@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.
- package/dist/chat/index.d.ts +1 -0
- package/dist/chat/index.js +1 -0
- package/dist/chat/logic/scrubber.js +12 -0
- package/dist/chat/logic/timeline-copy.js +2 -0
- package/dist/chat/logic/timeline.d.ts +6 -1
- package/dist/chat/logic/timeline.js +36 -10
- package/dist/chat/ui/ChatActivity.d.ts +2 -1
- package/dist/chat/ui/ChatActivity.js +295 -61
- package/dist/chat/ui/Composer.d.ts +2 -1
- package/dist/chat/ui/Composer.js +492 -486
- package/dist/chat/ui/PromptEditor.js +4 -1
- package/dist/chat/ui/ReferenceChip.d.ts +2 -1
- package/dist/chat/ui/ReferenceChip.js +135 -100
- package/dist/chat/ui/composer/ComposerMenu.js +17 -11
- package/dist/chat/ui/composer/chips.d.ts +3 -0
- package/dist/chat/ui/composer/chips.js +14 -10
- package/dist/chat/ui/reference-icons.d.ts +3 -0
- package/dist/chat/ui/reference-icons.js +15 -2
- package/dist/chat/ui/rows/MessageRows.d.ts +6 -1
- package/dist/chat/ui/rows/MessageRows.js +166 -10
- package/dist/chat/ui/rows/RowContainer.js +21 -22
- package/dist/chat/ui/rows/Rows.js +37 -19
- package/dist/chat/ui/rows/WorkflowRow.d.ts +2 -1
- package/dist/chat/ui/rows/WorkflowRow.js +197 -191
- package/dist/chat/ui/rows/row-rhythm.d.ts +1 -0
- package/dist/chat/ui/rows/row-rhythm.js +12 -3
- package/dist/chat/workflow-list.d.ts +12 -0
- package/dist/chat/workflow-list.js +54 -0
- package/dist/host.d.ts +8 -1
- package/dist/index.d.ts +1 -1
- package/dist/locales/en/agent-chat.d.ts +9 -0
- package/dist/locales/en/agent-chat.js +9 -0
- package/dist/locales/nl/agent-chat.d.ts +9 -0
- package/dist/locales/nl/agent-chat.js +9 -0
- package/package.json +8 -8
- package/src/chat/index.ts +1 -0
- package/src/chat/logic/scrubber.ts +5 -0
- package/src/chat/logic/timeline-copy.ts +2 -0
- package/src/chat/logic/timeline.ts +33 -2
- package/src/chat/ui/ChatActivity.tsx +52 -6
- package/src/chat/ui/Composer.tsx +19 -3
- package/src/chat/ui/PromptEditor.tsx +3 -1
- package/src/chat/ui/ReferenceChip.tsx +15 -5
- package/src/chat/ui/composer/ComposerMenu.tsx +4 -2
- package/src/chat/ui/composer/chips.ts +15 -9
- package/src/chat/ui/reference-icons.ts +13 -1
- package/src/chat/ui/rows/MessageRows.tsx +35 -0
- package/src/chat/ui/rows/RowContainer.tsx +2 -2
- package/src/chat/ui/rows/Rows.tsx +3 -0
- package/src/chat/ui/rows/WorkflowRow.tsx +9 -4
- package/src/chat/ui/rows/row-rhythm.ts +12 -3
- package/src/chat/workflow-list.ts +65 -0
- package/src/host.ts +15 -1
- package/src/index.ts +1 -0
- package/src/locales/en/agent-chat.ts +9 -0
- 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
|
-
|
|
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(
|
|
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
|
|
179
|
+
let t2;
|
|
175
180
|
if ($[0] !== id) {
|
|
176
|
-
|
|
181
|
+
t2 = s => s.unsupported[id] === true;
|
|
177
182
|
$[0] = id;
|
|
178
|
-
$[1] =
|
|
183
|
+
$[1] = t2;
|
|
179
184
|
} else {
|
|
180
|
-
|
|
185
|
+
t2 = $[1];
|
|
181
186
|
}
|
|
182
|
-
const refused = useSubagentSupport(
|
|
183
|
-
let
|
|
187
|
+
const refused = useSubagentSupport(t2);
|
|
188
|
+
let t3;
|
|
184
189
|
if ($[2] !== chatId || $[3] !== keyOf) {
|
|
185
|
-
|
|
190
|
+
t3 = s_0 => chatId === undefined ? undefined : s_0.statusByKey[keyOf(chatId)]?.info?.provider;
|
|
186
191
|
$[2] = chatId;
|
|
187
192
|
$[3] = keyOf;
|
|
188
|
-
$[4] =
|
|
193
|
+
$[4] = t3;
|
|
189
194
|
} else {
|
|
190
|
-
|
|
195
|
+
t3 = $[4];
|
|
191
196
|
}
|
|
192
|
-
const provider = useChats(
|
|
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
|
|
201
|
+
let t4;
|
|
197
202
|
if ($[5] !== tool.input) {
|
|
198
|
-
|
|
203
|
+
t4 = workflowDescription(tool.input);
|
|
199
204
|
$[5] = tool.input;
|
|
200
|
-
$[6] =
|
|
205
|
+
$[6] = t4;
|
|
201
206
|
} else {
|
|
202
|
-
|
|
207
|
+
t4 = $[6];
|
|
203
208
|
}
|
|
204
|
-
const description =
|
|
205
|
-
let
|
|
206
|
-
if ($[7] !== tool) {
|
|
207
|
-
|
|
208
|
-
$[7] =
|
|
209
|
-
$[8] =
|
|
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
|
-
|
|
217
|
+
t5 = $[9];
|
|
212
218
|
}
|
|
213
|
-
const opens =
|
|
219
|
+
const opens = t5;
|
|
214
220
|
const onOpen = refused ? undefined : onOpenAgent;
|
|
215
221
|
const actions = useChatActions();
|
|
216
|
-
let
|
|
217
|
-
if ($[
|
|
218
|
-
|
|
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
|
-
$[
|
|
230
|
-
$[
|
|
231
|
-
$[
|
|
232
|
-
$[
|
|
233
|
-
$[
|
|
234
|
-
$[
|
|
235
|
+
$[10] = actions;
|
|
236
|
+
$[11] = chatId;
|
|
237
|
+
$[12] = host;
|
|
238
|
+
$[13] = t;
|
|
239
|
+
$[14] = workflow.taskId;
|
|
240
|
+
$[15] = t6;
|
|
235
241
|
} else {
|
|
236
|
-
|
|
242
|
+
t6 = $[15];
|
|
237
243
|
}
|
|
238
|
-
const stop =
|
|
244
|
+
const stop = t6;
|
|
239
245
|
const failed = tool.state === "error";
|
|
240
|
-
const
|
|
241
|
-
let
|
|
242
|
-
if ($[
|
|
243
|
-
|
|
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
|
-
|
|
253
|
+
t8 = $[17];
|
|
248
254
|
}
|
|
249
|
-
let
|
|
250
|
-
if ($[
|
|
251
|
-
|
|
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
|
-
$[
|
|
261
|
+
$[18] = t9;
|
|
256
262
|
} else {
|
|
257
|
-
|
|
263
|
+
t9 = $[18];
|
|
258
264
|
}
|
|
259
|
-
let
|
|
260
|
-
if ($[
|
|
261
|
-
|
|
262
|
-
className:
|
|
263
|
-
children:
|
|
265
|
+
let t10;
|
|
266
|
+
if ($[19] !== t8) {
|
|
267
|
+
t10 = /*#__PURE__*/_jsx("span", {
|
|
268
|
+
className: t8,
|
|
269
|
+
children: t9
|
|
264
270
|
});
|
|
265
|
-
$[
|
|
266
|
-
$[
|
|
271
|
+
$[19] = t8;
|
|
272
|
+
$[20] = t10;
|
|
267
273
|
} else {
|
|
268
|
-
|
|
274
|
+
t10 = $[20];
|
|
269
275
|
}
|
|
270
|
-
const
|
|
271
|
-
let
|
|
272
|
-
if ($[
|
|
273
|
-
|
|
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
|
-
|
|
283
|
+
t12 = $[22];
|
|
278
284
|
}
|
|
279
|
-
const
|
|
280
|
-
let
|
|
281
|
-
if ($[
|
|
282
|
-
|
|
283
|
-
$[
|
|
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
|
-
|
|
293
|
+
t14 = $[25];
|
|
288
294
|
}
|
|
289
|
-
let
|
|
290
|
-
if ($[
|
|
291
|
-
|
|
292
|
-
className:
|
|
293
|
-
children:
|
|
295
|
+
let t15;
|
|
296
|
+
if ($[26] !== t12 || $[27] !== t14) {
|
|
297
|
+
t15 = /*#__PURE__*/_jsx("span", {
|
|
298
|
+
className: t12,
|
|
299
|
+
children: t14
|
|
294
300
|
});
|
|
295
|
-
$[
|
|
296
|
-
$[26] = t13;
|
|
301
|
+
$[26] = t12;
|
|
297
302
|
$[27] = t14;
|
|
303
|
+
$[28] = t15;
|
|
298
304
|
} else {
|
|
299
|
-
|
|
305
|
+
t15 = $[28];
|
|
300
306
|
}
|
|
301
|
-
let
|
|
302
|
-
if ($[
|
|
303
|
-
|
|
307
|
+
let t16;
|
|
308
|
+
if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
|
|
309
|
+
t16 = /*#__PURE__*/_jsx("span", {
|
|
304
310
|
className: "grow"
|
|
305
311
|
});
|
|
306
|
-
$[
|
|
312
|
+
$[29] = t16;
|
|
307
313
|
} else {
|
|
308
|
-
|
|
314
|
+
t16 = $[29];
|
|
309
315
|
}
|
|
310
|
-
const
|
|
316
|
+
const t17 = counts.total > 0 && /*#__PURE__*/_jsx(Counts, {
|
|
311
317
|
counts: counts
|
|
312
318
|
});
|
|
313
|
-
let
|
|
314
|
-
if ($[
|
|
315
|
-
|
|
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
|
-
$[
|
|
321
|
-
$[
|
|
322
|
-
$[
|
|
326
|
+
$[30] = open;
|
|
327
|
+
$[31] = opens;
|
|
328
|
+
$[32] = t18;
|
|
323
329
|
} else {
|
|
324
|
-
|
|
330
|
+
t18 = $[32];
|
|
325
331
|
}
|
|
326
|
-
let
|
|
327
|
-
if ($[
|
|
328
|
-
|
|
329
|
-
children: [
|
|
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
|
-
$[
|
|
332
|
-
$[
|
|
333
|
-
$[
|
|
334
|
-
$[35] = t9;
|
|
337
|
+
$[33] = t10;
|
|
338
|
+
$[34] = t15;
|
|
339
|
+
$[35] = t17;
|
|
335
340
|
$[36] = t18;
|
|
341
|
+
$[37] = t19;
|
|
336
342
|
} else {
|
|
337
|
-
|
|
343
|
+
t19 = $[37];
|
|
338
344
|
}
|
|
339
|
-
const header =
|
|
340
|
-
const
|
|
341
|
-
const
|
|
342
|
-
let
|
|
343
|
-
if ($[
|
|
344
|
-
|
|
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
|
-
|
|
355
|
+
t22 = $[40];
|
|
350
356
|
}
|
|
351
|
-
const headerClasses =
|
|
352
|
-
const
|
|
353
|
-
const
|
|
354
|
-
let
|
|
355
|
-
if ($[
|
|
356
|
-
|
|
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
|
-
$[
|
|
368
|
-
$[
|
|
369
|
-
$[
|
|
370
|
-
$[
|
|
373
|
+
$[41] = header;
|
|
374
|
+
$[42] = headerClasses;
|
|
375
|
+
$[43] = opens;
|
|
376
|
+
$[44] = t25;
|
|
371
377
|
} else {
|
|
372
|
-
|
|
378
|
+
t25 = $[44];
|
|
373
379
|
}
|
|
374
|
-
let
|
|
375
|
-
if ($[
|
|
376
|
-
|
|
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
|
-
$[
|
|
383
|
-
$[
|
|
384
|
-
$[
|
|
385
|
-
$[
|
|
386
|
-
$[
|
|
387
|
-
$[
|
|
388
|
+
$[45] = chatId;
|
|
389
|
+
$[46] = running;
|
|
390
|
+
$[47] = stop;
|
|
391
|
+
$[48] = t;
|
|
392
|
+
$[49] = workflow.taskId;
|
|
393
|
+
$[50] = t26;
|
|
388
394
|
} else {
|
|
389
|
-
|
|
395
|
+
t26 = $[50];
|
|
390
396
|
}
|
|
391
|
-
let
|
|
392
|
-
if ($[
|
|
393
|
-
|
|
397
|
+
let t27;
|
|
398
|
+
if ($[51] !== t25 || $[52] !== t26) {
|
|
399
|
+
t27 = /*#__PURE__*/_jsxs("div", {
|
|
394
400
|
className: "flex items-center gap-1",
|
|
395
|
-
children: [
|
|
401
|
+
children: [t25, t26]
|
|
396
402
|
});
|
|
397
|
-
$[50] = t24;
|
|
398
403
|
$[51] = t25;
|
|
399
404
|
$[52] = t26;
|
|
405
|
+
$[53] = t27;
|
|
400
406
|
} else {
|
|
401
|
-
|
|
407
|
+
t27 = $[53];
|
|
402
408
|
}
|
|
403
|
-
let
|
|
404
|
-
if ($[
|
|
405
|
-
|
|
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
|
-
$[
|
|
410
|
-
$[
|
|
411
|
-
$[
|
|
412
|
-
$[
|
|
413
|
-
$[
|
|
415
|
+
$[54] = chatId;
|
|
416
|
+
$[55] = open;
|
|
417
|
+
$[56] = opens;
|
|
418
|
+
$[57] = tool;
|
|
419
|
+
$[58] = t28;
|
|
414
420
|
} else {
|
|
415
|
-
|
|
421
|
+
t28 = $[58];
|
|
416
422
|
}
|
|
417
|
-
const
|
|
418
|
-
let
|
|
419
|
-
if ($[
|
|
420
|
-
|
|
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
|
-
$[
|
|
425
|
-
$[
|
|
430
|
+
$[59] = workflow.name;
|
|
431
|
+
$[60] = t30;
|
|
426
432
|
} else {
|
|
427
|
-
|
|
433
|
+
t30 = $[60];
|
|
428
434
|
}
|
|
429
|
-
let
|
|
430
|
-
if ($[
|
|
431
|
-
|
|
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
|
-
$[
|
|
436
|
-
$[
|
|
441
|
+
$[61] = description;
|
|
442
|
+
$[62] = t31;
|
|
437
443
|
} else {
|
|
438
|
-
|
|
444
|
+
t31 = $[62];
|
|
439
445
|
}
|
|
440
|
-
let
|
|
441
|
-
if ($[
|
|
442
|
-
|
|
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
|
-
$[
|
|
454
|
-
$[
|
|
455
|
-
$[
|
|
456
|
-
$[
|
|
459
|
+
$[63] = running;
|
|
460
|
+
$[64] = t;
|
|
461
|
+
$[65] = workflow.stalledAt;
|
|
462
|
+
$[66] = t32;
|
|
457
463
|
} else {
|
|
458
|
-
|
|
464
|
+
t32 = $[66];
|
|
459
465
|
}
|
|
460
|
-
let
|
|
461
|
-
if ($[
|
|
462
|
-
|
|
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
|
-
$[
|
|
468
|
-
$[
|
|
469
|
-
$[
|
|
473
|
+
$[67] = onOpen;
|
|
474
|
+
$[68] = provider;
|
|
475
|
+
$[69] = t33;
|
|
470
476
|
} else {
|
|
471
|
-
|
|
477
|
+
t33 = $[69];
|
|
472
478
|
}
|
|
473
|
-
const
|
|
474
|
-
let
|
|
475
|
-
if ($[
|
|
476
|
-
|
|
477
|
-
className:
|
|
478
|
-
children: [
|
|
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] =
|
|
488
|
+
$[72] = t32;
|
|
484
489
|
$[73] = t34;
|
|
490
|
+
$[74] = t35;
|
|
485
491
|
} else {
|
|
486
|
-
|
|
492
|
+
t35 = $[74];
|
|
487
493
|
}
|
|
488
|
-
let
|
|
489
|
-
if ($[
|
|
490
|
-
|
|
491
|
-
"data-find-item":
|
|
492
|
-
className:
|
|
493
|
-
children: [
|
|
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
|
-
$[
|
|
496
|
-
$[
|
|
497
|
-
$[
|
|
498
|
-
$[77] = tool.id;
|
|
501
|
+
$[75] = t23;
|
|
502
|
+
$[76] = t27;
|
|
503
|
+
$[77] = t28;
|
|
499
504
|
$[78] = t35;
|
|
505
|
+
$[79] = t36;
|
|
500
506
|
} else {
|
|
501
|
-
|
|
507
|
+
t36 = $[79];
|
|
502
508
|
}
|
|
503
|
-
return
|
|
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
|
|
14
|
+
const question = saidToChat(row);
|
|
11
15
|
const bare = previous?.kind === 'visual' || previous?.kind === 'app-card';
|
|
12
|
-
const seam = !question && previous !== null && previous
|
|
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
|
|
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
|
+
}
|