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