Files
deepseek-harness/packages/client/locale/src/locale-settings.ts
Yichen Jiang 53c66ecbeb 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.
2026-08-07 23:30:04 +08:00

27 lines
972 B
TypeScript

/** Locale preference stored in the Host user-settings document. */
import z from 'schemastery'
/** Settings namespace owned by the locale plugin. */
export const LOCALE_SETTINGS_NAMESPACE = 'locale'
/** Field carrying an explicit locale selection; absence delegates to the browser. */
export const LOCALE_PREFERENCE_FIELD = 'preference'
/** Locale identifiers shipped by the browser client. */
export const LOCALE_IDS = ['zh', 'en'] as const
/** Shipped locale identifier. */
export type LocaleId = typeof LOCALE_IDS[number]
/** Durable locale section shared by the Host schema and the browser scope. */
export interface LocaleSettings {
/** Explicit locale selection; absence delegates to the browser. */
preference?: LocaleId
}
/** Durable locale schema; also the wire envelope the browser scope validates against. */
export const LocaleSettingsSchema: z<LocaleSettings> = z.object({
[LOCALE_PREFERENCE_FIELD]: z.union([...LOCALE_IDS]).required(false),
})