@arbor-education/agent-view-frontend 0.4.7 → 0.4.8

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