@useago/sdk 1.5.3 → 1.5.4

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +10 -0
  3. package/dist/AgoClient-BW0YZsis.js +1681 -0
  4. package/dist/AgoClient-Ba3ICq4K.cjs +8 -0
  5. package/dist/angular.cjs +1 -1
  6. package/dist/angular.d.cts +41 -0
  7. package/dist/angular.d.ts +41 -0
  8. package/dist/angular.js +2 -2
  9. package/dist/{createConversationSession-C7cnnWKW.js → createConversationSession-BjsgjL-v.js} +1 -1
  10. package/dist/{createConversationSession-BCb0D6bt.cjs → createConversationSession-okoz3teC.cjs} +1 -1
  11. package/dist/{createFormCollector-t_fGyuTD.cjs → createFormCollector-BWIh1pMl.cjs} +1 -1
  12. package/dist/{createFormCollector-iCDwAwYJ.js → createFormCollector-Bay2UpRv.js} +1 -1
  13. package/dist/devtools.d.cts +41 -0
  14. package/dist/devtools.d.ts +41 -0
  15. package/dist/functions-CPs7omgM.cjs +1 -0
  16. package/dist/helpers.cjs +1 -1
  17. package/dist/helpers.js +1 -1
  18. package/dist/index.cjs +1 -1
  19. package/dist/index.d.cts +54 -0
  20. package/dist/index.d.ts +54 -0
  21. package/dist/index.js +64 -62
  22. package/dist/react.cjs +3 -3
  23. package/dist/react.d.cts +55 -0
  24. package/dist/react.d.ts +55 -0
  25. package/dist/react.js +142 -122
  26. package/dist/testing.cjs +1 -1
  27. package/dist/testing.d.cts +41 -0
  28. package/dist/testing.d.ts +41 -0
  29. package/dist/testing.js +1 -1
  30. package/dist/vue.cjs +1 -1
  31. package/dist/vue.d.cts +41 -0
  32. package/dist/vue.d.ts +41 -0
  33. package/dist/vue.js +1 -1
  34. package/dist/widget.cjs +1 -1
  35. package/dist/widget.d.cts +41 -0
  36. package/dist/widget.d.ts +41 -0
  37. package/dist/widget.js +3 -3
  38. package/llms-full.txt +29 -0
  39. package/package.json +1 -1
  40. package/dist/AgoClient-BGkFSNZF.cjs +0 -8
  41. package/dist/AgoClient-CW-BLT1_.js +0 -1542
  42. package/dist/functions-IGSjjvF4.cjs +0 -1
  43. package/dist/rolldown-runtime-16Nf8qvH.cjs +0 -1
  44. /package/dist/{autoContinue-D3Mmaaca.js → autoContinue-CC8K9mBU.js} +0 -0
  45. /package/dist/{autoContinue-CcCTva-D.cjs → autoContinue-CP9pJR-V.cjs} +0 -0
  46. /package/dist/{createMockClient-Br0TWgLO.js → createMockClient-DcuNlufr.js} +0 -0
  47. /package/dist/{createMockClient-BwNLPjeT.cjs → createMockClient-Dw-cyISN.cjs} +0 -0
  48. /package/dist/{functions-CApuQZ2b.js → functions-tzyOZNp6.js} +0 -0
package/dist/react.js CHANGED
@@ -1,20 +1,20 @@
1
- import { a as Y, b as q, h as X, i as Z, o as Q, s as ee, t as te } from "./AgoClient-CW-BLT1_.js";
2
- import { t as ne } from "./autoContinue-D3Mmaaca.js";
3
- import { n as He, r as j, t as B } from "./createFormCollector-iCDwAwYJ.js";
4
- import { t as qe } from "./createMockClient-Br0TWgLO.js";
5
- import re, { createContext as oe, useCallback as R, useContext as G, useEffect as A, useId as ae, useMemo as W, useRef as _, useState as E, useSyncExternalStore as se } from "react";
6
- import { Fragment as U, jsx as l, jsxs as M } from "react/jsx-runtime";
1
+ import { a as Y, b as L, h as X, i as Z, o as Q, s as ee, t as te } from "./AgoClient-BW0YZsis.js";
2
+ import { t as ne } from "./autoContinue-CC8K9mBU.js";
3
+ import { n as He, r as j, t as B } from "./createFormCollector-Bay2UpRv.js";
4
+ import { t as Oe } from "./createMockClient-DcuNlufr.js";
5
+ import re, { createContext as oe, useCallback as R, useContext as G, useEffect as I, useId as ae, useMemo as D, useRef as M, useState as E, useSyncExternalStore as se } from "react";
6
+ import { Fragment as U, jsx as l, jsxs as _ } from "react/jsx-runtime";
7
7
  import ie from "react-markdown";
8
8
  import le from "remark-gfm";
9
9
  function ce(e) {
10
- const [r, t] = E(!1), o = _(null), n = W(() => {
10
+ const [r, t] = E(!1), o = M(null), n = D(() => {
11
11
  if (o.current && (o.current.destroy(), o.current = null), !e) return null;
12
12
  const s = new te(e);
13
13
  return o.current = s, s;
14
14
  }, [e?.baseUrl, e?.widgetId]);
15
- return A(() => (n && o.current === null && (o.current = n, n.reviveAfterDestroy()), t(!0), () => {
15
+ return I(() => (n && o.current === null && (o.current = n, n.reviveAfterDestroy()), t(!0), () => {
16
16
  o.current?.destroy(), o.current = null;
17
- }), [n]), A(() => {
17
+ }), [n]), I(() => {
18
18
  o.current && e && o.current.updateConfig({
19
19
  agent: e.agent,
20
20
  defaultAgentId: e.defaultAgentId,
@@ -37,19 +37,19 @@ function ce(e) {
37
37
  isReady: r
38
38
  };
39
39
  }
40
- var L = oe(null), Ke = ({ children: e, client: r, tools: t, helpers: o, pageContext: n, ...s }) => {
40
+ var $ = oe(null), Ke = ({ children: e, client: r, tools: t, helpers: o, pageContext: n, ...s }) => {
41
41
  const { client: c } = ce(r ? null : s), a = r || c;
42
- return A(() => {
42
+ return I(() => {
43
43
  if (!(!t || t.length === 0)) {
44
44
  for (const f of t) a.register(f);
45
45
  return () => {
46
46
  for (const f of t) a.unregisterFunction(f.name);
47
47
  };
48
48
  }
49
- }, [a, t]), A(() => {
49
+ }, [a, t]), I(() => {
50
50
  if (!o) return;
51
51
  const f = [];
52
- return import("./functions-CApuQZ2b.js").then((d) => d.n).then((d) => {
52
+ return import("./functions-tzyOZNp6.js").then((d) => d.n).then((d) => {
53
53
  for (const [g, C] of Object.entries(o)) {
54
54
  const N = d[g];
55
55
  if (!N) {
@@ -65,26 +65,26 @@ var L = oe(null), Ke = ({ children: e, client: r, tools: t, helpers: o, pageCont
65
65
  }), () => {
66
66
  for (const d of f) a.unregisterFunction(d);
67
67
  };
68
- }, [a, o]), A(() => {
68
+ }, [a, o]), I(() => {
69
69
  n === "auto" && a.enableAutoPageContext();
70
- }, [a, n]), /* @__PURE__ */ l(L.Provider, {
70
+ }, [a, n]), /* @__PURE__ */ l($.Provider, {
71
71
  value: a,
72
72
  children: e
73
73
  });
74
74
  };
75
- function D() {
76
- const e = G(L);
75
+ function z() {
76
+ const e = G($);
77
77
  if (!e) throw new Error('useAgoClient must be used within an <AgoProvider>. Wrap your component tree with <AgoProvider baseUrl="...">.');
78
78
  return e;
79
79
  }
80
- function z() {
81
- return G(L);
80
+ function P() {
81
+ return G($);
82
82
  }
83
83
  function K({ client: e, conversationId: r } = {}) {
84
- const t = z(), o = e || t;
84
+ const t = P(), o = e || t;
85
85
  if (!o) throw new Error("useMessages requires an AgoClient. Either pass it as options.client or wrap your app in <AgoProvider>.");
86
86
  const [n, s] = E([]), [c, a] = E(r), [f, d] = E(!1), [g, C] = E(null);
87
- A(() => {
87
+ I(() => {
88
88
  r && r !== c && (a(r), N(r));
89
89
  }, [r]);
90
90
  const N = async (S) => {
@@ -94,7 +94,7 @@ function K({ client: e, conversationId: r } = {}) {
94
94
  C(k instanceof Error ? k : /* @__PURE__ */ new Error("Failed to load messages"));
95
95
  }
96
96
  };
97
- return A(() => {
97
+ return I(() => {
98
98
  const S = (u) => u === "IN_PROGRESS" || u === "WAITING_CLIENT", k = (u) => {
99
99
  c || a(u.conversationId), d(!0), s((h) => {
100
100
  const w = h.findIndex((b) => b.id === u.messageId);
@@ -204,7 +204,7 @@ function K({ client: e, conversationId: r } = {}) {
204
204
  };
205
205
  }
206
206
  var de = ({ onSend: e, disabled: r = !1, placeholder: t = "Type a message...", allowFiles: o = !1, className: n = "" }) => {
207
- const [s, c] = E(""), [a, f] = E([]), d = _(null), g = _(null), C = R(() => {
207
+ const [s, c] = E(""), [a, f] = E([]), d = M(null), g = M(null), C = R(() => {
208
208
  const i = g.current;
209
209
  if (!i) return;
210
210
  const v = 110;
@@ -224,7 +224,7 @@ var de = ({ onSend: e, disabled: r = !1, placeholder: t = "Type a message...", a
224
224
  }, []), p = R((i) => {
225
225
  f((v) => v.filter((u, h) => h !== i));
226
226
  }, []), x = s.trim() || a.length > 0;
227
- return /* @__PURE__ */ M("form", {
227
+ return /* @__PURE__ */ _("form", {
228
228
  onSubmit: N,
229
229
  className: `ago-chat-input ${n}`,
230
230
  style: {
@@ -242,7 +242,7 @@ var de = ({ onSend: e, disabled: r = !1, placeholder: t = "Type a message...", a
242
242
  flexWrap: "wrap",
243
243
  gap: "6px"
244
244
  },
245
- children: a.map((i, v) => /* @__PURE__ */ M("div", {
245
+ children: a.map((i, v) => /* @__PURE__ */ _("div", {
246
246
  style: {
247
247
  display: "flex",
248
248
  alignItems: "center",
@@ -277,14 +277,14 @@ var de = ({ onSend: e, disabled: r = !1, placeholder: t = "Type a message...", a
277
277
  children: "×"
278
278
  })]
279
279
  }, v))
280
- }), /* @__PURE__ */ M("div", {
280
+ }), /* @__PURE__ */ _("div", {
281
281
  style: {
282
282
  display: "flex",
283
283
  gap: "8px",
284
284
  alignItems: "flex-end"
285
285
  },
286
286
  children: [
287
- o && /* @__PURE__ */ M(U, { children: [/* @__PURE__ */ l("button", {
287
+ o && /* @__PURE__ */ _(U, { children: [/* @__PURE__ */ l("button", {
288
288
  type: "button",
289
289
  onClick: () => d.current?.click(),
290
290
  disabled: r,
@@ -378,7 +378,7 @@ var de = ({ onSend: e, disabled: r = !1, placeholder: t = "Type a message...", a
378
378
  },
379
379
  ...r,
380
380
  children: e
381
- }), P = (e, r) => {
381
+ }), W = (e, r) => {
382
382
  const t = ({ children: o, ...n }) => re.createElement(`h${e}`, {
383
383
  style: {
384
384
  margin: "16px 0 8px 0",
@@ -501,12 +501,12 @@ var de = ({ onSend: e, disabled: r = !1, placeholder: t = "Type a message...", a
501
501
  }), ke = {
502
502
  a: ue,
503
503
  p: fe,
504
- h1: P(1, "20px"),
505
- h2: P(2, "18px"),
506
- h3: P(3, "16px"),
507
- h4: P(4, "15px"),
508
- h5: P(5, "14px"),
509
- h6: P(6, "13px"),
504
+ h1: W(1, "20px"),
505
+ h2: W(2, "18px"),
506
+ h3: W(3, "16px"),
507
+ h4: W(4, "15px"),
508
+ h5: W(5, "14px"),
509
+ h6: W(6, "13px"),
510
510
  ul: pe,
511
511
  ol: ge,
512
512
  li: me,
@@ -518,8 +518,8 @@ var de = ({ onSend: e, disabled: r = !1, placeholder: t = "Type a message...", a
518
518
  td: we,
519
519
  img: Ce,
520
520
  hr: Se
521
- }, Ie = [le], Ae = ({ content: e }) => /* @__PURE__ */ l(ie, {
522
- remarkPlugins: Ie,
521
+ }, Ae = [le], Ie = ({ content: e }) => /* @__PURE__ */ l(ie, {
522
+ remarkPlugins: Ae,
523
523
  components: ke,
524
524
  children: e
525
525
  }), Ne = ({ attachment: e, isUser: r }) => {
@@ -546,7 +546,7 @@ var de = ({ onSend: e, disabled: r = !1, placeholder: t = "Type a message...", a
546
546
  }
547
547
  })
548
548
  });
549
- const o = Q(e.fileSize), n = /* @__PURE__ */ M(U, { children: [/* @__PURE__ */ l("span", {
549
+ const o = Q(e.fileSize), n = /* @__PURE__ */ _(U, { children: [/* @__PURE__ */ l("span", {
550
550
  style: {
551
551
  fontSize: "16px",
552
552
  lineHeight: 1,
@@ -554,7 +554,7 @@ var de = ({ onSend: e, disabled: r = !1, placeholder: t = "Type a message...", a
554
554
  },
555
555
  "aria-hidden": !0,
556
556
  children: "📄"
557
- }), /* @__PURE__ */ M("span", {
557
+ }), /* @__PURE__ */ _("span", {
558
558
  style: {
559
559
  display: "flex",
560
560
  flexDirection: "column",
@@ -600,7 +600,7 @@ var de = ({ onSend: e, disabled: r = !1, placeholder: t = "Type a message...", a
600
600
  children: n
601
601
  });
602
602
  }, Re = ({ source: e, index: r }) => {
603
- const t = /* @__PURE__ */ M("div", {
603
+ const t = /* @__PURE__ */ _("div", {
604
604
  style: {
605
605
  display: "flex",
606
606
  alignItems: "center",
@@ -664,7 +664,7 @@ var de = ({ onSend: e, disabled: r = !1, placeholder: t = "Type a message...", a
664
664
  style: o,
665
665
  children: t
666
666
  });
667
- }, Ee = () => /* @__PURE__ */ M("div", {
667
+ }, Ee = () => /* @__PURE__ */ _("div", {
668
668
  style: {
669
669
  display: "flex",
670
670
  gap: "4px",
@@ -687,9 +687,9 @@ var de = ({ onSend: e, disabled: r = !1, placeholder: t = "Type a message...", a
687
687
  40% { opacity: 1; transform: scale(1); }
688
688
  }
689
689
  ` })]
690
- }), Me = ({ message: e, className: r = "", showAgentName: t = !1, isLast: o = !1, onFollowUpClick: n }) => {
690
+ }), _e = ({ message: e, className: r = "", showAgentName: t = !1, isLast: o = !1, onFollowUpClick: n }) => {
691
691
  const s = e.role === "user", c = e.status === "IN_PROGRESS" || e.status === "WAITING_CLIENT";
692
- return /* @__PURE__ */ M("div", {
692
+ return /* @__PURE__ */ _("div", {
693
693
  className: `ago-message ago-message--${e.role} ${r}`,
694
694
  style: {
695
695
  display: "flex",
@@ -754,7 +754,7 @@ var de = ({ onSend: e, disabled: r = !1, placeholder: t = "Type a message...", a
754
754
  fontSize: "16px",
755
755
  lineHeight: "1.6"
756
756
  },
757
- children: e.content ? /* @__PURE__ */ l(Ae, { content: e.content }) : c && /* @__PURE__ */ l(Ee, {})
757
+ children: e.content ? /* @__PURE__ */ l(Ie, { content: e.content }) : c && /* @__PURE__ */ l(Ee, {})
758
758
  }),
759
759
  o && e.followUpReplies && e.followUpReplies.length > 0 && /* @__PURE__ */ l("div", {
760
760
  className: "ago-message__followups",
@@ -792,39 +792,39 @@ var de = ({ onSend: e, disabled: r = !1, placeholder: t = "Type a message...", a
792
792
  ]
793
793
  });
794
794
  }, Je = ({ client: e, conversationId: r, title: t = "Chat", welcomeMessage: o = "Hello! How can I help you today?", placeholder: n = "Type a message...", allowFiles: s = !1, height: c = 500, logoUrl: a, showAgentName: f = !1, forms: d, onFollowUpClick: g, className: C = "", onMessageSent: N, onMessageReceived: S }) => {
795
- const k = _(null), p = z(), x = e ?? p, { messages: i, isLoading: v, error: u, sendMessage: h } = K({
795
+ const k = M(null), p = P(), x = e ?? p, { messages: i, isLoading: v, error: u, sendMessage: h } = K({
796
796
  client: e,
797
797
  conversationId: r
798
798
  });
799
- A(() => {
799
+ I(() => {
800
800
  if (!x || !d || d.length === 0) return;
801
801
  let m = !1;
802
- const I = [];
802
+ const A = [];
803
803
  return Promise.all(d.map((F) => F.schema != null ? Promise.resolve(B(F)) : j(x, F))).then((F) => {
804
804
  if (!m)
805
- for (const V of F) I.push(V.install(x));
805
+ for (const V of F) A.push(V.install(x));
806
806
  }).catch(() => {
807
807
  }), () => {
808
- m = !0, I.forEach((F) => F());
808
+ m = !0, A.forEach((F) => F());
809
809
  };
810
810
  }, [x, d ? JSON.stringify(d.map((m) => [
811
811
  m.name,
812
812
  m.schema ?? null,
813
813
  m.submit ?? !1,
814
814
  m.description ?? null
815
- ])) : ""]), A(() => {
815
+ ])) : ""]), I(() => {
816
816
  k.current?.scrollIntoView({ behavior: "smooth" });
817
- }, [i]), A(() => {
817
+ }, [i]), I(() => {
818
818
  const m = i[i.length - 1];
819
819
  m && m.role === "assistant" && m.status === "DONE" && S && S({
820
820
  id: m.id,
821
821
  content: m.content
822
822
  });
823
823
  }, [i, S]);
824
- const w = async (m, I) => {
825
- N?.(m), await h(m, I);
824
+ const w = async (m, A) => {
825
+ N?.(m), await h(m, A);
826
826
  }, b = i[i.length - 1], T = v && b?.role === "assistant" && (b.status === "IN_PROGRESS" || b.status === "WAITING_CLIENT"), y = g === !1 ? void 0 : g ?? ((m) => w(m));
827
- return /* @__PURE__ */ M("div", {
827
+ return /* @__PURE__ */ _("div", {
828
828
  className: `ago-chat-widget ${C}`,
829
829
  style: {
830
830
  display: "flex",
@@ -839,7 +839,7 @@ var de = ({ onSend: e, disabled: r = !1, placeholder: t = "Type a message...", a
839
839
  boxShadow: "rgba(15, 15, 15, 0.08) 0px 2px 16px 0px"
840
840
  },
841
841
  children: [
842
- /* @__PURE__ */ M("div", {
842
+ /* @__PURE__ */ _("div", {
843
843
  className: "ago-chat-widget__header",
844
844
  style: {
845
845
  padding: "14px 16px",
@@ -866,7 +866,7 @@ var de = ({ onSend: e, disabled: r = !1, placeholder: t = "Type a message...", a
866
866
  children: t
867
867
  })]
868
868
  }),
869
- /* @__PURE__ */ M("div", {
869
+ /* @__PURE__ */ _("div", {
870
870
  className: "ago-chat-widget__messages",
871
871
  role: "log",
872
872
  "aria-live": "polite",
@@ -888,10 +888,10 @@ var de = ({ onSend: e, disabled: r = !1, placeholder: t = "Type a message...", a
888
888
  lineHeight: "1.5"
889
889
  },
890
890
  children: o
891
- }) : i.map((m, I) => /* @__PURE__ */ l(Me, {
891
+ }) : i.map((m, A) => /* @__PURE__ */ l(_e, {
892
892
  message: m,
893
893
  showAgentName: f,
894
- isLast: I === i.length - 1,
894
+ isLast: A === i.length - 1,
895
895
  onFollowUpClick: y
896
896
  }, m.id)),
897
897
  u && /* @__PURE__ */ l("div", {
@@ -919,13 +919,13 @@ var de = ({ onSend: e, disabled: r = !1, placeholder: t = "Type a message...", a
919
919
  ]
920
920
  });
921
921
  };
922
- function _e(e = {}) {
923
- const r = z(), t = e.client ?? r;
924
- if (!t) throw new q("useProactiveNudge: no AgoClient. Pass one via options.client or wrap your tree with <AgoProvider>.", "proactive_missing_client");
925
- const [o, n] = E(null), s = _(o);
922
+ function Me(e = {}) {
923
+ const r = P(), t = e.client ?? r;
924
+ if (!t) throw new L("useProactiveNudge: no AgoClient. Pass one via options.client or wrap your tree with <AgoProvider>.", "proactive_missing_client");
925
+ const [o, n] = E(null), s = M(o);
926
926
  s.current = o;
927
- const c = _(e.onExpand);
928
- return c.current = e.onExpand, A(() => {
927
+ const c = M(e.onExpand);
928
+ return c.current = e.onExpand, I(() => {
929
929
  const a = (d) => {
930
930
  n(d), t.proactive?.shown(d);
931
931
  }, f = ({ nudge: d }) => {
@@ -947,11 +947,11 @@ function _e(e = {}) {
947
947
  };
948
948
  }
949
949
  var Ve = ({ client: e, onExpand: r, autoHideMs: t, position: o = "bottom-right", openChatLabel: n = "Open chat", className: s = "" }) => {
950
- const { nudge: c, accept: a, dismiss: f } = _e({
950
+ const { nudge: c, accept: a, dismiss: f } = Me({
951
951
  client: e,
952
952
  onExpand: r
953
953
  });
954
- if (A(() => {
954
+ if (I(() => {
955
955
  if (!c || !t) return;
956
956
  const g = setTimeout(() => f(), t);
957
957
  return () => clearTimeout(g);
@@ -961,7 +961,7 @@ var Ve = ({ client: e, onExpand: r, autoHideMs: t, position: o = "bottom-right",
961
961
  f
962
962
  ]), !c) return null;
963
963
  const d = c.source === "agent" || !!c.goal;
964
- return /* @__PURE__ */ M("div", {
964
+ return /* @__PURE__ */ _("div", {
965
965
  className: `ago-nudge ${s}`,
966
966
  role: "status",
967
967
  "aria-live": "polite",
@@ -1007,7 +1007,7 @@ var Ve = ({ client: e, onExpand: r, autoHideMs: t, position: o = "bottom-right",
1007
1007
  style: { paddingRight: "16px" },
1008
1008
  children: c.message
1009
1009
  }),
1010
- (c.action || d) && /* @__PURE__ */ M("div", {
1010
+ (c.action || d) && /* @__PURE__ */ _("div", {
1011
1011
  className: "ago-nudge__actions",
1012
1012
  style: {
1013
1013
  display: "flex",
@@ -1055,7 +1055,7 @@ var Ve = ({ client: e, onExpand: r, autoHideMs: t, position: o = "bottom-right",
1055
1055
  });
1056
1056
  };
1057
1057
  function Fe({ client: e, autoLoad: r = !0 } = {}) {
1058
- const t = z(), o = e || t;
1058
+ const t = P(), o = e || t;
1059
1059
  if (!o) throw new Error("useConversation requires an AgoClient. Either pass it as options.client or wrap your app in <AgoProvider>.");
1060
1060
  const [n, s] = E([]), [c, a] = E(null), [f, d] = E(!1), [g, C] = E(null), N = R(async () => {
1061
1061
  d(!0), C(null);
@@ -1078,7 +1078,7 @@ function Fe({ client: e, autoLoad: r = !0 } = {}) {
1078
1078
  }, [o]), k = R(() => {
1079
1079
  a(null);
1080
1080
  }, []);
1081
- return A(() => {
1081
+ return I(() => {
1082
1082
  r && N();
1083
1083
  }, [r, N]), {
1084
1084
  conversations: n,
@@ -1091,7 +1091,7 @@ function Fe({ client: e, autoLoad: r = !0 } = {}) {
1091
1091
  };
1092
1092
  }
1093
1093
  function Ye(e = {}) {
1094
- const r = z(), t = e.client || r;
1094
+ const r = P(), t = e.client || r;
1095
1095
  if (!t) throw new Error("useChat requires an AgoClient. Either pass it as options.client or wrap your app in <AgoProvider>.");
1096
1096
  const o = K({
1097
1097
  client: t,
@@ -1116,11 +1116,11 @@ function Ye(e = {}) {
1116
1116
  };
1117
1117
  }
1118
1118
  function Xe(e, r) {
1119
- const t = D(), { name: o, description: n, parameters: s, handler: c, maxResultBytes: a, requiresApproval: f } = typeof e == "string" ? {
1119
+ const t = z(), { name: o, description: n, parameters: s, handler: c, maxResultBytes: a, requiresApproval: f } = typeof e == "string" ? {
1120
1120
  name: e,
1121
1121
  ...r
1122
- } : e, d = _(c);
1123
- d.current = c, A(() => {
1122
+ } : e, d = M(c);
1123
+ d.current = c, I(() => {
1124
1124
  const g = (C) => d.current(C);
1125
1125
  return t.registerFunction(o, g, {
1126
1126
  description: n,
@@ -1140,14 +1140,14 @@ function Xe(e, r) {
1140
1140
  ]);
1141
1141
  }
1142
1142
  function Ze(e, r) {
1143
- const t = D(), o = _(e);
1144
- o.current = e, A(() => (t.registerNavigationFunction((n) => o.current(n), r), () => {
1143
+ const t = z(), o = M(e);
1144
+ o.current = e, I(() => (t.registerNavigationFunction((n) => o.current(n), r), () => {
1145
1145
  t.unregisterNavigationFunction();
1146
1146
  }), [t, r]);
1147
1147
  }
1148
1148
  function Qe(e, r) {
1149
- const t = D(), o = r?.functionName ?? "setPageState", n = r?.requiresApproval, s = _(e);
1150
- s.current = e, A(() => {
1149
+ const t = z(), o = r?.functionName ?? "setPageState", n = r?.requiresApproval, s = M(e);
1150
+ s.current = e, I(() => {
1151
1151
  const c = s.current.map((a) => {
1152
1152
  const f = () => s.current.find((d) => d.name === a.name) ?? a;
1153
1153
  return {
@@ -1171,8 +1171,8 @@ function Qe(e, r) {
1171
1171
  ]);
1172
1172
  }
1173
1173
  function et(e) {
1174
- const r = D(), t = _(e);
1175
- t.current = e, A(() => ne(r, () => t.current), [r]);
1174
+ const r = z(), t = M(e);
1175
+ t.current = e, I(() => ne(r, () => t.current), [r]);
1176
1176
  }
1177
1177
  var Te = /* @__PURE__ */ new Set(["awaiting-approval"]);
1178
1178
  function J(e) {
@@ -1192,19 +1192,19 @@ function J(e) {
1192
1192
  function Pe(e) {
1193
1193
  return e.type === "client_function" ? e.functionName === "navigateToPage" ? "navigation" : "action" : J(e.type);
1194
1194
  }
1195
- function $(e, r) {
1195
+ function H(e, r) {
1196
1196
  const t = (e ?? "").toLowerCase();
1197
1197
  return t.includes("reject") ? "rejected" : t.includes("error") || t.includes("fail") ? "error" : t.includes("done") || t.includes("complet") ? "done" : (t.includes("waiting") || t.includes("pending")) && (r === "confirmation" || r === "form") ? "awaiting-approval" : "running";
1198
1198
  }
1199
- function H(e) {
1199
+ function q(e) {
1200
1200
  return typeof e != "string" || !e ? "page" : e.replace(/[-_]+/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/\b\w/g, (r) => r.toUpperCase()).trim();
1201
1201
  }
1202
1202
  function We(e) {
1203
1203
  switch (e.kind) {
1204
1204
  case "navigation":
1205
- return `Navigating to ${H(e.arguments?.page)}`;
1205
+ return `Navigating to ${q(e.arguments?.page)}`;
1206
1206
  case "action":
1207
- return e.functionName === "setPageState" ? "Updating the page" : e.functionName === "openFilteredConversations" ? "Opening conversations" : e.toolDisplayName || e.message || H(e.functionName) || "Working";
1207
+ return e.functionName === "setPageState" ? "Updating the page" : e.functionName === "openFilteredConversations" ? "Opening conversations" : e.toolDisplayName || e.message || q(e.functionName) || "Working";
1208
1208
  case "progress":
1209
1209
  return e.message || "Working";
1210
1210
  case "reasoning":
@@ -1218,9 +1218,9 @@ function We(e) {
1218
1218
  }
1219
1219
  }
1220
1220
  function tt(e = {}) {
1221
- const { includeReasoning: r = !1, labelFor: t } = e, o = z(), n = e.client || o;
1222
- if (!n) throw new q("useAgoActivity requires an AgoClient. Either pass it as options.client or wrap your app in <AgoProvider>.", "provider_missing_client");
1223
- const [s, c] = E([]), a = _(/* @__PURE__ */ new Set()), f = _(void 0), d = _(t);
1221
+ const { includeReasoning: r = !1, labelFor: t } = e, o = P(), n = e.client || o;
1222
+ if (!n) throw new L("useAgoActivity requires an AgoClient. Either pass it as options.client or wrap your app in <AgoProvider>.", "provider_missing_client");
1223
+ const [s, c] = E([]), a = M(/* @__PURE__ */ new Set()), f = M(void 0), d = M(t);
1224
1224
  d.current = t;
1225
1225
  const g = R((p, x) => {
1226
1226
  c((i) => {
@@ -1242,14 +1242,14 @@ function tt(e = {}) {
1242
1242
  ] : [...i, u];
1243
1243
  });
1244
1244
  }, []);
1245
- A(() => {
1245
+ I(() => {
1246
1246
  const p = (y) => {
1247
1247
  f.current = y.messageId;
1248
1248
  }, x = (y) => {
1249
1249
  const m = J(y.type);
1250
1250
  m === "reasoning" && !r || g(y.id, {
1251
1251
  kind: m,
1252
- status: $(y.status, m),
1252
+ status: H(y.status, m),
1253
1253
  messageId: f.current,
1254
1254
  toolName: y.toolName,
1255
1255
  toolDisplayName: y.toolDisplayName,
@@ -1277,35 +1277,35 @@ function tt(e = {}) {
1277
1277
  });
1278
1278
  }, u = (y) => {
1279
1279
  if (!y.invocationId) return;
1280
- const m = y.result, I = typeof y.result == "object" && m !== null && m.approved === !1 && m.reason === "user_rejected";
1280
+ const m = y.result, A = typeof y.result == "object" && m !== null && m.approved === !1 && m.reason === "user_rejected";
1281
1281
  g(y.invocationId, {
1282
- status: y.error ? "error" : I ? "rejected" : "done",
1282
+ status: y.error ? "error" : A ? "rejected" : "done",
1283
1283
  requiresApproval: !1
1284
1284
  });
1285
1285
  }, h = (y) => {
1286
1286
  for (const m of y.messages ?? [])
1287
1287
  if (m.role === "assistant")
1288
- for (const I of m.toolCalls ?? []) {
1289
- const F = Pe(I);
1290
- F === "reasoning" && !r || /waiting/i.test(I.status ?? "") || g(I.id, {
1288
+ for (const A of m.toolCalls ?? []) {
1289
+ const F = Pe(A);
1290
+ F === "reasoning" && !r || /waiting/i.test(A.status ?? "") || g(A.id, {
1291
1291
  kind: F,
1292
- status: $(I.status, F),
1292
+ status: H(A.status, F),
1293
1293
  messageId: m.id,
1294
- toolName: I.toolName,
1295
- toolDisplayName: I.toolDisplayName,
1296
- functionName: I.functionName,
1297
- arguments: I.arguments,
1298
- message: I.message,
1299
- data: I.data,
1300
- formSchema: I.formSchema,
1294
+ toolName: A.toolName,
1295
+ toolDisplayName: A.toolDisplayName,
1296
+ functionName: A.functionName,
1297
+ arguments: A.arguments,
1298
+ message: A.message,
1299
+ data: A.data,
1300
+ formSchema: A.formSchema,
1301
1301
  requiresApproval: F === "confirmation" || F === "form"
1302
1302
  });
1303
1303
  }
1304
1304
  }, w = (y) => {
1305
- c((m) => m.map((I) => I.status === "running" || I.status === "awaiting-approval" ? {
1306
- ...I,
1305
+ c((m) => m.map((A) => A.status === "running" || A.status === "awaiting-approval" ? {
1306
+ ...A,
1307
1307
  status: y
1308
- } : I));
1308
+ } : A));
1309
1309
  }, b = () => w("done"), T = () => w("error");
1310
1310
  return n.on("message:start", p), n.on("toolCall:received", x), n.on("function:invoke", i), n.on("function:awaiting-approval", v), n.on("function:result", u), n.on("conversation:loaded", h), n.on("message:complete", b), n.on("message:error", T), () => {
1311
1311
  n.off("message:start", p), n.off("toolCall:received", x), n.off("function:invoke", i), n.off("function:awaiting-approval", v), n.off("function:result", u), n.off("conversation:loaded", h), n.off("message:complete", b), n.off("message:error", T);
@@ -1353,11 +1353,30 @@ function tt(e = {}) {
1353
1353
  clear: k
1354
1354
  };
1355
1355
  }
1356
- function nt(e, r) {
1357
- const t = D(), o = ae(), n = r ?? o, s = _(e);
1356
+ function nt(e = {}) {
1357
+ const r = P(), t = e.client || r;
1358
+ if (!t) throw new L("useAgoActivityLog requires an AgoClient. Either pass it as options.client or wrap your app in <AgoProvider>.", "provider_missing_client");
1359
+ const [o, n] = E(() => t.getRecentActivity());
1360
+ I(() => {
1361
+ n(t.getRecentActivity());
1362
+ const a = () => n(t.getRecentActivity());
1363
+ return t.on("activity:recorded", a), () => t.off("activity:recorded", a);
1364
+ }, [t]);
1365
+ const s = R((a) => t.recordActivity(a), [t]), c = R(() => {
1366
+ t.clearActivity(), n([]);
1367
+ }, [t]);
1368
+ return {
1369
+ entries: o,
1370
+ latest: o.length > 0 ? o[o.length - 1] : void 0,
1371
+ record: s,
1372
+ clear: c
1373
+ };
1374
+ }
1375
+ function rt(e, r) {
1376
+ const t = z(), o = ae(), n = r ?? o, s = M(e);
1358
1377
  s.current = e;
1359
1378
  const c = typeof e == "function";
1360
- A(() => {
1379
+ I(() => {
1361
1380
  if (typeof s.current == "function") {
1362
1381
  const a = () => s.current();
1363
1382
  return t.addDynamicContext(n, a), () => {
@@ -1381,8 +1400,8 @@ var O = {
1381
1400
  missing: [],
1382
1401
  complete: !1
1383
1402
  };
1384
- function rt(e) {
1385
- const r = D(), t = e.schema != null, o = JSON.stringify(e.schema ?? null), n = e.submit, s = n ? typeof n == "string" ? `client:${n}` : n.via === "backend" ? "backend" : "handler" in n ? "client:handler" : `client:${n.url}` : "none", c = JSON.stringify(e.initialValues ?? null), a = W(() => t ? B(e) : null, [
1403
+ function ot(e) {
1404
+ const r = z(), t = e.schema != null, o = JSON.stringify(e.schema ?? null), n = e.submit, s = n ? typeof n == "string" ? `client:${n}` : n.via === "backend" ? "backend" : "handler" in n ? "client:handler" : `client:${n.url}` : "none", c = JSON.stringify(e.initialValues ?? null), a = D(() => t ? B(e) : null, [
1386
1405
  t,
1387
1406
  e.name,
1388
1407
  o,
@@ -1394,7 +1413,7 @@ function rt(e) {
1394
1413
  loading: !t,
1395
1414
  error: null
1396
1415
  });
1397
- A(() => {
1416
+ I(() => {
1398
1417
  if (t) return;
1399
1418
  let v = !1;
1400
1419
  return d({
@@ -1425,17 +1444,17 @@ function rt(e) {
1425
1444
  e.autoSubmit
1426
1445
  ]);
1427
1446
  const g = t ? a : f.collector, C = t ? !1 : f.loading, N = t ? null : f.error;
1428
- A(() => {
1447
+ I(() => {
1429
1448
  if (g)
1430
1449
  return g.install(r);
1431
1450
  }, [r, g]);
1432
- const S = W(() => X({
1451
+ const S = D(() => X({
1433
1452
  values: e.initialValues ?? {},
1434
1453
  submitted: !1
1435
- }), [c]), k = De(g?.store ?? S), p = W(() => g?.getStatus() ?? O, [k, g]), x = W(() => ({
1454
+ }), [c]), k = De(g?.store ?? S), p = D(() => g?.getStatus() ?? O, [k, g]), x = D(() => ({
1436
1455
  ...k,
1437
1456
  ...p
1438
- }), [k, p]), i = W(() => ({
1457
+ }), [k, p]), i = D(() => ({
1439
1458
  name: e.name,
1440
1459
  store: S,
1441
1460
  functions: [],
@@ -1477,25 +1496,26 @@ export {
1477
1496
  Ke as AgoProvider,
1478
1497
  de as ChatInput,
1479
1498
  Je as ChatWidget,
1480
- Ae as Markdown,
1481
- Me as Message,
1499
+ Ie as Markdown,
1500
+ _e as Message,
1482
1501
  B as createFormCollector,
1483
- qe as createMockClient,
1502
+ Oe as createMockClient,
1484
1503
  He as deriveFormStatus,
1485
1504
  j as loadFormCollector,
1486
1505
  ce as useAgo,
1487
1506
  tt as useAgoActivity,
1507
+ nt as useAgoActivityLog,
1488
1508
  et as useAgoAutoContinueAfterNavigation,
1489
- D as useAgoClient,
1490
- nt as useAgoContext,
1509
+ z as useAgoClient,
1510
+ rt as useAgoContext,
1491
1511
  Xe as useAgoFunction,
1492
1512
  Ze as useAgoNavigation,
1493
1513
  Qe as useAgoPageState,
1494
1514
  De as useAgoStore,
1495
1515
  Ye as useChat,
1496
1516
  Fe as useConversation,
1497
- rt as useFormCollector,
1517
+ ot as useFormCollector,
1498
1518
  K as useMessages,
1499
- z as useOptionalAgoClient,
1500
- _e as useProactiveNudge
1519
+ P as useOptionalAgoClient,
1520
+ Me as useProactiveNudge
1501
1521
  };
package/dist/testing.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./createMockClient-BwNLPjeT.cjs");exports.createMockClient=e.createMockClient;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./createMockClient-Dw-cyISN.cjs");exports.createMockClient=e.createMockClient;