@arbor-education/agent-view-frontend 0.5.2 → 0.6.0

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