@adecore/agents-react 0.45.0 → 0.46.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/chat-client.js +1 -0
- package/dist/chat/index.d.ts +1 -0
- package/dist/chat/index.js +1 -0
- package/dist/chat/logic/workflow.d.ts +13 -0
- package/dist/chat/logic/workflow.js +72 -0
- package/dist/chat/ui/SubagentTimeline.d.ts +4 -1
- package/dist/chat/ui/SubagentTimeline.js +106 -94
- package/dist/chat/ui/WorkflowAgentLine.d.ts +12 -0
- package/dist/chat/ui/WorkflowAgentLine.js +297 -0
- package/dist/chat/ui/index.d.ts +1 -0
- package/dist/chat/ui/index.js +1 -0
- package/dist/chat/ui/rows/WorkflowRow.d.ts +1 -1
- package/dist/chat/ui/rows/WorkflowRow.js +5 -268
- package/dist/state/chats.d.ts +3 -1
- package/dist/state/chats.js +14 -2
- package/package.json +8 -8
- package/src/chat/chat-client.ts +7 -1
- package/src/chat/index.ts +20 -0
- package/src/chat/logic/workflow.ts +79 -0
- package/src/chat/ui/SubagentTimeline.tsx +20 -3
- package/src/chat/ui/WorkflowAgentLine.tsx +94 -0
- package/src/chat/ui/index.ts +1 -0
- package/src/chat/ui/rows/WorkflowRow.tsx +6 -76
- package/src/state/chats.ts +28 -4
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { Bot, ChevronRight, X } from 'lucide-react';
|
|
4
|
+
import { workflowAgentRef } from '@adecore/agent-contracts';
|
|
5
|
+
import { formatElapsedShort } from '@adecore/ui/format';
|
|
6
|
+
import { Icon, useTickingText } from '@adecore/ui';
|
|
7
|
+
import { AgentIcon } from '../../agents/AgentIcon.js';
|
|
8
|
+
import { workflowAgentPreview, workflowAgentTime } from '../logic/workflow.js';
|
|
9
|
+
import { ROW_GUTTER } from './icons.js';
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
const DOT = {
|
|
12
|
+
running: 'bg-status-running',
|
|
13
|
+
waiting: 'bg-text-faint',
|
|
14
|
+
stopped: 'bg-text-faint',
|
|
15
|
+
done: 'bg-status-idle',
|
|
16
|
+
failed: 'bg-status-error'
|
|
17
|
+
};
|
|
18
|
+
const TIME = 'shrink-0 text-xs text-text-faint tabular-nums';
|
|
19
|
+
function Elapsed(t0) {
|
|
20
|
+
const $ = _c(4);
|
|
21
|
+
const {
|
|
22
|
+
startedAt
|
|
23
|
+
} = t0;
|
|
24
|
+
let t1;
|
|
25
|
+
if ($[0] !== startedAt) {
|
|
26
|
+
t1 = () => formatElapsedShort(Date.now() - startedAt);
|
|
27
|
+
$[0] = startedAt;
|
|
28
|
+
$[1] = t1;
|
|
29
|
+
} else {
|
|
30
|
+
t1 = $[1];
|
|
31
|
+
}
|
|
32
|
+
const ref = useTickingText(t1);
|
|
33
|
+
let t2;
|
|
34
|
+
if ($[2] !== ref) {
|
|
35
|
+
t2 = /*#__PURE__*/_jsx("span", {
|
|
36
|
+
ref: ref,
|
|
37
|
+
className: TIME
|
|
38
|
+
});
|
|
39
|
+
$[2] = ref;
|
|
40
|
+
$[3] = t2;
|
|
41
|
+
} else {
|
|
42
|
+
t2 = $[3];
|
|
43
|
+
}
|
|
44
|
+
return t2;
|
|
45
|
+
}
|
|
46
|
+
/*
|
|
47
|
+
* One agent of a workflow: its label, what it does or did, and its time. It opens the agent's
|
|
48
|
+
* conversation when `onOpen` is given and the agent started; one still waiting has no transcript yet.
|
|
49
|
+
* `selected` marks the agent whose conversation is open beside it.
|
|
50
|
+
*/
|
|
51
|
+
export function WorkflowAgentLine(t0) {
|
|
52
|
+
const $ = _c(56);
|
|
53
|
+
const {
|
|
54
|
+
view,
|
|
55
|
+
provider,
|
|
56
|
+
onOpen,
|
|
57
|
+
selected,
|
|
58
|
+
className,
|
|
59
|
+
ref
|
|
60
|
+
} = t0;
|
|
61
|
+
const {
|
|
62
|
+
agent,
|
|
63
|
+
state
|
|
64
|
+
} = view;
|
|
65
|
+
let t1;
|
|
66
|
+
if ($[0] !== view) {
|
|
67
|
+
t1 = workflowAgentTime(view);
|
|
68
|
+
$[0] = view;
|
|
69
|
+
$[1] = t1;
|
|
70
|
+
} else {
|
|
71
|
+
t1 = $[1];
|
|
72
|
+
}
|
|
73
|
+
const time = t1;
|
|
74
|
+
let t2;
|
|
75
|
+
if ($[2] !== view) {
|
|
76
|
+
t2 = workflowAgentPreview(view);
|
|
77
|
+
$[2] = view;
|
|
78
|
+
$[3] = t2;
|
|
79
|
+
} else {
|
|
80
|
+
t2 = $[3];
|
|
81
|
+
}
|
|
82
|
+
const preview = t2;
|
|
83
|
+
const agentId = agent.agentId;
|
|
84
|
+
let t3;
|
|
85
|
+
if ($[4] !== agent.label || $[5] !== agentId || $[6] !== onOpen) {
|
|
86
|
+
t3 = onOpen !== undefined && agentId !== null ? () => onOpen({
|
|
87
|
+
toolUseId: workflowAgentRef(agentId),
|
|
88
|
+
description: agent.label
|
|
89
|
+
}) : undefined;
|
|
90
|
+
$[4] = agent.label;
|
|
91
|
+
$[5] = agentId;
|
|
92
|
+
$[6] = onOpen;
|
|
93
|
+
$[7] = t3;
|
|
94
|
+
} else {
|
|
95
|
+
t3 = $[7];
|
|
96
|
+
}
|
|
97
|
+
const open = t3;
|
|
98
|
+
const t4 = agent.index;
|
|
99
|
+
const t5 = selected === true && "bg-surface-active";
|
|
100
|
+
let t6;
|
|
101
|
+
if ($[8] !== className || $[9] !== t5) {
|
|
102
|
+
t6 = clsx("-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", t5, className);
|
|
103
|
+
$[8] = className;
|
|
104
|
+
$[9] = t5;
|
|
105
|
+
$[10] = t6;
|
|
106
|
+
} else {
|
|
107
|
+
t6 = $[10];
|
|
108
|
+
}
|
|
109
|
+
const t7 = open === undefined;
|
|
110
|
+
let t8;
|
|
111
|
+
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
112
|
+
t8 = clsx(ROW_GUTTER, "relative text-text");
|
|
113
|
+
$[11] = t8;
|
|
114
|
+
} else {
|
|
115
|
+
t8 = $[11];
|
|
116
|
+
}
|
|
117
|
+
let t9;
|
|
118
|
+
if ($[12] !== provider) {
|
|
119
|
+
t9 = provider === undefined ? /*#__PURE__*/_jsx(Icon, {
|
|
120
|
+
icon: Bot,
|
|
121
|
+
size: 14
|
|
122
|
+
}) : /*#__PURE__*/_jsx(AgentIcon, {
|
|
123
|
+
kind: provider,
|
|
124
|
+
size: 14
|
|
125
|
+
});
|
|
126
|
+
$[12] = provider;
|
|
127
|
+
$[13] = t9;
|
|
128
|
+
} else {
|
|
129
|
+
t9 = $[13];
|
|
130
|
+
}
|
|
131
|
+
const t10 = DOT[state];
|
|
132
|
+
let t11;
|
|
133
|
+
if ($[14] !== t10) {
|
|
134
|
+
t11 = clsx("absolute -right-0.75 bottom-0 size-2 rounded-full ring-2 ring-surface", t10);
|
|
135
|
+
$[14] = t10;
|
|
136
|
+
$[15] = t11;
|
|
137
|
+
} else {
|
|
138
|
+
t11 = $[15];
|
|
139
|
+
}
|
|
140
|
+
let t12;
|
|
141
|
+
if ($[16] !== t11) {
|
|
142
|
+
t12 = /*#__PURE__*/_jsx("span", {
|
|
143
|
+
className: t11
|
|
144
|
+
});
|
|
145
|
+
$[16] = t11;
|
|
146
|
+
$[17] = t12;
|
|
147
|
+
} else {
|
|
148
|
+
t12 = $[17];
|
|
149
|
+
}
|
|
150
|
+
let t13;
|
|
151
|
+
if ($[18] !== t12 || $[19] !== t9) {
|
|
152
|
+
t13 = /*#__PURE__*/_jsxs("span", {
|
|
153
|
+
className: t8,
|
|
154
|
+
children: [t9, t12]
|
|
155
|
+
});
|
|
156
|
+
$[18] = t12;
|
|
157
|
+
$[19] = t9;
|
|
158
|
+
$[20] = t13;
|
|
159
|
+
} else {
|
|
160
|
+
t13 = $[20];
|
|
161
|
+
}
|
|
162
|
+
const t14 = state === "failed" ? "text-status-error" : "text-text";
|
|
163
|
+
let t15;
|
|
164
|
+
if ($[21] !== t14) {
|
|
165
|
+
t15 = clsx("truncate text-xs font-medium", t14);
|
|
166
|
+
$[21] = t14;
|
|
167
|
+
$[22] = t15;
|
|
168
|
+
} else {
|
|
169
|
+
t15 = $[22];
|
|
170
|
+
}
|
|
171
|
+
let t16;
|
|
172
|
+
if ($[23] !== agent.label || $[24] !== t15) {
|
|
173
|
+
t16 = /*#__PURE__*/_jsx("span", {
|
|
174
|
+
"data-find-field": "summary",
|
|
175
|
+
className: t15,
|
|
176
|
+
children: agent.label
|
|
177
|
+
});
|
|
178
|
+
$[23] = agent.label;
|
|
179
|
+
$[24] = t15;
|
|
180
|
+
$[25] = t16;
|
|
181
|
+
} else {
|
|
182
|
+
t16 = $[25];
|
|
183
|
+
}
|
|
184
|
+
let t17;
|
|
185
|
+
if ($[26] !== preview.text || $[27] !== preview.tool) {
|
|
186
|
+
t17 = (preview.tool !== null || preview.text !== null) && /*#__PURE__*/_jsxs("span", {
|
|
187
|
+
className: "truncate text-2xs text-text-muted",
|
|
188
|
+
children: [preview.tool !== null && /*#__PURE__*/_jsx("span", {
|
|
189
|
+
className: "font-mono text-code",
|
|
190
|
+
children: preview.tool
|
|
191
|
+
}), preview.tool !== null && preview.text !== null && " \xB7 ", preview.text]
|
|
192
|
+
});
|
|
193
|
+
$[26] = preview.text;
|
|
194
|
+
$[27] = preview.tool;
|
|
195
|
+
$[28] = t17;
|
|
196
|
+
} else {
|
|
197
|
+
t17 = $[28];
|
|
198
|
+
}
|
|
199
|
+
let t18;
|
|
200
|
+
if ($[29] !== t16 || $[30] !== t17) {
|
|
201
|
+
t18 = /*#__PURE__*/_jsxs("span", {
|
|
202
|
+
className: "flex min-w-0 grow flex-col",
|
|
203
|
+
children: [t16, t17]
|
|
204
|
+
});
|
|
205
|
+
$[29] = t16;
|
|
206
|
+
$[30] = t17;
|
|
207
|
+
$[31] = t18;
|
|
208
|
+
} else {
|
|
209
|
+
t18 = $[31];
|
|
210
|
+
}
|
|
211
|
+
let t19;
|
|
212
|
+
if ($[32] !== agent.startedAt || $[33] !== state || $[34] !== time) {
|
|
213
|
+
t19 = state === "running" && agent.startedAt !== null ? /*#__PURE__*/_jsx(Elapsed, {
|
|
214
|
+
startedAt: agent.startedAt
|
|
215
|
+
}) : time !== null && /*#__PURE__*/_jsx("span", {
|
|
216
|
+
className: TIME,
|
|
217
|
+
children: time
|
|
218
|
+
});
|
|
219
|
+
$[32] = agent.startedAt;
|
|
220
|
+
$[33] = state;
|
|
221
|
+
$[34] = time;
|
|
222
|
+
$[35] = t19;
|
|
223
|
+
} else {
|
|
224
|
+
t19 = $[35];
|
|
225
|
+
}
|
|
226
|
+
let t20;
|
|
227
|
+
if ($[36] !== state) {
|
|
228
|
+
t20 = state === "failed" && /*#__PURE__*/_jsx(Icon, {
|
|
229
|
+
icon: X,
|
|
230
|
+
size: 12,
|
|
231
|
+
className: "shrink-0 text-status-error"
|
|
232
|
+
});
|
|
233
|
+
$[36] = state;
|
|
234
|
+
$[37] = t20;
|
|
235
|
+
} else {
|
|
236
|
+
t20 = $[37];
|
|
237
|
+
}
|
|
238
|
+
const t21 = open === undefined && "invisible";
|
|
239
|
+
let t22;
|
|
240
|
+
if ($[38] !== t21) {
|
|
241
|
+
t22 = clsx("shrink-0 text-text-faint", t21);
|
|
242
|
+
$[38] = t21;
|
|
243
|
+
$[39] = t22;
|
|
244
|
+
} else {
|
|
245
|
+
t22 = $[39];
|
|
246
|
+
}
|
|
247
|
+
let t23;
|
|
248
|
+
if ($[40] !== t22) {
|
|
249
|
+
t23 = /*#__PURE__*/_jsx(Icon, {
|
|
250
|
+
icon: ChevronRight,
|
|
251
|
+
size: 12,
|
|
252
|
+
className: t22
|
|
253
|
+
});
|
|
254
|
+
$[40] = t22;
|
|
255
|
+
$[41] = t23;
|
|
256
|
+
} else {
|
|
257
|
+
t23 = $[41];
|
|
258
|
+
}
|
|
259
|
+
let t24;
|
|
260
|
+
if ($[42] !== t19 || $[43] !== t20 || $[44] !== t23) {
|
|
261
|
+
t24 = /*#__PURE__*/_jsxs("span", {
|
|
262
|
+
className: "flex h-5 shrink-0 items-center gap-2",
|
|
263
|
+
children: [t19, t20, t23]
|
|
264
|
+
});
|
|
265
|
+
$[42] = t19;
|
|
266
|
+
$[43] = t20;
|
|
267
|
+
$[44] = t23;
|
|
268
|
+
$[45] = t24;
|
|
269
|
+
} else {
|
|
270
|
+
t24 = $[45];
|
|
271
|
+
}
|
|
272
|
+
let t25;
|
|
273
|
+
if ($[46] !== agent.index || $[47] !== open || $[48] !== ref || $[49] !== selected || $[50] !== t13 || $[51] !== t18 || $[52] !== t24 || $[53] !== t6 || $[54] !== t7) {
|
|
274
|
+
t25 = /*#__PURE__*/_jsxs("button", {
|
|
275
|
+
ref: ref,
|
|
276
|
+
"data-workflow-agent": t4,
|
|
277
|
+
"aria-pressed": selected,
|
|
278
|
+
className: t6,
|
|
279
|
+
disabled: t7,
|
|
280
|
+
onClick: open,
|
|
281
|
+
children: [t13, t18, t24]
|
|
282
|
+
});
|
|
283
|
+
$[46] = agent.index;
|
|
284
|
+
$[47] = open;
|
|
285
|
+
$[48] = ref;
|
|
286
|
+
$[49] = selected;
|
|
287
|
+
$[50] = t13;
|
|
288
|
+
$[51] = t18;
|
|
289
|
+
$[52] = t24;
|
|
290
|
+
$[53] = t6;
|
|
291
|
+
$[54] = t7;
|
|
292
|
+
$[55] = t25;
|
|
293
|
+
} else {
|
|
294
|
+
t25 = $[55];
|
|
295
|
+
}
|
|
296
|
+
return t25;
|
|
297
|
+
}
|
package/dist/chat/ui/index.d.ts
CHANGED
|
@@ -49,4 +49,5 @@ export { ReportRow, AssistantRow, NoteRow, AgentTurnRow, CompactionRow } from '.
|
|
|
49
49
|
export { TaskRow } from './rows/TaskRow.js';
|
|
50
50
|
export { WorkRow, WorkGroupRow, WorkingRow } from './rows/WorkRows.js';
|
|
51
51
|
export { WorkflowRow } from './rows/WorkflowRow.js';
|
|
52
|
+
export { WorkflowAgentLine } from './WorkflowAgentLine.js';
|
|
52
53
|
export { useDiffSourceTokens } from './use-diff-source-tokens.js';
|
package/dist/chat/ui/index.js
CHANGED
|
@@ -45,4 +45,5 @@ export { ReportRow, AssistantRow, NoteRow, AgentTurnRow, CompactionRow } from '.
|
|
|
45
45
|
export { TaskRow } from './rows/TaskRow.js';
|
|
46
46
|
export { WorkRow, WorkGroupRow, WorkingRow } from './rows/WorkRows.js';
|
|
47
47
|
export { WorkflowRow } from './rows/WorkflowRow.js';
|
|
48
|
+
export { WorkflowAgentLine } from './WorkflowAgentLine.js';
|
|
48
49
|
export { useDiffSourceTokens } from './use-diff-source-tokens.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ChatToolItem, ChatWorkflow } from '@adecore/agent-contracts';
|
|
2
2
|
import type { SubagentStep } from '../../subagent-view.js';
|
|
3
3
|
export declare function WorkflowRow({ tool, workflow, chatId, onOpenAgent }: {
|
|
4
4
|
tool: ChatToolItem;
|
|
@@ -2,282 +2,19 @@ import { c as _c } from "react/compiler-runtime";
|
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
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';
|
|
5
|
+
import { ChevronRight, Square, TriangleAlert, Workflow } from 'lucide-react';
|
|
6
|
+
import { Icon, IconButton } from '@adecore/ui';
|
|
7
|
+
import { workflowCounts, workflowDescription, workflowPhases } from '../../logic/workflow.js';
|
|
11
8
|
import { hasToolBody } from '../../logic/tools.js';
|
|
12
9
|
import { useSubagentSupport } from '../../subagent-support.js';
|
|
13
10
|
import { ROW_GUTTER } from '../icons.js';
|
|
11
|
+
import { WorkflowAgentLine } from '../WorkflowAgentLine.js';
|
|
14
12
|
import { ToolBody } from './WorkRows.js';
|
|
15
13
|
import { useChatScope } from '../../../scope.js';
|
|
16
14
|
import { useChats } from '../../../state/chats.js';
|
|
17
15
|
import { useChatActions } from '../../actions.js';
|
|
18
16
|
import { useChatHost } from '../../../host.js';
|
|
19
17
|
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
|
-
}
|
|
55
|
-
function AgentLine(t0) {
|
|
56
|
-
const $ = _c(49);
|
|
57
|
-
const {
|
|
58
|
-
view,
|
|
59
|
-
provider,
|
|
60
|
-
onOpen
|
|
61
|
-
} = t0;
|
|
62
|
-
const {
|
|
63
|
-
agent,
|
|
64
|
-
state
|
|
65
|
-
} = view;
|
|
66
|
-
let t1;
|
|
67
|
-
if ($[0] !== view) {
|
|
68
|
-
t1 = workflowAgentTime(view);
|
|
69
|
-
$[0] = view;
|
|
70
|
-
$[1] = t1;
|
|
71
|
-
} else {
|
|
72
|
-
t1 = $[1];
|
|
73
|
-
}
|
|
74
|
-
const time = t1;
|
|
75
|
-
let t2;
|
|
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({
|
|
88
|
-
toolUseId: workflowAgentRef(agentId),
|
|
89
|
-
description: agent.label
|
|
90
|
-
}) : undefined;
|
|
91
|
-
$[4] = agent.label;
|
|
92
|
-
$[5] = agentId;
|
|
93
|
-
$[6] = onOpen;
|
|
94
|
-
$[7] = t3;
|
|
95
|
-
} else {
|
|
96
|
-
t3 = $[7];
|
|
97
|
-
}
|
|
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, {
|
|
110
|
-
icon: Bot,
|
|
111
|
-
size: 14
|
|
112
|
-
}) : /*#__PURE__*/_jsx(AgentIcon, {
|
|
113
|
-
kind: provider,
|
|
114
|
-
size: 14
|
|
115
|
-
});
|
|
116
|
-
$[9] = provider;
|
|
117
|
-
$[10] = t6;
|
|
118
|
-
} else {
|
|
119
|
-
t6 = $[10];
|
|
120
|
-
}
|
|
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, {
|
|
204
|
-
startedAt: agent.startedAt
|
|
205
|
-
}) : time !== null && /*#__PURE__*/_jsx("span", {
|
|
206
|
-
className: TIME,
|
|
207
|
-
children: time
|
|
208
|
-
});
|
|
209
|
-
$[29] = agent.startedAt;
|
|
210
|
-
$[30] = state;
|
|
211
|
-
$[31] = time;
|
|
212
|
-
$[32] = t16;
|
|
213
|
-
} else {
|
|
214
|
-
t16 = $[32];
|
|
215
|
-
}
|
|
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]
|
|
254
|
-
});
|
|
255
|
-
$[39] = t16;
|
|
256
|
-
$[40] = t17;
|
|
257
|
-
$[41] = t20;
|
|
258
|
-
$[42] = t21;
|
|
259
|
-
} else {
|
|
260
|
-
t21 = $[42];
|
|
261
|
-
}
|
|
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;
|
|
280
|
-
}
|
|
281
18
|
function PhaseBlock(t0) {
|
|
282
19
|
const $ = _c(17);
|
|
283
20
|
const {
|
|
@@ -321,7 +58,7 @@ function PhaseBlock(t0) {
|
|
|
321
58
|
if ($[7] !== onOpen || $[8] !== phase.agents || $[9] !== provider) {
|
|
322
59
|
let t4;
|
|
323
60
|
if ($[11] !== onOpen || $[12] !== provider) {
|
|
324
|
-
t4 = view_0 => /*#__PURE__*/_jsx(
|
|
61
|
+
t4 = view_0 => /*#__PURE__*/_jsx(WorkflowAgentLine, {
|
|
325
62
|
view: view_0,
|
|
326
63
|
provider: provider,
|
|
327
64
|
onOpen: onOpen
|
package/dist/state/chats.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentKind, ChatApprovalItem, ChatBookmark, ChatEvent, ChatHistoryResult, ChatInfo, ChatItem, ChatQuestionItem, ChatSubagentItem, ChatVisual } from '@adecore/agent-contracts';
|
|
1
|
+
import type { AgentKind, ChatApprovalItem, ChatBookmark, ChatEvent, ChatHistoryResult, ChatInfo, ChatItem, ChatQuestionItem, ChatSubagentItem, ChatToolItem, ChatVisual } from '@adecore/agent-contracts';
|
|
2
2
|
export interface ChatState {
|
|
3
3
|
info: ChatInfo;
|
|
4
4
|
historyPending?: boolean;
|
|
@@ -8,6 +8,7 @@ export interface ChatState {
|
|
|
8
8
|
history?: ChatHistoryPage;
|
|
9
9
|
waitingBefore?: string[];
|
|
10
10
|
subagentsBefore?: string[];
|
|
11
|
+
workflowsBefore?: string[];
|
|
11
12
|
outlineBefore?: ChatItem[];
|
|
12
13
|
bookmarks?: ChatBookmark[];
|
|
13
14
|
visuals?: ChatVisual[];
|
|
@@ -17,6 +18,7 @@ export interface ChatPage {
|
|
|
17
18
|
history: ChatHistoryPage;
|
|
18
19
|
pending: ChatItem[];
|
|
19
20
|
subagents?: ChatSubagentItem[];
|
|
21
|
+
workflows?: ChatToolItem[];
|
|
20
22
|
outline?: ChatItem[];
|
|
21
23
|
}
|
|
22
24
|
export type ChatsById = Record<string, ChatState>;
|
package/dist/state/chats.js
CHANGED
|
@@ -19,7 +19,8 @@ function stateOf(info, items, page) {
|
|
|
19
19
|
}
|
|
20
20
|
const before = page.pending.filter(item => !(item.id in byId));
|
|
21
21
|
const subagents = (page.subagents ?? []).filter(item => !(item.id in byId));
|
|
22
|
-
|
|
22
|
+
const workflows = (page.workflows ?? []).filter(item => !(item.id in byId) && !before.some(request => request.id === item.id));
|
|
23
|
+
for (const item of [...before, ...subagents, ...workflows]) {
|
|
23
24
|
byId[item.id] = item;
|
|
24
25
|
}
|
|
25
26
|
return {
|
|
@@ -30,6 +31,7 @@ function stateOf(info, items, page) {
|
|
|
30
31
|
history: page.history,
|
|
31
32
|
waitingBefore: before.map(item => item.id),
|
|
32
33
|
subagentsBefore: subagents.map(item => item.id),
|
|
34
|
+
workflowsBefore: workflows.map(item => item.id),
|
|
33
35
|
outlineBefore: (page.outline ?? []).filter(item => !(item.id in byId))
|
|
34
36
|
};
|
|
35
37
|
}
|
|
@@ -37,7 +39,7 @@ function stateOf(info, items, page) {
|
|
|
37
39
|
function isBeforePage(state, historyIndex) {
|
|
38
40
|
return state.history !== undefined && historyIndex !== undefined && historyIndex < state.history.start;
|
|
39
41
|
}
|
|
40
|
-
/* An item from before the page this client holds matters only as a sub-agent, a request that waits, or one that stopped waiting. */
|
|
42
|
+
/* An item from before the page this client holds matters only as a sub-agent, a workflow, a request that waits, or one that stopped waiting. */
|
|
41
43
|
function withEarlierItem(state, item, write) {
|
|
42
44
|
if (item.kind === 'subagent') {
|
|
43
45
|
const subagents = state.subagentsBefore ?? [];
|
|
@@ -46,6 +48,13 @@ function withEarlierItem(state, item, write) {
|
|
|
46
48
|
subagentsBefore: subagents.includes(item.id) ? subagents : [...subagents, item.id]
|
|
47
49
|
};
|
|
48
50
|
}
|
|
51
|
+
if (item.kind === 'tool' && item.name === 'Workflow' && item.workflow !== undefined) {
|
|
52
|
+
const workflows = state.workflowsBefore ?? [];
|
|
53
|
+
return {
|
|
54
|
+
...write(state, item),
|
|
55
|
+
workflowsBefore: workflows.includes(item.id) ? workflows : [...workflows, item.id]
|
|
56
|
+
};
|
|
57
|
+
}
|
|
49
58
|
const waiting = state.waitingBefore ?? [];
|
|
50
59
|
const held = waiting.includes(item.id);
|
|
51
60
|
if (isWaiting(item)) {
|
|
@@ -84,6 +93,7 @@ export function prependPage(state, cursor, page) {
|
|
|
84
93
|
history: _history,
|
|
85
94
|
waitingBefore: _waitingBefore,
|
|
86
95
|
subagentsBefore: _subagentsBefore,
|
|
96
|
+
workflowsBefore: _workflowsBefore,
|
|
87
97
|
outlineBefore: _outlineBefore,
|
|
88
98
|
...rest
|
|
89
99
|
} = loaded;
|
|
@@ -96,6 +106,7 @@ export function prependPage(state, cursor, page) {
|
|
|
96
106
|
}
|
|
97
107
|
const waitingBefore = (state.waitingBefore ?? []).filter(id => !olderIds.has(id));
|
|
98
108
|
const subagentsBefore = (state.subagentsBefore ?? []).filter(id => !olderIds.has(id));
|
|
109
|
+
const workflowsBefore = (state.workflowsBefore ?? []).filter(id => !olderIds.has(id));
|
|
99
110
|
const outlineBefore = (state.outlineBefore ?? []).filter(item => !olderIds.has(item.id));
|
|
100
111
|
return {
|
|
101
112
|
...loaded,
|
|
@@ -105,6 +116,7 @@ export function prependPage(state, cursor, page) {
|
|
|
105
116
|
history: page.history,
|
|
106
117
|
waitingBefore,
|
|
107
118
|
subagentsBefore,
|
|
119
|
+
workflowsBefore,
|
|
108
120
|
outlineBefore
|
|
109
121
|
};
|
|
110
122
|
}
|