@arbor-education/agent-view-frontend 0.4.10 → 0.4.11-alpha.2
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 +1792 -1614
- 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 p, useLayoutEffect as Se, useEffect as H, useMemo as Y, useCallback as C } from "react";
|
|
3
|
+
import W from "classnames";
|
|
4
|
+
import { Heading as Ce, Icon as P, Dot as zt, SlideoverUtils as Xe, SlideoverManager as mn, Modal as ue, Button as te, Tabs as dt, SelectDropdown as _n, TextInput as fn, Combobox as At, Card as vn } from "@arbor-education/design-system.components";
|
|
5
|
+
import { CHAT_RESPONSE_TYPE_AGENT as Gt, CHAT_RESPONSE_TYPE_ERROR as wn, ChatPanel as yn, CHAT_RESPONSE_TYPE_USER as kn, CHAT_RESPONSE_TYPE_INFO as Nn } 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
|
+
}, $ = {
|
|
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
|
+
}, An = {
|
|
33
|
+
user_file: "user_file"
|
|
34
|
+
}, bt = {
|
|
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
|
+
[$.complete]: {
|
|
40
43
|
label: "Complete",
|
|
41
44
|
icon: "circle-check",
|
|
42
45
|
color: "var(--color-semantic-success-600)"
|
|
43
46
|
},
|
|
44
|
-
[
|
|
47
|
+
[$.failed]: {
|
|
45
48
|
label: "Failed",
|
|
46
49
|
icon: "circle-x",
|
|
47
50
|
color: "var(--color-semantic-destructive-600)"
|
|
48
51
|
},
|
|
49
|
-
[
|
|
52
|
+
[$.hitl]: {
|
|
50
53
|
label: "Requires attention",
|
|
51
54
|
icon: "triangle-alert",
|
|
52
55
|
color: "var(--color-semantic-warning-600)"
|
|
53
56
|
},
|
|
54
|
-
[
|
|
57
|
+
[$["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
|
+
}, et = {
|
|
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
|
+
}, bn = [
|
|
101
|
+
E["generating-a-response"],
|
|
102
|
+
E.hitl
|
|
103
|
+
], Sn = [
|
|
104
|
+
E.complete,
|
|
105
|
+
E.failed
|
|
106
|
+
], Cn = "m4", En = "1", Ft = "msg-opening", Qe = "Unable to load agent tasks. Please try again.", Tn = "Unable to load the resources for this agent", Rn = "Unable to load this document. Please try again.", Bt = "Unable to load the timeline for this agent", In = "Something went wrong. Please try again.", qt = "Unable to load agents. Please try again.", be = "Loading tasks…", St = "Loading agents…", On = "Task", Ln = {
|
|
107
|
+
[B.briefing]: "Briefing",
|
|
108
|
+
[B.running]: "Working",
|
|
109
|
+
[B.stopped]: "Stopped",
|
|
110
|
+
[B.complete]: "Complete"
|
|
111
|
+
}, Un = [
|
|
112
|
+
E["generating-a-response"],
|
|
113
|
+
E.hitl,
|
|
114
|
+
E.complete,
|
|
115
|
+
E.failed
|
|
116
|
+
], Pn = {
|
|
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
|
+
}, xn = () => /* @__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,249 +230,262 @@ 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
|
+
), Dn = ({ status: e }) => {
|
|
238
|
+
const t = et[e];
|
|
239
|
+
return t.statusIcon ? /* @__PURE__ */ a(
|
|
237
240
|
P,
|
|
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(zt, { colour: t.dotColour, label: t.title });
|
|
248
|
+
}, Mn = () => /* @__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(Ce, { 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: Un.map((e) => {
|
|
258
|
+
const t = et[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(Dn, { 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: Pn[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(xn, {}) })
|
|
271
274
|
]
|
|
272
275
|
}
|
|
273
|
-
),
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
276
|
+
), $n = () => ({
|
|
277
|
+
needsInput: [],
|
|
278
|
+
complete: [],
|
|
279
|
+
failed: [],
|
|
280
|
+
tasks: []
|
|
281
|
+
}), Hn = (e, t) => ({
|
|
282
|
+
...e,
|
|
283
|
+
...t.length > 0 ? { children: t } : {}
|
|
284
|
+
}), Jt = (e) => {
|
|
285
|
+
const t = [], n = [], s = [], r = [];
|
|
286
|
+
for (const o of e) {
|
|
287
|
+
const i = o.children ? Jt(o.children) : $n();
|
|
288
|
+
if (t.push(...i.needsInput), n.push(...i.complete), s.push(...i.failed), o.status === $.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 === $.complete) {
|
|
293
|
+
n.push({ ...o, children: void 0 });
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
296
|
+
if (o.status === $.failed) {
|
|
297
|
+
s.push({ ...o, children: void 0 });
|
|
298
|
+
continue;
|
|
299
|
+
}
|
|
300
|
+
r.push(Hn(o, i.tasks));
|
|
301
|
+
}
|
|
302
|
+
return { needsInput: t, complete: n, failed: s, tasks: r };
|
|
303
|
+
}, Ct = (e) => e === $.hitl ? 0 : e === $.complete ? 1 : e === $.failed ? 2 : 3, zn = (e) => e.map((t, n) => ({ item: t, index: n })).sort((t, n) => {
|
|
304
|
+
const s = Ct(t.item.status) - Ct(n.item.status);
|
|
305
|
+
return s !== 0 ? s : t.index - n.index;
|
|
306
|
+
}).map(({ item: t }) => t), ht = 2, Gn = (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
|
+
}, Fn = (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
|
-
(m) => m ===
|
|
323
|
-
),
|
|
324
|
-
(m) => m ===
|
|
325
|
-
),
|
|
326
|
-
const m =
|
|
327
|
-
|
|
332
|
+
const i = le(null), u = le(null), [c, g] = p(!1), [_, N] = p(!1), [y, I] = p(null), L = () => {
|
|
333
|
+
var O;
|
|
334
|
+
return s ? ((O = i.current) == null ? void 0 : O.querySelector(s)) ?? null : u.current;
|
|
335
|
+
}, f = () => {
|
|
336
|
+
const O = L(), A = Gn(O);
|
|
337
|
+
if (g(
|
|
338
|
+
(m) => m === A.canScrollUp ? m : A.canScrollUp
|
|
339
|
+
), N(
|
|
340
|
+
(m) => m === A.canScrollDown ? m : A.canScrollDown
|
|
341
|
+
), s) {
|
|
342
|
+
const m = Fn(i.current, O);
|
|
343
|
+
I((b) => (b == null ? void 0 : b.top) === (m == null ? void 0 : m.top) && (b == null ? void 0 : b.left) === (m == null ? void 0 : m.left) && (b == null ? void 0 : b.width) === (m == null ? void 0 : m.width) && (b == null ? void 0 : b.height) === (m == null ? void 0 : m.height) ? b : m);
|
|
328
344
|
} else
|
|
329
|
-
|
|
345
|
+
I((m) => m === null ? m : null);
|
|
330
346
|
};
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
}),
|
|
334
|
-
const
|
|
335
|
-
if (!
|
|
347
|
+
Se(() => {
|
|
348
|
+
f();
|
|
349
|
+
}), H(() => {
|
|
350
|
+
const O = i.current;
|
|
351
|
+
if (!O)
|
|
336
352
|
return;
|
|
337
|
-
let
|
|
338
|
-
const
|
|
339
|
-
|
|
340
|
-
},
|
|
341
|
-
if (
|
|
342
|
-
|
|
353
|
+
let A = null, m = null;
|
|
354
|
+
const b = () => {
|
|
355
|
+
A == null || A.removeEventListener("scroll", f), m == null || m.disconnect(), m = null, A = null;
|
|
356
|
+
}, v = (z) => {
|
|
357
|
+
if (z === A) {
|
|
358
|
+
f();
|
|
343
359
|
return;
|
|
344
360
|
}
|
|
345
|
-
if (
|
|
346
|
-
|
|
361
|
+
if (b(), A = z, !A) {
|
|
362
|
+
f();
|
|
347
363
|
return;
|
|
348
364
|
}
|
|
349
|
-
|
|
365
|
+
A.addEventListener("scroll", f, { passive: !0 }), m = new ResizeObserver(() => f()), m.observe(A), A.firstElementChild instanceof HTMLElement && m.observe(A.firstElementChild), f();
|
|
350
366
|
};
|
|
351
|
-
L(
|
|
352
|
-
const
|
|
353
|
-
L(
|
|
367
|
+
v(L());
|
|
368
|
+
const R = new MutationObserver(() => {
|
|
369
|
+
v(L());
|
|
354
370
|
});
|
|
355
|
-
return
|
|
371
|
+
return R.observe(O, {
|
|
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(), b();
|
|
361
377
|
};
|
|
362
|
-
}, [
|
|
363
|
-
const
|
|
364
|
-
const
|
|
365
|
-
if (!
|
|
378
|
+
}, [s]);
|
|
379
|
+
const K = (O) => {
|
|
380
|
+
const A = L();
|
|
381
|
+
if (!A)
|
|
366
382
|
return;
|
|
367
|
-
const m = Math.max(
|
|
368
|
-
|
|
369
|
-
top:
|
|
383
|
+
const m = Math.max(A.clientHeight * 0.75, 120);
|
|
384
|
+
A.scrollBy({
|
|
385
|
+
top: O === "up" ? -m : m,
|
|
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(P, { name: "chevron-up", size: 16, color: "currentColor" })
|
|
383
399
|
}
|
|
384
400
|
)
|
|
385
401
|
] }),
|
|
386
|
-
|
|
387
|
-
/* @__PURE__ */
|
|
402
|
+
_ && /* @__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(P, { 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 || _) && /* @__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: u,
|
|
450
|
+
className: W("scrollable-region__viewport", n),
|
|
451
|
+
children: e
|
|
436
452
|
}
|
|
437
453
|
)
|
|
438
454
|
] })
|
|
439
455
|
}
|
|
440
456
|
);
|
|
441
|
-
},
|
|
442
|
-
checklist:
|
|
457
|
+
}, Bn = 48, qn = ({
|
|
458
|
+
checklist: e
|
|
443
459
|
}) => {
|
|
444
|
-
const
|
|
445
|
-
return
|
|
446
|
-
const
|
|
447
|
-
if (!
|
|
460
|
+
const t = le(null), n = le(!1);
|
|
461
|
+
return Se(() => {
|
|
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 <= Bn) && (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: zn(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__ */
|
|
488
|
+
/* @__PURE__ */ a(
|
|
473
489
|
P,
|
|
474
490
|
{
|
|
475
491
|
name: r.icon,
|
|
@@ -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 !== $.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
|
+
}, Jn = ({
|
|
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 Kn {
|
|
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: Gt,
|
|
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: In,
|
|
569
|
+
type: wn
|
|
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 Wn = ({
|
|
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: u,
|
|
580
596
|
onAwaitingChange: c,
|
|
581
|
-
onClarificationPrompt:
|
|
582
|
-
onDismissClarification:
|
|
597
|
+
onClarificationPrompt: g,
|
|
598
|
+
onDismissClarification: _
|
|
583
599
|
}) => {
|
|
584
|
-
const
|
|
585
|
-
() => new
|
|
586
|
-
canSend: () =>
|
|
587
|
-
onTurn:
|
|
600
|
+
const N = Y(
|
|
601
|
+
() => new Kn(e, {
|
|
602
|
+
canSend: () => t === B.running,
|
|
603
|
+
onTurn: u,
|
|
588
604
|
onAwaitingChange: c
|
|
589
605
|
}),
|
|
590
|
-
[
|
|
591
|
-
),
|
|
606
|
+
[e, t, u, 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,62 +613,62 @@ 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
|
+
Jn,
|
|
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: _,
|
|
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
|
+
yn,
|
|
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(P, { 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(P, { 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
|
+
}, Kt = ({
|
|
665
|
+
item: e,
|
|
666
|
+
depth: t,
|
|
651
667
|
canRequestInput: n,
|
|
652
|
-
onAttentionItemClick:
|
|
668
|
+
onAttentionItemClick: s
|
|
653
669
|
}) => {
|
|
654
|
-
const r =
|
|
655
|
-
/* @__PURE__ */
|
|
670
|
+
const r = ee[e.status], o = e.status.replace(/_/g, "-"), i = e.status === $.hitl && n && s, u = /* @__PURE__ */ l("div", { className: "agent-workspace__task-row", children: [
|
|
671
|
+
/* @__PURE__ */ a(
|
|
656
672
|
P,
|
|
657
673
|
{
|
|
658
674
|
name: r.icon,
|
|
@@ -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 !== $.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: u
|
|
684
700
|
}
|
|
685
|
-
) :
|
|
686
|
-
|
|
687
|
-
|
|
701
|
+
) : u,
|
|
702
|
+
e.children && e.children.length > 0 && /* @__PURE__ */ a("ul", { className: "agent-workspace__task-children", children: e.children.map((c) => /* @__PURE__ */ a(
|
|
703
|
+
Kt,
|
|
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
|
+
}, Ze = ({
|
|
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
|
+
Kt,
|
|
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
|
+
)) }), jn = ({
|
|
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 ? Jt(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__ */
|
|
747
|
+
/* @__PURE__ */ a("div", { className: "agent-workspace__panel-header", children: /* @__PURE__ */ a(Ce, { 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(
|
|
735
751
|
P,
|
|
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: be
|
|
742
758
|
}
|
|
743
759
|
),
|
|
744
|
-
/* @__PURE__ */
|
|
760
|
+
/* @__PURE__ */ a("span", { children: be })
|
|
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
|
+
Ze,
|
|
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
|
+
Ze,
|
|
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
|
+
Ze,
|
|
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
|
+
Ze,
|
|
770
826
|
{
|
|
771
827
|
items: i.tasks,
|
|
772
828
|
ariaLabel: "Agent tasks",
|
|
@@ -778,41 +834,41 @@ 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
|
+
}, Vn = ({
|
|
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 = Xe.removeSlideover;
|
|
853
|
+
return Xe.removeSlideover = () => {
|
|
798
854
|
i(), r();
|
|
799
855
|
}, () => {
|
|
800
|
-
|
|
856
|
+
Xe.removeSlideover = i;
|
|
801
857
|
};
|
|
802
|
-
}, [
|
|
803
|
-
if (!
|
|
858
|
+
}, [e, r]), H(() => {
|
|
859
|
+
if (!e)
|
|
804
860
|
return;
|
|
805
|
-
const i = (
|
|
806
|
-
|
|
861
|
+
const i = (u) => {
|
|
862
|
+
u.key === "Escape" && Xe.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__ */
|
|
871
|
+
/* @__PURE__ */ a(
|
|
816
872
|
P,
|
|
817
873
|
{
|
|
818
874
|
name: "loader",
|
|
@@ -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(mn, { slideovers: o }) });
|
|
897
|
+
}, Yn = {
|
|
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
|
+
}, Xn = ({
|
|
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,12 +937,12 @@ 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(Ce, { level: 4, children: "Resources" }),
|
|
941
|
+
/* @__PURE__ */ a("span", { className: "agent-workspace__panel-count", children: e.length })
|
|
881
942
|
] }),
|
|
882
|
-
/* @__PURE__ */
|
|
883
|
-
|
|
884
|
-
/* @__PURE__ */
|
|
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(
|
|
885
946
|
P,
|
|
886
947
|
{
|
|
887
948
|
name: "loader",
|
|
@@ -891,50 +952,50 @@ 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 = Yn[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: (u) => {
|
|
968
|
+
u.preventDefault(), s(r);
|
|
908
969
|
},
|
|
909
|
-
children: /* @__PURE__ */
|
|
970
|
+
children: /* @__PURE__ */ a(Et, { 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(Et, { 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
|
+
), Et = ({ 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(P, { 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__ */
|
|
998
|
+
n && /* @__PURE__ */ a(
|
|
938
999
|
P,
|
|
939
1000
|
{
|
|
940
1001
|
name: "external-link",
|
|
@@ -944,686 +1005,759 @@ const Pn = ({
|
|
|
944
1005
|
className: "agent-workspace__resource-open"
|
|
945
1006
|
}
|
|
946
1007
|
)
|
|
947
|
-
] }),
|
|
948
|
-
const
|
|
949
|
-
return Number.isFinite(
|
|
950
|
-
},
|
|
1008
|
+
] }), Tt = (e) => {
|
|
1009
|
+
const t = Date.parse(e);
|
|
1010
|
+
return Number.isFinite(t) ? t : 0;
|
|
1011
|
+
}, Zn = 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()) ? Zn.format(t) : e;
|
|
1020
|
+
}, Rt = (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
|
+
), It = (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
|
+
}, Qn = 60 * 60 * 1e3, Wt = 60 * 60 * 1e3, He = 24 * Wt, mt = 7 * He, ea = (e) => e.type !== "message-sent", ta = (e, t) => {
|
|
1030
|
+
const n = e.filter(ea).map((r, o) => ({
|
|
1031
|
+
kind: "action",
|
|
1032
|
+
id: `action-${r.timestamp}-${o}`,
|
|
1033
|
+
timestampMs: Tt(r.timestamp),
|
|
1034
|
+
item: r
|
|
1035
|
+
})), s = t.map((r) => ({
|
|
1036
|
+
kind: "chat",
|
|
1037
|
+
id: r.sessionId,
|
|
1038
|
+
timestampMs: Tt(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
|
+
}, na = (e) => e >= mt ? "weeks" : e >= He ? "days" : "hours", aa = (e) => {
|
|
1045
|
+
if (e < He) {
|
|
1046
|
+
const s = Math.max(1, Math.round(e / Wt));
|
|
1047
|
+
return s === 1 ? "1 hour later" : `${s} hours later`;
|
|
1048
|
+
}
|
|
1049
|
+
if (e < mt) {
|
|
1050
|
+
const s = Math.max(1, Math.round(e / He));
|
|
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 * He)));
|
|
1057
|
+
return n === 1 ? "1 month later" : `${n} months later`;
|
|
1058
|
+
}, sa = (e, t = Qn) => {
|
|
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: aa(i),
|
|
1069
|
+
size: na(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
|
+
}, ra = (e) => e.type === "checklist-updated" ? "checklist" : e.type === "status-transition" ? "status" : "note", ia = ({
|
|
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 = ta(r, o), u = sa(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 || Bt }),
|
|
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(
|
|
1088
|
+
"span",
|
|
1089
|
+
{
|
|
1090
|
+
className: "agent-timeline__station-node agent-timeline__station-node--terminus",
|
|
1091
|
+
"aria-hidden": "true",
|
|
1092
|
+
children: /* @__PURE__ */ a(P, { 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
|
+
u.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(P, { 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: _ } = g, N = ra(_), 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__ */ l(
|
|
1138
|
+
"button",
|
|
1139
|
+
{
|
|
1140
|
+
type: "button",
|
|
1141
|
+
className: `agent-timeline__station-node agent-timeline__station-node--${N}`,
|
|
1142
|
+
"aria-label": `${Rt(_.type)}: ${It(_.entry)}`,
|
|
1143
|
+
children: [
|
|
1144
|
+
y && /* @__PURE__ */ a(P, { name: "check-solid", size: 16, color: "currentColor" }),
|
|
1145
|
+
I && /* @__PURE__ */ a(P, { 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: Rt(_.type) }),
|
|
1151
|
+
/* @__PURE__ */ a("span", { className: "agent-timeline__label-entry", children: It(_.entry) }),
|
|
1152
|
+
/* @__PURE__ */ a("span", { className: "agent-timeline__label-time", children: ut(_.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(
|
|
1161
|
+
"span",
|
|
1162
|
+
{
|
|
1163
|
+
className: "agent-timeline__station-node agent-timeline__station-node--terminus",
|
|
1164
|
+
"aria-hidden": "true",
|
|
1165
|
+
children: /* @__PURE__ */ a(P, { 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
|
+
}, oa = [
|
|
1123
1173
|
"I'll get the details and come back to you",
|
|
1124
1174
|
"Skip this for now"
|
|
1125
|
-
],
|
|
1175
|
+
], la = (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 ?? oa
|
|
1133
1183
|
};
|
|
1134
|
-
},
|
|
1135
|
-
id:
|
|
1136
|
-
text:
|
|
1137
|
-
type:
|
|
1138
|
-
...
|
|
1139
|
-
})
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1184
|
+
}, Ae = (e) => ({
|
|
1185
|
+
id: e.id,
|
|
1186
|
+
text: e.text,
|
|
1187
|
+
type: e.author === ne.user ? kn : e.author === ne.system ? Nn : Gt,
|
|
1188
|
+
...e.followUpPrompts ? { followUpPrompts: e.followUpPrompts } : {}
|
|
1189
|
+
}), Ot = "MESSAGE_TYPE_REPOLL", Lt = "agentMessage:new_message", jt = "arbor-agent-", ve = {
|
|
1190
|
+
all: "ALL",
|
|
1191
|
+
checklist: "CHECKLIST",
|
|
1192
|
+
resources: "RESOURCES",
|
|
1193
|
+
chat: "CHAT",
|
|
1194
|
+
timeline: "TIMELINE"
|
|
1195
|
+
}, ca = new Set(Object.values(ve)), da = (e, t) => `${e.endsWith("-") ? e : `${e}-`}${t}`, ga = (e) => typeof e == "string" && ca.has(e) ? e : ve.all, ha = (e) => {
|
|
1196
|
+
if (!e || typeof e != "object")
|
|
1197
|
+
return null;
|
|
1198
|
+
const t = e;
|
|
1199
|
+
return t.type !== Ot ? null : {
|
|
1200
|
+
type: Ot,
|
|
1201
|
+
target: ga(t.target)
|
|
1202
|
+
};
|
|
1203
|
+
}, ua = (e) => {
|
|
1204
|
+
const t = Array.isArray(e) ? e : [e], n = [];
|
|
1205
|
+
for (const s of t) {
|
|
1206
|
+
const r = ha(s);
|
|
1207
|
+
r && n.push(r);
|
|
1208
|
+
}
|
|
1209
|
+
return n;
|
|
1210
|
+
}, pa = ({
|
|
1211
|
+
enabled: e,
|
|
1212
|
+
channelPrefix: t,
|
|
1213
|
+
agentId: n,
|
|
1214
|
+
subscribeToPusher: s,
|
|
1215
|
+
onRepoll: r
|
|
1216
|
+
}) => {
|
|
1217
|
+
const o = le(r);
|
|
1218
|
+
H(() => {
|
|
1219
|
+
o.current = r;
|
|
1220
|
+
}, [r]), H(() => {
|
|
1221
|
+
if (!e || !(t != null && t.trim()) || !s || !n)
|
|
1222
|
+
return;
|
|
1223
|
+
const i = da(t.trim(), n), u = s(
|
|
1224
|
+
i,
|
|
1225
|
+
Lt,
|
|
1226
|
+
(c) => {
|
|
1227
|
+
console.log("[agent-view pusher] message received", {
|
|
1228
|
+
channel: i,
|
|
1229
|
+
event: Lt,
|
|
1230
|
+
payload: c
|
|
1231
|
+
});
|
|
1232
|
+
for (const g of ua(c))
|
|
1233
|
+
o.current(g.target);
|
|
1234
|
+
}
|
|
1235
|
+
);
|
|
1236
|
+
return () => {
|
|
1237
|
+
u();
|
|
1238
|
+
};
|
|
1239
|
+
}, [e, t, n, s]);
|
|
1240
|
+
};
|
|
1241
|
+
class $e extends Error {
|
|
1242
|
+
constructor(t, n, s) {
|
|
1243
|
+
super(s ?? `Agent service request failed (${t})`), this.name = "AgentServiceError", this.status = t, this.detail = n;
|
|
1143
1244
|
}
|
|
1144
1245
|
}
|
|
1145
|
-
const
|
|
1246
|
+
const ma = "/api/v1", F = {
|
|
1146
1247
|
agentDefinitions: "/agent-definitions",
|
|
1147
1248
|
agents: "/agents",
|
|
1148
1249
|
conversations: "/conversations",
|
|
1149
1250
|
tripOptions: "/trip-options",
|
|
1150
1251
|
demoDataset: "/demo/dataset"
|
|
1151
|
-
},
|
|
1252
|
+
}, J = {
|
|
1152
1253
|
GET: "GET",
|
|
1153
1254
|
POST: "POST"
|
|
1154
|
-
},
|
|
1255
|
+
}, _a = {
|
|
1155
1256
|
error: "error"
|
|
1156
|
-
},
|
|
1257
|
+
}, fa = {
|
|
1157
1258
|
user: "user"
|
|
1158
|
-
},
|
|
1259
|
+
}, we = {
|
|
1159
1260
|
acceptJson: "application/json",
|
|
1160
1261
|
acceptHtml: "text/html",
|
|
1161
1262
|
acceptEventStream: "text/event-stream",
|
|
1162
1263
|
contentTypeJson: "application/json",
|
|
1163
1264
|
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
|
|
1265
|
+
}, va = 100, wa = (e) => {
|
|
1266
|
+
switch (e) {
|
|
1267
|
+
case bt.cancelled:
|
|
1268
|
+
return E.failed;
|
|
1269
|
+
case bt.archived:
|
|
1270
|
+
return E.complete;
|
|
1271
|
+
case E.hitl:
|
|
1272
|
+
case E.complete:
|
|
1273
|
+
case E.failed:
|
|
1274
|
+
case E["generating-a-response"]:
|
|
1275
|
+
return e;
|
|
1175
1276
|
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
|
|
1277
|
+
return E["generating-a-response"];
|
|
1278
|
+
}
|
|
1279
|
+
}, ya = (e) => {
|
|
1280
|
+
switch (e) {
|
|
1281
|
+
case gt.requires_attention:
|
|
1282
|
+
return $.hitl;
|
|
1283
|
+
case gt.in_progress:
|
|
1284
|
+
case gt.available:
|
|
1285
|
+
return $["generating-a-response"];
|
|
1286
|
+
case $.failed:
|
|
1287
|
+
case $.complete:
|
|
1288
|
+
case $.hitl:
|
|
1289
|
+
case $["generating-a-response"]:
|
|
1290
|
+
return e;
|
|
1190
1291
|
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:
|
|
1292
|
+
return $["generating-a-response"];
|
|
1293
|
+
}
|
|
1294
|
+
}, Vt = (e) => ({
|
|
1295
|
+
ref: e.name,
|
|
1296
|
+
display_name: e.display_name,
|
|
1297
|
+
agent_intent: e.agent_intent ?? "",
|
|
1298
|
+
description: e.description
|
|
1299
|
+
}), gs = (e) => ({
|
|
1300
|
+
id: e.id,
|
|
1301
|
+
name: e.name,
|
|
1302
|
+
...e.has_run_before ? { hasRunBefore: e.has_run_before } : {}
|
|
1303
|
+
}), ka = new Set(Object.values(he)), Na = (e) => ka.has(e) ? e : he.document_html, Aa = (e) => ({
|
|
1304
|
+
id: e.id,
|
|
1305
|
+
type: Na(e.type),
|
|
1306
|
+
title: e.title,
|
|
1307
|
+
createdDatetime: e.created_datetime,
|
|
1308
|
+
lastUpdatedDatetime: e.last_updated_datetime,
|
|
1309
|
+
misRecordUrl: e.mis_record_url
|
|
1310
|
+
}), ba = (e) => ({
|
|
1311
|
+
resources: e.resources.map(Aa),
|
|
1312
|
+
pageNumber: e.page_number,
|
|
1313
|
+
pageSize: e.page_size,
|
|
1314
|
+
totalRecords: e.total_records
|
|
1315
|
+
}), Sa = (e) => ({
|
|
1316
|
+
actionLog: (e.action_log ?? []).map((t) => ({
|
|
1317
|
+
timestamp: t.timestamp,
|
|
1318
|
+
type: t.type,
|
|
1319
|
+
entry: t.entry,
|
|
1320
|
+
origin: t.origin
|
|
1220
1321
|
})),
|
|
1221
|
-
chatSessions: (
|
|
1222
|
-
sessionId:
|
|
1223
|
-
timestamp:
|
|
1322
|
+
chatSessions: (e.chat_sessions ?? []).map((t) => ({
|
|
1323
|
+
sessionId: t.session_id,
|
|
1324
|
+
timestamp: t.timestamp
|
|
1224
1325
|
}))
|
|
1225
|
-
}),
|
|
1326
|
+
}), Ut = (e) => {
|
|
1226
1327
|
var n;
|
|
1227
|
-
const
|
|
1328
|
+
const t = e.invocation_id ?? e.id;
|
|
1228
1329
|
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:
|
|
1330
|
+
id: e.id,
|
|
1331
|
+
invocation_id: t,
|
|
1332
|
+
agent_definition_ref: e.agent_definition_ref,
|
|
1333
|
+
...e.agent_intent ? { agent_intent: e.agent_intent } : {},
|
|
1334
|
+
invocation_name: ((n = e.invocation_name) == null ? void 0 : n.trim()) || e.agent_definition_ref,
|
|
1335
|
+
application_id: e.application_id,
|
|
1336
|
+
...e.application_name ? { application_name: e.application_name } : {},
|
|
1337
|
+
created_by: e.created_by,
|
|
1338
|
+
status: wa(e.status),
|
|
1339
|
+
context_ref: e.context_ref ?? null,
|
|
1340
|
+
checklist_ref: e.checklist_ref ?? null
|
|
1240
1341
|
};
|
|
1241
|
-
},
|
|
1242
|
-
var
|
|
1342
|
+
}, Yt = (e) => {
|
|
1343
|
+
var t;
|
|
1243
1344
|
return {
|
|
1244
|
-
task:
|
|
1245
|
-
status:
|
|
1246
|
-
description:
|
|
1247
|
-
...
|
|
1248
|
-
...(
|
|
1345
|
+
task: e.item ?? e.task ?? e.name ?? e.label ?? On,
|
|
1346
|
+
status: ya(e.status),
|
|
1347
|
+
description: e.description ?? "",
|
|
1348
|
+
...e.prompt ? { prompt: e.prompt } : {},
|
|
1349
|
+
...(t = e.follow_up_prompts) != null && t.length ? { clarificationPrompts: e.follow_up_prompts } : {}
|
|
1249
1350
|
};
|
|
1250
|
-
},
|
|
1351
|
+
}, Ca = (e) => Array.isArray(e) ? e : e.checklist_items ?? e.checklist ?? e.items ?? [], Xt = (e, t, n) => {
|
|
1251
1352
|
var o;
|
|
1252
|
-
const
|
|
1353
|
+
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
1354
|
return {
|
|
1254
|
-
invocation_id:
|
|
1255
|
-
checklist:
|
|
1355
|
+
invocation_id: e,
|
|
1356
|
+
checklist: Ca(t).map(Yt),
|
|
1256
1357
|
...r ? { openingMessage: r } : {}
|
|
1257
1358
|
};
|
|
1258
|
-
},
|
|
1259
|
-
const n =
|
|
1359
|
+
}, Ea = (e, t) => {
|
|
1360
|
+
const n = nt(t);
|
|
1260
1361
|
return {
|
|
1261
|
-
invocation_id:
|
|
1262
|
-
checklist: (
|
|
1362
|
+
invocation_id: t.invocation_id ?? e,
|
|
1363
|
+
checklist: (t.checklist_items ?? []).map(Yt),
|
|
1263
1364
|
...n ? { openingMessage: n } : {}
|
|
1264
1365
|
};
|
|
1265
|
-
},
|
|
1266
|
-
var n,
|
|
1267
|
-
const
|
|
1268
|
-
if (
|
|
1366
|
+
}, nt = (e) => {
|
|
1367
|
+
var n, s;
|
|
1368
|
+
const t = (n = e.opening_message) == null ? void 0 : n.trim();
|
|
1369
|
+
if (t)
|
|
1269
1370
|
return {
|
|
1270
|
-
id:
|
|
1271
|
-
author:
|
|
1272
|
-
text:
|
|
1273
|
-
...(
|
|
1371
|
+
id: Ft,
|
|
1372
|
+
author: ne.agent,
|
|
1373
|
+
text: t,
|
|
1374
|
+
...(s = e.opening_follow_up_prompts) != null && s.length ? { followUpPrompts: e.opening_follow_up_prompts } : {}
|
|
1274
1375
|
};
|
|
1275
|
-
},
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1376
|
+
}, Ta = (e) => {
|
|
1377
|
+
try {
|
|
1378
|
+
const t = JSON.parse(e);
|
|
1379
|
+
if (Array.isArray(t)) {
|
|
1380
|
+
const n = t.filter(
|
|
1381
|
+
(s) => !!s && typeof s == "object" && typeof s.text == "string"
|
|
1382
|
+
).map((s) => s.text);
|
|
1383
|
+
if (n.length > 0)
|
|
1384
|
+
return n.join(`
|
|
1385
|
+
`);
|
|
1386
|
+
}
|
|
1387
|
+
} catch {
|
|
1388
|
+
}
|
|
1389
|
+
return e;
|
|
1390
|
+
}, Ra = (e) => {
|
|
1391
|
+
const t = e.trim();
|
|
1392
|
+
return t.length > 0 ? `File upload
|
|
1393
|
+
|
|
1394
|
+
${t}` : "File upload";
|
|
1395
|
+
}, Ia = (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) => {
|
|
1396
|
+
if (t.message_type === "user_file") {
|
|
1397
|
+
const n = typeof t.content == "string" ? t.content : "", s = Ta(n);
|
|
1398
|
+
return {
|
|
1399
|
+
id: t.message_id,
|
|
1400
|
+
author: ne.user,
|
|
1401
|
+
kind: An.user_file,
|
|
1402
|
+
text: Ra(s)
|
|
1403
|
+
};
|
|
1404
|
+
}
|
|
1405
|
+
return {
|
|
1406
|
+
id: t.message_id,
|
|
1407
|
+
author: t.role === "user" ? ne.user : ne.agent,
|
|
1408
|
+
text: t.content
|
|
1409
|
+
};
|
|
1410
|
+
}), Oa = /:invocationId\b/g, La = /:resourceId\b/g, Ua = (e) => e.trim().replace(/^Bearer\s+/i, ""), Pa = (e) => e.endsWith("/") ? e.slice(0, -1) : e;
|
|
1411
|
+
class ft {
|
|
1412
|
+
constructor(t) {
|
|
1413
|
+
var s;
|
|
1414
|
+
this.baseUrl = Pa(t.baseUrl ?? "");
|
|
1415
|
+
const n = (s = t.token) == null ? void 0 : s.trim();
|
|
1416
|
+
this.token = n ? Ua(n) : void 0, this.customHeaders = t.headers, this.urls = t.urls ?? {}, this.fetchImpl = t.fetch ?? globalThis.fetch.bind(globalThis);
|
|
1288
1417
|
}
|
|
1289
1418
|
// Replaces the extra headers merged into every subsequent request,
|
|
1290
1419
|
// without recreating the client (e.g. an application-URL header that
|
|
1291
1420
|
// changes as the user switches institutions).
|
|
1292
|
-
setHeaders(
|
|
1293
|
-
this.customHeaders =
|
|
1421
|
+
setHeaders(t) {
|
|
1422
|
+
this.customHeaders = t;
|
|
1294
1423
|
}
|
|
1295
1424
|
async listAgentDefinitions() {
|
|
1296
1425
|
return (await this.request(
|
|
1297
|
-
|
|
1298
|
-
this.resolveUrl("agentDefinitions",
|
|
1426
|
+
J.GET,
|
|
1427
|
+
this.resolveUrl("agentDefinitions", F.agentDefinitions)
|
|
1299
1428
|
)).agent_definitions ?? [];
|
|
1300
1429
|
}
|
|
1301
|
-
getAgentDefinition(
|
|
1430
|
+
getAgentDefinition(t) {
|
|
1302
1431
|
return this.request(
|
|
1303
|
-
|
|
1304
|
-
this.apiUrl(`${
|
|
1432
|
+
J.GET,
|
|
1433
|
+
this.apiUrl(`${F.agentDefinitions}/${encodeURIComponent(t)}`)
|
|
1305
1434
|
);
|
|
1306
1435
|
}
|
|
1307
1436
|
listTripOptions() {
|
|
1308
|
-
return this.request(
|
|
1437
|
+
return this.request(J.GET, this.apiUrl(F.tripOptions));
|
|
1309
1438
|
}
|
|
1310
1439
|
getDataset() {
|
|
1311
1440
|
return this.request(
|
|
1312
|
-
|
|
1313
|
-
this.apiUrl(
|
|
1441
|
+
J.GET,
|
|
1442
|
+
this.apiUrl(F.demoDataset)
|
|
1314
1443
|
);
|
|
1315
1444
|
}
|
|
1316
|
-
setDataset(
|
|
1445
|
+
setDataset(t) {
|
|
1317
1446
|
return this.request(
|
|
1318
|
-
|
|
1319
|
-
this.apiUrl(
|
|
1320
|
-
{ dataset:
|
|
1447
|
+
J.POST,
|
|
1448
|
+
this.apiUrl(F.demoDataset),
|
|
1449
|
+
{ dataset: t }
|
|
1321
1450
|
);
|
|
1322
1451
|
}
|
|
1323
|
-
listAgents(
|
|
1452
|
+
listAgents(t = {}) {
|
|
1324
1453
|
const n = new URLSearchParams();
|
|
1325
|
-
|
|
1326
|
-
const
|
|
1454
|
+
t.status && n.set("status", t.status), t.agentDefinitionRef && n.set("agent_definition_ref", t.agentDefinitionRef);
|
|
1455
|
+
const s = n.toString() ? `?${n.toString()}` : "";
|
|
1327
1456
|
return this.request(
|
|
1328
|
-
|
|
1329
|
-
`${this.resolveUrl("agents",
|
|
1457
|
+
J.GET,
|
|
1458
|
+
`${this.resolveUrl("agents", F.agents)}${s}`
|
|
1330
1459
|
);
|
|
1331
1460
|
}
|
|
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
|
-
|
|
1461
|
+
createAgent(t, n = {}) {
|
|
1462
|
+
var i, u;
|
|
1463
|
+
const s = {
|
|
1464
|
+
agent_definition_ref: t
|
|
1465
|
+
}, r = (i = n.invocationName) == null ? void 0 : i.trim(), o = (u = n.agentIntent) == null ? void 0 : u.trim();
|
|
1466
|
+
return r && (s.invocation_name = r), o && (s.agent_intent = o), this.request(
|
|
1467
|
+
J.POST,
|
|
1468
|
+
this.resolveUrl("agents", F.agents),
|
|
1469
|
+
s
|
|
1341
1470
|
);
|
|
1342
1471
|
}
|
|
1343
|
-
getAgent(
|
|
1472
|
+
getAgent(t) {
|
|
1344
1473
|
return this.request(
|
|
1345
|
-
|
|
1346
|
-
this.resolveUrl("agent", `${
|
|
1474
|
+
J.GET,
|
|
1475
|
+
this.resolveUrl("agent", `${F.agents}/${encodeURIComponent(t)}`, t)
|
|
1347
1476
|
);
|
|
1348
1477
|
}
|
|
1349
|
-
getAgentChecklist(
|
|
1478
|
+
getAgentChecklist(t) {
|
|
1350
1479
|
return this.request(
|
|
1351
|
-
|
|
1480
|
+
J.GET,
|
|
1352
1481
|
this.resolveUrl(
|
|
1353
1482
|
"agentChecklist",
|
|
1354
|
-
`${
|
|
1355
|
-
|
|
1483
|
+
`${F.agents}/${encodeURIComponent(t)}/checklist`,
|
|
1484
|
+
t
|
|
1356
1485
|
)
|
|
1357
1486
|
);
|
|
1358
1487
|
}
|
|
1359
|
-
getAgentResources(
|
|
1360
|
-
const
|
|
1361
|
-
n.pageNumber !== void 0 &&
|
|
1362
|
-
const r =
|
|
1488
|
+
getAgentResources(t, n = {}) {
|
|
1489
|
+
const s = new URLSearchParams();
|
|
1490
|
+
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);
|
|
1491
|
+
const r = s.toString(), o = this.resolveUrl(
|
|
1363
1492
|
"agentResources",
|
|
1364
|
-
`${
|
|
1365
|
-
|
|
1493
|
+
`${F.agents}/${encodeURIComponent(t)}/resources`,
|
|
1494
|
+
t
|
|
1366
1495
|
);
|
|
1367
1496
|
return this.request(
|
|
1368
|
-
|
|
1497
|
+
J.GET,
|
|
1369
1498
|
r ? `${o}?${r}` : o
|
|
1370
1499
|
);
|
|
1371
1500
|
}
|
|
1372
|
-
async listAllAgentResources(
|
|
1373
|
-
const n =
|
|
1374
|
-
let
|
|
1501
|
+
async listAllAgentResources(t) {
|
|
1502
|
+
const n = va;
|
|
1503
|
+
let s = 1;
|
|
1375
1504
|
const r = [];
|
|
1376
1505
|
let o = Number.POSITIVE_INFINITY;
|
|
1377
1506
|
for (; r.length < o; ) {
|
|
1378
|
-
const i =
|
|
1379
|
-
await this.getAgentResources(
|
|
1507
|
+
const i = ba(
|
|
1508
|
+
await this.getAgentResources(t, { pageNumber: s, pageSize: n })
|
|
1380
1509
|
);
|
|
1381
1510
|
if (o = i.totalRecords, i.resources.length === 0 || (r.push(...i.resources), r.length >= o))
|
|
1382
1511
|
break;
|
|
1383
|
-
|
|
1512
|
+
s += 1;
|
|
1384
1513
|
}
|
|
1385
1514
|
return r;
|
|
1386
1515
|
}
|
|
1387
|
-
getAgentResourceHtml(
|
|
1388
|
-
return this.requestText(
|
|
1516
|
+
getAgentResourceHtml(t, n) {
|
|
1517
|
+
return this.requestText(J.GET, this.resolveResourceHtmlUrl(t, n));
|
|
1389
1518
|
}
|
|
1390
|
-
getAgentTimeline(
|
|
1519
|
+
getAgentTimeline(t) {
|
|
1391
1520
|
return this.request(
|
|
1392
|
-
|
|
1521
|
+
J.GET,
|
|
1393
1522
|
this.resolveUrl(
|
|
1394
1523
|
"agentTimeline",
|
|
1395
|
-
`${
|
|
1396
|
-
|
|
1524
|
+
`${F.agents}/${encodeURIComponent(t)}/agent-timeline`,
|
|
1525
|
+
t
|
|
1397
1526
|
)
|
|
1398
1527
|
);
|
|
1399
1528
|
}
|
|
1400
|
-
getAgentContext(
|
|
1529
|
+
getAgentContext(t) {
|
|
1401
1530
|
return this.request(
|
|
1402
|
-
|
|
1403
|
-
this.apiUrl(`${
|
|
1531
|
+
J.GET,
|
|
1532
|
+
this.apiUrl(`${F.agents}/${encodeURIComponent(t)}/context`)
|
|
1404
1533
|
);
|
|
1405
1534
|
}
|
|
1406
|
-
cancelAgent(
|
|
1535
|
+
cancelAgent(t) {
|
|
1407
1536
|
return this.request(
|
|
1408
|
-
|
|
1409
|
-
this.
|
|
1537
|
+
J.POST,
|
|
1538
|
+
this.resolveUrl(
|
|
1539
|
+
"stopAgent",
|
|
1540
|
+
`${F.agents}/${encodeURIComponent(t)}/cancel`,
|
|
1541
|
+
t
|
|
1542
|
+
)
|
|
1410
1543
|
);
|
|
1411
1544
|
}
|
|
1412
|
-
archiveAgent(
|
|
1545
|
+
archiveAgent(t) {
|
|
1413
1546
|
return this.request(
|
|
1414
|
-
|
|
1415
|
-
this.apiUrl(`${
|
|
1547
|
+
J.POST,
|
|
1548
|
+
this.apiUrl(`${F.agents}/${encodeURIComponent(t)}/archive`)
|
|
1416
1549
|
);
|
|
1417
1550
|
}
|
|
1418
|
-
getConversation(
|
|
1551
|
+
getConversation(t) {
|
|
1419
1552
|
return this.request(
|
|
1420
|
-
|
|
1553
|
+
J.GET,
|
|
1421
1554
|
this.resolveUrl(
|
|
1422
1555
|
"agentConversation",
|
|
1423
|
-
`${
|
|
1424
|
-
|
|
1556
|
+
`${F.conversations}/${encodeURIComponent(t)}`,
|
|
1557
|
+
t
|
|
1425
1558
|
)
|
|
1426
1559
|
);
|
|
1427
1560
|
}
|
|
1428
1561
|
// Streams a chat turn. Resolves with the final SSE event; `onEvent` fires
|
|
1429
1562
|
// for every event as it arrives.
|
|
1430
|
-
async chat(
|
|
1431
|
-
const r = !!(
|
|
1563
|
+
async chat(t, n, s = {}) {
|
|
1564
|
+
const r = !!(s.uploadFiles && s.uploadFiles.length > 0), o = await this.fetchImpl(
|
|
1432
1565
|
this.resolveUrl(
|
|
1433
1566
|
"agentChat",
|
|
1434
|
-
`${
|
|
1435
|
-
|
|
1567
|
+
`${F.agents}/${encodeURIComponent(t)}/chat`,
|
|
1568
|
+
t
|
|
1436
1569
|
),
|
|
1437
1570
|
{
|
|
1438
|
-
method:
|
|
1571
|
+
method: J.POST,
|
|
1439
1572
|
headers: {
|
|
1440
1573
|
...this.customHeaders,
|
|
1441
1574
|
...this.authHeaders(),
|
|
1442
|
-
Accept:
|
|
1575
|
+
Accept: we.acceptEventStream,
|
|
1443
1576
|
// Let the browser set the multipart boundary when uploading.
|
|
1444
|
-
...r ? {} : { "Content-Type":
|
|
1577
|
+
...r ? {} : { "Content-Type": we.contentTypeJson }
|
|
1445
1578
|
},
|
|
1446
|
-
body: r ?
|
|
1447
|
-
signal:
|
|
1579
|
+
body: r ? Da(n, s.uploadFiles ?? []) : JSON.stringify(n),
|
|
1580
|
+
signal: s.signal
|
|
1448
1581
|
}
|
|
1449
1582
|
);
|
|
1450
1583
|
if (!o.ok)
|
|
1451
1584
|
throw await this.toError(o);
|
|
1452
1585
|
if (!o.body)
|
|
1453
|
-
throw new
|
|
1454
|
-
return this.consumeSse(o.body,
|
|
1586
|
+
throw new $e(o.status, null, "Chat response contained no stream body");
|
|
1587
|
+
return this.consumeSse(o.body, s.onEvent);
|
|
1455
1588
|
}
|
|
1456
1589
|
authHeaders() {
|
|
1457
1590
|
return this.token ? { Authorization: `Bearer ${this.token}` } : {};
|
|
1458
1591
|
}
|
|
1459
1592
|
// Builds a URL from the base url + shared API prefix + route.
|
|
1460
|
-
apiUrl(
|
|
1461
|
-
return `${this.baseUrl}${
|
|
1593
|
+
apiUrl(t) {
|
|
1594
|
+
return `${this.baseUrl}${ma}${t}`;
|
|
1462
1595
|
}
|
|
1463
1596
|
// Resolves the URL for an operation, preferring a per-operation override
|
|
1464
1597
|
// (with `:invocationId` substituted) and falling back to the base url.
|
|
1465
|
-
resolveUrl(
|
|
1466
|
-
const o = this.urls[
|
|
1598
|
+
resolveUrl(t, n, s, r) {
|
|
1599
|
+
const o = this.urls[t];
|
|
1467
1600
|
if (!o)
|
|
1468
1601
|
return this.apiUrl(n);
|
|
1469
1602
|
let i = o;
|
|
1470
|
-
return
|
|
1603
|
+
return s && (i = i.replace(Oa, encodeURIComponent(s))), r && (i = i.replace(La, encodeURIComponent(r))), i;
|
|
1471
1604
|
}
|
|
1472
|
-
resolveResourceHtmlUrl(
|
|
1605
|
+
resolveResourceHtmlUrl(t, n) {
|
|
1473
1606
|
return this.urls.agentResourceHtml ? this.resolveUrl(
|
|
1474
1607
|
"agentResourceHtml",
|
|
1475
|
-
`${
|
|
1608
|
+
`${F.agents}/${encodeURIComponent(t)}/resources/${encodeURIComponent(
|
|
1476
1609
|
n
|
|
1477
1610
|
)}`,
|
|
1478
|
-
|
|
1611
|
+
t,
|
|
1479
1612
|
n
|
|
1480
1613
|
) : this.urls.agentResources ? `${this.resolveUrl(
|
|
1481
1614
|
"agentResources",
|
|
1482
|
-
`${
|
|
1483
|
-
|
|
1615
|
+
`${F.agents}/${encodeURIComponent(t)}/resources`,
|
|
1616
|
+
t
|
|
1484
1617
|
).replace(/\/$/, "")}/${encodeURIComponent(n)}` : this.apiUrl(
|
|
1485
|
-
`${
|
|
1618
|
+
`${F.agents}/${encodeURIComponent(t)}/resources/${encodeURIComponent(
|
|
1486
1619
|
n
|
|
1487
1620
|
)}`
|
|
1488
1621
|
);
|
|
1489
1622
|
}
|
|
1490
|
-
async request(
|
|
1623
|
+
async request(t, n, s) {
|
|
1491
1624
|
const r = await this.fetchImpl(n, {
|
|
1492
|
-
method:
|
|
1625
|
+
method: t,
|
|
1493
1626
|
headers: {
|
|
1494
1627
|
...this.customHeaders,
|
|
1495
1628
|
...this.authHeaders(),
|
|
1496
|
-
Accept:
|
|
1497
|
-
...
|
|
1629
|
+
Accept: we.acceptJson,
|
|
1630
|
+
...s === void 0 ? {} : { "Content-Type": we.contentTypeJson }
|
|
1498
1631
|
},
|
|
1499
|
-
...
|
|
1632
|
+
...s === void 0 ? {} : { body: JSON.stringify(s) }
|
|
1500
1633
|
});
|
|
1501
1634
|
if (!r.ok)
|
|
1502
1635
|
throw await this.toError(r);
|
|
1503
1636
|
if (r.status !== 204)
|
|
1504
1637
|
return await r.json();
|
|
1505
1638
|
}
|
|
1506
|
-
async requestText(
|
|
1507
|
-
const
|
|
1508
|
-
method:
|
|
1639
|
+
async requestText(t, n) {
|
|
1640
|
+
const s = await this.fetchImpl(n, {
|
|
1641
|
+
method: t,
|
|
1509
1642
|
headers: {
|
|
1510
1643
|
...this.customHeaders,
|
|
1511
1644
|
...this.authHeaders(),
|
|
1512
|
-
Accept:
|
|
1645
|
+
Accept: we.acceptHtml
|
|
1513
1646
|
}
|
|
1514
1647
|
});
|
|
1515
|
-
if (!
|
|
1516
|
-
throw await this.toError(
|
|
1517
|
-
return
|
|
1648
|
+
if (!s.ok)
|
|
1649
|
+
throw await this.toError(s);
|
|
1650
|
+
return s.text();
|
|
1518
1651
|
}
|
|
1519
|
-
async toError(
|
|
1652
|
+
async toError(t) {
|
|
1520
1653
|
let n = null;
|
|
1521
1654
|
try {
|
|
1522
|
-
n = await
|
|
1655
|
+
n = await t.json();
|
|
1523
1656
|
} catch {
|
|
1524
1657
|
}
|
|
1525
|
-
return new
|
|
1526
|
-
|
|
1658
|
+
return new $e(
|
|
1659
|
+
t.status,
|
|
1527
1660
|
n,
|
|
1528
|
-
`Agent service request failed (${
|
|
1661
|
+
`Agent service request failed (${t.status} ${t.statusText})`
|
|
1529
1662
|
);
|
|
1530
1663
|
}
|
|
1531
|
-
async consumeSse(
|
|
1532
|
-
const
|
|
1664
|
+
async consumeSse(t, n) {
|
|
1665
|
+
const s = t.getReader(), r = new TextDecoder();
|
|
1533
1666
|
let o = "", i;
|
|
1534
|
-
const
|
|
1535
|
-
const { event:
|
|
1536
|
-
if (
|
|
1667
|
+
const u = (c) => {
|
|
1668
|
+
const { event: g, data: _ } = xa(c);
|
|
1669
|
+
if (_ === null)
|
|
1537
1670
|
return;
|
|
1538
|
-
if (
|
|
1539
|
-
const
|
|
1540
|
-
throw new
|
|
1671
|
+
if (g === _a.error) {
|
|
1672
|
+
const y = Pt(_);
|
|
1673
|
+
throw new $e(502, y, (y == null ? void 0 : y.message) ?? "Chat stream error");
|
|
1541
1674
|
}
|
|
1542
|
-
const
|
|
1543
|
-
|
|
1675
|
+
const N = Pt(_);
|
|
1676
|
+
N && (i = N, n == null || n(N));
|
|
1544
1677
|
};
|
|
1545
1678
|
for (; ; ) {
|
|
1546
|
-
const { done: c, value:
|
|
1679
|
+
const { done: c, value: g } = await s.read();
|
|
1547
1680
|
if (c)
|
|
1548
1681
|
break;
|
|
1549
|
-
o += r.decode(
|
|
1550
|
-
const
|
|
1682
|
+
o += r.decode(g, { stream: !0 });
|
|
1683
|
+
const _ = o.split(`
|
|
1551
1684
|
|
|
1552
1685
|
`);
|
|
1553
|
-
o =
|
|
1554
|
-
for (const
|
|
1555
|
-
|
|
1686
|
+
o = _.pop() ?? "";
|
|
1687
|
+
for (const N of _)
|
|
1688
|
+
u(N);
|
|
1556
1689
|
}
|
|
1557
|
-
if (o.trim() &&
|
|
1558
|
-
throw new
|
|
1690
|
+
if (o.trim() && u(o), !i)
|
|
1691
|
+
throw new $e(502, null, "Chat stream ended without any events");
|
|
1559
1692
|
return i;
|
|
1560
1693
|
}
|
|
1561
1694
|
}
|
|
1562
|
-
const
|
|
1563
|
-
let
|
|
1695
|
+
const xa = (e) => {
|
|
1696
|
+
let t = null;
|
|
1564
1697
|
const n = [];
|
|
1565
|
-
for (const
|
|
1698
|
+
for (const s of e.split(`
|
|
1566
1699
|
`)) {
|
|
1567
|
-
const r =
|
|
1568
|
-
r.startsWith("event:") ?
|
|
1700
|
+
const r = s.trimEnd();
|
|
1701
|
+
r.startsWith("event:") ? t = r.slice(6).trim() : r.startsWith("data:") && n.push(r.slice(5).trim());
|
|
1569
1702
|
}
|
|
1570
1703
|
return {
|
|
1571
|
-
event:
|
|
1704
|
+
event: t,
|
|
1572
1705
|
data: n.length > 0 ? n.join(`
|
|
1573
1706
|
`) : null
|
|
1574
1707
|
};
|
|
1575
|
-
},
|
|
1708
|
+
}, Pt = (e) => {
|
|
1576
1709
|
try {
|
|
1577
|
-
return JSON.parse(
|
|
1710
|
+
return JSON.parse(e);
|
|
1578
1711
|
} catch {
|
|
1579
1712
|
return;
|
|
1580
1713
|
}
|
|
1581
1714
|
};
|
|
1582
|
-
function
|
|
1715
|
+
function Da(e, t) {
|
|
1583
1716
|
const n = new FormData();
|
|
1584
|
-
n.append("body", JSON.stringify(
|
|
1585
|
-
for (const
|
|
1586
|
-
n.append("files",
|
|
1717
|
+
n.append("body", JSON.stringify(e));
|
|
1718
|
+
for (const s of t)
|
|
1719
|
+
n.append("files", s, s.name);
|
|
1587
1720
|
return n;
|
|
1588
1721
|
}
|
|
1589
|
-
const
|
|
1590
|
-
id:
|
|
1591
|
-
author:
|
|
1722
|
+
const Ma = {
|
|
1723
|
+
id: Ft,
|
|
1724
|
+
author: ne.agent,
|
|
1592
1725
|
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
1726
|
};
|
|
1594
|
-
let
|
|
1595
|
-
const
|
|
1596
|
-
const
|
|
1597
|
-
return `Let's get started on ${
|
|
1727
|
+
let xt = 0;
|
|
1728
|
+
const $a = (e) => (xt += 1, `${e}-${Date.now()}-${xt}`), Ha = (e) => {
|
|
1729
|
+
const t = e.destination ? ` to ${e.destination}` : "";
|
|
1730
|
+
return `Let's get started on ${e.tripName.trim() || e.destination.trim() || "this task"}${t}. What will you do first?`;
|
|
1598
1731
|
};
|
|
1599
|
-
class
|
|
1600
|
-
constructor(
|
|
1601
|
-
this.seededChecklist = [], this.client =
|
|
1732
|
+
class za {
|
|
1733
|
+
constructor(t, n, s = {}) {
|
|
1734
|
+
this.seededChecklist = [], this.client = t, this.agentId = n, this.chatId = s.chatId ?? n, this.opening = s.openingMessage ?? Ma, this.model = s.model;
|
|
1602
1735
|
}
|
|
1603
1736
|
openingMessage() {
|
|
1604
1737
|
return this.opening;
|
|
1605
1738
|
}
|
|
1606
1739
|
async bootstrapConversation() {
|
|
1607
|
-
const
|
|
1740
|
+
const t = await this.client.getConversation(this.chatId), n = Ia(t.messages);
|
|
1608
1741
|
return n.length === 0 ? [this.opening] : n;
|
|
1609
1742
|
}
|
|
1610
|
-
async start(
|
|
1611
|
-
return { ...await this.exchange(
|
|
1743
|
+
async start(t) {
|
|
1744
|
+
return { ...await this.exchange(Ha(t)), phase: B.running };
|
|
1612
1745
|
}
|
|
1613
|
-
sendMessage(
|
|
1614
|
-
return this.exchange(
|
|
1746
|
+
sendMessage(t, n) {
|
|
1747
|
+
return this.exchange(t, n);
|
|
1615
1748
|
}
|
|
1616
1749
|
async stop() {
|
|
1750
|
+
await this.client.cancelAgent(this.agentId);
|
|
1617
1751
|
}
|
|
1618
|
-
seedChecklist(
|
|
1619
|
-
this.seededChecklist =
|
|
1752
|
+
seedChecklist(t) {
|
|
1753
|
+
this.seededChecklist = t;
|
|
1620
1754
|
}
|
|
1621
|
-
async exchange(
|
|
1755
|
+
async exchange(t, n) {
|
|
1622
1756
|
var i;
|
|
1623
|
-
const
|
|
1757
|
+
const s = [{ role: fa.user, content: t }], r = await this.client.chat(
|
|
1624
1758
|
this.agentId,
|
|
1625
1759
|
{
|
|
1626
|
-
messages:
|
|
1760
|
+
messages: s,
|
|
1627
1761
|
chat_id: this.chatId,
|
|
1628
1762
|
...this.model ? { model: this.model } : {},
|
|
1629
1763
|
moderation_enabled: !0,
|
|
@@ -1634,623 +1768,679 @@ class _s {
|
|
|
1634
1768
|
},
|
|
1635
1769
|
...n && n.length > 0 ? [{ uploadFiles: n }] : []
|
|
1636
1770
|
), o = {
|
|
1637
|
-
id: r.event_id ||
|
|
1638
|
-
author:
|
|
1771
|
+
id: r.event_id || $a("msg-agent"),
|
|
1772
|
+
author: ne.agent,
|
|
1639
1773
|
text: r.message.content,
|
|
1640
1774
|
...(i = r.follow_up_prompts) != null && i.length ? { followUpPrompts: r.follow_up_prompts } : {}
|
|
1641
1775
|
};
|
|
1642
1776
|
try {
|
|
1643
|
-
const
|
|
1777
|
+
const u = await this.client.getAgent(this.agentId), { checklist: c } = Ea(this.agentId, u);
|
|
1644
1778
|
return this.seededChecklist = c, { message: o, checklist: c };
|
|
1645
1779
|
} catch {
|
|
1646
1780
|
return { message: o, ...this.seededChecklist.length ? { checklist: this.seededChecklist } : {} };
|
|
1647
1781
|
}
|
|
1648
1782
|
}
|
|
1649
1783
|
}
|
|
1650
|
-
const
|
|
1651
|
-
var
|
|
1652
|
-
return new
|
|
1653
|
-
model:
|
|
1654
|
-
chatId: ((
|
|
1655
|
-
openingMessage: ((r =
|
|
1784
|
+
const Zt = (e, t) => (n) => {
|
|
1785
|
+
var s, r;
|
|
1786
|
+
return new za(e, n.invocation_id, {
|
|
1787
|
+
model: t == null ? void 0 : t.model,
|
|
1788
|
+
chatId: ((s = t == null ? void 0 : t.resolveChatId) == null ? void 0 : s.call(t, n)) ?? (t == null ? void 0 : t.chatId) ?? n.invocation_id,
|
|
1789
|
+
openingMessage: ((r = t == null ? void 0 : t.resolveOpeningMessage) == null ? void 0 : r.call(t, n)) ?? (t == null ? void 0 : t.openingMessage)
|
|
1656
1790
|
});
|
|
1657
|
-
},
|
|
1658
|
-
const
|
|
1659
|
-
for (const n of
|
|
1660
|
-
const
|
|
1661
|
-
if (!
|
|
1791
|
+
}, Qt = (e) => e instanceof $e ? e.message : e instanceof TypeError ? "Network error while contacting the agent service." : e instanceof Error && e.message ? e.message : qt, Ga = (e) => {
|
|
1792
|
+
const t = {};
|
|
1793
|
+
for (const n of e) {
|
|
1794
|
+
const s = nt(n);
|
|
1795
|
+
if (!s)
|
|
1662
1796
|
continue;
|
|
1663
1797
|
const r = n.invocation_id ?? n.id;
|
|
1664
|
-
|
|
1798
|
+
t[r] = s, t[n.id] = s;
|
|
1665
1799
|
}
|
|
1666
|
-
return
|
|
1667
|
-
},
|
|
1668
|
-
const { jwt:
|
|
1669
|
-
() => new
|
|
1670
|
-
token:
|
|
1800
|
+
return t;
|
|
1801
|
+
}, Fa = (e) => JSON.stringify(e), pt = (e, t) => JSON.stringify(e) === JSON.stringify(t), Ba = (e) => {
|
|
1802
|
+
const { jwt: t, headers: n, urls: s } = e, r = JSON.stringify(n ?? {}), o = Fa(s), i = Y(
|
|
1803
|
+
() => new ft({
|
|
1804
|
+
token: t,
|
|
1671
1805
|
headers: n,
|
|
1672
|
-
urls:
|
|
1806
|
+
urls: s
|
|
1673
1807
|
}),
|
|
1674
1808
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- keyed on serialised config to keep a stable client.
|
|
1675
|
-
[
|
|
1809
|
+
[t, o]
|
|
1676
1810
|
);
|
|
1677
|
-
|
|
1811
|
+
Se(() => {
|
|
1678
1812
|
i.setHeaders(n);
|
|
1679
1813
|
}, [i, r]);
|
|
1680
|
-
const [
|
|
1814
|
+
const [u, c] = p([]), [g, _] = p(
|
|
1681
1815
|
[]
|
|
1682
|
-
), [
|
|
1683
|
-
(U,
|
|
1684
|
-
const
|
|
1816
|
+
), [N, y] = p({}), [I, L] = p("loading"), [f, K] = p(null), [T, O] = p(0), A = C(
|
|
1817
|
+
(U, G) => {
|
|
1818
|
+
const q = U.map(Ut), X = G.map(Vt), Z = Ga(U);
|
|
1685
1819
|
c(
|
|
1686
|
-
(
|
|
1687
|
-
),
|
|
1688
|
-
(
|
|
1689
|
-
),
|
|
1690
|
-
(
|
|
1691
|
-
),
|
|
1820
|
+
(D) => pt(D, q) ? D : q
|
|
1821
|
+
), _(
|
|
1822
|
+
(D) => pt(D, X) ? D : X
|
|
1823
|
+
), y(
|
|
1824
|
+
(D) => pt(D, Z) ? D : Z
|
|
1825
|
+
), L("idle"), K(null);
|
|
1692
1826
|
},
|
|
1693
1827
|
[]
|
|
1694
1828
|
);
|
|
1695
|
-
|
|
1829
|
+
H(() => {
|
|
1696
1830
|
let U = !1;
|
|
1697
|
-
return
|
|
1831
|
+
return L("loading"), K(null), (async () => {
|
|
1698
1832
|
try {
|
|
1699
|
-
const [
|
|
1833
|
+
const [G, q] = await Promise.all([
|
|
1700
1834
|
i.listAgents(),
|
|
1701
1835
|
i.listAgentDefinitions()
|
|
1702
1836
|
]);
|
|
1703
1837
|
if (U)
|
|
1704
1838
|
return;
|
|
1705
|
-
|
|
1706
|
-
} catch (
|
|
1839
|
+
A(G, q);
|
|
1840
|
+
} catch (G) {
|
|
1707
1841
|
if (U)
|
|
1708
1842
|
return;
|
|
1709
|
-
c([]),
|
|
1843
|
+
c([]), _([]), y({}), L("error"), K(Qt(G));
|
|
1710
1844
|
}
|
|
1711
1845
|
})(), () => {
|
|
1712
1846
|
U = !0;
|
|
1713
1847
|
};
|
|
1714
|
-
}, [
|
|
1715
|
-
const m =
|
|
1716
|
-
|
|
1717
|
-
}, []),
|
|
1848
|
+
}, [A, i, T]);
|
|
1849
|
+
const m = C(() => {
|
|
1850
|
+
O((U) => U + 1);
|
|
1851
|
+
}, []), b = C(async () => {
|
|
1718
1852
|
try {
|
|
1719
|
-
const [U,
|
|
1853
|
+
const [U, G] = await Promise.all([
|
|
1720
1854
|
i.listAgents(),
|
|
1721
1855
|
i.listAgentDefinitions()
|
|
1722
1856
|
]);
|
|
1723
|
-
|
|
1857
|
+
A(U, G);
|
|
1724
1858
|
} catch {
|
|
1725
1859
|
}
|
|
1726
|
-
}, [
|
|
1860
|
+
}, [A, i]), v = C(
|
|
1727
1861
|
async (U) => {
|
|
1728
|
-
const [
|
|
1862
|
+
const [G, q] = await Promise.all([
|
|
1729
1863
|
i.getAgentChecklist(U),
|
|
1730
1864
|
i.getAgent(U).catch(() => null)
|
|
1731
1865
|
]);
|
|
1732
|
-
return
|
|
1866
|
+
return Xt(
|
|
1733
1867
|
U,
|
|
1734
|
-
|
|
1735
|
-
|
|
1868
|
+
G,
|
|
1869
|
+
q ?? void 0
|
|
1736
1870
|
);
|
|
1737
1871
|
},
|
|
1738
1872
|
[i]
|
|
1739
|
-
),
|
|
1873
|
+
), R = C(
|
|
1740
1874
|
async (U) => i.listAllAgentResources(U),
|
|
1741
1875
|
[i]
|
|
1742
|
-
),
|
|
1876
|
+
), z = C(
|
|
1743
1877
|
async ({
|
|
1744
1878
|
definition: U,
|
|
1745
|
-
invocationName:
|
|
1879
|
+
invocationName: G
|
|
1746
1880
|
}) => {
|
|
1747
|
-
const
|
|
1748
|
-
invocationName:
|
|
1749
|
-
}),
|
|
1750
|
-
return c((
|
|
1751
|
-
...
|
|
1752
|
-
[
|
|
1753
|
-
[
|
|
1754
|
-
})),
|
|
1881
|
+
const q = await i.createAgent(U.ref, {
|
|
1882
|
+
invocationName: G
|
|
1883
|
+
}), X = await i.getAgent(q.id), Z = Ut(X), D = nt(X);
|
|
1884
|
+
return c((x) => [Z, ...x]), D && y((x) => ({
|
|
1885
|
+
...x,
|
|
1886
|
+
[Z.invocation_id]: D,
|
|
1887
|
+
[Z.id]: D
|
|
1888
|
+
})), Z;
|
|
1755
1889
|
},
|
|
1756
1890
|
[i]
|
|
1757
|
-
),
|
|
1758
|
-
() =>
|
|
1759
|
-
resolveOpeningMessage: (U) =>
|
|
1891
|
+
), Ee = Y(
|
|
1892
|
+
() => Zt(i, {
|
|
1893
|
+
resolveOpeningMessage: (U) => N[U.invocation_id] ?? N[U.id]
|
|
1760
1894
|
}),
|
|
1761
|
-
[i,
|
|
1895
|
+
[i, N]
|
|
1762
1896
|
);
|
|
1763
1897
|
return {
|
|
1764
|
-
agents:
|
|
1765
|
-
agentDefinitions:
|
|
1766
|
-
loadState:
|
|
1767
|
-
loadError:
|
|
1898
|
+
agents: u,
|
|
1899
|
+
agentDefinitions: g,
|
|
1900
|
+
loadState: I,
|
|
1901
|
+
loadError: f,
|
|
1768
1902
|
reload: m,
|
|
1769
|
-
refresh:
|
|
1770
|
-
fetchAgentChecklist:
|
|
1771
|
-
fetchAgentResources:
|
|
1772
|
-
createAgent:
|
|
1773
|
-
chatConnector:
|
|
1903
|
+
refresh: b,
|
|
1904
|
+
fetchAgentChecklist: v,
|
|
1905
|
+
fetchAgentResources: R,
|
|
1906
|
+
createAgent: z,
|
|
1907
|
+
chatConnector: Ee
|
|
1774
1908
|
};
|
|
1775
|
-
},
|
|
1776
|
-
const { agent:
|
|
1777
|
-
() => new
|
|
1909
|
+
}, qa = (e) => JSON.stringify(e), Ja = (e) => {
|
|
1910
|
+
const { agent: t, jwt: n, headers: s, urls: r, chatId: o } = e, i = JSON.stringify(s ?? {}), u = qa(r), c = Y(
|
|
1911
|
+
() => new ft({
|
|
1778
1912
|
token: n,
|
|
1779
|
-
headers:
|
|
1913
|
+
headers: s,
|
|
1780
1914
|
urls: {
|
|
1781
1915
|
agent: r.agentUrl,
|
|
1782
1916
|
agentChecklist: r.agentChecklistUrl,
|
|
1783
1917
|
...r.agentResourcesUrl ? { agentResources: r.agentResourcesUrl } : {},
|
|
1784
1918
|
...r.agentTimelineUrl ? { agentTimeline: r.agentTimelineUrl } : {},
|
|
1785
1919
|
agentChat: r.agentChatUrl,
|
|
1786
|
-
agentConversation: r.agentConversationUrl
|
|
1920
|
+
agentConversation: r.agentConversationUrl,
|
|
1921
|
+
...r.stopAgentUrl ? { stopAgent: r.stopAgentUrl } : {}
|
|
1787
1922
|
}
|
|
1788
1923
|
}),
|
|
1789
1924
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- keyed on serialised config to keep a stable client.
|
|
1790
|
-
[n,
|
|
1925
|
+
[n, u]
|
|
1791
1926
|
);
|
|
1792
|
-
|
|
1793
|
-
c.setHeaders(
|
|
1927
|
+
Se(() => {
|
|
1928
|
+
c.setHeaders(s);
|
|
1794
1929
|
}, [c, i]);
|
|
1795
|
-
const
|
|
1796
|
-
async (
|
|
1797
|
-
const [
|
|
1798
|
-
c.getAgentChecklist(
|
|
1799
|
-
c.getAgent(
|
|
1930
|
+
const g = C(
|
|
1931
|
+
async (L) => {
|
|
1932
|
+
const [f, K] = await Promise.all([
|
|
1933
|
+
c.getAgentChecklist(L),
|
|
1934
|
+
c.getAgent(L).catch(() => null)
|
|
1800
1935
|
]);
|
|
1801
|
-
return
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1936
|
+
return Xt(
|
|
1937
|
+
L,
|
|
1938
|
+
f,
|
|
1939
|
+
K ?? void 0
|
|
1805
1940
|
);
|
|
1806
1941
|
},
|
|
1807
1942
|
[c]
|
|
1808
|
-
),
|
|
1809
|
-
async (
|
|
1943
|
+
), _ = C(
|
|
1944
|
+
async (L) => c.listAllAgentResources(L),
|
|
1810
1945
|
[c]
|
|
1811
|
-
),
|
|
1812
|
-
async (
|
|
1946
|
+
), N = C(
|
|
1947
|
+
async (L, f) => c.getAgentResourceHtml(L, f),
|
|
1813
1948
|
[c]
|
|
1814
|
-
),
|
|
1815
|
-
async (
|
|
1816
|
-
const
|
|
1817
|
-
return
|
|
1949
|
+
), y = C(
|
|
1950
|
+
async (L) => {
|
|
1951
|
+
const f = await c.getAgentTimeline(L);
|
|
1952
|
+
return Sa(f);
|
|
1818
1953
|
},
|
|
1819
1954
|
[c]
|
|
1820
1955
|
);
|
|
1821
1956
|
return {
|
|
1822
1957
|
connector: Y(
|
|
1823
|
-
() =>
|
|
1824
|
-
chatId: o ??
|
|
1825
|
-
})(
|
|
1958
|
+
() => Zt(c, {
|
|
1959
|
+
chatId: o ?? t.invocation_id
|
|
1960
|
+
})(t),
|
|
1826
1961
|
// Key on invocation/chat ids so a new Agent object reference does not rebuild the connector.
|
|
1827
1962
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1828
|
-
[c,
|
|
1963
|
+
[c, t.invocation_id, o]
|
|
1829
1964
|
),
|
|
1830
|
-
fetchAgentChecklist:
|
|
1831
|
-
fetchAgentResources:
|
|
1832
|
-
fetchAgentResourceHtml:
|
|
1833
|
-
fetchAgentTimeline:
|
|
1965
|
+
fetchAgentChecklist: g,
|
|
1966
|
+
fetchAgentResources: _,
|
|
1967
|
+
fetchAgentResourceHtml: N,
|
|
1968
|
+
fetchAgentTimeline: y
|
|
1834
1969
|
};
|
|
1835
|
-
},
|
|
1836
|
-
const
|
|
1837
|
-
|
|
1838
|
-
},
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1970
|
+
}, en = (e) => {
|
|
1971
|
+
const t = document.querySelector(e);
|
|
1972
|
+
t instanceof HTMLElement && t.removeAttribute("aria-describedby");
|
|
1973
|
+
}, Ka = 3e4, Wa = (e, t) => {
|
|
1974
|
+
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." : "";
|
|
1975
|
+
return `${n}${s}.${r}`.trim();
|
|
1976
|
+
}, ja = (e) => {
|
|
1977
|
+
switch (e) {
|
|
1978
|
+
case E.failed:
|
|
1979
|
+
return B.stopped;
|
|
1980
|
+
case E.complete:
|
|
1981
|
+
return B.complete;
|
|
1844
1982
|
default:
|
|
1845
|
-
return
|
|
1983
|
+
return B.running;
|
|
1846
1984
|
}
|
|
1847
|
-
},
|
|
1848
|
-
|
|
1849
|
-
},
|
|
1850
|
-
const r =
|
|
1985
|
+
}, Dt = (e, t) => {
|
|
1986
|
+
t([Ae(e)]);
|
|
1987
|
+
}, Va = (e, t) => e.length === t.length && e.every((n, s) => {
|
|
1988
|
+
const r = t[s];
|
|
1851
1989
|
return r !== void 0 && n.id === r.id && n.text === r.text;
|
|
1852
|
-
}),
|
|
1853
|
-
agent:
|
|
1854
|
-
invocationId:
|
|
1990
|
+
}), Ya = ({
|
|
1991
|
+
agent: e,
|
|
1992
|
+
invocationId: t,
|
|
1855
1993
|
open: n,
|
|
1856
|
-
onClose:
|
|
1994
|
+
onClose: s,
|
|
1857
1995
|
jwt: r,
|
|
1858
1996
|
headers: o,
|
|
1859
1997
|
agentUrl: i,
|
|
1860
|
-
agentChecklistUrl:
|
|
1998
|
+
agentChecklistUrl: u,
|
|
1861
1999
|
agentResourcesUrl: c,
|
|
1862
|
-
agentTimelineUrl:
|
|
1863
|
-
agentChatUrl:
|
|
1864
|
-
agentConversationUrl:
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
2000
|
+
agentTimelineUrl: g,
|
|
2001
|
+
agentChatUrl: _,
|
|
2002
|
+
agentConversationUrl: N,
|
|
2003
|
+
stopAgentUrl: y,
|
|
2004
|
+
chatId: I,
|
|
2005
|
+
enableUpload: L,
|
|
2006
|
+
initialBrief: f,
|
|
2007
|
+
initialPhase: K,
|
|
2008
|
+
initialChecklist: T,
|
|
2009
|
+
usePusherToRepoll: O = !1,
|
|
2010
|
+
pusherChannelPrefix: A = jt,
|
|
2011
|
+
subscribeToPusher: m
|
|
1870
2012
|
}) => {
|
|
1871
|
-
const [
|
|
1872
|
-
|
|
2013
|
+
const [b, v] = p(I ?? t), [R, z] = p("chat"), [Ee, U] = p(!1), {
|
|
2014
|
+
connector: G,
|
|
2015
|
+
fetchAgentChecklist: q,
|
|
2016
|
+
fetchAgentResources: X,
|
|
2017
|
+
fetchAgentResourceHtml: Z,
|
|
2018
|
+
fetchAgentTimeline: D
|
|
2019
|
+
} = Ja({
|
|
2020
|
+
agent: { ...e, invocation_id: t },
|
|
1873
2021
|
jwt: r,
|
|
1874
2022
|
headers: o,
|
|
1875
|
-
chatId:
|
|
2023
|
+
chatId: b,
|
|
1876
2024
|
urls: {
|
|
1877
2025
|
agentUrl: i,
|
|
1878
|
-
agentChecklistUrl:
|
|
2026
|
+
agentChecklistUrl: u,
|
|
1879
2027
|
agentResourcesUrl: c,
|
|
1880
|
-
agentTimelineUrl:
|
|
1881
|
-
agentChatUrl:
|
|
1882
|
-
agentConversationUrl:
|
|
2028
|
+
agentTimelineUrl: g,
|
|
2029
|
+
agentChatUrl: _,
|
|
2030
|
+
agentConversationUrl: N,
|
|
2031
|
+
stopAgentUrl: y
|
|
1883
2032
|
}
|
|
1884
|
-
}),
|
|
1885
|
-
|
|
1886
|
-
), [
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
}, [
|
|
1890
|
-
|
|
1891
|
-
}, [
|
|
1892
|
-
|
|
1893
|
-
}, [
|
|
1894
|
-
|
|
2033
|
+
}), x = le(G), [ae, Te] = p(
|
|
2034
|
+
K ?? (f ? B.running : ja(e.status))
|
|
2035
|
+
), [ze, j] = p([]), [Ge, ye] = p(0), [Re, ke] = p(), [at, ce] = p(null), [st, Ie] = p([]), [pe, Oe] = p(!1), [Fe, Ne] = p(null), [Be, qe] = p(null), [Je, Le] = p(null), [Ke, Ue] = p(!1), [rt, Pe] = p(null), [de, xe] = p(null), [h, S] = p(!1), [k, V] = p(null), [se, re] = p(T ?? null), [me, De] = p(!1), [nn, it] = p(null), [We, ot] = p(!1), [je, an] = p(!1), [Ve, sn] = p(!1), vt = le(We), wt = le(0), yt = le(0);
|
|
2036
|
+
H(() => {
|
|
2037
|
+
x.current = G;
|
|
2038
|
+
}, [G]), Se(() => {
|
|
2039
|
+
n && en(".agent-workspace");
|
|
2040
|
+
}, [n]), H(() => {
|
|
2041
|
+
vt.current = We;
|
|
2042
|
+
}, [We]), H(() => {
|
|
2043
|
+
v(I ?? t), z("chat"), U(!1), j([]), ye((d) => d + 1);
|
|
2044
|
+
}, [t, I]), H(() => {
|
|
2045
|
+
if (!n || f)
|
|
1895
2046
|
return;
|
|
1896
|
-
const
|
|
1897
|
-
if (!
|
|
1898
|
-
|
|
2047
|
+
const d = x.current.bootstrapConversation;
|
|
2048
|
+
if (!d) {
|
|
2049
|
+
Dt(x.current.openingMessage(), j);
|
|
1899
2050
|
return;
|
|
1900
2051
|
}
|
|
1901
|
-
let
|
|
1902
|
-
return
|
|
2052
|
+
let w = !1;
|
|
2053
|
+
return ot(!0), (async () => {
|
|
1903
2054
|
try {
|
|
1904
|
-
const
|
|
1905
|
-
if (
|
|
2055
|
+
const M = await d.call(x.current);
|
|
2056
|
+
if (w)
|
|
1906
2057
|
return;
|
|
1907
|
-
|
|
2058
|
+
j(M.map(Ae));
|
|
1908
2059
|
} catch {
|
|
1909
|
-
|
|
2060
|
+
w || Dt(x.current.openingMessage(), j);
|
|
1910
2061
|
} finally {
|
|
1911
|
-
|
|
2062
|
+
w || ot(!1);
|
|
1912
2063
|
}
|
|
1913
2064
|
})(), () => {
|
|
1914
|
-
|
|
2065
|
+
w = !0;
|
|
1915
2066
|
};
|
|
1916
|
-
}, [n,
|
|
1917
|
-
const
|
|
1918
|
-
const
|
|
2067
|
+
}, [n, f, t, b]);
|
|
2068
|
+
const ie = C(() => {
|
|
2069
|
+
const d = ++wt.current;
|
|
1919
2070
|
(async () => {
|
|
1920
|
-
var
|
|
2071
|
+
var w, M;
|
|
1921
2072
|
try {
|
|
1922
|
-
const Q = await
|
|
1923
|
-
if (
|
|
2073
|
+
const Q = await q(t);
|
|
2074
|
+
if (d !== wt.current)
|
|
1924
2075
|
return;
|
|
1925
|
-
|
|
1926
|
-
(
|
|
1927
|
-
),
|
|
2076
|
+
re(
|
|
2077
|
+
(ge) => JSON.stringify(ge) === JSON.stringify(Q.checklist) ? ge : Q.checklist
|
|
2078
|
+
), it(null), (M = (w = x.current).seedChecklist) == null || M.call(w, Q.checklist);
|
|
1928
2079
|
} catch {
|
|
1929
2080
|
}
|
|
1930
2081
|
})();
|
|
1931
|
-
}, [
|
|
2082
|
+
}, [q, t]), _e = C(() => {
|
|
1932
2083
|
c && (async () => {
|
|
1933
2084
|
try {
|
|
1934
|
-
const
|
|
1935
|
-
|
|
2085
|
+
const d = await X(t);
|
|
2086
|
+
Ie(d), Ne(null);
|
|
1936
2087
|
} catch {
|
|
1937
2088
|
}
|
|
1938
2089
|
})();
|
|
1939
|
-
}, [c,
|
|
1940
|
-
if (!
|
|
2090
|
+
}, [c, X, t]), oe = C(() => {
|
|
2091
|
+
if (!g)
|
|
1941
2092
|
return;
|
|
1942
|
-
const
|
|
2093
|
+
const d = ++yt.current;
|
|
1943
2094
|
(async () => {
|
|
1944
2095
|
try {
|
|
1945
|
-
const
|
|
1946
|
-
if (
|
|
2096
|
+
const w = await D(t);
|
|
2097
|
+
if (d !== yt.current)
|
|
1947
2098
|
return;
|
|
1948
|
-
|
|
1949
|
-
(
|
|
2099
|
+
xe(
|
|
2100
|
+
(M) => JSON.stringify(M) === JSON.stringify(w) ? M : w
|
|
1950
2101
|
), V(null);
|
|
1951
2102
|
} catch {
|
|
1952
2103
|
}
|
|
1953
2104
|
})();
|
|
1954
|
-
}, [
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
const g = window.setInterval(() => {
|
|
1959
|
-
const y = I.current.bootstrapConversation;
|
|
1960
|
-
y && (async () => {
|
|
2105
|
+
}, [g, D, t]), Me = C(
|
|
2106
|
+
(d) => {
|
|
2107
|
+
const w = x.current.bootstrapConversation;
|
|
2108
|
+
w && (async () => {
|
|
1961
2109
|
try {
|
|
1962
|
-
const
|
|
1963
|
-
if (
|
|
2110
|
+
const M = await w.call(x.current);
|
|
2111
|
+
if (vt.current)
|
|
1964
2112
|
return;
|
|
1965
|
-
const Q =
|
|
1966
|
-
let
|
|
1967
|
-
|
|
2113
|
+
const Q = M.map(Ae);
|
|
2114
|
+
let ge = !1;
|
|
2115
|
+
j((Nt) => Va(Nt, Q) ? Nt : (ge = !0, Q)), ge && (d != null && d.refreshSidePanelsOnChange) && (ie(), oe());
|
|
1968
2116
|
} catch {
|
|
1969
2117
|
}
|
|
1970
2118
|
})();
|
|
1971
|
-
},
|
|
2119
|
+
},
|
|
2120
|
+
[ie, oe]
|
|
2121
|
+
), rn = C(
|
|
2122
|
+
(d) => {
|
|
2123
|
+
switch (d) {
|
|
2124
|
+
case ve.checklist:
|
|
2125
|
+
ie();
|
|
2126
|
+
return;
|
|
2127
|
+
case ve.resources:
|
|
2128
|
+
_e();
|
|
2129
|
+
return;
|
|
2130
|
+
case ve.chat:
|
|
2131
|
+
Me();
|
|
2132
|
+
return;
|
|
2133
|
+
case ve.timeline:
|
|
2134
|
+
oe();
|
|
2135
|
+
return;
|
|
2136
|
+
case ve.all:
|
|
2137
|
+
default:
|
|
2138
|
+
ie(), _e(), Me(), oe();
|
|
2139
|
+
}
|
|
2140
|
+
},
|
|
2141
|
+
[ie, Me, _e, oe]
|
|
2142
|
+
);
|
|
2143
|
+
pa({
|
|
2144
|
+
enabled: n && O,
|
|
2145
|
+
channelPrefix: A,
|
|
2146
|
+
agentId: e.id,
|
|
2147
|
+
subscribeToPusher: m,
|
|
2148
|
+
onRepoll: rn
|
|
2149
|
+
}), H(() => {
|
|
2150
|
+
if (!n || f || O)
|
|
2151
|
+
return;
|
|
2152
|
+
const d = window.setInterval(() => {
|
|
2153
|
+
Me({ refreshSidePanelsOnChange: !0 });
|
|
2154
|
+
}, Ka);
|
|
1972
2155
|
return () => {
|
|
1973
|
-
window.clearInterval(
|
|
2156
|
+
window.clearInterval(d);
|
|
1974
2157
|
};
|
|
1975
|
-
}, [
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
2158
|
+
}, [
|
|
2159
|
+
n,
|
|
2160
|
+
f,
|
|
2161
|
+
O,
|
|
2162
|
+
t,
|
|
2163
|
+
b,
|
|
2164
|
+
Me
|
|
2165
|
+
]);
|
|
2166
|
+
const on = C(
|
|
2167
|
+
(d) => {
|
|
2168
|
+
var w, M;
|
|
2169
|
+
d.checklist ? (re(d.checklist), (M = (w = x.current).seedChecklist) == null || M.call(w, d.checklist)) : ie(), d.phase && Te(d.phase), _e(), oe();
|
|
1980
2170
|
},
|
|
1981
|
-
[
|
|
2171
|
+
[ie, _e, oe]
|
|
1982
2172
|
);
|
|
1983
|
-
|
|
1984
|
-
var
|
|
1985
|
-
!n ||
|
|
1986
|
-
}, [n,
|
|
1987
|
-
if (!n ||
|
|
2173
|
+
H(() => {
|
|
2174
|
+
var d, w;
|
|
2175
|
+
!n || f || T && T.length > 0 && ((w = (d = x.current).seedChecklist) == null || w.call(d, T));
|
|
2176
|
+
}, [n, f, T]), H(() => {
|
|
2177
|
+
if (!n || f)
|
|
1988
2178
|
return;
|
|
1989
|
-
let
|
|
1990
|
-
return
|
|
1991
|
-
var
|
|
2179
|
+
let d = !1;
|
|
2180
|
+
return De((w) => T != null && T.length ? !1 : w || se === null || se.length === 0), it(null), (async () => {
|
|
2181
|
+
var w, M;
|
|
1992
2182
|
try {
|
|
1993
|
-
const Q = await
|
|
1994
|
-
if (
|
|
2183
|
+
const Q = await q(t);
|
|
2184
|
+
if (d)
|
|
1995
2185
|
return;
|
|
1996
|
-
|
|
2186
|
+
T != null && T.length || (re(Q.checklist), (M = (w = x.current).seedChecklist) == null || M.call(w, Q.checklist));
|
|
1997
2187
|
} catch {
|
|
1998
|
-
!
|
|
2188
|
+
!d && !(T != null && T.length) && it(Qe);
|
|
1999
2189
|
} finally {
|
|
2000
|
-
|
|
2190
|
+
d || De(!1);
|
|
2001
2191
|
}
|
|
2002
2192
|
})(), () => {
|
|
2003
|
-
|
|
2193
|
+
d = !0;
|
|
2004
2194
|
};
|
|
2005
|
-
}, [n,
|
|
2195
|
+
}, [n, t, f, T, q]), H(() => {
|
|
2006
2196
|
if (!n || !c)
|
|
2007
2197
|
return;
|
|
2008
|
-
let
|
|
2009
|
-
return
|
|
2198
|
+
let d = !1;
|
|
2199
|
+
return Oe(!0), Ne(null), (async () => {
|
|
2010
2200
|
try {
|
|
2011
|
-
const
|
|
2012
|
-
|
|
2201
|
+
const w = await X(t);
|
|
2202
|
+
d || Ie(w);
|
|
2013
2203
|
} catch {
|
|
2014
|
-
|
|
2204
|
+
d || Ne(Tn);
|
|
2015
2205
|
} finally {
|
|
2016
|
-
|
|
2206
|
+
d || Oe(!1);
|
|
2017
2207
|
}
|
|
2018
2208
|
})(), () => {
|
|
2019
|
-
|
|
2209
|
+
d = !0;
|
|
2020
2210
|
};
|
|
2021
|
-
}, [n,
|
|
2022
|
-
const
|
|
2023
|
-
|
|
2024
|
-
}, []),
|
|
2025
|
-
(
|
|
2026
|
-
if (
|
|
2027
|
-
window.open(
|
|
2211
|
+
}, [n, t, c, X]);
|
|
2212
|
+
const ln = C(() => {
|
|
2213
|
+
qe(null), Le(null), Pe(null), Ue(!1);
|
|
2214
|
+
}, []), cn = C(
|
|
2215
|
+
(d) => {
|
|
2216
|
+
if (d.misRecordUrl) {
|
|
2217
|
+
window.open(d.misRecordUrl, "_blank", "noopener,noreferrer");
|
|
2028
2218
|
return;
|
|
2029
2219
|
}
|
|
2030
|
-
|
|
2220
|
+
qe(d), Le(null), Pe(null), Ue(!0), (async () => {
|
|
2031
2221
|
try {
|
|
2032
|
-
const
|
|
2033
|
-
|
|
2222
|
+
const w = await Z(t, d.id);
|
|
2223
|
+
Le(w);
|
|
2034
2224
|
} catch {
|
|
2035
|
-
|
|
2225
|
+
Pe(Rn);
|
|
2036
2226
|
} finally {
|
|
2037
|
-
|
|
2227
|
+
Ue(!1);
|
|
2038
2228
|
}
|
|
2039
2229
|
})();
|
|
2040
2230
|
},
|
|
2041
|
-
[
|
|
2231
|
+
[Z, t]
|
|
2042
2232
|
);
|
|
2043
|
-
|
|
2044
|
-
if (!n || !
|
|
2233
|
+
H(() => {
|
|
2234
|
+
if (!n || !g)
|
|
2045
2235
|
return;
|
|
2046
|
-
let
|
|
2047
|
-
return
|
|
2236
|
+
let d = !1;
|
|
2237
|
+
return S((w) => w || de === null), V(null), (async () => {
|
|
2048
2238
|
try {
|
|
2049
|
-
const
|
|
2050
|
-
|
|
2239
|
+
const w = await D(t);
|
|
2240
|
+
d || xe(w);
|
|
2051
2241
|
} catch {
|
|
2052
|
-
|
|
2242
|
+
d || V(Bt);
|
|
2053
2243
|
} finally {
|
|
2054
|
-
|
|
2244
|
+
d || S(!1);
|
|
2055
2245
|
}
|
|
2056
2246
|
})(), () => {
|
|
2057
|
-
|
|
2247
|
+
d = !0;
|
|
2058
2248
|
};
|
|
2059
|
-
}, [n,
|
|
2060
|
-
if (!n || !
|
|
2249
|
+
}, [n, t, g, D]), H(() => {
|
|
2250
|
+
if (!n || !f)
|
|
2061
2251
|
return;
|
|
2062
|
-
let
|
|
2063
|
-
const
|
|
2252
|
+
let d = !1;
|
|
2253
|
+
const w = {
|
|
2064
2254
|
id: `user-brief-${Date.now()}`,
|
|
2065
|
-
author:
|
|
2066
|
-
text:
|
|
2255
|
+
author: ne.user,
|
|
2256
|
+
text: Wa(f, e.invocation_name)
|
|
2067
2257
|
};
|
|
2068
2258
|
return (async () => {
|
|
2069
|
-
var Q,
|
|
2070
|
-
const
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
]),
|
|
2259
|
+
var Q, ge;
|
|
2260
|
+
const M = await x.current.start(f);
|
|
2261
|
+
d || (j([
|
|
2262
|
+
Ae(x.current.openingMessage()),
|
|
2263
|
+
Ae(w),
|
|
2264
|
+
Ae(M.message)
|
|
2265
|
+
]), M.checklist ? (re(M.checklist), (ge = (Q = x.current).seedChecklist) == null || ge.call(Q, M.checklist)) : ie(), Te(M.phase ?? B.running), _e(), oe());
|
|
2076
2266
|
})(), () => {
|
|
2077
|
-
|
|
2267
|
+
d = !0;
|
|
2078
2268
|
};
|
|
2079
2269
|
}, [
|
|
2080
2270
|
n,
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2271
|
+
f,
|
|
2272
|
+
e.invocation_name,
|
|
2273
|
+
t,
|
|
2274
|
+
ie,
|
|
2275
|
+
_e,
|
|
2276
|
+
oe
|
|
2087
2277
|
]);
|
|
2088
|
-
const
|
|
2089
|
-
|
|
2090
|
-
}, []),
|
|
2091
|
-
(
|
|
2092
|
-
).sessionId : void 0,
|
|
2093
|
-
|
|
2094
|
-
}, [
|
|
2095
|
-
(
|
|
2096
|
-
if (
|
|
2097
|
-
|
|
2278
|
+
const dn = C((d) => {
|
|
2279
|
+
ce(la(d));
|
|
2280
|
+
}, []), lt = I ?? t, Ye = de == null ? void 0 : de.chatSessions, kt = Ye != null && Ye.length ? Ye.reduce(
|
|
2281
|
+
(d, w) => Date.parse(w.timestamp) < Date.parse(d.timestamp) ? w : d
|
|
2282
|
+
).sessionId : void 0, ct = C(() => {
|
|
2283
|
+
z("chat"), U(!1), b !== lt && (v(lt), j([]), ye((d) => d + 1));
|
|
2284
|
+
}, [b, lt]), gn = C(
|
|
2285
|
+
(d) => {
|
|
2286
|
+
if (d === kt) {
|
|
2287
|
+
ct();
|
|
2098
2288
|
return;
|
|
2099
2289
|
}
|
|
2100
|
-
|
|
2290
|
+
v(d), U(!0), z("chat"), j([]), ye((w) => w + 1);
|
|
2101
2291
|
},
|
|
2102
|
-
[
|
|
2103
|
-
),
|
|
2104
|
-
|
|
2105
|
-
}, []),
|
|
2106
|
-
await
|
|
2107
|
-
}, []),
|
|
2108
|
-
return /* @__PURE__ */ l(
|
|
2109
|
-
/* @__PURE__ */ l(
|
|
2292
|
+
[kt, ct]
|
|
2293
|
+
), hn = C((d) => {
|
|
2294
|
+
ce(null), ke(d), ye((w) => w + 1);
|
|
2295
|
+
}, []), un = C(async () => {
|
|
2296
|
+
await x.current.stop(), Te(B.stopped);
|
|
2297
|
+
}, []), pn = se;
|
|
2298
|
+
return /* @__PURE__ */ l(ue, { open: n, closeHandler: s, hideCloseButton: !0, className: "agent-workspace", children: [
|
|
2299
|
+
/* @__PURE__ */ l(ue.Header, { className: "agent-workspace__header", children: [
|
|
2110
2300
|
/* @__PURE__ */ l("div", { className: "agent-workspace__header-title", children: [
|
|
2111
|
-
/* @__PURE__ */
|
|
2112
|
-
/* @__PURE__ */
|
|
2113
|
-
/* @__PURE__ */
|
|
2301
|
+
/* @__PURE__ */ a("span", { className: "agent-workspace__header-avatar", "aria-hidden": "true", children: /* @__PURE__ */ a(P, { name: "ask-arbor", size: 24 }) }),
|
|
2302
|
+
/* @__PURE__ */ a(ue.Title, { children: e.invocation_name }),
|
|
2303
|
+
/* @__PURE__ */ a(
|
|
2114
2304
|
"span",
|
|
2115
2305
|
{
|
|
2116
|
-
className:
|
|
2117
|
-
children:
|
|
2306
|
+
className: W("agent-workspace__phase", `agent-workspace__phase--${ae}`),
|
|
2307
|
+
children: Ln[ae]
|
|
2118
2308
|
}
|
|
2119
2309
|
)
|
|
2120
2310
|
] }),
|
|
2121
2311
|
/* @__PURE__ */ l("div", { className: "agent-workspace__header-actions", children: [
|
|
2122
|
-
/* @__PURE__ */
|
|
2123
|
-
|
|
2312
|
+
/* @__PURE__ */ a(
|
|
2313
|
+
te,
|
|
2124
2314
|
{
|
|
2125
|
-
variant:
|
|
2315
|
+
variant: je ? "secondary" : "primary",
|
|
2126
2316
|
size: "S",
|
|
2127
2317
|
iconLeftName: "clipboard-list",
|
|
2128
2318
|
iconLeftScreenReaderText: "Toggle checklist",
|
|
2129
|
-
"aria-pressed": !
|
|
2130
|
-
onClick: () =>
|
|
2319
|
+
"aria-pressed": !je,
|
|
2320
|
+
onClick: () => an((d) => !d),
|
|
2131
2321
|
children: "Checklist"
|
|
2132
2322
|
}
|
|
2133
2323
|
),
|
|
2134
|
-
/* @__PURE__ */
|
|
2135
|
-
|
|
2324
|
+
/* @__PURE__ */ a(
|
|
2325
|
+
te,
|
|
2136
2326
|
{
|
|
2137
|
-
variant:
|
|
2327
|
+
variant: Ve ? "secondary" : "primary",
|
|
2138
2328
|
size: "S",
|
|
2139
2329
|
iconLeftName: "files",
|
|
2140
2330
|
iconLeftScreenReaderText: "Toggle resources",
|
|
2141
|
-
"aria-pressed": !
|
|
2142
|
-
onClick: () =>
|
|
2331
|
+
"aria-pressed": !Ve,
|
|
2332
|
+
onClick: () => sn((d) => !d),
|
|
2143
2333
|
children: "Resources"
|
|
2144
2334
|
}
|
|
2145
2335
|
),
|
|
2146
|
-
/* @__PURE__ */
|
|
2147
|
-
|
|
2336
|
+
/* @__PURE__ */ a(
|
|
2337
|
+
te,
|
|
2148
2338
|
{
|
|
2149
2339
|
variant: "secondary",
|
|
2150
2340
|
size: "S",
|
|
2151
2341
|
iconLeftName: "x",
|
|
2152
2342
|
iconLeftScreenReaderText: "Close",
|
|
2153
|
-
onClick:
|
|
2343
|
+
onClick: s,
|
|
2154
2344
|
children: "Close"
|
|
2155
2345
|
}
|
|
2156
2346
|
)
|
|
2157
2347
|
] })
|
|
2158
2348
|
] }),
|
|
2159
2349
|
/* @__PURE__ */ l(
|
|
2160
|
-
|
|
2350
|
+
ue.Body,
|
|
2161
2351
|
{
|
|
2162
|
-
className:
|
|
2163
|
-
"agent-workspace__body--no-checklist":
|
|
2164
|
-
"agent-workspace__body--no-resources":
|
|
2352
|
+
className: W("agent-workspace__body", {
|
|
2353
|
+
"agent-workspace__body--no-checklist": je,
|
|
2354
|
+
"agent-workspace__body--no-resources": Ve
|
|
2165
2355
|
}),
|
|
2166
2356
|
children: [
|
|
2167
|
-
"
|
|
2357
|
+
" ",
|
|
2168
2358
|
/* @__PURE__ */ l(
|
|
2169
2359
|
"section",
|
|
2170
2360
|
{
|
|
2171
|
-
className:
|
|
2172
|
-
"agent-workspace__panel--timeline": !!
|
|
2361
|
+
className: W("agent-workspace__panel", "agent-workspace__panel--chat", {
|
|
2362
|
+
"agent-workspace__panel--timeline": !!g && R === "timeline"
|
|
2173
2363
|
}),
|
|
2174
2364
|
"aria-label": "Agent",
|
|
2175
2365
|
children: [
|
|
2176
2366
|
/* @__PURE__ */ l("div", { className: "agent-workspace__panel-header", children: [
|
|
2177
|
-
/* @__PURE__ */
|
|
2178
|
-
|
|
2179
|
-
|
|
2367
|
+
/* @__PURE__ */ a(Ce, { level: 4, children: "Agent" }),
|
|
2368
|
+
y && ae === B.running && /* @__PURE__ */ a(
|
|
2369
|
+
te,
|
|
2180
2370
|
{
|
|
2181
2371
|
className: "agent-workspace__panel-header-action",
|
|
2182
2372
|
variant: "secondary-destructive",
|
|
2183
2373
|
size: "S",
|
|
2184
2374
|
iconLeftName: "circle-x",
|
|
2185
2375
|
iconLeftScreenReaderText: "Stop",
|
|
2186
|
-
onClick: () => void
|
|
2376
|
+
onClick: () => void un(),
|
|
2187
2377
|
children: "Stop agent"
|
|
2188
2378
|
}
|
|
2189
2379
|
)
|
|
2190
2380
|
] }),
|
|
2191
|
-
|
|
2192
|
-
/* @__PURE__ */
|
|
2193
|
-
|
|
2381
|
+
g && /* @__PURE__ */ l(dt, { className: "agent-workspace__center-tabs", "aria-label": "Center panel", children: [
|
|
2382
|
+
/* @__PURE__ */ a(
|
|
2383
|
+
dt.Item,
|
|
2194
2384
|
{
|
|
2195
|
-
active:
|
|
2385
|
+
active: R === "chat",
|
|
2196
2386
|
tabElementProps: {
|
|
2197
2387
|
id: "agent-center-tab-chat",
|
|
2198
|
-
onClick: () =>
|
|
2388
|
+
onClick: () => z("chat")
|
|
2199
2389
|
},
|
|
2200
2390
|
children: "Chat"
|
|
2201
2391
|
}
|
|
2202
2392
|
),
|
|
2203
|
-
/* @__PURE__ */
|
|
2204
|
-
|
|
2393
|
+
/* @__PURE__ */ a(
|
|
2394
|
+
dt.Item,
|
|
2205
2395
|
{
|
|
2206
|
-
active:
|
|
2396
|
+
active: R === "timeline",
|
|
2207
2397
|
tabElementProps: {
|
|
2208
2398
|
id: "agent-center-tab-timeline",
|
|
2209
|
-
onClick: () =>
|
|
2399
|
+
onClick: () => z("timeline")
|
|
2210
2400
|
},
|
|
2211
2401
|
children: "Timeline"
|
|
2212
2402
|
}
|
|
2213
2403
|
)
|
|
2214
2404
|
] }),
|
|
2215
|
-
|
|
2216
|
-
|
|
2405
|
+
g && R === "chat" && Ee && /* @__PURE__ */ a("div", { className: "agent-workspace__center-back", children: /* @__PURE__ */ a(
|
|
2406
|
+
te,
|
|
2217
2407
|
{
|
|
2218
2408
|
variant: "tertiary",
|
|
2219
2409
|
size: "S",
|
|
2220
2410
|
iconLeftName: "arrow-left",
|
|
2221
2411
|
iconLeftScreenReaderText: "Back to main chat",
|
|
2222
|
-
onClick:
|
|
2412
|
+
onClick: ct,
|
|
2223
2413
|
children: "Back to main chat"
|
|
2224
2414
|
}
|
|
2225
2415
|
) }),
|
|
2226
|
-
|
|
2227
|
-
|
|
2416
|
+
g && R === "timeline" && /* @__PURE__ */ a(
|
|
2417
|
+
ia,
|
|
2228
2418
|
{
|
|
2229
|
-
timeline:
|
|
2230
|
-
isLoading:
|
|
2231
|
-
error:
|
|
2232
|
-
onOpenChatSession:
|
|
2419
|
+
timeline: de,
|
|
2420
|
+
isLoading: h,
|
|
2421
|
+
error: k,
|
|
2422
|
+
onOpenChatSession: gn
|
|
2233
2423
|
}
|
|
2234
2424
|
),
|
|
2235
|
-
/* @__PURE__ */
|
|
2425
|
+
/* @__PURE__ */ a(
|
|
2236
2426
|
"div",
|
|
2237
2427
|
{
|
|
2238
2428
|
className: "agent-workspace__chat-keep-alive",
|
|
2239
|
-
hidden: !!
|
|
2240
|
-
children: /* @__PURE__ */
|
|
2241
|
-
|
|
2429
|
+
hidden: !!g && R !== "chat",
|
|
2430
|
+
children: /* @__PURE__ */ a(
|
|
2431
|
+
Wn,
|
|
2242
2432
|
{
|
|
2243
|
-
connector:
|
|
2244
|
-
phase:
|
|
2245
|
-
chatHistory:
|
|
2246
|
-
chatSessionKey:
|
|
2247
|
-
startQuery:
|
|
2248
|
-
clarificationMessage:
|
|
2249
|
-
enableUpload:
|
|
2250
|
-
onTurn:
|
|
2251
|
-
onAwaitingChange:
|
|
2252
|
-
onClarificationPrompt:
|
|
2253
|
-
onDismissClarification: () =>
|
|
2433
|
+
connector: G,
|
|
2434
|
+
phase: ae,
|
|
2435
|
+
chatHistory: ze,
|
|
2436
|
+
chatSessionKey: Ge,
|
|
2437
|
+
startQuery: Re,
|
|
2438
|
+
clarificationMessage: at,
|
|
2439
|
+
enableUpload: L,
|
|
2440
|
+
onTurn: on,
|
|
2441
|
+
onAwaitingChange: ot,
|
|
2442
|
+
onClarificationPrompt: hn,
|
|
2443
|
+
onDismissClarification: () => ce(null)
|
|
2254
2444
|
}
|
|
2255
2445
|
)
|
|
2256
2446
|
}
|
|
@@ -2258,282 +2448,284 @@ const Bt = (t, e) => (n) => {
|
|
|
2258
2448
|
]
|
|
2259
2449
|
}
|
|
2260
2450
|
),
|
|
2261
|
-
!
|
|
2262
|
-
|
|
2451
|
+
!je && /* @__PURE__ */ a(
|
|
2452
|
+
jn,
|
|
2263
2453
|
{
|
|
2264
|
-
checklist:
|
|
2265
|
-
isLoading:
|
|
2266
|
-
error:
|
|
2267
|
-
phase:
|
|
2268
|
-
canRequestInput:
|
|
2269
|
-
onAttentionItemClick:
|
|
2454
|
+
checklist: pn,
|
|
2455
|
+
isLoading: me,
|
|
2456
|
+
error: nn,
|
|
2457
|
+
phase: ae,
|
|
2458
|
+
canRequestInput: ae === B.running && !We,
|
|
2459
|
+
onAttentionItemClick: dn
|
|
2270
2460
|
}
|
|
2271
2461
|
),
|
|
2272
|
-
!
|
|
2273
|
-
|
|
2462
|
+
!Ve && /* @__PURE__ */ a(
|
|
2463
|
+
Xn,
|
|
2274
2464
|
{
|
|
2275
|
-
resources:
|
|
2276
|
-
isLoading:
|
|
2277
|
-
error:
|
|
2278
|
-
onOpenResource:
|
|
2465
|
+
resources: st,
|
|
2466
|
+
isLoading: pe,
|
|
2467
|
+
error: Fe,
|
|
2468
|
+
onOpenResource: cn
|
|
2279
2469
|
}
|
|
2280
2470
|
),
|
|
2281
|
-
/* @__PURE__ */
|
|
2282
|
-
|
|
2471
|
+
/* @__PURE__ */ a(
|
|
2472
|
+
Vn,
|
|
2283
2473
|
{
|
|
2284
|
-
resource:
|
|
2285
|
-
html:
|
|
2286
|
-
isLoading:
|
|
2287
|
-
error:
|
|
2288
|
-
onClose:
|
|
2474
|
+
resource: Be,
|
|
2475
|
+
html: Je,
|
|
2476
|
+
isLoading: Ke,
|
|
2477
|
+
error: rt,
|
|
2478
|
+
onClose: ln
|
|
2289
2479
|
}
|
|
2290
2480
|
)
|
|
2291
2481
|
]
|
|
2292
2482
|
}
|
|
2293
2483
|
)
|
|
2294
2484
|
] });
|
|
2295
|
-
},
|
|
2296
|
-
open:
|
|
2297
|
-
onClose:
|
|
2485
|
+
}, Xa = "Unable to load agent definitions. Please try again.", Za = "Unable to start the agent.", Mt = "Loading agents…", tn = ({
|
|
2486
|
+
open: e,
|
|
2487
|
+
onClose: t,
|
|
2298
2488
|
onStart: n,
|
|
2299
|
-
agentDefinitions:
|
|
2489
|
+
agentDefinitions: s,
|
|
2300
2490
|
definitionsState: r = "idle",
|
|
2301
2491
|
definitionsError: o = null,
|
|
2302
2492
|
onRetryDefinitions: i,
|
|
2303
|
-
embedded:
|
|
2493
|
+
embedded: u = !1
|
|
2304
2494
|
}) => {
|
|
2305
|
-
const [c,
|
|
2306
|
-
value:
|
|
2307
|
-
label:
|
|
2495
|
+
const [c, g] = p(void 0), [_, N] = p(""), [y, I] = p(!1), [L, f] = p(null), K = [...s].sort((v, R) => v.display_name.localeCompare(R.display_name)).map((v) => ({
|
|
2496
|
+
value: v.ref,
|
|
2497
|
+
label: v.display_name
|
|
2308
2498
|
}));
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
}, [
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2499
|
+
H(() => {
|
|
2500
|
+
e && (g(void 0), N(""), I(!1), f(null));
|
|
2501
|
+
}, [e]), Se(() => {
|
|
2502
|
+
!e || u || en(".new-agent");
|
|
2503
|
+
}, [e, u]);
|
|
2504
|
+
const T = c !== void 0 && _.trim().length > 0, O = C(
|
|
2505
|
+
(v) => {
|
|
2506
|
+
const R = s.find((z) => z.ref === v[0]);
|
|
2507
|
+
R && g(R);
|
|
2316
2508
|
},
|
|
2317
|
-
[
|
|
2318
|
-
),
|
|
2319
|
-
if (!(!c || !
|
|
2320
|
-
|
|
2509
|
+
[s]
|
|
2510
|
+
), A = C(async () => {
|
|
2511
|
+
if (!(!c || !T || y)) {
|
|
2512
|
+
I(!0), f(null);
|
|
2321
2513
|
try {
|
|
2322
|
-
await n({ definition: c, invocationName:
|
|
2323
|
-
} catch (
|
|
2324
|
-
|
|
2514
|
+
await n({ definition: c, invocationName: _.trim() });
|
|
2515
|
+
} catch (v) {
|
|
2516
|
+
f(v instanceof Error ? v.message : Za);
|
|
2325
2517
|
} finally {
|
|
2326
|
-
|
|
2518
|
+
I(!1);
|
|
2327
2519
|
}
|
|
2328
2520
|
}
|
|
2329
|
-
}, [
|
|
2330
|
-
if (r === "idle" &&
|
|
2521
|
+
}, [T, c, _, y, n]);
|
|
2522
|
+
if (r === "idle" && s.length === 0 || !e)
|
|
2331
2523
|
return null;
|
|
2332
2524
|
const m = /* @__PURE__ */ l("div", { className: "new-agent__header-title", children: [
|
|
2333
|
-
/* @__PURE__ */
|
|
2334
|
-
|
|
2525
|
+
/* @__PURE__ */ a("span", { className: "new-agent__header-avatar", "aria-hidden": "true", children: /* @__PURE__ */ a(P, { name: "ask-arbor", size: 24 }) }),
|
|
2526
|
+
u ? /* @__PURE__ */ a("h2", { className: "new-agent__title", children: "Start an agent" }) : /* @__PURE__ */ a(ue.Title, { children: "Start an agent" })
|
|
2335
2527
|
] });
|
|
2336
|
-
let
|
|
2337
|
-
return r === "loading" ?
|
|
2338
|
-
/* @__PURE__ */
|
|
2528
|
+
let b;
|
|
2529
|
+
return r === "loading" ? b = /* @__PURE__ */ l("div", { className: "new-agent__state", "aria-live": "polite", children: [
|
|
2530
|
+
/* @__PURE__ */ a(
|
|
2339
2531
|
P,
|
|
2340
2532
|
{
|
|
2341
2533
|
name: "loader",
|
|
2342
2534
|
size: 24,
|
|
2343
2535
|
color: "var(--color-brand-600)",
|
|
2344
2536
|
className: "new-agent__spinner",
|
|
2345
|
-
screenReaderText:
|
|
2537
|
+
screenReaderText: Mt
|
|
2346
2538
|
}
|
|
2347
2539
|
),
|
|
2348
|
-
/* @__PURE__ */
|
|
2349
|
-
] }) : r === "error" ?
|
|
2350
|
-
/* @__PURE__ */
|
|
2351
|
-
/* @__PURE__ */
|
|
2352
|
-
i ? /* @__PURE__ */
|
|
2353
|
-
] }) :
|
|
2540
|
+
/* @__PURE__ */ a("p", { className: "new-agent__state-message", children: Mt })
|
|
2541
|
+
] }) : r === "error" ? b = /* @__PURE__ */ l("div", { className: "new-agent__state new-agent__state--error", role: "alert", children: [
|
|
2542
|
+
/* @__PURE__ */ a(P, { name: "triangle-alert", size: 24, color: "var(--color-semantic-destructive-600)" }),
|
|
2543
|
+
/* @__PURE__ */ a("p", { className: "new-agent__state-message", children: o ?? Xa }),
|
|
2544
|
+
i ? /* @__PURE__ */ a(te, { variant: "secondary", size: "S", onClick: i, children: "Try again" }) : null
|
|
2545
|
+
] }) : b = /* @__PURE__ */ l(
|
|
2354
2546
|
"form",
|
|
2355
2547
|
{
|
|
2356
2548
|
className: "new-agent__form",
|
|
2357
2549
|
"aria-label": "Start an agent",
|
|
2358
|
-
onSubmit: (
|
|
2359
|
-
|
|
2550
|
+
onSubmit: (v) => {
|
|
2551
|
+
v.preventDefault(), T && !y && A();
|
|
2360
2552
|
},
|
|
2361
2553
|
children: [
|
|
2362
2554
|
/* @__PURE__ */ l("div", { className: "new-agent__type-field", children: [
|
|
2363
|
-
/* @__PURE__ */
|
|
2364
|
-
/* @__PURE__ */
|
|
2365
|
-
|
|
2555
|
+
/* @__PURE__ */ a("label", { className: "new-agent__type-label", htmlFor: "new-agent-type", children: "What would you like your agent to do?" }),
|
|
2556
|
+
/* @__PURE__ */ a(
|
|
2557
|
+
_n,
|
|
2366
2558
|
{
|
|
2367
2559
|
id: "new-agent-type",
|
|
2368
2560
|
placeholder: "Which agent would you like to start?",
|
|
2369
|
-
options:
|
|
2561
|
+
options: K,
|
|
2370
2562
|
selectedValues: c ? [c.ref] : [],
|
|
2371
|
-
onSelectionChange:
|
|
2563
|
+
onSelectionChange: O
|
|
2372
2564
|
}
|
|
2373
2565
|
)
|
|
2374
2566
|
] }),
|
|
2375
2567
|
/* @__PURE__ */ l("div", { className: "new-agent__type-field", children: [
|
|
2376
|
-
/* @__PURE__ */
|
|
2377
|
-
/* @__PURE__ */
|
|
2378
|
-
|
|
2568
|
+
/* @__PURE__ */ a("label", { className: "new-agent__type-label", htmlFor: "new-agent-invocation-name", children: "Name" }),
|
|
2569
|
+
/* @__PURE__ */ a(
|
|
2570
|
+
fn,
|
|
2379
2571
|
{
|
|
2380
2572
|
id: "new-agent-invocation-name",
|
|
2381
|
-
value:
|
|
2573
|
+
value: _,
|
|
2382
2574
|
placeholder: "What would you like to call your agent?",
|
|
2383
|
-
onChange: (
|
|
2575
|
+
onChange: (v) => N(v.target.value)
|
|
2384
2576
|
}
|
|
2385
2577
|
)
|
|
2386
2578
|
] }),
|
|
2387
|
-
|
|
2388
|
-
/* @__PURE__ */
|
|
2389
|
-
|
|
2579
|
+
L ? /* @__PURE__ */ a("p", { className: "new-agent__error", role: "alert", children: L }) : null,
|
|
2580
|
+
/* @__PURE__ */ a("div", { className: "new-agent__actions", children: /* @__PURE__ */ a(
|
|
2581
|
+
te,
|
|
2390
2582
|
{
|
|
2391
2583
|
type: "submit",
|
|
2392
2584
|
variant: "primary",
|
|
2393
|
-
className:
|
|
2394
|
-
"new-agent__start-button--starting":
|
|
2585
|
+
className: W("new-agent__start-button", {
|
|
2586
|
+
"new-agent__start-button--starting": y
|
|
2395
2587
|
}),
|
|
2396
|
-
disabled: !
|
|
2397
|
-
iconLeftName:
|
|
2398
|
-
iconLeftScreenReaderText:
|
|
2399
|
-
children:
|
|
2588
|
+
disabled: !T || y,
|
|
2589
|
+
iconLeftName: y ? "loader" : "sparkles",
|
|
2590
|
+
iconLeftScreenReaderText: y ? "Starting" : void 0,
|
|
2591
|
+
children: y ? "Starting…" : "Start"
|
|
2400
2592
|
}
|
|
2401
2593
|
) })
|
|
2402
2594
|
]
|
|
2403
2595
|
}
|
|
2404
|
-
),
|
|
2405
|
-
/* @__PURE__ */
|
|
2406
|
-
/* @__PURE__ */
|
|
2407
|
-
] }) : /* @__PURE__ */ l(
|
|
2408
|
-
/* @__PURE__ */
|
|
2409
|
-
/* @__PURE__ */
|
|
2596
|
+
), u ? /* @__PURE__ */ l("div", { className: W("new-agent", "new-agent--embedded"), children: [
|
|
2597
|
+
/* @__PURE__ */ a("div", { className: "new-agent__header", children: m }),
|
|
2598
|
+
/* @__PURE__ */ a("div", { className: "new-agent__body", children: b })
|
|
2599
|
+
] }) : /* @__PURE__ */ l(ue, { open: e, closeHandler: t, className: "new-agent", children: [
|
|
2600
|
+
/* @__PURE__ */ a(ue.Header, { className: "new-agent__header", children: m }),
|
|
2601
|
+
/* @__PURE__ */ a(ue.Body, { className: "new-agent__body", children: b })
|
|
2410
2602
|
] });
|
|
2411
|
-
},
|
|
2412
|
-
window.location.assign(
|
|
2413
|
-
},
|
|
2414
|
-
open:
|
|
2415
|
-
authToken:
|
|
2603
|
+
}, $t = (e) => {
|
|
2604
|
+
window.location.assign(e);
|
|
2605
|
+
}, Qa = ({
|
|
2606
|
+
open: e,
|
|
2607
|
+
authToken: t,
|
|
2416
2608
|
headers: n,
|
|
2417
|
-
agentDefinitionsUrl:
|
|
2609
|
+
agentDefinitionsUrl: s,
|
|
2418
2610
|
agentsUrl: r,
|
|
2419
2611
|
closeUrl: o,
|
|
2420
2612
|
successUrl: i,
|
|
2421
|
-
onClose:
|
|
2613
|
+
onClose: u,
|
|
2422
2614
|
onStart: c,
|
|
2423
|
-
embedded:
|
|
2615
|
+
embedded: g = !1
|
|
2424
2616
|
}) => {
|
|
2425
|
-
const
|
|
2426
|
-
() => new
|
|
2427
|
-
token:
|
|
2617
|
+
const _ = JSON.stringify(n ?? {}), N = Y(
|
|
2618
|
+
() => new ft({
|
|
2619
|
+
token: t,
|
|
2428
2620
|
headers: n,
|
|
2429
2621
|
urls: {
|
|
2430
|
-
agentDefinitions:
|
|
2622
|
+
agentDefinitions: s,
|
|
2431
2623
|
agents: r
|
|
2432
2624
|
}
|
|
2433
2625
|
}),
|
|
2434
2626
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- keyed on serialised config to keep a stable client.
|
|
2435
|
-
[
|
|
2436
|
-
), [
|
|
2437
|
-
|
|
2438
|
-
if (!
|
|
2627
|
+
[t, s, r, _]
|
|
2628
|
+
), [y, I] = p([]), [L, f] = p("loading"), [K, T] = p(null), [O, A] = p(0);
|
|
2629
|
+
H(() => {
|
|
2630
|
+
if (!e)
|
|
2439
2631
|
return;
|
|
2440
|
-
let
|
|
2441
|
-
return
|
|
2632
|
+
let R = !1;
|
|
2633
|
+
return f("loading"), T(null), (async () => {
|
|
2442
2634
|
try {
|
|
2443
|
-
const
|
|
2444
|
-
if (
|
|
2635
|
+
const z = await N.listAgentDefinitions();
|
|
2636
|
+
if (R)
|
|
2445
2637
|
return;
|
|
2446
|
-
|
|
2447
|
-
} catch (
|
|
2448
|
-
if (
|
|
2638
|
+
I(z.map(Vt)), f("idle");
|
|
2639
|
+
} catch (z) {
|
|
2640
|
+
if (R)
|
|
2449
2641
|
return;
|
|
2450
|
-
|
|
2642
|
+
I([]), T(Qt(z)), f("error");
|
|
2451
2643
|
}
|
|
2452
2644
|
})(), () => {
|
|
2453
|
-
|
|
2645
|
+
R = !0;
|
|
2454
2646
|
};
|
|
2455
|
-
}, [
|
|
2456
|
-
const m =
|
|
2457
|
-
|
|
2458
|
-
}, [o,
|
|
2459
|
-
async (
|
|
2460
|
-
await
|
|
2461
|
-
invocationName:
|
|
2462
|
-
}), c == null || c(
|
|
2647
|
+
}, [N, e, O]);
|
|
2648
|
+
const m = C(() => {
|
|
2649
|
+
u == null || u(), o && $t(o);
|
|
2650
|
+
}, [o, u]), b = C(
|
|
2651
|
+
async (R) => {
|
|
2652
|
+
await N.createAgent(R.definition.ref, {
|
|
2653
|
+
invocationName: R.invocationName
|
|
2654
|
+
}), c == null || c(R), i && $t(i);
|
|
2463
2655
|
},
|
|
2464
|
-
[
|
|
2465
|
-
),
|
|
2466
|
-
|
|
2656
|
+
[N, c, i]
|
|
2657
|
+
), v = C(() => {
|
|
2658
|
+
A((R) => R + 1);
|
|
2467
2659
|
}, []);
|
|
2468
|
-
return /* @__PURE__ */
|
|
2469
|
-
|
|
2660
|
+
return /* @__PURE__ */ a(
|
|
2661
|
+
tn,
|
|
2470
2662
|
{
|
|
2471
|
-
open:
|
|
2663
|
+
open: e,
|
|
2472
2664
|
onClose: m,
|
|
2473
|
-
onStart:
|
|
2474
|
-
agentDefinitions:
|
|
2475
|
-
definitionsState:
|
|
2476
|
-
definitionsError:
|
|
2477
|
-
onRetryDefinitions:
|
|
2478
|
-
embedded:
|
|
2665
|
+
onStart: b,
|
|
2666
|
+
agentDefinitions: y,
|
|
2667
|
+
definitionsState: L,
|
|
2668
|
+
definitionsError: K,
|
|
2669
|
+
onRetryDefinitions: v,
|
|
2670
|
+
embedded: g
|
|
2479
2671
|
}
|
|
2480
2672
|
);
|
|
2481
|
-
},
|
|
2673
|
+
}, es = (e) => "agentDefinitionsUrl" in e, ts = (e) => es(e) ? /* @__PURE__ */ a(Qa, { ...e }) : /* @__PURE__ */ a(tn, { ...e }), ns = (e) => e !== void 0 && e.some((t) => t.status === $.hitl), as = (e, t) => ns(t) ? E.hitl : e.status, ss = ({ column: e, label: t }) => e.statusIcon ? /* @__PURE__ */ a("span", { className: "agent-view__status-indicator", children: /* @__PURE__ */ a(
|
|
2482
2674
|
P,
|
|
2483
2675
|
{
|
|
2484
|
-
name:
|
|
2676
|
+
name: e.statusIcon.name,
|
|
2485
2677
|
size: 16,
|
|
2486
|
-
color:
|
|
2487
|
-
className:
|
|
2488
|
-
"agent-view__progress-icon--spinning":
|
|
2678
|
+
color: e.statusIcon.color,
|
|
2679
|
+
className: W({
|
|
2680
|
+
"agent-view__progress-icon--spinning": e.statusIcon.spin
|
|
2489
2681
|
}),
|
|
2490
|
-
screenReaderText:
|
|
2682
|
+
screenReaderText: t
|
|
2491
2683
|
}
|
|
2492
|
-
) }) : /* @__PURE__ */
|
|
2684
|
+
) }) : /* @__PURE__ */ a(
|
|
2493
2685
|
"span",
|
|
2494
2686
|
{
|
|
2495
|
-
className:
|
|
2496
|
-
[`agent-view__dot--${
|
|
2687
|
+
className: W("agent-view__dot", {
|
|
2688
|
+
[`agent-view__dot--${e.dotModifier}`]: e.dotModifier
|
|
2497
2689
|
}),
|
|
2498
|
-
children: /* @__PURE__ */
|
|
2690
|
+
children: /* @__PURE__ */ a(zt, { colour: e.dotColour, label: t })
|
|
2499
2691
|
}
|
|
2500
|
-
),
|
|
2501
|
-
agent:
|
|
2502
|
-
agentName:
|
|
2692
|
+
), rs = ({
|
|
2693
|
+
agent: e,
|
|
2694
|
+
agentName: t,
|
|
2503
2695
|
column: n,
|
|
2504
|
-
isExpanded:
|
|
2696
|
+
isExpanded: s,
|
|
2505
2697
|
isLoading: r,
|
|
2506
2698
|
checklist: o,
|
|
2507
2699
|
error: i,
|
|
2508
|
-
onToggle:
|
|
2700
|
+
onToggle: u,
|
|
2509
2701
|
onViewAgent: c
|
|
2510
2702
|
}) => {
|
|
2511
|
-
const { id:
|
|
2512
|
-
return /* @__PURE__ */
|
|
2703
|
+
const { id: g, invocation_name: _ } = e, N = `agent-card-${g}-header`, y = `agent-card-${g}-progress`;
|
|
2704
|
+
return /* @__PURE__ */ a(
|
|
2513
2705
|
"li",
|
|
2514
2706
|
{
|
|
2515
|
-
className:
|
|
2516
|
-
"agent-view__card--expanded":
|
|
2707
|
+
className: W("agent-view__card", {
|
|
2708
|
+
"agent-view__card--expanded": s
|
|
2517
2709
|
}),
|
|
2518
|
-
children: /* @__PURE__ */ l(
|
|
2519
|
-
/* @__PURE__ */
|
|
2710
|
+
children: /* @__PURE__ */ l(vn, { spacing: "dense", children: [
|
|
2711
|
+
/* @__PURE__ */ a(
|
|
2520
2712
|
"button",
|
|
2521
2713
|
{
|
|
2522
2714
|
type: "button",
|
|
2523
2715
|
className: "agent-view__card-toggle",
|
|
2524
|
-
"aria-expanded":
|
|
2525
|
-
"aria-controls":
|
|
2526
|
-
"aria-label":
|
|
2527
|
-
id:
|
|
2528
|
-
onClick: () =>
|
|
2716
|
+
"aria-expanded": s,
|
|
2717
|
+
"aria-controls": y,
|
|
2718
|
+
"aria-label": _,
|
|
2719
|
+
id: N,
|
|
2720
|
+
onClick: () => u(g),
|
|
2529
2721
|
children: /* @__PURE__ */ l("div", { className: "agent-view__card-content", children: [
|
|
2530
|
-
/* @__PURE__ */
|
|
2531
|
-
/* @__PURE__ */
|
|
2532
|
-
/* @__PURE__ */
|
|
2533
|
-
/* @__PURE__ */
|
|
2722
|
+
/* @__PURE__ */ a(ss, { column: n }),
|
|
2723
|
+
/* @__PURE__ */ a("span", { className: "agent-view__card-invocation-name", children: _ }),
|
|
2724
|
+
/* @__PURE__ */ a("span", { className: "agent-view__card-agent-name", children: t }),
|
|
2725
|
+
/* @__PURE__ */ a(
|
|
2534
2726
|
P,
|
|
2535
2727
|
{
|
|
2536
|
-
name:
|
|
2728
|
+
name: s ? "chevron-up" : "chevron-down",
|
|
2537
2729
|
size: 16,
|
|
2538
2730
|
className: "agent-view__card-chevron"
|
|
2539
2731
|
}
|
|
@@ -2541,290 +2733,278 @@ const Bt = (t, e) => (n) => {
|
|
|
2541
2733
|
] })
|
|
2542
2734
|
}
|
|
2543
2735
|
),
|
|
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
|
-
)
|
|
2736
|
+
s && /* @__PURE__ */ l("div", { id: y, "aria-labelledby": N, className: "agent-view__card-progress", children: [
|
|
2737
|
+
r && /* @__PURE__ */ l("div", { className: "agent-view__progress-loading", "aria-live": "polite", children: [
|
|
2738
|
+
/* @__PURE__ */ a(
|
|
2739
|
+
P,
|
|
2740
|
+
{
|
|
2741
|
+
name: "loader",
|
|
2742
|
+
size: 16,
|
|
2743
|
+
color: "var(--color-brand-600)",
|
|
2744
|
+
className: "agent-view__progress-icon--spinning",
|
|
2745
|
+
screenReaderText: be
|
|
2746
|
+
}
|
|
2747
|
+
),
|
|
2748
|
+
/* @__PURE__ */ a("span", { children: be })
|
|
2749
|
+
] }),
|
|
2750
|
+
!r && i && /* @__PURE__ */ a("p", { className: "agent-view__progress-error", role: "alert", children: i }),
|
|
2751
|
+
!r && !i && o !== null && /* @__PURE__ */ a(qn, { checklist: o }),
|
|
2752
|
+
!r && !i && o === null && /* @__PURE__ */ l("div", { className: "agent-view__progress-loading", "aria-live": "polite", children: [
|
|
2753
|
+
/* @__PURE__ */ a(
|
|
2754
|
+
P,
|
|
2755
|
+
{
|
|
2756
|
+
name: "loader",
|
|
2757
|
+
size: 16,
|
|
2758
|
+
color: "var(--color-brand-600)",
|
|
2759
|
+
className: "agent-view__progress-icon--spinning",
|
|
2760
|
+
screenReaderText: be
|
|
2761
|
+
}
|
|
2762
|
+
),
|
|
2763
|
+
/* @__PURE__ */ a("span", { children: be })
|
|
2764
|
+
] }),
|
|
2765
|
+
/* @__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" }) })
|
|
2766
|
+
] })
|
|
2591
2767
|
] })
|
|
2592
2768
|
}
|
|
2593
2769
|
);
|
|
2594
|
-
},
|
|
2595
|
-
column:
|
|
2596
|
-
agents:
|
|
2770
|
+
}, Ht = ({
|
|
2771
|
+
column: e,
|
|
2772
|
+
agents: t,
|
|
2597
2773
|
expandedAgentId: n,
|
|
2598
|
-
loadingAgentId:
|
|
2774
|
+
loadingAgentId: s,
|
|
2599
2775
|
checklistByInvocationId: r,
|
|
2600
2776
|
errorByAgentId: o,
|
|
2601
2777
|
definitionNameByRef: i,
|
|
2602
|
-
onToggleAgent:
|
|
2778
|
+
onToggleAgent: u,
|
|
2603
2779
|
onViewAgent: c,
|
|
2604
|
-
isSplit:
|
|
2780
|
+
isSplit: g = !1
|
|
2605
2781
|
}) => /* @__PURE__ */ l(
|
|
2606
2782
|
"section",
|
|
2607
2783
|
{
|
|
2608
|
-
className:
|
|
2609
|
-
"agent-view__column--split":
|
|
2784
|
+
className: W("agent-view__column", {
|
|
2785
|
+
"agent-view__column--split": g
|
|
2610
2786
|
}),
|
|
2611
|
-
"aria-label":
|
|
2787
|
+
"aria-label": e.title,
|
|
2612
2788
|
children: [
|
|
2613
2789
|
/* @__PURE__ */ l("div", { className: "agent-view__column-header", children: [
|
|
2614
|
-
/* @__PURE__ */
|
|
2615
|
-
/* @__PURE__ */
|
|
2790
|
+
/* @__PURE__ */ a(Ce, { level: 4, children: e.title }),
|
|
2791
|
+
/* @__PURE__ */ a("span", { className: "agent-view__column-count", children: t.length })
|
|
2616
2792
|
] }),
|
|
2617
|
-
/* @__PURE__ */
|
|
2618
|
-
|
|
2793
|
+
/* @__PURE__ */ a("ul", { className: "agent-view__card-list", children: t.map((_) => /* @__PURE__ */ a(
|
|
2794
|
+
rs,
|
|
2619
2795
|
{
|
|
2620
|
-
agent:
|
|
2621
|
-
agentName:
|
|
2622
|
-
column:
|
|
2623
|
-
isExpanded: n ===
|
|
2624
|
-
isLoading:
|
|
2625
|
-
checklist: r[
|
|
2626
|
-
error: o[
|
|
2627
|
-
onToggle:
|
|
2796
|
+
agent: _,
|
|
2797
|
+
agentName: _t(_, i),
|
|
2798
|
+
column: e,
|
|
2799
|
+
isExpanded: n === _.id,
|
|
2800
|
+
isLoading: s === _.id,
|
|
2801
|
+
checklist: r[_.invocation_id] ?? null,
|
|
2802
|
+
error: o[_.id] ?? null,
|
|
2803
|
+
onToggle: u,
|
|
2628
2804
|
onViewAgent: c
|
|
2629
2805
|
},
|
|
2630
|
-
|
|
2806
|
+
_.id
|
|
2631
2807
|
)) })
|
|
2632
2808
|
]
|
|
2633
2809
|
}
|
|
2634
|
-
),
|
|
2635
|
-
jwt:
|
|
2636
|
-
headers:
|
|
2810
|
+
), _t = (e, t) => t.get(e.agent_definition_ref) ?? e.agent_definition_ref.replace(/_/g, " "), hs = ({
|
|
2811
|
+
jwt: e,
|
|
2812
|
+
headers: t,
|
|
2637
2813
|
agentDefinitionsUrl: n,
|
|
2638
|
-
agentsUrl:
|
|
2814
|
+
agentsUrl: s,
|
|
2639
2815
|
agentUrl: r,
|
|
2640
2816
|
agentChecklistUrl: o,
|
|
2641
2817
|
agentResourcesUrl: i,
|
|
2642
|
-
agentTimelineUrl:
|
|
2818
|
+
agentTimelineUrl: u,
|
|
2643
2819
|
agentChatUrl: c,
|
|
2644
|
-
agentConversationUrl:
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2820
|
+
agentConversationUrl: g,
|
|
2821
|
+
stopAgentUrl: _,
|
|
2822
|
+
enableUpload: N,
|
|
2823
|
+
showHeader: y = !1,
|
|
2824
|
+
institutions: I,
|
|
2825
|
+
usePusherToRepoll: L = !1,
|
|
2826
|
+
pusherChannelPrefix: f = jt,
|
|
2827
|
+
subscribeToPusher: K
|
|
2648
2828
|
}) => {
|
|
2649
|
-
var
|
|
2650
|
-
const
|
|
2829
|
+
var xe;
|
|
2830
|
+
const T = Y(
|
|
2651
2831
|
() => ({
|
|
2652
2832
|
agentDefinitions: n,
|
|
2653
|
-
agents:
|
|
2833
|
+
agents: s,
|
|
2654
2834
|
agent: r,
|
|
2655
2835
|
agentChecklist: o,
|
|
2656
2836
|
...i ? { agentResources: i } : {},
|
|
2657
|
-
...
|
|
2837
|
+
...u ? { agentTimeline: u } : {},
|
|
2658
2838
|
agentChat: c,
|
|
2659
|
-
agentConversation:
|
|
2839
|
+
agentConversation: g
|
|
2660
2840
|
}),
|
|
2661
2841
|
[
|
|
2662
2842
|
n,
|
|
2663
|
-
|
|
2843
|
+
s,
|
|
2664
2844
|
r,
|
|
2665
2845
|
o,
|
|
2666
2846
|
i,
|
|
2667
|
-
|
|
2847
|
+
u,
|
|
2668
2848
|
c,
|
|
2669
|
-
|
|
2849
|
+
g
|
|
2670
2850
|
]
|
|
2671
|
-
), [
|
|
2672
|
-
(
|
|
2673
|
-
)) == null ? void 0 :
|
|
2674
|
-
const
|
|
2675
|
-
return
|
|
2676
|
-
}, [
|
|
2677
|
-
agents:
|
|
2678
|
-
agentDefinitions:
|
|
2679
|
-
loadState:
|
|
2680
|
-
loadError:
|
|
2681
|
-
reload:
|
|
2682
|
-
refresh:
|
|
2683
|
-
fetchAgentChecklist:
|
|
2684
|
-
createAgent:
|
|
2685
|
-
} =
|
|
2686
|
-
const
|
|
2687
|
-
(
|
|
2851
|
+
), [O, A] = p(null), m = O ? (xe = I == null ? void 0 : I.find(
|
|
2852
|
+
(h) => h.applicationId === O.application_id
|
|
2853
|
+
)) == null ? void 0 : xe.applicationUrl : void 0, b = Y(() => {
|
|
2854
|
+
const h = { ...t ?? {} };
|
|
2855
|
+
return m ? h[we.arborApplicationUrl] = m : delete h[we.arborApplicationUrl], h;
|
|
2856
|
+
}, [t, m]), {
|
|
2857
|
+
agents: v,
|
|
2858
|
+
agentDefinitions: R,
|
|
2859
|
+
loadState: z,
|
|
2860
|
+
loadError: Ee,
|
|
2861
|
+
reload: U,
|
|
2862
|
+
refresh: G,
|
|
2863
|
+
fetchAgentChecklist: q,
|
|
2864
|
+
createAgent: X
|
|
2865
|
+
} = Ba({ jwt: e, headers: b, urls: T }), [Z, D] = p(!1), [x, ae] = p(null), [Te, ze] = p(null), [j, Ge] = p({}), [ye, Re] = p({}), [ke, at] = p([]), [ce, st] = p([]), Ie = Y(() => {
|
|
2866
|
+
const h = new Set(v.map((k) => k.application_id)), S = new Map(
|
|
2867
|
+
(I ?? []).map((k) => [k.applicationId, k.name])
|
|
2688
2868
|
);
|
|
2689
|
-
return [...
|
|
2690
|
-
(
|
|
2691
|
-
).map((
|
|
2692
|
-
value:
|
|
2693
|
-
label:
|
|
2869
|
+
return [...h].sort(
|
|
2870
|
+
(k, V) => (S.get(k) ?? k).localeCompare(S.get(V) ?? V)
|
|
2871
|
+
).map((k) => ({
|
|
2872
|
+
value: k,
|
|
2873
|
+
label: S.get(k) ?? k
|
|
2694
2874
|
}));
|
|
2695
|
-
}, [
|
|
2696
|
-
() => new Map(
|
|
2697
|
-
[
|
|
2698
|
-
),
|
|
2699
|
-
|
|
2700
|
-
)].sort((
|
|
2701
|
-
value:
|
|
2702
|
-
label:
|
|
2703
|
-
})), [
|
|
2704
|
-
|
|
2705
|
-
const
|
|
2706
|
-
|
|
2875
|
+
}, [v, I]), pe = Y(
|
|
2876
|
+
() => new Map(R.map((h) => [h.ref, h.display_name])),
|
|
2877
|
+
[R]
|
|
2878
|
+
), Oe = Y(() => [...new Set(
|
|
2879
|
+
v.map((S) => _t(S, pe))
|
|
2880
|
+
)].sort((S, k) => S.localeCompare(k)).map((S) => ({
|
|
2881
|
+
value: S,
|
|
2882
|
+
label: S
|
|
2883
|
+
})), [v, pe]), Fe = Y(() => v.filter((h) => !(ke.length > 0 && !ke.includes(h.application_id) || ce.length > 0 && !ce.includes(_t(h, pe)))), [v, pe, ce, ke]), Ne = Ie.length > 1, Be = Oe.length > 1, qe = Ne || Be;
|
|
2884
|
+
H(() => {
|
|
2885
|
+
const h = window.setInterval(() => {
|
|
2886
|
+
G();
|
|
2707
2887
|
}, 6e4);
|
|
2708
2888
|
return () => {
|
|
2709
|
-
window.clearInterval(
|
|
2889
|
+
window.clearInterval(h);
|
|
2710
2890
|
};
|
|
2711
|
-
}, [
|
|
2712
|
-
if (
|
|
2891
|
+
}, [G]), H(() => {
|
|
2892
|
+
if (v.length === 0)
|
|
2713
2893
|
return;
|
|
2714
|
-
let
|
|
2894
|
+
let h = !1;
|
|
2715
2895
|
return (async () => {
|
|
2716
|
-
const
|
|
2717
|
-
|
|
2718
|
-
const V = await
|
|
2896
|
+
const S = await Promise.allSettled(
|
|
2897
|
+
v.map(async (k) => {
|
|
2898
|
+
const V = await q(k.invocation_id);
|
|
2719
2899
|
return {
|
|
2720
|
-
agentId:
|
|
2721
|
-
invocationId:
|
|
2900
|
+
agentId: k.id,
|
|
2901
|
+
invocationId: k.invocation_id,
|
|
2722
2902
|
checklist: V.checklist
|
|
2723
2903
|
};
|
|
2724
2904
|
})
|
|
2725
2905
|
);
|
|
2726
|
-
|
|
2727
|
-
const V = { ...
|
|
2728
|
-
let
|
|
2729
|
-
for (const
|
|
2730
|
-
if (
|
|
2906
|
+
h || (Ge((k) => {
|
|
2907
|
+
const V = { ...k };
|
|
2908
|
+
let se = !1;
|
|
2909
|
+
for (const re of S) {
|
|
2910
|
+
if (re.status !== "fulfilled")
|
|
2731
2911
|
continue;
|
|
2732
|
-
const { invocationId:
|
|
2733
|
-
JSON.stringify(
|
|
2912
|
+
const { invocationId: me, checklist: De } = re.value;
|
|
2913
|
+
JSON.stringify(k[me]) !== JSON.stringify(De) && (V[me] = De, se = !0);
|
|
2734
2914
|
}
|
|
2735
|
-
return
|
|
2736
|
-
}),
|
|
2737
|
-
const V = { ...
|
|
2738
|
-
let
|
|
2739
|
-
return
|
|
2740
|
-
|
|
2741
|
-
}),
|
|
2915
|
+
return se ? V : k;
|
|
2916
|
+
}), Re((k) => {
|
|
2917
|
+
const V = { ...k };
|
|
2918
|
+
let se = !1;
|
|
2919
|
+
return S.forEach((re, me) => {
|
|
2920
|
+
re.status === "rejected" && V[v[me].id] !== Qe && (V[v[me].id] = Qe, se = !0);
|
|
2921
|
+
}), se ? V : k;
|
|
2742
2922
|
}));
|
|
2743
2923
|
})(), () => {
|
|
2744
|
-
|
|
2924
|
+
h = !0;
|
|
2745
2925
|
};
|
|
2746
|
-
}, [
|
|
2747
|
-
const
|
|
2748
|
-
async (
|
|
2749
|
-
if (!
|
|
2750
|
-
|
|
2751
|
-
const
|
|
2752
|
-
return delete
|
|
2926
|
+
}, [v, q]);
|
|
2927
|
+
const Je = C(
|
|
2928
|
+
async (h) => {
|
|
2929
|
+
if (!j[h.invocation_id]) {
|
|
2930
|
+
ze(h.id), Re((S) => {
|
|
2931
|
+
const k = { ...S };
|
|
2932
|
+
return delete k[h.id], k;
|
|
2753
2933
|
});
|
|
2754
2934
|
try {
|
|
2755
|
-
const
|
|
2756
|
-
|
|
2757
|
-
...
|
|
2758
|
-
[
|
|
2935
|
+
const S = await q(h.invocation_id);
|
|
2936
|
+
Ge((k) => ({
|
|
2937
|
+
...k,
|
|
2938
|
+
[h.invocation_id]: S.checklist
|
|
2759
2939
|
}));
|
|
2760
2940
|
} catch {
|
|
2761
|
-
|
|
2762
|
-
...
|
|
2763
|
-
[
|
|
2941
|
+
Re((S) => ({
|
|
2942
|
+
...S,
|
|
2943
|
+
[h.id]: Qe
|
|
2764
2944
|
}));
|
|
2765
2945
|
} finally {
|
|
2766
|
-
|
|
2946
|
+
ze((S) => S === h.id ? null : S);
|
|
2767
2947
|
}
|
|
2768
2948
|
}
|
|
2769
2949
|
},
|
|
2770
|
-
[
|
|
2771
|
-
),
|
|
2772
|
-
(
|
|
2773
|
-
if (
|
|
2774
|
-
|
|
2950
|
+
[q, j]
|
|
2951
|
+
), Le = C(
|
|
2952
|
+
(h) => {
|
|
2953
|
+
if (x === h) {
|
|
2954
|
+
ae(null);
|
|
2775
2955
|
return;
|
|
2776
2956
|
}
|
|
2777
|
-
const
|
|
2778
|
-
|
|
2957
|
+
const S = v.find(({ id: k }) => k === h);
|
|
2958
|
+
S && (ae(h), Je(S));
|
|
2779
2959
|
},
|
|
2780
|
-
[
|
|
2781
|
-
),
|
|
2782
|
-
const
|
|
2783
|
-
for (const
|
|
2784
|
-
const
|
|
2785
|
-
|
|
2786
|
-
|
|
2960
|
+
[v, x, Je]
|
|
2961
|
+
), Ke = Y(() => {
|
|
2962
|
+
const h = {};
|
|
2963
|
+
for (const S of Fe) {
|
|
2964
|
+
const k = as(
|
|
2965
|
+
S,
|
|
2966
|
+
j[S.invocation_id]
|
|
2787
2967
|
);
|
|
2788
|
-
(
|
|
2968
|
+
(h[k] ?? (h[k] = [])).push(S);
|
|
2789
2969
|
}
|
|
2790
|
-
return
|
|
2791
|
-
}, [
|
|
2792
|
-
|
|
2793
|
-
}, []),
|
|
2794
|
-
async (
|
|
2795
|
-
const
|
|
2796
|
-
|
|
2970
|
+
return h;
|
|
2971
|
+
}, [Fe, j]), Ue = C((h) => {
|
|
2972
|
+
A(h);
|
|
2973
|
+
}, []), rt = C(
|
|
2974
|
+
async (h) => {
|
|
2975
|
+
const S = await X(h);
|
|
2976
|
+
A(S), D(!1);
|
|
2797
2977
|
},
|
|
2798
|
-
[
|
|
2799
|
-
),
|
|
2800
|
-
|
|
2801
|
-
}, []),
|
|
2802
|
-
expandedAgentId:
|
|
2803
|
-
loadingAgentId:
|
|
2804
|
-
checklistByInvocationId:
|
|
2805
|
-
errorByAgentId:
|
|
2806
|
-
definitionNameByRef:
|
|
2807
|
-
onToggleAgent:
|
|
2808
|
-
onViewAgent:
|
|
2978
|
+
[X]
|
|
2979
|
+
), Pe = C(() => {
|
|
2980
|
+
A(null);
|
|
2981
|
+
}, []), de = {
|
|
2982
|
+
expandedAgentId: x,
|
|
2983
|
+
loadingAgentId: Te,
|
|
2984
|
+
checklistByInvocationId: j,
|
|
2985
|
+
errorByAgentId: ye,
|
|
2986
|
+
definitionNameByRef: pe,
|
|
2987
|
+
onToggleAgent: Le,
|
|
2988
|
+
onViewAgent: Ue
|
|
2809
2989
|
};
|
|
2810
2990
|
return /* @__PURE__ */ l("div", { className: "agent-view-frontend agent-view", children: [
|
|
2811
|
-
|
|
2812
|
-
/* @__PURE__ */
|
|
2813
|
-
/* @__PURE__ */
|
|
2814
|
-
|
|
2991
|
+
y && /* @__PURE__ */ l("div", { className: "agent-view__header", children: [
|
|
2992
|
+
/* @__PURE__ */ a(Ce, { level: 1, children: "Agents" }),
|
|
2993
|
+
/* @__PURE__ */ a(
|
|
2994
|
+
te,
|
|
2815
2995
|
{
|
|
2816
2996
|
variant: "primary",
|
|
2817
2997
|
size: "S",
|
|
2818
2998
|
iconLeftName: "sparkles",
|
|
2819
2999
|
iconLeftScreenReaderText: "Start an agent",
|
|
2820
|
-
onClick: () =>
|
|
3000
|
+
onClick: () => D(!0),
|
|
2821
3001
|
children: "Start an agent"
|
|
2822
3002
|
}
|
|
2823
3003
|
)
|
|
2824
3004
|
] }),
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
/* @__PURE__ */
|
|
3005
|
+
v.length > 0 && qe && /* @__PURE__ */ l("div", { className: "agent-view__filters", children: [
|
|
3006
|
+
Ne && /* @__PURE__ */ l("div", { className: "agent-view__filter", children: [
|
|
3007
|
+
/* @__PURE__ */ a(
|
|
2828
3008
|
"label",
|
|
2829
3009
|
{
|
|
2830
3010
|
className: "agent-view__filter-label",
|
|
@@ -2832,43 +3012,36 @@ const Bt = (t, e) => (n) => {
|
|
|
2832
3012
|
children: "Institution"
|
|
2833
3013
|
}
|
|
2834
3014
|
),
|
|
2835
|
-
/* @__PURE__ */
|
|
2836
|
-
|
|
3015
|
+
/* @__PURE__ */ a(
|
|
3016
|
+
At,
|
|
2837
3017
|
{
|
|
2838
3018
|
id: "agent-view-institution-filter",
|
|
2839
3019
|
triggerVariant: "button",
|
|
2840
3020
|
multiple: !0,
|
|
2841
3021
|
searchType: "substring",
|
|
2842
3022
|
placeholder: "All institutions",
|
|
2843
|
-
options:
|
|
2844
|
-
value:
|
|
2845
|
-
onValueChange:
|
|
3023
|
+
options: Ie,
|
|
3024
|
+
value: ke,
|
|
3025
|
+
onValueChange: at,
|
|
2846
3026
|
showSelectionCountBadge: !0,
|
|
2847
3027
|
showClearAll: !0,
|
|
2848
3028
|
clearAllLabel: "Clear institutions"
|
|
2849
3029
|
}
|
|
2850
3030
|
)
|
|
2851
3031
|
] }),
|
|
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,
|
|
3032
|
+
Be && /* @__PURE__ */ l("div", { className: "agent-view__filter", children: [
|
|
3033
|
+
/* @__PURE__ */ a("label", { className: "agent-view__filter-label", htmlFor: "agent-view-agent-filter", children: "Agent" }),
|
|
3034
|
+
/* @__PURE__ */ a(
|
|
3035
|
+
At,
|
|
2863
3036
|
{
|
|
2864
3037
|
id: "agent-view-agent-filter",
|
|
2865
3038
|
triggerVariant: "button",
|
|
2866
3039
|
multiple: !0,
|
|
2867
3040
|
searchType: "substring",
|
|
2868
3041
|
placeholder: "All agents",
|
|
2869
|
-
options:
|
|
2870
|
-
value:
|
|
2871
|
-
onValueChange:
|
|
3042
|
+
options: Oe,
|
|
3043
|
+
value: ce,
|
|
3044
|
+
onValueChange: st,
|
|
2872
3045
|
showSelectionCountBadge: !0,
|
|
2873
3046
|
showClearAll: !0,
|
|
2874
3047
|
clearAllLabel: "Clear agents"
|
|
@@ -2876,117 +3049,122 @@ const Bt = (t, e) => (n) => {
|
|
|
2876
3049
|
)
|
|
2877
3050
|
] })
|
|
2878
3051
|
] }),
|
|
2879
|
-
|
|
2880
|
-
/* @__PURE__ */
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
color: "var(--color-semantic-destructive-600)"
|
|
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(
|
|
3052
|
+
z === "error" ? /* @__PURE__ */ l("div", { className: "agent-view__state agent-view__state--error", role: "alert", children: [
|
|
3053
|
+
/* @__PURE__ */ a(P, { name: "triangle-alert", size: 24, color: "var(--color-semantic-destructive-600)" }),
|
|
3054
|
+
/* @__PURE__ */ a("p", { className: "agent-view__state-message", children: Ee ?? qt }),
|
|
3055
|
+
/* @__PURE__ */ a(te, { variant: "secondary", size: "S", onClick: U, children: "Try again" })
|
|
3056
|
+
] }) : z === "loading" && v.length === 0 ? /* @__PURE__ */ l("div", { className: "agent-view__state", "aria-live": "polite", children: [
|
|
3057
|
+
/* @__PURE__ */ a(
|
|
2892
3058
|
P,
|
|
2893
3059
|
{
|
|
2894
3060
|
name: "loader",
|
|
2895
3061
|
size: 24,
|
|
2896
3062
|
color: "var(--color-brand-600)",
|
|
2897
3063
|
className: "agent-view__progress-icon--spinning",
|
|
2898
|
-
screenReaderText:
|
|
3064
|
+
screenReaderText: St
|
|
2899
3065
|
}
|
|
2900
3066
|
),
|
|
2901
|
-
/* @__PURE__ */
|
|
2902
|
-
] }) :
|
|
2903
|
-
|
|
2904
|
-
|
|
3067
|
+
/* @__PURE__ */ a("p", { className: "agent-view__state-message", children: St })
|
|
3068
|
+
] }) : v.length === 0 ? /* @__PURE__ */ a(Mn, {}) : /* @__PURE__ */ l("div", { className: "agent-view__board", children: [
|
|
3069
|
+
bn.map((h) => /* @__PURE__ */ a(
|
|
3070
|
+
Ht,
|
|
2905
3071
|
{
|
|
2906
|
-
column:
|
|
2907
|
-
agents:
|
|
2908
|
-
...
|
|
3072
|
+
column: et[h],
|
|
3073
|
+
agents: Ke[h] ?? [],
|
|
3074
|
+
...de
|
|
2909
3075
|
},
|
|
2910
|
-
|
|
3076
|
+
h
|
|
2911
3077
|
)),
|
|
2912
|
-
/* @__PURE__ */
|
|
2913
|
-
|
|
3078
|
+
/* @__PURE__ */ a("div", { className: "agent-view__split-column", children: Sn.map((h) => /* @__PURE__ */ a(
|
|
3079
|
+
Ht,
|
|
2914
3080
|
{
|
|
2915
|
-
column:
|
|
2916
|
-
agents:
|
|
3081
|
+
column: et[h],
|
|
3082
|
+
agents: Ke[h] ?? [],
|
|
2917
3083
|
isSplit: !0,
|
|
2918
|
-
...
|
|
3084
|
+
...de
|
|
2919
3085
|
},
|
|
2920
|
-
|
|
3086
|
+
h
|
|
2921
3087
|
)) })
|
|
2922
3088
|
] }),
|
|
2923
|
-
|
|
2924
|
-
|
|
3089
|
+
O && /* @__PURE__ */ a(
|
|
3090
|
+
Ya,
|
|
2925
3091
|
{
|
|
2926
|
-
agent:
|
|
2927
|
-
invocationId:
|
|
3092
|
+
agent: O,
|
|
3093
|
+
invocationId: O.invocation_id,
|
|
2928
3094
|
open: !0,
|
|
2929
|
-
jwt:
|
|
2930
|
-
headers:
|
|
3095
|
+
jwt: e,
|
|
3096
|
+
headers: b,
|
|
2931
3097
|
agentUrl: r,
|
|
2932
3098
|
agentChecklistUrl: o,
|
|
2933
3099
|
agentResourcesUrl: i,
|
|
2934
|
-
agentTimelineUrl:
|
|
3100
|
+
agentTimelineUrl: u,
|
|
2935
3101
|
agentChatUrl: c,
|
|
2936
|
-
agentConversationUrl:
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
3102
|
+
agentConversationUrl: g,
|
|
3103
|
+
stopAgentUrl: _,
|
|
3104
|
+
enableUpload: N,
|
|
3105
|
+
initialChecklist: j[O.invocation_id] ?? null,
|
|
3106
|
+
usePusherToRepoll: L,
|
|
3107
|
+
pusherChannelPrefix: f,
|
|
3108
|
+
subscribeToPusher: K,
|
|
3109
|
+
onClose: Pe
|
|
2940
3110
|
},
|
|
2941
|
-
|
|
3111
|
+
O.id
|
|
2942
3112
|
),
|
|
2943
|
-
/* @__PURE__ */
|
|
2944
|
-
|
|
3113
|
+
/* @__PURE__ */ a(
|
|
3114
|
+
ts,
|
|
2945
3115
|
{
|
|
2946
|
-
open:
|
|
2947
|
-
onClose: () =>
|
|
2948
|
-
onStart:
|
|
2949
|
-
agentDefinitions:
|
|
3116
|
+
open: Z,
|
|
3117
|
+
onClose: () => D(!1),
|
|
3118
|
+
onStart: rt,
|
|
3119
|
+
agentDefinitions: R
|
|
2950
3120
|
}
|
|
2951
3121
|
)
|
|
2952
3122
|
] });
|
|
2953
|
-
},
|
|
2954
|
-
const n = Date.now(),
|
|
3123
|
+
}, us = (e, t) => {
|
|
3124
|
+
const n = Date.now(), s = t.trim() || e.agent_intent;
|
|
2955
3125
|
return {
|
|
2956
3126
|
id: `agent-${n}`,
|
|
2957
3127
|
invocation_id: `inv-${n}`,
|
|
2958
|
-
agent_definition_ref:
|
|
2959
|
-
agent_intent:
|
|
2960
|
-
invocation_name:
|
|
2961
|
-
application_id:
|
|
2962
|
-
created_by:
|
|
2963
|
-
status:
|
|
3128
|
+
agent_definition_ref: e.ref,
|
|
3129
|
+
agent_intent: e.agent_intent,
|
|
3130
|
+
invocation_name: s,
|
|
3131
|
+
application_id: Cn,
|
|
3132
|
+
created_by: En,
|
|
3133
|
+
status: E["generating-a-response"],
|
|
2964
3134
|
context_ref: null,
|
|
2965
3135
|
checklist_ref: null
|
|
2966
3136
|
};
|
|
2967
3137
|
};
|
|
2968
3138
|
export {
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
3139
|
+
hs as AgentMonitorKanban,
|
|
3140
|
+
ft as AgentServiceClient,
|
|
3141
|
+
$e as AgentServiceError,
|
|
3142
|
+
Ya as AgentView,
|
|
3143
|
+
jt as DEFAULT_PUSHER_CHANNEL_PREFIX,
|
|
3144
|
+
za as HttpChatConnector,
|
|
3145
|
+
Ot as MESSAGE_TYPE_REPOLL,
|
|
3146
|
+
ts as NewAgentModal,
|
|
3147
|
+
Lt as PUSHER_AGENT_MESSAGE_EVENT,
|
|
3148
|
+
ve as REPOLL_TARGET,
|
|
3149
|
+
us as buildAgentFromDefinition,
|
|
3150
|
+
da as buildAgentPusherChannel,
|
|
3151
|
+
Zt as createHttpChatConnectorFactory,
|
|
3152
|
+
Ra as formatUserFileChatCardText,
|
|
3153
|
+
Ut as mapApiAgent,
|
|
3154
|
+
Vt as mapApiAgentDefinition,
|
|
3155
|
+
wa as mapApiAgentStatus,
|
|
3156
|
+
Sa as mapApiAgentTimelineResponse,
|
|
3157
|
+
Xt as mapApiChecklistEndpointResponse,
|
|
3158
|
+
Yt as mapApiChecklistItem,
|
|
3159
|
+
Ea as mapApiChecklistResponse,
|
|
3160
|
+
ya as mapApiChecklistStatus,
|
|
3161
|
+
Ia as mapApiConversationMessages,
|
|
3162
|
+
nt as mapApiOpeningMessage,
|
|
3163
|
+
Aa as mapApiResource,
|
|
3164
|
+
ba as mapApiResourcesEndpointResponse,
|
|
3165
|
+
gs as mapApiTripOption,
|
|
3166
|
+
Ta as parseConversationContentCaption,
|
|
3167
|
+
ua as parseRepollMessages,
|
|
3168
|
+
Ba as useAgentService,
|
|
3169
|
+
Ja as useAgentWorkspace
|
|
2992
3170
|
};
|