dsh-edge 0.18.0 → 0.19.0-alpha.2

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.
Files changed (118) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +8 -8
  3. package/README.zh.md +8 -8
  4. package/THIRD_PARTY_NOTICES.md +2011 -449
  5. package/dist/assets/fonts/Montserrat-OFL.txt +93 -0
  6. package/dist/assets/fonts/montserrat-light-Cvd2VjE_.woff2 +0 -0
  7. package/dist/assets/fonts/montserrat-medium-B4OyO9CN.woff2 +0 -0
  8. package/dist/assets/fonts/montserrat-regular-DYep38cA.woff2 +0 -0
  9. package/dist/assets/index-Cq6ljTv2.css +1 -0
  10. package/dist/assets/index-Dy0OhsZ5.js +127 -0
  11. package/dist/assets/langs/asciidoc-Ve4PFQV2.js +2 -0
  12. package/dist/assets/langs/bat-BkioyH1T.js +2 -0
  13. package/dist/assets/langs/bibtex-CHM0blh-.js +2 -0
  14. package/dist/assets/langs/clojure-P80f7IUj.js +2 -0
  15. package/dist/assets/langs/cmake-D1j8_8rp.js +2 -0
  16. package/dist/assets/langs/csv-fuZLfV_i.js +2 -0
  17. package/dist/assets/langs/dart-bE4Kk8sk.js +2 -0
  18. package/dist/assets/langs/diff-D97Zzqfu.js +2 -0
  19. package/dist/assets/langs/dotenv-Da5cRb03.js +2 -0
  20. package/dist/assets/langs/elixir-CvYZzuDY.js +2 -0
  21. package/dist/assets/langs/erlang-DsQrWhSR.js +2 -0
  22. package/dist/assets/langs/fish-BvzEVeQv.js +2 -0
  23. package/dist/assets/langs/fsharp-CXgrBDvD.js +2 -0
  24. package/dist/assets/langs/graphql-DujV8YkJ.js +2 -0
  25. package/dist/assets/langs/groovy-gcz8RCvz.js +2 -0
  26. package/dist/assets/langs/haskell-Df6bDoY_.js +2 -0
  27. package/dist/assets/langs/hcl-BWvSN4gD.js +2 -0
  28. package/dist/assets/langs/html-derivative-DOyKdj44.js +2 -0
  29. package/dist/assets/langs/html-fwsONPVS.js +2 -0
  30. package/dist/assets/langs/http-DcV90OkR.js +2 -0
  31. package/dist/assets/langs/javascript-DI5JR1nB.js +2 -0
  32. package/dist/assets/langs/julia-BpJ6DjL_.js +2 -0
  33. package/dist/assets/langs/latex-B4C7GdlO.js +2 -0
  34. package/dist/assets/langs/log-2UxHyX5q.js +2 -0
  35. package/dist/assets/langs/make-CHLpvVh8.js +2 -0
  36. package/dist/assets/langs/nix-CwoSXNpI.js +2 -0
  37. package/dist/assets/langs/perl-DsWkoyyU.js +2 -0
  38. package/dist/assets/langs/php-LEPfNACG.js +2 -0
  39. package/dist/assets/langs/powershell-Dpen1YoG.js +2 -0
  40. package/dist/assets/langs/proto-C7zT0LnQ.js +2 -0
  41. package/dist/assets/langs/r-Dspwwk_N.js +2 -0
  42. package/dist/assets/langs/rst-BbocfKWr.js +2 -0
  43. package/dist/assets/langs/ruby-R292Iif0.js +2 -0
  44. package/dist/assets/langs/scala-C151Ov-r.js +2 -0
  45. package/dist/assets/langs/svelte-DNMY6jOf.js +2 -0
  46. package/dist/assets/langs/system-verilog-CnnmHF94.js +2 -0
  47. package/dist/assets/langs/vb-D17OF-Vu.js +2 -0
  48. package/dist/assets/langs/verilog-BQ8w6xss.js +2 -0
  49. package/dist/assets/langs/vue-Dq2x6432.js +2 -0
  50. package/dist/favicon-dark.svg +3 -0
  51. package/dist/favicon.svg +0 -5
  52. package/dist/index.html +5 -4
  53. package/dist/manifest.webmanifest +3 -4
  54. package/dist/plugins/@deepseek-ai/dsh-api-gateway/client.js +353 -101
  55. package/dist/plugins/@deepseek-ai/dsh-api-job-controller/client.js +367 -0
  56. package/dist/plugins/@deepseek-ai/dsh-api-remotes/client.js +7223 -3584
  57. package/dist/plugins/@deepseek-ai/dsh-api-session-controller/client.js +1107 -991
  58. package/dist/plugins/@deepseek-ai/dsh-api-workspace-controller/client.js +119 -6
  59. package/dist/plugins/@deepseek-ai/dsh-api-workspace-files/client.js +41 -35
  60. package/dist/plugins/@deepseek-ai/dsh-client-connection/client.js +354 -5279
  61. package/dist/plugins/@deepseek-ai/dsh-client-file-upload/client.js +10 -23
  62. package/dist/plugins/@deepseek-ai/dsh-client-locale/client.js +234 -80
  63. package/dist/plugins/@deepseek-ai/dsh-client-modules/client.js +554 -46
  64. package/dist/plugins/@deepseek-ai/dsh-client-shortcuts/client.js +2006 -0
  65. package/dist/plugins/@deepseek-ai/dsh-client-ui-agent-preset/client.js +1090 -914
  66. package/dist/plugins/@deepseek-ai/dsh-client-ui-approval/client.js +79 -6
  67. package/dist/plugins/@deepseek-ai/dsh-client-ui-attachment/client.js +126 -155
  68. package/dist/plugins/@deepseek-ai/dsh-client-ui-chat/client.js +5776 -1593
  69. package/dist/plugins/@deepseek-ai/dsh-client-ui-commands/client.js +375 -121
  70. package/dist/plugins/@deepseek-ai/dsh-client-ui-conversation/client.js +3524 -1923
  71. package/dist/plugins/@deepseek-ai/dsh-client-ui-deliverables/client.js +1615 -258
  72. package/dist/plugins/@deepseek-ai/dsh-client-ui-directory-picker-browse/client.js +9 -9
  73. package/dist/plugins/@deepseek-ai/dsh-client-ui-goal/client.js +25 -10
  74. package/dist/plugins/@deepseek-ai/dsh-client-ui-input-trigger/client.js +169 -24
  75. package/dist/plugins/@deepseek-ai/dsh-client-ui-jobs/client.js +413 -63
  76. package/dist/plugins/@deepseek-ai/dsh-client-ui-layout/client.js +131 -14
  77. package/dist/plugins/@deepseek-ai/dsh-client-ui-message-feedback/client.js +24 -22
  78. package/dist/plugins/@deepseek-ai/dsh-client-ui-model-selection/client.js +281 -128
  79. package/dist/plugins/@deepseek-ai/dsh-client-ui-open-in-app/client.js +674 -223
  80. package/dist/plugins/@deepseek-ai/dsh-client-ui-plan/client.js +596 -18
  81. package/dist/plugins/@deepseek-ai/dsh-client-ui-reference/client.js +92 -9
  82. package/dist/plugins/@deepseek-ai/dsh-client-ui-renderer/client.js +467 -59
  83. package/dist/plugins/@deepseek-ai/dsh-client-ui-session/client.js +231 -72
  84. package/dist/plugins/@deepseek-ai/dsh-client-ui-settings/client.js +281 -117
  85. package/dist/plugins/@deepseek-ai/dsh-client-ui-settings-general/client.js +642 -122
  86. package/dist/plugins/@deepseek-ai/dsh-client-ui-settings-models/client.js +1565 -438
  87. package/dist/plugins/@deepseek-ai/dsh-client-ui-settings-plugin-inventory/client.js +201 -75
  88. package/dist/plugins/@deepseek-ai/dsh-client-ui-settings-plugins/client.js +30 -1628
  89. package/dist/plugins/@deepseek-ai/dsh-client-ui-shortcuts/client.js +1163 -0
  90. package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar/client.js +165 -39
  91. package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar-browser/client.js +1648 -0
  92. package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/client.js +5515 -25622
  93. package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar-files/client.js +419 -118
  94. package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar-right/client.js +5692 -260
  95. package/dist/plugins/@deepseek-ai/dsh-client-ui-skill/client.js +156 -41
  96. package/dist/plugins/@deepseek-ai/dsh-client-ui-subagent/client.js +386 -263
  97. package/dist/plugins/@deepseek-ai/dsh-client-ui-theme/client.js +183 -73
  98. package/dist/plugins/@deepseek-ai/dsh-client-ui-tool/client.js +2367 -429
  99. package/dist/plugins/@deepseek-ai/dsh-client-ui-trajectory/client.js +788 -270
  100. package/dist/plugins/@deepseek-ai/dsh-client-ui-user-questions/client.js +87 -79
  101. package/dist/plugins/@deepseek-ai/dsh-client-ui-workflow-run/client.js +28 -14
  102. package/dist/plugins/@deepseek-ai/dsh-client-ui-workspace/client.js +2647 -1044
  103. package/dist/plugins/@deepseek-ai/dsh-typert-registry/client.js +22 -7
  104. package/dist/plugins/dsh-edge-client-ui/client.js +1 -10
  105. package/package.json +96 -86
  106. package/scripts/cli.mjs +16 -4
  107. package/scripts/install.d.mts +12 -2
  108. package/scripts/install.mjs +36 -9
  109. package/scripts/legal-files.mjs +15 -0
  110. package/worker/direct/index.js +2564 -1822
  111. package/worker/isolated/index.js +2144 -1402
  112. package/dist/assets/index-BKQ_L1z6.js +0 -117
  113. package/dist/assets/index-DPX2bQLO.css +0 -1
  114. package/dist/assets/langs/html-CfGypltT.js +0 -2
  115. package/dist/assets/langs/php-DJl5gRdb.js +0 -2
  116. package/dist/assets/langs/ruby-5eNB0pDK.js +0 -2
  117. package/dist/plugins/@deepseek-ai/dsh-client-ui-permission-presets/client.js +0 -505
  118. package/dist/plugins/@deepseek-ai/dsh-client-ui-schedule/client.js +0 -307
@@ -60,14 +60,249 @@ window.__ModuleLoader__.load({
60
60
  return text;
61
61
  }
62
62
  //#endregion
63
+ //#region lib/types/client/tool/models/tool-call-model.js
64
+ /** Locale key per generic row variant. */
65
+ const VARIANT_TITLE_KEYS = {
66
+ search: "tool.title.search",
67
+ read: "tool.title.read",
68
+ bash: "tool.title.bash",
69
+ write: "tool.title.write",
70
+ edit: "tool.title.edit",
71
+ code: "tool.title.code",
72
+ others: "tool.title.generic"
73
+ };
74
+ /**
75
+ * Known tool name -> variant.
76
+ *
77
+ * `cordis_define` is deliberately absent: ui-cordis registers a keyed
78
+ * `tool.call.toolview` entry for it, and a keyed hit REPLACES the generic row
79
+ * (this table is only reached through GenericToolCard, the dispatch fallback in
80
+ * ToolCallTree). An entry here would be unreachable, and a second title for the
81
+ * same call would be a second answer to a question the card already owns.
82
+ */
83
+ const TOOL_VARIANTS = {
84
+ bash: "bash",
85
+ pwsh: "bash",
86
+ read: "read",
87
+ read_image: "read",
88
+ web_fetch: "read",
89
+ web_search: "search",
90
+ grep: "search",
91
+ glob: "search",
92
+ write: "write",
93
+ edit: "edit",
94
+ run_code: "code",
95
+ cordis_package_inspect: "read",
96
+ cordis_runtime_inspect: "read",
97
+ cordis_run: "others",
98
+ cordis_stop: "others",
99
+ cordis_undefine: "others"
100
+ };
101
+ /** Tool-owned titles that refine a generic row variant without replacing it. */
102
+ const TOOL_TITLE_KEYS = {
103
+ cordis_package_inspect: "tool.title.inspect",
104
+ cordis_runtime_inspect: "tool.title.inspect",
105
+ cordis_run: "tool.title.runCordis",
106
+ cordis_stop: "tool.title.stopCordis",
107
+ cordis_undefine: "tool.title.removeCordis",
108
+ pwsh: "tool.title.pwsh",
109
+ read_image: "tool.title.readImage",
110
+ todo_write: "todo.rowTitle",
111
+ ask_user_question: "ask.rowTitle",
112
+ create_goal: "tool.title.createGoal",
113
+ get_goal: "tool.title.getGoal",
114
+ update_goal: "tool.title.updateGoal",
115
+ schedule_create: "tool.title.createSchedule",
116
+ schedule_list: "tool.title.listSchedules",
117
+ schedule_delete: "tool.title.deleteSchedule",
118
+ schedule_update: "tool.title.updateSchedule",
119
+ cordis_inspect_list: "tool.title.inspectProviders",
120
+ cordis_inspect_query: "tool.title.queryRuntime",
121
+ cordis_inspect_self: "tool.title.inspectPlugins",
122
+ workflow: "tool.title.workflow",
123
+ ralph: "tool.title.ralph",
124
+ session_event_read: "tool.title.readEvent",
125
+ session_event_search: "tool.title.searchEvents",
126
+ session_event_trace: "tool.title.traceEvent",
127
+ session_search: "tool.title.searchSessions",
128
+ session_trace: "tool.title.traceSession",
129
+ list_subagent_models: "tool.title.listModels",
130
+ subagent: "tool.title.subagent",
131
+ list_agents: "tool.title.listAgents",
132
+ send_message: "tool.title.sendMessage",
133
+ interrupt_agent: "tool.title.interruptAgent",
134
+ job_list: "tool.title.listJobs",
135
+ job_output: "tool.title.readJob",
136
+ job_kill: "tool.title.killJob",
137
+ terminal_open: "tool.title.openTerminal",
138
+ terminal_read: "tool.title.readTerminal",
139
+ terminal_list: "tool.title.listTerminals",
140
+ terminal_signal: "tool.title.signalTerminal",
141
+ terminal_close: "tool.title.closeTerminal",
142
+ lsp: "tool.title.lsp",
143
+ spawn_teammate: "tool.title.spawnTeammate",
144
+ team_task_create: "tool.title.createTeamTask",
145
+ team_task_get: "tool.title.getTeamTask",
146
+ team_task_update: "tool.title.updateTeamTask",
147
+ team_task_list: "tool.title.listTeamTasks",
148
+ wait_agent: "tool.title.waitAgent"
149
+ };
150
+ /**
151
+ * Classify a tool name into its row variant.
152
+ * @param toolName - wire tool name.
153
+ * @returns matching variant, others when unknown.
154
+ */
155
+ function classifyTool(toolName) {
156
+ return TOOL_VARIANTS[toolName] ?? "others";
157
+ }
158
+ /**
159
+ * Select a tool-owned or generic title without reading arguments.
160
+ * @param toolName - wire tool name.
161
+ * @returns the localized title key.
162
+ */
163
+ function toolTitleKey(toolName) {
164
+ return TOOL_TITLE_KEYS[toolName] ?? VARIANT_TITLE_KEYS[classifyTool(toolName)];
165
+ }
166
+ function deriveAutoReviewDenial(block) {
167
+ if (!("kind" in block) || !block.isError) return null;
168
+ const error = block.error;
169
+ if (error?.name !== "AutoReviewDeniedError" || error.code !== "AUTO_REVIEW_DENIED") return null;
170
+ return { reason: typeof error.reason === "string" ? error.reason : null };
171
+ }
172
+ /**
173
+ * Flatten a settled result's content blocks to display text: text blocks
174
+ * verbatim, other block shapes as pretty JSON. Empty content on a failed call
175
+ * falls back to the structured error's `name: code` line.
176
+ * @param node - the settled result node.
177
+ * @returns the flattened result text (may be empty).
178
+ */
179
+ function resultText(node) {
180
+ const parts = [];
181
+ for (const block of node.content) if (block.type === "text") parts.push(block.text);
182
+ else parts.push(JSON.stringify(block, null, 2));
183
+ if (parts.length === 0 && node.error !== void 0) parts.push(`${node.error.name}: ${node.error.code}`);
184
+ return parts.join("\n");
185
+ }
186
+ function parseArgs(argsRaw) {
187
+ try {
188
+ return JSON.parse(argsRaw);
189
+ } catch {
190
+ return;
191
+ }
192
+ }
193
+ function firstLine(text) {
194
+ const nl = text.indexOf("\n");
195
+ return nl === -1 ? text : text.slice(0, nl);
196
+ }
197
+ function pickString(args, keys) {
198
+ for (const key of keys) {
199
+ const v = args[key];
200
+ if (typeof v === "string" && v !== "") return v;
201
+ }
202
+ }
203
+ /** Summary key preference per variant (args-derived; result-derived summaries are a ledger item). */
204
+ const SUMMARY_KEYS = {
205
+ bash: ["description", "command"],
206
+ read: [
207
+ "path",
208
+ "file_path",
209
+ "url"
210
+ ],
211
+ search: [
212
+ "query",
213
+ "pattern",
214
+ "url"
215
+ ],
216
+ write: ["path", "file_path"],
217
+ edit: ["path", "file_path"],
218
+ code: ["description"],
219
+ others: []
220
+ };
221
+ function deriveSummary(variant, argsRaw) {
222
+ const parsed = parseArgs(argsRaw);
223
+ if (typeof parsed !== "object" || parsed === null) return firstLine(argsRaw);
224
+ const args = parsed;
225
+ if (variant === "search" && Array.isArray(args.queries)) {
226
+ const queries = args.queries.filter((query) => typeof query === "string" && query !== "");
227
+ if (queries.length > 0) return queries.map(firstLine).join(", ");
228
+ }
229
+ const picked = pickString(args, SUMMARY_KEYS[variant]);
230
+ if (picked !== void 0) return firstLine(picked);
231
+ for (const v of Object.values(args)) if (typeof v === "string" && v !== "") return firstLine(v);
232
+ return firstLine(argsRaw);
233
+ }
234
+ /** Path keys only — never `url` (web_fetch lands on the read variant). */
235
+ const FILE_PATH_KEYS = ["path", "file_path"];
236
+ /** File-tool variants whose summary may be an openable workspace path. */
237
+ const FILE_PATH_VARIANTS = new Set([
238
+ "read",
239
+ "write",
240
+ "edit"
241
+ ]);
242
+ function deriveFilePath(variant, argsRaw) {
243
+ if (!FILE_PATH_VARIANTS.has(variant)) return void 0;
244
+ const parsed = parseArgs(argsRaw);
245
+ if (typeof parsed !== "object" || parsed === null) return void 0;
246
+ const picked = pickString(parsed, FILE_PATH_KEYS);
247
+ return picked === void 0 ? void 0 : firstLine(picked);
248
+ }
249
+ /**
250
+ * Format one argument payload when its generic input body becomes visible.
251
+ * @param variant - row presentation selected for the Tool name.
252
+ * @param argsRaw - original argument JSON or incomplete raw text.
253
+ * @returns display body, or null for empty input.
254
+ */
255
+ function formatToolBody(variant, argsRaw) {
256
+ if (argsRaw === "") return null;
257
+ const parsed = parseArgs(argsRaw);
258
+ if (parsed === void 0) return argsRaw;
259
+ if (variant === "code" && typeof parsed === "object" && parsed !== null) {
260
+ const code = parsed.code;
261
+ if (typeof code === "string" && code !== "") return code;
262
+ }
263
+ return JSON.stringify(parsed, null, 2);
264
+ }
265
+ /**
266
+ * Derive the full row model from a frozen call slice.
267
+ * @param toolName - wire tool name (dispatch-supplied; survives windowless results).
268
+ * @param block - preparing call, dispatched call, or result from the snapshot.
269
+ * @param cwd - session workspace root; workspace-rooted path summaries display relative to it.
270
+ * @param home - host account home; a leftover POSIX home path displays as `~`.
271
+ * @returns the row model.
272
+ */
273
+ function toolRowModel(toolName, block, cwd, home) {
274
+ const variant = classifyTool(toolName);
275
+ const titleKey = toolTitleKey(toolName);
276
+ const done = "kind" in block;
277
+ const argsRaw = done ? block.call?.argsRaw ?? "" : block.phase === "start" ? block.argsRaw : null;
278
+ const state = !done ? block.phase === "preparing" ? "preparing" : "running" : block.error?.code === "interrupted" ? "stopped" : block.isError ? "error" : "ok";
279
+ const base = argsRaw === null ? "" : argsRaw === "" ? block.callId : abbreviateHomePath(relativizeToCwd(deriveSummary(variant, argsRaw), cwd), home);
280
+ const summary = [titleKey === "tool.title.generic" ? toolName : "", base].filter(Boolean).join(" · ");
281
+ const output = done ? resultText(block) || null : null;
282
+ const errorSummary = state === "error" && output !== null ? firstLine(output) : null;
283
+ const bodyRaw = argsRaw === "" ? null : argsRaw;
284
+ return {
285
+ variant,
286
+ titleKey,
287
+ summary,
288
+ filePath: argsRaw === null ? void 0 : deriveFilePath(variant, argsRaw),
289
+ bodyRaw,
290
+ output,
291
+ errorSummary,
292
+ autoReviewDenial: deriveAutoReviewDenial(block),
293
+ state
294
+ };
295
+ }
296
+ //#endregion
63
297
  //#region lib/types/client/tool/models/raw-tool-call.js
64
298
  const parsedCalls = /* @__PURE__ */ new WeakMap();
65
299
  /**
66
300
  * Parse the call head paired with one immutable Tool block.
67
- * @param block - running or settled Tool block.
68
- * @returns the Tool name and object arguments, or null when the call head or valid JSON object is unavailable.
301
+ * @param block - preparing, dispatched, or settled Tool block.
302
+ * @returns the Tool name and object arguments, or null during preparation or when valid arguments are unavailable.
69
303
  */
70
304
  function parsedToolCall(block) {
305
+ if (!("kind" in block) && block.phase === "preparing") return null;
71
306
  const cached = parsedCalls.get(block);
72
307
  if (cached !== void 0 || parsedCalls.has(block)) return cached ?? null;
73
308
  const call = "kind" in block ? block.call : block;
@@ -436,6 +671,11 @@ window.__ModuleLoader__.load({
436
671
  const COUNT_OFFSET = EXACT_OMISSION.indexOf("0");
437
672
  const COUNT_SUFFIX = EXACT_OMISSION.slice(COUNT_OFFSET + 1);
438
673
  function isOmission(text) {
674
+ const imageNotice = / Omitted ([1-9][0-9]*) images\.$/.exec(text);
675
+ if (imageNotice !== null) {
676
+ if (!Number.isSafeInteger(Number(imageNotice[1]))) return false;
677
+ text = text.slice(0, imageNotice.index);
678
+ }
439
679
  if (text === describeOmitted({ kind: "none" }, "bytes") || text === describeOmitted({ kind: "unknown" }, "bytes")) return true;
440
680
  const count = Number(text.slice(COUNT_OFFSET, text.length - COUNT_SUFFIX.length));
441
681
  return Number.isSafeInteger(count) && count >= 0 && text === describeOmitted({
@@ -445,7 +685,7 @@ window.__ModuleLoader__.load({
445
685
  }
446
686
  /**
447
687
  * Recognize a final spill-policy notice in persisted text, including notice-only output.
448
- * This identifies the text convention, not authenticated provenance of tool output.
688
+ * This identifies the text convention, not authenticated tool-output origin.
449
689
  * @param text - complete recorded text result.
450
690
  * @returns whether a complete notice occupies the end of the result.
451
691
  */
@@ -475,6 +715,7 @@ window.__ModuleLoader__.load({
475
715
  return {
476
716
  signal: (signal) => t("terminal.signal", { signal }),
477
717
  exitCode: (code) => t("terminal.exitCode", { code }),
718
+ noExitCode: t("terminal.noExitCode"),
478
719
  running: t("terminal.running"),
479
720
  failed: t("terminal.failed"),
480
721
  done: t("terminal.done"),
@@ -677,7 +918,7 @@ window.__ModuleLoader__.load({
677
918
  }
678
919
  /**
679
920
  * Derive terminal props for supported shell and terminal-send calls, including
680
- * nested Code Dispatch calls. Standard shell results parse their final status
921
+ * nested PTC dispatch calls. Standard shell results parse their final status
681
922
  * marker; persistent shell results, spill previews, background calls, errors,
682
923
  * and malformed input use the generic path. {@link isSettledPersistentShellCall} lets that generic
683
924
  * persistent result remain expandable without inventing one process status.
@@ -790,184 +1031,45 @@ window.__ModuleLoader__.load({
790
1031
  truncated: meta.truncated
791
1032
  };
792
1033
  }
793
- //#endregion
794
- //#region lib/types/client/tool/models/tool-call-model.js
795
- /** Locale key per generic row variant. */
796
- const VARIANT_TITLE_KEYS = {
797
- search: "tool.title.search",
798
- read: "tool.title.read",
799
- bash: "tool.title.bash",
800
- write: "tool.title.write",
801
- edit: "tool.title.edit",
802
- code: "tool.title.code",
803
- others: "tool.title.generic"
804
- };
805
- /**
806
- * Known tool name -> variant.
807
- *
808
- * `cordis_define` is deliberately absent: ui-cordis registers a keyed
809
- * `tool.call.toolview` entry for it, and a keyed hit REPLACES the generic row
810
- * (this table is only reached through GenericToolCard, the dispatch fallback in
811
- * ToolCallTree). An entry here would be unreachable, and a second title for the
812
- * same call would be a second answer to a question the card already owns.
813
- */
814
- const TOOL_VARIANTS = {
815
- bash: "bash",
816
- pwsh: "bash",
817
- read: "read",
818
- read_image: "read",
819
- web_fetch: "read",
820
- web_search: "search",
821
- grep: "search",
822
- glob: "search",
823
- write: "write",
824
- edit: "edit",
825
- run_code: "code",
826
- cordis_package_inspect: "read",
827
- cordis_runtime_inspect: "read",
828
- cordis_run: "others",
829
- cordis_stop: "others",
830
- cordis_undefine: "others"
831
- };
832
- /** Tool-owned titles that refine a generic row variant without replacing it. */
833
- const TOOL_TITLE_KEYS = {
834
- cordis_package_inspect: "tool.title.inspect",
835
- cordis_runtime_inspect: "tool.title.inspect",
836
- cordis_run: "tool.title.runCordis",
837
- cordis_stop: "tool.title.stopCordis",
838
- cordis_undefine: "tool.title.removeCordis",
839
- pwsh: "tool.title.pwsh",
840
- read_image: "tool.title.readImage"
841
- };
842
- /**
843
- * Classify a tool name into its row variant.
844
- * @param toolName - wire tool name.
845
- * @returns matching variant, others when unknown.
846
- */
847
- function classifyTool(toolName) {
848
- return TOOL_VARIANTS[toolName] ?? "others";
849
- }
850
1034
  /**
851
- * Flatten a settled result's content blocks to display text: text blocks
852
- * verbatim, other block shapes as pretty JSON. Empty content on a failed call
853
- * falls back to the structured error's `name: code` line.
854
- * @param node - the settled result node.
855
- * @returns the flattened result text (may be empty).
1035
+ * Read the openable URL of a web_fetch call from its arguments.
1036
+ * @param block - running or settled Tool block.
1037
+ * @returns the http(s) URL, or undefined for another tool, protocol, or unparsable argument.
856
1038
  */
857
- function resultText(node) {
858
- const parts = [];
859
- for (const block of node.content) if (block.type === "text") parts.push(block.text);
860
- else parts.push(JSON.stringify(block, null, 2));
861
- if (parts.length === 0 && node.error !== void 0) parts.push(`${node.error.name}: ${node.error.code}`);
862
- return parts.join("\n");
863
- }
864
- function parseArgs(argsRaw) {
1039
+ function webFetchHref(block) {
1040
+ const call = parsedToolCall(block);
1041
+ if (call?.name !== "web_fetch" || typeof call.args.url !== "string") return void 0;
1042
+ const { url } = call.args;
865
1043
  try {
866
- return JSON.parse(argsRaw);
1044
+ const { protocol } = new URL(url);
1045
+ return protocol === "http:" || protocol === "https:" ? url : void 0;
867
1046
  } catch {
868
1047
  return;
869
1048
  }
870
1049
  }
871
- function firstLine(text) {
872
- const nl = text.indexOf("\n");
873
- return nl === -1 ? text : text.slice(0, nl);
874
- }
875
- function pickString(args, keys) {
876
- for (const key of keys) {
877
- const v = args[key];
878
- if (typeof v === "string" && v !== "") return v;
879
- }
880
- }
881
- /** Summary key preference per variant (args-derived; result-derived summaries are a ledger item). */
882
- const SUMMARY_KEYS = {
883
- bash: ["description", "command"],
884
- read: [
885
- "path",
886
- "file_path",
887
- "url"
888
- ],
889
- search: [
890
- "query",
891
- "pattern",
892
- "url"
893
- ],
894
- write: ["path", "file_path"],
895
- edit: ["path", "file_path"],
896
- code: ["description"],
897
- others: []
898
- };
899
- function deriveSummary(variant, argsRaw) {
900
- const parsed = parseArgs(argsRaw);
901
- if (typeof parsed !== "object" || parsed === null) return firstLine(argsRaw);
902
- const args = parsed;
903
- if (variant === "search" && Array.isArray(args.queries)) {
904
- const queries = args.queries.filter((query) => typeof query === "string" && query !== "");
905
- if (queries.length > 0) return queries.map(firstLine).join(", ");
906
- }
907
- const picked = pickString(args, SUMMARY_KEYS[variant]);
908
- if (picked !== void 0) return firstLine(picked);
909
- for (const v of Object.values(args)) if (typeof v === "string" && v !== "") return firstLine(v);
910
- return firstLine(argsRaw);
911
- }
912
- /** Path keys only — never `url` (web_fetch lands on the read variant). */
913
- const FILE_PATH_KEYS = ["path", "file_path"];
914
- /** File-tool variants whose summary may be an openable workspace path. */
915
- const FILE_PATH_VARIANTS = new Set([
916
- "read",
917
- "write",
918
- "edit"
919
- ]);
920
- function deriveFilePath(variant, argsRaw) {
921
- if (!FILE_PATH_VARIANTS.has(variant)) return void 0;
922
- const parsed = parseArgs(argsRaw);
923
- if (typeof parsed !== "object" || parsed === null) return void 0;
924
- const picked = pickString(parsed, FILE_PATH_KEYS);
925
- return picked === void 0 ? void 0 : firstLine(picked);
926
- }
927
- /**
928
- * Format one argument payload when its generic input body becomes visible.
929
- * @param variant - row presentation selected for the Tool name.
930
- * @param argsRaw - original argument JSON or incomplete raw text.
931
- * @returns display body, or null for empty input.
932
- */
933
- function formatToolBody(variant, argsRaw) {
934
- if (argsRaw === "") return null;
935
- const parsed = parseArgs(argsRaw);
936
- if (parsed === void 0) return argsRaw;
937
- if (variant === "code" && typeof parsed === "object" && parsed !== null) {
938
- const code = parsed.code;
939
- if (typeof code === "string" && code !== "") return code;
940
- }
941
- return JSON.stringify(parsed, null, 2);
1050
+ //#endregion
1051
+ //#region lib/types/client/tool/models/auto-review-denial.js
1052
+ /**
1053
+ * Normalize only the user-visible copy; the durable error keeps the raw reason.
1054
+ * @param reason - raw persisted reviewer reason, or null when none was recorded.
1055
+ * @returns one display line, or null when the reason has no displayable text.
1056
+ */
1057
+ function normalizeAutoReviewReason(reason) {
1058
+ if (reason === null) return null;
1059
+ const normalized = reason.trim().replace(/[\r\n\u2028\u2029]+/gu, " ");
1060
+ return normalized === "" ? null : normalized;
942
1061
  }
943
1062
  /**
944
- * Derive the full row model from a frozen call slice.
945
- * @param toolName - wire tool name (dispatch-supplied; survives windowless results).
946
- * @param block - RunningToolCall or ToolResultNode off the snapshot caches.
947
- * @param cwd - session workspace root; workspace-rooted path summaries display relative to it.
948
- * @param home - host account home; a leftover POSIX home path displays as `~`.
949
- * @returns the row model.
1063
+ * Resolve the collapsed identity and the single expanded OUT line.
1064
+ * @param denial - locale-neutral persisted denial facts.
1065
+ * @param t - conversation-namespace translator.
1066
+ * @returns localized summary and output text for the Tool row.
950
1067
  */
951
- function toolRowModel(toolName, block, cwd, home) {
952
- const variant = classifyTool(toolName);
953
- const done = "kind" in block;
954
- const argsRaw = (done ? block.call?.argsRaw : block.argsRaw) ?? "";
955
- const state = !done ? "running" : block.error?.code === "interrupted" ? "stopped" : block.isError ? "error" : "ok";
956
- const base = argsRaw === "" ? block.callId : abbreviateHomePath(relativizeToCwd(deriveSummary(variant, argsRaw), cwd), home);
957
- const toolTitleKey = TOOL_TITLE_KEYS[toolName];
958
- const summary = variant === "others" && toolName !== "" && toolTitleKey === void 0 ? `${toolName} · ${base}` : base;
959
- const output = done ? resultText(block) || null : null;
960
- const errorSummary = state === "error" && output !== null ? firstLine(output) : null;
961
- const bodyRaw = argsRaw === "" ? null : argsRaw;
1068
+ function localizeAutoReviewDenial(denial, t) {
1069
+ const reason = normalizeAutoReviewReason(denial.reason) ?? t("tool.autoReviewReasonFallback");
962
1070
  return {
963
- variant,
964
- titleKey: toolTitleKey ?? VARIANT_TITLE_KEYS[variant],
965
- summary,
966
- filePath: deriveFilePath(variant, argsRaw),
967
- bodyRaw,
968
- output,
969
- errorSummary,
970
- state
1071
+ summary: t("tool.autoReviewRejected"),
1072
+ output: t("tool.autoReviewNotExecuted", { reason })
971
1073
  };
972
1074
  }
973
1075
  //#endregion
@@ -989,6 +1091,18 @@ window.__ModuleLoader__.load({
989
1091
  //#region lib/types/client/tool/models/primitive-labels.js
990
1092
  /** Localized copy adapters for Cordis-free UI primitives used by Tool cards. */
991
1093
  /**
1094
+ * Localize the shared code-card toolbar.
1095
+ * @param t - Conversation locale seat.
1096
+ * @returns Language fallback and wrapping actions.
1097
+ */
1098
+ function codeToolbarLabels(t) {
1099
+ return {
1100
+ codeLabel: t("codeBlock.title"),
1101
+ wrapLabel: t("codeBlock.wrap"),
1102
+ unwrapLabel: t("codeBlock.unwrap")
1103
+ };
1104
+ }
1105
+ /**
992
1106
  * Build localized Markdown chrome labels.
993
1107
  * @param t - Conversation locale seat.
994
1108
  * @returns Markdown chrome labels.
@@ -997,7 +1111,8 @@ window.__ModuleLoader__.load({
997
1111
  return {
998
1112
  code: {
999
1113
  copyLabel: t("copy"),
1000
- copiedLabel: t("copied")
1114
+ copiedLabel: t("copied"),
1115
+ toolbarLabels: codeToolbarLabels(t)
1001
1116
  },
1002
1117
  footnotes: t("markdown.footnotes")
1003
1118
  };
@@ -1009,13 +1124,13 @@ window.__ModuleLoader__.load({
1009
1124
  */
1010
1125
  function diffBlockLabels(t) {
1011
1126
  return {
1127
+ ...codeToolbarLabels(t),
1012
1128
  copy: t("copy"),
1013
1129
  copied: t("copied"),
1014
1130
  collapseAria: t("diff.collapseAria"),
1015
1131
  expandAria: (count) => t("diff.expandAria", { count }),
1016
1132
  collapse: t("collapse"),
1017
- expand: (count) => t("diff.expandRest", { count }),
1018
- files: (count) => t(count === 1 ? "diff.files.one" : "diff.files.other", { count })
1133
+ expand: (count) => t("diff.expandRest", { count })
1019
1134
  };
1020
1135
  }
1021
1136
  /**
@@ -1025,6 +1140,7 @@ window.__ModuleLoader__.load({
1025
1140
  */
1026
1141
  function readBlockLabels(t) {
1027
1142
  return {
1143
+ ...codeToolbarLabels(t),
1028
1144
  window: (shown, total) => t("read.window", {
1029
1145
  shown,
1030
1146
  total
@@ -1078,13 +1194,13 @@ window.__ModuleLoader__.load({
1078
1194
  }
1079
1195
  //#endregion
1080
1196
  //#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-tool/src/client/tool/components/AskQuestionCard.module.css.mjs
1081
- const css$3 = ".fsXYAq_card{border:.5px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-base);border-radius:12px;flex-direction:column;gap:16px;max-height:360px;margin:4px 0 4px 4px;padding:16px 20px;display:flex;overflow-y:auto}.fsXYAq_item{flex-direction:column;gap:2px;min-width:0;display:flex}.fsXYAq_question,.fsXYAq_answer{white-space:pre-wrap;overflow-wrap:anywhere;font-size:var(--dsh-content-font-size,14px);line-height:calc(24px + var(--dsh-content-font-delta,0px));margin:0}.fsXYAq_question{color:var(--dsw-alias-label-tertiary)}.fsXYAq_answer{color:var(--dsw-alias-label-primary)}.fsXYAq_answerLine{display:block}.fsXYAq_skipped{color:var(--dsw-alias-label-tertiary)}.fsXYAq_verdict{color:var(--dsw-alias-label-primary);font-size:var(--dsh-content-font-size,14px);line-height:calc(24px + var(--dsh-content-font-delta,0px));margin:0}.fsXYAq_questionList{flex-direction:column;gap:8px;margin:0;padding-left:20px;display:flex}.fsXYAq_unansweredQuestion{color:var(--dsw-alias-label-tertiary);white-space:pre-wrap;overflow-wrap:anywhere;font-size:var(--dsh-content-font-size,14px);line-height:calc(24px + var(--dsh-content-font-delta,0px))}";
1082
- const tagId$3 = "@deepseek-ai/dsh-client-ui-tool/AskQuestionCard.module.css";
1083
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$3) + "]") === null) {
1197
+ const css$4 = ".fsXYAq_card{border:.5px solid var(--dsw-alias-border-l1);border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-bg-base);flex-direction:column;gap:16px;max-height:360px;margin:4px 0 4px 4px;padding:16px 20px;display:flex;overflow-y:auto}.fsXYAq_item{flex-direction:column;gap:2px;min-width:0;display:flex}.fsXYAq_question,.fsXYAq_answer{white-space:pre-wrap;overflow-wrap:anywhere;font-size:var(--dsh-content-font-size,14px);line-height:calc(24px + var(--dsh-content-font-delta,0px));margin:0}.fsXYAq_question{color:var(--dsw-alias-label-tertiary)}.fsXYAq_answer{color:var(--dsw-alias-label-primary)}.fsXYAq_answerLine{display:block}.fsXYAq_skipped{color:var(--dsw-alias-label-tertiary)}.fsXYAq_verdict{color:var(--dsw-alias-label-primary);font-size:var(--dsh-content-font-size,14px);line-height:calc(24px + var(--dsh-content-font-delta,0px));margin:0}.fsXYAq_questionList{flex-direction:column;gap:8px;margin:0;padding-left:20px;display:flex}.fsXYAq_unansweredQuestion{color:var(--dsw-alias-label-tertiary);white-space:pre-wrap;overflow-wrap:anywhere;font-size:var(--dsh-content-font-size,14px);line-height:calc(24px + var(--dsh-content-font-delta,0px))}";
1198
+ const tagId$4 = "@deepseek-ai/dsh-client-ui-tool/AskQuestionCard.module.css";
1199
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$4) + "]") === null) {
1084
1200
  const tag = document.createElement("style");
1085
1201
  tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-tool";
1086
- tag.dataset.pluginCss = tagId$3;
1087
- tag.textContent = css$3;
1202
+ tag.dataset.pluginCss = tagId$4;
1203
+ tag.textContent = css$4;
1088
1204
  document.head.appendChild(tag);
1089
1205
  }
1090
1206
  var AskQuestionCard_module_css_default = {
@@ -1140,8 +1256,182 @@ window.__ModuleLoader__.load({
1140
1256
  });
1141
1257
  }
1142
1258
  //#endregion
1259
+ //#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-tool/src/client/tool/components/ToolDetails.module.css.mjs
1260
+ const css$3 = ".DXqwVW_root{border:.5px solid var(--dsw-alias-border-l1);border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-markdown-code-block);color:var(--dsw-alias-label-secondary);font:var(--dsw-font-xs-13);margin:4px 0 4px 4px;overflow:hidden}.DXqwVW_list{max-height:320px;margin:0;padding:0;list-style:none;overflow-y:auto}.DXqwVW_item,.DXqwVW_empty{margin:0;padding:10px 14px}.DXqwVW_item+.DXqwVW_item{border-top:.5px solid var(--dsw-alias-border-l2)}.DXqwVW_root[data-inspect]:not([data-caption])>.DXqwVW_list>.DXqwVW_item,.DXqwVW_root[data-inspect]:not([data-caption]) .DXqwVW_empty,.DXqwVW_root[data-inspect] .DXqwVW_caption{padding-inline-end:88px}.DXqwVW_caption{color:var(--dsw-alias-label-caption);padding:10px 14px 6px;font-size:12px}.DXqwVW_heading{flex-wrap:wrap;align-items:baseline;gap:8px;display:flex}.DXqwVW_text{white-space:pre-wrap;overflow-wrap:anywhere;flex:1;min-width:0}.DXqwVW_status{flex:none;justify-content:center;align-self:flex-start;align-items:center;width:14px;height:18px;font-size:16px;line-height:18px;display:inline-flex}.DXqwVW_pending{box-sizing:border-box;border:1px solid var(--dsw-alias-label-tertiary);border-radius:2px;width:10px;height:10px}.DXqwVW_heading:has(.DXqwVW_statusText) .DXqwVW_text{flex-basis:12em}.DXqwVW_statusText{color:var(--dsw-alias-label-caption);white-space:nowrap;margin-inline-start:auto;font-size:12px}.DXqwVW_previous,.DXqwVW_unchanged{color:var(--dsw-alias-label-tertiary)}.DXqwVW_item[data-change=added] .DXqwVW_status{color:var(--dsw-alias-state-success-primary)}.DXqwVW_item[data-change=removed] .DXqwVW_status{color:var(--dsw-alias-state-error-primary)}.DXqwVW_item[data-change=removed] .DXqwVW_text{color:var(--dsw-alias-label-tertiary);text-decoration:line-through}.DXqwVW_unchanged{border-top:.5px solid var(--dsw-alias-border-l2)}.DXqwVW_unchanged summary{cursor:pointer;align-items:center;gap:6px;padding:9px 14px;list-style:none;display:flex}.DXqwVW_unchanged summary::-webkit-details-marker{display:none}.DXqwVW_unchanged[open] summary svg{transform:rotate(90deg)}.DXqwVW_fields{margin:0}.DXqwVW_heading+.DXqwVW_fields{margin-top:6px}.DXqwVW_field{grid-template-columns:5.5em minmax(0,1fr);gap:12px;display:grid}.DXqwVW_field+.DXqwVW_field{margin-top:4px}.DXqwVW_field dt{color:var(--dsw-alias-label-caption)}.DXqwVW_field dd{white-space:pre-wrap;overflow-wrap:anywhere;margin:0}.DXqwVW_badge{color:var(--dsw-alias-label-caption);flex:none;align-items:center;gap:5px;font-size:12px;display:inline-flex}.DXqwVW_badge:before{content:\"\";corner-shape:round;background:currentColor;border-radius:50%;width:5px;height:5px}.DXqwVW_badge[data-tone=info]{color:var(--dsw-alias-state-business-primary)}.DXqwVW_badge[data-tone=success]{color:var(--dsw-alias-state-success-primary)}.DXqwVW_badge[data-tone=warning]{color:var(--dsw-alias-state-warn-primary)}.DXqwVW_badge[data-tone=error]{color:var(--dsw-alias-state-error-primary)}.DXqwVW_subtitle{color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere;margin-top:3px;font-size:12px}.DXqwVW_description{color:var(--dsw-alias-label-caption);white-space:pre-wrap;overflow-wrap:anywhere;margin:6px 0}.DXqwVW_lines{white-space:pre-wrap;overflow-wrap:anywhere;margin:6px 0 0;padding-inline-start:18px}.DXqwVW_lines li+li{margin-top:4px}.DXqwVW_group{border-top:.5px solid var(--dsw-alias-border-l2);margin-top:8px}.DXqwVW_group>summary{color:var(--dsw-alias-label-caption);cursor:pointer;overflow-wrap:anywhere;align-items:center;gap:6px;padding:8px 0 0;list-style:none;display:flex}.DXqwVW_group>summary::-webkit-details-marker{display:none}.DXqwVW_group[open]>summary svg{transform:rotate(90deg)}.DXqwVW_group>summary svg{flex:none}.DXqwVW_group .DXqwVW_list{max-height:none;overflow:visible}.DXqwVW_group .DXqwVW_item{padding:9px 0 2px 20px}.DXqwVW_prose,.DXqwVW_code{max-width:100%;font-size:13px}.DXqwVW_prose{margin-top:8px}.DXqwVW_root .DXqwVW_item>.DXqwVW_code{max-height:240px;margin:8px 0 0;overflow:auto}.DXqwVW_root .DXqwVW_item:has(>.DXqwVW_code:only-child){padding:0}.DXqwVW_root .DXqwVW_item>.DXqwVW_code:only-child{margin:0}.DXqwVW_root .DXqwVW_group .DXqwVW_item:has(>.DXqwVW_code:only-child){padding:4px 0 0 20px}.DXqwVW_path{min-width:0;color:inherit;font:inherit;text-align:start;overflow-wrap:anywhere;cursor:pointer;background:0 0;border:none;flex:1;padding:0}.DXqwVW_path:hover{text-decoration:underline}.DXqwVW_path:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:3px}";
1261
+ const tagId$3 = "@deepseek-ai/dsh-client-ui-tool/ToolDetails.module.css";
1262
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$3) + "]") === null) {
1263
+ const tag = document.createElement("style");
1264
+ tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-tool";
1265
+ tag.dataset.pluginCss = tagId$3;
1266
+ tag.textContent = css$3;
1267
+ document.head.appendChild(tag);
1268
+ }
1269
+ var ToolDetails_module_css_default = {
1270
+ "badge": "DXqwVW_badge",
1271
+ "caption": "DXqwVW_caption",
1272
+ "code": "DXqwVW_code",
1273
+ "description": "DXqwVW_description",
1274
+ "empty": "DXqwVW_empty",
1275
+ "field": "DXqwVW_field",
1276
+ "fields": "DXqwVW_fields",
1277
+ "group": "DXqwVW_group",
1278
+ "heading": "DXqwVW_heading",
1279
+ "item": "DXqwVW_item",
1280
+ "lines": "DXqwVW_lines",
1281
+ "list": "DXqwVW_list",
1282
+ "path": "DXqwVW_path",
1283
+ "pending": "DXqwVW_pending",
1284
+ "previous": "DXqwVW_previous",
1285
+ "prose": "DXqwVW_prose",
1286
+ "root": "DXqwVW_root",
1287
+ "status": "DXqwVW_status",
1288
+ "statusText": "DXqwVW_statusText",
1289
+ "subtitle": "DXqwVW_subtitle",
1290
+ "text": "DXqwVW_text",
1291
+ "unchanged": "DXqwVW_unchanged"
1292
+ };
1293
+ //#endregion
1294
+ //#region lib/types/client/tool/components/ToolDetails.js
1295
+ /** Compact, read-only fields and lists for recorded Tool results. */
1296
+ function DetailItem({ item, t, onOpenFile }) {
1297
+ const status = item.status;
1298
+ return (0, react_jsx_runtime.jsxs)("li", {
1299
+ className: ToolDetails_module_css_default.item,
1300
+ "data-change": item.change?.value,
1301
+ children: [
1302
+ item.title !== void 0 && (0, react_jsx_runtime.jsxs)("div", {
1303
+ className: ToolDetails_module_css_default.heading,
1304
+ children: [
1305
+ status !== void 0 && (0, react_jsx_runtime.jsx)("span", {
1306
+ className: ToolDetails_module_css_default.status,
1307
+ role: "img",
1308
+ "aria-label": item.change?.label ?? status.label,
1309
+ children: item.change?.value === "added" ? "+" : item.change?.value === "removed" ? "−" : status.value === "completed" ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCheckOutlineRegular, { size: 14 }) : status.value === "in_progress" ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPlayOutlineRegular, { size: 14 }) : (0, react_jsx_runtime.jsx)("span", { className: ToolDetails_module_css_default.pending })
1310
+ }),
1311
+ item.location !== void 0 && onOpenFile !== void 0 ? (0, react_jsx_runtime.jsx)("button", {
1312
+ className: ToolDetails_module_css_default.path,
1313
+ type: "button",
1314
+ onClick: () => {
1315
+ const location = item.location;
1316
+ if (location !== void 0) onOpenFile(location.path, location.line === void 0 ? void 0 : { line: location.line });
1317
+ },
1318
+ children: item.title
1319
+ }) : (0, react_jsx_runtime.jsx)("span", {
1320
+ className: ToolDetails_module_css_default.text,
1321
+ children: item.title
1322
+ }),
1323
+ item.badge !== void 0 && (0, react_jsx_runtime.jsx)("span", {
1324
+ className: ToolDetails_module_css_default.badge,
1325
+ "data-tone": item.badge.tone,
1326
+ children: item.badge.label
1327
+ }),
1328
+ status !== void 0 && (0, react_jsx_runtime.jsxs)("span", {
1329
+ className: ToolDetails_module_css_default.statusText,
1330
+ children: [
1331
+ item.previousStatus !== void 0 && (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)("span", {
1332
+ className: ToolDetails_module_css_default.previous,
1333
+ children: item.previousStatus
1334
+ }), (0, react_jsx_runtime.jsx)("span", { children: " → " })] }),
1335
+ (0, react_jsx_runtime.jsx)("span", { children: status.label }),
1336
+ item.change?.value === "updated" && item.previousStatus === void 0 && (0, react_jsx_runtime.jsxs)("span", { children: [" · ", item.change.label] })
1337
+ ]
1338
+ })
1339
+ ]
1340
+ }),
1341
+ item.subtitle !== void 0 && (0, react_jsx_runtime.jsx)("div", {
1342
+ className: ToolDetails_module_css_default.subtitle,
1343
+ children: item.subtitle
1344
+ }),
1345
+ item.description !== void 0 && (0, react_jsx_runtime.jsx)("p", {
1346
+ className: ToolDetails_module_css_default.description,
1347
+ children: item.description
1348
+ }),
1349
+ item.fields.length > 0 && (0, react_jsx_runtime.jsx)("dl", {
1350
+ className: ToolDetails_module_css_default.fields,
1351
+ children: item.fields.map((field) => (0, react_jsx_runtime.jsxs)("div", {
1352
+ className: ToolDetails_module_css_default.field,
1353
+ children: [(0, react_jsx_runtime.jsx)("dt", { children: field.label }), (0, react_jsx_runtime.jsx)("dd", { children: field.value })]
1354
+ }, field.label))
1355
+ }),
1356
+ item.lines !== void 0 && (0, react_jsx_runtime.jsx)("ul", {
1357
+ className: ToolDetails_module_css_default.lines,
1358
+ children: item.lines.map((line, index) => (0, react_jsx_runtime.jsx)("li", { children: line }, index))
1359
+ }),
1360
+ item.markdown !== void 0 && (0, react_jsx_runtime.jsx)("div", {
1361
+ className: ToolDetails_module_css_default.prose,
1362
+ children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MarkdownText, {
1363
+ text: item.markdown,
1364
+ labels: markdownLabels(t)
1365
+ })
1366
+ }),
1367
+ item.code !== void 0 && (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.CodeBlock, {
1368
+ toolbarLabels: codeToolbarLabels(t),
1369
+ className: ToolDetails_module_css_default.code,
1370
+ code: item.code.text,
1371
+ lang: item.code.language,
1372
+ copyLabel: t("copy"),
1373
+ copiedLabel: t("copied")
1374
+ }),
1375
+ item.groups?.map((group, index) => (0, react_jsx_runtime.jsxs)("details", {
1376
+ className: ToolDetails_module_css_default.group,
1377
+ children: [(0, react_jsx_runtime.jsxs)("summary", { children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronRightOutlineRegular, {}), (0, react_jsx_runtime.jsx)("span", { children: group.label })] }), (0, react_jsx_runtime.jsx)("ul", {
1378
+ className: ToolDetails_module_css_default.list,
1379
+ children: group.items.map((child, childIndex) => (0, react_jsx_runtime.jsx)(DetailItem, {
1380
+ item: child,
1381
+ t,
1382
+ onOpenFile
1383
+ }, childIndex))
1384
+ })]
1385
+ }, index))
1386
+ ]
1387
+ });
1388
+ }
1389
+ /**
1390
+ * Render recorded values with local disclosures, copy controls, and file navigation.
1391
+ * @param props.model - Localized fields or list items; an empty list uses its empty label.
1392
+ * @param props.hasInspect - Reserve space for the row's upper-right Inspect button.
1393
+ * @param props.t - Conversation dictionary for shared Markdown and code controls.
1394
+ * @param props.onOpenFile - Open a recorded file location in the session workspace.
1395
+ * @returns The expanded detail body.
1396
+ */
1397
+ function ToolDetails({ model, hasInspect = false, t, onOpenFile }) {
1398
+ return (0, react_jsx_runtime.jsxs)("div", {
1399
+ className: ToolDetails_module_css_default.root,
1400
+ "data-inspect": hasInspect || void 0,
1401
+ "data-caption": model.caption !== void 0 || void 0,
1402
+ children: [
1403
+ model.caption !== void 0 && (0, react_jsx_runtime.jsx)("div", {
1404
+ className: ToolDetails_module_css_default.caption,
1405
+ children: model.caption
1406
+ }),
1407
+ model.items.length === 0 ? (0, react_jsx_runtime.jsx)("p", {
1408
+ className: ToolDetails_module_css_default.empty,
1409
+ children: model.empty
1410
+ }) : (0, react_jsx_runtime.jsx)("ul", {
1411
+ className: ToolDetails_module_css_default.list,
1412
+ children: model.items.map((item, index) => (0, react_jsx_runtime.jsx)(DetailItem, {
1413
+ item,
1414
+ t,
1415
+ onOpenFile
1416
+ }, index))
1417
+ }),
1418
+ model.unchanged !== void 0 && (0, react_jsx_runtime.jsxs)("details", {
1419
+ className: ToolDetails_module_css_default.unchanged,
1420
+ children: [(0, react_jsx_runtime.jsxs)("summary", { children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronRightOutlineRegular, {}), model.unchanged.label] }), (0, react_jsx_runtime.jsx)("ul", {
1421
+ className: ToolDetails_module_css_default.list,
1422
+ children: model.unchanged.items.map((item, index) => (0, react_jsx_runtime.jsx)(DetailItem, {
1423
+ item,
1424
+ t,
1425
+ onOpenFile
1426
+ }, index))
1427
+ })]
1428
+ })
1429
+ ]
1430
+ });
1431
+ }
1432
+ //#endregion
1143
1433
  //#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-tool/src/client/tool/components/ToolRow.module.css.mjs
1144
- const css$2 = ".o3BgMG_root{flex-direction:column;display:flex}.o3BgMG_row{position:relative;overflow:hidden}.o3BgMG_root[data-state=running] .o3BgMG_row:after{content:\"\";background:linear-gradient(90deg, transparent 0%, color-mix(in srgb, var(--dsw-alias-bg-base) 60%, transparent) 55%, transparent 100%);pointer-events:none;width:300px;animation:2.6s ease-out infinite o3BgMG_dsh-tool-row-sweep;position:absolute;top:0;bottom:0;left:0}@keyframes o3BgMG_dsh-tool-row-sweep{0%{left:-300px}90%,to{left:100%}}.o3BgMG_leading{flex-shrink:0}.o3BgMG_root[data-tool^=cordis_] .o3BgMG_leading,.o3BgMG_root[data-tool^=cordis_] .o3BgMG_title{color:var(--dsw-alias-state-business-primary)}.o3BgMG_root[data-tool^=cordis_] .o3BgMG_title{font-weight:500}.o3BgMG_root[data-tool^=cordis_] .o3BgMG_sep{background:var(--dsw-alias-state-business-primary)}.o3BgMG_chevron{color:var(--dsw-alias-label-secondary)}.o3BgMG_title{font-weight:400}.o3BgMG_sep{background:var(--dsw-alias-label-caption);border-radius:1px;flex:none;width:2px;height:2px;margin:0 8px}.o3BgMG_summary{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:var(--dsh-content-font-size-secondary,13px);line-height:calc(24px + var(--dsh-content-font-delta,0px));color:var(--dsw-alias-label-tertiary);flex:auto;overflow:hidden}.o3BgMG_summarySuffix{white-space:nowrap;font-size:var(--dsh-content-font-size-secondary,13px);line-height:calc(24px + var(--dsh-content-font-delta,0px));color:var(--dsw-alias-label-tertiary);flex:none;margin-left:4px}.o3BgMG_diffStat{font-family:var(--ds-font-family-code);font-size:calc(var(--dsh-content-font-size-secondary,13px) - 2px);color:var(--dsw-alias-label-caption);margin-left:10px;transform:translateY(.5px)}.o3BgMG_fileLink{text-overflow:ellipsis;white-space:nowrap;min-width:0;font:inherit;text-align:left;font-size:var(--dsh-content-font-size-secondary,13px);line-height:calc(24px + var(--dsh-content-font-delta,0px));color:var(--dsw-alias-label-secondary);text-decoration:underline dotted;text-decoration-color:var(--dsw-alias-label-tertiary);text-underline-offset:3px;cursor:pointer;background:0 0;border:none;flex:0 auto;margin:0;padding:0;text-decoration-thickness:1px;overflow:hidden}.o3BgMG_fileLink:hover{color:var(--dsw-alias-label-primary);text-decoration-color:currentColor}.o3BgMG_errorSummary{color:var(--dsw-alias-state-error-primary)}.o3BgMG_bodyWrap{flex-direction:column;display:flex}.o3BgMG_inspectButton{border:.5px solid var(--dsw-alias-border-l3);corner-shape:round;background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-secondary);cursor:pointer;opacity:0;border-radius:999px;align-self:flex-start;align-items:center;gap:4px;margin:4px 0 2px 4px;padding:2px 8px;font-size:11px;line-height:16px;transition:opacity .1s;display:inline-flex}.o3BgMG_root:hover .o3BgMG_inspectButton,.o3BgMG_inspectButton:focus-visible{opacity:1}.o3BgMG_inspectButton:hover{background:var(--dsw-alias-interactive-bg-hover-solid);color:var(--dsw-alias-label-primary)}.o3BgMG_bodyScroll{max-height:260px;overflow-y:auto}.o3BgMG_ioCard{border:.5px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-markdown-code-block);font:var(--dsw-font-markdown-code-block-small);border-radius:12px;flex-direction:column;margin:4px 0 4px 4px;display:flex}.o3BgMG_ioSection{grid-template-columns:max-content 1fr;align-items:baseline;column-gap:14px;max-height:150px;padding:12px 16px;display:grid;overflow-y:auto}.o3BgMG_ioSection::-webkit-scrollbar-thumb{background-clip:padding-box;border:2px solid #0000;border-radius:6px}.o3BgMG_ioSection::-webkit-scrollbar-track{margin:6px 0}.o3BgMG_ioLabel{color:var(--dsw-alias-label-caption);align-self:start;position:sticky;top:0}.o3BgMG_ioDivider{background:var(--dsw-alias-border-l2);flex:none;height:.5px}.o3BgMG_ioText{white-space:pre-wrap;word-break:break-word;min-width:0;color:var(--dsw-alias-label-secondary)}.o3BgMG_ioText[data-error]{color:var(--dsw-alias-state-error-primary)}.o3BgMG_codeBody,.o3BgMG_terminalBody,.o3BgMG_diffBody,.o3BgMG_readBody,.o3BgMG_imageBody,.o3BgMG_searchBody,.o3BgMG_webBody{margin:4px 0 4px 4px}.o3BgMG_searchRecovery{white-space:pre-wrap;overflow-wrap:anywhere;font:var(--dsw-font-xs-13);color:var(--dsw-alias-label-tertiary);margin:4px 0 4px 4px}.o3BgMG_imageLabel{overflow-wrap:anywhere;font:var(--dsw-font-sm-13);color:var(--dsw-alias-label-secondary);margin-bottom:4px}.o3BgMG_imageMeta{white-space:pre-wrap;overflow-wrap:anywhere;font:var(--dsw-font-xs-13);color:var(--dsw-alias-label-tertiary)}.o3BgMG_codeBody{--dsl-code-block-content-font:var(--dsw-font-markdown-code-block-small)}.o3BgMG_terminalBody{--dsl-terminal-font:var(--dsw-font-markdown-code-block-small);--dsl-terminal-line-height:18px;--dsl-terminal-output-max-height:224px;border:.5px solid var(--dsw-alias-border-l1)}.o3BgMG_visuallyHidden{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}";
1434
+ const css$2 = ".o3BgMG_root{flex-direction:column;display:flex}.o3BgMG_leading{flex-shrink:0}.o3BgMG_root[data-tool^=cordis_] .o3BgMG_leading,.o3BgMG_root[data-tool^=cordis_] .o3BgMG_title{color:var(--dsw-alias-state-business-primary)}.o3BgMG_root[data-tool^=cordis_] .o3BgMG_title{font-weight:500}.o3BgMG_root[data-tool^=cordis_] .o3BgMG_sep{background:var(--dsw-alias-state-business-primary)}.o3BgMG_chevron{color:var(--dsw-alias-label-secondary)}.o3BgMG_title{font-weight:400;transition:color .1s}.o3BgMG_sep{background:var(--dsw-alias-label-caption);border-radius:1px;flex:none;width:2px;height:2px;margin:0 8px}.o3BgMG_summary{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:var(--dsh-content-font-size-secondary,13px);line-height:calc(24px + var(--dsh-content-font-delta,0px));color:var(--dsw-alias-label-tertiary);flex:auto;transition:color .1s;overflow:hidden}.o3BgMG_summarySuffix{white-space:nowrap;font-size:var(--dsh-content-font-size-secondary,13px);line-height:calc(24px + var(--dsh-content-font-delta,0px));color:var(--dsw-alias-label-tertiary);flex:none;margin-left:4px;transition:color .1s}.o3BgMG_row:hover .o3BgMG_title,.o3BgMG_row:hover .o3BgMG_summary:not(.o3BgMG_errorSummary):not(.o3BgMG_stoppedSummary),.o3BgMG_row:hover .o3BgMG_summarySuffix{color:var(--dsw-alias-label-primary)}.o3BgMG_diffStat{font-family:var(--ds-font-family-code);font-size:calc(var(--dsh-content-font-size-secondary,13px) - 2px);color:var(--dsw-alias-label-caption);margin-left:10px;transform:translateY(.5px)}.o3BgMG_fileLink{text-overflow:ellipsis;white-space:nowrap;min-width:0;font:inherit;text-align:left;font-size:var(--dsh-content-font-size-secondary,13px);line-height:calc(24px + var(--dsh-content-font-delta,0px));color:var(--dsw-alias-label-secondary);text-decoration:underline dotted;text-decoration-color:var(--dsw-alias-label-tertiary);text-underline-offset:3px;cursor:pointer;background:0 0;border:none;flex:0 auto;margin:0;padding:0;text-decoration-thickness:1px;transition:color .1s;overflow:hidden}.o3BgMG_row:hover .o3BgMG_fileLink,.o3BgMG_fileLink:hover{color:var(--dsw-alias-label-primary);text-decoration-color:currentColor}.o3BgMG_errorSummary{color:var(--dsw-alias-state-error-primary)}.o3BgMG_stoppedSummary{color:var(--dsw-alias-state-warn-label)}.o3BgMG_bodyWrap{flex-direction:column;display:flex}.o3BgMG_inspectButton{border:.5px solid var(--dsw-alias-border-l3);corner-shape:round;background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-secondary);cursor:pointer;opacity:0;border-radius:999px;align-self:flex-start;align-items:center;gap:4px;margin:4px 0 2px 4px;padding:2px 8px;font-size:11px;line-height:16px;transition:opacity .1s;display:inline-flex}.o3BgMG_root:hover .o3BgMG_inspectButton,.o3BgMG_inspectButton:focus-visible{opacity:1}.o3BgMG_detailsBodyWrap{position:relative}.o3BgMG_detailsBodyWrap .o3BgMG_inspectButton{margin:0;position:absolute;top:12px;right:12px}.o3BgMG_inspectButton:hover{background:var(--dsw-alias-interactive-bg-hover-solid);color:var(--dsw-alias-label-primary)}.o3BgMG_bodyScroll{max-height:260px;overflow-y:auto}.o3BgMG_ioCard{border:.5px solid var(--dsw-alias-border-l1);border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-markdown-code-block);font:var(--dsw-font-markdown-code-block-small);flex-direction:column;margin:4px 0 4px 4px;display:flex}.o3BgMG_ioSection{grid-template-columns:max-content 1fr;align-items:baseline;column-gap:14px;max-height:150px;padding:12px 16px;display:grid;overflow-y:auto}.o3BgMG_ioSection::-webkit-scrollbar-thumb{border-radius:var(--dsw-radius-sm);background-clip:padding-box;border:2px solid #0000}.o3BgMG_ioSection::-webkit-scrollbar-track{margin:6px 0}.o3BgMG_ioLabel{color:var(--dsw-alias-label-caption);align-self:start;position:sticky;top:0}.o3BgMG_ioDivider{background:var(--dsw-alias-border-l2);flex:none;height:.5px}.o3BgMG_ioText{white-space:pre-wrap;word-break:break-word;min-width:0;color:var(--dsw-alias-label-secondary)}.o3BgMG_ioText[data-error]{color:var(--dsw-alias-state-error-primary)}.o3BgMG_codeBody,.o3BgMG_terminalBody,.o3BgMG_diffBody,.o3BgMG_readBody,.o3BgMG_imageBody,.o3BgMG_searchBody,.o3BgMG_webBody{margin:4px 0 4px 4px}.o3BgMG_searchRecovery{white-space:pre-wrap;overflow-wrap:anywhere;font:var(--dsw-font-xs-13);color:var(--dsw-alias-label-tertiary);margin:4px 0 4px 4px}.o3BgMG_imageLabel{overflow-wrap:anywhere;font:var(--dsw-font-sm-13);color:var(--dsw-alias-label-secondary);margin-bottom:4px}.o3BgMG_imageMeta{white-space:pre-wrap;overflow-wrap:anywhere;font:var(--dsw-font-xs-13);color:var(--dsw-alias-label-tertiary)}.o3BgMG_terminalBody{--dsl-terminal-font:var(--dsw-font-markdown-code-block-small);--dsl-terminal-line-height:18px;--dsl-terminal-output-max-height:224px;border:.5px solid var(--dsw-alias-border-l1)}.o3BgMG_visuallyHidden{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}";
1145
1435
  const tagId$2 = "@deepseek-ai/dsh-client-ui-tool/ToolRow.module.css";
1146
1436
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$2) + "]") === null) {
1147
1437
  const tag = document.createElement("style");
@@ -1155,9 +1445,9 @@ window.__ModuleLoader__.load({
1155
1445
  "bodyWrap": "o3BgMG_bodyWrap",
1156
1446
  "chevron": "o3BgMG_chevron",
1157
1447
  "codeBody": "o3BgMG_codeBody",
1448
+ "detailsBodyWrap": "o3BgMG_detailsBodyWrap",
1158
1449
  "diffBody": "o3BgMG_diffBody",
1159
1450
  "diffStat": "o3BgMG_diffStat",
1160
- "dsh-tool-row-sweep": "o3BgMG_dsh-tool-row-sweep",
1161
1451
  "errorSummary": "o3BgMG_errorSummary",
1162
1452
  "fileLink": "o3BgMG_fileLink",
1163
1453
  "imageBody": "o3BgMG_imageBody",
@@ -1176,6 +1466,7 @@ window.__ModuleLoader__.load({
1176
1466
  "searchBody": "o3BgMG_searchBody",
1177
1467
  "searchRecovery": "o3BgMG_searchRecovery",
1178
1468
  "sep": "o3BgMG_sep",
1469
+ "stoppedSummary": "o3BgMG_stoppedSummary",
1179
1470
  "summary": "o3BgMG_summary",
1180
1471
  "summarySuffix": "o3BgMG_summarySuffix",
1181
1472
  "terminalBody": "o3BgMG_terminalBody",
@@ -1185,72 +1476,238 @@ window.__ModuleLoader__.load({
1185
1476
  };
1186
1477
  //#endregion
1187
1478
  //#region lib/types/client/tool/components/ToolRow.js
1188
- function leadingFor$1(state, icon) {
1189
- switch (state) {
1190
- case "error": return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, { state: "error" });
1191
- case "stopped": return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, { state: "warning" });
1192
- default: return icon;
1193
- }
1479
+ /** Keep a summary link click from toggling the row; the browser still follows the link. */
1480
+ function stopLinkClick(event) {
1481
+ event.stopPropagation();
1194
1482
  }
1195
- /** Visually hidden run-state label: the StateDot and the CSS sweep are both
1196
- * aria-hidden / colour-only, so assistive technology needs this text to know a
1197
- * row is running, failed, or interrupted. null in the ok state (the icon and
1198
- * summary already describe a settled row). */
1483
+ /** Visually hidden run-state label for color-only running and settlement cues. */
1199
1484
  function stateStatus$1(state, t) {
1200
1485
  switch (state) {
1486
+ case "preparing": return t("row.preparing");
1201
1487
  case "running": return t("row.running");
1202
1488
  case "error": return t("row.failed");
1203
1489
  case "stopped": return t("row.stopped");
1204
1490
  default: return null;
1205
1491
  }
1206
1492
  }
1207
- function ToolRow({ t, variant, toolName, icon, title, summary, summarySuffix, bodyRaw, output, askQuestion, errorSummary, terminal, diff, read, image, renderSlot, loadImage, search, web, state, filePath, filePathLine, onOpenFile, inspect }) {
1208
- const [expanded, setExpanded] = (0, react.useState)(false);
1493
+ /**
1494
+ * Render one localized tool summary and lazily mounted result card.
1495
+ * Preparation retains the icon, title, and optional tool-name summary without disclosure.
1496
+ * @param props - tool state, summary, output, and navigation callbacks.
1497
+ * @returns the tool disclosure.
1498
+ */
1499
+ const ToolRow = (0, react.memo)(function ToolRow({ t, variant, toolName, icon, title, summary, summarySuffix, bodyRaw, output, askQuestion, errorSummary, terminal, diff, read, image, renderSlot, loadImage, search, web, details, state, filePath, filePathLine, onOpenFile, href, inspect, useDisclosure }) {
1500
+ const { expanded, toggle: toggleExpand } = useDisclosure();
1209
1501
  const terminalLabels = (0, react.useMemo)(() => terminalBlockLabels(t), [t]);
1210
1502
  const diffLabels = (0, react.useMemo)(() => diffBlockLabels(t), [t]);
1211
1503
  const readLabels = (0, react.useMemo)(() => readBlockLabels(t), [t]);
1212
1504
  const searchLabels = (0, react.useMemo)(() => searchBlockLabels(t), [t]);
1213
1505
  const webLabels = (0, react.useMemo)(() => webBlockLabels(t), [t]);
1214
- const terminalBody = terminal === void 0 || terminal === null ? null : localizeTerminalCardModel(terminal, t);
1506
+ const terminalBody = (0, react.useMemo)(() => terminal === void 0 || terminal === null ? null : localizeTerminalCardModel(terminal, t), [terminal, t]);
1215
1507
  const diffBody = diff ?? null;
1216
1508
  const readBody = read ?? null;
1217
1509
  const imageBody = image !== void 0 && image !== null && renderSlot !== void 0 && loadImage !== void 0 ? image : null;
1218
1510
  const searchBody = search ?? null;
1219
1511
  const webBody = web ?? null;
1220
1512
  const askQuestionBody = askQuestion ?? null;
1513
+ const detailsBody = details ?? null;
1514
+ const inputRaw = bodyRaw ?? null;
1221
1515
  const outputText = output ?? null;
1222
- const card = askQuestionBody ?? terminalBody ?? diffBody ?? readBody ?? imageBody ?? searchBody ?? webBody;
1223
- const expandable = bodyRaw != null || outputText !== null || card !== null;
1516
+ const card = askQuestionBody ?? terminalBody ?? diffBody ?? readBody ?? imageBody ?? searchBody ?? webBody ?? detailsBody;
1517
+ const expandable = state !== "preparing" && (inputRaw !== null || outputText !== null || card !== null);
1224
1518
  const open = expanded && expandable;
1225
- const bodyText = (0, react.useMemo)(() => open && card === null && bodyRaw != null ? formatToolBody(variant, bodyRaw) : null, [
1226
- bodyRaw,
1519
+ const bodyText = (0, react.useMemo)(() => open && card === null && inputRaw !== null ? formatToolBody(variant, inputRaw) : null, [
1227
1520
  card,
1521
+ inputRaw,
1228
1522
  open,
1229
1523
  variant
1230
1524
  ]);
1231
1525
  const status = stateStatus$1(state, t);
1232
- const failureLine = state === "error" ? errorSummary ?? null : null;
1233
- const summaryText = failureLine ?? terminalBody?.description ?? summary;
1526
+ const running = state === "running" || state === "preparing";
1527
+ const normalSummary = terminalBody?.description ?? (open ? detailsBody?.expandedSummary ?? summary : summary);
1528
+ const summaryText = (state === "error" ? errorSummary ?? normalSummary : null) ?? normalSummary;
1234
1529
  const diffStat = (0, react.useMemo)(() => {
1235
1530
  if (diffBody === null) return null;
1236
1531
  const { added, removed } = (0, _deepseek_ai_dsh_client_ui_primitives.diffTotals)(diffBody.card.diffs);
1237
1532
  return `+${added} -${removed}`;
1238
1533
  }, [diffBody]);
1239
- const suffix = failureLine === null ? summarySuffix ?? diffStat : null;
1240
- const fileLink = filePath !== void 0 && onOpenFile !== void 0 && failureLine === null;
1241
- const toggleExpand = () => {
1242
- setExpanded((v) => !v);
1243
- };
1244
- const openFile = (event) => {
1534
+ const settledWithCue = state === "error" || state === "stopped";
1535
+ const suffix = settledWithCue ? null : summarySuffix ?? diffStat;
1536
+ const openFile = (0, react.useMemo)(() => filePath !== void 0 && onOpenFile !== void 0 && !settledWithCue ? (event) => {
1245
1537
  event.stopPropagation();
1246
- if (filePath === void 0 || onOpenFile === void 0) return;
1247
1538
  if (filePathLine === void 0) onOpenFile(filePath);
1248
1539
  else onOpenFile(filePath, { line: filePathLine });
1249
- };
1250
- const fileLinkKeyDown = (event) => {
1540
+ } : void 0, [
1541
+ filePath,
1542
+ filePathLine,
1543
+ onOpenFile,
1544
+ settledWithCue
1545
+ ]);
1546
+ const linkHref = settledWithCue ? void 0 : href;
1547
+ const summaryLinkKeyDown = (0, react.useCallback)((event) => {
1251
1548
  if (event.key === "Enter" || event.key === " ") event.stopPropagation();
1252
- };
1549
+ }, []);
1253
1550
  const cardBody = variant === "code" ? null : bodyText;
1551
+ const collapsedContent = (0, react.useMemo)(() => summaryText !== "" && (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
1552
+ (0, react_jsx_runtime.jsx)("span", {
1553
+ className: ToolRow_module_css_default.sep,
1554
+ "data-shimmer-decoration": true,
1555
+ "aria-hidden": true
1556
+ }),
1557
+ openFile !== void 0 ? (0, react_jsx_runtime.jsx)("button", {
1558
+ type: "button",
1559
+ className: ToolRow_module_css_default.fileLink,
1560
+ onClick: openFile,
1561
+ onKeyDown: summaryLinkKeyDown,
1562
+ children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.TextShimmer, { children: summaryText })
1563
+ }) : linkHref !== void 0 ? (0, react_jsx_runtime.jsx)("a", {
1564
+ className: ToolRow_module_css_default.fileLink,
1565
+ href: linkHref,
1566
+ target: "_blank",
1567
+ rel: "noopener noreferrer",
1568
+ onClick: stopLinkClick,
1569
+ onKeyDown: summaryLinkKeyDown,
1570
+ children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.TextShimmer, { children: summaryText })
1571
+ }) : (0, react_jsx_runtime.jsx)("span", {
1572
+ className: clsx(ToolRow_module_css_default.summary, state === "error" && ToolRow_module_css_default.errorSummary, state === "stopped" && ToolRow_module_css_default.stoppedSummary),
1573
+ children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.TextShimmer, { children: summaryText })
1574
+ }),
1575
+ suffix !== null && (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.TextShimmer, {
1576
+ className: clsx(ToolRow_module_css_default.summarySuffix, suffix === diffStat && ToolRow_module_css_default.diffStat),
1577
+ children: suffix
1578
+ })
1579
+ ] }), [
1580
+ diffStat,
1581
+ summaryLinkKeyDown,
1582
+ linkHref,
1583
+ openFile,
1584
+ running,
1585
+ state,
1586
+ suffix,
1587
+ summaryText
1588
+ ]);
1589
+ const expandedContent = (0, react.useMemo)(() => open ? (0, react_jsx_runtime.jsxs)("div", {
1590
+ className: clsx(ToolRow_module_css_default.bodyWrap, detailsBody !== null && ToolRow_module_css_default.detailsBodyWrap),
1591
+ children: [askQuestionBody !== null ? (0, react_jsx_runtime.jsx)(AskQuestionCard, { card: askQuestionBody }) : terminalBody !== null ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.TerminalBlock, {
1592
+ ...terminalBody.card,
1593
+ maxLines: Infinity,
1594
+ labels: terminalLabels,
1595
+ className: ToolRow_module_css_default.terminalBody
1596
+ }) : diffBody !== null ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.DiffBlock, {
1597
+ ...diffBody.card,
1598
+ labels: diffLabels,
1599
+ maxLines: 9,
1600
+ className: ToolRow_module_css_default.diffBody
1601
+ }) : readBody !== null ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.ReadBlock, {
1602
+ ...readBody,
1603
+ labels: readLabels,
1604
+ maxLines: 8,
1605
+ className: ToolRow_module_css_default.readBody
1606
+ }) : imageBody !== null ? (0, react_jsx_runtime.jsxs)("div", {
1607
+ className: ToolRow_module_css_default.imageBody,
1608
+ children: [
1609
+ (0, react_jsx_runtime.jsx)("div", {
1610
+ className: ToolRow_module_css_default.imageLabel,
1611
+ children: imageBody.label
1612
+ }),
1613
+ renderSlot !== void 0 && loadImage !== void 0 && renderSlot("tool.call.images", {
1614
+ images: imageBody.images,
1615
+ loadImage,
1616
+ align: "start"
1617
+ }),
1618
+ (0, react_jsx_runtime.jsx)("div", {
1619
+ className: ToolRow_module_css_default.imageMeta,
1620
+ children: imageBody.text
1621
+ })
1622
+ ]
1623
+ }) : searchBody !== null ? (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.SearchBlock, {
1624
+ ...searchBody.card,
1625
+ labels: searchLabels,
1626
+ maxLines: 8,
1627
+ className: ToolRow_module_css_default.searchBody
1628
+ }), searchBody.recovery !== void 0 && (0, react_jsx_runtime.jsx)("div", {
1629
+ className: ToolRow_module_css_default.searchRecovery,
1630
+ children: searchBody.recovery
1631
+ })] }) : webBody !== null ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.WebBlock, {
1632
+ ...webBody,
1633
+ labels: webLabels,
1634
+ className: ToolRow_module_css_default.webBody
1635
+ }) : detailsBody !== null ? (0, react_jsx_runtime.jsx)(ToolDetails, {
1636
+ model: detailsBody,
1637
+ hasInspect: inspect !== void 0,
1638
+ t,
1639
+ onOpenFile
1640
+ }) : (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [variant === "code" && bodyText !== null && (0, react_jsx_runtime.jsx)("div", {
1641
+ className: ToolRow_module_css_default.bodyScroll,
1642
+ children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.CodeBlock, {
1643
+ code: bodyText,
1644
+ lang: "typescript",
1645
+ copyLabel: t("copy"),
1646
+ copiedLabel: t("copied"),
1647
+ toolbarLabels: codeToolbarLabels(t),
1648
+ className: ToolRow_module_css_default.codeBody
1649
+ })
1650
+ }), (cardBody !== null || outputText !== null) && (0, react_jsx_runtime.jsxs)("div", {
1651
+ className: ToolRow_module_css_default.ioCard,
1652
+ children: [
1653
+ cardBody !== null && (0, react_jsx_runtime.jsxs)("div", {
1654
+ className: ToolRow_module_css_default.ioSection,
1655
+ children: [(0, react_jsx_runtime.jsx)("span", {
1656
+ className: ToolRow_module_css_default.ioLabel,
1657
+ children: t("row.input")
1658
+ }), (0, react_jsx_runtime.jsx)("span", {
1659
+ className: ToolRow_module_css_default.ioText,
1660
+ children: cardBody
1661
+ })]
1662
+ }),
1663
+ cardBody !== null && outputText !== null && (0, react_jsx_runtime.jsx)("span", {
1664
+ className: ToolRow_module_css_default.ioDivider,
1665
+ "aria-hidden": true
1666
+ }),
1667
+ outputText !== null && (0, react_jsx_runtime.jsxs)("div", {
1668
+ className: ToolRow_module_css_default.ioSection,
1669
+ children: [(0, react_jsx_runtime.jsx)("span", {
1670
+ className: ToolRow_module_css_default.ioLabel,
1671
+ children: t("row.output")
1672
+ }), (0, react_jsx_runtime.jsx)("span", {
1673
+ className: ToolRow_module_css_default.ioText,
1674
+ "data-error": state === "error" || void 0,
1675
+ children: outputText
1676
+ })]
1677
+ })
1678
+ ]
1679
+ })] }), inspect !== void 0 && (0, react_jsx_runtime.jsxs)("button", {
1680
+ type: "button",
1681
+ className: ToolRow_module_css_default.inspectButton,
1682
+ onClick: inspect,
1683
+ children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconInspectOutlineRegular, {}), t("row.inspect")]
1684
+ })]
1685
+ }) : void 0, [
1686
+ open,
1687
+ detailsBody,
1688
+ askQuestionBody,
1689
+ terminalBody,
1690
+ terminalLabels,
1691
+ diffBody,
1692
+ diffLabels,
1693
+ readBody,
1694
+ readLabels,
1695
+ imageBody,
1696
+ renderSlot,
1697
+ loadImage,
1698
+ searchBody,
1699
+ searchLabels,
1700
+ webBody,
1701
+ webLabels,
1702
+ inspect,
1703
+ t,
1704
+ onOpenFile,
1705
+ variant,
1706
+ bodyText,
1707
+ cardBody,
1708
+ outputText,
1709
+ state
1710
+ ]);
1254
1711
  return (0, react_jsx_runtime.jsxs)("div", {
1255
1712
  className: ToolRow_module_css_default.root,
1256
1713
  "data-variant": variant,
@@ -1264,141 +1721,35 @@ window.__ModuleLoader__.load({
1264
1721
  leadingClassName: ToolRow_module_css_default.leading,
1265
1722
  titleClassName: ToolRow_module_css_default.title,
1266
1723
  chevronClassName: ToolRow_module_css_default.chevron,
1267
- icon: leadingFor$1(state, icon),
1724
+ icon,
1268
1725
  title,
1726
+ running,
1269
1727
  open,
1270
1728
  expandable,
1271
1729
  expandOnRowClick: true,
1272
1730
  keepContentWhenOpen: true,
1273
1731
  onToggle: toggleExpand,
1274
- collapsedContent: summaryText !== "" && (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
1275
- (0, react_jsx_runtime.jsx)("span", {
1276
- className: ToolRow_module_css_default.sep,
1277
- "aria-hidden": true
1278
- }),
1279
- fileLink ? (0, react_jsx_runtime.jsx)("button", {
1280
- type: "button",
1281
- className: ToolRow_module_css_default.fileLink,
1282
- onClick: openFile,
1283
- onKeyDown: fileLinkKeyDown,
1284
- children: summaryText
1285
- }) : (0, react_jsx_runtime.jsx)("span", {
1286
- className: clsx(ToolRow_module_css_default.summary, failureLine !== null && ToolRow_module_css_default.errorSummary),
1287
- children: summaryText
1288
- }),
1289
- suffix !== null && (0, react_jsx_runtime.jsx)("span", {
1290
- className: clsx(ToolRow_module_css_default.summarySuffix, suffix === diffStat && ToolRow_module_css_default.diffStat),
1291
- children: suffix
1292
- })
1293
- ] }),
1294
- children: (0, react_jsx_runtime.jsxs)("div", {
1295
- className: ToolRow_module_css_default.bodyWrap,
1296
- children: [askQuestionBody !== null ? (0, react_jsx_runtime.jsx)(AskQuestionCard, { card: askQuestionBody }) : terminalBody !== null ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.TerminalBlock, {
1297
- ...terminalBody.card,
1298
- maxLines: Infinity,
1299
- labels: terminalLabels,
1300
- className: ToolRow_module_css_default.terminalBody
1301
- }) : diffBody !== null ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.DiffBlock, {
1302
- ...diffBody.card,
1303
- labels: diffLabels,
1304
- maxLines: 8,
1305
- className: ToolRow_module_css_default.diffBody
1306
- }) : readBody !== null ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.ReadBlock, {
1307
- ...readBody,
1308
- labels: readLabels,
1309
- maxLines: 8,
1310
- className: ToolRow_module_css_default.readBody
1311
- }) : imageBody !== null ? (0, react_jsx_runtime.jsxs)("div", {
1312
- className: ToolRow_module_css_default.imageBody,
1313
- children: [
1314
- (0, react_jsx_runtime.jsx)("div", {
1315
- className: ToolRow_module_css_default.imageLabel,
1316
- children: imageBody.label
1317
- }),
1318
- renderSlot !== void 0 && loadImage !== void 0 && renderSlot("tool.call.images", {
1319
- images: imageBody.images,
1320
- loadImage,
1321
- align: "start"
1322
- }),
1323
- (0, react_jsx_runtime.jsx)("div", {
1324
- className: ToolRow_module_css_default.imageMeta,
1325
- children: imageBody.text
1326
- })
1327
- ]
1328
- }) : searchBody !== null ? (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.SearchBlock, {
1329
- ...searchBody.card,
1330
- labels: searchLabels,
1331
- maxLines: 8,
1332
- className: ToolRow_module_css_default.searchBody
1333
- }), searchBody.recovery !== void 0 && (0, react_jsx_runtime.jsx)("div", {
1334
- className: ToolRow_module_css_default.searchRecovery,
1335
- children: searchBody.recovery
1336
- })] }) : webBody !== null ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.WebBlock, {
1337
- ...webBody,
1338
- labels: webLabels,
1339
- className: ToolRow_module_css_default.webBody
1340
- }) : (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [variant === "code" && bodyText !== null && (0, react_jsx_runtime.jsx)("div", {
1341
- className: ToolRow_module_css_default.bodyScroll,
1342
- children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.CodeBlock, {
1343
- code: bodyText,
1344
- lang: "typescript",
1345
- copyLabel: t("copy"),
1346
- copiedLabel: t("copied"),
1347
- className: ToolRow_module_css_default.codeBody
1348
- })
1349
- }), (cardBody !== null || outputText !== null) && (0, react_jsx_runtime.jsxs)("div", {
1350
- className: ToolRow_module_css_default.ioCard,
1351
- children: [
1352
- cardBody !== null && (0, react_jsx_runtime.jsxs)("div", {
1353
- className: ToolRow_module_css_default.ioSection,
1354
- children: [(0, react_jsx_runtime.jsx)("span", {
1355
- className: ToolRow_module_css_default.ioLabel,
1356
- children: t("row.input")
1357
- }), (0, react_jsx_runtime.jsx)("span", {
1358
- className: ToolRow_module_css_default.ioText,
1359
- children: cardBody
1360
- })]
1361
- }),
1362
- cardBody !== null && outputText !== null && (0, react_jsx_runtime.jsx)("span", {
1363
- className: ToolRow_module_css_default.ioDivider,
1364
- "aria-hidden": true
1365
- }),
1366
- outputText !== null && (0, react_jsx_runtime.jsxs)("div", {
1367
- className: ToolRow_module_css_default.ioSection,
1368
- children: [(0, react_jsx_runtime.jsx)("span", {
1369
- className: ToolRow_module_css_default.ioLabel,
1370
- children: t("row.output")
1371
- }), (0, react_jsx_runtime.jsx)("span", {
1372
- className: ToolRow_module_css_default.ioText,
1373
- "data-error": state === "error" || void 0,
1374
- children: outputText
1375
- })]
1376
- })
1377
- ]
1378
- })] }), inspect !== void 0 && (0, react_jsx_runtime.jsxs)("button", {
1379
- type: "button",
1380
- className: ToolRow_module_css_default.inspectButton,
1381
- onClick: inspect,
1382
- children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconInspectOutline12, {}), t("row.inspect")]
1383
- })]
1384
- })
1732
+ collapsedContent,
1733
+ children: expandedContent
1385
1734
  })]
1386
1735
  });
1387
- }
1736
+ });
1388
1737
  //#endregion
1389
1738
  //#region lib/types/client/tool/toolviews/GenericToolCard.js
1390
1739
  /** Variant leading icons (figma table); all glyphs render at 14 inside the 16px leading box. */
1391
1740
  const VARIANT_ICONS = {
1392
- search: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconSearchOutline16, { size: 14 }),
1393
- read: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBrowseOutline16, { size: 14 }),
1394
- bash: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconApiOutline14, { size: 14 }),
1395
- write: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconEditOutline16, { size: 14 }),
1396
- edit: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconEditOutline16, { size: 14 }),
1397
- code: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCodeOutline16, { size: 14 }),
1398
- others: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconSparkle16, { size: 14 })
1741
+ search: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconSearchOutlineRegular, { size: 14 }),
1742
+ read: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBrowseOutlineRegular, { size: 14 }),
1743
+ bash: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconApiOutlineRegular, { size: 14 }),
1744
+ write: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconEditOutlineRegular, { size: 14 }),
1745
+ edit: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconEditOutlineRegular, { size: 14 }),
1746
+ code: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCodeOutlineRegular, { size: 14 }),
1747
+ others: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconSparkleRegular, { size: 14 })
1399
1748
  };
1400
- function GenericToolCard({ toolName, block, cwd, home, openFile, inspect, t }) {
1749
+ /** @param props - current tool stage and locale. @returns its preparation or dispatched card. */
1750
+ function GenericToolCard({ toolName, block, cwd, home, openFile, inspect, useDisclosure, t }) {
1401
1751
  const model = toolRowModel(toolName, block, cwd, home);
1752
+ const autoReview = model.autoReviewDenial === null ? null : localizeAutoReviewDenial(model.autoReviewDenial, t);
1402
1753
  const terminal = terminalCardModel(block, cwd);
1403
1754
  const read = readCardModel(block, cwd, home);
1404
1755
  const diff = diffCardModel(block);
@@ -1407,15 +1758,16 @@ window.__ModuleLoader__.load({
1407
1758
  const state = model.state === "ok" && terminal !== null && terminalFailed(terminal) ? "error" : model.state;
1408
1759
  const singleFile = model.filePath !== void 0;
1409
1760
  return (0, react_jsx_runtime.jsx)(ToolRow, {
1761
+ useDisclosure,
1410
1762
  t,
1411
1763
  variant: model.variant,
1412
1764
  toolName,
1413
1765
  icon: VARIANT_ICONS[model.variant],
1414
1766
  title: t(model.titleKey),
1415
1767
  summary: model.summary,
1416
- bodyRaw: singleFile ? null : model.bodyRaw,
1417
- output: model.output,
1418
- errorSummary: model.errorSummary,
1768
+ bodyRaw: singleFile || autoReview !== null ? null : model.bodyRaw,
1769
+ output: autoReview?.output ?? model.output,
1770
+ errorSummary: autoReview?.summary ?? model.errorSummary,
1419
1771
  terminal,
1420
1772
  diff,
1421
1773
  read,
@@ -1429,7 +1781,7 @@ window.__ModuleLoader__.load({
1429
1781
  }
1430
1782
  //#endregion
1431
1783
  //#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-tool/src/client/tool/ToolCallTree.module.css.mjs
1432
- const css$1 = ".ztWv_q_callRow{border-radius:6px}.ztWv_q_subCalls{border-left:.5px solid var(--dsw-alias-border-l2);flex-direction:column;gap:4px;margin:4px 0 2px 22px;padding-left:8px;display:flex}";
1784
+ const css$1 = ".ztWv_q_callRow{border-radius:var(--dsw-radius-sm)}.ztWv_q_subCalls{border-left:.5px solid var(--dsw-alias-border-l2);flex-direction:column;gap:4px;margin:4px 0 2px 22px;padding-left:8px;display:flex}";
1433
1785
  const tagId$1 = "@deepseek-ai/dsh-client-ui-tool/ToolCallTree.module.css";
1434
1786
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$1) + "]") === null) {
1435
1787
  const tag = document.createElement("style");
@@ -1445,39 +1797,68 @@ window.__ModuleLoader__.load({
1445
1797
  //#endregion
1446
1798
  //#region lib/types/client/tool/ToolCallTree.js
1447
1799
  /** Root/subcall Tool composition with one keyed atomic dispatch path. */
1448
- /** Resolve a Tool call's wire name from either lifecycle form. */
1449
- function callName(node) {
1450
- return "kind" in node ? node.call?.name ?? "" : node.name;
1800
+ function toolCallPhase(block) {
1801
+ if ("kind" in block) return {
1802
+ phase: "result",
1803
+ block
1804
+ };
1805
+ return block.phase === "preparing" ? {
1806
+ phase: "preparing",
1807
+ block
1808
+ } : {
1809
+ phase: "start",
1810
+ block
1811
+ };
1812
+ }
1813
+ /** Resolve a Tool call's wire name from its current stage. */
1814
+ function callName(call) {
1815
+ return call.phase === "result" ? call.block.call?.name ?? "" : call.block.name;
1451
1816
  }
1452
1817
  /** One atomic call dispatched through the Tool-owned keyed slot. */
1453
- const ToolCall = (0, react.memo)(function ToolCall({ renderSlot, callId, toolName, block, openFile, cwd, home, inspectCall, loadImage, t, children }) {
1818
+ const ToolCall = (0, react.memo)(function ToolCall({ renderSlot, callId, toolName, call, assistant, openFile, cwd, home, inspectCall, loadImage, useDisclosure, t, children }) {
1819
+ const preparing = call.phase === "preparing";
1820
+ const hookContext = (0, react.useMemo)(() => ({
1821
+ callId,
1822
+ assistant: preparing ? assistant : void 0
1823
+ }), [
1824
+ assistant,
1825
+ callId,
1826
+ preparing
1827
+ ]);
1454
1828
  const owner = (0, react.useMemo)(() => ({
1455
1829
  callId,
1456
1830
  toolName,
1457
- block,
1831
+ ...call,
1458
1832
  openFile,
1459
1833
  cwd,
1460
1834
  home,
1461
1835
  loadImage,
1462
- inspect: () => {
1836
+ useDisclosure,
1837
+ inspect: inspectCall === void 0 ? void 0 : () => {
1463
1838
  inspectCall(callId);
1464
1839
  }
1465
1840
  }), [
1466
1841
  callId,
1467
1842
  toolName,
1468
- block,
1843
+ call,
1469
1844
  openFile,
1470
1845
  cwd,
1471
1846
  home,
1472
1847
  loadImage,
1473
- inspectCall
1848
+ inspectCall,
1849
+ useDisclosure
1474
1850
  ]);
1851
+ const autoReviewDenied = (0, react.useMemo)(() => call.phase === "result" && toolRowModel(toolName, call.block).autoReviewDenial !== null, [toolName, call]);
1475
1852
  return (0, react_jsx_runtime.jsxs)("div", {
1476
1853
  className: ToolCallTree_module_css_default.callRow,
1477
1854
  "data-chat-anchor-key": `call:${callId}`,
1478
1855
  "data-chat-call-id": callId,
1479
- children: [renderSlot("tool.call.toolview", owner, {
1856
+ children: [autoReviewDenied ? (0, react_jsx_runtime.jsx)(GenericToolCard, {
1857
+ ...owner,
1858
+ t
1859
+ }) : renderSlot("tool.call.toolview", owner, {
1480
1860
  entryKey: toolName,
1861
+ hookContext,
1481
1862
  fallback: (0, react_jsx_runtime.jsx)(GenericToolCard, {
1482
1863
  ...owner,
1483
1864
  t
@@ -1485,28 +1866,33 @@ window.__ModuleLoader__.load({
1485
1866
  }), children]
1486
1867
  });
1487
1868
  });
1488
- const ToolCallBranch = (0, react.memo)(function ToolCallBranch({ renderSlot, block, cwd, home, openFile, inspectCall, loadImage, t }) {
1869
+ const ToolCallBranch = (0, react.memo)(function ToolCallBranch({ renderSlot, block, assistant, cwd, home, openFile, inspectCall, loadImage, useDisclosure, t }) {
1870
+ const call = (0, react.useMemo)(() => toolCallPhase(block), [block]);
1489
1871
  return (0, react_jsx_runtime.jsx)(ToolCall, {
1490
1872
  renderSlot,
1491
- callId: block.callId,
1492
- toolName: callName(block),
1493
- block,
1873
+ callId: call.block.callId,
1874
+ toolName: callName(call),
1875
+ call,
1876
+ assistant,
1494
1877
  openFile,
1495
1878
  cwd,
1496
1879
  home,
1497
1880
  inspectCall,
1881
+ useDisclosure,
1498
1882
  loadImage,
1499
1883
  t,
1500
- children: block.subCalls.length > 0 ? (0, react_jsx_runtime.jsx)("div", {
1884
+ children: call.phase !== "preparing" && call.block.subCalls.length > 0 ? (0, react_jsx_runtime.jsx)("div", {
1501
1885
  className: ToolCallTree_module_css_default.subCalls,
1502
1886
  "data-subcalls": true,
1503
- children: block.subCalls.map((child) => (0, react_jsx_runtime.jsx)(ToolCallBranch, {
1887
+ children: call.block.subCalls.map((child) => (0, react_jsx_runtime.jsx)(ToolCallBranch, {
1504
1888
  renderSlot,
1505
1889
  block: child,
1890
+ assistant,
1506
1891
  cwd,
1507
1892
  home,
1508
1893
  openFile,
1509
1894
  inspectCall,
1895
+ useDisclosure,
1510
1896
  loadImage,
1511
1897
  t
1512
1898
  }, child.callId))
@@ -1519,21 +1905,44 @@ window.__ModuleLoader__.load({
1519
1905
  * @param props - whole-Tool owner data and the Tool-owned child-slot share.
1520
1906
  * @returns the Tool call tree.
1521
1907
  */
1522
- function ToolCallTree({ renderSlot, node, cwd, openFile, inspectCall, loadImage, useHostInfo, t }) {
1908
+ function ToolCallTree({ renderSlot, node, cwd, openFile, inspectCall, loadImage, useDisclosure, useHostInfo, t }) {
1523
1909
  const home = useHostInfo((info) => info.home);
1524
- const block = node.data.root;
1910
+ const assistant = node.location.kind === "step" ? node.location.step.data.source("assistant-step") : void 0;
1525
1911
  return (0, react_jsx_runtime.jsx)(ToolCallBranch, {
1526
1912
  renderSlot,
1527
- block,
1913
+ block: node.data.root,
1914
+ assistant,
1528
1915
  cwd,
1529
1916
  home,
1530
1917
  openFile,
1531
1918
  inspectCall,
1919
+ useDisclosure,
1532
1920
  loadImage,
1533
1921
  t
1534
1922
  });
1535
1923
  }
1536
1924
  //#endregion
1925
+ //#region lib/types/client/tool/tool-call-arguments-partial.js
1926
+ /** Call-local argument subscription bound by the atomic Tool slot. */
1927
+ const subscribeEmpty = () => () => {};
1928
+ /**
1929
+ * Bind one call without subscribing until its component invokes the Hook.
1930
+ * @param _standard - framework-provided scope props.
1931
+ * @param context - the preparing call's Step source and identity.
1932
+ * @returns a Hook that reads only this call's raw argument prefix.
1933
+ */
1934
+ const bindToolCallArgumentsPartial = (_standard, context) => {
1935
+ const { assistant, callId } = context;
1936
+ const subscribe = assistant === void 0 ? subscribeEmpty : (listener) => assistant.subscribe(listener);
1937
+ const getSnapshot = () => {
1938
+ const block = assistant?.getSnapshot()?.blocks.find((candidate) => candidate.kind === "tool-call" && candidate.callId === callId);
1939
+ return block?.kind === "tool-call" ? block.argsRaw : "";
1940
+ };
1941
+ return function useToolCallArgumentsPartial() {
1942
+ return (0, react.useSyncExternalStore)(subscribe, getSnapshot);
1943
+ };
1944
+ };
1945
+ //#endregion
1537
1946
  //#region lib/types/client/locale.js
1538
1947
  /** Locale namespace supplied by the conversation owner to Tool renderers. */
1539
1948
  const CONVERSATION_NS = "conversation";
@@ -1628,10 +2037,10 @@ window.__ModuleLoader__.load({
1628
2037
  });
1629
2038
  }
1630
2039
  /** Summarizes a pending, answered, cancelled, or interrupted question set. */
1631
- function AskQuestionRow({ toolName, block, inspect, t }) {
2040
+ function AskQuestionRow({ toolName, block, inspect, useDisclosure, t }) {
1632
2041
  const model = toolRowModel(toolName, block);
1633
2042
  const code = "kind" in block ? block.error?.code : void 0;
1634
- const argsRaw = ("kind" in block ? block.call?.argsRaw : block.argsRaw) ?? "";
2043
+ const argsRaw = model.bodyRaw ?? "";
1635
2044
  let summary = model.summary;
1636
2045
  let state = model.state;
1637
2046
  let transcript = null;
@@ -1667,11 +2076,12 @@ window.__ModuleLoader__.load({
1667
2076
  }
1668
2077
  }
1669
2078
  return (0, react_jsx_runtime.jsx)(ToolRow, {
2079
+ useDisclosure,
1670
2080
  t,
1671
2081
  variant: model.variant,
1672
2082
  toolName,
1673
- icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconQuestionOutline14, {}),
1674
- title: t("ask.rowTitle"),
2083
+ icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconQuestionOutlineRegular, {}),
2084
+ title: t(model.titleKey),
1675
2085
  summary,
1676
2086
  bodyRaw: transcript === null ? model.bodyRaw : null,
1677
2087
  output: transcript === null ? model.output : null,
@@ -1693,8 +2103,27 @@ window.__ModuleLoader__.load({
1693
2103
  }
1694
2104
  };
1695
2105
  //#endregion
2106
+ //#region lib/types/client/tool/components/PreparingToolRow.js
2107
+ /**
2108
+ * Render a non-expandable tool prefix with an optional preparation summary.
2109
+ * @param props - tool prefix and locale.
2110
+ * @returns the preparation row.
2111
+ */
2112
+ function PreparingToolRow({ toolName, useDisclosure, icon, title, summary = "", t }) {
2113
+ return (0, react_jsx_runtime.jsx)(ToolRow, {
2114
+ useDisclosure,
2115
+ t,
2116
+ variant: classifyTool(toolName),
2117
+ toolName,
2118
+ icon,
2119
+ title,
2120
+ summary,
2121
+ state: "preparing"
2122
+ });
2123
+ }
2124
+ //#endregion
1696
2125
  //#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-tool/src/client/tool/toolviews/bash-sample.module.css.mjs
1697
- const css = ".CY-8Ka_card{flex-direction:column;display:flex}.CY-8Ka_terminal{--dsl-terminal-font:var(--dsw-font-markdown-code-block-small);--dsl-terminal-line-height:18px;--dsl-terminal-output-max-height:224px;border:.5px solid var(--dsw-alias-border-l1);margin:4px 0 4px 4px}.CY-8Ka_ioCard{border:.5px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-markdown-code-block);font:var(--dsw-font-markdown-code-block-small);border-radius:12px;flex-direction:column;margin:4px 0 4px 4px;display:flex}.CY-8Ka_ioSection{grid-template-columns:max-content 1fr;align-items:baseline;column-gap:14px;max-height:150px;padding:12px 16px;display:grid;overflow-y:auto}.CY-8Ka_ioSection::-webkit-scrollbar-thumb{background-clip:padding-box;border:2px solid #0000;border-radius:6px}.CY-8Ka_ioSection::-webkit-scrollbar-track{margin:6px 0}.CY-8Ka_ioLabel{color:var(--dsw-alias-label-caption);align-self:start;position:sticky;top:0}.CY-8Ka_ioDivider{background:var(--dsw-alias-border-l2);flex:none;height:.5px}.CY-8Ka_ioText{white-space:pre-wrap;word-break:break-word;min-width:0;color:var(--dsw-alias-label-secondary)}.CY-8Ka_ioText[data-error]{color:var(--dsw-alias-state-error-primary)}.CY-8Ka_root[data-expandable]{cursor:pointer}.CY-8Ka_root{height:calc(24px + var(--dsh-content-font-delta,0px));align-items:center;min-width:0;display:flex;position:relative;overflow:hidden}.CY-8Ka_root[data-state=running]:after{content:\"\";background:linear-gradient(90deg, transparent 0%, color-mix(in srgb, var(--dsw-alias-bg-base) 60%, transparent) 55%, transparent 100%);pointer-events:none;width:300px;animation:2.6s ease-out infinite CY-8Ka_dsh-bash-row-sweep;position:absolute;top:0;bottom:0;left:0}@keyframes CY-8Ka_dsh-bash-row-sweep{0%{left:-300px}90%,to{left:100%}}.CY-8Ka_leading{width:calc(16px + var(--dsh-content-font-delta,0px));height:calc(16px + var(--dsh-content-font-delta,0px));color:var(--dsw-alias-label-tertiary);flex:none;justify-content:center;align-items:center;margin-right:6px;display:inline-flex;position:relative}.CY-8Ka_leading svg:not([data-state]){width:calc(14px + var(--dsh-content-font-delta,0px));height:calc(14px + var(--dsh-content-font-delta,0px))}.CY-8Ka_chevron{color:var(--dsw-alias-label-secondary)}.CY-8Ka_iconIdle{opacity:1;transition:opacity .1s;display:inline-flex}.CY-8Ka_chevronHover{opacity:0;margin:auto;transition:opacity .1s;position:absolute;inset:0}.CY-8Ka_root:hover .CY-8Ka_iconIdle{opacity:0}.CY-8Ka_root:hover .CY-8Ka_chevronHover{opacity:1}.CY-8Ka_title{font-size:var(--dsh-content-font-size-secondary,13px);line-height:calc(24px + var(--dsh-content-font-delta,0px));color:var(--dsw-alias-label-secondary);flex:none}.CY-8Ka_sep{background:var(--dsw-alias-label-caption);border-radius:1px;flex:none;width:2px;height:2px;margin:0 8px}.CY-8Ka_summary{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:var(--dsh-content-font-size-secondary,13px);line-height:calc(24px + var(--dsh-content-font-delta,0px));color:var(--dsw-alias-label-tertiary);flex:auto;overflow:hidden}.CY-8Ka_errorSummary{color:var(--dsw-alias-state-error-primary)}.CY-8Ka_bodyWrap{flex-direction:column;display:flex}.CY-8Ka_inspectButton{border:.5px solid var(--dsw-alias-border-l4);corner-shape:round;background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-secondary);cursor:pointer;opacity:0;border-radius:999px;align-self:flex-start;align-items:center;gap:4px;margin:4px 0 2px 4px;padding:2px 8px;font-size:11px;line-height:16px;transition:opacity .1s;display:inline-flex}.CY-8Ka_card:hover .CY-8Ka_inspectButton,.CY-8Ka_inspectButton:focus-visible{opacity:1}.CY-8Ka_inspectButton:hover{background:var(--dsw-alias-interactive-bg-hover-solid);color:var(--dsw-alias-label-primary)}.CY-8Ka_visuallyHidden{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}";
2126
+ const css = ".CY-8Ka_card{flex-direction:column;display:flex}.CY-8Ka_terminal{--dsl-terminal-font:var(--dsw-font-markdown-code-block-small);--dsl-terminal-line-height:18px;--dsl-terminal-output-max-height:224px;border:.5px solid var(--dsw-alias-border-l1);margin:4px 0 4px 4px}.CY-8Ka_ioCard{border:.5px solid var(--dsw-alias-border-l1);border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-markdown-code-block);font:var(--dsw-font-markdown-code-block-small);flex-direction:column;margin:4px 0 4px 4px;display:flex}.CY-8Ka_ioSection{grid-template-columns:max-content 1fr;align-items:baseline;column-gap:14px;max-height:150px;padding:12px 16px;display:grid;overflow-y:auto}.CY-8Ka_ioSection::-webkit-scrollbar-thumb{border-radius:var(--dsw-radius-sm);background-clip:padding-box;border:2px solid #0000}.CY-8Ka_ioSection::-webkit-scrollbar-track{margin:6px 0}.CY-8Ka_ioLabel{color:var(--dsw-alias-label-caption);align-self:start;position:sticky;top:0}.CY-8Ka_ioDivider{background:var(--dsw-alias-border-l2);flex:none;height:.5px}.CY-8Ka_ioText{white-space:pre-wrap;word-break:break-word;min-width:0;color:var(--dsw-alias-label-secondary)}.CY-8Ka_ioText[data-error]{color:var(--dsw-alias-state-error-primary)}.CY-8Ka_root[data-expandable]{cursor:pointer}.CY-8Ka_root{height:calc(24px + var(--dsh-content-font-delta,0px));align-items:center;min-width:0;display:flex}.CY-8Ka_leading{width:calc(16px + var(--dsh-content-font-delta,0px));height:calc(16px + var(--dsh-content-font-delta,0px));color:var(--dsw-alias-label-tertiary);flex:none;justify-content:center;align-items:center;margin-right:6px;display:inline-flex;position:relative}.CY-8Ka_leading svg:not([data-state]){width:calc(14px + var(--dsh-content-font-delta,0px));height:calc(14px + var(--dsh-content-font-delta,0px))}.CY-8Ka_chevron{color:var(--dsw-alias-label-secondary)}.CY-8Ka_iconIdle{opacity:1;transition:opacity .1s;display:inline-flex}.CY-8Ka_chevronHover{opacity:0;margin:auto;transition:opacity .1s;position:absolute;inset:0}.CY-8Ka_root:hover .CY-8Ka_iconIdle{opacity:0}.CY-8Ka_root:hover .CY-8Ka_chevronHover{opacity:1}.CY-8Ka_title{font-size:var(--dsh-content-font-size-secondary,13px);line-height:calc(24px + var(--dsh-content-font-delta,0px));color:var(--dsw-alias-label-secondary);flex:none;transition:color .1s}.CY-8Ka_sep{background:var(--dsw-alias-label-caption);border-radius:1px;flex:none;width:2px;height:2px;margin:0 8px}.CY-8Ka_summary{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:var(--dsh-content-font-size-secondary,13px);line-height:calc(24px + var(--dsh-content-font-delta,0px));color:var(--dsw-alias-label-tertiary);flex:auto;transition:color .1s;overflow:hidden}.CY-8Ka_root:hover .CY-8Ka_title,.CY-8Ka_root:hover .CY-8Ka_summary:not(.CY-8Ka_errorSummary):not(.CY-8Ka_stoppedSummary){color:var(--dsw-alias-label-primary)}.CY-8Ka_errorSummary{color:var(--dsw-alias-state-error-primary)}.CY-8Ka_stoppedSummary{color:var(--dsw-alias-state-warn-label)}.CY-8Ka_bodyWrap{flex-direction:column;display:flex}.CY-8Ka_inspectButton{border:.5px solid var(--dsw-alias-border-l4);corner-shape:round;background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-secondary);cursor:pointer;opacity:0;border-radius:999px;align-self:flex-start;align-items:center;gap:4px;margin:4px 0 2px 4px;padding:2px 8px;font-size:11px;line-height:16px;transition:opacity .1s;display:inline-flex}.CY-8Ka_card:hover .CY-8Ka_inspectButton,.CY-8Ka_inspectButton:focus-visible{opacity:1}.CY-8Ka_inspectButton:hover{background:var(--dsw-alias-interactive-bg-hover-solid);color:var(--dsw-alias-label-primary)}.CY-8Ka_visuallyHidden{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}";
1698
2127
  const tagId = "@deepseek-ai/dsh-client-ui-tool/bash-sample.module.css";
1699
2128
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
1700
2129
  const tag = document.createElement("style");
@@ -1708,7 +2137,6 @@ window.__ModuleLoader__.load({
1708
2137
  "card": "CY-8Ka_card",
1709
2138
  "chevron": "CY-8Ka_chevron",
1710
2139
  "chevronHover": "CY-8Ka_chevronHover",
1711
- "dsh-bash-row-sweep": "CY-8Ka_dsh-bash-row-sweep",
1712
2140
  "errorSummary": "CY-8Ka_errorSummary",
1713
2141
  "iconIdle": "CY-8Ka_iconIdle",
1714
2142
  "inspectButton": "CY-8Ka_inspectButton",
@@ -1720,6 +2148,7 @@ window.__ModuleLoader__.load({
1720
2148
  "leading": "CY-8Ka_leading",
1721
2149
  "root": "CY-8Ka_root",
1722
2150
  "sep": "CY-8Ka_sep",
2151
+ "stoppedSummary": "CY-8Ka_stoppedSummary",
1723
2152
  "summary": "CY-8Ka_summary",
1724
2153
  "terminal": "CY-8Ka_terminal",
1725
2154
  "title": "CY-8Ka_title",
@@ -1727,14 +2156,8 @@ window.__ModuleLoader__.load({
1727
2156
  };
1728
2157
  //#endregion
1729
2158
  //#region lib/types/client/tool/toolviews/bash-sample.js
1730
- function leadingFor(state) {
1731
- switch (state) {
1732
- case "error": return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, { state: "error" });
1733
- case "stopped": return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, { state: "warning" });
1734
- default: return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconApiOutline14, { size: 14 });
1735
- }
1736
- }
1737
- /** Visually hidden status — StateDot is aria-hidden; AT needs a text label. */
2159
+ const BASH_ICON = (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconApiOutlineRegular, { size: 14 });
2160
+ /** Visually hidden status for the color-only running sweep and error tone. */
1738
2161
  function stateStatus(state, t) {
1739
2162
  switch (state) {
1740
2163
  case "running": return t("bash.running");
@@ -1743,14 +2166,28 @@ window.__ModuleLoader__.load({
1743
2166
  default: return null;
1744
2167
  }
1745
2168
  }
1746
- /** Renders expandable Bash output with an accessible lifecycle label. */
1747
- function BashRow({ toolName, block, sessionId, useSessions, inspect, t }) {
1748
- const model = toolRowModel(toolName, block);
1749
- const terminalModel = terminalCardModel(block, useSessions((list) => list.byId[sessionId]?.cwd));
1750
- const terminal = terminalModel === null ? null : localizeTerminalCardModel(terminalModel, t);
2169
+ /**
2170
+ * Render expandable Bash output with an accessible lifecycle label.
2171
+ * @param props - tool call, Session sources, locale, and inspection callback.
2172
+ * @returns the Bash output row.
2173
+ */
2174
+ const BashRow = (0, react.memo)(function BashRow(props) {
2175
+ if (props.phase === "preparing") return (0, react_jsx_runtime.jsx)(PreparingToolRow, {
2176
+ ...props,
2177
+ icon: BASH_ICON,
2178
+ title: props.t(toolTitleKey(props.toolName))
2179
+ });
2180
+ return (0, react_jsx_runtime.jsx)(StartedBashRow, { ...props });
2181
+ });
2182
+ const StartedBashRow = (0, react.memo)(function StartedBashRow({ toolName, block, sessionId, useSessions, inspect, useDisclosure, t }) {
2183
+ const model = (0, react.useMemo)(() => toolRowModel(toolName, block), [toolName, block]);
2184
+ const cwd = useSessions((list) => list.byId[sessionId]?.cwd);
2185
+ const terminalModel = (0, react.useMemo)(() => terminalCardModel(block, cwd), [block, cwd]);
2186
+ const terminal = (0, react.useMemo)(() => terminalModel === null ? null : localizeTerminalCardModel(terminalModel, t), [terminalModel, t]);
2187
+ const labels = (0, react.useMemo)(() => terminalBlockLabels(t), [t]);
1751
2188
  const state = model.state === "ok" && terminalModel !== null && terminalFailed(terminalModel) ? "error" : model.state;
1752
2189
  const status = stateStatus(state, t);
1753
- const [expanded, setExpanded] = (0, react.useState)(false);
2190
+ const { expanded, toggle: toggleExpand } = useDisclosure();
1754
2191
  const genericBody = terminal === null && (model.state === "error" || isSettledPersistentShellCall(block) || isSpilledShellCall(block)) && (model.bodyRaw !== null || model.output !== null);
1755
2192
  const expandable = terminal !== null || genericBody;
1756
2193
  const open = expanded && expandable;
@@ -1760,19 +2197,18 @@ window.__ModuleLoader__.load({
1760
2197
  model.variant,
1761
2198
  open
1762
2199
  ]);
1763
- const failureLine = model.state === "error" ? model.errorSummary : null;
1764
- const toggleExpand = () => {
1765
- setExpanded((v) => !v);
1766
- };
1767
- const toggleFromKeyboard = (event) => {
2200
+ const normalSummary = terminal?.description ?? model.summary;
2201
+ const settlementLine = state === "error" ? model.errorSummary ?? normalSummary : state === "stopped" ? t("bash.stopped") : null;
2202
+ const running = state === "running";
2203
+ const toggleFromKeyboard = (0, react.useCallback)((event) => {
1768
2204
  if (!expandable || event.key !== "Enter" && event.key !== " ") return;
1769
2205
  event.preventDefault();
1770
2206
  toggleExpand();
1771
- };
1772
- const leading = open ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutline14, { className: bash_sample_module_css_default.chevron }) : expandable ? (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)("span", {
2207
+ }, [expandable, toggleExpand]);
2208
+ const leading = open ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronUpOutlineRegular, { className: bash_sample_module_css_default.chevron }) : expandable ? (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)("span", {
1773
2209
  className: bash_sample_module_css_default.iconIdle,
1774
- children: leadingFor(state)
1775
- }), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutline14, { className: clsx(bash_sample_module_css_default.chevron, bash_sample_module_css_default.chevronHover) })] }) : leadingFor(state);
2210
+ children: BASH_ICON
2211
+ }), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular, { className: clsx(bash_sample_module_css_default.chevron, bash_sample_module_css_default.chevronHover) })] }) : BASH_ICON;
1776
2212
  return (0, react_jsx_runtime.jsxs)("div", {
1777
2213
  className: bash_sample_module_css_default.card,
1778
2214
  children: [(0, react_jsx_runtime.jsxs)("div", {
@@ -1795,17 +2231,23 @@ window.__ModuleLoader__.load({
1795
2231
  className: bash_sample_module_css_default.visuallyHidden,
1796
2232
  children: status
1797
2233
  }),
1798
- (0, react_jsx_runtime.jsx)("span", {
1799
- className: bash_sample_module_css_default.title,
1800
- children: t(model.titleKey)
1801
- }),
1802
- (0, react_jsx_runtime.jsx)("span", {
1803
- className: bash_sample_module_css_default.sep,
1804
- "aria-hidden": true
1805
- }),
1806
- (0, react_jsx_runtime.jsx)("span", {
1807
- className: clsx(bash_sample_module_css_default.summary, failureLine !== null && bash_sample_module_css_default.errorSummary),
1808
- children: failureLine ?? terminal?.description ?? model.summary
2234
+ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.TextShimmer, {
2235
+ active: running,
2236
+ children: [
2237
+ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.TextShimmer, {
2238
+ className: bash_sample_module_css_default.title,
2239
+ children: t(model.titleKey)
2240
+ }),
2241
+ (0, react_jsx_runtime.jsx)("span", {
2242
+ className: bash_sample_module_css_default.sep,
2243
+ "data-shimmer-decoration": true,
2244
+ "aria-hidden": true
2245
+ }),
2246
+ (0, react_jsx_runtime.jsx)("span", {
2247
+ className: clsx(bash_sample_module_css_default.summary, state === "error" && bash_sample_module_css_default.errorSummary, state === "stopped" && bash_sample_module_css_default.stoppedSummary),
2248
+ children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.TextShimmer, { children: settlementLine ?? normalSummary })
2249
+ })
2250
+ ]
1809
2251
  })
1810
2252
  ]
1811
2253
  }), open && (0, react_jsx_runtime.jsxs)("div", {
@@ -1813,7 +2255,7 @@ window.__ModuleLoader__.load({
1813
2255
  children: [terminal !== null ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.TerminalBlock, {
1814
2256
  ...terminal.card,
1815
2257
  maxLines: Infinity,
1816
- labels: terminalBlockLabels(t),
2258
+ labels,
1817
2259
  className: bash_sample_module_css_default.terminal
1818
2260
  }) : (0, react_jsx_runtime.jsxs)("div", {
1819
2261
  className: bash_sample_module_css_default.ioCard,
@@ -1848,11 +2290,11 @@ window.__ModuleLoader__.load({
1848
2290
  type: "button",
1849
2291
  className: bash_sample_module_css_default.inspectButton,
1850
2292
  onClick: inspect,
1851
- children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconInspectOutline12, {}), t("row.inspect")]
2293
+ children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconInspectOutlineRegular, {}), t("row.inspect")]
1852
2294
  })]
1853
2295
  })]
1854
2296
  });
1855
- }
2297
+ });
1856
2298
  /** Registers the standalone Bash conversation-row sample. */
1857
2299
  const bashToolviewSample = {
1858
2300
  name: "bash-toolview-sample",
@@ -1867,17 +2309,33 @@ window.__ModuleLoader__.load({
1867
2309
  };
1868
2310
  //#endregion
1869
2311
  //#region lib/types/client/tool/toolviews/file-mutation-row.js
2312
+ const FILE_MUTATION_ICON = (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconEditOutlineRegular, { size: 14 });
1870
2313
  /**
1871
2314
  * Lets users expand an applied file diff and open the reported path.
1872
2315
  */
1873
- function FileMutationRow({ toolName, block, cwd, home, openFile, inspect, t }) {
2316
+ function FileMutationRow(props) {
2317
+ return props.phase === "preparing" ? (0, react_jsx_runtime.jsx)(PreparingFileMutationRow, { ...props }) : (0, react_jsx_runtime.jsx)(StartedFileMutationRow, { ...props });
2318
+ }
2319
+ function PreparingFileMutationRow({ toolName, useDisclosure, useToolCallArgumentsPartial, t }) {
2320
+ const raw = useToolCallArgumentsPartial();
2321
+ return (0, react_jsx_runtime.jsx)(PreparingToolRow, {
2322
+ toolName,
2323
+ useDisclosure,
2324
+ icon: FILE_MUTATION_ICON,
2325
+ title: t(toolTitleKey(toolName)),
2326
+ t,
2327
+ summary: t("tool.preparing.content", { kilobytes: Math.ceil(raw.length / 1024) })
2328
+ });
2329
+ }
2330
+ function StartedFileMutationRow({ toolName, block, cwd, home, openFile, inspect, useDisclosure, t }) {
1874
2331
  const model = toolRowModel(toolName, block, cwd, home);
1875
2332
  const diff = diffCardModel(block);
1876
2333
  return (0, react_jsx_runtime.jsx)(ToolRow, {
2334
+ useDisclosure,
1877
2335
  t,
1878
2336
  variant: model.variant,
1879
2337
  toolName,
1880
- icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconEditOutline16, { size: 14 }),
2338
+ icon: FILE_MUTATION_ICON,
1881
2339
  title: t(model.titleKey),
1882
2340
  summary: model.summary,
1883
2341
  output: model.output,
@@ -1917,13 +2375,14 @@ window.__ModuleLoader__.load({
1917
2375
  * @param card - the card props this row owns.
1918
2376
  * @returns the assembled ToolRow.
1919
2377
  */
1920
- function readFamilyRow({ toolName, block, cwd, home, openFile, inspect, t }, card) {
2378
+ function readFamilyRow({ toolName, block, cwd, home, openFile, inspect, useDisclosure, t }, card) {
1921
2379
  const model = toolRowModel(toolName, block, cwd, home);
1922
2380
  return (0, react_jsx_runtime.jsx)(ToolRow, {
2381
+ useDisclosure,
1923
2382
  t,
1924
2383
  variant: model.variant,
1925
2384
  toolName,
1926
- icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBrowseOutline16, { size: 14 }),
2385
+ icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBrowseOutlineRegular, { size: 14 }),
1927
2386
  title: t(model.titleKey),
1928
2387
  summary: model.summary,
1929
2388
  bodyRaw: null,
@@ -2176,14 +2635,15 @@ window.__ModuleLoader__.load({
2176
2635
  glob: "tool.title.glob"
2177
2636
  };
2178
2637
  /** Lets users expand grep or glob results and recover capped searches. */
2179
- function SearchRow({ toolName, block, inspect, t }) {
2638
+ function SearchRow({ toolName, block, inspect, useDisclosure, t }) {
2180
2639
  const model = toolRowModel(toolName, block);
2181
2640
  const search = searchCardModel(block);
2182
2641
  return (0, react_jsx_runtime.jsx)(ToolRow, {
2642
+ useDisclosure,
2183
2643
  t,
2184
2644
  variant: model.variant,
2185
2645
  toolName,
2186
- icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconSearchOutline16, { size: 14 }),
2646
+ icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconSearchOutlineRegular, { size: 14 }),
2187
2647
  title: t(toolName === "grep" ? SEARCH_TITLE_KEYS.grep : toolName === "glob" ? SEARCH_TITLE_KEYS.glob : model.titleKey),
2188
2648
  summary: model.summary,
2189
2649
  output: model.output,
@@ -2213,26 +2673,1487 @@ window.__ModuleLoader__.load({
2213
2673
  }
2214
2674
  };
2215
2675
  //#endregion
2216
- //#region lib/types/client/tool/toolviews/plan-summary.js
2676
+ //#region lib/types/client/tool/models/detail-model-shared.js
2217
2677
  /**
2218
- * Pure plan derivation for the todo_write row's one-line summary. Several items
2219
- * may be `in_progress` at once — parallel work runs concurrent tasks, so a
2220
- * summary built from one active item would silently drop the rest. The plan
2221
- * strip header derives its own counts inline and shares nothing with this, so
2222
- * this stays inside the toolviews domain rather than in `contract/` (the
2223
- * inter-domain face).
2224
- * @module
2678
+ * Narrow parsed JSON to an object record.
2679
+ * @param value - Parsed result or argument value.
2680
+ * @returns Whether named fields can be read.
2225
2681
  */
2682
+ function detailRecord(value) {
2683
+ return typeof value === "object" && value !== null && !Array.isArray(value);
2684
+ }
2226
2685
  /**
2227
- * Derive the counts and the active summary from a whole-list snapshot. It names
2228
- * the first `in_progress` item and counts the remaining active ones, so a
2229
- * parallel plan reports how many tasks are running rather than naming one and
2230
- * hiding the others. `activeContent` is null when nothing is in progress, or
2231
- * when the first active item's content is missing, mistyped, or blank once
2232
- * trimmed — the tool's own rule for usable content, applied here because a
2233
- * rejected call keeps its args verbatim. The row then renders the counts alone
2234
- * rather than falling back to the generic tool summary: the counts are already
2235
- * known to be good, and the active-item clause is the only part an unusable
2686
+ * Check a recorded string field that must contain visible text.
2687
+ * @param value - Parsed field value.
2688
+ * @returns Whether the field is a non-empty string after trimming.
2689
+ */
2690
+ function nonempty(value) {
2691
+ return typeof value === "string" && value.trim() !== "";
2692
+ }
2693
+ /**
2694
+ * Decode an entire JSON result without accepting a partial prefix.
2695
+ * @param text - Recorded text.
2696
+ * @returns Parsed JSON, or undefined for non-JSON output.
2697
+ */
2698
+ function detailJson(text) {
2699
+ try {
2700
+ return JSON.parse(text);
2701
+ } catch {
2702
+ return;
2703
+ }
2704
+ }
2705
+ const STATUS_KEYS = {
2706
+ running: "detail.status.running",
2707
+ idle: "detail.status.idle",
2708
+ ready: "detail.status.ready",
2709
+ inactive: "detail.status.inactive",
2710
+ provisioning: "detail.status.provisioning",
2711
+ failed: "detail.status.failed",
2712
+ error: "detail.status.failed",
2713
+ completed: "detail.status.completed",
2714
+ complete: "detail.status.completed",
2715
+ done: "detail.status.completed",
2716
+ pending: "detail.todo.pending",
2717
+ in_progress: "detail.todo.in_progress",
2718
+ deleted: "detail.status.deleted",
2719
+ killed: "detail.status.killed",
2720
+ blocked: "detail.goal.blocked",
2721
+ accepted: "detail.status.accepted",
2722
+ queued: "detail.status.queued"
2723
+ };
2724
+ /**
2725
+ * Give a recorded status its localized name and a static semantic color.
2726
+ * @param status - Result status, retained verbatim when the vocabulary is unknown.
2727
+ * @param t - Conversation translator.
2728
+ * @returns A badge that does not imply a live subscription.
2729
+ */
2730
+ function detailBadge(status, t) {
2731
+ const key = Object.hasOwn(STATUS_KEYS, status) ? STATUS_KEYS[status] : void 0;
2732
+ const tone = [
2733
+ "completed",
2734
+ "complete",
2735
+ "done",
2736
+ "accepted"
2737
+ ].includes(status) ? "success" : ["failed", "error"].includes(status) ? "error" : [
2738
+ "blocked",
2739
+ "killed",
2740
+ "pending",
2741
+ "queued",
2742
+ "inactive"
2743
+ ].includes(status) ? "warning" : [
2744
+ "running",
2745
+ "in_progress",
2746
+ "provisioning"
2747
+ ].includes(status) ? "info" : "neutral";
2748
+ return {
2749
+ label: key === void 0 ? status : t(key),
2750
+ tone
2751
+ };
2752
+ }
2753
+ const FIELD_KEYS = {
2754
+ id: "detail.field.id",
2755
+ revision: "detail.field.revision",
2756
+ platform: "detail.field.platform",
2757
+ provider: "detail.field.provider",
2758
+ model: "detail.field.model",
2759
+ role: "detail.field.role",
2760
+ context: "detail.field.context",
2761
+ ownerName: "detail.field.owner",
2762
+ ready: "detail.field.ready",
2763
+ blockedBy: "detail.field.dependencies",
2764
+ writeScopes: "detail.field.writeScopes",
2765
+ writeScopeWarnings: "detail.field.warnings",
2766
+ diagnostics: "detail.field.diagnostics",
2767
+ methods: "detail.field.methods",
2768
+ inputSchema: "detail.field.inputSchema",
2769
+ outputSchema: "detail.field.outputSchema",
2770
+ currentPackageId: "detail.field.currentPackage",
2771
+ nextPackageId: "detail.field.nextPackage",
2772
+ latestRun: "detail.field.latestRun",
2773
+ packages: "detail.field.packages",
2774
+ registrations: "detail.field.registrations",
2775
+ props: "detail.field.props",
2776
+ data: "detail.field.data",
2777
+ source: "detail.field.source",
2778
+ arguments: "row.input",
2779
+ content: "detail.field.content",
2780
+ message: "detail.field.message",
2781
+ messageId: "detail.field.messageId",
2782
+ status: "detail.state",
2783
+ root: "detail.field.root",
2784
+ pid: "detail.field.pid",
2785
+ type: "detail.field.type",
2786
+ time: "detail.field.time",
2787
+ seq: "detail.field.seq",
2788
+ turn: "detail.field.turn",
2789
+ step: "detail.field.step",
2790
+ callId: "detail.field.callId",
2791
+ agentsStarted: "detail.field.agents",
2792
+ output: "row.output",
2793
+ result: "detail.field.result"
2794
+ };
2795
+ /**
2796
+ * Name a known tool field while preserving extension-owned field names.
2797
+ * @param key - Recorded JSON property name.
2798
+ * @param t - Conversation translator.
2799
+ * @returns Localized known label or the original property name.
2800
+ */
2801
+ function detailLabel(key, t) {
2802
+ const label = Object.hasOwn(FIELD_KEYS, key) ? FIELD_KEYS[key] : void 0;
2803
+ return label === void 0 ? key : t(label);
2804
+ }
2805
+ function scalar(value, t) {
2806
+ if (value === null) return t("detail.none");
2807
+ if (typeof value === "boolean") return t(value ? "detail.yes" : "detail.no");
2808
+ return typeof value === "string" ? value : JSON.stringify(value);
2809
+ }
2810
+ const INSPECTION_KEY_ORDER = [
2811
+ "subject",
2812
+ "title",
2813
+ "name",
2814
+ "pluginId",
2815
+ "packageId",
2816
+ "id",
2817
+ "summary"
2818
+ ];
2819
+ const INSPECTION_DETAIL_KEYS = ["description", "purpose"];
2820
+ const MAX_INSPECTION_ITEMS = 40;
2821
+ /**
2822
+ * Project open inspection records into readable fields and named disclosures.
2823
+ * @param value - Parsed JSON, including provider-owned extension fields.
2824
+ * @param t - Conversation translator.
2825
+ * @param depth - Current disclosure depth; deeper records remain available as code.
2826
+ * @returns Entity rows preserving the order of visible values.
2827
+ */
2828
+ function inspectionItems(value, t, depth = 0) {
2829
+ if (depth > 4 && value !== null && typeof value === "object") return [{
2830
+ code: {
2831
+ text: JSON.stringify(value, null, 2),
2832
+ language: "json"
2833
+ },
2834
+ fields: []
2835
+ }];
2836
+ if (Array.isArray(value)) {
2837
+ const items = value.slice(0, MAX_INSPECTION_ITEMS).flatMap((entry) => inspectionItems(entry, t, depth + 1));
2838
+ if (value.length > MAX_INSPECTION_ITEMS) items.push({
2839
+ description: t("detail.moreInInspect", { count: value.length - MAX_INSPECTION_ITEMS }),
2840
+ fields: []
2841
+ });
2842
+ return items.length === 0 ? [{
2843
+ description: t("detail.empty"),
2844
+ fields: []
2845
+ }] : items;
2846
+ }
2847
+ if (!detailRecord(value)) return [{
2848
+ description: scalar(value, t),
2849
+ fields: []
2850
+ }];
2851
+ const titleKey = INSPECTION_KEY_ORDER.find((key) => typeof value[key] === "string" && value[key] !== "");
2852
+ const descriptionKey = INSPECTION_DETAIL_KEYS.find((key) => typeof value[key] === "string" && value[key] !== "");
2853
+ const title = titleKey === void 0 ? void 0 : String(value[titleKey]);
2854
+ const fields = [];
2855
+ const groups = [];
2856
+ for (const [key, field] of Object.entries(value)) {
2857
+ if (key === titleKey || key === descriptionKey || key === "status" && typeof field === "string") continue;
2858
+ if (key === "inputSchema" || key === "outputSchema") {
2859
+ groups.push({
2860
+ label: detailLabel(key, t),
2861
+ items: [{
2862
+ fields: [],
2863
+ code: {
2864
+ text: JSON.stringify(field, null, 2),
2865
+ language: "json"
2866
+ }
2867
+ }]
2868
+ });
2869
+ continue;
2870
+ }
2871
+ if (Array.isArray(field) && field.length === 0) continue;
2872
+ if (key === "arguments" && typeof field === "string") {
2873
+ const args = detailJson(field);
2874
+ if (detailRecord(args)) {
2875
+ groups.push({
2876
+ label: detailLabel(key, t),
2877
+ items: inspectionItems(args, t, depth + 1)
2878
+ });
2879
+ continue;
2880
+ }
2881
+ }
2882
+ if (field !== null && typeof field === "object") groups.push({
2883
+ label: detailLabel(key, t),
2884
+ items: inspectionItems(field, t, depth + 1)
2885
+ });
2886
+ else fields.push({
2887
+ label: detailLabel(key, t),
2888
+ value: scalar(field, t)
2889
+ });
2890
+ }
2891
+ return [{
2892
+ ...title === void 0 && typeof value.status !== "string" ? {} : { title: title ?? t("detail.field.result") },
2893
+ ...descriptionKey === void 0 ? {} : { description: String(value[descriptionKey]) },
2894
+ ...typeof value.status === "string" ? { badge: detailBadge(value.status, t) } : {},
2895
+ fields,
2896
+ ...groups.length === 0 ? {} : { groups }
2897
+ }];
2898
+ }
2899
+ /**
2900
+ * Give a result list consistent historical context and empty-state copy.
2901
+ * @param items - Recorded result rows.
2902
+ * @param summary - Collapsed-row summary.
2903
+ * @param t - Conversation translator.
2904
+ * @returns A complete compact detail model.
2905
+ */
2906
+ function detailList(items, summary, t) {
2907
+ return {
2908
+ items,
2909
+ summary,
2910
+ caption: t("detail.recordedResult"),
2911
+ empty: t("detail.empty")
2912
+ };
2913
+ }
2914
+ //#endregion
2915
+ //#region lib/types/client/tool/models/control-details-model.js
2916
+ const OUTPUT_TRUNCATED = "\n[output truncated]";
2917
+ function arg(args, key) {
2918
+ const value = args[key];
2919
+ return typeof value === "string" ? value : "";
2920
+ }
2921
+ function receipt(title, badge, t, fields = [], description) {
2922
+ return {
2923
+ ...detailList([{
2924
+ title,
2925
+ badge,
2926
+ fields,
2927
+ ...description === void 0 ? {} : { description }
2928
+ }], `${title} · ${badge.label}`, t),
2929
+ expandedSummary: title
2930
+ };
2931
+ }
2932
+ function agentList(text, json, t) {
2933
+ if (Array.isArray(json)) return detailList(inspectionItems(json, t), t("detail.agents.count", { count: json.length }), t);
2934
+ if (text === "(no subagents)") return detailList([], t("detail.agents.count", { count: 0 }), t);
2935
+ const items = [];
2936
+ for (const line of text.split("\n")) {
2937
+ const match = /^(\S+) \[([^\]]+)\](?: parent=(\S+) depth=(\d+))?(?: — (.*))?$/u.exec(line);
2938
+ if (match === null) return null;
2939
+ const [, id, state, parent, depth, title] = match;
2940
+ if (id === void 0 || state === void 0) return null;
2941
+ items.push({
2942
+ title: title ?? id,
2943
+ ...title === void 0 ? {} : { subtitle: id },
2944
+ badge: detailBadge(state, t),
2945
+ fields: parent === void 0 ? [] : [{
2946
+ label: t("detail.field.parent"),
2947
+ value: parent
2948
+ }, {
2949
+ label: t("detail.field.depth"),
2950
+ value: depth ?? ""
2951
+ }]
2952
+ });
2953
+ }
2954
+ return detailList(items, t("detail.agents.count", { count: items.length }), t);
2955
+ }
2956
+ function jobList(text, t) {
2957
+ if (text === "(no background jobs)") return detailList([], t("detail.jobs.count", { count: 0 }), t);
2958
+ const items = [];
2959
+ for (const line of text.split("\n")) {
2960
+ const match = /^(\S+) \[([^\]]+)\] (\S+) — (.*)$/u.exec(line);
2961
+ if (match === null) return null;
2962
+ const [, id, kind, state, title] = match;
2963
+ if (id === void 0 || kind === void 0 || state === void 0 || title === void 0) return null;
2964
+ items.push({
2965
+ title,
2966
+ subtitle: id,
2967
+ badge: detailBadge(state, t),
2968
+ fields: [{
2969
+ label: t("detail.field.type"),
2970
+ value: kind
2971
+ }]
2972
+ });
2973
+ }
2974
+ return detailList(items, t("detail.jobs.count", { count: items.length }), t);
2975
+ }
2976
+ function terminalList(text, t) {
2977
+ if (text === "(no terminal sessions)") return detailList([], t("detail.terminals.count", { count: 0 }), t);
2978
+ const items = [];
2979
+ for (const line of text.split("\n")) {
2980
+ const match = /^(\S+)(?: \((.*?)\))? \[([^\]]+)\] (running|exited code=(\S+) signal=(\S+))(?: pid=(\d+))?$/u.exec(line);
2981
+ if (match === null) return null;
2982
+ const [, id, name, type, state, exitCode, signal, pid] = match;
2983
+ if (id === void 0 || type === void 0 || state === void 0) return null;
2984
+ const fields = [{
2985
+ label: t("detail.field.type"),
2986
+ value: type
2987
+ }];
2988
+ if (pid !== void 0) fields.push({
2989
+ label: t("detail.field.pid"),
2990
+ value: pid
2991
+ });
2992
+ if (exitCode !== void 0) fields.push({
2993
+ label: t("detail.field.exitCode"),
2994
+ value: exitCode
2995
+ });
2996
+ if (signal !== void 0 && signal !== "null") fields.push({
2997
+ label: t("detail.field.signal"),
2998
+ value: signal
2999
+ });
3000
+ items.push({
3001
+ title: name ?? id,
3002
+ ...name === void 0 ? {} : { subtitle: id },
3003
+ badge: state === "running" ? detailBadge("running", t) : {
3004
+ label: t("detail.status.exited"),
3005
+ tone: exitCode === "0" ? "success" : "neutral"
3006
+ },
3007
+ fields
3008
+ });
3009
+ }
3010
+ return detailList(items, t("detail.terminals.count", { count: items.length }), t);
3011
+ }
3012
+ function lspDetails(args, text, t) {
3013
+ const file = arg(args, "file_path");
3014
+ const operation = arg(args, "operation");
3015
+ if (file === "" || typeof args.line !== "number" || typeof args.character !== "number") return null;
3016
+ const source = `${file}:${args.line}:${args.character}`;
3017
+ if (operation === "hover") return detailList([{
3018
+ title: source,
3019
+ location: {
3020
+ path: file,
3021
+ line: args.line
3022
+ },
3023
+ markdown: text,
3024
+ fields: []
3025
+ }], source, t);
3026
+ if (text === "No results.") return detailList([], t("detail.locations.count", { count: 0 }), t);
3027
+ const items = [];
3028
+ for (const line of text.split("\n")) {
3029
+ if (line.startsWith("… ")) {
3030
+ items.push({
3031
+ description: line,
3032
+ fields: []
3033
+ });
3034
+ continue;
3035
+ }
3036
+ const match = /^(.*):(\d+):(\d+)$/u.exec(line);
3037
+ if (match === null) return null;
3038
+ const [, path, row, column] = match;
3039
+ if (path === void 0 || row === void 0 || column === void 0) return null;
3040
+ const isUri = /^[a-z][a-z\d+.-]*:/iu.test(path) && !/^[a-z]:[\\/]/iu.test(path);
3041
+ items.push({
3042
+ title: path,
3043
+ subtitle: t("detail.location", {
3044
+ line: row,
3045
+ column
3046
+ }),
3047
+ fields: [],
3048
+ ...isUri ? {} : { location: {
3049
+ path,
3050
+ line: Number(row)
3051
+ } }
3052
+ });
3053
+ }
3054
+ const count = items.filter((item) => item.title !== void 0).length;
3055
+ return detailList(items, `${file} · ${t("detail.locations.count", { count })}`, t);
3056
+ }
3057
+ /**
3058
+ * Derive entity lists and operation receipts from supported recorded output formats.
3059
+ * @param name - Wire tool name, including Team-scoped aliases.
3060
+ * @param args - Parsed recorded arguments.
3061
+ * @param text - Successful recorded result text.
3062
+ * @param json - Parsed whole-result JSON, or undefined for non-JSON text.
3063
+ * @param t - Conversation translator.
3064
+ * @returns Compact details, or null when the output format is not recognized.
3065
+ */
3066
+ function controlDetails(name, args, text, json, t) {
3067
+ const target = arg(args, "target") || arg(args, "agent_id") || arg(args, "sessionId") || arg(args, "job_id");
3068
+ switch (name) {
3069
+ case "list_agents": return agentList(text, json, t);
3070
+ case "job_list": return jobList(text, t);
3071
+ case "terminal_list": return terminalList(text, t);
3072
+ case "lsp": return lspDetails(args, text, t);
3073
+ case "spawn_teammate":
3074
+ if (!detailRecord(json) || !detailRecord(json.member)) return null;
3075
+ return detailList(inspectionItems(json.member, t), arg(args, "name"), t);
3076
+ case "team_task_create":
3077
+ case "team_task_get":
3078
+ case "team_task_update":
3079
+ if (!detailRecord(json) || typeof json.subject !== "string") return null;
3080
+ return detailList(inspectionItems(json, t), json.subject, t);
3081
+ case "team_task_list":
3082
+ if (!detailRecord(json) || !Array.isArray(json.tasks)) return null;
3083
+ if (json.nextCursor !== void 0 && typeof json.nextCursor !== "number") return null;
3084
+ return {
3085
+ ...detailList(inspectionItems(json.tasks, t), t("detail.tasks.count", { count: json.tasks.length }), t),
3086
+ ...json.nextCursor === void 0 ? {} : { caption: t("detail.tasks.nextPage", { cursor: String(json.nextCursor) }) }
3087
+ };
3088
+ case "send_message": {
3089
+ const status = detailRecord(json) ? json.status : void 0;
3090
+ if (status === "accepted" || status === "queued") return receipt(target, {
3091
+ label: t(status === "queued" ? "detail.status.queued" : "detail.receipt.delivered"),
3092
+ tone: status === "queued" ? "warning" : "success"
3093
+ }, t, [], arg(args, "message"));
3094
+ return text === `message delivered to agent ${target}` ? receipt(target, {
3095
+ label: t("detail.receipt.delivered"),
3096
+ tone: "success"
3097
+ }, t, [], arg(args, "message")) : null;
3098
+ }
3099
+ case "interrupt_agent":
3100
+ if (detailRecord(json) && typeof json.previousStatus === "string") return receipt(target, {
3101
+ label: t("detail.receipt.interrupt"),
3102
+ tone: "warning"
3103
+ }, t, [{
3104
+ label: t("detail.field.previousStatus"),
3105
+ value: detailBadge(json.previousStatus, t).label
3106
+ }]);
3107
+ return text === `interrupt requested for agent ${target}` ? receipt(target, {
3108
+ label: t("detail.receipt.interrupt"),
3109
+ tone: "warning"
3110
+ }, t) : null;
3111
+ case "wait_agent":
3112
+ if (!detailRecord(json) || typeof json.timedOut !== "boolean") return null;
3113
+ if (detailRecord(json.noProgress) && typeof json.noProgress.message === "string") return detailList([{
3114
+ title: t("detail.wait.noProgress"),
3115
+ description: json.noProgress.message,
3116
+ fields: []
3117
+ }], t("detail.wait.noProgress"), t);
3118
+ return receipt(t("detail.wait.title"), {
3119
+ label: t(json.timedOut ? "detail.wait.timeout" : "detail.wait.changed"),
3120
+ tone: "neutral"
3121
+ }, t);
3122
+ case "subagent": {
3123
+ const started = /^started (background subagent job|subagent) (\S+)$/u.exec(text);
3124
+ if (started !== null) return receipt(arg(args, "prompt"), {
3125
+ label: t("detail.receipt.started"),
3126
+ tone: "info"
3127
+ }, t, [{
3128
+ label: t(started[1] === "subagent" ? "detail.field.agent" : "detail.field.job"),
3129
+ value: started[2] ?? ""
3130
+ }]);
3131
+ return detailList([{
3132
+ title: t("detail.agent.reply"),
3133
+ markdown: text,
3134
+ fields: [],
3135
+ groups: [{
3136
+ label: t("detail.field.task"),
3137
+ items: [{
3138
+ description: arg(args, "prompt"),
3139
+ fields: []
3140
+ }]
3141
+ }]
3142
+ }], t("detail.agent.reply"), t);
3143
+ }
3144
+ case "list_subagent_models": return detailList(text.split("\n").map((line) => {
3145
+ const split = line.indexOf(" — ");
3146
+ return split < 0 ? {
3147
+ description: line,
3148
+ fields: []
3149
+ } : {
3150
+ title: line.slice(0, split),
3151
+ description: line.slice(split + 3),
3152
+ fields: []
3153
+ };
3154
+ }), arg(args, "model") || arg(args, "provider") || t("detail.models.title"), t);
3155
+ case "job_output": {
3156
+ const match = /\n\[status: ([^,\]\n]+)(?:, ([^\]\n]+))?\]$/u.exec(text);
3157
+ if (match === null || match[1] === void 0) return null;
3158
+ const output = text.slice(0, match.index);
3159
+ const truncated = output.endsWith(OUTPUT_TRUNCATED);
3160
+ const code = truncated ? output.slice(0, -19) : output;
3161
+ const description = [match[2], truncated ? t("detail.output.truncated") : void 0].filter((value) => value !== void 0).join(" · ");
3162
+ return {
3163
+ ...detailList([{
3164
+ title: target,
3165
+ badge: detailBadge(match[1], t),
3166
+ fields: [],
3167
+ ...description === "" ? {} : { description },
3168
+ code: { text: code }
3169
+ }], `${target} · ${detailBadge(match[1], t).label}`, t),
3170
+ expandedSummary: target
3171
+ };
3172
+ }
3173
+ case "job_kill":
3174
+ if (text === `requested cancellation of job ${target}`) return receipt(target, {
3175
+ label: t("detail.receipt.cancel"),
3176
+ tone: "warning"
3177
+ }, t, [], arg(args, "reason"));
3178
+ if (text.startsWith(`job ${target} had already finished `)) return receipt(target, {
3179
+ label: t("detail.receipt.alreadyFinished"),
3180
+ tone: "neutral"
3181
+ }, t);
3182
+ return null;
3183
+ case "terminal_open": {
3184
+ const match = /^started terminal session (\S+)(?: \((.*?)\))? \[type: ([^\]]+)\]\n([\s\S]*)$/u.exec(text);
3185
+ if (match === null || match[1] === void 0 || match[3] === void 0 || match[4] === void 0) return null;
3186
+ return detailList([{
3187
+ title: match[2] ?? match[1],
3188
+ ...match[2] === void 0 ? {} : { subtitle: match[1] },
3189
+ badge: {
3190
+ label: t("detail.receipt.started"),
3191
+ tone: "info"
3192
+ },
3193
+ fields: [{
3194
+ label: t("detail.field.type"),
3195
+ value: match[3]
3196
+ }],
3197
+ code: { text: match[4] }
3198
+ }], match[2] ?? match[1], t);
3199
+ }
3200
+ case "terminal_read": {
3201
+ const match = /\n\[lines: (\d+)-(\d+) of (\d+)\](\n\[output truncated\])?$/u.exec(text);
3202
+ if (match === null) return null;
3203
+ return detailList([{
3204
+ title: target,
3205
+ subtitle: t("detail.output.lines", {
3206
+ begin: match[1] ?? "",
3207
+ end: match[2] ?? "",
3208
+ total: match[3] ?? ""
3209
+ }),
3210
+ fields: [],
3211
+ code: { text: text.slice(0, match.index) },
3212
+ ...match[4] === void 0 ? {} : { description: t("detail.output.truncated") }
3213
+ }], target, t);
3214
+ }
3215
+ case "terminal_signal": {
3216
+ const match = /^delivered (\S+) to foreground process group (\d+)$/u.exec(text);
3217
+ if (match === null || match[1] === void 0 || match[2] === void 0) return null;
3218
+ return receipt(target, {
3219
+ label: t("detail.receipt.signal"),
3220
+ tone: "success"
3221
+ }, t, [{
3222
+ label: t("detail.field.signal"),
3223
+ value: match[1]
3224
+ }, {
3225
+ label: t("detail.field.processGroup"),
3226
+ value: match[2]
3227
+ }]);
3228
+ }
3229
+ case "terminal_close":
3230
+ if (text === `closed terminal session ${target}`) return receipt(target, {
3231
+ label: t("detail.receipt.closed"),
3232
+ tone: "neutral"
3233
+ }, t);
3234
+ if (text === `terminal session ${target} was already closing`) return receipt(target, {
3235
+ label: t("detail.receipt.closing"),
3236
+ tone: "neutral"
3237
+ }, t);
3238
+ return null;
3239
+ default: return null;
3240
+ }
3241
+ }
3242
+ //#endregion
3243
+ //#region lib/types/client/tool/models/inspection-details-model.js
3244
+ function dateText(value, locale) {
3245
+ const date = new Date(value);
3246
+ if (!Number.isFinite(date.getTime())) return String(value);
3247
+ try {
3248
+ return new Intl.DateTimeFormat(locale, {
3249
+ dateStyle: "medium",
3250
+ timeStyle: "short"
3251
+ }).format(date);
3252
+ } catch {
3253
+ return String(value);
3254
+ }
3255
+ }
3256
+ function cordisDetails(name, args, value, t) {
3257
+ if (!detailRecord(value)) return null;
3258
+ if (name === "cordis_inspect_list") {
3259
+ if (!Array.isArray(value.providers)) return null;
3260
+ return detailList(inspectionItems(value.providers, t), t("detail.providers.count", { count: value.providers.length }), t);
3261
+ }
3262
+ if (name === "cordis_inspect_query") {
3263
+ if (!("data" in value) || typeof value.provider !== "string" || typeof value.method !== "string") return null;
3264
+ return detailList(inspectionItems(value.data, t), `${value.provider}.${value.method}`, t);
3265
+ }
3266
+ if (name === "cordis_inspect_self") {
3267
+ if (Array.isArray(value.plugins)) return detailList(inspectionItems(value.plugins, t), t("detail.plugins.count", { count: value.plugins.length }), t);
3268
+ return detailList(inspectionItems(value, t), String(args.pluginId ?? args.packageId ?? value.mode), t);
3269
+ }
3270
+ return null;
3271
+ }
3272
+ function workflowDetails(name, args, text, t) {
3273
+ if (name === "workflow") {
3274
+ const match = /^workflow "([\s\S]*?)" completed \((\d+) agents?\)\.\nReturn value:\n([\s\S]*)$/u.exec(text);
3275
+ if (match === null || match[1] === void 0 || match[2] === void 0 || match[3] === void 0) return null;
3276
+ const value = detailJson(match[3]);
3277
+ if (value === void 0) return null;
3278
+ return detailList([{
3279
+ title: match[1],
3280
+ badge: {
3281
+ label: t("detail.status.completed"),
3282
+ tone: "success"
3283
+ },
3284
+ fields: [{
3285
+ label: t("detail.field.agents"),
3286
+ value: match[2]
3287
+ }],
3288
+ ...typeof args.code === "string" ? { groups: [{
3289
+ label: t("detail.workflow.script"),
3290
+ items: [{
3291
+ fields: [],
3292
+ code: {
3293
+ text: args.code,
3294
+ language: "javascript"
3295
+ }
3296
+ }]
3297
+ }] } : {}
3298
+ }, ...inspectionItems(value, t)], match[1], t);
3299
+ }
3300
+ const split = text.indexOf("\nFinal report:\n");
3301
+ if (split < 0) return null;
3302
+ const header = text.slice(0, split);
3303
+ const rounds = /\b(\d+) rounds?\b/u.exec(header)?.[1];
3304
+ const report = detailJson(text.slice(split + 15));
3305
+ if (!detailRecord(report) || typeof report.summary !== "string" || !Array.isArray(report.evidence) || !report.evidence.every((value) => typeof value === "string") || !Array.isArray(report.nextSteps) || !report.nextSteps.every((value) => typeof value === "string") || typeof report.blocker !== "string") return null;
3306
+ const badge = header.startsWith("Ralph worker reported completion ") ? {
3307
+ label: t("detail.ralph.reportedComplete"),
3308
+ tone: "success"
3309
+ } : header.startsWith("Ralph worker reported a blocker ") ? {
3310
+ label: t("detail.ralph.reportedBlocker"),
3311
+ tone: "warning"
3312
+ } : header.startsWith("Ralph reached its ") ? {
3313
+ label: t("detail.ralph.limit"),
3314
+ tone: "warning"
3315
+ } : void 0;
3316
+ if (badge === void 0) return null;
3317
+ const groups = [];
3318
+ if (report.nextSteps.length > 0) groups.push({
3319
+ label: t("detail.report.nextSteps"),
3320
+ items: [{
3321
+ fields: [],
3322
+ lines: report.nextSteps
3323
+ }]
3324
+ });
3325
+ if (typeof args.objective === "string") groups.push({
3326
+ label: t("detail.field.task"),
3327
+ items: [{
3328
+ fields: [],
3329
+ description: args.objective
3330
+ }]
3331
+ });
3332
+ const fields = rounds === void 0 ? [] : [{
3333
+ label: t("detail.goal.rounds"),
3334
+ value: rounds
3335
+ }];
3336
+ if (report.blocker !== "") fields.push({
3337
+ label: t("detail.goal.reason"),
3338
+ value: report.blocker
3339
+ });
3340
+ return detailList([{
3341
+ title: report.summary,
3342
+ badge,
3343
+ fields,
3344
+ ...report.evidence.length === 0 ? {} : { lines: report.evidence },
3345
+ groups
3346
+ }], report.summary, t);
3347
+ }
3348
+ const TRACE_FIELDS = {
3349
+ Created: "detail.field.time",
3350
+ Availability: "detail.field.availability",
3351
+ Parent: "detail.field.parent",
3352
+ "Best match": "detail.field.bestMatch",
3353
+ Target: "detail.field.target",
3354
+ "Replaced by": "detail.trace.replacedBy",
3355
+ "Replacement chain": "detail.trace.replacementChain",
3356
+ "Events replaced by target": "detail.trace.replaces",
3357
+ "Events cited directly as sources": "detail.trace.sources",
3358
+ "Direct derived events": "detail.trace.derived"
3359
+ };
3360
+ function textFields(text, t, locale) {
3361
+ return text.split("\n").flatMap((line) => {
3362
+ const match = /^\s*([^:]+): (.+)$/u.exec(line);
3363
+ if (match === null || match[1] === void 0 || match[2] === void 0) return [];
3364
+ const key = Object.hasOwn(TRACE_FIELDS, match[1]) ? TRACE_FIELDS[match[1]] : void 0;
3365
+ if (key === void 0) return [];
3366
+ return [{
3367
+ label: t(key),
3368
+ value: match[1] === "Created" ? dateText(match[2], locale) : match[2] === "none" ? t("detail.none") : match[2]
3369
+ }];
3370
+ });
3371
+ }
3372
+ function searchDetails(name, text, t, locale) {
3373
+ if (text === "No prior session matches found." || text.endsWith("\n\nNo prior event matches found.")) return detailList([], t("detail.matches.count", { count: 0 }), t);
3374
+ const blocks = text.split(/\n(?=\d+\. )/u).filter((block) => /^\d+\. /u.test(block));
3375
+ if (blocks.length === 0) return null;
3376
+ const items = [];
3377
+ for (const block of blocks) {
3378
+ const snippet = /\n\s*Snippet: ([\s\S]*?)(?:\n\nResult cap reached\.|$)/u.exec(block)?.[1];
3379
+ if (name === "session_search") {
3380
+ const match = /^\d+\. Session (\S+) — (.*)/u.exec(block);
3381
+ if (match === null || match[1] === void 0 || match[2] === void 0) return null;
3382
+ items.push({
3383
+ title: match[2],
3384
+ subtitle: match[1],
3385
+ ...snippet === void 0 ? {} : { description: snippet.trimEnd() },
3386
+ fields: textFields(block, t, locale)
3387
+ });
3388
+ } else {
3389
+ const match = /^\d+\. seq (\d+) \| ([^|]+) \| ([^|]+) \| ([^\n]+)/u.exec(block);
3390
+ if (match === null || match[1] === void 0 || match[2] === void 0 || match[3] === void 0 || match[4] === void 0) return null;
3391
+ items.push({
3392
+ title: snippet?.trimEnd() ?? match[2],
3393
+ subtitle: `${match[2].trim()} · #${match[1]}`,
3394
+ fields: [{
3395
+ label: t("detail.field.time"),
3396
+ value: dateText(match[4], locale)
3397
+ }, {
3398
+ label: t("detail.field.surface"),
3399
+ value: match[3].trim()
3400
+ }]
3401
+ });
3402
+ }
3403
+ }
3404
+ return {
3405
+ ...detailList(items, t("detail.matches.count", { count: items.length }), t),
3406
+ ...text.includes("Result cap reached.") ? { caption: t("detail.matches.capped") } : {}
3407
+ };
3408
+ }
3409
+ function eventReadDetails(text, t, locale) {
3410
+ const match = /^Session (\S+) — ([^\n]*)\nTarget event seq (\d+):\n```json\n([\s\S]*?)\n```([\s\S]*)$/u.exec(text);
3411
+ if (match === null || match[1] === void 0 || match[2] === void 0 || match[3] === void 0 || match[4] === void 0) return null;
3412
+ const event = detailJson(match[4]);
3413
+ if (!detailRecord(event) || typeof event.type !== "string" || !detailRecord(event.data)) return null;
3414
+ const fields = [{
3415
+ label: t("detail.field.seq"),
3416
+ value: match[3]
3417
+ }];
3418
+ if (typeof event.time === "number") fields.push({
3419
+ label: t("detail.field.time"),
3420
+ value: dateText(event.time, locale)
3421
+ });
3422
+ const groups = [];
3423
+ const adjacent = match[5]?.trim();
3424
+ if (adjacent) groups.push({
3425
+ label: t("detail.event.neighbors"),
3426
+ items: [{
3427
+ fields: [],
3428
+ description: adjacent
3429
+ }]
3430
+ });
3431
+ return detailList([
3432
+ {
3433
+ title: event.type,
3434
+ subtitle: `${match[2]} · ${match[1]}`,
3435
+ fields
3436
+ },
3437
+ ...inspectionItems(event.data, t),
3438
+ ...groups.length === 0 ? [] : [{
3439
+ fields: [],
3440
+ groups
3441
+ }]
3442
+ ], `${event.type} · #${match[3]}`, t);
3443
+ }
3444
+ function traceDetails(name, text, t, locale) {
3445
+ const match = /^Session (\S+) — ([^\n]*)\n([\s\S]*)$/u.exec(text);
3446
+ if (match === null || match[1] === void 0 || match[2] === void 0 || match[3] === void 0) return null;
3447
+ if (name === "session_event_trace") return detailList([{
3448
+ title: match[2],
3449
+ subtitle: match[1],
3450
+ fields: textFields(match[3], t, locale)
3451
+ }], match[2], t);
3452
+ const sections = match[3].split("\n\n");
3453
+ const items = [{
3454
+ title: match[2],
3455
+ subtitle: match[1],
3456
+ fields: textFields(sections[0] ?? "", t, locale)
3457
+ }];
3458
+ for (const section of sections.slice(1)) {
3459
+ const firstBreak = section.indexOf("\n");
3460
+ const label = section.startsWith("Ancestors (nearest first):") ? t("detail.trace.ancestors") : section.startsWith("Descendants:") ? t("detail.trace.descendants") : void 0;
3461
+ if (label === void 0 || firstBreak < 0) return null;
3462
+ const body = section.slice(firstBreak + 1);
3463
+ items.push({
3464
+ title: label,
3465
+ fields: [],
3466
+ ...body === "- none" || body === "- none (target is a root session)" ? { description: t("detail.none") } : { lines: body.split("\n").map((line) => line.replace(/^(\s*)- /u, "$1")) }
3467
+ });
3468
+ }
3469
+ return detailList(items, match[2], t);
3470
+ }
3471
+ /**
3472
+ * Present successful inspection, query, and workflow text as named records.
3473
+ * @param name - Wire tool name.
3474
+ * @param args - Recorded argument object.
3475
+ * @param text - Recorded result text.
3476
+ * @param json - Parsed whole-result JSON, or undefined for non-JSON text.
3477
+ * @param t - Conversation translator.
3478
+ * @param locale - Date display locale.
3479
+ * @returns Structured details, or null when an output format is unknown.
3480
+ */
3481
+ function inspectionDetails(name, args, text, json, t, locale) {
3482
+ if (hasSpillNotice(text)) return null;
3483
+ switch (name) {
3484
+ case "cordis_inspect_list":
3485
+ case "cordis_inspect_query":
3486
+ case "cordis_inspect_self": return cordisDetails(name, args, json, t);
3487
+ case "workflow":
3488
+ case "ralph": return workflowDetails(name, args, text, t);
3489
+ case "session_search":
3490
+ case "session_event_search": return searchDetails(name, text, t, locale);
3491
+ case "session_event_read": return eventReadDetails(text, t, locale);
3492
+ case "session_trace":
3493
+ case "session_event_trace": return traceDetails(name, text, t, locale);
3494
+ default: return null;
3495
+ }
3496
+ }
3497
+ //#endregion
3498
+ //#region lib/types/client/tool/models/details-card-model.js
3499
+ function count(value) {
3500
+ return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
3501
+ }
3502
+ function formatDate(date, locale, fallback) {
3503
+ try {
3504
+ return new Intl.DateTimeFormat(locale, {
3505
+ year: "numeric",
3506
+ month: "short",
3507
+ day: "numeric",
3508
+ hour: "2-digit",
3509
+ minute: "2-digit",
3510
+ second: "2-digit",
3511
+ timeZoneName: "short"
3512
+ }).format(date);
3513
+ } catch {
3514
+ return fallback;
3515
+ }
3516
+ }
3517
+ /**
3518
+ * Derive the compact todo list from a todo_write call.
3519
+ * @param args - Parsed todo_write arguments.
3520
+ * @param t - Conversation dictionary translator.
3521
+ * @returns Localized todo details, or null for unsupported input.
3522
+ */
3523
+ function todosDetail(args, t) {
3524
+ if (!Array.isArray(args.todos)) return null;
3525
+ const items = [];
3526
+ const seen = /* @__PURE__ */ new Set();
3527
+ for (const todo of args.todos) {
3528
+ if (!detailRecord(todo) || !nonempty(todo.content)) return null;
3529
+ const status = todo.status;
3530
+ if (status !== "completed" && status !== "in_progress" && status !== "pending") return null;
3531
+ const title = todo.content.trim();
3532
+ if (seen.has(title)) return null;
3533
+ seen.add(title);
3534
+ items.push({
3535
+ title,
3536
+ status: {
3537
+ value: status,
3538
+ label: t(`detail.todo.${status}`)
3539
+ },
3540
+ fields: []
3541
+ });
3542
+ }
3543
+ return {
3544
+ items,
3545
+ empty: t("detail.todo.empty")
3546
+ };
3547
+ }
3548
+ function goalDetail(value, t) {
3549
+ if (!detailRecord(value)) return null;
3550
+ if (value.goal === null) return {
3551
+ items: [],
3552
+ empty: t("detail.goal.empty")
3553
+ };
3554
+ const goal = value.goal;
3555
+ if (!detailRecord(goal) || !nonempty(goal.id) || !nonempty(goal.objective) || !count(goal.revision) || !count(goal.roundsStarted) || !count(goal.maxGoalRounds)) return null;
3556
+ const phase = goal.phase;
3557
+ if (phase !== "active" && phase !== "paused" && phase !== "blocked" && phase !== "complete") return null;
3558
+ if (value.activation !== "armed" && value.activation !== "disarmed") return null;
3559
+ const fields = [{
3560
+ label: t("detail.state"),
3561
+ value: t(phase === "active" && value.activation === "disarmed" ? "detail.goal.disarmed" : `detail.goal.${phase}`)
3562
+ }, {
3563
+ label: t("detail.goal.rounds"),
3564
+ value: `${goal.roundsStarted} / ${goal.maxGoalRounds}`
3565
+ }];
3566
+ if (goal.blockedReason !== void 0) {
3567
+ if (!detailRecord(goal.blockedReason) || !nonempty(goal.blockedReason.code) || !nonempty(goal.blockedReason.message)) return null;
3568
+ fields.push({
3569
+ label: t("detail.goal.reason"),
3570
+ value: goal.blockedReason.message
3571
+ });
3572
+ }
3573
+ return { items: [{
3574
+ title: goal.objective,
3575
+ fields
3576
+ }] };
3577
+ }
3578
+ /** ISO-weekday keys, Monday first: a stored weekly rule names days 1 through 7. */
3579
+ const WEEKDAY_KEYS = [
3580
+ "detail.weekday.1",
3581
+ "detail.weekday.2",
3582
+ "detail.weekday.3",
3583
+ "detail.weekday.4",
3584
+ "detail.weekday.5",
3585
+ "detail.weekday.6",
3586
+ "detail.weekday.7"
3587
+ ];
3588
+ function interval(seconds, t) {
3589
+ if (seconds % 86400 === 0) return t("detail.days", { count: seconds / 86400 });
3590
+ if (seconds % 3600 === 0) return t("detail.hours", { count: seconds / 3600 });
3591
+ if (seconds % 60 === 0) return t("detail.minutes", { count: seconds / 60 });
3592
+ return t("detail.seconds", { count: seconds });
3593
+ }
3594
+ /** A stored wall clock without its zero seconds, the figure the schedule surfaces state. */
3595
+ function shortTime(time) {
3596
+ return time.replace(/:00\.000$/, "").replace(/\.000$/, "");
3597
+ }
3598
+ /** Localized weekday list of a stored weekly rule, or undefined when the set is empty or out of range. */
3599
+ function weekdayText(days, t) {
3600
+ if (!Array.isArray(days) || days.length === 0) return void 0;
3601
+ const labels = [];
3602
+ for (const day of days) {
3603
+ if (typeof day !== "number" || !Number.isInteger(day)) return void 0;
3604
+ const key = WEEKDAY_KEYS[day - 1];
3605
+ if (key === void 0) return void 0;
3606
+ labels.push(t(key));
3607
+ }
3608
+ return labels.join(t("detail.weekday.join"));
3609
+ }
3610
+ function scheduleItem(value, t, locale) {
3611
+ if (!detailRecord(value) || !nonempty(value.id) || !nonempty(value.prompt) || typeof value.scheduledAt !== "string" || value.deliveryMode !== "host" && value.deliveryMode !== "session-local" || value.state !== "scheduled" && value.state !== "overdue") return null;
3612
+ const date = new Date(value.scheduledAt);
3613
+ if (!Number.isFinite(date.getTime()) || date.toISOString() !== value.scheduledAt) return null;
3614
+ let frequency;
3615
+ switch (value.kind) {
3616
+ case "at":
3617
+ frequency = t("detail.schedule.once");
3618
+ break;
3619
+ case "after":
3620
+ if (!count(value.afterSeconds) || value.afterSeconds === 0) return null;
3621
+ frequency = t("detail.schedule.once");
3622
+ break;
3623
+ case "every":
3624
+ if (!count(value.everySeconds) || value.everySeconds === 0) return null;
3625
+ frequency = t("detail.schedule.every", { interval: interval(value.everySeconds, t) });
3626
+ break;
3627
+ case "daily":
3628
+ if (!nonempty(value.time) || !nonempty(value.timeZone)) return null;
3629
+ frequency = t("detail.schedule.daily", {
3630
+ time: shortTime(value.time),
3631
+ zone: value.timeZone
3632
+ });
3633
+ break;
3634
+ case "weekly": {
3635
+ const days = weekdayText(value.weekdays, t);
3636
+ if (!nonempty(value.time) || !nonempty(value.timeZone) || days === void 0) return null;
3637
+ frequency = t("detail.schedule.weekly", {
3638
+ days,
3639
+ time: shortTime(value.time),
3640
+ zone: value.timeZone
3641
+ });
3642
+ break;
3643
+ }
3644
+ case "cron":
3645
+ if (!nonempty(value.expression) || !nonempty(value.timeZone)) return null;
3646
+ frequency = t("detail.schedule.cron", {
3647
+ expression: value.expression,
3648
+ zone: value.timeZone
3649
+ });
3650
+ break;
3651
+ default: return null;
3652
+ }
3653
+ const dateText = formatDate(date, locale, value.scheduledAt);
3654
+ return {
3655
+ title: nonempty(value.title) ? value.title : value.prompt,
3656
+ fields: [
3657
+ {
3658
+ label: t("detail.schedule.when"),
3659
+ value: dateText
3660
+ },
3661
+ {
3662
+ label: t("detail.schedule.frequency"),
3663
+ value: frequency
3664
+ },
3665
+ {
3666
+ label: t("detail.state"),
3667
+ value: t(`detail.schedule.${value.state}`)
3668
+ }
3669
+ ]
3670
+ };
3671
+ }
3672
+ /**
3673
+ * Derive a supported successful result, retaining generic output on unknown or malformed data.
3674
+ * @param block - Logged root or nested Tool call and its optional result.
3675
+ * @param t - Conversation dictionary translator.
3676
+ * @param locale - Display locale for absolute dates in the viewer's time zone.
3677
+ * @returns Localized detail data, or null for raw input/output.
3678
+ */
3679
+ function detailsCardModel(block, t, locale) {
3680
+ if (!("kind" in block) || block.isError) return null;
3681
+ const call = parsedToolCall(block);
3682
+ if (call === null) return null;
3683
+ const text = singleResultText(block);
3684
+ if (text === void 0) return null;
3685
+ const value = detailJson(text);
3686
+ const details = controlDetails(call.name, call.args, text, value, t) ?? inspectionDetails(call.name, call.args, text, value, t, locale);
3687
+ if (details !== null) return details;
3688
+ if (value === void 0) return null;
3689
+ switch (call.name) {
3690
+ case "create_goal":
3691
+ case "get_goal":
3692
+ case "update_goal": return goalDetail(value, t);
3693
+ case "schedule_create":
3694
+ case "schedule_update": {
3695
+ const item = scheduleItem(value, t, locale);
3696
+ return item === null ? null : { items: [item] };
3697
+ }
3698
+ case "schedule_list": {
3699
+ if (!Array.isArray(value)) return null;
3700
+ const items = [];
3701
+ for (const entry of value) {
3702
+ const item = scheduleItem(entry, t, locale);
3703
+ if (item === null) return null;
3704
+ items.push(item);
3705
+ }
3706
+ return {
3707
+ items,
3708
+ summary: t("detail.schedule.count", { count: items.length }),
3709
+ empty: t("detail.schedule.empty")
3710
+ };
3711
+ }
3712
+ case "schedule_delete":
3713
+ if (!detailRecord(value) || !nonempty(value.id) || value.deleted !== true) return null;
3714
+ return { items: [{
3715
+ title: value.id,
3716
+ fields: [{
3717
+ label: t("detail.state"),
3718
+ value: t("detail.schedule.deleted")
3719
+ }]
3720
+ }] };
3721
+ default: return null;
3722
+ }
3723
+ }
3724
+ //#endregion
3725
+ //#region lib/types/client/tool/toolviews/details-row.js
3726
+ /** Keyed recorded-result rows sharing the compact detail body. */
3727
+ const LSP_TITLE_KEYS = {
3728
+ goToDefinition: "tool.title.findDefinition",
3729
+ findReferences: "tool.title.findReferences",
3730
+ goToImplementation: "tool.title.findImplementation",
3731
+ hover: "tool.title.hoverSymbol"
3732
+ };
3733
+ /** Teammate-coordination tools presented with the two-person team icon. */
3734
+ const TEAMMATE_TOOLS = new Set([
3735
+ "spawn_teammate",
3736
+ "list_agents",
3737
+ "send_message",
3738
+ "interrupt_agent",
3739
+ "wait_agent"
3740
+ ]);
3741
+ function detailIcon(toolName) {
3742
+ if (TEAMMATE_TOOLS.has(toolName)) return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconUsersOutlineRegular, { size: 14 });
3743
+ if (toolName.startsWith("schedule_")) return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconClockOutlineRegular, { size: 14 });
3744
+ if (toolName.endsWith("_goal")) return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconGoalOutlineRegular, { size: 14 });
3745
+ if (toolName.startsWith("cordis_")) return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCordisPluginOutlineRegular, {});
3746
+ if (toolName.startsWith("terminal_")) return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCodeOutlineRegular, { size: 14 });
3747
+ if (toolName.startsWith("session_") || toolName === "lsp") return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconSearchOutlineRegular, { size: 14 });
3748
+ if (toolName.startsWith("job_") || toolName.startsWith("team_task_")) return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChecklistOutlineRegular, {});
3749
+ if (toolName === "workflow" || toolName === "ralph") return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBranchOutlineRegular, { size: 14 });
3750
+ return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconAgentPresetOutlineRegular, { size: 14 });
3751
+ }
3752
+ /**
3753
+ * Present recorded entities, receipts, and report fields in the existing expandable row.
3754
+ * @param props - Tool call, row actions, and locale supplied by the keyed slot.
3755
+ * @returns A Tool row with structured details or generic input/output.
3756
+ */
3757
+ function DetailsRow({ toolName, block, cwd, home, openFile, inspect, useDisclosure, t }) {
3758
+ const model = toolRowModel(toolName, block, cwd, home);
3759
+ const locale = document.documentElement.lang;
3760
+ const details = (0, react.useMemo)(() => detailsCardModel(block, t, locale), [
3761
+ block,
3762
+ t,
3763
+ locale
3764
+ ]);
3765
+ const operation = toolName === "lsp" ? parsedToolCall(block)?.args.operation : void 0;
3766
+ const titleKey = typeof operation === "string" && Object.hasOwn(LSP_TITLE_KEYS, operation) ? LSP_TITLE_KEYS[operation] : model.titleKey;
3767
+ return (0, react_jsx_runtime.jsx)(ToolRow, {
3768
+ useDisclosure,
3769
+ t,
3770
+ variant: model.variant,
3771
+ toolName,
3772
+ icon: detailIcon(toolName),
3773
+ title: t(titleKey),
3774
+ summary: details?.summary ?? details?.items[0]?.title ?? details?.empty ?? model.summary,
3775
+ details,
3776
+ bodyRaw: model.bodyRaw,
3777
+ output: model.output,
3778
+ errorSummary: model.errorSummary,
3779
+ state: model.state,
3780
+ inspect,
3781
+ onOpenFile: openFile
3782
+ });
3783
+ }
3784
+ /** Register recorded-result details through the standard atomic Tool slot. */
3785
+ const detailsToolview = {
3786
+ name: "details-toolview",
3787
+ inject: ["slots"],
3788
+ apply(ctx) {
3789
+ ctx.slots.inject("tool.call.toolview", function* () {
3790
+ yield ctx.slots.register({
3791
+ name: "tool.call.toolview",
3792
+ key: "create_goal",
3793
+ locale: CONVERSATION_NS
3794
+ }, DetailsRow);
3795
+ yield ctx.slots.register({
3796
+ name: "tool.call.toolview",
3797
+ key: "get_goal",
3798
+ locale: CONVERSATION_NS
3799
+ }, DetailsRow);
3800
+ yield ctx.slots.register({
3801
+ name: "tool.call.toolview",
3802
+ key: "update_goal",
3803
+ locale: CONVERSATION_NS
3804
+ }, DetailsRow);
3805
+ yield ctx.slots.register({
3806
+ name: "tool.call.toolview",
3807
+ key: "schedule_create",
3808
+ locale: CONVERSATION_NS
3809
+ }, DetailsRow);
3810
+ yield ctx.slots.register({
3811
+ name: "tool.call.toolview",
3812
+ key: "schedule_list",
3813
+ locale: CONVERSATION_NS
3814
+ }, DetailsRow);
3815
+ yield ctx.slots.register({
3816
+ name: "tool.call.toolview",
3817
+ key: "schedule_delete",
3818
+ locale: CONVERSATION_NS
3819
+ }, DetailsRow);
3820
+ yield ctx.slots.register({
3821
+ name: "tool.call.toolview",
3822
+ key: "schedule_update",
3823
+ locale: CONVERSATION_NS
3824
+ }, DetailsRow);
3825
+ yield ctx.slots.register({
3826
+ name: "tool.call.toolview",
3827
+ key: "cordis_inspect_list",
3828
+ locale: CONVERSATION_NS
3829
+ }, DetailsRow);
3830
+ yield ctx.slots.register({
3831
+ name: "tool.call.toolview",
3832
+ key: "cordis_inspect_query",
3833
+ locale: CONVERSATION_NS
3834
+ }, DetailsRow);
3835
+ yield ctx.slots.register({
3836
+ name: "tool.call.toolview",
3837
+ key: "cordis_inspect_self",
3838
+ locale: CONVERSATION_NS
3839
+ }, DetailsRow);
3840
+ yield ctx.slots.register({
3841
+ name: "tool.call.toolview",
3842
+ key: "workflow",
3843
+ locale: CONVERSATION_NS
3844
+ }, DetailsRow);
3845
+ yield ctx.slots.register({
3846
+ name: "tool.call.toolview",
3847
+ key: "ralph",
3848
+ locale: CONVERSATION_NS
3849
+ }, DetailsRow);
3850
+ yield ctx.slots.register({
3851
+ name: "tool.call.toolview",
3852
+ key: "session_event_read",
3853
+ locale: CONVERSATION_NS
3854
+ }, DetailsRow);
3855
+ yield ctx.slots.register({
3856
+ name: "tool.call.toolview",
3857
+ key: "session_event_search",
3858
+ locale: CONVERSATION_NS
3859
+ }, DetailsRow);
3860
+ yield ctx.slots.register({
3861
+ name: "tool.call.toolview",
3862
+ key: "session_event_trace",
3863
+ locale: CONVERSATION_NS
3864
+ }, DetailsRow);
3865
+ yield ctx.slots.register({
3866
+ name: "tool.call.toolview",
3867
+ key: "session_search",
3868
+ locale: CONVERSATION_NS
3869
+ }, DetailsRow);
3870
+ yield ctx.slots.register({
3871
+ name: "tool.call.toolview",
3872
+ key: "session_trace",
3873
+ locale: CONVERSATION_NS
3874
+ }, DetailsRow);
3875
+ yield ctx.slots.register({
3876
+ name: "tool.call.toolview",
3877
+ key: "list_subagent_models",
3878
+ locale: CONVERSATION_NS
3879
+ }, DetailsRow);
3880
+ yield ctx.slots.register({
3881
+ name: "tool.call.toolview",
3882
+ key: "subagent",
3883
+ locale: CONVERSATION_NS
3884
+ }, DetailsRow);
3885
+ yield ctx.slots.register({
3886
+ name: "tool.call.toolview",
3887
+ key: "list_agents",
3888
+ locale: CONVERSATION_NS
3889
+ }, DetailsRow);
3890
+ yield ctx.slots.register({
3891
+ name: "tool.call.toolview",
3892
+ key: "send_message",
3893
+ locale: CONVERSATION_NS
3894
+ }, DetailsRow);
3895
+ yield ctx.slots.register({
3896
+ name: "tool.call.toolview",
3897
+ key: "interrupt_agent",
3898
+ locale: CONVERSATION_NS
3899
+ }, DetailsRow);
3900
+ yield ctx.slots.register({
3901
+ name: "tool.call.toolview",
3902
+ key: "job_list",
3903
+ locale: CONVERSATION_NS
3904
+ }, DetailsRow);
3905
+ yield ctx.slots.register({
3906
+ name: "tool.call.toolview",
3907
+ key: "job_output",
3908
+ locale: CONVERSATION_NS
3909
+ }, DetailsRow);
3910
+ yield ctx.slots.register({
3911
+ name: "tool.call.toolview",
3912
+ key: "job_kill",
3913
+ locale: CONVERSATION_NS
3914
+ }, DetailsRow);
3915
+ yield ctx.slots.register({
3916
+ name: "tool.call.toolview",
3917
+ key: "terminal_open",
3918
+ locale: CONVERSATION_NS
3919
+ }, DetailsRow);
3920
+ yield ctx.slots.register({
3921
+ name: "tool.call.toolview",
3922
+ key: "terminal_read",
3923
+ locale: CONVERSATION_NS
3924
+ }, DetailsRow);
3925
+ yield ctx.slots.register({
3926
+ name: "tool.call.toolview",
3927
+ key: "terminal_list",
3928
+ locale: CONVERSATION_NS
3929
+ }, DetailsRow);
3930
+ yield ctx.slots.register({
3931
+ name: "tool.call.toolview",
3932
+ key: "terminal_signal",
3933
+ locale: CONVERSATION_NS
3934
+ }, DetailsRow);
3935
+ yield ctx.slots.register({
3936
+ name: "tool.call.toolview",
3937
+ key: "terminal_close",
3938
+ locale: CONVERSATION_NS
3939
+ }, DetailsRow);
3940
+ yield ctx.slots.register({
3941
+ name: "tool.call.toolview",
3942
+ key: "lsp",
3943
+ locale: CONVERSATION_NS
3944
+ }, DetailsRow);
3945
+ yield ctx.slots.register({
3946
+ name: "tool.call.toolview",
3947
+ key: "spawn_teammate",
3948
+ locale: CONVERSATION_NS
3949
+ }, DetailsRow);
3950
+ yield ctx.slots.register({
3951
+ name: "tool.call.toolview",
3952
+ key: "team_task_create",
3953
+ locale: CONVERSATION_NS
3954
+ }, DetailsRow);
3955
+ yield ctx.slots.register({
3956
+ name: "tool.call.toolview",
3957
+ key: "team_task_get",
3958
+ locale: CONVERSATION_NS
3959
+ }, DetailsRow);
3960
+ yield ctx.slots.register({
3961
+ name: "tool.call.toolview",
3962
+ key: "team_task_update",
3963
+ locale: CONVERSATION_NS
3964
+ }, DetailsRow);
3965
+ yield ctx.slots.register({
3966
+ name: "tool.call.toolview",
3967
+ key: "team_task_list",
3968
+ locale: CONVERSATION_NS
3969
+ }, DetailsRow);
3970
+ yield ctx.slots.register({
3971
+ name: "tool.call.toolview",
3972
+ key: "wait_agent",
3973
+ locale: CONVERSATION_NS
3974
+ }, DetailsRow);
3975
+ });
3976
+ }
3977
+ };
3978
+ //#endregion
3979
+ //#region lib/types/client/tool/models/todo-history.js
3980
+ /** Durable writes are indexed independently of Tool success receipts. */
3981
+ const todoWriteDefinition = {
3982
+ kind: "tool-todo-write",
3983
+ match: (event) => event.type === "todo/write" ? {
3984
+ id: String(event.seq),
3985
+ role: "start"
3986
+ } : null,
3987
+ start: (_context, match) => {
3988
+ if (match.event.type !== "todo/write") throw new Error("tool-todo-write requires todo/write");
3989
+ return match.event.data.todos;
3990
+ },
3991
+ update: (context) => context.state,
3992
+ publication: () => "none"
3993
+ };
3994
+ /** Invocation predecessors are repaired by the assembler when older history arrives. */
3995
+ const todoCallDefinition = {
3996
+ kind: "tool-todo-call",
3997
+ target: "tool-todo-history",
3998
+ match: (event) => {
3999
+ if (event.type === "tool/call" && event.data.name === "todo_write") return {
4000
+ id: String(event.data.callId),
4001
+ role: "start"
4002
+ };
4003
+ if (event.type === "tool/ptc-dispatch-start" && event.data.name === "todo_write") return {
4004
+ id: String(event.data.subCallId),
4005
+ role: "start"
4006
+ };
4007
+ return null;
4008
+ },
4009
+ start: (_context, _match, reader) => ({ todos: reader.previous("tool-todo-write")?.state }),
4010
+ update: (context) => context.state,
4011
+ buildViewNode: (context) => context.state === void 0 ? null : {
4012
+ key: context.key,
4013
+ kind: context.kind,
4014
+ id: context.id,
4015
+ target: "tool-todo-history",
4016
+ data: context.state
4017
+ }
4018
+ };
4019
+ /** Incremental lookup snapshots preserve earlier call baselines across later writes. */
4020
+ const todoHistoryView = {
4021
+ target: "tool-todo-history",
4022
+ create: () => {
4023
+ let calls = /* @__PURE__ */ new Map();
4024
+ return {
4025
+ empty: calls,
4026
+ replace: ({ nodes }) => calls = new Map(nodes.map((node) => [node.id, node.data])),
4027
+ apply: ({ upserts }) => {
4028
+ if (upserts.length > 0) {
4029
+ calls = new Map(calls);
4030
+ for (const node of upserts) calls.set(node.id, node.data);
4031
+ }
4032
+ return calls;
4033
+ }
4034
+ };
4035
+ }
4036
+ };
4037
+ /**
4038
+ * Install the recorded-write index and call predecessor target.
4039
+ * @param ctx - Tool presentation plugin context.
4040
+ */
4041
+ function registerTodoHistory(ctx) {
4042
+ ctx.uiConversation.events.register(todoWriteDefinition);
4043
+ ctx.uiConversation.events.register(todoCallDefinition);
4044
+ ctx.uiConversation.views.register(todoHistoryView);
4045
+ }
4046
+ //#endregion
4047
+ //#region lib/types/client/tool/models/todo-diff-model.js
4048
+ /**
4049
+ * Compare this write with its predecessor in the loaded call history.
4050
+ * @param block - The write being displayed.
4051
+ * @param baseline - List recorded before this call, or undefined when its start is unavailable.
4052
+ * @param hasMore - Whether older unloaded history may contain a preceding list.
4053
+ * @param t - Conversation dictionary translator.
4054
+ * @returns Details and a change summary, or null for generic Tool output.
4055
+ */
4056
+ function todoDiffModel(block, baseline, hasMore, t) {
4057
+ if (!("kind" in block) || block.isError) return null;
4058
+ const call = parsedToolCall(block);
4059
+ const current = call?.name === "todo_write" ? todosDetail(call.args, t) : null;
4060
+ if (current === null) return null;
4061
+ const previous = baseline?.todos === void 0 ? null : { items: baseline.todos.map((todo) => ({
4062
+ title: todo.content,
4063
+ status: {
4064
+ value: todo.status,
4065
+ label: t(`detail.todo.${todo.status}`)
4066
+ },
4067
+ fields: []
4068
+ })) };
4069
+ if (baseline === void 0 || previous === null && hasMore) return {
4070
+ details: {
4071
+ ...current,
4072
+ caption: t("todo.diff.unavailable")
4073
+ },
4074
+ summary: null
4075
+ };
4076
+ const previousByTitle = new Map(previous?.items.map((item) => [item.title, item]));
4077
+ const currentTitles = new Set(current.items.map((item) => item.title));
4078
+ const retainedPositions = new Map(previous?.items.filter((item) => currentTitles.has(item.title)).map((item, index) => [item.title, index]));
4079
+ let retainedIndex = 0;
4080
+ const items = [];
4081
+ const unchanged = [];
4082
+ let added = 0;
4083
+ let updated = 0;
4084
+ for (const item of current.items) {
4085
+ const before = previousByTitle.get(item.title);
4086
+ previousByTitle.delete(item.title);
4087
+ if (before === void 0) {
4088
+ added++;
4089
+ items.push({
4090
+ ...item,
4091
+ change: {
4092
+ value: "added",
4093
+ label: t("todo.diff.addedItem")
4094
+ }
4095
+ });
4096
+ } else {
4097
+ const moved = retainedPositions.get(item.title) !== retainedIndex++;
4098
+ const statusChanged = before.status?.value !== item.status?.value;
4099
+ if (statusChanged || moved) {
4100
+ updated++;
4101
+ items.push({
4102
+ ...item,
4103
+ ...statusChanged && before.status !== void 0 ? { previousStatus: before.status.label } : {},
4104
+ change: {
4105
+ value: "updated",
4106
+ label: t(statusChanged ? "todo.diff.updatedItem" : "todo.diff.movedItem")
4107
+ }
4108
+ });
4109
+ } else unchanged.push(item);
4110
+ }
4111
+ }
4112
+ for (const item of previousByTitle.values()) items.push({
4113
+ ...item,
4114
+ change: {
4115
+ value: "removed",
4116
+ label: t("todo.diff.removedItem")
4117
+ }
4118
+ });
4119
+ return {
4120
+ summary: [
4121
+ added > 0 ? t("todo.diff.added", { count: added }) : null,
4122
+ updated > 0 ? t("todo.diff.updated", { count: updated }) : null,
4123
+ previousByTitle.size > 0 ? t("todo.diff.removed", { count: previousByTitle.size }) : null
4124
+ ].filter((part) => part !== null).join(" · ") || t("todo.diff.noChanges"),
4125
+ details: {
4126
+ items,
4127
+ caption: t(previous === null ? "todo.diff.initial" : "todo.diff.compare"),
4128
+ empty: current.items.length === 0 && previous === null ? t("detail.todo.empty") : t("todo.diff.noChanges"),
4129
+ ...unchanged.length === 0 ? {} : { unchanged: {
4130
+ label: t("todo.diff.unchanged", { count: unchanged.length }),
4131
+ items: unchanged
4132
+ } }
4133
+ }
4134
+ };
4135
+ }
4136
+ //#endregion
4137
+ //#region lib/types/client/tool/toolviews/plan-summary.js
4138
+ /**
4139
+ * Pure plan derivation for the todo_write row's one-line summary. Several items
4140
+ * may be `in_progress` at once — parallel work runs concurrent tasks, so a
4141
+ * summary built from one active item would silently drop the rest. The plan
4142
+ * strip header derives its own counts inline and shares nothing with this, so
4143
+ * this stays inside the toolviews domain rather than in `contract/` (the
4144
+ * inter-domain face).
4145
+ * @module
4146
+ */
4147
+ /**
4148
+ * Derive the counts and the active summary from a whole-list snapshot. It names
4149
+ * the first `in_progress` item and counts the remaining active ones, so a
4150
+ * parallel plan reports how many tasks are running rather than naming one and
4151
+ * hiding the others. `activeContent` is null when nothing is in progress, or
4152
+ * when the first active item's content is missing, mistyped, or blank once
4153
+ * trimmed — the tool's own rule for usable content, applied here because a
4154
+ * rejected call keeps its args verbatim. The row then renders the counts alone
4155
+ * rather than falling back to the generic tool summary: the counts are already
4156
+ * known to be good, and the active-item clause is the only part an unusable
2236
4157
  * name costs.
2237
4158
  * @param todos - the whole list, in model order.
2238
4159
  * @returns the done/total counts and the two summary halves.
@@ -2254,6 +4175,7 @@ window.__ModuleLoader__.load({
2254
4175
  return typeof value === "object" && value !== null;
2255
4176
  }
2256
4177
  function summarize(argsRaw, t) {
4178
+ if (argsRaw === null) return null;
2257
4179
  let parsed;
2258
4180
  try {
2259
4181
  parsed = JSON.parse(argsRaw);
@@ -2274,22 +4196,32 @@ window.__ModuleLoader__.load({
2274
4196
  };
2275
4197
  }
2276
4198
  /** Summarizes a plan update without presenting a cancelled call as completed. */
2277
- function TodoRow({ toolName, block, inspect, t }) {
4199
+ function TodoRow({ toolName, block, inspect, useDisclosure, useTodoHistory, useSession, t }) {
4200
+ const baseline = useTodoHistory((snapshot) => snapshot?.get(block.callId));
4201
+ const hasMore = useSession((snapshot) => snapshot.hasMore);
4202
+ const diff = (0, react.useMemo)(() => todoDiffModel(block, baseline, hasMore, t), [
4203
+ block,
4204
+ baseline,
4205
+ hasMore,
4206
+ t
4207
+ ]);
2278
4208
  const model = toolRowModel(toolName, block);
2279
- const summary = summarize(("kind" in block ? block.call?.argsRaw : block.argsRaw) ?? "", t) ?? {
4209
+ const summary = summarize(model.bodyRaw, t) ?? {
2280
4210
  text: model.summary,
2281
4211
  extra: 0
2282
4212
  };
2283
4213
  return (0, react_jsx_runtime.jsx)(ToolRow, {
4214
+ useDisclosure,
2284
4215
  t,
2285
4216
  variant: model.variant,
2286
4217
  toolName,
2287
- icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChecklistOutline14, {}),
2288
- title: t("todo.rowTitle"),
4218
+ icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChecklistOutlineRegular, {}),
4219
+ title: t(model.titleKey),
2289
4220
  summary: summary.text,
2290
- summarySuffix: summary.extra > 0 ? `+${summary.extra}` : null,
4221
+ summarySuffix: [diff?.summary, summary.extra > 0 ? `+${summary.extra}` : null].filter((part) => part !== null && part !== void 0).join(" · ") || null,
2291
4222
  bodyRaw: model.bodyRaw,
2292
4223
  output: model.output,
4224
+ details: diff?.details,
2293
4225
  errorSummary: model.errorSummary,
2294
4226
  state: model.state,
2295
4227
  inspect
@@ -2298,12 +4230,14 @@ window.__ModuleLoader__.load({
2298
4230
  /** Registers the todo conversation row. */
2299
4231
  const todoToolview = {
2300
4232
  name: "todo-toolview",
2301
- inject: ["slots"],
4233
+ inject: ["slots", "uiConversation"],
2302
4234
  apply(ctx) {
4235
+ registerTodoHistory(ctx);
2303
4236
  ctx.slots.inject("tool.call.toolview", () => ctx.slots.register({
2304
4237
  name: "tool.call.toolview",
2305
4238
  key: "todo_write",
2306
- locale: CONVERSATION_NS
4239
+ locale: CONVERSATION_NS,
4240
+ inject: (sessionId) => ({ hooks: { todoHistory: ctx.uiConversation.binding(sessionId).target("tool-todo-history") } })
2307
4241
  }, TodoRow));
2308
4242
  }
2309
4243
  };
@@ -2314,11 +4248,12 @@ window.__ModuleLoader__.load({
2314
4248
  web_fetch: "tool.title.webFetch"
2315
4249
  };
2316
4250
  /** Lets users expand a completed web search or fetch result. */
2317
- function WebRow({ toolName, block, inspect, t }) {
4251
+ function WebRow({ toolName, block, inspect, useDisclosure, t }) {
2318
4252
  const model = toolRowModel(toolName, block);
2319
4253
  const web = webCardModel(block);
2320
- const icon = toolName === "web_fetch" ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBrowseOutline16, { size: 14 }) : (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconGlobeOutline14, { size: 14 });
4254
+ const icon = toolName === "web_fetch" ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBrowseOutlineRegular, { size: 14 }) : (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconGlobeOutlineRegular, { size: 14 });
2321
4255
  return (0, react_jsx_runtime.jsx)(ToolRow, {
4256
+ useDisclosure,
2322
4257
  t,
2323
4258
  variant: model.variant,
2324
4259
  toolName,
@@ -2328,6 +4263,7 @@ window.__ModuleLoader__.load({
2328
4263
  output: model.output,
2329
4264
  errorSummary: model.errorSummary,
2330
4265
  web,
4266
+ href: webFetchHref(block),
2331
4267
  state: model.state,
2332
4268
  inspect
2333
4269
  });
@@ -2371,7 +4307,8 @@ window.__ModuleLoader__.load({
2371
4307
  locale: CONVERSATION_NS,
2372
4308
  children: { "tool.call.toolview": {
2373
4309
  kind: "keyed",
2374
- scope: "session"
4310
+ scope: "session",
4311
+ inject: { hooks: { toolCallArgumentsPartial: bindToolCallArgumentsPartial } }
2375
4312
  } },
2376
4313
  inject: toolInject
2377
4314
  }, ToolCallTree));
@@ -2382,6 +4319,7 @@ window.__ModuleLoader__.load({
2382
4319
  ctx.plugin(searchToolview);
2383
4320
  ctx.plugin(webToolview);
2384
4321
  ctx.plugin(todoToolview);
4322
+ ctx.plugin(detailsToolview);
2385
4323
  ctx.plugin(askQuestionToolview);
2386
4324
  }
2387
4325
  //#endregion