@arbor-education/agent-view-frontend 0.5.1-alpha.2 → 0.5.2

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