@linxin666/dsh-liangshen 0.4.1 → 0.4.3
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/README.i18n.yaml +2 -2
- package/README.md +2 -2
- package/README.zh.md +2 -2
- package/lib/client.js +144 -9
- package/lib/client.js.map +1 -1
- package/lib/index.js +125 -13
- package/lib/types/client/index.d.ts +38 -6
- package/lib/types/client/settings-entry-form.d.ts +49 -0
- package/lib/types/mount-once.d.ts +38 -7
- package/package.json +15 -15
- package/src/announce.test.ts +77 -3
- package/src/client/index.ts +58 -15
- package/src/client/settings-entry-form.ts +142 -0
- package/src/index.ts +41 -1
- package/src/mount-once.ts +107 -13
- package/tools/analyze-session.mjs +19 -0
- package/tools/benchmark-live-run.mjs +141 -25
- package/tools/benchmark-report.mjs +32 -9
- package/tools/prices/deepseek-flash.json +14 -0
- package/tools/tasks/liangshen-v41-flash.json +49 -1
package/lib/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["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/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/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","// 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 save\n * that writes them. 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\nimport { useCallback, useEffect, useLayoutEffect, useRef, useState, type KeyboardEvent, type ReactNode } from 'react'\nimport type { CardShell } from './settings-form.ts'\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.unsaved',\n 'settings.readOnly',\n 'settings.saveFailed',\n 'settings.discard',\n 'settings.save',\n 'settings.saving',\n] as const\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 /** The card's form state: availability, writability, and what a save would do. */\n state: CardShell\n /** Write every staged edit. */\n onSave: () => void\n /** Drop every staged edit. */\n onDiscard: () => void\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 save/discard footer: cards whose body applies its own changes\n * immediately (an embedded external settings section) have no staged\n * edits, so the footer would sit there permanently disabled.\n */\n hideFooter?: boolean\n /** Render children even when the settings namespace is not exposed by the host. */\n renderChildrenWhenNotExposed?: boolean\n /** Hide the 'not exposed' warning banner when the settings namespace is not exposed. */\n hideNotExposedNotice?: boolean\n /** The plugin's controls. */\n children: ReactNode\n}\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 if (!state.available) return null\n const title = props.t(props.titleKey)\n const description = props.t(props.descriptionKey)\n const blocked = !state.dirty || state.invalid || state.saving\n const expanded = alwaysOpen === true || open\n const cardClass = expanded ? `${css.cardOpen} ${css.card}` : css.card\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 <span className={css.headText}>\n <span className={css.name} title={title}>{title}</span>\n <span className={css.description} title={description}>{props.descriptionNode ?? description}</span>\n </span>\n {state.dirty ? <span className={css.pending} title={props.t('settings.unsaved')}>{props.t('settings.unsaved')}</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 <span className={css.headText}>\n <span className={css.name} title={title}>{title}</span>\n <span className={css.description} title={description}>{props.descriptionNode ?? description}</span>\n </span>\n {state.dirty ? <span className={css.pending} title={props.t('settings.unsaved')}>{props.t('settings.unsaved')}</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.\n if (!state.exposed && props.renderChildrenWhenNotExposed !== true) {\n const showNotice = props.hideNotExposedNotice !== true\n return (\n <li className={cardClass}>\n {header}\n {expanded\n ? (\n <div className={css.body}>\n {showNotice ? <p className={css.notExposed} role=\"status\">{props.t('settings.notExposed')}</p> : null}\n </div>\n )\n : null}\n </li>\n )\n }\n return (\n <li className={cardClass}>\n {header}\n {expanded\n ? (\n <div className={css.body}>\n {!state.writable ? <p className={css.readOnly} role=\"status\">{props.t('settings.readOnly')}</p> : null}\n {props.children}\n {props.hideFooter === true\n ? null\n : (\n <div className={css.footer}>\n {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 <button\n type=\"button\"\n className={css.discard}\n disabled={!state.dirty || state.saving}\n onClick={props.onDiscard}\n >\n {props.t('settings.discard')}\n </button>\n <button\n type=\"button\"\n className={css.save}\n disabled={blocked}\n onClick={props.onSave}\n >\n {props.t(!state.saving ? 'settings.save' : 'settings.saving')}\n </button>\n </div>\n )}\n </div>\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 /** Draft text this control renders. */\n text: string\n /** True when saving would leave a user-layer entry for this field. */\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 /** Stage draft text. */\n onEdit: (text: string) => void\n /** Stage a clear so the field re-inherits the composition layer. */\n onReset: () => void\n}\n\n/** A staged value field. `numeric` only hints the keypad: which drafts a field accepts is decided by its spec. */\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}) {\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 <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 />\n <p className={props.invalid ? css.invalid : css.hint}>\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 * Staged cards reach it through BooleanField/ChoiceField; immediate-apply\n * editors (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/** A staged 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}) {\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 <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 <p className={css.hint}>{props.hint}</p>\n </div>\n )\n}\n\n/** A staged enumerated field rendered as a select. */\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 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 <SelectField\n id={props.id}\n options={[{ value: '', label: props.inheritLabel }, ...props.choices]}\n value={props.text}\n disabled={props.disabled}\n invalid={props.invalid}\n onEdit={props.onEdit}\n />\n <p className={props.invalid ? css.invalid : css.hint}>\n {props.invalid ? props.invalidLabel : props.hint}\n </p>\n </div>\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 * Staged form model behind the plugin settings card. A card stages what the\n * user types and writes it only when they save — the settings write is a\n * durable, revision-fenced document mutation, so staging keeps what is on\n * screen exactly what a save would store. Family-shared slice inlined into\n * each plugin's client bundle; mirrors the official ui-plugin-config\n * card-store pattern.\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 staged text performs when the card is saved. */\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 * 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 stages, or undefined when the text is not a\n * value this field accepts — which blocks the save rather than 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 saving would leave a user-layer entry for this field. */\n overridden: boolean\n /** Whether the draft is not a value this field accepts, which blocks saving. */\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 edits that a save would write. */\n dirty: boolean\n /** Whether any staged draft is invalid, which blocks the save. */\n invalid: boolean\n /** Whether a save is crossing the wire. */\n saving: boolean\n /** Whether the last save did not land as staged; cleared by the next edit or save. */\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 /** Stage draft text for one field. */\n edit: (field: string, text: string) => void\n /** Stage a clear, so saving lets the field re-inherit the composition layer. */\n resetField: (field: string) => void\n /** Write every staged edit, then re-seed from what the Host accepted. */\n save: () => void\n /** Drop every staged edit. */\n discard: () => void\n}\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 blocks the save. */\nexport function numberField(field: string, constraints: NumberConstraints = {}): FieldSpec {\n const { integer = false, min } = constraints\n return {\n field,\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/** A free-text field. An empty draft clears the field. */\nexport function textField(field: string): FieldSpec {\n return {\n field,\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 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 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 * Stages one card's edits over one settings namespace and writes them on save.\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 save that did not\n * land keeps its drafts, so the user can correct them instead 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 private saving = 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 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 a save would do. */\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: () => { void this.save() },\n discard: () => {\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 * Write every staged edit in one atomic form mutation, then re-seed from\n * what the Host accepted.\n *\n * The whole batch rides one mutate, so cross-field validate hooks\n * (baseURL+model) judge it as a unit: the Host either applies every write\n * or refuses the batch. The form contract answers a refusal or a skipped\n * write with `false` (it recovers with a fresh Host view instead of\n * throwing), so the outcome is judged twice: the answer itself, and then the\n * settled snapshot read back one planned write at a time. One missed write\n * fails the whole save. A transport that rejects instead (the dsh-web bridge\n * controller on a dead connection) reports through the same failure path\n * with its rejection message. A save that did not land keeps its drafts, so\n * the user can correct them instead of retyping.\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 (plan.length === 0 || this.saving || valid.length !== plan.length) return\n // Snapshot the staged entries this save writes, so an edit staged while it\n // is in flight (which replaces the same key) survives: only delete the key\n // when the entry is still the one this save started from.\n const pending = new Map<string, StagedEdit | undefined>()\n for (const item of plan) 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 (landed && this.staged.get(field) === before) 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 save would write. An entry whose draft is not a value\n * its field accepts carries no write: the form is still dirty, and the save\n * refuses rather than dropping the edit. 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 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 }\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 and the wire presentation. Registers\n * into the `web-ui.plugin.item` child slot the Web UI plugin group renders,\n * bound to the `liangshen` settings namespace (the Host profile entry id).\n *\n * The presentation field does not act on this client half: the Host applies it\n * to the preset it declares to the agent-preset registry, so a session reads it\n * from its preset. This card is the operator's only handle on it, which is why\n * 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 { BooleanField, ChoiceField, PluginSettingsCard, ValueField } from './PluginSettingsCard.tsx'\nimport { CardForm, booleanField, choiceField, numberField, 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', 'both'] as const\n\n/** Sensitivity presets for the circuit breaker (mirrors the Host schema). */\nexport const SENSITIVITY_CHOICES = ['conservative', 'balanced', 'aggressive'] 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 /** Master switch for the runtime degeneration circuit breaker. */\n guardEnabled?: boolean\n /** Sensitivity preset scaling the breaker's adaptive thresholds. */\n guardSensitivity?: string\n /** Per-step reasoning-character floor for the breaker's runaway ladder. */\n guardStallReasoningChars?: number\n /** Consecutive output-free reasoning steps for the breaker's slow-burn ladder. */\n guardGlobalStallCap?: number\n /** Identical-argument tool failures for the breaker's echo ladder. */\n guardEchoFailures?: number\n}\n\n/** What the LiangShen card renders. */\nexport interface LiangShenSettingsCardState extends CardShell {\n enabled: CardFieldState\n announceToAgent: CardFieldState\n presentation: CardFieldState\n guardEnabled: CardFieldState\n guardSensitivity: CardFieldState\n guardStallReasoningChars: CardFieldState\n guardGlobalStallCap: CardFieldState\n guardEchoFailures: 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('guardEnabled'),\n choiceField('guardSensitivity', SENSITIVITY_CHOICES),\n numberField('guardStallReasoningChars', { integer: true, min: 200 }),\n numberField('guardGlobalStallCap', { integer: true, min: 2 }),\n numberField('guardEchoFailures', { integer: true, min: 2 }),\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 guardEnabled: this.form.field('guardEnabled'),\n guardSensitivity: this.form.field('guardSensitivity'),\n guardStallReasoningChars: this.form.field('guardStallReasoningChars'),\n guardGlobalStallCap: this.form.field('guardGlobalStallCap'),\n guardEchoFailures: this.form.field('guardEchoFailures'),\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 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 {...fieldProps}\n {...state.presentation}\n onEdit={(text) => { props.edit('presentation', text) }}\n onReset={() => { props.resetField('presentation') }}\n />\n <BooleanField\n id=\"settings-liangshen-guard-enabled\"\n label={t('settings.guardEnabled')}\n hint={t('settings.guardEnabledHint')}\n onLabel={t('settings.on')}\n offLabel={t('settings.off')}\n {...fieldProps}\n {...state.guardEnabled}\n onEdit={(text) => { props.edit('guardEnabled', text) }}\n onReset={() => { props.resetField('guardEnabled') }}\n />\n <ChoiceField\n id=\"settings-liangshen-guard-sensitivity\"\n label={t('settings.guardSensitivity')}\n hint={t('settings.guardSensitivityHint')}\n choices={SENSITIVITY_CHOICES.map(choice => ({ value: choice, label: t(`sensitivity.${choice}`) }))}\n {...fieldProps}\n {...state.guardSensitivity}\n onEdit={(text) => { props.edit('guardSensitivity', text) }}\n onReset={() => { props.resetField('guardSensitivity') }}\n />\n <ValueField\n id=\"settings-liangshen-guard-stall-chars\"\n numeric\n label={t('settings.guardStallChars')}\n hint={t('settings.guardStallCharsHint')}\n placeholder=\"8000\"\n {...fieldProps}\n {...state.guardStallReasoningChars}\n onEdit={(text) => { props.edit('guardStallReasoningChars', text) }}\n onReset={() => { props.resetField('guardStallReasoningChars') }}\n />\n <ValueField\n id=\"settings-liangshen-guard-global-cap\"\n numeric\n label={t('settings.guardGlobalCap')}\n hint={t('settings.guardGlobalCapHint')}\n placeholder=\"4\"\n {...fieldProps}\n {...state.guardGlobalStallCap}\n onEdit={(text) => { props.edit('guardGlobalStallCap', text) }}\n onReset={() => { props.resetField('guardGlobalStallCap') }}\n />\n <ValueField\n id=\"settings-liangshen-guard-echo\"\n numeric\n label={t('settings.guardEchoFailures')}\n hint={t('settings.guardEchoFailuresHint')}\n placeholder=\"3\"\n {...fieldProps}\n {...state.guardEchoFailures}\n onEdit={(text) => { props.edit('guardEchoFailures', text) }}\n onReset={() => { props.resetField('guardEchoFailures') }}\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': '关闭后不声明预设、也不发 agent 公告。',\n 'settings.announceToAgent': '向 agent 公告本插件',\n 'settings.announceToAgentHint': '开启后向每一轮 agent 系统提示注入本插件公告;默认关闭以保持提示词干净。',\n 'settings.presentation': '工具面呈现方式',\n 'settings.presentationHint': '写入本插件声明的预设的 tool-catalog 行:both(出厂默认)让原生清单与 run_code 同驻(原生直调优先);native 保持原生工具清单;ptc 把 wire 收拢为 run_code。改动立即生效,但已开始的会话保持其已声明的组合。',\n 'settings.on': '开',\n 'settings.off': '关',\n 'settings.inherit': '继承(跟随部署默认)',\n 'settings.overridden': '已覆盖',\n 'settings.reset': '重置',\n 'settings.notExposed': '当前 DSH 版本未向设置页暴露本插件的配置命名空间,表单不可用。可编辑 ~/.dsh/settings.yaml 直接配置,或将本命名空间加入 Host 设置白名单后重启。',\n 'settings.readOnly': '当前部署的设置只读。',\n 'settings.expand': '展开设置',\n 'settings.collapse': '收起设置',\n 'settings.save': '保存',\n 'settings.saving': '保存中…',\n 'settings.discard': '放弃',\n 'settings.unsaved': '未保存',\n 'settings.saveFailed': '部署未接受这些值,已保留供你修改。',\n 'settings.invalidValue': '该取值不被接受',\n 'presentation.ptc': 'ptc(仅 run_code)',\n 'presentation.native': 'native(原生工具清单)',\n 'presentation.both': 'both(两者同驻)',\n 'settings.guardEnabled': '启用退化熔断器',\n 'settings.guardEnabledHint': '运行时检测思考退化(连续零产出长思考 / 同参重复失败),触发时注入熔断提示并临时下调推理档位。关闭后不干预任何请求。',\n 'settings.guardStallChars': '单步暴走字符阈值',\n 'settings.guardStallCharsHint': '单条推理达到该字符数且零产出即触发熔断(按 V4.1 官方 384K 最大输出校准;默认 8000,约 2-4K 思考 token)。',\n 'settings.guardGlobalCap': '慢烧连续步数',\n 'settings.guardGlobalCapHint': '连续多少步有真实推理但零产出触发慢烧熔断(默认 4;步数越小越敏感,真实长调查建议调大)。',\n 'settings.guardSensitivity': '熔断灵敏度',\n 'settings.guardSensitivityHint': '整体缩放熔断阈值:保守(更少打断,阈值×1.5)、均衡(出厂校准值)、激进(更早触发,阈值×0.5)。阈值随推理档位自适应:max 档 8000 / high 档 12000 / low 档 20000 字符。',\n 'sensitivity.conservative': '保守(少打断)',\n 'sensitivity.balanced': '均衡(默认)',\n 'sensitivity.aggressive': '激进(早触发)',\n 'settings.guardEchoFailures': '同参连续失败次数',\n 'settings.guardEchoFailuresHint': '同一工具以相同参数连续失败多少次触发空转熔断(默认 3)。',\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': 'Controls this plugin and the wire presentation.',\n 'settings.enabled': 'Enable LiangShen mode',\n 'settings.enabledHint': 'When off, the preset is not declared and the agent announcement does not run.',\n 'settings.announceToAgent': 'Announce this plugin to agents',\n 'settings.announceToAgentHint': 'Adds this plugin announcement to every agent system prompt; off by default so prompts stay clean.',\n 'settings.presentation': 'Wire presentation',\n 'settings.presentationHint': 'Written into the tool-catalog row of the preset this plugin declares: both (the shipped default) keeps the roster and run_code co-resident (direct native calls first); native keeps the native roster; ptc collapses the wire to run_code. A change re-declares the preset immediately; sessions that already started keep the composition they declared.',\n 'settings.on': 'On',\n 'settings.off': 'Off',\n 'settings.inherit': 'Inherit (deployment default)',\n 'settings.overridden': 'Overridden',\n 'settings.reset': 'Reset',\n 'settings.notExposed': \"This DSH version does not expose this plugin's settings namespace to the configuration page, so the form is unavailable. Edit ~/.dsh/settings.yaml directly, or add the namespace to the Host settings allowlist and restart.\",\n 'settings.readOnly': 'This deployment serves settings read-only.',\n 'settings.expand': 'Show settings',\n 'settings.collapse': 'Hide settings',\n 'settings.save': 'Save',\n 'settings.saving': 'Saving…',\n 'settings.discard': 'Discard',\n 'settings.unsaved': 'Unsaved',\n 'settings.saveFailed': 'The deployment did not accept these values; they were left for you to correct.',\n 'settings.invalidValue': 'The value is not accepted',\n 'presentation.ptc': 'ptc (run_code only)',\n 'presentation.native': 'native (native tool roster)',\n 'presentation.both': 'both (both co-resident)',\n 'settings.guardEnabled': 'Degeneration circuit breaker',\n 'settings.guardEnabledHint': 'Detects reasoning degeneration at runtime (consecutive zero-output long reasoning / repeated identical-argument failures), injecting a breaker message and stepping the reasoning effort down when it fires. Disabled means requests are never touched.',\n 'settings.guardStallChars': 'Runaway reasoning character floor',\n 'settings.guardStallCharsHint': 'One reasoning block reaching this many characters with no output fires the breaker (calibrated against V4.1\\'s official 384K max output; default 8000, roughly 2-4K thinking tokens).',\n 'settings.guardGlobalCap': 'Slow-burn step count',\n 'settings.guardGlobalCapHint': 'Consecutive output-free steps of real reasoning that fire the slow-burn ladder (default 4; lower is more sensitive — raise it for genuinely long investigations).',\n 'settings.guardSensitivity': 'Breaker sensitivity',\n 'settings.guardSensitivityHint': 'Scales every breaker threshold: conservative (fewer interruptions, x1.5), balanced (the calibrated defaults), aggressive (fires earlier, x0.5). Thresholds adapt to the reasoning effort: 8000 at max / 12000 at high / 20000 at low.',\n 'sensitivity.conservative': 'Conservative (fewer interruptions)',\n 'sensitivity.balanced': 'Balanced (default)',\n 'sensitivity.aggressive': 'Aggressive (fires earlier)',\n 'settings.guardEchoFailures': 'Identical-argument failures',\n 'settings.guardEchoFailuresHint': 'Identical-argument failures of the same tool in a row that fire the echo ladder (default 3).',\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}\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: string, listener: (...args: never[]) => void): 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 /** 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 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.inject === undefined ? {} : { inject }),\n }\n : {\n name: OFFICIAL_PLUGIN_CARD_SEAT,\n key: seat.bundle,\n locale: seat.locale,\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', () => { reconcile() })\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","/**\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'\n\n/** Locale namespace this half owns. */\nexport const NS = 'liangshen'\n\n/**\n * Settings namespace the settings card edits. Under the 0.1.7 settings\n * contract the namespace IS the Host profile entry id, so this names the\n * standalone row; the aggregate install mounts the generated\n * `web-ui-liangshen` row instead and the family binder resolves between the\n * two. Without that binder the card binds the entry id directly.\n */\nexport const SETTINGS_NAMESPACE = 'liangshen'\nconst AGGREGATE_ENTRY_ID = 'web-ui-liangshen'\nconst LIANGSHEN_ENTRY_IDS: readonly string[] = [AGGREGATE_ENTRY_ID, 'ui-liangshen', SETTINGS_NAMESPACE]\n\nfunction 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 served = undefined\n }\n if (!served || served.length === 0) return SETTINGS_NAMESPACE\n return LIANGSHEN_ENTRY_IDS.find(id => served.includes(id)) ?? SETTINGS_NAMESPACE\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 // The family binder resolves the family namespace onto this row's profile\n // entry id and binds the native shared form; a deployment without the group\n // plugin addresses the entry id directly (the standalone bundle row id).\n const binder = ctx.get('webUiSettings')\n const settingsForm = binder !== undefined && typeof binder.bind === 'function'\n ? binder.bind<LiangShenSettings>({ namespace: SETTINGS_NAMESPACE })\n : ctx.configForms.get<LiangShenSettings>(servedEntryId(ctx.configForms))\n const settingsCard = new LiangShenSettingsCardController(settingsForm)\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,O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GAElC,MAAM,aAAa,IAAI,gBAAgB,GAAG;GAC1C,IAAI,mBAAmB,WAAW,QAAQ,GAAG,6BAA6B;GAC1E,IAAI;IACF,WAAW,MAAM;GACnB,QAAQ,CAGR;GAKA,IAAI;IAIF,MAAM,SAAS,IAAI,IAAI,eAAe;IAItC,MAAM,eAAe,IAAI,gCAHJ,WAAW,KAAA,KAAa,OAAO,OAAO,SAAS,aAChE,OAAO,KAAwB,EAAE,WAAW,mBAAmB,CAAC,IAChE,IAAI,YAAY,IAAuB,cAAc,IAAI,WAAW,CAAC,CACJ;IAGrE,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"],"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/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","// 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 save\n * that writes them. 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\nimport { useCallback, useEffect, useLayoutEffect, useRef, useState, type KeyboardEvent, type ReactNode } from 'react'\nimport type { CardShell } from './settings-form.ts'\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.unsaved',\n 'settings.readOnly',\n 'settings.saveFailed',\n 'settings.discard',\n 'settings.save',\n 'settings.saving',\n] as const\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 /** The card's form state: availability, writability, and what a save would do. */\n state: CardShell\n /** Write every staged edit. */\n onSave: () => void\n /** Drop every staged edit. */\n onDiscard: () => void\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 save/discard footer: cards whose body applies its own changes\n * immediately (an embedded external settings section) have no staged\n * edits, so the footer would sit there permanently disabled.\n */\n hideFooter?: boolean\n /** Render children even when the settings namespace is not exposed by the host. */\n renderChildrenWhenNotExposed?: boolean\n /** Hide the 'not exposed' warning banner when the settings namespace is not exposed. */\n hideNotExposedNotice?: boolean\n /** The plugin's controls. */\n children: ReactNode\n}\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 if (!state.available) return null\n const title = props.t(props.titleKey)\n const description = props.t(props.descriptionKey)\n const blocked = !state.dirty || state.invalid || state.saving\n const expanded = alwaysOpen === true || open\n const cardClass = expanded ? `${css.cardOpen} ${css.card}` : css.card\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 <span className={css.headText}>\n <span className={css.name} title={title}>{title}</span>\n <span className={css.description} title={description}>{props.descriptionNode ?? description}</span>\n </span>\n {state.dirty ? <span className={css.pending} title={props.t('settings.unsaved')}>{props.t('settings.unsaved')}</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 <span className={css.headText}>\n <span className={css.name} title={title}>{title}</span>\n <span className={css.description} title={description}>{props.descriptionNode ?? description}</span>\n </span>\n {state.dirty ? <span className={css.pending} title={props.t('settings.unsaved')}>{props.t('settings.unsaved')}</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.\n if (!state.exposed && props.renderChildrenWhenNotExposed !== true) {\n const showNotice = props.hideNotExposedNotice !== true\n return (\n <li className={cardClass}>\n {header}\n {expanded\n ? (\n <div className={css.body}>\n {showNotice ? <p className={css.notExposed} role=\"status\">{props.t('settings.notExposed')}</p> : null}\n </div>\n )\n : null}\n </li>\n )\n }\n return (\n <li className={cardClass}>\n {header}\n {expanded\n ? (\n <div className={css.body}>\n {!state.writable ? <p className={css.readOnly} role=\"status\">{props.t('settings.readOnly')}</p> : null}\n {props.children}\n {props.hideFooter === true\n ? null\n : (\n <div className={css.footer}>\n {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 <button\n type=\"button\"\n className={css.discard}\n disabled={!state.dirty || state.saving}\n onClick={props.onDiscard}\n >\n {props.t('settings.discard')}\n </button>\n <button\n type=\"button\"\n className={css.save}\n disabled={blocked}\n onClick={props.onSave}\n >\n {props.t(!state.saving ? 'settings.save' : 'settings.saving')}\n </button>\n </div>\n )}\n </div>\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 /** Draft text this control renders. */\n text: string\n /** True when saving would leave a user-layer entry for this field. */\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 /** Stage draft text. */\n onEdit: (text: string) => void\n /** Stage a clear so the field re-inherits the composition layer. */\n onReset: () => void\n}\n\n/** A staged value field. `numeric` only hints the keypad: which drafts a field accepts is decided by its spec. */\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}) {\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 <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 />\n <p className={props.invalid ? css.invalid : css.hint}>\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 * Staged cards reach it through BooleanField/ChoiceField; immediate-apply\n * editors (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/** A staged 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}) {\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 <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 <p className={css.hint}>{props.hint}</p>\n </div>\n )\n}\n\n/** A staged enumerated field rendered as a select. */\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 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 <SelectField\n id={props.id}\n options={[{ value: '', label: props.inheritLabel }, ...props.choices]}\n value={props.text}\n disabled={props.disabled}\n invalid={props.invalid}\n onEdit={props.onEdit}\n />\n <p className={props.invalid ? css.invalid : css.hint}>\n {props.invalid ? props.invalidLabel : props.hint}\n </p>\n </div>\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 * Staged form model behind the plugin settings card. A card stages what the\n * user types and writes it only when they save — the settings write is a\n * durable, revision-fenced document mutation, so staging keeps what is on\n * screen exactly what a save would store. Family-shared slice inlined into\n * each plugin's client bundle; mirrors the official ui-plugin-config\n * card-store pattern.\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 staged text performs when the card is saved. */\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 * 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 stages, or undefined when the text is not a\n * value this field accepts — which blocks the save rather than 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 saving would leave a user-layer entry for this field. */\n overridden: boolean\n /** Whether the draft is not a value this field accepts, which blocks saving. */\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 edits that a save would write. */\n dirty: boolean\n /** Whether any staged draft is invalid, which blocks the save. */\n invalid: boolean\n /** Whether a save is crossing the wire. */\n saving: boolean\n /** Whether the last save did not land as staged; cleared by the next edit or save. */\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 /** Stage draft text for one field. */\n edit: (field: string, text: string) => void\n /** Stage a clear, so saving lets the field re-inherit the composition layer. */\n resetField: (field: string) => void\n /** Write every staged edit, then re-seed from what the Host accepted. */\n save: () => void\n /** Drop every staged edit. */\n discard: () => void\n}\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 blocks the save. */\nexport function numberField(field: string, constraints: NumberConstraints = {}): FieldSpec {\n const { integer = false, min } = constraints\n return {\n field,\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/** A free-text field. An empty draft clears the field. */\nexport function textField(field: string): FieldSpec {\n return {\n field,\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 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 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 * Stages one card's edits over one settings namespace and writes them on save.\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 save that did not\n * land keeps its drafts, so the user can correct them instead 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 private saving = 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 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 a save would do. */\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: () => { void this.save() },\n discard: () => {\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 * Write every staged edit in one atomic form mutation, then re-seed from\n * what the Host accepted.\n *\n * The whole batch rides one mutate, so cross-field validate hooks\n * (baseURL+model) judge it as a unit: the Host either applies every write\n * or refuses the batch. The form contract answers a refusal or a skipped\n * write with `false` (it recovers with a fresh Host view instead of\n * throwing), so the outcome is judged twice: the answer itself, and then the\n * settled snapshot read back one planned write at a time. One missed write\n * fails the whole save. A transport that rejects instead (the dsh-web bridge\n * controller on a dead connection) reports through the same failure path\n * with its rejection message. A save that did not land keeps its drafts, so\n * the user can correct them instead of retyping.\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 (plan.length === 0 || this.saving || valid.length !== plan.length) return\n // Snapshot the staged entries this save writes, so an edit staged while it\n // is in flight (which replaces the same key) survives: only delete the key\n // when the entry is still the one this save started from.\n const pending = new Map<string, StagedEdit | undefined>()\n for (const item of plan) 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 (landed && this.staged.get(field) === before) 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 save would write. An entry whose draft is not a value\n * its field accepts carries no write: the form is still dirty, and the save\n * refuses rather than dropping the edit. 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 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 }\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 and the wire presentation. Registers\n * into the `web-ui.plugin.item` child slot the Web UI plugin group renders,\n * bound to the `liangshen` settings namespace (the Host profile entry id).\n *\n * The presentation field does not act on this client half: the Host applies it\n * to the preset it declares to the agent-preset registry, so a session reads it\n * from its preset. This card is the operator's only handle on it, which is why\n * 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 { BooleanField, ChoiceField, PluginSettingsCard, ValueField } from './PluginSettingsCard.tsx'\nimport { CardForm, booleanField, choiceField, numberField, 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', 'both'] as const\n\n/** Sensitivity presets for the circuit breaker (mirrors the Host schema). */\nexport const SENSITIVITY_CHOICES = ['conservative', 'balanced', 'aggressive'] 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 /** Master switch for the runtime degeneration circuit breaker. */\n guardEnabled?: boolean\n /** Sensitivity preset scaling the breaker's adaptive thresholds. */\n guardSensitivity?: string\n /** Per-step reasoning-character floor for the breaker's runaway ladder. */\n guardStallReasoningChars?: number\n /** Consecutive output-free reasoning steps for the breaker's slow-burn ladder. */\n guardGlobalStallCap?: number\n /** Identical-argument tool failures for the breaker's echo ladder. */\n guardEchoFailures?: number\n}\n\n/** What the LiangShen card renders. */\nexport interface LiangShenSettingsCardState extends CardShell {\n enabled: CardFieldState\n announceToAgent: CardFieldState\n presentation: CardFieldState\n guardEnabled: CardFieldState\n guardSensitivity: CardFieldState\n guardStallReasoningChars: CardFieldState\n guardGlobalStallCap: CardFieldState\n guardEchoFailures: 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('guardEnabled'),\n choiceField('guardSensitivity', SENSITIVITY_CHOICES),\n numberField('guardStallReasoningChars', { integer: true, min: 200 }),\n numberField('guardGlobalStallCap', { integer: true, min: 2 }),\n numberField('guardEchoFailures', { integer: true, min: 2 }),\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 guardEnabled: this.form.field('guardEnabled'),\n guardSensitivity: this.form.field('guardSensitivity'),\n guardStallReasoningChars: this.form.field('guardStallReasoningChars'),\n guardGlobalStallCap: this.form.field('guardGlobalStallCap'),\n guardEchoFailures: this.form.field('guardEchoFailures'),\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 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 {...fieldProps}\n {...state.presentation}\n onEdit={(text) => { props.edit('presentation', text) }}\n onReset={() => { props.resetField('presentation') }}\n />\n <BooleanField\n id=\"settings-liangshen-guard-enabled\"\n label={t('settings.guardEnabled')}\n hint={t('settings.guardEnabledHint')}\n onLabel={t('settings.on')}\n offLabel={t('settings.off')}\n {...fieldProps}\n {...state.guardEnabled}\n onEdit={(text) => { props.edit('guardEnabled', text) }}\n onReset={() => { props.resetField('guardEnabled') }}\n />\n <ChoiceField\n id=\"settings-liangshen-guard-sensitivity\"\n label={t('settings.guardSensitivity')}\n hint={t('settings.guardSensitivityHint')}\n choices={SENSITIVITY_CHOICES.map(choice => ({ value: choice, label: t(`sensitivity.${choice}`) }))}\n {...fieldProps}\n {...state.guardSensitivity}\n onEdit={(text) => { props.edit('guardSensitivity', text) }}\n onReset={() => { props.resetField('guardSensitivity') }}\n />\n <ValueField\n id=\"settings-liangshen-guard-stall-chars\"\n numeric\n label={t('settings.guardStallChars')}\n hint={t('settings.guardStallCharsHint')}\n placeholder=\"8000\"\n {...fieldProps}\n {...state.guardStallReasoningChars}\n onEdit={(text) => { props.edit('guardStallReasoningChars', text) }}\n onReset={() => { props.resetField('guardStallReasoningChars') }}\n />\n <ValueField\n id=\"settings-liangshen-guard-global-cap\"\n numeric\n label={t('settings.guardGlobalCap')}\n hint={t('settings.guardGlobalCapHint')}\n placeholder=\"4\"\n {...fieldProps}\n {...state.guardGlobalStallCap}\n onEdit={(text) => { props.edit('guardGlobalStallCap', text) }}\n onReset={() => { props.resetField('guardGlobalStallCap') }}\n />\n <ValueField\n id=\"settings-liangshen-guard-echo\"\n numeric\n label={t('settings.guardEchoFailures')}\n hint={t('settings.guardEchoFailuresHint')}\n placeholder=\"3\"\n {...fieldProps}\n {...state.guardEchoFailures}\n onEdit={(text) => { props.edit('guardEchoFailures', text) }}\n onReset={() => { props.resetField('guardEchoFailures') }}\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': '关闭后不声明预设、也不发 agent 公告。',\n 'settings.announceToAgent': '向 agent 公告本插件',\n 'settings.announceToAgentHint': '开启后向每一轮 agent 系统提示注入本插件公告;默认关闭以保持提示词干净。',\n 'settings.presentation': '工具面呈现方式',\n 'settings.presentationHint': '写入本插件声明的预设的 tool-catalog 行:both(出厂默认)让原生清单与 run_code 同驻(原生直调优先);native 保持原生工具清单;ptc 把 wire 收拢为 run_code。改动立即生效,但已开始的会话保持其已声明的组合。',\n 'settings.on': '开',\n 'settings.off': '关',\n 'settings.inherit': '继承(跟随部署默认)',\n 'settings.overridden': '已覆盖',\n 'settings.reset': '重置',\n 'settings.notExposed': '当前 DSH 版本未向设置页暴露本插件的配置命名空间,表单不可用。可编辑 ~/.dsh/settings.yaml 直接配置,或将本命名空间加入 Host 设置白名单后重启。',\n 'settings.readOnly': '当前部署的设置只读。',\n 'settings.expand': '展开设置',\n 'settings.collapse': '收起设置',\n 'settings.save': '保存',\n 'settings.saving': '保存中…',\n 'settings.discard': '放弃',\n 'settings.unsaved': '未保存',\n 'settings.saveFailed': '部署未接受这些值,已保留供你修改。',\n 'settings.invalidValue': '该取值不被接受',\n 'presentation.ptc': 'ptc(仅 run_code)',\n 'presentation.native': 'native(原生工具清单)',\n 'presentation.both': 'both(两者同驻)',\n 'settings.guardEnabled': '启用退化熔断器',\n 'settings.guardEnabledHint': '运行时检测思考退化(连续零产出长思考 / 同参重复失败),触发时注入熔断提示并临时下调推理档位。关闭后不干预任何请求。',\n 'settings.guardStallChars': '单步暴走字符阈值',\n 'settings.guardStallCharsHint': '单条推理达到该字符数且零产出即触发熔断(按 V4.1 官方 384K 最大输出校准;默认 8000,约 2-4K 思考 token)。',\n 'settings.guardGlobalCap': '慢烧连续步数',\n 'settings.guardGlobalCapHint': '连续多少步有真实推理但零产出触发慢烧熔断(默认 4;步数越小越敏感,真实长调查建议调大)。',\n 'settings.guardSensitivity': '熔断灵敏度',\n 'settings.guardSensitivityHint': '整体缩放熔断阈值:保守(更少打断,阈值×1.5)、均衡(出厂校准值)、激进(更早触发,阈值×0.5)。阈值随推理档位自适应:max 档 8000 / high 档 12000 / low 档 20000 字符。',\n 'sensitivity.conservative': '保守(少打断)',\n 'sensitivity.balanced': '均衡(默认)',\n 'sensitivity.aggressive': '激进(早触发)',\n 'settings.guardEchoFailures': '同参连续失败次数',\n 'settings.guardEchoFailuresHint': '同一工具以相同参数连续失败多少次触发空转熔断(默认 3)。',\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': 'Controls this plugin and the wire presentation.',\n 'settings.enabled': 'Enable LiangShen mode',\n 'settings.enabledHint': 'When off, the preset is not declared and the agent announcement does not run.',\n 'settings.announceToAgent': 'Announce this plugin to agents',\n 'settings.announceToAgentHint': 'Adds this plugin announcement to every agent system prompt; off by default so prompts stay clean.',\n 'settings.presentation': 'Wire presentation',\n 'settings.presentationHint': 'Written into the tool-catalog row of the preset this plugin declares: both (the shipped default) keeps the roster and run_code co-resident (direct native calls first); native keeps the native roster; ptc collapses the wire to run_code. A change re-declares the preset immediately; sessions that already started keep the composition they declared.',\n 'settings.on': 'On',\n 'settings.off': 'Off',\n 'settings.inherit': 'Inherit (deployment default)',\n 'settings.overridden': 'Overridden',\n 'settings.reset': 'Reset',\n 'settings.notExposed': \"This DSH version does not expose this plugin's settings namespace to the configuration page, so the form is unavailable. Edit ~/.dsh/settings.yaml directly, or add the namespace to the Host settings allowlist and restart.\",\n 'settings.readOnly': 'This deployment serves settings read-only.',\n 'settings.expand': 'Show settings',\n 'settings.collapse': 'Hide settings',\n 'settings.save': 'Save',\n 'settings.saving': 'Saving…',\n 'settings.discard': 'Discard',\n 'settings.unsaved': 'Unsaved',\n 'settings.saveFailed': 'The deployment did not accept these values; they were left for you to correct.',\n 'settings.invalidValue': 'The value is not accepted',\n 'presentation.ptc': 'ptc (run_code only)',\n 'presentation.native': 'native (native tool roster)',\n 'presentation.both': 'both (both co-resident)',\n 'settings.guardEnabled': 'Degeneration circuit breaker',\n 'settings.guardEnabledHint': 'Detects reasoning degeneration at runtime (consecutive zero-output long reasoning / repeated identical-argument failures), injecting a breaker message and stepping the reasoning effort down when it fires. Disabled means requests are never touched.',\n 'settings.guardStallChars': 'Runaway reasoning character floor',\n 'settings.guardStallCharsHint': 'One reasoning block reaching this many characters with no output fires the breaker (calibrated against V4.1\\'s official 384K max output; default 8000, roughly 2-4K thinking tokens).',\n 'settings.guardGlobalCap': 'Slow-burn step count',\n 'settings.guardGlobalCapHint': 'Consecutive output-free steps of real reasoning that fire the slow-burn ladder (default 4; lower is more sensitive — raise it for genuinely long investigations).',\n 'settings.guardSensitivity': 'Breaker sensitivity',\n 'settings.guardSensitivityHint': 'Scales every breaker threshold: conservative (fewer interruptions, x1.5), balanced (the calibrated defaults), aggressive (fires earlier, x0.5). Thresholds adapt to the reasoning effort: 8000 at max / 12000 at high / 20000 at low.',\n 'sensitivity.conservative': 'Conservative (fewer interruptions)',\n 'sensitivity.balanced': 'Balanced (default)',\n 'sensitivity.aggressive': 'Aggressive (fires earlier)',\n 'settings.guardEchoFailures': 'Identical-argument failures',\n 'settings.guardEchoFailuresHint': 'Identical-argument failures of the same tool in a row that fire the echo ladder (default 3).',\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}\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: string, listener: (...args: never[]) => void): 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 /** 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 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.inject === undefined ? {} : { inject }),\n }\n : {\n name: OFFICIAL_PLUGIN_CARD_SEAT,\n key: seat.bundle,\n locale: seat.locale,\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', () => { reconcile() })\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 mode: 'host',\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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