@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.
@@ -90,6 +90,7 @@ export type TimelineRow = {
90
90
  work: string[];
91
91
  hiddenCount: number;
92
92
  expanded: boolean;
93
+ expandable: boolean;
93
94
  } | {
94
95
  kind: 'forks';
95
96
  id: string;
@@ -114,6 +115,7 @@ interface TimelineOptions {
114
115
  activeTurnId: string | null;
115
116
  forkedTurns?: ReadonlySet<string>;
116
117
  commandLooks?: readonly CommandLook[];
118
+ hideTools?: boolean;
117
119
  }
118
120
  export declare function isBlock(row: TimelineRow): boolean;
119
121
  export declare function summarizeGroup(tools: ChatToolItem[], looks?: readonly CommandLook[]): string;
@@ -6,6 +6,11 @@ import { isImageGeneration } from './generated-image.js';
6
6
  import { handbackReportOf } from './handback.js';
7
7
  import { toolEntry } from './tool-catalog.js';
8
8
  import { hasFileChanges, isFileChange, shellCommand } from './tools.js';
9
+ const TOOL_KINDS = new Set(['work', 'work-group', 'work-live']);
10
+ // A generated image is drawn as a tool call but reads as the turn's result, so it stays.
11
+ function shownRows(rows, options) {
12
+ return options.hideTools === true ? rows.filter(row => !TOOL_KINDS.has(row.kind) || isImageRow(row)) : rows;
13
+ }
9
14
  /*
10
15
  * A turn runs in two rhythms. The tool lines are a list and read as one when they sit tight
11
16
  * against each other; prose and cards are blocks and need room around them. Where the two meet,
@@ -529,7 +534,7 @@ export function deriveTimelineRows(items, options) {
529
534
  const children = groupChildren(items);
530
535
  for (const chunk of chunksByTurn(items)) {
531
536
  if (chunk.turnId === null) {
532
- rows.push(...rowsForItems(chunk.items, options, children));
537
+ rows.push(...shownRows(rowsForItems(chunk.items, options, children), options));
533
538
  continue;
534
539
  }
535
540
  const turnId = chunk.turnId;
@@ -546,7 +551,8 @@ export function deriveTimelineRows(items, options) {
546
551
  }
547
552
  const active = turnId === options.activeTurnId || turn?.state === 'running';
548
553
  if (!turn || active) {
549
- const live = rowsForItems(conversation, options, children);
554
+ // Without its call, a thought has nothing to stand over and stays where it was thought.
555
+ const live = shownRows(rowsForItems(conversation, options, children), options);
550
556
  rows.push(...(active ? withLiveThought(live, conversation) : live));
551
557
  if (active) {
552
558
  rows.push({
@@ -559,7 +565,7 @@ export function deriveTimelineRows(items, options) {
559
565
  }
560
566
  // Steering splits the conversation inside a turn. Earlier responses keep their place above it.
561
567
  const lastUser = conversation.findLastIndex(item => item.kind === 'user');
562
- rows.push(...rowsForItems(conversation.slice(0, lastUser + 1), options, children));
568
+ rows.push(...shownRows(rowsForItems(conversation.slice(0, lastUser + 1), options, children), options));
563
569
  const rest = conversation.slice(lastUser + 1);
564
570
  const work = rowsForItems(rest, options, children);
565
571
  // The closing answer stays visible; the work after the last input folds behind the label.
@@ -569,7 +575,9 @@ export function deriveTimelineRows(items, options) {
569
575
  // Images remain a turn's visible result, and a workflow or a background subagent may still be running after its turn ends.
570
576
  const standing = before.filter(row => isImageRow(row) || row.kind === 'workflow' && row.tool.state === 'running' || row.kind === 'subagent' && row.item.status === 'running');
571
577
  const folded = before.length - standing.length;
572
- const expanded = options.expandedTurns.has(turnId);
578
+ // With the tool lines left out, a turn that only ran tools has nothing behind its fold to open.
579
+ const expandable = shownRows(before, options).some(row => !standing.includes(row));
580
+ const expanded = expandable && options.expandedTurns.has(turnId);
573
581
  if (folded > 0) {
574
582
  const tools = rest.filter(item => item.kind === 'tool' && parentOf(item) === null && handbackReportOf(item) === null && !isImageGeneration(item));
575
583
  rows.push({
@@ -579,10 +587,12 @@ export function deriveTimelineRows(items, options) {
579
587
  label: turnLabel(turn, chunk.items),
580
588
  work: summarizeTurn(tools, options.commandLooks),
581
589
  hiddenCount: folded,
582
- expanded
590
+ expanded,
591
+ expandable
583
592
  });
584
593
  }
585
- rows.push(...(expanded ? before : standing));
594
+ // The fold counts the tool lines it would hide, so a turn of only tools still says how long it worked.
595
+ rows.push(...(expanded ? shownRows(before, options) : standing));
586
596
  const changed = changedFilesRow(turn, conversation);
587
597
  if (changed) {
588
598
  rows.push(changed);