@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/{createConversationSession-DtaeA418.cjs → createConversationSession-0F_OXdQB.cjs} +1 -1
- package/dist/{createConversationSession-D9FesBQS.js → createConversationSession-DbuVzvoX.js} +1 -1
- package/dist/createFormCollector-BMTdfhHg.cjs +1 -0
- package/dist/createFormCollector-Cujr7hW4.js +244 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +64 -7
- package/dist/index.d.ts +64 -7
- package/dist/index.js +59 -58
- package/dist/react.cjs +13 -13
- package/dist/react.d.cts +69 -9
- package/dist/react.d.ts +69 -9
- package/dist/react.js +1031 -1025
- package/dist/widget.cjs +1 -1
- package/dist/widget.d.cts +47 -5
- package/dist/widget.d.ts +47 -5
- package/dist/widget.js +44 -42
- package/package.json +1 -1
- package/dist/createFormCollector-BwvkKi48.js +0 -211
- package/dist/createFormCollector-Wb8Rr-U2.cjs +0 -1
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
|
|
2
|
-
import { n as T,
|
|
3
|
-
import { t as
|
|
4
|
-
import { t as
|
|
5
|
-
import { a as
|
|
6
|
-
function
|
|
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
|
|
9
|
+
function X(e, t) {
|
|
10
10
|
return e.on("message:complete", t), () => e.off("message:complete", t);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function Y(e, t) {
|
|
13
13
|
return e.on("message:chunk", t), () => e.off("message:chunk", t);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function Z(e, t) {
|
|
16
16
|
return e.on("message:start", t), () => e.off("message:start", t);
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function _(e, t) {
|
|
19
19
|
return e.on("message:error", t), () => e.off("message:error", t);
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function ee(e, t) {
|
|
22
22
|
return e.on("toolCall:received", t), () => e.off("toolCall:received", t);
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function te(e, t) {
|
|
25
25
|
return e.on("function:invoke", t), () => e.off("function:invoke", t);
|
|
26
26
|
}
|
|
27
|
-
async function*
|
|
28
|
-
const
|
|
29
|
-
let r = null,
|
|
27
|
+
async function* oe(e, t, g) {
|
|
28
|
+
const a = [];
|
|
29
|
+
let r = null, n = !1;
|
|
30
30
|
const u = (s) => {
|
|
31
|
-
|
|
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
|
-
}),
|
|
42
|
+
}), n = !0, r?.();
|
|
43
43
|
}, m = (s) => {
|
|
44
44
|
u({
|
|
45
45
|
type: "error",
|
|
46
46
|
data: s
|
|
47
|
-
}),
|
|
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
|
-
|
|
53
|
+
n = !0, r?.();
|
|
54
54
|
});
|
|
55
55
|
try {
|
|
56
|
-
for (; !
|
|
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,
|
|
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,
|
|
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"),
|
|
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,
|
|
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,
|
|
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:
|
|
83
|
+
agent: a,
|
|
84
84
|
permission: r,
|
|
85
|
-
userEmail:
|
|
85
|
+
userEmail: n,
|
|
86
86
|
userJwt: u,
|
|
87
87
|
debug: f
|
|
88
88
|
} : null;
|
|
89
89
|
}
|
|
90
|
-
function
|
|
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
|
|
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
|
-
|
|
110
|
-
|
|
109
|
+
S as EventEmitter,
|
|
110
|
+
b as FunctionRegistry,
|
|
111
111
|
v as SSEHandler,
|
|
112
112
|
c as autoDetectConfig,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
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
|
};
|