@arbor-education/agent-view-frontend 0.5.0 → 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 +3 -0
- package/dist/index.cjs +6 -6
- package/dist/index.d.ts +9 -3
- package/dist/index.js +1589 -1453
- 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
|
-
m && /* @__PURE__ */ l(
|
|
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
|
-
ref:
|
|
450
|
-
className:
|
|
451
|
-
children:
|
|
449
|
+
ref: u,
|
|
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 Yn {
|
|
|
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
|
-
onTurn:
|
|
596
|
-
onAwaitingChange:
|
|
597
|
-
onClarificationPrompt:
|
|
595
|
+
onTurn: u,
|
|
596
|
+
onAwaitingChange: d,
|
|
597
|
+
onClarificationPrompt: h,
|
|
598
598
|
onDismissClarification: m
|
|
599
599
|
}) => {
|
|
600
|
-
const N =
|
|
601
|
-
() => new
|
|
602
|
-
canSend: () =>
|
|
603
|
-
onTurn:
|
|
604
|
-
onAwaitingChange:
|
|
600
|
+
const N = X(
|
|
601
|
+
() => new ya(t, {
|
|
602
|
+
canSend: () => e === B.running,
|
|
603
|
+
onTurn: u,
|
|
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 Xn = ({
|
|
|
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(
|
|
@@ -633,13 +633,13 @@ const Xn = ({
|
|
|
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 Xn = ({
|
|
|
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 Xn = ({
|
|
|
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 Xn = ({
|
|
|
694
694
|
{
|
|
695
695
|
type: "button",
|
|
696
696
|
className: "agent-workspace__task-button",
|
|
697
|
-
"aria-label": `Provide input for ${
|
|
698
|
-
onClick: () => s(
|
|
699
|
-
children:
|
|
697
|
+
"aria-label": `Provide input for ${t.task}`,
|
|
698
|
+
onClick: () => s(t),
|
|
699
|
+
children: u
|
|
700
700
|
}
|
|
701
|
-
) :
|
|
702
|
-
|
|
703
|
-
|
|
701
|
+
) : u,
|
|
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 Xn = ({
|
|
|
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 Xn = ({
|
|
|
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 Xn = ({
|
|
|
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 Xn = ({
|
|
|
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
|
-
const i = (
|
|
862
|
-
|
|
909
|
+
const i = (u) => {
|
|
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 Xn = ({
|
|
|
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 Xn = ({
|
|
|
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 Xn = ({
|
|
|
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
|
{
|
|
@@ -964,10 +1012,10 @@ const Xn = ({
|
|
|
964
1012
|
href: i,
|
|
965
1013
|
target: "_blank",
|
|
966
1014
|
rel: "noreferrer",
|
|
967
|
-
onClick: (
|
|
968
|
-
|
|
1015
|
+
onClick: (u) => {
|
|
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 Xn = ({
|
|
|
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,83 +1053,83 @@ const Xn = ({
|
|
|
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
1135
|
/* @__PURE__ */ a("span", { className: "agent-timeline__station-rail", children: /* @__PURE__ */ a(
|
|
@@ -1089,46 +1137,46 @@ const Xn = ({
|
|
|
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
|
-
|
|
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: m } =
|
|
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
|
{
|
|
@@ -1139,21 +1187,21 @@ const Xn = ({
|
|
|
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: [
|
|
@@ -1162,217 +1210,218 @@ const Xn = ({
|
|
|
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
|
-
return
|
|
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
|
-
|
|
1225
|
-
|
|
1226
|
-
(
|
|
1227
|
-
for (const m of
|
|
1271
|
+
const d = s(
|
|
1272
|
+
za(i, n),
|
|
1273
|
+
Ma,
|
|
1274
|
+
(h) => {
|
|
1275
|
+
for (const m of Fa(h))
|
|
1228
1276
|
o.current(m.target);
|
|
1229
1277
|
}
|
|
1230
1278
|
);
|
|
1231
1279
|
return () => {
|
|
1232
|
-
|
|
1280
|
+
d();
|
|
1233
1281
|
};
|
|
1234
|
-
}, [
|
|
1282
|
+
}, [u, i, n, s]), u;
|
|
1235
1283
|
};
|
|
1236
|
-
class
|
|
1237
|
-
constructor(
|
|
1238
|
-
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;
|
|
1239
1287
|
}
|
|
1240
1288
|
}
|
|
1241
|
-
const
|
|
1289
|
+
const Ja = "/api/v1", z = {
|
|
1242
1290
|
agentDefinitions: "/agent-definitions",
|
|
1243
1291
|
agents: "/agents",
|
|
1244
1292
|
conversations: "/conversations",
|
|
1245
1293
|
tripOptions: "/trip-options",
|
|
1246
1294
|
demoDataset: "/demo/dataset"
|
|
1247
|
-
},
|
|
1295
|
+
}, F = {
|
|
1248
1296
|
GET: "GET",
|
|
1249
|
-
POST: "POST"
|
|
1250
|
-
|
|
1297
|
+
POST: "POST",
|
|
1298
|
+
PATCH: "PATCH"
|
|
1299
|
+
}, Ka = {
|
|
1251
1300
|
error: "error"
|
|
1252
|
-
},
|
|
1301
|
+
}, Wa = {
|
|
1253
1302
|
user: "user"
|
|
1254
|
-
},
|
|
1303
|
+
}, be = {
|
|
1255
1304
|
acceptJson: "application/json",
|
|
1256
1305
|
acceptHtml: "text/html",
|
|
1257
1306
|
acceptEventStream: "text/event-stream",
|
|
1258
1307
|
contentTypeJson: "application/json",
|
|
1259
1308
|
arborApplicationUrl: "X-Arbor-Application-Url"
|
|
1260
|
-
},
|
|
1261
|
-
switch (
|
|
1262
|
-
case
|
|
1263
|
-
return
|
|
1264
|
-
case
|
|
1265
|
-
return
|
|
1266
|
-
case
|
|
1267
|
-
case
|
|
1268
|
-
case
|
|
1269
|
-
case
|
|
1270
|
-
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;
|
|
1271
1320
|
default:
|
|
1272
|
-
return
|
|
1273
|
-
}
|
|
1274
|
-
},
|
|
1275
|
-
switch (
|
|
1276
|
-
case
|
|
1277
|
-
return
|
|
1278
|
-
case
|
|
1279
|
-
case
|
|
1280
|
-
return
|
|
1281
|
-
case
|
|
1282
|
-
case
|
|
1283
|
-
case
|
|
1284
|
-
case
|
|
1285
|
-
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;
|
|
1286
1335
|
default:
|
|
1287
|
-
return
|
|
1288
|
-
}
|
|
1289
|
-
},
|
|
1290
|
-
ref:
|
|
1291
|
-
display_name:
|
|
1292
|
-
agent_intent:
|
|
1293
|
-
description:
|
|
1294
|
-
}),
|
|
1295
|
-
id:
|
|
1296
|
-
name:
|
|
1297
|
-
...
|
|
1298
|
-
}),
|
|
1299
|
-
id:
|
|
1300
|
-
type:
|
|
1301
|
-
title:
|
|
1302
|
-
createdDatetime:
|
|
1303
|
-
lastUpdatedDatetime:
|
|
1304
|
-
misRecordUrl:
|
|
1305
|
-
}),
|
|
1306
|
-
resources:
|
|
1307
|
-
pageNumber:
|
|
1308
|
-
pageSize:
|
|
1309
|
-
totalRecords:
|
|
1310
|
-
}),
|
|
1311
|
-
actionLog: (
|
|
1312
|
-
timestamp:
|
|
1313
|
-
type:
|
|
1314
|
-
entry:
|
|
1315
|
-
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
|
|
1316
1365
|
})),
|
|
1317
|
-
chatSessions: (
|
|
1318
|
-
sessionId:
|
|
1319
|
-
timestamp:
|
|
1366
|
+
chatSessions: (t.chat_sessions ?? []).map((e) => ({
|
|
1367
|
+
sessionId: e.session_id,
|
|
1368
|
+
timestamp: e.timestamp
|
|
1320
1369
|
}))
|
|
1321
|
-
}),
|
|
1370
|
+
}), Xt = (t) => {
|
|
1322
1371
|
var n;
|
|
1323
|
-
const
|
|
1372
|
+
const e = t.invocation_id ?? t.id;
|
|
1324
1373
|
return {
|
|
1325
|
-
id:
|
|
1326
|
-
invocation_id:
|
|
1327
|
-
agent_definition_ref:
|
|
1328
|
-
...
|
|
1329
|
-
invocation_name: ((n =
|
|
1330
|
-
application_id:
|
|
1331
|
-
...
|
|
1332
|
-
created_by:
|
|
1333
|
-
status:
|
|
1334
|
-
context_ref:
|
|
1335
|
-
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
|
|
1336
1385
|
};
|
|
1337
|
-
},
|
|
1338
|
-
var
|
|
1386
|
+
}, _n = (t) => {
|
|
1387
|
+
var e;
|
|
1339
1388
|
return {
|
|
1340
|
-
task:
|
|
1341
|
-
status:
|
|
1342
|
-
description:
|
|
1343
|
-
...
|
|
1344
|
-
...(
|
|
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 } : {}
|
|
1345
1394
|
};
|
|
1346
|
-
},
|
|
1395
|
+
}, ns = (t) => Array.isArray(t) ? t : t.checklist_items ?? t.checklist ?? t.items ?? [], fn = (t, e, n) => {
|
|
1347
1396
|
var o;
|
|
1348
|
-
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;
|
|
1349
1398
|
return {
|
|
1350
|
-
invocation_id:
|
|
1351
|
-
checklist:
|
|
1399
|
+
invocation_id: t,
|
|
1400
|
+
checklist: ns(e).map(_n),
|
|
1352
1401
|
...r ? { openingMessage: r } : {}
|
|
1353
1402
|
};
|
|
1354
|
-
},
|
|
1355
|
-
const n =
|
|
1403
|
+
}, as = (t, e) => {
|
|
1404
|
+
const n = ot(e);
|
|
1356
1405
|
return {
|
|
1357
|
-
invocation_id:
|
|
1358
|
-
checklist: (
|
|
1406
|
+
invocation_id: e.invocation_id ?? t,
|
|
1407
|
+
checklist: (e.checklist_items ?? []).map(_n),
|
|
1359
1408
|
...n ? { openingMessage: n } : {}
|
|
1360
1409
|
};
|
|
1361
|
-
},
|
|
1410
|
+
}, ot = (t) => {
|
|
1362
1411
|
var n, s;
|
|
1363
|
-
const
|
|
1364
|
-
if (
|
|
1412
|
+
const e = (n = t.opening_message) == null ? void 0 : n.trim();
|
|
1413
|
+
if (e)
|
|
1365
1414
|
return {
|
|
1366
|
-
id:
|
|
1367
|
-
author:
|
|
1368
|
-
text:
|
|
1369
|
-
...(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 } : {}
|
|
1370
1419
|
};
|
|
1371
|
-
},
|
|
1420
|
+
}, ss = (t) => {
|
|
1372
1421
|
try {
|
|
1373
|
-
const
|
|
1374
|
-
if (Array.isArray(
|
|
1375
|
-
const n =
|
|
1422
|
+
const e = JSON.parse(t);
|
|
1423
|
+
if (Array.isArray(e)) {
|
|
1424
|
+
const n = e.filter(
|
|
1376
1425
|
(s) => !!s && typeof s == "object" && typeof s.text == "string"
|
|
1377
1426
|
).map((s) => s.text);
|
|
1378
1427
|
if (n.length > 0)
|
|
@@ -1381,126 +1430,140 @@ const ya = "/api/v1", F = {
|
|
|
1381
1430
|
}
|
|
1382
1431
|
} catch {
|
|
1383
1432
|
}
|
|
1384
|
-
return
|
|
1385
|
-
},
|
|
1386
|
-
const
|
|
1387
|
-
return
|
|
1433
|
+
return t;
|
|
1434
|
+
}, rs = (t) => {
|
|
1435
|
+
const e = t.trim();
|
|
1436
|
+
return e.length > 0 ? `File upload
|
|
1388
1437
|
|
|
1389
|
-
${
|
|
1390
|
-
},
|
|
1391
|
-
if (
|
|
1392
|
-
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);
|
|
1393
1442
|
return {
|
|
1394
|
-
id:
|
|
1395
|
-
author:
|
|
1396
|
-
kind:
|
|
1397
|
-
text:
|
|
1443
|
+
id: e.message_id,
|
|
1444
|
+
author: oe.user,
|
|
1445
|
+
kind: Vn.user_file,
|
|
1446
|
+
text: rs(s)
|
|
1398
1447
|
};
|
|
1399
1448
|
}
|
|
1400
1449
|
return {
|
|
1401
|
-
id:
|
|
1402
|
-
author:
|
|
1403
|
-
text:
|
|
1450
|
+
id: e.message_id,
|
|
1451
|
+
author: e.role === "user" ? oe.user : oe.agent,
|
|
1452
|
+
text: e.content
|
|
1404
1453
|
};
|
|
1405
|
-
}),
|
|
1406
|
-
class
|
|
1407
|
-
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) {
|
|
1408
1457
|
var s;
|
|
1409
|
-
this.baseUrl =
|
|
1410
|
-
const n = (s =
|
|
1411
|
-
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);
|
|
1412
1461
|
}
|
|
1413
1462
|
// Replaces the extra headers merged into every subsequent request,
|
|
1414
1463
|
// without recreating the client (e.g. an application-URL header that
|
|
1415
1464
|
// changes as the user switches institutions).
|
|
1416
|
-
setHeaders(
|
|
1417
|
-
this.customHeaders =
|
|
1465
|
+
setHeaders(e) {
|
|
1466
|
+
this.customHeaders = e;
|
|
1418
1467
|
}
|
|
1419
1468
|
async listAgentDefinitions() {
|
|
1420
1469
|
return (await this.request(
|
|
1421
|
-
|
|
1422
|
-
this.resolveUrl("agentDefinitions",
|
|
1470
|
+
F.GET,
|
|
1471
|
+
this.resolveUrl("agentDefinitions", z.agentDefinitions)
|
|
1423
1472
|
)).agent_definitions ?? [];
|
|
1424
1473
|
}
|
|
1425
|
-
getAgentDefinition(
|
|
1474
|
+
getAgentDefinition(e) {
|
|
1426
1475
|
return this.request(
|
|
1427
|
-
|
|
1428
|
-
this.apiUrl(`${
|
|
1476
|
+
F.GET,
|
|
1477
|
+
this.apiUrl(`${z.agentDefinitions}/${encodeURIComponent(e)}`)
|
|
1429
1478
|
);
|
|
1430
1479
|
}
|
|
1431
1480
|
listTripOptions() {
|
|
1432
|
-
return this.request(
|
|
1481
|
+
return this.request(F.GET, this.apiUrl(z.tripOptions));
|
|
1433
1482
|
}
|
|
1434
1483
|
getDataset() {
|
|
1435
1484
|
return this.request(
|
|
1436
|
-
|
|
1437
|
-
this.apiUrl(
|
|
1485
|
+
F.GET,
|
|
1486
|
+
this.apiUrl(z.demoDataset)
|
|
1438
1487
|
);
|
|
1439
1488
|
}
|
|
1440
|
-
setDataset(
|
|
1489
|
+
setDataset(e) {
|
|
1441
1490
|
return this.request(
|
|
1442
|
-
|
|
1443
|
-
this.apiUrl(
|
|
1444
|
-
{ dataset:
|
|
1491
|
+
F.POST,
|
|
1492
|
+
this.apiUrl(z.demoDataset),
|
|
1493
|
+
{ dataset: e }
|
|
1445
1494
|
);
|
|
1446
1495
|
}
|
|
1447
|
-
listAgents(
|
|
1496
|
+
listAgents(e = {}) {
|
|
1448
1497
|
const n = new URLSearchParams();
|
|
1449
|
-
|
|
1498
|
+
e.status && n.set("status", e.status), e.agentDefinitionRef && n.set("agent_definition_ref", e.agentDefinitionRef);
|
|
1450
1499
|
const s = n.toString() ? `?${n.toString()}` : "";
|
|
1451
1500
|
return this.request(
|
|
1452
|
-
|
|
1453
|
-
`${this.resolveUrl("agents",
|
|
1501
|
+
F.GET,
|
|
1502
|
+
`${this.resolveUrl("agents", z.agents)}${s}`
|
|
1454
1503
|
);
|
|
1455
1504
|
}
|
|
1456
|
-
createAgent(
|
|
1457
|
-
var i,
|
|
1505
|
+
createAgent(e, n = {}) {
|
|
1506
|
+
var i, u;
|
|
1458
1507
|
const s = {
|
|
1459
|
-
agent_definition_ref:
|
|
1460
|
-
}, r = (i = n.invocationName) == null ? void 0 : i.trim(), o = (
|
|
1508
|
+
agent_definition_ref: e
|
|
1509
|
+
}, r = (i = n.invocationName) == null ? void 0 : i.trim(), o = (u = n.agentIntent) == null ? void 0 : u.trim();
|
|
1461
1510
|
return r && (s.invocation_name = r), o && (s.agent_intent = o), this.request(
|
|
1462
|
-
|
|
1463
|
-
this.resolveUrl("agents",
|
|
1511
|
+
F.POST,
|
|
1512
|
+
this.resolveUrl("agents", z.agents),
|
|
1464
1513
|
s
|
|
1465
1514
|
);
|
|
1466
1515
|
}
|
|
1467
|
-
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
|
+
};
|
|
1468
1526
|
return this.request(
|
|
1469
|
-
|
|
1470
|
-
this.resolveUrl(
|
|
1527
|
+
F.PATCH,
|
|
1528
|
+
this.resolveUrl(
|
|
1529
|
+
"agent",
|
|
1530
|
+
`${z.agents}/${encodeURIComponent(e)}`,
|
|
1531
|
+
e
|
|
1532
|
+
),
|
|
1533
|
+
r
|
|
1471
1534
|
);
|
|
1472
1535
|
}
|
|
1473
|
-
getAgentChecklist(
|
|
1536
|
+
getAgentChecklist(e) {
|
|
1474
1537
|
return this.request(
|
|
1475
|
-
|
|
1538
|
+
F.GET,
|
|
1476
1539
|
this.resolveUrl(
|
|
1477
1540
|
"agentChecklist",
|
|
1478
|
-
`${
|
|
1479
|
-
|
|
1541
|
+
`${z.agents}/${encodeURIComponent(e)}/checklist`,
|
|
1542
|
+
e
|
|
1480
1543
|
)
|
|
1481
1544
|
);
|
|
1482
1545
|
}
|
|
1483
|
-
getAgentResources(
|
|
1546
|
+
getAgentResources(e, n = {}) {
|
|
1484
1547
|
const s = new URLSearchParams();
|
|
1485
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);
|
|
1486
1549
|
const r = s.toString(), o = this.resolveUrl(
|
|
1487
1550
|
"agentResources",
|
|
1488
|
-
`${
|
|
1489
|
-
|
|
1551
|
+
`${z.agents}/${encodeURIComponent(e)}/resources`,
|
|
1552
|
+
e
|
|
1490
1553
|
);
|
|
1491
1554
|
return this.request(
|
|
1492
|
-
|
|
1555
|
+
F.GET,
|
|
1493
1556
|
r ? `${o}?${r}` : o
|
|
1494
1557
|
);
|
|
1495
1558
|
}
|
|
1496
|
-
async listAllAgentResources(
|
|
1497
|
-
const n =
|
|
1559
|
+
async listAllAgentResources(e) {
|
|
1560
|
+
const n = ja;
|
|
1498
1561
|
let s = 1;
|
|
1499
1562
|
const r = [];
|
|
1500
1563
|
let o = Number.POSITIVE_INFINITY;
|
|
1501
1564
|
for (; r.length < o; ) {
|
|
1502
|
-
const i =
|
|
1503
|
-
await this.getAgentResources(
|
|
1565
|
+
const i = es(
|
|
1566
|
+
await this.getAgentResources(e, { pageNumber: s, pageSize: n })
|
|
1504
1567
|
);
|
|
1505
1568
|
if (o = i.totalRecords, i.resources.length === 0 || (r.push(...i.resources), r.length >= o))
|
|
1506
1569
|
break;
|
|
@@ -1508,121 +1571,126 @@ class ft {
|
|
|
1508
1571
|
}
|
|
1509
1572
|
return r;
|
|
1510
1573
|
}
|
|
1511
|
-
getAgentResourceHtml(
|
|
1512
|
-
return this.requestText(
|
|
1574
|
+
getAgentResourceHtml(e, n) {
|
|
1575
|
+
return this.requestText(F.GET, this.resolveResourceHtmlUrl(e, n));
|
|
1513
1576
|
}
|
|
1514
|
-
getAgentTimeline(
|
|
1577
|
+
getAgentTimeline(e) {
|
|
1515
1578
|
return this.request(
|
|
1516
|
-
|
|
1579
|
+
F.GET,
|
|
1517
1580
|
this.resolveUrl(
|
|
1518
1581
|
"agentTimeline",
|
|
1519
|
-
`${
|
|
1520
|
-
|
|
1582
|
+
`${z.agents}/${encodeURIComponent(e)}/agent-timeline`,
|
|
1583
|
+
e
|
|
1521
1584
|
)
|
|
1522
1585
|
);
|
|
1523
1586
|
}
|
|
1524
|
-
getAgentContext(
|
|
1587
|
+
getAgentContext(e) {
|
|
1588
|
+
const n = this.resolveUrl(
|
|
1589
|
+
"agent",
|
|
1590
|
+
`${z.agents}/${encodeURIComponent(e)}`,
|
|
1591
|
+
e
|
|
1592
|
+
);
|
|
1525
1593
|
return this.request(
|
|
1526
|
-
|
|
1527
|
-
|
|
1594
|
+
F.GET,
|
|
1595
|
+
`${Zt(n)}/context`
|
|
1528
1596
|
);
|
|
1529
1597
|
}
|
|
1530
|
-
cancelAgent(
|
|
1598
|
+
cancelAgent(e) {
|
|
1531
1599
|
return this.request(
|
|
1532
|
-
|
|
1600
|
+
F.POST,
|
|
1533
1601
|
this.resolveUrl(
|
|
1534
1602
|
"stopAgent",
|
|
1535
|
-
`${
|
|
1536
|
-
|
|
1603
|
+
`${z.agents}/${encodeURIComponent(e)}/cancel`,
|
|
1604
|
+
e
|
|
1537
1605
|
)
|
|
1538
1606
|
);
|
|
1539
1607
|
}
|
|
1540
|
-
archiveAgent(
|
|
1608
|
+
archiveAgent(e) {
|
|
1541
1609
|
return this.request(
|
|
1542
|
-
|
|
1543
|
-
this.apiUrl(`${
|
|
1610
|
+
F.POST,
|
|
1611
|
+
this.apiUrl(`${z.agents}/${encodeURIComponent(e)}/archive`)
|
|
1544
1612
|
);
|
|
1545
1613
|
}
|
|
1546
|
-
getConversation(
|
|
1614
|
+
getConversation(e) {
|
|
1547
1615
|
return this.request(
|
|
1548
|
-
|
|
1616
|
+
F.GET,
|
|
1549
1617
|
this.resolveUrl(
|
|
1550
1618
|
"agentConversation",
|
|
1551
|
-
`${
|
|
1552
|
-
|
|
1619
|
+
`${z.conversations}/${encodeURIComponent(e)}`,
|
|
1620
|
+
e
|
|
1553
1621
|
)
|
|
1554
1622
|
);
|
|
1555
1623
|
}
|
|
1556
1624
|
// Streams a chat turn. Resolves with the final SSE event; `onEvent` fires
|
|
1557
1625
|
// for every event as it arrives.
|
|
1558
|
-
async chat(
|
|
1626
|
+
async chat(e, n, s = {}) {
|
|
1559
1627
|
const r = !!(s.uploadFiles && s.uploadFiles.length > 0), o = await this.fetchImpl(
|
|
1560
1628
|
this.resolveUrl(
|
|
1561
1629
|
"agentChat",
|
|
1562
|
-
`${
|
|
1563
|
-
|
|
1630
|
+
`${z.agents}/${encodeURIComponent(e)}/chat`,
|
|
1631
|
+
e
|
|
1564
1632
|
),
|
|
1565
1633
|
{
|
|
1566
|
-
method:
|
|
1634
|
+
method: F.POST,
|
|
1567
1635
|
headers: {
|
|
1568
1636
|
...this.customHeaders,
|
|
1569
1637
|
...this.authHeaders(),
|
|
1570
|
-
Accept:
|
|
1638
|
+
Accept: be.acceptEventStream,
|
|
1571
1639
|
// Let the browser set the multipart boundary when uploading.
|
|
1572
|
-
...r ? {} : { "Content-Type":
|
|
1640
|
+
...r ? {} : { "Content-Type": be.contentTypeJson }
|
|
1573
1641
|
},
|
|
1574
|
-
body: r ?
|
|
1642
|
+
body: r ? gs(n, s.uploadFiles ?? []) : JSON.stringify(n),
|
|
1575
1643
|
signal: s.signal
|
|
1576
1644
|
}
|
|
1577
1645
|
);
|
|
1578
1646
|
if (!o.ok)
|
|
1579
1647
|
throw await this.toError(o);
|
|
1580
1648
|
if (!o.body)
|
|
1581
|
-
throw new
|
|
1649
|
+
throw new He(o.status, null, "Chat response contained no stream body");
|
|
1582
1650
|
return this.consumeSse(o.body, s.onEvent);
|
|
1583
1651
|
}
|
|
1584
1652
|
authHeaders() {
|
|
1585
1653
|
return this.token ? { Authorization: `Bearer ${this.token}` } : {};
|
|
1586
1654
|
}
|
|
1587
1655
|
// Builds a URL from the base url + shared API prefix + route.
|
|
1588
|
-
apiUrl(
|
|
1589
|
-
return `${this.baseUrl}${
|
|
1656
|
+
apiUrl(e) {
|
|
1657
|
+
return `${this.baseUrl}${Ja}${e}`;
|
|
1590
1658
|
}
|
|
1591
1659
|
// Resolves the URL for an operation, preferring a per-operation override
|
|
1592
1660
|
// (with `:invocationId` substituted) and falling back to the base url.
|
|
1593
|
-
resolveUrl(
|
|
1594
|
-
const o = this.urls[
|
|
1661
|
+
resolveUrl(e, n, s, r) {
|
|
1662
|
+
const o = this.urls[e];
|
|
1595
1663
|
if (!o)
|
|
1596
1664
|
return this.apiUrl(n);
|
|
1597
1665
|
let i = o;
|
|
1598
|
-
return s && (i = i.replace(
|
|
1666
|
+
return s && (i = i.replace(os, encodeURIComponent(s))), r && (i = i.replace(ls, encodeURIComponent(r))), i;
|
|
1599
1667
|
}
|
|
1600
|
-
resolveResourceHtmlUrl(
|
|
1668
|
+
resolveResourceHtmlUrl(e, n) {
|
|
1601
1669
|
return this.urls.agentResourceHtml ? this.resolveUrl(
|
|
1602
1670
|
"agentResourceHtml",
|
|
1603
|
-
`${
|
|
1671
|
+
`${z.agents}/${encodeURIComponent(e)}/resources/${encodeURIComponent(
|
|
1604
1672
|
n
|
|
1605
1673
|
)}`,
|
|
1606
|
-
|
|
1674
|
+
e,
|
|
1607
1675
|
n
|
|
1608
1676
|
) : this.urls.agentResources ? `${this.resolveUrl(
|
|
1609
1677
|
"agentResources",
|
|
1610
|
-
`${
|
|
1611
|
-
|
|
1678
|
+
`${z.agents}/${encodeURIComponent(e)}/resources`,
|
|
1679
|
+
e
|
|
1612
1680
|
).replace(/\/$/, "")}/${encodeURIComponent(n)}` : this.apiUrl(
|
|
1613
|
-
`${
|
|
1681
|
+
`${z.agents}/${encodeURIComponent(e)}/resources/${encodeURIComponent(
|
|
1614
1682
|
n
|
|
1615
1683
|
)}`
|
|
1616
1684
|
);
|
|
1617
1685
|
}
|
|
1618
|
-
async request(
|
|
1686
|
+
async request(e, n, s) {
|
|
1619
1687
|
const r = await this.fetchImpl(n, {
|
|
1620
|
-
method:
|
|
1688
|
+
method: e,
|
|
1621
1689
|
headers: {
|
|
1622
1690
|
...this.customHeaders,
|
|
1623
1691
|
...this.authHeaders(),
|
|
1624
|
-
Accept:
|
|
1625
|
-
...s === void 0 ? {} : { "Content-Type":
|
|
1692
|
+
Accept: be.acceptJson,
|
|
1693
|
+
...s === void 0 ? {} : { "Content-Type": be.contentTypeJson }
|
|
1626
1694
|
},
|
|
1627
1695
|
...s === void 0 ? {} : { body: JSON.stringify(s) }
|
|
1628
1696
|
});
|
|
@@ -1631,125 +1699,125 @@ class ft {
|
|
|
1631
1699
|
if (r.status !== 204)
|
|
1632
1700
|
return await r.json();
|
|
1633
1701
|
}
|
|
1634
|
-
async requestText(
|
|
1702
|
+
async requestText(e, n) {
|
|
1635
1703
|
const s = await this.fetchImpl(n, {
|
|
1636
|
-
method:
|
|
1704
|
+
method: e,
|
|
1637
1705
|
headers: {
|
|
1638
1706
|
...this.customHeaders,
|
|
1639
1707
|
...this.authHeaders(),
|
|
1640
|
-
Accept:
|
|
1708
|
+
Accept: be.acceptHtml
|
|
1641
1709
|
}
|
|
1642
1710
|
});
|
|
1643
1711
|
if (!s.ok)
|
|
1644
1712
|
throw await this.toError(s);
|
|
1645
1713
|
return s.text();
|
|
1646
1714
|
}
|
|
1647
|
-
async toError(
|
|
1715
|
+
async toError(e) {
|
|
1648
1716
|
let n = null;
|
|
1649
1717
|
try {
|
|
1650
|
-
n = await
|
|
1718
|
+
n = await e.json();
|
|
1651
1719
|
} catch {
|
|
1652
1720
|
}
|
|
1653
|
-
return new
|
|
1654
|
-
|
|
1721
|
+
return new He(
|
|
1722
|
+
e.status,
|
|
1655
1723
|
n,
|
|
1656
|
-
`Agent service request failed (${
|
|
1724
|
+
`Agent service request failed (${e.status} ${e.statusText})`
|
|
1657
1725
|
);
|
|
1658
1726
|
}
|
|
1659
|
-
async consumeSse(
|
|
1660
|
-
const s =
|
|
1727
|
+
async consumeSse(e, n) {
|
|
1728
|
+
const s = e.getReader(), r = new TextDecoder();
|
|
1661
1729
|
let o = "", i;
|
|
1662
|
-
const
|
|
1663
|
-
const { event:
|
|
1730
|
+
const u = (d) => {
|
|
1731
|
+
const { event: h, data: m } = ds(d);
|
|
1664
1732
|
if (m === null)
|
|
1665
1733
|
return;
|
|
1666
|
-
if (
|
|
1667
|
-
const
|
|
1668
|
-
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");
|
|
1669
1737
|
}
|
|
1670
|
-
const N =
|
|
1738
|
+
const N = Qt(m);
|
|
1671
1739
|
N && (i = N, n == null || n(N));
|
|
1672
1740
|
};
|
|
1673
1741
|
for (; ; ) {
|
|
1674
|
-
const { done:
|
|
1675
|
-
if (
|
|
1742
|
+
const { done: d, value: h } = await s.read();
|
|
1743
|
+
if (d)
|
|
1676
1744
|
break;
|
|
1677
|
-
o += r.decode(
|
|
1745
|
+
o += r.decode(h, { stream: !0 });
|
|
1678
1746
|
const m = o.split(`
|
|
1679
1747
|
|
|
1680
1748
|
`);
|
|
1681
1749
|
o = m.pop() ?? "";
|
|
1682
1750
|
for (const N of m)
|
|
1683
|
-
|
|
1751
|
+
u(N);
|
|
1684
1752
|
}
|
|
1685
|
-
if (o.trim() &&
|
|
1686
|
-
throw new
|
|
1753
|
+
if (o.trim() && u(o), !i)
|
|
1754
|
+
throw new He(502, null, "Chat stream ended without any events");
|
|
1687
1755
|
return i;
|
|
1688
1756
|
}
|
|
1689
1757
|
}
|
|
1690
|
-
const
|
|
1691
|
-
let
|
|
1758
|
+
const ds = (t) => {
|
|
1759
|
+
let e = null;
|
|
1692
1760
|
const n = [];
|
|
1693
|
-
for (const s of
|
|
1761
|
+
for (const s of t.split(`
|
|
1694
1762
|
`)) {
|
|
1695
1763
|
const r = s.trimEnd();
|
|
1696
|
-
r.startsWith("event:") ?
|
|
1764
|
+
r.startsWith("event:") ? e = r.slice(6).trim() : r.startsWith("data:") && n.push(r.slice(5).trim());
|
|
1697
1765
|
}
|
|
1698
1766
|
return {
|
|
1699
|
-
event:
|
|
1767
|
+
event: e,
|
|
1700
1768
|
data: n.length > 0 ? n.join(`
|
|
1701
1769
|
`) : null
|
|
1702
1770
|
};
|
|
1703
|
-
},
|
|
1771
|
+
}, Qt = (t) => {
|
|
1704
1772
|
try {
|
|
1705
|
-
return JSON.parse(
|
|
1773
|
+
return JSON.parse(t);
|
|
1706
1774
|
} catch {
|
|
1707
1775
|
return;
|
|
1708
1776
|
}
|
|
1709
1777
|
};
|
|
1710
|
-
function
|
|
1778
|
+
function gs(t, e) {
|
|
1711
1779
|
const n = new FormData();
|
|
1712
|
-
n.append("body", JSON.stringify(
|
|
1713
|
-
for (const s of
|
|
1780
|
+
n.append("body", JSON.stringify(t));
|
|
1781
|
+
for (const s of e)
|
|
1714
1782
|
n.append("files", s, s.name);
|
|
1715
1783
|
return n;
|
|
1716
1784
|
}
|
|
1717
|
-
const
|
|
1718
|
-
id:
|
|
1719
|
-
author:
|
|
1785
|
+
const hs = {
|
|
1786
|
+
id: ln,
|
|
1787
|
+
author: oe.agent,
|
|
1720
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."
|
|
1721
1789
|
};
|
|
1722
|
-
let
|
|
1723
|
-
const
|
|
1724
|
-
const
|
|
1725
|
-
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?`;
|
|
1726
1794
|
};
|
|
1727
|
-
class
|
|
1728
|
-
constructor(
|
|
1729
|
-
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;
|
|
1730
1798
|
}
|
|
1731
1799
|
openingMessage() {
|
|
1732
1800
|
return this.opening;
|
|
1733
1801
|
}
|
|
1734
1802
|
async bootstrapConversation() {
|
|
1735
|
-
const
|
|
1803
|
+
const e = await this.client.getConversation(this.chatId), n = is(e.messages);
|
|
1736
1804
|
return n.length === 0 ? [this.opening] : n;
|
|
1737
1805
|
}
|
|
1738
|
-
async start(
|
|
1739
|
-
return { ...await this.exchange(
|
|
1806
|
+
async start(e) {
|
|
1807
|
+
return { ...await this.exchange(ps(e)), phase: B.running };
|
|
1740
1808
|
}
|
|
1741
|
-
sendMessage(
|
|
1742
|
-
return this.exchange(
|
|
1809
|
+
sendMessage(e, n) {
|
|
1810
|
+
return this.exchange(e, n);
|
|
1743
1811
|
}
|
|
1744
1812
|
async stop() {
|
|
1745
1813
|
await this.client.cancelAgent(this.agentId);
|
|
1746
1814
|
}
|
|
1747
|
-
seedChecklist(
|
|
1748
|
-
this.seededChecklist =
|
|
1815
|
+
seedChecklist(e) {
|
|
1816
|
+
this.seededChecklist = e;
|
|
1749
1817
|
}
|
|
1750
|
-
async exchange(
|
|
1818
|
+
async exchange(e, n) {
|
|
1751
1819
|
var i;
|
|
1752
|
-
const s = [{ role:
|
|
1820
|
+
const s = [{ role: Wa.user, content: e }], r = await this.client.chat(
|
|
1753
1821
|
this.agentId,
|
|
1754
1822
|
{
|
|
1755
1823
|
messages: s,
|
|
@@ -1763,147 +1831,147 @@ class Ja {
|
|
|
1763
1831
|
},
|
|
1764
1832
|
...n && n.length > 0 ? [{ uploadFiles: n }] : []
|
|
1765
1833
|
), o = {
|
|
1766
|
-
id: r.event_id ||
|
|
1767
|
-
author:
|
|
1834
|
+
id: r.event_id || us("msg-agent"),
|
|
1835
|
+
author: oe.agent,
|
|
1768
1836
|
text: r.message.content,
|
|
1769
1837
|
...(i = r.follow_up_prompts) != null && i.length ? { followUpPrompts: r.follow_up_prompts } : {}
|
|
1770
1838
|
};
|
|
1771
1839
|
try {
|
|
1772
|
-
const
|
|
1773
|
-
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 };
|
|
1774
1842
|
} catch {
|
|
1775
1843
|
return { message: o, ...this.seededChecklist.length ? { checklist: this.seededChecklist } : {} };
|
|
1776
1844
|
}
|
|
1777
1845
|
}
|
|
1778
1846
|
}
|
|
1779
|
-
const
|
|
1847
|
+
const vn = (t, e) => (n) => {
|
|
1780
1848
|
var s, r;
|
|
1781
|
-
return new
|
|
1782
|
-
model:
|
|
1783
|
-
chatId: ((s =
|
|
1784
|
-
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)
|
|
1785
1853
|
});
|
|
1786
|
-
},
|
|
1787
|
-
const
|
|
1788
|
-
for (const n of
|
|
1789
|
-
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);
|
|
1790
1858
|
if (!s)
|
|
1791
1859
|
continue;
|
|
1792
1860
|
const r = n.invocation_id ?? n.id;
|
|
1793
|
-
|
|
1861
|
+
e[r] = s, e[n.id] = s;
|
|
1794
1862
|
}
|
|
1795
|
-
return
|
|
1796
|
-
},
|
|
1797
|
-
const { jwt:
|
|
1798
|
-
() => new
|
|
1799
|
-
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,
|
|
1800
1868
|
headers: n,
|
|
1801
1869
|
urls: s
|
|
1802
1870
|
}),
|
|
1803
1871
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- keyed on serialised config to keep a stable client.
|
|
1804
|
-
[
|
|
1872
|
+
[e, o]
|
|
1805
1873
|
);
|
|
1806
|
-
|
|
1874
|
+
rt(() => {
|
|
1807
1875
|
i.setHeaders(n);
|
|
1808
1876
|
}, [i, r]);
|
|
1809
|
-
const [
|
|
1877
|
+
const [u, d] = g([]), [h, m] = g(
|
|
1810
1878
|
[]
|
|
1811
|
-
), [N,
|
|
1812
|
-
(
|
|
1813
|
-
const
|
|
1814
|
-
|
|
1815
|
-
(
|
|
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
|
|
1816
1884
|
), m(
|
|
1817
|
-
(
|
|
1818
|
-
),
|
|
1819
|
-
(
|
|
1820
|
-
),
|
|
1885
|
+
(G) => At(G, V) ? G : V
|
|
1886
|
+
), w(
|
|
1887
|
+
(G) => At(G, Z) ? G : Z
|
|
1888
|
+
), p("idle"), k(null);
|
|
1821
1889
|
},
|
|
1822
1890
|
[]
|
|
1823
1891
|
);
|
|
1824
|
-
|
|
1825
|
-
let
|
|
1826
|
-
return
|
|
1892
|
+
$(() => {
|
|
1893
|
+
let U = !1;
|
|
1894
|
+
return p("loading"), k(null), (async () => {
|
|
1827
1895
|
try {
|
|
1828
|
-
const [
|
|
1896
|
+
const [q, K] = await Promise.all([
|
|
1829
1897
|
i.listAgents(),
|
|
1830
1898
|
i.listAgentDefinitions()
|
|
1831
1899
|
]);
|
|
1832
|
-
if (
|
|
1900
|
+
if (U)
|
|
1833
1901
|
return;
|
|
1834
|
-
A(
|
|
1835
|
-
} catch (
|
|
1836
|
-
if (
|
|
1902
|
+
A(q, K);
|
|
1903
|
+
} catch (q) {
|
|
1904
|
+
if (U)
|
|
1837
1905
|
return;
|
|
1838
|
-
|
|
1906
|
+
d([]), m([]), w({}), p("error"), k(wn(q));
|
|
1839
1907
|
}
|
|
1840
1908
|
})(), () => {
|
|
1841
|
-
|
|
1909
|
+
U = !0;
|
|
1842
1910
|
};
|
|
1843
|
-
}, [A, i,
|
|
1844
|
-
const
|
|
1845
|
-
|
|
1846
|
-
}, []),
|
|
1911
|
+
}, [A, i, P]);
|
|
1912
|
+
const v = S(() => {
|
|
1913
|
+
C((U) => U + 1);
|
|
1914
|
+
}, []), T = S(async () => {
|
|
1847
1915
|
try {
|
|
1848
|
-
const [
|
|
1916
|
+
const [U, q] = await Promise.all([
|
|
1849
1917
|
i.listAgents(),
|
|
1850
1918
|
i.listAgentDefinitions()
|
|
1851
1919
|
]);
|
|
1852
|
-
A(
|
|
1920
|
+
A(U, q);
|
|
1853
1921
|
} catch {
|
|
1854
1922
|
}
|
|
1855
|
-
}, [A, i]),
|
|
1856
|
-
async (
|
|
1857
|
-
const [
|
|
1858
|
-
i.getAgentChecklist(
|
|
1859
|
-
i.getAgent(
|
|
1923
|
+
}, [A, i]), O = S(
|
|
1924
|
+
async (U) => {
|
|
1925
|
+
const [q, K] = await Promise.all([
|
|
1926
|
+
i.getAgentChecklist(U),
|
|
1927
|
+
i.getAgent(U).catch(() => null)
|
|
1860
1928
|
]);
|
|
1861
|
-
return
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1929
|
+
return fn(
|
|
1930
|
+
U,
|
|
1931
|
+
q,
|
|
1932
|
+
K ?? void 0
|
|
1865
1933
|
);
|
|
1866
1934
|
},
|
|
1867
1935
|
[i]
|
|
1868
|
-
),
|
|
1869
|
-
async (
|
|
1936
|
+
), y = S(
|
|
1937
|
+
async (U) => i.listAllAgentResources(U),
|
|
1870
1938
|
[i]
|
|
1871
|
-
),
|
|
1939
|
+
), M = S(
|
|
1872
1940
|
async ({
|
|
1873
|
-
definition:
|
|
1874
|
-
invocationName:
|
|
1941
|
+
definition: U,
|
|
1942
|
+
invocationName: q
|
|
1875
1943
|
}) => {
|
|
1876
|
-
const
|
|
1877
|
-
invocationName:
|
|
1878
|
-
}),
|
|
1879
|
-
return
|
|
1880
|
-
...
|
|
1881
|
-
[Z.invocation_id]:
|
|
1882
|
-
[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
|
|
1883
1951
|
})), Z;
|
|
1884
1952
|
},
|
|
1885
1953
|
[i]
|
|
1886
|
-
),
|
|
1887
|
-
() =>
|
|
1888
|
-
resolveOpeningMessage: (
|
|
1954
|
+
), ne = X(
|
|
1955
|
+
() => vn(i, {
|
|
1956
|
+
resolveOpeningMessage: (U) => N[U.invocation_id] ?? N[U.id]
|
|
1889
1957
|
}),
|
|
1890
1958
|
[i, N]
|
|
1891
1959
|
);
|
|
1892
1960
|
return {
|
|
1893
|
-
agents:
|
|
1894
|
-
agentDefinitions:
|
|
1961
|
+
agents: u,
|
|
1962
|
+
agentDefinitions: h,
|
|
1895
1963
|
loadState: I,
|
|
1896
|
-
loadError:
|
|
1897
|
-
reload:
|
|
1898
|
-
refresh:
|
|
1899
|
-
fetchAgentChecklist:
|
|
1900
|
-
fetchAgentResources:
|
|
1901
|
-
createAgent:
|
|
1902
|
-
chatConnector:
|
|
1964
|
+
loadError: L,
|
|
1965
|
+
reload: v,
|
|
1966
|
+
refresh: T,
|
|
1967
|
+
fetchAgentChecklist: O,
|
|
1968
|
+
fetchAgentResources: y,
|
|
1969
|
+
createAgent: M,
|
|
1970
|
+
chatConnector: ne
|
|
1903
1971
|
};
|
|
1904
|
-
},
|
|
1905
|
-
const { agent:
|
|
1906
|
-
() => 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({
|
|
1907
1975
|
token: n,
|
|
1908
1976
|
headers: s,
|
|
1909
1977
|
urls: {
|
|
@@ -1917,414 +1985,473 @@ const nn = (e, t) => (n) => {
|
|
|
1917
1985
|
}
|
|
1918
1986
|
}),
|
|
1919
1987
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- keyed on serialised config to keep a stable client.
|
|
1920
|
-
[n,
|
|
1988
|
+
[n, u]
|
|
1921
1989
|
);
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
}, [
|
|
1925
|
-
const
|
|
1926
|
-
async (
|
|
1927
|
-
const [
|
|
1928
|
-
|
|
1929
|
-
|
|
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)
|
|
1930
1998
|
]);
|
|
1931
|
-
return
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1999
|
+
return fn(
|
|
2000
|
+
k,
|
|
2001
|
+
P,
|
|
2002
|
+
C ?? void 0
|
|
1935
2003
|
);
|
|
1936
2004
|
},
|
|
1937
|
-
[
|
|
1938
|
-
), m =
|
|
1939
|
-
async (
|
|
1940
|
-
[
|
|
1941
|
-
), N =
|
|
1942
|
-
async (
|
|
1943
|
-
[
|
|
1944
|
-
),
|
|
1945
|
-
async (
|
|
1946
|
-
|
|
1947
|
-
|
|
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);
|
|
1948
2019
|
},
|
|
1949
|
-
[
|
|
2020
|
+
[d]
|
|
2021
|
+
), p = S(
|
|
2022
|
+
async (k, P) => {
|
|
2023
|
+
await d.updateAgent(k, { invocationName: P });
|
|
2024
|
+
},
|
|
2025
|
+
[d]
|
|
1950
2026
|
);
|
|
1951
2027
|
return {
|
|
1952
|
-
connector:
|
|
1953
|
-
() =>
|
|
1954
|
-
chatId: o ??
|
|
1955
|
-
})(
|
|
2028
|
+
connector: X(
|
|
2029
|
+
() => vn(d, {
|
|
2030
|
+
chatId: o ?? e.invocation_id
|
|
2031
|
+
})(e),
|
|
1956
2032
|
// Key on invocation/chat ids so a new Agent object reference does not rebuild the connector.
|
|
1957
2033
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1958
|
-
[
|
|
2034
|
+
[d, e.invocation_id, o]
|
|
1959
2035
|
),
|
|
1960
|
-
fetchAgentChecklist:
|
|
2036
|
+
fetchAgentChecklist: h,
|
|
2037
|
+
fetchAgentContext: N,
|
|
1961
2038
|
fetchAgentResources: m,
|
|
1962
|
-
fetchAgentResourceHtml:
|
|
1963
|
-
fetchAgentTimeline:
|
|
2039
|
+
fetchAgentResourceHtml: w,
|
|
2040
|
+
fetchAgentTimeline: I,
|
|
2041
|
+
updateAgentInvocationName: p
|
|
1964
2042
|
};
|
|
1965
|
-
},
|
|
1966
|
-
const n =
|
|
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." : "";
|
|
1967
2045
|
return `${n}${s}.${r}`.trim();
|
|
1968
|
-
},
|
|
1969
|
-
switch (
|
|
1970
|
-
case
|
|
2046
|
+
}, As = (t) => {
|
|
2047
|
+
switch (t) {
|
|
2048
|
+
case R.failed:
|
|
1971
2049
|
return B.stopped;
|
|
1972
|
-
case
|
|
2050
|
+
case R.complete:
|
|
1973
2051
|
return B.complete;
|
|
1974
2052
|
default:
|
|
1975
2053
|
return B.running;
|
|
1976
2054
|
}
|
|
1977
|
-
},
|
|
1978
|
-
|
|
1979
|
-
},
|
|
1980
|
-
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];
|
|
1981
2059
|
return r !== void 0 && n.id === r.id && n.text === r.text;
|
|
1982
|
-
}),
|
|
1983
|
-
agent:
|
|
1984
|
-
invocationId:
|
|
2060
|
+
}), Ss = ({
|
|
2061
|
+
agent: t,
|
|
2062
|
+
invocationId: e,
|
|
1985
2063
|
open: n,
|
|
1986
2064
|
onClose: s,
|
|
1987
2065
|
jwt: r,
|
|
1988
2066
|
headers: o,
|
|
1989
2067
|
agentUrl: i,
|
|
1990
|
-
agentChecklistUrl:
|
|
1991
|
-
agentResourcesUrl:
|
|
1992
|
-
agentTimelineUrl:
|
|
2068
|
+
agentChecklistUrl: u,
|
|
2069
|
+
agentResourcesUrl: d,
|
|
2070
|
+
agentTimelineUrl: h,
|
|
1993
2071
|
agentChatUrl: m,
|
|
1994
2072
|
agentConversationUrl: N,
|
|
1995
|
-
stopAgentUrl:
|
|
2073
|
+
stopAgentUrl: w,
|
|
1996
2074
|
chatId: I,
|
|
1997
|
-
enableUpload:
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
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
|
|
2004
2083
|
}) => {
|
|
2005
|
-
const [
|
|
2006
|
-
connector:
|
|
2007
|
-
fetchAgentChecklist:
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
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 },
|
|
2013
2094
|
jwt: r,
|
|
2014
2095
|
headers: o,
|
|
2015
|
-
chatId:
|
|
2096
|
+
chatId: O,
|
|
2016
2097
|
urls: {
|
|
2017
2098
|
agentUrl: i,
|
|
2018
|
-
agentChecklistUrl:
|
|
2019
|
-
agentResourcesUrl:
|
|
2020
|
-
agentTimelineUrl:
|
|
2099
|
+
agentChecklistUrl: u,
|
|
2100
|
+
agentResourcesUrl: d,
|
|
2101
|
+
agentTimelineUrl: h,
|
|
2021
2102
|
agentChatUrl: m,
|
|
2022
2103
|
agentConversationUrl: N,
|
|
2023
|
-
stopAgentUrl:
|
|
2104
|
+
stopAgentUrl: w
|
|
2024
2105
|
}
|
|
2025
|
-
}),
|
|
2026
|
-
|
|
2027
|
-
), [
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
}, [
|
|
2031
|
-
|
|
2032
|
-
}, [
|
|
2033
|
-
|
|
2034
|
-
}, [
|
|
2035
|
-
|
|
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)
|
|
2036
2123
|
return;
|
|
2037
|
-
const
|
|
2038
|
-
if (!
|
|
2039
|
-
|
|
2124
|
+
const c = J.current.bootstrapConversation;
|
|
2125
|
+
if (!c) {
|
|
2126
|
+
tn(J.current.openingMessage(), Q);
|
|
2040
2127
|
return;
|
|
2041
2128
|
}
|
|
2042
|
-
let
|
|
2043
|
-
return
|
|
2129
|
+
let f = !1;
|
|
2130
|
+
return ft(!0), (async () => {
|
|
2044
2131
|
try {
|
|
2045
|
-
const
|
|
2046
|
-
if (
|
|
2132
|
+
const D = await c.call(J.current);
|
|
2133
|
+
if (f)
|
|
2047
2134
|
return;
|
|
2048
|
-
|
|
2135
|
+
Q(D.map(Te));
|
|
2049
2136
|
} catch {
|
|
2050
|
-
|
|
2137
|
+
f || tn(J.current.openingMessage(), Q);
|
|
2051
2138
|
} finally {
|
|
2052
|
-
|
|
2139
|
+
f || ft(!1);
|
|
2053
2140
|
}
|
|
2054
2141
|
})(), () => {
|
|
2055
|
-
|
|
2142
|
+
f = !0;
|
|
2056
2143
|
};
|
|
2057
|
-
}, [n,
|
|
2058
|
-
const
|
|
2059
|
-
const
|
|
2144
|
+
}, [n, k, e, O]);
|
|
2145
|
+
const le = S(() => {
|
|
2146
|
+
const c = ++$t.current;
|
|
2060
2147
|
(async () => {
|
|
2061
|
-
var
|
|
2148
|
+
var f, D;
|
|
2062
2149
|
try {
|
|
2063
|
-
const
|
|
2064
|
-
if (
|
|
2150
|
+
const W = await V(e);
|
|
2151
|
+
if (c !== $t.current)
|
|
2065
2152
|
return;
|
|
2066
|
-
|
|
2067
|
-
(
|
|
2068
|
-
),
|
|
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);
|
|
2069
2156
|
} catch {
|
|
2070
2157
|
}
|
|
2071
2158
|
})();
|
|
2072
|
-
}, [
|
|
2073
|
-
|
|
2159
|
+
}, [V, e]), Ne = S(() => {
|
|
2160
|
+
d && (async () => {
|
|
2074
2161
|
try {
|
|
2075
|
-
const
|
|
2076
|
-
|
|
2162
|
+
const c = await G(e);
|
|
2163
|
+
Ke(c), Pe(null);
|
|
2077
2164
|
} catch {
|
|
2078
2165
|
}
|
|
2079
2166
|
})();
|
|
2080
|
-
}, [
|
|
2081
|
-
if (!
|
|
2167
|
+
}, [d, G, e]), ce = S(() => {
|
|
2168
|
+
if (!h)
|
|
2082
2169
|
return;
|
|
2083
|
-
const
|
|
2170
|
+
const c = ++Mt.current;
|
|
2084
2171
|
(async () => {
|
|
2085
2172
|
try {
|
|
2086
|
-
const
|
|
2087
|
-
if (
|
|
2173
|
+
const f = await ge(e);
|
|
2174
|
+
if (c !== Mt.current)
|
|
2088
2175
|
return;
|
|
2089
|
-
|
|
2090
|
-
(
|
|
2091
|
-
),
|
|
2176
|
+
$e(
|
|
2177
|
+
(D) => JSON.stringify(D) === JSON.stringify(f) ? D : f
|
|
2178
|
+
), dt(null);
|
|
2092
2179
|
} catch {
|
|
2093
2180
|
}
|
|
2094
2181
|
})();
|
|
2095
|
-
}, [
|
|
2096
|
-
(
|
|
2097
|
-
const
|
|
2098
|
-
|
|
2182
|
+
}, [h, ge, e]), Me = S(
|
|
2183
|
+
(c) => {
|
|
2184
|
+
const f = J.current.bootstrapConversation;
|
|
2185
|
+
f && (async () => {
|
|
2099
2186
|
try {
|
|
2100
|
-
const
|
|
2101
|
-
if (
|
|
2187
|
+
const D = await f.call(J.current);
|
|
2188
|
+
if (Pt.current)
|
|
2102
2189
|
return;
|
|
2103
|
-
const
|
|
2104
|
-
let
|
|
2105
|
-
|
|
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());
|
|
2106
2193
|
} catch {
|
|
2107
2194
|
}
|
|
2108
2195
|
})();
|
|
2109
2196
|
},
|
|
2110
|
-
[
|
|
2111
|
-
),
|
|
2112
|
-
(
|
|
2113
|
-
switch (
|
|
2114
|
-
case
|
|
2115
|
-
|
|
2197
|
+
[le, ce]
|
|
2198
|
+
), Rn = S(
|
|
2199
|
+
(c) => {
|
|
2200
|
+
switch (c) {
|
|
2201
|
+
case Ae.checklist:
|
|
2202
|
+
le();
|
|
2116
2203
|
return;
|
|
2117
|
-
case
|
|
2118
|
-
|
|
2204
|
+
case Ae.resources:
|
|
2205
|
+
Ne();
|
|
2119
2206
|
return;
|
|
2120
|
-
case
|
|
2121
|
-
|
|
2207
|
+
case Ae.chat:
|
|
2208
|
+
Me();
|
|
2122
2209
|
return;
|
|
2123
|
-
case
|
|
2124
|
-
|
|
2210
|
+
case Ae.timeline:
|
|
2211
|
+
ce();
|
|
2125
2212
|
return;
|
|
2126
|
-
case
|
|
2213
|
+
case Ae.all:
|
|
2127
2214
|
default:
|
|
2128
|
-
|
|
2215
|
+
le(), Ne(), Me(), ce();
|
|
2129
2216
|
}
|
|
2130
2217
|
},
|
|
2131
|
-
[
|
|
2132
|
-
),
|
|
2133
|
-
enabled: n &&
|
|
2134
|
-
channelPrefix:
|
|
2135
|
-
agentId:
|
|
2136
|
-
subscribeToPusher:
|
|
2137
|
-
onRepoll:
|
|
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
|
|
2138
2225
|
});
|
|
2139
|
-
|
|
2140
|
-
if (!n ||
|
|
2226
|
+
$(() => {
|
|
2227
|
+
if (!n || k || Ht)
|
|
2141
2228
|
return;
|
|
2142
|
-
const
|
|
2143
|
-
|
|
2144
|
-
},
|
|
2229
|
+
const c = window.setInterval(() => {
|
|
2230
|
+
Me({ refreshSidePanelsOnChange: !0 });
|
|
2231
|
+
}, ys);
|
|
2145
2232
|
return () => {
|
|
2146
|
-
window.clearInterval(
|
|
2233
|
+
window.clearInterval(c);
|
|
2147
2234
|
};
|
|
2148
|
-
}, [n,
|
|
2149
|
-
const
|
|
2150
|
-
(
|
|
2151
|
-
var
|
|
2152
|
-
|
|
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();
|
|
2153
2240
|
},
|
|
2154
|
-
[
|
|
2241
|
+
[le, Ne, ce]
|
|
2155
2242
|
);
|
|
2156
|
-
|
|
2157
|
-
var
|
|
2158
|
-
!n ||
|
|
2159
|
-
}, [n,
|
|
2160
|
-
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)
|
|
2161
2248
|
return;
|
|
2162
|
-
let
|
|
2163
|
-
return
|
|
2164
|
-
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;
|
|
2165
2252
|
try {
|
|
2166
|
-
const
|
|
2167
|
-
if (
|
|
2253
|
+
const W = await V(e);
|
|
2254
|
+
if (c)
|
|
2168
2255
|
return;
|
|
2169
|
-
|
|
2256
|
+
C != null && C.length || (Ye(W.checklist), (D = (f = J.current).seedChecklist) == null || D.call(f, W.checklist));
|
|
2170
2257
|
} catch {
|
|
2171
|
-
!
|
|
2258
|
+
!c && !(C != null && C.length) && ht(at);
|
|
2172
2259
|
} finally {
|
|
2173
|
-
|
|
2260
|
+
c || Tt(!1);
|
|
2174
2261
|
}
|
|
2175
2262
|
})(), () => {
|
|
2176
|
-
|
|
2263
|
+
c = !0;
|
|
2177
2264
|
};
|
|
2178
|
-
}, [n,
|
|
2179
|
-
if (!n || !
|
|
2265
|
+
}, [n, e, k, C, V]), $(() => {
|
|
2266
|
+
if (!n || !d)
|
|
2180
2267
|
return;
|
|
2181
|
-
let
|
|
2182
|
-
return
|
|
2268
|
+
let c = !1;
|
|
2269
|
+
return je(!0), Pe(null), (async () => {
|
|
2183
2270
|
try {
|
|
2184
|
-
const
|
|
2185
|
-
|
|
2271
|
+
const f = await G(e);
|
|
2272
|
+
c || Ke(f);
|
|
2186
2273
|
} catch {
|
|
2187
|
-
|
|
2274
|
+
c || Pe(ta);
|
|
2188
2275
|
} finally {
|
|
2189
|
-
|
|
2276
|
+
c || je(!1);
|
|
2190
2277
|
}
|
|
2191
2278
|
})(), () => {
|
|
2192
|
-
|
|
2279
|
+
c = !0;
|
|
2193
2280
|
};
|
|
2194
|
-
}, [n,
|
|
2195
|
-
const
|
|
2196
|
-
|
|
2197
|
-
}, []),
|
|
2198
|
-
(
|
|
2199
|
-
if (
|
|
2200
|
-
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");
|
|
2201
2288
|
return;
|
|
2202
2289
|
}
|
|
2203
|
-
|
|
2290
|
+
De(c), E(null), me(null), Y(!0), (async () => {
|
|
2204
2291
|
try {
|
|
2205
|
-
const
|
|
2206
|
-
|
|
2292
|
+
const f = await ae(e, c.id);
|
|
2293
|
+
E(f);
|
|
2207
2294
|
} catch {
|
|
2208
|
-
|
|
2295
|
+
me(na);
|
|
2209
2296
|
} finally {
|
|
2210
|
-
|
|
2297
|
+
Y(!1);
|
|
2211
2298
|
}
|
|
2212
2299
|
})();
|
|
2213
2300
|
},
|
|
2214
|
-
[
|
|
2301
|
+
[ae, e]
|
|
2215
2302
|
);
|
|
2216
|
-
|
|
2217
|
-
if (!n || !
|
|
2303
|
+
$(() => {
|
|
2304
|
+
if (!n || !h)
|
|
2218
2305
|
return;
|
|
2219
|
-
let
|
|
2220
|
-
return
|
|
2306
|
+
let c = !1;
|
|
2307
|
+
return Et((f) => f || ee === null), dt(null), (async () => {
|
|
2221
2308
|
try {
|
|
2222
|
-
const
|
|
2223
|
-
|
|
2309
|
+
const f = await ge(e);
|
|
2310
|
+
c || $e(f);
|
|
2224
2311
|
} catch {
|
|
2225
|
-
|
|
2312
|
+
c || dt(cn);
|
|
2226
2313
|
} finally {
|
|
2227
|
-
|
|
2314
|
+
c || Et(!1);
|
|
2228
2315
|
}
|
|
2229
2316
|
})(), () => {
|
|
2230
|
-
|
|
2317
|
+
c = !0;
|
|
2231
2318
|
};
|
|
2232
|
-
}, [n,
|
|
2233
|
-
if (!n || !
|
|
2319
|
+
}, [n, e, h, ge]), $(() => {
|
|
2320
|
+
if (!n || !k)
|
|
2234
2321
|
return;
|
|
2235
|
-
let
|
|
2236
|
-
const
|
|
2322
|
+
let c = !1;
|
|
2323
|
+
const f = {
|
|
2237
2324
|
id: `user-brief-${Date.now()}`,
|
|
2238
|
-
author:
|
|
2239
|
-
|
|
2325
|
+
author: oe.user,
|
|
2326
|
+
// Read through a ref so a rename cannot re-trigger the agent run.
|
|
2327
|
+
text: Ns(k, Dt.current)
|
|
2240
2328
|
};
|
|
2241
2329
|
return (async () => {
|
|
2242
|
-
var
|
|
2243
|
-
const
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
]),
|
|
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());
|
|
2249
2337
|
})(), () => {
|
|
2250
|
-
|
|
2338
|
+
c = !0;
|
|
2251
2339
|
};
|
|
2252
|
-
}, [
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
}, []), lt = I ?? t, Ve = de == null ? void 0 : de.chatSessions, Ct = Ve != null && Ve.length ? Ve.reduce(
|
|
2264
|
-
(d, w) => Date.parse(w.timestamp) < Date.parse(d.timestamp) ? w : d
|
|
2265
|
-
).sessionId : void 0, ct = C(() => {
|
|
2266
|
-
z("chat"), L(!1), S !== lt && (v(lt), j([]), ye((d) => d + 1));
|
|
2267
|
-
}, [S, lt]), pn = C(
|
|
2268
|
-
(d) => {
|
|
2269
|
-
if (d === Ct) {
|
|
2270
|
-
ct();
|
|
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();
|
|
2271
2351
|
return;
|
|
2272
2352
|
}
|
|
2273
|
-
|
|
2353
|
+
y(c), q(!0), ne("chat"), Q([]), ke((f) => f + 1);
|
|
2274
2354
|
},
|
|
2275
|
-
[
|
|
2276
|
-
),
|
|
2277
|
-
|
|
2278
|
-
}, []),
|
|
2279
|
-
|
|
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);
|
|
2280
2360
|
try {
|
|
2281
|
-
await
|
|
2361
|
+
await J.current.stop(), pe(B.stopped);
|
|
2282
2362
|
} catch {
|
|
2283
|
-
|
|
2363
|
+
Ut(aa);
|
|
2284
2364
|
} finally {
|
|
2285
|
-
|
|
2365
|
+
Lt(!1);
|
|
2286
2366
|
}
|
|
2287
|
-
}, []),
|
|
2288
|
-
|
|
2289
|
-
|
|
2367
|
+
}, []), $n = S(
|
|
2368
|
+
(c) => {
|
|
2369
|
+
const f = c.trim(), D = Se;
|
|
2370
|
+
if (he(null), !f) {
|
|
2371
|
+
xe((W) => W + 1);
|
|
2372
|
+
return;
|
|
2373
|
+
}
|
|
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
|
+
})());
|
|
2381
|
+
},
|
|
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: [
|
|
2290
2408
|
/* @__PURE__ */ l("div", { className: "agent-workspace__header-title", children: [
|
|
2291
|
-
/* @__PURE__ */ a("span", { className: "agent-workspace__header-avatar", "aria-hidden": "true", children: /* @__PURE__ */ a(
|
|
2292
|
-
/* @__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
|
+
) }),
|
|
2293
2419
|
/* @__PURE__ */ a(
|
|
2294
2420
|
"span",
|
|
2295
2421
|
{
|
|
2296
|
-
className:
|
|
2297
|
-
children:
|
|
2422
|
+
className: j("agent-workspace__phase", `agent-workspace__phase--${ue}`),
|
|
2423
|
+
children: oa[ue]
|
|
2298
2424
|
}
|
|
2299
|
-
)
|
|
2425
|
+
),
|
|
2426
|
+
Ce && /* @__PURE__ */ a("p", { className: "agent-workspace__error agent-workspace__name-error", role: "alert", children: Ce })
|
|
2300
2427
|
] }),
|
|
2301
2428
|
/* @__PURE__ */ l("div", { className: "agent-workspace__header-actions", children: [
|
|
2302
2429
|
/* @__PURE__ */ a(
|
|
2303
|
-
|
|
2430
|
+
ie,
|
|
2304
2431
|
{
|
|
2305
|
-
variant:
|
|
2432
|
+
variant: Ze ? "secondary" : "primary",
|
|
2306
2433
|
size: "S",
|
|
2307
2434
|
iconLeftName: "clipboard-list",
|
|
2308
2435
|
iconLeftScreenReaderText: "Toggle checklist",
|
|
2309
|
-
"aria-pressed": !
|
|
2310
|
-
onClick: () =>
|
|
2436
|
+
"aria-pressed": !Ze,
|
|
2437
|
+
onClick: () => En((c) => !c),
|
|
2311
2438
|
children: "Checklist"
|
|
2312
2439
|
}
|
|
2313
2440
|
),
|
|
2314
2441
|
/* @__PURE__ */ a(
|
|
2315
|
-
|
|
2442
|
+
ie,
|
|
2316
2443
|
{
|
|
2317
|
-
variant:
|
|
2444
|
+
variant: Qe ? "secondary" : "primary",
|
|
2318
2445
|
size: "S",
|
|
2319
2446
|
iconLeftName: "files",
|
|
2320
2447
|
iconLeftScreenReaderText: "Toggle resources",
|
|
2321
|
-
"aria-pressed": !
|
|
2322
|
-
onClick: () =>
|
|
2448
|
+
"aria-pressed": !Qe,
|
|
2449
|
+
onClick: () => Tn((c) => !c),
|
|
2323
2450
|
children: "Resources"
|
|
2324
2451
|
}
|
|
2325
2452
|
),
|
|
2326
2453
|
/* @__PURE__ */ a(
|
|
2327
|
-
|
|
2454
|
+
ie,
|
|
2328
2455
|
{
|
|
2329
2456
|
variant: "secondary",
|
|
2330
2457
|
size: "S",
|
|
@@ -2337,101 +2464,101 @@ const nn = (e, t) => (n) => {
|
|
|
2337
2464
|
] })
|
|
2338
2465
|
] }),
|
|
2339
2466
|
/* @__PURE__ */ l(
|
|
2340
|
-
|
|
2467
|
+
ve.Body,
|
|
2341
2468
|
{
|
|
2342
|
-
className:
|
|
2343
|
-
"agent-workspace__body--no-checklist":
|
|
2344
|
-
"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
|
|
2345
2472
|
}),
|
|
2346
2473
|
children: [
|
|
2347
2474
|
/* @__PURE__ */ l(
|
|
2348
2475
|
"section",
|
|
2349
2476
|
{
|
|
2350
|
-
className:
|
|
2351
|
-
"agent-workspace__panel--timeline": !!
|
|
2477
|
+
className: j("agent-workspace__panel", "agent-workspace__panel--chat", {
|
|
2478
|
+
"agent-workspace__panel--timeline": !!h && M === "timeline"
|
|
2352
2479
|
}),
|
|
2353
2480
|
"aria-label": "Agent",
|
|
2354
2481
|
children: [
|
|
2355
2482
|
/* @__PURE__ */ l("div", { className: "agent-workspace__panel-header", children: [
|
|
2356
|
-
/* @__PURE__ */ a(
|
|
2357
|
-
|
|
2358
|
-
|
|
2483
|
+
/* @__PURE__ */ a(Ie, { level: 4, children: "Agent" }),
|
|
2484
|
+
w && ue === B.running && /* @__PURE__ */ a(
|
|
2485
|
+
ie,
|
|
2359
2486
|
{
|
|
2360
2487
|
className: "agent-workspace__panel-header-action",
|
|
2361
2488
|
variant: "secondary-destructive",
|
|
2362
2489
|
size: "S",
|
|
2363
2490
|
iconLeftName: "circle-x",
|
|
2364
2491
|
iconLeftScreenReaderText: "Stop",
|
|
2365
|
-
disabled:
|
|
2366
|
-
onClick: () => void
|
|
2367
|
-
children:
|
|
2492
|
+
disabled: It,
|
|
2493
|
+
onClick: () => void Dn(),
|
|
2494
|
+
children: It ? "Stopping…" : "Stop agent"
|
|
2368
2495
|
}
|
|
2369
2496
|
)
|
|
2370
2497
|
] }),
|
|
2371
|
-
|
|
2372
|
-
|
|
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: [
|
|
2373
2500
|
/* @__PURE__ */ a(
|
|
2374
|
-
|
|
2501
|
+
Oe.Item,
|
|
2375
2502
|
{
|
|
2376
|
-
active:
|
|
2503
|
+
active: M === "chat",
|
|
2377
2504
|
tabElementProps: {
|
|
2378
2505
|
id: "agent-center-tab-chat",
|
|
2379
|
-
onClick: () =>
|
|
2506
|
+
onClick: () => ne("chat")
|
|
2380
2507
|
},
|
|
2381
2508
|
children: "Chat"
|
|
2382
2509
|
}
|
|
2383
2510
|
),
|
|
2384
2511
|
/* @__PURE__ */ a(
|
|
2385
|
-
|
|
2512
|
+
Oe.Item,
|
|
2386
2513
|
{
|
|
2387
|
-
active:
|
|
2514
|
+
active: M === "timeline",
|
|
2388
2515
|
tabElementProps: {
|
|
2389
2516
|
id: "agent-center-tab-timeline",
|
|
2390
|
-
onClick: () =>
|
|
2517
|
+
onClick: () => ne("timeline")
|
|
2391
2518
|
},
|
|
2392
2519
|
children: "Timeline"
|
|
2393
2520
|
}
|
|
2394
2521
|
)
|
|
2395
2522
|
] }),
|
|
2396
|
-
|
|
2397
|
-
|
|
2523
|
+
h && M === "chat" && U && /* @__PURE__ */ a("div", { className: "agent-workspace__center-back", children: /* @__PURE__ */ a(
|
|
2524
|
+
ie,
|
|
2398
2525
|
{
|
|
2399
2526
|
variant: "tertiary",
|
|
2400
2527
|
size: "S",
|
|
2401
2528
|
iconLeftName: "arrow-left",
|
|
2402
2529
|
iconLeftScreenReaderText: "Back to main chat",
|
|
2403
|
-
onClick:
|
|
2530
|
+
onClick: wt,
|
|
2404
2531
|
children: "Back to main chat"
|
|
2405
2532
|
}
|
|
2406
2533
|
) }),
|
|
2407
|
-
|
|
2408
|
-
|
|
2534
|
+
h && M === "timeline" && /* @__PURE__ */ a(
|
|
2535
|
+
Pa,
|
|
2409
2536
|
{
|
|
2410
|
-
timeline:
|
|
2411
|
-
isLoading:
|
|
2412
|
-
error:
|
|
2413
|
-
onOpenChatSession:
|
|
2537
|
+
timeline: ee,
|
|
2538
|
+
isLoading: yn,
|
|
2539
|
+
error: Nn,
|
|
2540
|
+
onOpenChatSession: Un
|
|
2414
2541
|
}
|
|
2415
2542
|
),
|
|
2416
2543
|
/* @__PURE__ */ a(
|
|
2417
2544
|
"div",
|
|
2418
2545
|
{
|
|
2419
2546
|
className: "agent-workspace__chat-keep-alive",
|
|
2420
|
-
hidden: !!
|
|
2547
|
+
hidden: !!h && M !== "chat",
|
|
2421
2548
|
children: /* @__PURE__ */ a(
|
|
2422
|
-
|
|
2549
|
+
Na,
|
|
2423
2550
|
{
|
|
2424
|
-
connector:
|
|
2425
|
-
phase:
|
|
2426
|
-
chatHistory:
|
|
2427
|
-
chatSessionKey:
|
|
2428
|
-
startQuery:
|
|
2429
|
-
clarificationMessage:
|
|
2430
|
-
enableUpload:
|
|
2431
|
-
onTurn:
|
|
2432
|
-
onAwaitingChange:
|
|
2433
|
-
onClarificationPrompt:
|
|
2434
|
-
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)
|
|
2435
2562
|
}
|
|
2436
2563
|
)
|
|
2437
2564
|
}
|
|
@@ -2439,173 +2566,180 @@ const nn = (e, t) => (n) => {
|
|
|
2439
2566
|
]
|
|
2440
2567
|
}
|
|
2441
2568
|
),
|
|
2442
|
-
!
|
|
2443
|
-
|
|
2569
|
+
!Ze && /* @__PURE__ */ a(
|
|
2570
|
+
Aa,
|
|
2444
2571
|
{
|
|
2445
|
-
checklist:
|
|
2446
|
-
isLoading:
|
|
2447
|
-
error:
|
|
2448
|
-
phase:
|
|
2449
|
-
canRequestInput:
|
|
2450
|
-
onAttentionItemClick:
|
|
2451
|
-
|
|
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
|
|
2452
2586
|
),
|
|
2453
|
-
!
|
|
2454
|
-
|
|
2587
|
+
!Qe && /* @__PURE__ */ a(
|
|
2588
|
+
Ca,
|
|
2455
2589
|
{
|
|
2456
|
-
resources:
|
|
2457
|
-
isLoading:
|
|
2458
|
-
error:
|
|
2459
|
-
onOpenResource:
|
|
2590
|
+
resources: Je,
|
|
2591
|
+
isLoading: We,
|
|
2592
|
+
error: ct,
|
|
2593
|
+
onOpenResource: Ln
|
|
2460
2594
|
}
|
|
2461
2595
|
),
|
|
2462
2596
|
/* @__PURE__ */ a(
|
|
2463
|
-
|
|
2597
|
+
ba,
|
|
2464
2598
|
{
|
|
2465
|
-
resource:
|
|
2466
|
-
html:
|
|
2467
|
-
isLoading:
|
|
2468
|
-
error:
|
|
2469
|
-
onClose:
|
|
2599
|
+
resource: Ve,
|
|
2600
|
+
html: _,
|
|
2601
|
+
isLoading: b,
|
|
2602
|
+
error: ye,
|
|
2603
|
+
onClose: In
|
|
2470
2604
|
}
|
|
2471
2605
|
)
|
|
2472
2606
|
]
|
|
2473
2607
|
}
|
|
2474
2608
|
)
|
|
2475
2609
|
] });
|
|
2476
|
-
},
|
|
2477
|
-
open:
|
|
2478
|
-
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,
|
|
2479
2613
|
onStart: n,
|
|
2480
2614
|
agentDefinitions: s,
|
|
2481
2615
|
definitionsState: r = "idle",
|
|
2482
2616
|
definitionsError: o = null,
|
|
2483
2617
|
onRetryDefinitions: i,
|
|
2484
|
-
embedded:
|
|
2618
|
+
embedded: u = !1
|
|
2485
2619
|
}) => {
|
|
2486
|
-
const [
|
|
2487
|
-
value:
|
|
2488
|
-
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
|
|
2489
2623
|
}));
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
}, [
|
|
2493
|
-
const
|
|
2494
|
-
(
|
|
2495
|
-
const
|
|
2496
|
-
|
|
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);
|
|
2497
2631
|
},
|
|
2498
2632
|
[s]
|
|
2499
|
-
), A =
|
|
2500
|
-
if (!(!
|
|
2501
|
-
I(!0),
|
|
2633
|
+
), A = S(async () => {
|
|
2634
|
+
if (!(!d || !P || w)) {
|
|
2635
|
+
I(!0), L(null);
|
|
2502
2636
|
try {
|
|
2503
|
-
await n({ definition:
|
|
2504
|
-
} catch (
|
|
2505
|
-
|
|
2637
|
+
await n({ definition: d, invocationName: m.trim() });
|
|
2638
|
+
} catch (O) {
|
|
2639
|
+
L(O instanceof Error ? O.message : Es);
|
|
2506
2640
|
} finally {
|
|
2507
2641
|
I(!1);
|
|
2508
2642
|
}
|
|
2509
2643
|
}
|
|
2510
|
-
}, [
|
|
2511
|
-
if (r === "idle" && s.length === 0 || !
|
|
2644
|
+
}, [P, d, m, w, n]);
|
|
2645
|
+
if (r === "idle" && s.length === 0 || !t)
|
|
2512
2646
|
return null;
|
|
2513
|
-
const
|
|
2514
|
-
/* @__PURE__ */ a("span", { className: "new-agent__header-avatar", "aria-hidden": "true", children: /* @__PURE__ */ a(
|
|
2515
|
-
|
|
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" })
|
|
2516
2650
|
] });
|
|
2517
|
-
let
|
|
2518
|
-
return r === "loading" ?
|
|
2651
|
+
let T;
|
|
2652
|
+
return r === "loading" ? T = /* @__PURE__ */ l("div", { className: "new-agent__state", "aria-live": "polite", children: [
|
|
2519
2653
|
/* @__PURE__ */ a(
|
|
2520
|
-
|
|
2654
|
+
x,
|
|
2521
2655
|
{
|
|
2522
2656
|
name: "loader",
|
|
2523
2657
|
size: 24,
|
|
2524
2658
|
color: "var(--color-brand-600)",
|
|
2525
2659
|
className: "new-agent__spinner",
|
|
2526
|
-
screenReaderText:
|
|
2660
|
+
screenReaderText: nn
|
|
2527
2661
|
}
|
|
2528
2662
|
),
|
|
2529
|
-
/* @__PURE__ */ a("p", { className: "new-agent__state-message", children:
|
|
2530
|
-
] }) : r === "error" ?
|
|
2531
|
-
/* @__PURE__ */ a(
|
|
2532
|
-
/* @__PURE__ */ a("p", { className: "new-agent__state-message", children: o ??
|
|
2533
|
-
i ? /* @__PURE__ */ a(
|
|
2534
|
-
] }) :
|
|
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(
|
|
2535
2669
|
"form",
|
|
2536
2670
|
{
|
|
2537
2671
|
className: "new-agent__form",
|
|
2538
2672
|
"aria-label": "Start an agent",
|
|
2539
|
-
onSubmit: (
|
|
2540
|
-
|
|
2673
|
+
onSubmit: (O) => {
|
|
2674
|
+
O.preventDefault(), P && !w && A();
|
|
2541
2675
|
},
|
|
2542
2676
|
children: [
|
|
2543
2677
|
/* @__PURE__ */ l("div", { className: "new-agent__type-field", children: [
|
|
2544
2678
|
/* @__PURE__ */ a("label", { className: "new-agent__type-label", htmlFor: "new-agent-type", children: "What would you like your agent to do?" }),
|
|
2545
2679
|
/* @__PURE__ */ a(
|
|
2546
|
-
|
|
2680
|
+
Bn,
|
|
2547
2681
|
{
|
|
2548
2682
|
id: "new-agent-type",
|
|
2549
2683
|
placeholder: "Which agent would you like to start?",
|
|
2550
|
-
options:
|
|
2551
|
-
selectedValues:
|
|
2552
|
-
onSelectionChange:
|
|
2684
|
+
options: k,
|
|
2685
|
+
selectedValues: d ? [d.ref] : [],
|
|
2686
|
+
onSelectionChange: C
|
|
2553
2687
|
}
|
|
2554
2688
|
)
|
|
2555
2689
|
] }),
|
|
2556
2690
|
/* @__PURE__ */ l("div", { className: "new-agent__type-field", children: [
|
|
2557
2691
|
/* @__PURE__ */ a("label", { className: "new-agent__type-label", htmlFor: "new-agent-invocation-name", children: "Name" }),
|
|
2558
2692
|
/* @__PURE__ */ a(
|
|
2559
|
-
|
|
2693
|
+
Fn,
|
|
2560
2694
|
{
|
|
2561
2695
|
id: "new-agent-invocation-name",
|
|
2562
2696
|
value: m,
|
|
2563
2697
|
placeholder: "What would you like to call your agent?",
|
|
2564
|
-
onChange: (
|
|
2698
|
+
onChange: (O) => N(O.target.value)
|
|
2565
2699
|
}
|
|
2566
2700
|
)
|
|
2567
2701
|
] }),
|
|
2568
|
-
|
|
2702
|
+
p ? /* @__PURE__ */ a("p", { className: "new-agent__error", role: "alert", children: p }) : null,
|
|
2569
2703
|
/* @__PURE__ */ a("div", { className: "new-agent__actions", children: /* @__PURE__ */ a(
|
|
2570
|
-
|
|
2704
|
+
ie,
|
|
2571
2705
|
{
|
|
2572
2706
|
type: "submit",
|
|
2573
2707
|
variant: "primary",
|
|
2574
|
-
className:
|
|
2575
|
-
"new-agent__start-button--starting":
|
|
2708
|
+
className: j("new-agent__start-button", {
|
|
2709
|
+
"new-agent__start-button--starting": w
|
|
2576
2710
|
}),
|
|
2577
|
-
disabled: !
|
|
2578
|
-
iconLeftName:
|
|
2579
|
-
iconLeftScreenReaderText:
|
|
2580
|
-
children:
|
|
2711
|
+
disabled: !P || w,
|
|
2712
|
+
iconLeftName: w ? "loader" : "sparkles",
|
|
2713
|
+
iconLeftScreenReaderText: w ? "Starting" : void 0,
|
|
2714
|
+
children: w ? "Starting…" : "Start"
|
|
2581
2715
|
}
|
|
2582
2716
|
) })
|
|
2583
2717
|
]
|
|
2584
2718
|
}
|
|
2585
|
-
),
|
|
2586
|
-
/* @__PURE__ */ a("div", { className: "new-agent__header", children:
|
|
2587
|
-
/* @__PURE__ */ a("div", { className: "new-agent__body", children:
|
|
2588
|
-
] }) : /* @__PURE__ */ l(
|
|
2589
|
-
/* @__PURE__ */ a(
|
|
2590
|
-
/* @__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 })
|
|
2591
2725
|
] });
|
|
2592
|
-
},
|
|
2593
|
-
window.location.assign(
|
|
2594
|
-
},
|
|
2595
|
-
open:
|
|
2596
|
-
authToken:
|
|
2726
|
+
}, an = (t) => {
|
|
2727
|
+
window.location.assign(t);
|
|
2728
|
+
}, Ts = ({
|
|
2729
|
+
open: t,
|
|
2730
|
+
authToken: e,
|
|
2597
2731
|
headers: n,
|
|
2598
2732
|
agentDefinitionsUrl: s,
|
|
2599
2733
|
agentsUrl: r,
|
|
2600
2734
|
closeUrl: o,
|
|
2601
2735
|
successUrl: i,
|
|
2602
|
-
onClose:
|
|
2603
|
-
onStart:
|
|
2604
|
-
embedded:
|
|
2736
|
+
onClose: u,
|
|
2737
|
+
onStart: d,
|
|
2738
|
+
embedded: h = !1
|
|
2605
2739
|
}) => {
|
|
2606
|
-
const m = JSON.stringify(n ?? {}), N =
|
|
2607
|
-
() => new
|
|
2608
|
-
token:
|
|
2740
|
+
const m = JSON.stringify(n ?? {}), N = X(
|
|
2741
|
+
() => new Ct({
|
|
2742
|
+
token: e,
|
|
2609
2743
|
headers: n,
|
|
2610
2744
|
urls: {
|
|
2611
2745
|
agentDefinitions: s,
|
|
@@ -2613,106 +2747,106 @@ const nn = (e, t) => (n) => {
|
|
|
2613
2747
|
}
|
|
2614
2748
|
}),
|
|
2615
2749
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- keyed on serialised config to keep a stable client.
|
|
2616
|
-
[
|
|
2617
|
-
), [
|
|
2618
|
-
|
|
2619
|
-
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)
|
|
2620
2754
|
return;
|
|
2621
|
-
let
|
|
2622
|
-
return
|
|
2755
|
+
let y = !1;
|
|
2756
|
+
return L("loading"), P(null), (async () => {
|
|
2623
2757
|
try {
|
|
2624
|
-
const
|
|
2625
|
-
if (
|
|
2758
|
+
const M = await N.listAgentDefinitions();
|
|
2759
|
+
if (y)
|
|
2626
2760
|
return;
|
|
2627
|
-
I(
|
|
2628
|
-
} catch (
|
|
2629
|
-
if (
|
|
2761
|
+
I(M.map(mn)), L("idle");
|
|
2762
|
+
} catch (M) {
|
|
2763
|
+
if (y)
|
|
2630
2764
|
return;
|
|
2631
|
-
I([]),
|
|
2765
|
+
I([]), P(wn(M)), L("error");
|
|
2632
2766
|
}
|
|
2633
2767
|
})(), () => {
|
|
2634
|
-
|
|
2768
|
+
y = !0;
|
|
2635
2769
|
};
|
|
2636
|
-
}, [N,
|
|
2637
|
-
const
|
|
2638
|
-
|
|
2639
|
-
}, [o,
|
|
2640
|
-
async (
|
|
2641
|
-
await N.createAgent(
|
|
2642
|
-
invocationName:
|
|
2643
|
-
}),
|
|
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);
|
|
2644
2778
|
},
|
|
2645
|
-
[N,
|
|
2646
|
-
),
|
|
2647
|
-
A((
|
|
2779
|
+
[N, d, i]
|
|
2780
|
+
), O = S(() => {
|
|
2781
|
+
A((y) => y + 1);
|
|
2648
2782
|
}, []);
|
|
2649
2783
|
return /* @__PURE__ */ a(
|
|
2650
|
-
|
|
2784
|
+
kn,
|
|
2651
2785
|
{
|
|
2652
|
-
open:
|
|
2653
|
-
onClose:
|
|
2654
|
-
onStart:
|
|
2655
|
-
agentDefinitions:
|
|
2656
|
-
definitionsState:
|
|
2657
|
-
definitionsError:
|
|
2658
|
-
onRetryDefinitions:
|
|
2659
|
-
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
|
|
2660
2794
|
}
|
|
2661
2795
|
);
|
|
2662
|
-
},
|
|
2663
|
-
|
|
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,
|
|
2664
2798
|
{
|
|
2665
|
-
name:
|
|
2799
|
+
name: t.statusIcon.name,
|
|
2666
2800
|
size: 16,
|
|
2667
|
-
color:
|
|
2668
|
-
className:
|
|
2669
|
-
"agent-view__progress-icon--spinning":
|
|
2801
|
+
color: t.statusIcon.color,
|
|
2802
|
+
className: j({
|
|
2803
|
+
"agent-view__progress-icon--spinning": t.statusIcon.spin
|
|
2670
2804
|
}),
|
|
2671
|
-
screenReaderText:
|
|
2805
|
+
screenReaderText: e
|
|
2672
2806
|
}
|
|
2673
2807
|
) }) : /* @__PURE__ */ a(
|
|
2674
2808
|
"span",
|
|
2675
2809
|
{
|
|
2676
|
-
className:
|
|
2677
|
-
[`agent-view__dot--${
|
|
2810
|
+
className: j("agent-view__dot", {
|
|
2811
|
+
[`agent-view__dot--${t.dotModifier}`]: t.dotModifier
|
|
2678
2812
|
}),
|
|
2679
|
-
children: /* @__PURE__ */ a(
|
|
2813
|
+
children: /* @__PURE__ */ a(rn, { colour: t.dotColour, label: e })
|
|
2680
2814
|
}
|
|
2681
|
-
),
|
|
2682
|
-
agent:
|
|
2683
|
-
agentName:
|
|
2815
|
+
), Us = ({
|
|
2816
|
+
agent: t,
|
|
2817
|
+
agentName: e,
|
|
2684
2818
|
column: n,
|
|
2685
2819
|
isExpanded: s,
|
|
2686
2820
|
isLoading: r,
|
|
2687
2821
|
checklist: o,
|
|
2688
2822
|
error: i,
|
|
2689
|
-
onToggle:
|
|
2690
|
-
onViewAgent:
|
|
2823
|
+
onToggle: u,
|
|
2824
|
+
onViewAgent: d
|
|
2691
2825
|
}) => {
|
|
2692
|
-
const { id:
|
|
2826
|
+
const { id: h, invocation_name: m } = t, N = `agent-card-${h}-header`, w = `agent-card-${h}-progress`;
|
|
2693
2827
|
return /* @__PURE__ */ a(
|
|
2694
2828
|
"li",
|
|
2695
2829
|
{
|
|
2696
|
-
className:
|
|
2830
|
+
className: j("agent-view__card", {
|
|
2697
2831
|
"agent-view__card--expanded": s
|
|
2698
2832
|
}),
|
|
2699
|
-
children: /* @__PURE__ */ l(
|
|
2833
|
+
children: /* @__PURE__ */ l(qn, { spacing: "dense", children: [
|
|
2700
2834
|
/* @__PURE__ */ a(
|
|
2701
2835
|
"button",
|
|
2702
2836
|
{
|
|
2703
2837
|
type: "button",
|
|
2704
2838
|
className: "agent-view__card-toggle",
|
|
2705
2839
|
"aria-expanded": s,
|
|
2706
|
-
"aria-controls":
|
|
2840
|
+
"aria-controls": w,
|
|
2707
2841
|
"aria-label": m,
|
|
2708
2842
|
id: N,
|
|
2709
|
-
onClick: () =>
|
|
2843
|
+
onClick: () => u(h),
|
|
2710
2844
|
children: /* @__PURE__ */ l("div", { className: "agent-view__card-content", children: [
|
|
2711
|
-
/* @__PURE__ */ a(
|
|
2845
|
+
/* @__PURE__ */ a(xs, { column: n }),
|
|
2712
2846
|
/* @__PURE__ */ a("span", { className: "agent-view__card-invocation-name", children: m }),
|
|
2713
|
-
/* @__PURE__ */ a("span", { className: "agent-view__card-agent-name", children:
|
|
2847
|
+
/* @__PURE__ */ a("span", { className: "agent-view__card-agent-name", children: e }),
|
|
2714
2848
|
/* @__PURE__ */ a(
|
|
2715
|
-
|
|
2849
|
+
x,
|
|
2716
2850
|
{
|
|
2717
2851
|
name: s ? "chevron-up" : "chevron-down",
|
|
2718
2852
|
size: 16,
|
|
@@ -2722,110 +2856,111 @@ const nn = (e, t) => (n) => {
|
|
|
2722
2856
|
] })
|
|
2723
2857
|
}
|
|
2724
2858
|
),
|
|
2725
|
-
s && /* @__PURE__ */ l("div", { id:
|
|
2859
|
+
s && /* @__PURE__ */ l("div", { id: w, "aria-labelledby": N, className: "agent-view__card-progress", children: [
|
|
2726
2860
|
r && /* @__PURE__ */ l("div", { className: "agent-view__progress-loading", "aria-live": "polite", children: [
|
|
2727
2861
|
/* @__PURE__ */ a(
|
|
2728
|
-
|
|
2862
|
+
x,
|
|
2729
2863
|
{
|
|
2730
2864
|
name: "loader",
|
|
2731
2865
|
size: 16,
|
|
2732
2866
|
color: "var(--color-brand-600)",
|
|
2733
2867
|
className: "agent-view__progress-icon--spinning",
|
|
2734
|
-
screenReaderText:
|
|
2868
|
+
screenReaderText: Re
|
|
2735
2869
|
}
|
|
2736
2870
|
),
|
|
2737
|
-
/* @__PURE__ */ a("span", { children:
|
|
2871
|
+
/* @__PURE__ */ a("span", { children: Re })
|
|
2738
2872
|
] }),
|
|
2739
2873
|
!r && i && /* @__PURE__ */ a("p", { className: "agent-view__progress-error", role: "alert", children: i }),
|
|
2740
|
-
!r && !i && o !== null && /* @__PURE__ */ a(
|
|
2874
|
+
!r && !i && o !== null && /* @__PURE__ */ a(wa, { checklist: o }),
|
|
2741
2875
|
!r && !i && o === null && /* @__PURE__ */ l("div", { className: "agent-view__progress-loading", "aria-live": "polite", children: [
|
|
2742
2876
|
/* @__PURE__ */ a(
|
|
2743
|
-
|
|
2877
|
+
x,
|
|
2744
2878
|
{
|
|
2745
2879
|
name: "loader",
|
|
2746
2880
|
size: 16,
|
|
2747
2881
|
color: "var(--color-brand-600)",
|
|
2748
2882
|
className: "agent-view__progress-icon--spinning",
|
|
2749
|
-
screenReaderText:
|
|
2883
|
+
screenReaderText: Re
|
|
2750
2884
|
}
|
|
2751
2885
|
),
|
|
2752
|
-
/* @__PURE__ */ a("span", { children:
|
|
2886
|
+
/* @__PURE__ */ a("span", { children: Re })
|
|
2753
2887
|
] }),
|
|
2754
|
-
/* @__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" }) })
|
|
2755
2889
|
] })
|
|
2756
2890
|
] })
|
|
2757
2891
|
}
|
|
2758
2892
|
);
|
|
2759
|
-
},
|
|
2760
|
-
column:
|
|
2761
|
-
agents:
|
|
2893
|
+
}, sn = ({
|
|
2894
|
+
column: t,
|
|
2895
|
+
agents: e,
|
|
2762
2896
|
expandedAgentId: n,
|
|
2763
2897
|
loadingAgentId: s,
|
|
2764
2898
|
checklistByInvocationId: r,
|
|
2765
2899
|
errorByAgentId: o,
|
|
2766
2900
|
definitionNameByRef: i,
|
|
2767
|
-
onToggleAgent:
|
|
2768
|
-
onViewAgent:
|
|
2769
|
-
isSplit:
|
|
2901
|
+
onToggleAgent: u,
|
|
2902
|
+
onViewAgent: d,
|
|
2903
|
+
isSplit: h = !1
|
|
2770
2904
|
}) => /* @__PURE__ */ l(
|
|
2771
2905
|
"section",
|
|
2772
2906
|
{
|
|
2773
|
-
className:
|
|
2774
|
-
"agent-view__column--split":
|
|
2907
|
+
className: j("agent-view__column", {
|
|
2908
|
+
"agent-view__column--split": h
|
|
2775
2909
|
}),
|
|
2776
|
-
"aria-label":
|
|
2910
|
+
"aria-label": t.title,
|
|
2777
2911
|
children: [
|
|
2778
2912
|
/* @__PURE__ */ l("div", { className: "agent-view__column-header", children: [
|
|
2779
|
-
/* @__PURE__ */ a(
|
|
2780
|
-
/* @__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 })
|
|
2781
2915
|
] }),
|
|
2782
|
-
/* @__PURE__ */ a("ul", { className: "agent-view__card-list", children:
|
|
2783
|
-
|
|
2916
|
+
/* @__PURE__ */ a("ul", { className: "agent-view__card-list", children: e.map((m) => /* @__PURE__ */ a(
|
|
2917
|
+
Us,
|
|
2784
2918
|
{
|
|
2785
2919
|
agent: m,
|
|
2786
|
-
agentName:
|
|
2787
|
-
column:
|
|
2920
|
+
agentName: St(m, i),
|
|
2921
|
+
column: t,
|
|
2788
2922
|
isExpanded: n === m.id,
|
|
2789
2923
|
isLoading: s === m.id,
|
|
2790
2924
|
checklist: r[m.invocation_id] ?? null,
|
|
2791
2925
|
error: o[m.id] ?? null,
|
|
2792
|
-
onToggle:
|
|
2793
|
-
onViewAgent:
|
|
2926
|
+
onToggle: u,
|
|
2927
|
+
onViewAgent: d
|
|
2794
2928
|
},
|
|
2795
2929
|
m.id
|
|
2796
2930
|
)) })
|
|
2797
2931
|
]
|
|
2798
2932
|
}
|
|
2799
|
-
),
|
|
2800
|
-
jwt:
|
|
2801
|
-
headers:
|
|
2933
|
+
), St = (t, e) => e.get(t.agent_definition_ref) ?? t.agent_definition_ref.replace(/_/g, " "), Gs = ({
|
|
2934
|
+
jwt: t,
|
|
2935
|
+
headers: e,
|
|
2802
2936
|
agentDefinitionsUrl: n,
|
|
2803
2937
|
agentsUrl: s,
|
|
2804
2938
|
agentUrl: r,
|
|
2805
2939
|
agentChecklistUrl: o,
|
|
2806
2940
|
agentResourcesUrl: i,
|
|
2807
|
-
agentTimelineUrl:
|
|
2808
|
-
agentChatUrl:
|
|
2809
|
-
agentConversationUrl:
|
|
2941
|
+
agentTimelineUrl: u,
|
|
2942
|
+
agentChatUrl: d,
|
|
2943
|
+
agentConversationUrl: h,
|
|
2810
2944
|
stopAgentUrl: m,
|
|
2811
2945
|
enableUpload: N,
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2946
|
+
adminMode: w = !1,
|
|
2947
|
+
showHeader: I = !1,
|
|
2948
|
+
institutions: p,
|
|
2949
|
+
usePusherToRepoll: L = !1,
|
|
2950
|
+
pusherChannelPrefix: k = pn,
|
|
2951
|
+
subscribeToPusher: P
|
|
2817
2952
|
}) => {
|
|
2818
|
-
var
|
|
2819
|
-
const
|
|
2953
|
+
var De;
|
|
2954
|
+
const C = X(
|
|
2820
2955
|
() => ({
|
|
2821
2956
|
agentDefinitions: n,
|
|
2822
2957
|
agents: s,
|
|
2823
2958
|
agent: r,
|
|
2824
2959
|
agentChecklist: o,
|
|
2825
2960
|
...i ? { agentResources: i } : {},
|
|
2826
|
-
...
|
|
2827
|
-
agentChat:
|
|
2828
|
-
agentConversation:
|
|
2961
|
+
...u ? { agentTimeline: u } : {},
|
|
2962
|
+
agentChat: d,
|
|
2963
|
+
agentConversation: h
|
|
2829
2964
|
}),
|
|
2830
2965
|
[
|
|
2831
2966
|
n,
|
|
@@ -2833,166 +2968,166 @@ const nn = (e, t) => (n) => {
|
|
|
2833
2968
|
r,
|
|
2834
2969
|
o,
|
|
2835
2970
|
i,
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2971
|
+
u,
|
|
2972
|
+
d,
|
|
2973
|
+
h
|
|
2839
2974
|
]
|
|
2840
|
-
), [
|
|
2841
|
-
(
|
|
2842
|
-
)) == null ? void 0 :
|
|
2843
|
-
const
|
|
2844
|
-
return
|
|
2845
|
-
}, [
|
|
2846
|
-
agents:
|
|
2847
|
-
agentDefinitions:
|
|
2848
|
-
loadState:
|
|
2849
|
-
loadError:
|
|
2850
|
-
reload:
|
|
2851
|
-
refresh:
|
|
2852
|
-
fetchAgentChecklist:
|
|
2853
|
-
createAgent:
|
|
2854
|
-
} =
|
|
2855
|
-
const
|
|
2856
|
-
(
|
|
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])
|
|
2857
2992
|
);
|
|
2858
|
-
return [...
|
|
2859
|
-
(
|
|
2860
|
-
).map((
|
|
2861
|
-
value:
|
|
2862
|
-
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
|
|
2863
2998
|
}));
|
|
2864
|
-
}, [
|
|
2865
|
-
() => new Map(
|
|
2866
|
-
[
|
|
2867
|
-
),
|
|
2868
|
-
|
|
2869
|
-
)].sort((
|
|
2870
|
-
value:
|
|
2871
|
-
label:
|
|
2872
|
-
})), [
|
|
2873
|
-
|
|
2874
|
-
const
|
|
2875
|
-
|
|
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();
|
|
2876
3011
|
}, 6e4);
|
|
2877
3012
|
return () => {
|
|
2878
|
-
window.clearInterval(
|
|
3013
|
+
window.clearInterval(_);
|
|
2879
3014
|
};
|
|
2880
|
-
}, [
|
|
2881
|
-
if (
|
|
3015
|
+
}, [K]), $(() => {
|
|
3016
|
+
if (y.length === 0)
|
|
2882
3017
|
return;
|
|
2883
|
-
let
|
|
3018
|
+
let _ = !1;
|
|
2884
3019
|
return (async () => {
|
|
2885
|
-
const
|
|
2886
|
-
|
|
2887
|
-
const
|
|
3020
|
+
const E = await Promise.allSettled(
|
|
3021
|
+
y.map(async (b) => {
|
|
3022
|
+
const Y = await V(b.invocation_id);
|
|
2888
3023
|
return {
|
|
2889
|
-
agentId:
|
|
2890
|
-
invocationId:
|
|
2891
|
-
checklist:
|
|
3024
|
+
agentId: b.id,
|
|
3025
|
+
invocationId: b.invocation_id,
|
|
3026
|
+
checklist: Y.checklist
|
|
2892
3027
|
};
|
|
2893
3028
|
})
|
|
2894
3029
|
);
|
|
2895
|
-
|
|
2896
|
-
const
|
|
2897
|
-
let
|
|
2898
|
-
for (const
|
|
2899
|
-
if (
|
|
3030
|
+
_ || (Ge((b) => {
|
|
3031
|
+
const Y = { ...b };
|
|
3032
|
+
let ye = !1;
|
|
3033
|
+
for (const me of E) {
|
|
3034
|
+
if (me.status !== "fulfilled")
|
|
2900
3035
|
continue;
|
|
2901
|
-
const { invocationId:
|
|
2902
|
-
JSON.stringify(
|
|
3036
|
+
const { invocationId: ee, checklist: $e } = me.value;
|
|
3037
|
+
JSON.stringify(b[ee]) !== JSON.stringify($e) && (Y[ee] = $e, ye = !0);
|
|
2903
3038
|
}
|
|
2904
|
-
return
|
|
2905
|
-
}),
|
|
2906
|
-
const
|
|
2907
|
-
let
|
|
2908
|
-
return
|
|
2909
|
-
|
|
2910
|
-
}),
|
|
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;
|
|
2911
3046
|
}));
|
|
2912
3047
|
})(), () => {
|
|
2913
|
-
|
|
3048
|
+
_ = !0;
|
|
2914
3049
|
};
|
|
2915
|
-
}, [
|
|
2916
|
-
const
|
|
2917
|
-
async (
|
|
2918
|
-
if (!
|
|
2919
|
-
|
|
2920
|
-
const
|
|
2921
|
-
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;
|
|
2922
3057
|
});
|
|
2923
3058
|
try {
|
|
2924
|
-
const
|
|
2925
|
-
|
|
2926
|
-
...
|
|
2927
|
-
[
|
|
3059
|
+
const E = await V(_.invocation_id);
|
|
3060
|
+
Ge((b) => ({
|
|
3061
|
+
...b,
|
|
3062
|
+
[_.invocation_id]: E.checklist
|
|
2928
3063
|
}));
|
|
2929
3064
|
} catch {
|
|
2930
|
-
|
|
2931
|
-
...
|
|
2932
|
-
[
|
|
3065
|
+
Ce((E) => ({
|
|
3066
|
+
...E,
|
|
3067
|
+
[_.id]: at
|
|
2933
3068
|
}));
|
|
2934
3069
|
} finally {
|
|
2935
|
-
|
|
3070
|
+
Se((E) => E === _.id ? null : E);
|
|
2936
3071
|
}
|
|
2937
3072
|
}
|
|
2938
3073
|
},
|
|
2939
|
-
[
|
|
2940
|
-
),
|
|
2941
|
-
(
|
|
2942
|
-
if (
|
|
2943
|
-
|
|
3074
|
+
[V, se]
|
|
3075
|
+
), Ke = S(
|
|
3076
|
+
(_) => {
|
|
3077
|
+
if (ge === _) {
|
|
3078
|
+
Le(null);
|
|
2944
3079
|
return;
|
|
2945
3080
|
}
|
|
2946
|
-
const
|
|
2947
|
-
|
|
3081
|
+
const E = y.find(({ id: b }) => b === _);
|
|
3082
|
+
E && (Le(_), Je(E));
|
|
2948
3083
|
},
|
|
2949
|
-
[
|
|
2950
|
-
),
|
|
2951
|
-
const
|
|
2952
|
-
for (const
|
|
2953
|
-
const
|
|
2954
|
-
|
|
2955
|
-
|
|
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]
|
|
2956
3091
|
);
|
|
2957
|
-
(
|
|
3092
|
+
(_[b] ?? (_[b] = [])).push(E);
|
|
2958
3093
|
}
|
|
2959
|
-
return
|
|
2960
|
-
}, [
|
|
2961
|
-
|
|
2962
|
-
}, []),
|
|
2963
|
-
async (
|
|
2964
|
-
const
|
|
2965
|
-
|
|
3094
|
+
return _;
|
|
3095
|
+
}, [Be, se]), je = S((_) => {
|
|
3096
|
+
v(_);
|
|
3097
|
+
}, []), ct = S(
|
|
3098
|
+
async (_) => {
|
|
3099
|
+
const E = await Z(_);
|
|
3100
|
+
v(E), ae(!1);
|
|
2966
3101
|
},
|
|
2967
|
-
[
|
|
2968
|
-
),
|
|
2969
|
-
|
|
2970
|
-
}, []),
|
|
2971
|
-
expandedAgentId:
|
|
2972
|
-
loadingAgentId:
|
|
2973
|
-
checklistByInvocationId:
|
|
2974
|
-
errorByAgentId:
|
|
2975
|
-
definitionNameByRef:
|
|
2976
|
-
onToggleAgent:
|
|
2977
|
-
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
|
|
2978
3113
|
};
|
|
2979
3114
|
return /* @__PURE__ */ l("div", { className: "agent-view-frontend agent-view", children: [
|
|
2980
|
-
|
|
2981
|
-
/* @__PURE__ */ a(
|
|
3115
|
+
I && /* @__PURE__ */ l("div", { className: "agent-view__header", children: [
|
|
3116
|
+
/* @__PURE__ */ a(Ie, { level: 1, children: "Agents" }),
|
|
2982
3117
|
/* @__PURE__ */ a(
|
|
2983
|
-
|
|
3118
|
+
ie,
|
|
2984
3119
|
{
|
|
2985
3120
|
variant: "primary",
|
|
2986
3121
|
size: "S",
|
|
2987
3122
|
iconLeftName: "sparkles",
|
|
2988
3123
|
iconLeftScreenReaderText: "Start an agent",
|
|
2989
|
-
onClick: () =>
|
|
3124
|
+
onClick: () => ae(!0),
|
|
2990
3125
|
children: "Start an agent"
|
|
2991
3126
|
}
|
|
2992
3127
|
)
|
|
2993
3128
|
] }),
|
|
2994
|
-
|
|
2995
|
-
|
|
3129
|
+
y.length > 0 && Ue && /* @__PURE__ */ l("div", { className: "agent-view__filters", children: [
|
|
3130
|
+
Fe && /* @__PURE__ */ l("div", { className: "agent-view__filter", children: [
|
|
2996
3131
|
/* @__PURE__ */ a(
|
|
2997
3132
|
"label",
|
|
2998
3133
|
{
|
|
@@ -3002,35 +3137,35 @@ const nn = (e, t) => (n) => {
|
|
|
3002
3137
|
}
|
|
3003
3138
|
),
|
|
3004
3139
|
/* @__PURE__ */ a(
|
|
3005
|
-
|
|
3140
|
+
Bt,
|
|
3006
3141
|
{
|
|
3007
3142
|
id: "agent-view-institution-filter",
|
|
3008
3143
|
triggerVariant: "button",
|
|
3009
3144
|
multiple: !0,
|
|
3010
3145
|
searchType: "substring",
|
|
3011
3146
|
placeholder: "All institutions",
|
|
3012
|
-
options:
|
|
3013
|
-
value:
|
|
3014
|
-
onValueChange:
|
|
3147
|
+
options: Q,
|
|
3148
|
+
value: he,
|
|
3149
|
+
onValueChange: ue,
|
|
3015
3150
|
showSelectionCountBadge: !0,
|
|
3016
3151
|
showClearAll: !0,
|
|
3017
3152
|
clearAllLabel: "Clear institutions"
|
|
3018
3153
|
}
|
|
3019
3154
|
)
|
|
3020
3155
|
] }),
|
|
3021
|
-
|
|
3156
|
+
qe && /* @__PURE__ */ l("div", { className: "agent-view__filter", children: [
|
|
3022
3157
|
/* @__PURE__ */ a("label", { className: "agent-view__filter-label", htmlFor: "agent-view-agent-filter", children: "Agent" }),
|
|
3023
3158
|
/* @__PURE__ */ a(
|
|
3024
|
-
|
|
3159
|
+
Bt,
|
|
3025
3160
|
{
|
|
3026
3161
|
id: "agent-view-agent-filter",
|
|
3027
3162
|
triggerVariant: "button",
|
|
3028
3163
|
multiple: !0,
|
|
3029
3164
|
searchType: "substring",
|
|
3030
3165
|
placeholder: "All agents",
|
|
3031
|
-
options:
|
|
3032
|
-
value:
|
|
3033
|
-
onValueChange:
|
|
3166
|
+
options: ke,
|
|
3167
|
+
value: pe,
|
|
3168
|
+
onValueChange: lt,
|
|
3034
3169
|
showSelectionCountBadge: !0,
|
|
3035
3170
|
showClearAll: !0,
|
|
3036
3171
|
clearAllLabel: "Clear agents"
|
|
@@ -3038,122 +3173,123 @@ const nn = (e, t) => (n) => {
|
|
|
3038
3173
|
)
|
|
3039
3174
|
] })
|
|
3040
3175
|
] }),
|
|
3041
|
-
|
|
3042
|
-
/* @__PURE__ */ a(
|
|
3043
|
-
/* @__PURE__ */ a("p", { className: "agent-view__state-message", children:
|
|
3044
|
-
/* @__PURE__ */ a(
|
|
3045
|
-
] }) :
|
|
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: [
|
|
3046
3181
|
/* @__PURE__ */ a(
|
|
3047
|
-
|
|
3182
|
+
x,
|
|
3048
3183
|
{
|
|
3049
3184
|
name: "loader",
|
|
3050
3185
|
size: 24,
|
|
3051
3186
|
color: "var(--color-brand-600)",
|
|
3052
3187
|
className: "agent-view__progress-icon--spinning",
|
|
3053
|
-
screenReaderText:
|
|
3188
|
+
screenReaderText: qt
|
|
3054
3189
|
}
|
|
3055
3190
|
),
|
|
3056
|
-
/* @__PURE__ */ a("p", { className: "agent-view__state-message", children:
|
|
3057
|
-
] }) :
|
|
3058
|
-
|
|
3059
|
-
|
|
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,
|
|
3060
3195
|
{
|
|
3061
|
-
column:
|
|
3062
|
-
agents:
|
|
3063
|
-
...
|
|
3196
|
+
column: st[_],
|
|
3197
|
+
agents: We[_] ?? [],
|
|
3198
|
+
...Ve
|
|
3064
3199
|
},
|
|
3065
|
-
|
|
3200
|
+
_
|
|
3066
3201
|
)),
|
|
3067
|
-
/* @__PURE__ */ a("div", { className: "agent-view__split-column", children:
|
|
3068
|
-
|
|
3202
|
+
/* @__PURE__ */ a("div", { className: "agent-view__split-column", children: Xn.map((_) => /* @__PURE__ */ a(
|
|
3203
|
+
sn,
|
|
3069
3204
|
{
|
|
3070
|
-
column:
|
|
3071
|
-
agents:
|
|
3205
|
+
column: st[_],
|
|
3206
|
+
agents: We[_] ?? [],
|
|
3072
3207
|
isSplit: !0,
|
|
3073
|
-
...
|
|
3208
|
+
...Ve
|
|
3074
3209
|
},
|
|
3075
|
-
|
|
3210
|
+
_
|
|
3076
3211
|
)) })
|
|
3077
3212
|
] }),
|
|
3078
|
-
|
|
3079
|
-
|
|
3213
|
+
A && /* @__PURE__ */ a(
|
|
3214
|
+
Ss,
|
|
3080
3215
|
{
|
|
3081
|
-
agent:
|
|
3082
|
-
invocationId:
|
|
3216
|
+
agent: A,
|
|
3217
|
+
invocationId: A.invocation_id,
|
|
3083
3218
|
open: !0,
|
|
3084
|
-
jwt:
|
|
3085
|
-
headers:
|
|
3219
|
+
jwt: t,
|
|
3220
|
+
headers: O,
|
|
3086
3221
|
agentUrl: r,
|
|
3087
3222
|
agentChecklistUrl: o,
|
|
3088
3223
|
agentResourcesUrl: i,
|
|
3089
|
-
agentTimelineUrl:
|
|
3090
|
-
agentChatUrl:
|
|
3091
|
-
agentConversationUrl:
|
|
3224
|
+
agentTimelineUrl: u,
|
|
3225
|
+
agentChatUrl: d,
|
|
3226
|
+
agentConversationUrl: h,
|
|
3092
3227
|
stopAgentUrl: m,
|
|
3093
3228
|
enableUpload: N,
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3229
|
+
adminMode: w,
|
|
3230
|
+
initialChecklist: se[A.invocation_id] ?? null,
|
|
3231
|
+
usePusherToRepoll: L,
|
|
3232
|
+
pusherChannelPrefix: k,
|
|
3233
|
+
subscribeToPusher: P,
|
|
3234
|
+
onClose: Pe
|
|
3099
3235
|
},
|
|
3100
|
-
|
|
3236
|
+
A.id
|
|
3101
3237
|
),
|
|
3102
3238
|
/* @__PURE__ */ a(
|
|
3103
|
-
|
|
3239
|
+
Os,
|
|
3104
3240
|
{
|
|
3105
|
-
open:
|
|
3106
|
-
onClose: () =>
|
|
3107
|
-
onStart:
|
|
3108
|
-
agentDefinitions:
|
|
3241
|
+
open: G,
|
|
3242
|
+
onClose: () => ae(!1),
|
|
3243
|
+
onStart: ct,
|
|
3244
|
+
agentDefinitions: M
|
|
3109
3245
|
}
|
|
3110
3246
|
)
|
|
3111
3247
|
] });
|
|
3112
|
-
},
|
|
3113
|
-
const n = Date.now(), s =
|
|
3248
|
+
}, Bs = (t, e) => {
|
|
3249
|
+
const n = Date.now(), s = e.trim() || t.agent_intent;
|
|
3114
3250
|
return {
|
|
3115
3251
|
id: `agent-${n}`,
|
|
3116
3252
|
invocation_id: `inv-${n}`,
|
|
3117
|
-
agent_definition_ref:
|
|
3118
|
-
agent_intent:
|
|
3253
|
+
agent_definition_ref: t.ref,
|
|
3254
|
+
agent_intent: t.agent_intent,
|
|
3119
3255
|
invocation_name: s,
|
|
3120
|
-
application_id:
|
|
3121
|
-
created_by:
|
|
3122
|
-
status:
|
|
3256
|
+
application_id: Zn,
|
|
3257
|
+
created_by: Qn,
|
|
3258
|
+
status: R["generating-a-response"],
|
|
3123
3259
|
context_ref: null,
|
|
3124
3260
|
checklist_ref: null
|
|
3125
3261
|
};
|
|
3126
3262
|
};
|
|
3127
3263
|
export {
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
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
|
|
3159
3295
|
};
|