@adecore/agents-react 0.46.2 → 0.47.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.
Files changed (58) hide show
  1. package/dist/chat/index.d.ts +1 -0
  2. package/dist/chat/index.js +1 -0
  3. package/dist/chat/logic/scrubber.js +12 -0
  4. package/dist/chat/logic/timeline-copy.js +2 -0
  5. package/dist/chat/logic/timeline.d.ts +6 -1
  6. package/dist/chat/logic/timeline.js +36 -10
  7. package/dist/chat/ui/ChatActivity.d.ts +2 -1
  8. package/dist/chat/ui/ChatActivity.js +295 -61
  9. package/dist/chat/ui/Composer.d.ts +2 -1
  10. package/dist/chat/ui/Composer.js +492 -486
  11. package/dist/chat/ui/PromptEditor.js +4 -1
  12. package/dist/chat/ui/ReferenceChip.d.ts +2 -1
  13. package/dist/chat/ui/ReferenceChip.js +135 -100
  14. package/dist/chat/ui/composer/ComposerMenu.js +17 -11
  15. package/dist/chat/ui/composer/chips.d.ts +3 -0
  16. package/dist/chat/ui/composer/chips.js +14 -10
  17. package/dist/chat/ui/reference-icons.d.ts +3 -0
  18. package/dist/chat/ui/reference-icons.js +15 -2
  19. package/dist/chat/ui/rows/MessageRows.d.ts +6 -1
  20. package/dist/chat/ui/rows/MessageRows.js +166 -10
  21. package/dist/chat/ui/rows/RowContainer.js +21 -22
  22. package/dist/chat/ui/rows/Rows.js +37 -19
  23. package/dist/chat/ui/rows/WorkflowRow.d.ts +2 -1
  24. package/dist/chat/ui/rows/WorkflowRow.js +197 -191
  25. package/dist/chat/ui/rows/row-rhythm.d.ts +1 -0
  26. package/dist/chat/ui/rows/row-rhythm.js +12 -3
  27. package/dist/chat/workflow-list.d.ts +12 -0
  28. package/dist/chat/workflow-list.js +54 -0
  29. package/dist/host.d.ts +8 -1
  30. package/dist/index.d.ts +1 -1
  31. package/dist/locales/en/agent-chat.d.ts +9 -0
  32. package/dist/locales/en/agent-chat.js +9 -0
  33. package/dist/locales/nl/agent-chat.d.ts +9 -0
  34. package/dist/locales/nl/agent-chat.js +9 -0
  35. package/dist/theme.css +4 -2
  36. package/package.json +8 -8
  37. package/src/chat/index.ts +1 -0
  38. package/src/chat/logic/scrubber.ts +5 -0
  39. package/src/chat/logic/timeline-copy.ts +2 -0
  40. package/src/chat/logic/timeline.ts +33 -2
  41. package/src/chat/ui/ChatActivity.tsx +52 -6
  42. package/src/chat/ui/Composer.tsx +19 -3
  43. package/src/chat/ui/PromptEditor.tsx +3 -1
  44. package/src/chat/ui/ReferenceChip.tsx +15 -5
  45. package/src/chat/ui/composer/ComposerMenu.tsx +4 -2
  46. package/src/chat/ui/composer/chips.ts +15 -9
  47. package/src/chat/ui/reference-icons.ts +13 -1
  48. package/src/chat/ui/rows/MessageRows.tsx +35 -0
  49. package/src/chat/ui/rows/RowContainer.tsx +2 -2
  50. package/src/chat/ui/rows/Rows.tsx +3 -0
  51. package/src/chat/ui/rows/WorkflowRow.tsx +9 -4
  52. package/src/chat/ui/rows/row-rhythm.ts +12 -3
  53. package/src/chat/workflow-list.ts +65 -0
  54. package/src/host.ts +15 -1
  55. package/src/index.ts +1 -0
  56. package/src/locales/en/agent-chat.ts +9 -0
  57. package/src/locales/nl/agent-chat.ts +9 -0
  58. package/src/theme.css +4 -2
@@ -429,8 +429,8 @@ export function UserRow(t0) {
429
429
  return t14;
430
430
  }
431
431
  /*
432
- * The choice a message answers. The label stays out of the message, which holds exactly what the agent
433
- * read, and out of a copied selection; a screen reader hears it between the heading and the message.
432
+ * A message another node sent the chat: a bubble like a person's, under a chip that names and opens the sender,
433
+ * but on the left, since the person did not write it.
434
434
  */
435
435
  function _temp3(o) {
436
436
  return !o;
@@ -443,6 +443,162 @@ function _temp2(id_0) {
443
443
  function _temp(e) {
444
444
  return copySelectionWithChips(e.nativeEvent);
445
445
  }
446
+ export function SentMessageRow(t0) {
447
+ const $ = _c(32);
448
+ const {
449
+ chatId,
450
+ id,
451
+ message
452
+ } = t0;
453
+ const {
454
+ t
455
+ } = useTranslation("agent-chat");
456
+ const [open, setOpen] = useState(false);
457
+ let t1;
458
+ if ($[0] !== message.text) {
459
+ t1 = message.text.split("\n").length > USER_FOLD_LINES || message.text.length > USER_FOLD_CHARS;
460
+ $[0] = message.text;
461
+ $[1] = t1;
462
+ } else {
463
+ t1 = $[1];
464
+ }
465
+ const long = t1;
466
+ const lookup = useReferenceLookup(chatId);
467
+ useOpenForFind(id, "text", setOpen);
468
+ let t2;
469
+ if ($[2] !== message.title || $[3] !== t) {
470
+ t2 = t("rows.message.heading", {
471
+ name: message.title || t("rows.message.unnamed")
472
+ });
473
+ $[2] = message.title;
474
+ $[3] = t;
475
+ $[4] = t2;
476
+ } else {
477
+ t2 = $[4];
478
+ }
479
+ let t3;
480
+ if ($[5] !== t2) {
481
+ t3 = /*#__PURE__*/_jsx(MessageHeading, {
482
+ children: t2
483
+ });
484
+ $[5] = t2;
485
+ $[6] = t3;
486
+ } else {
487
+ t3 = $[6];
488
+ }
489
+ let t4;
490
+ if ($[7] !== message.from || $[8] !== message.title) {
491
+ t4 = /*#__PURE__*/_jsx("div", {
492
+ className: "mb-1.5 flex max-w-[80%]",
493
+ children: /*#__PURE__*/_jsx(ReferenceChip, {
494
+ id: message.from,
495
+ lastName: message.title
496
+ })
497
+ });
498
+ $[7] = message.from;
499
+ $[8] = message.title;
500
+ $[9] = t4;
501
+ } else {
502
+ t4 = $[9];
503
+ }
504
+ const t5 = long && !open && FOLD;
505
+ let t6;
506
+ if ($[10] !== t5) {
507
+ t6 = clsx(t5);
508
+ $[10] = t5;
509
+ $[11] = t6;
510
+ } else {
511
+ t6 = $[11];
512
+ }
513
+ let t7;
514
+ if ($[12] !== message.text) {
515
+ t7 = /*#__PURE__*/_jsx(MessageMarkdown, {
516
+ text: message.text
517
+ });
518
+ $[12] = message.text;
519
+ $[13] = t7;
520
+ } else {
521
+ t7 = $[13];
522
+ }
523
+ let t8;
524
+ if ($[14] !== t6 || $[15] !== t7) {
525
+ t8 = /*#__PURE__*/_jsx("div", {
526
+ "data-find-field": "text",
527
+ className: t6,
528
+ children: t7
529
+ });
530
+ $[14] = t6;
531
+ $[15] = t7;
532
+ $[16] = t8;
533
+ } else {
534
+ t8 = $[16];
535
+ }
536
+ let t9;
537
+ if ($[17] !== long || $[18] !== open || $[19] !== t) {
538
+ t9 = long && /*#__PURE__*/_jsxs("button", {
539
+ className: "mt-1 flex items-center gap-1 text-xs text-text-muted hover:text-text",
540
+ onClick: () => setOpen(_temp4),
541
+ children: [/*#__PURE__*/_jsx(Icon, {
542
+ icon: ChevronDown,
543
+ size: 12,
544
+ className: clsx("transition-transform", open && "rotate-180")
545
+ }), " ", open ? t("rows.user.showLess") : t("rows.user.showAll")]
546
+ });
547
+ $[17] = long;
548
+ $[18] = open;
549
+ $[19] = t;
550
+ $[20] = t9;
551
+ } else {
552
+ t9 = $[20];
553
+ }
554
+ let t10;
555
+ if ($[21] !== t8 || $[22] !== t9) {
556
+ t10 = /*#__PURE__*/_jsxs("div", {
557
+ className: "relative max-w-[80%] rounded-2xl bg-surface-hover px-3.5 py-2.5 text-sm wrap-anywhere text-text select-text",
558
+ children: [t8, t9]
559
+ });
560
+ $[21] = t8;
561
+ $[22] = t9;
562
+ $[23] = t10;
563
+ } else {
564
+ t10 = $[23];
565
+ }
566
+ let t11;
567
+ if ($[24] !== id || $[25] !== t10 || $[26] !== t3 || $[27] !== t4) {
568
+ t11 = /*#__PURE__*/_jsxs("div", {
569
+ "data-find-item": id,
570
+ className: "flex flex-col items-start",
571
+ children: [t3, t4, t10]
572
+ });
573
+ $[24] = id;
574
+ $[25] = t10;
575
+ $[26] = t3;
576
+ $[27] = t4;
577
+ $[28] = t11;
578
+ } else {
579
+ t11 = $[28];
580
+ }
581
+ let t12;
582
+ if ($[29] !== lookup || $[30] !== t11) {
583
+ t12 = /*#__PURE__*/_jsx(ReferenceLookupContext, {
584
+ value: lookup,
585
+ children: t11
586
+ });
587
+ $[29] = lookup;
588
+ $[30] = t11;
589
+ $[31] = t12;
590
+ } else {
591
+ t12 = $[31];
592
+ }
593
+ return t12;
594
+ }
595
+ /*
596
+ * The choice a message answers. The label stays out of the message, which holds exactly what the agent
597
+ * read, and out of a copied selection; a screen reader hears it between the heading and the message.
598
+ */
599
+ function _temp4(o) {
600
+ return !o;
601
+ }
446
602
  function ChoiceLine(t0) {
447
603
  const $ = _c(19);
448
604
  const {
@@ -646,7 +802,7 @@ function ReplyHeading(t0) {
646
802
  } = useTranslation("agent-chat");
647
803
  const context = useContext(ReplyContext);
648
804
  const author = useReplyAuthor(chatId);
649
- const kind = useChatRow(chatId, _temp4);
805
+ const kind = useChatRow(chatId, _temp5);
650
806
  let t1;
651
807
  if ($[0] !== context?.provider || $[1] !== kind) {
652
808
  t1 = s => s.providers.find(provider => provider.kind === (context?.provider ?? kind))?.name;
@@ -683,7 +839,7 @@ function ReplyHeading(t0) {
683
839
  * The line over a reply with who wrote it and how long ago, when the host names its author. A screen
684
840
  * reader hears the name from the reply's own heading, so this line is for the eye only.
685
841
  */
686
- function _temp4(row) {
842
+ function _temp5(row) {
687
843
  return row?.info.provider;
688
844
  }
689
845
  export function ReplyHeader(t0) {
@@ -951,7 +1107,7 @@ export function AssistantRow(t0) {
951
1107
  t6 = /*#__PURE__*/_jsxs("div", {
952
1108
  "data-find-item": item.id,
953
1109
  className: "-mx-1 px-1 pb-2",
954
- onCopy: _temp5,
1110
+ onCopy: _temp6,
955
1111
  children: [t3, t4, t5]
956
1112
  });
957
1113
  $[37] = item.id;
@@ -1062,7 +1218,7 @@ export function AssistantRow(t0) {
1062
1218
  t9 = /*#__PURE__*/_jsxs("div", {
1063
1219
  "data-find-item": t2,
1064
1220
  className: t4,
1065
- onCopy: _temp6,
1221
+ onCopy: _temp7,
1066
1222
  children: [t5, t7, t8]
1067
1223
  });
1068
1224
  $[61] = item.id;
@@ -1081,10 +1237,10 @@ export function AssistantRow(t0) {
1081
1237
  * once the answer starts, because the thought is worth a glance and rarely worth reading twice:
1082
1238
  * folded, it shows the heading it opens with or itself on one line, and opened, it reads as Markdown.
1083
1239
  */
1084
- function _temp6(e_0) {
1240
+ function _temp7(e_0) {
1085
1241
  return copySelectionWithChips(e_0.nativeEvent);
1086
1242
  }
1087
- function _temp5(e) {
1243
+ function _temp6(e) {
1088
1244
  return copySelectionWithChips(e.nativeEvent);
1089
1245
  }
1090
1246
  export function ThinkingRow(t0) {
@@ -1141,7 +1297,7 @@ export function ThinkingRow(t0) {
1141
1297
  const t6 = item.streaming ? undefined : open;
1142
1298
  let t7;
1143
1299
  if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
1144
- t7 = () => setOpen(_temp7);
1300
+ t7 = () => setOpen(_temp8);
1145
1301
  $[11] = t7;
1146
1302
  } else {
1147
1303
  t7 = $[11];
@@ -1247,7 +1403,7 @@ export function ThinkingRow(t0) {
1247
1403
  * The latest thought of a running turn over the call it led to, as its heading or first sentence,
1248
1404
  * so what the model found stays in view while it checks it. Nothing while the thought has no line yet.
1249
1405
  */
1250
- function _temp7(o) {
1406
+ function _temp8(o) {
1251
1407
  return !o;
1252
1408
  }
1253
1409
  export function LiveThoughtRow(t0) {
@@ -1,6 +1,6 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
2
  import clsx from 'clsx';
3
- import { rowPosition, rowRhythm } from './row-rhythm.js';
3
+ import { rowPosition, rowRhythm, saidToChat } from './row-rhythm.js';
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
  export function RowContainer(t0) {
6
6
  const $ = _c(15);
@@ -14,46 +14,45 @@ export function RowContainer(t0) {
14
14
  } = t0;
15
15
  const wide = row.kind === "visual" && row.visual.layout === "wide";
16
16
  const t1 = row.id;
17
- const t2 = wide ? "chat-wide-content" : "chat-column-content";
18
- let t3;
19
- if ($[0] !== index || $[1] !== previous || $[2] !== row || $[3] !== t2) {
20
- t3 = clsx("absolute inset-x-0 top-0 mx-auto w-full", t2, rowRhythm(row, previous), row.kind === "user" && index > 0 && "pt-(--chat-turn-gap)");
17
+ let t2;
18
+ if ($[0] !== index || $[1] !== previous || $[2] !== row || $[3] !== wide) {
19
+ t2 = clsx("absolute inset-x-0 top-0 mx-auto w-full", wide ? "chat-wide-content" : "chat-column-content", rowRhythm(row, previous), saidToChat(row) && index > 0 && "pt-(--chat-turn-gap)");
21
20
  $[0] = index;
22
21
  $[1] = previous;
23
22
  $[2] = row;
24
- $[3] = t2;
25
- $[4] = t3;
23
+ $[3] = wide;
24
+ $[4] = t2;
26
25
  } else {
27
- t3 = $[4];
26
+ t2 = $[4];
28
27
  }
29
- let t4;
28
+ let t3;
30
29
  if ($[5] !== row.kind || $[6] !== top) {
31
- t4 = rowPosition(row.kind, top);
30
+ t3 = rowPosition(row.kind, top);
32
31
  $[5] = row.kind;
33
32
  $[6] = top;
34
- $[7] = t4;
33
+ $[7] = t3;
35
34
  } else {
36
- t4 = $[7];
35
+ t3 = $[7];
37
36
  }
38
- let t5;
39
- if ($[8] !== children || $[9] !== index || $[10] !== ref || $[11] !== row.id || $[12] !== t3 || $[13] !== t4) {
40
- t5 = /*#__PURE__*/_jsx("div", {
37
+ let t4;
38
+ if ($[8] !== children || $[9] !== index || $[10] !== ref || $[11] !== row.id || $[12] !== t2 || $[13] !== t3) {
39
+ t4 = /*#__PURE__*/_jsx("div", {
41
40
  "data-index": index,
42
41
  "data-item-id": t1,
43
42
  ref: ref,
44
- className: t3,
45
- style: t4,
43
+ className: t2,
44
+ style: t3,
46
45
  children: children
47
46
  });
48
47
  $[8] = children;
49
48
  $[9] = index;
50
49
  $[10] = ref;
51
50
  $[11] = row.id;
52
- $[12] = t3;
53
- $[13] = t4;
54
- $[14] = t5;
51
+ $[12] = t2;
52
+ $[13] = t3;
53
+ $[14] = t4;
55
54
  } else {
56
- t5 = $[14];
55
+ t4 = $[14];
57
56
  }
58
- return t5;
57
+ return t4;
59
58
  }
@@ -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, ThinkingRow, UserRow } from './MessageRows.js';
4
+ import { AgentTurnRow, ApprovalHistoryRow, AssistantRow, CompactionRow, LiveThoughtRow, NoteRow, QuestionHistoryRow, ReportRow, 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(85);
73
+ const $ = _c(89);
74
74
  const {
75
75
  row,
76
76
  chatId,
@@ -420,61 +420,79 @@ export function Row(t0) {
420
420
  }
421
421
  return t1;
422
422
  }
423
+ case "message":
424
+ {
425
+ let t1;
426
+ if ($[76] !== chatId || $[77] !== row.id || $[78] !== row.message) {
427
+ t1 = /*#__PURE__*/_jsx(SentMessageRow, {
428
+ chatId: chatId,
429
+ id: row.id,
430
+ message: row.message
431
+ });
432
+ $[76] = chatId;
433
+ $[77] = row.id;
434
+ $[78] = row.message;
435
+ $[79] = t1;
436
+ } else {
437
+ t1 = $[79];
438
+ }
439
+ return t1;
440
+ }
423
441
  case "compaction":
424
442
  {
425
443
  let t1;
426
- if ($[76] !== row.preTokens) {
444
+ if ($[80] !== row.preTokens) {
427
445
  t1 = /*#__PURE__*/_jsx(CompactionRow, {
428
446
  preTokens: row.preTokens
429
447
  });
430
- $[76] = row.preTokens;
431
- $[77] = t1;
448
+ $[80] = row.preTokens;
449
+ $[81] = t1;
432
450
  } else {
433
- t1 = $[77];
451
+ t1 = $[81];
434
452
  }
435
453
  return t1;
436
454
  }
437
455
  case "working":
438
456
  {
439
457
  let t1;
440
- if ($[78] !== row.startedAt) {
458
+ if ($[82] !== row.startedAt) {
441
459
  t1 = /*#__PURE__*/_jsx(WorkingRow, {
442
460
  startedAt: row.startedAt
443
461
  });
444
- $[78] = row.startedAt;
445
- $[79] = t1;
462
+ $[82] = row.startedAt;
463
+ $[83] = t1;
446
464
  } else {
447
- t1 = $[79];
465
+ t1 = $[83];
448
466
  }
449
467
  return t1;
450
468
  }
451
469
  case "app-card":
452
470
  {
453
471
  let t1;
454
- if ($[80] !== row.card) {
472
+ if ($[84] !== row.card) {
455
473
  t1 = /*#__PURE__*/_jsx(AppCardRow, {
456
474
  card: row.card
457
475
  });
458
- $[80] = row.card;
459
- $[81] = t1;
476
+ $[84] = row.card;
477
+ $[85] = t1;
460
478
  } else {
461
- t1 = $[81];
479
+ t1 = $[85];
462
480
  }
463
481
  return t1;
464
482
  }
465
483
  case "visual":
466
484
  {
467
485
  let t1;
468
- if ($[82] !== chatId || $[83] !== row.visual) {
486
+ if ($[86] !== chatId || $[87] !== row.visual) {
469
487
  t1 = /*#__PURE__*/_jsx(VisualRow, {
470
488
  chatId: chatId,
471
489
  visual: row.visual
472
490
  });
473
- $[82] = chatId;
474
- $[83] = row.visual;
475
- $[84] = t1;
491
+ $[86] = chatId;
492
+ $[87] = row.visual;
493
+ $[88] = t1;
476
494
  } else {
477
- t1 = $[84];
495
+ t1 = $[88];
478
496
  }
479
497
  return t1;
480
498
  }
@@ -1,8 +1,9 @@
1
1
  import type { ChatToolItem, ChatWorkflow } from '@adecore/agent-contracts';
2
2
  import type { SubagentStep } from '../../subagent-view.js';
3
- export declare function WorkflowRow({ tool, workflow, chatId, onOpenAgent }: {
3
+ export declare function WorkflowRow({ tool, workflow, chatId, onOpenAgent, place }: {
4
4
  tool: ChatToolItem;
5
5
  workflow: ChatWorkflow;
6
6
  chatId?: string;
7
7
  onOpenAgent?(step: SubagentStep): void;
8
+ place?: 'thread' | 'flyout';
8
9
  }): import("react").JSX.Element;