@arbor-education/agent-view-frontend 0.4.4 → 0.4.5

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