@arbor-education/agent-view-frontend 0.8.2 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +5 -5
- package/dist/index.js +740 -738
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsxs as o, jsx as n, Fragment as ue } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as ae, useState as g, useLayoutEffect as sn, useEffect as L, useId as it, useMemo as ee, useCallback as v } from "react";
|
|
3
3
|
import ne from "classnames";
|
|
4
|
-
import { Heading as
|
|
5
|
-
import { CHAT_RESPONSE_TYPE_AGENT as
|
|
6
|
-
import
|
|
7
|
-
const
|
|
4
|
+
import { Heading as Je, Icon as x, Dot as oa, Modal as X, Button as F, Tabs as rt, SlideoverUtils as Qt, SlideoverManager as es, EditableText as ts, SelectDropdown as ns, TextInput as as, Combobox as Kn, Card as ss } from "@arbor-education/design-system.components";
|
|
5
|
+
import { CHAT_RESPONSE_TYPE_AGENT as ca, CHAT_RESPONSE_TYPE_ERROR as rs, ChatPanel as is, CHAT_RESPONSE_TYPE_USER as ls, CHAT_RESPONSE_TYPE_INFO as os, thinkingPhrasesFromToolCalls as cs } from "@arbor-education/ask-arbor-chat-panel";
|
|
6
|
+
import ds from "pusher-js";
|
|
7
|
+
const C = {
|
|
8
8
|
"generating-a-response": "generating-a-response",
|
|
9
9
|
hitl: "hitl",
|
|
10
10
|
paused: "paused",
|
|
@@ -31,9 +31,9 @@ const E = {
|
|
|
31
31
|
file: "file",
|
|
32
32
|
user_file: "user_file",
|
|
33
33
|
link: "link"
|
|
34
|
-
},
|
|
34
|
+
}, da = {
|
|
35
35
|
user_file: "user_file"
|
|
36
|
-
},
|
|
36
|
+
}, yn = {
|
|
37
37
|
active: "active",
|
|
38
38
|
complete: "complete",
|
|
39
39
|
paused: "paused"
|
|
@@ -70,9 +70,9 @@ const E = {
|
|
|
70
70
|
icon: "sparkles",
|
|
71
71
|
color: "var(--color-brand-600)"
|
|
72
72
|
}
|
|
73
|
-
},
|
|
74
|
-
[
|
|
75
|
-
status:
|
|
73
|
+
}, ua = "var(--color-grey-600)", Dt = {
|
|
74
|
+
[C["generating-a-response"]]: {
|
|
75
|
+
status: C["generating-a-response"],
|
|
76
76
|
title: "Active",
|
|
77
77
|
dotColour: "green",
|
|
78
78
|
statusIcon: {
|
|
@@ -80,8 +80,8 @@ const E = {
|
|
|
80
80
|
color: Fe["generating-a-response"].color
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
|
-
[
|
|
84
|
-
status:
|
|
83
|
+
[C.hitl]: {
|
|
84
|
+
status: C.hitl,
|
|
85
85
|
title: "Requires attention",
|
|
86
86
|
dotColour: "orange",
|
|
87
87
|
statusIcon: {
|
|
@@ -89,17 +89,17 @@ const E = {
|
|
|
89
89
|
color: Fe.hitl.color
|
|
90
90
|
}
|
|
91
91
|
},
|
|
92
|
-
[
|
|
93
|
-
status:
|
|
92
|
+
[C.paused]: {
|
|
93
|
+
status: C.paused,
|
|
94
94
|
title: "Paused",
|
|
95
95
|
dotColour: "green",
|
|
96
96
|
statusIcon: {
|
|
97
97
|
name: "circle-x",
|
|
98
|
-
color:
|
|
98
|
+
color: ua
|
|
99
99
|
}
|
|
100
100
|
},
|
|
101
|
-
[
|
|
102
|
-
status:
|
|
101
|
+
[C.complete]: {
|
|
102
|
+
status: C.complete,
|
|
103
103
|
title: "Complete",
|
|
104
104
|
dotColour: "green",
|
|
105
105
|
dotModifier: "grey-dark",
|
|
@@ -108,28 +108,28 @@ const E = {
|
|
|
108
108
|
color: Fe.complete.color
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
},
|
|
111
|
+
}, us = {
|
|
112
112
|
name: "archive",
|
|
113
|
-
color:
|
|
114
|
-
},
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
],
|
|
113
|
+
color: ua
|
|
114
|
+
}, hs = [
|
|
115
|
+
C["generating-a-response"],
|
|
116
|
+
C.hitl,
|
|
117
|
+
C.complete
|
|
118
|
+
], gs = "m4", ps = "1", ha = "msg-opening", tn = "Unable to load agent tasks. Please try again.", ms = "Unable to load context.", _s = "Unable to load the resources for this agent", fs = "Unable to load this document. Please try again.", ga = "Unable to load the timeline for this agent", vs = "Unable to pause the agent. Please try again.", Tn = "Unable to archive the agent. Please try again.", ws = "Archive this agent?", Ns = "Archiving files this agent away and stops its work. You can restore it later as paused; it will not run until you resume it. Chat is not available while it is archived. You can still open it from Archived to view the timeline and resources.", ys = "This agent is still in progress.", Sn = "Unable to unarchive the agent. Please try again.", As = "Restore this agent?", ks = "Restoring returns this agent to the board as paused. It will not run chats or scheduled work until you resume it.", bs = "Unable to delete the agent. Please try again.", Es = "You do not have permission to delete this agent.", Cs = "This agent must be paused or archived before it can be deleted.", Ts = "This agent could not be found. It may have already been deleted.", Ss = "Delete this agent?", Rs = "Deleting cannot be undone. This permanently removes the agent and its related data. It will not appear in Archived and cannot be restored.", Os = "Unable to resume the agent. Please try again.", Is = "The agent was resumed but could not be woken. Send a message to continue.", Vn = "You have been resumed after being paused. Reassess your current progress and continue your work from where you left off.", Ls = "Unable to rename the agent. Please try again.", Ps = "Something went wrong. Please try again.", pa = "Unable to load agents. Please try again.", at = "Loading tasks…", Jn = "Loading agents…", Us = "Task", Ds = {
|
|
119
119
|
[G.briefing]: "Briefing",
|
|
120
120
|
[G.running]: "Working",
|
|
121
121
|
[G.paused]: "Paused",
|
|
122
122
|
[G.complete]: "Complete"
|
|
123
123
|
}, xs = [
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
],
|
|
128
|
-
[
|
|
129
|
-
[
|
|
130
|
-
[
|
|
131
|
-
[
|
|
132
|
-
},
|
|
124
|
+
C["generating-a-response"],
|
|
125
|
+
C.hitl,
|
|
126
|
+
C.complete
|
|
127
|
+
], $s = {
|
|
128
|
+
[C["generating-a-response"]]: "Agents currently working on tasks for you.",
|
|
129
|
+
[C.hitl]: "Agents that need your input before they can continue.",
|
|
130
|
+
[C.paused]: "Agents that are paused until you resume them.",
|
|
131
|
+
[C.complete]: "Agents that have finished their work."
|
|
132
|
+
}, Ms = () => /* @__PURE__ */ o(
|
|
133
133
|
"svg",
|
|
134
134
|
{
|
|
135
135
|
className: "agent-view__empty-illustration",
|
|
@@ -243,33 +243,33 @@ const E = {
|
|
|
243
243
|
/* @__PURE__ */ n("circle", { cx: "256", cy: "70", r: "4", fill: "var(--color-grey-400)" })
|
|
244
244
|
]
|
|
245
245
|
}
|
|
246
|
-
),
|
|
247
|
-
const t =
|
|
246
|
+
), Hs = ({ status: e }) => {
|
|
247
|
+
const t = Dt[e];
|
|
248
248
|
return t.statusIcon ? /* @__PURE__ */ n(
|
|
249
|
-
|
|
249
|
+
x,
|
|
250
250
|
{
|
|
251
251
|
name: t.statusIcon.name,
|
|
252
252
|
size: 16,
|
|
253
253
|
color: t.statusIcon.color,
|
|
254
254
|
screenReaderText: t.title
|
|
255
255
|
}
|
|
256
|
-
) : /* @__PURE__ */ n(
|
|
257
|
-
},
|
|
256
|
+
) : /* @__PURE__ */ n(oa, { colour: t.dotColour, label: t.title });
|
|
257
|
+
}, Bs = () => /* @__PURE__ */ o(
|
|
258
258
|
"section",
|
|
259
259
|
{
|
|
260
260
|
className: "agent-view__empty",
|
|
261
261
|
"aria-label": "About the agents board",
|
|
262
262
|
children: [
|
|
263
263
|
/* @__PURE__ */ o("div", { className: "agent-view__empty-content", children: [
|
|
264
|
-
/* @__PURE__ */ n(
|
|
264
|
+
/* @__PURE__ */ n(Je, { level: 4, children: "Your agents board" }),
|
|
265
265
|
/* @__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." }),
|
|
266
266
|
/* @__PURE__ */ n("ul", { className: "agent-view__empty-columns", children: xs.map((e) => {
|
|
267
|
-
const t =
|
|
267
|
+
const t = Dt[e];
|
|
268
268
|
return /* @__PURE__ */ o("li", { className: "agent-view__empty-column", children: [
|
|
269
|
-
/* @__PURE__ */ n("span", { className: "agent-view__empty-column-indicator", children: /* @__PURE__ */ n(
|
|
269
|
+
/* @__PURE__ */ n("span", { className: "agent-view__empty-column-indicator", children: /* @__PURE__ */ n(Hs, { status: e }) }),
|
|
270
270
|
/* @__PURE__ */ o("span", { className: "agent-view__empty-column-text", children: [
|
|
271
271
|
/* @__PURE__ */ n("span", { className: "agent-view__empty-column-title", children: t.title }),
|
|
272
|
-
/* @__PURE__ */ n("span", { className: "agent-view__empty-column-description", children:
|
|
272
|
+
/* @__PURE__ */ n("span", { className: "agent-view__empty-column-description", children: $s[e] })
|
|
273
273
|
] })
|
|
274
274
|
] }, e);
|
|
275
275
|
}) }),
|
|
@@ -279,22 +279,22 @@ const E = {
|
|
|
279
279
|
" above to begin."
|
|
280
280
|
] })
|
|
281
281
|
] }),
|
|
282
|
-
/* @__PURE__ */ n("div", { className: "agent-view__empty-visual", children: /* @__PURE__ */ n(
|
|
282
|
+
/* @__PURE__ */ n("div", { className: "agent-view__empty-visual", children: /* @__PURE__ */ n(Ms, {}) })
|
|
283
283
|
]
|
|
284
284
|
}
|
|
285
|
-
),
|
|
285
|
+
), zs = () => ({
|
|
286
286
|
inProgress: [],
|
|
287
287
|
needsInput: [],
|
|
288
288
|
complete: [],
|
|
289
289
|
failed: [],
|
|
290
290
|
tasks: []
|
|
291
|
-
}),
|
|
291
|
+
}), Gs = (e, t) => ({
|
|
292
292
|
...e,
|
|
293
293
|
children: t.length > 0 ? t : void 0
|
|
294
|
-
}),
|
|
294
|
+
}), ma = (e) => {
|
|
295
295
|
const t = [], a = [], s = [], r = [], l = [];
|
|
296
296
|
for (const i of e) {
|
|
297
|
-
const p = i.children ?
|
|
297
|
+
const p = i.children ? ma(i.children) : zs();
|
|
298
298
|
if (t.push(...p.inProgress), a.push(...p.needsInput), s.push(...p.complete), r.push(...p.failed), i.status === B.hitl) {
|
|
299
299
|
a.push({ ...i, children: void 0 });
|
|
300
300
|
continue;
|
|
@@ -311,13 +311,13 @@ const E = {
|
|
|
311
311
|
t.push({ ...i, children: void 0 }), l.push(...p.tasks);
|
|
312
312
|
continue;
|
|
313
313
|
}
|
|
314
|
-
l.push(
|
|
314
|
+
l.push(Gs(i, p.tasks));
|
|
315
315
|
}
|
|
316
316
|
return { inProgress: t, needsInput: a, complete: s, failed: r, tasks: l };
|
|
317
|
-
}, Yn = (e) => e === B.hitl ? 0 : e === B.complete ? 1 : e === B.failed ? 2 : 3,
|
|
317
|
+
}, Yn = (e) => e === B.hitl ? 0 : e === B.complete ? 1 : e === B.failed ? 2 : 3, Fs = (e) => e.map((t, a) => ({ item: t, index: a })).sort((t, a) => {
|
|
318
318
|
const s = Yn(t.item.status) - Yn(a.item.status);
|
|
319
319
|
return s !== 0 ? s : t.index - a.index;
|
|
320
|
-
}).map(({ item: t }) => t), An = 2,
|
|
320
|
+
}).map(({ item: t }) => t), An = 2, qs = (e) => {
|
|
321
321
|
if (!e)
|
|
322
322
|
return { canScrollUp: !1, canScrollDown: !1 };
|
|
323
323
|
const t = e.scrollHeight - e.clientHeight;
|
|
@@ -325,7 +325,7 @@ const E = {
|
|
|
325
325
|
canScrollUp: e.scrollTop > An,
|
|
326
326
|
canScrollDown: e.scrollTop < t - An
|
|
327
327
|
};
|
|
328
|
-
},
|
|
328
|
+
}, Ks = (e, t) => {
|
|
329
329
|
if (!e || !t)
|
|
330
330
|
return null;
|
|
331
331
|
const a = e.getBoundingClientRect(), s = t.getBoundingClientRect();
|
|
@@ -343,60 +343,60 @@ const E = {
|
|
|
343
343
|
style: r,
|
|
344
344
|
"aria-label": l
|
|
345
345
|
}) => {
|
|
346
|
-
const i = ae(null), p = ae(null), [c, A] = g(!1), [f,
|
|
347
|
-
var
|
|
348
|
-
return s ? ((
|
|
349
|
-
},
|
|
350
|
-
const
|
|
346
|
+
const i = ae(null), p = ae(null), [c, A] = g(!1), [f, N] = g(!1), [_, y] = g(null), h = () => {
|
|
347
|
+
var D;
|
|
348
|
+
return s ? ((D = i.current) == null ? void 0 : D.querySelector(s)) ?? null : p.current;
|
|
349
|
+
}, T = () => {
|
|
350
|
+
const D = h(), k = qs(D);
|
|
351
351
|
if (A(
|
|
352
352
|
(m) => m === k.canScrollUp ? m : k.canScrollUp
|
|
353
|
-
),
|
|
353
|
+
), N(
|
|
354
354
|
(m) => m === k.canScrollDown ? m : k.canScrollDown
|
|
355
355
|
), s) {
|
|
356
|
-
const m =
|
|
357
|
-
|
|
356
|
+
const m = Ks(i.current, D);
|
|
357
|
+
y((b) => (b == null ? void 0 : b.top) === (m == null ? void 0 : m.top) && (b == null ? void 0 : b.left) === (m == null ? void 0 : m.left) && (b == null ? void 0 : b.width) === (m == null ? void 0 : m.width) && (b == null ? void 0 : b.height) === (m == null ? void 0 : m.height) ? b : m);
|
|
358
358
|
} else
|
|
359
|
-
|
|
359
|
+
y((m) => m === null ? m : null);
|
|
360
360
|
};
|
|
361
361
|
sn(() => {
|
|
362
|
-
|
|
362
|
+
T();
|
|
363
363
|
}), L(() => {
|
|
364
|
-
const
|
|
365
|
-
if (!
|
|
364
|
+
const D = i.current;
|
|
365
|
+
if (!D)
|
|
366
366
|
return;
|
|
367
367
|
let k = null, m = null;
|
|
368
368
|
const b = () => {
|
|
369
|
-
k == null || k.removeEventListener("scroll",
|
|
370
|
-
}, $ = (
|
|
371
|
-
if (
|
|
372
|
-
|
|
369
|
+
k == null || k.removeEventListener("scroll", T), m == null || m.disconnect(), m = null, k = null;
|
|
370
|
+
}, $ = (J) => {
|
|
371
|
+
if (J === k) {
|
|
372
|
+
T();
|
|
373
373
|
return;
|
|
374
374
|
}
|
|
375
|
-
if (b(), k =
|
|
376
|
-
|
|
375
|
+
if (b(), k = J, !k) {
|
|
376
|
+
T();
|
|
377
377
|
return;
|
|
378
378
|
}
|
|
379
|
-
k.addEventListener("scroll",
|
|
379
|
+
k.addEventListener("scroll", T, { passive: !0 }), m = new ResizeObserver(() => T()), m.observe(k), k.firstElementChild instanceof HTMLElement && m.observe(k.firstElementChild), T();
|
|
380
380
|
};
|
|
381
381
|
$(h());
|
|
382
382
|
const q = new MutationObserver(() => {
|
|
383
383
|
$(h());
|
|
384
384
|
});
|
|
385
|
-
return q.observe(
|
|
385
|
+
return q.observe(D, {
|
|
386
386
|
childList: !0,
|
|
387
387
|
subtree: !0,
|
|
388
388
|
characterData: !0
|
|
389
|
-
}), window.addEventListener("resize",
|
|
390
|
-
window.removeEventListener("resize",
|
|
389
|
+
}), window.addEventListener("resize", T), () => {
|
|
390
|
+
window.removeEventListener("resize", T), q.disconnect(), b();
|
|
391
391
|
};
|
|
392
392
|
}, [s]);
|
|
393
|
-
const P = (
|
|
393
|
+
const P = (D) => {
|
|
394
394
|
const k = h();
|
|
395
395
|
if (!k)
|
|
396
396
|
return;
|
|
397
397
|
const m = Math.max(k.clientHeight * 0.75, 120);
|
|
398
398
|
k.scrollBy({
|
|
399
|
-
top:
|
|
399
|
+
top: D === "up" ? -m : m,
|
|
400
400
|
behavior: "smooth"
|
|
401
401
|
});
|
|
402
402
|
}, U = /* @__PURE__ */ o(ue, { children: [
|
|
@@ -409,7 +409,7 @@ const E = {
|
|
|
409
409
|
className: "scrollable-region__edge scrollable-region__edge--top",
|
|
410
410
|
"aria-label": "Scroll up",
|
|
411
411
|
onClick: () => P("up"),
|
|
412
|
-
children: /* @__PURE__ */ n(
|
|
412
|
+
children: /* @__PURE__ */ n(x, { name: "chevron-up", size: 16, color: "currentColor" })
|
|
413
413
|
}
|
|
414
414
|
)
|
|
415
415
|
] }),
|
|
@@ -428,7 +428,7 @@ const E = {
|
|
|
428
428
|
className: "scrollable-region__edge scrollable-region__edge--bottom",
|
|
429
429
|
"aria-label": "Scroll down",
|
|
430
430
|
onClick: () => P("down"),
|
|
431
|
-
children: /* @__PURE__ */ n(
|
|
431
|
+
children: /* @__PURE__ */ n(x, { name: "chevron-down", size: 16, color: "currentColor" })
|
|
432
432
|
}
|
|
433
433
|
)
|
|
434
434
|
] })
|
|
@@ -468,7 +468,7 @@ const E = {
|
|
|
468
468
|
] })
|
|
469
469
|
}
|
|
470
470
|
);
|
|
471
|
-
},
|
|
471
|
+
}, Vs = 48, Js = ({
|
|
472
472
|
checklist: e
|
|
473
473
|
}) => {
|
|
474
474
|
const t = ae(null), a = ae(!1);
|
|
@@ -477,7 +477,7 @@ const E = {
|
|
|
477
477
|
if (!s)
|
|
478
478
|
return;
|
|
479
479
|
const r = s.scrollHeight - s.scrollTop - s.clientHeight;
|
|
480
|
-
(!a.current || r <=
|
|
480
|
+
(!a.current || r <= Vs) && (s.scrollTop = s.scrollHeight, a.current = !0);
|
|
481
481
|
}, [e]), e.length === 0 ? /* @__PURE__ */ n("p", { className: "agent-view__progress-empty", children: "No tasks to display." }) : /* @__PURE__ */ n(
|
|
482
482
|
rn,
|
|
483
483
|
{
|
|
@@ -489,7 +489,7 @@ const E = {
|
|
|
489
489
|
ref: t,
|
|
490
490
|
className: "agent-view__progress-list",
|
|
491
491
|
"aria-label": "Agent tasks",
|
|
492
|
-
children:
|
|
492
|
+
children: Fs(e).map((s) => {
|
|
493
493
|
const r = Fe[s.status];
|
|
494
494
|
return /* @__PURE__ */ o(
|
|
495
495
|
"li",
|
|
@@ -500,7 +500,7 @@ const E = {
|
|
|
500
500
|
),
|
|
501
501
|
children: [
|
|
502
502
|
/* @__PURE__ */ n(
|
|
503
|
-
|
|
503
|
+
x,
|
|
504
504
|
{
|
|
505
505
|
name: r.icon,
|
|
506
506
|
size: 16,
|
|
@@ -528,7 +528,7 @@ const E = {
|
|
|
528
528
|
)
|
|
529
529
|
}
|
|
530
530
|
);
|
|
531
|
-
},
|
|
531
|
+
}, _a = ({
|
|
532
532
|
open: e,
|
|
533
533
|
isInProgress: t,
|
|
534
534
|
isArchiving: a,
|
|
@@ -544,7 +544,7 @@ const E = {
|
|
|
544
544
|
closeHandler: r,
|
|
545
545
|
className: "archive-agent-confirm",
|
|
546
546
|
children: [
|
|
547
|
-
/* @__PURE__ */ n(X.Header, { className: "archive-agent-confirm__header", children: /* @__PURE__ */ n(X.Title, { id: i, children:
|
|
547
|
+
/* @__PURE__ */ n(X.Header, { className: "archive-agent-confirm__header", children: /* @__PURE__ */ n(X.Title, { id: i, children: ws }) }),
|
|
548
548
|
/* @__PURE__ */ o(X.Body, { className: "archive-agent-confirm__body", children: [
|
|
549
549
|
/* @__PURE__ */ o(
|
|
550
550
|
"div",
|
|
@@ -553,7 +553,7 @@ const E = {
|
|
|
553
553
|
"aria-labelledby": i,
|
|
554
554
|
"aria-describedby": p,
|
|
555
555
|
children: [
|
|
556
|
-
/* @__PURE__ */ n("p", { id: p, className: "archive-agent-confirm__lead", children:
|
|
556
|
+
/* @__PURE__ */ n("p", { id: p, className: "archive-agent-confirm__lead", children: Ns }),
|
|
557
557
|
t ? /* @__PURE__ */ n("p", { className: "archive-agent-confirm__progress", children: ys }) : null,
|
|
558
558
|
s ? /* @__PURE__ */ n("p", { className: "archive-agent-confirm__error", role: "alert", children: s }) : null
|
|
559
559
|
]
|
|
@@ -585,7 +585,7 @@ const E = {
|
|
|
585
585
|
]
|
|
586
586
|
}
|
|
587
587
|
);
|
|
588
|
-
},
|
|
588
|
+
}, fa = ({
|
|
589
589
|
open: e,
|
|
590
590
|
isDeleting: t,
|
|
591
591
|
error: a,
|
|
@@ -609,7 +609,7 @@ const E = {
|
|
|
609
609
|
"aria-labelledby": l,
|
|
610
610
|
"aria-describedby": i,
|
|
611
611
|
children: [
|
|
612
|
-
/* @__PURE__ */ n("p", { id: i, className: "archive-agent-confirm__lead", children:
|
|
612
|
+
/* @__PURE__ */ n("p", { id: i, className: "archive-agent-confirm__lead", children: Rs }),
|
|
613
613
|
a ? /* @__PURE__ */ n("p", { className: "archive-agent-confirm__error", role: "alert", children: a }) : null
|
|
614
614
|
]
|
|
615
615
|
}
|
|
@@ -640,7 +640,7 @@ const E = {
|
|
|
640
640
|
]
|
|
641
641
|
}
|
|
642
642
|
);
|
|
643
|
-
},
|
|
643
|
+
}, va = ({
|
|
644
644
|
open: e,
|
|
645
645
|
isUnarchiving: t,
|
|
646
646
|
error: a,
|
|
@@ -655,7 +655,7 @@ const E = {
|
|
|
655
655
|
closeHandler: s,
|
|
656
656
|
className: "archive-agent-confirm",
|
|
657
657
|
children: [
|
|
658
|
-
/* @__PURE__ */ n(X.Header, { className: "archive-agent-confirm__header", children: /* @__PURE__ */ n(X.Title, { id: l, children:
|
|
658
|
+
/* @__PURE__ */ n(X.Header, { className: "archive-agent-confirm__header", children: /* @__PURE__ */ n(X.Title, { id: l, children: As }) }),
|
|
659
659
|
/* @__PURE__ */ o(X.Body, { className: "archive-agent-confirm__body", children: [
|
|
660
660
|
/* @__PURE__ */ o(
|
|
661
661
|
"div",
|
|
@@ -664,7 +664,7 @@ const E = {
|
|
|
664
664
|
"aria-labelledby": l,
|
|
665
665
|
"aria-describedby": i,
|
|
666
666
|
children: [
|
|
667
|
-
/* @__PURE__ */ n("p", { id: i, className: "archive-agent-confirm__lead", children:
|
|
667
|
+
/* @__PURE__ */ n("p", { id: i, className: "archive-agent-confirm__lead", children: ks }),
|
|
668
668
|
a ? /* @__PURE__ */ n("p", { className: "archive-agent-confirm__error", role: "alert", children: a }) : null
|
|
669
669
|
]
|
|
670
670
|
}
|
|
@@ -695,7 +695,7 @@ const E = {
|
|
|
695
695
|
]
|
|
696
696
|
}
|
|
697
697
|
);
|
|
698
|
-
},
|
|
698
|
+
}, Ys = (e) => e !== void 0 && e.some((t) => t.status === B.hitl), wa = (e) => e !== void 0 && e.length > 0 && e.every((t) => t.status === B.complete), kn = (e, t) => e.status === C.paused ? wa(t) ? C.complete : C["generating-a-response"] : Ys(t) ? C.hitl : e.status === C.complete ? C.complete : e.status === C.hitl ? C.hitl : C["generating-a-response"], js = ({
|
|
699
699
|
prompts: e,
|
|
700
700
|
classNamePrefix: t = "agent-workspace",
|
|
701
701
|
onSelect: a
|
|
@@ -742,14 +742,14 @@ class Ws {
|
|
|
742
742
|
return this.onTurn(r), {
|
|
743
743
|
id: r.message.id,
|
|
744
744
|
text: r.message.text,
|
|
745
|
-
type:
|
|
745
|
+
type: ca,
|
|
746
746
|
...r.message.followUpPrompts ? { followUpPrompts: r.message.followUpPrompts } : {}
|
|
747
747
|
};
|
|
748
748
|
} catch {
|
|
749
749
|
return {
|
|
750
750
|
id: `error-${Date.now()}`,
|
|
751
|
-
text:
|
|
752
|
-
type:
|
|
751
|
+
text: Ps,
|
|
752
|
+
type: rs
|
|
753
753
|
};
|
|
754
754
|
} finally {
|
|
755
755
|
(s = this.onAwaitingChange) == null || s.call(this, !1);
|
|
@@ -767,7 +767,7 @@ class Ws {
|
|
|
767
767
|
return !1;
|
|
768
768
|
}
|
|
769
769
|
}
|
|
770
|
-
const
|
|
770
|
+
const Xs = ({
|
|
771
771
|
connector: e,
|
|
772
772
|
phase: t,
|
|
773
773
|
chatHistory: a,
|
|
@@ -780,14 +780,14 @@ const js = ({
|
|
|
780
780
|
onClarificationPrompt: A,
|
|
781
781
|
onDismissClarification: f
|
|
782
782
|
}) => {
|
|
783
|
-
const
|
|
783
|
+
const N = ee(
|
|
784
784
|
() => new Ws(e, {
|
|
785
785
|
canSend: () => t === G.running,
|
|
786
786
|
onTurn: p,
|
|
787
787
|
onAwaitingChange: c
|
|
788
788
|
}),
|
|
789
789
|
[e, t, p, c]
|
|
790
|
-
), _ = t !== G.running,
|
|
790
|
+
), _ = t !== G.running, y = t === G.running;
|
|
791
791
|
return /* @__PURE__ */ o("section", { className: "agent-workspace__chat-body", "aria-label": "Chat", children: [
|
|
792
792
|
l && /* @__PURE__ */ o(
|
|
793
793
|
"div",
|
|
@@ -798,7 +798,7 @@ const js = ({
|
|
|
798
798
|
children: [
|
|
799
799
|
/* @__PURE__ */ n("p", { className: "agent-workspace__clarification-text", children: l.text }),
|
|
800
800
|
l.followUpPrompts && /* @__PURE__ */ n(
|
|
801
|
-
|
|
801
|
+
js,
|
|
802
802
|
{
|
|
803
803
|
prompts: l.followUpPrompts,
|
|
804
804
|
onSelect: A
|
|
@@ -817,34 +817,34 @@ const js = ({
|
|
|
817
817
|
}
|
|
818
818
|
),
|
|
819
819
|
/* @__PURE__ */ n("div", { className: "agent-workspace__ask-arbor", children: /* @__PURE__ */ n(rn, { scrollSelector: ".chat-panel-message-list", children: /* @__PURE__ */ n(
|
|
820
|
-
|
|
820
|
+
is,
|
|
821
821
|
{
|
|
822
|
-
connector:
|
|
822
|
+
connector: N,
|
|
823
823
|
chatHistory: a,
|
|
824
824
|
startQuery: r,
|
|
825
825
|
lockConversation: _,
|
|
826
826
|
enableUpload: i,
|
|
827
|
-
speechEnabled:
|
|
827
|
+
speechEnabled: y,
|
|
828
828
|
speechLanguage: "en-GB",
|
|
829
829
|
speechSubmissionDelay: 1e3,
|
|
830
830
|
slashMenuItems: [],
|
|
831
831
|
menuContent: [],
|
|
832
832
|
introHeading: "Message your agent",
|
|
833
833
|
introBody: "Ask questions, share trip details, or paste a link. The agent will update the checklist as it works.",
|
|
834
|
-
placeholder:
|
|
834
|
+
placeholder: y ? "Message the agent, paste a link, or attach a file…" : "The agent is not accepting messages."
|
|
835
835
|
},
|
|
836
836
|
s
|
|
837
837
|
) }) }),
|
|
838
838
|
t === G.paused && /* @__PURE__ */ o("div", { className: "agent-workspace__notice", role: "status", children: [
|
|
839
|
-
/* @__PURE__ */ n(
|
|
839
|
+
/* @__PURE__ */ n(x, { name: "circle-alert", size: 16, color: "var(--color-semantic-warning-600)" }),
|
|
840
840
|
/* @__PURE__ */ n("span", { children: "The agent is paused. Its progress is saved in the checklist." })
|
|
841
841
|
] }),
|
|
842
842
|
t === G.complete && /* @__PURE__ */ o("div", { className: "agent-workspace__notice", role: "status", children: [
|
|
843
|
-
/* @__PURE__ */ n(
|
|
843
|
+
/* @__PURE__ */ n(x, { name: "party-popper", size: 16, color: "var(--color-semantic-success-600)" }),
|
|
844
844
|
/* @__PURE__ */ n("span", { children: "The agent has finished." })
|
|
845
845
|
] })
|
|
846
846
|
] });
|
|
847
|
-
},
|
|
847
|
+
}, Na = ({
|
|
848
848
|
item: e,
|
|
849
849
|
depth: t,
|
|
850
850
|
canRequestInput: a,
|
|
@@ -852,7 +852,7 @@ const js = ({
|
|
|
852
852
|
}) => {
|
|
853
853
|
const r = Fe[e.status], l = e.status.replace(/_/g, "-"), i = e.status === B.hitl && a && s, p = /* @__PURE__ */ o("div", { className: "agent-workspace__task-row", children: [
|
|
854
854
|
/* @__PURE__ */ n(
|
|
855
|
-
|
|
855
|
+
x,
|
|
856
856
|
{
|
|
857
857
|
name: r.icon,
|
|
858
858
|
size: 16,
|
|
@@ -884,7 +884,7 @@ const js = ({
|
|
|
884
884
|
}
|
|
885
885
|
) : p,
|
|
886
886
|
e.children && e.children.length > 0 && /* @__PURE__ */ n("ul", { className: "agent-workspace__task-children", children: e.children.map((c) => /* @__PURE__ */ n(
|
|
887
|
-
|
|
887
|
+
Na,
|
|
888
888
|
{
|
|
889
889
|
item: c,
|
|
890
890
|
depth: t + 1,
|
|
@@ -902,7 +902,7 @@ const js = ({
|
|
|
902
902
|
canRequestInput: a,
|
|
903
903
|
onAttentionItemClick: s
|
|
904
904
|
}) => /* @__PURE__ */ n("ul", { className: "agent-workspace__task-list", "aria-label": t, children: e.map((r) => /* @__PURE__ */ n(
|
|
905
|
-
|
|
905
|
+
Na,
|
|
906
906
|
{
|
|
907
907
|
item: r,
|
|
908
908
|
depth: 0,
|
|
@@ -910,7 +910,7 @@ const js = ({
|
|
|
910
910
|
onAttentionItemClick: s
|
|
911
911
|
},
|
|
912
912
|
r.task
|
|
913
|
-
)) }),
|
|
913
|
+
)) }), Zs = ({
|
|
914
914
|
checklist: e,
|
|
915
915
|
isLoading: t,
|
|
916
916
|
error: a,
|
|
@@ -922,13 +922,13 @@ const js = ({
|
|
|
922
922
|
contextLoaded: c = !1,
|
|
923
923
|
contextLoading: A = !1,
|
|
924
924
|
contextError: f = null,
|
|
925
|
-
onContextSelect:
|
|
925
|
+
onContextSelect: N
|
|
926
926
|
}) => {
|
|
927
|
-
const [_,
|
|
928
|
-
() => e ?
|
|
927
|
+
const [_, y] = g("checklist"), h = ee(
|
|
928
|
+
() => e ? ma(e) : null,
|
|
929
929
|
[e]
|
|
930
|
-
),
|
|
931
|
-
|
|
930
|
+
), T = () => {
|
|
931
|
+
y("context"), N == null || N();
|
|
932
932
|
};
|
|
933
933
|
return /* @__PURE__ */ o(
|
|
934
934
|
"section",
|
|
@@ -943,7 +943,7 @@ const js = ({
|
|
|
943
943
|
active: _ === "checklist",
|
|
944
944
|
tabElementProps: {
|
|
945
945
|
id: "agent-checklist-tab-checklist",
|
|
946
|
-
onClick: () =>
|
|
946
|
+
onClick: () => y("checklist")
|
|
947
947
|
},
|
|
948
948
|
children: "Checklist"
|
|
949
949
|
}
|
|
@@ -954,16 +954,16 @@ const js = ({
|
|
|
954
954
|
active: _ === "context",
|
|
955
955
|
tabElementProps: {
|
|
956
956
|
id: "agent-checklist-tab-context",
|
|
957
|
-
onClick:
|
|
957
|
+
onClick: T
|
|
958
958
|
},
|
|
959
959
|
children: "Context"
|
|
960
960
|
}
|
|
961
961
|
)
|
|
962
|
-
] }) : /* @__PURE__ */ n(
|
|
962
|
+
] }) : /* @__PURE__ */ n(Je, { level: 4, children: "Checklist" }) }),
|
|
963
963
|
/* @__PURE__ */ n("div", { className: "agent-workspace__panel-body", "aria-live": "polite", children: /* @__PURE__ */ n(rn, { children: _ === "context" ? /* @__PURE__ */ o(ue, { children: [
|
|
964
964
|
A && /* @__PURE__ */ o("div", { className: "agent-workspace__loading", children: [
|
|
965
965
|
/* @__PURE__ */ n(
|
|
966
|
-
|
|
966
|
+
x,
|
|
967
967
|
{
|
|
968
968
|
name: "loader",
|
|
969
969
|
size: 16,
|
|
@@ -980,7 +980,7 @@ const js = ({
|
|
|
980
980
|
] }) : /* @__PURE__ */ o(ue, { children: [
|
|
981
981
|
t && /* @__PURE__ */ o("div", { className: "agent-workspace__loading", children: [
|
|
982
982
|
/* @__PURE__ */ n(
|
|
983
|
-
|
|
983
|
+
x,
|
|
984
984
|
{
|
|
985
985
|
name: "loader",
|
|
986
986
|
size: 16,
|
|
@@ -1091,7 +1091,7 @@ const js = ({
|
|
|
1091
1091
|
]
|
|
1092
1092
|
}
|
|
1093
1093
|
);
|
|
1094
|
-
},
|
|
1094
|
+
}, Qs = ({
|
|
1095
1095
|
resource: e,
|
|
1096
1096
|
html: t,
|
|
1097
1097
|
isLoading: a,
|
|
@@ -1121,7 +1121,7 @@ const js = ({
|
|
|
1121
1121
|
children: /* @__PURE__ */ o("div", { className: "resource-preview-slideover__body", children: [
|
|
1122
1122
|
a && /* @__PURE__ */ o("div", { className: "resource-preview-slideover__status", children: [
|
|
1123
1123
|
/* @__PURE__ */ n(
|
|
1124
|
-
|
|
1124
|
+
x,
|
|
1125
1125
|
{
|
|
1126
1126
|
name: "loader",
|
|
1127
1127
|
size: 16,
|
|
@@ -1145,8 +1145,8 @@ const js = ({
|
|
|
1145
1145
|
] })
|
|
1146
1146
|
}
|
|
1147
1147
|
] : [], [e, t, a, s]);
|
|
1148
|
-
return /* @__PURE__ */ n("div", { className: "resource-preview-slideover", children: /* @__PURE__ */ n(
|
|
1149
|
-
},
|
|
1148
|
+
return /* @__PURE__ */ n("div", { className: "resource-preview-slideover", children: /* @__PURE__ */ n(es, { slideovers: l }) });
|
|
1149
|
+
}, er = {
|
|
1150
1150
|
[Oe.mis_record]: {
|
|
1151
1151
|
icon: "table",
|
|
1152
1152
|
label: "Arbor MIS",
|
|
@@ -1177,7 +1177,7 @@ const js = ({
|
|
|
1177
1177
|
label: "Link",
|
|
1178
1178
|
color: "var(--color-semantic-info-700)"
|
|
1179
1179
|
}
|
|
1180
|
-
},
|
|
1180
|
+
}, tr = ({
|
|
1181
1181
|
resources: e,
|
|
1182
1182
|
isLoading: t = !1,
|
|
1183
1183
|
error: a = null,
|
|
@@ -1189,13 +1189,13 @@ const js = ({
|
|
|
1189
1189
|
"aria-label": "Resources",
|
|
1190
1190
|
children: [
|
|
1191
1191
|
/* @__PURE__ */ o("div", { className: "agent-workspace__panel-header", children: [
|
|
1192
|
-
/* @__PURE__ */ n(
|
|
1192
|
+
/* @__PURE__ */ n(Je, { level: 4, children: "Resources" }),
|
|
1193
1193
|
/* @__PURE__ */ n("span", { className: "agent-workspace__panel-count", children: e.length })
|
|
1194
1194
|
] }),
|
|
1195
1195
|
/* @__PURE__ */ n("div", { className: "agent-workspace__panel-body", "aria-live": "polite", children: /* @__PURE__ */ o(rn, { children: [
|
|
1196
1196
|
t && /* @__PURE__ */ o("div", { className: "agent-workspace__loading", children: [
|
|
1197
1197
|
/* @__PURE__ */ n(
|
|
1198
|
-
|
|
1198
|
+
x,
|
|
1199
1199
|
{
|
|
1200
1200
|
name: "loader",
|
|
1201
1201
|
size: 16,
|
|
@@ -1208,7 +1208,7 @@ const js = ({
|
|
|
1208
1208
|
] }),
|
|
1209
1209
|
!t && a && /* @__PURE__ */ n("p", { className: "agent-workspace__error", role: "alert", children: a }),
|
|
1210
1210
|
!t && !a && e.length > 0 && /* @__PURE__ */ n("ul", { className: "agent-workspace__resource-list", "aria-label": "Agent resources", children: e.map((r) => {
|
|
1211
|
-
const l =
|
|
1211
|
+
const l = er[r.type], i = r.misRecordUrl;
|
|
1212
1212
|
return /* @__PURE__ */ n("li", { className: "agent-workspace__resource", children: i ? /* @__PURE__ */ n(
|
|
1213
1213
|
"a",
|
|
1214
1214
|
{
|
|
@@ -1219,7 +1219,7 @@ const js = ({
|
|
|
1219
1219
|
onClick: (p) => {
|
|
1220
1220
|
p.preventDefault(), s(r);
|
|
1221
1221
|
},
|
|
1222
|
-
children: /* @__PURE__ */ n(
|
|
1222
|
+
children: /* @__PURE__ */ n(jn, { resource: r, config: l, external: !0 })
|
|
1223
1223
|
}
|
|
1224
1224
|
) : /* @__PURE__ */ n(
|
|
1225
1225
|
"button",
|
|
@@ -1227,7 +1227,7 @@ const js = ({
|
|
|
1227
1227
|
type: "button",
|
|
1228
1228
|
className: "agent-workspace__resource-card",
|
|
1229
1229
|
onClick: () => s(r),
|
|
1230
|
-
children: /* @__PURE__ */ n(
|
|
1230
|
+
children: /* @__PURE__ */ n(jn, { resource: r, config: l })
|
|
1231
1231
|
}
|
|
1232
1232
|
) }, r.id);
|
|
1233
1233
|
}) }),
|
|
@@ -1235,12 +1235,12 @@ const js = ({
|
|
|
1235
1235
|
] }) })
|
|
1236
1236
|
]
|
|
1237
1237
|
}
|
|
1238
|
-
),
|
|
1238
|
+
), jn = ({ resource: e, config: t, external: a = !1 }) => /* @__PURE__ */ o(ue, { children: [
|
|
1239
1239
|
/* @__PURE__ */ n(
|
|
1240
1240
|
"span",
|
|
1241
1241
|
{
|
|
1242
1242
|
className: `agent-workspace__resource-icon agent-workspace__resource-icon--${e.type}`,
|
|
1243
|
-
children: /* @__PURE__ */ n(
|
|
1243
|
+
children: /* @__PURE__ */ n(x, { name: t.icon, size: 16, color: t.color, screenReaderText: `${t.label}:` })
|
|
1244
1244
|
}
|
|
1245
1245
|
),
|
|
1246
1246
|
/* @__PURE__ */ n("span", { className: "agent-workspace__resource-content", children: /* @__PURE__ */ o("span", { className: "agent-workspace__resource-top", children: [
|
|
@@ -1248,7 +1248,7 @@ const js = ({
|
|
|
1248
1248
|
/* @__PURE__ */ n("span", { className: `agent-workspace__resource-badge agent-workspace__resource-badge--${e.type}`, children: t.label })
|
|
1249
1249
|
] }) }),
|
|
1250
1250
|
a && /* @__PURE__ */ n(
|
|
1251
|
-
|
|
1251
|
+
x,
|
|
1252
1252
|
{
|
|
1253
1253
|
name: "external-link",
|
|
1254
1254
|
size: 12,
|
|
@@ -1260,16 +1260,16 @@ const js = ({
|
|
|
1260
1260
|
] }), bn = (e) => {
|
|
1261
1261
|
const t = Date.parse(e);
|
|
1262
1262
|
return Number.isFinite(t) ? t : 0;
|
|
1263
|
-
},
|
|
1263
|
+
}, nr = new Intl.DateTimeFormat("en-GB", {
|
|
1264
1264
|
day: "numeric",
|
|
1265
1265
|
month: "long",
|
|
1266
1266
|
year: "numeric",
|
|
1267
1267
|
hour: "numeric",
|
|
1268
1268
|
minute: "2-digit"
|
|
1269
|
-
}),
|
|
1269
|
+
}), En = (e) => {
|
|
1270
1270
|
const t = new Date(e);
|
|
1271
|
-
return Number.isFinite(t.getTime()) ?
|
|
1272
|
-
},
|
|
1271
|
+
return Number.isFinite(t.getTime()) ? nr.format(t) : e;
|
|
1272
|
+
}, Wn = (e) => e.replace(
|
|
1273
1273
|
/[A-Za-z0-9]+(?:[_-][A-Za-z0-9]+)+/g,
|
|
1274
1274
|
(t) => t.split(/[_-]/).map((a) => a.charAt(0).toUpperCase() + a.slice(1).toLowerCase()).join(" ")
|
|
1275
1275
|
), Xn = (e) => {
|
|
@@ -1278,7 +1278,7 @@ const js = ({
|
|
|
1278
1278
|
(s) => s.split(/[_-]/).map((r) => r.toLowerCase()).join(" ")
|
|
1279
1279
|
).toLowerCase();
|
|
1280
1280
|
return a && a.charAt(0).toUpperCase() + a.slice(1);
|
|
1281
|
-
},
|
|
1281
|
+
}, ar = 60 * 60 * 1e3, ya = 60 * 60 * 1e3, Ut = 24 * ya, Rn = 7 * Ut, sr = (e) => e.type !== "message-sent", rr = (e) => {
|
|
1282
1282
|
if (e == null || e <= 0)
|
|
1283
1283
|
return null;
|
|
1284
1284
|
if (e % 86400 === 0) {
|
|
@@ -1295,13 +1295,13 @@ const js = ({
|
|
|
1295
1295
|
}
|
|
1296
1296
|
const t = Math.max(1, Math.round(e / 60));
|
|
1297
1297
|
return t === 1 ? "every minute" : `every ${t} minutes`;
|
|
1298
|
-
},
|
|
1298
|
+
}, ir = (e) => {
|
|
1299
1299
|
if (e.recurrence === "one_off")
|
|
1300
1300
|
return "Scheduled to run once";
|
|
1301
|
-
const t =
|
|
1301
|
+
const t = rr(e.repeatIntervalSeconds);
|
|
1302
1302
|
return t ? `Repeating ${t}` : "Repeating run scheduled";
|
|
1303
|
-
},
|
|
1304
|
-
const s = e.filter(
|
|
1303
|
+
}, lr = (e) => e.recurrence === "one_off" ? "scheduled-one-off" : "scheduled-repeating", or = (e, t, a = []) => {
|
|
1304
|
+
const s = e.filter(sr).map((i, p) => ({
|
|
1305
1305
|
kind: "action",
|
|
1306
1306
|
id: `action-${i.timestamp}-${p}`,
|
|
1307
1307
|
timestampMs: bn(i.timestamp),
|
|
@@ -1320,7 +1320,7 @@ const js = ({
|
|
|
1320
1320
|
return [...s, ...r, ...l].sort(
|
|
1321
1321
|
(i, p) => i.timestampMs - p.timestampMs || i.id.localeCompare(p.id)
|
|
1322
1322
|
);
|
|
1323
|
-
},
|
|
1323
|
+
}, cr = (e) => e >= Rn ? "weeks" : e >= Ut ? "days" : "hours", dr = (e) => {
|
|
1324
1324
|
if (e < Ut) {
|
|
1325
1325
|
const s = Math.max(1, Math.round(e / ya));
|
|
1326
1326
|
return s === 1 ? "1 hour later" : `${s} hours later`;
|
|
@@ -1334,7 +1334,7 @@ const js = ({
|
|
|
1334
1334
|
return t === 1 ? "1 week later" : `${t} weeks later`;
|
|
1335
1335
|
const a = Math.max(1, Math.round(e / (30 * Ut)));
|
|
1336
1336
|
return a === 1 ? "1 month later" : `${a} months later`;
|
|
1337
|
-
},
|
|
1337
|
+
}, ur = (e, t = ar) => {
|
|
1338
1338
|
if (e.length === 0)
|
|
1339
1339
|
return [];
|
|
1340
1340
|
const a = [e[0]];
|
|
@@ -1344,25 +1344,25 @@ const js = ({
|
|
|
1344
1344
|
kind: "gap",
|
|
1345
1345
|
id: `gap-${r.id}-${l.id}`,
|
|
1346
1346
|
durationMs: i,
|
|
1347
|
-
label:
|
|
1348
|
-
size:
|
|
1347
|
+
label: dr(i),
|
|
1348
|
+
size: cr(i)
|
|
1349
1349
|
}), a.push(l);
|
|
1350
1350
|
}
|
|
1351
1351
|
return a;
|
|
1352
|
-
},
|
|
1352
|
+
}, hr = (e) => e.type === "checklist-updated" ? "checklist" : e.type === "status-transition" ? "status" : "note", gr = ({
|
|
1353
1353
|
timeline: e,
|
|
1354
1354
|
isLoading: t,
|
|
1355
1355
|
error: a,
|
|
1356
1356
|
onOpenChatSession: s
|
|
1357
1357
|
}) => {
|
|
1358
|
-
const r = (e == null ? void 0 : e.actionLog) ?? [], l = (e == null ? void 0 : e.chatSessions) ?? [], i = (e == null ? void 0 : e.scheduledRuns) ?? [], p =
|
|
1358
|
+
const r = (e == null ? void 0 : e.actionLog) ?? [], l = (e == null ? void 0 : e.chatSessions) ?? [], i = (e == null ? void 0 : e.scheduledRuns) ?? [], p = or(
|
|
1359
1359
|
r,
|
|
1360
1360
|
l,
|
|
1361
1361
|
i
|
|
1362
|
-
), c =
|
|
1362
|
+
), c = ur(p), A = !t && !a && p.length === 0;
|
|
1363
1363
|
return /* @__PURE__ */ o("section", { className: "agent-workspace__timeline", "aria-label": "Agent timeline", children: [
|
|
1364
1364
|
t && /* @__PURE__ */ n("p", { className: "agent-workspace__timeline-status", role: "status", children: "Loading timeline…" }),
|
|
1365
|
-
a && /* @__PURE__ */ n("p", { className: "agent-workspace__timeline-status", role: "alert", children: a ||
|
|
1365
|
+
a && /* @__PURE__ */ n("p", { className: "agent-workspace__timeline-status", role: "alert", children: a || ga }),
|
|
1366
1366
|
A && /* @__PURE__ */ n("p", { className: "agent-workspace__timeline-status", role: "status", children: "No timeline activity yet." }),
|
|
1367
1367
|
!t && !a && !A && /* @__PURE__ */ o("div", { className: "agent-timeline", children: [
|
|
1368
1368
|
/* @__PURE__ */ n("div", { className: "agent-timeline__track", "aria-hidden": "true" }),
|
|
@@ -1372,7 +1372,7 @@ const js = ({
|
|
|
1372
1372
|
{
|
|
1373
1373
|
className: "agent-timeline__station-node agent-timeline__station-node--terminus",
|
|
1374
1374
|
"aria-hidden": "true",
|
|
1375
|
-
children: /* @__PURE__ */ n(
|
|
1375
|
+
children: /* @__PURE__ */ n(x, { name: "arrow-right-from-line", size: 16, color: "currentColor" })
|
|
1376
1376
|
}
|
|
1377
1377
|
) }),
|
|
1378
1378
|
/* @__PURE__ */ n("div", { className: "agent-timeline__label", children: /* @__PURE__ */ n("strong", { className: "agent-timeline__label-type", children: "Start" }) })
|
|
@@ -1393,14 +1393,14 @@ const js = ({
|
|
|
1393
1393
|
f.id
|
|
1394
1394
|
);
|
|
1395
1395
|
if (f.kind === "chat") {
|
|
1396
|
-
const
|
|
1396
|
+
const T = En(f.session.timestamp), P = /* @__PURE__ */ n(x, { name: "sparkles", size: 16, color: "currentColor" });
|
|
1397
1397
|
return /* @__PURE__ */ o("div", { className: "agent-timeline__chat-station", children: [
|
|
1398
1398
|
s ? /* @__PURE__ */ n(
|
|
1399
1399
|
"button",
|
|
1400
1400
|
{
|
|
1401
1401
|
type: "button",
|
|
1402
1402
|
className: "agent-timeline__chat-node",
|
|
1403
|
-
"aria-label": `Open chat session from ${
|
|
1403
|
+
"aria-label": `Open chat session from ${T}`,
|
|
1404
1404
|
onClick: () => s(f.session.sessionId),
|
|
1405
1405
|
children: P
|
|
1406
1406
|
}
|
|
@@ -1414,36 +1414,36 @@ const js = ({
|
|
|
1414
1414
|
),
|
|
1415
1415
|
/* @__PURE__ */ o("div", { className: "agent-timeline__label", children: [
|
|
1416
1416
|
/* @__PURE__ */ n("strong", { className: "agent-timeline__label-type", children: "Chat session" }),
|
|
1417
|
-
/* @__PURE__ */ n("span", { className: "agent-timeline__label-time", children:
|
|
1417
|
+
/* @__PURE__ */ n("span", { className: "agent-timeline__label-time", children: T })
|
|
1418
1418
|
] })
|
|
1419
1419
|
] }, f.id);
|
|
1420
1420
|
}
|
|
1421
1421
|
if (f.kind === "scheduled") {
|
|
1422
|
-
const
|
|
1422
|
+
const T = lr(f.run), P = f.run.recurrence === "one_off" ? "One-off run" : "Repeating run";
|
|
1423
1423
|
return /* @__PURE__ */ o(
|
|
1424
1424
|
"div",
|
|
1425
1425
|
{
|
|
1426
|
-
className: `agent-timeline__station agent-timeline__station--${
|
|
1426
|
+
className: `agent-timeline__station agent-timeline__station--${T}`,
|
|
1427
1427
|
children: [
|
|
1428
1428
|
/* @__PURE__ */ n("span", { className: "agent-timeline__station-rail", children: /* @__PURE__ */ n(
|
|
1429
1429
|
"span",
|
|
1430
1430
|
{
|
|
1431
|
-
className: `agent-timeline__station-node agent-timeline__station-node--${
|
|
1431
|
+
className: `agent-timeline__station-node agent-timeline__station-node--${T}`,
|
|
1432
1432
|
"aria-hidden": "true",
|
|
1433
|
-
children: /* @__PURE__ */ n(
|
|
1433
|
+
children: /* @__PURE__ */ n(x, { name: "date", size: 16, color: "currentColor" })
|
|
1434
1434
|
}
|
|
1435
1435
|
) }),
|
|
1436
1436
|
/* @__PURE__ */ o("div", { className: "agent-timeline__label", children: [
|
|
1437
1437
|
/* @__PURE__ */ n("strong", { className: "agent-timeline__label-type", children: P }),
|
|
1438
|
-
/* @__PURE__ */ n("span", { className: "agent-timeline__label-entry", children:
|
|
1439
|
-
/* @__PURE__ */ n("span", { className: "agent-timeline__label-time", children:
|
|
1438
|
+
/* @__PURE__ */ n("span", { className: "agent-timeline__label-entry", children: ir(f.run) }),
|
|
1439
|
+
/* @__PURE__ */ n("span", { className: "agent-timeline__label-time", children: En(f.run.dueAt) })
|
|
1440
1440
|
] })
|
|
1441
1441
|
]
|
|
1442
1442
|
},
|
|
1443
1443
|
f.id
|
|
1444
1444
|
);
|
|
1445
1445
|
}
|
|
1446
|
-
const { item:
|
|
1446
|
+
const { item: N } = f, _ = hr(N), y = _ === "checklist", h = _ === "status";
|
|
1447
1447
|
return /* @__PURE__ */ o(
|
|
1448
1448
|
"div",
|
|
1449
1449
|
{
|
|
@@ -1454,17 +1454,17 @@ const js = ({
|
|
|
1454
1454
|
{
|
|
1455
1455
|
type: "button",
|
|
1456
1456
|
className: `agent-timeline__station-node agent-timeline__station-node--${_}`,
|
|
1457
|
-
"aria-label": `${
|
|
1457
|
+
"aria-label": `${Wn(N.type)}: ${Xn(N.entry)}`,
|
|
1458
1458
|
children: [
|
|
1459
|
-
|
|
1460
|
-
h && /* @__PURE__ */ n(
|
|
1459
|
+
y && /* @__PURE__ */ n(x, { name: "check-solid", size: 16, color: "currentColor" }),
|
|
1460
|
+
h && /* @__PURE__ */ n(x, { name: "iteration-ccw", size: 16, color: "currentColor" })
|
|
1461
1461
|
]
|
|
1462
1462
|
}
|
|
1463
1463
|
) }),
|
|
1464
1464
|
/* @__PURE__ */ o("div", { className: "agent-timeline__label", children: [
|
|
1465
|
-
/* @__PURE__ */ n("strong", { className: "agent-timeline__label-type", children:
|
|
1466
|
-
/* @__PURE__ */ n("span", { className: "agent-timeline__label-entry", children: Xn(
|
|
1467
|
-
/* @__PURE__ */ n("span", { className: "agent-timeline__label-time", children:
|
|
1465
|
+
/* @__PURE__ */ n("strong", { className: "agent-timeline__label-type", children: Wn(N.type) }),
|
|
1466
|
+
/* @__PURE__ */ n("span", { className: "agent-timeline__label-entry", children: Xn(N.entry) }),
|
|
1467
|
+
/* @__PURE__ */ n("span", { className: "agent-timeline__label-time", children: En(N.timestamp) })
|
|
1468
1468
|
] })
|
|
1469
1469
|
]
|
|
1470
1470
|
},
|
|
@@ -1477,37 +1477,37 @@ const js = ({
|
|
|
1477
1477
|
{
|
|
1478
1478
|
className: "agent-timeline__station-node agent-timeline__station-node--terminus",
|
|
1479
1479
|
"aria-hidden": "true",
|
|
1480
|
-
children: /* @__PURE__ */ n(
|
|
1480
|
+
children: /* @__PURE__ */ n(x, { name: "flag", size: 16, color: "currentColor" })
|
|
1481
1481
|
}
|
|
1482
1482
|
) }),
|
|
1483
1483
|
/* @__PURE__ */ n("div", { className: "agent-timeline__label", children: /* @__PURE__ */ n("strong", { className: "agent-timeline__label-type", children: "Finish" }) })
|
|
1484
1484
|
] })
|
|
1485
1485
|
] })
|
|
1486
1486
|
] });
|
|
1487
|
-
},
|
|
1487
|
+
}, pr = [
|
|
1488
1488
|
"I'll get the details and come back to you",
|
|
1489
1489
|
"Skip this for now"
|
|
1490
|
-
],
|
|
1490
|
+
], mr = (e) => {
|
|
1491
1491
|
var a;
|
|
1492
1492
|
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?`;
|
|
1493
1493
|
return {
|
|
1494
1494
|
id: `clarification-${Date.now()}`,
|
|
1495
1495
|
author: he.agent,
|
|
1496
1496
|
text: t,
|
|
1497
|
-
followUpPrompts: e.clarificationPrompts ??
|
|
1497
|
+
followUpPrompts: e.clarificationPrompts ?? pr
|
|
1498
1498
|
};
|
|
1499
|
-
},
|
|
1499
|
+
}, _r = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """), fr = (e) => e.kind === da.user_file ? `<strong>${_r(e.text)}</strong>` : e.text, Re = (e) => ({
|
|
1500
1500
|
id: e.id,
|
|
1501
|
-
text:
|
|
1502
|
-
type: e.author === he.user ?
|
|
1501
|
+
text: fr(e),
|
|
1502
|
+
type: e.author === he.user ? ls : e.author === he.system ? os : ca,
|
|
1503
1503
|
...e.followUpPrompts ? { followUpPrompts: e.followUpPrompts } : {}
|
|
1504
|
-
}), Zn = "MESSAGE_TYPE_REPOLL",
|
|
1504
|
+
}), Zn = "MESSAGE_TYPE_REPOLL", vr = "agentUi:update", Aa = "arbor-agent-", qe = {
|
|
1505
1505
|
all: "ALL",
|
|
1506
1506
|
checklist: "CHECKLIST",
|
|
1507
1507
|
resources: "RESOURCES",
|
|
1508
1508
|
chat: "CHAT",
|
|
1509
1509
|
timeline: "TIMELINE"
|
|
1510
|
-
},
|
|
1510
|
+
}, wr = new Set(Object.values(qe)), Nr = (e, t) => `${e.endsWith("-") ? e : `${e}-`}${t}`, yr = (e) => typeof e == "string" && wr.has(e) ? e : qe.all, Ar = (e) => {
|
|
1511
1511
|
if (!e || typeof e != "object")
|
|
1512
1512
|
return null;
|
|
1513
1513
|
const t = e;
|
|
@@ -1515,14 +1515,14 @@ const js = ({
|
|
|
1515
1515
|
type: Zn,
|
|
1516
1516
|
target: yr(t.target)
|
|
1517
1517
|
};
|
|
1518
|
-
},
|
|
1518
|
+
}, kr = (e) => {
|
|
1519
1519
|
const t = Array.isArray(e) ? e : [e], a = [];
|
|
1520
1520
|
for (const s of t) {
|
|
1521
|
-
const r =
|
|
1521
|
+
const r = Ar(s);
|
|
1522
1522
|
r && a.push(r);
|
|
1523
1523
|
}
|
|
1524
1524
|
return a;
|
|
1525
|
-
},
|
|
1525
|
+
}, br = ({
|
|
1526
1526
|
enabled: e,
|
|
1527
1527
|
channelPrefix: t,
|
|
1528
1528
|
agentId: a,
|
|
@@ -1536,10 +1536,10 @@ const js = ({
|
|
|
1536
1536
|
if (!p || !s || !i)
|
|
1537
1537
|
return;
|
|
1538
1538
|
const c = s(
|
|
1539
|
-
|
|
1540
|
-
|
|
1539
|
+
Nr(i, a),
|
|
1540
|
+
vr,
|
|
1541
1541
|
(A) => {
|
|
1542
|
-
for (const f of
|
|
1542
|
+
for (const f of kr(A))
|
|
1543
1543
|
l.current(f.target);
|
|
1544
1544
|
}
|
|
1545
1545
|
);
|
|
@@ -1549,12 +1549,12 @@ const js = ({
|
|
|
1549
1549
|
}, [p, i, a, s]), p;
|
|
1550
1550
|
};
|
|
1551
1551
|
let we = null, On = "", In = "", an = 0;
|
|
1552
|
-
const
|
|
1552
|
+
const Er = () => {
|
|
1553
1553
|
window.setTimeout(() => {
|
|
1554
1554
|
an > 0 || !we || (we.disconnect(), we = null, On = "", In = "");
|
|
1555
1555
|
}, 0);
|
|
1556
|
-
}, Cr = (e, t) => (we && (On !== e || In !== t) && (we.disconnect(), we = null), we || (we = new
|
|
1557
|
-
an = Math.max(0, an - 1),
|
|
1556
|
+
}, Cr = (e, t) => (we && (On !== e || In !== t) && (we.disconnect(), we = null), we || (we = new ds(e, { cluster: t }), On = e, In = t), an += 1, we), Tr = () => {
|
|
1557
|
+
an = Math.max(0, an - 1), Er();
|
|
1558
1558
|
}, Sr = ({
|
|
1559
1559
|
enabled: e,
|
|
1560
1560
|
key: t,
|
|
@@ -1569,18 +1569,18 @@ const br = () => {
|
|
|
1569
1569
|
}
|
|
1570
1570
|
const c = Cr(l, i);
|
|
1571
1571
|
return r.current = c, () => {
|
|
1572
|
-
r.current = null,
|
|
1572
|
+
r.current = null, Tr();
|
|
1573
1573
|
};
|
|
1574
1574
|
}, [p, l, i]), ee(() => {
|
|
1575
1575
|
if (p)
|
|
1576
1576
|
return (c, A, f) => {
|
|
1577
|
-
const
|
|
1578
|
-
if (!
|
|
1577
|
+
const N = r.current ?? we;
|
|
1578
|
+
if (!N)
|
|
1579
1579
|
return s && console.log(`[pusher] subscribe skipped — client not ready for "${c}"`), () => {
|
|
1580
1580
|
};
|
|
1581
|
-
const _ =
|
|
1581
|
+
const _ = N.subscribe(c);
|
|
1582
1582
|
return _.bind(A, f), () => {
|
|
1583
|
-
_.unbind(A, f),
|
|
1583
|
+
_.unbind(A, f), N.unsubscribe(c);
|
|
1584
1584
|
};
|
|
1585
1585
|
};
|
|
1586
1586
|
}, [p, s]);
|
|
@@ -1590,20 +1590,20 @@ class st extends Error {
|
|
|
1590
1590
|
super(s ?? `Agent service request failed (${t})`), this.name = "AgentServiceError", this.status = t, this.detail = a;
|
|
1591
1591
|
}
|
|
1592
1592
|
}
|
|
1593
|
-
const
|
|
1593
|
+
const Rr = "/api/v1", V = {
|
|
1594
1594
|
agentDefinitions: "/agent-definitions",
|
|
1595
1595
|
agents: "/agents",
|
|
1596
1596
|
conversations: "/conversations",
|
|
1597
1597
|
tripOptions: "/trip-options",
|
|
1598
1598
|
demoDataset: "/demo/dataset"
|
|
1599
|
-
},
|
|
1599
|
+
}, j = {
|
|
1600
1600
|
GET: "GET",
|
|
1601
1601
|
POST: "POST",
|
|
1602
1602
|
PATCH: "PATCH",
|
|
1603
1603
|
DELETE: "DELETE"
|
|
1604
|
-
}, Rr = {
|
|
1605
|
-
error: "error"
|
|
1606
1604
|
}, Or = {
|
|
1605
|
+
error: "error"
|
|
1606
|
+
}, Ir = {
|
|
1607
1607
|
user: "user"
|
|
1608
1608
|
}, Ke = {
|
|
1609
1609
|
acceptJson: "application/json",
|
|
@@ -1611,21 +1611,21 @@ const Tr = "/api/v1", J = {
|
|
|
1611
1611
|
acceptEventStream: "text/event-stream",
|
|
1612
1612
|
contentTypeJson: "application/json",
|
|
1613
1613
|
arborApplicationUrl: "X-Arbor-Application-Url"
|
|
1614
|
-
},
|
|
1614
|
+
}, Lr = 100, Pr = (e) => {
|
|
1615
1615
|
switch (e) {
|
|
1616
|
-
case
|
|
1617
|
-
return
|
|
1618
|
-
case
|
|
1619
|
-
return
|
|
1620
|
-
case
|
|
1621
|
-
return
|
|
1622
|
-
case
|
|
1623
|
-
case
|
|
1624
|
-
return
|
|
1616
|
+
case yn.paused:
|
|
1617
|
+
return C.paused;
|
|
1618
|
+
case yn.complete:
|
|
1619
|
+
return C.complete;
|
|
1620
|
+
case C.hitl:
|
|
1621
|
+
return C.hitl;
|
|
1622
|
+
case yn.active:
|
|
1623
|
+
case C["generating-a-response"]:
|
|
1624
|
+
return C["generating-a-response"];
|
|
1625
1625
|
default:
|
|
1626
|
-
return
|
|
1626
|
+
return C["generating-a-response"];
|
|
1627
1627
|
}
|
|
1628
|
-
},
|
|
1628
|
+
}, Ur = (e) => {
|
|
1629
1629
|
switch (e) {
|
|
1630
1630
|
case Lt.requires_attention:
|
|
1631
1631
|
case Lt.waiting_on_human:
|
|
@@ -1644,28 +1644,28 @@ const Tr = "/api/v1", J = {
|
|
|
1644
1644
|
default:
|
|
1645
1645
|
return B.to_do;
|
|
1646
1646
|
}
|
|
1647
|
-
},
|
|
1647
|
+
}, ka = (e) => ({
|
|
1648
1648
|
ref: e.name,
|
|
1649
1649
|
display_name: e.display_name,
|
|
1650
1650
|
agent_intent: e.agent_intent ?? "",
|
|
1651
1651
|
description: e.description
|
|
1652
|
-
}),
|
|
1652
|
+
}), Ci = (e) => ({
|
|
1653
1653
|
id: e.id,
|
|
1654
1654
|
name: e.name,
|
|
1655
1655
|
...e.has_run_before ? { hasRunBefore: e.has_run_before } : {}
|
|
1656
|
-
}),
|
|
1656
|
+
}), Dr = new Set(Object.values(Oe)), xr = (e) => Dr.has(e) ? e : Oe.document_html, $r = (e) => ({
|
|
1657
1657
|
id: e.id,
|
|
1658
1658
|
type: xr(e.type),
|
|
1659
1659
|
title: e.title,
|
|
1660
1660
|
createdDatetime: e.created_datetime,
|
|
1661
1661
|
lastUpdatedDatetime: e.last_updated_datetime,
|
|
1662
1662
|
misRecordUrl: e.mis_record_url
|
|
1663
|
-
}),
|
|
1664
|
-
resources: e.resources.map(
|
|
1663
|
+
}), Mr = (e) => ({
|
|
1664
|
+
resources: e.resources.map($r),
|
|
1665
1665
|
pageNumber: e.page_number,
|
|
1666
1666
|
pageSize: e.page_size,
|
|
1667
1667
|
totalRecords: e.total_records
|
|
1668
|
-
}),
|
|
1668
|
+
}), Hr = (e) => ({
|
|
1669
1669
|
actionLog: (e.action_log ?? []).map((t) => ({
|
|
1670
1670
|
timestamp: t.timestamp,
|
|
1671
1671
|
type: t.type,
|
|
@@ -1683,7 +1683,7 @@ const Tr = "/api/v1", J = {
|
|
|
1683
1683
|
repeatIntervalSeconds: t.repeat_interval_seconds,
|
|
1684
1684
|
wakePrompt: t.wake_prompt
|
|
1685
1685
|
}))
|
|
1686
|
-
}),
|
|
1686
|
+
}), Ve = (e) => {
|
|
1687
1687
|
var a;
|
|
1688
1688
|
const t = e.invocation_id ?? e.id;
|
|
1689
1689
|
return {
|
|
@@ -1695,33 +1695,33 @@ const Tr = "/api/v1", J = {
|
|
|
1695
1695
|
application_id: e.application_id,
|
|
1696
1696
|
...e.application_name ? { application_name: e.application_name } : {},
|
|
1697
1697
|
created_by: e.created_by,
|
|
1698
|
-
status:
|
|
1698
|
+
status: Pr(e.status),
|
|
1699
1699
|
archivedAt: e.archived_at ?? null,
|
|
1700
1700
|
context_ref: e.context_ref ?? null,
|
|
1701
1701
|
checklist_ref: e.checklist_ref ?? null
|
|
1702
1702
|
};
|
|
1703
|
-
},
|
|
1703
|
+
}, ba = (e) => {
|
|
1704
1704
|
var t;
|
|
1705
1705
|
return {
|
|
1706
|
-
task: e.item ?? e.task ?? e.name ?? e.label ??
|
|
1707
|
-
status:
|
|
1706
|
+
task: e.item ?? e.task ?? e.name ?? e.label ?? Us,
|
|
1707
|
+
status: Ur(e.status),
|
|
1708
1708
|
description: e.description ?? "",
|
|
1709
1709
|
...e.prompt ? { prompt: e.prompt } : {},
|
|
1710
1710
|
...(t = e.follow_up_prompts) != null && t.length ? { clarificationPrompts: e.follow_up_prompts } : {}
|
|
1711
1711
|
};
|
|
1712
|
-
},
|
|
1712
|
+
}, Br = (e) => Array.isArray(e) ? e : e.checklist_items ?? e.checklist ?? e.items ?? [], Ln = (e, t, a) => {
|
|
1713
1713
|
var l;
|
|
1714
1714
|
const s = !Array.isArray(t) && (t.opening_message || (l = t.opening_follow_up_prompts) != null && l.length) ? t : a, r = s ? ln(s) : void 0;
|
|
1715
1715
|
return {
|
|
1716
1716
|
invocation_id: e,
|
|
1717
|
-
checklist:
|
|
1717
|
+
checklist: Br(t).map(ba),
|
|
1718
1718
|
...r ? { openingMessage: r } : {}
|
|
1719
1719
|
};
|
|
1720
|
-
},
|
|
1720
|
+
}, Ti = (e, t) => {
|
|
1721
1721
|
const a = ln(t);
|
|
1722
1722
|
return {
|
|
1723
1723
|
invocation_id: t.invocation_id ?? e,
|
|
1724
|
-
checklist: (t.checklist_items ?? []).map(
|
|
1724
|
+
checklist: (t.checklist_items ?? []).map(ba),
|
|
1725
1725
|
...a ? { openingMessage: a } : {}
|
|
1726
1726
|
};
|
|
1727
1727
|
}, ln = (e) => {
|
|
@@ -1729,12 +1729,12 @@ const Tr = "/api/v1", J = {
|
|
|
1729
1729
|
const t = (a = e.opening_message) == null ? void 0 : a.trim();
|
|
1730
1730
|
if (t)
|
|
1731
1731
|
return {
|
|
1732
|
-
id:
|
|
1732
|
+
id: ha,
|
|
1733
1733
|
author: he.agent,
|
|
1734
1734
|
text: t,
|
|
1735
1735
|
...(s = e.opening_follow_up_prompts) != null && s.length ? { followUpPrompts: e.opening_follow_up_prompts } : {}
|
|
1736
1736
|
};
|
|
1737
|
-
},
|
|
1737
|
+
}, Si = (e) => {
|
|
1738
1738
|
try {
|
|
1739
1739
|
const t = JSON.parse(e);
|
|
1740
1740
|
if (Array.isArray(t)) {
|
|
@@ -1748,7 +1748,7 @@ const Tr = "/api/v1", J = {
|
|
|
1748
1748
|
} catch {
|
|
1749
1749
|
}
|
|
1750
1750
|
return e;
|
|
1751
|
-
},
|
|
1751
|
+
}, Ri = (e) => {
|
|
1752
1752
|
const t = e.trim();
|
|
1753
1753
|
return t.length > 0 ? `File upload
|
|
1754
1754
|
|
|
@@ -1757,25 +1757,25 @@ ${t}` : "File upload";
|
|
|
1757
1757
|
var a;
|
|
1758
1758
|
const t = (a = e.filename) == null ? void 0 : a.trim();
|
|
1759
1759
|
return t || null;
|
|
1760
|
-
},
|
|
1760
|
+
}, zr = (e) => e.filter((t) => Qn(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) => {
|
|
1761
1761
|
const a = Qn(t);
|
|
1762
1762
|
return a && t.role === "user" ? {
|
|
1763
1763
|
id: t.message_id,
|
|
1764
1764
|
author: he.user,
|
|
1765
|
-
kind:
|
|
1765
|
+
kind: da.user_file,
|
|
1766
1766
|
text: a
|
|
1767
1767
|
} : {
|
|
1768
1768
|
id: t.message_id,
|
|
1769
1769
|
author: t.role === "user" ? he.user : he.agent,
|
|
1770
1770
|
text: t.content
|
|
1771
1771
|
};
|
|
1772
|
-
}),
|
|
1772
|
+
}), Gr = /:invocationId\b/g, Fr = /:resourceId\b/g, qr = (e) => e.trim().replace(/^Bearer\s+/i, ""), ea = (e) => e.endsWith("/") ? e.slice(0, -1) : e;
|
|
1773
1773
|
class Pn {
|
|
1774
1774
|
constructor(t) {
|
|
1775
1775
|
var s;
|
|
1776
1776
|
this.baseUrl = ea(t.baseUrl ?? "");
|
|
1777
1777
|
const a = (s = t.token) == null ? void 0 : s.trim();
|
|
1778
|
-
this.token = a ?
|
|
1778
|
+
this.token = a ? qr(a) : void 0, this.customHeaders = t.headers, this.urls = t.urls ?? {}, this.fetchImpl = t.fetch ?? globalThis.fetch.bind(globalThis);
|
|
1779
1779
|
}
|
|
1780
1780
|
// Replaces the extra headers merged into every subsequent request,
|
|
1781
1781
|
// without recreating the client (e.g. an application-URL header that
|
|
@@ -1785,29 +1785,29 @@ class Pn {
|
|
|
1785
1785
|
}
|
|
1786
1786
|
async listAgentDefinitions() {
|
|
1787
1787
|
return (await this.request(
|
|
1788
|
-
|
|
1789
|
-
this.resolveUrl("agentDefinitions",
|
|
1788
|
+
j.GET,
|
|
1789
|
+
this.resolveUrl("agentDefinitions", V.agentDefinitions)
|
|
1790
1790
|
)).agent_definitions ?? [];
|
|
1791
1791
|
}
|
|
1792
1792
|
getAgentDefinition(t) {
|
|
1793
1793
|
return this.request(
|
|
1794
|
-
|
|
1795
|
-
this.apiUrl(`${
|
|
1794
|
+
j.GET,
|
|
1795
|
+
this.apiUrl(`${V.agentDefinitions}/${encodeURIComponent(t)}`)
|
|
1796
1796
|
);
|
|
1797
1797
|
}
|
|
1798
1798
|
listTripOptions() {
|
|
1799
|
-
return this.request(
|
|
1799
|
+
return this.request(j.GET, this.apiUrl(V.tripOptions));
|
|
1800
1800
|
}
|
|
1801
1801
|
getDataset() {
|
|
1802
1802
|
return this.request(
|
|
1803
|
-
|
|
1804
|
-
this.apiUrl(
|
|
1803
|
+
j.GET,
|
|
1804
|
+
this.apiUrl(V.demoDataset)
|
|
1805
1805
|
);
|
|
1806
1806
|
}
|
|
1807
1807
|
setDataset(t) {
|
|
1808
1808
|
return this.request(
|
|
1809
|
-
|
|
1810
|
-
this.apiUrl(
|
|
1809
|
+
j.POST,
|
|
1810
|
+
this.apiUrl(V.demoDataset),
|
|
1811
1811
|
{ dataset: t }
|
|
1812
1812
|
);
|
|
1813
1813
|
}
|
|
@@ -1816,8 +1816,8 @@ class Pn {
|
|
|
1816
1816
|
t.status && a.set("status", t.status), t.agentDefinitionRef && a.set("agent_definition_ref", t.agentDefinitionRef);
|
|
1817
1817
|
const s = a.toString() ? `?${a.toString()}` : "";
|
|
1818
1818
|
return this.request(
|
|
1819
|
-
|
|
1820
|
-
`${this.resolveUrl("agents",
|
|
1819
|
+
j.GET,
|
|
1820
|
+
`${this.resolveUrl("agents", V.agents)}${s}`
|
|
1821
1821
|
);
|
|
1822
1822
|
}
|
|
1823
1823
|
createAgent(t, a = {}) {
|
|
@@ -1826,15 +1826,15 @@ class Pn {
|
|
|
1826
1826
|
agent_definition_ref: t
|
|
1827
1827
|
}, r = (i = a.invocationName) == null ? void 0 : i.trim(), l = (p = a.agentIntent) == null ? void 0 : p.trim();
|
|
1828
1828
|
return r && (s.invocation_name = r), l && (s.agent_intent = l), this.request(
|
|
1829
|
-
|
|
1830
|
-
this.resolveUrl("agents",
|
|
1829
|
+
j.POST,
|
|
1830
|
+
this.resolveUrl("agents", V.agents),
|
|
1831
1831
|
s
|
|
1832
1832
|
);
|
|
1833
1833
|
}
|
|
1834
1834
|
getAgent(t) {
|
|
1835
1835
|
return this.request(
|
|
1836
|
-
|
|
1837
|
-
this.resolveUrl("agent", `${
|
|
1836
|
+
j.GET,
|
|
1837
|
+
this.resolveUrl("agent", `${V.agents}/${encodeURIComponent(t)}`, t)
|
|
1838
1838
|
);
|
|
1839
1839
|
}
|
|
1840
1840
|
updateAgent(t, a) {
|
|
@@ -1842,10 +1842,10 @@ class Pn {
|
|
|
1842
1842
|
invocation_name: a.invocationName.trim()
|
|
1843
1843
|
};
|
|
1844
1844
|
return this.request(
|
|
1845
|
-
|
|
1845
|
+
j.PATCH,
|
|
1846
1846
|
this.resolveUrl(
|
|
1847
1847
|
"agent",
|
|
1848
|
-
`${
|
|
1848
|
+
`${V.agents}/${encodeURIComponent(t)}`,
|
|
1849
1849
|
t
|
|
1850
1850
|
),
|
|
1851
1851
|
r
|
|
@@ -1853,10 +1853,10 @@ class Pn {
|
|
|
1853
1853
|
}
|
|
1854
1854
|
getAgentChecklist(t) {
|
|
1855
1855
|
return this.request(
|
|
1856
|
-
|
|
1856
|
+
j.GET,
|
|
1857
1857
|
this.resolveUrl(
|
|
1858
1858
|
"agentChecklist",
|
|
1859
|
-
`${
|
|
1859
|
+
`${V.agents}/${encodeURIComponent(t)}/checklist`,
|
|
1860
1860
|
t
|
|
1861
1861
|
)
|
|
1862
1862
|
);
|
|
@@ -1866,21 +1866,21 @@ class Pn {
|
|
|
1866
1866
|
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);
|
|
1867
1867
|
const r = s.toString(), l = this.resolveUrl(
|
|
1868
1868
|
"agentResources",
|
|
1869
|
-
`${
|
|
1869
|
+
`${V.agents}/${encodeURIComponent(t)}/resources`,
|
|
1870
1870
|
t
|
|
1871
1871
|
);
|
|
1872
1872
|
return this.request(
|
|
1873
|
-
|
|
1873
|
+
j.GET,
|
|
1874
1874
|
r ? `${l}?${r}` : l
|
|
1875
1875
|
);
|
|
1876
1876
|
}
|
|
1877
1877
|
async listAllAgentResources(t) {
|
|
1878
|
-
const a =
|
|
1878
|
+
const a = Lr;
|
|
1879
1879
|
let s = 1;
|
|
1880
1880
|
const r = [];
|
|
1881
1881
|
let l = Number.POSITIVE_INFINITY;
|
|
1882
1882
|
for (; r.length < l; ) {
|
|
1883
|
-
const i =
|
|
1883
|
+
const i = Mr(
|
|
1884
1884
|
await this.getAgentResources(t, { pageNumber: s, pageSize: a })
|
|
1885
1885
|
);
|
|
1886
1886
|
if (l = i.totalRecords, i.resources.length === 0 || (r.push(...i.resources), r.length >= l))
|
|
@@ -1890,14 +1890,14 @@ class Pn {
|
|
|
1890
1890
|
return r;
|
|
1891
1891
|
}
|
|
1892
1892
|
getAgentResourceHtml(t, a) {
|
|
1893
|
-
return this.requestText(
|
|
1893
|
+
return this.requestText(j.GET, this.resolveResourceHtmlUrl(t, a));
|
|
1894
1894
|
}
|
|
1895
1895
|
getAgentTimeline(t) {
|
|
1896
1896
|
return this.request(
|
|
1897
|
-
|
|
1897
|
+
j.GET,
|
|
1898
1898
|
this.resolveUrl(
|
|
1899
1899
|
"agentTimeline",
|
|
1900
|
-
`${
|
|
1900
|
+
`${V.agents}/${encodeURIComponent(t)}/agent-timeline`,
|
|
1901
1901
|
t
|
|
1902
1902
|
)
|
|
1903
1903
|
);
|
|
@@ -1905,70 +1905,70 @@ class Pn {
|
|
|
1905
1905
|
getAgentContext(t) {
|
|
1906
1906
|
const a = this.resolveUrl(
|
|
1907
1907
|
"agent",
|
|
1908
|
-
`${
|
|
1908
|
+
`${V.agents}/${encodeURIComponent(t)}`,
|
|
1909
1909
|
t
|
|
1910
1910
|
);
|
|
1911
1911
|
return this.request(
|
|
1912
|
-
|
|
1912
|
+
j.GET,
|
|
1913
1913
|
`${ea(a)}/context`
|
|
1914
1914
|
);
|
|
1915
1915
|
}
|
|
1916
1916
|
pauseAgent(t) {
|
|
1917
1917
|
return this.request(
|
|
1918
|
-
|
|
1918
|
+
j.POST,
|
|
1919
1919
|
this.resolveUrl(
|
|
1920
1920
|
"pauseAgent",
|
|
1921
|
-
`${
|
|
1921
|
+
`${V.agents}/${encodeURIComponent(t)}/pause`,
|
|
1922
1922
|
t
|
|
1923
1923
|
)
|
|
1924
1924
|
);
|
|
1925
1925
|
}
|
|
1926
1926
|
resumeAgent(t) {
|
|
1927
1927
|
return this.request(
|
|
1928
|
-
|
|
1928
|
+
j.POST,
|
|
1929
1929
|
this.resolveUrl(
|
|
1930
1930
|
"resumeAgent",
|
|
1931
|
-
`${
|
|
1931
|
+
`${V.agents}/${encodeURIComponent(t)}/resume`,
|
|
1932
1932
|
t
|
|
1933
1933
|
)
|
|
1934
1934
|
);
|
|
1935
1935
|
}
|
|
1936
1936
|
archiveAgent(t) {
|
|
1937
1937
|
return this.request(
|
|
1938
|
-
|
|
1938
|
+
j.POST,
|
|
1939
1939
|
this.resolveUrl(
|
|
1940
1940
|
"archiveAgent",
|
|
1941
|
-
`${
|
|
1941
|
+
`${V.agents}/${encodeURIComponent(t)}/archive`,
|
|
1942
1942
|
t
|
|
1943
1943
|
)
|
|
1944
1944
|
);
|
|
1945
1945
|
}
|
|
1946
1946
|
unarchiveAgent(t) {
|
|
1947
1947
|
return this.request(
|
|
1948
|
-
|
|
1948
|
+
j.POST,
|
|
1949
1949
|
this.resolveUrl(
|
|
1950
1950
|
"unarchiveAgent",
|
|
1951
|
-
`${
|
|
1951
|
+
`${V.agents}/${encodeURIComponent(t)}/unarchive`,
|
|
1952
1952
|
t
|
|
1953
1953
|
)
|
|
1954
1954
|
);
|
|
1955
1955
|
}
|
|
1956
1956
|
deleteAgent(t) {
|
|
1957
1957
|
return this.request(
|
|
1958
|
-
|
|
1958
|
+
j.DELETE,
|
|
1959
1959
|
this.resolveUrl(
|
|
1960
1960
|
"agent",
|
|
1961
|
-
`${
|
|
1961
|
+
`${V.agents}/${encodeURIComponent(t)}`,
|
|
1962
1962
|
t
|
|
1963
1963
|
)
|
|
1964
1964
|
);
|
|
1965
1965
|
}
|
|
1966
1966
|
getConversation(t) {
|
|
1967
1967
|
return this.request(
|
|
1968
|
-
|
|
1968
|
+
j.GET,
|
|
1969
1969
|
this.resolveUrl(
|
|
1970
1970
|
"agentConversation",
|
|
1971
|
-
`${
|
|
1971
|
+
`${V.conversations}/${encodeURIComponent(t)}`,
|
|
1972
1972
|
t
|
|
1973
1973
|
)
|
|
1974
1974
|
);
|
|
@@ -1979,11 +1979,11 @@ class Pn {
|
|
|
1979
1979
|
const r = !!(s.uploadFiles && s.uploadFiles.length > 0), l = await this.fetchImpl(
|
|
1980
1980
|
this.resolveUrl(
|
|
1981
1981
|
"agentChat",
|
|
1982
|
-
`${
|
|
1982
|
+
`${V.agents}/${encodeURIComponent(t)}/chat`,
|
|
1983
1983
|
t
|
|
1984
1984
|
),
|
|
1985
1985
|
{
|
|
1986
|
-
method:
|
|
1986
|
+
method: j.POST,
|
|
1987
1987
|
headers: {
|
|
1988
1988
|
...this.customHeaders,
|
|
1989
1989
|
...this.authHeaders(),
|
|
@@ -1991,7 +1991,7 @@ class Pn {
|
|
|
1991
1991
|
// Let the browser set the multipart boundary when uploading.
|
|
1992
1992
|
...r ? {} : { "Content-Type": Ke.contentTypeJson }
|
|
1993
1993
|
},
|
|
1994
|
-
body: r ?
|
|
1994
|
+
body: r ? Vr(a, s.uploadFiles ?? []) : JSON.stringify(a),
|
|
1995
1995
|
signal: s.signal
|
|
1996
1996
|
}
|
|
1997
1997
|
);
|
|
@@ -2006,7 +2006,7 @@ class Pn {
|
|
|
2006
2006
|
}
|
|
2007
2007
|
// Builds a URL from the base url + shared API prefix + route.
|
|
2008
2008
|
apiUrl(t) {
|
|
2009
|
-
return `${this.baseUrl}${
|
|
2009
|
+
return `${this.baseUrl}${Rr}${t}`;
|
|
2010
2010
|
}
|
|
2011
2011
|
// Resolves the URL for an operation, preferring a per-operation override
|
|
2012
2012
|
// (with `:invocationId` substituted) and falling back to the base url.
|
|
@@ -2015,22 +2015,22 @@ class Pn {
|
|
|
2015
2015
|
if (!l)
|
|
2016
2016
|
return this.apiUrl(a);
|
|
2017
2017
|
let i = l;
|
|
2018
|
-
return s && (i = i.replace(
|
|
2018
|
+
return s && (i = i.replace(Gr, encodeURIComponent(s))), r && (i = i.replace(Fr, encodeURIComponent(r))), i;
|
|
2019
2019
|
}
|
|
2020
2020
|
resolveResourceHtmlUrl(t, a) {
|
|
2021
2021
|
return this.urls.agentResourceHtml ? this.resolveUrl(
|
|
2022
2022
|
"agentResourceHtml",
|
|
2023
|
-
`${
|
|
2023
|
+
`${V.agents}/${encodeURIComponent(t)}/resources/${encodeURIComponent(
|
|
2024
2024
|
a
|
|
2025
2025
|
)}`,
|
|
2026
2026
|
t,
|
|
2027
2027
|
a
|
|
2028
2028
|
) : this.urls.agentResources ? `${this.resolveUrl(
|
|
2029
2029
|
"agentResources",
|
|
2030
|
-
`${
|
|
2030
|
+
`${V.agents}/${encodeURIComponent(t)}/resources`,
|
|
2031
2031
|
t
|
|
2032
2032
|
).replace(/\/$/, "")}/${encodeURIComponent(a)}` : this.apiUrl(
|
|
2033
|
-
`${
|
|
2033
|
+
`${V.agents}/${encodeURIComponent(t)}/resources/${encodeURIComponent(
|
|
2034
2034
|
a
|
|
2035
2035
|
)}`
|
|
2036
2036
|
);
|
|
@@ -2080,28 +2080,28 @@ class Pn {
|
|
|
2080
2080
|
const s = t.getReader(), r = new TextDecoder();
|
|
2081
2081
|
let l = "", i, p;
|
|
2082
2082
|
const c = (f) => {
|
|
2083
|
-
const { event:
|
|
2083
|
+
const { event: N, data: _ } = Kr(f);
|
|
2084
2084
|
if (_ === null)
|
|
2085
2085
|
return;
|
|
2086
|
-
if (
|
|
2086
|
+
if (N === Or.error) {
|
|
2087
2087
|
const h = ta(_);
|
|
2088
2088
|
throw new st(502, h, (h == null ? void 0 : h.message) ?? "Chat stream error");
|
|
2089
2089
|
}
|
|
2090
|
-
const
|
|
2091
|
-
|
|
2090
|
+
const y = ta(_);
|
|
2091
|
+
y && (i = y, a == null || a(y), y.is_final && (p = y));
|
|
2092
2092
|
};
|
|
2093
2093
|
try {
|
|
2094
2094
|
for (; ; ) {
|
|
2095
|
-
const { done: f, value:
|
|
2095
|
+
const { done: f, value: N } = await s.read();
|
|
2096
2096
|
if (f)
|
|
2097
2097
|
break;
|
|
2098
|
-
l += r.decode(
|
|
2098
|
+
l += r.decode(N, { stream: !0 });
|
|
2099
2099
|
const _ = l.split(`
|
|
2100
2100
|
|
|
2101
2101
|
`);
|
|
2102
2102
|
l = _.pop() ?? "";
|
|
2103
|
-
for (const
|
|
2104
|
-
c(
|
|
2103
|
+
for (const y of _)
|
|
2104
|
+
c(y);
|
|
2105
2105
|
if (p) {
|
|
2106
2106
|
await s.cancel().catch(() => {
|
|
2107
2107
|
});
|
|
@@ -2121,7 +2121,7 @@ class Pn {
|
|
|
2121
2121
|
return A;
|
|
2122
2122
|
}
|
|
2123
2123
|
}
|
|
2124
|
-
const
|
|
2124
|
+
const Kr = (e) => {
|
|
2125
2125
|
let t = null;
|
|
2126
2126
|
const a = [];
|
|
2127
2127
|
for (const s of e.split(`
|
|
@@ -2141,7 +2141,7 @@ const qr = (e) => {
|
|
|
2141
2141
|
return;
|
|
2142
2142
|
}
|
|
2143
2143
|
};
|
|
2144
|
-
function
|
|
2144
|
+
function Vr(e, t) {
|
|
2145
2145
|
const a = new FormData();
|
|
2146
2146
|
a.append("body", JSON.stringify(e));
|
|
2147
2147
|
for (const s of t)
|
|
@@ -2149,12 +2149,12 @@ function Kr(e, t) {
|
|
|
2149
2149
|
return a;
|
|
2150
2150
|
}
|
|
2151
2151
|
const Jr = {
|
|
2152
|
-
id:
|
|
2152
|
+
id: ha,
|
|
2153
2153
|
author: he.agent,
|
|
2154
2154
|
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."
|
|
2155
2155
|
};
|
|
2156
2156
|
let na = 0;
|
|
2157
|
-
const
|
|
2157
|
+
const Yr = (e) => (na += 1, `${e}-${Date.now()}-${na}`), jr = (e) => {
|
|
2158
2158
|
const t = e.destination ? ` to ${e.destination}` : "";
|
|
2159
2159
|
return `Let's get started on ${e.tripName.trim() || e.destination.trim() || "this task"}${t}. What will you do first?`;
|
|
2160
2160
|
};
|
|
@@ -2166,11 +2166,11 @@ class Wr {
|
|
|
2166
2166
|
return this.opening;
|
|
2167
2167
|
}
|
|
2168
2168
|
async bootstrapConversation() {
|
|
2169
|
-
const t = await this.client.getConversation(this.chatId), a =
|
|
2169
|
+
const t = await this.client.getConversation(this.chatId), a = zr(t.messages);
|
|
2170
2170
|
return a.length === 0 ? [this.opening] : a;
|
|
2171
2171
|
}
|
|
2172
2172
|
async start(t) {
|
|
2173
|
-
return { ...await this.exchange(
|
|
2173
|
+
return { ...await this.exchange(jr(t)), phase: G.running };
|
|
2174
2174
|
}
|
|
2175
2175
|
sendMessage(t, a, s) {
|
|
2176
2176
|
return this.exchange(t, a, s);
|
|
@@ -2185,8 +2185,8 @@ class Wr {
|
|
|
2185
2185
|
this.seededChecklist = t;
|
|
2186
2186
|
}
|
|
2187
2187
|
async exchange(t, a, s) {
|
|
2188
|
-
var
|
|
2189
|
-
const r = [{ role:
|
|
2188
|
+
var N;
|
|
2189
|
+
const r = [{ role: Ir.user, content: t }];
|
|
2190
2190
|
let l = "", i = null, p;
|
|
2191
2191
|
const c = await this.client.chat(
|
|
2192
2192
|
this.agentId,
|
|
@@ -2203,26 +2203,26 @@ class Wr {
|
|
|
2203
2203
|
{
|
|
2204
2204
|
...a && a.length > 0 ? { uploadFiles: a } : {},
|
|
2205
2205
|
onEvent: (_) => {
|
|
2206
|
-
var
|
|
2207
|
-
const
|
|
2208
|
-
if ((
|
|
2209
|
-
const P =
|
|
2206
|
+
var T;
|
|
2207
|
+
const y = _.message;
|
|
2208
|
+
if ((y == null ? void 0 : y.role) === "assistant" && y.tool_calls && y.tool_calls.length > 0) {
|
|
2209
|
+
const P = cs(y.tool_calls);
|
|
2210
2210
|
for (const U of P)
|
|
2211
|
-
U.phrase !== i && (i = U.phrase, (
|
|
2211
|
+
U.phrase !== i && (i = U.phrase, (T = s == null ? void 0 : s.onThinking) == null || T.call(s, U));
|
|
2212
2212
|
}
|
|
2213
|
-
const h =
|
|
2213
|
+
const h = y == null ? void 0 : y.content;
|
|
2214
2214
|
h && (l = _.is_final ? h : l + h), _.is_final && (p = _);
|
|
2215
2215
|
}
|
|
2216
2216
|
}
|
|
2217
2217
|
), A = p ?? c, f = {
|
|
2218
|
-
id: A.event_id ||
|
|
2218
|
+
id: A.event_id || Yr("msg-agent"),
|
|
2219
2219
|
author: he.agent,
|
|
2220
2220
|
text: l || A.message.content || "",
|
|
2221
|
-
...(
|
|
2221
|
+
...(N = A.follow_up_prompts) != null && N.length ? { followUpPrompts: A.follow_up_prompts } : {}
|
|
2222
2222
|
};
|
|
2223
2223
|
try {
|
|
2224
|
-
const _ = await this.client.getAgentChecklist(this.agentId), { checklist:
|
|
2225
|
-
return
|
|
2224
|
+
const _ = await this.client.getAgentChecklist(this.agentId), { checklist: y } = Ln(this.agentId, _);
|
|
2225
|
+
return y.length === 0 ? { message: f } : (this.seededChecklist = y, { message: f, checklist: y });
|
|
2226
2226
|
} catch {
|
|
2227
2227
|
return {
|
|
2228
2228
|
message: f,
|
|
@@ -2231,24 +2231,24 @@ class Wr {
|
|
|
2231
2231
|
}
|
|
2232
2232
|
}
|
|
2233
2233
|
}
|
|
2234
|
-
const
|
|
2234
|
+
const Ea = (e, t) => (a) => {
|
|
2235
2235
|
var s, r;
|
|
2236
2236
|
return new Wr(e, a.invocation_id, {
|
|
2237
2237
|
model: t == null ? void 0 : t.model,
|
|
2238
2238
|
chatId: ((s = t == null ? void 0 : t.resolveChatId) == null ? void 0 : s.call(t, a)) ?? (t == null ? void 0 : t.chatId) ?? a.invocation_id,
|
|
2239
2239
|
openingMessage: ((r = t == null ? void 0 : t.resolveOpeningMessage) == null ? void 0 : r.call(t, a)) ?? (t == null ? void 0 : t.openingMessage)
|
|
2240
2240
|
});
|
|
2241
|
-
}, Ca = (e) => e instanceof st ? e.message : e instanceof TypeError ? "Network error while contacting the agent service." : e instanceof Error && e.message ? e.message :
|
|
2241
|
+
}, Ca = (e) => e instanceof st ? e.message : e instanceof TypeError ? "Network error while contacting the agent service." : e instanceof Error && e.message ? e.message : pa, Ta = (e) => {
|
|
2242
2242
|
if (e instanceof st) {
|
|
2243
2243
|
if (e.status === 403)
|
|
2244
|
-
return
|
|
2244
|
+
return Es;
|
|
2245
2245
|
if (e.status === 409)
|
|
2246
2246
|
return Cs;
|
|
2247
2247
|
if (e.status === 404)
|
|
2248
|
-
return
|
|
2248
|
+
return Ts;
|
|
2249
2249
|
}
|
|
2250
|
-
return
|
|
2251
|
-
},
|
|
2250
|
+
return bs;
|
|
2251
|
+
}, Xr = (e) => {
|
|
2252
2252
|
const t = {};
|
|
2253
2253
|
for (const a of e) {
|
|
2254
2254
|
const s = ln(a);
|
|
@@ -2258,8 +2258,8 @@ const ba = (e, t) => (a) => {
|
|
|
2258
2258
|
t[r] = s, t[a.id] = s;
|
|
2259
2259
|
}
|
|
2260
2260
|
return t;
|
|
2261
|
-
},
|
|
2262
|
-
const { jwt: t, headers: a, urls: s } = e, r = JSON.stringify(a ?? {}), l =
|
|
2261
|
+
}, Zr = (e) => JSON.stringify(e), en = (e, t) => JSON.stringify(e) === JSON.stringify(t), Qr = (e) => {
|
|
2262
|
+
const { jwt: t, headers: a, urls: s } = e, r = JSON.stringify(a ?? {}), l = Zr(s), i = ee(
|
|
2263
2263
|
() => new Pn({
|
|
2264
2264
|
token: t,
|
|
2265
2265
|
headers: a,
|
|
@@ -2273,9 +2273,9 @@ const ba = (e, t) => (a) => {
|
|
|
2273
2273
|
}, [i, r]);
|
|
2274
2274
|
const [p, c] = g([]), [A, f] = g(
|
|
2275
2275
|
[]
|
|
2276
|
-
), [
|
|
2277
|
-
(
|
|
2278
|
-
const O =
|
|
2276
|
+
), [N, _] = g({}), [y, h] = g("loading"), [T, P] = g(null), [U, D] = g(0), k = v(
|
|
2277
|
+
(E, M) => {
|
|
2278
|
+
const O = E.map(Ve), H = M.map(ka), Y = Xr(E);
|
|
2279
2279
|
c(
|
|
2280
2280
|
(Z) => en(Z, O) ? Z : O
|
|
2281
2281
|
), f(
|
|
@@ -2287,60 +2287,60 @@ const ba = (e, t) => (a) => {
|
|
|
2287
2287
|
[]
|
|
2288
2288
|
);
|
|
2289
2289
|
L(() => {
|
|
2290
|
-
let
|
|
2290
|
+
let E = !1;
|
|
2291
2291
|
return h("loading"), P(null), (async () => {
|
|
2292
2292
|
try {
|
|
2293
2293
|
const [M, O] = await Promise.all([
|
|
2294
2294
|
i.listAgents(),
|
|
2295
2295
|
i.listAgentDefinitions()
|
|
2296
2296
|
]);
|
|
2297
|
-
if (
|
|
2297
|
+
if (E)
|
|
2298
2298
|
return;
|
|
2299
2299
|
k(M, O);
|
|
2300
2300
|
} catch (M) {
|
|
2301
|
-
if (
|
|
2301
|
+
if (E)
|
|
2302
2302
|
return;
|
|
2303
2303
|
c([]), f([]), _({}), h("error"), P(Ca(M));
|
|
2304
2304
|
}
|
|
2305
2305
|
})(), () => {
|
|
2306
|
-
|
|
2306
|
+
E = !0;
|
|
2307
2307
|
};
|
|
2308
2308
|
}, [k, i, U]);
|
|
2309
2309
|
const m = v(() => {
|
|
2310
|
-
|
|
2310
|
+
D((E) => E + 1);
|
|
2311
2311
|
}, []), b = v(async () => {
|
|
2312
2312
|
try {
|
|
2313
|
-
const [
|
|
2313
|
+
const [E, M] = await Promise.all([
|
|
2314
2314
|
i.listAgents(),
|
|
2315
2315
|
i.listAgentDefinitions()
|
|
2316
2316
|
]);
|
|
2317
|
-
k(
|
|
2317
|
+
k(E, M);
|
|
2318
2318
|
} catch {
|
|
2319
2319
|
}
|
|
2320
2320
|
}, [k, i]), $ = v(
|
|
2321
|
-
async (
|
|
2321
|
+
async (E) => {
|
|
2322
2322
|
const [M, O] = await Promise.all([
|
|
2323
|
-
i.getAgentChecklist(
|
|
2324
|
-
i.getAgent(
|
|
2323
|
+
i.getAgentChecklist(E),
|
|
2324
|
+
i.getAgent(E).catch(() => null)
|
|
2325
2325
|
]);
|
|
2326
2326
|
return Ln(
|
|
2327
|
-
|
|
2327
|
+
E,
|
|
2328
2328
|
M,
|
|
2329
2329
|
O ?? void 0
|
|
2330
2330
|
);
|
|
2331
2331
|
},
|
|
2332
2332
|
[i]
|
|
2333
2333
|
), q = v(
|
|
2334
|
-
async (
|
|
2334
|
+
async (E) => i.listAllAgentResources(E),
|
|
2335
2335
|
[i]
|
|
2336
|
-
),
|
|
2336
|
+
), J = v(
|
|
2337
2337
|
async ({
|
|
2338
|
-
definition:
|
|
2338
|
+
definition: E,
|
|
2339
2339
|
invocationName: M
|
|
2340
2340
|
}) => {
|
|
2341
|
-
const O = await i.createAgent(
|
|
2341
|
+
const O = await i.createAgent(E.ref, {
|
|
2342
2342
|
invocationName: M
|
|
2343
|
-
}), H = await i.getAgent(O.id), Y =
|
|
2343
|
+
}), H = await i.getAgent(O.id), Y = Ve(H), Z = ln(H);
|
|
2344
2344
|
return c((ce) => [Y, ...ce]), Z && _((ce) => ({
|
|
2345
2345
|
...ce,
|
|
2346
2346
|
[Y.invocation_id]: Z,
|
|
@@ -2349,59 +2349,59 @@ const ba = (e, t) => (a) => {
|
|
|
2349
2349
|
},
|
|
2350
2350
|
[i]
|
|
2351
2351
|
), ge = v(
|
|
2352
|
-
async (
|
|
2353
|
-
const M = await i.archiveAgent(
|
|
2352
|
+
async (E) => {
|
|
2353
|
+
const M = await i.archiveAgent(E), O = Ve(M);
|
|
2354
2354
|
return c(
|
|
2355
2355
|
(H) => H.map(
|
|
2356
|
-
(Y) => Y.id === O.id || Y.id ===
|
|
2356
|
+
(Y) => Y.id === O.id || Y.id === E || Y.invocation_id === E ? O : Y
|
|
2357
2357
|
)
|
|
2358
2358
|
), O;
|
|
2359
2359
|
},
|
|
2360
2360
|
[i]
|
|
2361
2361
|
), be = v(
|
|
2362
|
-
async (
|
|
2363
|
-
const M = await i.unarchiveAgent(
|
|
2362
|
+
async (E) => {
|
|
2363
|
+
const M = await i.unarchiveAgent(E), O = Ve(M);
|
|
2364
2364
|
return c(
|
|
2365
2365
|
(H) => H.map(
|
|
2366
|
-
(Y) => Y.id === O.id || Y.id ===
|
|
2366
|
+
(Y) => Y.id === O.id || Y.id === E || Y.invocation_id === E ? O : Y
|
|
2367
2367
|
)
|
|
2368
2368
|
), O;
|
|
2369
2369
|
},
|
|
2370
2370
|
[i]
|
|
2371
|
-
), oe = v((
|
|
2371
|
+
), oe = v((E) => {
|
|
2372
2372
|
c(
|
|
2373
2373
|
(M) => M.filter(
|
|
2374
|
-
(O) => O.id !==
|
|
2374
|
+
(O) => O.id !== E && O.invocation_id !== E
|
|
2375
2375
|
)
|
|
2376
2376
|
);
|
|
2377
|
-
}, []), z = v((
|
|
2377
|
+
}, []), z = v((E) => {
|
|
2378
2378
|
c((M) => {
|
|
2379
2379
|
const O = M.map(
|
|
2380
|
-
(H) => H.id ===
|
|
2380
|
+
(H) => H.id === E.id || H.invocation_id === E.invocation_id ? { ...H, ...E } : H
|
|
2381
2381
|
);
|
|
2382
2382
|
return en(M, O) ? M : O;
|
|
2383
2383
|
});
|
|
2384
2384
|
}, []), pe = v(
|
|
2385
|
-
async (
|
|
2386
|
-
await i.deleteAgent(
|
|
2385
|
+
async (E) => {
|
|
2386
|
+
await i.deleteAgent(E), oe(E);
|
|
2387
2387
|
},
|
|
2388
2388
|
[i, oe]
|
|
2389
2389
|
), Ie = ee(
|
|
2390
|
-
() =>
|
|
2391
|
-
resolveOpeningMessage: (
|
|
2390
|
+
() => Ea(i, {
|
|
2391
|
+
resolveOpeningMessage: (E) => N[E.invocation_id] ?? N[E.id]
|
|
2392
2392
|
}),
|
|
2393
|
-
[i,
|
|
2393
|
+
[i, N]
|
|
2394
2394
|
);
|
|
2395
2395
|
return {
|
|
2396
2396
|
agents: p,
|
|
2397
2397
|
agentDefinitions: A,
|
|
2398
|
-
loadState:
|
|
2399
|
-
loadError:
|
|
2398
|
+
loadState: y,
|
|
2399
|
+
loadError: T,
|
|
2400
2400
|
reload: m,
|
|
2401
2401
|
refresh: b,
|
|
2402
2402
|
fetchAgentChecklist: $,
|
|
2403
2403
|
fetchAgentResources: q,
|
|
2404
|
-
createAgent:
|
|
2404
|
+
createAgent: J,
|
|
2405
2405
|
archiveAgent: ge,
|
|
2406
2406
|
unarchiveAgent: be,
|
|
2407
2407
|
deleteAgent: pe,
|
|
@@ -2409,8 +2409,8 @@ const ba = (e, t) => (a) => {
|
|
|
2409
2409
|
replaceAgent: z,
|
|
2410
2410
|
chatConnector: Ie
|
|
2411
2411
|
};
|
|
2412
|
-
},
|
|
2413
|
-
const { agent: t, jwt: a, headers: s, urls: r, chatId: l } = e, i = JSON.stringify(s ?? {}), p =
|
|
2412
|
+
}, ei = (e) => JSON.stringify(e), ti = (e) => {
|
|
2413
|
+
const { agent: t, jwt: a, headers: s, urls: r, chatId: l } = e, i = JSON.stringify(s ?? {}), p = ei(r), c = ee(
|
|
2414
2414
|
() => new Pn({
|
|
2415
2415
|
token: a,
|
|
2416
2416
|
headers: s,
|
|
@@ -2434,7 +2434,7 @@ const ba = (e, t) => (a) => {
|
|
|
2434
2434
|
c.setHeaders(s);
|
|
2435
2435
|
}, [c, i]);
|
|
2436
2436
|
const A = v(
|
|
2437
|
-
async (m) =>
|
|
2437
|
+
async (m) => Ve(await c.getAgent(m)),
|
|
2438
2438
|
[c]
|
|
2439
2439
|
), f = v(
|
|
2440
2440
|
async (m) => {
|
|
@@ -2449,33 +2449,33 @@ const ba = (e, t) => (a) => {
|
|
|
2449
2449
|
);
|
|
2450
2450
|
},
|
|
2451
2451
|
[c]
|
|
2452
|
-
),
|
|
2452
|
+
), N = v(
|
|
2453
2453
|
async (m) => c.listAllAgentResources(m),
|
|
2454
2454
|
[c]
|
|
2455
2455
|
), _ = v(
|
|
2456
2456
|
async (m) => c.getAgentContext(m),
|
|
2457
2457
|
[c]
|
|
2458
|
-
),
|
|
2458
|
+
), y = v(
|
|
2459
2459
|
async (m, b) => c.getAgentResourceHtml(m, b),
|
|
2460
2460
|
[c]
|
|
2461
2461
|
), h = v(
|
|
2462
2462
|
async (m) => {
|
|
2463
2463
|
const b = await c.getAgentTimeline(m);
|
|
2464
|
-
return
|
|
2464
|
+
return Hr(b);
|
|
2465
2465
|
},
|
|
2466
2466
|
[c]
|
|
2467
|
-
),
|
|
2467
|
+
), T = v(
|
|
2468
2468
|
async (m, b) => {
|
|
2469
2469
|
await c.updateAgent(m, { invocationName: b });
|
|
2470
2470
|
},
|
|
2471
2471
|
[c]
|
|
2472
2472
|
), P = v(
|
|
2473
|
-
async (m) =>
|
|
2473
|
+
async (m) => Ve(await c.archiveAgent(m)),
|
|
2474
2474
|
[c]
|
|
2475
2475
|
), U = v(
|
|
2476
|
-
async (m) =>
|
|
2476
|
+
async (m) => Ve(await c.unarchiveAgent(m)),
|
|
2477
2477
|
[c]
|
|
2478
|
-
),
|
|
2478
|
+
), D = v(
|
|
2479
2479
|
async (m) => {
|
|
2480
2480
|
await c.deleteAgent(m);
|
|
2481
2481
|
},
|
|
@@ -2483,7 +2483,7 @@ const ba = (e, t) => (a) => {
|
|
|
2483
2483
|
);
|
|
2484
2484
|
return {
|
|
2485
2485
|
connector: ee(
|
|
2486
|
-
() =>
|
|
2486
|
+
() => Ea(c, {
|
|
2487
2487
|
chatId: l ?? t.invocation_id
|
|
2488
2488
|
})(t),
|
|
2489
2489
|
// Key on invocation/chat ids so a new Agent object reference does not rebuild the connector.
|
|
@@ -2493,32 +2493,32 @@ const ba = (e, t) => (a) => {
|
|
|
2493
2493
|
fetchAgent: A,
|
|
2494
2494
|
fetchAgentChecklist: f,
|
|
2495
2495
|
fetchAgentContext: _,
|
|
2496
|
-
fetchAgentResources:
|
|
2497
|
-
fetchAgentResourceHtml:
|
|
2496
|
+
fetchAgentResources: N,
|
|
2497
|
+
fetchAgentResourceHtml: y,
|
|
2498
2498
|
fetchAgentTimeline: h,
|
|
2499
|
-
updateAgentInvocationName:
|
|
2499
|
+
updateAgentInvocationName: T,
|
|
2500
2500
|
archiveAgent: P,
|
|
2501
2501
|
unarchiveAgent: U,
|
|
2502
|
-
deleteAgent:
|
|
2502
|
+
deleteAgent: D
|
|
2503
2503
|
};
|
|
2504
|
-
},
|
|
2504
|
+
}, ni = 3e4, ai = (e, t) => {
|
|
2505
2505
|
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." : "";
|
|
2506
2506
|
return `${a}${s}.${r}`.trim();
|
|
2507
2507
|
}, aa = (e) => {
|
|
2508
2508
|
switch (e) {
|
|
2509
|
-
case
|
|
2509
|
+
case C.paused:
|
|
2510
2510
|
return G.paused;
|
|
2511
|
-
case
|
|
2511
|
+
case C.complete:
|
|
2512
2512
|
return G.complete;
|
|
2513
2513
|
default:
|
|
2514
2514
|
return G.running;
|
|
2515
2515
|
}
|
|
2516
|
-
},
|
|
2516
|
+
}, Cn = (e) => e === C.paused, sa = (e, t) => {
|
|
2517
2517
|
t([Re(e)]);
|
|
2518
|
-
},
|
|
2518
|
+
}, si = (e, t) => e.length === t.length && e.every((a, s) => {
|
|
2519
2519
|
const r = t[s];
|
|
2520
2520
|
return r !== void 0 && a.id === r.id && a.text === r.text;
|
|
2521
|
-
}),
|
|
2521
|
+
}), ri = ({
|
|
2522
2522
|
agent: e,
|
|
2523
2523
|
invocationId: t,
|
|
2524
2524
|
open: a,
|
|
@@ -2530,20 +2530,20 @@ const ba = (e, t) => (a) => {
|
|
|
2530
2530
|
agentResourcesUrl: c,
|
|
2531
2531
|
agentTimelineUrl: A,
|
|
2532
2532
|
agentChatUrl: f,
|
|
2533
|
-
agentConversationUrl:
|
|
2533
|
+
agentConversationUrl: N,
|
|
2534
2534
|
pauseAgentUrl: _,
|
|
2535
|
-
resumeAgentUrl:
|
|
2535
|
+
resumeAgentUrl: y,
|
|
2536
2536
|
archiveAgentUrl: h,
|
|
2537
|
-
unarchiveAgentUrl:
|
|
2537
|
+
unarchiveAgentUrl: T,
|
|
2538
2538
|
chatId: P,
|
|
2539
2539
|
enableUpload: U,
|
|
2540
|
-
adminMode:
|
|
2540
|
+
adminMode: D = !1,
|
|
2541
2541
|
initialBrief: k,
|
|
2542
2542
|
initialPhase: m,
|
|
2543
2543
|
initialChecklist: b,
|
|
2544
2544
|
usePusherToRepoll: $ = !1,
|
|
2545
|
-
pusherChannelPrefix: q =
|
|
2546
|
-
pusherKey:
|
|
2545
|
+
pusherChannelPrefix: q = Aa,
|
|
2546
|
+
pusherKey: J = "",
|
|
2547
2547
|
pusherCluster: ge = "",
|
|
2548
2548
|
subscribeToPusher: be,
|
|
2549
2549
|
onArchived: oe,
|
|
@@ -2551,38 +2551,38 @@ const ba = (e, t) => (a) => {
|
|
|
2551
2551
|
onDeleted: pe,
|
|
2552
2552
|
onAgentUpdated: Ie
|
|
2553
2553
|
}) => {
|
|
2554
|
-
const [
|
|
2554
|
+
const [E, M] = g(P ?? t), [O, H] = g("chat"), [Y, Z] = g(!1), {
|
|
2555
2555
|
connector: ce,
|
|
2556
2556
|
fetchAgent: lt,
|
|
2557
2557
|
fetchAgentChecklist: Ye,
|
|
2558
|
-
fetchAgentContext:
|
|
2559
|
-
fetchAgentResources:
|
|
2560
|
-
fetchAgentResourceHtml:
|
|
2561
|
-
fetchAgentTimeline:
|
|
2558
|
+
fetchAgentContext: xt,
|
|
2559
|
+
fetchAgentResources: je,
|
|
2560
|
+
fetchAgentResourceHtml: We,
|
|
2561
|
+
fetchAgentTimeline: Ne,
|
|
2562
2562
|
updateAgentInvocationName: Le,
|
|
2563
2563
|
archiveAgent: ot,
|
|
2564
2564
|
unarchiveAgent: ct,
|
|
2565
2565
|
deleteAgent: le
|
|
2566
|
-
} =
|
|
2566
|
+
} = ti({
|
|
2567
2567
|
agent: { ...e, invocation_id: t },
|
|
2568
2568
|
jwt: r,
|
|
2569
2569
|
headers: l,
|
|
2570
|
-
chatId:
|
|
2570
|
+
chatId: E,
|
|
2571
2571
|
urls: {
|
|
2572
2572
|
agentUrl: i,
|
|
2573
2573
|
agentChecklistUrl: p,
|
|
2574
2574
|
agentResourcesUrl: c,
|
|
2575
2575
|
agentTimelineUrl: A,
|
|
2576
2576
|
agentChatUrl: f,
|
|
2577
|
-
agentConversationUrl:
|
|
2577
|
+
agentConversationUrl: N,
|
|
2578
2578
|
pauseAgentUrl: _,
|
|
2579
|
-
resumeAgentUrl:
|
|
2579
|
+
resumeAgentUrl: y,
|
|
2580
2580
|
archiveAgentUrl: h,
|
|
2581
|
-
unarchiveAgentUrl:
|
|
2581
|
+
unarchiveAgentUrl: T
|
|
2582
2582
|
}
|
|
2583
|
-
}), Q = ae(ce), [Pe,
|
|
2583
|
+
}), Q = ae(ce), [Pe, Ee] = g(e.invocation_name), [Xe, dt] = g(0), [Ue, ut] = g(null), [W, me] = g(
|
|
2584
2584
|
m ?? (k ? G.running : aa(e.status))
|
|
2585
|
-
), [ht, se] = g([]), [on,
|
|
2585
|
+
), [ht, se] = g([]), [on, ye] = g(0), [cn, gt] = g(), [Ze, De] = g(null), [pt, mt] = g([]), [dn, xe] = g(!1), [$e, Me] = g(null), [_t, ft] = g(null), [un, Ce] = g(null), [$t, _e] = g(!1), [Mt, Te] = g(null), [Se, vt] = g(null), [hn, wt] = g(!1), [Ht, He] = g(null), [Be, Nt] = g(b ?? null), [Bt, zt] = g(!1), [gn, yt] = g(null), [pn, Gt] = g(void 0), [At, Ft] = g(!1), [kt, bt] = g(!1), [mn, Et] = g(null), [qt, Kt] = g(!1), [Ct, d] = g(!1), [S, R] = g(!1), [re, Ae] = g(!1), [Qe, fe] = g(null), [Tt, Un] = g(!1), [Oa, _n] = g(!1), [Ia, Vt] = g(null), [Dn, xn] = g(!1), [La, fn] = g(!1), [Pa, Jt] = g(null), [$n, ie] = g(null), [Ua, St] = g(() => Cn(e.status)), [Da, Mn] = g(e.archivedAt ?? null), K = !!Da, [Yt, Rt] = g(!1), [jt, xa] = g(!1), [Wt, $a] = g(!1), Hn = ae(Yt), Bn = ae(e.invocation_name), et = ae(e), ve = ae(Ie), zn = ae(0), Gn = ae(0), tt = ae(0), Ot = ae(0);
|
|
2586
2586
|
ve.current = Ie, L(() => {
|
|
2587
2587
|
Mn(e.archivedAt ?? null);
|
|
2588
2588
|
}, [e.archivedAt]), L(() => {
|
|
@@ -2594,11 +2594,11 @@ const ba = (e, t) => (a) => {
|
|
|
2594
2594
|
}, [e]), L(() => {
|
|
2595
2595
|
Hn.current = Yt;
|
|
2596
2596
|
}, [Yt]), L(() => {
|
|
2597
|
-
M(P ?? t), H("chat"), Z(!1), se([]),
|
|
2598
|
-
}, [t, P]), L(() => (tt.current += 1, Gt(void 0), Ft(!1), bt(!1),
|
|
2597
|
+
M(P ?? t), H("chat"), Z(!1), se([]), ye((u) => u + 1), ut(null);
|
|
2598
|
+
}, [t, P]), L(() => (tt.current += 1, Gt(void 0), Ft(!1), bt(!1), Et(null), () => {
|
|
2599
2599
|
tt.current += 1;
|
|
2600
2600
|
}), [t]), L(() => {
|
|
2601
|
-
|
|
2601
|
+
St(Cn(e.status));
|
|
2602
2602
|
}, [e.status, t]), L(() => {
|
|
2603
2603
|
if (!a || k || K)
|
|
2604
2604
|
return;
|
|
@@ -2609,14 +2609,14 @@ const ba = (e, t) => (a) => {
|
|
|
2609
2609
|
const I = await lt(t);
|
|
2610
2610
|
if (u !== Ot.current)
|
|
2611
2611
|
return;
|
|
2612
|
-
me(aa(I.status)),
|
|
2612
|
+
me(aa(I.status)), St(Cn(I.status)), et.current = I, (w = ve.current) == null || w.call(ve, I);
|
|
2613
2613
|
} catch {
|
|
2614
2614
|
}
|
|
2615
2615
|
})(), () => {
|
|
2616
2616
|
Ot.current += 1;
|
|
2617
2617
|
};
|
|
2618
2618
|
}, [a, t, k, K, lt]), L(() => {
|
|
2619
|
-
|
|
2619
|
+
Ee(e.invocation_name), dt((u) => u + 1);
|
|
2620
2620
|
}, [e.invocation_name]), L(() => {
|
|
2621
2621
|
K && H("timeline");
|
|
2622
2622
|
}, [K]), L(() => {
|
|
@@ -2642,7 +2642,7 @@ const ba = (e, t) => (a) => {
|
|
|
2642
2642
|
})(), () => {
|
|
2643
2643
|
w = !0;
|
|
2644
2644
|
};
|
|
2645
|
-
}, [a, k, K, t,
|
|
2645
|
+
}, [a, k, K, t, E]);
|
|
2646
2646
|
const ze = v(() => {
|
|
2647
2647
|
const u = ++zn.current;
|
|
2648
2648
|
(async () => {
|
|
@@ -2651,25 +2651,25 @@ const ba = (e, t) => (a) => {
|
|
|
2651
2651
|
const te = await Ye(t);
|
|
2652
2652
|
if (u !== zn.current)
|
|
2653
2653
|
return;
|
|
2654
|
-
|
|
2654
|
+
Nt((de) => te.checklist.length === 0 && Array.isArray(de) && de.length > 0 || JSON.stringify(de) === JSON.stringify(te.checklist) ? de : te.checklist), yt(null), (I = (w = Q.current).seedChecklist) == null || I.call(w, te.checklist);
|
|
2655
2655
|
} catch {
|
|
2656
2656
|
}
|
|
2657
2657
|
})();
|
|
2658
2658
|
}, [Ye, t]), Ge = v(() => {
|
|
2659
2659
|
c && (async () => {
|
|
2660
2660
|
try {
|
|
2661
|
-
const u = await
|
|
2661
|
+
const u = await je(t);
|
|
2662
2662
|
mt(u), Me(null);
|
|
2663
2663
|
} catch {
|
|
2664
2664
|
}
|
|
2665
2665
|
})();
|
|
2666
|
-
}, [c,
|
|
2666
|
+
}, [c, je, t]), ke = v(() => {
|
|
2667
2667
|
if (!A)
|
|
2668
2668
|
return;
|
|
2669
2669
|
const u = ++Gn.current;
|
|
2670
2670
|
(async () => {
|
|
2671
2671
|
try {
|
|
2672
|
-
const w = await
|
|
2672
|
+
const w = await Ne(t);
|
|
2673
2673
|
if (u !== Gn.current)
|
|
2674
2674
|
return;
|
|
2675
2675
|
vt(
|
|
@@ -2678,7 +2678,7 @@ const ba = (e, t) => (a) => {
|
|
|
2678
2678
|
} catch {
|
|
2679
2679
|
}
|
|
2680
2680
|
})();
|
|
2681
|
-
}, [A,
|
|
2681
|
+
}, [A, Ne, t]), It = v(
|
|
2682
2682
|
(u) => {
|
|
2683
2683
|
const w = Q.current.bootstrapConversation;
|
|
2684
2684
|
w && (async () => {
|
|
@@ -2688,13 +2688,13 @@ const ba = (e, t) => (a) => {
|
|
|
2688
2688
|
return;
|
|
2689
2689
|
const te = I.map(Re);
|
|
2690
2690
|
let de = !1;
|
|
2691
|
-
se((nt) =>
|
|
2691
|
+
se((nt) => si(nt, te) ? nt : (de = !0, te)), de && (u != null && u.refreshSidePanelsOnChange) && (ze(), ke());
|
|
2692
2692
|
} catch {
|
|
2693
2693
|
}
|
|
2694
2694
|
})();
|
|
2695
2695
|
},
|
|
2696
2696
|
[ze, ke]
|
|
2697
|
-
),
|
|
2697
|
+
), Ma = v(
|
|
2698
2698
|
(u) => {
|
|
2699
2699
|
switch (u) {
|
|
2700
2700
|
case qe.checklist:
|
|
@@ -2715,33 +2715,33 @@ const ba = (e, t) => (a) => {
|
|
|
2715
2715
|
}
|
|
2716
2716
|
},
|
|
2717
2717
|
[ze, It, Ge, ke]
|
|
2718
|
-
),
|
|
2718
|
+
), Ha = Sr({
|
|
2719
2719
|
enabled: !!(a && $ && !be),
|
|
2720
|
-
key:
|
|
2720
|
+
key: J,
|
|
2721
2721
|
cluster: ge,
|
|
2722
|
-
isAdmin:
|
|
2723
|
-
}),
|
|
2722
|
+
isAdmin: D
|
|
2723
|
+
}), Ba = be ?? Ha, Fn = br({
|
|
2724
2724
|
enabled: a && $,
|
|
2725
2725
|
channelPrefix: q,
|
|
2726
2726
|
agentId: e.id,
|
|
2727
|
-
subscribeToPusher:
|
|
2728
|
-
onRepoll:
|
|
2727
|
+
subscribeToPusher: Ba,
|
|
2728
|
+
onRepoll: Ma
|
|
2729
2729
|
});
|
|
2730
2730
|
L(() => {
|
|
2731
2731
|
if (!a || k || K || Fn)
|
|
2732
2732
|
return;
|
|
2733
2733
|
const u = window.setInterval(() => {
|
|
2734
2734
|
It({ refreshSidePanelsOnChange: !0 });
|
|
2735
|
-
},
|
|
2735
|
+
}, ni);
|
|
2736
2736
|
return () => {
|
|
2737
2737
|
window.clearInterval(u);
|
|
2738
2738
|
};
|
|
2739
|
-
}, [a, k, K, Fn, t,
|
|
2739
|
+
}, [a, k, K, Fn, t, E, It]);
|
|
2740
2740
|
const Xt = v(
|
|
2741
2741
|
(u) => {
|
|
2742
2742
|
var w, I;
|
|
2743
2743
|
if (u && u.length > 0) {
|
|
2744
|
-
|
|
2744
|
+
Nt(u), (I = (w = Q.current).seedChecklist) == null || I.call(w, u);
|
|
2745
2745
|
return;
|
|
2746
2746
|
}
|
|
2747
2747
|
ze();
|
|
@@ -2760,15 +2760,15 @@ const ba = (e, t) => (a) => {
|
|
|
2760
2760
|
if (!a || k)
|
|
2761
2761
|
return;
|
|
2762
2762
|
let u = !1;
|
|
2763
|
-
return zt((w) => b != null && b.length ? !1 : w || Be === null || Be.length === 0),
|
|
2763
|
+
return zt((w) => b != null && b.length ? !1 : w || Be === null || Be.length === 0), yt(null), (async () => {
|
|
2764
2764
|
var w, I;
|
|
2765
2765
|
try {
|
|
2766
2766
|
const te = await Ye(t);
|
|
2767
2767
|
if (u)
|
|
2768
2768
|
return;
|
|
2769
|
-
b != null && b.length || (
|
|
2769
|
+
b != null && b.length || (Nt(te.checklist), (I = (w = Q.current).seedChecklist) == null || I.call(w, te.checklist));
|
|
2770
2770
|
} catch {
|
|
2771
|
-
!u && !(b != null && b.length) &&
|
|
2771
|
+
!u && !(b != null && b.length) && yt(tn);
|
|
2772
2772
|
} finally {
|
|
2773
2773
|
u || zt(!1);
|
|
2774
2774
|
}
|
|
@@ -2779,57 +2779,57 @@ const ba = (e, t) => (a) => {
|
|
|
2779
2779
|
if (!a || !c)
|
|
2780
2780
|
return;
|
|
2781
2781
|
let u = !1;
|
|
2782
|
-
return
|
|
2782
|
+
return xe(!0), Me(null), (async () => {
|
|
2783
2783
|
try {
|
|
2784
|
-
const w = await
|
|
2784
|
+
const w = await je(t);
|
|
2785
2785
|
u || mt(w);
|
|
2786
2786
|
} catch {
|
|
2787
|
-
u || Me(
|
|
2787
|
+
u || Me(_s);
|
|
2788
2788
|
} finally {
|
|
2789
|
-
u ||
|
|
2789
|
+
u || xe(!1);
|
|
2790
2790
|
}
|
|
2791
2791
|
})(), () => {
|
|
2792
2792
|
u = !0;
|
|
2793
2793
|
};
|
|
2794
|
-
}, [a, t, c,
|
|
2795
|
-
const
|
|
2796
|
-
ft(null),
|
|
2797
|
-
}, []),
|
|
2794
|
+
}, [a, t, c, je]);
|
|
2795
|
+
const za = v(() => {
|
|
2796
|
+
ft(null), Ce(null), Te(null), _e(!1);
|
|
2797
|
+
}, []), Ga = v(
|
|
2798
2798
|
(u) => {
|
|
2799
2799
|
if (u.misRecordUrl) {
|
|
2800
2800
|
window.open(u.misRecordUrl, "_blank", "noopener,noreferrer");
|
|
2801
2801
|
return;
|
|
2802
2802
|
}
|
|
2803
|
-
ft(u),
|
|
2803
|
+
ft(u), Ce(null), Te(null), _e(!0), (async () => {
|
|
2804
2804
|
try {
|
|
2805
|
-
const w = await
|
|
2806
|
-
|
|
2805
|
+
const w = await We(t, u.id);
|
|
2806
|
+
Ce(w);
|
|
2807
2807
|
} catch {
|
|
2808
|
-
|
|
2808
|
+
Te(fs);
|
|
2809
2809
|
} finally {
|
|
2810
2810
|
_e(!1);
|
|
2811
2811
|
}
|
|
2812
2812
|
})();
|
|
2813
2813
|
},
|
|
2814
|
-
[
|
|
2814
|
+
[We, t]
|
|
2815
2815
|
);
|
|
2816
2816
|
L(() => {
|
|
2817
2817
|
if (!a || !A)
|
|
2818
2818
|
return;
|
|
2819
2819
|
let u = !1;
|
|
2820
|
-
return wt((w) => w ||
|
|
2820
|
+
return wt((w) => w || Se === null), He(null), (async () => {
|
|
2821
2821
|
try {
|
|
2822
|
-
const w = await
|
|
2822
|
+
const w = await Ne(t);
|
|
2823
2823
|
u || vt(w);
|
|
2824
2824
|
} catch {
|
|
2825
|
-
u || He(
|
|
2825
|
+
u || He(ga);
|
|
2826
2826
|
} finally {
|
|
2827
2827
|
u || wt(!1);
|
|
2828
2828
|
}
|
|
2829
2829
|
})(), () => {
|
|
2830
2830
|
u = !0;
|
|
2831
2831
|
};
|
|
2832
|
-
}, [a, t, A,
|
|
2832
|
+
}, [a, t, A, Ne]), L(() => {
|
|
2833
2833
|
if (!a || !k)
|
|
2834
2834
|
return;
|
|
2835
2835
|
let u = !1;
|
|
@@ -2837,7 +2837,7 @@ const ba = (e, t) => (a) => {
|
|
|
2837
2837
|
id: `user-brief-${Date.now()}`,
|
|
2838
2838
|
author: he.user,
|
|
2839
2839
|
// Read through a ref so a rename cannot re-trigger the agent run.
|
|
2840
|
-
text:
|
|
2840
|
+
text: ai(k, Bn.current)
|
|
2841
2841
|
};
|
|
2842
2842
|
return (async () => {
|
|
2843
2843
|
const I = await Q.current.start(k);
|
|
@@ -2850,35 +2850,35 @@ const ba = (e, t) => (a) => {
|
|
|
2850
2850
|
u = !0;
|
|
2851
2851
|
};
|
|
2852
2852
|
}, [a, k, t, Xt, Ge, ke]);
|
|
2853
|
-
const
|
|
2854
|
-
|
|
2855
|
-
}, []), wn = P ?? t, Zt =
|
|
2853
|
+
const Fa = v((u) => {
|
|
2854
|
+
De(mr(u));
|
|
2855
|
+
}, []), wn = P ?? t, Zt = Se == null ? void 0 : Se.chatSessions, qn = Zt != null && Zt.length ? Zt.reduce(
|
|
2856
2856
|
(u, w) => Date.parse(w.timestamp) < Date.parse(u.timestamp) ? w : u
|
|
2857
|
-
).sessionId : void 0,
|
|
2858
|
-
H("chat"), Z(!1),
|
|
2859
|
-
}, [
|
|
2857
|
+
).sessionId : void 0, Nn = v(() => {
|
|
2858
|
+
H("chat"), Z(!1), E !== wn && (M(wn), se([]), ye((u) => u + 1));
|
|
2859
|
+
}, [E, wn]), qa = v(
|
|
2860
2860
|
(u) => {
|
|
2861
2861
|
if (u === qn) {
|
|
2862
|
-
|
|
2862
|
+
Nn();
|
|
2863
2863
|
return;
|
|
2864
2864
|
}
|
|
2865
|
-
M(u), Z(!0), H("chat"), se([]),
|
|
2865
|
+
M(u), Z(!0), H("chat"), se([]), ye((w) => w + 1);
|
|
2866
2866
|
},
|
|
2867
|
-
[qn,
|
|
2868
|
-
),
|
|
2869
|
-
|
|
2870
|
-
}, []),
|
|
2867
|
+
[qn, Nn]
|
|
2868
|
+
), Ka = v((u) => {
|
|
2869
|
+
De(null), gt(u), ye((w) => w + 1);
|
|
2870
|
+
}, []), Va = v(async () => {
|
|
2871
2871
|
var u;
|
|
2872
2872
|
ie(null), Kt(!0);
|
|
2873
2873
|
try {
|
|
2874
|
-
await Q.current.pause(), Ot.current += 1, me(G.paused),
|
|
2874
|
+
await Q.current.pause(), Ot.current += 1, me(G.paused), St(!0);
|
|
2875
2875
|
const w = {
|
|
2876
2876
|
...et.current,
|
|
2877
|
-
status:
|
|
2877
|
+
status: C.paused
|
|
2878
2878
|
};
|
|
2879
2879
|
et.current = w, (u = ve.current) == null || u.call(ve, w);
|
|
2880
2880
|
} catch {
|
|
2881
|
-
ie(
|
|
2881
|
+
ie(vs);
|
|
2882
2882
|
} finally {
|
|
2883
2883
|
Kt(!1);
|
|
2884
2884
|
}
|
|
@@ -2887,110 +2887,110 @@ const ba = (e, t) => (a) => {
|
|
|
2887
2887
|
ie(null), d(!0);
|
|
2888
2888
|
let u = !1;
|
|
2889
2889
|
try {
|
|
2890
|
-
await Q.current.resume(), u = !0, Ot.current += 1, me(G.running),
|
|
2890
|
+
await Q.current.resume(), u = !0, Ot.current += 1, me(G.running), St(!1);
|
|
2891
2891
|
const I = {
|
|
2892
2892
|
...et.current,
|
|
2893
|
-
status:
|
|
2893
|
+
status: C["generating-a-response"]
|
|
2894
2894
|
};
|
|
2895
2895
|
et.current = I, (w = ve.current) == null || w.call(ve, I), Rt(!0);
|
|
2896
2896
|
const te = {
|
|
2897
2897
|
id: `wake-${Date.now()}`,
|
|
2898
2898
|
author: he.user,
|
|
2899
|
-
text:
|
|
2899
|
+
text: Vn
|
|
2900
2900
|
};
|
|
2901
2901
|
se((nt) => [...nt, Re(te)]);
|
|
2902
|
-
const de = await Q.current.sendMessage(
|
|
2902
|
+
const de = await Q.current.sendMessage(Vn);
|
|
2903
2903
|
se((nt) => [...nt, Re(de.message)]), vn(de);
|
|
2904
2904
|
} catch {
|
|
2905
|
-
ie(u ?
|
|
2905
|
+
ie(u ? Is : Os);
|
|
2906
2906
|
} finally {
|
|
2907
2907
|
d(!1), Rt(!1);
|
|
2908
2908
|
}
|
|
2909
|
-
}, [vn]),
|
|
2909
|
+
}, [vn]), Ya = v(async () => {
|
|
2910
2910
|
ie(null), fe(null), R(!0);
|
|
2911
2911
|
try {
|
|
2912
2912
|
await ot(t), Ae(!1), oe == null || oe(), s();
|
|
2913
2913
|
} catch {
|
|
2914
|
-
fe(
|
|
2914
|
+
fe(Tn), ie(Tn);
|
|
2915
2915
|
} finally {
|
|
2916
2916
|
R(!1);
|
|
2917
2917
|
}
|
|
2918
|
-
}, [t, ot, oe, s]),
|
|
2919
|
-
ie(null),
|
|
2918
|
+
}, [t, ot, oe, s]), ja = v(async () => {
|
|
2919
|
+
ie(null), Vt(null), Un(!0);
|
|
2920
2920
|
try {
|
|
2921
|
-
await ct(t), Mn(null), me(G.paused),
|
|
2921
|
+
await ct(t), Mn(null), me(G.paused), St(!0), H("chat"), _n(!1), z == null || z();
|
|
2922
2922
|
} catch {
|
|
2923
|
-
|
|
2923
|
+
Vt(Sn), ie(Sn);
|
|
2924
2924
|
} finally {
|
|
2925
2925
|
Un(!1);
|
|
2926
2926
|
}
|
|
2927
2927
|
}, [t, ct, z]), Wa = v(async () => {
|
|
2928
|
-
ie(null),
|
|
2928
|
+
ie(null), Jt(null), xn(!0);
|
|
2929
2929
|
try {
|
|
2930
2930
|
await le(t), fn(!1), pe == null || pe(), s();
|
|
2931
2931
|
} catch (u) {
|
|
2932
|
-
|
|
2932
|
+
Jt(Ta(u));
|
|
2933
2933
|
} finally {
|
|
2934
|
-
|
|
2934
|
+
xn(!1);
|
|
2935
2935
|
}
|
|
2936
|
-
}, [t, le, pe, s]),
|
|
2936
|
+
}, [t, le, pe, s]), Xa = v(
|
|
2937
2937
|
(u) => {
|
|
2938
2938
|
const w = u.trim(), I = Pe;
|
|
2939
2939
|
if (ut(null), !w) {
|
|
2940
2940
|
dt((te) => te + 1);
|
|
2941
2941
|
return;
|
|
2942
2942
|
}
|
|
2943
|
-
w !== I && (
|
|
2943
|
+
w !== I && (Ee(w), (async () => {
|
|
2944
2944
|
try {
|
|
2945
2945
|
await Le(t, w);
|
|
2946
2946
|
} catch {
|
|
2947
|
-
|
|
2947
|
+
Ee(I), dt((te) => te + 1), ut(Ls);
|
|
2948
2948
|
}
|
|
2949
2949
|
})());
|
|
2950
2950
|
},
|
|
2951
2951
|
[Pe, t, Le]
|
|
2952
|
-
),
|
|
2953
|
-
if (!
|
|
2952
|
+
), Za = v(() => {
|
|
2953
|
+
if (!D || At || kt)
|
|
2954
2954
|
return;
|
|
2955
2955
|
const u = ++tt.current;
|
|
2956
|
-
bt(!0),
|
|
2956
|
+
bt(!0), Et(null), (async () => {
|
|
2957
2957
|
try {
|
|
2958
|
-
const w = await
|
|
2958
|
+
const w = await xt(t);
|
|
2959
2959
|
if (tt.current !== u)
|
|
2960
2960
|
return;
|
|
2961
2961
|
Gt(w), Ft(!0);
|
|
2962
2962
|
} catch {
|
|
2963
|
-
tt.current === u &&
|
|
2963
|
+
tt.current === u && Et(ms);
|
|
2964
2964
|
} finally {
|
|
2965
2965
|
tt.current === u && bt(!1);
|
|
2966
2966
|
}
|
|
2967
2967
|
})();
|
|
2968
2968
|
}, [
|
|
2969
|
-
|
|
2969
|
+
D,
|
|
2970
2970
|
At,
|
|
2971
2971
|
kt,
|
|
2972
|
-
|
|
2972
|
+
xt,
|
|
2973
2973
|
t
|
|
2974
|
-
]),
|
|
2974
|
+
]), Qa = Be;
|
|
2975
2975
|
return /* @__PURE__ */ o(ue, { children: [
|
|
2976
2976
|
/* @__PURE__ */ o(X, { open: a, closeHandler: s, hideCloseButton: !0, className: "agent-workspace", children: [
|
|
2977
2977
|
/* @__PURE__ */ o(X.Header, { className: "agent-workspace__header", children: [
|
|
2978
2978
|
/* @__PURE__ */ o("div", { className: "agent-workspace__header-title", children: [
|
|
2979
|
-
/* @__PURE__ */ n("span", { className: "agent-workspace__header-avatar", "aria-hidden": "true", children: /* @__PURE__ */ n(
|
|
2979
|
+
/* @__PURE__ */ n("span", { className: "agent-workspace__header-avatar", "aria-hidden": "true", children: /* @__PURE__ */ n(x, { name: "ask-arbor", size: 24 }) }),
|
|
2980
2980
|
/* @__PURE__ */ n(X.Title, { children: K ? /* @__PURE__ */ n("span", { className: "agent-workspace__header-name", children: Pe }) : /* @__PURE__ */ n(
|
|
2981
|
-
|
|
2981
|
+
ts,
|
|
2982
2982
|
{
|
|
2983
2983
|
className: "agent-workspace__header-name",
|
|
2984
2984
|
text: Pe,
|
|
2985
|
-
onEditSave:
|
|
2985
|
+
onEditSave: Xa
|
|
2986
2986
|
},
|
|
2987
2987
|
Xe
|
|
2988
2988
|
) }),
|
|
2989
2989
|
/* @__PURE__ */ n(
|
|
2990
2990
|
"span",
|
|
2991
2991
|
{
|
|
2992
|
-
className: ne("agent-workspace__phase", `agent-workspace__phase--${
|
|
2993
|
-
children:
|
|
2992
|
+
className: ne("agent-workspace__phase", `agent-workspace__phase--${W}`),
|
|
2993
|
+
children: Ds[W]
|
|
2994
2994
|
}
|
|
2995
2995
|
),
|
|
2996
2996
|
K ? /* @__PURE__ */ n("span", { className: "agent-workspace__phase agent-workspace__phase--archived", children: "Archived" }) : null,
|
|
@@ -3000,11 +3000,11 @@ const ba = (e, t) => (a) => {
|
|
|
3000
3000
|
/* @__PURE__ */ n(
|
|
3001
3001
|
F,
|
|
3002
3002
|
{
|
|
3003
|
-
variant:
|
|
3003
|
+
variant: jt ? "secondary" : "primary",
|
|
3004
3004
|
size: "S",
|
|
3005
3005
|
iconLeftName: "clipboard-list",
|
|
3006
3006
|
iconLeftScreenReaderText: "Toggle checklist",
|
|
3007
|
-
"aria-pressed": !
|
|
3007
|
+
"aria-pressed": !jt,
|
|
3008
3008
|
onClick: () => xa((u) => !u),
|
|
3009
3009
|
children: "Checklist"
|
|
3010
3010
|
}
|
|
@@ -3012,12 +3012,12 @@ const ba = (e, t) => (a) => {
|
|
|
3012
3012
|
/* @__PURE__ */ n(
|
|
3013
3013
|
F,
|
|
3014
3014
|
{
|
|
3015
|
-
variant:
|
|
3015
|
+
variant: Wt ? "secondary" : "primary",
|
|
3016
3016
|
size: "S",
|
|
3017
3017
|
iconLeftName: "files",
|
|
3018
3018
|
iconLeftScreenReaderText: "Toggle resources",
|
|
3019
|
-
"aria-pressed": !
|
|
3020
|
-
onClick: () =>
|
|
3019
|
+
"aria-pressed": !Wt,
|
|
3020
|
+
onClick: () => $a((u) => !u),
|
|
3021
3021
|
children: "Resources"
|
|
3022
3022
|
}
|
|
3023
3023
|
),
|
|
@@ -3038,8 +3038,8 @@ const ba = (e, t) => (a) => {
|
|
|
3038
3038
|
X.Body,
|
|
3039
3039
|
{
|
|
3040
3040
|
className: ne("agent-workspace__body", {
|
|
3041
|
-
"agent-workspace__body--no-checklist":
|
|
3042
|
-
"agent-workspace__body--no-resources":
|
|
3041
|
+
"agent-workspace__body--no-checklist": jt,
|
|
3042
|
+
"agent-workspace__body--no-resources": Wt
|
|
3043
3043
|
}),
|
|
3044
3044
|
children: [
|
|
3045
3045
|
/* @__PURE__ */ o(
|
|
@@ -3051,8 +3051,8 @@ const ba = (e, t) => (a) => {
|
|
|
3051
3051
|
"aria-label": "Agent",
|
|
3052
3052
|
children: [
|
|
3053
3053
|
/* @__PURE__ */ o("div", { className: "agent-workspace__panel-header", children: [
|
|
3054
|
-
/* @__PURE__ */ n(
|
|
3055
|
-
_ && !K &&
|
|
3054
|
+
/* @__PURE__ */ n(Je, { level: 4, children: "Agent" }),
|
|
3055
|
+
_ && !K && W === G.running && /* @__PURE__ */ n(
|
|
3056
3056
|
F,
|
|
3057
3057
|
{
|
|
3058
3058
|
className: "agent-workspace__panel-header-action",
|
|
@@ -3061,11 +3061,11 @@ const ba = (e, t) => (a) => {
|
|
|
3061
3061
|
iconLeftName: "circle-x",
|
|
3062
3062
|
iconLeftScreenReaderText: "Pause",
|
|
3063
3063
|
disabled: qt,
|
|
3064
|
-
onClick: () => void
|
|
3064
|
+
onClick: () => void Va(),
|
|
3065
3065
|
children: qt ? "Pausing…" : "Pause agent"
|
|
3066
3066
|
}
|
|
3067
3067
|
),
|
|
3068
|
-
|
|
3068
|
+
y && !K && W === G.paused && Ua && /* @__PURE__ */ n(
|
|
3069
3069
|
F,
|
|
3070
3070
|
{
|
|
3071
3071
|
className: "agent-workspace__panel-header-action",
|
|
@@ -3073,9 +3073,9 @@ const ba = (e, t) => (a) => {
|
|
|
3073
3073
|
size: "S",
|
|
3074
3074
|
iconLeftName: "iteration-ccw",
|
|
3075
3075
|
iconLeftScreenReaderText: "Resume",
|
|
3076
|
-
disabled:
|
|
3076
|
+
disabled: Ct,
|
|
3077
3077
|
onClick: () => void Ja(),
|
|
3078
|
-
children:
|
|
3078
|
+
children: Ct ? "Resuming…" : "Resume agent"
|
|
3079
3079
|
}
|
|
3080
3080
|
),
|
|
3081
3081
|
h && !K && /* @__PURE__ */ n(
|
|
@@ -3092,26 +3092,26 @@ const ba = (e, t) => (a) => {
|
|
|
3092
3092
|
children: "Archive agent"
|
|
3093
3093
|
}
|
|
3094
3094
|
),
|
|
3095
|
-
|
|
3095
|
+
T && K && /* @__PURE__ */ n(
|
|
3096
3096
|
F,
|
|
3097
3097
|
{
|
|
3098
3098
|
className: "agent-workspace__panel-header-action",
|
|
3099
3099
|
variant: "secondary",
|
|
3100
3100
|
size: "S",
|
|
3101
3101
|
onClick: () => {
|
|
3102
|
-
|
|
3102
|
+
Vt(null), ie(null), _n(!0);
|
|
3103
3103
|
},
|
|
3104
3104
|
children: "Unarchive agent"
|
|
3105
3105
|
}
|
|
3106
3106
|
),
|
|
3107
|
-
|
|
3107
|
+
D && K && /* @__PURE__ */ n(
|
|
3108
3108
|
F,
|
|
3109
3109
|
{
|
|
3110
3110
|
className: "agent-workspace__panel-header-action",
|
|
3111
3111
|
variant: "secondary-destructive",
|
|
3112
3112
|
size: "S",
|
|
3113
3113
|
onClick: () => {
|
|
3114
|
-
|
|
3114
|
+
Jt(null), ie(null), fn(!0);
|
|
3115
3115
|
},
|
|
3116
3116
|
children: "Delete agent"
|
|
3117
3117
|
}
|
|
@@ -3149,17 +3149,17 @@ const ba = (e, t) => (a) => {
|
|
|
3149
3149
|
size: "S",
|
|
3150
3150
|
iconLeftName: "arrow-left",
|
|
3151
3151
|
iconLeftScreenReaderText: "Back to main chat",
|
|
3152
|
-
onClick:
|
|
3152
|
+
onClick: Nn,
|
|
3153
3153
|
children: "Back to main chat"
|
|
3154
3154
|
}
|
|
3155
3155
|
) }),
|
|
3156
3156
|
A && (K || O === "timeline") && /* @__PURE__ */ n(
|
|
3157
|
-
|
|
3157
|
+
gr,
|
|
3158
3158
|
{
|
|
3159
|
-
timeline:
|
|
3159
|
+
timeline: Se,
|
|
3160
3160
|
isLoading: hn,
|
|
3161
3161
|
error: Ht,
|
|
3162
|
-
onOpenChatSession: K ? void 0 :
|
|
3162
|
+
onOpenChatSession: K ? void 0 : qa
|
|
3163
3163
|
}
|
|
3164
3164
|
),
|
|
3165
3165
|
!K && /* @__PURE__ */ n(
|
|
@@ -3168,10 +3168,10 @@ const ba = (e, t) => (a) => {
|
|
|
3168
3168
|
className: "agent-workspace__chat-keep-alive",
|
|
3169
3169
|
hidden: !!A && O !== "chat",
|
|
3170
3170
|
children: /* @__PURE__ */ n(
|
|
3171
|
-
|
|
3171
|
+
Xs,
|
|
3172
3172
|
{
|
|
3173
3173
|
connector: ce,
|
|
3174
|
-
phase:
|
|
3174
|
+
phase: W,
|
|
3175
3175
|
chatHistory: ht,
|
|
3176
3176
|
chatSessionKey: on,
|
|
3177
3177
|
startQuery: cn,
|
|
@@ -3179,8 +3179,8 @@ const ba = (e, t) => (a) => {
|
|
|
3179
3179
|
enableUpload: U,
|
|
3180
3180
|
onTurn: vn,
|
|
3181
3181
|
onAwaitingChange: Rt,
|
|
3182
|
-
onClarificationPrompt:
|
|
3183
|
-
onDismissClarification: () =>
|
|
3182
|
+
onClarificationPrompt: Ka,
|
|
3183
|
+
onDismissClarification: () => De(null)
|
|
3184
3184
|
}
|
|
3185
3185
|
)
|
|
3186
3186
|
}
|
|
@@ -3189,41 +3189,41 @@ const ba = (e, t) => (a) => {
|
|
|
3189
3189
|
]
|
|
3190
3190
|
}
|
|
3191
3191
|
),
|
|
3192
|
-
!
|
|
3193
|
-
|
|
3192
|
+
!jt && /* @__PURE__ */ n(
|
|
3193
|
+
Zs,
|
|
3194
3194
|
{
|
|
3195
|
-
checklist:
|
|
3195
|
+
checklist: Qa,
|
|
3196
3196
|
isLoading: Bt,
|
|
3197
3197
|
error: gn,
|
|
3198
|
-
phase:
|
|
3199
|
-
canRequestInput: !K &&
|
|
3200
|
-
onAttentionItemClick:
|
|
3201
|
-
adminMode:
|
|
3198
|
+
phase: W,
|
|
3199
|
+
canRequestInput: !K && W === G.running && !Yt,
|
|
3200
|
+
onAttentionItemClick: Fa,
|
|
3201
|
+
adminMode: D,
|
|
3202
3202
|
context: pn,
|
|
3203
3203
|
contextLoaded: At,
|
|
3204
3204
|
contextLoading: kt,
|
|
3205
3205
|
contextError: mn,
|
|
3206
|
-
onContextSelect:
|
|
3206
|
+
onContextSelect: Za
|
|
3207
3207
|
},
|
|
3208
3208
|
t
|
|
3209
3209
|
),
|
|
3210
|
-
!
|
|
3211
|
-
|
|
3210
|
+
!Wt && /* @__PURE__ */ n(
|
|
3211
|
+
tr,
|
|
3212
3212
|
{
|
|
3213
3213
|
resources: pt,
|
|
3214
3214
|
isLoading: dn,
|
|
3215
3215
|
error: $e,
|
|
3216
|
-
onOpenResource:
|
|
3216
|
+
onOpenResource: Ga
|
|
3217
3217
|
}
|
|
3218
3218
|
),
|
|
3219
3219
|
/* @__PURE__ */ n(
|
|
3220
|
-
|
|
3220
|
+
Qs,
|
|
3221
3221
|
{
|
|
3222
3222
|
resource: _t,
|
|
3223
3223
|
html: un,
|
|
3224
3224
|
isLoading: $t,
|
|
3225
3225
|
error: Mt,
|
|
3226
|
-
onClose:
|
|
3226
|
+
onClose: za
|
|
3227
3227
|
}
|
|
3228
3228
|
)
|
|
3229
3229
|
]
|
|
@@ -3231,42 +3231,42 @@ const ba = (e, t) => (a) => {
|
|
|
3231
3231
|
)
|
|
3232
3232
|
] }),
|
|
3233
3233
|
/* @__PURE__ */ n(
|
|
3234
|
-
|
|
3234
|
+
_a,
|
|
3235
3235
|
{
|
|
3236
3236
|
open: re,
|
|
3237
|
-
isInProgress:
|
|
3238
|
-
isArchiving:
|
|
3237
|
+
isInProgress: W === G.running || W === G.paused && !wa(Be ?? void 0),
|
|
3238
|
+
isArchiving: S,
|
|
3239
3239
|
error: Qe,
|
|
3240
3240
|
onCancel: () => {
|
|
3241
|
-
|
|
3241
|
+
S || (fe(null), Ae(!1));
|
|
3242
3242
|
},
|
|
3243
3243
|
onConfirm: () => {
|
|
3244
|
-
|
|
3244
|
+
Ya();
|
|
3245
3245
|
}
|
|
3246
3246
|
}
|
|
3247
3247
|
),
|
|
3248
3248
|
/* @__PURE__ */ n(
|
|
3249
|
-
|
|
3249
|
+
va,
|
|
3250
3250
|
{
|
|
3251
|
-
open:
|
|
3252
|
-
isUnarchiving:
|
|
3253
|
-
error:
|
|
3251
|
+
open: Oa,
|
|
3252
|
+
isUnarchiving: Tt,
|
|
3253
|
+
error: Ia,
|
|
3254
3254
|
onCancel: () => {
|
|
3255
|
-
|
|
3255
|
+
Tt || (Vt(null), _n(!1));
|
|
3256
3256
|
},
|
|
3257
3257
|
onConfirm: () => {
|
|
3258
|
-
|
|
3258
|
+
ja();
|
|
3259
3259
|
}
|
|
3260
3260
|
}
|
|
3261
3261
|
),
|
|
3262
3262
|
/* @__PURE__ */ n(
|
|
3263
|
-
|
|
3263
|
+
fa,
|
|
3264
3264
|
{
|
|
3265
|
-
open:
|
|
3266
|
-
isDeleting:
|
|
3267
|
-
error:
|
|
3265
|
+
open: La,
|
|
3266
|
+
isDeleting: Dn,
|
|
3267
|
+
error: Pa,
|
|
3268
3268
|
onCancel: () => {
|
|
3269
|
-
|
|
3269
|
+
Dn || (Jt(null), fn(!1));
|
|
3270
3270
|
},
|
|
3271
3271
|
onConfirm: () => {
|
|
3272
3272
|
Wa();
|
|
@@ -3274,7 +3274,7 @@ const ba = (e, t) => (a) => {
|
|
|
3274
3274
|
}
|
|
3275
3275
|
)
|
|
3276
3276
|
] });
|
|
3277
|
-
},
|
|
3277
|
+
}, ii = "Unable to load agent definitions. Please try again.", li = "Unable to start the agent.", ra = "Loading agents…", oi = "Which agent?", ci = "Select an agent", di = "Name for this run", ui = "e.g. Year 6 Science Museum trip", hi = "Shown on the board and in the workspace", ia = "new-agent-invocation-name-hint", Sa = ({
|
|
3278
3278
|
open: e,
|
|
3279
3279
|
onClose: t,
|
|
3280
3280
|
onStart: a,
|
|
@@ -3284,41 +3284,41 @@ const ba = (e, t) => (a) => {
|
|
|
3284
3284
|
onRetryDefinitions: i,
|
|
3285
3285
|
embedded: p = !1
|
|
3286
3286
|
}) => {
|
|
3287
|
-
const [c, A] = g(void 0), [f,
|
|
3287
|
+
const [c, A] = g(void 0), [f, N] = g(""), [_, y] = g(!1), [h, T] = g(null), P = [...s].sort(($, q) => $.display_name.localeCompare(q.display_name)).map(($) => ({
|
|
3288
3288
|
value: $.ref,
|
|
3289
3289
|
label: $.display_name
|
|
3290
3290
|
}));
|
|
3291
3291
|
L(() => {
|
|
3292
|
-
e && (A(void 0),
|
|
3292
|
+
e && (A(void 0), N(""), y(!1), T(null));
|
|
3293
3293
|
}, [e]);
|
|
3294
|
-
const U = c !== void 0 && f.trim().length > 0,
|
|
3294
|
+
const U = c !== void 0 && f.trim().length > 0, D = v(
|
|
3295
3295
|
($) => {
|
|
3296
|
-
const q = s.find((
|
|
3296
|
+
const q = s.find((J) => J.ref === $[0]);
|
|
3297
3297
|
q && A(q);
|
|
3298
3298
|
},
|
|
3299
3299
|
[s]
|
|
3300
3300
|
), k = v(async () => {
|
|
3301
3301
|
if (!(!c || !U || _)) {
|
|
3302
|
-
|
|
3302
|
+
y(!0), T(null);
|
|
3303
3303
|
try {
|
|
3304
3304
|
await a({ definition: c, invocationName: f.trim() });
|
|
3305
3305
|
} catch ($) {
|
|
3306
|
-
|
|
3306
|
+
T($ instanceof Error ? $.message : li);
|
|
3307
3307
|
} finally {
|
|
3308
|
-
|
|
3308
|
+
y(!1);
|
|
3309
3309
|
}
|
|
3310
3310
|
}
|
|
3311
3311
|
}, [U, c, f, _, a]);
|
|
3312
3312
|
if (r === "idle" && s.length === 0 || !e)
|
|
3313
3313
|
return null;
|
|
3314
3314
|
const m = /* @__PURE__ */ o("div", { className: "new-agent__header-title", children: [
|
|
3315
|
-
/* @__PURE__ */ n("span", { className: "new-agent__header-avatar", "aria-hidden": "true", children: /* @__PURE__ */ n(
|
|
3315
|
+
/* @__PURE__ */ n("span", { className: "new-agent__header-avatar", "aria-hidden": "true", children: /* @__PURE__ */ n(x, { name: "ask-arbor", size: 24 }) }),
|
|
3316
3316
|
p ? /* @__PURE__ */ n("h2", { className: "new-agent__title", children: "Start an agent" }) : /* @__PURE__ */ n(X.Title, { children: "Start an agent" })
|
|
3317
3317
|
] });
|
|
3318
3318
|
let b;
|
|
3319
3319
|
return r === "loading" ? b = /* @__PURE__ */ o("div", { className: "new-agent__state", "aria-live": "polite", children: [
|
|
3320
3320
|
/* @__PURE__ */ n(
|
|
3321
|
-
|
|
3321
|
+
x,
|
|
3322
3322
|
{
|
|
3323
3323
|
name: "loader",
|
|
3324
3324
|
size: 24,
|
|
@@ -3329,8 +3329,8 @@ const ba = (e, t) => (a) => {
|
|
|
3329
3329
|
),
|
|
3330
3330
|
/* @__PURE__ */ n("p", { className: "new-agent__state-message", children: ra })
|
|
3331
3331
|
] }) : r === "error" ? b = /* @__PURE__ */ o("div", { className: "new-agent__state new-agent__state--error", role: "alert", children: [
|
|
3332
|
-
/* @__PURE__ */ n(
|
|
3333
|
-
/* @__PURE__ */ n("p", { className: "new-agent__state-message", children: l ??
|
|
3332
|
+
/* @__PURE__ */ n(x, { name: "triangle-alert", size: 24, color: "var(--color-semantic-destructive-600)" }),
|
|
3333
|
+
/* @__PURE__ */ n("p", { className: "new-agent__state-message", children: l ?? ii }),
|
|
3334
3334
|
i ? /* @__PURE__ */ n(F, { variant: "secondary", size: "S", onClick: i, children: "Try again" }) : null
|
|
3335
3335
|
] }) : b = /* @__PURE__ */ o(
|
|
3336
3336
|
"form",
|
|
@@ -3342,29 +3342,31 @@ const ba = (e, t) => (a) => {
|
|
|
3342
3342
|
},
|
|
3343
3343
|
children: [
|
|
3344
3344
|
/* @__PURE__ */ o("div", { className: "new-agent__type-field", children: [
|
|
3345
|
-
/* @__PURE__ */ n("label", { className: "new-agent__type-label", htmlFor: "new-agent-type", children:
|
|
3345
|
+
/* @__PURE__ */ n("label", { className: "new-agent__type-label", htmlFor: "new-agent-type", children: oi }),
|
|
3346
3346
|
/* @__PURE__ */ n(
|
|
3347
|
-
|
|
3347
|
+
ns,
|
|
3348
3348
|
{
|
|
3349
3349
|
id: "new-agent-type",
|
|
3350
|
-
placeholder:
|
|
3350
|
+
placeholder: ci,
|
|
3351
3351
|
options: P,
|
|
3352
3352
|
selectedValues: c ? [c.ref] : [],
|
|
3353
|
-
onSelectionChange:
|
|
3353
|
+
onSelectionChange: D
|
|
3354
3354
|
}
|
|
3355
3355
|
)
|
|
3356
3356
|
] }),
|
|
3357
3357
|
/* @__PURE__ */ o("div", { className: "new-agent__type-field", children: [
|
|
3358
|
-
/* @__PURE__ */ n("label", { className: "new-agent__type-label", htmlFor: "new-agent-invocation-name", children:
|
|
3358
|
+
/* @__PURE__ */ n("label", { className: "new-agent__type-label", htmlFor: "new-agent-invocation-name", children: di }),
|
|
3359
3359
|
/* @__PURE__ */ n(
|
|
3360
|
-
|
|
3360
|
+
as,
|
|
3361
3361
|
{
|
|
3362
3362
|
id: "new-agent-invocation-name",
|
|
3363
3363
|
value: f,
|
|
3364
|
-
placeholder:
|
|
3365
|
-
|
|
3364
|
+
placeholder: ui,
|
|
3365
|
+
"aria-describedby": ia,
|
|
3366
|
+
onChange: ($) => N($.target.value)
|
|
3366
3367
|
}
|
|
3367
|
-
)
|
|
3368
|
+
),
|
|
3369
|
+
/* @__PURE__ */ n("p", { className: "new-agent__field-hint", id: ia, children: hi })
|
|
3368
3370
|
] }),
|
|
3369
3371
|
h ? /* @__PURE__ */ n("p", { className: "new-agent__error", role: "alert", children: h }) : null,
|
|
3370
3372
|
/* @__PURE__ */ n("div", { className: "new-agent__actions", children: /* @__PURE__ */ n(
|
|
@@ -3390,9 +3392,9 @@ const ba = (e, t) => (a) => {
|
|
|
3390
3392
|
/* @__PURE__ */ n(X.Header, { className: "new-agent__header", children: m }),
|
|
3391
3393
|
/* @__PURE__ */ n(X.Body, { className: "new-agent__body", children: b })
|
|
3392
3394
|
] });
|
|
3393
|
-
},
|
|
3395
|
+
}, la = (e) => {
|
|
3394
3396
|
window.location.assign(e);
|
|
3395
|
-
},
|
|
3397
|
+
}, gi = ({
|
|
3396
3398
|
open: e,
|
|
3397
3399
|
authToken: t,
|
|
3398
3400
|
headers: a,
|
|
@@ -3404,7 +3406,7 @@ const ba = (e, t) => (a) => {
|
|
|
3404
3406
|
onStart: c,
|
|
3405
3407
|
embedded: A = !1
|
|
3406
3408
|
}) => {
|
|
3407
|
-
const f = JSON.stringify(a ?? {}),
|
|
3409
|
+
const f = JSON.stringify(a ?? {}), N = ee(
|
|
3408
3410
|
() => new Pn({
|
|
3409
3411
|
token: t,
|
|
3410
3412
|
headers: a,
|
|
@@ -3415,35 +3417,35 @@ const ba = (e, t) => (a) => {
|
|
|
3415
3417
|
}),
|
|
3416
3418
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- keyed on serialised config to keep a stable client.
|
|
3417
3419
|
[t, s, r, f]
|
|
3418
|
-
), [_,
|
|
3420
|
+
), [_, y] = g([]), [h, T] = g("loading"), [P, U] = g(null), [D, k] = g(0);
|
|
3419
3421
|
L(() => {
|
|
3420
3422
|
if (!e)
|
|
3421
3423
|
return;
|
|
3422
3424
|
let q = !1;
|
|
3423
|
-
return
|
|
3425
|
+
return T("loading"), U(null), (async () => {
|
|
3424
3426
|
try {
|
|
3425
|
-
const
|
|
3427
|
+
const J = await N.listAgentDefinitions();
|
|
3426
3428
|
if (q)
|
|
3427
3429
|
return;
|
|
3428
|
-
|
|
3429
|
-
} catch (
|
|
3430
|
+
y(J.map(ka)), T("idle");
|
|
3431
|
+
} catch (J) {
|
|
3430
3432
|
if (q)
|
|
3431
3433
|
return;
|
|
3432
|
-
|
|
3434
|
+
y([]), U(Ca(J)), T("error");
|
|
3433
3435
|
}
|
|
3434
3436
|
})(), () => {
|
|
3435
3437
|
q = !0;
|
|
3436
3438
|
};
|
|
3437
|
-
}, [
|
|
3439
|
+
}, [N, e, D]);
|
|
3438
3440
|
const m = v(() => {
|
|
3439
|
-
p == null || p(), l &&
|
|
3441
|
+
p == null || p(), l && la(l);
|
|
3440
3442
|
}, [l, p]), b = v(
|
|
3441
3443
|
async (q) => {
|
|
3442
|
-
await
|
|
3444
|
+
await N.createAgent(q.definition.ref, {
|
|
3443
3445
|
invocationName: q.invocationName
|
|
3444
|
-
}), c == null || c(q), i &&
|
|
3446
|
+
}), c == null || c(q), i && la(i);
|
|
3445
3447
|
},
|
|
3446
|
-
[
|
|
3448
|
+
[N, c, i]
|
|
3447
3449
|
), $ = v(() => {
|
|
3448
3450
|
k((q) => q + 1);
|
|
3449
3451
|
}, []);
|
|
@@ -3460,19 +3462,19 @@ const ba = (e, t) => (a) => {
|
|
|
3460
3462
|
embedded: A
|
|
3461
3463
|
}
|
|
3462
3464
|
);
|
|
3463
|
-
},
|
|
3465
|
+
}, pi = (e) => "agentDefinitionsUrl" in e, mi = (e) => pi(e) ? /* @__PURE__ */ n(gi, { ...e }) : /* @__PURE__ */ n(Sa, { ...e }), _i = (e) => e.archivedAt ? "archived" : e.status === C.paused ? "paused" : null, fi = (e) => {
|
|
3464
3466
|
if (e === "archived")
|
|
3465
|
-
return
|
|
3467
|
+
return us;
|
|
3466
3468
|
if (e === "paused")
|
|
3467
|
-
return
|
|
3468
|
-
},
|
|
3469
|
+
return Dt[C.paused].statusIcon;
|
|
3470
|
+
}, vi = ({
|
|
3469
3471
|
column: e,
|
|
3470
3472
|
overlayIcon: t,
|
|
3471
3473
|
label: a
|
|
3472
3474
|
}) => {
|
|
3473
3475
|
const s = t ?? e.statusIcon;
|
|
3474
3476
|
return s ? /* @__PURE__ */ n("span", { className: "agent-view__status-indicator", children: /* @__PURE__ */ n(
|
|
3475
|
-
|
|
3477
|
+
x,
|
|
3476
3478
|
{
|
|
3477
3479
|
name: s.name,
|
|
3478
3480
|
size: 16,
|
|
@@ -3488,10 +3490,10 @@ const ba = (e, t) => (a) => {
|
|
|
3488
3490
|
className: ne("agent-view__dot", {
|
|
3489
3491
|
[`agent-view__dot--${e.dotModifier}`]: e.dotModifier
|
|
3490
3492
|
}),
|
|
3491
|
-
children: /* @__PURE__ */ n(
|
|
3493
|
+
children: /* @__PURE__ */ n(oa, { colour: e.dotColour, label: a })
|
|
3492
3494
|
}
|
|
3493
3495
|
);
|
|
3494
|
-
},
|
|
3496
|
+
}, Ra = ({
|
|
3495
3497
|
agent: e,
|
|
3496
3498
|
agentName: t,
|
|
3497
3499
|
column: a,
|
|
@@ -3503,12 +3505,12 @@ const ba = (e, t) => (a) => {
|
|
|
3503
3505
|
canUnarchive: c = !1,
|
|
3504
3506
|
canDelete: A = !1,
|
|
3505
3507
|
onToggle: f,
|
|
3506
|
-
onViewAgent:
|
|
3508
|
+
onViewAgent: N,
|
|
3507
3509
|
onArchive: _,
|
|
3508
|
-
onUnarchive:
|
|
3510
|
+
onUnarchive: y,
|
|
3509
3511
|
onDelete: h
|
|
3510
3512
|
}) => {
|
|
3511
|
-
const { id:
|
|
3513
|
+
const { id: T, invocation_name: P } = e, U = `agent-card-${T}-header`, D = `agent-card-${T}-progress`, k = _i(e), m = fi(k);
|
|
3512
3514
|
return /* @__PURE__ */ n(
|
|
3513
3515
|
"li",
|
|
3514
3516
|
{
|
|
@@ -3517,25 +3519,25 @@ const ba = (e, t) => (a) => {
|
|
|
3517
3519
|
"agent-view__card--paused": k === "paused",
|
|
3518
3520
|
"agent-view__card--archived": k === "archived"
|
|
3519
3521
|
}),
|
|
3520
|
-
children: /* @__PURE__ */ o(
|
|
3522
|
+
children: /* @__PURE__ */ o(ss, { spacing: "dense", children: [
|
|
3521
3523
|
/* @__PURE__ */ n(
|
|
3522
3524
|
"button",
|
|
3523
3525
|
{
|
|
3524
3526
|
type: "button",
|
|
3525
3527
|
className: "agent-view__card-toggle",
|
|
3526
3528
|
"aria-expanded": s,
|
|
3527
|
-
"aria-controls":
|
|
3529
|
+
"aria-controls": D,
|
|
3528
3530
|
"aria-label": P,
|
|
3529
3531
|
id: U,
|
|
3530
|
-
onClick: () => f(
|
|
3532
|
+
onClick: () => f(T),
|
|
3531
3533
|
children: /* @__PURE__ */ o("div", { className: "agent-view__card-content", children: [
|
|
3532
|
-
/* @__PURE__ */ n(
|
|
3534
|
+
/* @__PURE__ */ n(vi, { column: a, overlayIcon: m }),
|
|
3533
3535
|
/* @__PURE__ */ n("span", { className: "agent-view__card-invocation-name", children: P }),
|
|
3534
3536
|
/* @__PURE__ */ n("span", { className: "agent-view__card-agent-name", children: t }),
|
|
3535
3537
|
k === "paused" ? /* @__PURE__ */ n("span", { className: "agent-view__card-state-pill", children: "Paused" }) : null,
|
|
3536
3538
|
k === "archived" ? /* @__PURE__ */ n("span", { className: "agent-view__card-state-pill", children: "Archived" }) : null,
|
|
3537
3539
|
/* @__PURE__ */ n(
|
|
3538
|
-
|
|
3540
|
+
x,
|
|
3539
3541
|
{
|
|
3540
3542
|
name: s ? "chevron-up" : "chevron-down",
|
|
3541
3543
|
size: 16,
|
|
@@ -3545,10 +3547,10 @@ const ba = (e, t) => (a) => {
|
|
|
3545
3547
|
] })
|
|
3546
3548
|
}
|
|
3547
3549
|
),
|
|
3548
|
-
s && /* @__PURE__ */ o("div", { id:
|
|
3550
|
+
s && /* @__PURE__ */ o("div", { id: D, "aria-labelledby": U, className: "agent-view__card-progress", children: [
|
|
3549
3551
|
r && /* @__PURE__ */ o("div", { className: "agent-view__progress-loading", "aria-live": "polite", children: [
|
|
3550
3552
|
/* @__PURE__ */ n(
|
|
3551
|
-
|
|
3553
|
+
x,
|
|
3552
3554
|
{
|
|
3553
3555
|
name: "loader",
|
|
3554
3556
|
size: 16,
|
|
@@ -3563,7 +3565,7 @@ const ba = (e, t) => (a) => {
|
|
|
3563
3565
|
!r && !i && l !== null && /* @__PURE__ */ n(Js, { checklist: l }),
|
|
3564
3566
|
!r && !i && l === null && /* @__PURE__ */ o("div", { className: "agent-view__progress-loading", "aria-live": "polite", children: [
|
|
3565
3567
|
/* @__PURE__ */ n(
|
|
3566
|
-
|
|
3568
|
+
x,
|
|
3567
3569
|
{
|
|
3568
3570
|
name: "loader",
|
|
3569
3571
|
size: 16,
|
|
@@ -3585,7 +3587,7 @@ const ba = (e, t) => (a) => {
|
|
|
3585
3587
|
onClick: () => _ == null ? void 0 : _(e),
|
|
3586
3588
|
children: "Archive"
|
|
3587
3589
|
}
|
|
3588
|
-
) : c ? /* @__PURE__ */ n(F, { variant: "secondary", size: "S", onClick: () =>
|
|
3590
|
+
) : c ? /* @__PURE__ */ n(F, { variant: "secondary", size: "S", onClick: () => y == null ? void 0 : y(e), children: "Unarchive" }) : A ? /* @__PURE__ */ n(
|
|
3589
3591
|
F,
|
|
3590
3592
|
{
|
|
3591
3593
|
variant: "secondary-destructive",
|
|
@@ -3603,13 +3605,13 @@ const ba = (e, t) => (a) => {
|
|
|
3603
3605
|
children: "Delete"
|
|
3604
3606
|
}
|
|
3605
3607
|
) : null,
|
|
3606
|
-
/* @__PURE__ */ n(F, { variant: "secondary", size: "S", onClick: () =>
|
|
3608
|
+
/* @__PURE__ */ n(F, { variant: "secondary", size: "S", onClick: () => N == null ? void 0 : N(e), children: "View agent" })
|
|
3607
3609
|
] })
|
|
3608
3610
|
] })
|
|
3609
3611
|
] })
|
|
3610
3612
|
}
|
|
3611
3613
|
);
|
|
3612
|
-
},
|
|
3614
|
+
}, wi = ({
|
|
3613
3615
|
column: e,
|
|
3614
3616
|
agents: t,
|
|
3615
3617
|
expandedAgentId: a,
|
|
@@ -3623,27 +3625,27 @@ const ba = (e, t) => (a) => {
|
|
|
3623
3625
|
canArchive: f
|
|
3624
3626
|
}) => /* @__PURE__ */ o("section", { className: "agent-view__column", "aria-label": e.title, children: [
|
|
3625
3627
|
/* @__PURE__ */ o("div", { className: "agent-view__column-header", children: [
|
|
3626
|
-
/* @__PURE__ */ n(
|
|
3628
|
+
/* @__PURE__ */ n(Je, { level: 4, children: e.title }),
|
|
3627
3629
|
/* @__PURE__ */ n("span", { className: "agent-view__column-count", children: t.length })
|
|
3628
3630
|
] }),
|
|
3629
|
-
/* @__PURE__ */ n("ul", { className: "agent-view__card-list", children: t.map((
|
|
3630
|
-
|
|
3631
|
+
/* @__PURE__ */ n("ul", { className: "agent-view__card-list", children: t.map((N) => /* @__PURE__ */ n(
|
|
3632
|
+
Ra,
|
|
3631
3633
|
{
|
|
3632
|
-
agent:
|
|
3633
|
-
agentName: nn(
|
|
3634
|
+
agent: N,
|
|
3635
|
+
agentName: nn(N, i),
|
|
3634
3636
|
column: e,
|
|
3635
|
-
isExpanded: a ===
|
|
3636
|
-
isLoading: s ===
|
|
3637
|
-
checklist: r[
|
|
3638
|
-
error: l[
|
|
3639
|
-
canArchive: f && !
|
|
3637
|
+
isExpanded: a === N.id,
|
|
3638
|
+
isLoading: s === N.id,
|
|
3639
|
+
checklist: r[N.invocation_id] ?? null,
|
|
3640
|
+
error: l[N.id] ?? null,
|
|
3641
|
+
canArchive: f && !N.archivedAt,
|
|
3640
3642
|
onToggle: p,
|
|
3641
3643
|
onViewAgent: c,
|
|
3642
3644
|
onArchive: A
|
|
3643
3645
|
},
|
|
3644
|
-
|
|
3646
|
+
N.id
|
|
3645
3647
|
)) })
|
|
3646
|
-
] }), nn = (e, t) => t.get(e.agent_definition_ref) ?? e.agent_definition_ref.replace(/_/g, " "),
|
|
3648
|
+
] }), nn = (e, t) => t.get(e.agent_definition_ref) ?? e.agent_definition_ref.replace(/_/g, " "), Oi = ({
|
|
3647
3649
|
jwt: e,
|
|
3648
3650
|
headers: t,
|
|
3649
3651
|
agentDefinitionsUrl: a,
|
|
@@ -3655,20 +3657,20 @@ const ba = (e, t) => (a) => {
|
|
|
3655
3657
|
agentChatUrl: c,
|
|
3656
3658
|
agentConversationUrl: A,
|
|
3657
3659
|
pauseAgentUrl: f,
|
|
3658
|
-
resumeAgentUrl:
|
|
3660
|
+
resumeAgentUrl: N,
|
|
3659
3661
|
archiveAgentUrl: _,
|
|
3660
|
-
unarchiveAgentUrl:
|
|
3662
|
+
unarchiveAgentUrl: y,
|
|
3661
3663
|
enableUpload: h,
|
|
3662
|
-
adminMode:
|
|
3664
|
+
adminMode: T = !1,
|
|
3663
3665
|
showHeader: P = !1,
|
|
3664
3666
|
institutions: U,
|
|
3665
|
-
usePusherToRepoll:
|
|
3666
|
-
pusherChannelPrefix: k =
|
|
3667
|
+
usePusherToRepoll: D = !1,
|
|
3668
|
+
pusherChannelPrefix: k = Aa,
|
|
3667
3669
|
pusherKey: m,
|
|
3668
3670
|
pusherCluster: b,
|
|
3669
3671
|
subscribeToPusher: $
|
|
3670
3672
|
}) => {
|
|
3671
|
-
var
|
|
3673
|
+
var Ct;
|
|
3672
3674
|
const q = ee(
|
|
3673
3675
|
() => ({
|
|
3674
3676
|
agentDefinitions: a,
|
|
@@ -3680,7 +3682,7 @@ const ba = (e, t) => (a) => {
|
|
|
3680
3682
|
agentChat: c,
|
|
3681
3683
|
agentConversation: A,
|
|
3682
3684
|
..._ ? { archiveAgent: _ } : {},
|
|
3683
|
-
...
|
|
3685
|
+
...y ? { unarchiveAgent: y } : {}
|
|
3684
3686
|
}),
|
|
3685
3687
|
[
|
|
3686
3688
|
a,
|
|
@@ -3692,18 +3694,18 @@ const ba = (e, t) => (a) => {
|
|
|
3692
3694
|
c,
|
|
3693
3695
|
A,
|
|
3694
3696
|
_,
|
|
3695
|
-
|
|
3697
|
+
y
|
|
3696
3698
|
]
|
|
3697
|
-
), [
|
|
3698
|
-
(d) => d.applicationId ===
|
|
3699
|
-
)) == null ? void 0 :
|
|
3699
|
+
), [J, ge] = g(null), be = J ? (Ct = U == null ? void 0 : U.find(
|
|
3700
|
+
(d) => d.applicationId === J.application_id
|
|
3701
|
+
)) == null ? void 0 : Ct.applicationUrl : void 0, oe = ee(() => {
|
|
3700
3702
|
const d = { ...t ?? {} };
|
|
3701
3703
|
return be ? d[Ke.arborApplicationUrl] = be : delete d[Ke.arborApplicationUrl], d;
|
|
3702
3704
|
}, [t, be]), {
|
|
3703
3705
|
agents: z,
|
|
3704
3706
|
agentDefinitions: pe,
|
|
3705
3707
|
loadState: Ie,
|
|
3706
|
-
loadError:
|
|
3708
|
+
loadError: E,
|
|
3707
3709
|
reload: M,
|
|
3708
3710
|
refresh: O,
|
|
3709
3711
|
fetchAgentChecklist: H,
|
|
@@ -3712,30 +3714,30 @@ const ba = (e, t) => (a) => {
|
|
|
3712
3714
|
unarchiveAgent: ce,
|
|
3713
3715
|
deleteAgent: lt,
|
|
3714
3716
|
removeAgent: Ye,
|
|
3715
|
-
replaceAgent:
|
|
3716
|
-
} =
|
|
3717
|
+
replaceAgent: xt
|
|
3718
|
+
} = Qr({ jwt: e, headers: oe, urls: q }), [je, We] = g(!1), [Ne, Le] = g(null), [ot, ct] = g(null), [le, Q] = g({}), [Pe, Ee] = g({}), [Xe, dt] = g([]), [Ue, ut] = g([]), [W, me] = g(null), [ht, se] = g(!1), [on, ye] = g(null), [cn, gt] = g(!1), [Ze, De] = g(null), [pt, mt] = g(!1), [dn, xe] = g(null), [$e, Me] = g(null), [_t, ft] = g(!1), [un, Ce] = g(null);
|
|
3717
3719
|
L(() => {
|
|
3718
|
-
ge((d) => d ? z.find((
|
|
3720
|
+
ge((d) => d ? z.find((S) => S.id === d.id) ?? d : null);
|
|
3719
3721
|
}, [z]);
|
|
3720
3722
|
const $t = ee(() => {
|
|
3721
|
-
const d = new Set(z.map((R) => R.application_id)),
|
|
3723
|
+
const d = new Set(z.map((R) => R.application_id)), S = new Map(
|
|
3722
3724
|
(U ?? []).map((R) => [R.applicationId, R.name])
|
|
3723
3725
|
);
|
|
3724
3726
|
return [...d].sort(
|
|
3725
|
-
(R, re) => (
|
|
3727
|
+
(R, re) => (S.get(R) ?? R).localeCompare(S.get(re) ?? re)
|
|
3726
3728
|
).map((R) => ({
|
|
3727
3729
|
value: R,
|
|
3728
|
-
label:
|
|
3730
|
+
label: S.get(R) ?? R
|
|
3729
3731
|
}));
|
|
3730
3732
|
}, [z, U]), _e = ee(
|
|
3731
3733
|
() => new Map(pe.map((d) => [d.ref, d.display_name])),
|
|
3732
3734
|
[pe]
|
|
3733
3735
|
), Mt = ee(() => [...new Set(
|
|
3734
|
-
z.map((
|
|
3735
|
-
)].sort((
|
|
3736
|
-
value:
|
|
3737
|
-
label:
|
|
3738
|
-
})), [z, _e]),
|
|
3736
|
+
z.map((S) => nn(S, _e))
|
|
3737
|
+
)].sort((S, R) => S.localeCompare(R)).map((S) => ({
|
|
3738
|
+
value: S,
|
|
3739
|
+
label: S
|
|
3740
|
+
})), [z, _e]), Te = ee(() => z.filter((d) => !(Xe.length > 0 && !Xe.includes(d.application_id) || Ue.length > 0 && !Ue.includes(nn(d, _e)))), [z, _e, Ue, Xe]), Se = $t.length > 1, vt = Mt.length > 1, hn = Se || vt;
|
|
3739
3741
|
L(() => {
|
|
3740
3742
|
const d = window.setInterval(() => {
|
|
3741
3743
|
O();
|
|
@@ -3748,7 +3750,7 @@ const ba = (e, t) => (a) => {
|
|
|
3748
3750
|
return;
|
|
3749
3751
|
let d = !1;
|
|
3750
3752
|
return (async () => {
|
|
3751
|
-
const
|
|
3753
|
+
const S = await Promise.allSettled(
|
|
3752
3754
|
z.map(async (R) => {
|
|
3753
3755
|
const re = await H(R.invocation_id);
|
|
3754
3756
|
return {
|
|
@@ -3761,17 +3763,17 @@ const ba = (e, t) => (a) => {
|
|
|
3761
3763
|
d || (Q((R) => {
|
|
3762
3764
|
const re = { ...R };
|
|
3763
3765
|
let Ae = !1;
|
|
3764
|
-
for (const Qe of
|
|
3766
|
+
for (const Qe of S) {
|
|
3765
3767
|
if (Qe.status !== "fulfilled")
|
|
3766
3768
|
continue;
|
|
3767
|
-
const { invocationId: fe, checklist:
|
|
3768
|
-
JSON.stringify(R[fe]) !== JSON.stringify(
|
|
3769
|
+
const { invocationId: fe, checklist: Tt } = Qe.value;
|
|
3770
|
+
JSON.stringify(R[fe]) !== JSON.stringify(Tt) && (re[fe] = Tt, Ae = !0);
|
|
3769
3771
|
}
|
|
3770
3772
|
return Ae ? re : R;
|
|
3771
|
-
}),
|
|
3773
|
+
}), Ee((R) => {
|
|
3772
3774
|
const re = { ...R };
|
|
3773
3775
|
let Ae = !1;
|
|
3774
|
-
return
|
|
3776
|
+
return S.forEach((Qe, fe) => {
|
|
3775
3777
|
Qe.status === "rejected" && re[z[fe].id] !== tn && (re[z[fe].id] = tn, Ae = !0);
|
|
3776
3778
|
}), Ae ? re : R;
|
|
3777
3779
|
}));
|
|
@@ -3782,108 +3784,108 @@ const ba = (e, t) => (a) => {
|
|
|
3782
3784
|
const wt = v(
|
|
3783
3785
|
async (d) => {
|
|
3784
3786
|
if (!le[d.invocation_id]) {
|
|
3785
|
-
ct(d.id),
|
|
3786
|
-
const R = { ...
|
|
3787
|
+
ct(d.id), Ee((S) => {
|
|
3788
|
+
const R = { ...S };
|
|
3787
3789
|
return delete R[d.id], R;
|
|
3788
3790
|
});
|
|
3789
3791
|
try {
|
|
3790
|
-
const
|
|
3792
|
+
const S = await H(d.invocation_id);
|
|
3791
3793
|
Q((R) => ({
|
|
3792
3794
|
...R,
|
|
3793
|
-
[d.invocation_id]:
|
|
3795
|
+
[d.invocation_id]: S.checklist
|
|
3794
3796
|
}));
|
|
3795
3797
|
} catch {
|
|
3796
|
-
|
|
3797
|
-
...
|
|
3798
|
+
Ee((S) => ({
|
|
3799
|
+
...S,
|
|
3798
3800
|
[d.id]: tn
|
|
3799
3801
|
}));
|
|
3800
3802
|
} finally {
|
|
3801
|
-
ct((
|
|
3803
|
+
ct((S) => S === d.id ? null : S);
|
|
3802
3804
|
}
|
|
3803
3805
|
}
|
|
3804
3806
|
},
|
|
3805
3807
|
[H, le]
|
|
3806
3808
|
), Ht = v(
|
|
3807
3809
|
(d) => {
|
|
3808
|
-
if (
|
|
3810
|
+
if (Ne === d) {
|
|
3809
3811
|
Le(null);
|
|
3810
3812
|
return;
|
|
3811
3813
|
}
|
|
3812
|
-
const
|
|
3813
|
-
|
|
3814
|
+
const S = z.find(({ id: R }) => R === d);
|
|
3815
|
+
S && (Le(d), wt(S));
|
|
3814
3816
|
},
|
|
3815
|
-
[z,
|
|
3817
|
+
[z, Ne, wt]
|
|
3816
3818
|
), He = ee(
|
|
3817
|
-
() =>
|
|
3818
|
-
[
|
|
3819
|
+
() => Te.filter((d) => !!d.archivedAt),
|
|
3820
|
+
[Te]
|
|
3819
3821
|
), Be = ee(
|
|
3820
|
-
() =>
|
|
3821
|
-
[
|
|
3822
|
-
),
|
|
3822
|
+
() => Te.filter((d) => !d.archivedAt),
|
|
3823
|
+
[Te]
|
|
3824
|
+
), Nt = ee(() => {
|
|
3823
3825
|
const d = {};
|
|
3824
|
-
for (const
|
|
3826
|
+
for (const S of Be) {
|
|
3825
3827
|
const R = kn(
|
|
3826
|
-
|
|
3827
|
-
le[
|
|
3828
|
+
S,
|
|
3829
|
+
le[S.invocation_id]
|
|
3828
3830
|
);
|
|
3829
|
-
(d[R] ?? (d[R] = [])).push(
|
|
3831
|
+
(d[R] ?? (d[R] = [])).push(S);
|
|
3830
3832
|
}
|
|
3831
3833
|
return d;
|
|
3832
3834
|
}, [Be, le]), Bt = v((d) => {
|
|
3833
3835
|
ge(d);
|
|
3834
3836
|
}, []), zt = v((d) => {
|
|
3835
|
-
|
|
3837
|
+
ye(null), me(d);
|
|
3836
3838
|
}, []), gn = v(() => {
|
|
3837
|
-
ht || (
|
|
3838
|
-
}, [ht]),
|
|
3839
|
-
if (
|
|
3840
|
-
se(!0),
|
|
3841
|
-
const
|
|
3842
|
-
return delete
|
|
3839
|
+
ht || (ye(null), me(null));
|
|
3840
|
+
}, [ht]), yt = v(async () => {
|
|
3841
|
+
if (W) {
|
|
3842
|
+
se(!0), ye(null), Ee((d) => {
|
|
3843
|
+
const S = { ...d };
|
|
3844
|
+
return delete S[W.id], S;
|
|
3843
3845
|
});
|
|
3844
3846
|
try {
|
|
3845
|
-
await Z(
|
|
3847
|
+
await Z(W.invocation_id), ge((d) => (d == null ? void 0 : d.id) === W.id ? null : d), Le(W.id), gt(!0), me(null);
|
|
3846
3848
|
} catch {
|
|
3847
|
-
|
|
3849
|
+
ye(Tn);
|
|
3848
3850
|
} finally {
|
|
3849
3851
|
se(!1);
|
|
3850
3852
|
}
|
|
3851
3853
|
}
|
|
3852
|
-
}, [
|
|
3853
|
-
|
|
3854
|
+
}, [W, Z]), pn = v((d) => {
|
|
3855
|
+
xe(null), De(d);
|
|
3854
3856
|
}, []), Gt = v(() => {
|
|
3855
|
-
pt || (
|
|
3857
|
+
pt || (xe(null), De(null));
|
|
3856
3858
|
}, [pt]), At = v(async () => {
|
|
3857
3859
|
if (Ze) {
|
|
3858
|
-
mt(!0),
|
|
3860
|
+
mt(!0), xe(null);
|
|
3859
3861
|
try {
|
|
3860
|
-
await ce(Ze.invocation_id),
|
|
3862
|
+
await ce(Ze.invocation_id), De(null);
|
|
3861
3863
|
} catch {
|
|
3862
|
-
|
|
3864
|
+
xe(Sn);
|
|
3863
3865
|
} finally {
|
|
3864
3866
|
mt(!1);
|
|
3865
3867
|
}
|
|
3866
3868
|
}
|
|
3867
|
-
}, [Ze, ce]), Ft =
|
|
3868
|
-
|
|
3869
|
-
le[
|
|
3870
|
-
) !==
|
|
3869
|
+
}, [Ze, ce]), Ft = W ? kn(
|
|
3870
|
+
W,
|
|
3871
|
+
le[W.invocation_id]
|
|
3872
|
+
) !== C.complete : !1, kt = v(
|
|
3871
3873
|
async (d) => {
|
|
3872
|
-
const
|
|
3873
|
-
ge(
|
|
3874
|
+
const S = await Y(d);
|
|
3875
|
+
ge(S), We(!1);
|
|
3874
3876
|
},
|
|
3875
3877
|
[Y]
|
|
3876
3878
|
), bt = v((d) => {
|
|
3877
|
-
|
|
3879
|
+
Ce(null), Me(d);
|
|
3878
3880
|
}, []), mn = v(() => {
|
|
3879
|
-
_t || (
|
|
3880
|
-
}, [_t]),
|
|
3881
|
+
_t || (Ce(null), Me(null));
|
|
3882
|
+
}, [_t]), Et = v(async () => {
|
|
3881
3883
|
if ($e) {
|
|
3882
|
-
ft(!0),
|
|
3884
|
+
ft(!0), Ce(null);
|
|
3883
3885
|
try {
|
|
3884
3886
|
await lt($e.invocation_id), ge((d) => (d == null ? void 0 : d.id) === $e.id ? null : d), Me(null);
|
|
3885
3887
|
} catch (d) {
|
|
3886
|
-
|
|
3888
|
+
Ce(Ta(d));
|
|
3887
3889
|
} finally {
|
|
3888
3890
|
ft(!1);
|
|
3889
3891
|
}
|
|
@@ -3891,7 +3893,7 @@ const ba = (e, t) => (a) => {
|
|
|
3891
3893
|
}, [$e, lt]), qt = v(() => {
|
|
3892
3894
|
ge(null);
|
|
3893
3895
|
}, []), Kt = {
|
|
3894
|
-
expandedAgentId:
|
|
3896
|
+
expandedAgentId: Ne,
|
|
3895
3897
|
loadingAgentId: ot,
|
|
3896
3898
|
checklistByInvocationId: le,
|
|
3897
3899
|
errorByAgentId: Pe,
|
|
@@ -3903,7 +3905,7 @@ const ba = (e, t) => (a) => {
|
|
|
3903
3905
|
};
|
|
3904
3906
|
return /* @__PURE__ */ o("div", { className: "agent-view-frontend agent-view", children: [
|
|
3905
3907
|
P && /* @__PURE__ */ o("div", { className: "agent-view__header", children: [
|
|
3906
|
-
/* @__PURE__ */ n(
|
|
3908
|
+
/* @__PURE__ */ n(Je, { level: 1, children: "Agents" }),
|
|
3907
3909
|
/* @__PURE__ */ n(
|
|
3908
3910
|
F,
|
|
3909
3911
|
{
|
|
@@ -3911,13 +3913,13 @@ const ba = (e, t) => (a) => {
|
|
|
3911
3913
|
size: "S",
|
|
3912
3914
|
iconLeftName: "sparkles",
|
|
3913
3915
|
iconLeftScreenReaderText: "Start an agent",
|
|
3914
|
-
onClick: () =>
|
|
3916
|
+
onClick: () => We(!0),
|
|
3915
3917
|
children: "Start an agent"
|
|
3916
3918
|
}
|
|
3917
3919
|
)
|
|
3918
3920
|
] }),
|
|
3919
3921
|
z.length > 0 && hn && /* @__PURE__ */ o("div", { className: "agent-view__filters", children: [
|
|
3920
|
-
|
|
3922
|
+
Se && /* @__PURE__ */ o("div", { className: "agent-view__filter", children: [
|
|
3921
3923
|
/* @__PURE__ */ n(
|
|
3922
3924
|
"label",
|
|
3923
3925
|
{
|
|
@@ -3964,27 +3966,27 @@ const ba = (e, t) => (a) => {
|
|
|
3964
3966
|
] })
|
|
3965
3967
|
] }),
|
|
3966
3968
|
Ie === "error" ? /* @__PURE__ */ o("div", { className: "agent-view__state agent-view__state--error", role: "alert", children: [
|
|
3967
|
-
/* @__PURE__ */ n(
|
|
3968
|
-
/* @__PURE__ */ n("p", { className: "agent-view__state-message", children:
|
|
3969
|
+
/* @__PURE__ */ n(x, { name: "triangle-alert", size: 24, color: "var(--color-semantic-destructive-600)" }),
|
|
3970
|
+
/* @__PURE__ */ n("p", { className: "agent-view__state-message", children: E ?? pa }),
|
|
3969
3971
|
/* @__PURE__ */ n(F, { variant: "secondary", size: "S", onClick: M, children: "Try again" })
|
|
3970
3972
|
] }) : Ie === "loading" && z.length === 0 ? /* @__PURE__ */ o("div", { className: "agent-view__state", "aria-live": "polite", children: [
|
|
3971
3973
|
/* @__PURE__ */ n(
|
|
3972
|
-
|
|
3974
|
+
x,
|
|
3973
3975
|
{
|
|
3974
3976
|
name: "loader",
|
|
3975
3977
|
size: 24,
|
|
3976
3978
|
color: "var(--color-brand-600)",
|
|
3977
3979
|
className: "agent-view__progress-icon--spinning",
|
|
3978
|
-
screenReaderText:
|
|
3980
|
+
screenReaderText: Jn
|
|
3979
3981
|
}
|
|
3980
3982
|
),
|
|
3981
|
-
/* @__PURE__ */ n("p", { className: "agent-view__state-message", children:
|
|
3982
|
-
] }) : z.length === 0 ? /* @__PURE__ */ n(
|
|
3983
|
-
/* @__PURE__ */ n("div", { className: "agent-view__board", children:
|
|
3984
|
-
|
|
3983
|
+
/* @__PURE__ */ n("p", { className: "agent-view__state-message", children: Jn })
|
|
3984
|
+
] }) : z.length === 0 ? /* @__PURE__ */ n(Bs, {}) : /* @__PURE__ */ o(ue, { children: [
|
|
3985
|
+
/* @__PURE__ */ n("div", { className: "agent-view__board", children: hs.map((d) => /* @__PURE__ */ n(
|
|
3986
|
+
wi,
|
|
3985
3987
|
{
|
|
3986
|
-
column:
|
|
3987
|
-
agents:
|
|
3988
|
+
column: Dt[d],
|
|
3989
|
+
agents: Nt[d] ?? [],
|
|
3988
3990
|
...Kt
|
|
3989
3991
|
},
|
|
3990
3992
|
d
|
|
@@ -3999,22 +4001,22 @@ const ba = (e, t) => (a) => {
|
|
|
3999
4001
|
},
|
|
4000
4002
|
children: [
|
|
4001
4003
|
/* @__PURE__ */ o("summary", { className: "agent-view__archived-summary", children: [
|
|
4002
|
-
/* @__PURE__ */ n(
|
|
4004
|
+
/* @__PURE__ */ n(Je, { level: 4, children: "Archived" }),
|
|
4003
4005
|
/* @__PURE__ */ n("span", { className: "agent-view__column-count", children: He.length })
|
|
4004
4006
|
] }),
|
|
4005
4007
|
/* @__PURE__ */ n("ul", { className: "agent-view__card-list agent-view__archived-list", children: He.map((d) => /* @__PURE__ */ n(
|
|
4006
|
-
|
|
4008
|
+
Ra,
|
|
4007
4009
|
{
|
|
4008
4010
|
agent: d,
|
|
4009
4011
|
agentName: nn(d, _e),
|
|
4010
|
-
column:
|
|
4011
|
-
isExpanded:
|
|
4012
|
+
column: Dt[kn(d, le[d.invocation_id])],
|
|
4013
|
+
isExpanded: Ne === d.id,
|
|
4012
4014
|
isLoading: ot === d.id,
|
|
4013
4015
|
checklist: le[d.invocation_id] ?? null,
|
|
4014
4016
|
error: Pe[d.id] ?? null,
|
|
4015
4017
|
canArchive: !1,
|
|
4016
|
-
canUnarchive: !!
|
|
4017
|
-
canDelete:
|
|
4018
|
+
canUnarchive: !!y,
|
|
4019
|
+
canDelete: T,
|
|
4018
4020
|
onToggle: Ht,
|
|
4019
4021
|
onViewAgent: Bt,
|
|
4020
4022
|
onUnarchive: pn,
|
|
@@ -4026,11 +4028,11 @@ const ba = (e, t) => (a) => {
|
|
|
4026
4028
|
}
|
|
4027
4029
|
) : null
|
|
4028
4030
|
] }),
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
+
J && /* @__PURE__ */ n(
|
|
4032
|
+
ri,
|
|
4031
4033
|
{
|
|
4032
|
-
agent:
|
|
4033
|
-
invocationId:
|
|
4034
|
+
agent: J,
|
|
4035
|
+
invocationId: J.invocation_id,
|
|
4034
4036
|
open: !0,
|
|
4035
4037
|
jwt: e,
|
|
4036
4038
|
headers: oe,
|
|
@@ -4041,46 +4043,46 @@ const ba = (e, t) => (a) => {
|
|
|
4041
4043
|
agentChatUrl: c,
|
|
4042
4044
|
agentConversationUrl: A,
|
|
4043
4045
|
pauseAgentUrl: f,
|
|
4044
|
-
resumeAgentUrl:
|
|
4046
|
+
resumeAgentUrl: N,
|
|
4045
4047
|
archiveAgentUrl: _,
|
|
4046
|
-
unarchiveAgentUrl:
|
|
4048
|
+
unarchiveAgentUrl: y,
|
|
4047
4049
|
enableUpload: h,
|
|
4048
|
-
adminMode:
|
|
4049
|
-
initialChecklist: le[
|
|
4050
|
-
usePusherToRepoll:
|
|
4050
|
+
adminMode: T,
|
|
4051
|
+
initialChecklist: le[J.invocation_id] ?? null,
|
|
4052
|
+
usePusherToRepoll: D,
|
|
4051
4053
|
pusherChannelPrefix: k,
|
|
4052
4054
|
pusherKey: m,
|
|
4053
4055
|
pusherCluster: b,
|
|
4054
4056
|
subscribeToPusher: $,
|
|
4055
4057
|
onClose: qt,
|
|
4056
|
-
onAgentUpdated:
|
|
4058
|
+
onAgentUpdated: xt,
|
|
4057
4059
|
onArchived: () => {
|
|
4058
|
-
Le(
|
|
4060
|
+
Le(J.id), gt(!0), O();
|
|
4059
4061
|
},
|
|
4060
4062
|
onUnarchived: () => {
|
|
4061
4063
|
O();
|
|
4062
4064
|
},
|
|
4063
4065
|
onDeleted: () => {
|
|
4064
|
-
Ye(
|
|
4066
|
+
Ye(J.invocation_id);
|
|
4065
4067
|
}
|
|
4066
4068
|
},
|
|
4067
|
-
|
|
4069
|
+
J.id
|
|
4068
4070
|
),
|
|
4069
4071
|
/* @__PURE__ */ n(
|
|
4070
|
-
|
|
4072
|
+
_a,
|
|
4071
4073
|
{
|
|
4072
|
-
open: !!
|
|
4074
|
+
open: !!W,
|
|
4073
4075
|
isInProgress: Ft,
|
|
4074
4076
|
isArchiving: ht,
|
|
4075
4077
|
error: on,
|
|
4076
4078
|
onCancel: gn,
|
|
4077
4079
|
onConfirm: () => {
|
|
4078
|
-
|
|
4080
|
+
yt();
|
|
4079
4081
|
}
|
|
4080
4082
|
}
|
|
4081
4083
|
),
|
|
4082
4084
|
/* @__PURE__ */ n(
|
|
4083
|
-
|
|
4085
|
+
va,
|
|
4084
4086
|
{
|
|
4085
4087
|
open: !!Ze,
|
|
4086
4088
|
isUnarchiving: pt,
|
|
@@ -4092,28 +4094,28 @@ const ba = (e, t) => (a) => {
|
|
|
4092
4094
|
}
|
|
4093
4095
|
),
|
|
4094
4096
|
/* @__PURE__ */ n(
|
|
4095
|
-
|
|
4097
|
+
fa,
|
|
4096
4098
|
{
|
|
4097
4099
|
open: !!$e,
|
|
4098
4100
|
isDeleting: _t,
|
|
4099
4101
|
error: un,
|
|
4100
4102
|
onCancel: mn,
|
|
4101
4103
|
onConfirm: () => {
|
|
4102
|
-
|
|
4104
|
+
Et();
|
|
4103
4105
|
}
|
|
4104
4106
|
}
|
|
4105
4107
|
),
|
|
4106
4108
|
/* @__PURE__ */ n(
|
|
4107
|
-
|
|
4109
|
+
mi,
|
|
4108
4110
|
{
|
|
4109
|
-
open:
|
|
4110
|
-
onClose: () =>
|
|
4111
|
+
open: je,
|
|
4112
|
+
onClose: () => We(!1),
|
|
4111
4113
|
onStart: kt,
|
|
4112
4114
|
agentDefinitions: pe
|
|
4113
4115
|
}
|
|
4114
4116
|
)
|
|
4115
4117
|
] });
|
|
4116
|
-
},
|
|
4118
|
+
}, Ii = (e, t) => {
|
|
4117
4119
|
const a = Date.now(), s = t.trim() || e.agent_intent;
|
|
4118
4120
|
return {
|
|
4119
4121
|
id: `agent-${a}`,
|
|
@@ -4121,45 +4123,45 @@ const ba = (e, t) => (a) => {
|
|
|
4121
4123
|
agent_definition_ref: e.ref,
|
|
4122
4124
|
agent_intent: e.agent_intent,
|
|
4123
4125
|
invocation_name: s,
|
|
4124
|
-
application_id:
|
|
4125
|
-
created_by:
|
|
4126
|
-
status:
|
|
4126
|
+
application_id: gs,
|
|
4127
|
+
created_by: ps,
|
|
4128
|
+
status: C["generating-a-response"],
|
|
4127
4129
|
archivedAt: null,
|
|
4128
4130
|
context_ref: null,
|
|
4129
4131
|
checklist_ref: null
|
|
4130
4132
|
};
|
|
4131
4133
|
};
|
|
4132
4134
|
export {
|
|
4133
|
-
|
|
4135
|
+
Oi as AgentMonitorKanban,
|
|
4134
4136
|
Pn as AgentServiceClient,
|
|
4135
4137
|
st as AgentServiceError,
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
+
ri as AgentView,
|
|
4139
|
+
Aa as DEFAULT_PUSHER_CHANNEL_PREFIX,
|
|
4138
4140
|
Wr as HttpChatConnector,
|
|
4139
4141
|
Zn as MESSAGE_TYPE_REPOLL,
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
+
mi as NewAgentModal,
|
|
4143
|
+
vr as PUSHER_AGENT_MESSAGE_EVENT,
|
|
4142
4144
|
qe as REPOLL_TARGET,
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4145
|
+
Ii as buildAgentFromDefinition,
|
|
4146
|
+
Nr as buildAgentPusherChannel,
|
|
4147
|
+
Ea as createHttpChatConnectorFactory,
|
|
4148
|
+
Ri as formatUserFileChatCardText,
|
|
4149
|
+
Ve as mapApiAgent,
|
|
4150
|
+
ka as mapApiAgentDefinition,
|
|
4151
|
+
Pr as mapApiAgentStatus,
|
|
4152
|
+
Hr as mapApiAgentTimelineResponse,
|
|
4151
4153
|
Ln as mapApiChecklistEndpointResponse,
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4154
|
+
ba as mapApiChecklistItem,
|
|
4155
|
+
Ti as mapApiChecklistResponse,
|
|
4156
|
+
Ur as mapApiChecklistStatus,
|
|
4157
|
+
zr as mapApiConversationMessages,
|
|
4156
4158
|
ln as mapApiOpeningMessage,
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4159
|
+
$r as mapApiResource,
|
|
4160
|
+
Mr as mapApiResourcesEndpointResponse,
|
|
4161
|
+
Ci as mapApiTripOption,
|
|
4162
|
+
Si as parseConversationContentCaption,
|
|
4163
|
+
kr as parseRepollMessages,
|
|
4164
|
+
Qr as useAgentService,
|
|
4165
|
+
ti as useAgentWorkspace,
|
|
4164
4166
|
Sr as useSubscribeToPusher
|
|
4165
4167
|
};
|