refactor(client): keep settings constants and schemas off the client contract surfaces

The /client entry of a UI plugin exports no values beyond what cordis
loading needs; the theme constants block returns to type-only re-exports,
the per-namespace schemas move into the shared *-settings modules instead
of widening the host entries, and same-package specs import those internals
directly per the export discipline in packages/client/AGENTS.md.
This commit is contained in:
Yichen Jiang
2026-08-07 23:30:04 +08:00
parent 638c9e4bd7
commit 53c66ecbeb
9 changed files with 28 additions and 39 deletions
+1 -10
View File
@@ -1,23 +1,14 @@
/** Host registration for browser conversation preferences. */
import type { Context } from 'cordis'
import z from 'schemastery'
import { settingsNamespace } from '@deepseek-ai/dsh-settings'
import {
BUSY_ENTER_BEHAVIORS, BUSY_ENTER_FIELD, CONVERSATION_SETTINGS_NAMESPACE,
DEFAULT_BUSY_ENTER_BEHAVIOR, type ConversationSettings,
} from './submission-settings.ts'
import { CONVERSATION_SETTINGS_NAMESPACE, ConversationSettingsSchema } from './submission-settings.ts'
export {
BUSY_ENTER_BEHAVIORS, BUSY_ENTER_FIELD, CONVERSATION_SETTINGS_NAMESPACE,
DEFAULT_BUSY_ENTER_BEHAVIOR, type BusyEnterBehavior, type ConversationSettings,
} from './submission-settings.ts'
/** Durable conversation schema; also the wire envelope the browser scope validates against. */
export const ConversationSettingsSchema: z<ConversationSettings> = z.object({
[BUSY_ENTER_FIELD]: z.union([...BUSY_ENTER_BEHAVIORS]).default(DEFAULT_BUSY_ENTER_BEHAVIOR),
})
/**
* Register the durable conversation section when a settings provider exists.
* @param ctx - Host context whose optional settings service owns the section.
@@ -1,5 +1,7 @@
/** Busy-Enter preference stored in the Host user-settings document. */
import z from 'schemastery'
/** Settings namespace owned by the conversation plugin. */
export const CONVERSATION_SETTINGS_NAMESPACE = 'ui-conversation'
@@ -20,3 +22,8 @@ export interface ConversationSettings {
/** Delivery mode for plain Enter while the addressed agent is busy. */
busyEnter: BusyEnterBehavior
}
/** Durable conversation schema; also the wire envelope the browser scope validates against. */
export const ConversationSettingsSchema: z<ConversationSettings> = z.object({
[BUSY_ENTER_FIELD]: z.union([...BUSY_ENTER_BEHAVIORS]).default(DEFAULT_BUSY_ENTER_BEHAVIOR),
})