dsh-brief-sidebar 0.9.26 → 0.9.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.de.md +2 -1
- package/README.es.md +2 -1
- package/README.fr.md +2 -1
- package/README.it.md +2 -1
- package/README.md +2 -1
- package/README.pt.md +296 -0
- package/README.ru.md +2 -1
- package/dsh.plugin.json +16 -16
- package/lib/client.js +107 -2
- package/lib/client.js.map +1 -1
- package/lib/types/client/locales.d.ts +4 -2
- package/locale/pt.json +6 -0
- package/package.json +116 -116
- package/src/client/locales.ts +111 -2
package/lib/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["STATUS_KEY","NO_SUBSCRIBE","ABSENT","useMemo","useCallback","useSyncExternalStore","useMemo","SECTION_STYLE","HEADER_STYLE","LIST_STYLE","ROW_STYLE","createElement","CHEVRON_STYLE","createElement","SECTION_STYLE","HEADER_STYLE","LIST_STYLE","ROW_STYLE","TAG_STYLE","createElement","useState","isCounter","readLatest","isCounter","readItem","isCounter","readRecall","isCounter","NO_SUBSCRIBE","useMemo","useCallback","useSyncExternalStore","SECTION_STYLE","HEADER_STYLE","LIST_STYLE","ROW_STYLE","NAME_STYLE","TAG_STYLE","FOOTER_STYLE","EMPTY_STYLE","useState","createElement","SECTION_STYLE","HEADER_STYLE","LIST_STYLE","BUBBLE_STYLE","TITLE_STYLE","FOOTER_STYLE","EMPTY_STYLE","useState","createElement","TYPE_STYLE","BODY_STYLE","SCENARIO_STYLE","FOOTER_STYLE","createElement","renderMd","Fragment","TRIGGER_STYLE","ITEM_STYLE","FAIL_STYLE","POPOVER_STYLE","useState","useRef","useCallback","createElement","SECTION_STYLE","HEADER_STYLE","HINT_STYLE","LIST_STYLE","ROW_STYLE","TITLE_STYLE","META_STYLE","EMPTY_STYLE","createElement","useState","useRef","readRecall","useCallback","SECTION_STYLE","HEADER_STYLE","ROW_STYLE","BODY_STYLE","VIEW_BTN_STYLE","createElement","useCallback","useState","useRef","useCallback","createElement","SECTION_STYLE","HEADER_STYLE","BODY_STYLE","ROW_STYLE","ROW_TEXT_STYLE","useState","useCallback","createElement","HEADER_STYLE","useState","readRecall","useCallback","createElement","createElement","WRAP","useState","createElement","NAME_STYLE","createElement","Fragment","useState","createElement","useState","useSyncExternalStore","useCallback","useState","createElement","entry","createElement"],"sources":["../src/client/brief/board.ts","../src/client/use-projection.ts","../src/client/brief/use-todos.ts","../src/client/TodoBoardTab.tsx","../src/projection/keys.ts","../src/client/file-open.ts","../src/client/summary/deliverables.ts","../src/client/summary/FoldToggle.tsx","../src/client/locales.ts","../src/client/summary/DeliverablesSection.tsx","../src/client/summary/skill-usage.ts","../src/projection/search-ref-fold.ts","../src/client/summary/search-refs.ts","../src/client/summary/memory-recall.ts","../src/client/summary/memory-slots.ts","../src/client/scope-face.ts","../src/client/summary/use-config-flag.ts","../src/client/summary/SkillUsageSection.tsx","../src/client/summary/SearchRefSection.tsx","../src/client/summary/recall-feedback.ts","../src/client/summary/RecallBubble.tsx","../src/client/memory-open.ts","../src/client/memory-tab.ts","../src/client/summary/MemoryViewMenu.tsx","../src/client/summary/MemoryRecallSection.tsx","../src/client/summary/MemorySlotsSection.tsx","../src/client/spirit-echo.ts","../src/client/spirit-open.ts","../src/client/summary/EchoViewMenu.tsx","../src/client/summary/SpiritEchoSection.tsx","../src/client/summary/ReferenceSection.tsx","../src/client/SummaryTab.tsx","../src/client/native-sidebar.tsx","../src/client/echo-viewer/echo-viewer.tsx","../src/client/memory-viewer/viewer.tsx","../src/client/BriefIcon.tsx","../src/client/brief/dock-shadow.tsx","../src/client/settings-card.tsx","../src/client/family-host.tsx","../src/client/index.tsx"],"sourcesContent":["/**\r\n * The `todos` projection — reading and classifying it.\r\n *\r\n * The Host computes this projection (`dsh-tool-todo` registers the key) and\r\n * pushes finished whole values; the client never folds it. This module is the\r\n * read side of that contract and is deliberately PURE — no React, no context,\r\n * no IO — so the mapping can be tested directly.\r\n */\r\n/** The projection's three-state lifecycle (`TodoItem` in `dsh-tool-todo`). */\r\nexport type TodoStatus = 'pending' | 'in_progress' | 'completed'\r\n\r\n/** One entry of the `todos` projection. */\r\nexport interface TodoItem {\r\n readonly content: string\r\n readonly status: TodoStatus\r\n}\r\n\r\nconst STATUSES: readonly TodoStatus[] = ['pending', 'in_progress', 'completed']\r\n\r\n/** Locale key per status. Kept here so this module owns the vocabulary. */\r\nconst STATUS_KEY: Record<TodoStatus, string> = {\r\n pending: 'status.pending',\r\n in_progress: 'status.inProgress',\r\n completed: 'status.completed',\r\n}\r\n\r\n/** Locale key for one status label. */\r\nexport function statusKey(status: TodoStatus): string {\r\n return STATUS_KEY[status]\r\n}\r\n\r\n/**\r\n * Narrow a raw projection value into a todo list.\r\n *\r\n * Three outcomes are kept apart on purpose, mirroring the store's own contract:\r\n * - `undefined` — the capability is ABSENT (no session, the host unit is\r\n * unmounted, or no baseline/frame has carried the key yet);\r\n * - `[]` — the projection is present and the list is empty (`null` on the wire);\r\n * - a list — real entries.\r\n *\r\n * A malformed entry is dropped rather than thrown on: the projection is a\r\n * trusted Host value, but a shape drift must not blank the whole board.\r\n *\r\n * @param value - the raw `unknown` snapshot of the `todos` face.\r\n * @returns the validated list, or `undefined` when the capability is absent.\r\n */\r\nexport function readTodos(value: unknown): readonly TodoItem[] | undefined {\r\n if (value === null) return []\r\n if (!Array.isArray(value)) return undefined\r\n\r\n const items: TodoItem[] = []\r\n for (const raw of value) {\r\n if (raw === null || typeof raw !== 'object') continue\r\n const { content, status } = raw as { content?: unknown; status?: unknown }\r\n if (typeof content !== 'string') continue\r\n if (typeof status !== 'string' || !isStatus(status)) continue\r\n items.push({ content, status })\r\n }\r\n return items\r\n}\r\n\r\n/** Whether a string is one of the three lifecycle values. */\r\nfunction isStatus(value: string): value is TodoStatus {\r\n return (STATUSES as readonly string[]).includes(value)\r\n}\r\n\r\n/** Per-status counts over one list. */\r\nexport interface TodoCounts {\r\n readonly total: number\r\n readonly completed: number\r\n readonly inProgress: number\r\n readonly pending: number\r\n}\r\n\r\n/** Count a todo list by status. */\r\nexport function countTodos(todos: readonly TodoItem[]): TodoCounts {\r\n let completed = 0\r\n let inProgress = 0\r\n let pending = 0\r\n for (const item of todos) {\r\n if (item.status === 'completed') completed += 1\r\n else if (item.status === 'in_progress') inProgress += 1\r\n else pending += 1\r\n }\r\n return { total: todos.length, completed, inProgress, pending }\r\n}\r\n\r\n/** How many entries are not finished — the tab badge. */\r\nexport function unfinishedCount(todos: readonly TodoItem[]): number {\r\n const counts = countTodos(todos)\r\n return counts.inProgress + counts.pending\r\n}\r\n\r\n/**\r\n * The one-line progress summary, composed from parts so no interpolation\r\n * machinery is needed (the locale binder is a plain key → string lookup).\r\n * Mirrors the official dock's own label.\r\n */\r\nexport function progressLine(counts: TodoCounts, t: (key: string) => string): string {\r\n const parts = [`${t('status.completed')} ${counts.completed}/${counts.total}`]\r\n if (counts.inProgress > 0) parts.push(`${t('status.inProgress')} ${counts.inProgress}`)\r\n if (counts.pending > 0) parts.push(`${t('status.pending')} ${counts.pending}`)\r\n return parts.join(' · ')\r\n}\r\n","/**\r\n * Reading a live session projection from the client Session Controller.\r\n *\r\n * better-sidebar tab bodies are NOT rendered inside a DSH slot, so the\r\n * framework's `useProjection` standard prop is not available to them. The\r\n * equivalent face is reachable directly: the client Session Controller is a\r\n * cordis service on the root context, and each session binding exposes its\r\n * projections store (`SessionFace.projections.faceOf(key)`), which is the very\r\n * observable `useProjection` resolves. Since it is a bare\r\n * `{ getSnapshot, subscribe }` source, `useSyncExternalStore` binds it as-is —\r\n * no local mirror, no folding, and the value reference only changes when the\r\n * Host pushes a frame.\r\n *\r\n * Everything here is resolved defensively: a host without the Session\r\n * Controller, or a session that is not open any more, degrades to \"capability\r\n * absent\" (undefined) rather than throwing inside a render.\r\n *\r\n * This module is key-agnostic; the per-projection knowledge (which key, how to\r\n * narrow the raw value) lives with the feature modules that call it.\r\n */\r\nimport { useCallback, useMemo, useSyncExternalStore } from 'react'\r\n\r\n/**\r\n * Structural probe face for the client root context.\r\n *\r\n * Widened from cordis `Context` on the 0.2.1-rc.3 dev bed: the host tab library\r\n * vendors its own cordis `Context` and intersects it into the tab/badge ctx it\r\n * hands us, so the nominal cordis `Context` of this repo's cordis copy is NOT\r\n * assignable across the two (missing symbol members). Everything this plugin\r\n * reads off the context already goes through `ctx.get(...)` structural probes,\r\n * so the shared minimum is exactly that one method.\r\n */\r\nexport interface CtxProbe {\r\n get(key: string): any\r\n}\r\n\r\n/** Structural view of a projection face (`ObservableSnapshot<unknown>`). */\r\nexport interface ProjectionFace {\r\n getSnapshot(): unknown\r\n subscribe(listener: () => void): () => void\r\n}\r\n\r\n/** Structural view of one session binding's projection store. */\r\nexport interface ProjectionsLike {\r\n faceOf(key: string): ProjectionFace\r\n}\r\n\r\n/** Structural view of the client Session Controller face this plugin uses. */\r\nexport interface SessionsLike {\r\n binding(id: string): { readonly session: { readonly projections: ProjectionsLike } } | undefined\r\n}\r\n\r\n/** A no-op unsubscribe, kept as one identity so effects never thrash. */\r\nconst NO_SUBSCRIBE = (): void => {}\r\n\r\n/** A source that never has a value — the absent-capability face. */\r\nconst ABSENT: ProjectionFace = { getSnapshot: () => undefined, subscribe: () => NO_SUBSCRIBE }\r\n\r\n/**\r\n * Whether a value really is a projection face.\r\n *\r\n * The store contract promises an identity-stable face for every key, so this\r\n * never fires against a healthy host. It exists because the fallback is worse\r\n * than the check: `useSyncExternalStore` would throw on a face-less key, and a\r\n * thrown render is a blank sidebar rather than a diagnosable \"unavailable\".\r\n */\r\nfunction isFace(value: unknown): value is ProjectionFace {\r\n if (value === null || typeof value !== 'object') return false\r\n const face = value as Partial<ProjectionFace>\r\n return typeof face.getSnapshot === 'function' && typeof face.subscribe === 'function'\r\n}\r\n\r\n/**\r\n * Resolve one projection face for one session.\r\n *\r\n * `ctx.get('sessions')` is the safe accessor (a direct `ctx.sessions` read can\r\n * throw on a context that does not carry the service yet).\r\n *\r\n * @param ctx - the client root context handed to the tab body.\r\n * @param sessionId - the tab's session scope; undefined means \"no session\".\r\n * @param key - the projection key to resolve.\r\n * @returns the projection face, or {@link ABSENT} when unreachable.\r\n */\r\nexport function resolveFace(ctx: CtxProbe | undefined, sessionId: string | undefined, key: string): ProjectionFace {\r\n if (ctx === undefined || sessionId === undefined) return ABSENT\r\n const sessions = ctx.get('sessions') as SessionsLike | undefined\r\n if (sessions === undefined || typeof sessions.binding !== 'function') return ABSENT\r\n\r\n const binding = sessions.binding(sessionId)\r\n const projections = binding?.session?.projections\r\n if (projections === undefined || typeof projections.faceOf !== 'function') return ABSENT\r\n\r\n const face: unknown = projections.faceOf(key)\r\n return isFace(face) ? face : ABSENT\r\n}\r\n\r\n/**\r\n * Read one frame of a projection without subscribing.\r\n *\r\n * The one-shot sibling of {@link useProjectionValue}, for consumers that are\r\n * not React components — the tab badge is a plain function called on every\r\n * tab-bar render, so it must neither hold a subscription nor allocate one.\r\n *\r\n * @param ctx - the client root context.\r\n * @param sessionId - the session whose projection is read.\r\n * @param key - the projection key to read.\r\n * @returns the raw snapshot: `undefined` while the capability is absent; the\r\n * semantics of any other value belong to the projection's own contract.\r\n */\r\nexport function projectionSnapshot(ctx: CtxProbe | undefined, sessionId: string | undefined, key: string): unknown {\r\n return resolveFace(ctx, sessionId, key).getSnapshot()\r\n}\r\n\r\n/**\r\n * Subscribe to one session projection by key.\r\n *\r\n * @param ctx - the client root context.\r\n * @param sessionId - the session whose projection is shown.\r\n * @param key - the projection key to subscribe to.\r\n * @returns the raw snapshot value, identity-stable across frames the host did\r\n * not change. Narrowing is the caller's job.\r\n */\r\nexport function useProjectionValue(ctx: CtxProbe | undefined, sessionId: string | undefined, key: string): unknown {\r\n const face = useMemo(() => resolveFace(ctx, sessionId, key), [ctx, sessionId, key])\r\n\r\n const subscribe = useCallback((listener: () => void) => face.subscribe(listener), [face])\r\n const getSnapshot = useCallback(() => face.getSnapshot(), [face])\r\n\r\n return useSyncExternalStore(subscribe, getSnapshot, getSnapshot)\r\n}\r\n","/**\r\n * Reading the live `todos` projection — the thin, todo-specific wrapper around\r\n * the generic face resolver (`../use-projection`). The projection key is\r\n * registered by `dsh-tool-todo`; the host pushes finished whole values and the\r\n * client never folds it. Narrowing lives in `./board` (`readTodos`).\r\n */\r\nimport { useMemo } from 'react'\r\nimport type { CtxProbe } from '../use-projection'\r\nimport { readTodos } from './board'\r\nimport type { TodoItem } from './board'\r\nimport { useProjectionValue } from '../use-projection'\r\n\r\n/** The projection key registered by `dsh-tool-todo`. */\r\nexport const TODOS_KEY = 'todos'\r\n\r\n/**\r\n * Subscribe to one session's todo list.\r\n *\r\n * @param ctx - the client root context.\r\n * @param sessionId - the session whose projection is shown.\r\n * @returns the list, `[]` for a present-but-empty projection, or `undefined`\r\n * while the capability is absent.\r\n */\r\nexport function useTodos(ctx: CtxProbe | undefined, sessionId: string | undefined): readonly TodoItem[] | undefined {\r\n const raw = useProjectionValue(ctx, sessionId, TODOS_KEY)\r\n return useMemo(() => readTodos(raw), [raw])\r\n}\r\n","/**\r\n * The progress section: the `todos` projection drawn as one part of the\r\n * summary tab.\r\n *\r\n * The official composer-band panel is shadowed by this plugin (see\r\n * `brief/dock-shadow.tsx`), so the projection is read here and rendered as an\r\n * ordinary React view — no Canvas, no cross-package dependency. The full-height\r\n * shell and the scroll container live on the summary tab (`../SummaryTab`);\r\n * this component renders only its own slice and is the one section whose\r\n * absent state must stay VISIBLE: the official dock is hidden while this\r\n * plugin is mounted, so \"unavailable\" is a statement the reader needs.\r\n *\r\n * Colours come from `--dsw-alias-*` tokens only (skin contract), and the status\r\n * palette uses tokens that actually exist in the shipping theme:\r\n * `state-success-primary` / `state-business-primary` / `label-tertiary`.\r\n */\r\nimport { createElement } from 'react'\r\nimport type { CSSProperties, ReactNode } from 'react'\r\nimport type { CtxProbe } from './use-projection'\r\nimport { countTodos, progressLine, statusKey } from './brief/board'\r\nimport type { TodoItem, TodoStatus } from './brief/board'\r\nimport { useTodos } from './brief/use-todos'\r\n\r\n/** The session scope better-sidebar hands a tab body. */\r\nexport interface TodoScope {\r\n readonly sessionId?: string\r\n}\r\n\r\nexport interface TodoSectionProps {\r\n /** The DSH locale lookup, passed down from `apply`. */\r\n t: (key: string) => string\r\n /** The client root context (the tab body's only way to reach services). */\r\n ctx?: CtxProbe\r\n /** The session this tab is scoped to. */\r\n scope?: TodoScope\r\n}\r\n\r\n/** Status → token colour for the pill's text and border. */\r\nconst STATUS_COLOR: Record<TodoStatus, string> = {\r\n completed: 'var(--dsw-alias-state-success-primary)',\r\n in_progress: 'var(--dsw-alias-state-business-primary)',\r\n pending: 'var(--dsw-alias-label-tertiary)',\r\n}\r\n\r\nconst SECTION_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n borderBottom: '1px solid var(--dsw-alias-border-secondary)',\r\n}\r\n\r\nconst HEADER_STYLE: CSSProperties = {\r\n padding: '10px 12px 0',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n fontSize: 12,\r\n fontWeight: 600,\r\n}\r\n\r\nconst PROGRESS_STYLE: CSSProperties = {\r\n padding: '6px 12px 10px',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n fontSize: 12,\r\n}\r\n\r\nconst LIST_STYLE: CSSProperties = {\r\n listStyle: 'none',\r\n margin: 0,\r\n padding: '6px 0',\r\n display: 'flex',\r\n flexDirection: 'column',\r\n}\r\n\r\nconst ROW_STYLE: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'flex-start',\r\n gap: 8,\r\n padding: '6px 12px',\r\n}\r\n\r\n/** Pill style, coloured per status. */\r\nfunction pillStyle(status: TodoStatus): CSSProperties {\r\n return {\r\n flexShrink: 0,\r\n color: STATUS_COLOR[status],\r\n border: `1px solid ${STATUS_COLOR[status]}`,\r\n borderRadius: 999,\r\n padding: '0 6px',\r\n fontSize: 11,\r\n lineHeight: '16px',\r\n whiteSpace: 'nowrap',\r\n }\r\n}\r\n\r\n/** Task text: finished entries read as done, the working one as active. */\r\nfunction contentStyle(status: TodoStatus): CSSProperties {\r\n return {\r\n minWidth: 0,\r\n overflowWrap: 'anywhere',\r\n color:\r\n status === 'completed'\r\n ? 'var(--dsw-alias-label-tertiary)'\r\n : status === 'in_progress'\r\n ? 'var(--dsw-alias-label-primary)'\r\n : 'var(--dsw-alias-label-secondary)',\r\n textDecoration: status === 'completed' ? 'line-through' : 'none',\r\n }\r\n}\r\n\r\n/** Centred message block used by every non-list state. */\r\nexport function Notice(props: { title: string; detail?: string }): ReactNode {\r\n return (\r\n <div\r\n style={{\r\n margin: '0 auto',\r\n padding: 24,\r\n maxWidth: 460,\r\n textAlign: 'center',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n lineHeight: 1.7,\r\n fontSize: 12,\r\n }}\r\n >\r\n <div style={{ marginBottom: 6, color: 'var(--dsw-alias-label-secondary)' }}>{props.title}</div>\r\n {props.detail === undefined ? null : <div>{props.detail}</div>}\r\n </div>\r\n )\r\n}\r\n\r\n/** One task row. */\r\nfunction TodoRow(props: { item: TodoItem; t: (key: string) => string }): ReactNode {\r\n const { item, t } = props\r\n return createElement(\r\n 'li',\r\n { style: ROW_STYLE },\r\n createElement('span', { style: pillStyle(item.status) }, t(statusKey(item.status))),\r\n createElement('span', { style: contentStyle(item.status) }, item.content),\r\n )\r\n}\r\n\r\n/**\r\n * The progress section. The subscription is unconditional (a plain listener,\r\n * not IO); the three-state contract of the projection is preserved verbatim.\r\n * @param props - translation, client context, session scope.\r\n */\r\nexport function TodoSection(props: TodoSectionProps): ReactNode {\r\n const { t, ctx, scope } = props\r\n\r\n const todos = useTodos(ctx, scope?.sessionId)\r\n\r\n if (todos === undefined) {\r\n // `undefined` is the store's \"capability absent\": no session, or the host's\r\n // todo unit is unmounted. Say so rather than showing an empty board.\r\n return createElement(\r\n 'div',\r\n { style: SECTION_STYLE, 'data-dsh-brief-sidebar': 'progress-section' },\r\n createElement('div', { style: HEADER_STYLE }, t('section.progress')),\r\n createElement(Notice, { title: t('board.unavailable'), detail: t('board.unavailableHint') }),\r\n )\r\n }\r\n\r\n if (todos.length === 0) {\r\n return createElement(\r\n 'div',\r\n { style: SECTION_STYLE, 'data-dsh-brief-sidebar': 'progress-section' },\r\n createElement('div', { style: HEADER_STYLE }, t('section.progress')),\r\n createElement(Notice, { title: t('board.empty'), detail: t('board.emptyHint') }),\r\n )\r\n }\r\n\r\n const counts = countTodos(todos)\r\n\r\n return createElement(\r\n 'div',\r\n { style: SECTION_STYLE, 'data-dsh-brief-sidebar': 'progress-section' },\r\n createElement('div', { style: HEADER_STYLE }, t('section.progress')),\r\n createElement('div', { style: PROGRESS_STYLE }, progressLine(counts, t)),\r\n createElement(\r\n 'ul',\r\n { style: LIST_STYLE },\r\n todos.map((item, index) => createElement(TodoRow, { key: `${index}:${item.content}`, item, t })),\r\n ),\r\n )\r\n}\r\n\r\n/**\r\n * Backwards-compatible alias for the pre-summary export name. The component\r\n * no longer owns the full-height shell — that moved to `SummaryTab` — so the\r\n * alias exists only to keep import sites honest during the transition.\r\n */\r\nexport const TodoBoardTab = TodoSection\r\n","/**\r\n * The projection keys this plugin contributes to the session-projection\r\n * registry, and their wire views.\r\n *\r\n * The key is namespaced with the plugin name on purpose: the registry refuses\r\n * to share a key across differing `stateVersion`s, so a collision with a\r\n * future host-side deliverables unit would be a hard load error, not a silent\r\n * shadow. The view type is declared structurally (the plugin has no compile\r\n * dependency on `@deepseek-ai/dsh-session-projection`); the registry accepts\r\n * any string key at runtime.\r\n */\r\n\r\n/** The projection key registered by this plugin's host half. */\r\nexport const DELIVERABLES_KEY = 'dshSummaryDeliverables'\r\n\r\n/**\r\n * The second key: which skills this session actually loaded (the host's `skill`\r\n * tool, read off `tool/call.arguments`). Namespaced for the same reason as\r\n * {@link DELIVERABLES_KEY} — the registry hard-fails on a shared key with a\r\n * differing `stateVersion`, so a future host-side skill unit must not be able\r\n * to collide silently.\r\n */\r\nexport const SKILL_USAGE_KEY = 'dshSummarySkillUsage'\r\n\r\n/**\r\n * The search-reference key (queries and returned sources of this session's\r\n * web searches — the plugin's `advanced_search` and the harness's `web_search`).\r\n * Same rule as above: the name is ours, so no other host-side unit can answer\r\n * for it by accident.\r\n */\r\nexport const SEARCH_REFS_KEY = 'dshSummarySearchRefs'\r\n\r\n/** Client view of the produced-file fold (JSON-safe). */\r\nexport interface DeliverablesView {\r\n /** Paths produced in the latest turn, first-seen order (capped). */\r\n readonly latest: {\r\n readonly turn: number\r\n readonly paths: readonly string[]\r\n } | null\r\n /** Distinct produced paths session-wide, most-recent-first (capped). */\r\n readonly sessionPaths: readonly string[]\r\n /** Distinct produced paths session-wide, uncapped — the truthful total. */\r\n readonly sessionTotal: number\r\n}\r\n\r\n/** One loaded skill in the wire view. */\r\nexport interface SkillUsageEntryView {\r\n /** The skill name exactly as the model passed it to the `skill` tool. */\r\n readonly name: string\r\n /** Successful loads of this skill this session. */\r\n readonly count: number\r\n /** Turn whose call last advanced this tally. */\r\n readonly lastTurn: number\r\n}\r\n\r\n/** Client view of the skill-usage fold (JSON-safe). */\r\nexport interface SkillUsageView {\r\n /** Skills referenced in the latest turn; `null` before the first `turn/start`. */\r\n readonly latest: { readonly turn: number; readonly names: readonly string[] } | null\r\n /** Distinct referenced skills, most recently used first (capped). */\r\n readonly session: readonly SkillUsageEntryView[]\r\n /** Distinct referenced skills session-wide — may exceed `session.length`. */\r\n readonly sessionTotal: number\r\n /** Successful references session-wide, both channels included. */\r\n readonly callTotal: number\r\n /**\r\n * The skills this session was OFFERED, per its latest catalog frame (capped).\r\n * Available is not referenced: the model may never use any of these.\r\n */\r\n readonly available: readonly string[]\r\n /** How many entries that frame published — may exceed `available.length`. */\r\n readonly availableCount: number\r\n}\r\n\r\n/** One external source a search brought back (wire view). */\r\nexport interface SearchRefItemView {\r\n /** The URL as published (host case and trailing slash normalised). */\r\n readonly url: string\r\n readonly host: string\r\n readonly title?: string\r\n /** Provider snippet, capped by the fold. */\r\n readonly snippet?: string\r\n /** Every query that surfaced it (newest first) — what the clusters key on. */\r\n readonly queries: readonly string[]\r\n /** Which tool answered: the plugin's `advanced_search` or the host's `web_search`. */\r\n readonly tool: string\r\n /** Settled searches that surfaced this source. */\r\n readonly count: number\r\n readonly lastTurn: number\r\n}\r\n\r\n/** One query the session ran, with how many sources it returned. */\r\nexport interface SearchQueryView {\r\n readonly query: string\r\n /** `advanced_search` (plugin) or `web_search` (harness). */\r\n readonly tool: string\r\n readonly turn: number\r\n readonly hits: number\r\n}\r\n\r\n/** Client view of the search-reference fold (JSON-safe). */\r\nexport interface SearchRefView {\r\n /** Normalised URL keys surfaced in the latest turn; `null` before the first turn. */\r\n readonly latest: { readonly turn: number; readonly urls: readonly string[] } | null\r\n /** Distinct queries, most recent first (capped). */\r\n readonly queries: readonly SearchQueryView[]\r\n /** Distinct sources, most recent first (capped). */\r\n readonly sources: readonly SearchRefItemView[]\r\n /** Distinct queries session-wide — may exceed `queries.length`. */\r\n readonly queryTotal: number\r\n /** Distinct sources session-wide — may exceed `sources.length`. */\r\n readonly sourceTotal: number\r\n}\r\n","/**\r\n * Opening a produced file's preview in the right Sidebar — the same channel\r\n * the conversation flow uses for its produced-file chips and inline mentions\r\n * (ui-chat `openFile` → `ctx.sidebarRight.openResource` with a\r\n * `dsh-resource://file/…` address).\r\n *\r\n * The address grammar is ported verbatim from the harness's browser-safe\r\n * `@deepseek-ai/dsh-util-workspace-path` (`file-address.ts` / `index.ts`),\r\n * because the plugin does not compile against that package: a relative path,\r\n * or an absolute path inside the session's workspace, is addressed under the\r\n * session's scope (`dsh-resource://file/session/<id>/<path>`); an absolute\r\n * path elsewhere keeps its absolute spelling in the same session's address.\r\n * Which tab type claims the address is the Sidebar's decision, not ours.\r\n *\r\n * The `sidebarRight` service is consumed structurally and treated as OPTIONAL:\r\n * where it is absent the section renders plain rows instead of links, the same\r\n * graceful degradation as the deliverables projection itself.\r\n */\r\nimport type { CtxProbe } from './use-projection'\r\n\r\n/** Structural view of the right-Sidebar service this plugin needs. */\r\nexport interface SidebarRightLike {\r\n openResource(url: string, options?: { params?: { line?: number } }): void\r\n}\r\n\r\n/** Structural view of the sessions service slice the opener reads. */\r\ninterface SessionsListLike {\r\n list?: { getSnapshot(): { byId?: Record<string, { cwd?: string }> } }\r\n}\r\n\r\n/** The address scheme every file resource opens with. */\r\nconst FILE_ADDRESS_PREFIX = 'dsh-resource://file/'\r\n\r\n/** Whether a path uses a Windows drive or UNC prefix. */\r\nfunction isWindowsStylePath(value: string): boolean {\r\n return /^[A-Za-z]:[/\\\\]/.test(value) || value.startsWith('\\\\\\\\')\r\n}\r\n\r\n/**\r\n * Whether a path is absolute in either spelling the Host accepts: POSIX (`/a/b`)\r\n * or Windows drive or UNC.\r\n */\r\nexport function isAbsoluteWorkspacePath(path: string): boolean {\r\n return path.startsWith('/') || isWindowsStylePath(path)\r\n}\r\n\r\n/** Component-encode one id or path segment, keeping `:` literal for drive letters. */\r\nfunction encodeSegment(segment: string): string {\r\n return encodeURIComponent(segment).replace(/%3A/gi, ':')\r\n}\r\n\r\n/** Encode a `/`-separated path segment by segment. */\r\nfunction encodePath(path: string): string {\r\n return path.split('/').map(encodeSegment).join('/')\r\n}\r\n\r\n/**\r\n * Build the address of a file read through one Session.\r\n * @param sessionId - the Session whose Host workspace resolves the path.\r\n * @param path - absolute or workspace-relative path; backslashes are normalized\r\n * to `/`, and leading `./` prefixes are dropped.\r\n */\r\nfunction sessionFileAddress(sessionId: string, path: string): string {\r\n const normalized = path.replace(/\\\\/g, '/').replace(/^(?:\\.\\/)+/, '')\r\n return `${FILE_ADDRESS_PREFIX}session/${encodeSegment(sessionId)}/${encodePath(normalized)}`\r\n}\r\n\r\n/**\r\n * The address for a path as a caller holds it.\r\n * @param sessionId - the Session the path is read in.\r\n * @param cwd - that Session's workspace root, when known.\r\n * @param path - absolute or workspace-relative path, in either separator spelling.\r\n */\r\nexport function fileAddressFor(sessionId: string, cwd: string | undefined, path: string): string {\r\n const normalized = path.replace(/\\\\/g, '/')\r\n if (!isAbsoluteWorkspacePath(normalized)) return sessionFileAddress(sessionId, normalized)\r\n const root = cwd === undefined ? '' : cwd.replace(/\\\\/g, '/').replace(/\\/+$/, '')\r\n if (root !== '' && normalized === root) return sessionFileAddress(sessionId, '')\r\n if (root !== '' && normalized.startsWith(`${root}/`)) {\r\n return sessionFileAddress(sessionId, normalized.slice(root.length + 1))\r\n }\r\n return sessionFileAddress(sessionId, normalized)\r\n}\r\n\r\n/**\r\n * Build a sidebar file opener for one session, or `undefined` when the\r\n * environment cannot open previews (no `sidebarRight` service, no session).\r\n * The cwd is re-read per call inside the opener, so a workspace switch between\r\n * renders is picked up on the next click.\r\n *\r\n * @param ctx - the client root context.\r\n * @param sessionId - the session whose workspace resolves paths.\r\n * @returns an opener that routes a produced path to the Sidebar preview.\r\n */\r\nexport function sidebarFileOpener(\r\n ctx: CtxProbe | undefined,\r\n sessionId: string | undefined,\r\n): ((path: string) => void) | undefined {\r\n if (ctx === undefined || sessionId === undefined) return undefined\r\n const bar = ctx.get('sidebarRight') as SidebarRightLike | undefined\r\n if (bar === undefined || typeof bar.openResource !== 'function') return undefined\r\n\r\n return (path: string) => {\r\n const sessions = ctx.get('sessions') as SessionsListLike | undefined\r\n const cwd = sessions?.list?.getSnapshot?.().byId?.[sessionId]?.cwd\r\n bar.openResource(fileAddressFor(sessionId, cwd, path))\r\n }\r\n}\r\n","/**\r\n * The `dshSummaryDeliverables` projection — reading and classifying it.\r\n *\r\n * The Host computes this projection (this plugin's own node half registers the\r\n * unit) and pushes finished whole values; the client never folds it. This\r\n * module is the read side of that contract and is deliberately PURE — no\r\n * React, no context, no IO — so the narrowing and the codeplan classification\r\n * can be tested directly.\r\n */\r\nimport type { DeliverablesView } from '../../projection/keys'\r\n\r\n/**\r\n * Narrow a raw projection value into a deliverables view.\r\n *\r\n * Two outcomes are kept apart on purpose, mirroring the store's contract:\r\n * - `undefined` — the capability is ABSENT (the host half never registered —\r\n * e.g. an older composition — or no frame carried the key yet);\r\n * - a view — the projection is live. A view with `latest: null` and\r\n * `sessionTotal: 0` IS the empty state; the fold starts publishing as soon\r\n * as the unit registers, so \"present but empty\" is a real value here, not a\r\n * sentinel.\r\n *\r\n * @param value - the raw `unknown` snapshot of the deliverables face.\r\n * @returns the validated view, or `undefined` when the capability is absent.\r\n */\r\nexport function readDeliverables(value: unknown): DeliverablesView | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as { latest?: unknown; sessionPaths?: unknown; sessionTotal?: unknown }\r\n if (raw.latest === undefined || raw.sessionPaths === undefined || raw.sessionTotal === undefined) {\r\n return undefined\r\n }\r\n if (!isBucket(raw.latest) || !Array.isArray(raw.sessionPaths) || typeof raw.sessionTotal !== 'number') {\r\n return undefined\r\n }\r\n const paths = raw.sessionPaths.filter((path): path is string => typeof path === 'string')\r\n return {\r\n latest: raw.latest === null ? null : { turn: raw.latest.turn, paths: raw.latest.paths },\r\n sessionPaths: paths,\r\n sessionTotal: raw.sessionTotal,\r\n }\r\n}\r\n\r\n/** Whether a value is a well-formed latest-turn bucket (or explicitly null). */\r\nfunction isBucket(value: unknown): value is { turn: number; paths: readonly string[] } | null {\r\n if (value === null) return true\r\n if (typeof value !== 'object') return false\r\n const bucket = value as { turn?: unknown; paths?: unknown }\r\n return typeof bucket.turn === 'number' && Array.isArray(bucket.paths)\r\n}\r\n\r\n/**\r\n * The path prefix that identifies a codeplan artifact. The codeplan skill\r\n * writes its four fixed artifacts under `$workspace\\.agents\\plans\\<任务名>\\`;\r\n * produced paths may spell the separators either way.\r\n */\r\nconst CODEPLAN_SEGMENT = '.agents/plans/'\r\n\r\n/**\r\n * Normalize path separators so one spelling of the codeplan prefix matches.\r\n * Only classification uses this; the displayed path keeps the tool's exact\r\n * spelling.\r\n */\r\nfunction normalized(path: string): string {\r\n return path.replaceAll('\\\\', '/')\r\n}\r\n\r\n/** Whether a produced path is a codeplan artifact. */\r\nexport function isCodeplanPath(path: string): boolean {\r\n return normalized(path).includes(CODEPLAN_SEGMENT)\r\n}\r\n\r\n/**\r\n * Split a codeplan path into its task name and file name.\r\n *\r\n * @param path - a produced path; need not actually be a codeplan artifact.\r\n * @returns task and file names, or `null` when the path is not under the\r\n * codeplan plans directory (or names no file beneath the task folder).\r\n */\r\nexport function splitCodeplanPath(path: string): { task: string; file: string } | null {\r\n const marker = normalized(path).indexOf(CODEPLAN_SEGMENT)\r\n if (marker < 0) return null\r\n const rest = normalized(path).slice(marker + CODEPLAN_SEGMENT.length)\r\n const slash = rest.indexOf('/')\r\n if (slash <= 0 || slash === rest.length - 1) return null\r\n return { task: rest.slice(0, slash), file: rest.slice(slash + 1) }\r\n}\r\n\r\n/** The final path segment, under either separator. */\r\nexport function basename(path: string): string {\r\n const normalizedPath = normalized(path)\r\n const slash = normalizedPath.lastIndexOf('/')\r\n return slash < 0 ? normalizedPath : normalizedPath.slice(slash + 1)\r\n}\r\n\r\n/**\r\n * 历史文件 = 全会话去重路径 − 本回合活跃路径。\r\n *\r\n * 分隔符归一化后比较(`a\\b` 与 `a/b` 视为同一路径),保持 sessionPaths 自带的\r\n * \"最近在前\"顺序;活跃路径一个都不出现——分层契约:活跃的已在上方列表里,\r\n * 折叠区只收\"更早改过的文件\"。\r\n */\r\nexport function historyPaths(sessionPaths: readonly string[], latestPaths: readonly string[]): string[] {\r\n const active = new Set(latestPaths.map(normalized))\r\n return sessionPaths.filter((path) => !active.has(normalized(path)))\r\n}\r\n","/**\r\n * The two group chrome pieces the summary sections share: a counted group\r\n * title, and the toggle that folds a group away.\r\n *\r\n * Extracted because the deliverables section (本回合 / 更早改动) and the recall\r\n * section (活跃召回 / 其余历史召回) now fold a history group the same way. Two\r\n * private copies of the same button would drift the first time either section\r\n * touches padding — and the whole point of the split is that a reader can tell\r\n * \"what is live now\" from \"what the session also contains\" without learning a\r\n * different layout per section.\r\n *\r\n * Colours come from `--dsw-alias-*` tokens only (skin contract, enforced by\r\n * `tests/purity.spec.ts`).\r\n */\r\nimport { createElement } from 'react'\r\nimport type { CSSProperties, ReactNode } from 'react'\r\n\r\n/** Section-level title under the section header: quieter, same left gutter. */\r\nconst GROUP_HEADER_STYLE: CSSProperties = {\r\n padding: '8px 12px 0',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 11,\r\n fontWeight: 600,\r\n}\r\n\r\n/** The fold switch: full-width hit area, tertiary text, chevron at the end. */\r\nconst TOGGLE_STYLE: CSSProperties = {\r\n background: 'none',\r\n border: 'none',\r\n font: 'inherit',\r\n fontSize: 12,\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n cursor: 'pointer',\r\n display: 'flex',\r\n alignItems: 'center',\r\n gap: 4,\r\n padding: '6px 12px',\r\n textAlign: 'left',\r\n width: 'calc(100% - 24px)',\r\n}\r\n\r\n/** The note beside a folded group (e.g. how many the capped list left out). */\r\nconst CAPTION_STYLE: CSSProperties = {\r\n padding: '0 12px 6px',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 11,\r\n lineHeight: '16px',\r\n}\r\n\r\nconst CHEVRON_STYLE = (open: boolean): CSSProperties => ({\r\n flexShrink: 0,\r\n transition: 'transform 0.16s',\r\n transform: open ? 'rotate(180deg)' : 'none',\r\n})\r\n\r\n/**\r\n * A counted group title. Renders nothing when the group is empty — an empty\r\n * \"活跃召回 · 0\" line would ask the reader to explain a heading rather than read\r\n * a fact.\r\n * @param props - already-interpolated text, plus an optional DOM marker.\r\n */\r\nexport function GroupHeader(props: { text: string; marker?: string }): ReactNode {\r\n if (props.text.length === 0) return null\r\n return createElement(\r\n 'div',\r\n {\r\n style: GROUP_HEADER_STYLE,\r\n 'data-dsh-brief-sidebar': props.marker ?? 'group-header',\r\n },\r\n props.text,\r\n )\r\n}\r\n\r\n/**\r\n * The fold switch. `marker` is what tests (and the browser probe) click, so it\r\n * belongs to the component rather than to either caller's markup.\r\n * @param props - label, current state, DOM marker, click handler.\r\n */\r\nexport function FoldToggle(props: {\r\n label: string\r\n open: boolean\r\n marker: string\r\n onToggle(): void\r\n}): ReactNode {\r\n const { label, open, marker } = props\r\n return createElement(\r\n 'button',\r\n {\r\n type: 'button',\r\n 'aria-expanded': open,\r\n style: TOGGLE_STYLE,\r\n 'data-dsh-brief-sidebar': marker,\r\n onClick: () => { props.onToggle() },\r\n },\r\n label,\r\n createElement(\r\n 'svg',\r\n { width: 10, height: 10, viewBox: '0 0 16 16', 'aria-hidden': true, style: CHEVRON_STYLE(open) },\r\n createElement('path', {\r\n d: 'M4 6l4 4 4-4',\r\n fill: 'none',\r\n stroke: 'currentColor',\r\n strokeWidth: 1.5,\r\n strokeLinecap: 'round',\r\n strokeLinejoin: 'round',\r\n }),\r\n ),\r\n )\r\n}\r\n\r\n/** A quiet caption under a group, used for the \"the list is capped\" note. */\r\nexport function GroupCaption(props: { text: string; marker: string }): ReactNode {\r\n return createElement('div', { style: CAPTION_STYLE, 'data-dsh-brief-sidebar': props.marker }, props.text)\r\n}\r\n","/**\n * Plugin-owned i18n dictionaries.\n *\n * Consumer plugins must NOT reach into better-sidebar's internal `t()` or its\n * `betterSidebar` dictionary namespace, so this plugin registers its own\n * namespace through the DSH `locale` service. `dsh-brief-sidebar` is outside the\n * `LocaleNamespaceMap` merge table, which is exactly what the untyped\n * `register(ns, dicts)` overload is for — but the dictionaries themselves stay\n * strictly paired: `zh` is the key-set source of truth and every other language\n * (`en`, plus the fr/de/it/ru/es pack) is typed as\n * `Record<keyof typeof zh, string>`, so a missing or extra key is a COMPILE\n * error rather than a runtime fallback to the raw key.\n *\n * Every key referenced anywhere in `src/**` must exist in both dictionaries;\n * `tests/purity.spec.ts` asserts that, so a typo in a `t('…')` call cannot\n * ship as an untranslated literal.\n */\n\n/** The namespace owned by this plugin (own vocabulary, own lifecycle). */\nexport const NS = 'dsh-brief-sidebar'\n\n/** Simplified Chinese dictionary — the key-set source of truth. */\nexport const zh = {\n 'tab.title': '概要',\n 'tab.desc': '当前会话的任务、产物与规划文件(只读)',\n 'section.progress': '进展',\n 'section.deliverables': '产物',\n 'board.empty': '当前没有任务',\n 'board.emptyHint': '模型调用 todo_write 之后,任务会出现在这里。',\n 'board.unavailable': '任务暂不可用',\n 'board.unavailableHint': '这个会话还没有收到 todo 数据;宿主推来第一帧后会自动显示。',\n 'status.pending': '待处理',\n 'status.inProgress': '进行中',\n 'status.completed': '已完成',\n 'deliverables.empty': '本回合暂无改动文件',\n 'deliverables.emptyHint': '会话里成功写入或修改文件后,它们会实时出现在这里。',\n 'deliverables.history': '更早改动的文件 · {count}',\n 'deliverables.historyMore': '还有 {count} 条',\n 'deliverables.currentTurn': '本回合改动 · {count}',\n 'deliverables.historyCapped': '(会话共 {total} 个文件,列表已截断)',\n 'deliverable.codeplanTag': '规划',\n 'section.memorySlots': '记忆',\n 'slots.empty': '当前没有激活的记忆槽位',\n 'slots.emptyHint': '当 dsh-prime-memory 激活记忆槽位后,它们会实时出现在这里。',\n 'slots.openCount': '开启 {count} 个槽位',\n 'slots.viewMemory': '查看',\n 'slots.status.open': '生效中',\n 'slots.status.done': '已完成',\n 'slots.status.dropped': '已弃置',\n 'slots.status.expired': '已过期',\n 'section.memoryRecall': '本会话召回',\n 'recall.empty': '本会话还没有召回到记忆',\n 'recall.count': '注入 {count} 条 · 被摘要取代的已折叠(清空会话才清除)',\n 'recall.rateHint': '点选一条后可标注:0–5 相关度;-1 声明过时并退场(可恢复)',\n 'recall.obsolete': '声明过时',\n 'recall.obsoleteConfirm': '确认退场?',\n 'recall.obsoleted': '已判过时',\n 'recall.rated': '已评 {count} 分',\n 'recall.failed': '标注失败:',\n 'recall.obsoleteWhy': '声明过时后,该记忆退场(可恢复),下一轮会告知模型',\n 'recall.viewDetail': '查看详情',\n 'recall.strikeHint': ';判过时的条目会一直保留在列表里并划上删除线(清空会话才移除)',\n 'recall.supersededHidden': '已隐藏 {count} 条被摘要取代的旧召回(正文已不在上下文)',\n 'recall.activeGroup': '活跃召回 · {count}',\n 'recall.historyGroup': '其余历史召回 · {count}',\n 'recall.supersededTag': '已被摘要取代',\n 'recall.noBody': '(本帧没有这条记忆的全文)',\n 'section.skillUsage': '技能引用',\n 'section.references': '引用',\n 'references.tabSkills': '技能',\n 'references.tabMemory': '记忆',\n 'skillUsage.empty': '本会话还没载入过技能',\n 'skillUsage.emptyHint': '模型用 skill 工具载入、或你直接点用某个技能后,技能名会实时出现在这里。',\n 'skillUsage.uses': '{count} 次',\n 'skillUsage.count': '载入 {count} 次 · {total} 个技能',\n 'skillUsage.latestTag': '本轮',\n 'skillUsage.invokedGroup': '已引用 · {count}',\n 'skillUsage.availableGroup': '本会话可用 · {count}',\n 'skillUsage.availableCapped': '(可用清单共 {count} 条,列表已截断)',\n 'section.searchRefs': '搜索引用',\n 'references.tabSearch': '搜索',\n 'references.tabEcho': '回响',\n 'searchRefs.empty': '本会话还没搜索过',\n 'searchRefs.emptyHint': '模型调用 web_search 或 advanced_search 之后,查询与取回的来源会实时出现在这里。',\n 'searchRefs.queryGroup': '查询 · {count}',\n 'searchRefs.sourceGroup': '来源 · {count}',\n 'searchRefs.hits': '返回 {count} 条',\n 'searchRefs.latestTag': '本轮',\n 'searchRefs.noSourcesHint': '(该版本未回传来源清单,升级 dsh-free-search 后可见)',\n 'searchRefs.capped': '(会话共 {total} 条,列表已截断)',\n 'settings.title': '概要侧栏',\n 'settings.desc': '右侧栏概要 tab 的分区开关(只读展示)。',\n 'settings.memorySlots': '记忆槽位分区',\n 'settings.memorySlotsHint': '开启后,概要 tab 在进展与产物之下显示 dsh-prime-memory 的激活记忆槽位(只读)。',\n 'settings.memoryRecall': '本会话召回分区',\n 'settings.memoryRecallHint': '开启后,概要 tab 显示本会话已注入的记忆,并可标注相关度(0–5;-1 声明过时并退场)。被摘要取代的条目会自动折叠。',\n 'settings.spiritEcho': '回响页签',\n 'settings.spiritEchoHint': '开启后,「引用」内保留「回响」页签,列出本会话被 dsh-spirit 召回的回响条目与段落(落库,重启后仍在)。关掉则整个页签不出现。',\n 'settings.unavailable': '配置面不可用,记忆分区按默认「开」处理。',\n 'settings.readonly': '当前配置只读,无法在此修改。',\n 'section.spiritEcho': '回响',\n 'echo.segmentCount': '本会话 {count} 段回响',\n 'echo.stepCount': '本会话 {count} 条回响',\n 'echo.openOriginal': '查看原文',\n 'echo.skippedSummary': '另有 {count} 轮未注入({reasons})',\n 'echo.injectedEmpty': '(无摘要)',\n 'echo.totalHint': '本会话共 {count} 段(跨重启保留)',\n 'echo.latest': '最近:',\n 'echo.lastStep': '上一轮:',\n 'echo.injected': '注入',\n 'echo.skipped': '跳过',\n 'echo.empty': '本会话还没有被召回的回响段',\n 'echo.emptyHint': 'spirit 注入时会带回被勾起的旧片段,这里会列出本会话召回过的段落。',\n 'echo.goto': '条目 →',\n 'echo.gotoGraph': '星图 →',\n 'echo.gotoFail': '打开回响失败',\n 'echo.viewMenu': '查看',\n 'memoryView.button': '详细展示',\n 'memoryView.preview': '速览',\n 'memoryView.entry': '条目',\n 'memoryView.graph2d': '2D 图',\n 'memoryView.graph3d': '3D 图',\n 'memoryView.failAbsent': '记忆库不可用(未安装 dsh-prime-memory)',\n 'memoryView.failDisabled': '记忆库入口已在记忆设置中关闭',\n 'memoryView.failUnmounted': '当前宿主未挂载记忆库整页',\n 'memoryView.failUnregistered': '宿主未注册记忆库页面',\n}\n\n/** The key union: what a `t('…')` call may name inside this namespace. */\nexport type BriefKey = keyof typeof zh\n\n/** English dictionary, checked complete against the zh key set. */\nexport const en: Record<BriefKey, string> = {\n 'tab.title': 'Summary',\n 'tab.desc': 'Tasks, produced files and plan artifacts of this session (read-only)',\n 'section.progress': 'Progress',\n 'section.deliverables': 'Produced files',\n 'board.empty': 'No tasks yet',\n 'board.emptyHint': 'Tasks show up here once the model calls todo_write.',\n 'board.unavailable': 'Tasks unavailable',\n 'board.unavailableHint':\n 'This session has not received any todo data yet; the board fills in on the first frame.',\n 'status.pending': 'Pending',\n 'status.inProgress': 'In progress',\n 'status.completed': 'Done',\n 'deliverables.empty': 'No files changed in this turn',\n 'deliverables.emptyHint': 'Files written or edited successfully in the session appear here live.',\n 'deliverables.history': 'Earlier changes · {count}',\n 'deliverables.historyMore': '{count} more',\n 'deliverables.currentTurn': 'This turn · {count}',\n 'deliverables.historyCapped': '(the session produced {total} files; the list is capped)',\n 'deliverable.codeplanTag': 'Plan',\n 'section.memorySlots': 'Memory',\n 'slots.empty': 'No active memory slots',\n 'slots.emptyHint': 'Slots appear here live once dsh-prime-memory activates them.',\n 'slots.openCount': '{count} slots open',\n 'slots.viewMemory': 'View',\n 'slots.status.open': 'Open',\n 'slots.status.done': 'Done',\n 'slots.status.dropped': 'Dropped',\n 'slots.status.expired': 'Expired',\n 'section.memoryRecall': 'Session recall',\n 'recall.empty': 'No memories recalled in this session yet',\n 'recall.count': '{count} injected · superseded ones folded after compaction (cleared only on /clear)',\n 'recall.rateHint': 'Select a memory to mark it: 0–5 relevance; -1 declares it obsolete and retires it (restorable).',\n 'recall.obsolete': 'Obsolete',\n 'recall.obsoleteConfirm': 'Retire it?',\n 'recall.obsoleted': 'Marked obsolete',\n 'recall.rated': 'Rated {count}/5',\n 'recall.failed': 'Mark failed: ',\n 'recall.obsoleteWhy': 'Declaring it obsolete retires the record (restorable) and tells the model next turn',\n 'recall.viewDetail': 'View',\n 'recall.strikeHint': '; an entry you mark obsolete stays listed, struck through (removed only when you clear the session)',\n 'recall.supersededHidden': '{count} older recalls hidden — their text was replaced by a summary',\n 'recall.activeGroup': 'Active recalls · {count}',\n 'recall.historyGroup': 'Earlier recalls · {count}',\n 'recall.supersededTag': 'replaced by summary',\n 'recall.noBody': '(this frame carries no full body for this record)',\n 'section.skillUsage': 'Skill references',\n 'section.references': 'References',\n 'references.tabSkills': 'Skills',\n 'references.tabMemory': 'Memory',\n 'skillUsage.empty': 'No skills loaded in this session',\n 'skillUsage.emptyHint': 'Skills show up here once the model loads one with the `skill` tool, or you invoke one directly.',\n 'skillUsage.uses': '{count}x',\n 'skillUsage.count': '{count} loads - {total} skills',\n 'skillUsage.latestTag': 'this turn',\n 'skillUsage.invokedGroup': 'Referenced · {count}',\n 'skillUsage.availableGroup': 'Available this session · {count}',\n 'skillUsage.availableCapped': '({count} skills in the catalog; the list is capped)',\n 'section.searchRefs': 'Web searches',\n 'references.tabSearch': 'Searches',\n 'references.tabEcho': 'Echo',\n 'searchRefs.empty': 'No searches in this session',\n 'searchRefs.emptyHint': 'Queries and the sources they returned appear here once the model calls web_search or advanced_search.',\n 'searchRefs.queryGroup': 'Queries · {count}',\n 'searchRefs.sourceGroup': 'Sources · {count}',\n 'searchRefs.hits': '{count} returned',\n 'searchRefs.latestTag': 'This turn',\n 'searchRefs.noSourcesHint': '(this dsh-free-search build returns no source list; upgrade to see sources)',\n 'searchRefs.capped': '({total} in the session; the list is capped)',\n 'settings.title': 'Brief sidebar',\n 'settings.desc': 'Section switches for the summary tab in the right sidebar (read-only views).',\n 'settings.memorySlots': 'Memory slots section',\n 'settings.memorySlotsHint': 'When on, the summary tab lists the active memory slots from dsh-prime-memory beneath progress and produced files (read-only).',\n 'settings.memoryRecall': 'Session recall section',\n 'settings.memoryRecallHint': 'When on, the Summary tab lists the memories injected this session and lets you rate them (0–5; -1 declares one obsolete and retires it). Entries a summary replaced are folded away.',\n 'settings.spiritEcho': 'Echo tab',\n 'settings.spiritEchoHint': 'When on, the reference pane keeps the Echo tab listing the echoed entries and recalled passages of this session (persisted across restarts). Off hides the tab entirely.',\n 'settings.unavailable': 'The config face is unavailable; the memory section falls back to its default (on).',\n 'settings.readonly': 'This config is read-only here; edits are not available.',\n 'section.spiritEcho': 'Echo',\n 'echo.segmentCount': '{count} recalled passages in this session',\n 'echo.stepCount': '{count} echo entries in this session',\n 'echo.openOriginal': 'Open original',\n 'echo.skippedSummary': '{count} rounds injected nothing ({reasons})',\n 'echo.injectedEmpty': '(no summary)',\n 'echo.totalHint': 'Passages in this session: {count} (kept across restarts)',\n 'echo.latest': 'Latest:',\n 'echo.lastStep': 'Last round:',\n 'echo.injected': 'injected',\n 'echo.skipped': 'skipped',\n 'echo.empty': 'No echo passage recalled in this session yet',\n 'echo.emptyHint': 'Passages that dsh-spirit recalled into this session will be listed here.',\n 'echo.goto': 'Entries →',\n 'echo.gotoGraph': 'Star map →',\n 'echo.gotoFail': 'Could not open the echo page',\n 'echo.viewMenu': 'View',\n 'memoryView.button': 'Details',\n 'memoryView.preview': 'Quick view',\n 'memoryView.entry': 'Entries',\n 'memoryView.graph2d': '2D graph',\n 'memoryView.graph3d': '3D graph',\n 'memoryView.failAbsent': 'Memory library unavailable (dsh-prime-memory is not installed)',\n 'memoryView.failDisabled': 'The memory library entry is disabled in memory settings',\n 'memoryView.failUnmounted': 'This host does not mount the memory library page',\n 'memoryView.failUnregistered': 'The host has not registered the memory library page',\n}\n\n/** Japanese dictionary, checked complete against the zh key set. */\nexport const ja: Record<BriefKey, string> = {\n 'tab.title': '概要',\n 'tab.desc': 'このセッションのタスク・成果物・計画ファイル(読み取り専用)',\n 'section.progress': '進行状況',\n 'section.deliverables': '成果物',\n 'board.empty': '現在タスクはありません',\n 'board.emptyHint': 'モデルが todo_write を呼び出すと、タスクがここに表示されます。',\n 'board.unavailable': 'タスクを利用できません',\n 'board.unavailableHint':\n 'このセッションはまだ todo データを受信していません。ホストが最初のフレームを送ると自動的に表示されます。',\n 'status.pending': '未対応',\n 'status.inProgress': '進行中',\n 'status.completed': '完了',\n 'deliverables.empty': 'このターンで変更されたファイルはありません',\n 'deliverables.emptyHint': 'セッションでファイルの書き込み・変更が成功すると、ここにリアルタイムで表示されます。',\n 'deliverables.history': '以前の変更 · {count}',\n 'deliverables.historyMore': 'ほか {count} 件',\n 'deliverables.currentTurn': 'このターン · {count}',\n 'deliverables.historyCapped': '(セッション全体で {total} ファイル、一覧は上限で省略)',\n 'deliverable.codeplanTag': '計画',\n 'section.memorySlots': 'メモリ',\n 'slots.empty': 'アクティブなメモリスロットはありません',\n 'slots.emptyHint': 'dsh-prime-memory がスロットをアクティブにすると、ここにリアルタイムで表示されます。',\n 'slots.openCount': '有効なスロット: {count} 件',\n 'slots.viewMemory': '表示',\n 'slots.status.open': '有効',\n 'slots.status.done': '完了',\n 'slots.status.dropped': '破棄',\n 'slots.status.expired': '期限切れ',\n 'section.memoryRecall': 'このセッションの想起',\n 'recall.empty': 'このセッションではまだ記憶を想起していません',\n 'recall.count': '{count} 件を注入 · 要約に置き換わった分は折りたたみ(/clear でのみ消去)',\n 'recall.rateHint': '行を選ぶと採点できます:0–5 関連度;-1 は「古い」と宣言して退場(復元可)。',\n 'recall.obsolete': '古いと宣言',\n 'recall.obsoleteConfirm': '退場させますか?',\n 'recall.obsoleted': '古いと判定済み',\n 'recall.rated': '{count} 点',\n 'recall.failed': '採点に失敗:',\n 'recall.obsoleteWhy': '古いと宣言すると記録は退場(復元可)、次のターンでモデルに伝わります',\n 'recall.viewDetail': '詳細',\n 'recall.strikeHint': ';古いと宣言した項目は取り消し線のまま一覧に保持されます(セッションをクリアすると消えます)',\n 'recall.supersededHidden': '要約に置き換わった旧召回 {count} 件を非表示(本文はコンテキストにない)',\n 'recall.activeGroup': 'アクティブな想起 · {count}',\n 'recall.historyGroup': 'その他の履歴想起 · {count}',\n 'recall.supersededTag': '要約に置換済み',\n 'recall.noBody': 'このフレームには全文が含まれていない',\n 'section.skillUsage': 'スキル参照',\n 'section.references': '参照',\n 'references.tabSkills': 'スキル',\n 'references.tabMemory': 'メモリ',\n 'skillUsage.empty': 'このセッションではスキルを読み込んでいません',\n 'skillUsage.emptyHint': 'モデルが skill ツールで読み込むか、あなたがスキルを直接起動すると、ここにリアルタイムで表示されます。',\n 'skillUsage.uses': '{count} 回',\n 'skillUsage.count': '読み込み {count} 回 · スキル {total} 件',\n 'skillUsage.latestTag': 'このターン',\n 'skillUsage.invokedGroup': '参照済み · {count}',\n 'skillUsage.availableGroup': 'このセッションで利用可能 · {count}',\n 'skillUsage.availableCapped': '(カタログは全 {count} 件、一覧は上限で省略)',\n 'section.searchRefs': 'Web 検索',\n 'references.tabSearch': '検索',\n 'references.tabEcho': '回響',\n 'searchRefs.empty': 'このセッションではまだ検索していません',\n 'searchRefs.emptyHint': 'モデルが web_search または advanced_search を呼び出すと、クエリと取得した出典がここに表示されます。',\n 'searchRefs.queryGroup': 'クエリ · {count}',\n 'searchRefs.sourceGroup': 'ソース · {count}',\n 'searchRefs.hits': '{count} 件返却',\n 'searchRefs.latestTag': '今回のターン',\n 'searchRefs.noSourcesHint': '(この dsh-free-search ビルドはソース一覧を返しません。アップグレードすると表示されます)',\n 'searchRefs.capped': '(セッション全体で {total} 件、一覧は上限で省略)',\n 'settings.title': '概要サイドバー',\n 'settings.desc': '右サイドバー概要タブのセクション表示切り替え(読み取り専用)。',\n 'settings.memorySlots': 'メモリスロットセクション',\n 'settings.memorySlotsHint': 'オンにすると、概要タブの進行状況と成果物の下に dsh-prime-memory のアクティブなメモリスロット(読み取り専用)が表示されます。',\n 'settings.memoryRecall': 'セッション想起のセクション',\n 'settings.memoryRecallHint': '有効にすると概要タブに本セッションで注入された記憶を表示し、関連度(0–5、-1 は陳腐化を宣言して退場)を付けられます。要約に置き換わった項目は自動で折りたたまれます。',\n 'settings.spiritEcho': '回想タブ',\n 'settings.spiritEchoHint': '有効にすると「引用」内に「回想」タブが残り、本セッションの回想エントリーと想起された断章を並べます(保存され、再起動後も残ります)。',\n 'settings.unavailable': '設定画面を利用できません。メモリセクションは既定(オン)で動作します。',\n 'settings.readonly': 'この設定はここでは読み取り専用のため変更できません。',\n 'section.spiritEcho': '回響',\n 'echo.segmentCount': '本セッション: {count} 件の回想',\n 'echo.stepCount': '本セッション: {count} 件のエコー',\n 'echo.openOriginal': '原文を開く',\n 'echo.skippedSummary': 'ほかに {count} 回は注入なし({reasons})',\n 'echo.injectedEmpty': '(摘要なし)',\n 'echo.totalHint': '本セッション合計 {count} 件(再起動後も保持)',\n 'echo.latest': '最新:',\n 'echo.lastStep': '前回:',\n 'echo.injected': '注入',\n 'echo.skipped': 'スキップ',\n 'echo.empty': 'このセッションで回想された断章はまだありません',\n 'echo.emptyHint': 'dsh-spirit が想起した断章がここに並びます。',\n 'echo.goto': '項目 →',\n 'echo.gotoGraph': '星図 →',\n 'echo.gotoFail': 'エコー画面を開けませんでした',\n 'echo.viewMenu': '表示',\n 'memoryView.button': '詳細表示',\n 'memoryView.preview': 'プレビュー',\n 'memoryView.entry': '項目',\n 'memoryView.graph2d': '2D 図',\n 'memoryView.graph3d': '3D 図',\n 'memoryView.failAbsent': 'メモリライブラリを利用できません(dsh-prime-memory 未インストール)',\n 'memoryView.failDisabled': 'メモリ設定でメモリライブラリ入口が無効です',\n 'memoryView.failUnmounted': 'このホストはメモリライブラリページをマウントしていません',\n 'memoryView.failUnregistered': 'ホストがメモリライブラリページを登録していません',\n}\n\n/** Korean dictionary, checked complete against the zh key set. */\nexport const ko: Record<BriefKey, string> = {\n 'tab.title': '요약',\n 'tab.desc': '현재 세션의 작업, 산출물 및 계획 파일(읽기 전용)',\n 'section.progress': '진행 상황',\n 'section.deliverables': '산출물',\n 'board.empty': '현재 작업이 없습니다',\n 'board.emptyHint': '모델이 todo_write를 호출하면 작업이 여기에 표시됩니다.',\n 'board.unavailable': '작업을 사용할 수 없습니다',\n 'board.unavailableHint':\n '이 세션은 아직 todo 데이터를 받지 못했습니다. 호스트가 첫 프레임을 보내면 자동으로 표시됩니다.',\n 'status.pending': '대기 중',\n 'status.inProgress': '진행 중',\n 'status.completed': '완료',\n 'deliverables.empty': '이번 턴에 변경된 파일이 없습니다',\n 'deliverables.emptyHint': '세션에서 파일을 성공적으로 작성하거나 수정하면 여기에 실시간으로 표시됩니다.',\n 'deliverables.history': '이전 변경 사항 · {count}',\n 'deliverables.historyMore': '외 {count}개',\n 'deliverables.currentTurn': '이번 턴 · {count}',\n 'deliverables.historyCapped': '(세션 전체 {total}개 파일, 목록은 잘림)',\n 'deliverable.codeplanTag': '계획',\n 'section.memorySlots': '메모리',\n 'slots.empty': '활성화된 메모리 슬롯이 없습니다',\n 'slots.emptyHint': 'dsh-prime-memory가 슬롯을 활성화하면 여기에 실시간으로 표시됩니다.',\n 'slots.openCount': '열린 슬롯: {count}개',\n 'slots.viewMemory': '보기',\n 'slots.status.open': '활성',\n 'slots.status.done': '완료',\n 'slots.status.dropped': '폐기',\n 'slots.status.expired': '만료',\n 'section.memoryRecall': '이 세션 회상',\n 'recall.empty': '이 세션에서는 아직 기억을 회상하지 않았습니다',\n 'recall.count': '{count}건 주입 · 요약으로 대체된 항목은 접힘(/clear 시에만 삭제)',\n 'recall.rateHint': '항목을 선택하면 평가할 수 있습니다: 0–5 관련도; -1은 오래된 것으로 선언하여 삭제(복원 가능).',\n 'recall.obsolete': '오래됨 선언',\n 'recall.obsoleteConfirm': '삭제할까요?',\n 'recall.obsoleted': '오래된 것으로 판정됨',\n 'recall.rated': '{count}점 평가됨',\n 'recall.failed': '평가 실패: ',\n 'recall.obsoleteWhy': '낡음으로 선언하면 기록이 퇴장하며(복원 가능), 다음 턴에서 모델에 알립니다',\n 'recall.viewDetail': '상세 보기',\n 'recall.strikeHint': ';낡음으로 선언한 항목은 취소선 상태로 목록에 계속 표시됩니다(세션을 비우면 제거)',\n 'recall.supersededHidden': '요약으로 대체된 이전 회수 {count}건 숨김(본문이 컨텍스트에 없음)',\n 'recall.activeGroup': '활성 회상 · {count}',\n 'recall.historyGroup': '나머지 이전 회상 · {count}',\n 'recall.supersededTag': '요약에 대체됨',\n 'recall.noBody': '이 프레임에는 이 기록의 전문이 없습니다',\n 'section.skillUsage': '스킬 참조',\n 'section.references': '참조',\n 'references.tabSkills': '스킬',\n 'references.tabMemory': '메모리',\n 'skillUsage.empty': '이 세션에서 스킬을 불러오지 않았습니다',\n 'skillUsage.emptyHint': '모델이 skill 도구로 불러오거나 당신이 스킬을 직접 실행하면 여기에 실시간으로 나타납니다.',\n 'skillUsage.uses': '{count}회',\n 'skillUsage.count': '불러오기 {count}회 · 스킬 {total}개',\n 'skillUsage.latestTag': '이 턴',\n 'skillUsage.invokedGroup': '참조됨 · {count}',\n 'skillUsage.availableGroup': '이 세션에서 사용 가능 · {count}',\n 'skillUsage.availableCapped': '(카탈로그 전체 {count}개, 목록은 잘림)',\n 'section.searchRefs': '웹 검색',\n 'references.tabSearch': '검색',\n 'references.tabEcho': '에코',\n 'searchRefs.empty': '이 세션에서는 아직 검색하지 않았습니다',\n 'searchRefs.emptyHint': '모델이 web_search 또는 advanced_search를 호출하면 쿼리와 가져온 출처가 여기에 표시됩니다.',\n 'searchRefs.queryGroup': '쿼리 · {count}',\n 'searchRefs.sourceGroup': '소스 · {count}',\n 'searchRefs.hits': '{count}件 반환',\n 'searchRefs.latestTag': '이번 턴',\n 'searchRefs.noSourcesHint': '(이 dsh-free-search 빌드는 소스 목록을 반환하지 않습니다. 업그레이드 필요)',\n 'searchRefs.capped': '(세션 전체 {total}건, 목록은 잘림)',\n 'settings.title': '요약 사이드바',\n 'settings.desc': '오른쪽 사이드바 요약 탭의 섹션 표시 전환(읽기 전용).',\n 'settings.memorySlots': '메모리 슬롯 섹션',\n 'settings.memorySlotsHint': '켜면 요약 탭의 진행 상황과 산출물 아래에 dsh-prime-memory의 활성 메모리 슬롯(읽기 전용)이 표시됩니다.',\n 'settings.memoryRecall': '세션 회상 섹션',\n 'settings.memoryRecallHint': '켜면 요약 탭에 이번 세션에서 주입된 기억을 표시하고 관련도(0–5, -1은 노후 선언 후 퇴장)를 매길 수 있습니다. 요약으로 대체된 항목은 자동으로 접힙니다.',\n 'settings.spiritEcho': '에코 탭',\n 'settings.spiritEchoHint': '켜면 「참조」 안에 「에코」 탭이 남아 이 세션의 에코 항목과 되살린 구절을 나열합니다(저장되어 재시작 후에도 남습니다).',\n 'settings.unavailable': '설정 화면을 사용할 수 없어 메모리 섹션은 기본값(켜짐)으로 동작합니다.',\n 'settings.readonly': '이 설정은 여기서 읽기 전용이므로 변경할 수 없습니다.',\n 'section.spiritEcho': '에코',\n 'echo.segmentCount': '이 세션: {count}개 회상',\n 'echo.stepCount': '이 세션: {count}건의 에코',\n 'echo.openOriginal': '원문 보기',\n 'echo.skippedSummary': '그 밖에 {count}회는 주입 없음({reasons})',\n 'echo.injectedEmpty': '(요약 없음)',\n 'echo.totalHint': '이 세션 총 {count}개(재시작 후에도 유지)',\n 'echo.latest': '최근:',\n 'echo.lastStep': '지난 회차:',\n 'echo.injected': '주입',\n 'echo.skipped': '건너뜀',\n 'echo.empty': '이 세션에서 회상된 구절이 아직 없습니다',\n 'echo.emptyHint': 'dsh-spirit 이 되살린 구절이 여기에 나열됩니다.',\n 'echo.goto': '항목 →',\n 'echo.gotoGraph': '성도 →',\n 'echo.gotoFail': '에코 화면을 열지 못했습니다',\n 'echo.viewMenu': '보기',\n 'memoryView.button': '상세 보기',\n 'memoryView.preview': '빠른 보기',\n 'memoryView.entry': '항목',\n 'memoryView.graph2d': '2D 그래프',\n 'memoryView.graph3d': '3D 그래프',\n 'memoryView.failAbsent': '메모리 라이브러리를 사용할 수 없습니다(dsh-prime-memory 미설치)',\n 'memoryView.failDisabled': '메모리 설정에서 메모리 라이브러리 입구가 꺼져 있습니다',\n 'memoryView.failUnmounted': '현재 호스트가 메모리 라이브러리 페이지를 마운트하지 않았습니다',\n 'memoryView.failUnregistered': '호스트가 메모리 라이브러리 페이지를 등록하지 않았습니다',\n}\n\n/** French dictionary, checked complete against the zh key set. */\nexport const fr: Record<BriefKey, string> = {\n 'tab.title': 'Résumé',\n 'tab.desc': 'Tâches, fichiers produits et plans de la session (lecture seule)',\n 'section.progress': 'Avancement',\n 'section.deliverables': 'Fichiers produits',\n 'board.empty': 'Aucune tâche pour le moment',\n 'board.emptyHint': 'Les tâches apparaissent ici dès que le modèle appelle todo_write.',\n 'board.unavailable': 'Tâches indisponibles',\n 'board.unavailableHint':\n 'Cette session n’a pas encore reçu de données todo ; le tableau se remplit dès la première trame.',\n 'status.pending': 'En attente',\n 'status.inProgress': 'En cours',\n 'status.completed': 'Terminé',\n 'deliverables.empty': 'Aucun fichier modifié à ce tour',\n 'deliverables.emptyHint': 'Les fichiers écrits ou modifiés dans la session apparaissent ici en direct.',\n 'deliverables.history': 'Modifications antérieures · {count}',\n 'deliverables.historyMore': '{count} de plus',\n 'deliverables.currentTurn': 'Ce tour-ci · {count}',\n 'deliverables.historyCapped': '(la session a produit {total} fichiers ; la liste est tronquée)',\n 'deliverable.codeplanTag': 'Plan',\n 'section.memorySlots': 'Mémoire',\n 'slots.empty': 'Aucun emplacement mémoire actif',\n 'slots.emptyHint': 'Les emplacements apparaissent ici en direct dès que dsh-prime-memory les active.',\n 'slots.openCount': '{count} emplacements ouverts',\n 'slots.viewMemory': 'Voir',\n 'slots.status.open': 'Actif',\n 'slots.status.done': 'Terminé',\n 'slots.status.dropped': 'Abandonné',\n 'slots.status.expired': 'Expiré',\n 'section.memoryRecall': 'Rappel de la session',\n 'recall.empty': 'Aucun souvenir rappelé dans cette session',\n 'recall.count': '{count} injectés · les remplacés par un résumé sont repliés après compression (effacés par /clear)',\n 'recall.rateHint': 'Sélectionnez un souvenir pour le noter : 0–5 pertinence ; -1 le déclare obsolète et le retire (récupérable).',\n 'recall.obsolete': 'Obsolète',\n 'recall.obsoleteConfirm': 'Le retirer ?',\n 'recall.obsoleted': 'Déclaré obsolète',\n 'recall.rated': 'Noté {count}/5',\n 'recall.failed': 'Échec de la note : ',\n 'recall.obsoleteWhy': 'Déclarer obsolète retire l’enregistrement (récupérable) et prévient le modèle au tour suivant',\n 'recall.viewDetail': 'Détails',\n 'recall.strikeHint': ' ; une entrée déclarée obsolète reste listée, barrée (retirée uniquement quand vous videz la session)',\n 'recall.supersededHidden': '{count} anciens rappels masqués — leur texte a été remplacé par un résumé',\n 'recall.activeGroup': 'Rappels actifs · {count}',\n 'recall.historyGroup': 'Rappels antérieurs · {count}',\n 'recall.supersededTag': 'remplacé par le résumé',\n 'recall.noBody': '(aucun texte complet pour cette entrée dans cette trame)',\n 'section.skillUsage': 'Références de compétences',\n 'section.references': 'Références',\n 'references.tabSkills': 'Compétences',\n 'references.tabMemory': 'Mémoire',\n 'skillUsage.empty': 'Aucune compétence chargée dans cette session',\n 'skillUsage.emptyHint': 'Les compétences apparaissent ici dès que le modèle en charge une via l’outil `skill`, ou quand vous en lancez une directement.',\n 'skillUsage.uses': '{count}×',\n 'skillUsage.count': '{count} chargements · {total} compétences',\n 'skillUsage.latestTag': 'ce tour',\n 'skillUsage.invokedGroup': 'Référencées · {count}',\n 'skillUsage.availableGroup': 'Disponibles dans cette session · {count}',\n 'skillUsage.availableCapped': '({count} compétences au catalogue ; la liste est tronquée)',\n 'section.searchRefs': 'Recherches web',\n 'references.tabSearch': 'Recherches',\n 'references.tabEcho': 'Écho',\n 'searchRefs.empty': 'Aucune recherche dans cette session',\n 'searchRefs.emptyHint': 'Les requêtes et les sources obtenues s’affichent ici dès que le modèle appelle web_search ou advanced_search.',\n 'searchRefs.queryGroup': 'Requêtes · {count}',\n 'searchRefs.sourceGroup': 'Sources · {count}',\n 'searchRefs.hits': '{count} renvoyées',\n 'searchRefs.latestTag': 'Ce tour-ci',\n 'searchRefs.noSourcesHint': '(cette version de dsh-free-search ne renvoie pas la liste des sources ; mettez à jour)',\n 'searchRefs.capped': '({total} dans la session ; la liste est tronquée)',\n 'settings.title': 'Barre latérale Résumé',\n 'settings.desc': 'Interrupteurs des sections de l’onglet Résumé de la barre latérale (lecture seule).',\n 'settings.memorySlots': 'Section des emplacements mémoire',\n 'settings.memorySlotsHint': 'Une fois activé, l’onglet Résumé liste les emplacements mémoire actifs de dsh-prime-memory sous l’avancement et les fichiers produits (lecture seule).',\n 'settings.memoryRecall': 'Section rappel de session',\n 'settings.memoryRecallHint': 'Actif, onglet Résumé : liste les souvenirs injectés dans cette session et permet de les noter (0–5 ; -1 déclare obsolète et retire). Les entrées remplacées par un résumé sont repliées.',\n 'settings.spiritEcho': 'Onglet Écho',\n 'settings.spiritEchoHint': \"Actif, le volet Références garde l'onglet Écho listant les entrées d'écho et les passages rappelés de cette session (conservés après redémarrage). Désactivé, l'onglet disparaît.\",\n 'settings.unavailable': 'Le canal de configuration est indisponible ; la section mémoire revient à sa valeur par défaut (activée).',\n 'settings.readonly': 'Cette configuration est en lecture seule ici ; aucune modification possible.',\n 'section.spiritEcho': 'Écho',\n 'echo.segmentCount': 'Cette session : {count} passages rappelés',\n 'echo.stepCount': \"Cette session : {count} entrées d'écho\",\n 'echo.openOriginal': \"Ouvrir l'original\",\n 'echo.skippedSummary': '{count} tours sans injection ({reasons})',\n 'echo.injectedEmpty': '(sans résumé)',\n 'echo.totalHint': 'Passages de cette session : {count} (conservés après redémarrage)',\n 'echo.latest': 'Dernier :',\n 'echo.lastStep': 'Tour précédent :',\n 'echo.injected': 'injecté',\n 'echo.skipped': 'ignoré',\n 'echo.empty': \"Aucun passage d'écho rappelé dans cette session\",\n 'echo.emptyHint': \"Les passages rappelés par dsh-spirit dans cette session s'afficheront ici.\",\n 'echo.goto': 'Entrées →',\n 'echo.gotoGraph': 'Carte stellaire →',\n 'echo.gotoFail': \"Impossible d'ouvrir l'écho\",\n 'echo.viewMenu': \"Voir\",\n 'memoryView.button': 'Détails',\n 'memoryView.preview': 'Aperçu',\n 'memoryView.entry': 'Entrées',\n 'memoryView.graph2d': 'Graphe 2D',\n 'memoryView.graph3d': 'Graphe 3D',\n 'memoryView.failAbsent': \"Bibliothèque mémoire indisponible (dsh-prime-memory n'est pas installé)\",\n 'memoryView.failDisabled': \"L'entrée de la bibliothèque mémoire est désactivée dans les réglages\",\n 'memoryView.failUnmounted': 'Cet hôte ne monte pas la page de la bibliothèque mémoire',\n 'memoryView.failUnregistered': \"L'hôte n'a pas enregistré la page de la bibliothèque mémoire\",\n}\n\n/** German dictionary, checked complete against the zh key set. */\nexport const de: Record<BriefKey, string> = {\n 'tab.title': 'Übersicht',\n 'tab.desc': 'Aufgaben, erzeugte Dateien und Pläne dieser Sitzung (schreibgeschützt)',\n 'section.progress': 'Fortschritt',\n 'section.deliverables': 'Erzeugte Dateien',\n 'board.empty': 'Noch keine Aufgaben',\n 'board.emptyHint': 'Aufgaben erscheinen hier, sobald das Modell todo_write aufruft.',\n 'board.unavailable': 'Aufgaben nicht verfügbar',\n 'board.unavailableHint':\n 'Diese Sitzung hat noch keine Todo-Daten erhalten; das Board füllt sich mit dem ersten Frame.',\n 'status.pending': 'Ausstehend',\n 'status.inProgress': 'In Bearbeitung',\n 'status.completed': 'Fertig',\n 'deliverables.empty': 'Keine Dateien in diesem Durchgang geändert',\n 'deliverables.emptyHint': 'In der Sitzung erfolgreich geschriebene oder geänderte Dateien erscheinen hier live.',\n 'deliverables.history': 'Frühere Änderungen · {count}',\n 'deliverables.historyMore': 'noch {count}',\n 'deliverables.currentTurn': 'Dieser Durchlauf · {count}',\n 'deliverables.historyCapped': '(die Sitzung erzeugte {total} Dateien; die Liste ist gekürzt)',\n 'deliverable.codeplanTag': 'Plan',\n 'section.memorySlots': 'Gedächtnis',\n 'slots.empty': 'Keine aktiven Speicherplätze',\n 'slots.emptyHint': 'Sobald dsh-prime-memory Slots aktiviert, erscheinen sie hier in Echtzeit.',\n 'slots.openCount': '{count} Slots offen',\n 'slots.viewMemory': 'Anzeigen',\n 'slots.status.open': 'Offen',\n 'slots.status.done': 'Erledigt',\n 'slots.status.dropped': 'Verworfen',\n 'slots.status.expired': 'Abgelaufen',\n 'section.memoryRecall': 'Sitzungserinnerung',\n 'recall.empty': 'In dieser Sitzung wurden noch keine Erinnerungen geholt',\n 'recall.count': '{count} eingefügt · die durch eine Zusammenfassung ersetzten sind nach der Komprimierung eingeklappt (bei /clear gelöscht)',\n 'recall.rateHint': 'Ein Eintrag auswählen zum Bewerten: 0–5 Relevanz; -1 erklärt ihn für veraltet und entfernt ihn (wiederherstellbar).',\n 'recall.obsolete': 'Veraltet',\n 'recall.obsoleteConfirm': 'Entfernen?',\n 'recall.obsoleted': 'Als veraltet markiert',\n 'recall.rated': 'Bewertet {count}/5',\n 'recall.failed': 'Bewertung fehlgeschlagen: ',\n 'recall.obsoleteWhy': 'Als veraltet erklären versetzt den Eintrag in den Ruhestand (wiederherstellbar) und informiert das Modell in der nächsten Runde',\n 'recall.viewDetail': 'Details',\n 'recall.strikeHint': '; ein als veraltet markierter Eintrag bleibt durchgestrichen in der Liste (erst beim Leeren der Sitzung entfernt)',\n 'recall.supersededHidden': '{count} ältere Treffer ausgeblendet — ihr Text wurde durch eine Zusammenfassung ersetzt',\n 'recall.activeGroup': 'Aktive Abrufe · {count}',\n 'recall.historyGroup': 'Weitere Abrufe · {count}',\n 'recall.supersededTag': 'durch Zusammenfassung ersetzt',\n 'recall.noBody': '(dieser Rahmen enthält keinen vollständigen Text für diesen Eintrag)',\n 'section.skillUsage': 'Skill-Referenzen',\n 'section.references': 'Referenzen',\n 'references.tabSkills': 'Skills',\n 'references.tabMemory': 'Speicher',\n 'skillUsage.empty': 'In dieser Sitzung wurden keine Skills geladen',\n 'skillUsage.emptyHint': 'Skills erscheinen hier, sobald das Modell einen über das `skill`-Tool lädt oder du einen direkt aufrufst.',\n 'skillUsage.uses': '{count}x',\n 'skillUsage.count': '{count} Ladungen · {total} Skills',\n 'skillUsage.latestTag': 'diese Runde',\n 'skillUsage.invokedGroup': 'Referenziert · {count}',\n 'skillUsage.availableGroup': 'In dieser Sitzung verfügbar · {count}',\n 'skillUsage.availableCapped': '({count} Skills im Katalog; die Liste ist gekürzt)',\n 'section.searchRefs': 'Websuchen',\n 'references.tabSearch': 'Suchen',\n 'references.tabEcho': 'Echo',\n 'searchRefs.empty': 'Keine Suchen in dieser Sitzung',\n 'searchRefs.emptyHint': 'Abfragen und die gelieferten Quellen erscheinen hier, sobald das Modell web_search oder advanced_search aufruft.',\n 'searchRefs.queryGroup': 'Abfragen · {count}',\n 'searchRefs.sourceGroup': 'Quellen · {count}',\n 'searchRefs.hits': '{count} zurückgegeben',\n 'searchRefs.latestTag': 'Dieser Durchlauf',\n 'searchRefs.noSourcesHint': '(dieser dsh-free-search-Build liefert keine Quellenliste; aktualisieren, um Quellen zu sehen)',\n 'searchRefs.capped': '({total} in der Sitzung; die Liste ist gekürzt)',\n 'settings.title': 'Übersicht-Seitenleiste',\n 'settings.desc': 'Schalter für die Abschnitte des Übersicht-Tabs in der rechten Seitenleiste (schreibgeschützt).',\n 'settings.memorySlots': 'Speicherplätze-Abschnitt',\n 'settings.memorySlotsHint': 'Ist der Schalter eingeschaltet, listet der Übersicht-Tab die aktiven Speicherplätze aus dsh-prime-memory unter Fortschritt und erzeugten Dateien auf (schreibgeschützt).',\n 'settings.memoryRecall': 'Bereich Sitzungserinnerung',\n 'settings.memoryRecallHint': 'Aktiv: Der Tab „Zusammenfassung“ listet die in dieser Sitzung eingefügten Erinnerungen und erlaubt Bewertungen (0–5; -1 erklärt für veraltet und entfernt). Durch eine Zusammenfassung ersetzte Einträge werden eingeklappt.',\n 'settings.spiritEcho': 'Echo-Tab',\n 'settings.spiritEchoHint': 'Aktiv bleibt im Bereich „Referenzen“ der Echo-Tab erhalten: Er listet die Echo-Einträge und erinnerten Passagen dieser Sitzung (bleiben nach Neustart). Aus: Tab verschwindet.',\n 'settings.unavailable': 'Die Konfigurationsoberfläche ist nicht verfügbar; der Gedächtnis-Abschnitt fällt auf den Standard (ein) zurück.',\n 'settings.readonly': 'Diese Konfiguration ist hier schreibgeschützt; Änderungen sind nicht möglich.',\n 'section.spiritEcho': 'Echo',\n 'echo.segmentCount': 'Diese Sitzung: {count} erinnerte Passagen',\n 'echo.stepCount': 'Diese Sitzung: {count} Echo-Einträge',\n 'echo.openOriginal': 'Original öffnen',\n 'echo.skippedSummary': '{count} Runden ohne Injektion ({reasons})',\n 'echo.injectedEmpty': '(keine Zusammenfassung)',\n 'echo.totalHint': 'Passagen dieser Sitzung: {count} (bleiben nach Neustart)',\n 'echo.latest': 'Zuletzt:',\n 'echo.lastStep': 'Letzte Runde:',\n 'echo.injected': 'injiziert',\n 'echo.skipped': 'übersprungen',\n 'echo.empty': 'Noch keine Echo-Passage in dieser Sitzung erinnert',\n 'echo.emptyHint': 'Was dsh-spirit in dieser Sitzung erinnert, erscheint hier.',\n 'echo.goto': 'Einträge →',\n 'echo.gotoGraph': 'Sternkarte →',\n 'echo.gotoFail': 'Echo-Seite konnte nicht geöffnet werden',\n 'echo.viewMenu': 'Ansehen',\n 'memoryView.button': 'Details',\n 'memoryView.preview': 'Vorschau',\n 'memoryView.entry': 'Einträge',\n 'memoryView.graph2d': '2D-Graph',\n 'memoryView.graph3d': '3D-Graph',\n 'memoryView.failAbsent': 'Speicherbibliothek nicht verfügbar (dsh-prime-memory ist nicht installiert)',\n 'memoryView.failDisabled': 'Der Eintrag der Speicherbibliothek ist in den Speichereinstellungen deaktiviert',\n 'memoryView.failUnmounted': 'Dieser Host bindet die Speicherbibliothek-Seite nicht ein',\n 'memoryView.failUnregistered': 'Der Host hat die Speicherbibliothek-Seite nicht registriert',\n}\n\n/** Italian dictionary, checked complete against the zh key set. */\nexport const it: Record<BriefKey, string> = {\n 'tab.title': 'Riepilogo',\n 'tab.desc': 'Attività, file prodotti e piani di questa sessione (sola lettura)',\n 'section.progress': 'Avanzamento',\n 'section.deliverables': 'File prodotti',\n 'board.empty': 'Nessuna attività per ora',\n 'board.emptyHint': 'Le attività appaiono qui quando il modello chiama todo_write.',\n 'board.unavailable': 'Attività non disponibili',\n 'board.unavailableHint':\n 'Questa sessione non ha ancora ricevuto dati todo; la bacheca si riempirà al primo frame.',\n 'status.pending': 'In attesa',\n 'status.inProgress': 'In corso',\n 'status.completed': 'Completato',\n 'deliverables.empty': 'Nessun file modificato in questo turno',\n 'deliverables.emptyHint': 'I file scritti o modificati nella sessione appaiono qui in tempo reale.',\n 'deliverables.history': 'Modifiche precedenti · {count}',\n 'deliverables.historyMore': 'altri {count}',\n 'deliverables.currentTurn': 'Questo turno · {count}',\n 'deliverables.historyCapped': '(la sessione ha prodotto {total} file; l’elenco è troncato)',\n 'deliverable.codeplanTag': 'Piano',\n 'section.memorySlots': 'Memoria',\n 'slots.empty': 'Nessuno slot di memoria attivo',\n 'slots.emptyHint': 'Gli slot appaiono qui in tempo reale quando dsh-prime-memory li attiva.',\n 'slots.openCount': '{count} slot aperti',\n 'slots.viewMemory': 'Vedi',\n 'slots.status.open': 'Attivo',\n 'slots.status.done': 'Completato',\n 'slots.status.dropped': 'Scartato',\n 'slots.status.expired': 'Scaduto',\n 'section.memoryRecall': 'Richiamo della sessione',\n 'recall.empty': 'Nessun ricordo richiamato in questa sessione',\n 'recall.count': '{count} inseriti · quelli sostituiti da un riassunto sono ripiegati dopo la compressione (rimossi con /clear)',\n 'recall.rateHint': 'Seleziona un ricordo per valutarlo: 0–5 pertinenza; -1 lo dichiara obsoleto e lo ritira (ripristinabile).',\n 'recall.obsolete': 'Obsoleto',\n 'recall.obsoleteConfirm': 'Ritirarlo?',\n 'recall.obsoleted': 'Dichiarato obsoleto',\n 'recall.rated': 'Valutato {count}/5',\n 'recall.failed': 'Valutazione non riuscita: ',\n 'recall.obsoleteWhy': 'Dichiararlo obsoleto congeda il record (ripristinabile) e avvisa il modello al turno successivo',\n 'recall.viewDetail': 'Dettagli',\n 'recall.strikeHint': '; una voce dichiarata obsoleta resta elencata, barrata (rimossa solo svuotando la sessione)',\n 'recall.supersededHidden': '{count} vecchi richiami nascosti — il testo è stato sostituito da un riassunto',\n 'recall.activeGroup': 'Richiami attivi · {count}',\n 'recall.historyGroup': 'Richiami precedenti · {count}',\n 'recall.supersededTag': 'sostituito dal riassunto',\n 'recall.noBody': '(questo frame non contiene il testo completo di questa voce)',\n 'section.skillUsage': 'Riferimenti alle skill',\n 'section.references': 'Riferimenti',\n 'references.tabSkills': 'Skill',\n 'references.tabMemory': 'Memoria',\n 'skillUsage.empty': 'Nessuna skill caricata in questa sessione',\n 'skillUsage.emptyHint': 'Le skill compaiono qui quando il modello ne carica una con il tool `skill` o quando ne avvii una direttamente.',\n 'skillUsage.uses': '{count}x',\n 'skillUsage.count': '{count} caricamenti · {total} skill',\n 'skillUsage.latestTag': 'questo giro',\n 'skillUsage.invokedGroup': 'Referenziate · {count}',\n 'skillUsage.availableGroup': 'Disponibili in questa sessione · {count}',\n 'skillUsage.availableCapped': '({count} skill nel catalogo; l’elenco è troncato)',\n 'section.searchRefs': 'Ricerche web',\n 'references.tabSearch': 'Ricerche',\n 'references.tabEcho': 'Eco',\n 'searchRefs.empty': 'Nessuna ricerca in questa sessione',\n 'searchRefs.emptyHint': 'Le query e le fonti ottenute compaiono qui quando il modello chiama web_search o advanced_search.',\n 'searchRefs.queryGroup': 'Query · {count}',\n 'searchRefs.sourceGroup': 'Fonti · {count}',\n 'searchRefs.hits': '{count} restituite',\n 'searchRefs.latestTag': 'Questo turno',\n 'searchRefs.noSourcesHint': '(questa build di dsh-free-search non restituisce l’elenco delle fonti; aggiorna per vederlo)',\n 'searchRefs.capped': '({total} nella sessione; l’elenco è troncato)',\n 'settings.title': 'Barra laterale Riepilogo',\n 'settings.desc': 'Interruttori delle sezioni della scheda Riepilogo nella barra laterale destra (sola lettura).',\n 'settings.memorySlots': 'Sezione slot di memoria',\n 'settings.memorySlotsHint': 'Quando attivo, la scheda Riepilogo elenca gli slot di memoria attivi di dsh-prime-memory sotto avanzamento e file prodotti (sola lettura).',\n 'settings.memoryRecall': 'Sezione richiamo sessione',\n 'settings.memoryRecallHint': 'Attivo: la scheda Riepilogo elenca i ricordi inseriti in questa sessione e consente di valutarli (0–5; -1 dichiara obsoleto e ritira). Le voci sostituite da un riassunto vengono ripiegate.',\n 'settings.spiritEcho': 'Scheda Eco',\n 'settings.spiritEchoHint': 'Attivo: nel pannello Riferimenti resta la scheda Eco con le voci di eco e i passaggi richiamati di questa sessione (conservati dopo il riavvio). Disattivo: la scheda sparisce.',\n 'settings.unavailable': 'La superficie di configurazione non è disponibile; la sezione memoria torna al valore predefinito (attivo).',\n 'settings.readonly': 'Questa configurazione è in sola lettura qui; non è possibile modificarla.',\n 'section.spiritEcho': 'Eco',\n 'echo.segmentCount': 'Questa sessione: {count} passaggi richiamati',\n 'echo.stepCount': 'Questa sessione: {count} voci di eco',\n 'echo.openOriginal': 'Apri originale',\n 'echo.skippedSummary': '{count} turni senza iniezione ({reasons})',\n 'echo.injectedEmpty': '(nessun riepilogo)',\n 'echo.totalHint': 'Passaggi di questa sessione: {count} (conservati dopo il riavvio)',\n 'echo.latest': 'Ultimo:',\n 'echo.lastStep': 'Turno precedente:',\n 'echo.injected': 'iniettato',\n 'echo.skipped': 'saltato',\n 'echo.empty': 'Nessun passaggio di eco richiamato in questa sessione',\n 'echo.emptyHint': 'I passaggi richiamati da dsh-spirit in questa sessione appariranno qui.',\n 'echo.goto': 'Voci →',\n 'echo.gotoGraph': 'Mappa stellare →',\n 'echo.gotoFail': \"Impossibile aprire l'eco\",\n 'echo.viewMenu': \"Apri\",\n 'memoryView.button': 'Dettagli',\n 'memoryView.preview': 'Anteprima',\n 'memoryView.entry': 'Voci',\n 'memoryView.graph2d': 'Grafo 2D',\n 'memoryView.graph3d': 'Grafo 3D',\n 'memoryView.failAbsent': 'Libreria memorie non disponibile (dsh-prime-memory non è installato)',\n 'memoryView.failDisabled': \"L'ingresso della libreria memorie è disattivato nelle impostazioni\",\n 'memoryView.failUnmounted': 'Questo host non monta la pagina della libreria memorie',\n 'memoryView.failUnregistered': \"L'host non ha registrato la pagina della libreria memorie\",\n}\n\n/** Russian dictionary, checked complete against the zh key set. */\nexport const ru: Record<BriefKey, string> = {\n 'tab.title': 'Сводка',\n 'tab.desc': 'Задачи, созданные файлы и планы этой сессии (только чтение)',\n 'section.progress': 'Ход работы',\n 'section.deliverables': 'Созданные файлы',\n 'board.empty': 'Задач пока нет',\n 'board.emptyHint': 'Задачи появятся здесь, когда модель вызовет todo_write.',\n 'board.unavailable': 'Задачи недоступны',\n 'board.unavailableHint':\n 'Эта сессия ещё не получила данные todo; доска заполнится после первого кадра.',\n 'status.pending': 'Ожидает',\n 'status.inProgress': 'В работе',\n 'status.completed': 'Готово',\n 'deliverables.empty': 'За этот ход файлы не менялись',\n 'deliverables.emptyHint': 'Успешно записанные или изменённые файлы появляются здесь в реальном времени.',\n 'deliverables.history': 'Более ранние изменения · {count}',\n 'deliverables.historyMore': 'ещё {count}',\n 'deliverables.currentTurn': 'Этот ход · {count}',\n 'deliverables.historyCapped': '(в сессии всего {total} файлов; список усечён)',\n 'deliverable.codeplanTag': 'План',\n 'section.memorySlots': 'Память',\n 'slots.empty': 'Активных слотов памяти нет',\n 'slots.emptyHint': 'Как только dsh-prime-memory активирует слоты, они появляются здесь в реальном времени.',\n 'slots.openCount': 'Открытых слотов: {count}',\n 'slots.viewMemory': 'Просмотр',\n 'slots.status.open': 'Активен',\n 'slots.status.done': 'Завершён',\n 'slots.status.dropped': 'Отброшен',\n 'slots.status.expired': 'Истёк',\n 'section.memoryRecall': 'Воспоминания сессии',\n 'recall.empty': 'В этой сессии воспоминания ещё не вызывались',\n 'recall.count': 'Вставлено {count} · заменённые кратким изложением свёрнуты после сжатия (удаляются при /clear)',\n 'recall.rateHint': 'Выберите запись, чтобы оценить: 0–5 релевантность; -1 объявляет её устаревшей и убирает (восстановимо).',\n 'recall.obsolete': 'Устарело',\n 'recall.obsoleteConfirm': 'Убрать?',\n 'recall.obsoleted': 'Объявлено устаревшим',\n 'recall.rated': 'Оценка {count}/5',\n 'recall.failed': 'Ошибка оценки: ',\n 'recall.obsoleteWhy': 'Объявить устаревшим значит снимает запись восстанавлимо и сообщает модель на следующем ходе',\n 'recall.viewDetail': 'Подробнее',\n 'recall.strikeHint': '; помеченная как устаревшая запись остаётся в списке, зачёркнутой (удаляется только при очистке сессии)',\n 'recall.supersededHidden': 'Скрыто старых воспоминаний: {count} — их текст заменён кратким изложением',\n 'recall.activeGroup': 'Активные вызовы · {count}',\n 'recall.historyGroup': 'Прочие прежние вызовы · {count}',\n 'recall.supersededTag': 'заменено сводкой',\n 'recall.noBody': 'В этом кадре нет полного текста этой записи',\n 'section.skillUsage': 'Отсылки к скиллам',\n 'section.references': 'Отсылки',\n 'references.tabSkills': 'Навыки',\n 'references.tabMemory': 'Память',\n 'skillUsage.empty': 'В этой сессии скиллы не загружались',\n 'skillUsage.emptyHint': 'Навыки появятся здесь, когда модель загрузит их через инструмент `skill` или вы вызовете навык напрямую.',\n 'skillUsage.uses': '{count} раз',\n 'skillUsage.count': 'Загрузок: {count} · скиллов: {total}',\n 'skillUsage.latestTag': 'этот ход',\n 'skillUsage.invokedGroup': 'Использованы · {count}',\n 'skillUsage.availableGroup': 'Доступны в этой сессии · {count}',\n 'skillUsage.availableCapped': '({count} навыков в каталоге; список усечён)',\n 'section.searchRefs': 'Поиск в сети',\n 'references.tabSearch': 'Поиск',\n 'references.tabEcho': 'Эхо',\n 'searchRefs.empty': 'В этой сессии ещё не было поиска',\n 'searchRefs.emptyHint': 'Запросы и полученные источники появятся здесь, когда модель вызовет web_search или advanced_search.',\n 'searchRefs.queryGroup': 'Запросы · {count}',\n 'searchRefs.sourceGroup': 'Источники · {count}',\n 'searchRefs.hits': 'возвращено {count}',\n 'searchRefs.latestTag': 'Этот ход',\n 'searchRefs.noSourcesHint': '(эта сборка dsh-free-search не возвращает список источников; обновите, чтобы видеть их)',\n 'searchRefs.capped': '(в сессии всего {total}; список усечён)',\n 'settings.title': 'Боковая панель «Сводка»',\n 'settings.desc': 'Переключатели разделов вкладки «Сводка» на правой панели (только чтение).',\n 'settings.memorySlots': 'Раздел слотов памяти',\n 'settings.memorySlotsHint': 'Когда включено, вкладка «Сводка» показывает активные слоты памяти из dsh-prime-memory под ходом работы и созданными файлами (только чтение).',\n 'settings.memoryRecall': 'Раздел Воспоминания сессии',\n 'settings.memoryRecallHint': 'Включено: вкладка «Сводка» показывает вставленные в этой сессии воспоминания и позволяет оценить их (0–5; -1 объявляет устаревшим и выводит из обращения). Заменённые кратким изложением записи сворачиваются.',\n 'settings.spiritEcho': 'Вкладка «Эхо»',\n 'settings.spiritEchoHint': 'Включено: в «Ссылках» остаётся вкладка «Эхо» со списком эхо-записей и припомненных отрывков этой сессии (сохраняются после перезапуска). Выключено — вкладка скрыта.',\n 'settings.unavailable': 'Панель конфигурации недоступна; раздел памяти работает по умолчанию (включён).',\n 'settings.readonly': 'Эта конфигурация здесь только для чтения; изменить её нельзя.',\n 'section.spiritEcho': 'Эхо',\n 'echo.segmentCount': 'Эта сессия: {count} припомненных отрывков',\n 'echo.stepCount': 'Эта сессия: {count} записей эха',\n 'echo.openOriginal': 'Открыть оригинал',\n 'echo.skippedSummary': 'Ещё {count} раундов без внедрения ({reasons})',\n 'echo.injectedEmpty': '(без сводки)',\n 'echo.totalHint': 'Отрывки этой сессии: {count} (сохраняются после перезапуска)',\n 'echo.latest': 'Последнее:',\n 'echo.lastStep': 'Прошлый раунд:',\n 'echo.injected': 'внедрено',\n 'echo.skipped': 'пропущено',\n 'echo.empty': 'В этой сессии пока не припомнено ни одного отрывка',\n 'echo.emptyHint': 'Здесь появятся отрывки, которые dsh-spirit припомнил в этой сессии.',\n 'echo.goto': 'Записи →',\n 'echo.gotoGraph': 'Звёздная карта →',\n 'echo.gotoFail': 'Не удалось открыть эхо',\n 'echo.viewMenu': 'Открыть',\n 'memoryView.button': 'Подробно',\n 'memoryView.preview': 'Просмотр',\n 'memoryView.entry': 'Записи',\n 'memoryView.graph2d': 'Граф 2D',\n 'memoryView.graph3d': 'Граф 3D',\n 'memoryView.failAbsent': 'Библиотека памяти недоступна (dsh-prime-memory не установлен)',\n 'memoryView.failDisabled': 'Вход в библиотеку памяти отключён в настройках памяти',\n 'memoryView.failUnmounted': 'Этот хост не монтирует страницу библиотеки памяти',\n 'memoryView.failUnregistered': 'Хост не зарегистрировал страницу библиотеки памяти',\n}\n\n/** Spanish dictionary, checked complete against the zh key set. */\nexport const es: Record<BriefKey, string> = {\n 'tab.title': 'Resumen',\n 'tab.desc': 'Tareas, archivos generados y planes de esta sesión (solo lectura)',\n 'section.progress': 'Avance',\n 'section.deliverables': 'Archivos generados',\n 'board.empty': 'Aún no hay tareas',\n 'board.emptyHint': 'Las tareas aparecen aquí cuando el modelo llama a todo_write.',\n 'board.unavailable': 'Tareas no disponibles',\n 'board.unavailableHint':\n 'Esta sesión aún no ha recibido datos de tareas; el tablero se llena con el primer fotograma.',\n 'status.pending': 'Pendiente',\n 'status.inProgress': 'En curso',\n 'status.completed': 'Hecho',\n 'deliverables.empty': 'Ningún archivo modificado en este turno',\n 'deliverables.emptyHint': 'Los archivos escritos o editados en la sesión aparecen aquí en directo.',\n 'deliverables.history': 'Cambios anteriores · {count}',\n 'deliverables.historyMore': '{count} más',\n 'deliverables.currentTurn': 'Este turno · {count}',\n 'deliverables.historyCapped': '(la sesión produjo {total} archivos; la lista está truncada)',\n 'deliverable.codeplanTag': 'Plan',\n 'section.memorySlots': 'Memoria',\n 'slots.empty': 'No hay ranuras de memoria activas',\n 'slots.emptyHint': 'Las ranuras aparecen aquí en directo en cuanto dsh-prime-memory las active.',\n 'slots.openCount': '{count} ranuras abiertas',\n 'slots.viewMemory': 'Ver',\n 'slots.status.open': 'Activa',\n 'slots.status.done': 'Hecha',\n 'slots.status.dropped': 'Descartada',\n 'slots.status.expired': 'Caducada',\n 'section.memoryRecall': 'Recuerdo de la sesión',\n 'recall.empty': 'Aún no se ha recuperado ningún recuerdo en esta sesión',\n 'recall.count': '{count} insertados · los reemplazados por un resumen se pliegan tras comprimir (se borran con /clear)',\n 'recall.rateHint': 'Selecciona un recuerdo para puntuarlo: 0–5 relevancia; -1 lo declara obsoleto y lo retira (recuperable).',\n 'recall.obsolete': 'Obsoleto',\n 'recall.obsoleteConfirm': '¿Retirarlo?',\n 'recall.obsoleted': 'Declarado obsoleto',\n 'recall.rated': 'Puntuado {count}/5',\n 'recall.failed': 'Error al puntuar: ',\n 'recall.obsoleteWhy': 'Declararlo obsoleto retira el registro (recuperable) y avisa al modelo en el turno siguiente',\n 'recall.viewDetail': 'Detalles',\n 'recall.strikeHint': '; una entrada marcada como obsoleta sigue en la lista, tachada (se retira solo al vaciar la sesión)',\n 'recall.supersededHidden': '{count} recuerdos antiguos ocultos — su texto fue reemplazado por un resumen',\n 'recall.activeGroup': 'Recuerdos activos · {count}',\n 'recall.historyGroup': 'Recuerdos anteriores · {count}',\n 'recall.supersededTag': 'reemplazado por el resumen',\n 'recall.noBody': '(este fotograma no trae el texto completo de este registro)',\n 'section.skillUsage': 'Referencias de skills',\n 'section.references': 'Referencias',\n 'references.tabSkills': 'Skills',\n 'references.tabMemory': 'Memoria',\n 'skillUsage.empty': 'Esta sesión no ha cargado ningún skill',\n 'skillUsage.emptyHint': 'Las skills aparecen aquí cuando el modelo carga una con la herramienta `skill` o cuando invocas una directamente.',\n 'skillUsage.uses': '{count}x',\n 'skillUsage.count': '{count} cargas · {total} skills',\n 'skillUsage.latestTag': 'este turno',\n 'skillUsage.invokedGroup': 'Referenciadas · {count}',\n 'skillUsage.availableGroup': 'Disponibles en esta sesión · {count}',\n 'skillUsage.availableCapped': '({count} skills en el catálogo; la lista está truncada)',\n 'section.searchRefs': 'Búsquedas web',\n 'references.tabSearch': 'Búsquedas',\n 'references.tabEcho': 'Eco',\n 'searchRefs.empty': 'Sin búsquedas en esta sesión',\n 'searchRefs.emptyHint': 'Las consultas y las fuentes obtenidas aparecen aquí cuando el modelo llama a web_search o advanced_search.',\n 'searchRefs.queryGroup': 'Consultas · {count}',\n 'searchRefs.sourceGroup': 'Fuentes · {count}',\n 'searchRefs.hits': '{count} devueltas',\n 'searchRefs.latestTag': 'Este turno',\n 'searchRefs.noSourcesHint': '(esta versión de dsh-free-search no devuelve la lista de fuentes; actualiza para verla)',\n 'searchRefs.capped': '({total} en la sesión; la lista está truncada)',\n 'settings.title': 'Barra lateral Resumen',\n 'settings.desc': 'Interruptores de las secciones de la pestaña Resumen en la barra lateral derecha (solo lectura).',\n 'settings.memorySlots': 'Sección de ranuras de memoria',\n 'settings.memorySlotsHint': 'Al activarla, la pestaña Resumen enumera las ranuras de memoria activas de dsh-prime-memory bajo el avance y los archivos generados (solo lectura).',\n 'settings.memoryRecall': 'Sección de recuerdo de sesión',\n 'settings.memoryRecallHint': 'Activado: la pestaña Resumen lista los recuerdos inyectados en esta sesión y permite puntuarlos (0–5; -1 declara obsoleto y retira). Las entradas reemplazadas por un resumen se pliegan.',\n 'settings.spiritEcho': 'Pestaña Eco',\n 'settings.spiritEchoHint': 'Activado: el panel Referencias conserva la pestaña Eco con las entradas de eco y los pasajes recordados de esta sesión (se conservan tras reiniciar). Desactivado, la pestaña desaparece.',\n 'settings.unavailable': 'La superficie de configuración no está disponible; la sección de memoria vuelve a su valor por defecto (activada).',\n 'settings.readonly': 'Esta configuración es de solo lectura aquí; no se puede modificar.',\n 'section.spiritEcho': 'Eco',\n 'echo.segmentCount': 'Esta sesión: {count} pasajes recordados',\n 'echo.stepCount': 'Esta sesión: {count} entradas de eco',\n 'echo.openOriginal': 'Abrir original',\n 'echo.skippedSummary': '{count} rondas sin inyección ({reasons})',\n 'echo.injectedEmpty': '(sin resumen)',\n 'echo.totalHint': 'Pasajes de esta sesión: {count} (se conservan tras reiniciar)',\n 'echo.latest': 'Último:',\n 'echo.lastStep': 'Ronda anterior:',\n 'echo.injected': 'inyectado',\n 'echo.skipped': 'omitido',\n 'echo.empty': 'Aún no hay pasajes de eco recordados en esta sesión',\n 'echo.emptyHint': 'Aquí aparecerán los pasajes que dsh-spirit recuerde en esta sesión.',\n 'echo.goto': 'Entradas →',\n 'echo.gotoGraph': 'Mapa estelar →',\n 'echo.gotoFail': 'No se pudo abrir el eco',\n 'echo.viewMenu': 'Ver',\n 'memoryView.button': 'Detalles',\n 'memoryView.preview': 'Vista rápida',\n 'memoryView.entry': 'Entradas',\n 'memoryView.graph2d': 'Grafo 2D',\n 'memoryView.graph3d': 'Grafo 3D',\n 'memoryView.failAbsent': 'Biblioteca de memoria no disponible (dsh-prime-memory no está instalado)',\n 'memoryView.failDisabled': 'La entrada de la biblioteca de memoria está desactivada en los ajustes',\n 'memoryView.failUnmounted': 'Este host no monta la página de la biblioteca de memoria',\n 'memoryView.failUnregistered': 'El host no ha registrado la página de la biblioteca de memoria',\n}\n\n/**\n * All locales in the shape the locale service consumes. Registered in ONE call:\n * the registry rejects a duplicate `(namespace, locale)` pair and the\n * per-locale form would leave a half-registered namespace if a later call\n * threw. `zh`/`en` are the host built-ins; the fr/de/it/ru/es pack rides the\n * same map form (every id is a valid BCP 47-style tag, so the registry accepts\n * it as-is).\n */\nexport const dictionaries: Record<string, Record<string, string>> = {\n zh,\n en,\n ja,\n ko,\n fr,\n de,\n it,\n ru,\n es,\n}\n\n/**\n * Expand the one `{count}` placeholder the deliverables totals line uses. The\n * locale binder is a plain key → string lookup (no interpolation machinery),\n * mirroring how `progressLine` composes its summary from parts.\n */\nexport function expandCount(template: string, count: number): string {\n return template.replace('{count}', String(count))\n}\n\n/**\n * Fill a `{total}` placeholder — the counter that says how many there really\n * are, as opposed to how many the (capped) list shows.\n */\nexport function expandTotal(template: string, total: number): string {\n return template.replace('{total}', String(total))\n}\n","/**\r\n * The deliverables section: the `dshSummaryDeliverables` projection drawn as\r\n * one part of the summary tab.\r\n *\r\n * Unlike the progress section this is an OPTIONAL capability: where the host\r\n * half never registered the unit (older composition, key absent), the section\r\n * hides entirely — absence is not an error state here, and the official\r\n * \"本次产出\" row in the conversation flow still covers the turn-end view.\r\n * When the projection is live, the latest turn's produced paths update\r\n * mid-turn: every successful mutation result publishes a frame, so the reader\r\n * sees files appear while the turn is still running, which is exactly the gap\r\n * the official turn-tail row has.\r\n *\r\n * Codeplan artifacts (paths under `.agents/plans/<任务名>/`) are ordinary\r\n * produced entries — they are marked with a pill, not split into a separate\r\n * section.\r\n *\r\n * Colours come from `--dsw-alias-*` tokens only (skin contract).\r\n */\r\nimport { createElement } from 'react'\r\nimport { useState } from 'react'\r\nimport type { CSSProperties, ReactNode } from 'react'\r\nimport { useProjectionValue } from '../use-projection'\r\nimport type { CtxProbe } from '../use-projection'\r\nimport { DELIVERABLES_KEY } from '../../projection/keys'\r\nimport { sidebarFileOpener } from '../file-open'\r\nimport { basename, historyPaths, readDeliverables, splitCodeplanPath } from './deliverables'\r\nimport { GroupCaption, GroupHeader, FoldToggle } from './FoldToggle'\r\nimport { expandCount, expandTotal } from '../locales'\r\n\r\nexport interface DeliverablesSectionProps {\r\n /** The DSH locale lookup, passed down from `apply`. */\r\n t: (key: string) => string\r\n /** The client root context (the tab body's only way to reach services). */\r\n ctx?: CtxProbe\r\n /** The session this tab is scoped to. */\r\n scope?: { readonly sessionId?: string }\r\n}\r\n\r\nconst SECTION_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n borderBottom: '1px solid var(--dsw-alias-border-secondary)',\r\n}\r\n\r\n/**\r\n * How many earlier-change rows a reloaded session shows before the reader asks\r\n * for more. Five fills the visible slice of a narrow sidebar without turning\r\n * the section into a scroll well — the preview exists to prove \"this session\r\n * produced files\", not to be the full history.\r\n */\r\nconst HISTORY_PREVIEW = 5\r\n\r\nconst HEADER_STYLE: CSSProperties = {\r\n padding: '10px 12px 0',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n fontSize: 12,\r\n fontWeight: 600,\r\n}\r\n\r\nconst LIST_STYLE: CSSProperties = {\r\n listStyle: 'none',\r\n margin: 0,\r\n padding: '6px 0',\r\n display: 'flex',\r\n flexDirection: 'column',\r\n}\r\n\r\nconst ROW_STYLE: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'flex-start',\r\n gap: 8,\r\n padding: '6px 12px',\r\n}\r\n\r\nconst PATH_STYLE: CSSProperties = {\r\n minWidth: 0,\r\n overflowWrap: 'anywhere',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n}\r\n\r\n/** Row-as-button reset: the row itself is the click target, content unchanged. */\r\nconst BUTTON_STYLE: CSSProperties = {\r\n ...PATH_STYLE,\r\n background: 'none',\r\n border: 'none',\r\n font: 'inherit',\r\n fontSize: 'inherit',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n padding: 0,\r\n textAlign: 'left',\r\n cursor: 'pointer',\r\n}\r\n\r\n/** The codeplan pill: same form as the status pills, tertiary emphasis. */\r\nconst TAG_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n border: '1px solid var(--dsw-alias-label-tertiary)',\r\n borderRadius: 999,\r\n padding: '0 6px',\r\n fontSize: 11,\r\n lineHeight: '16px',\r\n whiteSpace: 'nowrap',\r\n}\r\n\r\n/**\r\n * One produced-file row. When the sidebar opener is available the row is a\r\n * button that routes the path to the Sidebar preview (the same channel the\r\n * conversation's produced-file chips use); otherwise it degrades to a plain\r\n * span. A codeplan artifact carries the pill either way.\r\n */\r\nfunction PathRow(props: {\r\n path: string\r\n t: (key: string) => string\r\n open?: (path: string) => void\r\n}): ReactNode {\r\n const { path, t, open } = props\r\n const plan = splitCodeplanPath(path)\r\n const title = plan === null ? path : `${t('deliverable.codeplanTag')}: ${plan.task} · ${path}`\r\n const label = basename(path)\r\n const content = plan === null ? null : createElement('span', { style: TAG_STYLE }, t('deliverable.codeplanTag'))\r\n if (open === undefined) {\r\n return createElement(\r\n 'li',\r\n { style: ROW_STYLE },\r\n content,\r\n createElement('span', { style: PATH_STYLE, title }, label),\r\n )\r\n }\r\n return createElement(\r\n 'li',\r\n { style: ROW_STYLE },\r\n content,\r\n createElement('button', { style: BUTTON_STYLE, title, onClick: () => { open(path) } }, label),\r\n )\r\n}\r\n\r\n/**\r\n * The deliverables section. The subscription is unconditional (a plain\r\n * listener, not IO).\r\n *\r\n * 分层:本回合改动(latest)与全会话更早改动分成两组各自计数——前者直列,后者\r\n * 折叠在开关行后面(与活跃文件按归一化路径去重),展开后是与活跃区相同的可点击\r\n * 文件行。列表有上限时,开关行说折叠区条数、附注说会话真数,两个数不混为一谈。\r\n *\r\n * **重载语义**:重新打开一个历史会话时,`latest` 要么是空的(还没跑新回合),\r\n * 要么指向上一回合——两种情况下「本回合改动」都读不出东西,而历史改动全被\r\n * 折叠收起,整节看起来像\"没有产物\"。所以本回合为空时历史区**默认展开并只\r\n * 预览前 {@link HISTORY_PREVIEW} 条**:读者一进来就能看见这个会话改过什么,\r\n * 又不至于把侧栏塞满;点「还有 N 条」看全量,点折叠行收起。\r\n * @param props - translation, client context, session scope.\r\n */\r\nexport function DeliverablesSection(props: DeliverablesSectionProps): ReactNode {\r\n const { t, ctx, scope } = props\r\n // `undefined` = the reader has not expressed a preference yet, so the\r\n // default below still applies. A live projection can flip the turn from\r\n // empty to populated mid-session, and a plain `useState(defaultOpen)` would\r\n // freeze whichever state the first render happened to see.\r\n const [historyOverride, setHistoryOverride] = useState<boolean | undefined>(undefined)\r\n\r\n const view = readDeliverables(useProjectionValue(ctx, scope?.sessionId, DELIVERABLES_KEY))\r\n\r\n // Capability absent — the optional unit never registered. Hide, don't nag.\r\n if (view === undefined) return null\r\n\r\n // Optional click-to-preview: rows degrade to plain text where the sidebar\r\n // opener is absent (the opener resolves the session cwd per click).\r\n const open = sidebarFileOpener(ctx, scope?.sessionId)\r\n\r\n const latestPaths = view.latest?.paths ?? []\r\n const history = historyPaths(view.sessionPaths, latestPaths)\r\n\r\n // No current-turn rows means this is a reload of a finished turn: show the\r\n // earlier changes instead of an apparently empty section.\r\n const historyOpen = historyOverride ?? latestPaths.length === 0\r\n // Previewing = open because the section defaulted open, not because the\r\n // reader asked for everything. Only a preview offers the \"N more\" entry.\r\n const previewing = historyOpen && historyOverride !== true\r\n const shownHistory = !historyOpen\r\n ? []\r\n : previewing ? history.slice(0, HISTORY_PREVIEW) : history\r\n const hiddenHistory = history.length - shownHistory.length\r\n\r\n if (latestPaths.length === 0 && view.sessionTotal === 0) {\r\n return createElement(\r\n 'div',\r\n { style: SECTION_STYLE, 'data-dsh-brief-sidebar': 'deliverables-section' },\r\n createElement('div', { style: HEADER_STYLE }, t('section.deliverables')),\r\n createElement(\r\n 'div',\r\n {\r\n style: {\r\n margin: '0 auto',\r\n padding: 24,\r\n maxWidth: 460,\r\n textAlign: 'center',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n lineHeight: 1.7,\r\n fontSize: 12,\r\n },\r\n },\r\n createElement('div', { style: { marginBottom: 6, color: 'var(--dsw-alias-label-secondary)' } }, t('deliverables.empty')),\r\n createElement('div', null, t('deliverables.emptyHint')),\r\n ),\r\n )\r\n }\r\n\r\n return createElement(\r\n 'div',\r\n { style: SECTION_STYLE, 'data-dsh-brief-sidebar': 'deliverables-section' },\r\n createElement('div', { style: HEADER_STYLE }, t('section.deliverables')),\r\n // 当前 turn 一组:只有真改过东西才起标题,否则“本回合改动 · 0”反而口舌。\r\n latestPaths.length > 0 && createElement(GroupHeader, {\r\n text: expandCount(t('deliverables.currentTurn'), latestPaths.length),\r\n marker: 'deliverables-current-group',\r\n }),\r\n latestPaths.length > 0 && createElement(\r\n 'ul',\r\n { style: LIST_STYLE },\r\n latestPaths.map(path => createElement(PathRow, { key: path, path, t, open })),\r\n ),\r\n history.length > 0 && createElement(FoldToggle, {\r\n label: expandCount(t('deliverables.history'), history.length),\r\n open: historyOpen,\r\n marker: 'deliverables-history-toggle',\r\n onToggle: () => { setHistoryOverride(!historyOpen) },\r\n }),\r\n // 列表有上限:开关行说的是折叠区收了多少条,附注说会话一共改过多少个。\r\n history.length > 0 && view.sessionTotal > view.sessionPaths.length && createElement(GroupCaption, {\r\n text: expandTotal(t('deliverables.historyCapped'), view.sessionTotal),\r\n marker: 'deliverables-history-capped',\r\n }),\r\n shownHistory.length > 0 && createElement(\r\n 'ul',\r\n { style: LIST_STYLE },\r\n shownHistory.map(path => createElement(PathRow, { key: path, path, t, open })),\r\n ),\r\n // 预览模式下把\"还有多少条\"交回读者:一行可点的补充入口,不靠滚动。\r\n // 只在预览态出现——收起态已经有折叠开关,全展开态没有剩余可给。\r\n previewing && hiddenHistory > 0 && createElement(FoldToggle, {\r\n label: expandCount(t('deliverables.historyMore'), hiddenHistory),\r\n open: false,\r\n marker: 'deliverables-history-more',\r\n onToggle: () => { setHistoryOverride(true) },\r\n }),\r\n )\r\n}\r\n","/**\r\n * The `dshSummarySkillUsage` projection — reading it.\r\n *\r\n * The unit is registered by THIS plugin's host half (key `dshSummarySkillUsage`):\r\n * the skills this session actually loaded through the host's `skill` tool. It\r\n * answers a different question from `memorySlots`/`memoryRecall` — those say\r\n * what the model was *told*, this says which instruction packs it *pulled*.\r\n *\r\n * The module is deliberately PURE — no React, no context, no IO — so the\r\n * narrowing is testable directly, exactly like `deliverables.ts`.\r\n *\r\n * Reading discipline (the same three-way split every brief section uses):\r\n * - `undefined` = the capability is ABSENT (host half never registered, older\r\n * composition without the projection registry, or a frame drifted beyond\r\n * repair) → the section hides;\r\n * - `session: []` = the honest empty state (the `skill` tool exists on all six\r\n * supported lines; this session simply has not loaded anything yet);\r\n * - a malformed entry is dropped, never thrown — one bad row must not blank\r\n * the whole list.\r\n */\r\nimport { SKILL_USAGE_KEY } from '../../projection/keys'\r\nimport type { SkillUsageEntryView, SkillUsageView } from '../../projection/keys'\r\n\r\n/** The key this plugin's client half subscribes to (re-exported for callers). */\r\nexport { SKILL_USAGE_KEY }\r\n\r\n/** Whether a value is a non-negative safe integer (the view's counter shape). */\r\nfunction isCounter(value: unknown): value is number {\r\n return typeof value === 'number' && Number.isSafeInteger(value) && value >= 0\r\n}\r\n\r\n/** Narrow one skill tally; `undefined` = malformed, dropped. */\r\nfunction readEntry(value: unknown): SkillUsageEntryView | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as Record<string, unknown>\r\n if (typeof raw['name'] !== 'string' || raw['name'].length === 0) return undefined\r\n if (!isCounter(raw['count']) || !isCounter(raw['lastTurn'])) return undefined\r\n return { name: raw['name'], count: raw['count'], lastTurn: raw['lastTurn'] }\r\n}\r\n\r\n/**\r\n * The latest-turn bucket, or `null` when it is absent OR drifted. A drifted\r\n * bucket only costs the \"本轮\" tag, so it degrades instead of voiding the view.\r\n */\r\nfunction readLatest(value: unknown): SkillUsageView['latest'] {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return null\r\n const raw = value as Record<string, unknown>\r\n if (!isCounter(raw['turn']) || !Array.isArray(raw['names'])) return null\r\n return { turn: raw['turn'], names: raw['names'].filter((n): n is string => typeof n === 'string' && n.length > 0) }\r\n}\r\n\r\n/**\r\n * The available-skill list of a frame, or `[]` when the frame carries none.\r\n *\r\n * Absent-by-age is the important case: a host half older than this reader\r\n * publishes no `available` field at all, and that must NOT void the whole view\r\n * — the session's references are still true. Only a drifted (non-array) value\r\n * reads as \"nothing known\", never as \"nothing available\".\r\n */\r\nfunction readAvailable(value: unknown): readonly string[] {\r\n if (!Array.isArray(value)) return []\r\n return value.filter((n): n is string => typeof n === 'string' && n.length > 0)\r\n}\r\n\r\n/**\r\n * Narrow a raw projection value into a skill-usage view.\r\n *\r\n * @param value - the raw `unknown` snapshot of the `dshSummarySkillUsage` face.\r\n * @returns the validated view, or `undefined` when the capability is absent.\r\n */\r\nexport function readSkillUsage(value: unknown): SkillUsageView | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as Record<string, unknown>\r\n // The counters and the list are the contract; their drift means the frame was\r\n // written by a different shape than this reader speaks.\r\n if (!Array.isArray(raw['session'])) return undefined\r\n if (!isCounter(raw['sessionTotal']) || !isCounter(raw['callTotal'])) return undefined\r\n const session: SkillUsageEntryView[] = []\r\n for (const entry of raw['session']) {\r\n const narrowed = readEntry(entry)\r\n if (narrowed !== undefined) session.push(narrowed)\r\n }\r\n const available = readAvailable(raw['available'])\r\n // The count rides with the list; without a list there is no count to trust.\r\n const availableCount = available.length === 0 ? 0 : (isCounter(raw['availableCount']) ? raw['availableCount'] : available.length)\r\n return {\r\n latest: readLatest(raw['latest']),\r\n session,\r\n sessionTotal: raw['sessionTotal'],\r\n callTotal: raw['callTotal'],\r\n available,\r\n availableCount,\r\n }\r\n}\r\n\r\n/**\r\n * The available list minus the names already shown as referenced.\r\n *\r\n * One skill must not occupy a row in both groups: the reference row is the\r\n * stronger fact, and a duplicate under \"available\" would read as \"the model\r\n * had a choice it didn't make\".\r\n *\r\n * @param available - the session's current catalog names, in catalog order.\r\n * @param referenced - names the fold counted as loaded or invoked.\r\n * @returns the remaining catalog names, order preserved.\r\n */\r\nexport function availableExcept(available: readonly string[], referenced: readonly string[]): string[] {\r\n const seen = new Set(referenced)\r\n return available.filter(name => !seen.has(name))\r\n}\r\n\r\n/**\r\n * Fill both placeholders of a template. `expandCount` only speaks `{count}`, and\r\n * this section's footer carries a second number on purpose: the capped list\r\n * needs the truthful distinct total next to the load count.\r\n *\r\n * @param template - a locale string carrying `{count}` and/or `{total}`.\r\n * @param count - the `{count}` value.\r\n * @param total - the `{total}` value.\r\n * @returns the filled string.\r\n */\r\nexport function expandPair(template: string, count: number, total: number): string {\r\n return template.replace('{count}', String(count)).replace('{total}', String(total))\r\n}\r\n","/**\n * Host-side fold of search-reference facts — the projection unit state for\n * `dshSummarySearchRefs`: which queries this session ran against the web, and\n * which external sources came back.\n *\n * Two tools feed it, and the split is stated on every row rather than merged\n * away, because they are different facts for the reader:\n *\n * - `advanced_search` — the user's own `dsh-free-search` tool: engines, keys\n * and prices are things the human configures. Its argument is `query`, a\n * single string.\n * - `web_search` — the harness's own tool, which `dsh-free-search` also feeds\n * (it registers a `WebSearchProvider`, so results can come from engines the\n * human picked while the call goes through host plumbing). Its argument is\n * `queries`, an array merged into one result set.\n *\n * Folding only the plugin tool turned out to be the wrong default: the model\n * reaches for the host's `web_search` far more often, so the section sat empty\n * in exactly the sessions where searching happened. Both are folded now; the\n * `tool` on each row is what keeps the two honest.\n *\n * Two channels, both structured, no prose scraping:\n *\n * - the query strings come from `tool/call.arguments`;\n * - the returned sources come from `tool/result.meta.sources[]` — the host\n * publishes those itself for `web_search`, and `dsh-free-search` >= 0.9.25\n * publishes them for `advanced_search` via `output.presentationMeta`.\n *\n * Older `dsh-free-search` builds declare no `presentationMeta`, so their\n * results carry no meta. That is a degraded reading, not a missed search: the\n * query still counts, with zero sources listed. Dropping the row instead would\n * tell the reader nothing happened when the model did search.\n *\n * Like the deliverables and skill folds this module is PURE — no cordis, no\n * zod, no IO — so it can be tested against hand-written event fixtures.\n * Success is required (an `isError` result is not a reference), and every list\n * is bounded because the registry folds this once per committed event.\n */\nimport type { FoldEvent } from './deliverables-fold'\n\n/** One external source the session pulled back. */\nexport interface SearchRefItem {\n /** The URL exactly as published, minus host case and a trailing slash. */\n readonly url: string\n /** Host, for grouping and for the row's quiet right-hand label. */\n readonly host: string\n readonly title?: string\n /** Provider snippet, capped (see CAPS.snippet). */\n readonly snippet?: string\n /**\n * Every query that has surfaced this source (newest call first, capped).\n * A merged multi-query `web_search` attributes its whole result set to each\n * of its queries, and a later call UNIONs onto this list rather than\n * replacing it — otherwise a source would silently leave the earlier query's\n * cluster while that query's `hits` still counted it.\n */\n readonly queries: readonly string[]\n /** Which tool answered — the plugin's own or the harness's. */\n readonly tool: string\n /** How many settled searches surfaced it. */\n readonly count: number\n /** Turn whose result last advanced this row. */\n readonly lastTurn: number\n}\n\n/** One search the session ran, with how many sources it returned. */\nexport interface SearchQueryRow {\n readonly query: string\n /** `advanced_search` (plugin) or `web_search` (host). */\n readonly tool: string\n readonly turn: number\n /**\n * Sources the call returned. For a merged multi-query `web_search` this is\n * the call's total repeated on each of its queries — the session never says\n * which query produced which source, and inventing a per-query split would\n * be worse than restating the shared total.\n */\n readonly hits: number\n}\n\n/** Fold state. Plain JSON, so the projection cache can persist it. */\nexport interface SearchRefState {\n /** Turn number of the open (or latest seen) turn; 0 before the first turn. */\n readonly turn: number\n /** Open turns' `callId → the search it asked for`; only owned tools are recorded. */\n readonly calls: Readonly<Record<string, { readonly turn: number; readonly tool: string; readonly queries: readonly string[] }>>\n /** URLs surfaced in the latest turn so far (`null` before the first turn). */\n readonly latest: { readonly turn: number; readonly urls: readonly string[] } | null\n /** Distinct sources, most-recent-first, capped. */\n readonly items: readonly SearchRefItem[]\n /** Distinct queries, most-recent-first, capped. */\n readonly queries: readonly SearchQueryRow[]\n /** Distinct sources over the whole session, uncapped. */\n readonly sourceTotal: number\n /** Distinct queries over the whole session, uncapped. */\n readonly queryTotal: number\n}\n\n/**\n * Capacity bounds, set from measurement rather than feel: 348 local sessions\n * (70 of them containing searches) gave distinct-queries-per-session\n * p50=7 / p90=29 / p95=38 / p99=67, distinct-sources-per-session\n * p50=16 / p90=54 / p95=63 / p99=164, and sources-per-turn p50=16 / p90=41 /\n * p95=51 / max=65. The previous 20/20/20 sat at roughly p55, which is what made\n * real clusters read \"0 results\" while the session had searched — a cap that\n * truncates the median session is a bug, not a limit.\n *\n * The cost of these numbers is bounded and known: one frame carries at most 64\n * sources and 48 queries, and a source row is URL + host + a capped title and\n * snippet plus at most 5 query strings. `snippet` is capped because it is the\n * only long text in the state and the frame is republished per event; the\n * provider already caps it once in its own `presentationMeta`, so this is a\n * second, tighter belt (measured snippet length: p95=137 characters).\n */\nexport const CAPS = {\n /** Distinct sources kept in state (measured p95=63, rounded up). */\n items: 64,\n /** Distinct queries kept in state (measured p95=38, headroom to ~p97). */\n queries: 48,\n /** URLs kept in the latest-turn bucket (measured per-turn max=65). */\n latest: 64,\n /** Snippet characters kept per source. */\n snippet: 160,\n /** Distinct queries kept per source (cluster membership, newest first). */\n queriesPerSource: 5,\n} as const\n\n/** The fold's initial state: no search has settled yet. */\nexport function initSearchRefState(): SearchRefState {\n return { turn: 0, calls: {}, latest: null, items: [], queries: [], sourceTotal: 0, queryTotal: 0 }\n}\n\n/**\n * The tools this fold owns, with how each one carries its query text.\n * Anything else is not a search reference even if its arguments look alike.\n */\nconst SEARCH_TOOLS: Readonly<Record<string, 'query' | 'queries'>> = {\n // The plugin's own tool: one query per call.\n advanced_search: 'query',\n // The harness's tool: 1..N queries whose result sets are merged.\n web_search: 'queries',\n}\n\n/**\n * Extract the query list of one committed `tool/call`.\n *\n * @param name - wire tool name.\n * @param argsRaw - model-produced JSON arguments (a string by the session contract).\n * @returns the non-blank queries in published order, or null when this call is not a search.\n */\nexport function queriesFromArgs(name: string, argsRaw: string): readonly string[] | null {\n let args: unknown\n try {\n args = JSON.parse(argsRaw) as unknown\n } catch {\n return null\n }\n return queriesOf(name, args)\n}\n\n/**\n * Extract the query list from a call whose arguments are ALREADY parsed — the\n * shape `tool/ptc-dispatch` carries. A non-object argument (the host's static\n * type is `unknown`; failure dispatches have been observed to carry a bare\n * string) yields null rather than an exception.\n *\n * @param name - wire tool name.\n * @param args - parsed call arguments.\n * @returns the non-blank queries in published order, or null when this call is not a search.\n */\nexport function queriesOf(name: string, args: unknown): readonly string[] | null {\n const shape = SEARCH_TOOLS[name]\n if (shape === undefined) return null\n if (typeof args !== 'object' || args === null || Array.isArray(args)) return null\n const record = args as Record<string, unknown>\n const keep = (value: unknown, out: string[]): void => {\n if (typeof value === 'string' && value.trim().length > 0) out.push(value.trim())\n }\n const out: string[] = []\n if (shape === 'query') {\n keep(record['query'], out)\n } else {\n // A non-array `queries` is a drifted argument, not a search we can name.\n if (!Array.isArray(record['queries'])) return null\n for (const entry of record['queries']) keep(entry, out)\n }\n return out.length > 0 ? out : null\n}\n\n/**\n * The dedupe key. Host case and a trailing slash are not meaningful for\n * identity; path case IS, so it is left alone. Exported because the client\n * matches a row against the latest-turn bucket with the same algorithm.\n */\nexport function urlKey(url: string): string {\n const trimmed = url.trim()\n const withoutTrailingSlash = trimmed.endsWith('/') ? trimmed.slice(0, -1) : trimmed\n return withoutTrailingSlash.replace(/^[a-z][a-z0-9+.-]*:\\/\\/[^/]+/i, match => match.toLowerCase())\n}\n\n/** The host label of a URL, or the raw string when it does not parse. */\nfunction hostOf(url: string): string {\n try {\n return new URL(url).hostname.replace(/^www\\./i, '')\n } catch {\n return url.slice(0, 40)\n }\n}\n\n/** Cap one snippet so one long provider blurb cannot dominate every frame. */\nfunction capSnippet(text: string): string {\n const one = text.replace(/\\s+/g, ' ').trim()\n return one.length > CAPS.snippet ? `${one.slice(0, CAPS.snippet)}…` : one\n}\n\n/** The sources of one result meta, or `[]` when the meta is absent or drifted. */\nfunction readSources(meta: unknown): { url: string; title?: string; snippet?: string }[] {\n if (typeof meta !== 'object' || meta === null) return []\n const raw = (meta as Record<string, unknown>)['sources']\n if (!Array.isArray(raw)) return []\n const out: { url: string; title?: string; snippet?: string }[] = []\n for (const entry of raw) {\n if (typeof entry !== 'object' || entry === null) continue\n const record = entry as Record<string, unknown>\n if (typeof record['url'] !== 'string' || record['url'].trim().length === 0) continue\n const source: { url: string; title?: string; snippet?: string } = { url: record['url'] }\n if (typeof record['title'] === 'string' && record['title'].length > 0) source.title = record['title']\n if (typeof record['snippet'] === 'string' && record['snippet'].length > 0) source.snippet = capSnippet(record['snippet'])\n out.push(source)\n }\n return out\n}\n\n/**\n * The next state after one committed event. Events this fold does not own\n * return the SAME reference, which is what keeps the registry's `Object.is`\n * drive from republishing the key on unrelated frames.\n *\n * @param state - the state covering all prior events.\n * @param event - the next committed session event.\n * @returns the next state (same reference when nothing the fold tracks moved).\n */\nexport function applySearchRefEvent(state: SearchRefState, event: FoldEvent): SearchRefState {\n if (event.type === 'turn/start') {\n const turn = event.data as { turn?: unknown }\n if (typeof turn?.turn !== 'number') return state\n const calls: Record<string, { readonly turn: number; readonly tool: string; readonly queries: readonly string[] }> = {}\n for (const [id, entry] of Object.entries(state.calls)) {\n if (entry.turn >= turn.turn - 1) calls[id] = entry\n }\n return { ...state, turn: turn.turn, calls, latest: { turn: turn.turn, urls: [] } }\n }\n\n if (event.type === 'tool/call') {\n const call = event.data as { callId?: unknown; name?: unknown; arguments?: unknown }\n if (typeof call?.callId !== 'string') return state\n if (typeof call.name !== 'string' || typeof call.arguments !== 'string') return state\n if (SEARCH_TOOLS[call.name] === undefined) return state\n const queries = queriesFromArgs(call.name, call.arguments)\n // An unreadable query is not recorded: the later result then settles nothing,\n // which is the honest reading of \"we do not know what was searched\".\n if (queries === null) return state\n return { ...state, calls: { ...state.calls, [call.callId]: { turn: state.turn, tool: call.name, queries } } }\n }\n\n if (event.type === 'tool/ptc-dispatch') {\n // PTC sub-dispatch settle: same two facts as the native channel — the\n // queries come from the (already-parsed) arguments, the sources come from\n // `meta.sources`, which the host preserves on dispatch events exactly as\n // `tool/result` carries them. A dispatch without meta still folds its\n // queries with zero sources; a failed dispatch counts nothing.\n const d = event.data as { subCallId?: unknown; name?: unknown; arguments?: unknown; isError?: unknown; meta?: unknown }\n if (typeof d?.subCallId !== 'string') return state\n if (d.isError === true) return state\n if (typeof d.name !== 'string') return state\n const queries = queriesOf(d.name, d.arguments)\n if (queries === null) return state\n return settle(state, { tool: d.name, queries, turn: state.turn }, readSources(d.meta))\n }\n\n if (event.type !== 'tool/result') return state\n\n const result = event.data as {\n meta?: unknown\n message?: { content?: readonly { isError?: unknown }[]; source?: { callId?: unknown } }\n }\n const callId = result?.message?.source?.callId\n if (typeof callId !== 'string') return state\n if (result?.message?.content?.[0]?.isError === true) return state\n\n const recorded = state.calls[callId]\n if (recorded === undefined) return state\n return settle(state, recorded, readSources(result.meta))\n}\n\n/**\n * Settle one successful search: fold its returned sources into the item rows\n * and its queries into the query rows. Shared by the native\n * `tool/call`+`tool/result` channel and the PTC `tool/ptc-dispatch`\n * channel — both carry the same `meta.sources` shape.\n *\n * With zero sources the state's `latest` reference is preserved unchanged so\n * the registry's `Object.is` drive does not republish on every frame (PTC\n * searches without meta would otherwise touch the reference per settle).\n */\nfunction settle(\n state: SearchRefState,\n ask: { readonly tool: string; readonly queries: readonly string[]; readonly turn: number },\n sources: readonly { url: string; title?: string; snippet?: string }[],\n): SearchRefState {\n const { tool, queries: asked, turn } = ask\n\n // Sources: front-insert per published order, so the last one published ends\n // up first. A repeat of a known URL updates that row instead of adding one.\n const items = [...state.items]\n let sourceTotal = state.sourceTotal\n const urls: string[] = []\n for (const source of sources) {\n const key = urlKey(source.url)\n urls.push(key)\n const at = items.findIndex(item => urlKey(item.url) === key)\n const previousQueries = at >= 0 ? items[at]?.queries ?? [] : []\n const row: SearchRefItem = {\n url: source.url,\n host: hostOf(source.url),\n ...(source.title !== undefined ? { title: source.title } : {}),\n ...(source.snippet !== undefined ? { snippet: source.snippet } : {}),\n queries: [...new Set([...asked, ...previousQueries])].slice(0, CAPS.queriesPerSource),\n tool,\n count: at < 0 ? 1 : (items[at]?.count ?? 0) + 1,\n lastTurn: turn,\n }\n if (at >= 0) items.splice(at, 1)\n else sourceTotal += 1\n items.unshift(row)\n }\n\n // Queries: newest first, one row per distinct query text, hits accumulating.\n // Every query of the call gets its own row — `web_search` merges N of them\n // and the reader asked what was searched, not which call carried it.\n const queries = [...state.queries]\n let queryTotal = state.queryTotal\n for (const asked2 of asked) {\n const qAt = queries.findIndex(row => row.query === asked2)\n if (qAt >= 0) {\n const previous = queries[qAt]\n queries.splice(qAt, 1)\n queries.unshift({ query: asked2, tool, turn, hits: (previous?.hits ?? 0) + sources.length })\n } else {\n queries.unshift({ query: asked2, tool, turn, hits: sources.length })\n queryTotal += 1\n }\n }\n\n const latest = state.latest\n const nextLatest = latest !== null && latest.turn === turn\n ? { turn: latest.turn, urls: [...urls.reverse(), ...latest.urls].slice(0, CAPS.latest) }\n : latest\n\n if (urls.length === 0) {\n // No sources came back: keep every settled query row, but do NOT rebuild\n // the state object — the unchanged reference keeps the wire quiet.\n return { ...state, queries: queries.slice(0, CAPS.queries), queryTotal, latest }\n }\n\n return {\n ...state,\n items: items.slice(0, CAPS.items),\n queries: queries.slice(0, CAPS.queries),\n sourceTotal,\n queryTotal,\n latest: nextLatest,\n }\n}\n","/**\r\n * The `dshSummarySearchRefs` projection — reading it.\r\n *\r\n * The unit is registered by THIS plugin's host half (key `dshSummarySearchRefs`):\r\n * the queries this session ran — through the harness's `web_search` or the\r\n * user's own `advanced_search` — and the sources those searches brought back.\r\n * It answers \"what did the session pull in from outside\" — where the skill tab\r\n * says which instruction packs were loaded and the memory tab says which of the\r\n * user's own knowledge was injected.\r\n *\r\n * Reading discipline, same as every other brief section:\r\n * - `undefined` = the capability is ABSENT (no projection registry, or a frame\r\n * drifted past repair) → the tab hides;\r\n * - empty lists = the honest empty state (the session has not searched yet);\r\n * - a malformed row is dropped, never thrown.\r\n *\r\n * The module is deliberately PURE — no React, no context, no IO.\r\n */\r\nimport { SEARCH_REFS_KEY } from '../../projection/keys'\r\nimport type { SearchRefItemView, SearchRefView, SearchQueryView } from '../../projection/keys'\r\nimport { urlKey } from '../../projection/search-ref-fold'\r\n\r\n/** The key this plugin's client half subscribes to (re-exported for callers). */\r\nexport { SEARCH_REFS_KEY }\r\n\r\n/** Whether a value is a non-negative safe integer (the view's counters). */\r\nfunction isCounter(value: unknown): value is number {\r\n return typeof value === 'number' && Number.isSafeInteger(value) && value >= 0\r\n}\r\n\r\n/**\r\n * The tool a row came from, defaulting to the plugin's own for a frame written\r\n * before the host half started publishing `tool`. Absent is \"we do not know\",\r\n * never \"not a search\", so the row still shows.\r\n */\r\nfunction readTool(value: unknown): string {\r\n return typeof value === 'string' && value.length > 0 ? value : 'advanced_search'\r\n}\r\n\r\n/**\r\n * The queries that surfaced a source, newest first.\r\n *\r\n * Two legacy shapes are repaired rather than dropped: a frame written before\r\n * the cluster change carries a single `query` string, and a drifted value\r\n * (non-array, or an array of junk) reads as \"member of no cluster\" — the row\r\n * still shows, it just joins the tail group.\r\n */\r\nfunction readQueries(value: unknown): readonly string[] {\r\n if (Array.isArray(value)) {\r\n return [...new Set(value.filter((q): q is string => typeof q === 'string' && q.length > 0))]\r\n }\r\n if (typeof value === 'string' && value.length > 0) return [value]\r\n return []\r\n}\r\n\r\n/** Narrow one source row; `undefined` = malformed, dropped. */\r\nfunction readItem(value: unknown): SearchRefItemView | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as Record<string, unknown>\r\n if (typeof raw['url'] !== 'string' || raw['url'].length === 0) return undefined\r\n if (typeof raw['host'] !== 'string') return undefined\r\n if (!isCounter(raw['count']) || !isCounter(raw['lastTurn'])) return undefined\r\n const item: { -readonly [K in keyof SearchRefItemView]: SearchRefItemView[K] } = {\r\n url: raw['url'],\r\n host: raw['host'],\r\n queries: readQueries(raw['queries'] ?? raw['query']),\r\n tool: readTool(raw['tool']),\r\n count: raw['count'],\r\n lastTurn: raw['lastTurn'],\r\n }\r\n if (typeof raw['title'] === 'string' && raw['title'].length > 0) item.title = raw['title']\r\n if (typeof raw['snippet'] === 'string' && raw['snippet'].length > 0) item.snippet = raw['snippet']\r\n return item\r\n}\r\n\r\n/** Narrow one query row; `undefined` = malformed, dropped. */\r\nfunction readQuery(value: unknown): SearchQueryView | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as Record<string, unknown>\r\n if (typeof raw['query'] !== 'string' || raw['query'].length === 0) return undefined\r\n if (!isCounter(raw['turn']) || !isCounter(raw['hits'])) return undefined\r\n return { query: raw['query'], tool: readTool(raw['tool']), turn: raw['turn'], hits: raw['hits'] }\r\n}\r\n\r\n/** The latest-turn key set, or `null` when absent OR drifted (only a tag rides it). */\r\nfunction readLatest(value: unknown): SearchRefView['latest'] {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return null\r\n const raw = value as Record<string, unknown>\r\n if (!isCounter(raw['turn']) || !Array.isArray(raw['urls'])) return null\r\n return { turn: raw['turn'], urls: raw['urls'].filter((u): u is string => typeof u === 'string' && u.length > 0) }\r\n}\r\n\r\n/**\r\n * Narrow a raw projection value into a search-reference view.\r\n *\r\n * @param value - the raw `unknown` snapshot of the `dshSummarySearchRefs` face.\r\n * @returns the validated view, or `undefined` when the capability is absent.\r\n */\r\nexport function readSearchRefs(value: unknown): SearchRefView | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as Record<string, unknown>\r\n if (!Array.isArray(raw['queries']) || !Array.isArray(raw['sources'])) return undefined\r\n if (!isCounter(raw['queryTotal']) || !isCounter(raw['sourceTotal'])) return undefined\r\n const queries: SearchQueryView[] = []\r\n for (const entry of raw['queries']) {\r\n const narrowed = readQuery(entry)\r\n if (narrowed !== undefined) queries.push(narrowed)\r\n }\r\n const sources: SearchRefItemView[] = []\r\n for (const entry of raw['sources']) {\r\n const narrowed = readItem(entry)\r\n if (narrowed !== undefined) sources.push(narrowed)\r\n }\r\n return {\r\n latest: readLatest(raw['latest']),\r\n queries,\r\n sources,\r\n queryTotal: raw['queryTotal'],\r\n sourceTotal: raw['sourceTotal'],\r\n }\r\n}\r\n\r\n/** Whether one source row was surfaced by the latest turn's searches. */\r\nexport function isLatestSource(view: SearchRefView, url: string): boolean {\r\n return view.latest?.urls.includes(urlKey(url)) === true\r\n}\r\n\r\n/** One query cluster: a question the session asked, and what answered it. */\r\nexport interface SearchCluster {\r\n /** The query text; `''` marks the tail group (sources no listed query claims). */\r\n readonly query: string\r\n readonly tool: string\r\n readonly turn: number\r\n readonly hits: number\r\n readonly items: readonly SearchRefItemView[]\r\n}\r\n\r\n/**\r\n * Cluster the result bubbles under the queries that surfaced them.\r\n *\r\n * Membership is the source's own `queries` list, so a source a merged\r\n * multi-query `web_search` brought back appears under each of them — that is\r\n * what happened, and hiding the repeat would make the counts under the headers\r\n * disagree with the cards on screen. Queries come newest-first from the fold;\r\n * a source no listed query claims (its query aged out of the capped list, or a\r\n * pre-cluster frame) lands in a tail group rather than disappearing.\r\n *\r\n * The section renders every cluster folded; nothing here decides what opens.\r\n */\r\nexport function clusterByQuery(view: SearchRefView): readonly SearchCluster[] {\r\n const claimed = new Set<string>()\r\n const out: SearchCluster[] = []\r\n for (const row of view.queries) {\r\n const items = view.sources.filter(item => item.queries.includes(row.query))\r\n for (const item of items) claimed.add(item.url)\r\n out.push({ query: row.query, tool: row.tool, turn: row.turn, hits: row.hits, items })\r\n }\r\n const rest = view.sources.filter(item => !claimed.has(item.url))\r\n if (rest.length > 0) {\r\n out.push({\r\n query: '',\r\n tool: rest[0]?.tool ?? '',\r\n turn: rest[0]?.lastTurn ?? 0,\r\n hits: rest.length,\r\n items: rest,\r\n })\r\n }\r\n return out\r\n}\r\n\r\n/**\r\n * The href to render for a source URL, or `undefined` when it must not be a link.\r\n *\r\n * Search results are untrusted external data: a `javascript:` or `data:` URL in\r\n * a provider response would otherwise become a clickable footgun in the user's\r\n * own sidebar. Only web schemes get an anchor; everything else renders as text.\r\n */\r\nexport function safeHref(url: string): string | undefined {\r\n try {\r\n const parsed = new URL(url)\r\n return parsed.protocol === 'https:' || parsed.protocol === 'http:' ? parsed.href : undefined\r\n } catch {\r\n return undefined\r\n }\r\n}\r\n","/**\r\n * The `memoryRecall` projection — reading it.\r\n *\r\n * The projection unit is registered by `dsh-prime-memory` (key `memoryRecall`,\r\n * wire view `{rev, sessionId, count, items[]}`): the memories this session has\r\n * actually injected. Unlike\r\n * `memorySlots` (pinned, resident conventions written by hand), this set is\r\n * NOT resident — it is the at-a-glance answer to \"what did the model see\".\r\n * It survives compaction on purpose: `compact` only marks the entries whose\r\n * text left the context as `superseded` (and `/clear` empties the set), so a\r\n * retired row keeps its strike-through instead of vanishing.\r\n *\r\n * This plugin does NOT depend on prime-memory: with the unit unregistered the\r\n * client reads `undefined` from the face and the section hides. The module is\r\n * deliberately PURE — no React, no context, no IO — so the narrowing is\r\n * testable directly, exactly like `memory-slots.ts`.\r\n */\r\n\r\n/** The projection key `dsh-prime-memory` registers (its canonical constant). */\r\nexport const MEMORY_RECALL_KEY = 'memoryRecall'\r\n\r\n/** One recalled memory of the wire view. */\r\nexport interface MemoryRecallItem {\r\n readonly id: string\r\n /** prime-memory's memory type: work_fact / work_method / episodic / … */\r\n readonly type: string\r\n /** First line of the record body (prime-memory truncates for the wire). */\r\n readonly title: string\r\n /** 0–100, the record's own priority. */\r\n readonly priority: number\r\n /** \"When should this surface\" phrases, once prime-memory exposes them. */\r\n readonly scenario?: readonly string[]\r\n /**\r\n * The last mark a HUMAN put on this record: `-1` (declared obsolete) or\r\n * `0..5` (relevance). Absent means never rated — which is NOT the same as\r\n * a zero. prime-memory publishes it on the `memoryRecall` view so the row\r\n * can show the existing mark without a second round-trip.\r\n */\r\n readonly rating?: number\r\n /**\r\n * The record body, whitespace-trimmed and capped by prime-memory. The hover\r\n * bubble reads it straight off the frame — no second round-trip. Absent on\r\n * frames published before that field existed, so the row falls back to\r\n * `title` and the bubble says it has no body.\r\n */\r\n readonly body?: string\r\n /**\r\n * prime-memory says this record has been retired (soft-deleted). It stays in\r\n * the list because its text is still part of what the model saw — and because\r\n * the retirement is the human's verdict; the row just draws a strike-through.\r\n * Absent means alive.\r\n */\r\n readonly retired?: boolean\r\n /**\r\n * The text of this recall has been replaced by a compaction summary, so it is\r\n * no longer in the model's context. Orthogonal to `retired` (both can be set).\r\n * The section hides these by default and reports the count in its footer;\r\n * a retired row is the exception and stays visible. Absent means still in context.\r\n */\r\n readonly superseded?: boolean\r\n}\r\n\r\n/** The whole wire view of one frame. */\r\nexport interface MemoryRecallView {\r\n readonly rev: number\r\n readonly sessionId: string\r\n /** Total recalled-and-alive count; `items` may be a capped prefix of it. */\r\n readonly count: number\r\n /** Most recently injected first. */\r\n readonly items: readonly MemoryRecallItem[]\r\n}\r\n\r\n/** Whether a value is a non-negative safe integer (the view's counter shape). */\r\nfunction isCounter(value: unknown): value is number {\r\n return typeof value === 'number' && Number.isSafeInteger(value) && value >= 0\r\n}\r\n\r\n/** Narrow one item entry; `undefined` = malformed, dropped. */\r\nfunction readItem(value: unknown): MemoryRecallItem | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as Record<string, unknown>\r\n if (typeof raw['id'] !== 'string' || raw['id'].length === 0) return undefined\r\n if (typeof raw['type'] !== 'string' || typeof raw['title'] !== 'string') return undefined\r\n if (typeof raw['priority'] !== 'number') return undefined\r\n const item: { -readonly [K in keyof MemoryRecallItem]: MemoryRecallItem[K] } = {\r\n id: raw['id'],\r\n type: raw['type'],\r\n title: raw['title'],\r\n priority: raw['priority'],\r\n }\r\n if (Array.isArray(raw['scenario'])) {\r\n const phrases = raw['scenario'].filter((s): s is string => typeof s === 'string' && s.length > 0)\r\n if (phrases.length > 0) item.scenario = phrases\r\n }\r\n // A drifted rating (non-number, or outside the -1..5 domain) is dropped\r\n // rather than trusted: the row then simply looks unrated.\r\n const rating = raw['rating']\r\n if (typeof rating === 'number' && Number.isInteger(rating) && rating >= -1 && rating <= 5) item.rating = rating\r\n // A non-string body is dropped rather than trusted: the bubble then says so.\r\n if (typeof raw['body'] === 'string') item.body = raw['body']\r\n // Only true is written; anything else reads back as absent (= alive).\r\n if (raw['retired'] === true) item.retired = true\r\n // Same discipline for the compaction marker: absent means \"still in context\".\r\n if (raw['superseded'] === true) item.superseded = true\r\n return item\r\n}\r\n\r\n/**\r\n * Narrow a raw projection value into a recall view.\r\n *\r\n * `undefined` means the capability is ABSENT (prime-memory not in the\r\n * composition, or no frame carried the key) or the frame drifted beyond repair;\r\n * a view with `items: []` IS the honest empty state (prime-memory publishes as\r\n * soon as the unit registers). Malformed items are dropped, never thrown on.\r\n *\r\n * @param value - the raw `unknown` snapshot of the `memoryRecall` face.\r\n * @returns the validated view, or `undefined` when the capability is absent.\r\n */\r\nexport function readRecall(value: unknown): MemoryRecallView | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as Record<string, unknown>\r\n if (!isCounter(raw['rev']) || !isCounter(raw['count'])) return undefined\r\n if (typeof raw['sessionId'] !== 'string') return undefined\r\n if (!Array.isArray(raw['items'])) return undefined\r\n const items: MemoryRecallItem[] = []\r\n for (const entry of raw['items']) {\r\n const item = readItem(entry)\r\n if (item !== undefined) items.push(item)\r\n }\r\n return { rev: raw['rev'], sessionId: raw['sessionId'], count: raw['count'], items }\r\n}\r\n","/**\r\n * The `memorySlots` projection — reading it.\r\n *\r\n * The projection unit is registered by `dsh-prime-memory` (key `memorySlots`,\r\n * wire view `{rev, count, openCount, slots[]}`); this plugin does NOT depend\r\n * on it — when the unit is not registered the client reads `undefined` from\r\n * `faceOf` and the section hides. This module is the read side of that\r\n * contract and is deliberately PURE — no React, no context, no IO — so the\r\n * narrowing can be tested directly.\r\n *\r\n * Forward compatibility: the shipped view carries `{id, title, kind, status,\r\n * priority}` only. A future prime-memory release may add `body`/`refs` to the\r\n * wire view (its projection plan keeps that door open); those fields are\r\n * narrowed opportunistically — present and well-formed → kept, absent or\r\n * malformed → dropped — so the section renders them without a brief-sidebar\r\n * change, and a malformed extra field can never blank the section.\r\n */\r\n\r\n/** The projection key `dsh-prime-memory` registers (its canonical constant). */\r\nexport const MEMORY_SLOTS_KEY = 'memorySlots'\r\n\r\n/** One slot of the wire view. */\r\nexport interface MemorySlotView {\r\n readonly id: string\r\n readonly title: string\r\n /** One of prime-memory's `SLOT_KINDS`: rule / todo / anchor / pointer. */\r\n readonly kind: string\r\n /** One of prime-memory's `SLOT_STATUSES`: open / done / dropped / expired. */\r\n readonly status: string\r\n /** 0–100; higher wins the activation competition. */\r\n readonly priority: number\r\n /** Slot body, once prime-memory exposes it on the wire (truncated at render). */\r\n readonly body?: string\r\n /** Reference targets, once prime-memory exposes them on the wire. */\r\n readonly refs?: readonly string[]\r\n /**\r\n * record_id 引用的展示解析(v0.5.0 契约:ref → `[type] 名称简述`),由\r\n * prime-memory 在投影帧构建时解析;路径/URL 类引用不产生条目。存在才收。\r\n */\r\n readonly refViews?: readonly SlotRefView[]\r\n}\r\n\r\n/** 一条 record_id 引用的展示解析(与 prime-memory 的 SlotRefView 同形)。 */\r\nexport interface SlotRefView {\r\n readonly ref: string\r\n readonly title: string\r\n /** 记忆文件相对路径(`<type>/<name>.memory.md`)。 */\r\n readonly filePath?: string\r\n /** 记忆归属的工作区绝对路径;undefined = global。 */\r\n readonly workspaceId?: string\r\n}\r\n\r\n/** The whole wire view of one frame. */\r\nexport interface MemorySlotsView {\r\n readonly rev: number\r\n readonly count: number\r\n readonly openCount: number\r\n readonly slots: readonly MemorySlotView[]\r\n}\r\n\r\n/**\r\n * Narrow a raw projection value into a memory-slots view.\r\n *\r\n * Two outcomes are kept apart, mirroring the deliverables read side:\r\n * - `undefined` — the capability is ABSENT (prime-memory is not in the\r\n * composition, or no frame has carried the key yet), or the frame is\r\n * malformed beyond repair (a shape drift must not blank the whole tab);\r\n * - a view — the projection is live. A view with `slots: []` IS the empty\r\n * state: prime-memory publishes as soon as the unit registers, so \"present\r\n * but empty\" is a real value, not a sentinel.\r\n *\r\n * Malformed slot entries are dropped rather than thrown on (trusted-Host\r\n * value, defensive display), like `readTodos`.\r\n *\r\n * @param value - the raw `unknown` snapshot of the `memorySlots` face.\r\n * @returns the validated view, or `undefined` when the capability is absent.\r\n */\r\nexport function readSlots(value: unknown): MemorySlotsView | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as Record<string, unknown>\r\n if (!isCounter(raw['rev']) || !isCounter(raw['count']) || !isCounter(raw['openCount'])) return undefined\r\n if (!Array.isArray(raw['slots'])) return undefined\r\n const slots: MemorySlotView[] = []\r\n for (const entry of raw['slots']) {\r\n const slot = readSlot(entry)\r\n if (slot !== undefined) slots.push(slot)\r\n }\r\n return { rev: raw['rev'], count: raw['count'], openCount: raw['openCount'], slots }\r\n}\r\n\r\n/** Whether a value is a non-negative safe integer (the view's counter shape). */\r\nfunction isCounter(value: unknown): value is number {\r\n return typeof value === 'number' && Number.isSafeInteger(value) && value >= 0\r\n}\r\n\r\n/** Narrow one slot entry; `undefined` = malformed, dropped. */\r\nfunction readSlot(value: unknown): MemorySlotView | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as Record<string, unknown>\r\n if (typeof raw['id'] !== 'string' || raw['id'].length === 0) return undefined\r\n if (typeof raw['title'] !== 'string') return undefined\r\n if (typeof raw['kind'] !== 'string' || typeof raw['status'] !== 'string') return undefined\r\n if (typeof raw['priority'] !== 'number') return undefined\r\n const slot: { -readonly [K in keyof MemorySlotView]: MemorySlotView[K] } = {\r\n id: raw['id'],\r\n title: raw['title'],\r\n kind: raw['kind'],\r\n status: raw['status'],\r\n priority: raw['priority'],\r\n }\r\n if (typeof raw['body'] === 'string' && raw['body'].length > 0) slot.body = raw['body']\r\n if (Array.isArray(raw['refs'])) {\r\n const refs = raw['refs'].filter((ref): ref is string => typeof ref === 'string' && ref.length > 0)\r\n if (refs.length > 0) slot.refs = refs\r\n }\r\n if (Array.isArray(raw['refViews'])) {\r\n const views: SlotRefView[] = []\r\n for (const entry of raw['refViews']) {\r\n if (entry === null || typeof entry !== 'object' || Array.isArray(entry)) continue\r\n const view = entry as Record<string, unknown>\r\n if (typeof view['ref'] !== 'string' || view['ref'].length === 0) continue\r\n if (typeof view['title'] !== 'string' || view['title'].length === 0) continue\r\n views.push({\r\n ref: view['ref'],\r\n title: view['title'],\r\n ...(typeof view['filePath'] === 'string' && view['filePath'].length > 0 ? { filePath: view['filePath'] } : {}),\r\n ...(typeof view['workspaceId'] === 'string' && view['workspaceId'].length > 0 ? { workspaceId: view['workspaceId'] } : {}),\r\n })\r\n }\r\n if (views.length > 0) slot.refViews = views\r\n }\r\n return slot\r\n}\r\n\r\n/** The body length at which the section truncates (full text rides the title tooltip). */\r\nexport const BODY_TRUNCATE_AT = 120\r\n\r\n/**\r\n * One-line truncation for a slot body. Already-short bodies pass through;\r\n * longer ones are cut at the limit with an ellipsis.\r\n */\r\nexport function truncateBody(body: string, limit = BODY_TRUNCATE_AT): string {\r\n const flat = body.replaceAll(/\\s+/g, ' ').trim()\r\n return flat.length <= limit ? flat : `${flat.slice(0, limit)}…`\r\n}\r\n","/**\r\n * Structural views of the `configForms` settings seam (DSH 0.1.7+).\r\n *\r\n * The settings card and the memory-section gate consume only these members of\r\n * the `ConfigForm` handle that `configForms.get(entryId)` returns, so the real\r\n * `@deepseek-ai/dsh-client-ui-settings/client` type graph is never imported —\r\n * the same reason `use-projection.ts` declares its own session faces and\r\n * `dock-shadow.tsx` its own slots face.\r\n *\r\n * `configForms` serves the STORED doc: a `.volatile()` field arrives as a\r\n * plain value here (the host unwraps the live refs before persistence), so\r\n * the client reads a plain config shape.\r\n */\r\n\r\n/** One snapshot of an entry's stored config. */\r\nexport interface SettingsScopeSnapshot<T> {\r\n status: 'loading' | 'ready' | 'unavailable'\r\n value: T | undefined\r\n revision: number | undefined\r\n /** Whether the current face may write (a read-only seat disables the controls). */\r\n writable: boolean\r\n}\r\n\r\n/** The `ConfigForm` handle face this plugin uses. */\r\nexport interface SettingsScope<T> {\r\n getSnapshot(): SettingsScopeSnapshot<T>\r\n subscribe(listener: () => void): () => void\r\n set(field: string, value: unknown): Promise<boolean>\r\n unset(field: string): Promise<boolean>\r\n}\r\n\r\n/** Structural view of the `configForms` cordis service, keyed by entry id. */\r\nexport interface ConfigFormsLike {\r\n get<T>(entryId: string): SettingsScope<T>\r\n}\r\n\r\n/**\r\n * This plugin's entry config, as the client reads it. Only the fields the\r\n * browser half consumes are declared; the schema (node half `Config`) owns\r\n * the full surface.\r\n */\r\nexport interface BriefClientConfig {\r\n /** Whether the summary tab renders the memory-slots section (default: off). */\r\n showMemorySlots?: boolean\r\n /** Whether the summary tab renders the session-recall section (default: on). */\r\n showMemoryRecall?: boolean\r\n /** Whether the reference pane keeps the echo tab (default: on). */\r\n showSpiritEcho?: boolean\r\n}\r\n\r\n/**\r\n * The slots switch's default. Flipped to OFF alongside prime-memory's\r\n * `memoryRecall` projection: a hand-pinned resident convention is a real\r\n * feature, but listing it as a permanent card in the summary pane taught\r\n * users to read \"memory\" as \"resident\", which is the opposite of how recall\r\n * works. The section still only appears when the `memorySlots` projection\r\n * exists, and stays one click away for anyone who wants it back.\r\n */\r\nexport const DEFAULT_SHOW_MEMORY_SLOTS = false\r\n\r\n/** The session-recall switch's default (on: it is the honest memory view). */\r\nexport const DEFAULT_SHOW_MEMORY_RECALL = true\r\n\r\n/**\r\n * Resolve the switch from one snapshot (pure; testable). Any\r\n * cannot-answer shape falls back to {@link DEFAULT_SHOW_MEMORY_SLOTS}; an\r\n * explicit `false` is the only off.\r\n */\r\nexport function resolveShowMemorySlots(\r\n snapshot: SettingsScopeSnapshot<BriefClientConfig> | undefined,\r\n): boolean {\r\n if (snapshot === undefined || snapshot.status !== 'ready') return DEFAULT_SHOW_MEMORY_SLOTS\r\n return snapshot.value?.showMemorySlots === true\r\n}\r\n\r\n/**\r\n * Resolve the session-recall switch from one snapshot (pure; testable).\r\n * Any cannot-answer shape falls back to {@link DEFAULT_SHOW_MEMORY_RECALL};\r\n * an explicit `false` is the only off.\r\n */\r\nexport function resolveShowMemoryRecall(\r\n snapshot: SettingsScopeSnapshot<BriefClientConfig> | undefined,\r\n): boolean {\r\n if (snapshot === undefined || snapshot.status !== 'ready') return DEFAULT_SHOW_MEMORY_RECALL\r\n return snapshot.value?.showMemoryRecall !== false\r\n}\r\n\r\n/** The echo tab's default (on: it is the honest view of this session's recall). */\r\nexport const DEFAULT_SHOW_SPIRIT_ECHO = true\r\n\r\n/**\r\n * Resolve the echo-tab switch from one snapshot (pure; testable). Any\r\n * cannot-answer shape falls back to {@link DEFAULT_SHOW_SPIRIT_ECHO}; an\r\n * explicit `false` is the only off — same rule as the two memory switches.\r\n */\r\nexport function resolveShowSpiritEcho(\r\n snapshot: SettingsScopeSnapshot<BriefClientConfig> | undefined,\r\n): boolean {\r\n if (snapshot === undefined || snapshot.status !== 'ready') return DEFAULT_SHOW_SPIRIT_ECHO\r\n return snapshot.value?.showSpiritEcho !== false\r\n}\r\n","/**\r\n * The shared `configForms` subscription behind this plugin's section switches.\r\n *\r\n * Both memory sections (pinned slots / session recall) gate on one boolean of\r\n * this plugin's entry config. The plumbing — defensive scope resolution,\r\n * `useSyncExternalStore`, and a stable absent-snapshot — is identical, so it\r\n * lives here once; each section passes its own pure resolver, which is what\r\n * the unit tests pin.\r\n *\r\n * A host without `configForms` (or a scope still loading) degrades to the\r\n * resolver's default instead of throwing inside a render.\r\n */\r\nimport { useCallback, useMemo, useSyncExternalStore } from 'react'\r\nimport type { CtxProbe } from '../use-projection'\r\nimport type { BriefClientConfig, ConfigFormsLike, SettingsScopeSnapshot } from '../scope-face'\r\n\r\n/**\r\n * The snapshot served while no config scope is reachable — every resolver\r\n * maps it to its own default.\r\n */\r\nconst ABSENT_SNAPSHOT: SettingsScopeSnapshot<BriefClientConfig> = {\r\n status: 'unavailable',\r\n value: undefined,\r\n revision: undefined,\r\n writable: false,\r\n}\r\n\r\n/** A no-op unsubscribe source, kept as one identity so the absent-scope\r\n * subscription never thrashes (a store contract requires a disposer). */\r\nconst NO_SUBSCRIBE = (): (() => void) => () => {}\r\n\r\n/**\r\n * Read one config switch, live.\r\n *\r\n * @param ctx - the client root context handed to the tab body.\r\n * @param resolve - pure snapshot → boolean resolver (owns the default).\r\n * @returns the resolved switch value.\r\n */\r\nexport function useConfigFlag(\r\n ctx: CtxProbe | undefined,\r\n resolve: (snapshot: SettingsScopeSnapshot<BriefClientConfig> | undefined) => boolean,\r\n): boolean {\r\n const scope = useMemo(() => {\r\n if (ctx === undefined) return undefined\r\n const configForms = ctx.get('configForms') as ConfigFormsLike | undefined\r\n if (configForms === undefined || typeof configForms.get !== 'function') return undefined\r\n return configForms.get<BriefClientConfig>('dsh-brief-sidebar')\r\n }, [ctx])\r\n\r\n const subscribe = useCallback(\r\n (listener: () => void) => scope?.subscribe(listener) ?? NO_SUBSCRIBE(),\r\n [scope],\r\n )\r\n const getSnapshot = useCallback(\r\n () => scope?.getSnapshot() ?? ABSENT_SNAPSHOT,\r\n [scope],\r\n )\r\n\r\n return resolve(useSyncExternalStore(subscribe, getSnapshot, getSnapshot))\r\n}\r\n","/**\r\n * The skill-usage section: the `dshSummarySkillUsage` projection drawn as one\r\n * part of the summary tab.\r\n *\r\n * Where `MemoryRecallSection` answers \"what memories did the model see\", this\r\n * answers \"which instruction packs entered the context, and which ones were on\r\n * the menu\". Two groups, deliberately not merged:\r\n *\r\n * - **已引用** — the skill's instructions reached the conversation, either\r\n * because the model called the `skill` tool or because the user invoked it\r\n * directly (the host then injects `<skill_content>` and tells the model not\r\n * to call the tool — reading only the tool would miss over half of those\r\n * sessions, measured on 250 real ones).\r\n * - **本会话可用** — the session's current catalog. Available is NOT used: the\r\n * model may never touch any of these, so it is collapsed behind a counted\r\n * toggle and never mixed into the reference rows.\r\n *\r\n * Like the deliverables section this is an OPTIONAL capability on both sides:\r\n * no projection registry (or a host half that never registered the unit) means\r\n * the client reads capability absence and the section hides. No settings switch\r\n * gates it either — the list is a read-only fact about the session, not a\r\n * preference.\r\n *\r\n * Two contracts this row honours, both learned on the recall section:\r\n * - **no native `title` attribute** — it paints an unskinable tooltip that\r\n * overlaps the plugin's own bubble; nothing here needs one;\r\n * - **colours from `--dsw-alias-*` tokens only** (skin contract).\r\n */\r\nimport { createElement } from 'react'\r\nimport { useState } from 'react'\r\nimport type { CSSProperties, ReactNode } from 'react'\r\nimport type { CtxProbe } from '../use-projection'\r\nimport { SKILL_USAGE_KEY } from '../../projection/keys'\r\nimport { useProjectionValue } from '../use-projection'\r\nimport { availableExcept, expandPair, readSkillUsage } from './skill-usage'\r\nimport { GroupCaption, GroupHeader, FoldToggle } from './FoldToggle'\r\nimport { expandCount } from '../locales'\r\n\r\nexport interface SkillUsageSectionProps {\r\n /** The DSH locale lookup, passed down from `apply`. */\r\n t: (key: string) => string\r\n /** The client root context (the tab body's only way to reach services). */\r\n ctx?: CtxProbe\r\n /** The session this tab is scoped to. */\r\n scope?: { readonly sessionId?: string }\r\n /**\r\n * Drop the section header. The references tab already says “技能”, so\r\n * repeating it as a heading inside the pane is noise; standalone renders\r\n * (and every existing test) keep the default `false`.\r\n */\r\n hideHeader?: boolean\r\n}\r\n\r\nconst SECTION_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n borderBottom: '1px solid var(--dsw-alias-border-secondary)',\r\n}\r\n\r\nconst HEADER_STYLE: CSSProperties = {\r\n padding: '10px 12px 0',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n fontSize: 12,\r\n fontWeight: 600,\r\n}\r\n\r\nconst LIST_STYLE: CSSProperties = {\r\n listStyle: 'none',\r\n margin: 0,\r\n padding: '6px 0',\r\n display: 'flex',\r\n flexDirection: 'column',\r\n}\r\n\r\nconst ROW_STYLE: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'baseline',\r\n gap: 8,\r\n padding: '6px 12px',\r\n}\r\n\r\n/** The skill name: primary-ish but never the loudest thing in the row. */\r\nconst NAME_STYLE: CSSProperties = {\r\n minWidth: 0,\r\n overflowWrap: 'anywhere',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n}\r\n\r\n/** The per-skill load tally, tertiary so the name stays the reading target. */\r\nconst COUNT_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 11,\r\n}\r\n\r\n/** The \"本轮\" pill: same form as the deliverables codeplan tag. */\r\nconst TAG_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n border: '1px solid var(--dsw-alias-label-tertiary)',\r\n borderRadius: 999,\r\n padding: '0 6px',\r\n fontSize: 11,\r\n lineHeight: '16px',\r\n whiteSpace: 'nowrap',\r\n}\r\n\r\nconst FOOTER_STYLE: CSSProperties = {\r\n padding: '0 12px 10px',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 11,\r\n}\r\n\r\nconst EMPTY_STYLE: CSSProperties = {\r\n margin: '0 auto',\r\n padding: 24,\r\n maxWidth: 460,\r\n textAlign: 'center',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n lineHeight: 1.7,\r\n fontSize: 12,\r\n}\r\n\r\n/**\r\n * The skill-usage section. The subscription is unconditional (a plain listener,\r\n * not IO); the view decides whether anything is drawn.\r\n *\r\n * @param props - translation, client context, session scope.\r\n */\r\nexport function SkillUsageSection(props: SkillUsageSectionProps): ReactNode {\r\n const { t, ctx, scope, hideHeader = false } = props\r\n const [availableOpen, setAvailableOpen] = useState(false)\r\n\r\n const view = readSkillUsage(useProjectionValue(ctx, scope?.sessionId, SKILL_USAGE_KEY))\r\n\r\n // Capability absent — the optional unit never registered. Hide, don't nag.\r\n if (view === undefined) return null\r\n\r\n const referenced = view.session.map(entry => entry.name)\r\n // 可用组只列未被引用的那些:同一个技能不该占两行。\r\n const rest = availableExcept(view.available, referenced)\r\n const latestNames = view.latest?.names ?? []\r\n\r\n return createElement(\r\n 'div',\r\n { style: SECTION_STYLE, 'data-dsh-brief-sidebar': 'skill-usage-section' },\r\n !hideHeader && createElement('div', { style: HEADER_STYLE }, t('section.skillUsage')),\r\n view.session.length === 0 && createElement(\r\n 'div',\r\n { style: EMPTY_STYLE },\r\n createElement('div', { style: { marginBottom: 6, color: 'var(--dsw-alias-label-secondary)' } }, t('skillUsage.empty')),\r\n createElement('div', null, t('skillUsage.emptyHint')),\r\n ),\r\n view.session.length > 0 && createElement(GroupHeader, {\r\n text: expandCount(t('skillUsage.invokedGroup'), view.session.length),\r\n marker: 'skill-usage-invoked-group',\r\n }),\r\n createElement(\r\n 'ul',\r\n { style: LIST_STYLE },\r\n view.session.map(entry => createElement(\r\n 'li',\r\n { key: entry.name, style: ROW_STYLE, 'data-dsh-brief-sidebar': 'skill-usage-row' },\r\n createElement('span', { style: NAME_STYLE }, entry.name),\r\n createElement('span', { style: COUNT_STYLE }, expandPair(t('skillUsage.uses'), entry.count, entry.count)),\r\n latestNames.includes(entry.name) && createElement('span', { style: TAG_STYLE }, t('skillUsage.latestTag')),\r\n )),\r\n ),\r\n rest.length > 0 && createElement(FoldToggle, {\r\n label: expandCount(t('skillUsage.availableGroup'), rest.length),\r\n open: availableOpen,\r\n marker: 'skill-usage-available-toggle',\r\n onToggle: () => { setAvailableOpen(current => !current) },\r\n }),\r\n // 清单有上限:开关行说收了多少个名字,附注说这一帧真发了多少。\r\n rest.length > 0 && view.availableCount > view.available.length && createElement(GroupCaption, {\r\n text: expandCount(t('skillUsage.availableCapped'), view.availableCount),\r\n marker: 'skill-usage-available-capped',\r\n }),\r\n availableOpen && createElement(\r\n 'ul',\r\n { style: LIST_STYLE },\r\n rest.map(name => createElement(\r\n 'li',\r\n { key: name, style: ROW_STYLE, 'data-dsh-brief-sidebar': 'skill-usage-available-row' },\r\n createElement('span', { style: NAME_STYLE }, name),\r\n )),\r\n ),\r\n // 列表有上限,页脚说真数:加载次数与去重后的技能数各归各。\r\n view.session.length > 0 && createElement('div', { style: FOOTER_STYLE }, expandPair(t('skillUsage.count'), view.callTotal, view.sessionTotal)),\r\n )\r\n}\r\n","/**\r\n * The search-reference section: the `dshSummarySearchRefs` projection drawn as\r\n * one tab of the references section.\r\n *\r\n * It answers \"what did this session pull in from outside\" as a list of the\r\n * questions the session asked: **one line per query, every one folded**. Opening\r\n * a line reveals that query's results as left-aligned bubbles — title as a link,\r\n * host and provider snippet under it — in the same reading idiom as the\r\n * conversation to the left.\r\n *\r\n * Folded-by-default is a deliberate call, not a leftover: a tab that spills its\r\n * whole result set the moment it is clicked buries the question list the reader\r\n * came to scan, and one session can carry forty results across eight queries.\r\n *\r\n * Each line counts what it actually holds, never what the call returned: a query\r\n * whose results aged out of the capped source list reads \"0\" and is drawn as a\r\n * plain line with no chevron, because a switch that opens onto nothing is worse\r\n * than no switch. Sources no listed query claims (their query aged out, or the\r\n * frame predates the cluster change) collect in a tail group rather than vanish.\r\n *\r\n * The fold still records which tool (`web_search` or the user's own\r\n * `advanced_search`) answered each query; that stays in the frame for any surface\r\n * that wants it and is not drawn here. An older `dsh-free-search` without\r\n * `presentationMeta` yields queries with no sources at all — that degraded case\r\n * is stated (`searchRefs.noSourcesHint`) rather than left as an empty pane,\r\n * because an empty list reads as \"the search found nothing\".\r\n *\r\n * Optional on both sides: no registry, or a host half that never registered the\r\n * unit, means the client reads capability absence and the section hides.\r\n *\r\n * Two contracts inherited from the recall section:\r\n * - **no native `title` attribute** — the whole text rides the row or is left\r\n * out; an unskinable tooltip would overlap the plugin's own surfaces;\r\n * - **colours from `--dsw-alias-*` tokens only** (skin contract).\r\n *\r\n * Source links are untrusted external data, so only `http`/`https` become\r\n * anchors (see `safeHref`) and they open with `rel=\"noreferrer noopener\"`.\r\n */\r\nimport { createElement, useState } from 'react'\r\nimport type { CSSProperties, ReactNode } from 'react'\r\nimport type { CtxProbe } from '../use-projection'\r\nimport { SEARCH_REFS_KEY } from '../../projection/keys'\r\nimport type { SearchRefItemView } from '../../projection/keys'\r\nimport { useProjectionValue } from '../use-projection'\r\nimport { FoldToggle, GroupHeader } from './FoldToggle'\r\nimport { expandCount, expandTotal } from '../locales'\r\nimport { clusterByQuery, isLatestSource, readSearchRefs, safeHref } from './search-refs'\r\n\r\nexport interface SearchRefSectionProps {\r\n /** The DSH locale lookup, passed down from `apply`. */\r\n t: (key: string) => string\r\n /** The client root context (the tab body's only way to reach services). */\r\n ctx?: CtxProbe\r\n /** The session this tab is scoped to. */\r\n scope?: { readonly sessionId?: string }\r\n /** Drop the section header (the references tab already names it). */\r\n hideHeader?: boolean\r\n}\r\n\r\nconst SECTION_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n borderBottom: '1px solid var(--dsw-alias-border-secondary)',\r\n}\r\n\r\nconst HEADER_STYLE: CSSProperties = {\r\n padding: '10px 12px 0',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n fontSize: 12,\r\n fontWeight: 600,\r\n}\r\n\r\nconst LIST_STYLE: CSSProperties = {\r\n listStyle: 'none',\r\n margin: 0,\r\n padding: '8px 12px 10px',\r\n display: 'flex',\r\n flexDirection: 'column',\r\n alignItems: 'flex-start',\r\n gap: 8,\r\n}\r\n\r\n/**\r\n * One result, drawn as a chat bubble: left-aligned, background-filled, rounded,\r\n * and narrower than the column. The reader reads this tab the way they read the\r\n * conversation to its left — each bubble is one thing the session pulled in — so\r\n * the list chrome (row rules, group headers, per-query title lines) is dropped\r\n * rather than restyled.\r\n *\r\n * `alignItems: flex-start` on the list is what keeps bubbles hugging the left\r\n * edge; without it a flex child stretches to the full column and the bubble\r\n * reads as a plain card.\r\n */\r\nconst BUBBLE_STYLE: CSSProperties = {\r\n maxWidth: '92%',\r\n padding: '8px 10px',\r\n borderRadius: 10,\r\n background: 'var(--dsw-alias-bg-layer-3)',\r\n border: '1px solid var(--dsw-alias-border-l2)',\r\n color: 'var(--dsw-alias-label-primary)',\r\n fontSize: 12,\r\n lineHeight: '17px',\r\n minWidth: 0,\r\n display: 'flex',\r\n flexDirection: 'column',\r\n gap: 2,\r\n}\r\n\r\n/** The source title, up to three lines: inside a bubble it IS the content. */\r\nconst TITLE_STYLE: CSSProperties = {\r\n minWidth: 0,\r\n overflowWrap: 'anywhere',\r\n display: '-webkit-box',\r\n WebkitLineClamp: 3,\r\n WebkitBoxOrient: 'vertical',\r\n overflow: 'hidden',\r\n}\r\n\r\nconst SNIPPET_STYLE: CSSProperties = {\r\n margin: 0,\r\n minWidth: 0,\r\n overflowWrap: 'anywhere',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 11,\r\n lineHeight: '16px',\r\n}\r\n\r\nconst HOST_STYLE: CSSProperties = {\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 11,\r\n lineHeight: '16px',\r\n overflowWrap: 'anywhere',\r\n}\r\n\r\n/** The bubble's own footer strip — where the \"本轮\" pill lives now. */\r\nconst BUBBLE_FOOT_STYLE: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'center',\r\n gap: 6,\r\n marginTop: 2,\r\n minWidth: 0,\r\n}\r\n\r\n/** The \"本轮\" pill: same form as the skill tag, tertiary emphasis. */\r\nconst TAG_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n border: '1px solid var(--dsw-alias-label-tertiary)',\r\n borderRadius: 999,\r\n padding: '0 6px',\r\n fontSize: 11,\r\n lineHeight: '16px',\r\n whiteSpace: 'nowrap',\r\n}\r\n\r\nconst FOOTER_STYLE: CSSProperties = {\r\n padding: '0 12px 10px',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 11,\r\n}\r\n\r\nconst EMPTY_STYLE: CSSProperties = {\r\n margin: '0 auto',\r\n padding: 24,\r\n maxWidth: 460,\r\n textAlign: 'center',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n lineHeight: 1.7,\r\n fontSize: 12,\r\n}\r\n\r\n/**\r\n * The search-reference section. The subscription is unconditional (a plain\r\n * listener, not IO); the view decides whether anything is drawn.\r\n *\r\n * @param props - translation, client context, session scope, header switch.\r\n */\r\nexport function SearchRefSection(props: SearchRefSectionProps): ReactNode {\r\n const { t, ctx, scope, hideHeader = false } = props\r\n\r\n const view = readSearchRefs(useProjectionValue(ctx, scope?.sessionId, SEARCH_REFS_KEY))\r\n\r\n // Which clusters the reader has opened, keyed by query text. The default is\r\n // **folded for every one of them** — including the current turn's — because a\r\n // tab that dumps its contents the moment it is clicked is a tab the reader has\r\n // to fight. Keying the overrides means new projection frames cannot reset what\r\n // they just opened.\r\n const [openMap, setOpenMap] = useState<Readonly<Record<string, boolean>>>({})\r\n\r\n // Capability absent — the optional unit never registered. Hide, don't nag.\r\n if (view === undefined) return null\r\n\r\n if (view.queries.length === 0 && view.sources.length === 0) {\r\n return createElement(\r\n 'div',\r\n { style: SECTION_STYLE, 'data-dsh-brief-sidebar': 'search-refs-section' },\r\n !hideHeader && createElement('div', { style: HEADER_STYLE }, t('section.searchRefs')),\r\n createElement(\r\n 'div',\r\n { style: EMPTY_STYLE },\r\n createElement('div', { style: { marginBottom: 6, color: 'var(--dsw-alias-label-secondary)' } }, t('searchRefs.empty')),\r\n createElement('div', null, t('searchRefs.emptyHint')),\r\n ),\r\n )\r\n }\r\n\r\n const body: ReactNode[] = []\r\n\r\n /** One result bubble; shared by every cluster so the cards stay identical. */\r\n const renderBubble = (item: SearchRefItemView): ReactNode => {\r\n const href = safeHref(item.url)\r\n const label = item.title ?? item.url\r\n const link = href === undefined\r\n // A non-web scheme (or a malformed URL) from a provider stays text:\r\n // it must not become a clickable thing in the user's sidebar.\r\n ? createElement('span', { style: TITLE_STYLE }, label)\r\n : createElement(\r\n 'a',\r\n { style: TITLE_STYLE, href, target: '_blank', rel: 'noreferrer noopener' },\r\n label,\r\n )\r\n const latest = isLatestSource(view, item.url)\r\n return createElement(\r\n 'li',\r\n { key: item.url, style: { minWidth: 0 }, 'data-dsh-brief-sidebar': 'search-refs-source' },\r\n createElement(\r\n 'div',\r\n { style: BUBBLE_STYLE, 'data-dsh-brief-sidebar': 'search-refs-bubble' },\r\n link,\r\n createElement('span', { style: HOST_STYLE }, item.host),\r\n item.snippet !== undefined && createElement('p', { style: SNIPPET_STYLE }, item.snippet),\r\n // The pill sits inside the bubble so a result and its freshness\r\n // cannot drift apart when the column scrolls.\r\n (latest || item.count > 1) && createElement(\r\n 'div',\r\n { style: BUBBLE_FOOT_STYLE },\r\n latest && createElement('span', { style: TAG_STYLE }, t('searchRefs.latestTag')),\r\n // Surfaced by more than one settled search — a fact about the\r\n // source, drawn on it rather than in a header the tab no longer\r\n // has. No new locale key: the count speaks for itself.\r\n item.count > 1 && createElement('span', { style: HOST_STYLE }, `\\u00d7${item.count}`),\r\n ),\r\n ),\r\n )\r\n }\r\n\r\n if (view.sources.length > 0) {\r\n // Results clustered under the query that surfaced them, every cluster folded\r\n // to one line. Eight searches read as eight questions and nothing else; the\r\n // reader opens the one they care about.\r\n for (const cluster of clusterByQuery(view)) {\r\n const key = cluster.query === '' ? '\\u0000tail' : cluster.query\r\n // The count on a heading is the count *inside* it. The fold's `hits` is\r\n // what the call returned session-wide; a source can since have aged out of\r\n // the capped list, and a heading promising five cards over an empty pane\r\n // is the bug this line exists to prevent.\r\n const shown = expandCount(t('searchRefs.hits'), cluster.items.length)\r\n if (cluster.items.length === 0) {\r\n // Nothing to open: a plain line, not a chevron that reveals an empty\r\n // group. The query still shows, because \"it was asked\" is the fact. (A\r\n // tail group never gets here — it only exists when it holds sources.)\r\n body.push(createElement(GroupHeader, {\r\n key: `h:${key}`,\r\n text: `${cluster.query} · ${shown}`,\r\n marker: 'search-refs-cluster-empty',\r\n }))\r\n continue\r\n }\r\n const open = openMap[key] === true\r\n body.push(createElement(FoldToggle, {\r\n key: `h:${key}`,\r\n // The tail group has no query to name it, so it borrows the source\r\n // count heading — “来源 · N” is exactly what it holds, and no locale key\r\n // gets spent on a case that only shows up when a query aged out of the\r\n // capped list.\r\n label: cluster.query === ''\r\n ? expandCount(t('searchRefs.sourceGroup'), cluster.items.length)\r\n : `${cluster.query} · ${shown}`,\r\n open,\r\n marker: 'search-refs-cluster',\r\n onToggle: () => { setOpenMap(prev => ({ ...prev, [key]: !open })) },\r\n }))\r\n if (!open) continue\r\n body.push(createElement(\r\n 'ul',\r\n { key: `b:${key}`, style: LIST_STYLE, 'data-dsh-brief-sidebar': 'search-refs-cluster-items' },\r\n cluster.items.map(renderBubble),\r\n ))\r\n }\r\n } else {\r\n // 有查询无来源:老版 dsh-free-search 不发 meta。说清楚,别让人以为搜了没结果。\r\n body.push(createElement(\r\n 'div',\r\n { key: 'ns', style: FOOTER_STYLE, 'data-dsh-brief-sidebar': 'search-refs-no-sources' },\r\n t('searchRefs.noSourcesHint'),\r\n ))\r\n }\r\n\r\n // 列表有上限,页脚说真数:只有真数超过列表长度时才出现,免得两个数字打架。\r\n if (view.queryTotal > view.queries.length || view.sourceTotal > view.sources.length) {\r\n body.push(createElement(\r\n 'div',\r\n { key: 'cap', style: FOOTER_STYLE, 'data-dsh-brief-sidebar': 'search-refs-capped' },\r\n expandTotal(t('searchRefs.capped'), Math.max(view.queryTotal, view.sourceTotal)),\r\n ))\r\n }\r\n\r\n return createElement(\r\n 'div',\r\n { style: SECTION_STYLE, 'data-dsh-brief-sidebar': 'search-refs-section' },\r\n !hideHeader && createElement('div', { style: HEADER_STYLE }, t('section.searchRefs')),\r\n ...body,\r\n )\r\n}\r\n","/**\r\n * The write channel back into `dsh-prime-memory`: rating one recalled memory.\r\n *\r\n * This is the FIRST write this plugin performs, and deliberately the only one.\r\n * Reading goes through the host's projection face (`memoryRecall`); there is no\r\n * projection for writes, so the mark travels over prime-memory's own client RPC\r\n * route — `POST /dsh-memory/rpc/<method>`, the same envelope its panel uses.\r\n * That is a cross-plugin HTTP contract, so everything that makes it safe to\r\n * hold lives here:\r\n *\r\n * - **Optional by construction.** A composition without dsh-prime-memory, or an\r\n * older one without this endpoint, answers 404/405. That is reported as\r\n * `absent`, and the section stops offering the control instead of failing on\r\n * every click.\r\n * - **No invented semantics.** `-1` and `0..5` are prime-memory's domain; this\r\n * module refuses anything else locally so a bad click cannot reach the server.\r\n * - **Nothing is optimistic about retirement.** The caller only hides a row\r\n * after the server confirms `retired` — a lost request must not silently\r\n * remove a memory from view.\r\n *\r\n * `fetch` is injected so the parse and the status mapping are testable without\r\n * a browser.\r\n */\r\n\r\n/** The route prime-memory's server half registers for its client RPC surface. */\r\nexport const RECALL_FEEDBACK_ROUTE = '/dsh-memory/rpc/recall-feedback'\r\n\r\n/** A relevance mark (`0..5`) or `-1` = \"this is obsolete\", prime-memory's domain. */\r\nexport const FEEDBACK_SCORES = [-1, 0, 1, 2, 3, 4, 5] as const\r\nexport type FeedbackScore = (typeof FEEDBACK_SCORES)[number]\r\n\r\n/** Whether a value is a score this plugin is allowed to send. */\r\nexport function isFeedbackScore(value: unknown): value is FeedbackScore {\r\n return typeof value === 'number' && (FEEDBACK_SCORES as readonly number[]).includes(value)\r\n}\r\n\r\n/** How long to wait before giving up on one click. */\r\nexport const FEEDBACK_TIMEOUT_MS = 8_000\r\n\r\n/**\r\n * Outcome of one rating attempt.\r\n *\r\n * `absent` is NOT an error to show the user — it means the capability is not\r\n * there (prime-memory missing or older), and the caller should stop offering\r\n * the control. `rejected` carries prime-memory's own reason (e.g. \"this memory\r\n * is no longer in the session's recall set\"), which is worth surfacing.\r\n */\r\nexport type FeedbackOutcome =\r\n | {\r\n readonly status: 'sent'\r\n readonly retired: boolean\r\n readonly announced: boolean\r\n readonly mean: number\r\n readonly rated: number\r\n }\r\n | { readonly status: 'rejected'; readonly reason: string }\r\n | { readonly status: 'absent' }\r\n | { readonly status: 'transport'; readonly reason: string }\r\n\r\n/** The minimal fetch shape this module needs (global `fetch` satisfies it). */\r\nexport interface FeedbackFetch {\r\n (url: string, init: {\r\n method: 'POST'\r\n headers: Record<string, string>\r\n body: string\r\n signal?: AbortSignal\r\n }): Promise<{\r\n readonly ok: boolean\r\n readonly status: number\r\n json(): Promise<unknown>\r\n }>\r\n}\r\n\r\nexport interface FeedbackRequest {\r\n readonly sessionId: string\r\n readonly id: string\r\n readonly score: FeedbackScore\r\n}\r\n\r\n/** Whether a status code means \"no such route\" rather than \"the call failed\". */\r\nfunction isAbsentStatus(status: number): boolean {\r\n return status === 404 || status === 405 || status === 501\r\n}\r\n\r\n/** The host's RpcResult envelope, narrowed enough to read the two branches. */\r\nfunction parseEnvelope(value: unknown): { ok: true; value: Record<string, unknown> } | { ok: false; reason: string } | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as Record<string, unknown>\r\n if (raw['ok'] === true && raw['value'] !== null && typeof raw['value'] === 'object') {\r\n return { ok: true, value: raw['value'] as Record<string, unknown> }\r\n }\r\n if (raw['ok'] === false) {\r\n const err = raw['error']\r\n const message = err !== null && typeof err === 'object'\r\n ? (err as Record<string, unknown>)['message']\r\n : undefined\r\n return { ok: false, reason: typeof message === 'string' && message.length > 0 ? message : 'rejected' }\r\n }\r\n return undefined\r\n}\r\n\r\nfunction num(value: unknown): number {\r\n return typeof value === 'number' && Number.isFinite(value) ? value : 0\r\n}\r\n\r\n/**\r\n * Send one rating.\r\n *\r\n * Never throws: every failure mode comes back as a discriminated outcome, so a\r\n * click cannot break the render.\r\n */\r\nexport async function sendRecallFeedback(\r\n fetchImpl: FeedbackFetch | undefined,\r\n request: FeedbackRequest,\r\n): Promise<FeedbackOutcome> {\r\n if (typeof fetchImpl !== 'function') return { status: 'absent' }\r\n if (request.sessionId.length === 0 || request.id.length === 0) {\r\n return { status: 'rejected', reason: 'missing-session-or-id' }\r\n }\r\n if (!isFeedbackScore(request.score)) return { status: 'rejected', reason: 'invalid-score' }\r\n\r\n const abort = typeof AbortController === 'function' ? new AbortController() : undefined\r\n const timer = abort === undefined\r\n ? undefined\r\n : setTimeout(() => { abort.abort() }, FEEDBACK_TIMEOUT_MS)\r\n try {\r\n const response = await fetchImpl(RECALL_FEEDBACK_ROUTE, {\r\n method: 'POST',\r\n headers: { 'content-type': 'application/json' },\r\n body: JSON.stringify({ sessionId: request.sessionId, id: request.id, score: request.score }),\r\n ...(abort === undefined ? {} : { signal: abort.signal }),\r\n })\r\n if (!response.ok) {\r\n return isAbsentStatus(response.status)\r\n ? { status: 'absent' }\r\n : { status: 'transport', reason: `HTTP ${response.status}` }\r\n }\r\n let envelope: unknown\r\n try {\r\n envelope = await response.json()\r\n } catch {\r\n return { status: 'transport', reason: 'unparseable-response' }\r\n }\r\n const parsed = parseEnvelope(envelope)\r\n if (parsed === undefined) return { status: 'transport', reason: 'unexpected-envelope' }\r\n if (parsed.ok === false) return { status: 'rejected', reason: parsed.reason }\r\n const value = parsed.value\r\n const rating = value['rating'] !== null && typeof value['rating'] === 'object'\r\n ? value['rating'] as Record<string, unknown>\r\n : {}\r\n return {\r\n status: 'sent',\r\n retired: value['retired'] === true,\r\n announced: value['announced'] === true,\r\n mean: num(rating['mean']),\r\n rated: num(rating['rated']),\r\n }\r\n } catch (err) {\r\n const aborted = err instanceof Error && (err.name === 'AbortError' || err.name === 'TimeoutError')\r\n return { status: 'transport', reason: aborted ? 'timeout' : (err instanceof Error ? err.message : 'network') }\r\n } finally {\r\n if (timer !== undefined) clearTimeout(timer)\r\n }\r\n}\r\n","/**\r\n * The hover bubble for one recalled memory — the whole body, straight off the\r\n * projection frame, no second round-trip.\r\n *\r\n * Two shapes are load-bearing here:\r\n *\r\n * - **Stateless.** The section owns when a bubble opens and which row it shows;\r\n * this only draws what it is handed. No hooks, no buttons, no timers.\r\n * - **`position: fixed`.** The summary tab body is `overflow: auto`, so a box\r\n * absolutely positioned inside a row gets clipped by the scroller's border as\r\n * soon as the row sits near an edge. Fixed positioning plus `bubblePos`\r\n * clamping keeps the bubble inside the viewport instead, and anchored to the\r\n * row's *left* so it never lands on the list it describes.\r\n *\r\n * `pointerEvents: 'none'` is not decoration: a bubble that captures the mouse\r\n * would strand the very row it hovers over and leave the section unable to\r\n * receive the click that selects it.\r\n *\r\n * Colours come from `--dsw-alias-*` tokens only (skin contract, asserted by\r\n * `tests/purity.spec.ts`). There is no shadow token in that family, so the\r\n * bubble separates from the list by border and background layer rather than by\r\n * elevation — a literal `box-shadow` colour would break the contract.\r\n */\r\nimport { createElement, Fragment } from 'react'\r\nimport type { CSSProperties, ReactNode } from 'react'\r\nimport type { MemoryRecallItem } from './memory-recall'\r\nimport { expandCount } from '../locales'\r\n\r\n/** Bubble box size, mirrored by `bubblePos`'s defaults (keep the two in sync). */\r\nconst BUBBLE_W = 360\r\nconst BUBBLE_H = 220\r\n/** Viewport gutter kept on every side when clamping. */\r\nconst EDGE = 8\r\n\r\n/**\r\n * Clamp the bubble into the viewport.\r\n *\r\n * It opens to the **left** of the row on purpose. The sidebar is right-docked\r\n * and only a few hundred pixels wide, so the old \"anchor + 8\" placement dropped\r\n * the box straight onto the row it came from — covering that row's rating strip\r\n * (the bubble is click-transparent, so the buttons stayed clickable *under* it:\r\n * blind-clicking a score is not an option). Opening left puts the text over the\r\n * chat area and leaves the whole list readable.\r\n *\r\n * Order of preference: left of the row → right of the row (only when the row\r\n * sits so far left that the box would run off the window) → clamped inside the\r\n * viewport. Pure and total.\r\n *\r\n * @param r - the hovered row's rect (`top`/`left`/`right` are read).\r\n * @param vw - viewport width (`window.innerWidth`).\r\n * @param vh - viewport height (`window.innerHeight`).\r\n * @param w - bubble width.\r\n * @param h - bubble height.\r\n * @returns fixed-position coordinates for the bubble.\r\n */\r\nexport function bubblePos(\r\n r: { top: number; left: number; right?: number },\r\n vw: number,\r\n vh: number,\r\n w = BUBBLE_W,\r\n h = BUBBLE_H,\r\n): { top: number; left: number } {\r\n const right = r.right ?? r.left\r\n const preferred = r.left - w - EDGE\r\n const fallback = right + EDGE\r\n const roomOnLeft = preferred >= EDGE\r\n const roomOnRight = fallback + w <= vw - EDGE\r\n const unplaced = Math.min(preferred, fallback)\r\n const left = roomOnLeft\r\n ? preferred\r\n : roomOnRight\r\n ? fallback\r\n : unplaced\r\n return {\r\n left: Math.max(EDGE, Math.min(left, vw - w - EDGE)),\r\n top: Math.max(EDGE, Math.min(r.top, vh - h - EDGE)),\r\n }\r\n}\r\n\r\nconst BUBBLE_STYLE: CSSProperties = {\r\n position: 'fixed',\r\n pointerEvents: 'none',\r\n zIndex: 1000,\r\n maxWidth: BUBBLE_W,\r\n maxHeight: '45vh',\r\n overflow: 'hidden',\r\n padding: '8px 10px',\r\n borderRadius: 6,\r\n background: 'var(--dsw-alias-bg-layer-3)',\r\n border: '1px solid var(--dsw-alias-border-l2)',\r\n color: 'var(--dsw-alias-label-primary)',\r\n fontSize: 12,\r\n lineHeight: '17px',\r\n}\r\n\r\nconst TYPE_STYLE: CSSProperties = {\r\n display: 'inline-block',\r\n marginBottom: 4,\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n border: '1px solid var(--dsw-alias-label-tertiary)',\r\n borderRadius: 999,\r\n padding: '0 6px',\r\n fontSize: 11,\r\n lineHeight: '16px',\r\n}\r\n\r\nconst BODY_STYLE: CSSProperties = {\r\n minWidth: 0,\r\n overflowWrap: 'anywhere',\r\n whiteSpace: 'pre-wrap',\r\n color: 'var(--dsw-alias-label-primary)',\r\n}\r\n\r\nconst SCENARIO_STYLE: CSSProperties = {\r\n marginTop: 4,\r\n minWidth: 0,\r\n overflowWrap: 'anywhere',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 11,\r\n lineHeight: '16px',\r\n}\r\n\r\nconst FOOTER_STYLE: CSSProperties = {\r\n marginTop: 4,\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 11,\r\n lineHeight: '16px',\r\n}\r\n\r\n/** A retired record stays readable in the bubble, just marked. */\r\nconst STALE_BODY_STYLE: CSSProperties = { ...BODY_STYLE, textDecoration: 'line-through' }\r\n\r\n/* ── Lightweight Markdown renderer (no external deps) ──────────────────── */\r\n\r\nconst MD_H_STYLES: CSSProperties[] = [\r\n { fontSize: 14, fontWeight: 700, margin: '6px 0 2px', color: 'var(--dsw-alias-label-primary)' },\r\n { fontSize: 13, fontWeight: 600, margin: '5px 0 2px', color: 'var(--dsw-alias-label-primary)' },\r\n { fontSize: 12, fontWeight: 600, margin: '4px 0 1px', color: 'var(--dsw-alias-label-secondary)' },\r\n { fontSize: 12, fontWeight: 600, margin: '4px 0 1px', color: 'var(--dsw-alias-label-secondary)' },\r\n { fontSize: 11, fontWeight: 600, margin: '3px 0 1px', color: 'var(--dsw-alias-label-secondary)' },\r\n { fontSize: 11, fontWeight: 600, margin: '3px 0 1px', color: 'var(--dsw-alias-label-tertiary)' },\r\n]\r\n\r\nconst MD_P_STYLE: CSSProperties = { margin: '2px 0', whiteSpace: 'pre-wrap' }\r\nconst MD_LI_STYLE: CSSProperties = { margin: '1px 0 1px 12px', whiteSpace: 'pre-wrap' }\r\nconst MD_CODE_STYLE: CSSProperties = {\r\n fontFamily: 'var(--dsw-alias-font-mono, monospace)',\r\n fontSize: 11,\r\n background: 'var(--dsw-alias-fill-tertiary)',\r\n padding: '0 3px',\r\n borderRadius: 3,\r\n}\r\n\r\n/** Parse inline bold (`**x**`) and code (`` `x` ``) spans. */\r\nfunction renderInline(text: string, key: string): ReactNode[] {\r\n const nodes: ReactNode[] = []\r\n // Split by **bold** or `code`\r\n const re = /\\*\\*(.+?)\\*\\*|`(.+?)`/\r\n let rest = text\r\n let i = 0\r\n while (rest.length > 0) {\r\n const m = re.exec(rest)\r\n if (m === null) { nodes.push(rest); break }\r\n if (m.index > 0) nodes.push(rest.slice(0, m.index))\r\n if (m[1] !== undefined) {\r\n nodes.push(createElement('strong', { key: `${key}-b${i++}` }, m[1]))\r\n } else {\r\n nodes.push(createElement('code', { key: `${key}-c${i++}`, style: MD_CODE_STYLE }, m[2]))\r\n }\r\n rest = rest.slice(m.index + m[0].length)\r\n }\r\n return nodes\r\n}\r\n\r\n/**\r\n * Render a markdown string into React nodes.\r\n * Supports: headings (h1-h6), unordered/ordered lists, bold, inline code, paragraphs.\r\n */\r\nexport function renderMd(md: string): ReactNode {\r\n const lines = md.split('\\n')\r\n const out: ReactNode[] = []\r\n let idx = 0\r\n for (const line of lines) {\r\n const trimmed = line.trim()\r\n if (trimmed.length === 0) continue\r\n // Heading\r\n const hMatch = /^(#{1,6})\\s+(.+)/.exec(trimmed)\r\n if (hMatch) {\r\n const level = hMatch[1].length\r\n out.push(createElement(`h${level}`, { key: `h${idx}`, style: MD_H_STYLES[level - 1] },\r\n ...renderInline(hMatch[2], `h${idx}`)))\r\n idx++\r\n continue\r\n }\r\n // Unordered list item\r\n const ulMatch = /^[-*]\\s+(.+)/.exec(trimmed)\r\n if (ulMatch) {\r\n out.push(createElement('span', { key: `li${idx}`, style: MD_LI_STYLE },\r\n '• ', ...renderInline(ulMatch[1], `li${idx}`)))\r\n idx++\r\n continue\r\n }\r\n // Ordered list item\r\n const olMatch = /^\\d+\\.\\s+(.+)/.exec(trimmed)\r\n if (olMatch) {\r\n out.push(createElement('span', { key: `li${idx}`, style: MD_LI_STYLE },\r\n trimmed.slice(0, trimmed.indexOf('.') + 2), ...renderInline(olMatch[1], `li${idx}`)))\r\n idx++\r\n continue\r\n }\r\n // Paragraph\r\n out.push(createElement('span', { key: `p${idx}`, style: MD_P_STYLE },\r\n ...renderInline(trimmed, `p${idx}`)))\r\n idx++\r\n }\r\n return createElement(Fragment, null, ...out)\r\n}\r\n\r\n/**\r\n * The bubble itself.\r\n *\r\n * @param props - the item to show, the clamped coordinates, and the lookup.\r\n * @returns the bubble element.\r\n */\r\nexport function RecallBubble(props: {\r\n item: MemoryRecallItem\r\n pos: { top: number; left: number }\r\n t: (key: string) => string\r\n}): ReactNode {\r\n const { item, pos, t } = props\r\n const scenario = item.scenario === undefined ? undefined : item.scenario.join(' · ')\r\n const stale = item.retired === true\r\n const rated = item.rating !== undefined && Number.isInteger(item.rating) && item.rating >= 0 && item.rating <= 5\r\n const foot = [\r\n `P${item.priority}`,\r\n rated ? expandCount(t('recall.rated'), item.rating) : undefined,\r\n stale ? t('recall.obsoleted') : undefined,\r\n ].filter((s): s is string => s !== undefined).join(' · ')\r\n return createElement(\r\n 'div',\r\n {\r\n style: { ...BUBBLE_STYLE, top: pos.top, left: pos.left },\r\n 'data-dsh-brief-sidebar': 'recall-bubble',\r\n role: 'tooltip',\r\n },\r\n createElement('span', { style: TYPE_STYLE }, item.type),\r\n createElement(\r\n 'div',\r\n { style: stale ? STALE_BODY_STYLE : BODY_STYLE },\r\n // Render markdown body; fallback when absent.\r\n item.body !== undefined ? renderMd(item.body) : `${item.title}\\n${t('recall.noBody')}`,\r\n ),\r\n scenario !== undefined && createElement('div', { style: SCENARIO_STYLE }, scenario),\r\n createElement('div', { style: FOOTER_STYLE }, foot),\r\n )\r\n}\r\n","/**\r\n * Opening the prime-memory library page in a chosen mode (cross-bundle deep link).\r\n *\r\n * Mirror of `spirit-open.ts`: `dsh-prime-memory` owns the explorer main panel\r\n * (its sidebar row calls `layout.selectPanel('dsh-memory-explorer')`), so the\r\n * panel owner performs the jump and answers synchronously. This plugin only\r\n * sends one cancelable event — no import, no layout access, no version coupling.\r\n *\r\n * Three modes map to the explorer's internal views:\r\n * - `entry` — query mode with the entry pane;\r\n * - `2d` / `3d` — graph mode with the G6 / canvas view.\r\n */\r\n\r\n/** The event `dsh-prime-memory` listens for (`client/src/entry.tsx`, same literal). */\r\nexport const MEMORY_OPEN_EVENT = 'dsh-prime-memory:open-explorer'\r\n\r\n/** Which explorer view to reveal. */\r\nexport type MemoryOpenMode = 'entry' | '2d' | '3d'\r\n\r\n/** Synchronous answer from the panel owner. */\r\nexport interface MemoryOpenAck {\r\n ok: boolean\r\n /** `disabled` = 记忆库入口被关掉; `unmounted` = 没有 main 页; `unregistered` = key 未注册。 */\r\n reason?: string\r\n /** Owner-side diagnostic (which resolver path was tried / what threw). Tooltip only. */\r\n detail?: string\r\n}\r\n\r\n/** Event detail shape (prime-memory reads `mode`/`recordId`, writes `ack`). */\r\ninterface MemoryOpenDetail {\r\n mode: MemoryOpenMode\r\n recordId?: string\r\n ack?: MemoryOpenAck\r\n}\r\n\r\n/**\r\n * Ask prime-memory to open its 记忆库 in the given mode.\r\n *\r\n * @param mode - which view to show.\r\n * @param recordId - optional memory id to focus (kept for per-row entry points).\r\n * @returns the owner's ack, or `absent` when nothing listened.\r\n */\r\nexport function openMemoryLibrary(mode: MemoryOpenMode, recordId?: string): MemoryOpenAck {\r\n if (typeof window === 'undefined') return { ok: false, reason: 'absent' }\r\n const detail: MemoryOpenDetail = recordId === undefined || recordId === ''\r\n ? { mode }\r\n : { mode, recordId }\r\n const event = new CustomEvent(MEMORY_OPEN_EVENT, { detail, cancelable: true })\r\n window.dispatchEvent(event)\r\n if (detail.ack !== undefined) return detail.ack\r\n return event.defaultPrevented ? { ok: true } : { ok: false, reason: 'absent' }\r\n}\r\n","/**\r\n * Module-level reference to the better-sidebar service, set during client apply.\r\n * This avoids the strict-proxy denial on ctx.get('betterSidebar') from deep\r\n * component callbacks (MemorySlotsSection / MemoryRecallSection).\r\n */\r\nexport interface OpenTabSeed {\r\n type: string\r\n title?: string\r\n path?: string\r\n}\r\n\r\nlet _openTab: ((seed: OpenTabSeed) => void) | undefined\r\n\r\n/** Set by apply() once the better-sidebar service is available. */\r\nexport function setOpenTab(fn: (seed: OpenTabSeed) => void): void {\r\n _openTab = fn\r\n}\r\n\r\n/** Open a memory viewer tab by memoryId. No-op if the service is absent. */\r\nexport function openMemoryTab(memoryId: string): void {\r\n _openTab?.({ type: 'dsh-md-memory-viewer:memory', path: memoryId, title: memoryId.slice(0, 16) })\r\n}\r\n\r\n/** 回响原文查看器 tab 的类型(与 index.tsx 的注册串一致)。 */\r\nexport const ECHO_VIEWER_TAB = 'dsh-md-echo-viewer:echo'\r\n\r\n/**\r\n * Open the echo viewer for one echo entry.\r\n *\r\n * `path` 里同时带 sessionId 与编号(`<sessionId>|<id>`):回响编号只在本会话内唯一,\r\n * 只传 id 会让“看原文”变成跨会话张冠李戴。\r\n */\r\nexport function openEchoTab(sessionId: string, id: string): void {\r\n _openTab?.({ type: ECHO_VIEWER_TAB, path: `${sessionId}|${id}`, title: id.slice(-10) })\r\n}\r\n","/**\r\n * The 「详细展示 ▾」 control for the memory pane.\r\n *\r\n * The sidebar does not redraw prime-memory's 2D/3D graphs: the panel owner does,\r\n * with its own G6/canvas implementation. This control only asks it to open the\r\n * 记忆库 page in one of three modes (条目 / 2D / 3D) through the same deep-link\r\n * event its own sidebar row uses. The owner answers synchronously, so a failure\r\n * (entry disabled, host without a main page) lands as readable copy here instead\r\n * of a dead click.\r\n *\r\n * Colours come from `--dsw-alias-*` tokens only (skin contract).\r\n */\r\nimport { createElement, useCallback, useEffect, useRef, useState } from 'react'\r\nimport type { CSSProperties, KeyboardEvent, ReactNode } from 'react'\r\nimport { openMemoryLibrary } from '../memory-open'\r\nimport type { MemoryOpenMode } from '../memory-open'\r\nimport { openMemoryTab } from '../memory-tab'\r\n\r\nexport interface MemoryViewMenuProps {\r\n /** The DSH locale lookup, passed down from `apply`. */\r\n t: (key: string) => string\r\n /** Optional memory id to focus; row-level menus pass the row's id. */\r\n recordId?: string\r\n /** Trigger copy; defaults to `memoryView.button` + caret. */\r\n label?: string\r\n /** Compact = inline text-link trigger for a row's rating strip. */\r\n compact?: boolean\r\n}\r\n\r\n/** Owner reason → locale key. Unknown reasons fall back to the absent copy. */\r\nconst REASON_KEY: Record<string, string> = {\r\n absent: 'memoryView.failAbsent',\r\n disabled: 'memoryView.failDisabled',\r\n unmounted: 'memoryView.failUnmounted',\r\n unregistered: 'memoryView.failUnregistered',\r\n}\r\n\r\n/** Menu entries, in reading order. `preview` is the pre-existing sidebar viewer. */\r\ntype MenuEntry = MemoryOpenMode | 'preview'\r\nconst MODES: ReadonlyArray<{ mode: MenuEntry; key: string }> = [\r\n { mode: 'preview', key: 'memoryView.preview' },\r\n { mode: 'entry', key: 'memoryView.entry' },\r\n { mode: '2d', key: 'memoryView.graph2d' },\r\n { mode: '3d', key: 'memoryView.graph3d' },\r\n]\r\n\r\nconst BAR_STYLE: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'center',\r\n flexWrap: 'wrap',\r\n gap: 6,\r\n padding: '8px 12px 0',\r\n}\r\n\r\n/** Row-strip variant: hangs at the right edge, no section padding. */\r\nconst COMPACT_BAR_STYLE: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'center',\r\n flexWrap: 'wrap',\r\n gap: 4,\r\n marginLeft: 'auto',\r\n}\r\n\r\nconst TRIGGER_STYLE: CSSProperties = {\r\n padding: '1px 8px',\r\n border: '1px solid var(--dsw-alias-border-secondary)',\r\n borderRadius: 4,\r\n background: 'none',\r\n font: 'inherit',\r\n fontSize: 11,\r\n lineHeight: '18px',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n cursor: 'pointer',\r\n}\r\n\r\nconst MENU_STYLE: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'center',\r\n gap: 4,\r\n}\r\n\r\nconst ITEM_STYLE: CSSProperties = {\r\n padding: '1px 8px',\r\n border: '1px solid var(--dsw-alias-label-tertiary)',\r\n borderRadius: 999,\r\n background: 'none',\r\n font: 'inherit',\r\n fontSize: 11,\r\n lineHeight: '18px',\r\n color: 'var(--dsw-alias-label-primary)',\r\n cursor: 'pointer',\r\n}\r\n\r\n/** Compact trigger mirrors the strip's other buttons. */\r\nconst COMPACT_TRIGGER_STYLE: CSSProperties = {\r\n ...ITEM_STYLE,\r\n color: 'var(--dsw-alias-label-secondary)',\r\n border: '1px solid var(--dsw-alias-border-secondary)',\r\n borderRadius: 4,\r\n minWidth: 0,\r\n whiteSpace: 'nowrap',\r\n}\r\n\r\nconst FAIL_STYLE: CSSProperties = {\r\n flexBasis: '100%',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 11,\r\n lineHeight: '16px',\r\n}\r\n\r\n/**\r\n * Row-strip popover: FIXED so the row's clipped height cannot cut the chips'\r\n * bottom border, and so a long row list never paints the menu behind the next\r\n * row. Anchored to the trigger's bottom edge and clamped into the viewport.\r\n */\r\nconst POPOVER_STYLE: CSSProperties = {\r\n position: 'fixed',\r\n zIndex: 1100,\r\n display: 'flex',\r\n alignItems: 'center',\r\n gap: 4,\r\n padding: '6px 8px',\r\n background: 'var(--dsw-alias-bg-layer-1)',\r\n border: '1px solid var(--dsw-alias-border-secondary)',\r\n borderRadius: 8,\r\n}\r\n\r\n/**\r\n * The memory view menu. All hooks run before any conditional rendering.\r\n * @param props - translation.\r\n */\r\nexport function MemoryViewMenu(props: MemoryViewMenuProps): ReactNode {\r\n const { t, recordId, label, compact = false } = props\r\n const [open, setOpen] = useState(false)\r\n // 失败回执整条留着:owner 的 detail 要能落到 title 上(三个字的 reason 排不了障)。\r\n const [fail, setFail] = useState<{ reason: string; detail?: string } | undefined>(undefined)\r\n const [anchor, setAnchor] = useState<{ top: number; left: number } | undefined>(undefined)\r\n const rootRef = useRef<HTMLDivElement | null>(null)\r\n const triggerRef = useRef<HTMLButtonElement | null>(null)\r\n // Section menu keeps the three library views; row menus also offer the\r\n // pre-existing sidebar quick view (direct viewer tab).\r\n const entries = recordId === undefined ? MODES.filter(entry => entry.mode !== 'preview') : MODES\r\n\r\n // Close on an outside mousedown while the menu is open.\r\n useEffect(() => {\r\n if (!open) return\r\n const onDocDown = (event: MouseEvent): void => {\r\n const root = rootRef.current\r\n if (root !== null && event.target instanceof Node && root.contains(event.target)) return\r\n setOpen(false)\r\n }\r\n document.addEventListener('mousedown', onDocDown)\r\n return () => { document.removeEventListener('mousedown', onDocDown) }\r\n }, [open])\r\n\r\n const pick = useCallback((mode: MenuEntry): void => {\r\n if (mode === 'preview') {\r\n // 速览:旧的侧栏查看器 tab。无 recordId 时开空态(未选记忆),有则直定那条。\r\n openMemoryTab(recordId ?? '')\r\n setOpen(false)\r\n setFail(undefined)\r\n return\r\n }\r\n const result = openMemoryLibrary(mode, recordId)\r\n setOpen(false)\r\n setFail(result.ok ? undefined : { reason: result.reason ?? 'absent', detail: result.detail })\r\n }, [recordId])\r\n\r\n const onKeyDown = useCallback((event: KeyboardEvent<HTMLDivElement>): void => {\r\n if (event.key !== 'Escape') return\r\n setOpen(false)\r\n }, [])\r\n\r\n /** Open/close; compact menus measure the trigger so the fixed chips stay attached. */\r\n const toggle = useCallback((event: { stopPropagation(): void }): void => {\r\n // The row's own click toggles selection; the menu must not close the strip.\r\n event.stopPropagation()\r\n setFail(undefined)\r\n if (open) {\r\n setOpen(false)\r\n return\r\n }\r\n if (compact) {\r\n const el = triggerRef.current\r\n if (el !== null) {\r\n const rect = el.getBoundingClientRect()\r\n const width = 260\r\n const left = Math.max(8, Math.min(rect.left, window.innerWidth - width - 8))\r\n setAnchor({ top: rect.bottom + 4, left })\r\n }\r\n }\r\n setOpen(true)\r\n }, [compact, open])\r\n\r\n return createElement(\r\n 'div',\r\n {\r\n ref: rootRef,\r\n style: compact ? COMPACT_BAR_STYLE : BAR_STYLE,\r\n onKeyDown,\r\n 'data-dsh-brief-sidebar': compact ? 'memory-view-row-menu' : 'memory-view-menu',\r\n },\r\n createElement(\r\n 'button',\r\n {\r\n ref: triggerRef,\r\n type: 'button' as const,\r\n style: compact ? COMPACT_TRIGGER_STYLE : TRIGGER_STYLE,\r\n 'aria-haspopup': 'menu',\r\n 'aria-expanded': open,\r\n onClick: toggle,\r\n },\r\n `${label ?? t('memoryView.button')} ▾`,\r\n ),\r\n open && createElement(\r\n 'div',\r\n {\r\n role: 'menu',\r\n style: compact && anchor !== undefined\r\n ? { ...POPOVER_STYLE, top: anchor.top, left: anchor.left, maxWidth: 'calc(100vw - 16px)' }\r\n : MENU_STYLE,\r\n 'aria-label': t('memoryView.button'),\r\n },\r\n ...entries.map(entry => createElement(\r\n 'button',\r\n {\r\n key: entry.mode,\r\n type: 'button' as const,\r\n role: 'menuitem',\r\n style: ITEM_STYLE,\r\n 'data-dsh-brief-sidebar': `memory-view-${entry.mode}`,\r\n onClick: (e: { stopPropagation(): void }) => { e.stopPropagation(); pick(entry.mode) },\r\n },\r\n t(entry.key),\r\n )),\r\n ),\r\n fail !== undefined && createElement(\r\n 'div',\r\n {\r\n style: FAIL_STYLE,\r\n 'data-dsh-brief-sidebar': 'memory-view-fail',\r\n ...(fail.detail === undefined ? {} : { title: fail.detail }),\r\n },\r\n t(REASON_KEY[fail.reason] ?? 'memoryView.failAbsent'),\r\n ),\r\n )\r\n}\r\n","/**\r\n * The session-recall section: what this session actually injected, drawn as a\r\n * part of the summary tab — and now annotatable.\r\n *\r\n * Where `MemorySlotsSection` lists hand-pinned resident conventions (written\r\n * once, injected every turn), this one answers a different question: **which\r\n * memories did the model see this session, and which are still in context**.\r\n * The set is not resident — it is relevance recall. Compaction does NOT drop\r\n * entries: prime-memory marks the ones whose text a summary replaced as\r\n * `superseded`, and this section hides those (the footer keeps the count).\r\n * Retired rows are the exception and stay visible. Only `/clear` empties the list.\r\n *\r\n * TWO gates, both fail-open to \"hidden\", mirroring the slots section:\r\n *\r\n * 1. **The switch.** This plugin's entry config (`configForms` → field\r\n * `showMemoryRecall`, default on).\r\n * 2. **The capability.** The `memoryRecall` projection must exist for the\r\n * session; `undefined` hides the section entirely — a composition without\r\n * dsh-prime-memory paints nothing here.\r\n *\r\n * Rating is a THIRD gate, and it fails open the same way: the mark goes back to\r\n * prime-memory over its client RPC route (`recall-feedback.ts`). A composition\r\n * whose prime-memory predates that endpoint answers 404, and the section falls\r\n * back to the read-only list it used to be — no per-click error, no dead button.\r\n *\r\n * What the marks mean (prime-memory owns the semantics, this only offers them):\r\n * - `0..5` — how relevant this recall actually was. Aggregated; it does NOT\r\n * rewrite any ranking on its own.\r\n * - `-1` — \"this memory is obsolete\": prime-memory retires the record (soft\r\n * delete, restorable from its panel) and tells the model next turn. That is\r\n * why it takes a second confirming click and says so on the button.\r\n *\r\n * A retired row does NOT leave this list: the retirement is the human's verdict\r\n * on that memory, so the row stays, struck through and unselectable, until the\r\n * session is cleared. A `superseded` row (its text was replaced by a summary, so\r\n * it is no longer in context) IS hidden, with the count kept in the footer.\r\n * Hovering a row opens one bubble with the whole body (`RecallBubble`)\r\n * — the row itself is clamped to two lines and the sidebar is narrow.\r\n *\r\n * Colours come from `--dsw-alias-*` tokens only (skin contract, enforced by\r\n * `tests/purity.spec.ts`).\r\n */\r\nimport { createElement } from 'react'\r\nimport { useCallback, useEffect, useRef, useState } from 'react'\r\nimport type { CSSProperties, ReactNode } from 'react'\r\nimport type { CtxProbe } from '../use-projection'\r\nimport { MEMORY_RECALL_KEY, readRecall } from './memory-recall'\r\nimport type { MemoryRecallItem, MemoryRecallView } from './memory-recall'\r\nimport { FEEDBACK_SCORES, sendRecallFeedback } from './recall-feedback'\r\nimport type { FeedbackFetch, FeedbackScore } from './recall-feedback'\r\nimport { RecallBubble, bubblePos } from './RecallBubble'\r\nimport { resolveShowMemoryRecall } from '../scope-face'\r\nimport { useConfigFlag } from './use-config-flag'\r\nimport { useProjectionValue } from '../use-projection'\r\nimport { expandCount } from '../locales'\r\nimport { FoldToggle, GroupHeader } from './FoldToggle'\r\nimport { MemoryViewMenu } from './MemoryViewMenu'\r\n\r\nexport interface MemoryRecallSectionProps {\r\n /** The DSH locale lookup, passed down from `apply`. */\r\n t: (key: string) => string\r\n /** The client root context (the tab body's only way to reach services). */\r\n ctx?: CtxProbe\r\n /** The session this tab is scoped to. */\r\n scope?: { readonly sessionId?: string }\r\n /**\r\n * The transport for rating. Defaults to the page's `fetch`; injectable so the\r\n * click path is testable without a browser.\r\n */\r\n fetchImpl?: FeedbackFetch\r\n}\r\n\r\nconst SECTION_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n borderBottom: '1px solid var(--dsw-alias-border-secondary)',\r\n}\r\n\r\nconst HEADER_STYLE: CSSProperties = {\r\n padding: '10px 12px 0',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n fontSize: 12,\r\n fontWeight: 600,\r\n}\r\n\r\nconst HINT_STYLE: CSSProperties = {\r\n padding: '2px 12px 0',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 11,\r\n lineHeight: '15px',\r\n}\r\n\r\nconst LIST_STYLE: CSSProperties = {\r\n listStyle: 'none',\r\n margin: 0,\r\n padding: '6px 0',\r\n display: 'flex',\r\n flexDirection: 'column',\r\n}\r\n\r\nconst ROW_STYLE: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'flex-start',\r\n gap: 8,\r\n padding: '6px 12px',\r\n}\r\n\r\n/** Selected row: one hairline of accent, no colour literal (skin contract). */\r\nconst ROW_SELECTED_STYLE: CSSProperties = {\r\n ...ROW_STYLE,\r\n background: 'var(--dsw-alias-fill-quaternary)',\r\n}\r\n\r\n/** The type pill: same form as the slot kind pill, tertiary emphasis. */\r\nconst TYPE_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n border: '1px solid var(--dsw-alias-label-tertiary)',\r\n borderRadius: 999,\r\n padding: '0 6px',\r\n fontSize: 11,\r\n lineHeight: '16px',\r\n whiteSpace: 'nowrap',\r\n}\r\n\r\nconst TITLE_STYLE: CSSProperties = {\r\n minWidth: 0,\r\n color: 'var(--dsw-alias-label-primary)',\r\n fontWeight: 600,\r\n // Two lines, always the same height whatever the body says — the row keeps\r\n // its shape and the whole text rides the hover bubble instead.\r\n display: '-webkit-box',\r\n WebkitLineClamp: 2,\r\n WebkitBoxOrient: 'vertical',\r\n overflow: 'hidden',\r\n fontSize: 13,\r\n lineHeight: '18px',\r\n}\r\n\r\n/**\r\n * Struck-through text for a retired row. Colour drops to tertiary because a\r\n * dead entry must not compete with a live one for the eye.\r\n */\r\nconst STRIKE_STYLE: CSSProperties = {\r\n textDecoration: 'line-through',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n}\r\n\r\nconst SCENARIO_STYLE: CSSProperties = {\r\n margin: 0,\r\n minWidth: 0,\r\n overflowWrap: 'anywhere',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 10,\r\n lineHeight: '14px',\r\n}\r\n\r\nconst META_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 11,\r\n lineHeight: '18px',\r\n whiteSpace: 'nowrap',\r\n}\r\n\r\nconst FOOTER_STYLE: CSSProperties = {\r\n padding: '6px 12px 10px',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 12,\r\n}\r\n\r\nconst EMPTY_STYLE: CSSProperties = {\r\n margin: '0 auto',\r\n padding: 24,\r\n maxWidth: 460,\r\n textAlign: 'center',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n lineHeight: 1.7,\r\n fontSize: 12,\r\n}\r\n\r\nconst STRIP_STYLE: CSSProperties = {\r\n display: 'flex',\r\n flexWrap: 'wrap',\r\n gap: 4,\r\n marginTop: 4,\r\n}\r\n\r\nconst SCORE_BUTTON_STYLE: CSSProperties = {\r\n minWidth: 24,\r\n padding: '0 5px',\r\n height: 20,\r\n fontSize: 11,\r\n lineHeight: '18px',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n background: 'none',\r\n border: '1px solid var(--dsw-alias-border-secondary)',\r\n borderRadius: 4,\r\n cursor: 'pointer',\r\n}\r\n\r\n/** The chosen mark: same box, filled so it survives a re-render without colour literals. */\r\nconst SCORE_ACTIVE_STYLE: CSSProperties = {\r\n ...SCORE_BUTTON_STYLE,\r\n border: '1px solid var(--dsw-alias-label-secondary)',\r\n color: 'var(--dsw-alias-label-primary)',\r\n}\r\n\r\n/** `-1` reads as an action, not a score: text instead of a number. */\r\nconst OBSOLETE_BUTTON_STYLE: CSSProperties = {\r\n ...SCORE_BUTTON_STYLE,\r\n minWidth: 0,\r\n whiteSpace: 'nowrap',\r\n}\r\n\r\nconst OBSOLETE_ARMED_STYLE: CSSProperties = {\r\n ...OBSOLETE_BUTTON_STYLE,\r\n border: '1px solid var(--dsw-alias-border-color-danger)',\r\n color: 'var(--dsw-alias-label-primary)',\r\n fontWeight: 600,\r\n}\r\n\r\nconst MARK_STYLE: CSSProperties = {\r\n marginTop: 2,\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 11,\r\n lineHeight: '15px',\r\n}\r\n\r\nconst ERROR_STYLE: CSSProperties = {\r\n marginTop: 2,\r\n color: 'var(--dsw-alias-label-secondary)',\r\n fontSize: 11,\r\n lineHeight: '15px',\r\n overflowWrap: 'anywhere',\r\n}\r\n\r\n/**\r\n * The rating strip of one selected row: `-1` (two-step) plus `0..5`.\r\n *\r\n * Exported for tests — the section itself only mounts it for the selected row,\r\n * and a static render never has one selected.\r\n *\r\n * **Every click here must stop propagating.** The strip lives INSIDE the row,\r\n * and the row's own `onClick` toggles the selection — so an un-stopped click\r\n * deselects the row, this strip unmounts mid-gesture, and the `-1` button's\r\n * armed \"确认退场?\" state is rendered on a node that is already gone. That is\r\n * the whole \"按了没反应、也没有删除线\" report: the request was never sent, the\r\n * confirmation was never shown, the control simply vanished on the first press.\r\n * @param props - labels, current mark, and the click handlers.\r\n */\r\nexport function RatingStrip(props: {\r\n current: number | undefined\r\n pending: boolean\r\n armed: boolean\r\n obsoleteLabel: string\r\n confirmLabel: string\r\n whyLabel: string\r\n /** Row identity: when present, 「查看详情」 opens the memory-view menu for it. */\r\n recordId?: string\r\n t: (key: string) => string\r\n onScore(score: FeedbackScore): void\r\n}): ReactNode {\r\n const { current, pending, armed } = props\r\n // Clicks landing on the strip's gaps/padding count too: anything inside here\r\n // belongs to the strip, not to the row beneath it.\r\n const swallow = (e: { stopPropagation(): void }): void => { e.stopPropagation() }\r\n return createElement(\r\n 'div',\r\n {\r\n style: STRIP_STYLE,\r\n onClick: swallow,\r\n 'data-dsh-brief-sidebar': 'recall-rating-strip',\r\n },\r\n createElement(\r\n 'button',\r\n {\r\n type: 'button',\r\n style: armed ? OBSOLETE_ARMED_STYLE : OBSOLETE_BUTTON_STYLE,\r\n disabled: pending,\r\n // Before arming the tooltip explains the consequence; after, it asks.\r\n title: armed ? props.confirmLabel : props.whyLabel,\r\n onClick: (e: { stopPropagation(): void }) => {\r\n e.stopPropagation()\r\n props.onScore(-1)\r\n },\r\n },\r\n armed ? props.confirmLabel : props.obsoleteLabel,\r\n ),\r\n ...FEEDBACK_SCORES.filter(s => s >= 0).map(score => createElement(\r\n 'button',\r\n {\r\n key: score,\r\n type: 'button',\r\n style: current === score ? SCORE_ACTIVE_STYLE : SCORE_BUTTON_STYLE,\r\n disabled: pending,\r\n 'aria-pressed': current === score,\r\n onClick: (e: { stopPropagation(): void }) => {\r\n e.stopPropagation()\r\n props.onScore(score)\r\n },\r\n },\r\n String(score),\r\n )),\r\n props.recordId !== undefined && createElement(MemoryViewMenu, {\r\n t: props.t,\r\n recordId: props.recordId,\r\n label: props.t('recall.viewDetail'),\r\n compact: true,\r\n }),\r\n )\r\n}\r\n\r\n/**\r\n * One recalled memory: type pill, first two lines of the body, its own\r\n * priority, and — once selected and still alive — the rating strip. Hovering\r\n * opens the bubble with the whole text; a retired row is struck through and\r\n * cannot be selected (there is nothing left to mark on a record prime-memory\r\n * has already retired).\r\n */\r\nfunction RecallRow(props: {\r\n item: MemoryRecallItem\r\n selected: boolean\r\n stale: boolean\r\n wasSuperseded: boolean\r\n pending: boolean\r\n armed: boolean\r\n mark: number | undefined\r\n error: string | undefined\r\n rating: boolean\r\n t: (key: string) => string\r\n onSelect(): void\r\n onScore(score: FeedbackScore): void\r\n onEnter(el: HTMLElement): void\r\n onLeave(): void\r\n}): ReactNode {\r\n const { item, selected, stale, wasSuperseded, mark, error, t } = props\r\n const scenario = item.scenario === undefined ? undefined : item.scenario.join(' · ')\r\n const markText = mark === undefined\r\n ? undefined\r\n : mark === -1\r\n ? t('recall.obsoleted')\r\n : expandCount(t('recall.rated'), mark)\r\n // A row prime-memory already retired but the human did not mark in this view\r\n // still needs the caption; when `mark === -1` the line above says the same\r\n // thing, so the two are mutually exclusive rather than doubled.\r\n const staleText = stale && mark !== -1 ? t('recall.obsoleted') : undefined\r\n const selectable = props.rating && !stale\r\n const titleStyle = stale ? { ...TITLE_STYLE, ...STRIKE_STYLE } : TITLE_STYLE\r\n return createElement(\r\n 'li',\r\n {\r\n style: selected && props.rating ? ROW_SELECTED_STYLE : ROW_STYLE,\r\n onClick: selectable ? props.onSelect : undefined,\r\n onMouseEnter: (e: { currentTarget: unknown }) => {\r\n const el = e.currentTarget\r\n if (el instanceof HTMLElement) props.onEnter(el)\r\n },\r\n onMouseLeave: () => { props.onLeave() },\r\n },\r\n createElement('span', { style: TYPE_STYLE }, item.type),\r\n createElement(\r\n 'div',\r\n { style: { minWidth: 0, flex: '1 1 auto', display: 'flex', flexDirection: 'column', gap: 2 } },\r\n createElement(\r\n 'span',\r\n // 不给原生 `title`:那会在泡泡之外再多一个宿主自己的深色提示框,两者内容重叠、\r\n // 样式不受皮肤契约管,反而把泡泡遮住。全文与使用场景现在都由 `RecallBubble` 承载。\r\n { style: titleStyle },\r\n item.title,\r\n ),\r\n scenario !== undefined && createElement(\r\n 'p',\r\n { style: stale ? { ...SCENARIO_STYLE, ...STRIKE_STYLE } : SCENARIO_STYLE },\r\n scenario,\r\n ),\r\n staleText !== undefined && createElement('span', { style: MARK_STYLE }, staleText),\r\n // “正文已被摘要取代”是行自己的事实,得写在行上:否则展开历史组后,\r\n // 读者只能靠位置猜哪一行不在上下文里。\r\n wasSuperseded && createElement(\r\n 'span',\r\n { style: TYPE_STYLE, 'data-dsh-brief-sidebar': 'recall-superseded-tag' },\r\n t('recall.supersededTag'),\r\n ),\r\n markText !== undefined && createElement('span', { style: MARK_STYLE }, markText),\r\n error !== undefined && createElement(\r\n 'span',\r\n { style: ERROR_STYLE },\r\n `${t('recall.failed')}${error}`,\r\n ),\r\n selected && !stale && props.rating && createElement(RatingStrip, {\r\n current: mark,\r\n pending: props.pending,\r\n armed: props.armed,\r\n obsoleteLabel: t('recall.obsolete'),\r\n confirmLabel: t('recall.obsoleteConfirm'),\r\n whyLabel: t('recall.obsoleteWhy'),\r\n recordId: item.id,\r\n t,\r\n onScore: props.onScore,\r\n }),\r\n ),\r\n createElement('span', { style: META_STYLE }, `P${item.priority}`),\r\n )\r\n}\r\n\r\n/** How long the `-1` button stays armed before reverting to its plain label. */\r\nconst ARM_WINDOW_MS = 5_000\r\n\r\n/** Delay before a hover opens its bubble (ms) — swiping past rows must not paint. */\r\nconst HOVER_DELAY_MS = 150\r\n\r\n/**\r\n * The session-recall section. All hooks run unconditionally (a conditional hook\r\n * order would break the moment the switch flips); the gates only decide whether\r\n * the resolved view paints and whether rows are clickable.\r\n * @param props - translation, client context, session scope, transport.\r\n */\r\nexport function MemoryRecallSection(props: MemoryRecallSectionProps): ReactNode {\r\n const { t, ctx, scope } = props\r\n const [selectedId, setSelectedId] = useState<string | undefined>(undefined)\r\n const [marks, setMarks] = useState<Record<string, number>>({})\r\n // Rows the human just marked obsolete in THIS view. prime-memory's `retired`\r\n // covers the ones retired earlier; these two sets union into \"draw a strike\".\r\n const [staleIds, setStaleIds] = useState<readonly string[]>([])\r\n const [hover, setHover] = useState<{ id: string; top: number; left: number; right: number } | undefined>(undefined)\r\n const pendingHover = useRef<ReturnType<typeof setTimeout> | null>(null)\r\n const [pendingId, setPendingId] = useState<string | undefined>(undefined)\r\n const [errors, setErrors] = useState<Record<string, string>>({})\r\n const [armed, setArmed] = useState(false)\r\n // Flipped once by a 404: the composition's prime-memory cannot take marks,\r\n // so the section goes back to being the plain read-only list it was.\r\n const [writeAbsent, setWriteAbsent] = useState(false)\r\n // 历史召回组默认折叠:它们已不在上下文里,但仍属于“本会话见过什么”的一部分。\r\n const [historyOpen, setHistoryOpen] = useState(false)\r\n\r\n const show = useConfigFlag(ctx, resolveShowMemoryRecall)\r\n const view: MemoryRecallView | undefined = readRecall(\r\n useProjectionValue(ctx, scope?.sessionId, MEMORY_RECALL_KEY),\r\n )\r\n\r\n const sessionId = scope?.sessionId ?? ''\r\n const rating = writeAbsent === false && sessionId.length > 0\r\n\r\n const rate = useCallback((id: string, score: FeedbackScore): void => {\r\n if (score === -1 && armed === false) {\r\n // Retirement is destructive-ish (soft delete + a notice to the model):\r\n // the first click only arms the button.\r\n setArmed(true)\r\n setTimeout(() => { setArmed(false) }, ARM_WINDOW_MS)\r\n return\r\n }\r\n if (pendingId !== undefined) return\r\n setArmed(false)\r\n setPendingId(id)\r\n const impl: FeedbackFetch | undefined = props.fetchImpl\r\n ?? (typeof fetch === 'function' ? (fetch as unknown as FeedbackFetch) : undefined)\r\n void sendRecallFeedback(impl, { sessionId, id, score }).then(outcome => {\r\n setPendingId(undefined)\r\n if (outcome.status === 'sent') {\r\n setMarks(current => ({ ...current, [id]: score }))\r\n setErrors(current => {\r\n const next = { ...current }\r\n delete next[id]\r\n return next\r\n })\r\n if (score === -1) setStaleIds(current => (current.includes(id) ? current : [...current, id]))\r\n setHover(undefined)\r\n if (score !== -1) setSelectedId(undefined)\r\n } else if (outcome.status === 'absent') {\r\n setWriteAbsent(true)\r\n setSelectedId(undefined)\r\n } else {\r\n setErrors(current => ({ ...current, [id]: outcome.reason }))\r\n }\r\n })\r\n }, [armed, pendingId, props.fetchImpl, sessionId])\r\n\r\n const onSelect = useCallback((id: string): void => {\r\n setArmed(false)\r\n setSelectedId(current => (current === id ? undefined : id))\r\n }, [])\r\n\r\n // One bubble at a time, and it opens on a delay: sweeping the mouse down the\r\n // list must not paint a bubble for every row it passes.\r\n const onEnter = useCallback((id: string, el: HTMLElement): void => {\r\n if (pendingHover.current !== null) clearTimeout(pendingHover.current)\r\n const rect = el.getBoundingClientRect()\r\n pendingHover.current = setTimeout(() => {\r\n pendingHover.current = null\r\n // The whole rect travels, not just its origin: `bubblePos` needs the row's\r\n // RIGHT edge to place the box outside the sidebar instead of on top of it.\r\n setHover({ id, top: rect.top, left: rect.left, right: rect.right })\r\n }, HOVER_DELAY_MS)\r\n }, [])\r\n\r\n const onLeave = useCallback((): void => {\r\n if (pendingHover.current !== null) {\r\n clearTimeout(pendingHover.current)\r\n pendingHover.current = null\r\n }\r\n setHover(undefined)\r\n }, [])\r\n\r\n // Unmounting mid-sweep would otherwise leave a timer that sets state on a\r\n // dead section.\r\n useEffect(() => () => {\r\n if (pendingHover.current !== null) clearTimeout(pendingHover.current)\r\n }, [])\r\n\r\n // Switched off at the settings faces — willed away, not empty.\r\n if (show === false) return null\r\n\r\n // Capability absent (prime-memory not in the composition, no frame yet).\r\n if (view === undefined) return null\r\n\r\n // Retired rows stay: that mark is the human's verdict, and the model did see them.\r\n // A `superseded` row is different — its text is no longer in context — so it is\r\n // hidden, and the footer reports the count so nothing disappears silently.\r\n const isStale = (item: MemoryRecallItem): boolean => item.retired === true || staleIds.includes(item.id)\r\n // 两组按“正文还在不在上下文”分:活跃 = 未取代(或被退场的例外,裁决凭证必须留下);\r\n // 其余历史 = 被摘要取代且未被裁决退场的,它们收进开关后面而不是只报个计数。\r\n const rows = view.items.filter(item => item.superseded !== true || item.retired === true)\r\n const historyRows = view.items.filter(item => item.superseded === true && item.retired !== true)\r\n const hidden = historyRows.length\r\n\r\n if (rows.length === 0) {\r\n return createElement(\r\n 'div',\r\n { style: SECTION_STYLE, 'data-dsh-brief-sidebar': 'memory-recall-section' },\r\n createElement('div', { style: HEADER_STYLE }, t('section.memoryRecall')),\r\n createElement(\r\n 'div',\r\n {\r\n style: EMPTY_STYLE,\r\n // 隐藏数为 0 时是真正的空态;否则这是“本轮确实召回过、但正文已被摘要替换”的告知。\r\n ...(hidden > 0 ? { 'data-dsh-brief-sidebar': 'recall-superseded-note' } : {}),\r\n },\r\n hidden > 0 ? expandCount(t('recall.supersededHidden'), hidden) : t('recall.empty'),\r\n ),\r\n // 空态下历史组仍要能展开:否则“全都被取代”的会话永远读不到自己召回过什么。\r\n historyRows.length > 0 && createElement(FoldToggle, {\r\n label: expandCount(t('recall.historyGroup'), historyRows.length),\r\n open: historyOpen,\r\n marker: 'recall-history-toggle',\r\n onToggle: () => { setHistoryOpen(current => !current) },\r\n }),\r\n historyOpen && createElement(\r\n 'ul',\r\n { style: LIST_STYLE },\r\n historyRows.map(item => createElement(RecallRow, {\r\n key: item.id,\r\n item,\r\n selected: false,\r\n stale: isStale(item),\r\n wasSuperseded: true,\r\n pending: false,\r\n armed: false,\r\n mark: undefined,\r\n error: undefined,\r\n rating: false,\r\n t,\r\n onSelect: () => {},\r\n onScore: () => {},\r\n onEnter: () => {},\r\n onLeave: () => {},\r\n })),\r\n ),\r\n )\r\n }\r\n\r\n return createElement(\r\n 'div',\r\n { style: SECTION_STYLE, 'data-dsh-brief-sidebar': 'memory-recall-section' },\r\n createElement('div', { style: HEADER_STYLE }, t('section.memoryRecall')),\r\n rating && createElement('div', { style: HINT_STYLE }, `${t('recall.rateHint')}${t('recall.strikeHint')}`),\r\n // 活跃组计数只说“仍在上下文”的那些,注入总数归页脚,两个数各说各的。\r\n rows.length > 0 && createElement(GroupHeader, {\r\n text: expandCount(t('recall.activeGroup'), rows.length),\r\n marker: 'recall-active-group',\r\n }),\r\n createElement(\r\n 'ul',\r\n { style: LIST_STYLE },\r\n rows.map(item => createElement(RecallRow, {\r\n key: item.id,\r\n item,\r\n selected: selectedId === item.id,\r\n stale: isStale(item),\r\n wasSuperseded: item.superseded === true,\r\n pending: pendingId === item.id,\r\n armed: armed && selectedId === item.id,\r\n mark: marks[item.id] ?? item.rating,\r\n error: errors[item.id],\r\n rating,\r\n t,\r\n onSelect: () => { onSelect(item.id) },\r\n onScore: (score: FeedbackScore) => { rate(item.id, score) },\r\n onEnter: (el: HTMLElement) => { onEnter(item.id, el) },\r\n onLeave,\r\n })),\r\n ),\r\n historyRows.length > 0 && createElement(FoldToggle, {\r\n label: expandCount(t('recall.historyGroup'), historyRows.length),\r\n open: historyOpen,\r\n marker: 'recall-history-toggle',\r\n onToggle: () => { setHistoryOpen(current => !current) },\r\n }),\r\n historyOpen && createElement(\r\n 'ul',\r\n { style: LIST_STYLE },\r\n historyRows.map(item => createElement(RecallRow, {\r\n key: item.id,\r\n item,\r\n // 历史行不开评分:退场与相关度都是对“还在上下文里的那条”的裁决,\r\n // 正文已被取代的行再标一次也不会回到上下文,只会让人以为还能救。\r\n selected: false,\r\n stale: isStale(item),\r\n wasSuperseded: true,\r\n pending: false,\r\n armed: false,\r\n mark: undefined,\r\n error: undefined,\r\n rating: false,\r\n t,\r\n onSelect: () => {},\r\n onScore: () => {},\r\n onEnter: () => {},\r\n onLeave: () => {},\r\n })),\r\n ),\r\n createElement(\r\n 'div',\r\n { style: FOOTER_STYLE },\r\n expandCount(t('recall.count'), view.count),\r\n hidden > 0 && createElement(\r\n 'div',\r\n { 'data-dsh-brief-sidebar': 'recall-superseded-note' },\r\n expandCount(t('recall.supersededHidden'), hidden),\r\n ),\r\n ),\r\n // The single bubble of this section. `typeof window` guard keeps a\r\n // non-DOM render (tests, SSR) from ever reaching the viewport maths.\r\n hover !== undefined && typeof window !== 'undefined'\r\n && (() => {\r\n const item = view.items.find(i => i.id === hover.id)\r\n if (item === undefined) return null\r\n return createElement(RecallBubble, {\r\n item,\r\n pos: bubblePos(hover, window.innerWidth, window.innerHeight),\r\n t,\r\n })\r\n })(),\r\n )\r\n}\r\n","/**\r\n * The memory-slots section: the `memorySlots` projection drawn as the third\r\n * part of the summary tab (fixed last: 进展 → 产物 → 记忆).\r\n *\r\n * TWO gates, both fail-open to \"hidden\", so a host without dsh-prime-memory\r\n * paints nothing here:\r\n *\r\n * 1. **The switch.** This plugin's entry config (`configForms` → entry\r\n * `dsh-brief-sidebar`, field `showMemorySlots`, default OFF — the pinned\r\n * list moved out of the summary pane's way in favour of the session-recall\r\n * section). When the config face cannot answer (service absent, scope not\r\n * ready, field unset) the default applies — see `scope-face.ts`.\r\n * 2. **The capability.** The `memorySlots` projection must exist for the\r\n * session; `undefined` hides the section entirely, exactly like the\r\n * optional deliverables section.\r\n *\r\n * Colours come from `--dsw-alias-*` tokens only (skin contract, enforced by\r\n * `tests/purity.spec.ts`).\r\n */\r\nimport { createElement, useCallback } from 'react'\r\nimport type { CSSProperties, ReactNode } from 'react'\r\nimport type { CtxProbe } from '../use-projection'\r\nimport {\r\n MEMORY_SLOTS_KEY,\r\n readSlots,\r\n truncateBody,\r\n} from './memory-slots'\r\nimport type { MemorySlotView, MemorySlotsView, SlotRefView } from './memory-slots'\r\nimport { resolveShowMemorySlots } from '../scope-face'\r\nimport { useConfigFlag } from './use-config-flag'\r\nimport { useProjectionValue } from '../use-projection'\r\nimport { expandCount } from '../locales'\r\nimport { openMemoryTab } from '../memory-tab'\r\n\r\nexport interface MemorySlotsSectionProps {\r\n /** The DSH locale lookup, passed down from `apply`. */\r\n t: (key: string) => string\r\n /** The client root context (the tab body's only way to reach services). */\r\n ctx?: CtxProbe\r\n /** The session this tab is scoped to. */\r\n scope?: { readonly sessionId?: string }\r\n}\r\n\r\nconst SECTION_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n borderBottom: '1px solid var(--dsw-alias-border-secondary)',\r\n}\r\n\r\nconst HEADER_STYLE: CSSProperties = {\r\n padding: '10px 12px 0',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n fontSize: 12,\r\n fontWeight: 600,\r\n}\r\n\r\nconst LIST_STYLE: CSSProperties = {\r\n listStyle: 'none',\r\n margin: 0,\r\n padding: '6px 0',\r\n display: 'flex',\r\n flexDirection: 'column',\r\n}\r\n\r\nconst ROW_STYLE: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'flex-start',\r\n gap: 8,\r\n padding: '6px 12px',\r\n}\r\n\r\nconst TITLE_STYLE: CSSProperties = {\r\n minWidth: 0,\r\n overflowWrap: 'anywhere',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n}\r\n\r\nconst META_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 11,\r\n lineHeight: '18px',\r\n whiteSpace: 'nowrap',\r\n}\r\n\r\n/** The kind pill: same form as the codeplan pill, tertiary emphasis. */\r\nconst KIND_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n border: '1px solid var(--dsw-alias-label-tertiary)',\r\n borderRadius: 999,\r\n padding: '0 6px',\r\n fontSize: 11,\r\n lineHeight: '16px',\r\n whiteSpace: 'nowrap',\r\n}\r\n\r\n/** The status pill: filled tint for an open slot, plain text otherwise. */\r\nconst STATUS_OPEN_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n color: 'var(--dsw-alias-label-primary)',\r\n border: '1px solid var(--dsw-alias-label-secondary)',\r\n borderRadius: 999,\r\n padding: '0 6px',\r\n fontSize: 11,\r\n lineHeight: '16px',\r\n whiteSpace: 'nowrap',\r\n}\r\n\r\nconst STATUS_SETTLED_STYLE: CSSProperties = {\r\n ...STATUS_OPEN_STYLE,\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n border: '1px solid var(--dsw-alias-label-tertiary)',\r\n}\r\n\r\nconst BODY_STYLE: CSSProperties = {\r\n margin: 0,\r\n minWidth: 0,\r\n overflowWrap: 'anywhere',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 12,\r\n lineHeight: '18px',\r\n}\r\n\r\nconst REFS_STYLE: CSSProperties = {\r\n ...BODY_STYLE,\r\n fontSize: 11,\r\n}\r\n\r\nconst TOTAL_STYLE: CSSProperties = {\r\n padding: '6px 12px 10px',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 12,\r\n}\r\n\r\nconst EMPTY_STYLE: CSSProperties = {\r\n margin: '0 auto',\r\n padding: 24,\r\n maxWidth: 460,\r\n textAlign: 'center',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n lineHeight: 1.7,\r\n fontSize: 12,\r\n}\r\n\r\n/** Locale key per known slot status; unknown statuses fall back to the raw wire value. */\r\nconst STATUS_KEY: Record<string, string> = {\r\n open: 'slots.status.open',\r\n done: 'slots.status.done',\r\n dropped: 'slots.status.dropped',\r\n expired: 'slots.status.expired',\r\n}\r\n\r\n/** The “查看” button beside a mem_* refView. */\r\nconst VIEW_BTN_STYLE: CSSProperties = {\r\n display: 'inline-block',\r\n marginLeft: 6,\r\n padding: '0 4px',\r\n fontSize: 10,\r\n lineHeight: '14px',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n border: '1px solid var(--dsw-alias-border-secondary)',\r\n borderRadius: 3,\r\n cursor: 'pointer',\r\n background: 'none',\r\n verticalAlign: 'middle',\r\n}\r\n\r\n/**\r\n * One slot row: kind pill, title (full body rides the tooltip), status pill,\r\n * priority; body line underneath when the wire view carries it; refs as\r\n * resolved 名称简述 (record_id → title) with a 「查看」 button for mem_* refs.\r\n */\r\nfunction SlotRow(props: { slot: MemorySlotView; t: (key: string) => string; onViewMemory?: (ref: string) => void }): ReactNode {\r\n const { slot, t, onViewMemory } = props\r\n const statusLabel = STATUS_KEY[slot.status] === undefined ? slot.status : t(STATUS_KEY[slot.status])\r\n const title = slot.body === undefined ? slot.title : `${slot.title} — ${slot.body}`\r\n const refsLine = slot.refViews !== undefined\r\n ? slot.refViews.map((view) => view.title).join(' · ')\r\n : slot.refs !== undefined\r\n ? slot.refs.join(' · ')\r\n : undefined\r\n return createElement(\r\n 'li',\r\n { style: ROW_STYLE },\r\n createElement('span', { style: KIND_STYLE }, slot.kind),\r\n createElement(\r\n 'div',\r\n { style: { minWidth: 0, flex: '1 1 auto', display: 'flex', flexDirection: 'column', gap: 2 } },\r\n createElement('span', { style: TITLE_STYLE, title }, slot.title),\r\n slot.body !== undefined && createElement('p', { style: BODY_STYLE }, truncateBody(slot.body)),\r\n refsLine !== undefined\r\n && createElement(\r\n 'p',\r\n {\r\n style: REFS_STYLE,\r\n title: slot.refs !== undefined ? slot.refs.join('\\n') : undefined,\r\n },\r\n ...(slot.refViews !== undefined\r\n ? slot.refViews.flatMap((view) => {\r\n const nodes: ReactNode[] = [view.title]\r\n if (view.ref.startsWith('mem_') && onViewMemory !== undefined) {\r\n nodes.push(createElement('button', {\r\n key: `view-${view.ref}`,\r\n type: 'button' as const,\r\n style: VIEW_BTN_STYLE,\r\n onClick: (e: { stopPropagation(): void }) => { e.stopPropagation(); onViewMemory(view.ref) },\r\n }, t('slots.viewMemory')))\r\n }\r\n return nodes\r\n }).flatMap((node, i) => i === 0 ? [node] : [' · ', node])\r\n : [refsLine]),\r\n ),\r\n ),\r\n createElement('span', { style: META_STYLE }, `P${slot.priority}`),\r\n createElement(\r\n 'span',\r\n { style: slot.status === 'open' ? STATUS_OPEN_STYLE : STATUS_SETTLED_STYLE },\r\n statusLabel,\r\n ),\r\n )\r\n}\r\n\r\n/**\r\n * Subscribe to this plugin's entry config and resolve the slots switch.\r\n * Plumbing lives in `use-config-flag`; the default (off) lives in the resolver.\r\n *\r\n * @param ctx - the client root context handed to the tab body.\r\n * @returns whether the memory-slots section may render at all.\r\n */\r\nexport function useShowMemorySlots(ctx: CtxProbe | undefined): boolean {\r\n return useConfigFlag(ctx, resolveShowMemorySlots)\r\n}\r\n\r\n/**\r\n * The memory-slots section. Both hooks run unconditionally (a conditional\r\n * hook order would break the moment the switch flips); the switch only\r\n * decides whether the resolved view paints.\r\n * @param props - translation, client context, session scope.\r\n */\r\nexport function MemorySlotsSection(props: MemorySlotsSectionProps): ReactNode {\r\n const { t, ctx, scope } = props\r\n\r\n const show = useShowMemorySlots(ctx)\r\n const view: MemorySlotsView | undefined = readSlots(\r\n useProjectionValue(ctx, scope?.sessionId, MEMORY_SLOTS_KEY),\r\n )\r\n\r\n // 查看按钮的 opener:经模块级 openMemoryTab 走 betterSidebar.openTab,完全绕过文件系统。\r\n const onViewMemory = useCallback((ref: string) => {\r\n openMemoryTab(ref)\r\n }, [])\r\n\r\n // Switched off at the settings faces — the section is willed away, not\r\n // empty (an empty state would claim prime-memory answered when the user\r\n // simply closed the section).\r\n if (show === false) return null\r\n\r\n // Capability absent (prime-memory not in the composition, no frame yet) —\r\n // hide, don't nag; the memory panel remains the write surface.\r\n if (view === undefined) return null\r\n\r\n if (view.slots.length === 0) {\r\n return createElement(\r\n 'div',\r\n { style: SECTION_STYLE, 'data-dsh-brief-sidebar': 'memory-slots-section' },\r\n createElement('div', { style: HEADER_STYLE }, t('section.memorySlots')),\r\n createElement(\r\n 'div',\r\n { style: EMPTY_STYLE },\r\n createElement('div', { style: { marginBottom: 6, color: 'var(--dsw-alias-label-secondary)' } }, t('slots.empty')),\r\n createElement('div', null, t('slots.emptyHint')),\r\n ),\r\n )\r\n }\r\n\r\n return createElement(\r\n 'div',\r\n { style: SECTION_STYLE, 'data-dsh-brief-sidebar': 'memory-slots-section' },\r\n createElement('div', { style: HEADER_STYLE }, t('section.memorySlots')),\r\n createElement(\r\n 'ul',\r\n { style: LIST_STYLE },\r\n view.slots.map(slot => createElement(SlotRow, { key: slot.id, slot, t, onViewMemory })),\r\n ),\r\n createElement(\r\n 'div',\r\n { style: TOTAL_STYLE },\r\n expandCount(t('slots.openCount'), view.openCount),\r\n ),\r\n )\r\n}\r\n","/**\r\n * The `spiritEcho` projection — reading it.\r\n *\r\n * Registered by `dsh-spirit` (key `spiritEcho`). Since spirit 0.8.3 the wire view is\r\n * `{token, total, segments, lastStep?}` and its source is spirit's `echo_recall` table,\r\n * so what rides this face is **this session's recalled echo passages** — and they\r\n * survive a restart (that is the whole point of moving off the in-process buffer).\r\n *\r\n * Two outcomes stay apart, mirroring the memory-slots reader:\r\n * - `undefined` — capability ABSENT (spirit not composed, or a shape drift bad enough\r\n * that rendering it would lie);\r\n * - a view — `segments: []` IS the empty state (a fresh session simply has no recall yet).\r\n *\r\n * Malformed rows are dropped rather than thrown on: this is a trusted-Host value\r\n * rendered defensively. The excerpt is already capped by spirit (≤240 chars).\r\n */\r\n\r\n/** The projection key `dsh-spirit` registers (its canonical constant). */\r\nexport const SPIRIT_ECHO_KEY = 'spiritEcho'\r\n\r\n/** One recalled passage as the projection publishes it. */\r\nexport interface SpiritEchoSegment {\r\n /** The recalled passage itself (already truncated by spirit). */\r\n readonly excerpt: string\r\n /** First time this session recalled it (ms). */\r\n readonly firstTs: number\r\n /** Most recent recall (ms). */\r\n readonly lastTs: number\r\n /** Recall count within this session. */\r\n readonly times: number\r\n}\r\n\r\n/** One referent of an echo entry (spirit v0.8.7): the memory item it points at. */\r\nexport interface SpiritEchoRef {\r\n readonly kind: string\r\n readonly id: string\r\n readonly label: string\r\n}\r\n\r\n/** The latest pre-step decision (answers \"why no card this round\"). */\r\nexport interface SpiritEchoStep {\r\n /** Entry id (`echo-<ts>`); the viewer fetches the original card by it. */\r\n readonly id: string\r\n readonly at: number\r\n readonly kind: 'injected' | 'skipped'\r\n readonly reason: string\r\n /** One-line summary of the injected card (`''` for skipped rows). */\r\n readonly preview: string\r\n /**\r\n * Content-first title (spirit frame v5+): e.g. the thread task name\r\n * `plugin-9lang-five-dim`. Absent on older frames ⇒ fall back to `preview`.\r\n */\r\n readonly title?: string\r\n /** The memory items this echo points at (memid), for entry/graph jumps. */\r\n readonly refs?: readonly SpiritEchoRef[]\r\n}\r\n\r\n/** One recalled **record** (spirit frame v7): `echoId = echo-<uuid>` belongs to the record itself. */\r\nexport interface SpiritEchoRecordRow {\r\n readonly echoId: string\r\n readonly sessionId: string\r\n readonly kind: string\r\n readonly memId: string\r\n readonly title: string\r\n readonly times: number\r\n /** The record's own timestamp (shown as \"记录时间\"). */\r\n readonly recordTs: number\r\n readonly firstTs: number\r\n readonly lastTs: number\r\n /** Latest recall event id (`recall-<uuid>`). */\r\n readonly lastRecallId: string\r\n}\r\n\r\n/** Old alias (one release). */\r\nexport type SpiritEchoRefRow = SpiritEchoRecordRow\r\n\r\n/** One recall event (v7): `recall-<uuid>`, one per injection round. */\r\nexport interface SpiritEchoRecall {\r\n readonly recallId: string\r\n readonly at: number\r\n readonly flashback: boolean\r\n}\r\n\r\n/** Tone/state (special format, not a reference). */\r\nexport interface SpiritEchoTone {\r\n readonly at: number\r\n readonly state?: string\r\n readonly opening?: string\r\n}\r\n\r\n/** The whole wire view of one frame. */\r\nexport interface SpiritEchoView {\r\n /** DB-derived token; changes whenever this session's echo store changes. */\r\n readonly token: number\r\n /** Distinct recalled passages in this session. */\r\n readonly total: number\r\n /** This session's recalled passages, newest first, ≤20. */\r\n readonly segments: readonly SpiritEchoSegment[]\r\n /** This session's recent echo entries (injected/skipped), newest first, ≤5. */\r\n readonly steps: readonly SpiritEchoStep[]\r\n readonly lastStep?: SpiritEchoStep\r\n /** Recalled records (v7 main data): one row per record (echo-<uuid>). */\r\n readonly records?: readonly SpiritEchoRecordRow[]\r\n /** Old alias (same content as records). */\r\n readonly refs?: readonly SpiritEchoRecordRow[]\r\n /** Latest recall event (recall-<uuid>). */\r\n readonly recall?: SpiritEchoRecall\r\n /** Tone/state (special format). */\r\n readonly tone?: SpiritEchoTone\r\n}\r\n\r\n/**\r\n * Narrow a raw projection value into an echo view.\r\n *\r\n * @param value - the raw `unknown` snapshot of the `spiritEcho` face.\r\n * @returns the validated view, or `undefined` when the capability is absent.\r\n */\r\nexport function readSpiritEcho(value: unknown): SpiritEchoView | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as Record<string, unknown>\r\n if (!isCounter(raw['token']) || !isCounter(raw['total'])) return undefined\r\n if (!Array.isArray(raw['segments'])) return undefined\r\n const segments: SpiritEchoSegment[] = []\r\n for (const entry of raw['segments']) {\r\n const segment = readSegment(entry)\r\n if (segment !== undefined) segments.push(segment)\r\n }\r\n const step = readStep(raw['lastStep'])\r\n const steps: SpiritEchoStep[] = []\r\n if (Array.isArray(raw['steps'])) {\r\n for (const entry of raw['steps']) {\r\n const row = readStep(entry)\r\n if (row !== undefined) steps.push(row)\r\n }\r\n }\r\n const records: SpiritEchoRecordRow[] = []\r\n for (const source of [raw['records'], raw['refs']]) {\r\n if (!Array.isArray(source)) continue\r\n for (const entry of source) {\r\n const row = readRecord(entry)\r\n if (row !== undefined && !records.some((item) => item.echoId === row.echoId && item.sessionId === row.sessionId)) records.push(row)\r\n }\r\n }\r\n const recall = readRecall(raw['recall'])\r\n const tone = readTone(raw['tone'])\r\n return {\r\n token: raw['token'],\r\n total: raw['total'],\r\n segments,\r\n steps,\r\n ...(step === undefined ? {} : { lastStep: step }),\r\n ...(records.length === 0 ? {} : { records, refs: records }),\r\n ...(recall === undefined ? {} : { recall }),\r\n ...(tone === undefined ? {} : { tone }),\r\n };\r\n}\r\n\r\n/** Whether a value is a non-negative safe integer (the view's counter shape). */\r\nfunction isCounter(value: unknown): value is number {\r\n return typeof value === 'number' && Number.isSafeInteger(value) && value >= 0\r\n}\r\n\r\n/** Narrow one record; `undefined` = malformed, dropped (old frames lack it). */\r\nfunction readRecord(value: unknown): SpiritEchoRecordRow | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as Record<string, unknown>\r\n // v7: echoId + lastRecallId;v6: refId + lastEchoStepId\r\n const echoId = typeof raw['echoId'] === 'string' && raw['echoId'] !== ''\r\n ? raw['echoId']\r\n : typeof raw['refId'] === 'string' ? raw['refId'] : ''\r\n if (echoId === '') return undefined\r\n if (typeof raw['kind'] !== 'string' || raw['kind'] === '') return undefined\r\n if (typeof raw['memId'] !== 'string' || raw['memId'] === '') return undefined\r\n if (!isCounter(raw['times']) || !isCounter(raw['firstTs']) || !isCounter(raw['lastTs'])) return undefined\r\n const recordTs = isCounter(raw['recordTs']) ? raw['recordTs'] : raw['firstTs']\r\n const lastRecallId = typeof raw['lastRecallId'] === 'string'\r\n ? raw['lastRecallId']\r\n : typeof raw['lastEchoStepId'] === 'string' ? raw['lastEchoStepId'] : ''\r\n return {\r\n echoId,\r\n sessionId: typeof raw['sessionId'] === 'string' ? raw['sessionId'] : '',\r\n kind: raw['kind'],\r\n memId: raw['memId'],\r\n title: typeof raw['title'] === 'string' ? raw['title'] : '',\r\n times: raw['times'],\r\n recordTs,\r\n firstTs: raw['firstTs'],\r\n lastTs: raw['lastTs'],\r\n lastRecallId,\r\n }\r\n}\r\n\r\n/** Narrow the optional recall event row. */\r\nfunction readRecall(value: unknown): SpiritEchoRecall | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as Record<string, unknown>\r\n if (typeof raw['recallId'] !== 'string' || raw['recallId'] === '') return undefined\r\n if (!isCounter(raw['at'])) return undefined\r\n return { recallId: raw['recallId'], at: raw['at'], flashback: raw['flashback'] === true }\r\n}\r\n\r\n/** Narrow the optional tone row (special format; absent on old frames). */\r\nfunction readTone(value: unknown): SpiritEchoTone | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as Record<string, unknown>\r\n if (!isCounter(raw['at'])) return undefined\r\n const state = typeof raw['state'] === 'string' && raw['state'] !== '' ? raw['state'] : undefined\r\n const opening = typeof raw['opening'] === 'string' && raw['opening'] !== '' ? raw['opening'] : undefined\r\n if (state === undefined && opening === undefined) return undefined\r\n return { at: raw['at'], ...(state === undefined ? {} : { state }), ...(opening === undefined ? {} : { opening }) }\r\n}\r\n\r\n/** Narrow one recalled passage; `undefined` = malformed, dropped. */\r\nfunction readSegment(value: unknown): SpiritEchoSegment | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as Record<string, unknown>\r\n if (typeof raw['excerpt'] !== 'string' || raw['excerpt'] === '') return undefined\r\n if (!isCounter(raw['firstTs']) || !isCounter(raw['lastTs']) || !isCounter(raw['times'])) return undefined\r\n return {\r\n excerpt: raw['excerpt'],\r\n firstTs: raw['firstTs'],\r\n lastTs: raw['lastTs'],\r\n times: raw['times'],\r\n }\r\n}\r\n\r\n/** Narrow the optional last-step row. */\r\nfunction readStep(value: unknown): SpiritEchoStep | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as Record<string, unknown>\r\n if (!isCounter(raw['at'])) return undefined\r\n if (raw['kind'] !== 'injected' && raw['kind'] !== 'skipped') return undefined\r\n if (typeof raw['reason'] !== 'string') return undefined\r\n // 编号缺席时按 `echo-<ts>` 兜底:老帧没有 id 也能打开原文(查不到就是查不到)。\r\n const id = typeof raw['id'] === 'string' && raw['id'] !== '' ? raw['id'] : `echo-${raw['at']}`\r\n const refs: SpiritEchoRef[] = []\r\n if (Array.isArray(raw['refs'])) {\r\n for (const entry of raw['refs']) {\r\n if (entry === null || typeof entry !== 'object' || Array.isArray(entry)) continue\r\n const ref = entry as Record<string, unknown>\r\n if (typeof ref['kind'] !== 'string' || ref['kind'] === '') continue\r\n if (typeof ref['id'] !== 'string' || ref['id'] === '') continue\r\n refs.push({ kind: ref['kind'], id: ref['id'], label: typeof ref['label'] === 'string' ? ref['label'] : '' })\r\n }\r\n }\r\n return {\r\n id,\r\n at: raw['at'],\r\n kind: raw['kind'],\r\n reason: raw['reason'],\r\n preview: typeof raw['preview'] === 'string' ? raw['preview'] : '',\r\n ...(typeof raw['title'] === 'string' && raw['title'] !== '' ? { title: raw['title'] } : {}),\r\n ...(refs.length === 0 ? {} : { refs }),\r\n }\r\n}\r\n","/**\r\n * Opening the spirit echo page (cross-bundle deep link).\r\n *\r\n * `dsh-spirit` owns the Memory Sea panel; this plugin must not import it and\r\n * must not call `layout.selectPanel` itself — that call THROWS when the main\r\n * key is not registered (host contract). So the request rides one cancelable\r\n * `CustomEvent` and the owner answers synchronously: it writes `detail.ack`\r\n * and calls `preventDefault()` on success.\r\n *\r\n * Absence is a normal outcome: no listener → `ack` missing and the event not\r\n * prevented → `{ok:false, reason:'absent'}` and the caller shows fallback copy.\r\n */\r\n\r\n/** The event `dsh-spirit` listens for (`client/src/entry.ts`, same literal). */\r\nexport const SPIRIT_OPEN_EVENT = 'dsh-spirit:open-sea'\r\n\r\n/** Synchronous answer from the panel owner. */\r\nexport interface SpiritOpenAck {\r\n ok: boolean\r\n /** `unmounted` = panel not in the composition; `unregistered` = main key not registered. */\r\n reason?: string\r\n /** Owner-side diagnostic (which resolver path was tried / what threw). Tooltip only. */\r\n detail?: string\r\n}\r\n\r\n/** Which spirit view to reveal: `echo` = 翻阅 → 回响(条目面); `graph` = 星海星图面。 */\r\nexport type SpiritOpenTarget = 'echo' | 'graph'\r\n\r\n/** Event detail shape (spirit reads `target`, writes `ack`). */\r\ninterface SpiritOpenDetail {\r\n target: SpiritOpenTarget\r\n ack?: SpiritOpenAck\r\n}\r\n\r\n/**\r\n * Ask spirit to reveal one of its echo views.\r\n *\r\n * @param target - `echo` (default, the recalled-passage list) or `graph` (the star map).\r\n * @returns `{ok:true}` when the owner opened the panel; otherwise the owner's\r\n * reason, or `absent` when nothing listened.\r\n */\r\nexport function openSpiritEcho(target: SpiritOpenTarget = 'echo'): SpiritOpenAck {\r\n if (typeof window === 'undefined') return { ok: false, reason: 'absent' }\r\n const detail: SpiritOpenDetail = { target }\r\n const event = new CustomEvent(SPIRIT_OPEN_EVENT, { detail, cancelable: true })\r\n window.dispatchEvent(event)\r\n if (detail.ack !== undefined) return detail.ack\r\n return event.defaultPrevented ? { ok: true } : { ok: false, reason: 'absent' }\r\n}\r\n","/**\r\n * The 「查看 ▾」 control for one echo row (and the echo section header).\r\n *\r\n * Rows used to be a single button straight into the original-card viewer. That\r\n * answered \"what did the card say\", but not \"where does this live in spirit\":\r\n * the 条目 list and the star map are two different pages there, and the footer\r\n * links sit far below a long row list. So each row gets the same popover the\r\n * memory rows already have (速览 / 条目 / 2D·3D), with echo's three targets:\r\n *\r\n * - 原文 → this plugin's own viewer tab (`dsh-md-echo-viewer:echo`);\r\n * - 条目 → spirit 翻阅 → 回响 (`dsh-spirit:open-sea` target=`echo`);\r\n * - 星图 → spirit 星海星图 (`dsh-spirit:open-sea` target=`graph`).\r\n *\r\n * The owner answers synchronously, so a failure lands as readable copy on the\r\n * trigger's tooltip instead of a dead click.\r\n *\r\n * Colours come from `--dsw-alias-*` tokens only (skin contract).\r\n */\r\nimport { createElement, useCallback, useEffect, useRef, useState } from 'react'\r\nimport type { CSSProperties, KeyboardEvent, ReactNode } from 'react'\r\nimport { openEchoTab } from '../memory-tab'\r\nimport { openSpiritEcho } from '../spirit-open'\r\n\r\nexport interface EchoViewMenuProps {\r\n /** The DSH locale lookup, passed down from `apply`. */\r\n t: (key: string) => string\r\n /** The session the row belongs to (the viewer tab needs it). */\r\n sessionId?: string\r\n /** The echo id this row points at; absent = section-level menu. */\r\n echoId?: string\r\n /** Trigger copy; defaults to `echo.viewMenu` + caret. */\r\n label?: string\r\n}\r\n\r\ntype MenuEntry = 'original' | 'entry' | 'graph'\r\n\r\n/** Menu entries, in reading order. */\r\nconst ENTRIES: ReadonlyArray<{ mode: MenuEntry; key: string }> = [\r\n { mode: 'original', key: 'echo.openOriginal' },\r\n { mode: 'entry', key: 'echo.goto' },\r\n { mode: 'graph', key: 'echo.gotoGraph' },\r\n]\r\n\r\nconst TRIGGER_STYLE: CSSProperties = {\r\n padding: '1px 8px',\r\n border: '1px solid var(--dsw-alias-border-secondary)',\r\n borderRadius: 4,\r\n background: 'none',\r\n font: 'inherit',\r\n fontSize: 11,\r\n lineHeight: '18px',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n cursor: 'pointer',\r\n whiteSpace: 'nowrap',\r\n}\r\n\r\nconst ITEM_STYLE: CSSProperties = {\r\n padding: '1px 8px',\r\n border: '1px solid var(--dsw-alias-label-tertiary)',\r\n borderRadius: 999,\r\n background: 'none',\r\n font: 'inherit',\r\n fontSize: 11,\r\n lineHeight: '18px',\r\n color: 'var(--dsw-alias-label-primary)',\r\n cursor: 'pointer',\r\n whiteSpace: 'nowrap',\r\n}\r\n\r\n/**\r\n * Anchored INSIDE the row wrapper (absolute), not fixed-to-viewport.\r\n *\r\n * 实测:主栏带缩放的皮肤下,用按钮的 viewport 坐标去摆 fixed 弹层会落到视口外\r\n * (量到 trigger(1613,926) 而弹层在 (1692,1730))。不量坐标就没有这类错位——弹层\r\n * 跟着行走,唯一代价是贴到面板边缘时可能被裁一点,滚一下就能看全。\r\n */\r\nconst POPOVER_STYLE: CSSProperties = {\r\n position: 'absolute',\r\n top: 'calc(100% + 4px)',\r\n right: 0,\r\n zIndex: 1100,\r\n display: 'flex',\r\n alignItems: 'center',\r\n gap: 4,\r\n padding: '6px 8px',\r\n background: 'var(--dsw-alias-bg-layer-1)',\r\n border: '1px solid var(--dsw-alias-border-secondary)',\r\n borderRadius: 8,\r\n}\r\n\r\nconst WRAP_STYLE: CSSProperties = {\r\n position: 'relative',\r\n display: 'flex',\r\n alignItems: 'center',\r\n gap: 4,\r\n minWidth: 0,\r\n}\r\n\r\n/**\r\n * The echo row menu. All hooks run before any conditional rendering.\r\n * @param props - translation, session scope, row id.\r\n */\r\nexport function EchoViewMenu(props: EchoViewMenuProps): ReactNode {\r\n const { t, sessionId, echoId, label } = props\r\n const [open, setOpen] = useState(false)\r\n const [fail, setFail] = useState<{ reason: string; detail?: string } | undefined>(undefined)\r\n const rootRef = useRef<HTMLDivElement | null>(null)\r\n const triggerRef = useRef<HTMLButtonElement | null>(null)\r\n\r\n // Close on an outside mousedown while the menu is open.\r\n useEffect(() => {\r\n if (!open) return\r\n const onDocDown = (event: MouseEvent): void => {\r\n const root = rootRef.current\r\n if (root !== null && event.target instanceof Node && root.contains(event.target)) return\r\n setOpen(false)\r\n }\r\n document.addEventListener('mousedown', onDocDown)\r\n return () => { document.removeEventListener('mousedown', onDocDown) }\r\n }, [open])\r\n\r\n const pick = useCallback((mode: MenuEntry): void => {\r\n setOpen(false)\r\n if (mode === 'original') {\r\n openEchoTab(sessionId ?? '', echoId ?? '')\r\n setFail(undefined)\r\n return\r\n }\r\n // 选单叫「条目」,深链口叫 `echo`(spirit 那边的页面名)——这里就这一处对照。\r\n const result = openSpiritEcho(mode === 'entry' ? 'echo' : 'graph')\r\n setFail(result.ok ? undefined : { reason: result.reason ?? 'absent', detail: result.detail })\r\n }, [echoId, sessionId])\r\n\r\n const onKeyDown = useCallback((event: KeyboardEvent<HTMLDivElement>): void => {\r\n if (event.key !== 'Escape') return\r\n setOpen(false)\r\n }, [])\r\n\r\n /** Open/close. The chips hang off the trigger's own box, so no coordinates are measured. */\r\n const toggle = useCallback((event: { stopPropagation(): void }): void => {\r\n // The row's own click opens the viewer; the menu must not trigger it.\r\n event.stopPropagation()\r\n setFail(undefined)\r\n setOpen((value) => !value)\r\n }, [])\r\n\r\n return createElement(\r\n 'div',\r\n {\r\n ref: rootRef,\r\n style: WRAP_STYLE,\r\n onKeyDown,\r\n 'data-dsh-brief-sidebar': echoId === undefined ? 'echo-view-menu' : 'echo-view-row-menu',\r\n },\r\n createElement(\r\n 'button',\r\n {\r\n ref: triggerRef,\r\n type: 'button' as const,\r\n style: TRIGGER_STYLE,\r\n 'aria-haspopup': 'menu',\r\n 'aria-expanded': open,\r\n ...(fail === undefined ? {} : { title: `${t('echo.gotoFail')}(${fail.reason})${fail.detail ?? ''}` }),\r\n onClick: toggle,\r\n },\r\n `${label ?? t('echo.viewMenu')} ▾`,\r\n ),\r\n open && createElement(\r\n 'div',\r\n {\r\n role: 'menu',\r\n style: { ...POPOVER_STYLE, maxWidth: 'calc(100vw - 16px)' },\r\n 'aria-label': t('echo.viewMenu'),\r\n },\r\n ...ENTRIES.map(entry => createElement(\r\n 'button',\r\n {\r\n key: entry.mode,\r\n type: 'button' as const,\r\n role: 'menuitem',\r\n style: ITEM_STYLE,\r\n 'data-dsh-brief-sidebar': `echo-view-${entry.mode}`,\r\n onClick: (e: { stopPropagation(): void }) => { e.stopPropagation(); pick(entry.mode) },\r\n },\r\n t(entry.key),\r\n )),\r\n ),\r\n )\r\n}\r\n","/**\r\n * The spirit-echo tab: which echo passages dsh-spirit recalled **in this session**,\r\n * drawn from the `spiritEcho` projection (v0.8.3: spirit's durable `echo_recall`).\r\n *\r\n * Contract mirrors the memory sections:\r\n * - capability absent (`spiritEcho` unit missing) → render nothing;\r\n * - `segments: []` → honest empty state (a fresh session has recalled nothing yet);\r\n * - data → this session's passage count + the latest passage + two pointers:\r\n * 「星图」 (the star map) and 「条目」 (翻阅 → 回响). Both ride the same deep link.\r\n *\r\n * The `lastStep` line answers \"why no card this round\" and is deliberately kept\r\n * apart from the passage list: one is an observation, the other is memory.\r\n *\r\n * Colours come from `--dsw-alias-*` tokens only (skin contract).\r\n */\r\nimport { createElement, useCallback, useState } from 'react'\r\nimport type { CSSProperties, ReactNode } from 'react'\r\nimport type { CtxProbe } from '../use-projection'\r\nimport { useProjectionValue } from '../use-projection'\r\nimport { SPIRIT_ECHO_KEY, readSpiritEcho } from '../spirit-echo'\r\nimport type { SpiritEchoRefRow, SpiritEchoStep } from '../spirit-echo'\r\nimport { openSpiritEcho } from '../spirit-open'\r\nimport type { SpiritOpenTarget } from '../spirit-open'\r\nimport { openEchoTab } from '../memory-tab'\r\nimport { EchoViewMenu } from './EchoViewMenu'\r\nimport { expandCount } from '../locales'\r\n\r\nexport interface SpiritEchoSectionProps {\r\n /** The DSH locale lookup, passed down from `apply`. */\r\n t: (key: string) => string\r\n /** The client root context (the tab body's only way to reach services). */\r\n ctx?: CtxProbe\r\n /** The session this tab is scoped to. */\r\n scope?: { readonly sessionId?: string }\r\n /** True when the section is rendered inside a tab that already names it (引用 → 回响). */\r\n hideHeader?: boolean\r\n}\r\n\r\nconst SECTION_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n borderBottom: '1px solid var(--dsw-alias-border-secondary)',\r\n}\r\n\r\nconst HEADER_STYLE: CSSProperties = {\r\n padding: '10px 12px 0',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n fontSize: 12,\r\n fontWeight: 600,\r\n}\r\n\r\nconst BODY_STYLE: CSSProperties = {\r\n padding: '6px 12px 10px',\r\n display: 'flex',\r\n flexDirection: 'column',\r\n gap: 2,\r\n fontSize: 12,\r\n lineHeight: '18px',\r\n}\r\n\r\nconst LINE_STYLE: CSSProperties = {\r\n color: 'var(--dsw-alias-label-secondary)',\r\n overflowWrap: 'anywhere',\r\n}\r\n\r\nconst MUTED_STYLE: CSSProperties = {\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n}\r\n\r\nconst VIEW_BTN_STYLE: CSSProperties = {\r\n alignSelf: 'flex-start',\r\n marginTop: 2,\r\n padding: 0,\r\n border: 'none',\r\n background: 'none',\r\n font: 'inherit',\r\n fontSize: 12,\r\n color: 'var(--dsw-alias-label-secondary)',\r\n cursor: 'pointer',\r\n textDecoration: 'underline',\r\n}\r\n\r\nconst FAIL_STYLE: CSSProperties = {\r\n ...MUTED_STYLE,\r\n fontSize: 11,\r\n}\r\n\r\n/** 一行里的两个跳转链接(星图 / 条目)。 */\r\nconst LINK_ROW_STYLE: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'center',\r\n gap: 12,\r\n marginTop: 2,\r\n}\r\n\r\n/** 一行:摘要文本按钮(开原文)+ 查看选单(原文 / 条目 / 星图)。 */\r\nconst ROW_STYLE: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'center',\r\n gap: 4,\r\n minWidth: 0,\r\n}\r\n\r\nconst ROW_TEXT_STYLE: CSSProperties = {\r\n ...LINE_STYLE,\r\n flex: '1 1 auto',\r\n minWidth: 0,\r\n padding: 0,\r\n border: 'none',\r\n background: 'none',\r\n font: 'inherit',\r\n textAlign: 'left' as const,\r\n cursor: 'pointer',\r\n overflow: 'hidden',\r\n textOverflow: 'ellipsis',\r\n whiteSpace: 'nowrap' as const,\r\n}\r\n\r\n/** 最近一段的显示长度:侧栏一行,不让一句回忆把整列顶开。 */\r\nconst LATEST_MAX = 60\r\n\r\n/**\r\n * 卡片分段行的词表(与 spirit 的 `ECHO_SEGMENTS` 同口径)。\r\n * 旧版落档没有清洗过的摘要(<system-reminder> 开头、后面跟免责声明),\r\n * 侧栏得自己把它剥掉——旧数据不会因为新版本重写。\r\n */\r\nconst CARD_MARKERS = ['状态:', '反馈:', '线程:', '事务:', '刚刚:', '想起:', '开场:'] as const\r\n\r\n/** 把一张卡的摘要剥成一句:从第一个分段行开切,否则只去标签。 */\r\nfunction cleanPreview(text: string): string {\r\n let cut = -1\r\n for (const marker of CARD_MARKERS) {\r\n const at = text.indexOf(marker)\r\n if (at >= 0 && (cut < 0 || at < cut)) cut = at\r\n }\r\n const body = cut > 0 ? text.slice(cut) : text\r\n return body\r\n .replaceAll(/<[^>]*>/g, ' ')\r\n .replaceAll(/(角色体验快照[^)]*)/g, ' ')\r\n .replaceAll(/\\s+/g, ' ')\r\n .trim()\r\n}\r\n\r\n/** 展示短号:`echo-` + UUID 去连字符前 12 位(与 spirit 侧同口径)。 */\r\nfunction shortEcho(echoId: string): string {\r\n const body = echoId.startsWith('echo-') ? echoId.slice('echo-'.length) : echoId\r\n return `echo-${body.replaceAll('-', '').slice(0, 12)}`\r\n}\r\n\r\n/** 记录时间:`M/D HH:mm`。 */\r\nfunction recordTime(ms: number): string {\r\n const date = new Date(ms)\r\n const pad = (value: number): string => String(value).padStart(2, '0')\r\n return `${date.getMonth() + 1}/${date.getDate()} ${pad(date.getHours())}:${pad(date.getMinutes())}`\r\n}\r\n\r\n/** 行文字:标题(无则 memId);编号/时间/次数另起副行(v7:记录持 echo 号)。 */\r\nfunction rowLabel(row: SpiritEchoRefRow): string {\r\n const title = (row.title ?? '').trim()\r\n return shorten(title !== '' ? title : row.memId)\r\n}\r\n\r\n/** 副行:`echo-xxxx · 11/9 02:46 ×3`。 */\r\nfunction rowMeta(row: SpiritEchoRefRow): string {\r\n const times = row.times > 1 ? ` ×${row.times}` : ''\r\n return `${shortEcho(row.echoId)} · ${recordTime(row.recordTs)}${times}`\r\n}\r\n\r\nfunction shorten(text: string): string {\r\n const flat = cleanPreview(text)\r\n return flat.length <= LATEST_MAX ? flat : `${flat.slice(0, LATEST_MAX)}…`\r\n}\r\n\r\n/**\r\n * 跳过的日志压成一句:`门名 ×次数`。逐条列门名对用户没有信息量,\r\n * 但「这轮为什么没卡」需要能一眼看出来,所以保留汇总而不是全删。\r\n */\r\nfunction summarizeSkips(rows: readonly SpiritEchoStep[]): string {\r\n if (rows.length === 0) return ''\r\n const counts = new Map<string, number>()\r\n for (const row of rows) {\r\n const key = row.reason === '' ? '?' : row.reason\r\n counts.set(key, (counts.get(key) ?? 0) + 1)\r\n }\r\n return [...counts.entries()]\r\n .map(([reason, times]) => (times > 1 ? `${reason} ×${times}` : reason))\r\n .join('、')\r\n}\r\n\r\n/**\r\n * The echo section. The hook runs unconditionally so the absent case never\r\n * changes hook order.\r\n * @param props - translation, client context, session scope.\r\n */\r\nexport function SpiritEchoSection(props: SpiritEchoSectionProps): ReactNode {\r\n const { t, ctx, scope, hideHeader = false } = props\r\n const view = readSpiritEcho(useProjectionValue(ctx, scope?.sessionId, SPIRIT_ECHO_KEY))\r\n // 失败回执整条留着(不只 reason):owner 给的 detail 要能落到 title 上,\r\n // 否则「打开回响失败(unregistered)」永远只有三个字,排查只能靠猜。\r\n const [fail, setFail] = useState<{ reason: string; detail?: string } | undefined>(undefined)\r\n\r\n const onOpen = useCallback((target: SpiritOpenTarget): void => {\r\n const result = openSpiritEcho(target)\r\n setFail(result.ok ? undefined : { reason: result.reason ?? 'absent', detail: result.detail })\r\n }, [])\r\n\r\n // Capability absent (spirit not in the composition, or no frame yet) — hide.\r\n if (view === undefined) return null\r\n\r\n const latest = view.segments[0]\r\n // 列表只列「真的注入了什么」:跳过行没有内容,逐条列出来等于把门名当日志刷屏;\r\n // 旧版(v10 以前)的注入行没有摘要(preview 为 ''),也不再占一行。\r\n const listed = view.steps.filter((row) => row.kind === 'injected' && row.preview !== '')\r\n // 帧里 `steps` 只有最近 5 条:连走几轮「跳过」会把真正的那条注入行挤到 `lastStep`,\r\n // 按 `steps` 判定就会得出「本会话还没有回响段」的假空态。这里把 lastStep 兑回去。\r\n const last = view.lastStep\r\n const injected = last !== undefined && last.kind === 'injected' && last.preview !== ''\r\n && !listed.some((row) => row.id === last.id)\r\n ? [last, ...listed]\r\n : listed\r\n const skips = view.steps.filter((row) => row.kind === 'skipped')\r\n const skipSummary = summarizeSkips(skips)\r\n // 记录聚合(v7 主数据):每行 = 一条被想起的记录(echo-<uuid> + 记录时间)\r\n const refs = view.records ?? view.refs ?? []\r\n const hasAny = injected.length > 0 || latest !== undefined || refs.length > 0\r\n\r\n return createElement(\r\n 'div',\r\n {\r\n style: SECTION_STYLE,\r\n 'data-dsh-brief-sidebar': 'spirit-echo-section',\r\n title: expandCount(t('echo.totalHint'), view.total),\r\n },\r\n hideHeader ? null : createElement('div', { style: HEADER_STYLE }, t('section.spiritEcho')),\r\n createElement(\r\n 'div',\r\n { style: BODY_STYLE },\r\n hasAny\r\n ? createElement(\r\n 'div',\r\n { style: { display: 'flex', flexDirection: 'column', gap: 2 } },\r\n createElement('div', { style: LINE_STYLE }, expandCount(t('echo.stepCount'), refs.length > 0 ? refs.length : injected.length)),\r\n // 引用行优先(v6):标题=内容(如线程任务名),时间=最近召回,×N=召回次数;\r\n // 无 refs 的老帧退回 steps(不伪装新形状存在)。\r\n ...(refs.length > 0\r\n ? refs.slice(0, 3).map((row, index) => createElement(\r\n 'div',\r\n {\r\n key: `${row.sessionId}-${row.echoId}`,\r\n style: ROW_STYLE,\r\n 'data-dsh-brief-sidebar': 'spirit-echo-ref',\r\n },\r\n createElement(\r\n 'button',\r\n {\r\n type: 'button' as const,\r\n style: { ...ROW_TEXT_STYLE, ...(index === 0 ? {} : MUTED_STYLE) },\r\n 'data-dsh-brief-sidebar': 'spirit-echo-ref-title',\r\n title: `${row.echoId} · ${new Date(row.recordTs).toLocaleString()} · ${t('echo.openOriginal')}`,\r\n onClick: () => { openEchoTab(row.sessionId !== '' ? row.sessionId : (scope?.sessionId ?? ''), row.lastRecallId) },\r\n },\r\n rowLabel(row),\r\n ),\r\n // 副行:echo 短号 + 记录时间 + ×N(用户要求“能看到记录时间和 echo id”)\r\n createElement('div', { style: { ...MUTED_STYLE, fontSize: 11 }, 'data-dsh-brief-sidebar': 'spirit-echo-ref-meta', title: row.echoId }, rowMeta(row)),\r\n createElement(EchoViewMenu, {\r\n t,\r\n sessionId: row.sessionId !== '' ? row.sessionId : (scope?.sessionId ?? ''),\r\n echoId: row.lastRecallId,\r\n }),\r\n )) \r\n : injected.slice(0, 3).map((row, index) => createElement(\r\n 'div',\r\n {\r\n key: `${row.id}-${index}`,\r\n style: ROW_STYLE,\r\n 'data-dsh-brief-sidebar': 'spirit-echo-row',\r\n },\r\n createElement(\r\n 'button',\r\n {\r\n type: 'button' as const,\r\n style: {\r\n ...ROW_TEXT_STYLE,\r\n ...(index === 0 ? {} : MUTED_STYLE),\r\n },\r\n 'data-dsh-brief-sidebar': 'spirit-echo-row-injected',\r\n title: `${row.id} · ${new Date(row.at).toLocaleString()} · ${t('echo.openOriginal')}`,\r\n onClick: () => { openEchoTab(scope?.sessionId ?? '', row.id) },\r\n },\r\n (row.title ?? '').trim() !== '' ? shorten(row.title ?? '') : shorten(row.preview),\r\n ),\r\n // 行级选单:与 memory 行同款(原文 / 条目 / 星图),不必滑到底部链接。\r\n createElement(EchoViewMenu, {\r\n t,\r\n sessionId: scope?.sessionId ?? '',\r\n echoId: row.id,\r\n }),\r\n ))),\r\n )\r\n : createElement(\r\n 'div',\r\n { style: MUTED_STYLE },\r\n createElement('div', null, t('echo.empty')),\r\n createElement('div', { style: { fontSize: 11 } }, t('echo.emptyHint')),\r\n ),\r\n // 跳过不逐条列,只给一句汇总(门名 × 次数)——它回答「为什么没卡」,不是回忆。\r\n skipSummary !== '' && createElement(\r\n 'div',\r\n {\r\n style: { ...MUTED_STYLE, fontSize: 11 },\r\n 'data-dsh-brief-sidebar': 'spirit-echo-skips',\r\n },\r\n expandCount(t('echo.skippedSummary'), skips.length).replace('{reasons}', skipSummary),\r\n ),\r\n // 想起的段落单独一行:有引用时以引用行为准(title + 次数),否则退回段落口径。\r\n (refs.length > 0 || latest !== undefined) && createElement(\r\n 'div',\r\n { style: { ...LINE_STYLE, ...MUTED_STYLE }, 'data-dsh-brief-sidebar': 'spirit-echo-latest' },\r\n refs.length > 0\r\n ? `${t('echo.latest')}${refs[0]!.title !== '' ? refs[0]!.title : refs[0]!.memId} · ${shortEcho(refs[0]!.echoId)}`\r\n : `${t('echo.latest')}${latest === undefined ? '' : shorten(latest.excerpt)}`,\r\n ),\r\n createElement(\r\n 'div',\r\n { style: LINK_ROW_STYLE },\r\n createElement('button', {\r\n type: 'button' as const,\r\n style: VIEW_BTN_STYLE,\r\n 'data-dsh-brief-sidebar': 'spirit-echo-goto-graph',\r\n onClick: () => { onOpen('graph') },\r\n }, t('echo.gotoGraph')),\r\n createElement('button', {\r\n type: 'button' as const,\r\n style: VIEW_BTN_STYLE,\r\n 'data-dsh-brief-sidebar': 'spirit-echo-goto',\r\n onClick: () => { onOpen('echo') },\r\n }, t('echo.goto')),\r\n ),\r\n fail !== undefined && createElement(\r\n 'div',\r\n {\r\n style: FAIL_STYLE,\r\n 'data-dsh-brief-sidebar': 'spirit-echo-fail',\r\n ...(fail.detail === undefined ? {} : { title: fail.detail }),\r\n },\r\n `${t('echo.gotoFail')}(${fail.reason})`,\r\n ),\r\n ),\r\n )\r\n}\r\n","/**\r\n * The references section: 技能与记忆并列成两个可左右切换的页签。\r\n *\r\n * Why a tab strip instead of three stacked sections: the two lists answer the\r\n * same question — \"what entered this session's context\" — from two different\r\n * providers (this plugin's own skill fold, and prime-memory's recall/slots).\r\n * Stacked, they pushed the board and the produced files off screen on a narrow\r\n * sidebar; side by side, each gets the full width when the reader actually\r\n * wants it.\r\n *\r\n * Two decisions worth knowing when editing this file:\r\n *\r\n * 1. **The inactive pane stays mounted and is hidden with `display:none`.**\r\n * The recall pane carries real interaction state (selected row, pending\r\n * rating, the expanded history group); unmounting it would silently reset\r\n * what the human just did every time they glanced at the skills tab. The\r\n * cost is that a hidden pane keeps re-rendering on projection frames —\r\n * bounded, because the whole tab still renders nothing while `visible` is\r\n * false (see `SummaryTab`).\r\n * 2. **The parent repeats its children's gates.** A section that hides itself\r\n * leaves the tab strip pointing at an empty pane, so the availability\r\n * question is answered here with the SAME readers and resolvers the children\r\n * use. `tests/reference-section.spec.tsx` pins both sides against the same\r\n * fixtures — if a child gate ever drifts from this one, that test goes red\r\n * rather than the UI growing a dead tab.\r\n *\r\n * Colours come from `--dsw-alias-*` tokens only (skin contract).\r\n */\r\nimport { createElement } from 'react'\r\nimport { useCallback, useState } from 'react'\r\nimport type { CSSProperties, KeyboardEvent, ReactNode } from 'react'\r\nimport type { CtxProbe } from '../use-projection'\r\nimport { SKILL_USAGE_KEY } from '../../projection/keys'\r\nimport { useProjectionValue } from '../use-projection'\r\nimport { readSkillUsage } from './skill-usage'\r\nimport { SEARCH_REFS_KEY, readSearchRefs } from './search-refs'\r\nimport { MEMORY_RECALL_KEY, readRecall } from './memory-recall'\r\nimport { MEMORY_SLOTS_KEY, readSlots } from './memory-slots'\r\nimport { resolveShowMemoryRecall, resolveShowMemorySlots, resolveShowSpiritEcho } from '../scope-face'\r\nimport { useConfigFlag } from './use-config-flag'\r\nimport { SkillUsageSection } from './SkillUsageSection'\r\nimport { SearchRefSection } from './SearchRefSection'\r\nimport { MemoryRecallSection } from './MemoryRecallSection'\r\nimport { MemorySlotsSection } from './MemorySlotsSection'\r\nimport { MemoryViewMenu } from './MemoryViewMenu'\r\nimport { SpiritEchoSection } from './SpiritEchoSection'\r\nimport { SPIRIT_ECHO_KEY, readSpiritEcho } from '../spirit-echo'\r\nimport type { FeedbackFetch } from './recall-feedback'\r\n\r\nexport interface ReferenceSectionProps {\r\n /** The DSH locale lookup, passed down from `apply`. */\r\n t: (key: string) => string\r\n /** The client root context (the tab body's only way to reach services). */\r\n ctx?: CtxProbe\r\n /** The session this tab is scoped to. */\r\n scope?: { readonly sessionId?: string }\r\n /** The rating transport, handed straight to the recall pane. */\r\n fetchImpl?: FeedbackFetch\r\n}\r\n\r\n/** Which pane is showing. Echo is a reference fact too (what spirit injected). */\r\nexport type ReferenceTab = 'skills' | 'memory' | 'search' | 'echo'\r\n\r\nconst SECTION_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n borderBottom: '1px solid var(--dsw-alias-border-secondary)',\r\n}\r\n\r\nconst HEADER_STYLE: CSSProperties = {\r\n padding: '10px 12px 0',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n fontSize: 12,\r\n fontWeight: 600,\r\n}\r\n\r\n/** The tab strip: flush-left, same gutter as section headers. */\r\nconst TABS_STYLE: CSSProperties = {\r\n display: 'flex',\r\n gap: 4,\r\n padding: '6px 12px 0',\r\n}\r\n\r\n/** One tab. Selected gets a hairline of secondary label; never a colour literal. */\r\nconst TAB_STYLE: CSSProperties = {\r\n background: 'none',\r\n border: 'none',\r\n borderBottom: '1px solid transparent',\r\n font: 'inherit',\r\n fontSize: 12,\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n cursor: 'pointer',\r\n padding: '4px 8px 6px',\r\n}\r\n\r\nconst TAB_ACTIVE_STYLE: CSSProperties = {\r\n ...TAB_STYLE,\r\n borderBottom: '1px solid var(--dsw-alias-label-secondary)',\r\n color: 'var(--dsw-alias-label-primary)',\r\n fontWeight: 600,\r\n}\r\n\r\nconst ORDER: readonly ReferenceTab[] = ['skills', 'memory', 'search', 'echo']\r\n\r\n/**\r\n * The references section. All hooks run before any early return, so the tab\r\n * strip can disappear (no capability at all) without ever changing hook order.\r\n *\r\n * @param props - translation, client context, session scope, rating transport.\r\n */\r\nexport function ReferenceSection(props: ReferenceSectionProps): ReactNode {\r\n const { t, ctx, scope, fetchImpl } = props\r\n const [tab, setTab] = useState<ReferenceTab>('skills')\r\n\r\n // The same three reads the children make, used only to decide whether the\r\n // strip has anything to point at.\r\n const skillsLive = readSkillUsage(useProjectionValue(ctx, scope?.sessionId, SKILL_USAGE_KEY)) !== undefined\r\n const searchLive = readSearchRefs(useProjectionValue(ctx, scope?.sessionId, SEARCH_REFS_KEY)) !== undefined\r\n const recallFrame = readRecall(useProjectionValue(ctx, scope?.sessionId, MEMORY_RECALL_KEY))\r\n const slotsFrame = readSlots(useProjectionValue(ctx, scope?.sessionId, MEMORY_SLOTS_KEY))\r\n const echoFrame = readSpiritEcho(useProjectionValue(ctx, scope?.sessionId, SPIRIT_ECHO_KEY))\r\n const recallOn = useConfigFlag(ctx, resolveShowMemoryRecall) !== false\r\n const slotsOn = useConfigFlag(ctx, resolveShowMemorySlots) === true\r\n const echoOn = useConfigFlag(ctx, resolveShowSpiritEcho) !== false\r\n const memoryLive = (recallFrame !== undefined && recallOn) || (slotsFrame !== undefined && slotsOn)\r\n // 回响页签与记忆同一种控制:能力在 + 开关开。关掉就整页签消失(不留空壳)。\r\n const echoLive = echoFrame !== undefined && echoOn\r\n const live: Record<ReferenceTab, boolean> = { skills: skillsLive, memory: memoryLive, search: searchLive, echo: echoLive }\r\n // 记住的选择可能因能力变化而消失(例如关掉记忆开关):退到第一个可用页签。\r\n const active: ReferenceTab = live[tab] ? tab : ORDER.find(id => live[id]) ?? 'skills'\r\n\r\n const onTabsKeyDown = useCallback((event: KeyboardEvent<HTMLDivElement>): void => {\r\n // 左右方向键在“可用页签”里循环:能力缺席的页签不该被键盘走到。\r\n if (event.key !== 'ArrowLeft' && event.key !== 'ArrowRight') return\r\n event.preventDefault()\r\n const shown = ORDER.filter(id => live[id])\r\n if (shown.length < 2) return\r\n const at = shown.indexOf(active)\r\n const step = event.key === 'ArrowRight' ? 1 : shown.length - 1\r\n setTab(shown[(at + step) % shown.length])\r\n }, [live, active])\r\n\r\n // Nothing to reference — no provider in the composition, or everything switched off.\r\n if (!skillsLive && !memoryLive && !searchLive && !echoLive) return null\r\n\r\n const tabButton = (id: ReferenceTab, label: string): ReactNode => createElement(\r\n 'button',\r\n {\r\n key: id,\r\n type: 'button',\r\n role: 'tab',\r\n id: `dsh-brief-reference-tab-${id}`,\r\n 'aria-selected': active === id,\r\n 'aria-controls': `dsh-brief-reference-pane-${id}`,\r\n style: active === id ? TAB_ACTIVE_STYLE : TAB_STYLE,\r\n 'data-dsh-brief-sidebar': `reference-tab-${id}`,\r\n onClick: () => { setTab(id) },\r\n },\r\n label,\r\n )\r\n\r\n return createElement(\r\n 'div',\r\n { style: SECTION_STYLE, 'data-dsh-brief-sidebar': 'references-section' },\r\n createElement('div', { style: HEADER_STYLE }, t('section.references')),\r\n createElement(\r\n 'div',\r\n {\r\n role: 'tablist',\r\n 'aria-label': t('section.references'),\r\n style: TABS_STYLE,\r\n onKeyDown: onTabsKeyDown,\r\n 'data-dsh-brief-sidebar': 'reference-tabs',\r\n },\r\n skillsLive && tabButton('skills', t('references.tabSkills')),\r\n // 每个页签各自条件化:只有一侧能力时不该留个点了就空的页签。\r\n memoryLive && tabButton('memory', t('references.tabMemory')),\r\n searchLive && tabButton('search', t('references.tabSearch')),\r\n echoLive && tabButton('echo', t('references.tabEcho')),\r\n ),\r\n skillsLive && createElement(\r\n 'div',\r\n {\r\n role: 'tabpanel',\r\n id: 'dsh-brief-reference-pane-skills',\r\n 'aria-labelledby': 'dsh-brief-reference-tab-skills',\r\n hidden: active !== 'skills',\r\n style: active === 'skills' ? undefined : { display: 'none' },\r\n 'data-dsh-brief-sidebar': 'reference-pane-skills',\r\n },\r\n createElement(SkillUsageSection, { t, ctx, scope, hideHeader: true }),\r\n ),\r\n memoryLive && createElement(\r\n 'div',\r\n {\r\n role: 'tabpanel',\r\n id: 'dsh-brief-reference-pane-memory',\r\n 'aria-labelledby': 'dsh-brief-reference-tab-memory',\r\n hidden: active !== 'memory',\r\n style: active === 'memory' ? undefined : { display: 'none' },\r\n 'data-dsh-brief-sidebar': 'reference-pane-memory',\r\n },\r\n // 记忆库指路:条目 / 2D / 3D 由 dsh-prime-memory 的整页渲染,这里只做深链。\r\n // 能力缺席时整节已隐藏,菜单不会单独出现。\r\n createElement(MemoryViewMenu, { key: 'memory-view', t }),\r\n // 两条记忆链各有自己的标题:召回与常驻槽位是不同事实,合成一节会糊掉。\r\n createElement(MemoryRecallSection, { t, ctx, scope, fetchImpl }),\r\n createElement(MemorySlotsSection, { t, ctx, scope }),\r\n ),\r\n searchLive && createElement(\r\n 'div',\r\n {\r\n role: 'tabpanel',\r\n id: 'dsh-brief-reference-pane-search',\r\n 'aria-labelledby': 'dsh-brief-reference-tab-search',\r\n hidden: active !== 'search',\r\n style: active === 'search' ? undefined : { display: 'none' },\r\n 'data-dsh-brief-sidebar': 'reference-pane-search',\r\n },\r\n createElement(SearchRefSection, { t, ctx, scope, hideHeader: true }),\r\n ),\r\n echoLive && createElement(\r\n 'div',\r\n {\r\n role: 'tabpanel',\r\n id: 'dsh-brief-reference-pane-echo',\r\n 'aria-labelledby': 'dsh-brief-reference-tab-echo',\r\n hidden: active !== 'echo',\r\n style: active === 'echo' ? undefined : { display: 'none' },\r\n 'data-dsh-brief-sidebar': 'reference-pane-echo',\r\n },\r\n // 回响是引用的一部分:它回答“这轮引用/跳过了什么”,与技能、记忆同列。\r\n createElement(SpiritEchoSection, { t, ctx, scope, hideHeader: true }),\r\n ),\r\n )\r\n}\r\n","/**\r\n * The summary tab body: the session's at-a-glance state, composed of sections.\r\n *\r\n * Section order: 进展 (the todos board) → 产物 (produced files, codeplan\r\n * artifacts marked inline) → 引用 (two switchable tabs: 技能 and 记忆).\r\n * The reference tabs replaced three stacked sections: which skills entered the\r\n * session, what prime-memory injected and compaction has not overwritten, and\r\n * the hand-pinned resident slots — all three answer \"what is in this session's\r\n * context\", and stacking them pushed the board off a narrow sidebar. Each pane\r\n * keeps its own data chain and its own gating contract; this component owns\r\n * only the shell.\r\n *\r\n * Two better-sidebar contracts are honoured:\r\n *\r\n * 1. **Height contract.** The tab body mounts inside a full-height column flex\r\n * host whose `.paneBody` is a definite-height BLOCK scroll container. The\r\n * root declares `height: 100%` + `min-height: 0`, and the scrolling element\r\n * is an inner div — not the root. Sections are non-scrolling slices with a\r\n * bottom border; the inner div scrolls them all.\r\n * 2. **`visible` pause.** Nothing is drawn while the tab is not the active\r\n * one, so a hidden tab does not re-render on every projection frame.\r\n */\r\nimport { createElement } from 'react'\r\nimport type { CSSProperties, ReactNode } from 'react'\r\nimport type { CtxProbe } from './use-projection'\r\nimport { TodoSection } from './TodoBoardTab'\r\nimport type { TodoScope } from './TodoBoardTab'\r\nimport { DeliverablesSection } from './summary/DeliverablesSection'\r\nimport { ReferenceSection } from './summary/ReferenceSection'\r\n\r\nexport interface SummaryTabProps {\r\n /** The DSH locale lookup, passed down from `apply`. */\r\n t: (key: string) => string\r\n /** The client root context (the tab body's only way to reach services). */\r\n ctx?: CtxProbe\r\n /** The session this tab is scoped to. */\r\n scope?: TodoScope\r\n /** Whether the tab is the active one AND the panel is open. */\r\n visible?: boolean\r\n}\r\n\r\nconst ROOT_STYLE: CSSProperties = {\r\n display: 'flex',\r\n flexDirection: 'column',\r\n height: '100%',\r\n minHeight: 0,\r\n background: 'var(--dsw-alias-bg-layer-1)',\r\n color: 'var(--dsw-alias-label-primary)',\r\n font: 'inherit',\r\n fontSize: 13,\r\n}\r\n\r\nconst SCROLL_STYLE: CSSProperties = { flex: 1, minHeight: 0, overflow: 'auto' }\r\n\r\n/**\r\n * The summary tab.\r\n * @param props - translation, client context, session scope, visibility.\r\n */\r\nexport function SummaryTab(props: SummaryTabProps): ReactNode {\r\n const { t, ctx, scope, visible = true } = props\r\n\r\n // A hidden tab renders NOTHING — not even the shell — so it never\r\n // re-renders on a projection frame while it is off screen.\r\n if (!visible) return null\r\n\r\n return createElement(\r\n 'div',\r\n { style: ROOT_STYLE, 'data-dsh-brief-sidebar': 'board' },\r\n createElement('div', { style: SCROLL_STYLE },\r\n createElement(TodoSection, { key: 'progress', t, ctx, scope }),\r\n createElement(DeliverablesSection, { key: 'deliverables', t, ctx, scope }),\r\n // 引用:技能页(`dshSummarySkillUsage`,本插件自己的 host 半注册)与记忆页\r\n // (`memoryRecall` / `memorySlots`,由 dsh-prime-memory 提供,各有开关)并列,\r\n // 可点击或用左右方向键切换。两个页签都空时整节隐藏(无能力 ≠ 空态)。\r\n createElement(ReferenceSection, { key: 'references', t, ctx, scope }),\r\n ),\r\n )\r\n}\r\n","/**\r\n * Native right-sidebar path: register the board tab directly into the DSH\r\n * host's own sidebar, with NO better-sidebar in sight. Available on host\r\n * generations that ship `dsh-client-ui-sidebar-right` (0.1.5+; verified by\r\n * slot-declaration forensics on 0.1.5-rc.3, 0.1.7-rc.2 and 0.2.0-rc.2).\r\n *\r\n * The host opens a tab type through a two-stage registration, and this module\r\n * copies better-sidebar's own native bridge EXACTLY — that plugin is the\r\n * shipped, field-proof consumer of the same seats:\r\n *\r\n * 1. Stage one, \"what the type IS\": `ctx.sidebarRightTabs.register({id, kind,\r\n * title, guide})` (a `SidebarRightTabDefinition`; page type — no `patterns`,\r\n * opened by kind). The returned disposer lives in our effect.\r\n * 2. Stage two, \"what the body draws\": a keyed registration under\r\n * `sidebar.right.pane.tab` whose `key` is the definition's `id`. The inject\r\n * callback receives the session id; everything else (our `t`, the root\r\n * `ctx`) rides a closure, and `SummaryTab` reads session data through\r\n * `ctx.get('sessions')` exactly as it does under better-sidebar.\r\n *\r\n * Degradations versus the better-sidebar path, accepted deliberately:\r\n * - no badge — the native chip has no badge affordance; the unfinished count\r\n * still shows inside the tab body.\r\n * - no `visible` pause — the host unmounts inactive bodies (`keepMounted`\r\n * defaults to false), which subsumes it.\r\n * - the open affordance is the guide-page capsule (`guide[]`), not a rail icon.\r\n *\r\n * Everything is read through `ctx.get` structural probes: the services are\r\n * absent on ≤0.1.2 hosts, so the caller must treat `undefined` as \"no native\r\n * surface\" and stay inert rather than crash. No import from\r\n * `@deepseek-ai/dsh-client-ui-sidebar-right` — a browser-only plugin keeps zero\r\n * build-time coupling to host internals, mirroring `use-projection.ts`.\r\n */\r\nimport type { ReactNode } from 'react'\r\nimport type { CtxProbe } from './use-projection'\r\nimport type { SlotsLike } from './brief/dock-shadow'\r\nimport { SummaryTab } from './SummaryTab'\r\n\r\n/** One guide-page capsule contributed by our type (structural `SidebarRightGuideEntry`). */\r\ninterface NativeGuideEntry {\r\n readonly id: string\r\n readonly order: number\r\n readonly title: () => string\r\n readonly description?: () => string\r\n}\r\n\r\n/** Stage-one shape (structural `SidebarRightTabDefinition`; only the page-type fields). */\r\ninterface NativeTabDefinition {\r\n readonly id: string\r\n readonly kind: string\r\n readonly title: (address: string) => string\r\n readonly guide?: readonly NativeGuideEntry[]\r\n}\r\n\r\n/** `ctx.sidebarRightTabs` — the only method we call. */\r\ninterface NativeTabRegistryLike {\r\n register(definition: NativeTabDefinition): () => void\r\n}\r\n\r\nexport type { NativeTabRegistryLike }\r\n\r\n/** The keyed seat a tab type registers its body under. */\r\nconst PANE_TAB_SEAT = 'sidebar.right.pane.tab'\r\n\r\n/**\r\n * Whether this host exposes the native right-sidebar tab system at all.\r\n *\r\n * Both services must answer: the registry stages the type, and a future\r\n * \"open from a button\" affordance goes through the controller face.\r\n * @param ctx - the client root context.\r\n */\r\nexport function nativeSidebarAvailable(ctx: CtxProbe): boolean {\r\n const registry = ctx.get('sidebarRightTabs') as NativeTabRegistryLike | undefined\r\n const controller = ctx.get('sidebarRight') as unknown\r\n return (\r\n registry !== undefined &&\r\n typeof registry.register === 'function' &&\r\n controller !== undefined &&\r\n ctx.get('slots') !== undefined\r\n )\r\n}\r\n\r\n/**\r\n * Register the board as a native right-sidebar tab type.\r\n *\r\n * The registry arrives as a parameter, read from the deferred `ctx.inject`\r\n * scope in `apply` — the 0.1.7+ strict-proxy ctx refuses a root `ctx.get`\r\n * of an undeclared service, so reaching for `sidebarRightTabs` from the root\r\n * context is what made the native seat silently no-op on 0.1.7 (the \"cannot\r\n * register directly\" observation). better-sidebar's own native bridge reads\r\n * it the same way: from the inject callback's scope.\r\n *\r\n * @param ctx - the client root context (for the declared `slots` service).\r\n * @param registry - the host tab-type registry from the injected scope.\r\n * @param deps - the stable ids and the translator from `apply`.\r\n * @returns a disposer that unregisters the seat first, then the type (the\r\n * registry refuses opens for a type whose body is already gone).\r\n */\r\nexport function registerNativeBoardTab(\r\n ctx: CtxProbe,\r\n registry: NativeTabRegistryLike | undefined,\r\n deps: { id: string; kind: string; order: number; t: (key: string) => string },\r\n): () => void {\r\n const slots = ctx.get('slots') as SlotsLike | undefined\r\n if (registry === undefined || typeof registry.register !== 'function' || slots === undefined) {\r\n return (): void => {}\r\n }\r\n\r\n // Stage 1: the type. Page kind — opened from the guide capsule by `kind`.\r\n const disposeType = registry.register({\r\n id: deps.id,\r\n kind: deps.kind,\r\n title: () => deps.t('tab.title'),\r\n guide: [\r\n {\r\n id: deps.id,\r\n order: deps.order,\r\n title: () => deps.t('tab.title'),\r\n description: () => deps.t('tab.desc'),\r\n },\r\n ],\r\n })\r\n\r\n // Stage 2: the body, keyed under the definition's own id. The payload\r\n // mirrors better-sidebar's `TabComponentProps` fields that SummaryTab reads;\r\n // `visible` is pinned true because the host unmounts hidden bodies anyway.\r\n const disposeSeat = slots.inject(PANE_TAB_SEAT, () =>\r\n slots.register(\r\n {\r\n name: PANE_TAB_SEAT,\r\n key: deps.id,\r\n inject: (sessionId: string) => ({\r\n t: deps.t,\r\n ctx,\r\n scope: { sessionId },\r\n visible: true,\r\n }),\r\n },\r\n SummaryTab as unknown as (props: unknown) => ReactNode,\r\n ),\r\n )\r\n\r\n return (): void => {\r\n try {\r\n disposeSeat()\r\n } finally {\r\n disposeType()\r\n }\r\n }\r\n}\r\n","/**\r\n * 回响原文查看器:按编号取一条回响当时注入的卡全文。\r\n *\r\n * 为什么单开一个 tab(与记忆查看器同款):侧栏一行只能放摘要,而「这条当时到底写了\r\n * 什么」是回响的原文事实,不能拿摘要冒充。数据来自 spirit 的 `echo-detail` RPC\r\n * (本仓不跨包 import,只走同源 loopback 路由)。\r\n *\r\n * 失败面同样是数据:条目不在了 / spirit 没装 / 网络抖动,都显示成人话,不吞成空白。\r\n */\r\nimport { createElement, useEffect, useState } from 'react'\r\nimport type { CSSProperties, ReactNode } from 'react'\r\n\r\ninterface DetailItem {\r\n id: string\r\n at: number\r\n kind: 'injected' | 'skipped'\r\n reason: string\r\n fingerprint: string\r\n preview: string\r\n text: string\r\n}\r\n\r\nconst WRAP: CSSProperties = {\r\n padding: '12px 14px',\r\n overflow: 'auto',\r\n height: '100%',\r\n fontSize: 13,\r\n lineHeight: 1.65,\r\n color: 'var(--dsw-alias-label-primary)',\r\n}\r\nconst HEAD: CSSProperties = {\r\n display: 'flex',\r\n flexWrap: 'wrap',\r\n alignItems: 'center',\r\n gap: 8,\r\n marginBottom: 10,\r\n paddingBottom: 8,\r\n borderBottom: '1px solid var(--dsw-alias-border-secondary)',\r\n fontSize: 11,\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n}\r\nconst ID_STYLE: CSSProperties = {\r\n fontFamily: 'ui-monospace,monospace',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n}\r\nconst CARD: CSSProperties = {\r\n whiteSpace: 'pre-wrap',\r\n wordBreak: 'break-word',\r\n fontFamily: 'ui-monospace,monospace',\r\n fontSize: 12.5,\r\n color: 'var(--dsw-alias-label-primary)',\r\n}\r\nconst MUTED: CSSProperties = { color: 'var(--dsw-alias-label-tertiary)', fontSize: 12 }\r\n\r\n/** `path` = `<sessionId>|<echoId>`;任何一半缺失都不发请求。 */\r\nexport function splitEchoPath(path: string | undefined): { sessionId: string; id: string } {\r\n const raw = path ?? ''\r\n const at = raw.indexOf('|')\r\n if (at <= 0) return { sessionId: '', id: '' }\r\n return { sessionId: raw.slice(0, at), id: raw.slice(at + 1) }\r\n}\r\n\r\nexport interface EchoViewerProps {\r\n tab?: { path?: string }\r\n t?: (key: string) => string\r\n /** The tab seat hands the client context down; the viewer reads nothing from it today. */\r\n ctx?: unknown\r\n}\r\n\r\n/**\r\n * The echo viewer body.\r\n * @param props - the better-sidebar tab seat (path carries sessionId|id).\r\n */\r\nexport function EchoViewer(props: EchoViewerProps): ReactNode {\r\n const { sessionId, id } = splitEchoPath(props.tab?.path)\r\n const [item, setItem] = useState<DetailItem | undefined>(undefined)\r\n const [error, setError] = useState<string | undefined>(undefined)\r\n\r\n useEffect(() => {\r\n if (sessionId === '' || id === '') return\r\n let cancelled = false\r\n setError(undefined)\r\n setItem(undefined)\r\n fetch('/dsh-spirit/rpc/echo-detail', {\r\n method: 'POST',\r\n headers: { 'Content-Type': 'application/json' },\r\n body: JSON.stringify({ sessionId, id }),\r\n })\r\n .then(async (r) => {\r\n if (!r.ok) throw new Error(`HTTP ${r.status}`)\r\n return (await r.json()) as { ok?: boolean; value?: { item?: DetailItem } }\r\n })\r\n .then((env) => {\r\n if (cancelled) return\r\n if (env.ok === true && env.value?.item !== undefined) {\r\n setItem(env.value.item)\r\n return\r\n }\r\n setError('该回响条目已不在库里')\r\n })\r\n .catch((e: unknown) => { if (!cancelled) setError(e instanceof Error ? e.message : String(e)) })\r\n return () => { cancelled = true }\r\n }, [sessionId, id])\r\n\r\n if (sessionId === '' || id === '') {\r\n return createElement('div', { style: WRAP }, createElement('div', { style: MUTED }, '未选择回响条目'))\r\n }\r\n if (error !== undefined) {\r\n return createElement('div', { style: WRAP }, createElement('div', { style: MUTED }, `⚠️ ${error}`))\r\n }\r\n if (item === undefined) {\r\n return createElement('div', { style: WRAP }, createElement('div', { style: MUTED }, '加载中…'))\r\n }\r\n\r\n return createElement(\r\n 'div',\r\n { style: WRAP, 'data-dsh-brief-sidebar': 'echo-viewer' },\r\n createElement(\r\n 'div',\r\n { style: HEAD },\r\n createElement('span', { style: ID_STYLE, 'data-dsh-brief-sidebar': 'echo-viewer-id' }, item.id),\r\n createElement('span', null, item.kind === 'injected' ? '注入' : `跳过(${item.reason})`),\r\n createElement('span', null, new Date(item.at).toLocaleString()),\r\n item.fingerprint !== '' ? createElement('span', null, item.fingerprint.slice(0, 24)) : null,\r\n ),\r\n item.text === ''\r\n ? createElement(\r\n 'div',\r\n { style: MUTED, 'data-dsh-brief-sidebar': 'echo-viewer-no-text' },\r\n `早期落档(${new Date(item.at).toLocaleString()}):这条当时只存了摘要、没存原文。`,\r\n createElement('div', { style: { marginTop: 6 } }, item.preview),\r\n )\r\n : createElement('div', { style: CARD }, item.text),\r\n )\r\n}\r\n","/**\r\n * Memory viewer component: fetches full metadata by memoryId via records-meta API,\r\n * renders a structured header bar + markdown body.\r\n */\r\nimport { createElement, useEffect, useState, Fragment } from 'react'\r\nimport type { CSSProperties, ReactNode } from 'react'\r\nimport type { Context } from '@deepseek-ai/cordis'\r\n\r\n/* ── Types (mirror prime-memory contract, no cross-repo import) ── */\r\ninterface RecordMeta {\r\n id: string\r\n name: string | null\r\n type: string\r\n priority: number\r\n content: string\r\n maturity?: 'low' | 'mid' | 'high'\r\n createdAt: string | null\r\n updatedAt: string | null\r\n scene: string\r\n scope: 'global' | 'workspace'\r\n workspaceId: string | null\r\n keywords?: string[]\r\n usageScenario?: string[]\r\n filePath: string\r\n retired: boolean\r\n}\r\n\r\ninterface Props {\r\n ctx: Context\r\n memoryId: string\r\n scope: { sessionId?: string }\r\n}\r\n\r\n/** 宿主 RPC 信封:失败分支的 `error` 是 `{code,message,details}` **对象**,不是字符串。 */\r\ninterface RecordsMetaEnvelope {\r\n ok?: boolean\r\n value?: { items?: RecordMeta[] }\r\n error?: { code?: string; message?: string } | string\r\n}\r\n\r\n/**\r\n * 把失败信封说成人话。\r\n *\r\n * 直接把 `error` 当字符串拼进模板会得到 `⚠️ [object Object]`——用户看不到原因,\r\n * 排查只能靠猜。取 `error.message`,拿不到才给兜底文案。\r\n */\r\nfunction describeEnvelopeError(env: RecordsMetaEnvelope): string {\r\n const e = env.error\r\n if (typeof e === 'string' && e.length > 0) return e\r\n if (e !== null && typeof e === 'object' && typeof e.message === 'string' && e.message.length > 0) return e.message\r\n return '未找到该记忆'\r\n}\r\n\r\n/* ── Styles (all --dsw-alias-* tokens) ── */\r\nconst WRAP: CSSProperties = { padding: '12px 16px', overflow: 'auto', height: '100%', fontSize: 13, lineHeight: 1.6, color: 'var(--dsw-alias-label-primary)' }\r\nconst HEADER: CSSProperties = { marginBottom: 12, paddingBottom: 8, borderBottom: '1px solid var(--dsw-alias-border-secondary)' }\r\nconst BADGE: CSSProperties = { display: 'inline-block', fontSize: 11, padding: '1px 6px', borderRadius: 999, border: '1px solid var(--dsw-alias-label-tertiary)', color: 'var(--dsw-alias-label-tertiary)', marginRight: 6, marginBottom: 4 }\r\nconst NAME_STYLE: CSSProperties = { fontSize: 15, fontWeight: 700, marginBottom: 4, color: 'var(--dsw-alias-label-primary)' }\r\nconst META_LINE: CSSProperties = { fontSize: 11, color: 'var(--dsw-alias-label-tertiary)', marginBottom: 2 }\r\nconst LABEL: CSSProperties = { fontSize: 11, color: 'var(--dsw-alias-label-tertiary)', marginBottom: 4, fontWeight: 600, display: 'block' }\r\nconst CHIP: CSSProperties = { display: 'inline-block', fontSize: 11, padding: '3px 10px', borderRadius: 6, border: '1px solid var(--dsw-alias-label-tertiary)', color: 'var(--dsw-alias-label-primary)', marginRight: 8, marginBottom: 6 }\r\nconst CHIP_ROW: CSSProperties = { marginBottom: 8 }\r\nconst PLACEHOLDER: CSSProperties = { padding: 24, textAlign: 'center', color: 'var(--dsw-alias-label-tertiary)' }\r\n\r\n/* ── Markdown renderer (same pattern as RecallBubble) ── */\r\nconst H_STYLES: CSSProperties[] = [\r\n { fontSize: 15, fontWeight: 700, margin: '8px 0 4px' },\r\n { fontSize: 14, fontWeight: 600, margin: '6px 0 3px' },\r\n { fontSize: 13, fontWeight: 600, margin: '5px 0 2px' },\r\n { fontSize: 12, fontWeight: 600, margin: '4px 0 2px' },\r\n { fontSize: 12, fontWeight: 600, margin: '3px 0 1px' },\r\n { fontSize: 11, fontWeight: 600, margin: '3px 0 1px' },\r\n]\r\nconst P_STYLE: CSSProperties = { margin: '2px 0', whiteSpace: 'pre-wrap', wordBreak: 'break-word' }\r\nconst LI_STYLE: CSSProperties = { margin: '1px 0 1px 12px', whiteSpace: 'pre-wrap' }\r\nconst CODE_STYLE: CSSProperties = { fontFamily: 'ui-monospace,monospace', fontSize: '0.9em', background: 'var(--dsw-alias-fill-tertiary)', padding: '0 3px', borderRadius: 3 }\r\n\r\nfunction inline(text: string, key: string): ReactNode[] {\r\n const nodes: ReactNode[] = []\r\n const re = /\\*\\*(.+?)\\*\\*|`(.+?)`/\r\n let rest = text; let i = 0\r\n while (rest.length > 0) {\r\n const m = re.exec(rest)\r\n if (m === null) { nodes.push(rest); break }\r\n if (m.index > 0) nodes.push(rest.slice(0, m.index))\r\n if (m[1] !== undefined) nodes.push(createElement('strong', { key: `${key}-b${i++}` }, m[1]))\r\n else nodes.push(createElement('code', { key: `${key}-c${i++}`, style: CODE_STYLE }, m[2]))\r\n rest = rest.slice(m.index + m[0].length)\r\n }\r\n return nodes\r\n}\r\n\r\nfunction renderMd(md: string): ReactNode {\r\n const lines = md.split('\\n')\r\n const out: ReactNode[] = []\r\n let idx = 0\r\n for (const line of lines) {\r\n const t = line.trim()\r\n if (!t) continue\r\n const h = /^(#{1,6})\\s+(.+)/.exec(t)\r\n if (h) { out.push(createElement(`h${h[1].length}`, { key: `h${idx}`, style: H_STYLES[h[1].length - 1] }, ...inline(h[2], `h${idx}`))); idx++; continue }\r\n const ul = /^[-*]\\s+(.+)/.exec(t)\r\n if (ul) { out.push(createElement('div', { key: `li${idx}`, style: LI_STYLE }, '• ', ...inline(ul[1], `li${idx}`))); idx++; continue }\r\n const ol = /^\\d+\\.\\s+(.+)/.exec(t)\r\n if (ol) { out.push(createElement('div', { key: `li${idx}`, style: LI_STYLE }, t.slice(0, t.indexOf('.') + 2), ...inline(ol[1], `li${idx}`))); idx++; continue }\r\n out.push(createElement('div', { key: `p${idx}`, style: P_STYLE }, ...inline(t, `p${idx}`))); idx++\r\n }\r\n return createElement(Fragment, null, ...out)\r\n}\r\n\r\n/* ── Main component ── */\r\nexport function MemoryViewer(props: Props): ReactNode {\r\n const { ctx, memoryId } = props\r\n const [record, setRecord] = useState<RecordMeta | undefined>(undefined)\r\n const [error, setError] = useState<string | undefined>(undefined)\r\n\r\n useEffect(() => {\r\n // 空 id 不发请求:`{ids:['']}` 会被服务端拒为“ids 过滤后为空”,\r\n // 把“重启后 tab 先于选择恢复”这个正常空态误报成错误。\r\n if (memoryId.length === 0) return\r\n let cancelled = false\r\n setError(undefined)\r\n fetch('/dsh-memory/rpc/records-meta', {\r\n method: 'POST',\r\n headers: { 'Content-Type': 'application/json' },\r\n body: JSON.stringify({ ids: [memoryId] }),\r\n })\r\n .then(async (r) => {\r\n if (!r.ok) throw new Error(`HTTP ${r.status}`)\r\n return (await r.json()) as RecordsMetaEnvelope\r\n })\r\n .then((env: RecordsMetaEnvelope) => {\r\n if (cancelled) return\r\n const first = env.ok === true ? env.value?.items?.[0] : undefined\r\n if (first !== undefined) { setRecord(first); return }\r\n setError(describeEnvelopeError(env))\r\n })\r\n .catch((e: unknown) => { if (!cancelled) setError(e instanceof Error ? e.message : String(e)) })\r\n return () => { cancelled = true }\r\n }, [memoryId])\r\n\r\n if (memoryId.length === 0) {\r\n return createElement('div', { style: WRAP },\r\n createElement('div', { style: PLACEHOLDER }, '未在本轮启动周期选择查看的记忆'))\r\n }\r\n if (error !== undefined) {\r\n return createElement('div', { style: WRAP },\r\n createElement('div', { style: PLACEHOLDER }, `⚠️ ${error}`))\r\n }\r\n if (record === undefined) {\r\n return createElement('div', { style: WRAP },\r\n createElement('div', { style: PLACEHOLDER }, '加载中…'))\r\n }\r\n\r\n return createElement('div', { style: WRAP },\r\n // Header bar\r\n createElement('div', { style: HEADER },\r\n createElement('div', { style: NAME_STYLE }, record.name ?? record.id),\r\n createElement('div', null,\r\n createElement('span', { style: BADGE }, record.type),\r\n createElement('span', { style: BADGE }, record.scope === 'workspace' ? '工作区' : '全局'),\r\n record.maturity && createElement('span', { style: BADGE }, `成熟:${record.maturity}`),\r\n createElement('span', { style: BADGE }, `P${record.priority}`),\r\n record.retired && createElement('span', { style: { ...BADGE, borderColor: 'var(--dsw-alias-border-color-danger)', color: 'var(--dsw-alias-border-color-danger)' } }, '已退场'),\r\n ),\r\n createElement('div', { style: META_LINE }, `创建: ${record.createdAt ? new Date(record.createdAt).toLocaleString() : '-'}`),\r\n record.scene && createElement('div', { style: META_LINE }, `情境: ${record.scene}`),\r\n createElement('div', { style: META_LINE }, `范围: ${record.scope === 'workspace' && record.workspaceId ? record.workspaceId : '用户默认 (global)'}`),\r\n record.keywords && record.keywords.length > 0 && createElement('div', { style: CHIP_ROW },\r\n createElement('span', { style: LABEL }, '关键词'),\r\n ...record.keywords.map((k, i) => createElement('span', { key: i, style: CHIP }, k))),\r\n record.usageScenario && record.usageScenario.length > 0 && createElement('div', { style: CHIP_ROW },\r\n createElement('span', { style: LABEL }, '使用场景'),\r\n ...record.usageScenario.map((s, i) => createElement('span', { key: i, style: CHIP }, s))),\r\n ),\r\n // Body\r\n renderMd(record.content),\r\n )\r\n}\r\n","/**\r\n * Tab glyph for the task board.\r\n *\r\n * Skin contract: plugin-drawn glyphs take their colour from the `--dsw-alias-*`\r\n * tokens — no colour literals anywhere in this file.\r\n */\r\nimport type { ReactNode } from 'react'\r\n\r\n/**\r\n * A checklist mark: three rows with ticks and text rails — the same status\r\n * vocabulary the board paints.\r\n * @param size - square edge in px (the host passes its own tab-icon size).\r\n */\r\nexport function BriefIcon(size: number): ReactNode {\r\n return (\r\n <svg\r\n width={size}\r\n height={size}\r\n viewBox=\"0 0 16 16\"\r\n fill=\"none\"\r\n aria-hidden=\"true\"\r\n focusable=\"false\"\r\n style={{ display: 'block', flex: 'none' }}\r\n >\r\n <rect\r\n x={1.6}\r\n y={2.4}\r\n width={12.8}\r\n height={11.2}\r\n rx={2}\r\n stroke=\"var(--dsw-alias-label-tertiary)\"\r\n strokeWidth={1.2}\r\n />\r\n <path\r\n d=\"M4.2 6.1l1 1 1.8-2\"\r\n stroke=\"var(--dsw-alias-state-success-primary)\"\r\n strokeWidth={1.3}\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n />\r\n <path\r\n d=\"M4.2 10.6l1 1 1.8-2\"\r\n stroke=\"var(--dsw-alias-label-tertiary)\"\r\n strokeWidth={1.3}\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n />\r\n <path\r\n d=\"M8.4 6.4h4M8.4 10.9h4\"\r\n stroke=\"var(--dsw-alias-label-tertiary)\"\r\n strokeWidth={1.2}\r\n strokeLinecap=\"round\"\r\n />\r\n </svg>\r\n )\r\n}\r\n","/**\r\n * Hiding the official todo dock.\r\n *\r\n * `conversation.input.dock` is a LIST slot, and its cells are keyed by each\r\n * entry's `id`. The slot core keeps one live entry per cell — entries are\r\n * sorted by `priority` ascending (then by `order`) and the first live entry of\r\n * a cell is the one the outlet renders, so a SECOND registration with the same\r\n * `id` at a LOWER priority shadows the first. The official todo entry\r\n * (`conversation-todo-dock` in `dsh-client-ui-conversation`) registers\r\n * `{ id: 'todo', order: 0 }` with the default priority 0, so\r\n * `{ id: 'todo', priority: -1 }` wins the cell and the official panel never\r\n * renders while this plugin is mounted.\r\n *\r\n * This is the same mechanism `dsh-input-traffic` uses on the sibling `queue`\r\n * cell (`{ id: 'queue', priority: -1 }`), so it is a proven seam on this host\r\n * generation, not a guess.\r\n *\r\n * Binding to a built-in id is a real coupling: if upstream renames the cell,\r\n * the shadow silently stops winning and the official dock simply reappears\r\n * (fail-open — the data is still shown, just twice). `slots.inject` is used\r\n * rather than a bare `register` because the slot is declared by a built-in\r\n * entry whose lifetime we do not control: `inject` waits for the declaration\r\n * and re-installs the entry if the declaration is ever recreated.\r\n *\r\n * Renders nothing on purpose: the todo UI now lives in this plugin's sidebar\r\n * tab. Return a summary chip here instead to keep a one-line entry point in the\r\n * composer band.\r\n */\r\nimport type { ReactNode } from 'react'\r\nimport type { Context } from '@deepseek-ai/cordis'\r\n\r\n/** The built-in cell id of the official todo dock. */\r\nexport const TODO_CELL_ID = 'todo'\r\n\r\n/** Lower than the built-in's default 0 — the winner of the `todo` cell. */\r\nexport const TODO_SHADOW_PRIORITY = -1\r\n\r\n/** Structural view of the client slots service (avoids a second type graph). */\r\nexport interface SlotsLike {\r\n inject(key: string, callback: () => (() => void) | undefined): () => void\r\n register(options: Record<string, unknown>, component: (props: unknown) => ReactNode): () => void\r\n}\r\n\r\n/** The replacement entry: deliberately empty. */\r\nfunction TodoDockShadow(): ReactNode {\r\n return null\r\n}\r\n\r\n/**\r\n * Register the shadowing entry.\r\n *\r\n * The caller wraps this in `ctx.effect(...)` so the returned disposer rides the\r\n * plugin fiber: unloading the plugin restores the official dock.\r\n *\r\n * @param ctx - the client root context.\r\n * @returns the disposer, or undefined when the slots service is unreachable.\r\n */\r\nexport function registerTodoDockShadow(ctx: Context): (() => void) | undefined {\r\n const slots = ctx.get('slots') as SlotsLike | undefined\r\n if (slots === undefined || typeof slots.inject !== 'function') return undefined\r\n\r\n return slots.inject('conversation.input.dock', () =>\r\n slots.register(\r\n {\r\n name: 'conversation.input.dock',\r\n id: TODO_CELL_ID,\r\n order: 0,\r\n priority: TODO_SHADOW_PRIORITY,\r\n registrant: 'dsh-brief-sidebar',\r\n },\r\n TodoDockShadow,\r\n ),\r\n )\r\n}\r\n","/**\r\n * BriefSettingsCard — the brief-sidebar settings card.\r\n *\r\n * One component mounted at TWO seats, fed by the SAME inject factory (one\r\n * source of truth, the dsh-thinking-levels arrangement):\r\n *\r\n * - the plugin-family settings section (「起子插件设置」, the `settings.section`\r\n * entry dsh-thinking-levels registers; this plugin contributes its card to\r\n * the `dsh-family.tab` child slot — the inject idles harmlessly when the\r\n * family section is absent);\r\n * - the Plugins-page configuration card (`plugins.bundle.config`, keyed by\r\n * the package name, rendered on the bundle's detail page).\r\n *\r\n * The card binds this plugin's entry config through the `configForms` service\r\n * and renders the fields the summary tab reads. Every change commits\r\n * immediately through the scope (no staged form), so a flip applies to the\r\n * open summary tab on its next render.\r\n *\r\n * The `t` binder is injected by the factory (the same closure the tab uses) —\r\n * the card does not rely on the framework's locale props, so it renders the\r\n * active language on every host generation. Kept dependency-free beyond\r\n * react: inline styles over `--dsw-alias-*` tokens only (no CSS modules, no\r\n * hex/rgba literals — the purity spec enforces the token contract).\r\n */\r\nimport { useCallback, useState, useSyncExternalStore } from 'react'\r\nimport { createElement } from 'react'\r\nimport type { CSSProperties, ChangeEvent, ReactNode } from 'react'\r\nimport type { BriefClientConfig, SettingsScope, SettingsScopeSnapshot } from './scope-face'\r\nimport { resolveShowMemoryRecall, resolveShowMemorySlots } from './scope-face'\r\n\r\n/** A no-op unsubscribe source, kept as one identity so effects never thrash. */\r\nconst NO_SUBSCRIBE = (): (() => void) => () => {}\r\n\r\n/** The snapshot served while no scope is reachable. */\r\nconst ABSENT: SettingsScopeSnapshot<BriefClientConfig> = {\r\n status: 'unavailable',\r\n value: undefined,\r\n revision: undefined,\r\n writable: false,\r\n}\r\n\r\n/** Injected face: the entry scope, plus the plugin's own binder. */\r\nexport interface BriefSettingsCardInjected {\r\n /** `configForms.get('dsh-brief-sidebar')` — may be unavailable on odd hosts. */\r\n scope?: SettingsScope<BriefClientConfig>\r\n /** The plugin's locale binder (applied-time closure over the locale service). */\r\n t: (key: string) => string\r\n}\r\n\r\nexport type BriefSettingsCardProps = BriefSettingsCardInjected\r\n\r\n/* ── shared row styling (inline; keeps the client bundle CSS-free) ──────── */\r\n\r\nconst CARD_STYLE: CSSProperties = {\r\n border: '1px solid var(--dsw-alias-border-l2)',\r\n background: 'var(--dsw-alias-bg-layer-3)',\r\n borderRadius: 12,\r\n transition: 'border-color 0.16s, background 0.16s',\r\n}\r\n\r\nconst HEADER_STYLE: CSSProperties = {\r\n appearance: 'none',\r\n width: '100%',\r\n font: 'inherit',\r\n color: 'inherit',\r\n textAlign: 'left',\r\n cursor: 'pointer',\r\n background: 'none',\r\n border: 0,\r\n borderRadius: 12,\r\n display: 'flex',\r\n alignItems: 'center',\r\n gap: 12,\r\n padding: '14px 16px',\r\n}\r\n\r\nconst HEADER_TEXT_STYLE: CSSProperties = { flex: '1 1 0%', minWidth: 0 }\r\n\r\nconst NAME_STYLE: CSSProperties = {\r\n fontSize: 14,\r\n fontWeight: 600,\r\n color: 'var(--dsw-alias-label-primary)',\r\n}\r\n\r\nconst DESC_STYLE: CSSProperties = {\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 13,\r\n lineHeight: 1.5,\r\n}\r\n\r\nconst CHEVRON_STYLE = (open: boolean): CSSProperties => ({\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n flex: '0 0 auto',\r\n transition: 'transform 0.16s',\r\n transform: open ? 'rotate(180deg)' : 'none',\r\n})\r\n\r\nconst BODY_STYLE: CSSProperties = { padding: '12px 16px' }\r\n\r\nconst ROW_STYLE: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'flex-start',\r\n justifyContent: 'space-between',\r\n gap: 12,\r\n padding: '8px 0',\r\n fontSize: 13,\r\n lineHeight: '20px',\r\n}\r\n\r\nconst ROW_TEXT_STYLE: CSSProperties = {\r\n display: 'flex',\r\n flexDirection: 'column',\r\n gap: 4,\r\n minWidth: 0,\r\n}\r\n\r\nconst LABEL_STYLE: CSSProperties = { margin: 0, color: 'var(--dsw-alias-label-primary)' }\r\n\r\nconst HINT_STYLE: CSSProperties = {\r\n margin: 0,\r\n fontSize: 12,\r\n lineHeight: '18px',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n}\r\n\r\nconst SWITCH_STYLE: CSSProperties = { flexShrink: 0, margin: 0, cursor: 'pointer' }\r\n\r\n/**\r\n * One switch row: label + hint on the left, checkbox on the right. Extracted\r\n * because the card now binds two sections (session recall / pinned slots).\r\n */\r\nfunction FlagRow(props: {\r\n id: string\r\n label: string\r\n hint: string\r\n checked: boolean\r\n disabled: boolean\r\n onToggle(next: boolean): void\r\n}): ReactNode {\r\n return createElement(\r\n 'div',\r\n { style: ROW_STYLE },\r\n createElement(\r\n 'div',\r\n { style: ROW_TEXT_STYLE },\r\n createElement('label', { htmlFor: props.id, style: LABEL_STYLE }, props.label),\r\n createElement('p', { style: HINT_STYLE }, props.hint),\r\n ),\r\n createElement('input', {\r\n id: props.id,\r\n type: 'checkbox',\r\n checked: props.checked,\r\n disabled: props.disabled,\r\n style: SWITCH_STYLE,\r\n onChange: (event: ChangeEvent<HTMLInputElement>) => { props.onToggle(event.currentTarget.checked) },\r\n }),\r\n )\r\n}\r\n\r\n/**\r\n * The settings card body. `scope` is optional on purpose: the inject factory\r\n * always provides it, but a host whose `configForms` face degrades must not\r\n * crash the settings page — the card renders the unavailable note and keeps\r\n * its header.\r\n */\r\nexport function BriefSettingsCard(props: BriefSettingsCardProps): ReactNode {\r\n const { t, scope } = props\r\n const [open, setOpen] = useState(true)\r\n\r\n const snapshot: SettingsScopeSnapshot<BriefClientConfig> | undefined = useSyncExternalStore(\r\n useCallback((listener: () => void) => scope?.subscribe(listener) ?? NO_SUBSCRIBE(), [scope]),\r\n useCallback(() => scope?.getSnapshot() ?? ABSENT, [scope]),\r\n useCallback(() => scope?.getSnapshot() ?? ABSENT, [scope]),\r\n )\r\n const unavailable = scope === undefined || snapshot.status === 'unavailable'\r\n const readonly = unavailable || !snapshot.writable\r\n // Defaults come from the same resolvers the sections use — one source of truth.\r\n const slotsChecked = resolveShowMemorySlots(snapshot)\r\n const recallChecked = resolveShowMemoryRecall(snapshot)\r\n\r\n return createElement(\r\n 'div',\r\n { style: CARD_STYLE, 'data-dsh-brief-sidebar': 'settings-card' },\r\n createElement(\r\n 'button',\r\n { type: 'button', 'aria-expanded': open, style: HEADER_STYLE, onClick: () => { setOpen(current => !current) } },\r\n createElement(\r\n 'span',\r\n { style: HEADER_TEXT_STYLE },\r\n createElement('div', { style: NAME_STYLE }, t('settings.title')),\r\n createElement('div', { style: DESC_STYLE }, t('settings.desc')),\r\n ),\r\n createElement(\r\n 'svg',\r\n { width: 16, height: 16, viewBox: '0 0 16 16', 'aria-hidden': true, style: CHEVRON_STYLE(open) },\r\n createElement('path', {\r\n d: 'M4 6l4 4 4-4',\r\n fill: 'none',\r\n stroke: 'currentColor',\r\n strokeWidth: 1.5,\r\n strokeLinecap: 'round',\r\n strokeLinejoin: 'round',\r\n }),\r\n ),\r\n ),\r\n open && createElement(\r\n 'div',\r\n { style: BODY_STYLE },\r\n unavailable\r\n ? createElement('p', { style: HINT_STYLE }, t('settings.unavailable'))\r\n : createElement(\r\n 'div',\r\n { style: { display: 'flex', flexDirection: 'column', gap: 12 } },\r\n createElement(FlagRow, {\r\n key: 'recall',\r\n id: 'dsh-brief-sidebar-show-memory-recall',\r\n label: t('settings.memoryRecall'),\r\n hint: t('settings.memoryRecallHint'),\r\n checked: recallChecked,\r\n disabled: readonly,\r\n onToggle: (next: boolean) => { void scope?.set('showMemoryRecall', next) },\r\n }),\r\n createElement(FlagRow, {\r\n key: 'slots',\r\n id: 'dsh-brief-sidebar-show-memory-slots',\r\n label: t('settings.memorySlots'),\r\n hint: t('settings.memorySlotsHint'),\r\n checked: slotsChecked,\r\n disabled: readonly,\r\n onToggle: (next: boolean) => { void scope?.set('showMemorySlots', next) },\r\n }),\r\n ),\r\n !unavailable && !snapshot.writable && createElement('p', { style: HINT_STYLE }, t('settings.readonly')),\r\n ),\r\n )\r\n}\r\n","/**\r\n * 家族容器兜底接管(family host backstop)。\r\n *\r\n * 为什么需要:本插件把设置卡挂在 `dsh-family.tab` 上,而那个子席位由**别的插件**\r\n * (thinking-levels / session-guard / session-steward / dsh-mcp-registry)声明。\r\n * 宿主的规则是「注册未声明的槽直接抛」,且声明全局唯一、先到先得——所以只要那几家\r\n * 全部让位或声明失败,本插件的设置面就整轮启动不可见,而且**不报任何错**\r\n * (inject 工厂在槽未声明时压根不跑)。\r\n *\r\n * 本模块把\"看不见\"变成\"自己上位\":延迟到分级时刻检查**自己的 tab 工厂有没有被跑过**\r\n * ——那是插件侧唯一合法的「有人声明了吗」探针(宿主只在声明成立后才执行工厂)。\r\n * 没跑过 → 自己注册一个通用容器,声明子席位,按账本渲染所有贡献卡(含自己的)。\r\n *\r\n * declare-or-withdraw:声明子席位失败(别人已持有)时**绝不**退回不带 children 的\r\n * 裸注册——残废容器会占住导航行、让后来者按「已有 dsh-family」集体退场,\r\n * 这正是 2026-10-14 家族面板丢失的成因。\r\n */\r\nimport { createElement, useEffect, useState } from 'react'\r\nimport type { JSX, ReactNode } from 'react'\r\n\r\n/** 账本条目(id/order/label,label 已解析成字符串)。 */\r\nexport interface FamilyTabEntry {\r\n id: string\r\n order: number\r\n label: string\r\n}\r\n\r\n/** 只用到槽门面的这几件事,避免与 index.tsx 的类型互相拖累。 */\r\nexport interface FamilyHostSlots {\r\n inject: (name: string, factory: () => unknown) => unknown\r\n register: (options: Record<string, unknown>, component: unknown) => unknown\r\n entries: (name: string) => readonly Record<string, unknown>[]\r\n subscribe?: (name: string, fn: () => void) => () => void\r\n}\r\n\r\n/** 家族节固定 id 与子席位 key(与 thinking-levels 的声明严格一致)。 */\r\nconst FAMILY_SECTION_ID = 'dsh-family'\r\nconst FAMILY_CHILD_KEY = 'dsh-family.tab'\r\n\r\n/**\r\n * 接管分级——唯一真源是 `mine-dsh-plugins/_tools/family-rank.mjs`(离线实测 GitHub\r\n * star + npm 周下载量加权)。延迟 = BASE + RANK * STEP;rank 越大越靠后兜底。\r\n */\r\nexport const FAMILY_CLAIM_RANK = 4\r\nconst FAMILY_CLAIM_BASE_MS = 200\r\nconst FAMILY_CLAIM_STEP_MS = 900\r\n/** 派生而非硬编码:改 rank 表就自动改时刻。 */\r\nexport const FAMILY_CLAIM_DELAY_MS = FAMILY_CLAIM_BASE_MS + FAMILY_CLAIM_RANK * FAMILY_CLAIM_STEP_MS\r\n\r\n/** 接管行的遮蔽优先级:必须大于任何正牌 owner(TL 无=0、guard=10),\r\n * 这样 owner 一旦上位就自然遮蔽本兜底行(宿主规则:同 cell 最低者渲染)。 */\r\nconst FAMILY_HOST_PRIORITY = 50\r\n\r\ntype HostObservable<T> = {\r\n getSnapshot(): T\r\n subscribe(listener: () => void): () => void\r\n}\r\n\r\n/** 账本条目上宿主挂的直挂载面(≤0.1.5 壳无 renderSlot 时用)。 */\r\ninterface MountableEntry {\r\n options?: Record<string, unknown>\r\n component?: unknown\r\n inject?: unknown\r\n}\r\n\r\nexport interface FamilyHostSectionProps {\r\n renderSlot?: (key: 'dsh-family.tab', owner?: object, opts?: { only?: string; fallback?: JSX.Element | null }) => JSX.Element | null\r\n useTabs?: <S>(selector: (value: readonly FamilyTabEntry[]) => S) => S\r\n hooks?: { tabs: HostObservable<readonly FamilyTabEntry[]> }\r\n renderContributor?: (id: string) => JSX.Element | null\r\n /** 接管态内联直挂本插件自己的卡:自宣子槽不触发自身 inject(账本恒无己卡),\r\n * 故不能靠 renderSlot/renderContributor 取回。缺省(未传)时行为与旧一致。 */\r\n renderOwn?: () => ReactNode\r\n /** 内联 own 行的账本 id(与账本条目去重用);仅 renderOwn 存在时生效。 */\r\n ownId?: string\r\n}\r\n\r\nconst NO_TABS: readonly FamilyTabEntry[] = []\r\n\r\n/** 通用容器渲染:按 order 依次画出账本里每张贡献卡,不含任何\"本插件特例\"。 */\r\nexport function FamilyHostSection(props: FamilyHostSectionProps): JSX.Element {\r\n const raw = props.hooks?.tabs\r\n const [polled, setPolled] = useState<readonly FamilyTabEntry[]>(() => raw?.getSnapshot() ?? NO_TABS)\r\n useEffect(() => {\r\n if (props.useTabs !== undefined || raw === undefined) return\r\n return raw.subscribe(() => setPolled(raw.getSnapshot()))\r\n })\r\n const tabs = props.useTabs !== undefined ? props.useTabs(value => value) : polled\r\n // 接管时本插件既是容器 owner 又是成员:自己声明的 dsh-family.tab 不会触发\r\n // 自身 inject(账本恒无本卡),故把本卡作为 OWN 行内联直挂、其余成员仍走账本;\r\n // 若本卡已在账本(外部 owner 在场、自身 inject 已触发)则去重不双渲。对齐 thinking-levels OWN_TAB_ID。\r\n const ownId = props.ownId ?? '__own__'\r\n const rows: readonly FamilyTabEntry[] = props.renderOwn\r\n ? [{ id: ownId, order: Number.NEGATIVE_INFINITY, label: ownId }, ...tabs.filter(tab => tab.id !== ownId)]\r\n : tabs\r\n return createElement(\r\n 'div',\r\n { style: { display: 'grid', gap: '12px' } },\r\n rows.map(row =>\r\n createElement(\r\n 'div',\r\n { key: row.id },\r\n props.renderOwn && row.id === ownId\r\n ? props.renderOwn()\r\n : props.renderSlot\r\n ? props.renderSlot(FAMILY_CHILD_KEY, {}, { only: row.id, fallback: null })\r\n : props.renderContributor?.(row.id) ?? null,\r\n ),\r\n ),\r\n )\r\n}\r\n\r\n/** 取条目上的具名面(宿主条目是结构化对象,这里只做安全读取)。 */\r\nfunction face(entry: unknown, key: string): unknown {\r\n if (entry === null || typeof entry !== 'object') return undefined\r\n return (entry as Record<string, unknown>)[key]\r\n}\r\n\r\n/** 条目的 options 收窄(宿主侧是结构化对象,缺失时当空对象读)。 */\r\nfunction optionsOf(entry: unknown): Record<string, unknown> {\r\n const raw = face(entry, 'options')\r\n return raw !== null && typeof raw === 'object' ? raw as Record<string, unknown> : {}\r\n}\r\n\r\n/** 把账本条目投影成标题行:label 可能是函数,抛错退化成 id,绝不带崩整节。 */\r\nexport function projectLedger(slots: FamilyHostSlots): readonly FamilyTabEntry[] {\r\n return slots\r\n .entries(FAMILY_CHILD_KEY)\r\n .map(rawEntry => {\r\n const entry = rawEntry as unknown as MountableEntry\r\n const options = entry.options ?? {}\r\n const id = String(options['id'] ?? '')\r\n const rawLabel = options['label']\r\n let label = id\r\n if (typeof rawLabel === 'function') {\r\n try {\r\n label = String((rawLabel as () => unknown)() ?? id)\r\n } catch {\r\n label = id\r\n }\r\n } else if (typeof rawLabel === 'string') {\r\n label = rawLabel\r\n }\r\n return { id, order: Number(options['order'] ?? 0), label }\r\n })\r\n .sort((a, b) => a.order - b.order)\r\n}\r\n\r\n/**\r\n * 若到点仍无人声明子席位,则自己接管容器。\r\n * @param slots - 客户端槽门面。\r\n * @param isHeld - 探针:本插件的 tab 工厂是否已被执行(= 有人声明了子席位)。\r\n * @param label - 导航标题;家族共享节的标题,不是本插件名。\r\n * @param log - console 前缀(带插件名)。\r\n * @returns 取消定时器与撤销接管注册的 disposer。\r\n */\r\nexport function claimFamilyHostIfOrphaned(\r\n slots: FamilyHostSlots,\r\n isHeld: () => boolean,\r\n label: () => string,\r\n log: string,\r\n ownTab?: { id: string; component: unknown; inject?: () => Record<string, unknown> },\r\n): () => void {\r\n let disposeClaim: (() => void) | undefined\r\n let claimed = false\r\n const timer = setTimeout(() => {\r\n // 有人持有声明(我们的工厂被跑过)或账本已有卡 → 只做成员,不上位。\r\n if (isHeld()) return\r\n const ledger: HostObservable<readonly FamilyTabEntry[]> = {\r\n getSnapshot: () => projectLedger(slots),\r\n subscribe: listener => (slots.subscribe ? slots.subscribe(FAMILY_CHILD_KEY, listener) : () => undefined),\r\n }\r\n /** ≤0.1.5 壳没有 renderSlot:从账本条目现挂组件,失败一律 null。 */\r\n const renderContributor = (id: string): JSX.Element | null => {\r\n try {\r\n const found = slots.entries(FAMILY_CHILD_KEY).find(candidate => String(optionsOf(candidate)['id'] ?? '') === id)\r\n const entry = found as unknown as MountableEntry | undefined\r\n const component = entry ? face(entry, 'component') : undefined\r\n const inject = entry ? face(entry, 'inject') : undefined\r\n if (typeof component !== 'function') return null\r\n const injected = typeof inject === 'function' ? (inject as () => Record<string, unknown>)() : {}\r\n return createElement(component as (props: unknown) => ReactNode, injected ?? {}) as JSX.Element\r\n } catch {\r\n return null\r\n }\r\n }\r\n try {\r\n const dispose = slots.register(\r\n {\r\n name: 'settings.section',\r\n id: FAMILY_SECTION_ID,\r\n order: 40,\r\n priority: FAMILY_HOST_PRIORITY,\r\n label,\r\n inject: () => ({\r\n hooks: { tabs: ledger },\r\n renderContributor,\r\n ownId: ownTab?.id,\r\n renderOwn: ownTab === undefined\r\n ? undefined\r\n : () => createElement(ownTab.component as (p: unknown) => ReactNode, ownTab.inject ? ownTab.inject() : {}),\r\n }),\r\n children: { [FAMILY_CHILD_KEY]: { kind: 'list', scope: 'root' } },\r\n },\r\n FamilyHostSection,\r\n )\r\n if (typeof dispose === 'function') disposeClaim = dispose as () => void\r\n claimed = true\r\n console.warn(`${log} family container unclaimed — took it over (children declared)`)\r\n } catch (error) {\r\n // declare-or-withdraw: someone holds the declaration after all; a childless\r\n // section here would hide every member card instead of saving it.\r\n console.warn(`${log} family claim lost — withdrawing (${error instanceof Error ? error.message : String(error)})`)\r\n }\r\n }, FAMILY_CLAIM_DELAY_MS)\r\n return () => {\r\n clearTimeout(timer)\r\n if (claimed) disposeClaim?.()\r\n }\r\n}\r\n","/**\r\n * Browser half: the task board tab, plus the shadow that hides the official\r\n * composer-band todo panel.\r\n *\r\n * Registration order matters and is deliberate:\r\n *\r\n * 1. **Dictionaries first.** Every later registration can render translated\r\n * copy, and a dictionary that lands after the first paint would show raw\r\n * keys for a frame.\r\n * 2. **Sidebar surface, deferred.** The board needs a sidebar to live in:\r\n * better-sidebar when it is installed (richer: badge + rail icon), else the\r\n * host's own right-sidebar tab system (0.1.5+ `sidebarRightTabs` +\r\n * `sidebar.right.pane.tab`). Both are acquired through the deferred\r\n * `ctx.inject` because neither service is ordered against this apply —\r\n * an immediate `ctx.get` was the 0.1.2 inert bug. With neither — ≤0.1.2\r\n * hosts without better-sidebar — the plugin stays sidebar-inert: the\r\n * official panel keeps rendering and the shadow never installs.\r\n * 3. **Shadow the official dock.** Deliberately BEFORE the tab registration:\r\n * the panel is the only other carrier of the list, so the replacement has to\r\n * exist in the same activation.\r\n * 4. **Register the tab.**\r\n * 5. **Register the settings cards.** The memory-section switch gets TWO\r\n * faces from ONE component + ONE inject factory: a card in the plugin-family\r\n * settings section (「起子插件设置」, hosted by dsh-thinking-levels) and the\r\n * Plugins-page configuration card. `configForms` resolves through a\r\n * deferred inject (the service may start after apply — the same lateness\r\n * the composer model panel in dsh-thinking-levels guards against); on a\r\n * host without it the cards never register and the section gate falls back\r\n * to its default (on).\r\n *\r\n * Every registration rides `ctx.effect(fn, label)` so its disposer is revoked on\r\n * fiber teardown (HMR / disable), which is also what makes the shadow\r\n * reversible: unload the plugin and the official dock renders again. The\r\n * settings cards are the family-proven exception: they ride the deferred\r\n * `configForms` inject whose disposers are not held (same as\r\n * dsh-thinking-levels' composer panel registration).\r\n *\r\n * Contract notes for the two surfaces touched here:\r\n * - better-sidebar tabs are hosted by DSH's native right Sidebar, so the tab\r\n * body receives `TabComponentProps` (`ctx` + `scope` + `visible`) and NOT the\r\n * framework's session-scoped slot props.\r\n * - `conversation.input.dock` is the DSH slot the official todo panel occupies;\r\n * see `brief/dock-shadow.tsx` for why a lower priority wins the cell.\r\n */\r\nimport { createElement } from 'react'\r\nimport type { ReactNode } from 'react'\r\nimport type { Context } from '@deepseek-ai/cordis'\r\nimport type { BetterSidebarService, TabComponentProps } from 'dsh-better-sidebar/client/service'\r\nimport { registerNativeBoardTab } from './native-sidebar'\r\nimport type { NativeTabRegistryLike } from './native-sidebar'\r\nimport { setOpenTab } from './memory-tab'\r\nimport { ECHO_VIEWER_TAB } from './memory-tab'\r\nimport { EchoViewer } from './echo-viewer/echo-viewer'\r\nimport { MemoryViewer } from './memory-viewer/viewer'\r\nimport { SummaryTab } from './SummaryTab'\r\nimport { BriefIcon } from './BriefIcon'\r\nimport { NS, dictionaries } from './locales'\r\nimport { readTodos, unfinishedCount } from './brief/board'\r\nimport { registerTodoDockShadow } from './brief/dock-shadow'\r\nimport type { SlotsLike } from './brief/dock-shadow'\r\nimport { TODOS_KEY } from './brief/use-todos'\r\nimport { projectionSnapshot } from './use-projection'\r\nimport { BriefSettingsCard } from './settings-card'\r\nimport type { BriefSettingsCardProps } from './settings-card'\r\nimport { claimFamilyHostIfOrphaned } from './family-host'\r\nimport type { FamilyHostSlots } from './family-host'\r\nimport type { BriefClientConfig, ConfigFormsLike } from './scope-face'\r\n\r\n/**\r\n * Tab type id. Package-prefixed so it cannot collide with a built-in type.\r\n * Unchanged since the 0.1.0 board tab: the summary tab REPLACES the board tab\r\n * in place, so an opened or pinned tab survives the upgrade.\r\n */\r\nexport const TAB_ID = 'dsh-brief-sidebar:board'\r\n\r\n/**\r\n * Tab kind on the native host-sidebar path (`openTab`/guide dispatch key).\r\n * Only the native registration uses it; better-sidebar keeps addressing the\r\n * tab by {@link TAB_ID}.\r\n */\r\nexport const TAB_KIND = 'brief-board'\r\n\r\n/**\r\n * Position in the host's new-tab guide.\r\n *\r\n * Built-ins on this host generation sit at editor 10 / git 20 / subagent 30 /\r\n * sidechat 35 / terminal 40 / browser 50. 15 places a per-session task board\r\n * right after the editor, which is where a reader looks for session state.\r\n */\r\nexport const TAB_ORDER = 15\r\n\r\n/** Services required before `apply` runs. */\r\n// Generation-neutral list only: betterSidebar/locale ride ctx.get soft-reads in\r\n// apply (both absent on 0.1.0/0.1.1 — declaring them pends the whole client\r\n// entry, web boot refuses to render; playbook §1).\r\n// betterSidebar 经 ctx.get 软读(缺席 inert);locale 全线 rc 皆在(0.1.0-rc.2 起)。\r\n// 第三方插件服务不入顶层 inject——缺席格 entry 永久 pending,web boot 拒渲染整树。\r\nexport const inject = ['slots', 'locale']\r\n\r\n/**\r\n * Structural view of the DSH locale service — only the two members this plugin\r\n * calls. Declared locally on purpose: importing the real type would pull the\r\n * whole client type graph into a browser-only plugin for two signatures.\r\n */\r\ninterface LocaleLike {\r\n register(ns: string, dicts: Record<string, Record<string, string>>): () => void\r\n bind(ns: string): (key: string) => string\r\n}\r\n\r\n/**\r\n * An effect body must return a disposer (cordis rejects `undefined` with a\r\n * `TypeError`), so a path that could not register anything returns this no-op\r\n * instead of nothing.\r\n */\r\nconst NOOP = (): void => {}\r\n\r\n/** Console prefix for the environment probe and registration attribution. */\r\nconst LOG = '[dsh-brief-sidebar]'\r\n\r\n/**\r\n * Run a registration thunk, attributing a thrown failure to the console\r\n * instead of the cordis effect void (a bare throw inside `ctx.effect` leaves\r\n * the field reader with an empty sidebar and no clue which arm died).\r\n */\r\nfunction guarded(label: string, run: () => (() => void) | undefined | void): () => void {\r\n try {\r\n const dispose = run()\r\n return typeof dispose === 'function' ? (dispose as () => void) : NOOP\r\n } catch (error) {\r\n console.error(`${LOG} ${label} failed`, error)\r\n return NOOP\r\n }\r\n}\r\n\r\n/**\r\n * Browser-face apply.\r\n *\r\n * @param ctx - the client root context.\r\n */\r\nexport function apply(ctx: Context): void {\r\n // 1. Plugin-owned dictionaries, in one registration.\r\n const locale: LocaleLike | undefined = ctx.get('locale')\r\n if (locale !== undefined) {\r\n ctx.effect(() => locale.register(NS, dictionaries), 'dsh-brief-sidebar: dictionaries')\r\n }\r\n\r\n /**\r\n * Translate one of our keys. `bind` returns a cached function that reads the\r\n * ACTIVE locale at call time, so a language switch needs no re-apply; an\r\n * unknown namespace or key falls back to the key itself rather than throwing\r\n * inside a render.\r\n */\r\n const t = (key: string): string => {\r\n if (locale === undefined) return key\r\n try {\r\n return locale.bind(NS)(key) || key\r\n } catch {\r\n return key\r\n }\r\n }\r\n\r\n // 2. Sidebar surface, acquired DEFERRED. better-sidebar is a third-party\r\n // plugin with no ordering guarantee against us, and the native tab\r\n // registry is a host service that can publish after this apply too — an\r\n // immediate `ctx.get` misses either one and stays inert forever (the\r\n // 0.1.2 field failure). Both arms ride the deferred optional\r\n // `ctx.inject` (the browser-cdp / configForms precedent). The host\r\n // registry usually wins the race on 0.1.5+ (it publishes before the\r\n // third-party sidebar), so the state is NOT a one-shot latch: when\r\n // better-sidebar arrives after a native seat, it HANDS OVER — the\r\n // native registration is released and the board re-seats on the bar,\r\n // which is the rail and manager the user actually sees (the 0.1.5\r\n // \"invisible tab\" failure was a native seat under a sidebar UI that\r\n // replaced the official rail). On a bare native host (0.1.7 farm cell)\r\n // no handover ever fires.\r\n let surface: 'none' | 'bar' | 'native' = 'none'\r\n let shadowDone = false\r\n let nativeDisposer: (() => void) | undefined\r\n\r\n /** Hide the official composer-band panel (reversible on unload), once. */\r\n const shadowDock = (): void => {\r\n if (shadowDone) return\r\n shadowDone = true\r\n ctx.effect(() => registerTodoDockShadow(ctx) ?? NOOP, 'dsh-brief-sidebar: dock shadow')\r\n }\r\n\r\n const registerOnBar = (bar: BetterSidebarService): void => {\r\n if (surface === 'bar') return\r\n if (surface === 'native') {\r\n const release = nativeDisposer\r\n nativeDisposer = undefined\r\n try {\r\n release?.()\r\n } catch { /* a half-torn-down native seat must not block the handover */ }\r\n console.info(`${LOG} surface=bar (handed over from native)`)\r\n } else {\r\n console.info(`${LOG} surface=bar`)\r\n }\r\n surface = 'bar'\r\n shadowDock()\r\n ctx.effect(\r\n () =>\r\n guarded('registerTab', () =>\r\n bar.registerTab({\r\n id: TAB_ID,\r\n title: () => t('tab.title'),\r\n description: () => t('tab.desc'),\r\n icon: (size: number) => BriefIcon(size),\r\n order: TAB_ORDER,\r\n // Shorthand for `dedupeKey: () => id`: reopening focuses the existing tab.\r\n single: true,\r\n /**\r\n * Unfinished count on the tab strip. Called on every tab-bar render, so\r\n * it reads one snapshot and allocates no subscription; a completed list\r\n * shows no badge at all.\r\n */\r\n badge: (badgeCtx, badgeScope) => {\r\n const todos = readTodos(projectionSnapshot(badgeCtx, badgeScope.sessionId, TODOS_KEY))\r\n if (todos === undefined) return null\r\n const pending = unfinishedCount(todos)\r\n return pending > 0 ? pending : null\r\n },\r\n component: (props: TabComponentProps) =>\r\n createElement(SummaryTab, {\r\n t,\r\n ctx: props.ctx,\r\n scope: props.scope,\r\n visible: props.visible,\r\n }),\r\n }),\r\n ),\r\n 'dsh-brief-sidebar: tab',\r\n )\r\n }\r\n\r\n const registerOnNative = (registry: NativeTabRegistryLike | undefined): void => {\r\n if (surface !== 'none') return\r\n surface = 'native'\r\n console.info(`${LOG} surface=native`)\r\n shadowDock()\r\n ctx.effect(\r\n () => {\r\n nativeDisposer = guarded('native tab', () => registerNativeBoardTab(ctx, registry, { id: TAB_ID, kind: TAB_KIND, order: TAB_ORDER, t }))\r\n return () => {\r\n nativeDisposer = undefined\r\n }\r\n },\r\n 'dsh-brief-sidebar: native tab',\r\n )\r\n }\r\n\r\n /** Register the memory detail viewer tab (hidden, opened via openMemoryTab). */\r\n const registerMemoryTab = (bar: BetterSidebarService): void => {\r\n try {\r\n ;(bar as unknown as { registerTab(desc: Record<string, unknown>): unknown }).registerTab({\r\n id: 'dsh-md-memory-viewer:memory',\r\n title: 'Memory',\r\n description: '查看记忆条目详情',\r\n hidden: true,\r\n order: 200,\r\n dedupeKey: (tab: { path?: string }) => tab.path ? `memory:${tab.path}` : undefined,\r\n component: (props: { ctx: Context; tab?: { path?: string }; scope?: { sessionId?: string } }) => {\r\n const memoryId = props.tab?.path ?? ''\r\n return createElement(MemoryViewer, {\r\n ctx: props.ctx,\r\n memoryId,\r\n scope: props.scope ?? {},\r\n })\r\n },\r\n })\r\n } catch { /* already registered or service busy */ }\r\n }\r\n\r\n /** Register the echo(回响原文)viewer tab (hidden, opened via openEchoTab). */\r\n const registerEchoTab = (bar: BetterSidebarService): void => {\r\n try {\r\n ;(bar as unknown as { registerTab(desc: Record<string, unknown>): unknown }).registerTab({\r\n id: ECHO_VIEWER_TAB,\r\n title: 'Echo',\r\n description: '查看回响条目当时的注入原文',\r\n hidden: true,\r\n order: 201,\r\n dedupeKey: (tab: { path?: string }) => tab.path ? `echo:${tab.path}` : undefined,\r\n component: (props: { ctx: Context; tab?: { path?: string }; scope?: { sessionId?: string } }) =>\r\n createElement(EchoViewer, { tab: props.tab, ctx: props.ctx }),\r\n })\r\n } catch { /* already registered or service busy */ }\r\n }\r\n\r\n // Arm 1: better-sidebar, immediate read first (the common case where the\r\n // sidebar started before us), deferred retry otherwise.\r\n let bar: BetterSidebarService | undefined\r\n try {\r\n bar = ctx.get('betterSidebar')\r\n } catch {\r\n bar = undefined\r\n }\r\n if (bar !== undefined) {\r\n registerOnBar(bar)\r\n setOpenTab((seed) => bar!.openTab(seed))\r\n registerMemoryTab(bar)\r\n registerEchoTab(bar)\r\n } else {\r\n ;(ctx as unknown as {\r\n inject: (deps: string[], cb: (scope: { betterSidebar?: BetterSidebarService }) => void) => void\r\n }).inject(['betterSidebar'], (scope) => {\r\n if (scope.betterSidebar !== undefined) { registerOnBar(scope.betterSidebar); setOpenTab((seed) => scope.betterSidebar!.openTab(seed)); registerMemoryTab(scope.betterSidebar); registerEchoTab(scope.betterSidebar) }\r\n })\r\n }\r\n\r\n // Arm 2: the host's own tab registry (0.1.5+). Never fires on ≤0.1.2. The\r\n // registry is read from the INJECTED scope — a root ctx.get of this\r\n // undeclared service is denied by the strict proxy (the 0.1.7 silent no-op).\r\n ;(ctx as unknown as {\r\n inject: (deps: string[], cb: (scope: { sidebarRightTabs?: NativeTabRegistryLike }) => void) => void\r\n }).inject(['sidebarRightTabs'], (scope) => {\r\n registerOnNative(scope.sidebarRightTabs)\r\n })\r\n\r\n // 5. The settings cards (see the module doc): ONE component + ONE inject\r\n // factory at TWO seats. The entry ids follow the family convention —\r\n // `dsh-family.tab` contributors key by short id (session-guard →\r\n // 'session-guard'), `plugins.bundle.config` keys by package name.\r\n // `configForms` rides a deferred inject: the service lives in the\r\n // settings module, which may start after this apply; the callback simply\r\n // never fires on a host without it (the gate then reads its default).\r\n const slots = ctx.get('slots') as SlotsLike | undefined\r\n // configForms 句柄惰性化:接管在 apply 顶层触发,早于/独立于 configForms 的\r\n // deferred inject;捕获解出的句柄供 ownTab 现取 scope(未解出时 BriefSettingsCard\r\n // 自行降级为 unavailable 提示而非空白)。\r\n let configFormsHandle: ConfigFormsLike | undefined\r\n ;(ctx as unknown as {\r\n inject: (deps: string[], cb: (scope: { configForms?: ConfigFormsLike }) => void) => void\r\n }).inject(['configForms'], (scope) => {\r\n const configForms = scope.configForms\r\n if (slots === undefined || configForms === undefined || typeof configForms.get !== 'function') return\r\n configFormsHandle = configForms\r\n\r\n /** Same face for both seats: the entry scope plus the applied-time binder. */\r\n const injectFactory = (): BriefSettingsCardProps => ({\r\n t,\r\n scope: configForms.get<BriefClientConfig>('dsh-brief-sidebar'),\r\n })\r\n /** The slot core hands the component `unknown` props (registry typing). */\r\n const component = BriefSettingsCard as unknown as (props: unknown) => ReactNode\r\n\r\n slots.inject('dsh-family.tab', () => slots.register(\r\n {\r\n name: 'dsh-family.tab',\r\n id: 'brief-sidebar',\r\n order: 30,\r\n label: () => t('settings.title'),\r\n inject: injectFactory,\r\n },\r\n component,\r\n ))\r\n slots.inject('plugins.bundle.config', () =>\r\n slots.register(\r\n {\r\n name: 'plugins.bundle.config',\r\n key: 'dsh-brief-sidebar',\r\n inject: injectFactory,\r\n },\r\n component,\r\n ),\r\n )\r\n })\r\n\r\n // 家族容器兜底:若到分级时刻仍无人声明 `dsh-family.tab`(owner 全部让位或声明\r\n // 失败),本插件自己上位成通用容器——否则成员卡整轮启动不可见且不报任何错。\r\n // 注册在 apply 顶层而不是 configForms 回调里:没有 configForms 的主机上,\r\n // 容器仍然需要有人接管。\r\n if (slots !== undefined) {\r\n ctx.effect(\r\n () => claimFamilyHostIfOrphaned(\r\n slots as unknown as FamilyHostSlots,\r\n // 判据:有没有一个实际在位的家族容器(id=dsh-family 的 settings.section),\r\n // 而非「我的 inject 有没有触发」——后者在自宣子槽时恒 false(本 bug 成因)。\r\n () => {\r\n try {\r\n return (slots as unknown as FamilyHostSlots).entries('settings.section')\r\n .some(e => String((((e.options ?? {}) as { id?: unknown }).id) ?? '') === 'dsh-family')\r\n } catch { return false }\r\n },\r\n // 家族共享节标题,不是本插件名:接管的是别人的那一节。\r\n () => '起子插件设置',\r\n LOG,\r\n // 接管态内联直挂本卡:own 卡组件 + 惰性 scope(configForms 未解出时卡自行降级为非空白)。\r\n {\r\n id: 'brief-sidebar',\r\n component: BriefSettingsCard as unknown,\r\n inject: () => ({ t, scope: configFormsHandle?.get<BriefClientConfig>('dsh-brief-sidebar') }),\r\n },\r\n ),\r\n 'brief: family host backstop',\r\n )\r\n }\r\n\r\n // One-line environment snapshot: what this apply could see at mount time.\r\n // Cross-reference with the `surface=` line to tell \"arm never fired\" from\r\n // \"arm fired and registration threw\" (guarded logs that part).\r\n try {\r\n let nativeTabsAtApply = false\r\n try {\r\n nativeTabsAtApply = ctx.get('sidebarRightTabs') !== undefined\r\n } catch {\r\n nativeTabsAtApply = false /* strict proxy denies the undeclared read */\r\n }\r\n console.info(`${LOG} env ${JSON.stringify({\r\n locale: locale !== undefined,\r\n barAtApply: bar !== undefined,\r\n nativeTabsAtApply,\r\n })}`)\r\n } catch { /* console may be absent in a stripped host */ }\r\n}\r\n"],"mappings":";;;;;;;;;EAiBA,MAAM,WAAkC;GAAC;GAAW;GAAe;EAAW;;EAG9E,MAAMA,eAAyC;GAC7C,SAAS;GACT,aAAa;GACb,WAAW;EACb;;EAGA,SAAgB,UAAU,QAA4B;GACpD,OAAOA,aAAW;EACpB;;;;;;;;;;;;;;;;EAiBA,SAAgB,UAAU,OAAiD;GACzE,IAAI,UAAU,MAAM,OAAO,CAAC;GAC5B,IAAI,CAAC,MAAM,QAAQ,KAAK,GAAG,OAAO,KAAA;GAElC,MAAM,QAAoB,CAAC;GAC3B,KAAK,MAAM,OAAO,OAAO;IACvB,IAAI,QAAQ,QAAQ,OAAO,QAAQ,UAAU;IAC7C,MAAM,EAAE,SAAS,WAAW;IAC5B,IAAI,OAAO,YAAY,UAAU;IACjC,IAAI,OAAO,WAAW,YAAY,CAAC,SAAS,MAAM,GAAG;IACrD,MAAM,KAAK;KAAE;KAAS;IAAO,CAAC;GAChC;GACA,OAAO;EACT;;EAGA,SAAS,SAAS,OAAoC;GACpD,OAAQ,SAA+B,SAAS,KAAK;EACvD;;EAWA,SAAgB,WAAW,OAAwC;GACjE,IAAI,YAAY;GAChB,IAAI,aAAa;GACjB,IAAI,UAAU;GACd,KAAK,MAAM,QAAQ,OACjB,IAAI,KAAK,WA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AO;IAAM;GACzB,SAEM,UACN,KAEA;IACE,IAAI;IACJ,WAAW;IACX,eAAe;KAAE;KAAG,OAAO,mBAAmB,IAAuB,mBAAmB;IAAE;GAC5F,CACF,GACA,6BACF;GAMF,IAAI;IACF,IAAI,oBAAoB;IACxB,IAAI;KACF,oBAAoB,IAAI,IAAI,kBAAkB,MAAM,KAAA;IACtD,QAAQ;KACN,oBAAoB;IACtB;IACA,QAAQ,KAAK,GAAG,IAAI,OAAO,KAAK,UAAU;KACxC,QAAQ,WAAW,KAAA;KACnB,YAAY,QAAQ,KAAA;KACpB;IACF,CAAC,GAAG;GACN,QAAQ,CAAiD;EAC3D"}
|
|
1
|
+
{"version":3,"file":"client.js","names":["STATUS_KEY","NO_SUBSCRIBE","ABSENT","useMemo","useCallback","useSyncExternalStore","useMemo","SECTION_STYLE","HEADER_STYLE","LIST_STYLE","ROW_STYLE","createElement","CHEVRON_STYLE","createElement","SECTION_STYLE","HEADER_STYLE","LIST_STYLE","ROW_STYLE","TAG_STYLE","createElement","useState","isCounter","readLatest","isCounter","readItem","isCounter","readRecall","isCounter","NO_SUBSCRIBE","useMemo","useCallback","useSyncExternalStore","SECTION_STYLE","HEADER_STYLE","LIST_STYLE","ROW_STYLE","NAME_STYLE","TAG_STYLE","FOOTER_STYLE","EMPTY_STYLE","useState","createElement","SECTION_STYLE","HEADER_STYLE","LIST_STYLE","BUBBLE_STYLE","TITLE_STYLE","FOOTER_STYLE","EMPTY_STYLE","useState","createElement","TYPE_STYLE","BODY_STYLE","SCENARIO_STYLE","FOOTER_STYLE","createElement","renderMd","Fragment","TRIGGER_STYLE","ITEM_STYLE","FAIL_STYLE","POPOVER_STYLE","useState","useRef","useCallback","createElement","SECTION_STYLE","HEADER_STYLE","HINT_STYLE","LIST_STYLE","ROW_STYLE","TITLE_STYLE","META_STYLE","EMPTY_STYLE","createElement","useState","useRef","readRecall","useCallback","SECTION_STYLE","HEADER_STYLE","ROW_STYLE","BODY_STYLE","VIEW_BTN_STYLE","createElement","useCallback","useState","useRef","useCallback","createElement","SECTION_STYLE","HEADER_STYLE","BODY_STYLE","ROW_STYLE","ROW_TEXT_STYLE","useState","useCallback","createElement","HEADER_STYLE","useState","readRecall","useCallback","createElement","createElement","WRAP","useState","createElement","NAME_STYLE","createElement","Fragment","useState","createElement","useState","useSyncExternalStore","useCallback","useState","createElement","entry","createElement"],"sources":["../src/client/brief/board.ts","../src/client/use-projection.ts","../src/client/brief/use-todos.ts","../src/client/TodoBoardTab.tsx","../src/projection/keys.ts","../src/client/file-open.ts","../src/client/summary/deliverables.ts","../src/client/summary/FoldToggle.tsx","../src/client/locales.ts","../src/client/summary/DeliverablesSection.tsx","../src/client/summary/skill-usage.ts","../src/projection/search-ref-fold.ts","../src/client/summary/search-refs.ts","../src/client/summary/memory-recall.ts","../src/client/summary/memory-slots.ts","../src/client/scope-face.ts","../src/client/summary/use-config-flag.ts","../src/client/summary/SkillUsageSection.tsx","../src/client/summary/SearchRefSection.tsx","../src/client/summary/recall-feedback.ts","../src/client/summary/RecallBubble.tsx","../src/client/memory-open.ts","../src/client/memory-tab.ts","../src/client/summary/MemoryViewMenu.tsx","../src/client/summary/MemoryRecallSection.tsx","../src/client/summary/MemorySlotsSection.tsx","../src/client/spirit-echo.ts","../src/client/spirit-open.ts","../src/client/summary/EchoViewMenu.tsx","../src/client/summary/SpiritEchoSection.tsx","../src/client/summary/ReferenceSection.tsx","../src/client/SummaryTab.tsx","../src/client/native-sidebar.tsx","../src/client/echo-viewer/echo-viewer.tsx","../src/client/memory-viewer/viewer.tsx","../src/client/BriefIcon.tsx","../src/client/brief/dock-shadow.tsx","../src/client/settings-card.tsx","../src/client/family-host.tsx","../src/client/index.tsx"],"sourcesContent":["/**\r\n * The `todos` projection — reading and classifying it.\r\n *\r\n * The Host computes this projection (`dsh-tool-todo` registers the key) and\r\n * pushes finished whole values; the client never folds it. This module is the\r\n * read side of that contract and is deliberately PURE — no React, no context,\r\n * no IO — so the mapping can be tested directly.\r\n */\r\n/** The projection's three-state lifecycle (`TodoItem` in `dsh-tool-todo`). */\r\nexport type TodoStatus = 'pending' | 'in_progress' | 'completed'\r\n\r\n/** One entry of the `todos` projection. */\r\nexport interface TodoItem {\r\n readonly content: string\r\n readonly status: TodoStatus\r\n}\r\n\r\nconst STATUSES: readonly TodoStatus[] = ['pending', 'in_progress', 'completed']\r\n\r\n/** Locale key per status. Kept here so this module owns the vocabulary. */\r\nconst STATUS_KEY: Record<TodoStatus, string> = {\r\n pending: 'status.pending',\r\n in_progress: 'status.inProgress',\r\n completed: 'status.completed',\r\n}\r\n\r\n/** Locale key for one status label. */\r\nexport function statusKey(status: TodoStatus): string {\r\n return STATUS_KEY[status]\r\n}\r\n\r\n/**\r\n * Narrow a raw projection value into a todo list.\r\n *\r\n * Three outcomes are kept apart on purpose, mirroring the store's own contract:\r\n * - `undefined` — the capability is ABSENT (no session, the host unit is\r\n * unmounted, or no baseline/frame has carried the key yet);\r\n * - `[]` — the projection is present and the list is empty (`null` on the wire);\r\n * - a list — real entries.\r\n *\r\n * A malformed entry is dropped rather than thrown on: the projection is a\r\n * trusted Host value, but a shape drift must not blank the whole board.\r\n *\r\n * @param value - the raw `unknown` snapshot of the `todos` face.\r\n * @returns the validated list, or `undefined` when the capability is absent.\r\n */\r\nexport function readTodos(value: unknown): readonly TodoItem[] | undefined {\r\n if (value === null) return []\r\n if (!Array.isArray(value)) return undefined\r\n\r\n const items: TodoItem[] = []\r\n for (const raw of value) {\r\n if (raw === null || typeof raw !== 'object') continue\r\n const { content, status } = raw as { content?: unknown; status?: unknown }\r\n if (typeof content !== 'string') continue\r\n if (typeof status !== 'string' || !isStatus(status)) continue\r\n items.push({ content, status })\r\n }\r\n return items\r\n}\r\n\r\n/** Whether a string is one of the three lifecycle values. */\r\nfunction isStatus(value: string): value is TodoStatus {\r\n return (STATUSES as readonly string[]).includes(value)\r\n}\r\n\r\n/** Per-status counts over one list. */\r\nexport interface TodoCounts {\r\n readonly total: number\r\n readonly completed: number\r\n readonly inProgress: number\r\n readonly pending: number\r\n}\r\n\r\n/** Count a todo list by status. */\r\nexport function countTodos(todos: readonly TodoItem[]): TodoCounts {\r\n let completed = 0\r\n let inProgress = 0\r\n let pending = 0\r\n for (const item of todos) {\r\n if (item.status === 'completed') completed += 1\r\n else if (item.status === 'in_progress') inProgress += 1\r\n else pending += 1\r\n }\r\n return { total: todos.length, completed, inProgress, pending }\r\n}\r\n\r\n/** How many entries are not finished — the tab badge. */\r\nexport function unfinishedCount(todos: readonly TodoItem[]): number {\r\n const counts = countTodos(todos)\r\n return counts.inProgress + counts.pending\r\n}\r\n\r\n/**\r\n * The one-line progress summary, composed from parts so no interpolation\r\n * machinery is needed (the locale binder is a plain key → string lookup).\r\n * Mirrors the official dock's own label.\r\n */\r\nexport function progressLine(counts: TodoCounts, t: (key: string) => string): string {\r\n const parts = [`${t('status.completed')} ${counts.completed}/${counts.total}`]\r\n if (counts.inProgress > 0) parts.push(`${t('status.inProgress')} ${counts.inProgress}`)\r\n if (counts.pending > 0) parts.push(`${t('status.pending')} ${counts.pending}`)\r\n return parts.join(' · ')\r\n}\r\n","/**\r\n * Reading a live session projection from the client Session Controller.\r\n *\r\n * better-sidebar tab bodies are NOT rendered inside a DSH slot, so the\r\n * framework's `useProjection` standard prop is not available to them. The\r\n * equivalent face is reachable directly: the client Session Controller is a\r\n * cordis service on the root context, and each session binding exposes its\r\n * projections store (`SessionFace.projections.faceOf(key)`), which is the very\r\n * observable `useProjection` resolves. Since it is a bare\r\n * `{ getSnapshot, subscribe }` source, `useSyncExternalStore` binds it as-is —\r\n * no local mirror, no folding, and the value reference only changes when the\r\n * Host pushes a frame.\r\n *\r\n * Everything here is resolved defensively: a host without the Session\r\n * Controller, or a session that is not open any more, degrades to \"capability\r\n * absent\" (undefined) rather than throwing inside a render.\r\n *\r\n * This module is key-agnostic; the per-projection knowledge (which key, how to\r\n * narrow the raw value) lives with the feature modules that call it.\r\n */\r\nimport { useCallback, useMemo, useSyncExternalStore } from 'react'\r\n\r\n/**\r\n * Structural probe face for the client root context.\r\n *\r\n * Widened from cordis `Context` on the 0.2.1-rc.3 dev bed: the host tab library\r\n * vendors its own cordis `Context` and intersects it into the tab/badge ctx it\r\n * hands us, so the nominal cordis `Context` of this repo's cordis copy is NOT\r\n * assignable across the two (missing symbol members). Everything this plugin\r\n * reads off the context already goes through `ctx.get(...)` structural probes,\r\n * so the shared minimum is exactly that one method.\r\n */\r\nexport interface CtxProbe {\r\n get(key: string): any\r\n}\r\n\r\n/** Structural view of a projection face (`ObservableSnapshot<unknown>`). */\r\nexport interface ProjectionFace {\r\n getSnapshot(): unknown\r\n subscribe(listener: () => void): () => void\r\n}\r\n\r\n/** Structural view of one session binding's projection store. */\r\nexport interface ProjectionsLike {\r\n faceOf(key: string): ProjectionFace\r\n}\r\n\r\n/** Structural view of the client Session Controller face this plugin uses. */\r\nexport interface SessionsLike {\r\n binding(id: string): { readonly session: { readonly projections: ProjectionsLike } } | undefined\r\n}\r\n\r\n/** A no-op unsubscribe, kept as one identity so effects never thrash. */\r\nconst NO_SUBSCRIBE = (): void => {}\r\n\r\n/** A source that never has a value — the absent-capability face. */\r\nconst ABSENT: ProjectionFace = { getSnapshot: () => undefined, subscribe: () => NO_SUBSCRIBE }\r\n\r\n/**\r\n * Whether a value really is a projection face.\r\n *\r\n * The store contract promises an identity-stable face for every key, so this\r\n * never fires against a healthy host. It exists because the fallback is worse\r\n * than the check: `useSyncExternalStore` would throw on a face-less key, and a\r\n * thrown render is a blank sidebar rather than a diagnosable \"unavailable\".\r\n */\r\nfunction isFace(value: unknown): value is ProjectionFace {\r\n if (value === null || typeof value !== 'object') return false\r\n const face = value as Partial<ProjectionFace>\r\n return typeof face.getSnapshot === 'function' && typeof face.subscribe === 'function'\r\n}\r\n\r\n/**\r\n * Resolve one projection face for one session.\r\n *\r\n * `ctx.get('sessions')` is the safe accessor (a direct `ctx.sessions` read can\r\n * throw on a context that does not carry the service yet).\r\n *\r\n * @param ctx - the client root context handed to the tab body.\r\n * @param sessionId - the tab's session scope; undefined means \"no session\".\r\n * @param key - the projection key to resolve.\r\n * @returns the projection face, or {@link ABSENT} when unreachable.\r\n */\r\nexport function resolveFace(ctx: CtxProbe | undefined, sessionId: string | undefined, key: string): ProjectionFace {\r\n if (ctx === undefined || sessionId === undefined) return ABSENT\r\n const sessions = ctx.get('sessions') as SessionsLike | undefined\r\n if (sessions === undefined || typeof sessions.binding !== 'function') return ABSENT\r\n\r\n const binding = sessions.binding(sessionId)\r\n const projections = binding?.session?.projections\r\n if (projections === undefined || typeof projections.faceOf !== 'function') return ABSENT\r\n\r\n const face: unknown = projections.faceOf(key)\r\n return isFace(face) ? face : ABSENT\r\n}\r\n\r\n/**\r\n * Read one frame of a projection without subscribing.\r\n *\r\n * The one-shot sibling of {@link useProjectionValue}, for consumers that are\r\n * not React components — the tab badge is a plain function called on every\r\n * tab-bar render, so it must neither hold a subscription nor allocate one.\r\n *\r\n * @param ctx - the client root context.\r\n * @param sessionId - the session whose projection is read.\r\n * @param key - the projection key to read.\r\n * @returns the raw snapshot: `undefined` while the capability is absent; the\r\n * semantics of any other value belong to the projection's own contract.\r\n */\r\nexport function projectionSnapshot(ctx: CtxProbe | undefined, sessionId: string | undefined, key: string): unknown {\r\n return resolveFace(ctx, sessionId, key).getSnapshot()\r\n}\r\n\r\n/**\r\n * Subscribe to one session projection by key.\r\n *\r\n * @param ctx - the client root context.\r\n * @param sessionId - the session whose projection is shown.\r\n * @param key - the projection key to subscribe to.\r\n * @returns the raw snapshot value, identity-stable across frames the host did\r\n * not change. Narrowing is the caller's job.\r\n */\r\nexport function useProjectionValue(ctx: CtxProbe | undefined, sessionId: string | undefined, key: string): unknown {\r\n const face = useMemo(() => resolveFace(ctx, sessionId, key), [ctx, sessionId, key])\r\n\r\n const subscribe = useCallback((listener: () => void) => face.subscribe(listener), [face])\r\n const getSnapshot = useCallback(() => face.getSnapshot(), [face])\r\n\r\n return useSyncExternalStore(subscribe, getSnapshot, getSnapshot)\r\n}\r\n","/**\r\n * Reading the live `todos` projection — the thin, todo-specific wrapper around\r\n * the generic face resolver (`../use-projection`). The projection key is\r\n * registered by `dsh-tool-todo`; the host pushes finished whole values and the\r\n * client never folds it. Narrowing lives in `./board` (`readTodos`).\r\n */\r\nimport { useMemo } from 'react'\r\nimport type { CtxProbe } from '../use-projection'\r\nimport { readTodos } from './board'\r\nimport type { TodoItem } from './board'\r\nimport { useProjectionValue } from '../use-projection'\r\n\r\n/** The projection key registered by `dsh-tool-todo`. */\r\nexport const TODOS_KEY = 'todos'\r\n\r\n/**\r\n * Subscribe to one session's todo list.\r\n *\r\n * @param ctx - the client root context.\r\n * @param sessionId - the session whose projection is shown.\r\n * @returns the list, `[]` for a present-but-empty projection, or `undefined`\r\n * while the capability is absent.\r\n */\r\nexport function useTodos(ctx: CtxProbe | undefined, sessionId: string | undefined): readonly TodoItem[] | undefined {\r\n const raw = useProjectionValue(ctx, sessionId, TODOS_KEY)\r\n return useMemo(() => readTodos(raw), [raw])\r\n}\r\n","/**\r\n * The progress section: the `todos` projection drawn as one part of the\r\n * summary tab.\r\n *\r\n * The official composer-band panel is shadowed by this plugin (see\r\n * `brief/dock-shadow.tsx`), so the projection is read here and rendered as an\r\n * ordinary React view — no Canvas, no cross-package dependency. The full-height\r\n * shell and the scroll container live on the summary tab (`../SummaryTab`);\r\n * this component renders only its own slice and is the one section whose\r\n * absent state must stay VISIBLE: the official dock is hidden while this\r\n * plugin is mounted, so \"unavailable\" is a statement the reader needs.\r\n *\r\n * Colours come from `--dsw-alias-*` tokens only (skin contract), and the status\r\n * palette uses tokens that actually exist in the shipping theme:\r\n * `state-success-primary` / `state-business-primary` / `label-tertiary`.\r\n */\r\nimport { createElement } from 'react'\r\nimport type { CSSProperties, ReactNode } from 'react'\r\nimport type { CtxProbe } from './use-projection'\r\nimport { countTodos, progressLine, statusKey } from './brief/board'\r\nimport type { TodoItem, TodoStatus } from './brief/board'\r\nimport { useTodos } from './brief/use-todos'\r\n\r\n/** The session scope better-sidebar hands a tab body. */\r\nexport interface TodoScope {\r\n readonly sessionId?: string\r\n}\r\n\r\nexport interface TodoSectionProps {\r\n /** The DSH locale lookup, passed down from `apply`. */\r\n t: (key: string) => string\r\n /** The client root context (the tab body's only way to reach services). */\r\n ctx?: CtxProbe\r\n /** The session this tab is scoped to. */\r\n scope?: TodoScope\r\n}\r\n\r\n/** Status → token colour for the pill's text and border. */\r\nconst STATUS_COLOR: Record<TodoStatus, string> = {\r\n completed: 'var(--dsw-alias-state-success-primary)',\r\n in_progress: 'var(--dsw-alias-state-business-primary)',\r\n pending: 'var(--dsw-alias-label-tertiary)',\r\n}\r\n\r\nconst SECTION_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n borderBottom: '1px solid var(--dsw-alias-border-secondary)',\r\n}\r\n\r\nconst HEADER_STYLE: CSSProperties = {\r\n padding: '10px 12px 0',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n fontSize: 12,\r\n fontWeight: 600,\r\n}\r\n\r\nconst PROGRESS_STYLE: CSSProperties = {\r\n padding: '6px 12px 10px',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n fontSize: 12,\r\n}\r\n\r\nconst LIST_STYLE: CSSProperties = {\r\n listStyle: 'none',\r\n margin: 0,\r\n padding: '6px 0',\r\n display: 'flex',\r\n flexDirection: 'column',\r\n}\r\n\r\nconst ROW_STYLE: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'flex-start',\r\n gap: 8,\r\n padding: '6px 12px',\r\n}\r\n\r\n/** Pill style, coloured per status. */\r\nfunction pillStyle(status: TodoStatus): CSSProperties {\r\n return {\r\n flexShrink: 0,\r\n color: STATUS_COLOR[status],\r\n border: `1px solid ${STATUS_COLOR[status]}`,\r\n borderRadius: 999,\r\n padding: '0 6px',\r\n fontSize: 11,\r\n lineHeight: '16px',\r\n whiteSpace: 'nowrap',\r\n }\r\n}\r\n\r\n/** Task text: finished entries read as done, the working one as active. */\r\nfunction contentStyle(status: TodoStatus): CSSProperties {\r\n return {\r\n minWidth: 0,\r\n overflowWrap: 'anywhere',\r\n color:\r\n status === 'completed'\r\n ? 'var(--dsw-alias-label-tertiary)'\r\n : status === 'in_progress'\r\n ? 'var(--dsw-alias-label-primary)'\r\n : 'var(--dsw-alias-label-secondary)',\r\n textDecoration: status === 'completed' ? 'line-through' : 'none',\r\n }\r\n}\r\n\r\n/** Centred message block used by every non-list state. */\r\nexport function Notice(props: { title: string; detail?: string }): ReactNode {\r\n return (\r\n <div\r\n style={{\r\n margin: '0 auto',\r\n padding: 24,\r\n maxWidth: 460,\r\n textAlign: 'center',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n lineHeight: 1.7,\r\n fontSize: 12,\r\n }}\r\n >\r\n <div style={{ marginBottom: 6, color: 'var(--dsw-alias-label-secondary)' }}>{props.title}</div>\r\n {props.detail === undefined ? null : <div>{props.detail}</div>}\r\n </div>\r\n )\r\n}\r\n\r\n/** One task row. */\r\nfunction TodoRow(props: { item: TodoItem; t: (key: string) => string }): ReactNode {\r\n const { item, t } = props\r\n return createElement(\r\n 'li',\r\n { style: ROW_STYLE },\r\n createElement('span', { style: pillStyle(item.status) }, t(statusKey(item.status))),\r\n createElement('span', { style: contentStyle(item.status) }, item.content),\r\n )\r\n}\r\n\r\n/**\r\n * The progress section. The subscription is unconditional (a plain listener,\r\n * not IO); the three-state contract of the projection is preserved verbatim.\r\n * @param props - translation, client context, session scope.\r\n */\r\nexport function TodoSection(props: TodoSectionProps): ReactNode {\r\n const { t, ctx, scope } = props\r\n\r\n const todos = useTodos(ctx, scope?.sessionId)\r\n\r\n if (todos === undefined) {\r\n // `undefined` is the store's \"capability absent\": no session, or the host's\r\n // todo unit is unmounted. Say so rather than showing an empty board.\r\n return createElement(\r\n 'div',\r\n { style: SECTION_STYLE, 'data-dsh-brief-sidebar': 'progress-section' },\r\n createElement('div', { style: HEADER_STYLE }, t('section.progress')),\r\n createElement(Notice, { title: t('board.unavailable'), detail: t('board.unavailableHint') }),\r\n )\r\n }\r\n\r\n if (todos.length === 0) {\r\n return createElement(\r\n 'div',\r\n { style: SECTION_STYLE, 'data-dsh-brief-sidebar': 'progress-section' },\r\n createElement('div', { style: HEADER_STYLE }, t('section.progress')),\r\n createElement(Notice, { title: t('board.empty'), detail: t('board.emptyHint') }),\r\n )\r\n }\r\n\r\n const counts = countTodos(todos)\r\n\r\n return createElement(\r\n 'div',\r\n { style: SECTION_STYLE, 'data-dsh-brief-sidebar': 'progress-section' },\r\n createElement('div', { style: HEADER_STYLE }, t('section.progress')),\r\n createElement('div', { style: PROGRESS_STYLE }, progressLine(counts, t)),\r\n createElement(\r\n 'ul',\r\n { style: LIST_STYLE },\r\n todos.map((item, index) => createElement(TodoRow, { key: `${index}:${item.content}`, item, t })),\r\n ),\r\n )\r\n}\r\n\r\n/**\r\n * Backwards-compatible alias for the pre-summary export name. The component\r\n * no longer owns the full-height shell — that moved to `SummaryTab` — so the\r\n * alias exists only to keep import sites honest during the transition.\r\n */\r\nexport const TodoBoardTab = TodoSection\r\n","/**\r\n * The projection keys this plugin contributes to the session-projection\r\n * registry, and their wire views.\r\n *\r\n * The key is namespaced with the plugin name on purpose: the registry refuses\r\n * to share a key across differing `stateVersion`s, so a collision with a\r\n * future host-side deliverables unit would be a hard load error, not a silent\r\n * shadow. The view type is declared structurally (the plugin has no compile\r\n * dependency on `@deepseek-ai/dsh-session-projection`); the registry accepts\r\n * any string key at runtime.\r\n */\r\n\r\n/** The projection key registered by this plugin's host half. */\r\nexport const DELIVERABLES_KEY = 'dshSummaryDeliverables'\r\n\r\n/**\r\n * The second key: which skills this session actually loaded (the host's `skill`\r\n * tool, read off `tool/call.arguments`). Namespaced for the same reason as\r\n * {@link DELIVERABLES_KEY} — the registry hard-fails on a shared key with a\r\n * differing `stateVersion`, so a future host-side skill unit must not be able\r\n * to collide silently.\r\n */\r\nexport const SKILL_USAGE_KEY = 'dshSummarySkillUsage'\r\n\r\n/**\r\n * The search-reference key (queries and returned sources of this session's\r\n * web searches — the plugin's `advanced_search` and the harness's `web_search`).\r\n * Same rule as above: the name is ours, so no other host-side unit can answer\r\n * for it by accident.\r\n */\r\nexport const SEARCH_REFS_KEY = 'dshSummarySearchRefs'\r\n\r\n/** Client view of the produced-file fold (JSON-safe). */\r\nexport interface DeliverablesView {\r\n /** Paths produced in the latest turn, first-seen order (capped). */\r\n readonly latest: {\r\n readonly turn: number\r\n readonly paths: readonly string[]\r\n } | null\r\n /** Distinct produced paths session-wide, most-recent-first (capped). */\r\n readonly sessionPaths: readonly string[]\r\n /** Distinct produced paths session-wide, uncapped — the truthful total. */\r\n readonly sessionTotal: number\r\n}\r\n\r\n/** One loaded skill in the wire view. */\r\nexport interface SkillUsageEntryView {\r\n /** The skill name exactly as the model passed it to the `skill` tool. */\r\n readonly name: string\r\n /** Successful loads of this skill this session. */\r\n readonly count: number\r\n /** Turn whose call last advanced this tally. */\r\n readonly lastTurn: number\r\n}\r\n\r\n/** Client view of the skill-usage fold (JSON-safe). */\r\nexport interface SkillUsageView {\r\n /** Skills referenced in the latest turn; `null` before the first `turn/start`. */\r\n readonly latest: { readonly turn: number; readonly names: readonly string[] } | null\r\n /** Distinct referenced skills, most recently used first (capped). */\r\n readonly session: readonly SkillUsageEntryView[]\r\n /** Distinct referenced skills session-wide — may exceed `session.length`. */\r\n readonly sessionTotal: number\r\n /** Successful references session-wide, both channels included. */\r\n readonly callTotal: number\r\n /**\r\n * The skills this session was OFFERED, per its latest catalog frame (capped).\r\n * Available is not referenced: the model may never use any of these.\r\n */\r\n readonly available: readonly string[]\r\n /** How many entries that frame published — may exceed `available.length`. */\r\n readonly availableCount: number\r\n}\r\n\r\n/** One external source a search brought back (wire view). */\r\nexport interface SearchRefItemView {\r\n /** The URL as published (host case and trailing slash normalised). */\r\n readonly url: string\r\n readonly host: string\r\n readonly title?: string\r\n /** Provider snippet, capped by the fold. */\r\n readonly snippet?: string\r\n /** Every query that surfaced it (newest first) — what the clusters key on. */\r\n readonly queries: readonly string[]\r\n /** Which tool answered: the plugin's `advanced_search` or the host's `web_search`. */\r\n readonly tool: string\r\n /** Settled searches that surfaced this source. */\r\n readonly count: number\r\n readonly lastTurn: number\r\n}\r\n\r\n/** One query the session ran, with how many sources it returned. */\r\nexport interface SearchQueryView {\r\n readonly query: string\r\n /** `advanced_search` (plugin) or `web_search` (harness). */\r\n readonly tool: string\r\n readonly turn: number\r\n readonly hits: number\r\n}\r\n\r\n/** Client view of the search-reference fold (JSON-safe). */\r\nexport interface SearchRefView {\r\n /** Normalised URL keys surfaced in the latest turn; `null` before the first turn. */\r\n readonly latest: { readonly turn: number; readonly urls: readonly string[] } | null\r\n /** Distinct queries, most recent first (capped). */\r\n readonly queries: readonly SearchQueryView[]\r\n /** Distinct sources, most recent first (capped). */\r\n readonly sources: readonly SearchRefItemView[]\r\n /** Distinct queries session-wide — may exceed `queries.length`. */\r\n readonly queryTotal: number\r\n /** Distinct sources session-wide — may exceed `sources.length`. */\r\n readonly sourceTotal: number\r\n}\r\n","/**\r\n * Opening a produced file's preview in the right Sidebar — the same channel\r\n * the conversation flow uses for its produced-file chips and inline mentions\r\n * (ui-chat `openFile` → `ctx.sidebarRight.openResource` with a\r\n * `dsh-resource://file/…` address).\r\n *\r\n * The address grammar is ported verbatim from the harness's browser-safe\r\n * `@deepseek-ai/dsh-util-workspace-path` (`file-address.ts` / `index.ts`),\r\n * because the plugin does not compile against that package: a relative path,\r\n * or an absolute path inside the session's workspace, is addressed under the\r\n * session's scope (`dsh-resource://file/session/<id>/<path>`); an absolute\r\n * path elsewhere keeps its absolute spelling in the same session's address.\r\n * Which tab type claims the address is the Sidebar's decision, not ours.\r\n *\r\n * The `sidebarRight` service is consumed structurally and treated as OPTIONAL:\r\n * where it is absent the section renders plain rows instead of links, the same\r\n * graceful degradation as the deliverables projection itself.\r\n */\r\nimport type { CtxProbe } from './use-projection'\r\n\r\n/** Structural view of the right-Sidebar service this plugin needs. */\r\nexport interface SidebarRightLike {\r\n openResource(url: string, options?: { params?: { line?: number } }): void\r\n}\r\n\r\n/** Structural view of the sessions service slice the opener reads. */\r\ninterface SessionsListLike {\r\n list?: { getSnapshot(): { byId?: Record<string, { cwd?: string }> } }\r\n}\r\n\r\n/** The address scheme every file resource opens with. */\r\nconst FILE_ADDRESS_PREFIX = 'dsh-resource://file/'\r\n\r\n/** Whether a path uses a Windows drive or UNC prefix. */\r\nfunction isWindowsStylePath(value: string): boolean {\r\n return /^[A-Za-z]:[/\\\\]/.test(value) || value.startsWith('\\\\\\\\')\r\n}\r\n\r\n/**\r\n * Whether a path is absolute in either spelling the Host accepts: POSIX (`/a/b`)\r\n * or Windows drive or UNC.\r\n */\r\nexport function isAbsoluteWorkspacePath(path: string): boolean {\r\n return path.startsWith('/') || isWindowsStylePath(path)\r\n}\r\n\r\n/** Component-encode one id or path segment, keeping `:` literal for drive letters. */\r\nfunction encodeSegment(segment: string): string {\r\n return encodeURIComponent(segment).replace(/%3A/gi, ':')\r\n}\r\n\r\n/** Encode a `/`-separated path segment by segment. */\r\nfunction encodePath(path: string): string {\r\n return path.split('/').map(encodeSegment).join('/')\r\n}\r\n\r\n/**\r\n * Build the address of a file read through one Session.\r\n * @param sessionId - the Session whose Host workspace resolves the path.\r\n * @param path - absolute or workspace-relative path; backslashes are normalized\r\n * to `/`, and leading `./` prefixes are dropped.\r\n */\r\nfunction sessionFileAddress(sessionId: string, path: string): string {\r\n const normalized = path.replace(/\\\\/g, '/').replace(/^(?:\\.\\/)+/, '')\r\n return `${FILE_ADDRESS_PREFIX}session/${encodeSegment(sessionId)}/${encodePath(normalized)}`\r\n}\r\n\r\n/**\r\n * The address for a path as a caller holds it.\r\n * @param sessionId - the Session the path is read in.\r\n * @param cwd - that Session's workspace root, when known.\r\n * @param path - absolute or workspace-relative path, in either separator spelling.\r\n */\r\nexport function fileAddressFor(sessionId: string, cwd: string | undefined, path: string): string {\r\n const normalized = path.replace(/\\\\/g, '/')\r\n if (!isAbsoluteWorkspacePath(normalized)) return sessionFileAddress(sessionId, normalized)\r\n const root = cwd === undefined ? '' : cwd.replace(/\\\\/g, '/').replace(/\\/+$/, '')\r\n if (root !== '' && normalized === root) return sessionFileAddress(sessionId, '')\r\n if (root !== '' && normalized.startsWith(`${root}/`)) {\r\n return sessionFileAddress(sessionId, normalized.slice(root.length + 1))\r\n }\r\n return sessionFileAddress(sessionId, normalized)\r\n}\r\n\r\n/**\r\n * Build a sidebar file opener for one session, or `undefined` when the\r\n * environment cannot open previews (no `sidebarRight` service, no session).\r\n * The cwd is re-read per call inside the opener, so a workspace switch between\r\n * renders is picked up on the next click.\r\n *\r\n * @param ctx - the client root context.\r\n * @param sessionId - the session whose workspace resolves paths.\r\n * @returns an opener that routes a produced path to the Sidebar preview.\r\n */\r\nexport function sidebarFileOpener(\r\n ctx: CtxProbe | undefined,\r\n sessionId: string | undefined,\r\n): ((path: string) => void) | undefined {\r\n if (ctx === undefined || sessionId === undefined) return undefined\r\n const bar = ctx.get('sidebarRight') as SidebarRightLike | undefined\r\n if (bar === undefined || typeof bar.openResource !== 'function') return undefined\r\n\r\n return (path: string) => {\r\n const sessions = ctx.get('sessions') as SessionsListLike | undefined\r\n const cwd = sessions?.list?.getSnapshot?.().byId?.[sessionId]?.cwd\r\n bar.openResource(fileAddressFor(sessionId, cwd, path))\r\n }\r\n}\r\n","/**\r\n * The `dshSummaryDeliverables` projection — reading and classifying it.\r\n *\r\n * The Host computes this projection (this plugin's own node half registers the\r\n * unit) and pushes finished whole values; the client never folds it. This\r\n * module is the read side of that contract and is deliberately PURE — no\r\n * React, no context, no IO — so the narrowing and the codeplan classification\r\n * can be tested directly.\r\n */\r\nimport type { DeliverablesView } from '../../projection/keys'\r\n\r\n/**\r\n * Narrow a raw projection value into a deliverables view.\r\n *\r\n * Two outcomes are kept apart on purpose, mirroring the store's contract:\r\n * - `undefined` — the capability is ABSENT (the host half never registered —\r\n * e.g. an older composition — or no frame carried the key yet);\r\n * - a view — the projection is live. A view with `latest: null` and\r\n * `sessionTotal: 0` IS the empty state; the fold starts publishing as soon\r\n * as the unit registers, so \"present but empty\" is a real value here, not a\r\n * sentinel.\r\n *\r\n * @param value - the raw `unknown` snapshot of the deliverables face.\r\n * @returns the validated view, or `undefined` when the capability is absent.\r\n */\r\nexport function readDeliverables(value: unknown): DeliverablesView | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as { latest?: unknown; sessionPaths?: unknown; sessionTotal?: unknown }\r\n if (raw.latest === undefined || raw.sessionPaths === undefined || raw.sessionTotal === undefined) {\r\n return undefined\r\n }\r\n if (!isBucket(raw.latest) || !Array.isArray(raw.sessionPaths) || typeof raw.sessionTotal !== 'number') {\r\n return undefined\r\n }\r\n const paths = raw.sessionPaths.filter((path): path is string => typeof path === 'string')\r\n return {\r\n latest: raw.latest === null ? null : { turn: raw.latest.turn, paths: raw.latest.paths },\r\n sessionPaths: paths,\r\n sessionTotal: raw.sessionTotal,\r\n }\r\n}\r\n\r\n/** Whether a value is a well-formed latest-turn bucket (or explicitly null). */\r\nfunction isBucket(value: unknown): value is { turn: number; paths: readonly string[] } | null {\r\n if (value === null) return true\r\n if (typeof value !== 'object') return false\r\n const bucket = value as { turn?: unknown; paths?: unknown }\r\n return typeof bucket.turn === 'number' && Array.isArray(bucket.paths)\r\n}\r\n\r\n/**\r\n * The path prefix that identifies a codeplan artifact. The codeplan skill\r\n * writes its four fixed artifacts under `$workspace\\.agents\\plans\\<任务名>\\`;\r\n * produced paths may spell the separators either way.\r\n */\r\nconst CODEPLAN_SEGMENT = '.agents/plans/'\r\n\r\n/**\r\n * Normalize path separators so one spelling of the codeplan prefix matches.\r\n * Only classification uses this; the displayed path keeps the tool's exact\r\n * spelling.\r\n */\r\nfunction normalized(path: string): string {\r\n return path.replaceAll('\\\\', '/')\r\n}\r\n\r\n/** Whether a produced path is a codeplan artifact. */\r\nexport function isCodeplanPath(path: string): boolean {\r\n return normalized(path).includes(CODEPLAN_SEGMENT)\r\n}\r\n\r\n/**\r\n * Split a codeplan path into its task name and file name.\r\n *\r\n * @param path - a produced path; need not actually be a codeplan artifact.\r\n * @returns task and file names, or `null` when the path is not under the\r\n * codeplan plans directory (or names no file beneath the task folder).\r\n */\r\nexport function splitCodeplanPath(path: string): { task: string; file: string } | null {\r\n const marker = normalized(path).indexOf(CODEPLAN_SEGMENT)\r\n if (marker < 0) return null\r\n const rest = normalized(path).slice(marker + CODEPLAN_SEGMENT.length)\r\n const slash = rest.indexOf('/')\r\n if (slash <= 0 || slash === rest.length - 1) return null\r\n return { task: rest.slice(0, slash), file: rest.slice(slash + 1) }\r\n}\r\n\r\n/** The final path segment, under either separator. */\r\nexport function basename(path: string): string {\r\n const normalizedPath = normalized(path)\r\n const slash = normalizedPath.lastIndexOf('/')\r\n return slash < 0 ? normalizedPath : normalizedPath.slice(slash + 1)\r\n}\r\n\r\n/**\r\n * 历史文件 = 全会话去重路径 − 本回合活跃路径。\r\n *\r\n * 分隔符归一化后比较(`a\\b` 与 `a/b` 视为同一路径),保持 sessionPaths 自带的\r\n * \"最近在前\"顺序;活跃路径一个都不出现——分层契约:活跃的已在上方列表里,\r\n * 折叠区只收\"更早改过的文件\"。\r\n */\r\nexport function historyPaths(sessionPaths: readonly string[], latestPaths: readonly string[]): string[] {\r\n const active = new Set(latestPaths.map(normalized))\r\n return sessionPaths.filter((path) => !active.has(normalized(path)))\r\n}\r\n","/**\r\n * The two group chrome pieces the summary sections share: a counted group\r\n * title, and the toggle that folds a group away.\r\n *\r\n * Extracted because the deliverables section (本回合 / 更早改动) and the recall\r\n * section (活跃召回 / 其余历史召回) now fold a history group the same way. Two\r\n * private copies of the same button would drift the first time either section\r\n * touches padding — and the whole point of the split is that a reader can tell\r\n * \"what is live now\" from \"what the session also contains\" without learning a\r\n * different layout per section.\r\n *\r\n * Colours come from `--dsw-alias-*` tokens only (skin contract, enforced by\r\n * `tests/purity.spec.ts`).\r\n */\r\nimport { createElement } from 'react'\r\nimport type { CSSProperties, ReactNode } from 'react'\r\n\r\n/** Section-level title under the section header: quieter, same left gutter. */\r\nconst GROUP_HEADER_STYLE: CSSProperties = {\r\n padding: '8px 12px 0',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 11,\r\n fontWeight: 600,\r\n}\r\n\r\n/** The fold switch: full-width hit area, tertiary text, chevron at the end. */\r\nconst TOGGLE_STYLE: CSSProperties = {\r\n background: 'none',\r\n border: 'none',\r\n font: 'inherit',\r\n fontSize: 12,\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n cursor: 'pointer',\r\n display: 'flex',\r\n alignItems: 'center',\r\n gap: 4,\r\n padding: '6px 12px',\r\n textAlign: 'left',\r\n width: 'calc(100% - 24px)',\r\n}\r\n\r\n/** The note beside a folded group (e.g. how many the capped list left out). */\r\nconst CAPTION_STYLE: CSSProperties = {\r\n padding: '0 12px 6px',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 11,\r\n lineHeight: '16px',\r\n}\r\n\r\nconst CHEVRON_STYLE = (open: boolean): CSSProperties => ({\r\n flexShrink: 0,\r\n transition: 'transform 0.16s',\r\n transform: open ? 'rotate(180deg)' : 'none',\r\n})\r\n\r\n/**\r\n * A counted group title. Renders nothing when the group is empty — an empty\r\n * \"活跃召回 · 0\" line would ask the reader to explain a heading rather than read\r\n * a fact.\r\n * @param props - already-interpolated text, plus an optional DOM marker.\r\n */\r\nexport function GroupHeader(props: { text: string; marker?: string }): ReactNode {\r\n if (props.text.length === 0) return null\r\n return createElement(\r\n 'div',\r\n {\r\n style: GROUP_HEADER_STYLE,\r\n 'data-dsh-brief-sidebar': props.marker ?? 'group-header',\r\n },\r\n props.text,\r\n )\r\n}\r\n\r\n/**\r\n * The fold switch. `marker` is what tests (and the browser probe) click, so it\r\n * belongs to the component rather than to either caller's markup.\r\n * @param props - label, current state, DOM marker, click handler.\r\n */\r\nexport function FoldToggle(props: {\r\n label: string\r\n open: boolean\r\n marker: string\r\n onToggle(): void\r\n}): ReactNode {\r\n const { label, open, marker } = props\r\n return createElement(\r\n 'button',\r\n {\r\n type: 'button',\r\n 'aria-expanded': open,\r\n style: TOGGLE_STYLE,\r\n 'data-dsh-brief-sidebar': marker,\r\n onClick: () => { props.onToggle() },\r\n },\r\n label,\r\n createElement(\r\n 'svg',\r\n { width: 10, height: 10, viewBox: '0 0 16 16', 'aria-hidden': true, style: CHEVRON_STYLE(open) },\r\n createElement('path', {\r\n d: 'M4 6l4 4 4-4',\r\n fill: 'none',\r\n stroke: 'currentColor',\r\n strokeWidth: 1.5,\r\n strokeLinecap: 'round',\r\n strokeLinejoin: 'round',\r\n }),\r\n ),\r\n )\r\n}\r\n\r\n/** A quiet caption under a group, used for the \"the list is capped\" note. */\r\nexport function GroupCaption(props: { text: string; marker: string }): ReactNode {\r\n return createElement('div', { style: CAPTION_STYLE, 'data-dsh-brief-sidebar': props.marker }, props.text)\r\n}\r\n","/**\n * Plugin-owned i18n dictionaries.\n *\n * Consumer plugins must NOT reach into better-sidebar's internal `t()` or its\n * `betterSidebar` dictionary namespace, so this plugin registers its own\n * namespace through the DSH `locale` service. `dsh-brief-sidebar` is outside the\n * `LocaleNamespaceMap` merge table, which is exactly what the untyped\n * `register(ns, dicts)` overload is for — but the dictionaries themselves stay\n * strictly paired: `zh` is the key-set source of truth and every other language\n * (`en`, plus the fr/de/it/ru/es/pt pack) is typed as\n * `Record<keyof typeof zh, string>`, so a missing or extra key is a COMPILE\n * error rather than a runtime fallback to the raw key.\n *\n * Every key referenced anywhere in `src/**` must exist in both dictionaries;\n * `tests/purity.spec.ts` asserts that, so a typo in a `t('…')` call cannot\n * ship as an untranslated literal.\n */\n\n/** The namespace owned by this plugin (own vocabulary, own lifecycle). */\nexport const NS = 'dsh-brief-sidebar'\n\n/** Simplified Chinese dictionary — the key-set source of truth. */\nexport const zh = {\n 'tab.title': '概要',\n 'tab.desc': '当前会话的任务、产物与规划文件(只读)',\n 'section.progress': '进展',\n 'section.deliverables': '产物',\n 'board.empty': '当前没有任务',\n 'board.emptyHint': '模型调用 todo_write 之后,任务会出现在这里。',\n 'board.unavailable': '任务暂不可用',\n 'board.unavailableHint': '这个会话还没有收到 todo 数据;宿主推来第一帧后会自动显示。',\n 'status.pending': '待处理',\n 'status.inProgress': '进行中',\n 'status.completed': '已完成',\n 'deliverables.empty': '本回合暂无改动文件',\n 'deliverables.emptyHint': '会话里成功写入或修改文件后,它们会实时出现在这里。',\n 'deliverables.history': '更早改动的文件 · {count}',\n 'deliverables.historyMore': '还有 {count} 条',\n 'deliverables.currentTurn': '本回合改动 · {count}',\n 'deliverables.historyCapped': '(会话共 {total} 个文件,列表已截断)',\n 'deliverable.codeplanTag': '规划',\n 'section.memorySlots': '记忆',\n 'slots.empty': '当前没有激活的记忆槽位',\n 'slots.emptyHint': '当 dsh-prime-memory 激活记忆槽位后,它们会实时出现在这里。',\n 'slots.openCount': '开启 {count} 个槽位',\n 'slots.viewMemory': '查看',\n 'slots.status.open': '生效中',\n 'slots.status.done': '已完成',\n 'slots.status.dropped': '已弃置',\n 'slots.status.expired': '已过期',\n 'section.memoryRecall': '本会话召回',\n 'recall.empty': '本会话还没有召回到记忆',\n 'recall.count': '注入 {count} 条 · 被摘要取代的已折叠(清空会话才清除)',\n 'recall.rateHint': '点选一条后可标注:0–5 相关度;-1 声明过时并退场(可恢复)',\n 'recall.obsolete': '声明过时',\n 'recall.obsoleteConfirm': '确认退场?',\n 'recall.obsoleted': '已判过时',\n 'recall.rated': '已评 {count} 分',\n 'recall.failed': '标注失败:',\n 'recall.obsoleteWhy': '声明过时后,该记忆退场(可恢复),下一轮会告知模型',\n 'recall.viewDetail': '查看详情',\n 'recall.strikeHint': ';判过时的条目会一直保留在列表里并划上删除线(清空会话才移除)',\n 'recall.supersededHidden': '已隐藏 {count} 条被摘要取代的旧召回(正文已不在上下文)',\n 'recall.activeGroup': '活跃召回 · {count}',\n 'recall.historyGroup': '其余历史召回 · {count}',\n 'recall.supersededTag': '已被摘要取代',\n 'recall.noBody': '(本帧没有这条记忆的全文)',\n 'section.skillUsage': '技能引用',\n 'section.references': '引用',\n 'references.tabSkills': '技能',\n 'references.tabMemory': '记忆',\n 'skillUsage.empty': '本会话还没载入过技能',\n 'skillUsage.emptyHint': '模型用 skill 工具载入、或你直接点用某个技能后,技能名会实时出现在这里。',\n 'skillUsage.uses': '{count} 次',\n 'skillUsage.count': '载入 {count} 次 · {total} 个技能',\n 'skillUsage.latestTag': '本轮',\n 'skillUsage.invokedGroup': '已引用 · {count}',\n 'skillUsage.availableGroup': '本会话可用 · {count}',\n 'skillUsage.availableCapped': '(可用清单共 {count} 条,列表已截断)',\n 'section.searchRefs': '搜索引用',\n 'references.tabSearch': '搜索',\n 'references.tabEcho': '回响',\n 'searchRefs.empty': '本会话还没搜索过',\n 'searchRefs.emptyHint': '模型调用 web_search 或 advanced_search 之后,查询与取回的来源会实时出现在这里。',\n 'searchRefs.queryGroup': '查询 · {count}',\n 'searchRefs.sourceGroup': '来源 · {count}',\n 'searchRefs.hits': '返回 {count} 条',\n 'searchRefs.latestTag': '本轮',\n 'searchRefs.noSourcesHint': '(该版本未回传来源清单,升级 dsh-free-search 后可见)',\n 'searchRefs.capped': '(会话共 {total} 条,列表已截断)',\n 'settings.title': '概要侧栏',\n 'settings.desc': '右侧栏概要 tab 的分区开关(只读展示)。',\n 'settings.memorySlots': '记忆槽位分区',\n 'settings.memorySlotsHint': '开启后,概要 tab 在进展与产物之下显示 dsh-prime-memory 的激活记忆槽位(只读)。',\n 'settings.memoryRecall': '本会话召回分区',\n 'settings.memoryRecallHint': '开启后,概要 tab 显示本会话已注入的记忆,并可标注相关度(0–5;-1 声明过时并退场)。被摘要取代的条目会自动折叠。',\n 'settings.spiritEcho': '回响页签',\n 'settings.spiritEchoHint': '开启后,「引用」内保留「回响」页签,列出本会话被 dsh-spirit 召回的回响条目与段落(落库,重启后仍在)。关掉则整个页签不出现。',\n 'settings.unavailable': '配置面不可用,记忆分区按默认「开」处理。',\n 'settings.readonly': '当前配置只读,无法在此修改。',\n 'section.spiritEcho': '回响',\n 'echo.segmentCount': '本会话 {count} 段回响',\n 'echo.stepCount': '本会话 {count} 条回响',\n 'echo.openOriginal': '查看原文',\n 'echo.skippedSummary': '另有 {count} 轮未注入({reasons})',\n 'echo.injectedEmpty': '(无摘要)',\n 'echo.totalHint': '本会话共 {count} 段(跨重启保留)',\n 'echo.latest': '最近:',\n 'echo.lastStep': '上一轮:',\n 'echo.injected': '注入',\n 'echo.skipped': '跳过',\n 'echo.empty': '本会话还没有被召回的回响段',\n 'echo.emptyHint': 'spirit 注入时会带回被勾起的旧片段,这里会列出本会话召回过的段落。',\n 'echo.goto': '条目 →',\n 'echo.gotoGraph': '星图 →',\n 'echo.gotoFail': '打开回响失败',\n 'echo.viewMenu': '查看',\n 'memoryView.button': '详细展示',\n 'memoryView.preview': '速览',\n 'memoryView.entry': '条目',\n 'memoryView.graph2d': '2D 图',\n 'memoryView.graph3d': '3D 图',\n 'memoryView.failAbsent': '记忆库不可用(未安装 dsh-prime-memory)',\n 'memoryView.failDisabled': '记忆库入口已在记忆设置中关闭',\n 'memoryView.failUnmounted': '当前宿主未挂载记忆库整页',\n 'memoryView.failUnregistered': '宿主未注册记忆库页面',\n}\n\n/** The key union: what a `t('…')` call may name inside this namespace. */\nexport type BriefKey = keyof typeof zh\n\n/** English dictionary, checked complete against the zh key set. */\nexport const en: Record<BriefKey, string> = {\n 'tab.title': 'Summary',\n 'tab.desc': 'Tasks, produced files and plan artifacts of this session (read-only)',\n 'section.progress': 'Progress',\n 'section.deliverables': 'Produced files',\n 'board.empty': 'No tasks yet',\n 'board.emptyHint': 'Tasks show up here once the model calls todo_write.',\n 'board.unavailable': 'Tasks unavailable',\n 'board.unavailableHint':\n 'This session has not received any todo data yet; the board fills in on the first frame.',\n 'status.pending': 'Pending',\n 'status.inProgress': 'In progress',\n 'status.completed': 'Done',\n 'deliverables.empty': 'No files changed in this turn',\n 'deliverables.emptyHint': 'Files written or edited successfully in the session appear here live.',\n 'deliverables.history': 'Earlier changes · {count}',\n 'deliverables.historyMore': '{count} more',\n 'deliverables.currentTurn': 'This turn · {count}',\n 'deliverables.historyCapped': '(the session produced {total} files; the list is capped)',\n 'deliverable.codeplanTag': 'Plan',\n 'section.memorySlots': 'Memory',\n 'slots.empty': 'No active memory slots',\n 'slots.emptyHint': 'Slots appear here live once dsh-prime-memory activates them.',\n 'slots.openCount': '{count} slots open',\n 'slots.viewMemory': 'View',\n 'slots.status.open': 'Open',\n 'slots.status.done': 'Done',\n 'slots.status.dropped': 'Dropped',\n 'slots.status.expired': 'Expired',\n 'section.memoryRecall': 'Session recall',\n 'recall.empty': 'No memories recalled in this session yet',\n 'recall.count': '{count} injected · superseded ones folded after compaction (cleared only on /clear)',\n 'recall.rateHint': 'Select a memory to mark it: 0–5 relevance; -1 declares it obsolete and retires it (restorable).',\n 'recall.obsolete': 'Obsolete',\n 'recall.obsoleteConfirm': 'Retire it?',\n 'recall.obsoleted': 'Marked obsolete',\n 'recall.rated': 'Rated {count}/5',\n 'recall.failed': 'Mark failed: ',\n 'recall.obsoleteWhy': 'Declaring it obsolete retires the record (restorable) and tells the model next turn',\n 'recall.viewDetail': 'View',\n 'recall.strikeHint': '; an entry you mark obsolete stays listed, struck through (removed only when you clear the session)',\n 'recall.supersededHidden': '{count} older recalls hidden — their text was replaced by a summary',\n 'recall.activeGroup': 'Active recalls · {count}',\n 'recall.historyGroup': 'Earlier recalls · {count}',\n 'recall.supersededTag': 'replaced by summary',\n 'recall.noBody': '(this frame carries no full body for this record)',\n 'section.skillUsage': 'Skill references',\n 'section.references': 'References',\n 'references.tabSkills': 'Skills',\n 'references.tabMemory': 'Memory',\n 'skillUsage.empty': 'No skills loaded in this session',\n 'skillUsage.emptyHint': 'Skills show up here once the model loads one with the `skill` tool, or you invoke one directly.',\n 'skillUsage.uses': '{count}x',\n 'skillUsage.count': '{count} loads - {total} skills',\n 'skillUsage.latestTag': 'this turn',\n 'skillUsage.invokedGroup': 'Referenced · {count}',\n 'skillUsage.availableGroup': 'Available this session · {count}',\n 'skillUsage.availableCapped': '({count} skills in the catalog; the list is capped)',\n 'section.searchRefs': 'Web searches',\n 'references.tabSearch': 'Searches',\n 'references.tabEcho': 'Echo',\n 'searchRefs.empty': 'No searches in this session',\n 'searchRefs.emptyHint': 'Queries and the sources they returned appear here once the model calls web_search or advanced_search.',\n 'searchRefs.queryGroup': 'Queries · {count}',\n 'searchRefs.sourceGroup': 'Sources · {count}',\n 'searchRefs.hits': '{count} returned',\n 'searchRefs.latestTag': 'This turn',\n 'searchRefs.noSourcesHint': '(this dsh-free-search build returns no source list; upgrade to see sources)',\n 'searchRefs.capped': '({total} in the session; the list is capped)',\n 'settings.title': 'Brief sidebar',\n 'settings.desc': 'Section switches for the summary tab in the right sidebar (read-only views).',\n 'settings.memorySlots': 'Memory slots section',\n 'settings.memorySlotsHint': 'When on, the summary tab lists the active memory slots from dsh-prime-memory beneath progress and produced files (read-only).',\n 'settings.memoryRecall': 'Session recall section',\n 'settings.memoryRecallHint': 'When on, the Summary tab lists the memories injected this session and lets you rate them (0–5; -1 declares one obsolete and retires it). Entries a summary replaced are folded away.',\n 'settings.spiritEcho': 'Echo tab',\n 'settings.spiritEchoHint': 'When on, the reference pane keeps the Echo tab listing the echoed entries and recalled passages of this session (persisted across restarts). Off hides the tab entirely.',\n 'settings.unavailable': 'The config face is unavailable; the memory section falls back to its default (on).',\n 'settings.readonly': 'This config is read-only here; edits are not available.',\n 'section.spiritEcho': 'Echo',\n 'echo.segmentCount': '{count} recalled passages in this session',\n 'echo.stepCount': '{count} echo entries in this session',\n 'echo.openOriginal': 'Open original',\n 'echo.skippedSummary': '{count} rounds injected nothing ({reasons})',\n 'echo.injectedEmpty': '(no summary)',\n 'echo.totalHint': 'Passages in this session: {count} (kept across restarts)',\n 'echo.latest': 'Latest:',\n 'echo.lastStep': 'Last round:',\n 'echo.injected': 'injected',\n 'echo.skipped': 'skipped',\n 'echo.empty': 'No echo passage recalled in this session yet',\n 'echo.emptyHint': 'Passages that dsh-spirit recalled into this session will be listed here.',\n 'echo.goto': 'Entries →',\n 'echo.gotoGraph': 'Star map →',\n 'echo.gotoFail': 'Could not open the echo page',\n 'echo.viewMenu': 'View',\n 'memoryView.button': 'Details',\n 'memoryView.preview': 'Quick view',\n 'memoryView.entry': 'Entries',\n 'memoryView.graph2d': '2D graph',\n 'memoryView.graph3d': '3D graph',\n 'memoryView.failAbsent': 'Memory library unavailable (dsh-prime-memory is not installed)',\n 'memoryView.failDisabled': 'The memory library entry is disabled in memory settings',\n 'memoryView.failUnmounted': 'This host does not mount the memory library page',\n 'memoryView.failUnregistered': 'The host has not registered the memory library page',\n}\n\n/** Japanese dictionary, checked complete against the zh key set. */\nexport const ja: Record<BriefKey, string> = {\n 'tab.title': '概要',\n 'tab.desc': 'このセッションのタスク・成果物・計画ファイル(読み取り専用)',\n 'section.progress': '進行状況',\n 'section.deliverables': '成果物',\n 'board.empty': '現在タスクはありません',\n 'board.emptyHint': 'モデルが todo_write を呼び出すと、タスクがここに表示されます。',\n 'board.unavailable': 'タスクを利用できません',\n 'board.unavailableHint':\n 'このセッションはまだ todo データを受信していません。ホストが最初のフレームを送ると自動的に表示されます。',\n 'status.pending': '未対応',\n 'status.inProgress': '進行中',\n 'status.completed': '完了',\n 'deliverables.empty': 'このターンで変更されたファイルはありません',\n 'deliverables.emptyHint': 'セッションでファイルの書き込み・変更が成功すると、ここにリアルタイムで表示されます。',\n 'deliverables.history': '以前の変更 · {count}',\n 'deliverables.historyMore': 'ほか {count} 件',\n 'deliverables.currentTurn': 'このターン · {count}',\n 'deliverables.historyCapped': '(セッション全体で {total} ファイル、一覧は上限で省略)',\n 'deliverable.codeplanTag': '計画',\n 'section.memorySlots': 'メモリ',\n 'slots.empty': 'アクティブなメモリスロットはありません',\n 'slots.emptyHint': 'dsh-prime-memory がスロットをアクティブにすると、ここにリアルタイムで表示されます。',\n 'slots.openCount': '有効なスロット: {count} 件',\n 'slots.viewMemory': '表示',\n 'slots.status.open': '有効',\n 'slots.status.done': '完了',\n 'slots.status.dropped': '破棄',\n 'slots.status.expired': '期限切れ',\n 'section.memoryRecall': 'このセッションの想起',\n 'recall.empty': 'このセッションではまだ記憶を想起していません',\n 'recall.count': '{count} 件を注入 · 要約に置き換わった分は折りたたみ(/clear でのみ消去)',\n 'recall.rateHint': '行を選ぶと採点できます:0–5 関連度;-1 は「古い」と宣言して退場(復元可)。',\n 'recall.obsolete': '古いと宣言',\n 'recall.obsoleteConfirm': '退場させますか?',\n 'recall.obsoleted': '古いと判定済み',\n 'recall.rated': '{count} 点',\n 'recall.failed': '採点に失敗:',\n 'recall.obsoleteWhy': '古いと宣言すると記録は退場(復元可)、次のターンでモデルに伝わります',\n 'recall.viewDetail': '詳細',\n 'recall.strikeHint': ';古いと宣言した項目は取り消し線のまま一覧に保持されます(セッションをクリアすると消えます)',\n 'recall.supersededHidden': '要約に置き換わった旧召回 {count} 件を非表示(本文はコンテキストにない)',\n 'recall.activeGroup': 'アクティブな想起 · {count}',\n 'recall.historyGroup': 'その他の履歴想起 · {count}',\n 'recall.supersededTag': '要約に置換済み',\n 'recall.noBody': 'このフレームには全文が含まれていない',\n 'section.skillUsage': 'スキル参照',\n 'section.references': '参照',\n 'references.tabSkills': 'スキル',\n 'references.tabMemory': 'メモリ',\n 'skillUsage.empty': 'このセッションではスキルを読み込んでいません',\n 'skillUsage.emptyHint': 'モデルが skill ツールで読み込むか、あなたがスキルを直接起動すると、ここにリアルタイムで表示されます。',\n 'skillUsage.uses': '{count} 回',\n 'skillUsage.count': '読み込み {count} 回 · スキル {total} 件',\n 'skillUsage.latestTag': 'このターン',\n 'skillUsage.invokedGroup': '参照済み · {count}',\n 'skillUsage.availableGroup': 'このセッションで利用可能 · {count}',\n 'skillUsage.availableCapped': '(カタログは全 {count} 件、一覧は上限で省略)',\n 'section.searchRefs': 'Web 検索',\n 'references.tabSearch': '検索',\n 'references.tabEcho': '回響',\n 'searchRefs.empty': 'このセッションではまだ検索していません',\n 'searchRefs.emptyHint': 'モデルが web_search または advanced_search を呼び出すと、クエリと取得した出典がここに表示されます。',\n 'searchRefs.queryGroup': 'クエリ · {count}',\n 'searchRefs.sourceGroup': 'ソース · {count}',\n 'searchRefs.hits': '{count} 件返却',\n 'searchRefs.latestTag': '今回のターン',\n 'searchRefs.noSourcesHint': '(この dsh-free-search ビルドはソース一覧を返しません。アップグレードすると表示されます)',\n 'searchRefs.capped': '(セッション全体で {total} 件、一覧は上限で省略)',\n 'settings.title': '概要サイドバー',\n 'settings.desc': '右サイドバー概要タブのセクション表示切り替え(読み取り専用)。',\n 'settings.memorySlots': 'メモリスロットセクション',\n 'settings.memorySlotsHint': 'オンにすると、概要タブの進行状況と成果物の下に dsh-prime-memory のアクティブなメモリスロット(読み取り専用)が表示されます。',\n 'settings.memoryRecall': 'セッション想起のセクション',\n 'settings.memoryRecallHint': '有効にすると概要タブに本セッションで注入された記憶を表示し、関連度(0–5、-1 は陳腐化を宣言して退場)を付けられます。要約に置き換わった項目は自動で折りたたまれます。',\n 'settings.spiritEcho': '回想タブ',\n 'settings.spiritEchoHint': '有効にすると「引用」内に「回想」タブが残り、本セッションの回想エントリーと想起された断章を並べます(保存され、再起動後も残ります)。',\n 'settings.unavailable': '設定画面を利用できません。メモリセクションは既定(オン)で動作します。',\n 'settings.readonly': 'この設定はここでは読み取り専用のため変更できません。',\n 'section.spiritEcho': '回響',\n 'echo.segmentCount': '本セッション: {count} 件の回想',\n 'echo.stepCount': '本セッション: {count} 件のエコー',\n 'echo.openOriginal': '原文を開く',\n 'echo.skippedSummary': 'ほかに {count} 回は注入なし({reasons})',\n 'echo.injectedEmpty': '(摘要なし)',\n 'echo.totalHint': '本セッション合計 {count} 件(再起動後も保持)',\n 'echo.latest': '最新:',\n 'echo.lastStep': '前回:',\n 'echo.injected': '注入',\n 'echo.skipped': 'スキップ',\n 'echo.empty': 'このセッションで回想された断章はまだありません',\n 'echo.emptyHint': 'dsh-spirit が想起した断章がここに並びます。',\n 'echo.goto': '項目 →',\n 'echo.gotoGraph': '星図 →',\n 'echo.gotoFail': 'エコー画面を開けませんでした',\n 'echo.viewMenu': '表示',\n 'memoryView.button': '詳細表示',\n 'memoryView.preview': 'プレビュー',\n 'memoryView.entry': '項目',\n 'memoryView.graph2d': '2D 図',\n 'memoryView.graph3d': '3D 図',\n 'memoryView.failAbsent': 'メモリライブラリを利用できません(dsh-prime-memory 未インストール)',\n 'memoryView.failDisabled': 'メモリ設定でメモリライブラリ入口が無効です',\n 'memoryView.failUnmounted': 'このホストはメモリライブラリページをマウントしていません',\n 'memoryView.failUnregistered': 'ホストがメモリライブラリページを登録していません',\n}\n\n/** Korean dictionary, checked complete against the zh key set. */\nexport const ko: Record<BriefKey, string> = {\n 'tab.title': '요약',\n 'tab.desc': '현재 세션의 작업, 산출물 및 계획 파일(읽기 전용)',\n 'section.progress': '진행 상황',\n 'section.deliverables': '산출물',\n 'board.empty': '현재 작업이 없습니다',\n 'board.emptyHint': '모델이 todo_write를 호출하면 작업이 여기에 표시됩니다.',\n 'board.unavailable': '작업을 사용할 수 없습니다',\n 'board.unavailableHint':\n '이 세션은 아직 todo 데이터를 받지 못했습니다. 호스트가 첫 프레임을 보내면 자동으로 표시됩니다.',\n 'status.pending': '대기 중',\n 'status.inProgress': '진행 중',\n 'status.completed': '완료',\n 'deliverables.empty': '이번 턴에 변경된 파일이 없습니다',\n 'deliverables.emptyHint': '세션에서 파일을 성공적으로 작성하거나 수정하면 여기에 실시간으로 표시됩니다.',\n 'deliverables.history': '이전 변경 사항 · {count}',\n 'deliverables.historyMore': '외 {count}개',\n 'deliverables.currentTurn': '이번 턴 · {count}',\n 'deliverables.historyCapped': '(세션 전체 {total}개 파일, 목록은 잘림)',\n 'deliverable.codeplanTag': '계획',\n 'section.memorySlots': '메모리',\n 'slots.empty': '활성화된 메모리 슬롯이 없습니다',\n 'slots.emptyHint': 'dsh-prime-memory가 슬롯을 활성화하면 여기에 실시간으로 표시됩니다.',\n 'slots.openCount': '열린 슬롯: {count}개',\n 'slots.viewMemory': '보기',\n 'slots.status.open': '활성',\n 'slots.status.done': '완료',\n 'slots.status.dropped': '폐기',\n 'slots.status.expired': '만료',\n 'section.memoryRecall': '이 세션 회상',\n 'recall.empty': '이 세션에서는 아직 기억을 회상하지 않았습니다',\n 'recall.count': '{count}건 주입 · 요약으로 대체된 항목은 접힘(/clear 시에만 삭제)',\n 'recall.rateHint': '항목을 선택하면 평가할 수 있습니다: 0–5 관련도; -1은 오래된 것으로 선언하여 삭제(복원 가능).',\n 'recall.obsolete': '오래됨 선언',\n 'recall.obsoleteConfirm': '삭제할까요?',\n 'recall.obsoleted': '오래된 것으로 판정됨',\n 'recall.rated': '{count}점 평가됨',\n 'recall.failed': '평가 실패: ',\n 'recall.obsoleteWhy': '낡음으로 선언하면 기록이 퇴장하며(복원 가능), 다음 턴에서 모델에 알립니다',\n 'recall.viewDetail': '상세 보기',\n 'recall.strikeHint': ';낡음으로 선언한 항목은 취소선 상태로 목록에 계속 표시됩니다(세션을 비우면 제거)',\n 'recall.supersededHidden': '요약으로 대체된 이전 회수 {count}건 숨김(본문이 컨텍스트에 없음)',\n 'recall.activeGroup': '활성 회상 · {count}',\n 'recall.historyGroup': '나머지 이전 회상 · {count}',\n 'recall.supersededTag': '요약에 대체됨',\n 'recall.noBody': '이 프레임에는 이 기록의 전문이 없습니다',\n 'section.skillUsage': '스킬 참조',\n 'section.references': '참조',\n 'references.tabSkills': '스킬',\n 'references.tabMemory': '메모리',\n 'skillUsage.empty': '이 세션에서 스킬을 불러오지 않았습니다',\n 'skillUsage.emptyHint': '모델이 skill 도구로 불러오거나 당신이 스킬을 직접 실행하면 여기에 실시간으로 나타납니다.',\n 'skillUsage.uses': '{count}회',\n 'skillUsage.count': '불러오기 {count}회 · 스킬 {total}개',\n 'skillUsage.latestTag': '이 턴',\n 'skillUsage.invokedGroup': '참조됨 · {count}',\n 'skillUsage.availableGroup': '이 세션에서 사용 가능 · {count}',\n 'skillUsage.availableCapped': '(카탈로그 전체 {count}개, 목록은 잘림)',\n 'section.searchRefs': '웹 검색',\n 'references.tabSearch': '검색',\n 'references.tabEcho': '에코',\n 'searchRefs.empty': '이 세션에서는 아직 검색하지 않았습니다',\n 'searchRefs.emptyHint': '모델이 web_search 또는 advanced_search를 호출하면 쿼리와 가져온 출처가 여기에 표시됩니다.',\n 'searchRefs.queryGroup': '쿼리 · {count}',\n 'searchRefs.sourceGroup': '소스 · {count}',\n 'searchRefs.hits': '{count}件 반환',\n 'searchRefs.latestTag': '이번 턴',\n 'searchRefs.noSourcesHint': '(이 dsh-free-search 빌드는 소스 목록을 반환하지 않습니다. 업그레이드 필요)',\n 'searchRefs.capped': '(세션 전체 {total}건, 목록은 잘림)',\n 'settings.title': '요약 사이드바',\n 'settings.desc': '오른쪽 사이드바 요약 탭의 섹션 표시 전환(읽기 전용).',\n 'settings.memorySlots': '메모리 슬롯 섹션',\n 'settings.memorySlotsHint': '켜면 요약 탭의 진행 상황과 산출물 아래에 dsh-prime-memory의 활성 메모리 슬롯(읽기 전용)이 표시됩니다.',\n 'settings.memoryRecall': '세션 회상 섹션',\n 'settings.memoryRecallHint': '켜면 요약 탭에 이번 세션에서 주입된 기억을 표시하고 관련도(0–5, -1은 노후 선언 후 퇴장)를 매길 수 있습니다. 요약으로 대체된 항목은 자동으로 접힙니다.',\n 'settings.spiritEcho': '에코 탭',\n 'settings.spiritEchoHint': '켜면 「참조」 안에 「에코」 탭이 남아 이 세션의 에코 항목과 되살린 구절을 나열합니다(저장되어 재시작 후에도 남습니다).',\n 'settings.unavailable': '설정 화면을 사용할 수 없어 메모리 섹션은 기본값(켜짐)으로 동작합니다.',\n 'settings.readonly': '이 설정은 여기서 읽기 전용이므로 변경할 수 없습니다.',\n 'section.spiritEcho': '에코',\n 'echo.segmentCount': '이 세션: {count}개 회상',\n 'echo.stepCount': '이 세션: {count}건의 에코',\n 'echo.openOriginal': '원문 보기',\n 'echo.skippedSummary': '그 밖에 {count}회는 주입 없음({reasons})',\n 'echo.injectedEmpty': '(요약 없음)',\n 'echo.totalHint': '이 세션 총 {count}개(재시작 후에도 유지)',\n 'echo.latest': '최근:',\n 'echo.lastStep': '지난 회차:',\n 'echo.injected': '주입',\n 'echo.skipped': '건너뜀',\n 'echo.empty': '이 세션에서 회상된 구절이 아직 없습니다',\n 'echo.emptyHint': 'dsh-spirit 이 되살린 구절이 여기에 나열됩니다.',\n 'echo.goto': '항목 →',\n 'echo.gotoGraph': '성도 →',\n 'echo.gotoFail': '에코 화면을 열지 못했습니다',\n 'echo.viewMenu': '보기',\n 'memoryView.button': '상세 보기',\n 'memoryView.preview': '빠른 보기',\n 'memoryView.entry': '항목',\n 'memoryView.graph2d': '2D 그래프',\n 'memoryView.graph3d': '3D 그래프',\n 'memoryView.failAbsent': '메모리 라이브러리를 사용할 수 없습니다(dsh-prime-memory 미설치)',\n 'memoryView.failDisabled': '메모리 설정에서 메모리 라이브러리 입구가 꺼져 있습니다',\n 'memoryView.failUnmounted': '현재 호스트가 메모리 라이브러리 페이지를 마운트하지 않았습니다',\n 'memoryView.failUnregistered': '호스트가 메모리 라이브러리 페이지를 등록하지 않았습니다',\n}\n\n/** French dictionary, checked complete against the zh key set. */\nexport const fr: Record<BriefKey, string> = {\n 'tab.title': 'Résumé',\n 'tab.desc': 'Tâches, fichiers produits et plans de la session (lecture seule)',\n 'section.progress': 'Avancement',\n 'section.deliverables': 'Fichiers produits',\n 'board.empty': 'Aucune tâche pour le moment',\n 'board.emptyHint': 'Les tâches apparaissent ici dès que le modèle appelle todo_write.',\n 'board.unavailable': 'Tâches indisponibles',\n 'board.unavailableHint':\n 'Cette session n’a pas encore reçu de données todo ; le tableau se remplit dès la première trame.',\n 'status.pending': 'En attente',\n 'status.inProgress': 'En cours',\n 'status.completed': 'Terminé',\n 'deliverables.empty': 'Aucun fichier modifié à ce tour',\n 'deliverables.emptyHint': 'Les fichiers écrits ou modifiés dans la session apparaissent ici en direct.',\n 'deliverables.history': 'Modifications antérieures · {count}',\n 'deliverables.historyMore': '{count} de plus',\n 'deliverables.currentTurn': 'Ce tour-ci · {count}',\n 'deliverables.historyCapped': '(la session a produit {total} fichiers ; la liste est tronquée)',\n 'deliverable.codeplanTag': 'Plan',\n 'section.memorySlots': 'Mémoire',\n 'slots.empty': 'Aucun emplacement mémoire actif',\n 'slots.emptyHint': 'Les emplacements apparaissent ici en direct dès que dsh-prime-memory les active.',\n 'slots.openCount': '{count} emplacements ouverts',\n 'slots.viewMemory': 'Voir',\n 'slots.status.open': 'Actif',\n 'slots.status.done': 'Terminé',\n 'slots.status.dropped': 'Abandonné',\n 'slots.status.expired': 'Expiré',\n 'section.memoryRecall': 'Rappel de la session',\n 'recall.empty': 'Aucun souvenir rappelé dans cette session',\n 'recall.count': '{count} injectés · les remplacés par un résumé sont repliés après compression (effacés par /clear)',\n 'recall.rateHint': 'Sélectionnez un souvenir pour le noter : 0–5 pertinence ; -1 le déclare obsolète et le retire (récupérable).',\n 'recall.obsolete': 'Obsolète',\n 'recall.obsoleteConfirm': 'Le retirer ?',\n 'recall.obsoleted': 'Déclaré obsolète',\n 'recall.rated': 'Noté {count}/5',\n 'recall.failed': 'Échec de la note : ',\n 'recall.obsoleteWhy': 'Déclarer obsolète retire l’enregistrement (récupérable) et prévient le modèle au tour suivant',\n 'recall.viewDetail': 'Détails',\n 'recall.strikeHint': ' ; une entrée déclarée obsolète reste listée, barrée (retirée uniquement quand vous videz la session)',\n 'recall.supersededHidden': '{count} anciens rappels masqués — leur texte a été remplacé par un résumé',\n 'recall.activeGroup': 'Rappels actifs · {count}',\n 'recall.historyGroup': 'Rappels antérieurs · {count}',\n 'recall.supersededTag': 'remplacé par le résumé',\n 'recall.noBody': '(aucun texte complet pour cette entrée dans cette trame)',\n 'section.skillUsage': 'Références de compétences',\n 'section.references': 'Références',\n 'references.tabSkills': 'Compétences',\n 'references.tabMemory': 'Mémoire',\n 'skillUsage.empty': 'Aucune compétence chargée dans cette session',\n 'skillUsage.emptyHint': 'Les compétences apparaissent ici dès que le modèle en charge une via l’outil `skill`, ou quand vous en lancez une directement.',\n 'skillUsage.uses': '{count}×',\n 'skillUsage.count': '{count} chargements · {total} compétences',\n 'skillUsage.latestTag': 'ce tour',\n 'skillUsage.invokedGroup': 'Référencées · {count}',\n 'skillUsage.availableGroup': 'Disponibles dans cette session · {count}',\n 'skillUsage.availableCapped': '({count} compétences au catalogue ; la liste est tronquée)',\n 'section.searchRefs': 'Recherches web',\n 'references.tabSearch': 'Recherches',\n 'references.tabEcho': 'Écho',\n 'searchRefs.empty': 'Aucune recherche dans cette session',\n 'searchRefs.emptyHint': 'Les requêtes et les sources obtenues s’affichent ici dès que le modèle appelle web_search ou advanced_search.',\n 'searchRefs.queryGroup': 'Requêtes · {count}',\n 'searchRefs.sourceGroup': 'Sources · {count}',\n 'searchRefs.hits': '{count} renvoyées',\n 'searchRefs.latestTag': 'Ce tour-ci',\n 'searchRefs.noSourcesHint': '(cette version de dsh-free-search ne renvoie pas la liste des sources ; mettez à jour)',\n 'searchRefs.capped': '({total} dans la session ; la liste est tronquée)',\n 'settings.title': 'Barre latérale Résumé',\n 'settings.desc': 'Interrupteurs des sections de l’onglet Résumé de la barre latérale (lecture seule).',\n 'settings.memorySlots': 'Section des emplacements mémoire',\n 'settings.memorySlotsHint': 'Une fois activé, l’onglet Résumé liste les emplacements mémoire actifs de dsh-prime-memory sous l’avancement et les fichiers produits (lecture seule).',\n 'settings.memoryRecall': 'Section rappel de session',\n 'settings.memoryRecallHint': 'Actif, onglet Résumé : liste les souvenirs injectés dans cette session et permet de les noter (0–5 ; -1 déclare obsolète et retire). Les entrées remplacées par un résumé sont repliées.',\n 'settings.spiritEcho': 'Onglet Écho',\n 'settings.spiritEchoHint': \"Actif, le volet Références garde l'onglet Écho listant les entrées d'écho et les passages rappelés de cette session (conservés après redémarrage). Désactivé, l'onglet disparaît.\",\n 'settings.unavailable': 'Le canal de configuration est indisponible ; la section mémoire revient à sa valeur par défaut (activée).',\n 'settings.readonly': 'Cette configuration est en lecture seule ici ; aucune modification possible.',\n 'section.spiritEcho': 'Écho',\n 'echo.segmentCount': 'Cette session : {count} passages rappelés',\n 'echo.stepCount': \"Cette session : {count} entrées d'écho\",\n 'echo.openOriginal': \"Ouvrir l'original\",\n 'echo.skippedSummary': '{count} tours sans injection ({reasons})',\n 'echo.injectedEmpty': '(sans résumé)',\n 'echo.totalHint': 'Passages de cette session : {count} (conservés après redémarrage)',\n 'echo.latest': 'Dernier :',\n 'echo.lastStep': 'Tour précédent :',\n 'echo.injected': 'injecté',\n 'echo.skipped': 'ignoré',\n 'echo.empty': \"Aucun passage d'écho rappelé dans cette session\",\n 'echo.emptyHint': \"Les passages rappelés par dsh-spirit dans cette session s'afficheront ici.\",\n 'echo.goto': 'Entrées →',\n 'echo.gotoGraph': 'Carte stellaire →',\n 'echo.gotoFail': \"Impossible d'ouvrir l'écho\",\n 'echo.viewMenu': \"Voir\",\n 'memoryView.button': 'Détails',\n 'memoryView.preview': 'Aperçu',\n 'memoryView.entry': 'Entrées',\n 'memoryView.graph2d': 'Graphe 2D',\n 'memoryView.graph3d': 'Graphe 3D',\n 'memoryView.failAbsent': \"Bibliothèque mémoire indisponible (dsh-prime-memory n'est pas installé)\",\n 'memoryView.failDisabled': \"L'entrée de la bibliothèque mémoire est désactivée dans les réglages\",\n 'memoryView.failUnmounted': 'Cet hôte ne monte pas la page de la bibliothèque mémoire',\n 'memoryView.failUnregistered': \"L'hôte n'a pas enregistré la page de la bibliothèque mémoire\",\n}\n\n/** German dictionary, checked complete against the zh key set. */\nexport const de: Record<BriefKey, string> = {\n 'tab.title': 'Übersicht',\n 'tab.desc': 'Aufgaben, erzeugte Dateien und Pläne dieser Sitzung (schreibgeschützt)',\n 'section.progress': 'Fortschritt',\n 'section.deliverables': 'Erzeugte Dateien',\n 'board.empty': 'Noch keine Aufgaben',\n 'board.emptyHint': 'Aufgaben erscheinen hier, sobald das Modell todo_write aufruft.',\n 'board.unavailable': 'Aufgaben nicht verfügbar',\n 'board.unavailableHint':\n 'Diese Sitzung hat noch keine Todo-Daten erhalten; das Board füllt sich mit dem ersten Frame.',\n 'status.pending': 'Ausstehend',\n 'status.inProgress': 'In Bearbeitung',\n 'status.completed': 'Fertig',\n 'deliverables.empty': 'Keine Dateien in diesem Durchgang geändert',\n 'deliverables.emptyHint': 'In der Sitzung erfolgreich geschriebene oder geänderte Dateien erscheinen hier live.',\n 'deliverables.history': 'Frühere Änderungen · {count}',\n 'deliverables.historyMore': 'noch {count}',\n 'deliverables.currentTurn': 'Dieser Durchlauf · {count}',\n 'deliverables.historyCapped': '(die Sitzung erzeugte {total} Dateien; die Liste ist gekürzt)',\n 'deliverable.codeplanTag': 'Plan',\n 'section.memorySlots': 'Gedächtnis',\n 'slots.empty': 'Keine aktiven Speicherplätze',\n 'slots.emptyHint': 'Sobald dsh-prime-memory Slots aktiviert, erscheinen sie hier in Echtzeit.',\n 'slots.openCount': '{count} Slots offen',\n 'slots.viewMemory': 'Anzeigen',\n 'slots.status.open': 'Offen',\n 'slots.status.done': 'Erledigt',\n 'slots.status.dropped': 'Verworfen',\n 'slots.status.expired': 'Abgelaufen',\n 'section.memoryRecall': 'Sitzungserinnerung',\n 'recall.empty': 'In dieser Sitzung wurden noch keine Erinnerungen geholt',\n 'recall.count': '{count} eingefügt · die durch eine Zusammenfassung ersetzten sind nach der Komprimierung eingeklappt (bei /clear gelöscht)',\n 'recall.rateHint': 'Ein Eintrag auswählen zum Bewerten: 0–5 Relevanz; -1 erklärt ihn für veraltet und entfernt ihn (wiederherstellbar).',\n 'recall.obsolete': 'Veraltet',\n 'recall.obsoleteConfirm': 'Entfernen?',\n 'recall.obsoleted': 'Als veraltet markiert',\n 'recall.rated': 'Bewertet {count}/5',\n 'recall.failed': 'Bewertung fehlgeschlagen: ',\n 'recall.obsoleteWhy': 'Als veraltet erklären versetzt den Eintrag in den Ruhestand (wiederherstellbar) und informiert das Modell in der nächsten Runde',\n 'recall.viewDetail': 'Details',\n 'recall.strikeHint': '; ein als veraltet markierter Eintrag bleibt durchgestrichen in der Liste (erst beim Leeren der Sitzung entfernt)',\n 'recall.supersededHidden': '{count} ältere Treffer ausgeblendet — ihr Text wurde durch eine Zusammenfassung ersetzt',\n 'recall.activeGroup': 'Aktive Abrufe · {count}',\n 'recall.historyGroup': 'Weitere Abrufe · {count}',\n 'recall.supersededTag': 'durch Zusammenfassung ersetzt',\n 'recall.noBody': '(dieser Rahmen enthält keinen vollständigen Text für diesen Eintrag)',\n 'section.skillUsage': 'Skill-Referenzen',\n 'section.references': 'Referenzen',\n 'references.tabSkills': 'Skills',\n 'references.tabMemory': 'Speicher',\n 'skillUsage.empty': 'In dieser Sitzung wurden keine Skills geladen',\n 'skillUsage.emptyHint': 'Skills erscheinen hier, sobald das Modell einen über das `skill`-Tool lädt oder du einen direkt aufrufst.',\n 'skillUsage.uses': '{count}x',\n 'skillUsage.count': '{count} Ladungen · {total} Skills',\n 'skillUsage.latestTag': 'diese Runde',\n 'skillUsage.invokedGroup': 'Referenziert · {count}',\n 'skillUsage.availableGroup': 'In dieser Sitzung verfügbar · {count}',\n 'skillUsage.availableCapped': '({count} Skills im Katalog; die Liste ist gekürzt)',\n 'section.searchRefs': 'Websuchen',\n 'references.tabSearch': 'Suchen',\n 'references.tabEcho': 'Echo',\n 'searchRefs.empty': 'Keine Suchen in dieser Sitzung',\n 'searchRefs.emptyHint': 'Abfragen und die gelieferten Quellen erscheinen hier, sobald das Modell web_search oder advanced_search aufruft.',\n 'searchRefs.queryGroup': 'Abfragen · {count}',\n 'searchRefs.sourceGroup': 'Quellen · {count}',\n 'searchRefs.hits': '{count} zurückgegeben',\n 'searchRefs.latestTag': 'Dieser Durchlauf',\n 'searchRefs.noSourcesHint': '(dieser dsh-free-search-Build liefert keine Quellenliste; aktualisieren, um Quellen zu sehen)',\n 'searchRefs.capped': '({total} in der Sitzung; die Liste ist gekürzt)',\n 'settings.title': 'Übersicht-Seitenleiste',\n 'settings.desc': 'Schalter für die Abschnitte des Übersicht-Tabs in der rechten Seitenleiste (schreibgeschützt).',\n 'settings.memorySlots': 'Speicherplätze-Abschnitt',\n 'settings.memorySlotsHint': 'Ist der Schalter eingeschaltet, listet der Übersicht-Tab die aktiven Speicherplätze aus dsh-prime-memory unter Fortschritt und erzeugten Dateien auf (schreibgeschützt).',\n 'settings.memoryRecall': 'Bereich Sitzungserinnerung',\n 'settings.memoryRecallHint': 'Aktiv: Der Tab „Zusammenfassung“ listet die in dieser Sitzung eingefügten Erinnerungen und erlaubt Bewertungen (0–5; -1 erklärt für veraltet und entfernt). Durch eine Zusammenfassung ersetzte Einträge werden eingeklappt.',\n 'settings.spiritEcho': 'Echo-Tab',\n 'settings.spiritEchoHint': 'Aktiv bleibt im Bereich „Referenzen“ der Echo-Tab erhalten: Er listet die Echo-Einträge und erinnerten Passagen dieser Sitzung (bleiben nach Neustart). Aus: Tab verschwindet.',\n 'settings.unavailable': 'Die Konfigurationsoberfläche ist nicht verfügbar; der Gedächtnis-Abschnitt fällt auf den Standard (ein) zurück.',\n 'settings.readonly': 'Diese Konfiguration ist hier schreibgeschützt; Änderungen sind nicht möglich.',\n 'section.spiritEcho': 'Echo',\n 'echo.segmentCount': 'Diese Sitzung: {count} erinnerte Passagen',\n 'echo.stepCount': 'Diese Sitzung: {count} Echo-Einträge',\n 'echo.openOriginal': 'Original öffnen',\n 'echo.skippedSummary': '{count} Runden ohne Injektion ({reasons})',\n 'echo.injectedEmpty': '(keine Zusammenfassung)',\n 'echo.totalHint': 'Passagen dieser Sitzung: {count} (bleiben nach Neustart)',\n 'echo.latest': 'Zuletzt:',\n 'echo.lastStep': 'Letzte Runde:',\n 'echo.injected': 'injiziert',\n 'echo.skipped': 'übersprungen',\n 'echo.empty': 'Noch keine Echo-Passage in dieser Sitzung erinnert',\n 'echo.emptyHint': 'Was dsh-spirit in dieser Sitzung erinnert, erscheint hier.',\n 'echo.goto': 'Einträge →',\n 'echo.gotoGraph': 'Sternkarte →',\n 'echo.gotoFail': 'Echo-Seite konnte nicht geöffnet werden',\n 'echo.viewMenu': 'Ansehen',\n 'memoryView.button': 'Details',\n 'memoryView.preview': 'Vorschau',\n 'memoryView.entry': 'Einträge',\n 'memoryView.graph2d': '2D-Graph',\n 'memoryView.graph3d': '3D-Graph',\n 'memoryView.failAbsent': 'Speicherbibliothek nicht verfügbar (dsh-prime-memory ist nicht installiert)',\n 'memoryView.failDisabled': 'Der Eintrag der Speicherbibliothek ist in den Speichereinstellungen deaktiviert',\n 'memoryView.failUnmounted': 'Dieser Host bindet die Speicherbibliothek-Seite nicht ein',\n 'memoryView.failUnregistered': 'Der Host hat die Speicherbibliothek-Seite nicht registriert',\n}\n\n/** Italian dictionary, checked complete against the zh key set. */\nexport const it: Record<BriefKey, string> = {\n 'tab.title': 'Riepilogo',\n 'tab.desc': 'Attività, file prodotti e piani di questa sessione (sola lettura)',\n 'section.progress': 'Avanzamento',\n 'section.deliverables': 'File prodotti',\n 'board.empty': 'Nessuna attività per ora',\n 'board.emptyHint': 'Le attività appaiono qui quando il modello chiama todo_write.',\n 'board.unavailable': 'Attività non disponibili',\n 'board.unavailableHint':\n 'Questa sessione non ha ancora ricevuto dati todo; la bacheca si riempirà al primo frame.',\n 'status.pending': 'In attesa',\n 'status.inProgress': 'In corso',\n 'status.completed': 'Completato',\n 'deliverables.empty': 'Nessun file modificato in questo turno',\n 'deliverables.emptyHint': 'I file scritti o modificati nella sessione appaiono qui in tempo reale.',\n 'deliverables.history': 'Modifiche precedenti · {count}',\n 'deliverables.historyMore': 'altri {count}',\n 'deliverables.currentTurn': 'Questo turno · {count}',\n 'deliverables.historyCapped': '(la sessione ha prodotto {total} file; l’elenco è troncato)',\n 'deliverable.codeplanTag': 'Piano',\n 'section.memorySlots': 'Memoria',\n 'slots.empty': 'Nessuno slot di memoria attivo',\n 'slots.emptyHint': 'Gli slot appaiono qui in tempo reale quando dsh-prime-memory li attiva.',\n 'slots.openCount': '{count} slot aperti',\n 'slots.viewMemory': 'Vedi',\n 'slots.status.open': 'Attivo',\n 'slots.status.done': 'Completato',\n 'slots.status.dropped': 'Scartato',\n 'slots.status.expired': 'Scaduto',\n 'section.memoryRecall': 'Richiamo della sessione',\n 'recall.empty': 'Nessun ricordo richiamato in questa sessione',\n 'recall.count': '{count} inseriti · quelli sostituiti da un riassunto sono ripiegati dopo la compressione (rimossi con /clear)',\n 'recall.rateHint': 'Seleziona un ricordo per valutarlo: 0–5 pertinenza; -1 lo dichiara obsoleto e lo ritira (ripristinabile).',\n 'recall.obsolete': 'Obsoleto',\n 'recall.obsoleteConfirm': 'Ritirarlo?',\n 'recall.obsoleted': 'Dichiarato obsoleto',\n 'recall.rated': 'Valutato {count}/5',\n 'recall.failed': 'Valutazione non riuscita: ',\n 'recall.obsoleteWhy': 'Dichiararlo obsoleto congeda il record (ripristinabile) e avvisa il modello al turno successivo',\n 'recall.viewDetail': 'Dettagli',\n 'recall.strikeHint': '; una voce dichiarata obsoleta resta elencata, barrata (rimossa solo svuotando la sessione)',\n 'recall.supersededHidden': '{count} vecchi richiami nascosti — il testo è stato sostituito da un riassunto',\n 'recall.activeGroup': 'Richiami attivi · {count}',\n 'recall.historyGroup': 'Richiami precedenti · {count}',\n 'recall.supersededTag': 'sostituito dal riassunto',\n 'recall.noBody': '(questo frame non contiene il testo completo di questa voce)',\n 'section.skillUsage': 'Riferimenti alle skill',\n 'section.references': 'Riferimenti',\n 'references.tabSkills': 'Skill',\n 'references.tabMemory': 'Memoria',\n 'skillUsage.empty': 'Nessuna skill caricata in questa sessione',\n 'skillUsage.emptyHint': 'Le skill compaiono qui quando il modello ne carica una con il tool `skill` o quando ne avvii una direttamente.',\n 'skillUsage.uses': '{count}x',\n 'skillUsage.count': '{count} caricamenti · {total} skill',\n 'skillUsage.latestTag': 'questo giro',\n 'skillUsage.invokedGroup': 'Referenziate · {count}',\n 'skillUsage.availableGroup': 'Disponibili in questa sessione · {count}',\n 'skillUsage.availableCapped': '({count} skill nel catalogo; l’elenco è troncato)',\n 'section.searchRefs': 'Ricerche web',\n 'references.tabSearch': 'Ricerche',\n 'references.tabEcho': 'Eco',\n 'searchRefs.empty': 'Nessuna ricerca in questa sessione',\n 'searchRefs.emptyHint': 'Le query e le fonti ottenute compaiono qui quando il modello chiama web_search o advanced_search.',\n 'searchRefs.queryGroup': 'Query · {count}',\n 'searchRefs.sourceGroup': 'Fonti · {count}',\n 'searchRefs.hits': '{count} restituite',\n 'searchRefs.latestTag': 'Questo turno',\n 'searchRefs.noSourcesHint': '(questa build di dsh-free-search non restituisce l’elenco delle fonti; aggiorna per vederlo)',\n 'searchRefs.capped': '({total} nella sessione; l’elenco è troncato)',\n 'settings.title': 'Barra laterale Riepilogo',\n 'settings.desc': 'Interruttori delle sezioni della scheda Riepilogo nella barra laterale destra (sola lettura).',\n 'settings.memorySlots': 'Sezione slot di memoria',\n 'settings.memorySlotsHint': 'Quando attivo, la scheda Riepilogo elenca gli slot di memoria attivi di dsh-prime-memory sotto avanzamento e file prodotti (sola lettura).',\n 'settings.memoryRecall': 'Sezione richiamo sessione',\n 'settings.memoryRecallHint': 'Attivo: la scheda Riepilogo elenca i ricordi inseriti in questa sessione e consente di valutarli (0–5; -1 dichiara obsoleto e ritira). Le voci sostituite da un riassunto vengono ripiegate.',\n 'settings.spiritEcho': 'Scheda Eco',\n 'settings.spiritEchoHint': 'Attivo: nel pannello Riferimenti resta la scheda Eco con le voci di eco e i passaggi richiamati di questa sessione (conservati dopo il riavvio). Disattivo: la scheda sparisce.',\n 'settings.unavailable': 'La superficie di configurazione non è disponibile; la sezione memoria torna al valore predefinito (attivo).',\n 'settings.readonly': 'Questa configurazione è in sola lettura qui; non è possibile modificarla.',\n 'section.spiritEcho': 'Eco',\n 'echo.segmentCount': 'Questa sessione: {count} passaggi richiamati',\n 'echo.stepCount': 'Questa sessione: {count} voci di eco',\n 'echo.openOriginal': 'Apri originale',\n 'echo.skippedSummary': '{count} turni senza iniezione ({reasons})',\n 'echo.injectedEmpty': '(nessun riepilogo)',\n 'echo.totalHint': 'Passaggi di questa sessione: {count} (conservati dopo il riavvio)',\n 'echo.latest': 'Ultimo:',\n 'echo.lastStep': 'Turno precedente:',\n 'echo.injected': 'iniettato',\n 'echo.skipped': 'saltato',\n 'echo.empty': 'Nessun passaggio di eco richiamato in questa sessione',\n 'echo.emptyHint': 'I passaggi richiamati da dsh-spirit in questa sessione appariranno qui.',\n 'echo.goto': 'Voci →',\n 'echo.gotoGraph': 'Mappa stellare →',\n 'echo.gotoFail': \"Impossibile aprire l'eco\",\n 'echo.viewMenu': \"Apri\",\n 'memoryView.button': 'Dettagli',\n 'memoryView.preview': 'Anteprima',\n 'memoryView.entry': 'Voci',\n 'memoryView.graph2d': 'Grafo 2D',\n 'memoryView.graph3d': 'Grafo 3D',\n 'memoryView.failAbsent': 'Libreria memorie non disponibile (dsh-prime-memory non è installato)',\n 'memoryView.failDisabled': \"L'ingresso della libreria memorie è disattivato nelle impostazioni\",\n 'memoryView.failUnmounted': 'Questo host non monta la pagina della libreria memorie',\n 'memoryView.failUnregistered': \"L'host non ha registrato la pagina della libreria memorie\",\n}\n\n/** Russian dictionary, checked complete against the zh key set. */\nexport const ru: Record<BriefKey, string> = {\n 'tab.title': 'Сводка',\n 'tab.desc': 'Задачи, созданные файлы и планы этой сессии (только чтение)',\n 'section.progress': 'Ход работы',\n 'section.deliverables': 'Созданные файлы',\n 'board.empty': 'Задач пока нет',\n 'board.emptyHint': 'Задачи появятся здесь, когда модель вызовет todo_write.',\n 'board.unavailable': 'Задачи недоступны',\n 'board.unavailableHint':\n 'Эта сессия ещё не получила данные todo; доска заполнится после первого кадра.',\n 'status.pending': 'Ожидает',\n 'status.inProgress': 'В работе',\n 'status.completed': 'Готово',\n 'deliverables.empty': 'За этот ход файлы не менялись',\n 'deliverables.emptyHint': 'Успешно записанные или изменённые файлы появляются здесь в реальном времени.',\n 'deliverables.history': 'Более ранние изменения · {count}',\n 'deliverables.historyMore': 'ещё {count}',\n 'deliverables.currentTurn': 'Этот ход · {count}',\n 'deliverables.historyCapped': '(в сессии всего {total} файлов; список усечён)',\n 'deliverable.codeplanTag': 'План',\n 'section.memorySlots': 'Память',\n 'slots.empty': 'Активных слотов памяти нет',\n 'slots.emptyHint': 'Как только dsh-prime-memory активирует слоты, они появляются здесь в реальном времени.',\n 'slots.openCount': 'Открытых слотов: {count}',\n 'slots.viewMemory': 'Просмотр',\n 'slots.status.open': 'Активен',\n 'slots.status.done': 'Завершён',\n 'slots.status.dropped': 'Отброшен',\n 'slots.status.expired': 'Истёк',\n 'section.memoryRecall': 'Воспоминания сессии',\n 'recall.empty': 'В этой сессии воспоминания ещё не вызывались',\n 'recall.count': 'Вставлено {count} · заменённые кратким изложением свёрнуты после сжатия (удаляются при /clear)',\n 'recall.rateHint': 'Выберите запись, чтобы оценить: 0–5 релевантность; -1 объявляет её устаревшей и убирает (восстановимо).',\n 'recall.obsolete': 'Устарело',\n 'recall.obsoleteConfirm': 'Убрать?',\n 'recall.obsoleted': 'Объявлено устаревшим',\n 'recall.rated': 'Оценка {count}/5',\n 'recall.failed': 'Ошибка оценки: ',\n 'recall.obsoleteWhy': 'Объявить устаревшим значит снимает запись восстанавлимо и сообщает модель на следующем ходе',\n 'recall.viewDetail': 'Подробнее',\n 'recall.strikeHint': '; помеченная как устаревшая запись остаётся в списке, зачёркнутой (удаляется только при очистке сессии)',\n 'recall.supersededHidden': 'Скрыто старых воспоминаний: {count} — их текст заменён кратким изложением',\n 'recall.activeGroup': 'Активные вызовы · {count}',\n 'recall.historyGroup': 'Прочие прежние вызовы · {count}',\n 'recall.supersededTag': 'заменено сводкой',\n 'recall.noBody': 'В этом кадре нет полного текста этой записи',\n 'section.skillUsage': 'Отсылки к скиллам',\n 'section.references': 'Отсылки',\n 'references.tabSkills': 'Навыки',\n 'references.tabMemory': 'Память',\n 'skillUsage.empty': 'В этой сессии скиллы не загружались',\n 'skillUsage.emptyHint': 'Навыки появятся здесь, когда модель загрузит их через инструмент `skill` или вы вызовете навык напрямую.',\n 'skillUsage.uses': '{count} раз',\n 'skillUsage.count': 'Загрузок: {count} · скиллов: {total}',\n 'skillUsage.latestTag': 'этот ход',\n 'skillUsage.invokedGroup': 'Использованы · {count}',\n 'skillUsage.availableGroup': 'Доступны в этой сессии · {count}',\n 'skillUsage.availableCapped': '({count} навыков в каталоге; список усечён)',\n 'section.searchRefs': 'Поиск в сети',\n 'references.tabSearch': 'Поиск',\n 'references.tabEcho': 'Эхо',\n 'searchRefs.empty': 'В этой сессии ещё не было поиска',\n 'searchRefs.emptyHint': 'Запросы и полученные источники появятся здесь, когда модель вызовет web_search или advanced_search.',\n 'searchRefs.queryGroup': 'Запросы · {count}',\n 'searchRefs.sourceGroup': 'Источники · {count}',\n 'searchRefs.hits': 'возвращено {count}',\n 'searchRefs.latestTag': 'Этот ход',\n 'searchRefs.noSourcesHint': '(эта сборка dsh-free-search не возвращает список источников; обновите, чтобы видеть их)',\n 'searchRefs.capped': '(в сессии всего {total}; список усечён)',\n 'settings.title': 'Боковая панель «Сводка»',\n 'settings.desc': 'Переключатели разделов вкладки «Сводка» на правой панели (только чтение).',\n 'settings.memorySlots': 'Раздел слотов памяти',\n 'settings.memorySlotsHint': 'Когда включено, вкладка «Сводка» показывает активные слоты памяти из dsh-prime-memory под ходом работы и созданными файлами (только чтение).',\n 'settings.memoryRecall': 'Раздел Воспоминания сессии',\n 'settings.memoryRecallHint': 'Включено: вкладка «Сводка» показывает вставленные в этой сессии воспоминания и позволяет оценить их (0–5; -1 объявляет устаревшим и выводит из обращения). Заменённые кратким изложением записи сворачиваются.',\n 'settings.spiritEcho': 'Вкладка «Эхо»',\n 'settings.spiritEchoHint': 'Включено: в «Ссылках» остаётся вкладка «Эхо» со списком эхо-записей и припомненных отрывков этой сессии (сохраняются после перезапуска). Выключено — вкладка скрыта.',\n 'settings.unavailable': 'Панель конфигурации недоступна; раздел памяти работает по умолчанию (включён).',\n 'settings.readonly': 'Эта конфигурация здесь только для чтения; изменить её нельзя.',\n 'section.spiritEcho': 'Эхо',\n 'echo.segmentCount': 'Эта сессия: {count} припомненных отрывков',\n 'echo.stepCount': 'Эта сессия: {count} записей эха',\n 'echo.openOriginal': 'Открыть оригинал',\n 'echo.skippedSummary': 'Ещё {count} раундов без внедрения ({reasons})',\n 'echo.injectedEmpty': '(без сводки)',\n 'echo.totalHint': 'Отрывки этой сессии: {count} (сохраняются после перезапуска)',\n 'echo.latest': 'Последнее:',\n 'echo.lastStep': 'Прошлый раунд:',\n 'echo.injected': 'внедрено',\n 'echo.skipped': 'пропущено',\n 'echo.empty': 'В этой сессии пока не припомнено ни одного отрывка',\n 'echo.emptyHint': 'Здесь появятся отрывки, которые dsh-spirit припомнил в этой сессии.',\n 'echo.goto': 'Записи →',\n 'echo.gotoGraph': 'Звёздная карта →',\n 'echo.gotoFail': 'Не удалось открыть эхо',\n 'echo.viewMenu': 'Открыть',\n 'memoryView.button': 'Подробно',\n 'memoryView.preview': 'Просмотр',\n 'memoryView.entry': 'Записи',\n 'memoryView.graph2d': 'Граф 2D',\n 'memoryView.graph3d': 'Граф 3D',\n 'memoryView.failAbsent': 'Библиотека памяти недоступна (dsh-prime-memory не установлен)',\n 'memoryView.failDisabled': 'Вход в библиотеку памяти отключён в настройках памяти',\n 'memoryView.failUnmounted': 'Этот хост не монтирует страницу библиотеки памяти',\n 'memoryView.failUnregistered': 'Хост не зарегистрировал страницу библиотеки памяти',\n}\n\n/** Spanish dictionary, checked complete against the zh key set. */\nexport const es: Record<BriefKey, string> = {\n 'tab.title': 'Resumen',\n 'tab.desc': 'Tareas, archivos generados y planes de esta sesión (solo lectura)',\n 'section.progress': 'Avance',\n 'section.deliverables': 'Archivos generados',\n 'board.empty': 'Aún no hay tareas',\n 'board.emptyHint': 'Las tareas aparecen aquí cuando el modelo llama a todo_write.',\n 'board.unavailable': 'Tareas no disponibles',\n 'board.unavailableHint':\n 'Esta sesión aún no ha recibido datos de tareas; el tablero se llena con el primer fotograma.',\n 'status.pending': 'Pendiente',\n 'status.inProgress': 'En curso',\n 'status.completed': 'Hecho',\n 'deliverables.empty': 'Ningún archivo modificado en este turno',\n 'deliverables.emptyHint': 'Los archivos escritos o editados en la sesión aparecen aquí en directo.',\n 'deliverables.history': 'Cambios anteriores · {count}',\n 'deliverables.historyMore': '{count} más',\n 'deliverables.currentTurn': 'Este turno · {count}',\n 'deliverables.historyCapped': '(la sesión produjo {total} archivos; la lista está truncada)',\n 'deliverable.codeplanTag': 'Plan',\n 'section.memorySlots': 'Memoria',\n 'slots.empty': 'No hay ranuras de memoria activas',\n 'slots.emptyHint': 'Las ranuras aparecen aquí en directo en cuanto dsh-prime-memory las active.',\n 'slots.openCount': '{count} ranuras abiertas',\n 'slots.viewMemory': 'Ver',\n 'slots.status.open': 'Activa',\n 'slots.status.done': 'Hecha',\n 'slots.status.dropped': 'Descartada',\n 'slots.status.expired': 'Caducada',\n 'section.memoryRecall': 'Recuerdo de la sesión',\n 'recall.empty': 'Aún no se ha recuperado ningún recuerdo en esta sesión',\n 'recall.count': '{count} insertados · los reemplazados por un resumen se pliegan tras comprimir (se borran con /clear)',\n 'recall.rateHint': 'Selecciona un recuerdo para puntuarlo: 0–5 relevancia; -1 lo declara obsoleto y lo retira (recuperable).',\n 'recall.obsolete': 'Obsoleto',\n 'recall.obsoleteConfirm': '¿Retirarlo?',\n 'recall.obsoleted': 'Declarado obsoleto',\n 'recall.rated': 'Puntuado {count}/5',\n 'recall.failed': 'Error al puntuar: ',\n 'recall.obsoleteWhy': 'Declararlo obsoleto retira el registro (recuperable) y avisa al modelo en el turno siguiente',\n 'recall.viewDetail': 'Detalles',\n 'recall.strikeHint': '; una entrada marcada como obsoleta sigue en la lista, tachada (se retira solo al vaciar la sesión)',\n 'recall.supersededHidden': '{count} recuerdos antiguos ocultos — su texto fue reemplazado por un resumen',\n 'recall.activeGroup': 'Recuerdos activos · {count}',\n 'recall.historyGroup': 'Recuerdos anteriores · {count}',\n 'recall.supersededTag': 'reemplazado por el resumen',\n 'recall.noBody': '(este fotograma no trae el texto completo de este registro)',\n 'section.skillUsage': 'Referencias de skills',\n 'section.references': 'Referencias',\n 'references.tabSkills': 'Skills',\n 'references.tabMemory': 'Memoria',\n 'skillUsage.empty': 'Esta sesión no ha cargado ningún skill',\n 'skillUsage.emptyHint': 'Las skills aparecen aquí cuando el modelo carga una con la herramienta `skill` o cuando invocas una directamente.',\n 'skillUsage.uses': '{count}x',\n 'skillUsage.count': '{count} cargas · {total} skills',\n 'skillUsage.latestTag': 'este turno',\n 'skillUsage.invokedGroup': 'Referenciadas · {count}',\n 'skillUsage.availableGroup': 'Disponibles en esta sesión · {count}',\n 'skillUsage.availableCapped': '({count} skills en el catálogo; la lista está truncada)',\n 'section.searchRefs': 'Búsquedas web',\n 'references.tabSearch': 'Búsquedas',\n 'references.tabEcho': 'Eco',\n 'searchRefs.empty': 'Sin búsquedas en esta sesión',\n 'searchRefs.emptyHint': 'Las consultas y las fuentes obtenidas aparecen aquí cuando el modelo llama a web_search o advanced_search.',\n 'searchRefs.queryGroup': 'Consultas · {count}',\n 'searchRefs.sourceGroup': 'Fuentes · {count}',\n 'searchRefs.hits': '{count} devueltas',\n 'searchRefs.latestTag': 'Este turno',\n 'searchRefs.noSourcesHint': '(esta versión de dsh-free-search no devuelve la lista de fuentes; actualiza para verla)',\n 'searchRefs.capped': '({total} en la sesión; la lista está truncada)',\n 'settings.title': 'Barra lateral Resumen',\n 'settings.desc': 'Interruptores de las secciones de la pestaña Resumen en la barra lateral derecha (solo lectura).',\n 'settings.memorySlots': 'Sección de ranuras de memoria',\n 'settings.memorySlotsHint': 'Al activarla, la pestaña Resumen enumera las ranuras de memoria activas de dsh-prime-memory bajo el avance y los archivos generados (solo lectura).',\n 'settings.memoryRecall': 'Sección de recuerdo de sesión',\n 'settings.memoryRecallHint': 'Activado: la pestaña Resumen lista los recuerdos inyectados en esta sesión y permite puntuarlos (0–5; -1 declara obsoleto y retira). Las entradas reemplazadas por un resumen se pliegan.',\n 'settings.spiritEcho': 'Pestaña Eco',\n 'settings.spiritEchoHint': 'Activado: el panel Referencias conserva la pestaña Eco con las entradas de eco y los pasajes recordados de esta sesión (se conservan tras reiniciar). Desactivado, la pestaña desaparece.',\n 'settings.unavailable': 'La superficie de configuración no está disponible; la sección de memoria vuelve a su valor por defecto (activada).',\n 'settings.readonly': 'Esta configuración es de solo lectura aquí; no se puede modificar.',\n 'section.spiritEcho': 'Eco',\n 'echo.segmentCount': 'Esta sesión: {count} pasajes recordados',\n 'echo.stepCount': 'Esta sesión: {count} entradas de eco',\n 'echo.openOriginal': 'Abrir original',\n 'echo.skippedSummary': '{count} rondas sin inyección ({reasons})',\n 'echo.injectedEmpty': '(sin resumen)',\n 'echo.totalHint': 'Pasajes de esta sesión: {count} (se conservan tras reiniciar)',\n 'echo.latest': 'Último:',\n 'echo.lastStep': 'Ronda anterior:',\n 'echo.injected': 'inyectado',\n 'echo.skipped': 'omitido',\n 'echo.empty': 'Aún no hay pasajes de eco recordados en esta sesión',\n 'echo.emptyHint': 'Aquí aparecerán los pasajes que dsh-spirit recuerde en esta sesión.',\n 'echo.goto': 'Entradas →',\n 'echo.gotoGraph': 'Mapa estelar →',\n 'echo.gotoFail': 'No se pudo abrir el eco',\n 'echo.viewMenu': 'Ver',\n 'memoryView.button': 'Detalles',\n 'memoryView.preview': 'Vista rápida',\n 'memoryView.entry': 'Entradas',\n 'memoryView.graph2d': 'Grafo 2D',\n 'memoryView.graph3d': 'Grafo 3D',\n 'memoryView.failAbsent': 'Biblioteca de memoria no disponible (dsh-prime-memory no está instalado)',\n 'memoryView.failDisabled': 'La entrada de la biblioteca de memoria está desactivada en los ajustes',\n 'memoryView.failUnmounted': 'Este host no monta la página de la biblioteca de memoria',\n 'memoryView.failUnregistered': 'El host no ha registrado la página de la biblioteca de memoria',\n}\n\n/** Brazilian Portuguese dictionary, checked complete against the zh key set. */\nexport const pt: Record<BriefKey, string> = {\n 'tab.title': 'Resumo',\n 'tab.desc': 'Tarefas, arquivos produzidos e artefatos de planejamento desta sessão (somente leitura)',\n 'section.progress': 'Progresso',\n 'section.deliverables': 'Arquivos produzidos',\n 'board.empty': 'Nenhuma tarefa ainda',\n 'board.emptyHint': 'As tarefas aparecem aqui quando o modelo chama todo_write.',\n 'board.unavailable': 'Tarefas indisponíveis',\n 'board.unavailableHint':\n 'Esta sessão ainda não recebeu dados de todo; o painel se preenche no primeiro quadro.',\n 'status.pending': 'Pendente',\n 'status.inProgress': 'Em andamento',\n 'status.completed': 'Concluída',\n 'deliverables.empty': 'Nenhum arquivo alterado neste turno',\n 'deliverables.emptyHint': 'Arquivos gravados ou editados com sucesso na sessão aparecem aqui em tempo real.',\n 'deliverables.history': 'Alterações anteriores · {count}',\n 'deliverables.historyMore': 'Mais {count}',\n 'deliverables.currentTurn': 'Este turno · {count}',\n 'deliverables.historyCapped': '(a sessão produziu {total} arquivos; a lista está truncada)',\n 'deliverable.codeplanTag': 'Planejamento',\n 'section.memorySlots': 'Memória',\n 'slots.empty': 'Nenhum slot de memória ativo',\n 'slots.emptyHint': 'Os slots aparecem aqui em tempo real quando o dsh-prime-memory os ativa.',\n 'slots.openCount': '{count} slots abertos',\n 'slots.viewMemory': 'Ver',\n 'slots.status.open': 'Ativo',\n 'slots.status.done': 'Concluído',\n 'slots.status.dropped': 'Descartado',\n 'slots.status.expired': 'Expirado',\n 'section.memoryRecall': 'Recordação desta sessão',\n 'recall.empty': 'Nenhuma memória recordada nesta sessão ainda',\n 'recall.count': '{count} injetadas · as substituídas por resumo ficam recolhidas (limpas só ao limpar a sessão)',\n 'recall.rateHint': 'Selecione uma memória para marcá-la: relevância 0–5; -1 declara obsoleta e a retira (recuperável).',\n 'recall.obsolete': 'Obsoleta',\n 'recall.obsoleteConfirm': 'Retirar?',\n 'recall.obsoleted': 'Marcada como obsoleta',\n 'recall.rated': 'Avaliada com {count}/5',\n 'recall.failed': 'Falha ao marcar: ',\n 'recall.obsoleteWhy': 'Declará-la obsoleta retira o registro (recuperável) e avisa o modelo no próximo turno',\n 'recall.viewDetail': 'Ver',\n 'recall.strikeHint': '; uma entrada marcada como obsoleta continua na lista, riscada (removida só quando você limpa a sessão)',\n 'recall.supersededHidden': '{count} recordações antigas ocultas — o texto foi substituído por um resumo',\n 'recall.activeGroup': 'Recordações ativas · {count}',\n 'recall.historyGroup': 'Recordações anteriores · {count}',\n 'recall.supersededTag': 'substituída por resumo',\n 'recall.noBody': '(este quadro não traz o texto completo deste registro)',\n 'section.skillUsage': 'Referências de skills',\n 'section.references': 'Referências',\n 'references.tabSkills': 'Skills',\n 'references.tabMemory': 'Memória',\n 'skillUsage.empty': 'Nenhuma skill carregada nesta sessão',\n 'skillUsage.emptyHint': 'As skills aparecem aqui quando o modelo carrega uma com a ferramenta `skill`, ou quando você invoca uma diretamente.',\n 'skillUsage.uses': '{count}x',\n 'skillUsage.count': '{count} carregamentos - {total} skills',\n 'skillUsage.latestTag': 'este turno',\n 'skillUsage.invokedGroup': 'Referenciadas · {count}',\n 'skillUsage.availableGroup': 'Disponíveis nesta sessão · {count}',\n 'skillUsage.availableCapped': '({count} skills no catálogo; a lista está truncada)',\n 'section.searchRefs': 'Buscas na web',\n 'references.tabSearch': 'Buscas',\n 'references.tabEcho': 'Eco',\n 'searchRefs.empty': 'Nenhuma busca nesta sessão',\n 'searchRefs.emptyHint': 'As consultas e as fontes retornadas aparecem aqui quando o modelo chama web_search ou advanced_search.',\n 'searchRefs.queryGroup': 'Consultas · {count}',\n 'searchRefs.sourceGroup': 'Fontes · {count}',\n 'searchRefs.hits': '{count} retornadas',\n 'searchRefs.latestTag': 'Este turno',\n 'searchRefs.noSourcesHint': '(esta compilação do dsh-free-search não devolve a lista de fontes; atualize para vê-las)',\n 'searchRefs.capped': '({total} na sessão; a lista está truncada)',\n 'settings.title': 'Barra lateral de resumo',\n 'settings.desc': 'Interruptores de seção da aba de resumo na barra lateral direita (visões somente leitura).',\n 'settings.memorySlots': 'Seção de slots de memória',\n 'settings.memorySlotsHint': 'Quando ativa, a aba de resumo lista os slots de memória ativos do dsh-prime-memory abaixo de progresso e arquivos produzidos (somente leitura).',\n 'settings.memoryRecall': 'Seção de recordação da sessão',\n 'settings.memoryRecallHint': 'Quando ativa, a aba Resumo lista as memórias injetadas nesta sessão e permite avaliá-las (0–5; -1 declara uma obsoleta e a retira). Entradas que um resumo substituiu ficam recolhidas.',\n 'settings.spiritEcho': 'Aba Eco',\n 'settings.spiritEchoHint': 'Quando ativa, o painel de referências mantém a aba Eco, que lista as entradas ecoadas e os trechos recordados desta sessão (persistidos entre reinícios). Desligar esconde a aba inteira.',\n 'settings.unavailable': 'A superfície de configuração está indisponível; a seção de memória usa o padrão (ativa).',\n 'settings.readonly': 'Esta configuração é somente leitura aqui; não há como editá-la.',\n 'section.spiritEcho': 'Eco',\n 'echo.segmentCount': '{count} trechos recordados nesta sessão',\n 'echo.stepCount': '{count} entradas de eco nesta sessão',\n 'echo.openOriginal': 'Abrir original',\n 'echo.skippedSummary': '{count} rodadas não injetaram nada ({reasons})',\n 'echo.injectedEmpty': '(sem resumo)',\n 'echo.totalHint': 'Trechos nesta sessão: {count} (mantidos entre reinícios)',\n 'echo.latest': 'Mais recente:',\n 'echo.lastStep': 'Rodada anterior:',\n 'echo.injected': 'injetado',\n 'echo.skipped': 'pulado',\n 'echo.empty': 'Nenhum trecho de eco recordado nesta sessão ainda',\n 'echo.emptyHint': 'Os trechos que o dsh-spirit recordou para esta sessão serão listados aqui.',\n 'echo.goto': 'Entradas →',\n 'echo.gotoGraph': 'Mapa estelar →',\n 'echo.gotoFail': 'Não foi possível abrir a página do eco',\n 'echo.viewMenu': 'Ver',\n 'memoryView.button': 'Detalhes',\n 'memoryView.preview': 'Visão rápida',\n 'memoryView.entry': 'Entradas',\n 'memoryView.graph2d': 'Gráfico 2D',\n 'memoryView.graph3d': 'Gráfico 3D',\n 'memoryView.failAbsent': 'Biblioteca de memória indisponível (o dsh-prime-memory não está instalado)',\n 'memoryView.failDisabled': 'A entrada da biblioteca de memória está desativada nas configurações de memória',\n 'memoryView.failUnmounted': 'Este host não monta a página inteira da biblioteca de memória',\n 'memoryView.failUnregistered': 'O host não registrou a página da biblioteca de memória',\n}\n\n/**\n * All locales in the shape the locale service consumes. Registered in ONE call:\n * the registry rejects a duplicate `(namespace, locale)` pair and the\n * per-locale form would leave a half-registered namespace if a later call\n * threw. `zh`/`en` are the host built-ins; the fr/de/it/ru/es/pt pack rides the\n * same map form (every id is a valid BCP 47-style tag, so the registry accepts\n * it as-is).\n */\nexport const dictionaries: Record<string, Record<string, string>> = {\n zh,\n en,\n ja,\n ko,\n fr,\n de,\n it,\n ru,\n es,\n pt,\n}\n\n/**\n * Expand the one `{count}` placeholder the deliverables totals line uses. The\n * locale binder is a plain key → string lookup (no interpolation machinery),\n * mirroring how `progressLine` composes its summary from parts.\n */\nexport function expandCount(template: string, count: number): string {\n return template.replace('{count}', String(count))\n}\n\n/**\n * Fill a `{total}` placeholder — the counter that says how many there really\n * are, as opposed to how many the (capped) list shows.\n */\nexport function expandTotal(template: string, total: number): string {\n return template.replace('{total}', String(total))\n}\n","/**\r\n * The deliverables section: the `dshSummaryDeliverables` projection drawn as\r\n * one part of the summary tab.\r\n *\r\n * Unlike the progress section this is an OPTIONAL capability: where the host\r\n * half never registered the unit (older composition, key absent), the section\r\n * hides entirely — absence is not an error state here, and the official\r\n * \"本次产出\" row in the conversation flow still covers the turn-end view.\r\n * When the projection is live, the latest turn's produced paths update\r\n * mid-turn: every successful mutation result publishes a frame, so the reader\r\n * sees files appear while the turn is still running, which is exactly the gap\r\n * the official turn-tail row has.\r\n *\r\n * Codeplan artifacts (paths under `.agents/plans/<任务名>/`) are ordinary\r\n * produced entries — they are marked with a pill, not split into a separate\r\n * section.\r\n *\r\n * Colours come from `--dsw-alias-*` tokens only (skin contract).\r\n */\r\nimport { createElement } from 'react'\r\nimport { useState } from 'react'\r\nimport type { CSSProperties, ReactNode } from 'react'\r\nimport { useProjectionValue } from '../use-projection'\r\nimport type { CtxProbe } from '../use-projection'\r\nimport { DELIVERABLES_KEY } from '../../projection/keys'\r\nimport { sidebarFileOpener } from '../file-open'\r\nimport { basename, historyPaths, readDeliverables, splitCodeplanPath } from './deliverables'\r\nimport { GroupCaption, GroupHeader, FoldToggle } from './FoldToggle'\r\nimport { expandCount, expandTotal } from '../locales'\r\n\r\nexport interface DeliverablesSectionProps {\r\n /** The DSH locale lookup, passed down from `apply`. */\r\n t: (key: string) => string\r\n /** The client root context (the tab body's only way to reach services). */\r\n ctx?: CtxProbe\r\n /** The session this tab is scoped to. */\r\n scope?: { readonly sessionId?: string }\r\n}\r\n\r\nconst SECTION_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n borderBottom: '1px solid var(--dsw-alias-border-secondary)',\r\n}\r\n\r\n/**\r\n * How many earlier-change rows a reloaded session shows before the reader asks\r\n * for more. Five fills the visible slice of a narrow sidebar without turning\r\n * the section into a scroll well — the preview exists to prove \"this session\r\n * produced files\", not to be the full history.\r\n */\r\nconst HISTORY_PREVIEW = 5\r\n\r\nconst HEADER_STYLE: CSSProperties = {\r\n padding: '10px 12px 0',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n fontSize: 12,\r\n fontWeight: 600,\r\n}\r\n\r\nconst LIST_STYLE: CSSProperties = {\r\n listStyle: 'none',\r\n margin: 0,\r\n padding: '6px 0',\r\n display: 'flex',\r\n flexDirection: 'column',\r\n}\r\n\r\nconst ROW_STYLE: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'flex-start',\r\n gap: 8,\r\n padding: '6px 12px',\r\n}\r\n\r\nconst PATH_STYLE: CSSProperties = {\r\n minWidth: 0,\r\n overflowWrap: 'anywhere',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n}\r\n\r\n/** Row-as-button reset: the row itself is the click target, content unchanged. */\r\nconst BUTTON_STYLE: CSSProperties = {\r\n ...PATH_STYLE,\r\n background: 'none',\r\n border: 'none',\r\n font: 'inherit',\r\n fontSize: 'inherit',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n padding: 0,\r\n textAlign: 'left',\r\n cursor: 'pointer',\r\n}\r\n\r\n/** The codeplan pill: same form as the status pills, tertiary emphasis. */\r\nconst TAG_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n border: '1px solid var(--dsw-alias-label-tertiary)',\r\n borderRadius: 999,\r\n padding: '0 6px',\r\n fontSize: 11,\r\n lineHeight: '16px',\r\n whiteSpace: 'nowrap',\r\n}\r\n\r\n/**\r\n * One produced-file row. When the sidebar opener is available the row is a\r\n * button that routes the path to the Sidebar preview (the same channel the\r\n * conversation's produced-file chips use); otherwise it degrades to a plain\r\n * span. A codeplan artifact carries the pill either way.\r\n */\r\nfunction PathRow(props: {\r\n path: string\r\n t: (key: string) => string\r\n open?: (path: string) => void\r\n}): ReactNode {\r\n const { path, t, open } = props\r\n const plan = splitCodeplanPath(path)\r\n const title = plan === null ? path : `${t('deliverable.codeplanTag')}: ${plan.task} · ${path}`\r\n const label = basename(path)\r\n const content = plan === null ? null : createElement('span', { style: TAG_STYLE }, t('deliverable.codeplanTag'))\r\n if (open === undefined) {\r\n return createElement(\r\n 'li',\r\n { style: ROW_STYLE },\r\n content,\r\n createElement('span', { style: PATH_STYLE, title }, label),\r\n )\r\n }\r\n return createElement(\r\n 'li',\r\n { style: ROW_STYLE },\r\n content,\r\n createElement('button', { style: BUTTON_STYLE, title, onClick: () => { open(path) } }, label),\r\n )\r\n}\r\n\r\n/**\r\n * The deliverables section. The subscription is unconditional (a plain\r\n * listener, not IO).\r\n *\r\n * 分层:本回合改动(latest)与全会话更早改动分成两组各自计数——前者直列,后者\r\n * 折叠在开关行后面(与活跃文件按归一化路径去重),展开后是与活跃区相同的可点击\r\n * 文件行。列表有上限时,开关行说折叠区条数、附注说会话真数,两个数不混为一谈。\r\n *\r\n * **重载语义**:重新打开一个历史会话时,`latest` 要么是空的(还没跑新回合),\r\n * 要么指向上一回合——两种情况下「本回合改动」都读不出东西,而历史改动全被\r\n * 折叠收起,整节看起来像\"没有产物\"。所以本回合为空时历史区**默认展开并只\r\n * 预览前 {@link HISTORY_PREVIEW} 条**:读者一进来就能看见这个会话改过什么,\r\n * 又不至于把侧栏塞满;点「还有 N 条」看全量,点折叠行收起。\r\n * @param props - translation, client context, session scope.\r\n */\r\nexport function DeliverablesSection(props: DeliverablesSectionProps): ReactNode {\r\n const { t, ctx, scope } = props\r\n // `undefined` = the reader has not expressed a preference yet, so the\r\n // default below still applies. A live projection can flip the turn from\r\n // empty to populated mid-session, and a plain `useState(defaultOpen)` would\r\n // freeze whichever state the first render happened to see.\r\n const [historyOverride, setHistoryOverride] = useState<boolean | undefined>(undefined)\r\n\r\n const view = readDeliverables(useProjectionValue(ctx, scope?.sessionId, DELIVERABLES_KEY))\r\n\r\n // Capability absent — the optional unit never registered. Hide, don't nag.\r\n if (view === undefined) return null\r\n\r\n // Optional click-to-preview: rows degrade to plain text where the sidebar\r\n // opener is absent (the opener resolves the session cwd per click).\r\n const open = sidebarFileOpener(ctx, scope?.sessionId)\r\n\r\n const latestPaths = view.latest?.paths ?? []\r\n const history = historyPaths(view.sessionPaths, latestPaths)\r\n\r\n // No current-turn rows means this is a reload of a finished turn: show the\r\n // earlier changes instead of an apparently empty section.\r\n const historyOpen = historyOverride ?? latestPaths.length === 0\r\n // Previewing = open because the section defaulted open, not because the\r\n // reader asked for everything. Only a preview offers the \"N more\" entry.\r\n const previewing = historyOpen && historyOverride !== true\r\n const shownHistory = !historyOpen\r\n ? []\r\n : previewing ? history.slice(0, HISTORY_PREVIEW) : history\r\n const hiddenHistory = history.length - shownHistory.length\r\n\r\n if (latestPaths.length === 0 && view.sessionTotal === 0) {\r\n return createElement(\r\n 'div',\r\n { style: SECTION_STYLE, 'data-dsh-brief-sidebar': 'deliverables-section' },\r\n createElement('div', { style: HEADER_STYLE }, t('section.deliverables')),\r\n createElement(\r\n 'div',\r\n {\r\n style: {\r\n margin: '0 auto',\r\n padding: 24,\r\n maxWidth: 460,\r\n textAlign: 'center',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n lineHeight: 1.7,\r\n fontSize: 12,\r\n },\r\n },\r\n createElement('div', { style: { marginBottom: 6, color: 'var(--dsw-alias-label-secondary)' } }, t('deliverables.empty')),\r\n createElement('div', null, t('deliverables.emptyHint')),\r\n ),\r\n )\r\n }\r\n\r\n return createElement(\r\n 'div',\r\n { style: SECTION_STYLE, 'data-dsh-brief-sidebar': 'deliverables-section' },\r\n createElement('div', { style: HEADER_STYLE }, t('section.deliverables')),\r\n // 当前 turn 一组:只有真改过东西才起标题,否则“本回合改动 · 0”反而口舌。\r\n latestPaths.length > 0 && createElement(GroupHeader, {\r\n text: expandCount(t('deliverables.currentTurn'), latestPaths.length),\r\n marker: 'deliverables-current-group',\r\n }),\r\n latestPaths.length > 0 && createElement(\r\n 'ul',\r\n { style: LIST_STYLE },\r\n latestPaths.map(path => createElement(PathRow, { key: path, path, t, open })),\r\n ),\r\n history.length > 0 && createElement(FoldToggle, {\r\n label: expandCount(t('deliverables.history'), history.length),\r\n open: historyOpen,\r\n marker: 'deliverables-history-toggle',\r\n onToggle: () => { setHistoryOverride(!historyOpen) },\r\n }),\r\n // 列表有上限:开关行说的是折叠区收了多少条,附注说会话一共改过多少个。\r\n history.length > 0 && view.sessionTotal > view.sessionPaths.length && createElement(GroupCaption, {\r\n text: expandTotal(t('deliverables.historyCapped'), view.sessionTotal),\r\n marker: 'deliverables-history-capped',\r\n }),\r\n shownHistory.length > 0 && createElement(\r\n 'ul',\r\n { style: LIST_STYLE },\r\n shownHistory.map(path => createElement(PathRow, { key: path, path, t, open })),\r\n ),\r\n // 预览模式下把\"还有多少条\"交回读者:一行可点的补充入口,不靠滚动。\r\n // 只在预览态出现——收起态已经有折叠开关,全展开态没有剩余可给。\r\n previewing && hiddenHistory > 0 && createElement(FoldToggle, {\r\n label: expandCount(t('deliverables.historyMore'), hiddenHistory),\r\n open: false,\r\n marker: 'deliverables-history-more',\r\n onToggle: () => { setHistoryOverride(true) },\r\n }),\r\n )\r\n}\r\n","/**\r\n * The `dshSummarySkillUsage` projection — reading it.\r\n *\r\n * The unit is registered by THIS plugin's host half (key `dshSummarySkillUsage`):\r\n * the skills this session actually loaded through the host's `skill` tool. It\r\n * answers a different question from `memorySlots`/`memoryRecall` — those say\r\n * what the model was *told*, this says which instruction packs it *pulled*.\r\n *\r\n * The module is deliberately PURE — no React, no context, no IO — so the\r\n * narrowing is testable directly, exactly like `deliverables.ts`.\r\n *\r\n * Reading discipline (the same three-way split every brief section uses):\r\n * - `undefined` = the capability is ABSENT (host half never registered, older\r\n * composition without the projection registry, or a frame drifted beyond\r\n * repair) → the section hides;\r\n * - `session: []` = the honest empty state (the `skill` tool exists on all six\r\n * supported lines; this session simply has not loaded anything yet);\r\n * - a malformed entry is dropped, never thrown — one bad row must not blank\r\n * the whole list.\r\n */\r\nimport { SKILL_USAGE_KEY } from '../../projection/keys'\r\nimport type { SkillUsageEntryView, SkillUsageView } from '../../projection/keys'\r\n\r\n/** The key this plugin's client half subscribes to (re-exported for callers). */\r\nexport { SKILL_USAGE_KEY }\r\n\r\n/** Whether a value is a non-negative safe integer (the view's counter shape). */\r\nfunction isCounter(value: unknown): value is number {\r\n return typeof value === 'number' && Number.isSafeInteger(value) && value >= 0\r\n}\r\n\r\n/** Narrow one skill tally; `undefined` = malformed, dropped. */\r\nfunction readEntry(value: unknown): SkillUsageEntryView | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as Record<string, unknown>\r\n if (typeof raw['name'] !== 'string' || raw['name'].length === 0) return undefined\r\n if (!isCounter(raw['count']) || !isCounter(raw['lastTurn'])) return undefined\r\n return { name: raw['name'], count: raw['count'], lastTurn: raw['lastTurn'] }\r\n}\r\n\r\n/**\r\n * The latest-turn bucket, or `null` when it is absent OR drifted. A drifted\r\n * bucket only costs the \"本轮\" tag, so it degrades instead of voiding the view.\r\n */\r\nfunction readLatest(value: unknown): SkillUsageView['latest'] {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return null\r\n const raw = value as Record<string, unknown>\r\n if (!isCounter(raw['turn']) || !Array.isArray(raw['names'])) return null\r\n return { turn: raw['turn'], names: raw['names'].filter((n): n is string => typeof n === 'string' && n.length > 0) }\r\n}\r\n\r\n/**\r\n * The available-skill list of a frame, or `[]` when the frame carries none.\r\n *\r\n * Absent-by-age is the important case: a host half older than this reader\r\n * publishes no `available` field at all, and that must NOT void the whole view\r\n * — the session's references are still true. Only a drifted (non-array) value\r\n * reads as \"nothing known\", never as \"nothing available\".\r\n */\r\nfunction readAvailable(value: unknown): readonly string[] {\r\n if (!Array.isArray(value)) return []\r\n return value.filter((n): n is string => typeof n === 'string' && n.length > 0)\r\n}\r\n\r\n/**\r\n * Narrow a raw projection value into a skill-usage view.\r\n *\r\n * @param value - the raw `unknown` snapshot of the `dshSummarySkillUsage` face.\r\n * @returns the validated view, or `undefined` when the capability is absent.\r\n */\r\nexport function readSkillUsage(value: unknown): SkillUsageView | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as Record<string, unknown>\r\n // The counters and the list are the contract; their drift means the frame was\r\n // written by a different shape than this reader speaks.\r\n if (!Array.isArray(raw['session'])) return undefined\r\n if (!isCounter(raw['sessionTotal']) || !isCounter(raw['callTotal'])) return undefined\r\n const session: SkillUsageEntryView[] = []\r\n for (const entry of raw['session']) {\r\n const narrowed = readEntry(entry)\r\n if (narrowed !== undefined) session.push(narrowed)\r\n }\r\n const available = readAvailable(raw['available'])\r\n // The count rides with the list; without a list there is no count to trust.\r\n const availableCount = available.length === 0 ? 0 : (isCounter(raw['availableCount']) ? raw['availableCount'] : available.length)\r\n return {\r\n latest: readLatest(raw['latest']),\r\n session,\r\n sessionTotal: raw['sessionTotal'],\r\n callTotal: raw['callTotal'],\r\n available,\r\n availableCount,\r\n }\r\n}\r\n\r\n/**\r\n * The available list minus the names already shown as referenced.\r\n *\r\n * One skill must not occupy a row in both groups: the reference row is the\r\n * stronger fact, and a duplicate under \"available\" would read as \"the model\r\n * had a choice it didn't make\".\r\n *\r\n * @param available - the session's current catalog names, in catalog order.\r\n * @param referenced - names the fold counted as loaded or invoked.\r\n * @returns the remaining catalog names, order preserved.\r\n */\r\nexport function availableExcept(available: readonly string[], referenced: readonly string[]): string[] {\r\n const seen = new Set(referenced)\r\n return available.filter(name => !seen.has(name))\r\n}\r\n\r\n/**\r\n * Fill both placeholders of a template. `expandCount` only speaks `{count}`, and\r\n * this section's footer carries a second number on purpose: the capped list\r\n * needs the truthful distinct total next to the load count.\r\n *\r\n * @param template - a locale string carrying `{count}` and/or `{total}`.\r\n * @param count - the `{count}` value.\r\n * @param total - the `{total}` value.\r\n * @returns the filled string.\r\n */\r\nexport function expandPair(template: string, count: number, total: number): string {\r\n return template.replace('{count}', String(count)).replace('{total}', String(total))\r\n}\r\n","/**\n * Host-side fold of search-reference facts — the projection unit state for\n * `dshSummarySearchRefs`: which queries this session ran against the web, and\n * which external sources came back.\n *\n * Two tools feed it, and the split is stated on every row rather than merged\n * away, because they are different facts for the reader:\n *\n * - `advanced_search` — the user's own `dsh-free-search` tool: engines, keys\n * and prices are things the human configures. Its argument is `query`, a\n * single string.\n * - `web_search` — the harness's own tool, which `dsh-free-search` also feeds\n * (it registers a `WebSearchProvider`, so results can come from engines the\n * human picked while the call goes through host plumbing). Its argument is\n * `queries`, an array merged into one result set.\n *\n * Folding only the plugin tool turned out to be the wrong default: the model\n * reaches for the host's `web_search` far more often, so the section sat empty\n * in exactly the sessions where searching happened. Both are folded now; the\n * `tool` on each row is what keeps the two honest.\n *\n * Two channels, both structured, no prose scraping:\n *\n * - the query strings come from `tool/call.arguments`;\n * - the returned sources come from `tool/result.meta.sources[]` — the host\n * publishes those itself for `web_search`, and `dsh-free-search` >= 0.9.25\n * publishes them for `advanced_search` via `output.presentationMeta`.\n *\n * Older `dsh-free-search` builds declare no `presentationMeta`, so their\n * results carry no meta. That is a degraded reading, not a missed search: the\n * query still counts, with zero sources listed. Dropping the row instead would\n * tell the reader nothing happened when the model did search.\n *\n * Like the deliverables and skill folds this module is PURE — no cordis, no\n * zod, no IO — so it can be tested against hand-written event fixtures.\n * Success is required (an `isError` result is not a reference), and every list\n * is bounded because the registry folds this once per committed event.\n */\nimport type { FoldEvent } from './deliverables-fold'\n\n/** One external source the session pulled back. */\nexport interface SearchRefItem {\n /** The URL exactly as published, minus host case and a trailing slash. */\n readonly url: string\n /** Host, for grouping and for the row's quiet right-hand label. */\n readonly host: string\n readonly title?: string\n /** Provider snippet, capped (see CAPS.snippet). */\n readonly snippet?: string\n /**\n * Every query that has surfaced this source (newest call first, capped).\n * A merged multi-query `web_search` attributes its whole result set to each\n * of its queries, and a later call UNIONs onto this list rather than\n * replacing it — otherwise a source would silently leave the earlier query's\n * cluster while that query's `hits` still counted it.\n */\n readonly queries: readonly string[]\n /** Which tool answered — the plugin's own or the harness's. */\n readonly tool: string\n /** How many settled searches surfaced it. */\n readonly count: number\n /** Turn whose result last advanced this row. */\n readonly lastTurn: number\n}\n\n/** One search the session ran, with how many sources it returned. */\nexport interface SearchQueryRow {\n readonly query: string\n /** `advanced_search` (plugin) or `web_search` (host). */\n readonly tool: string\n readonly turn: number\n /**\n * Sources the call returned. For a merged multi-query `web_search` this is\n * the call's total repeated on each of its queries — the session never says\n * which query produced which source, and inventing a per-query split would\n * be worse than restating the shared total.\n */\n readonly hits: number\n}\n\n/** Fold state. Plain JSON, so the projection cache can persist it. */\nexport interface SearchRefState {\n /** Turn number of the open (or latest seen) turn; 0 before the first turn. */\n readonly turn: number\n /** Open turns' `callId → the search it asked for`; only owned tools are recorded. */\n readonly calls: Readonly<Record<string, { readonly turn: number; readonly tool: string; readonly queries: readonly string[] }>>\n /** URLs surfaced in the latest turn so far (`null` before the first turn). */\n readonly latest: { readonly turn: number; readonly urls: readonly string[] } | null\n /** Distinct sources, most-recent-first, capped. */\n readonly items: readonly SearchRefItem[]\n /** Distinct queries, most-recent-first, capped. */\n readonly queries: readonly SearchQueryRow[]\n /** Distinct sources over the whole session, uncapped. */\n readonly sourceTotal: number\n /** Distinct queries over the whole session, uncapped. */\n readonly queryTotal: number\n}\n\n/**\n * Capacity bounds, set from measurement rather than feel: 348 local sessions\n * (70 of them containing searches) gave distinct-queries-per-session\n * p50=7 / p90=29 / p95=38 / p99=67, distinct-sources-per-session\n * p50=16 / p90=54 / p95=63 / p99=164, and sources-per-turn p50=16 / p90=41 /\n * p95=51 / max=65. The previous 20/20/20 sat at roughly p55, which is what made\n * real clusters read \"0 results\" while the session had searched — a cap that\n * truncates the median session is a bug, not a limit.\n *\n * The cost of these numbers is bounded and known: one frame carries at most 64\n * sources and 48 queries, and a source row is URL + host + a capped title and\n * snippet plus at most 5 query strings. `snippet` is capped because it is the\n * only long text in the state and the frame is republished per event; the\n * provider already caps it once in its own `presentationMeta`, so this is a\n * second, tighter belt (measured snippet length: p95=137 characters).\n */\nexport const CAPS = {\n /** Distinct sources kept in state (measured p95=63, rounded up). */\n items: 64,\n /** Distinct queries kept in state (measured p95=38, headroom to ~p97). */\n queries: 48,\n /** URLs kept in the latest-turn bucket (measured per-turn max=65). */\n latest: 64,\n /** Snippet characters kept per source. */\n snippet: 160,\n /** Distinct queries kept per source (cluster membership, newest first). */\n queriesPerSource: 5,\n} as const\n\n/** The fold's initial state: no search has settled yet. */\nexport function initSearchRefState(): SearchRefState {\n return { turn: 0, calls: {}, latest: null, items: [], queries: [], sourceTotal: 0, queryTotal: 0 }\n}\n\n/**\n * The tools this fold owns, with how each one carries its query text.\n * Anything else is not a search reference even if its arguments look alike.\n */\nconst SEARCH_TOOLS: Readonly<Record<string, 'query' | 'queries'>> = {\n // The plugin's own tool: one query per call.\n advanced_search: 'query',\n // The harness's tool: 1..N queries whose result sets are merged.\n web_search: 'queries',\n}\n\n/**\n * Extract the query list of one committed `tool/call`.\n *\n * @param name - wire tool name.\n * @param argsRaw - model-produced JSON arguments (a string by the session contract).\n * @returns the non-blank queries in published order, or null when this call is not a search.\n */\nexport function queriesFromArgs(name: string, argsRaw: string): readonly string[] | null {\n let args: unknown\n try {\n args = JSON.parse(argsRaw) as unknown\n } catch {\n return null\n }\n return queriesOf(name, args)\n}\n\n/**\n * Extract the query list from a call whose arguments are ALREADY parsed — the\n * shape `tool/ptc-dispatch` carries. A non-object argument (the host's static\n * type is `unknown`; failure dispatches have been observed to carry a bare\n * string) yields null rather than an exception.\n *\n * @param name - wire tool name.\n * @param args - parsed call arguments.\n * @returns the non-blank queries in published order, or null when this call is not a search.\n */\nexport function queriesOf(name: string, args: unknown): readonly string[] | null {\n const shape = SEARCH_TOOLS[name]\n if (shape === undefined) return null\n if (typeof args !== 'object' || args === null || Array.isArray(args)) return null\n const record = args as Record<string, unknown>\n const keep = (value: unknown, out: string[]): void => {\n if (typeof value === 'string' && value.trim().length > 0) out.push(value.trim())\n }\n const out: string[] = []\n if (shape === 'query') {\n keep(record['query'], out)\n } else {\n // A non-array `queries` is a drifted argument, not a search we can name.\n if (!Array.isArray(record['queries'])) return null\n for (const entry of record['queries']) keep(entry, out)\n }\n return out.length > 0 ? out : null\n}\n\n/**\n * The dedupe key. Host case and a trailing slash are not meaningful for\n * identity; path case IS, so it is left alone. Exported because the client\n * matches a row against the latest-turn bucket with the same algorithm.\n */\nexport function urlKey(url: string): string {\n const trimmed = url.trim()\n const withoutTrailingSlash = trimmed.endsWith('/') ? trimmed.slice(0, -1) : trimmed\n return withoutTrailingSlash.replace(/^[a-z][a-z0-9+.-]*:\\/\\/[^/]+/i, match => match.toLowerCase())\n}\n\n/** The host label of a URL, or the raw string when it does not parse. */\nfunction hostOf(url: string): string {\n try {\n return new URL(url).hostname.replace(/^www\\./i, '')\n } catch {\n return url.slice(0, 40)\n }\n}\n\n/** Cap one snippet so one long provider blurb cannot dominate every frame. */\nfunction capSnippet(text: string): string {\n const one = text.replace(/\\s+/g, ' ').trim()\n return one.length > CAPS.snippet ? `${one.slice(0, CAPS.snippet)}…` : one\n}\n\n/** The sources of one result meta, or `[]` when the meta is absent or drifted. */\nfunction readSources(meta: unknown): { url: string; title?: string; snippet?: string }[] {\n if (typeof meta !== 'object' || meta === null) return []\n const raw = (meta as Record<string, unknown>)['sources']\n if (!Array.isArray(raw)) return []\n const out: { url: string; title?: string; snippet?: string }[] = []\n for (const entry of raw) {\n if (typeof entry !== 'object' || entry === null) continue\n const record = entry as Record<string, unknown>\n if (typeof record['url'] !== 'string' || record['url'].trim().length === 0) continue\n const source: { url: string; title?: string; snippet?: string } = { url: record['url'] }\n if (typeof record['title'] === 'string' && record['title'].length > 0) source.title = record['title']\n if (typeof record['snippet'] === 'string' && record['snippet'].length > 0) source.snippet = capSnippet(record['snippet'])\n out.push(source)\n }\n return out\n}\n\n/**\n * The next state after one committed event. Events this fold does not own\n * return the SAME reference, which is what keeps the registry's `Object.is`\n * drive from republishing the key on unrelated frames.\n *\n * @param state - the state covering all prior events.\n * @param event - the next committed session event.\n * @returns the next state (same reference when nothing the fold tracks moved).\n */\nexport function applySearchRefEvent(state: SearchRefState, event: FoldEvent): SearchRefState {\n if (event.type === 'turn/start') {\n const turn = event.data as { turn?: unknown }\n if (typeof turn?.turn !== 'number') return state\n const calls: Record<string, { readonly turn: number; readonly tool: string; readonly queries: readonly string[] }> = {}\n for (const [id, entry] of Object.entries(state.calls)) {\n if (entry.turn >= turn.turn - 1) calls[id] = entry\n }\n return { ...state, turn: turn.turn, calls, latest: { turn: turn.turn, urls: [] } }\n }\n\n if (event.type === 'tool/call') {\n const call = event.data as { callId?: unknown; name?: unknown; arguments?: unknown }\n if (typeof call?.callId !== 'string') return state\n if (typeof call.name !== 'string' || typeof call.arguments !== 'string') return state\n if (SEARCH_TOOLS[call.name] === undefined) return state\n const queries = queriesFromArgs(call.name, call.arguments)\n // An unreadable query is not recorded: the later result then settles nothing,\n // which is the honest reading of \"we do not know what was searched\".\n if (queries === null) return state\n return { ...state, calls: { ...state.calls, [call.callId]: { turn: state.turn, tool: call.name, queries } } }\n }\n\n if (event.type === 'tool/ptc-dispatch') {\n // PTC sub-dispatch settle: same two facts as the native channel — the\n // queries come from the (already-parsed) arguments, the sources come from\n // `meta.sources`, which the host preserves on dispatch events exactly as\n // `tool/result` carries them. A dispatch without meta still folds its\n // queries with zero sources; a failed dispatch counts nothing.\n const d = event.data as { subCallId?: unknown; name?: unknown; arguments?: unknown; isError?: unknown; meta?: unknown }\n if (typeof d?.subCallId !== 'string') return state\n if (d.isError === true) return state\n if (typeof d.name !== 'string') return state\n const queries = queriesOf(d.name, d.arguments)\n if (queries === null) return state\n return settle(state, { tool: d.name, queries, turn: state.turn }, readSources(d.meta))\n }\n\n if (event.type !== 'tool/result') return state\n\n const result = event.data as {\n meta?: unknown\n message?: { content?: readonly { isError?: unknown }[]; source?: { callId?: unknown } }\n }\n const callId = result?.message?.source?.callId\n if (typeof callId !== 'string') return state\n if (result?.message?.content?.[0]?.isError === true) return state\n\n const recorded = state.calls[callId]\n if (recorded === undefined) return state\n return settle(state, recorded, readSources(result.meta))\n}\n\n/**\n * Settle one successful search: fold its returned sources into the item rows\n * and its queries into the query rows. Shared by the native\n * `tool/call`+`tool/result` channel and the PTC `tool/ptc-dispatch`\n * channel — both carry the same `meta.sources` shape.\n *\n * With zero sources the state's `latest` reference is preserved unchanged so\n * the registry's `Object.is` drive does not republish on every frame (PTC\n * searches without meta would otherwise touch the reference per settle).\n */\nfunction settle(\n state: SearchRefState,\n ask: { readonly tool: string; readonly queries: readonly string[]; readonly turn: number },\n sources: readonly { url: string; title?: string; snippet?: string }[],\n): SearchRefState {\n const { tool, queries: asked, turn } = ask\n\n // Sources: front-insert per published order, so the last one published ends\n // up first. A repeat of a known URL updates that row instead of adding one.\n const items = [...state.items]\n let sourceTotal = state.sourceTotal\n const urls: string[] = []\n for (const source of sources) {\n const key = urlKey(source.url)\n urls.push(key)\n const at = items.findIndex(item => urlKey(item.url) === key)\n const previousQueries = at >= 0 ? items[at]?.queries ?? [] : []\n const row: SearchRefItem = {\n url: source.url,\n host: hostOf(source.url),\n ...(source.title !== undefined ? { title: source.title } : {}),\n ...(source.snippet !== undefined ? { snippet: source.snippet } : {}),\n queries: [...new Set([...asked, ...previousQueries])].slice(0, CAPS.queriesPerSource),\n tool,\n count: at < 0 ? 1 : (items[at]?.count ?? 0) + 1,\n lastTurn: turn,\n }\n if (at >= 0) items.splice(at, 1)\n else sourceTotal += 1\n items.unshift(row)\n }\n\n // Queries: newest first, one row per distinct query text, hits accumulating.\n // Every query of the call gets its own row — `web_search` merges N of them\n // and the reader asked what was searched, not which call carried it.\n const queries = [...state.queries]\n let queryTotal = state.queryTotal\n for (const asked2 of asked) {\n const qAt = queries.findIndex(row => row.query === asked2)\n if (qAt >= 0) {\n const previous = queries[qAt]\n queries.splice(qAt, 1)\n queries.unshift({ query: asked2, tool, turn, hits: (previous?.hits ?? 0) + sources.length })\n } else {\n queries.unshift({ query: asked2, tool, turn, hits: sources.length })\n queryTotal += 1\n }\n }\n\n const latest = state.latest\n const nextLatest = latest !== null && latest.turn === turn\n ? { turn: latest.turn, urls: [...urls.reverse(), ...latest.urls].slice(0, CAPS.latest) }\n : latest\n\n if (urls.length === 0) {\n // No sources came back: keep every settled query row, but do NOT rebuild\n // the state object — the unchanged reference keeps the wire quiet.\n return { ...state, queries: queries.slice(0, CAPS.queries), queryTotal, latest }\n }\n\n return {\n ...state,\n items: items.slice(0, CAPS.items),\n queries: queries.slice(0, CAPS.queries),\n sourceTotal,\n queryTotal,\n latest: nextLatest,\n }\n}\n","/**\r\n * The `dshSummarySearchRefs` projection — reading it.\r\n *\r\n * The unit is registered by THIS plugin's host half (key `dshSummarySearchRefs`):\r\n * the queries this session ran — through the harness's `web_search` or the\r\n * user's own `advanced_search` — and the sources those searches brought back.\r\n * It answers \"what did the session pull in from outside\" — where the skill tab\r\n * says which instruction packs were loaded and the memory tab says which of the\r\n * user's own knowledge was injected.\r\n *\r\n * Reading discipline, same as every other brief section:\r\n * - `undefined` = the capability is ABSENT (no projection registry, or a frame\r\n * drifted past repair) → the tab hides;\r\n * - empty lists = the honest empty state (the session has not searched yet);\r\n * - a malformed row is dropped, never thrown.\r\n *\r\n * The module is deliberately PURE — no React, no context, no IO.\r\n */\r\nimport { SEARCH_REFS_KEY } from '../../projection/keys'\r\nimport type { SearchRefItemView, SearchRefView, SearchQueryView } from '../../projection/keys'\r\nimport { urlKey } from '../../projection/search-ref-fold'\r\n\r\n/** The key this plugin's client half subscribes to (re-exported for callers). */\r\nexport { SEARCH_REFS_KEY }\r\n\r\n/** Whether a value is a non-negative safe integer (the view's counters). */\r\nfunction isCounter(value: unknown): value is number {\r\n return typeof value === 'number' && Number.isSafeInteger(value) && value >= 0\r\n}\r\n\r\n/**\r\n * The tool a row came from, defaulting to the plugin's own for a frame written\r\n * before the host half started publishing `tool`. Absent is \"we do not know\",\r\n * never \"not a search\", so the row still shows.\r\n */\r\nfunction readTool(value: unknown): string {\r\n return typeof value === 'string' && value.length > 0 ? value : 'advanced_search'\r\n}\r\n\r\n/**\r\n * The queries that surfaced a source, newest first.\r\n *\r\n * Two legacy shapes are repaired rather than dropped: a frame written before\r\n * the cluster change carries a single `query` string, and a drifted value\r\n * (non-array, or an array of junk) reads as \"member of no cluster\" — the row\r\n * still shows, it just joins the tail group.\r\n */\r\nfunction readQueries(value: unknown): readonly string[] {\r\n if (Array.isArray(value)) {\r\n return [...new Set(value.filter((q): q is string => typeof q === 'string' && q.length > 0))]\r\n }\r\n if (typeof value === 'string' && value.length > 0) return [value]\r\n return []\r\n}\r\n\r\n/** Narrow one source row; `undefined` = malformed, dropped. */\r\nfunction readItem(value: unknown): SearchRefItemView | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as Record<string, unknown>\r\n if (typeof raw['url'] !== 'string' || raw['url'].length === 0) return undefined\r\n if (typeof raw['host'] !== 'string') return undefined\r\n if (!isCounter(raw['count']) || !isCounter(raw['lastTurn'])) return undefined\r\n const item: { -readonly [K in keyof SearchRefItemView]: SearchRefItemView[K] } = {\r\n url: raw['url'],\r\n host: raw['host'],\r\n queries: readQueries(raw['queries'] ?? raw['query']),\r\n tool: readTool(raw['tool']),\r\n count: raw['count'],\r\n lastTurn: raw['lastTurn'],\r\n }\r\n if (typeof raw['title'] === 'string' && raw['title'].length > 0) item.title = raw['title']\r\n if (typeof raw['snippet'] === 'string' && raw['snippet'].length > 0) item.snippet = raw['snippet']\r\n return item\r\n}\r\n\r\n/** Narrow one query row; `undefined` = malformed, dropped. */\r\nfunction readQuery(value: unknown): SearchQueryView | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as Record<string, unknown>\r\n if (typeof raw['query'] !== 'string' || raw['query'].length === 0) return undefined\r\n if (!isCounter(raw['turn']) || !isCounter(raw['hits'])) return undefined\r\n return { query: raw['query'], tool: readTool(raw['tool']), turn: raw['turn'], hits: raw['hits'] }\r\n}\r\n\r\n/** The latest-turn key set, or `null` when absent OR drifted (only a tag rides it). */\r\nfunction readLatest(value: unknown): SearchRefView['latest'] {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return null\r\n const raw = value as Record<string, unknown>\r\n if (!isCounter(raw['turn']) || !Array.isArray(raw['urls'])) return null\r\n return { turn: raw['turn'], urls: raw['urls'].filter((u): u is string => typeof u === 'string' && u.length > 0) }\r\n}\r\n\r\n/**\r\n * Narrow a raw projection value into a search-reference view.\r\n *\r\n * @param value - the raw `unknown` snapshot of the `dshSummarySearchRefs` face.\r\n * @returns the validated view, or `undefined` when the capability is absent.\r\n */\r\nexport function readSearchRefs(value: unknown): SearchRefView | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as Record<string, unknown>\r\n if (!Array.isArray(raw['queries']) || !Array.isArray(raw['sources'])) return undefined\r\n if (!isCounter(raw['queryTotal']) || !isCounter(raw['sourceTotal'])) return undefined\r\n const queries: SearchQueryView[] = []\r\n for (const entry of raw['queries']) {\r\n const narrowed = readQuery(entry)\r\n if (narrowed !== undefined) queries.push(narrowed)\r\n }\r\n const sources: SearchRefItemView[] = []\r\n for (const entry of raw['sources']) {\r\n const narrowed = readItem(entry)\r\n if (narrowed !== undefined) sources.push(narrowed)\r\n }\r\n return {\r\n latest: readLatest(raw['latest']),\r\n queries,\r\n sources,\r\n queryTotal: raw['queryTotal'],\r\n sourceTotal: raw['sourceTotal'],\r\n }\r\n}\r\n\r\n/** Whether one source row was surfaced by the latest turn's searches. */\r\nexport function isLatestSource(view: SearchRefView, url: string): boolean {\r\n return view.latest?.urls.includes(urlKey(url)) === true\r\n}\r\n\r\n/** One query cluster: a question the session asked, and what answered it. */\r\nexport interface SearchCluster {\r\n /** The query text; `''` marks the tail group (sources no listed query claims). */\r\n readonly query: string\r\n readonly tool: string\r\n readonly turn: number\r\n readonly hits: number\r\n readonly items: readonly SearchRefItemView[]\r\n}\r\n\r\n/**\r\n * Cluster the result bubbles under the queries that surfaced them.\r\n *\r\n * Membership is the source's own `queries` list, so a source a merged\r\n * multi-query `web_search` brought back appears under each of them — that is\r\n * what happened, and hiding the repeat would make the counts under the headers\r\n * disagree with the cards on screen. Queries come newest-first from the fold;\r\n * a source no listed query claims (its query aged out of the capped list, or a\r\n * pre-cluster frame) lands in a tail group rather than disappearing.\r\n *\r\n * The section renders every cluster folded; nothing here decides what opens.\r\n */\r\nexport function clusterByQuery(view: SearchRefView): readonly SearchCluster[] {\r\n const claimed = new Set<string>()\r\n const out: SearchCluster[] = []\r\n for (const row of view.queries) {\r\n const items = view.sources.filter(item => item.queries.includes(row.query))\r\n for (const item of items) claimed.add(item.url)\r\n out.push({ query: row.query, tool: row.tool, turn: row.turn, hits: row.hits, items })\r\n }\r\n const rest = view.sources.filter(item => !claimed.has(item.url))\r\n if (rest.length > 0) {\r\n out.push({\r\n query: '',\r\n tool: rest[0]?.tool ?? '',\r\n turn: rest[0]?.lastTurn ?? 0,\r\n hits: rest.length,\r\n items: rest,\r\n })\r\n }\r\n return out\r\n}\r\n\r\n/**\r\n * The href to render for a source URL, or `undefined` when it must not be a link.\r\n *\r\n * Search results are untrusted external data: a `javascript:` or `data:` URL in\r\n * a provider response would otherwise become a clickable footgun in the user's\r\n * own sidebar. Only web schemes get an anchor; everything else renders as text.\r\n */\r\nexport function safeHref(url: string): string | undefined {\r\n try {\r\n const parsed = new URL(url)\r\n return parsed.protocol === 'https:' || parsed.protocol === 'http:' ? parsed.href : undefined\r\n } catch {\r\n return undefined\r\n }\r\n}\r\n","/**\r\n * The `memoryRecall` projection — reading it.\r\n *\r\n * The projection unit is registered by `dsh-prime-memory` (key `memoryRecall`,\r\n * wire view `{rev, sessionId, count, items[]}`): the memories this session has\r\n * actually injected. Unlike\r\n * `memorySlots` (pinned, resident conventions written by hand), this set is\r\n * NOT resident — it is the at-a-glance answer to \"what did the model see\".\r\n * It survives compaction on purpose: `compact` only marks the entries whose\r\n * text left the context as `superseded` (and `/clear` empties the set), so a\r\n * retired row keeps its strike-through instead of vanishing.\r\n *\r\n * This plugin does NOT depend on prime-memory: with the unit unregistered the\r\n * client reads `undefined` from the face and the section hides. The module is\r\n * deliberately PURE — no React, no context, no IO — so the narrowing is\r\n * testable directly, exactly like `memory-slots.ts`.\r\n */\r\n\r\n/** The projection key `dsh-prime-memory` registers (its canonical constant). */\r\nexport const MEMORY_RECALL_KEY = 'memoryRecall'\r\n\r\n/** One recalled memory of the wire view. */\r\nexport interface MemoryRecallItem {\r\n readonly id: string\r\n /** prime-memory's memory type: work_fact / work_method / episodic / … */\r\n readonly type: string\r\n /** First line of the record body (prime-memory truncates for the wire). */\r\n readonly title: string\r\n /** 0–100, the record's own priority. */\r\n readonly priority: number\r\n /** \"When should this surface\" phrases, once prime-memory exposes them. */\r\n readonly scenario?: readonly string[]\r\n /**\r\n * The last mark a HUMAN put on this record: `-1` (declared obsolete) or\r\n * `0..5` (relevance). Absent means never rated — which is NOT the same as\r\n * a zero. prime-memory publishes it on the `memoryRecall` view so the row\r\n * can show the existing mark without a second round-trip.\r\n */\r\n readonly rating?: number\r\n /**\r\n * The record body, whitespace-trimmed and capped by prime-memory. The hover\r\n * bubble reads it straight off the frame — no second round-trip. Absent on\r\n * frames published before that field existed, so the row falls back to\r\n * `title` and the bubble says it has no body.\r\n */\r\n readonly body?: string\r\n /**\r\n * prime-memory says this record has been retired (soft-deleted). It stays in\r\n * the list because its text is still part of what the model saw — and because\r\n * the retirement is the human's verdict; the row just draws a strike-through.\r\n * Absent means alive.\r\n */\r\n readonly retired?: boolean\r\n /**\r\n * The text of this recall has been replaced by a compaction summary, so it is\r\n * no longer in the model's context. Orthogonal to `retired` (both can be set).\r\n * The section hides these by default and reports the count in its footer;\r\n * a retired row is the exception and stays visible. Absent means still in context.\r\n */\r\n readonly superseded?: boolean\r\n}\r\n\r\n/** The whole wire view of one frame. */\r\nexport interface MemoryRecallView {\r\n readonly rev: number\r\n readonly sessionId: string\r\n /** Total recalled-and-alive count; `items` may be a capped prefix of it. */\r\n readonly count: number\r\n /** Most recently injected first. */\r\n readonly items: readonly MemoryRecallItem[]\r\n}\r\n\r\n/** Whether a value is a non-negative safe integer (the view's counter shape). */\r\nfunction isCounter(value: unknown): value is number {\r\n return typeof value === 'number' && Number.isSafeInteger(value) && value >= 0\r\n}\r\n\r\n/** Narrow one item entry; `undefined` = malformed, dropped. */\r\nfunction readItem(value: unknown): MemoryRecallItem | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as Record<string, unknown>\r\n if (typeof raw['id'] !== 'string' || raw['id'].length === 0) return undefined\r\n if (typeof raw['type'] !== 'string' || typeof raw['title'] !== 'string') return undefined\r\n if (typeof raw['priority'] !== 'number') return undefined\r\n const item: { -readonly [K in keyof MemoryRecallItem]: MemoryRecallItem[K] } = {\r\n id: raw['id'],\r\n type: raw['type'],\r\n title: raw['title'],\r\n priority: raw['priority'],\r\n }\r\n if (Array.isArray(raw['scenario'])) {\r\n const phrases = raw['scenario'].filter((s): s is string => typeof s === 'string' && s.length > 0)\r\n if (phrases.length > 0) item.scenario = phrases\r\n }\r\n // A drifted rating (non-number, or outside the -1..5 domain) is dropped\r\n // rather than trusted: the row then simply looks unrated.\r\n const rating = raw['rating']\r\n if (typeof rating === 'number' && Number.isInteger(rating) && rating >= -1 && rating <= 5) item.rating = rating\r\n // A non-string body is dropped rather than trusted: the bubble then says so.\r\n if (typeof raw['body'] === 'string') item.body = raw['body']\r\n // Only true is written; anything else reads back as absent (= alive).\r\n if (raw['retired'] === true) item.retired = true\r\n // Same discipline for the compaction marker: absent means \"still in context\".\r\n if (raw['superseded'] === true) item.superseded = true\r\n return item\r\n}\r\n\r\n/**\r\n * Narrow a raw projection value into a recall view.\r\n *\r\n * `undefined` means the capability is ABSENT (prime-memory not in the\r\n * composition, or no frame carried the key) or the frame drifted beyond repair;\r\n * a view with `items: []` IS the honest empty state (prime-memory publishes as\r\n * soon as the unit registers). Malformed items are dropped, never thrown on.\r\n *\r\n * @param value - the raw `unknown` snapshot of the `memoryRecall` face.\r\n * @returns the validated view, or `undefined` when the capability is absent.\r\n */\r\nexport function readRecall(value: unknown): MemoryRecallView | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as Record<string, unknown>\r\n if (!isCounter(raw['rev']) || !isCounter(raw['count'])) return undefined\r\n if (typeof raw['sessionId'] !== 'string') return undefined\r\n if (!Array.isArray(raw['items'])) return undefined\r\n const items: MemoryRecallItem[] = []\r\n for (const entry of raw['items']) {\r\n const item = readItem(entry)\r\n if (item !== undefined) items.push(item)\r\n }\r\n return { rev: raw['rev'], sessionId: raw['sessionId'], count: raw['count'], items }\r\n}\r\n","/**\r\n * The `memorySlots` projection — reading it.\r\n *\r\n * The projection unit is registered by `dsh-prime-memory` (key `memorySlots`,\r\n * wire view `{rev, count, openCount, slots[]}`); this plugin does NOT depend\r\n * on it — when the unit is not registered the client reads `undefined` from\r\n * `faceOf` and the section hides. This module is the read side of that\r\n * contract and is deliberately PURE — no React, no context, no IO — so the\r\n * narrowing can be tested directly.\r\n *\r\n * Forward compatibility: the shipped view carries `{id, title, kind, status,\r\n * priority}` only. A future prime-memory release may add `body`/`refs` to the\r\n * wire view (its projection plan keeps that door open); those fields are\r\n * narrowed opportunistically — present and well-formed → kept, absent or\r\n * malformed → dropped — so the section renders them without a brief-sidebar\r\n * change, and a malformed extra field can never blank the section.\r\n */\r\n\r\n/** The projection key `dsh-prime-memory` registers (its canonical constant). */\r\nexport const MEMORY_SLOTS_KEY = 'memorySlots'\r\n\r\n/** One slot of the wire view. */\r\nexport interface MemorySlotView {\r\n readonly id: string\r\n readonly title: string\r\n /** One of prime-memory's `SLOT_KINDS`: rule / todo / anchor / pointer. */\r\n readonly kind: string\r\n /** One of prime-memory's `SLOT_STATUSES`: open / done / dropped / expired. */\r\n readonly status: string\r\n /** 0–100; higher wins the activation competition. */\r\n readonly priority: number\r\n /** Slot body, once prime-memory exposes it on the wire (truncated at render). */\r\n readonly body?: string\r\n /** Reference targets, once prime-memory exposes them on the wire. */\r\n readonly refs?: readonly string[]\r\n /**\r\n * record_id 引用的展示解析(v0.5.0 契约:ref → `[type] 名称简述`),由\r\n * prime-memory 在投影帧构建时解析;路径/URL 类引用不产生条目。存在才收。\r\n */\r\n readonly refViews?: readonly SlotRefView[]\r\n}\r\n\r\n/** 一条 record_id 引用的展示解析(与 prime-memory 的 SlotRefView 同形)。 */\r\nexport interface SlotRefView {\r\n readonly ref: string\r\n readonly title: string\r\n /** 记忆文件相对路径(`<type>/<name>.memory.md`)。 */\r\n readonly filePath?: string\r\n /** 记忆归属的工作区绝对路径;undefined = global。 */\r\n readonly workspaceId?: string\r\n}\r\n\r\n/** The whole wire view of one frame. */\r\nexport interface MemorySlotsView {\r\n readonly rev: number\r\n readonly count: number\r\n readonly openCount: number\r\n readonly slots: readonly MemorySlotView[]\r\n}\r\n\r\n/**\r\n * Narrow a raw projection value into a memory-slots view.\r\n *\r\n * Two outcomes are kept apart, mirroring the deliverables read side:\r\n * - `undefined` — the capability is ABSENT (prime-memory is not in the\r\n * composition, or no frame has carried the key yet), or the frame is\r\n * malformed beyond repair (a shape drift must not blank the whole tab);\r\n * - a view — the projection is live. A view with `slots: []` IS the empty\r\n * state: prime-memory publishes as soon as the unit registers, so \"present\r\n * but empty\" is a real value, not a sentinel.\r\n *\r\n * Malformed slot entries are dropped rather than thrown on (trusted-Host\r\n * value, defensive display), like `readTodos`.\r\n *\r\n * @param value - the raw `unknown` snapshot of the `memorySlots` face.\r\n * @returns the validated view, or `undefined` when the capability is absent.\r\n */\r\nexport function readSlots(value: unknown): MemorySlotsView | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as Record<string, unknown>\r\n if (!isCounter(raw['rev']) || !isCounter(raw['count']) || !isCounter(raw['openCount'])) return undefined\r\n if (!Array.isArray(raw['slots'])) return undefined\r\n const slots: MemorySlotView[] = []\r\n for (const entry of raw['slots']) {\r\n const slot = readSlot(entry)\r\n if (slot !== undefined) slots.push(slot)\r\n }\r\n return { rev: raw['rev'], count: raw['count'], openCount: raw['openCount'], slots }\r\n}\r\n\r\n/** Whether a value is a non-negative safe integer (the view's counter shape). */\r\nfunction isCounter(value: unknown): value is number {\r\n return typeof value === 'number' && Number.isSafeInteger(value) && value >= 0\r\n}\r\n\r\n/** Narrow one slot entry; `undefined` = malformed, dropped. */\r\nfunction readSlot(value: unknown): MemorySlotView | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as Record<string, unknown>\r\n if (typeof raw['id'] !== 'string' || raw['id'].length === 0) return undefined\r\n if (typeof raw['title'] !== 'string') return undefined\r\n if (typeof raw['kind'] !== 'string' || typeof raw['status'] !== 'string') return undefined\r\n if (typeof raw['priority'] !== 'number') return undefined\r\n const slot: { -readonly [K in keyof MemorySlotView]: MemorySlotView[K] } = {\r\n id: raw['id'],\r\n title: raw['title'],\r\n kind: raw['kind'],\r\n status: raw['status'],\r\n priority: raw['priority'],\r\n }\r\n if (typeof raw['body'] === 'string' && raw['body'].length > 0) slot.body = raw['body']\r\n if (Array.isArray(raw['refs'])) {\r\n const refs = raw['refs'].filter((ref): ref is string => typeof ref === 'string' && ref.length > 0)\r\n if (refs.length > 0) slot.refs = refs\r\n }\r\n if (Array.isArray(raw['refViews'])) {\r\n const views: SlotRefView[] = []\r\n for (const entry of raw['refViews']) {\r\n if (entry === null || typeof entry !== 'object' || Array.isArray(entry)) continue\r\n const view = entry as Record<string, unknown>\r\n if (typeof view['ref'] !== 'string' || view['ref'].length === 0) continue\r\n if (typeof view['title'] !== 'string' || view['title'].length === 0) continue\r\n views.push({\r\n ref: view['ref'],\r\n title: view['title'],\r\n ...(typeof view['filePath'] === 'string' && view['filePath'].length > 0 ? { filePath: view['filePath'] } : {}),\r\n ...(typeof view['workspaceId'] === 'string' && view['workspaceId'].length > 0 ? { workspaceId: view['workspaceId'] } : {}),\r\n })\r\n }\r\n if (views.length > 0) slot.refViews = views\r\n }\r\n return slot\r\n}\r\n\r\n/** The body length at which the section truncates (full text rides the title tooltip). */\r\nexport const BODY_TRUNCATE_AT = 120\r\n\r\n/**\r\n * One-line truncation for a slot body. Already-short bodies pass through;\r\n * longer ones are cut at the limit with an ellipsis.\r\n */\r\nexport function truncateBody(body: string, limit = BODY_TRUNCATE_AT): string {\r\n const flat = body.replaceAll(/\\s+/g, ' ').trim()\r\n return flat.length <= limit ? flat : `${flat.slice(0, limit)}…`\r\n}\r\n","/**\r\n * Structural views of the `configForms` settings seam (DSH 0.1.7+).\r\n *\r\n * The settings card and the memory-section gate consume only these members of\r\n * the `ConfigForm` handle that `configForms.get(entryId)` returns, so the real\r\n * `@deepseek-ai/dsh-client-ui-settings/client` type graph is never imported —\r\n * the same reason `use-projection.ts` declares its own session faces and\r\n * `dock-shadow.tsx` its own slots face.\r\n *\r\n * `configForms` serves the STORED doc: a `.volatile()` field arrives as a\r\n * plain value here (the host unwraps the live refs before persistence), so\r\n * the client reads a plain config shape.\r\n */\r\n\r\n/** One snapshot of an entry's stored config. */\r\nexport interface SettingsScopeSnapshot<T> {\r\n status: 'loading' | 'ready' | 'unavailable'\r\n value: T | undefined\r\n revision: number | undefined\r\n /** Whether the current face may write (a read-only seat disables the controls). */\r\n writable: boolean\r\n}\r\n\r\n/** The `ConfigForm` handle face this plugin uses. */\r\nexport interface SettingsScope<T> {\r\n getSnapshot(): SettingsScopeSnapshot<T>\r\n subscribe(listener: () => void): () => void\r\n set(field: string, value: unknown): Promise<boolean>\r\n unset(field: string): Promise<boolean>\r\n}\r\n\r\n/** Structural view of the `configForms` cordis service, keyed by entry id. */\r\nexport interface ConfigFormsLike {\r\n get<T>(entryId: string): SettingsScope<T>\r\n}\r\n\r\n/**\r\n * This plugin's entry config, as the client reads it. Only the fields the\r\n * browser half consumes are declared; the schema (node half `Config`) owns\r\n * the full surface.\r\n */\r\nexport interface BriefClientConfig {\r\n /** Whether the summary tab renders the memory-slots section (default: off). */\r\n showMemorySlots?: boolean\r\n /** Whether the summary tab renders the session-recall section (default: on). */\r\n showMemoryRecall?: boolean\r\n /** Whether the reference pane keeps the echo tab (default: on). */\r\n showSpiritEcho?: boolean\r\n}\r\n\r\n/**\r\n * The slots switch's default. Flipped to OFF alongside prime-memory's\r\n * `memoryRecall` projection: a hand-pinned resident convention is a real\r\n * feature, but listing it as a permanent card in the summary pane taught\r\n * users to read \"memory\" as \"resident\", which is the opposite of how recall\r\n * works. The section still only appears when the `memorySlots` projection\r\n * exists, and stays one click away for anyone who wants it back.\r\n */\r\nexport const DEFAULT_SHOW_MEMORY_SLOTS = false\r\n\r\n/** The session-recall switch's default (on: it is the honest memory view). */\r\nexport const DEFAULT_SHOW_MEMORY_RECALL = true\r\n\r\n/**\r\n * Resolve the switch from one snapshot (pure; testable). Any\r\n * cannot-answer shape falls back to {@link DEFAULT_SHOW_MEMORY_SLOTS}; an\r\n * explicit `false` is the only off.\r\n */\r\nexport function resolveShowMemorySlots(\r\n snapshot: SettingsScopeSnapshot<BriefClientConfig> | undefined,\r\n): boolean {\r\n if (snapshot === undefined || snapshot.status !== 'ready') return DEFAULT_SHOW_MEMORY_SLOTS\r\n return snapshot.value?.showMemorySlots === true\r\n}\r\n\r\n/**\r\n * Resolve the session-recall switch from one snapshot (pure; testable).\r\n * Any cannot-answer shape falls back to {@link DEFAULT_SHOW_MEMORY_RECALL};\r\n * an explicit `false` is the only off.\r\n */\r\nexport function resolveShowMemoryRecall(\r\n snapshot: SettingsScopeSnapshot<BriefClientConfig> | undefined,\r\n): boolean {\r\n if (snapshot === undefined || snapshot.status !== 'ready') return DEFAULT_SHOW_MEMORY_RECALL\r\n return snapshot.value?.showMemoryRecall !== false\r\n}\r\n\r\n/** The echo tab's default (on: it is the honest view of this session's recall). */\r\nexport const DEFAULT_SHOW_SPIRIT_ECHO = true\r\n\r\n/**\r\n * Resolve the echo-tab switch from one snapshot (pure; testable). Any\r\n * cannot-answer shape falls back to {@link DEFAULT_SHOW_SPIRIT_ECHO}; an\r\n * explicit `false` is the only off — same rule as the two memory switches.\r\n */\r\nexport function resolveShowSpiritEcho(\r\n snapshot: SettingsScopeSnapshot<BriefClientConfig> | undefined,\r\n): boolean {\r\n if (snapshot === undefined || snapshot.status !== 'ready') return DEFAULT_SHOW_SPIRIT_ECHO\r\n return snapshot.value?.showSpiritEcho !== false\r\n}\r\n","/**\r\n * The shared `configForms` subscription behind this plugin's section switches.\r\n *\r\n * Both memory sections (pinned slots / session recall) gate on one boolean of\r\n * this plugin's entry config. The plumbing — defensive scope resolution,\r\n * `useSyncExternalStore`, and a stable absent-snapshot — is identical, so it\r\n * lives here once; each section passes its own pure resolver, which is what\r\n * the unit tests pin.\r\n *\r\n * A host without `configForms` (or a scope still loading) degrades to the\r\n * resolver's default instead of throwing inside a render.\r\n */\r\nimport { useCallback, useMemo, useSyncExternalStore } from 'react'\r\nimport type { CtxProbe } from '../use-projection'\r\nimport type { BriefClientConfig, ConfigFormsLike, SettingsScopeSnapshot } from '../scope-face'\r\n\r\n/**\r\n * The snapshot served while no config scope is reachable — every resolver\r\n * maps it to its own default.\r\n */\r\nconst ABSENT_SNAPSHOT: SettingsScopeSnapshot<BriefClientConfig> = {\r\n status: 'unavailable',\r\n value: undefined,\r\n revision: undefined,\r\n writable: false,\r\n}\r\n\r\n/** A no-op unsubscribe source, kept as one identity so the absent-scope\r\n * subscription never thrashes (a store contract requires a disposer). */\r\nconst NO_SUBSCRIBE = (): (() => void) => () => {}\r\n\r\n/**\r\n * Read one config switch, live.\r\n *\r\n * @param ctx - the client root context handed to the tab body.\r\n * @param resolve - pure snapshot → boolean resolver (owns the default).\r\n * @returns the resolved switch value.\r\n */\r\nexport function useConfigFlag(\r\n ctx: CtxProbe | undefined,\r\n resolve: (snapshot: SettingsScopeSnapshot<BriefClientConfig> | undefined) => boolean,\r\n): boolean {\r\n const scope = useMemo(() => {\r\n if (ctx === undefined) return undefined\r\n const configForms = ctx.get('configForms') as ConfigFormsLike | undefined\r\n if (configForms === undefined || typeof configForms.get !== 'function') return undefined\r\n return configForms.get<BriefClientConfig>('dsh-brief-sidebar')\r\n }, [ctx])\r\n\r\n const subscribe = useCallback(\r\n (listener: () => void) => scope?.subscribe(listener) ?? NO_SUBSCRIBE(),\r\n [scope],\r\n )\r\n const getSnapshot = useCallback(\r\n () => scope?.getSnapshot() ?? ABSENT_SNAPSHOT,\r\n [scope],\r\n )\r\n\r\n return resolve(useSyncExternalStore(subscribe, getSnapshot, getSnapshot))\r\n}\r\n","/**\r\n * The skill-usage section: the `dshSummarySkillUsage` projection drawn as one\r\n * part of the summary tab.\r\n *\r\n * Where `MemoryRecallSection` answers \"what memories did the model see\", this\r\n * answers \"which instruction packs entered the context, and which ones were on\r\n * the menu\". Two groups, deliberately not merged:\r\n *\r\n * - **已引用** — the skill's instructions reached the conversation, either\r\n * because the model called the `skill` tool or because the user invoked it\r\n * directly (the host then injects `<skill_content>` and tells the model not\r\n * to call the tool — reading only the tool would miss over half of those\r\n * sessions, measured on 250 real ones).\r\n * - **本会话可用** — the session's current catalog. Available is NOT used: the\r\n * model may never touch any of these, so it is collapsed behind a counted\r\n * toggle and never mixed into the reference rows.\r\n *\r\n * Like the deliverables section this is an OPTIONAL capability on both sides:\r\n * no projection registry (or a host half that never registered the unit) means\r\n * the client reads capability absence and the section hides. No settings switch\r\n * gates it either — the list is a read-only fact about the session, not a\r\n * preference.\r\n *\r\n * Two contracts this row honours, both learned on the recall section:\r\n * - **no native `title` attribute** — it paints an unskinable tooltip that\r\n * overlaps the plugin's own bubble; nothing here needs one;\r\n * - **colours from `--dsw-alias-*` tokens only** (skin contract).\r\n */\r\nimport { createElement } from 'react'\r\nimport { useState } from 'react'\r\nimport type { CSSProperties, ReactNode } from 'react'\r\nimport type { CtxProbe } from '../use-projection'\r\nimport { SKILL_USAGE_KEY } from '../../projection/keys'\r\nimport { useProjectionValue } from '../use-projection'\r\nimport { availableExcept, expandPair, readSkillUsage } from './skill-usage'\r\nimport { GroupCaption, GroupHeader, FoldToggle } from './FoldToggle'\r\nimport { expandCount } from '../locales'\r\n\r\nexport interface SkillUsageSectionProps {\r\n /** The DSH locale lookup, passed down from `apply`. */\r\n t: (key: string) => string\r\n /** The client root context (the tab body's only way to reach services). */\r\n ctx?: CtxProbe\r\n /** The session this tab is scoped to. */\r\n scope?: { readonly sessionId?: string }\r\n /**\r\n * Drop the section header. The references tab already says “技能”, so\r\n * repeating it as a heading inside the pane is noise; standalone renders\r\n * (and every existing test) keep the default `false`.\r\n */\r\n hideHeader?: boolean\r\n}\r\n\r\nconst SECTION_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n borderBottom: '1px solid var(--dsw-alias-border-secondary)',\r\n}\r\n\r\nconst HEADER_STYLE: CSSProperties = {\r\n padding: '10px 12px 0',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n fontSize: 12,\r\n fontWeight: 600,\r\n}\r\n\r\nconst LIST_STYLE: CSSProperties = {\r\n listStyle: 'none',\r\n margin: 0,\r\n padding: '6px 0',\r\n display: 'flex',\r\n flexDirection: 'column',\r\n}\r\n\r\nconst ROW_STYLE: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'baseline',\r\n gap: 8,\r\n padding: '6px 12px',\r\n}\r\n\r\n/** The skill name: primary-ish but never the loudest thing in the row. */\r\nconst NAME_STYLE: CSSProperties = {\r\n minWidth: 0,\r\n overflowWrap: 'anywhere',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n}\r\n\r\n/** The per-skill load tally, tertiary so the name stays the reading target. */\r\nconst COUNT_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 11,\r\n}\r\n\r\n/** The \"本轮\" pill: same form as the deliverables codeplan tag. */\r\nconst TAG_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n border: '1px solid var(--dsw-alias-label-tertiary)',\r\n borderRadius: 999,\r\n padding: '0 6px',\r\n fontSize: 11,\r\n lineHeight: '16px',\r\n whiteSpace: 'nowrap',\r\n}\r\n\r\nconst FOOTER_STYLE: CSSProperties = {\r\n padding: '0 12px 10px',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 11,\r\n}\r\n\r\nconst EMPTY_STYLE: CSSProperties = {\r\n margin: '0 auto',\r\n padding: 24,\r\n maxWidth: 460,\r\n textAlign: 'center',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n lineHeight: 1.7,\r\n fontSize: 12,\r\n}\r\n\r\n/**\r\n * The skill-usage section. The subscription is unconditional (a plain listener,\r\n * not IO); the view decides whether anything is drawn.\r\n *\r\n * @param props - translation, client context, session scope.\r\n */\r\nexport function SkillUsageSection(props: SkillUsageSectionProps): ReactNode {\r\n const { t, ctx, scope, hideHeader = false } = props\r\n const [availableOpen, setAvailableOpen] = useState(false)\r\n\r\n const view = readSkillUsage(useProjectionValue(ctx, scope?.sessionId, SKILL_USAGE_KEY))\r\n\r\n // Capability absent — the optional unit never registered. Hide, don't nag.\r\n if (view === undefined) return null\r\n\r\n const referenced = view.session.map(entry => entry.name)\r\n // 可用组只列未被引用的那些:同一个技能不该占两行。\r\n const rest = availableExcept(view.available, referenced)\r\n const latestNames = view.latest?.names ?? []\r\n\r\n return createElement(\r\n 'div',\r\n { style: SECTION_STYLE, 'data-dsh-brief-sidebar': 'skill-usage-section' },\r\n !hideHeader && createElement('div', { style: HEADER_STYLE }, t('section.skillUsage')),\r\n view.session.length === 0 && createElement(\r\n 'div',\r\n { style: EMPTY_STYLE },\r\n createElement('div', { style: { marginBottom: 6, color: 'var(--dsw-alias-label-secondary)' } }, t('skillUsage.empty')),\r\n createElement('div', null, t('skillUsage.emptyHint')),\r\n ),\r\n view.session.length > 0 && createElement(GroupHeader, {\r\n text: expandCount(t('skillUsage.invokedGroup'), view.session.length),\r\n marker: 'skill-usage-invoked-group',\r\n }),\r\n createElement(\r\n 'ul',\r\n { style: LIST_STYLE },\r\n view.session.map(entry => createElement(\r\n 'li',\r\n { key: entry.name, style: ROW_STYLE, 'data-dsh-brief-sidebar': 'skill-usage-row' },\r\n createElement('span', { style: NAME_STYLE }, entry.name),\r\n createElement('span', { style: COUNT_STYLE }, expandPair(t('skillUsage.uses'), entry.count, entry.count)),\r\n latestNames.includes(entry.name) && createElement('span', { style: TAG_STYLE }, t('skillUsage.latestTag')),\r\n )),\r\n ),\r\n rest.length > 0 && createElement(FoldToggle, {\r\n label: expandCount(t('skillUsage.availableGroup'), rest.length),\r\n open: availableOpen,\r\n marker: 'skill-usage-available-toggle',\r\n onToggle: () => { setAvailableOpen(current => !current) },\r\n }),\r\n // 清单有上限:开关行说收了多少个名字,附注说这一帧真发了多少。\r\n rest.length > 0 && view.availableCount > view.available.length && createElement(GroupCaption, {\r\n text: expandCount(t('skillUsage.availableCapped'), view.availableCount),\r\n marker: 'skill-usage-available-capped',\r\n }),\r\n availableOpen && createElement(\r\n 'ul',\r\n { style: LIST_STYLE },\r\n rest.map(name => createElement(\r\n 'li',\r\n { key: name, style: ROW_STYLE, 'data-dsh-brief-sidebar': 'skill-usage-available-row' },\r\n createElement('span', { style: NAME_STYLE }, name),\r\n )),\r\n ),\r\n // 列表有上限,页脚说真数:加载次数与去重后的技能数各归各。\r\n view.session.length > 0 && createElement('div', { style: FOOTER_STYLE }, expandPair(t('skillUsage.count'), view.callTotal, view.sessionTotal)),\r\n )\r\n}\r\n","/**\r\n * The search-reference section: the `dshSummarySearchRefs` projection drawn as\r\n * one tab of the references section.\r\n *\r\n * It answers \"what did this session pull in from outside\" as a list of the\r\n * questions the session asked: **one line per query, every one folded**. Opening\r\n * a line reveals that query's results as left-aligned bubbles — title as a link,\r\n * host and provider snippet under it — in the same reading idiom as the\r\n * conversation to the left.\r\n *\r\n * Folded-by-default is a deliberate call, not a leftover: a tab that spills its\r\n * whole result set the moment it is clicked buries the question list the reader\r\n * came to scan, and one session can carry forty results across eight queries.\r\n *\r\n * Each line counts what it actually holds, never what the call returned: a query\r\n * whose results aged out of the capped source list reads \"0\" and is drawn as a\r\n * plain line with no chevron, because a switch that opens onto nothing is worse\r\n * than no switch. Sources no listed query claims (their query aged out, or the\r\n * frame predates the cluster change) collect in a tail group rather than vanish.\r\n *\r\n * The fold still records which tool (`web_search` or the user's own\r\n * `advanced_search`) answered each query; that stays in the frame for any surface\r\n * that wants it and is not drawn here. An older `dsh-free-search` without\r\n * `presentationMeta` yields queries with no sources at all — that degraded case\r\n * is stated (`searchRefs.noSourcesHint`) rather than left as an empty pane,\r\n * because an empty list reads as \"the search found nothing\".\r\n *\r\n * Optional on both sides: no registry, or a host half that never registered the\r\n * unit, means the client reads capability absence and the section hides.\r\n *\r\n * Two contracts inherited from the recall section:\r\n * - **no native `title` attribute** — the whole text rides the row or is left\r\n * out; an unskinable tooltip would overlap the plugin's own surfaces;\r\n * - **colours from `--dsw-alias-*` tokens only** (skin contract).\r\n *\r\n * Source links are untrusted external data, so only `http`/`https` become\r\n * anchors (see `safeHref`) and they open with `rel=\"noreferrer noopener\"`.\r\n */\r\nimport { createElement, useState } from 'react'\r\nimport type { CSSProperties, ReactNode } from 'react'\r\nimport type { CtxProbe } from '../use-projection'\r\nimport { SEARCH_REFS_KEY } from '../../projection/keys'\r\nimport type { SearchRefItemView } from '../../projection/keys'\r\nimport { useProjectionValue } from '../use-projection'\r\nimport { FoldToggle, GroupHeader } from './FoldToggle'\r\nimport { expandCount, expandTotal } from '../locales'\r\nimport { clusterByQuery, isLatestSource, readSearchRefs, safeHref } from './search-refs'\r\n\r\nexport interface SearchRefSectionProps {\r\n /** The DSH locale lookup, passed down from `apply`. */\r\n t: (key: string) => string\r\n /** The client root context (the tab body's only way to reach services). */\r\n ctx?: CtxProbe\r\n /** The session this tab is scoped to. */\r\n scope?: { readonly sessionId?: string }\r\n /** Drop the section header (the references tab already names it). */\r\n hideHeader?: boolean\r\n}\r\n\r\nconst SECTION_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n borderBottom: '1px solid var(--dsw-alias-border-secondary)',\r\n}\r\n\r\nconst HEADER_STYLE: CSSProperties = {\r\n padding: '10px 12px 0',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n fontSize: 12,\r\n fontWeight: 600,\r\n}\r\n\r\nconst LIST_STYLE: CSSProperties = {\r\n listStyle: 'none',\r\n margin: 0,\r\n padding: '8px 12px 10px',\r\n display: 'flex',\r\n flexDirection: 'column',\r\n alignItems: 'flex-start',\r\n gap: 8,\r\n}\r\n\r\n/**\r\n * One result, drawn as a chat bubble: left-aligned, background-filled, rounded,\r\n * and narrower than the column. The reader reads this tab the way they read the\r\n * conversation to its left — each bubble is one thing the session pulled in — so\r\n * the list chrome (row rules, group headers, per-query title lines) is dropped\r\n * rather than restyled.\r\n *\r\n * `alignItems: flex-start` on the list is what keeps bubbles hugging the left\r\n * edge; without it a flex child stretches to the full column and the bubble\r\n * reads as a plain card.\r\n */\r\nconst BUBBLE_STYLE: CSSProperties = {\r\n maxWidth: '92%',\r\n padding: '8px 10px',\r\n borderRadius: 10,\r\n background: 'var(--dsw-alias-bg-layer-3)',\r\n border: '1px solid var(--dsw-alias-border-l2)',\r\n color: 'var(--dsw-alias-label-primary)',\r\n fontSize: 12,\r\n lineHeight: '17px',\r\n minWidth: 0,\r\n display: 'flex',\r\n flexDirection: 'column',\r\n gap: 2,\r\n}\r\n\r\n/** The source title, up to three lines: inside a bubble it IS the content. */\r\nconst TITLE_STYLE: CSSProperties = {\r\n minWidth: 0,\r\n overflowWrap: 'anywhere',\r\n display: '-webkit-box',\r\n WebkitLineClamp: 3,\r\n WebkitBoxOrient: 'vertical',\r\n overflow: 'hidden',\r\n}\r\n\r\nconst SNIPPET_STYLE: CSSProperties = {\r\n margin: 0,\r\n minWidth: 0,\r\n overflowWrap: 'anywhere',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 11,\r\n lineHeight: '16px',\r\n}\r\n\r\nconst HOST_STYLE: CSSProperties = {\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 11,\r\n lineHeight: '16px',\r\n overflowWrap: 'anywhere',\r\n}\r\n\r\n/** The bubble's own footer strip — where the \"本轮\" pill lives now. */\r\nconst BUBBLE_FOOT_STYLE: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'center',\r\n gap: 6,\r\n marginTop: 2,\r\n minWidth: 0,\r\n}\r\n\r\n/** The \"本轮\" pill: same form as the skill tag, tertiary emphasis. */\r\nconst TAG_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n border: '1px solid var(--dsw-alias-label-tertiary)',\r\n borderRadius: 999,\r\n padding: '0 6px',\r\n fontSize: 11,\r\n lineHeight: '16px',\r\n whiteSpace: 'nowrap',\r\n}\r\n\r\nconst FOOTER_STYLE: CSSProperties = {\r\n padding: '0 12px 10px',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 11,\r\n}\r\n\r\nconst EMPTY_STYLE: CSSProperties = {\r\n margin: '0 auto',\r\n padding: 24,\r\n maxWidth: 460,\r\n textAlign: 'center',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n lineHeight: 1.7,\r\n fontSize: 12,\r\n}\r\n\r\n/**\r\n * The search-reference section. The subscription is unconditional (a plain\r\n * listener, not IO); the view decides whether anything is drawn.\r\n *\r\n * @param props - translation, client context, session scope, header switch.\r\n */\r\nexport function SearchRefSection(props: SearchRefSectionProps): ReactNode {\r\n const { t, ctx, scope, hideHeader = false } = props\r\n\r\n const view = readSearchRefs(useProjectionValue(ctx, scope?.sessionId, SEARCH_REFS_KEY))\r\n\r\n // Which clusters the reader has opened, keyed by query text. The default is\r\n // **folded for every one of them** — including the current turn's — because a\r\n // tab that dumps its contents the moment it is clicked is a tab the reader has\r\n // to fight. Keying the overrides means new projection frames cannot reset what\r\n // they just opened.\r\n const [openMap, setOpenMap] = useState<Readonly<Record<string, boolean>>>({})\r\n\r\n // Capability absent — the optional unit never registered. Hide, don't nag.\r\n if (view === undefined) return null\r\n\r\n if (view.queries.length === 0 && view.sources.length === 0) {\r\n return createElement(\r\n 'div',\r\n { style: SECTION_STYLE, 'data-dsh-brief-sidebar': 'search-refs-section' },\r\n !hideHeader && createElement('div', { style: HEADER_STYLE }, t('section.searchRefs')),\r\n createElement(\r\n 'div',\r\n { style: EMPTY_STYLE },\r\n createElement('div', { style: { marginBottom: 6, color: 'var(--dsw-alias-label-secondary)' } }, t('searchRefs.empty')),\r\n createElement('div', null, t('searchRefs.emptyHint')),\r\n ),\r\n )\r\n }\r\n\r\n const body: ReactNode[] = []\r\n\r\n /** One result bubble; shared by every cluster so the cards stay identical. */\r\n const renderBubble = (item: SearchRefItemView): ReactNode => {\r\n const href = safeHref(item.url)\r\n const label = item.title ?? item.url\r\n const link = href === undefined\r\n // A non-web scheme (or a malformed URL) from a provider stays text:\r\n // it must not become a clickable thing in the user's sidebar.\r\n ? createElement('span', { style: TITLE_STYLE }, label)\r\n : createElement(\r\n 'a',\r\n { style: TITLE_STYLE, href, target: '_blank', rel: 'noreferrer noopener' },\r\n label,\r\n )\r\n const latest = isLatestSource(view, item.url)\r\n return createElement(\r\n 'li',\r\n { key: item.url, style: { minWidth: 0 }, 'data-dsh-brief-sidebar': 'search-refs-source' },\r\n createElement(\r\n 'div',\r\n { style: BUBBLE_STYLE, 'data-dsh-brief-sidebar': 'search-refs-bubble' },\r\n link,\r\n createElement('span', { style: HOST_STYLE }, item.host),\r\n item.snippet !== undefined && createElement('p', { style: SNIPPET_STYLE }, item.snippet),\r\n // The pill sits inside the bubble so a result and its freshness\r\n // cannot drift apart when the column scrolls.\r\n (latest || item.count > 1) && createElement(\r\n 'div',\r\n { style: BUBBLE_FOOT_STYLE },\r\n latest && createElement('span', { style: TAG_STYLE }, t('searchRefs.latestTag')),\r\n // Surfaced by more than one settled search — a fact about the\r\n // source, drawn on it rather than in a header the tab no longer\r\n // has. No new locale key: the count speaks for itself.\r\n item.count > 1 && createElement('span', { style: HOST_STYLE }, `\\u00d7${item.count}`),\r\n ),\r\n ),\r\n )\r\n }\r\n\r\n if (view.sources.length > 0) {\r\n // Results clustered under the query that surfaced them, every cluster folded\r\n // to one line. Eight searches read as eight questions and nothing else; the\r\n // reader opens the one they care about.\r\n for (const cluster of clusterByQuery(view)) {\r\n const key = cluster.query === '' ? '\\u0000tail' : cluster.query\r\n // The count on a heading is the count *inside* it. The fold's `hits` is\r\n // what the call returned session-wide; a source can since have aged out of\r\n // the capped list, and a heading promising five cards over an empty pane\r\n // is the bug this line exists to prevent.\r\n const shown = expandCount(t('searchRefs.hits'), cluster.items.length)\r\n if (cluster.items.length === 0) {\r\n // Nothing to open: a plain line, not a chevron that reveals an empty\r\n // group. The query still shows, because \"it was asked\" is the fact. (A\r\n // tail group never gets here — it only exists when it holds sources.)\r\n body.push(createElement(GroupHeader, {\r\n key: `h:${key}`,\r\n text: `${cluster.query} · ${shown}`,\r\n marker: 'search-refs-cluster-empty',\r\n }))\r\n continue\r\n }\r\n const open = openMap[key] === true\r\n body.push(createElement(FoldToggle, {\r\n key: `h:${key}`,\r\n // The tail group has no query to name it, so it borrows the source\r\n // count heading — “来源 · N” is exactly what it holds, and no locale key\r\n // gets spent on a case that only shows up when a query aged out of the\r\n // capped list.\r\n label: cluster.query === ''\r\n ? expandCount(t('searchRefs.sourceGroup'), cluster.items.length)\r\n : `${cluster.query} · ${shown}`,\r\n open,\r\n marker: 'search-refs-cluster',\r\n onToggle: () => { setOpenMap(prev => ({ ...prev, [key]: !open })) },\r\n }))\r\n if (!open) continue\r\n body.push(createElement(\r\n 'ul',\r\n { key: `b:${key}`, style: LIST_STYLE, 'data-dsh-brief-sidebar': 'search-refs-cluster-items' },\r\n cluster.items.map(renderBubble),\r\n ))\r\n }\r\n } else {\r\n // 有查询无来源:老版 dsh-free-search 不发 meta。说清楚,别让人以为搜了没结果。\r\n body.push(createElement(\r\n 'div',\r\n { key: 'ns', style: FOOTER_STYLE, 'data-dsh-brief-sidebar': 'search-refs-no-sources' },\r\n t('searchRefs.noSourcesHint'),\r\n ))\r\n }\r\n\r\n // 列表有上限,页脚说真数:只有真数超过列表长度时才出现,免得两个数字打架。\r\n if (view.queryTotal > view.queries.length || view.sourceTotal > view.sources.length) {\r\n body.push(createElement(\r\n 'div',\r\n { key: 'cap', style: FOOTER_STYLE, 'data-dsh-brief-sidebar': 'search-refs-capped' },\r\n expandTotal(t('searchRefs.capped'), Math.max(view.queryTotal, view.sourceTotal)),\r\n ))\r\n }\r\n\r\n return createElement(\r\n 'div',\r\n { style: SECTION_STYLE, 'data-dsh-brief-sidebar': 'search-refs-section' },\r\n !hideHeader && createElement('div', { style: HEADER_STYLE }, t('section.searchRefs')),\r\n ...body,\r\n )\r\n}\r\n","/**\r\n * The write channel back into `dsh-prime-memory`: rating one recalled memory.\r\n *\r\n * This is the FIRST write this plugin performs, and deliberately the only one.\r\n * Reading goes through the host's projection face (`memoryRecall`); there is no\r\n * projection for writes, so the mark travels over prime-memory's own client RPC\r\n * route — `POST /dsh-memory/rpc/<method>`, the same envelope its panel uses.\r\n * That is a cross-plugin HTTP contract, so everything that makes it safe to\r\n * hold lives here:\r\n *\r\n * - **Optional by construction.** A composition without dsh-prime-memory, or an\r\n * older one without this endpoint, answers 404/405. That is reported as\r\n * `absent`, and the section stops offering the control instead of failing on\r\n * every click.\r\n * - **No invented semantics.** `-1` and `0..5` are prime-memory's domain; this\r\n * module refuses anything else locally so a bad click cannot reach the server.\r\n * - **Nothing is optimistic about retirement.** The caller only hides a row\r\n * after the server confirms `retired` — a lost request must not silently\r\n * remove a memory from view.\r\n *\r\n * `fetch` is injected so the parse and the status mapping are testable without\r\n * a browser.\r\n */\r\n\r\n/** The route prime-memory's server half registers for its client RPC surface. */\r\nexport const RECALL_FEEDBACK_ROUTE = '/dsh-memory/rpc/recall-feedback'\r\n\r\n/** A relevance mark (`0..5`) or `-1` = \"this is obsolete\", prime-memory's domain. */\r\nexport const FEEDBACK_SCORES = [-1, 0, 1, 2, 3, 4, 5] as const\r\nexport type FeedbackScore = (typeof FEEDBACK_SCORES)[number]\r\n\r\n/** Whether a value is a score this plugin is allowed to send. */\r\nexport function isFeedbackScore(value: unknown): value is FeedbackScore {\r\n return typeof value === 'number' && (FEEDBACK_SCORES as readonly number[]).includes(value)\r\n}\r\n\r\n/** How long to wait before giving up on one click. */\r\nexport const FEEDBACK_TIMEOUT_MS = 8_000\r\n\r\n/**\r\n * Outcome of one rating attempt.\r\n *\r\n * `absent` is NOT an error to show the user — it means the capability is not\r\n * there (prime-memory missing or older), and the caller should stop offering\r\n * the control. `rejected` carries prime-memory's own reason (e.g. \"this memory\r\n * is no longer in the session's recall set\"), which is worth surfacing.\r\n */\r\nexport type FeedbackOutcome =\r\n | {\r\n readonly status: 'sent'\r\n readonly retired: boolean\r\n readonly announced: boolean\r\n readonly mean: number\r\n readonly rated: number\r\n }\r\n | { readonly status: 'rejected'; readonly reason: string }\r\n | { readonly status: 'absent' }\r\n | { readonly status: 'transport'; readonly reason: string }\r\n\r\n/** The minimal fetch shape this module needs (global `fetch` satisfies it). */\r\nexport interface FeedbackFetch {\r\n (url: string, init: {\r\n method: 'POST'\r\n headers: Record<string, string>\r\n body: string\r\n signal?: AbortSignal\r\n }): Promise<{\r\n readonly ok: boolean\r\n readonly status: number\r\n json(): Promise<unknown>\r\n }>\r\n}\r\n\r\nexport interface FeedbackRequest {\r\n readonly sessionId: string\r\n readonly id: string\r\n readonly score: FeedbackScore\r\n}\r\n\r\n/** Whether a status code means \"no such route\" rather than \"the call failed\". */\r\nfunction isAbsentStatus(status: number): boolean {\r\n return status === 404 || status === 405 || status === 501\r\n}\r\n\r\n/** The host's RpcResult envelope, narrowed enough to read the two branches. */\r\nfunction parseEnvelope(value: unknown): { ok: true; value: Record<string, unknown> } | { ok: false; reason: string } | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as Record<string, unknown>\r\n if (raw['ok'] === true && raw['value'] !== null && typeof raw['value'] === 'object') {\r\n return { ok: true, value: raw['value'] as Record<string, unknown> }\r\n }\r\n if (raw['ok'] === false) {\r\n const err = raw['error']\r\n const message = err !== null && typeof err === 'object'\r\n ? (err as Record<string, unknown>)['message']\r\n : undefined\r\n return { ok: false, reason: typeof message === 'string' && message.length > 0 ? message : 'rejected' }\r\n }\r\n return undefined\r\n}\r\n\r\nfunction num(value: unknown): number {\r\n return typeof value === 'number' && Number.isFinite(value) ? value : 0\r\n}\r\n\r\n/**\r\n * Send one rating.\r\n *\r\n * Never throws: every failure mode comes back as a discriminated outcome, so a\r\n * click cannot break the render.\r\n */\r\nexport async function sendRecallFeedback(\r\n fetchImpl: FeedbackFetch | undefined,\r\n request: FeedbackRequest,\r\n): Promise<FeedbackOutcome> {\r\n if (typeof fetchImpl !== 'function') return { status: 'absent' }\r\n if (request.sessionId.length === 0 || request.id.length === 0) {\r\n return { status: 'rejected', reason: 'missing-session-or-id' }\r\n }\r\n if (!isFeedbackScore(request.score)) return { status: 'rejected', reason: 'invalid-score' }\r\n\r\n const abort = typeof AbortController === 'function' ? new AbortController() : undefined\r\n const timer = abort === undefined\r\n ? undefined\r\n : setTimeout(() => { abort.abort() }, FEEDBACK_TIMEOUT_MS)\r\n try {\r\n const response = await fetchImpl(RECALL_FEEDBACK_ROUTE, {\r\n method: 'POST',\r\n headers: { 'content-type': 'application/json' },\r\n body: JSON.stringify({ sessionId: request.sessionId, id: request.id, score: request.score }),\r\n ...(abort === undefined ? {} : { signal: abort.signal }),\r\n })\r\n if (!response.ok) {\r\n return isAbsentStatus(response.status)\r\n ? { status: 'absent' }\r\n : { status: 'transport', reason: `HTTP ${response.status}` }\r\n }\r\n let envelope: unknown\r\n try {\r\n envelope = await response.json()\r\n } catch {\r\n return { status: 'transport', reason: 'unparseable-response' }\r\n }\r\n const parsed = parseEnvelope(envelope)\r\n if (parsed === undefined) return { status: 'transport', reason: 'unexpected-envelope' }\r\n if (parsed.ok === false) return { status: 'rejected', reason: parsed.reason }\r\n const value = parsed.value\r\n const rating = value['rating'] !== null && typeof value['rating'] === 'object'\r\n ? value['rating'] as Record<string, unknown>\r\n : {}\r\n return {\r\n status: 'sent',\r\n retired: value['retired'] === true,\r\n announced: value['announced'] === true,\r\n mean: num(rating['mean']),\r\n rated: num(rating['rated']),\r\n }\r\n } catch (err) {\r\n const aborted = err instanceof Error && (err.name === 'AbortError' || err.name === 'TimeoutError')\r\n return { status: 'transport', reason: aborted ? 'timeout' : (err instanceof Error ? err.message : 'network') }\r\n } finally {\r\n if (timer !== undefined) clearTimeout(timer)\r\n }\r\n}\r\n","/**\r\n * The hover bubble for one recalled memory — the whole body, straight off the\r\n * projection frame, no second round-trip.\r\n *\r\n * Two shapes are load-bearing here:\r\n *\r\n * - **Stateless.** The section owns when a bubble opens and which row it shows;\r\n * this only draws what it is handed. No hooks, no buttons, no timers.\r\n * - **`position: fixed`.** The summary tab body is `overflow: auto`, so a box\r\n * absolutely positioned inside a row gets clipped by the scroller's border as\r\n * soon as the row sits near an edge. Fixed positioning plus `bubblePos`\r\n * clamping keeps the bubble inside the viewport instead, and anchored to the\r\n * row's *left* so it never lands on the list it describes.\r\n *\r\n * `pointerEvents: 'none'` is not decoration: a bubble that captures the mouse\r\n * would strand the very row it hovers over and leave the section unable to\r\n * receive the click that selects it.\r\n *\r\n * Colours come from `--dsw-alias-*` tokens only (skin contract, asserted by\r\n * `tests/purity.spec.ts`). There is no shadow token in that family, so the\r\n * bubble separates from the list by border and background layer rather than by\r\n * elevation — a literal `box-shadow` colour would break the contract.\r\n */\r\nimport { createElement, Fragment } from 'react'\r\nimport type { CSSProperties, ReactNode } from 'react'\r\nimport type { MemoryRecallItem } from './memory-recall'\r\nimport { expandCount } from '../locales'\r\n\r\n/** Bubble box size, mirrored by `bubblePos`'s defaults (keep the two in sync). */\r\nconst BUBBLE_W = 360\r\nconst BUBBLE_H = 220\r\n/** Viewport gutter kept on every side when clamping. */\r\nconst EDGE = 8\r\n\r\n/**\r\n * Clamp the bubble into the viewport.\r\n *\r\n * It opens to the **left** of the row on purpose. The sidebar is right-docked\r\n * and only a few hundred pixels wide, so the old \"anchor + 8\" placement dropped\r\n * the box straight onto the row it came from — covering that row's rating strip\r\n * (the bubble is click-transparent, so the buttons stayed clickable *under* it:\r\n * blind-clicking a score is not an option). Opening left puts the text over the\r\n * chat area and leaves the whole list readable.\r\n *\r\n * Order of preference: left of the row → right of the row (only when the row\r\n * sits so far left that the box would run off the window) → clamped inside the\r\n * viewport. Pure and total.\r\n *\r\n * @param r - the hovered row's rect (`top`/`left`/`right` are read).\r\n * @param vw - viewport width (`window.innerWidth`).\r\n * @param vh - viewport height (`window.innerHeight`).\r\n * @param w - bubble width.\r\n * @param h - bubble height.\r\n * @returns fixed-position coordinates for the bubble.\r\n */\r\nexport function bubblePos(\r\n r: { top: number; left: number; right?: number },\r\n vw: number,\r\n vh: number,\r\n w = BUBBLE_W,\r\n h = BUBBLE_H,\r\n): { top: number; left: number } {\r\n const right = r.right ?? r.left\r\n const preferred = r.left - w - EDGE\r\n const fallback = right + EDGE\r\n const roomOnLeft = preferred >= EDGE\r\n const roomOnRight = fallback + w <= vw - EDGE\r\n const unplaced = Math.min(preferred, fallback)\r\n const left = roomOnLeft\r\n ? preferred\r\n : roomOnRight\r\n ? fallback\r\n : unplaced\r\n return {\r\n left: Math.max(EDGE, Math.min(left, vw - w - EDGE)),\r\n top: Math.max(EDGE, Math.min(r.top, vh - h - EDGE)),\r\n }\r\n}\r\n\r\nconst BUBBLE_STYLE: CSSProperties = {\r\n position: 'fixed',\r\n pointerEvents: 'none',\r\n zIndex: 1000,\r\n maxWidth: BUBBLE_W,\r\n maxHeight: '45vh',\r\n overflow: 'hidden',\r\n padding: '8px 10px',\r\n borderRadius: 6,\r\n background: 'var(--dsw-alias-bg-layer-3)',\r\n border: '1px solid var(--dsw-alias-border-l2)',\r\n color: 'var(--dsw-alias-label-primary)',\r\n fontSize: 12,\r\n lineHeight: '17px',\r\n}\r\n\r\nconst TYPE_STYLE: CSSProperties = {\r\n display: 'inline-block',\r\n marginBottom: 4,\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n border: '1px solid var(--dsw-alias-label-tertiary)',\r\n borderRadius: 999,\r\n padding: '0 6px',\r\n fontSize: 11,\r\n lineHeight: '16px',\r\n}\r\n\r\nconst BODY_STYLE: CSSProperties = {\r\n minWidth: 0,\r\n overflowWrap: 'anywhere',\r\n whiteSpace: 'pre-wrap',\r\n color: 'var(--dsw-alias-label-primary)',\r\n}\r\n\r\nconst SCENARIO_STYLE: CSSProperties = {\r\n marginTop: 4,\r\n minWidth: 0,\r\n overflowWrap: 'anywhere',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 11,\r\n lineHeight: '16px',\r\n}\r\n\r\nconst FOOTER_STYLE: CSSProperties = {\r\n marginTop: 4,\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 11,\r\n lineHeight: '16px',\r\n}\r\n\r\n/** A retired record stays readable in the bubble, just marked. */\r\nconst STALE_BODY_STYLE: CSSProperties = { ...BODY_STYLE, textDecoration: 'line-through' }\r\n\r\n/* ── Lightweight Markdown renderer (no external deps) ──────────────────── */\r\n\r\nconst MD_H_STYLES: CSSProperties[] = [\r\n { fontSize: 14, fontWeight: 700, margin: '6px 0 2px', color: 'var(--dsw-alias-label-primary)' },\r\n { fontSize: 13, fontWeight: 600, margin: '5px 0 2px', color: 'var(--dsw-alias-label-primary)' },\r\n { fontSize: 12, fontWeight: 600, margin: '4px 0 1px', color: 'var(--dsw-alias-label-secondary)' },\r\n { fontSize: 12, fontWeight: 600, margin: '4px 0 1px', color: 'var(--dsw-alias-label-secondary)' },\r\n { fontSize: 11, fontWeight: 600, margin: '3px 0 1px', color: 'var(--dsw-alias-label-secondary)' },\r\n { fontSize: 11, fontWeight: 600, margin: '3px 0 1px', color: 'var(--dsw-alias-label-tertiary)' },\r\n]\r\n\r\nconst MD_P_STYLE: CSSProperties = { margin: '2px 0', whiteSpace: 'pre-wrap' }\r\nconst MD_LI_STYLE: CSSProperties = { margin: '1px 0 1px 12px', whiteSpace: 'pre-wrap' }\r\nconst MD_CODE_STYLE: CSSProperties = {\r\n fontFamily: 'var(--dsw-alias-font-mono, monospace)',\r\n fontSize: 11,\r\n background: 'var(--dsw-alias-fill-tertiary)',\r\n padding: '0 3px',\r\n borderRadius: 3,\r\n}\r\n\r\n/** Parse inline bold (`**x**`) and code (`` `x` ``) spans. */\r\nfunction renderInline(text: string, key: string): ReactNode[] {\r\n const nodes: ReactNode[] = []\r\n // Split by **bold** or `code`\r\n const re = /\\*\\*(.+?)\\*\\*|`(.+?)`/\r\n let rest = text\r\n let i = 0\r\n while (rest.length > 0) {\r\n const m = re.exec(rest)\r\n if (m === null) { nodes.push(rest); break }\r\n if (m.index > 0) nodes.push(rest.slice(0, m.index))\r\n if (m[1] !== undefined) {\r\n nodes.push(createElement('strong', { key: `${key}-b${i++}` }, m[1]))\r\n } else {\r\n nodes.push(createElement('code', { key: `${key}-c${i++}`, style: MD_CODE_STYLE }, m[2]))\r\n }\r\n rest = rest.slice(m.index + m[0].length)\r\n }\r\n return nodes\r\n}\r\n\r\n/**\r\n * Render a markdown string into React nodes.\r\n * Supports: headings (h1-h6), unordered/ordered lists, bold, inline code, paragraphs.\r\n */\r\nexport function renderMd(md: string): ReactNode {\r\n const lines = md.split('\\n')\r\n const out: ReactNode[] = []\r\n let idx = 0\r\n for (const line of lines) {\r\n const trimmed = line.trim()\r\n if (trimmed.length === 0) continue\r\n // Heading\r\n const hMatch = /^(#{1,6})\\s+(.+)/.exec(trimmed)\r\n if (hMatch) {\r\n const level = hMatch[1].length\r\n out.push(createElement(`h${level}`, { key: `h${idx}`, style: MD_H_STYLES[level - 1] },\r\n ...renderInline(hMatch[2], `h${idx}`)))\r\n idx++\r\n continue\r\n }\r\n // Unordered list item\r\n const ulMatch = /^[-*]\\s+(.+)/.exec(trimmed)\r\n if (ulMatch) {\r\n out.push(createElement('span', { key: `li${idx}`, style: MD_LI_STYLE },\r\n '• ', ...renderInline(ulMatch[1], `li${idx}`)))\r\n idx++\r\n continue\r\n }\r\n // Ordered list item\r\n const olMatch = /^\\d+\\.\\s+(.+)/.exec(trimmed)\r\n if (olMatch) {\r\n out.push(createElement('span', { key: `li${idx}`, style: MD_LI_STYLE },\r\n trimmed.slice(0, trimmed.indexOf('.') + 2), ...renderInline(olMatch[1], `li${idx}`)))\r\n idx++\r\n continue\r\n }\r\n // Paragraph\r\n out.push(createElement('span', { key: `p${idx}`, style: MD_P_STYLE },\r\n ...renderInline(trimmed, `p${idx}`)))\r\n idx++\r\n }\r\n return createElement(Fragment, null, ...out)\r\n}\r\n\r\n/**\r\n * The bubble itself.\r\n *\r\n * @param props - the item to show, the clamped coordinates, and the lookup.\r\n * @returns the bubble element.\r\n */\r\nexport function RecallBubble(props: {\r\n item: MemoryRecallItem\r\n pos: { top: number; left: number }\r\n t: (key: string) => string\r\n}): ReactNode {\r\n const { item, pos, t } = props\r\n const scenario = item.scenario === undefined ? undefined : item.scenario.join(' · ')\r\n const stale = item.retired === true\r\n const rated = item.rating !== undefined && Number.isInteger(item.rating) && item.rating >= 0 && item.rating <= 5\r\n const foot = [\r\n `P${item.priority}`,\r\n rated ? expandCount(t('recall.rated'), item.rating) : undefined,\r\n stale ? t('recall.obsoleted') : undefined,\r\n ].filter((s): s is string => s !== undefined).join(' · ')\r\n return createElement(\r\n 'div',\r\n {\r\n style: { ...BUBBLE_STYLE, top: pos.top, left: pos.left },\r\n 'data-dsh-brief-sidebar': 'recall-bubble',\r\n role: 'tooltip',\r\n },\r\n createElement('span', { style: TYPE_STYLE }, item.type),\r\n createElement(\r\n 'div',\r\n { style: stale ? STALE_BODY_STYLE : BODY_STYLE },\r\n // Render markdown body; fallback when absent.\r\n item.body !== undefined ? renderMd(item.body) : `${item.title}\\n${t('recall.noBody')}`,\r\n ),\r\n scenario !== undefined && createElement('div', { style: SCENARIO_STYLE }, scenario),\r\n createElement('div', { style: FOOTER_STYLE }, foot),\r\n )\r\n}\r\n","/**\r\n * Opening the prime-memory library page in a chosen mode (cross-bundle deep link).\r\n *\r\n * Mirror of `spirit-open.ts`: `dsh-prime-memory` owns the explorer main panel\r\n * (its sidebar row calls `layout.selectPanel('dsh-memory-explorer')`), so the\r\n * panel owner performs the jump and answers synchronously. This plugin only\r\n * sends one cancelable event — no import, no layout access, no version coupling.\r\n *\r\n * Three modes map to the explorer's internal views:\r\n * - `entry` — query mode with the entry pane;\r\n * - `2d` / `3d` — graph mode with the G6 / canvas view.\r\n */\r\n\r\n/** The event `dsh-prime-memory` listens for (`client/src/entry.tsx`, same literal). */\r\nexport const MEMORY_OPEN_EVENT = 'dsh-prime-memory:open-explorer'\r\n\r\n/** Which explorer view to reveal. */\r\nexport type MemoryOpenMode = 'entry' | '2d' | '3d'\r\n\r\n/** Synchronous answer from the panel owner. */\r\nexport interface MemoryOpenAck {\r\n ok: boolean\r\n /** `disabled` = 记忆库入口被关掉; `unmounted` = 没有 main 页; `unregistered` = key 未注册。 */\r\n reason?: string\r\n /** Owner-side diagnostic (which resolver path was tried / what threw). Tooltip only. */\r\n detail?: string\r\n}\r\n\r\n/** Event detail shape (prime-memory reads `mode`/`recordId`, writes `ack`). */\r\ninterface MemoryOpenDetail {\r\n mode: MemoryOpenMode\r\n recordId?: string\r\n ack?: MemoryOpenAck\r\n}\r\n\r\n/**\r\n * Ask prime-memory to open its 记忆库 in the given mode.\r\n *\r\n * @param mode - which view to show.\r\n * @param recordId - optional memory id to focus (kept for per-row entry points).\r\n * @returns the owner's ack, or `absent` when nothing listened.\r\n */\r\nexport function openMemoryLibrary(mode: MemoryOpenMode, recordId?: string): MemoryOpenAck {\r\n if (typeof window === 'undefined') return { ok: false, reason: 'absent' }\r\n const detail: MemoryOpenDetail = recordId === undefined || recordId === ''\r\n ? { mode }\r\n : { mode, recordId }\r\n const event = new CustomEvent(MEMORY_OPEN_EVENT, { detail, cancelable: true })\r\n window.dispatchEvent(event)\r\n if (detail.ack !== undefined) return detail.ack\r\n return event.defaultPrevented ? { ok: true } : { ok: false, reason: 'absent' }\r\n}\r\n","/**\r\n * Module-level reference to the better-sidebar service, set during client apply.\r\n * This avoids the strict-proxy denial on ctx.get('betterSidebar') from deep\r\n * component callbacks (MemorySlotsSection / MemoryRecallSection).\r\n */\r\nexport interface OpenTabSeed {\r\n type: string\r\n title?: string\r\n path?: string\r\n}\r\n\r\nlet _openTab: ((seed: OpenTabSeed) => void) | undefined\r\n\r\n/** Set by apply() once the better-sidebar service is available. */\r\nexport function setOpenTab(fn: (seed: OpenTabSeed) => void): void {\r\n _openTab = fn\r\n}\r\n\r\n/** Open a memory viewer tab by memoryId. No-op if the service is absent. */\r\nexport function openMemoryTab(memoryId: string): void {\r\n _openTab?.({ type: 'dsh-md-memory-viewer:memory', path: memoryId, title: memoryId.slice(0, 16) })\r\n}\r\n\r\n/** 回响原文查看器 tab 的类型(与 index.tsx 的注册串一致)。 */\r\nexport const ECHO_VIEWER_TAB = 'dsh-md-echo-viewer:echo'\r\n\r\n/**\r\n * Open the echo viewer for one echo entry.\r\n *\r\n * `path` 里同时带 sessionId 与编号(`<sessionId>|<id>`):回响编号只在本会话内唯一,\r\n * 只传 id 会让“看原文”变成跨会话张冠李戴。\r\n */\r\nexport function openEchoTab(sessionId: string, id: string): void {\r\n _openTab?.({ type: ECHO_VIEWER_TAB, path: `${sessionId}|${id}`, title: id.slice(-10) })\r\n}\r\n","/**\r\n * The 「详细展示 ▾」 control for the memory pane.\r\n *\r\n * The sidebar does not redraw prime-memory's 2D/3D graphs: the panel owner does,\r\n * with its own G6/canvas implementation. This control only asks it to open the\r\n * 记忆库 page in one of three modes (条目 / 2D / 3D) through the same deep-link\r\n * event its own sidebar row uses. The owner answers synchronously, so a failure\r\n * (entry disabled, host without a main page) lands as readable copy here instead\r\n * of a dead click.\r\n *\r\n * Colours come from `--dsw-alias-*` tokens only (skin contract).\r\n */\r\nimport { createElement, useCallback, useEffect, useRef, useState } from 'react'\r\nimport type { CSSProperties, KeyboardEvent, ReactNode } from 'react'\r\nimport { openMemoryLibrary } from '../memory-open'\r\nimport type { MemoryOpenMode } from '../memory-open'\r\nimport { openMemoryTab } from '../memory-tab'\r\n\r\nexport interface MemoryViewMenuProps {\r\n /** The DSH locale lookup, passed down from `apply`. */\r\n t: (key: string) => string\r\n /** Optional memory id to focus; row-level menus pass the row's id. */\r\n recordId?: string\r\n /** Trigger copy; defaults to `memoryView.button` + caret. */\r\n label?: string\r\n /** Compact = inline text-link trigger for a row's rating strip. */\r\n compact?: boolean\r\n}\r\n\r\n/** Owner reason → locale key. Unknown reasons fall back to the absent copy. */\r\nconst REASON_KEY: Record<string, string> = {\r\n absent: 'memoryView.failAbsent',\r\n disabled: 'memoryView.failDisabled',\r\n unmounted: 'memoryView.failUnmounted',\r\n unregistered: 'memoryView.failUnregistered',\r\n}\r\n\r\n/** Menu entries, in reading order. `preview` is the pre-existing sidebar viewer. */\r\ntype MenuEntry = MemoryOpenMode | 'preview'\r\nconst MODES: ReadonlyArray<{ mode: MenuEntry; key: string }> = [\r\n { mode: 'preview', key: 'memoryView.preview' },\r\n { mode: 'entry', key: 'memoryView.entry' },\r\n { mode: '2d', key: 'memoryView.graph2d' },\r\n { mode: '3d', key: 'memoryView.graph3d' },\r\n]\r\n\r\nconst BAR_STYLE: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'center',\r\n flexWrap: 'wrap',\r\n gap: 6,\r\n padding: '8px 12px 0',\r\n}\r\n\r\n/** Row-strip variant: hangs at the right edge, no section padding. */\r\nconst COMPACT_BAR_STYLE: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'center',\r\n flexWrap: 'wrap',\r\n gap: 4,\r\n marginLeft: 'auto',\r\n}\r\n\r\nconst TRIGGER_STYLE: CSSProperties = {\r\n padding: '1px 8px',\r\n border: '1px solid var(--dsw-alias-border-secondary)',\r\n borderRadius: 4,\r\n background: 'none',\r\n font: 'inherit',\r\n fontSize: 11,\r\n lineHeight: '18px',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n cursor: 'pointer',\r\n}\r\n\r\nconst MENU_STYLE: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'center',\r\n gap: 4,\r\n}\r\n\r\nconst ITEM_STYLE: CSSProperties = {\r\n padding: '1px 8px',\r\n border: '1px solid var(--dsw-alias-label-tertiary)',\r\n borderRadius: 999,\r\n background: 'none',\r\n font: 'inherit',\r\n fontSize: 11,\r\n lineHeight: '18px',\r\n color: 'var(--dsw-alias-label-primary)',\r\n cursor: 'pointer',\r\n}\r\n\r\n/** Compact trigger mirrors the strip's other buttons. */\r\nconst COMPACT_TRIGGER_STYLE: CSSProperties = {\r\n ...ITEM_STYLE,\r\n color: 'var(--dsw-alias-label-secondary)',\r\n border: '1px solid var(--dsw-alias-border-secondary)',\r\n borderRadius: 4,\r\n minWidth: 0,\r\n whiteSpace: 'nowrap',\r\n}\r\n\r\nconst FAIL_STYLE: CSSProperties = {\r\n flexBasis: '100%',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 11,\r\n lineHeight: '16px',\r\n}\r\n\r\n/**\r\n * Row-strip popover: FIXED so the row's clipped height cannot cut the chips'\r\n * bottom border, and so a long row list never paints the menu behind the next\r\n * row. Anchored to the trigger's bottom edge and clamped into the viewport.\r\n */\r\nconst POPOVER_STYLE: CSSProperties = {\r\n position: 'fixed',\r\n zIndex: 1100,\r\n display: 'flex',\r\n alignItems: 'center',\r\n gap: 4,\r\n padding: '6px 8px',\r\n background: 'var(--dsw-alias-bg-layer-1)',\r\n border: '1px solid var(--dsw-alias-border-secondary)',\r\n borderRadius: 8,\r\n}\r\n\r\n/**\r\n * The memory view menu. All hooks run before any conditional rendering.\r\n * @param props - translation.\r\n */\r\nexport function MemoryViewMenu(props: MemoryViewMenuProps): ReactNode {\r\n const { t, recordId, label, compact = false } = props\r\n const [open, setOpen] = useState(false)\r\n // 失败回执整条留着:owner 的 detail 要能落到 title 上(三个字的 reason 排不了障)。\r\n const [fail, setFail] = useState<{ reason: string; detail?: string } | undefined>(undefined)\r\n const [anchor, setAnchor] = useState<{ top: number; left: number } | undefined>(undefined)\r\n const rootRef = useRef<HTMLDivElement | null>(null)\r\n const triggerRef = useRef<HTMLButtonElement | null>(null)\r\n // Section menu keeps the three library views; row menus also offer the\r\n // pre-existing sidebar quick view (direct viewer tab).\r\n const entries = recordId === undefined ? MODES.filter(entry => entry.mode !== 'preview') : MODES\r\n\r\n // Close on an outside mousedown while the menu is open.\r\n useEffect(() => {\r\n if (!open) return\r\n const onDocDown = (event: MouseEvent): void => {\r\n const root = rootRef.current\r\n if (root !== null && event.target instanceof Node && root.contains(event.target)) return\r\n setOpen(false)\r\n }\r\n document.addEventListener('mousedown', onDocDown)\r\n return () => { document.removeEventListener('mousedown', onDocDown) }\r\n }, [open])\r\n\r\n const pick = useCallback((mode: MenuEntry): void => {\r\n if (mode === 'preview') {\r\n // 速览:旧的侧栏查看器 tab。无 recordId 时开空态(未选记忆),有则直定那条。\r\n openMemoryTab(recordId ?? '')\r\n setOpen(false)\r\n setFail(undefined)\r\n return\r\n }\r\n const result = openMemoryLibrary(mode, recordId)\r\n setOpen(false)\r\n setFail(result.ok ? undefined : { reason: result.reason ?? 'absent', detail: result.detail })\r\n }, [recordId])\r\n\r\n const onKeyDown = useCallback((event: KeyboardEvent<HTMLDivElement>): void => {\r\n if (event.key !== 'Escape') return\r\n setOpen(false)\r\n }, [])\r\n\r\n /** Open/close; compact menus measure the trigger so the fixed chips stay attached. */\r\n const toggle = useCallback((event: { stopPropagation(): void }): void => {\r\n // The row's own click toggles selection; the menu must not close the strip.\r\n event.stopPropagation()\r\n setFail(undefined)\r\n if (open) {\r\n setOpen(false)\r\n return\r\n }\r\n if (compact) {\r\n const el = triggerRef.current\r\n if (el !== null) {\r\n const rect = el.getBoundingClientRect()\r\n const width = 260\r\n const left = Math.max(8, Math.min(rect.left, window.innerWidth - width - 8))\r\n setAnchor({ top: rect.bottom + 4, left })\r\n }\r\n }\r\n setOpen(true)\r\n }, [compact, open])\r\n\r\n return createElement(\r\n 'div',\r\n {\r\n ref: rootRef,\r\n style: compact ? COMPACT_BAR_STYLE : BAR_STYLE,\r\n onKeyDown,\r\n 'data-dsh-brief-sidebar': compact ? 'memory-view-row-menu' : 'memory-view-menu',\r\n },\r\n createElement(\r\n 'button',\r\n {\r\n ref: triggerRef,\r\n type: 'button' as const,\r\n style: compact ? COMPACT_TRIGGER_STYLE : TRIGGER_STYLE,\r\n 'aria-haspopup': 'menu',\r\n 'aria-expanded': open,\r\n onClick: toggle,\r\n },\r\n `${label ?? t('memoryView.button')} ▾`,\r\n ),\r\n open && createElement(\r\n 'div',\r\n {\r\n role: 'menu',\r\n style: compact && anchor !== undefined\r\n ? { ...POPOVER_STYLE, top: anchor.top, left: anchor.left, maxWidth: 'calc(100vw - 16px)' }\r\n : MENU_STYLE,\r\n 'aria-label': t('memoryView.button'),\r\n },\r\n ...entries.map(entry => createElement(\r\n 'button',\r\n {\r\n key: entry.mode,\r\n type: 'button' as const,\r\n role: 'menuitem',\r\n style: ITEM_STYLE,\r\n 'data-dsh-brief-sidebar': `memory-view-${entry.mode}`,\r\n onClick: (e: { stopPropagation(): void }) => { e.stopPropagation(); pick(entry.mode) },\r\n },\r\n t(entry.key),\r\n )),\r\n ),\r\n fail !== undefined && createElement(\r\n 'div',\r\n {\r\n style: FAIL_STYLE,\r\n 'data-dsh-brief-sidebar': 'memory-view-fail',\r\n ...(fail.detail === undefined ? {} : { title: fail.detail }),\r\n },\r\n t(REASON_KEY[fail.reason] ?? 'memoryView.failAbsent'),\r\n ),\r\n )\r\n}\r\n","/**\r\n * The session-recall section: what this session actually injected, drawn as a\r\n * part of the summary tab — and now annotatable.\r\n *\r\n * Where `MemorySlotsSection` lists hand-pinned resident conventions (written\r\n * once, injected every turn), this one answers a different question: **which\r\n * memories did the model see this session, and which are still in context**.\r\n * The set is not resident — it is relevance recall. Compaction does NOT drop\r\n * entries: prime-memory marks the ones whose text a summary replaced as\r\n * `superseded`, and this section hides those (the footer keeps the count).\r\n * Retired rows are the exception and stay visible. Only `/clear` empties the list.\r\n *\r\n * TWO gates, both fail-open to \"hidden\", mirroring the slots section:\r\n *\r\n * 1. **The switch.** This plugin's entry config (`configForms` → field\r\n * `showMemoryRecall`, default on).\r\n * 2. **The capability.** The `memoryRecall` projection must exist for the\r\n * session; `undefined` hides the section entirely — a composition without\r\n * dsh-prime-memory paints nothing here.\r\n *\r\n * Rating is a THIRD gate, and it fails open the same way: the mark goes back to\r\n * prime-memory over its client RPC route (`recall-feedback.ts`). A composition\r\n * whose prime-memory predates that endpoint answers 404, and the section falls\r\n * back to the read-only list it used to be — no per-click error, no dead button.\r\n *\r\n * What the marks mean (prime-memory owns the semantics, this only offers them):\r\n * - `0..5` — how relevant this recall actually was. Aggregated; it does NOT\r\n * rewrite any ranking on its own.\r\n * - `-1` — \"this memory is obsolete\": prime-memory retires the record (soft\r\n * delete, restorable from its panel) and tells the model next turn. That is\r\n * why it takes a second confirming click and says so on the button.\r\n *\r\n * A retired row does NOT leave this list: the retirement is the human's verdict\r\n * on that memory, so the row stays, struck through and unselectable, until the\r\n * session is cleared. A `superseded` row (its text was replaced by a summary, so\r\n * it is no longer in context) IS hidden, with the count kept in the footer.\r\n * Hovering a row opens one bubble with the whole body (`RecallBubble`)\r\n * — the row itself is clamped to two lines and the sidebar is narrow.\r\n *\r\n * Colours come from `--dsw-alias-*` tokens only (skin contract, enforced by\r\n * `tests/purity.spec.ts`).\r\n */\r\nimport { createElement } from 'react'\r\nimport { useCallback, useEffect, useRef, useState } from 'react'\r\nimport type { CSSProperties, ReactNode } from 'react'\r\nimport type { CtxProbe } from '../use-projection'\r\nimport { MEMORY_RECALL_KEY, readRecall } from './memory-recall'\r\nimport type { MemoryRecallItem, MemoryRecallView } from './memory-recall'\r\nimport { FEEDBACK_SCORES, sendRecallFeedback } from './recall-feedback'\r\nimport type { FeedbackFetch, FeedbackScore } from './recall-feedback'\r\nimport { RecallBubble, bubblePos } from './RecallBubble'\r\nimport { resolveShowMemoryRecall } from '../scope-face'\r\nimport { useConfigFlag } from './use-config-flag'\r\nimport { useProjectionValue } from '../use-projection'\r\nimport { expandCount } from '../locales'\r\nimport { FoldToggle, GroupHeader } from './FoldToggle'\r\nimport { MemoryViewMenu } from './MemoryViewMenu'\r\n\r\nexport interface MemoryRecallSectionProps {\r\n /** The DSH locale lookup, passed down from `apply`. */\r\n t: (key: string) => string\r\n /** The client root context (the tab body's only way to reach services). */\r\n ctx?: CtxProbe\r\n /** The session this tab is scoped to. */\r\n scope?: { readonly sessionId?: string }\r\n /**\r\n * The transport for rating. Defaults to the page's `fetch`; injectable so the\r\n * click path is testable without a browser.\r\n */\r\n fetchImpl?: FeedbackFetch\r\n}\r\n\r\nconst SECTION_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n borderBottom: '1px solid var(--dsw-alias-border-secondary)',\r\n}\r\n\r\nconst HEADER_STYLE: CSSProperties = {\r\n padding: '10px 12px 0',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n fontSize: 12,\r\n fontWeight: 600,\r\n}\r\n\r\nconst HINT_STYLE: CSSProperties = {\r\n padding: '2px 12px 0',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 11,\r\n lineHeight: '15px',\r\n}\r\n\r\nconst LIST_STYLE: CSSProperties = {\r\n listStyle: 'none',\r\n margin: 0,\r\n padding: '6px 0',\r\n display: 'flex',\r\n flexDirection: 'column',\r\n}\r\n\r\nconst ROW_STYLE: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'flex-start',\r\n gap: 8,\r\n padding: '6px 12px',\r\n}\r\n\r\n/** Selected row: one hairline of accent, no colour literal (skin contract). */\r\nconst ROW_SELECTED_STYLE: CSSProperties = {\r\n ...ROW_STYLE,\r\n background: 'var(--dsw-alias-fill-quaternary)',\r\n}\r\n\r\n/** The type pill: same form as the slot kind pill, tertiary emphasis. */\r\nconst TYPE_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n border: '1px solid var(--dsw-alias-label-tertiary)',\r\n borderRadius: 999,\r\n padding: '0 6px',\r\n fontSize: 11,\r\n lineHeight: '16px',\r\n whiteSpace: 'nowrap',\r\n}\r\n\r\nconst TITLE_STYLE: CSSProperties = {\r\n minWidth: 0,\r\n color: 'var(--dsw-alias-label-primary)',\r\n fontWeight: 600,\r\n // Two lines, always the same height whatever the body says — the row keeps\r\n // its shape and the whole text rides the hover bubble instead.\r\n display: '-webkit-box',\r\n WebkitLineClamp: 2,\r\n WebkitBoxOrient: 'vertical',\r\n overflow: 'hidden',\r\n fontSize: 13,\r\n lineHeight: '18px',\r\n}\r\n\r\n/**\r\n * Struck-through text for a retired row. Colour drops to tertiary because a\r\n * dead entry must not compete with a live one for the eye.\r\n */\r\nconst STRIKE_STYLE: CSSProperties = {\r\n textDecoration: 'line-through',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n}\r\n\r\nconst SCENARIO_STYLE: CSSProperties = {\r\n margin: 0,\r\n minWidth: 0,\r\n overflowWrap: 'anywhere',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 10,\r\n lineHeight: '14px',\r\n}\r\n\r\nconst META_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 11,\r\n lineHeight: '18px',\r\n whiteSpace: 'nowrap',\r\n}\r\n\r\nconst FOOTER_STYLE: CSSProperties = {\r\n padding: '6px 12px 10px',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 12,\r\n}\r\n\r\nconst EMPTY_STYLE: CSSProperties = {\r\n margin: '0 auto',\r\n padding: 24,\r\n maxWidth: 460,\r\n textAlign: 'center',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n lineHeight: 1.7,\r\n fontSize: 12,\r\n}\r\n\r\nconst STRIP_STYLE: CSSProperties = {\r\n display: 'flex',\r\n flexWrap: 'wrap',\r\n gap: 4,\r\n marginTop: 4,\r\n}\r\n\r\nconst SCORE_BUTTON_STYLE: CSSProperties = {\r\n minWidth: 24,\r\n padding: '0 5px',\r\n height: 20,\r\n fontSize: 11,\r\n lineHeight: '18px',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n background: 'none',\r\n border: '1px solid var(--dsw-alias-border-secondary)',\r\n borderRadius: 4,\r\n cursor: 'pointer',\r\n}\r\n\r\n/** The chosen mark: same box, filled so it survives a re-render without colour literals. */\r\nconst SCORE_ACTIVE_STYLE: CSSProperties = {\r\n ...SCORE_BUTTON_STYLE,\r\n border: '1px solid var(--dsw-alias-label-secondary)',\r\n color: 'var(--dsw-alias-label-primary)',\r\n}\r\n\r\n/** `-1` reads as an action, not a score: text instead of a number. */\r\nconst OBSOLETE_BUTTON_STYLE: CSSProperties = {\r\n ...SCORE_BUTTON_STYLE,\r\n minWidth: 0,\r\n whiteSpace: 'nowrap',\r\n}\r\n\r\nconst OBSOLETE_ARMED_STYLE: CSSProperties = {\r\n ...OBSOLETE_BUTTON_STYLE,\r\n border: '1px solid var(--dsw-alias-border-color-danger)',\r\n color: 'var(--dsw-alias-label-primary)',\r\n fontWeight: 600,\r\n}\r\n\r\nconst MARK_STYLE: CSSProperties = {\r\n marginTop: 2,\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 11,\r\n lineHeight: '15px',\r\n}\r\n\r\nconst ERROR_STYLE: CSSProperties = {\r\n marginTop: 2,\r\n color: 'var(--dsw-alias-label-secondary)',\r\n fontSize: 11,\r\n lineHeight: '15px',\r\n overflowWrap: 'anywhere',\r\n}\r\n\r\n/**\r\n * The rating strip of one selected row: `-1` (two-step) plus `0..5`.\r\n *\r\n * Exported for tests — the section itself only mounts it for the selected row,\r\n * and a static render never has one selected.\r\n *\r\n * **Every click here must stop propagating.** The strip lives INSIDE the row,\r\n * and the row's own `onClick` toggles the selection — so an un-stopped click\r\n * deselects the row, this strip unmounts mid-gesture, and the `-1` button's\r\n * armed \"确认退场?\" state is rendered on a node that is already gone. That is\r\n * the whole \"按了没反应、也没有删除线\" report: the request was never sent, the\r\n * confirmation was never shown, the control simply vanished on the first press.\r\n * @param props - labels, current mark, and the click handlers.\r\n */\r\nexport function RatingStrip(props: {\r\n current: number | undefined\r\n pending: boolean\r\n armed: boolean\r\n obsoleteLabel: string\r\n confirmLabel: string\r\n whyLabel: string\r\n /** Row identity: when present, 「查看详情」 opens the memory-view menu for it. */\r\n recordId?: string\r\n t: (key: string) => string\r\n onScore(score: FeedbackScore): void\r\n}): ReactNode {\r\n const { current, pending, armed } = props\r\n // Clicks landing on the strip's gaps/padding count too: anything inside here\r\n // belongs to the strip, not to the row beneath it.\r\n const swallow = (e: { stopPropagation(): void }): void => { e.stopPropagation() }\r\n return createElement(\r\n 'div',\r\n {\r\n style: STRIP_STYLE,\r\n onClick: swallow,\r\n 'data-dsh-brief-sidebar': 'recall-rating-strip',\r\n },\r\n createElement(\r\n 'button',\r\n {\r\n type: 'button',\r\n style: armed ? OBSOLETE_ARMED_STYLE : OBSOLETE_BUTTON_STYLE,\r\n disabled: pending,\r\n // Before arming the tooltip explains the consequence; after, it asks.\r\n title: armed ? props.confirmLabel : props.whyLabel,\r\n onClick: (e: { stopPropagation(): void }) => {\r\n e.stopPropagation()\r\n props.onScore(-1)\r\n },\r\n },\r\n armed ? props.confirmLabel : props.obsoleteLabel,\r\n ),\r\n ...FEEDBACK_SCORES.filter(s => s >= 0).map(score => createElement(\r\n 'button',\r\n {\r\n key: score,\r\n type: 'button',\r\n style: current === score ? SCORE_ACTIVE_STYLE : SCORE_BUTTON_STYLE,\r\n disabled: pending,\r\n 'aria-pressed': current === score,\r\n onClick: (e: { stopPropagation(): void }) => {\r\n e.stopPropagation()\r\n props.onScore(score)\r\n },\r\n },\r\n String(score),\r\n )),\r\n props.recordId !== undefined && createElement(MemoryViewMenu, {\r\n t: props.t,\r\n recordId: props.recordId,\r\n label: props.t('recall.viewDetail'),\r\n compact: true,\r\n }),\r\n )\r\n}\r\n\r\n/**\r\n * One recalled memory: type pill, first two lines of the body, its own\r\n * priority, and — once selected and still alive — the rating strip. Hovering\r\n * opens the bubble with the whole text; a retired row is struck through and\r\n * cannot be selected (there is nothing left to mark on a record prime-memory\r\n * has already retired).\r\n */\r\nfunction RecallRow(props: {\r\n item: MemoryRecallItem\r\n selected: boolean\r\n stale: boolean\r\n wasSuperseded: boolean\r\n pending: boolean\r\n armed: boolean\r\n mark: number | undefined\r\n error: string | undefined\r\n rating: boolean\r\n t: (key: string) => string\r\n onSelect(): void\r\n onScore(score: FeedbackScore): void\r\n onEnter(el: HTMLElement): void\r\n onLeave(): void\r\n}): ReactNode {\r\n const { item, selected, stale, wasSuperseded, mark, error, t } = props\r\n const scenario = item.scenario === undefined ? undefined : item.scenario.join(' · ')\r\n const markText = mark === undefined\r\n ? undefined\r\n : mark === -1\r\n ? t('recall.obsoleted')\r\n : expandCount(t('recall.rated'), mark)\r\n // A row prime-memory already retired but the human did not mark in this view\r\n // still needs the caption; when `mark === -1` the line above says the same\r\n // thing, so the two are mutually exclusive rather than doubled.\r\n const staleText = stale && mark !== -1 ? t('recall.obsoleted') : undefined\r\n const selectable = props.rating && !stale\r\n const titleStyle = stale ? { ...TITLE_STYLE, ...STRIKE_STYLE } : TITLE_STYLE\r\n return createElement(\r\n 'li',\r\n {\r\n style: selected && props.rating ? ROW_SELECTED_STYLE : ROW_STYLE,\r\n onClick: selectable ? props.onSelect : undefined,\r\n onMouseEnter: (e: { currentTarget: unknown }) => {\r\n const el = e.currentTarget\r\n if (el instanceof HTMLElement) props.onEnter(el)\r\n },\r\n onMouseLeave: () => { props.onLeave() },\r\n },\r\n createElement('span', { style: TYPE_STYLE }, item.type),\r\n createElement(\r\n 'div',\r\n { style: { minWidth: 0, flex: '1 1 auto', display: 'flex', flexDirection: 'column', gap: 2 } },\r\n createElement(\r\n 'span',\r\n // 不给原生 `title`:那会在泡泡之外再多一个宿主自己的深色提示框,两者内容重叠、\r\n // 样式不受皮肤契约管,反而把泡泡遮住。全文与使用场景现在都由 `RecallBubble` 承载。\r\n { style: titleStyle },\r\n item.title,\r\n ),\r\n scenario !== undefined && createElement(\r\n 'p',\r\n { style: stale ? { ...SCENARIO_STYLE, ...STRIKE_STYLE } : SCENARIO_STYLE },\r\n scenario,\r\n ),\r\n staleText !== undefined && createElement('span', { style: MARK_STYLE }, staleText),\r\n // “正文已被摘要取代”是行自己的事实,得写在行上:否则展开历史组后,\r\n // 读者只能靠位置猜哪一行不在上下文里。\r\n wasSuperseded && createElement(\r\n 'span',\r\n { style: TYPE_STYLE, 'data-dsh-brief-sidebar': 'recall-superseded-tag' },\r\n t('recall.supersededTag'),\r\n ),\r\n markText !== undefined && createElement('span', { style: MARK_STYLE }, markText),\r\n error !== undefined && createElement(\r\n 'span',\r\n { style: ERROR_STYLE },\r\n `${t('recall.failed')}${error}`,\r\n ),\r\n selected && !stale && props.rating && createElement(RatingStrip, {\r\n current: mark,\r\n pending: props.pending,\r\n armed: props.armed,\r\n obsoleteLabel: t('recall.obsolete'),\r\n confirmLabel: t('recall.obsoleteConfirm'),\r\n whyLabel: t('recall.obsoleteWhy'),\r\n recordId: item.id,\r\n t,\r\n onScore: props.onScore,\r\n }),\r\n ),\r\n createElement('span', { style: META_STYLE }, `P${item.priority}`),\r\n )\r\n}\r\n\r\n/** How long the `-1` button stays armed before reverting to its plain label. */\r\nconst ARM_WINDOW_MS = 5_000\r\n\r\n/** Delay before a hover opens its bubble (ms) — swiping past rows must not paint. */\r\nconst HOVER_DELAY_MS = 150\r\n\r\n/**\r\n * The session-recall section. All hooks run unconditionally (a conditional hook\r\n * order would break the moment the switch flips); the gates only decide whether\r\n * the resolved view paints and whether rows are clickable.\r\n * @param props - translation, client context, session scope, transport.\r\n */\r\nexport function MemoryRecallSection(props: MemoryRecallSectionProps): ReactNode {\r\n const { t, ctx, scope } = props\r\n const [selectedId, setSelectedId] = useState<string | undefined>(undefined)\r\n const [marks, setMarks] = useState<Record<string, number>>({})\r\n // Rows the human just marked obsolete in THIS view. prime-memory's `retired`\r\n // covers the ones retired earlier; these two sets union into \"draw a strike\".\r\n const [staleIds, setStaleIds] = useState<readonly string[]>([])\r\n const [hover, setHover] = useState<{ id: string; top: number; left: number; right: number } | undefined>(undefined)\r\n const pendingHover = useRef<ReturnType<typeof setTimeout> | null>(null)\r\n const [pendingId, setPendingId] = useState<string | undefined>(undefined)\r\n const [errors, setErrors] = useState<Record<string, string>>({})\r\n const [armed, setArmed] = useState(false)\r\n // Flipped once by a 404: the composition's prime-memory cannot take marks,\r\n // so the section goes back to being the plain read-only list it was.\r\n const [writeAbsent, setWriteAbsent] = useState(false)\r\n // 历史召回组默认折叠:它们已不在上下文里,但仍属于“本会话见过什么”的一部分。\r\n const [historyOpen, setHistoryOpen] = useState(false)\r\n\r\n const show = useConfigFlag(ctx, resolveShowMemoryRecall)\r\n const view: MemoryRecallView | undefined = readRecall(\r\n useProjectionValue(ctx, scope?.sessionId, MEMORY_RECALL_KEY),\r\n )\r\n\r\n const sessionId = scope?.sessionId ?? ''\r\n const rating = writeAbsent === false && sessionId.length > 0\r\n\r\n const rate = useCallback((id: string, score: FeedbackScore): void => {\r\n if (score === -1 && armed === false) {\r\n // Retirement is destructive-ish (soft delete + a notice to the model):\r\n // the first click only arms the button.\r\n setArmed(true)\r\n setTimeout(() => { setArmed(false) }, ARM_WINDOW_MS)\r\n return\r\n }\r\n if (pendingId !== undefined) return\r\n setArmed(false)\r\n setPendingId(id)\r\n const impl: FeedbackFetch | undefined = props.fetchImpl\r\n ?? (typeof fetch === 'function' ? (fetch as unknown as FeedbackFetch) : undefined)\r\n void sendRecallFeedback(impl, { sessionId, id, score }).then(outcome => {\r\n setPendingId(undefined)\r\n if (outcome.status === 'sent') {\r\n setMarks(current => ({ ...current, [id]: score }))\r\n setErrors(current => {\r\n const next = { ...current }\r\n delete next[id]\r\n return next\r\n })\r\n if (score === -1) setStaleIds(current => (current.includes(id) ? current : [...current, id]))\r\n setHover(undefined)\r\n if (score !== -1) setSelectedId(undefined)\r\n } else if (outcome.status === 'absent') {\r\n setWriteAbsent(true)\r\n setSelectedId(undefined)\r\n } else {\r\n setErrors(current => ({ ...current, [id]: outcome.reason }))\r\n }\r\n })\r\n }, [armed, pendingId, props.fetchImpl, sessionId])\r\n\r\n const onSelect = useCallback((id: string): void => {\r\n setArmed(false)\r\n setSelectedId(current => (current === id ? undefined : id))\r\n }, [])\r\n\r\n // One bubble at a time, and it opens on a delay: sweeping the mouse down the\r\n // list must not paint a bubble for every row it passes.\r\n const onEnter = useCallback((id: string, el: HTMLElement): void => {\r\n if (pendingHover.current !== null) clearTimeout(pendingHover.current)\r\n const rect = el.getBoundingClientRect()\r\n pendingHover.current = setTimeout(() => {\r\n pendingHover.current = null\r\n // The whole rect travels, not just its origin: `bubblePos` needs the row's\r\n // RIGHT edge to place the box outside the sidebar instead of on top of it.\r\n setHover({ id, top: rect.top, left: rect.left, right: rect.right })\r\n }, HOVER_DELAY_MS)\r\n }, [])\r\n\r\n const onLeave = useCallback((): void => {\r\n if (pendingHover.current !== null) {\r\n clearTimeout(pendingHover.current)\r\n pendingHover.current = null\r\n }\r\n setHover(undefined)\r\n }, [])\r\n\r\n // Unmounting mid-sweep would otherwise leave a timer that sets state on a\r\n // dead section.\r\n useEffect(() => () => {\r\n if (pendingHover.current !== null) clearTimeout(pendingHover.current)\r\n }, [])\r\n\r\n // Switched off at the settings faces — willed away, not empty.\r\n if (show === false) return null\r\n\r\n // Capability absent (prime-memory not in the composition, no frame yet).\r\n if (view === undefined) return null\r\n\r\n // Retired rows stay: that mark is the human's verdict, and the model did see them.\r\n // A `superseded` row is different — its text is no longer in context — so it is\r\n // hidden, and the footer reports the count so nothing disappears silently.\r\n const isStale = (item: MemoryRecallItem): boolean => item.retired === true || staleIds.includes(item.id)\r\n // 两组按“正文还在不在上下文”分:活跃 = 未取代(或被退场的例外,裁决凭证必须留下);\r\n // 其余历史 = 被摘要取代且未被裁决退场的,它们收进开关后面而不是只报个计数。\r\n const rows = view.items.filter(item => item.superseded !== true || item.retired === true)\r\n const historyRows = view.items.filter(item => item.superseded === true && item.retired !== true)\r\n const hidden = historyRows.length\r\n\r\n if (rows.length === 0) {\r\n return createElement(\r\n 'div',\r\n { style: SECTION_STYLE, 'data-dsh-brief-sidebar': 'memory-recall-section' },\r\n createElement('div', { style: HEADER_STYLE }, t('section.memoryRecall')),\r\n createElement(\r\n 'div',\r\n {\r\n style: EMPTY_STYLE,\r\n // 隐藏数为 0 时是真正的空态;否则这是“本轮确实召回过、但正文已被摘要替换”的告知。\r\n ...(hidden > 0 ? { 'data-dsh-brief-sidebar': 'recall-superseded-note' } : {}),\r\n },\r\n hidden > 0 ? expandCount(t('recall.supersededHidden'), hidden) : t('recall.empty'),\r\n ),\r\n // 空态下历史组仍要能展开:否则“全都被取代”的会话永远读不到自己召回过什么。\r\n historyRows.length > 0 && createElement(FoldToggle, {\r\n label: expandCount(t('recall.historyGroup'), historyRows.length),\r\n open: historyOpen,\r\n marker: 'recall-history-toggle',\r\n onToggle: () => { setHistoryOpen(current => !current) },\r\n }),\r\n historyOpen && createElement(\r\n 'ul',\r\n { style: LIST_STYLE },\r\n historyRows.map(item => createElement(RecallRow, {\r\n key: item.id,\r\n item,\r\n selected: false,\r\n stale: isStale(item),\r\n wasSuperseded: true,\r\n pending: false,\r\n armed: false,\r\n mark: undefined,\r\n error: undefined,\r\n rating: false,\r\n t,\r\n onSelect: () => {},\r\n onScore: () => {},\r\n onEnter: () => {},\r\n onLeave: () => {},\r\n })),\r\n ),\r\n )\r\n }\r\n\r\n return createElement(\r\n 'div',\r\n { style: SECTION_STYLE, 'data-dsh-brief-sidebar': 'memory-recall-section' },\r\n createElement('div', { style: HEADER_STYLE }, t('section.memoryRecall')),\r\n rating && createElement('div', { style: HINT_STYLE }, `${t('recall.rateHint')}${t('recall.strikeHint')}`),\r\n // 活跃组计数只说“仍在上下文”的那些,注入总数归页脚,两个数各说各的。\r\n rows.length > 0 && createElement(GroupHeader, {\r\n text: expandCount(t('recall.activeGroup'), rows.length),\r\n marker: 'recall-active-group',\r\n }),\r\n createElement(\r\n 'ul',\r\n { style: LIST_STYLE },\r\n rows.map(item => createElement(RecallRow, {\r\n key: item.id,\r\n item,\r\n selected: selectedId === item.id,\r\n stale: isStale(item),\r\n wasSuperseded: item.superseded === true,\r\n pending: pendingId === item.id,\r\n armed: armed && selectedId === item.id,\r\n mark: marks[item.id] ?? item.rating,\r\n error: errors[item.id],\r\n rating,\r\n t,\r\n onSelect: () => { onSelect(item.id) },\r\n onScore: (score: FeedbackScore) => { rate(item.id, score) },\r\n onEnter: (el: HTMLElement) => { onEnter(item.id, el) },\r\n onLeave,\r\n })),\r\n ),\r\n historyRows.length > 0 && createElement(FoldToggle, {\r\n label: expandCount(t('recall.historyGroup'), historyRows.length),\r\n open: historyOpen,\r\n marker: 'recall-history-toggle',\r\n onToggle: () => { setHistoryOpen(current => !current) },\r\n }),\r\n historyOpen && createElement(\r\n 'ul',\r\n { style: LIST_STYLE },\r\n historyRows.map(item => createElement(RecallRow, {\r\n key: item.id,\r\n item,\r\n // 历史行不开评分:退场与相关度都是对“还在上下文里的那条”的裁决,\r\n // 正文已被取代的行再标一次也不会回到上下文,只会让人以为还能救。\r\n selected: false,\r\n stale: isStale(item),\r\n wasSuperseded: true,\r\n pending: false,\r\n armed: false,\r\n mark: undefined,\r\n error: undefined,\r\n rating: false,\r\n t,\r\n onSelect: () => {},\r\n onScore: () => {},\r\n onEnter: () => {},\r\n onLeave: () => {},\r\n })),\r\n ),\r\n createElement(\r\n 'div',\r\n { style: FOOTER_STYLE },\r\n expandCount(t('recall.count'), view.count),\r\n hidden > 0 && createElement(\r\n 'div',\r\n { 'data-dsh-brief-sidebar': 'recall-superseded-note' },\r\n expandCount(t('recall.supersededHidden'), hidden),\r\n ),\r\n ),\r\n // The single bubble of this section. `typeof window` guard keeps a\r\n // non-DOM render (tests, SSR) from ever reaching the viewport maths.\r\n hover !== undefined && typeof window !== 'undefined'\r\n && (() => {\r\n const item = view.items.find(i => i.id === hover.id)\r\n if (item === undefined) return null\r\n return createElement(RecallBubble, {\r\n item,\r\n pos: bubblePos(hover, window.innerWidth, window.innerHeight),\r\n t,\r\n })\r\n })(),\r\n )\r\n}\r\n","/**\r\n * The memory-slots section: the `memorySlots` projection drawn as the third\r\n * part of the summary tab (fixed last: 进展 → 产物 → 记忆).\r\n *\r\n * TWO gates, both fail-open to \"hidden\", so a host without dsh-prime-memory\r\n * paints nothing here:\r\n *\r\n * 1. **The switch.** This plugin's entry config (`configForms` → entry\r\n * `dsh-brief-sidebar`, field `showMemorySlots`, default OFF — the pinned\r\n * list moved out of the summary pane's way in favour of the session-recall\r\n * section). When the config face cannot answer (service absent, scope not\r\n * ready, field unset) the default applies — see `scope-face.ts`.\r\n * 2. **The capability.** The `memorySlots` projection must exist for the\r\n * session; `undefined` hides the section entirely, exactly like the\r\n * optional deliverables section.\r\n *\r\n * Colours come from `--dsw-alias-*` tokens only (skin contract, enforced by\r\n * `tests/purity.spec.ts`).\r\n */\r\nimport { createElement, useCallback } from 'react'\r\nimport type { CSSProperties, ReactNode } from 'react'\r\nimport type { CtxProbe } from '../use-projection'\r\nimport {\r\n MEMORY_SLOTS_KEY,\r\n readSlots,\r\n truncateBody,\r\n} from './memory-slots'\r\nimport type { MemorySlotView, MemorySlotsView, SlotRefView } from './memory-slots'\r\nimport { resolveShowMemorySlots } from '../scope-face'\r\nimport { useConfigFlag } from './use-config-flag'\r\nimport { useProjectionValue } from '../use-projection'\r\nimport { expandCount } from '../locales'\r\nimport { openMemoryTab } from '../memory-tab'\r\n\r\nexport interface MemorySlotsSectionProps {\r\n /** The DSH locale lookup, passed down from `apply`. */\r\n t: (key: string) => string\r\n /** The client root context (the tab body's only way to reach services). */\r\n ctx?: CtxProbe\r\n /** The session this tab is scoped to. */\r\n scope?: { readonly sessionId?: string }\r\n}\r\n\r\nconst SECTION_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n borderBottom: '1px solid var(--dsw-alias-border-secondary)',\r\n}\r\n\r\nconst HEADER_STYLE: CSSProperties = {\r\n padding: '10px 12px 0',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n fontSize: 12,\r\n fontWeight: 600,\r\n}\r\n\r\nconst LIST_STYLE: CSSProperties = {\r\n listStyle: 'none',\r\n margin: 0,\r\n padding: '6px 0',\r\n display: 'flex',\r\n flexDirection: 'column',\r\n}\r\n\r\nconst ROW_STYLE: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'flex-start',\r\n gap: 8,\r\n padding: '6px 12px',\r\n}\r\n\r\nconst TITLE_STYLE: CSSProperties = {\r\n minWidth: 0,\r\n overflowWrap: 'anywhere',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n}\r\n\r\nconst META_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 11,\r\n lineHeight: '18px',\r\n whiteSpace: 'nowrap',\r\n}\r\n\r\n/** The kind pill: same form as the codeplan pill, tertiary emphasis. */\r\nconst KIND_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n border: '1px solid var(--dsw-alias-label-tertiary)',\r\n borderRadius: 999,\r\n padding: '0 6px',\r\n fontSize: 11,\r\n lineHeight: '16px',\r\n whiteSpace: 'nowrap',\r\n}\r\n\r\n/** The status pill: filled tint for an open slot, plain text otherwise. */\r\nconst STATUS_OPEN_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n color: 'var(--dsw-alias-label-primary)',\r\n border: '1px solid var(--dsw-alias-label-secondary)',\r\n borderRadius: 999,\r\n padding: '0 6px',\r\n fontSize: 11,\r\n lineHeight: '16px',\r\n whiteSpace: 'nowrap',\r\n}\r\n\r\nconst STATUS_SETTLED_STYLE: CSSProperties = {\r\n ...STATUS_OPEN_STYLE,\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n border: '1px solid var(--dsw-alias-label-tertiary)',\r\n}\r\n\r\nconst BODY_STYLE: CSSProperties = {\r\n margin: 0,\r\n minWidth: 0,\r\n overflowWrap: 'anywhere',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 12,\r\n lineHeight: '18px',\r\n}\r\n\r\nconst REFS_STYLE: CSSProperties = {\r\n ...BODY_STYLE,\r\n fontSize: 11,\r\n}\r\n\r\nconst TOTAL_STYLE: CSSProperties = {\r\n padding: '6px 12px 10px',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 12,\r\n}\r\n\r\nconst EMPTY_STYLE: CSSProperties = {\r\n margin: '0 auto',\r\n padding: 24,\r\n maxWidth: 460,\r\n textAlign: 'center',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n lineHeight: 1.7,\r\n fontSize: 12,\r\n}\r\n\r\n/** Locale key per known slot status; unknown statuses fall back to the raw wire value. */\r\nconst STATUS_KEY: Record<string, string> = {\r\n open: 'slots.status.open',\r\n done: 'slots.status.done',\r\n dropped: 'slots.status.dropped',\r\n expired: 'slots.status.expired',\r\n}\r\n\r\n/** The “查看” button beside a mem_* refView. */\r\nconst VIEW_BTN_STYLE: CSSProperties = {\r\n display: 'inline-block',\r\n marginLeft: 6,\r\n padding: '0 4px',\r\n fontSize: 10,\r\n lineHeight: '14px',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n border: '1px solid var(--dsw-alias-border-secondary)',\r\n borderRadius: 3,\r\n cursor: 'pointer',\r\n background: 'none',\r\n verticalAlign: 'middle',\r\n}\r\n\r\n/**\r\n * One slot row: kind pill, title (full body rides the tooltip), status pill,\r\n * priority; body line underneath when the wire view carries it; refs as\r\n * resolved 名称简述 (record_id → title) with a 「查看」 button for mem_* refs.\r\n */\r\nfunction SlotRow(props: { slot: MemorySlotView; t: (key: string) => string; onViewMemory?: (ref: string) => void }): ReactNode {\r\n const { slot, t, onViewMemory } = props\r\n const statusLabel = STATUS_KEY[slot.status] === undefined ? slot.status : t(STATUS_KEY[slot.status])\r\n const title = slot.body === undefined ? slot.title : `${slot.title} — ${slot.body}`\r\n const refsLine = slot.refViews !== undefined\r\n ? slot.refViews.map((view) => view.title).join(' · ')\r\n : slot.refs !== undefined\r\n ? slot.refs.join(' · ')\r\n : undefined\r\n return createElement(\r\n 'li',\r\n { style: ROW_STYLE },\r\n createElement('span', { style: KIND_STYLE }, slot.kind),\r\n createElement(\r\n 'div',\r\n { style: { minWidth: 0, flex: '1 1 auto', display: 'flex', flexDirection: 'column', gap: 2 } },\r\n createElement('span', { style: TITLE_STYLE, title }, slot.title),\r\n slot.body !== undefined && createElement('p', { style: BODY_STYLE }, truncateBody(slot.body)),\r\n refsLine !== undefined\r\n && createElement(\r\n 'p',\r\n {\r\n style: REFS_STYLE,\r\n title: slot.refs !== undefined ? slot.refs.join('\\n') : undefined,\r\n },\r\n ...(slot.refViews !== undefined\r\n ? slot.refViews.flatMap((view) => {\r\n const nodes: ReactNode[] = [view.title]\r\n if (view.ref.startsWith('mem_') && onViewMemory !== undefined) {\r\n nodes.push(createElement('button', {\r\n key: `view-${view.ref}`,\r\n type: 'button' as const,\r\n style: VIEW_BTN_STYLE,\r\n onClick: (e: { stopPropagation(): void }) => { e.stopPropagation(); onViewMemory(view.ref) },\r\n }, t('slots.viewMemory')))\r\n }\r\n return nodes\r\n }).flatMap((node, i) => i === 0 ? [node] : [' · ', node])\r\n : [refsLine]),\r\n ),\r\n ),\r\n createElement('span', { style: META_STYLE }, `P${slot.priority}`),\r\n createElement(\r\n 'span',\r\n { style: slot.status === 'open' ? STATUS_OPEN_STYLE : STATUS_SETTLED_STYLE },\r\n statusLabel,\r\n ),\r\n )\r\n}\r\n\r\n/**\r\n * Subscribe to this plugin's entry config and resolve the slots switch.\r\n * Plumbing lives in `use-config-flag`; the default (off) lives in the resolver.\r\n *\r\n * @param ctx - the client root context handed to the tab body.\r\n * @returns whether the memory-slots section may render at all.\r\n */\r\nexport function useShowMemorySlots(ctx: CtxProbe | undefined): boolean {\r\n return useConfigFlag(ctx, resolveShowMemorySlots)\r\n}\r\n\r\n/**\r\n * The memory-slots section. Both hooks run unconditionally (a conditional\r\n * hook order would break the moment the switch flips); the switch only\r\n * decides whether the resolved view paints.\r\n * @param props - translation, client context, session scope.\r\n */\r\nexport function MemorySlotsSection(props: MemorySlotsSectionProps): ReactNode {\r\n const { t, ctx, scope } = props\r\n\r\n const show = useShowMemorySlots(ctx)\r\n const view: MemorySlotsView | undefined = readSlots(\r\n useProjectionValue(ctx, scope?.sessionId, MEMORY_SLOTS_KEY),\r\n )\r\n\r\n // 查看按钮的 opener:经模块级 openMemoryTab 走 betterSidebar.openTab,完全绕过文件系统。\r\n const onViewMemory = useCallback((ref: string) => {\r\n openMemoryTab(ref)\r\n }, [])\r\n\r\n // Switched off at the settings faces — the section is willed away, not\r\n // empty (an empty state would claim prime-memory answered when the user\r\n // simply closed the section).\r\n if (show === false) return null\r\n\r\n // Capability absent (prime-memory not in the composition, no frame yet) —\r\n // hide, don't nag; the memory panel remains the write surface.\r\n if (view === undefined) return null\r\n\r\n if (view.slots.length === 0) {\r\n return createElement(\r\n 'div',\r\n { style: SECTION_STYLE, 'data-dsh-brief-sidebar': 'memory-slots-section' },\r\n createElement('div', { style: HEADER_STYLE }, t('section.memorySlots')),\r\n createElement(\r\n 'div',\r\n { style: EMPTY_STYLE },\r\n createElement('div', { style: { marginBottom: 6, color: 'var(--dsw-alias-label-secondary)' } }, t('slots.empty')),\r\n createElement('div', null, t('slots.emptyHint')),\r\n ),\r\n )\r\n }\r\n\r\n return createElement(\r\n 'div',\r\n { style: SECTION_STYLE, 'data-dsh-brief-sidebar': 'memory-slots-section' },\r\n createElement('div', { style: HEADER_STYLE }, t('section.memorySlots')),\r\n createElement(\r\n 'ul',\r\n { style: LIST_STYLE },\r\n view.slots.map(slot => createElement(SlotRow, { key: slot.id, slot, t, onViewMemory })),\r\n ),\r\n createElement(\r\n 'div',\r\n { style: TOTAL_STYLE },\r\n expandCount(t('slots.openCount'), view.openCount),\r\n ),\r\n )\r\n}\r\n","/**\r\n * The `spiritEcho` projection — reading it.\r\n *\r\n * Registered by `dsh-spirit` (key `spiritEcho`). Since spirit 0.8.3 the wire view is\r\n * `{token, total, segments, lastStep?}` and its source is spirit's `echo_recall` table,\r\n * so what rides this face is **this session's recalled echo passages** — and they\r\n * survive a restart (that is the whole point of moving off the in-process buffer).\r\n *\r\n * Two outcomes stay apart, mirroring the memory-slots reader:\r\n * - `undefined` — capability ABSENT (spirit not composed, or a shape drift bad enough\r\n * that rendering it would lie);\r\n * - a view — `segments: []` IS the empty state (a fresh session simply has no recall yet).\r\n *\r\n * Malformed rows are dropped rather than thrown on: this is a trusted-Host value\r\n * rendered defensively. The excerpt is already capped by spirit (≤240 chars).\r\n */\r\n\r\n/** The projection key `dsh-spirit` registers (its canonical constant). */\r\nexport const SPIRIT_ECHO_KEY = 'spiritEcho'\r\n\r\n/** One recalled passage as the projection publishes it. */\r\nexport interface SpiritEchoSegment {\r\n /** The recalled passage itself (already truncated by spirit). */\r\n readonly excerpt: string\r\n /** First time this session recalled it (ms). */\r\n readonly firstTs: number\r\n /** Most recent recall (ms). */\r\n readonly lastTs: number\r\n /** Recall count within this session. */\r\n readonly times: number\r\n}\r\n\r\n/** One referent of an echo entry (spirit v0.8.7): the memory item it points at. */\r\nexport interface SpiritEchoRef {\r\n readonly kind: string\r\n readonly id: string\r\n readonly label: string\r\n}\r\n\r\n/** The latest pre-step decision (answers \"why no card this round\"). */\r\nexport interface SpiritEchoStep {\r\n /** Entry id (`echo-<ts>`); the viewer fetches the original card by it. */\r\n readonly id: string\r\n readonly at: number\r\n readonly kind: 'injected' | 'skipped'\r\n readonly reason: string\r\n /** One-line summary of the injected card (`''` for skipped rows). */\r\n readonly preview: string\r\n /**\r\n * Content-first title (spirit frame v5+): e.g. the thread task name\r\n * `plugin-9lang-five-dim`. Absent on older frames ⇒ fall back to `preview`.\r\n */\r\n readonly title?: string\r\n /** The memory items this echo points at (memid), for entry/graph jumps. */\r\n readonly refs?: readonly SpiritEchoRef[]\r\n}\r\n\r\n/** One recalled **record** (spirit frame v7): `echoId = echo-<uuid>` belongs to the record itself. */\r\nexport interface SpiritEchoRecordRow {\r\n readonly echoId: string\r\n readonly sessionId: string\r\n readonly kind: string\r\n readonly memId: string\r\n readonly title: string\r\n readonly times: number\r\n /** The record's own timestamp (shown as \"记录时间\"). */\r\n readonly recordTs: number\r\n readonly firstTs: number\r\n readonly lastTs: number\r\n /** Latest recall event id (`recall-<uuid>`). */\r\n readonly lastRecallId: string\r\n}\r\n\r\n/** Old alias (one release). */\r\nexport type SpiritEchoRefRow = SpiritEchoRecordRow\r\n\r\n/** One recall event (v7): `recall-<uuid>`, one per injection round. */\r\nexport interface SpiritEchoRecall {\r\n readonly recallId: string\r\n readonly at: number\r\n readonly flashback: boolean\r\n}\r\n\r\n/** Tone/state (special format, not a reference). */\r\nexport interface SpiritEchoTone {\r\n readonly at: number\r\n readonly state?: string\r\n readonly opening?: string\r\n}\r\n\r\n/** The whole wire view of one frame. */\r\nexport interface SpiritEchoView {\r\n /** DB-derived token; changes whenever this session's echo store changes. */\r\n readonly token: number\r\n /** Distinct recalled passages in this session. */\r\n readonly total: number\r\n /** This session's recalled passages, newest first, ≤20. */\r\n readonly segments: readonly SpiritEchoSegment[]\r\n /** This session's recent echo entries (injected/skipped), newest first, ≤5. */\r\n readonly steps: readonly SpiritEchoStep[]\r\n readonly lastStep?: SpiritEchoStep\r\n /** Recalled records (v7 main data): one row per record (echo-<uuid>). */\r\n readonly records?: readonly SpiritEchoRecordRow[]\r\n /** Old alias (same content as records). */\r\n readonly refs?: readonly SpiritEchoRecordRow[]\r\n /** Latest recall event (recall-<uuid>). */\r\n readonly recall?: SpiritEchoRecall\r\n /** Tone/state (special format). */\r\n readonly tone?: SpiritEchoTone\r\n}\r\n\r\n/**\r\n * Narrow a raw projection value into an echo view.\r\n *\r\n * @param value - the raw `unknown` snapshot of the `spiritEcho` face.\r\n * @returns the validated view, or `undefined` when the capability is absent.\r\n */\r\nexport function readSpiritEcho(value: unknown): SpiritEchoView | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as Record<string, unknown>\r\n if (!isCounter(raw['token']) || !isCounter(raw['total'])) return undefined\r\n if (!Array.isArray(raw['segments'])) return undefined\r\n const segments: SpiritEchoSegment[] = []\r\n for (const entry of raw['segments']) {\r\n const segment = readSegment(entry)\r\n if (segment !== undefined) segments.push(segment)\r\n }\r\n const step = readStep(raw['lastStep'])\r\n const steps: SpiritEchoStep[] = []\r\n if (Array.isArray(raw['steps'])) {\r\n for (const entry of raw['steps']) {\r\n const row = readStep(entry)\r\n if (row !== undefined) steps.push(row)\r\n }\r\n }\r\n const records: SpiritEchoRecordRow[] = []\r\n for (const source of [raw['records'], raw['refs']]) {\r\n if (!Array.isArray(source)) continue\r\n for (const entry of source) {\r\n const row = readRecord(entry)\r\n if (row !== undefined && !records.some((item) => item.echoId === row.echoId && item.sessionId === row.sessionId)) records.push(row)\r\n }\r\n }\r\n const recall = readRecall(raw['recall'])\r\n const tone = readTone(raw['tone'])\r\n return {\r\n token: raw['token'],\r\n total: raw['total'],\r\n segments,\r\n steps,\r\n ...(step === undefined ? {} : { lastStep: step }),\r\n ...(records.length === 0 ? {} : { records, refs: records }),\r\n ...(recall === undefined ? {} : { recall }),\r\n ...(tone === undefined ? {} : { tone }),\r\n };\r\n}\r\n\r\n/** Whether a value is a non-negative safe integer (the view's counter shape). */\r\nfunction isCounter(value: unknown): value is number {\r\n return typeof value === 'number' && Number.isSafeInteger(value) && value >= 0\r\n}\r\n\r\n/** Narrow one record; `undefined` = malformed, dropped (old frames lack it). */\r\nfunction readRecord(value: unknown): SpiritEchoRecordRow | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as Record<string, unknown>\r\n // v7: echoId + lastRecallId;v6: refId + lastEchoStepId\r\n const echoId = typeof raw['echoId'] === 'string' && raw['echoId'] !== ''\r\n ? raw['echoId']\r\n : typeof raw['refId'] === 'string' ? raw['refId'] : ''\r\n if (echoId === '') return undefined\r\n if (typeof raw['kind'] !== 'string' || raw['kind'] === '') return undefined\r\n if (typeof raw['memId'] !== 'string' || raw['memId'] === '') return undefined\r\n if (!isCounter(raw['times']) || !isCounter(raw['firstTs']) || !isCounter(raw['lastTs'])) return undefined\r\n const recordTs = isCounter(raw['recordTs']) ? raw['recordTs'] : raw['firstTs']\r\n const lastRecallId = typeof raw['lastRecallId'] === 'string'\r\n ? raw['lastRecallId']\r\n : typeof raw['lastEchoStepId'] === 'string' ? raw['lastEchoStepId'] : ''\r\n return {\r\n echoId,\r\n sessionId: typeof raw['sessionId'] === 'string' ? raw['sessionId'] : '',\r\n kind: raw['kind'],\r\n memId: raw['memId'],\r\n title: typeof raw['title'] === 'string' ? raw['title'] : '',\r\n times: raw['times'],\r\n recordTs,\r\n firstTs: raw['firstTs'],\r\n lastTs: raw['lastTs'],\r\n lastRecallId,\r\n }\r\n}\r\n\r\n/** Narrow the optional recall event row. */\r\nfunction readRecall(value: unknown): SpiritEchoRecall | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as Record<string, unknown>\r\n if (typeof raw['recallId'] !== 'string' || raw['recallId'] === '') return undefined\r\n if (!isCounter(raw['at'])) return undefined\r\n return { recallId: raw['recallId'], at: raw['at'], flashback: raw['flashback'] === true }\r\n}\r\n\r\n/** Narrow the optional tone row (special format; absent on old frames). */\r\nfunction readTone(value: unknown): SpiritEchoTone | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as Record<string, unknown>\r\n if (!isCounter(raw['at'])) return undefined\r\n const state = typeof raw['state'] === 'string' && raw['state'] !== '' ? raw['state'] : undefined\r\n const opening = typeof raw['opening'] === 'string' && raw['opening'] !== '' ? raw['opening'] : undefined\r\n if (state === undefined && opening === undefined) return undefined\r\n return { at: raw['at'], ...(state === undefined ? {} : { state }), ...(opening === undefined ? {} : { opening }) }\r\n}\r\n\r\n/** Narrow one recalled passage; `undefined` = malformed, dropped. */\r\nfunction readSegment(value: unknown): SpiritEchoSegment | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as Record<string, unknown>\r\n if (typeof raw['excerpt'] !== 'string' || raw['excerpt'] === '') return undefined\r\n if (!isCounter(raw['firstTs']) || !isCounter(raw['lastTs']) || !isCounter(raw['times'])) return undefined\r\n return {\r\n excerpt: raw['excerpt'],\r\n firstTs: raw['firstTs'],\r\n lastTs: raw['lastTs'],\r\n times: raw['times'],\r\n }\r\n}\r\n\r\n/** Narrow the optional last-step row. */\r\nfunction readStep(value: unknown): SpiritEchoStep | undefined {\r\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined\r\n const raw = value as Record<string, unknown>\r\n if (!isCounter(raw['at'])) return undefined\r\n if (raw['kind'] !== 'injected' && raw['kind'] !== 'skipped') return undefined\r\n if (typeof raw['reason'] !== 'string') return undefined\r\n // 编号缺席时按 `echo-<ts>` 兜底:老帧没有 id 也能打开原文(查不到就是查不到)。\r\n const id = typeof raw['id'] === 'string' && raw['id'] !== '' ? raw['id'] : `echo-${raw['at']}`\r\n const refs: SpiritEchoRef[] = []\r\n if (Array.isArray(raw['refs'])) {\r\n for (const entry of raw['refs']) {\r\n if (entry === null || typeof entry !== 'object' || Array.isArray(entry)) continue\r\n const ref = entry as Record<string, unknown>\r\n if (typeof ref['kind'] !== 'string' || ref['kind'] === '') continue\r\n if (typeof ref['id'] !== 'string' || ref['id'] === '') continue\r\n refs.push({ kind: ref['kind'], id: ref['id'], label: typeof ref['label'] === 'string' ? ref['label'] : '' })\r\n }\r\n }\r\n return {\r\n id,\r\n at: raw['at'],\r\n kind: raw['kind'],\r\n reason: raw['reason'],\r\n preview: typeof raw['preview'] === 'string' ? raw['preview'] : '',\r\n ...(typeof raw['title'] === 'string' && raw['title'] !== '' ? { title: raw['title'] } : {}),\r\n ...(refs.length === 0 ? {} : { refs }),\r\n }\r\n}\r\n","/**\r\n * Opening the spirit echo page (cross-bundle deep link).\r\n *\r\n * `dsh-spirit` owns the Memory Sea panel; this plugin must not import it and\r\n * must not call `layout.selectPanel` itself — that call THROWS when the main\r\n * key is not registered (host contract). So the request rides one cancelable\r\n * `CustomEvent` and the owner answers synchronously: it writes `detail.ack`\r\n * and calls `preventDefault()` on success.\r\n *\r\n * Absence is a normal outcome: no listener → `ack` missing and the event not\r\n * prevented → `{ok:false, reason:'absent'}` and the caller shows fallback copy.\r\n */\r\n\r\n/** The event `dsh-spirit` listens for (`client/src/entry.ts`, same literal). */\r\nexport const SPIRIT_OPEN_EVENT = 'dsh-spirit:open-sea'\r\n\r\n/** Synchronous answer from the panel owner. */\r\nexport interface SpiritOpenAck {\r\n ok: boolean\r\n /** `unmounted` = panel not in the composition; `unregistered` = main key not registered. */\r\n reason?: string\r\n /** Owner-side diagnostic (which resolver path was tried / what threw). Tooltip only. */\r\n detail?: string\r\n}\r\n\r\n/** Which spirit view to reveal: `echo` = 翻阅 → 回响(条目面); `graph` = 星海星图面。 */\r\nexport type SpiritOpenTarget = 'echo' | 'graph'\r\n\r\n/** Event detail shape (spirit reads `target`, writes `ack`). */\r\ninterface SpiritOpenDetail {\r\n target: SpiritOpenTarget\r\n ack?: SpiritOpenAck\r\n}\r\n\r\n/**\r\n * Ask spirit to reveal one of its echo views.\r\n *\r\n * @param target - `echo` (default, the recalled-passage list) or `graph` (the star map).\r\n * @returns `{ok:true}` when the owner opened the panel; otherwise the owner's\r\n * reason, or `absent` when nothing listened.\r\n */\r\nexport function openSpiritEcho(target: SpiritOpenTarget = 'echo'): SpiritOpenAck {\r\n if (typeof window === 'undefined') return { ok: false, reason: 'absent' }\r\n const detail: SpiritOpenDetail = { target }\r\n const event = new CustomEvent(SPIRIT_OPEN_EVENT, { detail, cancelable: true })\r\n window.dispatchEvent(event)\r\n if (detail.ack !== undefined) return detail.ack\r\n return event.defaultPrevented ? { ok: true } : { ok: false, reason: 'absent' }\r\n}\r\n","/**\r\n * The 「查看 ▾」 control for one echo row (and the echo section header).\r\n *\r\n * Rows used to be a single button straight into the original-card viewer. That\r\n * answered \"what did the card say\", but not \"where does this live in spirit\":\r\n * the 条目 list and the star map are two different pages there, and the footer\r\n * links sit far below a long row list. So each row gets the same popover the\r\n * memory rows already have (速览 / 条目 / 2D·3D), with echo's three targets:\r\n *\r\n * - 原文 → this plugin's own viewer tab (`dsh-md-echo-viewer:echo`);\r\n * - 条目 → spirit 翻阅 → 回响 (`dsh-spirit:open-sea` target=`echo`);\r\n * - 星图 → spirit 星海星图 (`dsh-spirit:open-sea` target=`graph`).\r\n *\r\n * The owner answers synchronously, so a failure lands as readable copy on the\r\n * trigger's tooltip instead of a dead click.\r\n *\r\n * Colours come from `--dsw-alias-*` tokens only (skin contract).\r\n */\r\nimport { createElement, useCallback, useEffect, useRef, useState } from 'react'\r\nimport type { CSSProperties, KeyboardEvent, ReactNode } from 'react'\r\nimport { openEchoTab } from '../memory-tab'\r\nimport { openSpiritEcho } from '../spirit-open'\r\n\r\nexport interface EchoViewMenuProps {\r\n /** The DSH locale lookup, passed down from `apply`. */\r\n t: (key: string) => string\r\n /** The session the row belongs to (the viewer tab needs it). */\r\n sessionId?: string\r\n /** The echo id this row points at; absent = section-level menu. */\r\n echoId?: string\r\n /** Trigger copy; defaults to `echo.viewMenu` + caret. */\r\n label?: string\r\n}\r\n\r\ntype MenuEntry = 'original' | 'entry' | 'graph'\r\n\r\n/** Menu entries, in reading order. */\r\nconst ENTRIES: ReadonlyArray<{ mode: MenuEntry; key: string }> = [\r\n { mode: 'original', key: 'echo.openOriginal' },\r\n { mode: 'entry', key: 'echo.goto' },\r\n { mode: 'graph', key: 'echo.gotoGraph' },\r\n]\r\n\r\nconst TRIGGER_STYLE: CSSProperties = {\r\n padding: '1px 8px',\r\n border: '1px solid var(--dsw-alias-border-secondary)',\r\n borderRadius: 4,\r\n background: 'none',\r\n font: 'inherit',\r\n fontSize: 11,\r\n lineHeight: '18px',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n cursor: 'pointer',\r\n whiteSpace: 'nowrap',\r\n}\r\n\r\nconst ITEM_STYLE: CSSProperties = {\r\n padding: '1px 8px',\r\n border: '1px solid var(--dsw-alias-label-tertiary)',\r\n borderRadius: 999,\r\n background: 'none',\r\n font: 'inherit',\r\n fontSize: 11,\r\n lineHeight: '18px',\r\n color: 'var(--dsw-alias-label-primary)',\r\n cursor: 'pointer',\r\n whiteSpace: 'nowrap',\r\n}\r\n\r\n/**\r\n * Anchored INSIDE the row wrapper (absolute), not fixed-to-viewport.\r\n *\r\n * 实测:主栏带缩放的皮肤下,用按钮的 viewport 坐标去摆 fixed 弹层会落到视口外\r\n * (量到 trigger(1613,926) 而弹层在 (1692,1730))。不量坐标就没有这类错位——弹层\r\n * 跟着行走,唯一代价是贴到面板边缘时可能被裁一点,滚一下就能看全。\r\n */\r\nconst POPOVER_STYLE: CSSProperties = {\r\n position: 'absolute',\r\n top: 'calc(100% + 4px)',\r\n right: 0,\r\n zIndex: 1100,\r\n display: 'flex',\r\n alignItems: 'center',\r\n gap: 4,\r\n padding: '6px 8px',\r\n background: 'var(--dsw-alias-bg-layer-1)',\r\n border: '1px solid var(--dsw-alias-border-secondary)',\r\n borderRadius: 8,\r\n}\r\n\r\nconst WRAP_STYLE: CSSProperties = {\r\n position: 'relative',\r\n display: 'flex',\r\n alignItems: 'center',\r\n gap: 4,\r\n minWidth: 0,\r\n}\r\n\r\n/**\r\n * The echo row menu. All hooks run before any conditional rendering.\r\n * @param props - translation, session scope, row id.\r\n */\r\nexport function EchoViewMenu(props: EchoViewMenuProps): ReactNode {\r\n const { t, sessionId, echoId, label } = props\r\n const [open, setOpen] = useState(false)\r\n const [fail, setFail] = useState<{ reason: string; detail?: string } | undefined>(undefined)\r\n const rootRef = useRef<HTMLDivElement | null>(null)\r\n const triggerRef = useRef<HTMLButtonElement | null>(null)\r\n\r\n // Close on an outside mousedown while the menu is open.\r\n useEffect(() => {\r\n if (!open) return\r\n const onDocDown = (event: MouseEvent): void => {\r\n const root = rootRef.current\r\n if (root !== null && event.target instanceof Node && root.contains(event.target)) return\r\n setOpen(false)\r\n }\r\n document.addEventListener('mousedown', onDocDown)\r\n return () => { document.removeEventListener('mousedown', onDocDown) }\r\n }, [open])\r\n\r\n const pick = useCallback((mode: MenuEntry): void => {\r\n setOpen(false)\r\n if (mode === 'original') {\r\n openEchoTab(sessionId ?? '', echoId ?? '')\r\n setFail(undefined)\r\n return\r\n }\r\n // 选单叫「条目」,深链口叫 `echo`(spirit 那边的页面名)——这里就这一处对照。\r\n const result = openSpiritEcho(mode === 'entry' ? 'echo' : 'graph')\r\n setFail(result.ok ? undefined : { reason: result.reason ?? 'absent', detail: result.detail })\r\n }, [echoId, sessionId])\r\n\r\n const onKeyDown = useCallback((event: KeyboardEvent<HTMLDivElement>): void => {\r\n if (event.key !== 'Escape') return\r\n setOpen(false)\r\n }, [])\r\n\r\n /** Open/close. The chips hang off the trigger's own box, so no coordinates are measured. */\r\n const toggle = useCallback((event: { stopPropagation(): void }): void => {\r\n // The row's own click opens the viewer; the menu must not trigger it.\r\n event.stopPropagation()\r\n setFail(undefined)\r\n setOpen((value) => !value)\r\n }, [])\r\n\r\n return createElement(\r\n 'div',\r\n {\r\n ref: rootRef,\r\n style: WRAP_STYLE,\r\n onKeyDown,\r\n 'data-dsh-brief-sidebar': echoId === undefined ? 'echo-view-menu' : 'echo-view-row-menu',\r\n },\r\n createElement(\r\n 'button',\r\n {\r\n ref: triggerRef,\r\n type: 'button' as const,\r\n style: TRIGGER_STYLE,\r\n 'aria-haspopup': 'menu',\r\n 'aria-expanded': open,\r\n ...(fail === undefined ? {} : { title: `${t('echo.gotoFail')}(${fail.reason})${fail.detail ?? ''}` }),\r\n onClick: toggle,\r\n },\r\n `${label ?? t('echo.viewMenu')} ▾`,\r\n ),\r\n open && createElement(\r\n 'div',\r\n {\r\n role: 'menu',\r\n style: { ...POPOVER_STYLE, maxWidth: 'calc(100vw - 16px)' },\r\n 'aria-label': t('echo.viewMenu'),\r\n },\r\n ...ENTRIES.map(entry => createElement(\r\n 'button',\r\n {\r\n key: entry.mode,\r\n type: 'button' as const,\r\n role: 'menuitem',\r\n style: ITEM_STYLE,\r\n 'data-dsh-brief-sidebar': `echo-view-${entry.mode}`,\r\n onClick: (e: { stopPropagation(): void }) => { e.stopPropagation(); pick(entry.mode) },\r\n },\r\n t(entry.key),\r\n )),\r\n ),\r\n )\r\n}\r\n","/**\r\n * The spirit-echo tab: which echo passages dsh-spirit recalled **in this session**,\r\n * drawn from the `spiritEcho` projection (v0.8.3: spirit's durable `echo_recall`).\r\n *\r\n * Contract mirrors the memory sections:\r\n * - capability absent (`spiritEcho` unit missing) → render nothing;\r\n * - `segments: []` → honest empty state (a fresh session has recalled nothing yet);\r\n * - data → this session's passage count + the latest passage + two pointers:\r\n * 「星图」 (the star map) and 「条目」 (翻阅 → 回响). Both ride the same deep link.\r\n *\r\n * The `lastStep` line answers \"why no card this round\" and is deliberately kept\r\n * apart from the passage list: one is an observation, the other is memory.\r\n *\r\n * Colours come from `--dsw-alias-*` tokens only (skin contract).\r\n */\r\nimport { createElement, useCallback, useState } from 'react'\r\nimport type { CSSProperties, ReactNode } from 'react'\r\nimport type { CtxProbe } from '../use-projection'\r\nimport { useProjectionValue } from '../use-projection'\r\nimport { SPIRIT_ECHO_KEY, readSpiritEcho } from '../spirit-echo'\r\nimport type { SpiritEchoRefRow, SpiritEchoStep } from '../spirit-echo'\r\nimport { openSpiritEcho } from '../spirit-open'\r\nimport type { SpiritOpenTarget } from '../spirit-open'\r\nimport { openEchoTab } from '../memory-tab'\r\nimport { EchoViewMenu } from './EchoViewMenu'\r\nimport { expandCount } from '../locales'\r\n\r\nexport interface SpiritEchoSectionProps {\r\n /** The DSH locale lookup, passed down from `apply`. */\r\n t: (key: string) => string\r\n /** The client root context (the tab body's only way to reach services). */\r\n ctx?: CtxProbe\r\n /** The session this tab is scoped to. */\r\n scope?: { readonly sessionId?: string }\r\n /** True when the section is rendered inside a tab that already names it (引用 → 回响). */\r\n hideHeader?: boolean\r\n}\r\n\r\nconst SECTION_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n borderBottom: '1px solid var(--dsw-alias-border-secondary)',\r\n}\r\n\r\nconst HEADER_STYLE: CSSProperties = {\r\n padding: '10px 12px 0',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n fontSize: 12,\r\n fontWeight: 600,\r\n}\r\n\r\nconst BODY_STYLE: CSSProperties = {\r\n padding: '6px 12px 10px',\r\n display: 'flex',\r\n flexDirection: 'column',\r\n gap: 2,\r\n fontSize: 12,\r\n lineHeight: '18px',\r\n}\r\n\r\nconst LINE_STYLE: CSSProperties = {\r\n color: 'var(--dsw-alias-label-secondary)',\r\n overflowWrap: 'anywhere',\r\n}\r\n\r\nconst MUTED_STYLE: CSSProperties = {\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n}\r\n\r\nconst VIEW_BTN_STYLE: CSSProperties = {\r\n alignSelf: 'flex-start',\r\n marginTop: 2,\r\n padding: 0,\r\n border: 'none',\r\n background: 'none',\r\n font: 'inherit',\r\n fontSize: 12,\r\n color: 'var(--dsw-alias-label-secondary)',\r\n cursor: 'pointer',\r\n textDecoration: 'underline',\r\n}\r\n\r\nconst FAIL_STYLE: CSSProperties = {\r\n ...MUTED_STYLE,\r\n fontSize: 11,\r\n}\r\n\r\n/** 一行里的两个跳转链接(星图 / 条目)。 */\r\nconst LINK_ROW_STYLE: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'center',\r\n gap: 12,\r\n marginTop: 2,\r\n}\r\n\r\n/** 一行:摘要文本按钮(开原文)+ 查看选单(原文 / 条目 / 星图)。 */\r\nconst ROW_STYLE: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'center',\r\n gap: 4,\r\n minWidth: 0,\r\n}\r\n\r\nconst ROW_TEXT_STYLE: CSSProperties = {\r\n ...LINE_STYLE,\r\n flex: '1 1 auto',\r\n minWidth: 0,\r\n padding: 0,\r\n border: 'none',\r\n background: 'none',\r\n font: 'inherit',\r\n textAlign: 'left' as const,\r\n cursor: 'pointer',\r\n overflow: 'hidden',\r\n textOverflow: 'ellipsis',\r\n whiteSpace: 'nowrap' as const,\r\n}\r\n\r\n/** 最近一段的显示长度:侧栏一行,不让一句回忆把整列顶开。 */\r\nconst LATEST_MAX = 60\r\n\r\n/**\r\n * 卡片分段行的词表(与 spirit 的 `ECHO_SEGMENTS` 同口径)。\r\n * 旧版落档没有清洗过的摘要(<system-reminder> 开头、后面跟免责声明),\r\n * 侧栏得自己把它剥掉——旧数据不会因为新版本重写。\r\n */\r\nconst CARD_MARKERS = ['状态:', '反馈:', '线程:', '事务:', '刚刚:', '想起:', '开场:'] as const\r\n\r\n/** 把一张卡的摘要剥成一句:从第一个分段行开切,否则只去标签。 */\r\nfunction cleanPreview(text: string): string {\r\n let cut = -1\r\n for (const marker of CARD_MARKERS) {\r\n const at = text.indexOf(marker)\r\n if (at >= 0 && (cut < 0 || at < cut)) cut = at\r\n }\r\n const body = cut > 0 ? text.slice(cut) : text\r\n return body\r\n .replaceAll(/<[^>]*>/g, ' ')\r\n .replaceAll(/(角色体验快照[^)]*)/g, ' ')\r\n .replaceAll(/\\s+/g, ' ')\r\n .trim()\r\n}\r\n\r\n/** 展示短号:`echo-` + UUID 去连字符前 12 位(与 spirit 侧同口径)。 */\r\nfunction shortEcho(echoId: string): string {\r\n const body = echoId.startsWith('echo-') ? echoId.slice('echo-'.length) : echoId\r\n return `echo-${body.replaceAll('-', '').slice(0, 12)}`\r\n}\r\n\r\n/** 记录时间:`M/D HH:mm`。 */\r\nfunction recordTime(ms: number): string {\r\n const date = new Date(ms)\r\n const pad = (value: number): string => String(value).padStart(2, '0')\r\n return `${date.getMonth() + 1}/${date.getDate()} ${pad(date.getHours())}:${pad(date.getMinutes())}`\r\n}\r\n\r\n/** 行文字:标题(无则 memId);编号/时间/次数另起副行(v7:记录持 echo 号)。 */\r\nfunction rowLabel(row: SpiritEchoRefRow): string {\r\n const title = (row.title ?? '').trim()\r\n return shorten(title !== '' ? title : row.memId)\r\n}\r\n\r\n/** 副行:`echo-xxxx · 11/9 02:46 ×3`。 */\r\nfunction rowMeta(row: SpiritEchoRefRow): string {\r\n const times = row.times > 1 ? ` ×${row.times}` : ''\r\n return `${shortEcho(row.echoId)} · ${recordTime(row.recordTs)}${times}`\r\n}\r\n\r\nfunction shorten(text: string): string {\r\n const flat = cleanPreview(text)\r\n return flat.length <= LATEST_MAX ? flat : `${flat.slice(0, LATEST_MAX)}…`\r\n}\r\n\r\n/**\r\n * 跳过的日志压成一句:`门名 ×次数`。逐条列门名对用户没有信息量,\r\n * 但「这轮为什么没卡」需要能一眼看出来,所以保留汇总而不是全删。\r\n */\r\nfunction summarizeSkips(rows: readonly SpiritEchoStep[]): string {\r\n if (rows.length === 0) return ''\r\n const counts = new Map<string, number>()\r\n for (const row of rows) {\r\n const key = row.reason === '' ? '?' : row.reason\r\n counts.set(key, (counts.get(key) ?? 0) + 1)\r\n }\r\n return [...counts.entries()]\r\n .map(([reason, times]) => (times > 1 ? `${reason} ×${times}` : reason))\r\n .join('、')\r\n}\r\n\r\n/**\r\n * The echo section. The hook runs unconditionally so the absent case never\r\n * changes hook order.\r\n * @param props - translation, client context, session scope.\r\n */\r\nexport function SpiritEchoSection(props: SpiritEchoSectionProps): ReactNode {\r\n const { t, ctx, scope, hideHeader = false } = props\r\n const view = readSpiritEcho(useProjectionValue(ctx, scope?.sessionId, SPIRIT_ECHO_KEY))\r\n // 失败回执整条留着(不只 reason):owner 给的 detail 要能落到 title 上,\r\n // 否则「打开回响失败(unregistered)」永远只有三个字,排查只能靠猜。\r\n const [fail, setFail] = useState<{ reason: string; detail?: string } | undefined>(undefined)\r\n\r\n const onOpen = useCallback((target: SpiritOpenTarget): void => {\r\n const result = openSpiritEcho(target)\r\n setFail(result.ok ? undefined : { reason: result.reason ?? 'absent', detail: result.detail })\r\n }, [])\r\n\r\n // Capability absent (spirit not in the composition, or no frame yet) — hide.\r\n if (view === undefined) return null\r\n\r\n const latest = view.segments[0]\r\n // 列表只列「真的注入了什么」:跳过行没有内容,逐条列出来等于把门名当日志刷屏;\r\n // 旧版(v10 以前)的注入行没有摘要(preview 为 ''),也不再占一行。\r\n const listed = view.steps.filter((row) => row.kind === 'injected' && row.preview !== '')\r\n // 帧里 `steps` 只有最近 5 条:连走几轮「跳过」会把真正的那条注入行挤到 `lastStep`,\r\n // 按 `steps` 判定就会得出「本会话还没有回响段」的假空态。这里把 lastStep 兑回去。\r\n const last = view.lastStep\r\n const injected = last !== undefined && last.kind === 'injected' && last.preview !== ''\r\n && !listed.some((row) => row.id === last.id)\r\n ? [last, ...listed]\r\n : listed\r\n const skips = view.steps.filter((row) => row.kind === 'skipped')\r\n const skipSummary = summarizeSkips(skips)\r\n // 记录聚合(v7 主数据):每行 = 一条被想起的记录(echo-<uuid> + 记录时间)\r\n const refs = view.records ?? view.refs ?? []\r\n const hasAny = injected.length > 0 || latest !== undefined || refs.length > 0\r\n\r\n return createElement(\r\n 'div',\r\n {\r\n style: SECTION_STYLE,\r\n 'data-dsh-brief-sidebar': 'spirit-echo-section',\r\n title: expandCount(t('echo.totalHint'), view.total),\r\n },\r\n hideHeader ? null : createElement('div', { style: HEADER_STYLE }, t('section.spiritEcho')),\r\n createElement(\r\n 'div',\r\n { style: BODY_STYLE },\r\n hasAny\r\n ? createElement(\r\n 'div',\r\n { style: { display: 'flex', flexDirection: 'column', gap: 2 } },\r\n createElement('div', { style: LINE_STYLE }, expandCount(t('echo.stepCount'), refs.length > 0 ? refs.length : injected.length)),\r\n // 引用行优先(v6):标题=内容(如线程任务名),时间=最近召回,×N=召回次数;\r\n // 无 refs 的老帧退回 steps(不伪装新形状存在)。\r\n ...(refs.length > 0\r\n ? refs.slice(0, 3).map((row, index) => createElement(\r\n 'div',\r\n {\r\n key: `${row.sessionId}-${row.echoId}`,\r\n style: ROW_STYLE,\r\n 'data-dsh-brief-sidebar': 'spirit-echo-ref',\r\n },\r\n createElement(\r\n 'button',\r\n {\r\n type: 'button' as const,\r\n style: { ...ROW_TEXT_STYLE, ...(index === 0 ? {} : MUTED_STYLE) },\r\n 'data-dsh-brief-sidebar': 'spirit-echo-ref-title',\r\n title: `${row.echoId} · ${new Date(row.recordTs).toLocaleString()} · ${t('echo.openOriginal')}`,\r\n onClick: () => { openEchoTab(row.sessionId !== '' ? row.sessionId : (scope?.sessionId ?? ''), row.lastRecallId) },\r\n },\r\n rowLabel(row),\r\n ),\r\n // 副行:echo 短号 + 记录时间 + ×N(用户要求“能看到记录时间和 echo id”)\r\n createElement('div', { style: { ...MUTED_STYLE, fontSize: 11 }, 'data-dsh-brief-sidebar': 'spirit-echo-ref-meta', title: row.echoId }, rowMeta(row)),\r\n createElement(EchoViewMenu, {\r\n t,\r\n sessionId: row.sessionId !== '' ? row.sessionId : (scope?.sessionId ?? ''),\r\n echoId: row.lastRecallId,\r\n }),\r\n )) \r\n : injected.slice(0, 3).map((row, index) => createElement(\r\n 'div',\r\n {\r\n key: `${row.id}-${index}`,\r\n style: ROW_STYLE,\r\n 'data-dsh-brief-sidebar': 'spirit-echo-row',\r\n },\r\n createElement(\r\n 'button',\r\n {\r\n type: 'button' as const,\r\n style: {\r\n ...ROW_TEXT_STYLE,\r\n ...(index === 0 ? {} : MUTED_STYLE),\r\n },\r\n 'data-dsh-brief-sidebar': 'spirit-echo-row-injected',\r\n title: `${row.id} · ${new Date(row.at).toLocaleString()} · ${t('echo.openOriginal')}`,\r\n onClick: () => { openEchoTab(scope?.sessionId ?? '', row.id) },\r\n },\r\n (row.title ?? '').trim() !== '' ? shorten(row.title ?? '') : shorten(row.preview),\r\n ),\r\n // 行级选单:与 memory 行同款(原文 / 条目 / 星图),不必滑到底部链接。\r\n createElement(EchoViewMenu, {\r\n t,\r\n sessionId: scope?.sessionId ?? '',\r\n echoId: row.id,\r\n }),\r\n ))),\r\n )\r\n : createElement(\r\n 'div',\r\n { style: MUTED_STYLE },\r\n createElement('div', null, t('echo.empty')),\r\n createElement('div', { style: { fontSize: 11 } }, t('echo.emptyHint')),\r\n ),\r\n // 跳过不逐条列,只给一句汇总(门名 × 次数)——它回答「为什么没卡」,不是回忆。\r\n skipSummary !== '' && createElement(\r\n 'div',\r\n {\r\n style: { ...MUTED_STYLE, fontSize: 11 },\r\n 'data-dsh-brief-sidebar': 'spirit-echo-skips',\r\n },\r\n expandCount(t('echo.skippedSummary'), skips.length).replace('{reasons}', skipSummary),\r\n ),\r\n // 想起的段落单独一行:有引用时以引用行为准(title + 次数),否则退回段落口径。\r\n (refs.length > 0 || latest !== undefined) && createElement(\r\n 'div',\r\n { style: { ...LINE_STYLE, ...MUTED_STYLE }, 'data-dsh-brief-sidebar': 'spirit-echo-latest' },\r\n refs.length > 0\r\n ? `${t('echo.latest')}${refs[0]!.title !== '' ? refs[0]!.title : refs[0]!.memId} · ${shortEcho(refs[0]!.echoId)}`\r\n : `${t('echo.latest')}${latest === undefined ? '' : shorten(latest.excerpt)}`,\r\n ),\r\n createElement(\r\n 'div',\r\n { style: LINK_ROW_STYLE },\r\n createElement('button', {\r\n type: 'button' as const,\r\n style: VIEW_BTN_STYLE,\r\n 'data-dsh-brief-sidebar': 'spirit-echo-goto-graph',\r\n onClick: () => { onOpen('graph') },\r\n }, t('echo.gotoGraph')),\r\n createElement('button', {\r\n type: 'button' as const,\r\n style: VIEW_BTN_STYLE,\r\n 'data-dsh-brief-sidebar': 'spirit-echo-goto',\r\n onClick: () => { onOpen('echo') },\r\n }, t('echo.goto')),\r\n ),\r\n fail !== undefined && createElement(\r\n 'div',\r\n {\r\n style: FAIL_STYLE,\r\n 'data-dsh-brief-sidebar': 'spirit-echo-fail',\r\n ...(fail.detail === undefined ? {} : { title: fail.detail }),\r\n },\r\n `${t('echo.gotoFail')}(${fail.reason})`,\r\n ),\r\n ),\r\n )\r\n}\r\n","/**\r\n * The references section: 技能与记忆并列成两个可左右切换的页签。\r\n *\r\n * Why a tab strip instead of three stacked sections: the two lists answer the\r\n * same question — \"what entered this session's context\" — from two different\r\n * providers (this plugin's own skill fold, and prime-memory's recall/slots).\r\n * Stacked, they pushed the board and the produced files off screen on a narrow\r\n * sidebar; side by side, each gets the full width when the reader actually\r\n * wants it.\r\n *\r\n * Two decisions worth knowing when editing this file:\r\n *\r\n * 1. **The inactive pane stays mounted and is hidden with `display:none`.**\r\n * The recall pane carries real interaction state (selected row, pending\r\n * rating, the expanded history group); unmounting it would silently reset\r\n * what the human just did every time they glanced at the skills tab. The\r\n * cost is that a hidden pane keeps re-rendering on projection frames —\r\n * bounded, because the whole tab still renders nothing while `visible` is\r\n * false (see `SummaryTab`).\r\n * 2. **The parent repeats its children's gates.** A section that hides itself\r\n * leaves the tab strip pointing at an empty pane, so the availability\r\n * question is answered here with the SAME readers and resolvers the children\r\n * use. `tests/reference-section.spec.tsx` pins both sides against the same\r\n * fixtures — if a child gate ever drifts from this one, that test goes red\r\n * rather than the UI growing a dead tab.\r\n *\r\n * Colours come from `--dsw-alias-*` tokens only (skin contract).\r\n */\r\nimport { createElement } from 'react'\r\nimport { useCallback, useState } from 'react'\r\nimport type { CSSProperties, KeyboardEvent, ReactNode } from 'react'\r\nimport type { CtxProbe } from '../use-projection'\r\nimport { SKILL_USAGE_KEY } from '../../projection/keys'\r\nimport { useProjectionValue } from '../use-projection'\r\nimport { readSkillUsage } from './skill-usage'\r\nimport { SEARCH_REFS_KEY, readSearchRefs } from './search-refs'\r\nimport { MEMORY_RECALL_KEY, readRecall } from './memory-recall'\r\nimport { MEMORY_SLOTS_KEY, readSlots } from './memory-slots'\r\nimport { resolveShowMemoryRecall, resolveShowMemorySlots, resolveShowSpiritEcho } from '../scope-face'\r\nimport { useConfigFlag } from './use-config-flag'\r\nimport { SkillUsageSection } from './SkillUsageSection'\r\nimport { SearchRefSection } from './SearchRefSection'\r\nimport { MemoryRecallSection } from './MemoryRecallSection'\r\nimport { MemorySlotsSection } from './MemorySlotsSection'\r\nimport { MemoryViewMenu } from './MemoryViewMenu'\r\nimport { SpiritEchoSection } from './SpiritEchoSection'\r\nimport { SPIRIT_ECHO_KEY, readSpiritEcho } from '../spirit-echo'\r\nimport type { FeedbackFetch } from './recall-feedback'\r\n\r\nexport interface ReferenceSectionProps {\r\n /** The DSH locale lookup, passed down from `apply`. */\r\n t: (key: string) => string\r\n /** The client root context (the tab body's only way to reach services). */\r\n ctx?: CtxProbe\r\n /** The session this tab is scoped to. */\r\n scope?: { readonly sessionId?: string }\r\n /** The rating transport, handed straight to the recall pane. */\r\n fetchImpl?: FeedbackFetch\r\n}\r\n\r\n/** Which pane is showing. Echo is a reference fact too (what spirit injected). */\r\nexport type ReferenceTab = 'skills' | 'memory' | 'search' | 'echo'\r\n\r\nconst SECTION_STYLE: CSSProperties = {\r\n flexShrink: 0,\r\n borderBottom: '1px solid var(--dsw-alias-border-secondary)',\r\n}\r\n\r\nconst HEADER_STYLE: CSSProperties = {\r\n padding: '10px 12px 0',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n fontSize: 12,\r\n fontWeight: 600,\r\n}\r\n\r\n/** The tab strip: flush-left, same gutter as section headers. */\r\nconst TABS_STYLE: CSSProperties = {\r\n display: 'flex',\r\n gap: 4,\r\n padding: '6px 12px 0',\r\n}\r\n\r\n/** One tab. Selected gets a hairline of secondary label; never a colour literal. */\r\nconst TAB_STYLE: CSSProperties = {\r\n background: 'none',\r\n border: 'none',\r\n borderBottom: '1px solid transparent',\r\n font: 'inherit',\r\n fontSize: 12,\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n cursor: 'pointer',\r\n padding: '4px 8px 6px',\r\n}\r\n\r\nconst TAB_ACTIVE_STYLE: CSSProperties = {\r\n ...TAB_STYLE,\r\n borderBottom: '1px solid var(--dsw-alias-label-secondary)',\r\n color: 'var(--dsw-alias-label-primary)',\r\n fontWeight: 600,\r\n}\r\n\r\nconst ORDER: readonly ReferenceTab[] = ['skills', 'memory', 'search', 'echo']\r\n\r\n/**\r\n * The references section. All hooks run before any early return, so the tab\r\n * strip can disappear (no capability at all) without ever changing hook order.\r\n *\r\n * @param props - translation, client context, session scope, rating transport.\r\n */\r\nexport function ReferenceSection(props: ReferenceSectionProps): ReactNode {\r\n const { t, ctx, scope, fetchImpl } = props\r\n const [tab, setTab] = useState<ReferenceTab>('skills')\r\n\r\n // The same three reads the children make, used only to decide whether the\r\n // strip has anything to point at.\r\n const skillsLive = readSkillUsage(useProjectionValue(ctx, scope?.sessionId, SKILL_USAGE_KEY)) !== undefined\r\n const searchLive = readSearchRefs(useProjectionValue(ctx, scope?.sessionId, SEARCH_REFS_KEY)) !== undefined\r\n const recallFrame = readRecall(useProjectionValue(ctx, scope?.sessionId, MEMORY_RECALL_KEY))\r\n const slotsFrame = readSlots(useProjectionValue(ctx, scope?.sessionId, MEMORY_SLOTS_KEY))\r\n const echoFrame = readSpiritEcho(useProjectionValue(ctx, scope?.sessionId, SPIRIT_ECHO_KEY))\r\n const recallOn = useConfigFlag(ctx, resolveShowMemoryRecall) !== false\r\n const slotsOn = useConfigFlag(ctx, resolveShowMemorySlots) === true\r\n const echoOn = useConfigFlag(ctx, resolveShowSpiritEcho) !== false\r\n const memoryLive = (recallFrame !== undefined && recallOn) || (slotsFrame !== undefined && slotsOn)\r\n // 回响页签与记忆同一种控制:能力在 + 开关开。关掉就整页签消失(不留空壳)。\r\n const echoLive = echoFrame !== undefined && echoOn\r\n const live: Record<ReferenceTab, boolean> = { skills: skillsLive, memory: memoryLive, search: searchLive, echo: echoLive }\r\n // 记住的选择可能因能力变化而消失(例如关掉记忆开关):退到第一个可用页签。\r\n const active: ReferenceTab = live[tab] ? tab : ORDER.find(id => live[id]) ?? 'skills'\r\n\r\n const onTabsKeyDown = useCallback((event: KeyboardEvent<HTMLDivElement>): void => {\r\n // 左右方向键在“可用页签”里循环:能力缺席的页签不该被键盘走到。\r\n if (event.key !== 'ArrowLeft' && event.key !== 'ArrowRight') return\r\n event.preventDefault()\r\n const shown = ORDER.filter(id => live[id])\r\n if (shown.length < 2) return\r\n const at = shown.indexOf(active)\r\n const step = event.key === 'ArrowRight' ? 1 : shown.length - 1\r\n setTab(shown[(at + step) % shown.length])\r\n }, [live, active])\r\n\r\n // Nothing to reference — no provider in the composition, or everything switched off.\r\n if (!skillsLive && !memoryLive && !searchLive && !echoLive) return null\r\n\r\n const tabButton = (id: ReferenceTab, label: string): ReactNode => createElement(\r\n 'button',\r\n {\r\n key: id,\r\n type: 'button',\r\n role: 'tab',\r\n id: `dsh-brief-reference-tab-${id}`,\r\n 'aria-selected': active === id,\r\n 'aria-controls': `dsh-brief-reference-pane-${id}`,\r\n style: active === id ? TAB_ACTIVE_STYLE : TAB_STYLE,\r\n 'data-dsh-brief-sidebar': `reference-tab-${id}`,\r\n onClick: () => { setTab(id) },\r\n },\r\n label,\r\n )\r\n\r\n return createElement(\r\n 'div',\r\n { style: SECTION_STYLE, 'data-dsh-brief-sidebar': 'references-section' },\r\n createElement('div', { style: HEADER_STYLE }, t('section.references')),\r\n createElement(\r\n 'div',\r\n {\r\n role: 'tablist',\r\n 'aria-label': t('section.references'),\r\n style: TABS_STYLE,\r\n onKeyDown: onTabsKeyDown,\r\n 'data-dsh-brief-sidebar': 'reference-tabs',\r\n },\r\n skillsLive && tabButton('skills', t('references.tabSkills')),\r\n // 每个页签各自条件化:只有一侧能力时不该留个点了就空的页签。\r\n memoryLive && tabButton('memory', t('references.tabMemory')),\r\n searchLive && tabButton('search', t('references.tabSearch')),\r\n echoLive && tabButton('echo', t('references.tabEcho')),\r\n ),\r\n skillsLive && createElement(\r\n 'div',\r\n {\r\n role: 'tabpanel',\r\n id: 'dsh-brief-reference-pane-skills',\r\n 'aria-labelledby': 'dsh-brief-reference-tab-skills',\r\n hidden: active !== 'skills',\r\n style: active === 'skills' ? undefined : { display: 'none' },\r\n 'data-dsh-brief-sidebar': 'reference-pane-skills',\r\n },\r\n createElement(SkillUsageSection, { t, ctx, scope, hideHeader: true }),\r\n ),\r\n memoryLive && createElement(\r\n 'div',\r\n {\r\n role: 'tabpanel',\r\n id: 'dsh-brief-reference-pane-memory',\r\n 'aria-labelledby': 'dsh-brief-reference-tab-memory',\r\n hidden: active !== 'memory',\r\n style: active === 'memory' ? undefined : { display: 'none' },\r\n 'data-dsh-brief-sidebar': 'reference-pane-memory',\r\n },\r\n // 记忆库指路:条目 / 2D / 3D 由 dsh-prime-memory 的整页渲染,这里只做深链。\r\n // 能力缺席时整节已隐藏,菜单不会单独出现。\r\n createElement(MemoryViewMenu, { key: 'memory-view', t }),\r\n // 两条记忆链各有自己的标题:召回与常驻槽位是不同事实,合成一节会糊掉。\r\n createElement(MemoryRecallSection, { t, ctx, scope, fetchImpl }),\r\n createElement(MemorySlotsSection, { t, ctx, scope }),\r\n ),\r\n searchLive && createElement(\r\n 'div',\r\n {\r\n role: 'tabpanel',\r\n id: 'dsh-brief-reference-pane-search',\r\n 'aria-labelledby': 'dsh-brief-reference-tab-search',\r\n hidden: active !== 'search',\r\n style: active === 'search' ? undefined : { display: 'none' },\r\n 'data-dsh-brief-sidebar': 'reference-pane-search',\r\n },\r\n createElement(SearchRefSection, { t, ctx, scope, hideHeader: true }),\r\n ),\r\n echoLive && createElement(\r\n 'div',\r\n {\r\n role: 'tabpanel',\r\n id: 'dsh-brief-reference-pane-echo',\r\n 'aria-labelledby': 'dsh-brief-reference-tab-echo',\r\n hidden: active !== 'echo',\r\n style: active === 'echo' ? undefined : { display: 'none' },\r\n 'data-dsh-brief-sidebar': 'reference-pane-echo',\r\n },\r\n // 回响是引用的一部分:它回答“这轮引用/跳过了什么”,与技能、记忆同列。\r\n createElement(SpiritEchoSection, { t, ctx, scope, hideHeader: true }),\r\n ),\r\n )\r\n}\r\n","/**\r\n * The summary tab body: the session's at-a-glance state, composed of sections.\r\n *\r\n * Section order: 进展 (the todos board) → 产物 (produced files, codeplan\r\n * artifacts marked inline) → 引用 (two switchable tabs: 技能 and 记忆).\r\n * The reference tabs replaced three stacked sections: which skills entered the\r\n * session, what prime-memory injected and compaction has not overwritten, and\r\n * the hand-pinned resident slots — all three answer \"what is in this session's\r\n * context\", and stacking them pushed the board off a narrow sidebar. Each pane\r\n * keeps its own data chain and its own gating contract; this component owns\r\n * only the shell.\r\n *\r\n * Two better-sidebar contracts are honoured:\r\n *\r\n * 1. **Height contract.** The tab body mounts inside a full-height column flex\r\n * host whose `.paneBody` is a definite-height BLOCK scroll container. The\r\n * root declares `height: 100%` + `min-height: 0`, and the scrolling element\r\n * is an inner div — not the root. Sections are non-scrolling slices with a\r\n * bottom border; the inner div scrolls them all.\r\n * 2. **`visible` pause.** Nothing is drawn while the tab is not the active\r\n * one, so a hidden tab does not re-render on every projection frame.\r\n */\r\nimport { createElement } from 'react'\r\nimport type { CSSProperties, ReactNode } from 'react'\r\nimport type { CtxProbe } from './use-projection'\r\nimport { TodoSection } from './TodoBoardTab'\r\nimport type { TodoScope } from './TodoBoardTab'\r\nimport { DeliverablesSection } from './summary/DeliverablesSection'\r\nimport { ReferenceSection } from './summary/ReferenceSection'\r\n\r\nexport interface SummaryTabProps {\r\n /** The DSH locale lookup, passed down from `apply`. */\r\n t: (key: string) => string\r\n /** The client root context (the tab body's only way to reach services). */\r\n ctx?: CtxProbe\r\n /** The session this tab is scoped to. */\r\n scope?: TodoScope\r\n /** Whether the tab is the active one AND the panel is open. */\r\n visible?: boolean\r\n}\r\n\r\nconst ROOT_STYLE: CSSProperties = {\r\n display: 'flex',\r\n flexDirection: 'column',\r\n height: '100%',\r\n minHeight: 0,\r\n background: 'var(--dsw-alias-bg-layer-1)',\r\n color: 'var(--dsw-alias-label-primary)',\r\n font: 'inherit',\r\n fontSize: 13,\r\n}\r\n\r\nconst SCROLL_STYLE: CSSProperties = { flex: 1, minHeight: 0, overflow: 'auto' }\r\n\r\n/**\r\n * The summary tab.\r\n * @param props - translation, client context, session scope, visibility.\r\n */\r\nexport function SummaryTab(props: SummaryTabProps): ReactNode {\r\n const { t, ctx, scope, visible = true } = props\r\n\r\n // A hidden tab renders NOTHING — not even the shell — so it never\r\n // re-renders on a projection frame while it is off screen.\r\n if (!visible) return null\r\n\r\n return createElement(\r\n 'div',\r\n { style: ROOT_STYLE, 'data-dsh-brief-sidebar': 'board' },\r\n createElement('div', { style: SCROLL_STYLE },\r\n createElement(TodoSection, { key: 'progress', t, ctx, scope }),\r\n createElement(DeliverablesSection, { key: 'deliverables', t, ctx, scope }),\r\n // 引用:技能页(`dshSummarySkillUsage`,本插件自己的 host 半注册)与记忆页\r\n // (`memoryRecall` / `memorySlots`,由 dsh-prime-memory 提供,各有开关)并列,\r\n // 可点击或用左右方向键切换。两个页签都空时整节隐藏(无能力 ≠ 空态)。\r\n createElement(ReferenceSection, { key: 'references', t, ctx, scope }),\r\n ),\r\n )\r\n}\r\n","/**\r\n * Native right-sidebar path: register the board tab directly into the DSH\r\n * host's own sidebar, with NO better-sidebar in sight. Available on host\r\n * generations that ship `dsh-client-ui-sidebar-right` (0.1.5+; verified by\r\n * slot-declaration forensics on 0.1.5-rc.3, 0.1.7-rc.2 and 0.2.0-rc.2).\r\n *\r\n * The host opens a tab type through a two-stage registration, and this module\r\n * copies better-sidebar's own native bridge EXACTLY — that plugin is the\r\n * shipped, field-proof consumer of the same seats:\r\n *\r\n * 1. Stage one, \"what the type IS\": `ctx.sidebarRightTabs.register({id, kind,\r\n * title, guide})` (a `SidebarRightTabDefinition`; page type — no `patterns`,\r\n * opened by kind). The returned disposer lives in our effect.\r\n * 2. Stage two, \"what the body draws\": a keyed registration under\r\n * `sidebar.right.pane.tab` whose `key` is the definition's `id`. The inject\r\n * callback receives the session id; everything else (our `t`, the root\r\n * `ctx`) rides a closure, and `SummaryTab` reads session data through\r\n * `ctx.get('sessions')` exactly as it does under better-sidebar.\r\n *\r\n * Degradations versus the better-sidebar path, accepted deliberately:\r\n * - no badge — the native chip has no badge affordance; the unfinished count\r\n * still shows inside the tab body.\r\n * - no `visible` pause — the host unmounts inactive bodies (`keepMounted`\r\n * defaults to false), which subsumes it.\r\n * - the open affordance is the guide-page capsule (`guide[]`), not a rail icon.\r\n *\r\n * Everything is read through `ctx.get` structural probes: the services are\r\n * absent on ≤0.1.2 hosts, so the caller must treat `undefined` as \"no native\r\n * surface\" and stay inert rather than crash. No import from\r\n * `@deepseek-ai/dsh-client-ui-sidebar-right` — a browser-only plugin keeps zero\r\n * build-time coupling to host internals, mirroring `use-projection.ts`.\r\n */\r\nimport type { ReactNode } from 'react'\r\nimport type { CtxProbe } from './use-projection'\r\nimport type { SlotsLike } from './brief/dock-shadow'\r\nimport { SummaryTab } from './SummaryTab'\r\n\r\n/** One guide-page capsule contributed by our type (structural `SidebarRightGuideEntry`). */\r\ninterface NativeGuideEntry {\r\n readonly id: string\r\n readonly order: number\r\n readonly title: () => string\r\n readonly description?: () => string\r\n}\r\n\r\n/** Stage-one shape (structural `SidebarRightTabDefinition`; only the page-type fields). */\r\ninterface NativeTabDefinition {\r\n readonly id: string\r\n readonly kind: string\r\n readonly title: (address: string) => string\r\n readonly guide?: readonly NativeGuideEntry[]\r\n}\r\n\r\n/** `ctx.sidebarRightTabs` — the only method we call. */\r\ninterface NativeTabRegistryLike {\r\n register(definition: NativeTabDefinition): () => void\r\n}\r\n\r\nexport type { NativeTabRegistryLike }\r\n\r\n/** The keyed seat a tab type registers its body under. */\r\nconst PANE_TAB_SEAT = 'sidebar.right.pane.tab'\r\n\r\n/**\r\n * Whether this host exposes the native right-sidebar tab system at all.\r\n *\r\n * Both services must answer: the registry stages the type, and a future\r\n * \"open from a button\" affordance goes through the controller face.\r\n * @param ctx - the client root context.\r\n */\r\nexport function nativeSidebarAvailable(ctx: CtxProbe): boolean {\r\n const registry = ctx.get('sidebarRightTabs') as NativeTabRegistryLike | undefined\r\n const controller = ctx.get('sidebarRight') as unknown\r\n return (\r\n registry !== undefined &&\r\n typeof registry.register === 'function' &&\r\n controller !== undefined &&\r\n ctx.get('slots') !== undefined\r\n )\r\n}\r\n\r\n/**\r\n * Register the board as a native right-sidebar tab type.\r\n *\r\n * The registry arrives as a parameter, read from the deferred `ctx.inject`\r\n * scope in `apply` — the 0.1.7+ strict-proxy ctx refuses a root `ctx.get`\r\n * of an undeclared service, so reaching for `sidebarRightTabs` from the root\r\n * context is what made the native seat silently no-op on 0.1.7 (the \"cannot\r\n * register directly\" observation). better-sidebar's own native bridge reads\r\n * it the same way: from the inject callback's scope.\r\n *\r\n * @param ctx - the client root context (for the declared `slots` service).\r\n * @param registry - the host tab-type registry from the injected scope.\r\n * @param deps - the stable ids and the translator from `apply`.\r\n * @returns a disposer that unregisters the seat first, then the type (the\r\n * registry refuses opens for a type whose body is already gone).\r\n */\r\nexport function registerNativeBoardTab(\r\n ctx: CtxProbe,\r\n registry: NativeTabRegistryLike | undefined,\r\n deps: { id: string; kind: string; order: number; t: (key: string) => string },\r\n): () => void {\r\n const slots = ctx.get('slots') as SlotsLike | undefined\r\n if (registry === undefined || typeof registry.register !== 'function' || slots === undefined) {\r\n return (): void => {}\r\n }\r\n\r\n // Stage 1: the type. Page kind — opened from the guide capsule by `kind`.\r\n const disposeType = registry.register({\r\n id: deps.id,\r\n kind: deps.kind,\r\n title: () => deps.t('tab.title'),\r\n guide: [\r\n {\r\n id: deps.id,\r\n order: deps.order,\r\n title: () => deps.t('tab.title'),\r\n description: () => deps.t('tab.desc'),\r\n },\r\n ],\r\n })\r\n\r\n // Stage 2: the body, keyed under the definition's own id. The payload\r\n // mirrors better-sidebar's `TabComponentProps` fields that SummaryTab reads;\r\n // `visible` is pinned true because the host unmounts hidden bodies anyway.\r\n const disposeSeat = slots.inject(PANE_TAB_SEAT, () =>\r\n slots.register(\r\n {\r\n name: PANE_TAB_SEAT,\r\n key: deps.id,\r\n inject: (sessionId: string) => ({\r\n t: deps.t,\r\n ctx,\r\n scope: { sessionId },\r\n visible: true,\r\n }),\r\n },\r\n SummaryTab as unknown as (props: unknown) => ReactNode,\r\n ),\r\n )\r\n\r\n return (): void => {\r\n try {\r\n disposeSeat()\r\n } finally {\r\n disposeType()\r\n }\r\n }\r\n}\r\n","/**\r\n * 回响原文查看器:按编号取一条回响当时注入的卡全文。\r\n *\r\n * 为什么单开一个 tab(与记忆查看器同款):侧栏一行只能放摘要,而「这条当时到底写了\r\n * 什么」是回响的原文事实,不能拿摘要冒充。数据来自 spirit 的 `echo-detail` RPC\r\n * (本仓不跨包 import,只走同源 loopback 路由)。\r\n *\r\n * 失败面同样是数据:条目不在了 / spirit 没装 / 网络抖动,都显示成人话,不吞成空白。\r\n */\r\nimport { createElement, useEffect, useState } from 'react'\r\nimport type { CSSProperties, ReactNode } from 'react'\r\n\r\ninterface DetailItem {\r\n id: string\r\n at: number\r\n kind: 'injected' | 'skipped'\r\n reason: string\r\n fingerprint: string\r\n preview: string\r\n text: string\r\n}\r\n\r\nconst WRAP: CSSProperties = {\r\n padding: '12px 14px',\r\n overflow: 'auto',\r\n height: '100%',\r\n fontSize: 13,\r\n lineHeight: 1.65,\r\n color: 'var(--dsw-alias-label-primary)',\r\n}\r\nconst HEAD: CSSProperties = {\r\n display: 'flex',\r\n flexWrap: 'wrap',\r\n alignItems: 'center',\r\n gap: 8,\r\n marginBottom: 10,\r\n paddingBottom: 8,\r\n borderBottom: '1px solid var(--dsw-alias-border-secondary)',\r\n fontSize: 11,\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n}\r\nconst ID_STYLE: CSSProperties = {\r\n fontFamily: 'ui-monospace,monospace',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n}\r\nconst CARD: CSSProperties = {\r\n whiteSpace: 'pre-wrap',\r\n wordBreak: 'break-word',\r\n fontFamily: 'ui-monospace,monospace',\r\n fontSize: 12.5,\r\n color: 'var(--dsw-alias-label-primary)',\r\n}\r\nconst MUTED: CSSProperties = { color: 'var(--dsw-alias-label-tertiary)', fontSize: 12 }\r\n\r\n/** `path` = `<sessionId>|<echoId>`;任何一半缺失都不发请求。 */\r\nexport function splitEchoPath(path: string | undefined): { sessionId: string; id: string } {\r\n const raw = path ?? ''\r\n const at = raw.indexOf('|')\r\n if (at <= 0) return { sessionId: '', id: '' }\r\n return { sessionId: raw.slice(0, at), id: raw.slice(at + 1) }\r\n}\r\n\r\nexport interface EchoViewerProps {\r\n tab?: { path?: string }\r\n t?: (key: string) => string\r\n /** The tab seat hands the client context down; the viewer reads nothing from it today. */\r\n ctx?: unknown\r\n}\r\n\r\n/**\r\n * The echo viewer body.\r\n * @param props - the better-sidebar tab seat (path carries sessionId|id).\r\n */\r\nexport function EchoViewer(props: EchoViewerProps): ReactNode {\r\n const { sessionId, id } = splitEchoPath(props.tab?.path)\r\n const [item, setItem] = useState<DetailItem | undefined>(undefined)\r\n const [error, setError] = useState<string | undefined>(undefined)\r\n\r\n useEffect(() => {\r\n if (sessionId === '' || id === '') return\r\n let cancelled = false\r\n setError(undefined)\r\n setItem(undefined)\r\n fetch('/dsh-spirit/rpc/echo-detail', {\r\n method: 'POST',\r\n headers: { 'Content-Type': 'application/json' },\r\n body: JSON.stringify({ sessionId, id }),\r\n })\r\n .then(async (r) => {\r\n if (!r.ok) throw new Error(`HTTP ${r.status}`)\r\n return (await r.json()) as { ok?: boolean; value?: { item?: DetailItem } }\r\n })\r\n .then((env) => {\r\n if (cancelled) return\r\n if (env.ok === true && env.value?.item !== undefined) {\r\n setItem(env.value.item)\r\n return\r\n }\r\n setError('该回响条目已不在库里')\r\n })\r\n .catch((e: unknown) => { if (!cancelled) setError(e instanceof Error ? e.message : String(e)) })\r\n return () => { cancelled = true }\r\n }, [sessionId, id])\r\n\r\n if (sessionId === '' || id === '') {\r\n return createElement('div', { style: WRAP }, createElement('div', { style: MUTED }, '未选择回响条目'))\r\n }\r\n if (error !== undefined) {\r\n return createElement('div', { style: WRAP }, createElement('div', { style: MUTED }, `⚠️ ${error}`))\r\n }\r\n if (item === undefined) {\r\n return createElement('div', { style: WRAP }, createElement('div', { style: MUTED }, '加载中…'))\r\n }\r\n\r\n return createElement(\r\n 'div',\r\n { style: WRAP, 'data-dsh-brief-sidebar': 'echo-viewer' },\r\n createElement(\r\n 'div',\r\n { style: HEAD },\r\n createElement('span', { style: ID_STYLE, 'data-dsh-brief-sidebar': 'echo-viewer-id' }, item.id),\r\n createElement('span', null, item.kind === 'injected' ? '注入' : `跳过(${item.reason})`),\r\n createElement('span', null, new Date(item.at).toLocaleString()),\r\n item.fingerprint !== '' ? createElement('span', null, item.fingerprint.slice(0, 24)) : null,\r\n ),\r\n item.text === ''\r\n ? createElement(\r\n 'div',\r\n { style: MUTED, 'data-dsh-brief-sidebar': 'echo-viewer-no-text' },\r\n `早期落档(${new Date(item.at).toLocaleString()}):这条当时只存了摘要、没存原文。`,\r\n createElement('div', { style: { marginTop: 6 } }, item.preview),\r\n )\r\n : createElement('div', { style: CARD }, item.text),\r\n )\r\n}\r\n","/**\r\n * Memory viewer component: fetches full metadata by memoryId via records-meta API,\r\n * renders a structured header bar + markdown body.\r\n */\r\nimport { createElement, useEffect, useState, Fragment } from 'react'\r\nimport type { CSSProperties, ReactNode } from 'react'\r\nimport type { Context } from '@deepseek-ai/cordis'\r\n\r\n/* ── Types (mirror prime-memory contract, no cross-repo import) ── */\r\ninterface RecordMeta {\r\n id: string\r\n name: string | null\r\n type: string\r\n priority: number\r\n content: string\r\n maturity?: 'low' | 'mid' | 'high'\r\n createdAt: string | null\r\n updatedAt: string | null\r\n scene: string\r\n scope: 'global' | 'workspace'\r\n workspaceId: string | null\r\n keywords?: string[]\r\n usageScenario?: string[]\r\n filePath: string\r\n retired: boolean\r\n}\r\n\r\ninterface Props {\r\n ctx: Context\r\n memoryId: string\r\n scope: { sessionId?: string }\r\n}\r\n\r\n/** 宿主 RPC 信封:失败分支的 `error` 是 `{code,message,details}` **对象**,不是字符串。 */\r\ninterface RecordsMetaEnvelope {\r\n ok?: boolean\r\n value?: { items?: RecordMeta[] }\r\n error?: { code?: string; message?: string } | string\r\n}\r\n\r\n/**\r\n * 把失败信封说成人话。\r\n *\r\n * 直接把 `error` 当字符串拼进模板会得到 `⚠️ [object Object]`——用户看不到原因,\r\n * 排查只能靠猜。取 `error.message`,拿不到才给兜底文案。\r\n */\r\nfunction describeEnvelopeError(env: RecordsMetaEnvelope): string {\r\n const e = env.error\r\n if (typeof e === 'string' && e.length > 0) return e\r\n if (e !== null && typeof e === 'object' && typeof e.message === 'string' && e.message.length > 0) return e.message\r\n return '未找到该记忆'\r\n}\r\n\r\n/* ── Styles (all --dsw-alias-* tokens) ── */\r\nconst WRAP: CSSProperties = { padding: '12px 16px', overflow: 'auto', height: '100%', fontSize: 13, lineHeight: 1.6, color: 'var(--dsw-alias-label-primary)' }\r\nconst HEADER: CSSProperties = { marginBottom: 12, paddingBottom: 8, borderBottom: '1px solid var(--dsw-alias-border-secondary)' }\r\nconst BADGE: CSSProperties = { display: 'inline-block', fontSize: 11, padding: '1px 6px', borderRadius: 999, border: '1px solid var(--dsw-alias-label-tertiary)', color: 'var(--dsw-alias-label-tertiary)', marginRight: 6, marginBottom: 4 }\r\nconst NAME_STYLE: CSSProperties = { fontSize: 15, fontWeight: 700, marginBottom: 4, color: 'var(--dsw-alias-label-primary)' }\r\nconst META_LINE: CSSProperties = { fontSize: 11, color: 'var(--dsw-alias-label-tertiary)', marginBottom: 2 }\r\nconst LABEL: CSSProperties = { fontSize: 11, color: 'var(--dsw-alias-label-tertiary)', marginBottom: 4, fontWeight: 600, display: 'block' }\r\nconst CHIP: CSSProperties = { display: 'inline-block', fontSize: 11, padding: '3px 10px', borderRadius: 6, border: '1px solid var(--dsw-alias-label-tertiary)', color: 'var(--dsw-alias-label-primary)', marginRight: 8, marginBottom: 6 }\r\nconst CHIP_ROW: CSSProperties = { marginBottom: 8 }\r\nconst PLACEHOLDER: CSSProperties = { padding: 24, textAlign: 'center', color: 'var(--dsw-alias-label-tertiary)' }\r\n\r\n/* ── Markdown renderer (same pattern as RecallBubble) ── */\r\nconst H_STYLES: CSSProperties[] = [\r\n { fontSize: 15, fontWeight: 700, margin: '8px 0 4px' },\r\n { fontSize: 14, fontWeight: 600, margin: '6px 0 3px' },\r\n { fontSize: 13, fontWeight: 600, margin: '5px 0 2px' },\r\n { fontSize: 12, fontWeight: 600, margin: '4px 0 2px' },\r\n { fontSize: 12, fontWeight: 600, margin: '3px 0 1px' },\r\n { fontSize: 11, fontWeight: 600, margin: '3px 0 1px' },\r\n]\r\nconst P_STYLE: CSSProperties = { margin: '2px 0', whiteSpace: 'pre-wrap', wordBreak: 'break-word' }\r\nconst LI_STYLE: CSSProperties = { margin: '1px 0 1px 12px', whiteSpace: 'pre-wrap' }\r\nconst CODE_STYLE: CSSProperties = { fontFamily: 'ui-monospace,monospace', fontSize: '0.9em', background: 'var(--dsw-alias-fill-tertiary)', padding: '0 3px', borderRadius: 3 }\r\n\r\nfunction inline(text: string, key: string): ReactNode[] {\r\n const nodes: ReactNode[] = []\r\n const re = /\\*\\*(.+?)\\*\\*|`(.+?)`/\r\n let rest = text; let i = 0\r\n while (rest.length > 0) {\r\n const m = re.exec(rest)\r\n if (m === null) { nodes.push(rest); break }\r\n if (m.index > 0) nodes.push(rest.slice(0, m.index))\r\n if (m[1] !== undefined) nodes.push(createElement('strong', { key: `${key}-b${i++}` }, m[1]))\r\n else nodes.push(createElement('code', { key: `${key}-c${i++}`, style: CODE_STYLE }, m[2]))\r\n rest = rest.slice(m.index + m[0].length)\r\n }\r\n return nodes\r\n}\r\n\r\nfunction renderMd(md: string): ReactNode {\r\n const lines = md.split('\\n')\r\n const out: ReactNode[] = []\r\n let idx = 0\r\n for (const line of lines) {\r\n const t = line.trim()\r\n if (!t) continue\r\n const h = /^(#{1,6})\\s+(.+)/.exec(t)\r\n if (h) { out.push(createElement(`h${h[1].length}`, { key: `h${idx}`, style: H_STYLES[h[1].length - 1] }, ...inline(h[2], `h${idx}`))); idx++; continue }\r\n const ul = /^[-*]\\s+(.+)/.exec(t)\r\n if (ul) { out.push(createElement('div', { key: `li${idx}`, style: LI_STYLE }, '• ', ...inline(ul[1], `li${idx}`))); idx++; continue }\r\n const ol = /^\\d+\\.\\s+(.+)/.exec(t)\r\n if (ol) { out.push(createElement('div', { key: `li${idx}`, style: LI_STYLE }, t.slice(0, t.indexOf('.') + 2), ...inline(ol[1], `li${idx}`))); idx++; continue }\r\n out.push(createElement('div', { key: `p${idx}`, style: P_STYLE }, ...inline(t, `p${idx}`))); idx++\r\n }\r\n return createElement(Fragment, null, ...out)\r\n}\r\n\r\n/* ── Main component ── */\r\nexport function MemoryViewer(props: Props): ReactNode {\r\n const { ctx, memoryId } = props\r\n const [record, setRecord] = useState<RecordMeta | undefined>(undefined)\r\n const [error, setError] = useState<string | undefined>(undefined)\r\n\r\n useEffect(() => {\r\n // 空 id 不发请求:`{ids:['']}` 会被服务端拒为“ids 过滤后为空”,\r\n // 把“重启后 tab 先于选择恢复”这个正常空态误报成错误。\r\n if (memoryId.length === 0) return\r\n let cancelled = false\r\n setError(undefined)\r\n fetch('/dsh-memory/rpc/records-meta', {\r\n method: 'POST',\r\n headers: { 'Content-Type': 'application/json' },\r\n body: JSON.stringify({ ids: [memoryId] }),\r\n })\r\n .then(async (r) => {\r\n if (!r.ok) throw new Error(`HTTP ${r.status}`)\r\n return (await r.json()) as RecordsMetaEnvelope\r\n })\r\n .then((env: RecordsMetaEnvelope) => {\r\n if (cancelled) return\r\n const first = env.ok === true ? env.value?.items?.[0] : undefined\r\n if (first !== undefined) { setRecord(first); return }\r\n setError(describeEnvelopeError(env))\r\n })\r\n .catch((e: unknown) => { if (!cancelled) setError(e instanceof Error ? e.message : String(e)) })\r\n return () => { cancelled = true }\r\n }, [memoryId])\r\n\r\n if (memoryId.length === 0) {\r\n return createElement('div', { style: WRAP },\r\n createElement('div', { style: PLACEHOLDER }, '未在本轮启动周期选择查看的记忆'))\r\n }\r\n if (error !== undefined) {\r\n return createElement('div', { style: WRAP },\r\n createElement('div', { style: PLACEHOLDER }, `⚠️ ${error}`))\r\n }\r\n if (record === undefined) {\r\n return createElement('div', { style: WRAP },\r\n createElement('div', { style: PLACEHOLDER }, '加载中…'))\r\n }\r\n\r\n return createElement('div', { style: WRAP },\r\n // Header bar\r\n createElement('div', { style: HEADER },\r\n createElement('div', { style: NAME_STYLE }, record.name ?? record.id),\r\n createElement('div', null,\r\n createElement('span', { style: BADGE }, record.type),\r\n createElement('span', { style: BADGE }, record.scope === 'workspace' ? '工作区' : '全局'),\r\n record.maturity && createElement('span', { style: BADGE }, `成熟:${record.maturity}`),\r\n createElement('span', { style: BADGE }, `P${record.priority}`),\r\n record.retired && createElement('span', { style: { ...BADGE, borderColor: 'var(--dsw-alias-border-color-danger)', color: 'var(--dsw-alias-border-color-danger)' } }, '已退场'),\r\n ),\r\n createElement('div', { style: META_LINE }, `创建: ${record.createdAt ? new Date(record.createdAt).toLocaleString() : '-'}`),\r\n record.scene && createElement('div', { style: META_LINE }, `情境: ${record.scene}`),\r\n createElement('div', { style: META_LINE }, `范围: ${record.scope === 'workspace' && record.workspaceId ? record.workspaceId : '用户默认 (global)'}`),\r\n record.keywords && record.keywords.length > 0 && createElement('div', { style: CHIP_ROW },\r\n createElement('span', { style: LABEL }, '关键词'),\r\n ...record.keywords.map((k, i) => createElement('span', { key: i, style: CHIP }, k))),\r\n record.usageScenario && record.usageScenario.length > 0 && createElement('div', { style: CHIP_ROW },\r\n createElement('span', { style: LABEL }, '使用场景'),\r\n ...record.usageScenario.map((s, i) => createElement('span', { key: i, style: CHIP }, s))),\r\n ),\r\n // Body\r\n renderMd(record.content),\r\n )\r\n}\r\n","/**\r\n * Tab glyph for the task board.\r\n *\r\n * Skin contract: plugin-drawn glyphs take their colour from the `--dsw-alias-*`\r\n * tokens — no colour literals anywhere in this file.\r\n */\r\nimport type { ReactNode } from 'react'\r\n\r\n/**\r\n * A checklist mark: three rows with ticks and text rails — the same status\r\n * vocabulary the board paints.\r\n * @param size - square edge in px (the host passes its own tab-icon size).\r\n */\r\nexport function BriefIcon(size: number): ReactNode {\r\n return (\r\n <svg\r\n width={size}\r\n height={size}\r\n viewBox=\"0 0 16 16\"\r\n fill=\"none\"\r\n aria-hidden=\"true\"\r\n focusable=\"false\"\r\n style={{ display: 'block', flex: 'none' }}\r\n >\r\n <rect\r\n x={1.6}\r\n y={2.4}\r\n width={12.8}\r\n height={11.2}\r\n rx={2}\r\n stroke=\"var(--dsw-alias-label-tertiary)\"\r\n strokeWidth={1.2}\r\n />\r\n <path\r\n d=\"M4.2 6.1l1 1 1.8-2\"\r\n stroke=\"var(--dsw-alias-state-success-primary)\"\r\n strokeWidth={1.3}\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n />\r\n <path\r\n d=\"M4.2 10.6l1 1 1.8-2\"\r\n stroke=\"var(--dsw-alias-label-tertiary)\"\r\n strokeWidth={1.3}\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n />\r\n <path\r\n d=\"M8.4 6.4h4M8.4 10.9h4\"\r\n stroke=\"var(--dsw-alias-label-tertiary)\"\r\n strokeWidth={1.2}\r\n strokeLinecap=\"round\"\r\n />\r\n </svg>\r\n )\r\n}\r\n","/**\r\n * Hiding the official todo dock.\r\n *\r\n * `conversation.input.dock` is a LIST slot, and its cells are keyed by each\r\n * entry's `id`. The slot core keeps one live entry per cell — entries are\r\n * sorted by `priority` ascending (then by `order`) and the first live entry of\r\n * a cell is the one the outlet renders, so a SECOND registration with the same\r\n * `id` at a LOWER priority shadows the first. The official todo entry\r\n * (`conversation-todo-dock` in `dsh-client-ui-conversation`) registers\r\n * `{ id: 'todo', order: 0 }` with the default priority 0, so\r\n * `{ id: 'todo', priority: -1 }` wins the cell and the official panel never\r\n * renders while this plugin is mounted.\r\n *\r\n * This is the same mechanism `dsh-input-traffic` uses on the sibling `queue`\r\n * cell (`{ id: 'queue', priority: -1 }`), so it is a proven seam on this host\r\n * generation, not a guess.\r\n *\r\n * Binding to a built-in id is a real coupling: if upstream renames the cell,\r\n * the shadow silently stops winning and the official dock simply reappears\r\n * (fail-open — the data is still shown, just twice). `slots.inject` is used\r\n * rather than a bare `register` because the slot is declared by a built-in\r\n * entry whose lifetime we do not control: `inject` waits for the declaration\r\n * and re-installs the entry if the declaration is ever recreated.\r\n *\r\n * Renders nothing on purpose: the todo UI now lives in this plugin's sidebar\r\n * tab. Return a summary chip here instead to keep a one-line entry point in the\r\n * composer band.\r\n */\r\nimport type { ReactNode } from 'react'\r\nimport type { Context } from '@deepseek-ai/cordis'\r\n\r\n/** The built-in cell id of the official todo dock. */\r\nexport const TODO_CELL_ID = 'todo'\r\n\r\n/** Lower than the built-in's default 0 — the winner of the `todo` cell. */\r\nexport const TODO_SHADOW_PRIORITY = -1\r\n\r\n/** Structural view of the client slots service (avoids a second type graph). */\r\nexport interface SlotsLike {\r\n inject(key: string, callback: () => (() => void) | undefined): () => void\r\n register(options: Record<string, unknown>, component: (props: unknown) => ReactNode): () => void\r\n}\r\n\r\n/** The replacement entry: deliberately empty. */\r\nfunction TodoDockShadow(): ReactNode {\r\n return null\r\n}\r\n\r\n/**\r\n * Register the shadowing entry.\r\n *\r\n * The caller wraps this in `ctx.effect(...)` so the returned disposer rides the\r\n * plugin fiber: unloading the plugin restores the official dock.\r\n *\r\n * @param ctx - the client root context.\r\n * @returns the disposer, or undefined when the slots service is unreachable.\r\n */\r\nexport function registerTodoDockShadow(ctx: Context): (() => void) | undefined {\r\n const slots = ctx.get('slots') as SlotsLike | undefined\r\n if (slots === undefined || typeof slots.inject !== 'function') return undefined\r\n\r\n return slots.inject('conversation.input.dock', () =>\r\n slots.register(\r\n {\r\n name: 'conversation.input.dock',\r\n id: TODO_CELL_ID,\r\n order: 0,\r\n priority: TODO_SHADOW_PRIORITY,\r\n registrant: 'dsh-brief-sidebar',\r\n },\r\n TodoDockShadow,\r\n ),\r\n )\r\n}\r\n","/**\r\n * BriefSettingsCard — the brief-sidebar settings card.\r\n *\r\n * One component mounted at TWO seats, fed by the SAME inject factory (one\r\n * source of truth, the dsh-thinking-levels arrangement):\r\n *\r\n * - the plugin-family settings section (「起子插件设置」, the `settings.section`\r\n * entry dsh-thinking-levels registers; this plugin contributes its card to\r\n * the `dsh-family.tab` child slot — the inject idles harmlessly when the\r\n * family section is absent);\r\n * - the Plugins-page configuration card (`plugins.bundle.config`, keyed by\r\n * the package name, rendered on the bundle's detail page).\r\n *\r\n * The card binds this plugin's entry config through the `configForms` service\r\n * and renders the fields the summary tab reads. Every change commits\r\n * immediately through the scope (no staged form), so a flip applies to the\r\n * open summary tab on its next render.\r\n *\r\n * The `t` binder is injected by the factory (the same closure the tab uses) —\r\n * the card does not rely on the framework's locale props, so it renders the\r\n * active language on every host generation. Kept dependency-free beyond\r\n * react: inline styles over `--dsw-alias-*` tokens only (no CSS modules, no\r\n * hex/rgba literals — the purity spec enforces the token contract).\r\n */\r\nimport { useCallback, useState, useSyncExternalStore } from 'react'\r\nimport { createElement } from 'react'\r\nimport type { CSSProperties, ChangeEvent, ReactNode } from 'react'\r\nimport type { BriefClientConfig, SettingsScope, SettingsScopeSnapshot } from './scope-face'\r\nimport { resolveShowMemoryRecall, resolveShowMemorySlots } from './scope-face'\r\n\r\n/** A no-op unsubscribe source, kept as one identity so effects never thrash. */\r\nconst NO_SUBSCRIBE = (): (() => void) => () => {}\r\n\r\n/** The snapshot served while no scope is reachable. */\r\nconst ABSENT: SettingsScopeSnapshot<BriefClientConfig> = {\r\n status: 'unavailable',\r\n value: undefined,\r\n revision: undefined,\r\n writable: false,\r\n}\r\n\r\n/** Injected face: the entry scope, plus the plugin's own binder. */\r\nexport interface BriefSettingsCardInjected {\r\n /** `configForms.get('dsh-brief-sidebar')` — may be unavailable on odd hosts. */\r\n scope?: SettingsScope<BriefClientConfig>\r\n /** The plugin's locale binder (applied-time closure over the locale service). */\r\n t: (key: string) => string\r\n}\r\n\r\nexport type BriefSettingsCardProps = BriefSettingsCardInjected\r\n\r\n/* ── shared row styling (inline; keeps the client bundle CSS-free) ──────── */\r\n\r\nconst CARD_STYLE: CSSProperties = {\r\n border: '1px solid var(--dsw-alias-border-l2)',\r\n background: 'var(--dsw-alias-bg-layer-3)',\r\n borderRadius: 12,\r\n transition: 'border-color 0.16s, background 0.16s',\r\n}\r\n\r\nconst HEADER_STYLE: CSSProperties = {\r\n appearance: 'none',\r\n width: '100%',\r\n font: 'inherit',\r\n color: 'inherit',\r\n textAlign: 'left',\r\n cursor: 'pointer',\r\n background: 'none',\r\n border: 0,\r\n borderRadius: 12,\r\n display: 'flex',\r\n alignItems: 'center',\r\n gap: 12,\r\n padding: '14px 16px',\r\n}\r\n\r\nconst HEADER_TEXT_STYLE: CSSProperties = { flex: '1 1 0%', minWidth: 0 }\r\n\r\nconst NAME_STYLE: CSSProperties = {\r\n fontSize: 14,\r\n fontWeight: 600,\r\n color: 'var(--dsw-alias-label-primary)',\r\n}\r\n\r\nconst DESC_STYLE: CSSProperties = {\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n fontSize: 13,\r\n lineHeight: 1.5,\r\n}\r\n\r\nconst CHEVRON_STYLE = (open: boolean): CSSProperties => ({\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n flex: '0 0 auto',\r\n transition: 'transform 0.16s',\r\n transform: open ? 'rotate(180deg)' : 'none',\r\n})\r\n\r\nconst BODY_STYLE: CSSProperties = { padding: '12px 16px' }\r\n\r\nconst ROW_STYLE: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'flex-start',\r\n justifyContent: 'space-between',\r\n gap: 12,\r\n padding: '8px 0',\r\n fontSize: 13,\r\n lineHeight: '20px',\r\n}\r\n\r\nconst ROW_TEXT_STYLE: CSSProperties = {\r\n display: 'flex',\r\n flexDirection: 'column',\r\n gap: 4,\r\n minWidth: 0,\r\n}\r\n\r\nconst LABEL_STYLE: CSSProperties = { margin: 0, color: 'var(--dsw-alias-label-primary)' }\r\n\r\nconst HINT_STYLE: CSSProperties = {\r\n margin: 0,\r\n fontSize: 12,\r\n lineHeight: '18px',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n}\r\n\r\nconst SWITCH_STYLE: CSSProperties = { flexShrink: 0, margin: 0, cursor: 'pointer' }\r\n\r\n/**\r\n * One switch row: label + hint on the left, checkbox on the right. Extracted\r\n * because the card now binds two sections (session recall / pinned slots).\r\n */\r\nfunction FlagRow(props: {\r\n id: string\r\n label: string\r\n hint: string\r\n checked: boolean\r\n disabled: boolean\r\n onToggle(next: boolean): void\r\n}): ReactNode {\r\n return createElement(\r\n 'div',\r\n { style: ROW_STYLE },\r\n createElement(\r\n 'div',\r\n { style: ROW_TEXT_STYLE },\r\n createElement('label', { htmlFor: props.id, style: LABEL_STYLE }, props.label),\r\n createElement('p', { style: HINT_STYLE }, props.hint),\r\n ),\r\n createElement('input', {\r\n id: props.id,\r\n type: 'checkbox',\r\n checked: props.checked,\r\n disabled: props.disabled,\r\n style: SWITCH_STYLE,\r\n onChange: (event: ChangeEvent<HTMLInputElement>) => { props.onToggle(event.currentTarget.checked) },\r\n }),\r\n )\r\n}\r\n\r\n/**\r\n * The settings card body. `scope` is optional on purpose: the inject factory\r\n * always provides it, but a host whose `configForms` face degrades must not\r\n * crash the settings page — the card renders the unavailable note and keeps\r\n * its header.\r\n */\r\nexport function BriefSettingsCard(props: BriefSettingsCardProps): ReactNode {\r\n const { t, scope } = props\r\n const [open, setOpen] = useState(true)\r\n\r\n const snapshot: SettingsScopeSnapshot<BriefClientConfig> | undefined = useSyncExternalStore(\r\n useCallback((listener: () => void) => scope?.subscribe(listener) ?? NO_SUBSCRIBE(), [scope]),\r\n useCallback(() => scope?.getSnapshot() ?? ABSENT, [scope]),\r\n useCallback(() => scope?.getSnapshot() ?? ABSENT, [scope]),\r\n )\r\n const unavailable = scope === undefined || snapshot.status === 'unavailable'\r\n const readonly = unavailable || !snapshot.writable\r\n // Defaults come from the same resolvers the sections use — one source of truth.\r\n const slotsChecked = resolveShowMemorySlots(snapshot)\r\n const recallChecked = resolveShowMemoryRecall(snapshot)\r\n\r\n return createElement(\r\n 'div',\r\n { style: CARD_STYLE, 'data-dsh-brief-sidebar': 'settings-card' },\r\n createElement(\r\n 'button',\r\n { type: 'button', 'aria-expanded': open, style: HEADER_STYLE, onClick: () => { setOpen(current => !current) } },\r\n createElement(\r\n 'span',\r\n { style: HEADER_TEXT_STYLE },\r\n createElement('div', { style: NAME_STYLE }, t('settings.title')),\r\n createElement('div', { style: DESC_STYLE }, t('settings.desc')),\r\n ),\r\n createElement(\r\n 'svg',\r\n { width: 16, height: 16, viewBox: '0 0 16 16', 'aria-hidden': true, style: CHEVRON_STYLE(open) },\r\n createElement('path', {\r\n d: 'M4 6l4 4 4-4',\r\n fill: 'none',\r\n stroke: 'currentColor',\r\n strokeWidth: 1.5,\r\n strokeLinecap: 'round',\r\n strokeLinejoin: 'round',\r\n }),\r\n ),\r\n ),\r\n open && createElement(\r\n 'div',\r\n { style: BODY_STYLE },\r\n unavailable\r\n ? createElement('p', { style: HINT_STYLE }, t('settings.unavailable'))\r\n : createElement(\r\n 'div',\r\n { style: { display: 'flex', flexDirection: 'column', gap: 12 } },\r\n createElement(FlagRow, {\r\n key: 'recall',\r\n id: 'dsh-brief-sidebar-show-memory-recall',\r\n label: t('settings.memoryRecall'),\r\n hint: t('settings.memoryRecallHint'),\r\n checked: recallChecked,\r\n disabled: readonly,\r\n onToggle: (next: boolean) => { void scope?.set('showMemoryRecall', next) },\r\n }),\r\n createElement(FlagRow, {\r\n key: 'slots',\r\n id: 'dsh-brief-sidebar-show-memory-slots',\r\n label: t('settings.memorySlots'),\r\n hint: t('settings.memorySlotsHint'),\r\n checked: slotsChecked,\r\n disabled: readonly,\r\n onToggle: (next: boolean) => { void scope?.set('showMemorySlots', next) },\r\n }),\r\n ),\r\n !unavailable && !snapshot.writable && createElement('p', { style: HINT_STYLE }, t('settings.readonly')),\r\n ),\r\n )\r\n}\r\n","/**\r\n * 家族容器兜底接管(family host backstop)。\r\n *\r\n * 为什么需要:本插件把设置卡挂在 `dsh-family.tab` 上,而那个子席位由**别的插件**\r\n * (thinking-levels / session-guard / session-steward / dsh-mcp-registry)声明。\r\n * 宿主的规则是「注册未声明的槽直接抛」,且声明全局唯一、先到先得——所以只要那几家\r\n * 全部让位或声明失败,本插件的设置面就整轮启动不可见,而且**不报任何错**\r\n * (inject 工厂在槽未声明时压根不跑)。\r\n *\r\n * 本模块把\"看不见\"变成\"自己上位\":延迟到分级时刻检查**自己的 tab 工厂有没有被跑过**\r\n * ——那是插件侧唯一合法的「有人声明了吗」探针(宿主只在声明成立后才执行工厂)。\r\n * 没跑过 → 自己注册一个通用容器,声明子席位,按账本渲染所有贡献卡(含自己的)。\r\n *\r\n * declare-or-withdraw:声明子席位失败(别人已持有)时**绝不**退回不带 children 的\r\n * 裸注册——残废容器会占住导航行、让后来者按「已有 dsh-family」集体退场,\r\n * 这正是 2026-10-14 家族面板丢失的成因。\r\n */\r\nimport { createElement, useEffect, useState } from 'react'\r\nimport type { JSX, ReactNode } from 'react'\r\n\r\n/** 账本条目(id/order/label,label 已解析成字符串)。 */\r\nexport interface FamilyTabEntry {\r\n id: string\r\n order: number\r\n label: string\r\n}\r\n\r\n/** 只用到槽门面的这几件事,避免与 index.tsx 的类型互相拖累。 */\r\nexport interface FamilyHostSlots {\r\n inject: (name: string, factory: () => unknown) => unknown\r\n register: (options: Record<string, unknown>, component: unknown) => unknown\r\n entries: (name: string) => readonly Record<string, unknown>[]\r\n subscribe?: (name: string, fn: () => void) => () => void\r\n}\r\n\r\n/** 家族节固定 id 与子席位 key(与 thinking-levels 的声明严格一致)。 */\r\nconst FAMILY_SECTION_ID = 'dsh-family'\r\nconst FAMILY_CHILD_KEY = 'dsh-family.tab'\r\n\r\n/**\r\n * 接管分级——唯一真源是 `mine-dsh-plugins/_tools/family-rank.mjs`(离线实测 GitHub\r\n * star + npm 周下载量加权)。延迟 = BASE + RANK * STEP;rank 越大越靠后兜底。\r\n */\r\nexport const FAMILY_CLAIM_RANK = 4\r\nconst FAMILY_CLAIM_BASE_MS = 200\r\nconst FAMILY_CLAIM_STEP_MS = 900\r\n/** 派生而非硬编码:改 rank 表就自动改时刻。 */\r\nexport const FAMILY_CLAIM_DELAY_MS = FAMILY_CLAIM_BASE_MS + FAMILY_CLAIM_RANK * FAMILY_CLAIM_STEP_MS\r\n\r\n/** 接管行的遮蔽优先级:必须大于任何正牌 owner(TL 无=0、guard=10),\r\n * 这样 owner 一旦上位就自然遮蔽本兜底行(宿主规则:同 cell 最低者渲染)。 */\r\nconst FAMILY_HOST_PRIORITY = 50\r\n\r\ntype HostObservable<T> = {\r\n getSnapshot(): T\r\n subscribe(listener: () => void): () => void\r\n}\r\n\r\n/** 账本条目上宿主挂的直挂载面(≤0.1.5 壳无 renderSlot 时用)。 */\r\ninterface MountableEntry {\r\n options?: Record<string, unknown>\r\n component?: unknown\r\n inject?: unknown\r\n}\r\n\r\nexport interface FamilyHostSectionProps {\r\n renderSlot?: (key: 'dsh-family.tab', owner?: object, opts?: { only?: string; fallback?: JSX.Element | null }) => JSX.Element | null\r\n useTabs?: <S>(selector: (value: readonly FamilyTabEntry[]) => S) => S\r\n hooks?: { tabs: HostObservable<readonly FamilyTabEntry[]> }\r\n renderContributor?: (id: string) => JSX.Element | null\r\n /** 接管态内联直挂本插件自己的卡:自宣子槽不触发自身 inject(账本恒无己卡),\r\n * 故不能靠 renderSlot/renderContributor 取回。缺省(未传)时行为与旧一致。 */\r\n renderOwn?: () => ReactNode\r\n /** 内联 own 行的账本 id(与账本条目去重用);仅 renderOwn 存在时生效。 */\r\n ownId?: string\r\n}\r\n\r\nconst NO_TABS: readonly FamilyTabEntry[] = []\r\n\r\n/** 通用容器渲染:按 order 依次画出账本里每张贡献卡,不含任何\"本插件特例\"。 */\r\nexport function FamilyHostSection(props: FamilyHostSectionProps): JSX.Element {\r\n const raw = props.hooks?.tabs\r\n const [polled, setPolled] = useState<readonly FamilyTabEntry[]>(() => raw?.getSnapshot() ?? NO_TABS)\r\n useEffect(() => {\r\n if (props.useTabs !== undefined || raw === undefined) return\r\n return raw.subscribe(() => setPolled(raw.getSnapshot()))\r\n })\r\n const tabs = props.useTabs !== undefined ? props.useTabs(value => value) : polled\r\n // 接管时本插件既是容器 owner 又是成员:自己声明的 dsh-family.tab 不会触发\r\n // 自身 inject(账本恒无本卡),故把本卡作为 OWN 行内联直挂、其余成员仍走账本;\r\n // 若本卡已在账本(外部 owner 在场、自身 inject 已触发)则去重不双渲。对齐 thinking-levels OWN_TAB_ID。\r\n const ownId = props.ownId ?? '__own__'\r\n const rows: readonly FamilyTabEntry[] = props.renderOwn\r\n ? [{ id: ownId, order: Number.NEGATIVE_INFINITY, label: ownId }, ...tabs.filter(tab => tab.id !== ownId)]\r\n : tabs\r\n return createElement(\r\n 'div',\r\n { style: { display: 'grid', gap: '12px' } },\r\n rows.map(row =>\r\n createElement(\r\n 'div',\r\n { key: row.id },\r\n props.renderOwn && row.id === ownId\r\n ? props.renderOwn()\r\n : props.renderSlot\r\n ? props.renderSlot(FAMILY_CHILD_KEY, {}, { only: row.id, fallback: null })\r\n : props.renderContributor?.(row.id) ?? null,\r\n ),\r\n ),\r\n )\r\n}\r\n\r\n/** 取条目上的具名面(宿主条目是结构化对象,这里只做安全读取)。 */\r\nfunction face(entry: unknown, key: string): unknown {\r\n if (entry === null || typeof entry !== 'object') return undefined\r\n return (entry as Record<string, unknown>)[key]\r\n}\r\n\r\n/** 条目的 options 收窄(宿主侧是结构化对象,缺失时当空对象读)。 */\r\nfunction optionsOf(entry: unknown): Record<string, unknown> {\r\n const raw = face(entry, 'options')\r\n return raw !== null && typeof raw === 'object' ? raw as Record<string, unknown> : {}\r\n}\r\n\r\n/** 把账本条目投影成标题行:label 可能是函数,抛错退化成 id,绝不带崩整节。 */\r\nexport function projectLedger(slots: FamilyHostSlots): readonly FamilyTabEntry[] {\r\n return slots\r\n .entries(FAMILY_CHILD_KEY)\r\n .map(rawEntry => {\r\n const entry = rawEntry as unknown as MountableEntry\r\n const options = entry.options ?? {}\r\n const id = String(options['id'] ?? '')\r\n const rawLabel = options['label']\r\n let label = id\r\n if (typeof rawLabel === 'function') {\r\n try {\r\n label = String((rawLabel as () => unknown)() ?? id)\r\n } catch {\r\n label = id\r\n }\r\n } else if (typeof rawLabel === 'string') {\r\n label = rawLabel\r\n }\r\n return { id, order: Number(options['order'] ?? 0), label }\r\n })\r\n .sort((a, b) => a.order - b.order)\r\n}\r\n\r\n/**\r\n * 若到点仍无人声明子席位,则自己接管容器。\r\n * @param slots - 客户端槽门面。\r\n * @param isHeld - 探针:本插件的 tab 工厂是否已被执行(= 有人声明了子席位)。\r\n * @param label - 导航标题;家族共享节的标题,不是本插件名。\r\n * @param log - console 前缀(带插件名)。\r\n * @returns 取消定时器与撤销接管注册的 disposer。\r\n */\r\nexport function claimFamilyHostIfOrphaned(\r\n slots: FamilyHostSlots,\r\n isHeld: () => boolean,\r\n label: () => string,\r\n log: string,\r\n ownTab?: { id: string; component: unknown; inject?: () => Record<string, unknown> },\r\n): () => void {\r\n let disposeClaim: (() => void) | undefined\r\n let claimed = false\r\n const timer = setTimeout(() => {\r\n // 有人持有声明(我们的工厂被跑过)或账本已有卡 → 只做成员,不上位。\r\n if (isHeld()) return\r\n const ledger: HostObservable<readonly FamilyTabEntry[]> = {\r\n getSnapshot: () => projectLedger(slots),\r\n subscribe: listener => (slots.subscribe ? slots.subscribe(FAMILY_CHILD_KEY, listener) : () => undefined),\r\n }\r\n /** ≤0.1.5 壳没有 renderSlot:从账本条目现挂组件,失败一律 null。 */\r\n const renderContributor = (id: string): JSX.Element | null => {\r\n try {\r\n const found = slots.entries(FAMILY_CHILD_KEY).find(candidate => String(optionsOf(candidate)['id'] ?? '') === id)\r\n const entry = found as unknown as MountableEntry | undefined\r\n const component = entry ? face(entry, 'component') : undefined\r\n const inject = entry ? face(entry, 'inject') : undefined\r\n if (typeof component !== 'function') return null\r\n const injected = typeof inject === 'function' ? (inject as () => Record<string, unknown>)() : {}\r\n return createElement(component as (props: unknown) => ReactNode, injected ?? {}) as JSX.Element\r\n } catch {\r\n return null\r\n }\r\n }\r\n try {\r\n const dispose = slots.register(\r\n {\r\n name: 'settings.section',\r\n id: FAMILY_SECTION_ID,\r\n order: 40,\r\n priority: FAMILY_HOST_PRIORITY,\r\n label,\r\n inject: () => ({\r\n hooks: { tabs: ledger },\r\n renderContributor,\r\n ownId: ownTab?.id,\r\n renderOwn: ownTab === undefined\r\n ? undefined\r\n : () => createElement(ownTab.component as (p: unknown) => ReactNode, ownTab.inject ? ownTab.inject() : {}),\r\n }),\r\n children: { [FAMILY_CHILD_KEY]: { kind: 'list', scope: 'root' } },\r\n },\r\n FamilyHostSection,\r\n )\r\n if (typeof dispose === 'function') disposeClaim = dispose as () => void\r\n claimed = true\r\n console.warn(`${log} family container unclaimed — took it over (children declared)`)\r\n } catch (error) {\r\n // declare-or-withdraw: someone holds the declaration after all; a childless\r\n // section here would hide every member card instead of saving it.\r\n console.warn(`${log} family claim lost — withdrawing (${error instanceof Error ? error.message : String(error)})`)\r\n }\r\n }, FAMILY_CLAIM_DELAY_MS)\r\n return () => {\r\n clearTimeout(timer)\r\n if (claimed) disposeClaim?.()\r\n }\r\n}\r\n","/**\r\n * Browser half: the task board tab, plus the shadow that hides the official\r\n * composer-band todo panel.\r\n *\r\n * Registration order matters and is deliberate:\r\n *\r\n * 1. **Dictionaries first.** Every later registration can render translated\r\n * copy, and a dictionary that lands after the first paint would show raw\r\n * keys for a frame.\r\n * 2. **Sidebar surface, deferred.** The board needs a sidebar to live in:\r\n * better-sidebar when it is installed (richer: badge + rail icon), else the\r\n * host's own right-sidebar tab system (0.1.5+ `sidebarRightTabs` +\r\n * `sidebar.right.pane.tab`). Both are acquired through the deferred\r\n * `ctx.inject` because neither service is ordered against this apply —\r\n * an immediate `ctx.get` was the 0.1.2 inert bug. With neither — ≤0.1.2\r\n * hosts without better-sidebar — the plugin stays sidebar-inert: the\r\n * official panel keeps rendering and the shadow never installs.\r\n * 3. **Shadow the official dock.** Deliberately BEFORE the tab registration:\r\n * the panel is the only other carrier of the list, so the replacement has to\r\n * exist in the same activation.\r\n * 4. **Register the tab.**\r\n * 5. **Register the settings cards.** The memory-section switch gets TWO\r\n * faces from ONE component + ONE inject factory: a card in the plugin-family\r\n * settings section (「起子插件设置」, hosted by dsh-thinking-levels) and the\r\n * Plugins-page configuration card. `configForms` resolves through a\r\n * deferred inject (the service may start after apply — the same lateness\r\n * the composer model panel in dsh-thinking-levels guards against); on a\r\n * host without it the cards never register and the section gate falls back\r\n * to its default (on).\r\n *\r\n * Every registration rides `ctx.effect(fn, label)` so its disposer is revoked on\r\n * fiber teardown (HMR / disable), which is also what makes the shadow\r\n * reversible: unload the plugin and the official dock renders again. The\r\n * settings cards are the family-proven exception: they ride the deferred\r\n * `configForms` inject whose disposers are not held (same as\r\n * dsh-thinking-levels' composer panel registration).\r\n *\r\n * Contract notes for the two surfaces touched here:\r\n * - better-sidebar tabs are hosted by DSH's native right Sidebar, so the tab\r\n * body receives `TabComponentProps` (`ctx` + `scope` + `visible`) and NOT the\r\n * framework's session-scoped slot props.\r\n * - `conversation.input.dock` is the DSH slot the official todo panel occupies;\r\n * see `brief/dock-shadow.tsx` for why a lower priority wins the cell.\r\n */\r\nimport { createElement } from 'react'\r\nimport type { ReactNode } from 'react'\r\nimport type { Context } from '@deepseek-ai/cordis'\r\nimport type { BetterSidebarService, TabComponentProps } from 'dsh-better-sidebar/client/service'\r\nimport { registerNativeBoardTab } from './native-sidebar'\r\nimport type { NativeTabRegistryLike } from './native-sidebar'\r\nimport { setOpenTab } from './memory-tab'\r\nimport { ECHO_VIEWER_TAB } from './memory-tab'\r\nimport { EchoViewer } from './echo-viewer/echo-viewer'\r\nimport { MemoryViewer } from './memory-viewer/viewer'\r\nimport { SummaryTab } from './SummaryTab'\r\nimport { BriefIcon } from './BriefIcon'\r\nimport { NS, dictionaries } from './locales'\r\nimport { readTodos, unfinishedCount } from './brief/board'\r\nimport { registerTodoDockShadow } from './brief/dock-shadow'\r\nimport type { SlotsLike } from './brief/dock-shadow'\r\nimport { TODOS_KEY } from './brief/use-todos'\r\nimport { projectionSnapshot } from './use-projection'\r\nimport { BriefSettingsCard } from './settings-card'\r\nimport type { BriefSettingsCardProps } from './settings-card'\r\nimport { claimFamilyHostIfOrphaned } from './family-host'\r\nimport type { FamilyHostSlots } from './family-host'\r\nimport type { BriefClientConfig, ConfigFormsLike } from './scope-face'\r\n\r\n/**\r\n * Tab type id. Package-prefixed so it cannot collide with a built-in type.\r\n * Unchanged since the 0.1.0 board tab: the summary tab REPLACES the board tab\r\n * in place, so an opened or pinned tab survives the upgrade.\r\n */\r\nexport const TAB_ID = 'dsh-brief-sidebar:board'\r\n\r\n/**\r\n * Tab kind on the native host-sidebar path (`openTab`/guide dispatch key).\r\n * Only the native registration uses it; better-sidebar keeps addressing the\r\n * tab by {@link TAB_ID}.\r\n */\r\nexport const TAB_KIND = 'brief-board'\r\n\r\n/**\r\n * Position in the host's new-tab guide.\r\n *\r\n * Built-ins on this host generation sit at editor 10 / git 20 / subagent 30 /\r\n * sidechat 35 / terminal 40 / browser 50. 15 places a per-session task board\r\n * right after the editor, which is where a reader looks for session state.\r\n */\r\nexport const TAB_ORDER = 15\r\n\r\n/** Services required before `apply` runs. */\r\n// Generation-neutral list only: betterSidebar/locale ride ctx.get soft-reads in\r\n// apply (both absent on 0.1.0/0.1.1 — declaring them pends the whole client\r\n// entry, web boot refuses to render; playbook §1).\r\n// betterSidebar 经 ctx.get 软读(缺席 inert);locale 全线 rc 皆在(0.1.0-rc.2 起)。\r\n// 第三方插件服务不入顶层 inject——缺席格 entry 永久 pending,web boot 拒渲染整树。\r\nexport const inject = ['slots', 'locale']\r\n\r\n/**\r\n * Structural view of the DSH locale service — only the two members this plugin\r\n * calls. Declared locally on purpose: importing the real type would pull the\r\n * whole client type graph into a browser-only plugin for two signatures.\r\n */\r\ninterface LocaleLike {\r\n register(ns: string, dicts: Record<string, Record<string, string>>): () => void\r\n bind(ns: string): (key: string) => string\r\n}\r\n\r\n/**\r\n * An effect body must return a disposer (cordis rejects `undefined` with a\r\n * `TypeError`), so a path that could not register anything returns this no-op\r\n * instead of nothing.\r\n */\r\nconst NOOP = (): void => {}\r\n\r\n/** Console prefix for the environment probe and registration attribution. */\r\nconst LOG = '[dsh-brief-sidebar]'\r\n\r\n/**\r\n * Run a registration thunk, attributing a thrown failure to the console\r\n * instead of the cordis effect void (a bare throw inside `ctx.effect` leaves\r\n * the field reader with an empty sidebar and no clue which arm died).\r\n */\r\nfunction guarded(label: string, run: () => (() => void) | undefined | void): () => void {\r\n try {\r\n const dispose = run()\r\n return typeof dispose === 'function' ? (dispose as () => void) : NOOP\r\n } catch (error) {\r\n console.error(`${LOG} ${label} failed`, error)\r\n return NOOP\r\n }\r\n}\r\n\r\n/**\r\n * Browser-face apply.\r\n *\r\n * @param ctx - the client root context.\r\n */\r\nexport function apply(ctx: Context): void {\r\n // 1. Plugin-owned dictionaries, in one registration.\r\n const locale: LocaleLike | undefined = ctx.get('locale')\r\n if (locale !== undefined) {\r\n ctx.effect(() => locale.register(NS, dictionaries), 'dsh-brief-sidebar: dictionaries')\r\n }\r\n\r\n /**\r\n * Translate one of our keys. `bind` returns a cached function that reads the\r\n * ACTIVE locale at call time, so a language switch needs no re-apply; an\r\n * unknown namespace or key falls back to the key itself rather than throwing\r\n * inside a render.\r\n */\r\n const t = (key: string): string => {\r\n if (locale === undefined) return key\r\n try {\r\n return locale.bind(NS)(key) || key\r\n } catch {\r\n return key\r\n }\r\n }\r\n\r\n // 2. Sidebar surface, acquired DEFERRED. better-sidebar is a third-party\r\n // plugin with no ordering guarantee against us, and the native tab\r\n // registry is a host service that can publish after this apply too — an\r\n // immediate `ctx.get` misses either one and stays inert forever (the\r\n // 0.1.2 field failure). Both arms ride the deferred optional\r\n // `ctx.inject` (the browser-cdp / configForms precedent). The host\r\n // registry usually wins the race on 0.1.5+ (it publishes before the\r\n // third-party sidebar), so the state is NOT a one-shot latch: when\r\n // better-sidebar arrives after a native seat, it HANDS OVER — the\r\n // native registration is released and the board re-seats on the bar,\r\n // which is the rail and manager the user actually sees (the 0.1.5\r\n // \"invisible tab\" failure was a native seat under a sidebar UI that\r\n // replaced the official rail). On a bare native host (0.1.7 farm cell)\r\n // no handover ever fires.\r\n let surface: 'none' | 'bar' | 'native' = 'none'\r\n let shadowDone = false\r\n let nativeDisposer: (() => void) | undefined\r\n\r\n /** Hide the official composer-band panel (reversible on unload), once. */\r\n const shadowDock = (): void => {\r\n if (shadowDone) return\r\n shadowDone = true\r\n ctx.effect(() => registerTodoDockShadow(ctx) ?? NOOP, 'dsh-brief-sidebar: dock shadow')\r\n }\r\n\r\n const registerOnBar = (bar: BetterSidebarService): void => {\r\n if (surface === 'bar') return\r\n if (surface === 'native') {\r\n const release = nativeDisposer\r\n nativeDisposer = undefined\r\n try {\r\n release?.()\r\n } catch { /* a half-torn-down native seat must not block the handover */ }\r\n console.info(`${LOG} surface=bar (handed over from native)`)\r\n } else {\r\n console.info(`${LOG} surface=bar`)\r\n }\r\n surface = 'bar'\r\n shadowDock()\r\n ctx.effect(\r\n () =>\r\n guarded('registerTab', () =>\r\n bar.registerTab({\r\n id: TAB_ID,\r\n title: () => t('tab.title'),\r\n description: () => t('tab.desc'),\r\n icon: (size: number) => BriefIcon(size),\r\n order: TAB_ORDER,\r\n // Shorthand for `dedupeKey: () => id`: reopening focuses the existing tab.\r\n single: true,\r\n /**\r\n * Unfinished count on the tab strip. Called on every tab-bar render, so\r\n * it reads one snapshot and allocates no subscription; a completed list\r\n * shows no badge at all.\r\n */\r\n badge: (badgeCtx, badgeScope) => {\r\n const todos = readTodos(projectionSnapshot(badgeCtx, badgeScope.sessionId, TODOS_KEY))\r\n if (todos === undefined) return null\r\n const pending = unfinishedCount(todos)\r\n return pending > 0 ? pending : null\r\n },\r\n component: (props: TabComponentProps) =>\r\n createElement(SummaryTab, {\r\n t,\r\n ctx: props.ctx,\r\n scope: props.scope,\r\n visible: props.visible,\r\n }),\r\n }),\r\n ),\r\n 'dsh-brief-sidebar: tab',\r\n )\r\n }\r\n\r\n const registerOnNative = (registry: NativeTabRegistryLike | undefined): void => {\r\n if (surface !== 'none') return\r\n surface = 'native'\r\n console.info(`${LOG} surface=native`)\r\n shadowDock()\r\n ctx.effect(\r\n () => {\r\n nativeDisposer = guarded('native tab', () => registerNativeBoardTab(ctx, registry, { id: TAB_ID, kind: TAB_KIND, order: TAB_ORDER, t }))\r\n return () => {\r\n nativeDisposer = undefined\r\n }\r\n },\r\n 'dsh-brief-sidebar: native tab',\r\n )\r\n }\r\n\r\n /** Register the memory detail viewer tab (hidden, opened via openMemoryTab). */\r\n const registerMemoryTab = (bar: BetterSidebarService): void => {\r\n try {\r\n ;(bar as unknown as { registerTab(desc: Record<string, unknown>): unknown }).registerTab({\r\n id: 'dsh-md-memory-viewer:memory',\r\n title: 'Memory',\r\n description: '查看记忆条目详情',\r\n hidden: true,\r\n order: 200,\r\n dedupeKey: (tab: { path?: string }) => tab.path ? `memory:${tab.path}` : undefined,\r\n component: (props: { ctx: Context; tab?: { path?: string }; scope?: { sessionId?: string } }) => {\r\n const memoryId = props.tab?.path ?? ''\r\n return createElement(MemoryViewer, {\r\n ctx: props.ctx,\r\n memoryId,\r\n scope: props.scope ?? {},\r\n })\r\n },\r\n })\r\n } catch { /* already registered or service busy */ }\r\n }\r\n\r\n /** Register the echo(回响原文)viewer tab (hidden, opened via openEchoTab). */\r\n const registerEchoTab = (bar: BetterSidebarService): void => {\r\n try {\r\n ;(bar as unknown as { registerTab(desc: Record<string, unknown>): unknown }).registerTab({\r\n id: ECHO_VIEWER_TAB,\r\n title: 'Echo',\r\n description: '查看回响条目当时的注入原文',\r\n hidden: true,\r\n order: 201,\r\n dedupeKey: (tab: { path?: string }) => tab.path ? `echo:${tab.path}` : undefined,\r\n component: (props: { ctx: Context; tab?: { path?: string }; scope?: { sessionId?: string } }) =>\r\n createElement(EchoViewer, { tab: props.tab, ctx: props.ctx }),\r\n })\r\n } catch { /* already registered or service busy */ }\r\n }\r\n\r\n // Arm 1: better-sidebar, immediate read first (the common case where the\r\n // sidebar started before us), deferred retry otherwise.\r\n let bar: BetterSidebarService | undefined\r\n try {\r\n bar = ctx.get('betterSidebar')\r\n } catch {\r\n bar = undefined\r\n }\r\n if (bar !== undefined) {\r\n registerOnBar(bar)\r\n setOpenTab((seed) => bar!.openTab(seed))\r\n registerMemoryTab(bar)\r\n registerEchoTab(bar)\r\n } else {\r\n ;(ctx as unknown as {\r\n inject: (deps: string[], cb: (scope: { betterSidebar?: BetterSidebarService }) => void) => void\r\n }).inject(['betterSidebar'], (scope) => {\r\n if (scope.betterSidebar !== undefined) { registerOnBar(scope.betterSidebar); setOpenTab((seed) => scope.betterSidebar!.openTab(seed)); registerMemoryTab(scope.betterSidebar); registerEchoTab(scope.betterSidebar) }\r\n })\r\n }\r\n\r\n // Arm 2: the host's own tab registry (0.1.5+). Never fires on ≤0.1.2. The\r\n // registry is read from the INJECTED scope — a root ctx.get of this\r\n // undeclared service is denied by the strict proxy (the 0.1.7 silent no-op).\r\n ;(ctx as unknown as {\r\n inject: (deps: string[], cb: (scope: { sidebarRightTabs?: NativeTabRegistryLike }) => void) => void\r\n }).inject(['sidebarRightTabs'], (scope) => {\r\n registerOnNative(scope.sidebarRightTabs)\r\n })\r\n\r\n // 5. The settings cards (see the module doc): ONE component + ONE inject\r\n // factory at TWO seats. The entry ids follow the family convention —\r\n // `dsh-family.tab` contributors key by short id (session-guard →\r\n // 'session-guard'), `plugins.bundle.config` keys by package name.\r\n // `configForms` rides a deferred inject: the service lives in the\r\n // settings module, which may start after this apply; the callback simply\r\n // never fires on a host without it (the gate then reads its default).\r\n const slots = ctx.get('slots') as SlotsLike | undefined\r\n // configForms 句柄惰性化:接管在 apply 顶层触发,早于/独立于 configForms 的\r\n // deferred inject;捕获解出的句柄供 ownTab 现取 scope(未解出时 BriefSettingsCard\r\n // 自行降级为 unavailable 提示而非空白)。\r\n let configFormsHandle: ConfigFormsLike | undefined\r\n ;(ctx as unknown as {\r\n inject: (deps: string[], cb: (scope: { configForms?: ConfigFormsLike }) => void) => void\r\n }).inject(['configForms'], (scope) => {\r\n const configForms = scope.configForms\r\n if (slots === undefined || configForms === undefined || typeof configForms.get !== 'function') return\r\n configFormsHandle = configForms\r\n\r\n /** Same face for both seats: the entry scope plus the applied-time binder. */\r\n const injectFactory = (): BriefSettingsCardProps => ({\r\n t,\r\n scope: configForms.get<BriefClientConfig>('dsh-brief-sidebar'),\r\n })\r\n /** The slot core hands the component `unknown` props (registry typing). */\r\n const component = BriefSettingsCard as unknown as (props: unknown) => ReactNode\r\n\r\n slots.inject('dsh-family.tab', () => slots.register(\r\n {\r\n name: 'dsh-family.tab',\r\n id: 'brief-sidebar',\r\n order: 30,\r\n label: () => t('settings.title'),\r\n inject: injectFactory,\r\n },\r\n component,\r\n ))\r\n slots.inject('plugins.bundle.config', () =>\r\n slots.register(\r\n {\r\n name: 'plugins.bundle.config',\r\n key: 'dsh-brief-sidebar',\r\n inject: injectFactory,\r\n },\r\n component,\r\n ),\r\n )\r\n })\r\n\r\n // 家族容器兜底:若到分级时刻仍无人声明 `dsh-family.tab`(owner 全部让位或声明\r\n // 失败),本插件自己上位成通用容器——否则成员卡整轮启动不可见且不报任何错。\r\n // 注册在 apply 顶层而不是 configForms 回调里:没有 configForms 的主机上,\r\n // 容器仍然需要有人接管。\r\n if (slots !== undefined) {\r\n ctx.effect(\r\n () => claimFamilyHostIfOrphaned(\r\n slots as unknown as FamilyHostSlots,\r\n // 判据:有没有一个实际在位的家族容器(id=dsh-family 的 settings.section),\r\n // 而非「我的 inject 有没有触发」——后者在自宣子槽时恒 false(本 bug 成因)。\r\n () => {\r\n try {\r\n return (slots as unknown as FamilyHostSlots).entries('settings.section')\r\n .some(e => String((((e.options ?? {}) as { id?: unknown }).id) ?? '') === 'dsh-family')\r\n } catch { return false }\r\n },\r\n // 家族共享节标题,不是本插件名:接管的是别人的那一节。\r\n () => '起子插件设置',\r\n LOG,\r\n // 接管态内联直挂本卡:own 卡组件 + 惰性 scope(configForms 未解出时卡自行降级为非空白)。\r\n {\r\n id: 'brief-sidebar',\r\n component: BriefSettingsCard as unknown,\r\n inject: () => ({ t, scope: configFormsHandle?.get<BriefClientConfig>('dsh-brief-sidebar') }),\r\n },\r\n ),\r\n 'brief: family host backstop',\r\n )\r\n }\r\n\r\n // One-line environment snapshot: what this apply could see at mount time.\r\n // Cross-reference with the `surface=` line to tell \"arm never fired\" from\r\n // \"arm fired and registration threw\" (guarded logs that part).\r\n try {\r\n let nativeTabsAtApply = false\r\n try {\r\n nativeTabsAtApply = ctx.get('sidebarRightTabs') !== undefined\r\n } catch {\r\n nativeTabsAtApply = false /* strict proxy denies the undeclared read */\r\n }\r\n console.info(`${LOG} env ${JSON.stringify({\r\n locale: locale !== undefined,\r\n barAtApply: bar !== undefined,\r\n nativeTabsAtApply,\r\n })}`)\r\n } catch { /* console may be absent in a stripped host */ }\r\n}\r\n"],"mappings":";;;;;;;;;EAiBA,MAAM,WAAkC;GAAC;GAAW;GAAe;EAAW;;EAG9E,MAAMA,eAAyC;GAC7C,SAAS;GACT,aAAa;GACb,WAAW;EACb;;EAGA,SAAgB,UAAU,QAA4B;GACpD,OAAOA,aAAW;EACpB;;;;;;;;;;;;;;;;EAiBA,SAAgB,UAAU,OAAiD;GACzE,IAAI,UAAU,MAAM,OAAO,CAAC;GAC5B,IAAI,CAAC,MAAM,QAAQ,KAAK,GAAG,OAAO,KAAA;GAElC,MAAM,QAAoB,CAAC;GAC3B,KAAK,MAAM,OAAO,OAAO;IACvB,IAAI,QAAQ,QAAQ,OAAO,QAAQ,UAAU;IAC7C,MAAM,EAAE,SAAS,WAAW;IAC5B,IAAI,OAAO,YAAY,UAAU;IACjC,IAAI,OAAO,WAAW,YAAY,CAAC,SAAS,MAAM,GAAG;IACrD,MAAM,KAAK;KAAE;KAAS;IAAO,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