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