@arbor-education/agent-view-frontend 0.3.1 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -26
- package/dist/index.cjs +4 -4
- package/dist/index.d.ts +59 -17
- package/dist/index.js +1081 -1009
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { jsxs as i, jsx as n, Fragment as
|
|
2
|
-
import { useMemo as U,
|
|
3
|
-
import
|
|
4
|
-
import { Heading as he, Icon as E, Dot as
|
|
5
|
-
import { CHAT_RESPONSE_TYPE_AGENT as
|
|
1
|
+
import { jsxs as i, jsx as n, Fragment as et } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as U, useLayoutEffect as Ge, useState as m, useEffect as G, useCallback as T, useRef as Re } from "react";
|
|
3
|
+
import H from "classnames";
|
|
4
|
+
import { Heading as he, Icon as E, Dot as Be, Button as J, Modal as W, SelectDropdown as tt, TextInput as nt, Combobox as Oe, Card as at } from "@arbor-education/design-system.components";
|
|
5
|
+
import { CHAT_RESPONSE_TYPE_AGENT as ze, CHAT_RESPONSE_TYPE_ERROR as st, ChatPanel as rt, CHAT_RESPONSE_TYPE_USER as ot, CHAT_RESPONSE_TYPE_INFO as it } from "@arbor-education/ask-arbor-chat-panel";
|
|
6
6
|
const v = {
|
|
7
7
|
"generating-a-response": "generating-a-response",
|
|
8
8
|
hitl: "hitl",
|
|
9
9
|
complete: "complete",
|
|
10
10
|
failed: "failed"
|
|
11
|
-
},
|
|
11
|
+
}, S = {
|
|
12
12
|
"generating-a-response": "generating-a-response",
|
|
13
13
|
hitl: "hitl",
|
|
14
14
|
complete: "complete",
|
|
15
15
|
failed: "failed"
|
|
16
|
-
},
|
|
16
|
+
}, b = {
|
|
17
17
|
briefing: "briefing",
|
|
18
18
|
running: "running",
|
|
19
19
|
stopped: "stopped",
|
|
20
20
|
complete: "complete"
|
|
21
|
-
},
|
|
21
|
+
}, j = {
|
|
22
22
|
agent: "agent",
|
|
23
23
|
user: "user",
|
|
24
24
|
system: "system"
|
|
@@ -30,39 +30,39 @@ const v = {
|
|
|
30
30
|
}, xe = {
|
|
31
31
|
cancelled: "cancelled",
|
|
32
32
|
archived: "archived"
|
|
33
|
-
},
|
|
33
|
+
}, Te = {
|
|
34
34
|
in_progress: "in_progress",
|
|
35
35
|
requires_attention: "requires_attention",
|
|
36
36
|
available: "available"
|
|
37
|
-
},
|
|
38
|
-
[
|
|
37
|
+
}, F = {
|
|
38
|
+
[S.complete]: {
|
|
39
39
|
label: "Complete",
|
|
40
40
|
icon: "circle-check",
|
|
41
41
|
color: "var(--color-semantic-success-600)"
|
|
42
42
|
},
|
|
43
|
-
[
|
|
43
|
+
[S.failed]: {
|
|
44
44
|
label: "Failed",
|
|
45
45
|
icon: "circle-x",
|
|
46
46
|
color: "var(--color-semantic-destructive-600)"
|
|
47
47
|
},
|
|
48
|
-
[
|
|
48
|
+
[S.hitl]: {
|
|
49
49
|
label: "Requires attention",
|
|
50
50
|
icon: "triangle-alert",
|
|
51
51
|
color: "var(--color-semantic-warning-600)"
|
|
52
52
|
},
|
|
53
|
-
[
|
|
53
|
+
[S["generating-a-response"]]: {
|
|
54
54
|
label: "Generating a response",
|
|
55
55
|
icon: "loader",
|
|
56
56
|
color: "var(--color-brand-600)"
|
|
57
57
|
}
|
|
58
|
-
},
|
|
58
|
+
}, ve = {
|
|
59
59
|
[v["generating-a-response"]]: {
|
|
60
60
|
status: v["generating-a-response"],
|
|
61
61
|
title: "Active",
|
|
62
62
|
dotColour: "green",
|
|
63
63
|
statusIcon: {
|
|
64
|
-
name:
|
|
65
|
-
color:
|
|
64
|
+
name: F["generating-a-response"].icon,
|
|
65
|
+
color: F["generating-a-response"].color,
|
|
66
66
|
spin: !0
|
|
67
67
|
}
|
|
68
68
|
},
|
|
@@ -71,8 +71,8 @@ const v = {
|
|
|
71
71
|
title: "Requires attention",
|
|
72
72
|
dotColour: "orange",
|
|
73
73
|
statusIcon: {
|
|
74
|
-
name:
|
|
75
|
-
color:
|
|
74
|
+
name: F.hitl.icon,
|
|
75
|
+
color: F.hitl.color
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
78
|
[v.complete]: {
|
|
@@ -81,8 +81,8 @@ const v = {
|
|
|
81
81
|
dotColour: "green",
|
|
82
82
|
dotModifier: "grey-dark",
|
|
83
83
|
statusIcon: {
|
|
84
|
-
name:
|
|
85
|
-
color:
|
|
84
|
+
name: F.complete.icon,
|
|
85
|
+
color: F.complete.color
|
|
86
86
|
}
|
|
87
87
|
},
|
|
88
88
|
[v.failed]: {
|
|
@@ -90,32 +90,32 @@ const v = {
|
|
|
90
90
|
title: "Failed",
|
|
91
91
|
dotColour: "salmon",
|
|
92
92
|
statusIcon: {
|
|
93
|
-
name:
|
|
94
|
-
color:
|
|
93
|
+
name: F.failed.icon,
|
|
94
|
+
color: F.failed.color
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
},
|
|
97
|
+
}, ct = [
|
|
98
98
|
v["generating-a-response"],
|
|
99
99
|
v.hitl
|
|
100
|
-
],
|
|
100
|
+
], lt = [
|
|
101
101
|
v.complete,
|
|
102
102
|
v.failed
|
|
103
|
-
],
|
|
104
|
-
[
|
|
105
|
-
[
|
|
106
|
-
[
|
|
107
|
-
[
|
|
108
|
-
},
|
|
103
|
+
], dt = "m4", gt = "1", Ke = "msg-opening", Ee = "Unable to load agent tasks. Please try again.", pt = "Unable to load the resources for this agent", ut = "Something went wrong. Please try again.", qe = "Unable to load agents. Please try again.", oe = "Loading tasks…", Pe = "Loading agents…", ht = "Task", _t = "What recent actions have you taken?", mt = {
|
|
104
|
+
[b.briefing]: "Briefing",
|
|
105
|
+
[b.running]: "Working",
|
|
106
|
+
[b.stopped]: "Stopped",
|
|
107
|
+
[b.complete]: "Complete"
|
|
108
|
+
}, ft = [
|
|
109
109
|
v["generating-a-response"],
|
|
110
110
|
v.hitl,
|
|
111
111
|
v.complete,
|
|
112
112
|
v.failed
|
|
113
|
-
],
|
|
113
|
+
], vt = {
|
|
114
114
|
[v["generating-a-response"]]: "Agents currently working on tasks for you.",
|
|
115
115
|
[v.hitl]: "Agents that need your input before they can continue.",
|
|
116
116
|
[v.complete]: "Agents that have finished their work.",
|
|
117
117
|
[v.failed]: "Agents that failed or were stopped."
|
|
118
|
-
},
|
|
118
|
+
}, wt = () => /* @__PURE__ */ i(
|
|
119
119
|
"svg",
|
|
120
120
|
{
|
|
121
121
|
className: "agent-view__empty-illustration",
|
|
@@ -231,8 +231,8 @@ const v = {
|
|
|
231
231
|
/* @__PURE__ */ n("circle", { cx: "256", cy: "160", r: "4", fill: "var(--color-semantic-destructive-500)" })
|
|
232
232
|
]
|
|
233
233
|
}
|
|
234
|
-
),
|
|
235
|
-
const t =
|
|
234
|
+
), kt = ({ status: e }) => {
|
|
235
|
+
const t = ve[e];
|
|
236
236
|
return t.statusIcon ? /* @__PURE__ */ n(
|
|
237
237
|
E,
|
|
238
238
|
{
|
|
@@ -241,8 +241,8 @@ const v = {
|
|
|
241
241
|
color: t.statusIcon.color,
|
|
242
242
|
screenReaderText: t.title
|
|
243
243
|
}
|
|
244
|
-
) : /* @__PURE__ */ n(
|
|
245
|
-
},
|
|
244
|
+
) : /* @__PURE__ */ n(Be, { colour: t.dotColour, label: t.title });
|
|
245
|
+
}, yt = () => /* @__PURE__ */ i(
|
|
246
246
|
"section",
|
|
247
247
|
{
|
|
248
248
|
className: "agent-view__empty",
|
|
@@ -251,13 +251,13 @@ const v = {
|
|
|
251
251
|
/* @__PURE__ */ i("div", { className: "agent-view__empty-content", children: [
|
|
252
252
|
/* @__PURE__ */ n(he, { level: 4, children: "Your agents board" }),
|
|
253
253
|
/* @__PURE__ */ n("p", { className: "agent-view__empty-lead", children: "When you start an agent, it appears here so you can track progress at a glance. Agents move between columns as their status changes." }),
|
|
254
|
-
/* @__PURE__ */ n("ul", { className: "agent-view__empty-columns", children:
|
|
255
|
-
const t =
|
|
254
|
+
/* @__PURE__ */ n("ul", { className: "agent-view__empty-columns", children: ft.map((e) => {
|
|
255
|
+
const t = ve[e];
|
|
256
256
|
return /* @__PURE__ */ i("li", { className: "agent-view__empty-column", children: [
|
|
257
|
-
/* @__PURE__ */ n("span", { className: "agent-view__empty-column-indicator", children: /* @__PURE__ */ n(
|
|
257
|
+
/* @__PURE__ */ n("span", { className: "agent-view__empty-column-indicator", children: /* @__PURE__ */ n(kt, { status: e }) }),
|
|
258
258
|
/* @__PURE__ */ i("span", { className: "agent-view__empty-column-text", children: [
|
|
259
259
|
/* @__PURE__ */ n("span", { className: "agent-view__empty-column-title", children: t.title }),
|
|
260
|
-
/* @__PURE__ */ n("span", { className: "agent-view__empty-column-description", children:
|
|
260
|
+
/* @__PURE__ */ n("span", { className: "agent-view__empty-column-description", children: vt[e] })
|
|
261
261
|
] })
|
|
262
262
|
] }, e);
|
|
263
263
|
}) }),
|
|
@@ -267,39 +267,39 @@ const v = {
|
|
|
267
267
|
" above to begin."
|
|
268
268
|
] })
|
|
269
269
|
] }),
|
|
270
|
-
/* @__PURE__ */ n("div", { className: "agent-view__empty-visual", children: /* @__PURE__ */ n(
|
|
270
|
+
/* @__PURE__ */ n("div", { className: "agent-view__empty-visual", children: /* @__PURE__ */ n(wt, {}) })
|
|
271
271
|
]
|
|
272
272
|
}
|
|
273
273
|
), Nt = (e, t) => ({
|
|
274
274
|
...e,
|
|
275
275
|
...t.length > 0 ? { children: t } : {}
|
|
276
|
-
}),
|
|
277
|
-
const t = [],
|
|
278
|
-
for (const
|
|
279
|
-
const r =
|
|
280
|
-
if (t.push(...r.needsInput),
|
|
281
|
-
t.push({ ...
|
|
276
|
+
}), We = (e) => {
|
|
277
|
+
const t = [], a = [];
|
|
278
|
+
for (const s of e) {
|
|
279
|
+
const r = s.children ? We(s.children) : { needsInput: [], tasks: [] };
|
|
280
|
+
if (t.push(...r.needsInput), s.status === S.hitl) {
|
|
281
|
+
t.push({ ...s, children: void 0 });
|
|
282
282
|
continue;
|
|
283
283
|
}
|
|
284
|
-
|
|
284
|
+
a.push(Nt(s, r.tasks));
|
|
285
285
|
}
|
|
286
|
-
return { needsInput: t, tasks:
|
|
287
|
-
},
|
|
288
|
-
const
|
|
289
|
-
return
|
|
290
|
-
}).map(({ item: t }) => t),
|
|
286
|
+
return { needsInput: t, tasks: a };
|
|
287
|
+
}, At = (e) => e.map((t, a) => ({ item: t, index: a })).sort((t, a) => {
|
|
288
|
+
const s = t.item.status === S.hitl, r = a.item.status === S.hitl;
|
|
289
|
+
return s !== r ? s ? -1 : 1 : t.index - a.index;
|
|
290
|
+
}).map(({ item: t }) => t), St = ({
|
|
291
291
|
checklist: e
|
|
292
292
|
}) => e.length === 0 ? /* @__PURE__ */ n("p", { className: "agent-view__progress-empty", children: "No tasks to display." }) : /* @__PURE__ */ n(
|
|
293
293
|
"ul",
|
|
294
294
|
{
|
|
295
295
|
className: "agent-view__progress-list",
|
|
296
296
|
"aria-label": "Agent tasks",
|
|
297
|
-
children:
|
|
298
|
-
const
|
|
297
|
+
children: At(e).map((t) => {
|
|
298
|
+
const a = F[t.status];
|
|
299
299
|
return /* @__PURE__ */ i(
|
|
300
300
|
"li",
|
|
301
301
|
{
|
|
302
|
-
className:
|
|
302
|
+
className: H(
|
|
303
303
|
"agent-view__progress-item",
|
|
304
304
|
`agent-view__progress-item--${t.status.replace(/_/g, "-")}`
|
|
305
305
|
),
|
|
@@ -307,18 +307,18 @@ const v = {
|
|
|
307
307
|
/* @__PURE__ */ n(
|
|
308
308
|
E,
|
|
309
309
|
{
|
|
310
|
-
name:
|
|
310
|
+
name: a.icon,
|
|
311
311
|
size: 16,
|
|
312
|
-
color:
|
|
313
|
-
screenReaderText: `${
|
|
314
|
-
className:
|
|
315
|
-
"agent-view__progress-icon--spinning": t.status ===
|
|
312
|
+
color: a.color,
|
|
313
|
+
screenReaderText: `${a.label}:`,
|
|
314
|
+
className: H({
|
|
315
|
+
"agent-view__progress-icon--spinning": t.status === S["generating-a-response"]
|
|
316
316
|
})
|
|
317
317
|
}
|
|
318
318
|
),
|
|
319
319
|
/* @__PURE__ */ i("div", { className: "agent-view__progress-item-content", children: [
|
|
320
320
|
/* @__PURE__ */ n("span", { className: "agent-view__progress-label", children: t.task }),
|
|
321
|
-
t.status !==
|
|
321
|
+
t.status !== S.complete && /* @__PURE__ */ n(
|
|
322
322
|
"span",
|
|
323
323
|
{
|
|
324
324
|
className: "agent-view__progress-description",
|
|
@@ -332,23 +332,23 @@ const v = {
|
|
|
332
332
|
);
|
|
333
333
|
})
|
|
334
334
|
}
|
|
335
|
-
),
|
|
335
|
+
), bt = ({
|
|
336
336
|
prompts: e,
|
|
337
337
|
classNamePrefix: t = "agent-workspace",
|
|
338
|
-
onSelect:
|
|
339
|
-
}) => e.length === 0 ? null : /* @__PURE__ */ n("div", { className: `${t}__chips`, children: e.map((
|
|
338
|
+
onSelect: a
|
|
339
|
+
}) => e.length === 0 ? null : /* @__PURE__ */ n("div", { className: `${t}__chips`, children: e.map((s) => /* @__PURE__ */ n(
|
|
340
340
|
"button",
|
|
341
341
|
{
|
|
342
342
|
type: "button",
|
|
343
343
|
className: `${t}__chip`,
|
|
344
|
-
onClick: () => s
|
|
345
|
-
children:
|
|
344
|
+
onClick: () => a(s),
|
|
345
|
+
children: s
|
|
346
346
|
},
|
|
347
|
-
|
|
347
|
+
s
|
|
348
348
|
)) });
|
|
349
|
-
class
|
|
350
|
-
constructor(t,
|
|
351
|
-
this.connector = t, this.canSend =
|
|
349
|
+
class Ct {
|
|
350
|
+
constructor(t, a) {
|
|
351
|
+
this.connector = t, this.canSend = a.canSend, this.onTurn = a.onTurn, this.onAwaitingChange = a.onAwaitingChange;
|
|
352
352
|
}
|
|
353
353
|
get canRate() {
|
|
354
354
|
return !1;
|
|
@@ -366,26 +366,29 @@ class bt {
|
|
|
366
366
|
return {};
|
|
367
367
|
}
|
|
368
368
|
async sendMessage(t) {
|
|
369
|
-
var
|
|
369
|
+
var a, s;
|
|
370
370
|
if (!this.canSend())
|
|
371
371
|
return null;
|
|
372
|
-
(
|
|
372
|
+
(a = this.onAwaitingChange) == null || a.call(this, !0);
|
|
373
373
|
try {
|
|
374
|
-
const r = await this.connector.sendMessage(
|
|
374
|
+
const r = await this.connector.sendMessage(
|
|
375
|
+
t.userMessage,
|
|
376
|
+
t.uploadFiles
|
|
377
|
+
);
|
|
375
378
|
return this.onTurn(r), {
|
|
376
379
|
id: r.message.id,
|
|
377
380
|
text: r.message.text,
|
|
378
|
-
type:
|
|
381
|
+
type: ze,
|
|
379
382
|
...r.message.followUpPrompts ? { followUpPrompts: r.message.followUpPrompts } : {}
|
|
380
383
|
};
|
|
381
384
|
} catch {
|
|
382
385
|
return {
|
|
383
386
|
id: `error-${Date.now()}`,
|
|
384
|
-
text:
|
|
385
|
-
type:
|
|
387
|
+
text: ut,
|
|
388
|
+
type: st
|
|
386
389
|
};
|
|
387
390
|
} finally {
|
|
388
|
-
(
|
|
391
|
+
(s = this.onAwaitingChange) == null || s.call(this, !1);
|
|
389
392
|
}
|
|
390
393
|
}
|
|
391
394
|
async loadHistory(t) {
|
|
@@ -400,40 +403,41 @@ class bt {
|
|
|
400
403
|
return !1;
|
|
401
404
|
}
|
|
402
405
|
}
|
|
403
|
-
const
|
|
406
|
+
const Tt = ({
|
|
404
407
|
connector: e,
|
|
405
408
|
phase: t,
|
|
406
|
-
chatHistory:
|
|
407
|
-
chatSessionKey:
|
|
409
|
+
chatHistory: a,
|
|
410
|
+
chatSessionKey: s,
|
|
408
411
|
startQuery: r,
|
|
409
|
-
clarificationMessage:
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
412
|
+
clarificationMessage: c,
|
|
413
|
+
enableUpload: l = !1,
|
|
414
|
+
onTurn: d,
|
|
415
|
+
onAwaitingChange: w,
|
|
416
|
+
onClarificationPrompt: f,
|
|
417
|
+
onDismissClarification: p
|
|
414
418
|
}) => {
|
|
415
|
-
const
|
|
416
|
-
() => new
|
|
417
|
-
canSend: () => t ===
|
|
418
|
-
onTurn:
|
|
419
|
-
onAwaitingChange:
|
|
419
|
+
const _ = U(
|
|
420
|
+
() => new Ct(e, {
|
|
421
|
+
canSend: () => t === b.running,
|
|
422
|
+
onTurn: d,
|
|
423
|
+
onAwaitingChange: w
|
|
420
424
|
}),
|
|
421
|
-
[e, t,
|
|
422
|
-
),
|
|
425
|
+
[e, t, d, w]
|
|
426
|
+
), u = t !== b.running, C = t === b.running;
|
|
423
427
|
return /* @__PURE__ */ i("section", { className: "agent-workspace__panel agent-workspace__panel--chat", "aria-label": "Chat", children: [
|
|
424
|
-
|
|
428
|
+
c && /* @__PURE__ */ i(
|
|
425
429
|
"div",
|
|
426
430
|
{
|
|
427
431
|
className: "agent-workspace__clarification",
|
|
428
432
|
role: "region",
|
|
429
433
|
"aria-label": "Agent question",
|
|
430
434
|
children: [
|
|
431
|
-
/* @__PURE__ */ n("p", { className: "agent-workspace__clarification-text", children:
|
|
432
|
-
|
|
433
|
-
|
|
435
|
+
/* @__PURE__ */ n("p", { className: "agent-workspace__clarification-text", children: c.text }),
|
|
436
|
+
c.followUpPrompts && /* @__PURE__ */ n(
|
|
437
|
+
bt,
|
|
434
438
|
{
|
|
435
|
-
prompts:
|
|
436
|
-
onSelect:
|
|
439
|
+
prompts: c.followUpPrompts,
|
|
440
|
+
onSelect: f
|
|
437
441
|
}
|
|
438
442
|
),
|
|
439
443
|
/* @__PURE__ */ n(
|
|
@@ -441,7 +445,7 @@ const Ct = ({
|
|
|
441
445
|
{
|
|
442
446
|
type: "button",
|
|
443
447
|
className: "agent-workspace__clarification-dismiss",
|
|
444
|
-
onClick:
|
|
448
|
+
onClick: p,
|
|
445
449
|
children: "Dismiss"
|
|
446
450
|
}
|
|
447
451
|
)
|
|
@@ -449,40 +453,40 @@ const Ct = ({
|
|
|
449
453
|
}
|
|
450
454
|
),
|
|
451
455
|
/* @__PURE__ */ n("div", { className: "agent-workspace__ask-arbor", children: /* @__PURE__ */ n(
|
|
452
|
-
|
|
456
|
+
rt,
|
|
453
457
|
{
|
|
454
|
-
connector:
|
|
455
|
-
chatHistory:
|
|
458
|
+
connector: _,
|
|
459
|
+
chatHistory: a,
|
|
456
460
|
startQuery: r,
|
|
457
|
-
lockConversation:
|
|
458
|
-
enableUpload:
|
|
459
|
-
speechEnabled:
|
|
461
|
+
lockConversation: u,
|
|
462
|
+
enableUpload: l,
|
|
463
|
+
speechEnabled: C,
|
|
460
464
|
speechLanguage: "en-GB",
|
|
461
465
|
speechSubmissionDelay: 1e3,
|
|
462
466
|
slashMenuItems: [],
|
|
463
467
|
menuContent: [],
|
|
464
468
|
introHeading: "Message your agent",
|
|
465
469
|
introBody: "Ask questions, share trip details, or paste a link. The agent will update the checklist as it works.",
|
|
466
|
-
placeholder:
|
|
470
|
+
placeholder: C ? "Message the agent, paste a link, or attach a file…" : "The agent is not accepting messages."
|
|
467
471
|
},
|
|
468
|
-
|
|
472
|
+
s
|
|
469
473
|
) }),
|
|
470
|
-
t ===
|
|
474
|
+
t === b.stopped && /* @__PURE__ */ i("div", { className: "agent-workspace__notice", role: "status", children: [
|
|
471
475
|
/* @__PURE__ */ n(E, { name: "circle-alert", size: 16, color: "var(--color-semantic-warning-600)" }),
|
|
472
476
|
/* @__PURE__ */ n("span", { children: "You stopped the agent. Its progress is saved in the checklist on the left." })
|
|
473
477
|
] }),
|
|
474
|
-
t ===
|
|
478
|
+
t === b.complete && /* @__PURE__ */ i("div", { className: "agent-workspace__notice", role: "status", children: [
|
|
475
479
|
/* @__PURE__ */ n(E, { name: "party-popper", size: 16, color: "var(--color-semantic-success-600)" }),
|
|
476
480
|
/* @__PURE__ */ n("span", { children: "The agent has finished." })
|
|
477
481
|
] })
|
|
478
482
|
] });
|
|
479
|
-
},
|
|
483
|
+
}, Je = ({
|
|
480
484
|
item: e,
|
|
481
485
|
depth: t,
|
|
482
|
-
canRequestInput:
|
|
483
|
-
onAttentionItemClick:
|
|
486
|
+
canRequestInput: a,
|
|
487
|
+
onAttentionItemClick: s
|
|
484
488
|
}) => {
|
|
485
|
-
const r =
|
|
489
|
+
const r = F[e.status], c = e.status.replace(/_/g, "-"), l = e.status === S.hitl && a && s, d = /* @__PURE__ */ i("div", { className: "agent-workspace__task-row", children: [
|
|
486
490
|
/* @__PURE__ */ n(
|
|
487
491
|
E,
|
|
488
492
|
{
|
|
@@ -490,40 +494,40 @@ const Ct = ({
|
|
|
490
494
|
size: 16,
|
|
491
495
|
color: r.color,
|
|
492
496
|
screenReaderText: `${r.label}:`,
|
|
493
|
-
className:
|
|
494
|
-
"agent-workspace__task-icon--spinning": e.status ===
|
|
497
|
+
className: H({
|
|
498
|
+
"agent-workspace__task-icon--spinning": e.status === S["generating-a-response"]
|
|
495
499
|
})
|
|
496
500
|
}
|
|
497
501
|
),
|
|
498
502
|
/* @__PURE__ */ i("div", { className: "agent-workspace__task-content", children: [
|
|
499
503
|
/* @__PURE__ */ n("span", { className: "agent-workspace__task-label", children: e.task }),
|
|
500
|
-
e.status !==
|
|
504
|
+
e.status !== S.complete && e.description && /* @__PURE__ */ n("span", { className: "agent-workspace__task-description", children: e.description })
|
|
501
505
|
] })
|
|
502
506
|
] });
|
|
503
507
|
return /* @__PURE__ */ i(
|
|
504
508
|
"li",
|
|
505
509
|
{
|
|
506
|
-
className:
|
|
510
|
+
className: H("agent-workspace__task", `agent-workspace__task--${c}`, {
|
|
507
511
|
"agent-workspace__task--child": t > 0
|
|
508
512
|
}),
|
|
509
513
|
children: [
|
|
510
|
-
|
|
514
|
+
l ? /* @__PURE__ */ n(
|
|
511
515
|
"button",
|
|
512
516
|
{
|
|
513
517
|
type: "button",
|
|
514
518
|
className: "agent-workspace__task-button",
|
|
515
519
|
"aria-label": `Provide input for ${e.task}`,
|
|
516
|
-
onClick: () =>
|
|
520
|
+
onClick: () => s(e),
|
|
517
521
|
children: d
|
|
518
522
|
}
|
|
519
523
|
) : d,
|
|
520
524
|
e.children && e.children.length > 0 && /* @__PURE__ */ n("ul", { className: "agent-workspace__task-children", children: e.children.map((w) => /* @__PURE__ */ n(
|
|
521
|
-
|
|
525
|
+
Je,
|
|
522
526
|
{
|
|
523
527
|
item: w,
|
|
524
528
|
depth: t + 1,
|
|
525
|
-
canRequestInput:
|
|
526
|
-
onAttentionItemClick:
|
|
529
|
+
canRequestInput: a,
|
|
530
|
+
onAttentionItemClick: s
|
|
527
531
|
},
|
|
528
532
|
w.task
|
|
529
533
|
)) })
|
|
@@ -533,28 +537,28 @@ const Ct = ({
|
|
|
533
537
|
}, Le = ({
|
|
534
538
|
items: e,
|
|
535
539
|
ariaLabel: t,
|
|
536
|
-
canRequestInput:
|
|
537
|
-
onAttentionItemClick:
|
|
540
|
+
canRequestInput: a,
|
|
541
|
+
onAttentionItemClick: s
|
|
538
542
|
}) => /* @__PURE__ */ n("ul", { className: "agent-workspace__task-list", "aria-label": t, children: e.map((r) => /* @__PURE__ */ n(
|
|
539
|
-
|
|
543
|
+
Je,
|
|
540
544
|
{
|
|
541
545
|
item: r,
|
|
542
546
|
depth: 0,
|
|
543
|
-
canRequestInput:
|
|
544
|
-
onAttentionItemClick:
|
|
547
|
+
canRequestInput: a,
|
|
548
|
+
onAttentionItemClick: s
|
|
545
549
|
},
|
|
546
550
|
r.task
|
|
547
|
-
)) }),
|
|
551
|
+
)) }), Et = ({
|
|
548
552
|
checklist: e,
|
|
549
553
|
isLoading: t,
|
|
550
|
-
error:
|
|
551
|
-
phase:
|
|
554
|
+
error: a,
|
|
555
|
+
phase: s,
|
|
552
556
|
canRequestInput: r,
|
|
553
|
-
onStop:
|
|
554
|
-
onAttentionItemClick:
|
|
557
|
+
onStop: c,
|
|
558
|
+
onAttentionItemClick: l
|
|
555
559
|
}) => {
|
|
556
560
|
const d = U(
|
|
557
|
-
() => e ?
|
|
561
|
+
() => e ? We(e) : null,
|
|
558
562
|
[e]
|
|
559
563
|
);
|
|
560
564
|
return /* @__PURE__ */ i(
|
|
@@ -565,14 +569,14 @@ const Ct = ({
|
|
|
565
569
|
children: [
|
|
566
570
|
/* @__PURE__ */ i("div", { className: "agent-workspace__panel-header", children: [
|
|
567
571
|
/* @__PURE__ */ n(he, { level: 4, children: "Checklist" }),
|
|
568
|
-
|
|
569
|
-
|
|
572
|
+
s === b.running && /* @__PURE__ */ n(
|
|
573
|
+
J,
|
|
570
574
|
{
|
|
571
575
|
variant: "secondary-destructive",
|
|
572
576
|
size: "S",
|
|
573
577
|
iconLeftName: "circle-x",
|
|
574
578
|
iconLeftScreenReaderText: "Stop",
|
|
575
|
-
onClick:
|
|
579
|
+
onClick: c,
|
|
576
580
|
children: "Stop agent"
|
|
577
581
|
}
|
|
578
582
|
)
|
|
@@ -591,8 +595,8 @@ const Ct = ({
|
|
|
591
595
|
),
|
|
592
596
|
/* @__PURE__ */ n("span", { children: oe })
|
|
593
597
|
] }),
|
|
594
|
-
!t &&
|
|
595
|
-
!t && !
|
|
598
|
+
!t && a && /* @__PURE__ */ n("p", { className: "agent-workspace__error", role: "alert", children: a }),
|
|
599
|
+
!t && !a && d && /* @__PURE__ */ i(et, { children: [
|
|
596
600
|
d.needsInput.length > 0 && /* @__PURE__ */ i("div", { className: "agent-workspace__task-group", children: [
|
|
597
601
|
/* @__PURE__ */ n("p", { className: "agent-workspace__task-group-label", children: "Needs your input" }),
|
|
598
602
|
/* @__PURE__ */ n(
|
|
@@ -601,14 +605,14 @@ const Ct = ({
|
|
|
601
605
|
items: d.needsInput,
|
|
602
606
|
ariaLabel: "Tasks needing your input",
|
|
603
607
|
canRequestInput: r,
|
|
604
|
-
onAttentionItemClick:
|
|
608
|
+
onAttentionItemClick: l
|
|
605
609
|
}
|
|
606
610
|
)
|
|
607
611
|
] }),
|
|
608
612
|
d.tasks.length > 0 && /* @__PURE__ */ i(
|
|
609
613
|
"div",
|
|
610
614
|
{
|
|
611
|
-
className:
|
|
615
|
+
className: H("agent-workspace__task-group", {
|
|
612
616
|
"agent-workspace__task-group--following": d.needsInput.length > 0
|
|
613
617
|
}),
|
|
614
618
|
children: [
|
|
@@ -619,19 +623,19 @@ const Ct = ({
|
|
|
619
623
|
items: d.tasks,
|
|
620
624
|
ariaLabel: "Agent tasks",
|
|
621
625
|
canRequestInput: r,
|
|
622
|
-
onAttentionItemClick:
|
|
626
|
+
onAttentionItemClick: l
|
|
623
627
|
}
|
|
624
628
|
)
|
|
625
629
|
]
|
|
626
630
|
}
|
|
627
631
|
)
|
|
628
632
|
] }),
|
|
629
|
-
!t && !
|
|
633
|
+
!t && !a && (!d || d.needsInput.length === 0 && d.tasks.length === 0) && /* @__PURE__ */ n("p", { className: "agent-workspace__empty", children: s === b.briefing ? "Tasks will appear here once the agent starts." : "No tasks to display." })
|
|
630
634
|
] })
|
|
631
635
|
]
|
|
632
636
|
}
|
|
633
637
|
);
|
|
634
|
-
},
|
|
638
|
+
}, It = {
|
|
635
639
|
[re.MIS_RECORD]: {
|
|
636
640
|
icon: "table",
|
|
637
641
|
label: "Arbor MIS",
|
|
@@ -652,10 +656,10 @@ const Ct = ({
|
|
|
652
656
|
label: "Link",
|
|
653
657
|
color: "var(--color-semantic-info-700)"
|
|
654
658
|
}
|
|
655
|
-
},
|
|
659
|
+
}, Rt = ({
|
|
656
660
|
resources: e,
|
|
657
661
|
isLoading: t = !1,
|
|
658
|
-
error:
|
|
662
|
+
error: a = null
|
|
659
663
|
}) => /* @__PURE__ */ i(
|
|
660
664
|
"section",
|
|
661
665
|
{
|
|
@@ -680,21 +684,21 @@ const Ct = ({
|
|
|
680
684
|
),
|
|
681
685
|
/* @__PURE__ */ n("span", { children: "Loading resources…" })
|
|
682
686
|
] }),
|
|
683
|
-
!t &&
|
|
684
|
-
!t && !
|
|
685
|
-
const r =
|
|
687
|
+
!t && a && /* @__PURE__ */ n("p", { className: "agent-workspace__error", role: "alert", children: a }),
|
|
688
|
+
!t && !a && e.length > 0 && /* @__PURE__ */ n("ul", { className: "agent-workspace__resource-list", "aria-label": "Agent resources", children: e.map((s) => {
|
|
689
|
+
const r = It[s.type];
|
|
686
690
|
return /* @__PURE__ */ n("li", { className: "agent-workspace__resource", children: /* @__PURE__ */ i(
|
|
687
691
|
"a",
|
|
688
692
|
{
|
|
689
693
|
className: "agent-workspace__resource-card",
|
|
690
|
-
href:
|
|
694
|
+
href: s.uri,
|
|
691
695
|
target: "_blank",
|
|
692
696
|
rel: "noreferrer",
|
|
693
697
|
children: [
|
|
694
698
|
/* @__PURE__ */ n(
|
|
695
699
|
"span",
|
|
696
700
|
{
|
|
697
|
-
className: `agent-workspace__resource-icon agent-workspace__resource-icon--${
|
|
701
|
+
className: `agent-workspace__resource-icon agent-workspace__resource-icon--${s.type.toLowerCase()}`,
|
|
698
702
|
children: /* @__PURE__ */ n(
|
|
699
703
|
E,
|
|
700
704
|
{
|
|
@@ -708,16 +712,16 @@ const Ct = ({
|
|
|
708
712
|
),
|
|
709
713
|
/* @__PURE__ */ i("span", { className: "agent-workspace__resource-content", children: [
|
|
710
714
|
/* @__PURE__ */ i("span", { className: "agent-workspace__resource-top", children: [
|
|
711
|
-
/* @__PURE__ */ n("span", { className: "agent-workspace__resource-name", children:
|
|
715
|
+
/* @__PURE__ */ n("span", { className: "agent-workspace__resource-name", children: s.name }),
|
|
712
716
|
/* @__PURE__ */ n(
|
|
713
717
|
"span",
|
|
714
718
|
{
|
|
715
|
-
className: `agent-workspace__resource-badge agent-workspace__resource-badge--${
|
|
719
|
+
className: `agent-workspace__resource-badge agent-workspace__resource-badge--${s.type.toLowerCase()}`,
|
|
716
720
|
children: r.label
|
|
717
721
|
}
|
|
718
722
|
)
|
|
719
723
|
] }),
|
|
720
|
-
|
|
724
|
+
s.description && /* @__PURE__ */ n("span", { className: "agent-workspace__resource-description", children: s.description })
|
|
721
725
|
] }),
|
|
722
726
|
/* @__PURE__ */ n(
|
|
723
727
|
E,
|
|
@@ -731,440 +735,59 @@ const Ct = ({
|
|
|
731
735
|
)
|
|
732
736
|
]
|
|
733
737
|
}
|
|
734
|
-
) }, `${
|
|
738
|
+
) }, `${s.type}-${s.uri}`);
|
|
735
739
|
}) }),
|
|
736
|
-
!t && !
|
|
740
|
+
!t && !a && e.length === 0 && /* @__PURE__ */ n("p", { className: "agent-workspace__empty", children: "No resources yet." })
|
|
737
741
|
] })
|
|
738
742
|
]
|
|
739
743
|
}
|
|
740
|
-
),
|
|
744
|
+
), Ot = [
|
|
741
745
|
"I'll get the details and come back to you",
|
|
742
746
|
"Skip this for now"
|
|
743
|
-
],
|
|
744
|
-
var
|
|
745
|
-
const t = (
|
|
747
|
+
], xt = (e) => {
|
|
748
|
+
var a;
|
|
749
|
+
const t = (a = e.prompt) != null && a.trim() ? e.prompt.trim() : `I need a bit more from you on "${e.task}". ${e.description} What can you tell me?`;
|
|
746
750
|
return {
|
|
747
751
|
id: `clarification-${Date.now()}`,
|
|
748
|
-
author:
|
|
752
|
+
author: j.agent,
|
|
749
753
|
text: t,
|
|
750
|
-
followUpPrompts: e.clarificationPrompts ??
|
|
754
|
+
followUpPrompts: e.clarificationPrompts ?? Ot
|
|
751
755
|
};
|
|
752
756
|
}, pe = (e) => ({
|
|
753
757
|
id: e.id,
|
|
754
758
|
text: e.text,
|
|
755
|
-
type: e.author ===
|
|
759
|
+
type: e.author === j.user ? ot : e.author === j.system ? it : ze,
|
|
756
760
|
...e.followUpPrompts ? { followUpPrompts: e.followUpPrompts } : {}
|
|
757
|
-
})
|
|
758
|
-
const s = e.hasRunBefore ? t || "This trip" : e.tripName.trim() || "A new trip", a = e.destination ? ` to ${e.destination}` : "", r = e.hasRunBefore ? " It has run before." : "";
|
|
759
|
-
return `${s}${a}.${r}`.trim();
|
|
760
|
-
}, Pt = (e) => {
|
|
761
|
-
switch (e) {
|
|
762
|
-
case v.failed:
|
|
763
|
-
return T.stopped;
|
|
764
|
-
case v.complete:
|
|
765
|
-
return T.complete;
|
|
766
|
-
default:
|
|
767
|
-
return T.running;
|
|
768
|
-
}
|
|
769
|
-
}, Ue = (e, t) => {
|
|
770
|
-
t([pe(e)]);
|
|
771
|
-
}, Lt = ({
|
|
772
|
-
agent: e,
|
|
773
|
-
open: t,
|
|
774
|
-
onClose: s,
|
|
775
|
-
initialBrief: a,
|
|
776
|
-
initialPhase: r,
|
|
777
|
-
initialChecklist: o,
|
|
778
|
-
fetchAgentChecklist: c,
|
|
779
|
-
fetchAgentResources: d,
|
|
780
|
-
connector: w
|
|
781
|
-
}) => {
|
|
782
|
-
const g = Re(w), [p, m] = _(
|
|
783
|
-
r ?? (a ? T.running : Pt(e.status))
|
|
784
|
-
), [k, x] = _([]), [P, N] = _(0), [D, S] = _(), [H, q] = _(null), [z, ce] = _([]), [ae, ee] = _(!1), [y, C] = _(null), [$, K] = _(
|
|
785
|
-
o ?? null
|
|
786
|
-
), [J, W] = _(!1), [L, le] = _(null), [Ne, te] = _(!1), [j, ye] = _(!1), [V, Ae] = _(!1), Y = Re(!1);
|
|
787
|
-
B(() => {
|
|
788
|
-
g.current = w;
|
|
789
|
-
}, [w]), B(() => {
|
|
790
|
-
Y.current = !1, x([]), N((u) => u + 1);
|
|
791
|
-
}, [e.invocation_id]), B(() => {
|
|
792
|
-
if (!t || a || Y.current)
|
|
793
|
-
return;
|
|
794
|
-
const u = g.current.bootstrapConversation;
|
|
795
|
-
if (!u) {
|
|
796
|
-
Ue(
|
|
797
|
-
g.current.openingMessage(),
|
|
798
|
-
x
|
|
799
|
-
);
|
|
800
|
-
return;
|
|
801
|
-
}
|
|
802
|
-
Y.current = !0;
|
|
803
|
-
let A = !1;
|
|
804
|
-
return te(!0), (async () => {
|
|
805
|
-
try {
|
|
806
|
-
const se = await u.call(g.current);
|
|
807
|
-
if (A)
|
|
808
|
-
return;
|
|
809
|
-
x(se.map(pe));
|
|
810
|
-
} catch {
|
|
811
|
-
A || Ue(
|
|
812
|
-
g.current.openingMessage(),
|
|
813
|
-
x
|
|
814
|
-
);
|
|
815
|
-
} finally {
|
|
816
|
-
A || te(!1);
|
|
817
|
-
}
|
|
818
|
-
})(), () => {
|
|
819
|
-
A = !0;
|
|
820
|
-
};
|
|
821
|
-
}, [t, a, e.invocation_id, w]);
|
|
822
|
-
const ne = I((u) => {
|
|
823
|
-
u.checklist && K(u.checklist), u.phase && m(u.phase);
|
|
824
|
-
}, []);
|
|
825
|
-
B(() => {
|
|
826
|
-
var u, A;
|
|
827
|
-
!t || a || o && o.length > 0 && ((A = (u = g.current).seedChecklist) == null || A.call(u, o));
|
|
828
|
-
}, [t, a, o]), B(() => {
|
|
829
|
-
if (!t || a || !c)
|
|
830
|
-
return;
|
|
831
|
-
let u = !1;
|
|
832
|
-
return W(!(o != null && o.length)), le(null), (async () => {
|
|
833
|
-
var A, se;
|
|
834
|
-
try {
|
|
835
|
-
const de = await c(e.invocation_id);
|
|
836
|
-
if (u)
|
|
837
|
-
return;
|
|
838
|
-
o != null && o.length || (K(de.checklist), (se = (A = g.current).seedChecklist) == null || se.call(A, de.checklist));
|
|
839
|
-
} catch {
|
|
840
|
-
!u && !(o != null && o.length) && le(be);
|
|
841
|
-
} finally {
|
|
842
|
-
u || W(!1);
|
|
843
|
-
}
|
|
844
|
-
})(), () => {
|
|
845
|
-
u = !0;
|
|
846
|
-
};
|
|
847
|
-
}, [
|
|
848
|
-
t,
|
|
849
|
-
e.invocation_id,
|
|
850
|
-
a,
|
|
851
|
-
o,
|
|
852
|
-
c
|
|
853
|
-
]), B(() => {
|
|
854
|
-
if (!t || !d)
|
|
855
|
-
return;
|
|
856
|
-
let u = !1;
|
|
857
|
-
return ee(!0), C(null), (async () => {
|
|
858
|
-
try {
|
|
859
|
-
const A = await d(
|
|
860
|
-
e.invocation_id
|
|
861
|
-
);
|
|
862
|
-
u || ce(A);
|
|
863
|
-
} catch {
|
|
864
|
-
u || C(gt);
|
|
865
|
-
} finally {
|
|
866
|
-
u || ee(!1);
|
|
867
|
-
}
|
|
868
|
-
})(), () => {
|
|
869
|
-
u = !0;
|
|
870
|
-
};
|
|
871
|
-
}, [t, e.invocation_id, d]), B(() => {
|
|
872
|
-
if (!t || !a || Y.current)
|
|
873
|
-
return;
|
|
874
|
-
Y.current = !0;
|
|
875
|
-
const u = {
|
|
876
|
-
id: `user-brief-${Date.now()}`,
|
|
877
|
-
author: Z.user,
|
|
878
|
-
text: xt(a, e.invocation_name)
|
|
879
|
-
};
|
|
880
|
-
(async () => {
|
|
881
|
-
const A = await g.current.start(a);
|
|
882
|
-
x([
|
|
883
|
-
pe(g.current.openingMessage()),
|
|
884
|
-
pe(u),
|
|
885
|
-
pe(A.message)
|
|
886
|
-
]), A.checklist && K(A.checklist), m(A.phase ?? T.running);
|
|
887
|
-
})();
|
|
888
|
-
}, [t, a, e.invocation_name]);
|
|
889
|
-
const _e = I(
|
|
890
|
-
(u) => {
|
|
891
|
-
q(Ot(u));
|
|
892
|
-
},
|
|
893
|
-
[]
|
|
894
|
-
), me = I((u) => {
|
|
895
|
-
q(null), S(u), N((A) => A + 1);
|
|
896
|
-
}, []), fe = I(async () => {
|
|
897
|
-
await g.current.stop(), m(T.stopped);
|
|
898
|
-
}, []), ve = $;
|
|
899
|
-
return /* @__PURE__ */ i(
|
|
900
|
-
Q,
|
|
901
|
-
{
|
|
902
|
-
open: t,
|
|
903
|
-
closeHandler: s,
|
|
904
|
-
hideCloseButton: !0,
|
|
905
|
-
className: "agent-workspace",
|
|
906
|
-
children: [
|
|
907
|
-
/* @__PURE__ */ i(Q.Header, { className: "agent-workspace__header", children: [
|
|
908
|
-
/* @__PURE__ */ i("div", { className: "agent-workspace__header-title", children: [
|
|
909
|
-
/* @__PURE__ */ n(
|
|
910
|
-
"span",
|
|
911
|
-
{
|
|
912
|
-
className: "agent-workspace__header-avatar",
|
|
913
|
-
"aria-hidden": "true",
|
|
914
|
-
children: /* @__PURE__ */ n(E, { name: "ask-arbor", size: 24 })
|
|
915
|
-
}
|
|
916
|
-
),
|
|
917
|
-
/* @__PURE__ */ n(Q.Title, { children: e.invocation_name }),
|
|
918
|
-
/* @__PURE__ */ n(
|
|
919
|
-
"span",
|
|
920
|
-
{
|
|
921
|
-
className: M(
|
|
922
|
-
"agent-workspace__phase",
|
|
923
|
-
`agent-workspace__phase--${p}`
|
|
924
|
-
),
|
|
925
|
-
children: _t[p]
|
|
926
|
-
}
|
|
927
|
-
)
|
|
928
|
-
] }),
|
|
929
|
-
/* @__PURE__ */ i("div", { className: "agent-workspace__header-actions", children: [
|
|
930
|
-
/* @__PURE__ */ n(
|
|
931
|
-
X,
|
|
932
|
-
{
|
|
933
|
-
variant: "tertiary",
|
|
934
|
-
size: "S",
|
|
935
|
-
iconLeftName: "clipboard-list",
|
|
936
|
-
iconLeftScreenReaderText: "Toggle checklist",
|
|
937
|
-
"aria-pressed": !V,
|
|
938
|
-
onClick: () => Ae((u) => !u),
|
|
939
|
-
children: "Checklist"
|
|
940
|
-
}
|
|
941
|
-
),
|
|
942
|
-
/* @__PURE__ */ n(
|
|
943
|
-
X,
|
|
944
|
-
{
|
|
945
|
-
variant: "tertiary",
|
|
946
|
-
size: "S",
|
|
947
|
-
iconLeftName: "files",
|
|
948
|
-
iconLeftScreenReaderText: "Toggle resources",
|
|
949
|
-
"aria-pressed": !j,
|
|
950
|
-
onClick: () => ye((u) => !u),
|
|
951
|
-
children: "Resources"
|
|
952
|
-
}
|
|
953
|
-
),
|
|
954
|
-
/* @__PURE__ */ n(
|
|
955
|
-
X,
|
|
956
|
-
{
|
|
957
|
-
variant: "secondary",
|
|
958
|
-
size: "S",
|
|
959
|
-
iconLeftName: "x",
|
|
960
|
-
iconLeftScreenReaderText: "Close",
|
|
961
|
-
onClick: s,
|
|
962
|
-
children: "Close"
|
|
963
|
-
}
|
|
964
|
-
)
|
|
965
|
-
] })
|
|
966
|
-
] }),
|
|
967
|
-
/* @__PURE__ */ i(
|
|
968
|
-
Q.Body,
|
|
969
|
-
{
|
|
970
|
-
className: M("agent-workspace__body", {
|
|
971
|
-
"agent-workspace__body--no-left": V,
|
|
972
|
-
"agent-workspace__body--no-right": j
|
|
973
|
-
}),
|
|
974
|
-
children: [
|
|
975
|
-
!V && /* @__PURE__ */ n(
|
|
976
|
-
Tt,
|
|
977
|
-
{
|
|
978
|
-
checklist: ve,
|
|
979
|
-
isLoading: J,
|
|
980
|
-
error: L,
|
|
981
|
-
phase: p,
|
|
982
|
-
canRequestInput: p === T.running && !Ne,
|
|
983
|
-
onStop: () => void fe(),
|
|
984
|
-
onAttentionItemClick: _e
|
|
985
|
-
}
|
|
986
|
-
),
|
|
987
|
-
/* @__PURE__ */ n(
|
|
988
|
-
Ct,
|
|
989
|
-
{
|
|
990
|
-
connector: g.current,
|
|
991
|
-
phase: p,
|
|
992
|
-
chatHistory: k,
|
|
993
|
-
chatSessionKey: P,
|
|
994
|
-
startQuery: D,
|
|
995
|
-
clarificationMessage: H,
|
|
996
|
-
onTurn: ne,
|
|
997
|
-
onAwaitingChange: te,
|
|
998
|
-
onClarificationPrompt: me,
|
|
999
|
-
onDismissClarification: () => q(null)
|
|
1000
|
-
}
|
|
1001
|
-
),
|
|
1002
|
-
!j && /* @__PURE__ */ n(
|
|
1003
|
-
It,
|
|
1004
|
-
{
|
|
1005
|
-
resources: z,
|
|
1006
|
-
isLoading: ae,
|
|
1007
|
-
error: y
|
|
1008
|
-
}
|
|
1009
|
-
)
|
|
1010
|
-
]
|
|
1011
|
-
}
|
|
1012
|
-
)
|
|
1013
|
-
]
|
|
1014
|
-
}
|
|
1015
|
-
);
|
|
1016
|
-
}, Ut = ({
|
|
1017
|
-
open: e,
|
|
1018
|
-
onClose: t,
|
|
1019
|
-
onStart: s,
|
|
1020
|
-
agentDefinitions: a
|
|
1021
|
-
}) => {
|
|
1022
|
-
const r = a[0], [o, c] = _(
|
|
1023
|
-
r
|
|
1024
|
-
), [d, w] = _(""), [g, p] = _(!1), [m, k] = _(null), x = [...a].sort((S, H) => S.agent_intent.localeCompare(H.agent_intent)).map((S) => ({
|
|
1025
|
-
value: S.ref,
|
|
1026
|
-
label: S.agent_intent
|
|
1027
|
-
}));
|
|
1028
|
-
B(() => {
|
|
1029
|
-
e && (c(r), w(""), p(!1), k(null));
|
|
1030
|
-
}, [e, r]);
|
|
1031
|
-
const P = o !== void 0 && d.trim().length > 0, N = I(
|
|
1032
|
-
(S) => {
|
|
1033
|
-
const H = a.find(
|
|
1034
|
-
(q) => q.ref === S[0]
|
|
1035
|
-
);
|
|
1036
|
-
H && c(H);
|
|
1037
|
-
},
|
|
1038
|
-
[a]
|
|
1039
|
-
), D = I(async () => {
|
|
1040
|
-
if (!(!o || !P || g)) {
|
|
1041
|
-
p(!0), k(null);
|
|
1042
|
-
try {
|
|
1043
|
-
await s({ definition: o, invocationName: d.trim() });
|
|
1044
|
-
} catch (S) {
|
|
1045
|
-
k(
|
|
1046
|
-
S instanceof Error ? S.message : "Unable to start the agent."
|
|
1047
|
-
);
|
|
1048
|
-
} finally {
|
|
1049
|
-
p(!1);
|
|
1050
|
-
}
|
|
1051
|
-
}
|
|
1052
|
-
}, [P, o, d, g, s]);
|
|
1053
|
-
return !o || a.length === 0 ? null : /* @__PURE__ */ i(
|
|
1054
|
-
Q,
|
|
1055
|
-
{
|
|
1056
|
-
open: e,
|
|
1057
|
-
closeHandler: t,
|
|
1058
|
-
className: "new-agent",
|
|
1059
|
-
children: [
|
|
1060
|
-
/* @__PURE__ */ n(Q.Header, { className: "new-agent__header", children: /* @__PURE__ */ i("div", { className: "new-agent__header-title", children: [
|
|
1061
|
-
/* @__PURE__ */ n(
|
|
1062
|
-
"span",
|
|
1063
|
-
{
|
|
1064
|
-
className: "new-agent__header-avatar",
|
|
1065
|
-
"aria-hidden": "true",
|
|
1066
|
-
children: /* @__PURE__ */ n(E, { name: "ask-arbor", size: 24 })
|
|
1067
|
-
}
|
|
1068
|
-
),
|
|
1069
|
-
/* @__PURE__ */ n(Q.Title, { children: "Start an agent" })
|
|
1070
|
-
] }) }),
|
|
1071
|
-
/* @__PURE__ */ n(Q.Body, { className: "new-agent__body", children: /* @__PURE__ */ i(
|
|
1072
|
-
"form",
|
|
1073
|
-
{
|
|
1074
|
-
className: "new-agent__form",
|
|
1075
|
-
"aria-label": "Start an agent",
|
|
1076
|
-
onSubmit: (S) => {
|
|
1077
|
-
S.preventDefault(), P && !g && D();
|
|
1078
|
-
},
|
|
1079
|
-
children: [
|
|
1080
|
-
/* @__PURE__ */ i("div", { className: "new-agent__type-field", children: [
|
|
1081
|
-
/* @__PURE__ */ n(
|
|
1082
|
-
"label",
|
|
1083
|
-
{
|
|
1084
|
-
className: "new-agent__type-label",
|
|
1085
|
-
htmlFor: "new-agent-type",
|
|
1086
|
-
children: "What would you like your agent to do?"
|
|
1087
|
-
}
|
|
1088
|
-
),
|
|
1089
|
-
/* @__PURE__ */ n(
|
|
1090
|
-
et,
|
|
1091
|
-
{
|
|
1092
|
-
id: "new-agent-type",
|
|
1093
|
-
placeholder: "Choose an intent",
|
|
1094
|
-
options: x,
|
|
1095
|
-
selectedValues: [o.ref],
|
|
1096
|
-
onSelectionChange: N
|
|
1097
|
-
}
|
|
1098
|
-
),
|
|
1099
|
-
/* @__PURE__ */ n("p", { className: "new-agent__type-description", children: o.description })
|
|
1100
|
-
] }),
|
|
1101
|
-
/* @__PURE__ */ i("div", { className: "new-agent__type-field", children: [
|
|
1102
|
-
/* @__PURE__ */ n(
|
|
1103
|
-
"label",
|
|
1104
|
-
{
|
|
1105
|
-
className: "new-agent__type-label",
|
|
1106
|
-
htmlFor: "new-agent-invocation-name",
|
|
1107
|
-
children: "Name"
|
|
1108
|
-
}
|
|
1109
|
-
),
|
|
1110
|
-
/* @__PURE__ */ n(
|
|
1111
|
-
tt,
|
|
1112
|
-
{
|
|
1113
|
-
id: "new-agent-invocation-name",
|
|
1114
|
-
value: d,
|
|
1115
|
-
placeholder: "e.g. Test with memory3",
|
|
1116
|
-
onChange: (S) => w(S.target.value)
|
|
1117
|
-
}
|
|
1118
|
-
)
|
|
1119
|
-
] }),
|
|
1120
|
-
m ? /* @__PURE__ */ n("p", { className: "new-agent__error", role: "alert", children: m }) : null,
|
|
1121
|
-
/* @__PURE__ */ n("div", { className: "new-agent__actions", children: /* @__PURE__ */ n(
|
|
1122
|
-
X,
|
|
1123
|
-
{
|
|
1124
|
-
type: "submit",
|
|
1125
|
-
variant: "primary",
|
|
1126
|
-
disabled: !P || g,
|
|
1127
|
-
iconLeftName: g ? "loader" : "sparkles",
|
|
1128
|
-
iconLeftScreenReaderText: g ? "Starting" : void 0,
|
|
1129
|
-
children: g ? "Starting…" : "Start"
|
|
1130
|
-
}
|
|
1131
|
-
) })
|
|
1132
|
-
]
|
|
1133
|
-
}
|
|
1134
|
-
) })
|
|
1135
|
-
]
|
|
1136
|
-
}
|
|
1137
|
-
);
|
|
1138
|
-
};
|
|
761
|
+
});
|
|
1139
762
|
class ue extends Error {
|
|
1140
|
-
constructor(t,
|
|
1141
|
-
super(
|
|
763
|
+
constructor(t, a, s) {
|
|
764
|
+
super(s ?? `Agent service request failed (${t})`), this.name = "AgentServiceError", this.status = t, this.detail = a;
|
|
1142
765
|
}
|
|
1143
766
|
}
|
|
1144
|
-
const
|
|
767
|
+
const Pt = "/api/v1", O = {
|
|
1145
768
|
agentDefinitions: "/agent-definitions",
|
|
1146
769
|
agents: "/agents",
|
|
1147
770
|
tripOptions: "/trip-options",
|
|
1148
771
|
demoDataset: "/demo/dataset"
|
|
1149
|
-
},
|
|
772
|
+
}, x = {
|
|
1150
773
|
GET: "GET",
|
|
1151
774
|
POST: "POST"
|
|
1152
|
-
},
|
|
775
|
+
}, Lt = {
|
|
1153
776
|
error: "error"
|
|
1154
|
-
},
|
|
777
|
+
}, Ut = {
|
|
1155
778
|
user: "user"
|
|
1156
779
|
}, ie = {
|
|
1157
780
|
acceptJson: "application/json",
|
|
1158
781
|
acceptEventStream: "text/event-stream",
|
|
1159
782
|
contentTypeJson: "application/json",
|
|
1160
783
|
arborApplicationUrl: "X-Arbor-Application-Url"
|
|
1161
|
-
},
|
|
1162
|
-
class
|
|
784
|
+
}, $t = /:invocationId\b/g, Mt = (e) => e.trim().replace(/^Bearer\s+/i, ""), Dt = (e) => e.endsWith("/") ? e.slice(0, -1) : e;
|
|
785
|
+
class je {
|
|
1163
786
|
constructor(t) {
|
|
1164
|
-
var
|
|
1165
|
-
this.baseUrl =
|
|
1166
|
-
const
|
|
1167
|
-
this.token =
|
|
787
|
+
var s;
|
|
788
|
+
this.baseUrl = Dt(t.baseUrl ?? "");
|
|
789
|
+
const a = (s = t.token) == null ? void 0 : s.trim();
|
|
790
|
+
this.token = a ? Mt(a) : void 0, this.customHeaders = t.headers, this.urls = t.urls ?? {}, this.fetchImpl = t.fetch ?? globalThis.fetch.bind(globalThis);
|
|
1168
791
|
}
|
|
1169
792
|
// Replaces the extra headers merged into every subsequent request,
|
|
1170
793
|
// without recreating the client (e.g. an application-URL header that
|
|
@@ -1174,170 +797,171 @@ class Bt {
|
|
|
1174
797
|
}
|
|
1175
798
|
async listAgentDefinitions() {
|
|
1176
799
|
return (await this.request(
|
|
1177
|
-
|
|
1178
|
-
this.resolveUrl("agentDefinitions",
|
|
800
|
+
x.GET,
|
|
801
|
+
this.resolveUrl("agentDefinitions", O.agentDefinitions)
|
|
1179
802
|
)).agent_definitions ?? [];
|
|
1180
803
|
}
|
|
1181
804
|
getAgentDefinition(t) {
|
|
1182
805
|
return this.request(
|
|
1183
|
-
|
|
806
|
+
x.GET,
|
|
1184
807
|
this.apiUrl(
|
|
1185
|
-
`${
|
|
808
|
+
`${O.agentDefinitions}/${encodeURIComponent(t)}`
|
|
1186
809
|
)
|
|
1187
810
|
);
|
|
1188
811
|
}
|
|
1189
812
|
listTripOptions() {
|
|
1190
813
|
return this.request(
|
|
1191
|
-
|
|
1192
|
-
this.apiUrl(
|
|
814
|
+
x.GET,
|
|
815
|
+
this.apiUrl(O.tripOptions)
|
|
1193
816
|
);
|
|
1194
817
|
}
|
|
1195
818
|
getDataset() {
|
|
1196
819
|
return this.request(
|
|
1197
|
-
|
|
1198
|
-
this.apiUrl(
|
|
820
|
+
x.GET,
|
|
821
|
+
this.apiUrl(O.demoDataset)
|
|
1199
822
|
);
|
|
1200
823
|
}
|
|
1201
824
|
setDataset(t) {
|
|
1202
825
|
return this.request(
|
|
1203
|
-
|
|
1204
|
-
this.apiUrl(
|
|
826
|
+
x.POST,
|
|
827
|
+
this.apiUrl(O.demoDataset),
|
|
1205
828
|
{ dataset: t }
|
|
1206
829
|
);
|
|
1207
830
|
}
|
|
1208
831
|
listAgents(t = {}) {
|
|
1209
|
-
const
|
|
1210
|
-
t.status &&
|
|
1211
|
-
const
|
|
832
|
+
const a = new URLSearchParams();
|
|
833
|
+
t.status && a.set("status", t.status), t.agentDefinitionRef && a.set("agent_definition_ref", t.agentDefinitionRef);
|
|
834
|
+
const s = a.toString() ? `?${a.toString()}` : "";
|
|
1212
835
|
return this.request(
|
|
1213
|
-
|
|
1214
|
-
`${this.resolveUrl("agents",
|
|
836
|
+
x.GET,
|
|
837
|
+
`${this.resolveUrl("agents", O.agents)}${s}`
|
|
1215
838
|
);
|
|
1216
839
|
}
|
|
1217
|
-
createAgent(t,
|
|
1218
|
-
var
|
|
1219
|
-
const
|
|
840
|
+
createAgent(t, a = {}) {
|
|
841
|
+
var l, d;
|
|
842
|
+
const s = {
|
|
1220
843
|
agent_definition_ref: t
|
|
1221
|
-
}, r = (
|
|
1222
|
-
return r && (
|
|
1223
|
-
|
|
1224
|
-
this.resolveUrl("agents",
|
|
1225
|
-
|
|
844
|
+
}, r = (l = a.invocationName) == null ? void 0 : l.trim(), c = (d = a.agentIntent) == null ? void 0 : d.trim();
|
|
845
|
+
return r && (s.invocation_name = r), c && (s.agent_intent = c), this.request(
|
|
846
|
+
x.POST,
|
|
847
|
+
this.resolveUrl("agents", O.agents),
|
|
848
|
+
s
|
|
1226
849
|
);
|
|
1227
850
|
}
|
|
1228
851
|
getAgent(t) {
|
|
1229
852
|
return this.request(
|
|
1230
|
-
|
|
853
|
+
x.GET,
|
|
1231
854
|
this.resolveUrl(
|
|
1232
855
|
"agent",
|
|
1233
|
-
`${
|
|
856
|
+
`${O.agents}/${encodeURIComponent(t)}`,
|
|
1234
857
|
t
|
|
1235
858
|
)
|
|
1236
859
|
);
|
|
1237
860
|
}
|
|
1238
861
|
getAgentChecklist(t) {
|
|
1239
862
|
return this.request(
|
|
1240
|
-
|
|
863
|
+
x.GET,
|
|
1241
864
|
this.resolveUrl(
|
|
1242
865
|
"agentChecklist",
|
|
1243
|
-
`${
|
|
866
|
+
`${O.agents}/${encodeURIComponent(t)}/checklist`,
|
|
1244
867
|
t
|
|
1245
868
|
)
|
|
1246
869
|
);
|
|
1247
870
|
}
|
|
1248
871
|
getAgentResources(t) {
|
|
1249
872
|
return this.request(
|
|
1250
|
-
|
|
873
|
+
x.GET,
|
|
1251
874
|
this.resolveUrl(
|
|
1252
875
|
"agentResources",
|
|
1253
|
-
`${
|
|
876
|
+
`${O.agents}/${encodeURIComponent(t)}/resources`,
|
|
1254
877
|
t
|
|
1255
878
|
)
|
|
1256
879
|
);
|
|
1257
880
|
}
|
|
1258
881
|
getAgentContext(t) {
|
|
1259
882
|
return this.request(
|
|
1260
|
-
|
|
883
|
+
x.GET,
|
|
1261
884
|
this.apiUrl(
|
|
1262
|
-
`${
|
|
885
|
+
`${O.agents}/${encodeURIComponent(t)}/context`
|
|
1263
886
|
)
|
|
1264
887
|
);
|
|
1265
888
|
}
|
|
1266
889
|
cancelAgent(t) {
|
|
1267
890
|
return this.request(
|
|
1268
|
-
|
|
891
|
+
x.POST,
|
|
1269
892
|
this.apiUrl(
|
|
1270
|
-
`${
|
|
893
|
+
`${O.agents}/${encodeURIComponent(t)}/cancel`
|
|
1271
894
|
)
|
|
1272
895
|
);
|
|
1273
896
|
}
|
|
1274
897
|
archiveAgent(t) {
|
|
1275
898
|
return this.request(
|
|
1276
|
-
|
|
899
|
+
x.POST,
|
|
1277
900
|
this.apiUrl(
|
|
1278
|
-
`${
|
|
901
|
+
`${O.agents}/${encodeURIComponent(t)}/archive`
|
|
1279
902
|
)
|
|
1280
903
|
);
|
|
1281
904
|
}
|
|
1282
905
|
// Streams a chat turn. Resolves with the final SSE event; `onEvent` fires
|
|
1283
906
|
// for every event as it arrives.
|
|
1284
|
-
async chat(t,
|
|
1285
|
-
const r = await this.fetchImpl(
|
|
907
|
+
async chat(t, a, s = {}) {
|
|
908
|
+
const r = !!(s.uploadFiles && s.uploadFiles.length > 0), c = await this.fetchImpl(
|
|
1286
909
|
this.resolveUrl(
|
|
1287
910
|
"agentChat",
|
|
1288
|
-
`${
|
|
911
|
+
`${O.agents}/${encodeURIComponent(t)}/chat`,
|
|
1289
912
|
t
|
|
1290
913
|
),
|
|
1291
914
|
{
|
|
1292
|
-
method:
|
|
915
|
+
method: x.POST,
|
|
1293
916
|
headers: {
|
|
1294
917
|
...this.customHeaders,
|
|
1295
918
|
...this.authHeaders(),
|
|
1296
919
|
Accept: ie.acceptEventStream,
|
|
1297
|
-
|
|
920
|
+
// Let the browser set the multipart boundary when uploading.
|
|
921
|
+
...r ? {} : { "Content-Type": ie.contentTypeJson }
|
|
1298
922
|
},
|
|
1299
|
-
body: JSON.stringify(
|
|
1300
|
-
signal:
|
|
923
|
+
body: r ? Ft(a, s.uploadFiles ?? []) : JSON.stringify(a),
|
|
924
|
+
signal: s.signal
|
|
1301
925
|
}
|
|
1302
926
|
);
|
|
1303
|
-
if (!
|
|
1304
|
-
throw await this.toError(
|
|
1305
|
-
if (!
|
|
927
|
+
if (!c.ok)
|
|
928
|
+
throw await this.toError(c);
|
|
929
|
+
if (!c.body)
|
|
1306
930
|
throw new ue(
|
|
1307
|
-
|
|
931
|
+
c.status,
|
|
1308
932
|
null,
|
|
1309
933
|
"Chat response contained no stream body"
|
|
1310
934
|
);
|
|
1311
|
-
return this.consumeSse(
|
|
935
|
+
return this.consumeSse(c.body, s.onEvent);
|
|
1312
936
|
}
|
|
1313
937
|
authHeaders() {
|
|
1314
938
|
return this.token ? { Authorization: `Bearer ${this.token}` } : {};
|
|
1315
939
|
}
|
|
1316
940
|
// Builds a URL from the base url + shared API prefix + route.
|
|
1317
941
|
apiUrl(t) {
|
|
1318
|
-
return `${this.baseUrl}${
|
|
942
|
+
return `${this.baseUrl}${Pt}${t}`;
|
|
1319
943
|
}
|
|
1320
944
|
// Resolves the URL for an operation, preferring a per-operation override
|
|
1321
945
|
// (with `:invocationId` substituted) and falling back to the base url.
|
|
1322
|
-
resolveUrl(t,
|
|
946
|
+
resolveUrl(t, a, s) {
|
|
1323
947
|
const r = this.urls[t];
|
|
1324
|
-
return r ?
|
|
1325
|
-
|
|
1326
|
-
encodeURIComponent(
|
|
1327
|
-
) : r : this.apiUrl(
|
|
948
|
+
return r ? s ? r.replace(
|
|
949
|
+
$t,
|
|
950
|
+
encodeURIComponent(s)
|
|
951
|
+
) : r : this.apiUrl(a);
|
|
1328
952
|
}
|
|
1329
|
-
async request(t,
|
|
953
|
+
async request(t, a, s) {
|
|
1330
954
|
const r = await this.fetchImpl(
|
|
1331
|
-
|
|
955
|
+
a,
|
|
1332
956
|
{
|
|
1333
957
|
method: t,
|
|
1334
958
|
headers: {
|
|
1335
959
|
...this.customHeaders,
|
|
1336
960
|
...this.authHeaders(),
|
|
1337
961
|
Accept: ie.acceptJson,
|
|
1338
|
-
...
|
|
962
|
+
...s === void 0 ? {} : { "Content-Type": ie.contentTypeJson }
|
|
1339
963
|
},
|
|
1340
|
-
...
|
|
964
|
+
...s === void 0 ? {} : { body: JSON.stringify(s) }
|
|
1341
965
|
}
|
|
1342
966
|
);
|
|
1343
967
|
if (!r.ok)
|
|
@@ -1346,144 +970,156 @@ class Bt {
|
|
|
1346
970
|
return await r.json();
|
|
1347
971
|
}
|
|
1348
972
|
async toError(t) {
|
|
1349
|
-
let
|
|
973
|
+
let a = null;
|
|
1350
974
|
try {
|
|
1351
|
-
|
|
975
|
+
a = await t.json();
|
|
1352
976
|
} catch {
|
|
1353
977
|
}
|
|
1354
978
|
return new ue(
|
|
1355
979
|
t.status,
|
|
1356
|
-
|
|
980
|
+
a,
|
|
1357
981
|
`Agent service request failed (${t.status} ${t.statusText})`
|
|
1358
982
|
);
|
|
1359
983
|
}
|
|
1360
|
-
async consumeSse(t,
|
|
1361
|
-
const
|
|
1362
|
-
let
|
|
984
|
+
async consumeSse(t, a) {
|
|
985
|
+
const s = t.getReader(), r = new TextDecoder();
|
|
986
|
+
let c = "", l;
|
|
1363
987
|
const d = (w) => {
|
|
1364
|
-
const { event:
|
|
988
|
+
const { event: f, data: p } = Ht(w);
|
|
1365
989
|
if (p === null)
|
|
1366
990
|
return;
|
|
1367
|
-
if (
|
|
1368
|
-
const
|
|
991
|
+
if (f === Lt.error) {
|
|
992
|
+
const u = Ue(p);
|
|
1369
993
|
throw new ue(
|
|
1370
994
|
502,
|
|
1371
|
-
|
|
1372
|
-
(
|
|
995
|
+
u,
|
|
996
|
+
(u == null ? void 0 : u.message) ?? "Chat stream error"
|
|
1373
997
|
);
|
|
1374
998
|
}
|
|
1375
|
-
const
|
|
1376
|
-
|
|
999
|
+
const _ = Ue(p);
|
|
1000
|
+
_ && (l = _, a == null || a(_));
|
|
1377
1001
|
};
|
|
1378
1002
|
for (; ; ) {
|
|
1379
|
-
const { done: w, value:
|
|
1003
|
+
const { done: w, value: f } = await s.read();
|
|
1380
1004
|
if (w)
|
|
1381
1005
|
break;
|
|
1382
|
-
|
|
1383
|
-
const p =
|
|
1006
|
+
c += r.decode(f, { stream: !0 });
|
|
1007
|
+
const p = c.split(`
|
|
1384
1008
|
|
|
1385
1009
|
`);
|
|
1386
|
-
|
|
1387
|
-
for (const
|
|
1388
|
-
d(
|
|
1010
|
+
c = p.pop() ?? "";
|
|
1011
|
+
for (const _ of p)
|
|
1012
|
+
d(_);
|
|
1389
1013
|
}
|
|
1390
|
-
if (
|
|
1014
|
+
if (c.trim() && d(c), !l)
|
|
1391
1015
|
throw new ue(
|
|
1392
1016
|
502,
|
|
1393
1017
|
null,
|
|
1394
1018
|
"Chat stream ended without any events"
|
|
1395
1019
|
);
|
|
1396
|
-
return
|
|
1020
|
+
return l;
|
|
1397
1021
|
}
|
|
1398
1022
|
}
|
|
1399
|
-
const
|
|
1023
|
+
const Ht = (e) => {
|
|
1400
1024
|
let t = null;
|
|
1401
|
-
const
|
|
1402
|
-
for (const
|
|
1025
|
+
const a = [];
|
|
1026
|
+
for (const s of e.split(`
|
|
1403
1027
|
`)) {
|
|
1404
|
-
const r =
|
|
1405
|
-
r.startsWith("event:") ? t = r.slice(6).trim() : r.startsWith("data:") &&
|
|
1028
|
+
const r = s.trimEnd();
|
|
1029
|
+
r.startsWith("event:") ? t = r.slice(6).trim() : r.startsWith("data:") && a.push(r.slice(5).trim());
|
|
1406
1030
|
}
|
|
1407
1031
|
return {
|
|
1408
1032
|
event: t,
|
|
1409
|
-
data:
|
|
1033
|
+
data: a.length > 0 ? a.join(`
|
|
1410
1034
|
`) : null
|
|
1411
1035
|
};
|
|
1412
|
-
},
|
|
1036
|
+
}, Ue = (e) => {
|
|
1413
1037
|
try {
|
|
1414
1038
|
return JSON.parse(e);
|
|
1415
1039
|
} catch {
|
|
1416
1040
|
return;
|
|
1417
1041
|
}
|
|
1418
|
-
}
|
|
1419
|
-
|
|
1420
|
-
|
|
1042
|
+
};
|
|
1043
|
+
function Ft(e, t) {
|
|
1044
|
+
const a = new FormData();
|
|
1045
|
+
a.append("body", JSON.stringify(e));
|
|
1046
|
+
for (const s of t)
|
|
1047
|
+
a.append("files", s, s.name);
|
|
1048
|
+
return a;
|
|
1049
|
+
}
|
|
1050
|
+
const Gt = {
|
|
1051
|
+
id: Ke,
|
|
1052
|
+
author: j.agent,
|
|
1421
1053
|
text: "I'm connected to this agent. Ask me how it's progressing, or send an instruction and I’ll act on it."
|
|
1422
1054
|
};
|
|
1423
|
-
let
|
|
1424
|
-
const
|
|
1055
|
+
let $e = 0;
|
|
1056
|
+
const Me = (e) => ($e += 1, `${e}-${Date.now()}-${$e}`), Bt = (e) => {
|
|
1425
1057
|
const t = e.destination ? ` to ${e.destination}` : "";
|
|
1426
1058
|
return `Let's get started on ${e.tripName.trim() || e.destination.trim() || "this task"}${t}. What will you do first?`;
|
|
1427
1059
|
};
|
|
1428
|
-
class
|
|
1429
|
-
constructor(t,
|
|
1430
|
-
this.seededChecklist = [], this.client = t, this.agentId =
|
|
1060
|
+
class zt {
|
|
1061
|
+
constructor(t, a, s = {}) {
|
|
1062
|
+
this.seededChecklist = [], this.client = t, this.agentId = a, this.opening = s.openingMessage ?? Gt, this.model = s.model, this.bootstrapPrompt = s.bootstrapPrompt ?? _t;
|
|
1431
1063
|
}
|
|
1432
1064
|
openingMessage() {
|
|
1433
1065
|
return this.opening;
|
|
1434
1066
|
}
|
|
1435
1067
|
async bootstrapConversation(t = this.bootstrapPrompt) {
|
|
1436
|
-
const
|
|
1437
|
-
if (!
|
|
1068
|
+
const a = t.trim();
|
|
1069
|
+
if (!a)
|
|
1438
1070
|
return [this.opening];
|
|
1439
|
-
const
|
|
1440
|
-
id:
|
|
1441
|
-
author:
|
|
1442
|
-
text:
|
|
1443
|
-
}, r = await this.exchange(
|
|
1444
|
-
return [
|
|
1071
|
+
const s = {
|
|
1072
|
+
id: Me("msg-user"),
|
|
1073
|
+
author: j.user,
|
|
1074
|
+
text: a
|
|
1075
|
+
}, r = await this.exchange(a);
|
|
1076
|
+
return [s, r.message];
|
|
1445
1077
|
}
|
|
1446
1078
|
async start(t) {
|
|
1447
|
-
return { ...await this.exchange(
|
|
1079
|
+
return { ...await this.exchange(Bt(t)), phase: b.running };
|
|
1448
1080
|
}
|
|
1449
|
-
sendMessage(t) {
|
|
1450
|
-
return this.exchange(t);
|
|
1081
|
+
sendMessage(t, a) {
|
|
1082
|
+
return this.exchange(t, a);
|
|
1451
1083
|
}
|
|
1452
1084
|
async stop() {
|
|
1453
1085
|
}
|
|
1454
1086
|
seedChecklist(t) {
|
|
1455
1087
|
this.seededChecklist = t;
|
|
1456
1088
|
}
|
|
1457
|
-
async exchange(t) {
|
|
1458
|
-
var
|
|
1089
|
+
async exchange(t, a) {
|
|
1090
|
+
var l;
|
|
1459
1091
|
const s = [
|
|
1460
|
-
{ role:
|
|
1461
|
-
],
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1092
|
+
{ role: Ut.user, content: t }
|
|
1093
|
+
], r = await this.client.chat(
|
|
1094
|
+
this.agentId,
|
|
1095
|
+
{
|
|
1096
|
+
messages: s,
|
|
1097
|
+
...this.chatId ? { chat_id: this.chatId } : {},
|
|
1098
|
+
...this.model ? { model: this.model } : {},
|
|
1099
|
+
moderation_enabled: !0,
|
|
1100
|
+
meta: {
|
|
1101
|
+
feature_id: "agent_view",
|
|
1102
|
+
source: "agent_view_frontend"
|
|
1103
|
+
}
|
|
1104
|
+
},
|
|
1105
|
+
...a && a.length > 0 ? [{ uploadFiles: a }] : []
|
|
1106
|
+
);
|
|
1107
|
+
return this.chatId = r.chat_id, { message: {
|
|
1108
|
+
id: r.event_id || Me("msg-agent"),
|
|
1109
|
+
author: j.agent,
|
|
1110
|
+
text: r.message.content,
|
|
1111
|
+
...(l = r.follow_up_prompts) != null && l.length ? { followUpPrompts: r.follow_up_prompts } : {}
|
|
1476
1112
|
} };
|
|
1477
1113
|
}
|
|
1478
1114
|
}
|
|
1479
|
-
const
|
|
1480
|
-
var
|
|
1481
|
-
return new
|
|
1115
|
+
const Ve = (e, t) => (a) => {
|
|
1116
|
+
var s;
|
|
1117
|
+
return new zt(e, a.invocation_id, {
|
|
1482
1118
|
model: t == null ? void 0 : t.model,
|
|
1483
1119
|
bootstrapPrompt: t == null ? void 0 : t.bootstrapPrompt,
|
|
1484
|
-
openingMessage: ((
|
|
1120
|
+
openingMessage: ((s = t == null ? void 0 : t.resolveOpeningMessage) == null ? void 0 : s.call(t, a)) ?? (t == null ? void 0 : t.openingMessage)
|
|
1485
1121
|
});
|
|
1486
|
-
},
|
|
1122
|
+
}, Kt = (e) => {
|
|
1487
1123
|
switch (e) {
|
|
1488
1124
|
case xe.cancelled:
|
|
1489
1125
|
return v.failed;
|
|
@@ -1497,22 +1133,22 @@ const Jt = (e, t) => (s) => {
|
|
|
1497
1133
|
default:
|
|
1498
1134
|
return v["generating-a-response"];
|
|
1499
1135
|
}
|
|
1500
|
-
},
|
|
1136
|
+
}, qt = (e) => {
|
|
1501
1137
|
switch (e) {
|
|
1502
|
-
case
|
|
1503
|
-
return
|
|
1504
|
-
case
|
|
1505
|
-
case
|
|
1506
|
-
return
|
|
1507
|
-
case
|
|
1508
|
-
case
|
|
1509
|
-
case
|
|
1510
|
-
case
|
|
1138
|
+
case Te.requires_attention:
|
|
1139
|
+
return S.hitl;
|
|
1140
|
+
case Te.in_progress:
|
|
1141
|
+
case Te.available:
|
|
1142
|
+
return S["generating-a-response"];
|
|
1143
|
+
case S.failed:
|
|
1144
|
+
case S.complete:
|
|
1145
|
+
case S.hitl:
|
|
1146
|
+
case S["generating-a-response"]:
|
|
1511
1147
|
return e;
|
|
1512
1148
|
default:
|
|
1513
|
-
return
|
|
1149
|
+
return S["generating-a-response"];
|
|
1514
1150
|
}
|
|
1515
|
-
},
|
|
1151
|
+
}, Wt = (e) => ({
|
|
1516
1152
|
ref: e.name,
|
|
1517
1153
|
display_name: e.display_name,
|
|
1518
1154
|
agent_intent: e.agent_intent ?? e.display_name,
|
|
@@ -1521,171 +1157,609 @@ const Jt = (e, t) => (s) => {
|
|
|
1521
1157
|
id: e.id,
|
|
1522
1158
|
name: e.name,
|
|
1523
1159
|
...e.has_run_before ? { hasRunBefore: e.has_run_before } : {}
|
|
1524
|
-
}),
|
|
1160
|
+
}), Jt = new Set(Object.values(re)), jt = (e) => e && Jt.has(e) ? e : re.LINK, Vt = (e) => ({
|
|
1525
1161
|
uri: e.uri ?? "",
|
|
1526
|
-
type:
|
|
1162
|
+
type: jt(e.type),
|
|
1527
1163
|
name: e.name ?? "",
|
|
1528
1164
|
description: e.description ?? ""
|
|
1529
|
-
}),
|
|
1530
|
-
var
|
|
1165
|
+
}), Ye = (e) => (Array.isArray(e) ? e : e.resources ?? []).map(Vt), De = (e) => {
|
|
1166
|
+
var a;
|
|
1531
1167
|
const t = e.invocation_id ?? e.id;
|
|
1532
1168
|
return {
|
|
1533
1169
|
id: e.id,
|
|
1534
1170
|
invocation_id: t,
|
|
1535
1171
|
agent_definition_ref: e.agent_definition_ref,
|
|
1536
1172
|
...e.agent_intent ? { agent_intent: e.agent_intent } : {},
|
|
1537
|
-
invocation_name: ((
|
|
1173
|
+
invocation_name: ((a = e.invocation_name) == null ? void 0 : a.trim()) || e.agent_definition_ref,
|
|
1538
1174
|
application_id: e.application_id,
|
|
1539
1175
|
...e.application_name ? { application_name: e.application_name } : {},
|
|
1540
1176
|
created_by: e.created_by,
|
|
1541
|
-
status:
|
|
1177
|
+
status: Kt(e.status),
|
|
1542
1178
|
context_ref: e.context_ref ?? null,
|
|
1543
1179
|
checklist_ref: e.checklist_ref ?? null
|
|
1544
1180
|
};
|
|
1545
|
-
},
|
|
1181
|
+
}, Qe = (e) => {
|
|
1546
1182
|
var t;
|
|
1547
1183
|
return {
|
|
1548
|
-
task: e.task ?? e.name ?? e.label ??
|
|
1549
|
-
status:
|
|
1184
|
+
task: e.task ?? e.name ?? e.label ?? ht,
|
|
1185
|
+
status: qt(e.status),
|
|
1550
1186
|
description: e.description ?? "",
|
|
1551
1187
|
...e.prompt ? { prompt: e.prompt } : {},
|
|
1552
1188
|
...(t = e.follow_up_prompts) != null && t.length ? { clarificationPrompts: e.follow_up_prompts } : {}
|
|
1553
1189
|
};
|
|
1554
|
-
},
|
|
1555
|
-
var
|
|
1556
|
-
const
|
|
1190
|
+
}, Yt = (e) => Array.isArray(e) ? e : e.checklist_items ?? e.checklist ?? e.items ?? [], Xe = (e, t, a) => {
|
|
1191
|
+
var c;
|
|
1192
|
+
const s = !Array.isArray(t) && (t.opening_message || (c = t.opening_follow_up_prompts) != null && c.length) ? t : a, r = s ? we(s) : void 0;
|
|
1557
1193
|
return {
|
|
1558
1194
|
invocation_id: e,
|
|
1559
|
-
checklist:
|
|
1195
|
+
checklist: Yt(t).map(Qe),
|
|
1560
1196
|
...r ? { openingMessage: r } : {}
|
|
1561
1197
|
};
|
|
1562
1198
|
}, vn = (e, t) => {
|
|
1563
|
-
const
|
|
1199
|
+
const a = we(t);
|
|
1564
1200
|
return {
|
|
1565
1201
|
invocation_id: t.invocation_id ?? e,
|
|
1566
|
-
checklist: (t.checklist_items ?? []).map(
|
|
1567
|
-
...
|
|
1202
|
+
checklist: (t.checklist_items ?? []).map(Qe),
|
|
1203
|
+
...a ? { openingMessage: a } : {}
|
|
1568
1204
|
};
|
|
1569
|
-
},
|
|
1570
|
-
var
|
|
1571
|
-
const t = (
|
|
1205
|
+
}, we = (e) => {
|
|
1206
|
+
var a, s;
|
|
1207
|
+
const t = (a = e.opening_message) == null ? void 0 : a.trim();
|
|
1572
1208
|
if (t)
|
|
1573
1209
|
return {
|
|
1574
|
-
id:
|
|
1575
|
-
author:
|
|
1210
|
+
id: Ke,
|
|
1211
|
+
author: j.agent,
|
|
1576
1212
|
text: t,
|
|
1577
|
-
...(
|
|
1213
|
+
...(s = e.opening_follow_up_prompts) != null && s.length ? { followUpPrompts: e.opening_follow_up_prompts } : {}
|
|
1578
1214
|
};
|
|
1579
|
-
},
|
|
1215
|
+
}, Qt = (e) => e instanceof ue ? e.message : e instanceof TypeError ? "Network error while contacting the agent service." : e instanceof Error && e.message ? e.message : qe, Xt = (e) => {
|
|
1580
1216
|
const t = {};
|
|
1581
|
-
for (const
|
|
1582
|
-
const
|
|
1583
|
-
if (!
|
|
1217
|
+
for (const a of e) {
|
|
1218
|
+
const s = we(a);
|
|
1219
|
+
if (!s)
|
|
1584
1220
|
continue;
|
|
1585
|
-
const r =
|
|
1586
|
-
t[r] =
|
|
1221
|
+
const r = a.invocation_id ?? a.id;
|
|
1222
|
+
t[r] = s, t[a.id] = s;
|
|
1587
1223
|
}
|
|
1588
1224
|
return t;
|
|
1589
|
-
},
|
|
1590
|
-
const { jwt: t, headers:
|
|
1591
|
-
() => {
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
headers: s,
|
|
1597
|
-
urls: C
|
|
1598
|
-
});
|
|
1599
|
-
},
|
|
1225
|
+
}, Zt = (e) => JSON.stringify(e), en = (e) => {
|
|
1226
|
+
const { jwt: t, headers: a, urls: s } = e, r = JSON.stringify(a ?? {}), c = Zt(s), l = U(
|
|
1227
|
+
() => new je({
|
|
1228
|
+
token: t,
|
|
1229
|
+
headers: a,
|
|
1230
|
+
urls: s
|
|
1231
|
+
}),
|
|
1600
1232
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- keyed on serialised config to keep a stable client.
|
|
1601
|
-
[t,
|
|
1233
|
+
[t, c]
|
|
1602
1234
|
);
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
}, [
|
|
1606
|
-
const [d, w] =
|
|
1235
|
+
Ge(() => {
|
|
1236
|
+
l.setHeaders(a);
|
|
1237
|
+
}, [l, r]);
|
|
1238
|
+
const [d, w] = m([]), [f, p] = m(
|
|
1607
1239
|
[]
|
|
1608
|
-
), [
|
|
1609
|
-
|
|
1610
|
-
let
|
|
1611
|
-
return
|
|
1240
|
+
), [_, u] = m({}), [C, R] = m("loading"), [y, A] = m(null), [k, $] = m(0);
|
|
1241
|
+
G(() => {
|
|
1242
|
+
let N = !1;
|
|
1243
|
+
return R("loading"), A(null), (async () => {
|
|
1612
1244
|
try {
|
|
1613
|
-
const [
|
|
1614
|
-
|
|
1615
|
-
|
|
1245
|
+
const [I, D] = await Promise.all([
|
|
1246
|
+
l.listAgents(),
|
|
1247
|
+
l.listAgentDefinitions()
|
|
1616
1248
|
]);
|
|
1617
|
-
if (
|
|
1249
|
+
if (N)
|
|
1618
1250
|
return;
|
|
1619
|
-
w(
|
|
1620
|
-
} catch (
|
|
1621
|
-
if (
|
|
1251
|
+
w(I.map(De)), p(D.map(Wt)), u(Xt(I)), R("idle");
|
|
1252
|
+
} catch (I) {
|
|
1253
|
+
if (N)
|
|
1622
1254
|
return;
|
|
1623
|
-
w([]), p([]),
|
|
1255
|
+
w([]), p([]), u({}), R("error"), A(Qt(I));
|
|
1624
1256
|
}
|
|
1625
1257
|
})(), () => {
|
|
1626
|
-
|
|
1258
|
+
N = !0;
|
|
1627
1259
|
};
|
|
1628
|
-
}, [
|
|
1629
|
-
const
|
|
1630
|
-
|
|
1631
|
-
}, []),
|
|
1632
|
-
async (
|
|
1633
|
-
const [
|
|
1634
|
-
|
|
1635
|
-
|
|
1260
|
+
}, [l, k]);
|
|
1261
|
+
const V = T(() => {
|
|
1262
|
+
$((N) => N + 1);
|
|
1263
|
+
}, []), M = T(
|
|
1264
|
+
async (N) => {
|
|
1265
|
+
const [I, D] = await Promise.all([
|
|
1266
|
+
l.getAgentChecklist(N),
|
|
1267
|
+
l.getAgent(N).catch(() => null)
|
|
1636
1268
|
]);
|
|
1637
|
-
return
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1269
|
+
return Xe(
|
|
1270
|
+
N,
|
|
1271
|
+
I,
|
|
1272
|
+
D ?? void 0
|
|
1641
1273
|
);
|
|
1642
1274
|
},
|
|
1643
|
-
[
|
|
1644
|
-
),
|
|
1645
|
-
async (
|
|
1646
|
-
const
|
|
1647
|
-
return
|
|
1275
|
+
[l]
|
|
1276
|
+
), ee = T(
|
|
1277
|
+
async (N) => {
|
|
1278
|
+
const I = await l.getAgentResources(N);
|
|
1279
|
+
return Ye(I);
|
|
1648
1280
|
},
|
|
1649
|
-
[
|
|
1650
|
-
),
|
|
1281
|
+
[l]
|
|
1282
|
+
), te = T(
|
|
1651
1283
|
async ({
|
|
1652
|
-
definition:
|
|
1653
|
-
invocationName:
|
|
1284
|
+
definition: N,
|
|
1285
|
+
invocationName: I
|
|
1654
1286
|
}) => {
|
|
1655
|
-
const
|
|
1656
|
-
invocationName:
|
|
1657
|
-
}),
|
|
1658
|
-
return w((
|
|
1659
|
-
...
|
|
1660
|
-
[
|
|
1661
|
-
[
|
|
1662
|
-
})),
|
|
1287
|
+
const D = await l.createAgent(N.ref, {
|
|
1288
|
+
invocationName: I
|
|
1289
|
+
}), Q = await l.getAgent(D.id), P = De(Q), B = we(Q);
|
|
1290
|
+
return w((z) => [P, ...z]), B && u((z) => ({
|
|
1291
|
+
...z,
|
|
1292
|
+
[P.invocation_id]: B,
|
|
1293
|
+
[P.id]: B
|
|
1294
|
+
})), P;
|
|
1663
1295
|
},
|
|
1664
|
-
[
|
|
1665
|
-
),
|
|
1666
|
-
() =>
|
|
1667
|
-
resolveOpeningMessage: (
|
|
1296
|
+
[l]
|
|
1297
|
+
), Y = U(
|
|
1298
|
+
() => Ve(l, {
|
|
1299
|
+
resolveOpeningMessage: (N) => _[N.invocation_id] ?? _[N.id]
|
|
1668
1300
|
}),
|
|
1669
|
-
[
|
|
1301
|
+
[l, _]
|
|
1670
1302
|
);
|
|
1671
1303
|
return {
|
|
1672
1304
|
agents: d,
|
|
1673
|
-
agentDefinitions:
|
|
1674
|
-
loadState:
|
|
1675
|
-
loadError:
|
|
1676
|
-
reload:
|
|
1677
|
-
fetchAgentChecklist:
|
|
1678
|
-
fetchAgentResources:
|
|
1679
|
-
createAgent:
|
|
1680
|
-
chatConnector:
|
|
1305
|
+
agentDefinitions: f,
|
|
1306
|
+
loadState: C,
|
|
1307
|
+
loadError: y,
|
|
1308
|
+
reload: V,
|
|
1309
|
+
fetchAgentChecklist: M,
|
|
1310
|
+
fetchAgentResources: ee,
|
|
1311
|
+
createAgent: te,
|
|
1312
|
+
chatConnector: Y
|
|
1313
|
+
};
|
|
1314
|
+
}, tn = (e) => JSON.stringify(e), nn = (e) => {
|
|
1315
|
+
const { agent: t, jwt: a, headers: s, urls: r } = e, c = JSON.stringify(s ?? {}), l = tn(r), d = U(
|
|
1316
|
+
() => new je({
|
|
1317
|
+
token: a,
|
|
1318
|
+
headers: s,
|
|
1319
|
+
urls: {
|
|
1320
|
+
agent: r.agentUrl,
|
|
1321
|
+
agentChecklist: r.agentChecklistUrl,
|
|
1322
|
+
...r.agentResourcesUrl ? { agentResources: r.agentResourcesUrl } : {},
|
|
1323
|
+
agentChat: r.agentChatUrl
|
|
1324
|
+
}
|
|
1325
|
+
}),
|
|
1326
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- keyed on serialised config to keep a stable client.
|
|
1327
|
+
[a, l]
|
|
1328
|
+
);
|
|
1329
|
+
Ge(() => {
|
|
1330
|
+
d.setHeaders(s);
|
|
1331
|
+
}, [d, c]);
|
|
1332
|
+
const w = T(
|
|
1333
|
+
async (_) => {
|
|
1334
|
+
const [u, C] = await Promise.all([
|
|
1335
|
+
d.getAgentChecklist(_),
|
|
1336
|
+
d.getAgent(_).catch(() => null)
|
|
1337
|
+
]);
|
|
1338
|
+
return Xe(
|
|
1339
|
+
_,
|
|
1340
|
+
u,
|
|
1341
|
+
C ?? void 0
|
|
1342
|
+
);
|
|
1343
|
+
},
|
|
1344
|
+
[d]
|
|
1345
|
+
), f = T(
|
|
1346
|
+
async (_) => {
|
|
1347
|
+
const u = await d.getAgentResources(_);
|
|
1348
|
+
return Ye(u);
|
|
1349
|
+
},
|
|
1350
|
+
[d]
|
|
1351
|
+
);
|
|
1352
|
+
return {
|
|
1353
|
+
connector: U(
|
|
1354
|
+
() => Ve(d)(t),
|
|
1355
|
+
[d, t]
|
|
1356
|
+
),
|
|
1357
|
+
fetchAgentChecklist: w,
|
|
1358
|
+
fetchAgentResources: f
|
|
1681
1359
|
};
|
|
1682
|
-
},
|
|
1360
|
+
}, an = (e, t) => {
|
|
1361
|
+
const a = e.hasRunBefore ? t || "This trip" : e.tripName.trim() || "A new trip", s = e.destination ? ` to ${e.destination}` : "", r = e.hasRunBefore ? " It has run before." : "";
|
|
1362
|
+
return `${a}${s}.${r}`.trim();
|
|
1363
|
+
}, sn = (e) => {
|
|
1364
|
+
switch (e) {
|
|
1365
|
+
case v.failed:
|
|
1366
|
+
return b.stopped;
|
|
1367
|
+
case v.complete:
|
|
1368
|
+
return b.complete;
|
|
1369
|
+
default:
|
|
1370
|
+
return b.running;
|
|
1371
|
+
}
|
|
1372
|
+
}, He = (e, t) => {
|
|
1373
|
+
t([pe(e)]);
|
|
1374
|
+
}, rn = ({
|
|
1375
|
+
agent: e,
|
|
1376
|
+
open: t,
|
|
1377
|
+
onClose: a,
|
|
1378
|
+
jwt: s,
|
|
1379
|
+
headers: r,
|
|
1380
|
+
agentUrl: c,
|
|
1381
|
+
agentChecklistUrl: l,
|
|
1382
|
+
agentResourcesUrl: d,
|
|
1383
|
+
agentChatUrl: w,
|
|
1384
|
+
enableUpload: f,
|
|
1385
|
+
initialBrief: p,
|
|
1386
|
+
initialPhase: _,
|
|
1387
|
+
initialChecklist: u
|
|
1388
|
+
}) => {
|
|
1389
|
+
const { connector: C, fetchAgentChecklist: R, fetchAgentResources: y } = nn({
|
|
1390
|
+
agent: e,
|
|
1391
|
+
jwt: s,
|
|
1392
|
+
headers: r,
|
|
1393
|
+
urls: {
|
|
1394
|
+
agentUrl: c,
|
|
1395
|
+
agentChecklistUrl: l,
|
|
1396
|
+
agentResourcesUrl: d,
|
|
1397
|
+
agentChatUrl: w
|
|
1398
|
+
}
|
|
1399
|
+
}), A = Re(C), [k, $] = m(
|
|
1400
|
+
_ ?? (p ? b.running : sn(e.status))
|
|
1401
|
+
), [V, M] = m([]), [ee, te] = m(0), [Y, N] = m(), [I, D] = m(null), [Q, P] = m([]), [B, z] = m(!1), [ce, X] = m(null), [ke, K] = m(
|
|
1402
|
+
u ?? null
|
|
1403
|
+
), [ye, le] = m(!1), [Z, de] = m(null), [_e, ne] = m(!1), [ae, Ne] = m(!1), [se, Ae] = m(!1), q = Re(!1);
|
|
1404
|
+
G(() => {
|
|
1405
|
+
A.current = C;
|
|
1406
|
+
}, [C]), G(() => {
|
|
1407
|
+
q.current = !1, M([]), te((o) => o + 1);
|
|
1408
|
+
}, [e.invocation_id]), G(() => {
|
|
1409
|
+
if (!t || p || q.current)
|
|
1410
|
+
return;
|
|
1411
|
+
const o = A.current.bootstrapConversation;
|
|
1412
|
+
if (!o) {
|
|
1413
|
+
He(
|
|
1414
|
+
A.current.openingMessage(),
|
|
1415
|
+
M
|
|
1416
|
+
);
|
|
1417
|
+
return;
|
|
1418
|
+
}
|
|
1419
|
+
q.current = !0;
|
|
1420
|
+
let g = !1;
|
|
1421
|
+
return ne(!0), (async () => {
|
|
1422
|
+
try {
|
|
1423
|
+
const h = await o.call(A.current);
|
|
1424
|
+
if (g)
|
|
1425
|
+
return;
|
|
1426
|
+
M(h.map(pe));
|
|
1427
|
+
} catch {
|
|
1428
|
+
g || He(
|
|
1429
|
+
A.current.openingMessage(),
|
|
1430
|
+
M
|
|
1431
|
+
);
|
|
1432
|
+
} finally {
|
|
1433
|
+
g || ne(!1);
|
|
1434
|
+
}
|
|
1435
|
+
})(), () => {
|
|
1436
|
+
g = !0;
|
|
1437
|
+
};
|
|
1438
|
+
}, [t, p, e.invocation_id, C]);
|
|
1439
|
+
const Se = T((o) => {
|
|
1440
|
+
o.checklist && K(o.checklist), o.phase && $(o.phase);
|
|
1441
|
+
}, []);
|
|
1442
|
+
G(() => {
|
|
1443
|
+
var o, g;
|
|
1444
|
+
!t || p || u && u.length > 0 && ((g = (o = A.current).seedChecklist) == null || g.call(o, u));
|
|
1445
|
+
}, [t, p, u]), G(() => {
|
|
1446
|
+
if (!t || p)
|
|
1447
|
+
return;
|
|
1448
|
+
let o = !1;
|
|
1449
|
+
return le(!(u != null && u.length)), de(null), (async () => {
|
|
1450
|
+
var g, h;
|
|
1451
|
+
try {
|
|
1452
|
+
const L = await R(e.invocation_id);
|
|
1453
|
+
if (o)
|
|
1454
|
+
return;
|
|
1455
|
+
u != null && u.length || (K(L.checklist), (h = (g = A.current).seedChecklist) == null || h.call(g, L.checklist));
|
|
1456
|
+
} catch {
|
|
1457
|
+
!o && !(u != null && u.length) && de(Ee);
|
|
1458
|
+
} finally {
|
|
1459
|
+
o || le(!1);
|
|
1460
|
+
}
|
|
1461
|
+
})(), () => {
|
|
1462
|
+
o = !0;
|
|
1463
|
+
};
|
|
1464
|
+
}, [
|
|
1465
|
+
t,
|
|
1466
|
+
e.invocation_id,
|
|
1467
|
+
p,
|
|
1468
|
+
u,
|
|
1469
|
+
R
|
|
1470
|
+
]), G(() => {
|
|
1471
|
+
if (!t || !d)
|
|
1472
|
+
return;
|
|
1473
|
+
let o = !1;
|
|
1474
|
+
return z(!0), X(null), (async () => {
|
|
1475
|
+
try {
|
|
1476
|
+
const g = await y(
|
|
1477
|
+
e.invocation_id
|
|
1478
|
+
);
|
|
1479
|
+
o || P(g);
|
|
1480
|
+
} catch {
|
|
1481
|
+
o || X(pt);
|
|
1482
|
+
} finally {
|
|
1483
|
+
o || z(!1);
|
|
1484
|
+
}
|
|
1485
|
+
})(), () => {
|
|
1486
|
+
o = !0;
|
|
1487
|
+
};
|
|
1488
|
+
}, [t, e.invocation_id, d, y]), G(() => {
|
|
1489
|
+
if (!t || !p || q.current)
|
|
1490
|
+
return;
|
|
1491
|
+
q.current = !0;
|
|
1492
|
+
const o = {
|
|
1493
|
+
id: `user-brief-${Date.now()}`,
|
|
1494
|
+
author: j.user,
|
|
1495
|
+
text: an(p, e.invocation_name)
|
|
1496
|
+
};
|
|
1497
|
+
(async () => {
|
|
1498
|
+
const g = await A.current.start(p);
|
|
1499
|
+
M([
|
|
1500
|
+
pe(A.current.openingMessage()),
|
|
1501
|
+
pe(o),
|
|
1502
|
+
pe(g.message)
|
|
1503
|
+
]), g.checklist && K(g.checklist), $(g.phase ?? b.running);
|
|
1504
|
+
})();
|
|
1505
|
+
}, [t, p, e.invocation_name]);
|
|
1506
|
+
const be = T(
|
|
1507
|
+
(o) => {
|
|
1508
|
+
D(xt(o));
|
|
1509
|
+
},
|
|
1510
|
+
[]
|
|
1511
|
+
), Ce = T((o) => {
|
|
1512
|
+
D(null), N(o), te((g) => g + 1);
|
|
1513
|
+
}, []), me = T(async () => {
|
|
1514
|
+
await A.current.stop(), $(b.stopped);
|
|
1515
|
+
}, []), fe = ke;
|
|
1516
|
+
return /* @__PURE__ */ i(
|
|
1517
|
+
W,
|
|
1518
|
+
{
|
|
1519
|
+
open: t,
|
|
1520
|
+
closeHandler: a,
|
|
1521
|
+
hideCloseButton: !0,
|
|
1522
|
+
className: "agent-workspace",
|
|
1523
|
+
children: [
|
|
1524
|
+
/* @__PURE__ */ i(W.Header, { className: "agent-workspace__header", children: [
|
|
1525
|
+
/* @__PURE__ */ i("div", { className: "agent-workspace__header-title", children: [
|
|
1526
|
+
/* @__PURE__ */ n(
|
|
1527
|
+
"span",
|
|
1528
|
+
{
|
|
1529
|
+
className: "agent-workspace__header-avatar",
|
|
1530
|
+
"aria-hidden": "true",
|
|
1531
|
+
children: /* @__PURE__ */ n(E, { name: "ask-arbor", size: 24 })
|
|
1532
|
+
}
|
|
1533
|
+
),
|
|
1534
|
+
/* @__PURE__ */ n(W.Title, { children: e.invocation_name }),
|
|
1535
|
+
/* @__PURE__ */ n(
|
|
1536
|
+
"span",
|
|
1537
|
+
{
|
|
1538
|
+
className: H(
|
|
1539
|
+
"agent-workspace__phase",
|
|
1540
|
+
`agent-workspace__phase--${k}`
|
|
1541
|
+
),
|
|
1542
|
+
children: mt[k]
|
|
1543
|
+
}
|
|
1544
|
+
)
|
|
1545
|
+
] }),
|
|
1546
|
+
/* @__PURE__ */ i("div", { className: "agent-workspace__header-actions", children: [
|
|
1547
|
+
/* @__PURE__ */ n(
|
|
1548
|
+
J,
|
|
1549
|
+
{
|
|
1550
|
+
variant: "tertiary",
|
|
1551
|
+
size: "S",
|
|
1552
|
+
iconLeftName: "clipboard-list",
|
|
1553
|
+
iconLeftScreenReaderText: "Toggle checklist",
|
|
1554
|
+
"aria-pressed": !se,
|
|
1555
|
+
onClick: () => Ae((o) => !o),
|
|
1556
|
+
children: "Checklist"
|
|
1557
|
+
}
|
|
1558
|
+
),
|
|
1559
|
+
/* @__PURE__ */ n(
|
|
1560
|
+
J,
|
|
1561
|
+
{
|
|
1562
|
+
variant: "tertiary",
|
|
1563
|
+
size: "S",
|
|
1564
|
+
iconLeftName: "files",
|
|
1565
|
+
iconLeftScreenReaderText: "Toggle resources",
|
|
1566
|
+
"aria-pressed": !ae,
|
|
1567
|
+
onClick: () => Ne((o) => !o),
|
|
1568
|
+
children: "Resources"
|
|
1569
|
+
}
|
|
1570
|
+
),
|
|
1571
|
+
/* @__PURE__ */ n(
|
|
1572
|
+
J,
|
|
1573
|
+
{
|
|
1574
|
+
variant: "secondary",
|
|
1575
|
+
size: "S",
|
|
1576
|
+
iconLeftName: "x",
|
|
1577
|
+
iconLeftScreenReaderText: "Close",
|
|
1578
|
+
onClick: a,
|
|
1579
|
+
children: "Close"
|
|
1580
|
+
}
|
|
1581
|
+
)
|
|
1582
|
+
] })
|
|
1583
|
+
] }),
|
|
1584
|
+
/* @__PURE__ */ i(
|
|
1585
|
+
W.Body,
|
|
1586
|
+
{
|
|
1587
|
+
className: H("agent-workspace__body", {
|
|
1588
|
+
"agent-workspace__body--no-left": se,
|
|
1589
|
+
"agent-workspace__body--no-right": ae
|
|
1590
|
+
}),
|
|
1591
|
+
children: [
|
|
1592
|
+
!se && /* @__PURE__ */ n(
|
|
1593
|
+
Et,
|
|
1594
|
+
{
|
|
1595
|
+
checklist: fe,
|
|
1596
|
+
isLoading: ye,
|
|
1597
|
+
error: Z,
|
|
1598
|
+
phase: k,
|
|
1599
|
+
canRequestInput: k === b.running && !_e,
|
|
1600
|
+
onStop: () => void me(),
|
|
1601
|
+
onAttentionItemClick: be
|
|
1602
|
+
}
|
|
1603
|
+
),
|
|
1604
|
+
/* @__PURE__ */ n(
|
|
1605
|
+
Tt,
|
|
1606
|
+
{
|
|
1607
|
+
connector: A.current,
|
|
1608
|
+
phase: k,
|
|
1609
|
+
chatHistory: V,
|
|
1610
|
+
chatSessionKey: ee,
|
|
1611
|
+
startQuery: Y,
|
|
1612
|
+
clarificationMessage: I,
|
|
1613
|
+
enableUpload: f,
|
|
1614
|
+
onTurn: Se,
|
|
1615
|
+
onAwaitingChange: ne,
|
|
1616
|
+
onClarificationPrompt: Ce,
|
|
1617
|
+
onDismissClarification: () => D(null)
|
|
1618
|
+
}
|
|
1619
|
+
),
|
|
1620
|
+
!ae && /* @__PURE__ */ n(
|
|
1621
|
+
Rt,
|
|
1622
|
+
{
|
|
1623
|
+
resources: Q,
|
|
1624
|
+
isLoading: B,
|
|
1625
|
+
error: ce
|
|
1626
|
+
}
|
|
1627
|
+
)
|
|
1628
|
+
]
|
|
1629
|
+
}
|
|
1630
|
+
)
|
|
1631
|
+
]
|
|
1632
|
+
}
|
|
1633
|
+
);
|
|
1634
|
+
}, on = ({
|
|
1635
|
+
open: e,
|
|
1636
|
+
onClose: t,
|
|
1637
|
+
onStart: a,
|
|
1638
|
+
agentDefinitions: s
|
|
1639
|
+
}) => {
|
|
1640
|
+
const r = s[0], [c, l] = m(
|
|
1641
|
+
r
|
|
1642
|
+
), [d, w] = m(""), [f, p] = m(!1), [_, u] = m(null), C = [...s].sort((k, $) => k.agent_intent.localeCompare($.agent_intent)).map((k) => ({
|
|
1643
|
+
value: k.ref,
|
|
1644
|
+
label: k.agent_intent
|
|
1645
|
+
}));
|
|
1646
|
+
G(() => {
|
|
1647
|
+
e && (l(r), w(""), p(!1), u(null));
|
|
1648
|
+
}, [e, r]);
|
|
1649
|
+
const R = c !== void 0 && d.trim().length > 0, y = T(
|
|
1650
|
+
(k) => {
|
|
1651
|
+
const $ = s.find(
|
|
1652
|
+
(V) => V.ref === k[0]
|
|
1653
|
+
);
|
|
1654
|
+
$ && l($);
|
|
1655
|
+
},
|
|
1656
|
+
[s]
|
|
1657
|
+
), A = T(async () => {
|
|
1658
|
+
if (!(!c || !R || f)) {
|
|
1659
|
+
p(!0), u(null);
|
|
1660
|
+
try {
|
|
1661
|
+
await a({ definition: c, invocationName: d.trim() });
|
|
1662
|
+
} catch (k) {
|
|
1663
|
+
u(
|
|
1664
|
+
k instanceof Error ? k.message : "Unable to start the agent."
|
|
1665
|
+
);
|
|
1666
|
+
} finally {
|
|
1667
|
+
p(!1);
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
}, [R, c, d, f, a]);
|
|
1671
|
+
return !c || s.length === 0 ? null : /* @__PURE__ */ i(
|
|
1672
|
+
W,
|
|
1673
|
+
{
|
|
1674
|
+
open: e,
|
|
1675
|
+
closeHandler: t,
|
|
1676
|
+
className: "new-agent",
|
|
1677
|
+
children: [
|
|
1678
|
+
/* @__PURE__ */ n(W.Header, { className: "new-agent__header", children: /* @__PURE__ */ i("div", { className: "new-agent__header-title", children: [
|
|
1679
|
+
/* @__PURE__ */ n(
|
|
1680
|
+
"span",
|
|
1681
|
+
{
|
|
1682
|
+
className: "new-agent__header-avatar",
|
|
1683
|
+
"aria-hidden": "true",
|
|
1684
|
+
children: /* @__PURE__ */ n(E, { name: "ask-arbor", size: 24 })
|
|
1685
|
+
}
|
|
1686
|
+
),
|
|
1687
|
+
/* @__PURE__ */ n(W.Title, { children: "Start an agent" })
|
|
1688
|
+
] }) }),
|
|
1689
|
+
/* @__PURE__ */ n(W.Body, { className: "new-agent__body", children: /* @__PURE__ */ i(
|
|
1690
|
+
"form",
|
|
1691
|
+
{
|
|
1692
|
+
className: "new-agent__form",
|
|
1693
|
+
"aria-label": "Start an agent",
|
|
1694
|
+
onSubmit: (k) => {
|
|
1695
|
+
k.preventDefault(), R && !f && A();
|
|
1696
|
+
},
|
|
1697
|
+
children: [
|
|
1698
|
+
/* @__PURE__ */ i("div", { className: "new-agent__type-field", children: [
|
|
1699
|
+
/* @__PURE__ */ n(
|
|
1700
|
+
"label",
|
|
1701
|
+
{
|
|
1702
|
+
className: "new-agent__type-label",
|
|
1703
|
+
htmlFor: "new-agent-type",
|
|
1704
|
+
children: "What would you like your agent to do?"
|
|
1705
|
+
}
|
|
1706
|
+
),
|
|
1707
|
+
/* @__PURE__ */ n(
|
|
1708
|
+
tt,
|
|
1709
|
+
{
|
|
1710
|
+
id: "new-agent-type",
|
|
1711
|
+
placeholder: "Choose an intent",
|
|
1712
|
+
options: C,
|
|
1713
|
+
selectedValues: [c.ref],
|
|
1714
|
+
onSelectionChange: y
|
|
1715
|
+
}
|
|
1716
|
+
),
|
|
1717
|
+
/* @__PURE__ */ n("p", { className: "new-agent__type-description", children: c.description })
|
|
1718
|
+
] }),
|
|
1719
|
+
/* @__PURE__ */ i("div", { className: "new-agent__type-field", children: [
|
|
1720
|
+
/* @__PURE__ */ n(
|
|
1721
|
+
"label",
|
|
1722
|
+
{
|
|
1723
|
+
className: "new-agent__type-label",
|
|
1724
|
+
htmlFor: "new-agent-invocation-name",
|
|
1725
|
+
children: "Name"
|
|
1726
|
+
}
|
|
1727
|
+
),
|
|
1728
|
+
/* @__PURE__ */ n(
|
|
1729
|
+
nt,
|
|
1730
|
+
{
|
|
1731
|
+
id: "new-agent-invocation-name",
|
|
1732
|
+
value: d,
|
|
1733
|
+
placeholder: "e.g. Test with memory3",
|
|
1734
|
+
onChange: (k) => w(k.target.value)
|
|
1735
|
+
}
|
|
1736
|
+
)
|
|
1737
|
+
] }),
|
|
1738
|
+
_ ? /* @__PURE__ */ n("p", { className: "new-agent__error", role: "alert", children: _ }) : null,
|
|
1739
|
+
/* @__PURE__ */ n("div", { className: "new-agent__actions", children: /* @__PURE__ */ n(
|
|
1740
|
+
J,
|
|
1741
|
+
{
|
|
1742
|
+
type: "submit",
|
|
1743
|
+
variant: "primary",
|
|
1744
|
+
disabled: !R || f,
|
|
1745
|
+
iconLeftName: f ? "loader" : "sparkles",
|
|
1746
|
+
iconLeftScreenReaderText: f ? "Starting" : void 0,
|
|
1747
|
+
children: f ? "Starting…" : "Start"
|
|
1748
|
+
}
|
|
1749
|
+
) })
|
|
1750
|
+
]
|
|
1751
|
+
}
|
|
1752
|
+
) })
|
|
1753
|
+
]
|
|
1754
|
+
}
|
|
1755
|
+
);
|
|
1756
|
+
}, cn = (e) => e !== void 0 && e.some((t) => t.status === S.hitl), ln = (e, t) => cn(t) ? v.hitl : e.status, dn = ({ column: e, label: t }) => e.statusIcon ? /* @__PURE__ */ n("span", { className: "agent-view__status-indicator", children: /* @__PURE__ */ n(
|
|
1683
1757
|
E,
|
|
1684
1758
|
{
|
|
1685
1759
|
name: e.statusIcon.name,
|
|
1686
1760
|
size: 16,
|
|
1687
1761
|
color: e.statusIcon.color,
|
|
1688
|
-
className:
|
|
1762
|
+
className: H({
|
|
1689
1763
|
"agent-view__progress-icon--spinning": e.statusIcon.spin
|
|
1690
1764
|
}),
|
|
1691
1765
|
screenReaderText: t
|
|
@@ -1693,48 +1767,48 @@ const Jt = (e, t) => (s) => {
|
|
|
1693
1767
|
) }) : /* @__PURE__ */ n(
|
|
1694
1768
|
"span",
|
|
1695
1769
|
{
|
|
1696
|
-
className:
|
|
1770
|
+
className: H("agent-view__dot", {
|
|
1697
1771
|
[`agent-view__dot--${e.dotModifier}`]: e.dotModifier
|
|
1698
1772
|
}),
|
|
1699
|
-
children: /* @__PURE__ */ n(
|
|
1773
|
+
children: /* @__PURE__ */ n(Be, { colour: e.dotColour, label: t })
|
|
1700
1774
|
}
|
|
1701
1775
|
), gn = ({
|
|
1702
1776
|
agent: e,
|
|
1703
1777
|
agentName: t,
|
|
1704
|
-
column:
|
|
1705
|
-
isExpanded:
|
|
1778
|
+
column: a,
|
|
1779
|
+
isExpanded: s,
|
|
1706
1780
|
isLoading: r,
|
|
1707
|
-
checklist:
|
|
1708
|
-
error:
|
|
1781
|
+
checklist: c,
|
|
1782
|
+
error: l,
|
|
1709
1783
|
onToggle: d,
|
|
1710
1784
|
onViewAgent: w
|
|
1711
1785
|
}) => {
|
|
1712
|
-
const { id:
|
|
1786
|
+
const { id: f, invocation_name: p } = e, _ = `agent-card-${f}-header`, u = `agent-card-${f}-progress`;
|
|
1713
1787
|
return /* @__PURE__ */ n(
|
|
1714
1788
|
"li",
|
|
1715
1789
|
{
|
|
1716
|
-
className:
|
|
1717
|
-
"agent-view__card--expanded":
|
|
1790
|
+
className: H("agent-view__card", {
|
|
1791
|
+
"agent-view__card--expanded": s
|
|
1718
1792
|
}),
|
|
1719
|
-
children: /* @__PURE__ */ i(
|
|
1793
|
+
children: /* @__PURE__ */ i(at, { spacing: "dense", children: [
|
|
1720
1794
|
/* @__PURE__ */ n(
|
|
1721
1795
|
"button",
|
|
1722
1796
|
{
|
|
1723
1797
|
type: "button",
|
|
1724
1798
|
className: "agent-view__card-toggle",
|
|
1725
|
-
"aria-expanded":
|
|
1726
|
-
"aria-controls":
|
|
1799
|
+
"aria-expanded": s,
|
|
1800
|
+
"aria-controls": u,
|
|
1727
1801
|
"aria-label": p,
|
|
1728
|
-
id:
|
|
1729
|
-
onClick: () => d(
|
|
1802
|
+
id: _,
|
|
1803
|
+
onClick: () => d(f),
|
|
1730
1804
|
children: /* @__PURE__ */ i("div", { className: "agent-view__card-content", children: [
|
|
1731
|
-
/* @__PURE__ */ n(dn, { column:
|
|
1805
|
+
/* @__PURE__ */ n(dn, { column: a }),
|
|
1732
1806
|
/* @__PURE__ */ n("span", { className: "agent-view__card-invocation-name", children: p }),
|
|
1733
1807
|
/* @__PURE__ */ n("span", { className: "agent-view__card-agent-name", children: t }),
|
|
1734
1808
|
/* @__PURE__ */ n(
|
|
1735
1809
|
E,
|
|
1736
1810
|
{
|
|
1737
|
-
name:
|
|
1811
|
+
name: s ? "chevron-up" : "chevron-down",
|
|
1738
1812
|
size: 16,
|
|
1739
1813
|
className: "agent-view__card-chevron"
|
|
1740
1814
|
}
|
|
@@ -1742,11 +1816,11 @@ const Jt = (e, t) => (s) => {
|
|
|
1742
1816
|
] })
|
|
1743
1817
|
}
|
|
1744
1818
|
),
|
|
1745
|
-
|
|
1819
|
+
s && /* @__PURE__ */ i(
|
|
1746
1820
|
"div",
|
|
1747
1821
|
{
|
|
1748
|
-
id:
|
|
1749
|
-
"aria-labelledby":
|
|
1822
|
+
id: u,
|
|
1823
|
+
"aria-labelledby": _,
|
|
1750
1824
|
className: "agent-view__card-progress",
|
|
1751
1825
|
children: [
|
|
1752
1826
|
r && /* @__PURE__ */ i("div", { className: "agent-view__progress-loading", "aria-live": "polite", children: [
|
|
@@ -1762,9 +1836,9 @@ const Jt = (e, t) => (s) => {
|
|
|
1762
1836
|
),
|
|
1763
1837
|
/* @__PURE__ */ n("span", { children: oe })
|
|
1764
1838
|
] }),
|
|
1765
|
-
!r &&
|
|
1766
|
-
!r && !
|
|
1767
|
-
!r && !
|
|
1839
|
+
!r && l && /* @__PURE__ */ n("p", { className: "agent-view__progress-error", role: "alert", children: l }),
|
|
1840
|
+
!r && !l && c !== null && /* @__PURE__ */ n(St, { checklist: c }),
|
|
1841
|
+
!r && !l && c === null && /* @__PURE__ */ i("div", { className: "agent-view__progress-loading", "aria-live": "polite", children: [
|
|
1768
1842
|
/* @__PURE__ */ n(
|
|
1769
1843
|
E,
|
|
1770
1844
|
{
|
|
@@ -1778,7 +1852,7 @@ const Jt = (e, t) => (s) => {
|
|
|
1778
1852
|
/* @__PURE__ */ n("span", { children: oe })
|
|
1779
1853
|
] }),
|
|
1780
1854
|
/* @__PURE__ */ n("div", { className: "agent-view__card-actions", children: /* @__PURE__ */ n(
|
|
1781
|
-
|
|
1855
|
+
J,
|
|
1782
1856
|
{
|
|
1783
1857
|
variant: "secondary",
|
|
1784
1858
|
size: "S",
|
|
@@ -1795,19 +1869,19 @@ const Jt = (e, t) => (s) => {
|
|
|
1795
1869
|
}, Fe = ({
|
|
1796
1870
|
column: e,
|
|
1797
1871
|
agents: t,
|
|
1798
|
-
expandedAgentId:
|
|
1799
|
-
loadingAgentId:
|
|
1872
|
+
expandedAgentId: a,
|
|
1873
|
+
loadingAgentId: s,
|
|
1800
1874
|
checklistByInvocationId: r,
|
|
1801
|
-
errorByAgentId:
|
|
1802
|
-
definitionNameByRef:
|
|
1875
|
+
errorByAgentId: c,
|
|
1876
|
+
definitionNameByRef: l,
|
|
1803
1877
|
onToggleAgent: d,
|
|
1804
1878
|
onViewAgent: w,
|
|
1805
|
-
isSplit:
|
|
1879
|
+
isSplit: f = !1
|
|
1806
1880
|
}) => /* @__PURE__ */ i(
|
|
1807
1881
|
"section",
|
|
1808
1882
|
{
|
|
1809
|
-
className:
|
|
1810
|
-
"agent-view__column--split":
|
|
1883
|
+
className: H("agent-view__column", {
|
|
1884
|
+
"agent-view__column--split": f
|
|
1811
1885
|
}),
|
|
1812
1886
|
"aria-label": e.title,
|
|
1813
1887
|
children: [
|
|
@@ -1819,12 +1893,12 @@ const Jt = (e, t) => (s) => {
|
|
|
1819
1893
|
gn,
|
|
1820
1894
|
{
|
|
1821
1895
|
agent: p,
|
|
1822
|
-
agentName:
|
|
1896
|
+
agentName: Ie(p, l),
|
|
1823
1897
|
column: e,
|
|
1824
|
-
isExpanded:
|
|
1825
|
-
isLoading:
|
|
1898
|
+
isExpanded: a === p.id,
|
|
1899
|
+
isLoading: s === p.id,
|
|
1826
1900
|
checklist: r[p.invocation_id] ?? null,
|
|
1827
|
-
error:
|
|
1901
|
+
error: c[p.id] ?? null,
|
|
1828
1902
|
onToggle: d,
|
|
1829
1903
|
onViewAgent: w
|
|
1830
1904
|
},
|
|
@@ -1832,185 +1906,178 @@ const Jt = (e, t) => (s) => {
|
|
|
1832
1906
|
)) })
|
|
1833
1907
|
]
|
|
1834
1908
|
}
|
|
1835
|
-
),
|
|
1909
|
+
), Ie = (e, t) => t.get(e.agent_definition_ref) ?? e.agent_definition_ref.replace(/_/g, " "), wn = ({
|
|
1836
1910
|
jwt: e,
|
|
1837
1911
|
headers: t,
|
|
1838
|
-
baseUrl: s,
|
|
1839
1912
|
agentDefinitionsUrl: a,
|
|
1840
|
-
agentsUrl:
|
|
1841
|
-
agentUrl:
|
|
1913
|
+
agentsUrl: s,
|
|
1914
|
+
agentUrl: r,
|
|
1842
1915
|
agentChecklistUrl: c,
|
|
1843
|
-
agentResourcesUrl:
|
|
1844
|
-
agentChatUrl:
|
|
1845
|
-
|
|
1916
|
+
agentResourcesUrl: l,
|
|
1917
|
+
agentChatUrl: d,
|
|
1918
|
+
enableUpload: w,
|
|
1919
|
+
institutions: f
|
|
1846
1920
|
}) => {
|
|
1847
|
-
var
|
|
1921
|
+
var fe;
|
|
1848
1922
|
const p = U(
|
|
1849
1923
|
() => ({
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
...
|
|
1855
|
-
|
|
1856
|
-
...w ? { agentChat: w } : {}
|
|
1924
|
+
agentDefinitions: a,
|
|
1925
|
+
agents: s,
|
|
1926
|
+
agent: r,
|
|
1927
|
+
agentChecklist: c,
|
|
1928
|
+
...l ? { agentResources: l } : {},
|
|
1929
|
+
agentChat: d
|
|
1857
1930
|
}),
|
|
1858
1931
|
[
|
|
1859
|
-
s,
|
|
1860
1932
|
a,
|
|
1933
|
+
s,
|
|
1861
1934
|
r,
|
|
1862
|
-
o,
|
|
1863
1935
|
c,
|
|
1864
|
-
|
|
1865
|
-
|
|
1936
|
+
l,
|
|
1937
|
+
d
|
|
1866
1938
|
]
|
|
1867
|
-
), [
|
|
1868
|
-
(
|
|
1869
|
-
)) == null ? void 0 :
|
|
1870
|
-
const
|
|
1871
|
-
return
|
|
1872
|
-
}, [t,
|
|
1873
|
-
agents:
|
|
1874
|
-
agentDefinitions:
|
|
1875
|
-
loadState:
|
|
1876
|
-
loadError:
|
|
1877
|
-
reload:
|
|
1878
|
-
fetchAgentChecklist:
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
const l = new Set(N.map((h) => h.application_id)), f = new Map(
|
|
1884
|
-
(g ?? []).map((h) => [h.applicationId, h.name])
|
|
1939
|
+
), [_, u] = m(null), C = _ ? (fe = f == null ? void 0 : f.find(
|
|
1940
|
+
(o) => o.applicationId === _.application_id
|
|
1941
|
+
)) == null ? void 0 : fe.applicationUrl : void 0, R = U(() => {
|
|
1942
|
+
const o = { ...t ?? {} };
|
|
1943
|
+
return C ? o[ie.arborApplicationUrl] = C : delete o[ie.arborApplicationUrl], o;
|
|
1944
|
+
}, [t, C]), {
|
|
1945
|
+
agents: y,
|
|
1946
|
+
agentDefinitions: A,
|
|
1947
|
+
loadState: k,
|
|
1948
|
+
loadError: $,
|
|
1949
|
+
reload: V,
|
|
1950
|
+
fetchAgentChecklist: M,
|
|
1951
|
+
createAgent: ee
|
|
1952
|
+
} = en({ jwt: e, headers: R, urls: p }), [te, Y] = m(!1), [N, I] = m(null), [D, Q] = m(null), [P, B] = m({}), [z, ce] = m({}), [X, ke] = m([]), [K, ye] = m([]), le = U(() => {
|
|
1953
|
+
const o = new Set(y.map((h) => h.application_id)), g = new Map(
|
|
1954
|
+
(f ?? []).map((h) => [h.applicationId, h.name])
|
|
1885
1955
|
);
|
|
1886
|
-
return [...
|
|
1887
|
-
(h,
|
|
1956
|
+
return [...o].sort(
|
|
1957
|
+
(h, L) => (g.get(h) ?? h).localeCompare(g.get(L) ?? L)
|
|
1888
1958
|
).map((h) => ({
|
|
1889
1959
|
value: h,
|
|
1890
|
-
label:
|
|
1960
|
+
label: g.get(h) ?? h
|
|
1891
1961
|
}));
|
|
1892
|
-
}, [
|
|
1893
|
-
() => new Map(
|
|
1894
|
-
[
|
|
1895
|
-
),
|
|
1896
|
-
|
|
1897
|
-
)].sort((
|
|
1898
|
-
value:
|
|
1899
|
-
label:
|
|
1900
|
-
})), [
|
|
1901
|
-
|
|
1902
|
-
if (
|
|
1962
|
+
}, [y, f]), Z = U(
|
|
1963
|
+
() => new Map(A.map((o) => [o.ref, o.display_name])),
|
|
1964
|
+
[A]
|
|
1965
|
+
), de = U(() => [...new Set(
|
|
1966
|
+
y.map((g) => Ie(g, Z))
|
|
1967
|
+
)].sort((g, h) => g.localeCompare(h)).map((g) => ({
|
|
1968
|
+
value: g,
|
|
1969
|
+
label: g
|
|
1970
|
+
})), [y, Z]), _e = U(() => y.filter((o) => !(X.length > 0 && !X.includes(o.application_id) || K.length > 0 && !K.includes(Ie(o, Z)))), [y, Z, K, X]), ne = le.length > 1, ae = de.length > 1, Ne = ne || ae;
|
|
1971
|
+
G(() => {
|
|
1972
|
+
if (y.length === 0)
|
|
1903
1973
|
return;
|
|
1904
|
-
let
|
|
1974
|
+
let o = !1;
|
|
1905
1975
|
return (async () => {
|
|
1906
|
-
const
|
|
1907
|
-
|
|
1908
|
-
const
|
|
1976
|
+
const g = await Promise.allSettled(
|
|
1977
|
+
y.map(async (h) => {
|
|
1978
|
+
const L = await M(h.invocation_id);
|
|
1909
1979
|
return {
|
|
1910
1980
|
agentId: h.id,
|
|
1911
1981
|
invocationId: h.invocation_id,
|
|
1912
|
-
checklist:
|
|
1982
|
+
checklist: L.checklist
|
|
1913
1983
|
};
|
|
1914
1984
|
})
|
|
1915
1985
|
);
|
|
1916
|
-
|
|
1917
|
-
const
|
|
1918
|
-
for (const ge of
|
|
1919
|
-
ge.status === "fulfilled" && (
|
|
1920
|
-
return
|
|
1921
|
-
}),
|
|
1922
|
-
const
|
|
1923
|
-
return
|
|
1924
|
-
ge.status === "rejected" && (
|
|
1925
|
-
}),
|
|
1986
|
+
o || (B((h) => {
|
|
1987
|
+
const L = { ...h };
|
|
1988
|
+
for (const ge of g)
|
|
1989
|
+
ge.status === "fulfilled" && (L[ge.value.invocationId] = ge.value.checklist);
|
|
1990
|
+
return L;
|
|
1991
|
+
}), ce((h) => {
|
|
1992
|
+
const L = { ...h };
|
|
1993
|
+
return g.forEach((ge, Ze) => {
|
|
1994
|
+
ge.status === "rejected" && (L[y[Ze].id] = Ee);
|
|
1995
|
+
}), L;
|
|
1926
1996
|
}));
|
|
1927
1997
|
})(), () => {
|
|
1928
|
-
|
|
1998
|
+
o = !0;
|
|
1929
1999
|
};
|
|
1930
|
-
}, [
|
|
1931
|
-
const
|
|
1932
|
-
async (
|
|
1933
|
-
if (!
|
|
1934
|
-
|
|
1935
|
-
const h = { ...
|
|
1936
|
-
return delete h[
|
|
2000
|
+
}, [y, M]);
|
|
2001
|
+
const se = T(
|
|
2002
|
+
async (o) => {
|
|
2003
|
+
if (!P[o.invocation_id]) {
|
|
2004
|
+
Q(o.id), ce((g) => {
|
|
2005
|
+
const h = { ...g };
|
|
2006
|
+
return delete h[o.id], h;
|
|
1937
2007
|
});
|
|
1938
2008
|
try {
|
|
1939
|
-
const
|
|
1940
|
-
|
|
2009
|
+
const g = await M(o.invocation_id);
|
|
2010
|
+
B((h) => ({
|
|
1941
2011
|
...h,
|
|
1942
|
-
[
|
|
2012
|
+
[o.invocation_id]: g.checklist
|
|
1943
2013
|
}));
|
|
1944
2014
|
} catch {
|
|
1945
|
-
|
|
1946
|
-
...
|
|
1947
|
-
[
|
|
2015
|
+
ce((g) => ({
|
|
2016
|
+
...g,
|
|
2017
|
+
[o.id]: Ee
|
|
1948
2018
|
}));
|
|
1949
2019
|
} finally {
|
|
1950
|
-
|
|
2020
|
+
Q((g) => g === o.id ? null : g);
|
|
1951
2021
|
}
|
|
1952
2022
|
}
|
|
1953
2023
|
},
|
|
1954
|
-
[
|
|
1955
|
-
),
|
|
1956
|
-
(
|
|
1957
|
-
if (
|
|
1958
|
-
|
|
2024
|
+
[M, P]
|
|
2025
|
+
), Ae = T(
|
|
2026
|
+
(o) => {
|
|
2027
|
+
if (N === o) {
|
|
2028
|
+
I(null);
|
|
1959
2029
|
return;
|
|
1960
2030
|
}
|
|
1961
|
-
const
|
|
1962
|
-
|
|
2031
|
+
const g = y.find(({ id: h }) => h === o);
|
|
2032
|
+
g && (I(o), se(g));
|
|
1963
2033
|
},
|
|
1964
|
-
[N,
|
|
1965
|
-
),
|
|
1966
|
-
const
|
|
1967
|
-
for (const
|
|
2034
|
+
[y, N, se]
|
|
2035
|
+
), q = U(() => {
|
|
2036
|
+
const o = {};
|
|
2037
|
+
for (const g of _e) {
|
|
1968
2038
|
const h = ln(
|
|
1969
|
-
|
|
1970
|
-
|
|
2039
|
+
g,
|
|
2040
|
+
P[g.invocation_id]
|
|
1971
2041
|
);
|
|
1972
|
-
(
|
|
2042
|
+
(o[h] ?? (o[h] = [])).push(g);
|
|
1973
2043
|
}
|
|
1974
|
-
return
|
|
1975
|
-
}, [
|
|
1976
|
-
|
|
1977
|
-
}, []),
|
|
1978
|
-
async (
|
|
1979
|
-
const
|
|
1980
|
-
|
|
2044
|
+
return o;
|
|
2045
|
+
}, [_e, P]), Se = T((o) => {
|
|
2046
|
+
u(o);
|
|
2047
|
+
}, []), be = T(
|
|
2048
|
+
async (o) => {
|
|
2049
|
+
const g = await ee(o);
|
|
2050
|
+
u(g), Y(!1);
|
|
1981
2051
|
},
|
|
1982
|
-
[
|
|
1983
|
-
),
|
|
1984
|
-
|
|
1985
|
-
}, []),
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
definitionNameByRef: ne,
|
|
1994
|
-
onToggleAgent: se,
|
|
1995
|
-
onViewAgent: je
|
|
2052
|
+
[ee]
|
|
2053
|
+
), Ce = T(() => {
|
|
2054
|
+
u(null);
|
|
2055
|
+
}, []), me = {
|
|
2056
|
+
expandedAgentId: N,
|
|
2057
|
+
loadingAgentId: D,
|
|
2058
|
+
checklistByInvocationId: P,
|
|
2059
|
+
errorByAgentId: z,
|
|
2060
|
+
definitionNameByRef: Z,
|
|
2061
|
+
onToggleAgent: Ae,
|
|
2062
|
+
onViewAgent: Se
|
|
1996
2063
|
};
|
|
1997
2064
|
return /* @__PURE__ */ i("div", { className: "agent-view-frontend agent-view", children: [
|
|
1998
2065
|
/* @__PURE__ */ i("div", { className: "agent-view__header", children: [
|
|
1999
2066
|
/* @__PURE__ */ n(he, { level: 1, children: "Agents" }),
|
|
2000
2067
|
/* @__PURE__ */ n(
|
|
2001
|
-
|
|
2068
|
+
J,
|
|
2002
2069
|
{
|
|
2003
2070
|
variant: "primary",
|
|
2004
2071
|
size: "S",
|
|
2005
2072
|
iconLeftName: "sparkles",
|
|
2006
2073
|
iconLeftScreenReaderText: "Start an agent",
|
|
2007
|
-
onClick: () =>
|
|
2074
|
+
onClick: () => Y(!0),
|
|
2008
2075
|
children: "Start an agent"
|
|
2009
2076
|
}
|
|
2010
2077
|
)
|
|
2011
2078
|
] }),
|
|
2012
|
-
|
|
2013
|
-
|
|
2079
|
+
y.length > 0 && Ne && /* @__PURE__ */ i("div", { className: "agent-view__filters", children: [
|
|
2080
|
+
ne && /* @__PURE__ */ i("div", { className: "agent-view__filter", children: [
|
|
2014
2081
|
/* @__PURE__ */ n(
|
|
2015
2082
|
"label",
|
|
2016
2083
|
{
|
|
@@ -2027,16 +2094,16 @@ const Jt = (e, t) => (s) => {
|
|
|
2027
2094
|
multiple: !0,
|
|
2028
2095
|
searchType: "substring",
|
|
2029
2096
|
placeholder: "All institutions",
|
|
2030
|
-
options:
|
|
2031
|
-
value:
|
|
2032
|
-
onValueChange:
|
|
2097
|
+
options: le,
|
|
2098
|
+
value: X,
|
|
2099
|
+
onValueChange: ke,
|
|
2033
2100
|
showSelectionCountBadge: !0,
|
|
2034
2101
|
showClearAll: !0,
|
|
2035
2102
|
clearAllLabel: "Clear institutions"
|
|
2036
2103
|
}
|
|
2037
2104
|
)
|
|
2038
2105
|
] }),
|
|
2039
|
-
|
|
2106
|
+
ae && /* @__PURE__ */ i("div", { className: "agent-view__filter", children: [
|
|
2040
2107
|
/* @__PURE__ */ n(
|
|
2041
2108
|
"label",
|
|
2042
2109
|
{
|
|
@@ -2053,9 +2120,9 @@ const Jt = (e, t) => (s) => {
|
|
|
2053
2120
|
multiple: !0,
|
|
2054
2121
|
searchType: "substring",
|
|
2055
2122
|
placeholder: "All agents",
|
|
2056
|
-
options:
|
|
2057
|
-
value:
|
|
2058
|
-
onValueChange:
|
|
2123
|
+
options: de,
|
|
2124
|
+
value: K,
|
|
2125
|
+
onValueChange: ye,
|
|
2059
2126
|
showSelectionCountBadge: !0,
|
|
2060
2127
|
showClearAll: !0,
|
|
2061
2128
|
clearAllLabel: "Clear agents"
|
|
@@ -2063,7 +2130,7 @@ const Jt = (e, t) => (s) => {
|
|
|
2063
2130
|
)
|
|
2064
2131
|
] })
|
|
2065
2132
|
] }),
|
|
2066
|
-
|
|
2133
|
+
k === "error" ? /* @__PURE__ */ i("div", { className: "agent-view__state agent-view__state--error", role: "alert", children: [
|
|
2067
2134
|
/* @__PURE__ */ n(
|
|
2068
2135
|
E,
|
|
2069
2136
|
{
|
|
@@ -2072,9 +2139,9 @@ const Jt = (e, t) => (s) => {
|
|
|
2072
2139
|
color: "var(--color-semantic-destructive-600)"
|
|
2073
2140
|
}
|
|
2074
2141
|
),
|
|
2075
|
-
/* @__PURE__ */ n("p", { className: "agent-view__state-message", children:
|
|
2076
|
-
/* @__PURE__ */ n(
|
|
2077
|
-
] }) :
|
|
2142
|
+
/* @__PURE__ */ n("p", { className: "agent-view__state-message", children: $ ?? qe }),
|
|
2143
|
+
/* @__PURE__ */ n(J, { variant: "secondary", size: "S", onClick: V, children: "Try again" })
|
|
2144
|
+
] }) : k === "loading" && y.length === 0 ? /* @__PURE__ */ i("div", { className: "agent-view__state", "aria-live": "polite", children: [
|
|
2078
2145
|
/* @__PURE__ */ n(
|
|
2079
2146
|
E,
|
|
2080
2147
|
{
|
|
@@ -2086,60 +2153,64 @@ const Jt = (e, t) => (s) => {
|
|
|
2086
2153
|
}
|
|
2087
2154
|
),
|
|
2088
2155
|
/* @__PURE__ */ n("p", { className: "agent-view__state-message", children: Pe })
|
|
2089
|
-
] }) :
|
|
2090
|
-
|
|
2156
|
+
] }) : y.length === 0 ? /* @__PURE__ */ n(yt, {}) : /* @__PURE__ */ i("div", { className: "agent-view__board", children: [
|
|
2157
|
+
ct.map((o) => /* @__PURE__ */ n(
|
|
2091
2158
|
Fe,
|
|
2092
2159
|
{
|
|
2093
|
-
column:
|
|
2094
|
-
agents:
|
|
2095
|
-
...
|
|
2160
|
+
column: ve[o],
|
|
2161
|
+
agents: q[o] ?? [],
|
|
2162
|
+
...me
|
|
2096
2163
|
},
|
|
2097
|
-
|
|
2164
|
+
o
|
|
2098
2165
|
)),
|
|
2099
|
-
/* @__PURE__ */ n("div", { className: "agent-view__split-column", children:
|
|
2166
|
+
/* @__PURE__ */ n("div", { className: "agent-view__split-column", children: lt.map((o) => /* @__PURE__ */ n(
|
|
2100
2167
|
Fe,
|
|
2101
2168
|
{
|
|
2102
|
-
column:
|
|
2103
|
-
agents:
|
|
2169
|
+
column: ve[o],
|
|
2170
|
+
agents: q[o] ?? [],
|
|
2104
2171
|
isSplit: !0,
|
|
2105
|
-
...
|
|
2172
|
+
...me
|
|
2106
2173
|
},
|
|
2107
|
-
|
|
2174
|
+
o
|
|
2108
2175
|
)) })
|
|
2109
2176
|
] }),
|
|
2110
|
-
|
|
2111
|
-
|
|
2177
|
+
_ && /* @__PURE__ */ n(
|
|
2178
|
+
rn,
|
|
2112
2179
|
{
|
|
2113
|
-
agent:
|
|
2180
|
+
agent: _,
|
|
2114
2181
|
open: !0,
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2182
|
+
jwt: e,
|
|
2183
|
+
headers: R,
|
|
2184
|
+
agentUrl: r,
|
|
2185
|
+
agentChecklistUrl: c,
|
|
2186
|
+
agentResourcesUrl: l,
|
|
2187
|
+
agentChatUrl: d,
|
|
2188
|
+
enableUpload: w,
|
|
2189
|
+
initialChecklist: P[_.invocation_id] ?? null,
|
|
2190
|
+
onClose: Ce
|
|
2120
2191
|
},
|
|
2121
|
-
|
|
2192
|
+
_.id
|
|
2122
2193
|
),
|
|
2123
2194
|
/* @__PURE__ */ n(
|
|
2124
|
-
|
|
2195
|
+
on,
|
|
2125
2196
|
{
|
|
2126
|
-
open:
|
|
2127
|
-
onClose: () =>
|
|
2128
|
-
onStart:
|
|
2129
|
-
agentDefinitions:
|
|
2197
|
+
open: te,
|
|
2198
|
+
onClose: () => Y(!1),
|
|
2199
|
+
onStart: be,
|
|
2200
|
+
agentDefinitions: A
|
|
2130
2201
|
}
|
|
2131
2202
|
)
|
|
2132
2203
|
] });
|
|
2133
2204
|
}, kn = (e, t) => {
|
|
2134
|
-
const
|
|
2205
|
+
const a = Date.now(), s = t.trim() || e.agent_intent;
|
|
2135
2206
|
return {
|
|
2136
|
-
id: `agent-${
|
|
2137
|
-
invocation_id: `inv-${
|
|
2207
|
+
id: `agent-${a}`,
|
|
2208
|
+
invocation_id: `inv-${a}`,
|
|
2138
2209
|
agent_definition_ref: e.ref,
|
|
2139
2210
|
agent_intent: e.agent_intent,
|
|
2140
|
-
invocation_name:
|
|
2141
|
-
application_id:
|
|
2142
|
-
created_by:
|
|
2211
|
+
invocation_name: s,
|
|
2212
|
+
application_id: dt,
|
|
2213
|
+
created_by: gt,
|
|
2143
2214
|
status: v["generating-a-response"],
|
|
2144
2215
|
context_ref: null,
|
|
2145
2216
|
checklist_ref: null
|
|
@@ -2147,23 +2218,24 @@ const Jt = (e, t) => (s) => {
|
|
|
2147
2218
|
};
|
|
2148
2219
|
export {
|
|
2149
2220
|
wn as AgentMonitorKanban,
|
|
2150
|
-
|
|
2221
|
+
je as AgentServiceClient,
|
|
2151
2222
|
ue as AgentServiceError,
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2223
|
+
rn as AgentView,
|
|
2224
|
+
zt as HttpChatConnector,
|
|
2225
|
+
on as NewAgentModal,
|
|
2155
2226
|
kn as buildAgentFromDefinition,
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2227
|
+
Ve as createHttpChatConnectorFactory,
|
|
2228
|
+
De as mapApiAgent,
|
|
2229
|
+
Wt as mapApiAgentDefinition,
|
|
2230
|
+
Kt as mapApiAgentStatus,
|
|
2231
|
+
Xe as mapApiChecklistEndpointResponse,
|
|
2232
|
+
Qe as mapApiChecklistItem,
|
|
2162
2233
|
vn as mapApiChecklistResponse,
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2234
|
+
qt as mapApiChecklistStatus,
|
|
2235
|
+
we as mapApiOpeningMessage,
|
|
2236
|
+
Vt as mapApiResource,
|
|
2237
|
+
Ye as mapApiResourcesEndpointResponse,
|
|
2167
2238
|
fn as mapApiTripOption,
|
|
2168
|
-
|
|
2239
|
+
en as useAgentService,
|
|
2240
|
+
nn as useAgentWorkspace
|
|
2169
2241
|
};
|