@arbor-education/agent-view-frontend 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +6 -6
- package/dist/index.d.ts +1 -0
- package/dist/index.js +770 -769
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as l, jsx as a, Fragment as ve } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as re, useState as g, useLayoutEffect as et, useEffect as D, useMemo as V, useCallback as
|
|
2
|
+
import { useRef as re, useState as g, useLayoutEffect as et, useEffect as D, useMemo as V, useCallback as S } from "react";
|
|
3
3
|
import j from "classnames";
|
|
4
|
-
import { Heading as Ee, Icon as L, Dot as
|
|
5
|
-
import { CHAT_RESPONSE_TYPE_AGENT as
|
|
4
|
+
import { Heading as Ee, Icon as L, Dot as Xt, SlideoverUtils as Ye, SlideoverManager as Rn, Modal as me, EditableText as In, Button as ie, Tabs as ut, SelectDropdown as On, TextInput as Ln, Combobox as Pt, Card as Un } from "@arbor-education/design-system.components";
|
|
5
|
+
import { CHAT_RESPONSE_TYPE_AGENT as Zt, CHAT_RESPONSE_TYPE_ERROR as Pn, ChatPanel as xn, CHAT_RESPONSE_TYPE_USER as Dn, CHAT_RESPONSE_TYPE_INFO as $n } from "@arbor-education/ask-arbor-chat-panel";
|
|
6
6
|
const T = {
|
|
7
7
|
"generating-a-response": "generating-a-response",
|
|
8
8
|
hitl: "hitl",
|
|
@@ -13,7 +13,7 @@ const T = {
|
|
|
13
13
|
hitl: "hitl",
|
|
14
14
|
complete: "complete",
|
|
15
15
|
failed: "failed"
|
|
16
|
-
},
|
|
16
|
+
}, B = {
|
|
17
17
|
briefing: "briefing",
|
|
18
18
|
running: "running",
|
|
19
19
|
stopped: "stopped",
|
|
@@ -29,7 +29,7 @@ const T = {
|
|
|
29
29
|
file: "file",
|
|
30
30
|
user_file: "user_file",
|
|
31
31
|
link: "link"
|
|
32
|
-
},
|
|
32
|
+
}, Qt = {
|
|
33
33
|
user_file: "user_file"
|
|
34
34
|
}, xt = {
|
|
35
35
|
cancelled: "cancelled",
|
|
@@ -97,28 +97,28 @@ const T = {
|
|
|
97
97
|
color: se.failed.color
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
-
},
|
|
100
|
+
}, Mn = [
|
|
101
101
|
T["generating-a-response"],
|
|
102
102
|
T.hitl
|
|
103
|
-
],
|
|
103
|
+
], Hn = [
|
|
104
104
|
T.complete,
|
|
105
105
|
T.failed
|
|
106
|
-
],
|
|
107
|
-
[
|
|
108
|
-
[
|
|
109
|
-
[
|
|
110
|
-
[
|
|
111
|
-
},
|
|
106
|
+
], zn = "m4", Gn = "1", en = "msg-opening", Ze = "Unable to load agent tasks. Please try again.", Bn = "Unable to load the resources for this agent", Fn = "Unable to load this document. Please try again.", tn = "Unable to load the timeline for this agent", qn = "Unable to stop the agent. Please try again.", Kn = "Unable to rename the agent. Please try again.", Jn = "Something went wrong. Please try again.", nn = "Unable to load agents. Please try again.", Ce = "Loading tasks…", Dt = "Loading agents…", Wn = "Task", jn = {
|
|
107
|
+
[B.briefing]: "Briefing",
|
|
108
|
+
[B.running]: "Working",
|
|
109
|
+
[B.stopped]: "Stopped",
|
|
110
|
+
[B.complete]: "Complete"
|
|
111
|
+
}, Vn = [
|
|
112
112
|
T["generating-a-response"],
|
|
113
113
|
T.hitl,
|
|
114
114
|
T.complete,
|
|
115
115
|
T.failed
|
|
116
|
-
],
|
|
116
|
+
], Yn = {
|
|
117
117
|
[T["generating-a-response"]]: "Agents currently working on tasks for you.",
|
|
118
118
|
[T.hitl]: "Agents that need your input before they can continue.",
|
|
119
119
|
[T.complete]: "Agents that have finished their work.",
|
|
120
120
|
[T.failed]: "Agents that failed or were stopped."
|
|
121
|
-
},
|
|
121
|
+
}, Xn = () => /* @__PURE__ */ l(
|
|
122
122
|
"svg",
|
|
123
123
|
{
|
|
124
124
|
className: "agent-view__empty-illustration",
|
|
@@ -234,18 +234,18 @@ const T = {
|
|
|
234
234
|
/* @__PURE__ */ a("circle", { cx: "256", cy: "160", r: "4", fill: "var(--color-semantic-destructive-500)" })
|
|
235
235
|
]
|
|
236
236
|
}
|
|
237
|
-
),
|
|
238
|
-
const
|
|
239
|
-
return
|
|
237
|
+
), Zn = ({ status: e }) => {
|
|
238
|
+
const t = Qe[e];
|
|
239
|
+
return t.statusIcon ? /* @__PURE__ */ a(
|
|
240
240
|
L,
|
|
241
241
|
{
|
|
242
|
-
name:
|
|
242
|
+
name: t.statusIcon.name,
|
|
243
243
|
size: 16,
|
|
244
|
-
color:
|
|
245
|
-
screenReaderText:
|
|
244
|
+
color: t.statusIcon.color,
|
|
245
|
+
screenReaderText: t.title
|
|
246
246
|
}
|
|
247
|
-
) : /* @__PURE__ */ a(
|
|
248
|
-
},
|
|
247
|
+
) : /* @__PURE__ */ a(Xt, { colour: t.dotColour, label: t.title });
|
|
248
|
+
}, Qn = () => /* @__PURE__ */ l(
|
|
249
249
|
"section",
|
|
250
250
|
{
|
|
251
251
|
className: "agent-view__empty",
|
|
@@ -254,15 +254,15 @@ const T = {
|
|
|
254
254
|
/* @__PURE__ */ l("div", { className: "agent-view__empty-content", children: [
|
|
255
255
|
/* @__PURE__ */ a(Ee, { level: 4, children: "Your agents board" }),
|
|
256
256
|
/* @__PURE__ */ a("p", { className: "agent-view__empty-lead", children: "When you start an agent, it appears here so you can track progress at a glance. Agents move between columns as their status changes." }),
|
|
257
|
-
/* @__PURE__ */ a("ul", { className: "agent-view__empty-columns", children:
|
|
258
|
-
const
|
|
257
|
+
/* @__PURE__ */ a("ul", { className: "agent-view__empty-columns", children: Vn.map((e) => {
|
|
258
|
+
const t = Qe[e];
|
|
259
259
|
return /* @__PURE__ */ l("li", { className: "agent-view__empty-column", children: [
|
|
260
|
-
/* @__PURE__ */ a("span", { className: "agent-view__empty-column-indicator", children: /* @__PURE__ */ a(
|
|
260
|
+
/* @__PURE__ */ a("span", { className: "agent-view__empty-column-indicator", children: /* @__PURE__ */ a(Zn, { status: e }) }),
|
|
261
261
|
/* @__PURE__ */ l("span", { className: "agent-view__empty-column-text", children: [
|
|
262
|
-
/* @__PURE__ */ a("span", { className: "agent-view__empty-column-title", children:
|
|
263
|
-
/* @__PURE__ */ a("span", { className: "agent-view__empty-column-description", children:
|
|
262
|
+
/* @__PURE__ */ a("span", { className: "agent-view__empty-column-title", children: t.title }),
|
|
263
|
+
/* @__PURE__ */ a("span", { className: "agent-view__empty-column-description", children: Yn[e] })
|
|
264
264
|
] })
|
|
265
|
-
] },
|
|
265
|
+
] }, e);
|
|
266
266
|
}) }),
|
|
267
267
|
/* @__PURE__ */ l("p", { className: "agent-view__empty-hint", children: [
|
|
268
268
|
"Use ",
|
|
@@ -270,23 +270,23 @@ const T = {
|
|
|
270
270
|
" above to begin."
|
|
271
271
|
] })
|
|
272
272
|
] }),
|
|
273
|
-
/* @__PURE__ */ a("div", { className: "agent-view__empty-visual", children: /* @__PURE__ */ a(
|
|
273
|
+
/* @__PURE__ */ a("div", { className: "agent-view__empty-visual", children: /* @__PURE__ */ a(Xn, {}) })
|
|
274
274
|
]
|
|
275
275
|
}
|
|
276
|
-
),
|
|
276
|
+
), ea = () => ({
|
|
277
277
|
needsInput: [],
|
|
278
278
|
complete: [],
|
|
279
279
|
failed: [],
|
|
280
280
|
tasks: []
|
|
281
|
-
}),
|
|
282
|
-
...
|
|
283
|
-
...
|
|
284
|
-
}),
|
|
285
|
-
const
|
|
286
|
-
for (const o of
|
|
287
|
-
const i = o.children ?
|
|
288
|
-
if (
|
|
289
|
-
|
|
281
|
+
}), ta = (e, t) => ({
|
|
282
|
+
...e,
|
|
283
|
+
...t.length > 0 ? { children: t } : {}
|
|
284
|
+
}), an = (e) => {
|
|
285
|
+
const t = [], n = [], s = [], r = [];
|
|
286
|
+
for (const o of e) {
|
|
287
|
+
const i = o.children ? an(o.children) : ea();
|
|
288
|
+
if (t.push(...i.needsInput), n.push(...i.complete), s.push(...i.failed), o.status === M.hitl) {
|
|
289
|
+
t.push({ ...o, children: void 0 });
|
|
290
290
|
continue;
|
|
291
291
|
}
|
|
292
292
|
if (o.status === M.complete) {
|
|
@@ -297,24 +297,24 @@ const T = {
|
|
|
297
297
|
s.push({ ...o, children: void 0 });
|
|
298
298
|
continue;
|
|
299
299
|
}
|
|
300
|
-
r.push(
|
|
301
|
-
}
|
|
302
|
-
return { needsInput:
|
|
303
|
-
}, $t = (
|
|
304
|
-
const s = $t(
|
|
305
|
-
return s !== 0 ? s :
|
|
306
|
-
}).map(({ item:
|
|
307
|
-
if (!
|
|
300
|
+
r.push(ta(o, i.tasks));
|
|
301
|
+
}
|
|
302
|
+
return { needsInput: t, complete: n, failed: s, tasks: r };
|
|
303
|
+
}, $t = (e) => e === M.hitl ? 0 : e === M.complete ? 1 : e === M.failed ? 2 : 3, na = (e) => e.map((t, n) => ({ item: t, index: n })).sort((t, n) => {
|
|
304
|
+
const s = $t(t.item.status) - $t(n.item.status);
|
|
305
|
+
return s !== 0 ? s : t.index - n.index;
|
|
306
|
+
}).map(({ item: t }) => t), mt = 2, aa = (e) => {
|
|
307
|
+
if (!e)
|
|
308
308
|
return { canScrollUp: !1, canScrollDown: !1 };
|
|
309
|
-
const
|
|
310
|
-
return
|
|
311
|
-
canScrollUp:
|
|
312
|
-
canScrollDown:
|
|
309
|
+
const t = e.scrollHeight - e.clientHeight;
|
|
310
|
+
return t <= mt ? { canScrollUp: !1, canScrollDown: !1 } : {
|
|
311
|
+
canScrollUp: e.scrollTop > mt,
|
|
312
|
+
canScrollDown: e.scrollTop < t - mt
|
|
313
313
|
};
|
|
314
|
-
},
|
|
315
|
-
if (!
|
|
314
|
+
}, sa = (e, t) => {
|
|
315
|
+
if (!e || !t)
|
|
316
316
|
return null;
|
|
317
|
-
const n =
|
|
317
|
+
const n = e.getBoundingClientRect(), s = t.getBoundingClientRect();
|
|
318
318
|
return {
|
|
319
319
|
top: s.top - n.top,
|
|
320
320
|
left: s.left - n.left,
|
|
@@ -322,25 +322,25 @@ const T = {
|
|
|
322
322
|
height: s.height
|
|
323
323
|
};
|
|
324
324
|
}, tt = ({
|
|
325
|
-
children:
|
|
326
|
-
className:
|
|
325
|
+
children: e,
|
|
326
|
+
className: t,
|
|
327
327
|
contentClassName: n,
|
|
328
328
|
scrollSelector: s,
|
|
329
329
|
style: r,
|
|
330
330
|
"aria-label": o
|
|
331
331
|
}) => {
|
|
332
|
-
const i = re(null), p = re(null), [d, h] = g(!1), [m,
|
|
332
|
+
const i = re(null), p = re(null), [d, h] = g(!1), [m, N] = g(!1), [y, I] = g(null), F = () => {
|
|
333
333
|
var U;
|
|
334
334
|
return s ? ((U = i.current) == null ? void 0 : U.querySelector(s)) ?? null : p.current;
|
|
335
335
|
}, _ = () => {
|
|
336
|
-
const U =
|
|
336
|
+
const U = F(), A = aa(U);
|
|
337
337
|
if (h(
|
|
338
338
|
(f) => f === A.canScrollUp ? f : A.canScrollUp
|
|
339
|
-
),
|
|
339
|
+
), N(
|
|
340
340
|
(f) => f === A.canScrollDown ? f : A.canScrollDown
|
|
341
341
|
), s) {
|
|
342
|
-
const f =
|
|
343
|
-
I((
|
|
342
|
+
const f = sa(i.current, U);
|
|
343
|
+
I((b) => (b == null ? void 0 : b.top) === (f == null ? void 0 : f.top) && (b == null ? void 0 : b.left) === (f == null ? void 0 : f.left) && (b == null ? void 0 : b.width) === (f == null ? void 0 : f.width) && (b == null ? void 0 : b.height) === (f == null ? void 0 : f.height) ? b : f);
|
|
344
344
|
} else
|
|
345
345
|
I((f) => f === null ? f : null);
|
|
346
346
|
};
|
|
@@ -351,33 +351,33 @@ const T = {
|
|
|
351
351
|
if (!U)
|
|
352
352
|
return;
|
|
353
353
|
let A = null, f = null;
|
|
354
|
-
const
|
|
354
|
+
const b = () => {
|
|
355
355
|
A == null || A.removeEventListener("scroll", _), f == null || f.disconnect(), f = null, A = null;
|
|
356
356
|
}, w = (z) => {
|
|
357
357
|
if (z === A) {
|
|
358
358
|
_();
|
|
359
359
|
return;
|
|
360
360
|
}
|
|
361
|
-
if (
|
|
361
|
+
if (b(), A = z, !A) {
|
|
362
362
|
_();
|
|
363
363
|
return;
|
|
364
364
|
}
|
|
365
365
|
A.addEventListener("scroll", _, { passive: !0 }), f = new ResizeObserver(() => _()), f.observe(A), A.firstElementChild instanceof HTMLElement && f.observe(A.firstElementChild), _();
|
|
366
366
|
};
|
|
367
|
-
w(
|
|
367
|
+
w(F());
|
|
368
368
|
const R = new MutationObserver(() => {
|
|
369
|
-
w(
|
|
369
|
+
w(F());
|
|
370
370
|
});
|
|
371
371
|
return R.observe(U, {
|
|
372
372
|
childList: !0,
|
|
373
373
|
subtree: !0,
|
|
374
374
|
characterData: !0
|
|
375
375
|
}), window.addEventListener("resize", _), () => {
|
|
376
|
-
window.removeEventListener("resize", _), R.disconnect(),
|
|
376
|
+
window.removeEventListener("resize", _), R.disconnect(), b();
|
|
377
377
|
};
|
|
378
378
|
}, [s]);
|
|
379
379
|
const x = (U) => {
|
|
380
|
-
const A =
|
|
380
|
+
const A = F();
|
|
381
381
|
if (!A)
|
|
382
382
|
return;
|
|
383
383
|
const f = Math.max(A.clientHeight * 0.75, 120);
|
|
@@ -423,11 +423,11 @@ const T = {
|
|
|
423
423
|
"div",
|
|
424
424
|
{
|
|
425
425
|
ref: i,
|
|
426
|
-
className: j("scrollable-region",
|
|
426
|
+
className: j("scrollable-region", t),
|
|
427
427
|
style: r,
|
|
428
428
|
"aria-label": o,
|
|
429
429
|
children: s ? /* @__PURE__ */ l(ve, { children: [
|
|
430
|
-
|
|
430
|
+
e,
|
|
431
431
|
y && (d || m) && /* @__PURE__ */ a(
|
|
432
432
|
"div",
|
|
433
433
|
{
|
|
@@ -448,23 +448,23 @@ const T = {
|
|
|
448
448
|
{
|
|
449
449
|
ref: p,
|
|
450
450
|
className: j("scrollable-region__viewport", n),
|
|
451
|
-
children:
|
|
451
|
+
children: e
|
|
452
452
|
}
|
|
453
453
|
)
|
|
454
454
|
] })
|
|
455
455
|
}
|
|
456
456
|
);
|
|
457
|
-
},
|
|
458
|
-
checklist:
|
|
457
|
+
}, ra = 48, ia = ({
|
|
458
|
+
checklist: e
|
|
459
459
|
}) => {
|
|
460
|
-
const
|
|
460
|
+
const t = re(null), n = re(!1);
|
|
461
461
|
return et(() => {
|
|
462
|
-
const s =
|
|
462
|
+
const s = t.current;
|
|
463
463
|
if (!s)
|
|
464
464
|
return;
|
|
465
465
|
const r = s.scrollHeight - s.scrollTop - s.clientHeight;
|
|
466
|
-
(!n.current || r <=
|
|
467
|
-
}, [
|
|
466
|
+
(!n.current || r <= ra) && (s.scrollTop = s.scrollHeight, n.current = !0);
|
|
467
|
+
}, [e]), e.length === 0 ? /* @__PURE__ */ a("p", { className: "agent-view__progress-empty", children: "No tasks to display." }) : /* @__PURE__ */ a(
|
|
468
468
|
tt,
|
|
469
469
|
{
|
|
470
470
|
className: "agent-view__progress-scroll",
|
|
@@ -472,10 +472,10 @@ const T = {
|
|
|
472
472
|
children: /* @__PURE__ */ a(
|
|
473
473
|
"ul",
|
|
474
474
|
{
|
|
475
|
-
ref:
|
|
475
|
+
ref: t,
|
|
476
476
|
className: "agent-view__progress-list",
|
|
477
477
|
"aria-label": "Agent tasks",
|
|
478
|
-
children:
|
|
478
|
+
children: na(e).map((s) => {
|
|
479
479
|
const r = se[s.status];
|
|
480
480
|
return /* @__PURE__ */ l(
|
|
481
481
|
"li",
|
|
@@ -513,23 +513,23 @@ const T = {
|
|
|
513
513
|
)
|
|
514
514
|
}
|
|
515
515
|
);
|
|
516
|
-
},
|
|
517
|
-
prompts:
|
|
518
|
-
classNamePrefix:
|
|
516
|
+
}, oa = ({
|
|
517
|
+
prompts: e,
|
|
518
|
+
classNamePrefix: t = "agent-workspace",
|
|
519
519
|
onSelect: n
|
|
520
|
-
}) =>
|
|
520
|
+
}) => e.length === 0 ? null : /* @__PURE__ */ a("div", { className: `${t}__chips`, children: e.map((s) => /* @__PURE__ */ a(
|
|
521
521
|
"button",
|
|
522
522
|
{
|
|
523
523
|
type: "button",
|
|
524
|
-
className: `${
|
|
524
|
+
className: `${t}__chip`,
|
|
525
525
|
onClick: () => n(s),
|
|
526
526
|
children: s
|
|
527
527
|
},
|
|
528
528
|
s
|
|
529
529
|
)) });
|
|
530
|
-
class
|
|
531
|
-
constructor(
|
|
532
|
-
this.connector =
|
|
530
|
+
class la {
|
|
531
|
+
constructor(t, n) {
|
|
532
|
+
this.connector = t, this.canSend = n.canSend, this.onTurn = n.onTurn, this.onAwaitingChange = n.onAwaitingChange;
|
|
533
533
|
}
|
|
534
534
|
get canRate() {
|
|
535
535
|
return !1;
|
|
@@ -546,47 +546,47 @@ class oa {
|
|
|
546
546
|
get ratingPopupUrls() {
|
|
547
547
|
return {};
|
|
548
548
|
}
|
|
549
|
-
async sendMessage(
|
|
549
|
+
async sendMessage(t) {
|
|
550
550
|
var n, s;
|
|
551
551
|
if (!this.canSend())
|
|
552
552
|
return null;
|
|
553
553
|
(n = this.onAwaitingChange) == null || n.call(this, !0);
|
|
554
554
|
try {
|
|
555
555
|
const r = await this.connector.sendMessage(
|
|
556
|
-
|
|
557
|
-
|
|
556
|
+
t.userMessage,
|
|
557
|
+
t.uploadFiles
|
|
558
558
|
);
|
|
559
559
|
return this.onTurn(r), {
|
|
560
560
|
id: r.message.id,
|
|
561
561
|
text: r.message.text,
|
|
562
|
-
type:
|
|
562
|
+
type: Zt,
|
|
563
563
|
...r.message.followUpPrompts ? { followUpPrompts: r.message.followUpPrompts } : {}
|
|
564
564
|
};
|
|
565
565
|
} catch {
|
|
566
566
|
return {
|
|
567
567
|
id: `error-${Date.now()}`,
|
|
568
|
-
text:
|
|
569
|
-
type:
|
|
568
|
+
text: Jn,
|
|
569
|
+
type: Pn
|
|
570
570
|
};
|
|
571
571
|
} finally {
|
|
572
572
|
(s = this.onAwaitingChange) == null || s.call(this, !1);
|
|
573
573
|
}
|
|
574
574
|
}
|
|
575
|
-
async loadHistory(
|
|
575
|
+
async loadHistory(t) {
|
|
576
576
|
return null;
|
|
577
577
|
}
|
|
578
578
|
async listInteractions() {
|
|
579
579
|
return null;
|
|
580
580
|
}
|
|
581
|
-
async rateMessage(
|
|
581
|
+
async rateMessage(t) {
|
|
582
582
|
}
|
|
583
|
-
async sendNotification(
|
|
583
|
+
async sendNotification(t) {
|
|
584
584
|
return !1;
|
|
585
585
|
}
|
|
586
586
|
}
|
|
587
|
-
const
|
|
588
|
-
connector:
|
|
589
|
-
phase:
|
|
587
|
+
const ca = ({
|
|
588
|
+
connector: e,
|
|
589
|
+
phase: t,
|
|
590
590
|
chatHistory: n,
|
|
591
591
|
chatSessionKey: s,
|
|
592
592
|
startQuery: r,
|
|
@@ -597,14 +597,14 @@ const la = ({
|
|
|
597
597
|
onClarificationPrompt: h,
|
|
598
598
|
onDismissClarification: m
|
|
599
599
|
}) => {
|
|
600
|
-
const
|
|
601
|
-
() => new
|
|
602
|
-
canSend: () =>
|
|
600
|
+
const N = V(
|
|
601
|
+
() => new la(e, {
|
|
602
|
+
canSend: () => t === B.running,
|
|
603
603
|
onTurn: p,
|
|
604
604
|
onAwaitingChange: d
|
|
605
605
|
}),
|
|
606
|
-
[
|
|
607
|
-
), y =
|
|
606
|
+
[e, t, p, d]
|
|
607
|
+
), y = t !== B.running, I = t === B.running;
|
|
608
608
|
return /* @__PURE__ */ l("section", { className: "agent-workspace__chat-body", "aria-label": "Chat", children: [
|
|
609
609
|
o && /* @__PURE__ */ l(
|
|
610
610
|
"div",
|
|
@@ -615,7 +615,7 @@ const la = ({
|
|
|
615
615
|
children: [
|
|
616
616
|
/* @__PURE__ */ a("p", { className: "agent-workspace__clarification-text", children: o.text }),
|
|
617
617
|
o.followUpPrompts && /* @__PURE__ */ a(
|
|
618
|
-
|
|
618
|
+
oa,
|
|
619
619
|
{
|
|
620
620
|
prompts: o.followUpPrompts,
|
|
621
621
|
onSelect: h
|
|
@@ -634,9 +634,9 @@ const la = ({
|
|
|
634
634
|
}
|
|
635
635
|
),
|
|
636
636
|
/* @__PURE__ */ a("div", { className: "agent-workspace__ask-arbor", children: /* @__PURE__ */ a(tt, { scrollSelector: ".chat-panel-message-list", children: /* @__PURE__ */ a(
|
|
637
|
-
|
|
637
|
+
xn,
|
|
638
638
|
{
|
|
639
|
-
connector:
|
|
639
|
+
connector: N,
|
|
640
640
|
chatHistory: n,
|
|
641
641
|
startQuery: r,
|
|
642
642
|
lockConversation: y,
|
|
@@ -652,22 +652,22 @@ const la = ({
|
|
|
652
652
|
},
|
|
653
653
|
s
|
|
654
654
|
) }) }),
|
|
655
|
-
|
|
655
|
+
t === B.stopped && /* @__PURE__ */ l("div", { className: "agent-workspace__notice", role: "status", children: [
|
|
656
656
|
/* @__PURE__ */ a(L, { name: "circle-alert", size: 16, color: "var(--color-semantic-warning-600)" }),
|
|
657
657
|
/* @__PURE__ */ a("span", { children: "You stopped the agent. Its progress is saved in the checklist." })
|
|
658
658
|
] }),
|
|
659
|
-
|
|
659
|
+
t === B.complete && /* @__PURE__ */ l("div", { className: "agent-workspace__notice", role: "status", children: [
|
|
660
660
|
/* @__PURE__ */ a(L, { name: "party-popper", size: 16, color: "var(--color-semantic-success-600)" }),
|
|
661
661
|
/* @__PURE__ */ a("span", { children: "The agent has finished." })
|
|
662
662
|
] })
|
|
663
663
|
] });
|
|
664
|
-
},
|
|
665
|
-
item:
|
|
666
|
-
depth:
|
|
664
|
+
}, sn = ({
|
|
665
|
+
item: e,
|
|
666
|
+
depth: t,
|
|
667
667
|
canRequestInput: n,
|
|
668
668
|
onAttentionItemClick: s
|
|
669
669
|
}) => {
|
|
670
|
-
const r = se[
|
|
670
|
+
const r = se[e.status], o = e.status.replace(/_/g, "-"), i = e.status === M.hitl && n && s, p = /* @__PURE__ */ l("div", { className: "agent-workspace__task-row", children: [
|
|
671
671
|
/* @__PURE__ */ a(
|
|
672
672
|
L,
|
|
673
673
|
{
|
|
@@ -678,15 +678,15 @@ const la = ({
|
|
|
678
678
|
}
|
|
679
679
|
),
|
|
680
680
|
/* @__PURE__ */ l("div", { className: "agent-workspace__task-content", children: [
|
|
681
|
-
/* @__PURE__ */ a("span", { className: "agent-workspace__task-label", children:
|
|
682
|
-
|
|
681
|
+
/* @__PURE__ */ a("span", { className: "agent-workspace__task-label", children: e.task }),
|
|
682
|
+
e.status !== M.complete && e.description && /* @__PURE__ */ a("span", { className: "agent-workspace__task-description", children: e.description })
|
|
683
683
|
] })
|
|
684
684
|
] });
|
|
685
685
|
return /* @__PURE__ */ l(
|
|
686
686
|
"li",
|
|
687
687
|
{
|
|
688
688
|
className: j("agent-workspace__task", `agent-workspace__task--${o}`, {
|
|
689
|
-
"agent-workspace__task--child":
|
|
689
|
+
"agent-workspace__task--child": t > 0
|
|
690
690
|
}),
|
|
691
691
|
children: [
|
|
692
692
|
i ? /* @__PURE__ */ a(
|
|
@@ -694,16 +694,16 @@ const la = ({
|
|
|
694
694
|
{
|
|
695
695
|
type: "button",
|
|
696
696
|
className: "agent-workspace__task-button",
|
|
697
|
-
"aria-label": `Provide input for ${
|
|
698
|
-
onClick: () => s(
|
|
697
|
+
"aria-label": `Provide input for ${e.task}`,
|
|
698
|
+
onClick: () => s(e),
|
|
699
699
|
children: p
|
|
700
700
|
}
|
|
701
701
|
) : p,
|
|
702
|
-
|
|
703
|
-
|
|
702
|
+
e.children && e.children.length > 0 && /* @__PURE__ */ a("ul", { className: "agent-workspace__task-children", children: e.children.map((d) => /* @__PURE__ */ a(
|
|
703
|
+
sn,
|
|
704
704
|
{
|
|
705
705
|
item: d,
|
|
706
|
-
depth:
|
|
706
|
+
depth: t + 1,
|
|
707
707
|
canRequestInput: n,
|
|
708
708
|
onAttentionItemClick: s
|
|
709
709
|
},
|
|
@@ -713,12 +713,12 @@ const la = ({
|
|
|
713
713
|
}
|
|
714
714
|
);
|
|
715
715
|
}, Xe = ({
|
|
716
|
-
items:
|
|
717
|
-
ariaLabel:
|
|
716
|
+
items: e,
|
|
717
|
+
ariaLabel: t,
|
|
718
718
|
canRequestInput: n,
|
|
719
719
|
onAttentionItemClick: s
|
|
720
|
-
}) => /* @__PURE__ */ a("ul", { className: "agent-workspace__task-list", "aria-label":
|
|
721
|
-
|
|
720
|
+
}) => /* @__PURE__ */ a("ul", { className: "agent-workspace__task-list", "aria-label": t, children: e.map((r) => /* @__PURE__ */ a(
|
|
721
|
+
sn,
|
|
722
722
|
{
|
|
723
723
|
item: r,
|
|
724
724
|
depth: 0,
|
|
@@ -726,17 +726,17 @@ const la = ({
|
|
|
726
726
|
onAttentionItemClick: s
|
|
727
727
|
},
|
|
728
728
|
r.task
|
|
729
|
-
)) }),
|
|
730
|
-
checklist:
|
|
731
|
-
isLoading:
|
|
729
|
+
)) }), da = ({
|
|
730
|
+
checklist: e,
|
|
731
|
+
isLoading: t,
|
|
732
732
|
error: n,
|
|
733
733
|
phase: s,
|
|
734
734
|
canRequestInput: r,
|
|
735
735
|
onAttentionItemClick: o
|
|
736
736
|
}) => {
|
|
737
737
|
const i = V(
|
|
738
|
-
() =>
|
|
739
|
-
[
|
|
738
|
+
() => e ? an(e) : null,
|
|
739
|
+
[e]
|
|
740
740
|
);
|
|
741
741
|
return /* @__PURE__ */ l(
|
|
742
742
|
"section",
|
|
@@ -746,7 +746,7 @@ const la = ({
|
|
|
746
746
|
children: [
|
|
747
747
|
/* @__PURE__ */ a("div", { className: "agent-workspace__panel-header", children: /* @__PURE__ */ a(Ee, { level: 4, children: "Checklist" }) }),
|
|
748
748
|
/* @__PURE__ */ a("div", { className: "agent-workspace__panel-body", "aria-live": "polite", children: /* @__PURE__ */ l(tt, { children: [
|
|
749
|
-
|
|
749
|
+
t && /* @__PURE__ */ l("div", { className: "agent-workspace__loading", children: [
|
|
750
750
|
/* @__PURE__ */ a(
|
|
751
751
|
L,
|
|
752
752
|
{
|
|
@@ -759,8 +759,8 @@ const la = ({
|
|
|
759
759
|
),
|
|
760
760
|
/* @__PURE__ */ a("span", { children: Ce })
|
|
761
761
|
] }),
|
|
762
|
-
!
|
|
763
|
-
!
|
|
762
|
+
!t && n && /* @__PURE__ */ a("p", { className: "agent-workspace__error", role: "alert", children: n }),
|
|
763
|
+
!t && !n && i && /* @__PURE__ */ l(ve, { children: [
|
|
764
764
|
i.needsInput.length > 0 && /* @__PURE__ */ l("div", { className: "agent-workspace__task-group", children: [
|
|
765
765
|
/* @__PURE__ */ a("p", { className: "agent-workspace__task-group-label", children: "Needs your input" }),
|
|
766
766
|
/* @__PURE__ */ a(
|
|
@@ -834,20 +834,20 @@ const la = ({
|
|
|
834
834
|
}
|
|
835
835
|
)
|
|
836
836
|
] }),
|
|
837
|
-
!
|
|
837
|
+
!t && !n && (!i || i.needsInput.length === 0 && i.complete.length === 0 && i.failed.length === 0 && i.tasks.length === 0) && /* @__PURE__ */ a("p", { className: "agent-workspace__empty", children: s === B.briefing ? "Tasks will appear here once the agent starts." : "No tasks to display." })
|
|
838
838
|
] }) })
|
|
839
839
|
]
|
|
840
840
|
}
|
|
841
841
|
);
|
|
842
|
-
},
|
|
843
|
-
resource:
|
|
844
|
-
html:
|
|
842
|
+
}, ga = ({
|
|
843
|
+
resource: e,
|
|
844
|
+
html: t,
|
|
845
845
|
isLoading: n,
|
|
846
846
|
error: s,
|
|
847
847
|
onClose: r
|
|
848
848
|
}) => {
|
|
849
849
|
D(() => {
|
|
850
|
-
if (!
|
|
850
|
+
if (!e)
|
|
851
851
|
return;
|
|
852
852
|
const i = Ye.removeSlideover;
|
|
853
853
|
return Ye.removeSlideover = () => {
|
|
@@ -855,15 +855,15 @@ const la = ({
|
|
|
855
855
|
}, () => {
|
|
856
856
|
Ye.removeSlideover = i;
|
|
857
857
|
};
|
|
858
|
-
}, [
|
|
859
|
-
if (!
|
|
858
|
+
}, [e, r]), D(() => {
|
|
859
|
+
if (!e)
|
|
860
860
|
return;
|
|
861
861
|
const i = (p) => {
|
|
862
862
|
p.key === "Escape" && Ye.removeSlideover();
|
|
863
863
|
};
|
|
864
864
|
return window.addEventListener("keydown", i), () => window.removeEventListener("keydown", i);
|
|
865
|
-
}, [
|
|
866
|
-
const o = V(() =>
|
|
865
|
+
}, [e]);
|
|
866
|
+
const o = V(() => e ? [
|
|
867
867
|
{
|
|
868
868
|
centerHeaderText: !1,
|
|
869
869
|
children: /* @__PURE__ */ l("div", { className: "resource-preview-slideover__body", children: [
|
|
@@ -881,20 +881,20 @@ const la = ({
|
|
|
881
881
|
/* @__PURE__ */ a("span", { children: "Loading document…" })
|
|
882
882
|
] }),
|
|
883
883
|
!n && s && /* @__PURE__ */ a("p", { className: "resource-preview-slideover__error", role: "alert", children: s }),
|
|
884
|
-
!n && !s &&
|
|
884
|
+
!n && !s && t !== null && /* @__PURE__ */ a(
|
|
885
885
|
"iframe",
|
|
886
886
|
{
|
|
887
887
|
className: "resource-preview-slideover__frame",
|
|
888
|
-
title:
|
|
888
|
+
title: e.title,
|
|
889
889
|
sandbox: "",
|
|
890
|
-
srcDoc:
|
|
890
|
+
srcDoc: t
|
|
891
891
|
}
|
|
892
892
|
)
|
|
893
893
|
] })
|
|
894
894
|
}
|
|
895
|
-
] : [], [
|
|
896
|
-
return /* @__PURE__ */ a("div", { className: "resource-preview-slideover", children: /* @__PURE__ */ a(
|
|
897
|
-
},
|
|
895
|
+
] : [], [e, t, n, s]);
|
|
896
|
+
return /* @__PURE__ */ a("div", { className: "resource-preview-slideover", children: /* @__PURE__ */ a(Rn, { slideovers: o }) });
|
|
897
|
+
}, ha = {
|
|
898
898
|
[pe.mis_record]: {
|
|
899
899
|
icon: "table",
|
|
900
900
|
label: "Arbor MIS",
|
|
@@ -925,9 +925,9 @@ const la = ({
|
|
|
925
925
|
label: "Link",
|
|
926
926
|
color: "var(--color-semantic-info-700)"
|
|
927
927
|
}
|
|
928
|
-
},
|
|
929
|
-
resources:
|
|
930
|
-
isLoading:
|
|
928
|
+
}, ua = ({
|
|
929
|
+
resources: e,
|
|
930
|
+
isLoading: t = !1,
|
|
931
931
|
error: n = null,
|
|
932
932
|
onOpenResource: s
|
|
933
933
|
}) => /* @__PURE__ */ l(
|
|
@@ -938,10 +938,10 @@ const la = ({
|
|
|
938
938
|
children: [
|
|
939
939
|
/* @__PURE__ */ l("div", { className: "agent-workspace__panel-header", children: [
|
|
940
940
|
/* @__PURE__ */ a(Ee, { level: 4, children: "Resources" }),
|
|
941
|
-
/* @__PURE__ */ a("span", { className: "agent-workspace__panel-count", children:
|
|
941
|
+
/* @__PURE__ */ a("span", { className: "agent-workspace__panel-count", children: e.length })
|
|
942
942
|
] }),
|
|
943
943
|
/* @__PURE__ */ a("div", { className: "agent-workspace__panel-body", "aria-live": "polite", children: /* @__PURE__ */ l(tt, { children: [
|
|
944
|
-
|
|
944
|
+
t && /* @__PURE__ */ l("div", { className: "agent-workspace__loading", children: [
|
|
945
945
|
/* @__PURE__ */ a(
|
|
946
946
|
L,
|
|
947
947
|
{
|
|
@@ -954,9 +954,9 @@ const la = ({
|
|
|
954
954
|
),
|
|
955
955
|
/* @__PURE__ */ a("span", { children: "Loading resources…" })
|
|
956
956
|
] }),
|
|
957
|
-
!
|
|
958
|
-
!
|
|
959
|
-
const o =
|
|
957
|
+
!t && n && /* @__PURE__ */ a("p", { className: "agent-workspace__error", role: "alert", children: n }),
|
|
958
|
+
!t && !n && e.length > 0 && /* @__PURE__ */ a("ul", { className: "agent-workspace__resource-list", "aria-label": "Agent resources", children: e.map((r) => {
|
|
959
|
+
const o = ha[r.type], i = r.misRecordUrl;
|
|
960
960
|
return /* @__PURE__ */ a("li", { className: "agent-workspace__resource", children: i ? /* @__PURE__ */ a(
|
|
961
961
|
"a",
|
|
962
962
|
{
|
|
@@ -979,21 +979,21 @@ const la = ({
|
|
|
979
979
|
}
|
|
980
980
|
) }, r.id);
|
|
981
981
|
}) }),
|
|
982
|
-
!
|
|
982
|
+
!t && !n && e.length === 0 && /* @__PURE__ */ a("p", { className: "agent-workspace__empty", children: "No resources yet." })
|
|
983
983
|
] }) })
|
|
984
984
|
]
|
|
985
985
|
}
|
|
986
|
-
), Mt = ({ resource:
|
|
986
|
+
), Mt = ({ resource: e, config: t, external: n = !1 }) => /* @__PURE__ */ l(ve, { children: [
|
|
987
987
|
/* @__PURE__ */ a(
|
|
988
988
|
"span",
|
|
989
989
|
{
|
|
990
|
-
className: `agent-workspace__resource-icon agent-workspace__resource-icon--${
|
|
991
|
-
children: /* @__PURE__ */ a(L, { name:
|
|
990
|
+
className: `agent-workspace__resource-icon agent-workspace__resource-icon--${e.type}`,
|
|
991
|
+
children: /* @__PURE__ */ a(L, { name: t.icon, size: 16, color: t.color, screenReaderText: `${t.label}:` })
|
|
992
992
|
}
|
|
993
993
|
),
|
|
994
994
|
/* @__PURE__ */ a("span", { className: "agent-workspace__resource-content", children: /* @__PURE__ */ l("span", { className: "agent-workspace__resource-top", children: [
|
|
995
|
-
/* @__PURE__ */ a("span", { className: "agent-workspace__resource-name", children:
|
|
996
|
-
/* @__PURE__ */ a("span", { className: `agent-workspace__resource-badge agent-workspace__resource-badge--${
|
|
995
|
+
/* @__PURE__ */ a("span", { className: "agent-workspace__resource-name", children: e.title }),
|
|
996
|
+
/* @__PURE__ */ a("span", { className: `agent-workspace__resource-badge agent-workspace__resource-badge--${e.type}`, children: t.label })
|
|
997
997
|
] }) }),
|
|
998
998
|
n && /* @__PURE__ */ a(
|
|
999
999
|
L,
|
|
@@ -1005,34 +1005,34 @@ const la = ({
|
|
|
1005
1005
|
className: "agent-workspace__resource-open"
|
|
1006
1006
|
}
|
|
1007
1007
|
)
|
|
1008
|
-
] }), Ht = (
|
|
1009
|
-
const
|
|
1010
|
-
return Number.isFinite(
|
|
1011
|
-
},
|
|
1008
|
+
] }), Ht = (e) => {
|
|
1009
|
+
const t = Date.parse(e);
|
|
1010
|
+
return Number.isFinite(t) ? t : 0;
|
|
1011
|
+
}, pa = new Intl.DateTimeFormat("en-GB", {
|
|
1012
1012
|
day: "numeric",
|
|
1013
1013
|
month: "long",
|
|
1014
1014
|
year: "numeric",
|
|
1015
1015
|
hour: "numeric",
|
|
1016
1016
|
minute: "2-digit"
|
|
1017
|
-
}), _t = (
|
|
1018
|
-
const
|
|
1019
|
-
return Number.isFinite(
|
|
1020
|
-
}, zt = (
|
|
1017
|
+
}), _t = (e) => {
|
|
1018
|
+
const t = new Date(e);
|
|
1019
|
+
return Number.isFinite(t.getTime()) ? pa.format(t) : e;
|
|
1020
|
+
}, zt = (e) => e.replace(
|
|
1021
1021
|
/[A-Za-z0-9]+(?:[_-][A-Za-z0-9]+)+/g,
|
|
1022
|
-
(
|
|
1023
|
-
), Gt = (
|
|
1024
|
-
const n =
|
|
1022
|
+
(t) => t.split(/[_-]/).map((n) => n.charAt(0).toUpperCase() + n.slice(1).toLowerCase()).join(" ")
|
|
1023
|
+
), Gt = (e) => {
|
|
1024
|
+
const n = e.replace(
|
|
1025
1025
|
/[A-Za-z0-9]+(?:[_-][A-Za-z0-9]+)+/g,
|
|
1026
1026
|
(s) => s.split(/[_-]/).map((r) => r.toLowerCase()).join(" ")
|
|
1027
1027
|
).toLowerCase();
|
|
1028
1028
|
return n && n.charAt(0).toUpperCase() + n.slice(1);
|
|
1029
|
-
},
|
|
1030
|
-
const n =
|
|
1029
|
+
}, ma = 60 * 60 * 1e3, rn = 60 * 60 * 1e3, $e = 24 * rn, vt = 7 * $e, _a = (e) => e.type !== "message-sent", fa = (e, t) => {
|
|
1030
|
+
const n = e.filter(_a).map((r, o) => ({
|
|
1031
1031
|
kind: "action",
|
|
1032
1032
|
id: `action-${r.timestamp}-${o}`,
|
|
1033
1033
|
timestampMs: Ht(r.timestamp),
|
|
1034
1034
|
item: r
|
|
1035
|
-
})), s =
|
|
1035
|
+
})), s = t.map((r) => ({
|
|
1036
1036
|
kind: "chat",
|
|
1037
1037
|
id: r.sessionId,
|
|
1038
1038
|
timestampMs: Ht(r.timestamp),
|
|
@@ -1041,47 +1041,47 @@ const la = ({
|
|
|
1041
1041
|
return [...n, ...s].sort(
|
|
1042
1042
|
(r, o) => r.timestampMs - o.timestampMs || r.id.localeCompare(o.id)
|
|
1043
1043
|
);
|
|
1044
|
-
},
|
|
1045
|
-
if (
|
|
1046
|
-
const s = Math.max(1, Math.round(
|
|
1044
|
+
}, va = (e) => e >= vt ? "weeks" : e >= $e ? "days" : "hours", wa = (e) => {
|
|
1045
|
+
if (e < $e) {
|
|
1046
|
+
const s = Math.max(1, Math.round(e / rn));
|
|
1047
1047
|
return s === 1 ? "1 hour later" : `${s} hours later`;
|
|
1048
1048
|
}
|
|
1049
|
-
if (
|
|
1050
|
-
const s = Math.max(1, Math.round(
|
|
1049
|
+
if (e < vt) {
|
|
1050
|
+
const s = Math.max(1, Math.round(e / $e));
|
|
1051
1051
|
return s === 1 ? "1 day later" : `${s} days later`;
|
|
1052
1052
|
}
|
|
1053
|
-
const
|
|
1054
|
-
if (
|
|
1055
|
-
return
|
|
1056
|
-
const n = Math.max(1, Math.round(
|
|
1053
|
+
const t = Math.max(1, Math.round(e / vt));
|
|
1054
|
+
if (t < 5)
|
|
1055
|
+
return t === 1 ? "1 week later" : `${t} weeks later`;
|
|
1056
|
+
const n = Math.max(1, Math.round(e / (30 * $e)));
|
|
1057
1057
|
return n === 1 ? "1 month later" : `${n} months later`;
|
|
1058
|
-
},
|
|
1059
|
-
if (
|
|
1058
|
+
}, ya = (e, t = ma) => {
|
|
1059
|
+
if (e.length === 0)
|
|
1060
1060
|
return [];
|
|
1061
|
-
const n = [
|
|
1062
|
-
for (let s = 1; s <
|
|
1063
|
-
const r =
|
|
1064
|
-
i >=
|
|
1061
|
+
const n = [e[0]];
|
|
1062
|
+
for (let s = 1; s < e.length; s += 1) {
|
|
1063
|
+
const r = e[s - 1], o = e[s], i = o.timestampMs - r.timestampMs;
|
|
1064
|
+
i >= t && n.push({
|
|
1065
1065
|
kind: "gap",
|
|
1066
1066
|
id: `gap-${r.id}-${o.id}`,
|
|
1067
1067
|
durationMs: i,
|
|
1068
|
-
label:
|
|
1069
|
-
size:
|
|
1068
|
+
label: wa(i),
|
|
1069
|
+
size: va(i)
|
|
1070
1070
|
}), n.push(o);
|
|
1071
1071
|
}
|
|
1072
1072
|
return n;
|
|
1073
|
-
},
|
|
1074
|
-
timeline:
|
|
1075
|
-
isLoading:
|
|
1073
|
+
}, ka = (e) => e.type === "checklist-updated" ? "checklist" : e.type === "status-transition" ? "status" : "note", Na = ({
|
|
1074
|
+
timeline: e,
|
|
1075
|
+
isLoading: t,
|
|
1076
1076
|
error: n,
|
|
1077
1077
|
onOpenChatSession: s
|
|
1078
1078
|
}) => {
|
|
1079
|
-
const r = (
|
|
1079
|
+
const r = (e == null ? void 0 : e.actionLog) ?? [], o = (e == null ? void 0 : e.chatSessions) ?? [], i = fa(r, o), p = ya(i), d = !t && !n && i.length === 0;
|
|
1080
1080
|
return /* @__PURE__ */ l("section", { className: "agent-workspace__timeline", "aria-label": "Agent timeline", children: [
|
|
1081
|
-
|
|
1082
|
-
n && /* @__PURE__ */ a("p", { className: "agent-workspace__timeline-status", role: "alert", children: n ||
|
|
1081
|
+
t && /* @__PURE__ */ a("p", { className: "agent-workspace__timeline-status", role: "status", children: "Loading timeline…" }),
|
|
1082
|
+
n && /* @__PURE__ */ a("p", { className: "agent-workspace__timeline-status", role: "alert", children: n || tn }),
|
|
1083
1083
|
d && /* @__PURE__ */ a("p", { className: "agent-workspace__timeline-status", role: "status", children: "No timeline activity yet." }),
|
|
1084
|
-
!
|
|
1084
|
+
!t && !n && !d && /* @__PURE__ */ l("div", { className: "agent-timeline", children: [
|
|
1085
1085
|
/* @__PURE__ */ a("div", { className: "agent-timeline__track", "aria-hidden": "true" }),
|
|
1086
1086
|
/* @__PURE__ */ l("div", { className: "agent-timeline__station agent-timeline__station--terminus", children: [
|
|
1087
1087
|
/* @__PURE__ */ a("span", { className: "agent-timeline__station-rail", children: /* @__PURE__ */ a(
|
|
@@ -1128,17 +1128,17 @@ const la = ({
|
|
|
1128
1128
|
/* @__PURE__ */ a("span", { className: "agent-timeline__label-time", children: _t(h.session.timestamp) })
|
|
1129
1129
|
] })
|
|
1130
1130
|
] }, h.id);
|
|
1131
|
-
const { item: m } = h,
|
|
1131
|
+
const { item: m } = h, N = ka(m), y = N === "checklist", I = N === "status";
|
|
1132
1132
|
return /* @__PURE__ */ l(
|
|
1133
1133
|
"div",
|
|
1134
1134
|
{
|
|
1135
|
-
className: `agent-timeline__station agent-timeline__station--${
|
|
1135
|
+
className: `agent-timeline__station agent-timeline__station--${N}`,
|
|
1136
1136
|
children: [
|
|
1137
1137
|
/* @__PURE__ */ a("span", { className: "agent-timeline__station-rail", children: /* @__PURE__ */ l(
|
|
1138
1138
|
"button",
|
|
1139
1139
|
{
|
|
1140
1140
|
type: "button",
|
|
1141
|
-
className: `agent-timeline__station-node agent-timeline__station-node--${
|
|
1141
|
+
className: `agent-timeline__station-node agent-timeline__station-node--${N}`,
|
|
1142
1142
|
"aria-label": `${zt(m.type)}: ${Gt(m.entry)}`,
|
|
1143
1143
|
children: [
|
|
1144
1144
|
y && /* @__PURE__ */ a(L, { name: "check-solid", size: 16, color: "currentColor" }),
|
|
@@ -1169,62 +1169,62 @@ const la = ({
|
|
|
1169
1169
|
] })
|
|
1170
1170
|
] })
|
|
1171
1171
|
] });
|
|
1172
|
-
},
|
|
1172
|
+
}, Aa = [
|
|
1173
1173
|
"I'll get the details and come back to you",
|
|
1174
1174
|
"Skip this for now"
|
|
1175
|
-
],
|
|
1175
|
+
], ba = (e) => {
|
|
1176
1176
|
var n;
|
|
1177
|
-
const
|
|
1177
|
+
const t = (n = e.prompt) != null && n.trim() ? e.prompt.trim() : `I need a bit more from you on "${e.task}". ${e.description} What can you tell me?`;
|
|
1178
1178
|
return {
|
|
1179
1179
|
id: `clarification-${Date.now()}`,
|
|
1180
1180
|
author: oe.agent,
|
|
1181
|
-
text:
|
|
1182
|
-
followUpPrompts:
|
|
1181
|
+
text: t,
|
|
1182
|
+
followUpPrompts: e.clarificationPrompts ?? Aa
|
|
1183
1183
|
};
|
|
1184
|
-
},
|
|
1185
|
-
id:
|
|
1186
|
-
text:
|
|
1187
|
-
type:
|
|
1188
|
-
...
|
|
1189
|
-
}),
|
|
1184
|
+
}, Sa = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """), Ca = (e) => e.kind === Qt.user_file ? `<strong>${Sa(e.text)}</strong>` : e.text, Se = (e) => ({
|
|
1185
|
+
id: e.id,
|
|
1186
|
+
text: Ca(e),
|
|
1187
|
+
type: e.author === oe.user ? Dn : e.author === oe.system ? $n : Zt,
|
|
1188
|
+
...e.followUpPrompts ? { followUpPrompts: e.followUpPrompts } : {}
|
|
1189
|
+
}), Bt = "MESSAGE_TYPE_REPOLL", Ea = "agentUi:update", on = "arbor-agent-", we = {
|
|
1190
1190
|
all: "ALL",
|
|
1191
1191
|
checklist: "CHECKLIST",
|
|
1192
1192
|
resources: "RESOURCES",
|
|
1193
1193
|
chat: "CHAT",
|
|
1194
1194
|
timeline: "TIMELINE"
|
|
1195
|
-
},
|
|
1196
|
-
if (!
|
|
1195
|
+
}, Ta = new Set(Object.values(we)), Ra = (e, t) => `${e.endsWith("-") ? e : `${e}-`}${t}`, Ia = (e) => typeof e == "string" && Ta.has(e) ? e : we.all, Oa = (e) => {
|
|
1196
|
+
if (!e || typeof e != "object")
|
|
1197
1197
|
return null;
|
|
1198
|
-
const
|
|
1199
|
-
return
|
|
1200
|
-
type:
|
|
1201
|
-
target:
|
|
1198
|
+
const t = e;
|
|
1199
|
+
return t.type !== Bt ? null : {
|
|
1200
|
+
type: Bt,
|
|
1201
|
+
target: Ia(t.target)
|
|
1202
1202
|
};
|
|
1203
|
-
},
|
|
1204
|
-
const
|
|
1205
|
-
for (const s of
|
|
1206
|
-
const r =
|
|
1203
|
+
}, La = (e) => {
|
|
1204
|
+
const t = Array.isArray(e) ? e : [e], n = [];
|
|
1205
|
+
for (const s of t) {
|
|
1206
|
+
const r = Oa(s);
|
|
1207
1207
|
r && n.push(r);
|
|
1208
1208
|
}
|
|
1209
1209
|
return n;
|
|
1210
|
-
},
|
|
1211
|
-
enabled:
|
|
1212
|
-
channelPrefix:
|
|
1210
|
+
}, Ua = ({
|
|
1211
|
+
enabled: e,
|
|
1212
|
+
channelPrefix: t,
|
|
1213
1213
|
agentId: n,
|
|
1214
1214
|
subscribeToPusher: s,
|
|
1215
1215
|
onRepoll: r
|
|
1216
1216
|
}) => {
|
|
1217
|
-
const o = re(r), i =
|
|
1217
|
+
const o = re(r), i = t == null ? void 0 : t.trim(), p = !!(e && s && i && n.trim());
|
|
1218
1218
|
return D(() => {
|
|
1219
1219
|
o.current = r;
|
|
1220
1220
|
}, [r]), D(() => {
|
|
1221
1221
|
if (!p || !s || !i)
|
|
1222
1222
|
return;
|
|
1223
1223
|
const d = s(
|
|
1224
|
-
|
|
1225
|
-
|
|
1224
|
+
Ra(i, n),
|
|
1225
|
+
Ea,
|
|
1226
1226
|
(h) => {
|
|
1227
|
-
for (const m of
|
|
1227
|
+
for (const m of La(h))
|
|
1228
1228
|
o.current(m.target);
|
|
1229
1229
|
}
|
|
1230
1230
|
);
|
|
@@ -1234,11 +1234,11 @@ const la = ({
|
|
|
1234
1234
|
}, [p, i, n, s]), p;
|
|
1235
1235
|
};
|
|
1236
1236
|
class De extends Error {
|
|
1237
|
-
constructor(
|
|
1238
|
-
super(s ?? `Agent service request failed (${
|
|
1237
|
+
constructor(t, n, s) {
|
|
1238
|
+
super(s ?? `Agent service request failed (${t})`), this.name = "AgentServiceError", this.status = t, this.detail = n;
|
|
1239
1239
|
}
|
|
1240
1240
|
}
|
|
1241
|
-
const
|
|
1241
|
+
const Pa = "/api/v1", H = {
|
|
1242
1242
|
agentDefinitions: "/agent-definitions",
|
|
1243
1243
|
agents: "/agents",
|
|
1244
1244
|
conversations: "/conversations",
|
|
@@ -1248,9 +1248,9 @@ const Oa = "/api/v1", H = {
|
|
|
1248
1248
|
GET: "GET",
|
|
1249
1249
|
POST: "POST",
|
|
1250
1250
|
PATCH: "PATCH"
|
|
1251
|
-
},
|
|
1251
|
+
}, xa = {
|
|
1252
1252
|
error: "error"
|
|
1253
|
-
},
|
|
1253
|
+
}, Da = {
|
|
1254
1254
|
user: "user"
|
|
1255
1255
|
}, ye = {
|
|
1256
1256
|
acceptJson: "application/json",
|
|
@@ -1258,8 +1258,8 @@ const Oa = "/api/v1", H = {
|
|
|
1258
1258
|
acceptEventStream: "text/event-stream",
|
|
1259
1259
|
contentTypeJson: "application/json",
|
|
1260
1260
|
arborApplicationUrl: "X-Arbor-Application-Url"
|
|
1261
|
-
},
|
|
1262
|
-
switch (
|
|
1261
|
+
}, $a = 100, Ma = (e) => {
|
|
1262
|
+
switch (e) {
|
|
1263
1263
|
case xt.cancelled:
|
|
1264
1264
|
return T.failed;
|
|
1265
1265
|
case xt.archived:
|
|
@@ -1268,12 +1268,12 @@ const Oa = "/api/v1", H = {
|
|
|
1268
1268
|
case T.complete:
|
|
1269
1269
|
case T.failed:
|
|
1270
1270
|
case T["generating-a-response"]:
|
|
1271
|
-
return
|
|
1271
|
+
return e;
|
|
1272
1272
|
default:
|
|
1273
1273
|
return T["generating-a-response"];
|
|
1274
1274
|
}
|
|
1275
|
-
},
|
|
1276
|
-
switch (
|
|
1275
|
+
}, Ha = (e) => {
|
|
1276
|
+
switch (e) {
|
|
1277
1277
|
case pt.requires_attention:
|
|
1278
1278
|
return M.hitl;
|
|
1279
1279
|
case pt.in_progress:
|
|
@@ -1283,97 +1283,97 @@ const Oa = "/api/v1", H = {
|
|
|
1283
1283
|
case M.complete:
|
|
1284
1284
|
case M.hitl:
|
|
1285
1285
|
case M["generating-a-response"]:
|
|
1286
|
-
return
|
|
1286
|
+
return e;
|
|
1287
1287
|
default:
|
|
1288
1288
|
return M["generating-a-response"];
|
|
1289
1289
|
}
|
|
1290
|
-
},
|
|
1291
|
-
ref:
|
|
1292
|
-
display_name:
|
|
1293
|
-
agent_intent:
|
|
1294
|
-
description:
|
|
1295
|
-
}),
|
|
1296
|
-
id:
|
|
1297
|
-
name:
|
|
1298
|
-
...
|
|
1299
|
-
}),
|
|
1300
|
-
id:
|
|
1301
|
-
type:
|
|
1302
|
-
title:
|
|
1303
|
-
createdDatetime:
|
|
1304
|
-
lastUpdatedDatetime:
|
|
1305
|
-
misRecordUrl:
|
|
1306
|
-
}),
|
|
1307
|
-
resources:
|
|
1308
|
-
pageNumber:
|
|
1309
|
-
pageSize:
|
|
1310
|
-
totalRecords:
|
|
1311
|
-
}),
|
|
1312
|
-
actionLog: (
|
|
1313
|
-
timestamp:
|
|
1314
|
-
type:
|
|
1315
|
-
entry:
|
|
1316
|
-
origin:
|
|
1290
|
+
}, ln = (e) => ({
|
|
1291
|
+
ref: e.name,
|
|
1292
|
+
display_name: e.display_name,
|
|
1293
|
+
agent_intent: e.agent_intent ?? "",
|
|
1294
|
+
description: e.description
|
|
1295
|
+
}), Ts = (e) => ({
|
|
1296
|
+
id: e.id,
|
|
1297
|
+
name: e.name,
|
|
1298
|
+
...e.has_run_before ? { hasRunBefore: e.has_run_before } : {}
|
|
1299
|
+
}), za = new Set(Object.values(pe)), Ga = (e) => za.has(e) ? e : pe.document_html, Ba = (e) => ({
|
|
1300
|
+
id: e.id,
|
|
1301
|
+
type: Ga(e.type),
|
|
1302
|
+
title: e.title,
|
|
1303
|
+
createdDatetime: e.created_datetime,
|
|
1304
|
+
lastUpdatedDatetime: e.last_updated_datetime,
|
|
1305
|
+
misRecordUrl: e.mis_record_url
|
|
1306
|
+
}), Fa = (e) => ({
|
|
1307
|
+
resources: e.resources.map(Ba),
|
|
1308
|
+
pageNumber: e.page_number,
|
|
1309
|
+
pageSize: e.page_size,
|
|
1310
|
+
totalRecords: e.total_records
|
|
1311
|
+
}), qa = (e) => ({
|
|
1312
|
+
actionLog: (e.action_log ?? []).map((t) => ({
|
|
1313
|
+
timestamp: t.timestamp,
|
|
1314
|
+
type: t.type,
|
|
1315
|
+
entry: t.entry,
|
|
1316
|
+
origin: t.origin
|
|
1317
1317
|
})),
|
|
1318
|
-
chatSessions: (
|
|
1319
|
-
sessionId:
|
|
1320
|
-
timestamp:
|
|
1318
|
+
chatSessions: (e.chat_sessions ?? []).map((t) => ({
|
|
1319
|
+
sessionId: t.session_id,
|
|
1320
|
+
timestamp: t.timestamp
|
|
1321
1321
|
}))
|
|
1322
|
-
}),
|
|
1322
|
+
}), Ft = (e) => {
|
|
1323
1323
|
var n;
|
|
1324
|
-
const
|
|
1324
|
+
const t = e.invocation_id ?? e.id;
|
|
1325
1325
|
return {
|
|
1326
|
-
id:
|
|
1327
|
-
invocation_id:
|
|
1328
|
-
agent_definition_ref:
|
|
1329
|
-
...
|
|
1330
|
-
invocation_name: ((n =
|
|
1331
|
-
application_id:
|
|
1332
|
-
...
|
|
1333
|
-
created_by:
|
|
1334
|
-
status:
|
|
1335
|
-
context_ref:
|
|
1336
|
-
checklist_ref:
|
|
1326
|
+
id: e.id,
|
|
1327
|
+
invocation_id: t,
|
|
1328
|
+
agent_definition_ref: e.agent_definition_ref,
|
|
1329
|
+
...e.agent_intent ? { agent_intent: e.agent_intent } : {},
|
|
1330
|
+
invocation_name: ((n = e.invocation_name) == null ? void 0 : n.trim()) || e.agent_definition_ref,
|
|
1331
|
+
application_id: e.application_id,
|
|
1332
|
+
...e.application_name ? { application_name: e.application_name } : {},
|
|
1333
|
+
created_by: e.created_by,
|
|
1334
|
+
status: Ma(e.status),
|
|
1335
|
+
context_ref: e.context_ref ?? null,
|
|
1336
|
+
checklist_ref: e.checklist_ref ?? null
|
|
1337
1337
|
};
|
|
1338
|
-
},
|
|
1339
|
-
var
|
|
1338
|
+
}, cn = (e) => {
|
|
1339
|
+
var t;
|
|
1340
1340
|
return {
|
|
1341
|
-
task:
|
|
1342
|
-
status:
|
|
1343
|
-
description:
|
|
1344
|
-
...
|
|
1345
|
-
...(
|
|
1341
|
+
task: e.item ?? e.task ?? e.name ?? e.label ?? Wn,
|
|
1342
|
+
status: Ha(e.status),
|
|
1343
|
+
description: e.description ?? "",
|
|
1344
|
+
...e.prompt ? { prompt: e.prompt } : {},
|
|
1345
|
+
...(t = e.follow_up_prompts) != null && t.length ? { clarificationPrompts: e.follow_up_prompts } : {}
|
|
1346
1346
|
};
|
|
1347
|
-
},
|
|
1347
|
+
}, Ka = (e) => Array.isArray(e) ? e : e.checklist_items ?? e.checklist ?? e.items ?? [], dn = (e, t, n) => {
|
|
1348
1348
|
var o;
|
|
1349
|
-
const s = !Array.isArray(
|
|
1349
|
+
const s = !Array.isArray(t) && (t.opening_message || (o = t.opening_follow_up_prompts) != null && o.length) ? t : n, r = s ? nt(s) : void 0;
|
|
1350
1350
|
return {
|
|
1351
|
-
invocation_id:
|
|
1352
|
-
checklist:
|
|
1351
|
+
invocation_id: e,
|
|
1352
|
+
checklist: Ka(t).map(cn),
|
|
1353
1353
|
...r ? { openingMessage: r } : {}
|
|
1354
1354
|
};
|
|
1355
|
-
},
|
|
1356
|
-
const n = nt(
|
|
1355
|
+
}, Ja = (e, t) => {
|
|
1356
|
+
const n = nt(t);
|
|
1357
1357
|
return {
|
|
1358
|
-
invocation_id:
|
|
1359
|
-
checklist: (
|
|
1358
|
+
invocation_id: t.invocation_id ?? e,
|
|
1359
|
+
checklist: (t.checklist_items ?? []).map(cn),
|
|
1360
1360
|
...n ? { openingMessage: n } : {}
|
|
1361
1361
|
};
|
|
1362
|
-
}, nt = (
|
|
1362
|
+
}, nt = (e) => {
|
|
1363
1363
|
var n, s;
|
|
1364
|
-
const
|
|
1365
|
-
if (
|
|
1364
|
+
const t = (n = e.opening_message) == null ? void 0 : n.trim();
|
|
1365
|
+
if (t)
|
|
1366
1366
|
return {
|
|
1367
|
-
id:
|
|
1367
|
+
id: en,
|
|
1368
1368
|
author: oe.agent,
|
|
1369
|
-
text:
|
|
1370
|
-
...(s =
|
|
1369
|
+
text: t,
|
|
1370
|
+
...(s = e.opening_follow_up_prompts) != null && s.length ? { followUpPrompts: e.opening_follow_up_prompts } : {}
|
|
1371
1371
|
};
|
|
1372
|
-
},
|
|
1372
|
+
}, Rs = (e) => {
|
|
1373
1373
|
try {
|
|
1374
|
-
const
|
|
1375
|
-
if (Array.isArray(
|
|
1376
|
-
const n =
|
|
1374
|
+
const t = JSON.parse(e);
|
|
1375
|
+
if (Array.isArray(t)) {
|
|
1376
|
+
const n = t.filter(
|
|
1377
1377
|
(s) => !!s && typeof s == "object" && typeof s.text == "string"
|
|
1378
1378
|
).map((s) => s.text);
|
|
1379
1379
|
if (n.length > 0)
|
|
@@ -1382,40 +1382,41 @@ const Oa = "/api/v1", H = {
|
|
|
1382
1382
|
}
|
|
1383
1383
|
} catch {
|
|
1384
1384
|
}
|
|
1385
|
-
return
|
|
1386
|
-
},
|
|
1387
|
-
const
|
|
1388
|
-
return
|
|
1385
|
+
return e;
|
|
1386
|
+
}, Is = (e) => {
|
|
1387
|
+
const t = e.trim();
|
|
1388
|
+
return t.length > 0 ? `File upload
|
|
1389
1389
|
|
|
1390
|
-
${
|
|
1391
|
-
},
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1390
|
+
${t}` : "File upload";
|
|
1391
|
+
}, qt = (e) => {
|
|
1392
|
+
var n;
|
|
1393
|
+
const t = (n = e.filename) == null ? void 0 : n.trim();
|
|
1394
|
+
return t || null;
|
|
1395
|
+
}, Wa = (e) => e.filter((t) => qt(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) => {
|
|
1396
|
+
const n = qt(t);
|
|
1397
|
+
return n && t.role === "user" ? {
|
|
1398
|
+
id: t.message_id,
|
|
1399
|
+
author: oe.user,
|
|
1400
|
+
kind: Qt.user_file,
|
|
1401
|
+
text: n
|
|
1402
|
+
} : {
|
|
1403
|
+
id: t.message_id,
|
|
1404
|
+
author: t.role === "user" ? oe.user : oe.agent,
|
|
1405
|
+
text: t.content
|
|
1405
1406
|
};
|
|
1406
|
-
}),
|
|
1407
|
+
}), ja = /:invocationId\b/g, Va = /:resourceId\b/g, Ya = (e) => e.trim().replace(/^Bearer\s+/i, ""), Xa = (e) => e.endsWith("/") ? e.slice(0, -1) : e;
|
|
1407
1408
|
class yt {
|
|
1408
|
-
constructor(
|
|
1409
|
+
constructor(t) {
|
|
1409
1410
|
var s;
|
|
1410
|
-
this.baseUrl =
|
|
1411
|
-
const n = (s =
|
|
1412
|
-
this.token = n ?
|
|
1411
|
+
this.baseUrl = Xa(t.baseUrl ?? "");
|
|
1412
|
+
const n = (s = t.token) == null ? void 0 : s.trim();
|
|
1413
|
+
this.token = n ? Ya(n) : void 0, this.customHeaders = t.headers, this.urls = t.urls ?? {}, this.fetchImpl = t.fetch ?? globalThis.fetch.bind(globalThis);
|
|
1413
1414
|
}
|
|
1414
1415
|
// Replaces the extra headers merged into every subsequent request,
|
|
1415
1416
|
// without recreating the client (e.g. an application-URL header that
|
|
1416
1417
|
// changes as the user switches institutions).
|
|
1417
|
-
setHeaders(
|
|
1418
|
-
this.customHeaders =
|
|
1418
|
+
setHeaders(t) {
|
|
1419
|
+
this.customHeaders = t;
|
|
1419
1420
|
}
|
|
1420
1421
|
async listAgentDefinitions() {
|
|
1421
1422
|
return (await this.request(
|
|
@@ -1423,10 +1424,10 @@ class yt {
|
|
|
1423
1424
|
this.resolveUrl("agentDefinitions", H.agentDefinitions)
|
|
1424
1425
|
)).agent_definitions ?? [];
|
|
1425
1426
|
}
|
|
1426
|
-
getAgentDefinition(
|
|
1427
|
+
getAgentDefinition(t) {
|
|
1427
1428
|
return this.request(
|
|
1428
1429
|
J.GET,
|
|
1429
|
-
this.apiUrl(`${H.agentDefinitions}/${encodeURIComponent(
|
|
1430
|
+
this.apiUrl(`${H.agentDefinitions}/${encodeURIComponent(t)}`)
|
|
1430
1431
|
);
|
|
1431
1432
|
}
|
|
1432
1433
|
listTripOptions() {
|
|
@@ -1438,26 +1439,26 @@ class yt {
|
|
|
1438
1439
|
this.apiUrl(H.demoDataset)
|
|
1439
1440
|
);
|
|
1440
1441
|
}
|
|
1441
|
-
setDataset(
|
|
1442
|
+
setDataset(t) {
|
|
1442
1443
|
return this.request(
|
|
1443
1444
|
J.POST,
|
|
1444
1445
|
this.apiUrl(H.demoDataset),
|
|
1445
|
-
{ dataset:
|
|
1446
|
+
{ dataset: t }
|
|
1446
1447
|
);
|
|
1447
1448
|
}
|
|
1448
|
-
listAgents(
|
|
1449
|
+
listAgents(t = {}) {
|
|
1449
1450
|
const n = new URLSearchParams();
|
|
1450
|
-
|
|
1451
|
+
t.status && n.set("status", t.status), t.agentDefinitionRef && n.set("agent_definition_ref", t.agentDefinitionRef);
|
|
1451
1452
|
const s = n.toString() ? `?${n.toString()}` : "";
|
|
1452
1453
|
return this.request(
|
|
1453
1454
|
J.GET,
|
|
1454
1455
|
`${this.resolveUrl("agents", H.agents)}${s}`
|
|
1455
1456
|
);
|
|
1456
1457
|
}
|
|
1457
|
-
createAgent(
|
|
1458
|
+
createAgent(t, n = {}) {
|
|
1458
1459
|
var i, p;
|
|
1459
1460
|
const s = {
|
|
1460
|
-
agent_definition_ref:
|
|
1461
|
+
agent_definition_ref: t
|
|
1461
1462
|
}, r = (i = n.invocationName) == null ? void 0 : i.trim(), o = (p = n.agentIntent) == null ? void 0 : p.trim();
|
|
1462
1463
|
return r && (s.invocation_name = r), o && (s.agent_intent = o), this.request(
|
|
1463
1464
|
J.POST,
|
|
@@ -1465,13 +1466,13 @@ class yt {
|
|
|
1465
1466
|
s
|
|
1466
1467
|
);
|
|
1467
1468
|
}
|
|
1468
|
-
getAgent(
|
|
1469
|
+
getAgent(t) {
|
|
1469
1470
|
return this.request(
|
|
1470
1471
|
J.GET,
|
|
1471
|
-
this.resolveUrl("agent", `${H.agents}/${encodeURIComponent(
|
|
1472
|
+
this.resolveUrl("agent", `${H.agents}/${encodeURIComponent(t)}`, t)
|
|
1472
1473
|
);
|
|
1473
1474
|
}
|
|
1474
|
-
updateAgent(
|
|
1475
|
+
updateAgent(t, n) {
|
|
1475
1476
|
const r = {
|
|
1476
1477
|
invocation_name: n.invocationName.trim()
|
|
1477
1478
|
};
|
|
@@ -1479,43 +1480,43 @@ class yt {
|
|
|
1479
1480
|
J.PATCH,
|
|
1480
1481
|
this.resolveUrl(
|
|
1481
1482
|
"agent",
|
|
1482
|
-
`${H.agents}/${encodeURIComponent(
|
|
1483
|
-
|
|
1483
|
+
`${H.agents}/${encodeURIComponent(t)}`,
|
|
1484
|
+
t
|
|
1484
1485
|
),
|
|
1485
1486
|
r
|
|
1486
1487
|
);
|
|
1487
1488
|
}
|
|
1488
|
-
getAgentChecklist(
|
|
1489
|
+
getAgentChecklist(t) {
|
|
1489
1490
|
return this.request(
|
|
1490
1491
|
J.GET,
|
|
1491
1492
|
this.resolveUrl(
|
|
1492
1493
|
"agentChecklist",
|
|
1493
|
-
`${H.agents}/${encodeURIComponent(
|
|
1494
|
-
|
|
1494
|
+
`${H.agents}/${encodeURIComponent(t)}/checklist`,
|
|
1495
|
+
t
|
|
1495
1496
|
)
|
|
1496
1497
|
);
|
|
1497
1498
|
}
|
|
1498
|
-
getAgentResources(
|
|
1499
|
+
getAgentResources(t, n = {}) {
|
|
1499
1500
|
const s = new URLSearchParams();
|
|
1500
1501
|
n.pageNumber !== void 0 && s.set("page_number", String(n.pageNumber)), n.pageSize !== void 0 && s.set("page_size", String(n.pageSize)), n.type && s.set("type", n.type);
|
|
1501
1502
|
const r = s.toString(), o = this.resolveUrl(
|
|
1502
1503
|
"agentResources",
|
|
1503
|
-
`${H.agents}/${encodeURIComponent(
|
|
1504
|
-
|
|
1504
|
+
`${H.agents}/${encodeURIComponent(t)}/resources`,
|
|
1505
|
+
t
|
|
1505
1506
|
);
|
|
1506
1507
|
return this.request(
|
|
1507
1508
|
J.GET,
|
|
1508
1509
|
r ? `${o}?${r}` : o
|
|
1509
1510
|
);
|
|
1510
1511
|
}
|
|
1511
|
-
async listAllAgentResources(
|
|
1512
|
-
const n =
|
|
1512
|
+
async listAllAgentResources(t) {
|
|
1513
|
+
const n = $a;
|
|
1513
1514
|
let s = 1;
|
|
1514
1515
|
const r = [];
|
|
1515
1516
|
let o = Number.POSITIVE_INFINITY;
|
|
1516
1517
|
for (; r.length < o; ) {
|
|
1517
|
-
const i =
|
|
1518
|
-
await this.getAgentResources(
|
|
1518
|
+
const i = Fa(
|
|
1519
|
+
await this.getAgentResources(t, { pageNumber: s, pageSize: n })
|
|
1519
1520
|
);
|
|
1520
1521
|
if (o = i.totalRecords, i.resources.length === 0 || (r.push(...i.resources), r.length >= o))
|
|
1521
1522
|
break;
|
|
@@ -1523,59 +1524,59 @@ class yt {
|
|
|
1523
1524
|
}
|
|
1524
1525
|
return r;
|
|
1525
1526
|
}
|
|
1526
|
-
getAgentResourceHtml(
|
|
1527
|
-
return this.requestText(J.GET, this.resolveResourceHtmlUrl(
|
|
1527
|
+
getAgentResourceHtml(t, n) {
|
|
1528
|
+
return this.requestText(J.GET, this.resolveResourceHtmlUrl(t, n));
|
|
1528
1529
|
}
|
|
1529
|
-
getAgentTimeline(
|
|
1530
|
+
getAgentTimeline(t) {
|
|
1530
1531
|
return this.request(
|
|
1531
1532
|
J.GET,
|
|
1532
1533
|
this.resolveUrl(
|
|
1533
1534
|
"agentTimeline",
|
|
1534
|
-
`${H.agents}/${encodeURIComponent(
|
|
1535
|
-
|
|
1535
|
+
`${H.agents}/${encodeURIComponent(t)}/agent-timeline`,
|
|
1536
|
+
t
|
|
1536
1537
|
)
|
|
1537
1538
|
);
|
|
1538
1539
|
}
|
|
1539
|
-
getAgentContext(
|
|
1540
|
+
getAgentContext(t) {
|
|
1540
1541
|
return this.request(
|
|
1541
1542
|
J.GET,
|
|
1542
|
-
this.apiUrl(`${H.agents}/${encodeURIComponent(
|
|
1543
|
+
this.apiUrl(`${H.agents}/${encodeURIComponent(t)}/context`)
|
|
1543
1544
|
);
|
|
1544
1545
|
}
|
|
1545
|
-
cancelAgent(
|
|
1546
|
+
cancelAgent(t) {
|
|
1546
1547
|
return this.request(
|
|
1547
1548
|
J.POST,
|
|
1548
1549
|
this.resolveUrl(
|
|
1549
1550
|
"stopAgent",
|
|
1550
|
-
`${H.agents}/${encodeURIComponent(
|
|
1551
|
-
|
|
1551
|
+
`${H.agents}/${encodeURIComponent(t)}/cancel`,
|
|
1552
|
+
t
|
|
1552
1553
|
)
|
|
1553
1554
|
);
|
|
1554
1555
|
}
|
|
1555
|
-
archiveAgent(
|
|
1556
|
+
archiveAgent(t) {
|
|
1556
1557
|
return this.request(
|
|
1557
1558
|
J.POST,
|
|
1558
|
-
this.apiUrl(`${H.agents}/${encodeURIComponent(
|
|
1559
|
+
this.apiUrl(`${H.agents}/${encodeURIComponent(t)}/archive`)
|
|
1559
1560
|
);
|
|
1560
1561
|
}
|
|
1561
|
-
getConversation(
|
|
1562
|
+
getConversation(t) {
|
|
1562
1563
|
return this.request(
|
|
1563
1564
|
J.GET,
|
|
1564
1565
|
this.resolveUrl(
|
|
1565
1566
|
"agentConversation",
|
|
1566
|
-
`${H.conversations}/${encodeURIComponent(
|
|
1567
|
-
|
|
1567
|
+
`${H.conversations}/${encodeURIComponent(t)}`,
|
|
1568
|
+
t
|
|
1568
1569
|
)
|
|
1569
1570
|
);
|
|
1570
1571
|
}
|
|
1571
1572
|
// Streams a chat turn. Resolves with the final SSE event; `onEvent` fires
|
|
1572
1573
|
// for every event as it arrives.
|
|
1573
|
-
async chat(
|
|
1574
|
+
async chat(t, n, s = {}) {
|
|
1574
1575
|
const r = !!(s.uploadFiles && s.uploadFiles.length > 0), o = await this.fetchImpl(
|
|
1575
1576
|
this.resolveUrl(
|
|
1576
1577
|
"agentChat",
|
|
1577
|
-
`${H.agents}/${encodeURIComponent(
|
|
1578
|
-
|
|
1578
|
+
`${H.agents}/${encodeURIComponent(t)}/chat`,
|
|
1579
|
+
t
|
|
1579
1580
|
),
|
|
1580
1581
|
{
|
|
1581
1582
|
method: J.POST,
|
|
@@ -1586,7 +1587,7 @@ class yt {
|
|
|
1586
1587
|
// Let the browser set the multipart boundary when uploading.
|
|
1587
1588
|
...r ? {} : { "Content-Type": ye.contentTypeJson }
|
|
1588
1589
|
},
|
|
1589
|
-
body: r ?
|
|
1590
|
+
body: r ? Qa(n, s.uploadFiles ?? []) : JSON.stringify(n),
|
|
1590
1591
|
signal: s.signal
|
|
1591
1592
|
}
|
|
1592
1593
|
);
|
|
@@ -1600,39 +1601,39 @@ class yt {
|
|
|
1600
1601
|
return this.token ? { Authorization: `Bearer ${this.token}` } : {};
|
|
1601
1602
|
}
|
|
1602
1603
|
// Builds a URL from the base url + shared API prefix + route.
|
|
1603
|
-
apiUrl(
|
|
1604
|
-
return `${this.baseUrl}${
|
|
1604
|
+
apiUrl(t) {
|
|
1605
|
+
return `${this.baseUrl}${Pa}${t}`;
|
|
1605
1606
|
}
|
|
1606
1607
|
// Resolves the URL for an operation, preferring a per-operation override
|
|
1607
1608
|
// (with `:invocationId` substituted) and falling back to the base url.
|
|
1608
|
-
resolveUrl(
|
|
1609
|
-
const o = this.urls[
|
|
1609
|
+
resolveUrl(t, n, s, r) {
|
|
1610
|
+
const o = this.urls[t];
|
|
1610
1611
|
if (!o)
|
|
1611
1612
|
return this.apiUrl(n);
|
|
1612
1613
|
let i = o;
|
|
1613
|
-
return s && (i = i.replace(
|
|
1614
|
+
return s && (i = i.replace(ja, encodeURIComponent(s))), r && (i = i.replace(Va, encodeURIComponent(r))), i;
|
|
1614
1615
|
}
|
|
1615
|
-
resolveResourceHtmlUrl(
|
|
1616
|
+
resolveResourceHtmlUrl(t, n) {
|
|
1616
1617
|
return this.urls.agentResourceHtml ? this.resolveUrl(
|
|
1617
1618
|
"agentResourceHtml",
|
|
1618
|
-
`${H.agents}/${encodeURIComponent(
|
|
1619
|
+
`${H.agents}/${encodeURIComponent(t)}/resources/${encodeURIComponent(
|
|
1619
1620
|
n
|
|
1620
1621
|
)}`,
|
|
1621
|
-
|
|
1622
|
+
t,
|
|
1622
1623
|
n
|
|
1623
1624
|
) : this.urls.agentResources ? `${this.resolveUrl(
|
|
1624
1625
|
"agentResources",
|
|
1625
|
-
`${H.agents}/${encodeURIComponent(
|
|
1626
|
-
|
|
1626
|
+
`${H.agents}/${encodeURIComponent(t)}/resources`,
|
|
1627
|
+
t
|
|
1627
1628
|
).replace(/\/$/, "")}/${encodeURIComponent(n)}` : this.apiUrl(
|
|
1628
|
-
`${H.agents}/${encodeURIComponent(
|
|
1629
|
+
`${H.agents}/${encodeURIComponent(t)}/resources/${encodeURIComponent(
|
|
1629
1630
|
n
|
|
1630
1631
|
)}`
|
|
1631
1632
|
);
|
|
1632
1633
|
}
|
|
1633
|
-
async request(
|
|
1634
|
+
async request(t, n, s) {
|
|
1634
1635
|
const r = await this.fetchImpl(n, {
|
|
1635
|
-
method:
|
|
1636
|
+
method: t,
|
|
1636
1637
|
headers: {
|
|
1637
1638
|
...this.customHeaders,
|
|
1638
1639
|
...this.authHeaders(),
|
|
@@ -1646,9 +1647,9 @@ class yt {
|
|
|
1646
1647
|
if (r.status !== 204)
|
|
1647
1648
|
return await r.json();
|
|
1648
1649
|
}
|
|
1649
|
-
async requestText(
|
|
1650
|
+
async requestText(t, n) {
|
|
1650
1651
|
const s = await this.fetchImpl(n, {
|
|
1651
|
-
method:
|
|
1652
|
+
method: t,
|
|
1652
1653
|
headers: {
|
|
1653
1654
|
...this.customHeaders,
|
|
1654
1655
|
...this.authHeaders(),
|
|
@@ -1659,31 +1660,31 @@ class yt {
|
|
|
1659
1660
|
throw await this.toError(s);
|
|
1660
1661
|
return s.text();
|
|
1661
1662
|
}
|
|
1662
|
-
async toError(
|
|
1663
|
+
async toError(t) {
|
|
1663
1664
|
let n = null;
|
|
1664
1665
|
try {
|
|
1665
|
-
n = await
|
|
1666
|
+
n = await t.json();
|
|
1666
1667
|
} catch {
|
|
1667
1668
|
}
|
|
1668
1669
|
return new De(
|
|
1669
|
-
|
|
1670
|
+
t.status,
|
|
1670
1671
|
n,
|
|
1671
|
-
`Agent service request failed (${
|
|
1672
|
+
`Agent service request failed (${t.status} ${t.statusText})`
|
|
1672
1673
|
);
|
|
1673
1674
|
}
|
|
1674
|
-
async consumeSse(
|
|
1675
|
-
const s =
|
|
1675
|
+
async consumeSse(t, n) {
|
|
1676
|
+
const s = t.getReader(), r = new TextDecoder();
|
|
1676
1677
|
let o = "", i;
|
|
1677
1678
|
const p = (d) => {
|
|
1678
|
-
const { event: h, data: m } =
|
|
1679
|
+
const { event: h, data: m } = Za(d);
|
|
1679
1680
|
if (m === null)
|
|
1680
1681
|
return;
|
|
1681
|
-
if (h ===
|
|
1682
|
-
const y =
|
|
1682
|
+
if (h === xa.error) {
|
|
1683
|
+
const y = Kt(m);
|
|
1683
1684
|
throw new De(502, y, (y == null ? void 0 : y.message) ?? "Chat stream error");
|
|
1684
1685
|
}
|
|
1685
|
-
const
|
|
1686
|
-
|
|
1686
|
+
const N = Kt(m);
|
|
1687
|
+
N && (i = N, n == null || n(N));
|
|
1687
1688
|
};
|
|
1688
1689
|
for (; ; ) {
|
|
1689
1690
|
const { done: d, value: h } = await s.read();
|
|
@@ -1694,77 +1695,77 @@ class yt {
|
|
|
1694
1695
|
|
|
1695
1696
|
`);
|
|
1696
1697
|
o = m.pop() ?? "";
|
|
1697
|
-
for (const
|
|
1698
|
-
p(
|
|
1698
|
+
for (const N of m)
|
|
1699
|
+
p(N);
|
|
1699
1700
|
}
|
|
1700
1701
|
if (o.trim() && p(o), !i)
|
|
1701
1702
|
throw new De(502, null, "Chat stream ended without any events");
|
|
1702
1703
|
return i;
|
|
1703
1704
|
}
|
|
1704
1705
|
}
|
|
1705
|
-
const
|
|
1706
|
-
let
|
|
1706
|
+
const Za = (e) => {
|
|
1707
|
+
let t = null;
|
|
1707
1708
|
const n = [];
|
|
1708
|
-
for (const s of
|
|
1709
|
+
for (const s of e.split(`
|
|
1709
1710
|
`)) {
|
|
1710
1711
|
const r = s.trimEnd();
|
|
1711
|
-
r.startsWith("event:") ?
|
|
1712
|
+
r.startsWith("event:") ? t = r.slice(6).trim() : r.startsWith("data:") && n.push(r.slice(5).trim());
|
|
1712
1713
|
}
|
|
1713
1714
|
return {
|
|
1714
|
-
event:
|
|
1715
|
+
event: t,
|
|
1715
1716
|
data: n.length > 0 ? n.join(`
|
|
1716
1717
|
`) : null
|
|
1717
1718
|
};
|
|
1718
|
-
},
|
|
1719
|
+
}, Kt = (e) => {
|
|
1719
1720
|
try {
|
|
1720
|
-
return JSON.parse(
|
|
1721
|
+
return JSON.parse(e);
|
|
1721
1722
|
} catch {
|
|
1722
1723
|
return;
|
|
1723
1724
|
}
|
|
1724
1725
|
};
|
|
1725
|
-
function
|
|
1726
|
+
function Qa(e, t) {
|
|
1726
1727
|
const n = new FormData();
|
|
1727
|
-
n.append("body", JSON.stringify(
|
|
1728
|
-
for (const s of
|
|
1728
|
+
n.append("body", JSON.stringify(e));
|
|
1729
|
+
for (const s of t)
|
|
1729
1730
|
n.append("files", s, s.name);
|
|
1730
1731
|
return n;
|
|
1731
1732
|
}
|
|
1732
|
-
const
|
|
1733
|
-
id:
|
|
1733
|
+
const es = {
|
|
1734
|
+
id: en,
|
|
1734
1735
|
author: oe.agent,
|
|
1735
1736
|
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."
|
|
1736
1737
|
};
|
|
1737
|
-
let
|
|
1738
|
-
const
|
|
1739
|
-
const
|
|
1740
|
-
return `Let's get started on ${
|
|
1738
|
+
let Jt = 0;
|
|
1739
|
+
const ts = (e) => (Jt += 1, `${e}-${Date.now()}-${Jt}`), ns = (e) => {
|
|
1740
|
+
const t = e.destination ? ` to ${e.destination}` : "";
|
|
1741
|
+
return `Let's get started on ${e.tripName.trim() || e.destination.trim() || "this task"}${t}. What will you do first?`;
|
|
1741
1742
|
};
|
|
1742
|
-
class
|
|
1743
|
-
constructor(
|
|
1744
|
-
this.seededChecklist = [], this.client =
|
|
1743
|
+
class as {
|
|
1744
|
+
constructor(t, n, s = {}) {
|
|
1745
|
+
this.seededChecklist = [], this.client = t, this.agentId = n, this.chatId = s.chatId ?? n, this.opening = s.openingMessage ?? es, this.model = s.model;
|
|
1745
1746
|
}
|
|
1746
1747
|
openingMessage() {
|
|
1747
1748
|
return this.opening;
|
|
1748
1749
|
}
|
|
1749
1750
|
async bootstrapConversation() {
|
|
1750
|
-
const
|
|
1751
|
+
const t = await this.client.getConversation(this.chatId), n = Wa(t.messages);
|
|
1751
1752
|
return n.length === 0 ? [this.opening] : n;
|
|
1752
1753
|
}
|
|
1753
|
-
async start(
|
|
1754
|
-
return { ...await this.exchange(
|
|
1754
|
+
async start(t) {
|
|
1755
|
+
return { ...await this.exchange(ns(t)), phase: B.running };
|
|
1755
1756
|
}
|
|
1756
|
-
sendMessage(
|
|
1757
|
-
return this.exchange(
|
|
1757
|
+
sendMessage(t, n) {
|
|
1758
|
+
return this.exchange(t, n);
|
|
1758
1759
|
}
|
|
1759
1760
|
async stop() {
|
|
1760
1761
|
await this.client.cancelAgent(this.agentId);
|
|
1761
1762
|
}
|
|
1762
|
-
seedChecklist(
|
|
1763
|
-
this.seededChecklist =
|
|
1763
|
+
seedChecklist(t) {
|
|
1764
|
+
this.seededChecklist = t;
|
|
1764
1765
|
}
|
|
1765
|
-
async exchange(
|
|
1766
|
+
async exchange(t, n) {
|
|
1766
1767
|
var i;
|
|
1767
|
-
const s = [{ role:
|
|
1768
|
+
const s = [{ role: Da.user, content: t }], r = await this.client.chat(
|
|
1768
1769
|
this.agentId,
|
|
1769
1770
|
{
|
|
1770
1771
|
messages: s,
|
|
@@ -1778,67 +1779,67 @@ class ns {
|
|
|
1778
1779
|
},
|
|
1779
1780
|
...n && n.length > 0 ? [{ uploadFiles: n }] : []
|
|
1780
1781
|
), o = {
|
|
1781
|
-
id: r.event_id ||
|
|
1782
|
+
id: r.event_id || ts("msg-agent"),
|
|
1782
1783
|
author: oe.agent,
|
|
1783
1784
|
text: r.message.content,
|
|
1784
1785
|
...(i = r.follow_up_prompts) != null && i.length ? { followUpPrompts: r.follow_up_prompts } : {}
|
|
1785
1786
|
};
|
|
1786
1787
|
try {
|
|
1787
|
-
const p = await this.client.getAgent(this.agentId), { checklist: d } =
|
|
1788
|
+
const p = await this.client.getAgent(this.agentId), { checklist: d } = Ja(this.agentId, p);
|
|
1788
1789
|
return this.seededChecklist = d, { message: o, checklist: d };
|
|
1789
1790
|
} catch {
|
|
1790
1791
|
return { message: o, ...this.seededChecklist.length ? { checklist: this.seededChecklist } : {} };
|
|
1791
1792
|
}
|
|
1792
1793
|
}
|
|
1793
1794
|
}
|
|
1794
|
-
const
|
|
1795
|
+
const gn = (e, t) => (n) => {
|
|
1795
1796
|
var s, r;
|
|
1796
|
-
return new
|
|
1797
|
-
model:
|
|
1798
|
-
chatId: ((s =
|
|
1799
|
-
openingMessage: ((r =
|
|
1797
|
+
return new as(e, n.invocation_id, {
|
|
1798
|
+
model: t == null ? void 0 : t.model,
|
|
1799
|
+
chatId: ((s = t == null ? void 0 : t.resolveChatId) == null ? void 0 : s.call(t, n)) ?? (t == null ? void 0 : t.chatId) ?? n.invocation_id,
|
|
1800
|
+
openingMessage: ((r = t == null ? void 0 : t.resolveOpeningMessage) == null ? void 0 : r.call(t, n)) ?? (t == null ? void 0 : t.openingMessage)
|
|
1800
1801
|
});
|
|
1801
|
-
},
|
|
1802
|
-
const
|
|
1803
|
-
for (const n of
|
|
1802
|
+
}, hn = (e) => e instanceof De ? e.message : e instanceof TypeError ? "Network error while contacting the agent service." : e instanceof Error && e.message ? e.message : nn, ss = (e) => {
|
|
1803
|
+
const t = {};
|
|
1804
|
+
for (const n of e) {
|
|
1804
1805
|
const s = nt(n);
|
|
1805
1806
|
if (!s)
|
|
1806
1807
|
continue;
|
|
1807
1808
|
const r = n.invocation_id ?? n.id;
|
|
1808
|
-
|
|
1809
|
+
t[r] = s, t[n.id] = s;
|
|
1809
1810
|
}
|
|
1810
|
-
return
|
|
1811
|
-
},
|
|
1812
|
-
const { jwt:
|
|
1811
|
+
return t;
|
|
1812
|
+
}, rs = (e) => JSON.stringify(e), ft = (e, t) => JSON.stringify(e) === JSON.stringify(t), is = (e) => {
|
|
1813
|
+
const { jwt: t, headers: n, urls: s } = e, r = JSON.stringify(n ?? {}), o = rs(s), i = V(
|
|
1813
1814
|
() => new yt({
|
|
1814
|
-
token:
|
|
1815
|
+
token: t,
|
|
1815
1816
|
headers: n,
|
|
1816
1817
|
urls: s
|
|
1817
1818
|
}),
|
|
1818
1819
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- keyed on serialised config to keep a stable client.
|
|
1819
|
-
[
|
|
1820
|
+
[t, o]
|
|
1820
1821
|
);
|
|
1821
1822
|
et(() => {
|
|
1822
1823
|
i.setHeaders(n);
|
|
1823
1824
|
}, [i, r]);
|
|
1824
1825
|
const [p, d] = g([]), [h, m] = g(
|
|
1825
1826
|
[]
|
|
1826
|
-
), [
|
|
1827
|
+
), [N, y] = g({}), [I, F] = g("loading"), [_, x] = g(null), [E, U] = g(0), A = S(
|
|
1827
1828
|
(O, G) => {
|
|
1828
|
-
const q = O.map(
|
|
1829
|
+
const q = O.map(Ft), Y = G.map(ln), Z = ss(O);
|
|
1829
1830
|
d(
|
|
1830
1831
|
($) => ft($, q) ? $ : q
|
|
1831
1832
|
), m(
|
|
1832
1833
|
($) => ft($, Y) ? $ : Y
|
|
1833
1834
|
), y(
|
|
1834
1835
|
($) => ft($, Z) ? $ : Z
|
|
1835
|
-
),
|
|
1836
|
+
), F("idle"), x(null);
|
|
1836
1837
|
},
|
|
1837
1838
|
[]
|
|
1838
1839
|
);
|
|
1839
1840
|
D(() => {
|
|
1840
1841
|
let O = !1;
|
|
1841
|
-
return
|
|
1842
|
+
return F("loading"), x(null), (async () => {
|
|
1842
1843
|
try {
|
|
1843
1844
|
const [G, q] = await Promise.all([
|
|
1844
1845
|
i.listAgents(),
|
|
@@ -1850,15 +1851,15 @@ const cn = (t, e) => (n) => {
|
|
|
1850
1851
|
} catch (G) {
|
|
1851
1852
|
if (O)
|
|
1852
1853
|
return;
|
|
1853
|
-
d([]), m([]), y({}),
|
|
1854
|
+
d([]), m([]), y({}), F("error"), x(hn(G));
|
|
1854
1855
|
}
|
|
1855
1856
|
})(), () => {
|
|
1856
1857
|
O = !0;
|
|
1857
1858
|
};
|
|
1858
1859
|
}, [A, i, E]);
|
|
1859
|
-
const f =
|
|
1860
|
+
const f = S(() => {
|
|
1860
1861
|
U((O) => O + 1);
|
|
1861
|
-
}, []),
|
|
1862
|
+
}, []), b = S(async () => {
|
|
1862
1863
|
try {
|
|
1863
1864
|
const [O, G] = await Promise.all([
|
|
1864
1865
|
i.listAgents(),
|
|
@@ -1867,30 +1868,30 @@ const cn = (t, e) => (n) => {
|
|
|
1867
1868
|
A(O, G);
|
|
1868
1869
|
} catch {
|
|
1869
1870
|
}
|
|
1870
|
-
}, [A, i]), w =
|
|
1871
|
+
}, [A, i]), w = S(
|
|
1871
1872
|
async (O) => {
|
|
1872
1873
|
const [G, q] = await Promise.all([
|
|
1873
1874
|
i.getAgentChecklist(O),
|
|
1874
1875
|
i.getAgent(O).catch(() => null)
|
|
1875
1876
|
]);
|
|
1876
|
-
return
|
|
1877
|
+
return dn(
|
|
1877
1878
|
O,
|
|
1878
1879
|
G,
|
|
1879
1880
|
q ?? void 0
|
|
1880
1881
|
);
|
|
1881
1882
|
},
|
|
1882
1883
|
[i]
|
|
1883
|
-
), R =
|
|
1884
|
+
), R = S(
|
|
1884
1885
|
async (O) => i.listAllAgentResources(O),
|
|
1885
1886
|
[i]
|
|
1886
|
-
), z =
|
|
1887
|
+
), z = S(
|
|
1887
1888
|
async ({
|
|
1888
1889
|
definition: O,
|
|
1889
1890
|
invocationName: G
|
|
1890
1891
|
}) => {
|
|
1891
1892
|
const q = await i.createAgent(O.ref, {
|
|
1892
1893
|
invocationName: G
|
|
1893
|
-
}), Y = await i.getAgent(q.id), Z =
|
|
1894
|
+
}), Y = await i.getAgent(q.id), Z = Ft(Y), $ = nt(Y);
|
|
1894
1895
|
return d((ee) => [Z, ...ee]), $ && y((ee) => ({
|
|
1895
1896
|
...ee,
|
|
1896
1897
|
[Z.invocation_id]: $,
|
|
@@ -1899,10 +1900,10 @@ const cn = (t, e) => (n) => {
|
|
|
1899
1900
|
},
|
|
1900
1901
|
[i]
|
|
1901
1902
|
), Te = V(
|
|
1902
|
-
() =>
|
|
1903
|
-
resolveOpeningMessage: (O) =>
|
|
1903
|
+
() => gn(i, {
|
|
1904
|
+
resolveOpeningMessage: (O) => N[O.invocation_id] ?? N[O.id]
|
|
1904
1905
|
}),
|
|
1905
|
-
[i,
|
|
1906
|
+
[i, N]
|
|
1906
1907
|
);
|
|
1907
1908
|
return {
|
|
1908
1909
|
agents: p,
|
|
@@ -1910,14 +1911,14 @@ const cn = (t, e) => (n) => {
|
|
|
1910
1911
|
loadState: I,
|
|
1911
1912
|
loadError: _,
|
|
1912
1913
|
reload: f,
|
|
1913
|
-
refresh:
|
|
1914
|
+
refresh: b,
|
|
1914
1915
|
fetchAgentChecklist: w,
|
|
1915
1916
|
fetchAgentResources: R,
|
|
1916
1917
|
createAgent: z,
|
|
1917
1918
|
chatConnector: Te
|
|
1918
1919
|
};
|
|
1919
|
-
},
|
|
1920
|
-
const { agent:
|
|
1920
|
+
}, os = (e) => JSON.stringify(e), ls = (e) => {
|
|
1921
|
+
const { agent: t, jwt: n, headers: s, urls: r, chatId: o } = e, i = JSON.stringify(s ?? {}), p = os(r), d = V(
|
|
1921
1922
|
() => new yt({
|
|
1922
1923
|
token: n,
|
|
1923
1924
|
headers: s,
|
|
@@ -1937,32 +1938,32 @@ const cn = (t, e) => (n) => {
|
|
|
1937
1938
|
et(() => {
|
|
1938
1939
|
d.setHeaders(s);
|
|
1939
1940
|
}, [d, i]);
|
|
1940
|
-
const h =
|
|
1941
|
+
const h = S(
|
|
1941
1942
|
async (_) => {
|
|
1942
1943
|
const [x, E] = await Promise.all([
|
|
1943
1944
|
d.getAgentChecklist(_),
|
|
1944
1945
|
d.getAgent(_).catch(() => null)
|
|
1945
1946
|
]);
|
|
1946
|
-
return
|
|
1947
|
+
return dn(
|
|
1947
1948
|
_,
|
|
1948
1949
|
x,
|
|
1949
1950
|
E ?? void 0
|
|
1950
1951
|
);
|
|
1951
1952
|
},
|
|
1952
1953
|
[d]
|
|
1953
|
-
), m =
|
|
1954
|
+
), m = S(
|
|
1954
1955
|
async (_) => d.listAllAgentResources(_),
|
|
1955
1956
|
[d]
|
|
1956
|
-
),
|
|
1957
|
+
), N = S(
|
|
1957
1958
|
async (_, x) => d.getAgentResourceHtml(_, x),
|
|
1958
1959
|
[d]
|
|
1959
|
-
), y =
|
|
1960
|
+
), y = S(
|
|
1960
1961
|
async (_) => {
|
|
1961
1962
|
const x = await d.getAgentTimeline(_);
|
|
1962
|
-
return
|
|
1963
|
+
return qa(x);
|
|
1963
1964
|
},
|
|
1964
1965
|
[d]
|
|
1965
|
-
), I =
|
|
1966
|
+
), I = S(
|
|
1966
1967
|
async (_, x) => {
|
|
1967
1968
|
await d.updateAgent(_, { invocationName: x });
|
|
1968
1969
|
},
|
|
@@ -1970,39 +1971,39 @@ const cn = (t, e) => (n) => {
|
|
|
1970
1971
|
);
|
|
1971
1972
|
return {
|
|
1972
1973
|
connector: V(
|
|
1973
|
-
() =>
|
|
1974
|
-
chatId: o ??
|
|
1975
|
-
})(
|
|
1974
|
+
() => gn(d, {
|
|
1975
|
+
chatId: o ?? t.invocation_id
|
|
1976
|
+
})(t),
|
|
1976
1977
|
// Key on invocation/chat ids so a new Agent object reference does not rebuild the connector.
|
|
1977
1978
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1978
|
-
[d,
|
|
1979
|
+
[d, t.invocation_id, o]
|
|
1979
1980
|
),
|
|
1980
1981
|
fetchAgentChecklist: h,
|
|
1981
1982
|
fetchAgentResources: m,
|
|
1982
|
-
fetchAgentResourceHtml:
|
|
1983
|
+
fetchAgentResourceHtml: N,
|
|
1983
1984
|
fetchAgentTimeline: y,
|
|
1984
1985
|
updateAgentInvocationName: I
|
|
1985
1986
|
};
|
|
1986
|
-
},
|
|
1987
|
-
const n =
|
|
1987
|
+
}, cs = 3e4, ds = (e, t) => {
|
|
1988
|
+
const n = e.hasRunBefore ? t || "This trip" : e.tripName.trim() || "A new trip", s = e.destination ? ` to ${e.destination}` : "", r = e.hasRunBefore ? " It has run before." : "";
|
|
1988
1989
|
return `${n}${s}.${r}`.trim();
|
|
1989
|
-
},
|
|
1990
|
-
switch (
|
|
1990
|
+
}, gs = (e) => {
|
|
1991
|
+
switch (e) {
|
|
1991
1992
|
case T.failed:
|
|
1992
|
-
return
|
|
1993
|
+
return B.stopped;
|
|
1993
1994
|
case T.complete:
|
|
1994
|
-
return
|
|
1995
|
+
return B.complete;
|
|
1995
1996
|
default:
|
|
1996
|
-
return
|
|
1997
|
+
return B.running;
|
|
1997
1998
|
}
|
|
1998
|
-
},
|
|
1999
|
-
|
|
2000
|
-
},
|
|
2001
|
-
const r =
|
|
1999
|
+
}, Wt = (e, t) => {
|
|
2000
|
+
t([Se(e)]);
|
|
2001
|
+
}, hs = (e, t) => e.length === t.length && e.every((n, s) => {
|
|
2002
|
+
const r = t[s];
|
|
2002
2003
|
return r !== void 0 && n.id === r.id && n.text === r.text;
|
|
2003
|
-
}),
|
|
2004
|
-
agent:
|
|
2005
|
-
invocationId:
|
|
2004
|
+
}), us = ({
|
|
2005
|
+
agent: e,
|
|
2006
|
+
invocationId: t,
|
|
2006
2007
|
open: n,
|
|
2007
2008
|
onClose: s,
|
|
2008
2009
|
jwt: r,
|
|
@@ -2012,57 +2013,57 @@ const cn = (t, e) => (n) => {
|
|
|
2012
2013
|
agentResourcesUrl: d,
|
|
2013
2014
|
agentTimelineUrl: h,
|
|
2014
2015
|
agentChatUrl: m,
|
|
2015
|
-
agentConversationUrl:
|
|
2016
|
+
agentConversationUrl: N,
|
|
2016
2017
|
stopAgentUrl: y,
|
|
2017
2018
|
chatId: I,
|
|
2018
|
-
enableUpload:
|
|
2019
|
+
enableUpload: F,
|
|
2019
2020
|
initialBrief: _,
|
|
2020
2021
|
initialPhase: x,
|
|
2021
2022
|
initialChecklist: E,
|
|
2022
2023
|
usePusherToRepoll: U = !1,
|
|
2023
|
-
pusherChannelPrefix: A =
|
|
2024
|
+
pusherChannelPrefix: A = on,
|
|
2024
2025
|
subscribeToPusher: f
|
|
2025
2026
|
}) => {
|
|
2026
|
-
const [
|
|
2027
|
+
const [b, w] = g(I ?? t), [R, z] = g("chat"), [Te, O] = g(!1), {
|
|
2027
2028
|
connector: G,
|
|
2028
2029
|
fetchAgentChecklist: q,
|
|
2029
2030
|
fetchAgentResources: Y,
|
|
2030
2031
|
fetchAgentResourceHtml: Z,
|
|
2031
2032
|
fetchAgentTimeline: $,
|
|
2032
2033
|
updateAgentInvocationName: ee
|
|
2033
|
-
} =
|
|
2034
|
-
agent: { ...
|
|
2034
|
+
} = ls({
|
|
2035
|
+
agent: { ...e, invocation_id: t },
|
|
2035
2036
|
jwt: r,
|
|
2036
2037
|
headers: o,
|
|
2037
|
-
chatId:
|
|
2038
|
+
chatId: b,
|
|
2038
2039
|
urls: {
|
|
2039
2040
|
agentUrl: i,
|
|
2040
2041
|
agentChecklistUrl: p,
|
|
2041
2042
|
agentResourcesUrl: d,
|
|
2042
2043
|
agentTimelineUrl: h,
|
|
2043
2044
|
agentChatUrl: m,
|
|
2044
|
-
agentConversationUrl:
|
|
2045
|
+
agentConversationUrl: N,
|
|
2045
2046
|
stopAgentUrl: y
|
|
2046
2047
|
}
|
|
2047
|
-
}), K = re(G), [Re,
|
|
2048
|
-
x ?? (_ ?
|
|
2049
|
-
), [Ae, te] = g([]), [He, ne] = g(0), [ze, Ge] = g(), [
|
|
2048
|
+
}), K = re(G), [Re, ke] = g(e.invocation_name), [ge, Ne] = g(0), [Me, _e] = g(null), [Q, Ie] = g(
|
|
2049
|
+
x ?? (_ ? B.running : gs(e.status))
|
|
2050
|
+
), [Ae, te] = g([]), [He, ne] = g(0), [ze, Ge] = g(), [Be, be] = g(null), [at, Oe] = g([]), [st, Le] = g(!1), [rt, Ue] = g(null), [it, Pe] = g(null), [Fe, u] = g(null), [C, k] = g(!1), [X, le] = g(null), [ae, he] = g(null), [qe, kt] = g(!1), [pn, ot] = g(null), [lt, Ke] = g(E ?? null), [mn, Nt] = g(!1), [_n, ct] = g(null), [At, bt] = g(!1), [St, Ct] = g(null), [Je, dt] = g(!1), [We, fn] = g(!1), [je, vn] = g(!1), Et = re(Je), Tt = re(e.invocation_name), Rt = re(0), It = re(0);
|
|
2050
2051
|
D(() => {
|
|
2051
2052
|
K.current = G;
|
|
2052
2053
|
}, [G]), D(() => {
|
|
2053
|
-
Tt.current =
|
|
2054
|
-
}, [
|
|
2054
|
+
Tt.current = e.invocation_name;
|
|
2055
|
+
}, [e.invocation_name]), D(() => {
|
|
2055
2056
|
Et.current = Je;
|
|
2056
2057
|
}, [Je]), D(() => {
|
|
2057
|
-
w(I ??
|
|
2058
|
-
}, [
|
|
2059
|
-
|
|
2060
|
-
}, [
|
|
2058
|
+
w(I ?? t), z("chat"), O(!1), te([]), ne((c) => c + 1), _e(null);
|
|
2059
|
+
}, [t, I]), D(() => {
|
|
2060
|
+
ke(e.invocation_name), Ne((c) => c + 1);
|
|
2061
|
+
}, [e.invocation_name]), D(() => {
|
|
2061
2062
|
if (!n || _)
|
|
2062
2063
|
return;
|
|
2063
2064
|
const c = K.current.bootstrapConversation;
|
|
2064
2065
|
if (!c) {
|
|
2065
|
-
|
|
2066
|
+
Wt(K.current.openingMessage(), te);
|
|
2066
2067
|
return;
|
|
2067
2068
|
}
|
|
2068
2069
|
let v = !1;
|
|
@@ -2071,22 +2072,22 @@ const cn = (t, e) => (n) => {
|
|
|
2071
2072
|
const P = await c.call(K.current);
|
|
2072
2073
|
if (v)
|
|
2073
2074
|
return;
|
|
2074
|
-
te(P.map(
|
|
2075
|
+
te(P.map(Se));
|
|
2075
2076
|
} catch {
|
|
2076
|
-
v ||
|
|
2077
|
+
v || Wt(K.current.openingMessage(), te);
|
|
2077
2078
|
} finally {
|
|
2078
2079
|
v || dt(!1);
|
|
2079
2080
|
}
|
|
2080
2081
|
})(), () => {
|
|
2081
2082
|
v = !0;
|
|
2082
2083
|
};
|
|
2083
|
-
}, [n, _,
|
|
2084
|
-
const ce =
|
|
2084
|
+
}, [n, _, t, b]);
|
|
2085
|
+
const ce = S(() => {
|
|
2085
2086
|
const c = ++Rt.current;
|
|
2086
2087
|
(async () => {
|
|
2087
2088
|
var v, P;
|
|
2088
2089
|
try {
|
|
2089
|
-
const W = await q(
|
|
2090
|
+
const W = await q(t);
|
|
2090
2091
|
if (c !== Rt.current)
|
|
2091
2092
|
return;
|
|
2092
2093
|
Ke(
|
|
@@ -2095,21 +2096,21 @@ const cn = (t, e) => (n) => {
|
|
|
2095
2096
|
} catch {
|
|
2096
2097
|
}
|
|
2097
2098
|
})();
|
|
2098
|
-
}, [q,
|
|
2099
|
+
}, [q, t]), fe = S(() => {
|
|
2099
2100
|
d && (async () => {
|
|
2100
2101
|
try {
|
|
2101
|
-
const c = await Y(
|
|
2102
|
+
const c = await Y(t);
|
|
2102
2103
|
Oe(c), Ue(null);
|
|
2103
2104
|
} catch {
|
|
2104
2105
|
}
|
|
2105
2106
|
})();
|
|
2106
|
-
}, [d, Y,
|
|
2107
|
+
}, [d, Y, t]), de = S(() => {
|
|
2107
2108
|
if (!h)
|
|
2108
2109
|
return;
|
|
2109
2110
|
const c = ++It.current;
|
|
2110
2111
|
(async () => {
|
|
2111
2112
|
try {
|
|
2112
|
-
const v = await $(
|
|
2113
|
+
const v = await $(t);
|
|
2113
2114
|
if (c !== It.current)
|
|
2114
2115
|
return;
|
|
2115
2116
|
he(
|
|
@@ -2118,7 +2119,7 @@ const cn = (t, e) => (n) => {
|
|
|
2118
2119
|
} catch {
|
|
2119
2120
|
}
|
|
2120
2121
|
})();
|
|
2121
|
-
}, [h, $,
|
|
2122
|
+
}, [h, $, t]), xe = S(
|
|
2122
2123
|
(c) => {
|
|
2123
2124
|
const v = K.current.bootstrapConversation;
|
|
2124
2125
|
v && (async () => {
|
|
@@ -2126,15 +2127,15 @@ const cn = (t, e) => (n) => {
|
|
|
2126
2127
|
const P = await v.call(K.current);
|
|
2127
2128
|
if (Et.current)
|
|
2128
2129
|
return;
|
|
2129
|
-
const W = P.map(
|
|
2130
|
+
const W = P.map(Se);
|
|
2130
2131
|
let ue = !1;
|
|
2131
|
-
te((Ut) =>
|
|
2132
|
+
te((Ut) => hs(Ut, W) ? Ut : (ue = !0, W)), ue && (c != null && c.refreshSidePanelsOnChange) && (ce(), de());
|
|
2132
2133
|
} catch {
|
|
2133
2134
|
}
|
|
2134
2135
|
})();
|
|
2135
2136
|
},
|
|
2136
2137
|
[ce, de]
|
|
2137
|
-
),
|
|
2138
|
+
), wn = S(
|
|
2138
2139
|
(c) => {
|
|
2139
2140
|
switch (c) {
|
|
2140
2141
|
case we.checklist:
|
|
@@ -2155,24 +2156,24 @@ const cn = (t, e) => (n) => {
|
|
|
2155
2156
|
}
|
|
2156
2157
|
},
|
|
2157
2158
|
[ce, xe, fe, de]
|
|
2158
|
-
), Ot =
|
|
2159
|
+
), Ot = Ua({
|
|
2159
2160
|
enabled: n && U,
|
|
2160
2161
|
channelPrefix: A,
|
|
2161
|
-
agentId:
|
|
2162
|
+
agentId: e.id,
|
|
2162
2163
|
subscribeToPusher: f,
|
|
2163
|
-
onRepoll:
|
|
2164
|
+
onRepoll: wn
|
|
2164
2165
|
});
|
|
2165
2166
|
D(() => {
|
|
2166
2167
|
if (!n || _ || Ot)
|
|
2167
2168
|
return;
|
|
2168
2169
|
const c = window.setInterval(() => {
|
|
2169
2170
|
xe({ refreshSidePanelsOnChange: !0 });
|
|
2170
|
-
},
|
|
2171
|
+
}, cs);
|
|
2171
2172
|
return () => {
|
|
2172
2173
|
window.clearInterval(c);
|
|
2173
2174
|
};
|
|
2174
|
-
}, [n, _, Ot,
|
|
2175
|
-
const
|
|
2175
|
+
}, [n, _, Ot, t, b, xe]);
|
|
2176
|
+
const yn = S(
|
|
2176
2177
|
(c) => {
|
|
2177
2178
|
var v, P;
|
|
2178
2179
|
c.checklist ? (Ke(c.checklist), (P = (v = K.current).seedChecklist) == null || P.call(v, c.checklist)) : ce(), c.phase && Ie(c.phase), fe(), de();
|
|
@@ -2186,76 +2187,76 @@ const cn = (t, e) => (n) => {
|
|
|
2186
2187
|
if (!n || _)
|
|
2187
2188
|
return;
|
|
2188
2189
|
let c = !1;
|
|
2189
|
-
return
|
|
2190
|
+
return Nt((v) => E != null && E.length ? !1 : v || lt === null || lt.length === 0), ct(null), (async () => {
|
|
2190
2191
|
var v, P;
|
|
2191
2192
|
try {
|
|
2192
|
-
const W = await q(
|
|
2193
|
+
const W = await q(t);
|
|
2193
2194
|
if (c)
|
|
2194
2195
|
return;
|
|
2195
2196
|
E != null && E.length || (Ke(W.checklist), (P = (v = K.current).seedChecklist) == null || P.call(v, W.checklist));
|
|
2196
2197
|
} catch {
|
|
2197
2198
|
!c && !(E != null && E.length) && ct(Ze);
|
|
2198
2199
|
} finally {
|
|
2199
|
-
c ||
|
|
2200
|
+
c || Nt(!1);
|
|
2200
2201
|
}
|
|
2201
2202
|
})(), () => {
|
|
2202
2203
|
c = !0;
|
|
2203
2204
|
};
|
|
2204
|
-
}, [n,
|
|
2205
|
+
}, [n, t, _, E, q]), D(() => {
|
|
2205
2206
|
if (!n || !d)
|
|
2206
2207
|
return;
|
|
2207
2208
|
let c = !1;
|
|
2208
2209
|
return Le(!0), Ue(null), (async () => {
|
|
2209
2210
|
try {
|
|
2210
|
-
const v = await Y(
|
|
2211
|
+
const v = await Y(t);
|
|
2211
2212
|
c || Oe(v);
|
|
2212
2213
|
} catch {
|
|
2213
|
-
c || Ue(
|
|
2214
|
+
c || Ue(Bn);
|
|
2214
2215
|
} finally {
|
|
2215
2216
|
c || Le(!1);
|
|
2216
2217
|
}
|
|
2217
2218
|
})(), () => {
|
|
2218
2219
|
c = !0;
|
|
2219
2220
|
};
|
|
2220
|
-
}, [n,
|
|
2221
|
-
const
|
|
2222
|
-
Pe(null), u(null), le(null),
|
|
2223
|
-
}, []),
|
|
2221
|
+
}, [n, t, d, Y]);
|
|
2222
|
+
const kn = S(() => {
|
|
2223
|
+
Pe(null), u(null), le(null), k(!1);
|
|
2224
|
+
}, []), Nn = S(
|
|
2224
2225
|
(c) => {
|
|
2225
2226
|
if (c.misRecordUrl) {
|
|
2226
2227
|
window.open(c.misRecordUrl, "_blank", "noopener,noreferrer");
|
|
2227
2228
|
return;
|
|
2228
2229
|
}
|
|
2229
|
-
Pe(c), u(null), le(null),
|
|
2230
|
+
Pe(c), u(null), le(null), k(!0), (async () => {
|
|
2230
2231
|
try {
|
|
2231
|
-
const v = await Z(
|
|
2232
|
+
const v = await Z(t, c.id);
|
|
2232
2233
|
u(v);
|
|
2233
2234
|
} catch {
|
|
2234
2235
|
le(Fn);
|
|
2235
2236
|
} finally {
|
|
2236
|
-
|
|
2237
|
+
k(!1);
|
|
2237
2238
|
}
|
|
2238
2239
|
})();
|
|
2239
2240
|
},
|
|
2240
|
-
[Z,
|
|
2241
|
+
[Z, t]
|
|
2241
2242
|
);
|
|
2242
2243
|
D(() => {
|
|
2243
2244
|
if (!n || !h)
|
|
2244
2245
|
return;
|
|
2245
2246
|
let c = !1;
|
|
2246
|
-
return
|
|
2247
|
+
return kt((v) => v || ae === null), ot(null), (async () => {
|
|
2247
2248
|
try {
|
|
2248
|
-
const v = await $(
|
|
2249
|
+
const v = await $(t);
|
|
2249
2250
|
c || he(v);
|
|
2250
2251
|
} catch {
|
|
2251
|
-
c || ot(
|
|
2252
|
+
c || ot(tn);
|
|
2252
2253
|
} finally {
|
|
2253
|
-
c ||
|
|
2254
|
+
c || kt(!1);
|
|
2254
2255
|
}
|
|
2255
2256
|
})(), () => {
|
|
2256
2257
|
c = !0;
|
|
2257
2258
|
};
|
|
2258
|
-
}, [n,
|
|
2259
|
+
}, [n, t, h, $]), D(() => {
|
|
2259
2260
|
if (!n || !_)
|
|
2260
2261
|
return;
|
|
2261
2262
|
let c = !1;
|
|
@@ -2263,27 +2264,27 @@ const cn = (t, e) => (n) => {
|
|
|
2263
2264
|
id: `user-brief-${Date.now()}`,
|
|
2264
2265
|
author: oe.user,
|
|
2265
2266
|
// Read through a ref so a rename cannot re-trigger the agent run.
|
|
2266
|
-
text:
|
|
2267
|
+
text: ds(_, Tt.current)
|
|
2267
2268
|
};
|
|
2268
2269
|
return (async () => {
|
|
2269
2270
|
var W, ue;
|
|
2270
2271
|
const P = await K.current.start(_);
|
|
2271
2272
|
c || (te([
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
]), P.checklist ? (Ke(P.checklist), (ue = (W = K.current).seedChecklist) == null || ue.call(W, P.checklist)) : ce(), Ie(P.phase ??
|
|
2273
|
+
Se(K.current.openingMessage()),
|
|
2274
|
+
Se(v),
|
|
2275
|
+
Se(P.message)
|
|
2276
|
+
]), P.checklist ? (Ke(P.checklist), (ue = (W = K.current).seedChecklist) == null || ue.call(W, P.checklist)) : ce(), Ie(P.phase ?? B.running), fe(), de());
|
|
2276
2277
|
})(), () => {
|
|
2277
2278
|
c = !0;
|
|
2278
2279
|
};
|
|
2279
|
-
}, [n, _,
|
|
2280
|
-
const
|
|
2281
|
-
|
|
2282
|
-
}, []), gt = I ??
|
|
2280
|
+
}, [n, _, t, ce, fe, de]);
|
|
2281
|
+
const An = S((c) => {
|
|
2282
|
+
be(ba(c));
|
|
2283
|
+
}, []), gt = I ?? t, Ve = ae == null ? void 0 : ae.chatSessions, Lt = Ve != null && Ve.length ? Ve.reduce(
|
|
2283
2284
|
(c, v) => Date.parse(v.timestamp) < Date.parse(c.timestamp) ? v : c
|
|
2284
|
-
).sessionId : void 0, ht =
|
|
2285
|
-
z("chat"), O(!1),
|
|
2286
|
-
}, [
|
|
2285
|
+
).sessionId : void 0, ht = S(() => {
|
|
2286
|
+
z("chat"), O(!1), b !== gt && (w(gt), te([]), ne((c) => c + 1));
|
|
2287
|
+
}, [b, gt]), bn = S(
|
|
2287
2288
|
(c) => {
|
|
2288
2289
|
if (c === Lt) {
|
|
2289
2290
|
ht();
|
|
@@ -2292,44 +2293,44 @@ const cn = (t, e) => (n) => {
|
|
|
2292
2293
|
w(c), O(!0), z("chat"), te([]), ne((v) => v + 1);
|
|
2293
2294
|
},
|
|
2294
2295
|
[Lt, ht]
|
|
2295
|
-
),
|
|
2296
|
-
|
|
2297
|
-
}, []),
|
|
2298
|
-
Ct(null),
|
|
2296
|
+
), Sn = S((c) => {
|
|
2297
|
+
be(null), Ge(c), ne((v) => v + 1);
|
|
2298
|
+
}, []), Cn = S(async () => {
|
|
2299
|
+
Ct(null), bt(!0);
|
|
2299
2300
|
try {
|
|
2300
|
-
await K.current.stop(), Ie(
|
|
2301
|
+
await K.current.stop(), Ie(B.stopped);
|
|
2301
2302
|
} catch {
|
|
2302
|
-
Ct(
|
|
2303
|
+
Ct(qn);
|
|
2303
2304
|
} finally {
|
|
2304
|
-
|
|
2305
|
+
bt(!1);
|
|
2305
2306
|
}
|
|
2306
|
-
}, []),
|
|
2307
|
+
}, []), En = S(
|
|
2307
2308
|
(c) => {
|
|
2308
2309
|
const v = c.trim(), P = Re;
|
|
2309
2310
|
if (_e(null), !v) {
|
|
2310
|
-
|
|
2311
|
+
Ne((W) => W + 1);
|
|
2311
2312
|
return;
|
|
2312
2313
|
}
|
|
2313
|
-
v !== P && (
|
|
2314
|
+
v !== P && (ke(v), (async () => {
|
|
2314
2315
|
try {
|
|
2315
|
-
await ee(
|
|
2316
|
+
await ee(t, v);
|
|
2316
2317
|
} catch {
|
|
2317
|
-
|
|
2318
|
+
ke(P), Ne((W) => W + 1), _e(Kn);
|
|
2318
2319
|
}
|
|
2319
2320
|
})());
|
|
2320
2321
|
},
|
|
2321
|
-
[Re,
|
|
2322
|
-
),
|
|
2322
|
+
[Re, t, ee]
|
|
2323
|
+
), Tn = lt;
|
|
2323
2324
|
return /* @__PURE__ */ l(me, { open: n, closeHandler: s, hideCloseButton: !0, className: "agent-workspace", children: [
|
|
2324
2325
|
/* @__PURE__ */ l(me.Header, { className: "agent-workspace__header", children: [
|
|
2325
2326
|
/* @__PURE__ */ l("div", { className: "agent-workspace__header-title", children: [
|
|
2326
2327
|
/* @__PURE__ */ a("span", { className: "agent-workspace__header-avatar", "aria-hidden": "true", children: /* @__PURE__ */ a(L, { name: "ask-arbor", size: 24 }) }),
|
|
2327
2328
|
/* @__PURE__ */ a(me.Title, { children: /* @__PURE__ */ a(
|
|
2328
|
-
|
|
2329
|
+
In,
|
|
2329
2330
|
{
|
|
2330
2331
|
className: "agent-workspace__header-name",
|
|
2331
2332
|
text: Re,
|
|
2332
|
-
onEditSave:
|
|
2333
|
+
onEditSave: En
|
|
2333
2334
|
},
|
|
2334
2335
|
ge
|
|
2335
2336
|
) }),
|
|
@@ -2337,7 +2338,7 @@ const cn = (t, e) => (n) => {
|
|
|
2337
2338
|
"span",
|
|
2338
2339
|
{
|
|
2339
2340
|
className: j("agent-workspace__phase", `agent-workspace__phase--${Q}`),
|
|
2340
|
-
children:
|
|
2341
|
+
children: jn[Q]
|
|
2341
2342
|
}
|
|
2342
2343
|
),
|
|
2343
2344
|
Me && /* @__PURE__ */ a("p", { className: "agent-workspace__error agent-workspace__name-error", role: "alert", children: Me })
|
|
@@ -2351,7 +2352,7 @@ const cn = (t, e) => (n) => {
|
|
|
2351
2352
|
iconLeftName: "clipboard-list",
|
|
2352
2353
|
iconLeftScreenReaderText: "Toggle checklist",
|
|
2353
2354
|
"aria-pressed": !We,
|
|
2354
|
-
onClick: () =>
|
|
2355
|
+
onClick: () => fn((c) => !c),
|
|
2355
2356
|
children: "Checklist"
|
|
2356
2357
|
}
|
|
2357
2358
|
),
|
|
@@ -2363,7 +2364,7 @@ const cn = (t, e) => (n) => {
|
|
|
2363
2364
|
iconLeftName: "files",
|
|
2364
2365
|
iconLeftScreenReaderText: "Toggle resources",
|
|
2365
2366
|
"aria-pressed": !je,
|
|
2366
|
-
onClick: () =>
|
|
2367
|
+
onClick: () => vn((c) => !c),
|
|
2367
2368
|
children: "Resources"
|
|
2368
2369
|
}
|
|
2369
2370
|
),
|
|
@@ -2398,7 +2399,7 @@ const cn = (t, e) => (n) => {
|
|
|
2398
2399
|
children: [
|
|
2399
2400
|
/* @__PURE__ */ l("div", { className: "agent-workspace__panel-header", children: [
|
|
2400
2401
|
/* @__PURE__ */ a(Ee, { level: 4, children: "Agent" }),
|
|
2401
|
-
y && Q ===
|
|
2402
|
+
y && Q === B.running && /* @__PURE__ */ a(
|
|
2402
2403
|
ie,
|
|
2403
2404
|
{
|
|
2404
2405
|
className: "agent-workspace__panel-header-action",
|
|
@@ -2407,12 +2408,12 @@ const cn = (t, e) => (n) => {
|
|
|
2407
2408
|
iconLeftName: "circle-x",
|
|
2408
2409
|
iconLeftScreenReaderText: "Stop",
|
|
2409
2410
|
disabled: At,
|
|
2410
|
-
onClick: () => void
|
|
2411
|
+
onClick: () => void Cn(),
|
|
2411
2412
|
children: At ? "Stopping…" : "Stop agent"
|
|
2412
2413
|
}
|
|
2413
2414
|
)
|
|
2414
2415
|
] }),
|
|
2415
|
-
|
|
2416
|
+
St && /* @__PURE__ */ a("p", { className: "agent-workspace__error agent-workspace__stop-error", role: "alert", children: St }),
|
|
2416
2417
|
h && /* @__PURE__ */ l(ut, { className: "agent-workspace__center-tabs", "aria-label": "Center panel", children: [
|
|
2417
2418
|
/* @__PURE__ */ a(
|
|
2418
2419
|
ut.Item,
|
|
@@ -2453,8 +2454,8 @@ const cn = (t, e) => (n) => {
|
|
|
2453
2454
|
{
|
|
2454
2455
|
timeline: ae,
|
|
2455
2456
|
isLoading: qe,
|
|
2456
|
-
error:
|
|
2457
|
-
onOpenChatSession:
|
|
2457
|
+
error: pn,
|
|
2458
|
+
onOpenChatSession: bn
|
|
2458
2459
|
}
|
|
2459
2460
|
),
|
|
2460
2461
|
/* @__PURE__ */ a(
|
|
@@ -2463,19 +2464,19 @@ const cn = (t, e) => (n) => {
|
|
|
2463
2464
|
className: "agent-workspace__chat-keep-alive",
|
|
2464
2465
|
hidden: !!h && R !== "chat",
|
|
2465
2466
|
children: /* @__PURE__ */ a(
|
|
2466
|
-
|
|
2467
|
+
ca,
|
|
2467
2468
|
{
|
|
2468
2469
|
connector: G,
|
|
2469
2470
|
phase: Q,
|
|
2470
2471
|
chatHistory: Ae,
|
|
2471
2472
|
chatSessionKey: He,
|
|
2472
2473
|
startQuery: ze,
|
|
2473
|
-
clarificationMessage:
|
|
2474
|
-
enableUpload:
|
|
2475
|
-
onTurn:
|
|
2474
|
+
clarificationMessage: Be,
|
|
2475
|
+
enableUpload: F,
|
|
2476
|
+
onTurn: yn,
|
|
2476
2477
|
onAwaitingChange: dt,
|
|
2477
|
-
onClarificationPrompt:
|
|
2478
|
-
onDismissClarification: () =>
|
|
2478
|
+
onClarificationPrompt: Sn,
|
|
2479
|
+
onDismissClarification: () => be(null)
|
|
2479
2480
|
}
|
|
2480
2481
|
)
|
|
2481
2482
|
}
|
|
@@ -2484,42 +2485,42 @@ const cn = (t, e) => (n) => {
|
|
|
2484
2485
|
}
|
|
2485
2486
|
),
|
|
2486
2487
|
!We && /* @__PURE__ */ a(
|
|
2487
|
-
|
|
2488
|
+
da,
|
|
2488
2489
|
{
|
|
2489
|
-
checklist:
|
|
2490
|
-
isLoading:
|
|
2491
|
-
error:
|
|
2490
|
+
checklist: Tn,
|
|
2491
|
+
isLoading: mn,
|
|
2492
|
+
error: _n,
|
|
2492
2493
|
phase: Q,
|
|
2493
|
-
canRequestInput: Q ===
|
|
2494
|
-
onAttentionItemClick:
|
|
2494
|
+
canRequestInput: Q === B.running && !Je,
|
|
2495
|
+
onAttentionItemClick: An
|
|
2495
2496
|
}
|
|
2496
2497
|
),
|
|
2497
2498
|
!je && /* @__PURE__ */ a(
|
|
2498
|
-
|
|
2499
|
+
ua,
|
|
2499
2500
|
{
|
|
2500
2501
|
resources: at,
|
|
2501
2502
|
isLoading: st,
|
|
2502
2503
|
error: rt,
|
|
2503
|
-
onOpenResource:
|
|
2504
|
+
onOpenResource: Nn
|
|
2504
2505
|
}
|
|
2505
2506
|
),
|
|
2506
2507
|
/* @__PURE__ */ a(
|
|
2507
|
-
|
|
2508
|
+
ga,
|
|
2508
2509
|
{
|
|
2509
2510
|
resource: it,
|
|
2510
|
-
html:
|
|
2511
|
+
html: Fe,
|
|
2511
2512
|
isLoading: C,
|
|
2512
2513
|
error: X,
|
|
2513
|
-
onClose:
|
|
2514
|
+
onClose: kn
|
|
2514
2515
|
}
|
|
2515
2516
|
)
|
|
2516
2517
|
]
|
|
2517
2518
|
}
|
|
2518
2519
|
)
|
|
2519
2520
|
] });
|
|
2520
|
-
},
|
|
2521
|
-
open:
|
|
2522
|
-
onClose:
|
|
2521
|
+
}, ps = "Unable to load agent definitions. Please try again.", ms = "Unable to start the agent.", jt = "Loading agents…", un = ({
|
|
2522
|
+
open: e,
|
|
2523
|
+
onClose: t,
|
|
2523
2524
|
onStart: n,
|
|
2524
2525
|
agentDefinitions: s,
|
|
2525
2526
|
definitionsState: r = "idle",
|
|
@@ -2527,39 +2528,39 @@ const cn = (t, e) => (n) => {
|
|
|
2527
2528
|
onRetryDefinitions: i,
|
|
2528
2529
|
embedded: p = !1
|
|
2529
2530
|
}) => {
|
|
2530
|
-
const [d, h] = g(void 0), [m,
|
|
2531
|
+
const [d, h] = g(void 0), [m, N] = g(""), [y, I] = g(!1), [F, _] = g(null), x = [...s].sort((w, R) => w.display_name.localeCompare(R.display_name)).map((w) => ({
|
|
2531
2532
|
value: w.ref,
|
|
2532
2533
|
label: w.display_name
|
|
2533
2534
|
}));
|
|
2534
2535
|
D(() => {
|
|
2535
|
-
|
|
2536
|
-
}, [
|
|
2537
|
-
const E = d !== void 0 && m.trim().length > 0, U =
|
|
2536
|
+
e && (h(void 0), N(""), I(!1), _(null));
|
|
2537
|
+
}, [e]);
|
|
2538
|
+
const E = d !== void 0 && m.trim().length > 0, U = S(
|
|
2538
2539
|
(w) => {
|
|
2539
2540
|
const R = s.find((z) => z.ref === w[0]);
|
|
2540
2541
|
R && h(R);
|
|
2541
2542
|
},
|
|
2542
2543
|
[s]
|
|
2543
|
-
), A =
|
|
2544
|
+
), A = S(async () => {
|
|
2544
2545
|
if (!(!d || !E || y)) {
|
|
2545
2546
|
I(!0), _(null);
|
|
2546
2547
|
try {
|
|
2547
2548
|
await n({ definition: d, invocationName: m.trim() });
|
|
2548
2549
|
} catch (w) {
|
|
2549
|
-
_(w instanceof Error ? w.message :
|
|
2550
|
+
_(w instanceof Error ? w.message : ms);
|
|
2550
2551
|
} finally {
|
|
2551
2552
|
I(!1);
|
|
2552
2553
|
}
|
|
2553
2554
|
}
|
|
2554
2555
|
}, [E, d, m, y, n]);
|
|
2555
|
-
if (r === "idle" && s.length === 0 || !
|
|
2556
|
+
if (r === "idle" && s.length === 0 || !e)
|
|
2556
2557
|
return null;
|
|
2557
2558
|
const f = /* @__PURE__ */ l("div", { className: "new-agent__header-title", children: [
|
|
2558
2559
|
/* @__PURE__ */ a("span", { className: "new-agent__header-avatar", "aria-hidden": "true", children: /* @__PURE__ */ a(L, { name: "ask-arbor", size: 24 }) }),
|
|
2559
2560
|
p ? /* @__PURE__ */ a("h2", { className: "new-agent__title", children: "Start an agent" }) : /* @__PURE__ */ a(me.Title, { children: "Start an agent" })
|
|
2560
2561
|
] });
|
|
2561
|
-
let
|
|
2562
|
-
return r === "loading" ?
|
|
2562
|
+
let b;
|
|
2563
|
+
return r === "loading" ? b = /* @__PURE__ */ l("div", { className: "new-agent__state", "aria-live": "polite", children: [
|
|
2563
2564
|
/* @__PURE__ */ a(
|
|
2564
2565
|
L,
|
|
2565
2566
|
{
|
|
@@ -2567,15 +2568,15 @@ const cn = (t, e) => (n) => {
|
|
|
2567
2568
|
size: 24,
|
|
2568
2569
|
color: "var(--color-brand-600)",
|
|
2569
2570
|
className: "new-agent__spinner",
|
|
2570
|
-
screenReaderText:
|
|
2571
|
+
screenReaderText: jt
|
|
2571
2572
|
}
|
|
2572
2573
|
),
|
|
2573
|
-
/* @__PURE__ */ a("p", { className: "new-agent__state-message", children:
|
|
2574
|
-
] }) : r === "error" ?
|
|
2574
|
+
/* @__PURE__ */ a("p", { className: "new-agent__state-message", children: jt })
|
|
2575
|
+
] }) : r === "error" ? b = /* @__PURE__ */ l("div", { className: "new-agent__state new-agent__state--error", role: "alert", children: [
|
|
2575
2576
|
/* @__PURE__ */ a(L, { name: "triangle-alert", size: 24, color: "var(--color-semantic-destructive-600)" }),
|
|
2576
|
-
/* @__PURE__ */ a("p", { className: "new-agent__state-message", children: o ??
|
|
2577
|
+
/* @__PURE__ */ a("p", { className: "new-agent__state-message", children: o ?? ps }),
|
|
2577
2578
|
i ? /* @__PURE__ */ a(ie, { variant: "secondary", size: "S", onClick: i, children: "Try again" }) : null
|
|
2578
|
-
] }) :
|
|
2579
|
+
] }) : b = /* @__PURE__ */ l(
|
|
2579
2580
|
"form",
|
|
2580
2581
|
{
|
|
2581
2582
|
className: "new-agent__form",
|
|
@@ -2587,7 +2588,7 @@ const cn = (t, e) => (n) => {
|
|
|
2587
2588
|
/* @__PURE__ */ l("div", { className: "new-agent__type-field", children: [
|
|
2588
2589
|
/* @__PURE__ */ a("label", { className: "new-agent__type-label", htmlFor: "new-agent-type", children: "What would you like your agent to do?" }),
|
|
2589
2590
|
/* @__PURE__ */ a(
|
|
2590
|
-
|
|
2591
|
+
On,
|
|
2591
2592
|
{
|
|
2592
2593
|
id: "new-agent-type",
|
|
2593
2594
|
placeholder: "Which agent would you like to start?",
|
|
@@ -2600,16 +2601,16 @@ const cn = (t, e) => (n) => {
|
|
|
2600
2601
|
/* @__PURE__ */ l("div", { className: "new-agent__type-field", children: [
|
|
2601
2602
|
/* @__PURE__ */ a("label", { className: "new-agent__type-label", htmlFor: "new-agent-invocation-name", children: "Name" }),
|
|
2602
2603
|
/* @__PURE__ */ a(
|
|
2603
|
-
|
|
2604
|
+
Ln,
|
|
2604
2605
|
{
|
|
2605
2606
|
id: "new-agent-invocation-name",
|
|
2606
2607
|
value: m,
|
|
2607
2608
|
placeholder: "What would you like to call your agent?",
|
|
2608
|
-
onChange: (w) =>
|
|
2609
|
+
onChange: (w) => N(w.target.value)
|
|
2609
2610
|
}
|
|
2610
2611
|
)
|
|
2611
2612
|
] }),
|
|
2612
|
-
|
|
2613
|
+
F ? /* @__PURE__ */ a("p", { className: "new-agent__error", role: "alert", children: F }) : null,
|
|
2613
2614
|
/* @__PURE__ */ a("div", { className: "new-agent__actions", children: /* @__PURE__ */ a(
|
|
2614
2615
|
ie,
|
|
2615
2616
|
{
|
|
@@ -2628,16 +2629,16 @@ const cn = (t, e) => (n) => {
|
|
|
2628
2629
|
}
|
|
2629
2630
|
), p ? /* @__PURE__ */ l("div", { className: j("new-agent", "new-agent--embedded"), children: [
|
|
2630
2631
|
/* @__PURE__ */ a("div", { className: "new-agent__header", children: f }),
|
|
2631
|
-
/* @__PURE__ */ a("div", { className: "new-agent__body", children:
|
|
2632
|
-
] }) : /* @__PURE__ */ l(me, { open:
|
|
2632
|
+
/* @__PURE__ */ a("div", { className: "new-agent__body", children: b })
|
|
2633
|
+
] }) : /* @__PURE__ */ l(me, { open: e, closeHandler: t, className: "new-agent", children: [
|
|
2633
2634
|
/* @__PURE__ */ a(me.Header, { className: "new-agent__header", children: f }),
|
|
2634
|
-
/* @__PURE__ */ a(me.Body, { className: "new-agent__body", children:
|
|
2635
|
+
/* @__PURE__ */ a(me.Body, { className: "new-agent__body", children: b })
|
|
2635
2636
|
] });
|
|
2636
|
-
},
|
|
2637
|
-
window.location.assign(
|
|
2638
|
-
},
|
|
2639
|
-
open:
|
|
2640
|
-
authToken:
|
|
2637
|
+
}, Vt = (e) => {
|
|
2638
|
+
window.location.assign(e);
|
|
2639
|
+
}, _s = ({
|
|
2640
|
+
open: e,
|
|
2641
|
+
authToken: t,
|
|
2641
2642
|
headers: n,
|
|
2642
2643
|
agentDefinitionsUrl: s,
|
|
2643
2644
|
agentsUrl: r,
|
|
@@ -2647,9 +2648,9 @@ const cn = (t, e) => (n) => {
|
|
|
2647
2648
|
onStart: d,
|
|
2648
2649
|
embedded: h = !1
|
|
2649
2650
|
}) => {
|
|
2650
|
-
const m = JSON.stringify(n ?? {}),
|
|
2651
|
+
const m = JSON.stringify(n ?? {}), N = V(
|
|
2651
2652
|
() => new yt({
|
|
2652
|
-
token:
|
|
2653
|
+
token: t,
|
|
2653
2654
|
headers: n,
|
|
2654
2655
|
urls: {
|
|
2655
2656
|
agentDefinitions: s,
|
|
@@ -2657,74 +2658,74 @@ const cn = (t, e) => (n) => {
|
|
|
2657
2658
|
}
|
|
2658
2659
|
}),
|
|
2659
2660
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- keyed on serialised config to keep a stable client.
|
|
2660
|
-
[
|
|
2661
|
-
), [y, I] = g([]), [
|
|
2661
|
+
[t, s, r, m]
|
|
2662
|
+
), [y, I] = g([]), [F, _] = g("loading"), [x, E] = g(null), [U, A] = g(0);
|
|
2662
2663
|
D(() => {
|
|
2663
|
-
if (!
|
|
2664
|
+
if (!e)
|
|
2664
2665
|
return;
|
|
2665
2666
|
let R = !1;
|
|
2666
2667
|
return _("loading"), E(null), (async () => {
|
|
2667
2668
|
try {
|
|
2668
|
-
const z = await
|
|
2669
|
+
const z = await N.listAgentDefinitions();
|
|
2669
2670
|
if (R)
|
|
2670
2671
|
return;
|
|
2671
|
-
I(z.map(
|
|
2672
|
+
I(z.map(ln)), _("idle");
|
|
2672
2673
|
} catch (z) {
|
|
2673
2674
|
if (R)
|
|
2674
2675
|
return;
|
|
2675
|
-
I([]), E(
|
|
2676
|
+
I([]), E(hn(z)), _("error");
|
|
2676
2677
|
}
|
|
2677
2678
|
})(), () => {
|
|
2678
2679
|
R = !0;
|
|
2679
2680
|
};
|
|
2680
|
-
}, [
|
|
2681
|
-
const f =
|
|
2682
|
-
p == null || p(), o &&
|
|
2683
|
-
}, [o, p]),
|
|
2681
|
+
}, [N, e, U]);
|
|
2682
|
+
const f = S(() => {
|
|
2683
|
+
p == null || p(), o && Vt(o);
|
|
2684
|
+
}, [o, p]), b = S(
|
|
2684
2685
|
async (R) => {
|
|
2685
|
-
await
|
|
2686
|
+
await N.createAgent(R.definition.ref, {
|
|
2686
2687
|
invocationName: R.invocationName
|
|
2687
|
-
}), d == null || d(R), i &&
|
|
2688
|
+
}), d == null || d(R), i && Vt(i);
|
|
2688
2689
|
},
|
|
2689
|
-
[
|
|
2690
|
-
), w =
|
|
2690
|
+
[N, d, i]
|
|
2691
|
+
), w = S(() => {
|
|
2691
2692
|
A((R) => R + 1);
|
|
2692
2693
|
}, []);
|
|
2693
2694
|
return /* @__PURE__ */ a(
|
|
2694
|
-
|
|
2695
|
+
un,
|
|
2695
2696
|
{
|
|
2696
|
-
open:
|
|
2697
|
+
open: e,
|
|
2697
2698
|
onClose: f,
|
|
2698
|
-
onStart:
|
|
2699
|
+
onStart: b,
|
|
2699
2700
|
agentDefinitions: y,
|
|
2700
|
-
definitionsState:
|
|
2701
|
+
definitionsState: F,
|
|
2701
2702
|
definitionsError: x,
|
|
2702
2703
|
onRetryDefinitions: w,
|
|
2703
2704
|
embedded: h
|
|
2704
2705
|
}
|
|
2705
2706
|
);
|
|
2706
|
-
},
|
|
2707
|
+
}, fs = (e) => "agentDefinitionsUrl" in e, vs = (e) => fs(e) ? /* @__PURE__ */ a(_s, { ...e }) : /* @__PURE__ */ a(un, { ...e }), ws = (e) => e !== void 0 && e.some((t) => t.status === M.hitl), ys = (e, t) => ws(t) ? T.hitl : e.status, ks = ({ column: e, label: t }) => e.statusIcon ? /* @__PURE__ */ a("span", { className: "agent-view__status-indicator", children: /* @__PURE__ */ a(
|
|
2707
2708
|
L,
|
|
2708
2709
|
{
|
|
2709
|
-
name:
|
|
2710
|
+
name: e.statusIcon.name,
|
|
2710
2711
|
size: 16,
|
|
2711
|
-
color:
|
|
2712
|
+
color: e.statusIcon.color,
|
|
2712
2713
|
className: j({
|
|
2713
|
-
"agent-view__progress-icon--spinning":
|
|
2714
|
+
"agent-view__progress-icon--spinning": e.statusIcon.spin
|
|
2714
2715
|
}),
|
|
2715
|
-
screenReaderText:
|
|
2716
|
+
screenReaderText: t
|
|
2716
2717
|
}
|
|
2717
2718
|
) }) : /* @__PURE__ */ a(
|
|
2718
2719
|
"span",
|
|
2719
2720
|
{
|
|
2720
2721
|
className: j("agent-view__dot", {
|
|
2721
|
-
[`agent-view__dot--${
|
|
2722
|
+
[`agent-view__dot--${e.dotModifier}`]: e.dotModifier
|
|
2722
2723
|
}),
|
|
2723
|
-
children: /* @__PURE__ */ a(
|
|
2724
|
+
children: /* @__PURE__ */ a(Xt, { colour: e.dotColour, label: t })
|
|
2724
2725
|
}
|
|
2725
2726
|
), Ns = ({
|
|
2726
|
-
agent:
|
|
2727
|
-
agentName:
|
|
2727
|
+
agent: e,
|
|
2728
|
+
agentName: t,
|
|
2728
2729
|
column: n,
|
|
2729
2730
|
isExpanded: s,
|
|
2730
2731
|
isLoading: r,
|
|
@@ -2733,14 +2734,14 @@ const cn = (t, e) => (n) => {
|
|
|
2733
2734
|
onToggle: p,
|
|
2734
2735
|
onViewAgent: d
|
|
2735
2736
|
}) => {
|
|
2736
|
-
const { id: h, invocation_name: m } =
|
|
2737
|
+
const { id: h, invocation_name: m } = e, N = `agent-card-${h}-header`, y = `agent-card-${h}-progress`;
|
|
2737
2738
|
return /* @__PURE__ */ a(
|
|
2738
2739
|
"li",
|
|
2739
2740
|
{
|
|
2740
2741
|
className: j("agent-view__card", {
|
|
2741
2742
|
"agent-view__card--expanded": s
|
|
2742
2743
|
}),
|
|
2743
|
-
children: /* @__PURE__ */ l(
|
|
2744
|
+
children: /* @__PURE__ */ l(Un, { spacing: "dense", children: [
|
|
2744
2745
|
/* @__PURE__ */ a(
|
|
2745
2746
|
"button",
|
|
2746
2747
|
{
|
|
@@ -2749,12 +2750,12 @@ const cn = (t, e) => (n) => {
|
|
|
2749
2750
|
"aria-expanded": s,
|
|
2750
2751
|
"aria-controls": y,
|
|
2751
2752
|
"aria-label": m,
|
|
2752
|
-
id:
|
|
2753
|
+
id: N,
|
|
2753
2754
|
onClick: () => p(h),
|
|
2754
2755
|
children: /* @__PURE__ */ l("div", { className: "agent-view__card-content", children: [
|
|
2755
|
-
/* @__PURE__ */ a(
|
|
2756
|
+
/* @__PURE__ */ a(ks, { column: n }),
|
|
2756
2757
|
/* @__PURE__ */ a("span", { className: "agent-view__card-invocation-name", children: m }),
|
|
2757
|
-
/* @__PURE__ */ a("span", { className: "agent-view__card-agent-name", children:
|
|
2758
|
+
/* @__PURE__ */ a("span", { className: "agent-view__card-agent-name", children: t }),
|
|
2758
2759
|
/* @__PURE__ */ a(
|
|
2759
2760
|
L,
|
|
2760
2761
|
{
|
|
@@ -2766,7 +2767,7 @@ const cn = (t, e) => (n) => {
|
|
|
2766
2767
|
] })
|
|
2767
2768
|
}
|
|
2768
2769
|
),
|
|
2769
|
-
s && /* @__PURE__ */ l("div", { id: y, "aria-labelledby":
|
|
2770
|
+
s && /* @__PURE__ */ l("div", { id: y, "aria-labelledby": N, className: "agent-view__card-progress", children: [
|
|
2770
2771
|
r && /* @__PURE__ */ l("div", { className: "agent-view__progress-loading", "aria-live": "polite", children: [
|
|
2771
2772
|
/* @__PURE__ */ a(
|
|
2772
2773
|
L,
|
|
@@ -2781,7 +2782,7 @@ const cn = (t, e) => (n) => {
|
|
|
2781
2782
|
/* @__PURE__ */ a("span", { children: Ce })
|
|
2782
2783
|
] }),
|
|
2783
2784
|
!r && i && /* @__PURE__ */ a("p", { className: "agent-view__progress-error", role: "alert", children: i }),
|
|
2784
|
-
!r && !i && o !== null && /* @__PURE__ */ a(
|
|
2785
|
+
!r && !i && o !== null && /* @__PURE__ */ a(ia, { checklist: o }),
|
|
2785
2786
|
!r && !i && o === null && /* @__PURE__ */ l("div", { className: "agent-view__progress-loading", "aria-live": "polite", children: [
|
|
2786
2787
|
/* @__PURE__ */ a(
|
|
2787
2788
|
L,
|
|
@@ -2795,14 +2796,14 @@ const cn = (t, e) => (n) => {
|
|
|
2795
2796
|
),
|
|
2796
2797
|
/* @__PURE__ */ a("span", { children: Ce })
|
|
2797
2798
|
] }),
|
|
2798
|
-
/* @__PURE__ */ a("div", { className: "agent-view__card-actions", children: /* @__PURE__ */ a(ie, { variant: "secondary", size: "S", onClick: () => d == null ? void 0 : d(
|
|
2799
|
+
/* @__PURE__ */ a("div", { className: "agent-view__card-actions", children: /* @__PURE__ */ a(ie, { variant: "secondary", size: "S", onClick: () => d == null ? void 0 : d(e), children: "View agent" }) })
|
|
2799
2800
|
] })
|
|
2800
2801
|
] })
|
|
2801
2802
|
}
|
|
2802
2803
|
);
|
|
2803
|
-
},
|
|
2804
|
-
column:
|
|
2805
|
-
agents:
|
|
2804
|
+
}, Yt = ({
|
|
2805
|
+
column: e,
|
|
2806
|
+
agents: t,
|
|
2806
2807
|
expandedAgentId: n,
|
|
2807
2808
|
loadingAgentId: s,
|
|
2808
2809
|
checklistByInvocationId: r,
|
|
@@ -2817,18 +2818,18 @@ const cn = (t, e) => (n) => {
|
|
|
2817
2818
|
className: j("agent-view__column", {
|
|
2818
2819
|
"agent-view__column--split": h
|
|
2819
2820
|
}),
|
|
2820
|
-
"aria-label":
|
|
2821
|
+
"aria-label": e.title,
|
|
2821
2822
|
children: [
|
|
2822
2823
|
/* @__PURE__ */ l("div", { className: "agent-view__column-header", children: [
|
|
2823
|
-
/* @__PURE__ */ a(Ee, { level: 4, children:
|
|
2824
|
-
/* @__PURE__ */ a("span", { className: "agent-view__column-count", children:
|
|
2824
|
+
/* @__PURE__ */ a(Ee, { level: 4, children: e.title }),
|
|
2825
|
+
/* @__PURE__ */ a("span", { className: "agent-view__column-count", children: t.length })
|
|
2825
2826
|
] }),
|
|
2826
|
-
/* @__PURE__ */ a("ul", { className: "agent-view__card-list", children:
|
|
2827
|
+
/* @__PURE__ */ a("ul", { className: "agent-view__card-list", children: t.map((m) => /* @__PURE__ */ a(
|
|
2827
2828
|
Ns,
|
|
2828
2829
|
{
|
|
2829
2830
|
agent: m,
|
|
2830
2831
|
agentName: wt(m, i),
|
|
2831
|
-
column:
|
|
2832
|
+
column: e,
|
|
2832
2833
|
isExpanded: n === m.id,
|
|
2833
2834
|
isLoading: s === m.id,
|
|
2834
2835
|
checklist: r[m.invocation_id] ?? null,
|
|
@@ -2840,9 +2841,9 @@ const cn = (t, e) => (n) => {
|
|
|
2840
2841
|
)) })
|
|
2841
2842
|
]
|
|
2842
2843
|
}
|
|
2843
|
-
), wt = (
|
|
2844
|
-
jwt:
|
|
2845
|
-
headers:
|
|
2844
|
+
), wt = (e, t) => t.get(e.agent_definition_ref) ?? e.agent_definition_ref.replace(/_/g, " "), Os = ({
|
|
2845
|
+
jwt: e,
|
|
2846
|
+
headers: t,
|
|
2846
2847
|
agentDefinitionsUrl: n,
|
|
2847
2848
|
agentsUrl: s,
|
|
2848
2849
|
agentUrl: r,
|
|
@@ -2852,14 +2853,14 @@ const cn = (t, e) => (n) => {
|
|
|
2852
2853
|
agentChatUrl: d,
|
|
2853
2854
|
agentConversationUrl: h,
|
|
2854
2855
|
stopAgentUrl: m,
|
|
2855
|
-
enableUpload:
|
|
2856
|
+
enableUpload: N,
|
|
2856
2857
|
showHeader: y = !1,
|
|
2857
2858
|
institutions: I,
|
|
2858
|
-
usePusherToRepoll:
|
|
2859
|
-
pusherChannelPrefix: _ =
|
|
2859
|
+
usePusherToRepoll: F = !1,
|
|
2860
|
+
pusherChannelPrefix: _ = on,
|
|
2860
2861
|
subscribeToPusher: x
|
|
2861
2862
|
}) => {
|
|
2862
|
-
var
|
|
2863
|
+
var Fe;
|
|
2863
2864
|
const E = V(
|
|
2864
2865
|
() => ({
|
|
2865
2866
|
agentDefinitions: n,
|
|
@@ -2881,12 +2882,12 @@ const cn = (t, e) => (n) => {
|
|
|
2881
2882
|
d,
|
|
2882
2883
|
h
|
|
2883
2884
|
]
|
|
2884
|
-
), [U, A] = g(null), f = U ? (
|
|
2885
|
+
), [U, A] = g(null), f = U ? (Fe = I == null ? void 0 : I.find(
|
|
2885
2886
|
(u) => u.applicationId === U.application_id
|
|
2886
|
-
)) == null ? void 0 :
|
|
2887
|
-
const u = { ...
|
|
2887
|
+
)) == null ? void 0 : Fe.applicationUrl : void 0, b = V(() => {
|
|
2888
|
+
const u = { ...t ?? {} };
|
|
2888
2889
|
return f ? u[ye.arborApplicationUrl] = f : delete u[ye.arborApplicationUrl], u;
|
|
2889
|
-
}, [
|
|
2890
|
+
}, [t, f]), {
|
|
2890
2891
|
agents: w,
|
|
2891
2892
|
agentDefinitions: R,
|
|
2892
2893
|
loadState: z,
|
|
@@ -2895,25 +2896,25 @@ const cn = (t, e) => (n) => {
|
|
|
2895
2896
|
refresh: G,
|
|
2896
2897
|
fetchAgentChecklist: q,
|
|
2897
2898
|
createAgent: Y
|
|
2898
|
-
} =
|
|
2899
|
-
const u = new Set(w.map((
|
|
2900
|
-
(I ?? []).map((
|
|
2899
|
+
} = is({ jwt: e, headers: b, urls: E }), [Z, $] = g(!1), [ee, K] = g(null), [Re, ke] = g(null), [ge, Ne] = g({}), [Me, _e] = g({}), [Q, Ie] = g([]), [Ae, te] = g([]), He = V(() => {
|
|
2900
|
+
const u = new Set(w.map((k) => k.application_id)), C = new Map(
|
|
2901
|
+
(I ?? []).map((k) => [k.applicationId, k.name])
|
|
2901
2902
|
);
|
|
2902
2903
|
return [...u].sort(
|
|
2903
|
-
(
|
|
2904
|
-
).map((
|
|
2905
|
-
value:
|
|
2906
|
-
label: C.get(
|
|
2904
|
+
(k, X) => (C.get(k) ?? k).localeCompare(C.get(X) ?? X)
|
|
2905
|
+
).map((k) => ({
|
|
2906
|
+
value: k,
|
|
2907
|
+
label: C.get(k) ?? k
|
|
2907
2908
|
}));
|
|
2908
2909
|
}, [w, I]), ne = V(
|
|
2909
2910
|
() => new Map(R.map((u) => [u.ref, u.display_name])),
|
|
2910
2911
|
[R]
|
|
2911
2912
|
), ze = V(() => [...new Set(
|
|
2912
2913
|
w.map((C) => wt(C, ne))
|
|
2913
|
-
)].sort((C,
|
|
2914
|
+
)].sort((C, k) => C.localeCompare(k)).map((C) => ({
|
|
2914
2915
|
value: C,
|
|
2915
2916
|
label: C
|
|
2916
|
-
})), [w, ne]), Ge = V(() => w.filter((u) => !(Q.length > 0 && !Q.includes(u.application_id) || Ae.length > 0 && !Ae.includes(wt(u, ne)))), [w, ne, Ae, Q]),
|
|
2917
|
+
})), [w, ne]), Ge = V(() => w.filter((u) => !(Q.length > 0 && !Q.includes(u.application_id) || Ae.length > 0 && !Ae.includes(wt(u, ne)))), [w, ne, Ae, Q]), Be = He.length > 1, be = ze.length > 1, at = Be || be;
|
|
2917
2918
|
D(() => {
|
|
2918
2919
|
const u = window.setInterval(() => {
|
|
2919
2920
|
G();
|
|
@@ -2927,47 +2928,47 @@ const cn = (t, e) => (n) => {
|
|
|
2927
2928
|
let u = !1;
|
|
2928
2929
|
return (async () => {
|
|
2929
2930
|
const C = await Promise.allSettled(
|
|
2930
|
-
w.map(async (
|
|
2931
|
-
const X = await q(
|
|
2931
|
+
w.map(async (k) => {
|
|
2932
|
+
const X = await q(k.invocation_id);
|
|
2932
2933
|
return {
|
|
2933
|
-
agentId:
|
|
2934
|
-
invocationId:
|
|
2934
|
+
agentId: k.id,
|
|
2935
|
+
invocationId: k.invocation_id,
|
|
2935
2936
|
checklist: X.checklist
|
|
2936
2937
|
};
|
|
2937
2938
|
})
|
|
2938
2939
|
);
|
|
2939
|
-
u || (
|
|
2940
|
-
const X = { ...
|
|
2940
|
+
u || (Ne((k) => {
|
|
2941
|
+
const X = { ...k };
|
|
2941
2942
|
let le = !1;
|
|
2942
2943
|
for (const ae of C) {
|
|
2943
2944
|
if (ae.status !== "fulfilled")
|
|
2944
2945
|
continue;
|
|
2945
2946
|
const { invocationId: he, checklist: qe } = ae.value;
|
|
2946
|
-
JSON.stringify(
|
|
2947
|
+
JSON.stringify(k[he]) !== JSON.stringify(qe) && (X[he] = qe, le = !0);
|
|
2947
2948
|
}
|
|
2948
|
-
return le ? X :
|
|
2949
|
-
}), _e((
|
|
2950
|
-
const X = { ...
|
|
2949
|
+
return le ? X : k;
|
|
2950
|
+
}), _e((k) => {
|
|
2951
|
+
const X = { ...k };
|
|
2951
2952
|
let le = !1;
|
|
2952
2953
|
return C.forEach((ae, he) => {
|
|
2953
2954
|
ae.status === "rejected" && X[w[he].id] !== Ze && (X[w[he].id] = Ze, le = !0);
|
|
2954
|
-
}), le ? X :
|
|
2955
|
+
}), le ? X : k;
|
|
2955
2956
|
}));
|
|
2956
2957
|
})(), () => {
|
|
2957
2958
|
u = !0;
|
|
2958
2959
|
};
|
|
2959
2960
|
}, [w, q]);
|
|
2960
|
-
const Oe =
|
|
2961
|
+
const Oe = S(
|
|
2961
2962
|
async (u) => {
|
|
2962
2963
|
if (!ge[u.invocation_id]) {
|
|
2963
|
-
|
|
2964
|
-
const
|
|
2965
|
-
return delete
|
|
2964
|
+
ke(u.id), _e((C) => {
|
|
2965
|
+
const k = { ...C };
|
|
2966
|
+
return delete k[u.id], k;
|
|
2966
2967
|
});
|
|
2967
2968
|
try {
|
|
2968
2969
|
const C = await q(u.invocation_id);
|
|
2969
|
-
|
|
2970
|
-
...
|
|
2970
|
+
Ne((k) => ({
|
|
2971
|
+
...k,
|
|
2971
2972
|
[u.invocation_id]: C.checklist
|
|
2972
2973
|
}));
|
|
2973
2974
|
} catch {
|
|
@@ -2976,40 +2977,40 @@ const cn = (t, e) => (n) => {
|
|
|
2976
2977
|
[u.id]: Ze
|
|
2977
2978
|
}));
|
|
2978
2979
|
} finally {
|
|
2979
|
-
|
|
2980
|
+
ke((C) => C === u.id ? null : C);
|
|
2980
2981
|
}
|
|
2981
2982
|
}
|
|
2982
2983
|
},
|
|
2983
2984
|
[q, ge]
|
|
2984
|
-
), st =
|
|
2985
|
+
), st = S(
|
|
2985
2986
|
(u) => {
|
|
2986
2987
|
if (ee === u) {
|
|
2987
2988
|
K(null);
|
|
2988
2989
|
return;
|
|
2989
2990
|
}
|
|
2990
|
-
const C = w.find(({ id:
|
|
2991
|
+
const C = w.find(({ id: k }) => k === u);
|
|
2991
2992
|
C && (K(u), Oe(C));
|
|
2992
2993
|
},
|
|
2993
2994
|
[w, ee, Oe]
|
|
2994
2995
|
), Le = V(() => {
|
|
2995
2996
|
const u = {};
|
|
2996
2997
|
for (const C of Ge) {
|
|
2997
|
-
const
|
|
2998
|
+
const k = ys(
|
|
2998
2999
|
C,
|
|
2999
3000
|
ge[C.invocation_id]
|
|
3000
3001
|
);
|
|
3001
|
-
(u[
|
|
3002
|
+
(u[k] ?? (u[k] = [])).push(C);
|
|
3002
3003
|
}
|
|
3003
3004
|
return u;
|
|
3004
|
-
}, [Ge, ge]), rt =
|
|
3005
|
+
}, [Ge, ge]), rt = S((u) => {
|
|
3005
3006
|
A(u);
|
|
3006
|
-
}, []), Ue =
|
|
3007
|
+
}, []), Ue = S(
|
|
3007
3008
|
async (u) => {
|
|
3008
3009
|
const C = await Y(u);
|
|
3009
3010
|
A(C), $(!1);
|
|
3010
3011
|
},
|
|
3011
3012
|
[Y]
|
|
3012
|
-
), it =
|
|
3013
|
+
), it = S(() => {
|
|
3013
3014
|
A(null);
|
|
3014
3015
|
}, []), Pe = {
|
|
3015
3016
|
expandedAgentId: ee,
|
|
@@ -3036,7 +3037,7 @@ const cn = (t, e) => (n) => {
|
|
|
3036
3037
|
)
|
|
3037
3038
|
] }),
|
|
3038
3039
|
w.length > 0 && at && /* @__PURE__ */ l("div", { className: "agent-view__filters", children: [
|
|
3039
|
-
|
|
3040
|
+
Be && /* @__PURE__ */ l("div", { className: "agent-view__filter", children: [
|
|
3040
3041
|
/* @__PURE__ */ a(
|
|
3041
3042
|
"label",
|
|
3042
3043
|
{
|
|
@@ -3062,7 +3063,7 @@ const cn = (t, e) => (n) => {
|
|
|
3062
3063
|
}
|
|
3063
3064
|
)
|
|
3064
3065
|
] }),
|
|
3065
|
-
|
|
3066
|
+
be && /* @__PURE__ */ l("div", { className: "agent-view__filter", children: [
|
|
3066
3067
|
/* @__PURE__ */ a("label", { className: "agent-view__filter-label", htmlFor: "agent-view-agent-filter", children: "Agent" }),
|
|
3067
3068
|
/* @__PURE__ */ a(
|
|
3068
3069
|
Pt,
|
|
@@ -3084,7 +3085,7 @@ const cn = (t, e) => (n) => {
|
|
|
3084
3085
|
] }),
|
|
3085
3086
|
z === "error" ? /* @__PURE__ */ l("div", { className: "agent-view__state agent-view__state--error", role: "alert", children: [
|
|
3086
3087
|
/* @__PURE__ */ a(L, { name: "triangle-alert", size: 24, color: "var(--color-semantic-destructive-600)" }),
|
|
3087
|
-
/* @__PURE__ */ a("p", { className: "agent-view__state-message", children: Te ??
|
|
3088
|
+
/* @__PURE__ */ a("p", { className: "agent-view__state-message", children: Te ?? nn }),
|
|
3088
3089
|
/* @__PURE__ */ a(ie, { variant: "secondary", size: "S", onClick: O, children: "Try again" })
|
|
3089
3090
|
] }) : z === "loading" && w.length === 0 ? /* @__PURE__ */ l("div", { className: "agent-view__state", "aria-live": "polite", children: [
|
|
3090
3091
|
/* @__PURE__ */ a(
|
|
@@ -3098,9 +3099,9 @@ const cn = (t, e) => (n) => {
|
|
|
3098
3099
|
}
|
|
3099
3100
|
),
|
|
3100
3101
|
/* @__PURE__ */ a("p", { className: "agent-view__state-message", children: Dt })
|
|
3101
|
-
] }) : w.length === 0 ? /* @__PURE__ */ a(
|
|
3102
|
-
|
|
3103
|
-
|
|
3102
|
+
] }) : w.length === 0 ? /* @__PURE__ */ a(Qn, {}) : /* @__PURE__ */ l("div", { className: "agent-view__board", children: [
|
|
3103
|
+
Mn.map((u) => /* @__PURE__ */ a(
|
|
3104
|
+
Yt,
|
|
3104
3105
|
{
|
|
3105
3106
|
column: Qe[u],
|
|
3106
3107
|
agents: Le[u] ?? [],
|
|
@@ -3108,8 +3109,8 @@ const cn = (t, e) => (n) => {
|
|
|
3108
3109
|
},
|
|
3109
3110
|
u
|
|
3110
3111
|
)),
|
|
3111
|
-
/* @__PURE__ */ a("div", { className: "agent-view__split-column", children:
|
|
3112
|
-
|
|
3112
|
+
/* @__PURE__ */ a("div", { className: "agent-view__split-column", children: Hn.map((u) => /* @__PURE__ */ a(
|
|
3113
|
+
Yt,
|
|
3113
3114
|
{
|
|
3114
3115
|
column: Qe[u],
|
|
3115
3116
|
agents: Le[u] ?? [],
|
|
@@ -3120,13 +3121,13 @@ const cn = (t, e) => (n) => {
|
|
|
3120
3121
|
)) })
|
|
3121
3122
|
] }),
|
|
3122
3123
|
U && /* @__PURE__ */ a(
|
|
3123
|
-
|
|
3124
|
+
us,
|
|
3124
3125
|
{
|
|
3125
3126
|
agent: U,
|
|
3126
3127
|
invocationId: U.invocation_id,
|
|
3127
3128
|
open: !0,
|
|
3128
|
-
jwt:
|
|
3129
|
-
headers:
|
|
3129
|
+
jwt: e,
|
|
3130
|
+
headers: b,
|
|
3130
3131
|
agentUrl: r,
|
|
3131
3132
|
agentChecklistUrl: o,
|
|
3132
3133
|
agentResourcesUrl: i,
|
|
@@ -3134,9 +3135,9 @@ const cn = (t, e) => (n) => {
|
|
|
3134
3135
|
agentChatUrl: d,
|
|
3135
3136
|
agentConversationUrl: h,
|
|
3136
3137
|
stopAgentUrl: m,
|
|
3137
|
-
enableUpload:
|
|
3138
|
+
enableUpload: N,
|
|
3138
3139
|
initialChecklist: ge[U.invocation_id] ?? null,
|
|
3139
|
-
usePusherToRepoll:
|
|
3140
|
+
usePusherToRepoll: F,
|
|
3140
3141
|
pusherChannelPrefix: _,
|
|
3141
3142
|
subscribeToPusher: x,
|
|
3142
3143
|
onClose: it
|
|
@@ -3144,7 +3145,7 @@ const cn = (t, e) => (n) => {
|
|
|
3144
3145
|
U.id
|
|
3145
3146
|
),
|
|
3146
3147
|
/* @__PURE__ */ a(
|
|
3147
|
-
|
|
3148
|
+
vs,
|
|
3148
3149
|
{
|
|
3149
3150
|
open: Z,
|
|
3150
3151
|
onClose: () => $(!1),
|
|
@@ -3153,51 +3154,51 @@ const cn = (t, e) => (n) => {
|
|
|
3153
3154
|
}
|
|
3154
3155
|
)
|
|
3155
3156
|
] });
|
|
3156
|
-
},
|
|
3157
|
-
const n = Date.now(), s =
|
|
3157
|
+
}, Ls = (e, t) => {
|
|
3158
|
+
const n = Date.now(), s = t.trim() || e.agent_intent;
|
|
3158
3159
|
return {
|
|
3159
3160
|
id: `agent-${n}`,
|
|
3160
3161
|
invocation_id: `inv-${n}`,
|
|
3161
|
-
agent_definition_ref:
|
|
3162
|
-
agent_intent:
|
|
3162
|
+
agent_definition_ref: e.ref,
|
|
3163
|
+
agent_intent: e.agent_intent,
|
|
3163
3164
|
invocation_name: s,
|
|
3164
|
-
application_id:
|
|
3165
|
-
created_by:
|
|
3165
|
+
application_id: zn,
|
|
3166
|
+
created_by: Gn,
|
|
3166
3167
|
status: T["generating-a-response"],
|
|
3167
3168
|
context_ref: null,
|
|
3168
3169
|
checklist_ref: null
|
|
3169
3170
|
};
|
|
3170
3171
|
};
|
|
3171
3172
|
export {
|
|
3172
|
-
|
|
3173
|
+
Os as AgentMonitorKanban,
|
|
3173
3174
|
yt as AgentServiceClient,
|
|
3174
3175
|
De as AgentServiceError,
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3176
|
+
us as AgentView,
|
|
3177
|
+
on as DEFAULT_PUSHER_CHANNEL_PREFIX,
|
|
3178
|
+
as as HttpChatConnector,
|
|
3179
|
+
Bt as MESSAGE_TYPE_REPOLL,
|
|
3180
|
+
vs as NewAgentModal,
|
|
3181
|
+
Ea as PUSHER_AGENT_MESSAGE_EVENT,
|
|
3181
3182
|
we as REPOLL_TARGET,
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3183
|
+
Ls as buildAgentFromDefinition,
|
|
3184
|
+
Ra as buildAgentPusherChannel,
|
|
3185
|
+
gn as createHttpChatConnectorFactory,
|
|
3186
|
+
Is as formatUserFileChatCardText,
|
|
3187
|
+
Ft as mapApiAgent,
|
|
3188
|
+
ln as mapApiAgentDefinition,
|
|
3189
|
+
Ma as mapApiAgentStatus,
|
|
3190
|
+
qa as mapApiAgentTimelineResponse,
|
|
3191
|
+
dn as mapApiChecklistEndpointResponse,
|
|
3192
|
+
cn as mapApiChecklistItem,
|
|
3193
|
+
Ja as mapApiChecklistResponse,
|
|
3194
|
+
Ha as mapApiChecklistStatus,
|
|
3195
|
+
Wa as mapApiConversationMessages,
|
|
3195
3196
|
nt as mapApiOpeningMessage,
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3197
|
+
Ba as mapApiResource,
|
|
3198
|
+
Fa as mapApiResourcesEndpointResponse,
|
|
3199
|
+
Ts as mapApiTripOption,
|
|
3200
|
+
Rs as parseConversationContentCaption,
|
|
3201
|
+
La as parseRepollMessages,
|
|
3202
|
+
is as useAgentService,
|
|
3203
|
+
ls as useAgentWorkspace
|
|
3203
3204
|
};
|