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