@useago/sdk 0.3.2 → 0.3.3
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/AgoClient-DF7M2WAz.js +575 -0
- package/dist/AgoClient-bjN-z2ZQ.cjs +6 -0
- package/dist/angular.cjs +1 -143
- package/dist/angular.d.cts +530 -0
- package/dist/angular.d.ts +530 -2
- package/dist/angular.js +71 -139
- package/dist/createMockClient-D6uVh-B9.js +254 -0
- package/dist/createMockClient-DecMEUcK.cjs +1 -0
- package/dist/devtools.cjs +4 -78
- package/dist/devtools.d.cts +443 -0
- package/dist/devtools.d.ts +443 -2
- package/dist/devtools.js +46 -71
- package/dist/functions-Bz-1Bs3I.cjs +1 -0
- package/dist/functions-DdROP6Ui.js +312 -0
- package/dist/helpers.cjs +1 -15
- package/dist/{helpers/functions.d.ts → helpers.d.cts} +121 -62
- package/dist/helpers.d.ts +121 -2
- package/dist/helpers.js +16 -2
- package/dist/index.cjs +1 -347
- package/dist/index.d.cts +1150 -0
- package/dist/index.d.ts +1150 -20
- package/dist/index.js +128 -298
- package/dist/react.cjs +31 -22438
- package/dist/react.d.cts +960 -0
- package/dist/react.d.ts +960 -2
- package/dist/react.js +8401 -22376
- package/dist/rolldown-runtime-CaekUdDJ.cjs +1 -0
- package/dist/rolldown-runtime-DxmricAu.js +25 -0
- package/dist/vue.cjs +1 -336
- package/dist/vue.d.cts +1063 -0
- package/dist/vue.d.ts +1063 -2
- package/dist/vue.js +174 -316
- package/dist/{widget/types.d.ts → widget.d.cts} +41 -43
- package/dist/widget.d.ts +41 -2
- package/package.json +35 -24
- package/dist/AgoClient-DPZdN5n2.js +0 -905
- package/dist/AgoClient-DPZdN5n2.js.map +0 -1
- package/dist/AgoClient-wMVUQqCD.cjs +0 -976
- package/dist/AgoClient-wMVUQqCD.cjs.map +0 -1
- package/dist/angular/ago.service.d.ts +0 -98
- package/dist/angular/index.d.ts +0 -4
- package/dist/angular/provide.d.ts +0 -27
- package/dist/angular.cjs.map +0 -1
- package/dist/angular.js.map +0 -1
- package/dist/api/HttpClient.d.ts +0 -31
- package/dist/api/index.d.ts +0 -1
- package/dist/auto/createAgo.d.ts +0 -39
- package/dist/auto/index.d.ts +0 -1
- package/dist/client/AgoClient.d.ts +0 -169
- package/dist/client/errors.d.ts +0 -48
- package/dist/client/index.d.ts +0 -3
- package/dist/client/types.d.ts +0 -205
- package/dist/createMockClient-Ci_N2tH8.cjs +0 -104
- package/dist/createMockClient-Ci_N2tH8.cjs.map +0 -1
- package/dist/createMockClient-U0ae_AYy.js +0 -99
- package/dist/createMockClient-U0ae_AYy.js.map +0 -1
- package/dist/devtools/index.d.ts +0 -2
- package/dist/devtools/initDevPanel.d.ts +0 -15
- package/dist/devtools.cjs.map +0 -1
- package/dist/devtools.js.map +0 -1
- package/dist/functions/FunctionRegistry.d.ts +0 -41
- package/dist/functions/defineFunction.d.ts +0 -22
- package/dist/functions/index.d.ts +0 -2
- package/dist/functions/types.d.ts +0 -50
- package/dist/functions--c6lx3ic.cjs +0 -480
- package/dist/functions--c6lx3ic.cjs.map +0 -1
- package/dist/functions-C9F1dnmh.js +0 -398
- package/dist/functions-C9F1dnmh.js.map +0 -1
- package/dist/helpers/factory.d.ts +0 -20
- package/dist/helpers/index.d.ts +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/react/components/ChatInput.d.ts +0 -12
- package/dist/react/components/ChatWidget.d.ts +0 -35
- package/dist/react/components/Markdown.d.ts +0 -12
- package/dist/react/components/Message.d.ts +0 -9
- package/dist/react/components/index.d.ts +0 -8
- package/dist/react/context/AgoContext.d.ts +0 -62
- package/dist/react/context/index.d.ts +0 -2
- package/dist/react/hooks/index.d.ts +0 -7
- package/dist/react/hooks/useAgo.d.ts +0 -14
- package/dist/react/hooks/useAgoContext.d.ts +0 -40
- package/dist/react/hooks/useAgoFunction.d.ts +0 -58
- package/dist/react/hooks/useAgoStore.d.ts +0 -17
- package/dist/react/hooks/useChat.d.ts +0 -45
- package/dist/react/hooks/useConversation.d.ts +0 -28
- package/dist/react/hooks/useMessages.d.ts +0 -26
- package/dist/react/index.d.ts +0 -24
- package/dist/react/testing.d.ts +0 -2
- package/dist/react.cjs.map +0 -1
- package/dist/react.js.map +0 -1
- package/dist/rolldown-runtime-BqCkTl7Q.cjs +0 -50
- package/dist/rolldown-runtime-CNZpIYwj.js +0 -33
- package/dist/state/ClientContextRegistry.d.ts +0 -64
- package/dist/state/createStore.d.ts +0 -30
- package/dist/streaming/SSEHandler.d.ts +0 -46
- package/dist/streaming/helpers.d.ts +0 -67
- package/dist/streaming/index.d.ts +0 -2
- package/dist/testing/createMockClient.d.ts +0 -42
- package/dist/testing/index.d.ts +0 -2
- package/dist/utils/eventEmitter.d.ts +0 -23
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/logger.d.ts +0 -14
- package/dist/vue/composables/useAgo.d.ts +0 -17
- package/dist/vue/composables/useAgoEvents.d.ts +0 -11
- package/dist/vue/composables/useAgoFunction.d.ts +0 -34
- package/dist/vue/composables/useAgoStore.d.ts +0 -18
- package/dist/vue/composables/useChat.d.ts +0 -251
- package/dist/vue/composables/useConversation.d.ts +0 -178
- package/dist/vue/composables/useMessages.d.ts +0 -89
- package/dist/vue/index.d.ts +0 -11
- package/dist/vue/plugin.d.ts +0 -16
- package/dist/vue/symbols.d.ts +0 -3
- package/dist/vue.cjs.map +0 -1
- package/dist/vue.js.map +0 -1
- package/dist/widget/index.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -1,309 +1,139 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { t as
|
|
3
|
-
import { a as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const storage = persist ? persist.storage ?? (typeof localStorage !== "undefined" ? localStorage : void 0) : void 0;
|
|
7
|
-
let state = initial;
|
|
8
|
-
if (persist && storage) try {
|
|
9
|
-
const raw = storage.getItem(persist.key);
|
|
10
|
-
if (raw != null) state = JSON.parse(raw);
|
|
11
|
-
} catch {}
|
|
12
|
-
const subscribers = /* @__PURE__ */ new Set();
|
|
13
|
-
const notify = () => subscribers.forEach((fn) => fn(state));
|
|
14
|
-
function persistState() {
|
|
15
|
-
if (persist && storage) try {
|
|
16
|
-
storage.setItem(persist.key, JSON.stringify(state));
|
|
17
|
-
} catch {}
|
|
18
|
-
}
|
|
19
|
-
return {
|
|
20
|
-
get: () => state,
|
|
21
|
-
set: (next) => {
|
|
22
|
-
state = next;
|
|
23
|
-
persistState();
|
|
24
|
-
notify();
|
|
25
|
-
},
|
|
26
|
-
subscribe: (fn) => {
|
|
27
|
-
subscribers.add(fn);
|
|
28
|
-
return () => {
|
|
29
|
-
subscribers.delete(fn);
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
};
|
|
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-DF7M2WAz.js";
|
|
2
|
+
import { n as T, r as I, t as U } from "./createMockClient-D6uVh-B9.js";
|
|
3
|
+
import { a as O, c as q, d as x, f as L, i as N, l as D, m as H, o as J, p as R, r as j, s as B, t as P, u as $ } from "./functions-DdROP6Ui.js";
|
|
4
|
+
function z(e) {
|
|
5
|
+
return e;
|
|
33
6
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Create a reusable function definition.
|
|
38
|
-
* Returns the same object — this is an identity function for discoverability and type-checking.
|
|
39
|
-
*
|
|
40
|
-
* ```ts
|
|
41
|
-
* // Define once, reuse anywhere
|
|
42
|
-
* export const lookupOrder = defineFunction({
|
|
43
|
-
* name: "lookupOrder",
|
|
44
|
-
* description: "Look up an order by ID",
|
|
45
|
-
* parameters: { type: "object", properties: { id: { type: "string" } }, required: ["id"] },
|
|
46
|
-
* handler: async (args) => fetchOrder(args.id as string),
|
|
47
|
-
* });
|
|
48
|
-
*
|
|
49
|
-
* // Register with client
|
|
50
|
-
* client.registerFunction(lookupOrder);
|
|
51
|
-
*
|
|
52
|
-
* // Or use in React
|
|
53
|
-
* useAgoFunction(lookupOrder.name, lookupOrder);
|
|
54
|
-
* ```
|
|
55
|
-
*/
|
|
56
|
-
function defineFunction(definition) {
|
|
57
|
-
return definition;
|
|
7
|
+
function K(e, t) {
|
|
8
|
+
return e.on("message:complete", t), () => e.off("message:complete", t);
|
|
58
9
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Subscribe to complete messages with a simple callback. Returns an unsubscribe function.
|
|
63
|
-
*
|
|
64
|
-
* ```ts
|
|
65
|
-
* const unsub = onMessage(client, (msg) => console.log(msg.content));
|
|
66
|
-
* // later: unsub();
|
|
67
|
-
* ```
|
|
68
|
-
*/
|
|
69
|
-
function onMessage(client, callback) {
|
|
70
|
-
client.on("message:complete", callback);
|
|
71
|
-
return () => client.off("message:complete", callback);
|
|
10
|
+
function Q(e, t) {
|
|
11
|
+
return e.on("message:chunk", t), () => e.off("message:chunk", t);
|
|
72
12
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
*
|
|
76
|
-
* ```ts
|
|
77
|
-
* onMessageChunk(client, ({ content }) => {
|
|
78
|
-
* outputEl.textContent += content;
|
|
79
|
-
* });
|
|
80
|
-
* ```
|
|
81
|
-
*/
|
|
82
|
-
function onMessageChunk(client, callback) {
|
|
83
|
-
client.on("message:chunk", callback);
|
|
84
|
-
return () => client.off("message:chunk", callback);
|
|
13
|
+
function V(e, t) {
|
|
14
|
+
return e.on("message:start", t), () => e.off("message:start", t);
|
|
85
15
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
*/
|
|
89
|
-
function onMessageStart(client, callback) {
|
|
90
|
-
client.on("message:start", callback);
|
|
91
|
-
return () => client.off("message:start", callback);
|
|
16
|
+
function W(e, t) {
|
|
17
|
+
return e.on("message:error", t), () => e.off("message:error", t);
|
|
92
18
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
*/
|
|
96
|
-
function onMessageError(client, callback) {
|
|
97
|
-
client.on("message:error", callback);
|
|
98
|
-
return () => client.off("message:error", callback);
|
|
19
|
+
function X(e, t) {
|
|
20
|
+
return e.on("toolCall:received", t), () => e.off("toolCall:received", t);
|
|
99
21
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
*/
|
|
103
|
-
function onToolCall(client, callback) {
|
|
104
|
-
client.on("toolCall:received", callback);
|
|
105
|
-
return () => client.off("toolCall:received", callback);
|
|
22
|
+
function Y(e, t) {
|
|
23
|
+
return e.on("function:invoke", t), () => e.off("function:invoke", t);
|
|
106
24
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
25
|
+
async function* Z(e, t, g) {
|
|
26
|
+
const n = [];
|
|
27
|
+
let r = null, a = !1;
|
|
28
|
+
const u = (s) => {
|
|
29
|
+
n.push(s), r?.();
|
|
30
|
+
}, f = (s) => u({
|
|
31
|
+
type: "start",
|
|
32
|
+
data: s
|
|
33
|
+
}), o = (s) => u({
|
|
34
|
+
type: "chunk",
|
|
35
|
+
data: s
|
|
36
|
+
}), i = (s) => {
|
|
37
|
+
u({
|
|
38
|
+
type: "complete",
|
|
39
|
+
data: s
|
|
40
|
+
}), a = !0, r?.();
|
|
41
|
+
}, l = (s) => {
|
|
42
|
+
u({
|
|
43
|
+
type: "error",
|
|
44
|
+
data: s
|
|
45
|
+
}), a = !0, r?.();
|
|
46
|
+
}, m = (s) => u({
|
|
47
|
+
type: "toolCall",
|
|
48
|
+
data: s
|
|
49
|
+
});
|
|
50
|
+
e.on("message:start", f), e.on("message:chunk", o), e.on("message:complete", i), e.on("message:error", l), e.on("toolCall:received", m), e.sendMessage(t, g).catch(() => {
|
|
51
|
+
a = !0, r?.();
|
|
52
|
+
});
|
|
53
|
+
try {
|
|
54
|
+
for (; !a || n.length > 0; ) n.length > 0 ? yield n.shift() : (await new Promise((s) => {
|
|
55
|
+
r = s;
|
|
56
|
+
}), r = null);
|
|
57
|
+
} finally {
|
|
58
|
+
e.off("message:start", f), e.off("message:chunk", o), e.off("message:complete", i), e.off("message:error", l), e.off("toolCall:received", m);
|
|
59
|
+
}
|
|
113
60
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
const onComplete = (data) => {
|
|
141
|
-
push({
|
|
142
|
-
type: "complete",
|
|
143
|
-
data
|
|
144
|
-
});
|
|
145
|
-
done = true;
|
|
146
|
-
resolve?.();
|
|
147
|
-
};
|
|
148
|
-
const onError = (data) => {
|
|
149
|
-
push({
|
|
150
|
-
type: "error",
|
|
151
|
-
data
|
|
152
|
-
});
|
|
153
|
-
done = true;
|
|
154
|
-
resolve?.();
|
|
155
|
-
};
|
|
156
|
-
const onTool = (data) => push({
|
|
157
|
-
type: "toolCall",
|
|
158
|
-
data
|
|
159
|
-
});
|
|
160
|
-
client.on("message:start", onStart);
|
|
161
|
-
client.on("message:chunk", onChunk);
|
|
162
|
-
client.on("message:complete", onComplete);
|
|
163
|
-
client.on("message:error", onError);
|
|
164
|
-
client.on("toolCall:received", onTool);
|
|
165
|
-
client.sendMessage(content, options).catch(() => {
|
|
166
|
-
done = true;
|
|
167
|
-
resolve?.();
|
|
168
|
-
});
|
|
169
|
-
try {
|
|
170
|
-
while (!done || queue.length > 0) if (queue.length > 0) yield queue.shift();
|
|
171
|
-
else {
|
|
172
|
-
await new Promise((r) => {
|
|
173
|
-
resolve = r;
|
|
174
|
-
});
|
|
175
|
-
resolve = null;
|
|
176
|
-
}
|
|
177
|
-
} finally {
|
|
178
|
-
client.off("message:start", onStart);
|
|
179
|
-
client.off("message:chunk", onChunk);
|
|
180
|
-
client.off("message:complete", onComplete);
|
|
181
|
-
client.off("message:error", onError);
|
|
182
|
-
client.off("toolCall:received", onTool);
|
|
183
|
-
}
|
|
61
|
+
function c(e) {
|
|
62
|
+
let t, g, n, r, a, u;
|
|
63
|
+
if (typeof window < "u" && window.AGO) {
|
|
64
|
+
const o = window.AGO;
|
|
65
|
+
t = o.basepath, g = o.widgetId, n = o.agent || o.defaultAgent, r = o.permission, a = o.email, u = o.jwt;
|
|
66
|
+
}
|
|
67
|
+
if (typeof document < "u") {
|
|
68
|
+
const o = (i) => document.querySelector(`meta[name="${i}"]`)?.getAttribute("content") || void 0;
|
|
69
|
+
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");
|
|
70
|
+
}
|
|
71
|
+
if (typeof document < "u") {
|
|
72
|
+
const o = [document.body, ...Array.from(document.querySelectorAll("script[data-ago-base-url]"))].filter(Boolean);
|
|
73
|
+
for (const i of o)
|
|
74
|
+
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);
|
|
75
|
+
}
|
|
76
|
+
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;
|
|
77
|
+
const f = e?.debug;
|
|
78
|
+
return t ? {
|
|
79
|
+
baseUrl: t,
|
|
80
|
+
widgetId: g,
|
|
81
|
+
agent: n,
|
|
82
|
+
permission: r,
|
|
83
|
+
userEmail: a,
|
|
84
|
+
userJwt: u,
|
|
85
|
+
debug: f
|
|
86
|
+
} : null;
|
|
184
87
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
*
|
|
190
|
-
* Checks (in order of priority):
|
|
191
|
-
* 1. `window.AGO` global object (widget config)
|
|
192
|
-
* 2. `<meta>` tags: `<meta name="ago-api-key" content="...">`
|
|
193
|
-
* 3. `data-ago-*` attributes on `<body>` or `<script data-ago-api-key="...">`
|
|
194
|
-
* 4. Explicit overrides passed as argument
|
|
195
|
-
*
|
|
196
|
-
* Returns null if no API key can be found.
|
|
197
|
-
*/
|
|
198
|
-
function autoDetectConfig(overrides) {
|
|
199
|
-
let baseUrl;
|
|
200
|
-
let widgetId;
|
|
201
|
-
let agent;
|
|
202
|
-
let permission;
|
|
203
|
-
let userEmail;
|
|
204
|
-
let userJwt;
|
|
205
|
-
if (typeof window !== "undefined" && window.AGO) {
|
|
206
|
-
const ago = window.AGO;
|
|
207
|
-
baseUrl = ago.basepath;
|
|
208
|
-
widgetId = ago.widgetId;
|
|
209
|
-
agent = ago.agent || ago.defaultAgent;
|
|
210
|
-
permission = ago.permission;
|
|
211
|
-
userEmail = ago.email;
|
|
212
|
-
userJwt = ago.jwt;
|
|
213
|
-
}
|
|
214
|
-
if (typeof document !== "undefined") {
|
|
215
|
-
const getMeta = (name) => document.querySelector(`meta[name="${name}"]`)?.getAttribute("content") || void 0;
|
|
216
|
-
baseUrl = baseUrl || getMeta("ago-base-url");
|
|
217
|
-
widgetId = widgetId || getMeta("ago-widget-id");
|
|
218
|
-
agent = agent || getMeta("ago-agent") || getMeta("ago-agent-id");
|
|
219
|
-
permission = permission || getMeta("ago-permission");
|
|
220
|
-
userEmail = userEmail || getMeta("ago-user-email");
|
|
221
|
-
}
|
|
222
|
-
if (typeof document !== "undefined") {
|
|
223
|
-
const sources = [document.body, ...Array.from(document.querySelectorAll("script[data-ago-base-url]"))].filter(Boolean);
|
|
224
|
-
for (const el of sources) {
|
|
225
|
-
if (!el) continue;
|
|
226
|
-
baseUrl = baseUrl || el.getAttribute("data-ago-base-url") || void 0;
|
|
227
|
-
widgetId = widgetId || el.getAttribute("data-ago-widget-id") || void 0;
|
|
228
|
-
agent = agent || el.getAttribute("data-ago-agent") || el.getAttribute("data-ago-agent-id") || void 0;
|
|
229
|
-
permission = permission || el.getAttribute("data-ago-permission") || void 0;
|
|
230
|
-
userEmail = userEmail || el.getAttribute("data-ago-user-email") || void 0;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
baseUrl = overrides?.baseUrl || baseUrl;
|
|
234
|
-
widgetId = overrides?.widgetId || widgetId;
|
|
235
|
-
agent = overrides?.agent || overrides?.defaultAgentId || agent;
|
|
236
|
-
permission = overrides?.permission || permission;
|
|
237
|
-
userEmail = overrides?.userEmail || userEmail;
|
|
238
|
-
userJwt = overrides?.userJwt || userJwt;
|
|
239
|
-
const debug = overrides?.debug;
|
|
240
|
-
if (!baseUrl) return null;
|
|
241
|
-
return {
|
|
242
|
-
baseUrl,
|
|
243
|
-
widgetId,
|
|
244
|
-
agent,
|
|
245
|
-
permission,
|
|
246
|
-
userEmail,
|
|
247
|
-
userJwt,
|
|
248
|
-
debug
|
|
249
|
-
};
|
|
88
|
+
function _(e) {
|
|
89
|
+
const t = c(e);
|
|
90
|
+
if (!t) throw new Error('createAgo(): could not detect AGO configuration. Set window.AGO, add <meta name="ago-base-url">, or pass { baseUrl } explicitly.');
|
|
91
|
+
return new d(t);
|
|
250
92
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
* <!-- In your HTML -->
|
|
257
|
-
* <meta name="ago-base-url" content="https://YOUR-DOMAIN.useago.com">
|
|
258
|
-
*
|
|
259
|
-
* <!-- Or on a script tag -->
|
|
260
|
-
* <script src="app.js" data-ago-base-url="https://YOUR-DOMAIN.useago.com"><\/script>
|
|
261
|
-
* ```
|
|
262
|
-
*
|
|
263
|
-
* ```ts
|
|
264
|
-
* import { createAgo } from "@useago/sdk";
|
|
265
|
-
*
|
|
266
|
-
* // Zero config — picks up from DOM
|
|
267
|
-
* const client = createAgo();
|
|
268
|
-
*
|
|
269
|
-
* // Or with partial overrides
|
|
270
|
-
* const client = createAgo({ debug: true });
|
|
271
|
-
* ```
|
|
272
|
-
*
|
|
273
|
-
* Throws if no base URL can be detected.
|
|
274
|
-
*/
|
|
275
|
-
function createAgo(overrides) {
|
|
276
|
-
const config = autoDetectConfig(overrides);
|
|
277
|
-
if (!config) throw new Error("createAgo(): could not detect AGO configuration. Set window.AGO, add <meta name=\"ago-base-url\">, or pass { baseUrl } explicitly.");
|
|
278
|
-
return new AgoClient(config);
|
|
93
|
+
function ee(e, t) {
|
|
94
|
+
return {
|
|
95
|
+
...e,
|
|
96
|
+
handler: t
|
|
97
|
+
};
|
|
279
98
|
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
99
|
+
export {
|
|
100
|
+
h as AgoApiError,
|
|
101
|
+
d as AgoClient,
|
|
102
|
+
E as AgoError,
|
|
103
|
+
M as AgoFunctionError,
|
|
104
|
+
A as AgoNetworkError,
|
|
105
|
+
y as AgoStreamError,
|
|
106
|
+
w as ClientContextRegistry,
|
|
107
|
+
b as EventEmitter,
|
|
108
|
+
S as FunctionRegistry,
|
|
109
|
+
v as SSEHandler,
|
|
110
|
+
c as autoDetectConfig,
|
|
111
|
+
P as copyToClipboard,
|
|
112
|
+
_ as createAgo,
|
|
113
|
+
T as createFormCollector,
|
|
114
|
+
Z as createMessageStream,
|
|
115
|
+
U as createMockClient,
|
|
116
|
+
I as createStore,
|
|
117
|
+
z as defineFunction,
|
|
118
|
+
j as getLocalStorage,
|
|
119
|
+
N as getUserLocation,
|
|
120
|
+
O as highlightElement,
|
|
121
|
+
C as isStreamNetworkError,
|
|
122
|
+
k as logger,
|
|
123
|
+
Y as onFunctionInvoke,
|
|
124
|
+
K as onMessage,
|
|
125
|
+
Q as onMessageChunk,
|
|
126
|
+
W as onMessageError,
|
|
127
|
+
V as onMessageStart,
|
|
128
|
+
X as onToolCall,
|
|
129
|
+
J as openUrl,
|
|
130
|
+
B as scrollToElement,
|
|
131
|
+
q as setLocalStorage,
|
|
132
|
+
D as setTheme,
|
|
133
|
+
$ as showConfirmDialog,
|
|
134
|
+
x as showNotification,
|
|
135
|
+
L as showToast,
|
|
136
|
+
R as submitForm,
|
|
137
|
+
H as trackEvent,
|
|
138
|
+
ee as withHandler
|
|
139
|
+
};
|