@adecore/agents-react 0.37.1 → 0.37.3

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 (105) hide show
  1. package/dist/chat/chat-client.d.ts +1 -0
  2. package/dist/chat/chat-client.js +2 -1
  3. package/dist/chat/chat-references.d.ts +16 -1
  4. package/dist/chat/chat-references.js +29 -3
  5. package/dist/chat/drafts.d.ts +2 -0
  6. package/dist/chat/drafts.js +21 -5
  7. package/dist/chat/index.d.ts +1 -1
  8. package/dist/chat/logic/picker-entries.d.ts +6 -1
  9. package/dist/chat/logic/picker-entries.js +10 -0
  10. package/dist/chat/mentions.d.ts +31 -14
  11. package/dist/chat/mentions.js +186 -41
  12. package/dist/chat/stash.d.ts +1 -0
  13. package/dist/chat/stash.js +4 -2
  14. package/dist/chat/ui/Composer.js +438 -429
  15. package/dist/chat/ui/ComposerInput.d.ts +1 -0
  16. package/dist/chat/ui/ComposerInput.js +2 -0
  17. package/dist/chat/ui/Markdown.d.ts +3 -1
  18. package/dist/chat/ui/Markdown.js +194 -120
  19. package/dist/chat/ui/MessageActions.js +70 -66
  20. package/dist/chat/ui/Pickers.js +151 -207
  21. package/dist/chat/ui/ReferenceChip.d.ts +15 -0
  22. package/dist/chat/ui/ReferenceChip.js +255 -0
  23. package/dist/chat/ui/RunSettings.js +25 -21
  24. package/dist/chat/ui/Timeline.js +52 -29
  25. package/dist/chat/ui/TimelineMenu.js +84 -78
  26. package/dist/chat/ui/chip-clipboard.d.ts +9 -0
  27. package/dist/chat/ui/chip-clipboard.js +105 -0
  28. package/dist/chat/ui/chips.d.ts +5 -0
  29. package/dist/chat/ui/chips.js +15 -1
  30. package/dist/chat/ui/composer/ComposerMenu.js +140 -79
  31. package/dist/chat/ui/composer/DraftParts.d.ts +0 -4
  32. package/dist/chat/ui/composer/DraftParts.js +0 -41
  33. package/dist/chat/ui/composer/chip-paste.d.ts +15 -0
  34. package/dist/chat/ui/composer/chip-paste.js +104 -0
  35. package/dist/chat/ui/composer/chips.d.ts +5 -0
  36. package/dist/chat/ui/composer/chips.js +59 -9
  37. package/dist/chat/ui/composer/key-handler.js +9 -0
  38. package/dist/chat/ui/composer/use-composer-draft.d.ts +0 -1
  39. package/dist/chat/ui/composer/use-composer-draft.js +2 -10
  40. package/dist/chat/ui/composer/use-composer-menus.d.ts +12 -2
  41. package/dist/chat/ui/composer/use-composer-menus.js +192 -149
  42. package/dist/chat/ui/composer/use-composer-submit.js +17 -12
  43. package/dist/chat/ui/composer/use-draft-files.d.ts +7 -1
  44. package/dist/chat/ui/composer/use-draft-files.js +90 -58
  45. package/dist/chat/ui/composer/use-take-back.js +2 -1
  46. package/dist/chat/ui/index.d.ts +0 -1
  47. package/dist/chat/ui/index.js +0 -1
  48. package/dist/chat/ui/reference-icons.d.ts +3 -0
  49. package/dist/chat/ui/reference-icons.js +15 -0
  50. package/dist/chat/ui/reference-lookup.d.ts +7 -0
  51. package/dist/chat/ui/reference-lookup.js +6 -0
  52. package/dist/chat/ui/rehype-chips.d.ts +8 -1
  53. package/dist/chat/ui/rehype-chips.js +35 -11
  54. package/dist/chat/ui/rows/MessageRows.js +218 -158
  55. package/dist/chat/ui/thread-references.d.ts +4 -0
  56. package/dist/chat/ui/thread-references.js +78 -0
  57. package/dist/host-hooks.d.ts +2 -0
  58. package/dist/host-hooks.js +7 -0
  59. package/dist/host.d.ts +3 -0
  60. package/dist/locales/en/agent-chat.d.ts +20 -3
  61. package/dist/locales/en/agent-chat.js +24 -7
  62. package/dist/locales/nl/agent-chat.d.ts +20 -3
  63. package/dist/locales/nl/agent-chat.js +24 -7
  64. package/package.json +8 -8
  65. package/src/chat/chat-client.ts +4 -1
  66. package/src/chat/chat-references.ts +44 -3
  67. package/src/chat/drafts.ts +24 -6
  68. package/src/chat/index.ts +1 -1
  69. package/src/chat/logic/picker-entries.ts +12 -1
  70. package/src/chat/mentions.ts +202 -36
  71. package/src/chat/stash.ts +6 -2
  72. package/src/chat/ui/Composer.tsx +14 -4
  73. package/src/chat/ui/ComposerInput.tsx +4 -0
  74. package/src/chat/ui/Markdown.tsx +57 -25
  75. package/src/chat/ui/MessageActions.tsx +5 -2
  76. package/src/chat/ui/Pickers.tsx +8 -2
  77. package/src/chat/ui/ReferenceChip.tsx +74 -0
  78. package/src/chat/ui/RunSettings.tsx +29 -23
  79. package/src/chat/ui/Timeline.tsx +24 -2
  80. package/src/chat/ui/TimelineMenu.tsx +7 -3
  81. package/src/chat/ui/chip-clipboard.ts +115 -0
  82. package/src/chat/ui/chips.ts +20 -1
  83. package/src/chat/ui/composer/ComposerMenu.tsx +53 -37
  84. package/src/chat/ui/composer/DraftParts.tsx +0 -12
  85. package/src/chat/ui/composer/chip-paste.ts +122 -0
  86. package/src/chat/ui/composer/chips.ts +60 -10
  87. package/src/chat/ui/composer/key-handler.ts +9 -0
  88. package/src/chat/ui/composer/use-composer-draft.ts +1 -7
  89. package/src/chat/ui/composer/use-composer-menus.ts +68 -29
  90. package/src/chat/ui/composer/use-composer-submit.ts +13 -6
  91. package/src/chat/ui/composer/use-draft-files.ts +39 -5
  92. package/src/chat/ui/composer/use-take-back.ts +2 -1
  93. package/src/chat/ui/index.ts +0 -1
  94. package/src/chat/ui/reference-icons.ts +17 -0
  95. package/src/chat/ui/reference-lookup.ts +13 -0
  96. package/src/chat/ui/rehype-chips.ts +38 -13
  97. package/src/chat/ui/rows/MessageRows.tsx +88 -64
  98. package/src/chat/ui/thread-references.ts +47 -0
  99. package/src/host-hooks.ts +9 -0
  100. package/src/host.ts +6 -1
  101. package/src/locales/en/agent-chat.ts +24 -7
  102. package/src/locales/nl/agent-chat.ts +24 -7
  103. package/dist/chat/ui/ChatReferenceChip.d.ts +0 -4
  104. package/dist/chat/ui/ChatReferenceChip.js +0 -110
  105. package/src/chat/ui/ChatReferenceChip.tsx +0 -26
@@ -10,7 +10,10 @@ import { useChatScope } from '../../../scope.js';
10
10
  import { splitQuote } from '../../quote.js';
11
11
  import { jumpToTimelineItem } from '../../timeline-scroll.js';
12
12
  import { useProviders } from '../../../state/providers.js';
13
- import { ChatReferenceChip } from '../ChatReferenceChip.js';
13
+ import { referenceTokens } from '../../chat-references.js';
14
+ import { presentReferences } from '../../mentions.js';
15
+ import { ReferenceChip } from '../ReferenceChip.js';
16
+ import { ReferenceLookupContext } from '../reference-lookup.js';
14
17
  import { ImageThumb } from '../ImageView.js';
15
18
  import { Markdown, MessageMarkdown, ReplyMarkdown } from '../Markdown.js';
16
19
  import { FadingWords } from '../FadingWords.js';
@@ -26,6 +29,8 @@ import { useOpenForFind } from '../find-reveal.js';
26
29
  import { ReplyContext, UiReplyNavigationContext } from '../reply-context.js';
27
30
  import { UiReply } from '../intelligent-ui/UiReply.js';
28
31
  import { useHostAttachmentUrl, useHostChatPlace, useHostReplyAuthor, useHostStreaming } from '../../../host-hooks.js';
32
+ import { copySelectionWithChips } from '../chip-clipboard.js';
33
+ import { useReferenceLookup } from '../thread-references.js';
29
34
  // A long prompt folds so the answer stays in view; the reader can open it.
30
35
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
31
36
  const USER_FOLD_LINES = 8;
@@ -183,7 +188,7 @@ function AttachmentThumb(t0) {
183
188
  return t1;
184
189
  }
185
190
  export function UserRow(t0) {
186
- const $ = _c(43);
191
+ const $ = _c(51);
187
192
  const {
188
193
  chatId,
189
194
  item
@@ -210,33 +215,43 @@ export function UserRow(t0) {
210
215
  t2 = $[3];
211
216
  }
212
217
  const attachments = t2;
213
- let t3;
214
- if ($[4] !== item.chats) {
215
- t3 = item.chats ?? [];
216
- $[4] = item.chats;
217
- $[5] = t3;
218
- } else {
219
- t3 = $[5];
220
- }
221
- const chats = t3;
222
218
  const [missing, setMissing] = useState(false);
223
219
  const {
224
220
  keyOf
225
221
  } = useChatScope();
222
+ const lookup = useReferenceLookup(chatId);
223
+ let references;
224
+ let t3;
225
+ if ($[4] !== item.chats || $[5] !== item.references || $[6] !== item.text || $[7] !== lookup.items) {
226
+ const referenced = [...(item.chats ?? []), ...(item.references ?? [])];
227
+ references = referenceTokens(referenced, lookup.items);
228
+ const placed = presentReferences(item.text, referenced, references);
229
+ t3 = referenced.filter(id => !placed.includes(id));
230
+ $[4] = item.chats;
231
+ $[5] = item.references;
232
+ $[6] = item.text;
233
+ $[7] = lookup.items;
234
+ $[8] = references;
235
+ $[9] = t3;
236
+ } else {
237
+ references = $[8];
238
+ t3 = $[9];
239
+ }
240
+ const beside = t3;
226
241
  useOpenForFind(item.id, "text", setOpen);
227
242
  let t4;
228
- if ($[6] !== item.quoteSource || $[7] !== item.text) {
243
+ if ($[10] !== item.quoteSource || $[11] !== item.text) {
229
244
  t4 = item.quoteSource === undefined ? null : splitQuote(item.text);
230
- $[6] = item.quoteSource;
231
- $[7] = item.text;
232
- $[8] = t4;
245
+ $[10] = item.quoteSource;
246
+ $[11] = item.text;
247
+ $[12] = t4;
233
248
  } else {
234
- t4 = $[8];
249
+ t4 = $[12];
235
250
  }
236
251
  const quoted = t4;
237
252
  const source = item.quoteSource?.itemId;
238
253
  let t5;
239
- if ($[9] !== chatId || $[10] !== keyOf || $[11] !== source) {
254
+ if ($[13] !== chatId || $[14] !== keyOf || $[15] !== source) {
240
255
  t5 = function goToSource() {
241
256
  if (source !== undefined) {
242
257
  setMissing(false);
@@ -246,35 +261,35 @@ export function UserRow(t0) {
246
261
  });
247
262
  }
248
263
  };
249
- $[9] = chatId;
250
- $[10] = keyOf;
251
- $[11] = source;
252
- $[12] = t5;
264
+ $[13] = chatId;
265
+ $[14] = keyOf;
266
+ $[15] = source;
267
+ $[16] = t5;
253
268
  } else {
254
- t5 = $[12];
269
+ t5 = $[16];
255
270
  }
256
271
  const goToSource = t5;
257
272
  const t6 = item.id;
258
273
  let t7;
259
- if ($[13] !== t) {
274
+ if ($[17] !== t) {
260
275
  t7 = t("rows.user.heading");
261
- $[13] = t;
262
- $[14] = t7;
276
+ $[17] = t;
277
+ $[18] = t7;
263
278
  } else {
264
- t7 = $[14];
279
+ t7 = $[18];
265
280
  }
266
281
  let t8;
267
- if ($[15] !== t7) {
282
+ if ($[19] !== t7) {
268
283
  t8 = /*#__PURE__*/_jsx(MessageHeading, {
269
284
  children: t7
270
285
  });
271
- $[15] = t7;
272
- $[16] = t8;
286
+ $[19] = t7;
287
+ $[20] = t8;
273
288
  } else {
274
- t8 = $[16];
289
+ t8 = $[20];
275
290
  }
276
291
  let t9;
277
- if ($[17] !== attachments || $[18] !== chatId) {
292
+ if ($[21] !== attachments || $[22] !== chatId) {
278
293
  t9 = attachments.length > 0 && /*#__PURE__*/_jsx("div", {
279
294
  className: "mb-1.5 flex max-w-[80%] flex-wrap justify-end gap-1.5",
280
295
  children: attachments.map(attachment => isImageAttachment(attachment.mime) ? /*#__PURE__*/_jsx(AttachmentThumb, {
@@ -285,37 +300,37 @@ export function UserRow(t0) {
285
300
  attachment: attachment
286
301
  }, attachment.id))
287
302
  });
288
- $[17] = attachments;
289
- $[18] = chatId;
290
- $[19] = t9;
303
+ $[21] = attachments;
304
+ $[22] = chatId;
305
+ $[23] = t9;
291
306
  } else {
292
- t9 = $[19];
307
+ t9 = $[23];
293
308
  }
294
309
  let t10;
295
- if ($[20] !== chats) {
296
- t10 = chats.length > 0 && /*#__PURE__*/_jsx("div", {
310
+ if ($[24] !== beside) {
311
+ t10 = beside.length > 0 && /*#__PURE__*/_jsx("div", {
297
312
  className: "mb-1.5 flex max-w-[80%] flex-wrap justify-end gap-1.5",
298
- children: chats.map(_temp)
313
+ children: beside.map(_temp2)
299
314
  });
300
- $[20] = chats;
301
- $[21] = t10;
315
+ $[24] = beside;
316
+ $[25] = t10;
302
317
  } else {
303
- t10 = $[21];
318
+ t10 = $[25];
304
319
  }
305
320
  let t11;
306
- if ($[22] !== chatId || $[23] !== item.uiChoice) {
321
+ if ($[26] !== chatId || $[27] !== item.uiChoice) {
307
322
  t11 = item.uiChoice !== undefined && /*#__PURE__*/_jsx(ChoiceLine, {
308
323
  chatId: chatId,
309
324
  choice: item.uiChoice
310
325
  });
311
- $[22] = chatId;
312
- $[23] = item.uiChoice;
313
- $[24] = t11;
326
+ $[26] = chatId;
327
+ $[27] = item.uiChoice;
328
+ $[28] = t11;
314
329
  } else {
315
- t11 = $[24];
330
+ t11 = $[28];
316
331
  }
317
332
  let t12;
318
- if ($[25] !== goToSource || $[26] !== item.mentions || $[27] !== item.skills || $[28] !== item.text || $[29] !== long || $[30] !== missing || $[31] !== open || $[32] !== quoted || $[33] !== source || $[34] !== t) {
333
+ if ($[29] !== goToSource || $[30] !== item.mentions || $[31] !== item.skills || $[32] !== item.text || $[33] !== long || $[34] !== missing || $[35] !== open || $[36] !== quoted || $[37] !== references || $[38] !== source || $[39] !== t) {
319
334
  t12 = item.text !== "" && /*#__PURE__*/_jsxs("div", {
320
335
  className: "relative max-w-[80%] rounded-2xl bg-surface-active px-3.5 py-2.5 text-sm wrap-anywhere text-text select-text",
321
336
  children: [/*#__PURE__*/_jsx("div", {
@@ -329,9 +344,9 @@ export function UserRow(t0) {
329
344
  tabIndex: 0,
330
345
  className: "mb-2 cursor-pointer rounded-sm border-l-2 border-border-strong pl-2.5 text-text-muted hover:bg-text/5 hover:text-text focus-visible:outline-2 focus-visible:outline-accent",
331
346
  onClick: goToSource,
332
- onKeyDown: e => {
333
- if (e.key === "Enter" || e.key === " ") {
334
- e.preventDefault();
347
+ onKeyDown: e_0 => {
348
+ if (e_0.key === "Enter" || e_0.key === " ") {
349
+ e_0.preventDefault();
335
350
  goToSource();
336
351
  }
337
352
  },
@@ -345,16 +360,18 @@ export function UserRow(t0) {
345
360
  }), quoted.rest !== "" && /*#__PURE__*/_jsx(MessageMarkdown, {
346
361
  text: quoted.rest,
347
362
  mentions: item.mentions,
348
- skills: item.skills
363
+ skills: item.skills,
364
+ references: references
349
365
  })]
350
366
  }) : /*#__PURE__*/_jsx(MessageMarkdown, {
351
367
  text: item.text,
352
368
  mentions: item.mentions,
353
- skills: item.skills
369
+ skills: item.skills,
370
+ references: references
354
371
  })
355
372
  }), long && /*#__PURE__*/_jsxs("button", {
356
373
  className: "mt-1 flex items-center gap-1 text-xs text-text-muted hover:text-text",
357
- onClick: () => setOpen(_temp2),
374
+ onClick: () => setOpen(_temp3),
358
375
  children: [/*#__PURE__*/_jsx(Icon, {
359
376
  icon: ChevronDown,
360
377
  size: 12,
@@ -362,50 +379,67 @@ export function UserRow(t0) {
362
379
  }), " ", open ? t("rows.user.showLess") : t("rows.user.showAll")]
363
380
  })]
364
381
  });
365
- $[25] = goToSource;
366
- $[26] = item.mentions;
367
- $[27] = item.skills;
368
- $[28] = item.text;
369
- $[29] = long;
370
- $[30] = missing;
371
- $[31] = open;
372
- $[32] = quoted;
373
- $[33] = source;
374
- $[34] = t;
375
- $[35] = t12;
376
- } else {
377
- t12 = $[35];
382
+ $[29] = goToSource;
383
+ $[30] = item.mentions;
384
+ $[31] = item.skills;
385
+ $[32] = item.text;
386
+ $[33] = long;
387
+ $[34] = missing;
388
+ $[35] = open;
389
+ $[36] = quoted;
390
+ $[37] = references;
391
+ $[38] = source;
392
+ $[39] = t;
393
+ $[40] = t12;
394
+ } else {
395
+ t12 = $[40];
378
396
  }
379
397
  let t13;
380
- if ($[36] !== item.id || $[37] !== t10 || $[38] !== t11 || $[39] !== t12 || $[40] !== t8 || $[41] !== t9) {
398
+ if ($[41] !== item.id || $[42] !== t10 || $[43] !== t11 || $[44] !== t12 || $[45] !== t8 || $[46] !== t9) {
381
399
  t13 = /*#__PURE__*/_jsxs("div", {
382
400
  "data-find-item": t6,
383
401
  className: "flex flex-col items-end",
402
+ onCopy: _temp,
384
403
  children: [t8, t9, t10, t11, t12]
385
404
  });
386
- $[36] = item.id;
387
- $[37] = t10;
388
- $[38] = t11;
389
- $[39] = t12;
390
- $[40] = t8;
391
- $[41] = t9;
392
- $[42] = t13;
405
+ $[41] = item.id;
406
+ $[42] = t10;
407
+ $[43] = t11;
408
+ $[44] = t12;
409
+ $[45] = t8;
410
+ $[46] = t9;
411
+ $[47] = t13;
412
+ } else {
413
+ t13 = $[47];
414
+ }
415
+ let t14;
416
+ if ($[48] !== lookup || $[49] !== t13) {
417
+ t14 = /*#__PURE__*/_jsx(ReferenceLookupContext, {
418
+ value: lookup,
419
+ children: t13
420
+ });
421
+ $[48] = lookup;
422
+ $[49] = t13;
423
+ $[50] = t14;
393
424
  } else {
394
- t13 = $[42];
425
+ t14 = $[50];
395
426
  }
396
- return t13;
427
+ return t14;
397
428
  }
398
429
  /*
399
430
  * The choice a message answers. The label stays out of the message, which holds exactly what the agent
400
431
  * read, and out of a copied selection; a screen reader hears it between the heading and the message.
401
432
  */
402
- function _temp2(o) {
433
+ function _temp3(o) {
403
434
  return !o;
404
435
  }
405
- function _temp(id) {
406
- return /*#__PURE__*/_jsx(ChatReferenceChip, {
407
- chatId: id
408
- }, id);
436
+ function _temp2(id_0) {
437
+ return /*#__PURE__*/_jsx(ReferenceChip, {
438
+ id: id_0
439
+ }, id_0);
440
+ }
441
+ function _temp(e) {
442
+ return copySelectionWithChips(e.nativeEvent);
409
443
  }
410
444
  function ChoiceLine(t0) {
411
445
  const $ = _c(19);
@@ -610,7 +644,7 @@ function ReplyHeading(t0) {
610
644
  } = useTranslation("agent-chat");
611
645
  const context = useContext(ReplyContext);
612
646
  const author = useReplyAuthor(chatId);
613
- const kind = useChatRow(chatId, _temp3);
647
+ const kind = useChatRow(chatId, _temp4);
614
648
  let t1;
615
649
  if ($[0] !== context?.provider || $[1] !== kind) {
616
650
  t1 = s => s.providers.find(provider => provider.kind === (context?.provider ?? kind))?.name;
@@ -647,7 +681,7 @@ function ReplyHeading(t0) {
647
681
  * The line over a reply with who wrote it and how long ago, when the host names its author. A screen
648
682
  * reader hears the name from the reply's own heading, so this line is for the eye only.
649
683
  */
650
- function _temp3(row) {
684
+ function _temp4(row) {
651
685
  return row?.info.provider;
652
686
  }
653
687
  export function ReplyHeader(t0) {
@@ -755,15 +789,17 @@ function Writing() {
755
789
  * A reply. A word at a time, it follows the text as it arrives. A block at a time, the blocks that
756
790
  * closed are drawn and fade in as they land, with "Writing…" where the next one will stand. Whole,
757
791
  * it says it is being written and fades in once it is done. Only a row that saw the reply being
758
- * written fades anything: an old reply scrolled back into view just stands there.
792
+ * written fades anything: an old reply scrolled back into view just stands there. A `#Name` it
793
+ * spells for a view, node or chat of the project is a chip that opens it.
759
794
  */
760
795
  export function AssistantRow(t0) {
761
- const $ = _c(63);
796
+ const $ = _c(67);
762
797
  const {
763
798
  chatId,
764
799
  item: derived
765
800
  } = t0;
766
801
  const item = useCurrentItem(chatId, derived);
802
+ const lookup = useReferenceLookup(chatId);
767
803
  const scope = useChatScope();
768
804
  const context = useContext(ReplyContext);
769
805
  let t1;
@@ -880,154 +916,178 @@ export function AssistantRow(t0) {
880
916
  t3 = $[29];
881
917
  }
882
918
  let t4;
883
- if ($[30] !== reply || $[31] !== sawWriting || $[32] !== settled) {
919
+ if ($[30] !== lookup || $[31] !== reply || $[32] !== sawWriting || $[33] !== settled) {
884
920
  t4 = settled !== "" && /*#__PURE__*/_jsx("div", {
885
921
  "data-find-field": "text",
886
922
  "data-quote-answer": true,
887
923
  className: "contents",
888
- children: /*#__PURE__*/_jsx(ReplyMarkdown, {
889
- text: settled,
890
- streaming: false,
891
- arriving: sawWriting,
892
- reply: reply
924
+ children: /*#__PURE__*/_jsx(ReferenceLookupContext, {
925
+ value: lookup,
926
+ children: /*#__PURE__*/_jsx(ReplyMarkdown, {
927
+ text: settled,
928
+ streaming: false,
929
+ arriving: sawWriting,
930
+ reply: reply
931
+ })
893
932
  })
894
933
  });
895
- $[30] = reply;
896
- $[31] = sawWriting;
897
- $[32] = settled;
898
- $[33] = t4;
934
+ $[30] = lookup;
935
+ $[31] = reply;
936
+ $[32] = sawWriting;
937
+ $[33] = settled;
938
+ $[34] = t4;
899
939
  } else {
900
- t4 = $[33];
940
+ t4 = $[34];
901
941
  }
902
942
  let t5;
903
- if ($[34] !== item.streaming) {
943
+ if ($[35] !== item.streaming) {
904
944
  t5 = item.streaming && /*#__PURE__*/_jsx(Writing, {});
905
- $[34] = item.streaming;
906
- $[35] = t5;
945
+ $[35] = item.streaming;
946
+ $[36] = t5;
907
947
  } else {
908
- t5 = $[35];
948
+ t5 = $[36];
909
949
  }
910
950
  let t6;
911
- if ($[36] !== item.id || $[37] !== t3 || $[38] !== t4 || $[39] !== t5) {
951
+ if ($[37] !== item.id || $[38] !== t3 || $[39] !== t4 || $[40] !== t5) {
912
952
  t6 = /*#__PURE__*/_jsxs("div", {
913
953
  "data-find-item": item.id,
914
954
  className: "-mx-1 px-1 pb-2",
955
+ onCopy: _temp5,
915
956
  children: [t3, t4, t5]
916
957
  });
917
- $[36] = item.id;
918
- $[37] = t3;
919
- $[38] = t4;
920
- $[39] = t5;
921
- $[40] = t6;
958
+ $[37] = item.id;
959
+ $[38] = t3;
960
+ $[39] = t4;
961
+ $[40] = t5;
962
+ $[41] = t6;
922
963
  } else {
923
- t6 = $[40];
964
+ t6 = $[41];
924
965
  }
925
966
  return t6;
926
967
  }
927
968
  if (mode === "whole" && item.streaming) {
928
969
  let t2;
929
- if ($[41] !== chatId) {
970
+ if ($[42] !== chatId) {
930
971
  t2 = /*#__PURE__*/_jsx(ReplyHeading, {
931
972
  chatId: chatId
932
973
  });
933
- $[41] = chatId;
934
- $[42] = t2;
974
+ $[42] = chatId;
975
+ $[43] = t2;
935
976
  } else {
936
- t2 = $[42];
977
+ t2 = $[43];
937
978
  }
938
979
  let t3;
939
- if ($[43] === Symbol.for("react.memo_cache_sentinel")) {
980
+ if ($[44] === Symbol.for("react.memo_cache_sentinel")) {
940
981
  t3 = /*#__PURE__*/_jsx(Writing, {});
941
- $[43] = t3;
982
+ $[44] = t3;
942
983
  } else {
943
- t3 = $[43];
984
+ t3 = $[44];
944
985
  }
945
986
  let t4;
946
- if ($[44] !== t2) {
987
+ if ($[45] !== t2) {
947
988
  t4 = /*#__PURE__*/_jsxs("div", {
948
989
  className: "-mx-1 px-1 pb-2",
949
990
  children: [t2, t3]
950
991
  });
951
- $[44] = t2;
952
- $[45] = t4;
992
+ $[45] = t2;
993
+ $[46] = t4;
953
994
  } else {
954
- t4 = $[45];
995
+ t4 = $[46];
955
996
  }
956
997
  return t4;
957
998
  }
958
999
  const t2 = item.id;
959
1000
  const t3 = mode === "whole" && sawWriting && WHOLE_FADE_CLASS;
960
1001
  let t4;
961
- if ($[46] !== t3) {
1002
+ if ($[47] !== t3) {
962
1003
  t4 = clsx("-mx-1 px-1 pb-2", t3);
963
- $[46] = t3;
964
- $[47] = t4;
1004
+ $[47] = t3;
1005
+ $[48] = t4;
965
1006
  } else {
966
- t4 = $[47];
1007
+ t4 = $[48];
967
1008
  }
968
1009
  let t5;
969
- if ($[48] !== chatId) {
1010
+ if ($[49] !== chatId) {
970
1011
  t5 = /*#__PURE__*/_jsx(ReplyHeading, {
971
1012
  chatId: chatId
972
1013
  });
973
- $[48] = chatId;
974
- $[49] = t5;
1014
+ $[49] = chatId;
1015
+ $[50] = t5;
975
1016
  } else {
976
- t5 = $[49];
1017
+ t5 = $[50];
977
1018
  }
978
1019
  let t6;
979
- if ($[50] !== reply || $[51] !== reveal.active || $[52] !== reveal.text) {
980
- t6 = /*#__PURE__*/_jsx("div", {
1020
+ if ($[51] !== reply || $[52] !== reveal.active || $[53] !== reveal.text) {
1021
+ t6 = /*#__PURE__*/_jsx(ReplyMarkdown, {
1022
+ text: reveal.text,
1023
+ streaming: reveal.active,
1024
+ reply: reply
1025
+ });
1026
+ $[51] = reply;
1027
+ $[52] = reveal.active;
1028
+ $[53] = reveal.text;
1029
+ $[54] = t6;
1030
+ } else {
1031
+ t6 = $[54];
1032
+ }
1033
+ let t7;
1034
+ if ($[55] !== lookup || $[56] !== t6) {
1035
+ t7 = /*#__PURE__*/_jsx("div", {
981
1036
  "data-find-field": "text",
982
1037
  "data-quote-answer": true,
983
1038
  className: "contents",
984
- children: /*#__PURE__*/_jsx(ReplyMarkdown, {
985
- text: reveal.text,
986
- streaming: reveal.active,
987
- reply: reply
1039
+ children: /*#__PURE__*/_jsx(ReferenceLookupContext, {
1040
+ value: lookup,
1041
+ children: t6
988
1042
  })
989
1043
  });
990
- $[50] = reply;
991
- $[51] = reveal.active;
992
- $[52] = reveal.text;
993
- $[53] = t6;
1044
+ $[55] = lookup;
1045
+ $[56] = t6;
1046
+ $[57] = t7;
994
1047
  } else {
995
- t6 = $[53];
1048
+ t7 = $[57];
996
1049
  }
997
- let t7;
998
- if ($[54] !== item.text || $[55] !== live) {
999
- t7 = live && item.text === "" && /*#__PURE__*/_jsx("span", {
1050
+ let t8;
1051
+ if ($[58] !== item.text || $[59] !== live) {
1052
+ t8 = live && item.text === "" && /*#__PURE__*/_jsx("span", {
1000
1053
  className: "inline-block h-3.5 w-1.5 animate-pulse rounded-sm bg-text-faint align-middle"
1001
1054
  });
1002
- $[54] = item.text;
1003
- $[55] = live;
1004
- $[56] = t7;
1055
+ $[58] = item.text;
1056
+ $[59] = live;
1057
+ $[60] = t8;
1005
1058
  } else {
1006
- t7 = $[56];
1059
+ t8 = $[60];
1007
1060
  }
1008
- let t8;
1009
- if ($[57] !== item.id || $[58] !== t4 || $[59] !== t5 || $[60] !== t6 || $[61] !== t7) {
1010
- t8 = /*#__PURE__*/_jsxs("div", {
1061
+ let t9;
1062
+ if ($[61] !== item.id || $[62] !== t4 || $[63] !== t5 || $[64] !== t7 || $[65] !== t8) {
1063
+ t9 = /*#__PURE__*/_jsxs("div", {
1011
1064
  "data-find-item": t2,
1012
1065
  className: t4,
1013
- children: [t5, t6, t7]
1066
+ onCopy: _temp6,
1067
+ children: [t5, t7, t8]
1014
1068
  });
1015
- $[57] = item.id;
1016
- $[58] = t4;
1017
- $[59] = t5;
1018
- $[60] = t6;
1019
- $[61] = t7;
1020
- $[62] = t8;
1069
+ $[61] = item.id;
1070
+ $[62] = t4;
1071
+ $[63] = t5;
1072
+ $[64] = t7;
1073
+ $[65] = t8;
1074
+ $[66] = t9;
1021
1075
  } else {
1022
- t8 = $[62];
1076
+ t9 = $[66];
1023
1077
  }
1024
- return t8;
1078
+ return t9;
1025
1079
  }
1026
1080
  /*
1027
1081
  * What the model thought before it answered. It shimmers while it streams and folds itself away
1028
1082
  * once the answer starts, because the thought is worth a glance and rarely worth reading twice:
1029
1083
  * folded, it shows the heading it opens with or itself on one line, and opened, it reads as Markdown.
1030
1084
  */
1085
+ function _temp6(e_0) {
1086
+ return copySelectionWithChips(e_0.nativeEvent);
1087
+ }
1088
+ function _temp5(e) {
1089
+ return copySelectionWithChips(e.nativeEvent);
1090
+ }
1031
1091
  export function ThinkingRow(t0) {
1032
1092
  const $ = _c(27);
1033
1093
  const {
@@ -1082,7 +1142,7 @@ export function ThinkingRow(t0) {
1082
1142
  const t6 = item.streaming ? undefined : open;
1083
1143
  let t7;
1084
1144
  if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
1085
- t7 = () => setOpen(_temp4);
1145
+ t7 = () => setOpen(_temp7);
1086
1146
  $[11] = t7;
1087
1147
  } else {
1088
1148
  t7 = $[11];
@@ -1188,7 +1248,7 @@ export function ThinkingRow(t0) {
1188
1248
  * The latest thought of a running turn over the call it led to, as its heading or first sentence,
1189
1249
  * so what the model found stays in view while it checks it. Nothing while the thought has no line yet.
1190
1250
  */
1191
- function _temp4(o) {
1251
+ function _temp7(o) {
1192
1252
  return !o;
1193
1253
  }
1194
1254
  export function LiveThoughtRow(t0) {
@@ -0,0 +1,4 @@
1
+ import type { ChatItem } from '@adecore/agent-contracts';
2
+ import type { ReferenceLookup } from './reference-lookup.js';
3
+ export declare function threadReferencedKey(structure: Record<string, ChatItem> | undefined): string;
4
+ export declare function useReferenceLookup(chatId: string): ReferenceLookup;