@adecore/agents-react 0.32.0 → 0.33.1

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,20 +1,62 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
+ import { useState } from 'react';
3
+ import clsx from 'clsx';
2
4
  import { useTranslation } from 'react-i18next';
3
- import { Bot, ListTree, TriangleAlert, Square } from 'lucide-react';
5
+ import { Bot, ChevronRight, Square, TriangleAlert, Workflow, X } from 'lucide-react';
4
6
  import { workflowAgentRef } from '@adecore/agent-contracts';
5
- import { workflowAgentTime, workflowPhases } from '../../logic/workflow.js';
7
+ import { formatElapsedShort } from '@adecore/ui/format';
8
+ import { Icon, IconButton, useTickingText } from '@adecore/ui';
9
+ import { AgentIcon } from '../../../agents/AgentIcon.js';
10
+ import { workflowAgentPreview, workflowAgentTime, workflowCounts, workflowDescription, workflowPhases } from '../../logic/workflow.js';
11
+ import { hasToolBody } from '../../logic/tools.js';
6
12
  import { useSubagentSupport } from '../../subagent-support.js';
7
13
  import { ROW_GUTTER } from '../icons.js';
8
- import { RunningFor, ToggleLine, WorkLiveRow, WorkRow } from './WorkRows.js';
14
+ import { ToolBody } from './WorkRows.js';
9
15
  import { useChatScope } from '../../../scope.js';
10
- import { Icon, IconButton } from '@adecore/ui';
16
+ import { useChats } from '../../../state/chats.js';
11
17
  import { useChatActions } from '../../actions.js';
12
18
  import { useChatHost } from '../../../host.js';
13
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
19
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
20
+ const DOT = {
21
+ running: 'bg-status-running',
22
+ waiting: 'bg-text-faint',
23
+ stopped: 'bg-text-faint',
24
+ done: 'bg-status-idle',
25
+ failed: 'bg-status-error'
26
+ };
27
+ const TIME = 'shrink-0 text-xs text-text-faint tabular-nums';
28
+ function Elapsed(t0) {
29
+ const $ = _c(4);
30
+ const {
31
+ startedAt
32
+ } = t0;
33
+ let t1;
34
+ if ($[0] !== startedAt) {
35
+ t1 = () => formatElapsedShort(Date.now() - startedAt);
36
+ $[0] = startedAt;
37
+ $[1] = t1;
38
+ } else {
39
+ t1 = $[1];
40
+ }
41
+ const ref = useTickingText(t1);
42
+ let t2;
43
+ if ($[2] !== ref) {
44
+ t2 = /*#__PURE__*/_jsx("span", {
45
+ ref: ref,
46
+ className: TIME
47
+ });
48
+ $[2] = ref;
49
+ $[3] = t2;
50
+ } else {
51
+ t2 = $[3];
52
+ }
53
+ return t2;
54
+ }
14
55
  function AgentLine(t0) {
15
- const $ = _c(18);
56
+ const $ = _c(49);
16
57
  const {
17
58
  view,
59
+ provider,
18
60
  onOpen
19
61
  } = t0;
20
62
  const {
@@ -30,142 +72,353 @@ function AgentLine(t0) {
30
72
  t1 = $[1];
31
73
  }
32
74
  const time = t1;
33
- const running = state === "running";
34
- const agentId = agent.agentId;
35
75
  let t2;
36
- if ($[2] !== agent.label || $[3] !== agentId || $[4] !== onOpen) {
37
- t2 = onOpen !== undefined && agentId !== null ? () => onOpen({
76
+ if ($[2] !== view) {
77
+ t2 = workflowAgentPreview(view);
78
+ $[2] = view;
79
+ $[3] = t2;
80
+ } else {
81
+ t2 = $[3];
82
+ }
83
+ const preview = t2;
84
+ const agentId = agent.agentId;
85
+ let t3;
86
+ if ($[4] !== agent.label || $[5] !== agentId || $[6] !== onOpen) {
87
+ t3 = onOpen !== undefined && agentId !== null ? () => onOpen({
38
88
  toolUseId: workflowAgentRef(agentId),
39
89
  description: agent.label
40
- }) : _temp;
41
- $[2] = agent.label;
42
- $[3] = agentId;
43
- $[4] = onOpen;
44
- $[5] = t2;
90
+ }) : undefined;
91
+ $[4] = agent.label;
92
+ $[5] = agentId;
93
+ $[6] = onOpen;
94
+ $[7] = t3;
45
95
  } else {
46
- t2 = $[5];
96
+ t3 = $[7];
47
97
  }
48
- const open = t2;
49
- let t3;
50
- if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
51
- t3 = /*#__PURE__*/_jsx(Icon, {
98
+ const open = t3;
99
+ const t4 = open === undefined;
100
+ let t5;
101
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
102
+ t5 = clsx(ROW_GUTTER, "relative text-text");
103
+ $[8] = t5;
104
+ } else {
105
+ t5 = $[8];
106
+ }
107
+ let t6;
108
+ if ($[9] !== provider) {
109
+ t6 = provider === undefined ? /*#__PURE__*/_jsx(Icon, {
52
110
  icon: Bot,
53
- size: 12
111
+ size: 14
112
+ }) : /*#__PURE__*/_jsx(AgentIcon, {
113
+ kind: provider,
114
+ size: 14
54
115
  });
55
- $[6] = t3;
116
+ $[9] = provider;
117
+ $[10] = t6;
56
118
  } else {
57
- t3 = $[6];
119
+ t6 = $[10];
58
120
  }
59
- const t4 = running ? agent.lastTool ?? undefined : undefined;
60
- const t5 = state === "failed";
61
- let t6;
62
- if ($[7] !== agent.startedAt || $[8] !== running || $[9] !== time) {
63
- t6 = running && agent.startedAt !== null ? /*#__PURE__*/_jsx(RunningFor, {
121
+ const t7 = DOT[state];
122
+ let t8;
123
+ if ($[11] !== t7) {
124
+ t8 = clsx("absolute -right-0.75 bottom-0 size-2 rounded-full ring-2 ring-surface", t7);
125
+ $[11] = t7;
126
+ $[12] = t8;
127
+ } else {
128
+ t8 = $[12];
129
+ }
130
+ let t9;
131
+ if ($[13] !== t8) {
132
+ t9 = /*#__PURE__*/_jsx("span", {
133
+ className: t8
134
+ });
135
+ $[13] = t8;
136
+ $[14] = t9;
137
+ } else {
138
+ t9 = $[14];
139
+ }
140
+ let t10;
141
+ if ($[15] !== t6 || $[16] !== t9) {
142
+ t10 = /*#__PURE__*/_jsxs("span", {
143
+ className: t5,
144
+ children: [t6, t9]
145
+ });
146
+ $[15] = t6;
147
+ $[16] = t9;
148
+ $[17] = t10;
149
+ } else {
150
+ t10 = $[17];
151
+ }
152
+ const t11 = state === "failed" ? "text-status-error" : "text-text";
153
+ let t12;
154
+ if ($[18] !== t11) {
155
+ t12 = clsx("truncate text-xs font-medium", t11);
156
+ $[18] = t11;
157
+ $[19] = t12;
158
+ } else {
159
+ t12 = $[19];
160
+ }
161
+ let t13;
162
+ if ($[20] !== agent.label || $[21] !== t12) {
163
+ t13 = /*#__PURE__*/_jsx("span", {
164
+ "data-find-field": "summary",
165
+ className: t12,
166
+ children: agent.label
167
+ });
168
+ $[20] = agent.label;
169
+ $[21] = t12;
170
+ $[22] = t13;
171
+ } else {
172
+ t13 = $[22];
173
+ }
174
+ let t14;
175
+ if ($[23] !== preview.text || $[24] !== preview.tool) {
176
+ t14 = (preview.tool !== null || preview.text !== null) && /*#__PURE__*/_jsxs("span", {
177
+ className: "truncate text-2xs text-text-muted",
178
+ children: [preview.tool !== null && /*#__PURE__*/_jsx("span", {
179
+ className: "font-mono text-code",
180
+ children: preview.tool
181
+ }), preview.tool !== null && preview.text !== null && " \xB7 ", preview.text]
182
+ });
183
+ $[23] = preview.text;
184
+ $[24] = preview.tool;
185
+ $[25] = t14;
186
+ } else {
187
+ t14 = $[25];
188
+ }
189
+ let t15;
190
+ if ($[26] !== t13 || $[27] !== t14) {
191
+ t15 = /*#__PURE__*/_jsxs("span", {
192
+ className: "flex min-w-0 grow flex-col",
193
+ children: [t13, t14]
194
+ });
195
+ $[26] = t13;
196
+ $[27] = t14;
197
+ $[28] = t15;
198
+ } else {
199
+ t15 = $[28];
200
+ }
201
+ let t16;
202
+ if ($[29] !== agent.startedAt || $[30] !== state || $[31] !== time) {
203
+ t16 = state === "running" && agent.startedAt !== null ? /*#__PURE__*/_jsx(Elapsed, {
64
204
  startedAt: agent.startedAt
65
- }) : /*#__PURE__*/_jsx("span", {
66
- className: "shrink-0 text-xs text-text-faint tabular-nums",
205
+ }) : time !== null && /*#__PURE__*/_jsx("span", {
206
+ className: TIME,
67
207
  children: time
68
208
  });
69
- $[7] = agent.startedAt;
70
- $[8] = running;
71
- $[9] = time;
72
- $[10] = t6;
209
+ $[29] = agent.startedAt;
210
+ $[30] = state;
211
+ $[31] = time;
212
+ $[32] = t16;
73
213
  } else {
74
- t6 = $[10];
214
+ t16 = $[32];
75
215
  }
76
- let t7;
77
- if ($[11] !== agent.label || $[12] !== open || $[13] !== running || $[14] !== t4 || $[15] !== t5 || $[16] !== t6) {
78
- t7 = /*#__PURE__*/_jsx(ToggleLine, {
79
- icon: t3,
80
- label: agent.label,
81
- detail: t4,
82
- open: false,
83
- onToggle: open,
84
- failed: t5,
85
- live: running,
86
- trailing: t6
216
+ let t17;
217
+ if ($[33] !== state) {
218
+ t17 = state === "failed" && /*#__PURE__*/_jsx(Icon, {
219
+ icon: X,
220
+ size: 12,
221
+ className: "shrink-0 text-status-error"
222
+ });
223
+ $[33] = state;
224
+ $[34] = t17;
225
+ } else {
226
+ t17 = $[34];
227
+ }
228
+ const t18 = open === undefined && "invisible";
229
+ let t19;
230
+ if ($[35] !== t18) {
231
+ t19 = clsx("shrink-0 text-text-faint", t18);
232
+ $[35] = t18;
233
+ $[36] = t19;
234
+ } else {
235
+ t19 = $[36];
236
+ }
237
+ let t20;
238
+ if ($[37] !== t19) {
239
+ t20 = /*#__PURE__*/_jsx(Icon, {
240
+ icon: ChevronRight,
241
+ size: 12,
242
+ className: t19
243
+ });
244
+ $[37] = t19;
245
+ $[38] = t20;
246
+ } else {
247
+ t20 = $[38];
248
+ }
249
+ let t21;
250
+ if ($[39] !== t16 || $[40] !== t17 || $[41] !== t20) {
251
+ t21 = /*#__PURE__*/_jsxs("span", {
252
+ className: "flex h-5 shrink-0 items-center gap-2",
253
+ children: [t16, t17, t20]
87
254
  });
88
- $[11] = agent.label;
89
- $[12] = open;
90
- $[13] = running;
91
- $[14] = t4;
92
- $[15] = t5;
93
- $[16] = t6;
94
- $[17] = t7;
255
+ $[39] = t16;
256
+ $[40] = t17;
257
+ $[41] = t20;
258
+ $[42] = t21;
95
259
  } else {
96
- t7 = $[17];
260
+ t21 = $[42];
97
261
  }
98
- return t7;
262
+ let t22;
263
+ if ($[43] !== open || $[44] !== t10 || $[45] !== t15 || $[46] !== t21 || $[47] !== t4) {
264
+ t22 = /*#__PURE__*/_jsxs("button", {
265
+ className: "-mx-1 mb-0.5 flex w-[calc(100%+8px)] items-start gap-2 rounded-md px-1 py-1 text-left enabled:hover:bg-surface-hover",
266
+ disabled: t4,
267
+ onClick: open,
268
+ children: [t10, t15, t21]
269
+ });
270
+ $[43] = open;
271
+ $[44] = t10;
272
+ $[45] = t15;
273
+ $[46] = t21;
274
+ $[47] = t4;
275
+ $[48] = t22;
276
+ } else {
277
+ t22 = $[48];
278
+ }
279
+ return t22;
99
280
  }
100
- function _temp() {}
101
281
  function PhaseBlock(t0) {
102
- const $ = _c(11);
282
+ const $ = _c(17);
103
283
  const {
104
284
  phase,
285
+ provider,
105
286
  onOpen
106
287
  } = t0;
107
288
  const {
108
289
  t
109
290
  } = useTranslation("agent-chat");
110
291
  let t1;
111
- if ($[0] !== phase.agents.length || $[1] !== phase.title || $[2] !== t) {
112
- t1 = phase.title !== null && /*#__PURE__*/_jsxs("div", {
113
- className: "mb-0.5 flex h-7 min-w-0 items-center gap-2 text-xs text-text-muted",
292
+ if ($[0] !== phase.agents) {
293
+ t1 = phase.agents.filter(_temp);
294
+ $[0] = phase.agents;
295
+ $[1] = t1;
296
+ } else {
297
+ t1 = $[1];
298
+ }
299
+ const settled = t1.length;
300
+ let t2;
301
+ if ($[2] !== phase.agents.length || $[3] !== phase.title || $[4] !== settled || $[5] !== t) {
302
+ t2 = phase.title !== null && /*#__PURE__*/_jsxs("div", {
303
+ className: "flex h-7 min-w-0 items-center gap-2 text-xs",
114
304
  children: [/*#__PURE__*/_jsx("span", {
115
- className: ROW_GUTTER,
116
- children: /*#__PURE__*/_jsx(Icon, {
117
- icon: ListTree,
118
- size: 12
119
- })
120
- }), /*#__PURE__*/_jsx("span", {
121
- className: "min-w-0 truncate",
305
+ className: "min-w-0 truncate font-medium text-text",
122
306
  children: phase.title
123
307
  }), /*#__PURE__*/_jsx("span", {
124
- className: "grow"
125
- }), phase.agents.length === 0 && /*#__PURE__*/_jsx("span", {
126
- className: "shrink-0 text-text-faint",
127
- children: t("rows.workflow.notStarted")
308
+ className: "shrink-0 text-text-faint tabular-nums",
309
+ children: phase.agents.length === 0 ? t("rows.workflow.notStarted") : `${settled}/${phase.agents.length}`
128
310
  })]
129
311
  });
130
- $[0] = phase.agents.length;
131
- $[1] = phase.title;
132
- $[2] = t;
133
- $[3] = t1;
312
+ $[2] = phase.agents.length;
313
+ $[3] = phase.title;
314
+ $[4] = settled;
315
+ $[5] = t;
316
+ $[6] = t2;
134
317
  } else {
135
- t1 = $[3];
318
+ t2 = $[6];
136
319
  }
137
- let t2;
138
- if ($[4] !== onOpen || $[5] !== phase.agents || $[6] !== phase.title) {
139
- t2 = phase.agents.length > 0 && /*#__PURE__*/_jsx("div", {
140
- className: phase.title === null ? undefined : "ml-6",
141
- children: phase.agents.map(view => /*#__PURE__*/_jsx(AgentLine, {
142
- view: view,
320
+ let t3;
321
+ if ($[7] !== onOpen || $[8] !== phase.agents || $[9] !== provider) {
322
+ let t4;
323
+ if ($[11] !== onOpen || $[12] !== provider) {
324
+ t4 = view_0 => /*#__PURE__*/_jsx(AgentLine, {
325
+ view: view_0,
326
+ provider: provider,
143
327
  onOpen: onOpen
144
- }, view.agent.index))
328
+ }, view_0.agent.index);
329
+ $[11] = onOpen;
330
+ $[12] = provider;
331
+ $[13] = t4;
332
+ } else {
333
+ t4 = $[13];
334
+ }
335
+ t3 = phase.agents.map(t4);
336
+ $[7] = onOpen;
337
+ $[8] = phase.agents;
338
+ $[9] = provider;
339
+ $[10] = t3;
340
+ } else {
341
+ t3 = $[10];
342
+ }
343
+ let t4;
344
+ if ($[14] !== t2 || $[15] !== t3) {
345
+ t4 = /*#__PURE__*/_jsxs("div", {
346
+ className: "mt-3",
347
+ children: [t2, t3]
145
348
  });
146
- $[4] = onOpen;
147
- $[5] = phase.agents;
148
- $[6] = phase.title;
149
- $[7] = t2;
349
+ $[14] = t2;
350
+ $[15] = t3;
351
+ $[16] = t4;
150
352
  } else {
151
- t2 = $[7];
353
+ t4 = $[16];
152
354
  }
153
- let t3;
154
- if ($[8] !== t1 || $[9] !== t2) {
155
- t3 = /*#__PURE__*/_jsxs("div", {
156
- children: [t1, t2]
355
+ return t4;
356
+ }
357
+ function _temp(view) {
358
+ return view.state === "done" || view.state === "failed";
359
+ }
360
+ function Counts(t0) {
361
+ const $ = _c(9);
362
+ const {
363
+ counts
364
+ } = t0;
365
+ const {
366
+ t
367
+ } = useTranslation("agent-chat");
368
+ let t1;
369
+ if ($[0] !== counts.done || $[1] !== counts.failed || $[2] !== counts.running || $[3] !== counts.total || $[4] !== t) {
370
+ const parts = [{
371
+ key: "working",
372
+ count: counts.running,
373
+ tone: "text-status-running"
374
+ }, {
375
+ key: "finished",
376
+ count: counts.done,
377
+ tone: "text-status-idle"
378
+ }, {
379
+ key: "failedCount",
380
+ count: counts.failed,
381
+ tone: "text-status-error"
382
+ }].filter(_temp2);
383
+ let t2;
384
+ if ($[6] !== counts.total || $[7] !== t) {
385
+ t2 = t("rows.workflow.agents", {
386
+ count: counts.total
387
+ });
388
+ $[6] = counts.total;
389
+ $[7] = t;
390
+ $[8] = t2;
391
+ } else {
392
+ t2 = $[8];
393
+ }
394
+ t1 = /*#__PURE__*/_jsxs("span", {
395
+ className: "shrink-0 truncate text-xs text-text-faint tabular-nums",
396
+ children: [t2, parts.map(part_0 => /*#__PURE__*/_jsxs("span", {
397
+ children: [" \xB7 ", /*#__PURE__*/_jsx("span", {
398
+ className: part_0.tone,
399
+ children: t(`rows.workflow.${part_0.key}`, {
400
+ count: part_0.count
401
+ })
402
+ })]
403
+ }, part_0.key))]
157
404
  });
158
- $[8] = t1;
159
- $[9] = t2;
160
- $[10] = t3;
405
+ $[0] = counts.done;
406
+ $[1] = counts.failed;
407
+ $[2] = counts.running;
408
+ $[3] = counts.total;
409
+ $[4] = t;
410
+ $[5] = t1;
161
411
  } else {
162
- t3 = $[10];
412
+ t1 = $[5];
163
413
  }
164
- return t3;
414
+ return t1;
165
415
  }
166
416
  // Keep background progress visible after the launcher turn ends.
417
+ function _temp2(part) {
418
+ return part.count > 0;
419
+ }
167
420
  export function WorkflowRow(t0) {
168
- const $ = _c(30);
421
+ const $ = _c(78);
169
422
  const {
170
423
  tool,
171
424
  workflow,
@@ -177,8 +430,10 @@ export function WorkflowRow(t0) {
177
430
  t
178
431
  } = useTranslation("agent-chat");
179
432
  const {
180
- id
433
+ id,
434
+ keyOf
181
435
  } = useChatScope();
436
+ const [open, setOpen] = useState(false);
182
437
  let t1;
183
438
  if ($[0] !== id) {
184
439
  t1 = s => s.unsupported[id] === true;
@@ -188,13 +443,42 @@ export function WorkflowRow(t0) {
188
443
  t1 = $[1];
189
444
  }
190
445
  const refused = useSubagentSupport(t1);
446
+ let t2;
447
+ if ($[2] !== chatId || $[3] !== keyOf) {
448
+ t2 = s_0 => chatId === undefined ? undefined : s_0.statusByKey[keyOf(chatId)]?.info?.provider;
449
+ $[2] = chatId;
450
+ $[3] = keyOf;
451
+ $[4] = t2;
452
+ } else {
453
+ t2 = $[4];
454
+ }
455
+ const provider = useChats(t2);
191
456
  const running = tool.state === "running";
192
457
  const phases = workflowPhases(workflow, running);
458
+ const counts = workflowCounts(phases);
459
+ let t3;
460
+ if ($[5] !== tool.input) {
461
+ t3 = workflowDescription(tool.input);
462
+ $[5] = tool.input;
463
+ $[6] = t3;
464
+ } else {
465
+ t3 = $[6];
466
+ }
467
+ const description = t3;
468
+ let t4;
469
+ if ($[7] !== tool) {
470
+ t4 = hasToolBody(tool);
471
+ $[7] = tool;
472
+ $[8] = t4;
473
+ } else {
474
+ t4 = $[8];
475
+ }
476
+ const opens = t4;
193
477
  const onOpen = refused ? undefined : onOpenAgent;
194
478
  const actions = useChatActions();
195
- let t2;
196
- if ($[2] !== actions || $[3] !== chatId || $[4] !== host || $[5] !== t || $[6] !== workflow) {
197
- t2 = () => {
479
+ let t5;
480
+ if ($[9] !== actions || $[10] !== chatId || $[11] !== host || $[12] !== t || $[13] !== workflow.taskId) {
481
+ t5 = () => {
198
482
  if (chatId && workflow.taskId) {
199
483
  actions.stopTask(chatId, workflow.taskId).catch(error => {
200
484
  host.notify({
@@ -205,71 +489,220 @@ export function WorkflowRow(t0) {
205
489
  });
206
490
  }
207
491
  };
208
- $[2] = actions;
209
- $[3] = chatId;
210
- $[4] = host;
211
- $[5] = t;
212
- $[6] = workflow;
213
- $[7] = t2;
492
+ $[9] = actions;
493
+ $[10] = chatId;
494
+ $[11] = host;
495
+ $[12] = t;
496
+ $[13] = workflow.taskId;
497
+ $[14] = t5;
214
498
  } else {
215
- t2 = $[7];
499
+ t5 = $[14];
216
500
  }
217
- const stop = t2;
218
- let t3;
219
- if ($[8] !== chatId || $[9] !== running || $[10] !== tool || $[11] !== workflow) {
220
- t3 = /*#__PURE__*/_jsx("div", {
501
+ const stop = t5;
502
+ const failed = tool.state === "error";
503
+ const t6 = running && "text-accent";
504
+ let t7;
505
+ if ($[15] !== t6) {
506
+ t7 = clsx(ROW_GUTTER, t6);
507
+ $[15] = t6;
508
+ $[16] = t7;
509
+ } else {
510
+ t7 = $[16];
511
+ }
512
+ let t8;
513
+ if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
514
+ t8 = /*#__PURE__*/_jsx(Icon, {
515
+ icon: Workflow,
516
+ size: 12
517
+ });
518
+ $[17] = t8;
519
+ } else {
520
+ t8 = $[17];
521
+ }
522
+ let t9;
523
+ if ($[18] !== t7) {
524
+ t9 = /*#__PURE__*/_jsx("span", {
525
+ className: t7,
526
+ children: t8
527
+ });
528
+ $[18] = t7;
529
+ $[19] = t9;
530
+ } else {
531
+ t9 = $[19];
532
+ }
533
+ const t10 = running && "chat-live-text";
534
+ let t11;
535
+ if ($[20] !== t10) {
536
+ t11 = clsx("shrink-0", t10);
537
+ $[20] = t10;
538
+ $[21] = t11;
539
+ } else {
540
+ t11 = $[21];
541
+ }
542
+ const t12 = `rows.workflow.${running ? "running" : failed ? "failed" : "done"}`;
543
+ let t13;
544
+ if ($[22] !== t || $[23] !== t12) {
545
+ t13 = t(t12);
546
+ $[22] = t;
547
+ $[23] = t12;
548
+ $[24] = t13;
549
+ } else {
550
+ t13 = $[24];
551
+ }
552
+ let t14;
553
+ if ($[25] !== t11 || $[26] !== t13) {
554
+ t14 = /*#__PURE__*/_jsx("span", {
555
+ className: t11,
556
+ children: t13
557
+ });
558
+ $[25] = t11;
559
+ $[26] = t13;
560
+ $[27] = t14;
561
+ } else {
562
+ t14 = $[27];
563
+ }
564
+ let t15;
565
+ if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
566
+ t15 = /*#__PURE__*/_jsx("span", {
567
+ className: "grow"
568
+ });
569
+ $[28] = t15;
570
+ } else {
571
+ t15 = $[28];
572
+ }
573
+ const t16 = counts.total > 0 && /*#__PURE__*/_jsx(Counts, {
574
+ counts: counts
575
+ });
576
+ let t17;
577
+ if ($[29] !== open || $[30] !== opens) {
578
+ t17 = opens && /*#__PURE__*/_jsx(Icon, {
579
+ icon: ChevronRight,
580
+ size: 12,
581
+ className: clsx("shrink-0 text-text-faint transition-transform", open && "rotate-90")
582
+ });
583
+ $[29] = open;
584
+ $[30] = opens;
585
+ $[31] = t17;
586
+ } else {
587
+ t17 = $[31];
588
+ }
589
+ let t18;
590
+ if ($[32] !== t14 || $[33] !== t16 || $[34] !== t17 || $[35] !== t9) {
591
+ t18 = /*#__PURE__*/_jsxs(_Fragment, {
592
+ children: [t9, t14, t15, t16, t17]
593
+ });
594
+ $[32] = t14;
595
+ $[33] = t16;
596
+ $[34] = t17;
597
+ $[35] = t9;
598
+ $[36] = t18;
599
+ } else {
600
+ t18 = $[36];
601
+ }
602
+ const header = t18;
603
+ const t19 = failed ? "text-status-error" : "text-text-muted";
604
+ const t20 = opens && "hover:bg-surface-hover";
605
+ let t21;
606
+ if ($[37] !== t19 || $[38] !== t20) {
607
+ 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);
608
+ $[37] = t19;
609
+ $[38] = t20;
610
+ $[39] = t21;
611
+ } else {
612
+ t21 = $[39];
613
+ }
614
+ const headerClasses = t21;
615
+ const t22 = tool.id;
616
+ const t23 = "mb-1";
617
+ let t24;
618
+ if ($[40] !== header || $[41] !== headerClasses || $[42] !== opens) {
619
+ t24 = /*#__PURE__*/_jsx("div", {
221
620
  className: "min-w-0 grow",
222
- children: running ? /*#__PURE__*/_jsx(WorkLiveRow, {
223
- chatId: chatId ?? "",
224
- tool: tool
225
- }) : /*#__PURE__*/_jsx(WorkRow, {
226
- chatId: chatId,
227
- tool: tool,
228
- detail: workflow.name ?? undefined
621
+ children: opens ? /*#__PURE__*/_jsx("button", {
622
+ className: headerClasses,
623
+ onClick: () => setOpen(_temp3),
624
+ children: header
625
+ }) : /*#__PURE__*/_jsx("div", {
626
+ className: headerClasses,
627
+ children: header
229
628
  })
230
629
  });
231
- $[8] = chatId;
232
- $[9] = running;
233
- $[10] = tool;
234
- $[11] = workflow;
235
- $[12] = t3;
630
+ $[40] = header;
631
+ $[41] = headerClasses;
632
+ $[42] = opens;
633
+ $[43] = t24;
236
634
  } else {
237
- t3 = $[12];
635
+ t24 = $[43];
238
636
  }
239
- let t4;
240
- if ($[13] !== chatId || $[14] !== running || $[15] !== stop || $[16] !== t || $[17] !== workflow) {
241
- t4 = running && chatId && workflow.taskId && /*#__PURE__*/_jsx(IconButton, {
637
+ let t25;
638
+ if ($[44] !== chatId || $[45] !== running || $[46] !== stop || $[47] !== t || $[48] !== workflow.taskId) {
639
+ t25 = running && chatId && workflow.taskId && /*#__PURE__*/_jsx(IconButton, {
242
640
  icon: Square,
243
641
  size: "xs",
244
642
  label: t("activity.stop"),
245
643
  onClick: stop
246
644
  });
247
- $[13] = chatId;
248
- $[14] = running;
249
- $[15] = stop;
250
- $[16] = t;
251
- $[17] = workflow;
252
- $[18] = t4;
645
+ $[44] = chatId;
646
+ $[45] = running;
647
+ $[46] = stop;
648
+ $[47] = t;
649
+ $[48] = workflow.taskId;
650
+ $[49] = t25;
253
651
  } else {
254
- t4 = $[18];
652
+ t25 = $[49];
255
653
  }
256
- let t5;
257
- if ($[19] !== t3 || $[20] !== t4) {
258
- t5 = /*#__PURE__*/_jsxs("div", {
654
+ let t26;
655
+ if ($[50] !== t24 || $[51] !== t25) {
656
+ t26 = /*#__PURE__*/_jsxs("div", {
259
657
  className: "flex items-center gap-1",
260
- children: [t3, t4]
658
+ children: [t24, t25]
261
659
  });
262
- $[19] = t3;
263
- $[20] = t4;
264
- $[21] = t5;
660
+ $[50] = t24;
661
+ $[51] = t25;
662
+ $[52] = t26;
265
663
  } else {
266
- t5 = $[21];
664
+ t26 = $[52];
267
665
  }
268
- let t6;
269
- if ($[22] !== running || $[23] !== t || $[24] !== workflow) {
270
- t6 = running && workflow.stalledAt !== undefined && /*#__PURE__*/_jsxs("p", {
666
+ let t27;
667
+ if ($[53] !== open || $[54] !== opens || $[55] !== tool) {
668
+ t27 = open && opens && /*#__PURE__*/_jsx(ToolBody, {
669
+ tool: tool
670
+ });
671
+ $[53] = open;
672
+ $[54] = opens;
673
+ $[55] = tool;
674
+ $[56] = t27;
675
+ } else {
676
+ t27 = $[56];
677
+ }
678
+ const t28 = "mt-1.5 ml-6";
679
+ let t29;
680
+ if ($[57] !== workflow.name) {
681
+ t29 = workflow.name !== null && /*#__PURE__*/_jsx("div", {
682
+ className: "truncate text-sm font-medium text-text",
683
+ children: workflow.name
684
+ });
685
+ $[57] = workflow.name;
686
+ $[58] = t29;
687
+ } else {
688
+ t29 = $[58];
689
+ }
690
+ let t30;
691
+ if ($[59] !== description) {
692
+ t30 = description !== null && /*#__PURE__*/_jsx("p", {
693
+ className: "mt-0.5 line-clamp-2 text-xs text-text-muted",
694
+ children: description
695
+ });
696
+ $[59] = description;
697
+ $[60] = t30;
698
+ } else {
699
+ t30 = $[60];
700
+ }
701
+ let t31;
702
+ if ($[61] !== running || $[62] !== t || $[63] !== workflow.stalledAt) {
703
+ t31 = running && workflow.stalledAt !== undefined && /*#__PURE__*/_jsxs("p", {
271
704
  role: "status",
272
- className: "ml-6 mb-1 flex items-start gap-1.5 text-xs text-text-muted",
705
+ className: "mt-1 flex items-start gap-1.5 text-xs text-text-muted",
273
706
  children: [/*#__PURE__*/_jsx(Icon, {
274
707
  icon: TriangleAlert,
275
708
  size: 12,
@@ -278,31 +711,58 @@ export function WorkflowRow(t0) {
278
711
  children: t("rows.workflow.stalled")
279
712
  })]
280
713
  });
281
- $[22] = running;
282
- $[23] = t;
283
- $[24] = workflow;
284
- $[25] = t6;
714
+ $[61] = running;
715
+ $[62] = t;
716
+ $[63] = workflow.stalledAt;
717
+ $[64] = t31;
285
718
  } else {
286
- t6 = $[25];
719
+ t31 = $[64];
287
720
  }
288
- const t7 = phases.length > 0 && /*#__PURE__*/_jsx("div", {
289
- className: "ml-6",
290
- children: phases.map(phase => /*#__PURE__*/_jsx(PhaseBlock, {
721
+ let t32;
722
+ if ($[65] !== onOpen || $[66] !== provider) {
723
+ t32 = phase => /*#__PURE__*/_jsx(PhaseBlock, {
291
724
  phase: phase,
725
+ provider: provider,
292
726
  onOpen: onOpen
293
- }, phase.key))
294
- });
295
- let t8;
296
- if ($[26] !== t5 || $[27] !== t6 || $[28] !== t7) {
297
- t8 = /*#__PURE__*/_jsxs("div", {
298
- children: [t5, t6, t7]
727
+ }, phase.key);
728
+ $[65] = onOpen;
729
+ $[66] = provider;
730
+ $[67] = t32;
731
+ } else {
732
+ t32 = $[67];
733
+ }
734
+ const t33 = phases.map(t32);
735
+ let t34;
736
+ if ($[68] !== t29 || $[69] !== t30 || $[70] !== t31 || $[71] !== t33) {
737
+ t34 = /*#__PURE__*/_jsxs("div", {
738
+ className: t28,
739
+ children: [t29, t30, t31, t33]
299
740
  });
300
- $[26] = t5;
301
- $[27] = t6;
302
- $[28] = t7;
303
- $[29] = t8;
741
+ $[68] = t29;
742
+ $[69] = t30;
743
+ $[70] = t31;
744
+ $[71] = t33;
745
+ $[72] = t34;
304
746
  } else {
305
- t8 = $[29];
747
+ t34 = $[72];
306
748
  }
307
- return t8;
749
+ let t35;
750
+ if ($[73] !== t26 || $[74] !== t27 || $[75] !== t34 || $[76] !== tool.id) {
751
+ t35 = /*#__PURE__*/_jsxs("div", {
752
+ "data-find-item": t22,
753
+ className: t23,
754
+ children: [t26, t27, t34]
755
+ });
756
+ $[73] = t26;
757
+ $[74] = t27;
758
+ $[75] = t34;
759
+ $[76] = tool.id;
760
+ $[77] = t35;
761
+ } else {
762
+ t35 = $[77];
763
+ }
764
+ return t35;
765
+ }
766
+ function _temp3(value) {
767
+ return !value;
308
768
  }