@arbor-education/agent-view-frontend 0.7.0 → 0.7.1

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