@klarkxy/dsh-git-commit 0.1.6 → 0.2.1
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.md +34 -4
- package/docs/README.zh-CN.md +28 -2
- package/lib/client.inner.cjs +395 -79
- package/lib/client.inner.cjs.map +1 -1
- package/lib/client.js +396 -241
- package/lib/contracts.d.ts +45 -12
- package/lib/contracts.js +1 -27
- package/lib/contracts.js.map +1 -1
- package/lib/index.d.ts +14 -5
- package/lib/index.js +294 -82
- package/lib/index.js.map +1 -1
- package/package.json +16 -9
package/lib/client.inner.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.inner.cjs","names":["useState","useRef","useAnchoredPosition","useCallback","Tooltip","Button","createPortal","IconRefreshOutlineRegular","Tag","useSyncExternalStore","Switch"],"sources":["../../dsh-plugin-kit/src/model-menu.ts","../../dsh-plugin-kit/src/official-ui.ts","../src/contracts.ts","../src/client.tsx"],"sourcesContent":["/**\n * Shared plugin-page model menu.\n *\n * A feature plugin's own settings row exposes a model select. An empty\n * selection means the host default chat model for that feature's own call.\n *\n * Browser-safe and React-optional: pure helpers live here so hosts and clients\n * share one catalog contract without bundling React into the host build.\n */\nimport { useEffect, useState } from 'react'\nimport type { ModelRoute } from './contracts.ts'\n\n/** One selectable model. `efforts` are the advertised reasoning efforts. */\nexport interface ModelMenuChoice {\n readonly provider: string\n readonly model: string\n readonly label: string\n readonly efforts: ReadonlyArray<{ id: string; name: string }>\n}\n\n/** The stored selection. Empty provider/model means \"follow the default\". */\nexport type ModelMenuRoute = ModelRoute\n\n/** The catalog face this helper needs; stays structural so hosts may add more. */\nexport interface ModelCatalogClient {\n readonly remote?: {\n readonly session?: { readonly modelCatalog?: () => Promise<unknown> }\n }\n}\n\nconst KEY_SEPARATOR = '\\u001f'\n\nexport function modelMenuChoiceKey(provider: string, model: string): string {\n return provider && model ? `${provider}${KEY_SEPARATOR}${model}` : ''\n}\n\nexport function parseModelMenuChoiceKey(value: string): { provider: string; model: string } | undefined {\n const index = value.indexOf(KEY_SEPARATOR)\n if (index <= 0) return undefined\n const provider = value.slice(0, index)\n const model = value.slice(index + KEY_SEPARATOR.length)\n if (!provider || !model) return undefined\n return { provider, model }\n}\n\nfunction asRecord(value: unknown): Record<string, unknown> | undefined {\n return value && typeof value === 'object' && !Array.isArray(value) ? value as Record<string, unknown> : undefined\n}\n\nfunction asText(value: unknown): string | undefined {\n return typeof value === 'string' && value.trim() ? value.trim() : undefined\n}\n\nfunction parseEffort(value: unknown): { id: string; name: string } | undefined {\n const row = asRecord(value)\n const id = row ? asText(row.id) : undefined\n if (!id) return undefined\n return { id, name: row ? asText(row.name) ?? id : id }\n}\n\n/** Parse the host session catalog into flat choices, keeping a saved route selectable. */\nexport function parseModelMenuChoices(value: unknown, bound?: ModelMenuRoute): ModelMenuChoice[] {\n const envelope = asRecord(value)\n // Host remote calls resolve to a result envelope ({ ok, value }); older hosts\n // and unit tests hand over the bare catalog. Accept both.\n const root = (envelope && envelope.ok === true ? asRecord(envelope.value) : undefined) ?? envelope ?? {}\n const groups = Array.isArray(root.groups) ? root.groups : []\n const choices: ModelMenuChoice[] = []\n for (const group of groups) {\n const groupRow = asRecord(group)\n const provider = groupRow ? asText(groupRow.id) : undefined\n if (!provider || !groupRow || !Array.isArray(groupRow.models)) continue\n const providerName = asText(groupRow.name) ?? provider\n for (const entry of groupRow.models) {\n const modelRow = asRecord(entry)\n const model = modelRow ? asText(modelRow.id) : undefined\n if (!model || !modelRow) continue\n const name = asText(modelRow.name) ?? model\n const reasoning = asRecord(modelRow.reasoning)\n const efforts = reasoning && Array.isArray(reasoning.efforts)\n ? reasoning.efforts.flatMap(effort => { const parsed = parseEffort(effort); return parsed ? [parsed] : [] })\n : []\n choices.push({ provider, model, label: `${providerName} / ${name}`, efforts })\n }\n }\n if (bound?.provider && bound.model && !choices.some(item => item.provider === bound.provider && item.model === bound.model)) {\n choices.push({ provider: bound.provider, model: bound.model, label: `${bound.provider} / ${bound.model}`, efforts: [] })\n }\n return choices\n}\n\n/** An empty saved route means no explicit model. */\nexport function modelMenuOverride(route: ModelMenuRoute | undefined): ModelRoute | undefined {\n const provider = route?.provider?.trim()\n const model = route?.model?.trim()\n if (!provider || !model) return undefined\n const effort = route?.reasoningEffort?.trim()\n return effort ? { provider, model, reasoningEffort: effort } : { provider, model }\n}\n\nexport function normalizeModelMenuRoute(value: unknown): ModelMenuRoute {\n const row = asRecord(value)\n if (!row) return { provider: '', model: '' }\n const provider = asText(row.provider) ?? ''\n const model = asText(row.model) ?? ''\n const effort = asText(row.reasoningEffort)\n if (!provider || !model || provider.length > 250 || model.length > 250) return { provider: '', model: '' }\n return effort && effort.length <= 80 ? { provider, model, reasoningEffort: effort } : { provider, model }\n}\n\n/** Load the host catalog once per mount and republish whenever it answers. */\nexport function useModelMenuChoices(client: ModelCatalogClient, bound?: ModelMenuRoute): ModelMenuChoice[] {\n const [choices, setChoices] = useState<ModelMenuChoice[]>([])\n useEffect(() => {\n if (typeof document === 'undefined') return\n let live = true\n const load = () => {\n void client.remote?.session?.modelCatalog?.()\n ?.then(value => { if (live) setChoices(parseModelMenuChoices(value, bound)) })\n .catch(() => { if (live) setChoices([]) })\n }\n load()\n return () => { live = false }\n }, [client, bound?.provider, bound?.model])\n return choices\n}\n\n/** Reasoning-effort options for one choice; the saved value stays selectable. */\nexport function modelMenuEffortOptions(\n choice: ModelMenuChoice | undefined,\n current?: string,\n): Array<{ id: string; name: string }> {\n const listed = (choice?.efforts ?? []).map(item => ({ ...item }))\n if (current && !listed.some(item => item.id === current)) listed.push({ id: current, name: current })\n return listed\n}\n","/**\n * Shared contract that keeps every plugin's browser-side UI on the official\n * DeepSeek Harness Web design language.\n *\n * Two rules produce that language, and both are load-bearing here:\n *\n * 1. Colour, radius, elevation and focus come from the host theme's real\n * `--dsw-*` tokens, written under their own names. Plugins never invent a\n * token, never alias the official ones behind a private palette (a private\n * alias is just a second, diverging theme), and never carries a literal\n * fallback — the host publishes light and dark, and a literal would pin one\n * of them. The only non-colour custom properties used are the host's own\n * content-font axis and frame clearance.\n *\n * 2. Anything the host already ships is used, not reimplemented. Controls come\n * from `@deepseek-ai/dsh-client-ui-primitives` (`Button`, `Input`,\n * `Checkbox`, `Switch`, `Tag`, `Pill`, `SegmentedControl`, `Menu`, `Modal`,\n * `Tooltip`, `Toast`, `DisclosureRow`, `StateDot`, `PathLabel`, the settings\n * form suite). This module only styles what primitives do not cover: page\n * scaffolding, field layout, banners, empty states and scroll regions.\n *\n * The metrics below are transcribed from the primitives' own CSS modules so a\n * feature panel lines up pixel-for-pixel with a native one: the 14/22 body and\n * 13/20 compact type tiers, the 0.5px hairline scale, and the elevation family\n * that draws a surface's edge in its shadow (`border: 0`) instead of a border.\n */\n\n/**\n * Every `--dsw-*` token this repo is allowed to reference, grouped by role.\n *\n * Plugins may only colour through this list. It is exported so the guard test\n * can fail a build when a stylesheet reaches for anything else — the failure\n * mode this prevents is silent: an unknown token resolves to nothing, so a\n * border disappears or a label inherits the wrong colour with no error anywhere.\n */\nexport const OFFICIAL_THEME_TOKENS = {\n /** Surfaces, from the page up to the topmost nested card. */\n surface: [\n '--dsw-alias-bg-base',\n '--dsw-alias-bg-layer-1',\n '--dsw-alias-bg-layer-2',\n '--dsw-alias-bg-layer-3',\n '--dsw-alias-bg-layer-4',\n '--dsw-alias-bg-module-platform',\n '--dsw-alias-bg-overlay',\n ],\n /** Hairlines. l1 is near-invisible on a menu surface, so menus use l2+. */\n border: ['--dsw-alias-border-l1', '--dsw-alias-border-l2', '--dsw-alias-border-l3', '--dsw-alias-border-l4'],\n /** Text. `caption` is menu shortcut text, `dimmed` is placeholder text. */\n label: [\n '--dsw-alias-label-primary',\n '--dsw-alias-label-secondary',\n '--dsw-alias-label-tertiary',\n '--dsw-alias-label-caption',\n '--dsw-alias-label-dimmed',\n '--dsw-alias-label-error',\n '--dsw-alias-label-primary-foreground',\n ],\n /** Interactive fills. The `-danger` hover belongs to destructive rows. */\n interactive: [\n '--dsw-alias-interactive-bg-hover',\n '--dsw-alias-interactive-bg-active',\n '--dsw-alias-interactive-bg-hover-danger',\n ],\n /** Accent and status. `business` is the focus ring's default colour. */\n accent: [\n '--dsw-alias-brand-primary',\n '--dsw-alias-button-primary-fill',\n '--dsw-alias-button-primary-hover',\n '--dsw-alias-button-tool-bar-fill',\n '--dsw-alias-button-tool-bar-hover',\n '--dsw-alias-button-ghost-active-fill',\n '--dsw-alias-button-ghost-active-border',\n ],\n state: [\n '--dsw-alias-state-business-primary',\n '--dsw-alias-state-success-primary',\n '--dsw-alias-state-warn-primary',\n '--dsw-alias-state-error-primary',\n '--dsw-alias-state-idle-primary',\n ],\n /** Corner scale: sm 8, md 12, lg the large card, panel the modal. */\n radius: ['--dsw-radius-sm', '--dsw-radius-md', '--dsw-radius-lg', '--dsw-radius-panel'],\n /** An elevated surface draws its edge in the shadow, so it keeps border: 0. */\n elevation: [\n '--dsw-elevation-soft',\n '--dsw-elevation-stroke',\n '--dsw-elevation-stroke-color',\n '--dsw-elevation-panel',\n '--dsw-elevation-prominent',\n ],\n /** Floats, masks and scrollbars. */\n overlay: [\n '--dsw-menu-surface-fill',\n '--dsw-menu-backdrop-filter',\n '--dsw-mask-blur',\n '--dsw-alias-bg-mask-1',\n '--dsw-alias-menu-icon',\n '--dsw-alias-scrollbar-bg-l2',\n '--dsw-alias-scrollbar-hover-l2',\n '--dsw-shadow-lv3',\n ],\n /** Motion, focus and type axis, published by the host rather than by a component. */\n system: [\n '--dsw-focus-ring-width',\n '--dsw-focus-ring-color',\n '--dsw-font-markdown-code-font-family',\n '--ds-transition-duration',\n '--ds-ease-in-out',\n '--ds-font-family-code',\n '--dsh-scrollbar-thumb',\n '--dsh-scrollbar-thumb-hover',\n '--dsh-content-font-size-secondary',\n '--dsh-content-font-delta',\n '--dsh-frame-top-clearance',\n ],\n} as const\n\n/** Every official token name, flat. Used by the token guard test. */\nexport const OFFICIAL_THEME_TOKEN_NAMES: readonly string[] = Object.values(OFFICIAL_THEME_TOKENS).flat()\n\n/** The elevation steps a surface can be raised by, softest first. */\nexport type OfficialElevation = 'soft' | 'stroke' | 'panel' | 'prominent'\n\n/**\n * The host's focus ring shorthand, verbatim. Writing this per control is how\n * rings drift apart; a stylesheet that draws its own focus style should use\n * {@link officialFocus} instead. The colour fallback is the host's own default.\n */\nexport const OFFICIAL_FOCUS_RING =\n 'var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary))'\n\n/**\n * A complete `outline` declaration at the official geometry. `offset` defaults\n * to the 2px the native controls use; the host's inline field rules sit at 1px\n * and a segmented tab pulls the ring inside itself at -2px.\n */\nexport function officialFocus(offset = '2px'): string {\n return `outline: ${OFFICIAL_FOCUS_RING}; outline-offset: ${offset}`\n}\n\n/**\n * An elevated surface. The host draws a raised surface's edge inside its\n * shadow rather than as a border, so a card sets `border: 0` and takes the edge\n * from the elevation — which is also why its border stays off the alias-border\n * set that a flat, non-elevated rule would use.\n */\nexport function officialElevation(level: OfficialElevation): string {\n return `border: 0; box-shadow: var(--dsw-elevation-${level})`\n}\n\n/**\n * An elevated surface whose edge should read as a specific hairline. Rebinding\n * the stroke colour is how a menu card picks l1 while a panel picks l3, without\n * the two growing apart by hand.\n */\nexport function officialStrokedElevation(level: OfficialElevation, color: string): string {\n return `--dsw-elevation-stroke-color: ${color}; ${officialElevation(level)}`\n}\n\n/**\n * The shared stylesheet for a plugin UI, scoped under that plugin's root class.\n *\n * Scoping is what keeps this safe to always-bundle into every client: the rules\n * can only match inside the plugin's own subtree, so two plugins can both mount\n * `dsh-ui-card` without either styling the other's markup.\n *\n * Each recipe matches the root element *and* its descendants, because the\n * commonest arrangement is one element that is both — a surface that carries\n * the root class and `dsh-ui-card`, or a portaled dialog that is the root and\n * the `dsh-ui-surface`. A descendant-only scope would silently leave those\n * unstyled, with no error anywhere.\n *\n * A caveat worth knowing: `Modal` and `Menu` portal to `document.body`, so their\n * content leaves the plugin's subtree entirely. A portaled surface therefore\n * needs its own root class on an element inside the portal.\n *\n * Only patterns that primitives do not provide live here. If a control appears\n * below that `Button`/`Input`/`Switch`/`Tag`/`Menu` already covers, that is a\n * bug in this file: use the primitive and delete the recipe.\n */\nexport function officialUiCss(roots: string | readonly string[]): string {\n // One plugin often mounts several unrelated surfaces (a settings seat, a chat\n // card, a header menu), so the caller names every root. The rules below are\n // nested under a single selector list and use `&`, which the browser expands\n // per root — so one stylesheet covers all of them without duplicating itself.\n const scope = (typeof roots === 'string' ? [roots] : roots).map(root => `.${root}`).join(', ')\n const sheet = `\n/* Official DSH Web UI contract. Generated by @klarkxy/dsh-plugin-kit/official-ui.\n * Do not hand-edit the copy inside a plugin: change this module so every plugin\n * moves together. Scope: ${scope} */\n/* The scope rule below stays open for the whole sheet: every rule after it\n * nests with the parent selector, so one stylesheet can cover several unrelated\n * roots without leaking into a neighbouring plugin. Its closing brace is last. */\n${scope} {\n color: var(--dsw-alias-label-primary);\n font-family: inherit;\n font-size: 14px;\n line-height: 22px;\n min-width: 0;\n\n& *, & *::before, & *::after { box-sizing: border-box; }\n& h1, & h2, & h3, & h4, & p, & figure { margin: 0; }\n/* Keyboard focus only: pointer input keeps the native resting appearance. The\n * ring needs no radius of its own — the outline already follows the control's\n * own border-radius, and overriding it here would flatten every control. */\n& :focus-visible { ${officialFocus()}; }\n& [hidden] { display: none !important; }\n\n/* --- Type tiers. The same 14/22 and 13/20 steps the primitives use. --- */\n& .dsh-ui-title { font-size: 16px; line-height: 24px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n& .dsh-ui-heading { font-size: 14px; line-height: 22px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n& .dsh-ui-compact { font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-primary); }\n& .dsh-ui-meta { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); }\n& .dsh-ui-hint { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }\n& .dsh-ui-error { font-size: 12px; line-height: 18px; color: var(--dsw-alias-state-error-primary); }\n& .dsh-ui-warn { color: var(--dsw-alias-state-warn-primary); }\n& .dsh-ui-success { color: var(--dsw-alias-state-success-primary); }\n& .dsh-ui-muted { color: var(--dsw-alias-label-tertiary); }\n& .dsh-ui-truncate { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n& .dsh-ui-wrap { min-width: 0; overflow-wrap: anywhere; }\n\n/* --- Layout scaffolding. --- */\n& .dsh-ui-stack { display: flex; flex-direction: column; gap: 12px; }\n& .dsh-ui-stack-lg { display: flex; flex-direction: column; gap: 20px; }\n& .dsh-ui-row { display: flex; align-items: center; gap: 8px; min-width: 0; }\n& .dsh-ui-row-wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }\n& .dsh-ui-spacer { flex: 1; min-width: 0; }\n/* A 0.5px l2 rule is the host's section divider; reserve the same rhythm. */\n& .dsh-ui-divider { height: 0.5px; background: var(--dsw-alias-border-l2); }\n& .dsh-ui-section { display: flex; flex-direction: column; gap: 12px; padding-top: 16px; border-top: 0.5px solid var(--dsw-alias-border-l2); }\n\n/* --- Card: a raised surface whose edge lives in the shadow. --- */\n& .dsh-ui-card {\n ${officialElevation('stroke')}\n display: flex;\n flex-direction: column;\n gap: 12px;\n padding: 16px;\n border-radius: var(--dsw-radius-lg);\n background: var(--dsw-alias-bg-layer-1);\n color: var(--dsw-alias-label-primary);\n min-width: 0;\n}\n& .dsh-ui-card--flat { border: 0.5px solid var(--dsw-alias-border-l3); box-shadow: none; }\n& .dsh-ui-card--nested { background: var(--dsw-alias-bg-layer-2); }\n& .dsh-ui-card--plain { background: none; }\n\n/* --- Field: label, control, help, error. The control itself is an\n * official primitive, so this only owns the vertical rhythm. --- */\n& .dsh-ui-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }\n& .dsh-ui-field + .dsh-ui-field { border-top: 0.5px solid var(--dsw-alias-border-l2); padding-top: 12px; }\n& .dsh-ui-label { display: flex; align-items: center; gap: 6px; font-size: 13px; line-height: 20px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n& .dsh-ui-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }\n& .dsh-ui-help { font-size: 12px; line-height: 1.6; color: var(--dsw-alias-label-secondary); }\n& .dsh-ui-help p { margin: 0; }\n& .dsh-ui-help p + p { margin-top: 8px; }\n& .dsh-ui-required { color: var(--dsw-alias-state-error-primary); }\n& .dsh-ui-control { width: 100%; min-width: 0; }\n/* An invalid control is marked on the control, not only in the message. */\n& .dsh-ui-control[aria-invalid='true'] { border-color: var(--dsw-alias-state-error-primary); }\n& .dsh-ui-readonly { display: flex; flex-direction: column; gap: 4px; min-width: 0; }\n& .dsh-ui-readonly > dt { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }\n& .dsh-ui-readonly > dd { margin: 0; font-size: 13px; line-height: 20px; overflow-wrap: anywhere; }\n\n/* --- Buttons row. A no-op container: it exists so actions line up on the\n * trailing edge the way every native panel does. --- */\n& .dsh-ui-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 4px; }\n& .dsh-ui-actions-end { justify-content: flex-end; }\n\n/* --- Banners. A banner is a left-rail notice, the shape used for warnings,\n * deprecations and blocking instructions. --- */\n& .dsh-ui-banner {\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 10px 14px;\n border: 0.5px solid var(--dsw-alias-border-l3);\n border-left: 3px solid var(--dsw-alias-state-warn-primary);\n border-radius: var(--dsw-radius-md);\n background: var(--dsw-alias-bg-layer-1);\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary);\n}\n& .dsh-ui-banner-title { font-weight: 500; color: var(--dsw-alias-state-warn-primary); }\n& .dsh-ui-banner--info { border-left-color: var(--dsw-alias-state-business-primary); }\n& .dsh-ui-banner--danger { border-left-color: var(--dsw-alias-state-error-primary); }\n& .dsh-ui-banner--success { border-left-color: var(--dsw-alias-state-success-primary); }\n& .dsh-ui-banner p { margin: 0; }\n\n/* --- Inline notice: a transient confirmation with no chrome of its own. --- */\n& .dsh-ui-notice { display: flex; align-items: center; gap: 6px; font-size: 12px; line-height: 18px; color: var(--dsw-alias-state-success-primary); }\n& .dsh-ui-notice--error { color: var(--dsw-alias-state-error-primary); }\n\n/* --- Empty and loading states. Both sit in a dashed well so an empty panel\n * reads as \"nothing here yet\" rather than as a broken layout. --- */\n& .dsh-ui-empty {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 6px;\n padding: 20px 16px;\n border: 0.5px dashed var(--dsw-alias-border-l3);\n border-radius: var(--dsw-radius-md);\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary);\n}\n& .dsh-ui-loading { display: flex; align-items: center; gap: 8px; padding: 20px 0; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary); }\n\n/* --- Selectable list. A row is a button-sized target with a hover fill and\n * a selected fill; the name carries the weight, the description does not. --- */\n& .dsh-ui-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; min-width: 0; }\n& .dsh-ui-list-scroll { max-height: min(66vh, 760px); overflow-y: auto; overflow-x: hidden; }\n& .dsh-ui-list-row { border-radius: var(--dsw-radius-md); }\n& .dsh-ui-list-row:hover { background: var(--dsw-alias-interactive-bg-hover); }\n& .dsh-ui-list-row[aria-selected='true'], & .dsh-ui-list-row[data-selected] { background: var(--dsw-alias-interactive-bg-active); }\n& .dsh-ui-list-item {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 4px;\n width: 100%;\n min-width: 0;\n padding: 10px 12px;\n border: 0;\n border-radius: var(--dsw-radius-md);\n background: none;\n font: inherit;\n color: inherit;\n text-align: start;\n cursor: pointer;\n}\n& .dsh-ui-list-item:disabled { cursor: default; }\n& .dsh-ui-list-item:disabled:hover { background: none; }\n& .dsh-ui-list-name { font-size: 14px; line-height: 22px; font-weight: 500; color: var(--dsw-alias-label-primary); overflow-wrap: anywhere; }\n& .dsh-ui-list-desc { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }\n\n/* --- Code and structured output. Wraps rather than scrolls, because a\n * feature panel is read rather than scanned. --- */\n& .dsh-ui-code {\n padding: 10px 12px;\n border: 0.5px solid var(--dsw-alias-border-l3);\n border-radius: var(--dsw-radius-md);\n background: var(--dsw-alias-bg-layer-1);\n font-family: var(--ds-font-family-code, ui-monospace, 'Cascadia Mono', Consolas, monospace);\n font-size: 12px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary);\n overflow-wrap: anywhere;\n white-space: pre-wrap;\n}\n& .dsh-ui-scroll { max-height: 60vh; overflow: auto; overscroll-behavior: contain; }\n\n/* --- A toggle row: label on the left, switch on the trailing edge. This is\n * layout only; the switch itself is the official primitive. --- */\n& .dsh-ui-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-width: 0; padding: 12px 0; }\n& .dsh-ui-toggle-row + .dsh-ui-toggle-row { border-top: 0.5px solid var(--dsw-alias-border-l2); }\n& .dsh-ui-toggle-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }\n& .dsh-ui-toggle-label { font-size: 14px; line-height: 22px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n\n/* --- Floating surface: a panel anchored to a trigger. This is the material\n * a menu card is made of — the translucent fill plus its backdrop blur, with\n * the edge riding inside the prominent elevation. A plugin that hand-rolls this\n * is how tokens like --dsw-specific-menu get invented; use this instead. --- */\n& .dsh-ui-surface {\n --dsw-elevation-stroke-color: var(--dsw-alias-border-l1);\n --dsh-scrollbar-thumb: var(--dsw-alias-scrollbar-bg-l2);\n --dsh-scrollbar-thumb-hover: var(--dsw-alias-scrollbar-hover-l2);\n position: relative;\n display: flex;\n flex-direction: column;\n border: 0;\n border-radius: var(--dsw-radius-lg);\n background: var(--dsw-menu-surface-fill);\n backdrop-filter: var(--dsw-menu-backdrop-filter);\n box-shadow: var(--dsw-elevation-prominent);\n color: var(--dsw-alias-label-primary);\n font-size: 13px;\n line-height: 20px;\n min-width: 0;\n}\n& .dsh-ui-surface-body { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px 14px; overflow-y: auto; }\n& .dsh-ui-surface-head { display: flex; align-items: center; gap: 8px; min-width: 0; }\n& .dsh-ui-surface-title { font-size: 14px; line-height: 22px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n\n/* --- Native select. The primitives ship no select, so a plugin that offers a\n * closed list of choices keeps the platform control and matches the official\n * settings field geometry exactly (34px, 0.5px l4, radius-md, layer-3). A\n * SegmentedControl is the primitive to reach for when the choices are few\n * enough to show at once. --- */\n& .dsh-ui-select {\n box-sizing: border-box;\n width: 100%;\n min-width: 0;\n height: 34px;\n padding: 0 12px;\n border: 0.5px solid var(--dsw-alias-border-l4);\n border-radius: var(--dsw-radius-md);\n background: var(--dsw-alias-bg-layer-3);\n font: inherit;\n font-size: 13px;\n line-height: 1.5;\n color: var(--dsw-alias-label-primary);\n cursor: pointer;\n}\n& .dsh-ui-select:focus-visible { outline: none; border-color: var(--dsw-alias-state-business-primary); }\n& .dsh-ui-select:disabled { color: var(--dsw-alias-label-tertiary); cursor: default; }\n& .dsh-ui-select[aria-invalid='true'] { border-color: var(--dsw-alias-state-error-primary); }\n\n/* Long panels scroll inside themselves instead of growing the host page. */\n& .dsh-ui-panel { display: flex; flex-direction: column; gap: 16px; min-width: 0; }\n& .dsh-ui-panel-wide { max-width: 100%; }\n\n@media (prefers-reduced-motion: reduce) {\n & *, & *::before, & *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }\n}\n}\n`\n // Widen every recipe from \"a descendant of the root\" to \"the root, or one of\n // its descendants\". Written as a transform rather than by hand so no recipe\n // can be added later with only the descendant form. The pattern is narrow on\n // purpose: a leading `&` followed by one recipe class and no combinator, so\n // sibling and child rules such as `.dsh-ui-field + .dsh-ui-field` keep their\n // own meaning and are left alone.\n return sheet.replace(/^& (\\.dsh-ui-[a-z0-9-]+)(?![+>~])/gm, (_match, className: string) =>\n `&${className}, & ${className}`)\n}\n","/** Browser-safe contracts. Shared RPC/result types stay on @klarkxy/dsh-plugin-kit. */\nexport type { RpcResult } from '@klarkxy/dsh-plugin-kit/contracts'\n\nexport const PLUGIN_NAME = '@klarkxy/dsh-git-commit'\nexport const FEATURE_ID = 'git-commit'\nexport const PURPOSE_ID = 'git-commit.plan'\nexport const RPC_CHANNEL = '/dsh-git-commit'\nexport const GIT_COMMIT_CLIENT_SERVICE = 'dshGitCommitClient'\nexport const PROMPT_VERSION = 'git-commit.v1'\nexport const SCHEMA_VERSION = 'commit-plan-json.v1'\nexport const CONTRACT_VERSION = 1\n\nexport const DEFAULT_MAX_OUTPUT_TOKENS = 2048\n/** Total character budget for the change manifest sent to the model. */\nexport const MAX_MANIFEST_CHARS = 48_000\n/** Per-file preview cap for untracked files. */\nexport const MAX_UNTRACKED_PREVIEW_CHARS = 2_000\n/** Recent commit subjects supplied as style reference. */\nexport const RECENT_LOG_COUNT = 10\n/** Hard cap for one generated commit message line. */\nexport const MAX_MESSAGE_CHARS = 120\n/** git subprocess timeout. */\nexport const GIT_TIMEOUT_MS = 30_000\nexport const SETTINGS_KEY = 'current'\n\n/** Plugin-page model selection. Empty provider/model means \"follow the default\". */\nexport interface CommitModelRoute {\n readonly provider: string\n readonly model: string\n readonly reasoningEffort?: string\n}\n\nexport interface GitCommitSettings {\n readonly revision: number\n readonly model: CommitModelRoute\n /**\n * Opt-in single commit when the model produced no usable plan. Off by\n * default: an unplanned commit is one the user never reviewed, so a failed\n * or unusable model call rejects the run instead of writing to the index.\n */\n readonly allowFallback: boolean\n}\n\nexport const defaultModelRoute = (): CommitModelRoute => ({ provider: '', model: '' })\n\nexport const defaultSettings = (): GitCommitSettings => ({\n revision: 0, model: defaultModelRoute(), allowFallback: false,\n})\n\n/** Untrusted stored flags stay opt-in: anything but a literal true is false. */\nexport function normalizeFallback(value: unknown): boolean {\n return value === true\n}\n\nfunction asRecord(value: unknown): Record<string, unknown> | undefined {\n return value && typeof value === 'object' && !Array.isArray(value) ? value as Record<string, unknown> : undefined\n}\n\nfunction asText(value: unknown): string | undefined {\n return typeof value === 'string' && value.trim() ? value.trim() : undefined\n}\n\n/** Untrusted stored routes collapse to the default so a bad row never breaks the run. */\nexport function normalizeModelRoute(value: unknown): CommitModelRoute {\n const row = asRecord(value)\n if (!row) return defaultModelRoute()\n const provider = asText(row.provider) ?? ''\n const model = asText(row.model) ?? ''\n const effort = asText(row.reasoningEffort)\n if (!provider || !model || provider.length > 250 || model.length > 250) return defaultModelRoute()\n return effort && effort.length <= 80 ? { provider, model, reasoningEffort: effort } : { provider, model }\n}\n\nexport interface CommitModelInfo {\n readonly provider: string\n readonly model: string\n /** 'page' is the plugin-page selection; 'default' is the host chat model. */\n readonly source: 'page' | 'default'\n}\n\nexport interface GitCommitStatus {\n readonly available: boolean\n /** Machine-readable reason when unavailable: 'no-session' | 'no-cwd' | 'not-a-repo' | 'no-git'. */\n readonly reason?: string\n readonly detail?: string\n readonly root?: string\n readonly branch?: string\n readonly workspace: { readonly files: number }\n readonly model?: CommitModelInfo\n}\n\nexport interface CommitGroupResult {\n readonly hash: string\n readonly message: string\n readonly files: readonly string[]\n}\n\nexport interface CommitRunResult {\n readonly branch: string\n readonly commits: readonly CommitGroupResult[]\n /** True when the model plan was unavailable and a single fallback commit was used. */\n readonly fallback: boolean\n readonly model?: CommitModelInfo\n}\n","import type { Context } from '@deepseek-ai/cordis'\nimport {\n modelMenuChoiceKey, modelMenuEffortOptions, parseModelMenuChoiceKey, parseModelMenuChoices,\n type ModelMenuChoice,\n} from '@klarkxy/dsh-plugin-kit/model-menu'\nimport { useCallback, useEffect, useRef, useState, useSyncExternalStore } from 'react'\nimport { createPortal } from 'react-dom'\nimport {\n Button, IconRefreshOutlineRegular, Switch, Tag, Tooltip, useAnchoredPosition, useDismissOnOutsidePointer,\n} from '@deepseek-ai/dsh-client-ui-primitives'\nimport { officialUiCss } from '@klarkxy/dsh-plugin-kit/official-ui'\nimport {\n GIT_COMMIT_CLIENT_SERVICE, PLUGIN_NAME, RPC_CHANNEL, type CommitModelRoute, type CommitRunResult,\n type GitCommitSettings, type GitCommitStatus, type RpcResult,\n} from './contracts.ts'\n\nexport const name = 'dsh-git-commit-client'\nexport const inject = ['slots', 'connection', 'remote', 'remote.session', 'locale'] as const\n\nconst NS = 'dsh-git-commit.action'\n\nconst zh = {\n action: '提交',\n title: '提交到 Git',\n commitAction: '分次提交全部工作区修改',\n files: '个文件',\n model: '模型',\n modelDefault: '默认模型',\n modelCustom: '插件设置',\n filesCount: '({n} 个文件)',\n confirmPrompt: '将把 {n} 个文件的全部修改分次提交到当前分支。',\n confirm: '确认提交',\n cancel: '取消',\n loading: '正在读取仓库状态…',\n running: '正在整理修改并分次提交…',\n done: '已创建提交',\n fallback: '模型不可用,已合并为单个提交',\n noWorkspace: '工作区没有修改',\n unavailable: '不可用',\n reasonNoRepo: '当前目录不在 Git 仓库中',\n reasonNoGit: '未找到 git 命令',\n reasonNoCwd: '会话没有工作目录',\n reasonNoSession: '会话不在线',\n sessionRunning: '会话正在运行,提交已暂停',\n refresh: '刷新',\n failed: '操作失败',\n planUnavailable: '模型没有给出可用的提交方案,已取消本次提交,工作区没有被改动。换一个模型重试,或在插件设置里开启兜底提交。',\n close: '关闭',\n}\n\nconst en: Record<keyof typeof zh, string> = {\n action: 'Commit',\n title: 'Commit to Git',\n commitAction: 'Commit all workspace changes',\n files: 'files',\n model: 'Model',\n modelDefault: 'default model',\n modelCustom: 'Plugin settings',\n filesCount: ' ({n} files)',\n confirmPrompt: 'All changes in {n} files will be committed to the current branch in one or more commits.',\n confirm: 'Commit now',\n cancel: 'Cancel',\n loading: 'Reading repository status…',\n running: 'Organizing changes into commits…',\n done: 'Commits created',\n fallback: 'Model unavailable; used a single commit',\n noWorkspace: 'No workspace changes',\n unavailable: 'Unavailable',\n reasonNoRepo: 'Current directory is not inside a Git repository',\n reasonNoGit: 'git executable not found',\n reasonNoCwd: 'Session has no working directory',\n reasonNoSession: 'Session is not live',\n sessionRunning: 'Session is running; commits paused',\n refresh: 'Refresh',\n failed: 'Operation failed',\n planUnavailable: 'The model returned no usable commit plan, so the run was cancelled and your workspace is untouched. Try another model, or turn on the fallback in plugin settings.',\n close: 'Close',\n}\n\ntype Key = keyof typeof zh\ntype Translate = (key: Key) => string\n\ninterface ConnectionLike {\n rpc: { call(channel: string, endpoint: string, payload: unknown): Promise<unknown> }\n}\n\ninterface SessionSnapshotLike {\n running?: boolean\n}\n\ninterface UseSessionLike {\n <T>(selector: (snapshot: SessionSnapshotLike) => T): T\n}\n\n/** A failed RPC keeps its code so the panel can explain a rejection in its own words. */\nclass RpcError extends Error {\n readonly code: string\n constructor(code: string, message: string) {\n super(message)\n this.name = 'RpcError'\n this.code = code\n }\n}\n\nexport interface GitCommitActionProps {\n sessionId: string\n useSession: UseSessionLike\n call: (endpoint: string, payload: unknown) => Promise<unknown>\n t: Translate\n}\n\nasync function rpc<T>(\n call: GitCommitActionProps['call'], endpoint: string, payload: unknown = {}, fallback = 'Operation failed',\n): Promise<T> {\n const result = await call(endpoint, payload) as RpcResult<T> | undefined\n if (!result || result.ok !== true) {\n const failed = result && 'error' in result ? result.error : undefined\n throw new RpcError(failed?.code ?? 'unknown', failed?.message ? failed.message : fallback)\n }\n return result.value\n}\n\nfunction reasonText(t: Translate, status: GitCommitStatus): string {\n switch (status.reason) {\n case 'not-a-repo': return t('reasonNoRepo')\n case 'no-git': return t('reasonNoGit')\n case 'no-cwd': return t('reasonNoCwd')\n case 'no-session': return t('reasonNoSession')\n default: return t('unavailable')\n }\n}\n\n/** A refusal the plugin can name gets its own sentence; the rest stay verbatim. */\nfunction errorText(t: Translate, error: { code: string; message: string }): string {\n return error.code === 'plan-unavailable' ? t('planUnavailable') : error.message\n}\n\nfunction panelError(reason: unknown): { code: string; message: string } {\n return reason instanceof RpcError\n ? { code: reason.code, message: reason.message }\n : { code: 'unknown', message: reason instanceof Error ? reason.message : String(reason) }\n}\n\nfunction GitBranchIcon() {\n return (\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\">\n <circle cx=\"4.5\" cy=\"3.5\" r=\"1.6\" stroke=\"currentColor\" strokeWidth=\"1.2\" />\n <circle cx=\"4.5\" cy=\"12.5\" r=\"1.6\" stroke=\"currentColor\" strokeWidth=\"1.2\" />\n <circle cx=\"11.5\" cy=\"6.5\" r=\"1.6\" stroke=\"currentColor\" strokeWidth=\"1.2\" />\n <path d=\"M4.5 5.1v5.8\" stroke=\"currentColor\" strokeWidth=\"1.2\" />\n <path d=\"M11.5 8.1c0 2-1.6 2.9-3.4 3\" stroke=\"currentColor\" strokeWidth=\"1.2\" />\n </svg>\n )\n}\n\nexport function GitCommitAction({ sessionId, useSession, call, t }: GitCommitActionProps) {\n const [open, setOpen] = useState(false)\n const [status, setStatus] = useState<GitCommitStatus>()\n const [loading, setLoading] = useState(false)\n const [running, setRunning] = useState(false)\n const [result, setResult] = useState<CommitRunResult | null>(null)\n const [error, setError] = useState<{ code: string; message: string } | null>(null)\n const [confirming, setConfirming] = useState(false)\n const rootRef = useRef<HTMLDivElement>(null)\n const triggerRef = useRef<HTMLButtonElement>(null)\n const panelRef = useRef<HTMLDivElement>(null)\n const generationRef = useRef(0)\n const position = useAnchoredPosition({ open, anchorRef: triggerRef, panelRef, gap: 5, margin: 16 })\n const sessionRunning = useSession(snapshot => snapshot.running === true)\n\n const changeOpen = useCallback((next: boolean) => {\n setOpen(next)\n setConfirming(false)\n if (next) {\n setResult(null)\n setError(null)\n }\n }, [])\n\n // Move focus into the dialog once it is positioned, so keyboard users land inside it.\n const positioned = Boolean(position)\n useEffect(() => {\n if (open && positioned) panelRef.current?.focus()\n }, [open, positioned])\n\n useDismissOnOutsidePointer(rootRef, open, changeOpen, panelRef)\n\n useEffect(() => {\n generationRef.current += 1\n setOpen(false)\n setStatus(undefined)\n setResult(null)\n setError(null)\n setRunning(false)\n }, [sessionId])\n\n const loadStatus = useCallback(async () => {\n const generation = generationRef.current\n setLoading(true)\n setError(null)\n try {\n const next = await rpc<GitCommitStatus>(call, 'status', { sessionId }, t('failed'))\n if (generationRef.current !== generation) return\n setStatus(next)\n } catch (reason) {\n if (generationRef.current !== generation) return\n setStatus(undefined)\n setError(panelError(reason))\n } finally {\n if (generationRef.current === generation) setLoading(false)\n }\n }, [call, sessionId, t])\n\n useEffect(() => {\n if (!open) return\n void loadStatus()\n }, [open, loadStatus])\n\n useEffect(() => {\n if (!open) return\n const dismiss = (event: KeyboardEvent) => {\n if (event.key !== 'Escape') return\n event.preventDefault()\n changeOpen(false)\n triggerRef.current?.focus()\n }\n document.addEventListener('keydown', dismiss)\n return () => document.removeEventListener('keydown', dismiss)\n }, [open, changeOpen])\n\n const runCommit = useCallback(async () => {\n const generation = generationRef.current\n setConfirming(false)\n setRunning(true)\n setResult(null)\n setError(null)\n try {\n const value = await rpc<CommitRunResult>(call, 'commit', { sessionId }, t('failed'))\n if (generationRef.current !== generation) return\n setResult(value)\n const next = await rpc<GitCommitStatus>(call, 'status', { sessionId }).catch(() => undefined)\n if (generationRef.current !== generation) return\n if (next) setStatus(next)\n } catch (reason) {\n if (generationRef.current !== generation) return\n setError(panelError(reason))\n } finally {\n if (generationRef.current === generation) setRunning(false)\n }\n }, [call, sessionId, t])\n\n const available = status?.available === true\n const workspaceCount = status?.workspace.files ?? 0\n const canCommit = available && !running && !sessionRunning && workspaceCount > 0\n\n return (\n <div ref={rootRef} className=\"gcm-root\">\n <Tooltip label={t('title')} side=\"bottom\" gap={4}>\n <Button\n ref={triggerRef}\n variant=\"ghost\"\n size=\"sm\"\n icon={<GitBranchIcon />}\n aria-label={t('title')}\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n onClick={() => changeOpen(!open)}\n >\n {t('action')}\n </Button>\n </Tooltip>\n {open && createPortal(\n <div\n ref={panelRef}\n className=\"gcm-root dsh-ui-surface gcm-panel\"\n style={position ?? { visibility: 'hidden', left: 0, top: 0 }}\n role=\"dialog\"\n tabIndex={-1}\n aria-label={t('title')}\n >\n <div className=\"dsh-ui-surface-body\">\n <div className=\"dsh-ui-surface-head\">\n <span className=\"dsh-ui-surface-title\">{t('title')}</span>\n {status?.branch ? <span className=\"dsh-ui-hint dsh-ui-truncate\">{status.branch}</span> : null}\n <span className=\"dsh-ui-spacer\" />\n <Tooltip label={t('refresh')} side=\"bottom\" gap={4}>\n <Button variant=\"ghost\" size=\"sm\" aria-label={t('refresh')} icon={<IconRefreshOutlineRegular size={14} />}\n disabled={loading || running} onClick={() => void loadStatus()} />\n </Tooltip>\n </div>\n {loading && !status && <p className=\"dsh-ui-hint\" role=\"status\">{t('loading')}</p>}\n {error !== null && <p className=\"dsh-ui-error\" role=\"alert\">{errorText(t, error)}</p>}\n {status && !available && <p className=\"dsh-ui-meta\" role=\"status\">{reasonText(t, status)}</p>}\n {available && (\n <>\n {status?.model ? (\n <p className=\"gcm-model\">\n <span className=\"dsh-ui-hint\">{t('model')}</span>\n <span className=\"dsh-ui-truncate\">{status.model.provider}/{status.model.model}</span>\n <Tag tone={status.model.source === 'page' ? 'info' : 'neutral'}>\n {status.model.source === 'page' ? t('modelCustom') : t('modelDefault')}\n </Tag>\n </p>\n ) : null}\n {confirming && canCommit ? (\n <div className=\"dsh-ui-stack\" role=\"group\" aria-label={t('commitAction')}>\n <p className=\"dsh-ui-hint dsh-ui-wrap\">{t('confirmPrompt').replace('{n}', String(workspaceCount))}</p>\n <div className=\"dsh-ui-actions\">\n <Button variant=\"ghost\" size=\"md\" onClick={() => setConfirming(false)}>{t('cancel')}</Button>\n <Button variant=\"primary\" size=\"md\" onClick={() => void runCommit()}>{t('confirm')}</Button>\n </div>\n </div>\n ) : (\n <Button variant=\"primary\" size=\"md\"\n disabled={!canCommit}\n onClick={() => setConfirming(true)}>\n {t('commitAction')}{t('filesCount').replace('{n}', String(workspaceCount))}\n </Button>\n )}\n {workspaceCount === 0 && <p className=\"dsh-ui-hint\">{t('noWorkspace')}</p>}\n {sessionRunning && <p className=\"dsh-ui-hint\">{t('sessionRunning')}</p>}\n </>\n )}\n {running && <p className=\"dsh-ui-hint\" role=\"status\">{t('running')}</p>}\n {result && (\n <div className=\"dsh-ui-stack\">\n <p className=\"dsh-ui-hint dsh-ui-wrap\">{t('done')} · {result.branch}</p>\n <ul className=\"gcm-commits\">\n {result.commits.map(commit => (\n <li key={commit.hash || commit.message}>\n <code>{commit.hash}</code> {commit.message}\n </li>\n ))}\n </ul>\n {result.fallback && <p className=\"dsh-ui-hint\">{t('fallback')}</p>}\n </div>\n )}\n </div>\n </div>,\n document.body,\n )}\n </div>\n )\n}\n\nexport const clientCss = `${officialUiCss('gcm-root')}\n/* Only the floating panel's geometry is this plugin's own: the material, the\n * rounded edge and the scrollbar tokens all come from the shared contract.\n *\n * The root class is spelled out because the panel is portaled and *is* the\n * root: the dsh-ui-surface recipe therefore reaches it as a compound\n * .gcm-root.dsh-ui-surface selector and declares position:relative at the\n * weight a bare .gcm-panel rule also carries. Left unqualified that recipe\n * wins, and the anchored left/top degrade into offsets from the panel's static\n * spot at the end of body — the popover then renders under the page instead\n * of at the trigger. Naming both classes puts this rule at the same weight,\n * later in the sheet, so it wins. */\n.gcm-root.gcm-panel { position: fixed; width: min(360px, calc(100vw - 32px)); max-height: min(560px, calc(100vh - 32px)); overflow: auto; }\n.gcm-model { display: flex; align-items: center; gap: 6px; min-width: 0; margin: 0; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-primary); }\n.gcm-commits { margin: 0; padding-inline-start: 18px; display: grid; gap: 2px; font-size: 12px; line-height: 18px; overflow-wrap: anywhere; }\n.gcm-commits code { font-size: 12px; background: var(--dsw-alias-bg-layer-2); padding: 0 4px; border-radius: var(--dsw-radius-sm); }\n.gcm-settings { display: flex; flex-direction: column; gap: 12px; min-width: 0; }\n.gcm-settings-status { display: flex; flex-direction: column; gap: 4px; }\n`\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context { dshGitCommitClient: { active: boolean } }\n}\n\ntype Client = Context & {\n connection: ConnectionLike\n remote?: { session?: { modelCatalog?: () => Promise<unknown> } }\n slots: {\n inject(key: string, callback: () => unknown): () => void\n register(spec: { name: string; id: string; order: number; locale: string; inject: () => unknown } | { name: string; key: string }, render: unknown): () => void\n }\n locale: {\n register(ns: string, locales: { zh: Record<string, string>; en: Record<string, string> }): () => void\n getSnapshot?(): { active: string }\n subscribe?(listener: () => void): () => void\n }\n}\n\n/** Host UI language, following live switches; falls back to zh when the service lacks a snapshot. */\nfunction useHostLocale(client: Client): string {\n const subscribe = useCallback(\n (listener: () => void) => client.locale.subscribe?.(listener) ?? (() => {}),\n [client],\n )\n const snapshot = useCallback(() => client.locale.getSnapshot?.().active ?? 'zh', [client])\n return useSyncExternalStore(subscribe, snapshot, snapshot)\n}\n\nconst settingsZh = {\n pageTitle: 'Git 提交',\n model: '提交规划模型',\n modelDefault: '默认模型',\n modelEffort: '思考强度',\n modelHint: '留空则使用当前会话模型,再回落到宿主默认对话模型。',\n fallback: '模型不可用时仍然提交',\n fallbackHint: '默认关闭:模型规划失败会取消本次提交,工作区不变。开启后全部改动会合并成一个提交,由插件代写提交信息。',\n loading: '正在读取设置…',\n saved: '已保存。',\n stale: '设置已更新,请刷新后重试。',\n failed: '无法读取提交设置。',\n retry: '重试',\n}\n\nconst settingsEn: Record<keyof typeof settingsZh, string> = {\n pageTitle: 'Git Commit',\n model: 'Commit planning model',\n modelDefault: 'Default model',\n modelEffort: 'Reasoning effort',\n modelHint: 'Leave empty to use the current session model, then the host default chat model.',\n fallback: 'Commit even without a model plan',\n fallbackHint: 'Off by default: a failed plan cancels the run and leaves the workspace untouched. When on, every change lands in one commit with a plugin-written message.',\n loading: 'Loading settings…',\n saved: 'Saved.',\n stale: 'Settings changed; refresh and retry.',\n failed: 'Could not load commit settings.',\n retry: 'Retry',\n}\n\nfunction settingsCopy(locale: string): Record<keyof typeof settingsZh, string> {\n return String(locale).startsWith('zh') ? settingsZh : settingsEn\n}\n\n/** Plugin-page settings row: pick the model this plugin's planning call uses. */\nexport function GitCommitSettingsPanel(props: { client: Client; locale?: string }) {\n const hostLocale = useHostLocale(props.client)\n const text = settingsCopy(props.locale ?? hostLocale)\n const [settings, setSettings] = useState<GitCommitSettings | undefined>(undefined)\n const [choices, setChoices] = useState<ModelMenuChoice[]>([])\n const [error, setError] = useState('')\n const [note, setNote] = useState('')\n const [busy, setBusy] = useState(false)\n\n const call = useCallback(\n (endpoint: string, payload: unknown = {}) => props.client.connection.rpc.call(RPC_CHANNEL, endpoint, payload),\n [props.client],\n )\n\n // Settings load once per client; the catalog effect below is keyed on route\n // strings, so saving a new settings object never re-triggers either fetch.\n useEffect(() => {\n let live = true\n void rpc<GitCommitSettings>(call, 'settings', {}, text.failed).then(next => {\n if (live) { setSettings(next); setError('') }\n }).catch(() => { if (live) setError(text.failed) })\n return () => { live = false }\n }, [call, text.failed])\n\n const boundProvider = settings?.model.provider ?? ''\n const boundModel = settings?.model.model ?? ''\n useEffect(() => {\n let live = true\n const bound = boundProvider && boundModel ? { provider: boundProvider, model: boundModel } : undefined\n void props.client.remote?.session?.modelCatalog?.()\n ?.then(value => { if (live) setChoices(parseModelMenuChoices(value, bound)) })\n .catch(() => { if (live) setChoices([]) })\n return () => { live = false }\n }, [props.client, boundProvider, boundModel])\n\n // One patch shape for both rows: the service replaces the whole row, so an\n // update to the toggle must carry the model it is not changing.\n const save = useCallback((patch: { model?: CommitModelRoute; allowFallback?: boolean }) => {\n if (!settings) return\n setBusy(true); setNote(''); setError('')\n void rpc<GitCommitSettings>(call, 'settings.update', {\n settings: {\n model: patch.model ?? settings.model,\n allowFallback: patch.allowFallback ?? settings.allowFallback,\n },\n expectedRevision: settings.revision,\n }, text.stale).then(next => {\n setSettings(next); setNote(text.saved); setBusy(false)\n }).catch(() => {\n setError(text.stale); setBusy(false)\n })\n }, [call, settings, text.saved, text.stale])\n\n if (!settings) {\n return (\n <section className=\"gcm-root gcm-settings\">\n {error\n ? <p role=\"alert\" className=\"dsh-ui-error\">{error}</p>\n : <p role=\"status\" className=\"dsh-ui-hint\">{text.loading}</p>}\n </section>\n )\n }\n\n const current = settings.model\n const selected = choices.find(item => item.provider === current.provider && item.model === current.model)\n const efforts = modelMenuEffortOptions(selected, current.reasoningEffort)\n\n return (\n <section className=\"gcm-root gcm-settings\" data-testid=\"git-commit-settings\">\n <div className=\"gcm-settings-status\">\n {error && <p role=\"alert\" className=\"dsh-ui-error\">{error}</p>}\n {note && <p role=\"status\" className=\"dsh-ui-notice\">{note}</p>}\n </div>\n <label className=\"dsh-ui-field\">\n <span className=\"dsh-ui-label\">{text.model}</span>\n <select\n className=\"dsh-ui-select\"\n value={modelMenuChoiceKey(current.provider, current.model)}\n disabled={busy}\n onChange={event => {\n const key = event.target.value\n if (!key) { save({ model: { provider: '', model: '' } }); return }\n const parsed = parseModelMenuChoiceKey(key)\n if (parsed) save({ model: parsed })\n }}\n >\n <option value=\"\">{text.modelDefault}</option>\n {choices.map(choice => (\n <option key={modelMenuChoiceKey(choice.provider, choice.model)} value={modelMenuChoiceKey(choice.provider, choice.model)}>\n {choice.label}\n </option>\n ))}\n </select>\n </label>\n {selected && efforts.length > 0 && (\n <label className=\"dsh-ui-field\">\n <span className=\"dsh-ui-label\">{text.modelEffort}</span>\n <select\n className=\"dsh-ui-select\"\n value={current.reasoningEffort ?? ''}\n disabled={busy}\n onChange={event => save({ model: { ...current, reasoningEffort: event.target.value || undefined } })}\n >\n <option value=\"\">{text.modelDefault}</option>\n {efforts.map(effort => <option key={effort.id} value={effort.id}>{effort.name}</option>)}\n </select>\n </label>\n )}\n <p className=\"dsh-ui-meta\">{text.modelHint}</p>\n <article className=\"gcm-root dsh-ui-card\">\n <header className=\"dsh-ui-toggle-row\">\n <div className=\"dsh-ui-toggle-text\">\n <h3 className=\"dsh-ui-toggle-label\">{text.fallback}</h3>\n <p className=\"dsh-ui-hint\">{text.fallbackHint}</p>\n </div>\n <Switch\n checked={settings.allowFallback}\n label={text.fallback}\n disabled={busy}\n onChange={next => save({ allowFallback: next })}\n />\n </header>\n </article>\n </section>\n )\n}\n\nexport function apply(ctx: Context): void {\n const client = ctx as unknown as Client\n ctx.provide(GIT_COMMIT_CLIENT_SERVICE, { active: true })\n ctx.effect(() => client.locale.register(NS, { zh: { ...zh }, en: { ...en } }), 'git-commit.locale')\n // One stylesheet for both the header popover and the plugin-page settings,\n // so the settings page is styled even when no session header is mounted.\n ctx.effect(() => {\n if (typeof document === 'undefined') return () => {}\n const style = document.createElement('style')\n style.setAttribute('data-plugin', name)\n style.textContent = clientCss\n document.head.appendChild(style)\n return () => style.remove()\n }, 'git-commit.styles')\n ctx.effect(() => client.slots.inject('plugins.bundle.config', () => client.slots.register(\n { name: 'plugins.bundle.config', key: PLUGIN_NAME },\n () => <GitCommitSettingsPanel client={client} />,\n )), 'git-commit.settings')\n ctx.effect(() => client.slots.inject('conversation.session.header.actions', () => client.slots.register(\n {\n name: 'conversation.session.header.actions',\n id: 'git-commit',\n order: 10,\n locale: NS,\n inject: () => ({\n call: (endpoint: string, payload: unknown) => client.connection.rpc.call(RPC_CHANNEL, endpoint, payload),\n }),\n },\n GitCommitAction,\n )), 'git-commit.slot')\n}\n"],"mappings":";;;;;;;;;;;;;;;AA8BA,MAAM,gBAAgB;AAEtB,SAAgB,mBAAmB,UAAkB,OAAuB;CAC1E,OAAO,YAAY,QAAQ,GAAG,WAAW,gBAAgB,UAAU;AACrE;AAEA,SAAgB,wBAAwB,OAAgE;CACtG,MAAM,QAAQ,MAAM,QAAQ,aAAa;CACzC,IAAI,SAAS,GAAG,OAAO,KAAA;CACvB,MAAM,WAAW,MAAM,MAAM,GAAG,KAAK;CACrC,MAAM,QAAQ,MAAM,MAAM,QAAQ,CAAoB;CACtD,IAAI,CAAC,YAAY,CAAC,OAAO,OAAO,KAAA;CAChC,OAAO;EAAE;EAAU;CAAM;AAC3B;AAEA,SAAS,SAAS,OAAqD;CACrE,OAAO,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,IAAI,QAAmC,KAAA;AAC1G;AAEA,SAAS,OAAO,OAAo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AU,SAAQ,KAAK,EAAE,eAAe,KAAK,CAAC;KAC/C,CAAA,CACK;;GACD,CAAA;EACF;;AAEb;AAEA,SAAgB,MAAM,KAAoB;CACxC,MAAM,SAAS;CACf,IAAI,QAAQ,2BAA2B,EAAE,QAAQ,KAAK,CAAC;CACvD,IAAI,aAAa,OAAO,OAAO,SAAS,IAAI;EAAE,IAAI,EAAE,GAAG,GAAG;EAAG,IAAI,EAAE,GAAG,GAAG;CAAE,CAAC,GAAG,mBAAmB;CAGlG,IAAI,aAAa;EACf,IAAI,OAAO,aAAa,aAAa,aAAa,CAAC;EACnD,MAAM,QAAQ,SAAS,cAAc,OAAO;EAC5C,MAAM,aAAa,eAAe,IAAI;EACtC,MAAM,cAAc;EACpB,SAAS,KAAK,YAAY,KAAK;EAC/B,aAAa,MAAM,OAAO;CAC5B,GAAG,mBAAmB;CACtB,IAAI,aAAa,OAAO,MAAM,OAAO,+BAA+B,OAAO,MAAM,SAC/E;EAAE,MAAM;EAAyB,KAAK;CAAY,SAC5C,iBAAA,GAAA,kBAAA,IAAA,CAAC,wBAAD,EAAgC,OAAS,CAAA,CACjD,CAAC,GAAG,qBAAqB;CACzB,IAAI,aAAa,OAAO,MAAM,OAAO,6CAA6C,OAAO,MAAM,SAC7F;EACE,MAAM;EACN,IAAI;EACJ,OAAO;EACP,QAAQ;EACR,eAAe,EACb,OAAO,UAAkB,YAAqB,OAAO,WAAW,IAAI,KAAK,aAAa,UAAU,OAAO,EACzG;CACF,GACA,eACF,CAAC,GAAG,iBAAiB;AACvB"}
|
|
1
|
+
{"version":3,"file":"client.inner.cjs","names":["useState","useRef","useAnchoredPosition","useCallback","Tooltip","Button","createPortal","IconRefreshOutlineRegular","Tag","useSyncExternalStore","modelMenuChoiceKey","parseModelMenuChoiceKey","Switch"],"sources":["../../dsh-model-route/src/route.ts","../../dsh-model-route/src/catalog.ts","../../dsh-plugin-kit/src/model-menu.ts","../../dsh-plugin-kit/src/official-ui.ts","../../dsh-plugin-kit/src/contracts.ts","../../dsh-plugin-kit/src/model-settings-client.ts","../src/contracts.ts","../src/client.tsx"],"sourcesContent":["/**\n * Shared model-route value contract.\n *\n * A feature plugin stores its model override as a ModelRoute on its own\n * settings page. Empty provider/model means \"follow the host default model\".\n * Pure and browser-safe: no cordis, no React, no schema library.\n */\n\n/** A concrete provider model a feature call should use. */\nexport interface ModelRoute {\n provider: string\n model: string\n reasoningEffort?: string\n}\n\n/** Empty route: no explicit model, the feature follows the host default. */\nexport function defaultModelRoute(): ModelRoute {\n return { provider: '', model: '' }\n}\n\n/** Structural check: both id fields are strings (either may be empty). */\nexport function isModelRouteValue(value: unknown): value is ModelRoute {\n if (!value || typeof value !== 'object' || Array.isArray(value)) return false\n const row = value as Record<string, unknown>\n return typeof row.provider === 'string' && typeof row.model === 'string'\n}\n\nconst MAX_ID_CHARS = 250\nconst MAX_EFFORT_CHARS = 80\n\nfunction asText(value: unknown): string | undefined {\n return typeof value === 'string' && value.trim() ? value.trim() : undefined\n}\n\n/**\n * Coerce a stored value into a ModelRoute. Anything malformed collapses to the\n * empty route, matching the per-plugin normalizers this contract replaces.\n */\nexport function normalizeModelRoute(value: unknown): ModelRoute {\n if (!value || typeof value !== 'object' || Array.isArray(value)) return defaultModelRoute()\n const row = value as Record<string, unknown>\n const provider = asText(row.provider) ?? ''\n const model = asText(row.model) ?? ''\n const effort = asText(row.reasoningEffort)\n if (!provider || !model || provider.length > MAX_ID_CHARS || model.length > MAX_ID_CHARS) return defaultModelRoute()\n return effort && effort.length <= MAX_EFFORT_CHARS ? { provider, model, reasoningEffort: effort } : { provider, model }\n}\n\n/** The override to actually call with: undefined when the route is empty. */\nexport function modelRouteOverride(route: ModelRoute | undefined): ModelRoute | undefined {\n const provider = route?.provider?.trim()\n const model = route?.model?.trim()\n if (!provider || !model) return undefined\n const effort = route?.reasoningEffort?.trim()\n return effort ? { provider, model, reasoningEffort: effort } : { provider, model }\n}\n\nconst KEY_SEPARATOR = '\\u001f'\n\n/** Stable key for one route, safe to use as a select-option value. */\nexport function modelRouteKey(provider: string, model: string): string {\n return provider && model ? `${provider}${KEY_SEPARATOR}${model}` : ''\n}\n\n/** Inverse of modelRouteKey; undefined for malformed keys. */\nexport function parseModelRouteKey(value: string): { provider: string; model: string } | undefined {\n const index = value.indexOf(KEY_SEPARATOR)\n if (index <= 0) return undefined\n const provider = value.slice(0, index)\n const model = value.slice(index + KEY_SEPARATOR.length)\n if (!provider || !model) return undefined\n return { provider, model }\n}\n\n/** True when both routes name the same target; two empty routes are equal. */\nexport function sameModelRoute(a: ModelRoute | undefined, b: ModelRoute | undefined): boolean {\n const left = modelRouteOverride(a)\n const right = modelRouteOverride(b)\n if (!left || !right) return !left === !right\n return left.provider === right.provider && left.model === right.model\n && (left.reasoningEffort ?? '') === (right.reasoningEffort ?? '')\n}\n","/**\n * Host model-catalog parsing shared by plugin settings UIs and model hubs.\n * Pure and browser-safe: no React, no host imports. The catalog envelope is\n * structural so hosts may add fields without breaking consumers.\n */\nimport { modelRouteKey, type ModelRoute } from './route.ts'\n\n/** One selectable model. `efforts` are the advertised reasoning efforts. */\nexport interface ModelMenuChoice {\n readonly provider: string\n readonly model: string\n readonly label: string\n readonly efforts: ReadonlyArray<{ id: string; name: string }>\n}\n\n/** The catalog face this helper needs; stays structural so hosts may add more. */\nexport interface ModelCatalogClient {\n readonly remote?: {\n readonly session?: { readonly modelCatalog?: () => Promise<unknown> }\n }\n}\n\nfunction asRecord(value: unknown): Record<string, unknown> | undefined {\n return value && typeof value === 'object' && !Array.isArray(value) ? value as Record<string, unknown> : undefined\n}\n\nfunction asText(value: unknown): string | undefined {\n return typeof value === 'string' && value.trim() ? value.trim() : undefined\n}\n\nfunction parseEffort(value: unknown): { id: string; name: string } | undefined {\n const row = asRecord(value)\n const id = row ? asText(row.id) : undefined\n if (!id) return undefined\n return { id, name: row ? asText(row.name) ?? id : id }\n}\n\n/** Parse the host session catalog into flat choices, keeping a saved route selectable. */\nexport function parseModelMenuChoices(value: unknown, bound?: ModelRoute): ModelMenuChoice[] {\n const envelope = asRecord(value)\n // Host remote calls resolve to a result envelope ({ ok, value }); older hosts\n // and unit tests hand over the bare catalog. Accept both.\n const root = (envelope && envelope.ok === true ? asRecord(envelope.value) : undefined) ?? envelope ?? {}\n const groups = Array.isArray(root.groups) ? root.groups : []\n const choices: ModelMenuChoice[] = []\n for (const group of groups) {\n const groupRow = asRecord(group)\n const provider = groupRow ? asText(groupRow.id) : undefined\n if (!provider || !groupRow || !Array.isArray(groupRow.models)) continue\n const providerName = asText(groupRow.name) ?? provider\n for (const entry of groupRow.models) {\n const modelRow = asRecord(entry)\n const model = modelRow ? asText(modelRow.id) : undefined\n if (!model || !modelRow) continue\n const name = asText(modelRow.name) ?? model\n const reasoning = asRecord(modelRow.reasoning)\n const efforts = reasoning && Array.isArray(reasoning.efforts)\n ? reasoning.efforts.flatMap(effort => { const parsed = parseEffort(effort); return parsed ? [parsed] : [] })\n : []\n choices.push({ provider, model, label: `${providerName} / ${name}`, efforts })\n }\n }\n if (bound?.provider && bound.model && !choices.some(item => item.provider === bound.provider && item.model === bound.model)) {\n choices.push({ provider: bound.provider, model: bound.model, label: `${bound.provider} / ${bound.model}`, efforts: [] })\n }\n return choices\n}\n\n/** Reasoning-effort options for one choice; the saved value stays selectable. */\nexport function modelMenuEffortOptions(\n choice: ModelMenuChoice | undefined,\n current?: string,\n): Array<{ id: string; name: string }> {\n const listed = (choice?.efforts ?? []).map(item => ({ ...item }))\n if (current && !listed.some(item => item.id === current)) listed.push({ id: current, name: current })\n return listed\n}\n\n/** Flat set of known routes for DetectModelFieldsOptions.knownModel. */\nexport function knownModelFromChoices(choices: readonly ModelMenuChoice[]): (route: ModelRoute) => boolean {\n const known = new Set(choices.map(choice => modelRouteKey(choice.provider, choice.model)))\n return route => known.has(modelRouteKey(route.provider, route.model))\n}\n","/**\n * Shared plugin-page model menu.\n *\n * Everything lives in @klarkxy/dsh-model-route: the pure contract (route\n * values, schema marker, catalog parsing, menu grouping) in its core entry,\n * and the ModelMenu popover component in its `./ui` browser entry. This entry\n * re-exports the core so existing plugin-kit consumers keep working, and adds\n * the React catalog hook on top. It must stay free of any ui-primitives\n * import so host-side and node-test consumers never load the component\n * bundle — the popover component and its styles live in\n * `@klarkxy/dsh-model-route/ui`.\n */\nimport { useEffect, useState } from 'react'\nimport { parseModelMenuChoices, type ModelCatalogClient, type ModelMenuChoice, type ModelRoute } from '@klarkxy/dsh-model-route'\n\nexport type { ModelCatalogClient, ModelMenuChoice, ModelMenuGroup } from '@klarkxy/dsh-model-route'\nexport {\n groupModelMenuChoices,\n knownModelFromChoices,\n modelMenuEffortOptions,\n modelMenuEffortLabel,\n modelMenuShortName,\n modelRouteKey as modelMenuChoiceKey,\n modelRouteOverride as modelMenuOverride,\n normalizeModelRoute as normalizeModelMenuRoute,\n parseModelMenuChoices,\n parseModelRouteKey as parseModelMenuChoiceKey,\n} from '@klarkxy/dsh-model-route'\n\n/** The stored selection. Empty provider/model means \"follow the default\". */\nexport type ModelMenuRoute = ModelRoute\n\n/** Load the host catalog once per mount and republish whenever it answers. */\nexport function useModelMenuChoices(client: ModelCatalogClient, bound?: ModelMenuRoute): ModelMenuChoice[] {\n const [choices, setChoices] = useState<ModelMenuChoice[]>([])\n useEffect(() => {\n if (typeof document === 'undefined') return\n let live = true\n const load = () => {\n void client.remote?.session?.modelCatalog?.()\n ?.then(value => { if (live) setChoices(parseModelMenuChoices(value, bound)) })\n .catch(() => { if (live) setChoices([]) })\n }\n load()\n return () => { live = false }\n }, [client, bound?.provider, bound?.model])\n return choices\n}\n","/**\n * Shared contract that keeps every plugin's browser-side UI on the official\n * DeepSeek Harness Web design language.\n *\n * Two rules produce that language, and both are load-bearing here:\n *\n * 1. Colour, radius, elevation and focus come from the host theme's real\n * `--dsw-*` tokens, written under their own names. Plugins never invent a\n * token, never alias the official ones behind a private palette (a private\n * alias is just a second, diverging theme), and never carries a literal\n * fallback — the host publishes light and dark, and a literal would pin one\n * of them. The only non-colour custom properties used are the host's own\n * content-font axis and frame clearance.\n *\n * 2. Anything the host already ships is used, not reimplemented. Controls come\n * from `@deepseek-ai/dsh-client-ui-primitives` (`Button`, `Input`,\n * `Checkbox`, `Switch`, `Tag`, `Pill`, `SegmentedControl`, `Menu`, `Modal`,\n * `Tooltip`, `Toast`, `DisclosureRow`, `StateDot`, `PathLabel`, the settings\n * form suite). This module only styles what primitives do not cover: page\n * scaffolding, field layout, banners, empty states and scroll regions.\n *\n * The metrics below are transcribed from the primitives' own CSS modules so a\n * feature panel lines up pixel-for-pixel with a native one: the 14/22 body and\n * 13/20 compact type tiers, the 0.5px hairline scale, and the elevation family\n * that draws a surface's edge in its shadow (`border: 0`) instead of a border.\n */\n\n/**\n * Every `--dsw-*` token this repo is allowed to reference, grouped by role.\n *\n * Plugins may only colour through this list. It is exported so the guard test\n * can fail a build when a stylesheet reaches for anything else — the failure\n * mode this prevents is silent: an unknown token resolves to nothing, so a\n * border disappears or a label inherits the wrong colour with no error anywhere.\n */\nexport const OFFICIAL_THEME_TOKENS = {\n /** Surfaces, from the page up to the topmost nested card. */\n surface: [\n '--dsw-alias-bg-base',\n '--dsw-alias-bg-layer-1',\n '--dsw-alias-bg-layer-2',\n '--dsw-alias-bg-layer-3',\n '--dsw-alias-bg-layer-4',\n '--dsw-alias-bg-module-platform',\n '--dsw-alias-bg-overlay',\n ],\n /** Hairlines. l1 is near-invisible on a menu surface, so menus use l2+. */\n border: ['--dsw-alias-border-l1', '--dsw-alias-border-l2', '--dsw-alias-border-l3', '--dsw-alias-border-l4'],\n /** Text. `caption` is menu shortcut text, `dimmed` is placeholder text. */\n label: [\n '--dsw-alias-label-primary',\n '--dsw-alias-label-secondary',\n '--dsw-alias-label-tertiary',\n '--dsw-alias-label-caption',\n '--dsw-alias-label-dimmed',\n '--dsw-alias-label-error',\n '--dsw-alias-label-primary-foreground',\n ],\n /** Interactive fills. The `-danger` hover belongs to destructive rows. */\n interactive: [\n '--dsw-alias-interactive-bg-hover',\n '--dsw-alias-interactive-bg-active',\n '--dsw-alias-interactive-bg-hover-danger',\n ],\n /** Accent and status. `business` is the focus ring's default colour. */\n accent: [\n '--dsw-alias-brand-primary',\n '--dsw-alias-button-primary-fill',\n '--dsw-alias-button-primary-hover',\n '--dsw-alias-button-tool-bar-fill',\n '--dsw-alias-button-tool-bar-hover',\n '--dsw-alias-button-ghost-active-fill',\n '--dsw-alias-button-ghost-active-border',\n ],\n state: [\n '--dsw-alias-state-business-primary',\n '--dsw-alias-state-success-primary',\n '--dsw-alias-state-warn-primary',\n '--dsw-alias-state-error-primary',\n '--dsw-alias-state-idle-primary',\n ],\n /** Corner scale: sm 8, md 12, lg the large card, panel the modal. */\n radius: ['--dsw-radius-sm', '--dsw-radius-md', '--dsw-radius-lg', '--dsw-radius-panel'],\n /** An elevated surface draws its edge in the shadow, so it keeps border: 0. */\n elevation: [\n '--dsw-elevation-soft',\n '--dsw-elevation-stroke',\n '--dsw-elevation-stroke-color',\n '--dsw-elevation-panel',\n '--dsw-elevation-prominent',\n ],\n /** Floats, masks and scrollbars. */\n overlay: [\n '--dsw-menu-surface-fill',\n '--dsw-menu-backdrop-filter',\n '--dsw-mask-blur',\n '--dsw-alias-bg-mask-1',\n '--dsw-alias-menu-icon',\n '--dsw-alias-scrollbar-bg-l2',\n '--dsw-alias-scrollbar-hover-l2',\n '--dsw-shadow-lv3',\n ],\n /** Motion, focus and type axis, published by the host rather than by a component. */\n system: [\n '--dsw-focus-ring-width',\n '--dsw-focus-ring-color',\n '--dsw-font-markdown-code-font-family',\n '--ds-transition-duration',\n '--ds-ease-in-out',\n '--ds-font-family-code',\n '--dsh-scrollbar-thumb',\n '--dsh-scrollbar-thumb-hover',\n '--dsh-content-font-size-secondary',\n '--dsh-content-font-delta',\n '--dsh-frame-top-clearance',\n ],\n} as const\n\n/** Every official token name, flat. Used by the token guard test. */\nexport const OFFICIAL_THEME_TOKEN_NAMES: readonly string[] = Object.values(OFFICIAL_THEME_TOKENS).flat()\n\n/** The elevation steps a surface can be raised by, softest first. */\nexport type OfficialElevation = 'soft' | 'stroke' | 'panel' | 'prominent'\n\n/**\n * The host's focus ring shorthand, verbatim. Writing this per control is how\n * rings drift apart; a stylesheet that draws its own focus style should use\n * {@link officialFocus} instead. The colour fallback is the host's own default.\n */\nexport const OFFICIAL_FOCUS_RING =\n 'var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary))'\n\n/**\n * A complete `outline` declaration at the official geometry. `offset` defaults\n * to the 2px the native controls use; the host's inline field rules sit at 1px\n * and a segmented tab pulls the ring inside itself at -2px.\n */\nexport function officialFocus(offset = '2px'): string {\n return `outline: ${OFFICIAL_FOCUS_RING}; outline-offset: ${offset}`\n}\n\n/**\n * An elevated surface. The host draws a raised surface's edge inside its\n * shadow rather than as a border, so a card sets `border: 0` and takes the edge\n * from the elevation — which is also why its border stays off the alias-border\n * set that a flat, non-elevated rule would use.\n */\nexport function officialElevation(level: OfficialElevation): string {\n return `border: 0; box-shadow: var(--dsw-elevation-${level})`\n}\n\n/**\n * An elevated surface whose edge should read as a specific hairline. Rebinding\n * the stroke colour is how a menu card picks l1 while a panel picks l3, without\n * the two growing apart by hand.\n */\nexport function officialStrokedElevation(level: OfficialElevation, color: string): string {\n return `--dsw-elevation-stroke-color: ${color}; ${officialElevation(level)}`\n}\n\n/**\n * The shared stylesheet for a plugin UI, scoped under that plugin's root class.\n *\n * Scoping is what keeps this safe to always-bundle into every client: the rules\n * can only match inside the plugin's own subtree, so two plugins can both mount\n * `dsh-ui-card` without either styling the other's markup.\n *\n * Each recipe matches the root element *and* its descendants, because the\n * commonest arrangement is one element that is both — a surface that carries\n * the root class and `dsh-ui-card`, or a portaled dialog that is the root and\n * the `dsh-ui-surface`. A descendant-only scope would silently leave those\n * unstyled, with no error anywhere.\n *\n * A caveat worth knowing: `Modal` and `Menu` portal to `document.body`, so their\n * content leaves the plugin's subtree entirely. A portaled surface therefore\n * needs its own root class on an element inside the portal.\n *\n * Only patterns that primitives do not provide live here. If a control appears\n * below that `Button`/`Input`/`Switch`/`Tag`/`Menu` already covers, that is a\n * bug in this file: use the primitive and delete the recipe.\n */\nexport function officialUiCss(roots: string | readonly string[]): string {\n // One plugin often mounts several unrelated surfaces (a settings seat, a chat\n // card, a header menu), so the caller names every root. The rules below are\n // nested under a single selector list and use `&`, which the browser expands\n // per root — so one stylesheet covers all of them without duplicating itself.\n const scope = (typeof roots === 'string' ? [roots] : roots).map(root => `.${root}`).join(', ')\n const sheet = `\n/* Official DSH Web UI contract. Generated by @klarkxy/dsh-plugin-kit/official-ui.\n * Do not hand-edit the copy inside a plugin: change this module so every plugin\n * moves together. Scope: ${scope} */\n/* The scope rule below stays open for the whole sheet: every rule after it\n * nests with the parent selector, so one stylesheet can cover several unrelated\n * roots without leaking into a neighbouring plugin. Its closing brace is last. */\n${scope} {\n color: var(--dsw-alias-label-primary);\n font-family: inherit;\n font-size: 14px;\n line-height: 22px;\n min-width: 0;\n\n& *, & *::before, & *::after { box-sizing: border-box; }\n& h1, & h2, & h3, & h4, & p, & figure { margin: 0; }\n/* Keyboard focus only: pointer input keeps the native resting appearance. The\n * ring needs no radius of its own — the outline already follows the control's\n * own border-radius, and overriding it here would flatten every control. */\n& :focus-visible { ${officialFocus()}; }\n& [hidden] { display: none !important; }\n\n/* --- Type tiers. The same 14/22 and 13/20 steps the primitives use. --- */\n& .dsh-ui-title { font-size: 16px; line-height: 24px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n& .dsh-ui-heading { font-size: 14px; line-height: 22px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n& .dsh-ui-compact { font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-primary); }\n& .dsh-ui-meta { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); }\n& .dsh-ui-hint { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }\n& .dsh-ui-error { font-size: 12px; line-height: 18px; color: var(--dsw-alias-state-error-primary); }\n& .dsh-ui-warn { color: var(--dsw-alias-state-warn-primary); }\n& .dsh-ui-success { color: var(--dsw-alias-state-success-primary); }\n& .dsh-ui-muted { color: var(--dsw-alias-label-tertiary); }\n& .dsh-ui-truncate { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n& .dsh-ui-wrap { min-width: 0; overflow-wrap: anywhere; }\n\n/* --- Layout scaffolding. --- */\n& .dsh-ui-stack { display: flex; flex-direction: column; gap: 12px; }\n& .dsh-ui-stack-lg { display: flex; flex-direction: column; gap: 20px; }\n& .dsh-ui-row { display: flex; align-items: center; gap: 8px; min-width: 0; }\n& .dsh-ui-row-wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }\n& .dsh-ui-spacer { flex: 1; min-width: 0; }\n/* A 0.5px l2 rule is the host's section divider; reserve the same rhythm. */\n& .dsh-ui-divider { height: 0.5px; background: var(--dsw-alias-border-l2); }\n& .dsh-ui-section { display: flex; flex-direction: column; gap: 12px; padding-top: 16px; border-top: 0.5px solid var(--dsw-alias-border-l2); }\n\n/* --- Card: a raised surface whose edge lives in the shadow. --- */\n& .dsh-ui-card {\n ${officialElevation('stroke')}\n display: flex;\n flex-direction: column;\n gap: 12px;\n padding: 16px;\n border-radius: var(--dsw-radius-lg);\n background: var(--dsw-alias-bg-layer-1);\n color: var(--dsw-alias-label-primary);\n min-width: 0;\n}\n& .dsh-ui-card--flat { border: 0.5px solid var(--dsw-alias-border-l3); box-shadow: none; }\n& .dsh-ui-card--nested { background: var(--dsw-alias-bg-layer-2); }\n& .dsh-ui-card--plain { background: none; }\n\n/* --- Field: label, control, help, error. The control itself is an\n * official primitive, so this only owns the vertical rhythm. --- */\n& .dsh-ui-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }\n& .dsh-ui-field + .dsh-ui-field { border-top: 0.5px solid var(--dsw-alias-border-l2); padding-top: 12px; }\n& .dsh-ui-label { display: flex; align-items: center; gap: 6px; font-size: 13px; line-height: 20px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n& .dsh-ui-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }\n& .dsh-ui-help { font-size: 12px; line-height: 1.6; color: var(--dsw-alias-label-secondary); }\n& .dsh-ui-help p { margin: 0; }\n& .dsh-ui-help p + p { margin-top: 8px; }\n& .dsh-ui-required { color: var(--dsw-alias-state-error-primary); }\n& .dsh-ui-control { width: 100%; min-width: 0; }\n/* An invalid control is marked on the control, not only in the message. */\n& .dsh-ui-control[aria-invalid='true'] { border-color: var(--dsw-alias-state-error-primary); }\n& .dsh-ui-readonly { display: flex; flex-direction: column; gap: 4px; min-width: 0; }\n& .dsh-ui-readonly > dt { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }\n& .dsh-ui-readonly > dd { margin: 0; font-size: 13px; line-height: 20px; overflow-wrap: anywhere; }\n\n/* --- Buttons row. A no-op container: it exists so actions line up on the\n * trailing edge the way every native panel does. --- */\n& .dsh-ui-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 4px; }\n& .dsh-ui-actions-end { justify-content: flex-end; }\n\n/* --- Banners. A banner is a left-rail notice, the shape used for warnings,\n * deprecations and blocking instructions. --- */\n& .dsh-ui-banner {\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 10px 14px;\n border: 0.5px solid var(--dsw-alias-border-l3);\n border-left: 3px solid var(--dsw-alias-state-warn-primary);\n border-radius: var(--dsw-radius-md);\n background: var(--dsw-alias-bg-layer-1);\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary);\n}\n& .dsh-ui-banner-title { font-weight: 500; color: var(--dsw-alias-state-warn-primary); }\n& .dsh-ui-banner--info { border-left-color: var(--dsw-alias-state-business-primary); }\n& .dsh-ui-banner--danger { border-left-color: var(--dsw-alias-state-error-primary); }\n& .dsh-ui-banner--success { border-left-color: var(--dsw-alias-state-success-primary); }\n& .dsh-ui-banner p { margin: 0; }\n\n/* --- Inline notice: a transient confirmation with no chrome of its own. --- */\n& .dsh-ui-notice { display: flex; align-items: center; gap: 6px; font-size: 12px; line-height: 18px; color: var(--dsw-alias-state-success-primary); }\n& .dsh-ui-notice--error { color: var(--dsw-alias-state-error-primary); }\n\n/* --- Empty and loading states. Both sit in a dashed well so an empty panel\n * reads as \"nothing here yet\" rather than as a broken layout. --- */\n& .dsh-ui-empty {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 6px;\n padding: 20px 16px;\n border: 0.5px dashed var(--dsw-alias-border-l3);\n border-radius: var(--dsw-radius-md);\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary);\n}\n& .dsh-ui-loading { display: flex; align-items: center; gap: 8px; padding: 20px 0; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary); }\n\n/* --- Selectable list. A row is a button-sized target with a hover fill and\n * a selected fill; the name carries the weight, the description does not. --- */\n& .dsh-ui-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; min-width: 0; }\n& .dsh-ui-list-scroll { max-height: min(66vh, 760px); overflow-y: auto; overflow-x: hidden; }\n& .dsh-ui-list-row { border-radius: var(--dsw-radius-md); }\n& .dsh-ui-list-row:hover { background: var(--dsw-alias-interactive-bg-hover); }\n& .dsh-ui-list-row[aria-selected='true'], & .dsh-ui-list-row[data-selected] { background: var(--dsw-alias-interactive-bg-active); }\n& .dsh-ui-list-item {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 4px;\n width: 100%;\n min-width: 0;\n padding: 10px 12px;\n border: 0;\n border-radius: var(--dsw-radius-md);\n background: none;\n font: inherit;\n color: inherit;\n text-align: start;\n cursor: pointer;\n}\n& .dsh-ui-list-item:disabled { cursor: default; }\n& .dsh-ui-list-item:disabled:hover { background: none; }\n& .dsh-ui-list-name { font-size: 14px; line-height: 22px; font-weight: 500; color: var(--dsw-alias-label-primary); overflow-wrap: anywhere; }\n& .dsh-ui-list-desc { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }\n\n/* --- Code and structured output. Wraps rather than scrolls, because a\n * feature panel is read rather than scanned. --- */\n& .dsh-ui-code {\n padding: 10px 12px;\n border: 0.5px solid var(--dsw-alias-border-l3);\n border-radius: var(--dsw-radius-md);\n background: var(--dsw-alias-bg-layer-1);\n font-family: var(--ds-font-family-code);\n font-size: 12px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary);\n overflow-wrap: anywhere;\n white-space: pre-wrap;\n}\n& .dsh-ui-scroll { max-height: 60vh; overflow: auto; overscroll-behavior: contain; }\n\n/* --- A toggle row: label on the left, switch on the trailing edge. This is\n * layout only; the switch itself is the official primitive. --- */\n& .dsh-ui-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-width: 0; padding: 12px 0; }\n& .dsh-ui-toggle-row + .dsh-ui-toggle-row { border-top: 0.5px solid var(--dsw-alias-border-l2); }\n& .dsh-ui-toggle-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }\n& .dsh-ui-toggle-label { font-size: 14px; line-height: 22px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n\n/* --- Floating surface: a panel anchored to a trigger. This is the material\n * a menu card is made of — the translucent fill plus its backdrop blur, with\n * the edge riding inside the prominent elevation. A plugin that hand-rolls this\n * is how tokens like --dsw-specific-menu get invented; use this instead. --- */\n& .dsh-ui-surface {\n --dsw-elevation-stroke-color: var(--dsw-alias-border-l1);\n --dsh-scrollbar-thumb: var(--dsw-alias-scrollbar-bg-l2);\n --dsh-scrollbar-thumb-hover: var(--dsw-alias-scrollbar-hover-l2);\n position: relative;\n display: flex;\n flex-direction: column;\n border: 0;\n border-radius: var(--dsw-radius-lg);\n background: var(--dsw-menu-surface-fill);\n backdrop-filter: var(--dsw-menu-backdrop-filter);\n box-shadow: var(--dsw-elevation-prominent);\n color: var(--dsw-alias-label-primary);\n font-size: 13px;\n line-height: 20px;\n min-width: 0;\n}\n& .dsh-ui-surface-body { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px 14px; overflow-y: auto; }\n& .dsh-ui-surface-head { display: flex; align-items: center; gap: 8px; min-width: 0; }\n& .dsh-ui-surface-title { font-size: 14px; line-height: 22px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n\n/* --- Native select. The primitives ship no select, so a plugin that offers a\n * closed list of choices keeps the platform control and matches the official\n * settings field geometry exactly (34px, 0.5px l4, radius-md, layer-3). A\n * SegmentedControl is the primitive to reach for when the choices are few\n * enough to show at once. --- */\n& .dsh-ui-select {\n box-sizing: border-box;\n width: 100%;\n min-width: 0;\n height: 34px;\n padding: 0 12px;\n border: 0.5px solid var(--dsw-alias-border-l4);\n border-radius: var(--dsw-radius-md);\n background: var(--dsw-alias-bg-layer-3);\n font: inherit;\n font-size: 13px;\n line-height: 1.5;\n color: var(--dsw-alias-label-primary);\n cursor: pointer;\n}\n& .dsh-ui-select:focus-visible { outline: none; border-color: var(--dsw-alias-state-business-primary); }\n& .dsh-ui-select:disabled { color: var(--dsw-alias-label-tertiary); cursor: default; }\n& .dsh-ui-select[aria-invalid='true'] { border-color: var(--dsw-alias-state-error-primary); }\n\n/* Long panels scroll inside themselves instead of growing the host page. */\n& .dsh-ui-panel { display: flex; flex-direction: column; gap: 16px; min-width: 0; }\n& .dsh-ui-panel-wide { max-width: 100%; }\n\n@media (prefers-reduced-motion: reduce) {\n & *, & *::before, & *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }\n}\n}\n`\n // Widen every recipe from \"a descendant of the root\" to \"the root, or one of\n // its descendants\". Written as a transform rather than by hand so no recipe\n // can be added later with only the descendant form. The pattern is narrow on\n // purpose: a leading `&` followed by one recipe class and no combinator, so\n // sibling and child rules such as `.dsh-ui-field + .dsh-ui-field` keep their\n // own meaning and are left alone.\n return sheet.replace(/^& (\\.dsh-ui-[a-z0-9-]+)(?![+>~])/gm, (_match, className: string) =>\n `&${className}, & ${className}`)\n}\n","import type { ContextFormed } from '@deepseek-ai/dsh-llm'\nimport type { ModelRoute } from '@klarkxy/dsh-model-route'\n\n/**\n * The canonical home is @klarkxy/dsh-model-route; re-exported here so existing\n * plugin-kit consumers keep compiling.\n */\nexport type { ModelRoute }\n\n/** Public, browser-safe contracts. Host implementations stay in their owning packages. */\nexport type ProducerSourceKind = `plugin:${string}`\nexport type ProducerMessageSource = { kind: ProducerSourceKind; plugin: string } & ContextFormed\n\n/**\n * V4 sessions persist the producing extension in `kind`; the retired generic\n * `plugin` wrapper is not admitted. Each feature plugin declares its own kind.\n */\ndeclare module '@deepseek-ai/dsh-llm' {\n interface MessageSourceMap {\n [kind: ProducerSourceKind]: ProducerMessageSource\n }\n}\n\nexport function producerMessageSource(plugin: string): ProducerMessageSource {\n return { kind: `plugin:${plugin}`, plugin }\n}\n\nexport type RpcResult<T = unknown> = { ok: true; value: T } | { ok: false; error: { code: string; message: string } }\nexport const CHAT_EVENTS_SLOT = 'dsh-editor.chat.events'\nexport interface EvidenceRef { sessionId: string; seq: number; kind: 'user' | 'tool' | 'turn' | 'manual'; excerpt?: string }\nexport interface TaskContract {\n id: string\n sessionId: string\n sourceVersion: string\n revision: number\n goal: string\n deliverables: string[]\n inScope: string[]\n outOfScope: string[]\n constraints: string[]\n acceptance: string[]\n assumptions: string[]\n questions: string[]\n evidence: EvidenceRef[]\n readiness: 'pending' | 'clear-request' | 'user-confirmed' | 'disclosed-assumptions' | 'cancelled' | 'stale'\n updatedAt: number\n}\nexport interface TaskCheckpoint {\n id: string\n sessionId: string\n sourceVersion: string\n contractVersion?: number\n fromSeq: number\n toSeq: number\n revision: number\n status: 'running' | 'completed' | 'failed' | 'cancelled'\n items: Array<{ label: string; state: 'pending' | 'verified' | 'failed'; evidence: EvidenceRef[] }>\n constraints: string[]\n nextAction: string\n createdAt: number\n}\nexport type KnowledgeScope = { kind: 'global' } | { kind: 'project'; projectId: string }\nexport type KnowledgeKind = 'preference' | 'project-fact' | 'decision' | 'vocabulary' | 'activity' | 'lesson'\n/** Descriptive context, never an executable instruction or authorization. */\nexport interface ContextKnowledge {\n subject: string\n domain: string\n key: string\n aliases: string[]\n observedAt: number\n /** The user's own time expression, not an inferred completion date. */\n eventTime?: string\n activityStatus?: 'planned' | 'in-progress' | 'blocked' | 'paused' | 'completed' | 'cancelled' | 'unknown'\n}\n/** A scoped method. Observations remain candidates until explicitly accepted. */\nexport interface ProcedureKnowledge {\n origin: 'instruction' | 'observation'\n goal: string\n when: string[]\n steps: string[]\n avoid: string[]\n verify: string[]\n}\nexport interface MemoryRecord {\n id: string\n revision: number\n scope: KnowledgeScope\n kind: KnowledgeKind\n status: 'candidate' | 'active' | 'rejected' | 'superseded' | 'revoked' | 'deleted'\n title: string\n content: string\n tags: string[]\n evidence: EvidenceRef[]\n exceptions: string[]\n source: 'user' | 'memory' | 'dream' | 'self-improvement'\n context?: ContextKnowledge\n procedure?: ProcedureKnowledge\n createdAt: number\n updatedAt: number\n expiresAt?: number\n supersedes?: string[]\n /** Exact record revisions behind a derived candidate; revalidated on adoption. */\n basis?: Array<{ id: string; revision: number }>\n}\nexport type NewMemoryRecord = Omit<MemoryRecord, 'id' | 'revision' | 'createdAt' | 'updatedAt'>\nexport interface MemoryQuery { scope: KnowledgeScope; query?: string; kinds?: KnowledgeKind[]; statuses?: MemoryRecord['status'][]; limit?: number }\nexport interface MemoryMutationOptions { signal?: AbortSignal; isCurrent?: () => boolean }\nexport interface MemoryService {\n list(query: MemoryQuery): Promise<MemoryRecord[]>\n create(record: NewMemoryRecord, options?: MemoryMutationOptions): Promise<MemoryRecord>\n update(id: string, patch: Partial<Pick<MemoryRecord, 'title' | 'content' | 'tags' | 'exceptions' | 'status' | 'expiresAt'>>, expectedRevision: number, options?: MemoryMutationOptions): Promise<MemoryRecord>\n /** Explicit user promotion, persisted atomically on the same record; preserves expiry and evidence. */\n promoteToGlobal(id: string, expectedRevision: number, options?: MemoryMutationOptions): Promise<MemoryRecord>\n remove(id: string, expectedRevision: number, options?: MemoryMutationOptions): Promise<void>\n recall(query: MemoryQuery): Promise<MemoryRecord[]>\n}\n\n/**\n * The session creation metadata the host snapshots when it creates a delegated child\n * thread. Mirrors `CreateAgentOptions.meta` in `@deepseek-ai/dsh-agent`; it is durable\n * session data, so it survives a restart and needs no ancestry walk.\n */\nexport interface SubagentSessionLike {\n readonly header?: {\n readonly parentSession?: unknown\n readonly origin?: unknown\n readonly delegationDepth?: unknown\n readonly isSeeded?: unknown\n readonly classification?: unknown\n }\n}\n\n/**\n * True when `session` is a delegated child thread rather than a human-driven top-level\n * conversation.\n *\n * A message's `source.kind === 'user'` cannot answer this: a lead agent's dispatch prompt\n * is delivered as the child's own user message, so delegated work is indistinguishable\n * from a person typing once you only look at the message. Plugins use this to keep\n * automatic writes and derived model calls on top-level sessions.\n */\nexport function isSubagentSession(session: unknown): boolean {\n const header = (session as SubagentSessionLike | null | undefined)?.header\n if (!header || typeof header !== 'object') return false\n if (header.origin === 'subagent' || Number(header.delegationDepth ?? 0) > 0) return true\n // Native human forks also persist parentSession for history lineage. A fork's\n // seeded header distinguishes it from legacy children whose parent is the\n // only marker. Native rc.2 forks omit depth; patched hosts may persist zero.\n // Explicit delegation and unknown metadata still keep the child guard.\n const humanFork = header.isSeeded === true\n && (header.delegationDepth === undefined || header.delegationDepth === 0)\n && header.origin === undefined\n && (header.classification === undefined || header.classification === 'ordinary' || header.classification === 'free')\n return Boolean(header.parentSession) && !humanFork\n}\n\n/** Project keys come only from the host-validated session directory, never client input. */\nexport function projectIdFromCwd(cwd: string | undefined): string | undefined {\n if (typeof cwd !== 'string') return undefined\n const normalized = cwd.trim().replaceAll('\\\\', '/')\n if (!normalized) return undefined\n return normalized === '/' || /^[A-Za-z]:\\/$/.test(normalized) ? normalized : normalized.replace(/\\/+$/, '')\n}\n\n/**\n * Remote contribution for model-settings change notifications.\n * Provided by `@klarkxy/dsh-model-hub` (`ModelSettingsChangesController`);\n * subscribers degrade silently when that package is not installed.\n * The stream carries invalidations only — `ready` is never a settings snapshot.\n */\nexport const MODEL_SETTINGS_CHANGES_REMOTE = {\n package: '@klarkxy/dsh-model-hub',\n descriptors: [{\n id: 'modelSettingsChanges/watch',\n service: 'modelSettingsChangesController',\n namespace: 'modelSettingsChanges',\n method: 'watch',\n mode: 'stream' as const,\n invocation: { kind: 'direct' as const },\n parameters: [] as const,\n cancellation: { parameter: 'signal' as const },\n }],\n}\n\n/**\n * Repository extension: a native web provider announces that its local\n * availability changed. Kind is `search` or `fetch`; id is the provider id.\n * Listeners refresh management state and must not treat this as a network probe.\n */\nexport const WEB_PROVIDER_AVAILABILITY_EVENT = 'web/provider-availability-updated' as const\n\n/**\n * Optional display metadata a provider may attach when it registers directly\n * with `ctx.web`. Execution and credentials stay with the provider; this object\n * is display-only and must never carry secret values.\n */\nexport interface DshWebManagementDescriptor {\n readonly id: string\n readonly label: string\n readonly description: string\n readonly defaultBaseURL?: string\n readonly credentialRef?: string\n /** True when the key is shared with another surface. The page must not delete it. */\n readonly credentialShared?: boolean\n /** Optional notice naming the settings surface that owns a shared credential. */\n readonly credentialHint?: string\n readonly billing: 'request' | 'model-and-tools' | 'none' | 'unknown'\n /** Optional provider-supplied billing summary. */\n readonly pricing?: string\n /** Public HTTPS page explaining provider charges. */\n readonly pricingUrl?: string\n /** Public HTTPS page where the user can create an API key. */\n readonly signupUrl?: string\n /** Plugin that owns configuration. Native providers keep their settings there. */\n readonly configurationOwner?: string\n /** Explicit settings link supplied by the provider, never inferred from its id. */\n readonly configurationUrl?: string\n /** Fixed legacy route migrated by a bundle-owned adapter; not used by native plugins. */\n readonly legacyId?: string\n}\n\n/**\n * Host Creator agent-preset id (`agentPresets.composedPreset`).\n * Plugins that gate Creator-only tools or prompt sections compare against this.\n */\nexport const CREATOR_PRESET_ID = 'cordis'\n","import type { TypertRemoteContribution } from '@deepseek-ai/dsh-typert-protocol'\nimport { MODEL_SETTINGS_CHANGES_REMOTE } from './contracts.ts'\n\nexport type ModelSettingsChangeFrame = { kind: 'ready' } | { kind: 'changed'; ns: string; revision: number }\n\n/** This stream carries invalidations only; ready is never a settings snapshot. */\nexport function parseModelSettingsChangeFrame(value: unknown): ModelSettingsChangeFrame {\n if (!value || typeof value !== 'object' || Array.isArray(value)) throw new Error('Invalid model settings change frame')\n const frame = value as Record<string, unknown>\n if (frame.kind === 'ready' && Object.keys(frame).length === 1) return { kind: 'ready' }\n if (frame.kind === 'changed' && Object.keys(frame).length === 3 && typeof frame.ns === 'string' && frame.ns.length > 0\n && typeof frame.revision === 'number' && Number.isSafeInteger(frame.revision) && frame.revision >= 0) {\n return { kind: 'changed', ns: frame.ns, revision: frame.revision }\n }\n throw new Error('Invalid model settings change frame')\n}\n\n/** One contribution mounted by Model Hub; consumers only inject its service. */\nexport const modelSettingsChangesRemote: TypertRemoteContribution = {\n package: MODEL_SETTINGS_CHANGES_REMOTE.package,\n descriptors: MODEL_SETTINGS_CHANGES_REMOTE.descriptors.map(descriptor => ({\n ...descriptor,\n result: { mode: 'strict' as const, typeSymbol: 'ModelSettings.ChangeFrame', create: () => ({ parse: parseModelSettingsChangeFrame }) },\n })),\n}\n\ninterface StreamItem {\n generation: number\n value: unknown\n signal: AbortSignal\n accept(): void\n}\ninterface ChangeStream extends AsyncIterable<StreamItem> { dispose(): Promise<void> }\nexport interface ModelSettingsSubscriberScope {\n remote: {\n modelSettingsChanges: { watch(signal: AbortSignal): AsyncIterable<unknown> }\n $stream(options: {\n name: string\n open(signal: AbortSignal): AsyncIterable<unknown>\n ended(accepted: boolean): Error\n }): ChangeStream\n }\n effect(callback: () => () => void | Promise<void>): unknown\n}\nexport interface ModelSettingsSubscriberContext {\n inject(dependencies: string[], callback: (scope: unknown) => void): unknown\n}\nexport interface ModelSettingsSubscriber {\n subscribe(onChange: () => void, onError?: (message: string) => void): () => void\n}\n\n/** Native RemoteStream owns carrier reconnects; no timers or browser transport.\n * A factory shares one logical stream while at least one subscriber remains. */\nexport function createModelSettingsSubscriber(ctx: ModelSettingsSubscriberContext, namespace: string): ModelSettingsSubscriber {\n const listeners = new Set<{ change: () => void; error?: (message: string) => void }>()\n let injection: { dispose(): void | Promise<void> } | undefined\n let current: { stream: ChangeStream; active: boolean } | undefined\n let lifecycle = 0\n let failureMessage: string | undefined\n const report = (message: string) => {\n failureMessage = message\n for (const listener of [...listeners]) {\n try { listener.error?.(message) } catch { /* Isolate page callbacks. */ }\n }\n }\n const invalidate = () => {\n for (const listener of [...listeners]) {\n if (!listeners.has(listener)) continue\n try { listener.change() } catch (error) {\n try { listener.error?.(error instanceof Error ? error.message : String(error)) } catch { /* Isolate callbacks. */ }\n }\n }\n }\n const start = () => {\n const life = ++lifecycle\n injection = ctx.inject(['remote', 'remote.modelSettingsChanges'], injected => {\n if (life !== lifecycle || !listeners.size) return\n const scope = injected as ModelSettingsSubscriberScope\n const stream = scope.remote.$stream({\n name: 'Model settings sync',\n open: signal => scope.remote.modelSettingsChanges.watch(signal),\n ended: accepted => new Error(`Model settings sync stream ended ${accepted ? 'after' : 'before'} ready; refresh or reopen the page`),\n })\n const session = { stream, active: true }\n current = session\n scope.effect(() => () => {\n session.active = false\n if (current === session) {\n current = undefined\n if (life === lifecycle && listeners.size) report('Model settings sync service unavailable')\n }\n return stream.dispose()\n })\n void (async () => {\n let generation: number | undefined\n let ready = false\n try {\n for await (const item of stream) {\n if (!session.active || life !== lifecycle || !listeners.size) break\n if (item.signal.aborted) continue\n if (generation !== item.generation) { generation = item.generation; ready = false }\n const frame = parseModelSettingsChangeFrame(item.value)\n if (frame.kind === 'ready') {\n ready = true\n failureMessage = undefined\n // Accept the validated invalidation baseline, not fetched data.\n // Every current listener queues its own latest settings read.\n item.accept()\n invalidate()\n } else {\n if (!ready) throw new Error('Model settings sync change arrived before ready')\n if (namespace === '*' || frame.ns === namespace) invalidate()\n }\n }\n } catch (error) {\n if (session.active && life === lifecycle) report(error instanceof Error ? error.message : String(error))\n } finally {\n if (current === session) current = undefined\n session.active = false\n await stream.dispose().catch(() => {})\n }\n })()\n }) as { dispose(): void | Promise<void> }\n queueMicrotask(() => {\n if (life === lifecycle && listeners.size && !current) report('Model settings sync service unavailable')\n })\n }\n return Object.freeze({ subscribe(onChange: () => void, onError?: (message: string) => void) {\n const listener = { change: onChange, error: onError }\n listeners.add(listener)\n if (!injection) start()\n else if (failureMessage) queueMicrotask(() => {\n if (listeners.has(listener) && failureMessage) {\n try { listener.error?.(failureMessage) } catch { /* Isolate callbacks. */ }\n }\n })\n return () => {\n if (!listeners.delete(listener) || listeners.size) return\n lifecycle++\n if (current) { current.active = false; void current.stream.dispose().catch(() => {}) }\n current = undefined\n failureMessage = undefined\n const previous = injection\n injection = undefined\n try { void Promise.resolve(previous?.dispose()).catch(() => {}) } catch { /* Already unloaded. */ }\n }\n } })\n}\n","import { defaultModelRoute, normalizeModelRoute, type ModelRoute } from '@klarkxy/dsh-model-route'\nexport { defaultModelRoute, normalizeModelRoute }\n\n/** Browser-safe contracts. Shared RPC/result types stay on @klarkxy/dsh-plugin-kit. */\nimport type { RpcResult as SharedRpcResult } from '@klarkxy/dsh-plugin-kit/contracts'\nexport type RpcResult<T = unknown> = Extract<SharedRpcResult<T>, { ok: true }> | {\n ok: false\n error: { code: string; message: string; partial?: PartialCommitResult }\n}\n\nexport const PLUGIN_NAME = '@klarkxy/dsh-git-commit'\nexport const FEATURE_ID = 'git-commit'\nexport const PURPOSE_ID = 'git-commit.plan'\nexport const RPC_CHANNEL = '/dsh-git-commit'\nexport const GIT_COMMIT_CLIENT_SERVICE = 'dshGitCommitClient'\nexport const PROMPT_VERSION = 'git-commit.v1'\nexport const SCHEMA_VERSION = 'commit-plan-json.v1'\nexport const CONTRACT_VERSION = 1\n\nexport const DEFAULT_MAX_OUTPUT_TOKENS = 2048\n/** Total character budget for the change manifest sent to the model. */\nexport const MAX_MANIFEST_CHARS = 48_000\n/** Per-file preview cap for untracked files. */\nexport const MAX_UNTRACKED_PREVIEW_CHARS = 2_000\n/** Recent commit subjects supplied as style reference. */\nexport const RECENT_LOG_COUNT = 10\n/** Hard cap for one generated commit message line. */\nexport const MAX_MESSAGE_CHARS = 120\n/** git subprocess timeout. */\nexport const GIT_TIMEOUT_MS = 30_000\nexport const SETTINGS_KEY = 'current'\n\n/**\n * Plugin-page model selection. Empty provider/model means \"follow the default\".\n * The value shape, empty default, and 250/80 normalizer live in\n * @klarkxy/dsh-model-route; this alias keeps the commit-specific name.\n */\nexport type CommitModelRoute = ModelRoute\n\nexport interface GitCommitSettings {\n readonly revision: number\n readonly model: CommitModelRoute\n /**\n * Opt-in single commit when the model produced no usable plan. Off by\n * default: an unplanned commit is one the user never reviewed, so a failed\n * or unusable model call rejects the run instead of writing to the index.\n */\n readonly allowFallback: boolean\n}\n\nexport const defaultSettings = (): GitCommitSettings => ({\n revision: 0, model: defaultModelRoute(), allowFallback: false,\n})\n\n/** Untrusted stored flags stay opt-in: anything but a literal true is false. */\nexport function normalizeFallback(value: unknown): boolean {\n return value === true\n}\n\nexport interface CommitModelInfo {\n readonly provider: string\n readonly model: string\n /** 'page' is the plugin-page selection; 'default' follows the session or host chat model. */\n readonly source: 'page' | 'default'\n}\n\nexport interface GitCommitStatus {\n readonly available: boolean\n /** Machine-readable reason when unavailable: 'no-session' | 'no-cwd' | 'not-a-repo' | 'no-git'. */\n readonly reason?: string\n readonly detail?: string\n readonly root?: string\n readonly branch?: string\n readonly workspace: { readonly files: number }\n readonly model?: CommitModelInfo\n}\n\nexport interface CommitGroupResult {\n /** Empty only when a created commit's hash could not be read. */\n readonly hash: string\n readonly message: string\n readonly files: readonly string[]\n}\n\nexport interface CommitRunResult {\n readonly branch: string\n readonly commits: readonly CommitGroupResult[]\n /** True when the model plan was unavailable and a single fallback commit was used. */\n readonly fallback: boolean\n readonly model?: CommitModelInfo\n}\n\n/**\n * Commits that already exist when a later group fails or the run is cancelled.\n * `commits` is the durable outcome; `failure` is why the rest did not run.\n * A recorded commit is never rolled back and never retried by this plugin.\n */\nexport interface PartialCommitResult {\n readonly branch: string\n readonly commits: readonly CommitGroupResult[]\n readonly fallback: boolean\n readonly model?: CommitModelInfo\n readonly failure: { readonly code: string; readonly message: string }\n readonly remaining: readonly { readonly message: string; readonly files: readonly string[] }[]\n /** After a rejected commit command, unchanged HEAD could not be proved; completion and ownership are unconfirmed. */\n readonly uncertain?: readonly { readonly message: string; readonly files: readonly string[] }[]\n}\n","import type { Context } from '@deepseek-ai/cordis'\nimport {\n modelMenuChoiceKey, modelMenuEffortOptions, parseModelMenuChoiceKey, parseModelMenuChoices,\n type ModelMenuChoice,\n} from '@klarkxy/dsh-plugin-kit/model-menu'\nimport { useCallback, useEffect, useRef, useState, useSyncExternalStore } from 'react'\nimport { createPortal } from 'react-dom'\nimport {\n Button, IconRefreshOutlineRegular, Switch, Tag, Tooltip, useAnchoredPosition, useDismissOnOutsidePointer,\n} from '@deepseek-ai/dsh-client-ui-primitives'\nimport { officialUiCss } from '@klarkxy/dsh-plugin-kit/official-ui'\nimport { createModelSettingsSubscriber } from '@klarkxy/dsh-plugin-kit/model-settings-client'\nimport {\n GIT_COMMIT_CLIENT_SERVICE, PLUGIN_NAME, RPC_CHANNEL, type CommitModelRoute, type CommitRunResult,\n type GitCommitSettings, type GitCommitStatus, type PartialCommitResult, type RpcResult,\n} from './contracts.ts'\n\nexport const name = 'dsh-git-commit-client'\nexport const inject = ['slots', 'connection', 'remote', 'remote.session', 'locale'] as const\n\nconst NS = 'dsh-git-commit.action'\n\nconst zh = {\n action: '提交',\n title: '提交到 Git',\n commitAction: '分次提交全部工作区修改',\n files: '个文件',\n model: '模型',\n modelDefault: '默认模型',\n modelCustom: '插件设置',\n filesCount: '({n} 个文件)',\n confirmPrompt: '将把 {n} 个文件的全部修改分次提交到当前分支。',\n confirm: '确认提交',\n cancel: '取消',\n loading: '正在读取仓库状态…',\n running: '正在整理修改并分次提交…',\n done: '已创建提交',\n partial: '本次提交未全部完成;以下提交已保留',\n stopped: '本次操作未确认完成',\n uncertain: '以下提交组的结果不确定。请检查 Git 日志和状态,确认后再操作。',\n hashUnavailable: '提交已创建,哈希未读取',\n remaining: '尚未提交:{n} 组',\n cancelled: '提交操作已取消',\n fallback: '模型不可用,已合并为单个提交',\n noWorkspace: '工作区没有修改',\n unavailable: '不可用',\n reasonNoRepo: '当前目录不在 Git 仓库中',\n reasonNoGit: '未找到 git 命令',\n reasonNoCwd: '会话没有工作目录',\n reasonNoSession: '会话不在线',\n sessionRunning: '会话正在运行,提交已暂停',\n refresh: '刷新',\n failed: '操作失败',\n disabled: '插件已停用',\n busy: '已有提交操作正在进行',\n stale: '设置已更新,请刷新后重试',\n workspaceChanged: '工作区或分支已变更,请刷新后重试提交',\n settingsUnavailable: '无法读取提交设置,请重新加载插件后重试',\n invalidRequest: '提交请求无效,请刷新后重试',\n planUnavailable: '模型没有给出可用的提交方案,已取消本次提交,工作区没有被改动。换一个模型重试,或在插件设置里开启兜底提交。',\n close: '关闭',\n}\n\nconst en: Record<keyof typeof zh, string> = {\n action: 'Commit',\n title: 'Commit to Git',\n commitAction: 'Commit all workspace changes',\n files: 'files',\n model: 'Model',\n modelDefault: 'default model',\n modelCustom: 'Plugin settings',\n filesCount: ' ({n} files)',\n confirmPrompt: 'All changes in {n} files will be committed to the current branch in one or more commits.',\n confirm: 'Commit now',\n cancel: 'Cancel',\n loading: 'Reading repository status…',\n running: 'Organizing changes into commits…',\n done: 'Commits created',\n partial: 'This run stopped before completion; these commits were kept',\n stopped: 'This run did not finish with a confirmed result',\n uncertain: 'The outcome of these groups is uncertain. Check Git log and status before taking further action.',\n hashUnavailable: 'Commit created; hash unavailable',\n remaining: 'Groups not committed: {n}',\n cancelled: 'Commit run cancelled',\n fallback: 'Model unavailable; used a single commit',\n noWorkspace: 'No workspace changes',\n unavailable: 'Unavailable',\n reasonNoRepo: 'Current directory is not inside a Git repository',\n reasonNoGit: 'git executable not found',\n reasonNoCwd: 'Session has no working directory',\n reasonNoSession: 'Session is not live',\n sessionRunning: 'Session is running; commits paused',\n refresh: 'Refresh',\n failed: 'Operation failed',\n disabled: 'Plugin disabled',\n busy: 'A commit run is already in progress',\n stale: 'Settings changed; refresh and retry',\n workspaceChanged: 'The workspace or branch changed; refresh and retry the commit',\n settingsUnavailable: 'Could not read commit settings; reload the plugin and retry',\n invalidRequest: 'Invalid commit request; refresh and retry',\n planUnavailable: 'The model returned no usable commit plan, so the run was cancelled and your workspace is untouched. Try another model, or turn on the fallback in plugin settings.',\n close: 'Close',\n}\n\ntype Key = keyof typeof zh\ntype Translate = (key: Key) => string\n\ninterface ConnectionLike {\n rpc: { call(channel: string, endpoint: string, payload: unknown): Promise<unknown> }\n}\n\ninterface SessionSnapshotLike {\n running?: boolean\n}\n\ninterface UseSessionLike {\n <T>(selector: (snapshot: SessionSnapshotLike) => T): T\n}\n\n/** A failed RPC keeps its code so the panel can explain a rejection in its own words. */\nclass RpcError extends Error {\n readonly code: string\n readonly partial?: PartialCommitResult\n constructor(code: string, message: string, partial?: PartialCommitResult) {\n super(message)\n this.name = 'RpcError'\n this.code = code\n this.partial = partial\n }\n}\n\nexport interface GitCommitActionProps {\n sessionId: string\n useSession: UseSessionLike\n call: (endpoint: string, payload: unknown) => Promise<unknown>\n t: Translate\n}\n\nasync function rpc<T>(\n call: GitCommitActionProps['call'], endpoint: string, payload: unknown = {}, fallback = '',\n): Promise<T> {\n const result = await call(endpoint, payload) as RpcResult<T> | undefined\n if (!result || result.ok !== true) {\n const failed = result && 'error' in result ? result.error : undefined\n throw new RpcError(failed?.code ?? 'unknown', failed?.message ? failed.message : fallback,\n failed && 'partial' in failed ? failed.partial : undefined)\n }\n return result.value\n}\n\nfunction reasonText(t: Translate, status: GitCommitStatus): string {\n switch (status.reason) {\n case 'not-a-repo': return t('reasonNoRepo')\n case 'no-git': return t('reasonNoGit')\n case 'no-cwd': return t('reasonNoCwd')\n case 'no-session': return t('reasonNoSession')\n default: return t('unavailable')\n }\n}\n\n/** A refusal the plugin can name gets its own sentence; the rest stay verbatim. */\nfunction errorText(t: Translate, error: { code: string; message: string }): string {\n const keys: Record<string, Key> = {\n 'plan-unavailable': 'planUnavailable', 'no-session': 'reasonNoSession', 'no-cwd': 'reasonNoCwd',\n 'no-git': 'reasonNoGit', 'not-a-repo': 'reasonNoRepo', 'no-changes': 'noWorkspace',\n 'session-running': 'sessionRunning', 'session-changed': 'workspaceChanged', 'workspace-changed': 'workspaceChanged',\n busy: 'busy', stale: 'stale', disposed: 'disabled', cancelled: 'cancelled',\n 'settings-unavailable': 'settingsUnavailable', 'bad-request': 'invalidRequest', 'not-found': 'invalidRequest',\n }\n const key = keys[error.code]\n return key ? t(key) : error.message || t('failed')\n}\n\nfunction panelError(reason: unknown): { code: string; message: string } {\n return reason instanceof RpcError\n ? { code: reason.code, message: reason.message }\n : { code: 'unknown', message: reason instanceof Error ? reason.message : String(reason) }\n}\n\nfunction GitBranchIcon() {\n return (\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\">\n <circle cx=\"4.5\" cy=\"3.5\" r=\"1.6\" stroke=\"currentColor\" strokeWidth=\"1.2\" />\n <circle cx=\"4.5\" cy=\"12.5\" r=\"1.6\" stroke=\"currentColor\" strokeWidth=\"1.2\" />\n <circle cx=\"11.5\" cy=\"6.5\" r=\"1.6\" stroke=\"currentColor\" strokeWidth=\"1.2\" />\n <path d=\"M4.5 5.1v5.8\" stroke=\"currentColor\" strokeWidth=\"1.2\" />\n <path d=\"M11.5 8.1c0 2-1.6 2.9-3.4 3\" stroke=\"currentColor\" strokeWidth=\"1.2\" />\n </svg>\n )\n}\n\nexport function GitCommitAction({ sessionId, useSession, call, t }: GitCommitActionProps) {\n const [open, setOpen] = useState(false)\n const [status, setStatus] = useState<GitCommitStatus>()\n const [loading, setLoading] = useState(false)\n const [running, setRunning] = useState(false)\n const [result, setResult] = useState<CommitRunResult | PartialCommitResult | null>(null)\n const [error, setError] = useState<{ code: string; message: string } | null>(null)\n const [confirming, setConfirming] = useState(false)\n const rootRef = useRef<HTMLDivElement>(null)\n const triggerRef = useRef<HTMLButtonElement>(null)\n const panelRef = useRef<HTMLDivElement>(null)\n const generationRef = useRef(0)\n const position = useAnchoredPosition({ open, anchorRef: triggerRef, panelRef, gap: 5, margin: 16 })\n const sessionRunning = useSession(snapshot => snapshot.running === true)\n\n const changeOpen = useCallback((next: boolean) => {\n setOpen(next)\n setConfirming(false)\n if (next) {\n setResult(null)\n setError(null)\n }\n }, [])\n\n // Move focus into the dialog once it is positioned, so keyboard users land inside it.\n const positioned = Boolean(position)\n useEffect(() => {\n if (open && positioned) panelRef.current?.focus()\n }, [open, positioned])\n\n useDismissOnOutsidePointer(rootRef, open, changeOpen, panelRef)\n\n useEffect(() => {\n generationRef.current += 1\n setOpen(false)\n setStatus(undefined)\n setResult(null)\n setError(null)\n setRunning(false)\n }, [sessionId])\n\n const loadStatus = useCallback(async () => {\n const generation = generationRef.current\n setLoading(true)\n setError(null)\n try {\n const next = await rpc<GitCommitStatus>(call, 'status', { sessionId })\n if (generationRef.current !== generation) return\n setStatus(next)\n } catch (reason) {\n if (generationRef.current !== generation) return\n setStatus(undefined)\n setError(panelError(reason))\n } finally {\n if (generationRef.current === generation) setLoading(false)\n }\n }, [call, sessionId])\n\n useEffect(() => {\n if (!open) return\n void loadStatus()\n }, [open, loadStatus])\n\n useEffect(() => {\n if (!open) return\n const dismiss = (event: KeyboardEvent) => {\n if (event.key !== 'Escape') return\n event.preventDefault()\n changeOpen(false)\n triggerRef.current?.focus()\n }\n document.addEventListener('keydown', dismiss)\n return () => document.removeEventListener('keydown', dismiss)\n }, [open, changeOpen])\n\n const runCommit = useCallback(async () => {\n const generation = generationRef.current\n setConfirming(false)\n setRunning(true)\n setResult(null)\n setError(null)\n try {\n const value = await rpc<CommitRunResult>(call, 'commit', { sessionId })\n if (generationRef.current !== generation) return\n setResult(value)\n } catch (reason) {\n if (generationRef.current !== generation) return\n if (reason instanceof RpcError && reason.partial) setResult(reason.partial)\n setError(panelError(reason))\n } finally {\n if (generationRef.current === generation) {\n // Even a rejected run may have durable commits or changed the index.\n const next = await rpc<GitCommitStatus>(call, 'status', { sessionId }).catch(() => undefined)\n if (generationRef.current === generation) {\n setStatus(next)\n setRunning(false)\n }\n }\n }\n }, [call, sessionId])\n\n const available = status?.available === true\n const workspaceCount = status?.workspace.files ?? 0\n const canCommit = available && !running && !sessionRunning && workspaceCount > 0\n\n return (\n <div ref={rootRef} className=\"gcm-root\">\n <Tooltip label={t('title')} side=\"bottom\" gap={4}>\n <Button\n ref={triggerRef}\n variant=\"ghost\"\n size=\"sm\"\n icon={<GitBranchIcon />}\n aria-label={t('title')}\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n onClick={() => changeOpen(!open)}\n >\n {t('action')}\n </Button>\n </Tooltip>\n {open && createPortal(\n <div\n ref={panelRef}\n className=\"gcm-root dsh-ui-surface gcm-panel\"\n style={position ?? { visibility: 'hidden', left: 0, top: 0 }}\n role=\"dialog\"\n tabIndex={-1}\n aria-label={t('title')}\n >\n <div className=\"dsh-ui-surface-body\">\n <div className=\"dsh-ui-surface-head\">\n <span className=\"dsh-ui-surface-title\">{t('title')}</span>\n {status?.branch ? <span className=\"dsh-ui-hint dsh-ui-truncate\">{status.branch}</span> : null}\n <span className=\"dsh-ui-spacer\" />\n <Tooltip label={t('refresh')} side=\"bottom\" gap={4}>\n <Button variant=\"ghost\" size=\"sm\" aria-label={t('refresh')} icon={<IconRefreshOutlineRegular size={14} />}\n disabled={loading || running} onClick={() => void loadStatus()} />\n </Tooltip>\n </div>\n {loading && !status && <p className=\"dsh-ui-hint\" role=\"status\">{t('loading')}</p>}\n {error !== null && <p className=\"dsh-ui-error\" role=\"alert\">{errorText(t, error)}</p>}\n {status && !available && <p className=\"dsh-ui-meta\" role=\"status\">{reasonText(t, status)}</p>}\n {available && (\n <>\n {status?.model ? (\n <p className=\"gcm-model\">\n <span className=\"dsh-ui-hint\">{t('model')}</span>\n <span className=\"dsh-ui-truncate\">{status.model.provider}/{status.model.model}</span>\n <Tag tone={status.model.source === 'page' ? 'info' : 'neutral'}>\n {status.model.source === 'page' ? t('modelCustom') : t('modelDefault')}\n </Tag>\n </p>\n ) : null}\n {confirming && canCommit ? (\n <div className=\"dsh-ui-stack\" role=\"group\" aria-label={t('commitAction')}>\n <p className=\"dsh-ui-hint dsh-ui-wrap\">{t('confirmPrompt').replace('{n}', String(workspaceCount))}</p>\n <div className=\"dsh-ui-actions\">\n <Button variant=\"ghost\" size=\"md\" onClick={() => setConfirming(false)}>{t('cancel')}</Button>\n <Button variant=\"primary\" size=\"md\" onClick={() => void runCommit()}>{t('confirm')}</Button>\n </div>\n </div>\n ) : (\n <Button variant=\"primary\" size=\"md\"\n disabled={!canCommit}\n onClick={() => setConfirming(true)}>\n {t('commitAction')}{t('filesCount').replace('{n}', String(workspaceCount))}\n </Button>\n )}\n {workspaceCount === 0 && <p className=\"dsh-ui-hint\">{t('noWorkspace')}</p>}\n {sessionRunning && <p className=\"dsh-ui-hint\">{t('sessionRunning')}</p>}\n </>\n )}\n {running && <p className=\"dsh-ui-hint\" role=\"status\">{t('running')}</p>}\n {result && (\n <div className=\"dsh-ui-stack\">\n <p className=\"dsh-ui-hint dsh-ui-wrap\">{t('failure' in result ? result.commits.length ? 'partial' : 'stopped' : 'done')} · {result.branch}</p>\n <ul className=\"gcm-commits\">\n {result.commits.map((commit, index) => (\n <li key={`${index}:${commit.hash}`}>\n <code>{commit.hash || t('hashUnavailable')}</code> {commit.message}\n <div className=\"dsh-ui-hint\">{commit.files.join(', ')}</div>\n </li>\n ))}\n </ul>\n {result.fallback && <p className=\"dsh-ui-hint\">{t('fallback')}</p>}\n {'uncertain' in result && result.uncertain?.length ? <>\n <p className=\"dsh-ui-hint\" role=\"status\">{t('uncertain')}</p>\n <ul className=\"gcm-commits\">\n {result.uncertain.map((group, index) => <li key={index}>{group.message}\n <div className=\"dsh-ui-hint\">{group.files.join(', ')}</div>\n </li>)}\n </ul>\n </> : null}\n {'remaining' in result && <>\n <p className=\"dsh-ui-hint\">{t('remaining').replace('{n}', String(result.remaining.length))}</p>\n <ul className=\"gcm-commits\">\n {result.remaining.map((group, index) => <li key={index}>{group.message}\n <div className=\"dsh-ui-hint\">{group.files.join(', ')}</div>\n </li>)}\n </ul>\n </>}\n </div>\n )}\n </div>\n </div>,\n document.body,\n )}\n </div>\n )\n}\n\nexport const clientCss = `${officialUiCss('gcm-root')}\n/* Only the floating panel's geometry is this plugin's own: the material, the\n * rounded edge and the scrollbar tokens all come from the shared contract.\n *\n * The root class is spelled out because the panel is portaled and *is* the\n * root: the dsh-ui-surface recipe therefore reaches it as a compound\n * .gcm-root.dsh-ui-surface selector and declares position:relative at the\n * weight a bare .gcm-panel rule also carries. Left unqualified that recipe\n * wins, and the anchored left/top degrade into offsets from the panel's static\n * spot at the end of body — the popover then renders under the page instead\n * of at the trigger. Naming both classes puts this rule at the same weight,\n * later in the sheet, so it wins. */\n.gcm-root.gcm-panel { position: fixed; width: min(360px, calc(100vw - 32px)); max-height: min(560px, calc(100vh - 32px)); overflow: auto; }\n.gcm-model { display: flex; align-items: center; gap: 6px; min-width: 0; margin: 0; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-primary); }\n.gcm-commits { margin: 0; padding-inline-start: 18px; display: grid; gap: 2px; font-size: 12px; line-height: 18px; overflow-wrap: anywhere; }\n.gcm-commits code { font-size: 12px; background: var(--dsw-alias-bg-layer-2); padding: 0 4px; border-radius: var(--dsw-radius-sm); }\n.gcm-settings { display: flex; flex-direction: column; gap: 12px; min-width: 0; }\n.gcm-settings-status { display: flex; flex-direction: column; gap: 4px; }\n`\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context { dshGitCommitClient: { active: boolean } }\n}\n\ntype Client = Context & {\n connection: ConnectionLike\n remote?: { session?: { modelCatalog?: () => Promise<unknown> } }\n slots: {\n inject(key: string, callback: () => unknown): () => void\n register(spec: { name: string; id: string; order: number; locale: string; inject: () => unknown } | { name: string; key: string }, render: unknown): () => void\n }\n locale: {\n register(ns: string, locales: { zh: Record<string, string>; en: Record<string, string> }): () => void\n getSnapshot?(): { active: string }\n subscribe?(listener: () => void): () => void\n }\n}\n\n/** Host UI language, following live switches with the host's English fallback. */\nfunction useHostLocale(client: Client): string {\n const subscribe = useCallback(\n (listener: () => void) => client.locale.subscribe?.(listener) ?? (() => {}),\n [client],\n )\n const snapshot = useCallback(() => client.locale.getSnapshot?.().active ?? 'en', [client])\n return useSyncExternalStore(subscribe, snapshot, snapshot)\n}\n\nconst settingsZh = {\n pageTitle: 'Git 提交',\n model: '提交规划模型',\n modelDefault: '默认模型',\n modelEffort: '思考强度',\n modelHint: '留空则使用当前会话模型,再回落到宿主默认对话模型。',\n fallback: '模型不可用时仍然提交',\n fallbackHint: '默认关闭:模型规划失败会取消本次提交,工作区不变。开启后全部改动会合并成一个提交,由插件代写提交信息。',\n loading: '正在读取设置…',\n saved: '已保存。',\n stale: '设置已更新,请刷新后重试。',\n failed: '无法读取提交设置。',\n retry: '重试',\n refresh: '刷新设置',\n syncUnavailable: '自动刷新不可用,请手动刷新设置。',\n}\n\nconst settingsEn: Record<keyof typeof settingsZh, string> = {\n pageTitle: 'Git Commit',\n model: 'Commit planning model',\n modelDefault: 'Default model',\n modelEffort: 'Reasoning effort',\n modelHint: 'Leave empty to use the current session model, then the host default chat model.',\n fallback: 'Commit even without a model plan',\n fallbackHint: 'Off by default: a failed plan cancels the run and leaves the workspace untouched. When on, every change lands in one commit with a plugin-written message.',\n loading: 'Loading settings…',\n saved: 'Saved.',\n stale: 'Settings changed; refresh and retry.',\n failed: 'Could not load commit settings.',\n retry: 'Retry',\n refresh: 'Refresh settings',\n syncUnavailable: 'Automatic refresh unavailable; refresh settings manually.',\n}\n\nfunction settingsCopy(locale: string): Record<keyof typeof settingsZh, string> {\n return String(locale).startsWith('zh') ? settingsZh : settingsEn\n}\n\n/** Plugin-page settings row: pick the model this plugin's planning call uses. */\nexport function GitCommitSettingsPanel(props: { client: Client; locale?: string; subscribeSettings?: (change: () => void, error?: (message: string) => void) => () => void }) {\n const hostLocale = useHostLocale(props.client)\n const text = settingsCopy(props.locale ?? hostLocale)\n const [settings, setSettings] = useState<GitCommitSettings | undefined>(undefined)\n const [choices, setChoices] = useState<ModelMenuChoice[]>([])\n const [error, setError] = useState<'' | 'failed' | 'stale'>('')\n const [note, setNote] = useState(false)\n const [busy, setBusy] = useState(false)\n const [syncError, setSyncError] = useState('')\n const operation = useRef({ epoch: 0, active: false, reading: false, writing: false, pending: false })\n const refreshRef = useRef<() => void>(() => {})\n\n const call = useCallback(\n (endpoint: string, payload: unknown = {}) => props.client.connection.rpc.call(RPC_CHANNEL, endpoint, payload),\n [props.client],\n )\n\n const refresh = () => {\n const state = operation.current\n if (!state.active) return\n if (state.reading || state.writing) { state.pending = true; return }\n state.pending = false; state.reading = true; setBusy(true)\n const epoch = state.epoch\n void rpc<GitCommitSettings>(call, 'settings', {}, text.failed).then(next => {\n if (state.active && state.epoch === epoch && !state.pending) { setSettings(next); setError('') }\n }).catch(() => {\n if (state.active && state.epoch === epoch && !state.pending) setError('failed')\n }).finally(() => {\n if (!state.active || state.epoch !== epoch) return\n state.reading = false; setBusy(false)\n if (state.pending) refreshRef.current()\n })\n }\n refreshRef.current = refresh\n useEffect(() => {\n const state = operation.current\n state.epoch++; state.active = true; state.reading = false; state.writing = false; state.pending = false\n setBusy(false); setSettings(undefined); setError(''); setNote(false)\n refreshRef.current()\n return () => { state.active = false; state.epoch++ }\n }, [call])\n useEffect(() => {\n setSyncError('')\n let live = true\n const stop = props.subscribeSettings?.(() => { if (live) { setSyncError(''); refreshRef.current() } }, message => { if (live) setSyncError(message) })\n return () => { live = false; stop?.() }\n }, [props.subscribeSettings, props.client])\n\n const boundProvider = settings?.model.provider ?? ''\n const boundModel = settings?.model.model ?? ''\n useEffect(() => {\n let live = true\n const bound = boundProvider && boundModel ? { provider: boundProvider, model: boundModel } : undefined\n void props.client.remote?.session?.modelCatalog?.()\n ?.then(value => { if (live) setChoices(parseModelMenuChoices(value, bound)) })\n .catch(() => { if (live) setChoices([]) })\n return () => { live = false }\n }, [props.client, boundProvider, boundModel])\n\n // One patch shape for both rows: the service replaces the whole row, so an\n // update to the toggle must carry the model it is not changing.\n const save = useCallback((patch: { model?: CommitModelRoute; allowFallback?: boolean }) => {\n const state = operation.current\n if (!settings || !state.active || state.writing || state.reading) return\n state.writing = true\n const epoch = state.epoch\n setBusy(true); setNote(false); setError('')\n void rpc<GitCommitSettings>(call, 'settings.update', {\n settings: {\n model: patch.model ?? settings.model,\n allowFallback: patch.allowFallback ?? settings.allowFallback,\n },\n expectedRevision: settings.revision,\n }, text.stale).then(next => {\n if (state.active && state.epoch === epoch) { setSettings(next); setNote(true) }\n }).catch(() => {\n if (state.active && state.epoch === epoch) setError('stale')\n }).finally(() => {\n if (!state.active || state.epoch !== epoch) return\n state.writing = false; setBusy(false)\n if (state.pending) refreshRef.current()\n })\n }, [call, settings, text.saved, text.stale])\n\n if (!settings) {\n return (\n <section className=\"gcm-root gcm-settings\">\n {error\n ? <p role=\"alert\" className=\"dsh-ui-error\">{text[error]}</p>\n : <p role=\"status\" className=\"dsh-ui-hint\">{text.loading}</p>}\n {syncError && <p role=\"status\" className=\"dsh-ui-hint\">{text.syncUnavailable}</p>}\n <Button variant=\"ghost\" size=\"sm\" disabled={busy} onClick={() => refreshRef.current()}>{text.retry}</Button>\n </section>\n )\n }\n\n const current = settings.model\n const selected = choices.find(item => item.provider === current.provider && item.model === current.model)\n const efforts = modelMenuEffortOptions(selected, current.reasoningEffort)\n\n return (\n <section className=\"gcm-root gcm-settings\" data-testid=\"git-commit-settings\">\n <div className=\"gcm-settings-status\">\n {syncError && <p role=\"status\" className=\"dsh-ui-hint\">{text.syncUnavailable}</p>}\n <Button variant=\"ghost\" size=\"sm\" disabled={busy} onClick={() => refreshRef.current()}>{text.refresh}</Button>\n {error && <p role=\"alert\" className=\"dsh-ui-error\">{text[error]}</p>}\n {note && <p role=\"status\" className=\"dsh-ui-notice\">{text.saved}</p>}\n </div>\n <label className=\"dsh-ui-field\">\n <span className=\"dsh-ui-label\">{text.model}</span>\n <select\n className=\"dsh-ui-select\"\n value={modelMenuChoiceKey(current.provider, current.model)}\n disabled={busy}\n onChange={event => {\n const key = event.target.value\n if (!key) { save({ model: { provider: '', model: '' } }); return }\n const parsed = parseModelMenuChoiceKey(key)\n if (parsed) save({ model: parsed })\n }}\n >\n <option value=\"\">{text.modelDefault}</option>\n {choices.map(choice => (\n <option key={modelMenuChoiceKey(choice.provider, choice.model)} value={modelMenuChoiceKey(choice.provider, choice.model)}>\n {choice.label}\n </option>\n ))}\n </select>\n </label>\n {selected && efforts.length > 0 && (\n <label className=\"dsh-ui-field\">\n <span className=\"dsh-ui-label\">{text.modelEffort}</span>\n <select\n className=\"dsh-ui-select\"\n value={current.reasoningEffort ?? ''}\n disabled={busy}\n onChange={event => save({ model: { ...current, reasoningEffort: event.target.value || undefined } })}\n >\n <option value=\"\">{text.modelDefault}</option>\n {efforts.map(effort => <option key={effort.id} value={effort.id}>{effort.name}</option>)}\n </select>\n </label>\n )}\n <p className=\"dsh-ui-meta\">{text.modelHint}</p>\n <article className=\"gcm-root dsh-ui-card\">\n <header className=\"dsh-ui-toggle-row\">\n <div className=\"dsh-ui-toggle-text\">\n <h3 className=\"dsh-ui-toggle-label\">{text.fallback}</h3>\n <p className=\"dsh-ui-hint\">{text.fallbackHint}</p>\n </div>\n <Switch\n checked={settings.allowFallback}\n label={text.fallback}\n disabled={busy}\n onChange={next => save({ allowFallback: next })}\n />\n </header>\n </article>\n </section>\n )\n}\n\nexport function apply(ctx: Context): void {\n const client = ctx as unknown as Client\n const settingsSubscriber = createModelSettingsSubscriber(ctx, PLUGIN_NAME)\n const subscribeSettings = (change: () => void, error?: (message: string) => void) => settingsSubscriber.subscribe(change, error)\n ctx.provide(GIT_COMMIT_CLIENT_SERVICE, { active: true })\n ctx.effect(() => client.locale.register(NS, { zh: { ...zh }, en: { ...en } }), 'git-commit.locale')\n // One stylesheet for both the header popover and the plugin-page settings,\n // so the settings page is styled even when no session header is mounted.\n ctx.effect(() => {\n if (typeof document === 'undefined') return () => {}\n const style = document.createElement('style')\n style.setAttribute('data-plugin', name)\n style.textContent = clientCss\n document.head.appendChild(style)\n return () => style.remove()\n }, 'git-commit.styles')\n ctx.effect(() => client.slots.inject('plugins.bundle.config', () => client.slots.register(\n { name: 'plugins.bundle.config', key: PLUGIN_NAME },\n () => <GitCommitSettingsPanel client={client} subscribeSettings={subscribeSettings} />,\n )), 'git-commit.settings')\n ctx.effect(() => client.slots.inject('conversation.session.header.actions', () => client.slots.register(\n {\n name: 'conversation.session.header.actions',\n id: 'git-commit',\n order: 10,\n locale: NS,\n inject: () => ({\n call: (endpoint: string, payload: unknown) => client.connection.rpc.call(RPC_CHANNEL, endpoint, payload),\n }),\n },\n GitCommitAction,\n )), 'git-commit.slot')\n}\n"],"mappings":";;;;;;AAyDA,MAAM,gBAAgB;;AAGtB,SAAgB,cAAc,UAAkB,OAAuB;CACrE,OAAO,YAAY,QAAQ,GAAG,WAAW,gBAAgB,UAAU;AACrE;;AAGA,SAAgB,mBAAmB,OAAgE;CACjG,MAAM,QAAQ,MAAM,QAAQ,aAAa;CACzC,IAAI,SAAS,GAAG,OAAO,KAAA;CACvB,MAAM,WAAW,MAAM,MAAM,GAAG,KAAK;CACrC,MAAM,QAAQ,MAAM,MAAM,QAAQ,CAAoB;CACtD,IAAI,CAAC,YAAY,CAAC,OAAO,OAAO,KAAA;CAChC,OAAO;EAAE;EAAU;CAAM;AAC3B;;;AClDA,SAAS,SAAS,OAAqD;CACrE,OAAO,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,IAAI,QAAmC,KAAA;AAC1G;AAEA,SAAS,OAAO,OAAoC;CAClD,OAAO,OAAO,UAAU,YAAY,MAAM,KAAK,IAAI,MAAM,KAAK,IAAI,KAAA;AACpE;AAEA,SAAS,YAAY,OAA0D;CAC7E,MAAM,MAAM,SAAS,KAAK;CAC1B,MAAM,KAAK,MAAM,OAAO,IAAI,EAAE,IAAI,KAAA;CAClC,IAAI,CAAC,IAAI,OAAO,KAAA;CAChB,OAAO;EAAE;EAAI,MAAM,MAAM,OAAO,IAAI,IAAI,KAAK,KAAK;CAAG;AACv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