@huanlin/dsh-plugin-merge-tool-calls 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +77 -0
- package/cordis.patch.yml +11 -0
- package/lib/client.js +1029 -0
- package/lib/client.js.map +1 -0
- package/lib/index.js +816 -0
- package/lib/invariant.js +11 -0
- package/lib/types/client/card-model.d.ts +77 -0
- package/lib/types/client/index.d.ts +29 -0
- package/lib/types/client/locales.d.ts +47 -0
- package/lib/types/client/merge-run.d.ts +46 -0
- package/lib/types/client/rows.d.ts +46 -0
- package/lib/types/client/styles.d.ts +19 -0
- package/lib/types/client/tool-names.d.ts +30 -0
- package/lib/types/index.d.ts +24 -0
- package/lib/types/invariant.d.ts +12 -0
- package/lib/types/types.d.ts +19 -0
- package/package.json +114 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","names":["DEFAULT_MERGE_CONFIG: MergeToolCallsConfig","ALL_TOOL_NAMES: readonly string[]","VARIANT_TITLES: Record<ToolVariant, string>","TOOL_VARIANTS: Record<string, ToolVariant>","TOOL_TITLES: Record<string, string>","parts: string[]","parsed: unknown","SUMMARY_KEYS: Record<ToolVariant, readonly string[]>","FILE_PATH_VARIANTS: ReadonlySet<ToolVariant>","state: RowState","out: DiffHunk[]","diffs","blocks: ToolCallBlock[]","VARIANT_ICONS: Record<ToolVariant, ReactNode>","IconSearchOutline16","IconBrowseOutline16","IconApiOutline14","IconEditOutline16","IconCodeOutline16","IconSparkle16","StateDot","TerminalBlock","DiffBlock","ReadBlock","SearchBlock","WebBlock","RowCard","DisclosureRow","ChildRow","cfg: MergeToolCallsConfig"],"sources":["../src/types.ts","../src/client/locales.ts","../src/client/tool-names.ts","../src/client/card-model.ts","../src/client/merge-run.ts","../src/client/rows.tsx","../src/client/styles.ts","../src/client/index.ts"],"sourcesContent":["/** Shared config surface of the merge-tool-calls plugin (host + client halves). */\n\n/** How consecutive same-tool calls are grouped into one merged card. */\nexport type MergeGroupMode = 'adjacent' | 'step'\n\n/** Plugin configuration; defaults live in the Schemastery schema and cordis.patch.yml. */\nexport interface MergeToolCallsConfig {\n /**\n * Wire tool names whose consecutive calls merge. Empty = every built-in\n * generic-family tool (read/grep/glob/edit/write/bash/pwsh/web_search/\n * web_fetch/run_code/cordis_package_inspect/cordis_runtime_inspect); a\n * non-empty list is an explicit whitelist (any wire name works).\n */\n readonly tools: readonly string[]\n /** `adjacent`: any consecutive run in the chat flow; `step`: only within one agent step. */\n readonly groupBy: MergeGroupMode\n /** Max calls per merged group; the run is truncated and the excess starts a new group. */\n readonly maxGroupSize: number\n}\n\n/** Runtime defaults applied when a half receives no config (defensive only). */\nexport const DEFAULT_MERGE_CONFIG: MergeToolCallsConfig = {\n tools: [],\n groupBy: 'adjacent',\n maxGroupSize: 8,\n}\n","/** Product copy for the merged tool-call rows. */\nexport const zh = {\n running: '进行中',\n failed: '失败',\n stopped: '已中断',\n expand: '展开',\n collapse: '折叠',\n more: '+{n}',\n showLess: '收起其余',\n mergedCount: '已合并 {n} 次调用',\n 'terminal.signal': '信号 {signal}',\n 'terminal.exitCode': '退出码 {code}',\n 'terminal.running': '运行中',\n 'terminal.failed': '失败',\n 'terminal.done': '已完成',\n 'terminal.copy': '复制',\n 'terminal.copied': '已复制',\n 'terminal.noOutput': '无输出',\n 'terminal.collapseAria': '收起输出',\n 'terminal.collapse': '折叠',\n 'terminal.expandAria': '展开其余 {n} 行输出',\n 'terminal.expandRest': '… 其余 {n} 行',\n} satisfies Record<string, string>\n\nexport type MergeToolCallsKey = keyof typeof zh\n\nexport const en = {\n running: 'Running',\n failed: 'Failed',\n stopped: 'Interrupted',\n expand: 'Expand',\n collapse: 'Collapse',\n more: '+{n}',\n showLess: 'Show fewer',\n mergedCount: '{n} calls merged',\n 'terminal.signal': 'signal {signal}',\n 'terminal.exitCode': 'exit code {code}',\n 'terminal.running': 'Running',\n 'terminal.failed': 'Failed',\n 'terminal.done': 'Done',\n 'terminal.copy': 'Copy',\n 'terminal.copied': 'Copied',\n 'terminal.noOutput': 'No output',\n 'terminal.collapseAria': 'Collapse output',\n 'terminal.collapse': 'Collapse',\n 'terminal.expandAria': 'Expand the remaining {n} output lines',\n 'terminal.expandRest': '… {n} more lines',\n} satisfies Record<MergeToolCallsKey, string>\n\nexport const NS = 'merge-tool-calls'\n","/**\n * The built-in tool universe this plugin shadows by default, plus the\n * variant-classification vocabulary mirroring ui-tool's tool-call model.\n *\n * The keyed `tool.call.toolview` slot dispatches on the exact wire tool name,\n * so a shadowed registration is needed per name (there is no wildcard). This\n * list names every shipped tool whose row belongs to the generic ToolRow\n * family — a variant title/icon plus read/search/diff/terminal/web card or\n * IN/OUT text — which the merged row reproduces faithfully.\n *\n * Deliberately excluded: tools with custom row cards this plugin does not\n * replicate (`skill`, `cordis_define`, and the live `cordis_run` /\n * `cordis_stop` / `cordis_undefine` rows), and `todo_write` /\n * `ask_user_question` whose summary formatting is tool-specific. They keep\n * their built-in rows unless the user names them in the `tools` config\n * explicitly.\n * @module\n */\n\n/** Wire tool names merged by default (empty `tools` config = this list). */\nexport const ALL_TOOL_NAMES: readonly string[] = [\n // File tools (read/search/diff cards).\n 'read', 'grep', 'glob', 'edit', 'write',\n // Shell tools (terminal card).\n 'bash', 'pwsh',\n // Web tools (web card).\n 'web_search', 'web_fetch',\n // Code tool (generic IN/OUT with the program body).\n 'run_code',\n // Cordis inspection verbs (generic read-variant rows).\n 'cordis_package_inspect', 'cordis_runtime_inspect',\n]\n\n/** Tool-row visual variant, mirroring ui-tool's ToolRowVariant. */\nexport type ToolVariant = 'search' | 'read' | 'bash' | 'write' | 'edit' | 'code' | 'others'\n\n/** Figma row titles per variant (design literals, not translatable copy). */\nexport const VARIANT_TITLES: Record<ToolVariant, string> = {\n search: 'Search', read: 'Read', bash: 'Bash',\n write: 'Write', edit: 'Edit', code: 'Code', others: 'Tool call',\n}\n\n/**\n * Known tool name -> row variant (mirrors ui-tool's classification table,\n * minus the run-control verbs: their rows are custom and not shadowed).\n */\nconst TOOL_VARIANTS: Record<string, ToolVariant> = {\n bash: 'bash',\n pwsh: 'bash',\n read: 'read',\n web_fetch: 'read',\n web_search: 'search',\n grep: 'search',\n glob: 'search',\n write: 'write',\n edit: 'edit',\n run_code: 'code',\n cordis_package_inspect: 'read',\n cordis_runtime_inspect: 'read',\n}\n\n/** Tool-owned titles refining a generic row variant (mirrors ui-tool). */\nexport const TOOL_TITLES: Record<string, string> = {\n cordis_package_inspect: 'Inspect',\n cordis_runtime_inspect: 'Inspect',\n pwsh: 'Pwsh',\n}\n\n/** Classify a tool name into its row variant (mirrors ui-tool). */\nexport function classifyTool(toolName: string): ToolVariant {\n return TOOL_VARIANTS[toolName] ?? 'others'\n}\n\n/** The variant title a row shows, honoring tool-owned refinements. */\nexport function variantTitle(toolName: string): string {\n return TOOL_TITLES[toolName] ?? VARIANT_TITLES[classifyTool(toolName)]\n}\n","/**\n * Pure card/row derivation from a frozen call slice, mirroring ui-tool's\n * tool-call/read-card/search-card/diff-card/terminal-card/web-card models at\n * the plugin boundary (those models are ui-tool internals and cannot be\n * imported cross-package). Same wire contract, same defensive treatment of\n * untrusted result views. A merged row renders the same surface the built-in\n * row would: a variant title/icon plus a card primitive or IN/OUT text.\n * @module\n */\nimport {\n resolveWorkspacePath,\n type ToolCallBlock, type ToolResultNode,\n} from '@deepseek-ai/dsh-client-runtime/client'\nimport type {\n DiffBlockProps, DiffHunk, ReadBlockProps, SearchBlockProps, SearchFileGroup,\n TerminalBlockProps, WebBlockProps,\n} from '@deepseek-ai/dsh-client-ui-primitives'\nimport { classifyTool, VARIANT_TITLES, TOOL_TITLES, type ToolVariant } from './tool-names.ts'\n\n/** Row state semantic, mirroring ui-tool's ToolRowState. */\nexport type RowState = 'running' | 'ok' | 'error' | 'stopped'\n\nexport type { ToolVariant } from './tool-names.ts'\n\n/** Read-card props the ReadBlock primitive draws (per-render maxLines owned by the caller). */\nexport type ReadCardModel = Pick<ReadBlockProps, 'label' | 'lines' | 'totalLines' | 'lang'>\n\n/**\n * Distributive `Omit`: a plain `Omit<A | B, K>` keeps only the keys common to\n * both members, dropping the discriminated `files`/`paths` fields. Distributing\n * over the naked type parameter preserves each shape.\n */\ntype DistributiveOmit<T, K extends keyof T> = T extends unknown ? Omit<T, K> : never\n\n/** Search-card props plus the capped-result recovery locator (mirrors ui-tool). */\nexport interface SearchCardModel {\n readonly card: DistributiveOmit<SearchBlockProps, 'maxLines' | 'className'>\n /** The result view's replacement title, which outranks the args summary. */\n readonly title: string | undefined\n readonly recovery: string | undefined\n}\n\n/** Diff-card props (mirrors ui-tool; maxLines/className belong to the render site). */\nexport interface DiffCardModel {\n readonly card: Pick<DiffBlockProps, 'diffs'>\n}\n\n/** Terminal-card props (mirrors ui-tool; maxLines/className/labels belong to the render site). */\nexport interface TerminalCardModel {\n readonly card: Pick<TerminalBlockProps, 'command' | 'cwd' | 'output' | 'exitCode' | 'signal' | 'running'>\n /** The call view's model-authored description shown above the card. */\n readonly description: string | undefined\n}\n\n/** True when a settled terminal card reports a failing exit (mirrors ui-tool). */\nexport function terminalFailed(model: TerminalCardModel): boolean {\n const { exitCode, signal, running } = model.card\n return running !== true && ((exitCode !== undefined && exitCode !== 0) || signal !== undefined)\n}\n\n/** Everything a merged row needs, derived once from the frozen slice. */\nexport interface CallRowModel {\n readonly state: RowState\n readonly variant: ToolVariant\n /** Row title: variant title, or the tool-owned title when it refines one. */\n readonly title: string\n /** Args/result-derived one-line summary (path for file tools, query for searches, …). */\n readonly summary: string\n /** Expanded-body input text (pretty args); null = no input section. */\n readonly body: string | null\n /** Flattened result text; null while running or when the result carries no text. */\n readonly output: string | null\n /** First result line on an error row (the collapsed summary's error text). */\n readonly errorSummary: string | null\n /** Openable workspace path from args; absent for non-file tools and errors. */\n readonly filePath: string | undefined\n /** Whether the row has anything to expand (a card, args body, or output). */\n readonly expandable: boolean\n /** Expanded-body content cards, mutually exclusive, or null when absent. */\n readonly terminal: TerminalCardModel | null\n readonly diff: DiffCardModel | null\n readonly read: ReadCardModel | null\n readonly search: SearchCardModel | null\n readonly web: WebBlockProps | null\n}\n\n/**\n * Flatten a settled result's content blocks to display text.\n * @param node - settled result node.\n * @returns joined text (may be empty).\n */\nexport function resultText(node: ToolResultNode): string {\n const parts: string[] = []\n for (const block of node.content) {\n if (block.type === 'text') parts.push(block.text)\n else parts.push(JSON.stringify(block))\n }\n if (parts.length === 0 && node.error !== undefined) parts.push(`${node.error.name}: ${node.error.code}`)\n return parts.join('\\n')\n}\n\nfunction firstLine(text: string): string {\n const nl = text.indexOf('\\n')\n return nl === -1 ? text : text.slice(0, nl)\n}\n\n/** Strip the workspace root from a workspace-rooted absolute path (display only). */\nexport function relativizeToCwd(text: string, cwd: string | undefined): string {\n if (cwd === undefined || cwd === '') return text\n const root = cwd.replace(/[/\\\\]+$/, '')\n if (text.startsWith(`${root}/`) || text.startsWith(`${root}\\\\`)) return text.slice(root.length + 1)\n return text\n}\n\nfunction parseArgs(argsRaw: string): Record<string, unknown> | undefined {\n try {\n const parsed: unknown = JSON.parse(argsRaw)\n return typeof parsed === 'object' && parsed !== null ? parsed as Record<string, unknown> : undefined\n } catch {\n return undefined\n }\n}\n\nfunction pickString(args: Record<string, unknown>, keys: readonly string[]): string | undefined {\n for (const key of keys) {\n const value = args[key]\n if (typeof value === 'string' && value !== '') return value\n }\n return undefined\n}\n\n/** Summary key preference per row variant (args-derived, mirrors ui-tool). */\nconst SUMMARY_KEYS: Record<ToolVariant, readonly string[]> = {\n bash: ['description', 'command'],\n read: ['path', 'file_path', 'url'],\n search: ['query', 'pattern', 'url'],\n write: ['path', 'file_path'],\n edit: ['path', 'file_path'],\n code: ['description'],\n others: [],\n}\n\nfunction deriveSummary(variant: ToolVariant, argsRaw: string): string {\n const parsed = parseArgs(argsRaw)\n if (parsed === undefined) return firstLine(argsRaw)\n const picked = pickString(parsed, SUMMARY_KEYS[variant])\n if (picked !== undefined) return firstLine(picked)\n for (const value of Object.values(parsed)) {\n if (typeof value === 'string' && value !== '') return firstLine(value)\n }\n return firstLine(argsRaw)\n}\n\n/** Path keys only — never `url` (web_fetch lands on the read variant). */\nconst FILE_PATH_KEYS = ['path', 'file_path'] as const\n\n/** File-tool variants whose summary may be an openable workspace path. */\nconst FILE_PATH_VARIANTS: ReadonlySet<ToolVariant> = new Set(['read', 'write', 'edit'])\n\nfunction deriveFilePath(variant: ToolVariant, argsRaw: string): string | undefined {\n if (!FILE_PATH_VARIANTS.has(variant)) return undefined\n const parsed = parseArgs(argsRaw)\n if (parsed === undefined) return undefined\n return pickString(parsed, FILE_PATH_KEYS)?.split('\\n')[0]\n}\n\nfunction deriveBody(variant: ToolVariant, argsRaw: string): string | null {\n if (argsRaw === '') return null\n const parsed = parseArgs(argsRaw)\n if (parsed === undefined) return argsRaw\n // The code row's expanded body IS the program, not the args JSON envelope.\n if (variant === 'code') {\n const code = parsed.code\n if (typeof code === 'string' && code !== '') return code\n }\n return JSON.stringify(parsed, null, 2)\n}\n\n/** Derive the row model for one call of a grouped tool. */\nexport function callRowModel(\n toolName: string,\n block: ToolCallBlock,\n cwd: string | undefined,\n): CallRowModel {\n const done = 'kind' in block\n const argsRaw = (done ? block.call?.argsRaw : block.argsRaw) ?? ''\n const state: RowState = !done ? 'running'\n : block.error?.code === 'interrupted' ? 'stopped'\n : block.isError ? 'error' : 'ok'\n const variant = classifyTool(toolName)\n const terminal = terminalCardOf(block, cwd)\n const read = readCardOf(block, cwd)\n const diff = diffCardOf(block)\n const search = searchCardOf(block)\n const web = webCardOf(block)\n const base = argsRaw === '' ? block.callId : relativizeToCwd(deriveSummary(variant, argsRaw), cwd)\n const toolTitle = TOOL_TITLES[toolName]\n // Others keeps the static \"Tool call\" title; the real tool name rides the\n // summary slot unless the tool owns a specific title (mirrors ui-tool).\n const argsSummary = variant === 'others' && toolName !== '' && toolTitle === undefined\n ? `${toolName} · ${base}`\n : base\n const filePath = deriveFilePath(variant, argsRaw)\n const output = done ? (resultText(block) || null) : null\n const errorSummary = state === 'error' && output !== null ? firstLine(output) : null\n // A card's own summary outranks the args summary: the terminal presenter's\n // description is the contract's above-card text, and a search result view's\n // replacement title names the query the tool itself chose (mirrors ui-tool).\n const summary = terminal?.description ?? search?.title ?? argsSummary\n // Single-file tools never expose an args body — the path link is the only\n // args interaction (mirrors ui-tool's singleFile rule).\n const body = filePath !== undefined ? null : deriveBody(variant, argsRaw)\n // A failing exit status is the terminal card's own error signal: the call\n // settles isError:false, and the red state dot is its only collapsed signal.\n const finalState = state === 'ok' && terminal !== null && terminalFailed(terminal)\n ? 'error'\n : state\n const expandable = terminal !== null || diff !== null || read !== null\n || search !== null || web !== null || body !== null || output !== null\n return {\n state: finalState,\n variant,\n title: toolTitle ?? VARIANT_TITLES[variant],\n summary,\n body,\n output,\n errorSummary,\n filePath,\n expandable,\n terminal,\n diff,\n read,\n search,\n web,\n }\n}\n\n/** Read-card derivation, or null when this call is not a read card (mirrors ui-tool). */\nfunction readCardOf(block: ToolCallBlock, cwd: string | undefined): ReadCardModel | null {\n if (!('kind' in block)) return null\n const result = block.resultView?.card === 'read' ? block.resultView : null\n if (result === null) return null\n if (!Array.isArray(result.lines)) return null\n const lines = result.lines\n .filter(line => typeof line === 'object' && line !== null\n && typeof (line as { number?: unknown }).number === 'number'\n && typeof (line as { text?: unknown }).text === 'string')\n .map(line => ({ number: (line as { number: number }).number, text: (line as { text: string }).text }))\n return {\n label: result.title ?? relativizeToCwd(result.path, cwd),\n lines,\n totalLines: typeof result.totalLines === 'number' ? result.totalLines : lines.length,\n lang: typeof result.lang === 'string' ? result.lang : undefined,\n }\n}\n\nfunction isValidFiles(files: unknown): files is SearchFileGroup[] {\n return Array.isArray(files) && files.every(file =>\n typeof file === 'object' && file !== null\n && typeof (file as { path?: unknown }).path === 'string'\n && Array.isArray((file as { matches?: unknown }).matches)\n && (file as { matches: unknown[] }).matches.every(match =>\n typeof match === 'object' && match !== null\n && typeof (match as { lineNumber?: unknown }).lineNumber === 'number'\n && typeof (match as { line?: unknown }).line === 'string'))\n}\n\nfunction flattenContent(content: readonly { type: string; text?: string }[]): string | undefined {\n const text = content\n .filter((block): block is { type: 'text'; text: string } => block.type === 'text' && typeof block.text === 'string')\n .map(block => block.text)\n .join('\\n')\n return text === '' ? undefined : text\n}\n\n/** Search-card derivation, or null when this call is not a search card (mirrors ui-tool). */\nfunction searchCardOf(block: ToolCallBlock): SearchCardModel | null {\n if (!('kind' in block)) return null\n const result = block.resultView?.card === 'search' ? block.resultView : null\n if (result === null) return null\n const common = { truncated: result.truncated, total: result.total }\n const recovery = result.truncated ? flattenContent(block.content) : undefined\n if (result.shape === 'matches') {\n if (!isValidFiles(result.files)) return null\n return { title: result.title, recovery, card: { kind: 'matches', files: result.files, ...common } }\n }\n if (result.shape !== 'paths') return null\n if (!Array.isArray(result.paths) || !result.paths.every(path => typeof path === 'string')) return null\n return { title: result.title, recovery, card: { kind: 'paths', paths: result.paths, ...common } }\n}\n\n/** Narrow a wire `card:'diff'` view's `diffs` to well-formed hunks (mirrors ui-tool). */\nfunction narrowDiffs(diffs: unknown): DiffHunk[] | null {\n if (!Array.isArray(diffs) || diffs.length === 0) return null\n const out: DiffHunk[] = []\n for (const hunk of diffs) {\n if (typeof hunk !== 'object' || hunk === null) return null\n const { path, oldText, newText } = hunk as Record<string, unknown>\n if (typeof path !== 'string') return null\n if (oldText !== null && typeof oldText !== 'string') return null\n if (typeof newText !== 'string') return null\n out.push({ path, oldText, newText })\n }\n return out\n}\n\n/** Diff-card derivation, or null when this call is not a diff card (mirrors ui-tool). */\nfunction diffCardOf(block: ToolCallBlock): DiffCardModel | null {\n if (!('kind' in block)) {\n const call = block.callView?.card === 'diff' ? block.callView : null\n const diffs = call === null ? null : narrowDiffs(call.diffs)\n return diffs === null ? null : { card: { diffs } }\n }\n const result = block.resultView?.card === 'diff' ? block.resultView : null\n const diffs = result === null ? null : narrowDiffs(result.diffs)\n return diffs === null ? null : { card: { diffs } }\n}\n\n/**\n * Resolve a terminal view's working directory the way the render-intent\n * contract assigns it: an absolute path is used as-is, a relative one joins\n * under the session workspace, and an omitted one IS the session workspace.\n * @param viewCwd - the cwd the terminal call view carries, if any.\n * @param sessionCwd - the session workspace root, if the caller knows it.\n * @returns the working directory for the prompt label, or undefined.\n */\nfunction resolveTerminalCwd(viewCwd: string | undefined, sessionCwd: string | undefined): string | undefined {\n if (viewCwd === undefined || viewCwd === '') return sessionCwd\n if (sessionCwd === undefined || sessionCwd === '') return viewCwd\n return resolveWorkspacePath(sessionCwd, viewCwd)\n}\n\n/** Terminal-card derivation, or null when this call is not a terminal card (mirrors ui-tool). */\nfunction terminalCardOf(block: ToolCallBlock, sessionCwd: string | undefined): TerminalCardModel | null {\n const call = block.callView?.card === 'terminal' ? block.callView : null\n if (!('kind' in block)) {\n return call === null ? null : {\n description: call.description,\n card: {\n command: call.title,\n cwd: resolveTerminalCwd(call.cwd, sessionCwd),\n output: undefined,\n exitCode: undefined,\n signal: undefined,\n running: true,\n },\n }\n }\n const result = block.resultView?.card === 'terminal' ? block.resultView : null\n if (result === null) return null\n return {\n description: call?.description,\n card: {\n command: result.title ?? call?.title ?? '',\n cwd: call === null ? undefined : resolveTerminalCwd(call.cwd, sessionCwd),\n output: result.output,\n exitCode: result.exitCode,\n signal: result.signal,\n running: false,\n },\n }\n}\n\n/** Web-card derivation, or null when this call is not a web card (mirrors ui-tool). */\nfunction webCardOf(block: ToolCallBlock): WebBlockProps | null {\n if (!('kind' in block)) return null\n const result = block.resultView\n if (result?.card !== 'web') return null\n if (result.kind === 'search') {\n return {\n kind: 'search',\n answer: result.answer,\n sources: result.sources.map(source => ({\n url: source.url,\n title: source.title,\n snippet: source.snippet,\n publishedAt: source.publishedAt,\n })),\n truncated: result.truncated,\n }\n }\n if (result.kind === 'fetch') {\n return {\n kind: 'fetch',\n url: result.url,\n statusCode: result.statusCode,\n truncated: result.truncated,\n }\n }\n return null\n}\n","/**\n * Pure detection of a consecutive run of grouped tool calls in the chat flow,\n * and the per-seat merged-group partition over it.\n *\n * A pure function of the chat snapshot (order + node store), so the merged\n * display is deterministic under replay: the web layer recomputes it per frame.\n * @module\n */\nimport type { ChatConversationViewNode, ChatNodeStore, ToolCallBlock } from '@deepseek-ai/dsh-client-runtime/client'\nimport { conversationContextKey } from '@deepseek-ai/dsh-client-runtime/client'\nimport type { MergeGroupMode } from '../types.ts'\nimport { classifyTool } from './tool-names.ts'\n\n/** Tool-call node kind registered by ui-conversation's built-in tool definition. */\nconst TOOL_CALL_KIND = 'tool-call'\n\n/** Extract a root call block from any chat node, when it is a tool-call node. */\nfunction toolRootOf(node: ChatConversationViewNode): ToolCallBlock | null {\n if (node.kind !== TOOL_CALL_KIND) return null\n const root = (node.data as { root?: unknown }).root\n return typeof root === 'object' && root !== null ? root as ToolCallBlock : null\n}\n\n/** The wire tool name of a call in either lifecycle form (mirrors ui-tool). */\nexport function callNameOf(block: ToolCallBlock): string {\n return 'kind' in block ? (block.call?.name ?? '') : block.name\n}\n\n/** Whether the call's wire name is one of the grouped tools (empty = all). */\nexport function isGroupedTool(name: string, tools: readonly string[]): boolean {\n return tools.length === 0 || tools.includes(name)\n}\n\n/** Step identity of a node's location; undefined when the node is not step-bound. */\nfunction stepIdOf(node: ChatConversationViewNode): string | undefined {\n const location = node.location\n return location.kind === 'step' ? `${location.turn.turn}:${location.step.step}` : undefined\n}\n\n/** One merged group: the group's first call plus its consecutive continuations. */\nexport interface ReadRun {\n /** Whether this seat is the group's rendering head (the only seat that shows the card). */\n readonly isFirst: boolean\n /** The group's root blocks in flow order (first + continuations). */\n readonly blocks: readonly ToolCallBlock[]\n}\n\n/**\n * Compute the merged group this call belongs to.\n *\n * 1. Locates this call's node in the chat order; null when it is not a chat\n * tool-call node (e.g. a read dispatched as a subcall).\n * 2. Walks backward/forward to the maximal consecutive run containing it. A\n * call continues the run when it is a grouped tool AND same-tool-same-run:\n * the identical wire name, or a sibling of the same known variant family\n * (grep+glob, bash+pwsh, read+web_fetch…). Unknown names (variant\n * `others`) only merge with themselves, so unrelated tools never share a\n * card (`adjacent`: any consecutive run; `step`: same agent step as this\n * call).\n * 3. Partitions the run into `maxGroupSize`-sized groups; this call is the\n * group's first only when it heads one of those partitions. Truncation\n * therefore never orphans a call: the excess starts its own group.\n *\n * @param order - chat node key order.\n * @param nodes - chat node store.\n * @param myCallId - the call id of the seat asking about itself.\n * @param tools - grouped wire tool names; empty means every tool.\n * @param groupBy - grouping mode.\n * @param maxGroupSize - per-group cap.\n * @returns the group partition, or null when the call is not a chat tool-call node.\n */\nexport function readRun(\n order: readonly string[],\n nodes: ChatNodeStore,\n myCallId: string,\n tools: readonly string[],\n groupBy: MergeGroupMode,\n maxGroupSize: number,\n): ReadRun | null {\n const myKey = conversationContextKey(TOOL_CALL_KIND, myCallId)\n const myIndex = order.indexOf(myKey)\n if (myIndex < 0) return null\n const myRoot = rootAtNode(order, nodes, myIndex)\n if (myRoot === null) return null\n const myName = callNameOf(myRoot)\n const myVariant = classifyTool(myName)\n const size = Math.max(1, maxGroupSize)\n\n const rootAt = (index: number): ToolCallBlock | null => rootAtNode(order, nodes, index)\n const myStep = groupBy === 'step' ? stepIdOfNodeAt(order, nodes, myIndex) : undefined\n const inGroup = (index: number): boolean => {\n const root = rootAt(index)\n if (root === null || !isGroupedTool(callNameOf(root), tools)) return false\n const name = callNameOf(root)\n // Same-name calls always continue the run; known families merge siblings\n // (grep+glob, bash+pwsh); unknown names merge only with themselves.\n if (name !== myName) {\n if (myVariant === 'others' || classifyTool(name) !== myVariant) return false\n }\n if (groupBy !== 'step') return true\n return myStep !== undefined && stepIdOfNodeAt(order, nodes, index) === myStep\n }\n\n let start = myIndex\n while (start > 0 && inGroup(start - 1)) start--\n let end = myIndex\n while (end < order.length - 1 && inGroup(end + 1)) end++\n\n const groupStart = start + Math.floor((myIndex - start) / size) * size\n const groupEnd = Math.min(groupStart + size, end + 1)\n\n const blocks: ToolCallBlock[] = []\n for (let index = groupStart; index < groupEnd; index++) {\n const root = rootAt(index)\n if (root !== null) blocks.push(root)\n }\n return { isFirst: myIndex === groupStart, blocks }\n}\n\nfunction rootAtNode(order: readonly string[], nodes: ChatNodeStore, index: number): ToolCallBlock | null {\n const key = order[index]\n const node = key === undefined ? undefined : nodes.get(key)\n return node === undefined ? null : toolRootOf(node)\n}\n\nfunction stepIdOfNodeAt(order: readonly string[], nodes: ChatNodeStore, index: number): string | undefined {\n const key = order[index]\n const node = key === undefined ? undefined : nodes.get(key)\n return node === undefined ? undefined : stepIdOf(node)\n}\n","/**\n * Merged tool-call row — the shadowed `tool.call.toolview` registrant.\n *\n * For the first call of a consecutive run of grouped tools, renders the run as\n * one card (the first call's full row) plus one compact child row per\n * continuation call. For a continuation call, renders nothing: the seat stays\n * empty and the injected stylesheet collapses it out of the flow. When the\n * call is not a chat tool-call node at all (e.g. dispatched as a subcall),\n * falls back to a plain single row so the call never disappears.\n *\n * The row surface mirrors the built-in generic ToolRow: a variant title/icon\n * plus the settled card (read/search/diff/terminal/web) or IN/OUT text.\n *\n * Everything here is a pure function of the chat snapshot + the frozen call\n * slices (replay-deterministic); expand state is component-local view state.\n * @module\n */\nimport { memo, useLayoutEffect, useRef, useState, type CSSProperties, type KeyboardEvent, type MouseEvent, type ReactNode } from 'react'\nimport {\n DiffBlock, DisclosureRow, IconApiOutline14, IconBrowseOutline16, IconCodeOutline16,\n IconEditOutline16, IconSearchOutline16, IconSparkle16, ReadBlock, SearchBlock, StateDot,\n TerminalBlock, WebBlock, type TerminalBlockLabels,\n} from '@deepseek-ai/dsh-client-ui-primitives'\nimport type { ToolCallBlock } from '@deepseek-ai/dsh-client-runtime/client'\nimport type { ToolCallViewProps } from '@deepseek-ai/dsh-client-ui-tool/client'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { MergeToolCallsConfig } from '../types.ts'\nimport { callRowModel, type CallRowModel, type RowState, type ToolVariant } from './card-model.ts'\nimport { readRun } from './merge-run.ts'\n\n/** Chat rows show a capped card; the details panel stays the full-height surface. */\nconst CHAT_READ_MAX_LINES = 8\nconst CHAT_SEARCH_MAX_LINES = 8\nconst CHAT_DIFF_MAX_LINES = 8\n\n/** Locale seat and inject face of the merged row registration. */\nexport type MergedToolRowProps = ToolCallViewProps\n & PropsLocale<'merge-tool-calls'>\n & { readonly cfg: MergeToolCallsConfig }\n\n/** Variant leading icons (figma table); all glyphs render at 14 inside the 16px leading box. */\nconst VARIANT_ICONS: Record<ToolVariant, ReactNode> = {\n search: <IconSearchOutline16 size={14} />,\n read: <IconBrowseOutline16 size={14} />,\n bash: <IconApiOutline14 size={14} />,\n write: <IconEditOutline16 size={14} />,\n edit: <IconEditOutline16 size={14} />,\n code: <IconCodeOutline16 size={14} />,\n others: <IconSparkle16 size={14} />,\n}\n\n/** Leading-slot state substitution, mirroring the shipped row. */\nfunction leadingFor(state: RowState, icon: ReactNode): ReactNode {\n switch (state) {\n case 'error': return <StateDot state=\"error\" />\n case 'stopped': return <StateDot state=\"warning\" />\n default: return icon\n }\n}\n\n/** Visually hidden run-state label (the StateDot and sweep are colour-only). */\nfunction stateStatus(state: RowState, t: MergedToolRowProps['t']): string | null {\n switch (state) {\n case 'running': return t('running')\n case 'error': return t('failed')\n case 'stopped': return t('stopped')\n default: return null\n }\n}\n\n/** TerminalBlock display copy from the plugin's own dictionary. */\nfunction terminalLabels(t: MergedToolRowProps['t']): TerminalBlockLabels {\n return {\n signal: signal => t('terminal.signal', { signal }),\n exitCode: code => t('terminal.exitCode', { code }),\n running: t('terminal.running'),\n failed: t('terminal.failed'),\n done: t('terminal.done'),\n copy: t('terminal.copy'),\n copied: t('terminal.copied'),\n noOutput: t('terminal.noOutput'),\n collapseAria: t('terminal.collapseAria'),\n collapse: t('terminal.collapse'),\n expandAria: hidden => t('terminal.expandAria', { n: hidden }),\n expand: hidden => t('terminal.expandRest', { n: hidden }),\n }\n}\n\n/** One call's expanded-body card, mirroring the built-in ToolRow body. */\nfunction CardBody({ model, t }: { model: CallRowModel; t: MergedToolRowProps['t'] }) {\n if (model.terminal !== null) {\n return <TerminalBlock {...model.terminal.card} maxLines={Infinity} labels={terminalLabels(t)} />\n }\n if (model.diff !== null) {\n return <DiffBlock {...model.diff.card} maxLines={CHAT_DIFF_MAX_LINES} />\n }\n if (model.read !== null) {\n return <ReadBlock {...model.read} maxLines={CHAT_READ_MAX_LINES} />\n }\n if (model.search !== null) {\n return (\n <>\n <SearchBlock {...model.search.card} maxLines={CHAT_SEARCH_MAX_LINES} />\n {model.search.recovery !== undefined && (\n <div className=\"mtc-recovery\">{model.search.recovery}</div>\n )}\n </>\n )\n }\n if (model.web !== null) {\n return <WebBlock {...model.web} />\n }\n const hasBody = model.body !== null\n const hasOutput = model.output !== null\n if (!hasBody && !hasOutput) return null\n return (\n <div className=\"mtc-io-card\">\n {hasBody && (\n <div className=\"mtc-io-section\">\n <span className=\"mtc-io-label\">IN</span>\n <span className=\"mtc-io-text\">{model.body}</span>\n </div>\n )}\n {hasBody && hasOutput && <span className=\"mtc-io-divider\" aria-hidden />}\n {hasOutput && (\n <div className=\"mtc-io-section\">\n <span className=\"mtc-io-label\">OUT</span>\n <span className=\"mtc-io-text\" data-error={model.state === 'error' || undefined}>{model.output}</span>\n </div>\n )}\n </div>\n )\n}\n\n/** The run's main card: the first call's full row (chrome + expandable card). */\nexport const RowCard = memo(function RowCard({\n toolName, block, cwd, openFile, inspect, t, mergedCount,\n}: {\n toolName: string\n block: ToolCallBlock\n cwd: string | undefined\n openFile: (path: string) => void\n inspect: (() => void) | undefined\n t: MergedToolRowProps['t']\n /** Continuation-call count rendered as a muted `+n` suffix; 0 hides it. */\n mergedCount: number\n}) {\n const model = callRowModel(toolName, block, cwd)\n const [expanded, setExpanded] = useState(false)\n const open = expanded && model.expandable\n const status = stateStatus(model.state, t)\n const failureLine = model.state === 'error' ? model.errorSummary ?? null : null\n const summaryText = failureLine ?? model.summary\n const suffix = failureLine === null && mergedCount > 0\n ? t('more', { n: String(mergedCount) })\n : null\n const fileLink = model.filePath !== undefined && openFile !== undefined && failureLine === null\n const openFileClick = (event: MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation()\n if (model.filePath !== undefined) openFile(model.filePath)\n }\n return (\n <div className=\"mtc-row\" data-state={model.state} data-variant={model.variant}>\n {status !== null && <span className=\"mtc-visually-hidden\">{status}</span>}\n <DisclosureRow\n rowClassName=\"mtc-title-row\"\n titleClassName=\"mtc-title\"\n leadingClassName=\"mtc-leading\"\n chevronClassName=\"mtc-chevron\"\n icon={leadingFor(model.state, VARIANT_ICONS[model.variant])}\n title={model.title}\n open={open}\n expandable={model.expandable}\n expandOnRowClick\n keepContentWhenOpen\n onToggle={() => { setExpanded(value => !value) }}\n collapsedContent={summaryText !== '' && (\n <>\n <span className=\"mtc-sep\" aria-hidden />\n {fileLink ? (\n <button type=\"button\" className=\"mtc-summary-link\" onClick={openFileClick}>{summaryText}</button>\n ) : (\n <span className=\"mtc-summary\">{summaryText}</span>\n )}\n {suffix !== null && <span className=\"mtc-summary-suffix\">{suffix}</span>}\n </>\n )}\n >\n <div className=\"mtc-card-body\">\n <CardBody model={model} t={t} />\n {inspect !== undefined && (\n <button type=\"button\" className=\"mtc-inspect\" onClick={inspect}>Inspect</button>\n )}\n </div>\n </DisclosureRow>\n </div>\n )\n})\n\n/**\n * One compact continuation row: the main row's tail structure ([sep dot][path]).\n * An expandable call toggles the inline content card on click (mirroring the\n * main row's whole-row disclosure); a read/write/edit-family path additionally\n * renders as an open-file link (the sidebar preview) that stops propagation,\n * exactly like the main row's summary link.\n */\nexport const ChildRow = memo(function ChildRow({\n toolName, block, cwd, openFile, t,\n}: {\n toolName: string\n block: ToolCallBlock\n cwd: string | undefined\n openFile: (path: string) => void\n t: MergedToolRowProps['t']\n}) {\n const model = callRowModel(toolName, block, cwd)\n const [open, setOpen] = useState(false)\n const stateLabel = stateStatus(model.state, t)\n const expandable = model.expandable\n const toggle = (): void => { setOpen(value => !value) }\n const openFileClick = (event: MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation()\n if (model.filePath !== undefined) openFile(model.filePath)\n }\n const onRowKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n toggle()\n }\n }\n return (\n <div className=\"mtc-child\">\n <div\n className=\"mtc-child-row\"\n data-open={expandable && open || undefined}\n data-static={expandable ? undefined : true}\n role={expandable ? 'button' : undefined}\n tabIndex={expandable ? 0 : undefined}\n aria-expanded={expandable ? open : undefined}\n onClick={expandable ? toggle : undefined}\n onKeyDown={expandable ? onRowKeyDown : undefined}\n >\n <span className=\"mtc-sep\" aria-hidden />\n {model.filePath !== undefined ? (\n <button type=\"button\" className=\"mtc-child-path-link\" onClick={openFileClick}>{model.summary}</button>\n ) : (\n <span className=\"mtc-child-path\">{model.summary}</span>\n )}\n {stateLabel !== null && (\n <span className=\"mtc-child-state\" data-error={model.state === 'error' || undefined}>{stateLabel}</span>\n )}\n </div>\n {expandable && open && (\n <div className=\"mtc-child-body\">\n <CardBody model={model} t={t} />\n </div>\n )}\n </div>\n )\n})\n\n/**\n * The shadowed toolview: renders the merged run card for the run's first call,\n * nothing for continuation calls, and a plain single row when this call is not\n * a chat tool-call node.\n *\n * Child-row alignment is measured at runtime, not hardcoded: the main row's\n * separator dot sits after a variable-width title (\"Read\"/\"Search\"/\"Bash\"/…),\n * so its column depends on the rendered font. A layout effect measures the\n * dot's offset from the card root (once, plus on reflow via ResizeObserver)\n * and indents the children so their dots and paths land on the main row's\n * columns — no font/title constants to keep in sync.\n */\nexport function MergedToolRow({ callId, toolName, block, cwd, openFile, inspect, t, cfg, useSession }: MergedToolRowProps) {\n const run = useSession(snapshot => readRun(\n snapshot.chat.order,\n snapshot.chat.nodes,\n callId,\n cfg.tools,\n cfg.groupBy,\n cfg.maxGroupSize,\n ))\n const rootRef = useRef<HTMLDivElement>(null)\n /** Main separator dot's left offset from the card root; null before first measure. */\n const [sepLeft, setSepLeft] = useState<number | null>(null)\n\n useLayoutEffect(() => {\n const root = rootRef.current\n if (root === null) return\n const sep = root.querySelector<HTMLElement>('.mtc-row .mtc-sep')\n if (sep === null) return\n const measure = (): void => {\n setSepLeft(Math.round(sep.getBoundingClientRect().left - root.getBoundingClientRect().left))\n }\n measure()\n // Font swaps, locale switches, and column resizes move the dot; keep the\n // alignment current without re-running the effect.\n const observer = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(measure)\n observer?.observe(root)\n return () => { observer?.disconnect() }\n }, [run === null ? null : run.blocks[0]?.callId ?? null])\n\n if (run === null) {\n // Not a chat tool-call node (subcall dispatch): never blank the call.\n return (\n <RowCard\n toolName={toolName}\n block={block}\n cwd={cwd}\n openFile={openFile}\n inspect={inspect}\n t={t}\n mergedCount={0}\n />\n )\n }\n if (!run.isFirst) return null\n const hasChildren = run.blocks.length > 1\n return (\n <div className=\"mtc-root\" data-tool={toolName} ref={rootRef}>\n <RowCard\n toolName={toolName}\n block={run.blocks[0] ?? block}\n cwd={cwd}\n openFile={openFile}\n inspect={inspect}\n t={t}\n mergedCount={run.blocks.length - 1}\n />\n {hasChildren && (\n // The custom property overrides the CSS fallback with the measured dot\n // column: the 2px dot + 8px sep right margin land the path exactly on\n // the main summary column. It is a property rather than an inline\n // margin so the expanded child card can cancel the indent and span the\n // card width (see `.mtc-child-body` in styles.ts).\n <div\n className=\"mtc-children\"\n style={sepLeft === null ? undefined : { ['--mtc-sep-left']: `${sepLeft}px` } as CSSProperties}\n >\n {run.blocks.slice(1).map(child => (\n <ChildRow key={child.callId} toolName={toolName} block={child} cwd={cwd} openFile={openFile} t={t} />\n ))}\n </div>\n )}\n </div>\n )\n}\n","/**\n * One scoped stylesheet injected for the lifetime of the client activation.\n *\n * Two jobs:\n * 1. The empty-seat collapse rule: the shadowed toolview renders `null` for\n * every non-first call of a merged run. The built-in `ToolCallTree` still\n * wraps that null in its `.callRow` div, and the renderer wraps every\n * toolview in an empty `<div data-slot=\"tool.call.toolview\">` (display:\n * contents), so the seat's `.flowItem` is never `:empty` itself and the\n * built-in `.flowItem:empty { display:none }` rule does not fire. This\n * rule extends the same intent (\"a renderer may decline its row\") to a\n * tool seat whose toolview rendered nothing.\n * 2. The plugin's own `.mtc-*` chrome for the merged card and its child rows.\n *\n * All colors come from the shared `--dsw-*` tokens (never literals).\n */\nexport const CSS = `\n/* A tool-call seat whose toolview declined to render (merged-run continuation\n calls) must not consume the flow column's gap. The empty toolview slot\n wrapper is the decline signal; the callRow around it always exists. */\n[data-chat-flow-kind=\"tool-call\"]:has([data-slot=\"tool.call.toolview\"]:empty) { display: none; }\n\n.mtc-root { display: flex; flex-direction: column; min-width: 0; }\n.mtc-row { display: flex; flex-direction: column; min-width: 0; }\n.mtc-row[data-state='running'] .mtc-title-row { position: relative; overflow: hidden; }\n.mtc-row[data-state='running'] .mtc-title-row::after {\n content: '';\n position: absolute;\n top: 0; bottom: 0; left: 0;\n width: 300px;\n background: linear-gradient(90deg, transparent 0%, color-mix(in srgb, var(--dsw-alias-bg-base) 60%, transparent) 55%, transparent 100%);\n animation: dsh-mtc-sweep 2.6s ease-out infinite;\n pointer-events: none;\n}\n@keyframes dsh-mtc-sweep {\n 0% { left: -300px; }\n 90%, 100% { left: 100%; }\n}\n\n.mtc-title { font-weight: 400; }\n.mtc-sep { flex: none; width: 2px; height: 2px; border-radius: 1px; margin: 0 8px; background: var(--dsw-alias-label-caption); }\n.mtc-summary {\n flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;\n font-size: 14px; line-height: 24px; color: var(--dsw-alias-label-tertiary);\n}\n.mtc-summary-link {\n flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;\n margin: 0; padding: 0; border: none; background: none; font: inherit; text-align: left;\n font-size: 14px; line-height: 24px; color: var(--dsw-alias-label-secondary);\n text-decoration: underline; text-decoration-color: var(--dsw-alias-label-quaternary);\n text-underline-offset: 3px; cursor: pointer;\n}\n.mtc-summary-link:hover { color: var(--dsw-alias-label-primary); text-decoration-color: currentColor; }\n.mtc-summary-error { color: var(--dsw-alias-state-error-primary); }\n.mtc-summary-suffix { flex: none; margin-left: 4px; white-space: nowrap; font-size: 14px; line-height: 24px; color: var(--dsw-alias-label-tertiary); }\n\n.mtc-card-body { margin: 4px 0 4px 4px; min-width: 0; }\n.mtc-recovery { margin: 4px 0 4px 4px; white-space: pre-wrap; overflow-wrap: anywhere; font: var(--dsw-font-xs-13); color: var(--dsw-alias-label-tertiary); }\n/* IN/OUT text card for calls without a card primitive (mirrors ToolRow). */\n.mtc-io-card {\n display: flex; flex-direction: column; min-width: 0;\n border: 1px solid var(--dsw-alias-border-l2); border-radius: 12px;\n background: var(--dsw-alias-bg-base);\n}\n.mtc-io-section { display: flex; gap: 10px; padding: 8px 12px; min-width: 0; }\n.mtc-io-label {\n flex: none; font-size: 11px; line-height: 16px; font-weight: 600;\n color: var(--dsw-alias-label-tertiary);\n}\n.mtc-io-text {\n flex: 1 1 auto; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere;\n font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary);\n}\n.mtc-io-text[data-error] { color: var(--dsw-alias-state-error-primary); }\n.mtc-io-divider { height: 1px; background: var(--dsw-alias-border-l2); }\n.mtc-inspect {\n display: inline-flex; align-self: flex-start; align-items: center; gap: 4px;\n margin: 4px 0 2px 4px; padding: 2px 8px;\n border: 1px solid var(--dsw-alias-border-l2); border-radius: 999px;\n background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-secondary);\n font-size: 11px; line-height: 16px; cursor: pointer;\n opacity: 0; transition: opacity 100ms ease;\n}\n.mtc-root:hover .mtc-inspect, .mtc-inspect:focus-visible { opacity: 1; }\n.mtc-inspect:hover { background: var(--dsw-alias-interactive-bg-hover-solid); color: var(--dsw-alias-label-primary); }\n\n/* Compact child rows: each is the main row's tail structure — [sep dot][path].\n The dot/path columns are set at runtime by the component (it measures the\n main row's sep offset and sets the --mtc-sep-left custom property on the\n children block), so this is only the pre-measure fallback. */\n.mtc-children { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 2px var(--mtc-sep-left, 61px); }\n.mtc-child { display: flex; flex-direction: column; min-width: 0; }\n.mtc-child-row {\n display: flex; align-items: center; gap: 0; min-width: 0; height: 20px;\n margin: 0; padding: 0; border: 0; border-radius: 4px; background: none;\n font: inherit; text-align: left; color: var(--dsw-alias-label-secondary); cursor: pointer;\n}\n.mtc-child-row:hover { background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-primary); }\n.mtc-child-row[data-static] { cursor: default; }\n.mtc-child-row[data-static]:hover { background: none; color: var(--dsw-alias-label-secondary); }\n.mtc-child-row .mtc-sep { margin: 0 8px 0 0; }\n.mtc-child-path {\n flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;\n font-size: 14px; line-height: 20px;\n}\n/* Read-family child paths are open-file links (sidebar preview), same affordance\n as the main row's summary link. */\n.mtc-child-path-link {\n flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;\n margin: 0; padding: 0; border: none; background: none; font: inherit; text-align: left;\n font-size: 14px; line-height: 20px; color: var(--dsw-alias-label-secondary);\n text-decoration: underline; text-decoration-color: var(--dsw-alias-label-quaternary);\n text-underline-offset: 3px; cursor: pointer;\n}\n.mtc-child-path-link:hover { color: var(--dsw-alias-label-primary); text-decoration-color: currentColor; }\n.mtc-child-state { flex: none; font-size: 11px; line-height: 16px; color: var(--dsw-alias-label-tertiary); }\n.mtc-child-state[data-error] { color: var(--dsw-alias-state-error-primary); }\n/* The expanded child card must not inherit the children block's sep indent:\n pull its left edge back to the main card body's column (root + 4px) so the\n card spans the card width instead of leaving a blank gutter on its left. */\n.mtc-child-body { margin: 2px 0 2px calc(4px - var(--mtc-sep-left, 61px)); min-width: 0; }\n\n.mtc-visually-hidden {\n position: absolute; width: 1px; height: 1px; overflow: hidden;\n clip: rect(0 0 0 0); white-space: nowrap;\n}\n`\n\n/** Install the stylesheet and return its disposer. */\nexport function installStyles(): () => void {\n const style = document.createElement('style')\n style.setAttribute('data-merge-tool-calls-style', '')\n style.textContent = CSS\n document.head.appendChild(style)\n return () => { style.remove() }\n}\n","/**\n * merge-tool-calls — browser half.\n *\n * Shadows the shipped `tool.call.toolview` entries for every grouped tool at\n * priority -1 (the keyed slot's shadowing rule: lowest priority renders). An\n * empty `tools` config means every built-in generic-family tool\n * (see {@link ALL_TOOL_NAMES}); a non-empty list is an explicit whitelist.\n * The shadowed component merges consecutive calls of one tool in the chat flow\n * into a single card with compact child rows.\n *\n * @module @dsh-external/dsh-merge-tool-calls/client\n */\n\nimport type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client'\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-tool/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-slots'\nimport { DEFAULT_MERGE_CONFIG, type MergeToolCallsConfig } from '../types.ts'\nimport { en, NS, zh, type MergeToolCallsKey } from './locales.ts'\nimport { MergedToolRow } from './rows.tsx'\nimport { installStyles } from './styles.ts'\nimport { ALL_TOOL_NAMES } from './tool-names.ts'\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap {\n /** Copy for the merged tool-call rows. */\n 'merge-tool-calls': MergeToolCallsKey\n }\n}\n\n/** Required services: the slot registry (toolview shadowing) and locale. */\nexport const inject = ['slots', 'locale']\n\n/**\n * Register one shadowed toolview per grouped tool.\n * @param ctx - client root context.\n * @param config - row config; defaults apply when the loader passes none.\n */\nexport function apply(ctx: ClientContext, config: Partial<MergeToolCallsConfig> = {}): void {\n const cfg: MergeToolCallsConfig = { ...DEFAULT_MERGE_CONFIG, ...config }\n ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'merge-tool-calls: dictionaries')\n ctx.effect(installStyles, 'merge-tool-calls: styles')\n\n const toolNames = cfg.tools.length === 0 ? ALL_TOOL_NAMES : [...new Set(cfg.tools)]\n for (const tool of toolNames) {\n ctx.slots.inject('tool.call.toolview', () => ctx.slots.register({\n name: 'tool.call.toolview',\n key: tool,\n priority: -1,\n locale: NS,\n inject: () => ({ cfg }),\n }, MergedToolRow))\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAaA,uBAA6C;CACxD,OAAO,EAAE;CACT,SAAS;CACT,cAAc;CACf;;;;;ACxBD,MAAa,KAAK;CAChB,SAAS;CACT,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,UAAU;CACV,MAAM;CACN,UAAU;CACV,aAAa;CACb,mBAAmB;CACnB,qBAAqB;CACrB,oBAAoB;CACpB,mBAAmB;CACnB,iBAAiB;CACjB,iBAAiB;CACjB,mBAAmB;CACnB,qBAAqB;CACrB,yBAAyB;CACzB,qBAAqB;CACrB,uBAAuB;CACvB,uBAAuB;CACxB;AAID,MAAa,KAAK;CAChB,SAAS;CACT,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,UAAU;CACV,MAAM;CACN,UAAU;CACV,aAAa;CACb,mBAAmB;CACnB,qBAAqB;CACrB,oBAAoB;CACpB,mBAAmB;CACnB,iBAAiB;CACjB,iBAAiB;CACjB,mBAAmB;CACnB,qBAAqB;CACrB,yBAAyB;CACzB,qBAAqB;CACrB,uBAAuB;CACvB,uBAAuB;CACxB;AAED,MAAa,KAAK;;;;;;;;;;;;;;;;;;;;;;;AC7BlB,MAAaC,iBAAoC;CAE/C;CAAQ;CAAQ;CAAQ;CAAQ;CAEhC;CAAQ;CAER;CAAc;CAEd;CAEA;CAA0B;CAC3B;;AAMD,MAAaC,iBAA8C;CACzD,QAAQ;CAAU,MAAM;CAAQ,MAAM;CACtC,OAAO;CAAS,MAAM;CAAQ,MAAM;CAAQ,QAAQ;CACrD;;;;;AAMD,MAAMC,gBAA6C;CACjD,MAAM;CACN,MAAM;CACN,MAAM;CACN,WAAW;CACX,YAAY;CACZ,MAAM;CACN,MAAM;CACN,OAAO;CACP,MAAM;CACN,UAAU;CACV,wBAAwB;CACxB,wBAAwB;CACz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