@useago/sdk 1.12.0 → 1.13.1
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 +111 -4
- package/README.md +73 -0
- package/dist/angular.cjs +1 -1
- package/dist/angular.d.cts +140 -38
- package/dist/angular.d.ts +140 -38
- package/dist/angular.js +7 -4
- package/dist/autoContinue-C3UsCvT5.cjs +1 -0
- package/dist/{autoContinue-CC8K9mBU.js → autoContinue-Cb4_iEbO.js} +1 -1
- package/dist/{createConversationSession-B1Qn-y0I.js → createConversationSession-D0vks-8C.js} +1 -1
- package/dist/{createConversationSession-B3v_xOU7.cjs → createConversationSession-Ri3EKIJU.cjs} +1 -1
- package/dist/{createFormCollector-m79zk_NA.js → createFormCollector-BMN-blXs.js} +1 -1
- package/dist/{createFormCollector-FvwDOqnV.cjs → createFormCollector-BNCMIUw2.cjs} +1 -1
- package/dist/createMockClient-BPt1gSve.cjs +1 -0
- package/dist/{createMockClient-Beao82tu.js → createMockClient-YoYr3pQr.js} +1 -0
- package/dist/devtools.cjs +4 -4
- package/dist/devtools.d.cts +129 -33
- package/dist/devtools.d.ts +129 -33
- package/dist/devtools.js +87 -84
- package/dist/helpers.d.cts +42 -12
- package/dist/helpers.d.ts +42 -12
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +135 -40
- package/dist/index.d.ts +135 -40
- package/dist/index.js +44 -43
- package/dist/react.cjs +4 -4
- package/dist/react.d.cts +187 -34
- package/dist/react.d.ts +187 -34
- package/dist/react.js +822 -729
- package/dist/speechToText-BV7qxqPF.js +704 -0
- package/dist/speechToText-ZciRyyJE.cjs +1 -0
- package/dist/testing.cjs +1 -1
- package/dist/testing.d.cts +129 -33
- package/dist/testing.d.ts +129 -33
- package/dist/testing.js +1 -1
- package/dist/types-Ck3iZG0K.cjs +10 -0
- package/dist/{types-Ct1hlKwg.js → types-fX-VoHfa.js} +1042 -759
- package/dist/vue.cjs +1 -1
- package/dist/vue.d.cts +143 -35
- package/dist/vue.d.ts +143 -35
- package/dist/vue.js +133 -131
- package/dist/widget.cjs +6 -6
- package/dist/widget.d.cts +161 -33
- package/dist/widget.d.ts +161 -33
- package/dist/widget.js +1702 -1757
- package/llms-full.txt +166 -1
- package/package.json +1 -1
- package/dist/autoContinue-CP9pJR-V.cjs +0 -1
- package/dist/createMockClient-BEOXI8yW.cjs +0 -1
- package/dist/sheetController-BThJRtOu.cjs +0 -1
- package/dist/sheetController-aEKXIvjk.js +0 -343
- package/dist/types-mcW8vB1U.cjs +0 -10
package/dist/vue.js
CHANGED
|
@@ -1,276 +1,278 @@
|
|
|
1
|
-
import { n as
|
|
1
|
+
import { n as I, t as x } from "./types-fX-VoHfa.js";
|
|
2
2
|
import { computed as L, inject as M, onMounted as p, onScopeDispose as R, onUnmounted as C, ref as d, shallowRef as F } from "vue";
|
|
3
|
-
var N = /* @__PURE__ */ Symbol("ago-client"),
|
|
4
|
-
const
|
|
5
|
-
t.provide(N,
|
|
3
|
+
var N = /* @__PURE__ */ Symbol("ago-client"), _ = { install(t, e) {
|
|
4
|
+
const n = new I(e);
|
|
5
|
+
t.provide(N, n);
|
|
6
6
|
} };
|
|
7
7
|
function m(t) {
|
|
8
|
-
if (t) return new
|
|
9
|
-
const
|
|
10
|
-
if (!
|
|
11
|
-
return
|
|
8
|
+
if (t) return new I(t);
|
|
9
|
+
const e = M(N);
|
|
10
|
+
if (!e) throw new Error("useAgo(): no AgoClient found. Either pass config or install AgoPlugin.");
|
|
11
|
+
return e;
|
|
12
12
|
}
|
|
13
13
|
function k(t = {}) {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
}, g = (
|
|
17
|
-
const u =
|
|
18
|
-
u >= 0 && (
|
|
19
|
-
...
|
|
20
|
-
content:
|
|
14
|
+
const e = t.client ?? m(), n = d([]), s = d(t.conversationId), o = d(!1), i = d(null), c = (a) => {
|
|
15
|
+
s.value || (s.value = a.conversationId);
|
|
16
|
+
}, g = (a) => {
|
|
17
|
+
const u = n.value.findIndex((v) => v.id === a.messageId);
|
|
18
|
+
u >= 0 && (n.value[u] = {
|
|
19
|
+
...n.value[u],
|
|
20
|
+
content: n.value[u].content + a.content
|
|
21
21
|
});
|
|
22
|
-
},
|
|
23
|
-
const u =
|
|
24
|
-
u >= 0 ?
|
|
25
|
-
},
|
|
26
|
-
i.value = new Error(
|
|
22
|
+
}, w = (a) => {
|
|
23
|
+
const u = n.value.findIndex((v) => v.id === a.id);
|
|
24
|
+
u >= 0 ? n.value[u] = a : n.value.push(a), o.value = !1;
|
|
25
|
+
}, h = (a) => {
|
|
26
|
+
i.value = new Error(a.error), o.value = !1;
|
|
27
27
|
}, r = () => {
|
|
28
|
-
let
|
|
29
|
-
for (let u =
|
|
30
|
-
const v =
|
|
28
|
+
let a = -1;
|
|
29
|
+
for (let u = n.value.length - 1; u >= 0; u--) {
|
|
30
|
+
const v = n.value[u];
|
|
31
31
|
if (v.role === "assistant" && (v.status === "IN_PROGRESS" || v.status === "WAITING_CLIENT")) {
|
|
32
|
-
|
|
32
|
+
a = u;
|
|
33
33
|
break;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
...
|
|
36
|
+
a >= 0 && (n.value[a].content ? n.value[a] = {
|
|
37
|
+
...n.value[a],
|
|
38
38
|
status: "CANCELED"
|
|
39
|
-
} :
|
|
39
|
+
} : n.value.splice(a, 1)), o.value = !1;
|
|
40
40
|
};
|
|
41
41
|
p(() => {
|
|
42
|
-
|
|
42
|
+
e.on("message:start", c), e.on("message:chunk", g), e.on("message:complete", w), e.on("message:error", h), e.on("message:stopped", r);
|
|
43
43
|
}), C(() => {
|
|
44
|
-
|
|
44
|
+
e.off("message:start", c), e.off("message:chunk", g), e.off("message:complete", w), e.off("message:error", h), e.off("message:stopped", r);
|
|
45
45
|
});
|
|
46
|
-
async function l(
|
|
46
|
+
async function l(a, u) {
|
|
47
47
|
o.value = !0, i.value = null;
|
|
48
48
|
const v = {
|
|
49
49
|
id: `temp-${Date.now()}`,
|
|
50
|
-
conversationId:
|
|
51
|
-
content:
|
|
50
|
+
conversationId: s.value || "",
|
|
51
|
+
content: a,
|
|
52
52
|
role: "user",
|
|
53
53
|
status: "DONE",
|
|
54
54
|
createdAt: /* @__PURE__ */ new Date()
|
|
55
55
|
}, S = {
|
|
56
56
|
id: `temp-assistant-${Date.now()}`,
|
|
57
|
-
conversationId:
|
|
57
|
+
conversationId: s.value || "",
|
|
58
58
|
content: "",
|
|
59
59
|
role: "assistant",
|
|
60
60
|
status: "IN_PROGRESS",
|
|
61
61
|
createdAt: /* @__PURE__ */ new Date()
|
|
62
62
|
};
|
|
63
|
-
|
|
63
|
+
n.value.push(v, S);
|
|
64
64
|
try {
|
|
65
|
-
const f = await
|
|
66
|
-
conversationId:
|
|
65
|
+
const f = await e.sendMessage(a, {
|
|
66
|
+
conversationId: s.value,
|
|
67
67
|
files: u
|
|
68
68
|
});
|
|
69
|
-
f.conversationId && !
|
|
70
|
-
const
|
|
69
|
+
f.conversationId && !s.value && (s.value = f.conversationId), n.value = n.value.filter((A) => !A.id.startsWith("temp-"));
|
|
70
|
+
const b = {
|
|
71
71
|
...v,
|
|
72
72
|
id: v.id.replace("temp-", "user-"),
|
|
73
73
|
conversationId: f.conversationId
|
|
74
74
|
};
|
|
75
|
-
return
|
|
75
|
+
return n.value.some((A) => A.id === f.id) ? n.value.push(b) : n.value.push(b, f), f;
|
|
76
76
|
} catch (f) {
|
|
77
|
-
return i.value = f instanceof Error ? f : /* @__PURE__ */ new Error("Failed to send"), o.value = !1,
|
|
77
|
+
return i.value = f instanceof Error ? f : /* @__PURE__ */ new Error("Failed to send"), o.value = !1, n.value = n.value.filter((b) => !b.id.startsWith("temp-")), null;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
async function E() {
|
|
81
|
-
await
|
|
81
|
+
await e.stop();
|
|
82
82
|
}
|
|
83
83
|
function y() {
|
|
84
|
-
|
|
84
|
+
n.value = [], s.value = void 0, i.value = null;
|
|
85
85
|
}
|
|
86
86
|
return {
|
|
87
|
-
messages:
|
|
87
|
+
messages: n,
|
|
88
88
|
isLoading: o,
|
|
89
89
|
error: i,
|
|
90
|
-
conversationId:
|
|
90
|
+
conversationId: s,
|
|
91
91
|
sendMessage: l,
|
|
92
92
|
stop: E,
|
|
93
93
|
clearMessages: y
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
|
-
function
|
|
97
|
-
const
|
|
96
|
+
function D(t = {}) {
|
|
97
|
+
const e = t.client ?? m(), n = t.autoLoad ?? !0, s = d([]), o = d(null), i = d(!1), c = d(null);
|
|
98
98
|
async function g() {
|
|
99
99
|
i.value = !0, c.value = null;
|
|
100
100
|
try {
|
|
101
|
-
|
|
101
|
+
s.value = (await e.getConversations()).data;
|
|
102
102
|
} catch (r) {
|
|
103
103
|
c.value = r instanceof Error ? r : /* @__PURE__ */ new Error("Failed to load conversations");
|
|
104
104
|
} finally {
|
|
105
105
|
i.value = !1;
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
async function
|
|
108
|
+
async function w(r) {
|
|
109
109
|
i.value = !0, c.value = null;
|
|
110
110
|
try {
|
|
111
|
-
o.value = await
|
|
111
|
+
o.value = await e.getConversation(r);
|
|
112
112
|
} catch (l) {
|
|
113
113
|
c.value = l instanceof Error ? l : /* @__PURE__ */ new Error("Failed to load conversation");
|
|
114
114
|
} finally {
|
|
115
115
|
i.value = !1;
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function h() {
|
|
119
119
|
o.value = null;
|
|
120
120
|
}
|
|
121
121
|
return p(() => {
|
|
122
|
-
|
|
122
|
+
n && g();
|
|
123
123
|
}), {
|
|
124
|
-
conversations:
|
|
124
|
+
conversations: s,
|
|
125
125
|
currentConversation: o,
|
|
126
126
|
isLoading: i,
|
|
127
127
|
error: c,
|
|
128
|
-
selectConversation:
|
|
129
|
-
startNewConversation:
|
|
128
|
+
selectConversation: w,
|
|
129
|
+
startNewConversation: h,
|
|
130
130
|
refreshConversations: g
|
|
131
131
|
};
|
|
132
132
|
}
|
|
133
133
|
function O(t = {}) {
|
|
134
|
-
const
|
|
134
|
+
const e = k({
|
|
135
135
|
client: t.client,
|
|
136
136
|
conversationId: t.conversationId
|
|
137
|
-
}),
|
|
137
|
+
}), n = D({
|
|
138
138
|
client: t.client,
|
|
139
139
|
autoLoad: t.autoLoad
|
|
140
|
-
}),
|
|
140
|
+
}), s = L(() => e.error.value || n.error.value);
|
|
141
141
|
return {
|
|
142
|
-
messages:
|
|
143
|
-
isLoading:
|
|
144
|
-
error:
|
|
145
|
-
sendMessage:
|
|
146
|
-
stop:
|
|
147
|
-
clearMessages:
|
|
148
|
-
conversationId:
|
|
149
|
-
conversations:
|
|
150
|
-
currentConversation:
|
|
151
|
-
isConversationsLoading:
|
|
152
|
-
selectConversation:
|
|
153
|
-
startNewConversation:
|
|
154
|
-
refreshConversations:
|
|
142
|
+
messages: e.messages,
|
|
143
|
+
isLoading: e.isLoading,
|
|
144
|
+
error: s,
|
|
145
|
+
sendMessage: e.sendMessage,
|
|
146
|
+
stop: e.stop,
|
|
147
|
+
clearMessages: e.clearMessages,
|
|
148
|
+
conversationId: e.conversationId,
|
|
149
|
+
conversations: n.conversations,
|
|
150
|
+
currentConversation: n.currentConversation,
|
|
151
|
+
isConversationsLoading: n.isLoading,
|
|
152
|
+
selectConversation: n.selectConversation,
|
|
153
|
+
startNewConversation: n.startNewConversation,
|
|
154
|
+
refreshConversations: n.refreshConversations
|
|
155
155
|
};
|
|
156
156
|
}
|
|
157
157
|
function G(t = {}) {
|
|
158
|
-
const
|
|
158
|
+
const e = t.client ?? m(), n = d({}), s = d(!1), o = d(null), i = /* @__PURE__ */ new Map();
|
|
159
159
|
function c(r) {
|
|
160
160
|
const l = (i.get(r) ?? 0) + 1;
|
|
161
161
|
return i.set(r, l), l;
|
|
162
162
|
}
|
|
163
163
|
const g = (r, l) => i.get(r) === l;
|
|
164
|
-
async function
|
|
164
|
+
async function w(r, l, E) {
|
|
165
165
|
const y = c(r);
|
|
166
|
-
|
|
166
|
+
s.value = !0, o.value = null;
|
|
167
167
|
try {
|
|
168
|
-
await
|
|
169
|
-
...
|
|
168
|
+
await e.submitFeedback(r, l, E), g(r, y) && (n.value = {
|
|
169
|
+
...n.value,
|
|
170
170
|
[r]: l
|
|
171
171
|
});
|
|
172
|
-
} catch (
|
|
173
|
-
const u =
|
|
172
|
+
} catch (a) {
|
|
173
|
+
const u = a instanceof Error ? a : /* @__PURE__ */ new Error("Failed to submit feedback");
|
|
174
174
|
throw o.value = u, u;
|
|
175
175
|
} finally {
|
|
176
|
-
|
|
176
|
+
s.value = !1;
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
-
async function
|
|
179
|
+
async function h(r, l, E) {
|
|
180
180
|
const y = c(r);
|
|
181
|
-
|
|
181
|
+
s.value = !0, o.value = null;
|
|
182
182
|
try {
|
|
183
|
-
const
|
|
184
|
-
return g(r, y) && (
|
|
185
|
-
...
|
|
186
|
-
[
|
|
187
|
-
}),
|
|
188
|
-
} catch (
|
|
189
|
-
const u =
|
|
183
|
+
const a = await e.submitConversationFeedback(r, l, E);
|
|
184
|
+
return g(r, y) && (n.value = {
|
|
185
|
+
...n.value,
|
|
186
|
+
[a]: l
|
|
187
|
+
}), a;
|
|
188
|
+
} catch (a) {
|
|
189
|
+
const u = a instanceof Error ? a : /* @__PURE__ */ new Error("Failed to submit feedback");
|
|
190
190
|
throw o.value = u, u;
|
|
191
191
|
} finally {
|
|
192
|
-
|
|
192
|
+
s.value = !1;
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
return {
|
|
196
|
-
ratings:
|
|
197
|
-
isSubmitting:
|
|
196
|
+
ratings: n,
|
|
197
|
+
isSubmitting: s,
|
|
198
198
|
error: o,
|
|
199
|
-
submitFeedback:
|
|
200
|
-
submitConversationFeedback:
|
|
199
|
+
submitFeedback: w,
|
|
200
|
+
submitConversationFeedback: h
|
|
201
201
|
};
|
|
202
202
|
}
|
|
203
|
-
function B(t,
|
|
204
|
-
const
|
|
203
|
+
function B(t, e) {
|
|
204
|
+
const n = m();
|
|
205
205
|
p(() => {
|
|
206
|
-
|
|
207
|
-
description:
|
|
208
|
-
parameters:
|
|
209
|
-
maxResultBytes:
|
|
206
|
+
n.registerFunction(t, e.handler, {
|
|
207
|
+
description: e.description,
|
|
208
|
+
parameters: e.parameters,
|
|
209
|
+
maxResultBytes: e.maxResultBytes,
|
|
210
|
+
requiresApproval: e.requiresApproval,
|
|
211
|
+
webmcp: e.webmcp
|
|
210
212
|
});
|
|
211
213
|
}), C(() => {
|
|
212
|
-
|
|
214
|
+
n.unregisterFunction(t);
|
|
213
215
|
});
|
|
214
216
|
}
|
|
215
|
-
function T(t, n) {
|
|
216
|
-
const
|
|
217
|
+
function T(t, e, n) {
|
|
218
|
+
const s = m();
|
|
217
219
|
p(() => {
|
|
218
|
-
|
|
220
|
+
s.registerNavigationFunction(t, e, { catalogue: n?.catalogue === "onDemand" ? "onDemand" : "inline" });
|
|
219
221
|
}), C(() => {
|
|
220
|
-
|
|
222
|
+
s.unregisterNavigationFunction();
|
|
221
223
|
});
|
|
222
224
|
}
|
|
223
|
-
function W(t,
|
|
224
|
-
const
|
|
225
|
+
function W(t, e) {
|
|
226
|
+
const n = m(), s = e?.functionName ?? "setPageState";
|
|
225
227
|
p(() => {
|
|
226
|
-
|
|
227
|
-
...
|
|
228
|
-
functionName:
|
|
228
|
+
n.registerPageStateFunction(t, {
|
|
229
|
+
...e,
|
|
230
|
+
functionName: s
|
|
229
231
|
});
|
|
230
232
|
}), C(() => {
|
|
231
|
-
|
|
233
|
+
n.unregisterPageStateFunction(s);
|
|
232
234
|
});
|
|
233
235
|
}
|
|
234
|
-
function K(t,
|
|
235
|
-
const
|
|
236
|
+
function K(t, e) {
|
|
237
|
+
const n = m();
|
|
236
238
|
p(() => {
|
|
237
|
-
|
|
239
|
+
n.on(t, e);
|
|
238
240
|
}), C(() => {
|
|
239
|
-
|
|
241
|
+
n.off(t, e);
|
|
240
242
|
});
|
|
241
243
|
}
|
|
242
244
|
function U(t) {
|
|
243
|
-
const
|
|
244
|
-
return R(t.subscribe((
|
|
245
|
-
|
|
246
|
-
})),
|
|
245
|
+
const e = F(t.get());
|
|
246
|
+
return R(t.subscribe((n) => {
|
|
247
|
+
e.value = n;
|
|
248
|
+
})), e;
|
|
247
249
|
}
|
|
248
250
|
function $() {
|
|
249
|
-
const t = m(),
|
|
250
|
-
|
|
251
|
-
},
|
|
252
|
-
|
|
251
|
+
const t = m(), e = F(null), n = (o) => {
|
|
252
|
+
e.value = o, t.proactive?.shown(o);
|
|
253
|
+
}, s = ({ nudge: o }) => {
|
|
254
|
+
e.value?.id === o.id && (e.value = null);
|
|
253
255
|
};
|
|
254
256
|
return p(() => {
|
|
255
|
-
t.on("nudge:ready",
|
|
257
|
+
t.on("nudge:ready", n), t.on("nudge:accepted", s), t.on("nudge:dismissed", s);
|
|
256
258
|
}), C(() => {
|
|
257
|
-
t.off("nudge:ready",
|
|
259
|
+
t.off("nudge:ready", n), t.off("nudge:accepted", s), t.off("nudge:dismissed", s);
|
|
258
260
|
}), {
|
|
259
|
-
nudge:
|
|
261
|
+
nudge: e,
|
|
260
262
|
accept: async () => {
|
|
261
|
-
const o =
|
|
262
|
-
o && (
|
|
263
|
+
const o = e.value;
|
|
264
|
+
o && (e.value = null, await t.proactive?.accept(o));
|
|
263
265
|
},
|
|
264
266
|
dismiss: () => {
|
|
265
|
-
const o =
|
|
266
|
-
o && (
|
|
267
|
+
const o = e.value;
|
|
268
|
+
o && (e.value = null, t.proactive?.dismiss(o));
|
|
267
269
|
}
|
|
268
270
|
};
|
|
269
271
|
}
|
|
270
272
|
export {
|
|
271
273
|
N as AGO_CLIENT_KEY,
|
|
272
|
-
|
|
273
|
-
|
|
274
|
+
_ as AgoPlugin,
|
|
275
|
+
x as FEEDBACK_REASONS,
|
|
274
276
|
m as useAgo,
|
|
275
277
|
K as useAgoEvents,
|
|
276
278
|
B as useAgoFunction,
|
|
@@ -278,7 +280,7 @@ export {
|
|
|
278
280
|
W as useAgoPageState,
|
|
279
281
|
U as useAgoStore,
|
|
280
282
|
O as useChat,
|
|
281
|
-
|
|
283
|
+
D as useConversation,
|
|
282
284
|
G as useFeedback,
|
|
283
285
|
k as useMessages,
|
|
284
286
|
$ as useProactiveNudge
|