@linxin666/dsh-liangshen 0.4.16 → 0.4.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","names":["css","Children","css","css"],"sources":["../../../packages/dsh-liangshen/src/client/LiangShenLever.tsx","../../../packages/dsh-liangshen/src/client/main-session.ts","../../../packages/dsh-liangshen/src/core/lever.ts","../../../packages/dsh-liangshen/src/client/lever-controller.ts","../../../packages/dsh-liangshen/src/client/LiangShenMark.tsx","../../../packages/dsh-liangshen/src/client/RangeBubble.tsx","../../../packages/dsh-liangshen/src/client/SegmentGroup.tsx","../../../packages/dsh-liangshen/src/client/PluginSettingsCard.tsx","../../../packages/dsh-liangshen/src/client/settings-form.ts","../../../packages/dsh-liangshen/src/client/LiangShenSettingsCard.tsx","../../../packages/dsh-liangshen/src/client/locales.ts","../../../packages/dsh-liangshen/src/client/plugin-card-seat.ts","../../../packages/dsh-liangshen/src/client/settings-entry-form.ts","../../../packages/dsh-liangshen/src/client/index.ts"],"sourcesContent":["/**\n * The homepage lever: a slot-machine arm beside the model selector.\n *\n * Pull it down and the session about to start becomes LiangShen mode; push it\n * up and the preset the user was on comes back. The arm tracks the real preset\n * (never a local guess), and the theatrical part — flash, shockwave, sparks,\n * and the three-language jackpot banner — plays only once the switch actually\n * landed, so a refused switch never celebrates.\n *\n * The component is pure: every fact and verb arrives through the injected face.\n * A pointer drag past {@link DRAG_THRESHOLD_PX} counts as a pull or a push; a\n * plain click or a keyboard activation toggles instead.\n */\n\nimport { useEffect, useRef, useState, useSyncExternalStore, type PointerEvent as ReactPointerEvent, type ReactElement } from 'react'\nimport type { LeverFace } from './lever-controller.ts'\nimport css from './LiangShenLever.module.css'\n\n/** Vertical travel that separates a pull or push from a plain click. */\nconst DRAG_THRESHOLD_PX = 14\n\n/** How long the burst overlay stays mounted, matching its CSS duration. */\nconst BURST_MS = 2200\n\n/** Jackpot lines that read the same in every language. */\nconst BINARY = '01001100 01001001 01000001 01001110 01000111'\nconst MORSE = '-.. . . .--. ... . . -.- / .... .- .-. -. . ... ...'\n\n/** One spark per spoke of the burst. */\nconst SPARKS = Array.from({ length: 14 }, (_, index) => index)\n\n/** Sync the hero preset chip above the composer so both controls always agree. */\nfunction syncHeroChip(label: string): void {\n try {\n if (typeof document === 'undefined') return\n const chip = document.querySelector<HTMLElement>('button[aria-haspopup=\"menu\"] span[class*=\"seatLabel\"]')\n ?? Array.from(document.querySelectorAll<HTMLElement>('button[aria-haspopup=\"menu\"] span')).find(s => s.className.includes('seatLabel'))\n if (chip && chip.textContent !== label) {\n chip.textContent = label\n }\n } catch {\n // Non-browser or detached element\n }\n}\n\n/** Slot entry for `conversation.input.right` (left of the model selector). */\nexport function LiangShenLever(face: LeverFace): ReactElement | null {\n const snapshot = useSyncExternalStore(face.store.subscribe, face.store.getSnapshot)\n const { state, restoreLabel, busy, error, burst } = snapshot\n const [burstKey, setBurstKey] = useState(0)\n const seen = useRef(burst)\n const drag = useRef<{ x: number, y: number, fired: boolean } | undefined>(undefined)\n const actionable = !busy && (state === 'on' || state === 'off')\n const on = state === 'on'\n const errorText = error === undefined\n ? undefined\n : error.kind === 'locked'\n ? face.t('lever.failed.locked')\n : error.kind === 'missing'\n ? face.t('lever.failed.missing')\n : error.kind === 'timeout'\n ? face.t('lever.failed.timeout')\n : face.t('lever.failed.failed', { reason: error.reason })\n\n // The burst is driven by the controller's counter, so a reload or a refresh\n // can never replay it and a refused switch can never start it.\n useEffect(() => {\n if (burst > seen.current) setBurstKey(burst)\n seen.current = burst\n }, [burst])\n\n useEffect(() => {\n if (burstKey === 0) return\n const timer = setTimeout(() => { setBurstKey(0) }, BURST_MS)\n return () => { clearTimeout(timer) }\n }, [burstKey])\n\n // Keep the hero preset chip above the composer in sync with the lever's selection\n const prevState = useRef(state)\n useEffect(() => {\n if (state === 'on') {\n syncHeroChip(face.t('lever.name'))\n } else if (prevState.current === 'on' && state === 'off' && restoreLabel !== '') {\n syncHeroChip(restoreLabel)\n }\n prevState.current = state\n }, [state, restoreLabel, face])\n\n // The lever exists only while the preset can still change, which is the\n // blank-session window: a started session reports `locked`, a deployment\n // without the preset reports `missing`, and both mean the row renders\n // nothing instead of a dead control in the composer of a running session.\n // An `on` lever with an empty restore label has nothing to return to either\n // (the roster supplies no other usable preset), so a push there would be the\n // same dead control: render nothing rather than a switch that eats gestures.\n if (state === 'locked' || state === 'missing' || (state === 'on' && restoreLabel === '')) return null\n\n const toggle = (): void => {\n if (!actionable) return\n if (on) face.push()\n else face.pull()\n }\n\n const onPointerDown = (event: ReactPointerEvent<HTMLButtonElement>): void => {\n if (!actionable) return\n drag.current = { x: event.clientX, y: event.clientY, fired: false }\n try {\n event.currentTarget.setPointerCapture?.(event.pointerId)\n } catch {\n // Defensive: some environments throw on pointer capture\n }\n }\n\n const onPointerMove = (event: ReactPointerEvent<HTMLButtonElement>): void => {\n const pending = drag.current\n if (pending === undefined || pending.fired) return\n const travelY = event.clientY - pending.y\n const travelX = event.clientX - pending.x\n if (Math.hypot(travelX, travelY) >= DRAG_THRESHOLD_PX) {\n pending.fired = true\n if (on) face.push()\n else face.pull()\n }\n }\n\n const onPointerUp = (): void => {\n const pending = drag.current\n drag.current = undefined\n // A drag already fired its verb; a click without travel still toggles.\n if (pending === undefined || pending.fired) return\n toggle()\n }\n\n return (\n <span\n className={css.lever}\n data-dsh-plugin=\"liangshen\"\n data-dsh-part=\"lever\"\n data-state={state}\n data-busy={busy ? 'true' : undefined}\n >\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={on}\n aria-label={face.t('lever.a11y')}\n aria-busy={busy}\n title={hint(face, state, restoreLabel)}\n className={css.control}\n disabled={!actionable}\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={onPointerUp}\n onPointerCancel={onPointerUp}\n // Keyboard and assistive activation arrives as a detail-less click;\n // pointer activation is already handled on pointerup.\n onClick={(event) => { if (event.detail === 0) toggle() }}\n >\n <span className={css.track} data-dsh-part=\"lever-track\" aria-hidden=\"true\">\n <svg className={css.arm} data-dsh-part=\"lever-arm\" viewBox=\"0 0 16 26\" aria-hidden=\"true\">\n <rect className={css.rod} x=\"6.5\" y=\"3.5\" width=\"3\" height=\"21\" rx=\"1.5\" />\n <circle className={css.knob} cx=\"8\" cy=\"4\" r=\"3.4\" />\n </svg>\n </span>\n <span className={css.readout}>{busy ? face.t('lever.busy') : on ? face.t('lever.state.on') : face.t('lever.state.off')}</span>\n </button>\n {errorText !== undefined && (\n <span className={css.error} role=\"status\" title={errorText}>{errorText}</span>\n )}\n {burstKey !== 0 && <Burst key={burstKey} face={face} />}\n </span>\n )\n}\n\n/** The hover hint: what this gesture would do right now. */\nfunction hint(face: LeverFace, state: string, restoreLabel: string): string {\n if (state === 'locked') return face.t('lever.hint.locked')\n if (state === 'missing') return face.t('lever.hint.missing')\n if (state === 'on') return face.t('lever.hint.push', { preset: restoreLabel === '' ? face.t('lever.state.off') : restoreLabel })\n return face.t('lever.hint.pull')\n}\n\n/** The jackpot overlay: flash, shockwave rings, sparks, and the banner. */\nfunction Burst({ face }: { face: LeverFace }): ReactElement {\n return (\n <span className={css.burst} data-dsh-part=\"lever-burst\" aria-hidden=\"true\">\n <span className={css.flash} />\n <span className={css.ring} />\n <span className={css.ring} />\n <span className={css.ring} />\n <span className={css.banner} data-dsh-part=\"lever-banner\">\n <span className={css.bannerName}>{face.t('lever.name')}</span>\n <span className={css.line}>{face.t('burst.line1')}</span>\n <span className={css.line}>{face.t('burst.line2')}</span>\n <span className={css.code}>{BINARY}</span>\n <span className={css.code}>{MORSE}</span>\n </span>\n <span className={css.sparks}>\n {SPARKS.map(spoke => (\n // `rotate` is its own property so the keyframes' translate runs along\n // the spoke after the rotation composes with it.\n <i key={spoke} className={css.spark} style={{ rotate: `${spoke * (360 / SPARKS.length)}deg` }} />\n ))}\n </span>\n </span>\n )\n}\n","// Generated by scripts/sync-shared.mjs from shared/client/main-session.ts. Do not edit this copy; edit the shared source and run \"node scripts/sync-shared.mjs\".\n/**\n * Main-view Session derivation for the multi-instance Client Session model.\n *\n * The Client Session Controller carries no global \"current\" selection: view\n * selection belongs to the workspace UI, which owns the main-area reference and\n * publishes it through the catalog's per-source ownership counts\n * (`SessionSummary.retainedBy.mainView`). A plugin that needs the Session the\n * main view shows derives it from that marker instead of the removed\n * `SessionListState.current` field.\n *\n * The marker describes view ownership, not authority. It is the right input for\n * presentation and for deciding which view a navigation targets; it is not a\n * business fallback, because source counts never imply visibility or success.\n * @module dsh-web/shared/main-session\n */\n\n/** The catalog row subset this helper reads (a `SessionSummary` projection). */\nexport interface MainViewOwnedRow<Id extends string = string> {\n /** Catalog row identity. */\n readonly id: Id\n /** Per-source local ownership counts; absent rows are never owned. */\n readonly retainedBy?: Readonly<Partial<Record<string, number>>> | undefined\n}\n\n/**\n * Resolve the Session the main view currently shows.\n *\n * Reads the catalog's rows rather than a per-id retain-info source: ownership\n * counts ride the list snapshot, so this neither allocates observers nor opens\n * history, and a subscription to the list still fires when the selection moves.\n * @param byId - the session catalog's rows (`SessionListState.byId`), when available.\n * @returns the main-view session id, or undefined when the main view shows none.\n */\nexport function mainViewSessionId<Id extends string>(\n byId: Readonly<Record<Id, MainViewOwnedRow<Id> | undefined>> | undefined | null,\n): Id | undefined {\n if (byId === undefined || byId === null) return undefined\n for (const row of Object.values<MainViewOwnedRow<Id> | undefined>(byId)) {\n if (row !== undefined && (row.retainedBy?.mainView ?? 0) > 0) return row.id\n }\n return undefined\n}\n","/**\n * LiangShen lever logic — framework-free, no DOM, compiled by both programs.\n *\n * The lever is a homepage control beside the model selector: pulling it down\n * turns the current session's preset into LiangShen mode, pushing it up\n * restores the preset the user was on before. The facts it needs are the\n * current session's preset, whether that session may still change preset at\n * all, and the preset roster; the decisions are pure so they can be tested\n * without the browser runtime.\n *\n * A preset is fixed once a session starts (the host refuses the switch with\n * `agent-preset/locked`), so the lever is only meaningful while the session is\n * blank — which is exactly the new-session screen it renders on.\n */\n\n/** The preset id this lever turns on; also the preset directory name. */\nexport const LIANGSHEN_PRESET_ID = 'liangshen'\n\n/** What the lever currently reports. */\nexport type LeverState =\n /** LiangShen mode is the current preset. */\n | 'on'\n /** Another preset is current and the session may still switch. */\n | 'off'\n /** The session has started; the preset can no longer change. */\n | 'locked'\n /** The deployment does not supply the LiangShen preset. */\n | 'missing'\n\n/** The facts one lever decision reads. */\nexport interface LeverFacts {\n /** Whether the current session may still change preset (blank). */\n blank: boolean\n /** The preset the current session runs, when the session reports one. */\n agentPreset?: string\n /** Ids every usable roster row supplies, in roster order. */\n available: readonly string[]\n /** The deployment default preset id, when the roster names one. */\n fallback?: string\n /** The preset the user ran before the last pull-down, remembered by the client. */\n previous?: string\n}\n\n/** Resolve what the lever shows for one set of facts. */\nexport function leverState(facts: LeverFacts): LeverState {\n if (!facts.available.includes(LIANGSHEN_PRESET_ID)) return 'missing'\n if (!facts.blank) return 'locked'\n return facts.agentPreset === LIANGSHEN_PRESET_ID ? 'on' : 'off'\n}\n\n/**\n * The preset a push-up restores: the preset the user was on before pulling the\n * lever, else the deployment default, else the first usable roster row that is\n * not the LiangShen preset. A candidate is skipped when it is the LiangShen\n * preset itself (restoring it would be a no-op) or when the roster no longer\n * supplies it. That last resort is what keeps the push direction alive when the\n * deployment default IS LiangShen mode: `fallback` is skipped then, and after a\n * reload `previous` is gone, so without it the gesture would have no target.\n */\nexport function restoreTarget(facts: LeverFacts): string | undefined {\n for (const candidate of [facts.previous, facts.fallback]) {\n if (candidate === undefined || candidate === LIANGSHEN_PRESET_ID) continue\n if (facts.available.includes(candidate)) return candidate\n }\n return facts.available.find(candidate => candidate !== LIANGSHEN_PRESET_ID)\n}\n\n/** Whether the lever can act at all in its current state. */\nexport function isActionable(state: LeverState): boolean {\n return state === 'on' || state === 'off'\n}\n","/**\n * Lever controller: the business face behind the homepage lever.\n *\n * The view stays pure; every fact and verb comes from here. The roster arrives\n * over the agent-preset Remote namespace (the same one the official surfaces\n * read), the main-view session comes from the catalog's ownership marker, and the\n * switch goes through `agentPresets.select`, which the host accepts only while\n * the session is still blank.\n *\n * Nothing is cached across reloads except in memory: the lever reads the\n * session's `agentPreset` projection, so a page reload still shows the true\n * state, while `previous` (the preset a push-up restores) is remembered for\n * the length of the page visit and otherwise falls back to the deployment\n * default.\n */\n\nimport type { Context as ClientContext } from '@deepseek-ai/cordis'\nimport type { AgentPresetRoster } from '@deepseek-ai/dsh-agent-preset-registry/types'\nimport type { ISessions } from '@deepseek-ai/dsh-api-session-controller/client'\nimport { mainViewSessionId } from './main-session.ts'\nimport type { RemoteResult } from '@deepseek-ai/dsh-api-remotes/client'\nimport { createSnapshotStore, type SnapshotStore } from '@deepseek-ai/dsh-client-store'\nimport { LIANGSHEN_PRESET_ID, isActionable, leverState, restoreTarget, type LeverFacts, type LeverState } from '../core/lever.ts'\nimport type { LiangShenKey } from './locales.ts'\n\n/**\n * Why the last switch was refused, mapped from the Remote failure code so the\n * view can render localized copy instead of a host message.\n */\nexport type LeverError =\n /** The session already started; its composition is fixed. */\n | { kind: 'locked' }\n /** The deployment supplies no such preset. */\n | { kind: 'missing' }\n /**\n * The switch outlived its ceiling. A Remote answer can be lost on the way\n * back even though the host committed the change, so the lever must stop\n * claiming to be busy and let the next session read report the truth.\n */\n | { kind: 'timeout' }\n /** Anything else, carrying the host's own reason. */\n | { kind: 'failed'; reason: string }\n\n/** How long one preset switch may stay in flight before it is reported as timed out. */\nexport const SELECT_TIMEOUT_MS = 10_000\n\n/**\n * Settings entry ids whose writes can move the roster this lever reads: the\n * agent-preset registry's own entry (its default and selection policy) and this\n * plugin's row under either install shape — the aggregate's generated row id\n * and the standalone row id — because disabling the plugin unregisters the\n * preset it declares.\n */\nexport const ROSTER_SETTINGS_ENTRY_IDS: readonly string[] = ['agent-preset-registry', 'web-ui-liangshen', 'liangshen']\n\n/** What the lever view renders. */\nexport interface LeverSnapshot {\n /** Resolved lever state. */\n state: LeverState\n /** Display name of the preset a push-up restores; empty when there is none. */\n restoreLabel: string\n /** A switch is in flight. */\n busy: boolean\n /** The last refusal, cleared by the next attempt. */\n error?: LeverError\n /** Increments when a pull-down landed, so the view replays the burst once. */\n burst: number\n}\n\n/**\n * The two agent-preset Remote calls this plugin makes. Spelled locally: the\n * generated namespace merge belongs to the SDK's own client packages, and this\n * browser bundle only needs the two members it calls.\n */\nexport interface AgentPresetRemote {\n list(): Promise<RemoteResult<AgentPresetRoster>>\n select(sessionId: string, agentPreset: string): Promise<RemoteResult<string>>\n}\n\n/** The injected face the lever view consumes. */\nexport interface LeverFace {\n /** The snapshot store the view subscribes to. */\n store: SnapshotStore<LeverSnapshot>\n /** Pull the lever down: turn LiangShen mode on. */\n pull: () => void\n /** Push the lever up: restore the previous preset. */\n push: () => void\n /** Translate one lever key. */\n t: (key: LiangShenKey, vars?: Record<string, string | number>) => string\n}\n\n/** Read the preset a session summary reports, when it reports one. */\nfunction presetOf(session: { projectionValues?: Record<string, unknown> } | undefined): string | undefined {\n const value = session?.projectionValues?.['agentPreset']\n return typeof value === 'string' ? value : undefined\n}\n\n/** The lever controller: roster read, session facts, and the preset switch. */\nexport class LeverController {\n private readonly store: SnapshotStore<LeverSnapshot>\n\n /**\n * The browser services this controller reads, resolved defensively: the\n * context proxy throws on any service the fiber did not inject, so a\n * deployment that cannot answer one of them must leave the lever inert\n * rather than take the plugin (and the composer row) down with it.\n */\n private readonly sessions: ISessions | undefined\n\n private readonly remote: AgentPresetRemote | undefined\n\n /** Roster rows as last read; empty until the first read lands. */\n private rows: AgentPresetRoster['presets'] = []\n\n /** The preset the user was on before the last pull-down. */\n private previous: string | undefined\n\n private loading = false\n\n /** Ceiling on one in-flight switch, so a lost Remote answer cannot hang the row. */\n private readonly selectTimeoutMs: number\n\n private readonly disposers: (() => void)[] = []\n\n constructor(private readonly ctx: ClientContext, options: LeverControllerOptions = {}) {\n this.selectTimeoutMs = options.selectTimeoutMs ?? SELECT_TIMEOUT_MS\n this.sessions = readService<ISessions>(() => (ctx as unknown as { sessions: ISessions }).sessions)\n this.remote = readService<AgentPresetRemote>(\n () => (ctx as unknown as { remote: { agentPresets: AgentPresetRemote } }).remote.agentPresets,\n )\n this.store = createSnapshotStore<LeverSnapshot>({\n state: 'off',\n restoreLabel: '',\n busy: false,\n burst: 0,\n })\n }\n\n /** The snapshot store the view subscribes to. */\n snapshot(): SnapshotStore<LeverSnapshot> {\n return this.store\n }\n\n /** Follow the roster and the current session, then read the roster once. */\n start(): void {\n const list = this.sessions?.list\n if (list !== undefined) {\n this.disposers.push(list.subscribe(() => { this.refresh() }))\n }\n const remote = readService<{ $on?: (event: string, listener: (ns: string) => void) => () => void }>(\n () => (this.ctx as unknown as { remote: { $on: (event: string, listener: (ns: string) => void) => () => void } }).remote,\n )\n if (typeof remote?.$on === 'function') {\n this.disposers.push(remote.$on('settings/document-updated', (ns: string) => {\n if (ROSTER_SETTINGS_ENTRY_IDS.includes(ns)) void this.load()\n }))\n }\n this.refresh()\n if (this.remote !== undefined) void this.load()\n }\n\n /** Release every subscription. Idempotent. */\n dispose(): void {\n for (const dispose of this.disposers.splice(0)) dispose()\n }\n\n /** The inject face handed to the slot entry. */\n face(): LeverFace {\n return {\n store: this.store,\n pull: () => { void this.toggle('down') },\n push: () => { void this.toggle('up') },\n t: (key, vars) => {\n const translate = readService<(key: LiangShenKey, vars?: Record<string, string | number>) => string>(\n () => this.ctx.locale.bind('liangshen'),\n )\n return translate === undefined ? key : translate(key, vars)\n },\n }\n }\n\n /** Read the roster; a refusal leaves the lever as it was. */\n async load(): Promise<void> {\n if (this.loading) return\n const remote = this.remote\n if (remote === undefined) return\n this.loading = true\n try {\n const result = await remote.list()\n if (result.ok) this.rows = result.value.presets\n } catch {\n // A carrier failure leaves the roster empty; the view reports `missing`.\n } finally {\n this.loading = false\n this.refresh()\n }\n }\n\n /**\n * Recompute the snapshot from the current session and the last roster read.\n * Only the derived fields are written: an in-flight switch, the last refusal,\n * and the burst counter belong to the gesture, not to a session refresh.\n */\n refresh(): void {\n const facts = this.facts()\n const snapshot = this.store.getSnapshot()\n const state = leverState(facts)\n const target = restoreTarget(facts)\n const restoreLabel = target === undefined ? '' : this.labelOf(target)\n if (snapshot.state === state && snapshot.restoreLabel === restoreLabel) return\n this.store.set({ ...snapshot, state, restoreLabel })\n }\n\n /** The verb behind one gesture direction. */\n private async toggle(direction: 'down' | 'up'): Promise<void> {\n const snapshot = this.store.getSnapshot()\n if (snapshot.busy) return\n const remote = this.remote\n if (remote === undefined) return\n const facts = this.facts()\n if (!isActionable(leverState(facts))) return\n const target = direction === 'down' ? LIANGSHEN_PRESET_ID : restoreTarget(facts)\n const sessionId = this.currentSessionId()\n if (target === undefined || sessionId === undefined) return\n if (facts.agentPreset === target) {\n // Already there: a gesture on the current state is a no-op, not a switch.\n this.refresh()\n return\n }\n this.store.set({ ...snapshot, busy: true, error: undefined })\n let result: RemoteResult<string>\n try {\n result = await withTimeout(remote.select(sessionId, target), this.selectTimeoutMs)\n } catch (error) {\n // A timeout is its own copy: the host may well have committed the change\n // even though its answer never arrived, so this reports the wait, and the\n // next session read (or the next gesture) shows what actually happened.\n const mapped: LeverError = error instanceof SwitchTimeout\n ? { kind: 'timeout' }\n : { kind: 'failed', reason: message(error) }\n this.store.set({ ...this.store.getSnapshot(), busy: false, error: mapped })\n this.refresh()\n return\n }\n if (!result.ok) {\n this.store.set({ ...this.store.getSnapshot(), busy: false, error: refusal(result.error) })\n this.refresh()\n return\n }\n // The switch landed: remember where to return, then celebrate only the\n // pull that turned the mode on.\n if (direction === 'down') {\n const prev = facts.agentPreset ?? this.detectPreset()\n if (prev !== undefined && prev !== LIANGSHEN_PRESET_ID) {\n this.rememberPrevious(prev)\n }\n }\n const next = this.store.getSnapshot()\n this.store.set({ ...next, busy: false, error: undefined, burst: direction === 'down' ? next.burst + 1 : next.burst })\n this.refresh()\n }\n\n /**\n * Try to detect the active preset from the DOM hero chip or storage\n * when session.projectionValues.agentPreset is absent.\n */\n private detectPreset(): string | undefined {\n try {\n if (typeof document !== 'undefined') {\n const chip = document.querySelector<HTMLElement>('button[aria-haspopup=\"menu\"] span[class*=\"seatLabel\"]')\n ?? Array.from(document.querySelectorAll<HTMLElement>('button[aria-haspopup=\"menu\"] span')).find(s => s.className.includes('seatLabel'))\n const text = chip?.textContent?.trim()\n if (text) {\n const matched = this.rows.find(row => (row.name === text || row.id === text) && row.id !== LIANGSHEN_PRESET_ID)\n if (matched) return matched.id\n }\n }\n } catch {\n // Defensive\n }\n\n try {\n if (typeof sessionStorage !== 'undefined') {\n const stored = sessionStorage.getItem('dsh-liangshen:previous-preset')\n if (stored && stored !== LIANGSHEN_PRESET_ID && this.rows.some(r => r.id === stored)) {\n return stored\n }\n }\n } catch {\n // Defensive\n }\n\n return undefined\n }\n\n private rememberPrevious(presetId: string | undefined): void {\n if (presetId === undefined || presetId === LIANGSHEN_PRESET_ID) return\n this.previous = presetId\n try {\n if (typeof sessionStorage !== 'undefined') {\n sessionStorage.setItem('dsh-liangshen:previous-preset', presetId)\n }\n } catch {\n // Defensive\n }\n }\n\n /** The facts one decision reads, from the live session and the roster. */\n private facts(): LeverFacts {\n const summary = this.currentSession()\n const available = this.rows.filter(row => row.broken === undefined).map(row => row.id)\n const fallback = this.rows.find(row => row.isDefault)?.id\n const currentPreset = presetOf(summary)\n\n if (currentPreset !== undefined && currentPreset !== LIANGSHEN_PRESET_ID) {\n this.rememberPrevious(currentPreset)\n }\n\n const previous = this.previous ?? this.detectPreset()\n\n return {\n blank: summary?.blank === true,\n agentPreset: currentPreset,\n available,\n fallback,\n previous,\n }\n }\n\n private currentSessionId(): string | undefined {\n return mainViewSessionId(this.sessions?.list.getSnapshot().byId)\n }\n\n private currentSession(): { blank?: boolean, projectionValues?: Record<string, unknown> } | undefined {\n const state = this.sessions?.list.getSnapshot()\n const current = mainViewSessionId(state?.byId)\n if (state === undefined || current === undefined) return undefined\n return state.byId[current] as unknown as { blank?: boolean, projectionValues?: Record<string, unknown> } | undefined\n }\n\n /** Display name of one preset id, falling back to the id itself. */\n private labelOf(id: string): string {\n const row = this.rows.find(candidate => candidate.id === id)\n return row?.name ?? id\n }\n}\n\n/** The face constructor options; tests narrow the switch ceiling. */\nexport interface LeverControllerOptions {\n /** Override {@link SELECT_TIMEOUT_MS}. */\n selectTimeoutMs?: number\n}\n\n/** Raised when one switch outlives {@link SELECT_TIMEOUT_MS}. */\nclass SwitchTimeout extends Error {\n constructor() {\n super('the preset switch did not answer in time')\n this.name = 'SwitchTimeout'\n }\n}\n\n/** Resolve with `work`, or reject with a {@link SwitchTimeout} after `ms`. */\nfunction withTimeout<T>(work: Promise<T>, ms: number): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n const timer = setTimeout(() => { reject(new SwitchTimeout()) }, ms)\n work.then(\n (value) => { clearTimeout(timer); resolve(value) },\n (error: unknown) => { clearTimeout(timer); reject(error instanceof Error ? error : new Error(String(error))) },\n )\n })\n}\n\n/**\n * Read one context service, treating the proxy's \"without inject\" refusal (and\n * any other resolution fault) as the service being absent.\n */\nfunction readService<T>(read: () => T): T | undefined {\n try {\n return read()\n } catch {\n return undefined\n }\n}\n\n/** The host's own reason for a refusal, mapped to lever copy. */\nfunction refusal(error: { code?: string, message?: string, details?: unknown }): LeverError {\n if (error.code === 'agent-preset/locked') return { kind: 'locked' }\n if (error.code === 'agent-preset/not-found') return { kind: 'missing' }\n const details = error.details\n if (typeof details === 'object' && details !== null && typeof (details as { reason?: unknown }).reason === 'string') {\n return { kind: 'failed', reason: (details as { reason: string }).reason }\n }\n return { kind: 'failed', reason: error.message ?? error.code ?? 'unknown' }\n}\n\nfunction message(error: unknown): string {\n return error instanceof Error ? error.message : String(error)\n}\n","/**\n * Card mark for the LiangShen settings entry: the mode's machine is a\n * slot-machine lever, so the mark is that lever reduced to one knob, one arm\n * and one pivot foot. Three rounded shapes with no interior detail stay\n * legible at 18px, and every shape is painted with `currentColor` so the mark\n * follows the surrounding theme like the lever itself does.\n */\n\nimport type { ReactElement } from 'react'\n\n/**\n * Render the LiangShen card mark.\n * @returns the 18x18 lever mark, in the current text color.\n */\nexport function LiangShenMark(): ReactElement {\n return (\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 18 18\" fill=\"none\" aria-hidden=\"true\">\n <rect x=\"3.6\" y=\"13.2\" width=\"8.8\" height=\"2.8\" rx=\"1.4\" fill=\"currentColor\" />\n <g transform=\"rotate(20 8 14.4)\">\n <rect x=\"6.5\" y=\"4.6\" width=\"3\" height=\"9.8\" rx=\"1.5\" fill=\"currentColor\" />\n <circle cx=\"8\" cy=\"4.4\" r=\"2.9\" fill=\"currentColor\" />\n </g>\n </svg>\n )\n}\n","// Generated by scripts/sync-shared.mjs from shared/client/settings/RangeBubble.tsx. Do not edit this copy; edit the shared source and run \"node scripts/sync-shared.mjs\".\n/**\n * Coarse adjustment for a bounded number: resting the pointer on the control\n * (or moving focus into it) raises a small bubble holding a slider across the\n * field's whole range, so a large change is one drag instead of many presses\n * or a retyped value. The control itself stays the precise entry.\n *\n * The bubble belongs to the anchor's subtree, so moving from the control onto\n * the bubble never counts as leaving. It opens after a short rest and closes a\n * moment after the pointer and focus have both gone, so crossing the control\n * on the way elsewhere does not flash it. While a drag is in progress the\n * bubble stays put even if the pointer strays off it.\n *\n * Dragging reports each value through `onInput`, so the field shows it live;\n * releasing the thumb, or a key press on it, reports `onCommit` once. The\n * bubble opens on the side of the control that has room inside the nearest\n * scrolling ancestor, so a row near the top of a settings page does not hang\n * its bubble under the page edge.\n */\n\nimport { useEffect, useRef, useState, type ChangeEvent, type CSSProperties, type KeyboardEvent, type ReactNode } from 'react'\nimport css from './settings-card.module.css'\n\n/** Rest on the control before the bubble opens. */\nconst OPEN_DELAY_MS = 220\n/** Grace after pointer and focus have left before the bubble closes. */\nconst CLOSE_DELAY_MS = 200\n/** Room the bubble needs between the control and the scroller's edge. */\nconst BUBBLE_ROOM_PX = 64\n\n/** Props of {@link RangeBubble}. */\nexport interface RangeBubbleProps {\n /** Lowest value the slider reaches. */\n min: number\n /** Highest value the slider reaches. */\n max: number\n /** Slider granularity. */\n step: number\n /** Current value; a value outside the range parks the thumb at the nearer end. */\n value: number\n /** Accessible name of the slider. */\n label: string\n /** Disables the bubble along with the control. */\n disabled?: boolean\n /** Each value while the thumb moves. */\n onInput: (value: number) => void\n /** The value the thumb was released on, once per drag or key press. */\n onCommit: (value: number) => void\n /** The precise control the bubble hangs off. */\n children: ReactNode\n}\n\n/** The nearest ancestor that scrolls vertically, or the viewport's root. */\nfunction scroller(node: HTMLElement): HTMLElement {\n for (let parent = node.parentElement; parent !== null; parent = parent.parentElement) {\n const overflow = getComputedStyle(parent).overflowY\n if (overflow === 'auto' || overflow === 'scroll') return parent\n }\n return node.ownerDocument.documentElement\n}\n\n/**\n * Render the control with its coarse-adjustment bubble.\n * @param props - the range, the value and the two report callbacks.\n * @returns the anchor holding the control and the bubble.\n */\nexport function RangeBubble(props: RangeBubbleProps): ReactNode {\n const { min, max, step, disabled = false } = props\n const [open, setOpen] = useState(false)\n const [side, setSide] = useState<'above' | 'below'>('above')\n const [live, setLive] = useState<number | null>(null)\n const anchorRef = useRef<HTMLDivElement | null>(null)\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined)\n const hovered = useRef(false)\n const focused = useRef(false)\n const dragging = useRef(false)\n\n useEffect(() => () => { clearTimeout(timer.current) }, [])\n useEffect(() => {\n if (disabled) {\n clearTimeout(timer.current)\n setOpen(false)\n }\n }, [disabled])\n\n const show = (): void => {\n const anchor = anchorRef.current\n if (anchor !== null) {\n const room = anchor.getBoundingClientRect().top - scroller(anchor).getBoundingClientRect().top\n setSide(room >= BUBBLE_ROOM_PX ? 'above' : 'below')\n }\n setOpen(true)\n }\n const schedule = (): void => {\n clearTimeout(timer.current)\n if (disabled) return\n if (hovered.current || focused.current || dragging.current) {\n if (!open) timer.current = setTimeout(show, focused.current ? 0 : OPEN_DELAY_MS)\n return\n }\n timer.current = setTimeout(() => { setOpen(false) }, CLOSE_DELAY_MS)\n }\n\n const commit = (value: number): void => {\n dragging.current = false\n setLive(null)\n props.onCommit(value)\n schedule()\n }\n const onChange = (event: ChangeEvent<HTMLInputElement>): void => {\n const value = Number(event.target.value)\n setLive(value)\n props.onInput(value)\n }\n const onKeyUp = (event: KeyboardEvent<HTMLInputElement>): void => {\n if (live !== null) commit(live)\n if (event.key === 'Escape') {\n clearTimeout(timer.current)\n setOpen(false)\n }\n }\n const shown = live ?? Math.min(max, Math.max(min, props.value))\n\n return (\n <div\n ref={anchorRef}\n className={css.rangeAnchor}\n onPointerEnter={() => { hovered.current = true; schedule() }}\n onPointerLeave={() => { hovered.current = false; schedule() }}\n onFocus={() => { focused.current = true; schedule() }}\n onBlur={(event) => {\n if (event.currentTarget.contains(event.relatedTarget as Node | null)) return\n focused.current = false\n if (live !== null) commit(live)\n else schedule()\n }}\n >\n {props.children}\n <div className={css.rangeBubble} data-open={open ? '' : undefined} data-side={side}>\n <input\n type=\"range\"\n className={css.rangeSlider}\n min={min}\n max={max}\n step={step}\n value={shown}\n aria-label={props.label}\n tabIndex={open ? 0 : -1}\n disabled={disabled}\n style={{ '--range-fill': `${((shown - min) / (max - min)) * 100}%` } as CSSProperties}\n onPointerDown={() => { dragging.current = true }}\n onPointerUp={(event) => { commit(Number(event.currentTarget.value)) }}\n onPointerCancel={(event) => { commit(Number(event.currentTarget.value)) }}\n onChange={onChange}\n onKeyUp={onKeyUp}\n />\n <span className={css.rangeEnds} aria-hidden=\"true\">\n <span>{min}</span>\n <span>{max}</span>\n </span>\n </div>\n </div>\n )\n}\n","// Generated by scripts/sync-shared.mjs from shared/client/settings/SegmentGroup.tsx. Do not edit this copy; edit the shared source and run \"node scripts/sync-shared.mjs\".\n/**\n * The family's segmented control: a quiet track whose options share one\n * highlight that slides to the pressed option, instead of each option fading\n * its own background out and the next one in. The settings fields' small\n * choices and the Web Extensions TAB strip both render through it, so the two\n * read as one control.\n *\n * The caller builds the option buttons and marks the pressed one with\n * `data-active`; the group measures that button after every render and writes\n * its box as four custom properties, and the stylesheet draws the highlight\n * there (`.segmentGroup[data-pill]::before`). Attribute and first placement\n * land in the same task, so the highlight appears in place and only later\n * changes slide. A ResizeObserver re-measures when the group or an option\n * changes size: a longer locale, a font arriving, a container growing, a\n * strip wrapping onto a second line.\n */\n\nimport { Children, useLayoutEffect, useRef, type HTMLAttributes, type ReactNode } from 'react'\nimport css from './settings-card.module.css'\n\n/** The attribute marking a group whose highlight has been placed. */\nconst PILL_ATTR = 'data-pill'\n/** The pressed option, relative to the group. */\nconst ACTIVE_SELECTOR = ':scope > [data-active]'\nconst PILL_PROPERTIES = ['--segment-pill-x', '--segment-pill-y', '--segment-pill-w', '--segment-pill-h'] as const\n\n/** Props of {@link SegmentGroup}: the track's own attributes and the option buttons. */\nexport interface SegmentGroupProps extends HTMLAttributes<HTMLDivElement> {\n /** The option buttons; the pressed one carries `data-active`. */\n children: ReactNode\n}\n\n/**\n * Write the highlight's box from the pressed option's box, or take the\n * highlight off when nothing is pressed or the group has no layout yet.\n * The two boxes are read in viewport pixels and turned back into the group's\n * own CSS pixels, so a dialog that opens through a scale transform still\n * lands the highlight on its option.\n */\nfunction placePill(group: HTMLElement): void {\n const item = group.querySelector<HTMLElement>(ACTIVE_SELECTOR)\n const box = group.getBoundingClientRect()\n if (item === null || group.offsetWidth === 0 || box.width === 0) {\n group.removeAttribute(PILL_ATTR)\n for (const property of PILL_PROPERTIES) group.style.removeProperty(property)\n return\n }\n const scale = box.width / group.offsetWidth\n const itemBox = item.getBoundingClientRect()\n const values = [\n (itemBox.left - box.left) / scale - group.clientLeft,\n (itemBox.top - box.top) / scale - group.clientTop,\n itemBox.width / scale,\n itemBox.height / scale,\n ]\n values.forEach((value, index) => {\n group.style.setProperty(PILL_PROPERTIES[index], `${Math.round(value * 100) / 100}px`)\n })\n if (!group.hasAttribute(PILL_ATTR)) group.setAttribute(PILL_ATTR, '')\n}\n\n/**\n * Render a segmented track around the caller's option buttons.\n * @param props - the track's attributes (role, accessible name, key handler) and its options.\n * @returns the track.\n */\nexport function SegmentGroup(props: SegmentGroupProps): ReactNode {\n const { children, className, ...rest } = props\n const group = useRef<HTMLDivElement | null>(null)\n const count = Children.count(children)\n\n // Placed before the frame is painted, after every render: a press moves the\n // pressed mark and the highlight follows it in the same frame.\n useLayoutEffect(() => {\n if (group.current !== null) placePill(group.current)\n })\n\n useLayoutEffect(() => {\n const element = group.current\n if (element === null || typeof ResizeObserver === 'undefined') return undefined\n const observer = new ResizeObserver(() => { placePill(element) })\n observer.observe(element)\n for (const item of Array.from(element.children)) observer.observe(item)\n return () => { observer.disconnect() }\n }, [count])\n\n return (\n <div {...rest} ref={group} className={className === undefined ? css.segmentGroup : `${css.segmentGroup} ${className}`}>\n {children}\n </div>\n )\n}\n","// Generated by scripts/sync-shared.mjs from shared/client/settings/PluginSettingsCard.tsx. Do not edit this copy; edit the shared source and run \"node scripts/sync-shared.mjs\".\n/**\n * Family-shared chrome for plugin settings cards: a disclosure header naming\n * the plugin and what its settings govern, the controls inside, and the line\n * that reports a refused write. A pick is written the moment it is made and a\n * typed value after a pause, so the card has no save button and nothing waits\n * on the reader. Renders nothing while the namespace is unavailable — a\n * deployment that does not compose the owning plugin should show no trace of\n * it. Inlined into each consumer's client bundle; mirrors the official\n * ui-plugin-config PluginCard in a self-contained slice.\n *\n * Every field inside the body is one settings row: the label and its hint on\n * the left, the control on the right, a hairline between two rows; a narrow\n * card stacks the control under the text (settings-card.module.css).\n */\n\nimport { createContext, useCallback, useContext, useEffect, useLayoutEffect, useRef, useState, type KeyboardEvent, type ReactNode } from 'react'\nimport type { CardShell } from './settings-form.ts'\nimport { RangeBubble } from './RangeBubble.tsx'\nimport { SegmentGroup } from './SegmentGroup.tsx'\nimport css from './settings-card.module.css'\n\n/** Copy keys the card chrome itself reads; every consumer locale carries this shared vocabulary. */\nexport const CARD_COPY_KEYS = [\n 'settings.collapse',\n 'settings.expand',\n 'settings.notExposed',\n 'settings.readOnly',\n 'settings.saveFailed',\n] as const\n\n/**\n * What a text field inside a card reaches without its plugin wiring it: write\n * the pending draft now (Enter, leaving the field) or put it back (Escape).\n * Picks need neither; they are written the moment they are made.\n */\nconst CardApply = createContext<{ commit(): void, revert(): void } | null>(null)\n\n/** Copy key the card chrome itself reads. */\nexport type CardCopyKey = (typeof CARD_COPY_KEYS)[number]\n\n/** Key domain for the plugin's own copy (inferred per consumer). */\nexport type SettingsCardKey<TKey extends string = string> = TKey | CardCopyKey\n\n/** Card chrome shared by every plugin settings card. */\nexport interface PluginSettingsCardProps<TKey extends string = string> {\n /** Locale reader for this card's copy. */\n t: (key: SettingsCardKey<TKey>, params?: Record<string, string | number>) => string\n /** Locale key of the plugin's name. */\n titleKey: TKey\n /** Locale key of the line describing what this plugin's settings govern. */\n descriptionKey: TKey\n /** Optional rich header description rendered instead of the plain t(descriptionKey) text (the plain text stays as the tooltip). */\n descriptionNode?: ReactNode\n /**\n * Locale key of the full sentence behind a shortened description: when\n * present, the header's native `title` takes this text while the visible\n * line keeps `descriptionKey`/`descriptionNode`, so a compact card can\n * compress the sentence without keeping a second visible copy of it.\n * Defaults to the description key.\n */\n descriptionTitleKey?: TKey\n /**\n * Optional leading mark identifying the plugin. A card without one keeps the\n * plain official header shape, so the chrome stays a readable sibling of the\n * built-in PluginCard wherever a family plugin lands in the official bundle\n * seat.\n */\n icon?: ReactNode\n /** The card's form state: availability, writability, and how the last write went. */\n state: CardShell\n /** Write every pending draft now: a text field's Enter or blur. */\n onSave: () => void\n /** Drop every pending draft: a text field's Escape. */\n onDiscard: () => void\n /**\n * Id applied to the card's title element, so a header control (an immediate\n * toggle in `headerAction`) can name itself through `aria-labelledby`\n * instead of repeating the title as a string.\n */\n titleId?: string\n /**\n * Render the header only, with no body region. A card whose whole setting is\n * the header control (a switch whose explanation is the description) has no\n * controls to lay out below it, and an empty body would draw a divider line\n * with nothing under it.\n */\n headerOnly?: boolean\n /**\n * Render the controls expanded on arrival (still collapsible). Defaults to\n * true: promoted first-level sections show their settings immediately.\n */\n defaultOpen?: boolean\n /**\n * Render without the collapse affordance: a static header and an always\n * visible body. Used by first-level settings sections whose nav entry\n * already provides the selection.\n */\n alwaysOpen?: boolean\n /**\n * Hide the line under the body that reports a refused write: a card whose\n * body applies its own changes (an embedded external settings section)\n * reports its own failures.\n */\n hideFooter?: boolean\n /**\n * Optional control rendered at the header's trailing edge, before the\n * chevron. A card whose setting is one immediate flip (it\n * applies outside the card's form) puts its ToggleSwitch here, so the control\n * is reachable without opening the card and matches a plugin card's shape.\n */\n headerAction?: ReactNode\n /**\n * Render children even when the settings namespace is not exposed by the\n * host. The 'not exposed' notice still explains the card above them; a card\n * that wants the rows alone hides it through `hideNotExposedNotice`.\n */\n renderChildrenWhenNotExposed?: boolean\n /** Hide the 'not exposed' notice, whichever branch renders the card body. */\n hideNotExposedNotice?: boolean\n /**\n * Compact chrome for a topic card rendered inside another card's body: a\n * smaller title, a tighter header and body inset, and a one-line description\n * whose full text stays on the header's own title. Defaults to the\n * first-level chrome, which is unchanged.\n */\n density?: 'nested'\n /** The plugin's controls. */\n children: ReactNode\n}\n\n/** Length of the body's disclosure motion; it matches `--settings-card-motion` on the card root. */\nconst BODY_MOTION_MS = 180\n\n/**\n * Lifecycle of one card body. `collapsed` is the mounted-but-closed frame the\n * enter leg starts from, `entering` and `closing` are the two moving legs, and\n * `shown` is the settled open body, which releases its clipping box.\n */\ntype BodyPhase = 'hidden' | 'collapsed' | 'entering' | 'shown' | 'closing'\n\n/**\n * Render one plugin settings card.\n * @param props - the plugin's copy keys, its form state, and its controls.\n * @returns the card, or nothing while the namespace is still loading.\n */\nexport function PluginSettingsCard<TKey extends string = string>(props: PluginSettingsCardProps<TKey>) {\n const [open, setOpen] = useState(props.defaultOpen ?? true)\n const { state, alwaysOpen } = props\n const expanded = alwaysOpen === true || open\n const [bodyPhase, setBodyPhase] = useState<BodyPhase>(expanded ? 'shown' : 'hidden')\n const bodyRef = useRef<HTMLDivElement | null>(null)\n // Enter and leave run the same pair: a body that should open is mounted\n // closed for one frame so its transition has a state to leave, and a closing\n // one stays mounted until its leg has run.\n useLayoutEffect(() => {\n if (expanded) {\n if (bodyPhase === 'hidden') setBodyPhase('collapsed')\n else if (bodyPhase === 'collapsed') {\n const node = bodyRef.current\n if (node !== null) void node.offsetHeight\n setBodyPhase('entering')\n } else if (bodyPhase === 'closing') setBodyPhase('entering')\n return\n }\n if (bodyPhase === 'collapsed') setBodyPhase('hidden')\n else if (bodyPhase === 'entering' || bodyPhase === 'shown') setBodyPhase('closing')\n }, [expanded, bodyPhase])\n useEffect(() => {\n if (bodyPhase !== 'entering' && bodyPhase !== 'closing') return\n const timer = setTimeout(() => {\n setBodyPhase(bodyPhase === 'entering' ? 'shown' : 'hidden')\n }, BODY_MOTION_MS)\n return () => { clearTimeout(timer) }\n }, [bodyPhase])\n if (!state.available) return null\n const title = props.t(props.titleKey)\n const description = props.t(props.descriptionKey)\n const descriptionTitle = props.descriptionTitleKey === undefined ? description : props.t(props.descriptionTitleKey)\n const baseClass = expanded ? `${css.cardOpen} ${css.card}` : css.card\n const cardClass = props.density === 'nested' ? `${baseClass} ${css.cardNested}` : baseClass\n /** The body region both legs share; a hidden phase renders nothing at all. */\n const bodyRegion = (content: ReactNode) => bodyPhase === 'hidden'\n ? null\n : (\n <div className={css.disclosure} data-state={bodyPhase} ref={bodyRef}>\n <div className={css.body}>{content}</div>\n </div>\n )\n // With alwaysOpen the nav entry already provides the selection, so the\n // header is a static title row instead of a disclosure button.\n const header = alwaysOpen === true\n ? (\n <div className={css.headerStatic}>\n {props.icon !== undefined ? <span className={css.mark} aria-hidden=\"true\">{props.icon}</span> : null}\n <span className={css.headText}>\n <span className={css.name} id={props.titleId} title={title}>{title}</span>\n <span className={css.description} title={descriptionTitle}>{props.descriptionNode ?? description}</span>\n </span>\n {props.headerAction !== undefined ? <span className={css.headerAction}>{props.headerAction}</span> : null}\n </div>\n )\n : (\n <button\n type=\"button\"\n className={css.header}\n aria-expanded={open}\n aria-label={`${props.t(open ? 'settings.collapse' : 'settings.expand')}: ${title}`}\n onClick={() => { setOpen(!open) }}\n >\n {props.icon !== undefined ? <span className={css.mark} aria-hidden=\"true\">{props.icon}</span> : null}\n <span className={css.headText}>\n <span className={css.name} id={props.titleId} title={title}>{title}</span>\n <span className={css.description} title={descriptionTitle}>{props.descriptionNode ?? description}</span>\n </span>\n {props.headerAction !== undefined ? <span className={css.headerAction}>{props.headerAction}</span> : null}\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 14 14\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className={open ? `${css.chevron} ${css.chevronOpen}` : css.chevron}\n >\n <path\n d=\"M11.8486 5.5L11.4238 5.92383L8.69727 8.65137C8.44157 8.90706 8.21562 9.13382 8.01172 9.29785C7.79912 9.46883 7.55595 9.61756 7.25 9.66602C7.08435 9.69222 6.91565 9.69222 6.75 9.66602C6.44405 9.61756 6.20088 9.46883 5.98828 9.29785C5.78438 9.13382 5.55843 8.90706 5.30273 8.65137L2.57617 5.92383L2.15137 5.5L3 4.65137L3.42383 5.07617L6.15137 7.80273C6.42595 8.07732 6.59876 8.24849 6.74023 8.3623C6.87291 8.46904 6.92272 8.47813 6.9375 8.48047C6.97895 8.48703 7.02105 8.48703 7.0625 8.48047C7.07728 8.47813 7.12709 8.46904 7.25977 8.3623C7.40124 8.24849 7.57405 8.07732 7.84863 7.80273L10.5762 5.07617L11 4.65137L11.8486 5.5Z\"\n fill=\"currentColor\"\n />\n </svg>\n </button>\n )\n // The namespace exists but the Host does not serve it to this client (the\n // official settings allowlist omits third-party namespaces): show a card\n // that explains the gap instead of vanishing, so a missing card never\n // reads as a missing plugin. A card that keeps its rows anyway keeps the\n // same explanation above them, unless it hides the notice outright.\n const notExposedNotice = state.exposed || props.hideNotExposedNotice === true\n ? null\n : <p className={css.notExposed} role=\"status\">{props.t('settings.notExposed')}</p>\n if (!state.exposed && props.renderChildrenWhenNotExposed !== true) {\n return (\n <li className={cardClass}>\n {header}\n {bodyRegion(notExposedNotice)}\n </li>\n )\n }\n // A header-only card has no body region at all: the divider would otherwise\n // sit above an empty box.\n const bodyVisible = props.headerOnly !== true\n return (\n <li className={cardClass}>\n {header}\n {bodyVisible\n ? bodyRegion(\n <>\n {notExposedNotice}\n {!state.writable ? <p className={css.readOnly} role=\"status\">{props.t('settings.readOnly')}</p> : null}\n <CardApply.Provider value={{ commit: props.onSave, revert: props.onDiscard }}>\n {props.children}\n </CardApply.Provider>\n {props.hideFooter !== true && state.failed\n ? (\n <p className={css.failed} role=\"status\">\n {props.t('settings.saveFailed')}{state.failedReason ? ' - ' + state.failedReason : ''}\n </p>\n )\n : null}\n </>,\n )\n : null}\n </li>\n )\n}\n\n/** Props every field control needs regardless of its value type. */\nexport interface FieldProps {\n /** Stable id associating the label with its control. */\n id: string\n /** Visible label. */\n label: string\n /** One-line explanation rendered under the control. */\n hint: string\n /**\n * Full sentence behind the visible hint, exposed as the paragraph's native\n * `title` so a card can shorten the line without losing the text. Omitted:\n * the paragraph carries no title attribute at all.\n */\n hintTitle?: string\n /** Draft text this control renders. */\n text: string\n /** True when the field holds a user-layer entry over the inherited value. */\n overridden: boolean\n /** True when the draft is not a value this field accepts. */\n invalid: boolean\n /** Copy for the overridden badge. */\n overriddenLabel: string\n /** Copy for the reset control. */\n resetLabel: string\n /** Copy shown in place of the hint while the draft is invalid. */\n invalidLabel: string\n /** Disables every control (read-only document, or an unavailable namespace). */\n disabled: boolean\n /** Take new draft text; the card writes it as the field's entry rule says. */\n onEdit: (text: string) => void\n /** Clear the field at once so it re-inherits the composition layer. */\n onReset: () => void\n}\n\n/**\n * A typed value field. Its draft is written after a pause in typing, at once on\n * Enter or when focus leaves, and Escape puts the stored value back. `numeric`\n * only hints the keypad: which drafts a field accepts is decided by its spec.\n * A field given a `range` also offers the coarse slider bubble: dragging fills\n * the draft live and releasing writes it.\n */\nexport function ValueField(props: FieldProps & {\n /** Hints a numeric keypad without narrowing what the control accepts. */\n numeric?: boolean\n /** Placeholder shown while the draft is empty. */\n placeholder?: string\n /** Bounds of a numeric field, for the coarse slider; the spec still judges every draft. */\n range?: { min: number, max: number, step: number }\n}) {\n const apply = useContext(CardApply)\n // Enter and Escape settle the draft themselves and then leave the field, so\n // the blur they cause is that same settlement reaching the field's edge, not\n // a second write. Without this an Escape reported a discard and then a save,\n // which reads to a consumer as a write still waiting to happen.\n const settledByKey = useRef(false)\n const onKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (apply === null || (event.key !== 'Enter' && event.key !== 'Escape')) return\n event.preventDefault()\n settledByKey.current = true\n if (event.key === 'Enter') apply.commit()\n else apply.revert()\n event.currentTarget.blur()\n }\n const input = (\n <input\n id={props.id}\n className={props.invalid ? css.inputInvalid : css.input}\n type=\"text\"\n {...props.numeric === true ? { inputMode: 'numeric' as const } : {}}\n {...props.invalid ? { 'aria-invalid': true } : {}}\n value={props.text}\n placeholder={props.placeholder ?? ''}\n disabled={props.disabled}\n onChange={(event) => { props.onEdit(event.target.value) }}\n onKeyDown={onKeyDown}\n onFocus={() => { settledByKey.current = false }}\n onBlur={() => {\n if (settledByKey.current) {\n settledByKey.current = false\n return\n }\n apply?.commit()\n }}\n />\n )\n const { range } = props\n const typed = Number(props.text)\n return (\n <div className={css.field}>\n <div className={css.head}>\n <label className={css.label} htmlFor={props.id}>{props.label}</label>\n {props.overridden\n ? (\n <span className={css.badges}>\n <span className={css.badge}>{props.overriddenLabel}</span>\n <button\n type=\"button\"\n className={css.reset}\n disabled={props.disabled}\n onClick={props.onReset}\n >\n {props.resetLabel}\n </button>\n </span>\n )\n : null}\n </div>\n {range === undefined\n ? input\n : (\n <RangeBubble\n min={range.min}\n max={range.max}\n step={range.step}\n value={props.text.trim() === '' || Number.isNaN(typed) ? range.min : typed}\n label={`${props.label} ${range.min}–${range.max}`}\n disabled={props.disabled}\n onInput={(value) => { props.onEdit(String(value)) }}\n onCommit={(value) => {\n props.onEdit(String(value))\n apply?.commit()\n }}\n >\n {input}\n </RangeBubble>\n )}\n <p className={props.invalid ? css.invalid : css.hint} title={props.hintTitle}>\n {props.invalid ? props.invalidLabel : props.hint}\n </p>\n </div>\n )\n}\n\nconst NON_SKIN_BODY_MARKERS = new Set(['dshSkinCenter', 'dshSidebarCollapsed'])\n// 检测使用使用皮肤,用了皮肤退回原生select样式,防止样式冲突。默认外观下使用优化后的select样式。\nfunction isSkinActive(): boolean {\n const datasetList = Object.keys(document.body.dataset)\n const isActive = datasetList.some(key => key.startsWith('dsh') && !NON_SKIN_BODY_MARKERS.has(key))\n return isActive\n}\n\ninterface SelectOption {\n value: string\n label: string\n}\n\nconst SELECT_CLOSE_MS = 100\n\n/**\n * The shared dual-mode select control. While an appearance skin is active it\n * renders the legacy native `<select>` untouched, so element-level skin\n * selectors keep working; under the default appearance it renders a\n * self-drawn `role=\"listbox\"` popup whose open/close is transition-animated.\n * Cards reach it through BooleanField/ChoiceField; editors outside a card\n * (the side-card prefs) bind it directly through onEdit.\n * 双模式下拉框:皮肤激活时用原生 select,默认外观用自绘动画弹层。\n */\nexport function SelectField(props: {\n id: string\n options: ReadonlyArray<SelectOption>\n value: string\n disabled: boolean\n invalid: boolean\n onEdit: (text: string) => void\n}) {\n const { id, options, value } = props\n const [open, setOpen] = useState(false)\n const [closing, setClosing] = useState(false)\n const [phase, setPhase] = useState<'initial' | 'open'>('initial')\n const [activeIndex, setActiveIndex] = useState(0)\n const closeTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined)\n const wrapRef = useRef<HTMLDivElement | null>(null)\n const popupRef = useRef<HTMLDivElement | null>(null)\n\n const currentIndex = () => {\n const index = options.findIndex(option => option.value === value)\n return index >= 0 ? index : 0\n }\n\n const close = useCallback(() => {\n if (closeTimer.current !== undefined) clearTimeout(closeTimer.current)\n setClosing(true)\n closeTimer.current = setTimeout(() => {\n setClosing(false)\n setOpen(false)\n }, SELECT_CLOSE_MS)\n }, [])\n\n const openPopup = () => {\n if (closeTimer.current !== undefined) clearTimeout(closeTimer.current)\n setActiveIndex(currentIndex())\n setPhase('initial')\n setClosing(false)\n setOpen(true)\n }\n\n const commit = (index: number) => {\n const option = options[index]\n if (option) props.onEdit(option.value)\n close()\n }\n\n const onTriggerClick = () => {\n if (props.disabled) return\n if (open && !closing) close()\n else openPopup()\n }\n\n const onKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n if (props.disabled) return\n const count = options.length\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowUp':\n case 'Enter':\n case ' ':\n event.preventDefault()\n if (!open) {\n openPopup()\n } else if (!closing) {\n if (event.key === 'ArrowDown') setActiveIndex(index => (index + 1) % count)\n else if (event.key === 'ArrowUp') setActiveIndex(index => (index - 1 + count) % count)\n else commit(activeIndex)\n }\n break\n case 'Escape':\n if (open) {\n event.preventDefault()\n event.stopPropagation()\n close()\n }\n break\n case 'Tab':\n if (open) close()\n break\n }\n }\n\n useEffect(() => () => {\n if (closeTimer.current !== undefined) clearTimeout(closeTimer.current)\n }, [])\n useLayoutEffect(() => {\n if (open && !closing && phase === 'initial') {\n void popupRef.current?.offsetHeight\n setPhase('open')\n }\n }, [open, closing, phase])\n\n useEffect(() => {\n if (!open) return\n const onPointerDown = (event: PointerEvent) => {\n const target = event.target\n if (target instanceof Node && !wrapRef.current?.contains(target)) close()\n }\n document.addEventListener('pointerdown', onPointerDown)\n return () => document.removeEventListener('pointerdown', onPointerDown)\n }, [open, close])\n\n useEffect(() => {\n if (props.disabled && open) close()\n }, [props.disabled, open, close])\n\n // 使用了皮肤则退回原生select样式防止样式冲突。\n if (isSkinActive()) {\n return (\n <select\n id={id}\n className={css.select}\n value={value}\n disabled={props.disabled}\n onChange={(event) => { props.onEdit(event.target.value) }}\n >\n {options.map(option => (\n <option key={option.value} value={option.value}>{option.label}</option>\n ))}\n </select>\n )\n }\n\n const label = options.find(option => option.value === value)?.label ?? ''\n const popupClass = closing\n ? `${css.selectPopup} ${css.selectPopupClose}`\n : phase === 'open'\n ? `${css.selectPopup} ${css.selectPopupOpen}`\n : css.selectPopup\n return (\n <div className={css.selectWrap} ref={wrapRef}>\n <button\n type=\"button\"\n id={id}\n className={`${css.select} ${css.selectButton}`}\n disabled={props.disabled}\n aria-haspopup=\"listbox\"\n aria-expanded={open}\n aria-activedescendant={open ? `${id}-o${activeIndex}` : undefined}\n aria-invalid={props.invalid || undefined}\n onClick={onTriggerClick}\n onKeyDown={onKeyDown}\n >\n <span className={css.selectLabel}>{label}</span>\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 14 14\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className={open ? `${css.selectChevron} ${css.selectChevronOpen}` : css.selectChevron}\n aria-hidden=\"true\"\n >\n <path\n d=\"M11.8486 5.5L11.4238 5.92383L8.69727 8.65137C8.44157 8.90706 8.21562 9.13382 8.01172 9.29785C7.79912 9.46883 7.55595 9.61756 7.25 9.66602C7.08435 9.69222 6.91565 9.69222 6.75 9.66602C6.44405 9.61756 6.20088 9.46883 5.98828 9.29785C5.78438 9.13382 5.55843 8.90706 5.30273 8.65137L2.57617 5.92383L2.15137 5.5L3 4.65137L3.42383 5.07617L6.15137 7.80273C6.42595 8.07732 6.59876 8.24849 6.74023 8.3623C6.87291 8.46904 6.92272 8.47813 6.9375 8.48047C6.97895 8.48703 7.02105 8.48703 7.0625 8.48047C7.07728 8.47813 7.12709 8.46904 7.25977 8.3623C7.40124 8.24849 7.57405 8.07732 7.84863 7.80273L10.5762 5.07617L11 4.65137L11.8486 5.5Z\"\n fill=\"currentColor\"\n />\n </svg>\n </button>\n {open\n ? (\n <div className={popupClass} role=\"listbox\" ref={popupRef}>\n {options.map((option, index) => (\n <div\n key={option.value}\n id={`${id}-o${index}`}\n role=\"option\"\n aria-selected={option.value === value}\n className={`${css.selectOption}${option.value === value ? ` ${css.selectOptionSelected}` : ''}${index === activeIndex && !closing ? ` ${css.selectOptionActive}` : ''}`}\n onClick={() => { commit(index) }}\n >\n {option.label}\n </div>\n ))}\n </div>\n )\n : null}\n </div>\n )\n}\n\n/**\n * A visible segmented group for a small set of mutually exclusive values.\n * Every option stays on screen, so inherit/on/off and short enum fields take\n * one click without opening a popup. The pressed option carries the group's\n * sliding highlight and `aria-pressed`; the group takes the field label as its\n * accessible name.\n */\nexport function SegmentField(props: {\n id: string\n label: string\n options: ReadonlyArray<SelectOption>\n value: string\n disabled: boolean\n invalid: boolean\n onEdit: (text: string) => void\n}) {\n return (\n <SegmentGroup\n id={props.id}\n role=\"group\"\n aria-label={props.label}\n aria-invalid={props.invalid || undefined}\n >\n {props.options.map((option, index) => {\n const active = option.value === props.value\n return (\n <button\n key={option.value}\n type=\"button\"\n className={css.segment}\n aria-pressed={active}\n disabled={props.disabled}\n data-active={active ? '' : undefined}\n data-segment-index={index}\n onClick={() => {\n if (!active) props.onEdit(option.value)\n }}\n >\n {option.label}\n </button>\n )\n })}\n </SegmentGroup>\n )\n}\n\n/** How a small single-choice field presents its options. */\nexport type FieldPresentation = 'select' | 'segment'\n\n/** A boolean field: 继承 / 开 / 关. */\nexport function BooleanField(props: FieldProps & {\n /** Copy for the inherit option. */\n inheritLabel: string\n /** Copy for the on option. */\n onLabel: string\n /** Copy for the off option. */\n offLabel: string\n /** Defaults to the visible segments: the three answers always fit on one row. */\n presentation?: FieldPresentation\n}) {\n const segmented = props.presentation !== 'select'\n return (\n <div className={css.field}>\n <div className={css.head}>\n {segmented\n ? <span className={css.label}>{props.label}</span>\n : <label className={css.label} htmlFor={props.id}>{props.label}</label>}\n {props.overridden\n ? (\n <span className={css.badges}>\n <span className={css.badge}>{props.overriddenLabel}</span>\n <button\n type=\"button\"\n className={css.reset}\n disabled={props.disabled}\n onClick={props.onReset}\n >\n {props.resetLabel}\n </button>\n </span>\n )\n : null}\n </div>\n {segmented\n ? (\n <SegmentField\n id={props.id}\n label={props.label}\n options={[\n { value: '', label: props.inheritLabel },\n { value: 'true', label: props.onLabel },\n { value: 'false', label: props.offLabel },\n ]}\n value={props.text}\n disabled={props.disabled}\n invalid={props.invalid}\n onEdit={props.onEdit}\n />\n )\n : (\n <SelectField\n id={props.id}\n options={[\n { value: '', label: props.inheritLabel },\n { value: 'true', label: props.onLabel },\n { value: 'false', label: props.offLabel },\n ]}\n value={props.text}\n disabled={props.disabled}\n invalid={props.invalid}\n onEdit={props.onEdit}\n />\n )}\n <p className={css.hint} title={props.hintTitle}>{props.hint}</p>\n </div>\n )\n}\n\n/** An enumerated field, selecting or segmenting its small choice set. */\nexport function ChoiceField(props: FieldProps & {\n /** Copy for the inherit option (draft text is the empty string). */\n inheritLabel: string\n /** Choices rendered in order; `value` is the draft/stored text. */\n choices: ReadonlyArray<{ value: string; label: string }>\n /**\n * Visible segmented options for a short fixed set; defaults to the compact\n * select, which also suits a list whose length follows the deployment.\n */\n presentation?: FieldPresentation\n}) {\n const segmented = props.presentation === 'segment'\n const options = [{ value: '', label: props.inheritLabel }, ...props.choices]\n return (\n <div className={css.field}>\n <div className={css.head}>\n {segmented\n ? <span className={css.label}>{props.label}</span>\n : <label className={css.label} htmlFor={props.id}>{props.label}</label>}\n {props.overridden\n ? (\n <span className={css.badges}>\n <span className={css.badge}>{props.overriddenLabel}</span>\n <button\n type=\"button\"\n className={css.reset}\n disabled={props.disabled}\n onClick={props.onReset}\n >\n {props.resetLabel}\n </button>\n </span>\n )\n : null}\n </div>\n {segmented\n ? (\n <SegmentField\n id={props.id}\n label={props.label}\n options={options}\n value={props.text}\n disabled={props.disabled}\n invalid={props.invalid}\n onEdit={props.onEdit}\n />\n )\n : (\n <SelectField\n id={props.id}\n options={options}\n value={props.text}\n disabled={props.disabled}\n invalid={props.invalid}\n onEdit={props.onEdit}\n />\n )}\n <p className={props.invalid ? css.invalid : css.hint} title={props.hintTitle}>\n {props.invalid ? props.invalidLabel : props.hint}\n </p>\n </div>\n )\n}\n\n/**\n * A boolean toggle drawn as a switch track, for a setting that is only on or\n * off and applies on flip. It is a real button with\n * `role=\"switch\"` and `aria-checked`, so keyboard and assistive activation\n * arrive as a click and the state is announced instead of inferred from a\n * checkbox tick.\n *\n * The thumb bounces across only once the reader has pressed this switch: the\n * press writes the mark that arms the bounce, so a page opening, a TAB\n * switching back or a value arriving from elsewhere draws every thumb at rest.\n */\nexport function ToggleSwitch(props: {\n /** Id of the element naming the switch (the card's title). */\n labelledBy?: string\n /** Accessible name when no element labels it. */\n ariaLabel?: string\n /** Current state. */\n checked: boolean\n /** Disables the switch while a write is in flight or the Host refuses writes. */\n disabled?: boolean\n /** Called with the requested next state. */\n onChange: (next: boolean) => void\n}) {\n const [moved, setMoved] = useState(false)\n return (\n <button\n type=\"button\"\n className={css.toggle}\n role=\"switch\"\n aria-checked={props.checked}\n aria-labelledby={props.labelledBy}\n aria-label={props.labelledBy === undefined ? props.ariaLabel : undefined}\n disabled={props.disabled}\n data-moved={moved ? '' : undefined}\n onClick={() => {\n setMoved(true)\n props.onChange(!props.checked)\n }}\n >\n <span className={css.toggleTrack}><span className={css.toggleThumb} /></span>\n </button>\n )\n}\n","// Generated by scripts/sync-shared.mjs from shared/client/settings/settings-form.ts. Do not edit this copy; edit the shared source and run \"node scripts/sync-shared.mjs\".\n/**\n * Form model behind the plugin settings card. Every control applies itself:\n * a pick (a segment, a select option, a reset) writes the moment it is made,\n * and typed text writes once typing pauses or the reader leaves the field.\n * Between the edit and the write the edit is held here as a draft, so what is\n * on screen is exactly what the write will store; a write the Host refuses\n * puts a pick back to the stored value and keeps typed text for correcting.\n * Family-shared slice inlined into each plugin's client bundle.\n */\n\nimport type { ConfigForm, ConfigFormSnapshot } from '@deepseek-ai/dsh-client-ui-settings/client'\nimport type { SnapshotStore } from '@deepseek-ai/dsh-client-store'\nimport { createSnapshotStore } from '@deepseek-ai/dsh-client-store'\n\n/** The write one field's draft text performs when it is applied. */\nexport type FieldWrite =\n | { kind: 'set'; value: unknown }\n | { kind: 'clear' }\n\n/** How one field converts between its stored value and its draft text. */\nexport interface FieldSpec {\n /** Field name inside the namespace section. */\n field: string\n /**\n * How the reader enters a value, which decides when it is written: a `pick`\n * is a whole value at once and applies immediately; `type` is text arriving\n * a keystroke at a time and applies once typing pauses or the field is left.\n */\n entry: 'pick' | 'type'\n /**\n * Whether the Host treats this field as a secret and redacts its value from\n * the read-back (role('secret') in the section schema). Redacted secrets are\n * never compared against the draft on save: the Host strips them from every\n * wire view layer, so the settled snapshot carries nothing to read back. A\n * staged secret set is judged by the mutation settling; the rest of its\n * batch, when one exists, is still judged by read-back, and the atomic\n * mutation lands every write or none.\n */\n secret?: boolean\n /** Render a stored value as draft text; the empty string when the section carries none. */\n format: (value: unknown) => string\n /**\n * The write this draft text performs, or undefined when the text is not a\n * value this field accepts — which holds the draft unwritten rather than\n * discarding it.\n */\n parse: (text: string) => FieldWrite | undefined\n}\n\n/** One field as the card renders it. */\nexport interface FieldState {\n /** Draft text the control renders. */\n text: string\n /** Whether the field leaves (or will leave) a user-layer entry. */\n overridden: boolean\n /** Whether the draft is not a value this field accepts, which holds it unwritten. */\n invalid: boolean\n}\n\n/** Form state every plugin settings card shares. */\nexport interface CardShell {\n /** False while the namespace is still loading; the card renders nothing. */\n available: boolean\n /**\n * Whether the namespace is actually served to this client. False when the\n * Host deployment does not expose it (e.g. the owning plugin's settings\n * domain is not mounted): the card renders an explanation\n * instead of its form, so a missing namespace never looks like a missing\n * plugin.\n */\n exposed: boolean\n /** Whether the Host document accepts writes. */\n writable: boolean\n /** Whether the form holds drafts not yet written (typed text waiting for its pause). */\n dirty: boolean\n /** Whether any draft is invalid, which holds it unwritten. */\n invalid: boolean\n /** Whether a write is crossing the wire. */\n saving: boolean\n /** Whether the last write did not land; cleared by the next edit or write. */\n failed: boolean\n /**\n * The rejection code/message the Host returned for the last failed save,\n * surfaced next to the generic failure text. Undefined while no save has\n * failed (or the failure carried no server reason).\n */\n failedReason?: string\n}\n\n/** The write actions the card's slot entry injects. */\nexport interface CardActions {\n /** Take draft text for one field; a pick writes at once, typed text after a pause. */\n edit: (field: string, text: string) => void\n /** Clear one field at once, so it re-inherits the composition layer. */\n resetField: (field: string) => void\n /** Write every pending draft now (a text field's Enter or blur), then re-seed from what the Host accepted. */\n save: () => void\n /** Drop every pending draft, putting each control back to the stored value (a text field's Escape). */\n discard: () => void\n}\n\n/** How long typed text rests before it is written. */\nexport const TYPE_PAUSE_MS = 600\n\n/** One field's staged edit. */\ninterface StagedEdit {\n /** Draft text the control renders. */\n text: string\n /** True when this edit clears the field whatever text it shows. */\n clear: boolean\n}\n\n/** One staged edit resolved into the write a save performs. */\ninterface PlannedWrite {\n /** Field this entry writes. */\n field: string\n /** The durable write this entry performs, inside the save's one atomic mutation. */\n op: BatchedWrite\n /**\n * Read the settled snapshot back and report whether the Host holds this\n * write's effect. Undefined when the draft is not a value the field\n * accepts: there is nothing to write, and the entry blocks the save.\n */\n judge: (() => boolean) | undefined\n}\n\n/** One durable write inside the save's atomic form mutation. */\nexport interface BatchedWrite {\n /** Field this entry writes. */\n field: string\n /** set stores a value; unset drops the leaf. */\n op: 'set' | 'unset'\n /** Value for op set (absent for unset). */\n value?: unknown\n}\n\n/** Constraints a numeric field's accepted drafts must satisfy, mirroring the host schema. */\nexport interface NumberConstraints {\n /** The accepted value must be a whole number. */\n integer?: boolean\n /** The accepted value must be at least this. */\n min?: number\n}\n\n/** A whole- or decimal-number field. An empty draft clears the field; any other draft that is not a finite number within the constraints stays unwritten. */\nexport function numberField(field: string, constraints: NumberConstraints = {}): FieldSpec {\n const { integer = false, min } = constraints\n return {\n field,\n entry: 'type',\n format: value => typeof value === 'number' ? String(value) : '',\n parse: (text) => {\n const trimmed = text.trim()\n if (trimmed === '') return { kind: 'clear' }\n const parsed = Number(trimmed)\n if (!Number.isFinite(parsed)) return undefined\n if (integer && !Number.isInteger(parsed)) return undefined\n if (min !== undefined && parsed < min) return undefined\n return { kind: 'set', value: parsed }\n },\n }\n}\n\n/**\n * A free-text field. An empty draft clears the field. `entry` is `pick` when\n * the text arrives whole from a picker (a preset or a reasoning level).\n */\nexport function textField(field: string, entry: FieldSpec['entry'] = 'type'): FieldSpec {\n return {\n field,\n entry,\n format: value => typeof value === 'string' ? value : '',\n parse: (text) => {\n const trimmed = text.trim()\n return trimmed === '' ? { kind: 'clear' } : { kind: 'set', value: trimmed }\n },\n }\n}\n\n/**\n * A free-text field the Host treats as a secret and redacts from the read-back\n * (role('secret') in the section schema). The card still edits it like text,\n * but a save never compares the redacted value back: the staged set is judged\n * by the mutation settling (see {@link FieldSpec.secret}).\n */\nexport function secretField(field: string): FieldSpec {\n return { ...textField(field), secret: true }\n}\n\n/** A boolean field, edited through true/false draft text. */\nexport function booleanField(field: string): FieldSpec {\n return {\n field,\n entry: 'pick',\n format: value => typeof value === 'boolean' ? String(value) : '',\n parse: (text) => {\n const trimmed = text.trim()\n if (trimmed === '') return { kind: 'clear' }\n if (trimmed === 'true') return { kind: 'set', value: true }\n if (trimmed === 'false') return { kind: 'set', value: false }\n return undefined\n },\n }\n}\n\n/** An enumerated string field; only the listed choices are accepted. An empty draft clears the field. */\nexport function choiceField(field: string, choices: readonly string[]): FieldSpec {\n return {\n field,\n entry: 'pick',\n format: value => typeof value === 'string' && choices.includes(value) ? value : '',\n parse: (text) => {\n if (text === '') return { kind: 'clear' }\n return choices.includes(text) ? { kind: 'set', value: text } : undefined\n },\n }\n}\n\n/**\n * Applies one card's edits to one settings namespace as the reader makes them.\n *\n * The Host is the only authority on whether a value was accepted — its\n * validators own the constraints no schema can express — so the outcome is\n * read back from the section rather than predicted here. A write that did not\n * land puts each pick back to the stored value, the way a switch that could not\n * flip springs back, and keeps typed text so the reader can correct it instead\n * of retyping.\n */\nexport class CardForm<T> {\n private readonly specs: Map<string, FieldSpec>\n private readonly staged = new Map<string, StagedEdit>()\n private readonly listeners = new Set<() => void>()\n /** The form subscription installed in the constructor; released by dispose(). */\n private readonly disposeForm: () => void\n private disposed = false\n /** The pending write of typed text, waiting for typing to pause. */\n private typePause: ReturnType<typeof setTimeout> | undefined\n private saving = false\n /** A save asked for while one was in flight; it runs once the first settles (#1754). */\n private saveQueued = false\n private failed = false\n private failedReason: string | undefined\n\n /** @param scope - the bound configuration form for this card's namespace. */\n constructor(\n private readonly scope: ConfigForm<T>,\n specs: FieldSpec[],\n ) {\n this.specs = new Map(specs.map(spec => [spec.field, spec]))\n this.disposeForm = scope.subscribe(() => { this.publish() })\n }\n\n /**\n * Release the form subscription and every bound store listener. The card\n * must call this on teardown; later calls are no-ops.\n */\n dispose(): void {\n if (this.disposed) return\n this.disposed = true\n clearTimeout(this.typePause)\n this.disposeForm()\n this.listeners.clear()\n }\n\n /** Publish a projection of this form, rebuilt whenever the form or a draft changes. */\n bind<S>(project: () => S): SnapshotStore<S> {\n const store = createSnapshotStore(project())\n this.listeners.add(() => { store.set(project()) })\n return store\n }\n\n /** Read the card-level state: what the Host serves, and what is still waiting to be written. */\n shell(): CardShell {\n const snapshot = this.scope.getSnapshot()\n const plan = this.plan()\n return {\n available: snapshot.status !== 'loading',\n exposed: snapshot.status === 'ready',\n writable: snapshot.writable,\n dirty: plan.length > 0,\n invalid: plan.some(item => item.judge === undefined),\n saving: this.saving,\n failed: this.failed,\n ...this.failedReason === undefined ? {} : { failedReason: this.failedReason },\n }\n }\n\n /** Read one field's state from the effective section and its staged draft. */\n field(field: string): FieldState {\n const spec = this.specOf(field)\n const staged = this.staged.get(field)\n if (staged === undefined) {\n return { text: spec.format(this.sectionValue(field)), overridden: this.stored(field), invalid: false }\n }\n const write = staged.clear ? { kind: 'clear' as const } : spec.parse(staged.text)\n return {\n text: staged.text,\n overridden: write?.kind === 'set',\n invalid: write === undefined,\n }\n }\n\n /** The actions the card's slot registration injects. */\n actions(): CardActions {\n return {\n edit: (field, text) => { this.stage(field, { text, clear: false }) },\n resetField: (field) => {\n this.stage(field, { text: this.specOf(field).format(this.baseValue(field)), clear: true })\n },\n save: () => { this.applyNow() },\n discard: () => {\n clearTimeout(this.typePause)\n if (this.staged.size === 0 && !this.failed) return\n this.staged.clear()\n this.failed = false\n this.failedReason = undefined\n this.publish()\n },\n }\n }\n\n /**\n * Run one write, and re-run it once if another was asked for while this one\n * was still in flight.\n *\n * A write is a Host round trip that also drives the profile reconcile, and\n * the Host runs it inside one exclusive transaction. Answering an edit that\n * arrives mid-flight by returning immediately dropped it with no explanation\n * (#1754). Serializing instead means an edit made while another write is\n * still settling is written against the settled state.\n * @returns settlement after the mutation and the read-back.\n */\n async requestSave(): Promise<void> {\n if (this.saving) {\n this.saveQueued = true\n return\n }\n await this.save()\n if (!this.saveQueued) return\n this.saveQueued = false\n await this.requestSave()\n }\n\n /**\n * Write every valid draft in one atomic form mutation, then re-seed from\n * what the Host accepted. A draft the field does not accept stays on screen,\n * unwritten, without holding the others back.\n *\n * The batch rides one mutate, so cross-field validate hooks (baseURL+model)\n * judge it as a unit: the Host either applies every write or refuses the\n * batch. The form contract answers a refusal or a skipped write with `false`\n * (it recovers with a fresh Host view instead of throwing), so the outcome is\n * judged twice: the answer itself, and then the settled snapshot read back\n * one planned write at a time. One missed write fails the whole batch. A\n * transport that rejects instead (the dsh-web bridge controller on a dead\n * connection) reports through the same failure path with its rejection\n * message. A batch that did not land puts its picks and clears back to the\n * stored value and keeps its typed text, so the reader can correct it.\n * @returns settlement after the mutation and the read-back.\n */\n async save(): Promise<void> {\n const plan = this.plan()\n const valid = plan.filter((item): item is PlannedWrite & { judge: () => boolean } => item.judge !== undefined)\n if (valid.length === 0 || this.saving) return\n // Snapshot the staged entries this write carries, so an edit staged while\n // it is in flight (which replaces the same key) survives: only settle the\n // key when the entry is still the one this write started from.\n const pending = new Map<string, StagedEdit | undefined>()\n for (const item of valid) pending.set(item.field, this.staged.get(item.field))\n this.saving = true\n this.failed = false\n this.failedReason = undefined\n this.publish()\n // One atomic namespace mutation: the form contract takes ordered path\n // operations, so the whole staged batch is validated, persisted, and\n // recovered together — either every write lands or none does.\n const ops: Array<{ op: 'set'; path: string[]; value: string | number | boolean } | { op: 'unset'; path: string[] }> = valid.map(item => item.op.op === 'set'\n ? { op: 'set', path: [item.field], value: (item.op as { value: string | number | boolean }).value }\n : { op: 'unset', path: [item.field] })\n let failedReason: string | undefined\n let accepted = false\n try {\n accepted = await this.scope.mutate(ops)\n } catch (error) {\n failedReason = error instanceof Error ? error.message : String(error)\n }\n // `false` is the contract's refusal/skip answer, and the form still\n // resolves after a refusal (it recovers with a fresh view), so the answer\n // alone is not enough: judge every planned write against the settled\n // snapshot as well. The mutation is atomic, so one missed write fails the\n // whole save and keeps the drafts.\n const landed = accepted && failedReason === undefined && valid.every(item => item.judge())\n for (const [field, before] of pending) {\n if (this.staged.get(field) !== before) continue\n if (landed || before === undefined || before.clear || this.specOf(field).entry === 'pick') this.staged.delete(field)\n }\n this.saving = false\n this.failed = !landed\n // A refused or unlanded batch carries no server reason: the card surfaces\n // its generic failure copy; a rejecting transport (the bridge) adds its\n // message.\n this.failedReason = failedReason\n this.publish()\n }\n\n /**\n * Every staged edit a write would carry. An entry whose draft is not a value\n * its field accepts carries no write: the form is still dirty, and the draft\n * stays on screen rather than being dropped. A staged edit that matches the\n * effective section is not a write at all.\n * @returns the planned writes, in the order the fields were staged.\n */\n private plan(): PlannedWrite[] {\n const plan: PlannedWrite[] = []\n for (const [field, staged] of this.staged) {\n const spec = this.specOf(field)\n if (staged.clear) {\n if (this.stored(field)) plan.push({ field, op: { field, op: 'unset' }, judge: () => this.landedUnset(field) })\n continue\n }\n if (staged.text === spec.format(this.sectionValue(field))) continue\n const write = spec.parse(staged.text)\n if (write === undefined) plan.push({ field, op: { field, op: 'unset' }, judge: undefined })\n else if (write.kind === 'clear') plan.push({ field, op: { field, op: 'unset' }, judge: () => this.landedUnset(field) })\n else plan.push({ field, op: { field, op: 'set', value: write.value }, judge: () => this.landedSet(field, write.value) })\n }\n return plan\n }\n\n /**\n * Read-back judgment for a planned set: the user layer must hold the\n * intended value once the mutation has settled.\n */\n private landedSet(field: string, value: unknown): boolean {\n // A redacted secret never appears in any wire view layer: the Host strips\n // role('secret') fields and reports them through a sidecar the form\n // snapshot does not expose, so there is nothing to compare the draft\n // against. Settling is the only signal the form has; the rest of the\n // batch, when one exists, still carries the atomic verdict by read-back.\n if (this.specOf(field).secret) return true\n return this.userLayer()?.[field] === value\n }\n\n /**\n * Read-back judgment for a planned unset: the field must be gone from the\n * user layer once the mutation has settled.\n */\n private landedUnset(field: string): boolean {\n return !this.stored(field)\n }\n\n /**\n * Take one edit and schedule its write: a pick or a clear is written now,\n * typed text once typing has rested for TYPE_PAUSE_MS.\n */\n private stage(field: string, edit: StagedEdit): void {\n this.staged.set(field, edit)\n this.failed = false\n this.failedReason = undefined\n this.publish()\n if (edit.clear || this.specOf(field).entry === 'pick') {\n this.applyNow()\n return\n }\n clearTimeout(this.typePause)\n this.typePause = setTimeout(() => { this.applyNow() }, TYPE_PAUSE_MS)\n }\n\n /** Write every pending draft now, taking the place of a waiting pause. */\n private applyNow(): void {\n clearTimeout(this.typePause)\n this.typePause = undefined\n if (this.disposed) return\n void this.requestSave()\n }\n\n private specOf(field: string): FieldSpec {\n const spec = this.specs.get(field)\n // Every call site names a field this card declared; a missing one is a\n // wiring mistake that must not degrade into a silently inert control.\n if (spec === undefined) throw new Error(`settings card has no field ${field}`)\n return spec\n }\n\n private snapshotOf(): ConfigFormSnapshot<T> {\n return this.scope.getSnapshot()\n }\n\n private sectionValue(field: string): unknown {\n return (this.snapshotOf().value as Record<string, unknown> | undefined)?.[field]\n }\n\n private baseValue(field: string): unknown {\n return (this.snapshotOf().base as Record<string, unknown> | undefined)?.[field]\n }\n\n private userLayer(): Record<string, unknown> | undefined {\n return this.snapshotOf().user as Record<string, unknown> | undefined\n }\n\n private stored(field: string): boolean {\n const user = this.userLayer()\n return user !== undefined && Object.hasOwn(user, field)\n }\n\n private publish(): void {\n for (const listener of this.listeners) listener()\n }\n}\n","/**\n * LiangShen settings card: availability, the wire presentation, and the\n * dispatcher identity. Registers into the `web-ui.plugin.item` child slot the\n * Web UI plugin group renders, bound to the `liangshen` settings namespace\n * (the Host profile entry id).\n *\n * No field acts on this client half: the Host applies the presentation and the\n * dispatcher switch to the preset it declares to the agent-preset registry, so\n * a session reads both from its preset. The card is the operator's only handle\n * on them, which is why every field the Host schema carries appears here.\n */\n\nimport type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { SnapshotStore } from '@deepseek-ai/dsh-client-store'\nimport type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client'\nimport { LiangShenMark } from './LiangShenMark.tsx'\nimport { BooleanField, ChoiceField, PluginSettingsCard } from './PluginSettingsCard.tsx'\nimport { CardForm, booleanField, choiceField, type CardActions, type CardShell, type FieldState as CardFieldState } from './settings-form.ts'\n\n/** Wire presentations the tool catalog accepts (mirrors the Host schema). */\nexport const PRESENTATION_CHOICES = ['ptc', 'native'] as const\n\n/** The LiangShen fields this card edits (the namespace's full schema). */\nexport interface LiangShenSettings {\n /** Master switch for the plugin. */\n enabled?: boolean\n /** Whether the plugin announces itself in every agent's system prompt. */\n announceToAgent?: boolean\n /** Wire presentation the Host applies to the preset's tool-catalog row. */\n presentation?: string\n /** Whether the preset appends the dispatcher rules section after the persona. */\n dispatcher?: boolean\n}\n\n/** What the LiangShen card renders. */\nexport interface LiangShenSettingsCardState extends CardShell {\n enabled: CardFieldState\n announceToAgent: CardFieldState\n presentation: CardFieldState\n dispatcher: CardFieldState\n}\n\n/** The registration-side face the card's slot entry injects. */\nexport interface LiangShenSettingsCardFace extends CardActions {\n hooks: {\n /** Card snapshot bound by the renderer as useLiangShenSettingsCard. */\n liangShenSettingsCard: SnapshotStore<LiangShenSettingsCardState>\n }\n}\n\n/** Bridges the `liangshen` settings form onto the card's staged form. */\nexport class LiangShenSettingsCardController {\n private readonly form: CardForm<LiangShenSettings>\n private readonly store: SnapshotStore<LiangShenSettingsCardState>\n\n /** @param scope - the bound configuration form of the entry that owns this namespace. */\n constructor(scope: ConfigForm<LiangShenSettings>) {\n this.form = new CardForm(scope, [\n booleanField('enabled'),\n booleanField('announceToAgent'),\n choiceField('presentation', PRESENTATION_CHOICES),\n booleanField('dispatcher'),\n ])\n this.store = this.form.bind(() => this.projection())\n }\n\n private projection(): LiangShenSettingsCardState {\n return {\n ...this.form.shell(),\n enabled: this.form.field('enabled'),\n announceToAgent: this.form.field('announceToAgent'),\n presentation: this.form.field('presentation'),\n dispatcher: this.form.field('dispatcher'),\n }\n }\n\n /**\n * Build the face the card's slot registration injects.\n * @returns the card's snapshot and its form actions.\n */\n inject(): LiangShenSettingsCardFace {\n return { hooks: { liangShenSettingsCard: this.store }, ...this.form.actions() }\n }\n\n /** Release the card's scope subscription and bound stores. */\n dispose(): void {\n this.form.dispose()\n }\n}\n\n/** Props the renderer binds for the LiangShen card. */\nexport type LiangShenSettingsCardProps =\n PropsRuntime<'web-ui.plugin.item'>\n & PropsLocale<'liangshen'>\n & InjectFace<LiangShenSettingsCardFace>\n\n/**\n * Render the LiangShen card.\n * @param props - locale copy, the card snapshot, and its form actions.\n * @returns the card.\n */\nexport function LiangShenSettingsCard(props: LiangShenSettingsCardProps) {\n const { t } = props\n const state = props.useLiangShenSettingsCard((snapshot: LiangShenSettingsCardState) => snapshot)\n const fieldProps = {\n overriddenLabel: t('settings.overridden'),\n resetLabel: t('settings.reset'),\n invalidLabel: t('settings.invalidValue'),\n disabled: !state.writable,\n inheritLabel: t('settings.inherit'),\n }\n return (\n <PluginSettingsCard\n t={t}\n titleKey=\"settings.title\"\n descriptionKey=\"settings.description\"\n icon={<LiangShenMark />}\n defaultOpen={false}\n state={state}\n renderChildrenWhenNotExposed\n hideNotExposedNotice\n onSave={props.save}\n onDiscard={props.discard}\n >\n <BooleanField\n id=\"settings-liangshen-enabled\"\n label={t('settings.enabled')}\n hint={t('settings.enabledHint')}\n onLabel={t('settings.on')}\n offLabel={t('settings.off')}\n {...fieldProps}\n {...state.enabled}\n onEdit={(text) => { props.edit('enabled', text) }}\n onReset={() => { props.resetField('enabled') }}\n />\n <BooleanField\n id=\"settings-liangshen-announce\"\n label={t('settings.announceToAgent')}\n hint={t('settings.announceToAgentHint')}\n onLabel={t('settings.on')}\n offLabel={t('settings.off')}\n {...fieldProps}\n {...state.announceToAgent}\n onEdit={(text) => { props.edit('announceToAgent', text) }}\n onReset={() => { props.resetField('announceToAgent') }}\n />\n <ChoiceField\n id=\"settings-liangshen-presentation\"\n label={t('settings.presentation')}\n hint={t('settings.presentationHint')}\n choices={PRESENTATION_CHOICES.map(choice => ({ value: choice, label: t(`presentation.${choice}`) }))}\n presentation=\"segment\"\n {...fieldProps}\n {...state.presentation}\n onEdit={(text) => { props.edit('presentation', text) }}\n onReset={() => { props.resetField('presentation') }}\n />\n <BooleanField\n id=\"settings-liangshen-dispatcher\"\n label={t('settings.dispatcher')}\n hint={t('settings.dispatcherHint')}\n onLabel={t('settings.on')}\n offLabel={t('settings.off')}\n {...fieldProps}\n {...state.dispatcher}\n onEdit={(text) => { props.edit('dispatcher', text) }}\n onReset={() => { props.resetField('dispatcher') }}\n />\n </PluginSettingsCard>\n )\n}\n","/**\n * Lever copy: zh-first dictionary with an English counterpart. The zh side is\n * the key-set source of truth; `packages/dsh-i18n` mirrors the keys into the\n * centralized ru dictionary and `pnpm i18n:check` enforces the parity.\n */\n\n/** Lever copy, key source of truth. */\nexport const zh = {\n 'lever.a11y': '梁神模式拨杆',\n 'lever.name': '梁神模式',\n 'lever.hint.pull': '拨下拨杆:开启「梁神模式」',\n 'lever.hint.push': '上拨拨杆:返回「{preset}」',\n 'lever.hint.locked': '会话已开始,模式不可再更改',\n 'lever.hint.missing': '未找到「梁神模式」预设,请先启用该插件行',\n 'lever.state.on': '梁神模式',\n 'lever.state.off': '普通模式',\n 'lever.busy': '正在切换…',\n 'lever.failed.locked': '会话已经开始,模式已锁定',\n 'lever.failed.missing': '没有找到「梁神模式」预设',\n 'lever.failed.timeout': '切换超时,请重试',\n 'lever.failed.failed': '切换失败:{reason}',\n 'burst.line1': '三秒,三辈子的代码',\n 'burst.line2': '文言文 · 二进制 · 摩斯电码',\n 'settings.title': '梁神模式',\n 'settings.description': '梁神模式的开关、工具面与调度身份。',\n 'settings.enabled': '总开关',\n 'settings.enabledHint': '关掉后不再声明预设。',\n 'settings.announceToAgent': '公告给 agent',\n 'settings.announceToAgentHint': '每一轮系统提示都带上本插件公告。',\n 'settings.presentation': '工具面',\n 'settings.presentationHint': 'ptc 把工具收进 run_code,native 保留原生清单。',\n 'settings.dispatcher': '调度身份',\n 'settings.dispatcherHint': '按调度 Agent 工作:分诊、访谈、派发子代理。',\n 'settings.on': '开',\n 'settings.off': '关',\n 'settings.inherit': '继承',\n 'settings.overridden': '已修改',\n 'settings.reset': '恢复默认',\n 'settings.notExposed': '这个版本的 DSH 没有开放梁神模式的设置。',\n 'settings.readOnly': '设置只读。',\n 'settings.expand': '展开设置',\n 'settings.collapse': '收起设置',\n 'settings.saveFailed': '没有保存成功。',\n 'settings.invalidValue': '填一个可用的值。',\n 'presentation.ptc': 'ptc',\n 'presentation.native': 'native',\n}\n\n/** English counterpart; the key set mirrors {@link zh} exactly. */\nexport const en: Record<keyof typeof zh, string> = {\n 'lever.a11y': 'LiangShen mode lever',\n 'lever.name': 'LiangShen mode',\n 'lever.hint.pull': 'Pull the lever down to turn on LiangShen mode',\n 'lever.hint.push': 'Push the lever up to return to \"{preset}\"',\n 'lever.hint.locked': 'The session has started, so its mode can no longer change',\n 'lever.hint.missing': 'The LiangShen preset is not installed; enable that plugin row first',\n 'lever.state.on': 'LiangShen',\n 'lever.state.off': 'Standard',\n 'lever.busy': 'Switching…',\n 'lever.failed.locked': 'The session already started, so the mode is locked',\n 'lever.failed.missing': 'The LiangShen preset was not found',\n 'lever.failed.timeout': 'The switch timed out; try again',\n 'lever.failed.failed': 'Switch failed: {reason}',\n 'burst.line1': 'Three seconds, three lifetimes of code',\n 'burst.line2': 'Classical Chinese · Binary · Morse code',\n 'settings.title': 'LiangShen mode',\n 'settings.description': 'The mode switch, the wire presentation and the dispatcher identity.',\n 'settings.enabled': 'Master switch',\n 'settings.enabledHint': 'When off, the preset is no longer declared.',\n 'settings.announceToAgent': 'Announce to agents',\n 'settings.announceToAgentHint': 'Every system prompt carries this plugin note.',\n 'settings.presentation': 'Wire',\n 'settings.presentationHint': 'ptc folds tools into run_code; native keeps the native roster.',\n 'settings.dispatcher': 'Dispatcher',\n 'settings.dispatcherHint': 'Works as a dispatcher: triage, interview, then dispatch subagents.',\n 'settings.on': 'On',\n 'settings.off': 'Off',\n 'settings.inherit': 'Inherit',\n 'settings.overridden': 'Changed',\n 'settings.reset': 'Reset to default',\n 'settings.notExposed': 'This DSH version does not open the LiangShen settings.',\n 'settings.readOnly': 'Settings are read-only.',\n 'settings.expand': 'Show settings',\n 'settings.collapse': 'Hide settings',\n 'settings.saveFailed': 'Not saved.',\n 'settings.invalidValue': 'Enter a value this field accepts.',\n 'presentation.ptc': 'ptc',\n 'presentation.native': 'native',\n}\n\n/** Every key in the locale catalog. */\nexport type LiangShenKey = keyof typeof zh\n","// Generated by scripts/sync-shared.mjs from shared/client/settings/plugin-card-seat.ts. Do not edit this copy; edit the shared source and run \"node scripts/sync-shared.mjs\".\n/**\n * Family plugin-card seat.\n *\n * A family plugin contributes its settings card to whichever plugin-card seat\n * the running host actually renders:\n *\n * - `web-ui.plugin.item` — the list seat declared by the dsh-web-settings\n * group section (this family's own first-level \"Web UI plugins\" section);\n * - `plugins.bundle.config` — the official keyed seat of the harness's plugin\n * manager page, keyed by the bundle's package name and rendered on that\n * bundle's page. alpha.2 removed the `settings.plugin.item` keyed seat of the\n * `ui-settings-plugins` tab that this helper used before, so a card keyed by\n * its settings namespace has no seat to land in any more.\n *\n * SEAT SELECTION IS NOT A DECLARATION PROBE. The official plugin surface\n * belongs to the harness bundle and declares its seats before any external\n * plugin's `apply()` runs, so \"is the official seat declared?\" answers yes even\n * in the deployment whose whole point is the family group. Choosing on that\n * probe sends every family card to the official page and leaves the group's own\n * section permanently empty — the family of reports where the section renders\n * its heading and zero cards.\n *\n * The signal that actually distinguishes the two deployments is whether\n * dsh-web-settings is loaded: it is the package that owns the group section and\n * it publishes the `webUiSettings` service during `apply()`, which every\n * family plugin already reads for its settings form. Group loaded -> the family\n * seat; group absent -> the official seat.\n *\n * The decision is re-evaluated on every `slots/changed` because the group may\n * apply after this plugin (the family aggregate orders it first, a profile that\n * installs the group separately need not): the initial contribution goes to the\n * official seat, then moves to the family seat the moment the group's section\n * registers. The entry is disposed before the replacement is registered, so a\n * card is never in two seats at once.\n *\n * The shared tree has no client-SDK dependency, so this module reads its\n * context through the structural shape below; callers pass the plugin's own\n * `ctx`.\n */\n\n/** The family list seat key. */\nexport const FAMILY_PLUGIN_CARD_SEAT = 'web-ui.plugin.item'\n\n/** The official keyed plugin-card seat key (the alpha.2 bundle-configuration seat). */\nexport const OFFICIAL_PLUGIN_CARD_SEAT = 'plugins.bundle.config'\n\n/** The service dsh-web-settings publishes while it is loaded. */\nexport const FAMILY_GROUP_SERVICE = 'webUiSettings'\n\n/** The slot-registry member this helper uses (structurally satisfied by ctx.slots). */\nexport interface PluginCardSlots {\n /** Contribution of one card entry. */\n register(options: never, component: never): unknown\n /** Declaration probe: a target seat may appear after this plugin applies. */\n spec?(key: string): unknown\n}\n\n/** The slice of the client context a card contribution needs. */\nexport interface PluginCardContext {\n slots: PluginCardSlots\n /** Service lookup; absent on a context double that only models the slots. */\n get?(name: string): unknown\n /** Event subscription seat; absent on an event-less test double. */\n on?(event: never, listener: never): unknown\n}\n\n/** Owner share of a family list-seat card (that seat supplies nothing). */\nexport interface SettingsPluginItemOwnerProps {\n /** Marker field: card owner props are intentionally empty. */\n children?: never\n}\n\n/** One family plugin's card contribution. */\nexport interface PluginCardSeat {\n /**\n * Npm package name of the bundle this card configures; the official keyed\n * seat dispatches on it. Every family package ships its own bundle patch, so\n * a standalone install lists that package as the bundle whose page renders\n * this card.\n */\n bundle: string\n /** Family list-seat entry id. */\n id: string\n /** Family list-seat sort order. */\n order?: number\n /** Family list-seat display label; the official keyed seat carries none. */\n label?: () => string\n /** Locale namespace the card renders with. */\n locale: string\n /**\n * Child slots this card declares and renders. Forwarded to whichever seat\n * the host renders; absent for a card that declares none.\n */\n children?: Record<string, unknown>\n /** Business-face factory of the registration. */\n inject?: () => object\n /**\n * The card component. Its props type is the seat's composed shape, which is\n * chosen at runtime, so the helper takes it erased; the registrant keeps its\n * own precise typing at the call site.\n */\n component: unknown\n}\n\n/**\n * Whether the family group (dsh-web-settings) is loaded in this page. The\n * service is the group package's own contract, so the probe cannot be fooled\n * by a harness release that starts declaring the official seat differently.\n */\nexport function familyGroupLoaded(ctx: PluginCardContext): boolean {\n const get = ctx.get\n if (typeof get !== 'function') return false\n try {\n return get.call(ctx, FAMILY_GROUP_SERVICE) !== undefined\n } catch {\n // A context that refuses the lookup: treat the group as absent, which\n // falls back to the official seat the harness declares.\n return false\n }\n}\n\n/** Report a refused registration instead of leaving the user with no card. */\nfunction warnRefusedSeat(seat: string, error: unknown): void {\n try {\n console.warn(`[dsh-web] plugin card registration into \"${seat}\" was refused; the card will not render`, error)\n } catch {\n // Best-effort console write; a failed warning must not break the plugin.\n }\n}\n\n/**\n * Contribute one family plugin card to the seat this host renders, following\n * the group if it loads later. The entry is disposed and re-registered on a\n * seat change, never duplicated.\n * @param ctx - client context (its slot registry decides the seat).\n * @param seat - the card contribution.\n */\nexport function installPluginCard(ctx: PluginCardContext, seat: PluginCardSeat): void {\n const slots = ctx.slots\n const component = seat.component as never\n const inject = seat.inject as never\n\n let dispose: (() => void) | undefined\n let current: string | undefined\n /**\n * Re-entrancy latch. The registry emits a change event synchronously from\n * inside both `register` and the previous entry's disposer, so an unguarded\n * reconcile would re-enter itself mid-move and register the card twice into\n * the seat it is leaving (\"already has an entry for key ...\").\n */\n let reconciling = false\n\n /** Reconcile the contribution with the currently live seat (no-op when unchanged). */\n const reconcile = (): void => {\n if (reconciling) return\n const target = familyGroupLoaded(ctx) ? FAMILY_PLUGIN_CARD_SEAT : OFFICIAL_PLUGIN_CARD_SEAT\n if (current === target) return\n // The group's child seat can be declared after this card applies (the\n // parent mounts its pages through the extension service). Wait for the\n // declaration instead of logging a refused registration on every boot.\n if (typeof slots.spec === 'function' && slots.spec(target) === undefined) return\n reconciling = true\n const previous = dispose\n dispose = undefined\n current = undefined\n previous?.()\n try {\n dispose = slots.register((target === FAMILY_PLUGIN_CARD_SEAT\n ? {\n name: FAMILY_PLUGIN_CARD_SEAT,\n id: seat.id,\n ...(seat.order === undefined ? {} : { order: seat.order }),\n ...(seat.label === undefined ? {} : { label: seat.label }),\n locale: seat.locale,\n ...(seat.children === undefined ? {} : { children: seat.children }),\n ...(seat.inject === undefined ? {} : { inject }),\n }\n : {\n name: OFFICIAL_PLUGIN_CARD_SEAT,\n key: seat.bundle,\n locale: seat.locale,\n ...(seat.children === undefined ? {} : { children: seat.children }),\n ...(seat.inject === undefined ? {} : { inject }),\n }) as never, component) as () => void\n current = target\n } catch (error) {\n warnRefusedSeat(target, error)\n } finally {\n reconciling = false\n }\n }\n\n if (typeof ctx.on === 'function') {\n try {\n ctx.on('slots/changed' as never, (() => { reconcile() }) as never)\n } catch {\n // An event seat that refuses the subscription leaves the initial\n // decision in place; the card still renders in the seat chosen below.\n }\n }\n // The initial decision: the group, when it is already loaded (the aggregate\n // order), otherwise the official seat the harness declares.\n reconcile()\n}\n","// Generated by scripts/sync-shared.mjs from shared/client/settings/settings-entry-form.ts. Do not edit this copy; edit the shared source and run \"node scripts/sync-shared.mjs\".\n// Generated by scripts/sync-shared.mjs from shared/client/settings/settings-entry-form.ts. Do not edit this copy; edit the shared source and run \"node scripts/sync-shared.mjs\".\n/**\n * Family settings form bound to the profile entry id a Host actually serves.\n *\n * Under the 0.1.7 settings model a form is addressed by PROFILE ENTRY ID, while\n * a family card knows only its own settings namespace. The family binder\n * (`ctx.get('webUiSettings')`, published by dsh-web-settings) resolves one onto\n * the other and is the preferred transport; this module is the fallback for a\n * page that serves no binder — the group plugin is not installed, or its client\n * half has not applied yet (the aggregate mounts its children in order, and a\n * child still waiting on its own injects publishes nothing).\n *\n * The shared describe mirror is the only local evidence of which row id this\n * profile serves, but it answers asynchronously: at plugin activation it usually\n * holds nothing yet. A one-shot guess therefore cannot be right for every\n * deployment, and the form is bound once per session:\n *\n * - binding the bare namespace made every save answer `No configurable plugin\n * entry \"<namespace>\"` on an aggregate install (the namespace is not an entry\n * id there), which the card reported as \"the deployment did not accept these\n * values\";\n * - binding the aggregate row id would break a standalone install, whose row id\n * is the namespace or the package's own `ui-*` row.\n *\n * So the fallback starts on the most likely row and REBINDS the moment the\n * mirror names one of this package's rows. Until the mirror answers, the form\n * reports the binding it holds (usually `loading`), which the card renders as an\n * unavailable form rather than a doomed one.\n */\nimport type { ConfigForm, ConfigFormSnapshot, ConfigForms } from '@deepseek-ai/dsh-client-ui-settings/client'\n\n/** Options of {@link createServedEntryForm}. */\nexport interface ServedEntryFormOptions<T> {\n /** The shared configuration forms service (`ctx.configForms`). */\n forms: ConfigForms\n /**\n * Profile entry ids this package's rows carry, most likely first: the\n * aggregate's generated row, the package's own standalone row, then the bare\n * namespace. The first is the fallback while the mirror has no answer; the\n * last is the answer when the mirror serves none of them.\n */\n entryIds: readonly string[]\n}\n\n/** The snapshot a form reports before the Host has answered with this entry. */\nfunction pendingSnapshot<T>(): ConfigFormSnapshot<T> {\n return {\n status: 'loading',\n value: undefined,\n base: undefined,\n user: undefined,\n revision: undefined,\n writable: false,\n }\n}\n\n/**\n * Create a settings form bound to the profile entry id this Host serves, and\n * rebound whenever the shared describe mirror names a different one of this\n * package's rows.\n * @param options - the shared forms service and this package's candidate row ids.\n * @returns a form delegating to the currently resolved entry's own form.\n */\nexport function createServedEntryForm<T>(options: ServedEntryFormOptions<T>): ConfigForm<T> {\n const { forms, entryIds } = options\n const fallbackId = entryIds[0]\n const namespaceId = entryIds[entryIds.length - 1]\n const listeners = new Set<() => void>()\n let boundId: string | undefined\n let bound: ConfigForm<T> | undefined\n let offBound: (() => void) | undefined\n let snapshot: ConfigFormSnapshot<T> = pendingSnapshot<T>()\n\n /** Republish: the delegated snapshot when one is bound, the pending one otherwise. */\n const publish = (): void => {\n if (bound !== undefined) snapshot = bound.getSnapshot()\n for (const listener of [...listeners]) listener()\n }\n\n /**\n * The entry id the mirror currently justifies. An unanswered or empty mirror\n * is not evidence of absence, so it keeps the first candidate; a mirror that\n * answers without any of this package's rows leaves the namespace itself.\n * @returns the entry id to bind.\n */\n const resolve = (): string => {\n let served: readonly string[] | undefined\n try {\n served = forms.describe().getSnapshot().view?.namespaces.map(row => row.ns)\n } catch {\n // A mirror that refuses the read is unanswered too, not absent.\n served = undefined\n }\n if (served === undefined || served.length === 0) return fallbackId\n return entryIds.find(id => served.includes(id)) ?? namespaceId\n }\n\n /** Bind (or rebind) the resolved entry's form; a no-op while it is unchanged. */\n const bind = (): void => {\n const target = resolve()\n if (target === boundId) return\n offBound?.()\n offBound = undefined\n let form: ConfigForm<T>\n try {\n form = forms.get<T>(target)\n } catch {\n // A service that refuses the id stays unbound; the next mirror answer\n // retries rather than pinning a wrong entry for the session.\n boundId = undefined\n return\n }\n boundId = target\n bound = form\n offBound = form.subscribe(() => { publish() })\n publish()\n }\n\n // The mirror subscription lives for the page: the card owns its form for the\n // session, and the ConfigForm contract carries no disposer to hang it on. The\n // callback is cheap (a resolve plus a no-op while the id is unchanged). A\n // mirror without a subscription seat keeps the initial binding.\n try {\n forms.describe().subscribe(() => { bind() })\n } catch {\n // A describe face that refuses the subscription: the initial binding stands.\n }\n bind()\n\n return {\n getSnapshot: () => snapshot,\n subscribe: (listener) => {\n listeners.add(listener)\n return () => { listeners.delete(listener) }\n },\n set: (field, value) => bound?.set(field, value) ?? Promise.resolve(false),\n unset: (field) => bound?.unset(field) ?? Promise.resolve(false),\n mutate: (ops, expectedRevision) => bound?.mutate(ops, expectedRevision) ?? Promise.resolve(false),\n }\n}\n","/**\n * dsh-liangshen browser half: the LiangShen lever in the composer tool row.\n *\n * The slot is `conversation.input.right` — \"compact controls before the\n * composer submit action\", which renders immediately left of the model\n * selector (`conversation.input.model`) inside the same composer card, on the\n * homepage's new-session hero as well as in a session. The lever lives only\n * while the session is still blank, because that is the only window in which a\n * preset can change at all: `agentPresets.select` refuses an already-started\n * session, and the arm would have nothing to do in one.\n *\n * This half talks to the host over the agent-preset Remote namespace rather\n * than through the official preset package's browser module: cross-plugin\n * collaboration here goes through cordis services and Remote surfaces, not\n * value imports.\n *\n * Failure policy: a missing slot or a refused Remote call is handled, never\n * thrown — one external plugin must not take the GUI boot down.\n */\n\nimport type { Context as ClientContext } from '@deepseek-ai/cordis'\nimport type {} from '@deepseek-ai/dsh-client-ui-renderer/client'\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\n// Type-only: pulls the ui-conversation SlotMap merge (the composer tool row).\nimport type {} from '@deepseek-ai/dsh-client-ui-conversation/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-slots'\nimport type { ConfigForm, ConfigForms } from '@deepseek-ai/dsh-client-ui-settings/client'\n// Type-only: pulls the settings-surface Context merge (ctx.configForms).\nimport type {} from '@deepseek-ai/dsh-client-ui-settings/client'\nimport { LiangShenLever } from './LiangShenLever.tsx'\nimport { LeverController } from './lever-controller.ts'\nimport { LiangShenSettingsCard, LiangShenSettingsCardController, type LiangShenSettings } from './LiangShenSettingsCard.tsx'\nimport { en, zh, type LiangShenKey } from './locales.ts'\nimport { installPluginCard } from './plugin-card-seat.ts'\nimport { createServedEntryForm } from './settings-entry-form.ts'\n\n/** Locale namespace this half owns. */\nexport const NS = 'liangshen'\n\n/**\n * Settings namespace the settings card edits: the family identity of this\n * plugin's own settings form, and the row id a standalone bundle install\n * carries. The aggregate install mounts the generated `web-ui-liangshen` row\n * instead, and the family binder resolves between the two.\n */\nexport const SETTINGS_NAMESPACE = 'liangshen'\n\n/**\n * Profile entry id the family aggregate's generated row carries — the shape\n * nearly every user runs, and the id the shared-forms fallback binds when the\n * family binder cannot resolve the namespace.\n */\nconst AGGREGATE_ENTRY_ID = 'web-ui-liangshen'\n\n/** Profile entry ids this package's patch rows carry, most specific first. */\nconst LIANGSHEN_ENTRY_IDS: readonly string[] = [AGGREGATE_ENTRY_ID, 'ui-liangshen', SETTINGS_NAMESPACE]\n\n/**\n * The profile entry id this package's own row carries, for a page that serves\n * no family binder.\n *\n * The shared describe mirror is the only local evidence of which row id this\n * profile actually serves, but it answers asynchronously: at plugin activation\n * it usually holds nothing yet. An unanswered or empty mirror is therefore NOT\n * evidence of absence, and binding the bare namespace there is what made every\n * save fail with `No configurable plugin entry \"liangshen\"` — the form is\n * bound once per session, so a wrong guess never recovers. The aggregate row id\n * is the answer that matches nearly every deployment; only a mirror that\n * answers with OTHER plugins' rows keeps the namespace as the last resort (the\n * pre-0.1.7 keying shape), because that answer is the one that actually proves\n * this package's own row is not served.\n * @param forms - the shared configuration forms service.\n * @returns the entry id to bind.\n */\nexport function servedEntryId(forms: ConfigForms): string {\n let served: readonly string[] | undefined\n try {\n served = forms.describe().getSnapshot().view?.namespaces.map(view => view.ns)\n } catch {\n // A mirror that refuses the read is unanswered too, not absent.\n served = undefined\n }\n if (served === undefined || served.length === 0) return AGGREGATE_ENTRY_ID\n return LIANGSHEN_ENTRY_IDS.find(id => served.includes(id)) ?? SETTINGS_NAMESPACE\n}\n\n/**\n * Bind the settings form the card stages over.\n *\n * The family binder comes first: it is what resolves this package's family\n * namespace onto the profile entry id the Host serves the form under, and it\n * keeps the loopback bridge as its own fallback. A page without that group (or\n * one where its client half has not applied yet) binds through the shared forms\n * service, on the entry id the describe mirror justifies and rebound as soon as\n * the mirror answers — see {@link createServedEntryForm} for why a one-shot\n * guess cannot be right for both an aggregate and a standalone install.\n * @param ctx - the browser plugin context.\n * @returns the form the settings card reads and writes.\n */\nexport function bindSettingsForm(ctx: ClientContext): ConfigForm<LiangShenSettings> {\n const binder = ctx.get('webUiSettings')\n if (binder !== undefined && typeof binder.bind === 'function') {\n return binder.bind<LiangShenSettings>({ namespace: SETTINGS_NAMESPACE })\n }\n return createServedEntryForm<LiangShenSettings>({\n forms: ctx.configForms,\n entryIds: LIANGSHEN_ENTRY_IDS,\n })\n}\n\n/** Owner share of a plugin card (the section supplies nothing). */\nexport interface SettingsPluginItemOwnerProps {\n /** Marker field: card owner props are intentionally empty. */\n children?: never\n}\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface SlotMap {\n /**\n * The child slot the Web UI plugin group declares; this card registers into\n * the group's list seat rather than the official bundle-configuration\n * seat. Declared here so this package needs no dependency on the sibling UI\n * package.\n */\n 'web-ui.plugin.item': { kind: 'list'; scope: 'root'; owner: SettingsPluginItemOwnerProps }\n }\n}\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n /**\n * Optional family settings binder provided by dsh-web-settings; absent when\n * that group plugin is not installed, so callers bind the shared forms\n * service (`ctx.configForms`) by profile entry id directly.\n */\n webUiSettings?: { bind<S>(spec: LiangShenFormSpec<S>): ConfigForm<S> }\n }\n}\n\n/**\n * One settings namespace a family card binds. The 0.1.7 client exports no spec\n * type (the form controller takes it privately), so the binder's input shape is\n * restated here.\n */\nexport interface LiangShenFormSpec<T> {\n /** Settings namespace registered by the owning host plugin. */\n namespace: string\n /** Narrow one wire section; undefined keeps the last accepted value. */\n decode?: (section: unknown) => T | undefined\n}\n\n/**\n * Required client services: the slot registry, locale, sessions, the shared\n * configuration forms, and the roster Remote. Both `remote` and\n * `remote.agentPresets` are declared: the context proxy refuses an uninjected\n * service, and a nested service name does not imply its parent, so reading\n * `ctx.remote.agentPresets` needs `remote` as well.\n */\nexport const inject = ['slots', 'locale', 'sessions', 'configForms', 'remote', 'remote.agentPresets']\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap {\n /** The LiangShen lever copy. */\n 'liangshen': LiangShenKey\n }\n}\n\nexport { LiangShenLever } from './LiangShenLever.tsx'\nexport { LeverController, type LeverFace, type LeverSnapshot } from './lever-controller.ts'\nexport { LIANGSHEN_PRESET_ID, leverState, restoreTarget, type LeverFacts, type LeverState } from '../core/lever.ts'\n\n/**\n * Mount the lever: register the copy, follow the roster and the current\n * session, and claim the composer tool row.\n * @param ctx - the browser plugin context.\n */\nexport function apply(ctx: ClientContext): void {\n ctx.effect(() => {\n try {\n return ctx.locale.register(NS, { zh, en })\n } catch {\n return () => {}\n }\n }, 'liangshen: lever dictionaries')\n\n const controller = new LeverController(ctx)\n ctx.effect(() => () => controller.dispose(), 'liangshen: lever controller')\n try {\n controller.start()\n } catch {\n // An unavailable sessions or Remote service leaves the lever inert; the\n // view still renders and reports what it knows.\n }\n\n // Plugin configuration card: one staged form over the `liangshen` settings\n // namespace, contributed to the Web UI plugin group beside the\n // remote-access and task-board cards.\n try {\n const settingsCard = new LiangShenSettingsCardController(bindSettingsForm(ctx))\n // Card seat: the family group's list seat, or the official\n // bundle-configuration seat when the group is not installed.\n installPluginCard(ctx, {\n bundle: '@linxin666/dsh-liangshen',\n id: 'liangshen',\n order: 120,\n locale: NS,\n inject: () => settingsCard.inject(),\n component: LiangShenSettingsCard,\n })\n ctx.effect(() => () => { settingsCard.dispose() }, 'liangshen: settings card')\n } catch {\n // A missing settings surface leaves the lever working and the card absent;\n // one unavailable service must not take the browser half down.\n }\n\n ctx.slots.inject('conversation.input.right', () => {\n try {\n const unregister = ctx.slots.register({\n name: 'conversation.input.right',\n id: 'liangshen-lever',\n order: 20,\n inject: () => controller.face(),\n }, LiangShenLever)\n return () => { unregister() }\n } catch {\n return () => {}\n }\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmBA,MAAM,oBAAoB;;EAG1B,MAAM,WAAW;;EAGjB,MAAM,SAAS;EACf,MAAM,QAAQ;;EAGd,MAAM,SAAS,MAAM,KAAK,EAAE,QAAQ,GAAG,IAAI,GAAG,UAAU,KAAK;;EAG7D,SAAS,aAAa,OAAqB;GACzC,IAAI;IACF,IAAI,OAAO,aAAa,aAAa;IACrC,MAAM,OAAO,SAAS,cAA2B,2DAAuD,KACnG,MAAM,KAAK,SAAS,iBAA8B,qCAAmC,CAAC,CAAC,CAAC,MAAK,MAAK,EAAE,UAAU,SAAS,WAAW,CAAC;IACxI,IAAI,QAAQ,KAAK,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gC,iBAAiB,GAAG,CAAC;IAG9E,kBAAkB,KAAK;KACrB,QAAQ;KACR,IAAI;KACJ,OAAO;KACP,QAAQ;KACR,cAAc,aAAa,OAAO;KAClC,WAAW;IACb,CAAC;IACD,IAAI,mBAAmB;KAAE,aAAa,QAAQ;IAAE,GAAG,0BAA0B;GAC/E,QAAQ,CAGR;GAEA,IAAI,MAAM,OAAO,kCAAkC;IACjD,IAAI;KACF,MAAM,aAAa,IAAI,MAAM,SAAS;MACpC,MAAM;MACN,IAAI;MACJ,OAAO;MACP,cAAc,WAAW,KAAK;KAChC,GAAG,cAAc;KACjB,aAAa;MAAE,WAAW;KAAE;IAC9B,QAAQ;KACN,aAAa,CAAC;IAChB;GACF,CAAC;EACH"}
1
+ {"version":3,"file":"client.js","names":["css","css","Children","css","css"],"sources":["../../../packages/dsh-liangshen/src/client/LiangShenLever.tsx","../../../packages/dsh-liangshen/src/client/main-session.ts","../../../packages/dsh-liangshen/src/core/lever.ts","../../../packages/dsh-liangshen/src/client/lever-controller.ts","../../../packages/dsh-liangshen/src/client/LiangShenMark.tsx","../../../packages/dsh-liangshen/src/client/RangeBubble.tsx","../../../packages/dsh-liangshen/src/client/SegmentGroup.tsx","../../../packages/dsh-liangshen/src/client/PluginSettingsCard.tsx","../../../packages/dsh-liangshen/src/client/settings-form.ts","../../../packages/dsh-liangshen/src/client/LiangShenSettingsCard.tsx","../../../packages/dsh-liangshen/src/client/locales.ts","../../../packages/dsh-liangshen/src/client/plugin-card-seat.ts","../../../packages/dsh-liangshen/src/client/settings-entry-form.ts","../../../packages/dsh-liangshen/src/client/index.ts"],"sourcesContent":["/**\n * The homepage lever: a slot-machine arm beside the model selector.\n *\n * Pull it down and the session about to start becomes LiangShen mode; push it\n * up and the preset the user was on comes back. The arm tracks the real preset\n * (never a local guess), and the theatrical part — flash, shockwave, sparks,\n * and the three-language jackpot banner — plays only once the switch actually\n * landed, so a refused switch never celebrates.\n *\n * The component is pure: every fact and verb arrives through the injected face.\n * A pointer drag past {@link DRAG_THRESHOLD_PX} counts as a pull or a push; a\n * plain click or a keyboard activation toggles instead.\n */\n\nimport { useEffect, useRef, useState, useSyncExternalStore, type PointerEvent as ReactPointerEvent, type ReactElement } from 'react'\nimport type { LeverFace } from './lever-controller.ts'\nimport css from './LiangShenLever.module.css'\n\n/** Vertical travel that separates a pull or push from a plain click. */\nconst DRAG_THRESHOLD_PX = 14\n\n/** How long the burst overlay stays mounted, matching its CSS duration. */\nconst BURST_MS = 2200\n\n/** Jackpot lines that read the same in every language. */\nconst BINARY = '01001100 01001001 01000001 01001110 01000111'\nconst MORSE = '-.. . . .--. ... . . -.- / .... .- .-. -. . ... ...'\n\n/** One spark per spoke of the burst. */\nconst SPARKS = Array.from({ length: 14 }, (_, index) => index)\n\n/** Sync the hero preset chip above the composer so both controls always agree. */\nfunction syncHeroChip(label: string): void {\n try {\n if (typeof document === 'undefined') return\n const chip = document.querySelector<HTMLElement>('button[aria-haspopup=\"menu\"] span[class*=\"seatLabel\"]')\n ?? Array.from(document.querySelectorAll<HTMLElement>('button[aria-haspopup=\"menu\"] span')).find(s => s.className.includes('seatLabel'))\n if (chip && chip.textContent !== label) {\n chip.textContent = label\n }\n } catch {\n // Non-browser or detached element\n }\n}\n\n/** Slot entry for `conversation.input.right` (left of the model selector). */\nexport function LiangShenLever(face: LeverFace): ReactElement | null {\n const snapshot = useSyncExternalStore(face.store.subscribe, face.store.getSnapshot)\n const { state, restoreLabel, busy, error, burst } = snapshot\n const [burstKey, setBurstKey] = useState(0)\n const seen = useRef(burst)\n const drag = useRef<{ x: number, y: number, fired: boolean } | undefined>(undefined)\n const actionable = !busy && (state === 'on' || state === 'off')\n const on = state === 'on'\n const errorText = error === undefined\n ? undefined\n : error.kind === 'locked'\n ? face.t('lever.failed.locked')\n : error.kind === 'missing'\n ? face.t('lever.failed.missing')\n : error.kind === 'timeout'\n ? face.t('lever.failed.timeout')\n : face.t('lever.failed.failed', { reason: error.reason })\n\n // The burst is driven by the controller's counter, so a reload or a refresh\n // can never replay it and a refused switch can never start it.\n useEffect(() => {\n if (burst > seen.current) setBurstKey(burst)\n seen.current = burst\n }, [burst])\n\n useEffect(() => {\n if (burstKey === 0) return\n const timer = setTimeout(() => { setBurstKey(0) }, BURST_MS)\n return () => { clearTimeout(timer) }\n }, [burstKey])\n\n // Keep the hero preset chip above the composer in sync with the lever's selection\n const prevState = useRef(state)\n useEffect(() => {\n if (state === 'on') {\n syncHeroChip(face.t('lever.name'))\n } else if (prevState.current === 'on' && state === 'off' && restoreLabel !== '') {\n syncHeroChip(restoreLabel)\n }\n prevState.current = state\n }, [state, restoreLabel, face])\n\n // The lever exists only while the preset can still change, which is the\n // blank-session window: a started session reports `locked`, a deployment\n // without the preset reports `missing`, and both mean the row renders\n // nothing instead of a dead control in the composer of a running session.\n // An `on` lever with an empty restore label has nothing to return to either\n // (the roster supplies no other usable preset), so a push there would be the\n // same dead control: render nothing rather than a switch that eats gestures.\n if (state === 'locked' || state === 'missing' || (state === 'on' && restoreLabel === '')) return null\n\n const toggle = (): void => {\n if (!actionable) return\n if (on) face.push()\n else face.pull()\n }\n\n const onPointerDown = (event: ReactPointerEvent<HTMLButtonElement>): void => {\n if (!actionable) return\n drag.current = { x: event.clientX, y: event.clientY, fired: false }\n try {\n event.currentTarget.setPointerCapture?.(event.pointerId)\n } catch {\n // Defensive: some environments throw on pointer capture\n }\n }\n\n const onPointerMove = (event: ReactPointerEvent<HTMLButtonElement>): void => {\n const pending = drag.current\n if (pending === undefined || pending.fired) return\n const travelY = event.clientY - pending.y\n const travelX = event.clientX - pending.x\n if (Math.hypot(travelX, travelY) >= DRAG_THRESHOLD_PX) {\n pending.fired = true\n if (on) face.push()\n else face.pull()\n }\n }\n\n const onPointerUp = (): void => {\n const pending = drag.current\n drag.current = undefined\n // A drag already fired its verb; a click without travel still toggles.\n if (pending === undefined || pending.fired) return\n toggle()\n }\n\n return (\n <span\n className={css.lever}\n data-dsh-plugin=\"liangshen\"\n data-dsh-part=\"lever\"\n data-state={state}\n data-busy={busy ? 'true' : undefined}\n >\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={on}\n aria-label={face.t('lever.a11y')}\n aria-busy={busy}\n title={hint(face, state, restoreLabel)}\n className={css.control}\n disabled={!actionable}\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={onPointerUp}\n onPointerCancel={onPointerUp}\n // Keyboard and assistive activation arrives as a detail-less click;\n // pointer activation is already handled on pointerup.\n onClick={(event) => { if (event.detail === 0) toggle() }}\n >\n <span className={css.track} data-dsh-part=\"lever-track\" aria-hidden=\"true\">\n <svg className={css.arm} data-dsh-part=\"lever-arm\" viewBox=\"0 0 16 26\" aria-hidden=\"true\">\n <rect className={css.rod} x=\"6.5\" y=\"3.5\" width=\"3\" height=\"21\" rx=\"1.5\" />\n <circle className={css.knob} cx=\"8\" cy=\"4\" r=\"3.4\" />\n </svg>\n </span>\n <span className={css.readout}>{busy ? face.t('lever.busy') : on ? face.t('lever.state.on') : face.t('lever.state.off')}</span>\n </button>\n {errorText !== undefined && (\n <span className={css.error} role=\"status\" title={errorText}>{errorText}</span>\n )}\n {burstKey !== 0 && <Burst key={burstKey} face={face} />}\n </span>\n )\n}\n\n/** The hover hint: what this gesture would do right now. */\nfunction hint(face: LeverFace, state: string, restoreLabel: string): string {\n if (state === 'locked') return face.t('lever.hint.locked')\n if (state === 'missing') return face.t('lever.hint.missing')\n if (state === 'on') return face.t('lever.hint.push', { preset: restoreLabel === '' ? face.t('lever.state.off') : restoreLabel })\n return face.t('lever.hint.pull')\n}\n\n/** The jackpot overlay: flash, shockwave rings, sparks, and the banner. */\nfunction Burst({ face }: { face: LeverFace }): ReactElement {\n return (\n <span className={css.burst} data-dsh-part=\"lever-burst\" aria-hidden=\"true\">\n <span className={css.flash} />\n <span className={css.ring} />\n <span className={css.ring} />\n <span className={css.ring} />\n <span className={css.banner} data-dsh-part=\"lever-banner\">\n <span className={css.bannerName}>{face.t('lever.name')}</span>\n <span className={css.line}>{face.t('burst.line1')}</span>\n <span className={css.line}>{face.t('burst.line2')}</span>\n <span className={css.code}>{BINARY}</span>\n <span className={css.code}>{MORSE}</span>\n </span>\n <span className={css.sparks}>\n {SPARKS.map(spoke => (\n // `rotate` is its own property so the keyframes' translate runs along\n // the spoke after the rotation composes with it.\n <i key={spoke} className={css.spark} style={{ rotate: `${spoke * (360 / SPARKS.length)}deg` }} />\n ))}\n </span>\n </span>\n )\n}\n","// Generated by scripts/sync-shared.mjs from shared/client/main-session.ts. Do not edit this copy; edit the shared source and run \"node scripts/sync-shared.mjs\".\n/**\n * Main-view Session derivation for the multi-instance Client Session model.\n *\n * The Client Session Controller carries no global \"current\" selection: view\n * selection belongs to the workspace UI, which owns the main-area reference and\n * publishes it through the catalog's per-source ownership counts\n * (`SessionSummary.retainedBy.mainView`). A plugin that needs the Session the\n * main view shows derives it from that marker instead of the removed\n * `SessionListState.current` field.\n *\n * The marker describes view ownership, not authority. It is the right input for\n * presentation and for deciding which view a navigation targets; it is not a\n * business fallback, because source counts never imply visibility or success.\n * @module dsh-web/shared/main-session\n */\n\n/** The catalog row subset this helper reads (a `SessionSummary` projection). */\nexport interface MainViewOwnedRow<Id extends string = string> {\n /** Catalog row identity. */\n readonly id: Id\n /** Per-source local ownership counts; absent rows are never owned. */\n readonly retainedBy?: Readonly<Partial<Record<string, number>>> | undefined\n}\n\n/**\n * Resolve the Session the main view currently shows.\n *\n * Reads the catalog's rows rather than a per-id retain-info source: ownership\n * counts ride the list snapshot, so this neither allocates observers nor opens\n * history, and a subscription to the list still fires when the selection moves.\n * @param byId - the session catalog's rows (`SessionListState.byId`), when available.\n * @returns the main-view session id, or undefined when the main view shows none.\n */\nexport function mainViewSessionId<Id extends string>(\n byId: Readonly<Record<Id, MainViewOwnedRow<Id> | undefined>> | undefined | null,\n): Id | undefined {\n if (byId === undefined || byId === null) return undefined\n for (const row of Object.values<MainViewOwnedRow<Id> | undefined>(byId)) {\n if (row !== undefined && (row.retainedBy?.mainView ?? 0) > 0) return row.id\n }\n return undefined\n}\n","/**\n * LiangShen lever logic — framework-free, no DOM, compiled by both programs.\n *\n * The lever is a homepage control beside the model selector: pulling it down\n * turns the current session's preset into LiangShen mode, pushing it up\n * restores the preset the user was on before. The facts it needs are the\n * current session's preset, whether that session may still change preset at\n * all, and the preset roster; the decisions are pure so they can be tested\n * without the browser runtime.\n *\n * A preset is fixed once a session starts (the host refuses the switch with\n * `agent-preset/locked`), so the lever is only meaningful while the session is\n * blank — which is exactly the new-session screen it renders on.\n */\n\n/** The preset id this lever turns on; also the preset directory name. */\nexport const LIANGSHEN_PRESET_ID = 'liangshen'\n\n/** What the lever currently reports. */\nexport type LeverState =\n /** LiangShen mode is the current preset. */\n | 'on'\n /** Another preset is current and the session may still switch. */\n | 'off'\n /** The session has started; the preset can no longer change. */\n | 'locked'\n /** The deployment does not supply the LiangShen preset. */\n | 'missing'\n\n/** The facts one lever decision reads. */\nexport interface LeverFacts {\n /** Whether the current session may still change preset (blank). */\n blank: boolean\n /** The preset the current session runs, when the session reports one. */\n agentPreset?: string\n /** Ids every usable roster row supplies, in roster order. */\n available: readonly string[]\n /** The deployment default preset id, when the roster names one. */\n fallback?: string\n /** The preset the user ran before the last pull-down, remembered by the client. */\n previous?: string\n}\n\n/** Resolve what the lever shows for one set of facts. */\nexport function leverState(facts: LeverFacts): LeverState {\n if (!facts.available.includes(LIANGSHEN_PRESET_ID)) return 'missing'\n if (!facts.blank) return 'locked'\n return facts.agentPreset === LIANGSHEN_PRESET_ID ? 'on' : 'off'\n}\n\n/**\n * The preset a push-up restores: the preset the user was on before pulling the\n * lever, else the deployment default, else the first usable roster row that is\n * not the LiangShen preset. A candidate is skipped when it is the LiangShen\n * preset itself (restoring it would be a no-op) or when the roster no longer\n * supplies it. That last resort is what keeps the push direction alive when the\n * deployment default IS LiangShen mode: `fallback` is skipped then, and after a\n * reload `previous` is gone, so without it the gesture would have no target.\n */\nexport function restoreTarget(facts: LeverFacts): string | undefined {\n for (const candidate of [facts.previous, facts.fallback]) {\n if (candidate === undefined || candidate === LIANGSHEN_PRESET_ID) continue\n if (facts.available.includes(candidate)) return candidate\n }\n return facts.available.find(candidate => candidate !== LIANGSHEN_PRESET_ID)\n}\n\n/** Whether the lever can act at all in its current state. */\nexport function isActionable(state: LeverState): boolean {\n return state === 'on' || state === 'off'\n}\n","/**\n * Lever controller: the business face behind the homepage lever.\n *\n * The view stays pure; every fact and verb comes from here. The roster arrives\n * over the agent-preset Remote namespace (the same one the official surfaces\n * read), the main-view session comes from the catalog's ownership marker, and the\n * switch goes through `agentPresets.select`, which the host accepts only while\n * the session is still blank.\n *\n * Nothing is cached across reloads except in memory: the lever reads the\n * session's `agentPreset` projection, so a page reload still shows the true\n * state, while `previous` (the preset a push-up restores) is remembered for\n * the length of the page visit and otherwise falls back to the deployment\n * default.\n */\n\nimport type { Context as ClientContext } from '@deepseek-ai/cordis'\nimport type { AgentPresetRoster } from '@deepseek-ai/dsh-agent-preset-registry/types'\nimport type { ISessions } from '@deepseek-ai/dsh-api-session-controller/client'\nimport { mainViewSessionId } from './main-session.ts'\nimport type { RemoteResult } from '@deepseek-ai/dsh-api-remotes/client'\nimport { createSnapshotStore, type SnapshotStore } from '@deepseek-ai/dsh-client-store'\nimport { LIANGSHEN_PRESET_ID, isActionable, leverState, restoreTarget, type LeverFacts, type LeverState } from '../core/lever.ts'\nimport type { LiangShenKey } from './locales.ts'\n\n/**\n * Why the last switch was refused, mapped from the Remote failure code so the\n * view can render localized copy instead of a host message.\n */\nexport type LeverError =\n /** The session already started; its composition is fixed. */\n | { kind: 'locked' }\n /** The deployment supplies no such preset. */\n | { kind: 'missing' }\n /**\n * The switch outlived its ceiling. A Remote answer can be lost on the way\n * back even though the host committed the change, so the lever must stop\n * claiming to be busy and let the next session read report the truth.\n */\n | { kind: 'timeout' }\n /** Anything else, carrying the host's own reason. */\n | { kind: 'failed'; reason: string }\n\n/** How long one preset switch may stay in flight before it is reported as timed out. */\nexport const SELECT_TIMEOUT_MS = 10_000\n\n/**\n * Settings entry ids whose writes can move the roster this lever reads: the\n * agent-preset registry's own entry (its default and selection policy) and this\n * plugin's row under either install shape — the aggregate's generated row id\n * and the standalone row id — because disabling the plugin unregisters the\n * preset it declares.\n */\nexport const ROSTER_SETTINGS_ENTRY_IDS: readonly string[] = ['agent-preset-registry', 'web-ui-liangshen', 'liangshen']\n\n/** What the lever view renders. */\nexport interface LeverSnapshot {\n /** Resolved lever state. */\n state: LeverState\n /** Display name of the preset a push-up restores; empty when there is none. */\n restoreLabel: string\n /** A switch is in flight. */\n busy: boolean\n /** The last refusal, cleared by the next attempt. */\n error?: LeverError\n /** Increments when a pull-down landed, so the view replays the burst once. */\n burst: number\n}\n\n/**\n * The two agent-preset Remote calls this plugin makes. Spelled locally: the\n * generated namespace merge belongs to the SDK's own client packages, and this\n * browser bundle only needs the two members it calls.\n */\nexport interface AgentPresetRemote {\n list(): Promise<RemoteResult<AgentPresetRoster>>\n select(sessionId: string, agentPreset: string): Promise<RemoteResult<string>>\n}\n\n/** The injected face the lever view consumes. */\nexport interface LeverFace {\n /** The snapshot store the view subscribes to. */\n store: SnapshotStore<LeverSnapshot>\n /** Pull the lever down: turn LiangShen mode on. */\n pull: () => void\n /** Push the lever up: restore the previous preset. */\n push: () => void\n /** Translate one lever key. */\n t: (key: LiangShenKey, vars?: Record<string, string | number>) => string\n}\n\n/** Read the preset a session summary reports, when it reports one. */\nfunction presetOf(session: { projectionValues?: Record<string, unknown> } | undefined): string | undefined {\n const value = session?.projectionValues?.['agentPreset']\n return typeof value === 'string' ? value : undefined\n}\n\n/** The lever controller: roster read, session facts, and the preset switch. */\nexport class LeverController {\n private readonly store: SnapshotStore<LeverSnapshot>\n\n /**\n * The browser services this controller reads, resolved defensively: the\n * context proxy throws on any service the fiber did not inject, so a\n * deployment that cannot answer one of them must leave the lever inert\n * rather than take the plugin (and the composer row) down with it.\n */\n private readonly sessions: ISessions | undefined\n\n private readonly remote: AgentPresetRemote | undefined\n\n /** Roster rows as last read; empty until the first read lands. */\n private rows: AgentPresetRoster['presets'] = []\n\n /** The preset the user was on before the last pull-down. */\n private previous: string | undefined\n\n private loading = false\n\n /** Ceiling on one in-flight switch, so a lost Remote answer cannot hang the row. */\n private readonly selectTimeoutMs: number\n\n private readonly disposers: (() => void)[] = []\n\n constructor(private readonly ctx: ClientContext, options: LeverControllerOptions = {}) {\n this.selectTimeoutMs = options.selectTimeoutMs ?? SELECT_TIMEOUT_MS\n this.sessions = readService<ISessions>(() => (ctx as unknown as { sessions: ISessions }).sessions)\n this.remote = readService<AgentPresetRemote>(\n () => (ctx as unknown as { remote: { agentPresets: AgentPresetRemote } }).remote.agentPresets,\n )\n this.store = createSnapshotStore<LeverSnapshot>({\n state: 'off',\n restoreLabel: '',\n busy: false,\n burst: 0,\n })\n }\n\n /** The snapshot store the view subscribes to. */\n snapshot(): SnapshotStore<LeverSnapshot> {\n return this.store\n }\n\n /** Follow the roster and the current session, then read the roster once. */\n start(): void {\n const list = this.sessions?.list\n if (list !== undefined) {\n this.disposers.push(list.subscribe(() => { this.refresh() }))\n }\n const remote = readService<{ $on?: (event: string, listener: (ns: string) => void) => () => void }>(\n () => (this.ctx as unknown as { remote: { $on: (event: string, listener: (ns: string) => void) => () => void } }).remote,\n )\n if (typeof remote?.$on === 'function') {\n this.disposers.push(remote.$on('settings/document-updated', (ns: string) => {\n if (ROSTER_SETTINGS_ENTRY_IDS.includes(ns)) void this.load()\n }))\n }\n this.refresh()\n if (this.remote !== undefined) void this.load()\n }\n\n /** Release every subscription. Idempotent. */\n dispose(): void {\n for (const dispose of this.disposers.splice(0)) dispose()\n }\n\n /** The inject face handed to the slot entry. */\n face(): LeverFace {\n return {\n store: this.store,\n pull: () => { void this.toggle('down') },\n push: () => { void this.toggle('up') },\n t: (key, vars) => {\n const translate = readService<(key: LiangShenKey, vars?: Record<string, string | number>) => string>(\n () => this.ctx.locale.bind('liangshen'),\n )\n return translate === undefined ? key : translate(key, vars)\n },\n }\n }\n\n /** Read the roster; a refusal leaves the lever as it was. */\n async load(): Promise<void> {\n if (this.loading) return\n const remote = this.remote\n if (remote === undefined) return\n this.loading = true\n try {\n const result = await remote.list()\n if (result.ok) this.rows = result.value.presets\n } catch {\n // A carrier failure leaves the roster empty; the view reports `missing`.\n } finally {\n this.loading = false\n this.refresh()\n }\n }\n\n /**\n * Recompute the snapshot from the current session and the last roster read.\n * Only the derived fields are written: an in-flight switch, the last refusal,\n * and the burst counter belong to the gesture, not to a session refresh.\n */\n refresh(): void {\n const facts = this.facts()\n const snapshot = this.store.getSnapshot()\n const state = leverState(facts)\n const target = restoreTarget(facts)\n const restoreLabel = target === undefined ? '' : this.labelOf(target)\n if (snapshot.state === state && snapshot.restoreLabel === restoreLabel) return\n this.store.set({ ...snapshot, state, restoreLabel })\n }\n\n /** The verb behind one gesture direction. */\n private async toggle(direction: 'down' | 'up'): Promise<void> {\n const snapshot = this.store.getSnapshot()\n if (snapshot.busy) return\n const remote = this.remote\n if (remote === undefined) return\n const facts = this.facts()\n if (!isActionable(leverState(facts))) return\n const target = direction === 'down' ? LIANGSHEN_PRESET_ID : restoreTarget(facts)\n const sessionId = this.currentSessionId()\n if (target === undefined || sessionId === undefined) return\n if (facts.agentPreset === target) {\n // Already there: a gesture on the current state is a no-op, not a switch.\n this.refresh()\n return\n }\n this.store.set({ ...snapshot, busy: true, error: undefined })\n let result: RemoteResult<string>\n try {\n result = await withTimeout(remote.select(sessionId, target), this.selectTimeoutMs)\n } catch (error) {\n // A timeout is its own copy: the host may well have committed the change\n // even though its answer never arrived, so this reports the wait, and the\n // next session read (or the next gesture) shows what actually happened.\n const mapped: LeverError = error instanceof SwitchTimeout\n ? { kind: 'timeout' }\n : { kind: 'failed', reason: message(error) }\n this.store.set({ ...this.store.getSnapshot(), busy: false, error: mapped })\n this.refresh()\n return\n }\n if (!result.ok) {\n this.store.set({ ...this.store.getSnapshot(), busy: false, error: refusal(result.error) })\n this.refresh()\n return\n }\n // The switch landed: remember where to return, then celebrate only the\n // pull that turned the mode on.\n if (direction === 'down') {\n const prev = facts.agentPreset ?? this.detectPreset()\n if (prev !== undefined && prev !== LIANGSHEN_PRESET_ID) {\n this.rememberPrevious(prev)\n }\n }\n const next = this.store.getSnapshot()\n this.store.set({ ...next, busy: false, error: undefined, burst: direction === 'down' ? next.burst + 1 : next.burst })\n this.refresh()\n }\n\n /**\n * Try to detect the active preset from the DOM hero chip or storage\n * when session.projectionValues.agentPreset is absent.\n */\n private detectPreset(): string | undefined {\n try {\n if (typeof document !== 'undefined') {\n const chip = document.querySelector<HTMLElement>('button[aria-haspopup=\"menu\"] span[class*=\"seatLabel\"]')\n ?? Array.from(document.querySelectorAll<HTMLElement>('button[aria-haspopup=\"menu\"] span')).find(s => s.className.includes('seatLabel'))\n const text = chip?.textContent?.trim()\n if (text) {\n const matched = this.rows.find(row => (row.name === text || row.id === text) && row.id !== LIANGSHEN_PRESET_ID)\n if (matched) return matched.id\n }\n }\n } catch {\n // Defensive\n }\n\n try {\n if (typeof sessionStorage !== 'undefined') {\n const stored = sessionStorage.getItem('dsh-liangshen:previous-preset')\n if (stored && stored !== LIANGSHEN_PRESET_ID && this.rows.some(r => r.id === stored)) {\n return stored\n }\n }\n } catch {\n // Defensive\n }\n\n return undefined\n }\n\n private rememberPrevious(presetId: string | undefined): void {\n if (presetId === undefined || presetId === LIANGSHEN_PRESET_ID) return\n this.previous = presetId\n try {\n if (typeof sessionStorage !== 'undefined') {\n sessionStorage.setItem('dsh-liangshen:previous-preset', presetId)\n }\n } catch {\n // Defensive\n }\n }\n\n /** The facts one decision reads, from the live session and the roster. */\n private facts(): LeverFacts {\n const summary = this.currentSession()\n const available = this.rows.filter(row => row.broken === undefined).map(row => row.id)\n const fallback = this.rows.find(row => row.isDefault)?.id\n const currentPreset = presetOf(summary)\n\n if (currentPreset !== undefined && currentPreset !== LIANGSHEN_PRESET_ID) {\n this.rememberPrevious(currentPreset)\n }\n\n const previous = this.previous ?? this.detectPreset()\n\n return {\n blank: summary?.blank === true,\n agentPreset: currentPreset,\n available,\n fallback,\n previous,\n }\n }\n\n private currentSessionId(): string | undefined {\n return mainViewSessionId(this.sessions?.list.getSnapshot().byId)\n }\n\n private currentSession(): { blank?: boolean, projectionValues?: Record<string, unknown> } | undefined {\n const state = this.sessions?.list.getSnapshot()\n const current = mainViewSessionId(state?.byId)\n if (state === undefined || current === undefined) return undefined\n return state.byId[current] as unknown as { blank?: boolean, projectionValues?: Record<string, unknown> } | undefined\n }\n\n /** Display name of one preset id, falling back to the id itself. */\n private labelOf(id: string): string {\n const row = this.rows.find(candidate => candidate.id === id)\n return row?.name ?? id\n }\n}\n\n/** The face constructor options; tests narrow the switch ceiling. */\nexport interface LeverControllerOptions {\n /** Override {@link SELECT_TIMEOUT_MS}. */\n selectTimeoutMs?: number\n}\n\n/** Raised when one switch outlives {@link SELECT_TIMEOUT_MS}. */\nclass SwitchTimeout extends Error {\n constructor() {\n super('the preset switch did not answer in time')\n this.name = 'SwitchTimeout'\n }\n}\n\n/** Resolve with `work`, or reject with a {@link SwitchTimeout} after `ms`. */\nfunction withTimeout<T>(work: Promise<T>, ms: number): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n const timer = setTimeout(() => { reject(new SwitchTimeout()) }, ms)\n work.then(\n (value) => { clearTimeout(timer); resolve(value) },\n (error: unknown) => { clearTimeout(timer); reject(error instanceof Error ? error : new Error(String(error))) },\n )\n })\n}\n\n/**\n * Read one context service, treating the proxy's \"without inject\" refusal (and\n * any other resolution fault) as the service being absent.\n */\nfunction readService<T>(read: () => T): T | undefined {\n try {\n return read()\n } catch {\n return undefined\n }\n}\n\n/** The host's own reason for a refusal, mapped to lever copy. */\nfunction refusal(error: { code?: string, message?: string, details?: unknown }): LeverError {\n if (error.code === 'agent-preset/locked') return { kind: 'locked' }\n if (error.code === 'agent-preset/not-found') return { kind: 'missing' }\n const details = error.details\n if (typeof details === 'object' && details !== null && typeof (details as { reason?: unknown }).reason === 'string') {\n return { kind: 'failed', reason: (details as { reason: string }).reason }\n }\n return { kind: 'failed', reason: error.message ?? error.code ?? 'unknown' }\n}\n\nfunction message(error: unknown): string {\n return error instanceof Error ? error.message : String(error)\n}\n","/**\n * Card mark for the LiangShen settings entry: the mode's machine is a\n * slot-machine lever, so the mark is that lever reduced to one knob, one arm\n * and one pivot foot. Three rounded shapes with no interior detail stay\n * legible at 18px, and every shape is painted with `currentColor` so the mark\n * follows the surrounding theme like the lever itself does.\n */\n\nimport type { ReactElement } from 'react'\n\n/**\n * Render the LiangShen card mark.\n * @returns the 18x18 lever mark, in the current text color.\n */\nexport function LiangShenMark(): ReactElement {\n return (\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 18 18\" fill=\"none\" aria-hidden=\"true\">\n <rect x=\"3.6\" y=\"13.2\" width=\"8.8\" height=\"2.8\" rx=\"1.4\" fill=\"currentColor\" />\n <g transform=\"rotate(20 8 14.4)\">\n <rect x=\"6.5\" y=\"4.6\" width=\"3\" height=\"9.8\" rx=\"1.5\" fill=\"currentColor\" />\n <circle cx=\"8\" cy=\"4.4\" r=\"2.9\" fill=\"currentColor\" />\n </g>\n </svg>\n )\n}\n","// Generated by scripts/sync-shared.mjs from shared/client/settings/RangeBubble.tsx. Do not edit this copy; edit the shared source and run \"node scripts/sync-shared.mjs\".\n/**\n * Coarse adjustment for a bounded number: resting the pointer on the control\n * (or moving focus into it) raises a small bubble holding a slider across the\n * field's whole range, so a large change is one drag instead of many presses\n * or a retyped value. The control itself stays the precise entry.\n *\n * The bubble belongs to the anchor's subtree, so moving from the control onto\n * the bubble never counts as leaving. It opens after a short rest and closes a\n * moment after the pointer and focus have both gone, so crossing the control\n * on the way elsewhere does not flash it. While a drag is in progress the\n * bubble stays put even if the pointer strays off it.\n *\n * Dragging reports each value through `onInput`, so the field shows it live;\n * releasing the thumb, or a key press on it, reports `onCommit` once. The\n * bubble opens on the side of the control that has room inside the nearest\n * scrolling ancestor, so a row near the top of a settings page does not hang\n * its bubble under the page edge.\n */\n\nimport { useEffect, useRef, useState, type ChangeEvent, type CSSProperties, type KeyboardEvent, type ReactNode } from 'react'\nimport css from './settings-card.module.css'\n\n/** Rest on the control before the bubble opens. */\nconst OPEN_DELAY_MS = 220\n/** Grace after pointer and focus have left before the bubble closes. */\nconst CLOSE_DELAY_MS = 200\n/** Room the bubble needs between the control and the scroller's edge. */\nconst BUBBLE_ROOM_PX = 64\n\n/** Props of {@link RangeBubble}. */\nexport interface RangeBubbleProps {\n /** Lowest value the slider reaches. */\n min: number\n /** Highest value the slider reaches. */\n max: number\n /** Slider granularity. */\n step: number\n /** Current value; a value outside the range parks the thumb at the nearer end. */\n value: number\n /** Accessible name of the slider. */\n label: string\n /** Disables the bubble along with the control. */\n disabled?: boolean\n /** Each value while the thumb moves. */\n onInput: (value: number) => void\n /** The value the thumb was released on, once per drag or key press. */\n onCommit: (value: number) => void\n /** The precise control the bubble hangs off. */\n children: ReactNode\n}\n\n/** The nearest ancestor that scrolls vertically, or the viewport's root. */\nfunction scroller(node: HTMLElement): HTMLElement {\n for (let parent = node.parentElement; parent !== null; parent = parent.parentElement) {\n const overflow = getComputedStyle(parent).overflowY\n if (overflow === 'auto' || overflow === 'scroll') return parent\n }\n return node.ownerDocument.documentElement\n}\n\n/**\n * Render the control with its coarse-adjustment bubble.\n * @param props - the range, the value and the two report callbacks.\n * @returns the anchor holding the control and the bubble.\n */\nexport function RangeBubble(props: RangeBubbleProps): ReactNode {\n const { min, max, step, disabled = false } = props\n const [open, setOpen] = useState(false)\n const [side, setSide] = useState<'above' | 'below'>('above')\n const [live, setLive] = useState<number | null>(null)\n const anchorRef = useRef<HTMLDivElement | null>(null)\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined)\n const hovered = useRef(false)\n const focused = useRef(false)\n const dragging = useRef(false)\n\n useEffect(() => () => { clearTimeout(timer.current) }, [])\n useEffect(() => {\n if (disabled) {\n clearTimeout(timer.current)\n setOpen(false)\n }\n }, [disabled])\n\n const show = (): void => {\n const anchor = anchorRef.current\n if (anchor !== null) {\n const room = anchor.getBoundingClientRect().top - scroller(anchor).getBoundingClientRect().top\n setSide(room >= BUBBLE_ROOM_PX ? 'above' : 'below')\n }\n setOpen(true)\n }\n const schedule = (): void => {\n clearTimeout(timer.current)\n if (disabled) return\n if (hovered.current || focused.current || dragging.current) {\n if (!open) timer.current = setTimeout(show, focused.current ? 0 : OPEN_DELAY_MS)\n return\n }\n timer.current = setTimeout(() => { setOpen(false) }, CLOSE_DELAY_MS)\n }\n\n const commit = (value: number): void => {\n dragging.current = false\n setLive(null)\n props.onCommit(value)\n schedule()\n }\n const onChange = (event: ChangeEvent<HTMLInputElement>): void => {\n const value = Number(event.target.value)\n setLive(value)\n props.onInput(value)\n }\n const onKeyUp = (event: KeyboardEvent<HTMLInputElement>): void => {\n if (live !== null) commit(live)\n if (event.key === 'Escape') {\n clearTimeout(timer.current)\n setOpen(false)\n }\n }\n const shown = live ?? Math.min(max, Math.max(min, props.value))\n\n return (\n <div\n ref={anchorRef}\n className={css.rangeAnchor}\n onPointerEnter={() => { hovered.current = true; schedule() }}\n onPointerLeave={() => { hovered.current = false; schedule() }}\n onFocus={() => { focused.current = true; schedule() }}\n onBlur={(event) => {\n if (event.currentTarget.contains(event.relatedTarget as Node | null)) return\n focused.current = false\n if (live !== null) commit(live)\n else schedule()\n }}\n >\n {props.children}\n <div className={css.rangeBubble} data-open={open ? '' : undefined} data-side={side}>\n <input\n type=\"range\"\n className={css.rangeSlider}\n min={min}\n max={max}\n step={step}\n value={shown}\n aria-label={props.label}\n tabIndex={open ? 0 : -1}\n disabled={disabled}\n style={{ '--range-fill': `${((shown - min) / (max - min)) * 100}%` } as CSSProperties}\n onPointerDown={() => { dragging.current = true }}\n onPointerUp={(event) => { commit(Number(event.currentTarget.value)) }}\n onPointerCancel={(event) => { commit(Number(event.currentTarget.value)) }}\n onChange={onChange}\n onKeyUp={onKeyUp}\n />\n <span className={css.rangeEnds} aria-hidden=\"true\">\n <span>{min}</span>\n <span>{max}</span>\n </span>\n </div>\n </div>\n )\n}\n","// Generated by scripts/sync-shared.mjs from shared/client/settings/SegmentGroup.tsx. Do not edit this copy; edit the shared source and run \"node scripts/sync-shared.mjs\".\n/**\n * The family's segmented control: a quiet track whose options share one\n * highlight that slides to the pressed option, instead of each option fading\n * its own background out and the next one in. The settings fields' small\n * choices and the Web Extensions TAB strip both render through it, so the two\n * read as one control.\n *\n * The caller builds the option buttons and marks the pressed one with\n * `data-active`; the group measures that button after every render and writes\n * its box as four custom properties, and the stylesheet draws the highlight\n * there (`.segmentGroup[data-pill]::before`). Attribute and first placement\n * land in the same task, so the highlight appears in place and only later\n * changes slide. A ResizeObserver re-measures when the group or an option\n * changes size: a longer locale, a font arriving, a container growing, a\n * strip wrapping onto a second line.\n */\n\nimport { Children, useLayoutEffect, useRef, type HTMLAttributes, type ReactNode } from 'react'\nimport css from './settings-card.module.css'\n\n/** The attribute marking a group whose highlight has been placed. */\nconst PILL_ATTR = 'data-pill'\n/** The pressed option, relative to the group. */\nconst ACTIVE_SELECTOR = ':scope > [data-active]'\nconst PILL_PROPERTIES = ['--segment-pill-x', '--segment-pill-y', '--segment-pill-w', '--segment-pill-h'] as const\n\n/** Props of {@link SegmentGroup}: the track's own attributes and the option buttons. */\nexport interface SegmentGroupProps extends HTMLAttributes<HTMLDivElement> {\n /** The option buttons; the pressed one carries `data-active`. */\n children: ReactNode\n}\n\n/**\n * Write the highlight's box from the pressed option's box, or take the\n * highlight off when nothing is pressed or the group has no layout yet.\n * The two boxes are read in viewport pixels and turned back into the group's\n * own CSS pixels, so a dialog that opens through a scale transform still\n * lands the highlight on its option.\n */\nfunction placePill(group: HTMLElement): void {\n const item = group.querySelector<HTMLElement>(ACTIVE_SELECTOR)\n const box = group.getBoundingClientRect()\n if (item === null || group.offsetWidth === 0 || box.width === 0) {\n group.removeAttribute(PILL_ATTR)\n for (const property of PILL_PROPERTIES) group.style.removeProperty(property)\n return\n }\n const scale = box.width / group.offsetWidth\n const itemBox = item.getBoundingClientRect()\n const values = [\n (itemBox.left - box.left) / scale - group.clientLeft,\n (itemBox.top - box.top) / scale - group.clientTop,\n itemBox.width / scale,\n itemBox.height / scale,\n ]\n values.forEach((value, index) => {\n group.style.setProperty(PILL_PROPERTIES[index], `${Math.round(value * 100) / 100}px`)\n })\n if (!group.hasAttribute(PILL_ATTR)) group.setAttribute(PILL_ATTR, '')\n}\n\n/**\n * Render a segmented track around the caller's option buttons.\n * @param props - the track's attributes (role, accessible name, key handler) and its options.\n * @returns the track.\n */\nexport function SegmentGroup(props: SegmentGroupProps): ReactNode {\n const { children, className, ...rest } = props\n const group = useRef<HTMLDivElement | null>(null)\n const count = Children.count(children)\n\n // Placed before the frame is painted, after every render: a press moves the\n // pressed mark and the highlight follows it in the same frame.\n useLayoutEffect(() => {\n if (group.current !== null) placePill(group.current)\n })\n\n useLayoutEffect(() => {\n const element = group.current\n if (element === null || typeof ResizeObserver === 'undefined') return undefined\n const observer = new ResizeObserver(() => { placePill(element) })\n observer.observe(element)\n for (const item of Array.from(element.children)) observer.observe(item)\n return () => { observer.disconnect() }\n }, [count])\n\n return (\n <div {...rest} ref={group} className={className === undefined ? css.segmentGroup : `${css.segmentGroup} ${className}`}>\n {children}\n </div>\n )\n}\n","// Generated by scripts/sync-shared.mjs from shared/client/settings/PluginSettingsCard.tsx. Do not edit this copy; edit the shared source and run \"node scripts/sync-shared.mjs\".\n/**\n * Family-shared chrome for plugin settings cards: a disclosure header naming\n * the plugin and what its settings govern, the controls inside, and the line\n * that reports a refused write. A pick is written the moment it is made and a\n * typed value after a pause, so the card has no save button and nothing waits\n * on the reader. Renders nothing while the namespace is unavailable — a\n * deployment that does not compose the owning plugin should show no trace of\n * it. Inlined into each consumer's client bundle; mirrors the official\n * ui-plugin-config PluginCard in a self-contained slice.\n *\n * Every field inside the body is one settings row: the label and its hint on\n * the left, the control on the right, a hairline between two rows; a narrow\n * card stacks the control under the text (settings-card.module.css).\n */\n\nimport { createContext, useCallback, useContext, useEffect, useLayoutEffect, useRef, useState, type KeyboardEvent, type ReactNode } from 'react'\nimport type { CardShell } from './settings-form.ts'\nimport { RangeBubble } from './RangeBubble.tsx'\nimport { SegmentGroup } from './SegmentGroup.tsx'\nimport css from './settings-card.module.css'\n\n/** Copy keys the card chrome itself reads; every consumer locale carries this shared vocabulary. */\nexport const CARD_COPY_KEYS = [\n 'settings.collapse',\n 'settings.expand',\n 'settings.notExposed',\n 'settings.readOnly',\n 'settings.saveFailed',\n] as const\n\n/**\n * What a text field inside a card reaches without its plugin wiring it: write\n * the pending draft now (Enter, leaving the field) or put it back (Escape).\n * Picks need neither; they are written the moment they are made.\n */\nconst CardApply = createContext<{ commit(): void, revert(): void } | null>(null)\n\n/** Copy key the card chrome itself reads. */\nexport type CardCopyKey = (typeof CARD_COPY_KEYS)[number]\n\n/** Key domain for the plugin's own copy (inferred per consumer). */\nexport type SettingsCardKey<TKey extends string = string> = TKey | CardCopyKey\n\n/** Card chrome shared by every plugin settings card. */\nexport interface PluginSettingsCardProps<TKey extends string = string> {\n /** Locale reader for this card's copy. */\n t: (key: SettingsCardKey<TKey>, params?: Record<string, string | number>) => string\n /** Locale key of the plugin's name. */\n titleKey: TKey\n /** Locale key of the line describing what this plugin's settings govern. */\n descriptionKey: TKey\n /** Optional rich header description rendered instead of the plain t(descriptionKey) text (the plain text stays as the tooltip). */\n descriptionNode?: ReactNode\n /**\n * Locale key of the full sentence behind a shortened description: when\n * present, the header's native `title` takes this text while the visible\n * line keeps `descriptionKey`/`descriptionNode`, so a compact card can\n * compress the sentence without keeping a second visible copy of it.\n * Defaults to the description key.\n */\n descriptionTitleKey?: TKey\n /**\n * Optional leading mark identifying the plugin. A card without one keeps the\n * plain official header shape, so the chrome stays a readable sibling of the\n * built-in PluginCard wherever a family plugin lands in the official bundle\n * seat.\n */\n icon?: ReactNode\n /** The card's form state: availability, writability, and how the last write went. */\n state: CardShell\n /** Write every pending draft now: a text field's Enter or blur. */\n onSave: () => void\n /** Drop every pending draft: a text field's Escape. */\n onDiscard: () => void\n /**\n * Id applied to the card's title element, so a header control (an immediate\n * toggle in `headerAction`) can name itself through `aria-labelledby`\n * instead of repeating the title as a string.\n */\n titleId?: string\n /**\n * Render the header only, with no body region. A card whose whole setting is\n * the header control (a switch whose explanation is the description) has no\n * controls to lay out below it, and an empty body would draw a divider line\n * with nothing under it.\n */\n headerOnly?: boolean\n /**\n * Render the controls expanded on arrival (still collapsible). Defaults to\n * true: promoted first-level sections show their settings immediately.\n */\n defaultOpen?: boolean\n /**\n * Render without the collapse affordance: a static header and an always\n * visible body. Used by first-level settings sections whose nav entry\n * already provides the selection.\n */\n alwaysOpen?: boolean\n /**\n * Hide the line under the body that reports a refused write: a card whose\n * body applies its own changes (an embedded external settings section)\n * reports its own failures.\n */\n hideFooter?: boolean\n /**\n * Optional control rendered at the header's trailing edge, before the\n * chevron. A card whose setting is one immediate flip (it\n * applies outside the card's form) puts its ToggleSwitch here, so the control\n * is reachable without opening the card and matches a plugin card's shape.\n */\n headerAction?: ReactNode\n /**\n * Render children even when the settings namespace is not exposed by the\n * host. The 'not exposed' notice still explains the card above them; a card\n * that wants the rows alone hides it through `hideNotExposedNotice`.\n */\n renderChildrenWhenNotExposed?: boolean\n /** Hide the 'not exposed' notice, whichever branch renders the card body. */\n hideNotExposedNotice?: boolean\n /**\n * Compact chrome for a topic card rendered inside another card's body: a\n * smaller title, a tighter header and body inset, and a one-line description\n * whose full text stays on the header's own title. Defaults to the\n * first-level chrome, which is unchanged.\n */\n density?: 'nested'\n /** The plugin's controls. */\n children: ReactNode\n}\n\n/** Length of the body's disclosure motion; it matches `--settings-card-motion` on the card root. */\nconst BODY_MOTION_MS = 180\n\n/**\n * Lifecycle of one card body. `collapsed` is the mounted-but-closed frame the\n * enter leg starts from, `entering` and `closing` are the two moving legs, and\n * `shown` is the settled open body, which releases its clipping box.\n */\ntype BodyPhase = 'hidden' | 'collapsed' | 'entering' | 'shown' | 'closing'\n\n/**\n * Render one plugin settings card.\n * @param props - the plugin's copy keys, its form state, and its controls.\n * @returns the card, or nothing while the namespace is still loading.\n */\nexport function PluginSettingsCard<TKey extends string = string>(props: PluginSettingsCardProps<TKey>) {\n const [open, setOpen] = useState(props.defaultOpen ?? true)\n const { state, alwaysOpen } = props\n const expanded = alwaysOpen === true || open\n const [bodyPhase, setBodyPhase] = useState<BodyPhase>(expanded ? 'shown' : 'hidden')\n const bodyRef = useRef<HTMLDivElement | null>(null)\n // Enter and leave run the same pair: a body that should open is mounted\n // closed for one frame so its transition has a state to leave, and a closing\n // one stays mounted until its leg has run.\n useLayoutEffect(() => {\n if (expanded) {\n if (bodyPhase === 'hidden') setBodyPhase('collapsed')\n else if (bodyPhase === 'collapsed') {\n const node = bodyRef.current\n if (node !== null) void node.offsetHeight\n setBodyPhase('entering')\n } else if (bodyPhase === 'closing') setBodyPhase('entering')\n return\n }\n if (bodyPhase === 'collapsed') setBodyPhase('hidden')\n else if (bodyPhase === 'entering' || bodyPhase === 'shown') setBodyPhase('closing')\n }, [expanded, bodyPhase])\n useEffect(() => {\n if (bodyPhase !== 'entering' && bodyPhase !== 'closing') return\n const timer = setTimeout(() => {\n setBodyPhase(bodyPhase === 'entering' ? 'shown' : 'hidden')\n }, BODY_MOTION_MS)\n return () => { clearTimeout(timer) }\n }, [bodyPhase])\n if (!state.available) return null\n const title = props.t(props.titleKey)\n const description = props.t(props.descriptionKey)\n const descriptionTitle = props.descriptionTitleKey === undefined ? description : props.t(props.descriptionTitleKey)\n const baseClass = expanded ? `${css.cardOpen} ${css.card}` : css.card\n const cardClass = props.density === 'nested' ? `${baseClass} ${css.cardNested}` : baseClass\n /** The body region both legs share; a hidden phase renders nothing at all. */\n const bodyRegion = (content: ReactNode) => bodyPhase === 'hidden'\n ? null\n : (\n <div className={css.disclosure} data-state={bodyPhase} ref={bodyRef}>\n <div className={css.body}>{content}</div>\n </div>\n )\n // With alwaysOpen the nav entry already provides the selection, so the\n // header is a static title row instead of a disclosure button.\n const header = alwaysOpen === true\n ? (\n <div className={css.headerStatic}>\n {props.icon !== undefined ? <span className={css.mark} aria-hidden=\"true\">{props.icon}</span> : null}\n <span className={css.headText}>\n <span className={css.name} id={props.titleId} title={title}>{title}</span>\n <span className={css.description} title={descriptionTitle}>{props.descriptionNode ?? description}</span>\n </span>\n {props.headerAction !== undefined ? <span className={css.headerAction}>{props.headerAction}</span> : null}\n </div>\n )\n : (\n <button\n type=\"button\"\n className={css.header}\n aria-expanded={open}\n aria-label={`${props.t(open ? 'settings.collapse' : 'settings.expand')}: ${title}`}\n onClick={() => { setOpen(!open) }}\n >\n {props.icon !== undefined ? <span className={css.mark} aria-hidden=\"true\">{props.icon}</span> : null}\n <span className={css.headText}>\n <span className={css.name} id={props.titleId} title={title}>{title}</span>\n <span className={css.description} title={descriptionTitle}>{props.descriptionNode ?? description}</span>\n </span>\n {props.headerAction !== undefined ? <span className={css.headerAction}>{props.headerAction}</span> : null}\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 14 14\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className={open ? `${css.chevron} ${css.chevronOpen}` : css.chevron}\n >\n <path\n d=\"M11.8486 5.5L11.4238 5.92383L8.69727 8.65137C8.44157 8.90706 8.21562 9.13382 8.01172 9.29785C7.79912 9.46883 7.55595 9.61756 7.25 9.66602C7.08435 9.69222 6.91565 9.69222 6.75 9.66602C6.44405 9.61756 6.20088 9.46883 5.98828 9.29785C5.78438 9.13382 5.55843 8.90706 5.30273 8.65137L2.57617 5.92383L2.15137 5.5L3 4.65137L3.42383 5.07617L6.15137 7.80273C6.42595 8.07732 6.59876 8.24849 6.74023 8.3623C6.87291 8.46904 6.92272 8.47813 6.9375 8.48047C6.97895 8.48703 7.02105 8.48703 7.0625 8.48047C7.07728 8.47813 7.12709 8.46904 7.25977 8.3623C7.40124 8.24849 7.57405 8.07732 7.84863 7.80273L10.5762 5.07617L11 4.65137L11.8486 5.5Z\"\n fill=\"currentColor\"\n />\n </svg>\n </button>\n )\n // The namespace exists but the Host does not serve it to this client (the\n // official settings allowlist omits third-party namespaces): show a card\n // that explains the gap instead of vanishing, so a missing card never\n // reads as a missing plugin. A card that keeps its rows anyway keeps the\n // same explanation above them, unless it hides the notice outright.\n const notExposedNotice = state.exposed || props.hideNotExposedNotice === true\n ? null\n : <p className={css.notExposed} role=\"status\">{props.t('settings.notExposed')}</p>\n if (!state.exposed && props.renderChildrenWhenNotExposed !== true) {\n return (\n <li className={cardClass}>\n {header}\n {bodyRegion(notExposedNotice)}\n </li>\n )\n }\n // A header-only card has no body region at all: the divider would otherwise\n // sit above an empty box.\n const bodyVisible = props.headerOnly !== true\n return (\n <li className={cardClass}>\n {header}\n {bodyVisible\n ? bodyRegion(\n <>\n {notExposedNotice}\n {!state.writable ? <p className={css.readOnly} role=\"status\">{props.t('settings.readOnly')}</p> : null}\n <CardApply.Provider value={{ commit: props.onSave, revert: props.onDiscard }}>\n {props.children}\n </CardApply.Provider>\n {props.hideFooter !== true && state.failed\n ? (\n <p className={css.failed} role=\"status\">\n {props.t('settings.saveFailed')}{state.failedReason ? ' - ' + state.failedReason : ''}\n </p>\n )\n : null}\n </>,\n )\n : null}\n </li>\n )\n}\n\n/** Props every field control needs regardless of its value type. */\nexport interface FieldProps {\n /** Stable id associating the label with its control. */\n id: string\n /** Visible label. */\n label: string\n /** One-line explanation rendered under the control. */\n hint: string\n /**\n * Full sentence behind the visible hint, exposed as the paragraph's native\n * `title` so a card can shorten the line without losing the text. Omitted:\n * the paragraph carries no title attribute at all.\n */\n hintTitle?: string\n /** Draft text this control renders. */\n text: string\n /** True when the field holds a user-layer entry over the inherited value. */\n overridden: boolean\n /** True when the draft is not a value this field accepts. */\n invalid: boolean\n /** Copy for the overridden badge. */\n overriddenLabel: string\n /** Copy for the reset control. */\n resetLabel: string\n /** Copy shown in place of the hint while the draft is invalid. */\n invalidLabel: string\n /** Disables every control (read-only document, or an unavailable namespace). */\n disabled: boolean\n /** Take new draft text; the card writes it as the field's entry rule says. */\n onEdit: (text: string) => void\n /** Clear the field at once so it re-inherits the composition layer. */\n onReset: () => void\n}\n\n/**\n * A typed value field. Its draft is written after a pause in typing, at once on\n * Enter or when focus leaves, and Escape puts the stored value back. `numeric`\n * only hints the keypad: which drafts a field accepts is decided by its spec.\n * A field given a `range` also offers the coarse slider bubble: dragging fills\n * the draft live and releasing writes it.\n */\nexport function ValueField(props: FieldProps & {\n /** Hints a numeric keypad without narrowing what the control accepts. */\n numeric?: boolean\n /** Placeholder shown while the draft is empty. */\n placeholder?: string\n /** Bounds of a numeric field, for the coarse slider; the spec still judges every draft. */\n range?: { min: number, max: number, step: number }\n}) {\n const apply = useContext(CardApply)\n // Enter and Escape settle the draft themselves and then leave the field, so\n // the blur they cause is that same settlement reaching the field's edge, not\n // a second write. Without this an Escape reported a discard and then a save,\n // which reads to a consumer as a write still waiting to happen.\n const settledByKey = useRef(false)\n const onKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (apply === null || (event.key !== 'Enter' && event.key !== 'Escape')) return\n event.preventDefault()\n settledByKey.current = true\n if (event.key === 'Enter') apply.commit()\n else apply.revert()\n event.currentTarget.blur()\n }\n const input = (\n <input\n id={props.id}\n className={props.invalid ? css.inputInvalid : css.input}\n type=\"text\"\n {...props.numeric === true ? { inputMode: 'numeric' as const } : {}}\n {...props.invalid ? { 'aria-invalid': true } : {}}\n value={props.text}\n placeholder={props.placeholder ?? ''}\n disabled={props.disabled}\n onChange={(event) => { props.onEdit(event.target.value) }}\n onKeyDown={onKeyDown}\n onFocus={() => { settledByKey.current = false }}\n onBlur={() => {\n if (settledByKey.current) {\n settledByKey.current = false\n return\n }\n apply?.commit()\n }}\n />\n )\n const { range } = props\n const typed = Number(props.text)\n return (\n <div className={css.field}>\n <div className={css.head}>\n <label className={css.label} htmlFor={props.id}>{props.label}</label>\n {props.overridden\n ? (\n <span className={css.badges}>\n <span className={css.badge}>{props.overriddenLabel}</span>\n <button\n type=\"button\"\n className={css.reset}\n disabled={props.disabled}\n onClick={props.onReset}\n >\n {props.resetLabel}\n </button>\n </span>\n )\n : null}\n </div>\n {range === undefined\n ? input\n : (\n <RangeBubble\n min={range.min}\n max={range.max}\n step={range.step}\n value={props.text.trim() === '' || Number.isNaN(typed) ? range.min : typed}\n label={`${props.label} ${range.min}–${range.max}`}\n disabled={props.disabled}\n onInput={(value) => { props.onEdit(String(value)) }}\n onCommit={(value) => {\n props.onEdit(String(value))\n apply?.commit()\n }}\n >\n {input}\n </RangeBubble>\n )}\n <p className={props.invalid ? css.invalid : css.hint} title={props.hintTitle}>\n {props.invalid ? props.invalidLabel : props.hint}\n </p>\n </div>\n )\n}\n\nconst NON_SKIN_BODY_MARKERS = new Set(['dshSkinCenter', 'dshSidebarCollapsed'])\n// 检测使用使用皮肤,用了皮肤退回原生select样式,防止样式冲突。默认外观下使用优化后的select样式。\nfunction isSkinActive(): boolean {\n const datasetList = Object.keys(document.body.dataset)\n const isActive = datasetList.some(key => key.startsWith('dsh') && !NON_SKIN_BODY_MARKERS.has(key))\n return isActive\n}\n\ninterface SelectOption {\n value: string\n label: string\n}\n\nconst SELECT_CLOSE_MS = 100\n\n/**\n * The shared dual-mode select control. While an appearance skin is active it\n * renders the legacy native `<select>` untouched, so element-level skin\n * selectors keep working; under the default appearance it renders a\n * self-drawn `role=\"listbox\"` popup whose open/close is transition-animated.\n * Cards reach it through BooleanField/ChoiceField; editors outside a card\n * (the side-card prefs) bind it directly through onEdit.\n * 双模式下拉框:皮肤激活时用原生 select,默认外观用自绘动画弹层。\n */\nexport function SelectField(props: {\n id: string\n options: ReadonlyArray<SelectOption>\n value: string\n disabled: boolean\n invalid: boolean\n onEdit: (text: string) => void\n}) {\n const { id, options, value } = props\n const [open, setOpen] = useState(false)\n const [closing, setClosing] = useState(false)\n const [phase, setPhase] = useState<'initial' | 'open'>('initial')\n const [activeIndex, setActiveIndex] = useState(0)\n const closeTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined)\n const wrapRef = useRef<HTMLDivElement | null>(null)\n const popupRef = useRef<HTMLDivElement | null>(null)\n\n const currentIndex = () => {\n const index = options.findIndex(option => option.value === value)\n return index >= 0 ? index : 0\n }\n\n const close = useCallback(() => {\n if (closeTimer.current !== undefined) clearTimeout(closeTimer.current)\n setClosing(true)\n closeTimer.current = setTimeout(() => {\n setClosing(false)\n setOpen(false)\n }, SELECT_CLOSE_MS)\n }, [])\n\n const openPopup = () => {\n if (closeTimer.current !== undefined) clearTimeout(closeTimer.current)\n setActiveIndex(currentIndex())\n setPhase('initial')\n setClosing(false)\n setOpen(true)\n }\n\n const commit = (index: number) => {\n const option = options[index]\n if (option) props.onEdit(option.value)\n close()\n }\n\n const onTriggerClick = () => {\n if (props.disabled) return\n if (open && !closing) close()\n else openPopup()\n }\n\n const onKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n if (props.disabled) return\n const count = options.length\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowUp':\n case 'Enter':\n case ' ':\n event.preventDefault()\n if (!open) {\n openPopup()\n } else if (!closing) {\n if (event.key === 'ArrowDown') setActiveIndex(index => (index + 1) % count)\n else if (event.key === 'ArrowUp') setActiveIndex(index => (index - 1 + count) % count)\n else commit(activeIndex)\n }\n break\n case 'Escape':\n if (open) {\n event.preventDefault()\n event.stopPropagation()\n close()\n }\n break\n case 'Tab':\n if (open) close()\n break\n }\n }\n\n useEffect(() => () => {\n if (closeTimer.current !== undefined) clearTimeout(closeTimer.current)\n }, [])\n useLayoutEffect(() => {\n if (open && !closing && phase === 'initial') {\n void popupRef.current?.offsetHeight\n setPhase('open')\n }\n }, [open, closing, phase])\n\n useEffect(() => {\n if (!open) return\n const onPointerDown = (event: PointerEvent) => {\n const target = event.target\n if (target instanceof Node && !wrapRef.current?.contains(target)) close()\n }\n document.addEventListener('pointerdown', onPointerDown)\n return () => document.removeEventListener('pointerdown', onPointerDown)\n }, [open, close])\n\n useEffect(() => {\n if (props.disabled && open) close()\n }, [props.disabled, open, close])\n\n // 使用了皮肤则退回原生select样式防止样式冲突。\n if (isSkinActive()) {\n return (\n <select\n id={id}\n className={css.select}\n value={value}\n disabled={props.disabled}\n onChange={(event) => { props.onEdit(event.target.value) }}\n >\n {options.map(option => (\n <option key={option.value} value={option.value}>{option.label}</option>\n ))}\n </select>\n )\n }\n\n const label = options.find(option => option.value === value)?.label ?? ''\n const popupClass = closing\n ? `${css.selectPopup} ${css.selectPopupClose}`\n : phase === 'open'\n ? `${css.selectPopup} ${css.selectPopupOpen}`\n : css.selectPopup\n return (\n <div className={css.selectWrap} ref={wrapRef}>\n <button\n type=\"button\"\n id={id}\n className={`${css.select} ${css.selectButton}`}\n disabled={props.disabled}\n aria-haspopup=\"listbox\"\n aria-expanded={open}\n aria-activedescendant={open ? `${id}-o${activeIndex}` : undefined}\n aria-invalid={props.invalid || undefined}\n onClick={onTriggerClick}\n onKeyDown={onKeyDown}\n >\n <span className={css.selectLabel}>{label}</span>\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 14 14\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className={open ? `${css.selectChevron} ${css.selectChevronOpen}` : css.selectChevron}\n aria-hidden=\"true\"\n >\n <path\n d=\"M11.8486 5.5L11.4238 5.92383L8.69727 8.65137C8.44157 8.90706 8.21562 9.13382 8.01172 9.29785C7.79912 9.46883 7.55595 9.61756 7.25 9.66602C7.08435 9.69222 6.91565 9.69222 6.75 9.66602C6.44405 9.61756 6.20088 9.46883 5.98828 9.29785C5.78438 9.13382 5.55843 8.90706 5.30273 8.65137L2.57617 5.92383L2.15137 5.5L3 4.65137L3.42383 5.07617L6.15137 7.80273C6.42595 8.07732 6.59876 8.24849 6.74023 8.3623C6.87291 8.46904 6.92272 8.47813 6.9375 8.48047C6.97895 8.48703 7.02105 8.48703 7.0625 8.48047C7.07728 8.47813 7.12709 8.46904 7.25977 8.3623C7.40124 8.24849 7.57405 8.07732 7.84863 7.80273L10.5762 5.07617L11 4.65137L11.8486 5.5Z\"\n fill=\"currentColor\"\n />\n </svg>\n </button>\n {open\n ? (\n <div className={popupClass} role=\"listbox\" ref={popupRef}>\n {options.map((option, index) => (\n <div\n key={option.value}\n id={`${id}-o${index}`}\n role=\"option\"\n aria-selected={option.value === value}\n className={`${css.selectOption}${option.value === value ? ` ${css.selectOptionSelected}` : ''}${index === activeIndex && !closing ? ` ${css.selectOptionActive}` : ''}`}\n onClick={() => { commit(index) }}\n >\n {option.label}\n </div>\n ))}\n </div>\n )\n : null}\n </div>\n )\n}\n\n/**\n * A visible segmented group for a small set of mutually exclusive values.\n * Every option stays on screen, so inherit/on/off and short enum fields take\n * one click without opening a popup. The pressed option carries the group's\n * sliding highlight and `aria-pressed`; the group takes the field label as its\n * accessible name.\n */\nexport function SegmentField(props: {\n id: string\n label: string\n options: ReadonlyArray<SelectOption>\n value: string\n disabled: boolean\n invalid: boolean\n onEdit: (text: string) => void\n}) {\n return (\n <SegmentGroup\n id={props.id}\n role=\"group\"\n aria-label={props.label}\n aria-invalid={props.invalid || undefined}\n >\n {props.options.map((option, index) => {\n const active = option.value === props.value\n return (\n <button\n key={option.value}\n type=\"button\"\n className={css.segment}\n aria-pressed={active}\n disabled={props.disabled}\n data-active={active ? '' : undefined}\n data-segment-index={index}\n onClick={() => {\n if (!active) props.onEdit(option.value)\n }}\n >\n {option.label}\n </button>\n )\n })}\n </SegmentGroup>\n )\n}\n\n/** How a small single-choice field presents its options. */\nexport type FieldPresentation = 'select' | 'segment'\n\n/** A boolean field: 继承 / 开 / 关. */\nexport function BooleanField(props: FieldProps & {\n /** Copy for the inherit option. */\n inheritLabel: string\n /** Copy for the on option. */\n onLabel: string\n /** Copy for the off option. */\n offLabel: string\n /** Defaults to the visible segments: the three answers always fit on one row. */\n presentation?: FieldPresentation\n}) {\n const segmented = props.presentation !== 'select'\n return (\n <div className={css.field}>\n <div className={css.head}>\n {segmented\n ? <span className={css.label}>{props.label}</span>\n : <label className={css.label} htmlFor={props.id}>{props.label}</label>}\n {props.overridden\n ? (\n <span className={css.badges}>\n <span className={css.badge}>{props.overriddenLabel}</span>\n <button\n type=\"button\"\n className={css.reset}\n disabled={props.disabled}\n onClick={props.onReset}\n >\n {props.resetLabel}\n </button>\n </span>\n )\n : null}\n </div>\n {segmented\n ? (\n <SegmentField\n id={props.id}\n label={props.label}\n options={[\n { value: '', label: props.inheritLabel },\n { value: 'true', label: props.onLabel },\n { value: 'false', label: props.offLabel },\n ]}\n value={props.text}\n disabled={props.disabled}\n invalid={props.invalid}\n onEdit={props.onEdit}\n />\n )\n : (\n <SelectField\n id={props.id}\n options={[\n { value: '', label: props.inheritLabel },\n { value: 'true', label: props.onLabel },\n { value: 'false', label: props.offLabel },\n ]}\n value={props.text}\n disabled={props.disabled}\n invalid={props.invalid}\n onEdit={props.onEdit}\n />\n )}\n <p className={css.hint} title={props.hintTitle}>{props.hint}</p>\n </div>\n )\n}\n\n/** An enumerated field, selecting or segmenting its small choice set. */\nexport function ChoiceField(props: FieldProps & {\n /** Copy for the inherit option (draft text is the empty string). */\n inheritLabel: string\n /** Choices rendered in order; `value` is the draft/stored text. */\n choices: ReadonlyArray<{ value: string; label: string }>\n /**\n * Visible segmented options for a short fixed set; defaults to the compact\n * select, which also suits a list whose length follows the deployment.\n */\n presentation?: FieldPresentation\n}) {\n const segmented = props.presentation === 'segment'\n const options = [{ value: '', label: props.inheritLabel }, ...props.choices]\n return (\n <div className={css.field}>\n <div className={css.head}>\n {segmented\n ? <span className={css.label}>{props.label}</span>\n : <label className={css.label} htmlFor={props.id}>{props.label}</label>}\n {props.overridden\n ? (\n <span className={css.badges}>\n <span className={css.badge}>{props.overriddenLabel}</span>\n <button\n type=\"button\"\n className={css.reset}\n disabled={props.disabled}\n onClick={props.onReset}\n >\n {props.resetLabel}\n </button>\n </span>\n )\n : null}\n </div>\n {segmented\n ? (\n <SegmentField\n id={props.id}\n label={props.label}\n options={options}\n value={props.text}\n disabled={props.disabled}\n invalid={props.invalid}\n onEdit={props.onEdit}\n />\n )\n : (\n <SelectField\n id={props.id}\n options={options}\n value={props.text}\n disabled={props.disabled}\n invalid={props.invalid}\n onEdit={props.onEdit}\n />\n )}\n <p className={props.invalid ? css.invalid : css.hint} title={props.hintTitle}>\n {props.invalid ? props.invalidLabel : props.hint}\n </p>\n </div>\n )\n}\n\n/**\n * A boolean toggle drawn as a switch track, for a setting that is only on or\n * off and applies on flip. It is a real button with\n * `role=\"switch\"` and `aria-checked`, so keyboard and assistive activation\n * arrive as a click and the state is announced instead of inferred from a\n * checkbox tick.\n *\n * The thumb bounces across only once the reader has pressed this switch: the\n * press writes the mark that arms the bounce, so a page opening, a TAB\n * switching back or a value arriving from elsewhere draws every thumb at rest.\n */\nexport function ToggleSwitch(props: {\n /** Id of the element naming the switch (the card's title). */\n labelledBy?: string\n /** Accessible name when no element labels it. */\n ariaLabel?: string\n /** Current state. */\n checked: boolean\n /** Disables the switch while a write is in flight or the Host refuses writes. */\n disabled?: boolean\n /** Called with the requested next state. */\n onChange: (next: boolean) => void\n}) {\n const [moved, setMoved] = useState(false)\n return (\n <button\n type=\"button\"\n className={css.toggle}\n role=\"switch\"\n aria-checked={props.checked}\n aria-labelledby={props.labelledBy}\n aria-label={props.labelledBy === undefined ? props.ariaLabel : undefined}\n disabled={props.disabled}\n data-moved={moved ? '' : undefined}\n onClick={() => {\n setMoved(true)\n props.onChange(!props.checked)\n }}\n >\n <span className={css.toggleTrack}><span className={css.toggleThumb} /></span>\n </button>\n )\n}\n","// Generated by scripts/sync-shared.mjs from shared/client/settings/settings-form.ts. Do not edit this copy; edit the shared source and run \"node scripts/sync-shared.mjs\".\n/**\n * Form model behind the plugin settings card. Every control applies itself:\n * a pick (a segment, a select option, a reset) writes the moment it is made,\n * and typed text writes once typing pauses or the reader leaves the field.\n * Between the edit and the write the edit is held here as a draft, so what is\n * on screen is exactly what the write will store; a write the Host refuses\n * puts a pick back to the stored value and keeps typed text for correcting.\n * Family-shared slice inlined into each plugin's client bundle.\n */\n\nimport type { ConfigForm, ConfigFormSnapshot } from '@deepseek-ai/dsh-client-ui-settings/client'\nimport type { SnapshotStore } from '@deepseek-ai/dsh-client-store'\nimport { createSnapshotStore } from '@deepseek-ai/dsh-client-store'\n\n/** The write one field's draft text performs when it is applied. */\nexport type FieldWrite =\n | { kind: 'set'; value: unknown }\n | { kind: 'clear' }\n\n/** How one field converts between its stored value and its draft text. */\nexport interface FieldSpec {\n /** Field name inside the namespace section. */\n field: string\n /**\n * How the reader enters a value, which decides when it is written: a `pick`\n * is a whole value at once and applies immediately; `type` is text arriving\n * a keystroke at a time and applies once typing pauses or the field is left.\n */\n entry: 'pick' | 'type'\n /**\n * Whether the Host treats this field as a secret and redacts its value from\n * the read-back (role('secret') in the section schema). Redacted secrets are\n * never compared against the draft on save: the Host strips them from every\n * wire view layer, so the settled snapshot carries nothing to read back. A\n * staged secret set is judged by the mutation settling; the rest of its\n * batch, when one exists, is still judged by read-back, and the atomic\n * mutation lands every write or none.\n */\n secret?: boolean\n /** Render a stored value as draft text; the empty string when the section carries none. */\n format: (value: unknown) => string\n /**\n * The write this draft text performs, or undefined when the text is not a\n * value this field accepts — which holds the draft unwritten rather than\n * discarding it.\n */\n parse: (text: string) => FieldWrite | undefined\n}\n\n/** One field as the card renders it. */\nexport interface FieldState {\n /** Draft text the control renders. */\n text: string\n /** Whether the field leaves (or will leave) a user-layer entry. */\n overridden: boolean\n /** Whether the draft is not a value this field accepts, which holds it unwritten. */\n invalid: boolean\n}\n\n/** Form state every plugin settings card shares. */\nexport interface CardShell {\n /** False while the namespace is still loading; the card renders nothing. */\n available: boolean\n /**\n * Whether the namespace is actually served to this client. False when the\n * Host deployment does not expose it (e.g. the owning plugin's settings\n * domain is not mounted): the card renders an explanation\n * instead of its form, so a missing namespace never looks like a missing\n * plugin.\n */\n exposed: boolean\n /** Whether the Host document accepts writes. */\n writable: boolean\n /** Whether the form holds drafts not yet written (typed text waiting for its pause). */\n dirty: boolean\n /** Whether any draft is invalid, which holds it unwritten. */\n invalid: boolean\n /** Whether a write is crossing the wire. */\n saving: boolean\n /** Whether the last write did not land; cleared by the next edit or write. */\n failed: boolean\n /**\n * The rejection code/message the Host returned for the last failed save,\n * surfaced next to the generic failure text. Undefined while no save has\n * failed (or the failure carried no server reason).\n */\n failedReason?: string\n}\n\n/** The write actions the card's slot entry injects. */\nexport interface CardActions {\n /** Take draft text for one field; a pick writes at once, typed text after a pause. */\n edit: (field: string, text: string) => void\n /** Clear one field at once, so it re-inherits the composition layer. */\n resetField: (field: string) => void\n /** Write every pending draft now (a text field's Enter or blur), then re-seed from what the Host accepted. */\n save: () => void\n /** Drop every pending draft, putting each control back to the stored value (a text field's Escape). */\n discard: () => void\n}\n\n/** How long typed text rests before it is written. */\nexport const TYPE_PAUSE_MS = 600\n\n/** One field's staged edit. */\ninterface StagedEdit {\n /** Draft text the control renders. */\n text: string\n /** True when this edit clears the field whatever text it shows. */\n clear: boolean\n}\n\n/** One staged edit resolved into the write a save performs. */\ninterface PlannedWrite {\n /** Field this entry writes. */\n field: string\n /** The durable write this entry performs, inside the save's one atomic mutation. */\n op: BatchedWrite\n /**\n * Read the settled snapshot back and report whether the Host holds this\n * write's effect. Undefined when the draft is not a value the field\n * accepts: there is nothing to write, and the entry blocks the save.\n */\n judge: (() => boolean) | undefined\n}\n\n/** One durable write inside the save's atomic form mutation. */\nexport interface BatchedWrite {\n /** Field this entry writes. */\n field: string\n /** set stores a value; unset drops the leaf. */\n op: 'set' | 'unset'\n /** Value for op set (absent for unset). */\n value?: unknown\n}\n\n/** Constraints a numeric field's accepted drafts must satisfy, mirroring the host schema. */\nexport interface NumberConstraints {\n /** The accepted value must be a whole number. */\n integer?: boolean\n /** The accepted value must be at least this. */\n min?: number\n}\n\n/** A whole- or decimal-number field. An empty draft clears the field; any other draft that is not a finite number within the constraints stays unwritten. */\nexport function numberField(field: string, constraints: NumberConstraints = {}): FieldSpec {\n const { integer = false, min } = constraints\n return {\n field,\n entry: 'type',\n format: value => typeof value === 'number' ? String(value) : '',\n parse: (text) => {\n const trimmed = text.trim()\n if (trimmed === '') return { kind: 'clear' }\n const parsed = Number(trimmed)\n if (!Number.isFinite(parsed)) return undefined\n if (integer && !Number.isInteger(parsed)) return undefined\n if (min !== undefined && parsed < min) return undefined\n return { kind: 'set', value: parsed }\n },\n }\n}\n\n/**\n * A free-text field. An empty draft clears the field. `entry` is `pick` when\n * the text arrives whole from a picker (a preset or a reasoning level).\n */\nexport function textField(field: string, entry: FieldSpec['entry'] = 'type'): FieldSpec {\n return {\n field,\n entry,\n format: value => typeof value === 'string' ? value : '',\n parse: (text) => {\n const trimmed = text.trim()\n return trimmed === '' ? { kind: 'clear' } : { kind: 'set', value: trimmed }\n },\n }\n}\n\n/**\n * A free-text field the Host treats as a secret and redacts from the read-back\n * (role('secret') in the section schema). The card still edits it like text,\n * but a save never compares the redacted value back: the staged set is judged\n * by the mutation settling (see {@link FieldSpec.secret}).\n */\nexport function secretField(field: string): FieldSpec {\n return { ...textField(field), secret: true }\n}\n\n/** A boolean field, edited through true/false draft text. */\nexport function booleanField(field: string): FieldSpec {\n return {\n field,\n entry: 'pick',\n format: value => typeof value === 'boolean' ? String(value) : '',\n parse: (text) => {\n const trimmed = text.trim()\n if (trimmed === '') return { kind: 'clear' }\n if (trimmed === 'true') return { kind: 'set', value: true }\n if (trimmed === 'false') return { kind: 'set', value: false }\n return undefined\n },\n }\n}\n\n/** An enumerated string field; only the listed choices are accepted. An empty draft clears the field. */\nexport function choiceField(field: string, choices: readonly string[]): FieldSpec {\n return {\n field,\n entry: 'pick',\n format: value => typeof value === 'string' && choices.includes(value) ? value : '',\n parse: (text) => {\n if (text === '') return { kind: 'clear' }\n return choices.includes(text) ? { kind: 'set', value: text } : undefined\n },\n }\n}\n\n/**\n * Applies one card's edits to one settings namespace as the reader makes them.\n *\n * The Host is the only authority on whether a value was accepted — its\n * validators own the constraints no schema can express — so the outcome is\n * read back from the section rather than predicted here. A write that did not\n * land puts each pick back to the stored value, the way a switch that could not\n * flip springs back, and keeps typed text so the reader can correct it instead\n * of retyping.\n */\nexport class CardForm<T> {\n private readonly specs: Map<string, FieldSpec>\n private readonly staged = new Map<string, StagedEdit>()\n private readonly listeners = new Set<() => void>()\n /** The form subscription installed in the constructor; released by dispose(). */\n private readonly disposeForm: () => void\n private disposed = false\n /** The pending write of typed text, waiting for typing to pause. */\n private typePause: ReturnType<typeof setTimeout> | undefined\n private saving = false\n /** A save asked for while one was in flight; it runs once the first settles (#1754). */\n private saveQueued = false\n private failed = false\n private failedReason: string | undefined\n\n /** @param scope - the bound configuration form for this card's namespace. */\n constructor(\n private readonly scope: ConfigForm<T>,\n specs: FieldSpec[],\n ) {\n this.specs = new Map(specs.map(spec => [spec.field, spec]))\n this.disposeForm = scope.subscribe(() => { this.publish() })\n }\n\n /**\n * Release the form subscription and every bound store listener. The card\n * must call this on teardown; later calls are no-ops.\n */\n dispose(): void {\n if (this.disposed) return\n this.disposed = true\n clearTimeout(this.typePause)\n this.disposeForm()\n this.listeners.clear()\n }\n\n /** Publish a projection of this form, rebuilt whenever the form or a draft changes. */\n bind<S>(project: () => S): SnapshotStore<S> {\n const store = createSnapshotStore(project())\n this.listeners.add(() => { store.set(project()) })\n return store\n }\n\n /** Read the card-level state: what the Host serves, and what is still waiting to be written. */\n shell(): CardShell {\n const snapshot = this.scope.getSnapshot()\n const plan = this.plan()\n return {\n available: snapshot.status !== 'loading',\n exposed: snapshot.status === 'ready',\n writable: snapshot.writable,\n dirty: plan.length > 0,\n invalid: plan.some(item => item.judge === undefined),\n saving: this.saving,\n failed: this.failed,\n ...this.failedReason === undefined ? {} : { failedReason: this.failedReason },\n }\n }\n\n /** Read one field's state from the effective section and its staged draft. */\n field(field: string): FieldState {\n const spec = this.specOf(field)\n const staged = this.staged.get(field)\n if (staged === undefined) {\n return { text: spec.format(this.sectionValue(field)), overridden: this.stored(field), invalid: false }\n }\n const write = staged.clear ? { kind: 'clear' as const } : spec.parse(staged.text)\n return {\n text: staged.text,\n overridden: write?.kind === 'set',\n invalid: write === undefined,\n }\n }\n\n /** The actions the card's slot registration injects. */\n actions(): CardActions {\n return {\n edit: (field, text) => { this.stage(field, { text, clear: false }) },\n resetField: (field) => {\n this.stage(field, { text: this.specOf(field).format(this.baseValue(field)), clear: true })\n },\n save: () => { this.applyNow() },\n discard: () => {\n clearTimeout(this.typePause)\n if (this.staged.size === 0 && !this.failed) return\n this.staged.clear()\n this.failed = false\n this.failedReason = undefined\n this.publish()\n },\n }\n }\n\n /**\n * Run one write, and re-run it once if another was asked for while this one\n * was still in flight.\n *\n * A write is a Host round trip that also drives the profile reconcile, and\n * the Host runs it inside one exclusive transaction. Answering an edit that\n * arrives mid-flight by returning immediately dropped it with no explanation\n * (#1754). Serializing instead means an edit made while another write is\n * still settling is written against the settled state.\n * @returns settlement after the mutation and the read-back.\n */\n async requestSave(): Promise<void> {\n if (this.saving) {\n this.saveQueued = true\n return\n }\n await this.save()\n if (!this.saveQueued) return\n this.saveQueued = false\n await this.requestSave()\n }\n\n /**\n * Write every valid draft in one atomic form mutation, then re-seed from\n * what the Host accepted. A draft the field does not accept stays on screen,\n * unwritten, without holding the others back.\n *\n * The batch rides one mutate, so cross-field validate hooks (baseURL+model)\n * judge it as a unit: the Host either applies every write or refuses the\n * batch. The form contract answers a refusal or a skipped write with `false`\n * (it recovers with a fresh Host view instead of throwing), so the outcome is\n * judged twice: the answer itself, and then the settled snapshot read back\n * one planned write at a time. One missed write fails the whole batch. A\n * transport that rejects instead (the dsh-web bridge controller on a dead\n * connection) reports through the same failure path with its rejection\n * message. A batch that did not land puts its picks and clears back to the\n * stored value and keeps its typed text, so the reader can correct it.\n * @returns settlement after the mutation and the read-back.\n */\n async save(): Promise<void> {\n const plan = this.plan()\n const valid = plan.filter((item): item is PlannedWrite & { judge: () => boolean } => item.judge !== undefined)\n if (valid.length === 0 || this.saving) return\n // Snapshot the staged entries this write carries, so an edit staged while\n // it is in flight (which replaces the same key) survives: only settle the\n // key when the entry is still the one this write started from.\n const pending = new Map<string, StagedEdit | undefined>()\n for (const item of valid) pending.set(item.field, this.staged.get(item.field))\n this.saving = true\n this.failed = false\n this.failedReason = undefined\n this.publish()\n // One atomic namespace mutation: the form contract takes ordered path\n // operations, so the whole staged batch is validated, persisted, and\n // recovered together — either every write lands or none does.\n const ops: Array<{ op: 'set'; path: string[]; value: string | number | boolean } | { op: 'unset'; path: string[] }> = valid.map(item => item.op.op === 'set'\n ? { op: 'set', path: [item.field], value: (item.op as { value: string | number | boolean }).value }\n : { op: 'unset', path: [item.field] })\n let failedReason: string | undefined\n let accepted = false\n try {\n accepted = await this.scope.mutate(ops)\n } catch (error) {\n failedReason = error instanceof Error ? error.message : String(error)\n }\n // `false` is the contract's refusal/skip answer, and the form still\n // resolves after a refusal (it recovers with a fresh view), so the answer\n // alone is not enough: judge every planned write against the settled\n // snapshot as well. The mutation is atomic, so one missed write fails the\n // whole save and keeps the drafts.\n const landed = accepted && failedReason === undefined && valid.every(item => item.judge())\n for (const [field, before] of pending) {\n if (this.staged.get(field) !== before) continue\n if (landed || before === undefined || before.clear || this.specOf(field).entry === 'pick') this.staged.delete(field)\n }\n this.saving = false\n this.failed = !landed\n // A refused or unlanded batch carries no server reason: the card surfaces\n // its generic failure copy; a rejecting transport (the bridge) adds its\n // message.\n this.failedReason = failedReason\n this.publish()\n }\n\n /**\n * Every staged edit a write would carry. An entry whose draft is not a value\n * its field accepts carries no write: the form is still dirty, and the draft\n * stays on screen rather than being dropped. A staged edit that matches the\n * effective section is not a write at all.\n * @returns the planned writes, in the order the fields were staged.\n */\n private plan(): PlannedWrite[] {\n const plan: PlannedWrite[] = []\n for (const [field, staged] of this.staged) {\n const spec = this.specOf(field)\n if (staged.clear) {\n if (this.stored(field)) plan.push({ field, op: { field, op: 'unset' }, judge: () => this.landedUnset(field) })\n continue\n }\n if (staged.text === spec.format(this.sectionValue(field))) continue\n const write = spec.parse(staged.text)\n if (write === undefined) plan.push({ field, op: { field, op: 'unset' }, judge: undefined })\n else if (write.kind === 'clear') plan.push({ field, op: { field, op: 'unset' }, judge: () => this.landedUnset(field) })\n else plan.push({ field, op: { field, op: 'set', value: write.value }, judge: () => this.landedSet(field, write.value) })\n }\n return plan\n }\n\n /**\n * Read-back judgment for a planned set: the user layer must hold the\n * intended value once the mutation has settled.\n */\n private landedSet(field: string, value: unknown): boolean {\n // A redacted secret never appears in any wire view layer: the Host strips\n // role('secret') fields and reports them through a sidecar the form\n // snapshot does not expose, so there is nothing to compare the draft\n // against. Settling is the only signal the form has; the rest of the\n // batch, when one exists, still carries the atomic verdict by read-back.\n if (this.specOf(field).secret) return true\n return this.userLayer()?.[field] === value\n }\n\n /**\n * Read-back judgment for a planned unset: the field must be gone from the\n * user layer once the mutation has settled.\n */\n private landedUnset(field: string): boolean {\n return !this.stored(field)\n }\n\n /**\n * Take one edit and schedule its write: a pick or a clear is written now,\n * typed text once typing has rested for TYPE_PAUSE_MS.\n */\n private stage(field: string, edit: StagedEdit): void {\n this.staged.set(field, edit)\n this.failed = false\n this.failedReason = undefined\n this.publish()\n if (edit.clear || this.specOf(field).entry === 'pick') {\n this.applyNow()\n return\n }\n clearTimeout(this.typePause)\n this.typePause = setTimeout(() => { this.applyNow() }, TYPE_PAUSE_MS)\n }\n\n /** Write every pending draft now, taking the place of a waiting pause. */\n private applyNow(): void {\n clearTimeout(this.typePause)\n this.typePause = undefined\n if (this.disposed) return\n void this.requestSave()\n }\n\n private specOf(field: string): FieldSpec {\n const spec = this.specs.get(field)\n // Every call site names a field this card declared; a missing one is a\n // wiring mistake that must not degrade into a silently inert control.\n if (spec === undefined) throw new Error(`settings card has no field ${field}`)\n return spec\n }\n\n private snapshotOf(): ConfigFormSnapshot<T> {\n return this.scope.getSnapshot()\n }\n\n private sectionValue(field: string): unknown {\n return (this.snapshotOf().value as Record<string, unknown> | undefined)?.[field]\n }\n\n private baseValue(field: string): unknown {\n return (this.snapshotOf().base as Record<string, unknown> | undefined)?.[field]\n }\n\n private userLayer(): Record<string, unknown> | undefined {\n return this.snapshotOf().user as Record<string, unknown> | undefined\n }\n\n private stored(field: string): boolean {\n const user = this.userLayer()\n return user !== undefined && Object.hasOwn(user, field)\n }\n\n private publish(): void {\n for (const listener of this.listeners) listener()\n }\n}\n","/**\n * LiangShen settings card: availability, the wire presentation, and the\n * dispatcher identity. Registers into the `web-ui.plugin.item` child slot the\n * Web UI plugin group renders, bound to the `liangshen` settings namespace\n * (the Host profile entry id).\n *\n * No field acts on this client half: the Host applies the presentation and the\n * dispatcher switch to the preset it declares to the agent-preset registry, so\n * a session reads both from its preset. The card is the operator's only handle\n * on them, which is why every field the Host schema carries appears here.\n */\n\nimport type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { SnapshotStore } from '@deepseek-ai/dsh-client-store'\nimport type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client'\nimport { LiangShenMark } from './LiangShenMark.tsx'\nimport { BooleanField, ChoiceField, PluginSettingsCard, ValueField } from './PluginSettingsCard.tsx'\nimport { CardForm, booleanField, choiceField, textField, type CardActions, type CardShell, type FieldSpec, type FieldState as CardFieldState } from './settings-form.ts'\n\n/** A tool family entry: a prefix ending in exactly one trailing star. */\nconst FAMILY_ENTRY_RE = /^[^*]+\\*$/\n\n/**\n * The on-demand tool family list: comma separated entries, each a prefix with\n * one trailing star. Blank clears the field; any malformed entry holds the\n * draft unwritten.\n */\nexport function pagedToolPatternsField(field: string): FieldSpec {\n return {\n ...textField(field),\n parse: (text) => {\n const entries = text.split(',').map(entry => entry.trim()).filter(entry => entry !== '')\n if (entries.length === 0) return { kind: 'clear' }\n if (!entries.every(entry => FAMILY_ENTRY_RE.test(entry))) return undefined\n return { kind: 'set', value: entries.join(', ') }\n },\n }\n}\n\n/** Wire presentations the tool catalog accepts (mirrors the Host schema). */\nexport const PRESENTATION_CHOICES = ['ptc', 'native'] as const\n\n/** The LiangShen fields this card edits (the namespace's full schema). */\nexport interface LiangShenSettings {\n /** Master switch for the plugin. */\n enabled?: boolean\n /** Whether the plugin announces itself in every agent's system prompt. */\n announceToAgent?: boolean\n /** Wire presentation the Host applies to the preset's tool-catalog row. */\n presentation?: string\n /** Whether the preset appends the dispatcher rules section after the persona. */\n dispatcher?: boolean\n /** Comma-separated on-demand tool families the Host writes to the tool-catalog row. */\n pagedToolPatterns?: string\n}\n\n/** What the LiangShen card renders. */\nexport interface LiangShenSettingsCardState extends CardShell {\n enabled: CardFieldState\n announceToAgent: CardFieldState\n presentation: CardFieldState\n dispatcher: CardFieldState\n pagedToolPatterns: CardFieldState\n}\n\n/** The registration-side face the card's slot entry injects. */\nexport interface LiangShenSettingsCardFace extends CardActions {\n hooks: {\n /** Card snapshot bound by the renderer as useLiangShenSettingsCard. */\n liangShenSettingsCard: SnapshotStore<LiangShenSettingsCardState>\n }\n}\n\n/** Bridges the `liangshen` settings form onto the card's staged form. */\nexport class LiangShenSettingsCardController {\n private readonly form: CardForm<LiangShenSettings>\n private readonly store: SnapshotStore<LiangShenSettingsCardState>\n\n /** @param scope - the bound configuration form of the entry that owns this namespace. */\n constructor(scope: ConfigForm<LiangShenSettings>) {\n this.form = new CardForm(scope, [\n booleanField('enabled'),\n booleanField('announceToAgent'),\n choiceField('presentation', PRESENTATION_CHOICES),\n booleanField('dispatcher'),\n pagedToolPatternsField('pagedToolPatterns'),\n ])\n this.store = this.form.bind(() => this.projection())\n }\n\n private projection(): LiangShenSettingsCardState {\n return {\n ...this.form.shell(),\n enabled: this.form.field('enabled'),\n announceToAgent: this.form.field('announceToAgent'),\n presentation: this.form.field('presentation'),\n dispatcher: this.form.field('dispatcher'),\n pagedToolPatterns: this.form.field('pagedToolPatterns'),\n }\n }\n\n /**\n * Build the face the card's slot registration injects.\n * @returns the card's snapshot and its form actions.\n */\n inject(): LiangShenSettingsCardFace {\n return { hooks: { liangShenSettingsCard: this.store }, ...this.form.actions() }\n }\n\n /** Release the card's scope subscription and bound stores. */\n dispose(): void {\n this.form.dispose()\n }\n}\n\n/** Props the renderer binds for the LiangShen card. */\nexport type LiangShenSettingsCardProps =\n PropsRuntime<'web-ui.plugin.item'>\n & PropsLocale<'liangshen'>\n & InjectFace<LiangShenSettingsCardFace>\n\n/**\n * Render the LiangShen card.\n * @param props - locale copy, the card snapshot, and its form actions.\n * @returns the card.\n */\nexport function LiangShenSettingsCard(props: LiangShenSettingsCardProps) {\n const { t } = props\n const state = props.useLiangShenSettingsCard((snapshot: LiangShenSettingsCardState) => snapshot)\n const fieldProps = {\n overriddenLabel: t('settings.overridden'),\n resetLabel: t('settings.reset'),\n invalidLabel: t('settings.invalidValue'),\n disabled: !state.writable,\n inheritLabel: t('settings.inherit'),\n }\n return (\n <PluginSettingsCard\n t={t}\n titleKey=\"settings.title\"\n descriptionKey=\"settings.description\"\n icon={<LiangShenMark />}\n defaultOpen={false}\n state={state}\n renderChildrenWhenNotExposed\n hideNotExposedNotice\n onSave={props.save}\n onDiscard={props.discard}\n >\n <BooleanField\n id=\"settings-liangshen-enabled\"\n label={t('settings.enabled')}\n hint={t('settings.enabledHint')}\n onLabel={t('settings.on')}\n offLabel={t('settings.off')}\n {...fieldProps}\n {...state.enabled}\n onEdit={(text) => { props.edit('enabled', text) }}\n onReset={() => { props.resetField('enabled') }}\n />\n <BooleanField\n id=\"settings-liangshen-announce\"\n label={t('settings.announceToAgent')}\n hint={t('settings.announceToAgentHint')}\n onLabel={t('settings.on')}\n offLabel={t('settings.off')}\n {...fieldProps}\n {...state.announceToAgent}\n onEdit={(text) => { props.edit('announceToAgent', text) }}\n onReset={() => { props.resetField('announceToAgent') }}\n />\n <ChoiceField\n id=\"settings-liangshen-presentation\"\n label={t('settings.presentation')}\n hint={t('settings.presentationHint')}\n choices={PRESENTATION_CHOICES.map(choice => ({ value: choice, label: t(`presentation.${choice}`) }))}\n presentation=\"segment\"\n {...fieldProps}\n {...state.presentation}\n onEdit={(text) => { props.edit('presentation', text) }}\n onReset={() => { props.resetField('presentation') }}\n />\n <BooleanField\n id=\"settings-liangshen-dispatcher\"\n label={t('settings.dispatcher')}\n hint={t('settings.dispatcherHint')}\n onLabel={t('settings.on')}\n offLabel={t('settings.off')}\n {...fieldProps}\n {...state.dispatcher}\n onEdit={(text) => { props.edit('dispatcher', text) }}\n onReset={() => { props.resetField('dispatcher') }}\n />\n <ValueField\n id=\"settings-liangshen-paged-tool-patterns\"\n label={t('settings.pagedToolPatterns')}\n hint={t('settings.pagedToolPatternsHint')}\n placeholder=\"browser_*, task_board_*\"\n {...fieldProps}\n invalidLabel={t('settings.pagedToolPatternsInvalid')}\n {...state.pagedToolPatterns}\n onEdit={(text) => { props.edit('pagedToolPatterns', text) }}\n onReset={() => { props.resetField('pagedToolPatterns') }}\n />\n </PluginSettingsCard>\n )\n}\n","/**\n * Lever copy: zh-first dictionary with an English counterpart. The zh side is\n * the key-set source of truth; `packages/dsh-i18n` mirrors the keys into the\n * centralized ru dictionary and `pnpm i18n:check` enforces the parity.\n */\n\n/** Lever copy, key source of truth. */\nexport const zh = {\n 'lever.a11y': '梁神模式拨杆',\n 'lever.name': '梁神模式',\n 'lever.hint.pull': '拨下拨杆:开启「梁神模式」',\n 'lever.hint.push': '上拨拨杆:返回「{preset}」',\n 'lever.hint.locked': '会话已开始,模式不可再更改',\n 'lever.hint.missing': '未找到「梁神模式」预设,请先启用该插件行',\n 'lever.state.on': '梁神模式',\n 'lever.state.off': '普通模式',\n 'lever.busy': '正在切换…',\n 'lever.failed.locked': '会话已经开始,模式已锁定',\n 'lever.failed.missing': '没有找到「梁神模式」预设',\n 'lever.failed.timeout': '切换超时,请重试',\n 'lever.failed.failed': '切换失败:{reason}',\n 'burst.line1': '三秒,三辈子的代码',\n 'burst.line2': '文言文 · 二进制 · 摩斯电码',\n 'settings.title': '梁神模式',\n 'settings.description': '梁神模式的开关、工具面与调度身份。',\n 'settings.enabled': '总开关',\n 'settings.enabledHint': '关掉后不再声明预设。',\n 'settings.announceToAgent': '公告给 agent',\n 'settings.announceToAgentHint': '每一轮系统提示都带上本插件公告。',\n 'settings.presentation': '工具面',\n 'settings.presentationHint': 'ptc 把工具收进 run_code,native 保留原生清单。',\n 'settings.dispatcher': '调度身份',\n 'settings.dispatcherHint': '按调度 Agent 工作:分诊、访谈、派发子代理。',\n 'settings.pagedToolPatterns': '按需工具族',\n 'settings.pagedToolPatternsHint': '逗号分隔,每项以单个 * 结尾。命中这些前缀的工具默认不进上下文,需要时用 tool_activate 按需加载。留空继承出厂 7 项:mcp__*, browser_*, task_board_*, team_*, squad*, ui_*, ssh_*。',\n 'settings.pagedToolPatternsInvalid': '每项须是非空前缀并以单个 * 结尾,逗号分隔,例如 task_board_*。',\n 'settings.on': '开',\n 'settings.off': '关',\n 'settings.inherit': '继承',\n 'settings.overridden': '已修改',\n 'settings.reset': '恢复默认',\n 'settings.notExposed': '这个版本的 DSH 没有开放梁神模式的设置。',\n 'settings.readOnly': '设置只读。',\n 'settings.expand': '展开设置',\n 'settings.collapse': '收起设置',\n 'settings.saveFailed': '没有保存成功。',\n 'settings.invalidValue': '填一个可用的值。',\n 'presentation.ptc': 'ptc',\n 'presentation.native': 'native',\n}\n\n/** English counterpart; the key set mirrors {@link zh} exactly. */\nexport const en: Record<keyof typeof zh, string> = {\n 'lever.a11y': 'LiangShen mode lever',\n 'lever.name': 'LiangShen mode',\n 'lever.hint.pull': 'Pull the lever down to turn on LiangShen mode',\n 'lever.hint.push': 'Push the lever up to return to \"{preset}\"',\n 'lever.hint.locked': 'The session has started, so its mode can no longer change',\n 'lever.hint.missing': 'The LiangShen preset is not installed; enable that plugin row first',\n 'lever.state.on': 'LiangShen',\n 'lever.state.off': 'Standard',\n 'lever.busy': 'Switching…',\n 'lever.failed.locked': 'The session already started, so the mode is locked',\n 'lever.failed.missing': 'The LiangShen preset was not found',\n 'lever.failed.timeout': 'The switch timed out; try again',\n 'lever.failed.failed': 'Switch failed: {reason}',\n 'burst.line1': 'Three seconds, three lifetimes of code',\n 'burst.line2': 'Classical Chinese · Binary · Morse code',\n 'settings.title': 'LiangShen mode',\n 'settings.description': 'The mode switch, the wire presentation and the dispatcher identity.',\n 'settings.enabled': 'Master switch',\n 'settings.enabledHint': 'When off, the preset is no longer declared.',\n 'settings.announceToAgent': 'Announce to agents',\n 'settings.announceToAgentHint': 'Every system prompt carries this plugin note.',\n 'settings.presentation': 'Wire',\n 'settings.presentationHint': 'ptc folds tools into run_code; native keeps the native roster.',\n 'settings.dispatcher': 'Dispatcher',\n 'settings.dispatcherHint': 'Works as a dispatcher: triage, interview, then dispatch subagents.',\n 'settings.pagedToolPatterns': 'On-demand tool families',\n 'settings.pagedToolPatternsHint': 'Comma separated, each entry ending in a single *. Tools matching these prefixes stay out of context by default; load them with tool_activate when needed. Leave empty to inherit the 7 factory entries: mcp__*, browser_*, task_board_*, team_*, squad*, ui_*, ssh_*.',\n 'settings.pagedToolPatternsInvalid': 'Each entry must be a non-empty prefix ending in a single *, comma separated, for example task_board_*.',\n 'settings.on': 'On',\n 'settings.off': 'Off',\n 'settings.inherit': 'Inherit',\n 'settings.overridden': 'Changed',\n 'settings.reset': 'Reset to default',\n 'settings.notExposed': 'This DSH version does not open the LiangShen settings.',\n 'settings.readOnly': 'Settings are read-only.',\n 'settings.expand': 'Show settings',\n 'settings.collapse': 'Hide settings',\n 'settings.saveFailed': 'Not saved.',\n 'settings.invalidValue': 'Enter a value this field accepts.',\n 'presentation.ptc': 'ptc',\n 'presentation.native': 'native',\n}\n\n/** Every key in the locale catalog. */\nexport type LiangShenKey = keyof typeof zh\n","// Generated by scripts/sync-shared.mjs from shared/client/settings/plugin-card-seat.ts. Do not edit this copy; edit the shared source and run \"node scripts/sync-shared.mjs\".\n/**\n * Family plugin-card seat.\n *\n * A family plugin contributes its settings card to whichever plugin-card seat\n * the running host actually renders:\n *\n * - `web-ui.plugin.item` — the list seat declared by the dsh-web-settings\n * group section (this family's own first-level \"Web UI plugins\" section);\n * - `plugins.bundle.config` — the official keyed seat of the harness's plugin\n * manager page, keyed by the bundle's package name and rendered on that\n * bundle's page. alpha.2 removed the `settings.plugin.item` keyed seat of the\n * `ui-settings-plugins` tab that this helper used before, so a card keyed by\n * its settings namespace has no seat to land in any more.\n *\n * SEAT SELECTION IS NOT A DECLARATION PROBE. The official plugin surface\n * belongs to the harness bundle and declares its seats before any external\n * plugin's `apply()` runs, so \"is the official seat declared?\" answers yes even\n * in the deployment whose whole point is the family group. Choosing on that\n * probe sends every family card to the official page and leaves the group's own\n * section permanently empty — the family of reports where the section renders\n * its heading and zero cards.\n *\n * The signal that actually distinguishes the two deployments is whether\n * dsh-web-settings is loaded: it is the package that owns the group section and\n * it publishes the `webUiSettings` service during `apply()`, which every\n * family plugin already reads for its settings form. Group loaded -> the family\n * seat; group absent -> the official seat.\n *\n * The decision is re-evaluated on every `slots/changed` because the group may\n * apply after this plugin (the family aggregate orders it first, a profile that\n * installs the group separately need not): the initial contribution goes to the\n * official seat, then moves to the family seat the moment the group's section\n * registers. The entry is disposed before the replacement is registered, so a\n * card is never in two seats at once.\n *\n * The shared tree has no client-SDK dependency, so this module reads its\n * context through the structural shape below; callers pass the plugin's own\n * `ctx`.\n */\n\n/** The family list seat key. */\nexport const FAMILY_PLUGIN_CARD_SEAT = 'web-ui.plugin.item'\n\n/** The official keyed plugin-card seat key (the alpha.2 bundle-configuration seat). */\nexport const OFFICIAL_PLUGIN_CARD_SEAT = 'plugins.bundle.config'\n\n/** The service dsh-web-settings publishes while it is loaded. */\nexport const FAMILY_GROUP_SERVICE = 'webUiSettings'\n\n/** The slot-registry member this helper uses (structurally satisfied by ctx.slots). */\nexport interface PluginCardSlots {\n /** Contribution of one card entry. */\n register(options: never, component: never): unknown\n /** Declaration probe: a target seat may appear after this plugin applies. */\n spec?(key: string): unknown\n}\n\n/** The slice of the client context a card contribution needs. */\nexport interface PluginCardContext {\n slots: PluginCardSlots\n /** Service lookup; absent on a context double that only models the slots. */\n get?(name: string): unknown\n /** Event subscription seat; absent on an event-less test double. */\n on?(event: never, listener: never): unknown\n}\n\n/** Owner share of a family list-seat card (that seat supplies nothing). */\nexport interface SettingsPluginItemOwnerProps {\n /** Marker field: card owner props are intentionally empty. */\n children?: never\n}\n\n/** One family plugin's card contribution. */\nexport interface PluginCardSeat {\n /**\n * Npm package name of the bundle this card configures; the official keyed\n * seat dispatches on it. Every family package ships its own bundle patch, so\n * a standalone install lists that package as the bundle whose page renders\n * this card.\n */\n bundle: string\n /** Family list-seat entry id. */\n id: string\n /** Family list-seat sort order. */\n order?: number\n /** Family list-seat display label; the official keyed seat carries none. */\n label?: () => string\n /** Locale namespace the card renders with. */\n locale: string\n /**\n * Child slots this card declares and renders. Forwarded to whichever seat\n * the host renders; absent for a card that declares none.\n */\n children?: Record<string, unknown>\n /** Business-face factory of the registration. */\n inject?: () => object\n /**\n * The card component. Its props type is the seat's composed shape, which is\n * chosen at runtime, so the helper takes it erased; the registrant keeps its\n * own precise typing at the call site.\n */\n component: unknown\n}\n\n/**\n * Whether the family group (dsh-web-settings) is loaded in this page. The\n * service is the group package's own contract, so the probe cannot be fooled\n * by a harness release that starts declaring the official seat differently.\n */\nexport function familyGroupLoaded(ctx: PluginCardContext): boolean {\n const get = ctx.get\n if (typeof get !== 'function') return false\n try {\n return get.call(ctx, FAMILY_GROUP_SERVICE) !== undefined\n } catch {\n // A context that refuses the lookup: treat the group as absent, which\n // falls back to the official seat the harness declares.\n return false\n }\n}\n\n/** Report a refused registration instead of leaving the user with no card. */\nfunction warnRefusedSeat(seat: string, error: unknown): void {\n try {\n console.warn(`[dsh-web] plugin card registration into \"${seat}\" was refused; the card will not render`, error)\n } catch {\n // Best-effort console write; a failed warning must not break the plugin.\n }\n}\n\n/**\n * Contribute one family plugin card to the seat this host renders, following\n * the group if it loads later. The entry is disposed and re-registered on a\n * seat change, never duplicated.\n * @param ctx - client context (its slot registry decides the seat).\n * @param seat - the card contribution.\n */\nexport function installPluginCard(ctx: PluginCardContext, seat: PluginCardSeat): void {\n const slots = ctx.slots\n const component = seat.component as never\n const inject = seat.inject as never\n\n let dispose: (() => void) | undefined\n let current: string | undefined\n /**\n * Re-entrancy latch. The registry emits a change event synchronously from\n * inside both `register` and the previous entry's disposer, so an unguarded\n * reconcile would re-enter itself mid-move and register the card twice into\n * the seat it is leaving (\"already has an entry for key ...\").\n */\n let reconciling = false\n\n /** Reconcile the contribution with the currently live seat (no-op when unchanged). */\n const reconcile = (): void => {\n if (reconciling) return\n const target = familyGroupLoaded(ctx) ? FAMILY_PLUGIN_CARD_SEAT : OFFICIAL_PLUGIN_CARD_SEAT\n if (current === target) return\n // The group's child seat can be declared after this card applies (the\n // parent mounts its pages through the extension service). Wait for the\n // declaration instead of logging a refused registration on every boot.\n if (typeof slots.spec === 'function' && slots.spec(target) === undefined) return\n reconciling = true\n const previous = dispose\n dispose = undefined\n current = undefined\n previous?.()\n try {\n dispose = slots.register((target === FAMILY_PLUGIN_CARD_SEAT\n ? {\n name: FAMILY_PLUGIN_CARD_SEAT,\n id: seat.id,\n ...(seat.order === undefined ? {} : { order: seat.order }),\n ...(seat.label === undefined ? {} : { label: seat.label }),\n locale: seat.locale,\n ...(seat.children === undefined ? {} : { children: seat.children }),\n ...(seat.inject === undefined ? {} : { inject }),\n }\n : {\n name: OFFICIAL_PLUGIN_CARD_SEAT,\n key: seat.bundle,\n locale: seat.locale,\n ...(seat.children === undefined ? {} : { children: seat.children }),\n ...(seat.inject === undefined ? {} : { inject }),\n }) as never, component) as () => void\n current = target\n } catch (error) {\n warnRefusedSeat(target, error)\n } finally {\n reconciling = false\n }\n }\n\n if (typeof ctx.on === 'function') {\n try {\n ctx.on('slots/changed' as never, (() => { reconcile() }) as never)\n } catch {\n // An event seat that refuses the subscription leaves the initial\n // decision in place; the card still renders in the seat chosen below.\n }\n }\n // The initial decision: the group, when it is already loaded (the aggregate\n // order), otherwise the official seat the harness declares.\n reconcile()\n}\n","// Generated by scripts/sync-shared.mjs from shared/client/settings/settings-entry-form.ts. Do not edit this copy; edit the shared source and run \"node scripts/sync-shared.mjs\".\n// Generated by scripts/sync-shared.mjs from shared/client/settings/settings-entry-form.ts. Do not edit this copy; edit the shared source and run \"node scripts/sync-shared.mjs\".\n/**\n * Family settings form bound to the profile entry id a Host actually serves.\n *\n * Under the 0.1.7 settings model a form is addressed by PROFILE ENTRY ID, while\n * a family card knows only its own settings namespace. The family binder\n * (`ctx.get('webUiSettings')`, published by dsh-web-settings) resolves one onto\n * the other and is the preferred transport; this module is the fallback for a\n * page that serves no binder — the group plugin is not installed, or its client\n * half has not applied yet (the aggregate mounts its children in order, and a\n * child still waiting on its own injects publishes nothing).\n *\n * The shared describe mirror is the only local evidence of which row id this\n * profile serves, but it answers asynchronously: at plugin activation it usually\n * holds nothing yet. A one-shot guess therefore cannot be right for every\n * deployment, and the form is bound once per session:\n *\n * - binding the bare namespace made every save answer `No configurable plugin\n * entry \"<namespace>\"` on an aggregate install (the namespace is not an entry\n * id there), which the card reported as \"the deployment did not accept these\n * values\";\n * - binding the aggregate row id would break a standalone install, whose row id\n * is the namespace or the package's own `ui-*` row.\n *\n * So the fallback starts on the most likely row and REBINDS the moment the\n * mirror names one of this package's rows. Until the mirror answers, the form\n * reports the binding it holds (usually `loading`), which the card renders as an\n * unavailable form rather than a doomed one.\n */\nimport type { ConfigForm, ConfigFormSnapshot, ConfigForms } from '@deepseek-ai/dsh-client-ui-settings/client'\n\n/** Options of {@link createServedEntryForm}. */\nexport interface ServedEntryFormOptions<T> {\n /** The shared configuration forms service (`ctx.configForms`). */\n forms: ConfigForms\n /**\n * Profile entry ids this package's rows carry, most likely first: the\n * aggregate's generated row, the package's own standalone row, then the bare\n * namespace. The first is the fallback while the mirror has no answer; the\n * last is the answer when the mirror serves none of them.\n */\n entryIds: readonly string[]\n}\n\n/** The snapshot a form reports before the Host has answered with this entry. */\nfunction pendingSnapshot<T>(): ConfigFormSnapshot<T> {\n return {\n status: 'loading',\n value: undefined,\n base: undefined,\n user: undefined,\n revision: undefined,\n writable: false,\n }\n}\n\n/**\n * Create a settings form bound to the profile entry id this Host serves, and\n * rebound whenever the shared describe mirror names a different one of this\n * package's rows.\n * @param options - the shared forms service and this package's candidate row ids.\n * @returns a form delegating to the currently resolved entry's own form.\n */\nexport function createServedEntryForm<T>(options: ServedEntryFormOptions<T>): ConfigForm<T> {\n const { forms, entryIds } = options\n const fallbackId = entryIds[0]\n const namespaceId = entryIds[entryIds.length - 1]\n const listeners = new Set<() => void>()\n let boundId: string | undefined\n let bound: ConfigForm<T> | undefined\n let offBound: (() => void) | undefined\n let snapshot: ConfigFormSnapshot<T> = pendingSnapshot<T>()\n\n /** Republish: the delegated snapshot when one is bound, the pending one otherwise. */\n const publish = (): void => {\n if (bound !== undefined) snapshot = bound.getSnapshot()\n for (const listener of [...listeners]) listener()\n }\n\n /**\n * The entry id the mirror currently justifies. An unanswered or empty mirror\n * is not evidence of absence, so it keeps the first candidate; a mirror that\n * answers without any of this package's rows leaves the namespace itself.\n * @returns the entry id to bind.\n */\n const resolve = (): string => {\n let served: readonly string[] | undefined\n try {\n served = forms.describe().getSnapshot().view?.namespaces.map(row => row.ns)\n } catch {\n // A mirror that refuses the read is unanswered too, not absent.\n served = undefined\n }\n if (served === undefined || served.length === 0) return fallbackId\n return entryIds.find(id => served.includes(id)) ?? namespaceId\n }\n\n /** Bind (or rebind) the resolved entry's form; a no-op while it is unchanged. */\n const bind = (): void => {\n const target = resolve()\n if (target === boundId) return\n offBound?.()\n offBound = undefined\n let form: ConfigForm<T>\n try {\n form = forms.get<T>(target)\n } catch {\n // A service that refuses the id stays unbound; the next mirror answer\n // retries rather than pinning a wrong entry for the session.\n boundId = undefined\n return\n }\n boundId = target\n bound = form\n offBound = form.subscribe(() => { publish() })\n publish()\n }\n\n // The mirror subscription lives for the page: the card owns its form for the\n // session, and the ConfigForm contract carries no disposer to hang it on. The\n // callback is cheap (a resolve plus a no-op while the id is unchanged). A\n // mirror without a subscription seat keeps the initial binding.\n try {\n forms.describe().subscribe(() => { bind() })\n } catch {\n // A describe face that refuses the subscription: the initial binding stands.\n }\n bind()\n\n return {\n getSnapshot: () => snapshot,\n subscribe: (listener) => {\n listeners.add(listener)\n return () => { listeners.delete(listener) }\n },\n set: (field, value) => bound?.set(field, value) ?? Promise.resolve(false),\n unset: (field) => bound?.unset(field) ?? Promise.resolve(false),\n mutate: (ops, expectedRevision) => bound?.mutate(ops, expectedRevision) ?? Promise.resolve(false),\n }\n}\n","/**\n * dsh-liangshen browser half: the LiangShen lever in the composer tool row.\n *\n * The slot is `conversation.input.right` — \"compact controls before the\n * composer submit action\", which renders immediately left of the model\n * selector (`conversation.input.model`) inside the same composer card, on the\n * homepage's new-session hero as well as in a session. The lever lives only\n * while the session is still blank, because that is the only window in which a\n * preset can change at all: `agentPresets.select` refuses an already-started\n * session, and the arm would have nothing to do in one.\n *\n * This half talks to the host over the agent-preset Remote namespace rather\n * than through the official preset package's browser module: cross-plugin\n * collaboration here goes through cordis services and Remote surfaces, not\n * value imports.\n *\n * Failure policy: a missing slot or a refused Remote call is handled, never\n * thrown — one external plugin must not take the GUI boot down.\n */\n\nimport type { Context as ClientContext } from '@deepseek-ai/cordis'\nimport type {} from '@deepseek-ai/dsh-client-ui-renderer/client'\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\n// Type-only: pulls the ui-conversation SlotMap merge (the composer tool row).\nimport type {} from '@deepseek-ai/dsh-client-ui-conversation/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-slots'\nimport type { ConfigForm, ConfigForms } from '@deepseek-ai/dsh-client-ui-settings/client'\n// Type-only: pulls the settings-surface Context merge (ctx.configForms).\nimport type {} from '@deepseek-ai/dsh-client-ui-settings/client'\nimport { LiangShenLever } from './LiangShenLever.tsx'\nimport { LeverController } from './lever-controller.ts'\nimport { LiangShenSettingsCard, LiangShenSettingsCardController, type LiangShenSettings } from './LiangShenSettingsCard.tsx'\nimport { en, zh, type LiangShenKey } from './locales.ts'\nimport { installPluginCard } from './plugin-card-seat.ts'\nimport { createServedEntryForm } from './settings-entry-form.ts'\n\n/** Locale namespace this half owns. */\nexport const NS = 'liangshen'\n\n/**\n * Settings namespace the settings card edits: the family identity of this\n * plugin's own settings form, and the row id a standalone bundle install\n * carries. The aggregate install mounts the generated `web-ui-liangshen` row\n * instead, and the family binder resolves between the two.\n */\nexport const SETTINGS_NAMESPACE = 'liangshen'\n\n/**\n * Profile entry id the family aggregate's generated row carries — the shape\n * nearly every user runs, and the id the shared-forms fallback binds when the\n * family binder cannot resolve the namespace.\n */\nconst AGGREGATE_ENTRY_ID = 'web-ui-liangshen'\n\n/** Profile entry ids this package's patch rows carry, most specific first. */\nconst LIANGSHEN_ENTRY_IDS: readonly string[] = [AGGREGATE_ENTRY_ID, 'ui-liangshen', SETTINGS_NAMESPACE]\n\n/**\n * The profile entry id this package's own row carries, for a page that serves\n * no family binder.\n *\n * The shared describe mirror is the only local evidence of which row id this\n * profile actually serves, but it answers asynchronously: at plugin activation\n * it usually holds nothing yet. An unanswered or empty mirror is therefore NOT\n * evidence of absence, and binding the bare namespace there is what made every\n * save fail with `No configurable plugin entry \"liangshen\"` — the form is\n * bound once per session, so a wrong guess never recovers. The aggregate row id\n * is the answer that matches nearly every deployment; only a mirror that\n * answers with OTHER plugins' rows keeps the namespace as the last resort (the\n * pre-0.1.7 keying shape), because that answer is the one that actually proves\n * this package's own row is not served.\n * @param forms - the shared configuration forms service.\n * @returns the entry id to bind.\n */\nexport function servedEntryId(forms: ConfigForms): string {\n let served: readonly string[] | undefined\n try {\n served = forms.describe().getSnapshot().view?.namespaces.map(view => view.ns)\n } catch {\n // A mirror that refuses the read is unanswered too, not absent.\n served = undefined\n }\n if (served === undefined || served.length === 0) return AGGREGATE_ENTRY_ID\n return LIANGSHEN_ENTRY_IDS.find(id => served.includes(id)) ?? SETTINGS_NAMESPACE\n}\n\n/**\n * Bind the settings form the card stages over.\n *\n * The family binder comes first: it is what resolves this package's family\n * namespace onto the profile entry id the Host serves the form under, and it\n * keeps the loopback bridge as its own fallback. A page without that group (or\n * one where its client half has not applied yet) binds through the shared forms\n * service, on the entry id the describe mirror justifies and rebound as soon as\n * the mirror answers — see {@link createServedEntryForm} for why a one-shot\n * guess cannot be right for both an aggregate and a standalone install.\n * @param ctx - the browser plugin context.\n * @returns the form the settings card reads and writes.\n */\nexport function bindSettingsForm(ctx: ClientContext): ConfigForm<LiangShenSettings> {\n const binder = ctx.get('webUiSettings')\n if (binder !== undefined && typeof binder.bind === 'function') {\n return binder.bind<LiangShenSettings>({ namespace: SETTINGS_NAMESPACE })\n }\n return createServedEntryForm<LiangShenSettings>({\n forms: ctx.configForms,\n entryIds: LIANGSHEN_ENTRY_IDS,\n })\n}\n\n/** Owner share of a plugin card (the section supplies nothing). */\nexport interface SettingsPluginItemOwnerProps {\n /** Marker field: card owner props are intentionally empty. */\n children?: never\n}\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface SlotMap {\n /**\n * The child slot the Web UI plugin group declares; this card registers into\n * the group's list seat rather than the official bundle-configuration\n * seat. Declared here so this package needs no dependency on the sibling UI\n * package.\n */\n 'web-ui.plugin.item': { kind: 'list'; scope: 'root'; owner: SettingsPluginItemOwnerProps }\n }\n}\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n /**\n * Optional family settings binder provided by dsh-web-settings; absent when\n * that group plugin is not installed, so callers bind the shared forms\n * service (`ctx.configForms`) by profile entry id directly.\n */\n webUiSettings?: { bind<S>(spec: LiangShenFormSpec<S>): ConfigForm<S> }\n }\n}\n\n/**\n * One settings namespace a family card binds. The 0.1.7 client exports no spec\n * type (the form controller takes it privately), so the binder's input shape is\n * restated here.\n */\nexport interface LiangShenFormSpec<T> {\n /** Settings namespace registered by the owning host plugin. */\n namespace: string\n /** Narrow one wire section; undefined keeps the last accepted value. */\n decode?: (section: unknown) => T | undefined\n}\n\n/**\n * Required client services: the slot registry, locale, sessions, the shared\n * configuration forms, and the roster Remote. Both `remote` and\n * `remote.agentPresets` are declared: the context proxy refuses an uninjected\n * service, and a nested service name does not imply its parent, so reading\n * `ctx.remote.agentPresets` needs `remote` as well.\n */\nexport const inject = ['slots', 'locale', 'sessions', 'configForms', 'remote', 'remote.agentPresets']\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap {\n /** The LiangShen lever copy. */\n 'liangshen': LiangShenKey\n }\n}\n\nexport { LiangShenLever } from './LiangShenLever.tsx'\nexport { LeverController, type LeverFace, type LeverSnapshot } from './lever-controller.ts'\nexport { LIANGSHEN_PRESET_ID, leverState, restoreTarget, type LeverFacts, type LeverState } from '../core/lever.ts'\n\n/**\n * Mount the lever: register the copy, follow the roster and the current\n * session, and claim the composer tool row.\n * @param ctx - the browser plugin context.\n */\nexport function apply(ctx: ClientContext): void {\n ctx.effect(() => {\n try {\n return ctx.locale.register(NS, { zh, en })\n } catch {\n return () => {}\n }\n }, 'liangshen: lever dictionaries')\n\n const controller = new LeverController(ctx)\n ctx.effect(() => () => controller.dispose(), 'liangshen: lever controller')\n try {\n controller.start()\n } catch {\n // An unavailable sessions or Remote service leaves the lever inert; the\n // view still renders and reports what it knows.\n }\n\n // Plugin configuration card: one staged form over the `liangshen` settings\n // namespace, contributed to the Web UI plugin group beside the\n // remote-access and task-board cards.\n try {\n const settingsCard = new LiangShenSettingsCardController(bindSettingsForm(ctx))\n // Card seat: the family group's list seat, or the official\n // bundle-configuration seat when the group is not installed.\n installPluginCard(ctx, {\n bundle: '@linxin666/dsh-liangshen',\n id: 'liangshen',\n order: 120,\n locale: NS,\n inject: () => settingsCard.inject(),\n component: LiangShenSettingsCard,\n })\n ctx.effect(() => () => { settingsCard.dispose() }, 'liangshen: settings card')\n } catch {\n // A missing settings surface leaves the lever working and the card absent;\n // one unavailable service must not take the browser half down.\n }\n\n ctx.slots.inject('conversation.input.right', () => {\n try {\n const unregister = ctx.slots.register({\n name: 'conversation.input.right',\n id: 'liangshen-lever',\n order: 20,\n inject: () => controller.face(),\n }, LiangShenLever)\n return () => { unregister() }\n } catch {\n return () => {}\n }\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmBA,MAAM,oBAAoB;;EA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