@arbor-education/agent-view-frontend 0.4.10 → 0.5.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/README.md +14 -12
- package/dist/index.cjs +7 -4
- package/dist/index.d.ts +49 -5
- package/dist/index.js +1805 -1638
- package/dist/style.css +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -1,121 +1,124 @@
|
|
|
1
|
-
import { jsxs as l, jsx as
|
|
2
|
-
import { useRef as le, useState as
|
|
3
|
-
import
|
|
4
|
-
import { Heading as
|
|
5
|
-
import { CHAT_RESPONSE_TYPE_AGENT as
|
|
6
|
-
const
|
|
1
|
+
import { jsxs as l, jsx as a, Fragment as fe } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as le, useState as h, useLayoutEffect as et, useEffect as H, useMemo as Y, useCallback as C } from "react";
|
|
3
|
+
import W from "classnames";
|
|
4
|
+
import { Heading as be, Icon as U, Dot as qt, SlideoverUtils as Ye, SlideoverManager as vn, Modal as ue, Button as te, Tabs as dt, SelectDropdown as wn, TextInput as yn, Combobox as Tt, Card as kn } from "@arbor-education/design-system.components";
|
|
5
|
+
import { CHAT_RESPONSE_TYPE_AGENT as Jt, CHAT_RESPONSE_TYPE_ERROR as Nn, ChatPanel as An, CHAT_RESPONSE_TYPE_USER as Sn, CHAT_RESPONSE_TYPE_INFO as bn } from "@arbor-education/ask-arbor-chat-panel";
|
|
6
|
+
const E = {
|
|
7
7
|
"generating-a-response": "generating-a-response",
|
|
8
8
|
hitl: "hitl",
|
|
9
9
|
complete: "complete",
|
|
10
10
|
failed: "failed"
|
|
11
|
-
},
|
|
11
|
+
}, M = {
|
|
12
12
|
"generating-a-response": "generating-a-response",
|
|
13
13
|
hitl: "hitl",
|
|
14
14
|
complete: "complete",
|
|
15
15
|
failed: "failed"
|
|
16
|
-
},
|
|
16
|
+
}, B = {
|
|
17
17
|
briefing: "briefing",
|
|
18
18
|
running: "running",
|
|
19
19
|
stopped: "stopped",
|
|
20
20
|
complete: "complete"
|
|
21
|
-
},
|
|
21
|
+
}, ne = {
|
|
22
22
|
agent: "agent",
|
|
23
23
|
user: "user",
|
|
24
24
|
system: "system"
|
|
25
|
-
},
|
|
25
|
+
}, he = {
|
|
26
26
|
document_html: "document_html",
|
|
27
27
|
mis_record: "mis_record",
|
|
28
28
|
workflow: "workflow",
|
|
29
29
|
file: "file",
|
|
30
|
+
user_file: "user_file",
|
|
30
31
|
link: "link"
|
|
31
|
-
},
|
|
32
|
+
}, Cn = {
|
|
33
|
+
user_file: "user_file"
|
|
34
|
+
}, Rt = {
|
|
32
35
|
cancelled: "cancelled",
|
|
33
36
|
archived: "archived"
|
|
34
|
-
},
|
|
37
|
+
}, gt = {
|
|
35
38
|
in_progress: "in_progress",
|
|
36
39
|
requires_attention: "requires_attention",
|
|
37
40
|
available: "available"
|
|
38
|
-
},
|
|
39
|
-
[
|
|
41
|
+
}, ee = {
|
|
42
|
+
[M.complete]: {
|
|
40
43
|
label: "Complete",
|
|
41
44
|
icon: "circle-check",
|
|
42
45
|
color: "var(--color-semantic-success-600)"
|
|
43
46
|
},
|
|
44
|
-
[
|
|
47
|
+
[M.failed]: {
|
|
45
48
|
label: "Failed",
|
|
46
49
|
icon: "circle-x",
|
|
47
50
|
color: "var(--color-semantic-destructive-600)"
|
|
48
51
|
},
|
|
49
|
-
[
|
|
52
|
+
[M.hitl]: {
|
|
50
53
|
label: "Requires attention",
|
|
51
54
|
icon: "triangle-alert",
|
|
52
55
|
color: "var(--color-semantic-warning-600)"
|
|
53
56
|
},
|
|
54
|
-
[
|
|
57
|
+
[M["generating-a-response"]]: {
|
|
55
58
|
label: "Generating a response",
|
|
56
59
|
icon: "sparkles",
|
|
57
60
|
color: "var(--color-brand-600)"
|
|
58
61
|
}
|
|
59
|
-
},
|
|
60
|
-
[
|
|
61
|
-
status:
|
|
62
|
+
}, Qe = {
|
|
63
|
+
[E["generating-a-response"]]: {
|
|
64
|
+
status: E["generating-a-response"],
|
|
62
65
|
title: "Active",
|
|
63
66
|
dotColour: "green",
|
|
64
67
|
statusIcon: {
|
|
65
|
-
name:
|
|
66
|
-
color:
|
|
68
|
+
name: ee["generating-a-response"].icon,
|
|
69
|
+
color: ee["generating-a-response"].color
|
|
67
70
|
}
|
|
68
71
|
},
|
|
69
|
-
[
|
|
70
|
-
status:
|
|
72
|
+
[E.hitl]: {
|
|
73
|
+
status: E.hitl,
|
|
71
74
|
title: "Requires attention",
|
|
72
75
|
dotColour: "orange",
|
|
73
76
|
statusIcon: {
|
|
74
|
-
name:
|
|
75
|
-
color:
|
|
77
|
+
name: ee.hitl.icon,
|
|
78
|
+
color: ee.hitl.color
|
|
76
79
|
}
|
|
77
80
|
},
|
|
78
|
-
[
|
|
79
|
-
status:
|
|
81
|
+
[E.complete]: {
|
|
82
|
+
status: E.complete,
|
|
80
83
|
title: "Complete",
|
|
81
84
|
dotColour: "green",
|
|
82
85
|
dotModifier: "grey-dark",
|
|
83
86
|
statusIcon: {
|
|
84
|
-
name:
|
|
85
|
-
color:
|
|
87
|
+
name: ee.complete.icon,
|
|
88
|
+
color: ee.complete.color
|
|
86
89
|
}
|
|
87
90
|
},
|
|
88
|
-
[
|
|
89
|
-
status:
|
|
91
|
+
[E.failed]: {
|
|
92
|
+
status: E.failed,
|
|
90
93
|
title: "Failed",
|
|
91
94
|
dotColour: "salmon",
|
|
92
95
|
statusIcon: {
|
|
93
|
-
name:
|
|
94
|
-
color:
|
|
96
|
+
name: ee.failed.icon,
|
|
97
|
+
color: ee.failed.color
|
|
95
98
|
}
|
|
96
99
|
}
|
|
97
|
-
},
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
],
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
],
|
|
104
|
-
[
|
|
105
|
-
[
|
|
106
|
-
[
|
|
107
|
-
[
|
|
108
|
-
},
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
],
|
|
114
|
-
[
|
|
115
|
-
[
|
|
116
|
-
[
|
|
117
|
-
[
|
|
118
|
-
},
|
|
100
|
+
}, En = [
|
|
101
|
+
E["generating-a-response"],
|
|
102
|
+
E.hitl
|
|
103
|
+
], Tn = [
|
|
104
|
+
E.complete,
|
|
105
|
+
E.failed
|
|
106
|
+
], Rn = "m4", In = "1", Kt = "msg-opening", Ze = "Unable to load agent tasks. Please try again.", On = "Unable to load the resources for this agent", Ln = "Unable to load this document. Please try again.", Wt = "Unable to load the timeline for this agent", Un = "Unable to stop the agent. Please try again.", Pn = "Something went wrong. Please try again.", jt = "Unable to load agents. Please try again.", Se = "Loading tasks…", It = "Loading agents…", xn = "Task", Dn = {
|
|
107
|
+
[B.briefing]: "Briefing",
|
|
108
|
+
[B.running]: "Working",
|
|
109
|
+
[B.stopped]: "Stopped",
|
|
110
|
+
[B.complete]: "Complete"
|
|
111
|
+
}, $n = [
|
|
112
|
+
E["generating-a-response"],
|
|
113
|
+
E.hitl,
|
|
114
|
+
E.complete,
|
|
115
|
+
E.failed
|
|
116
|
+
], Mn = {
|
|
117
|
+
[E["generating-a-response"]]: "Agents currently working on tasks for you.",
|
|
118
|
+
[E.hitl]: "Agents that need your input before they can continue.",
|
|
119
|
+
[E.complete]: "Agents that have finished their work.",
|
|
120
|
+
[E.failed]: "Agents that failed or were stopped."
|
|
121
|
+
}, Hn = () => /* @__PURE__ */ l(
|
|
119
122
|
"svg",
|
|
120
123
|
{
|
|
121
124
|
className: "agent-view__empty-illustration",
|
|
@@ -124,7 +127,7 @@ const R = {
|
|
|
124
127
|
role: "img",
|
|
125
128
|
"aria-label": "Preview of the agents board layout",
|
|
126
129
|
children: [
|
|
127
|
-
/* @__PURE__ */
|
|
130
|
+
/* @__PURE__ */ a(
|
|
128
131
|
"rect",
|
|
129
132
|
{
|
|
130
133
|
x: "0",
|
|
@@ -135,7 +138,7 @@ const R = {
|
|
|
135
138
|
fill: "var(--color-grey-100)"
|
|
136
139
|
}
|
|
137
140
|
),
|
|
138
|
-
/* @__PURE__ */
|
|
141
|
+
/* @__PURE__ */ a(
|
|
139
142
|
"rect",
|
|
140
143
|
{
|
|
141
144
|
x: "16",
|
|
@@ -147,7 +150,7 @@ const R = {
|
|
|
147
150
|
stroke: "var(--card-default-color-border)"
|
|
148
151
|
}
|
|
149
152
|
),
|
|
150
|
-
/* @__PURE__ */
|
|
153
|
+
/* @__PURE__ */ a(
|
|
151
154
|
"rect",
|
|
152
155
|
{
|
|
153
156
|
x: "130",
|
|
@@ -159,7 +162,7 @@ const R = {
|
|
|
159
162
|
stroke: "var(--card-default-color-border)"
|
|
160
163
|
}
|
|
161
164
|
),
|
|
162
|
-
/* @__PURE__ */
|
|
165
|
+
/* @__PURE__ */ a(
|
|
163
166
|
"rect",
|
|
164
167
|
{
|
|
165
168
|
x: "244",
|
|
@@ -171,7 +174,7 @@ const R = {
|
|
|
171
174
|
stroke: "var(--card-default-color-border)"
|
|
172
175
|
}
|
|
173
176
|
),
|
|
174
|
-
/* @__PURE__ */
|
|
177
|
+
/* @__PURE__ */ a(
|
|
175
178
|
"rect",
|
|
176
179
|
{
|
|
177
180
|
x: "244",
|
|
@@ -183,7 +186,7 @@ const R = {
|
|
|
183
186
|
stroke: "var(--card-default-color-border)"
|
|
184
187
|
}
|
|
185
188
|
),
|
|
186
|
-
/* @__PURE__ */
|
|
189
|
+
/* @__PURE__ */ a(
|
|
187
190
|
"rect",
|
|
188
191
|
{
|
|
189
192
|
x: "28",
|
|
@@ -194,7 +197,7 @@ const R = {
|
|
|
194
197
|
fill: "var(--color-grey-050)"
|
|
195
198
|
}
|
|
196
199
|
),
|
|
197
|
-
/* @__PURE__ */
|
|
200
|
+
/* @__PURE__ */ a(
|
|
198
201
|
"rect",
|
|
199
202
|
{
|
|
200
203
|
x: "28",
|
|
@@ -205,7 +208,7 @@ const R = {
|
|
|
205
208
|
fill: "var(--color-grey-050)"
|
|
206
209
|
}
|
|
207
210
|
),
|
|
208
|
-
/* @__PURE__ */
|
|
211
|
+
/* @__PURE__ */ a(
|
|
209
212
|
"rect",
|
|
210
213
|
{
|
|
211
214
|
x: "142",
|
|
@@ -216,9 +219,9 @@ const R = {
|
|
|
216
219
|
fill: "var(--color-semantic-warning-050)"
|
|
217
220
|
}
|
|
218
221
|
),
|
|
219
|
-
/* @__PURE__ */
|
|
220
|
-
/* @__PURE__ */
|
|
221
|
-
/* @__PURE__ */
|
|
222
|
+
/* @__PURE__ */ a("circle", { cx: "40", cy: "70", r: "4", fill: "var(--color-brand-600)" }),
|
|
223
|
+
/* @__PURE__ */ a("circle", { cx: "40", cy: "114", r: "4", fill: "var(--color-brand-600)" }),
|
|
224
|
+
/* @__PURE__ */ a(
|
|
222
225
|
"circle",
|
|
223
226
|
{
|
|
224
227
|
cx: "154",
|
|
@@ -227,250 +230,263 @@ const R = {
|
|
|
227
230
|
fill: "var(--color-semantic-warning-600)"
|
|
228
231
|
}
|
|
229
232
|
),
|
|
230
|
-
/* @__PURE__ */
|
|
231
|
-
/* @__PURE__ */
|
|
233
|
+
/* @__PURE__ */ a("circle", { cx: "256", cy: "52", r: "4", fill: "var(--color-grey-400)" }),
|
|
234
|
+
/* @__PURE__ */ a("circle", { cx: "256", cy: "160", r: "4", fill: "var(--color-semantic-destructive-500)" })
|
|
232
235
|
]
|
|
233
236
|
}
|
|
234
|
-
),
|
|
235
|
-
const
|
|
236
|
-
return
|
|
237
|
-
|
|
237
|
+
), zn = ({ status: e }) => {
|
|
238
|
+
const t = Qe[e];
|
|
239
|
+
return t.statusIcon ? /* @__PURE__ */ a(
|
|
240
|
+
U,
|
|
238
241
|
{
|
|
239
|
-
name:
|
|
242
|
+
name: t.statusIcon.name,
|
|
240
243
|
size: 16,
|
|
241
|
-
color:
|
|
242
|
-
screenReaderText:
|
|
244
|
+
color: t.statusIcon.color,
|
|
245
|
+
screenReaderText: t.title
|
|
243
246
|
}
|
|
244
|
-
) : /* @__PURE__ */
|
|
245
|
-
},
|
|
247
|
+
) : /* @__PURE__ */ a(qt, { colour: t.dotColour, label: t.title });
|
|
248
|
+
}, Gn = () => /* @__PURE__ */ l(
|
|
246
249
|
"section",
|
|
247
250
|
{
|
|
248
251
|
className: "agent-view__empty",
|
|
249
252
|
"aria-label": "About the agents board",
|
|
250
253
|
children: [
|
|
251
254
|
/* @__PURE__ */ l("div", { className: "agent-view__empty-content", children: [
|
|
252
|
-
/* @__PURE__ */
|
|
253
|
-
/* @__PURE__ */
|
|
254
|
-
/* @__PURE__ */
|
|
255
|
-
const
|
|
255
|
+
/* @__PURE__ */ a(be, { level: 4, children: "Your agents board" }),
|
|
256
|
+
/* @__PURE__ */ a("p", { className: "agent-view__empty-lead", children: "When you start an agent, it appears here so you can track progress at a glance. Agents move between columns as their status changes." }),
|
|
257
|
+
/* @__PURE__ */ a("ul", { className: "agent-view__empty-columns", children: $n.map((e) => {
|
|
258
|
+
const t = Qe[e];
|
|
256
259
|
return /* @__PURE__ */ l("li", { className: "agent-view__empty-column", children: [
|
|
257
|
-
/* @__PURE__ */
|
|
260
|
+
/* @__PURE__ */ a("span", { className: "agent-view__empty-column-indicator", children: /* @__PURE__ */ a(zn, { status: e }) }),
|
|
258
261
|
/* @__PURE__ */ l("span", { className: "agent-view__empty-column-text", children: [
|
|
259
|
-
/* @__PURE__ */
|
|
260
|
-
/* @__PURE__ */
|
|
262
|
+
/* @__PURE__ */ a("span", { className: "agent-view__empty-column-title", children: t.title }),
|
|
263
|
+
/* @__PURE__ */ a("span", { className: "agent-view__empty-column-description", children: Mn[e] })
|
|
261
264
|
] })
|
|
262
|
-
] },
|
|
265
|
+
] }, e);
|
|
263
266
|
}) }),
|
|
264
267
|
/* @__PURE__ */ l("p", { className: "agent-view__empty-hint", children: [
|
|
265
268
|
"Use ",
|
|
266
|
-
/* @__PURE__ */
|
|
269
|
+
/* @__PURE__ */ a("strong", { children: "Start an agent" }),
|
|
267
270
|
" above to begin."
|
|
268
271
|
] })
|
|
269
272
|
] }),
|
|
270
|
-
/* @__PURE__ */
|
|
273
|
+
/* @__PURE__ */ a("div", { className: "agent-view__empty-visual", children: /* @__PURE__ */ a(Hn, {}) })
|
|
271
274
|
]
|
|
272
275
|
}
|
|
273
|
-
),
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
276
|
+
), Fn = () => ({
|
|
277
|
+
needsInput: [],
|
|
278
|
+
complete: [],
|
|
279
|
+
failed: [],
|
|
280
|
+
tasks: []
|
|
281
|
+
}), Bn = (e, t) => ({
|
|
282
|
+
...e,
|
|
283
|
+
...t.length > 0 ? { children: t } : {}
|
|
284
|
+
}), Vt = (e) => {
|
|
285
|
+
const t = [], n = [], s = [], r = [];
|
|
286
|
+
for (const o of e) {
|
|
287
|
+
const i = o.children ? Vt(o.children) : Fn();
|
|
288
|
+
if (t.push(...i.needsInput), n.push(...i.complete), s.push(...i.failed), o.status === M.hitl) {
|
|
289
|
+
t.push({ ...o, children: void 0 });
|
|
282
290
|
continue;
|
|
283
291
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
+
if (o.status === M.complete) {
|
|
293
|
+
n.push({ ...o, children: void 0 });
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
296
|
+
if (o.status === M.failed) {
|
|
297
|
+
s.push({ ...o, children: void 0 });
|
|
298
|
+
continue;
|
|
299
|
+
}
|
|
300
|
+
r.push(Bn(o, i.tasks));
|
|
301
|
+
}
|
|
302
|
+
return { needsInput: t, complete: n, failed: s, tasks: r };
|
|
303
|
+
}, Ot = (e) => e === M.hitl ? 0 : e === M.complete ? 1 : e === M.failed ? 2 : 3, qn = (e) => e.map((t, n) => ({ item: t, index: n })).sort((t, n) => {
|
|
304
|
+
const s = Ot(t.item.status) - Ot(n.item.status);
|
|
305
|
+
return s !== 0 ? s : t.index - n.index;
|
|
306
|
+
}).map(({ item: t }) => t), ht = 2, Jn = (e) => {
|
|
307
|
+
if (!e)
|
|
292
308
|
return { canScrollUp: !1, canScrollDown: !1 };
|
|
293
|
-
const
|
|
294
|
-
return
|
|
295
|
-
canScrollUp:
|
|
296
|
-
canScrollDown:
|
|
309
|
+
const t = e.scrollHeight - e.clientHeight;
|
|
310
|
+
return t <= ht ? { canScrollUp: !1, canScrollDown: !1 } : {
|
|
311
|
+
canScrollUp: e.scrollTop > ht,
|
|
312
|
+
canScrollDown: e.scrollTop < t - ht
|
|
297
313
|
};
|
|
298
|
-
},
|
|
299
|
-
if (!
|
|
314
|
+
}, Kn = (e, t) => {
|
|
315
|
+
if (!e || !t)
|
|
300
316
|
return null;
|
|
301
|
-
const n =
|
|
317
|
+
const n = e.getBoundingClientRect(), s = t.getBoundingClientRect();
|
|
302
318
|
return {
|
|
303
|
-
top:
|
|
304
|
-
left:
|
|
305
|
-
width:
|
|
306
|
-
height:
|
|
319
|
+
top: s.top - n.top,
|
|
320
|
+
left: s.left - n.left,
|
|
321
|
+
width: s.width,
|
|
322
|
+
height: s.height
|
|
307
323
|
};
|
|
308
|
-
},
|
|
309
|
-
children:
|
|
310
|
-
className:
|
|
324
|
+
}, tt = ({
|
|
325
|
+
children: e,
|
|
326
|
+
className: t,
|
|
311
327
|
contentClassName: n,
|
|
312
|
-
scrollSelector:
|
|
328
|
+
scrollSelector: s,
|
|
313
329
|
style: r,
|
|
314
330
|
"aria-label": o
|
|
315
331
|
}) => {
|
|
316
|
-
const i = le(null),
|
|
317
|
-
var
|
|
318
|
-
return
|
|
319
|
-
},
|
|
320
|
-
const
|
|
321
|
-
if (
|
|
322
|
-
(
|
|
323
|
-
),
|
|
324
|
-
(
|
|
325
|
-
),
|
|
326
|
-
const
|
|
327
|
-
|
|
332
|
+
const i = le(null), p = le(null), [c, g] = h(!1), [m, N] = h(!1), [y, I] = h(null), O = () => {
|
|
333
|
+
var P;
|
|
334
|
+
return s ? ((P = i.current) == null ? void 0 : P.querySelector(s)) ?? null : p.current;
|
|
335
|
+
}, f = () => {
|
|
336
|
+
const P = O(), A = Jn(P);
|
|
337
|
+
if (g(
|
|
338
|
+
(_) => _ === A.canScrollUp ? _ : A.canScrollUp
|
|
339
|
+
), N(
|
|
340
|
+
(_) => _ === A.canScrollDown ? _ : A.canScrollDown
|
|
341
|
+
), s) {
|
|
342
|
+
const _ = Kn(i.current, P);
|
|
343
|
+
I((S) => (S == null ? void 0 : S.top) === (_ == null ? void 0 : _.top) && (S == null ? void 0 : S.left) === (_ == null ? void 0 : _.left) && (S == null ? void 0 : S.width) === (_ == null ? void 0 : _.width) && (S == null ? void 0 : S.height) === (_ == null ? void 0 : _.height) ? S : _);
|
|
328
344
|
} else
|
|
329
|
-
|
|
345
|
+
I((_) => _ === null ? _ : null);
|
|
330
346
|
};
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
}),
|
|
334
|
-
const
|
|
335
|
-
if (!
|
|
347
|
+
et(() => {
|
|
348
|
+
f();
|
|
349
|
+
}), H(() => {
|
|
350
|
+
const P = i.current;
|
|
351
|
+
if (!P)
|
|
336
352
|
return;
|
|
337
|
-
let
|
|
338
|
-
const
|
|
339
|
-
|
|
340
|
-
},
|
|
341
|
-
if (
|
|
342
|
-
|
|
353
|
+
let A = null, _ = null;
|
|
354
|
+
const S = () => {
|
|
355
|
+
A == null || A.removeEventListener("scroll", f), _ == null || _.disconnect(), _ = null, A = null;
|
|
356
|
+
}, v = (z) => {
|
|
357
|
+
if (z === A) {
|
|
358
|
+
f();
|
|
343
359
|
return;
|
|
344
360
|
}
|
|
345
|
-
if (
|
|
346
|
-
|
|
361
|
+
if (S(), A = z, !A) {
|
|
362
|
+
f();
|
|
347
363
|
return;
|
|
348
364
|
}
|
|
349
|
-
|
|
365
|
+
A.addEventListener("scroll", f, { passive: !0 }), _ = new ResizeObserver(() => f()), _.observe(A), A.firstElementChild instanceof HTMLElement && _.observe(A.firstElementChild), f();
|
|
350
366
|
};
|
|
351
|
-
|
|
352
|
-
const
|
|
353
|
-
|
|
367
|
+
v(O());
|
|
368
|
+
const R = new MutationObserver(() => {
|
|
369
|
+
v(O());
|
|
354
370
|
});
|
|
355
|
-
return
|
|
371
|
+
return R.observe(P, {
|
|
356
372
|
childList: !0,
|
|
357
373
|
subtree: !0,
|
|
358
374
|
characterData: !0
|
|
359
|
-
}), window.addEventListener("resize",
|
|
360
|
-
window.removeEventListener("resize",
|
|
375
|
+
}), window.addEventListener("resize", f), () => {
|
|
376
|
+
window.removeEventListener("resize", f), R.disconnect(), S();
|
|
361
377
|
};
|
|
362
|
-
}, [
|
|
363
|
-
const
|
|
364
|
-
const
|
|
365
|
-
if (!
|
|
378
|
+
}, [s]);
|
|
379
|
+
const K = (P) => {
|
|
380
|
+
const A = O();
|
|
381
|
+
if (!A)
|
|
366
382
|
return;
|
|
367
|
-
const
|
|
368
|
-
|
|
369
|
-
top:
|
|
383
|
+
const _ = Math.max(A.clientHeight * 0.75, 120);
|
|
384
|
+
A.scrollBy({
|
|
385
|
+
top: P === "up" ? -_ : _,
|
|
370
386
|
behavior: "smooth"
|
|
371
387
|
});
|
|
372
|
-
},
|
|
373
|
-
c && /* @__PURE__ */ l(
|
|
374
|
-
/* @__PURE__ */
|
|
375
|
-
/* @__PURE__ */
|
|
388
|
+
}, T = /* @__PURE__ */ l(fe, { children: [
|
|
389
|
+
c && /* @__PURE__ */ l(fe, { children: [
|
|
390
|
+
/* @__PURE__ */ a("div", { className: "scrollable-region__fade scrollable-region__fade--top", "aria-hidden": "true" }),
|
|
391
|
+
/* @__PURE__ */ a(
|
|
376
392
|
"button",
|
|
377
393
|
{
|
|
378
394
|
type: "button",
|
|
379
395
|
className: "scrollable-region__edge scrollable-region__edge--top",
|
|
380
396
|
"aria-label": "Scroll up",
|
|
381
|
-
onClick: () =>
|
|
382
|
-
children: /* @__PURE__ */
|
|
397
|
+
onClick: () => K("up"),
|
|
398
|
+
children: /* @__PURE__ */ a(U, { name: "chevron-up", size: 16, color: "currentColor" })
|
|
383
399
|
}
|
|
384
400
|
)
|
|
385
401
|
] }),
|
|
386
|
-
|
|
387
|
-
/* @__PURE__ */
|
|
402
|
+
m && /* @__PURE__ */ l(fe, { children: [
|
|
403
|
+
/* @__PURE__ */ a(
|
|
388
404
|
"div",
|
|
389
405
|
{
|
|
390
406
|
className: "scrollable-region__fade scrollable-region__fade--bottom",
|
|
391
407
|
"aria-hidden": "true"
|
|
392
408
|
}
|
|
393
409
|
),
|
|
394
|
-
/* @__PURE__ */
|
|
410
|
+
/* @__PURE__ */ a(
|
|
395
411
|
"button",
|
|
396
412
|
{
|
|
397
413
|
type: "button",
|
|
398
414
|
className: "scrollable-region__edge scrollable-region__edge--bottom",
|
|
399
415
|
"aria-label": "Scroll down",
|
|
400
|
-
onClick: () =>
|
|
401
|
-
children: /* @__PURE__ */
|
|
416
|
+
onClick: () => K("down"),
|
|
417
|
+
children: /* @__PURE__ */ a(U, { name: "chevron-down", size: 16, color: "currentColor" })
|
|
402
418
|
}
|
|
403
419
|
)
|
|
404
420
|
] })
|
|
405
421
|
] });
|
|
406
|
-
return /* @__PURE__ */
|
|
422
|
+
return /* @__PURE__ */ a(
|
|
407
423
|
"div",
|
|
408
424
|
{
|
|
409
425
|
ref: i,
|
|
410
|
-
className:
|
|
426
|
+
className: W("scrollable-region", t),
|
|
411
427
|
style: r,
|
|
412
428
|
"aria-label": o,
|
|
413
|
-
children:
|
|
414
|
-
|
|
415
|
-
|
|
429
|
+
children: s ? /* @__PURE__ */ l(fe, { children: [
|
|
430
|
+
e,
|
|
431
|
+
y && (c || m) && /* @__PURE__ */ a(
|
|
416
432
|
"div",
|
|
417
433
|
{
|
|
418
434
|
className: "scrollable-region__overlay",
|
|
419
435
|
style: {
|
|
420
|
-
top:
|
|
421
|
-
left:
|
|
422
|
-
width:
|
|
423
|
-
height:
|
|
436
|
+
top: y.top,
|
|
437
|
+
left: y.left,
|
|
438
|
+
width: y.width,
|
|
439
|
+
height: y.height
|
|
424
440
|
},
|
|
425
|
-
children:
|
|
441
|
+
children: T
|
|
426
442
|
}
|
|
427
443
|
)
|
|
428
|
-
] }) : /* @__PURE__ */ l(
|
|
429
|
-
|
|
430
|
-
/* @__PURE__ */
|
|
444
|
+
] }) : /* @__PURE__ */ l(fe, { children: [
|
|
445
|
+
T,
|
|
446
|
+
/* @__PURE__ */ a(
|
|
431
447
|
"div",
|
|
432
448
|
{
|
|
433
|
-
ref:
|
|
434
|
-
className:
|
|
435
|
-
children:
|
|
449
|
+
ref: p,
|
|
450
|
+
className: W("scrollable-region__viewport", n),
|
|
451
|
+
children: e
|
|
436
452
|
}
|
|
437
453
|
)
|
|
438
454
|
] })
|
|
439
455
|
}
|
|
440
456
|
);
|
|
441
|
-
},
|
|
442
|
-
checklist:
|
|
457
|
+
}, Wn = 48, jn = ({
|
|
458
|
+
checklist: e
|
|
443
459
|
}) => {
|
|
444
|
-
const
|
|
445
|
-
return
|
|
446
|
-
const
|
|
447
|
-
if (!
|
|
460
|
+
const t = le(null), n = le(!1);
|
|
461
|
+
return et(() => {
|
|
462
|
+
const s = t.current;
|
|
463
|
+
if (!s)
|
|
448
464
|
return;
|
|
449
|
-
const r =
|
|
450
|
-
(!n.current || r <=
|
|
451
|
-
}, [
|
|
452
|
-
|
|
465
|
+
const r = s.scrollHeight - s.scrollTop - s.clientHeight;
|
|
466
|
+
(!n.current || r <= Wn) && (s.scrollTop = s.scrollHeight, n.current = !0);
|
|
467
|
+
}, [e]), e.length === 0 ? /* @__PURE__ */ a("p", { className: "agent-view__progress-empty", children: "No tasks to display." }) : /* @__PURE__ */ a(
|
|
468
|
+
tt,
|
|
453
469
|
{
|
|
454
470
|
className: "agent-view__progress-scroll",
|
|
455
471
|
scrollSelector: ".agent-view__progress-list",
|
|
456
|
-
children: /* @__PURE__ */
|
|
472
|
+
children: /* @__PURE__ */ a(
|
|
457
473
|
"ul",
|
|
458
474
|
{
|
|
459
|
-
ref:
|
|
475
|
+
ref: t,
|
|
460
476
|
className: "agent-view__progress-list",
|
|
461
477
|
"aria-label": "Agent tasks",
|
|
462
|
-
children:
|
|
463
|
-
const r =
|
|
478
|
+
children: qn(e).map((s) => {
|
|
479
|
+
const r = ee[s.status];
|
|
464
480
|
return /* @__PURE__ */ l(
|
|
465
481
|
"li",
|
|
466
482
|
{
|
|
467
|
-
className:
|
|
483
|
+
className: W(
|
|
468
484
|
"agent-view__progress-item",
|
|
469
|
-
`agent-view__progress-item--${
|
|
485
|
+
`agent-view__progress-item--${s.status.replace(/_/g, "-")}`
|
|
470
486
|
),
|
|
471
487
|
children: [
|
|
472
|
-
/* @__PURE__ */
|
|
473
|
-
|
|
488
|
+
/* @__PURE__ */ a(
|
|
489
|
+
U,
|
|
474
490
|
{
|
|
475
491
|
name: r.icon,
|
|
476
492
|
size: 16,
|
|
@@ -479,41 +495,41 @@ const R = {
|
|
|
479
495
|
}
|
|
480
496
|
),
|
|
481
497
|
/* @__PURE__ */ l("div", { className: "agent-view__progress-item-content", children: [
|
|
482
|
-
/* @__PURE__ */
|
|
483
|
-
|
|
498
|
+
/* @__PURE__ */ a("span", { className: "agent-view__progress-label", children: s.task }),
|
|
499
|
+
s.status !== M.complete && /* @__PURE__ */ a(
|
|
484
500
|
"span",
|
|
485
501
|
{
|
|
486
502
|
className: "agent-view__progress-description",
|
|
487
|
-
children:
|
|
503
|
+
children: s.description
|
|
488
504
|
}
|
|
489
505
|
)
|
|
490
506
|
] })
|
|
491
507
|
]
|
|
492
508
|
},
|
|
493
|
-
|
|
509
|
+
s.task
|
|
494
510
|
);
|
|
495
511
|
})
|
|
496
512
|
}
|
|
497
513
|
)
|
|
498
514
|
}
|
|
499
515
|
);
|
|
500
|
-
},
|
|
501
|
-
prompts:
|
|
502
|
-
classNamePrefix:
|
|
516
|
+
}, Vn = ({
|
|
517
|
+
prompts: e,
|
|
518
|
+
classNamePrefix: t = "agent-workspace",
|
|
503
519
|
onSelect: n
|
|
504
|
-
}) =>
|
|
520
|
+
}) => e.length === 0 ? null : /* @__PURE__ */ a("div", { className: `${t}__chips`, children: e.map((s) => /* @__PURE__ */ a(
|
|
505
521
|
"button",
|
|
506
522
|
{
|
|
507
523
|
type: "button",
|
|
508
|
-
className: `${
|
|
509
|
-
onClick: () => n(
|
|
510
|
-
children:
|
|
524
|
+
className: `${t}__chip`,
|
|
525
|
+
onClick: () => n(s),
|
|
526
|
+
children: s
|
|
511
527
|
},
|
|
512
|
-
|
|
528
|
+
s
|
|
513
529
|
)) });
|
|
514
|
-
class
|
|
515
|
-
constructor(
|
|
516
|
-
this.connector =
|
|
530
|
+
class Yn {
|
|
531
|
+
constructor(t, n) {
|
|
532
|
+
this.connector = t, this.canSend = n.canSend, this.onTurn = n.onTurn, this.onAwaitingChange = n.onAwaitingChange;
|
|
517
533
|
}
|
|
518
534
|
get canRate() {
|
|
519
535
|
return !1;
|
|
@@ -530,65 +546,65 @@ class On {
|
|
|
530
546
|
get ratingPopupUrls() {
|
|
531
547
|
return {};
|
|
532
548
|
}
|
|
533
|
-
async sendMessage(
|
|
534
|
-
var n,
|
|
549
|
+
async sendMessage(t) {
|
|
550
|
+
var n, s;
|
|
535
551
|
if (!this.canSend())
|
|
536
552
|
return null;
|
|
537
553
|
(n = this.onAwaitingChange) == null || n.call(this, !0);
|
|
538
554
|
try {
|
|
539
555
|
const r = await this.connector.sendMessage(
|
|
540
|
-
|
|
541
|
-
|
|
556
|
+
t.userMessage,
|
|
557
|
+
t.uploadFiles
|
|
542
558
|
);
|
|
543
559
|
return this.onTurn(r), {
|
|
544
560
|
id: r.message.id,
|
|
545
561
|
text: r.message.text,
|
|
546
|
-
type:
|
|
562
|
+
type: Jt,
|
|
547
563
|
...r.message.followUpPrompts ? { followUpPrompts: r.message.followUpPrompts } : {}
|
|
548
564
|
};
|
|
549
565
|
} catch {
|
|
550
566
|
return {
|
|
551
567
|
id: `error-${Date.now()}`,
|
|
552
|
-
text:
|
|
553
|
-
type:
|
|
568
|
+
text: Pn,
|
|
569
|
+
type: Nn
|
|
554
570
|
};
|
|
555
571
|
} finally {
|
|
556
|
-
(
|
|
572
|
+
(s = this.onAwaitingChange) == null || s.call(this, !1);
|
|
557
573
|
}
|
|
558
574
|
}
|
|
559
|
-
async loadHistory(
|
|
575
|
+
async loadHistory(t) {
|
|
560
576
|
return null;
|
|
561
577
|
}
|
|
562
578
|
async listInteractions() {
|
|
563
579
|
return null;
|
|
564
580
|
}
|
|
565
|
-
async rateMessage(
|
|
581
|
+
async rateMessage(t) {
|
|
566
582
|
}
|
|
567
|
-
async sendNotification(
|
|
583
|
+
async sendNotification(t) {
|
|
568
584
|
return !1;
|
|
569
585
|
}
|
|
570
586
|
}
|
|
571
|
-
const
|
|
572
|
-
connector:
|
|
573
|
-
phase:
|
|
587
|
+
const Xn = ({
|
|
588
|
+
connector: e,
|
|
589
|
+
phase: t,
|
|
574
590
|
chatHistory: n,
|
|
575
|
-
chatSessionKey:
|
|
591
|
+
chatSessionKey: s,
|
|
576
592
|
startQuery: r,
|
|
577
593
|
clarificationMessage: o,
|
|
578
594
|
enableUpload: i = !1,
|
|
579
|
-
onTurn:
|
|
595
|
+
onTurn: p,
|
|
580
596
|
onAwaitingChange: c,
|
|
581
|
-
onClarificationPrompt:
|
|
582
|
-
onDismissClarification:
|
|
597
|
+
onClarificationPrompt: g,
|
|
598
|
+
onDismissClarification: m
|
|
583
599
|
}) => {
|
|
584
|
-
const
|
|
585
|
-
() => new
|
|
586
|
-
canSend: () =>
|
|
587
|
-
onTurn:
|
|
600
|
+
const N = Y(
|
|
601
|
+
() => new Yn(e, {
|
|
602
|
+
canSend: () => t === B.running,
|
|
603
|
+
onTurn: p,
|
|
588
604
|
onAwaitingChange: c
|
|
589
605
|
}),
|
|
590
|
-
[
|
|
591
|
-
),
|
|
606
|
+
[e, t, p, c]
|
|
607
|
+
), y = t !== B.running, I = t === B.running;
|
|
592
608
|
return /* @__PURE__ */ l("section", { className: "agent-workspace__chat-body", "aria-label": "Chat", children: [
|
|
593
609
|
o && /* @__PURE__ */ l(
|
|
594
610
|
"div",
|
|
@@ -597,63 +613,63 @@ const Pn = ({
|
|
|
597
613
|
role: "region",
|
|
598
614
|
"aria-label": "Agent question",
|
|
599
615
|
children: [
|
|
600
|
-
/* @__PURE__ */
|
|
601
|
-
o.followUpPrompts && /* @__PURE__ */
|
|
602
|
-
|
|
616
|
+
/* @__PURE__ */ a("p", { className: "agent-workspace__clarification-text", children: o.text }),
|
|
617
|
+
o.followUpPrompts && /* @__PURE__ */ a(
|
|
618
|
+
Vn,
|
|
603
619
|
{
|
|
604
620
|
prompts: o.followUpPrompts,
|
|
605
|
-
onSelect:
|
|
621
|
+
onSelect: g
|
|
606
622
|
}
|
|
607
623
|
),
|
|
608
|
-
/* @__PURE__ */
|
|
624
|
+
/* @__PURE__ */ a(
|
|
609
625
|
"button",
|
|
610
626
|
{
|
|
611
627
|
type: "button",
|
|
612
628
|
className: "agent-workspace__clarification-dismiss",
|
|
613
|
-
onClick:
|
|
629
|
+
onClick: m,
|
|
614
630
|
children: "Dismiss"
|
|
615
631
|
}
|
|
616
632
|
)
|
|
617
633
|
]
|
|
618
634
|
}
|
|
619
635
|
),
|
|
620
|
-
/* @__PURE__ */
|
|
621
|
-
|
|
636
|
+
/* @__PURE__ */ a("div", { className: "agent-workspace__ask-arbor", children: /* @__PURE__ */ a(tt, { scrollSelector: ".chat-panel-message-list", children: /* @__PURE__ */ a(
|
|
637
|
+
An,
|
|
622
638
|
{
|
|
623
|
-
connector:
|
|
639
|
+
connector: N,
|
|
624
640
|
chatHistory: n,
|
|
625
641
|
startQuery: r,
|
|
626
|
-
lockConversation:
|
|
642
|
+
lockConversation: y,
|
|
627
643
|
enableUpload: i,
|
|
628
|
-
speechEnabled:
|
|
644
|
+
speechEnabled: I,
|
|
629
645
|
speechLanguage: "en-GB",
|
|
630
646
|
speechSubmissionDelay: 1e3,
|
|
631
647
|
slashMenuItems: [],
|
|
632
648
|
menuContent: [],
|
|
633
649
|
introHeading: "Message your agent",
|
|
634
650
|
introBody: "Ask questions, share trip details, or paste a link. The agent will update the checklist as it works.",
|
|
635
|
-
placeholder:
|
|
651
|
+
placeholder: I ? "Message the agent, paste a link, or attach a file…" : "The agent is not accepting messages."
|
|
636
652
|
},
|
|
637
|
-
|
|
653
|
+
s
|
|
638
654
|
) }) }),
|
|
639
|
-
|
|
640
|
-
/* @__PURE__ */
|
|
641
|
-
/* @__PURE__ */
|
|
655
|
+
t === B.stopped && /* @__PURE__ */ l("div", { className: "agent-workspace__notice", role: "status", children: [
|
|
656
|
+
/* @__PURE__ */ a(U, { name: "circle-alert", size: 16, color: "var(--color-semantic-warning-600)" }),
|
|
657
|
+
/* @__PURE__ */ a("span", { children: "You stopped the agent. Its progress is saved in the checklist." })
|
|
642
658
|
] }),
|
|
643
|
-
|
|
644
|
-
/* @__PURE__ */
|
|
645
|
-
/* @__PURE__ */
|
|
659
|
+
t === B.complete && /* @__PURE__ */ l("div", { className: "agent-workspace__notice", role: "status", children: [
|
|
660
|
+
/* @__PURE__ */ a(U, { name: "party-popper", size: 16, color: "var(--color-semantic-success-600)" }),
|
|
661
|
+
/* @__PURE__ */ a("span", { children: "The agent has finished." })
|
|
646
662
|
] })
|
|
647
663
|
] });
|
|
648
|
-
},
|
|
649
|
-
item:
|
|
650
|
-
depth:
|
|
664
|
+
}, Yt = ({
|
|
665
|
+
item: e,
|
|
666
|
+
depth: t,
|
|
651
667
|
canRequestInput: n,
|
|
652
|
-
onAttentionItemClick:
|
|
668
|
+
onAttentionItemClick: s
|
|
653
669
|
}) => {
|
|
654
|
-
const r =
|
|
655
|
-
/* @__PURE__ */
|
|
656
|
-
|
|
670
|
+
const r = ee[e.status], o = e.status.replace(/_/g, "-"), i = e.status === M.hitl && n && s, p = /* @__PURE__ */ l("div", { className: "agent-workspace__task-row", children: [
|
|
671
|
+
/* @__PURE__ */ a(
|
|
672
|
+
U,
|
|
657
673
|
{
|
|
658
674
|
name: r.icon,
|
|
659
675
|
size: 16,
|
|
@@ -662,65 +678,65 @@ const Pn = ({
|
|
|
662
678
|
}
|
|
663
679
|
),
|
|
664
680
|
/* @__PURE__ */ l("div", { className: "agent-workspace__task-content", children: [
|
|
665
|
-
/* @__PURE__ */
|
|
666
|
-
|
|
681
|
+
/* @__PURE__ */ a("span", { className: "agent-workspace__task-label", children: e.task }),
|
|
682
|
+
e.status !== M.complete && e.description && /* @__PURE__ */ a("span", { className: "agent-workspace__task-description", children: e.description })
|
|
667
683
|
] })
|
|
668
684
|
] });
|
|
669
685
|
return /* @__PURE__ */ l(
|
|
670
686
|
"li",
|
|
671
687
|
{
|
|
672
|
-
className:
|
|
673
|
-
"agent-workspace__task--child":
|
|
688
|
+
className: W("agent-workspace__task", `agent-workspace__task--${o}`, {
|
|
689
|
+
"agent-workspace__task--child": t > 0
|
|
674
690
|
}),
|
|
675
691
|
children: [
|
|
676
|
-
i ? /* @__PURE__ */
|
|
692
|
+
i ? /* @__PURE__ */ a(
|
|
677
693
|
"button",
|
|
678
694
|
{
|
|
679
695
|
type: "button",
|
|
680
696
|
className: "agent-workspace__task-button",
|
|
681
|
-
"aria-label": `Provide input for ${
|
|
682
|
-
onClick: () =>
|
|
683
|
-
children:
|
|
697
|
+
"aria-label": `Provide input for ${e.task}`,
|
|
698
|
+
onClick: () => s(e),
|
|
699
|
+
children: p
|
|
684
700
|
}
|
|
685
|
-
) :
|
|
686
|
-
|
|
687
|
-
|
|
701
|
+
) : p,
|
|
702
|
+
e.children && e.children.length > 0 && /* @__PURE__ */ a("ul", { className: "agent-workspace__task-children", children: e.children.map((c) => /* @__PURE__ */ a(
|
|
703
|
+
Yt,
|
|
688
704
|
{
|
|
689
705
|
item: c,
|
|
690
|
-
depth:
|
|
706
|
+
depth: t + 1,
|
|
691
707
|
canRequestInput: n,
|
|
692
|
-
onAttentionItemClick:
|
|
708
|
+
onAttentionItemClick: s
|
|
693
709
|
},
|
|
694
710
|
c.task
|
|
695
711
|
)) })
|
|
696
712
|
]
|
|
697
713
|
}
|
|
698
714
|
);
|
|
699
|
-
},
|
|
700
|
-
items:
|
|
701
|
-
ariaLabel:
|
|
715
|
+
}, Xe = ({
|
|
716
|
+
items: e,
|
|
717
|
+
ariaLabel: t,
|
|
702
718
|
canRequestInput: n,
|
|
703
|
-
onAttentionItemClick:
|
|
704
|
-
}) => /* @__PURE__ */
|
|
705
|
-
|
|
719
|
+
onAttentionItemClick: s
|
|
720
|
+
}) => /* @__PURE__ */ a("ul", { className: "agent-workspace__task-list", "aria-label": t, children: e.map((r) => /* @__PURE__ */ a(
|
|
721
|
+
Yt,
|
|
706
722
|
{
|
|
707
723
|
item: r,
|
|
708
724
|
depth: 0,
|
|
709
725
|
canRequestInput: n,
|
|
710
|
-
onAttentionItemClick:
|
|
726
|
+
onAttentionItemClick: s
|
|
711
727
|
},
|
|
712
728
|
r.task
|
|
713
|
-
)) }),
|
|
714
|
-
checklist:
|
|
715
|
-
isLoading:
|
|
729
|
+
)) }), Zn = ({
|
|
730
|
+
checklist: e,
|
|
731
|
+
isLoading: t,
|
|
716
732
|
error: n,
|
|
717
|
-
phase:
|
|
733
|
+
phase: s,
|
|
718
734
|
canRequestInput: r,
|
|
719
735
|
onAttentionItemClick: o
|
|
720
736
|
}) => {
|
|
721
737
|
const i = Y(
|
|
722
|
-
() =>
|
|
723
|
-
[
|
|
738
|
+
() => e ? Vt(e) : null,
|
|
739
|
+
[e]
|
|
724
740
|
);
|
|
725
741
|
return /* @__PURE__ */ l(
|
|
726
742
|
"section",
|
|
@@ -728,27 +744,27 @@ const Pn = ({
|
|
|
728
744
|
className: "agent-workspace__panel agent-workspace__panel--checklist",
|
|
729
745
|
"aria-label": "Checklist",
|
|
730
746
|
children: [
|
|
731
|
-
/* @__PURE__ */
|
|
732
|
-
/* @__PURE__ */
|
|
733
|
-
|
|
734
|
-
/* @__PURE__ */
|
|
735
|
-
|
|
747
|
+
/* @__PURE__ */ a("div", { className: "agent-workspace__panel-header", children: /* @__PURE__ */ a(be, { level: 4, children: "Checklist" }) }),
|
|
748
|
+
/* @__PURE__ */ a("div", { className: "agent-workspace__panel-body", "aria-live": "polite", children: /* @__PURE__ */ l(tt, { children: [
|
|
749
|
+
t && /* @__PURE__ */ l("div", { className: "agent-workspace__loading", children: [
|
|
750
|
+
/* @__PURE__ */ a(
|
|
751
|
+
U,
|
|
736
752
|
{
|
|
737
753
|
name: "loader",
|
|
738
754
|
size: 16,
|
|
739
755
|
color: "var(--color-brand-600)",
|
|
740
756
|
className: "agent-workspace__task-icon--spinning",
|
|
741
|
-
screenReaderText:
|
|
757
|
+
screenReaderText: Se
|
|
742
758
|
}
|
|
743
759
|
),
|
|
744
|
-
/* @__PURE__ */
|
|
760
|
+
/* @__PURE__ */ a("span", { children: Se })
|
|
745
761
|
] }),
|
|
746
|
-
!
|
|
747
|
-
!
|
|
762
|
+
!t && n && /* @__PURE__ */ a("p", { className: "agent-workspace__error", role: "alert", children: n }),
|
|
763
|
+
!t && !n && i && /* @__PURE__ */ l(fe, { children: [
|
|
748
764
|
i.needsInput.length > 0 && /* @__PURE__ */ l("div", { className: "agent-workspace__task-group", children: [
|
|
749
|
-
/* @__PURE__ */
|
|
750
|
-
/* @__PURE__ */
|
|
751
|
-
|
|
765
|
+
/* @__PURE__ */ a("p", { className: "agent-workspace__task-group-label", children: "Needs your input" }),
|
|
766
|
+
/* @__PURE__ */ a(
|
|
767
|
+
Xe,
|
|
752
768
|
{
|
|
753
769
|
items: i.needsInput,
|
|
754
770
|
ariaLabel: "Tasks needing your input",
|
|
@@ -757,16 +773,56 @@ const Pn = ({
|
|
|
757
773
|
}
|
|
758
774
|
)
|
|
759
775
|
] }),
|
|
760
|
-
i.
|
|
776
|
+
i.complete.length > 0 && /* @__PURE__ */ l(
|
|
761
777
|
"div",
|
|
762
778
|
{
|
|
763
|
-
className:
|
|
779
|
+
className: W("agent-workspace__task-group", {
|
|
764
780
|
"agent-workspace__task-group--following": i.needsInput.length > 0
|
|
765
781
|
}),
|
|
766
782
|
children: [
|
|
767
|
-
i.needsInput.length > 0 && /* @__PURE__ */
|
|
768
|
-
/* @__PURE__ */
|
|
769
|
-
|
|
783
|
+
(i.needsInput.length > 0 || i.failed.length > 0 || i.tasks.length > 0) && /* @__PURE__ */ a("p", { className: "agent-workspace__task-group-label", children: "Completed" }),
|
|
784
|
+
/* @__PURE__ */ a(
|
|
785
|
+
Xe,
|
|
786
|
+
{
|
|
787
|
+
items: i.complete,
|
|
788
|
+
ariaLabel: "Completed tasks",
|
|
789
|
+
canRequestInput: r,
|
|
790
|
+
onAttentionItemClick: o
|
|
791
|
+
}
|
|
792
|
+
)
|
|
793
|
+
]
|
|
794
|
+
}
|
|
795
|
+
),
|
|
796
|
+
i.failed.length > 0 && /* @__PURE__ */ l(
|
|
797
|
+
"div",
|
|
798
|
+
{
|
|
799
|
+
className: W("agent-workspace__task-group", {
|
|
800
|
+
"agent-workspace__task-group--following": i.needsInput.length > 0 || i.complete.length > 0
|
|
801
|
+
}),
|
|
802
|
+
children: [
|
|
803
|
+
(i.needsInput.length > 0 || i.complete.length > 0 || i.tasks.length > 0) && /* @__PURE__ */ a("p", { className: "agent-workspace__task-group-label", children: "Failed" }),
|
|
804
|
+
/* @__PURE__ */ a(
|
|
805
|
+
Xe,
|
|
806
|
+
{
|
|
807
|
+
items: i.failed,
|
|
808
|
+
ariaLabel: "Failed tasks",
|
|
809
|
+
canRequestInput: r,
|
|
810
|
+
onAttentionItemClick: o
|
|
811
|
+
}
|
|
812
|
+
)
|
|
813
|
+
]
|
|
814
|
+
}
|
|
815
|
+
),
|
|
816
|
+
i.tasks.length > 0 && /* @__PURE__ */ l(
|
|
817
|
+
"div",
|
|
818
|
+
{
|
|
819
|
+
className: W("agent-workspace__task-group", {
|
|
820
|
+
"agent-workspace__task-group--following": i.needsInput.length > 0 || i.complete.length > 0 || i.failed.length > 0
|
|
821
|
+
}),
|
|
822
|
+
children: [
|
|
823
|
+
(i.needsInput.length > 0 || i.complete.length > 0 || i.failed.length > 0) && /* @__PURE__ */ a("p", { className: "agent-workspace__task-group-label", children: "Working on" }),
|
|
824
|
+
/* @__PURE__ */ a(
|
|
825
|
+
Xe,
|
|
770
826
|
{
|
|
771
827
|
items: i.tasks,
|
|
772
828
|
ariaLabel: "Agent tasks",
|
|
@@ -778,42 +834,42 @@ const Pn = ({
|
|
|
778
834
|
}
|
|
779
835
|
)
|
|
780
836
|
] }),
|
|
781
|
-
!
|
|
837
|
+
!t && !n && (!i || i.needsInput.length === 0 && i.complete.length === 0 && i.failed.length === 0 && i.tasks.length === 0) && /* @__PURE__ */ a("p", { className: "agent-workspace__empty", children: s === B.briefing ? "Tasks will appear here once the agent starts." : "No tasks to display." })
|
|
782
838
|
] }) })
|
|
783
839
|
]
|
|
784
840
|
}
|
|
785
841
|
);
|
|
786
|
-
},
|
|
787
|
-
resource:
|
|
788
|
-
html:
|
|
842
|
+
}, Qn = ({
|
|
843
|
+
resource: e,
|
|
844
|
+
html: t,
|
|
789
845
|
isLoading: n,
|
|
790
|
-
error:
|
|
846
|
+
error: s,
|
|
791
847
|
onClose: r
|
|
792
848
|
}) => {
|
|
793
|
-
|
|
794
|
-
if (!
|
|
849
|
+
H(() => {
|
|
850
|
+
if (!e)
|
|
795
851
|
return;
|
|
796
|
-
const i =
|
|
797
|
-
return
|
|
852
|
+
const i = Ye.removeSlideover;
|
|
853
|
+
return Ye.removeSlideover = () => {
|
|
798
854
|
i(), r();
|
|
799
855
|
}, () => {
|
|
800
|
-
|
|
856
|
+
Ye.removeSlideover = i;
|
|
801
857
|
};
|
|
802
|
-
}, [
|
|
803
|
-
if (!
|
|
858
|
+
}, [e, r]), H(() => {
|
|
859
|
+
if (!e)
|
|
804
860
|
return;
|
|
805
|
-
const i = (
|
|
806
|
-
|
|
861
|
+
const i = (p) => {
|
|
862
|
+
p.key === "Escape" && Ye.removeSlideover();
|
|
807
863
|
};
|
|
808
864
|
return window.addEventListener("keydown", i), () => window.removeEventListener("keydown", i);
|
|
809
|
-
}, [
|
|
810
|
-
const o = Y(() =>
|
|
865
|
+
}, [e]);
|
|
866
|
+
const o = Y(() => e ? [
|
|
811
867
|
{
|
|
812
868
|
centerHeaderText: !1,
|
|
813
869
|
children: /* @__PURE__ */ l("div", { className: "resource-preview-slideover__body", children: [
|
|
814
870
|
n && /* @__PURE__ */ l("div", { className: "resource-preview-slideover__status", children: [
|
|
815
|
-
/* @__PURE__ */
|
|
816
|
-
|
|
871
|
+
/* @__PURE__ */ a(
|
|
872
|
+
U,
|
|
817
873
|
{
|
|
818
874
|
name: "loader",
|
|
819
875
|
size: 16,
|
|
@@ -822,53 +878,58 @@ const Pn = ({
|
|
|
822
878
|
screenReaderText: "Loading document"
|
|
823
879
|
}
|
|
824
880
|
),
|
|
825
|
-
/* @__PURE__ */
|
|
881
|
+
/* @__PURE__ */ a("span", { children: "Loading document…" })
|
|
826
882
|
] }),
|
|
827
|
-
!n &&
|
|
828
|
-
!n && !
|
|
883
|
+
!n && s && /* @__PURE__ */ a("p", { className: "resource-preview-slideover__error", role: "alert", children: s }),
|
|
884
|
+
!n && !s && t !== null && /* @__PURE__ */ a(
|
|
829
885
|
"iframe",
|
|
830
886
|
{
|
|
831
887
|
className: "resource-preview-slideover__frame",
|
|
832
|
-
title:
|
|
888
|
+
title: e.title,
|
|
833
889
|
sandbox: "",
|
|
834
|
-
srcDoc:
|
|
890
|
+
srcDoc: t
|
|
835
891
|
}
|
|
836
892
|
)
|
|
837
893
|
] })
|
|
838
894
|
}
|
|
839
|
-
] : [], [
|
|
840
|
-
return /* @__PURE__ */
|
|
841
|
-
},
|
|
842
|
-
[
|
|
895
|
+
] : [], [e, t, n, s]);
|
|
896
|
+
return /* @__PURE__ */ a("div", { className: "resource-preview-slideover", children: /* @__PURE__ */ a(vn, { slideovers: o }) });
|
|
897
|
+
}, ea = {
|
|
898
|
+
[he.mis_record]: {
|
|
843
899
|
icon: "table",
|
|
844
900
|
label: "Arbor MIS",
|
|
845
901
|
color: "var(--color-brand-600)"
|
|
846
902
|
},
|
|
847
|
-
[
|
|
903
|
+
[he.document_html]: {
|
|
848
904
|
icon: "file",
|
|
849
905
|
label: "Document",
|
|
850
906
|
color: "var(--color-semantic-caution-800)"
|
|
851
907
|
},
|
|
852
|
-
[
|
|
908
|
+
[he.file]: {
|
|
853
909
|
icon: "file",
|
|
854
910
|
label: "File",
|
|
855
911
|
color: "var(--color-semantic-caution-800)"
|
|
856
912
|
},
|
|
857
|
-
[
|
|
913
|
+
[he.user_file]: {
|
|
914
|
+
icon: "upload",
|
|
915
|
+
label: "File upload",
|
|
916
|
+
color: "var(--color-semantic-caution-800)"
|
|
917
|
+
},
|
|
918
|
+
[he.workflow]: {
|
|
858
919
|
icon: "list-tree",
|
|
859
920
|
label: "Workflow",
|
|
860
921
|
color: "var(--color-semantic-warning-700)"
|
|
861
922
|
},
|
|
862
|
-
[
|
|
923
|
+
[he.link]: {
|
|
863
924
|
icon: "link",
|
|
864
925
|
label: "Link",
|
|
865
926
|
color: "var(--color-semantic-info-700)"
|
|
866
927
|
}
|
|
867
|
-
},
|
|
868
|
-
resources:
|
|
869
|
-
isLoading:
|
|
928
|
+
}, ta = ({
|
|
929
|
+
resources: e,
|
|
930
|
+
isLoading: t = !1,
|
|
870
931
|
error: n = null,
|
|
871
|
-
onOpenResource:
|
|
932
|
+
onOpenResource: s
|
|
872
933
|
}) => /* @__PURE__ */ l(
|
|
873
934
|
"section",
|
|
874
935
|
{
|
|
@@ -876,13 +937,13 @@ const Pn = ({
|
|
|
876
937
|
"aria-label": "Resources",
|
|
877
938
|
children: [
|
|
878
939
|
/* @__PURE__ */ l("div", { className: "agent-workspace__panel-header", children: [
|
|
879
|
-
/* @__PURE__ */
|
|
880
|
-
/* @__PURE__ */
|
|
940
|
+
/* @__PURE__ */ a(be, { level: 4, children: "Resources" }),
|
|
941
|
+
/* @__PURE__ */ a("span", { className: "agent-workspace__panel-count", children: e.length })
|
|
881
942
|
] }),
|
|
882
|
-
/* @__PURE__ */
|
|
883
|
-
|
|
884
|
-
/* @__PURE__ */
|
|
885
|
-
|
|
943
|
+
/* @__PURE__ */ a("div", { className: "agent-workspace__panel-body", "aria-live": "polite", children: /* @__PURE__ */ l(tt, { children: [
|
|
944
|
+
t && /* @__PURE__ */ l("div", { className: "agent-workspace__loading", children: [
|
|
945
|
+
/* @__PURE__ */ a(
|
|
946
|
+
U,
|
|
886
947
|
{
|
|
887
948
|
name: "loader",
|
|
888
949
|
size: 16,
|
|
@@ -891,51 +952,51 @@ const Pn = ({
|
|
|
891
952
|
screenReaderText: "Loading resources"
|
|
892
953
|
}
|
|
893
954
|
),
|
|
894
|
-
/* @__PURE__ */
|
|
955
|
+
/* @__PURE__ */ a("span", { children: "Loading resources…" })
|
|
895
956
|
] }),
|
|
896
|
-
!
|
|
897
|
-
!
|
|
898
|
-
const o =
|
|
899
|
-
return /* @__PURE__ */
|
|
957
|
+
!t && n && /* @__PURE__ */ a("p", { className: "agent-workspace__error", role: "alert", children: n }),
|
|
958
|
+
!t && !n && e.length > 0 && /* @__PURE__ */ a("ul", { className: "agent-workspace__resource-list", "aria-label": "Agent resources", children: e.map((r) => {
|
|
959
|
+
const o = ea[r.type], i = r.misRecordUrl;
|
|
960
|
+
return /* @__PURE__ */ a("li", { className: "agent-workspace__resource", children: i ? /* @__PURE__ */ a(
|
|
900
961
|
"a",
|
|
901
962
|
{
|
|
902
963
|
className: "agent-workspace__resource-card",
|
|
903
964
|
href: i,
|
|
904
965
|
target: "_blank",
|
|
905
966
|
rel: "noreferrer",
|
|
906
|
-
onClick: (
|
|
907
|
-
|
|
967
|
+
onClick: (p) => {
|
|
968
|
+
p.preventDefault(), s(r);
|
|
908
969
|
},
|
|
909
|
-
children: /* @__PURE__ */
|
|
970
|
+
children: /* @__PURE__ */ a(Lt, { resource: r, config: o, external: !0 })
|
|
910
971
|
}
|
|
911
|
-
) : /* @__PURE__ */
|
|
972
|
+
) : /* @__PURE__ */ a(
|
|
912
973
|
"button",
|
|
913
974
|
{
|
|
914
975
|
type: "button",
|
|
915
976
|
className: "agent-workspace__resource-card",
|
|
916
|
-
onClick: () =>
|
|
917
|
-
children: /* @__PURE__ */
|
|
977
|
+
onClick: () => s(r),
|
|
978
|
+
children: /* @__PURE__ */ a(Lt, { resource: r, config: o })
|
|
918
979
|
}
|
|
919
980
|
) }, r.id);
|
|
920
981
|
}) }),
|
|
921
|
-
!
|
|
982
|
+
!t && !n && e.length === 0 && /* @__PURE__ */ a("p", { className: "agent-workspace__empty", children: "No resources yet." })
|
|
922
983
|
] }) })
|
|
923
984
|
]
|
|
924
985
|
}
|
|
925
|
-
),
|
|
926
|
-
/* @__PURE__ */
|
|
986
|
+
), Lt = ({ resource: e, config: t, external: n = !1 }) => /* @__PURE__ */ l(fe, { children: [
|
|
987
|
+
/* @__PURE__ */ a(
|
|
927
988
|
"span",
|
|
928
989
|
{
|
|
929
|
-
className: `agent-workspace__resource-icon agent-workspace__resource-icon--${
|
|
930
|
-
children: /* @__PURE__ */
|
|
990
|
+
className: `agent-workspace__resource-icon agent-workspace__resource-icon--${e.type}`,
|
|
991
|
+
children: /* @__PURE__ */ a(U, { name: t.icon, size: 16, color: t.color, screenReaderText: `${t.label}:` })
|
|
931
992
|
}
|
|
932
993
|
),
|
|
933
|
-
/* @__PURE__ */
|
|
934
|
-
/* @__PURE__ */
|
|
935
|
-
/* @__PURE__ */
|
|
994
|
+
/* @__PURE__ */ a("span", { className: "agent-workspace__resource-content", children: /* @__PURE__ */ l("span", { className: "agent-workspace__resource-top", children: [
|
|
995
|
+
/* @__PURE__ */ a("span", { className: "agent-workspace__resource-name", children: e.title }),
|
|
996
|
+
/* @__PURE__ */ a("span", { className: `agent-workspace__resource-badge agent-workspace__resource-badge--${e.type}`, children: t.label })
|
|
936
997
|
] }) }),
|
|
937
|
-
n && /* @__PURE__ */
|
|
938
|
-
|
|
998
|
+
n && /* @__PURE__ */ a(
|
|
999
|
+
U,
|
|
939
1000
|
{
|
|
940
1001
|
name: "external-link",
|
|
941
1002
|
size: 12,
|
|
@@ -944,686 +1005,754 @@ const Pn = ({
|
|
|
944
1005
|
className: "agent-workspace__resource-open"
|
|
945
1006
|
}
|
|
946
1007
|
)
|
|
947
|
-
] }),
|
|
948
|
-
const
|
|
949
|
-
return Number.isFinite(
|
|
950
|
-
},
|
|
1008
|
+
] }), Ut = (e) => {
|
|
1009
|
+
const t = Date.parse(e);
|
|
1010
|
+
return Number.isFinite(t) ? t : 0;
|
|
1011
|
+
}, na = new Intl.DateTimeFormat("en-GB", {
|
|
951
1012
|
day: "numeric",
|
|
952
1013
|
month: "long",
|
|
953
1014
|
year: "numeric",
|
|
954
1015
|
hour: "numeric",
|
|
955
1016
|
minute: "2-digit"
|
|
956
|
-
}),
|
|
957
|
-
const
|
|
958
|
-
return Number.isFinite(
|
|
959
|
-
},
|
|
1017
|
+
}), ut = (e) => {
|
|
1018
|
+
const t = new Date(e);
|
|
1019
|
+
return Number.isFinite(t.getTime()) ? na.format(t) : e;
|
|
1020
|
+
}, Pt = (e) => e.replace(
|
|
960
1021
|
/[A-Za-z0-9]+(?:[_-][A-Za-z0-9]+)+/g,
|
|
961
|
-
(
|
|
962
|
-
),
|
|
1022
|
+
(t) => t.split(/[_-]/).map((n) => n.charAt(0).toUpperCase() + n.slice(1).toLowerCase()).join(" ")
|
|
1023
|
+
), xt = (e) => {
|
|
1024
|
+
const n = e.replace(
|
|
1025
|
+
/[A-Za-z0-9]+(?:[_-][A-Za-z0-9]+)+/g,
|
|
1026
|
+
(s) => s.split(/[_-]/).map((r) => r.toLowerCase()).join(" ")
|
|
1027
|
+
).toLowerCase();
|
|
1028
|
+
return n && n.charAt(0).toUpperCase() + n.slice(1);
|
|
1029
|
+
}, aa = 60 * 60 * 1e3, Xt = 60 * 60 * 1e3, Me = 24 * Xt, mt = 7 * Me, sa = (e) => e.type !== "message-sent", ra = (e, t) => {
|
|
1030
|
+
const n = e.filter(sa).map((r, o) => ({
|
|
1031
|
+
kind: "action",
|
|
1032
|
+
id: `action-${r.timestamp}-${o}`,
|
|
1033
|
+
timestampMs: Ut(r.timestamp),
|
|
1034
|
+
item: r
|
|
1035
|
+
})), s = t.map((r) => ({
|
|
1036
|
+
kind: "chat",
|
|
1037
|
+
id: r.sessionId,
|
|
1038
|
+
timestampMs: Ut(r.timestamp),
|
|
1039
|
+
session: r
|
|
1040
|
+
}));
|
|
1041
|
+
return [...n, ...s].sort(
|
|
1042
|
+
(r, o) => r.timestampMs - o.timestampMs || r.id.localeCompare(o.id)
|
|
1043
|
+
);
|
|
1044
|
+
}, ia = (e) => e >= mt ? "weeks" : e >= Me ? "days" : "hours", oa = (e) => {
|
|
1045
|
+
if (e < Me) {
|
|
1046
|
+
const s = Math.max(1, Math.round(e / Xt));
|
|
1047
|
+
return s === 1 ? "1 hour later" : `${s} hours later`;
|
|
1048
|
+
}
|
|
1049
|
+
if (e < mt) {
|
|
1050
|
+
const s = Math.max(1, Math.round(e / Me));
|
|
1051
|
+
return s === 1 ? "1 day later" : `${s} days later`;
|
|
1052
|
+
}
|
|
1053
|
+
const t = Math.max(1, Math.round(e / mt));
|
|
1054
|
+
if (t < 5)
|
|
1055
|
+
return t === 1 ? "1 week later" : `${t} weeks later`;
|
|
1056
|
+
const n = Math.max(1, Math.round(e / (30 * Me)));
|
|
1057
|
+
return n === 1 ? "1 month later" : `${n} months later`;
|
|
1058
|
+
}, la = (e, t = aa) => {
|
|
963
1059
|
if (e.length === 0)
|
|
964
|
-
return
|
|
965
|
-
const n =
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
(i, d) => i.leftPercent - d.leftPercent || i.timestampMs - d.timestampMs || i.id.localeCompare(d.id)
|
|
976
|
-
), o = [];
|
|
977
|
-
for (const i of r) {
|
|
978
|
-
const d = o[o.length - 1];
|
|
979
|
-
d && i.leftPercent - d[d.length - 1].leftPercent < e ? d.push(i) : o.push([i]);
|
|
980
|
-
}
|
|
981
|
-
for (const i of o) {
|
|
982
|
-
const d = [...i].sort(
|
|
983
|
-
(v, f) => v.timestampMs - f.timestampMs || v.id.localeCompare(f.id)
|
|
984
|
-
), c = (d.length - 1) / 2;
|
|
985
|
-
d.forEach((v, f) => {
|
|
986
|
-
a.set(v.id, (f - c) * n);
|
|
987
|
-
});
|
|
1060
|
+
return [];
|
|
1061
|
+
const n = [e[0]];
|
|
1062
|
+
for (let s = 1; s < e.length; s += 1) {
|
|
1063
|
+
const r = e[s - 1], o = e[s], i = o.timestampMs - r.timestampMs;
|
|
1064
|
+
i >= t && n.push({
|
|
1065
|
+
kind: "gap",
|
|
1066
|
+
id: `gap-${r.id}-${o.id}`,
|
|
1067
|
+
durationMs: i,
|
|
1068
|
+
label: oa(i),
|
|
1069
|
+
size: ia(i)
|
|
1070
|
+
}), n.push(o);
|
|
988
1071
|
}
|
|
989
|
-
return
|
|
990
|
-
},
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
}), Gn = (t) => t.type !== "message-sent", qn = ({
|
|
994
|
-
timeline: t,
|
|
995
|
-
isLoading: e,
|
|
1072
|
+
return n;
|
|
1073
|
+
}, ca = (e) => e.type === "checklist-updated" ? "checklist" : e.type === "status-transition" ? "status" : "note", da = ({
|
|
1074
|
+
timeline: e,
|
|
1075
|
+
isLoading: t,
|
|
996
1076
|
error: n,
|
|
997
|
-
onOpenChatSession:
|
|
1077
|
+
onOpenChatSession: s
|
|
998
1078
|
}) => {
|
|
999
|
-
const r = (
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
!e && !n && !i && /* @__PURE__ */ l("div", { className: "agent-timeline", children: [
|
|
1021
|
-
/* @__PURE__ */ s("div", { className: "agent-timeline__track", "aria-hidden": "true" }),
|
|
1022
|
-
/* @__PURE__ */ l(
|
|
1023
|
-
"div",
|
|
1024
|
-
{
|
|
1025
|
-
className: "agent-timeline__station agent-timeline__station--terminus",
|
|
1026
|
-
style: Ke(Pe(0, d)),
|
|
1027
|
-
children: [
|
|
1028
|
-
/* @__PURE__ */ s(
|
|
1029
|
-
"span",
|
|
1030
|
-
{
|
|
1031
|
-
className: "agent-timeline__station-node agent-timeline__station-node--terminus",
|
|
1032
|
-
"aria-hidden": "true",
|
|
1033
|
-
children: /* @__PURE__ */ s(P, { name: "arrow-right-from-line", size: 16, color: "currentColor" })
|
|
1034
|
-
}
|
|
1035
|
-
),
|
|
1036
|
-
/* @__PURE__ */ s("span", { className: "agent-timeline__terminus-label", children: "Start" })
|
|
1037
|
-
]
|
|
1038
|
-
}
|
|
1039
|
-
),
|
|
1040
|
-
r.map((h, u) => {
|
|
1041
|
-
const x = `action-${h.timestamp}-${u}`, w = c[u].leftPercent, b = h.type === "checklist-updated", S = h.type === "status-transition", D = b ? "checklist" : S ? "status" : "note";
|
|
1042
|
-
return /* @__PURE__ */ l(
|
|
1043
|
-
"div",
|
|
1044
|
-
{
|
|
1045
|
-
className: `agent-timeline__station agent-timeline__station--${D}`,
|
|
1046
|
-
style: Ke(w, f.get(x) ?? 0),
|
|
1047
|
-
children: [
|
|
1048
|
-
/* @__PURE__ */ l(
|
|
1049
|
-
"button",
|
|
1050
|
-
{
|
|
1051
|
-
type: "button",
|
|
1052
|
-
className: `agent-timeline__station-node agent-timeline__station-node--${D}`,
|
|
1053
|
-
"aria-label": `${Je(h.type)}: ${Je(h.entry)}`,
|
|
1054
|
-
children: [
|
|
1055
|
-
b && /* @__PURE__ */ s(P, { name: "check-solid", size: 16, color: "currentColor" }),
|
|
1056
|
-
S && /* @__PURE__ */ s(P, { name: "iteration-ccw", size: 16, color: "currentColor" })
|
|
1057
|
-
]
|
|
1058
|
-
}
|
|
1059
|
-
),
|
|
1060
|
-
/* @__PURE__ */ l("div", { className: "agent-timeline__pill", role: "tooltip", children: [
|
|
1061
|
-
/* @__PURE__ */ s("strong", { className: "agent-timeline__pill-type", children: Je(h.type) }),
|
|
1062
|
-
/* @__PURE__ */ s("span", { className: "agent-timeline__pill-entry", children: Je(h.entry) }),
|
|
1063
|
-
/* @__PURE__ */ s("span", { className: "agent-timeline__pill-entry", children: ct(h.timestamp) })
|
|
1064
|
-
] })
|
|
1065
|
-
]
|
|
1066
|
-
},
|
|
1067
|
-
x
|
|
1068
|
-
);
|
|
1069
|
-
}),
|
|
1070
|
-
/* @__PURE__ */ l(
|
|
1079
|
+
const r = (e == null ? void 0 : e.actionLog) ?? [], o = (e == null ? void 0 : e.chatSessions) ?? [], i = ra(r, o), p = la(i), c = !t && !n && i.length === 0;
|
|
1080
|
+
return /* @__PURE__ */ l("section", { className: "agent-workspace__timeline", "aria-label": "Agent timeline", children: [
|
|
1081
|
+
t && /* @__PURE__ */ a("p", { className: "agent-workspace__timeline-status", role: "status", children: "Loading timeline…" }),
|
|
1082
|
+
n && /* @__PURE__ */ a("p", { className: "agent-workspace__timeline-status", role: "alert", children: n || Wt }),
|
|
1083
|
+
c && /* @__PURE__ */ a("p", { className: "agent-workspace__timeline-status", role: "status", children: "No timeline activity yet." }),
|
|
1084
|
+
!t && !n && !c && /* @__PURE__ */ l("div", { className: "agent-timeline", children: [
|
|
1085
|
+
/* @__PURE__ */ a("div", { className: "agent-timeline__track", "aria-hidden": "true" }),
|
|
1086
|
+
/* @__PURE__ */ l("div", { className: "agent-timeline__station agent-timeline__station--terminus", children: [
|
|
1087
|
+
/* @__PURE__ */ a("span", { className: "agent-timeline__station-rail", children: /* @__PURE__ */ a(
|
|
1088
|
+
"span",
|
|
1089
|
+
{
|
|
1090
|
+
className: "agent-timeline__station-node agent-timeline__station-node--terminus",
|
|
1091
|
+
"aria-hidden": "true",
|
|
1092
|
+
children: /* @__PURE__ */ a(U, { name: "arrow-right-from-line", size: 16, color: "currentColor" })
|
|
1093
|
+
}
|
|
1094
|
+
) }),
|
|
1095
|
+
/* @__PURE__ */ a("div", { className: "agent-timeline__label", children: /* @__PURE__ */ a("strong", { className: "agent-timeline__label-type", children: "Start" }) })
|
|
1096
|
+
] }),
|
|
1097
|
+
p.map((g) => {
|
|
1098
|
+
if (g.kind === "gap")
|
|
1099
|
+
return /* @__PURE__ */ l(
|
|
1071
1100
|
"div",
|
|
1072
1101
|
{
|
|
1073
|
-
className:
|
|
1074
|
-
|
|
1102
|
+
className: `agent-timeline__gap agent-timeline__gap--${g.size}`,
|
|
1103
|
+
role: "separator",
|
|
1104
|
+
"aria-label": g.label,
|
|
1075
1105
|
children: [
|
|
1076
|
-
/* @__PURE__ */
|
|
1077
|
-
|
|
1078
|
-
{
|
|
1079
|
-
className: "agent-timeline__station-node agent-timeline__station-node--terminus",
|
|
1080
|
-
"aria-hidden": "true",
|
|
1081
|
-
children: /* @__PURE__ */ s(P, { name: "flag", size: 16, color: "currentColor" })
|
|
1082
|
-
}
|
|
1083
|
-
),
|
|
1084
|
-
/* @__PURE__ */ s("span", { className: "agent-timeline__terminus-label", children: "Finish" })
|
|
1106
|
+
/* @__PURE__ */ a("span", { className: "agent-timeline__gap-rail", "aria-hidden": "true", children: /* @__PURE__ */ a("span", { className: "agent-timeline__gap-dot" }) }),
|
|
1107
|
+
/* @__PURE__ */ a("span", { className: "agent-timeline__gap-label", children: g.label })
|
|
1085
1108
|
]
|
|
1086
|
-
}
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1109
|
+
},
|
|
1110
|
+
g.id
|
|
1111
|
+
);
|
|
1112
|
+
if (g.kind === "chat")
|
|
1113
|
+
return /* @__PURE__ */ l("div", { className: "agent-timeline__chat-station", children: [
|
|
1114
|
+
/* @__PURE__ */ a(
|
|
1115
|
+
"button",
|
|
1092
1116
|
{
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
)
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1117
|
+
type: "button",
|
|
1118
|
+
className: "agent-timeline__chat-node",
|
|
1119
|
+
"aria-label": `Open chat session from ${ut(
|
|
1120
|
+
g.session.timestamp
|
|
1121
|
+
)}`,
|
|
1122
|
+
onClick: () => s(g.session.sessionId),
|
|
1123
|
+
children: /* @__PURE__ */ a(U, { name: "sparkles", size: 16, color: "currentColor" })
|
|
1124
|
+
}
|
|
1125
|
+
),
|
|
1126
|
+
/* @__PURE__ */ l("div", { className: "agent-timeline__label", children: [
|
|
1127
|
+
/* @__PURE__ */ a("strong", { className: "agent-timeline__label-type", children: "Chat session" }),
|
|
1128
|
+
/* @__PURE__ */ a("span", { className: "agent-timeline__label-time", children: ut(g.session.timestamp) })
|
|
1129
|
+
] })
|
|
1130
|
+
] }, g.id);
|
|
1131
|
+
const { item: m } = g, N = ca(m), y = N === "checklist", I = N === "status";
|
|
1132
|
+
return /* @__PURE__ */ l(
|
|
1133
|
+
"div",
|
|
1134
|
+
{
|
|
1135
|
+
className: `agent-timeline__station agent-timeline__station--${N}`,
|
|
1136
|
+
children: [
|
|
1137
|
+
/* @__PURE__ */ a("span", { className: "agent-timeline__station-rail", children: /* @__PURE__ */ l(
|
|
1138
|
+
"button",
|
|
1139
|
+
{
|
|
1140
|
+
type: "button",
|
|
1141
|
+
className: `agent-timeline__station-node agent-timeline__station-node--${N}`,
|
|
1142
|
+
"aria-label": `${Pt(m.type)}: ${xt(m.entry)}`,
|
|
1143
|
+
children: [
|
|
1144
|
+
y && /* @__PURE__ */ a(U, { name: "check-solid", size: 16, color: "currentColor" }),
|
|
1145
|
+
I && /* @__PURE__ */ a(U, { name: "iteration-ccw", size: 16, color: "currentColor" })
|
|
1146
|
+
]
|
|
1147
|
+
}
|
|
1148
|
+
) }),
|
|
1149
|
+
/* @__PURE__ */ l("div", { className: "agent-timeline__label", children: [
|
|
1150
|
+
/* @__PURE__ */ a("strong", { className: "agent-timeline__label-type", children: Pt(m.type) }),
|
|
1151
|
+
/* @__PURE__ */ a("span", { className: "agent-timeline__label-entry", children: xt(m.entry) }),
|
|
1152
|
+
/* @__PURE__ */ a("span", { className: "agent-timeline__label-time", children: ut(m.timestamp) })
|
|
1153
|
+
] })
|
|
1154
|
+
]
|
|
1155
|
+
},
|
|
1156
|
+
g.id
|
|
1157
|
+
);
|
|
1158
|
+
}),
|
|
1159
|
+
/* @__PURE__ */ l("div", { className: "agent-timeline__station agent-timeline__station--terminus", children: [
|
|
1160
|
+
/* @__PURE__ */ a("span", { className: "agent-timeline__station-rail", children: /* @__PURE__ */ a(
|
|
1161
|
+
"span",
|
|
1162
|
+
{
|
|
1163
|
+
className: "agent-timeline__station-node agent-timeline__station-node--terminus",
|
|
1164
|
+
"aria-hidden": "true",
|
|
1165
|
+
children: /* @__PURE__ */ a(U, { name: "flag", size: 16, color: "currentColor" })
|
|
1166
|
+
}
|
|
1167
|
+
) }),
|
|
1168
|
+
/* @__PURE__ */ a("div", { className: "agent-timeline__label", children: /* @__PURE__ */ a("strong", { className: "agent-timeline__label-type", children: "Finish" }) })
|
|
1169
|
+
] })
|
|
1170
|
+
] })
|
|
1171
|
+
] });
|
|
1172
|
+
}, ga = [
|
|
1123
1173
|
"I'll get the details and come back to you",
|
|
1124
1174
|
"Skip this for now"
|
|
1125
|
-
],
|
|
1175
|
+
], ha = (e) => {
|
|
1126
1176
|
var n;
|
|
1127
|
-
const
|
|
1177
|
+
const t = (n = e.prompt) != null && n.trim() ? e.prompt.trim() : `I need a bit more from you on "${e.task}". ${e.description} What can you tell me?`;
|
|
1128
1178
|
return {
|
|
1129
1179
|
id: `clarification-${Date.now()}`,
|
|
1130
|
-
author:
|
|
1131
|
-
text:
|
|
1132
|
-
followUpPrompts:
|
|
1180
|
+
author: ne.agent,
|
|
1181
|
+
text: t,
|
|
1182
|
+
followUpPrompts: e.clarificationPrompts ?? ga
|
|
1183
|
+
};
|
|
1184
|
+
}, Ae = (e) => ({
|
|
1185
|
+
id: e.id,
|
|
1186
|
+
text: e.text,
|
|
1187
|
+
type: e.author === ne.user ? Sn : e.author === ne.system ? bn : Jt,
|
|
1188
|
+
...e.followUpPrompts ? { followUpPrompts: e.followUpPrompts } : {}
|
|
1189
|
+
}), Dt = "MESSAGE_TYPE_REPOLL", ua = "agentUi:update", Zt = "arbor-agent-", ve = {
|
|
1190
|
+
all: "ALL",
|
|
1191
|
+
checklist: "CHECKLIST",
|
|
1192
|
+
resources: "RESOURCES",
|
|
1193
|
+
chat: "CHAT",
|
|
1194
|
+
timeline: "TIMELINE"
|
|
1195
|
+
}, pa = new Set(Object.values(ve)), ma = (e, t) => `${e.endsWith("-") ? e : `${e}-`}${t}`, _a = (e) => typeof e == "string" && pa.has(e) ? e : ve.all, fa = (e) => {
|
|
1196
|
+
if (!e || typeof e != "object")
|
|
1197
|
+
return null;
|
|
1198
|
+
const t = e;
|
|
1199
|
+
return t.type !== Dt ? null : {
|
|
1200
|
+
type: Dt,
|
|
1201
|
+
target: _a(t.target)
|
|
1133
1202
|
};
|
|
1134
|
-
},
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
}
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1203
|
+
}, va = (e) => {
|
|
1204
|
+
const t = Array.isArray(e) ? e : [e], n = [];
|
|
1205
|
+
for (const s of t) {
|
|
1206
|
+
const r = fa(s);
|
|
1207
|
+
r && n.push(r);
|
|
1208
|
+
}
|
|
1209
|
+
return n;
|
|
1210
|
+
}, wa = ({
|
|
1211
|
+
enabled: e,
|
|
1212
|
+
channelPrefix: t,
|
|
1213
|
+
agentId: n,
|
|
1214
|
+
subscribeToPusher: s,
|
|
1215
|
+
onRepoll: r
|
|
1216
|
+
}) => {
|
|
1217
|
+
const o = le(r), i = t == null ? void 0 : t.trim(), p = !!(e && s && i && n.trim());
|
|
1218
|
+
return H(() => {
|
|
1219
|
+
o.current = r;
|
|
1220
|
+
}, [r]), H(() => {
|
|
1221
|
+
if (!p || !s || !i)
|
|
1222
|
+
return;
|
|
1223
|
+
const c = s(
|
|
1224
|
+
ma(i, n),
|
|
1225
|
+
ua,
|
|
1226
|
+
(g) => {
|
|
1227
|
+
for (const m of va(g))
|
|
1228
|
+
o.current(m.target);
|
|
1229
|
+
}
|
|
1230
|
+
);
|
|
1231
|
+
return () => {
|
|
1232
|
+
c();
|
|
1233
|
+
};
|
|
1234
|
+
}, [p, i, n, s]), p;
|
|
1235
|
+
};
|
|
1236
|
+
class $e extends Error {
|
|
1237
|
+
constructor(t, n, s) {
|
|
1238
|
+
super(s ?? `Agent service request failed (${t})`), this.name = "AgentServiceError", this.status = t, this.detail = n;
|
|
1143
1239
|
}
|
|
1144
1240
|
}
|
|
1145
|
-
const
|
|
1241
|
+
const ya = "/api/v1", F = {
|
|
1146
1242
|
agentDefinitions: "/agent-definitions",
|
|
1147
1243
|
agents: "/agents",
|
|
1148
1244
|
conversations: "/conversations",
|
|
1149
1245
|
tripOptions: "/trip-options",
|
|
1150
1246
|
demoDataset: "/demo/dataset"
|
|
1151
|
-
},
|
|
1247
|
+
}, J = {
|
|
1152
1248
|
GET: "GET",
|
|
1153
1249
|
POST: "POST"
|
|
1154
|
-
},
|
|
1250
|
+
}, ka = {
|
|
1155
1251
|
error: "error"
|
|
1156
|
-
},
|
|
1252
|
+
}, Na = {
|
|
1157
1253
|
user: "user"
|
|
1158
|
-
},
|
|
1254
|
+
}, we = {
|
|
1159
1255
|
acceptJson: "application/json",
|
|
1160
1256
|
acceptHtml: "text/html",
|
|
1161
1257
|
acceptEventStream: "text/event-stream",
|
|
1162
1258
|
contentTypeJson: "application/json",
|
|
1163
1259
|
arborApplicationUrl: "X-Arbor-Application-Url"
|
|
1164
|
-
},
|
|
1165
|
-
switch (
|
|
1166
|
-
case
|
|
1167
|
-
return
|
|
1168
|
-
case
|
|
1169
|
-
return
|
|
1170
|
-
case
|
|
1171
|
-
case
|
|
1172
|
-
case
|
|
1173
|
-
case
|
|
1174
|
-
return
|
|
1260
|
+
}, Aa = 100, Sa = (e) => {
|
|
1261
|
+
switch (e) {
|
|
1262
|
+
case Rt.cancelled:
|
|
1263
|
+
return E.failed;
|
|
1264
|
+
case Rt.archived:
|
|
1265
|
+
return E.complete;
|
|
1266
|
+
case E.hitl:
|
|
1267
|
+
case E.complete:
|
|
1268
|
+
case E.failed:
|
|
1269
|
+
case E["generating-a-response"]:
|
|
1270
|
+
return e;
|
|
1175
1271
|
default:
|
|
1176
|
-
return
|
|
1177
|
-
}
|
|
1178
|
-
},
|
|
1179
|
-
switch (
|
|
1180
|
-
case
|
|
1181
|
-
return
|
|
1182
|
-
case
|
|
1183
|
-
case
|
|
1184
|
-
return
|
|
1185
|
-
case
|
|
1186
|
-
case
|
|
1187
|
-
case
|
|
1188
|
-
case
|
|
1189
|
-
return
|
|
1272
|
+
return E["generating-a-response"];
|
|
1273
|
+
}
|
|
1274
|
+
}, ba = (e) => {
|
|
1275
|
+
switch (e) {
|
|
1276
|
+
case gt.requires_attention:
|
|
1277
|
+
return M.hitl;
|
|
1278
|
+
case gt.in_progress:
|
|
1279
|
+
case gt.available:
|
|
1280
|
+
return M["generating-a-response"];
|
|
1281
|
+
case M.failed:
|
|
1282
|
+
case M.complete:
|
|
1283
|
+
case M.hitl:
|
|
1284
|
+
case M["generating-a-response"]:
|
|
1285
|
+
return e;
|
|
1190
1286
|
default:
|
|
1191
|
-
return
|
|
1192
|
-
}
|
|
1193
|
-
},
|
|
1194
|
-
ref:
|
|
1195
|
-
display_name:
|
|
1196
|
-
agent_intent:
|
|
1197
|
-
description:
|
|
1198
|
-
}),
|
|
1199
|
-
id:
|
|
1200
|
-
name:
|
|
1201
|
-
...
|
|
1202
|
-
}),
|
|
1203
|
-
id:
|
|
1204
|
-
type:
|
|
1205
|
-
title:
|
|
1206
|
-
createdDatetime:
|
|
1207
|
-
lastUpdatedDatetime:
|
|
1208
|
-
misRecordUrl:
|
|
1209
|
-
}),
|
|
1210
|
-
resources:
|
|
1211
|
-
pageNumber:
|
|
1212
|
-
pageSize:
|
|
1213
|
-
totalRecords:
|
|
1214
|
-
}),
|
|
1215
|
-
actionLog: (
|
|
1216
|
-
timestamp:
|
|
1217
|
-
type:
|
|
1218
|
-
entry:
|
|
1219
|
-
origin:
|
|
1287
|
+
return M["generating-a-response"];
|
|
1288
|
+
}
|
|
1289
|
+
}, Qt = (e) => ({
|
|
1290
|
+
ref: e.name,
|
|
1291
|
+
display_name: e.display_name,
|
|
1292
|
+
agent_intent: e.agent_intent ?? "",
|
|
1293
|
+
description: e.description
|
|
1294
|
+
}), _s = (e) => ({
|
|
1295
|
+
id: e.id,
|
|
1296
|
+
name: e.name,
|
|
1297
|
+
...e.has_run_before ? { hasRunBefore: e.has_run_before } : {}
|
|
1298
|
+
}), Ca = new Set(Object.values(he)), Ea = (e) => Ca.has(e) ? e : he.document_html, Ta = (e) => ({
|
|
1299
|
+
id: e.id,
|
|
1300
|
+
type: Ea(e.type),
|
|
1301
|
+
title: e.title,
|
|
1302
|
+
createdDatetime: e.created_datetime,
|
|
1303
|
+
lastUpdatedDatetime: e.last_updated_datetime,
|
|
1304
|
+
misRecordUrl: e.mis_record_url
|
|
1305
|
+
}), Ra = (e) => ({
|
|
1306
|
+
resources: e.resources.map(Ta),
|
|
1307
|
+
pageNumber: e.page_number,
|
|
1308
|
+
pageSize: e.page_size,
|
|
1309
|
+
totalRecords: e.total_records
|
|
1310
|
+
}), Ia = (e) => ({
|
|
1311
|
+
actionLog: (e.action_log ?? []).map((t) => ({
|
|
1312
|
+
timestamp: t.timestamp,
|
|
1313
|
+
type: t.type,
|
|
1314
|
+
entry: t.entry,
|
|
1315
|
+
origin: t.origin
|
|
1220
1316
|
})),
|
|
1221
|
-
chatSessions: (
|
|
1222
|
-
sessionId:
|
|
1223
|
-
timestamp:
|
|
1317
|
+
chatSessions: (e.chat_sessions ?? []).map((t) => ({
|
|
1318
|
+
sessionId: t.session_id,
|
|
1319
|
+
timestamp: t.timestamp
|
|
1224
1320
|
}))
|
|
1225
|
-
}),
|
|
1321
|
+
}), $t = (e) => {
|
|
1226
1322
|
var n;
|
|
1227
|
-
const
|
|
1323
|
+
const t = e.invocation_id ?? e.id;
|
|
1228
1324
|
return {
|
|
1229
|
-
id:
|
|
1230
|
-
invocation_id:
|
|
1231
|
-
agent_definition_ref:
|
|
1232
|
-
...
|
|
1233
|
-
invocation_name: ((n =
|
|
1234
|
-
application_id:
|
|
1235
|
-
...
|
|
1236
|
-
created_by:
|
|
1237
|
-
status:
|
|
1238
|
-
context_ref:
|
|
1239
|
-
checklist_ref:
|
|
1325
|
+
id: e.id,
|
|
1326
|
+
invocation_id: t,
|
|
1327
|
+
agent_definition_ref: e.agent_definition_ref,
|
|
1328
|
+
...e.agent_intent ? { agent_intent: e.agent_intent } : {},
|
|
1329
|
+
invocation_name: ((n = e.invocation_name) == null ? void 0 : n.trim()) || e.agent_definition_ref,
|
|
1330
|
+
application_id: e.application_id,
|
|
1331
|
+
...e.application_name ? { application_name: e.application_name } : {},
|
|
1332
|
+
created_by: e.created_by,
|
|
1333
|
+
status: Sa(e.status),
|
|
1334
|
+
context_ref: e.context_ref ?? null,
|
|
1335
|
+
checklist_ref: e.checklist_ref ?? null
|
|
1240
1336
|
};
|
|
1241
|
-
},
|
|
1242
|
-
var
|
|
1337
|
+
}, en = (e) => {
|
|
1338
|
+
var t;
|
|
1243
1339
|
return {
|
|
1244
|
-
task:
|
|
1245
|
-
status:
|
|
1246
|
-
description:
|
|
1247
|
-
...
|
|
1248
|
-
...(
|
|
1340
|
+
task: e.item ?? e.task ?? e.name ?? e.label ?? xn,
|
|
1341
|
+
status: ba(e.status),
|
|
1342
|
+
description: e.description ?? "",
|
|
1343
|
+
...e.prompt ? { prompt: e.prompt } : {},
|
|
1344
|
+
...(t = e.follow_up_prompts) != null && t.length ? { clarificationPrompts: e.follow_up_prompts } : {}
|
|
1249
1345
|
};
|
|
1250
|
-
},
|
|
1346
|
+
}, Oa = (e) => Array.isArray(e) ? e : e.checklist_items ?? e.checklist ?? e.items ?? [], tn = (e, t, n) => {
|
|
1251
1347
|
var o;
|
|
1252
|
-
const
|
|
1348
|
+
const s = !Array.isArray(t) && (t.opening_message || (o = t.opening_follow_up_prompts) != null && o.length) ? t : n, r = s ? nt(s) : void 0;
|
|
1253
1349
|
return {
|
|
1254
|
-
invocation_id:
|
|
1255
|
-
checklist:
|
|
1350
|
+
invocation_id: e,
|
|
1351
|
+
checklist: Oa(t).map(en),
|
|
1256
1352
|
...r ? { openingMessage: r } : {}
|
|
1257
1353
|
};
|
|
1258
|
-
},
|
|
1259
|
-
const n =
|
|
1354
|
+
}, La = (e, t) => {
|
|
1355
|
+
const n = nt(t);
|
|
1260
1356
|
return {
|
|
1261
|
-
invocation_id:
|
|
1262
|
-
checklist: (
|
|
1357
|
+
invocation_id: t.invocation_id ?? e,
|
|
1358
|
+
checklist: (t.checklist_items ?? []).map(en),
|
|
1263
1359
|
...n ? { openingMessage: n } : {}
|
|
1264
1360
|
};
|
|
1265
|
-
},
|
|
1266
|
-
var n,
|
|
1267
|
-
const
|
|
1268
|
-
if (
|
|
1361
|
+
}, nt = (e) => {
|
|
1362
|
+
var n, s;
|
|
1363
|
+
const t = (n = e.opening_message) == null ? void 0 : n.trim();
|
|
1364
|
+
if (t)
|
|
1365
|
+
return {
|
|
1366
|
+
id: Kt,
|
|
1367
|
+
author: ne.agent,
|
|
1368
|
+
text: t,
|
|
1369
|
+
...(s = e.opening_follow_up_prompts) != null && s.length ? { followUpPrompts: e.opening_follow_up_prompts } : {}
|
|
1370
|
+
};
|
|
1371
|
+
}, Ua = (e) => {
|
|
1372
|
+
try {
|
|
1373
|
+
const t = JSON.parse(e);
|
|
1374
|
+
if (Array.isArray(t)) {
|
|
1375
|
+
const n = t.filter(
|
|
1376
|
+
(s) => !!s && typeof s == "object" && typeof s.text == "string"
|
|
1377
|
+
).map((s) => s.text);
|
|
1378
|
+
if (n.length > 0)
|
|
1379
|
+
return n.join(`
|
|
1380
|
+
`);
|
|
1381
|
+
}
|
|
1382
|
+
} catch {
|
|
1383
|
+
}
|
|
1384
|
+
return e;
|
|
1385
|
+
}, Pa = (e) => {
|
|
1386
|
+
const t = e.trim();
|
|
1387
|
+
return t.length > 0 ? `File upload
|
|
1388
|
+
|
|
1389
|
+
${t}` : "File upload";
|
|
1390
|
+
}, xa = (e) => e.filter((t) => t.message_type === "user_file" && t.role === "user" ? !0 : (t.role === "user" || t.role === "assistant") && typeof t.content == "string" && t.content.length > 0 && t.message_type !== "tool_request").map((t) => {
|
|
1391
|
+
if (t.message_type === "user_file") {
|
|
1392
|
+
const n = typeof t.content == "string" ? t.content : "", s = Ua(n);
|
|
1269
1393
|
return {
|
|
1270
|
-
id:
|
|
1271
|
-
author:
|
|
1272
|
-
|
|
1273
|
-
|
|
1394
|
+
id: t.message_id,
|
|
1395
|
+
author: ne.user,
|
|
1396
|
+
kind: Cn.user_file,
|
|
1397
|
+
text: Pa(s)
|
|
1274
1398
|
};
|
|
1275
|
-
}
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
})
|
|
1282
|
-
class
|
|
1283
|
-
constructor(
|
|
1284
|
-
var
|
|
1285
|
-
this.baseUrl =
|
|
1286
|
-
const n = (
|
|
1287
|
-
this.token = n ?
|
|
1399
|
+
}
|
|
1400
|
+
return {
|
|
1401
|
+
id: t.message_id,
|
|
1402
|
+
author: t.role === "user" ? ne.user : ne.agent,
|
|
1403
|
+
text: t.content
|
|
1404
|
+
};
|
|
1405
|
+
}), Da = /:invocationId\b/g, $a = /:resourceId\b/g, Ma = (e) => e.trim().replace(/^Bearer\s+/i, ""), Ha = (e) => e.endsWith("/") ? e.slice(0, -1) : e;
|
|
1406
|
+
class ft {
|
|
1407
|
+
constructor(t) {
|
|
1408
|
+
var s;
|
|
1409
|
+
this.baseUrl = Ha(t.baseUrl ?? "");
|
|
1410
|
+
const n = (s = t.token) == null ? void 0 : s.trim();
|
|
1411
|
+
this.token = n ? Ma(n) : void 0, this.customHeaders = t.headers, this.urls = t.urls ?? {}, this.fetchImpl = t.fetch ?? globalThis.fetch.bind(globalThis);
|
|
1288
1412
|
}
|
|
1289
1413
|
// Replaces the extra headers merged into every subsequent request,
|
|
1290
1414
|
// without recreating the client (e.g. an application-URL header that
|
|
1291
1415
|
// changes as the user switches institutions).
|
|
1292
|
-
setHeaders(
|
|
1293
|
-
this.customHeaders =
|
|
1416
|
+
setHeaders(t) {
|
|
1417
|
+
this.customHeaders = t;
|
|
1294
1418
|
}
|
|
1295
1419
|
async listAgentDefinitions() {
|
|
1296
1420
|
return (await this.request(
|
|
1297
|
-
|
|
1298
|
-
this.resolveUrl("agentDefinitions",
|
|
1421
|
+
J.GET,
|
|
1422
|
+
this.resolveUrl("agentDefinitions", F.agentDefinitions)
|
|
1299
1423
|
)).agent_definitions ?? [];
|
|
1300
1424
|
}
|
|
1301
|
-
getAgentDefinition(
|
|
1425
|
+
getAgentDefinition(t) {
|
|
1302
1426
|
return this.request(
|
|
1303
|
-
|
|
1304
|
-
this.apiUrl(`${
|
|
1427
|
+
J.GET,
|
|
1428
|
+
this.apiUrl(`${F.agentDefinitions}/${encodeURIComponent(t)}`)
|
|
1305
1429
|
);
|
|
1306
1430
|
}
|
|
1307
1431
|
listTripOptions() {
|
|
1308
|
-
return this.request(
|
|
1432
|
+
return this.request(J.GET, this.apiUrl(F.tripOptions));
|
|
1309
1433
|
}
|
|
1310
1434
|
getDataset() {
|
|
1311
1435
|
return this.request(
|
|
1312
|
-
|
|
1313
|
-
this.apiUrl(
|
|
1436
|
+
J.GET,
|
|
1437
|
+
this.apiUrl(F.demoDataset)
|
|
1314
1438
|
);
|
|
1315
1439
|
}
|
|
1316
|
-
setDataset(
|
|
1440
|
+
setDataset(t) {
|
|
1317
1441
|
return this.request(
|
|
1318
|
-
|
|
1319
|
-
this.apiUrl(
|
|
1320
|
-
{ dataset:
|
|
1442
|
+
J.POST,
|
|
1443
|
+
this.apiUrl(F.demoDataset),
|
|
1444
|
+
{ dataset: t }
|
|
1321
1445
|
);
|
|
1322
1446
|
}
|
|
1323
|
-
listAgents(
|
|
1447
|
+
listAgents(t = {}) {
|
|
1324
1448
|
const n = new URLSearchParams();
|
|
1325
|
-
|
|
1326
|
-
const
|
|
1449
|
+
t.status && n.set("status", t.status), t.agentDefinitionRef && n.set("agent_definition_ref", t.agentDefinitionRef);
|
|
1450
|
+
const s = n.toString() ? `?${n.toString()}` : "";
|
|
1327
1451
|
return this.request(
|
|
1328
|
-
|
|
1329
|
-
`${this.resolveUrl("agents",
|
|
1452
|
+
J.GET,
|
|
1453
|
+
`${this.resolveUrl("agents", F.agents)}${s}`
|
|
1330
1454
|
);
|
|
1331
1455
|
}
|
|
1332
|
-
createAgent(
|
|
1333
|
-
var i,
|
|
1334
|
-
const
|
|
1335
|
-
agent_definition_ref:
|
|
1336
|
-
}, r = (i = n.invocationName) == null ? void 0 : i.trim(), o = (
|
|
1337
|
-
return r && (
|
|
1338
|
-
|
|
1339
|
-
this.resolveUrl("agents",
|
|
1340
|
-
|
|
1456
|
+
createAgent(t, n = {}) {
|
|
1457
|
+
var i, p;
|
|
1458
|
+
const s = {
|
|
1459
|
+
agent_definition_ref: t
|
|
1460
|
+
}, r = (i = n.invocationName) == null ? void 0 : i.trim(), o = (p = n.agentIntent) == null ? void 0 : p.trim();
|
|
1461
|
+
return r && (s.invocation_name = r), o && (s.agent_intent = o), this.request(
|
|
1462
|
+
J.POST,
|
|
1463
|
+
this.resolveUrl("agents", F.agents),
|
|
1464
|
+
s
|
|
1341
1465
|
);
|
|
1342
1466
|
}
|
|
1343
|
-
getAgent(
|
|
1467
|
+
getAgent(t) {
|
|
1344
1468
|
return this.request(
|
|
1345
|
-
|
|
1346
|
-
this.resolveUrl("agent", `${
|
|
1469
|
+
J.GET,
|
|
1470
|
+
this.resolveUrl("agent", `${F.agents}/${encodeURIComponent(t)}`, t)
|
|
1347
1471
|
);
|
|
1348
1472
|
}
|
|
1349
|
-
getAgentChecklist(
|
|
1473
|
+
getAgentChecklist(t) {
|
|
1350
1474
|
return this.request(
|
|
1351
|
-
|
|
1475
|
+
J.GET,
|
|
1352
1476
|
this.resolveUrl(
|
|
1353
1477
|
"agentChecklist",
|
|
1354
|
-
`${
|
|
1355
|
-
|
|
1478
|
+
`${F.agents}/${encodeURIComponent(t)}/checklist`,
|
|
1479
|
+
t
|
|
1356
1480
|
)
|
|
1357
1481
|
);
|
|
1358
1482
|
}
|
|
1359
|
-
getAgentResources(
|
|
1360
|
-
const
|
|
1361
|
-
n.pageNumber !== void 0 &&
|
|
1362
|
-
const r =
|
|
1483
|
+
getAgentResources(t, n = {}) {
|
|
1484
|
+
const s = new URLSearchParams();
|
|
1485
|
+
n.pageNumber !== void 0 && s.set("page_number", String(n.pageNumber)), n.pageSize !== void 0 && s.set("page_size", String(n.pageSize)), n.type && s.set("type", n.type);
|
|
1486
|
+
const r = s.toString(), o = this.resolveUrl(
|
|
1363
1487
|
"agentResources",
|
|
1364
|
-
`${
|
|
1365
|
-
|
|
1488
|
+
`${F.agents}/${encodeURIComponent(t)}/resources`,
|
|
1489
|
+
t
|
|
1366
1490
|
);
|
|
1367
1491
|
return this.request(
|
|
1368
|
-
|
|
1492
|
+
J.GET,
|
|
1369
1493
|
r ? `${o}?${r}` : o
|
|
1370
1494
|
);
|
|
1371
1495
|
}
|
|
1372
|
-
async listAllAgentResources(
|
|
1373
|
-
const n =
|
|
1374
|
-
let
|
|
1496
|
+
async listAllAgentResources(t) {
|
|
1497
|
+
const n = Aa;
|
|
1498
|
+
let s = 1;
|
|
1375
1499
|
const r = [];
|
|
1376
1500
|
let o = Number.POSITIVE_INFINITY;
|
|
1377
1501
|
for (; r.length < o; ) {
|
|
1378
|
-
const i =
|
|
1379
|
-
await this.getAgentResources(
|
|
1502
|
+
const i = Ra(
|
|
1503
|
+
await this.getAgentResources(t, { pageNumber: s, pageSize: n })
|
|
1380
1504
|
);
|
|
1381
1505
|
if (o = i.totalRecords, i.resources.length === 0 || (r.push(...i.resources), r.length >= o))
|
|
1382
1506
|
break;
|
|
1383
|
-
|
|
1507
|
+
s += 1;
|
|
1384
1508
|
}
|
|
1385
1509
|
return r;
|
|
1386
1510
|
}
|
|
1387
|
-
getAgentResourceHtml(
|
|
1388
|
-
return this.requestText(
|
|
1511
|
+
getAgentResourceHtml(t, n) {
|
|
1512
|
+
return this.requestText(J.GET, this.resolveResourceHtmlUrl(t, n));
|
|
1389
1513
|
}
|
|
1390
|
-
getAgentTimeline(
|
|
1514
|
+
getAgentTimeline(t) {
|
|
1391
1515
|
return this.request(
|
|
1392
|
-
|
|
1516
|
+
J.GET,
|
|
1393
1517
|
this.resolveUrl(
|
|
1394
1518
|
"agentTimeline",
|
|
1395
|
-
`${
|
|
1396
|
-
|
|
1519
|
+
`${F.agents}/${encodeURIComponent(t)}/agent-timeline`,
|
|
1520
|
+
t
|
|
1397
1521
|
)
|
|
1398
1522
|
);
|
|
1399
1523
|
}
|
|
1400
|
-
getAgentContext(
|
|
1524
|
+
getAgentContext(t) {
|
|
1401
1525
|
return this.request(
|
|
1402
|
-
|
|
1403
|
-
this.apiUrl(`${
|
|
1526
|
+
J.GET,
|
|
1527
|
+
this.apiUrl(`${F.agents}/${encodeURIComponent(t)}/context`)
|
|
1404
1528
|
);
|
|
1405
1529
|
}
|
|
1406
|
-
cancelAgent(
|
|
1530
|
+
cancelAgent(t) {
|
|
1407
1531
|
return this.request(
|
|
1408
|
-
|
|
1409
|
-
this.
|
|
1532
|
+
J.POST,
|
|
1533
|
+
this.resolveUrl(
|
|
1534
|
+
"stopAgent",
|
|
1535
|
+
`${F.agents}/${encodeURIComponent(t)}/cancel`,
|
|
1536
|
+
t
|
|
1537
|
+
)
|
|
1410
1538
|
);
|
|
1411
1539
|
}
|
|
1412
|
-
archiveAgent(
|
|
1540
|
+
archiveAgent(t) {
|
|
1413
1541
|
return this.request(
|
|
1414
|
-
|
|
1415
|
-
this.apiUrl(`${
|
|
1542
|
+
J.POST,
|
|
1543
|
+
this.apiUrl(`${F.agents}/${encodeURIComponent(t)}/archive`)
|
|
1416
1544
|
);
|
|
1417
1545
|
}
|
|
1418
|
-
getConversation(
|
|
1546
|
+
getConversation(t) {
|
|
1419
1547
|
return this.request(
|
|
1420
|
-
|
|
1548
|
+
J.GET,
|
|
1421
1549
|
this.resolveUrl(
|
|
1422
1550
|
"agentConversation",
|
|
1423
|
-
`${
|
|
1424
|
-
|
|
1551
|
+
`${F.conversations}/${encodeURIComponent(t)}`,
|
|
1552
|
+
t
|
|
1425
1553
|
)
|
|
1426
1554
|
);
|
|
1427
1555
|
}
|
|
1428
1556
|
// Streams a chat turn. Resolves with the final SSE event; `onEvent` fires
|
|
1429
1557
|
// for every event as it arrives.
|
|
1430
|
-
async chat(
|
|
1431
|
-
const r = !!(
|
|
1558
|
+
async chat(t, n, s = {}) {
|
|
1559
|
+
const r = !!(s.uploadFiles && s.uploadFiles.length > 0), o = await this.fetchImpl(
|
|
1432
1560
|
this.resolveUrl(
|
|
1433
1561
|
"agentChat",
|
|
1434
|
-
`${
|
|
1435
|
-
|
|
1562
|
+
`${F.agents}/${encodeURIComponent(t)}/chat`,
|
|
1563
|
+
t
|
|
1436
1564
|
),
|
|
1437
1565
|
{
|
|
1438
|
-
method:
|
|
1566
|
+
method: J.POST,
|
|
1439
1567
|
headers: {
|
|
1440
1568
|
...this.customHeaders,
|
|
1441
1569
|
...this.authHeaders(),
|
|
1442
|
-
Accept:
|
|
1570
|
+
Accept: we.acceptEventStream,
|
|
1443
1571
|
// Let the browser set the multipart boundary when uploading.
|
|
1444
|
-
...r ? {} : { "Content-Type":
|
|
1572
|
+
...r ? {} : { "Content-Type": we.contentTypeJson }
|
|
1445
1573
|
},
|
|
1446
|
-
body: r ?
|
|
1447
|
-
signal:
|
|
1574
|
+
body: r ? Ga(n, s.uploadFiles ?? []) : JSON.stringify(n),
|
|
1575
|
+
signal: s.signal
|
|
1448
1576
|
}
|
|
1449
1577
|
);
|
|
1450
1578
|
if (!o.ok)
|
|
1451
1579
|
throw await this.toError(o);
|
|
1452
1580
|
if (!o.body)
|
|
1453
|
-
throw new
|
|
1454
|
-
return this.consumeSse(o.body,
|
|
1581
|
+
throw new $e(o.status, null, "Chat response contained no stream body");
|
|
1582
|
+
return this.consumeSse(o.body, s.onEvent);
|
|
1455
1583
|
}
|
|
1456
1584
|
authHeaders() {
|
|
1457
1585
|
return this.token ? { Authorization: `Bearer ${this.token}` } : {};
|
|
1458
1586
|
}
|
|
1459
1587
|
// Builds a URL from the base url + shared API prefix + route.
|
|
1460
|
-
apiUrl(
|
|
1461
|
-
return `${this.baseUrl}${
|
|
1588
|
+
apiUrl(t) {
|
|
1589
|
+
return `${this.baseUrl}${ya}${t}`;
|
|
1462
1590
|
}
|
|
1463
1591
|
// Resolves the URL for an operation, preferring a per-operation override
|
|
1464
1592
|
// (with `:invocationId` substituted) and falling back to the base url.
|
|
1465
|
-
resolveUrl(
|
|
1466
|
-
const o = this.urls[
|
|
1593
|
+
resolveUrl(t, n, s, r) {
|
|
1594
|
+
const o = this.urls[t];
|
|
1467
1595
|
if (!o)
|
|
1468
1596
|
return this.apiUrl(n);
|
|
1469
1597
|
let i = o;
|
|
1470
|
-
return
|
|
1598
|
+
return s && (i = i.replace(Da, encodeURIComponent(s))), r && (i = i.replace($a, encodeURIComponent(r))), i;
|
|
1471
1599
|
}
|
|
1472
|
-
resolveResourceHtmlUrl(
|
|
1600
|
+
resolveResourceHtmlUrl(t, n) {
|
|
1473
1601
|
return this.urls.agentResourceHtml ? this.resolveUrl(
|
|
1474
1602
|
"agentResourceHtml",
|
|
1475
|
-
`${
|
|
1603
|
+
`${F.agents}/${encodeURIComponent(t)}/resources/${encodeURIComponent(
|
|
1476
1604
|
n
|
|
1477
1605
|
)}`,
|
|
1478
|
-
|
|
1606
|
+
t,
|
|
1479
1607
|
n
|
|
1480
1608
|
) : this.urls.agentResources ? `${this.resolveUrl(
|
|
1481
1609
|
"agentResources",
|
|
1482
|
-
`${
|
|
1483
|
-
|
|
1610
|
+
`${F.agents}/${encodeURIComponent(t)}/resources`,
|
|
1611
|
+
t
|
|
1484
1612
|
).replace(/\/$/, "")}/${encodeURIComponent(n)}` : this.apiUrl(
|
|
1485
|
-
`${
|
|
1613
|
+
`${F.agents}/${encodeURIComponent(t)}/resources/${encodeURIComponent(
|
|
1486
1614
|
n
|
|
1487
1615
|
)}`
|
|
1488
1616
|
);
|
|
1489
1617
|
}
|
|
1490
|
-
async request(
|
|
1618
|
+
async request(t, n, s) {
|
|
1491
1619
|
const r = await this.fetchImpl(n, {
|
|
1492
|
-
method:
|
|
1620
|
+
method: t,
|
|
1493
1621
|
headers: {
|
|
1494
1622
|
...this.customHeaders,
|
|
1495
1623
|
...this.authHeaders(),
|
|
1496
|
-
Accept:
|
|
1497
|
-
...
|
|
1624
|
+
Accept: we.acceptJson,
|
|
1625
|
+
...s === void 0 ? {} : { "Content-Type": we.contentTypeJson }
|
|
1498
1626
|
},
|
|
1499
|
-
...
|
|
1627
|
+
...s === void 0 ? {} : { body: JSON.stringify(s) }
|
|
1500
1628
|
});
|
|
1501
1629
|
if (!r.ok)
|
|
1502
1630
|
throw await this.toError(r);
|
|
1503
1631
|
if (r.status !== 204)
|
|
1504
1632
|
return await r.json();
|
|
1505
1633
|
}
|
|
1506
|
-
async requestText(
|
|
1507
|
-
const
|
|
1508
|
-
method:
|
|
1634
|
+
async requestText(t, n) {
|
|
1635
|
+
const s = await this.fetchImpl(n, {
|
|
1636
|
+
method: t,
|
|
1509
1637
|
headers: {
|
|
1510
1638
|
...this.customHeaders,
|
|
1511
1639
|
...this.authHeaders(),
|
|
1512
|
-
Accept:
|
|
1640
|
+
Accept: we.acceptHtml
|
|
1513
1641
|
}
|
|
1514
1642
|
});
|
|
1515
|
-
if (!
|
|
1516
|
-
throw await this.toError(
|
|
1517
|
-
return
|
|
1643
|
+
if (!s.ok)
|
|
1644
|
+
throw await this.toError(s);
|
|
1645
|
+
return s.text();
|
|
1518
1646
|
}
|
|
1519
|
-
async toError(
|
|
1647
|
+
async toError(t) {
|
|
1520
1648
|
let n = null;
|
|
1521
1649
|
try {
|
|
1522
|
-
n = await
|
|
1650
|
+
n = await t.json();
|
|
1523
1651
|
} catch {
|
|
1524
1652
|
}
|
|
1525
|
-
return new
|
|
1526
|
-
|
|
1653
|
+
return new $e(
|
|
1654
|
+
t.status,
|
|
1527
1655
|
n,
|
|
1528
|
-
`Agent service request failed (${
|
|
1656
|
+
`Agent service request failed (${t.status} ${t.statusText})`
|
|
1529
1657
|
);
|
|
1530
1658
|
}
|
|
1531
|
-
async consumeSse(
|
|
1532
|
-
const
|
|
1659
|
+
async consumeSse(t, n) {
|
|
1660
|
+
const s = t.getReader(), r = new TextDecoder();
|
|
1533
1661
|
let o = "", i;
|
|
1534
|
-
const
|
|
1535
|
-
const { event:
|
|
1536
|
-
if (
|
|
1662
|
+
const p = (c) => {
|
|
1663
|
+
const { event: g, data: m } = za(c);
|
|
1664
|
+
if (m === null)
|
|
1537
1665
|
return;
|
|
1538
|
-
if (
|
|
1539
|
-
const
|
|
1540
|
-
throw new
|
|
1666
|
+
if (g === ka.error) {
|
|
1667
|
+
const y = Mt(m);
|
|
1668
|
+
throw new $e(502, y, (y == null ? void 0 : y.message) ?? "Chat stream error");
|
|
1541
1669
|
}
|
|
1542
|
-
const
|
|
1543
|
-
|
|
1670
|
+
const N = Mt(m);
|
|
1671
|
+
N && (i = N, n == null || n(N));
|
|
1544
1672
|
};
|
|
1545
1673
|
for (; ; ) {
|
|
1546
|
-
const { done: c, value:
|
|
1674
|
+
const { done: c, value: g } = await s.read();
|
|
1547
1675
|
if (c)
|
|
1548
1676
|
break;
|
|
1549
|
-
o += r.decode(
|
|
1550
|
-
const
|
|
1677
|
+
o += r.decode(g, { stream: !0 });
|
|
1678
|
+
const m = o.split(`
|
|
1551
1679
|
|
|
1552
1680
|
`);
|
|
1553
|
-
o =
|
|
1554
|
-
for (const
|
|
1555
|
-
|
|
1681
|
+
o = m.pop() ?? "";
|
|
1682
|
+
for (const N of m)
|
|
1683
|
+
p(N);
|
|
1556
1684
|
}
|
|
1557
|
-
if (o.trim() &&
|
|
1558
|
-
throw new
|
|
1685
|
+
if (o.trim() && p(o), !i)
|
|
1686
|
+
throw new $e(502, null, "Chat stream ended without any events");
|
|
1559
1687
|
return i;
|
|
1560
1688
|
}
|
|
1561
1689
|
}
|
|
1562
|
-
const
|
|
1563
|
-
let
|
|
1690
|
+
const za = (e) => {
|
|
1691
|
+
let t = null;
|
|
1564
1692
|
const n = [];
|
|
1565
|
-
for (const
|
|
1693
|
+
for (const s of e.split(`
|
|
1566
1694
|
`)) {
|
|
1567
|
-
const r =
|
|
1568
|
-
r.startsWith("event:") ?
|
|
1695
|
+
const r = s.trimEnd();
|
|
1696
|
+
r.startsWith("event:") ? t = r.slice(6).trim() : r.startsWith("data:") && n.push(r.slice(5).trim());
|
|
1569
1697
|
}
|
|
1570
1698
|
return {
|
|
1571
|
-
event:
|
|
1699
|
+
event: t,
|
|
1572
1700
|
data: n.length > 0 ? n.join(`
|
|
1573
1701
|
`) : null
|
|
1574
1702
|
};
|
|
1575
|
-
},
|
|
1703
|
+
}, Mt = (e) => {
|
|
1576
1704
|
try {
|
|
1577
|
-
return JSON.parse(
|
|
1705
|
+
return JSON.parse(e);
|
|
1578
1706
|
} catch {
|
|
1579
1707
|
return;
|
|
1580
1708
|
}
|
|
1581
1709
|
};
|
|
1582
|
-
function
|
|
1710
|
+
function Ga(e, t) {
|
|
1583
1711
|
const n = new FormData();
|
|
1584
|
-
n.append("body", JSON.stringify(
|
|
1585
|
-
for (const
|
|
1586
|
-
n.append("files",
|
|
1712
|
+
n.append("body", JSON.stringify(e));
|
|
1713
|
+
for (const s of t)
|
|
1714
|
+
n.append("files", s, s.name);
|
|
1587
1715
|
return n;
|
|
1588
1716
|
}
|
|
1589
|
-
const
|
|
1590
|
-
id:
|
|
1591
|
-
author:
|
|
1717
|
+
const Fa = {
|
|
1718
|
+
id: Kt,
|
|
1719
|
+
author: ne.agent,
|
|
1592
1720
|
text: "Type a question or upload a file. You can ask it how it's progressing, or send an instruction and it'll act on it."
|
|
1593
1721
|
};
|
|
1594
|
-
let
|
|
1595
|
-
const
|
|
1596
|
-
const
|
|
1597
|
-
return `Let's get started on ${
|
|
1722
|
+
let Ht = 0;
|
|
1723
|
+
const Ba = (e) => (Ht += 1, `${e}-${Date.now()}-${Ht}`), qa = (e) => {
|
|
1724
|
+
const t = e.destination ? ` to ${e.destination}` : "";
|
|
1725
|
+
return `Let's get started on ${e.tripName.trim() || e.destination.trim() || "this task"}${t}. What will you do first?`;
|
|
1598
1726
|
};
|
|
1599
|
-
class
|
|
1600
|
-
constructor(
|
|
1601
|
-
this.seededChecklist = [], this.client =
|
|
1727
|
+
class Ja {
|
|
1728
|
+
constructor(t, n, s = {}) {
|
|
1729
|
+
this.seededChecklist = [], this.client = t, this.agentId = n, this.chatId = s.chatId ?? n, this.opening = s.openingMessage ?? Fa, this.model = s.model;
|
|
1602
1730
|
}
|
|
1603
1731
|
openingMessage() {
|
|
1604
1732
|
return this.opening;
|
|
1605
1733
|
}
|
|
1606
1734
|
async bootstrapConversation() {
|
|
1607
|
-
const
|
|
1735
|
+
const t = await this.client.getConversation(this.chatId), n = xa(t.messages);
|
|
1608
1736
|
return n.length === 0 ? [this.opening] : n;
|
|
1609
1737
|
}
|
|
1610
|
-
async start(
|
|
1611
|
-
return { ...await this.exchange(
|
|
1738
|
+
async start(t) {
|
|
1739
|
+
return { ...await this.exchange(qa(t)), phase: B.running };
|
|
1612
1740
|
}
|
|
1613
|
-
sendMessage(
|
|
1614
|
-
return this.exchange(
|
|
1741
|
+
sendMessage(t, n) {
|
|
1742
|
+
return this.exchange(t, n);
|
|
1615
1743
|
}
|
|
1616
1744
|
async stop() {
|
|
1745
|
+
await this.client.cancelAgent(this.agentId);
|
|
1617
1746
|
}
|
|
1618
|
-
seedChecklist(
|
|
1619
|
-
this.seededChecklist =
|
|
1747
|
+
seedChecklist(t) {
|
|
1748
|
+
this.seededChecklist = t;
|
|
1620
1749
|
}
|
|
1621
|
-
async exchange(
|
|
1750
|
+
async exchange(t, n) {
|
|
1622
1751
|
var i;
|
|
1623
|
-
const
|
|
1752
|
+
const s = [{ role: Na.user, content: t }], r = await this.client.chat(
|
|
1624
1753
|
this.agentId,
|
|
1625
1754
|
{
|
|
1626
|
-
messages:
|
|
1755
|
+
messages: s,
|
|
1627
1756
|
chat_id: this.chatId,
|
|
1628
1757
|
...this.model ? { model: this.model } : {},
|
|
1629
1758
|
moderation_enabled: !0,
|
|
@@ -1634,623 +1763,675 @@ class _s {
|
|
|
1634
1763
|
},
|
|
1635
1764
|
...n && n.length > 0 ? [{ uploadFiles: n }] : []
|
|
1636
1765
|
), o = {
|
|
1637
|
-
id: r.event_id ||
|
|
1638
|
-
author:
|
|
1766
|
+
id: r.event_id || Ba("msg-agent"),
|
|
1767
|
+
author: ne.agent,
|
|
1639
1768
|
text: r.message.content,
|
|
1640
1769
|
...(i = r.follow_up_prompts) != null && i.length ? { followUpPrompts: r.follow_up_prompts } : {}
|
|
1641
1770
|
};
|
|
1642
1771
|
try {
|
|
1643
|
-
const
|
|
1772
|
+
const p = await this.client.getAgent(this.agentId), { checklist: c } = La(this.agentId, p);
|
|
1644
1773
|
return this.seededChecklist = c, { message: o, checklist: c };
|
|
1645
1774
|
} catch {
|
|
1646
1775
|
return { message: o, ...this.seededChecklist.length ? { checklist: this.seededChecklist } : {} };
|
|
1647
1776
|
}
|
|
1648
1777
|
}
|
|
1649
1778
|
}
|
|
1650
|
-
const
|
|
1651
|
-
var
|
|
1652
|
-
return new
|
|
1653
|
-
model:
|
|
1654
|
-
chatId: ((
|
|
1655
|
-
openingMessage: ((r =
|
|
1779
|
+
const nn = (e, t) => (n) => {
|
|
1780
|
+
var s, r;
|
|
1781
|
+
return new Ja(e, n.invocation_id, {
|
|
1782
|
+
model: t == null ? void 0 : t.model,
|
|
1783
|
+
chatId: ((s = t == null ? void 0 : t.resolveChatId) == null ? void 0 : s.call(t, n)) ?? (t == null ? void 0 : t.chatId) ?? n.invocation_id,
|
|
1784
|
+
openingMessage: ((r = t == null ? void 0 : t.resolveOpeningMessage) == null ? void 0 : r.call(t, n)) ?? (t == null ? void 0 : t.openingMessage)
|
|
1656
1785
|
});
|
|
1657
|
-
},
|
|
1658
|
-
const
|
|
1659
|
-
for (const n of
|
|
1660
|
-
const
|
|
1661
|
-
if (!
|
|
1786
|
+
}, an = (e) => e instanceof $e ? e.message : e instanceof TypeError ? "Network error while contacting the agent service." : e instanceof Error && e.message ? e.message : jt, Ka = (e) => {
|
|
1787
|
+
const t = {};
|
|
1788
|
+
for (const n of e) {
|
|
1789
|
+
const s = nt(n);
|
|
1790
|
+
if (!s)
|
|
1662
1791
|
continue;
|
|
1663
1792
|
const r = n.invocation_id ?? n.id;
|
|
1664
|
-
|
|
1793
|
+
t[r] = s, t[n.id] = s;
|
|
1665
1794
|
}
|
|
1666
|
-
return
|
|
1667
|
-
},
|
|
1668
|
-
const { jwt:
|
|
1669
|
-
() => new
|
|
1670
|
-
token:
|
|
1795
|
+
return t;
|
|
1796
|
+
}, Wa = (e) => JSON.stringify(e), pt = (e, t) => JSON.stringify(e) === JSON.stringify(t), ja = (e) => {
|
|
1797
|
+
const { jwt: t, headers: n, urls: s } = e, r = JSON.stringify(n ?? {}), o = Wa(s), i = Y(
|
|
1798
|
+
() => new ft({
|
|
1799
|
+
token: t,
|
|
1671
1800
|
headers: n,
|
|
1672
|
-
urls:
|
|
1801
|
+
urls: s
|
|
1673
1802
|
}),
|
|
1674
1803
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- keyed on serialised config to keep a stable client.
|
|
1675
|
-
[
|
|
1804
|
+
[t, o]
|
|
1676
1805
|
);
|
|
1677
|
-
|
|
1806
|
+
et(() => {
|
|
1678
1807
|
i.setHeaders(n);
|
|
1679
1808
|
}, [i, r]);
|
|
1680
|
-
const [
|
|
1809
|
+
const [p, c] = h([]), [g, m] = h(
|
|
1681
1810
|
[]
|
|
1682
|
-
), [
|
|
1683
|
-
(
|
|
1684
|
-
const
|
|
1811
|
+
), [N, y] = h({}), [I, O] = h("loading"), [f, K] = h(null), [T, P] = h(0), A = C(
|
|
1812
|
+
(L, G) => {
|
|
1813
|
+
const q = L.map($t), X = G.map(Qt), Z = Ka(L);
|
|
1685
1814
|
c(
|
|
1686
|
-
(
|
|
1687
|
-
),
|
|
1688
|
-
(
|
|
1689
|
-
),
|
|
1690
|
-
(
|
|
1691
|
-
),
|
|
1815
|
+
(D) => pt(D, q) ? D : q
|
|
1816
|
+
), m(
|
|
1817
|
+
(D) => pt(D, X) ? D : X
|
|
1818
|
+
), y(
|
|
1819
|
+
(D) => pt(D, Z) ? D : Z
|
|
1820
|
+
), O("idle"), K(null);
|
|
1692
1821
|
},
|
|
1693
1822
|
[]
|
|
1694
1823
|
);
|
|
1695
|
-
|
|
1696
|
-
let
|
|
1697
|
-
return
|
|
1824
|
+
H(() => {
|
|
1825
|
+
let L = !1;
|
|
1826
|
+
return O("loading"), K(null), (async () => {
|
|
1698
1827
|
try {
|
|
1699
|
-
const [
|
|
1828
|
+
const [G, q] = await Promise.all([
|
|
1700
1829
|
i.listAgents(),
|
|
1701
1830
|
i.listAgentDefinitions()
|
|
1702
1831
|
]);
|
|
1703
|
-
if (
|
|
1832
|
+
if (L)
|
|
1704
1833
|
return;
|
|
1705
|
-
|
|
1706
|
-
} catch (
|
|
1707
|
-
if (
|
|
1834
|
+
A(G, q);
|
|
1835
|
+
} catch (G) {
|
|
1836
|
+
if (L)
|
|
1708
1837
|
return;
|
|
1709
|
-
c([]),
|
|
1838
|
+
c([]), m([]), y({}), O("error"), K(an(G));
|
|
1710
1839
|
}
|
|
1711
1840
|
})(), () => {
|
|
1712
|
-
|
|
1841
|
+
L = !0;
|
|
1713
1842
|
};
|
|
1714
|
-
}, [
|
|
1715
|
-
const
|
|
1716
|
-
|
|
1717
|
-
}, []),
|
|
1843
|
+
}, [A, i, T]);
|
|
1844
|
+
const _ = C(() => {
|
|
1845
|
+
P((L) => L + 1);
|
|
1846
|
+
}, []), S = C(async () => {
|
|
1718
1847
|
try {
|
|
1719
|
-
const [
|
|
1848
|
+
const [L, G] = await Promise.all([
|
|
1720
1849
|
i.listAgents(),
|
|
1721
1850
|
i.listAgentDefinitions()
|
|
1722
1851
|
]);
|
|
1723
|
-
|
|
1852
|
+
A(L, G);
|
|
1724
1853
|
} catch {
|
|
1725
1854
|
}
|
|
1726
|
-
}, [
|
|
1727
|
-
async (
|
|
1728
|
-
const [
|
|
1729
|
-
i.getAgentChecklist(
|
|
1730
|
-
i.getAgent(
|
|
1855
|
+
}, [A, i]), v = C(
|
|
1856
|
+
async (L) => {
|
|
1857
|
+
const [G, q] = await Promise.all([
|
|
1858
|
+
i.getAgentChecklist(L),
|
|
1859
|
+
i.getAgent(L).catch(() => null)
|
|
1731
1860
|
]);
|
|
1732
|
-
return
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1861
|
+
return tn(
|
|
1862
|
+
L,
|
|
1863
|
+
G,
|
|
1864
|
+
q ?? void 0
|
|
1736
1865
|
);
|
|
1737
1866
|
},
|
|
1738
1867
|
[i]
|
|
1739
|
-
),
|
|
1740
|
-
async (
|
|
1868
|
+
), R = C(
|
|
1869
|
+
async (L) => i.listAllAgentResources(L),
|
|
1741
1870
|
[i]
|
|
1742
|
-
),
|
|
1871
|
+
), z = C(
|
|
1743
1872
|
async ({
|
|
1744
|
-
definition:
|
|
1745
|
-
invocationName:
|
|
1873
|
+
definition: L,
|
|
1874
|
+
invocationName: G
|
|
1746
1875
|
}) => {
|
|
1747
|
-
const
|
|
1748
|
-
invocationName:
|
|
1749
|
-
}),
|
|
1750
|
-
return c((
|
|
1751
|
-
...
|
|
1752
|
-
[
|
|
1753
|
-
[
|
|
1754
|
-
})),
|
|
1876
|
+
const q = await i.createAgent(L.ref, {
|
|
1877
|
+
invocationName: G
|
|
1878
|
+
}), X = await i.getAgent(q.id), Z = $t(X), D = nt(X);
|
|
1879
|
+
return c((x) => [Z, ...x]), D && y((x) => ({
|
|
1880
|
+
...x,
|
|
1881
|
+
[Z.invocation_id]: D,
|
|
1882
|
+
[Z.id]: D
|
|
1883
|
+
})), Z;
|
|
1755
1884
|
},
|
|
1756
1885
|
[i]
|
|
1757
|
-
),
|
|
1758
|
-
() =>
|
|
1759
|
-
resolveOpeningMessage: (
|
|
1886
|
+
), Ce = Y(
|
|
1887
|
+
() => nn(i, {
|
|
1888
|
+
resolveOpeningMessage: (L) => N[L.invocation_id] ?? N[L.id]
|
|
1760
1889
|
}),
|
|
1761
|
-
[i,
|
|
1890
|
+
[i, N]
|
|
1762
1891
|
);
|
|
1763
1892
|
return {
|
|
1764
|
-
agents:
|
|
1765
|
-
agentDefinitions:
|
|
1766
|
-
loadState:
|
|
1767
|
-
loadError:
|
|
1768
|
-
reload:
|
|
1769
|
-
refresh:
|
|
1770
|
-
fetchAgentChecklist:
|
|
1771
|
-
fetchAgentResources:
|
|
1772
|
-
createAgent:
|
|
1773
|
-
chatConnector:
|
|
1893
|
+
agents: p,
|
|
1894
|
+
agentDefinitions: g,
|
|
1895
|
+
loadState: I,
|
|
1896
|
+
loadError: f,
|
|
1897
|
+
reload: _,
|
|
1898
|
+
refresh: S,
|
|
1899
|
+
fetchAgentChecklist: v,
|
|
1900
|
+
fetchAgentResources: R,
|
|
1901
|
+
createAgent: z,
|
|
1902
|
+
chatConnector: Ce
|
|
1774
1903
|
};
|
|
1775
|
-
},
|
|
1776
|
-
const { agent:
|
|
1777
|
-
() => new
|
|
1904
|
+
}, Va = (e) => JSON.stringify(e), Ya = (e) => {
|
|
1905
|
+
const { agent: t, jwt: n, headers: s, urls: r, chatId: o } = e, i = JSON.stringify(s ?? {}), p = Va(r), c = Y(
|
|
1906
|
+
() => new ft({
|
|
1778
1907
|
token: n,
|
|
1779
|
-
headers:
|
|
1908
|
+
headers: s,
|
|
1780
1909
|
urls: {
|
|
1781
1910
|
agent: r.agentUrl,
|
|
1782
1911
|
agentChecklist: r.agentChecklistUrl,
|
|
1783
1912
|
...r.agentResourcesUrl ? { agentResources: r.agentResourcesUrl } : {},
|
|
1784
1913
|
...r.agentTimelineUrl ? { agentTimeline: r.agentTimelineUrl } : {},
|
|
1785
1914
|
agentChat: r.agentChatUrl,
|
|
1786
|
-
agentConversation: r.agentConversationUrl
|
|
1915
|
+
agentConversation: r.agentConversationUrl,
|
|
1916
|
+
...r.stopAgentUrl ? { stopAgent: r.stopAgentUrl } : {}
|
|
1787
1917
|
}
|
|
1788
1918
|
}),
|
|
1789
1919
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- keyed on serialised config to keep a stable client.
|
|
1790
|
-
[n,
|
|
1920
|
+
[n, p]
|
|
1791
1921
|
);
|
|
1792
|
-
|
|
1793
|
-
c.setHeaders(
|
|
1922
|
+
et(() => {
|
|
1923
|
+
c.setHeaders(s);
|
|
1794
1924
|
}, [c, i]);
|
|
1795
|
-
const
|
|
1796
|
-
async (
|
|
1797
|
-
const [
|
|
1798
|
-
c.getAgentChecklist(
|
|
1799
|
-
c.getAgent(
|
|
1925
|
+
const g = C(
|
|
1926
|
+
async (O) => {
|
|
1927
|
+
const [f, K] = await Promise.all([
|
|
1928
|
+
c.getAgentChecklist(O),
|
|
1929
|
+
c.getAgent(O).catch(() => null)
|
|
1800
1930
|
]);
|
|
1801
|
-
return
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1931
|
+
return tn(
|
|
1932
|
+
O,
|
|
1933
|
+
f,
|
|
1934
|
+
K ?? void 0
|
|
1805
1935
|
);
|
|
1806
1936
|
},
|
|
1807
1937
|
[c]
|
|
1808
|
-
),
|
|
1809
|
-
async (
|
|
1938
|
+
), m = C(
|
|
1939
|
+
async (O) => c.listAllAgentResources(O),
|
|
1810
1940
|
[c]
|
|
1811
|
-
),
|
|
1812
|
-
async (
|
|
1941
|
+
), N = C(
|
|
1942
|
+
async (O, f) => c.getAgentResourceHtml(O, f),
|
|
1813
1943
|
[c]
|
|
1814
|
-
),
|
|
1815
|
-
async (
|
|
1816
|
-
const
|
|
1817
|
-
return
|
|
1944
|
+
), y = C(
|
|
1945
|
+
async (O) => {
|
|
1946
|
+
const f = await c.getAgentTimeline(O);
|
|
1947
|
+
return Ia(f);
|
|
1818
1948
|
},
|
|
1819
1949
|
[c]
|
|
1820
1950
|
);
|
|
1821
1951
|
return {
|
|
1822
1952
|
connector: Y(
|
|
1823
|
-
() =>
|
|
1824
|
-
chatId: o ??
|
|
1825
|
-
})(
|
|
1953
|
+
() => nn(c, {
|
|
1954
|
+
chatId: o ?? t.invocation_id
|
|
1955
|
+
})(t),
|
|
1826
1956
|
// Key on invocation/chat ids so a new Agent object reference does not rebuild the connector.
|
|
1827
1957
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1828
|
-
[c,
|
|
1958
|
+
[c, t.invocation_id, o]
|
|
1829
1959
|
),
|
|
1830
|
-
fetchAgentChecklist:
|
|
1831
|
-
fetchAgentResources:
|
|
1832
|
-
fetchAgentResourceHtml:
|
|
1833
|
-
fetchAgentTimeline:
|
|
1960
|
+
fetchAgentChecklist: g,
|
|
1961
|
+
fetchAgentResources: m,
|
|
1962
|
+
fetchAgentResourceHtml: N,
|
|
1963
|
+
fetchAgentTimeline: y
|
|
1834
1964
|
};
|
|
1835
|
-
},
|
|
1836
|
-
const n =
|
|
1837
|
-
return `${n}${
|
|
1838
|
-
},
|
|
1839
|
-
switch (
|
|
1840
|
-
case
|
|
1841
|
-
return
|
|
1842
|
-
case
|
|
1843
|
-
return
|
|
1965
|
+
}, Xa = 3e4, Za = (e, t) => {
|
|
1966
|
+
const n = e.hasRunBefore ? t || "This trip" : e.tripName.trim() || "A new trip", s = e.destination ? ` to ${e.destination}` : "", r = e.hasRunBefore ? " It has run before." : "";
|
|
1967
|
+
return `${n}${s}.${r}`.trim();
|
|
1968
|
+
}, Qa = (e) => {
|
|
1969
|
+
switch (e) {
|
|
1970
|
+
case E.failed:
|
|
1971
|
+
return B.stopped;
|
|
1972
|
+
case E.complete:
|
|
1973
|
+
return B.complete;
|
|
1844
1974
|
default:
|
|
1845
|
-
return
|
|
1975
|
+
return B.running;
|
|
1846
1976
|
}
|
|
1847
|
-
},
|
|
1848
|
-
|
|
1849
|
-
},
|
|
1850
|
-
const r =
|
|
1977
|
+
}, zt = (e, t) => {
|
|
1978
|
+
t([Ae(e)]);
|
|
1979
|
+
}, es = (e, t) => e.length === t.length && e.every((n, s) => {
|
|
1980
|
+
const r = t[s];
|
|
1851
1981
|
return r !== void 0 && n.id === r.id && n.text === r.text;
|
|
1852
|
-
}),
|
|
1853
|
-
agent:
|
|
1854
|
-
invocationId:
|
|
1982
|
+
}), ts = ({
|
|
1983
|
+
agent: e,
|
|
1984
|
+
invocationId: t,
|
|
1855
1985
|
open: n,
|
|
1856
|
-
onClose:
|
|
1986
|
+
onClose: s,
|
|
1857
1987
|
jwt: r,
|
|
1858
1988
|
headers: o,
|
|
1859
1989
|
agentUrl: i,
|
|
1860
|
-
agentChecklistUrl:
|
|
1990
|
+
agentChecklistUrl: p,
|
|
1861
1991
|
agentResourcesUrl: c,
|
|
1862
|
-
agentTimelineUrl:
|
|
1863
|
-
agentChatUrl:
|
|
1864
|
-
agentConversationUrl:
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1992
|
+
agentTimelineUrl: g,
|
|
1993
|
+
agentChatUrl: m,
|
|
1994
|
+
agentConversationUrl: N,
|
|
1995
|
+
stopAgentUrl: y,
|
|
1996
|
+
chatId: I,
|
|
1997
|
+
enableUpload: O,
|
|
1998
|
+
initialBrief: f,
|
|
1999
|
+
initialPhase: K,
|
|
2000
|
+
initialChecklist: T,
|
|
2001
|
+
usePusherToRepoll: P = !1,
|
|
2002
|
+
pusherChannelPrefix: A = Zt,
|
|
2003
|
+
subscribeToPusher: _
|
|
1870
2004
|
}) => {
|
|
1871
|
-
const [
|
|
1872
|
-
|
|
2005
|
+
const [S, v] = h(I ?? t), [R, z] = h("chat"), [Ce, L] = h(!1), {
|
|
2006
|
+
connector: G,
|
|
2007
|
+
fetchAgentChecklist: q,
|
|
2008
|
+
fetchAgentResources: X,
|
|
2009
|
+
fetchAgentResourceHtml: Z,
|
|
2010
|
+
fetchAgentTimeline: D
|
|
2011
|
+
} = Ya({
|
|
2012
|
+
agent: { ...e, invocation_id: t },
|
|
1873
2013
|
jwt: r,
|
|
1874
2014
|
headers: o,
|
|
1875
|
-
chatId:
|
|
2015
|
+
chatId: S,
|
|
1876
2016
|
urls: {
|
|
1877
2017
|
agentUrl: i,
|
|
1878
|
-
agentChecklistUrl:
|
|
2018
|
+
agentChecklistUrl: p,
|
|
1879
2019
|
agentResourcesUrl: c,
|
|
1880
|
-
agentTimelineUrl:
|
|
1881
|
-
agentChatUrl:
|
|
1882
|
-
agentConversationUrl:
|
|
2020
|
+
agentTimelineUrl: g,
|
|
2021
|
+
agentChatUrl: m,
|
|
2022
|
+
agentConversationUrl: N,
|
|
2023
|
+
stopAgentUrl: y
|
|
1883
2024
|
}
|
|
1884
|
-
}),
|
|
1885
|
-
|
|
1886
|
-
), [
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
}, [
|
|
1890
|
-
|
|
1891
|
-
}, [
|
|
1892
|
-
|
|
1893
|
-
}, [
|
|
1894
|
-
if (!n ||
|
|
2025
|
+
}), x = le(G), [ae, Ee] = h(
|
|
2026
|
+
K ?? (f ? B.running : Qa(e.status))
|
|
2027
|
+
), [He, j] = h([]), [ze, ye] = h(0), [Te, ke] = h(), [at, ce] = h(null), [st, Re] = h([]), [pe, Ie] = h(!1), [Ge, Ne] = h(null), [Fe, Be] = h(null), [qe, Oe] = h(null), [Je, Le] = h(!1), [rt, Ue] = h(null), [de, Pe] = h(null), [u, b] = h(!1), [k, V] = h(null), [se, re] = h(T ?? null), [me, xe] = h(!1), [rn, it] = h(null), [vt, wt] = h(!1), [yt, kt] = h(null), [Ke, ot] = h(!1), [We, on] = h(!1), [je, ln] = h(!1), Nt = le(Ke), At = le(0), St = le(0);
|
|
2028
|
+
H(() => {
|
|
2029
|
+
x.current = G;
|
|
2030
|
+
}, [G]), H(() => {
|
|
2031
|
+
Nt.current = Ke;
|
|
2032
|
+
}, [Ke]), H(() => {
|
|
2033
|
+
v(I ?? t), z("chat"), L(!1), j([]), ye((d) => d + 1);
|
|
2034
|
+
}, [t, I]), H(() => {
|
|
2035
|
+
if (!n || f)
|
|
1895
2036
|
return;
|
|
1896
|
-
const
|
|
1897
|
-
if (!
|
|
1898
|
-
|
|
2037
|
+
const d = x.current.bootstrapConversation;
|
|
2038
|
+
if (!d) {
|
|
2039
|
+
zt(x.current.openingMessage(), j);
|
|
1899
2040
|
return;
|
|
1900
2041
|
}
|
|
1901
|
-
let
|
|
1902
|
-
return
|
|
2042
|
+
let w = !1;
|
|
2043
|
+
return ot(!0), (async () => {
|
|
1903
2044
|
try {
|
|
1904
|
-
const $ = await
|
|
1905
|
-
if (
|
|
2045
|
+
const $ = await d.call(x.current);
|
|
2046
|
+
if (w)
|
|
1906
2047
|
return;
|
|
1907
|
-
|
|
2048
|
+
j($.map(Ae));
|
|
1908
2049
|
} catch {
|
|
1909
|
-
|
|
2050
|
+
w || zt(x.current.openingMessage(), j);
|
|
1910
2051
|
} finally {
|
|
1911
|
-
|
|
2052
|
+
w || ot(!1);
|
|
1912
2053
|
}
|
|
1913
2054
|
})(), () => {
|
|
1914
|
-
|
|
2055
|
+
w = !0;
|
|
1915
2056
|
};
|
|
1916
|
-
}, [n,
|
|
1917
|
-
const
|
|
1918
|
-
const
|
|
2057
|
+
}, [n, f, t, S]);
|
|
2058
|
+
const ie = C(() => {
|
|
2059
|
+
const d = ++At.current;
|
|
1919
2060
|
(async () => {
|
|
1920
|
-
var
|
|
2061
|
+
var w, $;
|
|
1921
2062
|
try {
|
|
1922
|
-
const Q = await
|
|
1923
|
-
if (
|
|
2063
|
+
const Q = await q(t);
|
|
2064
|
+
if (d !== At.current)
|
|
1924
2065
|
return;
|
|
1925
|
-
|
|
1926
|
-
(
|
|
1927
|
-
),
|
|
2066
|
+
re(
|
|
2067
|
+
(ge) => JSON.stringify(ge) === JSON.stringify(Q.checklist) ? ge : Q.checklist
|
|
2068
|
+
), it(null), ($ = (w = x.current).seedChecklist) == null || $.call(w, Q.checklist);
|
|
1928
2069
|
} catch {
|
|
1929
2070
|
}
|
|
1930
2071
|
})();
|
|
1931
|
-
}, [
|
|
2072
|
+
}, [q, t]), _e = C(() => {
|
|
1932
2073
|
c && (async () => {
|
|
1933
2074
|
try {
|
|
1934
|
-
const
|
|
1935
|
-
|
|
2075
|
+
const d = await X(t);
|
|
2076
|
+
Re(d), Ne(null);
|
|
1936
2077
|
} catch {
|
|
1937
2078
|
}
|
|
1938
2079
|
})();
|
|
1939
|
-
}, [c,
|
|
1940
|
-
if (!
|
|
2080
|
+
}, [c, X, t]), oe = C(() => {
|
|
2081
|
+
if (!g)
|
|
1941
2082
|
return;
|
|
1942
|
-
const
|
|
2083
|
+
const d = ++St.current;
|
|
1943
2084
|
(async () => {
|
|
1944
2085
|
try {
|
|
1945
|
-
const
|
|
1946
|
-
if (
|
|
2086
|
+
const w = await D(t);
|
|
2087
|
+
if (d !== St.current)
|
|
1947
2088
|
return;
|
|
1948
|
-
|
|
1949
|
-
($) => JSON.stringify($) === JSON.stringify(
|
|
2089
|
+
Pe(
|
|
2090
|
+
($) => JSON.stringify($) === JSON.stringify(w) ? $ : w
|
|
1950
2091
|
), V(null);
|
|
1951
2092
|
} catch {
|
|
1952
2093
|
}
|
|
1953
2094
|
})();
|
|
1954
|
-
}, [
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
const g = window.setInterval(() => {
|
|
1959
|
-
const y = I.current.bootstrapConversation;
|
|
1960
|
-
y && (async () => {
|
|
2095
|
+
}, [g, D, t]), De = C(
|
|
2096
|
+
(d) => {
|
|
2097
|
+
const w = x.current.bootstrapConversation;
|
|
2098
|
+
w && (async () => {
|
|
1961
2099
|
try {
|
|
1962
|
-
const $ = await
|
|
1963
|
-
if (
|
|
2100
|
+
const $ = await w.call(x.current);
|
|
2101
|
+
if (Nt.current)
|
|
1964
2102
|
return;
|
|
1965
|
-
const Q = $.map(
|
|
1966
|
-
let
|
|
1967
|
-
|
|
2103
|
+
const Q = $.map(Ae);
|
|
2104
|
+
let ge = !1;
|
|
2105
|
+
j((Et) => es(Et, Q) ? Et : (ge = !0, Q)), ge && (d != null && d.refreshSidePanelsOnChange) && (ie(), oe());
|
|
1968
2106
|
} catch {
|
|
1969
2107
|
}
|
|
1970
2108
|
})();
|
|
1971
|
-
},
|
|
2109
|
+
},
|
|
2110
|
+
[ie, oe]
|
|
2111
|
+
), cn = C(
|
|
2112
|
+
(d) => {
|
|
2113
|
+
switch (d) {
|
|
2114
|
+
case ve.checklist:
|
|
2115
|
+
ie();
|
|
2116
|
+
return;
|
|
2117
|
+
case ve.resources:
|
|
2118
|
+
_e();
|
|
2119
|
+
return;
|
|
2120
|
+
case ve.chat:
|
|
2121
|
+
De();
|
|
2122
|
+
return;
|
|
2123
|
+
case ve.timeline:
|
|
2124
|
+
oe();
|
|
2125
|
+
return;
|
|
2126
|
+
case ve.all:
|
|
2127
|
+
default:
|
|
2128
|
+
ie(), _e(), De(), oe();
|
|
2129
|
+
}
|
|
2130
|
+
},
|
|
2131
|
+
[ie, De, _e, oe]
|
|
2132
|
+
), bt = wa({
|
|
2133
|
+
enabled: n && P,
|
|
2134
|
+
channelPrefix: A,
|
|
2135
|
+
agentId: e.id,
|
|
2136
|
+
subscribeToPusher: _,
|
|
2137
|
+
onRepoll: cn
|
|
2138
|
+
});
|
|
2139
|
+
H(() => {
|
|
2140
|
+
if (!n || f || bt)
|
|
2141
|
+
return;
|
|
2142
|
+
const d = window.setInterval(() => {
|
|
2143
|
+
De({ refreshSidePanelsOnChange: !0 });
|
|
2144
|
+
}, Xa);
|
|
1972
2145
|
return () => {
|
|
1973
|
-
window.clearInterval(
|
|
2146
|
+
window.clearInterval(d);
|
|
1974
2147
|
};
|
|
1975
|
-
}, [n,
|
|
1976
|
-
const
|
|
1977
|
-
(
|
|
1978
|
-
var
|
|
1979
|
-
|
|
2148
|
+
}, [n, f, bt, t, S, De]);
|
|
2149
|
+
const dn = C(
|
|
2150
|
+
(d) => {
|
|
2151
|
+
var w, $;
|
|
2152
|
+
d.checklist ? (re(d.checklist), ($ = (w = x.current).seedChecklist) == null || $.call(w, d.checklist)) : ie(), d.phase && Ee(d.phase), _e(), oe();
|
|
1980
2153
|
},
|
|
1981
|
-
[
|
|
2154
|
+
[ie, _e, oe]
|
|
1982
2155
|
);
|
|
1983
|
-
|
|
1984
|
-
var
|
|
1985
|
-
!n ||
|
|
1986
|
-
}, [n,
|
|
1987
|
-
if (!n ||
|
|
2156
|
+
H(() => {
|
|
2157
|
+
var d, w;
|
|
2158
|
+
!n || f || T && T.length > 0 && ((w = (d = x.current).seedChecklist) == null || w.call(d, T));
|
|
2159
|
+
}, [n, f, T]), H(() => {
|
|
2160
|
+
if (!n || f)
|
|
1988
2161
|
return;
|
|
1989
|
-
let
|
|
1990
|
-
return
|
|
1991
|
-
var
|
|
2162
|
+
let d = !1;
|
|
2163
|
+
return xe((w) => T != null && T.length ? !1 : w || se === null || se.length === 0), it(null), (async () => {
|
|
2164
|
+
var w, $;
|
|
1992
2165
|
try {
|
|
1993
|
-
const Q = await
|
|
1994
|
-
if (
|
|
2166
|
+
const Q = await q(t);
|
|
2167
|
+
if (d)
|
|
1995
2168
|
return;
|
|
1996
|
-
|
|
2169
|
+
T != null && T.length || (re(Q.checklist), ($ = (w = x.current).seedChecklist) == null || $.call(w, Q.checklist));
|
|
1997
2170
|
} catch {
|
|
1998
|
-
!
|
|
2171
|
+
!d && !(T != null && T.length) && it(Ze);
|
|
1999
2172
|
} finally {
|
|
2000
|
-
|
|
2173
|
+
d || xe(!1);
|
|
2001
2174
|
}
|
|
2002
2175
|
})(), () => {
|
|
2003
|
-
|
|
2176
|
+
d = !0;
|
|
2004
2177
|
};
|
|
2005
|
-
}, [n,
|
|
2178
|
+
}, [n, t, f, T, q]), H(() => {
|
|
2006
2179
|
if (!n || !c)
|
|
2007
2180
|
return;
|
|
2008
|
-
let
|
|
2009
|
-
return
|
|
2181
|
+
let d = !1;
|
|
2182
|
+
return Ie(!0), Ne(null), (async () => {
|
|
2010
2183
|
try {
|
|
2011
|
-
const
|
|
2012
|
-
|
|
2184
|
+
const w = await X(t);
|
|
2185
|
+
d || Re(w);
|
|
2013
2186
|
} catch {
|
|
2014
|
-
|
|
2187
|
+
d || Ne(On);
|
|
2015
2188
|
} finally {
|
|
2016
|
-
|
|
2189
|
+
d || Ie(!1);
|
|
2017
2190
|
}
|
|
2018
2191
|
})(), () => {
|
|
2019
|
-
|
|
2192
|
+
d = !0;
|
|
2020
2193
|
};
|
|
2021
|
-
}, [n,
|
|
2022
|
-
const
|
|
2023
|
-
|
|
2024
|
-
}, []),
|
|
2025
|
-
(
|
|
2026
|
-
if (
|
|
2027
|
-
window.open(
|
|
2194
|
+
}, [n, t, c, X]);
|
|
2195
|
+
const gn = C(() => {
|
|
2196
|
+
Be(null), Oe(null), Ue(null), Le(!1);
|
|
2197
|
+
}, []), hn = C(
|
|
2198
|
+
(d) => {
|
|
2199
|
+
if (d.misRecordUrl) {
|
|
2200
|
+
window.open(d.misRecordUrl, "_blank", "noopener,noreferrer");
|
|
2028
2201
|
return;
|
|
2029
2202
|
}
|
|
2030
|
-
|
|
2203
|
+
Be(d), Oe(null), Ue(null), Le(!0), (async () => {
|
|
2031
2204
|
try {
|
|
2032
|
-
const
|
|
2033
|
-
|
|
2205
|
+
const w = await Z(t, d.id);
|
|
2206
|
+
Oe(w);
|
|
2034
2207
|
} catch {
|
|
2035
|
-
|
|
2208
|
+
Ue(Ln);
|
|
2036
2209
|
} finally {
|
|
2037
|
-
|
|
2210
|
+
Le(!1);
|
|
2038
2211
|
}
|
|
2039
2212
|
})();
|
|
2040
2213
|
},
|
|
2041
|
-
[
|
|
2214
|
+
[Z, t]
|
|
2042
2215
|
);
|
|
2043
|
-
|
|
2044
|
-
if (!n || !
|
|
2216
|
+
H(() => {
|
|
2217
|
+
if (!n || !g)
|
|
2045
2218
|
return;
|
|
2046
|
-
let
|
|
2047
|
-
return
|
|
2219
|
+
let d = !1;
|
|
2220
|
+
return b((w) => w || de === null), V(null), (async () => {
|
|
2048
2221
|
try {
|
|
2049
|
-
const
|
|
2050
|
-
|
|
2222
|
+
const w = await D(t);
|
|
2223
|
+
d || Pe(w);
|
|
2051
2224
|
} catch {
|
|
2052
|
-
|
|
2225
|
+
d || V(Wt);
|
|
2053
2226
|
} finally {
|
|
2054
|
-
|
|
2227
|
+
d || b(!1);
|
|
2055
2228
|
}
|
|
2056
2229
|
})(), () => {
|
|
2057
|
-
|
|
2230
|
+
d = !0;
|
|
2058
2231
|
};
|
|
2059
|
-
}, [n,
|
|
2060
|
-
if (!n || !
|
|
2232
|
+
}, [n, t, g, D]), H(() => {
|
|
2233
|
+
if (!n || !f)
|
|
2061
2234
|
return;
|
|
2062
|
-
let
|
|
2063
|
-
const
|
|
2235
|
+
let d = !1;
|
|
2236
|
+
const w = {
|
|
2064
2237
|
id: `user-brief-${Date.now()}`,
|
|
2065
|
-
author:
|
|
2066
|
-
text:
|
|
2238
|
+
author: ne.user,
|
|
2239
|
+
text: Za(f, e.invocation_name)
|
|
2067
2240
|
};
|
|
2068
2241
|
return (async () => {
|
|
2069
|
-
var Q,
|
|
2070
|
-
const $ = await
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
]), $.checklist ? (
|
|
2242
|
+
var Q, ge;
|
|
2243
|
+
const $ = await x.current.start(f);
|
|
2244
|
+
d || (j([
|
|
2245
|
+
Ae(x.current.openingMessage()),
|
|
2246
|
+
Ae(w),
|
|
2247
|
+
Ae($.message)
|
|
2248
|
+
]), $.checklist ? (re($.checklist), (ge = (Q = x.current).seedChecklist) == null || ge.call(Q, $.checklist)) : ie(), Ee($.phase ?? B.running), _e(), oe());
|
|
2076
2249
|
})(), () => {
|
|
2077
|
-
|
|
2250
|
+
d = !0;
|
|
2078
2251
|
};
|
|
2079
2252
|
}, [
|
|
2080
2253
|
n,
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2254
|
+
f,
|
|
2255
|
+
e.invocation_name,
|
|
2256
|
+
t,
|
|
2257
|
+
ie,
|
|
2258
|
+
_e,
|
|
2259
|
+
oe
|
|
2087
2260
|
]);
|
|
2088
|
-
const
|
|
2089
|
-
|
|
2090
|
-
}, []),
|
|
2091
|
-
(
|
|
2092
|
-
).sessionId : void 0,
|
|
2093
|
-
|
|
2094
|
-
}, [
|
|
2095
|
-
(
|
|
2096
|
-
if (
|
|
2097
|
-
|
|
2261
|
+
const un = C((d) => {
|
|
2262
|
+
ce(ha(d));
|
|
2263
|
+
}, []), lt = I ?? t, Ve = de == null ? void 0 : de.chatSessions, Ct = Ve != null && Ve.length ? Ve.reduce(
|
|
2264
|
+
(d, w) => Date.parse(w.timestamp) < Date.parse(d.timestamp) ? w : d
|
|
2265
|
+
).sessionId : void 0, ct = C(() => {
|
|
2266
|
+
z("chat"), L(!1), S !== lt && (v(lt), j([]), ye((d) => d + 1));
|
|
2267
|
+
}, [S, lt]), pn = C(
|
|
2268
|
+
(d) => {
|
|
2269
|
+
if (d === Ct) {
|
|
2270
|
+
ct();
|
|
2098
2271
|
return;
|
|
2099
2272
|
}
|
|
2100
|
-
|
|
2273
|
+
v(d), L(!0), z("chat"), j([]), ye((w) => w + 1);
|
|
2101
2274
|
},
|
|
2102
|
-
[
|
|
2103
|
-
),
|
|
2104
|
-
|
|
2105
|
-
}, []),
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2275
|
+
[Ct, ct]
|
|
2276
|
+
), mn = C((d) => {
|
|
2277
|
+
ce(null), ke(d), ye((w) => w + 1);
|
|
2278
|
+
}, []), _n = C(async () => {
|
|
2279
|
+
kt(null), wt(!0);
|
|
2280
|
+
try {
|
|
2281
|
+
await x.current.stop(), Ee(B.stopped);
|
|
2282
|
+
} catch {
|
|
2283
|
+
kt(Un);
|
|
2284
|
+
} finally {
|
|
2285
|
+
wt(!1);
|
|
2286
|
+
}
|
|
2287
|
+
}, []), fn = se;
|
|
2288
|
+
return /* @__PURE__ */ l(ue, { open: n, closeHandler: s, hideCloseButton: !0, className: "agent-workspace", children: [
|
|
2289
|
+
/* @__PURE__ */ l(ue.Header, { className: "agent-workspace__header", children: [
|
|
2110
2290
|
/* @__PURE__ */ l("div", { className: "agent-workspace__header-title", children: [
|
|
2111
|
-
/* @__PURE__ */
|
|
2112
|
-
/* @__PURE__ */
|
|
2113
|
-
/* @__PURE__ */
|
|
2291
|
+
/* @__PURE__ */ a("span", { className: "agent-workspace__header-avatar", "aria-hidden": "true", children: /* @__PURE__ */ a(U, { name: "ask-arbor", size: 24 }) }),
|
|
2292
|
+
/* @__PURE__ */ a(ue.Title, { children: e.invocation_name }),
|
|
2293
|
+
/* @__PURE__ */ a(
|
|
2114
2294
|
"span",
|
|
2115
2295
|
{
|
|
2116
|
-
className:
|
|
2117
|
-
children:
|
|
2296
|
+
className: W("agent-workspace__phase", `agent-workspace__phase--${ae}`),
|
|
2297
|
+
children: Dn[ae]
|
|
2118
2298
|
}
|
|
2119
2299
|
)
|
|
2120
2300
|
] }),
|
|
2121
2301
|
/* @__PURE__ */ l("div", { className: "agent-workspace__header-actions", children: [
|
|
2122
|
-
/* @__PURE__ */
|
|
2123
|
-
|
|
2302
|
+
/* @__PURE__ */ a(
|
|
2303
|
+
te,
|
|
2124
2304
|
{
|
|
2125
|
-
variant:
|
|
2305
|
+
variant: We ? "secondary" : "primary",
|
|
2126
2306
|
size: "S",
|
|
2127
2307
|
iconLeftName: "clipboard-list",
|
|
2128
2308
|
iconLeftScreenReaderText: "Toggle checklist",
|
|
2129
|
-
"aria-pressed": !
|
|
2130
|
-
onClick: () =>
|
|
2309
|
+
"aria-pressed": !We,
|
|
2310
|
+
onClick: () => on((d) => !d),
|
|
2131
2311
|
children: "Checklist"
|
|
2132
2312
|
}
|
|
2133
2313
|
),
|
|
2134
|
-
/* @__PURE__ */
|
|
2135
|
-
|
|
2314
|
+
/* @__PURE__ */ a(
|
|
2315
|
+
te,
|
|
2136
2316
|
{
|
|
2137
|
-
variant:
|
|
2317
|
+
variant: je ? "secondary" : "primary",
|
|
2138
2318
|
size: "S",
|
|
2139
2319
|
iconLeftName: "files",
|
|
2140
2320
|
iconLeftScreenReaderText: "Toggle resources",
|
|
2141
|
-
"aria-pressed": !
|
|
2142
|
-
onClick: () =>
|
|
2321
|
+
"aria-pressed": !je,
|
|
2322
|
+
onClick: () => ln((d) => !d),
|
|
2143
2323
|
children: "Resources"
|
|
2144
2324
|
}
|
|
2145
2325
|
),
|
|
2146
|
-
/* @__PURE__ */
|
|
2147
|
-
|
|
2326
|
+
/* @__PURE__ */ a(
|
|
2327
|
+
te,
|
|
2148
2328
|
{
|
|
2149
2329
|
variant: "secondary",
|
|
2150
2330
|
size: "S",
|
|
2151
2331
|
iconLeftName: "x",
|
|
2152
2332
|
iconLeftScreenReaderText: "Close",
|
|
2153
|
-
onClick:
|
|
2333
|
+
onClick: s,
|
|
2154
2334
|
children: "Close"
|
|
2155
2335
|
}
|
|
2156
2336
|
)
|
|
2157
2337
|
] })
|
|
2158
2338
|
] }),
|
|
2159
2339
|
/* @__PURE__ */ l(
|
|
2160
|
-
|
|
2340
|
+
ue.Body,
|
|
2161
2341
|
{
|
|
2162
|
-
className:
|
|
2163
|
-
"agent-workspace__body--no-checklist":
|
|
2164
|
-
"agent-workspace__body--no-resources":
|
|
2342
|
+
className: W("agent-workspace__body", {
|
|
2343
|
+
"agent-workspace__body--no-checklist": We,
|
|
2344
|
+
"agent-workspace__body--no-resources": je
|
|
2165
2345
|
}),
|
|
2166
2346
|
children: [
|
|
2167
|
-
" ",
|
|
2168
2347
|
/* @__PURE__ */ l(
|
|
2169
2348
|
"section",
|
|
2170
2349
|
{
|
|
2171
|
-
className:
|
|
2172
|
-
"agent-workspace__panel--timeline": !!
|
|
2350
|
+
className: W("agent-workspace__panel", "agent-workspace__panel--chat", {
|
|
2351
|
+
"agent-workspace__panel--timeline": !!g && R === "timeline"
|
|
2173
2352
|
}),
|
|
2174
2353
|
"aria-label": "Agent",
|
|
2175
2354
|
children: [
|
|
2176
2355
|
/* @__PURE__ */ l("div", { className: "agent-workspace__panel-header", children: [
|
|
2177
|
-
/* @__PURE__ */
|
|
2178
|
-
|
|
2179
|
-
|
|
2356
|
+
/* @__PURE__ */ a(be, { level: 4, children: "Agent" }),
|
|
2357
|
+
y && ae === B.running && /* @__PURE__ */ a(
|
|
2358
|
+
te,
|
|
2180
2359
|
{
|
|
2181
2360
|
className: "agent-workspace__panel-header-action",
|
|
2182
2361
|
variant: "secondary-destructive",
|
|
2183
2362
|
size: "S",
|
|
2184
2363
|
iconLeftName: "circle-x",
|
|
2185
2364
|
iconLeftScreenReaderText: "Stop",
|
|
2186
|
-
|
|
2187
|
-
|
|
2365
|
+
disabled: vt,
|
|
2366
|
+
onClick: () => void _n(),
|
|
2367
|
+
children: vt ? "Stopping…" : "Stop agent"
|
|
2188
2368
|
}
|
|
2189
2369
|
)
|
|
2190
2370
|
] }),
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2371
|
+
yt && /* @__PURE__ */ a("p", { className: "agent-workspace__error agent-workspace__stop-error", role: "alert", children: yt }),
|
|
2372
|
+
g && /* @__PURE__ */ l(dt, { className: "agent-workspace__center-tabs", "aria-label": "Center panel", children: [
|
|
2373
|
+
/* @__PURE__ */ a(
|
|
2374
|
+
dt.Item,
|
|
2194
2375
|
{
|
|
2195
|
-
active:
|
|
2376
|
+
active: R === "chat",
|
|
2196
2377
|
tabElementProps: {
|
|
2197
2378
|
id: "agent-center-tab-chat",
|
|
2198
|
-
onClick: () =>
|
|
2379
|
+
onClick: () => z("chat")
|
|
2199
2380
|
},
|
|
2200
2381
|
children: "Chat"
|
|
2201
2382
|
}
|
|
2202
2383
|
),
|
|
2203
|
-
/* @__PURE__ */
|
|
2204
|
-
|
|
2384
|
+
/* @__PURE__ */ a(
|
|
2385
|
+
dt.Item,
|
|
2205
2386
|
{
|
|
2206
|
-
active:
|
|
2387
|
+
active: R === "timeline",
|
|
2207
2388
|
tabElementProps: {
|
|
2208
2389
|
id: "agent-center-tab-timeline",
|
|
2209
|
-
onClick: () =>
|
|
2390
|
+
onClick: () => z("timeline")
|
|
2210
2391
|
},
|
|
2211
2392
|
children: "Timeline"
|
|
2212
2393
|
}
|
|
2213
2394
|
)
|
|
2214
2395
|
] }),
|
|
2215
|
-
|
|
2216
|
-
|
|
2396
|
+
g && R === "chat" && Ce && /* @__PURE__ */ a("div", { className: "agent-workspace__center-back", children: /* @__PURE__ */ a(
|
|
2397
|
+
te,
|
|
2217
2398
|
{
|
|
2218
2399
|
variant: "tertiary",
|
|
2219
2400
|
size: "S",
|
|
2220
2401
|
iconLeftName: "arrow-left",
|
|
2221
2402
|
iconLeftScreenReaderText: "Back to main chat",
|
|
2222
|
-
onClick:
|
|
2403
|
+
onClick: ct,
|
|
2223
2404
|
children: "Back to main chat"
|
|
2224
2405
|
}
|
|
2225
2406
|
) }),
|
|
2226
|
-
|
|
2227
|
-
|
|
2407
|
+
g && R === "timeline" && /* @__PURE__ */ a(
|
|
2408
|
+
da,
|
|
2228
2409
|
{
|
|
2229
|
-
timeline:
|
|
2230
|
-
isLoading:
|
|
2231
|
-
error:
|
|
2232
|
-
onOpenChatSession:
|
|
2410
|
+
timeline: de,
|
|
2411
|
+
isLoading: u,
|
|
2412
|
+
error: k,
|
|
2413
|
+
onOpenChatSession: pn
|
|
2233
2414
|
}
|
|
2234
2415
|
),
|
|
2235
|
-
/* @__PURE__ */
|
|
2416
|
+
/* @__PURE__ */ a(
|
|
2236
2417
|
"div",
|
|
2237
2418
|
{
|
|
2238
2419
|
className: "agent-workspace__chat-keep-alive",
|
|
2239
|
-
hidden: !!
|
|
2240
|
-
children: /* @__PURE__ */
|
|
2241
|
-
|
|
2420
|
+
hidden: !!g && R !== "chat",
|
|
2421
|
+
children: /* @__PURE__ */ a(
|
|
2422
|
+
Xn,
|
|
2242
2423
|
{
|
|
2243
|
-
connector:
|
|
2244
|
-
phase:
|
|
2245
|
-
chatHistory:
|
|
2246
|
-
chatSessionKey:
|
|
2247
|
-
startQuery:
|
|
2248
|
-
clarificationMessage:
|
|
2249
|
-
enableUpload:
|
|
2250
|
-
onTurn:
|
|
2251
|
-
onAwaitingChange:
|
|
2252
|
-
onClarificationPrompt:
|
|
2253
|
-
onDismissClarification: () =>
|
|
2424
|
+
connector: G,
|
|
2425
|
+
phase: ae,
|
|
2426
|
+
chatHistory: He,
|
|
2427
|
+
chatSessionKey: ze,
|
|
2428
|
+
startQuery: Te,
|
|
2429
|
+
clarificationMessage: at,
|
|
2430
|
+
enableUpload: O,
|
|
2431
|
+
onTurn: dn,
|
|
2432
|
+
onAwaitingChange: ot,
|
|
2433
|
+
onClarificationPrompt: mn,
|
|
2434
|
+
onDismissClarification: () => ce(null)
|
|
2254
2435
|
}
|
|
2255
2436
|
)
|
|
2256
2437
|
}
|
|
@@ -2258,282 +2439,282 @@ const Bt = (t, e) => (n) => {
|
|
|
2258
2439
|
]
|
|
2259
2440
|
}
|
|
2260
2441
|
),
|
|
2261
|
-
!
|
|
2262
|
-
|
|
2442
|
+
!We && /* @__PURE__ */ a(
|
|
2443
|
+
Zn,
|
|
2263
2444
|
{
|
|
2264
|
-
checklist:
|
|
2265
|
-
isLoading:
|
|
2266
|
-
error:
|
|
2267
|
-
phase:
|
|
2268
|
-
canRequestInput:
|
|
2269
|
-
onAttentionItemClick:
|
|
2445
|
+
checklist: fn,
|
|
2446
|
+
isLoading: me,
|
|
2447
|
+
error: rn,
|
|
2448
|
+
phase: ae,
|
|
2449
|
+
canRequestInput: ae === B.running && !Ke,
|
|
2450
|
+
onAttentionItemClick: un
|
|
2270
2451
|
}
|
|
2271
2452
|
),
|
|
2272
|
-
!
|
|
2273
|
-
|
|
2453
|
+
!je && /* @__PURE__ */ a(
|
|
2454
|
+
ta,
|
|
2274
2455
|
{
|
|
2275
|
-
resources:
|
|
2276
|
-
isLoading:
|
|
2277
|
-
error:
|
|
2278
|
-
onOpenResource:
|
|
2456
|
+
resources: st,
|
|
2457
|
+
isLoading: pe,
|
|
2458
|
+
error: Ge,
|
|
2459
|
+
onOpenResource: hn
|
|
2279
2460
|
}
|
|
2280
2461
|
),
|
|
2281
|
-
/* @__PURE__ */
|
|
2282
|
-
|
|
2462
|
+
/* @__PURE__ */ a(
|
|
2463
|
+
Qn,
|
|
2283
2464
|
{
|
|
2284
|
-
resource:
|
|
2285
|
-
html:
|
|
2286
|
-
isLoading:
|
|
2287
|
-
error:
|
|
2288
|
-
onClose:
|
|
2465
|
+
resource: Fe,
|
|
2466
|
+
html: qe,
|
|
2467
|
+
isLoading: Je,
|
|
2468
|
+
error: rt,
|
|
2469
|
+
onClose: gn
|
|
2289
2470
|
}
|
|
2290
2471
|
)
|
|
2291
2472
|
]
|
|
2292
2473
|
}
|
|
2293
2474
|
)
|
|
2294
2475
|
] });
|
|
2295
|
-
},
|
|
2296
|
-
open:
|
|
2297
|
-
onClose:
|
|
2476
|
+
}, ns = "Unable to load agent definitions. Please try again.", as = "Unable to start the agent.", Gt = "Loading agents…", sn = ({
|
|
2477
|
+
open: e,
|
|
2478
|
+
onClose: t,
|
|
2298
2479
|
onStart: n,
|
|
2299
|
-
agentDefinitions:
|
|
2480
|
+
agentDefinitions: s,
|
|
2300
2481
|
definitionsState: r = "idle",
|
|
2301
2482
|
definitionsError: o = null,
|
|
2302
2483
|
onRetryDefinitions: i,
|
|
2303
|
-
embedded:
|
|
2484
|
+
embedded: p = !1
|
|
2304
2485
|
}) => {
|
|
2305
|
-
const [c,
|
|
2306
|
-
value:
|
|
2307
|
-
label:
|
|
2486
|
+
const [c, g] = h(void 0), [m, N] = h(""), [y, I] = h(!1), [O, f] = h(null), K = [...s].sort((v, R) => v.display_name.localeCompare(R.display_name)).map((v) => ({
|
|
2487
|
+
value: v.ref,
|
|
2488
|
+
label: v.display_name
|
|
2308
2489
|
}));
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
}, [
|
|
2312
|
-
const
|
|
2313
|
-
(
|
|
2314
|
-
const
|
|
2315
|
-
|
|
2490
|
+
H(() => {
|
|
2491
|
+
e && (g(void 0), N(""), I(!1), f(null));
|
|
2492
|
+
}, [e]);
|
|
2493
|
+
const T = c !== void 0 && m.trim().length > 0, P = C(
|
|
2494
|
+
(v) => {
|
|
2495
|
+
const R = s.find((z) => z.ref === v[0]);
|
|
2496
|
+
R && g(R);
|
|
2316
2497
|
},
|
|
2317
|
-
[
|
|
2318
|
-
),
|
|
2319
|
-
if (!(!c || !
|
|
2320
|
-
|
|
2498
|
+
[s]
|
|
2499
|
+
), A = C(async () => {
|
|
2500
|
+
if (!(!c || !T || y)) {
|
|
2501
|
+
I(!0), f(null);
|
|
2321
2502
|
try {
|
|
2322
|
-
await n({ definition: c, invocationName:
|
|
2323
|
-
} catch (
|
|
2324
|
-
|
|
2503
|
+
await n({ definition: c, invocationName: m.trim() });
|
|
2504
|
+
} catch (v) {
|
|
2505
|
+
f(v instanceof Error ? v.message : as);
|
|
2325
2506
|
} finally {
|
|
2326
|
-
|
|
2507
|
+
I(!1);
|
|
2327
2508
|
}
|
|
2328
2509
|
}
|
|
2329
|
-
}, [
|
|
2330
|
-
if (r === "idle" &&
|
|
2510
|
+
}, [T, c, m, y, n]);
|
|
2511
|
+
if (r === "idle" && s.length === 0 || !e)
|
|
2331
2512
|
return null;
|
|
2332
|
-
const
|
|
2333
|
-
/* @__PURE__ */
|
|
2334
|
-
|
|
2513
|
+
const _ = /* @__PURE__ */ l("div", { className: "new-agent__header-title", children: [
|
|
2514
|
+
/* @__PURE__ */ a("span", { className: "new-agent__header-avatar", "aria-hidden": "true", children: /* @__PURE__ */ a(U, { name: "ask-arbor", size: 24 }) }),
|
|
2515
|
+
p ? /* @__PURE__ */ a("h2", { className: "new-agent__title", children: "Start an agent" }) : /* @__PURE__ */ a(ue.Title, { children: "Start an agent" })
|
|
2335
2516
|
] });
|
|
2336
|
-
let
|
|
2337
|
-
return r === "loading" ?
|
|
2338
|
-
/* @__PURE__ */
|
|
2339
|
-
|
|
2517
|
+
let S;
|
|
2518
|
+
return r === "loading" ? S = /* @__PURE__ */ l("div", { className: "new-agent__state", "aria-live": "polite", children: [
|
|
2519
|
+
/* @__PURE__ */ a(
|
|
2520
|
+
U,
|
|
2340
2521
|
{
|
|
2341
2522
|
name: "loader",
|
|
2342
2523
|
size: 24,
|
|
2343
2524
|
color: "var(--color-brand-600)",
|
|
2344
2525
|
className: "new-agent__spinner",
|
|
2345
|
-
screenReaderText:
|
|
2526
|
+
screenReaderText: Gt
|
|
2346
2527
|
}
|
|
2347
2528
|
),
|
|
2348
|
-
/* @__PURE__ */
|
|
2349
|
-
] }) : r === "error" ?
|
|
2350
|
-
/* @__PURE__ */
|
|
2351
|
-
/* @__PURE__ */
|
|
2352
|
-
i ? /* @__PURE__ */
|
|
2353
|
-
] }) :
|
|
2529
|
+
/* @__PURE__ */ a("p", { className: "new-agent__state-message", children: Gt })
|
|
2530
|
+
] }) : r === "error" ? S = /* @__PURE__ */ l("div", { className: "new-agent__state new-agent__state--error", role: "alert", children: [
|
|
2531
|
+
/* @__PURE__ */ a(U, { name: "triangle-alert", size: 24, color: "var(--color-semantic-destructive-600)" }),
|
|
2532
|
+
/* @__PURE__ */ a("p", { className: "new-agent__state-message", children: o ?? ns }),
|
|
2533
|
+
i ? /* @__PURE__ */ a(te, { variant: "secondary", size: "S", onClick: i, children: "Try again" }) : null
|
|
2534
|
+
] }) : S = /* @__PURE__ */ l(
|
|
2354
2535
|
"form",
|
|
2355
2536
|
{
|
|
2356
2537
|
className: "new-agent__form",
|
|
2357
2538
|
"aria-label": "Start an agent",
|
|
2358
|
-
onSubmit: (
|
|
2359
|
-
|
|
2539
|
+
onSubmit: (v) => {
|
|
2540
|
+
v.preventDefault(), T && !y && A();
|
|
2360
2541
|
},
|
|
2361
2542
|
children: [
|
|
2362
2543
|
/* @__PURE__ */ l("div", { className: "new-agent__type-field", children: [
|
|
2363
|
-
/* @__PURE__ */
|
|
2364
|
-
/* @__PURE__ */
|
|
2365
|
-
|
|
2544
|
+
/* @__PURE__ */ a("label", { className: "new-agent__type-label", htmlFor: "new-agent-type", children: "What would you like your agent to do?" }),
|
|
2545
|
+
/* @__PURE__ */ a(
|
|
2546
|
+
wn,
|
|
2366
2547
|
{
|
|
2367
2548
|
id: "new-agent-type",
|
|
2368
2549
|
placeholder: "Which agent would you like to start?",
|
|
2369
|
-
options:
|
|
2550
|
+
options: K,
|
|
2370
2551
|
selectedValues: c ? [c.ref] : [],
|
|
2371
|
-
onSelectionChange:
|
|
2552
|
+
onSelectionChange: P
|
|
2372
2553
|
}
|
|
2373
2554
|
)
|
|
2374
2555
|
] }),
|
|
2375
2556
|
/* @__PURE__ */ l("div", { className: "new-agent__type-field", children: [
|
|
2376
|
-
/* @__PURE__ */
|
|
2377
|
-
/* @__PURE__ */
|
|
2378
|
-
|
|
2557
|
+
/* @__PURE__ */ a("label", { className: "new-agent__type-label", htmlFor: "new-agent-invocation-name", children: "Name" }),
|
|
2558
|
+
/* @__PURE__ */ a(
|
|
2559
|
+
yn,
|
|
2379
2560
|
{
|
|
2380
2561
|
id: "new-agent-invocation-name",
|
|
2381
|
-
value:
|
|
2562
|
+
value: m,
|
|
2382
2563
|
placeholder: "What would you like to call your agent?",
|
|
2383
|
-
onChange: (
|
|
2564
|
+
onChange: (v) => N(v.target.value)
|
|
2384
2565
|
}
|
|
2385
2566
|
)
|
|
2386
2567
|
] }),
|
|
2387
|
-
|
|
2388
|
-
/* @__PURE__ */
|
|
2389
|
-
|
|
2568
|
+
O ? /* @__PURE__ */ a("p", { className: "new-agent__error", role: "alert", children: O }) : null,
|
|
2569
|
+
/* @__PURE__ */ a("div", { className: "new-agent__actions", children: /* @__PURE__ */ a(
|
|
2570
|
+
te,
|
|
2390
2571
|
{
|
|
2391
2572
|
type: "submit",
|
|
2392
2573
|
variant: "primary",
|
|
2393
|
-
className:
|
|
2394
|
-
"new-agent__start-button--starting":
|
|
2574
|
+
className: W("new-agent__start-button", {
|
|
2575
|
+
"new-agent__start-button--starting": y
|
|
2395
2576
|
}),
|
|
2396
|
-
disabled: !
|
|
2397
|
-
iconLeftName:
|
|
2398
|
-
iconLeftScreenReaderText:
|
|
2399
|
-
children:
|
|
2577
|
+
disabled: !T || y,
|
|
2578
|
+
iconLeftName: y ? "loader" : "sparkles",
|
|
2579
|
+
iconLeftScreenReaderText: y ? "Starting" : void 0,
|
|
2580
|
+
children: y ? "Starting…" : "Start"
|
|
2400
2581
|
}
|
|
2401
2582
|
) })
|
|
2402
2583
|
]
|
|
2403
2584
|
}
|
|
2404
|
-
),
|
|
2405
|
-
/* @__PURE__ */
|
|
2406
|
-
/* @__PURE__ */
|
|
2407
|
-
] }) : /* @__PURE__ */ l(
|
|
2408
|
-
/* @__PURE__ */
|
|
2409
|
-
/* @__PURE__ */
|
|
2585
|
+
), p ? /* @__PURE__ */ l("div", { className: W("new-agent", "new-agent--embedded"), children: [
|
|
2586
|
+
/* @__PURE__ */ a("div", { className: "new-agent__header", children: _ }),
|
|
2587
|
+
/* @__PURE__ */ a("div", { className: "new-agent__body", children: S })
|
|
2588
|
+
] }) : /* @__PURE__ */ l(ue, { open: e, closeHandler: t, className: "new-agent", children: [
|
|
2589
|
+
/* @__PURE__ */ a(ue.Header, { className: "new-agent__header", children: _ }),
|
|
2590
|
+
/* @__PURE__ */ a(ue.Body, { className: "new-agent__body", children: S })
|
|
2410
2591
|
] });
|
|
2411
|
-
},
|
|
2412
|
-
window.location.assign(
|
|
2413
|
-
},
|
|
2414
|
-
open:
|
|
2415
|
-
authToken:
|
|
2592
|
+
}, Ft = (e) => {
|
|
2593
|
+
window.location.assign(e);
|
|
2594
|
+
}, ss = ({
|
|
2595
|
+
open: e,
|
|
2596
|
+
authToken: t,
|
|
2416
2597
|
headers: n,
|
|
2417
|
-
agentDefinitionsUrl:
|
|
2598
|
+
agentDefinitionsUrl: s,
|
|
2418
2599
|
agentsUrl: r,
|
|
2419
2600
|
closeUrl: o,
|
|
2420
2601
|
successUrl: i,
|
|
2421
|
-
onClose:
|
|
2602
|
+
onClose: p,
|
|
2422
2603
|
onStart: c,
|
|
2423
|
-
embedded:
|
|
2604
|
+
embedded: g = !1
|
|
2424
2605
|
}) => {
|
|
2425
|
-
const
|
|
2426
|
-
() => new
|
|
2427
|
-
token:
|
|
2606
|
+
const m = JSON.stringify(n ?? {}), N = Y(
|
|
2607
|
+
() => new ft({
|
|
2608
|
+
token: t,
|
|
2428
2609
|
headers: n,
|
|
2429
2610
|
urls: {
|
|
2430
|
-
agentDefinitions:
|
|
2611
|
+
agentDefinitions: s,
|
|
2431
2612
|
agents: r
|
|
2432
2613
|
}
|
|
2433
2614
|
}),
|
|
2434
2615
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- keyed on serialised config to keep a stable client.
|
|
2435
|
-
[
|
|
2436
|
-
), [
|
|
2437
|
-
|
|
2438
|
-
if (!
|
|
2616
|
+
[t, s, r, m]
|
|
2617
|
+
), [y, I] = h([]), [O, f] = h("loading"), [K, T] = h(null), [P, A] = h(0);
|
|
2618
|
+
H(() => {
|
|
2619
|
+
if (!e)
|
|
2439
2620
|
return;
|
|
2440
|
-
let
|
|
2441
|
-
return
|
|
2621
|
+
let R = !1;
|
|
2622
|
+
return f("loading"), T(null), (async () => {
|
|
2442
2623
|
try {
|
|
2443
|
-
const
|
|
2444
|
-
if (
|
|
2624
|
+
const z = await N.listAgentDefinitions();
|
|
2625
|
+
if (R)
|
|
2445
2626
|
return;
|
|
2446
|
-
|
|
2447
|
-
} catch (
|
|
2448
|
-
if (
|
|
2627
|
+
I(z.map(Qt)), f("idle");
|
|
2628
|
+
} catch (z) {
|
|
2629
|
+
if (R)
|
|
2449
2630
|
return;
|
|
2450
|
-
|
|
2631
|
+
I([]), T(an(z)), f("error");
|
|
2451
2632
|
}
|
|
2452
2633
|
})(), () => {
|
|
2453
|
-
|
|
2634
|
+
R = !0;
|
|
2454
2635
|
};
|
|
2455
|
-
}, [
|
|
2456
|
-
const
|
|
2457
|
-
|
|
2458
|
-
}, [o,
|
|
2459
|
-
async (
|
|
2460
|
-
await
|
|
2461
|
-
invocationName:
|
|
2462
|
-
}), c == null || c(
|
|
2636
|
+
}, [N, e, P]);
|
|
2637
|
+
const _ = C(() => {
|
|
2638
|
+
p == null || p(), o && Ft(o);
|
|
2639
|
+
}, [o, p]), S = C(
|
|
2640
|
+
async (R) => {
|
|
2641
|
+
await N.createAgent(R.definition.ref, {
|
|
2642
|
+
invocationName: R.invocationName
|
|
2643
|
+
}), c == null || c(R), i && Ft(i);
|
|
2463
2644
|
},
|
|
2464
|
-
[
|
|
2465
|
-
),
|
|
2466
|
-
|
|
2645
|
+
[N, c, i]
|
|
2646
|
+
), v = C(() => {
|
|
2647
|
+
A((R) => R + 1);
|
|
2467
2648
|
}, []);
|
|
2468
|
-
return /* @__PURE__ */
|
|
2469
|
-
|
|
2649
|
+
return /* @__PURE__ */ a(
|
|
2650
|
+
sn,
|
|
2470
2651
|
{
|
|
2471
|
-
open:
|
|
2472
|
-
onClose:
|
|
2473
|
-
onStart:
|
|
2474
|
-
agentDefinitions:
|
|
2475
|
-
definitionsState:
|
|
2476
|
-
definitionsError:
|
|
2477
|
-
onRetryDefinitions:
|
|
2478
|
-
embedded:
|
|
2652
|
+
open: e,
|
|
2653
|
+
onClose: _,
|
|
2654
|
+
onStart: S,
|
|
2655
|
+
agentDefinitions: y,
|
|
2656
|
+
definitionsState: O,
|
|
2657
|
+
definitionsError: K,
|
|
2658
|
+
onRetryDefinitions: v,
|
|
2659
|
+
embedded: g
|
|
2479
2660
|
}
|
|
2480
2661
|
);
|
|
2481
|
-
},
|
|
2482
|
-
|
|
2662
|
+
}, rs = (e) => "agentDefinitionsUrl" in e, is = (e) => rs(e) ? /* @__PURE__ */ a(ss, { ...e }) : /* @__PURE__ */ a(sn, { ...e }), os = (e) => e !== void 0 && e.some((t) => t.status === M.hitl), ls = (e, t) => os(t) ? E.hitl : e.status, cs = ({ column: e, label: t }) => e.statusIcon ? /* @__PURE__ */ a("span", { className: "agent-view__status-indicator", children: /* @__PURE__ */ a(
|
|
2663
|
+
U,
|
|
2483
2664
|
{
|
|
2484
|
-
name:
|
|
2665
|
+
name: e.statusIcon.name,
|
|
2485
2666
|
size: 16,
|
|
2486
|
-
color:
|
|
2487
|
-
className:
|
|
2488
|
-
"agent-view__progress-icon--spinning":
|
|
2667
|
+
color: e.statusIcon.color,
|
|
2668
|
+
className: W({
|
|
2669
|
+
"agent-view__progress-icon--spinning": e.statusIcon.spin
|
|
2489
2670
|
}),
|
|
2490
|
-
screenReaderText:
|
|
2671
|
+
screenReaderText: t
|
|
2491
2672
|
}
|
|
2492
|
-
) }) : /* @__PURE__ */
|
|
2673
|
+
) }) : /* @__PURE__ */ a(
|
|
2493
2674
|
"span",
|
|
2494
2675
|
{
|
|
2495
|
-
className:
|
|
2496
|
-
[`agent-view__dot--${
|
|
2676
|
+
className: W("agent-view__dot", {
|
|
2677
|
+
[`agent-view__dot--${e.dotModifier}`]: e.dotModifier
|
|
2497
2678
|
}),
|
|
2498
|
-
children: /* @__PURE__ */
|
|
2679
|
+
children: /* @__PURE__ */ a(qt, { colour: e.dotColour, label: t })
|
|
2499
2680
|
}
|
|
2500
|
-
),
|
|
2501
|
-
agent:
|
|
2502
|
-
agentName:
|
|
2681
|
+
), ds = ({
|
|
2682
|
+
agent: e,
|
|
2683
|
+
agentName: t,
|
|
2503
2684
|
column: n,
|
|
2504
|
-
isExpanded:
|
|
2685
|
+
isExpanded: s,
|
|
2505
2686
|
isLoading: r,
|
|
2506
2687
|
checklist: o,
|
|
2507
2688
|
error: i,
|
|
2508
|
-
onToggle:
|
|
2689
|
+
onToggle: p,
|
|
2509
2690
|
onViewAgent: c
|
|
2510
2691
|
}) => {
|
|
2511
|
-
const { id:
|
|
2512
|
-
return /* @__PURE__ */
|
|
2692
|
+
const { id: g, invocation_name: m } = e, N = `agent-card-${g}-header`, y = `agent-card-${g}-progress`;
|
|
2693
|
+
return /* @__PURE__ */ a(
|
|
2513
2694
|
"li",
|
|
2514
2695
|
{
|
|
2515
|
-
className:
|
|
2516
|
-
"agent-view__card--expanded":
|
|
2696
|
+
className: W("agent-view__card", {
|
|
2697
|
+
"agent-view__card--expanded": s
|
|
2517
2698
|
}),
|
|
2518
|
-
children: /* @__PURE__ */ l(
|
|
2519
|
-
/* @__PURE__ */
|
|
2699
|
+
children: /* @__PURE__ */ l(kn, { spacing: "dense", children: [
|
|
2700
|
+
/* @__PURE__ */ a(
|
|
2520
2701
|
"button",
|
|
2521
2702
|
{
|
|
2522
2703
|
type: "button",
|
|
2523
2704
|
className: "agent-view__card-toggle",
|
|
2524
|
-
"aria-expanded":
|
|
2525
|
-
"aria-controls":
|
|
2526
|
-
"aria-label":
|
|
2527
|
-
id:
|
|
2528
|
-
onClick: () =>
|
|
2705
|
+
"aria-expanded": s,
|
|
2706
|
+
"aria-controls": y,
|
|
2707
|
+
"aria-label": m,
|
|
2708
|
+
id: N,
|
|
2709
|
+
onClick: () => p(g),
|
|
2529
2710
|
children: /* @__PURE__ */ l("div", { className: "agent-view__card-content", children: [
|
|
2530
|
-
/* @__PURE__ */
|
|
2531
|
-
/* @__PURE__ */
|
|
2532
|
-
/* @__PURE__ */
|
|
2533
|
-
/* @__PURE__ */
|
|
2534
|
-
|
|
2711
|
+
/* @__PURE__ */ a(cs, { column: n }),
|
|
2712
|
+
/* @__PURE__ */ a("span", { className: "agent-view__card-invocation-name", children: m }),
|
|
2713
|
+
/* @__PURE__ */ a("span", { className: "agent-view__card-agent-name", children: t }),
|
|
2714
|
+
/* @__PURE__ */ a(
|
|
2715
|
+
U,
|
|
2535
2716
|
{
|
|
2536
|
-
name:
|
|
2717
|
+
name: s ? "chevron-up" : "chevron-down",
|
|
2537
2718
|
size: 16,
|
|
2538
2719
|
className: "agent-view__card-chevron"
|
|
2539
2720
|
}
|
|
@@ -2541,290 +2722,278 @@ const Bt = (t, e) => (n) => {
|
|
|
2541
2722
|
] })
|
|
2542
2723
|
}
|
|
2543
2724
|
),
|
|
2544
|
-
|
|
2545
|
-
"div",
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
}
|
|
2576
|
-
),
|
|
2577
|
-
/* @__PURE__ */ s("span", { children: ke })
|
|
2578
|
-
] }),
|
|
2579
|
-
/* @__PURE__ */ s("div", { className: "agent-view__card-actions", children: /* @__PURE__ */ s(
|
|
2580
|
-
ee,
|
|
2581
|
-
{
|
|
2582
|
-
variant: "secondary",
|
|
2583
|
-
size: "S",
|
|
2584
|
-
onClick: () => c == null ? void 0 : c(t),
|
|
2585
|
-
children: "View agent"
|
|
2586
|
-
}
|
|
2587
|
-
) })
|
|
2588
|
-
]
|
|
2589
|
-
}
|
|
2590
|
-
)
|
|
2725
|
+
s && /* @__PURE__ */ l("div", { id: y, "aria-labelledby": N, className: "agent-view__card-progress", children: [
|
|
2726
|
+
r && /* @__PURE__ */ l("div", { className: "agent-view__progress-loading", "aria-live": "polite", children: [
|
|
2727
|
+
/* @__PURE__ */ a(
|
|
2728
|
+
U,
|
|
2729
|
+
{
|
|
2730
|
+
name: "loader",
|
|
2731
|
+
size: 16,
|
|
2732
|
+
color: "var(--color-brand-600)",
|
|
2733
|
+
className: "agent-view__progress-icon--spinning",
|
|
2734
|
+
screenReaderText: Se
|
|
2735
|
+
}
|
|
2736
|
+
),
|
|
2737
|
+
/* @__PURE__ */ a("span", { children: Se })
|
|
2738
|
+
] }),
|
|
2739
|
+
!r && i && /* @__PURE__ */ a("p", { className: "agent-view__progress-error", role: "alert", children: i }),
|
|
2740
|
+
!r && !i && o !== null && /* @__PURE__ */ a(jn, { checklist: o }),
|
|
2741
|
+
!r && !i && o === null && /* @__PURE__ */ l("div", { className: "agent-view__progress-loading", "aria-live": "polite", children: [
|
|
2742
|
+
/* @__PURE__ */ a(
|
|
2743
|
+
U,
|
|
2744
|
+
{
|
|
2745
|
+
name: "loader",
|
|
2746
|
+
size: 16,
|
|
2747
|
+
color: "var(--color-brand-600)",
|
|
2748
|
+
className: "agent-view__progress-icon--spinning",
|
|
2749
|
+
screenReaderText: Se
|
|
2750
|
+
}
|
|
2751
|
+
),
|
|
2752
|
+
/* @__PURE__ */ a("span", { children: Se })
|
|
2753
|
+
] }),
|
|
2754
|
+
/* @__PURE__ */ a("div", { className: "agent-view__card-actions", children: /* @__PURE__ */ a(te, { variant: "secondary", size: "S", onClick: () => c == null ? void 0 : c(e), children: "View agent" }) })
|
|
2755
|
+
] })
|
|
2591
2756
|
] })
|
|
2592
2757
|
}
|
|
2593
2758
|
);
|
|
2594
|
-
},
|
|
2595
|
-
column:
|
|
2596
|
-
agents:
|
|
2759
|
+
}, Bt = ({
|
|
2760
|
+
column: e,
|
|
2761
|
+
agents: t,
|
|
2597
2762
|
expandedAgentId: n,
|
|
2598
|
-
loadingAgentId:
|
|
2763
|
+
loadingAgentId: s,
|
|
2599
2764
|
checklistByInvocationId: r,
|
|
2600
2765
|
errorByAgentId: o,
|
|
2601
2766
|
definitionNameByRef: i,
|
|
2602
|
-
onToggleAgent:
|
|
2767
|
+
onToggleAgent: p,
|
|
2603
2768
|
onViewAgent: c,
|
|
2604
|
-
isSplit:
|
|
2769
|
+
isSplit: g = !1
|
|
2605
2770
|
}) => /* @__PURE__ */ l(
|
|
2606
2771
|
"section",
|
|
2607
2772
|
{
|
|
2608
|
-
className:
|
|
2609
|
-
"agent-view__column--split":
|
|
2773
|
+
className: W("agent-view__column", {
|
|
2774
|
+
"agent-view__column--split": g
|
|
2610
2775
|
}),
|
|
2611
|
-
"aria-label":
|
|
2776
|
+
"aria-label": e.title,
|
|
2612
2777
|
children: [
|
|
2613
2778
|
/* @__PURE__ */ l("div", { className: "agent-view__column-header", children: [
|
|
2614
|
-
/* @__PURE__ */
|
|
2615
|
-
/* @__PURE__ */
|
|
2779
|
+
/* @__PURE__ */ a(be, { level: 4, children: e.title }),
|
|
2780
|
+
/* @__PURE__ */ a("span", { className: "agent-view__column-count", children: t.length })
|
|
2616
2781
|
] }),
|
|
2617
|
-
/* @__PURE__ */
|
|
2618
|
-
|
|
2782
|
+
/* @__PURE__ */ a("ul", { className: "agent-view__card-list", children: t.map((m) => /* @__PURE__ */ a(
|
|
2783
|
+
ds,
|
|
2619
2784
|
{
|
|
2620
|
-
agent:
|
|
2621
|
-
agentName:
|
|
2622
|
-
column:
|
|
2623
|
-
isExpanded: n ===
|
|
2624
|
-
isLoading:
|
|
2625
|
-
checklist: r[
|
|
2626
|
-
error: o[
|
|
2627
|
-
onToggle:
|
|
2785
|
+
agent: m,
|
|
2786
|
+
agentName: _t(m, i),
|
|
2787
|
+
column: e,
|
|
2788
|
+
isExpanded: n === m.id,
|
|
2789
|
+
isLoading: s === m.id,
|
|
2790
|
+
checklist: r[m.invocation_id] ?? null,
|
|
2791
|
+
error: o[m.id] ?? null,
|
|
2792
|
+
onToggle: p,
|
|
2628
2793
|
onViewAgent: c
|
|
2629
2794
|
},
|
|
2630
|
-
|
|
2795
|
+
m.id
|
|
2631
2796
|
)) })
|
|
2632
2797
|
]
|
|
2633
2798
|
}
|
|
2634
|
-
),
|
|
2635
|
-
jwt:
|
|
2636
|
-
headers:
|
|
2799
|
+
), _t = (e, t) => t.get(e.agent_definition_ref) ?? e.agent_definition_ref.replace(/_/g, " "), fs = ({
|
|
2800
|
+
jwt: e,
|
|
2801
|
+
headers: t,
|
|
2637
2802
|
agentDefinitionsUrl: n,
|
|
2638
|
-
agentsUrl:
|
|
2803
|
+
agentsUrl: s,
|
|
2639
2804
|
agentUrl: r,
|
|
2640
2805
|
agentChecklistUrl: o,
|
|
2641
2806
|
agentResourcesUrl: i,
|
|
2642
|
-
agentTimelineUrl:
|
|
2807
|
+
agentTimelineUrl: p,
|
|
2643
2808
|
agentChatUrl: c,
|
|
2644
|
-
agentConversationUrl:
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2809
|
+
agentConversationUrl: g,
|
|
2810
|
+
stopAgentUrl: m,
|
|
2811
|
+
enableUpload: N,
|
|
2812
|
+
showHeader: y = !1,
|
|
2813
|
+
institutions: I,
|
|
2814
|
+
usePusherToRepoll: O = !1,
|
|
2815
|
+
pusherChannelPrefix: f = Zt,
|
|
2816
|
+
subscribeToPusher: K
|
|
2648
2817
|
}) => {
|
|
2649
|
-
var
|
|
2650
|
-
const
|
|
2818
|
+
var Pe;
|
|
2819
|
+
const T = Y(
|
|
2651
2820
|
() => ({
|
|
2652
2821
|
agentDefinitions: n,
|
|
2653
|
-
agents:
|
|
2822
|
+
agents: s,
|
|
2654
2823
|
agent: r,
|
|
2655
2824
|
agentChecklist: o,
|
|
2656
2825
|
...i ? { agentResources: i } : {},
|
|
2657
|
-
...
|
|
2826
|
+
...p ? { agentTimeline: p } : {},
|
|
2658
2827
|
agentChat: c,
|
|
2659
|
-
agentConversation:
|
|
2828
|
+
agentConversation: g
|
|
2660
2829
|
}),
|
|
2661
2830
|
[
|
|
2662
2831
|
n,
|
|
2663
|
-
|
|
2832
|
+
s,
|
|
2664
2833
|
r,
|
|
2665
2834
|
o,
|
|
2666
2835
|
i,
|
|
2667
|
-
|
|
2836
|
+
p,
|
|
2668
2837
|
c,
|
|
2669
|
-
|
|
2838
|
+
g
|
|
2670
2839
|
]
|
|
2671
|
-
), [
|
|
2672
|
-
(
|
|
2673
|
-
)) == null ? void 0 :
|
|
2674
|
-
const
|
|
2675
|
-
return
|
|
2676
|
-
}, [
|
|
2677
|
-
agents:
|
|
2678
|
-
agentDefinitions:
|
|
2679
|
-
loadState:
|
|
2680
|
-
loadError:
|
|
2840
|
+
), [P, A] = h(null), _ = P ? (Pe = I == null ? void 0 : I.find(
|
|
2841
|
+
(u) => u.applicationId === P.application_id
|
|
2842
|
+
)) == null ? void 0 : Pe.applicationUrl : void 0, S = Y(() => {
|
|
2843
|
+
const u = { ...t ?? {} };
|
|
2844
|
+
return _ ? u[we.arborApplicationUrl] = _ : delete u[we.arborApplicationUrl], u;
|
|
2845
|
+
}, [t, _]), {
|
|
2846
|
+
agents: v,
|
|
2847
|
+
agentDefinitions: R,
|
|
2848
|
+
loadState: z,
|
|
2849
|
+
loadError: Ce,
|
|
2681
2850
|
reload: L,
|
|
2682
|
-
refresh:
|
|
2683
|
-
fetchAgentChecklist:
|
|
2684
|
-
createAgent:
|
|
2685
|
-
} =
|
|
2686
|
-
const
|
|
2687
|
-
(
|
|
2851
|
+
refresh: G,
|
|
2852
|
+
fetchAgentChecklist: q,
|
|
2853
|
+
createAgent: X
|
|
2854
|
+
} = ja({ jwt: e, headers: S, urls: T }), [Z, D] = h(!1), [x, ae] = h(null), [Ee, He] = h(null), [j, ze] = h({}), [ye, Te] = h({}), [ke, at] = h([]), [ce, st] = h([]), Re = Y(() => {
|
|
2855
|
+
const u = new Set(v.map((k) => k.application_id)), b = new Map(
|
|
2856
|
+
(I ?? []).map((k) => [k.applicationId, k.name])
|
|
2688
2857
|
);
|
|
2689
|
-
return [...
|
|
2690
|
-
(
|
|
2691
|
-
).map((
|
|
2692
|
-
value:
|
|
2693
|
-
label:
|
|
2858
|
+
return [...u].sort(
|
|
2859
|
+
(k, V) => (b.get(k) ?? k).localeCompare(b.get(V) ?? V)
|
|
2860
|
+
).map((k) => ({
|
|
2861
|
+
value: k,
|
|
2862
|
+
label: b.get(k) ?? k
|
|
2694
2863
|
}));
|
|
2695
|
-
}, [
|
|
2696
|
-
() => new Map(
|
|
2697
|
-
[
|
|
2698
|
-
),
|
|
2699
|
-
|
|
2700
|
-
)].sort((
|
|
2701
|
-
value:
|
|
2702
|
-
label:
|
|
2703
|
-
})), [
|
|
2704
|
-
|
|
2705
|
-
const
|
|
2706
|
-
|
|
2864
|
+
}, [v, I]), pe = Y(
|
|
2865
|
+
() => new Map(R.map((u) => [u.ref, u.display_name])),
|
|
2866
|
+
[R]
|
|
2867
|
+
), Ie = Y(() => [...new Set(
|
|
2868
|
+
v.map((b) => _t(b, pe))
|
|
2869
|
+
)].sort((b, k) => b.localeCompare(k)).map((b) => ({
|
|
2870
|
+
value: b,
|
|
2871
|
+
label: b
|
|
2872
|
+
})), [v, pe]), Ge = Y(() => v.filter((u) => !(ke.length > 0 && !ke.includes(u.application_id) || ce.length > 0 && !ce.includes(_t(u, pe)))), [v, pe, ce, ke]), Ne = Re.length > 1, Fe = Ie.length > 1, Be = Ne || Fe;
|
|
2873
|
+
H(() => {
|
|
2874
|
+
const u = window.setInterval(() => {
|
|
2875
|
+
G();
|
|
2707
2876
|
}, 6e4);
|
|
2708
2877
|
return () => {
|
|
2709
|
-
window.clearInterval(
|
|
2878
|
+
window.clearInterval(u);
|
|
2710
2879
|
};
|
|
2711
|
-
}, [
|
|
2712
|
-
if (
|
|
2880
|
+
}, [G]), H(() => {
|
|
2881
|
+
if (v.length === 0)
|
|
2713
2882
|
return;
|
|
2714
|
-
let
|
|
2883
|
+
let u = !1;
|
|
2715
2884
|
return (async () => {
|
|
2716
|
-
const
|
|
2717
|
-
|
|
2718
|
-
const V = await
|
|
2885
|
+
const b = await Promise.allSettled(
|
|
2886
|
+
v.map(async (k) => {
|
|
2887
|
+
const V = await q(k.invocation_id);
|
|
2719
2888
|
return {
|
|
2720
|
-
agentId:
|
|
2721
|
-
invocationId:
|
|
2889
|
+
agentId: k.id,
|
|
2890
|
+
invocationId: k.invocation_id,
|
|
2722
2891
|
checklist: V.checklist
|
|
2723
2892
|
};
|
|
2724
2893
|
})
|
|
2725
2894
|
);
|
|
2726
|
-
|
|
2727
|
-
const V = { ...
|
|
2728
|
-
let
|
|
2729
|
-
for (const
|
|
2730
|
-
if (
|
|
2895
|
+
u || (ze((k) => {
|
|
2896
|
+
const V = { ...k };
|
|
2897
|
+
let se = !1;
|
|
2898
|
+
for (const re of b) {
|
|
2899
|
+
if (re.status !== "fulfilled")
|
|
2731
2900
|
continue;
|
|
2732
|
-
const { invocationId:
|
|
2733
|
-
JSON.stringify(
|
|
2901
|
+
const { invocationId: me, checklist: xe } = re.value;
|
|
2902
|
+
JSON.stringify(k[me]) !== JSON.stringify(xe) && (V[me] = xe, se = !0);
|
|
2734
2903
|
}
|
|
2735
|
-
return
|
|
2736
|
-
}),
|
|
2737
|
-
const V = { ...
|
|
2738
|
-
let
|
|
2739
|
-
return
|
|
2740
|
-
|
|
2741
|
-
}),
|
|
2904
|
+
return se ? V : k;
|
|
2905
|
+
}), Te((k) => {
|
|
2906
|
+
const V = { ...k };
|
|
2907
|
+
let se = !1;
|
|
2908
|
+
return b.forEach((re, me) => {
|
|
2909
|
+
re.status === "rejected" && V[v[me].id] !== Ze && (V[v[me].id] = Ze, se = !0);
|
|
2910
|
+
}), se ? V : k;
|
|
2742
2911
|
}));
|
|
2743
2912
|
})(), () => {
|
|
2744
|
-
|
|
2913
|
+
u = !0;
|
|
2745
2914
|
};
|
|
2746
|
-
}, [
|
|
2747
|
-
const
|
|
2748
|
-
async (
|
|
2749
|
-
if (!
|
|
2750
|
-
|
|
2751
|
-
const
|
|
2752
|
-
return delete
|
|
2915
|
+
}, [v, q]);
|
|
2916
|
+
const qe = C(
|
|
2917
|
+
async (u) => {
|
|
2918
|
+
if (!j[u.invocation_id]) {
|
|
2919
|
+
He(u.id), Te((b) => {
|
|
2920
|
+
const k = { ...b };
|
|
2921
|
+
return delete k[u.id], k;
|
|
2753
2922
|
});
|
|
2754
2923
|
try {
|
|
2755
|
-
const
|
|
2756
|
-
|
|
2757
|
-
...
|
|
2758
|
-
[
|
|
2924
|
+
const b = await q(u.invocation_id);
|
|
2925
|
+
ze((k) => ({
|
|
2926
|
+
...k,
|
|
2927
|
+
[u.invocation_id]: b.checklist
|
|
2759
2928
|
}));
|
|
2760
2929
|
} catch {
|
|
2761
|
-
|
|
2762
|
-
...
|
|
2763
|
-
[
|
|
2930
|
+
Te((b) => ({
|
|
2931
|
+
...b,
|
|
2932
|
+
[u.id]: Ze
|
|
2764
2933
|
}));
|
|
2765
2934
|
} finally {
|
|
2766
|
-
|
|
2935
|
+
He((b) => b === u.id ? null : b);
|
|
2767
2936
|
}
|
|
2768
2937
|
}
|
|
2769
2938
|
},
|
|
2770
|
-
[
|
|
2771
|
-
),
|
|
2772
|
-
(
|
|
2773
|
-
if (
|
|
2774
|
-
|
|
2939
|
+
[q, j]
|
|
2940
|
+
), Oe = C(
|
|
2941
|
+
(u) => {
|
|
2942
|
+
if (x === u) {
|
|
2943
|
+
ae(null);
|
|
2775
2944
|
return;
|
|
2776
2945
|
}
|
|
2777
|
-
const
|
|
2778
|
-
|
|
2946
|
+
const b = v.find(({ id: k }) => k === u);
|
|
2947
|
+
b && (ae(u), qe(b));
|
|
2779
2948
|
},
|
|
2780
|
-
[
|
|
2781
|
-
),
|
|
2782
|
-
const
|
|
2783
|
-
for (const
|
|
2784
|
-
const
|
|
2785
|
-
|
|
2786
|
-
|
|
2949
|
+
[v, x, qe]
|
|
2950
|
+
), Je = Y(() => {
|
|
2951
|
+
const u = {};
|
|
2952
|
+
for (const b of Ge) {
|
|
2953
|
+
const k = ls(
|
|
2954
|
+
b,
|
|
2955
|
+
j[b.invocation_id]
|
|
2787
2956
|
);
|
|
2788
|
-
(
|
|
2957
|
+
(u[k] ?? (u[k] = [])).push(b);
|
|
2789
2958
|
}
|
|
2790
|
-
return
|
|
2791
|
-
}, [
|
|
2792
|
-
|
|
2793
|
-
}, []),
|
|
2794
|
-
async (
|
|
2795
|
-
const
|
|
2796
|
-
b
|
|
2959
|
+
return u;
|
|
2960
|
+
}, [Ge, j]), Le = C((u) => {
|
|
2961
|
+
A(u);
|
|
2962
|
+
}, []), rt = C(
|
|
2963
|
+
async (u) => {
|
|
2964
|
+
const b = await X(u);
|
|
2965
|
+
A(b), D(!1);
|
|
2797
2966
|
},
|
|
2798
|
-
[
|
|
2799
|
-
),
|
|
2800
|
-
|
|
2801
|
-
}, []),
|
|
2802
|
-
expandedAgentId:
|
|
2803
|
-
loadingAgentId:
|
|
2804
|
-
checklistByInvocationId:
|
|
2805
|
-
errorByAgentId:
|
|
2806
|
-
definitionNameByRef:
|
|
2807
|
-
onToggleAgent:
|
|
2808
|
-
onViewAgent:
|
|
2967
|
+
[X]
|
|
2968
|
+
), Ue = C(() => {
|
|
2969
|
+
A(null);
|
|
2970
|
+
}, []), de = {
|
|
2971
|
+
expandedAgentId: x,
|
|
2972
|
+
loadingAgentId: Ee,
|
|
2973
|
+
checklistByInvocationId: j,
|
|
2974
|
+
errorByAgentId: ye,
|
|
2975
|
+
definitionNameByRef: pe,
|
|
2976
|
+
onToggleAgent: Oe,
|
|
2977
|
+
onViewAgent: Le
|
|
2809
2978
|
};
|
|
2810
2979
|
return /* @__PURE__ */ l("div", { className: "agent-view-frontend agent-view", children: [
|
|
2811
|
-
|
|
2812
|
-
/* @__PURE__ */
|
|
2813
|
-
/* @__PURE__ */
|
|
2814
|
-
|
|
2980
|
+
y && /* @__PURE__ */ l("div", { className: "agent-view__header", children: [
|
|
2981
|
+
/* @__PURE__ */ a(be, { level: 1, children: "Agents" }),
|
|
2982
|
+
/* @__PURE__ */ a(
|
|
2983
|
+
te,
|
|
2815
2984
|
{
|
|
2816
2985
|
variant: "primary",
|
|
2817
2986
|
size: "S",
|
|
2818
2987
|
iconLeftName: "sparkles",
|
|
2819
2988
|
iconLeftScreenReaderText: "Start an agent",
|
|
2820
|
-
onClick: () =>
|
|
2989
|
+
onClick: () => D(!0),
|
|
2821
2990
|
children: "Start an agent"
|
|
2822
2991
|
}
|
|
2823
2992
|
)
|
|
2824
2993
|
] }),
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
/* @__PURE__ */
|
|
2994
|
+
v.length > 0 && Be && /* @__PURE__ */ l("div", { className: "agent-view__filters", children: [
|
|
2995
|
+
Ne && /* @__PURE__ */ l("div", { className: "agent-view__filter", children: [
|
|
2996
|
+
/* @__PURE__ */ a(
|
|
2828
2997
|
"label",
|
|
2829
2998
|
{
|
|
2830
2999
|
className: "agent-view__filter-label",
|
|
@@ -2832,43 +3001,36 @@ const Bt = (t, e) => (n) => {
|
|
|
2832
3001
|
children: "Institution"
|
|
2833
3002
|
}
|
|
2834
3003
|
),
|
|
2835
|
-
/* @__PURE__ */
|
|
2836
|
-
|
|
3004
|
+
/* @__PURE__ */ a(
|
|
3005
|
+
Tt,
|
|
2837
3006
|
{
|
|
2838
3007
|
id: "agent-view-institution-filter",
|
|
2839
3008
|
triggerVariant: "button",
|
|
2840
3009
|
multiple: !0,
|
|
2841
3010
|
searchType: "substring",
|
|
2842
3011
|
placeholder: "All institutions",
|
|
2843
|
-
options:
|
|
2844
|
-
value:
|
|
2845
|
-
onValueChange:
|
|
3012
|
+
options: Re,
|
|
3013
|
+
value: ke,
|
|
3014
|
+
onValueChange: at,
|
|
2846
3015
|
showSelectionCountBadge: !0,
|
|
2847
3016
|
showClearAll: !0,
|
|
2848
3017
|
clearAllLabel: "Clear institutions"
|
|
2849
3018
|
}
|
|
2850
3019
|
)
|
|
2851
3020
|
] }),
|
|
2852
|
-
|
|
2853
|
-
/* @__PURE__ */
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
className: "agent-view__filter-label",
|
|
2857
|
-
htmlFor: "agent-view-agent-filter",
|
|
2858
|
-
children: "Agent"
|
|
2859
|
-
}
|
|
2860
|
-
),
|
|
2861
|
-
/* @__PURE__ */ s(
|
|
2862
|
-
vt,
|
|
3021
|
+
Fe && /* @__PURE__ */ l("div", { className: "agent-view__filter", children: [
|
|
3022
|
+
/* @__PURE__ */ a("label", { className: "agent-view__filter-label", htmlFor: "agent-view-agent-filter", children: "Agent" }),
|
|
3023
|
+
/* @__PURE__ */ a(
|
|
3024
|
+
Tt,
|
|
2863
3025
|
{
|
|
2864
3026
|
id: "agent-view-agent-filter",
|
|
2865
3027
|
triggerVariant: "button",
|
|
2866
3028
|
multiple: !0,
|
|
2867
3029
|
searchType: "substring",
|
|
2868
3030
|
placeholder: "All agents",
|
|
2869
|
-
options:
|
|
2870
|
-
value:
|
|
2871
|
-
onValueChange:
|
|
3031
|
+
options: Ie,
|
|
3032
|
+
value: ce,
|
|
3033
|
+
onValueChange: st,
|
|
2872
3034
|
showSelectionCountBadge: !0,
|
|
2873
3035
|
showClearAll: !0,
|
|
2874
3036
|
clearAllLabel: "Clear agents"
|
|
@@ -2876,117 +3038,122 @@ const Bt = (t, e) => (n) => {
|
|
|
2876
3038
|
)
|
|
2877
3039
|
] })
|
|
2878
3040
|
] }),
|
|
2879
|
-
|
|
2880
|
-
/* @__PURE__ */
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
}
|
|
2887
|
-
),
|
|
2888
|
-
/* @__PURE__ */ s("p", { className: "agent-view__state-message", children: E ?? Ut }),
|
|
2889
|
-
/* @__PURE__ */ s(ee, { variant: "secondary", size: "S", onClick: L, children: "Try again" })
|
|
2890
|
-
] }) : m === "loading" && N.length === 0 ? /* @__PURE__ */ l("div", { className: "agent-view__state", "aria-live": "polite", children: [
|
|
2891
|
-
/* @__PURE__ */ s(
|
|
2892
|
-
P,
|
|
3041
|
+
z === "error" ? /* @__PURE__ */ l("div", { className: "agent-view__state agent-view__state--error", role: "alert", children: [
|
|
3042
|
+
/* @__PURE__ */ a(U, { name: "triangle-alert", size: 24, color: "var(--color-semantic-destructive-600)" }),
|
|
3043
|
+
/* @__PURE__ */ a("p", { className: "agent-view__state-message", children: Ce ?? jt }),
|
|
3044
|
+
/* @__PURE__ */ a(te, { variant: "secondary", size: "S", onClick: L, children: "Try again" })
|
|
3045
|
+
] }) : z === "loading" && v.length === 0 ? /* @__PURE__ */ l("div", { className: "agent-view__state", "aria-live": "polite", children: [
|
|
3046
|
+
/* @__PURE__ */ a(
|
|
3047
|
+
U,
|
|
2893
3048
|
{
|
|
2894
3049
|
name: "loader",
|
|
2895
3050
|
size: 24,
|
|
2896
3051
|
color: "var(--color-brand-600)",
|
|
2897
3052
|
className: "agent-view__progress-icon--spinning",
|
|
2898
|
-
screenReaderText:
|
|
3053
|
+
screenReaderText: It
|
|
2899
3054
|
}
|
|
2900
3055
|
),
|
|
2901
|
-
/* @__PURE__ */
|
|
2902
|
-
] }) :
|
|
2903
|
-
|
|
2904
|
-
|
|
3056
|
+
/* @__PURE__ */ a("p", { className: "agent-view__state-message", children: It })
|
|
3057
|
+
] }) : v.length === 0 ? /* @__PURE__ */ a(Gn, {}) : /* @__PURE__ */ l("div", { className: "agent-view__board", children: [
|
|
3058
|
+
En.map((u) => /* @__PURE__ */ a(
|
|
3059
|
+
Bt,
|
|
2905
3060
|
{
|
|
2906
|
-
column:
|
|
2907
|
-
agents:
|
|
2908
|
-
...
|
|
3061
|
+
column: Qe[u],
|
|
3062
|
+
agents: Je[u] ?? [],
|
|
3063
|
+
...de
|
|
2909
3064
|
},
|
|
2910
|
-
|
|
3065
|
+
u
|
|
2911
3066
|
)),
|
|
2912
|
-
/* @__PURE__ */
|
|
2913
|
-
|
|
3067
|
+
/* @__PURE__ */ a("div", { className: "agent-view__split-column", children: Tn.map((u) => /* @__PURE__ */ a(
|
|
3068
|
+
Bt,
|
|
2914
3069
|
{
|
|
2915
|
-
column:
|
|
2916
|
-
agents:
|
|
3070
|
+
column: Qe[u],
|
|
3071
|
+
agents: Je[u] ?? [],
|
|
2917
3072
|
isSplit: !0,
|
|
2918
|
-
...
|
|
3073
|
+
...de
|
|
2919
3074
|
},
|
|
2920
|
-
|
|
3075
|
+
u
|
|
2921
3076
|
)) })
|
|
2922
3077
|
] }),
|
|
2923
|
-
|
|
2924
|
-
|
|
3078
|
+
P && /* @__PURE__ */ a(
|
|
3079
|
+
ts,
|
|
2925
3080
|
{
|
|
2926
|
-
agent:
|
|
2927
|
-
invocationId:
|
|
3081
|
+
agent: P,
|
|
3082
|
+
invocationId: P.invocation_id,
|
|
2928
3083
|
open: !0,
|
|
2929
|
-
jwt:
|
|
2930
|
-
headers:
|
|
3084
|
+
jwt: e,
|
|
3085
|
+
headers: S,
|
|
2931
3086
|
agentUrl: r,
|
|
2932
3087
|
agentChecklistUrl: o,
|
|
2933
3088
|
agentResourcesUrl: i,
|
|
2934
|
-
agentTimelineUrl:
|
|
3089
|
+
agentTimelineUrl: p,
|
|
2935
3090
|
agentChatUrl: c,
|
|
2936
|
-
agentConversationUrl:
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
3091
|
+
agentConversationUrl: g,
|
|
3092
|
+
stopAgentUrl: m,
|
|
3093
|
+
enableUpload: N,
|
|
3094
|
+
initialChecklist: j[P.invocation_id] ?? null,
|
|
3095
|
+
usePusherToRepoll: O,
|
|
3096
|
+
pusherChannelPrefix: f,
|
|
3097
|
+
subscribeToPusher: K,
|
|
3098
|
+
onClose: Ue
|
|
2940
3099
|
},
|
|
2941
|
-
|
|
3100
|
+
P.id
|
|
2942
3101
|
),
|
|
2943
|
-
/* @__PURE__ */
|
|
2944
|
-
|
|
3102
|
+
/* @__PURE__ */ a(
|
|
3103
|
+
is,
|
|
2945
3104
|
{
|
|
2946
|
-
open:
|
|
2947
|
-
onClose: () =>
|
|
2948
|
-
onStart:
|
|
2949
|
-
agentDefinitions:
|
|
3105
|
+
open: Z,
|
|
3106
|
+
onClose: () => D(!1),
|
|
3107
|
+
onStart: rt,
|
|
3108
|
+
agentDefinitions: R
|
|
2950
3109
|
}
|
|
2951
3110
|
)
|
|
2952
3111
|
] });
|
|
2953
|
-
},
|
|
2954
|
-
const n = Date.now(),
|
|
3112
|
+
}, vs = (e, t) => {
|
|
3113
|
+
const n = Date.now(), s = t.trim() || e.agent_intent;
|
|
2955
3114
|
return {
|
|
2956
3115
|
id: `agent-${n}`,
|
|
2957
3116
|
invocation_id: `inv-${n}`,
|
|
2958
|
-
agent_definition_ref:
|
|
2959
|
-
agent_intent:
|
|
2960
|
-
invocation_name:
|
|
2961
|
-
application_id:
|
|
2962
|
-
created_by:
|
|
2963
|
-
status:
|
|
3117
|
+
agent_definition_ref: e.ref,
|
|
3118
|
+
agent_intent: e.agent_intent,
|
|
3119
|
+
invocation_name: s,
|
|
3120
|
+
application_id: Rn,
|
|
3121
|
+
created_by: In,
|
|
3122
|
+
status: E["generating-a-response"],
|
|
2964
3123
|
context_ref: null,
|
|
2965
3124
|
checklist_ref: null
|
|
2966
3125
|
};
|
|
2967
3126
|
};
|
|
2968
3127
|
export {
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
3128
|
+
fs as AgentMonitorKanban,
|
|
3129
|
+
ft as AgentServiceClient,
|
|
3130
|
+
$e as AgentServiceError,
|
|
3131
|
+
ts as AgentView,
|
|
3132
|
+
Zt as DEFAULT_PUSHER_CHANNEL_PREFIX,
|
|
3133
|
+
Ja as HttpChatConnector,
|
|
3134
|
+
Dt as MESSAGE_TYPE_REPOLL,
|
|
3135
|
+
is as NewAgentModal,
|
|
3136
|
+
ua as PUSHER_AGENT_MESSAGE_EVENT,
|
|
3137
|
+
ve as REPOLL_TARGET,
|
|
3138
|
+
vs as buildAgentFromDefinition,
|
|
3139
|
+
ma as buildAgentPusherChannel,
|
|
3140
|
+
nn as createHttpChatConnectorFactory,
|
|
3141
|
+
Pa as formatUserFileChatCardText,
|
|
3142
|
+
$t as mapApiAgent,
|
|
3143
|
+
Qt as mapApiAgentDefinition,
|
|
3144
|
+
Sa as mapApiAgentStatus,
|
|
3145
|
+
Ia as mapApiAgentTimelineResponse,
|
|
3146
|
+
tn as mapApiChecklistEndpointResponse,
|
|
3147
|
+
en as mapApiChecklistItem,
|
|
3148
|
+
La as mapApiChecklistResponse,
|
|
3149
|
+
ba as mapApiChecklistStatus,
|
|
3150
|
+
xa as mapApiConversationMessages,
|
|
3151
|
+
nt as mapApiOpeningMessage,
|
|
3152
|
+
Ta as mapApiResource,
|
|
3153
|
+
Ra as mapApiResourcesEndpointResponse,
|
|
3154
|
+
_s as mapApiTripOption,
|
|
3155
|
+
Ua as parseConversationContentCaption,
|
|
3156
|
+
va as parseRepollMessages,
|
|
3157
|
+
ja as useAgentService,
|
|
3158
|
+
Ya as useAgentWorkspace
|
|
2992
3159
|
};
|