@8wave/ai-elements 0.112.0-beta.8 → 0.112.0
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/_chunks/{PkToolShowVideo-Djr8Ofsz.js → PkToolShowVideo-p6Y9j3-B.js} +3 -3
- package/dist/_chunks/PkToolShowVideo-p6Y9j3-B.js.map +1 -0
- package/dist/_chunks/{browser-B0Xnbqi7.js → browser-Ct5TRDgj.js} +521 -518
- package/dist/_chunks/{browser-B0Xnbqi7.js.map → browser-Ct5TRDgj.js.map} +1 -1
- package/dist/_chunks/markdown-BRD-hDrH.js.map +1 -1
- package/dist/_chunks/{web-Dzr6HJ14.js → web-CEmtEYdH.js} +89 -65
- package/dist/_chunks/web-CEmtEYdH.js.map +1 -0
- package/dist/ai-elements.es.js +2918 -3166
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotAuth.js +1 -1
- package/dist-vue/PkChatbotMessages.js +1 -1
- package/dist-vue/PkChatbotViewChat.js +1 -1
- package/dist-vue/PkChatbotViewConversations.js +1 -1
- package/dist-vue/PkChatbotViewFiles.js +1 -1
- package/dist-vue/PkChatbotViewProfile.js +1 -1
- package/dist-vue/_chunks/{Document-Bjz-CSLq.js → Document-2X01-F4Z.js} +2 -2
- package/dist-vue/_chunks/Document-2X01-F4Z.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbot-BGSXeh04.js → PkChatbot-C11EVHnI.js} +6 -6
- package/dist-vue/_chunks/{PkChatbot-BGSXeh04.js.map → PkChatbot-C11EVHnI.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotAuth-AxAOI9t2.js → PkChatbotAuth-Bi508F1u.js} +57 -57
- package/dist-vue/_chunks/PkChatbotAuth-Bi508F1u.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotMessages-BNjbDHgy.js → PkChatbotMessages-BD-vUak6.js} +4 -4
- package/dist-vue/_chunks/{PkChatbotMessages-BNjbDHgy.js.map → PkChatbotMessages-BD-vUak6.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewChat-ZWFtuc-N.js → PkChatbotViewChat-DJnjuhjt.js} +5 -5
- package/dist-vue/_chunks/{PkChatbotViewChat-ZWFtuc-N.js.map → PkChatbotViewChat-DJnjuhjt.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewConversations-BLMzqmXi.js → PkChatbotViewConversations-BCdolW0R.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewConversations-BLMzqmXi.js.map → PkChatbotViewConversations-BCdolW0R.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewFiles-DLkQ7ClA.js → PkChatbotViewFiles-Cudao8ew.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewFiles-DLkQ7ClA.js.map → PkChatbotViewFiles-Cudao8ew.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewProfile-DZ-Jim4x.js → PkChatbotViewProfile-DDsKOkcC.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewProfile-DZ-Jim4x.js.map → PkChatbotViewProfile-DDsKOkcC.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowDiagram-BXdA_2Na.js → PkToolShowDiagram-RtkI_sKL.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowDiagram-BXdA_2Na.js.map → PkToolShowDiagram-RtkI_sKL.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSources-B3tBNres.js → PkToolShowSources-gI947JOm.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowSources-B3tBNres.js.map → PkToolShowSources-gI947JOm.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowVideo-Bv9kMd88.js → PkToolShowVideo-BZOTu2Qe.js} +3 -3
- package/dist-vue/_chunks/PkToolShowVideo-BZOTu2Qe.js.map +1 -0
- package/dist-vue/_chunks/{useChatbotStore-Bc6V5Rv0.js → useChatbotStore-BwrBZJCq.js} +1157 -1500
- package/dist-vue/_chunks/useChatbotStore-BwrBZJCq.js.map +1 -0
- package/dist-vue/_chunks/{web-Dzr6HJ14.js → web-CEmtEYdH.js} +89 -65
- package/dist-vue/_chunks/web-CEmtEYdH.js.map +1 -0
- package/dist-vue/apps/web-component/src/composables/useChatbotAuthForm.d.ts +0 -1
- package/dist-vue/composables.js +2809 -80
- package/dist-vue/composables.js.map +1 -1
- package/dist-vue/index.js +250 -195
- package/dist-vue/index.js.map +1 -1
- package/dist-vue/locales.js +16 -20
- package/dist-vue/packages/components/src/chat/PkAgentSettingsPanel.d.ts +2 -2
- package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +12 -0
- package/dist-vue/packages/models/src/schema/ModelProvider.d.ts +11 -2
- package/dist-vue/packages/models/src/schema/Organization.d.ts +3 -3
- package/dist-vue/packages/models/src/schema/User.d.ts +10 -0
- package/dist-vue/packages/models/src/schema/constants.d.ts +1 -1
- package/dist-vue/style.css +1 -1
- package/package.json +3 -3
- package/dist/_chunks/PkToolShowVideo-Djr8Ofsz.js.map +0 -1
- package/dist/_chunks/web-Dzr6HJ14.js.map +0 -1
- package/dist-vue/_chunks/Document-Bjz-CSLq.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotAuth-AxAOI9t2.js.map +0 -1
- package/dist-vue/_chunks/PkToolShowVideo-Bv9kMd88.js.map +0 -1
- package/dist-vue/_chunks/useChatbotStore-Bc6V5Rv0.js.map +0 -1
- package/dist-vue/_chunks/web-Dzr6HJ14.js.map +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { E as e, S as t, T as n, _ as r, a as i, b as a, c as o, f as s, g as c, h as l, i as u, l as d, m as f, n as p, o as m, p as h, r as g, x as _, y as v } from "./schemas-DxbHVg3r.js";
|
|
2
|
-
import { O as
|
|
3
|
-
import { r as
|
|
4
|
-
import { t as
|
|
5
|
-
import { n as
|
|
6
|
-
import { t as
|
|
7
|
-
import { computed as
|
|
8
|
-
import { useI18n as
|
|
9
|
-
import { usePreferredDark as
|
|
10
|
-
import { defineStore as
|
|
2
|
+
import { O as ee } from "./Agent-BNlmK-uJ.js";
|
|
3
|
+
import { r as te, t as ne } from "./createChatbotApiClient-CaVLm5W9.js";
|
|
4
|
+
import { t as re } from "./src-DT8FLE4_.js";
|
|
5
|
+
import { n as ie } from "./message-RohfrdWS.js";
|
|
6
|
+
import { t as ae } from "./useSafeLocalStorage-Ce3S1Ayn.js";
|
|
7
|
+
import { computed as y, getCurrentScope as oe, isReadonly as se, onScopeDispose as ce, reactive as le, ref as b, toRefs as ue, watch as de, watchEffect as fe } from "vue";
|
|
8
|
+
import { useI18n as pe } from "vue-i18n";
|
|
9
|
+
import { usePreferredDark as me } from "@vueuse/core";
|
|
10
|
+
import { defineStore as x } from "pinia";
|
|
11
11
|
//#region ../../packages/utils/src/device-context.ts
|
|
12
|
-
function
|
|
12
|
+
function he() {
|
|
13
13
|
let e = navigator.connection, t = navigator.userAgentData;
|
|
14
14
|
return {
|
|
15
15
|
dateTime: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -39,7 +39,7 @@ function me() {
|
|
|
39
39
|
historyLength: window.history.length
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
async function
|
|
42
|
+
async function ge(e) {
|
|
43
43
|
if (!navigator.geolocation || !navigator.permissions) return null;
|
|
44
44
|
try {
|
|
45
45
|
if ((await navigator.permissions.query({ name: "geolocation" })).state !== "granted") return null;
|
|
@@ -57,67 +57,66 @@ async function he(e) {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
//#endregion
|
|
60
|
-
//#region ../../node_modules/.pnpm/@ai-sdk+provider@4.0.
|
|
61
|
-
var
|
|
60
|
+
//#region ../../node_modules/.pnpm/@ai-sdk+provider@4.0.20/node_modules/@ai-sdk/provider/dist/index.js
|
|
61
|
+
var _e = "vercel.ai.error", ve = Symbol.for(_e), S = class e extends Error {
|
|
62
62
|
constructor({ name: e, message: t, cause: n }) {
|
|
63
|
-
super(t), this[
|
|
63
|
+
super(t), this[ve] = !0, this.name = e, this.cause = n;
|
|
64
64
|
}
|
|
65
65
|
static isInstance(t) {
|
|
66
|
-
return e.hasMarker(t,
|
|
66
|
+
return e.hasMarker(t, _e);
|
|
67
67
|
}
|
|
68
68
|
static hasMarker(e, t) {
|
|
69
69
|
let n = Symbol.for(t);
|
|
70
70
|
return typeof e == "object" && !!e && n in e && typeof e[n] == "boolean" && e[n] === !0;
|
|
71
71
|
}
|
|
72
|
-
},
|
|
72
|
+
}, C = "AI_APICallError", w = `vercel.ai.error.${C}`, ye = Symbol.for(w), be = class extends S {
|
|
73
73
|
constructor({ message: e, url: t, requestBodyValues: n, statusCode: r, responseHeaders: i, responseBody: a, cause: o, isRetryable: s = r != null && (r === 408 || r === 409 || r === 429 || r >= 500), data: c }) {
|
|
74
74
|
super({
|
|
75
|
-
name:
|
|
75
|
+
name: C,
|
|
76
76
|
message: e,
|
|
77
77
|
cause: o
|
|
78
|
-
}), this[
|
|
78
|
+
}), this[ye] = !0, this.url = t, this.requestBodyValues = n, this.statusCode = r, this.responseHeaders = i, this.responseBody = a, this.isRetryable = s, this.data = c;
|
|
79
79
|
}
|
|
80
80
|
static isInstance(e) {
|
|
81
|
-
return
|
|
81
|
+
return S.hasMarker(e, w);
|
|
82
82
|
}
|
|
83
|
-
},
|
|
83
|
+
}, xe = "AI_EmptyResponseBodyError", T = `vercel.ai.error.${xe}`, Se = Symbol.for(T), Ce = class extends S {
|
|
84
84
|
constructor({ message: e = "Empty response body" } = {}) {
|
|
85
85
|
super({
|
|
86
|
-
name:
|
|
86
|
+
name: xe,
|
|
87
87
|
message: e
|
|
88
|
-
}), this[
|
|
88
|
+
}), this[Se] = !0;
|
|
89
89
|
}
|
|
90
90
|
static isInstance(e) {
|
|
91
|
-
return
|
|
91
|
+
return S.hasMarker(e, T);
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
|
-
function
|
|
94
|
+
function E(e) {
|
|
95
95
|
return e == null ? "unknown error" : typeof e == "string" ? e : e instanceof Error ? e.toString() : JSON.stringify(e);
|
|
96
96
|
}
|
|
97
|
-
var
|
|
97
|
+
var we = "AI_InvalidArgumentError", Te = `vercel.ai.error.${we}`, Ee = Symbol.for(Te), De = class extends S {
|
|
98
98
|
constructor({ message: e, cause: t, argument: n }) {
|
|
99
99
|
super({
|
|
100
|
-
name:
|
|
100
|
+
name: we,
|
|
101
101
|
message: e,
|
|
102
102
|
cause: t
|
|
103
|
-
}), this[
|
|
103
|
+
}), this[Ee] = !0, this.argument = n;
|
|
104
104
|
}
|
|
105
105
|
static isInstance(e) {
|
|
106
|
-
return
|
|
106
|
+
return S.hasMarker(e, Te);
|
|
107
107
|
}
|
|
108
|
-
},
|
|
108
|
+
}, Oe = "AI_JSONParseError", D = `vercel.ai.error.${Oe}`, ke = Symbol.for(D), O = class extends S {
|
|
109
109
|
constructor({ text: e, cause: t }) {
|
|
110
110
|
super({
|
|
111
|
-
name:
|
|
112
|
-
message: `JSON parsing failed: Text: ${e}
|
|
113
|
-
Error message: ${O(t)}`,
|
|
111
|
+
name: Oe,
|
|
112
|
+
message: `JSON parsing failed: Text: ${e}.\nError message: ${E(t)}`,
|
|
114
113
|
cause: t
|
|
115
|
-
}), this[
|
|
114
|
+
}), this[ke] = !0, this.text = e;
|
|
116
115
|
}
|
|
117
116
|
static isInstance(e) {
|
|
118
|
-
return
|
|
117
|
+
return S.hasMarker(e, D);
|
|
119
118
|
}
|
|
120
|
-
},
|
|
119
|
+
}, Ae = "AI_TypeValidationError", je = `vercel.ai.error.${Ae}`, k = Symbol.for(je), A = class e extends S {
|
|
121
120
|
constructor({ value: e, cause: t, context: n }) {
|
|
122
121
|
let r = "Type validation failed";
|
|
123
122
|
if (n?.field && (r += ` for ${n.field}`), n?.entityName || n?.entityId) {
|
|
@@ -126,14 +125,13 @@ Error message: ${O(t)}`,
|
|
|
126
125
|
n.entityName && e.push(n.entityName), n.entityId && e.push(`id: "${n.entityId}"`), r += e.join(", "), r += ")";
|
|
127
126
|
}
|
|
128
127
|
super({
|
|
129
|
-
name:
|
|
130
|
-
message: `${r}: Value: ${JSON.stringify(e)}
|
|
131
|
-
Error message: ${O(t)}`,
|
|
128
|
+
name: Ae,
|
|
129
|
+
message: `${r}: Value: ${JSON.stringify(e)}.\nError message: ${E(t)}`,
|
|
132
130
|
cause: t
|
|
133
|
-
}), this[
|
|
131
|
+
}), this[k] = !0, this.value = e, this.context = n;
|
|
134
132
|
}
|
|
135
133
|
static isInstance(e) {
|
|
136
|
-
return
|
|
134
|
+
return S.hasMarker(e, je);
|
|
137
135
|
}
|
|
138
136
|
static wrap({ value: t, cause: n, context: r }) {
|
|
139
137
|
return e.isInstance(n) && n.value === t && n.context?.field === r?.field && n.context?.entityName === r?.entityName && n.context?.entityId === r?.entityId ? n : new e({
|
|
@@ -142,25 +140,25 @@ Error message: ${O(t)}`,
|
|
|
142
140
|
context: r
|
|
143
141
|
});
|
|
144
142
|
}
|
|
145
|
-
},
|
|
143
|
+
}, Me = "AI_UnsupportedFunctionalityError", j = `vercel.ai.error.${Me}`, Ne = Symbol.for(j), Pe = class extends S {
|
|
146
144
|
constructor({ functionality: e, message: t = `'${e}' functionality not supported.` }) {
|
|
147
145
|
super({
|
|
148
|
-
name:
|
|
146
|
+
name: Me,
|
|
149
147
|
message: t
|
|
150
|
-
}), this[
|
|
148
|
+
}), this[Ne] = !0, this.functionality = e;
|
|
151
149
|
}
|
|
152
150
|
static isInstance(e) {
|
|
153
|
-
return
|
|
151
|
+
return S.hasMarker(e, j);
|
|
154
152
|
}
|
|
155
|
-
},
|
|
153
|
+
}, M = class extends Error {
|
|
156
154
|
constructor(e, t) {
|
|
157
155
|
super(e), this.name = "ParseError", this.type = t.type, this.field = t.field, this.value = t.value, this.line = t.line;
|
|
158
156
|
}
|
|
159
|
-
},
|
|
160
|
-
function
|
|
161
|
-
function
|
|
157
|
+
}, Fe = 10, N = 13, P = 32;
|
|
158
|
+
function F(e) {}
|
|
159
|
+
function Ie(e) {
|
|
162
160
|
if (typeof e == "function") throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");
|
|
163
|
-
let { onEvent: t =
|
|
161
|
+
let { onEvent: t = F, onError: n = F, onRetry: r = F, onComment: i, maxBufferSize: a } = e, o = [], s = 0, c = !0, l, u = "", d = 0, f, p = !1;
|
|
164
162
|
function m(e) {
|
|
165
163
|
if (p) throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");
|
|
166
164
|
if (c && (c = !1, e.charCodeAt(0) === 239 && e.charCodeAt(1) === 187 && e.charCodeAt(2) === 191 && (e = e.slice(3))), o.length === 0) {
|
|
@@ -179,7 +177,7 @@ function Xe(e) {
|
|
|
179
177
|
n !== "" && (o.push(n), s = n.length), h();
|
|
180
178
|
}
|
|
181
179
|
function h() {
|
|
182
|
-
a !== void 0 && (s + u.length <= a || (p = !0, o.length = 0, s = 0, l = void 0, u = "", d = 0, f = void 0, n(new
|
|
180
|
+
a !== void 0 && (s + u.length <= a || (p = !0, o.length = 0, s = 0, l = void 0, u = "", d = 0, f = void 0, n(new M(`Buffered data exceeded max buffer size of ${a} characters`, { type: "max-buffer-size-exceeded" }))));
|
|
183
181
|
}
|
|
184
182
|
function g(e) {
|
|
185
183
|
let n = 0;
|
|
@@ -195,9 +193,9 @@ function Xe(e) {
|
|
|
195
193
|
continue;
|
|
196
194
|
}
|
|
197
195
|
let i = e.charCodeAt(n);
|
|
198
|
-
if (
|
|
199
|
-
let i = e.charCodeAt(n + 5) ===
|
|
200
|
-
if (d === 0 && e.charCodeAt(r + 1) ===
|
|
196
|
+
if (I(e, n, i)) {
|
|
197
|
+
let i = e.charCodeAt(n + 5) === P ? n + 6 : n + 5, a = e.slice(i, r);
|
|
198
|
+
if (d === 0 && e.charCodeAt(r + 1) === Fe) {
|
|
201
199
|
t({
|
|
202
200
|
id: l,
|
|
203
201
|
event: f,
|
|
@@ -207,7 +205,7 @@ function Xe(e) {
|
|
|
207
205
|
}
|
|
208
206
|
u = d === 0 ? a : `${u}
|
|
209
207
|
${a}`, d++;
|
|
210
|
-
} else
|
|
208
|
+
} else Le(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) === P ? n + 7 : n + 6, r) || void 0 : _(e, n, r);
|
|
211
209
|
n = r + 1, r = e.indexOf("\n", n);
|
|
212
210
|
}
|
|
213
211
|
return e.slice(n);
|
|
@@ -215,35 +213,35 @@ ${a}`, d++;
|
|
|
215
213
|
for (; n < e.length;) {
|
|
216
214
|
let t = e.indexOf("\r", n), r = e.indexOf("\n", n), i = -1;
|
|
217
215
|
if (t !== -1 && r !== -1 ? i = t < r ? t : r : t === -1 ? r !== -1 && (i = r) : i = t === e.length - 1 ? -1 : t, i === -1) break;
|
|
218
|
-
_(e, n, i), n = i + 1, e.charCodeAt(n - 1) ===
|
|
216
|
+
_(e, n, i), n = i + 1, e.charCodeAt(n - 1) === N && e.charCodeAt(n) === Fe && n++;
|
|
219
217
|
}
|
|
220
218
|
return e.slice(n);
|
|
221
219
|
}
|
|
222
220
|
function _(e, t, n) {
|
|
223
221
|
if (t === n) {
|
|
224
|
-
|
|
222
|
+
ee();
|
|
225
223
|
return;
|
|
226
224
|
}
|
|
227
225
|
let r = e.charCodeAt(t);
|
|
228
|
-
if (
|
|
229
|
-
let r = e.charCodeAt(t + 5) ===
|
|
226
|
+
if (I(e, t, r)) {
|
|
227
|
+
let r = e.charCodeAt(t + 5) === P ? t + 6 : t + 5, i = e.slice(r, n);
|
|
230
228
|
u = d === 0 ? i : `${u}
|
|
231
229
|
${i}`, d++;
|
|
232
230
|
return;
|
|
233
231
|
}
|
|
234
|
-
if (
|
|
235
|
-
f = e.slice(e.charCodeAt(t + 6) ===
|
|
232
|
+
if (Le(e, t, r)) {
|
|
233
|
+
f = e.slice(e.charCodeAt(t + 6) === P ? t + 7 : t + 6, n) || void 0;
|
|
236
234
|
return;
|
|
237
235
|
}
|
|
238
236
|
if (r === 105 && e.charCodeAt(t + 1) === 100 && e.charCodeAt(t + 2) === 58) {
|
|
239
|
-
let r = e.slice(e.charCodeAt(t + 3) ===
|
|
237
|
+
let r = e.slice(e.charCodeAt(t + 3) === P ? t + 4 : t + 3, n);
|
|
240
238
|
l = r.includes("\0") ? void 0 : r;
|
|
241
239
|
return;
|
|
242
240
|
}
|
|
243
241
|
if (r === 58) {
|
|
244
242
|
if (i) {
|
|
245
243
|
let r = e.slice(t, n);
|
|
246
|
-
i(r.slice(e.charCodeAt(t + 1) ===
|
|
244
|
+
i(r.slice(e.charCodeAt(t + 1) === P ? 2 : 1));
|
|
247
245
|
}
|
|
248
246
|
return;
|
|
249
247
|
}
|
|
@@ -252,7 +250,7 @@ ${i}`, d++;
|
|
|
252
250
|
v(a, "", a);
|
|
253
251
|
return;
|
|
254
252
|
}
|
|
255
|
-
let s = a.slice(0, o), c = a.charCodeAt(o + 1) ===
|
|
253
|
+
let s = a.slice(0, o), c = a.charCodeAt(o + 1) === P ? 2 : 1;
|
|
256
254
|
v(s, a.slice(o + c), a);
|
|
257
255
|
}
|
|
258
256
|
function v(e, t, i) {
|
|
@@ -268,13 +266,13 @@ ${t}`, d++;
|
|
|
268
266
|
l = t.includes("\0") ? void 0 : t;
|
|
269
267
|
break;
|
|
270
268
|
case "retry":
|
|
271
|
-
/^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new
|
|
269
|
+
/^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new M(`Invalid \`retry\` value: "${t}"`, {
|
|
272
270
|
type: "invalid-retry",
|
|
273
271
|
value: t,
|
|
274
272
|
line: i
|
|
275
273
|
}));
|
|
276
274
|
break;
|
|
277
|
-
default: n(new
|
|
275
|
+
default: n(new M(`Unknown field "${e.length > 20 ? `${e.slice(0, 20)}\u2026` : e}"`, {
|
|
278
276
|
type: "unknown-field",
|
|
279
277
|
field: e,
|
|
280
278
|
value: t,
|
|
@@ -282,14 +280,14 @@ ${t}`, d++;
|
|
|
282
280
|
}));
|
|
283
281
|
}
|
|
284
282
|
}
|
|
285
|
-
function
|
|
283
|
+
function ee() {
|
|
286
284
|
d > 0 && t({
|
|
287
285
|
id: l,
|
|
288
286
|
event: f,
|
|
289
287
|
data: u
|
|
290
288
|
}), l = void 0, u = "", d = 0, f = void 0;
|
|
291
289
|
}
|
|
292
|
-
function
|
|
290
|
+
function te(e = {}) {
|
|
293
291
|
if (e.consume && o.length > 0) {
|
|
294
292
|
let e = o.join("");
|
|
295
293
|
_(e, 0, e.length);
|
|
@@ -298,23 +296,23 @@ ${t}`, d++;
|
|
|
298
296
|
}
|
|
299
297
|
return {
|
|
300
298
|
feed: m,
|
|
301
|
-
reset:
|
|
299
|
+
reset: te
|
|
302
300
|
};
|
|
303
301
|
}
|
|
304
|
-
function
|
|
302
|
+
function I(e, t, n) {
|
|
305
303
|
return n === 100 && e.charCodeAt(t + 1) === 97 && e.charCodeAt(t + 2) === 116 && e.charCodeAt(t + 3) === 97 && e.charCodeAt(t + 4) === 58;
|
|
306
304
|
}
|
|
307
|
-
function
|
|
305
|
+
function Le(e, t, n) {
|
|
308
306
|
return n === 101 && e.charCodeAt(t + 1) === 118 && e.charCodeAt(t + 2) === 101 && e.charCodeAt(t + 3) === 110 && e.charCodeAt(t + 4) === 116 && e.charCodeAt(t + 5) === 58;
|
|
309
307
|
}
|
|
310
308
|
//#endregion
|
|
311
309
|
//#region ../../node_modules/.pnpm/eventsource-parser@3.1.0/node_modules/eventsource-parser/dist/stream.js
|
|
312
|
-
var
|
|
310
|
+
var Re = class extends TransformStream {
|
|
313
311
|
constructor({ onError: e, onRetry: t, onComment: n, maxBufferSize: r } = {}) {
|
|
314
312
|
let i;
|
|
315
313
|
super({
|
|
316
314
|
start(a) {
|
|
317
|
-
i =
|
|
315
|
+
i = Ie({
|
|
318
316
|
onEvent: (e) => {
|
|
319
317
|
a.enqueue(e);
|
|
320
318
|
},
|
|
@@ -333,8 +331,8 @@ var $e = class extends TransformStream {
|
|
|
333
331
|
}
|
|
334
332
|
};
|
|
335
333
|
new TextDecoder();
|
|
336
|
-
var { btoa:
|
|
337
|
-
function
|
|
334
|
+
var { btoa: ze, atob: Be } = globalThis;
|
|
335
|
+
function L(e) {
|
|
338
336
|
if (e == null) return {};
|
|
339
337
|
let t = {};
|
|
340
338
|
if (e instanceof Headers) e.forEach((e, n) => {
|
|
@@ -346,28 +344,28 @@ function I(e) {
|
|
|
346
344
|
}
|
|
347
345
|
return t;
|
|
348
346
|
}
|
|
349
|
-
var
|
|
347
|
+
var R = ({ prefix: e, size: t = 16, alphabet: n = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", separator: r = "-" } = {}) => {
|
|
350
348
|
let i = () => {
|
|
351
349
|
let e = n.length, r = Array(t);
|
|
352
350
|
for (let i = 0; i < t; i++) r[i] = n[Math.random() * e | 0];
|
|
353
351
|
return r.join("");
|
|
354
352
|
};
|
|
355
353
|
if (e == null) return i;
|
|
356
|
-
if (n.includes(r)) throw new
|
|
354
|
+
if (n.includes(r)) throw new De({
|
|
357
355
|
argument: "separator",
|
|
358
356
|
message: `The separator "${r}" must not be part of the alphabet "${n}".`
|
|
359
357
|
});
|
|
360
358
|
return () => `${e}${r}${i()}`;
|
|
361
|
-
},
|
|
362
|
-
function
|
|
359
|
+
}, z = R();
|
|
360
|
+
function Ve(e) {
|
|
363
361
|
return globalThis.Buffer?.isBuffer(e) ?? !1;
|
|
364
362
|
}
|
|
365
|
-
var
|
|
366
|
-
function
|
|
363
|
+
var He = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/, Ue = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
|
|
364
|
+
function We(e) {
|
|
367
365
|
let t = JSON.parse(e);
|
|
368
|
-
return typeof t != "object" || !t ||
|
|
366
|
+
return typeof t != "object" || !t || He.test(e) === !1 && Ue.test(e) === !1 ? t : Ge(t);
|
|
369
367
|
}
|
|
370
|
-
function
|
|
368
|
+
function Ge(e) {
|
|
371
369
|
let t = [e];
|
|
372
370
|
for (; t.length;) {
|
|
373
371
|
let e = t;
|
|
@@ -382,35 +380,35 @@ function ot(e) {
|
|
|
382
380
|
}
|
|
383
381
|
return e;
|
|
384
382
|
}
|
|
385
|
-
function
|
|
383
|
+
function Ke(e) {
|
|
386
384
|
let { stackTraceLimit: t } = Error;
|
|
387
385
|
try {
|
|
388
386
|
Error.stackTraceLimit = 0;
|
|
389
387
|
} catch {
|
|
390
|
-
return
|
|
388
|
+
return We(e);
|
|
391
389
|
}
|
|
392
390
|
try {
|
|
393
|
-
return
|
|
391
|
+
return We(e);
|
|
394
392
|
} finally {
|
|
395
393
|
Error.stackTraceLimit = t;
|
|
396
394
|
}
|
|
397
395
|
}
|
|
398
|
-
function
|
|
396
|
+
function qe(e) {
|
|
399
397
|
if (e.type === "object" || Array.isArray(e.type) && e.type.includes("object")) {
|
|
400
398
|
let { additionalProperties: t } = e;
|
|
401
|
-
e.additionalProperties = t != null && typeof t != "boolean" &&
|
|
399
|
+
e.additionalProperties = t != null && typeof t != "boolean" && B(t);
|
|
402
400
|
let { properties: n } = e;
|
|
403
|
-
if (n != null) for (let e of Object.keys(n)) n[e] =
|
|
401
|
+
if (n != null) for (let e of Object.keys(n)) n[e] = B(n[e]);
|
|
404
402
|
}
|
|
405
|
-
e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(
|
|
403
|
+
e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(B) : B(e.items)), e.anyOf != null && (e.anyOf = e.anyOf.map(B)), e.allOf != null && (e.allOf = e.allOf.map(B)), e.oneOf != null && (e.oneOf = e.oneOf.map(B));
|
|
406
404
|
let { definitions: t } = e;
|
|
407
|
-
if (t != null) for (let e of Object.keys(t)) t[e] =
|
|
405
|
+
if (t != null) for (let e of Object.keys(t)) t[e] = B(t[e]);
|
|
408
406
|
return e;
|
|
409
407
|
}
|
|
410
|
-
function
|
|
411
|
-
return typeof e == "boolean" ? e :
|
|
408
|
+
function B(e) {
|
|
409
|
+
return typeof e == "boolean" ? e : qe(e);
|
|
412
410
|
}
|
|
413
|
-
var
|
|
411
|
+
var Je = Symbol("Let zodToJsonSchema decide on which parser to use"), Ye = {
|
|
414
412
|
name: void 0,
|
|
415
413
|
$refStrategy: "root",
|
|
416
414
|
basePath: ["#"],
|
|
@@ -430,24 +428,24 @@ var lt = /* @__PURE__ */ Symbol("Let zodToJsonSchema decide on which parser to u
|
|
|
430
428
|
emailStrategy: "format:email",
|
|
431
429
|
base64Strategy: "contentEncoding:base64",
|
|
432
430
|
nameStrategy: "ref"
|
|
433
|
-
},
|
|
434
|
-
...
|
|
431
|
+
}, Xe = (e) => typeof e == "string" ? {
|
|
432
|
+
...Ye,
|
|
435
433
|
name: e
|
|
436
434
|
} : {
|
|
437
|
-
...
|
|
435
|
+
...Ye,
|
|
438
436
|
...e
|
|
439
437
|
};
|
|
440
|
-
function
|
|
438
|
+
function V() {
|
|
441
439
|
return {};
|
|
442
440
|
}
|
|
443
|
-
function
|
|
441
|
+
function Ze(e, t) {
|
|
444
442
|
let n = { type: "array" };
|
|
445
|
-
return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items =
|
|
443
|
+
return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = K(e.type._def, {
|
|
446
444
|
...t,
|
|
447
445
|
currentPath: [...t.currentPath, "items"]
|
|
448
446
|
})), e.minLength && (n.minItems = e.minLength.value), e.maxLength && (n.maxItems = e.maxLength.value), e.exactLength && (n.minItems = e.exactLength.value, n.maxItems = e.exactLength.value), n;
|
|
449
447
|
}
|
|
450
|
-
function
|
|
448
|
+
function Qe(e) {
|
|
451
449
|
let t = {
|
|
452
450
|
type: "integer",
|
|
453
451
|
format: "int64"
|
|
@@ -464,16 +462,16 @@ function pt(e) {
|
|
|
464
462
|
}
|
|
465
463
|
return t;
|
|
466
464
|
}
|
|
467
|
-
function
|
|
465
|
+
function $e() {
|
|
468
466
|
return { type: "boolean" };
|
|
469
467
|
}
|
|
470
|
-
function
|
|
471
|
-
return
|
|
468
|
+
function et(e, t) {
|
|
469
|
+
return K(e.type._def, t);
|
|
472
470
|
}
|
|
473
|
-
var
|
|
474
|
-
function
|
|
471
|
+
var tt = (e, t) => K(e.innerType._def, t);
|
|
472
|
+
function nt(e, t, n) {
|
|
475
473
|
let r = n ?? t.dateStrategy;
|
|
476
|
-
if (Array.isArray(r)) return { anyOf: r.map((n) =>
|
|
474
|
+
if (Array.isArray(r)) return { anyOf: r.map((n) => nt(e, t, n)) };
|
|
477
475
|
switch (r) {
|
|
478
476
|
case "string":
|
|
479
477
|
case "format:date-time": return {
|
|
@@ -484,10 +482,10 @@ function _t(e, t, n) {
|
|
|
484
482
|
type: "string",
|
|
485
483
|
format: "date"
|
|
486
484
|
};
|
|
487
|
-
case "integer": return
|
|
485
|
+
case "integer": return rt(e);
|
|
488
486
|
}
|
|
489
487
|
}
|
|
490
|
-
var
|
|
488
|
+
var rt = (e) => {
|
|
491
489
|
let t = {
|
|
492
490
|
type: "integer",
|
|
493
491
|
format: "unix-time"
|
|
@@ -500,31 +498,31 @@ var vt = (e) => {
|
|
|
500
498
|
}
|
|
501
499
|
return t;
|
|
502
500
|
};
|
|
503
|
-
function
|
|
501
|
+
function it(e, t) {
|
|
504
502
|
return {
|
|
505
|
-
...
|
|
503
|
+
...K(e.innerType._def, t),
|
|
506
504
|
default: e.defaultValue()
|
|
507
505
|
};
|
|
508
506
|
}
|
|
509
|
-
function
|
|
510
|
-
return t.effectStrategy === "input" ?
|
|
507
|
+
function at(e, t) {
|
|
508
|
+
return t.effectStrategy === "input" ? K(e.schema._def, t) : V();
|
|
511
509
|
}
|
|
512
|
-
function
|
|
510
|
+
function H(e) {
|
|
513
511
|
return {
|
|
514
512
|
type: "string",
|
|
515
513
|
enum: Array.from(e.values)
|
|
516
514
|
};
|
|
517
515
|
}
|
|
518
|
-
var
|
|
519
|
-
function
|
|
520
|
-
let n = [
|
|
516
|
+
var ot = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
|
|
517
|
+
function st(e, t) {
|
|
518
|
+
let n = [K(e.left._def, {
|
|
521
519
|
...t,
|
|
522
520
|
currentPath: [
|
|
523
521
|
...t.currentPath,
|
|
524
522
|
"allOf",
|
|
525
523
|
"0"
|
|
526
524
|
]
|
|
527
|
-
}),
|
|
525
|
+
}), K(e.right._def, {
|
|
528
526
|
...t,
|
|
529
527
|
currentPath: [
|
|
530
528
|
...t.currentPath,
|
|
@@ -533,7 +531,7 @@ function Ct(e, t) {
|
|
|
533
531
|
]
|
|
534
532
|
})].filter((e) => !!e), r = [];
|
|
535
533
|
return n.forEach((e) => {
|
|
536
|
-
if (
|
|
534
|
+
if (ot(e)) r.push(...e.allOf);
|
|
537
535
|
else {
|
|
538
536
|
let t = e;
|
|
539
537
|
if ("additionalProperties" in e && e.additionalProperties === !1) {
|
|
@@ -544,19 +542,19 @@ function Ct(e, t) {
|
|
|
544
542
|
}
|
|
545
543
|
}), r.length ? { allOf: r } : void 0;
|
|
546
544
|
}
|
|
547
|
-
function
|
|
545
|
+
function ct(e) {
|
|
548
546
|
let t = typeof e.value;
|
|
549
547
|
return t !== "bigint" && t !== "number" && t !== "boolean" && t !== "string" ? { type: Array.isArray(e.value) ? "array" : "object" } : {
|
|
550
548
|
type: t === "bigint" ? "integer" : t,
|
|
551
549
|
const: e.value
|
|
552
550
|
};
|
|
553
551
|
}
|
|
554
|
-
var
|
|
552
|
+
var lt = void 0, U = {
|
|
555
553
|
cuid: /^[cC][^\s-]{8,}$/,
|
|
556
554
|
cuid2: /^[0-9a-z]+$/,
|
|
557
555
|
ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
|
|
558
556
|
email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}$/,
|
|
559
|
-
emoji: () => (
|
|
557
|
+
emoji: () => (lt === void 0 && (lt = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u")), lt),
|
|
560
558
|
uuid: /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,
|
|
561
559
|
ipv4: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,
|
|
562
560
|
ipv4Cidr: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,
|
|
@@ -567,7 +565,7 @@ var Tt = void 0, V = {
|
|
|
567
565
|
nanoid: /^[a-zA-Z0-9_-]{21}$/,
|
|
568
566
|
jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
|
|
569
567
|
};
|
|
570
|
-
function
|
|
568
|
+
function ut(e, t) {
|
|
571
569
|
let n = { type: "string" };
|
|
572
570
|
if (e.checks) for (let r of e.checks) switch (r.kind) {
|
|
573
571
|
case "min":
|
|
@@ -579,108 +577,108 @@ function Et(e, t) {
|
|
|
579
577
|
case "email":
|
|
580
578
|
switch (t.emailStrategy) {
|
|
581
579
|
case "format:email":
|
|
582
|
-
|
|
580
|
+
W(n, "email", r.message, t);
|
|
583
581
|
break;
|
|
584
582
|
case "format:idn-email":
|
|
585
|
-
|
|
583
|
+
W(n, "idn-email", r.message, t);
|
|
586
584
|
break;
|
|
587
|
-
case "pattern:zod":
|
|
585
|
+
case "pattern:zod": G(n, U.email, r.message, t);
|
|
588
586
|
}
|
|
589
587
|
break;
|
|
590
588
|
case "url":
|
|
591
|
-
|
|
589
|
+
W(n, "uri", r.message, t);
|
|
592
590
|
break;
|
|
593
591
|
case "uuid":
|
|
594
|
-
|
|
592
|
+
W(n, "uuid", r.message, t);
|
|
595
593
|
break;
|
|
596
594
|
case "regex":
|
|
597
|
-
|
|
595
|
+
G(n, r.regex, r.message, t);
|
|
598
596
|
break;
|
|
599
597
|
case "cuid":
|
|
600
|
-
|
|
598
|
+
G(n, U.cuid, r.message, t);
|
|
601
599
|
break;
|
|
602
600
|
case "cuid2":
|
|
603
|
-
|
|
601
|
+
G(n, U.cuid2, r.message, t);
|
|
604
602
|
break;
|
|
605
603
|
case "startsWith":
|
|
606
|
-
|
|
604
|
+
G(n, RegExp(`^${dt(r.value, t)}`), r.message, t);
|
|
607
605
|
break;
|
|
608
606
|
case "endsWith":
|
|
609
|
-
|
|
607
|
+
G(n, RegExp(`${dt(r.value, t)}$`), r.message, t);
|
|
610
608
|
break;
|
|
611
609
|
case "datetime":
|
|
612
|
-
|
|
610
|
+
W(n, "date-time", r.message, t);
|
|
613
611
|
break;
|
|
614
612
|
case "date":
|
|
615
|
-
|
|
613
|
+
W(n, "date", r.message, t);
|
|
616
614
|
break;
|
|
617
615
|
case "time":
|
|
618
|
-
|
|
616
|
+
W(n, "time", r.message, t);
|
|
619
617
|
break;
|
|
620
618
|
case "duration":
|
|
621
|
-
|
|
619
|
+
W(n, "duration", r.message, t);
|
|
622
620
|
break;
|
|
623
621
|
case "length":
|
|
624
622
|
n.minLength = typeof n.minLength == "number" ? Math.max(n.minLength, r.value) : r.value, n.maxLength = typeof n.maxLength == "number" ? Math.min(n.maxLength, r.value) : r.value;
|
|
625
623
|
break;
|
|
626
624
|
case "includes":
|
|
627
|
-
|
|
625
|
+
G(n, RegExp(dt(r.value, t)), r.message, t);
|
|
628
626
|
break;
|
|
629
627
|
case "ip":
|
|
630
|
-
r.version !== "v6" &&
|
|
628
|
+
r.version !== "v6" && W(n, "ipv4", r.message, t), r.version !== "v4" && W(n, "ipv6", r.message, t);
|
|
631
629
|
break;
|
|
632
630
|
case "base64url":
|
|
633
|
-
|
|
631
|
+
G(n, U.base64url, r.message, t);
|
|
634
632
|
break;
|
|
635
633
|
case "jwt":
|
|
636
|
-
|
|
634
|
+
G(n, U.jwt, r.message, t);
|
|
637
635
|
break;
|
|
638
636
|
case "cidr":
|
|
639
|
-
r.version !== "v6" &&
|
|
637
|
+
r.version !== "v6" && G(n, U.ipv4Cidr, r.message, t), r.version !== "v4" && G(n, U.ipv6Cidr, r.message, t);
|
|
640
638
|
break;
|
|
641
639
|
case "emoji":
|
|
642
|
-
|
|
640
|
+
G(n, U.emoji(), r.message, t);
|
|
643
641
|
break;
|
|
644
642
|
case "ulid":
|
|
645
|
-
|
|
643
|
+
G(n, U.ulid, r.message, t);
|
|
646
644
|
break;
|
|
647
645
|
case "base64":
|
|
648
646
|
switch (t.base64Strategy) {
|
|
649
647
|
case "format:binary":
|
|
650
|
-
|
|
648
|
+
W(n, "binary", r.message, t);
|
|
651
649
|
break;
|
|
652
650
|
case "contentEncoding:base64":
|
|
653
651
|
n.contentEncoding = "base64";
|
|
654
652
|
break;
|
|
655
|
-
case "pattern:zod":
|
|
653
|
+
case "pattern:zod": G(n, U.base64, r.message, t);
|
|
656
654
|
}
|
|
657
655
|
break;
|
|
658
|
-
case "nanoid":
|
|
656
|
+
case "nanoid": G(n, U.nanoid, r.message, t);
|
|
659
657
|
}
|
|
660
658
|
return n;
|
|
661
659
|
}
|
|
662
|
-
function
|
|
663
|
-
return t.patternStrategy === "escape" ?
|
|
660
|
+
function dt(e, t) {
|
|
661
|
+
return t.patternStrategy === "escape" ? pt(e) : e;
|
|
664
662
|
}
|
|
665
|
-
var
|
|
666
|
-
function
|
|
663
|
+
var ft = /* @__PURE__ */ new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
664
|
+
function pt(e) {
|
|
667
665
|
let t = "";
|
|
668
|
-
for (let n = 0; n < e.length; n++)
|
|
666
|
+
for (let n = 0; n < e.length; n++) ft.has(e[n]) || (t += "\\"), t += e[n];
|
|
669
667
|
return t;
|
|
670
668
|
}
|
|
671
|
-
function
|
|
669
|
+
function W(e, t, n, r) {
|
|
672
670
|
e.format || e.anyOf?.some((e) => e.format) ? (e.anyOf ||= [], e.format && (e.anyOf.push({ format: e.format }), delete e.format), e.anyOf.push({
|
|
673
671
|
format: t,
|
|
674
672
|
...n && r.errorMessages && { errorMessage: { format: n } }
|
|
675
673
|
})) : e.format = t;
|
|
676
674
|
}
|
|
677
|
-
function
|
|
675
|
+
function G(e, t, n, r) {
|
|
678
676
|
e.pattern || e.allOf?.some((e) => e.pattern) ? (e.allOf ||= [], e.pattern && (e.allOf.push({ pattern: e.pattern }), delete e.pattern), e.allOf.push({
|
|
679
|
-
pattern:
|
|
677
|
+
pattern: mt(t, r),
|
|
680
678
|
...n && r.errorMessages && { errorMessage: { pattern: n } }
|
|
681
|
-
})) : e.pattern =
|
|
679
|
+
})) : e.pattern = mt(t, r);
|
|
682
680
|
}
|
|
683
|
-
function
|
|
681
|
+
function mt(e, t) {
|
|
684
682
|
if (!t.applyRegexFlags || !e.flags) return e.source;
|
|
685
683
|
let n = {
|
|
686
684
|
i: e.flags.includes("i"),
|
|
@@ -714,9 +712,7 @@ function At(e, t) {
|
|
|
714
712
|
}
|
|
715
713
|
}
|
|
716
714
|
if (n.s && r[e] === ".") {
|
|
717
|
-
i += o ? `${r[e]}\r
|
|
718
|
-
` : `[${r[e]}\r
|
|
719
|
-
]`;
|
|
715
|
+
i += o ? `${r[e]}\r\n` : `[${r[e]}\r\n]`;
|
|
720
716
|
continue;
|
|
721
717
|
}
|
|
722
718
|
i += r[e], r[e] === "\\" ? a = !0 : o && r[e] === "]" ? o = !1 : !o && r[e] === "[" && (o = !0);
|
|
@@ -728,16 +724,16 @@ function At(e, t) {
|
|
|
728
724
|
}
|
|
729
725
|
return i;
|
|
730
726
|
}
|
|
731
|
-
function
|
|
727
|
+
function ht(e, t) {
|
|
732
728
|
let n = {
|
|
733
729
|
type: "object",
|
|
734
|
-
additionalProperties:
|
|
730
|
+
additionalProperties: K(e.valueType._def, {
|
|
735
731
|
...t,
|
|
736
732
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
737
733
|
}) ?? t.allowedAdditionalProperties
|
|
738
734
|
};
|
|
739
735
|
if (e.keyType?._def.typeName === "ZodString" && e.keyType._def.checks?.length) {
|
|
740
|
-
let { type: r, ...i } =
|
|
736
|
+
let { type: r, ...i } = ut(e.keyType._def, t);
|
|
741
737
|
return {
|
|
742
738
|
...n,
|
|
743
739
|
propertyNames: i
|
|
@@ -748,7 +744,7 @@ function jt(e, t) {
|
|
|
748
744
|
propertyNames: { enum: e.keyType._def.values }
|
|
749
745
|
};
|
|
750
746
|
if (e.keyType?._def.typeName === "ZodBranded" && e.keyType._def.type._def.typeName === "ZodString" && e.keyType._def.type._def.checks?.length) {
|
|
751
|
-
let { type: r, ...i } =
|
|
747
|
+
let { type: r, ...i } = et(e.keyType._def, t);
|
|
752
748
|
return {
|
|
753
749
|
...n,
|
|
754
750
|
propertyNames: i
|
|
@@ -756,13 +752,13 @@ function jt(e, t) {
|
|
|
756
752
|
}
|
|
757
753
|
return n;
|
|
758
754
|
}
|
|
759
|
-
function
|
|
760
|
-
return t.mapStrategy === "record" ?
|
|
755
|
+
function gt(e, t) {
|
|
756
|
+
return t.mapStrategy === "record" ? ht(e, t) : {
|
|
761
757
|
type: "array",
|
|
762
758
|
maxItems: 125,
|
|
763
759
|
items: {
|
|
764
760
|
type: "array",
|
|
765
|
-
items: [
|
|
761
|
+
items: [K(e.keyType._def, {
|
|
766
762
|
...t,
|
|
767
763
|
currentPath: [
|
|
768
764
|
...t.currentPath,
|
|
@@ -770,7 +766,7 @@ function Mt(e, t) {
|
|
|
770
766
|
"items",
|
|
771
767
|
"0"
|
|
772
768
|
]
|
|
773
|
-
}) ||
|
|
769
|
+
}) || V(), K(e.valueType._def, {
|
|
774
770
|
...t,
|
|
775
771
|
currentPath: [
|
|
776
772
|
...t.currentPath,
|
|
@@ -778,37 +774,37 @@ function Mt(e, t) {
|
|
|
778
774
|
"items",
|
|
779
775
|
"1"
|
|
780
776
|
]
|
|
781
|
-
}) ||
|
|
777
|
+
}) || V()],
|
|
782
778
|
minItems: 2,
|
|
783
779
|
maxItems: 2
|
|
784
780
|
}
|
|
785
781
|
};
|
|
786
782
|
}
|
|
787
|
-
function
|
|
783
|
+
function _t(e) {
|
|
788
784
|
let t = e.values, n = Object.keys(e.values).filter((e) => typeof t[t[e]] != "number").map((e) => t[e]), r = Array.from(new Set(n.map((e) => typeof e)));
|
|
789
785
|
return {
|
|
790
786
|
type: r.length === 1 ? r[0] === "string" ? "string" : "number" : ["string", "number"],
|
|
791
787
|
enum: n
|
|
792
788
|
};
|
|
793
789
|
}
|
|
794
|
-
function
|
|
795
|
-
return { not:
|
|
790
|
+
function vt() {
|
|
791
|
+
return { not: V() };
|
|
796
792
|
}
|
|
797
|
-
function
|
|
793
|
+
function yt() {
|
|
798
794
|
return { type: "null" };
|
|
799
795
|
}
|
|
800
|
-
var
|
|
796
|
+
var bt = {
|
|
801
797
|
ZodString: "string",
|
|
802
798
|
ZodNumber: "number",
|
|
803
799
|
ZodBigInt: "integer",
|
|
804
800
|
ZodBoolean: "boolean",
|
|
805
801
|
ZodNull: "null"
|
|
806
802
|
};
|
|
807
|
-
function
|
|
803
|
+
function xt(e, t) {
|
|
808
804
|
let n = e.options instanceof Map ? Array.from(e.options.values()) : e.options;
|
|
809
|
-
if (n.every((e) => e._def.typeName in
|
|
805
|
+
if (n.every((e) => e._def.typeName in bt && (!e._def.checks || !e._def.checks.length))) {
|
|
810
806
|
let e = n.reduce((e, t) => {
|
|
811
|
-
let n =
|
|
807
|
+
let n = bt[t._def.typeName];
|
|
812
808
|
return n && !e.includes(n) ? [...e, n] : e;
|
|
813
809
|
}, []);
|
|
814
810
|
return { type: e.length > 1 ? e : e[0] };
|
|
@@ -836,10 +832,10 @@ function Lt(e, t) {
|
|
|
836
832
|
type: "string",
|
|
837
833
|
enum: n.reduce((e, t) => [...e, ...t._def.values.filter((t) => !e.includes(t))], [])
|
|
838
834
|
};
|
|
839
|
-
return
|
|
835
|
+
return St(e, t);
|
|
840
836
|
}
|
|
841
|
-
var
|
|
842
|
-
let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) =>
|
|
837
|
+
var St = (e, t) => {
|
|
838
|
+
let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => K(e._def, {
|
|
843
839
|
...t,
|
|
844
840
|
currentPath: [
|
|
845
841
|
...t.currentPath,
|
|
@@ -849,15 +845,15 @@ var Rt = (e, t) => {
|
|
|
849
845
|
})).filter((e) => !!e && (!t.strictUnions || typeof e == "object" && Object.keys(e).length > 0));
|
|
850
846
|
return n.length ? { anyOf: n } : void 0;
|
|
851
847
|
};
|
|
852
|
-
function
|
|
848
|
+
function Ct(e, t) {
|
|
853
849
|
if ([
|
|
854
850
|
"ZodString",
|
|
855
851
|
"ZodNumber",
|
|
856
852
|
"ZodBigInt",
|
|
857
853
|
"ZodBoolean",
|
|
858
854
|
"ZodNull"
|
|
859
|
-
].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [
|
|
860
|
-
let n =
|
|
855
|
+
].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [bt[e.innerType._def.typeName], "null"] };
|
|
856
|
+
let n = K(e.innerType._def, {
|
|
861
857
|
...t,
|
|
862
858
|
currentPath: [
|
|
863
859
|
...t.currentPath,
|
|
@@ -867,7 +863,7 @@ function zt(e, t) {
|
|
|
867
863
|
});
|
|
868
864
|
return n && { anyOf: [n, { type: "null" }] };
|
|
869
865
|
}
|
|
870
|
-
function
|
|
866
|
+
function wt(e) {
|
|
871
867
|
let t = { type: "number" };
|
|
872
868
|
if (!e.checks) return t;
|
|
873
869
|
for (let n of e.checks) switch (n.kind) {
|
|
@@ -884,7 +880,7 @@ function Bt(e) {
|
|
|
884
880
|
}
|
|
885
881
|
return t;
|
|
886
882
|
}
|
|
887
|
-
function
|
|
883
|
+
function Tt(e, t) {
|
|
888
884
|
let n = {
|
|
889
885
|
type: "object",
|
|
890
886
|
properties: {}
|
|
@@ -892,7 +888,7 @@ function Vt(e, t) {
|
|
|
892
888
|
for (let e in i) {
|
|
893
889
|
let a = i[e];
|
|
894
890
|
if (a === void 0 || a._def === void 0) continue;
|
|
895
|
-
let o =
|
|
891
|
+
let o = Dt(a), s = K(a._def, {
|
|
896
892
|
...t,
|
|
897
893
|
currentPath: [
|
|
898
894
|
...t.currentPath,
|
|
@@ -908,11 +904,11 @@ function Vt(e, t) {
|
|
|
908
904
|
s !== void 0 && (n.properties[e] = s, o || r.push(e));
|
|
909
905
|
}
|
|
910
906
|
r.length && (n.required = r);
|
|
911
|
-
let a =
|
|
907
|
+
let a = Et(e, t);
|
|
912
908
|
return a !== void 0 && (n.additionalProperties = a), n;
|
|
913
909
|
}
|
|
914
|
-
function
|
|
915
|
-
if (e.catchall._def.typeName !== "ZodNever") return
|
|
910
|
+
function Et(e, t) {
|
|
911
|
+
if (e.catchall._def.typeName !== "ZodNever") return K(e.catchall._def, {
|
|
916
912
|
...t,
|
|
917
913
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
918
914
|
});
|
|
@@ -922,16 +918,16 @@ function Ht(e, t) {
|
|
|
922
918
|
case "strip": return t.removeAdditionalStrategy === "strict" ? t.allowedAdditionalProperties : t.rejectedAdditionalProperties;
|
|
923
919
|
}
|
|
924
920
|
}
|
|
925
|
-
function
|
|
921
|
+
function Dt(e) {
|
|
926
922
|
try {
|
|
927
923
|
return e.isOptional();
|
|
928
924
|
} catch {
|
|
929
925
|
return !0;
|
|
930
926
|
}
|
|
931
927
|
}
|
|
932
|
-
var
|
|
933
|
-
if (t.currentPath.toString() === t.propertyPath?.toString()) return
|
|
934
|
-
let n =
|
|
928
|
+
var Ot = (e, t) => {
|
|
929
|
+
if (t.currentPath.toString() === t.propertyPath?.toString()) return K(e.innerType._def, t);
|
|
930
|
+
let n = K(e.innerType._def, {
|
|
935
931
|
...t,
|
|
936
932
|
currentPath: [
|
|
937
933
|
...t.currentPath,
|
|
@@ -939,11 +935,11 @@ var Wt = (e, t) => {
|
|
|
939
935
|
"1"
|
|
940
936
|
]
|
|
941
937
|
});
|
|
942
|
-
return n ? { anyOf: [{ not:
|
|
943
|
-
},
|
|
944
|
-
if (t.pipeStrategy === "input") return
|
|
945
|
-
if (t.pipeStrategy === "output") return
|
|
946
|
-
let n =
|
|
938
|
+
return n ? { anyOf: [{ not: V() }, n] } : V();
|
|
939
|
+
}, kt = (e, t) => {
|
|
940
|
+
if (t.pipeStrategy === "input") return K(e.in._def, t);
|
|
941
|
+
if (t.pipeStrategy === "output") return K(e.out._def, t);
|
|
942
|
+
let n = K(e.in._def, {
|
|
947
943
|
...t,
|
|
948
944
|
currentPath: [
|
|
949
945
|
...t.currentPath,
|
|
@@ -951,7 +947,7 @@ var Wt = (e, t) => {
|
|
|
951
947
|
"0"
|
|
952
948
|
]
|
|
953
949
|
});
|
|
954
|
-
return { allOf: [n,
|
|
950
|
+
return { allOf: [n, K(e.out._def, {
|
|
955
951
|
...t,
|
|
956
952
|
currentPath: [
|
|
957
953
|
...t.currentPath,
|
|
@@ -960,25 +956,25 @@ var Wt = (e, t) => {
|
|
|
960
956
|
]
|
|
961
957
|
})].filter((e) => e !== void 0) };
|
|
962
958
|
};
|
|
963
|
-
function
|
|
964
|
-
return
|
|
959
|
+
function At(e, t) {
|
|
960
|
+
return K(e.type._def, t);
|
|
965
961
|
}
|
|
966
|
-
function
|
|
962
|
+
function jt(e, t) {
|
|
967
963
|
let n = {
|
|
968
964
|
type: "array",
|
|
969
965
|
uniqueItems: !0,
|
|
970
|
-
items:
|
|
966
|
+
items: K(e.valueType._def, {
|
|
971
967
|
...t,
|
|
972
968
|
currentPath: [...t.currentPath, "items"]
|
|
973
969
|
})
|
|
974
970
|
};
|
|
975
971
|
return e.minSize && (n.minItems = e.minSize.value), e.maxSize && (n.maxItems = e.maxSize.value), n;
|
|
976
972
|
}
|
|
977
|
-
function
|
|
973
|
+
function Mt(e, t) {
|
|
978
974
|
return e.rest ? {
|
|
979
975
|
type: "array",
|
|
980
976
|
minItems: e.items.length,
|
|
981
|
-
items: e.items.map((e, n) =>
|
|
977
|
+
items: e.items.map((e, n) => K(e._def, {
|
|
982
978
|
...t,
|
|
983
979
|
currentPath: [
|
|
984
980
|
...t.currentPath,
|
|
@@ -986,7 +982,7 @@ function Jt(e, t) {
|
|
|
986
982
|
`${n}`
|
|
987
983
|
]
|
|
988
984
|
})).reduce((e, t) => t === void 0 ? e : [...e, t], []),
|
|
989
|
-
additionalItems:
|
|
985
|
+
additionalItems: K(e.rest._def, {
|
|
990
986
|
...t,
|
|
991
987
|
currentPath: [...t.currentPath, "additionalItems"]
|
|
992
988
|
})
|
|
@@ -994,7 +990,7 @@ function Jt(e, t) {
|
|
|
994
990
|
type: "array",
|
|
995
991
|
minItems: e.items.length,
|
|
996
992
|
maxItems: e.items.length,
|
|
997
|
-
items: e.items.map((e, n) =>
|
|
993
|
+
items: e.items.map((e, n) => K(e._def, {
|
|
998
994
|
...t,
|
|
999
995
|
currentPath: [
|
|
1000
996
|
...t.currentPath,
|
|
@@ -1004,65 +1000,67 @@ function Jt(e, t) {
|
|
|
1004
1000
|
})).reduce((e, t) => t === void 0 ? e : [...e, t], [])
|
|
1005
1001
|
};
|
|
1006
1002
|
}
|
|
1007
|
-
function
|
|
1008
|
-
return { not:
|
|
1003
|
+
function Nt() {
|
|
1004
|
+
return { not: V() };
|
|
1009
1005
|
}
|
|
1010
|
-
function
|
|
1011
|
-
return
|
|
1006
|
+
function Pt() {
|
|
1007
|
+
return V();
|
|
1012
1008
|
}
|
|
1013
|
-
var
|
|
1009
|
+
var Ft = (e, t) => K(e.innerType._def, t), It = (e, t, n) => {
|
|
1014
1010
|
switch (t) {
|
|
1015
|
-
case "ZodString": return
|
|
1016
|
-
case "ZodNumber": return
|
|
1017
|
-
case "ZodObject": return
|
|
1018
|
-
case "ZodBigInt": return
|
|
1019
|
-
case "ZodBoolean": return
|
|
1020
|
-
case "ZodDate": return
|
|
1021
|
-
case "ZodUndefined": return
|
|
1022
|
-
case "ZodNull": return
|
|
1023
|
-
case "ZodArray": return
|
|
1011
|
+
case "ZodString": return ut(e, n);
|
|
1012
|
+
case "ZodNumber": return wt(e);
|
|
1013
|
+
case "ZodObject": return Tt(e, n);
|
|
1014
|
+
case "ZodBigInt": return Qe(e);
|
|
1015
|
+
case "ZodBoolean": return $e();
|
|
1016
|
+
case "ZodDate": return nt(e, n);
|
|
1017
|
+
case "ZodUndefined": return Nt();
|
|
1018
|
+
case "ZodNull": return yt();
|
|
1019
|
+
case "ZodArray": return Ze(e, n);
|
|
1024
1020
|
case "ZodUnion":
|
|
1025
|
-
case "ZodDiscriminatedUnion": return
|
|
1026
|
-
case "ZodIntersection": return
|
|
1027
|
-
case "ZodTuple": return
|
|
1028
|
-
case "ZodRecord": return
|
|
1029
|
-
case "ZodLiteral": return
|
|
1030
|
-
case "ZodEnum": return
|
|
1031
|
-
case "ZodNativeEnum": return
|
|
1032
|
-
case "ZodNullable": return
|
|
1033
|
-
case "ZodOptional": return
|
|
1034
|
-
case "ZodMap": return
|
|
1035
|
-
case "ZodSet": return
|
|
1021
|
+
case "ZodDiscriminatedUnion": return xt(e, n);
|
|
1022
|
+
case "ZodIntersection": return st(e, n);
|
|
1023
|
+
case "ZodTuple": return Mt(e, n);
|
|
1024
|
+
case "ZodRecord": return ht(e, n);
|
|
1025
|
+
case "ZodLiteral": return ct(e);
|
|
1026
|
+
case "ZodEnum": return H(e);
|
|
1027
|
+
case "ZodNativeEnum": return _t(e);
|
|
1028
|
+
case "ZodNullable": return Ct(e, n);
|
|
1029
|
+
case "ZodOptional": return Ot(e, n);
|
|
1030
|
+
case "ZodMap": return gt(e, n);
|
|
1031
|
+
case "ZodSet": return jt(e, n);
|
|
1036
1032
|
case "ZodLazy": return () => e.getter()._def;
|
|
1037
|
-
case "ZodPromise": return
|
|
1033
|
+
case "ZodPromise": return At(e, n);
|
|
1038
1034
|
case "ZodNaN":
|
|
1039
|
-
case "ZodNever": return
|
|
1040
|
-
case "ZodEffects": return
|
|
1041
|
-
case "ZodAny": return
|
|
1042
|
-
case "ZodUnknown": return
|
|
1043
|
-
case "ZodDefault": return
|
|
1044
|
-
case "ZodBranded": return
|
|
1045
|
-
case "ZodReadonly": return
|
|
1046
|
-
case "ZodCatch": return
|
|
1047
|
-
case "ZodPipeline": return
|
|
1035
|
+
case "ZodNever": return vt();
|
|
1036
|
+
case "ZodEffects": return at(e, n);
|
|
1037
|
+
case "ZodAny": return V();
|
|
1038
|
+
case "ZodUnknown": return Pt();
|
|
1039
|
+
case "ZodDefault": return it(e, n);
|
|
1040
|
+
case "ZodBranded": return et(e, n);
|
|
1041
|
+
case "ZodReadonly": return Ft(e, n);
|
|
1042
|
+
case "ZodCatch": return tt(e, n);
|
|
1043
|
+
case "ZodPipeline": return kt(e, n);
|
|
1048
1044
|
case "ZodFunction":
|
|
1049
1045
|
case "ZodVoid":
|
|
1050
1046
|
case "ZodSymbol": return;
|
|
1051
|
-
default:
|
|
1047
|
+
default:
|
|
1048
|
+
/* c8 ignore next */
|
|
1049
|
+
return ((e) => void 0)(t);
|
|
1052
1050
|
}
|
|
1053
|
-
},
|
|
1051
|
+
}, Lt = (e, t) => {
|
|
1054
1052
|
let n = 0;
|
|
1055
1053
|
for (; n < e.length && n < t.length && e[n] === t[n]; n++);
|
|
1056
1054
|
return [(e.length - n).toString(), ...t.slice(n)].join("/");
|
|
1057
1055
|
};
|
|
1058
|
-
function
|
|
1056
|
+
function K(e, t, n = !1) {
|
|
1059
1057
|
let r = t.seen.get(e);
|
|
1060
1058
|
if (t.override) {
|
|
1061
|
-
let i = t.override?.
|
|
1062
|
-
if (i !==
|
|
1059
|
+
let i = t.override?.(e, t, r, n);
|
|
1060
|
+
if (i !== Je) return i;
|
|
1063
1061
|
}
|
|
1064
1062
|
if (r && !n) {
|
|
1065
|
-
let e =
|
|
1063
|
+
let e = Rt(r, t);
|
|
1066
1064
|
if (e !== void 0) return e;
|
|
1067
1065
|
}
|
|
1068
1066
|
let i = {
|
|
@@ -1071,22 +1069,22 @@ function W(e, t, n = !1) {
|
|
|
1071
1069
|
jsonSchema: void 0
|
|
1072
1070
|
};
|
|
1073
1071
|
t.seen.set(e, i);
|
|
1074
|
-
let a =
|
|
1075
|
-
if (o &&
|
|
1072
|
+
let a = It(e, e.typeName, t), o = typeof a == "function" ? K(a(), t) : a;
|
|
1073
|
+
if (o && zt(e, t, o), t.postProcess) {
|
|
1076
1074
|
let n = t.postProcess(o, e, t);
|
|
1077
1075
|
return i.jsonSchema = o, n;
|
|
1078
1076
|
}
|
|
1079
1077
|
return i.jsonSchema = o, o;
|
|
1080
1078
|
}
|
|
1081
|
-
var
|
|
1079
|
+
var Rt = (e, t) => {
|
|
1082
1080
|
switch (t.$refStrategy) {
|
|
1083
1081
|
case "root": return { $ref: e.path.join("/") };
|
|
1084
|
-
case "relative": return { $ref:
|
|
1082
|
+
case "relative": return { $ref: Lt(t.currentPath, e.path) };
|
|
1085
1083
|
case "none":
|
|
1086
|
-
case "seen": return e.path.length < t.currentPath.length && e.path.every((e, n) => t.currentPath[n] === e) ? (console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),
|
|
1084
|
+
case "seen": return e.path.length < t.currentPath.length && e.path.every((e, n) => t.currentPath[n] === e) ? (console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`), V()) : t.$refStrategy === "seen" ? V() : void 0;
|
|
1087
1085
|
}
|
|
1088
|
-
},
|
|
1089
|
-
let t =
|
|
1086
|
+
}, zt = (e, t, n) => (e.description && (n.description = e.description), n), Bt = (e) => {
|
|
1087
|
+
let t = Xe(e), n = t.name === void 0 ? t.basePath : [
|
|
1090
1088
|
...t.basePath,
|
|
1091
1089
|
t.definitionPath,
|
|
1092
1090
|
t.name
|
|
@@ -1105,25 +1103,25 @@ var en = (e, t) => {
|
|
|
1105
1103
|
jsonSchema: void 0
|
|
1106
1104
|
}]))
|
|
1107
1105
|
};
|
|
1108
|
-
},
|
|
1109
|
-
let n =
|
|
1106
|
+
}, Vt = (e, t) => {
|
|
1107
|
+
let n = Bt(t), r = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((e, [t, r]) => ({
|
|
1110
1108
|
...e,
|
|
1111
|
-
[t]:
|
|
1109
|
+
[t]: K(r._def, {
|
|
1112
1110
|
...n,
|
|
1113
1111
|
currentPath: [
|
|
1114
1112
|
...n.basePath,
|
|
1115
1113
|
n.definitionPath,
|
|
1116
1114
|
t
|
|
1117
1115
|
]
|
|
1118
|
-
}, !0) ??
|
|
1119
|
-
}), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a =
|
|
1116
|
+
}, !0) ?? V()
|
|
1117
|
+
}), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = K(e._def, i === void 0 ? n : {
|
|
1120
1118
|
...n,
|
|
1121
1119
|
currentPath: [
|
|
1122
1120
|
...n.basePath,
|
|
1123
1121
|
n.definitionPath,
|
|
1124
1122
|
i
|
|
1125
1123
|
]
|
|
1126
|
-
}, !1) ??
|
|
1124
|
+
}, !1) ?? V(), o = typeof t == "object" && t.name !== void 0 && t.nameStrategy === "title" ? t.name : void 0;
|
|
1127
1125
|
o !== void 0 && (a.title = o);
|
|
1128
1126
|
let s = i === void 0 ? r ? {
|
|
1129
1127
|
...a,
|
|
@@ -1140,14 +1138,14 @@ var en = (e, t) => {
|
|
|
1140
1138
|
}
|
|
1141
1139
|
};
|
|
1142
1140
|
return s.$schema = "http://json-schema.org/draft-07/schema#", s;
|
|
1143
|
-
},
|
|
1144
|
-
function
|
|
1141
|
+
}, Ht = Symbol.for("vercel.ai.schema");
|
|
1142
|
+
function Ut(e) {
|
|
1145
1143
|
let t;
|
|
1146
1144
|
return () => (t ??= e(), t);
|
|
1147
1145
|
}
|
|
1148
|
-
function
|
|
1146
|
+
function Wt(e, { validate: t } = {}) {
|
|
1149
1147
|
return {
|
|
1150
|
-
[
|
|
1148
|
+
[Ht]: !0,
|
|
1151
1149
|
_type: void 0,
|
|
1152
1150
|
get jsonSchema() {
|
|
1153
1151
|
return typeof e == "function" && (e = e()), e;
|
|
@@ -1155,20 +1153,20 @@ function sn(e, { validate: t } = {}) {
|
|
|
1155
1153
|
validate: t
|
|
1156
1154
|
};
|
|
1157
1155
|
}
|
|
1158
|
-
function
|
|
1159
|
-
return typeof e == "object" && !!e &&
|
|
1156
|
+
function Gt(e) {
|
|
1157
|
+
return typeof e == "object" && !!e && Ht in e && e[Ht] === !0 && "jsonSchema" in e && "validate" in e;
|
|
1160
1158
|
}
|
|
1161
|
-
function
|
|
1162
|
-
return e == null ?
|
|
1159
|
+
function Kt(e) {
|
|
1160
|
+
return e == null ? Wt({
|
|
1163
1161
|
type: "object",
|
|
1164
1162
|
properties: {},
|
|
1165
1163
|
additionalProperties: !1
|
|
1166
|
-
}) :
|
|
1164
|
+
}) : Gt(e) ? e : "~standard" in e ? e["~standard"].vendor === "zod" ? Qt(e) : qt(e) : e();
|
|
1167
1165
|
}
|
|
1168
|
-
function
|
|
1169
|
-
return
|
|
1170
|
-
if (!
|
|
1171
|
-
return
|
|
1166
|
+
function qt(e) {
|
|
1167
|
+
return Wt(() => {
|
|
1168
|
+
if (!Jt(e)) throw Error(`Standard schema vendor '${e["~standard"].vendor}' does not support JSON Schema conversion.`);
|
|
1169
|
+
return qe(e["~standard"].jsonSchema.input({ target: "draft-07" }));
|
|
1172
1170
|
}, { validate: async (t) => {
|
|
1173
1171
|
let n = await e["~standard"].validate(t);
|
|
1174
1172
|
return "value" in n ? {
|
|
@@ -1176,19 +1174,19 @@ function un(e) {
|
|
|
1176
1174
|
value: n.value
|
|
1177
1175
|
} : {
|
|
1178
1176
|
success: !1,
|
|
1179
|
-
error: new
|
|
1177
|
+
error: new A({
|
|
1180
1178
|
value: t,
|
|
1181
1179
|
cause: n.issues
|
|
1182
1180
|
})
|
|
1183
1181
|
};
|
|
1184
1182
|
} });
|
|
1185
1183
|
}
|
|
1186
|
-
function
|
|
1184
|
+
function Jt(e) {
|
|
1187
1185
|
return e["~standard"].jsonSchema != null;
|
|
1188
1186
|
}
|
|
1189
|
-
function
|
|
1187
|
+
function Yt(e, t) {
|
|
1190
1188
|
let n = t?.useReferences ?? !1;
|
|
1191
|
-
return
|
|
1189
|
+
return Wt(() => Vt(e, { $refStrategy: n ? "root" : "none" }), { validate: async (t) => {
|
|
1192
1190
|
let n = await e.safeParseAsync(t);
|
|
1193
1191
|
return n.success ? {
|
|
1194
1192
|
success: !0,
|
|
@@ -1199,9 +1197,9 @@ function fn(e, t) {
|
|
|
1199
1197
|
};
|
|
1200
1198
|
} });
|
|
1201
1199
|
}
|
|
1202
|
-
function
|
|
1200
|
+
function Xt(t, r) {
|
|
1203
1201
|
let i = r?.useReferences ?? !1;
|
|
1204
|
-
return
|
|
1202
|
+
return Wt(() => qe(e(t, {
|
|
1205
1203
|
target: "draft-7",
|
|
1206
1204
|
io: "input",
|
|
1207
1205
|
reused: i ? "ref" : "inline"
|
|
@@ -1216,27 +1214,27 @@ function pn(t, r) {
|
|
|
1216
1214
|
};
|
|
1217
1215
|
} });
|
|
1218
1216
|
}
|
|
1219
|
-
function
|
|
1217
|
+
function Zt(e) {
|
|
1220
1218
|
return "_zod" in e;
|
|
1221
1219
|
}
|
|
1222
|
-
function
|
|
1223
|
-
return
|
|
1220
|
+
function Qt(e, t) {
|
|
1221
|
+
return Zt(e) ? Xt(e, t) : Yt(e, t);
|
|
1224
1222
|
}
|
|
1225
|
-
async function
|
|
1226
|
-
let r = await
|
|
1223
|
+
async function $t({ value: e, schema: t, context: n }) {
|
|
1224
|
+
let r = await en({
|
|
1227
1225
|
value: e,
|
|
1228
1226
|
schema: t,
|
|
1229
1227
|
context: n
|
|
1230
1228
|
});
|
|
1231
|
-
if (!r.success) throw
|
|
1229
|
+
if (!r.success) throw A.wrap({
|
|
1232
1230
|
value: e,
|
|
1233
1231
|
cause: r.error,
|
|
1234
1232
|
context: n
|
|
1235
1233
|
});
|
|
1236
1234
|
return r.value;
|
|
1237
1235
|
}
|
|
1238
|
-
async function
|
|
1239
|
-
let r =
|
|
1236
|
+
async function en({ value: e, schema: t, context: n }) {
|
|
1237
|
+
let r = Kt(t);
|
|
1240
1238
|
try {
|
|
1241
1239
|
if (r.validate == null) return {
|
|
1242
1240
|
success: !0,
|
|
@@ -1250,7 +1248,7 @@ async function _n({ value: e, schema: t, context: n }) {
|
|
|
1250
1248
|
rawValue: e
|
|
1251
1249
|
} : {
|
|
1252
1250
|
success: !1,
|
|
1253
|
-
error:
|
|
1251
|
+
error: A.wrap({
|
|
1254
1252
|
value: e,
|
|
1255
1253
|
cause: t.error,
|
|
1256
1254
|
context: n
|
|
@@ -1260,7 +1258,7 @@ async function _n({ value: e, schema: t, context: n }) {
|
|
|
1260
1258
|
} catch (t) {
|
|
1261
1259
|
return {
|
|
1262
1260
|
success: !1,
|
|
1263
|
-
error:
|
|
1261
|
+
error: A.wrap({
|
|
1264
1262
|
value: e,
|
|
1265
1263
|
cause: t,
|
|
1266
1264
|
context: n
|
|
@@ -1269,21 +1267,21 @@ async function _n({ value: e, schema: t, context: n }) {
|
|
|
1269
1267
|
};
|
|
1270
1268
|
}
|
|
1271
1269
|
}
|
|
1272
|
-
async function
|
|
1270
|
+
async function tn({ text: e, schema: t }) {
|
|
1273
1271
|
try {
|
|
1274
|
-
let n =
|
|
1272
|
+
let n = Ke(e);
|
|
1275
1273
|
return t == null ? {
|
|
1276
1274
|
success: !0,
|
|
1277
1275
|
value: n,
|
|
1278
1276
|
rawValue: n
|
|
1279
|
-
} : await
|
|
1277
|
+
} : await en({
|
|
1280
1278
|
value: n,
|
|
1281
1279
|
schema: t
|
|
1282
1280
|
});
|
|
1283
1281
|
} catch (t) {
|
|
1284
1282
|
return {
|
|
1285
1283
|
success: !1,
|
|
1286
|
-
error:
|
|
1284
|
+
error: O.isInstance(t) ? t : new O({
|
|
1287
1285
|
text: e,
|
|
1288
1286
|
cause: t
|
|
1289
1287
|
}),
|
|
@@ -1291,98 +1289,42 @@ async function G({ text: e, schema: t }) {
|
|
|
1291
1289
|
};
|
|
1292
1290
|
}
|
|
1293
1291
|
}
|
|
1294
|
-
function
|
|
1295
|
-
return e.pipeThrough(new TextDecoderStream()).pipeThrough(new
|
|
1296
|
-
e !== "[DONE]" && n.enqueue(await
|
|
1292
|
+
function nn({ stream: e, schema: t }) {
|
|
1293
|
+
return e.pipeThrough(new TextDecoderStream()).pipeThrough(new Re()).pipeThrough(new TransformStream({ async transform({ data: e }, n) {
|
|
1294
|
+
e !== "[DONE]" && n.enqueue(await tn({
|
|
1297
1295
|
text: e,
|
|
1298
1296
|
schema: t
|
|
1299
1297
|
}));
|
|
1300
1298
|
} }));
|
|
1301
1299
|
}
|
|
1302
|
-
async function
|
|
1300
|
+
async function rn(e) {
|
|
1303
1301
|
return typeof e == "function" && (e = e()), e;
|
|
1304
1302
|
}
|
|
1305
1303
|
new TextDecoder();
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
enumerable: !0
|
|
1310
|
-
});
|
|
1311
|
-
}, xn = "AI_InvalidArgumentError", Sn = `vercel.ai.error.${xn}`, Cn = Symbol.for(Sn), wn, Tn, En = class extends (Tn = T, wn = Cn, Tn) {
|
|
1304
|
+
//#endregion
|
|
1305
|
+
//#region ../../node_modules/.pnpm/ai@7.0.123_zod@4.6.5/node_modules/ai/dist/index.js
|
|
1306
|
+
var an = "AI_InvalidArgumentError", on = `vercel.ai.error.${an}`, sn = Symbol.for(on), cn = class extends S {
|
|
1312
1307
|
constructor({ parameter: e, value: t, message: n }) {
|
|
1313
1308
|
super({
|
|
1314
|
-
name:
|
|
1309
|
+
name: an,
|
|
1315
1310
|
message: `Invalid argument for parameter ${e}: ${n}`
|
|
1316
|
-
}), this[
|
|
1311
|
+
}), this[sn] = !0, this.parameter = e, this.value = t;
|
|
1317
1312
|
}
|
|
1318
1313
|
static isInstance(e) {
|
|
1319
|
-
return
|
|
1314
|
+
return S.hasMarker(e, on);
|
|
1320
1315
|
}
|
|
1321
|
-
},
|
|
1322
|
-
constructor({ message: e = "No object generated.", cause: t, text: n, response: r, usage: i, finishReason: a }) {
|
|
1323
|
-
super({
|
|
1324
|
-
name: Dn,
|
|
1325
|
-
message: e,
|
|
1326
|
-
cause: t
|
|
1327
|
-
}), this[An] = !0, this.text = n, this.response = r, this.usage = i, this.finishReason = a;
|
|
1328
|
-
}
|
|
1329
|
-
static isInstance(e) {
|
|
1330
|
-
return T.hasMarker(e, On);
|
|
1331
|
-
}
|
|
1332
|
-
}, Mn = "AI_UIMessageStreamError", Nn = `vercel.ai.error.${Mn}`, Pn = Symbol.for(Nn), Fn, In, J = class extends (In = T, Fn = Pn, In) {
|
|
1316
|
+
}, ln = "AI_UIMessageStreamError", un = `vercel.ai.error.${ln}`, dn = Symbol.for(un), q = class extends S {
|
|
1333
1317
|
constructor({ chunkType: e, chunkId: t, message: n }) {
|
|
1334
1318
|
super({
|
|
1335
|
-
name:
|
|
1319
|
+
name: ln,
|
|
1336
1320
|
message: n
|
|
1337
|
-
}), this[
|
|
1321
|
+
}), this[dn] = !0, this.chunkType = e, this.chunkId = t;
|
|
1338
1322
|
}
|
|
1339
1323
|
static isInstance(e) {
|
|
1340
|
-
return
|
|
1341
|
-
}
|
|
1342
|
-
};
|
|
1343
|
-
function Ln({ warning: e, provider: t, model: n }) {
|
|
1344
|
-
let r = `AI SDK Warning${t != null && n != null ? ` (${t} / ${n})` : ""}:`;
|
|
1345
|
-
switch (e.type) {
|
|
1346
|
-
case "unsupported": {
|
|
1347
|
-
let t = `${r} The feature "${e.feature}" is not supported.`;
|
|
1348
|
-
return e.details && (t += ` ${e.details}`), t;
|
|
1349
|
-
}
|
|
1350
|
-
case "compatibility": {
|
|
1351
|
-
let t = `${r} The feature "${e.feature}" is used in a compatibility mode.`;
|
|
1352
|
-
return e.details && (t += ` ${e.details}`), t;
|
|
1353
|
-
}
|
|
1354
|
-
case "deprecated": return `${r} Deprecated: "${e.setting}". ${e.message}`;
|
|
1355
|
-
case "other": return `${r} ${e.message}`;
|
|
1356
|
-
default: return `${r} ${JSON.stringify(e, null, 2)}`;
|
|
1357
|
-
}
|
|
1358
|
-
}
|
|
1359
|
-
var Rn = "AI SDK Warning System: To turn off warning logging, set the AI_SDK_LOG_WARNINGS global to false.", zn = !1;
|
|
1360
|
-
function Bn({ message: e, type: t }) {
|
|
1361
|
-
typeof process < "u" && typeof process.emitWarning == "function" ? process.emitWarning(e, { type: t }) : console.warn(e);
|
|
1362
|
-
}
|
|
1363
|
-
var Vn = (e) => {
|
|
1364
|
-
if (e.warnings.length === 0) return;
|
|
1365
|
-
let t = globalThis.AI_SDK_LOG_WARNINGS;
|
|
1366
|
-
if (t !== !1) {
|
|
1367
|
-
if (typeof t == "function") {
|
|
1368
|
-
t(e);
|
|
1369
|
-
return;
|
|
1370
|
-
}
|
|
1371
|
-
zn || (zn = !0, Bn({
|
|
1372
|
-
message: Rn,
|
|
1373
|
-
type: "Warning"
|
|
1374
|
-
}));
|
|
1375
|
-
for (let t of e.warnings) Bn({
|
|
1376
|
-
message: Ln({
|
|
1377
|
-
warning: t,
|
|
1378
|
-
provider: e.provider,
|
|
1379
|
-
model: e.model
|
|
1380
|
-
}),
|
|
1381
|
-
type: t.type === "deprecated" ? "DeprecationWarning" : "Warning"
|
|
1382
|
-
});
|
|
1324
|
+
return S.hasMarker(e, un);
|
|
1383
1325
|
}
|
|
1384
1326
|
};
|
|
1385
|
-
function
|
|
1327
|
+
function fn(e, t) {
|
|
1386
1328
|
if (e === void 0 && t === void 0) return;
|
|
1387
1329
|
if (e === void 0) return t;
|
|
1388
1330
|
if (t === void 0) return e;
|
|
@@ -1391,11 +1333,11 @@ function Hn(e, t) {
|
|
|
1391
1333
|
let i = t[r];
|
|
1392
1334
|
if (i === void 0) continue;
|
|
1393
1335
|
let a = r in e ? e[r] : void 0, o = typeof i == "object" && !!i && !Array.isArray(i) && !(i instanceof Date) && !(i instanceof RegExp), s = typeof a == "object" && !!a && !Array.isArray(a) && !(a instanceof Date) && !(a instanceof RegExp);
|
|
1394
|
-
n[r] = o && s ?
|
|
1336
|
+
n[r] = o && s ? fn(a, i) : i;
|
|
1395
1337
|
}
|
|
1396
1338
|
return n;
|
|
1397
1339
|
}
|
|
1398
|
-
var
|
|
1340
|
+
var J = {
|
|
1399
1341
|
array: i,
|
|
1400
1342
|
boolean: m,
|
|
1401
1343
|
custom: o,
|
|
@@ -1413,242 +1355,236 @@ var Y = {
|
|
|
1413
1355
|
string: a,
|
|
1414
1356
|
union: _,
|
|
1415
1357
|
unknown: t
|
|
1416
|
-
},
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
])),
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
]),
|
|
1429
|
-
type:
|
|
1430
|
-
text:
|
|
1431
|
-
providerOptions:
|
|
1432
|
-
}),
|
|
1433
|
-
type:
|
|
1434
|
-
image:
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1358
|
+
}, Y = J.lazy(() => J.union([
|
|
1359
|
+
J.null(),
|
|
1360
|
+
J.string(),
|
|
1361
|
+
J.number(),
|
|
1362
|
+
J.boolean(),
|
|
1363
|
+
J.record(J.string(), Y.optional()),
|
|
1364
|
+
J.array(Y)
|
|
1365
|
+
])), X = J.record(J.string(), J.record(J.string(), Y.optional())), pn = J.union([
|
|
1366
|
+
J.string(),
|
|
1367
|
+
J.instanceof(Uint8Array),
|
|
1368
|
+
J.instanceof(ArrayBuffer),
|
|
1369
|
+
J.custom(Ve, { message: "Must be a Buffer" })
|
|
1370
|
+
]), mn = J.record(J.string(), J.string()), hn = J.object({
|
|
1371
|
+
type: J.literal("text"),
|
|
1372
|
+
text: J.string(),
|
|
1373
|
+
providerOptions: X.optional()
|
|
1374
|
+
}), gn = J.object({
|
|
1375
|
+
type: J.literal("image"),
|
|
1376
|
+
image: J.union([
|
|
1377
|
+
pn,
|
|
1378
|
+
J.instanceof(URL),
|
|
1379
|
+
mn
|
|
1438
1380
|
]),
|
|
1439
|
-
mediaType:
|
|
1440
|
-
providerOptions:
|
|
1441
|
-
}),
|
|
1442
|
-
|
|
1443
|
-
type:
|
|
1444
|
-
data:
|
|
1381
|
+
mediaType: J.string().optional(),
|
|
1382
|
+
providerOptions: X.optional()
|
|
1383
|
+
}), _n = J.discriminatedUnion("type", [
|
|
1384
|
+
J.object({
|
|
1385
|
+
type: J.literal("data"),
|
|
1386
|
+
data: pn
|
|
1445
1387
|
}),
|
|
1446
|
-
|
|
1447
|
-
type:
|
|
1448
|
-
url:
|
|
1388
|
+
J.object({
|
|
1389
|
+
type: J.literal("url"),
|
|
1390
|
+
url: J.instanceof(URL)
|
|
1449
1391
|
}),
|
|
1450
|
-
|
|
1451
|
-
type:
|
|
1452
|
-
reference:
|
|
1392
|
+
J.object({
|
|
1393
|
+
type: J.literal("reference"),
|
|
1394
|
+
reference: mn
|
|
1453
1395
|
}),
|
|
1454
|
-
|
|
1455
|
-
type:
|
|
1456
|
-
text:
|
|
1396
|
+
J.object({
|
|
1397
|
+
type: J.literal("text"),
|
|
1398
|
+
text: J.string()
|
|
1457
1399
|
})
|
|
1458
|
-
]),
|
|
1459
|
-
type:
|
|
1460
|
-
data:
|
|
1461
|
-
}),
|
|
1462
|
-
type:
|
|
1463
|
-
url:
|
|
1464
|
-
})]),
|
|
1465
|
-
type:
|
|
1466
|
-
data:
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1400
|
+
]), vn = J.discriminatedUnion("type", [J.object({
|
|
1401
|
+
type: J.literal("data"),
|
|
1402
|
+
data: pn
|
|
1403
|
+
}), J.object({
|
|
1404
|
+
type: J.literal("url"),
|
|
1405
|
+
url: J.instanceof(URL)
|
|
1406
|
+
})]), yn = J.object({
|
|
1407
|
+
type: J.literal("file"),
|
|
1408
|
+
data: J.union([
|
|
1409
|
+
_n,
|
|
1410
|
+
pn,
|
|
1411
|
+
J.instanceof(URL),
|
|
1412
|
+
mn
|
|
1471
1413
|
]),
|
|
1472
|
-
filename:
|
|
1473
|
-
mediaType:
|
|
1474
|
-
providerOptions:
|
|
1475
|
-
}),
|
|
1476
|
-
type:
|
|
1477
|
-
text:
|
|
1478
|
-
providerOptions:
|
|
1479
|
-
}),
|
|
1480
|
-
type:
|
|
1481
|
-
kind:
|
|
1482
|
-
providerOptions:
|
|
1483
|
-
}),
|
|
1484
|
-
type:
|
|
1485
|
-
data:
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1414
|
+
filename: J.string().optional(),
|
|
1415
|
+
mediaType: J.string(),
|
|
1416
|
+
providerOptions: X.optional()
|
|
1417
|
+
}), bn = J.object({
|
|
1418
|
+
type: J.literal("reasoning"),
|
|
1419
|
+
text: J.string(),
|
|
1420
|
+
providerOptions: X.optional()
|
|
1421
|
+
}), xn = J.object({
|
|
1422
|
+
type: J.literal("custom"),
|
|
1423
|
+
kind: J.string().transform((e) => e),
|
|
1424
|
+
providerOptions: X.optional()
|
|
1425
|
+
}), Sn = J.object({
|
|
1426
|
+
type: J.literal("reasoning-file"),
|
|
1427
|
+
data: J.union([
|
|
1428
|
+
vn,
|
|
1429
|
+
pn,
|
|
1430
|
+
J.instanceof(URL)
|
|
1489
1431
|
]),
|
|
1490
|
-
mediaType:
|
|
1491
|
-
providerOptions:
|
|
1492
|
-
}),
|
|
1493
|
-
type:
|
|
1494
|
-
toolCallId:
|
|
1495
|
-
toolName:
|
|
1496
|
-
input:
|
|
1497
|
-
providerOptions:
|
|
1498
|
-
providerExecuted:
|
|
1499
|
-
}),
|
|
1500
|
-
|
|
1501
|
-
type:
|
|
1502
|
-
value:
|
|
1503
|
-
providerOptions:
|
|
1432
|
+
mediaType: J.string(),
|
|
1433
|
+
providerOptions: X.optional()
|
|
1434
|
+
}), Cn = J.object({
|
|
1435
|
+
type: J.literal("tool-call"),
|
|
1436
|
+
toolCallId: J.string(),
|
|
1437
|
+
toolName: J.string(),
|
|
1438
|
+
input: J.unknown(),
|
|
1439
|
+
providerOptions: X.optional(),
|
|
1440
|
+
providerExecuted: J.boolean().optional()
|
|
1441
|
+
}), wn = J.discriminatedUnion("type", [
|
|
1442
|
+
J.object({
|
|
1443
|
+
type: J.literal("text"),
|
|
1444
|
+
value: J.string(),
|
|
1445
|
+
providerOptions: X.optional()
|
|
1504
1446
|
}),
|
|
1505
|
-
|
|
1506
|
-
type:
|
|
1507
|
-
value:
|
|
1508
|
-
providerOptions:
|
|
1447
|
+
J.object({
|
|
1448
|
+
type: J.literal("json"),
|
|
1449
|
+
value: Y,
|
|
1450
|
+
providerOptions: X.optional()
|
|
1509
1451
|
}),
|
|
1510
|
-
|
|
1511
|
-
type:
|
|
1512
|
-
reason:
|
|
1513
|
-
providerOptions:
|
|
1452
|
+
J.object({
|
|
1453
|
+
type: J.literal("execution-denied"),
|
|
1454
|
+
reason: J.string().optional(),
|
|
1455
|
+
providerOptions: X.optional()
|
|
1514
1456
|
}),
|
|
1515
|
-
|
|
1516
|
-
type:
|
|
1517
|
-
value:
|
|
1518
|
-
providerOptions:
|
|
1457
|
+
J.object({
|
|
1458
|
+
type: J.literal("error-text"),
|
|
1459
|
+
value: J.string(),
|
|
1460
|
+
providerOptions: X.optional()
|
|
1519
1461
|
}),
|
|
1520
|
-
|
|
1521
|
-
type:
|
|
1522
|
-
value:
|
|
1523
|
-
providerOptions:
|
|
1462
|
+
J.object({
|
|
1463
|
+
type: J.literal("error-json"),
|
|
1464
|
+
value: Y,
|
|
1465
|
+
providerOptions: X.optional()
|
|
1524
1466
|
}),
|
|
1525
|
-
|
|
1526
|
-
type:
|
|
1527
|
-
value:
|
|
1528
|
-
|
|
1529
|
-
type:
|
|
1530
|
-
text:
|
|
1531
|
-
providerOptions:
|
|
1467
|
+
J.object({
|
|
1468
|
+
type: J.literal("content"),
|
|
1469
|
+
value: J.array(J.union([
|
|
1470
|
+
J.object({
|
|
1471
|
+
type: J.literal("text"),
|
|
1472
|
+
text: J.string(),
|
|
1473
|
+
providerOptions: X.optional()
|
|
1532
1474
|
}),
|
|
1533
|
-
|
|
1534
|
-
type:
|
|
1535
|
-
data:
|
|
1536
|
-
mediaType:
|
|
1537
|
-
filename:
|
|
1538
|
-
providerOptions:
|
|
1475
|
+
J.object({
|
|
1476
|
+
type: J.literal("file"),
|
|
1477
|
+
data: _n,
|
|
1478
|
+
mediaType: J.string(),
|
|
1479
|
+
filename: J.string().optional(),
|
|
1480
|
+
providerOptions: X.optional()
|
|
1539
1481
|
}),
|
|
1540
|
-
|
|
1541
|
-
type:
|
|
1542
|
-
data:
|
|
1543
|
-
mediaType:
|
|
1544
|
-
filename:
|
|
1545
|
-
providerOptions:
|
|
1482
|
+
J.object({
|
|
1483
|
+
type: J.literal("file-data"),
|
|
1484
|
+
data: J.string(),
|
|
1485
|
+
mediaType: J.string(),
|
|
1486
|
+
filename: J.string().optional(),
|
|
1487
|
+
providerOptions: X.optional()
|
|
1546
1488
|
}),
|
|
1547
|
-
|
|
1548
|
-
type:
|
|
1549
|
-
url:
|
|
1550
|
-
mediaType:
|
|
1551
|
-
providerOptions:
|
|
1489
|
+
J.object({
|
|
1490
|
+
type: J.literal("file-url"),
|
|
1491
|
+
url: J.string(),
|
|
1492
|
+
mediaType: J.string().optional(),
|
|
1493
|
+
providerOptions: X.optional()
|
|
1552
1494
|
}),
|
|
1553
|
-
|
|
1554
|
-
type:
|
|
1555
|
-
fileId:
|
|
1556
|
-
providerOptions:
|
|
1495
|
+
J.object({
|
|
1496
|
+
type: J.literal("file-id"),
|
|
1497
|
+
fileId: J.union([J.string(), J.record(J.string(), J.string())]),
|
|
1498
|
+
providerOptions: X.optional()
|
|
1557
1499
|
}),
|
|
1558
|
-
|
|
1559
|
-
type:
|
|
1560
|
-
providerReference:
|
|
1561
|
-
providerOptions:
|
|
1500
|
+
J.object({
|
|
1501
|
+
type: J.literal("file-reference"),
|
|
1502
|
+
providerReference: J.record(J.string(), J.string()),
|
|
1503
|
+
providerOptions: X.optional()
|
|
1562
1504
|
}),
|
|
1563
|
-
|
|
1564
|
-
type:
|
|
1565
|
-
data:
|
|
1566
|
-
mediaType:
|
|
1567
|
-
providerOptions:
|
|
1505
|
+
J.object({
|
|
1506
|
+
type: J.literal("image-data"),
|
|
1507
|
+
data: J.string(),
|
|
1508
|
+
mediaType: J.string(),
|
|
1509
|
+
providerOptions: X.optional()
|
|
1568
1510
|
}),
|
|
1569
|
-
|
|
1570
|
-
type:
|
|
1571
|
-
url:
|
|
1572
|
-
providerOptions:
|
|
1511
|
+
J.object({
|
|
1512
|
+
type: J.literal("image-url"),
|
|
1513
|
+
url: J.string(),
|
|
1514
|
+
providerOptions: X.optional()
|
|
1573
1515
|
}),
|
|
1574
|
-
|
|
1575
|
-
type:
|
|
1576
|
-
fileId:
|
|
1577
|
-
providerOptions:
|
|
1516
|
+
J.object({
|
|
1517
|
+
type: J.literal("image-file-id"),
|
|
1518
|
+
fileId: J.union([J.string(), J.record(J.string(), J.string())]),
|
|
1519
|
+
providerOptions: X.optional()
|
|
1578
1520
|
}),
|
|
1579
|
-
|
|
1580
|
-
type:
|
|
1581
|
-
providerReference:
|
|
1582
|
-
providerOptions:
|
|
1521
|
+
J.object({
|
|
1522
|
+
type: J.literal("image-file-reference"),
|
|
1523
|
+
providerReference: J.record(J.string(), J.string()),
|
|
1524
|
+
providerOptions: X.optional()
|
|
1583
1525
|
}),
|
|
1584
|
-
|
|
1585
|
-
type:
|
|
1586
|
-
providerOptions:
|
|
1526
|
+
J.object({
|
|
1527
|
+
type: J.literal("custom"),
|
|
1528
|
+
providerOptions: X.optional()
|
|
1587
1529
|
})
|
|
1588
1530
|
]))
|
|
1589
1531
|
})
|
|
1590
|
-
]),
|
|
1591
|
-
type:
|
|
1592
|
-
toolCallId:
|
|
1593
|
-
toolName:
|
|
1594
|
-
output:
|
|
1595
|
-
providerOptions:
|
|
1596
|
-
}),
|
|
1597
|
-
type:
|
|
1598
|
-
approvalId:
|
|
1599
|
-
toolCallId:
|
|
1600
|
-
reason:
|
|
1601
|
-
isAutomatic:
|
|
1602
|
-
signature:
|
|
1603
|
-
inputSchemaInput:
|
|
1604
|
-
}),
|
|
1605
|
-
type:
|
|
1606
|
-
approvalId:
|
|
1607
|
-
approved:
|
|
1608
|
-
reason:
|
|
1609
|
-
}),
|
|
1610
|
-
role:
|
|
1611
|
-
content:
|
|
1612
|
-
providerOptions:
|
|
1613
|
-
}),
|
|
1614
|
-
role:
|
|
1615
|
-
content:
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1532
|
+
]), Tn = J.object({
|
|
1533
|
+
type: J.literal("tool-result"),
|
|
1534
|
+
toolCallId: J.string(),
|
|
1535
|
+
toolName: J.string(),
|
|
1536
|
+
output: wn,
|
|
1537
|
+
providerOptions: X.optional()
|
|
1538
|
+
}), En = J.object({
|
|
1539
|
+
type: J.literal("tool-approval-request"),
|
|
1540
|
+
approvalId: J.string(),
|
|
1541
|
+
toolCallId: J.string(),
|
|
1542
|
+
reason: J.string().optional(),
|
|
1543
|
+
isAutomatic: J.boolean().optional(),
|
|
1544
|
+
signature: J.string().optional(),
|
|
1545
|
+
inputSchemaInput: J.unknown().optional()
|
|
1546
|
+
}), Dn = J.object({
|
|
1547
|
+
type: J.literal("tool-approval-response"),
|
|
1548
|
+
approvalId: J.string(),
|
|
1549
|
+
approved: J.boolean(),
|
|
1550
|
+
reason: J.string().optional()
|
|
1551
|
+
}), On = J.object({
|
|
1552
|
+
role: J.literal("system"),
|
|
1553
|
+
content: J.string(),
|
|
1554
|
+
providerOptions: X.optional()
|
|
1555
|
+
}), kn = J.object({
|
|
1556
|
+
role: J.literal("user"),
|
|
1557
|
+
content: J.union([J.string(), J.array(J.union([
|
|
1558
|
+
hn,
|
|
1559
|
+
gn,
|
|
1560
|
+
yn
|
|
1619
1561
|
]))]),
|
|
1620
|
-
providerOptions:
|
|
1621
|
-
}),
|
|
1622
|
-
role:
|
|
1623
|
-
content:
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1562
|
+
providerOptions: X.optional()
|
|
1563
|
+
}), An = J.object({
|
|
1564
|
+
role: J.literal("assistant"),
|
|
1565
|
+
content: J.union([J.string(), J.array(J.union([
|
|
1566
|
+
hn,
|
|
1567
|
+
xn,
|
|
1568
|
+
yn,
|
|
1569
|
+
bn,
|
|
1570
|
+
Sn,
|
|
1571
|
+
Cn,
|
|
1572
|
+
Tn,
|
|
1573
|
+
En
|
|
1632
1574
|
]))]),
|
|
1633
|
-
providerOptions:
|
|
1634
|
-
}),
|
|
1635
|
-
role:
|
|
1636
|
-
content:
|
|
1637
|
-
providerOptions:
|
|
1575
|
+
providerOptions: X.optional()
|
|
1576
|
+
}), jn = J.object({
|
|
1577
|
+
role: J.literal("tool"),
|
|
1578
|
+
content: J.array(J.union([Tn, Dn])),
|
|
1579
|
+
providerOptions: X.optional()
|
|
1638
1580
|
});
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
])
|
|
1645
|
-
|
|
1646
|
-
choice: () => hr,
|
|
1647
|
-
json: () => gr,
|
|
1648
|
-
object: () => dr,
|
|
1649
|
-
text: () => ur
|
|
1650
|
-
});
|
|
1651
|
-
function cr(e) {
|
|
1581
|
+
J.union([
|
|
1582
|
+
On,
|
|
1583
|
+
kn,
|
|
1584
|
+
An,
|
|
1585
|
+
jn
|
|
1586
|
+
]);
|
|
1587
|
+
function Mn(e) {
|
|
1652
1588
|
let t = ["ROOT"], n = -1, r = null, i = 0;
|
|
1653
1589
|
function a(e) {
|
|
1654
1590
|
return e >= "0" && e <= "9" || e >= "A" && e <= "F" || e >= "a" && e <= "f";
|
|
@@ -1830,16 +1766,16 @@ function cr(e) {
|
|
|
1830
1766
|
}
|
|
1831
1767
|
return l;
|
|
1832
1768
|
}
|
|
1833
|
-
async function
|
|
1769
|
+
async function Nn(e) {
|
|
1834
1770
|
if (e === void 0) return {
|
|
1835
1771
|
value: void 0,
|
|
1836
1772
|
state: "undefined-input"
|
|
1837
1773
|
};
|
|
1838
|
-
let t = await
|
|
1774
|
+
let t = await tn({ text: e });
|
|
1839
1775
|
return t.success ? {
|
|
1840
1776
|
value: t.value,
|
|
1841
1777
|
state: "successful-parse"
|
|
1842
|
-
} : (t = await
|
|
1778
|
+
} : (t = await tn({ text: Mn(e) }), t.success ? {
|
|
1843
1779
|
value: t.value,
|
|
1844
1780
|
state: "repaired-parse"
|
|
1845
1781
|
} : {
|
|
@@ -1847,471 +1783,178 @@ async function lr(e) {
|
|
|
1847
1783
|
state: "failed-parse"
|
|
1848
1784
|
});
|
|
1849
1785
|
}
|
|
1850
|
-
|
|
1851
|
-
name: "text",
|
|
1852
|
-
responseFormat: Promise.resolve({ type: "text" }),
|
|
1853
|
-
async parseCompleteOutput({ text: e }) {
|
|
1854
|
-
return e;
|
|
1855
|
-
},
|
|
1856
|
-
async parsePartialOutput({ text: e }) {
|
|
1857
|
-
return { partial: e };
|
|
1858
|
-
},
|
|
1859
|
-
createElementStreamTransform() {}
|
|
1860
|
-
}), dr = ({ schema: e, name: t, description: n }) => {
|
|
1861
|
-
let r = ln(e);
|
|
1862
|
-
return {
|
|
1863
|
-
name: "object",
|
|
1864
|
-
responseFormat: K(r.jsonSchema).then((e) => ({
|
|
1865
|
-
type: "json",
|
|
1866
|
-
schema: e,
|
|
1867
|
-
...t != null && { name: t },
|
|
1868
|
-
...n != null && { description: n }
|
|
1869
|
-
})),
|
|
1870
|
-
async parseCompleteOutput({ text: e }, t) {
|
|
1871
|
-
let n = await G({ text: e });
|
|
1872
|
-
if (!n.success) throw new q({
|
|
1873
|
-
message: "No object generated: could not parse the response.",
|
|
1874
|
-
cause: n.error,
|
|
1875
|
-
text: e,
|
|
1876
|
-
response: t.response,
|
|
1877
|
-
usage: t.usage,
|
|
1878
|
-
finishReason: t.finishReason
|
|
1879
|
-
});
|
|
1880
|
-
let i = await _n({
|
|
1881
|
-
value: n.value,
|
|
1882
|
-
schema: r
|
|
1883
|
-
});
|
|
1884
|
-
if (!i.success) throw new q({
|
|
1885
|
-
message: "No object generated: response did not match schema.",
|
|
1886
|
-
cause: i.error,
|
|
1887
|
-
text: e,
|
|
1888
|
-
response: t.response,
|
|
1889
|
-
usage: t.usage,
|
|
1890
|
-
finishReason: t.finishReason
|
|
1891
|
-
});
|
|
1892
|
-
return i.value;
|
|
1893
|
-
},
|
|
1894
|
-
async parsePartialOutput({ text: e }) {
|
|
1895
|
-
let t = await lr(e);
|
|
1896
|
-
switch (t.state) {
|
|
1897
|
-
case "failed-parse":
|
|
1898
|
-
case "undefined-input": return;
|
|
1899
|
-
case "repaired-parse":
|
|
1900
|
-
case "successful-parse": return { partial: t.value };
|
|
1901
|
-
}
|
|
1902
|
-
},
|
|
1903
|
-
createElementStreamTransform() {}
|
|
1904
|
-
};
|
|
1905
|
-
}, fr = ({ element: e, minItems: t, maxItems: n, name: r, description: i }) => {
|
|
1906
|
-
if (pr({
|
|
1907
|
-
name: "minItems",
|
|
1908
|
-
value: t
|
|
1909
|
-
}), pr({
|
|
1910
|
-
name: "maxItems",
|
|
1911
|
-
value: n
|
|
1912
|
-
}), t != null && n != null && t > n) throw new En({
|
|
1913
|
-
parameter: "minItems",
|
|
1914
|
-
value: t,
|
|
1915
|
-
message: "minItems must be less than or equal to maxItems"
|
|
1916
|
-
});
|
|
1917
|
-
let a = ln(e);
|
|
1918
|
-
return {
|
|
1919
|
-
name: "array",
|
|
1920
|
-
responseFormat: K(a.jsonSchema).then((e) => {
|
|
1921
|
-
let { $schema: a, definitions: o, $defs: s, ...c } = e;
|
|
1922
|
-
return {
|
|
1923
|
-
type: "json",
|
|
1924
|
-
schema: {
|
|
1925
|
-
$schema: "http://json-schema.org/draft-07/schema#",
|
|
1926
|
-
...o != null && { definitions: o },
|
|
1927
|
-
...s != null && { $defs: s },
|
|
1928
|
-
type: "object",
|
|
1929
|
-
properties: { elements: {
|
|
1930
|
-
type: "array",
|
|
1931
|
-
items: c,
|
|
1932
|
-
...t != null && { minItems: t },
|
|
1933
|
-
...n != null && { maxItems: n }
|
|
1934
|
-
} },
|
|
1935
|
-
required: ["elements"],
|
|
1936
|
-
additionalProperties: !1
|
|
1937
|
-
},
|
|
1938
|
-
...r != null && { name: r },
|
|
1939
|
-
...i != null && { description: i }
|
|
1940
|
-
};
|
|
1941
|
-
}),
|
|
1942
|
-
async parseCompleteOutput({ text: e }, r) {
|
|
1943
|
-
let i = await G({ text: e });
|
|
1944
|
-
if (!i.success) throw new q({
|
|
1945
|
-
message: "No object generated: could not parse the response.",
|
|
1946
|
-
cause: i.error,
|
|
1947
|
-
text: e,
|
|
1948
|
-
response: r.response,
|
|
1949
|
-
usage: r.usage,
|
|
1950
|
-
finishReason: r.finishReason
|
|
1951
|
-
});
|
|
1952
|
-
let o = i.value;
|
|
1953
|
-
if (typeof o != "object" || !o || !("elements" in o) || !Array.isArray(o.elements)) throw new q({
|
|
1954
|
-
message: "No object generated: response did not match schema.",
|
|
1955
|
-
cause: new P({
|
|
1956
|
-
value: o,
|
|
1957
|
-
cause: "response must be an object with an elements array"
|
|
1958
|
-
}),
|
|
1959
|
-
text: e,
|
|
1960
|
-
response: r.response,
|
|
1961
|
-
usage: r.usage,
|
|
1962
|
-
finishReason: r.finishReason
|
|
1963
|
-
});
|
|
1964
|
-
let s = mr({
|
|
1965
|
-
value: o.elements,
|
|
1966
|
-
minItems: t,
|
|
1967
|
-
maxItems: n
|
|
1968
|
-
});
|
|
1969
|
-
if (s != null) throw new q({
|
|
1970
|
-
message: "No object generated: response did not match schema.",
|
|
1971
|
-
cause: s,
|
|
1972
|
-
text: e,
|
|
1973
|
-
response: r.response,
|
|
1974
|
-
usage: r.usage,
|
|
1975
|
-
finishReason: r.finishReason
|
|
1976
|
-
});
|
|
1977
|
-
let c = [];
|
|
1978
|
-
for (let t of o.elements) {
|
|
1979
|
-
let n = await _n({
|
|
1980
|
-
value: t,
|
|
1981
|
-
schema: a
|
|
1982
|
-
});
|
|
1983
|
-
if (!n.success) throw new q({
|
|
1984
|
-
message: "No object generated: response did not match schema.",
|
|
1985
|
-
cause: n.error,
|
|
1986
|
-
text: e,
|
|
1987
|
-
response: r.response,
|
|
1988
|
-
usage: r.usage,
|
|
1989
|
-
finishReason: r.finishReason
|
|
1990
|
-
});
|
|
1991
|
-
c.push(n.value);
|
|
1992
|
-
}
|
|
1993
|
-
return c;
|
|
1994
|
-
},
|
|
1995
|
-
async parsePartialOutput({ text: e }) {
|
|
1996
|
-
let t = await lr(e);
|
|
1997
|
-
switch (t.state) {
|
|
1998
|
-
case "failed-parse":
|
|
1999
|
-
case "undefined-input": return;
|
|
2000
|
-
case "repaired-parse":
|
|
2001
|
-
case "successful-parse": {
|
|
2002
|
-
let e = t.value;
|
|
2003
|
-
if (typeof e != "object" || !e || !("elements" in e) || !Array.isArray(e.elements)) return;
|
|
2004
|
-
let n = t.state === "repaired-parse" && e.elements.length > 0 ? e.elements.slice(0, -1) : e.elements, r = [];
|
|
2005
|
-
for (let e of n) {
|
|
2006
|
-
let t = await _n({
|
|
2007
|
-
value: e,
|
|
2008
|
-
schema: a
|
|
2009
|
-
});
|
|
2010
|
-
t.success && r.push(t.value);
|
|
2011
|
-
}
|
|
2012
|
-
return { partial: r };
|
|
2013
|
-
}
|
|
2014
|
-
}
|
|
2015
|
-
},
|
|
2016
|
-
createElementStreamTransform() {
|
|
2017
|
-
let e = 0;
|
|
2018
|
-
return new TransformStream({ transform({ partialOutput: t }, r) {
|
|
2019
|
-
if (t != null) for (; e < t.length; e++) {
|
|
2020
|
-
if (n != null && e >= n) {
|
|
2021
|
-
r.error(mr({
|
|
2022
|
-
value: t,
|
|
2023
|
-
maxItems: n
|
|
2024
|
-
}));
|
|
2025
|
-
return;
|
|
2026
|
-
}
|
|
2027
|
-
r.enqueue(t[e]);
|
|
2028
|
-
}
|
|
2029
|
-
} });
|
|
2030
|
-
}
|
|
2031
|
-
};
|
|
2032
|
-
};
|
|
2033
|
-
function pr({ name: e, value: t }) {
|
|
2034
|
-
if (t != null) {
|
|
2035
|
-
if (!Number.isInteger(t)) throw new En({
|
|
2036
|
-
parameter: e,
|
|
2037
|
-
value: t,
|
|
2038
|
-
message: `${e} must be an integer`
|
|
2039
|
-
});
|
|
2040
|
-
if (t < 0) throw new En({
|
|
2041
|
-
parameter: e,
|
|
2042
|
-
value: t,
|
|
2043
|
-
message: `${e} must be greater than or equal to 0`
|
|
2044
|
-
});
|
|
2045
|
-
}
|
|
2046
|
-
}
|
|
2047
|
-
function mr({ value: e, minItems: t, maxItems: n }) {
|
|
2048
|
-
if (t != null && e.length < t) return new P({
|
|
2049
|
-
value: e,
|
|
2050
|
-
cause: `elements array must contain at least ${t} items`
|
|
2051
|
-
});
|
|
2052
|
-
if (n != null && e.length > n) return new P({
|
|
2053
|
-
value: e,
|
|
2054
|
-
cause: `elements array must contain at most ${n} items`
|
|
2055
|
-
});
|
|
2056
|
-
}
|
|
2057
|
-
var hr = ({ options: e, name: t, description: n }) => ({
|
|
2058
|
-
name: "choice",
|
|
2059
|
-
responseFormat: Promise.resolve({
|
|
2060
|
-
type: "json",
|
|
2061
|
-
schema: {
|
|
2062
|
-
$schema: "http://json-schema.org/draft-07/schema#",
|
|
2063
|
-
type: "object",
|
|
2064
|
-
properties: { result: {
|
|
2065
|
-
type: "string",
|
|
2066
|
-
enum: e
|
|
2067
|
-
} },
|
|
2068
|
-
required: ["result"],
|
|
2069
|
-
additionalProperties: !1
|
|
2070
|
-
},
|
|
2071
|
-
...t != null && { name: t },
|
|
2072
|
-
...n != null && { description: n }
|
|
2073
|
-
}),
|
|
2074
|
-
async parseCompleteOutput({ text: t }, n) {
|
|
2075
|
-
let r = await G({ text: t });
|
|
2076
|
-
if (!r.success) throw new q({
|
|
2077
|
-
message: "No object generated: could not parse the response.",
|
|
2078
|
-
cause: r.error,
|
|
2079
|
-
text: t,
|
|
2080
|
-
response: n.response,
|
|
2081
|
-
usage: n.usage,
|
|
2082
|
-
finishReason: n.finishReason
|
|
2083
|
-
});
|
|
2084
|
-
let i = r.value;
|
|
2085
|
-
if (typeof i != "object" || !i || !("result" in i) || typeof i.result != "string" || !e.includes(i.result)) throw new q({
|
|
2086
|
-
message: "No object generated: response did not match schema.",
|
|
2087
|
-
cause: new P({
|
|
2088
|
-
value: i,
|
|
2089
|
-
cause: "response must be an object that contains a choice value."
|
|
2090
|
-
}),
|
|
2091
|
-
text: t,
|
|
2092
|
-
response: n.response,
|
|
2093
|
-
usage: n.usage,
|
|
2094
|
-
finishReason: n.finishReason
|
|
2095
|
-
});
|
|
2096
|
-
return i.result;
|
|
2097
|
-
},
|
|
2098
|
-
async parsePartialOutput({ text: t }) {
|
|
2099
|
-
let n = await lr(t);
|
|
2100
|
-
switch (n.state) {
|
|
2101
|
-
case "failed-parse":
|
|
2102
|
-
case "undefined-input": return;
|
|
2103
|
-
case "repaired-parse":
|
|
2104
|
-
case "successful-parse": {
|
|
2105
|
-
let t = n.value;
|
|
2106
|
-
if (typeof t != "object" || !t || !("result" in t) || typeof t.result != "string") return;
|
|
2107
|
-
let r = e.filter((e) => e.startsWith(t.result));
|
|
2108
|
-
return n.state === "successful-parse" ? r.includes(t.result) ? { partial: t.result } : void 0 : r.length === 1 ? { partial: r[0] } : void 0;
|
|
2109
|
-
}
|
|
2110
|
-
}
|
|
2111
|
-
},
|
|
2112
|
-
createElementStreamTransform() {}
|
|
2113
|
-
}), gr = ({ name: e, description: t } = {}) => ({
|
|
2114
|
-
name: "json",
|
|
2115
|
-
responseFormat: Promise.resolve({
|
|
2116
|
-
type: "json",
|
|
2117
|
-
...e != null && { name: e },
|
|
2118
|
-
...t != null && { description: t }
|
|
2119
|
-
}),
|
|
2120
|
-
async parseCompleteOutput({ text: e }, t) {
|
|
2121
|
-
let n = await G({ text: e });
|
|
2122
|
-
if (!n.success) throw new q({
|
|
2123
|
-
message: "No object generated: could not parse the response.",
|
|
2124
|
-
cause: n.error,
|
|
2125
|
-
text: e,
|
|
2126
|
-
response: t.response,
|
|
2127
|
-
usage: t.usage,
|
|
2128
|
-
finishReason: t.finishReason
|
|
2129
|
-
});
|
|
2130
|
-
return n.value;
|
|
2131
|
-
},
|
|
2132
|
-
async parsePartialOutput({ text: e }) {
|
|
2133
|
-
let t = await lr(e);
|
|
2134
|
-
switch (t.state) {
|
|
2135
|
-
case "failed-parse":
|
|
2136
|
-
case "undefined-input": return;
|
|
2137
|
-
case "repaired-parse":
|
|
2138
|
-
case "successful-parse": return t.value === void 0 ? void 0 : { partial: t.value };
|
|
2139
|
-
}
|
|
2140
|
-
},
|
|
2141
|
-
createElementStreamTransform() {}
|
|
2142
|
-
});
|
|
2143
|
-
new TextEncoder(), new TextEncoder(), L({
|
|
1786
|
+
new TextEncoder(), new TextEncoder(), R({
|
|
2144
1787
|
prefix: "aitxt",
|
|
2145
1788
|
size: 24
|
|
2146
|
-
}),
|
|
1789
|
+
}), R({
|
|
2147
1790
|
prefix: "call",
|
|
2148
1791
|
size: 24
|
|
2149
1792
|
}), TransformStream;
|
|
2150
|
-
var
|
|
2151
|
-
|
|
2152
|
-
type:
|
|
2153
|
-
id:
|
|
2154
|
-
providerMetadata:
|
|
1793
|
+
var Pn = J.record(J.string(), Y.optional()), Fn = Ut(() => Qt(J.union([
|
|
1794
|
+
J.looseObject({
|
|
1795
|
+
type: J.literal("text-start"),
|
|
1796
|
+
id: J.string(),
|
|
1797
|
+
providerMetadata: X.optional()
|
|
2155
1798
|
}),
|
|
2156
|
-
|
|
2157
|
-
type:
|
|
2158
|
-
id:
|
|
2159
|
-
delta:
|
|
2160
|
-
providerMetadata:
|
|
1799
|
+
J.looseObject({
|
|
1800
|
+
type: J.literal("text-delta"),
|
|
1801
|
+
id: J.string(),
|
|
1802
|
+
delta: J.string(),
|
|
1803
|
+
providerMetadata: X.optional()
|
|
2161
1804
|
}),
|
|
2162
|
-
|
|
2163
|
-
type:
|
|
2164
|
-
id:
|
|
2165
|
-
providerMetadata:
|
|
1805
|
+
J.looseObject({
|
|
1806
|
+
type: J.literal("text-end"),
|
|
1807
|
+
id: J.string(),
|
|
1808
|
+
providerMetadata: X.optional()
|
|
2166
1809
|
}),
|
|
2167
|
-
|
|
2168
|
-
type:
|
|
2169
|
-
errorText:
|
|
1810
|
+
J.looseObject({
|
|
1811
|
+
type: J.literal("error"),
|
|
1812
|
+
errorText: J.string()
|
|
2170
1813
|
}),
|
|
2171
|
-
|
|
2172
|
-
type:
|
|
2173
|
-
toolCallId:
|
|
2174
|
-
toolName:
|
|
2175
|
-
providerExecuted:
|
|
2176
|
-
providerMetadata:
|
|
2177
|
-
toolMetadata:
|
|
2178
|
-
dynamic:
|
|
2179
|
-
title:
|
|
1814
|
+
J.looseObject({
|
|
1815
|
+
type: J.literal("tool-input-start"),
|
|
1816
|
+
toolCallId: J.string(),
|
|
1817
|
+
toolName: J.string(),
|
|
1818
|
+
providerExecuted: J.boolean().optional(),
|
|
1819
|
+
providerMetadata: X.optional(),
|
|
1820
|
+
toolMetadata: Pn.optional(),
|
|
1821
|
+
dynamic: J.boolean().optional(),
|
|
1822
|
+
title: J.string().optional()
|
|
2180
1823
|
}),
|
|
2181
|
-
|
|
2182
|
-
type:
|
|
2183
|
-
toolCallId:
|
|
2184
|
-
inputTextDelta:
|
|
1824
|
+
J.looseObject({
|
|
1825
|
+
type: J.literal("tool-input-delta"),
|
|
1826
|
+
toolCallId: J.string(),
|
|
1827
|
+
inputTextDelta: J.string()
|
|
2185
1828
|
}),
|
|
2186
|
-
|
|
2187
|
-
type:
|
|
2188
|
-
toolCallId:
|
|
2189
|
-
toolName:
|
|
2190
|
-
input:
|
|
2191
|
-
providerExecuted:
|
|
2192
|
-
providerMetadata:
|
|
2193
|
-
toolMetadata:
|
|
2194
|
-
dynamic:
|
|
2195
|
-
title:
|
|
1829
|
+
J.looseObject({
|
|
1830
|
+
type: J.literal("tool-input-available"),
|
|
1831
|
+
toolCallId: J.string(),
|
|
1832
|
+
toolName: J.string(),
|
|
1833
|
+
input: J.unknown(),
|
|
1834
|
+
providerExecuted: J.boolean().optional(),
|
|
1835
|
+
providerMetadata: X.optional(),
|
|
1836
|
+
toolMetadata: Pn.optional(),
|
|
1837
|
+
dynamic: J.boolean().optional(),
|
|
1838
|
+
title: J.string().optional()
|
|
2196
1839
|
}),
|
|
2197
|
-
|
|
2198
|
-
type:
|
|
2199
|
-
toolCallId:
|
|
2200
|
-
toolName:
|
|
2201
|
-
input:
|
|
2202
|
-
providerExecuted:
|
|
2203
|
-
providerMetadata:
|
|
2204
|
-
toolMetadata:
|
|
2205
|
-
dynamic:
|
|
2206
|
-
errorText:
|
|
2207
|
-
title:
|
|
1840
|
+
J.looseObject({
|
|
1841
|
+
type: J.literal("tool-input-error"),
|
|
1842
|
+
toolCallId: J.string(),
|
|
1843
|
+
toolName: J.string(),
|
|
1844
|
+
input: J.unknown(),
|
|
1845
|
+
providerExecuted: J.boolean().optional(),
|
|
1846
|
+
providerMetadata: X.optional(),
|
|
1847
|
+
toolMetadata: Pn.optional(),
|
|
1848
|
+
dynamic: J.boolean().optional(),
|
|
1849
|
+
errorText: J.string(),
|
|
1850
|
+
title: J.string().optional()
|
|
2208
1851
|
}),
|
|
2209
|
-
|
|
2210
|
-
type:
|
|
2211
|
-
approvalId:
|
|
2212
|
-
toolCallId:
|
|
2213
|
-
approvalDescriptor:
|
|
2214
|
-
inputSchemaInput:
|
|
2215
|
-
reason:
|
|
2216
|
-
isAutomatic:
|
|
2217
|
-
signature:
|
|
1852
|
+
J.looseObject({
|
|
1853
|
+
type: J.literal("tool-approval-request"),
|
|
1854
|
+
approvalId: J.string(),
|
|
1855
|
+
toolCallId: J.string(),
|
|
1856
|
+
approvalDescriptor: J.unknown().optional(),
|
|
1857
|
+
inputSchemaInput: J.unknown().optional(),
|
|
1858
|
+
reason: J.string().optional(),
|
|
1859
|
+
isAutomatic: J.boolean().optional(),
|
|
1860
|
+
signature: J.string().optional()
|
|
2218
1861
|
}),
|
|
2219
|
-
|
|
2220
|
-
type:
|
|
2221
|
-
approvalId:
|
|
2222
|
-
approved:
|
|
2223
|
-
reason:
|
|
2224
|
-
providerExecuted:
|
|
2225
|
-
providerMetadata:
|
|
1862
|
+
J.looseObject({
|
|
1863
|
+
type: J.literal("tool-approval-response"),
|
|
1864
|
+
approvalId: J.string(),
|
|
1865
|
+
approved: J.boolean(),
|
|
1866
|
+
reason: J.string().optional(),
|
|
1867
|
+
providerExecuted: J.boolean().optional(),
|
|
1868
|
+
providerMetadata: X.optional()
|
|
2226
1869
|
}),
|
|
2227
|
-
|
|
2228
|
-
type:
|
|
2229
|
-
toolCallId:
|
|
2230
|
-
output:
|
|
2231
|
-
providerExecuted:
|
|
2232
|
-
providerMetadata:
|
|
2233
|
-
toolMetadata:
|
|
2234
|
-
dynamic:
|
|
2235
|
-
preliminary:
|
|
1870
|
+
J.looseObject({
|
|
1871
|
+
type: J.literal("tool-output-available"),
|
|
1872
|
+
toolCallId: J.string(),
|
|
1873
|
+
output: J.unknown(),
|
|
1874
|
+
providerExecuted: J.boolean().optional(),
|
|
1875
|
+
providerMetadata: X.optional(),
|
|
1876
|
+
toolMetadata: Pn.optional(),
|
|
1877
|
+
dynamic: J.boolean().optional(),
|
|
1878
|
+
preliminary: J.boolean().optional()
|
|
2236
1879
|
}),
|
|
2237
|
-
|
|
2238
|
-
type:
|
|
2239
|
-
toolCallId:
|
|
2240
|
-
errorText:
|
|
2241
|
-
providerExecuted:
|
|
2242
|
-
providerMetadata:
|
|
2243
|
-
toolMetadata:
|
|
2244
|
-
dynamic:
|
|
1880
|
+
J.looseObject({
|
|
1881
|
+
type: J.literal("tool-output-error"),
|
|
1882
|
+
toolCallId: J.string(),
|
|
1883
|
+
errorText: J.string(),
|
|
1884
|
+
providerExecuted: J.boolean().optional(),
|
|
1885
|
+
providerMetadata: X.optional(),
|
|
1886
|
+
toolMetadata: Pn.optional(),
|
|
1887
|
+
dynamic: J.boolean().optional()
|
|
2245
1888
|
}),
|
|
2246
|
-
|
|
2247
|
-
type:
|
|
2248
|
-
toolCallId:
|
|
1889
|
+
J.looseObject({
|
|
1890
|
+
type: J.literal("tool-output-denied"),
|
|
1891
|
+
toolCallId: J.string()
|
|
2249
1892
|
}),
|
|
2250
|
-
|
|
2251
|
-
type:
|
|
2252
|
-
id:
|
|
2253
|
-
providerMetadata:
|
|
1893
|
+
J.looseObject({
|
|
1894
|
+
type: J.literal("reasoning-start"),
|
|
1895
|
+
id: J.string(),
|
|
1896
|
+
providerMetadata: X.optional()
|
|
2254
1897
|
}),
|
|
2255
|
-
|
|
2256
|
-
type:
|
|
2257
|
-
id:
|
|
2258
|
-
delta:
|
|
2259
|
-
providerMetadata:
|
|
1898
|
+
J.looseObject({
|
|
1899
|
+
type: J.literal("reasoning-delta"),
|
|
1900
|
+
id: J.string(),
|
|
1901
|
+
delta: J.string(),
|
|
1902
|
+
providerMetadata: X.optional()
|
|
2260
1903
|
}),
|
|
2261
|
-
|
|
2262
|
-
type:
|
|
2263
|
-
id:
|
|
2264
|
-
providerMetadata:
|
|
1904
|
+
J.looseObject({
|
|
1905
|
+
type: J.literal("reasoning-end"),
|
|
1906
|
+
id: J.string(),
|
|
1907
|
+
providerMetadata: X.optional()
|
|
2265
1908
|
}),
|
|
2266
|
-
|
|
2267
|
-
type:
|
|
2268
|
-
kind:
|
|
2269
|
-
providerMetadata:
|
|
1909
|
+
J.looseObject({
|
|
1910
|
+
type: J.literal("custom"),
|
|
1911
|
+
kind: J.string().transform((e) => e),
|
|
1912
|
+
providerMetadata: X.optional()
|
|
2270
1913
|
}),
|
|
2271
|
-
|
|
2272
|
-
type:
|
|
2273
|
-
sourceId:
|
|
2274
|
-
url:
|
|
2275
|
-
title:
|
|
2276
|
-
providerMetadata:
|
|
1914
|
+
J.looseObject({
|
|
1915
|
+
type: J.literal("source-url"),
|
|
1916
|
+
sourceId: J.string(),
|
|
1917
|
+
url: J.string(),
|
|
1918
|
+
title: J.string().optional(),
|
|
1919
|
+
providerMetadata: X.optional()
|
|
2277
1920
|
}),
|
|
2278
|
-
|
|
2279
|
-
type:
|
|
2280
|
-
sourceId:
|
|
2281
|
-
mediaType:
|
|
2282
|
-
title:
|
|
2283
|
-
filename:
|
|
2284
|
-
providerMetadata:
|
|
1921
|
+
J.looseObject({
|
|
1922
|
+
type: J.literal("source-document"),
|
|
1923
|
+
sourceId: J.string(),
|
|
1924
|
+
mediaType: J.string(),
|
|
1925
|
+
title: J.string(),
|
|
1926
|
+
filename: J.string().optional(),
|
|
1927
|
+
providerMetadata: X.optional()
|
|
2285
1928
|
}),
|
|
2286
|
-
|
|
2287
|
-
type:
|
|
2288
|
-
url:
|
|
2289
|
-
mediaType:
|
|
2290
|
-
providerMetadata:
|
|
1929
|
+
J.looseObject({
|
|
1930
|
+
type: J.literal("file"),
|
|
1931
|
+
url: J.string(),
|
|
1932
|
+
mediaType: J.string(),
|
|
1933
|
+
providerMetadata: X.optional()
|
|
2291
1934
|
}),
|
|
2292
|
-
|
|
2293
|
-
type:
|
|
2294
|
-
url:
|
|
2295
|
-
mediaType:
|
|
2296
|
-
providerMetadata:
|
|
1935
|
+
J.looseObject({
|
|
1936
|
+
type: J.literal("reasoning-file"),
|
|
1937
|
+
url: J.string(),
|
|
1938
|
+
mediaType: J.string(),
|
|
1939
|
+
providerMetadata: X.optional()
|
|
2297
1940
|
}),
|
|
2298
|
-
|
|
2299
|
-
type:
|
|
2300
|
-
id:
|
|
2301
|
-
data:
|
|
2302
|
-
transient:
|
|
1941
|
+
J.looseObject({
|
|
1942
|
+
type: J.custom((e) => typeof e == "string" && e.startsWith("data-"), { message: "Type must start with \"data-\"" }),
|
|
1943
|
+
id: J.string().optional(),
|
|
1944
|
+
data: J.unknown(),
|
|
1945
|
+
transient: J.boolean().optional()
|
|
2303
1946
|
}),
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
type:
|
|
2309
|
-
messageId:
|
|
2310
|
-
messageMetadata:
|
|
1947
|
+
J.looseObject({ type: J.literal("start-step") }),
|
|
1948
|
+
J.looseObject({ type: J.literal("finish-step") }),
|
|
1949
|
+
J.looseObject({ type: J.literal("reset-step") }),
|
|
1950
|
+
J.looseObject({
|
|
1951
|
+
type: J.literal("start"),
|
|
1952
|
+
messageId: J.string().optional(),
|
|
1953
|
+
messageMetadata: J.unknown().optional()
|
|
2311
1954
|
}),
|
|
2312
|
-
|
|
2313
|
-
type:
|
|
2314
|
-
finishReason:
|
|
1955
|
+
J.looseObject({
|
|
1956
|
+
type: J.literal("finish"),
|
|
1957
|
+
finishReason: J.enum([
|
|
2315
1958
|
"stop",
|
|
2316
1959
|
"length",
|
|
2317
1960
|
"content-filter",
|
|
@@ -2319,57 +1962,62 @@ var _r = Y.record(Y.string(), X.optional()), vr = on(() => hn(Y.union([
|
|
|
2319
1962
|
"error",
|
|
2320
1963
|
"other"
|
|
2321
1964
|
]).optional(),
|
|
2322
|
-
messageMetadata:
|
|
1965
|
+
messageMetadata: J.unknown().optional()
|
|
2323
1966
|
}),
|
|
2324
|
-
|
|
2325
|
-
type:
|
|
2326
|
-
reason:
|
|
1967
|
+
J.looseObject({
|
|
1968
|
+
type: J.literal("abort"),
|
|
1969
|
+
reason: J.string().optional()
|
|
2327
1970
|
}),
|
|
2328
|
-
|
|
2329
|
-
type:
|
|
2330
|
-
messageMetadata:
|
|
1971
|
+
J.looseObject({
|
|
1972
|
+
type: J.literal("message-metadata"),
|
|
1973
|
+
messageMetadata: J.unknown()
|
|
2331
1974
|
})
|
|
2332
1975
|
])));
|
|
2333
|
-
function
|
|
1976
|
+
function In(e) {
|
|
2334
1977
|
return e.type.startsWith("data-");
|
|
2335
1978
|
}
|
|
2336
|
-
function
|
|
2337
|
-
return
|
|
1979
|
+
function Ln() {
|
|
1980
|
+
return Object.create(null);
|
|
2338
1981
|
}
|
|
2339
|
-
function
|
|
1982
|
+
function Rn(e) {
|
|
2340
1983
|
return e.type.startsWith("tool-");
|
|
2341
1984
|
}
|
|
2342
|
-
function
|
|
1985
|
+
function zn(e) {
|
|
2343
1986
|
return e.type === "dynamic-tool";
|
|
2344
1987
|
}
|
|
2345
|
-
function
|
|
2346
|
-
return
|
|
1988
|
+
function Z(e) {
|
|
1989
|
+
return Rn(e) || zn(e);
|
|
2347
1990
|
}
|
|
2348
|
-
function
|
|
1991
|
+
function Bn(e) {
|
|
2349
1992
|
return e.type.split("-").slice(1).join("-");
|
|
2350
1993
|
}
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
1994
|
+
function Vn({ lastMessage: e, messageId: t }) {
|
|
1995
|
+
let n = e?.role === "assistant" ? e : {
|
|
1996
|
+
id: t,
|
|
1997
|
+
metadata: void 0,
|
|
1998
|
+
role: "assistant",
|
|
1999
|
+
parts: []
|
|
2000
|
+
}, r = Ln(), i = n.parts.findLastIndex((e) => e.type === "step-start"), a = 0;
|
|
2001
|
+
for (let e of n.parts.slice(i + 1)) {
|
|
2002
|
+
if (!Z(e)) continue;
|
|
2003
|
+
let t = a;
|
|
2004
|
+
Rn(e) && a++, e.state === "input-streaming" && (r[e.toolCallId] = {
|
|
2005
|
+
text: e.rawInput ?? "",
|
|
2006
|
+
index: t,
|
|
2007
|
+
toolName: e.type === "dynamic-tool" ? e.toolName : Bn(e),
|
|
2008
|
+
dynamic: e.type === "dynamic-tool",
|
|
2009
|
+
title: e.title,
|
|
2010
|
+
toolMetadata: e.toolMetadata
|
|
2011
|
+
});
|
|
2012
|
+
}
|
|
2360
2013
|
return {
|
|
2361
|
-
message:
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
parts: []
|
|
2366
|
-
},
|
|
2367
|
-
activeTextParts: br(),
|
|
2368
|
-
activeReasoningParts: br(),
|
|
2369
|
-
partialToolCalls: br()
|
|
2014
|
+
message: n,
|
|
2015
|
+
activeTextParts: Ln(),
|
|
2016
|
+
activeReasoningParts: Ln(),
|
|
2017
|
+
partialToolCalls: r
|
|
2370
2018
|
};
|
|
2371
2019
|
}
|
|
2372
|
-
function
|
|
2020
|
+
function Hn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdateMessageJob: r, onError: i, onToolCall: a, onData: o }) {
|
|
2373
2021
|
return e.pipeThrough(new TransformStream({ async transform(e, s) {
|
|
2374
2022
|
await r(async ({ state: r, write: c }) => {
|
|
2375
2023
|
function l() {
|
|
@@ -2378,7 +2026,7 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2378
2026
|
return e.slice(t + 1);
|
|
2379
2027
|
}
|
|
2380
2028
|
function u() {
|
|
2381
|
-
return l().filter(
|
|
2029
|
+
return l().filter(Z);
|
|
2382
2030
|
}
|
|
2383
2031
|
function d(e) {
|
|
2384
2032
|
let t = u().find((t) => t.toolCallId === e);
|
|
@@ -2386,13 +2034,13 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2386
2034
|
let n = r.message.parts;
|
|
2387
2035
|
for (let r = n.length - 1; r >= 0; r--) {
|
|
2388
2036
|
let i = n[r];
|
|
2389
|
-
if (
|
|
2037
|
+
if (Z(i) && i.toolCallId === e) {
|
|
2390
2038
|
t = i;
|
|
2391
2039
|
break;
|
|
2392
2040
|
}
|
|
2393
2041
|
}
|
|
2394
2042
|
}
|
|
2395
|
-
if (t == null) throw new
|
|
2043
|
+
if (t == null) throw new q({
|
|
2396
2044
|
chunkType: "tool-invocation",
|
|
2397
2045
|
chunkId: e,
|
|
2398
2046
|
message: `No tool invocation found for tool call ID "${e}".`
|
|
@@ -2400,8 +2048,8 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2400
2048
|
return t;
|
|
2401
2049
|
}
|
|
2402
2050
|
function f(e) {
|
|
2403
|
-
let t = r.message.parts.filter(
|
|
2404
|
-
if (t == null) throw new
|
|
2051
|
+
let t = r.message.parts.filter(Z).find((t) => t.approval?.id === e);
|
|
2052
|
+
if (t == null) throw new q({
|
|
2405
2053
|
chunkType: "tool-approval-response",
|
|
2406
2054
|
chunkId: e,
|
|
2407
2055
|
message: `No tool invocation found for approval ID "${e}".`
|
|
@@ -2409,7 +2057,7 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2409
2057
|
return t;
|
|
2410
2058
|
}
|
|
2411
2059
|
function p(e, t) {
|
|
2412
|
-
let n = t ?? l().find((t) =>
|
|
2060
|
+
let n = t ?? l().find((t) => Rn(t) && t.toolCallId === e.toolCallId), i = e, a = n;
|
|
2413
2061
|
if (n != null) {
|
|
2414
2062
|
n.state = e.state, a.input = i.input, a.output = i.output, a.errorText = i.errorText, a.rawInput = i.rawInput, a.preliminary = i.preliminary, e.title !== void 0 && (a.title = e.title), e.toolMetadata !== void 0 && (a.toolMetadata = e.toolMetadata), a.providerExecuted = i.providerExecuted ?? n.providerExecuted;
|
|
2415
2063
|
let t = i.providerMetadata;
|
|
@@ -2438,7 +2086,7 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2438
2086
|
function m(e, t) {
|
|
2439
2087
|
let n = t ?? l().find((t) => t.type === "dynamic-tool" && t.toolCallId === e.toolCallId), i = e, a = n;
|
|
2440
2088
|
if (n != null) {
|
|
2441
|
-
n.state = e.state, a.toolName = e.toolName, a.input = i.input, a.output = i.output, a.errorText = i.errorText, a.rawInput = i.rawInput
|
|
2089
|
+
n.state = e.state, a.toolName = e.toolName, a.input = i.input, a.output = i.output, a.errorText = i.errorText, a.rawInput = i.rawInput, a.preliminary = i.preliminary, e.title !== void 0 && (a.title = e.title), e.toolMetadata !== void 0 && (a.toolMetadata = e.toolMetadata), a.providerExecuted = i.providerExecuted ?? n.providerExecuted;
|
|
2442
2090
|
let t = i.providerMetadata;
|
|
2443
2091
|
if (t != null) {
|
|
2444
2092
|
if (e.state === "output-available" || e.state === "output-error") {
|
|
@@ -2464,8 +2112,8 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2464
2112
|
}
|
|
2465
2113
|
async function h(e) {
|
|
2466
2114
|
if (e != null) {
|
|
2467
|
-
let n = r.message.metadata == null ? e :
|
|
2468
|
-
t != null && await
|
|
2115
|
+
let n = r.message.metadata == null ? e : fn(r.message.metadata, e);
|
|
2116
|
+
t != null && await $t({
|
|
2469
2117
|
value: n,
|
|
2470
2118
|
schema: t,
|
|
2471
2119
|
context: {
|
|
@@ -2488,7 +2136,7 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2488
2136
|
}
|
|
2489
2137
|
case "text-delta": {
|
|
2490
2138
|
let t = r.activeTextParts[e.id];
|
|
2491
|
-
if (t == null) throw new
|
|
2139
|
+
if (t == null) throw new q({
|
|
2492
2140
|
chunkType: "text-delta",
|
|
2493
2141
|
chunkId: e.id,
|
|
2494
2142
|
message: `Received text-delta for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`
|
|
@@ -2498,7 +2146,7 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2498
2146
|
}
|
|
2499
2147
|
case "text-end": {
|
|
2500
2148
|
let t = r.activeTextParts[e.id];
|
|
2501
|
-
if (t == null) throw new
|
|
2149
|
+
if (t == null) throw new q({
|
|
2502
2150
|
chunkType: "text-end",
|
|
2503
2151
|
chunkId: e.id,
|
|
2504
2152
|
message: `Received text-end for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`
|
|
@@ -2528,7 +2176,7 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2528
2176
|
}
|
|
2529
2177
|
case "reasoning-delta": {
|
|
2530
2178
|
let t = r.activeReasoningParts[e.id];
|
|
2531
|
-
if (t == null) throw new
|
|
2179
|
+
if (t == null) throw new q({
|
|
2532
2180
|
chunkType: "reasoning-delta",
|
|
2533
2181
|
chunkId: e.id,
|
|
2534
2182
|
message: `Received reasoning-delta for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`
|
|
@@ -2538,7 +2186,7 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2538
2186
|
}
|
|
2539
2187
|
case "reasoning-end": {
|
|
2540
2188
|
let t = r.activeReasoningParts[e.id];
|
|
2541
|
-
if (t == null) throw new
|
|
2189
|
+
if (t == null) throw new q({
|
|
2542
2190
|
chunkType: "reasoning-end",
|
|
2543
2191
|
chunkId: e.id,
|
|
2544
2192
|
message: `Received reasoning-end for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`
|
|
@@ -2575,7 +2223,7 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2575
2223
|
}), c();
|
|
2576
2224
|
break;
|
|
2577
2225
|
case "tool-input-start": {
|
|
2578
|
-
let t = l().filter(
|
|
2226
|
+
let t = l().filter(Rn);
|
|
2579
2227
|
r.partialToolCalls[e.toolCallId] = {
|
|
2580
2228
|
text: "",
|
|
2581
2229
|
toolName: e.toolName,
|
|
@@ -2606,18 +2254,19 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2606
2254
|
}
|
|
2607
2255
|
case "tool-input-delta": {
|
|
2608
2256
|
let t = r.partialToolCalls[e.toolCallId];
|
|
2609
|
-
if (t == null) throw new
|
|
2257
|
+
if (t == null) throw new q({
|
|
2610
2258
|
chunkType: "tool-input-delta",
|
|
2611
2259
|
chunkId: e.toolCallId,
|
|
2612
2260
|
message: `Received tool-input-delta for missing tool call with ID "${e.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`
|
|
2613
2261
|
});
|
|
2614
2262
|
t.text += e.inputTextDelta;
|
|
2615
|
-
let { value: n } = await
|
|
2263
|
+
let { value: n } = await Nn(t.text);
|
|
2616
2264
|
t.dynamic ? m({
|
|
2617
2265
|
toolCallId: e.toolCallId,
|
|
2618
2266
|
toolName: t.toolName,
|
|
2619
2267
|
state: "input-streaming",
|
|
2620
2268
|
input: n,
|
|
2269
|
+
rawInput: t.text,
|
|
2621
2270
|
title: t.title,
|
|
2622
2271
|
toolMetadata: t.toolMetadata
|
|
2623
2272
|
}) : p({
|
|
@@ -2625,6 +2274,7 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2625
2274
|
toolName: t.toolName,
|
|
2626
2275
|
state: "input-streaming",
|
|
2627
2276
|
input: n,
|
|
2277
|
+
rawInput: t.text,
|
|
2628
2278
|
title: t.title,
|
|
2629
2279
|
toolMetadata: t.toolMetadata
|
|
2630
2280
|
}), c();
|
|
@@ -2652,7 +2302,7 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2652
2302
|
}), c(), a && !e.providerExecuted && await a({ toolCall: e });
|
|
2653
2303
|
break;
|
|
2654
2304
|
case "tool-input-error": {
|
|
2655
|
-
let t = l().filter(
|
|
2305
|
+
let t = l().filter(Z).find((t) => t.toolCallId === e.toolCallId);
|
|
2656
2306
|
(t == null ? e.dynamic : t.type === "dynamic-tool") ? m({
|
|
2657
2307
|
toolCallId: e.toolCallId,
|
|
2658
2308
|
toolName: e.toolName,
|
|
@@ -2662,17 +2312,16 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2662
2312
|
providerExecuted: e.providerExecuted,
|
|
2663
2313
|
providerMetadata: e.providerMetadata,
|
|
2664
2314
|
toolMetadata: e.toolMetadata
|
|
2665
|
-
}) :
|
|
2315
|
+
}) : p({
|
|
2666
2316
|
toolCallId: e.toolCallId,
|
|
2667
2317
|
toolName: e.toolName,
|
|
2668
2318
|
state: "output-error",
|
|
2669
|
-
input:
|
|
2670
|
-
rawInput: e.input,
|
|
2319
|
+
input: e.input,
|
|
2671
2320
|
errorText: e.errorText,
|
|
2672
2321
|
providerExecuted: e.providerExecuted,
|
|
2673
2322
|
providerMetadata: e.providerMetadata,
|
|
2674
2323
|
toolMetadata: e.toolMetadata
|
|
2675
|
-
}),
|
|
2324
|
+
}), c();
|
|
2676
2325
|
break;
|
|
2677
2326
|
}
|
|
2678
2327
|
case "tool-approval-request": {
|
|
@@ -2714,10 +2363,10 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2714
2363
|
providerExecuted: e.providerExecuted,
|
|
2715
2364
|
providerMetadata: e.providerMetadata,
|
|
2716
2365
|
title: t.title,
|
|
2717
|
-
toolMetadata: t.toolMetadata
|
|
2366
|
+
toolMetadata: e.toolMetadata ?? t.toolMetadata
|
|
2718
2367
|
}, t) : p({
|
|
2719
2368
|
toolCallId: e.toolCallId,
|
|
2720
|
-
toolName:
|
|
2369
|
+
toolName: Bn(t),
|
|
2721
2370
|
state: "output-available",
|
|
2722
2371
|
input: t.input,
|
|
2723
2372
|
output: e.output,
|
|
@@ -2725,7 +2374,7 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2725
2374
|
preliminary: e.preliminary,
|
|
2726
2375
|
providerMetadata: e.providerMetadata,
|
|
2727
2376
|
title: t.title,
|
|
2728
|
-
toolMetadata: t.toolMetadata
|
|
2377
|
+
toolMetadata: e.toolMetadata ?? t.toolMetadata
|
|
2729
2378
|
}, t), c();
|
|
2730
2379
|
break;
|
|
2731
2380
|
}
|
|
@@ -2740,10 +2389,10 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2740
2389
|
providerExecuted: e.providerExecuted,
|
|
2741
2390
|
providerMetadata: e.providerMetadata,
|
|
2742
2391
|
title: t.title,
|
|
2743
|
-
toolMetadata: t.toolMetadata
|
|
2392
|
+
toolMetadata: e.toolMetadata ?? t.toolMetadata
|
|
2744
2393
|
}, t) : p({
|
|
2745
2394
|
toolCallId: e.toolCallId,
|
|
2746
|
-
toolName:
|
|
2395
|
+
toolName: Bn(t),
|
|
2747
2396
|
state: "output-error",
|
|
2748
2397
|
input: t.input,
|
|
2749
2398
|
rawInput: t.rawInput,
|
|
@@ -2751,7 +2400,7 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2751
2400
|
providerExecuted: e.providerExecuted,
|
|
2752
2401
|
providerMetadata: e.providerMetadata,
|
|
2753
2402
|
title: t.title,
|
|
2754
|
-
toolMetadata: t.toolMetadata
|
|
2403
|
+
toolMetadata: e.toolMetadata ?? t.toolMetadata
|
|
2755
2404
|
}, t), c();
|
|
2756
2405
|
break;
|
|
2757
2406
|
}
|
|
@@ -2761,7 +2410,7 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2761
2410
|
case "finish-step": break;
|
|
2762
2411
|
case "reset-step": {
|
|
2763
2412
|
let e = l();
|
|
2764
|
-
r.activeTextParts =
|
|
2413
|
+
r.activeTextParts = Ln(), r.activeReasoningParts = Ln(), r.partialToolCalls = Ln(), e.length > 0 && (r.message.parts.splice(r.message.parts.length - e.length, e.length), c());
|
|
2765
2414
|
break;
|
|
2766
2415
|
}
|
|
2767
2416
|
case "start":
|
|
@@ -2776,10 +2425,10 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2776
2425
|
case "error":
|
|
2777
2426
|
i?.(Error(e.errorText));
|
|
2778
2427
|
break;
|
|
2779
|
-
default: if (
|
|
2428
|
+
default: if (In(e)) {
|
|
2780
2429
|
if (n?.[e.type] != null) {
|
|
2781
2430
|
let t = r.message.parts.findIndex((t) => "id" in t && "data" in t && t.id === e.id && t.type === e.type), i = t >= 0 ? t : r.message.parts.length;
|
|
2782
|
-
await
|
|
2431
|
+
await $t({
|
|
2783
2432
|
value: e.data,
|
|
2784
2433
|
schema: n[e.type],
|
|
2785
2434
|
context: {
|
|
@@ -2802,7 +2451,7 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2802
2451
|
});
|
|
2803
2452
|
} }));
|
|
2804
2453
|
}
|
|
2805
|
-
async function
|
|
2454
|
+
async function Un({ stream: e, onError: t, abortSignal: n }) {
|
|
2806
2455
|
let r = e.getReader(), i = () => {
|
|
2807
2456
|
r.cancel().catch(() => {});
|
|
2808
2457
|
};
|
|
@@ -2818,32 +2467,32 @@ async function Or({ stream: e, onError: t, abortSignal: n }) {
|
|
|
2818
2467
|
n?.removeEventListener("abort", i), r.releaseLock();
|
|
2819
2468
|
}
|
|
2820
2469
|
}
|
|
2821
|
-
|
|
2470
|
+
R({
|
|
2822
2471
|
prefix: "aitxt",
|
|
2823
2472
|
size: 24
|
|
2824
|
-
}),
|
|
2473
|
+
}), R({
|
|
2825
2474
|
prefix: "call",
|
|
2826
2475
|
size: 24
|
|
2827
|
-
}),
|
|
2476
|
+
}), R({
|
|
2828
2477
|
prefix: "aitxt",
|
|
2829
2478
|
size: 24
|
|
2830
|
-
}),
|
|
2479
|
+
}), R({
|
|
2831
2480
|
prefix: "call",
|
|
2832
2481
|
size: 24
|
|
2833
|
-
}),
|
|
2482
|
+
}), J.record(J.string(), Y.optional()), J.record(J.string(), J.string()), R({
|
|
2834
2483
|
prefix: "call",
|
|
2835
2484
|
size: 24
|
|
2836
|
-
}),
|
|
2485
|
+
}), R({
|
|
2837
2486
|
prefix: "call",
|
|
2838
2487
|
size: 24
|
|
2839
|
-
}), new TextEncoder(),
|
|
2488
|
+
}), new TextEncoder(), R({
|
|
2840
2489
|
prefix: "call",
|
|
2841
2490
|
size: 24
|
|
2842
|
-
}),
|
|
2491
|
+
}), R({
|
|
2843
2492
|
prefix: "aiobj",
|
|
2844
2493
|
size: 24
|
|
2845
2494
|
});
|
|
2846
|
-
var { atob:
|
|
2495
|
+
var { atob: Wn } = globalThis, Gn = class {
|
|
2847
2496
|
constructor() {
|
|
2848
2497
|
this.queue = [], this.isProcessing = !1;
|
|
2849
2498
|
}
|
|
@@ -2865,12 +2514,12 @@ var { atob: kr } = globalThis, Ar = class {
|
|
|
2865
2514
|
});
|
|
2866
2515
|
}
|
|
2867
2516
|
};
|
|
2868
|
-
|
|
2517
|
+
R({
|
|
2869
2518
|
prefix: "aiobj",
|
|
2870
2519
|
size: 24
|
|
2871
|
-
}),
|
|
2872
|
-
token:
|
|
2873
|
-
url:
|
|
2520
|
+
}), J.object({
|
|
2521
|
+
token: J.string().refine((e) => e.trim().length > 0),
|
|
2522
|
+
url: J.string().refine((e) => {
|
|
2874
2523
|
try {
|
|
2875
2524
|
let t = new URL(e);
|
|
2876
2525
|
return (t.protocol === "ws:" || t.protocol === "wss:") && t.hostname !== "";
|
|
@@ -2878,20 +2527,20 @@ L({
|
|
|
2878
2527
|
return !1;
|
|
2879
2528
|
}
|
|
2880
2529
|
}),
|
|
2881
|
-
expiresAt:
|
|
2882
|
-
tools:
|
|
2883
|
-
type:
|
|
2884
|
-
name:
|
|
2885
|
-
description:
|
|
2886
|
-
parameters:
|
|
2530
|
+
expiresAt: J.number().positive().max(2 ** 53 - 1).optional(),
|
|
2531
|
+
tools: J.array(J.object({
|
|
2532
|
+
type: J.literal("function"),
|
|
2533
|
+
name: J.string().min(1),
|
|
2534
|
+
description: J.string().optional(),
|
|
2535
|
+
parameters: J.record(J.string(), J.unknown())
|
|
2887
2536
|
})).optional()
|
|
2888
|
-
}),
|
|
2537
|
+
}), R({
|
|
2889
2538
|
prefix: "call",
|
|
2890
2539
|
size: 24
|
|
2891
2540
|
});
|
|
2892
|
-
async function
|
|
2541
|
+
async function Kn({ response: e, url: t, fallbackMessage: n }) {
|
|
2893
2542
|
let r = await e.text();
|
|
2894
|
-
return new
|
|
2543
|
+
return new be({
|
|
2895
2544
|
message: r || n,
|
|
2896
2545
|
url: t,
|
|
2897
2546
|
requestBodyValues: void 0,
|
|
@@ -2899,9 +2548,9 @@ async function jr({ response: e, url: t, fallbackMessage: n }) {
|
|
|
2899
2548
|
responseBody: r
|
|
2900
2549
|
});
|
|
2901
2550
|
}
|
|
2902
|
-
async function
|
|
2551
|
+
async function qn(e) {
|
|
2903
2552
|
if (e == null) return [];
|
|
2904
|
-
if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new
|
|
2553
|
+
if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new Pe({
|
|
2905
2554
|
functionality: "FileList",
|
|
2906
2555
|
message: "FileList is not supported in the current environment"
|
|
2907
2556
|
});
|
|
@@ -2920,19 +2569,19 @@ async function Mr(e) {
|
|
|
2920
2569
|
};
|
|
2921
2570
|
}));
|
|
2922
2571
|
}
|
|
2923
|
-
function
|
|
2572
|
+
function Jn(e, t) {
|
|
2924
2573
|
let n = e.search(/[?#]/);
|
|
2925
2574
|
return n === -1 ? `${e}${t}` : `${e.slice(0, n)}${t}${e.slice(n)}`;
|
|
2926
2575
|
}
|
|
2927
|
-
var
|
|
2576
|
+
var Yn = class {
|
|
2928
2577
|
constructor({ api: e = "/api/chat", credentials: t, headers: n, body: r, fetch: i, prepareSendMessagesRequest: a, prepareReconnectToStreamRequest: o }) {
|
|
2929
2578
|
this.api = e, this.credentials = t, this.headers = n, this.body = r, this.fetch = i, this.prepareSendMessagesRequest = a, this.prepareReconnectToStreamRequest = o;
|
|
2930
2579
|
}
|
|
2931
2580
|
async sendMessages({ abortSignal: e, ...t }) {
|
|
2932
|
-
let n = await
|
|
2933
|
-
...
|
|
2934
|
-
...
|
|
2935
|
-
}, o = await this.prepareSendMessagesRequest?.
|
|
2581
|
+
let n = await rn(this.body), r = await rn(this.headers), i = await rn(this.credentials), a = {
|
|
2582
|
+
...L(r),
|
|
2583
|
+
...L(t.headers)
|
|
2584
|
+
}, o = await this.prepareSendMessagesRequest?.({
|
|
2936
2585
|
api: this.api,
|
|
2937
2586
|
id: t.chatId,
|
|
2938
2587
|
messages: t.messages,
|
|
@@ -2945,7 +2594,7 @@ var Pr = class {
|
|
|
2945
2594
|
requestMetadata: t.metadata,
|
|
2946
2595
|
trigger: t.trigger,
|
|
2947
2596
|
messageId: t.messageId
|
|
2948
|
-
}), s = o?.api ?? this.api, c = o?.headers === void 0 ? a :
|
|
2597
|
+
}), s = o?.api ?? this.api, c = o?.headers === void 0 ? a : L(o.headers), l = o?.body === void 0 ? {
|
|
2949
2598
|
...n,
|
|
2950
2599
|
...t.body,
|
|
2951
2600
|
id: t.chatId,
|
|
@@ -2962,19 +2611,19 @@ var Pr = class {
|
|
|
2962
2611
|
credentials: u,
|
|
2963
2612
|
signal: e
|
|
2964
2613
|
});
|
|
2965
|
-
if (!d.ok) throw await
|
|
2614
|
+
if (!d.ok) throw await Kn({
|
|
2966
2615
|
response: d,
|
|
2967
2616
|
url: s,
|
|
2968
2617
|
fallbackMessage: "Failed to fetch the chat response."
|
|
2969
2618
|
});
|
|
2970
|
-
if (!d.body) throw new
|
|
2619
|
+
if (!d.body) throw new Ce({ message: "The response body is empty." });
|
|
2971
2620
|
return this.processResponseStream(d.body);
|
|
2972
2621
|
}
|
|
2973
2622
|
async reconnectToStream(e) {
|
|
2974
|
-
let t = await
|
|
2975
|
-
...
|
|
2976
|
-
...
|
|
2977
|
-
}, a = await this.prepareReconnectToStreamRequest?.
|
|
2623
|
+
let t = await rn(this.body), n = await rn(this.headers), r = await rn(this.credentials), i = {
|
|
2624
|
+
...L(n),
|
|
2625
|
+
...L(e.headers)
|
|
2626
|
+
}, a = await this.prepareReconnectToStreamRequest?.({
|
|
2978
2627
|
api: this.api,
|
|
2979
2628
|
id: e.chatId,
|
|
2980
2629
|
body: {
|
|
@@ -2984,44 +2633,53 @@ var Pr = class {
|
|
|
2984
2633
|
headers: i,
|
|
2985
2634
|
credentials: r,
|
|
2986
2635
|
requestMetadata: e.metadata
|
|
2987
|
-
}), o = a?.api
|
|
2636
|
+
}), o = a?.api;
|
|
2637
|
+
if (o == null) {
|
|
2638
|
+
if (e.chatId === "." || e.chatId === "..") throw new cn({
|
|
2639
|
+
parameter: "chatId",
|
|
2640
|
+
value: e.chatId,
|
|
2641
|
+
message: "Chat IDs must not be \".\" or \"..\" when using the default reconnect URL."
|
|
2642
|
+
});
|
|
2643
|
+
o = Jn(this.api, `/${encodeURIComponent(e.chatId)}/stream`);
|
|
2644
|
+
}
|
|
2645
|
+
let s = a?.headers === void 0 ? i : L(a.headers), c = a?.credentials ?? r, l = await (this.fetch ?? globalThis.fetch)(o, {
|
|
2988
2646
|
method: "GET",
|
|
2989
2647
|
headers: s,
|
|
2990
2648
|
credentials: c,
|
|
2991
2649
|
signal: e.abortSignal
|
|
2992
2650
|
});
|
|
2993
2651
|
if (l.status === 204) return null;
|
|
2994
|
-
if (!l.ok) throw await
|
|
2652
|
+
if (!l.ok) throw await Kn({
|
|
2995
2653
|
response: l,
|
|
2996
2654
|
url: o,
|
|
2997
2655
|
fallbackMessage: "Failed to fetch the chat response."
|
|
2998
2656
|
});
|
|
2999
|
-
if (!l.body) throw new
|
|
2657
|
+
if (!l.body) throw new Ce({ message: "The response body is empty." });
|
|
3000
2658
|
return this.processResponseStream(l.body);
|
|
3001
2659
|
}
|
|
3002
|
-
},
|
|
2660
|
+
}, Xn = class extends Yn {
|
|
3003
2661
|
constructor(e = {}) {
|
|
3004
2662
|
super(e);
|
|
3005
2663
|
}
|
|
3006
2664
|
processResponseStream(e) {
|
|
3007
|
-
return
|
|
2665
|
+
return nn({
|
|
3008
2666
|
stream: e,
|
|
3009
|
-
schema:
|
|
2667
|
+
schema: Fn
|
|
3010
2668
|
}).pipeThrough(new TransformStream({ async transform(e, t) {
|
|
3011
2669
|
if (!e.success) throw e.error;
|
|
3012
2670
|
t.enqueue(e.value);
|
|
3013
2671
|
} }));
|
|
3014
2672
|
}
|
|
3015
|
-
},
|
|
3016
|
-
constructor({ generateId: e =
|
|
3017
|
-
this.pendingMessagePreparations = /* @__PURE__ */ new Set(), this.activeResponse = void 0, this.activeResumeRequest = void 0, this.jobExecutor = new
|
|
2673
|
+
}, Zn = class {
|
|
2674
|
+
constructor({ generateId: e = z, id: t = e(), transport: n = new Xn(), messageMetadataSchema: r, dataPartSchemas: i, state: a, onError: o, onToolCall: s, onFinish: c, onData: l, sendAutomaticallyWhen: u }) {
|
|
2675
|
+
this.pendingMessagePreparations = /* @__PURE__ */ new Set(), this.activeResponse = void 0, this.activeResumeRequest = void 0, this.resumableStreamState = void 0, this.jobExecutor = new Gn(), this.sendMessage = async (e, t) => {
|
|
3018
2676
|
if (e == null) {
|
|
3019
2677
|
let e = this.pendingApprovalMessageId;
|
|
3020
2678
|
if (e == null) {
|
|
3021
2679
|
e = this.lastMessage?.id;
|
|
3022
2680
|
for (let t = this.state.messages.length - 1; t >= 0; t--) {
|
|
3023
2681
|
let n = this.state.messages[t];
|
|
3024
|
-
if (n.role === "assistant" && n.parts.some((e) =>
|
|
2682
|
+
if (n.role === "assistant" && n.parts.some((e) => Z(e) && e.state === "approval-responded")) {
|
|
3025
2683
|
e = n.id;
|
|
3026
2684
|
break;
|
|
3027
2685
|
}
|
|
@@ -3041,7 +2699,7 @@ var Pr = class {
|
|
|
3041
2699
|
this.pendingMessagePreparations.add(t);
|
|
3042
2700
|
let r;
|
|
3043
2701
|
try {
|
|
3044
|
-
r = Array.isArray(e.files) ? e.files : await
|
|
2702
|
+
r = Array.isArray(e.files) ? e.files : await qn(e.files);
|
|
3045
2703
|
} finally {
|
|
3046
2704
|
this.pendingMessagePreparations.delete(t);
|
|
3047
2705
|
}
|
|
@@ -3053,12 +2711,12 @@ var Pr = class {
|
|
|
3053
2711
|
} else n = e;
|
|
3054
2712
|
if (e.messageId != null) {
|
|
3055
2713
|
let t = this.state.messages.findIndex((t) => t.id === e.messageId);
|
|
3056
|
-
if (t === -1) throw new
|
|
2714
|
+
if (t === -1) throw new cn({
|
|
3057
2715
|
parameter: "message.messageId",
|
|
3058
2716
|
value: e.messageId,
|
|
3059
2717
|
message: `message with id ${e.messageId} not found`
|
|
3060
2718
|
});
|
|
3061
|
-
if (this.state.messages[t].role !== "user") throw new
|
|
2719
|
+
if (this.state.messages[t].role !== "user") throw new cn({
|
|
3062
2720
|
parameter: "message.messageId",
|
|
3063
2721
|
value: e.messageId,
|
|
3064
2722
|
message: `message with id ${e.messageId} is not a user message`
|
|
@@ -3082,7 +2740,7 @@ var Pr = class {
|
|
|
3082
2740
|
});
|
|
3083
2741
|
}, this.regenerate = async ({ messageId: e, ...t } = {}) => {
|
|
3084
2742
|
let n = e == null ? this.state.messages.length - 1 : this.state.messages.findIndex((t) => t.id === e);
|
|
3085
|
-
if (n === -1) throw new
|
|
2743
|
+
if (n === -1) throw new cn({
|
|
3086
2744
|
parameter: "messageId",
|
|
3087
2745
|
value: e,
|
|
3088
2746
|
message: `message ${e} not found`
|
|
@@ -3100,7 +2758,7 @@ var Pr = class {
|
|
|
3100
2758
|
}, this.clearError = () => {
|
|
3101
2759
|
this.status === "error" && (this.state.error = void 0, this.setStatus({ status: "ready" }));
|
|
3102
2760
|
}, this.addToolApprovalResponse = async ({ id: e, approved: t, reason: n, options: r }) => this.jobExecutor.run(async () => {
|
|
3103
|
-
let i = this.state.messages, a = (r) =>
|
|
2761
|
+
let i = this.state.messages, a = (r) => Z(r) && r.state === "approval-requested" && r.approval.id === e ? {
|
|
3104
2762
|
...r,
|
|
3105
2763
|
state: "approval-responded",
|
|
3106
2764
|
approval: {
|
|
@@ -3109,7 +2767,7 @@ var Pr = class {
|
|
|
3109
2767
|
approved: t,
|
|
3110
2768
|
reason: n
|
|
3111
2769
|
}
|
|
3112
|
-
} : r, o = i.findIndex((t) => t.parts.some((t) =>
|
|
2770
|
+
} : r, o = i.findIndex((t) => t.parts.some((t) => Z(t) && t.state === "approval-requested" && t.approval.id === e));
|
|
3113
2771
|
if (o !== -1) {
|
|
3114
2772
|
let e = i[o];
|
|
3115
2773
|
this.state.replaceMessage(o, {
|
|
@@ -3128,7 +2786,7 @@ var Pr = class {
|
|
|
3128
2786
|
}
|
|
3129
2787
|
});
|
|
3130
2788
|
}), this.addToolOutput = async ({ state: e = "output-available", toolCallId: t, output: n, errorText: r, options: i }) => this.jobExecutor.run(async () => {
|
|
3131
|
-
let a = this.state.messages, o = a[a.length - 1], s = (i) =>
|
|
2789
|
+
let a = this.state.messages, o = a[a.length - 1], s = (i) => Z(i) && i.toolCallId === t ? {
|
|
3132
2790
|
...i,
|
|
3133
2791
|
state: e,
|
|
3134
2792
|
output: n,
|
|
@@ -3145,9 +2803,8 @@ var Pr = class {
|
|
|
3145
2803
|
});
|
|
3146
2804
|
});
|
|
3147
2805
|
}), this.addToolResult = this.addToolOutput, this.stop = async () => {
|
|
3148
|
-
var e, t;
|
|
3149
2806
|
for (let e of this.pendingMessagePreparations) e.abort();
|
|
3150
|
-
|
|
2807
|
+
this.activeResumeRequest?.abortController.abort(), this.activeResponse?.abortController.abort();
|
|
3151
2808
|
}, this.id = t, this.transport = n, this.generateId = e, this.messageMetadataSchema = r, this.dataPartSchemas = i, this.state = a, this.onError = o, this.onToolCall = s, this.onFinish = c, this.onData = l, this.sendAutomaticallyWhen = u;
|
|
3152
2809
|
}
|
|
3153
2810
|
get status() {
|
|
@@ -3182,112 +2839,112 @@ var Pr = class {
|
|
|
3182
2839
|
}), r && this.status === "error" && this.pendingApprovalMessageId == null && (this.pendingApprovalMessageId = this.state.messages[t]?.id ?? e);
|
|
3183
2840
|
}
|
|
3184
2841
|
async makeRequest({ trigger: e, metadata: t, headers: n, body: r, messageId: i }) {
|
|
3185
|
-
|
|
3186
|
-
let
|
|
3187
|
-
|
|
3188
|
-
let
|
|
3189
|
-
this.activeResumeRequest ===
|
|
3190
|
-
},
|
|
2842
|
+
e !== "resume-stream" && (this.resumableStreamState = void 0);
|
|
2843
|
+
let a = new AbortController(), o = e === "resume-stream" ? { abortController: a } : void 0;
|
|
2844
|
+
o && (this.activeResumeRequest?.abortController.abort(), this.activeResumeRequest = o);
|
|
2845
|
+
let s = () => o == null || this.activeResumeRequest === o, c = () => {
|
|
2846
|
+
this.activeResumeRequest === o && (this.activeResumeRequest = void 0);
|
|
2847
|
+
}, l;
|
|
3191
2848
|
if (e === "resume-stream") try {
|
|
3192
2849
|
let e = await this.transport.reconnectToStream({
|
|
3193
2850
|
chatId: this.id,
|
|
3194
|
-
abortSignal:
|
|
2851
|
+
abortSignal: a.signal,
|
|
3195
2852
|
metadata: t,
|
|
3196
2853
|
headers: n,
|
|
3197
2854
|
body: r
|
|
3198
2855
|
});
|
|
3199
|
-
if (
|
|
3200
|
-
await e?.cancel().catch(() => {}),
|
|
2856
|
+
if (a.signal.aborted || !s()) {
|
|
2857
|
+
await e?.cancel().catch(() => {}), s() && (this.setStatus({ status: "ready" }), this.resumableStreamState = void 0), c();
|
|
3201
2858
|
return;
|
|
3202
2859
|
}
|
|
3203
2860
|
if (e == null) {
|
|
3204
|
-
this.setStatus({ status: "ready" }),
|
|
2861
|
+
this.setStatus({ status: "ready" }), this.resumableStreamState = void 0, c();
|
|
3205
2862
|
return;
|
|
3206
2863
|
}
|
|
3207
|
-
|
|
2864
|
+
l = e;
|
|
3208
2865
|
} catch (e) {
|
|
3209
|
-
if (
|
|
3210
|
-
|
|
2866
|
+
if (a.signal.aborted || e.name === "AbortError") {
|
|
2867
|
+
s() && (this.setStatus({ status: "ready" }), this.resumableStreamState = void 0), c();
|
|
3211
2868
|
return;
|
|
3212
2869
|
}
|
|
3213
|
-
if (!
|
|
2870
|
+
if (!s()) return;
|
|
3214
2871
|
this.onError && e instanceof Error && this.onError(e), this.setStatus({
|
|
3215
2872
|
status: "error",
|
|
3216
2873
|
error: e
|
|
3217
|
-
}),
|
|
2874
|
+
}), c();
|
|
3218
2875
|
return;
|
|
3219
2876
|
}
|
|
3220
2877
|
this.setStatus({
|
|
3221
2878
|
status: "submitted",
|
|
3222
2879
|
error: void 0
|
|
3223
2880
|
});
|
|
3224
|
-
let
|
|
2881
|
+
let u = this.lastMessage, d = e === "submit-message" && i != null ? this.state.messages.findIndex((e) => e.id === i) : this.state.messages.length - 1, f = d === -1 ? u : this.state.messages[d], p = e === "resume-stream" && f?.role === "assistant" && f.parts.some((e) => Z(e) && e.state === "input-streaming") ? this.state.snapshot(f) : void 0, m = d !== -1 && d < this.state.messages.length - 1 && f?.role === "assistant", h = !1, g = !1, _ = !1, v;
|
|
3225
2882
|
try {
|
|
3226
|
-
let
|
|
3227
|
-
state:
|
|
3228
|
-
lastMessage: e === "resume-stream"
|
|
2883
|
+
let o = {
|
|
2884
|
+
state: e === "resume-stream" && this.resumableStreamState != null ? this.resumableStreamState : Vn({
|
|
2885
|
+
lastMessage: e === "resume-stream" ? p : e === "regenerate-message" ? void 0 : this.state.snapshot(f),
|
|
3229
2886
|
messageId: this.generateId()
|
|
3230
2887
|
}),
|
|
3231
|
-
abortController:
|
|
2888
|
+
abortController: a
|
|
3232
2889
|
};
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
}), this.activeResponse =
|
|
3236
|
-
let
|
|
3237
|
-
if (
|
|
2890
|
+
v = o, o.abortController.signal.addEventListener("abort", () => {
|
|
2891
|
+
h = !0;
|
|
2892
|
+
}), this.activeResponse = o;
|
|
2893
|
+
let c;
|
|
2894
|
+
if (c = e === "resume-stream" ? l : await this.transport.sendMessages({
|
|
3238
2895
|
chatId: this.id,
|
|
3239
2896
|
messages: this.state.messages,
|
|
3240
|
-
abortSignal:
|
|
2897
|
+
abortSignal: o.abortController.signal,
|
|
3241
2898
|
metadata: t,
|
|
3242
2899
|
headers: n,
|
|
3243
2900
|
body: r,
|
|
3244
2901
|
trigger: e,
|
|
3245
2902
|
messageId: i
|
|
3246
|
-
}), await
|
|
3247
|
-
stream:
|
|
3248
|
-
stream:
|
|
2903
|
+
}), await Un({
|
|
2904
|
+
stream: Hn({
|
|
2905
|
+
stream: c,
|
|
3249
2906
|
onToolCall: this.onToolCall,
|
|
3250
2907
|
onData: this.onData,
|
|
3251
2908
|
messageMetadataSchema: this.messageMetadataSchema,
|
|
3252
2909
|
dataPartSchemas: this.dataPartSchemas,
|
|
3253
|
-
runUpdateMessageJob: (e) => this.jobExecutor.run(() =>
|
|
3254
|
-
state:
|
|
2910
|
+
runUpdateMessageJob: (e) => this.jobExecutor.run(() => o.abortController.signal.aborted ? Promise.resolve() : e({
|
|
2911
|
+
state: o.state,
|
|
3255
2912
|
write: ({ updateStatus: e = !0 } = {}) => {
|
|
3256
|
-
|
|
2913
|
+
o.abortController.signal.aborted || (e && this.setStatus({ status: "streaming" }), m ? this.state.replaceMessage(d, o.state.message) : o.state.message.id === this.lastMessage?.id ? this.state.replaceMessage(this.state.messages.length - 1, o.state.message) : this.state.pushMessage(o.state.message));
|
|
3257
2914
|
}
|
|
3258
2915
|
})),
|
|
3259
2916
|
onError: (e) => {
|
|
3260
2917
|
throw e;
|
|
3261
2918
|
}
|
|
3262
2919
|
}),
|
|
3263
|
-
abortSignal:
|
|
2920
|
+
abortSignal: o.abortController.signal,
|
|
3264
2921
|
onError: (e) => {
|
|
3265
2922
|
throw e;
|
|
3266
2923
|
}
|
|
3267
|
-
}),
|
|
3268
|
-
|
|
2924
|
+
}), h) return s() && (this.setStatus({ status: "ready" }), this.resumableStreamState === o.state && (this.resumableStreamState = void 0)), null;
|
|
2925
|
+
s() && (this.setStatus({ status: "ready" }), this.resumableStreamState === o.state && (this.resumableStreamState = void 0));
|
|
3269
2926
|
} catch (e) {
|
|
3270
|
-
if (
|
|
3271
|
-
if (!
|
|
3272
|
-
|
|
2927
|
+
if (h || e.name === "AbortError") return h = !0, s() && (this.setStatus({ status: "ready" }), this.resumableStreamState === v?.state && (this.resumableStreamState = void 0)), null;
|
|
2928
|
+
if (!s()) return null;
|
|
2929
|
+
_ = !0, e instanceof TypeError && (e.message.toLowerCase().includes("fetch") || e.message.toLowerCase().includes("network")) && (g = !0), g ? this.resumableStreamState = v?.state : this.resumableStreamState === v?.state && (this.resumableStreamState = void 0), this.onError && e instanceof Error && this.onError(e), this.setStatus({
|
|
3273
2930
|
status: "error",
|
|
3274
2931
|
error: e
|
|
3275
2932
|
});
|
|
3276
2933
|
} finally {
|
|
3277
2934
|
try {
|
|
3278
|
-
|
|
3279
|
-
message:
|
|
2935
|
+
v && this.onFinish?.({
|
|
2936
|
+
message: v.state.message,
|
|
3280
2937
|
messages: this.state.messages,
|
|
3281
|
-
isAbort:
|
|
3282
|
-
isDisconnect:
|
|
3283
|
-
isError:
|
|
3284
|
-
finishReason:
|
|
3285
|
-
})
|
|
2938
|
+
isAbort: h,
|
|
2939
|
+
isDisconnect: g,
|
|
2940
|
+
isError: _,
|
|
2941
|
+
finishReason: v.state.finishReason
|
|
2942
|
+
});
|
|
3286
2943
|
} finally {
|
|
3287
|
-
this.activeResponse ===
|
|
2944
|
+
this.activeResponse === v && (this.activeResponse = void 0), c();
|
|
3288
2945
|
}
|
|
3289
2946
|
}
|
|
3290
|
-
!
|
|
2947
|
+
!_ && await this.shouldSendAutomatically() && await this.makeRequest({
|
|
3291
2948
|
trigger: "submit-message",
|
|
3292
2949
|
messageId: this.lastMessage?.id,
|
|
3293
2950
|
metadata: t,
|
|
@@ -3296,39 +2953,39 @@ var Pr = class {
|
|
|
3296
2953
|
});
|
|
3297
2954
|
}
|
|
3298
2955
|
};
|
|
3299
|
-
function
|
|
2956
|
+
function Qn({ messages: e }) {
|
|
3300
2957
|
let t = e[e.length - 1];
|
|
3301
2958
|
if (!t || t.role !== "assistant") return !1;
|
|
3302
|
-
let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter(
|
|
2959
|
+
let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter(Z);
|
|
3303
2960
|
return r.filter((e) => e.state === "approval-responded").length > 0 && r.every((e) => e.state === "output-available" && e.preliminary !== !0 || e.state === "output-error" || e.state === "output-denied" || e.state === "approval-responded");
|
|
3304
2961
|
}
|
|
3305
2962
|
//#endregion
|
|
3306
2963
|
//#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.43_typescript@6.0.3_/node_modules/swrv/esm/lib/hash.js
|
|
3307
|
-
var
|
|
3308
|
-
function
|
|
2964
|
+
var $n = /* @__PURE__ */ new WeakMap(), er = 0;
|
|
2965
|
+
function tr(e) {
|
|
3309
2966
|
if (!e.length) return "";
|
|
3310
2967
|
for (var t = "arg", n = 0; n < e.length; ++n) {
|
|
3311
2968
|
var r = void 0;
|
|
3312
|
-
e[n] === null || typeof e[n] != "object" && typeof e[n] != "function" ? r = typeof e[n] == "string" ? "\"" + e[n] + "\"" : String(e[n]) :
|
|
2969
|
+
e[n] === null || typeof e[n] != "object" && typeof e[n] != "function" ? r = typeof e[n] == "string" ? "\"" + e[n] + "\"" : String(e[n]) : $n.has(e[n]) ? r = $n.get(e[n]) : (r = er, $n.set(e[n], er++)), t += "@" + r;
|
|
3313
2970
|
}
|
|
3314
2971
|
return t;
|
|
3315
2972
|
}
|
|
3316
2973
|
//#endregion
|
|
3317
2974
|
//#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.43_typescript@6.0.3_/node_modules/swrv/esm/cache/index.js
|
|
3318
|
-
function
|
|
2975
|
+
function nr(e) {
|
|
3319
2976
|
if (typeof e == "function") try {
|
|
3320
2977
|
e = e();
|
|
3321
2978
|
} catch {
|
|
3322
2979
|
e = "";
|
|
3323
2980
|
}
|
|
3324
|
-
return e = Array.isArray(e) ?
|
|
2981
|
+
return e = Array.isArray(e) ? tr(e) : String(e || ""), e;
|
|
3325
2982
|
}
|
|
3326
|
-
var
|
|
2983
|
+
var rr = function() {
|
|
3327
2984
|
function e(e) {
|
|
3328
2985
|
e === void 0 && (e = 0), this.items = /* @__PURE__ */ new Map(), this.ttl = e;
|
|
3329
2986
|
}
|
|
3330
2987
|
return e.prototype.serializeKey = function(e) {
|
|
3331
|
-
return
|
|
2988
|
+
return nr(e);
|
|
3332
2989
|
}, e.prototype.get = function(e) {
|
|
3333
2990
|
var t = this.serializeKey(e);
|
|
3334
2991
|
return this.items.get(t);
|
|
@@ -3350,26 +3007,26 @@ var Hr = function() {
|
|
|
3350
3007
|
}();
|
|
3351
3008
|
//#endregion
|
|
3352
3009
|
//#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.43_typescript@6.0.3_/node_modules/swrv/esm/lib/web-preset.js
|
|
3353
|
-
function
|
|
3010
|
+
function ir() {
|
|
3354
3011
|
return navigator.onLine === void 0 || navigator.onLine;
|
|
3355
3012
|
}
|
|
3356
|
-
function
|
|
3013
|
+
function ar() {
|
|
3357
3014
|
return typeof document < "u" && document.visibilityState !== void 0 ? document.visibilityState !== "hidden" : !0;
|
|
3358
3015
|
}
|
|
3359
|
-
var
|
|
3360
|
-
isOnline:
|
|
3361
|
-
isDocumentVisible:
|
|
3016
|
+
var or = {
|
|
3017
|
+
isOnline: ir,
|
|
3018
|
+
isDocumentVisible: ar,
|
|
3362
3019
|
fetcher: function(e) {
|
|
3363
3020
|
return fetch(e).then(function(e) {
|
|
3364
3021
|
return e.json();
|
|
3365
3022
|
});
|
|
3366
3023
|
}
|
|
3367
|
-
},
|
|
3368
|
-
return
|
|
3024
|
+
}, Q = function() {
|
|
3025
|
+
return Q = Object.assign || function(e) {
|
|
3369
3026
|
for (var t, n = 1, r = arguments.length; n < r; n++) for (var i in t = arguments[n], t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
|
|
3370
3027
|
return e;
|
|
3371
|
-
},
|
|
3372
|
-
},
|
|
3028
|
+
}, Q.apply(this, arguments);
|
|
3029
|
+
}, sr = function(e, t, n, r) {
|
|
3373
3030
|
function i(e) {
|
|
3374
3031
|
return e instanceof n ? e : new n(function(t) {
|
|
3375
3032
|
t(e);
|
|
@@ -3395,7 +3052,7 @@ var Gr = {
|
|
|
3395
3052
|
}
|
|
3396
3053
|
c((r = r.apply(e, t || [])).next());
|
|
3397
3054
|
});
|
|
3398
|
-
},
|
|
3055
|
+
}, $ = function(e, t) {
|
|
3399
3056
|
var n = {
|
|
3400
3057
|
label: 0,
|
|
3401
3058
|
sent: function() {
|
|
@@ -3468,7 +3125,7 @@ var Gr = {
|
|
|
3468
3125
|
done: !0
|
|
3469
3126
|
};
|
|
3470
3127
|
}
|
|
3471
|
-
},
|
|
3128
|
+
}, cr = function(e, t) {
|
|
3472
3129
|
var n = typeof Symbol == "function" && e[Symbol.iterator];
|
|
3473
3130
|
if (!n) return e;
|
|
3474
3131
|
var r = n.call(e), i, a = [], o;
|
|
@@ -3484,11 +3141,11 @@ var Gr = {
|
|
|
3484
3141
|
}
|
|
3485
3142
|
}
|
|
3486
3143
|
return a;
|
|
3487
|
-
},
|
|
3144
|
+
}, lr = function(e, t, n) {
|
|
3488
3145
|
if (n || arguments.length === 2) for (var r = 0, i = t.length, a; r < i; r++) (a || !(r in t)) && (a ||= Array.prototype.slice.call(t, 0, r), a[r] = t[r]);
|
|
3489
3146
|
return e.concat(a || Array.prototype.slice.call(t));
|
|
3490
|
-
},
|
|
3491
|
-
cache:
|
|
3147
|
+
}, ur = new rr(), dr = new rr(), fr = new rr(), pr = {
|
|
3148
|
+
cache: ur,
|
|
3492
3149
|
refreshInterval: 0,
|
|
3493
3150
|
ttl: 0,
|
|
3494
3151
|
serverTTL: 1e3,
|
|
@@ -3498,15 +3155,15 @@ var Gr = {
|
|
|
3498
3155
|
shouldRetryOnError: !0,
|
|
3499
3156
|
errorRetryInterval: 5e3,
|
|
3500
3157
|
errorRetryCount: 5,
|
|
3501
|
-
fetcher:
|
|
3502
|
-
isOnline:
|
|
3503
|
-
isDocumentVisible:
|
|
3158
|
+
fetcher: or.fetcher,
|
|
3159
|
+
isOnline: or.isOnline,
|
|
3160
|
+
isDocumentVisible: or.isDocumentVisible
|
|
3504
3161
|
};
|
|
3505
|
-
function
|
|
3506
|
-
var r =
|
|
3507
|
-
r ? r.data.push(t) :
|
|
3162
|
+
function mr(e, t, n) {
|
|
3163
|
+
var r = dr.get(e);
|
|
3164
|
+
r ? r.data.push(t) : dr.set(e, [t], n > 0 ? n + 5e3 : n);
|
|
3508
3165
|
}
|
|
3509
|
-
function
|
|
3166
|
+
function hr(e, t, n) {
|
|
3510
3167
|
if (n.isDocumentVisible() && !(n.errorRetryCount !== void 0 && t > n.errorRetryCount)) {
|
|
3511
3168
|
var r = Math.min(t || 0, n.errorRetryCount), i = r * n.errorRetryInterval;
|
|
3512
3169
|
setTimeout(function() {
|
|
@@ -3517,17 +3174,17 @@ function ti(e, t, n) {
|
|
|
3517
3174
|
}, i);
|
|
3518
3175
|
}
|
|
3519
3176
|
}
|
|
3520
|
-
function
|
|
3177
|
+
function gr(e) {
|
|
3521
3178
|
var t = e.shouldRetry, n = t === void 0 ? void 0 : t, r = e.error;
|
|
3522
|
-
return typeof n == "function" ? n(r) : typeof n == "boolean" ? n :
|
|
3179
|
+
return typeof n == "function" ? n(r) : typeof n == "boolean" ? n : pr.shouldRetryOnError;
|
|
3523
3180
|
}
|
|
3524
|
-
var
|
|
3525
|
-
return n === void 0 && (n =
|
|
3181
|
+
var _r = function(e, t, n, r) {
|
|
3182
|
+
return n === void 0 && (n = ur), r === void 0 && (r = pr.ttl), sr(void 0, void 0, void 0, function() {
|
|
3526
3183
|
var i, a, o, s, c, l, u;
|
|
3527
|
-
return
|
|
3184
|
+
return $(this, function(d) {
|
|
3528
3185
|
switch (d.label) {
|
|
3529
3186
|
case 0:
|
|
3530
|
-
if (!
|
|
3187
|
+
if (!yr(t)) return [3, 5];
|
|
3531
3188
|
d.label = 1;
|
|
3532
3189
|
case 1: return d.trys.push([
|
|
3533
3190
|
1,
|
|
@@ -3549,7 +3206,7 @@ var ri = function(e, t, n, r) {
|
|
|
3549
3206
|
} catch (e) {
|
|
3550
3207
|
console.error("swrv(mutate): failed to set cache", e);
|
|
3551
3208
|
}
|
|
3552
|
-
return l =
|
|
3209
|
+
return l = dr.get(e), l && l.data.length && (u = l.data.filter(function(t) {
|
|
3553
3210
|
return t.key === e;
|
|
3554
3211
|
}), u.forEach(function(e, t) {
|
|
3555
3212
|
c.data !== void 0 && (e.data = c.data), e.error = c.error, e.isValidating = c.isValidating, e.isLoading = c.isValidating, t !== u.length - 1 && delete u[t];
|
|
@@ -3558,16 +3215,16 @@ var ri = function(e, t, n, r) {
|
|
|
3558
3215
|
});
|
|
3559
3216
|
});
|
|
3560
3217
|
};
|
|
3561
|
-
function
|
|
3218
|
+
function vr() {
|
|
3562
3219
|
for (var e = this, t = [], n = 0; n < arguments.length; n++) t[n] = arguments[n];
|
|
3563
|
-
var r, i, a =
|
|
3564
|
-
if (!
|
|
3220
|
+
var r, i, a = Q({}, pr), o = !1, s = !1;
|
|
3221
|
+
if (!oe()) return console.error("useSWRV must be called inside setup() or an active effectScope()."), null;
|
|
3565
3222
|
var c = typeof window > "u" || typeof document > "u";
|
|
3566
|
-
t.length >= 1 && (r = t[0]), t.length >= 2 && (i = t[1]), t.length > 2 && (a =
|
|
3567
|
-
var l = c ? a.serverTTL : a.ttl, u = typeof r == "function" ? r :
|
|
3223
|
+
t.length >= 1 && (r = t[0]), t.length >= 2 && (i = t[1]), t.length > 2 && (a = Q(Q({}, a), t[2]));
|
|
3224
|
+
var l = c ? a.serverTTL : a.ttl, u = typeof r == "function" ? r : b(r);
|
|
3568
3225
|
i === void 0 && (i = a.fetcher);
|
|
3569
3226
|
var d = null;
|
|
3570
|
-
d ||=
|
|
3227
|
+
d ||= le({
|
|
3571
3228
|
data: void 0,
|
|
3572
3229
|
error: void 0,
|
|
3573
3230
|
isValidating: !0,
|
|
@@ -3575,32 +3232,32 @@ function ii() {
|
|
|
3575
3232
|
key: null
|
|
3576
3233
|
});
|
|
3577
3234
|
var f = function(t, n) {
|
|
3578
|
-
return
|
|
3235
|
+
return sr(e, void 0, void 0, function() {
|
|
3579
3236
|
var e, r, s, c, p, m, h, g = this;
|
|
3580
|
-
return
|
|
3237
|
+
return $(this, function(_) {
|
|
3581
3238
|
switch (_.label) {
|
|
3582
3239
|
case 0: return e = d.data === void 0, r = u.value, r ? (s = a.cache.get(r), c = s && s.data, d.isValidating = !0, d.isLoading = !c, c && (d.data = c.data, d.error = c.error), p = t || i, !p || !a.isDocumentVisible() && !e || n?.forceRevalidate !== void 0 && !n?.forceRevalidate || s && (m = !!(Date.now() - s.createdAt >= a.dedupingInterval || n?.forceRevalidate), !m) ? (d.isValidating = !1, d.isLoading = !1, [2]) : (h = function() {
|
|
3583
|
-
return
|
|
3240
|
+
return sr(g, void 0, void 0, function() {
|
|
3584
3241
|
var e, t, i, s, c, u;
|
|
3585
|
-
return
|
|
3242
|
+
return $(this, function(m) {
|
|
3586
3243
|
switch (m.label) {
|
|
3587
|
-
case 0: return e =
|
|
3244
|
+
case 0: return e = fr.get(r), e ? [3, 2] : (t = Array.isArray(r) ? r : [r], i = p.apply(void 0, lr([], cr(t), !1)), fr.set(r, i, a.dedupingInterval), [4, _r(r, i, a.cache, l)]);
|
|
3588
3245
|
case 1: return m.sent(), [3, 4];
|
|
3589
|
-
case 2: return [4,
|
|
3246
|
+
case 2: return [4, _r(r, e.data, a.cache, l)];
|
|
3590
3247
|
case 3: m.sent(), m.label = 4;
|
|
3591
|
-
case 4: return d.isValidating = !1, d.isLoading = !1,
|
|
3248
|
+
case 4: return d.isValidating = !1, d.isLoading = !1, fr.delete(r), d.error !== void 0 && (s = gr({
|
|
3592
3249
|
shouldRetry: a.shouldRetryOnError,
|
|
3593
3250
|
error: d.error
|
|
3594
|
-
}), c =
|
|
3251
|
+
}), c = gr({
|
|
3595
3252
|
shouldRetry: !n || n.shouldRetryOnError,
|
|
3596
3253
|
error: d.error
|
|
3597
|
-
}), u = !o && s && c, u &&
|
|
3254
|
+
}), u = !o && s && c, u && hr(f, n ? n.errorRetryCount : 1, a)), [2];
|
|
3598
3255
|
}
|
|
3599
3256
|
});
|
|
3600
3257
|
});
|
|
3601
3258
|
}, c && a.revalidateDebounce ? (setTimeout(function() {
|
|
3602
|
-
return
|
|
3603
|
-
return
|
|
3259
|
+
return sr(g, void 0, void 0, function() {
|
|
3260
|
+
return $(this, function(e) {
|
|
3604
3261
|
switch (e.label) {
|
|
3605
3262
|
case 0: return o ? [3, 2] : [4, h()];
|
|
3606
3263
|
case 1: e.sent(), e.label = 2;
|
|
@@ -3616,16 +3273,16 @@ function ii() {
|
|
|
3616
3273
|
});
|
|
3617
3274
|
});
|
|
3618
3275
|
}, p = function() {
|
|
3619
|
-
return
|
|
3620
|
-
return
|
|
3276
|
+
return sr(e, void 0, void 0, function() {
|
|
3277
|
+
return $(this, function(e) {
|
|
3621
3278
|
return [2, f(null, { shouldRetryOnError: !1 })];
|
|
3622
3279
|
});
|
|
3623
3280
|
});
|
|
3624
3281
|
}, m = null;
|
|
3625
3282
|
if (!c) {
|
|
3626
3283
|
var h = function() {
|
|
3627
|
-
return
|
|
3628
|
-
return
|
|
3284
|
+
return sr(e, void 0, void 0, function() {
|
|
3285
|
+
return $(this, function(e) {
|
|
3629
3286
|
switch (e.label) {
|
|
3630
3287
|
case 0: return d.error || !a.isOnline() ? [3, 2] : [4, f()];
|
|
3631
3288
|
case 1: return e.sent(), [3, 3];
|
|
@@ -3637,38 +3294,38 @@ function ii() {
|
|
|
3637
3294
|
};
|
|
3638
3295
|
a.refreshInterval && (m = setTimeout(h, a.refreshInterval)), a.revalidateOnFocus && (document.addEventListener("visibilitychange", p, !1), window.addEventListener("focus", p, !1));
|
|
3639
3296
|
}
|
|
3640
|
-
|
|
3297
|
+
ce(function() {
|
|
3641
3298
|
o = !0, m &&= (clearTimeout(m), null), !c && a.revalidateOnFocus && (document.removeEventListener("visibilitychange", p, !1), window.removeEventListener("focus", p, !1));
|
|
3642
|
-
var e =
|
|
3299
|
+
var e = dr.get(u.value);
|
|
3643
3300
|
e && (e.data = e.data.filter(function(e) {
|
|
3644
3301
|
return e !== d;
|
|
3645
3302
|
}));
|
|
3646
3303
|
});
|
|
3647
3304
|
try {
|
|
3648
|
-
|
|
3649
|
-
|
|
3305
|
+
de(u, function(e) {
|
|
3306
|
+
se(u) || (u.value = e), d.key = e, d.isValidating = !!e, mr(u.value, d, l), !c && !s && u.value && f(), s = !1;
|
|
3650
3307
|
}, { immediate: !0 });
|
|
3651
3308
|
} catch {}
|
|
3652
|
-
return
|
|
3653
|
-
return f(e,
|
|
3309
|
+
return Q(Q({}, ue(d)), { mutate: function(e, t) {
|
|
3310
|
+
return f(e, Q(Q({}, t), { forceRevalidate: !0 }));
|
|
3654
3311
|
} });
|
|
3655
3312
|
}
|
|
3656
|
-
function
|
|
3313
|
+
function yr(e) {
|
|
3657
3314
|
return typeof e == "object" && !!e && typeof e.then == "function";
|
|
3658
3315
|
}
|
|
3659
3316
|
//#endregion
|
|
3660
3317
|
//#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.43_typescript@6.0.3_/node_modules/swrv/esm/index.js
|
|
3661
|
-
var
|
|
3662
|
-
|
|
3663
|
-
var
|
|
3318
|
+
var br = vr;
|
|
3319
|
+
br.default, br.default;
|
|
3320
|
+
var xr = class {
|
|
3664
3321
|
constructor(e) {
|
|
3665
|
-
this.statusRef =
|
|
3322
|
+
this.statusRef = b("ready"), this.errorRef = b(void 0), this.pushMessage = (e) => {
|
|
3666
3323
|
this.messagesRef.value = [...this.messagesRef.value, e];
|
|
3667
3324
|
}, this.popMessage = () => {
|
|
3668
3325
|
this.messagesRef.value = this.messagesRef.value.slice(0, -1);
|
|
3669
3326
|
}, this.replaceMessage = (e, t) => {
|
|
3670
3327
|
this.messagesRef.value[e] = { ...t };
|
|
3671
|
-
}, this.snapshot = (e) => e, this.messagesRef =
|
|
3328
|
+
}, this.snapshot = (e) => e, this.messagesRef = b(e ?? []);
|
|
3672
3329
|
}
|
|
3673
3330
|
get messages() {
|
|
3674
3331
|
return this.messagesRef.value;
|
|
@@ -3688,52 +3345,52 @@ var si = class {
|
|
|
3688
3345
|
set error(e) {
|
|
3689
3346
|
this.errorRef.value = e;
|
|
3690
3347
|
}
|
|
3691
|
-
},
|
|
3348
|
+
}, Sr = class extends Zn {
|
|
3692
3349
|
constructor({ messages: e, ...t }) {
|
|
3693
3350
|
super({
|
|
3694
3351
|
...t,
|
|
3695
|
-
state: new
|
|
3352
|
+
state: new xr(e)
|
|
3696
3353
|
});
|
|
3697
3354
|
}
|
|
3698
|
-
},
|
|
3355
|
+
}, Cr = "voice-", wr = (e) => e.replace(/\s+/g, " ").trim().toLowerCase(), Tr = (e) => wr(e.parts.filter((e) => e.type === "text").map((e) => "text" in e ? e.text : "").join(" ")), Er = 8, Dr = (e, t) => {
|
|
3699
3356
|
let n = e.filter((e) => e.role === "user").map((e) => ({
|
|
3700
|
-
text:
|
|
3357
|
+
text: Tr(e),
|
|
3701
3358
|
taken: !1
|
|
3702
3359
|
}));
|
|
3703
3360
|
return t.filter((e) => {
|
|
3704
3361
|
if (!e.id.startsWith("voice-") || e.role !== "user") return !1;
|
|
3705
|
-
let t =
|
|
3362
|
+
let t = Tr(e), r = n.find((e) => !e.taken && e.text.length > 0 && (e.text === t || e.text.length >= Er && t.endsWith(e.text)));
|
|
3706
3363
|
return !r || (r.taken = !0, !1);
|
|
3707
3364
|
});
|
|
3708
|
-
},
|
|
3365
|
+
}, Or = (e) => {
|
|
3709
3366
|
let t = e.type ?? "";
|
|
3710
3367
|
return t === "dynamic-tool" ? e.toolName ?? "" : t.startsWith("tool-") ? t.slice(5) : "";
|
|
3711
|
-
},
|
|
3368
|
+
}, kr = ({ messages: e }) => {
|
|
3712
3369
|
let t = e[e.length - 1];
|
|
3713
3370
|
if (!t || t.role !== "assistant") return !1;
|
|
3714
|
-
let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter((e) => !e.providerExecuted &&
|
|
3715
|
-
return r.length > 0 && r.every((e) =>
|
|
3371
|
+
let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter((e) => !e.providerExecuted && ee(Or(e)));
|
|
3372
|
+
return r.length > 0 && r.every((e) => te.has(e.state ?? ""));
|
|
3716
3373
|
};
|
|
3717
|
-
function
|
|
3718
|
-
return
|
|
3719
|
-
let { t, te: n, locale: r } =
|
|
3374
|
+
function Ar(e) {
|
|
3375
|
+
return x(`chatbot-${e}`, () => {
|
|
3376
|
+
let { t, te: n, locale: r } = pe({ useScope: "global" }), i = b(""), a = b(), o = b(e), s = b(), c = b(), l = b(), u = b(), d = b(), f = b(), p = b(), m = b(), h = b(), g = b(), _ = b(), v = b(), ee = b(), te = b(), oe = b(), se = b(), ce = b(!1), le = me(), ue = y(() => {
|
|
3720
3377
|
let e = u.value?.theme;
|
|
3721
|
-
return (!e || e === "auto") && (e =
|
|
3722
|
-
}),
|
|
3378
|
+
return (!e || e === "auto") && (e = se.value), e ? e === "dark" : le.value;
|
|
3379
|
+
}), x = y(() => c.value === "reasoning"), _e = y(() => x.value ? g.value?.filter((e) => ![
|
|
3723
3380
|
"upvote",
|
|
3724
3381
|
"downvote",
|
|
3725
3382
|
"feedback"
|
|
3726
|
-
].includes(e)) : g.value),
|
|
3727
|
-
|
|
3728
|
-
|
|
3383
|
+
].includes(e)) : g.value), ve = ae(y(() => `${o.value}-chatId`), null);
|
|
3384
|
+
fe(() => {
|
|
3385
|
+
ve.value ||= z();
|
|
3729
3386
|
});
|
|
3730
|
-
let
|
|
3731
|
-
get: () =>
|
|
3387
|
+
let S = y({
|
|
3388
|
+
get: () => ve.value,
|
|
3732
3389
|
set: (e) => {
|
|
3733
|
-
|
|
3390
|
+
ve.value = e;
|
|
3734
3391
|
}
|
|
3735
|
-
}),
|
|
3736
|
-
function
|
|
3392
|
+
}), C = b(), w = b(!1), ye = y(() => C.value?.message?.toLowerCase().includes("conversation-blocked") ?? !1);
|
|
3393
|
+
function be(e) {
|
|
3737
3394
|
try {
|
|
3738
3395
|
let t = JSON.parse(e.message);
|
|
3739
3396
|
return t.status === 404 || t.type?.includes("entity-not-found");
|
|
@@ -3741,25 +3398,25 @@ function gi(e) {
|
|
|
3741
3398
|
return !1;
|
|
3742
3399
|
}
|
|
3743
3400
|
}
|
|
3744
|
-
function
|
|
3745
|
-
if (
|
|
3746
|
-
let e =
|
|
3747
|
-
|
|
3401
|
+
function xe(e) {
|
|
3402
|
+
if (be(e)) {
|
|
3403
|
+
let e = E.value.messages.filter((e) => e.role === "user"), t = e[e.length - 1], n = t ? ie(t) : void 0;
|
|
3404
|
+
S.value = z(), E.value.clearError(), C.value = void 0, n && E.value.sendMessage({ text: n });
|
|
3748
3405
|
return;
|
|
3749
3406
|
}
|
|
3750
|
-
|
|
3407
|
+
re.error(e), C.value = e, ye.value && (w.value = !0);
|
|
3751
3408
|
}
|
|
3752
|
-
let
|
|
3409
|
+
let T = y(() => ne({
|
|
3753
3410
|
baseUrl: i.value,
|
|
3754
3411
|
basePath: a.value,
|
|
3755
3412
|
headers: () => p.value
|
|
3756
|
-
})),
|
|
3757
|
-
...
|
|
3758
|
-
...
|
|
3759
|
-
}),
|
|
3760
|
-
id:
|
|
3761
|
-
transport: new
|
|
3762
|
-
api:
|
|
3413
|
+
})), Se = b(null), Ce = () => ({
|
|
3414
|
+
...he(),
|
|
3415
|
+
...Se.value ?? {}
|
|
3416
|
+
}), E = y(() => new Sr({
|
|
3417
|
+
id: S.value,
|
|
3418
|
+
transport: new Xn({
|
|
3419
|
+
api: T.value.getChatEndpoint(o.value, x.value ? "reasoning" : "chat"),
|
|
3763
3420
|
prepareSendMessagesRequest: ({ messages: e, id: t }) => ({ body: {
|
|
3764
3421
|
id: t,
|
|
3765
3422
|
messages: [e[e.length - 1]],
|
|
@@ -3774,32 +3431,32 @@ function gi(e) {
|
|
|
3774
3431
|
reasoning: d.value?.reasoning,
|
|
3775
3432
|
webSearch: f.value?.webSearch,
|
|
3776
3433
|
smoothStream: u.value?.smoothStream,
|
|
3777
|
-
deviceContext:
|
|
3778
|
-
externalContext:
|
|
3434
|
+
deviceContext: Ce(),
|
|
3435
|
+
externalContext: oe.value,
|
|
3779
3436
|
disabledTools: f.value?.disabled,
|
|
3780
|
-
fallbackModels:
|
|
3781
|
-
gatewayOptions:
|
|
3437
|
+
fallbackModels: ee.value,
|
|
3438
|
+
gatewayOptions: te.value
|
|
3782
3439
|
} }),
|
|
3783
3440
|
credentials: "include",
|
|
3784
3441
|
headers: () => p.value ?? {}
|
|
3785
3442
|
}),
|
|
3786
|
-
sendAutomaticallyWhen: (e) =>
|
|
3787
|
-
onError:
|
|
3443
|
+
sendAutomaticallyWhen: (e) => kr(e) || Qn(e),
|
|
3444
|
+
onError: xe,
|
|
3788
3445
|
onFinish: () => {
|
|
3789
|
-
let e =
|
|
3790
|
-
!
|
|
3446
|
+
let e = S.value;
|
|
3447
|
+
!x.value && !D.value.some((t) => t.id === e) && I(o.value);
|
|
3791
3448
|
}
|
|
3792
|
-
})),
|
|
3449
|
+
})), we = y(() => {
|
|
3793
3450
|
let e = u.value?.initialMessage;
|
|
3794
3451
|
return e?.[r.value] ? e[r.value] : n("message.defaultAgentWelcome") ? t("message.defaultAgentWelcome") : "";
|
|
3795
|
-
}),
|
|
3796
|
-
id:
|
|
3452
|
+
}), Te = z(), Ee = y(() => ({
|
|
3453
|
+
id: Te,
|
|
3797
3454
|
role: "assistant",
|
|
3798
3455
|
parts: [{
|
|
3799
3456
|
type: "text",
|
|
3800
|
-
text:
|
|
3457
|
+
text: we.value
|
|
3801
3458
|
}]
|
|
3802
|
-
})),
|
|
3459
|
+
})), De = y(() => {
|
|
3803
3460
|
let e = (e) => e.map((e) => e.role !== "user" || !e.parts.some((e) => e.type === "file") ? e : {
|
|
3804
3461
|
...e,
|
|
3805
3462
|
parts: e.parts.map((e) => {
|
|
@@ -3809,291 +3466,291 @@ function gi(e) {
|
|
|
3809
3466
|
let e = t.url.slice(13);
|
|
3810
3467
|
return {
|
|
3811
3468
|
...t,
|
|
3812
|
-
url:
|
|
3469
|
+
url: T.value.getMediaUrl(o.value, S.value, e)
|
|
3813
3470
|
};
|
|
3814
3471
|
}
|
|
3815
3472
|
return t.url.startsWith("blob:") ? t : {
|
|
3816
3473
|
...t,
|
|
3817
|
-
url:
|
|
3474
|
+
url: T.value.appendAuthToken(t.url)
|
|
3818
3475
|
};
|
|
3819
3476
|
})
|
|
3820
3477
|
});
|
|
3821
|
-
return
|
|
3822
|
-
}),
|
|
3478
|
+
return x.value ? e(E.value.messages) : !ce.value && E.value.messages?.[0]?.role !== "assistant" ? [Ee.value, ...e(E.value.messages)] : e(E.value.messages);
|
|
3479
|
+
}), Oe = y(() => {
|
|
3823
3480
|
let e = u.value?.messagePlaceholder;
|
|
3824
3481
|
return e?.[r.value] ? e[r.value] : n("placeholder.askAnything") ? t("placeholder.askAnything") : "";
|
|
3825
|
-
}),
|
|
3826
|
-
async function
|
|
3827
|
-
if (
|
|
3828
|
-
|
|
3482
|
+
}), D = b([]), ke = b(!1), O = b([]), Ae = b(!1), je = b("chat"), k = b([]), A = b(), Me = b(!1), j = b(!1), Ne = b(), Pe = b(!1), M = b(!1), Fe = b(), N = b(""), P = b([]), F = b(""), Ie = b(0);
|
|
3483
|
+
async function I(e) {
|
|
3484
|
+
if (x.value) {
|
|
3485
|
+
D.value = [];
|
|
3829
3486
|
return;
|
|
3830
3487
|
}
|
|
3831
|
-
|
|
3488
|
+
ke.value = !0;
|
|
3832
3489
|
try {
|
|
3833
|
-
|
|
3490
|
+
D.value = await T.value.getConversations(e, l.value);
|
|
3834
3491
|
} catch {
|
|
3835
|
-
|
|
3492
|
+
D.value = [];
|
|
3836
3493
|
} finally {
|
|
3837
|
-
|
|
3494
|
+
ke.value = !1;
|
|
3838
3495
|
}
|
|
3839
3496
|
}
|
|
3840
|
-
async function
|
|
3841
|
-
let e =
|
|
3497
|
+
async function Le() {
|
|
3498
|
+
let e = S.value;
|
|
3842
3499
|
if (!e) {
|
|
3843
|
-
|
|
3500
|
+
O.value = [];
|
|
3844
3501
|
return;
|
|
3845
3502
|
}
|
|
3846
|
-
|
|
3503
|
+
Ae.value = !0;
|
|
3847
3504
|
try {
|
|
3848
|
-
|
|
3505
|
+
O.value = await T.value.getChatFiles(e);
|
|
3849
3506
|
} catch {
|
|
3850
|
-
|
|
3507
|
+
O.value = [];
|
|
3851
3508
|
} finally {
|
|
3852
|
-
|
|
3509
|
+
Ae.value = !1;
|
|
3853
3510
|
}
|
|
3854
3511
|
}
|
|
3855
|
-
function
|
|
3856
|
-
return
|
|
3512
|
+
function Re(e, t = !1) {
|
|
3513
|
+
return T.value.getChatFileDownloadUrl(e, t);
|
|
3857
3514
|
}
|
|
3858
|
-
function
|
|
3859
|
-
return
|
|
3515
|
+
function ze(e) {
|
|
3516
|
+
return T.value.getChatFilePreviewUrl(e);
|
|
3860
3517
|
}
|
|
3861
|
-
async function
|
|
3862
|
-
await
|
|
3518
|
+
async function Be(e) {
|
|
3519
|
+
await T.value.deleteChatFile(e), O.value = O.value.filter((t) => t.documentId !== e);
|
|
3863
3520
|
}
|
|
3864
|
-
async function
|
|
3865
|
-
if (!
|
|
3866
|
-
let n = await
|
|
3867
|
-
if (t !==
|
|
3868
|
-
n && (
|
|
3521
|
+
async function L(e, t) {
|
|
3522
|
+
if (!x.value) try {
|
|
3523
|
+
let n = await T.value.getChat(e, t);
|
|
3524
|
+
if (t !== S.value || E.value.status !== "ready" || E.value.messages.length > 0) return;
|
|
3525
|
+
n && (E.value.messages = n.messages, w.value = n.blocked ?? !1);
|
|
3869
3526
|
} catch {}
|
|
3870
3527
|
}
|
|
3871
|
-
let
|
|
3872
|
-
let e =
|
|
3528
|
+
let R = () => {
|
|
3529
|
+
let e = E.value.status;
|
|
3873
3530
|
return e === "submitted" || e === "streaming";
|
|
3874
|
-
},
|
|
3875
|
-
async function
|
|
3876
|
-
if (
|
|
3877
|
-
let e =
|
|
3531
|
+
}, Ve = 0, He = 0;
|
|
3532
|
+
async function Ue() {
|
|
3533
|
+
if (x.value || R()) return "indeterminate";
|
|
3534
|
+
let e = S.value, t = Ve += 1;
|
|
3878
3535
|
try {
|
|
3879
|
-
let n = await
|
|
3880
|
-
if (!n || e !==
|
|
3881
|
-
|
|
3882
|
-
let r = n.messages, i =
|
|
3883
|
-
return
|
|
3536
|
+
let n = await T.value.getChat(o.value, e);
|
|
3537
|
+
if (!n || e !== S.value || R() || t <= He) return "indeterminate";
|
|
3538
|
+
He = t;
|
|
3539
|
+
let r = n.messages, i = Dr(r, E.value.messages);
|
|
3540
|
+
return E.value.messages = [...r, ...i], w.value = n.blocked ?? !1, i.length > 0 ? "pending" : "caught-up";
|
|
3884
3541
|
} catch {}
|
|
3885
3542
|
return "indeterminate";
|
|
3886
3543
|
}
|
|
3887
|
-
function
|
|
3888
|
-
|
|
3544
|
+
function We(e) {
|
|
3545
|
+
E.value.messages = [...E.value.messages, e];
|
|
3889
3546
|
}
|
|
3890
|
-
async function
|
|
3547
|
+
async function Ge(e) {
|
|
3891
3548
|
try {
|
|
3892
|
-
|
|
3549
|
+
k.value = await T.value.getMessageFeedbacks(e);
|
|
3893
3550
|
} catch {
|
|
3894
|
-
|
|
3551
|
+
k.value = [];
|
|
3895
3552
|
}
|
|
3896
3553
|
}
|
|
3897
|
-
function
|
|
3898
|
-
let t =
|
|
3899
|
-
t >= 0 ?
|
|
3554
|
+
function Ke(e) {
|
|
3555
|
+
let t = k.value.findIndex((t) => t.messageId === e.messageId);
|
|
3556
|
+
t >= 0 ? k.value[t] = e : k.value.push(e);
|
|
3900
3557
|
}
|
|
3901
|
-
function
|
|
3902
|
-
let t =
|
|
3558
|
+
function qe(e) {
|
|
3559
|
+
let t = De.value, n = t.findIndex((t) => t.id === e.id), r = ie(e) ?? "", i = t.slice(0, n).reverse().find((e) => e.role === "user");
|
|
3903
3560
|
return {
|
|
3904
|
-
userQuestion:
|
|
3561
|
+
userQuestion: ie(i ?? e) ?? "",
|
|
3905
3562
|
assistantMessage: r
|
|
3906
3563
|
};
|
|
3907
3564
|
}
|
|
3908
|
-
async function
|
|
3565
|
+
async function B(e, t) {
|
|
3909
3566
|
await Promise.all([
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
]),
|
|
3914
|
-
e && (
|
|
3567
|
+
L(e, t),
|
|
3568
|
+
I(e),
|
|
3569
|
+
Ge(t)
|
|
3570
|
+
]), Se.value || ge((e, t) => T.value.reverseGeocode(e, t, r.value)).then((e) => {
|
|
3571
|
+
e && (Se.value = e);
|
|
3915
3572
|
});
|
|
3916
3573
|
}
|
|
3917
|
-
async function
|
|
3918
|
-
let e =
|
|
3574
|
+
async function Je() {
|
|
3575
|
+
let e = N.value.trim(), t = P.value.filter((e) => e.state === "done" && e.mediaSource !== void 0).map((e) => ({
|
|
3919
3576
|
type: "file",
|
|
3920
3577
|
mediaType: e.mediaSource.mimeType,
|
|
3921
3578
|
url: e.localUrl,
|
|
3922
3579
|
filename: e.mediaSource.name,
|
|
3923
3580
|
providerMetadata: { "8bot": { media: e.mediaSource } }
|
|
3924
3581
|
}));
|
|
3925
|
-
|
|
3926
|
-
let n =
|
|
3582
|
+
x.value && De.value.length > 0 && await Ze(), F.value = e, Ie.value = E.value.messages.length;
|
|
3583
|
+
let n = E.value.sendMessage;
|
|
3927
3584
|
n({
|
|
3928
3585
|
text: e,
|
|
3929
3586
|
files: t.length > 0 ? t : void 0
|
|
3930
|
-
}),
|
|
3587
|
+
}), N.value = "", V();
|
|
3931
3588
|
}
|
|
3932
|
-
function
|
|
3589
|
+
function Ye(e) {
|
|
3933
3590
|
let t = e.trim();
|
|
3934
3591
|
if (!t) return;
|
|
3935
|
-
if (
|
|
3936
|
-
|
|
3592
|
+
if (E.value.status !== "ready") {
|
|
3593
|
+
re.warn("[useChatbotStore] sendMessage called before chat is ready. Listen for the \"ready\" event on the widget element.");
|
|
3937
3594
|
return;
|
|
3938
3595
|
}
|
|
3939
|
-
let n =
|
|
3596
|
+
let n = E.value.sendMessage;
|
|
3940
3597
|
n({ text: t });
|
|
3941
3598
|
}
|
|
3942
|
-
async function
|
|
3943
|
-
let e =
|
|
3944
|
-
await
|
|
3599
|
+
async function Xe() {
|
|
3600
|
+
let e = F.value.length > 0;
|
|
3601
|
+
await E.value.stop(), e && (N.value = F.value, E.value.messages = E.value.messages.slice(0, Ie.value), F.value = "");
|
|
3945
3602
|
}
|
|
3946
|
-
|
|
3947
|
-
e === "ready" &&
|
|
3603
|
+
de(() => E.value.status, (e) => {
|
|
3604
|
+
e === "ready" && F.value.length > 0 && (F.value = "");
|
|
3948
3605
|
});
|
|
3949
|
-
function
|
|
3950
|
-
for (let t of
|
|
3951
|
-
|
|
3606
|
+
function V(e = !1) {
|
|
3607
|
+
for (let t of P.value) (e || t.state !== "done") && URL.revokeObjectURL(t.localUrl);
|
|
3608
|
+
P.value = [], H.value = null;
|
|
3952
3609
|
}
|
|
3953
|
-
async function
|
|
3954
|
-
return
|
|
3610
|
+
async function Ze() {
|
|
3611
|
+
return F.value = "", await Xe(), S.value = z(), E.value.clearError(), C.value = void 0, w.value = !1, V(!0), G("chat"), S.value;
|
|
3955
3612
|
}
|
|
3956
|
-
async function
|
|
3957
|
-
|
|
3613
|
+
async function Qe(e) {
|
|
3614
|
+
E.value.status !== "ready" && (F.value = "", await Xe()), await E.value.regenerate(e);
|
|
3958
3615
|
}
|
|
3959
|
-
function
|
|
3616
|
+
function $e(e) {
|
|
3960
3617
|
if (e.tool === "requestGeolocation") {
|
|
3961
3618
|
let t = e.output;
|
|
3962
|
-
"latitude" in t && (
|
|
3619
|
+
"latitude" in t && (Se.value = {
|
|
3963
3620
|
geolocationLatitude: t.latitude,
|
|
3964
3621
|
geolocationLongitude: t.longitude,
|
|
3965
3622
|
geolocationAccuracy: t.accuracy,
|
|
3966
3623
|
geolocationCity: t.city
|
|
3967
3624
|
});
|
|
3968
3625
|
}
|
|
3969
|
-
|
|
3626
|
+
E.value.addToolOutput(e);
|
|
3970
3627
|
}
|
|
3971
|
-
function
|
|
3972
|
-
|
|
3628
|
+
function et(e) {
|
|
3629
|
+
E.value.addToolApprovalResponse(e);
|
|
3973
3630
|
}
|
|
3974
|
-
let
|
|
3975
|
-
|
|
3631
|
+
let tt = y(() => E.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), nt = y(() => _.value?.maxFilesPerMessage ?? 5), rt = y(() => _.value?.maxFilesPerChat ?? 20), it = y(() => Math.max(0, Math.min(nt.value - P.value.length, rt.value - tt.value - P.value.length))), at = y(() => it.value <= 0), H = b(null), ot = () => {
|
|
3632
|
+
H.value = null;
|
|
3976
3633
|
};
|
|
3977
|
-
|
|
3978
|
-
e || (
|
|
3634
|
+
de(at, (e) => {
|
|
3635
|
+
e || (H.value = null);
|
|
3979
3636
|
});
|
|
3980
|
-
async function
|
|
3981
|
-
if (
|
|
3982
|
-
|
|
3637
|
+
async function st(e) {
|
|
3638
|
+
if (at.value) {
|
|
3639
|
+
H.value = rt.value - tt.value - P.value.length <= nt.value - P.value.length ? {
|
|
3983
3640
|
reason: "per-chat",
|
|
3984
|
-
max:
|
|
3641
|
+
max: rt.value
|
|
3985
3642
|
} : {
|
|
3986
3643
|
reason: "per-message",
|
|
3987
|
-
max:
|
|
3644
|
+
max: nt.value
|
|
3988
3645
|
};
|
|
3989
3646
|
return;
|
|
3990
3647
|
}
|
|
3991
|
-
let t =
|
|
3648
|
+
let t = z(), n = {
|
|
3992
3649
|
id: t,
|
|
3993
3650
|
file: e,
|
|
3994
3651
|
localUrl: URL.createObjectURL(e),
|
|
3995
3652
|
state: "uploading"
|
|
3996
3653
|
};
|
|
3997
|
-
|
|
3654
|
+
P.value = [...P.value, n];
|
|
3998
3655
|
try {
|
|
3999
|
-
let n = await
|
|
4000
|
-
|
|
3656
|
+
let n = await T.value.uploadMedia(o.value, S.value, e);
|
|
3657
|
+
P.value = P.value.map((e) => e.id === t ? {
|
|
4001
3658
|
...e,
|
|
4002
3659
|
state: "done",
|
|
4003
3660
|
mediaSource: n
|
|
4004
3661
|
} : e);
|
|
4005
3662
|
} catch (e) {
|
|
4006
3663
|
let n = e instanceof Error ? e.message : "Upload failed";
|
|
4007
|
-
|
|
3664
|
+
P.value = P.value.map((e) => e.id === t ? {
|
|
4008
3665
|
...e,
|
|
4009
3666
|
state: "error",
|
|
4010
3667
|
error: n
|
|
4011
3668
|
} : e);
|
|
4012
3669
|
}
|
|
4013
3670
|
}
|
|
4014
|
-
async function
|
|
4015
|
-
let { userQuestion: n, assistantMessage: r } =
|
|
4016
|
-
|
|
3671
|
+
async function ct(e, t) {
|
|
3672
|
+
let { userQuestion: n, assistantMessage: r } = qe(e);
|
|
3673
|
+
Ke(await T.value.submitMessageFeedback({
|
|
4017
3674
|
messageId: e.id,
|
|
4018
|
-
chatId:
|
|
3675
|
+
chatId: S.value,
|
|
4019
3676
|
agentId: o.value,
|
|
4020
3677
|
vote: t,
|
|
4021
3678
|
userQuestion: n,
|
|
4022
3679
|
assistantMessage: r
|
|
4023
3680
|
}));
|
|
4024
3681
|
}
|
|
4025
|
-
async function
|
|
4026
|
-
await
|
|
3682
|
+
async function lt(e) {
|
|
3683
|
+
await ct(e, "upvote");
|
|
4027
3684
|
}
|
|
4028
|
-
async function
|
|
4029
|
-
await
|
|
3685
|
+
async function U(e) {
|
|
3686
|
+
await ct(e, "downvote");
|
|
4030
3687
|
}
|
|
4031
|
-
function
|
|
4032
|
-
|
|
3688
|
+
function ut(e) {
|
|
3689
|
+
j.value = !1, Ne.value = void 0, A.value = e;
|
|
4033
3690
|
}
|
|
4034
|
-
async function
|
|
4035
|
-
if (
|
|
4036
|
-
Me.value = !0,
|
|
4037
|
-
let { userQuestion: t, assistantMessage: n } =
|
|
4038
|
-
|
|
4039
|
-
messageId:
|
|
4040
|
-
chatId:
|
|
3691
|
+
async function dt(e) {
|
|
3692
|
+
if (A.value) try {
|
|
3693
|
+
Me.value = !0, j.value = !1, Ne.value = void 0;
|
|
3694
|
+
let { userQuestion: t, assistantMessage: n } = qe(A.value);
|
|
3695
|
+
Ke(await T.value.submitMessageFeedback({
|
|
3696
|
+
messageId: A.value.id,
|
|
3697
|
+
chatId: S.value,
|
|
4041
3698
|
agentId: o.value,
|
|
4042
3699
|
userQuestion: t,
|
|
4043
3700
|
assistantMessage: n,
|
|
4044
3701
|
comment: e
|
|
4045
|
-
})),
|
|
3702
|
+
})), j.value = !0, await Ge(S.value);
|
|
4046
3703
|
} catch {
|
|
4047
|
-
|
|
3704
|
+
Ne.value = n("message.feedbackSubmitError") ? t("message.feedbackSubmitError") : "Failed to submit feedback";
|
|
4048
3705
|
} finally {
|
|
4049
3706
|
Me.value = !1;
|
|
4050
3707
|
}
|
|
4051
3708
|
}
|
|
4052
|
-
async function
|
|
3709
|
+
async function ft(e) {
|
|
4053
3710
|
try {
|
|
4054
|
-
|
|
3711
|
+
M.value = !0, Pe.value = !1, Fe.value = void 0, await T.value.submitLead({
|
|
4055
3712
|
agentId: o.value,
|
|
4056
|
-
chatId:
|
|
3713
|
+
chatId: S.value,
|
|
4057
3714
|
...e
|
|
4058
|
-
}),
|
|
3715
|
+
}), Pe.value = !0;
|
|
4059
3716
|
} catch {
|
|
4060
|
-
|
|
3717
|
+
Fe.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
|
|
4061
3718
|
} finally {
|
|
4062
|
-
|
|
3719
|
+
M.value = !1;
|
|
4063
3720
|
}
|
|
4064
3721
|
}
|
|
4065
|
-
async function
|
|
4066
|
-
let n = await
|
|
4067
|
-
|
|
3722
|
+
async function pt(e, t) {
|
|
3723
|
+
let n = await T.value.updateChatTitle(o.value, e, t);
|
|
3724
|
+
D.value = D.value.map((t) => t.id === e ? {
|
|
4068
3725
|
...t,
|
|
4069
3726
|
title: n.title
|
|
4070
3727
|
} : t);
|
|
4071
3728
|
}
|
|
4072
|
-
async function
|
|
4073
|
-
await
|
|
3729
|
+
async function W(e) {
|
|
3730
|
+
await T.value.deleteChat(o.value, e), D.value = D.value.filter((t) => t.id !== e), S.value === e && await Ze();
|
|
4074
3731
|
}
|
|
4075
|
-
function
|
|
4076
|
-
|
|
3732
|
+
function G(e) {
|
|
3733
|
+
je.value = e;
|
|
4077
3734
|
}
|
|
4078
|
-
let
|
|
4079
|
-
function
|
|
4080
|
-
let t = () =>
|
|
3735
|
+
let mt;
|
|
3736
|
+
function ht(e) {
|
|
3737
|
+
let t = () => T.value.getChat(o.value, e).then((e) => e !== null);
|
|
4081
3738
|
return t().catch(() => t().catch(() => !1));
|
|
4082
3739
|
}
|
|
4083
|
-
return
|
|
4084
|
-
if (!e || e ===
|
|
4085
|
-
let t =
|
|
4086
|
-
if (
|
|
4087
|
-
let n =
|
|
4088
|
-
if (l.value === e &&
|
|
3740
|
+
return de(l, async (e) => {
|
|
3741
|
+
if (!e || e === mt) return;
|
|
3742
|
+
let t = mt;
|
|
3743
|
+
if (mt = e, t === void 0) return;
|
|
3744
|
+
let n = S.value, r = !x.value && await ht(n);
|
|
3745
|
+
if (l.value === e && S.value === n) {
|
|
4089
3746
|
if (r) {
|
|
4090
|
-
|
|
3747
|
+
I(o.value);
|
|
4091
3748
|
return;
|
|
4092
3749
|
}
|
|
4093
|
-
|
|
3750
|
+
D.value = [], k.value = [], O.value = [], await Ze(), N.value = "";
|
|
4094
3751
|
}
|
|
4095
3752
|
}), {
|
|
4096
|
-
apiClient:
|
|
3753
|
+
apiClient: T,
|
|
4097
3754
|
baseUrl: i,
|
|
4098
3755
|
basePath: a,
|
|
4099
3756
|
agentId: o,
|
|
@@ -4107,69 +3764,69 @@ function gi(e) {
|
|
|
4107
3764
|
revisedAnswers: m,
|
|
4108
3765
|
model: h,
|
|
4109
3766
|
actionsInput: g,
|
|
4110
|
-
actions:
|
|
3767
|
+
actions: _e,
|
|
4111
3768
|
agentFileUpload: _,
|
|
4112
3769
|
agentVoice: v,
|
|
4113
|
-
fallbackModels:
|
|
4114
|
-
gatewayOptions:
|
|
4115
|
-
externalContext:
|
|
4116
|
-
systemTheme:
|
|
4117
|
-
hideWelcomeMessage:
|
|
4118
|
-
isDark:
|
|
4119
|
-
chat:
|
|
4120
|
-
messages:
|
|
4121
|
-
conversations:
|
|
4122
|
-
isLoadingConversations:
|
|
4123
|
-
chatFiles:
|
|
4124
|
-
isLoadingChatFiles:
|
|
4125
|
-
input:
|
|
4126
|
-
pendingAttachments:
|
|
4127
|
-
isAttachmentLimitReached:
|
|
4128
|
-
fileLimitError:
|
|
4129
|
-
localChatId:
|
|
4130
|
-
isConversationBlocked:
|
|
4131
|
-
inputMessagePlaceholder:
|
|
4132
|
-
chatError:
|
|
4133
|
-
activeView:
|
|
4134
|
-
messageFeedbacks:
|
|
4135
|
-
feedbackDialogMessage:
|
|
3770
|
+
fallbackModels: ee,
|
|
3771
|
+
gatewayOptions: te,
|
|
3772
|
+
externalContext: oe,
|
|
3773
|
+
systemTheme: se,
|
|
3774
|
+
hideWelcomeMessage: ce,
|
|
3775
|
+
isDark: ue,
|
|
3776
|
+
chat: E,
|
|
3777
|
+
messages: De,
|
|
3778
|
+
conversations: D,
|
|
3779
|
+
isLoadingConversations: ke,
|
|
3780
|
+
chatFiles: O,
|
|
3781
|
+
isLoadingChatFiles: Ae,
|
|
3782
|
+
input: N,
|
|
3783
|
+
pendingAttachments: P,
|
|
3784
|
+
isAttachmentLimitReached: at,
|
|
3785
|
+
fileLimitError: H,
|
|
3786
|
+
localChatId: S,
|
|
3787
|
+
isConversationBlocked: w,
|
|
3788
|
+
inputMessagePlaceholder: Oe,
|
|
3789
|
+
chatError: C,
|
|
3790
|
+
activeView: je,
|
|
3791
|
+
messageFeedbacks: k,
|
|
3792
|
+
feedbackDialogMessage: A,
|
|
4136
3793
|
isFeedbackSubmitting: Me,
|
|
4137
|
-
isFeedbackSubmitted:
|
|
4138
|
-
feedbackSubmitError:
|
|
4139
|
-
isLeadSubmitted:
|
|
4140
|
-
isLoadingSubmitLead:
|
|
4141
|
-
submitLeadError:
|
|
4142
|
-
buildDeviceContext:
|
|
4143
|
-
initialize:
|
|
4144
|
-
loadConversations:
|
|
4145
|
-
loadChatFiles:
|
|
4146
|
-
refreshMessages:
|
|
4147
|
-
appendMessage:
|
|
4148
|
-
getChatFileUrl:
|
|
4149
|
-
getChatFilePreviewUrl:
|
|
4150
|
-
deleteChatFile:
|
|
4151
|
-
handleSubmit:
|
|
4152
|
-
sendMessage:
|
|
4153
|
-
stopGeneration:
|
|
4154
|
-
startNewChat:
|
|
4155
|
-
regenerate:
|
|
4156
|
-
addToolOutput:
|
|
4157
|
-
addToolApprovalResponse:
|
|
4158
|
-
handleFileSelect:
|
|
4159
|
-
clearFileLimitError:
|
|
4160
|
-
clearPendingAttachments:
|
|
4161
|
-
onUpvote:
|
|
4162
|
-
onDownvote:
|
|
4163
|
-
onFeedback:
|
|
4164
|
-
onFeedbackSubmit:
|
|
4165
|
-
onLeadSubmit:
|
|
4166
|
-
navigate:
|
|
4167
|
-
renameChatTitle:
|
|
4168
|
-
deleteChat:
|
|
3794
|
+
isFeedbackSubmitted: j,
|
|
3795
|
+
feedbackSubmitError: Ne,
|
|
3796
|
+
isLeadSubmitted: Pe,
|
|
3797
|
+
isLoadingSubmitLead: M,
|
|
3798
|
+
submitLeadError: Fe,
|
|
3799
|
+
buildDeviceContext: Ce,
|
|
3800
|
+
initialize: B,
|
|
3801
|
+
loadConversations: I,
|
|
3802
|
+
loadChatFiles: Le,
|
|
3803
|
+
refreshMessages: Ue,
|
|
3804
|
+
appendMessage: We,
|
|
3805
|
+
getChatFileUrl: Re,
|
|
3806
|
+
getChatFilePreviewUrl: ze,
|
|
3807
|
+
deleteChatFile: Be,
|
|
3808
|
+
handleSubmit: Je,
|
|
3809
|
+
sendMessage: Ye,
|
|
3810
|
+
stopGeneration: Xe,
|
|
3811
|
+
startNewChat: Ze,
|
|
3812
|
+
regenerate: Qe,
|
|
3813
|
+
addToolOutput: $e,
|
|
3814
|
+
addToolApprovalResponse: et,
|
|
3815
|
+
handleFileSelect: st,
|
|
3816
|
+
clearFileLimitError: ot,
|
|
3817
|
+
clearPendingAttachments: V,
|
|
3818
|
+
onUpvote: lt,
|
|
3819
|
+
onDownvote: U,
|
|
3820
|
+
onFeedback: ut,
|
|
3821
|
+
onFeedbackSubmit: dt,
|
|
3822
|
+
onLeadSubmit: ft,
|
|
3823
|
+
navigate: G,
|
|
3824
|
+
renameChatTitle: pt,
|
|
3825
|
+
deleteChat: W
|
|
4169
3826
|
};
|
|
4170
3827
|
})();
|
|
4171
3828
|
}
|
|
4172
3829
|
//#endregion
|
|
4173
|
-
export {
|
|
3830
|
+
export { z as a, Xn as i, Ar as n, Sr as r, Cr as t };
|
|
4174
3831
|
|
|
4175
|
-
//# sourceMappingURL=useChatbotStore-
|
|
3832
|
+
//# sourceMappingURL=useChatbotStore-BwrBZJCq.js.map
|