@adecore/agents-react 0.50.4 → 0.50.6

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.
@@ -1,7 +1,7 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
2
  import { useTranslation } from 'react-i18next';
3
3
  import { ErrorBoundary } from '@adecore/ui';
4
- import { AgentTurnRow, ApprovalHistoryRow, AssistantRow, CompactionRow, LiveThoughtRow, NoteRow, QuestionHistoryRow, ReportRow, SentMessageRow, ThinkingRow, UserRow } from './MessageRows.js';
4
+ import { AgentTurnRow, ApprovalHistoryRow, AssistantRow, CompactionRow, LiveThoughtRow, NoteRow, QuestionHistoryRow, ReportRow, SentByAgentRow, SentMessageRow, ThinkingRow, UserRow } from './MessageRows.js';
5
5
  import { isImageGeneration } from '../../logic/generated-image.js';
6
6
  import { ForksRow } from './ForksRow.js';
7
7
  import { GeneratedImageRow } from './GeneratedImageRow.js';
@@ -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(93);
73
+ const $ = _c(98);
74
74
  const {
75
75
  row,
76
76
  chatId,
@@ -440,73 +440,93 @@ export function Row(t0) {
440
440
  }
441
441
  return t1;
442
442
  }
443
+ case "sent":
444
+ {
445
+ let t1;
446
+ if ($[81] !== chatId || $[82] !== row.id || $[83] !== row.sent || $[84] !== row.tool) {
447
+ t1 = /*#__PURE__*/_jsx(SentByAgentRow, {
448
+ chatId: chatId,
449
+ id: row.id,
450
+ tool: row.tool,
451
+ sent: row.sent
452
+ });
453
+ $[81] = chatId;
454
+ $[82] = row.id;
455
+ $[83] = row.sent;
456
+ $[84] = row.tool;
457
+ $[85] = t1;
458
+ } else {
459
+ t1 = $[85];
460
+ }
461
+ return t1;
462
+ }
443
463
  case "compaction":
444
464
  {
445
465
  let t1;
446
- if ($[81] !== row.preTokens) {
466
+ if ($[86] !== row.preTokens) {
447
467
  t1 = /*#__PURE__*/_jsx(CompactionRow, {
448
468
  preTokens: row.preTokens
449
469
  });
450
- $[81] = row.preTokens;
451
- $[82] = t1;
470
+ $[86] = row.preTokens;
471
+ $[87] = t1;
452
472
  } else {
453
- t1 = $[82];
473
+ t1 = $[87];
454
474
  }
455
475
  return t1;
456
476
  }
457
477
  case "working":
458
478
  {
459
479
  let t1;
460
- if ($[83] !== row.tool) {
480
+ if ($[88] !== row.tool) {
461
481
  t1 = row.tool === undefined ? {} : {
462
482
  tool: row.tool
463
483
  };
464
- $[83] = row.tool;
465
- $[84] = t1;
484
+ $[88] = row.tool;
485
+ $[89] = t1;
466
486
  } else {
467
- t1 = $[84];
487
+ t1 = $[89];
468
488
  }
469
489
  let t2;
470
- if ($[85] !== row.startedAt || $[86] !== t1) {
490
+ if ($[90] !== row.startedAt || $[91] !== t1) {
471
491
  t2 = /*#__PURE__*/_jsx(WorkingRow, {
472
492
  startedAt: row.startedAt,
473
493
  ...t1
474
494
  });
475
- $[85] = row.startedAt;
476
- $[86] = t1;
477
- $[87] = t2;
495
+ $[90] = row.startedAt;
496
+ $[91] = t1;
497
+ $[92] = t2;
478
498
  } else {
479
- t2 = $[87];
499
+ t2 = $[92];
480
500
  }
481
501
  return t2;
482
502
  }
483
503
  case "app-card":
484
504
  {
485
505
  let t1;
486
- if ($[88] !== row.card) {
506
+ if ($[93] !== row.card) {
487
507
  t1 = /*#__PURE__*/_jsx(AppCardRow, {
488
508
  card: row.card
489
509
  });
490
- $[88] = row.card;
491
- $[89] = t1;
510
+ $[93] = row.card;
511
+ $[94] = t1;
492
512
  } else {
493
- t1 = $[89];
513
+ t1 = $[94];
494
514
  }
495
515
  return t1;
496
516
  }
497
517
  case "visual":
498
518
  {
499
519
  let t1;
500
- if ($[90] !== chatId || $[91] !== row.visual) {
520
+ if ($[95] !== chatId || $[96] !== row.visual) {
501
521
  t1 = /*#__PURE__*/_jsx(VisualRow, {
502
522
  chatId: chatId,
503
523
  visual: row.visual
504
524
  });
505
- $[90] = chatId;
506
- $[91] = row.visual;
507
- $[92] = t1;
525
+ $[95] = chatId;
526
+ $[96] = row.visual;
527
+ $[97] = t1;
508
528
  } else {
509
- t1 = $[92];
529
+ t1 = $[97];
510
530
  }
511
531
  return t1;
512
532
  }
@@ -4,7 +4,8 @@ import { isBlock } from '../../logic/timeline.js';
4
4
  export const FOLLOW_THRESHOLD_PX = 40;
5
5
  /*
6
6
  * A seam where tool lines meet prose gets the block gap, and so does the row under a visual or an app's
7
- * card, which have no margin of their own. A question and the answer after it never take a seam.
7
+ * card, which have no margin of their own, and each end of a run of sent messages, which sit as tight as
8
+ * work lines so a fan-out reads as one stretch. A question and the answer after it never take a seam.
8
9
  */
9
10
  /* A person's message, or one another node sent: both are said to the chat and drawn the same way. */
10
11
  export function saidToChat(row) {
@@ -13,7 +14,7 @@ export function saidToChat(row) {
13
14
  export function rowRhythm(row, previous) {
14
15
  const question = saidToChat(row);
15
16
  const bare = previous?.kind === 'visual' || previous?.kind === 'app-card';
16
- const seam = !question && previous !== null && !saidToChat(previous) && (isBlock(row) !== isBlock(previous) || bare);
17
+ const seam = !question && previous !== null && !saidToChat(previous) && (isBlock(row) !== isBlock(previous) || bare || row.kind === 'sent' !== (previous.kind === 'sent'));
17
18
  return clsx(question && 'pb-(--chat-answer-gap)', seam && 'pt-(--chat-block-gap)');
18
19
  }
19
20
  /*
package/dist/host.d.ts CHANGED
@@ -178,6 +178,20 @@ export interface CommandLookMatch {
178
178
  fold?: readonly string[];
179
179
  languages?: Readonly<Record<string, string>>;
180
180
  }
181
+ export interface CommandLookCall {
182
+ readonly args: readonly string[];
183
+ readonly heredoc: string | null;
184
+ readonly state: 'running' | 'done' | 'error';
185
+ readonly output: string | null;
186
+ }
187
+ export interface CommandLookSent {
188
+ readonly to: string;
189
+ readonly title?: string;
190
+ readonly hint?: string;
191
+ readonly text: string;
192
+ readonly state: 'sending' | 'delivered' | 'waiting' | 'failed';
193
+ readonly reason?: string;
194
+ }
181
195
  export interface CommandLook {
182
196
  program: string;
183
197
  brand?: string;
@@ -187,6 +201,7 @@ export interface CommandLook {
187
201
  describe(args: readonly string[]): CommandLookMatch | null;
188
202
  sentence?(count: number): string;
189
203
  useNames?(scopeId: string, chatId: string): (word: string, option: string | null) => CommandName | null;
204
+ sent?(call: CommandLookCall): CommandLookSent | null;
190
205
  }
191
206
  export type UiMapSource = {
192
207
  state: 'tiles';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { type ChatActions, type FileRef, type ShellCodeBlockContext, type ChatPlace, type SubagentTask, type TimelineFindOptions, type TimelineFind, type ComposerDictationProps, type ComposerHeaderSlotProps, type ComposerSlotProps, type ReferenceIconProps, type ComposerSendAction, type ComposerSendDraft, type SubagentSlotProps, type ThreadCard, type VisualHost, type HostMenuAction, type ReplyAuthor, type ChatHost, type UiMapSource, type UiModelViewProps, type CommandLook, type CommandLookMatch, type CommandName, ChatHostProvider, useChatHost, type AccentChoice, type ChatToast, type TextareaProps, type ResourceUrl } from './host.js';
1
+ export { type ChatActions, type FileRef, type ShellCodeBlockContext, type ChatPlace, type SubagentTask, type TimelineFindOptions, type TimelineFind, type ComposerDictationProps, type ComposerHeaderSlotProps, type ComposerSlotProps, type ReferenceIconProps, type ComposerSendAction, type ComposerSendDraft, type SubagentSlotProps, type ThreadCard, type VisualHost, type HostMenuAction, type ReplyAuthor, type ChatHost, type UiMapSource, type UiModelViewProps, type CommandLook, type CommandLookCall, type CommandLookSent, type CommandLookMatch, type CommandName, ChatHostProvider, useChatHost, type AccentChoice, type ChatToast, type TextareaProps, type ResourceUrl } from './host.js';
2
2
  export { type ChatScope, ChatScopeContext, useChatScope } from './scope.js';
3
3
  export { type ChatRequestMap, type ChatEventMap, type ChatTransportStatus, type ChatTransport, ChatTransportError, errorCode, isConnectionError } from './transport.js';
4
4
  export { portTransport, type PortTransport } from './port-transport.js';
@@ -126,6 +126,16 @@ declare const _default: {
126
126
  waiting: string;
127
127
  dropped: string;
128
128
  };
129
+ sent: {
130
+ heading: string;
131
+ to: string;
132
+ sending: string;
133
+ delivered: string;
134
+ waiting: string;
135
+ failed: string;
136
+ showCall: string;
137
+ hideCall: string;
138
+ };
129
139
  report: {
130
140
  heading: string;
131
141
  };
@@ -293,6 +303,8 @@ declare const _default: {
293
303
  calls_other: string;
294
304
  edited_one: string;
295
305
  edited_other: string;
306
+ sent_one: string;
307
+ sent_other: string;
296
308
  toolCalls_one: string;
297
309
  toolCalls_other: string;
298
310
  otherCalls_one: string;
@@ -126,6 +126,16 @@ export default {
126
126
  waiting: 'Waiting for the next turn',
127
127
  dropped: 'Expired before the agent read it'
128
128
  },
129
+ sent: {
130
+ heading: 'Message to {{name}}',
131
+ to: 'To',
132
+ sending: 'Sending',
133
+ delivered: 'Delivered',
134
+ waiting: 'Waiting for its next turn',
135
+ failed: 'Not sent',
136
+ showCall: 'Show the call',
137
+ hideCall: 'Hide the call'
138
+ },
129
139
  report: {
130
140
  heading: 'Report'
131
141
  },
@@ -278,8 +288,8 @@ export default {
278
288
  Glob_other: 'Listed {{count}} patterns',
279
289
  WebFetch_one: 'Fetched {{count}} page',
280
290
  WebFetch_other: 'Fetched {{count}} pages',
281
- WebSearch_one: 'Searched the web {{count}} query',
282
- WebSearch_other: 'Searched the web {{count}} queries',
291
+ WebSearch_one: 'Ran {{count}} web search',
292
+ WebSearch_other: 'Ran {{count}} web searches',
283
293
  Task_one: 'Delegated {{count}} task',
284
294
  Task_other: 'Delegated {{count}} tasks',
285
295
  Agent_one: 'Delegated {{count}} task',
@@ -293,6 +303,8 @@ export default {
293
303
  calls_other: '{{name}} {{count}} calls',
294
304
  edited_one: 'Edited {{count}} file',
295
305
  edited_other: 'Edited {{count}} files',
306
+ sent_one: 'Sent {{count}} message',
307
+ sent_other: 'Sent {{count}} messages',
296
308
  toolCalls_one: '{{count}} tool call',
297
309
  toolCalls_other: '{{count}} tool calls',
298
310
  otherCalls_one: '{{count}} other tool call',
@@ -547,7 +559,7 @@ export default {
547
559
  more: 'More actions',
548
560
  remove: 'Remove visual',
549
561
  removeTitle: 'Remove visual?',
550
- removeDescription: '{{title}} is deleted from the chat. This cannot be undone.',
562
+ removeDescription: 'Deletes {{title}} from the chat. This cannot be undone.',
551
563
  removeFailed: 'Could not remove visual',
552
564
  loading: 'Loading {{title}}',
553
565
  failed: 'Could not load {{title}}',
@@ -711,13 +723,13 @@ export default {
711
723
  failed: 'Could not send. Try again.',
712
724
  ready: 'Choices are ready'
713
725
  },
714
- answered: 'Answered with “{{label}}”',
715
- chose: 'Chose “{{label}}”',
716
- choseOlder: 'Chose “{{label}}” on the reply of {{time}}',
726
+ answered: 'Answered with "{{label}}"',
727
+ chose: 'Chose "{{label}}"',
728
+ choseOlder: 'Chose "{{label}}" on the reply of {{time}}',
717
729
  notes_one: '{{count}} note',
718
730
  notes_other: '{{count}} notes',
719
731
  shownAsText: 'Shown as text',
720
- unknownComponent: 'This version cannot draw {{component}}',
732
+ unknownComponent: 'This version cannot show {{component}}',
721
733
  renderFailed: 'Could not show this part',
722
734
  unreadable: 'Could not read block',
723
735
  live: {
@@ -126,6 +126,16 @@ declare const _default: {
126
126
  waiting: string;
127
127
  dropped: string;
128
128
  };
129
+ sent: {
130
+ heading: string;
131
+ to: string;
132
+ sending: string;
133
+ delivered: string;
134
+ waiting: string;
135
+ failed: string;
136
+ showCall: string;
137
+ hideCall: string;
138
+ };
129
139
  report: {
130
140
  heading: string;
131
141
  };
@@ -293,6 +303,8 @@ declare const _default: {
293
303
  calls_other: string;
294
304
  edited_one: string;
295
305
  edited_other: string;
306
+ sent_one: string;
307
+ sent_other: string;
296
308
  toolCalls_one: string;
297
309
  toolCalls_other: string;
298
310
  otherCalls_one: string;
@@ -57,7 +57,7 @@ export default {
57
57
  active: 'Werkt aan een doel',
58
58
  paused: 'Doel gepauzeerd',
59
59
  blocked: 'Doel geblokkeerd',
60
- 'usage-limited': 'Doel gestopt op een gebruikslimiet',
60
+ 'usage-limited': 'Doel gestopt op een verbruikslimiet',
61
61
  'budget-limited': 'Doel heeft zijn tokenbudget op',
62
62
  complete: 'Doel bereikt'
63
63
  },
@@ -123,9 +123,19 @@ export default {
123
123
  message: {
124
124
  heading: 'Bericht van {{name}}',
125
125
  unnamed: 'een andere node',
126
- waiting: 'Wacht op de volgende beurt',
126
+ waiting: 'Wacht op de volgende turn',
127
127
  dropped: 'Vervallen voordat de agent het las'
128
128
  },
129
+ sent: {
130
+ heading: 'Bericht aan {{name}}',
131
+ to: 'Aan',
132
+ sending: 'Bezig met versturen',
133
+ delivered: 'Afgeleverd',
134
+ waiting: 'Wacht op de volgende turn',
135
+ failed: 'Niet verstuurd',
136
+ showCall: 'Aanroep tonen',
137
+ hideCall: 'Aanroep verbergen'
138
+ },
129
139
  report: {
130
140
  heading: 'Rapport'
131
141
  },
@@ -201,7 +211,7 @@ export default {
201
211
  diffLabel: 'Wijzigingen in {{path}}',
202
212
  showDiff: 'Diff tonen',
203
213
  loadingDiff: 'Diff laden',
204
- diffUnavailable: 'Deze diff kon niet worden geladen',
214
+ diffUnavailable: 'Kon deze diff niet laden',
205
215
  runningFor: 'loopt al {{elapsed}}',
206
216
  awaitingApproval: 'wacht op jou',
207
217
  forksAfter_one: 'Fork na deze turn',
@@ -212,9 +222,9 @@ export default {
212
222
  },
213
223
  changedFiles_one: '{{count}} gewijzigd bestand',
214
224
  changedFiles_other: '{{count}} gewijzigde bestanden',
215
- folderChanges_one: '{{count}} mapwijziging tijdens deze beurt',
216
- folderChanges_other: '{{count}} mapwijzigingen tijdens deze beurt',
217
- baseMoved: 'Branch verplaatst tijdens deze beurt ({{from}} naar {{to}}). Inclusief wat daarmee binnenkwam.',
225
+ folderChanges_one: '{{count}} mapwijziging tijdens deze turn',
226
+ folderChanges_other: '{{count}} mapwijzigingen tijdens deze turn',
227
+ baseMoved: 'Branch verplaatst tijdens deze turn ({{from}} naar {{to}}). Inclusief wat daarmee binnenkwam.',
218
228
  andMore: 'en meer',
219
229
  edits_one: '{{count}} bewerking',
220
230
  edits_other: '{{count}} bewerkingen',
@@ -224,11 +234,11 @@ export default {
224
234
  heredoc: 'heredoc',
225
235
  moreRuns_one: '+{{count}}',
226
236
  moreRuns_other: '+{{count}}',
227
- showFullOutput: 'Volledige uitvoer tonen',
237
+ showFullOutput: 'Volledige output tonen',
228
238
  showFullDiff: 'Volledige diff tonen',
229
239
  wholeSize: '{{size}} in totaal',
230
- fullOutputFailed: 'De volledige uitvoer kon niet worden geladen',
231
- fullDiffFailed: 'De volledige diff kon niet worden geladen',
240
+ fullOutputFailed: 'Kon de volledige output niet laden',
241
+ fullDiffFailed: 'Kon de volledige diff niet laden',
232
242
  retry: 'Opnieuw proberen'
233
243
  },
234
244
  timeline: {
@@ -293,6 +303,8 @@ export default {
293
303
  calls_other: '{{name}}, {{count}} aanroepen',
294
304
  edited_one: '{{count}} bestand bewerkt',
295
305
  edited_other: '{{count}} bestanden bewerkt',
306
+ sent_one: '{{count}} bericht verstuurd',
307
+ sent_other: '{{count}} berichten verstuurd',
296
308
  toolCalls_one: '{{count}} tool-aanroep',
297
309
  toolCalls_other: '{{count}} tool-aanroepen',
298
310
  otherCalls_one: '{{count}} andere tool-aanroep',
@@ -318,7 +330,7 @@ export default {
318
330
  commands: "Commando's",
319
331
  skills: 'Skills',
320
332
  mentions: 'Vermeldingen',
321
- references: 'Views en nodes'
333
+ references: 'Weergaven en nodes'
322
334
  },
323
335
  held: {
324
336
  question: 'Er wacht een vraag. Opent zodra je stopt met typen.',
@@ -368,8 +380,8 @@ export default {
368
380
  },
369
381
  references: {
370
382
  canvas: 'Op dit canvas',
371
- views: 'Views',
372
- noMatch: 'Geen view of node gevonden',
383
+ views: 'Weergaven',
384
+ noMatch: 'Geen weergave of node gevonden',
373
385
  currentProject: 'Dit project',
374
386
  kinds: {
375
387
  canvas: 'canvas',
@@ -404,7 +416,7 @@ export default {
404
416
  stop: 'Stoppen. Shift-klik stopt ook de sub-agents',
405
417
  queueButton: 'In de wachtrij zetten',
406
418
  continue: 'Doorgaan',
407
- continueHint: 'Ga verder met de gestopte beurt',
419
+ continueHint: 'Ga verder met de gestopte turn',
408
420
  send: 'Versturen',
409
421
  sendActions: 'Meer verzendopties',
410
422
  clear: {
@@ -414,7 +426,7 @@ export default {
414
426
  },
415
427
  waitingBelow: 'Antwoord hieronder',
416
428
  steerButton: 'Nu versturen. Houd Option of Alt ingedrukt om in de wachtrij te zetten.',
417
- queueWithSteerButton: 'In de wachtrij na deze beurt. Houd Option of Alt ingedrukt om nu te versturen.'
429
+ queueWithSteerButton: 'In de wachtrij na deze turn. Houd Option of Alt ingedrukt om nu te versturen.'
418
430
  },
419
431
  activity: {
420
432
  subagents_one: '{{count}} sub-agent',
@@ -547,7 +559,7 @@ export default {
547
559
  more: 'Meer acties',
548
560
  remove: 'Visualisatie verwijderen',
549
561
  removeTitle: 'Visualisatie verwijderen?',
550
- removeDescription: '{{title}} wordt uit de chat verwijderd. Dit kan niet ongedaan worden gemaakt.',
562
+ removeDescription: 'Verwijdert {{title}} uit de chat. Dit kan niet ongedaan worden gemaakt.',
551
563
  removeFailed: 'Kon de visualisatie niet verwijderen',
552
564
  loading: '{{title}} wordt geladen',
553
565
  failed: 'Kon {{title}} niet laden',
@@ -711,13 +723,13 @@ export default {
711
723
  failed: 'Versturen lukte niet. Probeer het opnieuw.',
712
724
  ready: 'De keuzes staan klaar'
713
725
  },
714
- answered: 'Beantwoord met “{{label}}”',
715
- chose: 'Gekozen: “{{label}}”',
716
- choseOlder: 'Gekozen: “{{label}}”, bij het antwoord van {{time}}',
726
+ answered: 'Beantwoord met "{{label}}"',
727
+ chose: 'Gekozen: "{{label}}"',
728
+ choseOlder: 'Gekozen: "{{label}}", bij het antwoord van {{time}}',
717
729
  notes_one: '{{count}} opmerking',
718
730
  notes_other: '{{count}} opmerkingen',
719
731
  shownAsText: 'Als tekst getoond',
720
- unknownComponent: 'Deze versie kan {{component}} niet tekenen',
732
+ unknownComponent: 'Deze versie kan {{component}} niet tonen',
721
733
  renderFailed: 'Kon dit deel niet tonen',
722
734
  unreadable: 'Kon het blok niet lezen',
723
735
  live: {
@@ -38,6 +38,6 @@ export default {
38
38
  waiting_one: '{{count}} verzoek wacht',
39
39
  waiting_other: '{{count}} verzoeken wachten',
40
40
  question: 'Vraag {{index}} van {{total}}',
41
- draftSaved: 'Concept bewaard'
41
+ draftSaved: 'Concept opgeslagen'
42
42
  }
43
43
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adecore/agents-react",
3
- "version": "0.50.4",
3
+ "version": "0.50.6",
4
4
  "description": "React agent chat threads, composers, approvals, provider accounts and usage views.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -72,11 +72,11 @@
72
72
  "test:visuals": "bun --config=integration.bunfig.toml --conditions=source test ./src/chat/visual-viewport.integration.test.ts"
73
73
  },
74
74
  "dependencies": {
75
- "@adecore/agent-contracts": "0.50.4",
76
- "@adecore/editor": "0.50.4",
77
- "@adecore/editor-react": "0.50.4",
78
- "@adecore/intelligent-ui": "0.50.4",
79
- "@adecore/merge": "0.50.4",
75
+ "@adecore/agent-contracts": "0.50.6",
76
+ "@adecore/editor": "0.50.6",
77
+ "@adecore/editor-react": "0.50.6",
78
+ "@adecore/intelligent-ui": "0.50.6",
79
+ "@adecore/merge": "0.50.6",
80
80
  "@codemirror/commands": "^6.11.1",
81
81
  "@codemirror/language": "^6.13.1",
82
82
  "@codemirror/state": "^6.7.6",
@@ -100,14 +100,14 @@
100
100
  "zustand": "^5.0.16"
101
101
  },
102
102
  "peerDependencies": {
103
- "@adecore/ui": "^0.50.4",
103
+ "@adecore/ui": "^0.50.6",
104
104
  "i18next": "^26.4.2",
105
105
  "react": "^19.3.0",
106
106
  "react-dom": "^19.3.0",
107
107
  "react-i18next": "^17.0.15"
108
108
  },
109
109
  "devDependencies": {
110
- "@adecore/ui": "0.50.4",
110
+ "@adecore/ui": "0.50.6",
111
111
  "@types/bun": "^1.4.4",
112
112
  "@types/react": "^19.3.0",
113
113
  "@types/react-dom": "^19.3.0",
package/src/chat/index.ts CHANGED
@@ -26,7 +26,7 @@ export {
26
26
  type ForkWorktreeChoice
27
27
  } from './logic/fork';
28
28
 
29
- export { matchCommandLook, type CommandLookRun, type CommandLookWord } from './logic/command-looks';
29
+ export { matchCommandLook, sentMessageOf, type CommandLookRun, type CommandLookWord } from './logic/command-looks';
30
30
  export { handbackReportOf } from './logic/handback';
31
31
  export { limitView, type LimitView } from './logic/limit';
32
32
  export type { TickKind, ScrubberTick } from './logic/scrubber';
@@ -1,5 +1,7 @@
1
- import type { CommandLook, CommandLookMatch } from '../../host';
1
+ import type { ChatToolItem } from '@adecore/agent-contracts';
2
+ import type { CommandLook, CommandLookMatch, CommandLookSent } from '../../host';
2
3
  import { EMBEDDED_CODE_LIMIT, shellCommands, type EmbeddedCode, type ShellSimpleCommand, type ShellWord } from './embedded-code';
4
+ import { shellCommand } from './tools';
3
5
 
4
6
  // A folded value keeps this many characters of what it says.
5
7
  const FOLD_LENGTH = 40;
@@ -32,6 +34,12 @@ export interface CommandLookRun {
32
34
  readonly more: number;
33
35
  /* Whether the command is fed a heredoc, which the detail leaves out. */
34
36
  readonly heredoc: boolean;
37
+ /* The words after the program, quotes taken out. */
38
+ readonly args: readonly string[];
39
+ /* The lines of its one heredoc, or null without one, with more, or with one the shell fills in. */
40
+ readonly heredocText: string | null;
41
+ /* Whether the shell fills in a part of a word, so its text here is not what the program gets. */
42
+ readonly expands: boolean;
35
43
  }
36
44
 
37
45
  const caches = new WeakMap<readonly CommandLook[], Map<string, CommandLookRun | null>>();
@@ -121,6 +129,43 @@ function detailOf(source: string, command: ShellSimpleCommand, match: CommandLoo
121
129
  return { detail, code, words };
122
130
  }
123
131
 
132
+ /* Whether the shell would fill in a part of this source: a `$` or backtick outside single quotes and not escaped. */
133
+ function expandsInShell(source: string): boolean {
134
+ let quote: "'" | '"' | null = null;
135
+
136
+ for (let i = 0; i < source.length; i++) {
137
+ const char = source[i];
138
+
139
+ if (quote === "'") {
140
+ quote = char === "'" ? null : quote;
141
+ } else if (char === '\\') {
142
+ i++;
143
+ } else if (char === '$' || char === '`') {
144
+ return true;
145
+ } else if (char === "'" && quote === null) {
146
+ quote = "'";
147
+ } else if (char === '"') {
148
+ quote = quote === null ? '"' : null;
149
+ }
150
+ }
151
+
152
+ return false;
153
+ }
154
+
155
+ /* The text of a command's only heredoc, as long as a quoted delimiter or plain text says the shell leaves it alone. */
156
+ function heredocTextOf(source: string, command: ShellSimpleCommand): string | null {
157
+ const heredoc = command.heredocs.length === 1 ? command.heredocs[0] : undefined;
158
+
159
+ if (heredoc === undefined) {
160
+ return null;
161
+ }
162
+
163
+ const text = source.slice(heredoc.body.start, heredoc.body.end);
164
+ const quoted = /['"\\]/.test(source.slice(heredoc.start, heredoc.end));
165
+
166
+ return quoted || !/[$`\\]/.test(text) ? text : null;
167
+ }
168
+
124
169
  function read(command: string, looks: readonly CommandLook[]): CommandLookRun | null {
125
170
  let found: { command: ShellSimpleCommand; look: CommandLook; match: CommandLookMatch } | null = null;
126
171
  let more = 0;
@@ -148,7 +193,10 @@ function read(command: string, looks: readonly CommandLook[]): CommandLookRun |
148
193
  ...detailOf(command, found.command, found.match),
149
194
  others,
150
195
  more,
151
- heredoc: found.command.heredocs.length > 0
196
+ heredoc: found.command.heredocs.length > 0,
197
+ args: found.command.words.slice(found.command.program!.index + 1).map(({ text }) => text),
198
+ heredocText: heredocTextOf(command, found.command),
199
+ expands: found.command.words.some((word) => expandsInShell(command.slice(word.start, word.end)))
152
200
  };
153
201
  }
154
202
 
@@ -184,3 +232,15 @@ export function matchCommandLook(command: string, looks: readonly CommandLook[]
184
232
 
185
233
  return run;
186
234
  }
235
+
236
+ /* The message a shell call sent, per its look: only for a line that is exactly that one call, whose words are all known. */
237
+ export function sentMessageOf(tool: ChatToolItem, looks: readonly CommandLook[] | undefined): CommandLookSent | null {
238
+ const command = shellCommand(tool.name, tool.input);
239
+ const run = command === null ? null : matchCommandLook(command, looks);
240
+
241
+ if (run === null || run.look.sent === undefined || run.others.length > 0 || run.more > 0 || run.expands) {
242
+ return null;
243
+ }
244
+
245
+ return run.look.sent({ args: run.args, heredoc: run.heredocText, state: tool.state, output: tool.output });
246
+ }
@@ -51,6 +51,8 @@ export function messageTextOf(row: TimelineRow): string | null {
51
51
  return row.text;
52
52
  case 'message':
53
53
  return row.message.text || null;
54
+ case 'sent':
55
+ return row.sent.text || null;
54
56
  default:
55
57
  return null;
56
58
  }