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