@useago/sdk 1.0.4 → 1.0.6

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 (41) hide show
  1. package/README.md +3 -3
  2. package/dist/{AgoClient-1jgDndKs.cjs → AgoClient--y10UXUV.cjs} +1 -1
  3. package/dist/{AgoClient-j1sk1hK5.js → AgoClient-DYdIe_R4.js} +9 -6
  4. package/dist/angular.cjs +1 -1
  5. package/dist/angular.d.cts +49 -2
  6. package/dist/angular.d.ts +49 -2
  7. package/dist/angular.js +1 -1
  8. package/dist/{createConversationSession-CZhoTCtD.js → createConversationSession-Boi0PjDU.js} +1 -1
  9. package/dist/{createConversationSession-BYNhYbkY.cjs → createConversationSession-lJWANT6T.cjs} +1 -1
  10. package/dist/{createFormCollector-BPKzKDeX.js → createFormCollector-BUqSA2Qw.js} +1 -1
  11. package/dist/{createFormCollector-B8V9YSGe.cjs → createFormCollector-CSG5ioym.cjs} +1 -1
  12. package/dist/devtools.cjs +41 -27
  13. package/dist/devtools.d.cts +48 -0
  14. package/dist/devtools.d.ts +48 -0
  15. package/dist/devtools.js +98 -70
  16. package/dist/{functions-C1-5vadY.js → functions-CApuQZ2b.js} +50 -43
  17. package/dist/{functions-DsmzgHjC.cjs → functions-Djnq-JAo.cjs} +1 -1
  18. package/dist/helpers.cjs +1 -1
  19. package/dist/helpers.js +1 -1
  20. package/dist/index.cjs +1 -1
  21. package/dist/index.d.cts +12 -0
  22. package/dist/index.d.ts +12 -0
  23. package/dist/index.js +35 -35
  24. package/dist/react.cjs +3 -31
  25. package/dist/react.d.cts +49 -2
  26. package/dist/react.d.ts +49 -2
  27. package/dist/react.js +599 -8156
  28. package/dist/rolldown-runtime-16Nf8qvH.cjs +1 -0
  29. package/dist/testing.d.cts +48 -0
  30. package/dist/testing.d.ts +48 -0
  31. package/dist/vue.cjs +1 -1
  32. package/dist/vue.d.cts +49 -2
  33. package/dist/vue.d.ts +49 -2
  34. package/dist/vue.js +1 -1
  35. package/dist/widget.cjs +1 -1
  36. package/dist/widget.d.cts +48 -0
  37. package/dist/widget.d.ts +48 -0
  38. package/dist/widget.js +3 -3
  39. package/package.json +6 -6
  40. package/dist/rolldown-runtime-CaekUdDJ.cjs +0 -1
  41. package/dist/rolldown-runtime-DxmricAu.js +0 -25
package/dist/devtools.js CHANGED
@@ -1,74 +1,96 @@
1
- var p, d, x = () => ({});
1
+ var v, x, p, h = () => ({});
2
2
  function i() {
3
- p && (p.textContent = JSON.stringify(x(), null, 2));
3
+ v && (v.textContent = JSON.stringify(h(), null, 2));
4
4
  }
5
- function r(n, e) {
6
- if (!d) return;
7
- const o = document.createElement("div");
8
- o.className = `dev-log-line dev-log-${e}`, o.textContent = `${(/* @__PURE__ */ new Date()).toLocaleTimeString()} ${n}`, d.appendChild(o), d.scrollTop = d.scrollHeight;
5
+ function m(e, t, d) {
6
+ if (!e) return;
7
+ const n = document.createElement("div");
8
+ n.className = `dev-log-line dev-log-${d}`, n.textContent = `${(/* @__PURE__ */ new Date()).toLocaleTimeString()} ${t}`, e.appendChild(n), e.scrollTop = e.scrollHeight;
9
9
  }
10
- var f = "ago_dev_panel_collapsed";
11
- function c(n, e) {
12
- n.classList.toggle("collapsed", e);
13
- const o = n.querySelector(".dev-toggle");
14
- o && (o.textContent = e ? "▢" : "—", o.title = e ? "Expand dev tools" : "Collapse dev tools", o.setAttribute("aria-expanded", String(!e)));
10
+ function c(e, t) {
11
+ m(x, e, t);
12
+ }
13
+ function y(e) {
14
+ let t;
15
+ return e.type ? t = e.type : e.content !== void 0 ? t = "content" : e.full_content !== void 0 ? t = "full_content" : e.status ? t = `status:${e.status}` : t = "event", `${t} ${JSON.stringify(e)}`;
16
+ }
17
+ var S = "ago_dev_panel_collapsed", E = "ago_dev_events_collapsed";
18
+ function g(e, t, d, n) {
19
+ e.classList.toggle("collapsed", t);
20
+ const o = e.querySelector(".dev-toggle");
21
+ o && (o.textContent = t ? "▢" : "—", o.title = t ? `Expand ${n}` : `Collapse ${n}`, o.setAttribute("aria-expanded", String(!t)));
22
+ try {
23
+ localStorage.setItem(d, t ? "1" : "0");
24
+ } catch {
25
+ }
26
+ }
27
+ function u(e, t, d) {
28
+ e.querySelector(".dev-toggle")?.addEventListener("click", (o) => {
29
+ o.stopPropagation(), g(e, !e.classList.contains("collapsed"), t, d);
30
+ }), e.addEventListener("click", () => {
31
+ e.classList.contains("collapsed") && g(e, !1, t, d);
32
+ });
33
+ let n = !1;
15
34
  try {
16
- localStorage.setItem(f, e ? "1" : "0");
35
+ n = localStorage.getItem(t) === "1";
17
36
  } catch {
18
37
  }
38
+ g(e, n, t, d);
19
39
  }
20
- function y(n) {
21
- const { client: e, target: o } = n;
22
- x = () => {
23
- const t = e.getContextSnapshot()?.entries ?? {};
24
- return Object.fromEntries(Object.entries(t).map(([l, { name: s, data: h }]) => [l, {
25
- name: s,
26
- data: h
40
+ function L(e) {
41
+ const { client: t, target: d } = e;
42
+ h = () => {
43
+ const a = t.getContextSnapshot()?.entries ?? {};
44
+ return Object.fromEntries(Object.entries(a).map(([l, { name: r, data: b }]) => [l, {
45
+ name: r,
46
+ data: b
27
47
  }]));
28
- }, b();
29
- const u = typeof o == "string" ? document.querySelector(o) : o instanceof Element ? o : document.body, a = document.createElement("aside");
30
- a.id = "ago-dev-panel", (u ?? document.body).appendChild(a), a.innerHTML = `
48
+ }, C();
49
+ const n = typeof d == "string" ? document.querySelector(d) : d instanceof Element ? d : document.body, o = document.createElement("aside");
50
+ o.id = "ago-dev-panel", o.className = "ago-dev-card", (n ?? document.body).appendChild(o), o.innerHTML = `
31
51
  <div class="dev-head">
32
52
  <span class="dev-badge">DEV</span>
33
53
  <span class="dev-title">DEV TOOLS · client-side function state — not for production</span>
34
54
  <button type="button" class="dev-toggle" aria-label="Toggle dev tools">—</button>
35
55
  </div>
36
56
  <div class="dev-body">
37
- <div class="dev-fns">Registered functions: <code>${(e.getRegisteredFunctions?.() ?? []).map((t) => t.name).join(", ") || "—"}</code></div>
57
+ <div class="dev-fns">Registered functions: <code>${(t.getRegisteredFunctions?.() ?? []).map((a) => a.name).join(", ") || "—"}</code></div>
38
58
  <div class="dev-section-label">JSON object (built by the agent)</div>
39
59
  <pre class="dev-state" id="ago-dev-state"></pre>
40
60
  <div class="dev-section-label">Function calls</div>
41
61
  <div class="dev-log" id="ago-dev-log"></div>
42
62
  </div>
43
- `, p = a.querySelector("#ago-dev-state"), d = a.querySelector("#ago-dev-log"), a.querySelector(".dev-toggle")?.addEventListener("click", (t) => {
44
- t.stopPropagation(), c(a, !a.classList.contains("collapsed"));
45
- }), a.addEventListener("click", () => {
46
- a.classList.contains("collapsed") && c(a, !1);
47
- });
48
- let g = !1;
49
- try {
50
- g = localStorage.getItem(f) === "1";
51
- } catch {
52
- }
53
- c(a, g), e.on("function:invoke", ({ functionName: t, arguments: l }) => {
54
- r(`→ ${t}(${JSON.stringify(l ?? {})})`, "invoke");
55
- }), e.on("function:result", ({ result: t, error: l }) => {
56
- r(l ? `✗ error: ${l}` : `← ${JSON.stringify(t)}`, l ? "error" : "result"), i();
57
- }), e.on("context:changed", i), e.on("conversation:loaded", (t) => {
58
- const l = (t.messages ?? []).flatMap((s) => s.toolCalls ?? []);
59
- r(`⟳ hydrated "${t.title || t.id}" — replayed ${l.length} tool call${l.length === 1 ? "" : "s"}`, "hydrate"), i();
63
+ `, v = o.querySelector("#ago-dev-state"), x = o.querySelector("#ago-dev-log"), u(o, S, "dev tools");
64
+ const s = document.createElement("aside");
65
+ s.id = "ago-dev-events", s.className = "ago-dev-card", (n ?? document.body).appendChild(s), s.innerHTML = `
66
+ <div class="dev-head">
67
+ <span class="dev-badge">SSE</span>
68
+ <span class="dev-title">SSE EVENT LOG · raw stream messages</span>
69
+ <button type="button" class="dev-toggle" aria-label="Toggle SSE event log">—</button>
70
+ </div>
71
+ <div class="dev-body">
72
+ <div class="dev-log" id="ago-dev-event-log"></div>
73
+ </div>
74
+ `, p = s.querySelector("#ago-dev-event-log"), u(s, E, "SSE event log"), t.on("stream:message", (a) => {
75
+ m(p, y(a), "event");
76
+ }), t.on("function:invoke", ({ functionName: a, arguments: l }) => {
77
+ c(`→ ${a}(${JSON.stringify(l ?? {})})`, "invoke");
78
+ }), t.on("function:result", ({ result: a, error: l }) => {
79
+ c(l ? `✗ error: ${l}` : `← ${JSON.stringify(a)}`, l ? "error" : "result"), i();
80
+ }), t.on("context:changed", i), t.on("conversation:loaded", (a) => {
81
+ const l = (a.messages ?? []).flatMap((r) => r.toolCalls ?? []);
82
+ c(`⟳ hydrated "${a.title || a.id}" — replayed ${l.length} tool call${l.length === 1 ? "" : "s"}`, "hydrate"), i();
60
83
  }), i();
61
84
  }
62
- var v = "ago-dev-panel-styles";
63
- function b() {
64
- if (document.getElementById(v)) return;
65
- const n = document.createElement("style");
66
- n.id = v, n.textContent = m, document.head.appendChild(n);
85
+ var f = "ago-dev-panel-styles";
86
+ function C() {
87
+ if (document.getElementById(f)) return;
88
+ const e = document.createElement("style");
89
+ e.id = f, e.textContent = w, document.head.appendChild(e);
67
90
  }
68
- var m = `
69
- #ago-dev-panel {
91
+ var w = `
92
+ .ago-dev-card {
70
93
  position: fixed;
71
- top: 16px;
72
94
  right: 16px;
73
95
  width: min(360px, calc(100vw - 32px));
74
96
  max-width: calc(100vw - 32px);
@@ -87,8 +109,11 @@ var m = `
87
109
  font-size: 12px;
88
110
  z-index: 1000;
89
111
  }
90
- #ago-dev-panel .dev-head { display: flex; align-items: center; gap: 8px; }
91
- #ago-dev-panel .dev-toggle {
112
+ /* The main panel pins to the top, the SSE log to the bottom, so they don't overlap. */
113
+ #ago-dev-panel { top: 16px; }
114
+ #ago-dev-events { bottom: 16px; }
115
+ .ago-dev-card .dev-head { display: flex; align-items: center; gap: 8px; }
116
+ .ago-dev-card .dev-toggle {
92
117
  margin-left: auto;
93
118
  flex: none;
94
119
  width: 22px;
@@ -104,19 +129,19 @@ var m = `
104
129
  line-height: 1;
105
130
  cursor: pointer;
106
131
  }
107
- #ago-dev-panel .dev-toggle:hover { color: #d7e0e8; border-color: #3a4655; }
108
- #ago-dev-panel .dev-body { display: flex; flex-direction: column; gap: 8px; }
132
+ .ago-dev-card .dev-toggle:hover { color: #d7e0e8; border-color: #3a4655; }
133
+ .ago-dev-card .dev-body { display: flex; flex-direction: column; gap: 8px; }
109
134
 
110
- /* Collapsed: shrink to a small clickable widget showing only the DEV badge. */
111
- #ago-dev-panel.collapsed {
135
+ /* Collapsed: shrink to a small clickable widget showing only the badge. */
136
+ .ago-dev-card.collapsed {
112
137
  width: auto;
113
138
  cursor: pointer;
114
139
  padding: 8px 10px;
115
140
  }
116
- #ago-dev-panel.collapsed .dev-title,
117
- #ago-dev-panel.collapsed .dev-body { display: none; }
118
- #ago-dev-panel.collapsed .dev-toggle { margin-left: 6px; }
119
- #ago-dev-panel .dev-badge {
141
+ .ago-dev-card.collapsed .dev-title,
142
+ .ago-dev-card.collapsed .dev-body { display: none; }
143
+ .ago-dev-card.collapsed .dev-toggle { margin-left: 6px; }
144
+ .ago-dev-card .dev-badge {
120
145
  background: #f59e0b;
121
146
  color: #1c1206;
122
147
  font-weight: 700;
@@ -125,17 +150,17 @@ var m = `
125
150
  padding: 2px 6px;
126
151
  border-radius: 5px;
127
152
  }
128
- #ago-dev-panel .dev-title { color: #f59e0b; font-size: 11px; line-height: 1.3; }
129
- #ago-dev-panel .dev-fns { color: #7c8a99; font-size: 11px; }
130
- #ago-dev-panel .dev-fns code { color: #9ecbff; }
131
- #ago-dev-panel .dev-section-label {
153
+ .ago-dev-card .dev-title { color: #f59e0b; font-size: 11px; line-height: 1.3; }
154
+ .ago-dev-card .dev-fns { color: #7c8a99; font-size: 11px; }
155
+ .ago-dev-card .dev-fns code { color: #9ecbff; }
156
+ .ago-dev-card .dev-section-label {
132
157
  color: #7c8a99;
133
158
  text-transform: uppercase;
134
159
  letter-spacing: .08em;
135
160
  font-size: 10px;
136
161
  margin-top: 4px;
137
162
  }
138
- #ago-dev-panel .dev-state {
163
+ .ago-dev-card .dev-state {
139
164
  margin: 0;
140
165
  padding: 8px;
141
166
  background: #060a0e;
@@ -145,7 +170,7 @@ var m = `
145
170
  white-space: pre;
146
171
  color: #c8e6c9;
147
172
  }
148
- #ago-dev-panel .dev-log {
173
+ .ago-dev-card .dev-log {
149
174
  display: flex;
150
175
  flex-direction: column;
151
176
  gap: 2px;
@@ -155,12 +180,15 @@ var m = `
155
180
  border-radius: 8px;
156
181
  padding: 6px 8px;
157
182
  }
158
- #ago-dev-panel .dev-log-line { white-space: pre-wrap; word-break: break-word; line-height: 1.4; }
159
- #ago-dev-panel .dev-log-invoke { color: #9ecbff; }
160
- #ago-dev-panel .dev-log-result { color: #86efac; }
161
- #ago-dev-panel .dev-log-error { color: #fca5a5; }
162
- #ago-dev-panel .dev-log-hydrate { color: #d8b4fe; }
183
+ /* The SSE log is the events panel's only content, so give it more room. */
184
+ #ago-dev-events .dev-log { max-height: 60vh; }
185
+ .ago-dev-card .dev-log-line { white-space: pre-wrap; word-break: break-word; line-height: 1.4; }
186
+ .ago-dev-card .dev-log-invoke { color: #9ecbff; }
187
+ .ago-dev-card .dev-log-result { color: #86efac; }
188
+ .ago-dev-card .dev-log-error { color: #fca5a5; }
189
+ .ago-dev-card .dev-log-hydrate { color: #d8b4fe; }
190
+ .ago-dev-card .dev-log-event { color: #7c8a99; }
163
191
  `;
164
192
  export {
165
- y as initDevPanel
193
+ L as initDevPanel
166
194
  };
@@ -1,19 +1,26 @@
1
- import { n as s } from "./rolldown-runtime-DxmricAu.js";
2
- var S = /* @__PURE__ */ s({
3
- copyToClipboard: () => p,
4
- getLocalStorage: () => f,
5
- getUserLocation: () => m,
6
- highlightElement: () => g,
7
- openUrl: () => l,
8
- scrollToElement: () => h,
9
- setLocalStorage: () => y,
10
- setTheme: () => d,
11
- showConfirmDialog: () => u,
12
- showNotification: () => c,
13
- showToast: () => a,
14
- submitForm: () => v,
15
- trackEvent: () => b
16
- }), a = {
1
+ var n = Object.defineProperty, a = (e, t) => {
2
+ let r = {};
3
+ for (var o in e)
4
+ n(r, o, {
5
+ get: e[o],
6
+ enumerable: !0
7
+ });
8
+ return t || n(r, Symbol.toStringTag, { value: "Module" }), r;
9
+ }, S = /* @__PURE__ */ a({
10
+ copyToClipboard: () => d,
11
+ getLocalStorage: () => g,
12
+ getUserLocation: () => h,
13
+ highlightElement: () => v,
14
+ openUrl: () => p,
15
+ scrollToElement: () => y,
16
+ setLocalStorage: () => f,
17
+ setTheme: () => u,
18
+ showConfirmDialog: () => m,
19
+ showNotification: () => l,
20
+ showToast: () => c,
21
+ submitForm: () => b,
22
+ trackEvent: () => w
23
+ }), c = {
17
24
  name: "showToast",
18
25
  description: "Show a toast notification to the user. Use this to confirm actions or display brief messages.",
19
26
  parameters: {
@@ -44,7 +51,7 @@ var S = /* @__PURE__ */ s({
44
51
  shown: !1,
45
52
  error: "No toast handler configured"
46
53
  })
47
- }, c = {
54
+ }, l = {
48
55
  name: "showNotification",
49
56
  description: "Show a browser notification to the user. Useful for important alerts even when the tab is not focused.",
50
57
  parameters: {
@@ -71,7 +78,7 @@ var S = /* @__PURE__ */ s({
71
78
  shown: !1,
72
79
  error: "Permission not granted"
73
80
  })
74
- }, l = {
81
+ }, p = {
75
82
  name: "openUrl",
76
83
  description: "Open a URL in a new browser tab.",
77
84
  parameters: {
@@ -83,7 +90,7 @@ var S = /* @__PURE__ */ s({
83
90
  required: ["url"]
84
91
  },
85
92
  handler: async (e) => (window.open(e.url, "_blank", "noopener,noreferrer"), { opened: !0 })
86
- }, p = {
93
+ }, d = {
87
94
  name: "copyToClipboard",
88
95
  description: "Copy text to the user's clipboard.",
89
96
  parameters: {
@@ -95,7 +102,7 @@ var S = /* @__PURE__ */ s({
95
102
  required: ["text"]
96
103
  },
97
104
  handler: async (e) => (await navigator.clipboard.writeText(e.text), { copied: !0 })
98
- }, d = {
105
+ }, u = {
99
106
  name: "setTheme",
100
107
  description: "Change the application's color theme. Sets a data-theme attribute on the document element.",
101
108
  parameters: {
@@ -118,7 +125,7 @@ var S = /* @__PURE__ */ s({
118
125
  applied: !0
119
126
  };
120
127
  }
121
- }, u = {
128
+ }, m = {
122
129
  name: "showConfirmDialog",
123
130
  description: "Show a confirmation dialog to the user and return their choice (true/false).",
124
131
  parameters: {
@@ -130,7 +137,7 @@ var S = /* @__PURE__ */ s({
130
137
  required: ["message"]
131
138
  },
132
139
  handler: async (e) => ({ confirmed: window.confirm(e.message) })
133
- }, m = {
140
+ }, h = {
134
141
  name: "getUserLocation",
135
142
  description: "Get the user's current geographic location (requires permission).",
136
143
  parameters: {
@@ -144,7 +151,7 @@ var S = /* @__PURE__ */ s({
144
151
  accuracy: t.coords.accuracy
145
152
  }), (t) => e({ error: t.message }));
146
153
  }) : { error: "Geolocation not supported" }
147
- }, h = {
154
+ }, y = {
148
155
  name: "scrollToElement",
149
156
  description: "Scroll the page to a specific element identified by CSS selector.",
150
157
  parameters: {
@@ -169,7 +176,7 @@ var S = /* @__PURE__ */ s({
169
176
  error: `Element not found: ${e.selector}`
170
177
  };
171
178
  }
172
- }, y = {
179
+ }, f = {
173
180
  name: "setLocalStorage",
174
181
  description: "Store a value in the browser's localStorage.",
175
182
  parameters: {
@@ -187,7 +194,7 @@ var S = /* @__PURE__ */ s({
187
194
  required: ["key", "value"]
188
195
  },
189
196
  handler: async (e) => (localStorage.setItem(e.key, e.value), { stored: !0 })
190
- }, f = {
197
+ }, g = {
191
198
  name: "getLocalStorage",
192
199
  description: "Retrieve a value from the browser's localStorage.",
193
200
  parameters: {
@@ -206,7 +213,7 @@ var S = /* @__PURE__ */ s({
206
213
  found: t !== null
207
214
  };
208
215
  }
209
- }, g = {
216
+ }, v = {
210
217
  name: "highlightElement",
211
218
  description: "Highlight a DOM element to draw the user's attention (e.g. for onboarding).",
212
219
  parameters: {
@@ -237,7 +244,7 @@ var S = /* @__PURE__ */ s({
237
244
  t.style.outline = r, t.style.outlineOffset = "";
238
245
  }, 3e3), { highlighted: !0 };
239
246
  }
240
- }, v = {
247
+ }, b = {
241
248
  name: "submitForm",
242
249
  description: "Fill and submit an HTML form on the page. Pass field values as key-value pairs.",
243
250
  parameters: {
@@ -262,14 +269,14 @@ var S = /* @__PURE__ */ s({
262
269
  };
263
270
  if (e.values) {
264
271
  const r = JSON.parse(e.values);
265
- for (const [o, n] of Object.entries(r)) {
272
+ for (const [o, s] of Object.entries(r)) {
266
273
  const i = t.elements.namedItem(o);
267
- i && (i.value = n);
274
+ i && (i.value = s);
268
275
  }
269
276
  }
270
277
  return t.requestSubmit(), { submitted: !0 };
271
278
  }
272
- }, b = {
279
+ }, w = {
273
280
  name: "trackEvent",
274
281
  description: "Track a custom analytics event. Override the handler to wire up your analytics provider.",
275
282
  parameters: {
@@ -295,18 +302,18 @@ var S = /* @__PURE__ */ s({
295
302
  }
296
303
  };
297
304
  export {
298
- g as a,
299
- y as c,
300
- c as d,
301
- a as f,
302
- m as i,
303
- d as l,
304
- b as m,
305
+ v as a,
306
+ f as c,
307
+ l as d,
308
+ c as f,
309
+ h as i,
310
+ u as l,
311
+ w as m,
305
312
  S as n,
306
- l as o,
307
- v as p,
308
- f as r,
309
- h as s,
310
- p as t,
311
- u
313
+ p as o,
314
+ b as p,
315
+ g as r,
316
+ y as s,
317
+ d as t,
318
+ m as u
312
319
  };
@@ -1 +1 @@
1
- const v=require("./rolldown-runtime-CaekUdDJ.cjs");var w=v.__exportAll({copyToClipboard:()=>c,getLocalStorage:()=>f,getUserLocation:()=>p,highlightElement:()=>h,openUrl:()=>a,scrollToElement:()=>d,setLocalStorage:()=>m,setTheme:()=>l,showConfirmDialog:()=>u,showNotification:()=>s,showToast:()=>i,submitForm:()=>y,trackEvent:()=>g}),i={name:"showToast",description:"Show a toast notification to the user. Use this to confirm actions or display brief messages.",parameters:{type:"object",properties:{message:{type:"string",description:"The message to display"},type:{type:"string",description:"Toast type",enum:["success","error","warning","info"]},duration:{type:"number",description:"Duration in milliseconds (default 3000)"}},required:["message"]},handler:async()=>({shown:!1,error:"No toast handler configured"})},s={name:"showNotification",description:"Show a browser notification to the user. Useful for important alerts even when the tab is not focused.",parameters:{type:"object",properties:{title:{type:"string",description:"Notification title"},body:{type:"string",description:"Notification body text"}},required:["title"]},handler:async e=>typeof Notification>"u"?{shown:!1,error:"Notifications not supported"}:Notification.permission==="denied"?{shown:!1,error:"Notification permission denied"}:(Notification.permission!=="granted"&&await Notification.requestPermission(),Notification.permission==="granted"?(new Notification(e.title,{body:e.body}),{shown:!0}):{shown:!1,error:"Permission not granted"})},a={name:"openUrl",description:"Open a URL in a new browser tab.",parameters:{type:"object",properties:{url:{type:"string",description:"The URL to open"}},required:["url"]},handler:async e=>(window.open(e.url,"_blank","noopener,noreferrer"),{opened:!0})},c={name:"copyToClipboard",description:"Copy text to the user's clipboard.",parameters:{type:"object",properties:{text:{type:"string",description:"The text to copy"}},required:["text"]},handler:async e=>(await navigator.clipboard.writeText(e.text),{copied:!0})},l={name:"setTheme",description:"Change the application's color theme. Sets a data-theme attribute on the document element.",parameters:{type:"object",properties:{theme:{type:"string",description:"Theme to apply",enum:["light","dark","system"]}},required:["theme"]},handler:async e=>{const t=e.theme;return document.documentElement.setAttribute("data-theme",t),t==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),{theme:t,applied:!0}}},u={name:"showConfirmDialog",description:"Show a confirmation dialog to the user and return their choice (true/false).",parameters:{type:"object",properties:{message:{type:"string",description:"The confirmation message to display"}},required:["message"]},handler:async e=>({confirmed:window.confirm(e.message)})},p={name:"getUserLocation",description:"Get the user's current geographic location (requires permission).",parameters:{type:"object",properties:{}},handler:async()=>navigator.geolocation?new Promise(e=>{navigator.geolocation.getCurrentPosition(t=>e({latitude:t.coords.latitude,longitude:t.coords.longitude,accuracy:t.coords.accuracy}),t=>e({error:t.message}))}):{error:"Geolocation not supported"}},d={name:"scrollToElement",description:"Scroll the page to a specific element identified by CSS selector.",parameters:{type:"object",properties:{selector:{type:"string",description:"CSS selector of the element to scroll to (e.g. '#section-pricing')"},behavior:{type:"string",description:"Scroll behavior",enum:["smooth","instant"]}},required:["selector"]},handler:async e=>{const t=document.querySelector(e.selector);return t?(t.scrollIntoView({behavior:e.behavior||"smooth"}),{scrolled:!0}):{scrolled:!1,error:`Element not found: ${e.selector}`}}},m={name:"setLocalStorage",description:"Store a value in the browser's localStorage.",parameters:{type:"object",properties:{key:{type:"string",description:"Storage key"},value:{type:"string",description:"Value to store"}},required:["key","value"]},handler:async e=>(localStorage.setItem(e.key,e.value),{stored:!0})},f={name:"getLocalStorage",description:"Retrieve a value from the browser's localStorage.",parameters:{type:"object",properties:{key:{type:"string",description:"Storage key"}},required:["key"]},handler:async e=>{const t=localStorage.getItem(e.key);return{key:e.key,value:t,found:t!==null}}},h={name:"highlightElement",description:"Highlight a DOM element to draw the user's attention (e.g. for onboarding).",parameters:{type:"object",properties:{selector:{type:"string",description:"CSS selector of the element to highlight"},color:{type:"string",description:"Highlight border color (default: #3b82f6)"}},required:["selector"]},handler:async e=>{const t=document.querySelector(e.selector);if(!t)return{highlighted:!1,error:`Element not found: ${e.selector}`};const r=t.style.outline,o=e.color||"#3b82f6";return t.style.outline=`3px solid ${o}`,t.style.outlineOffset="2px",t.scrollIntoView({behavior:"smooth",block:"center"}),setTimeout(()=>{t.style.outline=r,t.style.outlineOffset=""},3e3),{highlighted:!0}}},y={name:"submitForm",description:"Fill and submit an HTML form on the page. Pass field values as key-value pairs.",parameters:{type:"object",properties:{selector:{type:"string",description:"CSS selector of the form element"},values:{type:"string",description:"JSON string of field name → value pairs"}},required:["selector"]},handler:async e=>{const t=document.querySelector(e.selector);if(!t)return{submitted:!1,error:`Form not found: ${e.selector}`};if(e.values){const r=JSON.parse(e.values);for(const[o,b]of Object.entries(r)){const n=t.elements.namedItem(o);n&&(n.value=b)}}return t.requestSubmit(),{submitted:!0}}},g={name:"trackEvent",description:"Track a custom analytics event. Override the handler to wire up your analytics provider.",parameters:{type:"object",properties:{event:{type:"string",description:"Event name"},properties:{type:"string",description:"JSON string of event properties"}},required:["event"]},handler:async e=>{const t=e.properties?JSON.parse(e.properties):{};return console.log(`[AGO Analytics] ${e.event}`,t),{tracked:!0,event:e.event}}};Object.defineProperty(exports,"copyToClipboard",{enumerable:!0,get:function(){return c}});Object.defineProperty(exports,"functions_exports",{enumerable:!0,get:function(){return w}});Object.defineProperty(exports,"getLocalStorage",{enumerable:!0,get:function(){return f}});Object.defineProperty(exports,"getUserLocation",{enumerable:!0,get:function(){return p}});Object.defineProperty(exports,"highlightElement",{enumerable:!0,get:function(){return h}});Object.defineProperty(exports,"openUrl",{enumerable:!0,get:function(){return a}});Object.defineProperty(exports,"scrollToElement",{enumerable:!0,get:function(){return d}});Object.defineProperty(exports,"setLocalStorage",{enumerable:!0,get:function(){return m}});Object.defineProperty(exports,"setTheme",{enumerable:!0,get:function(){return l}});Object.defineProperty(exports,"showConfirmDialog",{enumerable:!0,get:function(){return u}});Object.defineProperty(exports,"showNotification",{enumerable:!0,get:function(){return s}});Object.defineProperty(exports,"showToast",{enumerable:!0,get:function(){return i}});Object.defineProperty(exports,"submitForm",{enumerable:!0,get:function(){return y}});Object.defineProperty(exports,"trackEvent",{enumerable:!0,get:function(){return g}});
1
+ const v=require("./rolldown-runtime-16Nf8qvH.cjs");var w=v.__exportAll({copyToClipboard:()=>c,getLocalStorage:()=>f,getUserLocation:()=>p,highlightElement:()=>h,openUrl:()=>a,scrollToElement:()=>d,setLocalStorage:()=>m,setTheme:()=>l,showConfirmDialog:()=>u,showNotification:()=>s,showToast:()=>i,submitForm:()=>y,trackEvent:()=>g}),i={name:"showToast",description:"Show a toast notification to the user. Use this to confirm actions or display brief messages.",parameters:{type:"object",properties:{message:{type:"string",description:"The message to display"},type:{type:"string",description:"Toast type",enum:["success","error","warning","info"]},duration:{type:"number",description:"Duration in milliseconds (default 3000)"}},required:["message"]},handler:async()=>({shown:!1,error:"No toast handler configured"})},s={name:"showNotification",description:"Show a browser notification to the user. Useful for important alerts even when the tab is not focused.",parameters:{type:"object",properties:{title:{type:"string",description:"Notification title"},body:{type:"string",description:"Notification body text"}},required:["title"]},handler:async e=>typeof Notification>"u"?{shown:!1,error:"Notifications not supported"}:Notification.permission==="denied"?{shown:!1,error:"Notification permission denied"}:(Notification.permission!=="granted"&&await Notification.requestPermission(),Notification.permission==="granted"?(new Notification(e.title,{body:e.body}),{shown:!0}):{shown:!1,error:"Permission not granted"})},a={name:"openUrl",description:"Open a URL in a new browser tab.",parameters:{type:"object",properties:{url:{type:"string",description:"The URL to open"}},required:["url"]},handler:async e=>(window.open(e.url,"_blank","noopener,noreferrer"),{opened:!0})},c={name:"copyToClipboard",description:"Copy text to the user's clipboard.",parameters:{type:"object",properties:{text:{type:"string",description:"The text to copy"}},required:["text"]},handler:async e=>(await navigator.clipboard.writeText(e.text),{copied:!0})},l={name:"setTheme",description:"Change the application's color theme. Sets a data-theme attribute on the document element.",parameters:{type:"object",properties:{theme:{type:"string",description:"Theme to apply",enum:["light","dark","system"]}},required:["theme"]},handler:async e=>{const t=e.theme;return document.documentElement.setAttribute("data-theme",t),t==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),{theme:t,applied:!0}}},u={name:"showConfirmDialog",description:"Show a confirmation dialog to the user and return their choice (true/false).",parameters:{type:"object",properties:{message:{type:"string",description:"The confirmation message to display"}},required:["message"]},handler:async e=>({confirmed:window.confirm(e.message)})},p={name:"getUserLocation",description:"Get the user's current geographic location (requires permission).",parameters:{type:"object",properties:{}},handler:async()=>navigator.geolocation?new Promise(e=>{navigator.geolocation.getCurrentPosition(t=>e({latitude:t.coords.latitude,longitude:t.coords.longitude,accuracy:t.coords.accuracy}),t=>e({error:t.message}))}):{error:"Geolocation not supported"}},d={name:"scrollToElement",description:"Scroll the page to a specific element identified by CSS selector.",parameters:{type:"object",properties:{selector:{type:"string",description:"CSS selector of the element to scroll to (e.g. '#section-pricing')"},behavior:{type:"string",description:"Scroll behavior",enum:["smooth","instant"]}},required:["selector"]},handler:async e=>{const t=document.querySelector(e.selector);return t?(t.scrollIntoView({behavior:e.behavior||"smooth"}),{scrolled:!0}):{scrolled:!1,error:`Element not found: ${e.selector}`}}},m={name:"setLocalStorage",description:"Store a value in the browser's localStorage.",parameters:{type:"object",properties:{key:{type:"string",description:"Storage key"},value:{type:"string",description:"Value to store"}},required:["key","value"]},handler:async e=>(localStorage.setItem(e.key,e.value),{stored:!0})},f={name:"getLocalStorage",description:"Retrieve a value from the browser's localStorage.",parameters:{type:"object",properties:{key:{type:"string",description:"Storage key"}},required:["key"]},handler:async e=>{const t=localStorage.getItem(e.key);return{key:e.key,value:t,found:t!==null}}},h={name:"highlightElement",description:"Highlight a DOM element to draw the user's attention (e.g. for onboarding).",parameters:{type:"object",properties:{selector:{type:"string",description:"CSS selector of the element to highlight"},color:{type:"string",description:"Highlight border color (default: #3b82f6)"}},required:["selector"]},handler:async e=>{const t=document.querySelector(e.selector);if(!t)return{highlighted:!1,error:`Element not found: ${e.selector}`};const r=t.style.outline,o=e.color||"#3b82f6";return t.style.outline=`3px solid ${o}`,t.style.outlineOffset="2px",t.scrollIntoView({behavior:"smooth",block:"center"}),setTimeout(()=>{t.style.outline=r,t.style.outlineOffset=""},3e3),{highlighted:!0}}},y={name:"submitForm",description:"Fill and submit an HTML form on the page. Pass field values as key-value pairs.",parameters:{type:"object",properties:{selector:{type:"string",description:"CSS selector of the form element"},values:{type:"string",description:"JSON string of field name → value pairs"}},required:["selector"]},handler:async e=>{const t=document.querySelector(e.selector);if(!t)return{submitted:!1,error:`Form not found: ${e.selector}`};if(e.values){const r=JSON.parse(e.values);for(const[o,b]of Object.entries(r)){const n=t.elements.namedItem(o);n&&(n.value=b)}}return t.requestSubmit(),{submitted:!0}}},g={name:"trackEvent",description:"Track a custom analytics event. Override the handler to wire up your analytics provider.",parameters:{type:"object",properties:{event:{type:"string",description:"Event name"},properties:{type:"string",description:"JSON string of event properties"}},required:["event"]},handler:async e=>{const t=e.properties?JSON.parse(e.properties):{};return console.log(`[AGO Analytics] ${e.event}`,t),{tracked:!0,event:e.event}}};Object.defineProperty(exports,"copyToClipboard",{enumerable:!0,get:function(){return c}});Object.defineProperty(exports,"functions_exports",{enumerable:!0,get:function(){return w}});Object.defineProperty(exports,"getLocalStorage",{enumerable:!0,get:function(){return f}});Object.defineProperty(exports,"getUserLocation",{enumerable:!0,get:function(){return p}});Object.defineProperty(exports,"highlightElement",{enumerable:!0,get:function(){return h}});Object.defineProperty(exports,"openUrl",{enumerable:!0,get:function(){return a}});Object.defineProperty(exports,"scrollToElement",{enumerable:!0,get:function(){return d}});Object.defineProperty(exports,"setLocalStorage",{enumerable:!0,get:function(){return m}});Object.defineProperty(exports,"setTheme",{enumerable:!0,get:function(){return l}});Object.defineProperty(exports,"showConfirmDialog",{enumerable:!0,get:function(){return u}});Object.defineProperty(exports,"showNotification",{enumerable:!0,get:function(){return s}});Object.defineProperty(exports,"showToast",{enumerable:!0,get:function(){return i}});Object.defineProperty(exports,"submitForm",{enumerable:!0,get:function(){return y}});Object.defineProperty(exports,"trackEvent",{enumerable:!0,get:function(){return g}});
package/dist/helpers.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./functions-DsmzgHjC.cjs");exports.copyToClipboard=o.copyToClipboard;exports.getLocalStorage=o.getLocalStorage;exports.getUserLocation=o.getUserLocation;exports.highlightElement=o.highlightElement;exports.openUrl=o.openUrl;exports.scrollToElement=o.scrollToElement;exports.setLocalStorage=o.setLocalStorage;exports.setTheme=o.setTheme;exports.showConfirmDialog=o.showConfirmDialog;exports.showNotification=o.showNotification;exports.showToast=o.showToast;exports.submitForm=o.submitForm;exports.trackEvent=o.trackEvent;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./functions-Djnq-JAo.cjs");exports.copyToClipboard=o.copyToClipboard;exports.getLocalStorage=o.getLocalStorage;exports.getUserLocation=o.getUserLocation;exports.highlightElement=o.highlightElement;exports.openUrl=o.openUrl;exports.scrollToElement=o.scrollToElement;exports.setLocalStorage=o.setLocalStorage;exports.setTheme=o.setTheme;exports.showConfirmDialog=o.showConfirmDialog;exports.showNotification=o.showNotification;exports.showToast=o.showToast;exports.submitForm=o.submitForm;exports.trackEvent=o.trackEvent;
package/dist/helpers.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a, c as s, d as t, f as e, i as r, l as i, m as l, o as m, p as c, r as g, s as h, t as n, u as p } from "./functions-C1-5vadY.js";
1
+ import { a, c as s, d as t, f as e, i as r, l as i, m as l, o as m, p as c, r as g, s as h, t as n, u as p } from "./functions-CApuQZ2b.js";
2
2
  export {
3
3
  n as copyToClipboard,
4
4
  g as getLocalStorage,
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./AgoClient-1jgDndKs.cjs"),m=require("./createFormCollector-B8V9YSGe.cjs"),p=require("./createConversationSession-BYNhYbkY.cjs"),w=require("./createMockClient-zHQ0cjUH.cjs");require("./testing.cjs");const g=require("./functions-DsmzgHjC.cjs");function h(e){return e}function E(e,o){return e.on("message:complete",o),()=>e.off("message:complete",o)}function S(e,o){return e.on("message:chunk",o),()=>e.off("message:chunk",o)}function y(e,o){return e.on("message:start",o),()=>e.off("message:start",o)}function v(e,o){return e.on("message:error",o),()=>e.off("message:error",o)}function b(e,o){return e.on("toolCall:received",o),()=>e.off("toolCall:received",o)}function F(e,o){return e.on("function:invoke",o),()=>e.off("function:invoke",o)}async function*M(e,o,l){const a=[];let r=null,s=!1;const c=i=>{a.push(i),r?.()},f=i=>c({type:"start",data:i}),t=i=>c({type:"chunk",data:i}),u=i=>{c({type:"complete",data:i}),s=!0,r?.()},d=i=>{c({type:"error",data:i}),s=!0,r?.()},C=i=>c({type:"toolCall",data:i});e.on("message:start",f),e.on("message:chunk",t),e.on("message:complete",u),e.on("message:error",d),e.on("toolCall:received",C),e.sendMessage(o,l).catch(()=>{s=!0,r?.()});try{for(;!s||a.length>0;)a.length>0?yield a.shift():(await new Promise(i=>{r=i}),r=null)}finally{e.off("message:start",f),e.off("message:chunk",t),e.off("message:complete",u),e.off("message:error",d),e.off("toolCall:received",C)}}function A(e){let o,l,a,r,s,c;if(typeof window<"u"&&window.AGO){const t=window.AGO;o=t.basepath,l=t.widgetId,a=t.agent||t.defaultAgent,r=t.permission,s=t.email,c=t.jwt}if(typeof document<"u"){const t=u=>document.querySelector(`meta[name="${u}"]`)?.getAttribute("content")||void 0;o=o||t("ago-base-url"),l=l||t("ago-widget-id"),a=a||t("ago-agent")||t("ago-agent-id"),r=r||t("ago-permission"),s=s||t("ago-user-email")}if(typeof document<"u"){const t=[document.body,...Array.from(document.querySelectorAll("script[data-ago-base-url]"))].filter(Boolean);for(const u of t)u&&(o=o||u.getAttribute("data-ago-base-url")||void 0,l=l||u.getAttribute("data-ago-widget-id")||void 0,a=a||u.getAttribute("data-ago-agent")||u.getAttribute("data-ago-agent-id")||void 0,r=r||u.getAttribute("data-ago-permission")||void 0,s=s||u.getAttribute("data-ago-user-email")||void 0)}o=e?.baseUrl||o,l=e?.widgetId||l,a=e?.agent||e?.defaultAgentId||a,r=e?.permission||r,s=e?.userEmail||s,c=e?.userJwt||c;const f=e?.debug;return o?{baseUrl:o,widgetId:l,agent:a,permission:r,userEmail:s,userJwt:c,debug:f}:null}function k(e){const o=A(e);if(!o)throw new n.AgoError('createAgo(): could not detect AGO configuration. Set window.AGO, add <meta name="ago-base-url">, or pass { baseUrl } explicitly.',"config_missing_base_url");return new n.AgoClient(o)}function q(e,o){return{...e,handler:o}}exports.AgoApiError=n.AgoApiError;exports.AgoClient=n.AgoClient;exports.AgoError=n.AgoError;exports.AgoFunctionError=n.AgoFunctionError;exports.AgoNetworkError=n.AgoNetworkError;exports.AgoStreamError=n.AgoStreamError;exports.ClientContextRegistry=n.ClientContextRegistry;exports.EventEmitter=n.EventEmitter;exports.FunctionRegistry=n.FunctionRegistry;exports.SSEHandler=n.SSEHandler;exports.autoDetectConfig=A;exports.copyToClipboard=g.copyToClipboard;exports.createAgo=k;exports.createConversationSession=p.createConversationSession;exports.createFormCollector=m.createFormCollector;exports.createMessageStream=M;exports.createMockClient=w.createMockClient;exports.createStore=m.createStore;exports.defineFunction=h;exports.deriveFormStatus=m.deriveFormStatus;exports.getLocalStorage=g.getLocalStorage;exports.getUserLocation=g.getUserLocation;exports.highlightElement=g.highlightElement;exports.isStreamNetworkError=n.isStreamNetworkError;exports.loadFormCollector=m.loadFormCollector;exports.logger=n.logger;exports.onFunctionInvoke=F;exports.onMessage=E;exports.onMessageChunk=S;exports.onMessageError=v;exports.onMessageStart=y;exports.onToolCall=b;exports.openUrl=g.openUrl;exports.scrollToElement=g.scrollToElement;exports.setLocalStorage=g.setLocalStorage;exports.setTheme=g.setTheme;exports.showConfirmDialog=g.showConfirmDialog;exports.showNotification=g.showNotification;exports.showToast=g.showToast;exports.submitForm=g.submitForm;exports.trackEvent=g.trackEvent;exports.validateConfig=n.validateConfig;exports.withHandler=q;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./AgoClient--y10UXUV.cjs"),m=require("./createFormCollector-CSG5ioym.cjs"),p=require("./createConversationSession-lJWANT6T.cjs"),w=require("./createMockClient-zHQ0cjUH.cjs");require("./testing.cjs");const g=require("./functions-Djnq-JAo.cjs");function h(e){return e}function E(e,o){return e.on("message:complete",o),()=>e.off("message:complete",o)}function S(e,o){return e.on("message:chunk",o),()=>e.off("message:chunk",o)}function y(e,o){return e.on("message:start",o),()=>e.off("message:start",o)}function v(e,o){return e.on("message:error",o),()=>e.off("message:error",o)}function b(e,o){return e.on("toolCall:received",o),()=>e.off("toolCall:received",o)}function F(e,o){return e.on("function:invoke",o),()=>e.off("function:invoke",o)}async function*M(e,o,l){const a=[];let r=null,s=!1;const c=i=>{a.push(i),r?.()},f=i=>c({type:"start",data:i}),t=i=>c({type:"chunk",data:i}),u=i=>{c({type:"complete",data:i}),s=!0,r?.()},d=i=>{c({type:"error",data:i}),s=!0,r?.()},C=i=>c({type:"toolCall",data:i});e.on("message:start",f),e.on("message:chunk",t),e.on("message:complete",u),e.on("message:error",d),e.on("toolCall:received",C),e.sendMessage(o,l).catch(()=>{s=!0,r?.()});try{for(;!s||a.length>0;)a.length>0?yield a.shift():(await new Promise(i=>{r=i}),r=null)}finally{e.off("message:start",f),e.off("message:chunk",t),e.off("message:complete",u),e.off("message:error",d),e.off("toolCall:received",C)}}function A(e){let o,l,a,r,s,c;if(typeof window<"u"&&window.AGO){const t=window.AGO;o=t.basepath,l=t.widgetId,a=t.agent||t.defaultAgent,r=t.permission,s=t.email,c=t.jwt}if(typeof document<"u"){const t=u=>document.querySelector(`meta[name="${u}"]`)?.getAttribute("content")||void 0;o=o||t("ago-base-url"),l=l||t("ago-widget-id"),a=a||t("ago-agent")||t("ago-agent-id"),r=r||t("ago-permission"),s=s||t("ago-user-email")}if(typeof document<"u"){const t=[document.body,...Array.from(document.querySelectorAll("script[data-ago-base-url]"))].filter(Boolean);for(const u of t)u&&(o=o||u.getAttribute("data-ago-base-url")||void 0,l=l||u.getAttribute("data-ago-widget-id")||void 0,a=a||u.getAttribute("data-ago-agent")||u.getAttribute("data-ago-agent-id")||void 0,r=r||u.getAttribute("data-ago-permission")||void 0,s=s||u.getAttribute("data-ago-user-email")||void 0)}o=e?.baseUrl||o,l=e?.widgetId||l,a=e?.agent||e?.defaultAgentId||a,r=e?.permission||r,s=e?.userEmail||s,c=e?.userJwt||c;const f=e?.debug;return o?{baseUrl:o,widgetId:l,agent:a,permission:r,userEmail:s,userJwt:c,debug:f}:null}function k(e){const o=A(e);if(!o)throw new n.AgoError('createAgo(): could not detect AGO configuration. Set window.AGO, add <meta name="ago-base-url">, or pass { baseUrl } explicitly.',"config_missing_base_url");return new n.AgoClient(o)}function q(e,o){return{...e,handler:o}}exports.AgoApiError=n.AgoApiError;exports.AgoClient=n.AgoClient;exports.AgoError=n.AgoError;exports.AgoFunctionError=n.AgoFunctionError;exports.AgoNetworkError=n.AgoNetworkError;exports.AgoStreamError=n.AgoStreamError;exports.ClientContextRegistry=n.ClientContextRegistry;exports.EventEmitter=n.EventEmitter;exports.FunctionRegistry=n.FunctionRegistry;exports.SSEHandler=n.SSEHandler;exports.autoDetectConfig=A;exports.copyToClipboard=g.copyToClipboard;exports.createAgo=k;exports.createConversationSession=p.createConversationSession;exports.createFormCollector=m.createFormCollector;exports.createMessageStream=M;exports.createMockClient=w.createMockClient;exports.createStore=m.createStore;exports.defineFunction=h;exports.deriveFormStatus=m.deriveFormStatus;exports.getLocalStorage=g.getLocalStorage;exports.getUserLocation=g.getUserLocation;exports.highlightElement=g.highlightElement;exports.isStreamNetworkError=n.isStreamNetworkError;exports.loadFormCollector=m.loadFormCollector;exports.logger=n.logger;exports.onFunctionInvoke=F;exports.onMessage=E;exports.onMessageChunk=S;exports.onMessageError=v;exports.onMessageStart=y;exports.onToolCall=b;exports.openUrl=g.openUrl;exports.scrollToElement=g.scrollToElement;exports.setLocalStorage=g.setLocalStorage;exports.setTheme=g.setTheme;exports.showConfirmDialog=g.showConfirmDialog;exports.showNotification=g.showNotification;exports.showToast=g.showToast;exports.submitForm=g.submitForm;exports.trackEvent=g.trackEvent;exports.validateConfig=n.validateConfig;exports.withHandler=q;
package/dist/index.d.cts CHANGED
@@ -254,6 +254,13 @@ export declare interface AgoClientEvents {
254
254
  conversationId: string;
255
255
  messageId: string;
256
256
  };
257
+ /**
258
+ * Every raw SSE message parsed off the stream, before the handler interprets it
259
+ * into the higher-level `message:*` / `toolCall:*` / `function:*` events. Carries
260
+ * the chunk verbatim so debugging tools (notably the dev panel) can log the exact
261
+ * wire payload. Heartbeat comments are not messages and don't fire this.
262
+ */
263
+ "stream:message": SSEChunkData;
257
264
  /**
258
265
  * The main answer text is done (backend emitted `status: "DONE"`), but follow-up
259
266
  * replies may still be pending. Fires once, before `message:complete`.
@@ -1315,6 +1322,11 @@ export declare class SSEHandler {
1315
1322
  }
1316
1323
 
1317
1324
  declare interface SSEHandlerCallbacks {
1325
+ /**
1326
+ * Every raw SSE chunk parsed off the stream, fired before it's interpreted into
1327
+ * the higher-level callbacks below. The verbatim payload, for debugging/logging.
1328
+ */
1329
+ onRawChunk?: (data: SSEChunkData) => void;
1318
1330
  onStart?: (data: {
1319
1331
  conversationId: string;
1320
1332
  messageId: string;
package/dist/index.d.ts CHANGED
@@ -254,6 +254,13 @@ export declare interface AgoClientEvents {
254
254
  conversationId: string;
255
255
  messageId: string;
256
256
  };
257
+ /**
258
+ * Every raw SSE message parsed off the stream, before the handler interprets it
259
+ * into the higher-level `message:*` / `toolCall:*` / `function:*` events. Carries
260
+ * the chunk verbatim so debugging tools (notably the dev panel) can log the exact
261
+ * wire payload. Heartbeat comments are not messages and don't fire this.
262
+ */
263
+ "stream:message": SSEChunkData;
257
264
  /**
258
265
  * The main answer text is done (backend emitted `status: "DONE"`), but follow-up
259
266
  * replies may still be pending. Fires once, before `message:complete`.
@@ -1315,6 +1322,11 @@ export declare class SSEHandler {
1315
1322
  }
1316
1323
 
1317
1324
  declare interface SSEHandlerCallbacks {
1325
+ /**
1326
+ * Every raw SSE chunk parsed off the stream, fired before it's interpreted into
1327
+ * the higher-level callbacks below. The verbatim payload, for debugging/logging.
1328
+ */
1329
+ onRawChunk?: (data: SSEChunkData) => void;
1318
1330
  onStart?: (data: {
1319
1331
  conversationId: string;
1320
1332
  messageId: string;