@adecore/agents-react 0.46.3 → 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 (56) 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/package.json +8 -8
  36. package/src/chat/index.ts +1 -0
  37. package/src/chat/logic/scrubber.ts +5 -0
  38. package/src/chat/logic/timeline-copy.ts +2 -0
  39. package/src/chat/logic/timeline.ts +33 -2
  40. package/src/chat/ui/ChatActivity.tsx +52 -6
  41. package/src/chat/ui/Composer.tsx +19 -3
  42. package/src/chat/ui/PromptEditor.tsx +3 -1
  43. package/src/chat/ui/ReferenceChip.tsx +15 -5
  44. package/src/chat/ui/composer/ComposerMenu.tsx +4 -2
  45. package/src/chat/ui/composer/chips.ts +15 -9
  46. package/src/chat/ui/reference-icons.ts +13 -1
  47. package/src/chat/ui/rows/MessageRows.tsx +35 -0
  48. package/src/chat/ui/rows/RowContainer.tsx +2 -2
  49. package/src/chat/ui/rows/Rows.tsx +3 -0
  50. package/src/chat/ui/rows/WorkflowRow.tsx +9 -4
  51. package/src/chat/ui/rows/row-rhythm.ts +12 -3
  52. package/src/chat/workflow-list.ts +65 -0
  53. package/src/host.ts +15 -1
  54. package/src/index.ts +1 -0
  55. package/src/locales/en/agent-chat.ts +9 -0
  56. package/src/locales/nl/agent-chat.ts +9 -0
@@ -150,18 +150,23 @@ function Counts(t0) {
150
150
  }
151
151
  return t1;
152
152
  }
153
- // Keep background progress visible after the launcher turn ends.
153
+ /*
154
+ * Keep background progress visible after the launcher turn ends. In the flyout over the composer it
155
+ * has no call to open and is no place in the thread a search jumps to.
156
+ */
154
157
  function _temp2(part) {
155
158
  return part.count > 0;
156
159
  }
157
160
  export function WorkflowRow(t0) {
158
- const $ = _c(79);
161
+ const $ = _c(80);
159
162
  const {
160
163
  tool,
161
164
  workflow,
162
165
  chatId,
163
- onOpenAgent
166
+ onOpenAgent,
167
+ place: t1
164
168
  } = t0;
169
+ const place = t1 === undefined ? "thread" : t1;
165
170
  const host = useChatHost();
166
171
  const {
167
172
  t
@@ -171,51 +176,52 @@ export function WorkflowRow(t0) {
171
176
  keyOf
172
177
  } = useChatScope();
173
178
  const [open, setOpen] = useState(false);
174
- let t1;
179
+ let t2;
175
180
  if ($[0] !== id) {
176
- t1 = s => s.unsupported[id] === true;
181
+ t2 = s => s.unsupported[id] === true;
177
182
  $[0] = id;
178
- $[1] = t1;
183
+ $[1] = t2;
179
184
  } else {
180
- t1 = $[1];
185
+ t2 = $[1];
181
186
  }
182
- const refused = useSubagentSupport(t1);
183
- let t2;
187
+ const refused = useSubagentSupport(t2);
188
+ let t3;
184
189
  if ($[2] !== chatId || $[3] !== keyOf) {
185
- t2 = s_0 => chatId === undefined ? undefined : s_0.statusByKey[keyOf(chatId)]?.info?.provider;
190
+ t3 = s_0 => chatId === undefined ? undefined : s_0.statusByKey[keyOf(chatId)]?.info?.provider;
186
191
  $[2] = chatId;
187
192
  $[3] = keyOf;
188
- $[4] = t2;
193
+ $[4] = t3;
189
194
  } else {
190
- t2 = $[4];
195
+ t3 = $[4];
191
196
  }
192
- const provider = useChats(t2);
197
+ const provider = useChats(t3);
193
198
  const running = tool.state === "running";
194
199
  const phases = workflowPhases(workflow, running);
195
200
  const counts = workflowCounts(phases);
196
- let t3;
201
+ let t4;
197
202
  if ($[5] !== tool.input) {
198
- t3 = workflowDescription(tool.input);
203
+ t4 = workflowDescription(tool.input);
199
204
  $[5] = tool.input;
200
- $[6] = t3;
205
+ $[6] = t4;
201
206
  } else {
202
- t3 = $[6];
207
+ t4 = $[6];
203
208
  }
204
- const description = t3;
205
- let t4;
206
- if ($[7] !== tool) {
207
- t4 = hasToolBody(tool);
208
- $[7] = tool;
209
- $[8] = t4;
209
+ const description = t4;
210
+ let t5;
211
+ if ($[7] !== place || $[8] !== tool) {
212
+ t5 = place === "thread" && hasToolBody(tool);
213
+ $[7] = place;
214
+ $[8] = tool;
215
+ $[9] = t5;
210
216
  } else {
211
- t4 = $[8];
217
+ t5 = $[9];
212
218
  }
213
- const opens = t4;
219
+ const opens = t5;
214
220
  const onOpen = refused ? undefined : onOpenAgent;
215
221
  const actions = useChatActions();
216
- let t5;
217
- if ($[9] !== actions || $[10] !== chatId || $[11] !== host || $[12] !== t || $[13] !== workflow.taskId) {
218
- t5 = () => {
222
+ let t6;
223
+ if ($[10] !== actions || $[11] !== chatId || $[12] !== host || $[13] !== t || $[14] !== workflow.taskId) {
224
+ t6 = () => {
219
225
  if (chatId && workflow.taskId) {
220
226
  actions.stopTask(chatId, workflow.taskId).catch(error => {
221
227
  host.notify({
@@ -226,134 +232,134 @@ export function WorkflowRow(t0) {
226
232
  });
227
233
  }
228
234
  };
229
- $[9] = actions;
230
- $[10] = chatId;
231
- $[11] = host;
232
- $[12] = t;
233
- $[13] = workflow.taskId;
234
- $[14] = t5;
235
+ $[10] = actions;
236
+ $[11] = chatId;
237
+ $[12] = host;
238
+ $[13] = t;
239
+ $[14] = workflow.taskId;
240
+ $[15] = t6;
235
241
  } else {
236
- t5 = $[14];
242
+ t6 = $[15];
237
243
  }
238
- const stop = t5;
244
+ const stop = t6;
239
245
  const failed = tool.state === "error";
240
- const t6 = running && "text-accent";
241
- let t7;
242
- if ($[15] !== t6) {
243
- t7 = clsx(ROW_GUTTER, t6);
244
- $[15] = t6;
246
+ const t7 = running && "text-accent";
247
+ let t8;
248
+ if ($[16] !== t7) {
249
+ t8 = clsx(ROW_GUTTER, t7);
245
250
  $[16] = t7;
251
+ $[17] = t8;
246
252
  } else {
247
- t7 = $[16];
253
+ t8 = $[17];
248
254
  }
249
- let t8;
250
- if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
251
- t8 = /*#__PURE__*/_jsx(Icon, {
255
+ let t9;
256
+ if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
257
+ t9 = /*#__PURE__*/_jsx(Icon, {
252
258
  icon: Workflow,
253
259
  size: 12
254
260
  });
255
- $[17] = t8;
261
+ $[18] = t9;
256
262
  } else {
257
- t8 = $[17];
263
+ t9 = $[18];
258
264
  }
259
- let t9;
260
- if ($[18] !== t7) {
261
- t9 = /*#__PURE__*/_jsx("span", {
262
- className: t7,
263
- children: t8
265
+ let t10;
266
+ if ($[19] !== t8) {
267
+ t10 = /*#__PURE__*/_jsx("span", {
268
+ className: t8,
269
+ children: t9
264
270
  });
265
- $[18] = t7;
266
- $[19] = t9;
271
+ $[19] = t8;
272
+ $[20] = t10;
267
273
  } else {
268
- t9 = $[19];
274
+ t10 = $[20];
269
275
  }
270
- const t10 = running && "chat-live-text";
271
- let t11;
272
- if ($[20] !== t10) {
273
- t11 = clsx("shrink-0", t10);
274
- $[20] = t10;
276
+ const t11 = running && "chat-live-text";
277
+ let t12;
278
+ if ($[21] !== t11) {
279
+ t12 = clsx("shrink-0", t11);
275
280
  $[21] = t11;
281
+ $[22] = t12;
276
282
  } else {
277
- t11 = $[21];
283
+ t12 = $[22];
278
284
  }
279
- const t12 = `rows.workflow.${running ? "running" : failed ? "failed" : "done"}`;
280
- let t13;
281
- if ($[22] !== t || $[23] !== t12) {
282
- t13 = t(t12);
283
- $[22] = t;
284
- $[23] = t12;
285
+ const t13 = `rows.workflow.${running ? "running" : failed ? "failed" : "done"}`;
286
+ let t14;
287
+ if ($[23] !== t || $[24] !== t13) {
288
+ t14 = t(t13);
289
+ $[23] = t;
285
290
  $[24] = t13;
291
+ $[25] = t14;
286
292
  } else {
287
- t13 = $[24];
293
+ t14 = $[25];
288
294
  }
289
- let t14;
290
- if ($[25] !== t11 || $[26] !== t13) {
291
- t14 = /*#__PURE__*/_jsx("span", {
292
- className: t11,
293
- children: t13
295
+ let t15;
296
+ if ($[26] !== t12 || $[27] !== t14) {
297
+ t15 = /*#__PURE__*/_jsx("span", {
298
+ className: t12,
299
+ children: t14
294
300
  });
295
- $[25] = t11;
296
- $[26] = t13;
301
+ $[26] = t12;
297
302
  $[27] = t14;
303
+ $[28] = t15;
298
304
  } else {
299
- t14 = $[27];
305
+ t15 = $[28];
300
306
  }
301
- let t15;
302
- if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
303
- t15 = /*#__PURE__*/_jsx("span", {
307
+ let t16;
308
+ if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
309
+ t16 = /*#__PURE__*/_jsx("span", {
304
310
  className: "grow"
305
311
  });
306
- $[28] = t15;
312
+ $[29] = t16;
307
313
  } else {
308
- t15 = $[28];
314
+ t16 = $[29];
309
315
  }
310
- const t16 = counts.total > 0 && /*#__PURE__*/_jsx(Counts, {
316
+ const t17 = counts.total > 0 && /*#__PURE__*/_jsx(Counts, {
311
317
  counts: counts
312
318
  });
313
- let t17;
314
- if ($[29] !== open || $[30] !== opens) {
315
- t17 = opens && /*#__PURE__*/_jsx(Icon, {
319
+ let t18;
320
+ if ($[30] !== open || $[31] !== opens) {
321
+ t18 = opens && /*#__PURE__*/_jsx(Icon, {
316
322
  icon: ChevronRight,
317
323
  size: 12,
318
324
  className: clsx("shrink-0 text-text-faint transition-transform", open && "rotate-90")
319
325
  });
320
- $[29] = open;
321
- $[30] = opens;
322
- $[31] = t17;
326
+ $[30] = open;
327
+ $[31] = opens;
328
+ $[32] = t18;
323
329
  } else {
324
- t17 = $[31];
330
+ t18 = $[32];
325
331
  }
326
- let t18;
327
- if ($[32] !== t14 || $[33] !== t16 || $[34] !== t17 || $[35] !== t9) {
328
- t18 = /*#__PURE__*/_jsxs(_Fragment, {
329
- children: [t9, t14, t15, t16, t17]
332
+ let t19;
333
+ if ($[33] !== t10 || $[34] !== t15 || $[35] !== t17 || $[36] !== t18) {
334
+ t19 = /*#__PURE__*/_jsxs(_Fragment, {
335
+ children: [t10, t15, t16, t17, t18]
330
336
  });
331
- $[32] = t14;
332
- $[33] = t16;
333
- $[34] = t17;
334
- $[35] = t9;
337
+ $[33] = t10;
338
+ $[34] = t15;
339
+ $[35] = t17;
335
340
  $[36] = t18;
341
+ $[37] = t19;
336
342
  } else {
337
- t18 = $[36];
343
+ t19 = $[37];
338
344
  }
339
- const header = t18;
340
- const t19 = failed ? "text-status-error" : "text-text-muted";
341
- const t20 = opens && "hover:bg-surface-hover";
342
- let t21;
343
- if ($[37] !== t19 || $[38] !== t20) {
344
- t21 = clsx("-mx-1 flex h-7 w-[calc(100%+8px)] min-w-0 items-center gap-2 rounded-md px-1 text-left text-xs", t19, t20);
345
- $[37] = t19;
345
+ const header = t19;
346
+ const t20 = failed ? "text-status-error" : "text-text-muted";
347
+ const t21 = opens && "hover:bg-surface-hover";
348
+ let t22;
349
+ if ($[38] !== t20 || $[39] !== t21) {
350
+ t22 = clsx("-mx-1 flex h-7 w-[calc(100%+8px)] min-w-0 items-center gap-2 rounded-md px-1 text-left text-xs", t20, t21);
346
351
  $[38] = t20;
347
352
  $[39] = t21;
353
+ $[40] = t22;
348
354
  } else {
349
- t21 = $[39];
355
+ t22 = $[40];
350
356
  }
351
- const headerClasses = t21;
352
- const t22 = tool.id;
353
- const t23 = "mb-1";
354
- let t24;
355
- if ($[40] !== header || $[41] !== headerClasses || $[42] !== opens) {
356
- t24 = /*#__PURE__*/_jsx("div", {
357
+ const headerClasses = t22;
358
+ const t23 = place === "thread" ? tool.id : undefined;
359
+ const t24 = "mb-1";
360
+ let t25;
361
+ if ($[41] !== header || $[42] !== headerClasses || $[43] !== opens) {
362
+ t25 = /*#__PURE__*/_jsx("div", {
357
363
  className: "min-w-0 grow",
358
364
  children: opens ? /*#__PURE__*/_jsx("button", {
359
365
  className: headerClasses,
@@ -364,82 +370,82 @@ export function WorkflowRow(t0) {
364
370
  children: header
365
371
  })
366
372
  });
367
- $[40] = header;
368
- $[41] = headerClasses;
369
- $[42] = opens;
370
- $[43] = t24;
373
+ $[41] = header;
374
+ $[42] = headerClasses;
375
+ $[43] = opens;
376
+ $[44] = t25;
371
377
  } else {
372
- t24 = $[43];
378
+ t25 = $[44];
373
379
  }
374
- let t25;
375
- if ($[44] !== chatId || $[45] !== running || $[46] !== stop || $[47] !== t || $[48] !== workflow.taskId) {
376
- t25 = running && chatId && workflow.taskId && /*#__PURE__*/_jsx(IconButton, {
380
+ let t26;
381
+ if ($[45] !== chatId || $[46] !== running || $[47] !== stop || $[48] !== t || $[49] !== workflow.taskId) {
382
+ t26 = running && chatId && workflow.taskId && /*#__PURE__*/_jsx(IconButton, {
377
383
  icon: Square,
378
384
  size: "xs",
379
385
  label: t("activity.stop"),
380
386
  onClick: stop
381
387
  });
382
- $[44] = chatId;
383
- $[45] = running;
384
- $[46] = stop;
385
- $[47] = t;
386
- $[48] = workflow.taskId;
387
- $[49] = t25;
388
+ $[45] = chatId;
389
+ $[46] = running;
390
+ $[47] = stop;
391
+ $[48] = t;
392
+ $[49] = workflow.taskId;
393
+ $[50] = t26;
388
394
  } else {
389
- t25 = $[49];
395
+ t26 = $[50];
390
396
  }
391
- let t26;
392
- if ($[50] !== t24 || $[51] !== t25) {
393
- t26 = /*#__PURE__*/_jsxs("div", {
397
+ let t27;
398
+ if ($[51] !== t25 || $[52] !== t26) {
399
+ t27 = /*#__PURE__*/_jsxs("div", {
394
400
  className: "flex items-center gap-1",
395
- children: [t24, t25]
401
+ children: [t25, t26]
396
402
  });
397
- $[50] = t24;
398
403
  $[51] = t25;
399
404
  $[52] = t26;
405
+ $[53] = t27;
400
406
  } else {
401
- t26 = $[52];
407
+ t27 = $[53];
402
408
  }
403
- let t27;
404
- if ($[53] !== chatId || $[54] !== open || $[55] !== opens || $[56] !== tool) {
405
- t27 = open && opens && /*#__PURE__*/_jsx(ToolBody, {
409
+ let t28;
410
+ if ($[54] !== chatId || $[55] !== open || $[56] !== opens || $[57] !== tool) {
411
+ t28 = open && opens && /*#__PURE__*/_jsx(ToolBody, {
406
412
  tool: tool,
407
413
  chatId: chatId
408
414
  });
409
- $[53] = chatId;
410
- $[54] = open;
411
- $[55] = opens;
412
- $[56] = tool;
413
- $[57] = t27;
415
+ $[54] = chatId;
416
+ $[55] = open;
417
+ $[56] = opens;
418
+ $[57] = tool;
419
+ $[58] = t28;
414
420
  } else {
415
- t27 = $[57];
421
+ t28 = $[58];
416
422
  }
417
- const t28 = "mt-1.5 ml-6";
418
- let t29;
419
- if ($[58] !== workflow.name) {
420
- t29 = workflow.name !== null && /*#__PURE__*/_jsx("div", {
423
+ const t29 = "mt-1.5 ml-6";
424
+ let t30;
425
+ if ($[59] !== workflow.name) {
426
+ t30 = workflow.name !== null && /*#__PURE__*/_jsx("div", {
421
427
  className: "truncate text-sm font-medium text-text",
422
428
  children: workflow.name
423
429
  });
424
- $[58] = workflow.name;
425
- $[59] = t29;
430
+ $[59] = workflow.name;
431
+ $[60] = t30;
426
432
  } else {
427
- t29 = $[59];
433
+ t30 = $[60];
428
434
  }
429
- let t30;
430
- if ($[60] !== description) {
431
- t30 = description !== null && /*#__PURE__*/_jsx("p", {
435
+ let t31;
436
+ if ($[61] !== description) {
437
+ t31 = description !== null && /*#__PURE__*/_jsx("p", {
432
438
  className: "mt-0.5 line-clamp-2 text-xs text-text-muted",
433
439
  children: description
434
440
  });
435
- $[60] = description;
436
- $[61] = t30;
441
+ $[61] = description;
442
+ $[62] = t31;
437
443
  } else {
438
- t30 = $[61];
444
+ t31 = $[62];
439
445
  }
440
- let t31;
441
- if ($[62] !== running || $[63] !== t || $[64] !== workflow.stalledAt) {
442
- t31 = running && workflow.stalledAt !== undefined && /*#__PURE__*/_jsxs("p", {
446
+ let t32;
447
+ if ($[63] !== running || $[64] !== t || $[65] !== workflow.stalledAt) {
448
+ t32 = running && workflow.stalledAt !== undefined && /*#__PURE__*/_jsxs("p", {
443
449
  role: "status",
444
450
  className: "mt-1 flex items-start gap-1.5 text-xs text-text-muted",
445
451
  children: [/*#__PURE__*/_jsx(Icon, {
@@ -450,57 +456,57 @@ export function WorkflowRow(t0) {
450
456
  children: t("rows.workflow.stalled")
451
457
  })]
452
458
  });
453
- $[62] = running;
454
- $[63] = t;
455
- $[64] = workflow.stalledAt;
456
- $[65] = t31;
459
+ $[63] = running;
460
+ $[64] = t;
461
+ $[65] = workflow.stalledAt;
462
+ $[66] = t32;
457
463
  } else {
458
- t31 = $[65];
464
+ t32 = $[66];
459
465
  }
460
- let t32;
461
- if ($[66] !== onOpen || $[67] !== provider) {
462
- t32 = phase => /*#__PURE__*/_jsx(PhaseBlock, {
466
+ let t33;
467
+ if ($[67] !== onOpen || $[68] !== provider) {
468
+ t33 = phase => /*#__PURE__*/_jsx(PhaseBlock, {
463
469
  phase: phase,
464
470
  provider: provider,
465
471
  onOpen: onOpen
466
472
  }, phase.key);
467
- $[66] = onOpen;
468
- $[67] = provider;
469
- $[68] = t32;
473
+ $[67] = onOpen;
474
+ $[68] = provider;
475
+ $[69] = t33;
470
476
  } else {
471
- t32 = $[68];
477
+ t33 = $[69];
472
478
  }
473
- const t33 = phases.map(t32);
474
- let t34;
475
- if ($[69] !== t29 || $[70] !== t30 || $[71] !== t31 || $[72] !== t33) {
476
- t34 = /*#__PURE__*/_jsxs("div", {
477
- className: t28,
478
- children: [t29, t30, t31, t33]
479
+ const t34 = phases.map(t33);
480
+ let t35;
481
+ if ($[70] !== t30 || $[71] !== t31 || $[72] !== t32 || $[73] !== t34) {
482
+ t35 = /*#__PURE__*/_jsxs("div", {
483
+ className: t29,
484
+ children: [t30, t31, t32, t34]
479
485
  });
480
- $[69] = t29;
481
486
  $[70] = t30;
482
487
  $[71] = t31;
483
- $[72] = t33;
488
+ $[72] = t32;
484
489
  $[73] = t34;
490
+ $[74] = t35;
485
491
  } else {
486
- t34 = $[73];
492
+ t35 = $[74];
487
493
  }
488
- let t35;
489
- if ($[74] !== t26 || $[75] !== t27 || $[76] !== t34 || $[77] !== tool.id) {
490
- t35 = /*#__PURE__*/_jsxs("div", {
491
- "data-find-item": t22,
492
- className: t23,
493
- children: [t26, t27, t34]
494
+ let t36;
495
+ if ($[75] !== t23 || $[76] !== t27 || $[77] !== t28 || $[78] !== t35) {
496
+ t36 = /*#__PURE__*/_jsxs("div", {
497
+ "data-find-item": t23,
498
+ className: t24,
499
+ children: [t27, t28, t35]
494
500
  });
495
- $[74] = t26;
496
- $[75] = t27;
497
- $[76] = t34;
498
- $[77] = tool.id;
501
+ $[75] = t23;
502
+ $[76] = t27;
503
+ $[77] = t28;
499
504
  $[78] = t35;
505
+ $[79] = t36;
500
506
  } else {
501
- t35 = $[78];
507
+ t36 = $[79];
502
508
  }
503
- return t35;
509
+ return t36;
504
510
  }
505
511
  function _temp3(value) {
506
512
  return !value;
@@ -1,6 +1,7 @@
1
1
  import type { CSSProperties } from 'react';
2
2
  import { type TimelineRow } from '../../logic/timeline.js';
3
3
  export declare const FOLLOW_THRESHOLD_PX = 40;
4
+ export declare function saidToChat(row: TimelineRow): boolean;
4
5
  export declare function rowRhythm(row: TimelineRow, previous: TimelineRow | null): string;
5
6
  export declare function replyHeader(row: TimelineRow, previous: TimelineRow | null): {
6
7
  at: number | null;
@@ -6,10 +6,14 @@ export const FOLLOW_THRESHOLD_PX = 40;
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
7
  * card, which have no margin of their own. A question and the answer after it never take a seam.
8
8
  */
9
+ /* A person's message, or one another node sent: both are said to the chat and drawn the same way. */
10
+ export function saidToChat(row) {
11
+ return row.kind === 'user' || row.kind === 'message';
12
+ }
9
13
  export function rowRhythm(row, previous) {
10
- const question = row.kind === 'user';
14
+ const question = saidToChat(row);
11
15
  const bare = previous?.kind === 'visual' || previous?.kind === 'app-card';
12
- const seam = !question && previous !== null && previous.kind !== 'user' && (isBlock(row) !== isBlock(previous) || bare);
16
+ const seam = !question && previous !== null && !saidToChat(previous) && (isBlock(row) !== isBlock(previous) || bare);
13
17
  return clsx(question && 'pb-(--chat-answer-gap)', seam && 'pt-(--chat-block-gap)');
14
18
  }
15
19
  /*
@@ -18,7 +22,7 @@ export function rowRhythm(row, previous) {
18
22
  * starts halfway through a reply has no time to show.
19
23
  */
20
24
  export function replyHeader(row, previous) {
21
- if (row.kind === 'user' || row.kind === 'turn-start') {
25
+ if (saidToChat(row) || row.kind === 'turn-start') {
22
26
  return null;
23
27
  }
24
28
  if (previous === null) {
@@ -31,6 +35,11 @@ export function replyHeader(row, previous) {
31
35
  at: previous.item.createdAt
32
36
  };
33
37
  }
38
+ if (previous.kind === 'message') {
39
+ return {
40
+ at: previous.createdAt
41
+ };
42
+ }
34
43
  if (previous.kind === 'turn-start') {
35
44
  return {
36
45
  at: previous.turn.createdAt
@@ -0,0 +1,12 @@
1
+ import { type ChatItem, type ChatToolItem, type ChatWorkflow } from '@adecore/agent-contracts';
2
+ export type WorkflowCall = ChatToolItem & {
3
+ workflow: ChatWorkflow;
4
+ };
5
+ export type WorkflowWord = 'running' | 'stalled' | 'done' | 'failed';
6
+ export interface WorkflowPill {
7
+ word: WorkflowWord;
8
+ label: string;
9
+ }
10
+ export declare function flyoutWorkflows(order: readonly string[], structure: Readonly<Record<string, ChatItem>>): WorkflowCall[];
11
+ export declare function workflowWordOf(tool: WorkflowCall): WorkflowWord;
12
+ export declare function workflowPillOf(calls: readonly WorkflowCall[]): WorkflowPill;
@@ -0,0 +1,54 @@
1
+ import i18next from 'i18next';
2
+ import { activeWorkflows } from '@adecore/agent-contracts';
3
+ import { workflowCounts, workflowPhases } from './logic/workflow.js';
4
+ /* What the workflow pill over the composer lists (`activeWorkflows`); `order` puts the calls from before the page first. */
5
+ export function flyoutWorkflows(order, structure) {
6
+ return activeWorkflows(order.flatMap(id => {
7
+ const item = structure[id];
8
+ return item === undefined ? [] : [item];
9
+ })).filter(tool => tool.workflow !== undefined);
10
+ }
11
+ export function workflowWordOf(tool) {
12
+ if (tool.state === 'running') {
13
+ return tool.workflow.stalledAt === undefined ? 'running' : 'stalled';
14
+ }
15
+ return tool.state === 'error' ? 'failed' : 'done';
16
+ }
17
+ /* What asks for a look first: one that stalled, then one at work, then one that failed. */
18
+ const PRESSING = ['stalled', 'running', 'failed', 'done'];
19
+ /*
20
+ * One workflow names itself with how many of its agents are done, or that it stalled. Several are
21
+ * counted like the sub-agents badge: the ones still at work, and all of them once none is.
22
+ */
23
+ export function workflowPillOf(calls) {
24
+ const words = calls.map(workflowWordOf);
25
+ const word = PRESSING.find(candidate => words.includes(candidate)) ?? 'done';
26
+ if (calls.length !== 1) {
27
+ const active = words.filter(candidate => candidate === 'running' || candidate === 'stalled').length;
28
+ return {
29
+ word,
30
+ label: i18next.t('agent-chat:activity.workflows', {
31
+ count: active > 0 ? active : calls.length
32
+ })
33
+ };
34
+ }
35
+ const call = calls[0];
36
+ const name = call.workflow.name ?? i18next.t('agent-chat:activity.workflow');
37
+ if (word === 'stalled') {
38
+ return {
39
+ word,
40
+ label: i18next.t('agent-chat:activity.workflowStalled', {
41
+ name
42
+ })
43
+ };
44
+ }
45
+ const counts = workflowCounts(workflowPhases(call.workflow, word === 'running'));
46
+ return {
47
+ word,
48
+ label: counts.total === 0 ? name : i18next.t('agent-chat:activity.workflowProgress', {
49
+ name,
50
+ done: counts.done,
51
+ total: counts.total
52
+ })
53
+ };
54
+ }