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