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