refactor(client): replace the per-field settings preference controller with a namespace settings scope

bindSettingsScope mirrors the Host-side settings owner seam in the browser:
one scope per namespace publishes a snapshot store (status, section value,
revision, writability, host/memory mode), validates sections against the
namespace's serialized wire schema via dsh-client-schema-form, and keeps the
controller's listener-before-read, revisioned serialized writes, latest-wins
publication, conflict recovery, and disposal quiescence. Theme, locale, and
busy-Enter services now take the scope as a constructor collaborator, which
removes the bindPersistence/syncPreference two-phase callback pair and the
defaulted no-op persist writers; hand-written wire guards fall away in favor
of the registered schema. test-runtime gains a stubSettingsScope double.
This commit is contained in:
Yichen Jiang
2026-08-07 23:25:42 +08:00
parent 6922a942a6
commit 638c9e4bd7
37 changed files with 926 additions and 617 deletions

View File

@@ -4,7 +4,6 @@ import { Settings, settingsNamespace, type SettingsNamespace } from '@deepseek-a
import {
CONVERSATION_SETTINGS_NAMESPACE, DEFAULT_BUSY_ENTER_BEHAVIOR, apply,
} from '@deepseek-ai/dsh-client-ui-conversation'
import { isBusyEnterBehavior } from '../src/submission-settings.ts'
class MemorySettings extends Settings {
readonly writable = true
@@ -15,12 +14,6 @@ class MemorySettings extends Settings {
}
describe('ui-conversation host', () => {
it('narrows settings-wire values to the supported behavior pair', () => {
expect(isBusyEnterBehavior('queue')).toBe(true)
expect(isBusyEnterBehavior('steer')).toBe(true)
expect(isBusyEnterBehavior('later')).toBe(false)
})
it('registers, validates, and disposes the durable busy-Enter preference', async () => {
const ctx = new Context()
await ctx.plugin(MemorySettings).await()