@arbor-education/agent-view-frontend 0.3.1 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,24 +1,24 @@
1
- import { jsxs as i, jsx as n, Fragment as Xe } from "react/jsx-runtime";
2
- import { useMemo as U, useRef as Re, useState as _, useEffect as B, useCallback as I, useLayoutEffect as Ze } from "react";
3
- import M from "classnames";
4
- import { Heading as he, Icon as E, Dot as Ge, Button as X, Modal as Q, SelectDropdown as et, TextInput as tt, Combobox as Oe, Card as nt } from "@arbor-education/design-system.components";
5
- import { CHAT_RESPONSE_TYPE_AGENT as Be, CHAT_RESPONSE_TYPE_ERROR as at, ChatPanel as st, CHAT_RESPONSE_TYPE_USER as rt, CHAT_RESPONSE_TYPE_INFO as ot } from "@arbor-education/ask-arbor-chat-panel";
1
+ import { jsxs as i, jsx as n, Fragment as et } from "react/jsx-runtime";
2
+ import { useMemo as U, useLayoutEffect as Ge, useState as m, useEffect as G, useCallback as T, useRef as Re } from "react";
3
+ import H from "classnames";
4
+ import { Heading as he, Icon as E, Dot as Be, Button as J, Modal as W, SelectDropdown as tt, TextInput as nt, Combobox as Oe, Card as at } from "@arbor-education/design-system.components";
5
+ import { CHAT_RESPONSE_TYPE_AGENT as ze, CHAT_RESPONSE_TYPE_ERROR as st, ChatPanel as rt, CHAT_RESPONSE_TYPE_USER as ot, CHAT_RESPONSE_TYPE_INFO as it } from "@arbor-education/ask-arbor-chat-panel";
6
6
  const v = {
7
7
  "generating-a-response": "generating-a-response",
8
8
  hitl: "hitl",
9
9
  complete: "complete",
10
10
  failed: "failed"
11
- }, b = {
11
+ }, S = {
12
12
  "generating-a-response": "generating-a-response",
13
13
  hitl: "hitl",
14
14
  complete: "complete",
15
15
  failed: "failed"
16
- }, T = {
16
+ }, b = {
17
17
  briefing: "briefing",
18
18
  running: "running",
19
19
  stopped: "stopped",
20
20
  complete: "complete"
21
- }, Z = {
21
+ }, j = {
22
22
  agent: "agent",
23
23
  user: "user",
24
24
  system: "system"
@@ -30,39 +30,39 @@ const v = {
30
30
  }, xe = {
31
31
  cancelled: "cancelled",
32
32
  archived: "archived"
33
- }, Se = {
33
+ }, Te = {
34
34
  in_progress: "in_progress",
35
35
  requires_attention: "requires_attention",
36
36
  available: "available"
37
- }, G = {
38
- [b.complete]: {
37
+ }, F = {
38
+ [S.complete]: {
39
39
  label: "Complete",
40
40
  icon: "circle-check",
41
41
  color: "var(--color-semantic-success-600)"
42
42
  },
43
- [b.failed]: {
43
+ [S.failed]: {
44
44
  label: "Failed",
45
45
  icon: "circle-x",
46
46
  color: "var(--color-semantic-destructive-600)"
47
47
  },
48
- [b.hitl]: {
48
+ [S.hitl]: {
49
49
  label: "Requires attention",
50
50
  icon: "triangle-alert",
51
51
  color: "var(--color-semantic-warning-600)"
52
52
  },
53
- [b["generating-a-response"]]: {
53
+ [S["generating-a-response"]]: {
54
54
  label: "Generating a response",
55
55
  icon: "loader",
56
56
  color: "var(--color-brand-600)"
57
57
  }
58
- }, we = {
58
+ }, ve = {
59
59
  [v["generating-a-response"]]: {
60
60
  status: v["generating-a-response"],
61
61
  title: "Active",
62
62
  dotColour: "green",
63
63
  statusIcon: {
64
- name: G["generating-a-response"].icon,
65
- color: G["generating-a-response"].color,
64
+ name: F["generating-a-response"].icon,
65
+ color: F["generating-a-response"].color,
66
66
  spin: !0
67
67
  }
68
68
  },
@@ -71,8 +71,8 @@ const v = {
71
71
  title: "Requires attention",
72
72
  dotColour: "orange",
73
73
  statusIcon: {
74
- name: G.hitl.icon,
75
- color: G.hitl.color
74
+ name: F.hitl.icon,
75
+ color: F.hitl.color
76
76
  }
77
77
  },
78
78
  [v.complete]: {
@@ -81,8 +81,8 @@ const v = {
81
81
  dotColour: "green",
82
82
  dotModifier: "grey-dark",
83
83
  statusIcon: {
84
- name: G.complete.icon,
85
- color: G.complete.color
84
+ name: F.complete.icon,
85
+ color: F.complete.color
86
86
  }
87
87
  },
88
88
  [v.failed]: {
@@ -90,32 +90,32 @@ const v = {
90
90
  title: "Failed",
91
91
  dotColour: "salmon",
92
92
  statusIcon: {
93
- name: G.failed.icon,
94
- color: G.failed.color
93
+ name: F.failed.icon,
94
+ color: F.failed.color
95
95
  }
96
96
  }
97
- }, it = [
97
+ }, ct = [
98
98
  v["generating-a-response"],
99
99
  v.hitl
100
- ], ct = [
100
+ ], lt = [
101
101
  v.complete,
102
102
  v.failed
103
- ], lt = "m4", dt = "1", qe = "msg-opening", be = "Unable to load agent tasks. Please try again.", gt = "Unable to load the resources for this agent", pt = "Something went wrong. Please try again.", ze = "Unable to load agents. Please try again.", oe = "Loading tasks…", Pe = "Loading agents…", ut = "Task", ht = "What recent actions have you taken?", _t = {
104
- [T.briefing]: "Briefing",
105
- [T.running]: "Working",
106
- [T.stopped]: "Stopped",
107
- [T.complete]: "Complete"
108
- }, mt = [
103
+ ], dt = "m4", gt = "1", Ke = "msg-opening", Ee = "Unable to load agent tasks. Please try again.", pt = "Unable to load the resources for this agent", ut = "Something went wrong. Please try again.", qe = "Unable to load agents. Please try again.", oe = "Loading tasks…", Pe = "Loading agents…", ht = "Task", _t = "What recent actions have you taken?", mt = {
104
+ [b.briefing]: "Briefing",
105
+ [b.running]: "Working",
106
+ [b.stopped]: "Stopped",
107
+ [b.complete]: "Complete"
108
+ }, ft = [
109
109
  v["generating-a-response"],
110
110
  v.hitl,
111
111
  v.complete,
112
112
  v.failed
113
- ], ft = {
113
+ ], vt = {
114
114
  [v["generating-a-response"]]: "Agents currently working on tasks for you.",
115
115
  [v.hitl]: "Agents that need your input before they can continue.",
116
116
  [v.complete]: "Agents that have finished their work.",
117
117
  [v.failed]: "Agents that failed or were stopped."
118
- }, vt = () => /* @__PURE__ */ i(
118
+ }, wt = () => /* @__PURE__ */ i(
119
119
  "svg",
120
120
  {
121
121
  className: "agent-view__empty-illustration",
@@ -231,8 +231,8 @@ const v = {
231
231
  /* @__PURE__ */ n("circle", { cx: "256", cy: "160", r: "4", fill: "var(--color-semantic-destructive-500)" })
232
232
  ]
233
233
  }
234
- ), wt = ({ status: e }) => {
235
- const t = we[e];
234
+ ), kt = ({ status: e }) => {
235
+ const t = ve[e];
236
236
  return t.statusIcon ? /* @__PURE__ */ n(
237
237
  E,
238
238
  {
@@ -241,8 +241,8 @@ const v = {
241
241
  color: t.statusIcon.color,
242
242
  screenReaderText: t.title
243
243
  }
244
- ) : /* @__PURE__ */ n(Ge, { colour: t.dotColour, label: t.title });
245
- }, kt = () => /* @__PURE__ */ i(
244
+ ) : /* @__PURE__ */ n(Be, { colour: t.dotColour, label: t.title });
245
+ }, yt = () => /* @__PURE__ */ i(
246
246
  "section",
247
247
  {
248
248
  className: "agent-view__empty",
@@ -251,13 +251,13 @@ const v = {
251
251
  /* @__PURE__ */ i("div", { className: "agent-view__empty-content", children: [
252
252
  /* @__PURE__ */ n(he, { level: 4, children: "Your agents board" }),
253
253
  /* @__PURE__ */ n("p", { className: "agent-view__empty-lead", children: "When you start an agent, it appears here so you can track progress at a glance. Agents move between columns as their status changes." }),
254
- /* @__PURE__ */ n("ul", { className: "agent-view__empty-columns", children: mt.map((e) => {
255
- const t = we[e];
254
+ /* @__PURE__ */ n("ul", { className: "agent-view__empty-columns", children: ft.map((e) => {
255
+ const t = ve[e];
256
256
  return /* @__PURE__ */ i("li", { className: "agent-view__empty-column", children: [
257
- /* @__PURE__ */ n("span", { className: "agent-view__empty-column-indicator", children: /* @__PURE__ */ n(wt, { status: e }) }),
257
+ /* @__PURE__ */ n("span", { className: "agent-view__empty-column-indicator", children: /* @__PURE__ */ n(kt, { status: e }) }),
258
258
  /* @__PURE__ */ i("span", { className: "agent-view__empty-column-text", children: [
259
259
  /* @__PURE__ */ n("span", { className: "agent-view__empty-column-title", children: t.title }),
260
- /* @__PURE__ */ n("span", { className: "agent-view__empty-column-description", children: ft[e] })
260
+ /* @__PURE__ */ n("span", { className: "agent-view__empty-column-description", children: vt[e] })
261
261
  ] })
262
262
  ] }, e);
263
263
  }) }),
@@ -267,39 +267,39 @@ const v = {
267
267
  " above to begin."
268
268
  ] })
269
269
  ] }),
270
- /* @__PURE__ */ n("div", { className: "agent-view__empty-visual", children: /* @__PURE__ */ n(vt, {}) })
270
+ /* @__PURE__ */ n("div", { className: "agent-view__empty-visual", children: /* @__PURE__ */ n(wt, {}) })
271
271
  ]
272
272
  }
273
273
  ), Nt = (e, t) => ({
274
274
  ...e,
275
275
  ...t.length > 0 ? { children: t } : {}
276
- }), Ke = (e) => {
277
- const t = [], s = [];
278
- for (const a of e) {
279
- const r = a.children ? Ke(a.children) : { needsInput: [], tasks: [] };
280
- if (t.push(...r.needsInput), a.status === b.hitl) {
281
- t.push({ ...a, children: void 0 });
276
+ }), We = (e) => {
277
+ const t = [], a = [];
278
+ for (const s of e) {
279
+ const r = s.children ? We(s.children) : { needsInput: [], tasks: [] };
280
+ if (t.push(...r.needsInput), s.status === S.hitl) {
281
+ t.push({ ...s, children: void 0 });
282
282
  continue;
283
283
  }
284
- s.push(Nt(a, r.tasks));
284
+ a.push(Nt(s, r.tasks));
285
285
  }
286
- return { needsInput: t, tasks: s };
287
- }, yt = (e) => e.map((t, s) => ({ item: t, index: s })).sort((t, s) => {
288
- const a = t.item.status === b.hitl, r = s.item.status === b.hitl;
289
- return a !== r ? a ? -1 : 1 : t.index - s.index;
290
- }).map(({ item: t }) => t), At = ({
286
+ return { needsInput: t, tasks: a };
287
+ }, At = (e) => e.map((t, a) => ({ item: t, index: a })).sort((t, a) => {
288
+ const s = t.item.status === S.hitl, r = a.item.status === S.hitl;
289
+ return s !== r ? s ? -1 : 1 : t.index - a.index;
290
+ }).map(({ item: t }) => t), St = ({
291
291
  checklist: e
292
292
  }) => e.length === 0 ? /* @__PURE__ */ n("p", { className: "agent-view__progress-empty", children: "No tasks to display." }) : /* @__PURE__ */ n(
293
293
  "ul",
294
294
  {
295
295
  className: "agent-view__progress-list",
296
296
  "aria-label": "Agent tasks",
297
- children: yt(e).map((t) => {
298
- const s = G[t.status];
297
+ children: At(e).map((t) => {
298
+ const a = F[t.status];
299
299
  return /* @__PURE__ */ i(
300
300
  "li",
301
301
  {
302
- className: M(
302
+ className: H(
303
303
  "agent-view__progress-item",
304
304
  `agent-view__progress-item--${t.status.replace(/_/g, "-")}`
305
305
  ),
@@ -307,18 +307,18 @@ const v = {
307
307
  /* @__PURE__ */ n(
308
308
  E,
309
309
  {
310
- name: s.icon,
310
+ name: a.icon,
311
311
  size: 16,
312
- color: s.color,
313
- screenReaderText: `${s.label}:`,
314
- className: M({
315
- "agent-view__progress-icon--spinning": t.status === b["generating-a-response"]
312
+ color: a.color,
313
+ screenReaderText: `${a.label}:`,
314
+ className: H({
315
+ "agent-view__progress-icon--spinning": t.status === S["generating-a-response"]
316
316
  })
317
317
  }
318
318
  ),
319
319
  /* @__PURE__ */ i("div", { className: "agent-view__progress-item-content", children: [
320
320
  /* @__PURE__ */ n("span", { className: "agent-view__progress-label", children: t.task }),
321
- t.status !== b.complete && /* @__PURE__ */ n(
321
+ t.status !== S.complete && /* @__PURE__ */ n(
322
322
  "span",
323
323
  {
324
324
  className: "agent-view__progress-description",
@@ -332,23 +332,23 @@ const v = {
332
332
  );
333
333
  })
334
334
  }
335
- ), St = ({
335
+ ), bt = ({
336
336
  prompts: e,
337
337
  classNamePrefix: t = "agent-workspace",
338
- onSelect: s
339
- }) => e.length === 0 ? null : /* @__PURE__ */ n("div", { className: `${t}__chips`, children: e.map((a) => /* @__PURE__ */ n(
338
+ onSelect: a
339
+ }) => e.length === 0 ? null : /* @__PURE__ */ n("div", { className: `${t}__chips`, children: e.map((s) => /* @__PURE__ */ n(
340
340
  "button",
341
341
  {
342
342
  type: "button",
343
343
  className: `${t}__chip`,
344
- onClick: () => s(a),
345
- children: a
344
+ onClick: () => a(s),
345
+ children: s
346
346
  },
347
- a
347
+ s
348
348
  )) });
349
- class bt {
350
- constructor(t, s) {
351
- this.connector = t, this.canSend = s.canSend, this.onTurn = s.onTurn, this.onAwaitingChange = s.onAwaitingChange;
349
+ class Ct {
350
+ constructor(t, a) {
351
+ this.connector = t, this.canSend = a.canSend, this.onTurn = a.onTurn, this.onAwaitingChange = a.onAwaitingChange;
352
352
  }
353
353
  get canRate() {
354
354
  return !1;
@@ -366,26 +366,29 @@ class bt {
366
366
  return {};
367
367
  }
368
368
  async sendMessage(t) {
369
- var s, a;
369
+ var a, s;
370
370
  if (!this.canSend())
371
371
  return null;
372
- (s = this.onAwaitingChange) == null || s.call(this, !0);
372
+ (a = this.onAwaitingChange) == null || a.call(this, !0);
373
373
  try {
374
- const r = await this.connector.sendMessage(t.userMessage);
374
+ const r = await this.connector.sendMessage(
375
+ t.userMessage,
376
+ t.uploadFiles
377
+ );
375
378
  return this.onTurn(r), {
376
379
  id: r.message.id,
377
380
  text: r.message.text,
378
- type: Be,
381
+ type: ze,
379
382
  ...r.message.followUpPrompts ? { followUpPrompts: r.message.followUpPrompts } : {}
380
383
  };
381
384
  } catch {
382
385
  return {
383
386
  id: `error-${Date.now()}`,
384
- text: pt,
385
- type: at
387
+ text: ut,
388
+ type: st
386
389
  };
387
390
  } finally {
388
- (a = this.onAwaitingChange) == null || a.call(this, !1);
391
+ (s = this.onAwaitingChange) == null || s.call(this, !1);
389
392
  }
390
393
  }
391
394
  async loadHistory(t) {
@@ -400,40 +403,41 @@ class bt {
400
403
  return !1;
401
404
  }
402
405
  }
403
- const Ct = ({
406
+ const Tt = ({
404
407
  connector: e,
405
408
  phase: t,
406
- chatHistory: s,
407
- chatSessionKey: a,
409
+ chatHistory: a,
410
+ chatSessionKey: s,
408
411
  startQuery: r,
409
- clarificationMessage: o,
410
- onTurn: c,
411
- onAwaitingChange: d,
412
- onClarificationPrompt: w,
413
- onDismissClarification: g
412
+ clarificationMessage: c,
413
+ enableUpload: l = !1,
414
+ onTurn: d,
415
+ onAwaitingChange: w,
416
+ onClarificationPrompt: f,
417
+ onDismissClarification: p
414
418
  }) => {
415
- const p = U(
416
- () => new bt(e, {
417
- canSend: () => t === T.running,
418
- onTurn: c,
419
- onAwaitingChange: d
419
+ const _ = U(
420
+ () => new Ct(e, {
421
+ canSend: () => t === b.running,
422
+ onTurn: d,
423
+ onAwaitingChange: w
420
424
  }),
421
- [e, t, c, d]
422
- ), m = t !== T.running, k = t === T.running;
425
+ [e, t, d, w]
426
+ ), u = t !== b.running, C = t === b.running;
423
427
  return /* @__PURE__ */ i("section", { className: "agent-workspace__panel agent-workspace__panel--chat", "aria-label": "Chat", children: [
424
- o && /* @__PURE__ */ i(
428
+ c && /* @__PURE__ */ i(
425
429
  "div",
426
430
  {
427
431
  className: "agent-workspace__clarification",
428
432
  role: "region",
429
433
  "aria-label": "Agent question",
430
434
  children: [
431
- /* @__PURE__ */ n("p", { className: "agent-workspace__clarification-text", children: o.text }),
432
- o.followUpPrompts && /* @__PURE__ */ n(
433
- St,
435
+ /* @__PURE__ */ n("p", { className: "agent-workspace__clarification-text", children: c.text }),
436
+ c.followUpPrompts && /* @__PURE__ */ n(
437
+ bt,
434
438
  {
435
- prompts: o.followUpPrompts,
436
- onSelect: w
439
+ prompts: c.followUpPrompts,
440
+ onSelect: f
437
441
  }
438
442
  ),
439
443
  /* @__PURE__ */ n(
@@ -441,7 +445,7 @@ const Ct = ({
441
445
  {
442
446
  type: "button",
443
447
  className: "agent-workspace__clarification-dismiss",
444
- onClick: g,
448
+ onClick: p,
445
449
  children: "Dismiss"
446
450
  }
447
451
  )
@@ -449,40 +453,40 @@ const Ct = ({
449
453
  }
450
454
  ),
451
455
  /* @__PURE__ */ n("div", { className: "agent-workspace__ask-arbor", children: /* @__PURE__ */ n(
452
- st,
456
+ rt,
453
457
  {
454
- connector: p,
455
- chatHistory: s,
458
+ connector: _,
459
+ chatHistory: a,
456
460
  startQuery: r,
457
- lockConversation: m,
458
- enableUpload: !0,
459
- speechEnabled: k,
461
+ lockConversation: u,
462
+ enableUpload: l,
463
+ speechEnabled: C,
460
464
  speechLanguage: "en-GB",
461
465
  speechSubmissionDelay: 1e3,
462
466
  slashMenuItems: [],
463
467
  menuContent: [],
464
468
  introHeading: "Message your agent",
465
469
  introBody: "Ask questions, share trip details, or paste a link. The agent will update the checklist as it works.",
466
- placeholder: k ? "Message the agent, paste a link, or attach a file…" : "The agent is not accepting messages."
470
+ placeholder: C ? "Message the agent, paste a link, or attach a file…" : "The agent is not accepting messages."
467
471
  },
468
- a
472
+ s
469
473
  ) }),
470
- t === T.stopped && /* @__PURE__ */ i("div", { className: "agent-workspace__notice", role: "status", children: [
474
+ t === b.stopped && /* @__PURE__ */ i("div", { className: "agent-workspace__notice", role: "status", children: [
471
475
  /* @__PURE__ */ n(E, { name: "circle-alert", size: 16, color: "var(--color-semantic-warning-600)" }),
472
476
  /* @__PURE__ */ n("span", { children: "You stopped the agent. Its progress is saved in the checklist on the left." })
473
477
  ] }),
474
- t === T.complete && /* @__PURE__ */ i("div", { className: "agent-workspace__notice", role: "status", children: [
478
+ t === b.complete && /* @__PURE__ */ i("div", { className: "agent-workspace__notice", role: "status", children: [
475
479
  /* @__PURE__ */ n(E, { name: "party-popper", size: 16, color: "var(--color-semantic-success-600)" }),
476
480
  /* @__PURE__ */ n("span", { children: "The agent has finished." })
477
481
  ] })
478
482
  ] });
479
- }, We = ({
483
+ }, Je = ({
480
484
  item: e,
481
485
  depth: t,
482
- canRequestInput: s,
483
- onAttentionItemClick: a
486
+ canRequestInput: a,
487
+ onAttentionItemClick: s
484
488
  }) => {
485
- const r = G[e.status], o = e.status.replace(/_/g, "-"), c = e.status === b.hitl && s && a, d = /* @__PURE__ */ i("div", { className: "agent-workspace__task-row", children: [
489
+ const r = F[e.status], c = e.status.replace(/_/g, "-"), l = e.status === S.hitl && a && s, d = /* @__PURE__ */ i("div", { className: "agent-workspace__task-row", children: [
486
490
  /* @__PURE__ */ n(
487
491
  E,
488
492
  {
@@ -490,40 +494,40 @@ const Ct = ({
490
494
  size: 16,
491
495
  color: r.color,
492
496
  screenReaderText: `${r.label}:`,
493
- className: M({
494
- "agent-workspace__task-icon--spinning": e.status === b["generating-a-response"]
497
+ className: H({
498
+ "agent-workspace__task-icon--spinning": e.status === S["generating-a-response"]
495
499
  })
496
500
  }
497
501
  ),
498
502
  /* @__PURE__ */ i("div", { className: "agent-workspace__task-content", children: [
499
503
  /* @__PURE__ */ n("span", { className: "agent-workspace__task-label", children: e.task }),
500
- e.status !== b.complete && e.description && /* @__PURE__ */ n("span", { className: "agent-workspace__task-description", children: e.description })
504
+ e.status !== S.complete && e.description && /* @__PURE__ */ n("span", { className: "agent-workspace__task-description", children: e.description })
501
505
  ] })
502
506
  ] });
503
507
  return /* @__PURE__ */ i(
504
508
  "li",
505
509
  {
506
- className: M("agent-workspace__task", `agent-workspace__task--${o}`, {
510
+ className: H("agent-workspace__task", `agent-workspace__task--${c}`, {
507
511
  "agent-workspace__task--child": t > 0
508
512
  }),
509
513
  children: [
510
- c ? /* @__PURE__ */ n(
514
+ l ? /* @__PURE__ */ n(
511
515
  "button",
512
516
  {
513
517
  type: "button",
514
518
  className: "agent-workspace__task-button",
515
519
  "aria-label": `Provide input for ${e.task}`,
516
- onClick: () => a(e),
520
+ onClick: () => s(e),
517
521
  children: d
518
522
  }
519
523
  ) : d,
520
524
  e.children && e.children.length > 0 && /* @__PURE__ */ n("ul", { className: "agent-workspace__task-children", children: e.children.map((w) => /* @__PURE__ */ n(
521
- We,
525
+ Je,
522
526
  {
523
527
  item: w,
524
528
  depth: t + 1,
525
- canRequestInput: s,
526
- onAttentionItemClick: a
529
+ canRequestInput: a,
530
+ onAttentionItemClick: s
527
531
  },
528
532
  w.task
529
533
  )) })
@@ -533,28 +537,28 @@ const Ct = ({
533
537
  }, Le = ({
534
538
  items: e,
535
539
  ariaLabel: t,
536
- canRequestInput: s,
537
- onAttentionItemClick: a
540
+ canRequestInput: a,
541
+ onAttentionItemClick: s
538
542
  }) => /* @__PURE__ */ n("ul", { className: "agent-workspace__task-list", "aria-label": t, children: e.map((r) => /* @__PURE__ */ n(
539
- We,
543
+ Je,
540
544
  {
541
545
  item: r,
542
546
  depth: 0,
543
- canRequestInput: s,
544
- onAttentionItemClick: a
547
+ canRequestInput: a,
548
+ onAttentionItemClick: s
545
549
  },
546
550
  r.task
547
- )) }), Tt = ({
551
+ )) }), Et = ({
548
552
  checklist: e,
549
553
  isLoading: t,
550
- error: s,
551
- phase: a,
554
+ error: a,
555
+ phase: s,
552
556
  canRequestInput: r,
553
- onStop: o,
554
- onAttentionItemClick: c
557
+ onStop: c,
558
+ onAttentionItemClick: l
555
559
  }) => {
556
560
  const d = U(
557
- () => e ? Ke(e) : null,
561
+ () => e ? We(e) : null,
558
562
  [e]
559
563
  );
560
564
  return /* @__PURE__ */ i(
@@ -565,14 +569,14 @@ const Ct = ({
565
569
  children: [
566
570
  /* @__PURE__ */ i("div", { className: "agent-workspace__panel-header", children: [
567
571
  /* @__PURE__ */ n(he, { level: 4, children: "Checklist" }),
568
- a === T.running && /* @__PURE__ */ n(
569
- X,
572
+ s === b.running && /* @__PURE__ */ n(
573
+ J,
570
574
  {
571
575
  variant: "secondary-destructive",
572
576
  size: "S",
573
577
  iconLeftName: "circle-x",
574
578
  iconLeftScreenReaderText: "Stop",
575
- onClick: o,
579
+ onClick: c,
576
580
  children: "Stop agent"
577
581
  }
578
582
  )
@@ -591,8 +595,8 @@ const Ct = ({
591
595
  ),
592
596
  /* @__PURE__ */ n("span", { children: oe })
593
597
  ] }),
594
- !t && s && /* @__PURE__ */ n("p", { className: "agent-workspace__error", role: "alert", children: s }),
595
- !t && !s && d && /* @__PURE__ */ i(Xe, { children: [
598
+ !t && a && /* @__PURE__ */ n("p", { className: "agent-workspace__error", role: "alert", children: a }),
599
+ !t && !a && d && /* @__PURE__ */ i(et, { children: [
596
600
  d.needsInput.length > 0 && /* @__PURE__ */ i("div", { className: "agent-workspace__task-group", children: [
597
601
  /* @__PURE__ */ n("p", { className: "agent-workspace__task-group-label", children: "Needs your input" }),
598
602
  /* @__PURE__ */ n(
@@ -601,14 +605,14 @@ const Ct = ({
601
605
  items: d.needsInput,
602
606
  ariaLabel: "Tasks needing your input",
603
607
  canRequestInput: r,
604
- onAttentionItemClick: c
608
+ onAttentionItemClick: l
605
609
  }
606
610
  )
607
611
  ] }),
608
612
  d.tasks.length > 0 && /* @__PURE__ */ i(
609
613
  "div",
610
614
  {
611
- className: M("agent-workspace__task-group", {
615
+ className: H("agent-workspace__task-group", {
612
616
  "agent-workspace__task-group--following": d.needsInput.length > 0
613
617
  }),
614
618
  children: [
@@ -619,19 +623,19 @@ const Ct = ({
619
623
  items: d.tasks,
620
624
  ariaLabel: "Agent tasks",
621
625
  canRequestInput: r,
622
- onAttentionItemClick: c
626
+ onAttentionItemClick: l
623
627
  }
624
628
  )
625
629
  ]
626
630
  }
627
631
  )
628
632
  ] }),
629
- !t && !s && (!d || d.needsInput.length === 0 && d.tasks.length === 0) && /* @__PURE__ */ n("p", { className: "agent-workspace__empty", children: a === T.briefing ? "Tasks will appear here once the agent starts." : "No tasks to display." })
633
+ !t && !a && (!d || d.needsInput.length === 0 && d.tasks.length === 0) && /* @__PURE__ */ n("p", { className: "agent-workspace__empty", children: s === b.briefing ? "Tasks will appear here once the agent starts." : "No tasks to display." })
630
634
  ] })
631
635
  ]
632
636
  }
633
637
  );
634
- }, Et = {
638
+ }, It = {
635
639
  [re.MIS_RECORD]: {
636
640
  icon: "table",
637
641
  label: "Arbor MIS",
@@ -652,10 +656,10 @@ const Ct = ({
652
656
  label: "Link",
653
657
  color: "var(--color-semantic-info-700)"
654
658
  }
655
- }, It = ({
659
+ }, Rt = ({
656
660
  resources: e,
657
661
  isLoading: t = !1,
658
- error: s = null
662
+ error: a = null
659
663
  }) => /* @__PURE__ */ i(
660
664
  "section",
661
665
  {
@@ -680,21 +684,21 @@ const Ct = ({
680
684
  ),
681
685
  /* @__PURE__ */ n("span", { children: "Loading resources…" })
682
686
  ] }),
683
- !t && s && /* @__PURE__ */ n("p", { className: "agent-workspace__error", role: "alert", children: s }),
684
- !t && !s && e.length > 0 && /* @__PURE__ */ n("ul", { className: "agent-workspace__resource-list", "aria-label": "Agent resources", children: e.map((a) => {
685
- const r = Et[a.type];
687
+ !t && a && /* @__PURE__ */ n("p", { className: "agent-workspace__error", role: "alert", children: a }),
688
+ !t && !a && e.length > 0 && /* @__PURE__ */ n("ul", { className: "agent-workspace__resource-list", "aria-label": "Agent resources", children: e.map((s) => {
689
+ const r = It[s.type];
686
690
  return /* @__PURE__ */ n("li", { className: "agent-workspace__resource", children: /* @__PURE__ */ i(
687
691
  "a",
688
692
  {
689
693
  className: "agent-workspace__resource-card",
690
- href: a.uri,
694
+ href: s.uri,
691
695
  target: "_blank",
692
696
  rel: "noreferrer",
693
697
  children: [
694
698
  /* @__PURE__ */ n(
695
699
  "span",
696
700
  {
697
- className: `agent-workspace__resource-icon agent-workspace__resource-icon--${a.type.toLowerCase()}`,
701
+ className: `agent-workspace__resource-icon agent-workspace__resource-icon--${s.type.toLowerCase()}`,
698
702
  children: /* @__PURE__ */ n(
699
703
  E,
700
704
  {
@@ -708,16 +712,16 @@ const Ct = ({
708
712
  ),
709
713
  /* @__PURE__ */ i("span", { className: "agent-workspace__resource-content", children: [
710
714
  /* @__PURE__ */ i("span", { className: "agent-workspace__resource-top", children: [
711
- /* @__PURE__ */ n("span", { className: "agent-workspace__resource-name", children: a.name }),
715
+ /* @__PURE__ */ n("span", { className: "agent-workspace__resource-name", children: s.name }),
712
716
  /* @__PURE__ */ n(
713
717
  "span",
714
718
  {
715
- className: `agent-workspace__resource-badge agent-workspace__resource-badge--${a.type.toLowerCase()}`,
719
+ className: `agent-workspace__resource-badge agent-workspace__resource-badge--${s.type.toLowerCase()}`,
716
720
  children: r.label
717
721
  }
718
722
  )
719
723
  ] }),
720
- a.description && /* @__PURE__ */ n("span", { className: "agent-workspace__resource-description", children: a.description })
724
+ s.description && /* @__PURE__ */ n("span", { className: "agent-workspace__resource-description", children: s.description })
721
725
  ] }),
722
726
  /* @__PURE__ */ n(
723
727
  E,
@@ -731,440 +735,59 @@ const Ct = ({
731
735
  )
732
736
  ]
733
737
  }
734
- ) }, `${a.type}-${a.uri}`);
738
+ ) }, `${s.type}-${s.uri}`);
735
739
  }) }),
736
- !t && !s && e.length === 0 && /* @__PURE__ */ n("p", { className: "agent-workspace__empty", children: "No resources yet." })
740
+ !t && !a && e.length === 0 && /* @__PURE__ */ n("p", { className: "agent-workspace__empty", children: "No resources yet." })
737
741
  ] })
738
742
  ]
739
743
  }
740
- ), Rt = [
744
+ ), Ot = [
741
745
  "I'll get the details and come back to you",
742
746
  "Skip this for now"
743
- ], Ot = (e) => {
744
- var s;
745
- const t = (s = e.prompt) != null && s.trim() ? e.prompt.trim() : `I need a bit more from you on "${e.task}". ${e.description} What can you tell me?`;
747
+ ], xt = (e) => {
748
+ var a;
749
+ const t = (a = e.prompt) != null && a.trim() ? e.prompt.trim() : `I need a bit more from you on "${e.task}". ${e.description} What can you tell me?`;
746
750
  return {
747
751
  id: `clarification-${Date.now()}`,
748
- author: Z.agent,
752
+ author: j.agent,
749
753
  text: t,
750
- followUpPrompts: e.clarificationPrompts ?? Rt
754
+ followUpPrompts: e.clarificationPrompts ?? Ot
751
755
  };
752
756
  }, pe = (e) => ({
753
757
  id: e.id,
754
758
  text: e.text,
755
- type: e.author === Z.user ? rt : e.author === Z.system ? ot : Be,
759
+ type: e.author === j.user ? ot : e.author === j.system ? it : ze,
756
760
  ...e.followUpPrompts ? { followUpPrompts: e.followUpPrompts } : {}
757
- }), xt = (e, t) => {
758
- const s = e.hasRunBefore ? t || "This trip" : e.tripName.trim() || "A new trip", a = e.destination ? ` to ${e.destination}` : "", r = e.hasRunBefore ? " It has run before." : "";
759
- return `${s}${a}.${r}`.trim();
760
- }, Pt = (e) => {
761
- switch (e) {
762
- case v.failed:
763
- return T.stopped;
764
- case v.complete:
765
- return T.complete;
766
- default:
767
- return T.running;
768
- }
769
- }, Ue = (e, t) => {
770
- t([pe(e)]);
771
- }, Lt = ({
772
- agent: e,
773
- open: t,
774
- onClose: s,
775
- initialBrief: a,
776
- initialPhase: r,
777
- initialChecklist: o,
778
- fetchAgentChecklist: c,
779
- fetchAgentResources: d,
780
- connector: w
781
- }) => {
782
- const g = Re(w), [p, m] = _(
783
- r ?? (a ? T.running : Pt(e.status))
784
- ), [k, x] = _([]), [P, N] = _(0), [D, S] = _(), [H, q] = _(null), [z, ce] = _([]), [ae, ee] = _(!1), [y, C] = _(null), [$, K] = _(
785
- o ?? null
786
- ), [J, W] = _(!1), [L, le] = _(null), [Ne, te] = _(!1), [j, ye] = _(!1), [V, Ae] = _(!1), Y = Re(!1);
787
- B(() => {
788
- g.current = w;
789
- }, [w]), B(() => {
790
- Y.current = !1, x([]), N((u) => u + 1);
791
- }, [e.invocation_id]), B(() => {
792
- if (!t || a || Y.current)
793
- return;
794
- const u = g.current.bootstrapConversation;
795
- if (!u) {
796
- Ue(
797
- g.current.openingMessage(),
798
- x
799
- );
800
- return;
801
- }
802
- Y.current = !0;
803
- let A = !1;
804
- return te(!0), (async () => {
805
- try {
806
- const se = await u.call(g.current);
807
- if (A)
808
- return;
809
- x(se.map(pe));
810
- } catch {
811
- A || Ue(
812
- g.current.openingMessage(),
813
- x
814
- );
815
- } finally {
816
- A || te(!1);
817
- }
818
- })(), () => {
819
- A = !0;
820
- };
821
- }, [t, a, e.invocation_id, w]);
822
- const ne = I((u) => {
823
- u.checklist && K(u.checklist), u.phase && m(u.phase);
824
- }, []);
825
- B(() => {
826
- var u, A;
827
- !t || a || o && o.length > 0 && ((A = (u = g.current).seedChecklist) == null || A.call(u, o));
828
- }, [t, a, o]), B(() => {
829
- if (!t || a || !c)
830
- return;
831
- let u = !1;
832
- return W(!(o != null && o.length)), le(null), (async () => {
833
- var A, se;
834
- try {
835
- const de = await c(e.invocation_id);
836
- if (u)
837
- return;
838
- o != null && o.length || (K(de.checklist), (se = (A = g.current).seedChecklist) == null || se.call(A, de.checklist));
839
- } catch {
840
- !u && !(o != null && o.length) && le(be);
841
- } finally {
842
- u || W(!1);
843
- }
844
- })(), () => {
845
- u = !0;
846
- };
847
- }, [
848
- t,
849
- e.invocation_id,
850
- a,
851
- o,
852
- c
853
- ]), B(() => {
854
- if (!t || !d)
855
- return;
856
- let u = !1;
857
- return ee(!0), C(null), (async () => {
858
- try {
859
- const A = await d(
860
- e.invocation_id
861
- );
862
- u || ce(A);
863
- } catch {
864
- u || C(gt);
865
- } finally {
866
- u || ee(!1);
867
- }
868
- })(), () => {
869
- u = !0;
870
- };
871
- }, [t, e.invocation_id, d]), B(() => {
872
- if (!t || !a || Y.current)
873
- return;
874
- Y.current = !0;
875
- const u = {
876
- id: `user-brief-${Date.now()}`,
877
- author: Z.user,
878
- text: xt(a, e.invocation_name)
879
- };
880
- (async () => {
881
- const A = await g.current.start(a);
882
- x([
883
- pe(g.current.openingMessage()),
884
- pe(u),
885
- pe(A.message)
886
- ]), A.checklist && K(A.checklist), m(A.phase ?? T.running);
887
- })();
888
- }, [t, a, e.invocation_name]);
889
- const _e = I(
890
- (u) => {
891
- q(Ot(u));
892
- },
893
- []
894
- ), me = I((u) => {
895
- q(null), S(u), N((A) => A + 1);
896
- }, []), fe = I(async () => {
897
- await g.current.stop(), m(T.stopped);
898
- }, []), ve = $;
899
- return /* @__PURE__ */ i(
900
- Q,
901
- {
902
- open: t,
903
- closeHandler: s,
904
- hideCloseButton: !0,
905
- className: "agent-workspace",
906
- children: [
907
- /* @__PURE__ */ i(Q.Header, { className: "agent-workspace__header", children: [
908
- /* @__PURE__ */ i("div", { className: "agent-workspace__header-title", children: [
909
- /* @__PURE__ */ n(
910
- "span",
911
- {
912
- className: "agent-workspace__header-avatar",
913
- "aria-hidden": "true",
914
- children: /* @__PURE__ */ n(E, { name: "ask-arbor", size: 24 })
915
- }
916
- ),
917
- /* @__PURE__ */ n(Q.Title, { children: e.invocation_name }),
918
- /* @__PURE__ */ n(
919
- "span",
920
- {
921
- className: M(
922
- "agent-workspace__phase",
923
- `agent-workspace__phase--${p}`
924
- ),
925
- children: _t[p]
926
- }
927
- )
928
- ] }),
929
- /* @__PURE__ */ i("div", { className: "agent-workspace__header-actions", children: [
930
- /* @__PURE__ */ n(
931
- X,
932
- {
933
- variant: "tertiary",
934
- size: "S",
935
- iconLeftName: "clipboard-list",
936
- iconLeftScreenReaderText: "Toggle checklist",
937
- "aria-pressed": !V,
938
- onClick: () => Ae((u) => !u),
939
- children: "Checklist"
940
- }
941
- ),
942
- /* @__PURE__ */ n(
943
- X,
944
- {
945
- variant: "tertiary",
946
- size: "S",
947
- iconLeftName: "files",
948
- iconLeftScreenReaderText: "Toggle resources",
949
- "aria-pressed": !j,
950
- onClick: () => ye((u) => !u),
951
- children: "Resources"
952
- }
953
- ),
954
- /* @__PURE__ */ n(
955
- X,
956
- {
957
- variant: "secondary",
958
- size: "S",
959
- iconLeftName: "x",
960
- iconLeftScreenReaderText: "Close",
961
- onClick: s,
962
- children: "Close"
963
- }
964
- )
965
- ] })
966
- ] }),
967
- /* @__PURE__ */ i(
968
- Q.Body,
969
- {
970
- className: M("agent-workspace__body", {
971
- "agent-workspace__body--no-left": V,
972
- "agent-workspace__body--no-right": j
973
- }),
974
- children: [
975
- !V && /* @__PURE__ */ n(
976
- Tt,
977
- {
978
- checklist: ve,
979
- isLoading: J,
980
- error: L,
981
- phase: p,
982
- canRequestInput: p === T.running && !Ne,
983
- onStop: () => void fe(),
984
- onAttentionItemClick: _e
985
- }
986
- ),
987
- /* @__PURE__ */ n(
988
- Ct,
989
- {
990
- connector: g.current,
991
- phase: p,
992
- chatHistory: k,
993
- chatSessionKey: P,
994
- startQuery: D,
995
- clarificationMessage: H,
996
- onTurn: ne,
997
- onAwaitingChange: te,
998
- onClarificationPrompt: me,
999
- onDismissClarification: () => q(null)
1000
- }
1001
- ),
1002
- !j && /* @__PURE__ */ n(
1003
- It,
1004
- {
1005
- resources: z,
1006
- isLoading: ae,
1007
- error: y
1008
- }
1009
- )
1010
- ]
1011
- }
1012
- )
1013
- ]
1014
- }
1015
- );
1016
- }, Ut = ({
1017
- open: e,
1018
- onClose: t,
1019
- onStart: s,
1020
- agentDefinitions: a
1021
- }) => {
1022
- const r = a[0], [o, c] = _(
1023
- r
1024
- ), [d, w] = _(""), [g, p] = _(!1), [m, k] = _(null), x = [...a].sort((S, H) => S.agent_intent.localeCompare(H.agent_intent)).map((S) => ({
1025
- value: S.ref,
1026
- label: S.agent_intent
1027
- }));
1028
- B(() => {
1029
- e && (c(r), w(""), p(!1), k(null));
1030
- }, [e, r]);
1031
- const P = o !== void 0 && d.trim().length > 0, N = I(
1032
- (S) => {
1033
- const H = a.find(
1034
- (q) => q.ref === S[0]
1035
- );
1036
- H && c(H);
1037
- },
1038
- [a]
1039
- ), D = I(async () => {
1040
- if (!(!o || !P || g)) {
1041
- p(!0), k(null);
1042
- try {
1043
- await s({ definition: o, invocationName: d.trim() });
1044
- } catch (S) {
1045
- k(
1046
- S instanceof Error ? S.message : "Unable to start the agent."
1047
- );
1048
- } finally {
1049
- p(!1);
1050
- }
1051
- }
1052
- }, [P, o, d, g, s]);
1053
- return !o || a.length === 0 ? null : /* @__PURE__ */ i(
1054
- Q,
1055
- {
1056
- open: e,
1057
- closeHandler: t,
1058
- className: "new-agent",
1059
- children: [
1060
- /* @__PURE__ */ n(Q.Header, { className: "new-agent__header", children: /* @__PURE__ */ i("div", { className: "new-agent__header-title", children: [
1061
- /* @__PURE__ */ n(
1062
- "span",
1063
- {
1064
- className: "new-agent__header-avatar",
1065
- "aria-hidden": "true",
1066
- children: /* @__PURE__ */ n(E, { name: "ask-arbor", size: 24 })
1067
- }
1068
- ),
1069
- /* @__PURE__ */ n(Q.Title, { children: "Start an agent" })
1070
- ] }) }),
1071
- /* @__PURE__ */ n(Q.Body, { className: "new-agent__body", children: /* @__PURE__ */ i(
1072
- "form",
1073
- {
1074
- className: "new-agent__form",
1075
- "aria-label": "Start an agent",
1076
- onSubmit: (S) => {
1077
- S.preventDefault(), P && !g && D();
1078
- },
1079
- children: [
1080
- /* @__PURE__ */ i("div", { className: "new-agent__type-field", children: [
1081
- /* @__PURE__ */ n(
1082
- "label",
1083
- {
1084
- className: "new-agent__type-label",
1085
- htmlFor: "new-agent-type",
1086
- children: "What would you like your agent to do?"
1087
- }
1088
- ),
1089
- /* @__PURE__ */ n(
1090
- et,
1091
- {
1092
- id: "new-agent-type",
1093
- placeholder: "Choose an intent",
1094
- options: x,
1095
- selectedValues: [o.ref],
1096
- onSelectionChange: N
1097
- }
1098
- ),
1099
- /* @__PURE__ */ n("p", { className: "new-agent__type-description", children: o.description })
1100
- ] }),
1101
- /* @__PURE__ */ i("div", { className: "new-agent__type-field", children: [
1102
- /* @__PURE__ */ n(
1103
- "label",
1104
- {
1105
- className: "new-agent__type-label",
1106
- htmlFor: "new-agent-invocation-name",
1107
- children: "Name"
1108
- }
1109
- ),
1110
- /* @__PURE__ */ n(
1111
- tt,
1112
- {
1113
- id: "new-agent-invocation-name",
1114
- value: d,
1115
- placeholder: "e.g. Test with memory3",
1116
- onChange: (S) => w(S.target.value)
1117
- }
1118
- )
1119
- ] }),
1120
- m ? /* @__PURE__ */ n("p", { className: "new-agent__error", role: "alert", children: m }) : null,
1121
- /* @__PURE__ */ n("div", { className: "new-agent__actions", children: /* @__PURE__ */ n(
1122
- X,
1123
- {
1124
- type: "submit",
1125
- variant: "primary",
1126
- disabled: !P || g,
1127
- iconLeftName: g ? "loader" : "sparkles",
1128
- iconLeftScreenReaderText: g ? "Starting" : void 0,
1129
- children: g ? "Starting…" : "Start"
1130
- }
1131
- ) })
1132
- ]
1133
- }
1134
- ) })
1135
- ]
1136
- }
1137
- );
1138
- };
761
+ });
1139
762
  class ue extends Error {
1140
- constructor(t, s, a) {
1141
- super(a ?? `Agent service request failed (${t})`), this.name = "AgentServiceError", this.status = t, this.detail = s;
763
+ constructor(t, a, s) {
764
+ super(s ?? `Agent service request failed (${t})`), this.name = "AgentServiceError", this.status = t, this.detail = a;
1142
765
  }
1143
766
  }
1144
- const $t = "/api/v1", R = {
767
+ const Pt = "/api/v1", O = {
1145
768
  agentDefinitions: "/agent-definitions",
1146
769
  agents: "/agents",
1147
770
  tripOptions: "/trip-options",
1148
771
  demoDataset: "/demo/dataset"
1149
- }, O = {
772
+ }, x = {
1150
773
  GET: "GET",
1151
774
  POST: "POST"
1152
- }, Mt = {
775
+ }, Lt = {
1153
776
  error: "error"
1154
- }, Dt = {
777
+ }, Ut = {
1155
778
  user: "user"
1156
779
  }, ie = {
1157
780
  acceptJson: "application/json",
1158
781
  acceptEventStream: "text/event-stream",
1159
782
  contentTypeJson: "application/json",
1160
783
  arborApplicationUrl: "X-Arbor-Application-Url"
1161
- }, Ht = /:invocationId\b/g, Ft = (e) => e.trim().replace(/^Bearer\s+/i, ""), Gt = (e) => e.endsWith("/") ? e.slice(0, -1) : e;
1162
- class Bt {
784
+ }, $t = /:invocationId\b/g, Mt = (e) => e.trim().replace(/^Bearer\s+/i, ""), Dt = (e) => e.endsWith("/") ? e.slice(0, -1) : e;
785
+ class je {
1163
786
  constructor(t) {
1164
- var a;
1165
- this.baseUrl = Gt(t.baseUrl);
1166
- const s = (a = t.token) == null ? void 0 : a.trim();
1167
- this.token = s ? Ft(s) : void 0, this.customHeaders = t.headers, this.urls = t.urls ?? {}, this.fetchImpl = t.fetch ?? globalThis.fetch.bind(globalThis);
787
+ var s;
788
+ this.baseUrl = Dt(t.baseUrl ?? "");
789
+ const a = (s = t.token) == null ? void 0 : s.trim();
790
+ this.token = a ? Mt(a) : void 0, this.customHeaders = t.headers, this.urls = t.urls ?? {}, this.fetchImpl = t.fetch ?? globalThis.fetch.bind(globalThis);
1168
791
  }
1169
792
  // Replaces the extra headers merged into every subsequent request,
1170
793
  // without recreating the client (e.g. an application-URL header that
@@ -1174,170 +797,171 @@ class Bt {
1174
797
  }
1175
798
  async listAgentDefinitions() {
1176
799
  return (await this.request(
1177
- O.GET,
1178
- this.resolveUrl("agentDefinitions", R.agentDefinitions)
800
+ x.GET,
801
+ this.resolveUrl("agentDefinitions", O.agentDefinitions)
1179
802
  )).agent_definitions ?? [];
1180
803
  }
1181
804
  getAgentDefinition(t) {
1182
805
  return this.request(
1183
- O.GET,
806
+ x.GET,
1184
807
  this.apiUrl(
1185
- `${R.agentDefinitions}/${encodeURIComponent(t)}`
808
+ `${O.agentDefinitions}/${encodeURIComponent(t)}`
1186
809
  )
1187
810
  );
1188
811
  }
1189
812
  listTripOptions() {
1190
813
  return this.request(
1191
- O.GET,
1192
- this.apiUrl(R.tripOptions)
814
+ x.GET,
815
+ this.apiUrl(O.tripOptions)
1193
816
  );
1194
817
  }
1195
818
  getDataset() {
1196
819
  return this.request(
1197
- O.GET,
1198
- this.apiUrl(R.demoDataset)
820
+ x.GET,
821
+ this.apiUrl(O.demoDataset)
1199
822
  );
1200
823
  }
1201
824
  setDataset(t) {
1202
825
  return this.request(
1203
- O.POST,
1204
- this.apiUrl(R.demoDataset),
826
+ x.POST,
827
+ this.apiUrl(O.demoDataset),
1205
828
  { dataset: t }
1206
829
  );
1207
830
  }
1208
831
  listAgents(t = {}) {
1209
- const s = new URLSearchParams();
1210
- t.status && s.set("status", t.status), t.agentDefinitionRef && s.set("agent_definition_ref", t.agentDefinitionRef);
1211
- const a = s.toString() ? `?${s.toString()}` : "";
832
+ const a = new URLSearchParams();
833
+ t.status && a.set("status", t.status), t.agentDefinitionRef && a.set("agent_definition_ref", t.agentDefinitionRef);
834
+ const s = a.toString() ? `?${a.toString()}` : "";
1212
835
  return this.request(
1213
- O.GET,
1214
- `${this.resolveUrl("agents", R.agents)}${a}`
836
+ x.GET,
837
+ `${this.resolveUrl("agents", O.agents)}${s}`
1215
838
  );
1216
839
  }
1217
- createAgent(t, s = {}) {
1218
- var c, d;
1219
- const a = {
840
+ createAgent(t, a = {}) {
841
+ var l, d;
842
+ const s = {
1220
843
  agent_definition_ref: t
1221
- }, r = (c = s.invocationName) == null ? void 0 : c.trim(), o = (d = s.agentIntent) == null ? void 0 : d.trim();
1222
- return r && (a.invocation_name = r), o && (a.agent_intent = o), this.request(
1223
- O.POST,
1224
- this.resolveUrl("agents", R.agents),
1225
- a
844
+ }, r = (l = a.invocationName) == null ? void 0 : l.trim(), c = (d = a.agentIntent) == null ? void 0 : d.trim();
845
+ return r && (s.invocation_name = r), c && (s.agent_intent = c), this.request(
846
+ x.POST,
847
+ this.resolveUrl("agents", O.agents),
848
+ s
1226
849
  );
1227
850
  }
1228
851
  getAgent(t) {
1229
852
  return this.request(
1230
- O.GET,
853
+ x.GET,
1231
854
  this.resolveUrl(
1232
855
  "agent",
1233
- `${R.agents}/${encodeURIComponent(t)}`,
856
+ `${O.agents}/${encodeURIComponent(t)}`,
1234
857
  t
1235
858
  )
1236
859
  );
1237
860
  }
1238
861
  getAgentChecklist(t) {
1239
862
  return this.request(
1240
- O.GET,
863
+ x.GET,
1241
864
  this.resolveUrl(
1242
865
  "agentChecklist",
1243
- `${R.agents}/${encodeURIComponent(t)}/checklist`,
866
+ `${O.agents}/${encodeURIComponent(t)}/checklist`,
1244
867
  t
1245
868
  )
1246
869
  );
1247
870
  }
1248
871
  getAgentResources(t) {
1249
872
  return this.request(
1250
- O.GET,
873
+ x.GET,
1251
874
  this.resolveUrl(
1252
875
  "agentResources",
1253
- `${R.agents}/${encodeURIComponent(t)}/resources`,
876
+ `${O.agents}/${encodeURIComponent(t)}/resources`,
1254
877
  t
1255
878
  )
1256
879
  );
1257
880
  }
1258
881
  getAgentContext(t) {
1259
882
  return this.request(
1260
- O.GET,
883
+ x.GET,
1261
884
  this.apiUrl(
1262
- `${R.agents}/${encodeURIComponent(t)}/context`
885
+ `${O.agents}/${encodeURIComponent(t)}/context`
1263
886
  )
1264
887
  );
1265
888
  }
1266
889
  cancelAgent(t) {
1267
890
  return this.request(
1268
- O.POST,
891
+ x.POST,
1269
892
  this.apiUrl(
1270
- `${R.agents}/${encodeURIComponent(t)}/cancel`
893
+ `${O.agents}/${encodeURIComponent(t)}/cancel`
1271
894
  )
1272
895
  );
1273
896
  }
1274
897
  archiveAgent(t) {
1275
898
  return this.request(
1276
- O.POST,
899
+ x.POST,
1277
900
  this.apiUrl(
1278
- `${R.agents}/${encodeURIComponent(t)}/archive`
901
+ `${O.agents}/${encodeURIComponent(t)}/archive`
1279
902
  )
1280
903
  );
1281
904
  }
1282
905
  // Streams a chat turn. Resolves with the final SSE event; `onEvent` fires
1283
906
  // for every event as it arrives.
1284
- async chat(t, s, a = {}) {
1285
- const r = await this.fetchImpl(
907
+ async chat(t, a, s = {}) {
908
+ const r = !!(s.uploadFiles && s.uploadFiles.length > 0), c = await this.fetchImpl(
1286
909
  this.resolveUrl(
1287
910
  "agentChat",
1288
- `${R.agents}/${encodeURIComponent(t)}/chat`,
911
+ `${O.agents}/${encodeURIComponent(t)}/chat`,
1289
912
  t
1290
913
  ),
1291
914
  {
1292
- method: O.POST,
915
+ method: x.POST,
1293
916
  headers: {
1294
917
  ...this.customHeaders,
1295
918
  ...this.authHeaders(),
1296
919
  Accept: ie.acceptEventStream,
1297
- "Content-Type": ie.contentTypeJson
920
+ // Let the browser set the multipart boundary when uploading.
921
+ ...r ? {} : { "Content-Type": ie.contentTypeJson }
1298
922
  },
1299
- body: JSON.stringify(s),
1300
- signal: a.signal
923
+ body: r ? Ft(a, s.uploadFiles ?? []) : JSON.stringify(a),
924
+ signal: s.signal
1301
925
  }
1302
926
  );
1303
- if (!r.ok)
1304
- throw await this.toError(r);
1305
- if (!r.body)
927
+ if (!c.ok)
928
+ throw await this.toError(c);
929
+ if (!c.body)
1306
930
  throw new ue(
1307
- r.status,
931
+ c.status,
1308
932
  null,
1309
933
  "Chat response contained no stream body"
1310
934
  );
1311
- return this.consumeSse(r.body, a.onEvent);
935
+ return this.consumeSse(c.body, s.onEvent);
1312
936
  }
1313
937
  authHeaders() {
1314
938
  return this.token ? { Authorization: `Bearer ${this.token}` } : {};
1315
939
  }
1316
940
  // Builds a URL from the base url + shared API prefix + route.
1317
941
  apiUrl(t) {
1318
- return `${this.baseUrl}${$t}${t}`;
942
+ return `${this.baseUrl}${Pt}${t}`;
1319
943
  }
1320
944
  // Resolves the URL for an operation, preferring a per-operation override
1321
945
  // (with `:invocationId` substituted) and falling back to the base url.
1322
- resolveUrl(t, s, a) {
946
+ resolveUrl(t, a, s) {
1323
947
  const r = this.urls[t];
1324
- return r ? a ? r.replace(
1325
- Ht,
1326
- encodeURIComponent(a)
1327
- ) : r : this.apiUrl(s);
948
+ return r ? s ? r.replace(
949
+ $t,
950
+ encodeURIComponent(s)
951
+ ) : r : this.apiUrl(a);
1328
952
  }
1329
- async request(t, s, a) {
953
+ async request(t, a, s) {
1330
954
  const r = await this.fetchImpl(
1331
- s,
955
+ a,
1332
956
  {
1333
957
  method: t,
1334
958
  headers: {
1335
959
  ...this.customHeaders,
1336
960
  ...this.authHeaders(),
1337
961
  Accept: ie.acceptJson,
1338
- ...a === void 0 ? {} : { "Content-Type": ie.contentTypeJson }
962
+ ...s === void 0 ? {} : { "Content-Type": ie.contentTypeJson }
1339
963
  },
1340
- ...a === void 0 ? {} : { body: JSON.stringify(a) }
964
+ ...s === void 0 ? {} : { body: JSON.stringify(s) }
1341
965
  }
1342
966
  );
1343
967
  if (!r.ok)
@@ -1346,144 +970,156 @@ class Bt {
1346
970
  return await r.json();
1347
971
  }
1348
972
  async toError(t) {
1349
- let s = null;
973
+ let a = null;
1350
974
  try {
1351
- s = await t.json();
975
+ a = await t.json();
1352
976
  } catch {
1353
977
  }
1354
978
  return new ue(
1355
979
  t.status,
1356
- s,
980
+ a,
1357
981
  `Agent service request failed (${t.status} ${t.statusText})`
1358
982
  );
1359
983
  }
1360
- async consumeSse(t, s) {
1361
- const a = t.getReader(), r = new TextDecoder();
1362
- let o = "", c;
984
+ async consumeSse(t, a) {
985
+ const s = t.getReader(), r = new TextDecoder();
986
+ let c = "", l;
1363
987
  const d = (w) => {
1364
- const { event: g, data: p } = qt(w);
988
+ const { event: f, data: p } = Ht(w);
1365
989
  if (p === null)
1366
990
  return;
1367
- if (g === Mt.error) {
1368
- const k = $e(p);
991
+ if (f === Lt.error) {
992
+ const u = Ue(p);
1369
993
  throw new ue(
1370
994
  502,
1371
- k,
1372
- (k == null ? void 0 : k.message) ?? "Chat stream error"
995
+ u,
996
+ (u == null ? void 0 : u.message) ?? "Chat stream error"
1373
997
  );
1374
998
  }
1375
- const m = $e(p);
1376
- m && (c = m, s == null || s(m));
999
+ const _ = Ue(p);
1000
+ _ && (l = _, a == null || a(_));
1377
1001
  };
1378
1002
  for (; ; ) {
1379
- const { done: w, value: g } = await a.read();
1003
+ const { done: w, value: f } = await s.read();
1380
1004
  if (w)
1381
1005
  break;
1382
- o += r.decode(g, { stream: !0 });
1383
- const p = o.split(`
1006
+ c += r.decode(f, { stream: !0 });
1007
+ const p = c.split(`
1384
1008
 
1385
1009
  `);
1386
- o = p.pop() ?? "";
1387
- for (const m of p)
1388
- d(m);
1010
+ c = p.pop() ?? "";
1011
+ for (const _ of p)
1012
+ d(_);
1389
1013
  }
1390
- if (o.trim() && d(o), !c)
1014
+ if (c.trim() && d(c), !l)
1391
1015
  throw new ue(
1392
1016
  502,
1393
1017
  null,
1394
1018
  "Chat stream ended without any events"
1395
1019
  );
1396
- return c;
1020
+ return l;
1397
1021
  }
1398
1022
  }
1399
- const qt = (e) => {
1023
+ const Ht = (e) => {
1400
1024
  let t = null;
1401
- const s = [];
1402
- for (const a of e.split(`
1025
+ const a = [];
1026
+ for (const s of e.split(`
1403
1027
  `)) {
1404
- const r = a.trimEnd();
1405
- r.startsWith("event:") ? t = r.slice(6).trim() : r.startsWith("data:") && s.push(r.slice(5).trim());
1028
+ const r = s.trimEnd();
1029
+ r.startsWith("event:") ? t = r.slice(6).trim() : r.startsWith("data:") && a.push(r.slice(5).trim());
1406
1030
  }
1407
1031
  return {
1408
1032
  event: t,
1409
- data: s.length > 0 ? s.join(`
1033
+ data: a.length > 0 ? a.join(`
1410
1034
  `) : null
1411
1035
  };
1412
- }, $e = (e) => {
1036
+ }, Ue = (e) => {
1413
1037
  try {
1414
1038
  return JSON.parse(e);
1415
1039
  } catch {
1416
1040
  return;
1417
1041
  }
1418
- }, zt = {
1419
- id: qe,
1420
- author: Z.agent,
1042
+ };
1043
+ function Ft(e, t) {
1044
+ const a = new FormData();
1045
+ a.append("body", JSON.stringify(e));
1046
+ for (const s of t)
1047
+ a.append("files", s, s.name);
1048
+ return a;
1049
+ }
1050
+ const Gt = {
1051
+ id: Ke,
1052
+ author: j.agent,
1421
1053
  text: "I'm connected to this agent. Ask me how it's progressing, or send an instruction and I’ll act on it."
1422
1054
  };
1423
- let Me = 0;
1424
- const De = (e) => (Me += 1, `${e}-${Date.now()}-${Me}`), Kt = (e) => {
1055
+ let $e = 0;
1056
+ const Me = (e) => ($e += 1, `${e}-${Date.now()}-${$e}`), Bt = (e) => {
1425
1057
  const t = e.destination ? ` to ${e.destination}` : "";
1426
1058
  return `Let's get started on ${e.tripName.trim() || e.destination.trim() || "this task"}${t}. What will you do first?`;
1427
1059
  };
1428
- class Wt {
1429
- constructor(t, s, a = {}) {
1430
- this.seededChecklist = [], this.client = t, this.agentId = s, this.opening = a.openingMessage ?? zt, this.model = a.model, this.bootstrapPrompt = a.bootstrapPrompt ?? ht;
1060
+ class zt {
1061
+ constructor(t, a, s = {}) {
1062
+ this.seededChecklist = [], this.client = t, this.agentId = a, this.opening = s.openingMessage ?? Gt, this.model = s.model, this.bootstrapPrompt = s.bootstrapPrompt ?? _t;
1431
1063
  }
1432
1064
  openingMessage() {
1433
1065
  return this.opening;
1434
1066
  }
1435
1067
  async bootstrapConversation(t = this.bootstrapPrompt) {
1436
- const s = t.trim();
1437
- if (!s)
1068
+ const a = t.trim();
1069
+ if (!a)
1438
1070
  return [this.opening];
1439
- const a = {
1440
- id: De("msg-user"),
1441
- author: Z.user,
1442
- text: s
1443
- }, r = await this.exchange(s);
1444
- return [a, r.message];
1071
+ const s = {
1072
+ id: Me("msg-user"),
1073
+ author: j.user,
1074
+ text: a
1075
+ }, r = await this.exchange(a);
1076
+ return [s, r.message];
1445
1077
  }
1446
1078
  async start(t) {
1447
- return { ...await this.exchange(Kt(t)), phase: T.running };
1079
+ return { ...await this.exchange(Bt(t)), phase: b.running };
1448
1080
  }
1449
- sendMessage(t) {
1450
- return this.exchange(t);
1081
+ sendMessage(t, a) {
1082
+ return this.exchange(t, a);
1451
1083
  }
1452
1084
  async stop() {
1453
1085
  }
1454
1086
  seedChecklist(t) {
1455
1087
  this.seededChecklist = t;
1456
1088
  }
1457
- async exchange(t) {
1458
- var o;
1089
+ async exchange(t, a) {
1090
+ var l;
1459
1091
  const s = [
1460
- { role: Dt.user, content: t }
1461
- ], a = await this.client.chat(this.agentId, {
1462
- messages: s,
1463
- ...this.chatId ? { chat_id: this.chatId } : {},
1464
- ...this.model ? { model: this.model } : {},
1465
- moderation_enabled: !0,
1466
- meta: {
1467
- feature_id: "agent_view",
1468
- source: "agent_view_frontend"
1469
- }
1470
- });
1471
- return this.chatId = a.chat_id, { message: {
1472
- id: a.event_id || De("msg-agent"),
1473
- author: Z.agent,
1474
- text: a.message.content,
1475
- ...(o = a.follow_up_prompts) != null && o.length ? { followUpPrompts: a.follow_up_prompts } : {}
1092
+ { role: Ut.user, content: t }
1093
+ ], r = await this.client.chat(
1094
+ this.agentId,
1095
+ {
1096
+ messages: s,
1097
+ ...this.chatId ? { chat_id: this.chatId } : {},
1098
+ ...this.model ? { model: this.model } : {},
1099
+ moderation_enabled: !0,
1100
+ meta: {
1101
+ feature_id: "agent_view",
1102
+ source: "agent_view_frontend"
1103
+ }
1104
+ },
1105
+ ...a && a.length > 0 ? [{ uploadFiles: a }] : []
1106
+ );
1107
+ return this.chatId = r.chat_id, { message: {
1108
+ id: r.event_id || Me("msg-agent"),
1109
+ author: j.agent,
1110
+ text: r.message.content,
1111
+ ...(l = r.follow_up_prompts) != null && l.length ? { followUpPrompts: r.follow_up_prompts } : {}
1476
1112
  } };
1477
1113
  }
1478
1114
  }
1479
- const Jt = (e, t) => (s) => {
1480
- var a;
1481
- return new Wt(e, s.invocation_id, {
1115
+ const Ve = (e, t) => (a) => {
1116
+ var s;
1117
+ return new zt(e, a.invocation_id, {
1482
1118
  model: t == null ? void 0 : t.model,
1483
1119
  bootstrapPrompt: t == null ? void 0 : t.bootstrapPrompt,
1484
- openingMessage: ((a = t == null ? void 0 : t.resolveOpeningMessage) == null ? void 0 : a.call(t, s)) ?? (t == null ? void 0 : t.openingMessage)
1120
+ openingMessage: ((s = t == null ? void 0 : t.resolveOpeningMessage) == null ? void 0 : s.call(t, a)) ?? (t == null ? void 0 : t.openingMessage)
1485
1121
  });
1486
- }, jt = (e) => {
1122
+ }, Kt = (e) => {
1487
1123
  switch (e) {
1488
1124
  case xe.cancelled:
1489
1125
  return v.failed;
@@ -1497,22 +1133,22 @@ const Jt = (e, t) => (s) => {
1497
1133
  default:
1498
1134
  return v["generating-a-response"];
1499
1135
  }
1500
- }, Vt = (e) => {
1136
+ }, qt = (e) => {
1501
1137
  switch (e) {
1502
- case Se.requires_attention:
1503
- return b.hitl;
1504
- case Se.in_progress:
1505
- case Se.available:
1506
- return b["generating-a-response"];
1507
- case b.failed:
1508
- case b.complete:
1509
- case b.hitl:
1510
- case b["generating-a-response"]:
1138
+ case Te.requires_attention:
1139
+ return S.hitl;
1140
+ case Te.in_progress:
1141
+ case Te.available:
1142
+ return S["generating-a-response"];
1143
+ case S.failed:
1144
+ case S.complete:
1145
+ case S.hitl:
1146
+ case S["generating-a-response"]:
1511
1147
  return e;
1512
1148
  default:
1513
- return b["generating-a-response"];
1149
+ return S["generating-a-response"];
1514
1150
  }
1515
- }, Yt = (e) => ({
1151
+ }, Wt = (e) => ({
1516
1152
  ref: e.name,
1517
1153
  display_name: e.display_name,
1518
1154
  agent_intent: e.agent_intent ?? e.display_name,
@@ -1521,171 +1157,609 @@ const Jt = (e, t) => (s) => {
1521
1157
  id: e.id,
1522
1158
  name: e.name,
1523
1159
  ...e.has_run_before ? { hasRunBefore: e.has_run_before } : {}
1524
- }), Qt = new Set(Object.values(re)), Xt = (e) => e && Qt.has(e) ? e : re.LINK, Zt = (e) => ({
1160
+ }), Jt = new Set(Object.values(re)), jt = (e) => e && Jt.has(e) ? e : re.LINK, Vt = (e) => ({
1525
1161
  uri: e.uri ?? "",
1526
- type: Xt(e.type),
1162
+ type: jt(e.type),
1527
1163
  name: e.name ?? "",
1528
1164
  description: e.description ?? ""
1529
- }), en = (e) => (Array.isArray(e) ? e : e.resources ?? []).map(Zt), He = (e) => {
1530
- var s;
1165
+ }), Ye = (e) => (Array.isArray(e) ? e : e.resources ?? []).map(Vt), De = (e) => {
1166
+ var a;
1531
1167
  const t = e.invocation_id ?? e.id;
1532
1168
  return {
1533
1169
  id: e.id,
1534
1170
  invocation_id: t,
1535
1171
  agent_definition_ref: e.agent_definition_ref,
1536
1172
  ...e.agent_intent ? { agent_intent: e.agent_intent } : {},
1537
- invocation_name: ((s = e.invocation_name) == null ? void 0 : s.trim()) || e.agent_definition_ref,
1173
+ invocation_name: ((a = e.invocation_name) == null ? void 0 : a.trim()) || e.agent_definition_ref,
1538
1174
  application_id: e.application_id,
1539
1175
  ...e.application_name ? { application_name: e.application_name } : {},
1540
1176
  created_by: e.created_by,
1541
- status: jt(e.status),
1177
+ status: Kt(e.status),
1542
1178
  context_ref: e.context_ref ?? null,
1543
1179
  checklist_ref: e.checklist_ref ?? null
1544
1180
  };
1545
- }, Je = (e) => {
1181
+ }, Qe = (e) => {
1546
1182
  var t;
1547
1183
  return {
1548
- task: e.task ?? e.name ?? e.label ?? ut,
1549
- status: Vt(e.status),
1184
+ task: e.task ?? e.name ?? e.label ?? ht,
1185
+ status: qt(e.status),
1550
1186
  description: e.description ?? "",
1551
1187
  ...e.prompt ? { prompt: e.prompt } : {},
1552
1188
  ...(t = e.follow_up_prompts) != null && t.length ? { clarificationPrompts: e.follow_up_prompts } : {}
1553
1189
  };
1554
- }, tn = (e) => Array.isArray(e) ? e : e.checklist_items ?? e.checklist ?? e.items ?? [], nn = (e, t, s) => {
1555
- var o;
1556
- const a = !Array.isArray(t) && (t.opening_message || (o = t.opening_follow_up_prompts) != null && o.length) ? t : s, r = a ? ke(a) : void 0;
1190
+ }, Yt = (e) => Array.isArray(e) ? e : e.checklist_items ?? e.checklist ?? e.items ?? [], Xe = (e, t, a) => {
1191
+ var c;
1192
+ const s = !Array.isArray(t) && (t.opening_message || (c = t.opening_follow_up_prompts) != null && c.length) ? t : a, r = s ? we(s) : void 0;
1557
1193
  return {
1558
1194
  invocation_id: e,
1559
- checklist: tn(t).map(Je),
1195
+ checklist: Yt(t).map(Qe),
1560
1196
  ...r ? { openingMessage: r } : {}
1561
1197
  };
1562
1198
  }, vn = (e, t) => {
1563
- const s = ke(t);
1199
+ const a = we(t);
1564
1200
  return {
1565
1201
  invocation_id: t.invocation_id ?? e,
1566
- checklist: (t.checklist_items ?? []).map(Je),
1567
- ...s ? { openingMessage: s } : {}
1202
+ checklist: (t.checklist_items ?? []).map(Qe),
1203
+ ...a ? { openingMessage: a } : {}
1568
1204
  };
1569
- }, ke = (e) => {
1570
- var s, a;
1571
- const t = (s = e.opening_message) == null ? void 0 : s.trim();
1205
+ }, we = (e) => {
1206
+ var a, s;
1207
+ const t = (a = e.opening_message) == null ? void 0 : a.trim();
1572
1208
  if (t)
1573
1209
  return {
1574
- id: qe,
1575
- author: Z.agent,
1210
+ id: Ke,
1211
+ author: j.agent,
1576
1212
  text: t,
1577
- ...(a = e.opening_follow_up_prompts) != null && a.length ? { followUpPrompts: e.opening_follow_up_prompts } : {}
1213
+ ...(s = e.opening_follow_up_prompts) != null && s.length ? { followUpPrompts: e.opening_follow_up_prompts } : {}
1578
1214
  };
1579
- }, an = (e) => e instanceof ue ? e.message : e instanceof TypeError ? "Network error while contacting the agent service." : e instanceof Error && e.message ? e.message : ze, sn = (e) => {
1215
+ }, Qt = (e) => e instanceof ue ? e.message : e instanceof TypeError ? "Network error while contacting the agent service." : e instanceof Error && e.message ? e.message : qe, Xt = (e) => {
1580
1216
  const t = {};
1581
- for (const s of e) {
1582
- const a = ke(s);
1583
- if (!a)
1217
+ for (const a of e) {
1218
+ const s = we(a);
1219
+ if (!s)
1584
1220
  continue;
1585
- const r = s.invocation_id ?? s.id;
1586
- t[r] = a, t[s.id] = a;
1221
+ const r = a.invocation_id ?? a.id;
1222
+ t[r] = s, t[a.id] = s;
1587
1223
  }
1588
1224
  return t;
1589
- }, rn = (e) => JSON.stringify(e), on = (e) => {
1590
- const { jwt: t, headers: s, urls: a } = e, r = JSON.stringify(s ?? {}), o = rn(a), c = U(
1591
- () => {
1592
- const { baseUrl: y, ...C } = a;
1593
- return new Bt({
1594
- baseUrl: y,
1595
- token: t,
1596
- headers: s,
1597
- urls: C
1598
- });
1599
- },
1225
+ }, Zt = (e) => JSON.stringify(e), en = (e) => {
1226
+ const { jwt: t, headers: a, urls: s } = e, r = JSON.stringify(a ?? {}), c = Zt(s), l = U(
1227
+ () => new je({
1228
+ token: t,
1229
+ headers: a,
1230
+ urls: s
1231
+ }),
1600
1232
  // eslint-disable-next-line react-hooks/exhaustive-deps -- keyed on serialised config to keep a stable client.
1601
- [t, o]
1233
+ [t, c]
1602
1234
  );
1603
- Ze(() => {
1604
- c.setHeaders(s);
1605
- }, [c, r]);
1606
- const [d, w] = _([]), [g, p] = _(
1235
+ Ge(() => {
1236
+ l.setHeaders(a);
1237
+ }, [l, r]);
1238
+ const [d, w] = m([]), [f, p] = m(
1607
1239
  []
1608
- ), [m, k] = _({}), [x, P] = _("loading"), [N, D] = _(null), [S, H] = _(0);
1609
- B(() => {
1610
- let y = !1;
1611
- return P("loading"), D(null), (async () => {
1240
+ ), [_, u] = m({}), [C, R] = m("loading"), [y, A] = m(null), [k, $] = m(0);
1241
+ G(() => {
1242
+ let N = !1;
1243
+ return R("loading"), A(null), (async () => {
1612
1244
  try {
1613
- const [C, $] = await Promise.all([
1614
- c.listAgents(),
1615
- c.listAgentDefinitions()
1245
+ const [I, D] = await Promise.all([
1246
+ l.listAgents(),
1247
+ l.listAgentDefinitions()
1616
1248
  ]);
1617
- if (y)
1249
+ if (N)
1618
1250
  return;
1619
- w(C.map(He)), p($.map(Yt)), k(sn(C)), P("idle");
1620
- } catch (C) {
1621
- if (y)
1251
+ w(I.map(De)), p(D.map(Wt)), u(Xt(I)), R("idle");
1252
+ } catch (I) {
1253
+ if (N)
1622
1254
  return;
1623
- w([]), p([]), k({}), P("error"), D(an(C));
1255
+ w([]), p([]), u({}), R("error"), A(Qt(I));
1624
1256
  }
1625
1257
  })(), () => {
1626
- y = !0;
1258
+ N = !0;
1627
1259
  };
1628
- }, [c, S]);
1629
- const q = I(() => {
1630
- H((y) => y + 1);
1631
- }, []), z = I(
1632
- async (y) => {
1633
- const [C, $] = await Promise.all([
1634
- c.getAgentChecklist(y),
1635
- c.getAgent(y).catch(() => null)
1260
+ }, [l, k]);
1261
+ const V = T(() => {
1262
+ $((N) => N + 1);
1263
+ }, []), M = T(
1264
+ async (N) => {
1265
+ const [I, D] = await Promise.all([
1266
+ l.getAgentChecklist(N),
1267
+ l.getAgent(N).catch(() => null)
1636
1268
  ]);
1637
- return nn(
1638
- y,
1639
- C,
1640
- $ ?? void 0
1269
+ return Xe(
1270
+ N,
1271
+ I,
1272
+ D ?? void 0
1641
1273
  );
1642
1274
  },
1643
- [c]
1644
- ), ce = I(
1645
- async (y) => {
1646
- const C = await c.getAgentResources(y);
1647
- return en(C);
1275
+ [l]
1276
+ ), ee = T(
1277
+ async (N) => {
1278
+ const I = await l.getAgentResources(N);
1279
+ return Ye(I);
1648
1280
  },
1649
- [c]
1650
- ), ae = I(
1281
+ [l]
1282
+ ), te = T(
1651
1283
  async ({
1652
- definition: y,
1653
- invocationName: C
1284
+ definition: N,
1285
+ invocationName: I
1654
1286
  }) => {
1655
- const $ = await c.createAgent(y.ref, {
1656
- invocationName: C
1657
- }), K = await c.getAgent($.id), J = He(K), W = ke(K);
1658
- return w((L) => [J, ...L]), W && k((L) => ({
1659
- ...L,
1660
- [J.invocation_id]: W,
1661
- [J.id]: W
1662
- })), J;
1287
+ const D = await l.createAgent(N.ref, {
1288
+ invocationName: I
1289
+ }), Q = await l.getAgent(D.id), P = De(Q), B = we(Q);
1290
+ return w((z) => [P, ...z]), B && u((z) => ({
1291
+ ...z,
1292
+ [P.invocation_id]: B,
1293
+ [P.id]: B
1294
+ })), P;
1663
1295
  },
1664
- [c]
1665
- ), ee = U(
1666
- () => Jt(c, {
1667
- resolveOpeningMessage: (y) => m[y.invocation_id] ?? m[y.id]
1296
+ [l]
1297
+ ), Y = U(
1298
+ () => Ve(l, {
1299
+ resolveOpeningMessage: (N) => _[N.invocation_id] ?? _[N.id]
1668
1300
  }),
1669
- [c, m]
1301
+ [l, _]
1670
1302
  );
1671
1303
  return {
1672
1304
  agents: d,
1673
- agentDefinitions: g,
1674
- loadState: x,
1675
- loadError: N,
1676
- reload: q,
1677
- fetchAgentChecklist: z,
1678
- fetchAgentResources: ce,
1679
- createAgent: ae,
1680
- chatConnector: ee
1305
+ agentDefinitions: f,
1306
+ loadState: C,
1307
+ loadError: y,
1308
+ reload: V,
1309
+ fetchAgentChecklist: M,
1310
+ fetchAgentResources: ee,
1311
+ createAgent: te,
1312
+ chatConnector: Y
1313
+ };
1314
+ }, tn = (e) => JSON.stringify(e), nn = (e) => {
1315
+ const { agent: t, jwt: a, headers: s, urls: r } = e, c = JSON.stringify(s ?? {}), l = tn(r), d = U(
1316
+ () => new je({
1317
+ token: a,
1318
+ headers: s,
1319
+ urls: {
1320
+ agent: r.agentUrl,
1321
+ agentChecklist: r.agentChecklistUrl,
1322
+ ...r.agentResourcesUrl ? { agentResources: r.agentResourcesUrl } : {},
1323
+ agentChat: r.agentChatUrl
1324
+ }
1325
+ }),
1326
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- keyed on serialised config to keep a stable client.
1327
+ [a, l]
1328
+ );
1329
+ Ge(() => {
1330
+ d.setHeaders(s);
1331
+ }, [d, c]);
1332
+ const w = T(
1333
+ async (_) => {
1334
+ const [u, C] = await Promise.all([
1335
+ d.getAgentChecklist(_),
1336
+ d.getAgent(_).catch(() => null)
1337
+ ]);
1338
+ return Xe(
1339
+ _,
1340
+ u,
1341
+ C ?? void 0
1342
+ );
1343
+ },
1344
+ [d]
1345
+ ), f = T(
1346
+ async (_) => {
1347
+ const u = await d.getAgentResources(_);
1348
+ return Ye(u);
1349
+ },
1350
+ [d]
1351
+ );
1352
+ return {
1353
+ connector: U(
1354
+ () => Ve(d)(t),
1355
+ [d, t]
1356
+ ),
1357
+ fetchAgentChecklist: w,
1358
+ fetchAgentResources: f
1681
1359
  };
1682
- }, cn = (e) => e !== void 0 && e.some((t) => t.status === b.hitl), ln = (e, t) => cn(t) ? v.hitl : e.status, dn = ({ column: e, label: t }) => e.statusIcon ? /* @__PURE__ */ n("span", { className: "agent-view__status-indicator", children: /* @__PURE__ */ n(
1360
+ }, an = (e, t) => {
1361
+ const a = e.hasRunBefore ? t || "This trip" : e.tripName.trim() || "A new trip", s = e.destination ? ` to ${e.destination}` : "", r = e.hasRunBefore ? " It has run before." : "";
1362
+ return `${a}${s}.${r}`.trim();
1363
+ }, sn = (e) => {
1364
+ switch (e) {
1365
+ case v.failed:
1366
+ return b.stopped;
1367
+ case v.complete:
1368
+ return b.complete;
1369
+ default:
1370
+ return b.running;
1371
+ }
1372
+ }, He = (e, t) => {
1373
+ t([pe(e)]);
1374
+ }, rn = ({
1375
+ agent: e,
1376
+ open: t,
1377
+ onClose: a,
1378
+ jwt: s,
1379
+ headers: r,
1380
+ agentUrl: c,
1381
+ agentChecklistUrl: l,
1382
+ agentResourcesUrl: d,
1383
+ agentChatUrl: w,
1384
+ enableUpload: f,
1385
+ initialBrief: p,
1386
+ initialPhase: _,
1387
+ initialChecklist: u
1388
+ }) => {
1389
+ const { connector: C, fetchAgentChecklist: R, fetchAgentResources: y } = nn({
1390
+ agent: e,
1391
+ jwt: s,
1392
+ headers: r,
1393
+ urls: {
1394
+ agentUrl: c,
1395
+ agentChecklistUrl: l,
1396
+ agentResourcesUrl: d,
1397
+ agentChatUrl: w
1398
+ }
1399
+ }), A = Re(C), [k, $] = m(
1400
+ _ ?? (p ? b.running : sn(e.status))
1401
+ ), [V, M] = m([]), [ee, te] = m(0), [Y, N] = m(), [I, D] = m(null), [Q, P] = m([]), [B, z] = m(!1), [ce, X] = m(null), [ke, K] = m(
1402
+ u ?? null
1403
+ ), [ye, le] = m(!1), [Z, de] = m(null), [_e, ne] = m(!1), [ae, Ne] = m(!1), [se, Ae] = m(!1), q = Re(!1);
1404
+ G(() => {
1405
+ A.current = C;
1406
+ }, [C]), G(() => {
1407
+ q.current = !1, M([]), te((o) => o + 1);
1408
+ }, [e.invocation_id]), G(() => {
1409
+ if (!t || p || q.current)
1410
+ return;
1411
+ const o = A.current.bootstrapConversation;
1412
+ if (!o) {
1413
+ He(
1414
+ A.current.openingMessage(),
1415
+ M
1416
+ );
1417
+ return;
1418
+ }
1419
+ q.current = !0;
1420
+ let g = !1;
1421
+ return ne(!0), (async () => {
1422
+ try {
1423
+ const h = await o.call(A.current);
1424
+ if (g)
1425
+ return;
1426
+ M(h.map(pe));
1427
+ } catch {
1428
+ g || He(
1429
+ A.current.openingMessage(),
1430
+ M
1431
+ );
1432
+ } finally {
1433
+ g || ne(!1);
1434
+ }
1435
+ })(), () => {
1436
+ g = !0;
1437
+ };
1438
+ }, [t, p, e.invocation_id, C]);
1439
+ const Se = T((o) => {
1440
+ o.checklist && K(o.checklist), o.phase && $(o.phase);
1441
+ }, []);
1442
+ G(() => {
1443
+ var o, g;
1444
+ !t || p || u && u.length > 0 && ((g = (o = A.current).seedChecklist) == null || g.call(o, u));
1445
+ }, [t, p, u]), G(() => {
1446
+ if (!t || p)
1447
+ return;
1448
+ let o = !1;
1449
+ return le(!(u != null && u.length)), de(null), (async () => {
1450
+ var g, h;
1451
+ try {
1452
+ const L = await R(e.invocation_id);
1453
+ if (o)
1454
+ return;
1455
+ u != null && u.length || (K(L.checklist), (h = (g = A.current).seedChecklist) == null || h.call(g, L.checklist));
1456
+ } catch {
1457
+ !o && !(u != null && u.length) && de(Ee);
1458
+ } finally {
1459
+ o || le(!1);
1460
+ }
1461
+ })(), () => {
1462
+ o = !0;
1463
+ };
1464
+ }, [
1465
+ t,
1466
+ e.invocation_id,
1467
+ p,
1468
+ u,
1469
+ R
1470
+ ]), G(() => {
1471
+ if (!t || !d)
1472
+ return;
1473
+ let o = !1;
1474
+ return z(!0), X(null), (async () => {
1475
+ try {
1476
+ const g = await y(
1477
+ e.invocation_id
1478
+ );
1479
+ o || P(g);
1480
+ } catch {
1481
+ o || X(pt);
1482
+ } finally {
1483
+ o || z(!1);
1484
+ }
1485
+ })(), () => {
1486
+ o = !0;
1487
+ };
1488
+ }, [t, e.invocation_id, d, y]), G(() => {
1489
+ if (!t || !p || q.current)
1490
+ return;
1491
+ q.current = !0;
1492
+ const o = {
1493
+ id: `user-brief-${Date.now()}`,
1494
+ author: j.user,
1495
+ text: an(p, e.invocation_name)
1496
+ };
1497
+ (async () => {
1498
+ const g = await A.current.start(p);
1499
+ M([
1500
+ pe(A.current.openingMessage()),
1501
+ pe(o),
1502
+ pe(g.message)
1503
+ ]), g.checklist && K(g.checklist), $(g.phase ?? b.running);
1504
+ })();
1505
+ }, [t, p, e.invocation_name]);
1506
+ const be = T(
1507
+ (o) => {
1508
+ D(xt(o));
1509
+ },
1510
+ []
1511
+ ), Ce = T((o) => {
1512
+ D(null), N(o), te((g) => g + 1);
1513
+ }, []), me = T(async () => {
1514
+ await A.current.stop(), $(b.stopped);
1515
+ }, []), fe = ke;
1516
+ return /* @__PURE__ */ i(
1517
+ W,
1518
+ {
1519
+ open: t,
1520
+ closeHandler: a,
1521
+ hideCloseButton: !0,
1522
+ className: "agent-workspace",
1523
+ children: [
1524
+ /* @__PURE__ */ i(W.Header, { className: "agent-workspace__header", children: [
1525
+ /* @__PURE__ */ i("div", { className: "agent-workspace__header-title", children: [
1526
+ /* @__PURE__ */ n(
1527
+ "span",
1528
+ {
1529
+ className: "agent-workspace__header-avatar",
1530
+ "aria-hidden": "true",
1531
+ children: /* @__PURE__ */ n(E, { name: "ask-arbor", size: 24 })
1532
+ }
1533
+ ),
1534
+ /* @__PURE__ */ n(W.Title, { children: e.invocation_name }),
1535
+ /* @__PURE__ */ n(
1536
+ "span",
1537
+ {
1538
+ className: H(
1539
+ "agent-workspace__phase",
1540
+ `agent-workspace__phase--${k}`
1541
+ ),
1542
+ children: mt[k]
1543
+ }
1544
+ )
1545
+ ] }),
1546
+ /* @__PURE__ */ i("div", { className: "agent-workspace__header-actions", children: [
1547
+ /* @__PURE__ */ n(
1548
+ J,
1549
+ {
1550
+ variant: "tertiary",
1551
+ size: "S",
1552
+ iconLeftName: "clipboard-list",
1553
+ iconLeftScreenReaderText: "Toggle checklist",
1554
+ "aria-pressed": !se,
1555
+ onClick: () => Ae((o) => !o),
1556
+ children: "Checklist"
1557
+ }
1558
+ ),
1559
+ /* @__PURE__ */ n(
1560
+ J,
1561
+ {
1562
+ variant: "tertiary",
1563
+ size: "S",
1564
+ iconLeftName: "files",
1565
+ iconLeftScreenReaderText: "Toggle resources",
1566
+ "aria-pressed": !ae,
1567
+ onClick: () => Ne((o) => !o),
1568
+ children: "Resources"
1569
+ }
1570
+ ),
1571
+ /* @__PURE__ */ n(
1572
+ J,
1573
+ {
1574
+ variant: "secondary",
1575
+ size: "S",
1576
+ iconLeftName: "x",
1577
+ iconLeftScreenReaderText: "Close",
1578
+ onClick: a,
1579
+ children: "Close"
1580
+ }
1581
+ )
1582
+ ] })
1583
+ ] }),
1584
+ /* @__PURE__ */ i(
1585
+ W.Body,
1586
+ {
1587
+ className: H("agent-workspace__body", {
1588
+ "agent-workspace__body--no-left": se,
1589
+ "agent-workspace__body--no-right": ae
1590
+ }),
1591
+ children: [
1592
+ !se && /* @__PURE__ */ n(
1593
+ Et,
1594
+ {
1595
+ checklist: fe,
1596
+ isLoading: ye,
1597
+ error: Z,
1598
+ phase: k,
1599
+ canRequestInput: k === b.running && !_e,
1600
+ onStop: () => void me(),
1601
+ onAttentionItemClick: be
1602
+ }
1603
+ ),
1604
+ /* @__PURE__ */ n(
1605
+ Tt,
1606
+ {
1607
+ connector: A.current,
1608
+ phase: k,
1609
+ chatHistory: V,
1610
+ chatSessionKey: ee,
1611
+ startQuery: Y,
1612
+ clarificationMessage: I,
1613
+ enableUpload: f,
1614
+ onTurn: Se,
1615
+ onAwaitingChange: ne,
1616
+ onClarificationPrompt: Ce,
1617
+ onDismissClarification: () => D(null)
1618
+ }
1619
+ ),
1620
+ !ae && /* @__PURE__ */ n(
1621
+ Rt,
1622
+ {
1623
+ resources: Q,
1624
+ isLoading: B,
1625
+ error: ce
1626
+ }
1627
+ )
1628
+ ]
1629
+ }
1630
+ )
1631
+ ]
1632
+ }
1633
+ );
1634
+ }, on = ({
1635
+ open: e,
1636
+ onClose: t,
1637
+ onStart: a,
1638
+ agentDefinitions: s
1639
+ }) => {
1640
+ const r = s[0], [c, l] = m(
1641
+ r
1642
+ ), [d, w] = m(""), [f, p] = m(!1), [_, u] = m(null), C = [...s].sort((k, $) => k.agent_intent.localeCompare($.agent_intent)).map((k) => ({
1643
+ value: k.ref,
1644
+ label: k.agent_intent
1645
+ }));
1646
+ G(() => {
1647
+ e && (l(r), w(""), p(!1), u(null));
1648
+ }, [e, r]);
1649
+ const R = c !== void 0 && d.trim().length > 0, y = T(
1650
+ (k) => {
1651
+ const $ = s.find(
1652
+ (V) => V.ref === k[0]
1653
+ );
1654
+ $ && l($);
1655
+ },
1656
+ [s]
1657
+ ), A = T(async () => {
1658
+ if (!(!c || !R || f)) {
1659
+ p(!0), u(null);
1660
+ try {
1661
+ await a({ definition: c, invocationName: d.trim() });
1662
+ } catch (k) {
1663
+ u(
1664
+ k instanceof Error ? k.message : "Unable to start the agent."
1665
+ );
1666
+ } finally {
1667
+ p(!1);
1668
+ }
1669
+ }
1670
+ }, [R, c, d, f, a]);
1671
+ return !c || s.length === 0 ? null : /* @__PURE__ */ i(
1672
+ W,
1673
+ {
1674
+ open: e,
1675
+ closeHandler: t,
1676
+ className: "new-agent",
1677
+ children: [
1678
+ /* @__PURE__ */ n(W.Header, { className: "new-agent__header", children: /* @__PURE__ */ i("div", { className: "new-agent__header-title", children: [
1679
+ /* @__PURE__ */ n(
1680
+ "span",
1681
+ {
1682
+ className: "new-agent__header-avatar",
1683
+ "aria-hidden": "true",
1684
+ children: /* @__PURE__ */ n(E, { name: "ask-arbor", size: 24 })
1685
+ }
1686
+ ),
1687
+ /* @__PURE__ */ n(W.Title, { children: "Start an agent" })
1688
+ ] }) }),
1689
+ /* @__PURE__ */ n(W.Body, { className: "new-agent__body", children: /* @__PURE__ */ i(
1690
+ "form",
1691
+ {
1692
+ className: "new-agent__form",
1693
+ "aria-label": "Start an agent",
1694
+ onSubmit: (k) => {
1695
+ k.preventDefault(), R && !f && A();
1696
+ },
1697
+ children: [
1698
+ /* @__PURE__ */ i("div", { className: "new-agent__type-field", children: [
1699
+ /* @__PURE__ */ n(
1700
+ "label",
1701
+ {
1702
+ className: "new-agent__type-label",
1703
+ htmlFor: "new-agent-type",
1704
+ children: "What would you like your agent to do?"
1705
+ }
1706
+ ),
1707
+ /* @__PURE__ */ n(
1708
+ tt,
1709
+ {
1710
+ id: "new-agent-type",
1711
+ placeholder: "Choose an intent",
1712
+ options: C,
1713
+ selectedValues: [c.ref],
1714
+ onSelectionChange: y
1715
+ }
1716
+ ),
1717
+ /* @__PURE__ */ n("p", { className: "new-agent__type-description", children: c.description })
1718
+ ] }),
1719
+ /* @__PURE__ */ i("div", { className: "new-agent__type-field", children: [
1720
+ /* @__PURE__ */ n(
1721
+ "label",
1722
+ {
1723
+ className: "new-agent__type-label",
1724
+ htmlFor: "new-agent-invocation-name",
1725
+ children: "Name"
1726
+ }
1727
+ ),
1728
+ /* @__PURE__ */ n(
1729
+ nt,
1730
+ {
1731
+ id: "new-agent-invocation-name",
1732
+ value: d,
1733
+ placeholder: "e.g. Test with memory3",
1734
+ onChange: (k) => w(k.target.value)
1735
+ }
1736
+ )
1737
+ ] }),
1738
+ _ ? /* @__PURE__ */ n("p", { className: "new-agent__error", role: "alert", children: _ }) : null,
1739
+ /* @__PURE__ */ n("div", { className: "new-agent__actions", children: /* @__PURE__ */ n(
1740
+ J,
1741
+ {
1742
+ type: "submit",
1743
+ variant: "primary",
1744
+ disabled: !R || f,
1745
+ iconLeftName: f ? "loader" : "sparkles",
1746
+ iconLeftScreenReaderText: f ? "Starting" : void 0,
1747
+ children: f ? "Starting…" : "Start"
1748
+ }
1749
+ ) })
1750
+ ]
1751
+ }
1752
+ ) })
1753
+ ]
1754
+ }
1755
+ );
1756
+ }, cn = (e) => e !== void 0 && e.some((t) => t.status === S.hitl), ln = (e, t) => cn(t) ? v.hitl : e.status, dn = ({ column: e, label: t }) => e.statusIcon ? /* @__PURE__ */ n("span", { className: "agent-view__status-indicator", children: /* @__PURE__ */ n(
1683
1757
  E,
1684
1758
  {
1685
1759
  name: e.statusIcon.name,
1686
1760
  size: 16,
1687
1761
  color: e.statusIcon.color,
1688
- className: M({
1762
+ className: H({
1689
1763
  "agent-view__progress-icon--spinning": e.statusIcon.spin
1690
1764
  }),
1691
1765
  screenReaderText: t
@@ -1693,48 +1767,48 @@ const Jt = (e, t) => (s) => {
1693
1767
  ) }) : /* @__PURE__ */ n(
1694
1768
  "span",
1695
1769
  {
1696
- className: M("agent-view__dot", {
1770
+ className: H("agent-view__dot", {
1697
1771
  [`agent-view__dot--${e.dotModifier}`]: e.dotModifier
1698
1772
  }),
1699
- children: /* @__PURE__ */ n(Ge, { colour: e.dotColour, label: t })
1773
+ children: /* @__PURE__ */ n(Be, { colour: e.dotColour, label: t })
1700
1774
  }
1701
1775
  ), gn = ({
1702
1776
  agent: e,
1703
1777
  agentName: t,
1704
- column: s,
1705
- isExpanded: a,
1778
+ column: a,
1779
+ isExpanded: s,
1706
1780
  isLoading: r,
1707
- checklist: o,
1708
- error: c,
1781
+ checklist: c,
1782
+ error: l,
1709
1783
  onToggle: d,
1710
1784
  onViewAgent: w
1711
1785
  }) => {
1712
- const { id: g, invocation_name: p } = e, m = `agent-card-${g}-header`, k = `agent-card-${g}-progress`;
1786
+ const { id: f, invocation_name: p } = e, _ = `agent-card-${f}-header`, u = `agent-card-${f}-progress`;
1713
1787
  return /* @__PURE__ */ n(
1714
1788
  "li",
1715
1789
  {
1716
- className: M("agent-view__card", {
1717
- "agent-view__card--expanded": a
1790
+ className: H("agent-view__card", {
1791
+ "agent-view__card--expanded": s
1718
1792
  }),
1719
- children: /* @__PURE__ */ i(nt, { spacing: "dense", children: [
1793
+ children: /* @__PURE__ */ i(at, { spacing: "dense", children: [
1720
1794
  /* @__PURE__ */ n(
1721
1795
  "button",
1722
1796
  {
1723
1797
  type: "button",
1724
1798
  className: "agent-view__card-toggle",
1725
- "aria-expanded": a,
1726
- "aria-controls": k,
1799
+ "aria-expanded": s,
1800
+ "aria-controls": u,
1727
1801
  "aria-label": p,
1728
- id: m,
1729
- onClick: () => d(g),
1802
+ id: _,
1803
+ onClick: () => d(f),
1730
1804
  children: /* @__PURE__ */ i("div", { className: "agent-view__card-content", children: [
1731
- /* @__PURE__ */ n(dn, { column: s }),
1805
+ /* @__PURE__ */ n(dn, { column: a }),
1732
1806
  /* @__PURE__ */ n("span", { className: "agent-view__card-invocation-name", children: p }),
1733
1807
  /* @__PURE__ */ n("span", { className: "agent-view__card-agent-name", children: t }),
1734
1808
  /* @__PURE__ */ n(
1735
1809
  E,
1736
1810
  {
1737
- name: a ? "chevron-up" : "chevron-down",
1811
+ name: s ? "chevron-up" : "chevron-down",
1738
1812
  size: 16,
1739
1813
  className: "agent-view__card-chevron"
1740
1814
  }
@@ -1742,11 +1816,11 @@ const Jt = (e, t) => (s) => {
1742
1816
  ] })
1743
1817
  }
1744
1818
  ),
1745
- a && /* @__PURE__ */ i(
1819
+ s && /* @__PURE__ */ i(
1746
1820
  "div",
1747
1821
  {
1748
- id: k,
1749
- "aria-labelledby": m,
1822
+ id: u,
1823
+ "aria-labelledby": _,
1750
1824
  className: "agent-view__card-progress",
1751
1825
  children: [
1752
1826
  r && /* @__PURE__ */ i("div", { className: "agent-view__progress-loading", "aria-live": "polite", children: [
@@ -1762,9 +1836,9 @@ const Jt = (e, t) => (s) => {
1762
1836
  ),
1763
1837
  /* @__PURE__ */ n("span", { children: oe })
1764
1838
  ] }),
1765
- !r && c && /* @__PURE__ */ n("p", { className: "agent-view__progress-error", role: "alert", children: c }),
1766
- !r && !c && o !== null && /* @__PURE__ */ n(At, { checklist: o }),
1767
- !r && !c && o === null && /* @__PURE__ */ i("div", { className: "agent-view__progress-loading", "aria-live": "polite", children: [
1839
+ !r && l && /* @__PURE__ */ n("p", { className: "agent-view__progress-error", role: "alert", children: l }),
1840
+ !r && !l && c !== null && /* @__PURE__ */ n(St, { checklist: c }),
1841
+ !r && !l && c === null && /* @__PURE__ */ i("div", { className: "agent-view__progress-loading", "aria-live": "polite", children: [
1768
1842
  /* @__PURE__ */ n(
1769
1843
  E,
1770
1844
  {
@@ -1778,7 +1852,7 @@ const Jt = (e, t) => (s) => {
1778
1852
  /* @__PURE__ */ n("span", { children: oe })
1779
1853
  ] }),
1780
1854
  /* @__PURE__ */ n("div", { className: "agent-view__card-actions", children: /* @__PURE__ */ n(
1781
- X,
1855
+ J,
1782
1856
  {
1783
1857
  variant: "secondary",
1784
1858
  size: "S",
@@ -1795,19 +1869,19 @@ const Jt = (e, t) => (s) => {
1795
1869
  }, Fe = ({
1796
1870
  column: e,
1797
1871
  agents: t,
1798
- expandedAgentId: s,
1799
- loadingAgentId: a,
1872
+ expandedAgentId: a,
1873
+ loadingAgentId: s,
1800
1874
  checklistByInvocationId: r,
1801
- errorByAgentId: o,
1802
- definitionNameByRef: c,
1875
+ errorByAgentId: c,
1876
+ definitionNameByRef: l,
1803
1877
  onToggleAgent: d,
1804
1878
  onViewAgent: w,
1805
- isSplit: g = !1
1879
+ isSplit: f = !1
1806
1880
  }) => /* @__PURE__ */ i(
1807
1881
  "section",
1808
1882
  {
1809
- className: M("agent-view__column", {
1810
- "agent-view__column--split": g
1883
+ className: H("agent-view__column", {
1884
+ "agent-view__column--split": f
1811
1885
  }),
1812
1886
  "aria-label": e.title,
1813
1887
  children: [
@@ -1819,12 +1893,12 @@ const Jt = (e, t) => (s) => {
1819
1893
  gn,
1820
1894
  {
1821
1895
  agent: p,
1822
- agentName: Ce(p, c),
1896
+ agentName: Ie(p, l),
1823
1897
  column: e,
1824
- isExpanded: s === p.id,
1825
- isLoading: a === p.id,
1898
+ isExpanded: a === p.id,
1899
+ isLoading: s === p.id,
1826
1900
  checklist: r[p.invocation_id] ?? null,
1827
- error: o[p.id] ?? null,
1901
+ error: c[p.id] ?? null,
1828
1902
  onToggle: d,
1829
1903
  onViewAgent: w
1830
1904
  },
@@ -1832,185 +1906,178 @@ const Jt = (e, t) => (s) => {
1832
1906
  )) })
1833
1907
  ]
1834
1908
  }
1835
- ), Ce = (e, t) => t.get(e.agent_definition_ref) ?? e.agent_definition_ref.replace(/_/g, " "), wn = ({
1909
+ ), Ie = (e, t) => t.get(e.agent_definition_ref) ?? e.agent_definition_ref.replace(/_/g, " "), wn = ({
1836
1910
  jwt: e,
1837
1911
  headers: t,
1838
- baseUrl: s,
1839
1912
  agentDefinitionsUrl: a,
1840
- agentsUrl: r,
1841
- agentUrl: o,
1913
+ agentsUrl: s,
1914
+ agentUrl: r,
1842
1915
  agentChecklistUrl: c,
1843
- agentResourcesUrl: d,
1844
- agentChatUrl: w,
1845
- institutions: g
1916
+ agentResourcesUrl: l,
1917
+ agentChatUrl: d,
1918
+ enableUpload: w,
1919
+ institutions: f
1846
1920
  }) => {
1847
- var Ie;
1921
+ var fe;
1848
1922
  const p = U(
1849
1923
  () => ({
1850
- baseUrl: s,
1851
- ...a ? { agentDefinitions: a } : {},
1852
- ...r ? { agents: r } : {},
1853
- ...o ? { agent: o } : {},
1854
- ...c ? { agentChecklist: c } : {},
1855
- ...d ? { agentResources: d } : {},
1856
- ...w ? { agentChat: w } : {}
1924
+ agentDefinitions: a,
1925
+ agents: s,
1926
+ agent: r,
1927
+ agentChecklist: c,
1928
+ ...l ? { agentResources: l } : {},
1929
+ agentChat: d
1857
1930
  }),
1858
1931
  [
1859
- s,
1860
1932
  a,
1933
+ s,
1861
1934
  r,
1862
- o,
1863
1935
  c,
1864
- d,
1865
- w
1936
+ l,
1937
+ d
1866
1938
  ]
1867
- ), [m, k] = _(null), x = m ? (Ie = g == null ? void 0 : g.find(
1868
- (l) => l.applicationId === m.application_id
1869
- )) == null ? void 0 : Ie.applicationUrl : void 0, P = U(() => {
1870
- const l = { ...t ?? {} };
1871
- return x ? l[ie.arborApplicationUrl] = x : delete l[ie.arborApplicationUrl], l;
1872
- }, [t, x]), {
1873
- agents: N,
1874
- agentDefinitions: D,
1875
- loadState: S,
1876
- loadError: H,
1877
- reload: q,
1878
- fetchAgentChecklist: z,
1879
- fetchAgentResources: ce,
1880
- createAgent: ae,
1881
- chatConnector: ee
1882
- } = on({ jwt: e, headers: P, urls: p }), [y, C] = _(!1), [$, K] = _(null), [J, W] = _(null), [L, le] = _({}), [Ne, te] = _({}), [j, ye] = _([]), [V, Ae] = _([]), Y = U(() => {
1883
- const l = new Set(N.map((h) => h.application_id)), f = new Map(
1884
- (g ?? []).map((h) => [h.applicationId, h.name])
1939
+ ), [_, u] = m(null), C = _ ? (fe = f == null ? void 0 : f.find(
1940
+ (o) => o.applicationId === _.application_id
1941
+ )) == null ? void 0 : fe.applicationUrl : void 0, R = U(() => {
1942
+ const o = { ...t ?? {} };
1943
+ return C ? o[ie.arborApplicationUrl] = C : delete o[ie.arborApplicationUrl], o;
1944
+ }, [t, C]), {
1945
+ agents: y,
1946
+ agentDefinitions: A,
1947
+ loadState: k,
1948
+ loadError: $,
1949
+ reload: V,
1950
+ fetchAgentChecklist: M,
1951
+ createAgent: ee
1952
+ } = en({ jwt: e, headers: R, urls: p }), [te, Y] = m(!1), [N, I] = m(null), [D, Q] = m(null), [P, B] = m({}), [z, ce] = m({}), [X, ke] = m([]), [K, ye] = m([]), le = U(() => {
1953
+ const o = new Set(y.map((h) => h.application_id)), g = new Map(
1954
+ (f ?? []).map((h) => [h.applicationId, h.name])
1885
1955
  );
1886
- return [...l].sort(
1887
- (h, F) => (f.get(h) ?? h).localeCompare(f.get(F) ?? F)
1956
+ return [...o].sort(
1957
+ (h, L) => (g.get(h) ?? h).localeCompare(g.get(L) ?? L)
1888
1958
  ).map((h) => ({
1889
1959
  value: h,
1890
- label: f.get(h) ?? h
1960
+ label: g.get(h) ?? h
1891
1961
  }));
1892
- }, [N, g]), ne = U(
1893
- () => new Map(D.map((l) => [l.ref, l.display_name])),
1894
- [D]
1895
- ), _e = U(() => [...new Set(
1896
- N.map((f) => Ce(f, ne))
1897
- )].sort((f, h) => f.localeCompare(h)).map((f) => ({
1898
- value: f,
1899
- label: f
1900
- })), [N, ne]), me = U(() => N.filter((l) => !(j.length > 0 && !j.includes(l.application_id) || V.length > 0 && !V.includes(Ce(l, ne)))), [N, ne, V, j]), fe = Y.length > 1, ve = _e.length > 1, u = fe || ve;
1901
- B(() => {
1902
- if (N.length === 0)
1962
+ }, [y, f]), Z = U(
1963
+ () => new Map(A.map((o) => [o.ref, o.display_name])),
1964
+ [A]
1965
+ ), de = U(() => [...new Set(
1966
+ y.map((g) => Ie(g, Z))
1967
+ )].sort((g, h) => g.localeCompare(h)).map((g) => ({
1968
+ value: g,
1969
+ label: g
1970
+ })), [y, Z]), _e = U(() => y.filter((o) => !(X.length > 0 && !X.includes(o.application_id) || K.length > 0 && !K.includes(Ie(o, Z)))), [y, Z, K, X]), ne = le.length > 1, ae = de.length > 1, Ne = ne || ae;
1971
+ G(() => {
1972
+ if (y.length === 0)
1903
1973
  return;
1904
- let l = !1;
1974
+ let o = !1;
1905
1975
  return (async () => {
1906
- const f = await Promise.allSettled(
1907
- N.map(async (h) => {
1908
- const F = await z(h.invocation_id);
1976
+ const g = await Promise.allSettled(
1977
+ y.map(async (h) => {
1978
+ const L = await M(h.invocation_id);
1909
1979
  return {
1910
1980
  agentId: h.id,
1911
1981
  invocationId: h.invocation_id,
1912
- checklist: F.checklist
1982
+ checklist: L.checklist
1913
1983
  };
1914
1984
  })
1915
1985
  );
1916
- l || (le((h) => {
1917
- const F = { ...h };
1918
- for (const ge of f)
1919
- ge.status === "fulfilled" && (F[ge.value.invocationId] = ge.value.checklist);
1920
- return F;
1921
- }), te((h) => {
1922
- const F = { ...h };
1923
- return f.forEach((ge, Qe) => {
1924
- ge.status === "rejected" && (F[N[Qe].id] = be);
1925
- }), F;
1986
+ o || (B((h) => {
1987
+ const L = { ...h };
1988
+ for (const ge of g)
1989
+ ge.status === "fulfilled" && (L[ge.value.invocationId] = ge.value.checklist);
1990
+ return L;
1991
+ }), ce((h) => {
1992
+ const L = { ...h };
1993
+ return g.forEach((ge, Ze) => {
1994
+ ge.status === "rejected" && (L[y[Ze].id] = Ee);
1995
+ }), L;
1926
1996
  }));
1927
1997
  })(), () => {
1928
- l = !0;
1998
+ o = !0;
1929
1999
  };
1930
- }, [N, z]);
1931
- const A = I(
1932
- async (l) => {
1933
- if (!L[l.invocation_id]) {
1934
- W(l.id), te((f) => {
1935
- const h = { ...f };
1936
- return delete h[l.id], h;
2000
+ }, [y, M]);
2001
+ const se = T(
2002
+ async (o) => {
2003
+ if (!P[o.invocation_id]) {
2004
+ Q(o.id), ce((g) => {
2005
+ const h = { ...g };
2006
+ return delete h[o.id], h;
1937
2007
  });
1938
2008
  try {
1939
- const f = await z(l.invocation_id);
1940
- le((h) => ({
2009
+ const g = await M(o.invocation_id);
2010
+ B((h) => ({
1941
2011
  ...h,
1942
- [l.invocation_id]: f.checklist
2012
+ [o.invocation_id]: g.checklist
1943
2013
  }));
1944
2014
  } catch {
1945
- te((f) => ({
1946
- ...f,
1947
- [l.id]: be
2015
+ ce((g) => ({
2016
+ ...g,
2017
+ [o.id]: Ee
1948
2018
  }));
1949
2019
  } finally {
1950
- W((f) => f === l.id ? null : f);
2020
+ Q((g) => g === o.id ? null : g);
1951
2021
  }
1952
2022
  }
1953
2023
  },
1954
- [z, L]
1955
- ), se = I(
1956
- (l) => {
1957
- if ($ === l) {
1958
- K(null);
2024
+ [M, P]
2025
+ ), Ae = T(
2026
+ (o) => {
2027
+ if (N === o) {
2028
+ I(null);
1959
2029
  return;
1960
2030
  }
1961
- const f = N.find(({ id: h }) => h === l);
1962
- f && (K(l), A(f));
2031
+ const g = y.find(({ id: h }) => h === o);
2032
+ g && (I(o), se(g));
1963
2033
  },
1964
- [N, $, A]
1965
- ), de = U(() => {
1966
- const l = {};
1967
- for (const f of me) {
2034
+ [y, N, se]
2035
+ ), q = U(() => {
2036
+ const o = {};
2037
+ for (const g of _e) {
1968
2038
  const h = ln(
1969
- f,
1970
- L[f.invocation_id]
2039
+ g,
2040
+ P[g.invocation_id]
1971
2041
  );
1972
- (l[h] ?? (l[h] = [])).push(f);
2042
+ (o[h] ?? (o[h] = [])).push(g);
1973
2043
  }
1974
- return l;
1975
- }, [me, L]), je = I((l) => {
1976
- k(l);
1977
- }, []), Ve = I(
1978
- async (l) => {
1979
- const f = await ae(l);
1980
- k(f), C(!1);
2044
+ return o;
2045
+ }, [_e, P]), Se = T((o) => {
2046
+ u(o);
2047
+ }, []), be = T(
2048
+ async (o) => {
2049
+ const g = await ee(o);
2050
+ u(g), Y(!1);
1981
2051
  },
1982
- [ae]
1983
- ), Ye = I(() => {
1984
- k(null);
1985
- }, []), Te = U(
1986
- () => m ? ee(m) : void 0,
1987
- [ee, m]
1988
- ), Ee = {
1989
- expandedAgentId: $,
1990
- loadingAgentId: J,
1991
- checklistByInvocationId: L,
1992
- errorByAgentId: Ne,
1993
- definitionNameByRef: ne,
1994
- onToggleAgent: se,
1995
- onViewAgent: je
2052
+ [ee]
2053
+ ), Ce = T(() => {
2054
+ u(null);
2055
+ }, []), me = {
2056
+ expandedAgentId: N,
2057
+ loadingAgentId: D,
2058
+ checklistByInvocationId: P,
2059
+ errorByAgentId: z,
2060
+ definitionNameByRef: Z,
2061
+ onToggleAgent: Ae,
2062
+ onViewAgent: Se
1996
2063
  };
1997
2064
  return /* @__PURE__ */ i("div", { className: "agent-view-frontend agent-view", children: [
1998
2065
  /* @__PURE__ */ i("div", { className: "agent-view__header", children: [
1999
2066
  /* @__PURE__ */ n(he, { level: 1, children: "Agents" }),
2000
2067
  /* @__PURE__ */ n(
2001
- X,
2068
+ J,
2002
2069
  {
2003
2070
  variant: "primary",
2004
2071
  size: "S",
2005
2072
  iconLeftName: "sparkles",
2006
2073
  iconLeftScreenReaderText: "Start an agent",
2007
- onClick: () => C(!0),
2074
+ onClick: () => Y(!0),
2008
2075
  children: "Start an agent"
2009
2076
  }
2010
2077
  )
2011
2078
  ] }),
2012
- N.length > 0 && u && /* @__PURE__ */ i("div", { className: "agent-view__filters", children: [
2013
- fe && /* @__PURE__ */ i("div", { className: "agent-view__filter", children: [
2079
+ y.length > 0 && Ne && /* @__PURE__ */ i("div", { className: "agent-view__filters", children: [
2080
+ ne && /* @__PURE__ */ i("div", { className: "agent-view__filter", children: [
2014
2081
  /* @__PURE__ */ n(
2015
2082
  "label",
2016
2083
  {
@@ -2027,16 +2094,16 @@ const Jt = (e, t) => (s) => {
2027
2094
  multiple: !0,
2028
2095
  searchType: "substring",
2029
2096
  placeholder: "All institutions",
2030
- options: Y,
2031
- value: j,
2032
- onValueChange: ye,
2097
+ options: le,
2098
+ value: X,
2099
+ onValueChange: ke,
2033
2100
  showSelectionCountBadge: !0,
2034
2101
  showClearAll: !0,
2035
2102
  clearAllLabel: "Clear institutions"
2036
2103
  }
2037
2104
  )
2038
2105
  ] }),
2039
- ve && /* @__PURE__ */ i("div", { className: "agent-view__filter", children: [
2106
+ ae && /* @__PURE__ */ i("div", { className: "agent-view__filter", children: [
2040
2107
  /* @__PURE__ */ n(
2041
2108
  "label",
2042
2109
  {
@@ -2053,9 +2120,9 @@ const Jt = (e, t) => (s) => {
2053
2120
  multiple: !0,
2054
2121
  searchType: "substring",
2055
2122
  placeholder: "All agents",
2056
- options: _e,
2057
- value: V,
2058
- onValueChange: Ae,
2123
+ options: de,
2124
+ value: K,
2125
+ onValueChange: ye,
2059
2126
  showSelectionCountBadge: !0,
2060
2127
  showClearAll: !0,
2061
2128
  clearAllLabel: "Clear agents"
@@ -2063,7 +2130,7 @@ const Jt = (e, t) => (s) => {
2063
2130
  )
2064
2131
  ] })
2065
2132
  ] }),
2066
- S === "error" ? /* @__PURE__ */ i("div", { className: "agent-view__state agent-view__state--error", role: "alert", children: [
2133
+ k === "error" ? /* @__PURE__ */ i("div", { className: "agent-view__state agent-view__state--error", role: "alert", children: [
2067
2134
  /* @__PURE__ */ n(
2068
2135
  E,
2069
2136
  {
@@ -2072,9 +2139,9 @@ const Jt = (e, t) => (s) => {
2072
2139
  color: "var(--color-semantic-destructive-600)"
2073
2140
  }
2074
2141
  ),
2075
- /* @__PURE__ */ n("p", { className: "agent-view__state-message", children: H ?? ze }),
2076
- /* @__PURE__ */ n(X, { variant: "secondary", size: "S", onClick: q, children: "Try again" })
2077
- ] }) : S === "loading" && N.length === 0 ? /* @__PURE__ */ i("div", { className: "agent-view__state", "aria-live": "polite", children: [
2142
+ /* @__PURE__ */ n("p", { className: "agent-view__state-message", children: $ ?? qe }),
2143
+ /* @__PURE__ */ n(J, { variant: "secondary", size: "S", onClick: V, children: "Try again" })
2144
+ ] }) : k === "loading" && y.length === 0 ? /* @__PURE__ */ i("div", { className: "agent-view__state", "aria-live": "polite", children: [
2078
2145
  /* @__PURE__ */ n(
2079
2146
  E,
2080
2147
  {
@@ -2086,60 +2153,64 @@ const Jt = (e, t) => (s) => {
2086
2153
  }
2087
2154
  ),
2088
2155
  /* @__PURE__ */ n("p", { className: "agent-view__state-message", children: Pe })
2089
- ] }) : N.length === 0 ? /* @__PURE__ */ n(kt, {}) : /* @__PURE__ */ i("div", { className: "agent-view__board", children: [
2090
- it.map((l) => /* @__PURE__ */ n(
2156
+ ] }) : y.length === 0 ? /* @__PURE__ */ n(yt, {}) : /* @__PURE__ */ i("div", { className: "agent-view__board", children: [
2157
+ ct.map((o) => /* @__PURE__ */ n(
2091
2158
  Fe,
2092
2159
  {
2093
- column: we[l],
2094
- agents: de[l] ?? [],
2095
- ...Ee
2160
+ column: ve[o],
2161
+ agents: q[o] ?? [],
2162
+ ...me
2096
2163
  },
2097
- l
2164
+ o
2098
2165
  )),
2099
- /* @__PURE__ */ n("div", { className: "agent-view__split-column", children: ct.map((l) => /* @__PURE__ */ n(
2166
+ /* @__PURE__ */ n("div", { className: "agent-view__split-column", children: lt.map((o) => /* @__PURE__ */ n(
2100
2167
  Fe,
2101
2168
  {
2102
- column: we[l],
2103
- agents: de[l] ?? [],
2169
+ column: ve[o],
2170
+ agents: q[o] ?? [],
2104
2171
  isSplit: !0,
2105
- ...Ee
2172
+ ...me
2106
2173
  },
2107
- l
2174
+ o
2108
2175
  )) })
2109
2176
  ] }),
2110
- m && Te && /* @__PURE__ */ n(
2111
- Lt,
2177
+ _ && /* @__PURE__ */ n(
2178
+ rn,
2112
2179
  {
2113
- agent: m,
2180
+ agent: _,
2114
2181
  open: !0,
2115
- initialChecklist: L[m.invocation_id] ?? null,
2116
- fetchAgentChecklist: z,
2117
- fetchAgentResources: ce,
2118
- onClose: Ye,
2119
- connector: Te
2182
+ jwt: e,
2183
+ headers: R,
2184
+ agentUrl: r,
2185
+ agentChecklistUrl: c,
2186
+ agentResourcesUrl: l,
2187
+ agentChatUrl: d,
2188
+ enableUpload: w,
2189
+ initialChecklist: P[_.invocation_id] ?? null,
2190
+ onClose: Ce
2120
2191
  },
2121
- m.id
2192
+ _.id
2122
2193
  ),
2123
2194
  /* @__PURE__ */ n(
2124
- Ut,
2195
+ on,
2125
2196
  {
2126
- open: y,
2127
- onClose: () => C(!1),
2128
- onStart: Ve,
2129
- agentDefinitions: D
2197
+ open: te,
2198
+ onClose: () => Y(!1),
2199
+ onStart: be,
2200
+ agentDefinitions: A
2130
2201
  }
2131
2202
  )
2132
2203
  ] });
2133
2204
  }, kn = (e, t) => {
2134
- const s = Date.now(), a = t.trim() || e.agent_intent;
2205
+ const a = Date.now(), s = t.trim() || e.agent_intent;
2135
2206
  return {
2136
- id: `agent-${s}`,
2137
- invocation_id: `inv-${s}`,
2207
+ id: `agent-${a}`,
2208
+ invocation_id: `inv-${a}`,
2138
2209
  agent_definition_ref: e.ref,
2139
2210
  agent_intent: e.agent_intent,
2140
- invocation_name: a,
2141
- application_id: lt,
2142
- created_by: dt,
2211
+ invocation_name: s,
2212
+ application_id: dt,
2213
+ created_by: gt,
2143
2214
  status: v["generating-a-response"],
2144
2215
  context_ref: null,
2145
2216
  checklist_ref: null
@@ -2147,23 +2218,24 @@ const Jt = (e, t) => (s) => {
2147
2218
  };
2148
2219
  export {
2149
2220
  wn as AgentMonitorKanban,
2150
- Bt as AgentServiceClient,
2221
+ je as AgentServiceClient,
2151
2222
  ue as AgentServiceError,
2152
- Lt as AgentView,
2153
- Wt as HttpChatConnector,
2154
- Ut as NewAgentModal,
2223
+ rn as AgentView,
2224
+ zt as HttpChatConnector,
2225
+ on as NewAgentModal,
2155
2226
  kn as buildAgentFromDefinition,
2156
- Jt as createHttpChatConnectorFactory,
2157
- He as mapApiAgent,
2158
- Yt as mapApiAgentDefinition,
2159
- jt as mapApiAgentStatus,
2160
- nn as mapApiChecklistEndpointResponse,
2161
- Je as mapApiChecklistItem,
2227
+ Ve as createHttpChatConnectorFactory,
2228
+ De as mapApiAgent,
2229
+ Wt as mapApiAgentDefinition,
2230
+ Kt as mapApiAgentStatus,
2231
+ Xe as mapApiChecklistEndpointResponse,
2232
+ Qe as mapApiChecklistItem,
2162
2233
  vn as mapApiChecklistResponse,
2163
- Vt as mapApiChecklistStatus,
2164
- ke as mapApiOpeningMessage,
2165
- Zt as mapApiResource,
2166
- en as mapApiResourcesEndpointResponse,
2234
+ qt as mapApiChecklistStatus,
2235
+ we as mapApiOpeningMessage,
2236
+ Vt as mapApiResource,
2237
+ Ye as mapApiResourcesEndpointResponse,
2167
2238
  fn as mapApiTripOption,
2168
- on as useAgentService
2239
+ en as useAgentService,
2240
+ nn as useAgentWorkspace
2169
2241
  };