@useago/sdk 0.4.3 → 0.4.5

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,34 +1,34 @@
1
- import { a as w, c as h, d as A, f as y, i as C, l as E, n as b, o as S, r as v, s as k, t as d, u as M } from "./AgoClient-rvTz2thR.js";
2
- import { n as T, t as I } from "./createFormCollector-BwvkKi48.js";
3
- import { t as G } from "./createConversationSession-D9FesBQS.js";
4
- import { t as q } from "./createMockClient-DwdxNwEn.js";
5
- import { a as L, c as N, d as D, f as H, i as J, l as R, m as j, o as B, p as P, r as $, s as z, t as K, u as Q } from "./functions-C1-5vadY.js";
6
- function V(e) {
1
+ import { a as w, c as h, d as A, f as y, i as C, l as E, n as S, o as b, r as v, s as k, t as d, u as M } from "./AgoClient-rvTz2thR.js";
2
+ import { n as T, r as I, t as U } from "./createFormCollector-Cujr7hW4.js";
3
+ import { t as O } from "./createConversationSession-DbuVzvoX.js";
4
+ import { t as x } from "./createMockClient-DwdxNwEn.js";
5
+ import { a as N, c as D, d as H, f as J, i as R, l as j, m as B, o as P, p as $, r as z, s as K, t as Q, u as V } from "./functions-C1-5vadY.js";
6
+ function W(e) {
7
7
  return e;
8
8
  }
9
- function W(e, t) {
9
+ function X(e, t) {
10
10
  return e.on("message:complete", t), () => e.off("message:complete", t);
11
11
  }
12
- function X(e, t) {
12
+ function Y(e, t) {
13
13
  return e.on("message:chunk", t), () => e.off("message:chunk", t);
14
14
  }
15
- function Y(e, t) {
15
+ function Z(e, t) {
16
16
  return e.on("message:start", t), () => e.off("message:start", t);
17
17
  }
18
- function Z(e, t) {
18
+ function _(e, t) {
19
19
  return e.on("message:error", t), () => e.off("message:error", t);
20
20
  }
21
- function _(e, t) {
21
+ function ee(e, t) {
22
22
  return e.on("toolCall:received", t), () => e.off("toolCall:received", t);
23
23
  }
24
- function ee(e, t) {
24
+ function te(e, t) {
25
25
  return e.on("function:invoke", t), () => e.off("function:invoke", t);
26
26
  }
27
- async function* te(e, t, g) {
28
- const n = [];
29
- let r = null, a = !1;
27
+ async function* oe(e, t, g) {
28
+ const a = [];
29
+ let r = null, n = !1;
30
30
  const u = (s) => {
31
- n.push(s), r?.();
31
+ a.push(s), r?.();
32
32
  }, f = (s) => u({
33
33
  type: "start",
34
34
  data: s
@@ -39,21 +39,21 @@ async function* te(e, t, g) {
39
39
  u({
40
40
  type: "complete",
41
41
  data: s
42
- }), a = !0, r?.();
42
+ }), n = !0, r?.();
43
43
  }, m = (s) => {
44
44
  u({
45
45
  type: "error",
46
46
  data: s
47
- }), a = !0, r?.();
47
+ }), n = !0, r?.();
48
48
  }, l = (s) => u({
49
49
  type: "toolCall",
50
50
  data: s
51
51
  });
52
52
  e.on("message:start", f), e.on("message:chunk", o), e.on("message:complete", i), e.on("message:error", m), e.on("toolCall:received", l), e.sendMessage(t, g).catch(() => {
53
- a = !0, r?.();
53
+ n = !0, r?.();
54
54
  });
55
55
  try {
56
- for (; !a || n.length > 0; ) n.length > 0 ? yield n.shift() : (await new Promise((s) => {
56
+ for (; !n || a.length > 0; ) a.length > 0 ? yield a.shift() : (await new Promise((s) => {
57
57
  r = s;
58
58
  }), r = null);
59
59
  } finally {
@@ -61,38 +61,38 @@ async function* te(e, t, g) {
61
61
  }
62
62
  }
63
63
  function c(e) {
64
- let t, g, n, r, a, u;
64
+ let t, g, a, r, n, u;
65
65
  if (typeof window < "u" && window.AGO) {
66
66
  const o = window.AGO;
67
- t = o.basepath, g = o.widgetId, n = o.agent || o.defaultAgent, r = o.permission, a = o.email, u = o.jwt;
67
+ t = o.basepath, g = o.widgetId, a = o.agent || o.defaultAgent, r = o.permission, n = o.email, u = o.jwt;
68
68
  }
69
69
  if (typeof document < "u") {
70
70
  const o = (i) => document.querySelector(`meta[name="${i}"]`)?.getAttribute("content") || void 0;
71
- t = t || o("ago-base-url"), g = g || o("ago-widget-id"), n = n || o("ago-agent") || o("ago-agent-id"), r = r || o("ago-permission"), a = a || o("ago-user-email");
71
+ t = t || o("ago-base-url"), g = g || o("ago-widget-id"), a = a || o("ago-agent") || o("ago-agent-id"), r = r || o("ago-permission"), n = n || o("ago-user-email");
72
72
  }
73
73
  if (typeof document < "u") {
74
74
  const o = [document.body, ...Array.from(document.querySelectorAll("script[data-ago-base-url]"))].filter(Boolean);
75
75
  for (const i of o)
76
- i && (t = t || i.getAttribute("data-ago-base-url") || void 0, g = g || i.getAttribute("data-ago-widget-id") || void 0, n = n || i.getAttribute("data-ago-agent") || i.getAttribute("data-ago-agent-id") || void 0, r = r || i.getAttribute("data-ago-permission") || void 0, a = a || i.getAttribute("data-ago-user-email") || void 0);
76
+ i && (t = t || i.getAttribute("data-ago-base-url") || void 0, g = g || i.getAttribute("data-ago-widget-id") || void 0, a = a || i.getAttribute("data-ago-agent") || i.getAttribute("data-ago-agent-id") || void 0, r = r || i.getAttribute("data-ago-permission") || void 0, n = n || i.getAttribute("data-ago-user-email") || void 0);
77
77
  }
78
- t = e?.baseUrl || t, g = e?.widgetId || g, n = e?.agent || e?.defaultAgentId || n, r = e?.permission || r, a = e?.userEmail || a, u = e?.userJwt || u;
78
+ t = e?.baseUrl || t, g = e?.widgetId || g, a = e?.agent || e?.defaultAgentId || a, r = e?.permission || r, n = e?.userEmail || n, u = e?.userJwt || u;
79
79
  const f = e?.debug;
80
80
  return t ? {
81
81
  baseUrl: t,
82
82
  widgetId: g,
83
- agent: n,
83
+ agent: a,
84
84
  permission: r,
85
- userEmail: a,
85
+ userEmail: n,
86
86
  userJwt: u,
87
87
  debug: f
88
88
  } : null;
89
89
  }
90
- function oe(e) {
90
+ function re(e) {
91
91
  const t = c(e);
92
92
  if (!t) throw new Error('createAgo(): could not detect AGO configuration. Set window.AGO, add <meta name="ago-base-url">, or pass { baseUrl } explicitly.');
93
93
  return new d(t);
94
94
  }
95
- function re(e, t) {
95
+ function ae(e, t) {
96
96
  return {
97
97
  ...e,
98
98
  handler: t
@@ -106,37 +106,38 @@ export {
106
106
  A as AgoNetworkError,
107
107
  y as AgoStreamError,
108
108
  w as ClientContextRegistry,
109
- b as EventEmitter,
110
- S as FunctionRegistry,
109
+ S as EventEmitter,
110
+ b as FunctionRegistry,
111
111
  v as SSEHandler,
112
112
  c as autoDetectConfig,
113
- K as copyToClipboard,
114
- oe as createAgo,
115
- G as createConversationSession,
116
- I as createFormCollector,
117
- te as createMessageStream,
118
- q as createMockClient,
119
- T as createStore,
120
- V as defineFunction,
121
- $ as getLocalStorage,
122
- J as getUserLocation,
123
- L as highlightElement,
113
+ Q as copyToClipboard,
114
+ re as createAgo,
115
+ O as createConversationSession,
116
+ U as createFormCollector,
117
+ oe as createMessageStream,
118
+ x as createMockClient,
119
+ I as createStore,
120
+ W as defineFunction,
121
+ T as deriveFormStatus,
122
+ z as getLocalStorage,
123
+ R as getUserLocation,
124
+ N as highlightElement,
124
125
  C as isStreamNetworkError,
125
126
  k as logger,
126
- ee as onFunctionInvoke,
127
- W as onMessage,
128
- X as onMessageChunk,
129
- Z as onMessageError,
130
- Y as onMessageStart,
131
- _ as onToolCall,
132
- B as openUrl,
133
- z as scrollToElement,
134
- N as setLocalStorage,
135
- R as setTheme,
136
- Q as showConfirmDialog,
137
- D as showNotification,
138
- H as showToast,
139
- P as submitForm,
140
- j as trackEvent,
141
- re as withHandler
127
+ te as onFunctionInvoke,
128
+ X as onMessage,
129
+ Y as onMessageChunk,
130
+ _ as onMessageError,
131
+ Z as onMessageStart,
132
+ ee as onToolCall,
133
+ P as openUrl,
134
+ K as scrollToElement,
135
+ D as setLocalStorage,
136
+ j as setTheme,
137
+ V as showConfirmDialog,
138
+ H as showNotification,
139
+ J as showToast,
140
+ $ as submitForm,
141
+ B as trackEvent,
142
+ ae as withHandler
142
143
  };