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