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