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