@arbor-education/agent-view-frontend 0.4.0 → 0.4.2

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