dsh-quick-actions 0.1.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.en.md +199 -0
- package/README.md +199 -0
- package/cordis.patch.yml +29 -0
- package/lib/client.js +3901 -0
- package/lib/client.js.map +1 -0
- package/lib/index.js +737 -0
- package/lib/types/client/controller.d.ts +207 -0
- package/lib/types/client/dsh.d.ts +171 -0
- package/lib/types/client/index.d.ts +43 -0
- package/lib/types/client/manager/ActionForm.d.ts +20 -0
- package/lib/types/client/manager/ActionPanel.d.ts +15 -0
- package/lib/types/client/manager/ManagedRow.d.ts +40 -0
- package/lib/types/client/manager/ManagerPanel.d.ts +9 -0
- package/lib/types/client/manager/press.d.ts +38 -0
- package/lib/types/client/manager/search.d.ts +56 -0
- package/lib/types/client/manager/status.d.ts +23 -0
- package/lib/types/client/modal.d.ts +55 -0
- package/lib/types/client/session/ConfirmPanel.d.ts +23 -0
- package/lib/types/client/session/availability.d.ts +19 -0
- package/lib/types/client/session/execution.d.ts +86 -0
- package/lib/types/client/session/guards.d.ts +59 -0
- package/lib/types/client/surfaces/ActionFace.d.ts +21 -0
- package/lib/types/client/surfaces/ErrorBoundary.d.ts +31 -0
- package/lib/types/client/surfaces/QuickActionsSurface.d.ts +17 -0
- package/lib/types/client/surfaces/entries.d.ts +27 -0
- package/lib/types/client/surfaces/layout.d.ts +49 -0
- package/lib/types/client/surfaces/residency.d.ts +65 -0
- package/lib/types/host/config.d.ts +18 -0
- package/lib/types/host/index.d.ts +38 -0
- package/lib/types/host/presets.d.ts +26 -0
- package/lib/types/host/settings.d.ts +113 -0
- package/lib/types/index.d.ts +35 -0
- package/lib/types/locales/index.d.ts +34 -0
- package/lib/types/model/catalog.d.ts +63 -0
- package/lib/types/model/index.d.ts +13 -0
- package/lib/types/model/json.d.ts +11 -0
- package/lib/types/model/mutations.d.ts +98 -0
- package/lib/types/model/normalize.d.ts +15 -0
- package/lib/types/model/projection.d.ts +49 -0
- package/lib/types/model/settings.d.ts +48 -0
- package/lib/types/model/text.d.ts +28 -0
- package/lib/types/model/types.d.ts +89 -0
- package/lib/types/model/validation.d.ts +40 -0
- package/lib/types/styles/index.d.ts +39 -0
- package/lib/types/types.d.ts +11 -0
- package/lib/types.js +1 -0
- package/package.json +83 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","names":["messageOf","Component","Fragment","Pill","useRef","useCallback","useState","Input","IconSearchOutline16","Button","Button","useRef","useState","useId","useMemo","useCallback","useId","useRef","Button","Pill","Button","useCallback","useId","useState","createPortal","Button","useSyncExternalStore","useCallback","useMemo"],"sources":["../src/model/types.ts","../src/model/json.ts","../src/model/text.ts","../src/model/validation.ts","../src/model/catalog.ts","../src/model/settings.ts","../src/model/normalize.ts","../src/model/projection.ts","../src/model/mutations.ts","../src/client/controller.ts","../src/client/session/guards.ts","../src/client/session/execution.ts","../src/client/surfaces/residency.ts","../src/client/surfaces/ErrorBoundary.tsx","../src/client/surfaces/ActionFace.tsx","../src/client/surfaces/layout.ts","../src/client/manager/search.ts","../src/client/modal.ts","../src/client/session/availability.ts","../src/client/manager/ActionPanel.tsx","../src/client/session/ConfirmPanel.tsx","../src/client/surfaces/QuickActionsSurface.tsx","../src/client/manager/press.ts","../src/locales/index.ts","../src/client/manager/ActionForm.tsx","../src/client/manager/ManagedRow.tsx","../src/client/manager/status.ts","../src/client/manager/ManagerPanel.tsx","../src/client/surfaces/entries.tsx","../src/styles/index.ts","../src/client/index.tsx"],"sourcesContent":["/**\n * Normalized Quick Action domain types (spec 4.1, 4.2) plus the field-issue\n * vocabulary every validation entry point reports through (spec 4.3).\n * Every type here is plain JSON: no cordis, React, DOM or storage handles.\n */\n\n/** Author-assigned, package-scoped, permanent identity of a Preset Quick Action. */\nexport type PresetActionId = string\n/** UUID minted when a Custom Quick Action is created; stable for its whole life. */\nexport type CustomActionId = string\n\n/**\n * Action-type discriminant. The first release is always `'send'`; it is not a\n * configuration field. Keeping the tag lets a later Insert Action ship without\n * raising `schemaVersion` or rewriting stored user data (spec 4.1, 16.1).\n */\nexport type QuickActionKind = 'send'\n\n/** The three global Quick Action Layouts (spec 8.1). */\nexport type QuickActionLayout = 'ribbon' | 'bar' | 'launcher'\n\n/** Every layout value, in the order the management panel offers them. */\nexport const QUICK_ACTION_LAYOUTS: readonly QuickActionLayout[] = ['ribbon', 'bar', 'launcher']\n\n/** Author-owned, user-read-only action from the Preset Catalog (spec 4.1). */\nexport interface PresetQuickAction {\n readonly id: PresetActionId\n readonly kind: QuickActionKind\n readonly label: string\n readonly text: string\n readonly icon?: string\n readonly confirm: boolean\n}\n\n/** User-owned action stored in Settings (spec 4.1). */\nexport interface CustomQuickActionValue {\n readonly kind: QuickActionKind\n readonly label: string\n readonly text: string\n readonly icon?: string\n readonly confirm: boolean\n readonly enabled: boolean\n readonly clonedFromPresetId?: PresetActionId\n}\n\n/**\n * A stored custom entry this release cannot render: its `kind` is not `'send'`\n * (real data from a higher version) or its label/text are not readable strings.\n * Preserved verbatim — never displayed, counted, edited or rewritten (spec 5.3).\n * Every field stays opaque on purpose, `kind` included: this release must hand\n * the record back to the version that wrote it exactly as it found it.\n */\nexport interface QuickActionTombstone {\n readonly [field: string]: unknown\n}\n\n/** One entry of `userActionsById`: either a live send action or a preserved tombstone. */\nexport type StoredQuickActionValue = CustomQuickActionValue | QuickActionTombstone\n\n/** Reference into the single mixed order shared by presets and custom actions (spec 4.1). */\nexport type QuickActionRef =\n | { readonly source: 'preset'; readonly id: PresetActionId }\n | { readonly source: 'custom'; readonly id: CustomActionId }\n\n/**\n * The identity of a reference as one comparable string. Source and id together\n * are the identity: the same id under a different source is a different action.\n */\nexport function quickActionRefKey(ref: QuickActionRef): string {\n return `${ref.source}:${ref.id}`\n}\n\n/**\n * User difference stored against one Preset Action ID (spec 4.2). `hidden` is the\n * only field this release writes; any other field belongs to the version that\n * wrote it and is carried through untouched.\n */\nexport interface PresetQuickActionState {\n readonly hidden?: boolean\n readonly [field: string]: unknown\n}\n\n/** The only persisted namespace shape (spec 4.2). */\nexport interface QuickActionSettingsV1 {\n readonly schemaVersion: 1\n readonly layout: QuickActionLayout\n readonly userActionsById: Readonly<Record<CustomActionId, StoredQuickActionValue>>\n readonly actionOrder: readonly QuickActionRef[]\n readonly presetStateById: Readonly<Record<PresetActionId, PresetQuickActionState>>\n}\n\n/** Fields a validation issue can be attached to. */\nexport type QuickActionField =\n | 'id'\n | 'kind'\n | 'label'\n | 'text'\n | 'icon'\n | 'confirm'\n | 'enabled'\n | 'clonedFromPresetId'\n\n/** Why a field was rejected. Combined with `field` it addresses one dictionary entry. */\nexport type QuickActionIssueReason =\n | 'invalid-type'\n | 'missing'\n | 'blank'\n | 'too-long'\n | 'reserved-placeholder'\n | 'not-emoji'\n | 'duplicate'\n | 'unsupported'\n\n/** One field-level rejection, reported identically by config loading, forms and mutations. */\nexport interface QuickActionFieldIssue {\n readonly field: QuickActionField\n readonly reason: QuickActionIssueReason\n}\n","/**\n * JSON structural comparison shared by the mutation planner and the Host's\n * canonical rewrite.\n *\n * Structural, not canonical-JSON: object key order carries no meaning here.\n * A stored section round-tripped through YAML, and a tombstone written by a\n * higher version, both come back with whatever key order their writer chose —\n * comparing serialized text would report a difference that is not one, and the\n * rewrite would then write on every start instead of being idempotent.\n */\nexport function deepEqualJson(left: unknown, right: unknown): boolean {\n if (left === right) return true\n if (typeof left !== 'object' || typeof right !== 'object' || left === null || right === null) return false\n if (Array.isArray(left) || Array.isArray(right)) {\n if (!Array.isArray(left) || !Array.isArray(right) || left.length !== right.length) return false\n return left.every((item, index) => deepEqualJson(item, right[index]))\n }\n const leftKeys = Object.keys(left)\n const rightKeys = Object.keys(right)\n if (leftKeys.length !== rightKeys.length) return false\n return leftKeys.every(\n (key) =>\n Object.hasOwn(right, key) &&\n deepEqualJson((left as Record<string, unknown>)[key], (right as Record<string, unknown>)[key]),\n )\n}\n","/**\n * Unicode primitives shared by every Quick Action entry point (spec 4.3).\n * Config loading, the management form, migration and Settings mutations must all\n * measure and trim text through these functions so one rule cannot drift from another.\n */\n\n/**\n * Reference placeholder code points DSH reserves and strips inside `setDraft`:\n * the reference marker block plus the legacy object replacement character.\n * Static text carrying one of them would submit something other than what the\n * user configured, so the model rejects it as a field error (spec 4.3).\n *\n * Source: `REFERENCE_PLACEHOLDER_RE` in `@deepseek-ai/dsh-client-ui-conversation`\n * (`lib/client.js`, input machine), applied by `setDraft` before it rebuilds the\n * draft. Verified identical in 0.1.1-rc.2, 0.1.2-rc.1 and 0.1.5-rc.1 — the release\n * that renamed `imageIds` left this range untouched (ticket 29). Its tail is\n * published as a named constant, which 0.1.5-rc.1 moved and renamed:\n * `PLACEHOLDER = \"\\uFFFC\"` in `lib/types/client/input/machine.d.ts` became\n * `ATOMIC_CHAR = \"\\uFFFC\"` in `lib/types/client/input/editor/projection.d.ts`.\n * Re-check this range when the supported DSH range moves.\n */\nconst RESERVED_REFERENCE_PLACEHOLDER = /[\\u{E100}-\\u{E11D}\\u{FFFC}]/u\n\n/** Unicode code point length — the counting unit for every length limit (spec 4.3). */\nexport function countCodePoints(value: string): number {\n let count = 0\n for (const _ of value) count += 1\n return count\n}\n\n/** Whether a text holds no character outside ECMAScript `trim()` whitespace (spec 4.3). */\nexport function isBlankQuickActionText(text: string): boolean {\n return text.trim().length === 0\n}\n\n/** Whether a text carries a DSH-reserved reference placeholder code point (spec 4.3). */\nexport function containsReservedReferencePlaceholder(text: string): boolean {\n return RESERVED_REFERENCE_PLACEHOLDER.test(text)\n}\n\n/**\n * Whether a static text is a Command Send Action: its first non-whitespace\n * character is `/` (spec 4.3). Whitespace is ECMAScript `trim()` whitespace.\n */\nexport function isCommandSendActionText(text: string): boolean {\n return text.trimStart().startsWith('/')\n}\n\n/** Code points allowed to appear inside an emoji grapheme cluster. */\nconst EMOJI_CLUSTER_MEMBER = /^[\\p{Extended_Pictographic}\\p{Emoji_Component}\\p{Emoji_Modifier}\\u{FE0E}\\u{FE0F}\\u{200D}]+$/u\n/** A keycap sequence carries no pictographic code point of its own. */\nconst KEYCAP_CLUSTER = /^[0-9#*]\\u{FE0F}?\\u{20E3}$/u\n/** A flag is a pair of regional indicators, also without a pictographic code point. */\nconst FLAG_CLUSTER = /^\\p{Regional_Indicator}{2}$/u\n\nconst graphemeSegmenter = new Intl.Segmenter('en', { granularity: 'grapheme' })\n\nfunction isEmojiCluster(cluster: string): boolean {\n if (!EMOJI_CLUSTER_MEMBER.test(cluster)) return false\n return /\\p{Extended_Pictographic}/u.test(cluster) || KEYCAP_CLUSTER.test(cluster) || FLAG_CLUSTER.test(cluster)\n}\n\n/** Grapheme-cluster reading of an icon candidate (spec 4.3). */\nexport interface EmojiClusterScan {\n /** Grapheme clusters in the candidate, emoji or not. */\n readonly clusters: number\n /** Whether every grapheme cluster is an emoji cluster. */\n readonly emojiOnly: boolean\n}\n\n/**\n * Segment an icon candidate into grapheme clusters and report whether each one\n * is an emoji cluster, so validation can tell `too-long` from `not-emoji`.\n */\nexport function scanEmojiClusters(icon: string): EmojiClusterScan {\n let clusters = 0\n let emojiOnly = true\n for (const { segment } of graphemeSegmenter.segment(icon)) {\n clusters += 1\n if (!isEmojiCluster(segment)) emojiOnly = false\n }\n return { clusters, emojiOnly }\n}\n","/**\n * The single set of Quick Action field rules (spec 4.3). Preset config loading,\n * the management form, migration and Settings mutations all validate here, so a\n * text the model accepts is exactly a text the Composer may submit unchanged.\n */\nimport {\n containsReservedReferencePlaceholder,\n countCodePoints,\n isBlankQuickActionText,\n scanEmojiClusters,\n} from './text.js'\nimport type { QuickActionFieldIssue } from './types.js'\n\n/** Label limit, in Unicode code points, measured after trimming (spec 4.3). */\nexport const QUICK_ACTION_LABEL_MAX_CODE_POINTS = 40\n/** Static text limit, in Unicode code points, measured without trimming (spec 4.3). */\nexport const QUICK_ACTION_TEXT_MAX_CODE_POINTS = 4000\n/** Icon limit, in emoji grapheme clusters (spec 4.3). */\nexport const QUICK_ACTION_ICON_MAX_CLUSTERS = 4\n\n/** What the management form edits; an empty `icon` means the action has no icon. */\nexport interface QuickActionDraft {\n readonly label: string\n readonly text: string\n readonly icon: string\n readonly confirm: boolean\n}\n\n/** The stored content of a validated draft, shared by preset and custom actions. */\nexport interface QuickActionContent {\n readonly label: string\n readonly text: string\n readonly icon: string | undefined\n readonly confirm: boolean\n}\n\n/** Either the content to persist, or every field that has to be fixed first. */\nexport type QuickActionDraftResult =\n | { readonly ok: true; readonly value: QuickActionContent }\n | { readonly ok: false; readonly issues: readonly QuickActionFieldIssue[] }\n\n/** Trimmed label, or the reason it cannot be stored. */\nexport function labelIssue(label: string): QuickActionFieldIssue | undefined {\n const trimmed = label.trim()\n if (trimmed.length === 0) return { field: 'label', reason: 'blank' }\n if (countCodePoints(trimmed) > QUICK_ACTION_LABEL_MAX_CODE_POINTS) {\n return { field: 'label', reason: 'too-long' }\n }\n return undefined\n}\n\n/** The reason a static text cannot be stored, if any. */\nexport function textIssue(text: string): QuickActionFieldIssue | undefined {\n if (isBlankQuickActionText(text)) return { field: 'text', reason: 'blank' }\n if (countCodePoints(text) > QUICK_ACTION_TEXT_MAX_CODE_POINTS) return { field: 'text', reason: 'too-long' }\n if (containsReservedReferencePlaceholder(text)) return { field: 'text', reason: 'reserved-placeholder' }\n return undefined\n}\n\n/** The reason a non-empty icon cannot be stored, if any. */\nexport function iconIssue(icon: string): QuickActionFieldIssue | undefined {\n const { clusters, emojiOnly } = scanEmojiClusters(icon)\n if (!emojiOnly) return { field: 'icon', reason: 'not-emoji' }\n if (clusters > QUICK_ACTION_ICON_MAX_CLUSTERS) return { field: 'icon', reason: 'too-long' }\n return undefined\n}\n\n/**\n * Validate one edited or created action. Issues come back in field declaration\n * order — label, text, icon — so the form can render them deterministically.\n */\nexport function validateQuickActionDraft(draft: QuickActionDraft): QuickActionDraftResult {\n const issues = [labelIssue(draft.label), textIssue(draft.text), draft.icon === '' ? undefined : iconIssue(draft.icon)]\n .filter((issue): issue is QuickActionFieldIssue => issue !== undefined)\n if (issues.length > 0) return { ok: false, issues }\n return {\n ok: true,\n value: {\n label: draft.label.trim(),\n text: draft.text,\n icon: draft.icon === '' ? undefined : draft.icon,\n confirm: draft.confirm,\n },\n }\n}\n","/**\n * Preset Catalog assembly (spec 5.1): the package manifest followed by the Host\n * composition's `Config.presets`. The Host owns the catalog, so an invalid preset,\n * a duplicate Preset Action ID or an oversized catalog fails config loading loudly\n * instead of being silently truncated or overridden.\n */\nimport { iconIssue, labelIssue, textIssue } from './validation.js'\nimport type {\n PresetActionId,\n PresetQuickAction,\n QuickActionField,\n QuickActionFieldIssue,\n QuickActionIssueReason,\n} from './types.js'\n\n/** Absolute threshold on the merged catalog itself (spec 5.4). */\nexport const QUICK_ACTION_CATALOG_LIMIT = 50\n\n/** Where a catalog entry was declared. */\nexport type PresetSource = 'builtin' | 'config'\n\n/** What the Host feeds the model: raw JSON, validated here rather than upstream. */\nexport interface PresetCatalogInput {\n /** The package's built-in manifest, in declaration order. */\n readonly builtins: readonly unknown[]\n /** `Config.presets` from the Host composition, in declaration order. */\n readonly configured: readonly unknown[]\n}\n\n/** One reason the plugin config must fail to load. */\nexport type PresetCatalogIssue =\n | {\n readonly scope: 'preset'\n readonly source: PresetSource\n readonly index: number\n /** The declared id when it is a usable string, otherwise `undefined`. */\n readonly id: string | undefined\n readonly field: QuickActionField\n readonly reason: QuickActionIssueReason\n }\n | {\n readonly scope: 'catalog'\n readonly reason: 'too-many'\n readonly count: number\n readonly limit: number\n }\n\n/** The authoritative, read-only catalog snapshot the Remote publishes (spec 6.2). */\nexport interface PresetCatalog {\n readonly schemaVersion: 1\n /** Determined by the catalog projection; any change to it changes this value. */\n readonly revision: string\n readonly presets: readonly PresetQuickAction[]\n}\n\n/** Either the authoritative catalog, or every reason config loading has to fail. */\nexport type PresetCatalogResult =\n | { readonly ok: true; readonly catalog: PresetCatalog }\n | { readonly ok: false; readonly issues: readonly PresetCatalogIssue[] }\n\nconst FNV_OFFSET_BASIS = 0x6c62272e07bb014262b821756295c58dn\nconst FNV_PRIME = 0x0000000001000000000000000000013bn\nconst FNV_MASK = (1n << 128n) - 1n\n\nfunction fnv1a128(value: string): string {\n let hash = FNV_OFFSET_BASIS\n for (const byte of new TextEncoder().encode(value)) {\n hash = ((hash ^ BigInt(byte)) * FNV_PRIME) & FNV_MASK\n }\n return hash.toString(16).padStart(32, '0')\n}\n\n/**\n * Hash the whole catalog projection, field by field and in order, so that any\n * change a client could observe — including a pure reordering — moves the\n * revision, and an unchanged catalog never does (spec 6.2).\n */\nfunction revisionOf(presets: readonly PresetQuickAction[]): string {\n const canonical = JSON.stringify([\n 1,\n presets.map((preset) => [preset.id, preset.kind, preset.label, preset.text, preset.icon ?? null, preset.confirm]),\n ])\n return fnv1a128(canonical)\n}\n\nfunction fieldIssue(field: QuickActionField, reason: QuickActionIssueReason): QuickActionFieldIssue {\n return { field, reason }\n}\n\nfunction readId(entry: Record<string, unknown>): { id: string } | { issue: QuickActionFieldIssue } {\n const { id } = entry\n if (id === undefined) return { issue: fieldIssue('id', 'missing') }\n if (typeof id !== 'string') return { issue: fieldIssue('id', 'invalid-type') }\n if (id.trim().length === 0) return { issue: fieldIssue('id', 'blank') }\n return { id }\n}\n\nfunction readPreset(\n entry: Record<string, unknown>,\n id: PresetActionId,\n): { preset: PresetQuickAction } | { issue: QuickActionFieldIssue } {\n if (entry.kind !== undefined && entry.kind !== 'send') return { issue: fieldIssue('kind', 'unsupported') }\n\n const { label, text, icon, confirm } = entry\n if (typeof label !== 'string') return { issue: fieldIssue('label', label === undefined ? 'missing' : 'invalid-type') }\n const labelProblem = labelIssue(label)\n if (labelProblem !== undefined) return { issue: labelProblem }\n\n if (typeof text !== 'string') return { issue: fieldIssue('text', text === undefined ? 'missing' : 'invalid-type') }\n const textProblem = textIssue(text)\n if (textProblem !== undefined) return { issue: textProblem }\n\n if (icon !== undefined && typeof icon !== 'string') return { issue: fieldIssue('icon', 'invalid-type') }\n if (icon === '') return { issue: fieldIssue('icon', 'blank') }\n if (icon !== undefined) {\n const iconProblem = iconIssue(icon)\n if (iconProblem !== undefined) return { issue: iconProblem }\n }\n\n if (confirm !== undefined && typeof confirm !== 'boolean') return { issue: fieldIssue('confirm', 'invalid-type') }\n\n return {\n preset: {\n id,\n kind: 'send',\n label: label.trim(),\n text,\n ...(icon === undefined ? {} : { icon }),\n confirm: confirm ?? true,\n },\n }\n}\n\n/**\n * Merge and validate the built-in manifest with the Host composition's presets.\n * Nothing is repaired or dropped: the first release refuses to load a catalog an\n * author got wrong, so the mistake surfaces at startup rather than at send time.\n */\nexport function buildPresetCatalog(input: PresetCatalogInput): PresetCatalogResult {\n const issues: PresetCatalogIssue[] = []\n const presets: PresetQuickAction[] = []\n const seen = new Set<PresetActionId>()\n\n const sources: readonly (readonly [PresetSource, readonly unknown[]])[] = [\n ['builtin', input.builtins],\n ['config', input.configured],\n ]\n\n for (const [source, entries] of sources) {\n for (const [index, entry] of entries.entries()) {\n const at = (issue: QuickActionFieldIssue, id: string | undefined): PresetCatalogIssue => ({\n scope: 'preset',\n source,\n index,\n id,\n field: issue.field,\n reason: issue.reason,\n })\n\n if (typeof entry !== 'object' || entry === null || Array.isArray(entry)) {\n issues.push(at(fieldIssue('id', 'invalid-type'), undefined))\n continue\n }\n\n const record = entry as Record<string, unknown>\n const identity = readId(record)\n if ('issue' in identity) {\n issues.push(at(identity.issue, undefined))\n continue\n }\n if (seen.has(identity.id)) {\n issues.push(at(fieldIssue('id', 'duplicate'), identity.id))\n continue\n }\n\n const read = readPreset(record, identity.id)\n if ('issue' in read) {\n issues.push(at(read.issue, identity.id))\n continue\n }\n seen.add(identity.id)\n presets.push(read.preset)\n }\n }\n\n const count = input.builtins.length + input.configured.length\n if (count > QUICK_ACTION_CATALOG_LIMIT) {\n issues.push({ scope: 'catalog', reason: 'too-many', count, limit: QUICK_ACTION_CATALOG_LIMIT })\n }\n\n if (issues.length > 0) return { ok: false, issues }\n return { ok: true, catalog: { schemaVersion: 1, revision: revisionOf(presets), presets } }\n}\n\n/**\n * Read one published catalog snapshot back (spec 17.2). The Host is the catalog's\n * single validation authority, so this is a defensive decode of an already\n * confirmed snapshot rather than a second authority — but it is a decode, not a\n * cast: a snapshot this release cannot read in full yields no catalog at all.\n *\n * All-or-nothing on purpose. Dropping the entries it cannot read would show the\n * user a silently truncated action list, which is exactly what spec 5.1 forbids\n * the Host to do; the consumer reports a catalog error instead (spec 10).\n *\n * The Host's `revision` is carried through rather than recomputed. It is the\n * catalog's published identity, and a Client that recomputed it would be\n * asserting an authority it does not have.\n */\nexport function decodeCatalogSnapshot(raw: unknown): PresetCatalog | undefined {\n if (typeof raw !== 'object' || raw === null || Array.isArray(raw)) return undefined\n const { schemaVersion, revision, presets } = raw as Record<string, unknown>\n if (schemaVersion !== 1) return undefined\n if (typeof revision !== 'string' || revision === '') return undefined\n if (!Array.isArray(presets)) return undefined\n\n const read = readPublishedPresets(presets)\n if (read === undefined) return undefined\n return { schemaVersion: 1, revision, presets: read }\n}\n\n/**\n * Validate an already-published preset list against the same field rules the\n * Host applied. Nothing is reported field by field: the Host is the authority\n * that names an author's mistake, and a Client can only refuse the snapshot.\n */\nfunction readPublishedPresets(entries: readonly unknown[]): PresetQuickAction[] | undefined {\n if (entries.length > QUICK_ACTION_CATALOG_LIMIT) return undefined\n\n const presets: PresetQuickAction[] = []\n const seen = new Set<PresetActionId>()\n for (const entry of entries) {\n if (typeof entry !== 'object' || entry === null || Array.isArray(entry)) return undefined\n const record = entry as Record<string, unknown>\n\n const identity = readId(record)\n if ('issue' in identity || seen.has(identity.id)) return undefined\n const read = readPreset(record, identity.id)\n if ('issue' in read) return undefined\n\n seen.add(identity.id)\n presets.push(read.preset)\n }\n return presets\n}\n","/**\n * Settings V1 decoding (spec 4.2, 6.3). Decoding is defensive and lossless: it\n * coerces shapes it recognises, falls back to documented defaults, and preserves\n * anything it cannot render as a tombstone rather than repairing or dropping it.\n * Catalog-aware canonicalization lives in `normalize.ts`.\n */\nimport { QUICK_ACTION_LAYOUTS } from './types.js'\nimport type {\n CustomQuickActionValue,\n PresetQuickActionState,\n QuickActionLayout,\n QuickActionRef,\n QuickActionSettingsV1,\n QuickActionTombstone,\n StoredQuickActionValue,\n} from './types.js'\n\n/**\n * The one namespace holding user data (spec 4.2); renaming it orphans every\n * stored section. It lives in the shared model because both faces address it:\n * the Host registers it, the Client binds the same name.\n */\nexport const QUICK_ACTIONS_SETTINGS_NAMESPACE = 'composer-quick-actions'\n\n/**\n * The read-only namespace carrying the Preset Catalog to Clients (spec 17.2).\n * The plugin never writes its user layer, so it holds no persisted section —\n * `composer-quick-actions` remains the only persisted namespace (spec 4.2).\n */\nexport const QUICK_ACTIONS_CATALOG_NAMESPACE = 'composer-quick-actions-catalog'\n\n/** The state a fresh install starts from (spec 4.2). */\nexport const DEFAULT_QUICK_ACTION_SETTINGS: QuickActionSettingsV1 = Object.freeze({\n schemaVersion: 1,\n layout: 'ribbon',\n userActionsById: Object.freeze({}),\n actionOrder: Object.freeze([]),\n presetStateById: Object.freeze({}),\n})\n\nfunction asRecord(value: unknown): Record<string, unknown> | undefined {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) return undefined\n return value as Record<string, unknown>\n}\n\n/**\n * Whether a stored entry is a live Send Action this release can render.\n * Everything else is a tombstone: a higher version's `kind`, or a value whose\n * label/text are not readable strings.\n */\nexport function isLiveQuickAction(value: StoredQuickActionValue): value is CustomQuickActionValue {\n return value.kind === 'send' && typeof value.label === 'string' && typeof value.text === 'string'\n}\n\n/** Whether a stored entry must be preserved untouched and kept out of every projection (spec 5.3). */\nexport function isQuickActionTombstone(value: StoredQuickActionValue): value is QuickActionTombstone {\n return !isLiveQuickAction(value)\n}\n\nfunction decodeLayout(value: unknown): QuickActionLayout {\n return QUICK_ACTION_LAYOUTS.find((layout) => layout === value) ?? DEFAULT_QUICK_ACTION_SETTINGS.layout\n}\n\n/**\n * Read one stored custom action into canonical form. A missing `kind` reads as\n * `'send'` because V1 always writes the tag; anything else marks a tombstone and\n * is handed straight back by identity, so a value written by a higher version\n * survives the round trip intact.\n *\n * A live result always carries `kind`, `confirm` and `enabled` explicitly, which\n * is what spec 4.3 requires of every normalized action. `confirm` is only\n * defaulted when it is absent — never derived from the text.\n */\nexport function decodeStoredQuickAction(value: unknown): StoredQuickActionValue | undefined {\n const entry = asRecord(value)\n if (entry === undefined) return undefined\n\n const kind = entry.kind ?? 'send'\n if (kind !== 'send' || typeof entry.label !== 'string' || typeof entry.text !== 'string') {\n return entry\n }\n\n const { icon, confirm, enabled, clonedFromPresetId } = entry\n return {\n kind: 'send',\n label: entry.label,\n text: entry.text,\n ...(typeof icon === 'string' && icon !== '' ? { icon } : {}),\n confirm: typeof confirm === 'boolean' ? confirm : true,\n enabled: typeof enabled === 'boolean' ? enabled : true,\n ...(typeof clonedFromPresetId === 'string' ? { clonedFromPresetId } : {}),\n }\n}\n\nfunction decodeUserActions(value: unknown): Record<string, StoredQuickActionValue> {\n const entries = asRecord(value)\n if (entries === undefined) return {}\n const decoded: Record<string, StoredQuickActionValue> = {}\n for (const [id, raw] of Object.entries(entries)) {\n const action = decodeStoredQuickAction(raw)\n if (action !== undefined) decoded[id] = action\n }\n return decoded\n}\n\nfunction decodeRef(value: unknown): QuickActionRef | undefined {\n const entry = asRecord(value)\n if (entry === undefined) return undefined\n if (typeof entry.id !== 'string' || entry.id === '') return undefined\n if (entry.source === 'preset') return { source: 'preset', id: entry.id }\n if (entry.source === 'custom') return { source: 'custom', id: entry.id }\n return undefined\n}\n\nfunction decodeOrder(value: unknown): QuickActionRef[] {\n if (!Array.isArray(value)) return []\n return value.map(decodeRef).filter((ref): ref is QuickActionRef => ref !== undefined)\n}\n\n/**\n * Canonicalize one preset state: `hidden` becomes an explicit boolean or\n * disappears, and every other field is carried through so a higher version's own\n * preference survives a downgrade (spec 5.3).\n */\nexport function canonicalPresetState(state: Readonly<Record<string, unknown>>): PresetQuickActionState {\n const rest: Record<string, unknown> = { ...state }\n delete rest.hidden\n return state.hidden === true ? { ...rest, hidden: true } : rest\n}\n\n/** Whether a canonical preset state carries no user preference at all. */\nexport function isEmptyPresetState(state: PresetQuickActionState): boolean {\n return Object.keys(state).length === 0\n}\n\nfunction decodePresetState(value: unknown): Record<string, PresetQuickActionState> {\n const entries = asRecord(value)\n if (entries === undefined) return {}\n const decoded: Record<string, PresetQuickActionState> = {}\n for (const [id, raw] of Object.entries(entries)) {\n const state = asRecord(raw)\n if (state === undefined) continue\n decoded[id] = canonicalPresetState(state)\n }\n return decoded\n}\n\n/**\n * Decode any published snapshot into V1. The stored `schemaVersion` is not a\n * gate: a snapshot written by a higher version still yields every field this\n * release understands, which is what makes a downgrade round trip lossless.\n */\nexport function decodeQuickActionSettings(raw: unknown): QuickActionSettingsV1 {\n const stored = asRecord(raw)\n if (stored === undefined) return DEFAULT_QUICK_ACTION_SETTINGS\n return {\n schemaVersion: 1,\n layout: decodeLayout(stored.layout),\n userActionsById: decodeUserActions(stored.userActionsById),\n actionOrder: decodeOrder(stored.actionOrder),\n presetStateById: decodePresetState(stored.presetStateById),\n }\n}\n","/**\n * Deterministic, idempotent canonicalization of decoded Settings against the\n * current Preset Catalog (spec 5.3). The same input and catalog always produce\n * the same result, and normalizing twice changes nothing — which is what lets the\n * Host rewrite behind a revision fence without fighting its own writes.\n *\n * Normalization repairs references and re-states the discriminant, never content.\n * In particular it never derives `confirm` from the text: that default is\n * initialized when an action is created or cloned, so rewriting it here would undo\n * the user's choice on every load and break idempotence.\n */\nimport {\n canonicalPresetState,\n decodeQuickActionSettings,\n decodeStoredQuickAction,\n isEmptyPresetState,\n isLiveQuickAction,\n} from './settings.js'\nimport { quickActionRefKey } from './types.js'\nimport type { PresetCatalog } from './catalog.js'\nimport type {\n PresetQuickActionState,\n QuickActionRef,\n QuickActionSettingsV1,\n StoredQuickActionValue,\n} from './types.js'\n\n/**\n * Canonicalize one decoded snapshot against a catalog.\n *\n * Order: existing references keep their positions, minus repeats and minus\n * references to custom actions that are gone; references to presets this catalog\n * no longer carries stay put, because the same Preset Action ID coming back must\n * restore the user's preference. Known actions with no reference are appended —\n * presets in catalog order, then custom actions in stored order. Tombstones are\n * never given a new reference, so a downgrade round trip returns their exact order.\n */\nexport function normalizeQuickActionSettings(\n settings: QuickActionSettingsV1,\n catalog: PresetCatalog,\n): QuickActionSettingsV1 {\n const knownPresetIds = new Set(catalog.presets.map((preset) => preset.id))\n const placed = new Set<string>()\n const actionOrder: QuickActionRef[] = []\n\n const place = (ref: QuickActionRef): void => {\n const key = quickActionRefKey(ref)\n if (placed.has(key)) return\n placed.add(key)\n actionOrder.push(ref)\n }\n\n const userActionsById: Record<string, StoredQuickActionValue> = {}\n for (const [id, stored] of Object.entries(settings.userActionsById)) {\n const value = decodeStoredQuickAction(stored)\n if (value !== undefined) userActionsById[id] = value\n }\n\n for (const ref of settings.actionOrder) {\n if (ref.source === 'custom' && userActionsById[ref.id] === undefined) continue\n place(ref)\n }\n for (const preset of catalog.presets) place({ source: 'preset', id: preset.id })\n for (const [id, value] of Object.entries(userActionsById)) {\n if (isLiveQuickAction(value)) place({ source: 'custom', id })\n }\n\n const presetStateById: Record<string, PresetQuickActionState> = {}\n for (const [id, stored] of Object.entries(settings.presetStateById)) {\n const state = canonicalPresetState(stored)\n if (!knownPresetIds.has(id)) presetStateById[id] = state\n else if (!isEmptyPresetState(state)) presetStateById[id] = state\n }\n\n return {\n schemaVersion: 1,\n layout: settings.layout,\n userActionsById,\n actionOrder,\n presetStateById,\n }\n}\n\n/** Decode a raw persisted value and canonicalize it in one step — the Host's read path. */\nexport function readQuickActionSettings(raw: unknown, catalog: PresetCatalog): QuickActionSettingsV1 {\n return normalizeQuickActionSettings(decodeQuickActionSettings(raw), catalog)\n}\n","/**\n * Derived Quick Action state (spec 3, 5.4, 8.1). One pass over the canonical\n * order produces what the management panel lists, what the Composer renders and\n * the counts that gate the new and clone entry points.\n *\n * Preserved entries — references to presets this catalog no longer carries, and\n * tombstoned custom actions — are deliberately absent from both lists and from\n * the total: this release has no definition to render for them and must not let\n * them consume a user's action budget.\n *\n * `hidden` here is the Hidden Quick Action projection only (spec 3). Unavailable\n * Quick Actions are a per-session runtime state — current draft occupancy, native\n * guard, submission phase — that this module must not model, because it would need\n * the live Input snapshot the shared model is forbidden to depend on. The Composer\n * list is where that layer applies its own disabled state (spec 9.2).\n */\nimport { normalizeQuickActionSettings } from './normalize.js'\nimport { isLiveQuickAction, isQuickActionTombstone } from './settings.js'\nimport { isCommandSendActionText } from './text.js'\nimport type { PresetCatalog } from './catalog.js'\nimport type {\n PresetActionId,\n QuickActionLayout,\n QuickActionRef,\n QuickActionSettingsV1,\n} from './types.js'\n\n/** Normal ceiling on known presets plus every custom action (spec 5.4). */\nexport const QUICK_ACTION_TOTAL_LIMIT = 50\n\n/** One action as the surfaces consume it, with its source-specific affordances resolved. */\nexport interface ProjectedQuickAction {\n readonly ref: QuickActionRef\n readonly label: string\n readonly text: string\n readonly icon: string | undefined\n readonly confirm: boolean\n /** Command Send Action: the text's first non-whitespace character is `/` (spec 4.3). */\n readonly command: boolean\n /** Presets are author-owned: the user may reorder, hide and clone them, never edit them. */\n readonly editable: boolean\n /** Hidden preset or disabled custom action: management panel only (spec 3). */\n readonly hidden: boolean\n readonly clonedFromPresetId: PresetActionId | undefined\n}\n\n/** The numbers the management panel gates its entry points and warnings on (spec 5.4). */\nexport interface QuickActionCounts {\n /** Known presets plus every custom action; hidden and disabled ones included. */\n readonly total: number\n readonly limit: number\n /** `total` already above `limit` — a passive overflow that never drops data. */\n readonly overflow: boolean\n /** Whether creating or cloning is allowed right now. */\n readonly canAdd: boolean\n readonly visible: number\n readonly hidden: number\n /** Entries preserved but kept out of every projection: unknown presets and tombstones. */\n readonly preserved: number\n}\n\n/** Everything the surfaces and the management panel derive from one snapshot. */\nexport interface QuickActionProjection {\n readonly layout: QuickActionLayout\n /** Everything the management panel lists, in the shared order. */\n readonly managed: readonly ProjectedQuickAction[]\n /** The subset the Composer renders, in the same order. */\n readonly composer: readonly ProjectedQuickAction[]\n readonly counts: QuickActionCounts\n}\n\n/**\n * Project one snapshot against a catalog. The snapshot is canonicalized first, so\n * the counts are the real totals even when the caller hands over state the catalog\n * has moved on from — a known preset or a live action missing from the order must\n * never slip past the action ceiling.\n */\nexport function projectQuickActions(\n raw: QuickActionSettingsV1,\n catalog: PresetCatalog,\n): QuickActionProjection {\n const settings = normalizeQuickActionSettings(raw, catalog)\n const presets = new Map(catalog.presets.map((preset) => [preset.id, preset]))\n const managed: ProjectedQuickAction[] = []\n const referenced = new Set<string>()\n let preserved = 0\n\n for (const ref of settings.actionOrder) {\n if (ref.source === 'preset') {\n const preset = presets.get(ref.id)\n if (preset === undefined) {\n preserved += 1\n continue\n }\n managed.push({\n ref,\n label: preset.label,\n text: preset.text,\n icon: preset.icon,\n confirm: preset.confirm,\n command: isCommandSendActionText(preset.text),\n editable: false,\n hidden: settings.presetStateById[ref.id]?.hidden === true,\n clonedFromPresetId: undefined,\n })\n continue\n }\n\n referenced.add(ref.id)\n const value = settings.userActionsById[ref.id]\n if (value === undefined || !isLiveQuickAction(value)) {\n preserved += 1\n continue\n }\n managed.push({\n ref,\n label: value.label,\n text: value.text,\n icon: value.icon,\n confirm: value.confirm,\n command: isCommandSendActionText(value.text),\n editable: true,\n hidden: !value.enabled,\n clonedFromPresetId: value.clonedFromPresetId,\n })\n }\n\n for (const [id, value] of Object.entries(settings.userActionsById)) {\n if (!referenced.has(id) && isQuickActionTombstone(value)) preserved += 1\n }\n\n const composer = managed.filter((action) => !action.hidden)\n const total = managed.length\n return {\n layout: settings.layout,\n managed,\n composer,\n counts: {\n total,\n limit: QUICK_ACTION_TOTAL_LIMIT,\n overflow: total > QUICK_ACTION_TOTAL_LIMIT,\n canAdd: total < QUICK_ACTION_TOTAL_LIMIT,\n visible: composer.length,\n hidden: total - composer.length,\n preserved,\n },\n }\n}\n","/**\n * Revision-fenced Settings mutation planning (spec 5.2, 5.4, 6.3, 10).\n *\n * A planner is pure: it takes the last Host-confirmed snapshot and returns the\n * canonical snapshot to persist together with the revision the write must be\n * fenced to. It performs no I/O and mints no identity — the caller supplies each\n * new Custom Action ID, so a UUID collision comes back as a refusal to retry\n * rather than as a silent overwrite.\n */\nimport { deepEqualJson } from './json.js'\nimport { normalizeQuickActionSettings } from './normalize.js'\nimport { isLiveQuickAction } from './settings.js'\nimport { projectQuickActions } from './projection.js'\nimport { quickActionRefKey } from './types.js'\nimport { validateQuickActionDraft } from './validation.js'\nimport type { PresetCatalog } from './catalog.js'\nimport type { QuickActionDraft } from './validation.js'\nimport type {\n CustomActionId,\n CustomQuickActionValue,\n PresetActionId,\n PresetQuickActionState,\n QuickActionFieldIssue,\n QuickActionLayout,\n QuickActionRef,\n QuickActionSettingsV1,\n StoredQuickActionValue,\n} from './types.js'\n\n/** What every planner reads: the confirmed snapshot, the catalog it was read against, and its revision. */\nexport interface QuickActionMutationContext {\n readonly settings: QuickActionSettingsV1\n readonly catalog: PresetCatalog\n /** The Settings namespace revision the resulting write must carry (spec 6.3). */\n readonly revision: string\n}\n\n/** What to persist, and the fence the write must carry. */\nexport interface QuickActionMutationPlan {\n readonly expectedRevision: string\n readonly next: QuickActionSettingsV1\n /** False when the plan would persist exactly what is already stored. */\n readonly changed: boolean\n}\n\n/** Why a planner refused; each reason maps to one management-panel response (spec 10). */\nexport type QuickActionMutationRejectionReason =\n /** One or more fields failed the shared validation rules. */\n | 'invalid-fields'\n /** Creating or cloning while the action total is at or above the ceiling. */\n | 'limit-reached'\n /** The target action is absent, or is a tombstone this release must not touch. */\n | 'unknown-action'\n /** The requested Custom Action ID is taken; mint another and retry. */\n | 'id-in-use'\n /** The submitted order is not a permutation of the managed actions. */\n | 'invalid-order'\n\n/** A refusal, with the field issues to render when the reason is a validation failure. */\nexport interface QuickActionMutationRejection {\n readonly reason: QuickActionMutationRejectionReason\n readonly issues: readonly QuickActionFieldIssue[]\n}\n\n/** Either a plan to persist behind the fence, or a refusal to show the user. */\nexport type QuickActionMutationOutcome =\n | { readonly ok: true; readonly plan: QuickActionMutationPlan }\n | { readonly ok: false; readonly rejection: QuickActionMutationRejection }\n\n/** The draft the management form opens on; the only place the confirm default is applied. */\nexport function newQuickActionDraft(): QuickActionDraft {\n return { label: '', text: '', icon: '', confirm: true }\n}\n\nfunction refuse(\n reason: QuickActionMutationRejectionReason,\n issues: readonly QuickActionFieldIssue[] = [],\n): QuickActionMutationOutcome {\n return { ok: false, rejection: { reason, issues } }\n}\n\nfunction unknownAction(): QuickActionMutationOutcome {\n return refuse('unknown-action', [{ field: 'id', reason: 'missing' }])\n}\n\nfunction planFrom(\n context: QuickActionMutationContext,\n current: QuickActionSettingsV1,\n next: QuickActionSettingsV1,\n): QuickActionMutationOutcome {\n const canonical = normalizeQuickActionSettings(next, context.catalog)\n return {\n ok: true,\n plan: { expectedRevision: context.revision, next: canonical, changed: !deepEqualJson(current, canonical) },\n }\n}\n\n/** Every planner starts from the canonical reading of the confirmed snapshot. */\nfunction currentOf(context: QuickActionMutationContext): QuickActionSettingsV1 {\n return normalizeQuickActionSettings(context.settings, context.catalog)\n}\n\nfunction withUserActions(\n settings: QuickActionSettingsV1,\n userActionsById: Readonly<Record<CustomActionId, StoredQuickActionValue>>,\n): QuickActionSettingsV1 {\n return { ...settings, userActionsById }\n}\n\nfunction liveActionOf(\n settings: QuickActionSettingsV1,\n id: CustomActionId,\n): CustomQuickActionValue | undefined {\n const value = settings.userActionsById[id]\n if (value === undefined || !isLiveQuickAction(value)) return undefined\n return value\n}\n\n/** Build one stored Send Action with every field spec 4.3 requires stated explicitly. */\nfunction sendActionValue(input: {\n readonly label: string\n readonly text: string\n readonly icon: string | undefined\n readonly confirm: boolean\n readonly enabled: boolean\n readonly clonedFromPresetId: PresetActionId | undefined\n}): CustomQuickActionValue {\n return {\n kind: 'send',\n label: input.label,\n text: input.text,\n ...(input.icon === undefined ? {} : { icon: input.icon }),\n confirm: input.confirm,\n enabled: input.enabled,\n ...(input.clonedFromPresetId === undefined ? {} : { clonedFromPresetId: input.clonedFromPresetId }),\n }\n}\n\n/**\n * Check a caller-minted Custom Action ID before it is persisted. A taken id comes\n * back as `id-in-use` so the caller mints another UUID and retries; normalization\n * must never renumber an id that is already stored (spec 4.1).\n */\nfunction identityRefusal(\n settings: QuickActionSettingsV1,\n id: CustomActionId,\n): QuickActionMutationOutcome | undefined {\n if (id === '') return refuse('invalid-fields', [{ field: 'id', reason: 'blank' }])\n if (settings.userActionsById[id] !== undefined) {\n return refuse('id-in-use', [{ field: 'id', reason: 'duplicate' }])\n }\n return undefined\n}\n\nfunction planWithAction(\n context: QuickActionMutationContext,\n current: QuickActionSettingsV1,\n id: CustomActionId,\n value: CustomQuickActionValue,\n): QuickActionMutationOutcome {\n return planFrom(context, current, withUserActions(current, { ...current.userActionsById, [id]: value }))\n}\n\n/** Create a Custom Quick Action under a caller-minted identity (spec 5.2, 5.4). */\nexport function planCreateCustomQuickAction(\n context: QuickActionMutationContext,\n input: { readonly id: CustomActionId; readonly draft: QuickActionDraft },\n): QuickActionMutationOutcome {\n const current = currentOf(context)\n if (!projectQuickActions(current, context.catalog).counts.canAdd) return refuse('limit-reached')\n const refusal = identityRefusal(current, input.id)\n if (refusal !== undefined) return refusal\n\n const validated = validateQuickActionDraft(input.draft)\n if (!validated.ok) return refuse('invalid-fields', validated.issues)\n\n return planWithAction(\n context,\n current,\n input.id,\n sendActionValue({ ...validated.value, enabled: true, clonedFromPresetId: undefined }),\n )\n}\n\n/**\n * Clone a Preset Quick Action into a new Custom Quick Action (spec 5.2).\n * The confirmation policy is copied as it stands — including a Command Send\n * Action the author left unconfirmed — never re-defaulted.\n */\nexport function planClonePresetQuickAction(\n context: QuickActionMutationContext,\n input: { readonly presetId: PresetActionId; readonly id: CustomActionId },\n): QuickActionMutationOutcome {\n const current = currentOf(context)\n if (!projectQuickActions(current, context.catalog).counts.canAdd) return refuse('limit-reached')\n\n const preset = context.catalog.presets.find((candidate) => candidate.id === input.presetId)\n if (preset === undefined) return unknownAction()\n const refusal = identityRefusal(current, input.id)\n if (refusal !== undefined) return refusal\n\n return planWithAction(\n context,\n current,\n input.id,\n sendActionValue({\n label: preset.label,\n text: preset.text,\n icon: preset.icon,\n confirm: preset.confirm,\n enabled: true,\n clonedFromPresetId: preset.id,\n }),\n )\n}\n\n/**\n * Save edited content onto an existing Custom Quick Action. `enabled` and the\n * Clone Provenance survive the edit; `confirm` comes from the form, which is the\n * only place the user can change it.\n */\nexport function planUpdateCustomQuickAction(\n context: QuickActionMutationContext,\n input: { readonly id: CustomActionId; readonly draft: QuickActionDraft },\n): QuickActionMutationOutcome {\n const current = currentOf(context)\n const existing = liveActionOf(current, input.id)\n if (existing === undefined) return unknownAction()\n\n const validated = validateQuickActionDraft(input.draft)\n if (!validated.ok) return refuse('invalid-fields', validated.issues)\n\n return planWithAction(\n context,\n current,\n input.id,\n sendActionValue({\n ...validated.value,\n enabled: existing.enabled,\n clonedFromPresetId: existing.clonedFromPresetId,\n }),\n )\n}\n\n/** Disable or re-enable a Custom Quick Action; disabled actions stay in the management panel (spec 3). */\nexport function planSetCustomQuickActionEnabled(\n context: QuickActionMutationContext,\n input: { readonly id: CustomActionId; readonly enabled: boolean },\n): QuickActionMutationOutcome {\n const current = currentOf(context)\n const existing = liveActionOf(current, input.id)\n if (existing === undefined) return unknownAction()\n return planWithAction(context, current, input.id, { ...existing, enabled: input.enabled })\n}\n\n/** Delete a Custom Quick Action; normalization drops its order reference with it. */\nexport function planDeleteCustomQuickAction(\n context: QuickActionMutationContext,\n input: { readonly id: CustomActionId },\n): QuickActionMutationOutcome {\n const current = currentOf(context)\n if (liveActionOf(current, input.id) === undefined) return unknownAction()\n const userActionsById = { ...current.userActionsById }\n delete userActionsById[input.id]\n return planFrom(context, current, withUserActions(current, userActionsById))\n}\n\n/** Hide or restore a Preset Quick Action; the author's definition is never touched (spec 5.1). */\nexport function planSetPresetQuickActionHidden(\n context: QuickActionMutationContext,\n input: { readonly presetId: PresetActionId; readonly hidden: boolean },\n): QuickActionMutationOutcome {\n const current = currentOf(context)\n if (!context.catalog.presets.some((preset) => preset.id === input.presetId)) return unknownAction()\n\n const presetStateById: Record<PresetActionId, PresetQuickActionState> = { ...current.presetStateById }\n if (input.hidden) presetStateById[input.presetId] = { hidden: true }\n else delete presetStateById[input.presetId]\n return planFrom(context, current, { ...current, presetStateById })\n}\n\n/**\n * Apply a new order to the actions the management panel lists. Preserved\n * references — unknown presets and tombstones — keep their exact positions, so a\n * reorder here never disturbs data a higher version owns.\n */\nexport function planReorderQuickActions(\n context: QuickActionMutationContext,\n input: { readonly order: readonly QuickActionRef[] },\n): QuickActionMutationOutcome {\n const current = currentOf(context)\n const managed = projectQuickActions(current, context.catalog).managed.map((action) => action.ref)\n\n const managedKeys = new Set(managed.map(quickActionRefKey))\n const wanted = input.order.map(quickActionRefKey)\n if (wanted.length !== managedKeys.size || new Set(wanted).size !== wanted.length) return refuse('invalid-order')\n if (!wanted.every((key) => managedKeys.has(key))) return refuse('invalid-order')\n\n const queue = [...input.order]\n const actionOrder = current.actionOrder.map((ref) =>\n managedKeys.has(quickActionRefKey(ref)) ? queue.shift() ?? ref : ref,\n )\n return planFrom(context, current, { ...current, actionOrder })\n}\n\n/** Move one managed action to another position in the management list. */\nexport function planMoveQuickAction(\n context: QuickActionMutationContext,\n input: { readonly ref: QuickActionRef; readonly toIndex: number },\n): QuickActionMutationOutcome {\n const current = currentOf(context)\n const managed = projectQuickActions(current, context.catalog).managed.map((action) => action.ref)\n const from = managed.findIndex((candidate) => quickActionRefKey(candidate) === quickActionRefKey(input.ref))\n if (from === -1) return unknownAction()\n if (!Number.isInteger(input.toIndex) || input.toIndex < 0 || input.toIndex >= managed.length) {\n return refuse('invalid-order')\n }\n\n const order = [...managed]\n const [moved] = order.splice(from, 1)\n if (moved === undefined) return refuse('invalid-order')\n order.splice(input.toIndex, 0, moved)\n return planReorderQuickActions(context, { order })\n}\n\n/** Switch the global Quick Action Layout (spec 8.1). */\nexport function planSetQuickActionLayout(\n context: QuickActionMutationContext,\n input: { readonly layout: QuickActionLayout },\n): QuickActionMutationOutcome {\n const current = currentOf(context)\n return planFrom(context, current, { ...current, layout: input.layout })\n}\n","/**\n * The Client's single owner of authoritative Quick Action state (spec 7.1).\n *\n * It binds the two Settings namespaces the Host registers — the read-only\n * catalog namespace, read off its composition `base` layer, and the user-state\n * namespace — derives the projection every surface renders, and serializes\n * revision-fenced writes back through the same scope.\n *\n * What it deliberately does not own:\n *\n * - **Validation and migration authority.** The Host owns both (spec 6.3). Every\n * rule applied here comes from the shared model, and a snapshot is decoded\n * defensively rather than repaired: this face never rewrites before validating,\n * never writes a file, and never treats browser storage as a source of truth.\n * - **Anything session-scoped.** No Session, InputState, Slot props or\n * `InputActions` object reaches this module — long-lived global state must not\n * pin a session's runtime objects (spec 7.1). Draft occupancy, confirmation and\n * send single-flight belong to the per-session execution layer (spec 7.2).\n * - **Its own copy of the settings document.** Both bindings derive from the one\n * browser-side describe mirror, so the catalog costs no read of its own and\n * refreshes with that mirror after a reconnect (spec 17.3).\n */\nimport {\n DEFAULT_QUICK_ACTION_SETTINGS,\n QUICK_ACTIONS_CATALOG_NAMESPACE,\n QUICK_ACTIONS_SETTINGS_NAMESPACE,\n decodeCatalogSnapshot,\n decodeQuickActionSettings,\n deepEqualJson,\n normalizeQuickActionSettings,\n planClonePresetQuickAction,\n planCreateCustomQuickAction,\n planDeleteCustomQuickAction,\n planMoveQuickAction,\n planReorderQuickActions,\n planSetCustomQuickActionEnabled,\n planSetPresetQuickActionHidden,\n planSetQuickActionLayout,\n planUpdateCustomQuickAction,\n projectQuickActions,\n} from '../model/index.js'\nimport type {\n CustomActionId,\n PresetActionId,\n PresetCatalog,\n QuickActionDraft,\n QuickActionLayout,\n QuickActionMutationContext,\n QuickActionMutationOutcome,\n QuickActionMutationRejection,\n QuickActionProjection,\n QuickActionRef,\n QuickActionSettingsV1,\n} from '../model/index.js'\n\n// ---------------------------------------------------------------------------\n// The DSH faces this module consumes\n//\n// Declared structurally, and only as wide as this controller actually reads, so\n// the behaviour above is testable against a controlled transport. The shipped\n// `ctx.settingsScope` and `ctx.connection` satisfy them as-is.\n// ---------------------------------------------------------------------------\n\n/**\n * One path-addressed edit inside a namespace section. The transport also accepts\n * an `unset` form; this plugin writes the whole section field by field and never\n * clears one, so only the form it submits is declared.\n */\nexport interface SettingsSetOp {\n readonly op: 'set'\n readonly path: readonly string[]\n readonly value: unknown\n}\n\n/** One bound namespace as the scope publishes it. */\nexport interface SettingsScopeSnapshot {\n /** `loading` until the shared document answers; `unavailable` when the namespace is not served. */\n readonly status: 'loading' | 'ready' | 'unavailable'\n /** Resolved section: schema defaults, then composition base, then the user layer. */\n readonly value?: unknown\n /** Composition base layer, where an author-owned layer such as the catalog rides. */\n readonly base?: unknown\n /** Revision of the raw user section, sent back to fence a write. */\n readonly revision?: number\n /** Whether the provider accepts writes at all. */\n readonly writable: boolean\n /** `memory` on a page this Client keeps process-local; no write ever crosses the wire. */\n readonly mode: 'host' | 'memory'\n}\n\n/** The namespace contract handed to `bind`. */\nexport interface SettingsScopeSpec {\n readonly namespace: string\n /** Narrows the resolved value; returning `undefined` publishes no value at all. */\n readonly decode?: (value: unknown) => unknown\n}\n\n/** One namespace scope: a derived read plus that namespace's serialized writes. */\nexport interface BoundSettingsScope {\n getSnapshot(): SettingsScopeSnapshot\n subscribe(listener: () => void): () => void\n mutate(ops: readonly SettingsSetOp[], expectedRevision?: number): Promise<void>\n}\n\n/** The shared settings document as the mirror holds it. */\nexport interface SettingsMirrorSnapshot {\n /** Whether any document answer is held at all; absent while no read has succeeded. */\n readonly view?: unknown\n /** The last read's failure message, or `null` when it answered. */\n readonly error: string | null\n}\n\n/**\n * The shared describe mirror's read face. A bound scope publishes nothing at all\n * while the document is unanswered, so a read that *failed* is only visible here\n * — which is what tells a first catalog read failure apart from one still in\n * flight (spec 10).\n */\nexport interface SettingsMirror {\n getSnapshot(): SettingsMirrorSnapshot\n subscribe(listener: () => void): () => void\n load(): Promise<void>\n}\n\n/** `ctx.settingsScope`. */\nexport interface SettingsScopeService {\n bind(spec: SettingsScopeSpec): BoundSettingsScope\n describe(): SettingsMirror\n}\n\n/** Connection lifecycle as `ctx.connection` publishes it; `undefined` before the loop starts. */\nexport type ConnectionState = 'connected' | 'connecting' | 'disconnected' | undefined\n\n/** `ctx.connection`, narrowed to the observable state this controller reads. */\nexport interface ConnectionLike {\n readonly state: {\n getSnapshot(): ConnectionState\n subscribe(listener: () => void): () => void\n }\n}\n\n// ---------------------------------------------------------------------------\n// Published state\n// ---------------------------------------------------------------------------\n\n/** Why the authoritative catalog cannot be shown (spec 10). */\nexport type CatalogErrorReason =\n /** The settings document could not be read at all; retrying is the remedy. */\n | 'unreadable'\n /** The Host serves no catalog namespace, or published no `base` layer on it. */\n | 'unavailable'\n /** A `base` layer this release cannot read in full; never a truncated catalog (spec 5.1). */\n | 'undecodable'\n\n/** The authoritative Preset Catalog as the Client currently knows it. */\nexport type CatalogState =\n | { readonly status: 'loading' }\n | { readonly status: 'ready'; readonly catalog: PresetCatalog }\n | { readonly status: 'error'; readonly reason: CatalogErrorReason }\n\n/** The last Host-confirmed user state, and the fence a write against it must carry. */\nexport type SettingsState =\n | { readonly status: 'loading' }\n /** No namespace to read or write: unserved, or a page kept process-local. */\n | { readonly status: 'unavailable' }\n | {\n readonly status: 'ready'\n readonly settings: QuickActionSettingsV1\n readonly revision: number\n readonly writable: boolean\n }\n\n/** Why a write did not reach the stored state. */\nexport type QuickActionWriteFailure =\n /** No catalog or no readable namespace yet, or the controller is disposed. */\n | { readonly kind: 'not-ready' }\n /** The provider accepts no writes, or the connection is not current (spec 10). */\n | { readonly kind: 'read-only' }\n /** The shared model refused the plan; nothing crossed the wire. */\n | { readonly kind: 'rejected'; readonly rejection: QuickActionMutationRejection }\n /** The Host refused the write itself; the authoritative snapshot was re-read. */\n | { readonly kind: 'refused' }\n /** The revision fence was lost: refresh, then ask the user to confirm again (spec 10). */\n | { readonly kind: 'conflict' }\n /** The write never settled against the Host. Never retried automatically. */\n | { readonly kind: 'failed'; readonly message: string }\n\n/**\n * The structured result every mutation answers with (spec 15, decision 4).\n *\n * The shipped `SettingsScope.mutate` resolves to `void`, and this release adds no\n * DSH core interface (spec 16.4), so success, refusal and conflict are told apart\n * here, from the authoritative snapshot the scope publishes after the write: the\n * write committed when the stored state now reads back as the plan, the fence was\n * lost when the namespace revision moved elsewhere, and anything else is a Host\n * refusal. Each failing case leaves the caller's form content untouched — the\n * caller owns the draft — and the recovery read has already happened by the time\n * this resolves.\n */\nexport type QuickActionWriteOutcome =\n | { readonly ok: true; readonly changed: boolean }\n | { readonly ok: false; readonly failure: QuickActionWriteFailure }\n\n/** The global management panel's own state (spec 7.1). */\nexport interface QuickActionManagerState {\n readonly open: boolean\n}\n\n/** Everything the Quick Action surfaces render from. */\nexport interface QuickActionsClientState {\n readonly catalog: CatalogState\n readonly settings: SettingsState\n /**\n * What the surfaces list, or `undefined` while no catalog is readable. With a\n * catalog but no readable user state it projects the defaults, so the\n * authoritative presets still render while management stays read-only (spec 10).\n */\n readonly projection: QuickActionProjection | undefined\n /** Whether any write may be attempted right now. */\n readonly readOnly: boolean\n /** The connection is not current, so the held snapshot may have moved on (spec 10). */\n readonly stale: boolean\n readonly manager: QuickActionManagerState\n /** A write is in flight; the panel disables its controls rather than queueing clicks. */\n readonly writing: boolean\n /** The last failure, until it is dismissed or superseded by the next write. */\n readonly failure?: QuickActionWriteFailure\n}\n\n/** The controller as the surfaces consume it. */\nexport interface QuickActionsController {\n /** Current state; the same reference until something actually changes. */\n getSnapshot(): QuickActionsClientState\n subscribe(listener: () => void): () => void\n /** Re-read the shared settings document — the retry behind a catalog error (spec 10). */\n refresh(): Promise<void>\n openManager(): void\n closeManager(): void\n dismissFailure(): void\n createCustomAction(draft: QuickActionDraft): Promise<QuickActionWriteOutcome>\n clonePreset(presetId: PresetActionId): Promise<QuickActionWriteOutcome>\n updateCustomAction(id: CustomActionId, draft: QuickActionDraft): Promise<QuickActionWriteOutcome>\n setCustomActionEnabled(id: CustomActionId, enabled: boolean): Promise<QuickActionWriteOutcome>\n deleteCustomAction(id: CustomActionId): Promise<QuickActionWriteOutcome>\n setPresetHidden(presetId: PresetActionId, hidden: boolean): Promise<QuickActionWriteOutcome>\n reorderActions(order: readonly QuickActionRef[]): Promise<QuickActionWriteOutcome>\n moveAction(ref: QuickActionRef, toIndex: number): Promise<QuickActionWriteOutcome>\n setLayout(layout: QuickActionLayout): Promise<QuickActionWriteOutcome>\n /** Release the scope subscriptions and the connection listener. */\n dispose(): void\n}\n\n/** What the controller is built over. */\nexport interface QuickActionsControllerOptions {\n readonly settingsScope: SettingsScopeService\n readonly connection: ConnectionLike\n /** Mints one Custom Action ID. Defaults to `crypto.randomUUID()`. */\n readonly mintCustomActionId?: () => string\n}\n\n/**\n * How many Custom Action IDs a create or clone tries before giving up.\n * Normalization must never renumber a stored id (spec 4.1), so the planner\n * refuses a taken id and the controller mints another rather than overwriting\n * anything; exhausting the attempts surfaces the refusal instead of hiding it.\n */\nconst ID_MINT_ATTEMPTS = 4\n\n/** The five top-level fields of the persisted section (spec 4.2). */\nfunction sectionOps(next: QuickActionSettingsV1): readonly SettingsSetOp[] {\n return [\n { op: 'set', path: ['schemaVersion'], value: next.schemaVersion },\n { op: 'set', path: ['layout'], value: next.layout },\n { op: 'set', path: ['userActionsById'], value: next.userActionsById },\n { op: 'set', path: ['actionOrder'], value: next.actionOrder },\n { op: 'set', path: ['presetStateById'], value: next.presetStateById },\n ]\n}\n\n/**\n * Read the catalog off a bound namespace.\n *\n * `base` is read, never `value`: `base` is the author's own layer, so a user who\n * hand-writes a section of that name into the settings document still sees the\n * Host's catalog (spec 17.2).\n */\nfunction readCatalog(snapshot: SettingsScopeSnapshot, document: SettingsMirrorSnapshot): CatalogState {\n if (snapshot.status === 'loading') {\n // No namespace answer yet. A held document means the read succeeded and the\n // namespace simply is not served; no document plus a reported error means the\n // read itself failed, which is the retryable catalog error of spec 10.\n if (document.view !== undefined) return { status: 'error', reason: 'unavailable' }\n return document.error === null ? { status: 'loading' } : { status: 'error', reason: 'unreadable' }\n }\n if (snapshot.status === 'unavailable' || snapshot.base === undefined) {\n return { status: 'error', reason: 'unavailable' }\n }\n const catalog = decodeCatalogSnapshot(snapshot.base)\n if (catalog === undefined) return { status: 'error', reason: 'undecodable' }\n return { status: 'ready', catalog }\n}\n\n/**\n * Read the confirmed user state off a bound namespace.\n *\n * Decoded, not canonicalized: canonicalization is catalog-relative, and whether\n * a namespace is readable has nothing to do with whether the catalog is. Every\n * consumer that needs the canonical form — the projection, each planner, the\n * post-write comparison — derives it against the catalog it already holds.\n */\nfunction readSettings(snapshot: SettingsScopeSnapshot): SettingsState {\n if (snapshot.status === 'loading') return { status: 'loading' }\n if (snapshot.status === 'unavailable' || snapshot.revision === undefined) return { status: 'unavailable' }\n return {\n status: 'ready',\n settings: decodeQuickActionSettings(snapshot.value),\n revision: snapshot.revision,\n writable: snapshot.writable,\n }\n}\n\n/**\n * Either the everything one write needs, or the reason no write may be attempted.\n * One gate so the surfaces' read-only state and a write's refusal can never\n * disagree about why (spec 10).\n */\ntype WriteGate =\n | {\n readonly ok: true\n readonly context: QuickActionMutationContext\n readonly catalog: PresetCatalog\n readonly revision: number\n }\n | { readonly ok: false; readonly failure: QuickActionWriteFailure }\n\nfunction writeGate(catalog: CatalogState, settings: SettingsState, stale: boolean): WriteGate {\n if (catalog.status !== 'ready' || settings.status !== 'ready') {\n return { ok: false, failure: { kind: 'not-ready' } }\n }\n // A held snapshot the connection can no longer vouch for is served read-only:\n // it may still be executed against, but never written back over (spec 10).\n if (!settings.writable || stale) return { ok: false, failure: { kind: 'read-only' } }\n return {\n ok: true,\n context: {\n settings: settings.settings,\n catalog: catalog.catalog,\n revision: String(settings.revision),\n },\n catalog: catalog.catalog,\n revision: settings.revision,\n }\n}\n\n/**\n * Create the controller. Both bindings are made on the calling fiber, so the\n * scope disposers the binder registers are withdrawn with it; `dispose()`\n * releases what this module owns on top of that.\n */\nexport function createQuickActionsController(\n options: QuickActionsControllerOptions,\n): QuickActionsController {\n const mintId = options.mintCustomActionId ?? (() => crypto.randomUUID())\n const catalogScope = options.settingsScope.bind({\n namespace: QUICK_ACTIONS_CATALOG_NAMESPACE,\n // The resolved value is passed through only so the scope reports readiness;\n // the catalog itself is read from `base`. `null` stands in for a namespace\n // that resolves to nothing, which would otherwise read as still loading.\n decode: (value) => value ?? null,\n })\n const settingsScope = options.settingsScope.bind({\n namespace: QUICK_ACTIONS_SETTINGS_NAMESPACE,\n // Decoding here rather than against the registered schema keeps the Client's\n // reading of a confirmed snapshot the shared model's, not the transport's.\n decode: (value) => decodeQuickActionSettings(value),\n })\n\n const mirror = options.settingsScope.describe()\n\n const listeners = new Set<() => void>()\n let disposed = false\n let manager: QuickActionManagerState = { open: false }\n let writing = 0\n let failure: QuickActionWriteFailure | undefined\n let connectionState: ConnectionState = options.connection.state.getSnapshot()\n let state = derive()\n\n /** Serializes this controller's own writes so each plan reads the previous one back. */\n let tail: Promise<unknown> = Promise.resolve()\n\n function derive(): QuickActionsClientState {\n const catalog = readCatalog(catalogScope.getSnapshot(), mirror.getSnapshot())\n const settings = readSettings(settingsScope.getSnapshot())\n const projection =\n catalog.status === 'ready'\n ? projectQuickActions(\n settings.status === 'ready' ? settings.settings : DEFAULT_QUICK_ACTION_SETTINGS,\n catalog.catalog,\n )\n : undefined\n const stale = connectionState !== undefined && connectionState !== 'connected'\n return {\n catalog,\n settings,\n projection,\n readOnly: !writeGate(catalog, settings, stale).ok,\n stale,\n manager,\n writing: writing > 0,\n ...(failure === undefined ? {} : { failure }),\n }\n }\n\n /** Republish only on a real change, so a subscriber never re-renders for nothing. */\n function publish(): void {\n if (disposed) return\n const next = derive()\n if (deepEqualJson(state, next)) return\n state = next\n // Snapshot: a listener may unsubscribe as it reacts to this very change.\n for (const listener of Array.from(listeners)) listener()\n }\n\n // The mirror is subscribed to as well as the two scopes: a failed document read\n // never reaches a scope snapshot, so it is only observable here.\n const stopSources = [mirror.subscribe(publish), catalogScope.subscribe(publish), settingsScope.subscribe(publish)]\n const stopConnection = options.connection.state.subscribe(() => {\n connectionState = options.connection.state.getSnapshot()\n publish()\n })\n\n /**\n * Run one planner, re-minting on a taken Custom Action ID. Only a planner that\n * mints can answer `id-in-use`, so this loop costs nothing for the others.\n */\n function plan(\n planner: (context: QuickActionMutationContext) => QuickActionMutationOutcome,\n context: QuickActionMutationContext,\n ): QuickActionMutationOutcome {\n let outcome = planner(context)\n for (let attempt = 1; attempt < ID_MINT_ATTEMPTS; attempt += 1) {\n if (outcome.ok || outcome.rejection.reason !== 'id-in-use') return outcome\n outcome = planner(context)\n }\n return outcome\n }\n\n /**\n * Classify one settled write against the snapshot the scope published for it.\n *\n * The stored state reading back as the plan is the only positive evidence of a\n * commit. Failing that, a namespace revision that moved elsewhere is a lost\n * fence and anything else is a Host refusal — with one bounded blind spot: if\n * the recovery read that follows a refusal also fails, a lost fence is\n * indistinguishable from a refusal and is reported as the latter. In that\n * window the connection is down, so the surfaces are already read-only, and\n * retrying against the stale fence is refused again rather than overwriting\n * the writer that won.\n */\n function classify(catalog: PresetCatalog, next: QuickActionSettingsV1, fence: number): QuickActionWriteOutcome {\n const snapshot = settingsScope.getSnapshot()\n const settings = readSettings(snapshot)\n if (\n settings.status === 'ready' &&\n deepEqualJson(normalizeQuickActionSettings(settings.settings, catalog), next)\n ) {\n return { ok: true, changed: true }\n }\n if (snapshot.revision !== fence) return { ok: false, failure: { kind: 'conflict' } }\n return { ok: false, failure: { kind: 'refused' } }\n }\n\n function settle(outcome: QuickActionWriteOutcome): QuickActionWriteOutcome {\n failure = outcome.ok ? undefined : outcome.failure\n return outcome\n }\n\n function submit(\n planner: (context: QuickActionMutationContext) => QuickActionMutationOutcome,\n ): Promise<QuickActionWriteOutcome> {\n if (disposed) return Promise.resolve({ ok: false, failure: { kind: 'not-ready' } })\n // Counted before the queue so a click is visibly in flight, not silently queued.\n writing += 1\n publish()\n const task = tail.then(async (): Promise<QuickActionWriteOutcome> => {\n if (disposed) return { ok: false, failure: { kind: 'not-ready' } }\n const gate = writeGate(state.catalog, state.settings, state.stale)\n if (!gate.ok) return settle(gate)\n try {\n const outcome = plan(planner, gate.context)\n if (!outcome.ok) return settle({ ok: false, failure: { kind: 'rejected', rejection: outcome.rejection } })\n // Nothing to persist is a success with no write: an unchanged plan must not\n // cost a round trip, and re-normalizing what is stored is not a change.\n if (!outcome.plan.changed) return settle({ ok: true, changed: false })\n\n await settingsScope.mutate(sectionOps(outcome.plan.next), gate.revision)\n return settle(classify(gate.catalog, outcome.plan.next, gate.revision))\n } catch (error) {\n // Either the plan could not be built or the write never settled against\n // the Host. Neither is replayed: a silent retry could submit a plan the\n // user has already moved past, and every write answers with an outcome\n // rather than rejecting into a click handler.\n //\n // The scope recovers by itself only when the Host *answered* a refusal,\n // so this branch owns the recovery read: whatever the surfaces render\n // next must come from the Host, not from a snapshot this write may have\n // already invalidated.\n await mirror.load().catch(() => undefined)\n return settle({ ok: false, failure: { kind: 'failed', message: messageOf(error) } })\n }\n })\n tail = task.catch(() => undefined)\n return task.finally(() => {\n writing -= 1\n publish()\n })\n }\n\n return {\n getSnapshot: () => state,\n subscribe(listener) {\n listeners.add(listener)\n return () => {\n listeners.delete(listener)\n }\n },\n refresh: async () => {\n if (disposed) return\n await mirror.load()\n },\n openManager() {\n manager = { open: true }\n publish()\n },\n closeManager() {\n manager = { open: false }\n publish()\n },\n dismissFailure() {\n failure = undefined\n publish()\n },\n createCustomAction: (draft) =>\n submit((context) => planCreateCustomQuickAction(context, { id: mintId(), draft })),\n clonePreset: (presetId) =>\n submit((context) => planClonePresetQuickAction(context, { presetId, id: mintId() })),\n updateCustomAction: (id, draft) => submit((context) => planUpdateCustomQuickAction(context, { id, draft })),\n setCustomActionEnabled: (id, enabled) =>\n submit((context) => planSetCustomQuickActionEnabled(context, { id, enabled })),\n deleteCustomAction: (id) => submit((context) => planDeleteCustomQuickAction(context, { id })),\n setPresetHidden: (presetId, hidden) =>\n submit((context) => planSetPresetQuickActionHidden(context, { presetId, hidden })),\n reorderActions: (order) => submit((context) => planReorderQuickActions(context, { order })),\n moveAction: (ref, toIndex) => submit((context) => planMoveQuickAction(context, { ref, toIndex })),\n setLayout: (layout) => submit((context) => planSetQuickActionLayout(context, { layout })),\n /**\n * Release what this module owns. The two scope bindings are withdrawn by the\n * binder's own disposer on the fiber this controller was created on, so the\n * fiber and this call together leave nothing behind.\n */\n dispose() {\n disposed = true\n for (const stop of stopSources) stop()\n stopConnection()\n listeners.clear()\n },\n }\n}\n\nfunction messageOf(error: unknown): string {\n return error instanceof Error ? error.message : String(error)\n}\n","/**\n * The send preconditions of spec 9.2, derived from nothing but the public\n * per-Session snapshots a dock Slot entry receives.\n *\n * Both functions are total over the published `InputState` and the published\n * `SessionSnapshot`: every field of the public Input snapshot is accounted for\n * here or explained as deliberately not a precondition, because spec 9.5 makes\n * that exact field set the only evidence this feature may judge a send by.\n */\nimport type { ComposerBlock, InputState, SessionSnapshot } from '../dsh.js'\n\n/** Why no Quick Action may execute in this Composer right now (spec 3, 9.2). */\nexport type QuickActionUnavailableReason =\n /** The draft holds text, an attachment or a reference chip (Occupied Draft). */\n | 'occupied-draft'\n /** The input machine is mid-adjudication, mid-submit, or in command mode. */\n | 'composer-busy'\n /** A feature-owned Composer block is raised for this Session. */\n | 'composer-blocked'\n /** The Session was removed. */\n | 'session-removed'\n /** A continuable subagent whose parent is not available: the composer is inert. */\n | 'parent-offline'\n /** This Session already has a send in flight (spec 9.5 single-flight). */\n | 'sending'\n\n/**\n * Whether one published list field carries content, read totally.\n *\n * A field that is absent or not an array counts as content. The snapshot is the\n * only evidence this guard has, and DSH has renamed a field of it out from\n * under this plugin once already (`imageIds` → `attachmentIds` in 0.1.5-rc.1,\n * ticket 29). If that happens again, a Quick Action must go inert rather than\n * load a draft whose remaining content this guard can no longer see — an action\n * that fired blind would submit its own text *plus* whatever the user had\n * attached.\n *\n * This is not the compatibility fallback spec 21.3 rules out: no superseded\n * field name is ever read, and nothing degrades to a working state. The only\n * thing it buys is that an unreadable snapshot reports `occupied-draft` instead\n * of throwing through `derive → publish → observe` and taking the whole surface\n * down with it.\n */\nfunction holdsContent(field: readonly unknown[] | undefined): boolean {\n if (!Array.isArray(field)) return true\n return field.length > 0\n}\n\n/**\n * Whether the draft is occupied (spec 9.2). Occupancy is any text — pure\n * whitespace included, so the raw string is compared against `''` and never\n * trimmed — any attachment, and any rich reference.\n *\n * The public snapshot exposes exactly `{ draft, attachmentIds, draftRev, phase,\n * claim?, occurrences, queue }`. Occupancy reads three of them:\n *\n * - `draft` — the clipboard-text projection of the whole document. Compared\n * against `''`, so a snapshot without it is occupied for the same reason\n * {@link holdsContent} gives;\n * - `attachmentIds` — the ordered draft attachments, and the only public\n * attachment field there is. Since 0.1.5-rc.1 it admits any attachment kind,\n * not just images;\n * - `occurrences` — the reference chips. They are already expanded inside\n * `draft`, so this test is redundant today; it is kept because a future chip\n * whose clipboard projection is empty must still count as content the send\n * action would carry away.\n *\n * The remaining fields are not occupancy: `draftRev` is a revision counter,\n * `phase`/`claim` are the submit plane (handled by {@link composerGate}), and\n * `queue` is the Session's transient inbox, which spec 9.2 explicitly allows a\n * send to join.\n */\nexport function isOccupiedDraft(input: InputState): boolean {\n return input.draft !== '' || holdsContent(input.attachmentIds) || holdsContent(input.occurrences)\n}\n\n/**\n * The composer-level guard, reproducing the shipped send button's own\n * conditions from public state alone (spec 9.2).\n *\n * `disabled` in spec 9.2's list is the shipped bar's inert state, which is\n * reached only without a Session or on the blank-session hero. Neither can\n * occur here: both dock Slots are session-scoped, and the Quick Action surfaces\n * render only where the Resident Composer predicate holds.\n */\nexport function composerGate(\n input: InputState,\n session: SessionSnapshot,\n block: ComposerBlock | undefined,\n): QuickActionUnavailableReason | undefined {\n if (session.removed) return 'session-removed'\n if (block !== undefined) return 'composer-blocked'\n if (session.subagent?.address.mode === 'continuable' && session.subagent.parentAvailable !== true) {\n return 'parent-offline'\n }\n // `claimed` is listed with the busy phases on purpose: a live command claim\n // owns the draft, and admitting a send there would submit the user's command\n // token rather than the action's text.\n if (input.phase !== 'plain') return 'composer-busy'\n if (isOccupiedDraft(input)) return 'occupied-draft'\n return undefined\n}\n","/**\n * The per-Session Quick Action execution layer (spec 7.2, 9.2–9.5).\n *\n * One engine per Session owns the current `InputActions`, the confirmation in\n * flight and the send single-flight. Nothing global holds it: the registry below\n * hands the same engine to whichever Slot entry is currently rendering the\n * layout, so switching layouts re-mounts a component without ever minting a\n * second lock for the same Session (spec 7.2).\n *\n * ## The single-flight window\n *\n * Spec 9.5 asks for a window that runs from the first activation until the\n * official submission stage ends, judged only from the published Input snapshot\n * `{ draft, attachmentIds, draftRev, phase, claim?, occurrences, queue }`, with the\n * hard acceptance criterion that it never produces a duplicate send.\n *\n * The mutex itself is this module's own: {@link QuickActionSessionEngine.activate}\n * claims it synchronously, before any await and before the draft is touched. It\n * is deliberately not derived from draft occupancy — the official default sink\n * clears optimistically, so a second activation one frame later would find an\n * empty draft and pass every precondition. That is the duplicate-send trap, and\n * the regression test for it pins two activations in the same tick.\n *\n * What the public snapshot is used for is deciding *when the window may close*,\n * and the answer differs by the path the official machine took. Both readings\n * come from one place: `SessionInputShell.submit()` feeds an `enter` event to a\n * pure submit machine and executes the resulting effects synchronously, then\n * publishes. So the first snapshot observed after `submit()` returns already\n * carries the machine's verdict.\n *\n * - **The machine kept the frozen slot** (`phase` is `adjudicating` or\n * `submitting`). Our attempt owns that slot exclusively — the machine refuses\n * another `enter` while it is held — so the phase is attributable to this\n * submission. The window stays open until the phase leaves those states; that\n * is the latest reliable public boundary of the official stage, and past it\n * every outcome belongs to DSH's own feedback (spec 9.5).\n * - **The machine committed an ordinary send** (`phase` back to `plain` and\n * `draft` empty). The optimistic commit is the official stage's last publicly\n * observable step: the default sink runs detached, and nothing about it\n * reaches the public snapshot. So the commit is the latest boundary\n * attributable to this submission, and the window closes there.\n * - **The machine refused the submission** (`phase` still `plain` and `draft`\n * still holding content). Nothing was sent; the text stays exactly as loaded\n * and the window closes with \"not sent, text retained\".\n *\n * The ordinary-send test is emptiness, not equality with the text that was\n * loaded: `draft` is the editor's clipboard-text projection rather than the\n * string handed to `setDraft`, so comparing the two would make the verdict\n * depend on that round trip. Emptiness needs no such assumption — the load only\n * ever runs against a verified-unoccupied draft, so anything in `draft` after it\n * is this feature's own text, and only the official commit clears it.\n *\n * The window also never closes inside the activation that opened it: settlement\n * is read from {@link QuickActionSessionEngine.observe}, which the owning entry\n * calls once per commit, so two activations in one tick can only ever produce\n * one send however fast the official sink empties the draft.\n *\n * Nothing here reads the DOM, Lexical, a private event or a private state, and\n * no DSH object is retained beyond the Session it belongs to.\n */\nimport { composerGate } from './guards.js'\nimport type { QuickActionUnavailableReason } from './guards.js'\nimport type { ComposerBlock, InputActions, InputState, SessionSnapshot } from '../dsh.js'\nimport { quickActionRefKey } from '../../model/index.js'\nimport type { ProjectedQuickAction, QuickActionRef } from '../../model/index.js'\n\n/** The action awaiting the user's confirmation (spec 9.3). */\nexport interface PendingQuickActionConfirmation {\n readonly ref: QuickActionRef\n readonly label: string\n /** The complete text that will be submitted; the panel shows it verbatim. */\n readonly text: string\n /** Whether this is a Command Send Action, so the panel can carry its notice. */\n readonly command: boolean\n}\n\n/** What the surfaces report after an execution attempt (spec 9.3, 9.5). */\nexport type QuickActionFeedback =\n /** A re-verification found the action, Session, draft or guard changed. */\n | { readonly kind: 'state-changed' }\n /** The text was loaded but the machine did not take it; the draft keeps it. */\n | { readonly kind: 'retained' }\n /** Nothing was loaded; the draft is untouched and the action can be retried. */\n | { readonly kind: 'failed'; readonly message: string }\n\n/** Everything the surfaces render about this Session's execution state. */\nexport interface QuickActionSessionState {\n /** Why no action may run right now, or `undefined` when they may (spec 3). */\n readonly unavailable: QuickActionUnavailableReason | undefined\n /** The confirmation panel's subject, when one is open. */\n readonly confirming: PendingQuickActionConfirmation | undefined\n /** Whether a send holds this Session's single flight. */\n readonly sending: boolean\n /** The action holding the flight, so its own control can show the state. */\n readonly activeRef: QuickActionRef | undefined\n /** The last execution feedback, until dismissed or superseded. */\n readonly feedback: QuickActionFeedback | undefined\n}\n\n/** The per-Session engine as the surfaces consume it. */\nexport interface QuickActionSessionEngine {\n getSnapshot(): QuickActionSessionState\n subscribe(listener: () => void): () => void\n /**\n * Publish the current DSH state into the engine. Called on every commit of\n * the entry that owns the layout, and the only way a snapshot reaches here —\n * the engine never subscribes to a DSH store of its own.\n */\n observe(input: InputState, session: SessionSnapshot, block: ComposerBlock | undefined): void\n /** Bind the live `InputActions` and the live Composer projection (spec 7.2). */\n bind(face: InputActions | undefined, composer: readonly ProjectedQuickAction[]): void\n /** Begin one Quick Action: claims the single flight, or is ignored. */\n activate(action: ProjectedQuickAction): void\n /** Confirm the pending action after re-verifying everything (spec 9.3). */\n confirm(): void\n /** Cancel the pending confirmation with no side effect (spec 9.3). */\n cancel(): void\n dismissFeedback(): void\n /**\n * Drop everything that has not entered the official state machine — the\n * Session-switch, layout-unmount and Slot-replacement rule of spec 7.2. A send\n * the machine already accepted is left alone: it belongs to its own Session.\n */\n cancelPending(): void\n dispose(): void\n}\n\n/** Where one activation stands. */\ntype Flight =\n /**\n * The mutex is held and nothing has been written yet: either the confirmation\n * panel is open, or the confirmation-free path is re-verifying (spec 9.3).\n */\n | { readonly stage: 'pending'; readonly ref: QuickActionRef }\n /**\n * `setDraft` + `submit` have been called; the next observed commit carries the\n * machine's verdict, because both calls publish synchronously before the\n * activation returns.\n */\n | { readonly stage: 'submitted'; readonly ref: QuickActionRef }\n /** The machine holds the frozen slot for this attempt; wait for it to release. */\n | { readonly stage: 'official'; readonly ref: QuickActionRef }\n\n/** The last DSH state the engine was handed. */\ninterface Observed {\n readonly input: InputState\n readonly session: SessionSnapshot\n readonly block: ComposerBlock | undefined\n}\n\n/**\n * The executable identity of an action: everything a re-verification must find\n * unchanged before the draft is touched (spec 9.3). `command` is included even\n * though it is derived from `text`, so a rewrite that moves the action across\n * the Command Send Action boundary is rejected under its own name.\n */\nfunction identityOf(action: ProjectedQuickAction): string {\n return JSON.stringify([\n quickActionRefKey(action.ref),\n action.label,\n action.text,\n action.confirm,\n action.command,\n action.hidden,\n ])\n}\n\nfunction messageOf(error: unknown): string {\n return error instanceof Error ? error.message : String(error)\n}\n\n/** Create the execution engine for one Session. */\nexport function createQuickActionSessionEngine(sessionId: string): QuickActionSessionEngine {\n const listeners = new Set<() => void>()\n let disposed = false\n let observed: Observed | undefined\n let actions: InputActions | undefined\n let composer: readonly ProjectedQuickAction[] = []\n let flight: Flight | undefined\n let confirming: PendingQuickActionConfirmation | undefined\n let identity: string | undefined\n let feedback: QuickActionFeedback | undefined\n /** True while `run` is on the stack, so no settlement can close its own flight. */\n let running = false\n let state = derive()\n\n function derive(): QuickActionSessionState {\n const gate =\n flight !== undefined\n ? ('sending' as const)\n : observed === undefined\n ? ('composer-busy' as const)\n : composerGate(observed.input, observed.session, observed.block)\n return {\n unavailable: gate,\n confirming,\n sending: flight !== undefined,\n activeRef: flight?.ref,\n feedback,\n }\n }\n\n function publish(): void {\n if (disposed) return\n const next = derive()\n if (\n next.unavailable === state.unavailable &&\n next.confirming === state.confirming &&\n next.sending === state.sending &&\n next.activeRef === state.activeRef &&\n next.feedback === state.feedback\n ) {\n return\n }\n state = next\n for (const listener of Array.from(listeners)) listener()\n }\n\n /** End the flight, optionally reporting why. */\n function settle(next: QuickActionFeedback | undefined): void {\n flight = undefined\n confirming = undefined\n identity = undefined\n feedback = next\n publish()\n }\n\n /** The action as the current Composer projection carries it, if it still does. */\n function shownAction(ref: QuickActionRef): ProjectedQuickAction | undefined {\n const key = quickActionRefKey(ref)\n const found = composer.find((action) => quickActionRefKey(action.ref) === key)\n return found === undefined || found.hidden ? undefined : found\n }\n\n /** Re-read everything spec 9.3 lists, immediately before the draft is touched. */\n function reverify(ref: QuickActionRef): ProjectedQuickAction | undefined {\n const found = shownAction(ref)\n if (found === undefined) return undefined\n if (identity !== undefined && identityOf(found) !== identity) return undefined\n if (observed === undefined || observed.session.sessionId !== sessionId) return undefined\n if (composerGate(observed.input, observed.session, observed.block) !== undefined) return undefined\n return found\n }\n\n /**\n * Load the static text and hand it to the official submit path (spec 9.4).\n * The two calls are the whole write side of this feature; everything before\n * them is verification and everything after is observation.\n */\n function run(action: ProjectedQuickAction): void {\n const face = actions\n if (face === undefined || observed === undefined) {\n settle({ kind: 'state-changed' })\n return\n }\n running = true\n try {\n try {\n face.setDraft(action.text)\n } catch (error) {\n // Nothing reached the draft, so the user's own content — an empty draft\n // at this point — is intact and the action may simply be retried.\n settle({ kind: 'failed', message: messageOf(error) })\n return\n }\n flight = { stage: 'submitted', ref: action.ref }\n confirming = undefined\n try {\n face.submit()\n } catch (error) {\n // The text is loaded but no submission started. Spec 9.5: keep it exactly\n // as loaded, say so, and never retry on the user's behalf.\n void error\n settle({ kind: 'retained' })\n return\n }\n } finally {\n running = false\n }\n publish()\n }\n\n return {\n getSnapshot: () => state,\n subscribe(listener) {\n listeners.add(listener)\n return () => {\n listeners.delete(listener)\n }\n },\n\n observe(input, session, block) {\n if (disposed) return\n observed = { input, session, block }\n // Publications made by this feature's own two calls carry no verdict: the\n // machine's answer is read on the next commit of the owning entry.\n if (running) return\n\n if (flight?.stage === 'submitted') {\n if (input.phase === 'adjudicating' || input.phase === 'submitting') {\n flight = { stage: 'official', ref: flight.ref }\n confirming = undefined\n feedback = undefined\n } else if (input.draft === '') {\n // The official optimistic commit cleared the load: accepted. The local\n // message echo is the success feedback (spec 9.5).\n settle(undefined)\n } else {\n settle({ kind: 'retained' })\n }\n } else if (flight?.stage === 'official' && input.phase !== 'adjudicating' && input.phase !== 'submitting') {\n // The frozen slot was released: the official stage this submission\n // entered has ended, and whatever it produced is DSH's to report.\n settle(undefined)\n }\n\n publish()\n },\n\n bind(face, projection) {\n if (disposed) return\n actions = face\n composer = projection\n // An action deleted or hidden while its confirmation is open cancels that\n // confirmation outright, with no side effect (spec 9.3). A *rewritten*\n // definition deliberately does not: spec 9.3 treats that as a change the\n // user is told about, so the panel stays and the confirmation refuses.\n if (confirming !== undefined && shownAction(confirming.ref) === undefined) settle(undefined)\n publish()\n },\n\n activate(action) {\n if (disposed) return\n // The mutex, claimed before anything else can observe an empty draft.\n if (flight !== undefined) return\n if (observed === undefined || observed.session.sessionId !== sessionId) {\n settle({ kind: 'state-changed' })\n return\n }\n if (\n shownAction(action.ref) === undefined ||\n composerGate(observed.input, observed.session, observed.block) !== undefined\n ) {\n settle({ kind: 'state-changed' })\n return\n }\n\n identity = identityOf(action)\n feedback = undefined\n flight = { stage: 'pending', ref: action.ref }\n if (action.confirm) {\n confirming = {\n ref: action.ref,\n label: action.label,\n text: action.text,\n command: action.command,\n }\n publish()\n return\n }\n // A confirmation-free action still re-reads everything immediately before\n // the draft is touched (spec 9.3); `run` is reached with the same\n // guarantees the confirmed path has.\n const fresh = reverify(action.ref)\n if (fresh === undefined) {\n settle({ kind: 'state-changed' })\n return\n }\n run(fresh)\n },\n\n confirm() {\n if (disposed || flight?.stage !== 'pending' || confirming === undefined) return\n const fresh = reverify(flight.ref)\n if (fresh === undefined) {\n settle({ kind: 'state-changed' })\n return\n }\n run(fresh)\n },\n\n cancel() {\n if (disposed || flight?.stage !== 'pending' || confirming === undefined) return\n // Cancelling never touched the draft, so there is nothing to undo.\n settle(undefined)\n },\n\n dismissFeedback() {\n if (disposed || feedback === undefined) return\n feedback = undefined\n publish()\n },\n\n cancelPending() {\n if (disposed || flight === undefined) return\n if (flight.stage !== 'pending') return\n settle(undefined)\n },\n\n dispose() {\n disposed = true\n listeners.clear()\n actions = undefined\n observed = undefined\n composer = []\n },\n }\n}\n\n/**\n * The fiber-owned registry of per-Session engines.\n *\n * The engine is looked up by Session id rather than constructed by the surface,\n * which is what keeps one lock per Session across a layout switch: the ribbon\n * unmounts as the bar mounts, and the engine in between is the same object\n * (spec 7.2). Engines live until the Client fiber unloads; each one is a handful\n * of fields, and tying their lifetime to the fiber avoids a reference count that\n * a double-invoked render could get wrong.\n */\nexport interface QuickActionSessionRegistry {\n /** This Session's engine, created on first use. */\n engineFor(sessionId: string): QuickActionSessionEngine\n /** Release every engine — the Client fiber's own disposer. */\n dispose(): void\n}\n\nexport function createQuickActionSessionRegistry(): QuickActionSessionRegistry {\n const engines = new Map<string, QuickActionSessionEngine>()\n\n return {\n engineFor(sessionId) {\n let engine = engines.get(sessionId)\n if (engine === undefined) {\n engine = createQuickActionSessionEngine(sessionId)\n engines.set(sessionId, engine)\n }\n return engine\n },\n dispose() {\n for (const engine of engines.values()) {\n engine.cancelPending()\n engine.dispose()\n }\n engines.clear()\n },\n }\n}\n","/**\n * The Resident Composer predicate (spec 2.3, 8.1; spec 15, decision 6).\n *\n * ## Why a predicate is needed at all\n *\n * The two dock Slots this feature registers into do not have the same reach:\n *\n * - `conversation.composer.dock` — \"Ambient entries below the composer card\" —\n * is rendered by the shipped `InputBar` under\n * `variant === 'composer' && input !== undefined && sessionId !== undefined`.\n * The blank-session hero renders the same bar with `variant: 'hero'`, and that\n * branch renders no composer dock at all.\n * - `conversation.input.dock` — \"Full-width entries above the composer card\" —\n * is rendered by `ConversationRoot` from the composer stack, which is shared\n * by the hero and the resident composer. Its `zone` owner prop only requires\n * a Session and an Input, so the entry *does* mount on the hero.\n *\n * So the input dock alone cannot tell a Resident Composer from a hero, and the\n * first release must render in one and never the other.\n *\n * ## The predicate\n *\n * A `conversation.composer.dock` entry is mounted **if and only if** the shipped\n * composer is in its resident, session-backed variant. That mount is therefore\n * DSH's own public statement of residency, and this registry is how the input\n * dock reads it: the composer-dock entry marks its Session resident while it is\n * mounted, and the input-dock entry renders the current layout only while the\n * mark stands.\n *\n * It is a contract-level signal, not a guess: no DOM is measured, no private\n * Composer state is read, and the shipped hero branch is not re-derived here —\n * which is what spec 8.1 forbids (\"不得通过 DOM 或私有 Composer 状态猜测来规避\").\n * The mark is published from a layout effect, so a hero that becomes resident\n * brings the layout up in the same commit rather than the next one; and if that\n * ever slipped a frame, it would slip in the required direction — the hard rule\n * is that nothing appears on the hero, never that it appears instantly.\n *\n * Takeover composers need no predicate of their own: when a `conversation.composer`\n * chain entry wins, the renderer keeps the resident fallback mounted but hides\n * its wrapper, so both docks — and everything in them — go with it.\n */\n\n/** Which Sessions currently have a Resident Composer on screen. */\nexport interface ResidentComposerRegistry {\n /**\n * Mark one Session's Composer resident. The disposer withdraws the mark, and\n * marks are counted, so a remount that overlaps its own unmount cannot leave\n * the Session looking non-resident.\n */\n mark(sessionId: string): () => void\n isResident(sessionId: string): boolean\n /**\n * The Session that owns anything global, or `undefined` when none is resident.\n *\n * The centralized management panel is global state rendered from a\n * session-scoped Slot (spec 8.1 asks for it to be registered independently,\n * and this release has no Slot outside a Session to register into). So if two\n * Resident Composers were ever on screen at once, both entries would render\n * the same overlay. Electing one owner — the Session that has been resident\n * longest, which is stable while it stays mounted — is what keeps the panel\n * single.\n */\n primarySessionId(): string | undefined\n subscribe(listener: () => void): () => void\n}\n\nexport function createResidentComposerRegistry(): ResidentComposerRegistry {\n const marks = new Map<string, number>()\n const listeners = new Set<() => void>()\n\n function publish(): void {\n for (const listener of Array.from(listeners)) listener()\n }\n\n return {\n mark(sessionId) {\n marks.set(sessionId, (marks.get(sessionId) ?? 0) + 1)\n publish()\n let withdrawn = false\n return () => {\n if (withdrawn) return\n withdrawn = true\n const held = (marks.get(sessionId) ?? 1) - 1\n if (held > 0) marks.set(sessionId, held)\n else marks.delete(sessionId)\n publish()\n }\n },\n isResident: (sessionId) => marks.has(sessionId),\n // Insertion-ordered: the first key is the Session marked longest ago that is\n // still marked, so the owner only changes when it actually stops being one.\n primarySessionId: () => marks.keys().next().value,\n subscribe(listener) {\n listeners.add(listener)\n return () => {\n listeners.delete(listener)\n }\n },\n }\n}\n","/**\n * One Slot entry's local error boundary (spec 7.3).\n *\n * A render error inside the Quick Action surfaces replaces the Quick Action\n * area and nothing else: the Composer, its draft and its submit button keep\n * working, and the user can ask for the surface back. Retrying remounts the\n * subtree by changing its key, so a transient failure clears without a reload.\n *\n * DSH's own submission errors never reach here — they are reported by the\n * Composer, and this feature must not repeat them (spec 9.5).\n */\nimport { Component, Fragment } from 'react'\nimport type { ErrorInfo, ReactNode } from 'react'\nimport type { Translate } from '../dsh.js'\n\nexport interface SurfaceErrorBoundaryProps {\n readonly t: Translate\n readonly children: ReactNode\n}\n\ninterface SurfaceErrorBoundaryState {\n readonly failed: boolean\n /** Bumped on retry so the failing subtree is rebuilt rather than reused. */\n readonly attempt: number\n}\n\nexport class SurfaceErrorBoundary extends Component<SurfaceErrorBoundaryProps, SurfaceErrorBoundaryState> {\n override state: SurfaceErrorBoundaryState = { failed: false, attempt: 0 }\n\n static getDerivedStateFromError(): Partial<SurfaceErrorBoundaryState> {\n return { failed: true }\n }\n\n override componentDidCatch(error: Error, info: ErrorInfo): void {\n // The console is the only channel here: a toast would compete with DSH's own\n // error surface, and the retry affordance below is the user-facing report.\n console.error('[composer-quick-actions] surface failed', error, info.componentStack)\n }\n\n private readonly retry = (): void => {\n this.setState((current) => ({ failed: false, attempt: current.attempt + 1 }))\n }\n\n override render(): ReactNode {\n const { t, children } = this.props\n // A Fragment, never an element: both docks lay their entries out in a flex\n // column with a gap, so an empty wrapper would shift the Composer every time\n // the surfaces render nothing — on the hero, and on the dock that does not\n // own the current layout.\n if (!this.state.failed) return <Fragment key={this.state.attempt}>{children}</Fragment>\n return (\n <div className=\"dsh-cqa-note\" role=\"status\">\n <span className=\"dsh-cqa-note-text\">{t('crash.title')}</span>\n <button type=\"button\" className=\"dsh-cqa-link\" onClick={this.retry}>\n {t('crash.retry')}\n </button>\n </div>\n )\n }\n}\n","/**\n * The visible face of one Quick Action — the shared action control of spec 14's\n * `src/client/surfaces/` boundary.\n *\n * Three places offer an action to the user: a layout's control, the shared\n * searchable action panel's list item, and the management list's row. All three\n * must read the same, because the Command marker is only meaningful if it looks\n * and means the same wherever it appears, and the emoji is only decoration if it\n * is `aria-hidden` in every one of them (spec 8.4).\n *\n * It renders a fragment, not an element: each caller owns its own control — a\n * `<button>`, a list row — and its own layout box.\n */\nimport type { ReactElement } from 'react'\nimport { Pill } from '@deepseek-ai/dsh-client-ui-primitives'\nimport type { ProjectedQuickAction } from '../../model/index.js'\nimport type { Translate } from '../dsh.js'\n\nexport interface ActionFaceProps {\n readonly action: ProjectedQuickAction\n readonly t: Translate\n}\n\nexport function ActionFace({ action, t }: ActionFaceProps): ReactElement {\n return (\n <>\n {action.icon === undefined ? null : (\n // Decoration only: never an accessible name, never a label's substitute.\n <span className=\"dsh-cqa-icon\" aria-hidden=\"true\">\n {action.icon}\n </span>\n )}\n <span className=\"dsh-cqa-label\">{action.label}</span>\n {action.command ? <Pill className=\"dsh-cqa-badge\">{t('command.badge')}</Pill> : null}\n </>\n )\n}\n","/**\n * The width and density rules of spec 8.2, as pure functions.\n *\n * The geometry itself is CSS (see `src/styles/`), because the two docks sit in\n * different boxes: the ribbon renders outside the InputBar, which owns the side\n * clearance, so it must subtract that clearance itself; the bar renders inside\n * the InputBar, whose padding already is the clearance, so it takes the full\n * width. Both are then capped by the card's own max width and centred, which is\n * what makes their outer edges line up with the input box.\n *\n * What is left over is the part that cannot be expressed in CSS: how many\n * leading actions the `bar` layout shows before the rest fold into \"more\", and\n * which density the surface renders at. Both are decided here so the rules can\n * be pinned by tests rather than by a screenshot.\n */\n\n/** How the surface presents itself at the current width (spec 8.2). */\nexport type SurfaceDensity = 'wide' | 'narrow'\n\n/**\n * Below this surface width the layout drops secondary information — the section\n * title — and tightens its spacing. It never changes the outer width, and it\n * never drops a control's visible text label (spec 8.2, 8.4).\n *\n * Sized against the viewports spec 13.3 requires: a desktop or ~768px viewport\n * leaves the composer far above this, and a ~360px viewport lands well below it.\n */\nexport const NARROW_SURFACE_WIDTH = 480\n\nexport function densityFor(width: number): SurfaceDensity {\n return width > 0 && width < NARROW_SURFACE_WIDTH ? 'narrow' : 'wide'\n}\n\n/** One measured row of the `bar` layout. */\nexport interface BarFitInput {\n /** Usable inner width of the action row. */\n readonly available: number\n /** Measured width of each action control, in the shared order. */\n readonly widths: readonly number[]\n /** Width the always-visible controls (\"more\", \"manage\") need to keep. */\n readonly reserved: number\n /** Gap between adjacent controls. */\n readonly gap: number\n}\n\n/**\n * How many leading actions the `bar` layout shows (spec 8.1). The rest fold into\n * the shared action panel behind \"more\", and the management entry stays visible\n * whatever the answer is.\n *\n * Before the first measurement — a fresh mount, or a headless environment with\n * no layout — every width reads as zero. That answers \"all of them\": showing the\n * full row and letting the browser's own overflow handle it for one frame is\n * better than flashing a \"more\" button that the next frame withdraws.\n */\nexport function fitActionCount(input: BarFitInput): number {\n const { available, widths, reserved, gap } = input\n if (widths.length === 0) return 0\n if (available <= 0 || widths.every((width) => width <= 0)) return widths.length\n\n let used = reserved\n let shown = 0\n for (const width of widths) {\n const next = used + width + (shown === 0 && reserved === 0 ? 0 : gap)\n if (next > available) break\n used = next\n shown += 1\n }\n return shown\n}\n","/**\n * The shared action panel's search rule (spec 8.1).\n *\n * Spec 8.1 requires the search to *actually* filter — the prototype's\n * \"shows everything\" placeholder is explicitly forbidden — to keep matches in\n * their `actionOrder` relative order, and to have one stated policy for which\n * fields are searched, how case is handled and how Unicode is normalized.\n *\n * That policy is:\n *\n * - **Fields**: the label and the static text, and nothing else. Those are the\n * two things the user wrote and can read; the icon is decoration and never an\n * accessible or searchable name (spec 8.4), and the Command badge is derived\n * from the text that is already searched.\n * - **Case**: folded with `toLowerCase()`, which is the locale-independent\n * Unicode default mapping. `toLocaleLowerCase()` is deliberately avoided: it\n * would make the same query behave differently for a Turkish `i` depending on\n * the UI language, and a filter that depends on the locale cannot be pinned.\n * - **Unicode**: NFKC. It folds the compatibility forms a CJK IME actually\n * produces — full-width Latin and full-width punctuation above all — so a\n * query typed with the IME still finds half-width text.\n * - **Whitespace**: every run collapses to one space, on both sides, so a\n * one-line query can match a multi-line action text. The run definition is\n * the regex `\\s`, which is the same ECMAScript whitespace `trim()` uses, so\n * this stays consistent with the blank rules of spec 4.3.\n *\n * Matching is per field and by substring: an action matches when the normalized\n * query appears in its normalized label or in its normalized text. Fields are\n * never concatenated first, which would let a query match across a boundary\n * that does not exist.\n *\n * The comparison is deliberately not locale-collated (`Intl.Collator`): a\n * collator answers \"are these equal\", not \"does this contain that\", and a\n * substring search is what a filter box means.\n */\nimport type { ProjectedQuickAction } from '../../model/index.js'\n\n/** The fields a query is compared against. */\nconst SEARCH_FIELDS: readonly ['label', 'text'] = ['label', 'text']\n\n/**\n * The one normalization both sides of a comparison go through. Applying it to\n * the query and to the haystack through the same function is what keeps the two\n * from drifting apart.\n */\nexport function normalizeQuickActionSearchText(value: string): string {\n return value.normalize('NFKC').toLowerCase().replace(/\\s+/gu, ' ').trim()\n}\n\n/**\n * Whether a query asks for anything at all. A whitespace-only box is an empty\n * one, and telling the two apart is what lets a panel say \"nothing matched\"\n * rather than \"nothing to run\".\n */\nexport function hasQuickActionQuery(query: string): boolean {\n return normalizeQuickActionSearchText(query) !== ''\n}\n\n/**\n * The actions matching `query`, in their original relative order.\n *\n * An empty or whitespace-only query hands the same array back by identity: an\n * unsearched panel is not a filtered panel, and returning a copy would remount\n * every row for nothing.\n */\nexport function filterQuickActions(\n actions: readonly ProjectedQuickAction[],\n query: string,\n): readonly ProjectedQuickAction[] {\n const needle = normalizeQuickActionSearchText(query)\n if (needle === '') return actions\n return actions.filter((action) =>\n SEARCH_FIELDS.some((field) => normalizeQuickActionSearchText(action[field]).includes(needle)),\n )\n}\n","/**\n * The modal semantics every Quick Action panel shares (spec 8.4).\n *\n * Spec 8.4 makes Escape cancellation, a clear focus ring, keyboard traversal and\n * focus return after a panel closes hard gates. A Slot entry renders in place,\n * inside the composer stack, so without a Tab boundary a keyboard user would tab\n * straight out of an open panel into the draft behind it, and every route back\n * into the panel would take the Escape handler with it.\n *\n * That holds for the management overlay too, even though ticket 26 moved it onto\n * `document.body` through a portal: a portal relocates the DOM node, not the\n * React tree, so its events still bubble to the dock and its Tab order still\n * follows document order — which is now the end of the body, further from the\n * draft rather than nearer it. Both hooks below are unaffected either way,\n * because both work off the panel element they are handed.\n *\n * This module is a leaf beside `dsh.ts`, owned by no directory of spec 14's\n * source map: the confirmation panel (`session/`), the action panel and the\n * management panel (`manager/`) all need it, and putting it inside any one of\n * them would make another depend on that one's directory for something that is\n * neither an action nor an execution concern.\n *\n * Both hooks are deliberately tiny and DOM-only: they read `document.activeElement`\n * and call `focus()`, which is the browser's own focus contract, not DSH's. No\n * Composer state, private event or Lexical path is touched (spec 9.1).\n */\nimport { useCallback, useEffect, useLayoutEffect, useRef } from 'react'\nimport type { KeyboardEvent as ReactKeyboardEvent, MutableRefObject } from 'react'\n\n/**\n * What Tab may reach inside a panel. Disabled controls are excluded, which is\n * what keeps the boundary correct while a write is in flight and half the\n * panel's buttons are inert.\n */\nconst FOCUSABLE_SELECTOR = [\n 'a[href]',\n 'button:not([disabled])',\n 'input:not([disabled])',\n 'select:not([disabled])',\n 'textarea:not([disabled])',\n '[tabindex]:not([tabindex=\"-1\"])',\n].join(',')\n\n/** What {@link useModalKeys} hands a panel. */\nexport interface ModalKeys<T extends HTMLElement> {\n /** Put on the panel element itself; the Tab boundary is computed from its subtree. */\n readonly panelRef: MutableRefObject<T | null>\n /** Put on the same element; handles Escape and the Tab boundary. */\n readonly onKeyDown: (event: ReactKeyboardEvent<T>) => void\n}\n\n/**\n * Escape cancels, and Tab stays inside.\n *\n * The focusable set is recomputed on every keystroke rather than cached: a\n * management panel grows a form, a form's Save button goes inert while a write\n * is in flight, and a stale boundary would trap focus on a control that is no\n * longer there.\n */\nexport function useModalKeys<T extends HTMLElement>(onCancel: () => void): ModalKeys<T> {\n const panelRef = useRef<T | null>(null)\n\n const onKeyDown = useCallback(\n (event: ReactKeyboardEvent<T>) => {\n if (event.key === 'Escape') {\n // Stopped here: the composer behind this panel also listens for Escape,\n // and cancelling a Quick Action must not also clear the user's draft.\n // A nested editing context — the management form — stops Escape before\n // it reaches this handler, so leaving the form does not close the panel;\n // the form takes focus on open, so that holds from its first keystroke.\n event.stopPropagation()\n onCancel()\n return\n }\n if (event.key !== 'Tab') return\n const focusable = Array.from(panelRef.current?.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR) ?? [])\n const first = focusable[0]\n const last = focusable[focusable.length - 1]\n if (first === undefined || last === undefined) return\n const edge = event.shiftKey ? first : last\n if (event.target !== edge) return\n event.preventDefault()\n ;(event.shiftKey ? last : first).focus()\n },\n [onCancel],\n )\n\n return { panelRef, onKeyDown }\n}\n\n/**\n * Return focus to whatever opened this panel, when it closes (spec 8.4).\n *\n * The opener is captured in a layout effect, so it must be declared *before* any\n * effect that moves focus into the panel: effects run in declaration order\n * within a component, and layout effects run before passive ones, so the capture\n * always sees the control the user actually activated.\n *\n * An opener that has since been unmounted — an action picked from a list that\n * closed with it — is skipped rather than focused, and the caller is free to\n * offer a fallback of its own.\n *\n * @param scope - the closing context's own element, for an editing context\n * nested inside a panel (the management form inside the management panel).\n * When the outer panel closes, React runs the outer cleanup first, the inner\n * cleanup next, and only then removes the outer DOM: by the time the nested\n * context returns focus, the panel has already handed it to *its* opener, and\n * the nested opener is a control about to leave the document. So a nested\n * context returns focus only while focus is still inside it (or fell to the\n * body); focus that has already left belongs to whoever moved it.\n */\nexport function useFocusReturn(scope?: MutableRefObject<HTMLElement | null>): void {\n const opener = useRef<HTMLElement | null>(null)\n\n useLayoutEffect(() => {\n const active = typeof document === 'undefined' ? null : document.activeElement\n opener.current = active === document.body ? null : (active as HTMLElement | null)\n return () => {\n const element = opener.current\n opener.current = null\n if (element === null || !element.isConnected) return\n const current = document.activeElement\n if (\n scope?.current != null &&\n current !== null &&\n current !== document.body &&\n !scope.current.contains(current)\n ) {\n return\n }\n element.focus()\n }\n }, [])\n}\n\n/** Move focus into a panel once, on open (spec 8.4). */\nexport function useInitialFocus<T extends HTMLElement>(): MutableRefObject<T | null> {\n const target = useRef<T | null>(null)\n useEffect(() => {\n target.current?.focus()\n }, [])\n return target\n}\n\n/**\n * Move focus into a panel once, on open, addressing the target through the\n * panel rather than through a ref (spec 8.4).\n *\n * `@deepseek-ai/dsh-client-ui-primitives` publishes no `forwardRef` at all, so\n * an official `Button` or `Input` cannot carry one. Addressing the opening\n * target by marker attribute — the way the Tab boundary above already addresses\n * the focusable set — keeps that limitation in this one module instead of\n * pushing every panel back onto native controls.\n *\n * @param container - the panel whose subtree holds the target.\n * @param selector - CSS selector for the control that should open focused.\n */\nexport function useInitialFocusIn<T extends HTMLElement>(\n container: MutableRefObject<T | null>,\n selector: string,\n): void {\n useEffect(() => {\n container.current?.querySelector<HTMLElement>(selector)?.focus()\n }, [container, selector])\n}\n","/**\n * Which control one Quick Action renders as, given its Session's execution\n * state (spec 3, 9.2).\n *\n * Shared by every surface that offers an action for execution — the three\n * layouts and the shared searchable action panel — so a control cannot explain\n * itself one way in the ribbon and another way behind \"more\".\n */\nimport type { QuickActionSessionState } from './execution.js'\nimport type { QuickActionUnavailableReason } from './guards.js'\nimport { quickActionRefKey } from '../../model/index.js'\nimport type { ProjectedQuickAction } from '../../model/index.js'\n\n/**\n * The reason this action cannot run right now, or `undefined` when it can.\n *\n * While a send holds the Session's single flight, only the action holding it\n * explains itself as \"sending\"; the rest are simply unavailable while the\n * Composer is busy with it (spec 9.5).\n */\nexport function unavailableReasonFor(\n action: ProjectedQuickAction,\n session: QuickActionSessionState,\n): QuickActionUnavailableReason | undefined {\n if (session.unavailable === 'sending') {\n return session.activeRef !== undefined && quickActionRefKey(session.activeRef) === quickActionRefKey(action.ref)\n ? 'sending'\n : 'composer-busy'\n }\n return session.unavailable\n}\n","/**\n * The shared searchable action panel (spec 8.1).\n *\n * One panel serves both entries that need a list rather than a row: the `bar`\n * layout's \"more\" overflow and the `launcher` layout's single entry. Sharing it\n * is a spec requirement, not a convenience — the two entries must not drift into\n * offering different search behaviour or different keyboard handling.\n *\n * The search itself is `./search.js`: it really filters, it keeps the matches in\n * their `actionOrder` relative order, and its field, case and Unicode policy is\n * stated and pinned there. The panel adds only the UI around it — a search field\n * with a visible text label, the same disabled-with-a-reason projection the\n * layouts use (spec 3), and the modal semantics of spec 8.4.\n *\n * Nothing here executes anything: activation is handed straight to the caller's\n * per-Session engine, which owns the single flight and the final re-verification\n * (spec 9.3, 9.5). The panel never mints a second lock.\n */\nimport { useState } from 'react'\nimport type { ReactElement } from 'react'\nimport { filterQuickActions, hasQuickActionQuery } from './search.js'\nimport { IconSearchOutline16, Input } from '@deepseek-ai/dsh-client-ui-primitives'\nimport { useInitialFocusIn, useModalKeys } from '../modal.js'\nimport { ActionFace } from '../surfaces/ActionFace.js'\nimport { unavailableReasonFor } from '../session/availability.js'\nimport type { QuickActionSessionState } from '../session/execution.js'\nimport { quickActionRefKey } from '../../model/index.js'\nimport type { ProjectedQuickAction } from '../../model/index.js'\nimport type { Translate } from '../dsh.js'\n\nexport interface ActionPanelProps {\n /** The actions this entry offers, already in the shared order. */\n readonly actions: readonly ProjectedQuickAction[]\n readonly session: QuickActionSessionState\n readonly t: Translate\n /** Id of the element naming this dialog. */\n readonly labelledBy: string\n readonly onActivate: (action: ProjectedQuickAction) => void\n readonly onClose: () => void\n}\n\nexport function ActionPanel(props: ActionPanelProps): ReactElement {\n const { actions, session, t, labelledBy, onActivate, onClose } = props\n const [query, setQuery] = useState('')\n const { panelRef, onKeyDown } = useModalKeys<HTMLDivElement>(onClose)\n useInitialFocusIn(panelRef, '[data-quick-actions-search]')\n\n const matches = filterQuickActions(actions, query)\n // \"Nothing to run\" and \"nothing matched what you typed\" are different answers,\n // and telling them apart is the difference between a broken panel and an empty\n // search.\n const emptyKey = hasQuickActionQuery(query) ? 'panel.search.empty' : 'empty'\n\n return (\n <>\n {/* The backdrop: clicking outside the panel closes it, with no side effect. */}\n <div className=\"dsh-cqa-backdrop\" data-quick-actions-backdrop=\"\" aria-hidden=\"true\" onClick={onClose} />\n <div\n className=\"dsh-cqa-panel\"\n ref={panelRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={labelledBy}\n data-quick-actions-panel=\"\"\n onKeyDown={onKeyDown}\n >\n <div className=\"dsh-cqa-panel-head\">\n <span className=\"dsh-cqa-panel-title\" id={labelledBy}>\n {t('panel.title')}\n </span>\n {/*\n Escape, the backdrop and the entry itself all close this panel, but\n none of them is visible. A pointer user needs a control they can see\n (spec 8.4).\n */}\n <button type=\"button\" className=\"dsh-cqa-link\" data-quick-actions-panel-close=\"\" onClick={onClose}>\n {t('panel.close')}\n </button>\n </div>\n\n <label className=\"dsh-cqa-field\">\n <span className=\"dsh-cqa-field-label\">{t('panel.search')}</span>\n <Input\n icon={<IconSearchOutline16 />}\n type=\"search\"\n value={query}\n data-quick-actions-search=\"\"\n onChange={(event) => {\n setQuery(event.target.value)\n }}\n />\n </label>\n\n {matches.length === 0 ? <div className=\"dsh-cqa-panel-title\">{t(emptyKey)}</div> : null}\n {matches.map((action) => {\n const reason = unavailableReasonFor(action, session)\n return (\n <button\n key={quickActionRefKey(action.ref)}\n type=\"button\"\n className=\"dsh-cqa-panel-item\"\n data-quick-action={quickActionRefKey(action.ref)}\n disabled={reason !== undefined}\n title={reason === undefined ? action.text : t(`unavailable.${reason}`)}\n onClick={() => {\n onActivate(action)\n onClose()\n }}\n >\n <ActionFace action={action} t={t} />\n </button>\n )\n })}\n </div>\n </>\n )\n}\n","/**\n * The send confirmation panel (spec 9.3).\n *\n * It shows the action's label and the complete text that will be submitted, and\n * for a Command Send Action it also carries the notice spec 9.3 and 16.2 make\n * mandatory: the text goes to DSH's own command adjudication path, and no native\n * `/` suggestion menu appears here, so what is on screen is exactly what will be\n * submitted. Nothing in this panel imitates that menu.\n *\n * Opening it does not touch the draft; cancelling — the button, Escape, or a\n * click on the backdrop — has no side effect at all. The re-verification that\n * follows a confirmation lives in the execution engine, not here.\n */\nimport type { ReactElement } from 'react'\nimport { Button } from '@deepseek-ai/dsh-client-ui-primitives'\nimport type { PendingQuickActionConfirmation } from './execution.js'\nimport { useInitialFocusIn, useModalKeys } from '../modal.js'\nimport type { Translate } from '../dsh.js'\n\nexport interface ConfirmPanelProps {\n readonly pending: PendingQuickActionConfirmation\n readonly t: Translate\n readonly onConfirm: () => void\n readonly onCancel: () => void\n}\n\nexport function ConfirmPanel({ pending, t, onConfirm, onCancel }: ConfirmPanelProps): ReactElement {\n // Escape cancellation, the Tab boundary and the opening focus are the shared\n // modal semantics of spec 8.4; this panel adds no rule of its own. Focus\n // return is the surface's, not this panel's: the control that opened a\n // confirmation is usually disabled or unmounted by the time it closes, so the\n // surface owns the fallback (spec 8.4).\n const { panelRef, onKeyDown } = useModalKeys<HTMLDivElement>(onCancel)\n useInitialFocusIn(panelRef, '[data-quick-actions-confirm-send]')\n\n return (\n <>\n {/* The backdrop: clicking outside the panel cancels, with no side effect. */}\n <div\n className=\"dsh-cqa-backdrop\"\n data-quick-actions-backdrop=\"\"\n aria-hidden=\"true\"\n onClick={onCancel}\n />\n <div\n className=\"dsh-cqa-panel\"\n ref={panelRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={t('confirm.title')}\n data-quick-actions-confirm=\"\"\n onKeyDown={onKeyDown}\n >\n <div className=\"dsh-cqa-panel-title\">{pending.label}</div>\n <div className=\"dsh-cqa-confirm-text\">{pending.text}</div>\n {pending.command ? (\n <p className=\"dsh-cqa-note\" data-quick-actions-command-notice=\"\">\n <span className=\"dsh-cqa-note-text\">{t('confirm.command')}</span>\n </p>\n ) : null}\n <div className=\"dsh-cqa-confirm-actions\">\n <Button variant=\"toolbar\" size=\"sm\" className=\"dsh-cqa-entry\" onClick={onCancel}>\n {t('confirm.cancel')}\n </Button>\n <Button\n variant=\"toolbar\"\n size=\"sm\"\n className=\"dsh-cqa-entry\"\n data-quick-actions-confirm-send=\"\"\n onClick={onConfirm}\n >\n {t('confirm.send')}\n </Button>\n </div>\n </div>\n </>\n )\n}\n","/**\n * The three Quick Action Layouts and the control they share (spec 8.1, 8.2).\n *\n * | layout | Slot | body |\n * |------------|-----------------------------|-------------------------------------------------------------|\n * | `ribbon` | `conversation.input.dock` | title, the actions in shared order, and \"manage\" on one line |\n * | `bar` | `conversation.composer.dock`| the leading actions that fit, then \"more\", then \"manage\" |\n * | `launcher` | `conversation.input.dock` | one compact entry carrying the Composer projection's count |\n *\n * Three rules hold across all of them:\n *\n * - the management entry is always rendered, so hiding or disabling every action\n * still leaves a compact, operable entry rather than an empty strip;\n * - controls keep a visible text label at every width — a narrow surface drops\n * the section title and tightens spacing, and nothing else (spec 8.2, 8.4);\n * - an action that cannot run right now is shown disabled with its reason, never\n * removed. Removal is the Hidden Quick Action projection, and that is the\n * management panel's business (spec 3).\n */\nimport { useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from 'react'\nimport type { MutableRefObject, ReactElement } from 'react'\nimport { Button } from '@deepseek-ai/dsh-client-ui-primitives'\nimport { ActionFace } from './ActionFace.js'\nimport { densityFor, fitActionCount } from './layout.js'\nimport type { SurfaceDensity } from './layout.js'\nimport { ActionPanel } from '../manager/ActionPanel.js'\nimport { ConfirmPanel } from '../session/ConfirmPanel.js'\nimport { unavailableReasonFor } from '../session/availability.js'\nimport type { QuickActionSessionState } from '../session/execution.js'\nimport type { QuickActionUnavailableReason } from '../session/guards.js'\nimport { quickActionRefKey } from '../../model/index.js'\nimport type { ProjectedQuickAction, QuickActionLayout } from '../../model/index.js'\nimport type { Translate } from '../dsh.js'\n\n/** Gap between adjacent controls; mirrors `--gap` in the stylesheet. */\nconst CONTROL_GAP = 8\n\nexport interface QuickActionsSurfaceProps {\n readonly layout: QuickActionLayout\n /** The Composer projection, in the shared order (hidden actions already gone). */\n readonly actions: readonly ProjectedQuickAction[]\n readonly session: QuickActionSessionState\n readonly t: Translate\n readonly onActivate: (action: ProjectedQuickAction) => void\n readonly onConfirm: () => void\n readonly onCancelConfirm: () => void\n readonly onDismissFeedback: () => void\n readonly onManage: () => void\n}\n\nfunction ActionControl(props: {\n readonly action: ProjectedQuickAction\n readonly reason: QuickActionUnavailableReason | undefined\n readonly t: Translate\n readonly onActivate: (action: ProjectedQuickAction) => void\n}): ReactElement {\n const { action, reason, t, onActivate } = props\n return (\n <Button\n variant=\"toolbar\"\n size=\"sm\"\n className=\"dsh-cqa-action\"\n data-quick-action={quickActionRefKey(action.ref)}\n disabled={reason !== undefined}\n title={reason === undefined ? action.text : t(`unavailable.${reason}`)}\n onClick={() => {\n onActivate(action)\n }}\n >\n <ActionFace action={action} t={t} />\n </Button>\n )\n}\n\n/**\n * Measure one element's inner width, republishing on every resize. Used twice:\n * on the whole row for the density rule, and on the action region alone for the\n * bar's overflow split — the region is `flex: 1 1 auto`, so its width is already\n * what is left after the controls that must stay visible.\n */\nfunction useElementWidth(): [MutableRefObject<HTMLDivElement | null>, number] {\n const ref = useRef<HTMLDivElement | null>(null)\n const [width, setWidth] = useState(0)\n\n useEffect(() => {\n const element = ref.current\n if (element === null || typeof ResizeObserver === 'undefined') return\n const observer = new ResizeObserver(() => {\n setWidth(element.clientWidth)\n })\n observer.observe(element)\n setWidth(element.clientWidth)\n return () => {\n observer.disconnect()\n }\n }, [])\n\n return [ref, width]\n}\n\nexport function QuickActionsSurface(props: QuickActionsSurfaceProps): ReactElement {\n const { layout, actions, session, t, onActivate, onConfirm, onCancelConfirm, onDismissFeedback, onManage } = props\n const [rowRef, width] = useElementWidth()\n const [fitRef, fitWidth] = useElementWidth()\n const density: SurfaceDensity = densityFor(width)\n const [panelOpen, setPanelOpen] = useState(false)\n const panelTitleId = useId()\n\n // Measured control widths, cached by action identity: they depend on the\n // label, not on the container, so a resize re-runs only the arithmetic.\n //\n // The scan runs here rather than inside each control because `Button` forwards\n // no ref — primitives publish no `forwardRef` at all — and reading the whole\n // region in one layout effect is less machinery than threading a callback\n // through every control anyway.\n const widths = useRef(new Map<string, number>())\n const [measured, setMeasured] = useState(0)\n useLayoutEffect(() => {\n if (layout !== 'bar') return\n let changed = false\n for (const node of Array.from(fitRef.current?.querySelectorAll<HTMLElement>('[data-quick-action]') ?? [])) {\n const key = node.dataset['quickAction']\n const value = node.offsetWidth\n if (key === undefined || value <= 0 || widths.current.get(key) === value) continue\n widths.current.set(key, value)\n changed = true\n }\n if (changed) setMeasured((seen) => seen + 1)\n })\n\n const shown = useMemo(() => {\n if (layout !== 'bar') return actions.length\n const keys = actions.map((action) => quickActionRefKey(action.ref))\n const known = keys.map((key) => widths.current.get(key) ?? 0)\n // A control whose width is not cached yet keeps every action on screen for\n // one frame rather than folding a measured-as-zero action into \"more\".\n if (known.some((value) => value <= 0)) return actions.length\n return fitActionCount({ available: fitWidth, widths: known, reserved: 0, gap: CONTROL_GAP })\n // `measured` is the cache's revision: it is what makes this recompute.\n }, [layout, actions, fitWidth, measured])\n\n const overflow = layout === 'bar' ? actions.slice(shown) : actions\n /**\n * Resolve one of this surface's own controls by its data marker.\n *\n * `Button` takes no ref, so the focus contract of spec 8.4 addresses controls\n * the way the stylesheet does: through a marker attribute, queried from the\n * row this surface already measures. The selector and the attribute that\n * answers it live in this one file, so the coupling stays local.\n */\n const control = useCallback((marker: string): HTMLElement | null => {\n return rowRef.current?.querySelector<HTMLElement>(`[${marker}]`) ?? null\n }, [rowRef])\n const closePanel = useCallback(() => {\n setPanelOpen(false)\n control('data-quick-actions-entry')?.focus()\n }, [control])\n\n // Focus return after the confirmation closes (spec 8.4): the control that\n // opened it gets the caret back. The opener is captured in the activation\n // itself, because by the time an effect runs the panel has already claimed\n // focus for its own confirm button.\n const confirmOpener = useRef<HTMLElement | null>(null)\n const confirming = session.confirming\n const activate = useCallback(\n (action: ProjectedQuickAction) => {\n confirmOpener.current = document.activeElement as HTMLElement | null\n onActivate(action)\n },\n [onActivate],\n )\n useEffect(() => {\n if (confirming !== undefined) return\n const opener = confirmOpener.current\n confirmOpener.current = null\n if (opener === null) return\n // The opener is often unusable by the time the panel closes: confirming a\n // send disables it for the flight, and an action picked from the overflow\n // list is unmounted with the list. The management entry is the one control\n // every layout always has, so focus lands there rather than on the body.\n const usable = opener.isConnected && !(opener as HTMLButtonElement).disabled\n ;(usable ? opener : control('data-quick-actions-manage'))?.focus()\n }, [confirming, control])\n\n // A layout switch, or an emptied overflow, must not leave a panel open over\n // an entry that no longer exists.\n useEffect(() => {\n if (overflow.length === 0) setPanelOpen(false)\n }, [overflow.length])\n\n const manage = (\n <Button\n variant=\"toolbar\"\n size=\"sm\"\n className=\"dsh-cqa-entry\"\n data-quick-actions-manage=\"\"\n // A tooltip, never a name: `aria-label` here would replace the visible\n // label as the accessible name, which spec 8.4 forbids.\n title={t('manage.tooltip')}\n onClick={onManage}\n >\n <span className=\"dsh-cqa-label\">{t('manage')}</span>\n </Button>\n )\n\n const rootClass = layout === 'bar' ? 'dsh-cqa-bar' : layout === 'launcher' ? 'dsh-cqa-launcher' : 'dsh-cqa-ribbon'\n\n return (\n <div className={rootClass} data-quick-actions-layout={layout} data-quick-actions-density={density}>\n <div className=\"dsh-cqa-row\" ref={rowRef} data-density={density}>\n {layout === 'ribbon' && density === 'wide' ? <span className=\"dsh-cqa-title\">{t('title')}</span> : null}\n\n {layout === 'ribbon' ? (\n <div className=\"dsh-cqa-scroll\">\n {actions.length === 0 ? <span className=\"dsh-cqa-title\">{t('empty')}</span> : null}\n {actions.map((action) => (\n <ActionControl\n key={quickActionRefKey(action.ref)}\n action={action}\n reason={unavailableReasonFor(action, session)}\n t={t}\n onActivate={activate}\n />\n ))}\n </div>\n ) : null}\n\n {layout === 'bar' ? (\n <div className=\"dsh-cqa-fit\" ref={fitRef}>\n {actions.length === 0 ? <span className=\"dsh-cqa-title\">{t('empty')}</span> : null}\n {actions.slice(0, shown).map((action) => (\n <ActionControl\n key={quickActionRefKey(action.ref)}\n action={action}\n reason={unavailableReasonFor(action, session)}\n t={t}\n onActivate={activate}\n />\n ))}\n </div>\n ) : null}\n\n <div className=\"dsh-cqa-trailing\">\n {layout === 'launcher' || (layout === 'bar' && overflow.length > 0) ? (\n <span className=\"dsh-cqa-anchor\">\n <Button\n variant=\"toolbar\"\n size=\"sm\"\n className=\"dsh-cqa-entry\"\n data-quick-actions-entry={layout}\n aria-expanded={panelOpen}\n aria-haspopup=\"dialog\"\n disabled={layout === 'launcher' && actions.length === 0}\n onClick={() => {\n setPanelOpen((open) => !open)\n }}\n >\n <span className=\"dsh-cqa-label\">\n {layout === 'launcher'\n ? t('launcher', { count: actions.length })\n : t('more', { count: overflow.length })}\n </span>\n </Button>\n {panelOpen ? (\n <ActionPanel\n actions={overflow}\n session={session}\n t={t}\n labelledBy={panelTitleId}\n onActivate={activate}\n onClose={closePanel}\n />\n ) : null}\n </span>\n ) : null}\n <span className=\"dsh-cqa-anchor\">\n {manage}\n {session.confirming === undefined ? null : (\n <ConfirmPanel pending={session.confirming} t={t} onConfirm={onConfirm} onCancel={onCancelConfirm} />\n )}\n </span>\n </div>\n </div>\n\n {session.feedback === undefined ? null : (\n <div className=\"dsh-cqa-note\" role=\"status\" data-quick-actions-feedback={session.feedback.kind}>\n <span className=\"dsh-cqa-note-text\">\n {session.feedback.kind === 'failed'\n ? t('feedback.failed', { message: session.feedback.message })\n : t(`feedback.${session.feedback.kind}`)}\n </span>\n <button type=\"button\" className=\"dsh-cqa-link\" onClick={onDismissFeedback}>\n {t('feedback.dismiss')}\n </button>\n </div>\n )}\n </div>\n )\n}\n","/**\n * When a mutating control in the management panel may be pressed, and how it\n * says so (spec 5.4, 8.4, 10).\n *\n * ## Why two ways of saying \"no\"\n *\n * Only sustained, externally-imposed unavailability — a read-only namespace, or a\n * connection that can no longer vouch for the held snapshot — uses a real\n * `disabled`, which takes the control out of the tab order entirely.\n *\n * Everything else uses `aria-disabled` plus a guarded handler, because\n * everything else can become true *as a result of the press itself*: the write\n * this control just started, the row that just reached an end of the list, the\n * layout it just selected becoming current, the clone that just filled the last\n * slot. A real `disabled` there would drop the keyboard caret to the document\n * body mid-reorder — and focus handling is a hard gate of spec 8.4, not a nicety.\n */\n\n/** What every mutating control in the panel is gated on. */\nexport interface ManagerWriteGate {\n /** Sustained and external: the panel is genuinely inert and must not be tabbable. */\n readonly readOnly: boolean\n /** A write is in flight; transient, and usually started by the focused control. */\n readonly busy: boolean\n /** Whether creating or cloning is allowed at all right now (spec 5.4). */\n readonly canAdd: boolean\n}\n\n/** The props one mutating control spreads onto its `<button>`. */\nexport interface PressProps {\n readonly disabled: boolean\n readonly 'aria-disabled': boolean\n readonly onClick: () => void\n}\n\n/**\n * Gate one control. `blocked` is its own extra condition — an end of the list,\n * the ceiling, the choice already made; the gate's own `busy` is folded in here\n * so no caller has to remember it.\n */\nexport function pressProps(gate: ManagerWriteGate, blocked: boolean, onPress: () => void): PressProps {\n const refused = gate.readOnly || gate.busy || blocked\n return {\n disabled: gate.readOnly,\n 'aria-disabled': gate.busy || blocked,\n onClick: () => {\n if (refused) return\n onPress()\n },\n }\n}\n","/**\n * Composer Quick Actions dictionaries (spec 8.4).\n *\n * Both shipped languages carry the same key set, so a missing translation is a\n * compile error rather than a key leaking onto a surface. Keys are registered\n * under one namespace and reached through the `t` prop the Slot registration's\n * `locale` option binds; nothing here formats a date, a number or a plural.\n *\n * Two families of key are addressed by composition rather than by name — a\n * field issue (`issue.<field>.<reason>`) and a write failure (`write.<kind>`) —\n * because the model and the controller name those cases, not this file. Both go\n * through {@link quickActionsLocaleKey}, which checks the composed key against\n * the dictionary itself, so a case this release cannot phrase falls back to a\n * general sentence instead of printing a raw key at the user.\n */\nimport type { QuickActionFieldIssue } from '../model/index.js'\n\n/** The locale namespace this package registers and every Slot entry binds. */\nexport const QUICK_ACTIONS_LOCALE_NAMESPACE = 'composer-quick-actions'\n\n/** Every key the Composer surfaces and the management panel render. */\nexport type QuickActionsLocaleKey =\n | 'title'\n | 'manage'\n | 'manage.tooltip'\n | 'more'\n | 'launcher'\n | 'empty'\n | 'command.badge'\n | 'unavailable.occupied-draft'\n | 'unavailable.composer-busy'\n | 'unavailable.composer-blocked'\n | 'unavailable.session-removed'\n | 'unavailable.parent-offline'\n | 'unavailable.sending'\n | 'feedback.state-changed'\n | 'feedback.retained'\n | 'feedback.failed'\n | 'feedback.dismiss'\n | 'catalog.loading'\n | 'catalog.unreadable'\n | 'catalog.unavailable'\n | 'catalog.undecodable'\n | 'catalog.retry'\n | 'crash.title'\n | 'crash.retry'\n | 'confirm.title'\n | 'confirm.send'\n | 'confirm.cancel'\n | 'confirm.command'\n | 'panel.title'\n | 'panel.close'\n | 'panel.search'\n | 'panel.search.empty'\n | 'manager.title'\n | 'manager.close'\n | 'manager.layout'\n | 'manager.layout.ribbon'\n | 'manager.layout.bar'\n | 'manager.layout.launcher'\n | 'manager.actions'\n | 'manager.count'\n | 'manager.new'\n | 'manager.empty'\n | 'manager.overflow'\n | 'manager.limit'\n | 'manager.command.notice'\n | 'manager.preset'\n | 'manager.custom'\n | 'manager.clonedFrom'\n | 'manager.hidden'\n | 'manager.disabled'\n | 'manager.hide'\n | 'manager.restore'\n | 'manager.clone'\n | 'manager.edit'\n | 'manager.enable'\n | 'manager.disable'\n | 'manager.delete'\n | 'manager.delete.confirm'\n | 'manager.delete.cancel'\n | 'manager.moveUp'\n | 'manager.moveDown'\n | 'manager.readonly.storage'\n | 'manager.readonly.offline'\n | 'form.title.new'\n | 'form.title.edit'\n | 'form.label'\n | 'form.label.hint'\n | 'form.text'\n | 'form.text.hint'\n | 'form.icon'\n | 'form.icon.hint'\n | 'form.confirm'\n | 'form.save'\n | 'form.cancel'\n | 'form.command.warning'\n | 'issue.invalid'\n | 'issue.label.blank'\n | 'issue.label.too-long'\n | 'issue.text.blank'\n | 'issue.text.too-long'\n | 'issue.text.reserved-placeholder'\n | 'issue.icon.not-emoji'\n | 'issue.icon.too-long'\n | 'write.dismiss'\n | 'write.retry'\n | 'write.not-ready'\n | 'write.read-only'\n | 'write.refused'\n | 'write.conflict'\n | 'write.failed'\n | 'write.invalid-fields'\n | 'write.limit-reached'\n | 'write.unknown-action'\n | 'write.id-in-use'\n | 'write.invalid-order'\n\nexport type QuickActionsDictionary = Record<QuickActionsLocaleKey, string>\n\nexport const zh: QuickActionsDictionary = {\n 'title': '快捷动作',\n 'manage': '管理',\n 'manage.tooltip': '管理快捷动作',\n 'more': '更多 {count}',\n 'launcher': '快捷动作 {count}',\n 'empty': '暂无可用快捷动作',\n 'command.badge': '命令',\n 'unavailable.occupied-draft': '草稿中已有内容;发送动作不会覆盖或携带它',\n 'unavailable.composer-busy': '消息编辑器正在提交,请稍候',\n 'unavailable.composer-blocked': '当前会话的消息编辑器已被占用',\n 'unavailable.session-removed': '会话已被移除',\n 'unavailable.parent-offline': '父会话不可用',\n 'unavailable.sending': '正在发送',\n 'feedback.state-changed': '状态已变化,请重试',\n 'feedback.retained': '未发送,文本已保留',\n 'feedback.failed': '未能执行:{message}',\n 'feedback.dismiss': '知道了',\n 'catalog.loading': '正在读取快捷动作…',\n 'catalog.unreadable': '无法读取设置,快捷动作暂不可用',\n 'catalog.unavailable': '未找到预置目录',\n 'catalog.undecodable': '预置目录版本过新,无法读取',\n 'catalog.retry': '重试',\n 'crash.title': '快捷动作出错了',\n 'crash.retry': '重新加载',\n 'confirm.title': '确认发送',\n 'confirm.send': '发送',\n 'confirm.cancel': '取消',\n 'confirm.command': '这条文本会按命令进入 DSH 官方裁决路径。此处不会出现输入 / 时的原生候选菜单,你看到的就是最终提交内容。',\n 'panel.title': '选择快捷动作',\n 'panel.close': '关闭',\n 'panel.search': '搜索快捷动作',\n 'panel.search.empty': '没有匹配的快捷动作',\n\n 'manager.title': '管理快捷动作',\n 'manager.close': '关闭',\n 'manager.layout': '布局',\n 'manager.layout.ribbon': '上方动作带',\n 'manager.layout.bar': '下方操作栏',\n 'manager.layout.launcher': '单入口面板',\n 'manager.actions': '快捷动作',\n 'manager.count': '共 {total} / {limit} 项',\n 'manager.new': '新建快捷动作',\n 'manager.empty': '还没有任何快捷动作',\n 'manager.overflow':\n '动作总数为 {total} 项,已超过 {limit} 项上限。现有动作全部保留,但在恢复到上限以内之前无法新增或克隆。',\n 'manager.limit': '已达 {limit} 项上限,无法新增或克隆。',\n 'manager.command.notice':\n '标有「命令」的动作以 / 开头,会按命令进入 DSH 官方裁决路径。确认面板只展示最终提交的文本,不会出现原生 / 候选菜单;关闭确认后,命令将一键提交且没有任何预览。',\n 'manager.preset': '预置',\n 'manager.custom': '自定义',\n 'manager.clonedFrom': '克隆自预置',\n 'manager.hidden': '已隐藏',\n 'manager.disabled': '已停用',\n 'manager.hide': '隐藏',\n 'manager.restore': '恢复',\n 'manager.clone': '克隆',\n 'manager.edit': '编辑',\n 'manager.enable': '启用',\n 'manager.disable': '停用',\n 'manager.delete': '删除',\n 'manager.delete.confirm': '确认删除',\n 'manager.delete.cancel': '不删除',\n 'manager.moveUp': '上移',\n 'manager.moveDown': '下移',\n 'manager.readonly.storage': '设置存储当前不可用,管理界面为只读。',\n 'manager.readonly.offline': '连接已断开,管理界面为只读;连接恢复后可继续修改。',\n\n 'form.title.new': '新建快捷动作',\n 'form.title.edit': '编辑快捷动作',\n 'form.label': '标签',\n 'form.label.hint': '按钮上显示的名称,最长 {max} 个字符',\n 'form.text': '发送文本',\n 'form.text.hint': '原样提交的静态文本,保留换行,最长 {max} 个字符',\n 'form.icon': '图标(可选)',\n 'form.icon.hint': '1–{max} 个 emoji,仅作装饰',\n 'form.confirm': '发送前确认',\n 'form.save': '保存',\n 'form.cancel': '取消',\n 'form.command.warning':\n '这条文本以 / 开头,是命令发送动作:它会按命令进入 DSH 官方裁决路径;确认面板不会展示原生 / 候选菜单;关闭确认后,该命令将一键提交且没有任何预览。确认开关仍由你自行设置。',\n\n 'issue.invalid': '这个字段不符合要求',\n 'issue.label.blank': '请填写标签',\n 'issue.label.too-long': '标签超出长度上限',\n 'issue.text.blank': '发送文本至少要有一个非空白字符',\n 'issue.text.too-long': '发送文本超出长度上限',\n 'issue.text.reserved-placeholder': '发送文本包含 DSH 保留的引用占位符,无法作为静态文本提交',\n 'issue.icon.not-emoji': '图标只能由 emoji 组成',\n 'issue.icon.too-long': '图标的 emoji 数量超出上限',\n\n 'write.dismiss': '知道了',\n 'write.retry': '重试',\n 'write.not-ready': '设置尚未就绪,改动没有保存。',\n 'write.read-only': '当前无法写入设置,改动没有保存。',\n 'write.refused': '保存被拒绝,没有写入任何内容;请重试。',\n 'write.conflict': '设置已在别处被修改,已刷新到最新状态;请核对后重新确认这次修改。',\n 'write.failed': '保存失败:{message};请重试。',\n 'write.invalid-fields': '有字段不符合要求,改动没有保存。',\n 'write.limit-reached': '已达动作数量上限,无法新增或克隆。',\n 'write.unknown-action': '这个动作已经不存在了,请核对当前列表后重试。',\n 'write.id-in-use': '生成的标识发生重复,请重试。',\n 'write.invalid-order': '顺序已经变化,请核对当前列表后重试。',\n}\n\nexport const en: QuickActionsDictionary = {\n 'title': 'Quick Actions',\n 'manage': 'Manage',\n 'manage.tooltip': 'Manage Quick Actions',\n 'more': 'More {count}',\n 'launcher': 'Quick Actions {count}',\n 'empty': 'No Quick Actions available',\n 'command.badge': 'Command',\n 'unavailable.occupied-draft': 'The draft already has content; a send action never overwrites or carries it',\n 'unavailable.composer-busy': 'The composer is submitting; try again in a moment',\n 'unavailable.composer-blocked': 'Another feature owns this session’s composer',\n 'unavailable.session-removed': 'This session was removed',\n 'unavailable.parent-offline': 'The parent session is unavailable',\n 'unavailable.sending': 'Sending',\n 'feedback.state-changed': 'Something changed — try again',\n 'feedback.retained': 'Not sent; the text was kept in the draft',\n 'feedback.failed': 'Could not run: {message}',\n 'feedback.dismiss': 'Dismiss',\n 'catalog.loading': 'Loading Quick Actions…',\n 'catalog.unreadable': 'Settings could not be read, so Quick Actions are unavailable',\n 'catalog.unavailable': 'No Preset Catalog was published',\n 'catalog.undecodable': 'The Preset Catalog is newer than this release can read',\n 'catalog.retry': 'Retry',\n 'crash.title': 'Quick Actions hit an error',\n 'crash.retry': 'Reload',\n 'confirm.title': 'Confirm send',\n 'confirm.send': 'Send',\n 'confirm.cancel': 'Cancel',\n 'confirm.command':\n 'This text enters DSH’s own command adjudication path. The native “/” suggestion menu does not appear here, so what you see is exactly what is submitted.',\n 'panel.title': 'Pick a Quick Action',\n 'panel.close': 'Close',\n 'panel.search': 'Search Quick Actions',\n 'panel.search.empty': 'No Quick Action matches that',\n\n 'manager.title': 'Manage Quick Actions',\n 'manager.close': 'Close',\n 'manager.layout': 'Layout',\n 'manager.layout.ribbon': 'Action ribbon',\n 'manager.layout.bar': 'Action bar',\n 'manager.layout.launcher': 'Single launcher',\n 'manager.actions': 'Quick Actions',\n 'manager.count': '{total} of {limit}',\n 'manager.new': 'New Quick Action',\n 'manager.empty': 'No Quick Actions yet',\n 'manager.overflow':\n 'There are {total} actions, over the limit of {limit}. Everything you have is kept, but creating and cloning stay disabled until the total is back within the limit.',\n 'manager.limit': 'The limit of {limit} actions is reached, so creating and cloning are disabled.',\n 'manager.command.notice':\n 'Actions marked “Command” start with “/” and enter DSH’s own command adjudication path. The confirmation panel shows only the text that will be submitted — the native “/” suggestion menu does not appear — and with confirmation off the command is submitted in one click with no preview.',\n 'manager.preset': 'Preset',\n 'manager.custom': 'Custom',\n 'manager.clonedFrom': 'Cloned from a preset',\n 'manager.hidden': 'Hidden',\n 'manager.disabled': 'Disabled',\n 'manager.hide': 'Hide',\n 'manager.restore': 'Restore',\n 'manager.clone': 'Clone',\n 'manager.edit': 'Edit',\n 'manager.enable': 'Enable',\n 'manager.disable': 'Disable',\n 'manager.delete': 'Delete',\n 'manager.delete.confirm': 'Confirm delete',\n 'manager.delete.cancel': 'Keep it',\n 'manager.moveUp': 'Move up',\n 'manager.moveDown': 'Move down',\n 'manager.readonly.storage': 'Settings storage is unavailable right now, so management is read-only.',\n 'manager.readonly.offline': 'The connection is down, so management is read-only until it is back.',\n\n 'form.title.new': 'New Quick Action',\n 'form.title.edit': 'Edit Quick Action',\n 'form.label': 'Label',\n 'form.label.hint': 'The name on the button, up to {max} characters',\n 'form.text': 'Text to send',\n 'form.text.hint': 'Static text submitted as-is, line breaks kept, up to {max} characters',\n 'form.icon': 'Icon (optional)',\n 'form.icon.hint': '1–{max} emoji, decoration only',\n 'form.confirm': 'Confirm before sending',\n 'form.save': 'Save',\n 'form.cancel': 'Cancel',\n 'form.command.warning':\n 'This text starts with “/”, which makes it a Command Send Action: it enters DSH’s own command adjudication path, the confirmation panel shows no native “/” suggestion menu, and with confirmation off the command is submitted in one click with no preview at all. The confirmation switch stays yours to set.',\n\n 'issue.invalid': 'This field is not acceptable',\n 'issue.label.blank': 'Enter a label',\n 'issue.label.too-long': 'The label is over the length limit',\n 'issue.text.blank': 'The text needs at least one non-whitespace character',\n 'issue.text.too-long': 'The text is over the length limit',\n 'issue.text.reserved-placeholder': 'The text holds a DSH-reserved reference placeholder and cannot be submitted as static text',\n 'issue.icon.not-emoji': 'An icon may only be made of emoji',\n 'issue.icon.too-long': 'The icon has too many emoji',\n\n 'write.dismiss': 'Dismiss',\n 'write.retry': 'Retry',\n 'write.not-ready': 'Settings are not ready yet, so nothing was saved.',\n 'write.read-only': 'Settings cannot be written right now, so nothing was saved.',\n 'write.refused': 'The write was refused and nothing was saved; try again.',\n 'write.conflict':\n 'Settings changed elsewhere and have been refreshed; check what is on screen and confirm your change again.',\n 'write.failed': 'The write failed: {message}. Try again.',\n 'write.invalid-fields': 'Some fields are not acceptable, so nothing was saved.',\n 'write.limit-reached': 'The action limit is reached, so creating and cloning are disabled.',\n 'write.unknown-action': 'That action no longer exists; check the current list and try again.',\n 'write.id-in-use': 'The generated id collided; try again.',\n 'write.invalid-order': 'The order has changed; check the current list and try again.',\n}\n\n/** The dictionaries as `ctx.locale.register` takes them. */\nexport const quickActionsDictionaries: Record<string, QuickActionsDictionary> = { zh, en }\n\n/**\n * Every key this package ships, taken from the dictionary rather than restated,\n * so a composed key is checked against what actually exists.\n */\nconst SHIPPED_KEYS: ReadonlySet<string> = new Set(Object.keys(zh))\n\n/**\n * Narrow a composed key to one this package ships, falling back when it does\n * not. Composed keys come from names the model and the controller own — a field\n * issue, a mutation refusal, a write failure — so a case added upstream shows a\n * general sentence instead of leaking `write.something-new` onto a surface.\n */\nexport function quickActionsLocaleKey(candidate: string, fallback: QuickActionsLocaleKey): QuickActionsLocaleKey {\n return SHIPPED_KEYS.has(candidate) ? (candidate as QuickActionsLocaleKey) : fallback\n}\n\n/** The dictionary entry naming one field issue (spec 4.3). */\nexport function quickActionIssueKey(issue: QuickActionFieldIssue): QuickActionsLocaleKey {\n return quickActionsLocaleKey(`issue.${issue.field}.${issue.reason}`, 'issue.invalid')\n}\n","/**\n * The Custom Quick Action form (spec 8.3).\n *\n * It edits exactly four things — label, static text, optional emoji and the send\n * confirmation — and validates them through the shared model, so a draft this\n * form accepts is a draft the Host will accept (spec 4.3).\n *\n * ## What this form deliberately does not have\n *\n * - **An action-type selector.** `kind` is not a configuration field: the first\n * release is always `'send'`, and no user path may change it (spec 4.1, 16.1).\n * - **Any control the Command Send Action warning locks.** When the text becomes\n * a command the form warns and nothing else (spec 8.3, 16.1): the warning\n * states that the text enters DSH's own adjudication path, that the\n * confirmation panel shows no native `/` suggestion menu, and that with\n * confirmation off the command is submitted in one click with no preview. The\n * confirmation switch stays editable throughout.\n * - **Any rewrite of `confirm` in response to the text.** The default is applied\n * once, when a draft is created or cloned (`newQuickActionDraft`, the clone\n * planner). Deriving it from the text here would silently undo the user's own\n * choice every time they edited the text — the same reason spec 4.3 forbids\n * normalization from touching it.\n *\n * The draft lives in the caller's state, which is what makes \"a failed write\n * keeps the form content\" (spec 10) structural rather than incidental.\n *\n * ## The form as a nested editing context\n *\n * The management panel's Escape handler relies on this form stopping Escape\n * before it arrives — but a handler on the form only sees keys typed *inside*\n * the form. Until the form took focus of its own, the first Escape after \"new\"\n * or \"edit\" was still aimed at the button that opened it, outside the form, and\n * closed the whole panel (ticket 25). So the form has the two focus rules every\n * other panel of spec 8.4 has: it opens with the caret in its first field, and\n * it hands focus back to the control that opened it when it closes — which is\n * what keeps a second Escape meaning \"close the panel\".\n */\nimport { useId, useRef } from 'react'\nimport type { KeyboardEvent as ReactKeyboardEvent, ReactElement } from 'react'\nimport { Button } from '@deepseek-ai/dsh-client-ui-primitives'\nimport { pressProps } from './press.js'\nimport type { ManagerWriteGate } from './press.js'\nimport { useFocusReturn, useInitialFocusIn } from '../modal.js'\nimport {\n QUICK_ACTION_ICON_MAX_CLUSTERS,\n QUICK_ACTION_LABEL_MAX_CODE_POINTS,\n QUICK_ACTION_TEXT_MAX_CODE_POINTS,\n isCommandSendActionText,\n validateQuickActionDraft,\n} from '../../model/index.js'\nimport type { QuickActionDraft, QuickActionField, QuickActionFieldIssue } from '../../model/index.js'\nimport { quickActionIssueKey } from '../../locales/index.js'\nimport type { Translate } from '../dsh.js'\n\nexport interface ActionFormProps {\n /** `new` for a creation, `edit` for an existing Custom Quick Action. */\n readonly mode: 'new' | 'edit'\n readonly draft: QuickActionDraft\n /**\n * Whether the user has already tried to save. Blank fields only report\n * themselves after that, so a freshly opened form does not open shouting.\n */\n readonly attempted: boolean\n readonly gate: ManagerWriteGate\n readonly t: Translate\n readonly onChange: (draft: QuickActionDraft) => void\n readonly onSave: () => void\n readonly onCancel: () => void\n}\n\n/**\n * The issues to render for one draft.\n *\n * Every rule comes from the shared model; the only presentation decision is that\n * a blank field stays quiet until the user has tried to save it.\n */\nfunction visibleQuickActionIssues(draft: QuickActionDraft, attempted: boolean): readonly QuickActionFieldIssue[] {\n const validated = validateQuickActionDraft(draft)\n if (validated.ok) return []\n return attempted ? validated.issues : validated.issues.filter((issue) => issue.reason !== 'blank')\n}\n\n/** One labelled field, with its hint and — when it has one — its issue. */\nfunction Field(props: {\n readonly field: QuickActionField\n readonly label: string\n readonly hint: string\n readonly issue: QuickActionFieldIssue | undefined\n readonly t: Translate\n readonly children: (bound: {\n readonly id: string\n readonly describedBy: string\n readonly invalid: boolean\n }) => ReactElement\n}): ReactElement {\n const { field, label, hint, issue, t, children } = props\n const id = useId()\n const hintId = `${id}-hint`\n const errorId = `${id}-error`\n // The label element carries the field name and nothing else: a wrapping label\n // would fold the hint into the control's accessible name, and the hint is a\n // description (spec 8.4 wants a visible text label, not a paragraph for a name).\n //\n // The hint stays on screen beside an error rather than being replaced by it:\n // the hint is where the limits are stated, and the limits come from the model's\n // own constants — an error sentence that restated them would be a second copy\n // free to drift.\n return (\n <div className=\"dsh-cqa-field\">\n <label className=\"dsh-cqa-field-label\" htmlFor={id}>\n {label}\n </label>\n {children({\n id,\n describedBy: issue === undefined ? hintId : `${hintId} ${errorId}`,\n invalid: issue !== undefined,\n })}\n <span className=\"dsh-cqa-field-hint\" id={hintId}>\n {hint}\n </span>\n {issue === undefined ? null : (\n <span className=\"dsh-cqa-field-error\" id={errorId} data-quick-actions-issue={field}>\n {t(quickActionIssueKey(issue))}\n </span>\n )}\n </div>\n )\n}\n\nexport function ActionForm(props: ActionFormProps): ReactElement {\n const { mode, draft, attempted, gate, t, onChange, onSave, onCancel } = props\n const issues = visibleQuickActionIssues(draft, attempted)\n const issueFor = (field: QuickActionField): QuickActionFieldIssue | undefined =>\n issues.find((issue) => issue.field === field)\n const command = isCommandSendActionText(draft.text)\n const titleId = useId()\n\n // Focus return is declared first so its layout effect captures the opener —\n // the \"new\" or \"edit\" control — before the passive effect below moves focus\n // into the form (spec 8.4). It is given the form's own element because this\n // editing context is nested in the management panel: when that one closes\n // over an open form, focus is already on the management entry by the time\n // the form's cleanup runs, and must stay there. The label field is the opening target:\n // it is the first field, and it is what the user is about to type into. It is\n // addressed by marker rather than by ref for the same reason every other\n // panel is: the one focus mechanism lives in `modal.ts`, whatever control\n // ends up there.\n const formRef = useRef<HTMLDivElement | null>(null)\n useFocusReturn(formRef)\n useInitialFocusIn(formRef, '[data-quick-actions-form-label]')\n\n /**\n * Escape leaves the form, not the panel behind it.\n *\n * Without stopping it here, Escape typed in a field would reach the management\n * panel's own handler and close the whole panel — a far larger action than the\n * user asked for. The innermost editing context is what Escape means.\n */\n const onKeyDown = (event: ReactKeyboardEvent<HTMLDivElement>): void => {\n if (event.key !== 'Escape') return\n event.stopPropagation()\n onCancel()\n }\n\n return (\n <div\n className=\"dsh-cqa-form\"\n ref={formRef}\n role=\"group\"\n aria-labelledby={titleId}\n data-quick-actions-form={mode}\n onKeyDown={onKeyDown}\n >\n <span className=\"dsh-cqa-section-title\" id={titleId}>\n {t(mode === 'new' ? 'form.title.new' : 'form.title.edit')}\n </span>\n\n <Field\n field=\"label\"\n label={t('form.label')}\n hint={t('form.label.hint', { max: QUICK_ACTION_LABEL_MAX_CODE_POINTS })}\n issue={issueFor('label')}\n t={t}\n >\n {({ id, describedBy, invalid }) => (\n <input\n className=\"dsh-cqa-input\"\n id={id}\n aria-describedby={describedBy}\n aria-invalid={invalid}\n disabled={gate.readOnly}\n data-quick-actions-form-label=\"\"\n value={draft.label}\n onChange={(event) => {\n onChange({ ...draft, label: event.target.value })\n }}\n />\n )}\n </Field>\n\n <Field\n field=\"text\"\n label={t('form.text')}\n hint={t('form.text.hint', { max: QUICK_ACTION_TEXT_MAX_CODE_POINTS })}\n issue={issueFor('text')}\n t={t}\n >\n {({ id, describedBy, invalid }) => (\n <textarea\n className=\"dsh-cqa-textarea\"\n id={id}\n rows={4}\n aria-describedby={describedBy}\n aria-invalid={invalid}\n disabled={gate.readOnly}\n value={draft.text}\n onChange={(event) => {\n onChange({ ...draft, text: event.target.value })\n }}\n />\n )}\n </Field>\n\n {/*\n The Command Send Action warning. `role=\"status\"` rather than `alert`: it\n is a consequence of what the user typed, not an error, and it locks\n nothing — including the confirmation switch right below it.\n */}\n {command ? (\n <p className=\"dsh-cqa-note\" role=\"status\" data-quick-actions-command-warning=\"\">\n <span className=\"dsh-cqa-note-text\">{t('form.command.warning')}</span>\n </p>\n ) : null}\n\n <Field\n field=\"icon\"\n label={t('form.icon')}\n hint={t('form.icon.hint', { max: QUICK_ACTION_ICON_MAX_CLUSTERS })}\n issue={issueFor('icon')}\n t={t}\n >\n {({ id, describedBy, invalid }) => (\n <input\n className=\"dsh-cqa-input\"\n id={id}\n aria-describedby={describedBy}\n aria-invalid={invalid}\n disabled={gate.readOnly}\n value={draft.icon}\n onChange={(event) => {\n onChange({ ...draft, icon: event.target.value })\n }}\n />\n )}\n </Field>\n\n <label className=\"dsh-cqa-switch\">\n <input\n type=\"checkbox\"\n disabled={gate.readOnly}\n checked={draft.confirm}\n data-quick-actions-confirm-switch=\"\"\n onChange={(event) => {\n onChange({ ...draft, confirm: event.target.checked })\n }}\n />\n <span className=\"dsh-cqa-field-label\">{t('form.confirm')}</span>\n </label>\n\n <div className=\"dsh-cqa-form-actions\">\n {/*\n Cancel is never gated. It writes nothing, and a read-only or\n mid-write panel that could not be backed out of would leave the user\n holding an open draft with no way out of it.\n */}\n <Button variant=\"toolbar\" size=\"sm\" className=\"dsh-cqa-entry\" onClick={onCancel}>\n {t('form.cancel')}\n </Button>\n <Button variant=\"toolbar\" size=\"sm\" className=\"dsh-cqa-entry\" {...pressProps(gate, false, onSave)}>\n {t('form.save')}\n </Button>\n </div>\n </div>\n )\n}\n","/**\n * One row of the management list: what the action is, and everything the user\n * may do to it (spec 3, 5.1, 5.2, 8.3).\n *\n * The two sources differ in exactly the way spec 5.1 says they must: a Preset\n * Quick Action may be reordered, hidden, restored and cloned — never edited or\n * deleted, because its definition is the author's — while a Custom Quick Action\n * has its whole life cycle here.\n *\n * A hidden or disabled action is rendered, dimmed and labelled, never removed:\n * removal from the Composer is the Hidden Quick Action projection, and this\n * panel is where it stays recoverable (spec 3).\n */\nimport type { ReactElement } from 'react'\nimport { Button, Pill } from '@deepseek-ai/dsh-client-ui-primitives'\nimport { pressProps } from './press.js'\nimport type { ManagerWriteGate } from './press.js'\nimport { ActionFace } from '../surfaces/ActionFace.js'\nimport { quickActionRefKey } from '../../model/index.js'\nimport type { ProjectedQuickAction, QuickActionRef } from '../../model/index.js'\nimport type { Translate } from '../dsh.js'\n\n/** Everything one row can ask the panel to do. */\nexport interface ManagedRowHandlers {\n readonly onMove: (ref: QuickActionRef, toIndex: number) => void\n readonly onEdit: () => void\n readonly onClone: () => void\n readonly onToggleHidden: () => void\n readonly onToggleEnabled: () => void\n readonly onAskDelete: () => void\n readonly onCancelDelete: () => void\n readonly onConfirmDelete: () => void\n}\n\nexport interface ManagedRowProps {\n readonly action: ProjectedQuickAction\n /** Position in the shared order, which is what the move controls address. */\n readonly index: number\n readonly total: number\n readonly gate: ManagerWriteGate\n /** Whether this row has already been asked about deleting. */\n readonly deleting: boolean\n readonly t: Translate\n readonly on: ManagedRowHandlers\n}\n\nexport function ManagedRow({ action, index, total, gate, deleting, t, on }: ManagedRowProps): ReactElement {\n return (\n <li\n className=\"dsh-cqa-list-item\"\n data-quick-action={quickActionRefKey(action.ref)}\n data-quick-action-hidden={action.hidden ? '' : undefined}\n >\n <span className=\"dsh-cqa-list-head\">\n <ActionFace action={action} t={t} />\n <Pill className=\"dsh-cqa-tag\">{t(action.editable ? 'manager.custom' : 'manager.preset')}</Pill>\n {action.hidden ? (\n <Pill active className=\"dsh-cqa-tag\">\n {t(action.editable ? 'manager.disabled' : 'manager.hidden')}\n </Pill>\n ) : null}\n {action.clonedFromPresetId === undefined ? null : (\n <Pill className=\"dsh-cqa-tag\">{t('manager.clonedFrom')}</Pill>\n )}\n </span>\n\n {/* A one-line preview; the whole text is in the form and in the confirmation. */}\n <span className=\"dsh-cqa-list-text\">{action.text}</span>\n\n <span className=\"dsh-cqa-list-controls\">\n <Button variant=\"toolbar\" size=\"sm\"\n className=\"dsh-cqa-entry\"\n data-quick-actions-move=\"up\"\n {...pressProps(gate, index === 0, () => {\n on.onMove(action.ref, index - 1)\n })}\n >\n {t('manager.moveUp')}\n </Button>\n <Button variant=\"toolbar\" size=\"sm\"\n className=\"dsh-cqa-entry\"\n data-quick-actions-move=\"down\"\n {...pressProps(gate, index === total - 1, () => {\n on.onMove(action.ref, index + 1)\n })}\n >\n {t('manager.moveDown')}\n </Button>\n\n {action.editable ? (\n <>\n <Button variant=\"toolbar\" size=\"sm\" className=\"dsh-cqa-entry\" {...pressProps(gate, false, on.onEdit)}>\n {t('manager.edit')}\n </Button>\n <Button variant=\"toolbar\" size=\"sm\" className=\"dsh-cqa-entry\" {...pressProps(gate, false, on.onToggleEnabled)}>\n {t(action.hidden ? 'manager.enable' : 'manager.disable')}\n </Button>\n {/*\n Deleting is the one control here that destroys user data, so it\n asks once in place rather than behind a second modal. Backing out\n is never gated: it writes nothing.\n */}\n {deleting ? (\n <>\n <Button variant=\"toolbar\" size=\"sm\"\n className=\"dsh-cqa-entry\"\n data-quick-actions-delete=\"confirm\"\n {...pressProps(gate, false, on.onConfirmDelete)}\n >\n {t('manager.delete.confirm')}\n </Button>\n <Button variant=\"toolbar\" size=\"sm\" className=\"dsh-cqa-entry\" onClick={on.onCancelDelete}>\n {t('manager.delete.cancel')}\n </Button>\n </>\n ) : (\n <Button variant=\"toolbar\" size=\"sm\"\n className=\"dsh-cqa-entry\"\n data-quick-actions-delete=\"ask\"\n {...pressProps(gate, false, on.onAskDelete)}\n >\n {t('manager.delete')}\n </Button>\n )}\n </>\n ) : (\n <>\n <Button variant=\"toolbar\" size=\"sm\" className=\"dsh-cqa-entry\" {...pressProps(gate, false, on.onToggleHidden)}>\n {t(action.hidden ? 'manager.restore' : 'manager.hide')}\n </Button>\n <Button variant=\"toolbar\" size=\"sm\"\n className=\"dsh-cqa-entry\"\n data-quick-actions-clone=\"\"\n {...pressProps(gate, !gate.canAdd, on.onClone)}\n >\n {t('manager.clone')}\n </Button>\n </>\n )}\n </span>\n </li>\n )\n}\n","/**\n * How the management panel names the state it is in (spec 10).\n *\n * Both readings are pure functions over the snapshot the controller publishes,\n * kept beside the panel rather than inside it — the same split the surfaces use\n * for `layout.ts` and the action panel for `search.ts`.\n */\nimport { quickActionsLocaleKey } from '../../locales/index.js'\nimport type { QuickActionsClientState, QuickActionWriteFailure } from '../controller.js'\nimport type { Translate } from '../dsh.js'\n\n/** Why every write is refused right now, or `undefined` when none is. */\nexport type ManagerReadOnlyReason =\n /** The connection cannot vouch for the held snapshot, so it must not be written over. */\n | 'offline'\n /** No writable namespace: an unreadable first read, or a process-local page. */\n | 'storage'\n\n/**\n * Report read-only state, and only read-only state.\n *\n * Spec 10 keeps two first-read failures apart: a catalog that could not be read\n * shows a retryable catalog error, while a *readable* catalog whose user\n * namespace failed shows \"storage unavailable\". Without the projection guard\n * below, a loading or failed catalog also reads as read-only — the write gate\n * refuses on `not-ready` — and the panel would print both notices at once,\n * telling the user their storage is broken when it is the catalog that is\n * missing. With no catalog there is nothing to be read-only *about*: the catalog\n * notice is the whole story.\n */\nexport function managerReadOnlyReason(client: QuickActionsClientState): ManagerReadOnlyReason | undefined {\n if (client.projection === undefined) return undefined\n if (!client.readOnly) return undefined\n // Staleness is reported first: it is the one the user can act on, and it also\n // explains why an otherwise writable namespace is refusing writes.\n return client.stale ? 'offline' : 'storage'\n}\n\n/** One write failure as a sentence, with the recovery it implies (spec 10). */\nexport function managerFailureMessage(failure: QuickActionWriteFailure, t: Translate): string {\n if (failure.kind === 'failed') return t('write.failed', { message: failure.message })\n const candidate = failure.kind === 'rejected' ? `write.${failure.rejection.reason}` : `write.${failure.kind}`\n return t(quickActionsLocaleKey(candidate, 'write.refused'))\n}\n","/**\n * The centralized management panel (spec 8.3).\n *\n * Everything a user can change about Quick Actions lives here and nowhere else:\n * the shared order, a preset's hidden state and its clone, a custom action's\n * whole life cycle, and the global layout. The Composer surfaces only read the\n * projection and execute.\n *\n * ## Where the truth is\n *\n * The panel renders the authoritative snapshot the controller publishes and\n * never a local copy of it. So a new UI state appears only once the Host has\n * persisted it (spec 10) — including the order, which is why a failed reorder\n * needs no \"restore the old order\" path: the old order was never left.\n *\n * ## Failure, and the one retry\n *\n * Every write goes through one funnel, which also remembers how to run it again.\n * That is spec 10's 「提供明确重试」: the failure banner offers the retry, and\n * pressing it *re-plans* rather than replaying — the controller builds each plan\n * from the snapshot it holds at that moment, and a create mints a fresh Custom\n * Action ID per attempt. Nothing ever retries on its own; a silent replay could\n * submit a plan the user has already moved past.\n *\n * Each failure is named, because spec 10 asks for different handling per kind: a\n * refusal or a transport failure keeps the form content and the panel open,\n * while a revision conflict means the controller has already re-read the\n * authoritative state, so the notice asks the user to confirm the change again\n * against what is now on screen — this feature keeps no second offline truth.\n *\n * Nothing here reports success: the list is the feedback, and spec 9.5 forbids an\n * extra success toast.\n */\nimport { useCallback, useEffect, useId, useState } from 'react'\nimport type { ReactElement } from 'react'\nimport { createPortal } from 'react-dom'\nimport { Button } from '@deepseek-ai/dsh-client-ui-primitives'\nimport { ActionForm } from './ActionForm.js'\nimport { ManagedRow } from './ManagedRow.js'\nimport { pressProps } from './press.js'\nimport type { ManagerWriteGate } from './press.js'\nimport { managerFailureMessage, managerReadOnlyReason } from './status.js'\nimport { useFocusReturn, useInitialFocusIn, useModalKeys } from '../modal.js'\nimport {\n QUICK_ACTION_LAYOUTS,\n newQuickActionDraft,\n quickActionRefKey,\n validateQuickActionDraft,\n} from '../../model/index.js'\nimport type {\n CustomActionId,\n ProjectedQuickAction,\n QuickActionDraft,\n QuickActionLayout,\n QuickActionRef,\n} from '../../model/index.js'\nimport type { QuickActionsClientState, QuickActionsController, QuickActionWriteOutcome } from '../controller.js'\nimport type { Translate } from '../dsh.js'\n\nexport interface ManagerPanelProps {\n readonly client: QuickActionsClientState\n readonly controller: QuickActionsController\n readonly t: Translate\n}\n\n/** Which action the form is editing, if any. */\ntype FormTarget = { readonly kind: 'new' } | { readonly kind: 'edit'; readonly id: CustomActionId }\n\ninterface FormState {\n readonly target: FormTarget\n readonly draft: QuickActionDraft\n /** Whether a save has already been attempted, which is what unmutes blank fields. */\n readonly attempted: boolean\n}\n\n/** One controller write, as this panel runs it. */\ntype ManagerWrite = () => Promise<QuickActionWriteOutcome>\n\n/**\n * How to run the last failed write again.\n *\n * A form save is remembered as a *kind* rather than as a closure, so the retry\n * saves whatever the form holds now: a user who fixed a field after the failure\n * must not have their earlier draft resubmitted behind their back.\n */\ntype PendingWrite = { readonly kind: 'form' } | { readonly kind: 'write'; readonly run: ManagerWrite }\n\n/** The form's starting draft for an existing Custom Quick Action. */\nfunction draftOf(action: ProjectedQuickAction): QuickActionDraft {\n return { label: action.label, text: action.text, icon: action.icon ?? '', confirm: action.confirm }\n}\n\nexport function ManagerPanel({ client, controller, t }: ManagerPanelProps): ReactElement {\n const close = useCallback(() => {\n controller.closeManager()\n }, [controller])\n\n useFocusReturn()\n const { panelRef, onKeyDown } = useModalKeys<HTMLDivElement>(close)\n useInitialFocusIn(panelRef, '[data-quick-actions-manager-close]')\n const titleId = useId()\n const layoutTitleId = useId()\n const listTitleId = useId()\n\n const [form, setForm] = useState<FormState | undefined>(undefined)\n const [pendingDelete, setPendingDelete] = useState<CustomActionId | undefined>(undefined)\n const [pending, setPending] = useState<PendingWrite | undefined>(undefined)\n\n const projection = client.projection\n const managed = projection?.managed ?? []\n const counts = projection?.counts\n const readOnlyReason = managerReadOnlyReason(client)\n const gate: ManagerWriteGate = {\n readOnly: readOnlyReason !== undefined,\n busy: client.writing,\n canAdd: counts?.canAdd === true,\n }\n\n // An action edited in one tab and deleted in another must not leave an editor\n // open over nothing: saving it would only ever answer `unknown-action`.\n const editingId = form?.target.kind === 'edit' ? form.target.id : undefined\n const editingLives =\n editingId === undefined ||\n managed.some((action) => action.editable && action.ref.source === 'custom' && action.ref.id === editingId)\n useEffect(() => {\n if (!editingLives) setForm(undefined)\n }, [editingLives])\n\n /**\n * The one funnel every write goes through: remember it, run it, and answer\n * whether it landed.\n *\n * The `catch` is the belt. A controller write answers with an outcome rather\n * than rejecting, so this arm should be unreachable — but an unhandled\n * rejection must never reach the page from a click handler, and the failure\n * the user sees comes from the snapshot the controller publishes either way.\n */\n const write = useCallback(async (remember: PendingWrite, run: ManagerWrite): Promise<boolean> => {\n setPending(remember)\n try {\n const outcome = await run()\n if (outcome.ok) setPending(undefined)\n return outcome.ok\n } catch {\n return false\n }\n }, [])\n\n /** Start a write from a click handler, with no outcome to react to. */\n const fire = useCallback(\n (run: ManagerWrite): void => {\n void write({ kind: 'write', run }, run)\n },\n [write],\n )\n\n const save = useCallback(async (): Promise<void> => {\n if (form === undefined) return\n // Validated here as well as by the planner, so a fixable field is reported\n // without a round trip — and through the very same shared rules (spec 4.3).\n if (!validateQuickActionDraft(form.draft).ok) {\n setForm({ ...form, attempted: true })\n return\n }\n const { target, draft } = form\n const landed = await write({ kind: 'form' }, () =>\n target.kind === 'new'\n ? controller.createCustomAction(draft)\n : controller.updateCustomAction(target.id, draft),\n )\n // A failed write keeps the draft exactly as typed (spec 10); only a\n // persisted one closes the form.\n if (landed) setForm(undefined)\n else setForm({ ...form, attempted: true })\n }, [controller, form, write])\n\n const retry = useCallback((): void => {\n if (pending === undefined) return\n if (pending.kind === 'form') {\n void save()\n return\n }\n void write(pending, pending.run)\n }, [pending, save, write])\n\n const remove = useCallback(\n (id: CustomActionId): void => {\n const run: ManagerWrite = () => controller.deleteCustomAction(id)\n void write({ kind: 'write', run }, run).then((landed) => {\n if (landed) setPendingDelete(undefined)\n })\n },\n [controller, write],\n )\n\n /*\n Rendered on the body rather than in place (ticket 26).\n\n This overlay is `position: fixed; z-index: 31`, but a Slot entry renders\n inside the input dock, and a z-index only ranks its element against siblings\n in the same stacking context: any ancestor in that dock which opens one caps\n this panel inside it. Ticket 21's acceptance found the shell's sidebar width\n handle — `position: absolute; z-index: 8` — painting over the panel's left\n edge, which swallowed clicks aimed at the confirmation switch's 13 px box.\n\n A portal to `document.body` puts the overlay in the page's own stacking\n context, where 31 means what it says. `document.body` is the target rather\n than a container this feature appends: React inserts and removes the\n children itself, so there is no node left behind when the fiber goes away\n (spec 7.3), and nothing to clean up on dispose.\n\n The backdrop travels with it. Left behind, it would scrim the dock's layer\n while the panel floated above the page — and its click-to-close would land\n under the panel it is supposed to be behind.\n\n Only this panel is portaled. The two anchored popovers (`ActionPanel`,\n `ConfirmPanel`) position themselves against `.dsh-cqa-anchor`'s\n `position: relative` in the dock, so a portal would move their positioning\n basis to the viewport; that is a separate change, and ticket 21 measured\n their controls as reachable at all three viewports.\n\n `document` is always there: the Client bundle is browser-only, enforced in\n both tsdown and Rolldown by the build adapter.\n */\n return createPortal(\n <>\n {/*\n The backdrop closes the panel with no side effect. It paints nothing: the\n surfaces may only use DSH alias theme tokens, and this release has no\n token for a modal scrim to spend (spec 8.4).\n */}\n <div\n className=\"dsh-cqa-backdrop dsh-cqa-manager-backdrop\"\n data-quick-actions-backdrop=\"\"\n aria-hidden=\"true\"\n onClick={close}\n />\n <div\n className=\"dsh-cqa-manager\"\n ref={panelRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={titleId}\n data-quick-actions-manager=\"\"\n onKeyDown={onKeyDown}\n >\n <div className=\"dsh-cqa-manager-head\">\n <h2 className=\"dsh-cqa-manager-title\" id={titleId}>\n {t('manager.title')}\n </h2>\n <Button\n variant=\"toolbar\"\n size=\"sm\"\n className=\"dsh-cqa-entry\"\n data-quick-actions-manager-close=\"\"\n onClick={close}\n >\n {t('manager.close')}\n </Button>\n </div>\n\n {projection === undefined ? (\n <div\n className=\"dsh-cqa-note\"\n role=\"status\"\n data-quick-actions-catalog-error={client.catalog.status === 'error' ? client.catalog.reason : 'loading'}\n >\n <span className=\"dsh-cqa-note-text\">\n {t(client.catalog.status === 'error' ? `catalog.${client.catalog.reason}` : 'catalog.loading')}\n </span>\n <button\n type=\"button\"\n className=\"dsh-cqa-link\"\n onClick={() => {\n // The controller reports a failed re-read through the catalog\n // state it publishes, and deliberately lets the promise reject;\n // swallowing it here is what keeps a retry from raising an\n // unhandled rejection on the page.\n controller.refresh().catch(() => undefined)\n }}\n >\n {t('catalog.retry')}\n </button>\n </div>\n ) : null}\n\n {readOnlyReason === undefined ? null : (\n <div className=\"dsh-cqa-note\" role=\"status\" data-quick-actions-readonly={readOnlyReason}>\n <span className=\"dsh-cqa-note-text\">{t(`manager.readonly.${readOnlyReason}`)}</span>\n </div>\n )}\n\n {client.failure === undefined ? null : (\n <div className=\"dsh-cqa-note\" role=\"alert\" data-quick-actions-write-failure={client.failure.kind}>\n <span className=\"dsh-cqa-note-text\">{managerFailureMessage(client.failure, t)}</span>\n {pending === undefined ? null : (\n <button type=\"button\" className=\"dsh-cqa-link\" data-quick-actions-write-retry=\"\" onClick={retry}>\n {t('write.retry')}\n </button>\n )}\n <button\n type=\"button\"\n className=\"dsh-cqa-link\"\n onClick={() => {\n controller.dismissFailure()\n }}\n >\n {t('write.dismiss')}\n </button>\n </div>\n )}\n\n {counts === undefined || (!counts.overflow && counts.canAdd) ? null : (\n <div\n className=\"dsh-cqa-note\"\n role=\"status\"\n data-quick-actions-limit={counts.overflow ? 'overflow' : 'reached'}\n >\n <span className=\"dsh-cqa-note-text\">\n {t(counts.overflow ? 'manager.overflow' : 'manager.limit', { limit: counts.limit, total: counts.total })}\n </span>\n </div>\n )}\n\n {projection === undefined ? null : (\n <>\n <div className=\"dsh-cqa-section\">\n <span className=\"dsh-cqa-section-title\" id={layoutTitleId}>\n {t('manager.layout')}\n </span>\n <div className=\"dsh-cqa-group\" role=\"group\" aria-labelledby={layoutTitleId}>\n {QUICK_ACTION_LAYOUTS.map((layout: QuickActionLayout) => (\n <Button variant=\"toolbar\" size=\"sm\"\n key={layout}\n className=\"dsh-cqa-entry\"\n data-quick-actions-layout-choice={layout}\n aria-pressed={projection.layout === layout}\n {...pressProps(gate, projection.layout === layout, () => {\n fire(() => controller.setLayout(layout))\n })}\n >\n {t(`manager.layout.${layout}`)}\n </Button>\n ))}\n </div>\n </div>\n\n <div className=\"dsh-cqa-section\">\n <div className=\"dsh-cqa-section-head\">\n <span className=\"dsh-cqa-section-title\" id={listTitleId}>\n {t('manager.actions')}\n </span>\n <span className=\"dsh-cqa-field-hint\" data-quick-actions-count=\"\">\n {t('manager.count', { total: counts?.total ?? 0, limit: counts?.limit ?? 0 })}\n </span>\n <Button variant=\"toolbar\" size=\"sm\"\n className=\"dsh-cqa-entry\"\n data-quick-actions-new=\"\"\n {...pressProps(gate, !gate.canAdd || form?.target.kind === 'new', () => {\n setForm({ target: { kind: 'new' }, draft: newQuickActionDraft(), attempted: false })\n })}\n >\n {t('manager.new')}\n </Button>\n </div>\n\n {/*\n The centralized Command Send Action explanation spec 8.3 requires.\n It stands whether or not a badge happens to be on screen: it is\n what the marker *means*, and a user about to write their first\n command text needs it before any marker exists. The form adds its\n own live warning on top of it.\n */}\n <p className=\"dsh-cqa-note\" data-quick-actions-command-notice=\"\">\n <span className=\"dsh-cqa-note-text\">{t('manager.command.notice')}</span>\n </p>\n\n {managed.length === 0 ? (\n <div className=\"dsh-cqa-field-hint\">{t('manager.empty')}</div>\n ) : (\n <ul className=\"dsh-cqa-list\" aria-labelledby={listTitleId}>\n {managed.map((action, index) => (\n <ManagedRow\n key={quickActionRefKey(action.ref)}\n action={action}\n index={index}\n total={managed.length}\n gate={gate}\n deleting={action.ref.source === 'custom' && pendingDelete === action.ref.id}\n t={t}\n on={{\n onMove: (ref: QuickActionRef, toIndex: number) => {\n fire(() => controller.moveAction(ref, toIndex))\n },\n onEdit: () => {\n setForm({\n target: { kind: 'edit', id: action.ref.id },\n draft: draftOf(action),\n attempted: false,\n })\n },\n onClone: () => {\n fire(() => controller.clonePreset(action.ref.id))\n },\n onToggleHidden: () => {\n fire(() => controller.setPresetHidden(action.ref.id, !action.hidden))\n },\n onToggleEnabled: () => {\n fire(() => controller.setCustomActionEnabled(action.ref.id, action.hidden))\n },\n onAskDelete: () => {\n setPendingDelete(action.ref.id)\n },\n onCancelDelete: () => {\n setPendingDelete(undefined)\n },\n onConfirmDelete: () => {\n remove(action.ref.id)\n },\n }}\n />\n ))}\n </ul>\n )}\n </div>\n\n {form === undefined ? null : (\n // Keyed by target, so switching from one action's form to\n // another's remounts it: the caret moves into the new form, and\n // its focus return is captured against the control that opened\n // *that* form rather than the first one.\n <ActionForm\n key={editingId === undefined ? 'new' : `edit:${editingId}`}\n mode={form.target.kind}\n draft={form.draft}\n attempted={form.attempted}\n gate={gate}\n t={t}\n onChange={(draft) => {\n setForm({ ...form, draft })\n }}\n onSave={() => {\n void save()\n }}\n onCancel={() => {\n setForm(undefined)\n }}\n />\n )}\n </>\n )}\n </div>\n </>,\n document.body,\n )\n}\n","/**\n * The two dock Slot entries (spec 7.3, 8.1).\n *\n * Both are always registered; which one renders the layout is decided at render\n * time from the authoritative Settings snapshot, and both render nothing at all\n * unless the Resident Composer predicate holds for their Session:\n *\n * - `conversation.composer.dock` is the residency beacon. Its mount is DSH's own\n * statement that this Session's composer is in its resident variant, so it\n * marks the Session while mounted and additionally renders the `bar` layout.\n * - `conversation.input.dock` renders `ribbon` or `launcher`, but only while the\n * beacon's mark stands — that Slot also mounts on the blank-session hero, and\n * the first release must never appear there.\n *\n * A third entry rides the same input dock: the centralized management overlay,\n * which spec 8.1 requires to be registered independently of the layout entries.\n * It is a separate Slot cell with its own id, order and error boundary, so a\n * failure in the management panel cannot take a Composer layout down with it and\n * vice versa (spec 7.3). Because the overlay is global state rendered from a\n * session-scoped Slot, only the Session the residency registry elects primary\n * draws it — two Resident Composers on screen must not stack two overlays.\n *\n * Each entry carries its own error boundary, so a failure replaces the Quick\n * Action area alone.\n */\nimport { useCallback, useEffect, useLayoutEffect, useMemo, useSyncExternalStore } from 'react'\nimport type { ReactElement } from 'react'\nimport { SurfaceErrorBoundary } from './ErrorBoundary.js'\nimport { QuickActionsSurface } from './QuickActionsSurface.js'\nimport { ManagerPanel } from '../manager/ManagerPanel.js'\nimport type { ResidentComposerRegistry } from './residency.js'\nimport type { QuickActionSessionRegistry } from '../session/execution.js'\nimport type { QuickActionsClientState, QuickActionsController } from '../controller.js'\nimport type {\n ComposerBlock,\n ComposerBlocks,\n ComposerDockProps,\n InputDockProps,\n SessionSlotProps,\n} from '../dsh.js'\nimport type { ProjectedQuickAction, QuickActionLayout } from '../../model/index.js'\n\n/** Everything the Slot entries reach outside React. */\nexport interface QuickActionSurfaceDeps {\n readonly controller: QuickActionsController\n readonly sessions: QuickActionSessionRegistry\n readonly residency: ResidentComposerRegistry\n /**\n * Resolves `ctx.conversation.blocks`, the registry face documented as \"how a\n * plugin the composer cannot import makes a session's input inert\". It is the\n * only public reading of the `blocked` guard of spec 9.2, and it is reached\n * through `ctx.get`, which the Cordis reflection layer documents as a read\n * \"without the inject requirement\" — so the Client's declared dependencies\n * stay exactly the four of spec 7.3. Absent, the guard degrades to \"not\n * blocked\" rather than guessing from the DOM.\n */\n readonly blocks: () => ComposerBlocks | undefined\n}\n\nfunction useControllerState(controller: QuickActionsController): QuickActionsClientState {\n return useSyncExternalStore(\n useCallback((listener: () => void) => controller.subscribe(listener), [controller]),\n () => controller.getSnapshot(),\n )\n}\n\nfunction useResident(residency: ResidentComposerRegistry, sessionId: string): boolean {\n return useSyncExternalStore(\n useCallback((listener: () => void) => residency.subscribe(listener), [residency]),\n () => residency.isResident(sessionId),\n )\n}\n\n/** Whether this Session is the one that draws anything global (see the registry). */\nfunction usePrimaryResident(residency: ResidentComposerRegistry, sessionId: string): boolean {\n return useSyncExternalStore(\n useCallback((listener: () => void) => residency.subscribe(listener), [residency]),\n () => residency.primarySessionId() === sessionId,\n )\n}\n\n/**\n * The Composer block for one Session, resolved on every read rather than cached.\n *\n * `conversation` is reached through `ctx.get` rather than `inject`, so nothing\n * orders it before this component's first render. Caching the resolution would\n * turn \"the service was not there yet\" into \"this Session can never be blocked\",\n * and a Quick Action would then send into a Composer another feature has made\n * inert. `storeFor` answers an identity-stable store, so re-resolving costs a\n * map lookup and keeps `getSnapshot` referentially stable.\n */\nfunction useComposerBlock(blocks: () => ComposerBlocks | undefined, sessionId: string): ComposerBlock | undefined {\n return useSyncExternalStore(\n useCallback(\n (listener: () => void) => blocks()?.storeFor(sessionId)?.subscribe(listener) ?? (() => {}),\n [blocks, sessionId],\n ),\n () => blocks()?.storeFor(sessionId)?.getSnapshot(),\n )\n}\n\n/**\n * The body both entries render once residency and the layout agree.\n *\n * It owns the Session's execution engine for as long as it is mounted: every\n * commit republishes the live `InputActions` and the live Composer projection\n * into it, and unmounting cancels whatever has not reached the official state\n * machine (spec 7.2).\n */\nfunction SessionSurface(props: SessionSlotProps & { readonly deps: QuickActionSurfaceDeps; readonly layout: QuickActionLayout; readonly actions: readonly ProjectedQuickAction[] }): ReactElement {\n const { deps, layout, actions, sessionId, useInput, useSession, inputActions, t } = props\n const engine = useMemo(() => deps.sessions.engineFor(sessionId), [deps.sessions, sessionId])\n const input = useInput((state) => state)\n const session = useSession((state) => state)\n const block = useComposerBlock(deps.blocks, sessionId)\n\n // One layout effect with no dependency list: the engine is handed the state of\n // every commit, which is also the boundary its single-flight settlement reads.\n // Running before paint means the first frame already carries the real\n // availability, rather than flashing every control disabled for one frame.\n useLayoutEffect(() => {\n engine.bind(inputActions, actions)\n engine.observe(input, session, block)\n })\n\n useEffect(\n () => () => {\n engine.cancelPending()\n },\n [engine],\n )\n\n const state = useSyncExternalStore(\n useCallback((listener: () => void) => engine.subscribe(listener), [engine]),\n () => engine.getSnapshot(),\n )\n\n const onActivate = useCallback(\n (action: ProjectedQuickAction) => {\n engine.activate(action)\n },\n [engine],\n )\n\n return (\n <QuickActionsSurface\n layout={layout}\n actions={actions}\n session={state}\n t={t}\n onActivate={onActivate}\n onConfirm={() => {\n engine.confirm()\n }}\n onCancelConfirm={() => {\n engine.cancel()\n }}\n onDismissFeedback={() => {\n engine.dismissFeedback()\n }}\n onManage={() => {\n deps.controller.openManager()\n }}\n />\n )\n}\n\n/** The catalog error and loading states of spec 10, rendered where the layout would be. */\nfunction CatalogNotice(props: {\n readonly client: QuickActionsClientState\n readonly t: SessionSlotProps['t']\n readonly onRetry: () => void\n}): ReactElement | null {\n const { client, t, onRetry } = props\n if (client.catalog.status === 'loading') return null\n if (client.catalog.status === 'ready') return null\n return (\n <div className=\"dsh-cqa-note\" role=\"status\" data-quick-actions-catalog-error={client.catalog.reason}>\n <span className=\"dsh-cqa-note-text\">{t(`catalog.${client.catalog.reason}`)}</span>\n <button type=\"button\" className=\"dsh-cqa-link\" onClick={onRetry}>\n {t('catalog.retry')}\n </button>\n </div>\n )\n}\n\n/** Build both Slot entry components over one set of fiber-owned dependencies. */\nexport function createQuickActionDockEntries(deps: QuickActionSurfaceDeps): {\n readonly InputDock: (props: InputDockProps) => ReactElement\n readonly ComposerDock: (props: ComposerDockProps) => ReactElement\n readonly ManagerDock: (props: InputDockProps) => ReactElement\n} {\n function Body(props: SessionSlotProps & { readonly owns: readonly QuickActionLayout[] }): ReactElement | null {\n const { owns, ...slot } = props\n const client = useControllerState(deps.controller)\n const projection = client.projection\n const onRetry = useCallback(() => {\n // The controller reports a failed re-read through the catalog state it\n // publishes, and deliberately lets the promise reject; swallowing it here\n // is what keeps a retry from raising an unhandled rejection on the page.\n deps.controller.refresh().catch(() => undefined)\n }, [])\n\n if (projection === undefined) {\n // No authoritative catalog: the layout is unknown, so only the retryable\n // catalog error may be shown, and only by the entry that owns the default.\n return owns.includes('ribbon') ? <CatalogNotice client={client} t={slot.t} onRetry={onRetry} /> : null\n }\n if (!owns.includes(projection.layout)) return null\n return (\n <SessionSurface\n {...slot}\n deps={deps}\n layout={projection.layout}\n actions={projection.composer}\n />\n )\n }\n\n function InputDock(props: InputDockProps): ReactElement {\n const resident = useResident(deps.residency, props.sessionId)\n return (\n <SurfaceErrorBoundary t={props.t}>\n {resident ? <Body {...props} owns={INPUT_DOCK_LAYOUTS} /> : null}\n </SurfaceErrorBoundary>\n )\n }\n\n function ComposerDock(props: ComposerDockProps): ReactElement {\n const { sessionId } = props\n // The beacon. A layout effect, so the mark lands — and the input dock's own\n // re-render lands with it — before the browser paints this commit: a hero\n // that becomes resident brings the ribbon up in the same frame, not the next.\n // The effect's own cleanup withdraws it, so a remount re-adds it.\n useLayoutEffect(() => deps.residency.mark(sessionId), [sessionId])\n\n return (\n <SurfaceErrorBoundary t={props.t}>\n <Body {...props} owns={COMPOSER_DOCK_LAYOUTS} />\n </SurfaceErrorBoundary>\n )\n }\n\n /**\n * The centralized management overlay (spec 8.1, 8.3).\n *\n * It renders only where a Resident Composer's own \"manage\" entry could have\n * opened it, and only for the primary Session, so the global panel stays\n * single however many composers are on screen.\n */\n function ManagerDock(props: InputDockProps): ReactElement {\n const primary = usePrimaryResident(deps.residency, props.sessionId)\n const client = useControllerState(deps.controller)\n return (\n <SurfaceErrorBoundary t={props.t}>\n {primary && client.manager.open ? (\n <ManagerPanel client={client} controller={deps.controller} t={props.t} />\n ) : null}\n </SurfaceErrorBoundary>\n )\n }\n\n return { InputDock, ComposerDock, ManagerDock }\n}\n\n/** `ribbon` and `launcher` render above the composer card (spec 8.1). */\nconst INPUT_DOCK_LAYOUTS: readonly QuickActionLayout[] = ['ribbon', 'launcher']\n/** `bar` renders below it. */\nconst COMPOSER_DOCK_LAYOUTS: readonly QuickActionLayout[] = ['bar']\n","/**\n * The Composer Quick Action surfaces' stylesheet (spec 8.2, 8.4).\n *\n * It is shipped as one string installed into a `<style data-plugin-css>` tag,\n * the same shape and idempotence the first-party DSH client bundles use, rather\n * than as CSS Modules: the Client build adapter produces one browser CJS file\n * with no CSS pipeline (spec 11.2), and adding one would change a contract the\n * bundle's own tests pin. Class names carry the `dsh-cqa-` prefix instead of a\n * generated hash, which gives the same collision safety by convention.\n *\n * Colours are DSH alias theme tokens only — nothing here defines a palette, and\n * nothing overrides a global theme (spec 8.4).\n *\n * ## The width rule (spec 8.2)\n *\n * The two layouts sit in different boxes, so they reach the same outer edges by\n * different arithmetic:\n *\n * - `.dsh-cqa-ribbon` renders in the composer stack, outside the InputBar, which\n * is the element that owns `--dsh-composer-side-clearance` as padding. It\n * therefore subtracts that clearance from both sides itself.\n * - `.dsh-cqa-bar` renders as the InputBar's last child, inside that padding, so\n * it is simply `100%` wide.\n *\n * Both are then capped at `--dsh-composer-card-max-width` — the same cap the\n * composer card uses — and centred, so their left and right edges coincide with\n * the input box exactly rather than approximately.\n */\n\nconst TAG_ID = 'dsh-quick-actions/surfaces.css'\n\nexport const QUICK_ACTIONS_CSS = `\n.dsh-cqa-ribbon,\n.dsh-cqa-launcher {\n box-sizing: border-box;\n width: calc(100% - var(--dsh-composer-side-clearance) - var(--dsh-composer-side-clearance));\n max-width: var(--dsh-composer-card-max-width);\n margin: 0 auto;\n}\n.dsh-cqa-bar {\n box-sizing: border-box;\n width: 100%;\n max-width: var(--dsh-composer-card-max-width);\n margin: 0 auto;\n}\n\n.dsh-cqa-row {\n display: flex;\n align-items: center;\n gap: 8px;\n min-width: 0;\n padding: 2px 0;\n}\n.dsh-cqa-row[data-density='narrow'] {\n gap: 6px;\n}\n\n.dsh-cqa-title {\n flex: none;\n color: var(--dsw-alias-label-tertiary);\n font-size: 12px;\n font-weight: 500;\n line-height: 18px;\n white-space: nowrap;\n}\n\n/* The ribbon overflows horizontally; the management entry never scrolls away. */\n.dsh-cqa-scroll {\n display: flex;\n align-items: center;\n gap: 8px;\n flex: 1 1 auto;\n min-width: 0;\n overflow-x: auto;\n scrollbar-width: thin;\n}\n.dsh-cqa-fit {\n display: flex;\n align-items: center;\n gap: 8px;\n flex: 1 1 auto;\n min-width: 0;\n overflow: hidden;\n}\n.dsh-cqa-trailing {\n display: flex;\n align-items: center;\n gap: 8px;\n flex: none;\n margin-left: auto;\n}\n\n/*\n * The capsule itself — height, radius, padding, colours, hover and \":disabled\"\n * — belongs to the official \"Button\". What is left here is what a shared\n * control cannot know (how it behaves inside these rows) plus what the\n * primitive does not supply. Nothing below may restate a Button property,\n * because the plugin class is applied after the primitive's and would win on\n * equal specificity.\n *\n * The focus ring is one of the things it does not supply: \"Button.module.css\"\n * and \"Pill.module.css\" carry no \":focus\" rule at all — the library leaves the\n * ring to each component that wants one (\"Input.module.css\" has\n * \":focus-within\", \"HoverCard\" and \"JsonTree\" their own). Spec 8.4 makes a\n * clear focus ring a hard gate, so it stays here for every control this plugin\n * renders.\n */\n.dsh-cqa-action,\n.dsh-cqa-entry {\n /* No global border-box reset exists in this stylesheet, and Button pads\n itself, so the cap has to count that padding to mean 240px on screen. */\n box-sizing: border-box;\n flex: none;\n /* Long labels truncate rather than pushing the row's other controls out. */\n max-width: 240px;\n}\n.dsh-cqa-action:focus-visible,\n.dsh-cqa-entry:focus-visible {\n outline: 2px solid var(--dsw-alias-state-business-primary);\n outline-offset: 1px;\n}\n/* \"aria-disabled\" is not \":disabled\": a control kept focusable while a write is\n in flight still has to read as inert, and no primitive expresses that. */\n.dsh-cqa-entry[aria-disabled='true'] {\n opacity: 0.5;\n cursor: default;\n}\n/* The searchable panel's rows stay native — a full-width, left-aligned list row\n is not a capsule — so they still need a focus ring of their own. */\n.dsh-cqa-panel-item:focus-visible,\n.dsh-cqa-link:focus-visible {\n outline: 2px solid var(--dsw-alias-state-business-primary);\n outline-offset: 1px;\n}\n.dsh-cqa-label {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.dsh-cqa-icon {\n flex: none;\n}\n/* The chip look is \"Pill\"'s; only its behaviour in a flex row is ours. */\n.dsh-cqa-badge,\n.dsh-cqa-tag {\n flex: none;\n}\n\n.dsh-cqa-note {\n box-sizing: border-box;\n width: 100%;\n margin: 4px 0 0;\n padding: 4px 8px;\n border-radius: 8px;\n background: var(--dsw-alias-interactive-bg-hover);\n color: var(--dsw-alias-label-secondary);\n font-size: 12px;\n line-height: 18px;\n display: flex;\n align-items: center;\n gap: 8px;\n}\n.dsh-cqa-note-text {\n flex: 1 1 auto;\n min-width: 0;\n}\n.dsh-cqa-link {\n flex: none;\n border: 0;\n background: none;\n padding: 0;\n color: var(--dsw-alias-state-business-primary);\n font: inherit;\n font-size: 12px;\n cursor: pointer;\n text-decoration: underline;\n}\n\n/* Anchored surfaces: the popover list and the confirmation panel. */\n.dsh-cqa-anchor {\n position: relative;\n}\n.dsh-cqa-backdrop {\n position: fixed;\n z-index: 19;\n inset: 0;\n}\n.dsh-cqa-panel {\n position: absolute;\n z-index: 20;\n bottom: calc(100% + 6px);\n left: 0;\n box-sizing: border-box;\n max-width: min(100%, 360px);\n min-width: 220px;\n max-height: 260px;\n overflow-y: auto;\n padding: 6px;\n border: 0.5px solid var(--dsw-alias-border-l1);\n border-radius: 12px;\n background: var(--dsw-specific-tip);\n box-shadow: var(--dsw-elevation-soft);\n}\n.dsh-cqa-panel-head {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n.dsh-cqa-panel-head .dsh-cqa-panel-title {\n flex: 1 1 auto;\n min-width: 0;\n}\n.dsh-cqa-panel-title {\n padding: 4px 8px;\n color: var(--dsw-alias-label-tertiary);\n font-size: 12px;\n line-height: 18px;\n}\n.dsh-cqa-panel-item {\n display: flex;\n align-items: center;\n gap: 6px;\n width: 100%;\n padding: 6px 8px;\n border: 0;\n border-radius: 8px;\n background: none;\n color: var(--dsw-alias-label-primary);\n font: inherit;\n font-size: 13px;\n line-height: 20px;\n text-align: left;\n cursor: pointer;\n}\n.dsh-cqa-panel-item:hover:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n.dsh-cqa-panel-item:disabled {\n opacity: 0.5;\n cursor: default;\n}\n\n.dsh-cqa-confirm-text {\n margin: 6px 0;\n padding: 8px;\n border-radius: 8px;\n background: var(--dsw-alias-interactive-bg-hover);\n color: var(--dsw-alias-label-primary);\n font-family: var(--ds-font-family-code);\n font-size: 12px;\n line-height: 18px;\n white-space: pre-wrap;\n word-break: break-word;\n max-height: 160px;\n overflow-y: auto;\n}\n.dsh-cqa-confirm-actions {\n display: flex;\n justify-content: flex-end;\n gap: 8px;\n}\n\n/* ------------------------------------------------------------------------- */\n/* Fields, shared by the search box and the Custom Quick Action form */\n/* ------------------------------------------------------------------------- */\n\n.dsh-cqa-field {\n display: flex;\n flex-direction: column;\n gap: 2px;\n padding: 4px 0;\n}\n.dsh-cqa-field-label {\n color: var(--dsw-alias-label-secondary);\n font-size: 12px;\n line-height: 18px;\n}\n.dsh-cqa-field-hint {\n color: var(--dsw-alias-label-tertiary);\n font-size: 11px;\n line-height: 16px;\n}\n.dsh-cqa-field-error {\n color: var(--dsw-alias-state-danger-primary, var(--dsw-alias-label-primary));\n font-size: 11px;\n line-height: 16px;\n font-weight: 500;\n}\n\n.dsh-cqa-input,\n.dsh-cqa-textarea {\n box-sizing: border-box;\n width: 100%;\n padding: 4px 8px;\n border: 0.5px solid var(--dsw-alias-border-l1);\n border-radius: 8px;\n background: transparent;\n color: var(--dsw-alias-label-primary);\n font: inherit;\n font-size: 13px;\n line-height: 20px;\n}\n.dsh-cqa-textarea {\n resize: vertical;\n min-height: 72px;\n font-family: var(--ds-font-family-code);\n white-space: pre-wrap;\n}\n.dsh-cqa-input:focus-visible,\n.dsh-cqa-textarea:focus-visible {\n outline: 2px solid var(--dsw-alias-state-business-primary);\n outline-offset: 1px;\n}\n.dsh-cqa-input:disabled,\n.dsh-cqa-textarea:disabled {\n opacity: 0.5;\n}\n\n.dsh-cqa-switch {\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 4px 0;\n cursor: pointer;\n}\n\n/* ------------------------------------------------------------------------- */\n/* The centralized management overlay */\n/* ------------------------------------------------------------------------- */\n\n/*\n * The overlay and its click-catching backdrop. Neither paints: only DSH alias\n * theme tokens may be used here, and this release has no token to spend on a\n * modal scrim (spec 8.4).\n *\n * These two numbers rank the overlay against its own backdrop, and nothing\n * else. Since ticket 26 the overlay is portaled to the document body, so it and\n * the anchored popovers (19 and 20, still rendered in the input dock) sit in\n * different stacking contexts: which of them paints on top follows from where\n * the dock's own ancestors land in the root context, not from comparing 31\n * against 20. Raising these would not change that.\n */\n.dsh-cqa-manager-backdrop {\n z-index: 30;\n}\n.dsh-cqa-manager {\n position: fixed;\n z-index: 31;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n gap: 6px;\n width: min(560px, calc(100vw - 24px));\n max-height: min(80vh, 680px);\n overflow-y: auto;\n padding: 12px;\n border: 0.5px solid var(--dsw-alias-border-l1);\n border-radius: 12px;\n background: var(--dsw-specific-tip);\n color: var(--dsw-alias-label-primary);\n box-shadow: var(--dsw-elevation-soft);\n}\n\n.dsh-cqa-manager-head {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n.dsh-cqa-manager-title {\n flex: 1 1 auto;\n min-width: 0;\n margin: 0;\n color: var(--dsw-alias-label-primary);\n font-size: 14px;\n font-weight: 600;\n line-height: 20px;\n}\n\n.dsh-cqa-section {\n display: flex;\n flex-direction: column;\n gap: 6px;\n padding: 6px 0;\n border-top: 0.5px solid var(--dsw-alias-border-l1);\n}\n.dsh-cqa-section-head {\n display: flex;\n align-items: center;\n gap: 8px;\n flex-wrap: wrap;\n}\n.dsh-cqa-section-head .dsh-cqa-section-title {\n flex: 1 1 auto;\n}\n.dsh-cqa-section-title {\n color: var(--dsw-alias-label-secondary);\n font-size: 12px;\n font-weight: 500;\n line-height: 18px;\n}\n.dsh-cqa-group {\n display: flex;\n align-items: center;\n gap: 6px;\n flex-wrap: wrap;\n}\n.dsh-cqa-entry[aria-pressed='true'] {\n background: var(--dsw-alias-state-business-tertiary);\n color: var(--dsw-alias-label-primary-bluish);\n opacity: 1;\n}\n\n.dsh-cqa-list {\n display: flex;\n flex-direction: column;\n gap: 6px;\n margin: 0;\n padding: 0;\n list-style: none;\n}\n.dsh-cqa-list-item {\n display: flex;\n flex-direction: column;\n gap: 4px;\n padding: 6px 8px;\n border-radius: 8px;\n background: var(--dsw-alias-interactive-bg-hover);\n}\n/* A hidden or disabled action stays legible: it is managed here, not removed. */\n.dsh-cqa-list-item[data-quick-action-hidden] .dsh-cqa-list-head,\n.dsh-cqa-list-item[data-quick-action-hidden] .dsh-cqa-list-text {\n opacity: 0.6;\n}\n.dsh-cqa-list-head {\n display: flex;\n align-items: center;\n gap: 6px;\n flex-wrap: wrap;\n min-width: 0;\n font-size: 13px;\n line-height: 20px;\n}\n.dsh-cqa-list-text {\n min-width: 0;\n overflow: hidden;\n color: var(--dsw-alias-label-tertiary);\n font-family: var(--ds-font-family-code);\n font-size: 11px;\n line-height: 16px;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n.dsh-cqa-list-controls {\n display: flex;\n align-items: center;\n gap: 4px;\n flex-wrap: wrap;\n}\n\n.dsh-cqa-form {\n display: flex;\n flex-direction: column;\n gap: 2px;\n padding: 6px 0 0;\n border-top: 0.5px solid var(--dsw-alias-border-l1);\n}\n.dsh-cqa-form-actions {\n display: flex;\n justify-content: flex-end;\n gap: 8px;\n padding-top: 6px;\n}\n`\n\n/**\n * Install the stylesheet once per document and return its disposer, so the\n * Client fiber owns it like every other registration (spec 7.3).\n *\n * The holder count lives on the tag rather than in this module, because a hot\n * reload runs two bundle instances at once: the new fiber installs before the\n * old one unloads, and each has its own module scope. Counting in the DOM is\n * what keeps the surviving instance's styles from being removed underneath it.\n */\nexport function installQuickActionStyles(): () => void {\n if (typeof document === 'undefined') return () => {}\n const selector = `style[data-plugin-css=${JSON.stringify(TAG_ID)}]`\n const existing = document.querySelector<HTMLStyleElement>(selector)\n const tag = existing ?? document.createElement('style')\n if (existing === null) {\n tag.dataset['plugin'] = 'dsh-quick-actions'\n tag.dataset['pluginCss'] = TAG_ID\n tag.textContent = QUICK_ACTIONS_CSS\n document.head.appendChild(tag)\n }\n tag.dataset['pluginCssHolders'] = String(holdersOf(tag) + 1)\n\n let released = false\n return () => {\n if (released) return\n released = true\n const left = holdersOf(tag) - 1\n if (left > 0) {\n tag.dataset['pluginCssHolders'] = String(left)\n return\n }\n tag.remove()\n }\n}\n\nfunction holdersOf(tag: HTMLStyleElement): number {\n const held = Number(tag.dataset['pluginCssHolders'])\n return Number.isFinite(held) && held > 0 ? held : 0\n}\n","/**\n * Client composition entry for Composer Quick Actions.\n *\n * This fiber owns everything the feature holds in the browser: one global\n * `QuickActionsController` over the two Settings namespaces, the per-Session\n * execution registry, the Resident Composer registry, the locale dictionaries,\n * the stylesheet, and the two dock Slot registrations. All of it is installed\n * through `ctx.effect` and `ctx.slots.inject`, so unloading the plugin leaves\n * no listener, registration, namespace, style tag or subscription behind\n * (spec 7.3).\n *\n * `settingsScope` is how this Client reaches Host-authoritative state at all — it\n * never writes a file, never treats browser storage as a source of truth, and\n * never reaches past Settings to a provider (spec 6.3). `connection` supplies the\n * generation state the read-only-while-disconnected rule needs (spec 10).\n */\nimport type { Context } from '@deepseek-ai/cordis'\nimport { createQuickActionsController } from './controller.js'\nimport type { ConnectionLike, SettingsScopeService } from './controller.js'\nimport { createQuickActionSessionRegistry } from './session/execution.js'\nimport { createResidentComposerRegistry } from './surfaces/residency.js'\nimport { createQuickActionDockEntries } from './surfaces/entries.js'\nimport type { ComponentType, ConversationLike, LocaleService, SlotsService } from './dsh.js'\nimport { QUICK_ACTIONS_LOCALE_NAMESPACE, quickActionsDictionaries } from '../locales/index.js'\nimport { installQuickActionStyles } from '../styles/index.js'\n\n// `@deepseek-ai/dsh-client-ui-settings`, `@deepseek-ai/dsh-client-connection`,\n// `@deepseek-ai/dsh-client-ui-renderer` and `@deepseek-ai/dsh-client-locale`\n// publish no `.d.ts` this package can depend on at build time — the Client\n// bundle may only `require` the specifiers the build adapter declares external —\n// so the shapes this plugin consumes are declared in `./dsh.ts` and in\n// `./controller.ts`, deliberately no wider than what is actually read.\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n settingsScope: SettingsScopeService\n connection: ConnectionLike\n slots: SlotsService\n locale: LocaleService\n conversation: ConversationLike\n }\n}\n\nexport const name = 'composer-quick-actions'\n\n/**\n * The services this Client requires (spec 7.3). `conversation` is deliberately\n * absent: its Composer-block registry is read through `ctx.get`, the documented\n * read \"without the inject requirement\", because the service is guaranteed\n * present wherever the two dock Slots it declares are rendered.\n */\nexport const inject: readonly string[] = ['slots', 'settingsScope', 'connection', 'locale']\n\n/** Ascending position among the shipped dock entries; late enough to sit last. */\nconst DOCK_ORDER = 100\n/** The management overlay's own cell, right after the layout's (spec 8.1). */\nconst MANAGER_ORDER = 101\n\n/**\n * Start the feature and tie every piece of it to this fiber.\n *\n * Nothing is returned and no internal type is re-exported: the controller, the\n * execution engine and the surfaces are internal to this package (spec 14).\n */\nexport function apply(ctx: Context): void {\n const controller = createQuickActionsController({\n settingsScope: ctx.settingsScope,\n connection: ctx.connection,\n })\n const sessions = createQuickActionSessionRegistry()\n const residency = createResidentComposerRegistry()\n\n ctx.effect(\n () => () => {\n sessions.dispose()\n controller.dispose()\n },\n 'composer-quick-actions: client controller',\n )\n ctx.effect(\n () => ctx.locale.register(QUICK_ACTIONS_LOCALE_NAMESPACE, quickActionsDictionaries),\n 'composer-quick-actions: dictionaries',\n )\n ctx.effect(installQuickActionStyles, 'composer-quick-actions: surface styles')\n\n const { InputDock, ComposerDock, ManagerDock } = createQuickActionDockEntries({\n controller,\n sessions,\n residency,\n blocks: () => ctx.get('conversation')?.blocks,\n })\n\n // Both docks are always registered; the current layout decides which one draws\n // (spec 8.1). The composer dock is also the Resident Composer beacon, so it is\n // registered whatever the layout is.\n //\n // The input dock carries two cells, not one: the layout entry and — registered\n // independently, as spec 8.1 requires — the centralized management overlay.\n // One `inject` declares both, because a Slot injection accepts an iterable of\n // disposers and the two cells share one declaration lifetime.\n ctx.slots.inject('conversation.input.dock', () => [\n ctx.slots.register(\n {\n name: 'conversation.input.dock',\n id: 'composer-quick-actions',\n order: DOCK_ORDER,\n locale: QUICK_ACTIONS_LOCALE_NAMESPACE,\n },\n InputDock as ComponentType<never>,\n ),\n ctx.slots.register(\n {\n name: 'conversation.input.dock',\n id: 'composer-quick-actions-manager',\n order: MANAGER_ORDER,\n locale: QUICK_ACTIONS_LOCALE_NAMESPACE,\n },\n ManagerDock as ComponentType<never>,\n ),\n ])\n ctx.slots.inject('conversation.composer.dock', () =>\n ctx.slots.register(\n {\n name: 'conversation.composer.dock',\n id: 'composer-quick-actions',\n order: DOCK_ORDER,\n locale: QUICK_ACTIONS_LOCALE_NAMESPACE,\n },\n ComposerDock as ComponentType<never>,\n ),\n )\n}\n"],"mappings":";;;;;;;;;;;;EAsBA,MAAa,uBAAqD;GAAC;GAAU;GAAO;EAAU;;;;;EA8C9F,SAAgB,kBAAkB,KAA6B;GAC7D,OAAO,GAAG,IAAI,OAAO,GAAG,IAAI;EAC9B;;;;;;;;;;;;;EC5DA,SAAgB,cAAc,MAAe,OAAyB;GACpE,IAAI,SAAS,OAAO,OAAO;GAC3B,IAAI,OAAO,SAAS,YAAY,OAAO,UAAU,YAAY,SAAS,QAAQ,UAAU,MAAM,OAAO;GACrG,IAAI,MAAM,QAAQ,IAAI,KAAK,MAAM,QAAQ,KAAK,GAAG;IAC/C,IAAI,CAAC,MAAM,QAAQ,IAAI,KAAK,CAAC,MAAM,QAAQ,KAAK,KAAK,KAAK,WAAW,MAAM,QAAQ,OAAO;IAC1F,OAAO,KAAK,OAAO,MAAM,U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