@adecore/agents-react 0.44.4 → 0.45.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.
@@ -19,6 +19,7 @@ import { useChatRow } from '../../state/chats.js';
19
19
  import { useChatPreferences } from '../preferences.js';
20
20
  import { readingWidthStyle } from '../reading-width.js';
21
21
  import { useChatHost } from '../../host.js';
22
+ import { useHostHidesToolCalls } from '../../host-hooks.js';
22
23
  import { useChatScope } from '../../scope.js';
23
24
  import { EmptyState, ContextMenu, Icon } from '@adecore/ui';
24
25
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -117,12 +118,14 @@ export function SubagentTimeline(t0) {
117
118
  t5 = $[14];
118
119
  }
119
120
  useEffect(t4, t5);
121
+ const hideTools = useHostHidesToolCalls(scope.id, chatId);
120
122
  const rows = deriveTimelineRows(state.items, {
121
123
  expandedGroups: groups.ids,
122
124
  expandedTurns: NO_TURNS,
123
125
  expandedSubagents: subagents.ids,
124
126
  activeTurnId: null,
125
- commandLooks
127
+ commandLooks,
128
+ hideTools
126
129
  });
127
130
  let t6;
128
131
  if ($[15] !== state.items) {
@@ -38,7 +38,7 @@ import { FileLinkContext } from './file-links.js';
38
38
  import { AgentIcon } from '../../agents/AgentIcon.js';
39
39
  import { useModelName } from '../../agents/model-name.js';
40
40
  import { ContextMenu, EmptyState, ErrorBoundary, Icon, SectionLabel } from '@adecore/ui';
41
- import { useHostContextSources, useHostHidesFolder, useHostThreadCards, useHostTimelineFind, useHostWelcome } from '../../host-hooks.js';
41
+ import { useHostContextSources, useHostHidesFolder, useHostHidesToolCalls, useHostThreadCards, useHostTimelineFind, useHostWelcome } from '../../host-hooks.js';
42
42
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
43
43
  const ESTIMATED_ROW_PX = 56;
44
44
  // How long a jump waits for a thread that is still loading before it calls the item missing.
@@ -476,6 +476,7 @@ export function Timeline({
476
476
  setLoadingEarlier(false);
477
477
  });
478
478
  }, [scope, chatId, cursor]);
479
+ const hideTools = useHostHidesToolCalls(scopeId, chatId);
479
480
  const threadRows = useMemo(() => {
480
481
  if (!order || !items) {
481
482
  return [];
@@ -486,9 +487,10 @@ export function Timeline({
486
487
  expandedSubagents: subagents.ids,
487
488
  activeTurnId,
488
489
  forkedTurns,
489
- commandLooks: host.commandLooks
490
+ commandLooks: host.commandLooks,
491
+ hideTools
490
492
  });
491
- }, [order, items, groups.ids, turns.ids, subagents.ids, activeTurnId, forkedTurns, host.commandLooks]);
493
+ }, [order, items, groups.ids, turns.ids, subagents.ids, activeTurnId, forkedTurns, host.commandLooks, hideTools]);
492
494
  const cards = useHostThreadCards(scopeId, chatId);
493
495
  const drawsVisuals = host.visuals !== null;
494
496
  // Where the part of the thread this client holds begins, while there is a page before it.
@@ -70,7 +70,7 @@ function AppCardRow(t0) {
70
70
  }
71
71
  /* One row of a thread, the chat's own or a subagent's read back, drawn the same way in both. */
72
72
  export function Row(t0) {
73
- const $ = _c(84);
73
+ const $ = _c(85);
74
74
  const {
75
75
  row,
76
76
  chatId,
@@ -308,38 +308,40 @@ export function Row(t0) {
308
308
  t1 = $[48];
309
309
  }
310
310
  let t2;
311
- if ($[49] !== row.expanded || $[50] !== row.label || $[51] !== row.turn || $[52] !== row.work || $[53] !== t1) {
311
+ if ($[49] !== row.expandable || $[50] !== row.expanded || $[51] !== row.label || $[52] !== row.turn || $[53] !== row.work || $[54] !== t1) {
312
312
  t2 = /*#__PURE__*/_jsx(TurnFoldRow, {
313
313
  turn: row.turn,
314
314
  label: row.label,
315
315
  work: row.work,
316
316
  expanded: row.expanded,
317
+ expandable: row.expandable,
317
318
  onToggle: t1
318
319
  });
319
- $[49] = row.expanded;
320
- $[50] = row.label;
321
- $[51] = row.turn;
322
- $[52] = row.work;
323
- $[53] = t1;
324
- $[54] = t2;
320
+ $[49] = row.expandable;
321
+ $[50] = row.expanded;
322
+ $[51] = row.label;
323
+ $[52] = row.turn;
324
+ $[53] = row.work;
325
+ $[54] = t1;
326
+ $[55] = t2;
325
327
  } else {
326
- t2 = $[54];
328
+ t2 = $[55];
327
329
  }
328
330
  return t2;
329
331
  }
330
332
  case "forks":
331
333
  {
332
334
  let t1;
333
- if ($[55] !== chatId || $[56] !== row.turnId) {
335
+ if ($[56] !== chatId || $[57] !== row.turnId) {
334
336
  t1 = /*#__PURE__*/_jsx(ForksRow, {
335
337
  chatId: chatId,
336
338
  turnId: row.turnId
337
339
  });
338
- $[55] = chatId;
339
- $[56] = row.turnId;
340
- $[57] = t1;
340
+ $[56] = chatId;
341
+ $[57] = row.turnId;
342
+ $[58] = t1;
341
343
  } else {
342
- t1 = $[57];
344
+ t1 = $[58];
343
345
  }
344
346
  return t1;
345
347
  }
@@ -347,7 +349,7 @@ export function Row(t0) {
347
349
  {
348
350
  const t1 = row.heldBack === true;
349
351
  let t2;
350
- if ($[58] !== chatId || $[59] !== row.baseMoved || $[60] !== row.checkpoint || $[61] !== row.diff || $[62] !== row.tools || $[63] !== row.turnId || $[64] !== t1) {
352
+ if ($[59] !== chatId || $[60] !== row.baseMoved || $[61] !== row.checkpoint || $[62] !== row.diff || $[63] !== row.tools || $[64] !== row.turnId || $[65] !== t1) {
351
353
  t2 = /*#__PURE__*/_jsx(ChangedFilesRow, {
352
354
  chatId: chatId,
353
355
  turnId: row.turnId,
@@ -357,122 +359,122 @@ export function Row(t0) {
357
359
  baseMoved: row.baseMoved,
358
360
  heldBack: t1
359
361
  });
360
- $[58] = chatId;
361
- $[59] = row.baseMoved;
362
- $[60] = row.checkpoint;
363
- $[61] = row.diff;
364
- $[62] = row.tools;
365
- $[63] = row.turnId;
366
- $[64] = t1;
367
- $[65] = t2;
362
+ $[59] = chatId;
363
+ $[60] = row.baseMoved;
364
+ $[61] = row.checkpoint;
365
+ $[62] = row.diff;
366
+ $[63] = row.tools;
367
+ $[64] = row.turnId;
368
+ $[65] = t1;
369
+ $[66] = t2;
368
370
  } else {
369
- t2 = $[65];
371
+ t2 = $[66];
370
372
  }
371
373
  return t2;
372
374
  }
373
375
  case "approval":
374
376
  {
375
377
  let t1;
376
- if ($[66] !== row.item) {
378
+ if ($[67] !== row.item) {
377
379
  t1 = /*#__PURE__*/_jsx(ApprovalHistoryRow, {
378
380
  item: row.item
379
381
  });
380
- $[66] = row.item;
381
- $[67] = t1;
382
+ $[67] = row.item;
383
+ $[68] = t1;
382
384
  } else {
383
- t1 = $[67];
385
+ t1 = $[68];
384
386
  }
385
387
  return t1;
386
388
  }
387
389
  case "question":
388
390
  {
389
391
  let t1;
390
- if ($[68] !== row.item) {
392
+ if ($[69] !== row.item) {
391
393
  t1 = /*#__PURE__*/_jsx(QuestionHistoryRow, {
392
394
  item: row.item
393
395
  });
394
- $[68] = row.item;
395
- $[69] = t1;
396
+ $[69] = row.item;
397
+ $[70] = t1;
396
398
  } else {
397
- t1 = $[69];
399
+ t1 = $[70];
398
400
  }
399
401
  return t1;
400
402
  }
401
403
  case "note":
402
404
  {
403
405
  let t1;
404
- if ($[70] !== row.from || $[71] !== row.id || $[72] !== row.level || $[73] !== row.text) {
406
+ if ($[71] !== row.from || $[72] !== row.id || $[73] !== row.level || $[74] !== row.text) {
405
407
  t1 = /*#__PURE__*/_jsx(NoteRow, {
406
408
  id: row.id,
407
409
  level: row.level,
408
410
  text: row.text,
409
411
  from: row.from
410
412
  });
411
- $[70] = row.from;
412
- $[71] = row.id;
413
- $[72] = row.level;
414
- $[73] = row.text;
415
- $[74] = t1;
413
+ $[71] = row.from;
414
+ $[72] = row.id;
415
+ $[73] = row.level;
416
+ $[74] = row.text;
417
+ $[75] = t1;
416
418
  } else {
417
- t1 = $[74];
419
+ t1 = $[75];
418
420
  }
419
421
  return t1;
420
422
  }
421
423
  case "compaction":
422
424
  {
423
425
  let t1;
424
- if ($[75] !== row.preTokens) {
426
+ if ($[76] !== row.preTokens) {
425
427
  t1 = /*#__PURE__*/_jsx(CompactionRow, {
426
428
  preTokens: row.preTokens
427
429
  });
428
- $[75] = row.preTokens;
429
- $[76] = t1;
430
+ $[76] = row.preTokens;
431
+ $[77] = t1;
430
432
  } else {
431
- t1 = $[76];
433
+ t1 = $[77];
432
434
  }
433
435
  return t1;
434
436
  }
435
437
  case "working":
436
438
  {
437
439
  let t1;
438
- if ($[77] !== row.startedAt) {
440
+ if ($[78] !== row.startedAt) {
439
441
  t1 = /*#__PURE__*/_jsx(WorkingRow, {
440
442
  startedAt: row.startedAt
441
443
  });
442
- $[77] = row.startedAt;
443
- $[78] = t1;
444
+ $[78] = row.startedAt;
445
+ $[79] = t1;
444
446
  } else {
445
- t1 = $[78];
447
+ t1 = $[79];
446
448
  }
447
449
  return t1;
448
450
  }
449
451
  case "app-card":
450
452
  {
451
453
  let t1;
452
- if ($[79] !== row.card) {
454
+ if ($[80] !== row.card) {
453
455
  t1 = /*#__PURE__*/_jsx(AppCardRow, {
454
456
  card: row.card
455
457
  });
456
- $[79] = row.card;
457
- $[80] = t1;
458
+ $[80] = row.card;
459
+ $[81] = t1;
458
460
  } else {
459
- t1 = $[80];
461
+ t1 = $[81];
460
462
  }
461
463
  return t1;
462
464
  }
463
465
  case "visual":
464
466
  {
465
467
  let t1;
466
- if ($[81] !== chatId || $[82] !== row.visual) {
468
+ if ($[82] !== chatId || $[83] !== row.visual) {
467
469
  t1 = /*#__PURE__*/_jsx(VisualRow, {
468
470
  chatId: chatId,
469
471
  visual: row.visual
470
472
  });
471
- $[81] = chatId;
472
- $[82] = row.visual;
473
- $[83] = t1;
473
+ $[82] = chatId;
474
+ $[83] = row.visual;
475
+ $[84] = t1;
474
476
  } else {
475
- t1 = $[83];
477
+ t1 = $[84];
476
478
  }
477
479
  return t1;
478
480
  }
@@ -17,7 +17,7 @@ import { canOpenSubagent, crumbOf } from '../../subagent-view.js';
17
17
  import '../../../host.js';
18
18
  import { useChatScope } from '../../../scope.js';
19
19
  import { useCurrentItem } from '../../../state/chats.js';
20
- import { useHostTask } from '../../../host-hooks.js';
20
+ import { useHostHidesToolCalls, useHostTask } from '../../../host-hooks.js';
21
21
  // The work of a long-running agent scrolls inside its row instead of pushing the thread away.
22
22
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
23
23
  const CHILDREN_MAX_PX = 320;
@@ -204,7 +204,7 @@ function StatusPill(t0) {
204
204
  }
205
205
  /* What the sub-agent did, live: its own tool calls and the text it wrote, as ordinary rows. */
206
206
  function SubagentWork(t0) {
207
- const $ = _c(21);
207
+ const $ = _c(24);
208
208
  const {
209
209
  chatId,
210
210
  item,
@@ -213,110 +213,130 @@ function SubagentWork(t0) {
213
213
  const {
214
214
  t
215
215
  } = useTranslation("agent-chat");
216
+ const {
217
+ id
218
+ } = useChatScope();
219
+ const hideTools = useHostHidesToolCalls(id, chatId);
216
220
  const scroller = useRef(null);
217
221
  const running = item.status === "running";
218
222
  let t1;
219
- if ($[0] !== running) {
220
- t1 = () => {
223
+ if ($[0] !== hideTools || $[1] !== work) {
224
+ t1 = hideTools ? work.filter(_temp) : work;
225
+ $[0] = hideTools;
226
+ $[1] = work;
227
+ $[2] = t1;
228
+ } else {
229
+ t1 = $[2];
230
+ }
231
+ const shown = t1;
232
+ let t2;
233
+ if ($[3] !== running) {
234
+ t2 = () => {
221
235
  if (running && scroller.current) {
222
236
  scroller.current.scrollTop = scroller.current.scrollHeight;
223
237
  }
224
238
  };
225
- $[0] = running;
226
- $[1] = t1;
227
- } else {
228
- t1 = $[1];
229
- }
230
- let t2;
231
- if ($[2] !== running || $[3] !== work.length) {
232
- t2 = [work.length, running];
233
- $[2] = running;
234
- $[3] = work.length;
239
+ $[3] = running;
235
240
  $[4] = t2;
236
241
  } else {
237
242
  t2 = $[4];
238
243
  }
239
- useLayoutEffect(t1, t2);
244
+ let t3;
245
+ if ($[5] !== running || $[6] !== shown.length) {
246
+ t3 = [shown.length, running];
247
+ $[5] = running;
248
+ $[6] = shown.length;
249
+ $[7] = t3;
250
+ } else {
251
+ t3 = $[7];
252
+ }
253
+ useLayoutEffect(t2, t3);
240
254
  if (work.length === 0) {
241
- let t3;
242
- if ($[5] !== t) {
243
- t3 = t("rows.subagent.nothingYet");
244
- $[5] = t;
245
- $[6] = t3;
255
+ let t4;
256
+ if ($[8] !== t) {
257
+ t4 = t("rows.subagent.nothingYet");
258
+ $[8] = t;
259
+ $[9] = t4;
246
260
  } else {
247
- t3 = $[6];
261
+ t4 = $[9];
248
262
  }
249
- let t4;
250
- if ($[7] !== t3) {
251
- t4 = /*#__PURE__*/_jsx("div", {
263
+ let t5;
264
+ if ($[10] !== t4) {
265
+ t5 = /*#__PURE__*/_jsx("div", {
252
266
  className: "ml-6 pb-1 text-xs text-text-faint",
253
- children: t3
267
+ children: t4
254
268
  });
255
- $[7] = t3;
256
- $[8] = t4;
269
+ $[10] = t4;
270
+ $[11] = t5;
257
271
  } else {
258
- t4 = $[8];
272
+ t5 = $[11];
259
273
  }
260
- return t4;
274
+ return t5;
261
275
  }
262
- let t3;
263
- if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
264
- t3 = {
276
+ if (shown.length === 0) {
277
+ return null;
278
+ }
279
+ let t4;
280
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
281
+ t4 = {
265
282
  maxHeight: CHILDREN_MAX_PX
266
283
  };
267
- $[9] = t3;
284
+ $[12] = t4;
268
285
  } else {
269
- t3 = $[9];
286
+ t4 = $[12];
270
287
  }
271
- let t4;
272
- if ($[10] !== item.itemsTruncated || $[11] !== t) {
273
- t4 = item.itemsTruncated && /*#__PURE__*/_jsx("div", {
288
+ let t5;
289
+ if ($[13] !== item.itemsTruncated || $[14] !== t) {
290
+ t5 = item.itemsTruncated && /*#__PURE__*/_jsx("div", {
274
291
  className: "pb-1 text-xs text-text-faint",
275
292
  children: t("rows.subagent.truncated")
276
293
  });
277
- $[10] = item.itemsTruncated;
278
- $[11] = t;
279
- $[12] = t4;
294
+ $[13] = item.itemsTruncated;
295
+ $[14] = t;
296
+ $[15] = t5;
280
297
  } else {
281
- t4 = $[12];
298
+ t5 = $[15];
282
299
  }
283
- let t5;
284
- if ($[13] !== chatId || $[14] !== work) {
285
- let t6;
286
- if ($[16] !== chatId) {
287
- t6 = child => /*#__PURE__*/_jsx(ChildRow, {
300
+ let t6;
301
+ if ($[16] !== chatId || $[17] !== shown) {
302
+ let t7;
303
+ if ($[19] !== chatId) {
304
+ t7 = child_0 => /*#__PURE__*/_jsx(ChildRow, {
288
305
  chatId: chatId,
289
- item: child
290
- }, child.id);
291
- $[16] = chatId;
292
- $[17] = t6;
306
+ item: child_0
307
+ }, child_0.id);
308
+ $[19] = chatId;
309
+ $[20] = t7;
293
310
  } else {
294
- t6 = $[17];
311
+ t7 = $[20];
295
312
  }
296
- t5 = work.map(t6);
297
- $[13] = chatId;
298
- $[14] = work;
299
- $[15] = t5;
313
+ t6 = shown.map(t7);
314
+ $[16] = chatId;
315
+ $[17] = shown;
316
+ $[18] = t6;
300
317
  } else {
301
- t5 = $[15];
318
+ t6 = $[18];
302
319
  }
303
- let t6;
304
- if ($[18] !== t4 || $[19] !== t5) {
305
- t6 = /*#__PURE__*/_jsxs("div", {
320
+ let t7;
321
+ if ($[21] !== t5 || $[22] !== t6) {
322
+ t7 = /*#__PURE__*/_jsxs("div", {
306
323
  ref: scroller,
307
324
  className: "ml-6 overflow-y-auto",
308
- style: t3,
309
- children: [t4, t5]
325
+ style: t4,
326
+ children: [t5, t6]
310
327
  });
311
- $[18] = t4;
312
- $[19] = t5;
313
- $[20] = t6;
328
+ $[21] = t5;
329
+ $[22] = t6;
330
+ $[23] = t7;
314
331
  } else {
315
- t6 = $[20];
332
+ t7 = $[23];
316
333
  }
317
- return t6;
334
+ return t7;
318
335
  }
319
336
  /* The report the sub-agent handed back, behind a fold: the row is about the work, this is the answer. */
337
+ function _temp(child) {
338
+ return child.kind !== "tool" || isImageGeneration(child);
339
+ }
320
340
  function SubagentResult(t0) {
321
341
  const $ = _c(17);
322
342
  const {
@@ -330,7 +350,7 @@ function SubagentResult(t0) {
330
350
  useOpenForFind(itemId, "output", setOpen);
331
351
  let t1;
332
352
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
333
- t1 = () => setOpen(_temp);
353
+ t1 = () => setOpen(_temp2);
334
354
  $[0] = t1;
335
355
  } else {
336
356
  t1 = $[0];
@@ -412,7 +432,7 @@ function SubagentResult(t0) {
412
432
  * opens the whole conversation in the thread's place, and where there is none to open it folds out
413
433
  * the work the thread kept and, once it settled, the report it wrote.
414
434
  */
415
- function _temp(o) {
435
+ function _temp2(o) {
416
436
  return !o;
417
437
  }
418
438
  export function SubagentRow(t0) {
@@ -49,11 +49,12 @@ export declare function WorkGroupRow({ tools, summary, look, expanded, onToggle
49
49
  expanded: boolean;
50
50
  onToggle(): void;
51
51
  }): import("react").JSX.Element;
52
- export declare function TurnFoldRow({ turn, label, work, expanded, onToggle }: {
52
+ export declare function TurnFoldRow({ turn, label, work, expanded, expandable, onToggle }: {
53
53
  turn: ChatTurnItem;
54
54
  label: string;
55
55
  work: readonly string[];
56
56
  expanded: boolean;
57
+ expandable: boolean;
57
58
  onToggle(): void;
58
59
  }): import("react").JSX.Element;
59
60
  export declare function ChangedFilesRow({ tools, diff, checkpoint, baseMoved, chatId, turnId, heldBack }: {