@mcp-b/react-components 0.74.0 → 0.75.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -31,17 +31,14 @@ function toolFailurePanel(part, label) {
31
31
  });
32
32
  return null;
33
33
  }
34
- function prefixLines(text, prefix) {
35
- return text.split("\n").map((line) => `${prefix}${line}`).join("\n");
36
- }
37
- /** Default panels for the Think workspace tools, Claude Code-style: read/write
38
- show the file with line numbers, edit shows a mini diff, list/find/grep
39
- show their result lists, bash gets the shell panel. Everything is typed by
40
- the upstream tool contract. */
34
+ /** Default panels for the workspace tools, Claude Code-style: read/write show
35
+ the file, edit shows upstream's line-numbered diff, ls/find/grep show
36
+ their pages of results, and exec or a host's bash get the shell panel.
37
+ Every field comes from the tool contract in ThinkChatToolParts. */
41
38
  function ThinkChatWorkspacePanel(t0) {
42
- const $ = c(16);
39
+ const $ = c(18);
43
40
  const { part } = t0;
44
- if (part.type === "tool-bash") {
41
+ if (part.type === "tool-exec" || part.type === "tool-bash") {
45
42
  let t1;
46
43
  if ($[0] !== part) {
47
44
  t1 = /* @__PURE__ */ jsx(ThinkChatShellPanel, { part });
@@ -86,7 +83,7 @@ function ThinkChatWorkspacePanel(t0) {
86
83
  } else t2 = $[9];
87
84
  return t2;
88
85
  }
89
- case "tool-list": {
86
+ case "tool-ls": {
90
87
  let t2;
91
88
  if ($[10] !== part) {
92
89
  t2 = /* @__PURE__ */ jsx(WorkspaceListPanel, { part });
@@ -113,82 +110,128 @@ function ThinkChatWorkspacePanel(t0) {
113
110
  } else t2 = $[15];
114
111
  return t2;
115
112
  }
113
+ case "tool-publish": {
114
+ let t2;
115
+ if ($[16] !== part) {
116
+ t2 = /* @__PURE__ */ jsx(WorkspacePublishPanel, { part });
117
+ $[16] = part;
118
+ $[17] = t2;
119
+ } else t2 = $[17];
120
+ return t2;
121
+ }
116
122
  default: return null;
117
123
  }
118
124
  }
125
+ function WorkspaceErrorPanel(t0) {
126
+ const $ = c(5);
127
+ const { label, error } = t0;
128
+ let t1;
129
+ if ($[0] !== error) {
130
+ t1 = executionErrorSummary(error);
131
+ $[0] = error;
132
+ $[1] = t1;
133
+ } else t1 = $[1];
134
+ let t2;
135
+ if ($[2] !== label || $[3] !== t1) {
136
+ t2 = /* @__PURE__ */ jsx(ActivityPanel, {
137
+ label,
138
+ text: t1,
139
+ status: "error",
140
+ error: true
141
+ });
142
+ $[2] = label;
143
+ $[3] = t1;
144
+ $[4] = t2;
145
+ } else t2 = $[4];
146
+ return t2;
147
+ }
148
+ /** "120 entries", plus where the next page starts when there is one. */
149
+ function pageStatus(count, noun, nextOffset) {
150
+ const counted = `${count} ${noun}`;
151
+ return nextOffset === void 0 ? counted : `${counted} · more from ${nextOffset}`;
152
+ }
119
153
  function WorkspaceReadPanel(t0) {
120
- const $ = c(14);
154
+ const $ = c(13);
121
155
  const { part } = t0;
122
156
  const label = part.input?.path ?? "file";
123
157
  const output = part.state === "output-available" ? part.output : void 0;
124
- if (output && "error" in output) {
158
+ if (output === void 0) {
125
159
  let t1;
126
- if ($[0] !== output.error) {
127
- t1 = executionErrorSummary(output.error);
128
- $[0] = output.error;
160
+ if ($[0] !== label) {
161
+ t1 = /* @__PURE__ */ jsx(ActivityPanel, { label });
162
+ $[0] = label;
129
163
  $[1] = t1;
130
164
  } else t1 = $[1];
131
- let t2;
132
- if ($[2] !== label || $[3] !== t1) {
133
- t2 = /* @__PURE__ */ jsx(ActivityPanel, {
134
- label,
135
- text: t1,
136
- status: "error",
137
- error: true
138
- });
139
- $[2] = label;
140
- $[3] = t1;
141
- $[4] = t2;
142
- } else t2 = $[4];
143
- return t2;
165
+ return t1;
144
166
  }
145
- if (output && "content" in output) {
146
- const t1 = `${output.totalLines} lines`;
147
- let t2;
148
- if ($[5] !== label || $[6] !== output.content || $[7] !== t1) {
149
- t2 = /* @__PURE__ */ jsx(ActivityPanel, {
167
+ if ("error" in output) {
168
+ let t1;
169
+ if ($[2] !== label || $[3] !== output.error) {
170
+ t1 = /* @__PURE__ */ jsx(WorkspaceErrorPanel, {
150
171
  label,
151
- text: output.content,
152
- status: t1
172
+ error: output.error
153
173
  });
154
- $[5] = label;
155
- $[6] = output.content;
156
- $[7] = t1;
157
- $[8] = t2;
158
- } else t2 = $[8];
159
- return t2;
174
+ $[2] = label;
175
+ $[3] = output.error;
176
+ $[4] = t1;
177
+ } else t1 = $[4];
178
+ return t1;
160
179
  }
161
- if (output) {
180
+ if ("kind" in output) {
162
181
  const t1 = `${output.name} · ${output.mediaType} · ${output.sizeBytes} bytes`;
163
- let t2;
164
- if ($[9] !== label || $[10] !== t1) {
165
- t2 = /* @__PURE__ */ jsx(ActivityPanel, {
182
+ const t2 = output.unsupported ? "unsupported" : void 0;
183
+ let t3;
184
+ if ($[5] !== label || $[6] !== t1 || $[7] !== t2) {
185
+ t3 = /* @__PURE__ */ jsx(ActivityPanel, {
166
186
  label,
167
- text: t1
187
+ text: t1,
188
+ status: t2
168
189
  });
169
- $[9] = label;
170
- $[10] = t1;
171
- $[11] = t2;
172
- } else t2 = $[11];
173
- return t2;
190
+ $[5] = label;
191
+ $[6] = t1;
192
+ $[7] = t2;
193
+ $[8] = t3;
194
+ } else t3 = $[8];
195
+ return t3;
174
196
  }
175
- let t1;
176
- if ($[12] !== label) {
177
- t1 = /* @__PURE__ */ jsx(ActivityPanel, { label });
178
- $[12] = label;
179
- $[13] = t1;
180
- } else t1 = $[13];
181
- return t1;
197
+ const lines = output.totalLines === null ? `lines ${output.startLine}–${output.endLine}` : `${output.totalLines} lines`;
198
+ const t1 = output.nextOffset === void 0 ? lines : `${lines} · more from line ${output.nextOffset}`;
199
+ let t2;
200
+ if ($[9] !== label || $[10] !== output.content || $[11] !== t1) {
201
+ t2 = /* @__PURE__ */ jsx(ActivityPanel, {
202
+ label,
203
+ text: output.content,
204
+ status: t1
205
+ });
206
+ $[9] = label;
207
+ $[10] = output.content;
208
+ $[11] = t1;
209
+ $[12] = t2;
210
+ } else t2 = $[12];
211
+ return t2;
182
212
  }
183
213
  function WorkspaceWritePanel(t0) {
184
- const $ = c(8);
214
+ const $ = c(11);
185
215
  const { part } = t0;
186
216
  const path = part.input?.path ?? "file";
187
217
  const content = part.input?.content;
188
218
  const output = part.state === "output-available" ? part.output : void 0;
189
- const t1 = output ? `${output.lines} lines written` : void 0;
219
+ if (output && "error" in output) {
220
+ let t1;
221
+ if ($[0] !== output.error || $[1] !== path) {
222
+ t1 = /* @__PURE__ */ jsx(WorkspaceErrorPanel, {
223
+ label: path,
224
+ error: output.error
225
+ });
226
+ $[0] = output.error;
227
+ $[1] = path;
228
+ $[2] = t1;
229
+ } else t1 = $[2];
230
+ return t1;
231
+ }
232
+ const t1 = output ? `${output.bytesWritten} bytes written` : void 0;
190
233
  let t2;
191
- if ($[0] !== content || $[1] !== part.state || $[2] !== path) {
234
+ if ($[3] !== content || $[4] !== part.state || $[5] !== path) {
192
235
  t2 = content !== void 0 ? /* @__PURE__ */ jsx(CodeBlock, {
193
236
  surface: "plain",
194
237
  wrap: true,
@@ -198,171 +241,320 @@ function WorkspaceWritePanel(t0) {
198
241
  showLineNumbers: true,
199
242
  children: /* @__PURE__ */ jsx(CodeBlockContainer, { children: /* @__PURE__ */ jsx(CodeBlockContent, {}) })
200
243
  }) : null;
201
- $[0] = content;
202
- $[1] = part.state;
203
- $[2] = path;
204
- $[3] = t2;
205
- } else t2 = $[3];
244
+ $[3] = content;
245
+ $[4] = part.state;
246
+ $[5] = path;
247
+ $[6] = t2;
248
+ } else t2 = $[6];
206
249
  let t3;
207
- if ($[4] !== path || $[5] !== t1 || $[6] !== t2) {
250
+ if ($[7] !== path || $[8] !== t1 || $[9] !== t2) {
208
251
  t3 = /* @__PURE__ */ jsx(ActivityPanel, {
209
252
  label: path,
210
253
  status: t1,
211
254
  children: t2
212
255
  });
213
- $[4] = path;
214
- $[5] = t1;
215
- $[6] = t2;
216
- $[7] = t3;
217
- } else t3 = $[7];
256
+ $[7] = path;
257
+ $[8] = t1;
258
+ $[9] = t2;
259
+ $[10] = t3;
260
+ } else t3 = $[10];
218
261
  return t3;
219
262
  }
263
+ /** Upstream's display diff marks each line `+`, `-` or space. */
264
+ function DiffLines(t0) {
265
+ const $ = c(4);
266
+ const { diff } = t0;
267
+ let t1;
268
+ if ($[0] !== diff) {
269
+ t1 = diff.split("\n").map(_temp);
270
+ $[0] = diff;
271
+ $[1] = t1;
272
+ } else t1 = $[1];
273
+ let t2;
274
+ if ($[2] !== t1) {
275
+ t2 = /* @__PURE__ */ jsx(ActivityOutput, { children: t1 });
276
+ $[2] = t1;
277
+ $[3] = t2;
278
+ } else t2 = $[3];
279
+ return t2;
280
+ }
281
+ function _temp(line, index) {
282
+ return /* @__PURE__ */ jsxs(React.Fragment, { children: [index > 0 ? "\n" : null, line.startsWith("+") ? /* @__PURE__ */ jsx("span", {
283
+ className: "think-chat-tool-panels__diff-add",
284
+ children: line
285
+ }) : line.startsWith("-") ? /* @__PURE__ */ jsx("span", {
286
+ className: "think-chat-tool-panels__diff-del",
287
+ children: line
288
+ }) : line] }, index);
289
+ }
220
290
  function WorkspaceEditPanel(t0) {
221
- const $ = c(7);
291
+ const $ = c(18);
222
292
  const { part } = t0;
223
- const input = part.input;
293
+ const path = part.input?.path ?? "file";
224
294
  const output = part.state === "output-available" ? part.output : void 0;
225
- const status = !output ? void 0 : output.error ? output.error : output.created ? "created" : output.fuzzyMatch ? "replaced (fuzzy match)" : "replaced";
226
- const t1 = input?.path ?? "file";
227
- const t2 = Boolean(output?.error);
295
+ if (output && "error" in output) {
296
+ let t1;
297
+ if ($[0] !== output.error || $[1] !== path) {
298
+ t1 = /* @__PURE__ */ jsx(WorkspaceErrorPanel, {
299
+ label: path,
300
+ error: output.error
301
+ });
302
+ $[0] = output.error;
303
+ $[1] = path;
304
+ $[2] = t1;
305
+ } else t1 = $[2];
306
+ return t1;
307
+ }
308
+ if (output) {
309
+ const applied = `${output.editsApplied} ${output.editsApplied === 1 ? "edit" : "edits"} applied`;
310
+ const t1 = output.diffTruncated ? `${applied} · diff truncated` : applied;
311
+ let t2;
312
+ if ($[3] !== output.diff) {
313
+ t2 = output.diff ? /* @__PURE__ */ jsx(DiffLines, { diff: output.diff }) : null;
314
+ $[3] = output.diff;
315
+ $[4] = t2;
316
+ } else t2 = $[4];
317
+ let t3;
318
+ if ($[5] !== path || $[6] !== t1 || $[7] !== t2) {
319
+ t3 = /* @__PURE__ */ jsx(ActivityPanel, {
320
+ label: path,
321
+ status: t1,
322
+ children: t2
323
+ });
324
+ $[5] = path;
325
+ $[6] = t1;
326
+ $[7] = t2;
327
+ $[8] = t3;
328
+ } else t3 = $[8];
329
+ return t3;
330
+ }
331
+ let t1;
332
+ if ($[9] !== part.input?.edits) {
333
+ t1 = part.input?.edits ?? [];
334
+ $[9] = part.input?.edits;
335
+ $[10] = t1;
336
+ } else t1 = $[10];
337
+ const edits = t1;
338
+ let t2;
339
+ if ($[11] !== edits) {
340
+ t2 = edits.flatMap(_temp4).join("\n");
341
+ $[11] = edits;
342
+ $[12] = t2;
343
+ } else t2 = $[12];
344
+ const requested = t2;
228
345
  let t3;
229
- if ($[0] !== input) {
230
- t3 = input?.old_string !== void 0 && input.new_string !== void 0 ? /* @__PURE__ */ jsxs(ActivityOutput, { children: [
231
- /* @__PURE__ */ jsx("span", {
232
- className: "think-chat-tool-panels__diff-del",
233
- children: prefixLines(input.old_string, "- ")
234
- }),
235
- "\n",
236
- /* @__PURE__ */ jsx("span", {
237
- className: "think-chat-tool-panels__diff-add",
238
- children: prefixLines(input.new_string, "+ ")
239
- })
240
- ] }) : null;
241
- $[0] = input;
242
- $[1] = t3;
243
- } else t3 = $[1];
346
+ if ($[13] !== requested) {
347
+ t3 = requested ? /* @__PURE__ */ jsx(DiffLines, { diff: requested }) : null;
348
+ $[13] = requested;
349
+ $[14] = t3;
350
+ } else t3 = $[14];
244
351
  let t4;
245
- if ($[2] !== status || $[3] !== t1 || $[4] !== t2 || $[5] !== t3) {
352
+ if ($[15] !== path || $[16] !== t3) {
246
353
  t4 = /* @__PURE__ */ jsx(ActivityPanel, {
247
- label: t1,
248
- status,
249
- error: t2,
354
+ label: path,
250
355
  children: t3
251
356
  });
252
- $[2] = status;
253
- $[3] = t1;
254
- $[4] = t2;
255
- $[5] = t3;
256
- $[6] = t4;
257
- } else t4 = $[6];
357
+ $[15] = path;
358
+ $[16] = t3;
359
+ $[17] = t4;
360
+ } else t4 = $[17];
258
361
  return t4;
259
362
  }
363
+ function _temp4(edit) {
364
+ return [...(edit?.oldText ?? "").split("\n").map(_temp2), ...(edit?.newText ?? "").split("\n").map(_temp3)];
365
+ }
366
+ function _temp3(line_0) {
367
+ return `+ ${line_0}`;
368
+ }
369
+ function _temp2(line) {
370
+ return `- ${line}`;
371
+ }
260
372
  function WorkspaceListPanel(t0) {
261
- const $ = c(6);
373
+ const $ = c(11);
262
374
  const { part } = t0;
375
+ const label = part.input?.path ?? "/";
263
376
  const output = part.state === "output-available" ? part.output : void 0;
264
- const t1 = part.input?.path ?? "/";
377
+ if (output && "error" in output) {
378
+ let t1;
379
+ if ($[0] !== label || $[1] !== output.error) {
380
+ t1 = /* @__PURE__ */ jsx(WorkspaceErrorPanel, {
381
+ label,
382
+ error: output.error
383
+ });
384
+ $[0] = label;
385
+ $[1] = output.error;
386
+ $[2] = t1;
387
+ } else t1 = $[2];
388
+ return t1;
389
+ }
390
+ let t1;
391
+ if ($[3] !== output?.entries) {
392
+ t1 = output?.entries.map(_temp5).join("\n");
393
+ $[3] = output?.entries;
394
+ $[4] = t1;
395
+ } else t1 = $[4];
265
396
  let t2;
266
- if ($[0] !== output?.entries) {
267
- t2 = output?.entries.join("\n");
268
- $[0] = output?.entries;
269
- $[1] = t2;
270
- } else t2 = $[1];
271
- const t3 = output ? `${output.count} entries` : void 0;
272
- let t4;
273
- if ($[2] !== t1 || $[3] !== t2 || $[4] !== t3) {
274
- t4 = /* @__PURE__ */ jsx(ActivityPanel, {
275
- label: t1,
276
- text: t2,
277
- status: t3
397
+ if ($[5] !== output) {
398
+ t2 = output ? pageStatus(output.count, "entries", output.nextOffset) : void 0;
399
+ $[5] = output;
400
+ $[6] = t2;
401
+ } else t2 = $[6];
402
+ let t3;
403
+ if ($[7] !== label || $[8] !== t1 || $[9] !== t2) {
404
+ t3 = /* @__PURE__ */ jsx(ActivityPanel, {
405
+ label,
406
+ text: t1,
407
+ status: t2
278
408
  });
279
- $[2] = t1;
280
- $[3] = t2;
281
- $[4] = t3;
282
- $[5] = t4;
283
- } else t4 = $[5];
284
- return t4;
409
+ $[7] = label;
410
+ $[8] = t1;
411
+ $[9] = t2;
412
+ $[10] = t3;
413
+ } else t3 = $[10];
414
+ return t3;
415
+ }
416
+ function _temp5(entry) {
417
+ return entry.isDirectory ? `${entry.name}/` : entry.name;
285
418
  }
286
419
  function WorkspaceFindPanel(t0) {
287
420
  const $ = c(11);
288
421
  const { part } = t0;
422
+ const label = part.input?.pattern ?? "files";
289
423
  const output = part.state === "output-available" ? part.output : void 0;
290
- let T0;
291
- let count;
424
+ if (output && "error" in output) {
425
+ let t1;
426
+ if ($[0] !== label || $[1] !== output.error) {
427
+ t1 = /* @__PURE__ */ jsx(WorkspaceErrorPanel, {
428
+ label,
429
+ error: output.error
430
+ });
431
+ $[0] = label;
432
+ $[1] = output.error;
433
+ $[2] = t1;
434
+ } else t1 = $[2];
435
+ return t1;
436
+ }
292
437
  let t1;
293
- let t2;
294
- if ($[0] !== output || $[1] !== part.input?.pattern) {
295
- const files = Array.isArray(output?.files) ? output.files.map(String) : [];
296
- count = typeof output?.count === "number" ? output.count : files.length;
297
- T0 = ActivityPanel;
298
- t1 = part.input?.pattern ?? "files";
299
- t2 = files.join("\n");
300
- $[0] = output;
301
- $[1] = part.input?.pattern;
302
- $[2] = T0;
303
- $[3] = count;
438
+ if ($[3] !== output?.entries) {
439
+ t1 = output?.entries.map(_temp6).join("\n");
440
+ $[3] = output?.entries;
304
441
  $[4] = t1;
305
- $[5] = t2;
306
- } else {
307
- T0 = $[2];
308
- count = $[3];
309
- t1 = $[4];
310
- t2 = $[5];
311
- }
312
- const t3 = output ? `${count} files${output.truncated ? " (truncated)" : ""}` : void 0;
313
- let t4;
314
- if ($[6] !== T0 || $[7] !== t1 || $[8] !== t2 || $[9] !== t3) {
315
- t4 = /* @__PURE__ */ jsx(T0, {
316
- label: t1,
317
- text: t2,
318
- status: t3
442
+ } else t1 = $[4];
443
+ let t2;
444
+ if ($[5] !== output) {
445
+ t2 = output ? pageStatus(output.count, "matches", output.nextOffset) : void 0;
446
+ $[5] = output;
447
+ $[6] = t2;
448
+ } else t2 = $[6];
449
+ let t3;
450
+ if ($[7] !== label || $[8] !== t1 || $[9] !== t2) {
451
+ t3 = /* @__PURE__ */ jsx(ActivityPanel, {
452
+ label,
453
+ text: t1,
454
+ status: t2
319
455
  });
320
- $[6] = T0;
321
- $[7] = t1;
322
- $[8] = t2;
323
- $[9] = t3;
324
- $[10] = t4;
325
- } else t4 = $[10];
326
- return t4;
456
+ $[7] = label;
457
+ $[8] = t1;
458
+ $[9] = t2;
459
+ $[10] = t3;
460
+ } else t3 = $[10];
461
+ return t3;
327
462
  }
463
+ function _temp6(entry) {
464
+ return entry.type === "dir" ? `${entry.path}/` : entry.path;
465
+ }
466
+ /** grep -n style: `path:line:text` for a match, `path-line-text` for context. */
328
467
  function WorkspaceGrepPanel(t0) {
329
- const $ = c(8);
468
+ const $ = c(11);
330
469
  const { part } = t0;
470
+ const label = part.input?.query ?? "search";
331
471
  const output = part.state === "output-available" ? part.output : void 0;
472
+ if (output && "error" in output) {
473
+ let t1;
474
+ if ($[0] !== label || $[1] !== output.error) {
475
+ t1 = /* @__PURE__ */ jsx(WorkspaceErrorPanel, {
476
+ label,
477
+ error: output.error
478
+ });
479
+ $[0] = label;
480
+ $[1] = output.error;
481
+ $[2] = t1;
482
+ } else t1 = $[2];
483
+ return t1;
484
+ }
332
485
  let t1;
333
- if ($[0] !== output) {
334
- t1 = Array.isArray(output?.matches) ? output.matches.map(_temp) : [];
335
- $[0] = output;
336
- $[1] = t1;
337
- } else t1 = $[1];
338
- const matches = t1;
339
- const status = output && typeof output.totalMatches === "number" ? `${output.totalMatches} matches in ${String(output.filesWithMatches)} files` : void 0;
340
- const t2 = part.input?.query ?? "search";
486
+ if ($[3] !== output?.matches) {
487
+ t1 = output?.matches.flatMap(_temp7).join("\n");
488
+ $[3] = output?.matches;
489
+ $[4] = t1;
490
+ } else t1 = $[4];
491
+ const text = t1;
492
+ let t2;
493
+ if ($[5] !== output) {
494
+ t2 = output ? pageStatus(output.count, "matches", output.nextOffset) : void 0;
495
+ $[5] = output;
496
+ $[6] = t2;
497
+ } else t2 = $[6];
341
498
  let t3;
342
- if ($[2] !== matches) {
343
- t3 = matches.length ? /* @__PURE__ */ jsx(ExecutionResult, {
344
- result: matches,
345
- showSummary: false
346
- }) : null;
347
- $[2] = matches;
348
- $[3] = t3;
349
- } else t3 = $[3];
350
- let t4;
351
- if ($[4] !== status || $[5] !== t2 || $[6] !== t3) {
352
- t4 = /* @__PURE__ */ jsx(ActivityPanel, {
353
- label: t2,
354
- status,
355
- children: t3
499
+ if ($[7] !== label || $[8] !== t2 || $[9] !== text) {
500
+ t3 = /* @__PURE__ */ jsx(ActivityPanel, {
501
+ label,
502
+ text,
503
+ status: t2
356
504
  });
357
- $[4] = status;
358
- $[5] = t2;
359
- $[6] = t3;
360
- $[7] = t4;
361
- } else t4 = $[7];
362
- return t4;
505
+ $[7] = label;
506
+ $[8] = t2;
507
+ $[9] = text;
508
+ $[10] = t3;
509
+ } else t3 = $[10];
510
+ return t3;
363
511
  }
364
- function _temp(match) {
365
- return match != null && typeof match === "object" && "context" in match ? match.context : match;
512
+ function _temp7(match) {
513
+ return match.context?.length ? match.context.map((line) => `${match.path}${line.isMatch ? ":" : "-"}${line.line}${line.isMatch ? ":" : "-"}${line.text}`) : [`${match.path}:${match.line}:${match.text}`];
514
+ }
515
+ function WorkspacePublishPanel(t0) {
516
+ const $ = c(9);
517
+ const { part } = t0;
518
+ const label = part.input?.path ?? "file";
519
+ const output = part.state === "output-available" ? part.output : void 0;
520
+ if (output && !output.ok) {
521
+ let t1;
522
+ if ($[0] !== label || $[1] !== output.error) {
523
+ t1 = /* @__PURE__ */ jsx(WorkspaceErrorPanel, {
524
+ label,
525
+ error: output.error
526
+ });
527
+ $[0] = label;
528
+ $[1] = output.error;
529
+ $[2] = t1;
530
+ } else t1 = $[2];
531
+ return t1;
532
+ }
533
+ const t1 = output ? "published" : void 0;
534
+ let t2;
535
+ if ($[3] !== output) {
536
+ t2 = output ? /* @__PURE__ */ jsx(ActivityOutput, { children: /* @__PURE__ */ jsx("a", {
537
+ href: output.url,
538
+ target: "_blank",
539
+ rel: "noreferrer",
540
+ children: output.url
541
+ }) }) : null;
542
+ $[3] = output;
543
+ $[4] = t2;
544
+ } else t2 = $[4];
545
+ let t3;
546
+ if ($[5] !== label || $[6] !== t1 || $[7] !== t2) {
547
+ t3 = /* @__PURE__ */ jsx(ActivityPanel, {
548
+ label,
549
+ status: t1,
550
+ children: t2
551
+ });
552
+ $[5] = label;
553
+ $[6] = t1;
554
+ $[7] = t2;
555
+ $[8] = t3;
556
+ } else t3 = $[8];
557
+ return t3;
366
558
  }
367
559
  /** Skill panels show what the model actually received: the activated skill's
368
560
  body, the resource text, or the script result. */
@@ -718,7 +910,7 @@ function ExecuteCodeView(t0) {
718
910
  if ($[9] !== calls?.length || $[10] !== output) {
719
911
  t5 = output?.status === "paused" && !calls?.length ? /* @__PURE__ */ jsx("ol", {
720
912
  className: "think-chat-tool-panels__call-audit-list",
721
- children: output.pending.map(_temp2)
913
+ children: output.pending.map(_temp8)
722
914
  }) : null;
723
915
  $[9] = calls?.length;
724
916
  $[10] = output;
@@ -754,7 +946,7 @@ function ExecuteCodeView(t0) {
754
946
  } else t7 = $[21];
755
947
  return t7;
756
948
  }
757
- function _temp2(action) {
949
+ function _temp8(action) {
758
950
  return /* @__PURE__ */ jsxs("li", { children: [/* @__PURE__ */ jsx("span", { children: pendingActionLabel(action) }), action.args !== void 0 ? /* @__PURE__ */ jsx(ExecutionResult, {
759
951
  result: action.args,
760
952
  showSummary: false
@@ -801,7 +993,7 @@ function ToolCallAudit(t0) {
801
993
  } else t1 = $[0];
802
994
  let t2;
803
995
  if ($[1] !== calls) {
804
- t2 = calls.map(_temp3);
996
+ t2 = calls.map(_temp9);
805
997
  $[1] = calls;
806
998
  $[2] = t2;
807
999
  } else t2 = $[2];
@@ -819,7 +1011,7 @@ function ToolCallAudit(t0) {
819
1011
  } else t3 = $[4];
820
1012
  return t3;
821
1013
  }
822
- function _temp3(call) {
1014
+ function _temp9(call) {
823
1015
  return /* @__PURE__ */ jsxs("li", {
824
1016
  className: "think-chat-tool-panels__call-audit-item",
825
1017
  "data-state": call.state,
@@ -1016,7 +1208,7 @@ function ThinkChatFollowUpPanel(t0) {
1016
1208
  const t4 = receipt.followUps.length === 0 ? "No follow-ups scheduled" : `${receipt.followUps.length} scheduled`;
1017
1209
  const t5 = receipt.followUps.length ? /* @__PURE__ */ jsx("ol", {
1018
1210
  className: "think-chat-tool-panels__follow-up-list",
1019
- children: receipt.followUps.map(_temp4)
1211
+ children: receipt.followUps.map(_temp10)
1020
1212
  }) : null;
1021
1213
  let t6;
1022
1214
  if ($[17] !== t4 || $[18] !== t5) {
@@ -1054,7 +1246,7 @@ function ThinkChatFollowUpPanel(t0) {
1054
1246
  } else t5 = $[21];
1055
1247
  return t5;
1056
1248
  }
1057
- function _temp4(item) {
1249
+ function _temp10(item) {
1058
1250
  return /* @__PURE__ */ jsxs("li", { children: [/* @__PURE__ */ jsx("time", {
1059
1251
  dateTime: item.scheduledFor,
1060
1252
  children: formatFollowUpDateTime(item.scheduledFor)
@@ -1504,7 +1696,7 @@ function ThinkChatExecutePanel(t0) {
1504
1696
  function ThinkChatBrowserPanel(t0) {
1505
1697
  const $ = c(13);
1506
1698
  const { part } = t0;
1507
- const [seenAt] = React.useState(_temp5);
1699
+ const [seenAt] = React.useState(_temp11);
1508
1700
  let t1;
1509
1701
  if ($[0] !== part) {
1510
1702
  t1 = toolFailurePanel(part, "Browser");
@@ -1558,7 +1750,7 @@ function ThinkChatBrowserPanel(t0) {
1558
1750
  } else t4 = $[12];
1559
1751
  return t4;
1560
1752
  }
1561
- function _temp5() {
1753
+ function _temp11() {
1562
1754
  return Date.now();
1563
1755
  }
1564
1756
  function ThinkChatBrowserExecutePanel(t0) {
@@ -1668,74 +1860,126 @@ function ThinkChatBrowserExecutePanel(t0) {
1668
1860
  } else t8 = $[20];
1669
1861
  return t8;
1670
1862
  }
1863
+ /** One shell panel for upstream `exec` and a host's `bash`: the command, its
1864
+ output streams, and its exit status. */
1671
1865
  function ThinkChatShellPanel(t0) {
1672
- const $ = c(12);
1866
+ const $ = c(25);
1673
1867
  const { part } = t0;
1674
- const output = part.state === "output-available" ? part.output : void 0;
1675
1868
  const errorText = part.state === "output-error" ? part.errorText : "";
1676
1869
  const deniedReason = part.state === "output-denied" || part.state === "approval-responded" && !part.approval.approved ? part.approval.reason ?? "denied" : "";
1677
- const failed = Boolean(errorText) || Boolean(deniedReason) || output !== void 0 && (output.exitCode !== 0 || Boolean(output.errors?.length));
1678
- const t1 = errorText || deniedReason;
1870
+ let run;
1871
+ let status;
1872
+ let t1;
1679
1873
  let t2;
1680
- if ($[0] !== output || $[1] !== part.input || $[2] !== t1) {
1681
- t2 = formatBashPanelText(part.input, output, t1);
1682
- $[0] = output;
1683
- $[1] = part.input;
1684
- $[2] = t1;
1685
- $[3] = t2;
1686
- } else t2 = $[3];
1687
- const text = t2;
1688
1874
  let t3;
1689
- if ($[4] !== deniedReason || $[5] !== errorText || $[6] !== output) {
1690
- t3 = output !== void 0 || errorText || deniedReason ? getBashStatusText(output, errorText, deniedReason) : void 0;
1691
- $[4] = deniedReason;
1692
- $[5] = errorText;
1693
- $[6] = output;
1694
- $[7] = t3;
1695
- } else t3 = $[7];
1696
1875
  let t4;
1697
- if ($[8] !== failed || $[9] !== t3 || $[10] !== text) {
1698
- t4 = /* @__PURE__ */ jsx(ActivityPanel, {
1699
- label: "Shell",
1700
- text,
1701
- status: t3,
1702
- error: failed
1876
+ if ($[0] !== deniedReason || $[1] !== errorText || $[2] !== part) {
1877
+ run = shellRun(part);
1878
+ status = errorText ? "error" : deniedReason ? "denied" : run.error !== void 0 ? "error" : run.exitCode === void 0 ? void 0 : run.exitCode === null ? "no exit code" : run.exitCode === 0 ? "success" : `exit ${run.exitCode}`;
1879
+ t1 = run.command;
1880
+ t2 = run.stdout;
1881
+ t3 = run.stderr;
1882
+ t4 = run.error === void 0 ? "" : executionErrorSummary(run.error);
1883
+ $[0] = deniedReason;
1884
+ $[1] = errorText;
1885
+ $[2] = part;
1886
+ $[3] = run;
1887
+ $[4] = status;
1888
+ $[5] = t1;
1889
+ $[6] = t2;
1890
+ $[7] = t3;
1891
+ $[8] = t4;
1892
+ } else {
1893
+ run = $[3];
1894
+ status = $[4];
1895
+ t1 = $[5];
1896
+ t2 = $[6];
1897
+ t3 = $[7];
1898
+ t4 = $[8];
1899
+ }
1900
+ const t5 = errorText || deniedReason;
1901
+ let t6;
1902
+ if ($[9] !== t1 || $[10] !== t2 || $[11] !== t3 || $[12] !== t4 || $[13] !== t5) {
1903
+ t6 = [
1904
+ t1,
1905
+ t2,
1906
+ t3,
1907
+ t4,
1908
+ t5
1909
+ ].filter(Boolean);
1910
+ $[9] = t1;
1911
+ $[10] = t2;
1912
+ $[11] = t3;
1913
+ $[12] = t4;
1914
+ $[13] = t5;
1915
+ $[14] = t6;
1916
+ } else t6 = $[14];
1917
+ const text = t6.join("\n\n");
1918
+ const t7 = status !== void 0 && status !== "success";
1919
+ let t8;
1920
+ if ($[15] !== text) {
1921
+ t8 = text ? /* @__PURE__ */ jsx(ActivityOutput, { children: text }) : null;
1922
+ $[15] = text;
1923
+ $[16] = t8;
1924
+ } else t8 = $[16];
1925
+ let t9;
1926
+ if ($[17] !== run.result) {
1927
+ t9 = run.result !== void 0 ? /* @__PURE__ */ jsx(ExecutionResult, {
1928
+ result: run.result,
1929
+ showSummary: false
1930
+ }) : null;
1931
+ $[17] = run.result;
1932
+ $[18] = t9;
1933
+ } else t9 = $[18];
1934
+ let t10;
1935
+ if ($[19] !== run.label || $[20] !== status || $[21] !== t7 || $[22] !== t8 || $[23] !== t9) {
1936
+ t10 = /* @__PURE__ */ jsxs(ActivityPanel, {
1937
+ label: run.label,
1938
+ status,
1939
+ error: t7,
1940
+ children: [t8, t9]
1703
1941
  });
1704
- $[8] = failed;
1705
- $[9] = t3;
1706
- $[10] = text;
1707
- $[11] = t4;
1708
- } else t4 = $[11];
1709
- return t4;
1710
- }
1711
- function formatBashPanelText(input, output, errorText) {
1712
- return [
1713
- input?.script?.trim() ? `$ bash\n${input.script}` : "",
1714
- output?.stdout,
1715
- output?.stderr,
1716
- errorText,
1717
- output?.skippedFiles?.length ? ["skipped files", ...output.skippedFiles].join("\n") : "",
1718
- output?.errors?.length ? ["sync errors", ...output.errors].join("\n") : "",
1719
- output ? formatChangedFiles(output.changedFiles) : ""
1720
- ].filter(Boolean).join("\n\n");
1721
- }
1722
- function formatChangedFiles(changedFiles) {
1723
- if (!changedFiles) return "";
1724
- const lines = [
1725
- ...changedFiles.created.map((path) => `created ${path}`),
1726
- ...changedFiles.updated.map((path) => `updated ${path}`),
1727
- ...changedFiles.deleted.map((path) => `deleted ${path}`),
1728
- ...changedFiles.directoriesCreated.map((path) => `created directory ${path}`),
1729
- ...changedFiles.directoriesDeleted.map((path) => `deleted directory ${path}`)
1730
- ];
1731
- return lines.length ? ["workspace changes", ...lines].join("\n") : "";
1942
+ $[19] = run.label;
1943
+ $[20] = status;
1944
+ $[21] = t7;
1945
+ $[22] = t8;
1946
+ $[23] = t9;
1947
+ $[24] = t10;
1948
+ } else t10 = $[24];
1949
+ return t10;
1732
1950
  }
1733
- function getBashStatusText(output, errorText, deniedReason) {
1734
- if (errorText) return "error";
1735
- if (deniedReason) return "denied";
1736
- if (output?.errors?.length) return "sync errors";
1737
- if (output && output.exitCode !== 0) return `exit ${output.exitCode}`;
1738
- return "success";
1951
+ /** The fields both shells share. `exitCode` is undefined until a final result. */
1952
+ function shellRun(part) {
1953
+ const settled = part.state === "output-available" && !part.preliminary;
1954
+ if (part.type === "tool-bash") {
1955
+ const output = part.state === "output-available" ? part.output : void 0;
1956
+ const script = part.input?.script?.trim();
1957
+ return {
1958
+ label: "Shell",
1959
+ command: script ? `$ bash\n${script}` : "",
1960
+ stdout: output?.stdout,
1961
+ stderr: output?.stderr,
1962
+ exitCode: settled ? output?.exitCode : void 0
1963
+ };
1964
+ }
1965
+ const exec = part.state === "output-available" ? part.output : void 0;
1966
+ const command = exec?.command ?? part.input?.command ?? "";
1967
+ const base = {
1968
+ label: exec?.backend ?? part.input?.backend ?? "Command",
1969
+ command: command ? `$ ${command}` : ""
1970
+ };
1971
+ if (exec === void 0) return base;
1972
+ if ("error" in exec) return {
1973
+ ...base,
1974
+ error: exec.error
1975
+ };
1976
+ return {
1977
+ ...base,
1978
+ stdout: exec.stdout,
1979
+ stderr: exec.stderr,
1980
+ exitCode: settled ? exec.exitCode : void 0,
1981
+ result: exec.result
1982
+ };
1739
1983
  }
1740
1984
  //#endregion
1741
1985
  export { ThinkChatBrowserPanel, ThinkChatExecutePanel, ThinkChatFetchPanel, ThinkChatFollowUpPanel, ThinkChatSessionContextPanel, ThinkChatSkillPanel, ThinkChatWorkspacePanel };