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