@8wave/ai-elements 0.126.0-beta.20 → 0.126.0-beta.21
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/ai-elements.es.js +2313 -2150
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.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/{PkChatbot-CxphD_YU.js → PkChatbot-Ck4H-uln.js} +6 -6
- package/dist-vue/_chunks/{PkChatbot-CxphD_YU.js.map → PkChatbot-Ck4H-uln.js.map} +1 -1
- package/dist-vue/_chunks/PkChatbotViewChat-SQLnQry2.js +1336 -0
- package/dist-vue/_chunks/PkChatbotViewChat-SQLnQry2.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewConversations-BbCnRdv4.js → PkChatbotViewConversations-D0vDYTyo.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewConversations-BbCnRdv4.js.map → PkChatbotViewConversations-D0vDYTyo.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewFiles-gwoZqmza.js → PkChatbotViewFiles-Bj5Nkzst.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewFiles-gwoZqmza.js.map → PkChatbotViewFiles-Bj5Nkzst.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewProfile-B7DroVld.js → PkChatbotViewProfile-GW0WuMOy.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewProfile-B7DroVld.js.map → PkChatbotViewProfile-GW0WuMOy.js.map} +1 -1
- package/dist-vue/_chunks/{PkFilePreview-N0kWPuFh.js → PkFilePreview-CyA7aA5I.js} +2 -2
- package/dist-vue/_chunks/{PkFilePreview-N0kWPuFh.js.map → PkFilePreview-CyA7aA5I.js.map} +1 -1
- package/dist-vue/_chunks/{PkFilePreviewDialog-DqBESOIS.js → PkFilePreviewDialog-1Pp-5cpt.js} +2 -2
- package/dist-vue/_chunks/{PkFilePreviewDialog-DqBESOIS.js.map → PkFilePreviewDialog-1Pp-5cpt.js.map} +1 -1
- package/dist-vue/_chunks/{createChatbotApiClient-BACnmIzY.js → createChatbotApiClient-Pb7_cU2s.js} +105 -75
- package/dist-vue/_chunks/createChatbotApiClient-Pb7_cU2s.js.map +1 -0
- package/dist-vue/_chunks/{useChatbotStore-B-WenuyB.js → useChatbotStore-ChrZVIDt.js} +1172 -1141
- package/dist-vue/_chunks/useChatbotStore-ChrZVIDt.js.map +1 -0
- package/dist-vue/api.js +1 -1
- package/dist-vue/composables.js +76 -2
- package/dist-vue/composables.js.map +1 -1
- package/dist-vue/index.js +4290 -3576
- package/dist-vue/index.js.map +1 -1
- package/dist-vue/locales.js +78 -2
- package/dist-vue/packages/components/src/PkSchemaField.d.ts +2 -2
- package/dist-vue/packages/components/src/chat/PkChatProjectDialog.d.ts +50 -0
- package/dist-vue/packages/components/src/chat/PkChatProjectMoveDialog.d.ts +23 -0
- package/dist-vue/packages/components/src/chat/PkChatSidebar.d.ts +5 -2
- package/dist-vue/packages/components/src/chat/PkChatSidebarConversationItem.d.ts +12 -0
- package/dist-vue/packages/components/src/chat/PkChatbot.d.ts +9 -3
- package/dist-vue/packages/components/src/chat/PkChatbotFeedbackForm.d.ts +2 -2
- package/dist-vue/packages/composable/src/chatbot/api/createChatbotApiClient.d.ts +20 -1
- package/dist-vue/packages/composable/src/chatbot/index.d.ts +1 -0
- package/dist-vue/packages/composable/src/chatbot/useChatProjectsStore.d.ts +4005 -0
- package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +36 -6
- package/dist-vue/packages/models/src/schema/ChatProject.d.ts +10 -0
- package/dist-vue/style.css +1 -1
- package/package.json +1 -1
- package/dist-vue/_chunks/PkChatbotViewChat-2J6g9Etg.js +0 -1307
- package/dist-vue/_chunks/PkChatbotViewChat-2J6g9Etg.js.map +0 -1
- package/dist-vue/_chunks/createChatbotApiClient-BACnmIzY.js.map +0 -1
- package/dist-vue/_chunks/useChatbotStore-B-WenuyB.js.map +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { $ as e, A as t, B as n, D as r, E as i, F as a, G as o, H as s, I as c, J as l, K as u, L as d, M as f, N as p, P as m, Q as h, R as g, S as _, T as v, U as y, W as b, X as ee, Y as te, Z as ne, _t as re, a as ie, at as ae, b as oe, bt as x, ct as se, dt as ce, et as le, g as ue, gt as de, h as fe, ht as pe, i as me, it as he, k as ge, l as _e, lt as ve, m as ye, mt as S, nt as C, o as be, ot as xe, p as w, q as Se, rt as Ce, s as we, st as Te, tt as Ee, u as De, ut as Oe, vt as ke, x as Ae, xt as je, y as Me, yt as Ne, z as Pe } from "./schemas-CwcNxjnD.js";
|
|
2
2
|
import { n as Fe, t as Ie } from "./useSafeLocalStorage-Bn4SsL8C.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { d as
|
|
6
|
-
import { n as
|
|
7
|
-
import { computed as T, getCurrentScope as E, isReadonly as
|
|
8
|
-
import { useI18n as
|
|
9
|
-
import { useDocumentVisibility as
|
|
3
|
+
import { i as Le, r as Re, t as ze } from "./createChatbotApiClient-Pb7_cU2s.js";
|
|
4
|
+
import { Q as Be, V as Ve, Z as He, at as Ue, et as We, nt as Ge, ot as Ke, st as qe } from "./Agent-CRwhrv5Z.js";
|
|
5
|
+
import { d as Je, r as Ye } from "./message-DuibQyHy.js";
|
|
6
|
+
import { n as Xe } from "./src-nb8MU1sh.js";
|
|
7
|
+
import { computed as T, getCurrentScope as E, isReadonly as Ze, nextTick as Qe, onScopeDispose as $e, reactive as et, ref as D, shallowRef as O, toRefs as tt, toValue as nt, watch as k, watchEffect as rt } from "vue";
|
|
8
|
+
import { useI18n as it } from "vue-i18n";
|
|
9
|
+
import { useDocumentVisibility as at, usePreferredDark as ot } from "@vueuse/core";
|
|
10
10
|
import { defineStore as A } from "pinia";
|
|
11
11
|
// ../../packages/utils/src/device-context.ts
|
|
12
|
-
function
|
|
12
|
+
function st() {
|
|
13
13
|
let e = navigator.connection, t = navigator.userAgentData;
|
|
14
14
|
return {
|
|
15
15
|
dateTime: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -39,7 +39,7 @@ function ot() {
|
|
|
39
39
|
historyLength: window.history.length
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
async function
|
|
42
|
+
async function ct(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,16 +57,16 @@ async function st(e) {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
// ../../packages/composable/src/chatbot/hostTools.ts
|
|
60
|
-
var
|
|
60
|
+
var lt = "agentstudio:page-navigation", ut = (e) => typeof e?.afterOutput == "function", dt = (e) => e.toolMetadata?.source === Ue, ft = (e, t) => {
|
|
61
61
|
if (!t || !e?.length) return;
|
|
62
|
-
let n = new Set(t.allowed), r = e.filter((e) => n.has(e.name) && !
|
|
62
|
+
let n = new Set(t.allowed), r = e.filter((e) => n.has(e.name) && !We(e.name)).map(({ execute: e, confirmation: t, policy: n, ...r }) => r);
|
|
63
63
|
return r.length > 0 ? r : void 0;
|
|
64
64
|
};
|
|
65
|
-
function
|
|
65
|
+
function pt(e) {
|
|
66
66
|
let t = 0, n = 0, r = (t) => {
|
|
67
67
|
n = t, e.onPendingChange?.(n);
|
|
68
68
|
}, i = Promise.resolve(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), s = (e) => {
|
|
69
|
-
|
|
69
|
+
ut(e) && e.abandon?.();
|
|
70
70
|
}, c = (e, t) => t.requireConfirmation.includes(e.name) || t.confirmDestructive && e.annotations?.destructiveHint === !0, l = (t, n) => e.addToolOutput({
|
|
71
71
|
tool: t.toolName,
|
|
72
72
|
toolCallId: t.toolCallId,
|
|
@@ -80,7 +80,7 @@ function ft(e) {
|
|
|
80
80
|
async function d(n, r) {
|
|
81
81
|
let i = () => r === t, d = e.capability(), f = e.registry()?.find((e) => e.name === n.toolName), p = f?.policy?.timeoutMs ?? d?.timeoutMs;
|
|
82
82
|
if (!f || p === void 0) {
|
|
83
|
-
u(n,
|
|
83
|
+
u(n, Ke(n.readOnly));
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
let m;
|
|
@@ -118,7 +118,7 @@ function ft(e) {
|
|
|
118
118
|
s(r);
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
121
|
-
if (
|
|
121
|
+
if (ut(r)) {
|
|
122
122
|
l(n, r.result ?? null);
|
|
123
123
|
let t = !1, a = () => {
|
|
124
124
|
t || (t = !0, o.delete(a), r.abandon?.());
|
|
@@ -130,7 +130,7 @@ function ft(e) {
|
|
|
130
130
|
} catch (e) {
|
|
131
131
|
if (b?.then(s, () => void 0), !i()) return;
|
|
132
132
|
let t = v.signal.aborted;
|
|
133
|
-
u(n, t ?
|
|
133
|
+
u(n, t ? Ke(n.readOnly) : e instanceof Error && e.message ? e.message : "The host app failed to run this call.");
|
|
134
134
|
} finally {
|
|
135
135
|
clearTimeout(y), a.delete(n.toolCallId), e.onActivity?.(void 0);
|
|
136
136
|
}
|
|
@@ -151,65 +151,65 @@ function ft(e) {
|
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
153
|
// ../../node_modules/.pnpm/@ai-sdk+provider@4.0.38/node_modules/@ai-sdk/provider/dist/index.js
|
|
154
|
-
var
|
|
154
|
+
var mt = "vercel.ai.error", ht = Symbol.for(mt), j = class e extends Error {
|
|
155
155
|
constructor({ name: e, message: t, cause: n }) {
|
|
156
|
-
super(t), this[
|
|
156
|
+
super(t), this[ht] = !0, this.name = e, this.cause = n;
|
|
157
157
|
}
|
|
158
158
|
static isInstance(t) {
|
|
159
|
-
return e.hasMarker(t,
|
|
159
|
+
return e.hasMarker(t, mt);
|
|
160
160
|
}
|
|
161
161
|
static hasMarker(e, t) {
|
|
162
162
|
let n = Symbol.for(t);
|
|
163
163
|
return typeof e == "object" && !!e && n in e && typeof e[n] == "boolean" && e[n] === !0;
|
|
164
164
|
}
|
|
165
|
-
},
|
|
165
|
+
}, gt = "AI_APICallError", _t = `vercel.ai.error.${gt}`, vt = Symbol.for(_t), yt = class extends j {
|
|
166
166
|
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 }) {
|
|
167
167
|
super({
|
|
168
|
-
name:
|
|
168
|
+
name: gt,
|
|
169
169
|
message: e,
|
|
170
170
|
cause: o
|
|
171
|
-
}), this[
|
|
171
|
+
}), this[vt] = !0, this.url = t, this.requestBodyValues = n, this.statusCode = r, this.responseHeaders = i, this.responseBody = a, this.isRetryable = s, this.data = c;
|
|
172
172
|
}
|
|
173
173
|
static isInstance(e) {
|
|
174
|
-
return j.hasMarker(e,
|
|
174
|
+
return j.hasMarker(e, _t);
|
|
175
175
|
}
|
|
176
|
-
},
|
|
176
|
+
}, bt = "AI_EmptyResponseBodyError", xt = `vercel.ai.error.${bt}`, St = Symbol.for(xt), Ct = class extends j {
|
|
177
177
|
constructor({ message: e = "Empty response body" } = {}) {
|
|
178
178
|
super({
|
|
179
|
-
name:
|
|
179
|
+
name: bt,
|
|
180
180
|
message: e
|
|
181
|
-
}), this[
|
|
181
|
+
}), this[St] = !0;
|
|
182
182
|
}
|
|
183
183
|
static isInstance(e) {
|
|
184
|
-
return j.hasMarker(e,
|
|
184
|
+
return j.hasMarker(e, xt);
|
|
185
185
|
}
|
|
186
186
|
};
|
|
187
|
-
function
|
|
187
|
+
function wt(e) {
|
|
188
188
|
return e == null ? "unknown error" : typeof e == "string" ? e : e instanceof Error ? e.toString() : JSON.stringify(e);
|
|
189
189
|
}
|
|
190
|
-
var
|
|
190
|
+
var Tt = "AI_InvalidArgumentError", Et = `vercel.ai.error.${Tt}`, Dt = Symbol.for(Et), Ot = class extends j {
|
|
191
191
|
constructor({ message: e, cause: t, argument: n }) {
|
|
192
192
|
super({
|
|
193
|
-
name:
|
|
193
|
+
name: Tt,
|
|
194
194
|
message: e,
|
|
195
195
|
cause: t
|
|
196
|
-
}), this[
|
|
196
|
+
}), this[Dt] = !0, this.argument = n;
|
|
197
197
|
}
|
|
198
198
|
static isInstance(e) {
|
|
199
|
-
return j.hasMarker(e,
|
|
199
|
+
return j.hasMarker(e, Et);
|
|
200
200
|
}
|
|
201
|
-
}, M = "AI_JSONParseError",
|
|
201
|
+
}, M = "AI_JSONParseError", kt = `vercel.ai.error.${M}`, At = Symbol.for(kt), jt = class extends j {
|
|
202
202
|
constructor({ text: e, cause: t }) {
|
|
203
203
|
super({
|
|
204
204
|
name: M,
|
|
205
|
-
message: `JSON parsing failed: Text: ${e}.\nError message: ${
|
|
205
|
+
message: `JSON parsing failed: Text: ${e}.\nError message: ${wt(t)}`,
|
|
206
206
|
cause: t
|
|
207
|
-
}), this[
|
|
207
|
+
}), this[At] = !0, this.text = e;
|
|
208
208
|
}
|
|
209
209
|
static isInstance(e) {
|
|
210
|
-
return j.hasMarker(e,
|
|
210
|
+
return j.hasMarker(e, kt);
|
|
211
211
|
}
|
|
212
|
-
}, N = "AI_TypeValidationError", P = `vercel.ai.error.${N}`,
|
|
212
|
+
}, N = "AI_TypeValidationError", P = `vercel.ai.error.${N}`, Mt = Symbol.for(P), Nt = class e extends j {
|
|
213
213
|
constructor({ value: e, cause: t, context: n }) {
|
|
214
214
|
let r = "Type validation failed";
|
|
215
215
|
if (n?.field && (r += ` for ${n.field}`), n?.entityName || n?.entityId) {
|
|
@@ -219,9 +219,9 @@ var wt = "AI_InvalidArgumentError", Tt = `vercel.ai.error.${wt}`, Et = Symbol.fo
|
|
|
219
219
|
}
|
|
220
220
|
super({
|
|
221
221
|
name: N,
|
|
222
|
-
message: `${r}: Value: ${JSON.stringify(e)}.\nError message: ${
|
|
222
|
+
message: `${r}: Value: ${JSON.stringify(e)}.\nError message: ${wt(t)}`,
|
|
223
223
|
cause: t
|
|
224
|
-
}), this[
|
|
224
|
+
}), this[Mt] = !0, this.value = e, this.context = n;
|
|
225
225
|
}
|
|
226
226
|
static isInstance(e) {
|
|
227
227
|
return j.hasMarker(e, P);
|
|
@@ -233,25 +233,25 @@ var wt = "AI_InvalidArgumentError", Tt = `vercel.ai.error.${wt}`, Et = Symbol.fo
|
|
|
233
233
|
context: r
|
|
234
234
|
});
|
|
235
235
|
}
|
|
236
|
-
},
|
|
236
|
+
}, Pt = "AI_UnsupportedFunctionalityError", Ft = `vercel.ai.error.${Pt}`, It = Symbol.for(Ft), Lt = class extends j {
|
|
237
237
|
constructor({ functionality: e, message: t = `'${e}' functionality not supported.` }) {
|
|
238
238
|
super({
|
|
239
|
-
name:
|
|
239
|
+
name: Pt,
|
|
240
240
|
message: t
|
|
241
|
-
}), this[
|
|
241
|
+
}), this[It] = !0, this.functionality = e;
|
|
242
242
|
}
|
|
243
243
|
static isInstance(e) {
|
|
244
|
-
return j.hasMarker(e,
|
|
244
|
+
return j.hasMarker(e, Ft);
|
|
245
245
|
}
|
|
246
|
-
},
|
|
246
|
+
}, Rt = class extends Error {
|
|
247
247
|
constructor(e, t) {
|
|
248
248
|
super(e), this.name = "ParseError", this.type = t.type, this.field = t.field, this.value = t.value, this.line = t.line;
|
|
249
249
|
}
|
|
250
|
-
},
|
|
251
|
-
function
|
|
252
|
-
function
|
|
250
|
+
}, F = 10, zt = 13, Bt = 32;
|
|
251
|
+
function Vt(e) {}
|
|
252
|
+
function Ht(e) {
|
|
253
253
|
if (typeof e == "function") throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");
|
|
254
|
-
let { onEvent: t =
|
|
254
|
+
let { onEvent: t = Vt, onError: n = Vt, onRetry: r = Vt, onComment: i, maxBufferSize: a } = e, o = [], s = 0, c = !0, l, u = "", d = 0, f, p = !1;
|
|
255
255
|
function m(e) {
|
|
256
256
|
if (p) throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");
|
|
257
257
|
if (c && (c = !1, e.charCodeAt(0) === 239 && e.charCodeAt(1) === 187 && e.charCodeAt(2) === 191 && (e = e.slice(3))), o.length === 0) {
|
|
@@ -270,7 +270,7 @@ function Bt(e) {
|
|
|
270
270
|
n !== "" && (o.push(n), s = n.length), h();
|
|
271
271
|
}
|
|
272
272
|
function h() {
|
|
273
|
-
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
|
|
273
|
+
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 Rt(`Buffered data exceeded max buffer size of ${a} characters`, { type: "max-buffer-size-exceeded" }))));
|
|
274
274
|
}
|
|
275
275
|
function g(e) {
|
|
276
276
|
let n = 0;
|
|
@@ -286,9 +286,9 @@ function Bt(e) {
|
|
|
286
286
|
continue;
|
|
287
287
|
}
|
|
288
288
|
let i = e.charCodeAt(n);
|
|
289
|
-
if (
|
|
290
|
-
let i = e.charCodeAt(n + 5) ===
|
|
291
|
-
if (d === 0 && e.charCodeAt(r + 1) ===
|
|
289
|
+
if (Ut(e, n, i)) {
|
|
290
|
+
let i = e.charCodeAt(n + 5) === Bt ? n + 6 : n + 5, a = e.slice(i, r);
|
|
291
|
+
if (d === 0 && e.charCodeAt(r + 1) === F) {
|
|
292
292
|
t({
|
|
293
293
|
id: l,
|
|
294
294
|
event: f,
|
|
@@ -298,7 +298,7 @@ function Bt(e) {
|
|
|
298
298
|
}
|
|
299
299
|
u = d === 0 ? a : `${u}
|
|
300
300
|
${a}`, d++;
|
|
301
|
-
} else
|
|
301
|
+
} else Wt(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) === Bt ? n + 7 : n + 6, r) || void 0 : _(e, n, r);
|
|
302
302
|
n = r + 1, r = e.indexOf("\n", n);
|
|
303
303
|
}
|
|
304
304
|
return e.slice(n);
|
|
@@ -306,7 +306,7 @@ ${a}`, d++;
|
|
|
306
306
|
for (; n < e.length;) {
|
|
307
307
|
let t = e.indexOf("\r", n), r = e.indexOf("\n", n), i = -1;
|
|
308
308
|
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;
|
|
309
|
-
_(e, n, i), n = i + 1, e.charCodeAt(n - 1) ===
|
|
309
|
+
_(e, n, i), n = i + 1, e.charCodeAt(n - 1) === zt && e.charCodeAt(n) === F && n++;
|
|
310
310
|
}
|
|
311
311
|
return e.slice(n);
|
|
312
312
|
}
|
|
@@ -316,25 +316,25 @@ ${a}`, d++;
|
|
|
316
316
|
return;
|
|
317
317
|
}
|
|
318
318
|
let r = e.charCodeAt(t);
|
|
319
|
-
if (
|
|
320
|
-
let r = e.charCodeAt(t + 5) ===
|
|
319
|
+
if (Ut(e, t, r)) {
|
|
320
|
+
let r = e.charCodeAt(t + 5) === Bt ? t + 6 : t + 5, i = e.slice(r, n);
|
|
321
321
|
u = d === 0 ? i : `${u}
|
|
322
322
|
${i}`, d++;
|
|
323
323
|
return;
|
|
324
324
|
}
|
|
325
|
-
if (
|
|
326
|
-
f = e.slice(e.charCodeAt(t + 6) ===
|
|
325
|
+
if (Wt(e, t, r)) {
|
|
326
|
+
f = e.slice(e.charCodeAt(t + 6) === Bt ? t + 7 : t + 6, n) || void 0;
|
|
327
327
|
return;
|
|
328
328
|
}
|
|
329
329
|
if (r === 105 && e.charCodeAt(t + 1) === 100 && e.charCodeAt(t + 2) === 58) {
|
|
330
|
-
let r = e.slice(e.charCodeAt(t + 3) ===
|
|
330
|
+
let r = e.slice(e.charCodeAt(t + 3) === Bt ? t + 4 : t + 3, n);
|
|
331
331
|
l = r.includes("\0") ? void 0 : r;
|
|
332
332
|
return;
|
|
333
333
|
}
|
|
334
334
|
if (r === 58) {
|
|
335
335
|
if (i) {
|
|
336
336
|
let r = e.slice(t, n);
|
|
337
|
-
i(r.slice(e.charCodeAt(t + 1) ===
|
|
337
|
+
i(r.slice(e.charCodeAt(t + 1) === Bt ? 2 : 1));
|
|
338
338
|
}
|
|
339
339
|
return;
|
|
340
340
|
}
|
|
@@ -343,7 +343,7 @@ ${i}`, d++;
|
|
|
343
343
|
v(a, "", a);
|
|
344
344
|
return;
|
|
345
345
|
}
|
|
346
|
-
let s = a.slice(0, o), c = a.charCodeAt(o + 1) ===
|
|
346
|
+
let s = a.slice(0, o), c = a.charCodeAt(o + 1) === Bt ? 2 : 1;
|
|
347
347
|
v(s, a.slice(o + c), a);
|
|
348
348
|
}
|
|
349
349
|
function v(e, t, i) {
|
|
@@ -359,13 +359,13 @@ ${t}`, d++;
|
|
|
359
359
|
l = t.includes("\0") ? void 0 : t;
|
|
360
360
|
break;
|
|
361
361
|
case "retry":
|
|
362
|
-
/^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new
|
|
362
|
+
/^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new Rt(`Invalid \`retry\` value: "${t}"`, {
|
|
363
363
|
type: "invalid-retry",
|
|
364
364
|
value: t,
|
|
365
365
|
line: i
|
|
366
366
|
}));
|
|
367
367
|
break;
|
|
368
|
-
default: n(new
|
|
368
|
+
default: n(new Rt(`Unknown field "${e.length > 20 ? `${e.slice(0, 20)}\u2026` : e}"`, {
|
|
369
369
|
type: "unknown-field",
|
|
370
370
|
field: e,
|
|
371
371
|
value: t,
|
|
@@ -392,19 +392,19 @@ ${t}`, d++;
|
|
|
392
392
|
reset: b
|
|
393
393
|
};
|
|
394
394
|
}
|
|
395
|
-
function
|
|
395
|
+
function Ut(e, t, n) {
|
|
396
396
|
return n === 100 && e.charCodeAt(t + 1) === 97 && e.charCodeAt(t + 2) === 116 && e.charCodeAt(t + 3) === 97 && e.charCodeAt(t + 4) === 58;
|
|
397
397
|
}
|
|
398
|
-
function
|
|
398
|
+
function Wt(e, t, n) {
|
|
399
399
|
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;
|
|
400
400
|
}
|
|
401
401
|
// ../../node_modules/.pnpm/eventsource-parser@3.1.0/node_modules/eventsource-parser/dist/stream.js
|
|
402
|
-
var
|
|
402
|
+
var Gt = class extends TransformStream {
|
|
403
403
|
constructor({ onError: e, onRetry: t, onComment: n, maxBufferSize: r } = {}) {
|
|
404
404
|
let i;
|
|
405
405
|
super({
|
|
406
406
|
start(a) {
|
|
407
|
-
i =
|
|
407
|
+
i = Ht({
|
|
408
408
|
onEvent: (e) => {
|
|
409
409
|
a.enqueue(e);
|
|
410
410
|
},
|
|
@@ -423,19 +423,19 @@ var L = class extends TransformStream {
|
|
|
423
423
|
}
|
|
424
424
|
};
|
|
425
425
|
new TextDecoder();
|
|
426
|
-
var { btoa:
|
|
427
|
-
function
|
|
428
|
-
return ArrayBuffer.isView(e) &&
|
|
426
|
+
var { btoa: Kt, atob: qt } = globalThis, Jt = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype), Symbol.toStringTag).get, Yt = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength").get;
|
|
427
|
+
function Xt(e) {
|
|
428
|
+
return ArrayBuffer.isView(e) && Jt.call(e) === "Uint8Array";
|
|
429
429
|
}
|
|
430
|
-
function
|
|
430
|
+
function I(e) {
|
|
431
431
|
if (typeof e != "object" || !e || !("byteLength" in e)) return !1;
|
|
432
432
|
try {
|
|
433
|
-
return
|
|
433
|
+
return Yt.call(e), !0;
|
|
434
434
|
} catch {
|
|
435
435
|
return !1;
|
|
436
436
|
}
|
|
437
437
|
}
|
|
438
|
-
function
|
|
438
|
+
function Zt(e) {
|
|
439
439
|
if (e == null) return {};
|
|
440
440
|
let t = {};
|
|
441
441
|
if (e instanceof Headers) e.forEach((e, n) => {
|
|
@@ -447,28 +447,28 @@ function Yt(e) {
|
|
|
447
447
|
}
|
|
448
448
|
return t;
|
|
449
449
|
}
|
|
450
|
-
var
|
|
450
|
+
var L = ({ prefix: e, size: t = 16, alphabet: n = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", separator: r = "-" } = {}) => {
|
|
451
451
|
let i = () => {
|
|
452
452
|
let e = n.length, r = Array(t);
|
|
453
453
|
for (let i = 0; i < t; i++) r[i] = n[Math.random() * e | 0];
|
|
454
454
|
return r.join("");
|
|
455
455
|
};
|
|
456
456
|
if (e == null) return i;
|
|
457
|
-
if (n.includes(r)) throw new
|
|
457
|
+
if (n.includes(r)) throw new Ot({
|
|
458
458
|
argument: "separator",
|
|
459
459
|
message: `The separator "${r}" must not be part of the alphabet "${n}".`
|
|
460
460
|
});
|
|
461
461
|
return () => `${e}${r}${i()}`;
|
|
462
|
-
},
|
|
463
|
-
function
|
|
462
|
+
}, Qt = L();
|
|
463
|
+
function R(e) {
|
|
464
464
|
return globalThis.Buffer?.isBuffer(e) ?? !1;
|
|
465
465
|
}
|
|
466
|
-
var
|
|
467
|
-
function
|
|
466
|
+
var $t = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/, en = /"(?: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*:/;
|
|
467
|
+
function tn(e) {
|
|
468
468
|
let t = JSON.parse(e);
|
|
469
|
-
return typeof t != "object" || !t ||
|
|
469
|
+
return typeof t != "object" || !t || $t.test(e) === !1 && en.test(e) === !1 ? t : nn(t);
|
|
470
470
|
}
|
|
471
|
-
function
|
|
471
|
+
function nn(e) {
|
|
472
472
|
let t = [e];
|
|
473
473
|
for (; t.length;) {
|
|
474
474
|
let e = t;
|
|
@@ -483,35 +483,35 @@ function tn(e) {
|
|
|
483
483
|
}
|
|
484
484
|
return e;
|
|
485
485
|
}
|
|
486
|
-
function
|
|
486
|
+
function rn(e) {
|
|
487
487
|
let { stackTraceLimit: t } = Error;
|
|
488
488
|
try {
|
|
489
489
|
Error.stackTraceLimit = 0;
|
|
490
490
|
} catch {
|
|
491
|
-
return
|
|
491
|
+
return tn(e);
|
|
492
492
|
}
|
|
493
493
|
try {
|
|
494
|
-
return
|
|
494
|
+
return tn(e);
|
|
495
495
|
} finally {
|
|
496
496
|
Error.stackTraceLimit = t;
|
|
497
497
|
}
|
|
498
498
|
}
|
|
499
|
-
function
|
|
499
|
+
function z(e) {
|
|
500
500
|
if (e.type === "object" || Array.isArray(e.type) && e.type.includes("object")) {
|
|
501
501
|
let { additionalProperties: t } = e;
|
|
502
|
-
e.additionalProperties = t != null && typeof t != "boolean" &&
|
|
502
|
+
e.additionalProperties = t != null && typeof t != "boolean" && B(t);
|
|
503
503
|
let { properties: n } = e;
|
|
504
|
-
if (n != null) for (let e of Object.keys(n)) n[e] =
|
|
504
|
+
if (n != null) for (let e of Object.keys(n)) n[e] = B(n[e]);
|
|
505
505
|
}
|
|
506
|
-
e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(
|
|
506
|
+
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));
|
|
507
507
|
let { definitions: t } = e;
|
|
508
|
-
if (t != null) for (let e of Object.keys(t)) t[e] =
|
|
508
|
+
if (t != null) for (let e of Object.keys(t)) t[e] = B(t[e]);
|
|
509
509
|
return e;
|
|
510
510
|
}
|
|
511
|
-
function
|
|
512
|
-
return typeof e == "boolean" ? e :
|
|
511
|
+
function B(e) {
|
|
512
|
+
return typeof e == "boolean" ? e : z(e);
|
|
513
513
|
}
|
|
514
|
-
var an = Symbol("Let zodToJsonSchema decide on which parser to use"),
|
|
514
|
+
var an = Symbol("Let zodToJsonSchema decide on which parser to use"), on = {
|
|
515
515
|
name: void 0,
|
|
516
516
|
$refStrategy: "root",
|
|
517
517
|
basePath: ["#"],
|
|
@@ -531,24 +531,24 @@ var an = Symbol("Let zodToJsonSchema decide on which parser to use"), B = {
|
|
|
531
531
|
emailStrategy: "format:email",
|
|
532
532
|
base64Strategy: "contentEncoding:base64",
|
|
533
533
|
nameStrategy: "ref"
|
|
534
|
-
},
|
|
535
|
-
...
|
|
534
|
+
}, sn = (e) => typeof e == "string" ? {
|
|
535
|
+
...on,
|
|
536
536
|
name: e
|
|
537
537
|
} : {
|
|
538
|
-
...
|
|
538
|
+
...on,
|
|
539
539
|
...e
|
|
540
540
|
};
|
|
541
|
-
function
|
|
541
|
+
function V() {
|
|
542
542
|
return {};
|
|
543
543
|
}
|
|
544
|
-
function
|
|
544
|
+
function cn(e, t) {
|
|
545
545
|
let n = { type: "array" };
|
|
546
|
-
return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items =
|
|
546
|
+
return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = J(e.type._def, {
|
|
547
547
|
...t,
|
|
548
548
|
currentPath: [...t.currentPath, "items"]
|
|
549
549
|
})), 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;
|
|
550
550
|
}
|
|
551
|
-
function
|
|
551
|
+
function ln(e) {
|
|
552
552
|
let t = {
|
|
553
553
|
type: "integer",
|
|
554
554
|
format: "int64"
|
|
@@ -565,16 +565,16 @@ function sn(e) {
|
|
|
565
565
|
}
|
|
566
566
|
return t;
|
|
567
567
|
}
|
|
568
|
-
function
|
|
568
|
+
function un() {
|
|
569
569
|
return { type: "boolean" };
|
|
570
570
|
}
|
|
571
|
-
function
|
|
572
|
-
return
|
|
571
|
+
function dn(e, t) {
|
|
572
|
+
return J(e.type._def, t);
|
|
573
573
|
}
|
|
574
|
-
var
|
|
575
|
-
function
|
|
574
|
+
var fn = (e, t) => J(e.innerType._def, t);
|
|
575
|
+
function pn(e, t, n) {
|
|
576
576
|
let r = n ?? t.dateStrategy;
|
|
577
|
-
if (Array.isArray(r)) return { anyOf: r.map((n) =>
|
|
577
|
+
if (Array.isArray(r)) return { anyOf: r.map((n) => pn(e, t, n)) };
|
|
578
578
|
switch (r) {
|
|
579
579
|
case "string":
|
|
580
580
|
case "format:date-time": return {
|
|
@@ -585,10 +585,10 @@ function dn(e, t, n) {
|
|
|
585
585
|
type: "string",
|
|
586
586
|
format: "date"
|
|
587
587
|
};
|
|
588
|
-
case "integer": return
|
|
588
|
+
case "integer": return H(e);
|
|
589
589
|
}
|
|
590
590
|
}
|
|
591
|
-
var
|
|
591
|
+
var H = (e) => {
|
|
592
592
|
let t = {
|
|
593
593
|
type: "integer",
|
|
594
594
|
format: "unix-time"
|
|
@@ -601,31 +601,31 @@ var fn = (e) => {
|
|
|
601
601
|
}
|
|
602
602
|
return t;
|
|
603
603
|
};
|
|
604
|
-
function
|
|
604
|
+
function U(e, t) {
|
|
605
605
|
return {
|
|
606
|
-
...
|
|
606
|
+
...J(e.innerType._def, t),
|
|
607
607
|
default: e.defaultValue()
|
|
608
608
|
};
|
|
609
609
|
}
|
|
610
|
-
function
|
|
611
|
-
return t.effectStrategy === "input" ?
|
|
610
|
+
function W(e, t) {
|
|
611
|
+
return t.effectStrategy === "input" ? J(e.schema._def, t) : V();
|
|
612
612
|
}
|
|
613
|
-
function
|
|
613
|
+
function mn(e) {
|
|
614
614
|
return {
|
|
615
615
|
type: "string",
|
|
616
616
|
enum: Array.from(e.values)
|
|
617
617
|
};
|
|
618
618
|
}
|
|
619
|
-
var
|
|
620
|
-
function
|
|
621
|
-
let n = [
|
|
619
|
+
var hn = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
|
|
620
|
+
function gn(e, t) {
|
|
621
|
+
let n = [J(e.left._def, {
|
|
622
622
|
...t,
|
|
623
623
|
currentPath: [
|
|
624
624
|
...t.currentPath,
|
|
625
625
|
"allOf",
|
|
626
626
|
"0"
|
|
627
627
|
]
|
|
628
|
-
}),
|
|
628
|
+
}), J(e.right._def, {
|
|
629
629
|
...t,
|
|
630
630
|
currentPath: [
|
|
631
631
|
...t.currentPath,
|
|
@@ -634,7 +634,7 @@ function _n(e, t) {
|
|
|
634
634
|
]
|
|
635
635
|
})].filter((e) => !!e), r = [];
|
|
636
636
|
return n.forEach((e) => {
|
|
637
|
-
if (
|
|
637
|
+
if (hn(e)) r.push(...e.allOf);
|
|
638
638
|
else {
|
|
639
639
|
let t = e;
|
|
640
640
|
if ("additionalProperties" in e && e.additionalProperties === !1) {
|
|
@@ -645,19 +645,19 @@ function _n(e, t) {
|
|
|
645
645
|
}
|
|
646
646
|
}), r.length ? { allOf: r } : void 0;
|
|
647
647
|
}
|
|
648
|
-
function
|
|
648
|
+
function _n(e) {
|
|
649
649
|
let t = typeof e.value;
|
|
650
650
|
return t !== "bigint" && t !== "number" && t !== "boolean" && t !== "string" ? { type: Array.isArray(e.value) ? "array" : "object" } : {
|
|
651
651
|
type: t === "bigint" ? "integer" : t,
|
|
652
652
|
const: e.value
|
|
653
653
|
};
|
|
654
654
|
}
|
|
655
|
-
var
|
|
655
|
+
var vn = void 0, G = {
|
|
656
656
|
cuid: /^[cC][^\s-]{8,}$/,
|
|
657
657
|
cuid2: /^[0-9a-z]+$/,
|
|
658
658
|
ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
|
|
659
659
|
email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}$/,
|
|
660
|
-
emoji: () => (
|
|
660
|
+
emoji: () => (vn === void 0 && (vn = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u")), vn),
|
|
661
661
|
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}$/,
|
|
662
662
|
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])$/,
|
|
663
663
|
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])$/,
|
|
@@ -668,7 +668,7 @@ var yn = void 0, U = {
|
|
|
668
668
|
nanoid: /^[a-zA-Z0-9_-]{21}$/,
|
|
669
669
|
jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
|
|
670
670
|
};
|
|
671
|
-
function
|
|
671
|
+
function yn(e, t) {
|
|
672
672
|
let n = { type: "string" };
|
|
673
673
|
if (e.checks) for (let r of e.checks) switch (r.kind) {
|
|
674
674
|
case "min":
|
|
@@ -680,108 +680,108 @@ function bn(e, t) {
|
|
|
680
680
|
case "email":
|
|
681
681
|
switch (t.emailStrategy) {
|
|
682
682
|
case "format:email":
|
|
683
|
-
|
|
683
|
+
K(n, "email", r.message, t);
|
|
684
684
|
break;
|
|
685
685
|
case "format:idn-email":
|
|
686
|
-
|
|
686
|
+
K(n, "idn-email", r.message, t);
|
|
687
687
|
break;
|
|
688
|
-
case "pattern:zod":
|
|
688
|
+
case "pattern:zod": q(n, G.email, r.message, t);
|
|
689
689
|
}
|
|
690
690
|
break;
|
|
691
691
|
case "url":
|
|
692
|
-
|
|
692
|
+
K(n, "uri", r.message, t);
|
|
693
693
|
break;
|
|
694
694
|
case "uuid":
|
|
695
|
-
|
|
695
|
+
K(n, "uuid", r.message, t);
|
|
696
696
|
break;
|
|
697
697
|
case "regex":
|
|
698
|
-
|
|
698
|
+
q(n, r.regex, r.message, t);
|
|
699
699
|
break;
|
|
700
700
|
case "cuid":
|
|
701
|
-
|
|
701
|
+
q(n, G.cuid, r.message, t);
|
|
702
702
|
break;
|
|
703
703
|
case "cuid2":
|
|
704
|
-
|
|
704
|
+
q(n, G.cuid2, r.message, t);
|
|
705
705
|
break;
|
|
706
706
|
case "startsWith":
|
|
707
|
-
|
|
707
|
+
q(n, RegExp(`^${bn(r.value, t)}`), r.message, t);
|
|
708
708
|
break;
|
|
709
709
|
case "endsWith":
|
|
710
|
-
|
|
710
|
+
q(n, RegExp(`${bn(r.value, t)}$`), r.message, t);
|
|
711
711
|
break;
|
|
712
712
|
case "datetime":
|
|
713
|
-
|
|
713
|
+
K(n, "date-time", r.message, t);
|
|
714
714
|
break;
|
|
715
715
|
case "date":
|
|
716
|
-
|
|
716
|
+
K(n, "date", r.message, t);
|
|
717
717
|
break;
|
|
718
718
|
case "time":
|
|
719
|
-
|
|
719
|
+
K(n, "time", r.message, t);
|
|
720
720
|
break;
|
|
721
721
|
case "duration":
|
|
722
|
-
|
|
722
|
+
K(n, "duration", r.message, t);
|
|
723
723
|
break;
|
|
724
724
|
case "length":
|
|
725
725
|
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;
|
|
726
726
|
break;
|
|
727
727
|
case "includes":
|
|
728
|
-
|
|
728
|
+
q(n, RegExp(bn(r.value, t)), r.message, t);
|
|
729
729
|
break;
|
|
730
730
|
case "ip":
|
|
731
|
-
r.version !== "v6" &&
|
|
731
|
+
r.version !== "v6" && K(n, "ipv4", r.message, t), r.version !== "v4" && K(n, "ipv6", r.message, t);
|
|
732
732
|
break;
|
|
733
733
|
case "base64url":
|
|
734
|
-
|
|
734
|
+
q(n, G.base64url, r.message, t);
|
|
735
735
|
break;
|
|
736
736
|
case "jwt":
|
|
737
|
-
|
|
737
|
+
q(n, G.jwt, r.message, t);
|
|
738
738
|
break;
|
|
739
739
|
case "cidr":
|
|
740
|
-
r.version !== "v6" &&
|
|
740
|
+
r.version !== "v6" && q(n, G.ipv4Cidr, r.message, t), r.version !== "v4" && q(n, G.ipv6Cidr, r.message, t);
|
|
741
741
|
break;
|
|
742
742
|
case "emoji":
|
|
743
|
-
|
|
743
|
+
q(n, G.emoji(), r.message, t);
|
|
744
744
|
break;
|
|
745
745
|
case "ulid":
|
|
746
|
-
|
|
746
|
+
q(n, G.ulid, r.message, t);
|
|
747
747
|
break;
|
|
748
748
|
case "base64":
|
|
749
749
|
switch (t.base64Strategy) {
|
|
750
750
|
case "format:binary":
|
|
751
|
-
|
|
751
|
+
K(n, "binary", r.message, t);
|
|
752
752
|
break;
|
|
753
753
|
case "contentEncoding:base64":
|
|
754
754
|
n.contentEncoding = "base64";
|
|
755
755
|
break;
|
|
756
|
-
case "pattern:zod":
|
|
756
|
+
case "pattern:zod": q(n, G.base64, r.message, t);
|
|
757
757
|
}
|
|
758
758
|
break;
|
|
759
|
-
case "nanoid":
|
|
759
|
+
case "nanoid": q(n, G.nanoid, r.message, t);
|
|
760
760
|
}
|
|
761
761
|
return n;
|
|
762
762
|
}
|
|
763
|
-
function
|
|
764
|
-
return t.patternStrategy === "escape" ?
|
|
763
|
+
function bn(e, t) {
|
|
764
|
+
return t.patternStrategy === "escape" ? Sn(e) : e;
|
|
765
765
|
}
|
|
766
|
-
var
|
|
767
|
-
function
|
|
766
|
+
var xn = /* @__PURE__ */ new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
767
|
+
function Sn(e) {
|
|
768
768
|
let t = "";
|
|
769
|
-
for (let n = 0; n < e.length; n++)
|
|
769
|
+
for (let n = 0; n < e.length; n++) xn.has(e[n]) || (t += "\\"), t += e[n];
|
|
770
770
|
return t;
|
|
771
771
|
}
|
|
772
|
-
function
|
|
772
|
+
function K(e, t, n, r) {
|
|
773
773
|
e.format || e.anyOf?.some((e) => e.format) ? (e.anyOf ||= [], e.format && (e.anyOf.push({ format: e.format }), delete e.format), e.anyOf.push({
|
|
774
774
|
format: t,
|
|
775
775
|
...n && r.errorMessages && { errorMessage: { format: n } }
|
|
776
776
|
})) : e.format = t;
|
|
777
777
|
}
|
|
778
|
-
function
|
|
778
|
+
function q(e, t, n, r) {
|
|
779
779
|
e.pattern || e.allOf?.some((e) => e.pattern) ? (e.allOf ||= [], e.pattern && (e.allOf.push({ pattern: e.pattern }), delete e.pattern), e.allOf.push({
|
|
780
|
-
pattern:
|
|
780
|
+
pattern: Cn(t, r),
|
|
781
781
|
...n && r.errorMessages && { errorMessage: { pattern: n } }
|
|
782
|
-
})) : e.pattern =
|
|
782
|
+
})) : e.pattern = Cn(t, r);
|
|
783
783
|
}
|
|
784
|
-
function
|
|
784
|
+
function Cn(e, t) {
|
|
785
785
|
if (!t.applyRegexFlags || !e.flags) return e.source;
|
|
786
786
|
let n = {
|
|
787
787
|
i: e.flags.includes("i"),
|
|
@@ -820,16 +820,16 @@ function wn(e, t) {
|
|
|
820
820
|
}
|
|
821
821
|
return i;
|
|
822
822
|
}
|
|
823
|
-
function
|
|
823
|
+
function wn(e, t) {
|
|
824
824
|
let n = {
|
|
825
825
|
type: "object",
|
|
826
|
-
additionalProperties:
|
|
826
|
+
additionalProperties: J(e.valueType._def, {
|
|
827
827
|
...t,
|
|
828
828
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
829
829
|
}) ?? t.allowedAdditionalProperties
|
|
830
830
|
};
|
|
831
831
|
if (e.keyType?._def.typeName === "ZodString" && e.keyType._def.checks?.length) {
|
|
832
|
-
let { type: r, ...i } =
|
|
832
|
+
let { type: r, ...i } = yn(e.keyType._def, t);
|
|
833
833
|
return {
|
|
834
834
|
...n,
|
|
835
835
|
propertyNames: i
|
|
@@ -840,7 +840,7 @@ function K(e, t) {
|
|
|
840
840
|
propertyNames: { enum: e.keyType._def.values }
|
|
841
841
|
};
|
|
842
842
|
if (e.keyType?._def.typeName === "ZodBranded" && e.keyType._def.type._def.typeName === "ZodString" && e.keyType._def.type._def.checks?.length) {
|
|
843
|
-
let { type: r, ...i } =
|
|
843
|
+
let { type: r, ...i } = dn(e.keyType._def, t);
|
|
844
844
|
return {
|
|
845
845
|
...n,
|
|
846
846
|
propertyNames: i
|
|
@@ -849,12 +849,12 @@ function K(e, t) {
|
|
|
849
849
|
return n;
|
|
850
850
|
}
|
|
851
851
|
function Tn(e, t) {
|
|
852
|
-
return t.mapStrategy === "record" ?
|
|
852
|
+
return t.mapStrategy === "record" ? wn(e, t) : {
|
|
853
853
|
type: "array",
|
|
854
854
|
maxItems: 125,
|
|
855
855
|
items: {
|
|
856
856
|
type: "array",
|
|
857
|
-
items: [
|
|
857
|
+
items: [J(e.keyType._def, {
|
|
858
858
|
...t,
|
|
859
859
|
currentPath: [
|
|
860
860
|
...t.currentPath,
|
|
@@ -862,7 +862,7 @@ function Tn(e, t) {
|
|
|
862
862
|
"items",
|
|
863
863
|
"0"
|
|
864
864
|
]
|
|
865
|
-
}) ||
|
|
865
|
+
}) || V(), J(e.valueType._def, {
|
|
866
866
|
...t,
|
|
867
867
|
currentPath: [
|
|
868
868
|
...t.currentPath,
|
|
@@ -870,7 +870,7 @@ function Tn(e, t) {
|
|
|
870
870
|
"items",
|
|
871
871
|
"1"
|
|
872
872
|
]
|
|
873
|
-
}) ||
|
|
873
|
+
}) || V()],
|
|
874
874
|
minItems: 2,
|
|
875
875
|
maxItems: 2
|
|
876
876
|
}
|
|
@@ -884,7 +884,7 @@ function En(e) {
|
|
|
884
884
|
};
|
|
885
885
|
}
|
|
886
886
|
function Dn() {
|
|
887
|
-
return { not:
|
|
887
|
+
return { not: V() };
|
|
888
888
|
}
|
|
889
889
|
function On() {
|
|
890
890
|
return { type: "null" };
|
|
@@ -931,7 +931,7 @@ function An(e, t) {
|
|
|
931
931
|
return jn(e, t);
|
|
932
932
|
}
|
|
933
933
|
var jn = (e, t) => {
|
|
934
|
-
let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) =>
|
|
934
|
+
let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => J(e._def, {
|
|
935
935
|
...t,
|
|
936
936
|
currentPath: [
|
|
937
937
|
...t.currentPath,
|
|
@@ -949,7 +949,7 @@ function Mn(e, t) {
|
|
|
949
949
|
"ZodBoolean",
|
|
950
950
|
"ZodNull"
|
|
951
951
|
].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [kn[e.innerType._def.typeName], "null"] };
|
|
952
|
-
let n =
|
|
952
|
+
let n = J(e.innerType._def, {
|
|
953
953
|
...t,
|
|
954
954
|
currentPath: [
|
|
955
955
|
...t.currentPath,
|
|
@@ -984,7 +984,7 @@ function Pn(e, t) {
|
|
|
984
984
|
for (let e in i) {
|
|
985
985
|
let a = i[e];
|
|
986
986
|
if (a === void 0 || a._def === void 0) continue;
|
|
987
|
-
let o = In(a), s =
|
|
987
|
+
let o = In(a), s = J(a._def, {
|
|
988
988
|
...t,
|
|
989
989
|
currentPath: [
|
|
990
990
|
...t.currentPath,
|
|
@@ -1004,7 +1004,7 @@ function Pn(e, t) {
|
|
|
1004
1004
|
return a !== void 0 && (n.additionalProperties = a), n;
|
|
1005
1005
|
}
|
|
1006
1006
|
function Fn(e, t) {
|
|
1007
|
-
if (e.catchall._def.typeName !== "ZodNever") return
|
|
1007
|
+
if (e.catchall._def.typeName !== "ZodNever") return J(e.catchall._def, {
|
|
1008
1008
|
...t,
|
|
1009
1009
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
1010
1010
|
});
|
|
@@ -1022,8 +1022,8 @@ function In(e) {
|
|
|
1022
1022
|
}
|
|
1023
1023
|
}
|
|
1024
1024
|
var Ln = (e, t) => {
|
|
1025
|
-
if (t.currentPath.toString() === t.propertyPath?.toString()) return
|
|
1026
|
-
let n =
|
|
1025
|
+
if (t.currentPath.toString() === t.propertyPath?.toString()) return J(e.innerType._def, t);
|
|
1026
|
+
let n = J(e.innerType._def, {
|
|
1027
1027
|
...t,
|
|
1028
1028
|
currentPath: [
|
|
1029
1029
|
...t.currentPath,
|
|
@@ -1031,11 +1031,11 @@ var Ln = (e, t) => {
|
|
|
1031
1031
|
"1"
|
|
1032
1032
|
]
|
|
1033
1033
|
});
|
|
1034
|
-
return n ? { anyOf: [{ not:
|
|
1034
|
+
return n ? { anyOf: [{ not: V() }, n] } : V();
|
|
1035
1035
|
}, Rn = (e, t) => {
|
|
1036
|
-
if (t.pipeStrategy === "input") return
|
|
1037
|
-
if (t.pipeStrategy === "output") return
|
|
1038
|
-
let n =
|
|
1036
|
+
if (t.pipeStrategy === "input") return J(e.in._def, t);
|
|
1037
|
+
if (t.pipeStrategy === "output") return J(e.out._def, t);
|
|
1038
|
+
let n = J(e.in._def, {
|
|
1039
1039
|
...t,
|
|
1040
1040
|
currentPath: [
|
|
1041
1041
|
...t.currentPath,
|
|
@@ -1043,7 +1043,7 @@ var Ln = (e, t) => {
|
|
|
1043
1043
|
"0"
|
|
1044
1044
|
]
|
|
1045
1045
|
});
|
|
1046
|
-
return { allOf: [n,
|
|
1046
|
+
return { allOf: [n, J(e.out._def, {
|
|
1047
1047
|
...t,
|
|
1048
1048
|
currentPath: [
|
|
1049
1049
|
...t.currentPath,
|
|
@@ -1053,13 +1053,13 @@ var Ln = (e, t) => {
|
|
|
1053
1053
|
})].filter((e) => e !== void 0) };
|
|
1054
1054
|
};
|
|
1055
1055
|
function zn(e, t) {
|
|
1056
|
-
return
|
|
1056
|
+
return J(e.type._def, t);
|
|
1057
1057
|
}
|
|
1058
1058
|
function Bn(e, t) {
|
|
1059
1059
|
let n = {
|
|
1060
1060
|
type: "array",
|
|
1061
1061
|
uniqueItems: !0,
|
|
1062
|
-
items:
|
|
1062
|
+
items: J(e.valueType._def, {
|
|
1063
1063
|
...t,
|
|
1064
1064
|
currentPath: [...t.currentPath, "items"]
|
|
1065
1065
|
})
|
|
@@ -1070,7 +1070,7 @@ function Vn(e, t) {
|
|
|
1070
1070
|
return e.rest ? {
|
|
1071
1071
|
type: "array",
|
|
1072
1072
|
minItems: e.items.length,
|
|
1073
|
-
items: e.items.map((e, n) =>
|
|
1073
|
+
items: e.items.map((e, n) => J(e._def, {
|
|
1074
1074
|
...t,
|
|
1075
1075
|
currentPath: [
|
|
1076
1076
|
...t.currentPath,
|
|
@@ -1078,7 +1078,7 @@ function Vn(e, t) {
|
|
|
1078
1078
|
`${n}`
|
|
1079
1079
|
]
|
|
1080
1080
|
})).reduce((e, t) => t === void 0 ? e : [...e, t], []),
|
|
1081
|
-
additionalItems:
|
|
1081
|
+
additionalItems: J(e.rest._def, {
|
|
1082
1082
|
...t,
|
|
1083
1083
|
currentPath: [...t.currentPath, "additionalItems"]
|
|
1084
1084
|
})
|
|
@@ -1086,7 +1086,7 @@ function Vn(e, t) {
|
|
|
1086
1086
|
type: "array",
|
|
1087
1087
|
minItems: e.items.length,
|
|
1088
1088
|
maxItems: e.items.length,
|
|
1089
|
-
items: e.items.map((e, n) =>
|
|
1089
|
+
items: e.items.map((e, n) => J(e._def, {
|
|
1090
1090
|
...t,
|
|
1091
1091
|
currentPath: [
|
|
1092
1092
|
...t.currentPath,
|
|
@@ -1097,29 +1097,29 @@ function Vn(e, t) {
|
|
|
1097
1097
|
};
|
|
1098
1098
|
}
|
|
1099
1099
|
function Hn() {
|
|
1100
|
-
return { not:
|
|
1100
|
+
return { not: V() };
|
|
1101
1101
|
}
|
|
1102
1102
|
function Un() {
|
|
1103
|
-
return
|
|
1103
|
+
return V();
|
|
1104
1104
|
}
|
|
1105
|
-
var Wn = (e, t) =>
|
|
1105
|
+
var Wn = (e, t) => J(e.innerType._def, t), Gn = (e, t, n) => {
|
|
1106
1106
|
switch (t) {
|
|
1107
|
-
case "ZodString": return
|
|
1107
|
+
case "ZodString": return yn(e, n);
|
|
1108
1108
|
case "ZodNumber": return Nn(e);
|
|
1109
1109
|
case "ZodObject": return Pn(e, n);
|
|
1110
|
-
case "ZodBigInt": return
|
|
1111
|
-
case "ZodBoolean": return
|
|
1112
|
-
case "ZodDate": return
|
|
1110
|
+
case "ZodBigInt": return ln(e);
|
|
1111
|
+
case "ZodBoolean": return un();
|
|
1112
|
+
case "ZodDate": return pn(e, n);
|
|
1113
1113
|
case "ZodUndefined": return Hn();
|
|
1114
1114
|
case "ZodNull": return On();
|
|
1115
|
-
case "ZodArray": return
|
|
1115
|
+
case "ZodArray": return cn(e, n);
|
|
1116
1116
|
case "ZodUnion":
|
|
1117
1117
|
case "ZodDiscriminatedUnion": return An(e, n);
|
|
1118
|
-
case "ZodIntersection": return
|
|
1118
|
+
case "ZodIntersection": return gn(e, n);
|
|
1119
1119
|
case "ZodTuple": return Vn(e, n);
|
|
1120
|
-
case "ZodRecord": return
|
|
1121
|
-
case "ZodLiteral": return
|
|
1122
|
-
case "ZodEnum": return
|
|
1120
|
+
case "ZodRecord": return wn(e, n);
|
|
1121
|
+
case "ZodLiteral": return _n(e);
|
|
1122
|
+
case "ZodEnum": return mn(e);
|
|
1123
1123
|
case "ZodNativeEnum": return En(e);
|
|
1124
1124
|
case "ZodNullable": return Mn(e, n);
|
|
1125
1125
|
case "ZodOptional": return Ln(e, n);
|
|
@@ -1129,13 +1129,13 @@ var Wn = (e, t) => q(e.innerType._def, t), Gn = (e, t, n) => {
|
|
|
1129
1129
|
case "ZodPromise": return zn(e, n);
|
|
1130
1130
|
case "ZodNaN":
|
|
1131
1131
|
case "ZodNever": return Dn();
|
|
1132
|
-
case "ZodEffects": return
|
|
1133
|
-
case "ZodAny": return
|
|
1132
|
+
case "ZodEffects": return W(e, n);
|
|
1133
|
+
case "ZodAny": return V();
|
|
1134
1134
|
case "ZodUnknown": return Un();
|
|
1135
|
-
case "ZodDefault": return
|
|
1136
|
-
case "ZodBranded": return
|
|
1135
|
+
case "ZodDefault": return U(e, n);
|
|
1136
|
+
case "ZodBranded": return dn(e, n);
|
|
1137
1137
|
case "ZodReadonly": return Wn(e, n);
|
|
1138
|
-
case "ZodCatch": return
|
|
1138
|
+
case "ZodCatch": return fn(e, n);
|
|
1139
1139
|
case "ZodPipeline": return Rn(e, n);
|
|
1140
1140
|
case "ZodFunction":
|
|
1141
1141
|
case "ZodVoid":
|
|
@@ -1149,7 +1149,7 @@ var Wn = (e, t) => q(e.innerType._def, t), Gn = (e, t, n) => {
|
|
|
1149
1149
|
for (; n < e.length && n < t.length && e[n] === t[n]; n++);
|
|
1150
1150
|
return [(e.length - n).toString(), ...t.slice(n)].join("/");
|
|
1151
1151
|
};
|
|
1152
|
-
function
|
|
1152
|
+
function J(e, t, n = !1) {
|
|
1153
1153
|
let r = t.seen.get(e);
|
|
1154
1154
|
if (t.override) {
|
|
1155
1155
|
let i = t.override?.(e, t, r, n);
|
|
@@ -1165,7 +1165,7 @@ function q(e, t, n = !1) {
|
|
|
1165
1165
|
jsonSchema: void 0
|
|
1166
1166
|
};
|
|
1167
1167
|
t.seen.set(e, i);
|
|
1168
|
-
let a = Gn(e, e.typeName, t), o = typeof a == "function" ?
|
|
1168
|
+
let a = Gn(e, e.typeName, t), o = typeof a == "function" ? J(a(), t) : a;
|
|
1169
1169
|
if (o && Jn(e, t, o), t.postProcess) {
|
|
1170
1170
|
let n = t.postProcess(o, e, t);
|
|
1171
1171
|
return i.jsonSchema = o, n;
|
|
@@ -1177,10 +1177,10 @@ var qn = (e, t) => {
|
|
|
1177
1177
|
case "root": return { $ref: e.path.join("/") };
|
|
1178
1178
|
case "relative": return { $ref: Kn(t.currentPath, e.path) };
|
|
1179
1179
|
case "none":
|
|
1180
|
-
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`),
|
|
1180
|
+
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;
|
|
1181
1181
|
}
|
|
1182
1182
|
}, Jn = (e, t, n) => (e.description && (n.description = e.description), n), Yn = (e) => {
|
|
1183
|
-
let t =
|
|
1183
|
+
let t = sn(e), n = t.name === void 0 ? t.basePath : [
|
|
1184
1184
|
...t.basePath,
|
|
1185
1185
|
t.definitionPath,
|
|
1186
1186
|
t.name
|
|
@@ -1202,22 +1202,22 @@ var qn = (e, t) => {
|
|
|
1202
1202
|
}, Xn = (e, t) => {
|
|
1203
1203
|
let n = Yn(t), r = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((e, [t, r]) => ({
|
|
1204
1204
|
...e,
|
|
1205
|
-
[t]:
|
|
1205
|
+
[t]: J(r._def, {
|
|
1206
1206
|
...n,
|
|
1207
1207
|
currentPath: [
|
|
1208
1208
|
...n.basePath,
|
|
1209
1209
|
n.definitionPath,
|
|
1210
1210
|
t
|
|
1211
1211
|
]
|
|
1212
|
-
}, !0) ??
|
|
1213
|
-
}), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a =
|
|
1212
|
+
}, !0) ?? V()
|
|
1213
|
+
}), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = J(e._def, i === void 0 ? n : {
|
|
1214
1214
|
...n,
|
|
1215
1215
|
currentPath: [
|
|
1216
1216
|
...n.basePath,
|
|
1217
1217
|
n.definitionPath,
|
|
1218
1218
|
i
|
|
1219
1219
|
]
|
|
1220
|
-
}, !1) ??
|
|
1220
|
+
}, !1) ?? V(), o = typeof t == "object" && t.name !== void 0 && t.nameStrategy === "title" ? t.name : void 0;
|
|
1221
1221
|
o !== void 0 && (a.title = o);
|
|
1222
1222
|
let s = i === void 0 ? r ? {
|
|
1223
1223
|
...a,
|
|
@@ -1262,7 +1262,7 @@ function tr(e) {
|
|
|
1262
1262
|
function nr(e) {
|
|
1263
1263
|
return $n(() => {
|
|
1264
1264
|
if (!rr(e)) throw Error(`Standard schema vendor '${e["~standard"].vendor}' does not support JSON Schema conversion.`);
|
|
1265
|
-
return
|
|
1265
|
+
return z(e["~standard"].jsonSchema.input({ target: "draft-07" }));
|
|
1266
1266
|
}, { validate: async (t) => {
|
|
1267
1267
|
let n = await e["~standard"].validate(t);
|
|
1268
1268
|
return "value" in n ? {
|
|
@@ -1270,7 +1270,7 @@ function nr(e) {
|
|
|
1270
1270
|
value: n.value
|
|
1271
1271
|
} : {
|
|
1272
1272
|
success: !1,
|
|
1273
|
-
error: new
|
|
1273
|
+
error: new Nt({
|
|
1274
1274
|
value: t,
|
|
1275
1275
|
cause: n.issues
|
|
1276
1276
|
})
|
|
@@ -1296,7 +1296,7 @@ function ir(e, t) {
|
|
|
1296
1296
|
function ar(e, t) {
|
|
1297
1297
|
de().localeError || de(y());
|
|
1298
1298
|
let n = t?.useReferences ?? !1;
|
|
1299
|
-
return $n(() =>
|
|
1299
|
+
return $n(() => z(i(e, {
|
|
1300
1300
|
target: "draft-7",
|
|
1301
1301
|
io: "input",
|
|
1302
1302
|
reused: n ? "ref" : "inline"
|
|
@@ -1323,7 +1323,7 @@ async function cr({ value: e, schema: t, context: n }) {
|
|
|
1323
1323
|
schema: t,
|
|
1324
1324
|
context: n
|
|
1325
1325
|
});
|
|
1326
|
-
if (!r.success) throw
|
|
1326
|
+
if (!r.success) throw Nt.wrap({
|
|
1327
1327
|
value: e,
|
|
1328
1328
|
cause: r.error,
|
|
1329
1329
|
context: n
|
|
@@ -1345,7 +1345,7 @@ async function lr({ value: e, schema: t, context: n }) {
|
|
|
1345
1345
|
rawValue: e
|
|
1346
1346
|
} : {
|
|
1347
1347
|
success: !1,
|
|
1348
|
-
error:
|
|
1348
|
+
error: Nt.wrap({
|
|
1349
1349
|
value: e,
|
|
1350
1350
|
cause: t.error,
|
|
1351
1351
|
context: n
|
|
@@ -1355,7 +1355,7 @@ async function lr({ value: e, schema: t, context: n }) {
|
|
|
1355
1355
|
} catch (t) {
|
|
1356
1356
|
return {
|
|
1357
1357
|
success: !1,
|
|
1358
|
-
error:
|
|
1358
|
+
error: Nt.wrap({
|
|
1359
1359
|
value: e,
|
|
1360
1360
|
cause: t,
|
|
1361
1361
|
context: n
|
|
@@ -1366,7 +1366,7 @@ async function lr({ value: e, schema: t, context: n }) {
|
|
|
1366
1366
|
}
|
|
1367
1367
|
async function ur({ text: e, schema: t }) {
|
|
1368
1368
|
try {
|
|
1369
|
-
let n =
|
|
1369
|
+
let n = rn(e);
|
|
1370
1370
|
return t == null ? {
|
|
1371
1371
|
success: !0,
|
|
1372
1372
|
value: n,
|
|
@@ -1378,7 +1378,7 @@ async function ur({ text: e, schema: t }) {
|
|
|
1378
1378
|
} catch (t) {
|
|
1379
1379
|
return {
|
|
1380
1380
|
success: !1,
|
|
1381
|
-
error:
|
|
1381
|
+
error: jt.isInstance(t) ? t : new jt({
|
|
1382
1382
|
text: e,
|
|
1383
1383
|
cause: t
|
|
1384
1384
|
}),
|
|
@@ -1387,7 +1387,7 @@ async function ur({ text: e, schema: t }) {
|
|
|
1387
1387
|
}
|
|
1388
1388
|
}
|
|
1389
1389
|
function dr({ stream: e, schema: t }) {
|
|
1390
|
-
return e.pipeThrough(new TextDecoderStream()).pipeThrough(new
|
|
1390
|
+
return e.pipeThrough(new TextDecoderStream()).pipeThrough(new Gt()).pipeThrough(new TransformStream({ async transform({ data: e }, n) {
|
|
1391
1391
|
e !== "[DONE]" && n.enqueue(await ur({
|
|
1392
1392
|
text: e,
|
|
1393
1393
|
schema: t
|
|
@@ -1399,7 +1399,7 @@ async function fr(e) {
|
|
|
1399
1399
|
}
|
|
1400
1400
|
new TextDecoder();
|
|
1401
1401
|
// ../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/mini/schemas.js
|
|
1402
|
-
var
|
|
1402
|
+
var Y = /*@__PURE__*/ S("ZodMiniType", (e, t) => {
|
|
1403
1403
|
if (!e._zod) throw Error("Uninitialized schema in ZodMiniType.");
|
|
1404
1404
|
ae.init(e, t), e.def = t, e.type = t.type;
|
|
1405
1405
|
}, {
|
|
@@ -1445,14 +1445,14 @@ var J = /*@__PURE__*/ S("ZodMiniType", (e, t) => {
|
|
|
1445
1445
|
return t.length === 0 ? e(this) : e(this, ...t);
|
|
1446
1446
|
}
|
|
1447
1447
|
}), pr = /*@__PURE__*/ S("ZodMiniString", (e, t) => {
|
|
1448
|
-
Ce.init(e, t),
|
|
1448
|
+
Ce.init(e, t), Y.init(e, t);
|
|
1449
1449
|
});
|
|
1450
1450
|
// @__NO_SIDE_EFFECTS__
|
|
1451
1451
|
function mr(e) {
|
|
1452
1452
|
return n(pr, e);
|
|
1453
1453
|
}
|
|
1454
1454
|
var hr = /*@__PURE__*/ S("ZodMiniNumber", (e, t) => {
|
|
1455
|
-
ne.init(e, t),
|
|
1455
|
+
ne.init(e, t), Y.init(e, t);
|
|
1456
1456
|
});
|
|
1457
1457
|
// @__NO_SIDE_EFFECTS__
|
|
1458
1458
|
function gr(e) {
|
|
@@ -1465,28 +1465,28 @@ function vr(e) {
|
|
|
1465
1465
|
return t(_r, e);
|
|
1466
1466
|
}
|
|
1467
1467
|
var yr = /*@__PURE__*/ S("ZodMiniBoolean", (e, t) => {
|
|
1468
|
-
o.init(e, t),
|
|
1468
|
+
o.init(e, t), Y.init(e, t);
|
|
1469
1469
|
});
|
|
1470
1470
|
// @__NO_SIDE_EFFECTS__
|
|
1471
1471
|
function br(e) {
|
|
1472
1472
|
return r(yr, e);
|
|
1473
1473
|
}
|
|
1474
1474
|
var xr = /*@__PURE__*/ S("ZodMiniUnknown", (e, t) => {
|
|
1475
|
-
Te.init(e, t),
|
|
1475
|
+
Te.init(e, t), Y.init(e, t);
|
|
1476
1476
|
});
|
|
1477
1477
|
// @__NO_SIDE_EFFECTS__
|
|
1478
1478
|
function Sr() {
|
|
1479
1479
|
return s(xr);
|
|
1480
1480
|
}
|
|
1481
1481
|
var Cr = /*@__PURE__*/ S("ZodMiniNever", (e, t) => {
|
|
1482
|
-
ee.init(e, t),
|
|
1482
|
+
ee.init(e, t), Y.init(e, t);
|
|
1483
1483
|
});
|
|
1484
1484
|
// @__NO_SIDE_EFFECTS__
|
|
1485
1485
|
function wr(e) {
|
|
1486
1486
|
return m(Cr, e);
|
|
1487
1487
|
}
|
|
1488
1488
|
var Tr = /*@__PURE__*/ S("ZodMiniArray", (e, t) => {
|
|
1489
|
-
b.init(e, t),
|
|
1489
|
+
b.init(e, t), Y.init(e, t);
|
|
1490
1490
|
});
|
|
1491
1491
|
// @__NO_SIDE_EFFECTS__
|
|
1492
1492
|
function Er(e, t) {
|
|
@@ -1497,7 +1497,7 @@ function Er(e, t) {
|
|
|
1497
1497
|
});
|
|
1498
1498
|
}
|
|
1499
1499
|
var Dr = /*@__PURE__*/ S("ZodMiniObject", (t, n) => {
|
|
1500
|
-
e.init(t, n),
|
|
1500
|
+
e.init(t, n), Y.init(t, n), Ne(t, "shape", (e) => e._zod.def.shape, !1);
|
|
1501
1501
|
});
|
|
1502
1502
|
// @__NO_SIDE_EFFECTS__
|
|
1503
1503
|
function Or(e, t) {
|
|
@@ -1521,7 +1521,7 @@ function Ar(e, t) {
|
|
|
1521
1521
|
return ke(e, t);
|
|
1522
1522
|
}
|
|
1523
1523
|
var jr = /*@__PURE__*/ S("ZodMiniUnion", (e, t) => {
|
|
1524
|
-
xe.init(e, t),
|
|
1524
|
+
xe.init(e, t), Y.init(e, t);
|
|
1525
1525
|
});
|
|
1526
1526
|
// @__NO_SIDE_EFFECTS__
|
|
1527
1527
|
function Mr(e, t) {
|
|
@@ -1532,7 +1532,7 @@ function Mr(e, t) {
|
|
|
1532
1532
|
});
|
|
1533
1533
|
}
|
|
1534
1534
|
var Nr = /*@__PURE__*/ S("ZodMiniDiscriminatedUnion", (e, t) => {
|
|
1535
|
-
Se.init(e, t),
|
|
1535
|
+
Se.init(e, t), Y.init(e, t);
|
|
1536
1536
|
});
|
|
1537
1537
|
// @__NO_SIDE_EFFECTS__
|
|
1538
1538
|
function Pr(e, t, n) {
|
|
@@ -1544,7 +1544,7 @@ function Pr(e, t, n) {
|
|
|
1544
1544
|
});
|
|
1545
1545
|
}
|
|
1546
1546
|
var Fr = /*@__PURE__*/ S("ZodMiniRecord", (e, t) => {
|
|
1547
|
-
C.init(e, t),
|
|
1547
|
+
C.init(e, t), Y.init(e, t);
|
|
1548
1548
|
});
|
|
1549
1549
|
// @__NO_SIDE_EFFECTS__
|
|
1550
1550
|
function Ir(e, t, n) {
|
|
@@ -1561,7 +1561,7 @@ function Ir(e, t, n) {
|
|
|
1561
1561
|
});
|
|
1562
1562
|
}
|
|
1563
1563
|
var Lr = /*@__PURE__*/ S("ZodMiniEnum", (e, t) => {
|
|
1564
|
-
l.init(e, t),
|
|
1564
|
+
l.init(e, t), Y.init(e, t), e.options = [...e._zod.values];
|
|
1565
1565
|
});
|
|
1566
1566
|
// @__NO_SIDE_EFFECTS__
|
|
1567
1567
|
function Rr(e, t) {
|
|
@@ -1572,7 +1572,7 @@ function Rr(e, t) {
|
|
|
1572
1572
|
});
|
|
1573
1573
|
}
|
|
1574
1574
|
var zr = /*@__PURE__*/ S("ZodMiniLiteral", (e, t) => {
|
|
1575
|
-
te.init(e, t),
|
|
1575
|
+
te.init(e, t), Y.init(e, t);
|
|
1576
1576
|
});
|
|
1577
1577
|
// @__NO_SIDE_EFFECTS__
|
|
1578
1578
|
function Br(e, t) {
|
|
@@ -1583,7 +1583,7 @@ function Br(e, t) {
|
|
|
1583
1583
|
});
|
|
1584
1584
|
}
|
|
1585
1585
|
var Vr = /*@__PURE__*/ S("ZodMiniTransform", (e, t) => {
|
|
1586
|
-
he.init(e, t),
|
|
1586
|
+
he.init(e, t), Y.init(e, t);
|
|
1587
1587
|
});
|
|
1588
1588
|
// @__NO_SIDE_EFFECTS__
|
|
1589
1589
|
function Hr(e) {
|
|
@@ -1593,7 +1593,7 @@ function Hr(e) {
|
|
|
1593
1593
|
});
|
|
1594
1594
|
}
|
|
1595
1595
|
var Ur = /*@__PURE__*/ S("ZodMiniOptional", (e, t) => {
|
|
1596
|
-
le.init(e, t),
|
|
1596
|
+
le.init(e, t), Y.init(e, t);
|
|
1597
1597
|
});
|
|
1598
1598
|
// @__NO_SIDE_EFFECTS__
|
|
1599
1599
|
function Wr(e) {
|
|
@@ -1603,7 +1603,7 @@ function Wr(e) {
|
|
|
1603
1603
|
});
|
|
1604
1604
|
}
|
|
1605
1605
|
var Gr = /*@__PURE__*/ S("ZodMiniPipe", (e, t) => {
|
|
1606
|
-
Ee.init(e, t),
|
|
1606
|
+
Ee.init(e, t), Y.init(e, t);
|
|
1607
1607
|
});
|
|
1608
1608
|
// @__NO_SIDE_EFFECTS__
|
|
1609
1609
|
function Kr(e, t) {
|
|
@@ -1614,7 +1614,7 @@ function Kr(e, t) {
|
|
|
1614
1614
|
});
|
|
1615
1615
|
}
|
|
1616
1616
|
var qr = /*@__PURE__*/ S("ZodMiniCustom", (e, t) => {
|
|
1617
|
-
u.init(e, t),
|
|
1617
|
+
u.init(e, t), Y.init(e, t);
|
|
1618
1618
|
});
|
|
1619
1619
|
// @__NO_SIDE_EFFECTS__
|
|
1620
1620
|
function Jr(e, t) {
|
|
@@ -1858,17 +1858,17 @@ async function oi(e) {
|
|
|
1858
1858
|
state: "failed-parse"
|
|
1859
1859
|
});
|
|
1860
1860
|
}
|
|
1861
|
-
|
|
1861
|
+
L({
|
|
1862
1862
|
prefix: "steer",
|
|
1863
1863
|
size: 24
|
|
1864
|
-
}), new TextEncoder(), new TextEncoder(),
|
|
1864
|
+
}), new TextEncoder(), new TextEncoder(), L({
|
|
1865
1865
|
prefix: "aitxt",
|
|
1866
1866
|
size: 24
|
|
1867
|
-
}),
|
|
1867
|
+
}), L({
|
|
1868
1868
|
prefix: "call",
|
|
1869
1869
|
size: 24
|
|
1870
1870
|
}), TransformStream;
|
|
1871
|
-
var
|
|
1871
|
+
var X = {
|
|
1872
1872
|
NEVER: pe,
|
|
1873
1873
|
array: Er,
|
|
1874
1874
|
boolean: br,
|
|
@@ -1896,7 +1896,7 @@ var Y = {
|
|
|
1896
1896
|
transform: Hr,
|
|
1897
1897
|
union: Mr,
|
|
1898
1898
|
unknown: Sr
|
|
1899
|
-
},
|
|
1899
|
+
}, Z = {
|
|
1900
1900
|
array: be,
|
|
1901
1901
|
boolean: we,
|
|
1902
1902
|
custom: _e,
|
|
@@ -1911,216 +1911,216 @@ var Y = {
|
|
|
1911
1911
|
string: oe,
|
|
1912
1912
|
union: Ae,
|
|
1913
1913
|
unknown: _
|
|
1914
|
-
}, si =
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
])),
|
|
1922
|
-
source:
|
|
1923
|
-
type:
|
|
1924
|
-
sourceType:
|
|
1925
|
-
id:
|
|
1926
|
-
url:
|
|
1927
|
-
title:
|
|
1928
|
-
providerMetadata:
|
|
1929
|
-
}),
|
|
1930
|
-
type:
|
|
1931
|
-
sourceType:
|
|
1932
|
-
id:
|
|
1933
|
-
mediaType:
|
|
1934
|
-
title:
|
|
1935
|
-
filename:
|
|
1936
|
-
providerMetadata:
|
|
1914
|
+
}, si = Z.lazy(() => Z.union([
|
|
1915
|
+
Z.null(),
|
|
1916
|
+
Z.string(),
|
|
1917
|
+
Z.number(),
|
|
1918
|
+
Z.boolean(),
|
|
1919
|
+
Z.record(Z.string(), si.optional()),
|
|
1920
|
+
Z.array(si)
|
|
1921
|
+
])), Q = Z.record(Z.string(), Z.record(Z.string(), si.optional())), ci = X.object({
|
|
1922
|
+
source: X.discriminatedUnion("sourceType", [X.object({
|
|
1923
|
+
type: X.literal("source"),
|
|
1924
|
+
sourceType: X.literal("url"),
|
|
1925
|
+
id: X.string(),
|
|
1926
|
+
url: X.string(),
|
|
1927
|
+
title: X.optional(X.string()),
|
|
1928
|
+
providerMetadata: X.optional(Q)
|
|
1929
|
+
}), X.object({
|
|
1930
|
+
type: X.literal("source"),
|
|
1931
|
+
sourceType: X.literal("document"),
|
|
1932
|
+
id: X.string(),
|
|
1933
|
+
mediaType: X.string(),
|
|
1934
|
+
title: X.string(),
|
|
1935
|
+
filename: X.optional(X.string()),
|
|
1936
|
+
providerMetadata: X.optional(Q)
|
|
1937
1937
|
})]),
|
|
1938
|
-
startIndex:
|
|
1939
|
-
endIndex:
|
|
1940
|
-
citedText:
|
|
1941
|
-
}), li =
|
|
1942
|
-
|
|
1943
|
-
type:
|
|
1944
|
-
id:
|
|
1945
|
-
providerMetadata:
|
|
1938
|
+
startIndex: X.optional(X.number().check(X.int()).check(X.nonnegative())),
|
|
1939
|
+
endIndex: X.optional(X.number().check(X.int()).check(X.nonnegative())),
|
|
1940
|
+
citedText: X.optional(X.string())
|
|
1941
|
+
}), li = X.record(X.string(), X.optional(si)), ui = Qn(() => sr(X.union([
|
|
1942
|
+
X.looseObject({
|
|
1943
|
+
type: X.literal("text-start"),
|
|
1944
|
+
id: X.string(),
|
|
1945
|
+
providerMetadata: X.optional(Q)
|
|
1946
1946
|
}),
|
|
1947
|
-
|
|
1948
|
-
type:
|
|
1949
|
-
id:
|
|
1950
|
-
delta:
|
|
1951
|
-
providerMetadata:
|
|
1947
|
+
X.looseObject({
|
|
1948
|
+
type: X.literal("text-delta"),
|
|
1949
|
+
id: X.string(),
|
|
1950
|
+
delta: X.string(),
|
|
1951
|
+
providerMetadata: X.optional(Q)
|
|
1952
1952
|
}),
|
|
1953
|
-
|
|
1954
|
-
type:
|
|
1955
|
-
id:
|
|
1956
|
-
citations:
|
|
1957
|
-
providerMetadata:
|
|
1953
|
+
X.looseObject({
|
|
1954
|
+
type: X.literal("text-end"),
|
|
1955
|
+
id: X.string(),
|
|
1956
|
+
citations: X.optional(X.array(ci)),
|
|
1957
|
+
providerMetadata: X.optional(Q)
|
|
1958
1958
|
}),
|
|
1959
|
-
|
|
1960
|
-
type:
|
|
1961
|
-
errorText:
|
|
1959
|
+
X.looseObject({
|
|
1960
|
+
type: X.literal("error"),
|
|
1961
|
+
errorText: X.string()
|
|
1962
1962
|
}),
|
|
1963
|
-
|
|
1964
|
-
type:
|
|
1965
|
-
toolCallId:
|
|
1966
|
-
toolName:
|
|
1967
|
-
inputEncoding:
|
|
1968
|
-
providerExecuted:
|
|
1969
|
-
providerMetadata:
|
|
1970
|
-
toolMetadata:
|
|
1971
|
-
dynamic:
|
|
1972
|
-
title:
|
|
1963
|
+
X.looseObject({
|
|
1964
|
+
type: X.literal("tool-input-start"),
|
|
1965
|
+
toolCallId: X.string(),
|
|
1966
|
+
toolName: X.string(),
|
|
1967
|
+
inputEncoding: X.optional(X.enum(["json", "text"])),
|
|
1968
|
+
providerExecuted: X.optional(X.boolean()),
|
|
1969
|
+
providerMetadata: X.optional(Q),
|
|
1970
|
+
toolMetadata: X.optional(li),
|
|
1971
|
+
dynamic: X.optional(X.boolean()),
|
|
1972
|
+
title: X.optional(X.string())
|
|
1973
1973
|
}),
|
|
1974
|
-
|
|
1975
|
-
type:
|
|
1976
|
-
toolCallId:
|
|
1977
|
-
inputTextDelta:
|
|
1974
|
+
X.looseObject({
|
|
1975
|
+
type: X.literal("tool-input-delta"),
|
|
1976
|
+
toolCallId: X.string(),
|
|
1977
|
+
inputTextDelta: X.string()
|
|
1978
1978
|
}),
|
|
1979
|
-
|
|
1980
|
-
type:
|
|
1981
|
-
toolCallId:
|
|
1982
|
-
toolName:
|
|
1983
|
-
input:
|
|
1984
|
-
providerExecuted:
|
|
1985
|
-
providerMetadata:
|
|
1986
|
-
toolMetadata:
|
|
1987
|
-
dynamic:
|
|
1988
|
-
title:
|
|
1979
|
+
X.looseObject({
|
|
1980
|
+
type: X.literal("tool-input-available"),
|
|
1981
|
+
toolCallId: X.string(),
|
|
1982
|
+
toolName: X.string(),
|
|
1983
|
+
input: X.unknown(),
|
|
1984
|
+
providerExecuted: X.optional(X.boolean()),
|
|
1985
|
+
providerMetadata: X.optional(Q),
|
|
1986
|
+
toolMetadata: X.optional(li),
|
|
1987
|
+
dynamic: X.optional(X.boolean()),
|
|
1988
|
+
title: X.optional(X.string())
|
|
1989
1989
|
}),
|
|
1990
|
-
|
|
1991
|
-
type:
|
|
1992
|
-
toolCallId:
|
|
1993
|
-
toolName:
|
|
1994
|
-
input:
|
|
1995
|
-
providerExecuted:
|
|
1996
|
-
providerMetadata:
|
|
1997
|
-
toolMetadata:
|
|
1998
|
-
dynamic:
|
|
1999
|
-
errorText:
|
|
2000
|
-
title:
|
|
1990
|
+
X.looseObject({
|
|
1991
|
+
type: X.literal("tool-input-error"),
|
|
1992
|
+
toolCallId: X.string(),
|
|
1993
|
+
toolName: X.string(),
|
|
1994
|
+
input: X.unknown(),
|
|
1995
|
+
providerExecuted: X.optional(X.boolean()),
|
|
1996
|
+
providerMetadata: X.optional(Q),
|
|
1997
|
+
toolMetadata: X.optional(li),
|
|
1998
|
+
dynamic: X.optional(X.boolean()),
|
|
1999
|
+
errorText: X.string(),
|
|
2000
|
+
title: X.optional(X.string())
|
|
2001
2001
|
}),
|
|
2002
|
-
|
|
2003
|
-
type:
|
|
2004
|
-
approvalId:
|
|
2005
|
-
toolCallId:
|
|
2006
|
-
approvalDescriptor:
|
|
2007
|
-
inputSchemaInput:
|
|
2008
|
-
reason:
|
|
2009
|
-
isAutomatic:
|
|
2010
|
-
signature:
|
|
2002
|
+
X.looseObject({
|
|
2003
|
+
type: X.literal("tool-approval-request"),
|
|
2004
|
+
approvalId: X.string(),
|
|
2005
|
+
toolCallId: X.string(),
|
|
2006
|
+
approvalDescriptor: X.optional(X.unknown()),
|
|
2007
|
+
inputSchemaInput: X.optional(X.unknown()),
|
|
2008
|
+
reason: X.optional(X.string()),
|
|
2009
|
+
isAutomatic: X.optional(X.boolean()),
|
|
2010
|
+
signature: X.optional(X.string())
|
|
2011
2011
|
}),
|
|
2012
|
-
|
|
2013
|
-
type:
|
|
2014
|
-
approvalId:
|
|
2015
|
-
approved:
|
|
2016
|
-
reason:
|
|
2017
|
-
providerExecuted:
|
|
2018
|
-
providerMetadata:
|
|
2012
|
+
X.looseObject({
|
|
2013
|
+
type: X.literal("tool-approval-response"),
|
|
2014
|
+
approvalId: X.string(),
|
|
2015
|
+
approved: X.boolean(),
|
|
2016
|
+
reason: X.optional(X.string()),
|
|
2017
|
+
providerExecuted: X.optional(X.boolean()),
|
|
2018
|
+
providerMetadata: X.optional(Q)
|
|
2019
2019
|
}),
|
|
2020
|
-
|
|
2021
|
-
type:
|
|
2022
|
-
toolCallId:
|
|
2023
|
-
output:
|
|
2024
|
-
providerExecuted:
|
|
2025
|
-
providerMetadata:
|
|
2026
|
-
toolMetadata:
|
|
2027
|
-
dynamic:
|
|
2028
|
-
preliminary:
|
|
2020
|
+
X.looseObject({
|
|
2021
|
+
type: X.literal("tool-output-available"),
|
|
2022
|
+
toolCallId: X.string(),
|
|
2023
|
+
output: X.unknown(),
|
|
2024
|
+
providerExecuted: X.optional(X.boolean()),
|
|
2025
|
+
providerMetadata: X.optional(Q),
|
|
2026
|
+
toolMetadata: X.optional(li),
|
|
2027
|
+
dynamic: X.optional(X.boolean()),
|
|
2028
|
+
preliminary: X.optional(X.boolean())
|
|
2029
2029
|
}),
|
|
2030
|
-
|
|
2031
|
-
type:
|
|
2032
|
-
toolCallId:
|
|
2033
|
-
errorText:
|
|
2034
|
-
providerExecuted:
|
|
2035
|
-
providerMetadata:
|
|
2036
|
-
toolMetadata:
|
|
2037
|
-
dynamic:
|
|
2030
|
+
X.looseObject({
|
|
2031
|
+
type: X.literal("tool-output-error"),
|
|
2032
|
+
toolCallId: X.string(),
|
|
2033
|
+
errorText: X.string(),
|
|
2034
|
+
providerExecuted: X.optional(X.boolean()),
|
|
2035
|
+
providerMetadata: X.optional(Q),
|
|
2036
|
+
toolMetadata: X.optional(li),
|
|
2037
|
+
dynamic: X.optional(X.boolean())
|
|
2038
2038
|
}),
|
|
2039
|
-
|
|
2040
|
-
type:
|
|
2041
|
-
toolCallId:
|
|
2039
|
+
X.looseObject({
|
|
2040
|
+
type: X.literal("tool-output-denied"),
|
|
2041
|
+
toolCallId: X.string()
|
|
2042
2042
|
}),
|
|
2043
|
-
|
|
2044
|
-
type:
|
|
2045
|
-
id:
|
|
2046
|
-
providerMetadata:
|
|
2043
|
+
X.looseObject({
|
|
2044
|
+
type: X.literal("reasoning-start"),
|
|
2045
|
+
id: X.string(),
|
|
2046
|
+
providerMetadata: X.optional(Q)
|
|
2047
2047
|
}),
|
|
2048
|
-
|
|
2049
|
-
type:
|
|
2050
|
-
id:
|
|
2051
|
-
delta:
|
|
2052
|
-
providerMetadata:
|
|
2048
|
+
X.looseObject({
|
|
2049
|
+
type: X.literal("reasoning-delta"),
|
|
2050
|
+
id: X.string(),
|
|
2051
|
+
delta: X.string(),
|
|
2052
|
+
providerMetadata: X.optional(Q)
|
|
2053
2053
|
}),
|
|
2054
|
-
|
|
2055
|
-
type:
|
|
2056
|
-
id:
|
|
2057
|
-
providerMetadata:
|
|
2054
|
+
X.looseObject({
|
|
2055
|
+
type: X.literal("reasoning-end"),
|
|
2056
|
+
id: X.string(),
|
|
2057
|
+
providerMetadata: X.optional(Q)
|
|
2058
2058
|
}),
|
|
2059
|
-
|
|
2060
|
-
type:
|
|
2061
|
-
kind:
|
|
2062
|
-
providerMetadata:
|
|
2059
|
+
X.looseObject({
|
|
2060
|
+
type: X.literal("custom"),
|
|
2061
|
+
kind: X.pipe(X.string(), X.transform((e) => e)),
|
|
2062
|
+
providerMetadata: X.optional(Q)
|
|
2063
2063
|
}),
|
|
2064
|
-
|
|
2065
|
-
type:
|
|
2066
|
-
sourceId:
|
|
2067
|
-
url:
|
|
2068
|
-
title:
|
|
2069
|
-
providerMetadata:
|
|
2064
|
+
X.looseObject({
|
|
2065
|
+
type: X.literal("source-url"),
|
|
2066
|
+
sourceId: X.string(),
|
|
2067
|
+
url: X.string(),
|
|
2068
|
+
title: X.optional(X.string()),
|
|
2069
|
+
providerMetadata: X.optional(Q)
|
|
2070
2070
|
}),
|
|
2071
|
-
|
|
2072
|
-
type:
|
|
2073
|
-
sourceId:
|
|
2074
|
-
mediaType:
|
|
2075
|
-
title:
|
|
2076
|
-
filename:
|
|
2077
|
-
providerMetadata:
|
|
2071
|
+
X.looseObject({
|
|
2072
|
+
type: X.literal("source-document"),
|
|
2073
|
+
sourceId: X.string(),
|
|
2074
|
+
mediaType: X.string(),
|
|
2075
|
+
title: X.string(),
|
|
2076
|
+
filename: X.optional(X.string()),
|
|
2077
|
+
providerMetadata: X.optional(Q)
|
|
2078
2078
|
}),
|
|
2079
|
-
|
|
2080
|
-
type:
|
|
2081
|
-
url:
|
|
2082
|
-
mediaType:
|
|
2083
|
-
providerMetadata:
|
|
2079
|
+
X.looseObject({
|
|
2080
|
+
type: X.literal("file"),
|
|
2081
|
+
url: X.string(),
|
|
2082
|
+
mediaType: X.string(),
|
|
2083
|
+
providerMetadata: X.optional(Q)
|
|
2084
2084
|
}),
|
|
2085
|
-
|
|
2086
|
-
type:
|
|
2087
|
-
url:
|
|
2088
|
-
mediaType:
|
|
2089
|
-
providerMetadata:
|
|
2085
|
+
X.looseObject({
|
|
2086
|
+
type: X.literal("reasoning-file"),
|
|
2087
|
+
url: X.string(),
|
|
2088
|
+
mediaType: X.string(),
|
|
2089
|
+
providerMetadata: X.optional(Q)
|
|
2090
2090
|
}),
|
|
2091
|
-
|
|
2092
|
-
type:
|
|
2093
|
-
id:
|
|
2094
|
-
parts:
|
|
2095
|
-
type:
|
|
2096
|
-
text:
|
|
2097
|
-
providerMetadata:
|
|
2098
|
-
}),
|
|
2099
|
-
type:
|
|
2100
|
-
mediaType:
|
|
2101
|
-
url:
|
|
2102
|
-
filename:
|
|
2103
|
-
providerReference:
|
|
2104
|
-
providerMetadata:
|
|
2091
|
+
X.looseObject({
|
|
2092
|
+
type: X.literal("steering-message"),
|
|
2093
|
+
id: X.string(),
|
|
2094
|
+
parts: X.array(X.union([X.looseObject({
|
|
2095
|
+
type: X.literal("text"),
|
|
2096
|
+
text: X.string(),
|
|
2097
|
+
providerMetadata: X.optional(Q)
|
|
2098
|
+
}), X.looseObject({
|
|
2099
|
+
type: X.literal("file"),
|
|
2100
|
+
mediaType: X.string(),
|
|
2101
|
+
url: X.string(),
|
|
2102
|
+
filename: X.optional(X.string()),
|
|
2103
|
+
providerReference: X.optional(X.record(X.string(), X.string())),
|
|
2104
|
+
providerMetadata: X.optional(Q)
|
|
2105
2105
|
})]))
|
|
2106
2106
|
}),
|
|
2107
|
-
|
|
2108
|
-
type:
|
|
2109
|
-
id:
|
|
2110
|
-
data:
|
|
2111
|
-
transient:
|
|
2107
|
+
X.looseObject({
|
|
2108
|
+
type: X.custom((e) => typeof e == "string" && e.startsWith("data-"), { message: "Type must start with \"data-\"" }),
|
|
2109
|
+
id: X.optional(X.string()),
|
|
2110
|
+
data: X.unknown(),
|
|
2111
|
+
transient: X.optional(X.boolean())
|
|
2112
2112
|
}),
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
type:
|
|
2118
|
-
messageId:
|
|
2119
|
-
messageMetadata:
|
|
2113
|
+
X.looseObject({ type: X.literal("start-step") }),
|
|
2114
|
+
X.looseObject({ type: X.literal("finish-step") }),
|
|
2115
|
+
X.looseObject({ type: X.literal("reset-step") }),
|
|
2116
|
+
X.looseObject({
|
|
2117
|
+
type: X.literal("start"),
|
|
2118
|
+
messageId: X.optional(X.string()),
|
|
2119
|
+
messageMetadata: X.optional(X.unknown())
|
|
2120
2120
|
}),
|
|
2121
|
-
|
|
2122
|
-
type:
|
|
2123
|
-
finishReason:
|
|
2121
|
+
X.looseObject({
|
|
2122
|
+
type: X.literal("finish"),
|
|
2123
|
+
finishReason: X.optional(X.enum([
|
|
2124
2124
|
"stop",
|
|
2125
2125
|
"length",
|
|
2126
2126
|
"content-filter",
|
|
@@ -2129,15 +2129,15 @@ var Y = {
|
|
|
2129
2129
|
"interrupted",
|
|
2130
2130
|
"other"
|
|
2131
2131
|
])),
|
|
2132
|
-
messageMetadata:
|
|
2132
|
+
messageMetadata: X.optional(X.unknown())
|
|
2133
2133
|
}),
|
|
2134
|
-
|
|
2135
|
-
type:
|
|
2136
|
-
reason:
|
|
2134
|
+
X.looseObject({
|
|
2135
|
+
type: X.literal("abort"),
|
|
2136
|
+
reason: X.optional(X.string())
|
|
2137
2137
|
}),
|
|
2138
|
-
|
|
2139
|
-
type:
|
|
2140
|
-
messageMetadata:
|
|
2138
|
+
X.looseObject({
|
|
2139
|
+
type: X.literal("message-metadata"),
|
|
2140
|
+
messageMetadata: X.unknown()
|
|
2141
2141
|
})
|
|
2142
2142
|
])));
|
|
2143
2143
|
function di(e) {
|
|
@@ -2152,7 +2152,7 @@ function pi(e) {
|
|
|
2152
2152
|
function mi(e) {
|
|
2153
2153
|
return e.type === "dynamic-tool";
|
|
2154
2154
|
}
|
|
2155
|
-
function
|
|
2155
|
+
function $(e) {
|
|
2156
2156
|
return pi(e) || mi(e);
|
|
2157
2157
|
}
|
|
2158
2158
|
function hi(e) {
|
|
@@ -2166,7 +2166,7 @@ function gi({ lastMessage: e, messageId: t }) {
|
|
|
2166
2166
|
parts: []
|
|
2167
2167
|
}, r = fi(), i = n.parts.findLastIndex((e) => e.type === "step-start"), a = 0;
|
|
2168
2168
|
for (let e of n.parts.slice(i + 1)) {
|
|
2169
|
-
if (
|
|
2169
|
+
if (!$(e)) continue;
|
|
2170
2170
|
let t = a;
|
|
2171
2171
|
pi(e) && a++, e.state === "input-streaming" && (r[e.toolCallId] = {
|
|
2172
2172
|
text: e.rawInput ?? "",
|
|
@@ -2195,7 +2195,7 @@ function _i({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2195
2195
|
return e.slice(t + 1);
|
|
2196
2196
|
}
|
|
2197
2197
|
function p() {
|
|
2198
|
-
return f().filter(
|
|
2198
|
+
return f().filter($);
|
|
2199
2199
|
}
|
|
2200
2200
|
function m(e) {
|
|
2201
2201
|
let t = p().find((t) => t.toolCallId === e);
|
|
@@ -2203,7 +2203,7 @@ function _i({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2203
2203
|
let n = r.message.parts;
|
|
2204
2204
|
for (let r = n.length - 1; r >= 0; r--) {
|
|
2205
2205
|
let i = n[r];
|
|
2206
|
-
if (
|
|
2206
|
+
if ($(i) && i.toolCallId === e) {
|
|
2207
2207
|
t = i;
|
|
2208
2208
|
break;
|
|
2209
2209
|
}
|
|
@@ -2217,7 +2217,7 @@ function _i({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2217
2217
|
return t;
|
|
2218
2218
|
}
|
|
2219
2219
|
function h(e) {
|
|
2220
|
-
let t = r.message.parts.filter(
|
|
2220
|
+
let t = r.message.parts.filter($).find((t) => t.approval?.id === e);
|
|
2221
2221
|
if (t == null) throw new ri({
|
|
2222
2222
|
chunkType: "tool-approval-response",
|
|
2223
2223
|
chunkId: e,
|
|
@@ -2478,7 +2478,7 @@ function _i({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2478
2478
|
}), d(), a && !e.providerExecuted && await a({ toolCall: e });
|
|
2479
2479
|
break;
|
|
2480
2480
|
case "tool-input-error": {
|
|
2481
|
-
let t = f().filter(
|
|
2481
|
+
let t = f().filter($).find((t) => t.toolCallId === e.toolCallId);
|
|
2482
2482
|
(t == null ? e.dynamic : t.type === "dynamic-tool") ? _({
|
|
2483
2483
|
toolCallId: e.toolCallId,
|
|
2484
2484
|
toolName: e.toolName,
|
|
@@ -2666,16 +2666,16 @@ function yi() {
|
|
|
2666
2666
|
reject: t
|
|
2667
2667
|
};
|
|
2668
2668
|
}
|
|
2669
|
-
|
|
2669
|
+
L({
|
|
2670
2670
|
prefix: "aitxt",
|
|
2671
2671
|
size: 24
|
|
2672
|
-
}),
|
|
2672
|
+
}), L({
|
|
2673
2673
|
prefix: "call",
|
|
2674
2674
|
size: 24
|
|
2675
|
-
}),
|
|
2675
|
+
}), L({
|
|
2676
2676
|
prefix: "aitxt",
|
|
2677
2677
|
size: 24
|
|
2678
|
-
}),
|
|
2678
|
+
}), L({
|
|
2679
2679
|
prefix: "call",
|
|
2680
2680
|
size: 24
|
|
2681
2681
|
});
|
|
@@ -2702,7 +2702,7 @@ function bi(e, t = [], n = /* @__PURE__ */ new WeakSet()) {
|
|
|
2702
2702
|
}
|
|
2703
2703
|
}
|
|
2704
2704
|
function xi(e, t = []) {
|
|
2705
|
-
return
|
|
2705
|
+
return X.pipe(X.unknown().check((e) => {
|
|
2706
2706
|
let n = e.value;
|
|
2707
2707
|
for (let e of t) n = typeof n == "object" && n ? n[e] : void 0;
|
|
2708
2708
|
let r = bi(n);
|
|
@@ -2714,16 +2714,16 @@ function xi(e, t = []) {
|
|
|
2714
2714
|
});
|
|
2715
2715
|
}), e);
|
|
2716
2716
|
}
|
|
2717
|
-
xi(
|
|
2717
|
+
xi(X.record(X.string(), X.optional(si))), xi(Q), X.record(X.string(), X.string()), xi(ci, ["source", "providerMetadata"]), L({
|
|
2718
2718
|
prefix: "call",
|
|
2719
2719
|
size: 24
|
|
2720
|
-
}),
|
|
2720
|
+
}), L({
|
|
2721
2721
|
prefix: "call",
|
|
2722
2722
|
size: 24
|
|
2723
|
-
}), new TextEncoder(),
|
|
2723
|
+
}), new TextEncoder(), L({
|
|
2724
2724
|
prefix: "call",
|
|
2725
2725
|
size: 24
|
|
2726
|
-
}),
|
|
2726
|
+
}), L({
|
|
2727
2727
|
prefix: "aiobj",
|
|
2728
2728
|
size: 24
|
|
2729
2729
|
});
|
|
@@ -2759,214 +2759,214 @@ var { atob: Si } = globalThis, Ci = class {
|
|
|
2759
2759
|
});
|
|
2760
2760
|
}
|
|
2761
2761
|
};
|
|
2762
|
-
|
|
2762
|
+
L({
|
|
2763
2763
|
prefix: "aiobj",
|
|
2764
2764
|
size: 24
|
|
2765
|
-
}),
|
|
2765
|
+
}), L({
|
|
2766
2766
|
prefix: "call",
|
|
2767
2767
|
size: 24
|
|
2768
2768
|
});
|
|
2769
|
-
var wi =
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
]), Ti =
|
|
2775
|
-
type:
|
|
2776
|
-
text:
|
|
2777
|
-
providerOptions:
|
|
2778
|
-
}), Di =
|
|
2779
|
-
type:
|
|
2780
|
-
image:
|
|
2769
|
+
var wi = Z.union([
|
|
2770
|
+
Z.string(),
|
|
2771
|
+
Z.custom(Xt, { message: "Must be a Uint8Array" }),
|
|
2772
|
+
Z.custom(I, { message: "Must be an ArrayBuffer" }),
|
|
2773
|
+
Z.custom(R, { message: "Must be a Buffer" })
|
|
2774
|
+
]), Ti = Z.record(Z.string(), Z.string()), Ei = Z.object({
|
|
2775
|
+
type: Z.literal("text"),
|
|
2776
|
+
text: Z.string(),
|
|
2777
|
+
providerOptions: Q.optional()
|
|
2778
|
+
}), Di = Z.object({
|
|
2779
|
+
type: Z.literal("image"),
|
|
2780
|
+
image: Z.union([
|
|
2781
2781
|
wi,
|
|
2782
|
-
|
|
2782
|
+
Z.instanceof(URL),
|
|
2783
2783
|
Ti
|
|
2784
2784
|
]),
|
|
2785
|
-
mediaType:
|
|
2786
|
-
providerOptions:
|
|
2787
|
-
}), Oi =
|
|
2788
|
-
|
|
2789
|
-
type:
|
|
2785
|
+
mediaType: Z.string().optional(),
|
|
2786
|
+
providerOptions: Q.optional()
|
|
2787
|
+
}), Oi = Z.discriminatedUnion("type", [
|
|
2788
|
+
Z.object({
|
|
2789
|
+
type: Z.literal("data"),
|
|
2790
2790
|
data: wi
|
|
2791
2791
|
}),
|
|
2792
|
-
|
|
2793
|
-
type:
|
|
2794
|
-
url:
|
|
2792
|
+
Z.object({
|
|
2793
|
+
type: Z.literal("url"),
|
|
2794
|
+
url: Z.instanceof(URL)
|
|
2795
2795
|
}),
|
|
2796
|
-
|
|
2797
|
-
type:
|
|
2796
|
+
Z.object({
|
|
2797
|
+
type: Z.literal("reference"),
|
|
2798
2798
|
reference: Ti
|
|
2799
2799
|
}),
|
|
2800
|
-
|
|
2801
|
-
type:
|
|
2802
|
-
text:
|
|
2800
|
+
Z.object({
|
|
2801
|
+
type: Z.literal("text"),
|
|
2802
|
+
text: Z.string()
|
|
2803
2803
|
})
|
|
2804
|
-
]), ki =
|
|
2805
|
-
type:
|
|
2804
|
+
]), ki = Z.discriminatedUnion("type", [Z.object({
|
|
2805
|
+
type: Z.literal("data"),
|
|
2806
2806
|
data: wi
|
|
2807
|
-
}),
|
|
2808
|
-
type:
|
|
2809
|
-
url:
|
|
2810
|
-
})]), Ai =
|
|
2811
|
-
type:
|
|
2812
|
-
data:
|
|
2807
|
+
}), Z.object({
|
|
2808
|
+
type: Z.literal("url"),
|
|
2809
|
+
url: Z.instanceof(URL)
|
|
2810
|
+
})]), Ai = Z.object({
|
|
2811
|
+
type: Z.literal("file"),
|
|
2812
|
+
data: Z.union([
|
|
2813
2813
|
Oi,
|
|
2814
2814
|
wi,
|
|
2815
|
-
|
|
2815
|
+
Z.instanceof(URL),
|
|
2816
2816
|
Ti
|
|
2817
2817
|
]),
|
|
2818
|
-
filename:
|
|
2819
|
-
mediaType:
|
|
2820
|
-
providerOptions:
|
|
2821
|
-
}), ji =
|
|
2822
|
-
type:
|
|
2823
|
-
text:
|
|
2824
|
-
providerOptions:
|
|
2825
|
-
}), Mi =
|
|
2826
|
-
type:
|
|
2827
|
-
kind:
|
|
2828
|
-
providerOptions:
|
|
2829
|
-
}), Ni =
|
|
2830
|
-
type:
|
|
2831
|
-
data:
|
|
2818
|
+
filename: Z.string().optional(),
|
|
2819
|
+
mediaType: Z.string(),
|
|
2820
|
+
providerOptions: Q.optional()
|
|
2821
|
+
}), ji = Z.object({
|
|
2822
|
+
type: Z.literal("reasoning"),
|
|
2823
|
+
text: Z.string(),
|
|
2824
|
+
providerOptions: Q.optional()
|
|
2825
|
+
}), Mi = Z.object({
|
|
2826
|
+
type: Z.literal("custom"),
|
|
2827
|
+
kind: Z.string().transform((e) => e),
|
|
2828
|
+
providerOptions: Q.optional()
|
|
2829
|
+
}), Ni = Z.object({
|
|
2830
|
+
type: Z.literal("reasoning-file"),
|
|
2831
|
+
data: Z.union([
|
|
2832
2832
|
ki,
|
|
2833
2833
|
wi,
|
|
2834
|
-
|
|
2834
|
+
Z.instanceof(URL)
|
|
2835
2835
|
]),
|
|
2836
|
-
mediaType:
|
|
2837
|
-
providerOptions:
|
|
2838
|
-
}), Pi =
|
|
2839
|
-
type:
|
|
2840
|
-
toolCallId:
|
|
2841
|
-
toolName:
|
|
2842
|
-
input:
|
|
2843
|
-
providerOptions:
|
|
2844
|
-
providerExecuted:
|
|
2845
|
-
}), Fi =
|
|
2846
|
-
|
|
2847
|
-
type:
|
|
2848
|
-
value:
|
|
2849
|
-
providerOptions:
|
|
2836
|
+
mediaType: Z.string(),
|
|
2837
|
+
providerOptions: Q.optional()
|
|
2838
|
+
}), Pi = Z.object({
|
|
2839
|
+
type: Z.literal("tool-call"),
|
|
2840
|
+
toolCallId: Z.string(),
|
|
2841
|
+
toolName: Z.string(),
|
|
2842
|
+
input: Z.unknown(),
|
|
2843
|
+
providerOptions: Q.optional(),
|
|
2844
|
+
providerExecuted: Z.boolean().optional()
|
|
2845
|
+
}), Fi = Z.discriminatedUnion("type", [
|
|
2846
|
+
Z.object({
|
|
2847
|
+
type: Z.literal("text"),
|
|
2848
|
+
value: Z.string(),
|
|
2849
|
+
providerOptions: Q.optional()
|
|
2850
2850
|
}),
|
|
2851
|
-
|
|
2852
|
-
type:
|
|
2851
|
+
Z.object({
|
|
2852
|
+
type: Z.literal("json"),
|
|
2853
2853
|
value: si,
|
|
2854
|
-
providerOptions:
|
|
2854
|
+
providerOptions: Q.optional()
|
|
2855
2855
|
}),
|
|
2856
|
-
|
|
2857
|
-
type:
|
|
2858
|
-
reason:
|
|
2859
|
-
providerOptions:
|
|
2856
|
+
Z.object({
|
|
2857
|
+
type: Z.literal("execution-denied"),
|
|
2858
|
+
reason: Z.string().optional(),
|
|
2859
|
+
providerOptions: Q.optional()
|
|
2860
2860
|
}),
|
|
2861
|
-
|
|
2862
|
-
type:
|
|
2863
|
-
value:
|
|
2864
|
-
providerOptions:
|
|
2861
|
+
Z.object({
|
|
2862
|
+
type: Z.literal("error-text"),
|
|
2863
|
+
value: Z.string(),
|
|
2864
|
+
providerOptions: Q.optional()
|
|
2865
2865
|
}),
|
|
2866
|
-
|
|
2867
|
-
type:
|
|
2866
|
+
Z.object({
|
|
2867
|
+
type: Z.literal("error-json"),
|
|
2868
2868
|
value: si,
|
|
2869
|
-
providerOptions:
|
|
2869
|
+
providerOptions: Q.optional()
|
|
2870
2870
|
}),
|
|
2871
|
-
|
|
2872
|
-
type:
|
|
2873
|
-
value:
|
|
2874
|
-
|
|
2875
|
-
type:
|
|
2876
|
-
text:
|
|
2877
|
-
providerOptions:
|
|
2871
|
+
Z.object({
|
|
2872
|
+
type: Z.literal("content"),
|
|
2873
|
+
value: Z.array(Z.union([
|
|
2874
|
+
Z.object({
|
|
2875
|
+
type: Z.literal("text"),
|
|
2876
|
+
text: Z.string(),
|
|
2877
|
+
providerOptions: Q.optional()
|
|
2878
2878
|
}),
|
|
2879
|
-
|
|
2880
|
-
type:
|
|
2879
|
+
Z.object({
|
|
2880
|
+
type: Z.literal("file"),
|
|
2881
2881
|
data: Oi,
|
|
2882
|
-
mediaType:
|
|
2883
|
-
filename:
|
|
2884
|
-
providerOptions:
|
|
2882
|
+
mediaType: Z.string(),
|
|
2883
|
+
filename: Z.string().optional(),
|
|
2884
|
+
providerOptions: Q.optional()
|
|
2885
2885
|
}),
|
|
2886
|
-
|
|
2887
|
-
type:
|
|
2888
|
-
data:
|
|
2889
|
-
mediaType:
|
|
2890
|
-
filename:
|
|
2891
|
-
providerOptions:
|
|
2886
|
+
Z.object({
|
|
2887
|
+
type: Z.literal("file-data"),
|
|
2888
|
+
data: Z.string(),
|
|
2889
|
+
mediaType: Z.string(),
|
|
2890
|
+
filename: Z.string().optional(),
|
|
2891
|
+
providerOptions: Q.optional()
|
|
2892
2892
|
}),
|
|
2893
|
-
|
|
2894
|
-
type:
|
|
2895
|
-
url:
|
|
2896
|
-
mediaType:
|
|
2897
|
-
providerOptions:
|
|
2893
|
+
Z.object({
|
|
2894
|
+
type: Z.literal("file-url"),
|
|
2895
|
+
url: Z.string(),
|
|
2896
|
+
mediaType: Z.string().optional(),
|
|
2897
|
+
providerOptions: Q.optional()
|
|
2898
2898
|
}),
|
|
2899
|
-
|
|
2900
|
-
type:
|
|
2901
|
-
fileId:
|
|
2902
|
-
providerOptions:
|
|
2899
|
+
Z.object({
|
|
2900
|
+
type: Z.literal("file-id"),
|
|
2901
|
+
fileId: Z.union([Z.string(), Z.record(Z.string(), Z.string())]),
|
|
2902
|
+
providerOptions: Q.optional()
|
|
2903
2903
|
}),
|
|
2904
|
-
|
|
2905
|
-
type:
|
|
2906
|
-
providerReference:
|
|
2907
|
-
providerOptions:
|
|
2904
|
+
Z.object({
|
|
2905
|
+
type: Z.literal("file-reference"),
|
|
2906
|
+
providerReference: Z.record(Z.string(), Z.string()),
|
|
2907
|
+
providerOptions: Q.optional()
|
|
2908
2908
|
}),
|
|
2909
|
-
|
|
2910
|
-
type:
|
|
2911
|
-
data:
|
|
2912
|
-
mediaType:
|
|
2913
|
-
providerOptions:
|
|
2909
|
+
Z.object({
|
|
2910
|
+
type: Z.literal("image-data"),
|
|
2911
|
+
data: Z.string(),
|
|
2912
|
+
mediaType: Z.string(),
|
|
2913
|
+
providerOptions: Q.optional()
|
|
2914
2914
|
}),
|
|
2915
|
-
|
|
2916
|
-
type:
|
|
2917
|
-
url:
|
|
2918
|
-
providerOptions:
|
|
2915
|
+
Z.object({
|
|
2916
|
+
type: Z.literal("image-url"),
|
|
2917
|
+
url: Z.string(),
|
|
2918
|
+
providerOptions: Q.optional()
|
|
2919
2919
|
}),
|
|
2920
|
-
|
|
2921
|
-
type:
|
|
2922
|
-
fileId:
|
|
2923
|
-
providerOptions:
|
|
2920
|
+
Z.object({
|
|
2921
|
+
type: Z.literal("image-file-id"),
|
|
2922
|
+
fileId: Z.union([Z.string(), Z.record(Z.string(), Z.string())]),
|
|
2923
|
+
providerOptions: Q.optional()
|
|
2924
2924
|
}),
|
|
2925
|
-
|
|
2926
|
-
type:
|
|
2927
|
-
providerReference:
|
|
2928
|
-
providerOptions:
|
|
2925
|
+
Z.object({
|
|
2926
|
+
type: Z.literal("image-file-reference"),
|
|
2927
|
+
providerReference: Z.record(Z.string(), Z.string()),
|
|
2928
|
+
providerOptions: Q.optional()
|
|
2929
2929
|
}),
|
|
2930
|
-
|
|
2931
|
-
type:
|
|
2932
|
-
providerOptions:
|
|
2930
|
+
Z.object({
|
|
2931
|
+
type: Z.literal("custom"),
|
|
2932
|
+
providerOptions: Q.optional()
|
|
2933
2933
|
})
|
|
2934
2934
|
]))
|
|
2935
2935
|
})
|
|
2936
|
-
]), Ii =
|
|
2937
|
-
type:
|
|
2938
|
-
toolCallId:
|
|
2939
|
-
toolName:
|
|
2936
|
+
]), Ii = Z.object({
|
|
2937
|
+
type: Z.literal("tool-result"),
|
|
2938
|
+
toolCallId: Z.string(),
|
|
2939
|
+
toolName: Z.string(),
|
|
2940
2940
|
output: Fi,
|
|
2941
|
-
providerOptions:
|
|
2942
|
-
}), Li =
|
|
2943
|
-
type:
|
|
2944
|
-
approvalId:
|
|
2945
|
-
toolCallId:
|
|
2946
|
-
reason:
|
|
2947
|
-
isAutomatic:
|
|
2948
|
-
signature:
|
|
2949
|
-
inputSchemaInput:
|
|
2950
|
-
}), Ri =
|
|
2951
|
-
type:
|
|
2952
|
-
approvalId:
|
|
2953
|
-
approved:
|
|
2954
|
-
reason:
|
|
2955
|
-
}), zi =
|
|
2956
|
-
role:
|
|
2957
|
-
content:
|
|
2958
|
-
providerOptions:
|
|
2959
|
-
}), Bi =
|
|
2960
|
-
role:
|
|
2961
|
-
content:
|
|
2941
|
+
providerOptions: Q.optional()
|
|
2942
|
+
}), Li = Z.object({
|
|
2943
|
+
type: Z.literal("tool-approval-request"),
|
|
2944
|
+
approvalId: Z.string(),
|
|
2945
|
+
toolCallId: Z.string(),
|
|
2946
|
+
reason: Z.string().optional(),
|
|
2947
|
+
isAutomatic: Z.boolean().optional(),
|
|
2948
|
+
signature: Z.string().optional(),
|
|
2949
|
+
inputSchemaInput: Z.unknown().optional()
|
|
2950
|
+
}), Ri = Z.object({
|
|
2951
|
+
type: Z.literal("tool-approval-response"),
|
|
2952
|
+
approvalId: Z.string(),
|
|
2953
|
+
approved: Z.boolean(),
|
|
2954
|
+
reason: Z.string().optional()
|
|
2955
|
+
}), zi = Z.object({
|
|
2956
|
+
role: Z.literal("system"),
|
|
2957
|
+
content: Z.string(),
|
|
2958
|
+
providerOptions: Q.optional()
|
|
2959
|
+
}), Bi = Z.object({
|
|
2960
|
+
role: Z.literal("user"),
|
|
2961
|
+
content: Z.union([Z.string(), Z.array(Z.union([
|
|
2962
2962
|
Ei,
|
|
2963
2963
|
Di,
|
|
2964
2964
|
Ai
|
|
2965
2965
|
]))]),
|
|
2966
|
-
providerOptions:
|
|
2967
|
-
}), Vi =
|
|
2968
|
-
role:
|
|
2969
|
-
content:
|
|
2966
|
+
providerOptions: Q.optional()
|
|
2967
|
+
}), Vi = Z.object({
|
|
2968
|
+
role: Z.literal("assistant"),
|
|
2969
|
+
content: Z.union([Z.string(), Z.array(Z.union([
|
|
2970
2970
|
Ei,
|
|
2971
2971
|
Mi,
|
|
2972
2972
|
Ai,
|
|
@@ -2976,20 +2976,20 @@ var wi = X.union([
|
|
|
2976
2976
|
Ii,
|
|
2977
2977
|
Li
|
|
2978
2978
|
]))]),
|
|
2979
|
-
providerOptions:
|
|
2980
|
-
}), Hi =
|
|
2981
|
-
role:
|
|
2982
|
-
content:
|
|
2983
|
-
providerOptions:
|
|
2979
|
+
providerOptions: Q.optional()
|
|
2980
|
+
}), Hi = Z.object({
|
|
2981
|
+
role: Z.literal("tool"),
|
|
2982
|
+
content: Z.array(Z.union([Ii, Ri])),
|
|
2983
|
+
providerOptions: Q.optional()
|
|
2984
2984
|
});
|
|
2985
|
-
|
|
2985
|
+
Z.union([
|
|
2986
2986
|
zi,
|
|
2987
2987
|
Bi,
|
|
2988
2988
|
Vi,
|
|
2989
2989
|
Hi
|
|
2990
|
-
]),
|
|
2991
|
-
token:
|
|
2992
|
-
url:
|
|
2990
|
+
]), X.object({
|
|
2991
|
+
token: X.string().check(X.refine((e) => e.trim().length > 0)),
|
|
2992
|
+
url: X.string().check(X.refine((e) => {
|
|
2993
2993
|
try {
|
|
2994
2994
|
let t = new URL(e);
|
|
2995
2995
|
return (t.protocol === "ws:" || t.protocol === "wss:") && t.hostname !== "";
|
|
@@ -2997,26 +2997,26 @@ X.union([
|
|
|
2997
2997
|
return !1;
|
|
2998
2998
|
}
|
|
2999
2999
|
})),
|
|
3000
|
-
expiresAt:
|
|
3001
|
-
tools:
|
|
3002
|
-
type:
|
|
3003
|
-
name:
|
|
3004
|
-
description:
|
|
3005
|
-
parameters:
|
|
3000
|
+
expiresAt: X.optional(X.number().check(X.positive()).check(X.maximum(2 ** 53 - 1))),
|
|
3001
|
+
tools: X.optional(X.array(X.object({
|
|
3002
|
+
type: X.literal("function"),
|
|
3003
|
+
name: X.string().check(X.minLength(1)),
|
|
3004
|
+
description: X.optional(X.string()),
|
|
3005
|
+
parameters: X.record(X.string(), X.unknown())
|
|
3006
3006
|
})))
|
|
3007
|
-
}),
|
|
3007
|
+
}), L({
|
|
3008
3008
|
prefix: "call",
|
|
3009
3009
|
size: 24
|
|
3010
|
-
}),
|
|
3010
|
+
}), L({
|
|
3011
3011
|
prefix: "call",
|
|
3012
3012
|
size: 24
|
|
3013
|
-
}),
|
|
3013
|
+
}), L({
|
|
3014
3014
|
prefix: "call",
|
|
3015
3015
|
size: 24
|
|
3016
3016
|
});
|
|
3017
3017
|
async function Ui({ response: e, url: t, fallbackMessage: n }) {
|
|
3018
3018
|
let r = await e.text();
|
|
3019
|
-
return new
|
|
3019
|
+
return new yt({
|
|
3020
3020
|
message: r || n,
|
|
3021
3021
|
url: t,
|
|
3022
3022
|
requestBodyValues: void 0,
|
|
@@ -3026,7 +3026,7 @@ async function Ui({ response: e, url: t, fallbackMessage: n }) {
|
|
|
3026
3026
|
}
|
|
3027
3027
|
async function Wi(e) {
|
|
3028
3028
|
if (e == null) return [];
|
|
3029
|
-
if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new
|
|
3029
|
+
if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new Lt({
|
|
3030
3030
|
functionality: "FileList",
|
|
3031
3031
|
message: "FileList is not supported in the current environment"
|
|
3032
3032
|
});
|
|
@@ -3055,8 +3055,8 @@ var Ki = class {
|
|
|
3055
3055
|
}
|
|
3056
3056
|
async sendMessages({ abortSignal: e, ...t }) {
|
|
3057
3057
|
let n = await fr(this.body), r = await fr(this.headers), i = await fr(this.credentials), a = {
|
|
3058
|
-
...
|
|
3059
|
-
...
|
|
3058
|
+
...Zt(r),
|
|
3059
|
+
...Zt(t.headers)
|
|
3060
3060
|
}, o = await this.prepareSendMessagesRequest?.({
|
|
3061
3061
|
api: this.api,
|
|
3062
3062
|
id: t.chatId,
|
|
@@ -3070,7 +3070,7 @@ var Ki = class {
|
|
|
3070
3070
|
requestMetadata: t.metadata,
|
|
3071
3071
|
trigger: t.trigger,
|
|
3072
3072
|
messageId: t.messageId
|
|
3073
|
-
}), s = o?.api ?? this.api, c = o?.headers === void 0 ? a :
|
|
3073
|
+
}), s = o?.api ?? this.api, c = o?.headers === void 0 ? a : Zt(o.headers), l = o?.body === void 0 ? {
|
|
3074
3074
|
...n,
|
|
3075
3075
|
...t.body,
|
|
3076
3076
|
id: t.chatId,
|
|
@@ -3092,13 +3092,13 @@ var Ki = class {
|
|
|
3092
3092
|
url: s,
|
|
3093
3093
|
fallbackMessage: "Failed to fetch the chat response."
|
|
3094
3094
|
});
|
|
3095
|
-
if (!d.body) throw new
|
|
3095
|
+
if (!d.body) throw new Ct({ message: "The response body is empty." });
|
|
3096
3096
|
return this.processResponseStream(d.body);
|
|
3097
3097
|
}
|
|
3098
3098
|
async reconnectToStream(e) {
|
|
3099
3099
|
let t = await fr(this.body), n = await fr(this.headers), r = await fr(this.credentials), i = {
|
|
3100
|
-
...
|
|
3101
|
-
...
|
|
3100
|
+
...Zt(n),
|
|
3101
|
+
...Zt(e.headers)
|
|
3102
3102
|
}, a = await this.prepareReconnectToStreamRequest?.({
|
|
3103
3103
|
api: this.api,
|
|
3104
3104
|
id: e.chatId,
|
|
@@ -3118,7 +3118,7 @@ var Ki = class {
|
|
|
3118
3118
|
});
|
|
3119
3119
|
o = Gi(this.api, `/${encodeURIComponent(e.chatId)}/stream`);
|
|
3120
3120
|
}
|
|
3121
|
-
let s = a?.headers === void 0 ? i :
|
|
3121
|
+
let s = a?.headers === void 0 ? i : Zt(a.headers), c = a?.credentials ?? r, l = await (this.fetch ?? globalThis.fetch)(o, {
|
|
3122
3122
|
method: "GET",
|
|
3123
3123
|
headers: s,
|
|
3124
3124
|
credentials: c,
|
|
@@ -3130,7 +3130,7 @@ var Ki = class {
|
|
|
3130
3130
|
url: o,
|
|
3131
3131
|
fallbackMessage: "Failed to fetch the chat response."
|
|
3132
3132
|
});
|
|
3133
|
-
if (!l.body) throw new
|
|
3133
|
+
if (!l.body) throw new Ct({ message: "The response body is empty." });
|
|
3134
3134
|
return this.processResponseStream(l.body);
|
|
3135
3135
|
}
|
|
3136
3136
|
}, qi = class extends Ki {
|
|
@@ -3150,7 +3150,7 @@ var Ki = class {
|
|
|
3150
3150
|
get id() {
|
|
3151
3151
|
return this._id ??= this.generateId();
|
|
3152
3152
|
}
|
|
3153
|
-
constructor({ generateId: e =
|
|
3153
|
+
constructor({ generateId: e = Qt, id: t, transport: n = new qi(), messageMetadataSchema: r, dataPartSchemas: i, state: a, onError: o, onToolCall: s, onFinish: c, onData: l, sendAutomaticallyWhen: u, experimental_queue: d = !1 }) {
|
|
3154
3154
|
this.queuedMessagesFallback = [], this.queuedMessageOptions = /* @__PURE__ */ new Map(), this.isQueuePaused = !1, this.pendingAutomaticDecisions = [], this.pendingMessagePreparations = /* @__PURE__ */ new Set(), this.interruptedMessageIds = /* @__PURE__ */ new Set(), this.activeResponse = void 0, this.activeResumeRequest = void 0, this.resumableStreamState = void 0, this.jobExecutor = new Ci(), this.activeStopCount = 0, this.stopGeneration = 0, this.experimental_removeQueuedMessage = (e) => {
|
|
3155
3155
|
this.queuedMessageOptions.delete(e), this.setQueuedMessages(this.experimental_queuedMessages.filter((t) => t.id !== e));
|
|
3156
3156
|
}, this.experimental_sendQueuedMessageNow = async (e) => {
|
|
@@ -3169,7 +3169,7 @@ var Ki = class {
|
|
|
3169
3169
|
e = this.lastMessage?.id;
|
|
3170
3170
|
for (let t = this.state.messages.length - 1; t >= 0; t--) {
|
|
3171
3171
|
let n = this.state.messages[t];
|
|
3172
|
-
if (n.role === "assistant" && n.parts.some((e) =>
|
|
3172
|
+
if (n.role === "assistant" && n.parts.some((e) => $(e) && e.state === "approval-responded")) {
|
|
3173
3173
|
e = n.id;
|
|
3174
3174
|
break;
|
|
3175
3175
|
}
|
|
@@ -3266,7 +3266,7 @@ var Ki = class {
|
|
|
3266
3266
|
}, this.clearError = () => {
|
|
3267
3267
|
this.status === "error" && (this.state.error = void 0, this.setStatus({ status: "ready" }));
|
|
3268
3268
|
}, this.addToolApprovalResponse = async ({ id: e, approved: t, reason: n, options: r }) => this.jobExecutor.run(async () => {
|
|
3269
|
-
let i = this.stopGeneration, a = this.state.messages, o = (r) =>
|
|
3269
|
+
let i = this.stopGeneration, a = this.state.messages, o = (r) => $(r) && r.state === "approval-requested" && r.approval.id === e ? {
|
|
3270
3270
|
...r,
|
|
3271
3271
|
state: "approval-responded",
|
|
3272
3272
|
approval: {
|
|
@@ -3275,7 +3275,7 @@ var Ki = class {
|
|
|
3275
3275
|
approved: t,
|
|
3276
3276
|
reason: n
|
|
3277
3277
|
}
|
|
3278
|
-
} : r, s = a.findIndex((t) => t.parts.some((t) =>
|
|
3278
|
+
} : r, s = a.findIndex((t) => t.parts.some((t) => $(t) && t.state === "approval-requested" && t.approval.id === e));
|
|
3279
3279
|
if (s !== -1) {
|
|
3280
3280
|
let e = a[s];
|
|
3281
3281
|
this.state.replaceMessage(s, {
|
|
@@ -3300,7 +3300,7 @@ var Ki = class {
|
|
|
3300
3300
|
this.settleQueue({ stopGeneration: i });
|
|
3301
3301
|
}), this.addToolOutput = async ({ state: e, toolCallId: t, output: n, errorText: r, options: i }) => this.jobExecutor.run(async () => {
|
|
3302
3302
|
let a = this.stopGeneration, o = this.state.messages, s = (i) => {
|
|
3303
|
-
if (
|
|
3303
|
+
if (!$(i) || i.toolCallId !== t) return i;
|
|
3304
3304
|
let { approval: a, ...o } = i, s = a?.approved === !0 ? { approval: {
|
|
3305
3305
|
...a,
|
|
3306
3306
|
approved: a.approved
|
|
@@ -3320,7 +3320,7 @@ var Ki = class {
|
|
|
3320
3320
|
output: n,
|
|
3321
3321
|
errorText: void 0
|
|
3322
3322
|
};
|
|
3323
|
-
}, c = o.findIndex((e) => e.parts.some((e) =>
|
|
3323
|
+
}, c = o.findIndex((e) => e.parts.some((e) => $(e) && e.toolCallId === t));
|
|
3324
3324
|
if (c !== -1) {
|
|
3325
3325
|
let e = o[c];
|
|
3326
3326
|
this.state.replaceMessage(c, {
|
|
@@ -3392,11 +3392,11 @@ var Ki = class {
|
|
|
3392
3392
|
}
|
|
3393
3393
|
isWaitingForUser() {
|
|
3394
3394
|
let e = this.lastMessage;
|
|
3395
|
-
return e?.role === "assistant" && e.parts.some((e) =>
|
|
3395
|
+
return e?.role === "assistant" && e.parts.some((e) => $(e) && (e.state === "approval-requested" || e.state === "approval-responded" || !e.providerExecuted && (e.state === "input-streaming" || e.state === "input-available")));
|
|
3396
3396
|
}
|
|
3397
3397
|
hasUnsentApprovalResponse() {
|
|
3398
3398
|
let e = this.lastMessage;
|
|
3399
|
-
return e?.role === "assistant" && e.parts.some((e) =>
|
|
3399
|
+
return e?.role === "assistant" && e.parts.some((e) => $(e) && e.state === "approval-responded") && !e.parts.some((e) => $(e) && (e.state === "approval-requested" || !e.providerExecuted && (e.state === "input-streaming" || e.state === "input-available")));
|
|
3400
3400
|
}
|
|
3401
3401
|
async settleQueue({ stopGeneration: e = this.stopGeneration, skipWaitForUser: t = !1 } = {}) {
|
|
3402
3402
|
if (this.isQueuePaused || this.isRequestInProgress() || this.activeStopCount > 0 || e !== this.stopGeneration) return;
|
|
@@ -3496,7 +3496,7 @@ var Ki = class {
|
|
|
3496
3496
|
status: "submitted",
|
|
3497
3497
|
error: void 0
|
|
3498
3498
|
});
|
|
3499
|
-
let d = this.lastMessage, f = e === "submit-message" && i != null ? this.state.messages.findIndex((e) => e.id === i) : this.state.messages.length - 1, p = f === -1 ? d : this.state.messages[f], m = p?.id, h = e === "resume-stream" && p?.role === "assistant" && p.parts.some((e) =>
|
|
3499
|
+
let d = this.lastMessage, f = e === "submit-message" && i != null ? this.state.messages.findIndex((e) => e.id === i) : this.state.messages.length - 1, p = f === -1 ? d : this.state.messages[f], m = p?.id, h = e === "resume-stream" && p?.role === "assistant" && p.parts.some((e) => $(e) && (e.state === "input-streaming" || e.state === "input-available" && e.providerExecuted || e.state === "approval-responded")) ? this.state.snapshot(p) : void 0, g = f !== -1 && f < this.state.messages.length - 1 && p?.role === "assistant", _ = !1, v = !1, y = !1, b;
|
|
3500
3500
|
try {
|
|
3501
3501
|
let s = {
|
|
3502
3502
|
state: e === "resume-stream" && this.resumableStreamState != null ? this.resumableStreamState : gi({
|
|
@@ -3594,7 +3594,7 @@ var Ki = class {
|
|
|
3594
3594
|
function Yi({ messages: e }) {
|
|
3595
3595
|
let t = e[e.length - 1];
|
|
3596
3596
|
if (!t || t.role !== "assistant") return !1;
|
|
3597
|
-
let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter(
|
|
3597
|
+
let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter($);
|
|
3598
3598
|
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");
|
|
3599
3599
|
}
|
|
3600
3600
|
// ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.45_typescript@6.0.3_/node_modules/swrv/esm/lib/hash.js
|
|
@@ -3656,12 +3656,12 @@ var ra = {
|
|
|
3656
3656
|
return e.json();
|
|
3657
3657
|
});
|
|
3658
3658
|
}
|
|
3659
|
-
},
|
|
3660
|
-
return
|
|
3659
|
+
}, ia = function() {
|
|
3660
|
+
return ia = Object.assign || function(e) {
|
|
3661
3661
|
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]);
|
|
3662
3662
|
return e;
|
|
3663
|
-
},
|
|
3664
|
-
},
|
|
3663
|
+
}, ia.apply(this, arguments);
|
|
3664
|
+
}, aa = function(e, t, n, r) {
|
|
3665
3665
|
function i(e) {
|
|
3666
3666
|
return e instanceof n ? e : new n(function(t) {
|
|
3667
3667
|
t(e);
|
|
@@ -3687,7 +3687,7 @@ var ra = {
|
|
|
3687
3687
|
}
|
|
3688
3688
|
c((r = r.apply(e, t || [])).next());
|
|
3689
3689
|
});
|
|
3690
|
-
},
|
|
3690
|
+
}, oa = function(e, t) {
|
|
3691
3691
|
var n = {
|
|
3692
3692
|
label: 0,
|
|
3693
3693
|
sent: function() {
|
|
@@ -3760,7 +3760,7 @@ var ra = {
|
|
|
3760
3760
|
done: !0
|
|
3761
3761
|
};
|
|
3762
3762
|
}
|
|
3763
|
-
},
|
|
3763
|
+
}, sa = function(e, t) {
|
|
3764
3764
|
var n = typeof Symbol == "function" && e[Symbol.iterator];
|
|
3765
3765
|
if (!n) return e;
|
|
3766
3766
|
var r = n.call(e), i, a = [], o;
|
|
@@ -3776,11 +3776,11 @@ var ra = {
|
|
|
3776
3776
|
}
|
|
3777
3777
|
}
|
|
3778
3778
|
return a;
|
|
3779
|
-
},
|
|
3779
|
+
}, ca = function(e, t, n) {
|
|
3780
3780
|
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]);
|
|
3781
3781
|
return e.concat(a || Array.prototype.slice.call(t));
|
|
3782
|
-
},
|
|
3783
|
-
cache:
|
|
3782
|
+
}, la = new ea(), ua = new ea(), da = new ea(), fa = {
|
|
3783
|
+
cache: la,
|
|
3784
3784
|
refreshInterval: 0,
|
|
3785
3785
|
ttl: 0,
|
|
3786
3786
|
serverTTL: 1e3,
|
|
@@ -3794,11 +3794,11 @@ var ra = {
|
|
|
3794
3794
|
isOnline: ra.isOnline,
|
|
3795
3795
|
isDocumentVisible: ra.isDocumentVisible
|
|
3796
3796
|
};
|
|
3797
|
-
function fa(e, t, n) {
|
|
3798
|
-
var r = la.get(e);
|
|
3799
|
-
r ? r.data.push(t) : la.set(e, [t], n > 0 ? n + 5e3 : n);
|
|
3800
|
-
}
|
|
3801
3797
|
function pa(e, t, n) {
|
|
3798
|
+
var r = ua.get(e);
|
|
3799
|
+
r ? r.data.push(t) : ua.set(e, [t], n > 0 ? n + 5e3 : n);
|
|
3800
|
+
}
|
|
3801
|
+
function ma(e, t, n) {
|
|
3802
3802
|
if (n.isDocumentVisible() && !(n.errorRetryCount !== void 0 && t > n.errorRetryCount)) {
|
|
3803
3803
|
var r = Math.min(t || 0, n.errorRetryCount), i = r * n.errorRetryInterval;
|
|
3804
3804
|
setTimeout(function() {
|
|
@@ -3809,17 +3809,17 @@ function pa(e, t, n) {
|
|
|
3809
3809
|
}, i);
|
|
3810
3810
|
}
|
|
3811
3811
|
}
|
|
3812
|
-
function
|
|
3812
|
+
function ha(e) {
|
|
3813
3813
|
var t = e.shouldRetry, n = t === void 0 ? void 0 : t, r = e.error;
|
|
3814
|
-
return typeof n == "function" ? n(r) : typeof n == "boolean" ? n :
|
|
3814
|
+
return typeof n == "function" ? n(r) : typeof n == "boolean" ? n : fa.shouldRetryOnError;
|
|
3815
3815
|
}
|
|
3816
|
-
var
|
|
3817
|
-
return n === void 0 && (n =
|
|
3816
|
+
var ga = function(e, t, n, r) {
|
|
3817
|
+
return n === void 0 && (n = la), r === void 0 && (r = fa.ttl), aa(void 0, void 0, void 0, function() {
|
|
3818
3818
|
var i, a, o, s, c, l, u;
|
|
3819
|
-
return
|
|
3819
|
+
return oa(this, function(d) {
|
|
3820
3820
|
switch (d.label) {
|
|
3821
3821
|
case 0:
|
|
3822
|
-
if (!
|
|
3822
|
+
if (!va(t)) return [3, 5];
|
|
3823
3823
|
d.label = 1;
|
|
3824
3824
|
case 1: return d.trys.push([
|
|
3825
3825
|
1,
|
|
@@ -3841,7 +3841,7 @@ var ha = function(e, t, n, r) {
|
|
|
3841
3841
|
} catch (e) {
|
|
3842
3842
|
console.error("swrv(mutate): failed to set cache", e);
|
|
3843
3843
|
}
|
|
3844
|
-
return l =
|
|
3844
|
+
return l = ua.get(e), l && l.data.length && (u = l.data.filter(function(t) {
|
|
3845
3845
|
return t.key === e;
|
|
3846
3846
|
}), u.forEach(function(e, t) {
|
|
3847
3847
|
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];
|
|
@@ -3850,16 +3850,16 @@ var ha = function(e, t, n, r) {
|
|
|
3850
3850
|
});
|
|
3851
3851
|
});
|
|
3852
3852
|
};
|
|
3853
|
-
function
|
|
3853
|
+
function _a() {
|
|
3854
3854
|
for (var e = this, t = [], n = 0; n < arguments.length; n++) t[n] = arguments[n];
|
|
3855
|
-
var r, i, a =
|
|
3855
|
+
var r, i, a = ia({}, fa), o = !1, s = !1;
|
|
3856
3856
|
if (!E()) return console.error("useSWRV must be called inside setup() or an active effectScope()."), null;
|
|
3857
3857
|
var c = typeof window > "u" || typeof document > "u";
|
|
3858
|
-
t.length >= 1 && (r = t[0]), t.length >= 2 && (i = t[1]), t.length > 2 && (a =
|
|
3858
|
+
t.length >= 1 && (r = t[0]), t.length >= 2 && (i = t[1]), t.length > 2 && (a = ia(ia({}, a), t[2]));
|
|
3859
3859
|
var l = c ? a.serverTTL : a.ttl, u = typeof r == "function" ? r : D(r);
|
|
3860
3860
|
i === void 0 && (i = a.fetcher);
|
|
3861
3861
|
var d = null;
|
|
3862
|
-
d ||=
|
|
3862
|
+
d ||= et({
|
|
3863
3863
|
data: void 0,
|
|
3864
3864
|
error: void 0,
|
|
3865
3865
|
isValidating: !0,
|
|
@@ -3867,32 +3867,32 @@ function ga() {
|
|
|
3867
3867
|
key: null
|
|
3868
3868
|
});
|
|
3869
3869
|
var f = function(t, n) {
|
|
3870
|
-
return
|
|
3870
|
+
return aa(e, void 0, void 0, function() {
|
|
3871
3871
|
var e, r, s, c, p, m, h, g = this;
|
|
3872
|
-
return
|
|
3872
|
+
return oa(this, function(_) {
|
|
3873
3873
|
switch (_.label) {
|
|
3874
3874
|
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() {
|
|
3875
|
-
return
|
|
3875
|
+
return aa(g, void 0, void 0, function() {
|
|
3876
3876
|
var e, t, i, s, c, u;
|
|
3877
|
-
return
|
|
3877
|
+
return oa(this, function(m) {
|
|
3878
3878
|
switch (m.label) {
|
|
3879
|
-
case 0: return e =
|
|
3879
|
+
case 0: return e = da.get(r), e ? [3, 2] : (t = Array.isArray(r) ? r : [r], i = p.apply(void 0, ca([], sa(t), !1)), da.set(r, i, a.dedupingInterval), [4, ga(r, i, a.cache, l)]);
|
|
3880
3880
|
case 1: return m.sent(), [3, 4];
|
|
3881
|
-
case 2: return [4,
|
|
3881
|
+
case 2: return [4, ga(r, e.data, a.cache, l)];
|
|
3882
3882
|
case 3: m.sent(), m.label = 4;
|
|
3883
|
-
case 4: return d.isValidating = !1, d.isLoading = !1,
|
|
3883
|
+
case 4: return d.isValidating = !1, d.isLoading = !1, da.delete(r), d.error !== void 0 && (s = ha({
|
|
3884
3884
|
shouldRetry: a.shouldRetryOnError,
|
|
3885
3885
|
error: d.error
|
|
3886
|
-
}), c =
|
|
3886
|
+
}), c = ha({
|
|
3887
3887
|
shouldRetry: !n || n.shouldRetryOnError,
|
|
3888
3888
|
error: d.error
|
|
3889
|
-
}), u = !o && s && c, u &&
|
|
3889
|
+
}), u = !o && s && c, u && ma(f, n ? n.errorRetryCount : 1, a)), [2];
|
|
3890
3890
|
}
|
|
3891
3891
|
});
|
|
3892
3892
|
});
|
|
3893
3893
|
}, c && a.revalidateDebounce ? (setTimeout(function() {
|
|
3894
|
-
return
|
|
3895
|
-
return
|
|
3894
|
+
return aa(g, void 0, void 0, function() {
|
|
3895
|
+
return oa(this, function(e) {
|
|
3896
3896
|
switch (e.label) {
|
|
3897
3897
|
case 0: return o ? [3, 2] : [4, h()];
|
|
3898
3898
|
case 1: e.sent(), e.label = 2;
|
|
@@ -3908,16 +3908,16 @@ function ga() {
|
|
|
3908
3908
|
});
|
|
3909
3909
|
});
|
|
3910
3910
|
}, p = function() {
|
|
3911
|
-
return
|
|
3912
|
-
return
|
|
3911
|
+
return aa(e, void 0, void 0, function() {
|
|
3912
|
+
return oa(this, function(e) {
|
|
3913
3913
|
return [2, f(null, { shouldRetryOnError: !1 })];
|
|
3914
3914
|
});
|
|
3915
3915
|
});
|
|
3916
3916
|
}, m = null;
|
|
3917
3917
|
if (!c) {
|
|
3918
3918
|
var h = function() {
|
|
3919
|
-
return
|
|
3920
|
-
return
|
|
3919
|
+
return aa(e, void 0, void 0, function() {
|
|
3920
|
+
return oa(this, function(e) {
|
|
3921
3921
|
switch (e.label) {
|
|
3922
3922
|
case 0: return d.error || !a.isOnline() ? [3, 2] : [4, f()];
|
|
3923
3923
|
case 1: return e.sent(), [3, 3];
|
|
@@ -3929,40 +3929,40 @@ function ga() {
|
|
|
3929
3929
|
};
|
|
3930
3930
|
a.refreshInterval && (m = setTimeout(h, a.refreshInterval)), a.revalidateOnFocus && (document.addEventListener("visibilitychange", p, !1), window.addEventListener("focus", p, !1));
|
|
3931
3931
|
}
|
|
3932
|
-
|
|
3932
|
+
$e(function() {
|
|
3933
3933
|
o = !0, m &&= (clearTimeout(m), null), !c && a.revalidateOnFocus && (document.removeEventListener("visibilitychange", p, !1), window.removeEventListener("focus", p, !1));
|
|
3934
|
-
var e =
|
|
3934
|
+
var e = ua.get(u.value);
|
|
3935
3935
|
e && (e.data = e.data.filter(function(e) {
|
|
3936
3936
|
return e !== d;
|
|
3937
3937
|
}));
|
|
3938
3938
|
});
|
|
3939
3939
|
try {
|
|
3940
3940
|
k(u, function(e) {
|
|
3941
|
-
|
|
3941
|
+
Ze(u) || (u.value = e), d.key = e, d.isValidating = !!e, pa(u.value, d, l), !c && !s && u.value && f(), s = !1;
|
|
3942
3942
|
}, { immediate: !0 });
|
|
3943
3943
|
} catch {}
|
|
3944
|
-
return
|
|
3945
|
-
return f(e,
|
|
3944
|
+
return ia(ia({}, tt(d)), { mutate: function(e, t) {
|
|
3945
|
+
return f(e, ia(ia({}, t), { forceRevalidate: !0 }));
|
|
3946
3946
|
} });
|
|
3947
3947
|
}
|
|
3948
|
-
function
|
|
3948
|
+
function va(e) {
|
|
3949
3949
|
return typeof e == "object" && !!e && typeof e.then == "function";
|
|
3950
3950
|
}
|
|
3951
3951
|
// ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.45_typescript@6.0.3_/node_modules/swrv/esm/index.js
|
|
3952
|
-
var
|
|
3953
|
-
|
|
3954
|
-
function
|
|
3952
|
+
var ya = _a;
|
|
3953
|
+
ya.default, ya.default;
|
|
3954
|
+
function ba(e) {
|
|
3955
3955
|
return Array.isArray(e) ? [...e] : typeof e == "object" && e && (Object.getPrototypeOf(e) === Object.prototype || Object.getPrototypeOf(e) === null) ? { ...e } : e;
|
|
3956
3956
|
}
|
|
3957
|
-
function
|
|
3957
|
+
function xa(e) {
|
|
3958
3958
|
if (typeof e != "object" || !e || !("parts" in e) || !Array.isArray(e.parts)) return e;
|
|
3959
3959
|
let t = e, n = {
|
|
3960
3960
|
...t,
|
|
3961
3961
|
parts: t.parts.map((e) => ({ ...e }))
|
|
3962
3962
|
};
|
|
3963
|
-
return "metadata" in t && (n.metadata =
|
|
3963
|
+
return "metadata" in t && (n.metadata = ba(t.metadata)), n;
|
|
3964
3964
|
}
|
|
3965
|
-
var
|
|
3965
|
+
var Sa = class {
|
|
3966
3966
|
constructor({ initialMessages: e, messagesRef: t, statusRef: n, errorRef: r, queuedMessagesRef: i, throttleWaitMs: a }) {
|
|
3967
3967
|
this.publishedMessages = [], this.publishedMessageSources = [], this.dirtyMessageIndices = /* @__PURE__ */ new Set(), this.statusValue = "ready", this.queuedMessagesValue = [], this.hasPendingPublication = !1, this.isActive = !0, this.isPublishing = !1, this.pushMessage = (e) => {
|
|
3968
3968
|
this.messagesValue.push(e), this.dirtyMessageIndices.add(this.messagesValue.length - 1), this.schedulePublication();
|
|
@@ -3970,7 +3970,7 @@ var xa = class {
|
|
|
3970
3970
|
this.messagesValue.pop(), this.schedulePublication();
|
|
3971
3971
|
}, this.replaceMessage = (e, t) => {
|
|
3972
3972
|
this.messagesValue[e] = t, this.dirtyMessageIndices.add(e), this.schedulePublication();
|
|
3973
|
-
}, this.snapshot =
|
|
3973
|
+
}, this.snapshot = xa, this.handleIntervalEnd = () => {
|
|
3974
3974
|
this.timeout = void 0, this.isActive && this.hasPendingPublication && (this.hasPendingPublication = !1, this.publishMessages(), this.timeout = setTimeout(this.handleIntervalEnd, this.throttleWaitMs));
|
|
3975
3975
|
}, this.messagesValue = e, this.messagesRef = t, this.statusRef = n, this.errorRef = r, this.queuedMessagesRef = i, this.throttleWaitMs = a != null && Number.isFinite(a) && a > 0 ? a : void 0;
|
|
3976
3976
|
}
|
|
@@ -4018,7 +4018,7 @@ var xa = class {
|
|
|
4018
4018
|
}
|
|
4019
4019
|
publishMessages() {
|
|
4020
4020
|
if (!this.isActive) return;
|
|
4021
|
-
let e = this.messagesValue.map((e, t) => this.dirtyMessageIndices.has(t) || this.publishedMessageSources[t] !== e ?
|
|
4021
|
+
let e = this.messagesValue.map((e, t) => this.dirtyMessageIndices.has(t) || this.publishedMessageSources[t] !== e ? xa(e) : this.publishedMessages[t]);
|
|
4022
4022
|
this.publishedMessages = e, this.publishedMessageSources = [...this.messagesValue], this.dirtyMessageIndices.clear(), this.isPublishing = !0;
|
|
4023
4023
|
try {
|
|
4024
4024
|
this.messagesRef.value = e;
|
|
@@ -4026,7 +4026,7 @@ var xa = class {
|
|
|
4026
4026
|
this.isPublishing = !1;
|
|
4027
4027
|
}
|
|
4028
4028
|
}
|
|
4029
|
-
},
|
|
4029
|
+
}, Ca = class extends Ji {
|
|
4030
4030
|
constructor({ state: e, ...t }) {
|
|
4031
4031
|
super({
|
|
4032
4032
|
...t,
|
|
@@ -4034,13 +4034,13 @@ var xa = class {
|
|
|
4034
4034
|
});
|
|
4035
4035
|
}
|
|
4036
4036
|
};
|
|
4037
|
-
function
|
|
4037
|
+
function wa(e) {
|
|
4038
4038
|
let t = O([]), n = O("ready"), r = O(), i = O([]), a = O(), o;
|
|
4039
4039
|
return k(t, (e) => {
|
|
4040
4040
|
o != null && !o.isPublishing && o.setMessagesFromConsumer(e);
|
|
4041
|
-
}, { flush: "sync" }), k(() =>
|
|
4041
|
+
}, { flush: "sync" }), k(() => nt(e), (e) => {
|
|
4042
4042
|
o?.dispose();
|
|
4043
|
-
let { throttle: s, ...c } = e ?? {}, l = new
|
|
4043
|
+
let { throttle: s, ...c } = e ?? {}, l = new Sa({
|
|
4044
4044
|
initialMessages: c.messages ?? [],
|
|
4045
4045
|
messagesRef: t,
|
|
4046
4046
|
statusRef: n,
|
|
@@ -4048,11 +4048,11 @@ function Ca(e) {
|
|
|
4048
4048
|
queuedMessagesRef: i,
|
|
4049
4049
|
throttleWaitMs: s
|
|
4050
4050
|
});
|
|
4051
|
-
o = l, l.publishInitialState(), a.value = new
|
|
4051
|
+
o = l, l.publishInitialState(), a.value = new Ca({
|
|
4052
4052
|
...c,
|
|
4053
4053
|
state: l
|
|
4054
4054
|
});
|
|
4055
|
-
}, { immediate: !0 }), E() != null &&
|
|
4055
|
+
}, { immediate: !0 }), E() != null && $e(() => {
|
|
4056
4056
|
o?.dispose();
|
|
4057
4057
|
}), {
|
|
4058
4058
|
id: T(() => a.value.id),
|
|
@@ -4072,28 +4072,28 @@ function Ca(e) {
|
|
|
4072
4072
|
};
|
|
4073
4073
|
}
|
|
4074
4074
|
// ../../packages/composable/src/chatbot/useChatbotStore.ts
|
|
4075
|
-
var
|
|
4075
|
+
var Ta = "voice-", Ea = 300, Da = (e) => e?.role === "assistant" && e.parts.some((e) => e.state === "approval-requested"), Oa = (e) => e.replace(/\s+/g, " ").trim().toLowerCase(), ka = (e) => Oa(e.parts.filter((e) => e.type === "text").map((e) => "text" in e ? e.text : "").join(" ")), Aa = 8, ja = (e, t) => {
|
|
4076
4076
|
let n = new Set(t.map((e) => e.id)), r = e.filter((e) => e.role === "user" && !n.has(e.id)).map((e) => ({
|
|
4077
|
-
text:
|
|
4077
|
+
text: ka(e),
|
|
4078
4078
|
taken: !1
|
|
4079
4079
|
}));
|
|
4080
4080
|
return t.filter((e) => {
|
|
4081
4081
|
if (!e.id.startsWith("voice-") || e.role !== "user") return !1;
|
|
4082
|
-
let t =
|
|
4082
|
+
let t = ka(e), n = r.find((e) => !e.taken && e.text.length > 0 && (e.text === t || e.text.length >= Aa && t.endsWith(e.text)));
|
|
4083
4083
|
return !n || (n.taken = !0, !1);
|
|
4084
4084
|
});
|
|
4085
|
-
},
|
|
4085
|
+
}, Ma = 12e4, Na = 1e3, Pa = 5e3, Fa = 100, Ia = 3e4, La = 5e3, Ra = 250, za = 1e3, Ba = "\n\n", Va = (e) => {
|
|
4086
4086
|
let t = e.type ?? "";
|
|
4087
4087
|
return t === "dynamic-tool" ? e.toolName ?? "" : t.startsWith("tool-") ? t.slice(5) : "";
|
|
4088
|
-
},
|
|
4088
|
+
}, Ha = (e) => e?.role === "assistant" && e.parts.some((e) => Ve(Va(e)) && !e.providerExecuted && !Le.has(e.state ?? "")), Ua = ({ messages: e }) => {
|
|
4089
4089
|
let t = e[e.length - 1];
|
|
4090
4090
|
if (!t || t.role !== "assistant") return !1;
|
|
4091
|
-
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 && (
|
|
4092
|
-
return r.length > 0 && r.every((e) =>
|
|
4091
|
+
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 && (Ve(Va(e)) || qe(e)));
|
|
4092
|
+
return r.length > 0 && r.every((e) => Le.has(e.state ?? ""));
|
|
4093
4093
|
};
|
|
4094
|
-
function
|
|
4094
|
+
function Wa(e) {
|
|
4095
4095
|
return A(`chatbot-${e}`, () => {
|
|
4096
|
-
let { t, te: n, locale: r } =
|
|
4096
|
+
let { t, te: n, locale: r } = it({ useScope: "global" }), i = D(""), a = D(), o = D(e), s = D(), c = D(), l = D(), u = D(), d = D(), f = D(), p = D(), m = D(), h = D(), g = D(), _ = D(), v = D(), y = D(), b = D(), ee = D(), te = D(), ne = O(), re = D(0), ie = D(0), ae = D(), oe = D(), x = D(), se = O(), ce = O(), le = D(), ue = D(), de = O(), fe = D(!1), pe = D({}), me = D({}), he = D(!1), ge = D(0), _e = D(), ve = D(!1), ye = ot(), S = T(() => {
|
|
4097
4097
|
let e = u.value?.theme;
|
|
4098
4098
|
return e && e !== "auto" || (e = _e.value), e ? e === "dark" : ye.value;
|
|
4099
4099
|
}), C = T(() => c.value === "reasoning"), be = T(() => C.value ? g.value?.filter((e) => ![
|
|
@@ -4101,8 +4101,8 @@ function Ua(e) {
|
|
|
4101
4101
|
"downvote",
|
|
4102
4102
|
"feedback"
|
|
4103
4103
|
].includes(e)) : g.value), xe = Ie(T(() => `${o.value}-chatId`), null);
|
|
4104
|
-
|
|
4105
|
-
xe.value ||=
|
|
4104
|
+
rt(() => {
|
|
4105
|
+
xe.value ||= Qt();
|
|
4106
4106
|
});
|
|
4107
4107
|
let w = T({
|
|
4108
4108
|
get: () => xe.value,
|
|
@@ -4119,12 +4119,12 @@ function Ua(e) {
|
|
|
4119
4119
|
});
|
|
4120
4120
|
let je = Ie(T(() => `${o.value}-pageNotice`), null), Me = T(() => {
|
|
4121
4121
|
let e = ae.value?.level;
|
|
4122
|
-
return e && e !==
|
|
4122
|
+
return e && e !== Be.Off && Ce.value.length && !Ge(je.value ?? void 0, e) ? e : void 0;
|
|
4123
4123
|
});
|
|
4124
4124
|
function Ne() {
|
|
4125
4125
|
je.value = ae.value?.level ?? null;
|
|
4126
4126
|
}
|
|
4127
|
-
let Pe = D(),
|
|
4127
|
+
let Pe = D(), Le = D(!1), Ve = T(() => Pe.value?.message?.toLowerCase().includes("conversation-blocked") ?? !1);
|
|
4128
4128
|
function Ue(e) {
|
|
4129
4129
|
try {
|
|
4130
4130
|
let t = JSON.parse(e.message);
|
|
@@ -4133,31 +4133,31 @@ function Ua(e) {
|
|
|
4133
4133
|
return !1;
|
|
4134
4134
|
}
|
|
4135
4135
|
}
|
|
4136
|
-
function
|
|
4137
|
-
if (Ue(e)) {
|
|
4138
|
-
let e =
|
|
4139
|
-
w.value =
|
|
4140
|
-
|
|
4136
|
+
function Ke(e) {
|
|
4137
|
+
if (Ue(e) && !I.value) {
|
|
4138
|
+
let e = F.value.messages.filter((e) => e.role === "user"), t = e[e.length - 1], n = t ? Ye(t) : void 0;
|
|
4139
|
+
w.value = Qt(), Pe.value = void 0, Qe(() => {
|
|
4140
|
+
F.value.clearError(), n && F.value.sendMessage({ text: n });
|
|
4141
4141
|
});
|
|
4142
|
-
} else
|
|
4142
|
+
} else Xe.error(e), Pe.value = e, Ve.value && (Le.value = !0);
|
|
4143
4143
|
}
|
|
4144
|
-
let E = T(() =>
|
|
4144
|
+
let E = T(() => ze({
|
|
4145
4145
|
baseUrl: i.value,
|
|
4146
4146
|
basePath: a.value,
|
|
4147
4147
|
headers: () => p.value
|
|
4148
|
-
})),
|
|
4149
|
-
...
|
|
4150
|
-
...
|
|
4151
|
-
}),
|
|
4148
|
+
})), Ze = D(null), tt = () => ({
|
|
4149
|
+
...st(),
|
|
4150
|
+
...Ze.value ?? {}
|
|
4151
|
+
}), nt = () => {
|
|
4152
4152
|
let e = ge.value;
|
|
4153
4153
|
return new Promise((t) => {
|
|
4154
4154
|
let n = setTimeout(() => {
|
|
4155
4155
|
r(), t(!1);
|
|
4156
|
-
}, 3e4), r = k(() => [ge.value,
|
|
4156
|
+
}, 3e4), r = k(() => [ge.value, F.value.status], ([i, a]) => {
|
|
4157
4157
|
i > e && a === "streaming" && (clearTimeout(n), r(), t(!0));
|
|
4158
4158
|
});
|
|
4159
4159
|
});
|
|
4160
|
-
}, A = O(),
|
|
4160
|
+
}, A = O(), ut = (e, t) => new Promise((n) => {
|
|
4161
4161
|
A.value?.answer(!1), A.value = {
|
|
4162
4162
|
toolCallId: e.toolCallId,
|
|
4163
4163
|
question: t?.question,
|
|
@@ -4168,10 +4168,10 @@ function Ua(e) {
|
|
|
4168
4168
|
}
|
|
4169
4169
|
};
|
|
4170
4170
|
});
|
|
4171
|
-
function
|
|
4171
|
+
function mt(e) {
|
|
4172
4172
|
A.value?.answer(e);
|
|
4173
4173
|
}
|
|
4174
|
-
let
|
|
4174
|
+
let ht = (e, t) => {
|
|
4175
4175
|
t.details?.some((e) => e.before !== void 0) && (me.value = {
|
|
4176
4176
|
...me.value,
|
|
4177
4177
|
[e.toolCallId]: {
|
|
@@ -4181,14 +4181,14 @@ function Ua(e) {
|
|
|
4181
4181
|
});
|
|
4182
4182
|
}, j = ({ forms: e }) => ae.value && Ce.value.length ? {
|
|
4183
4183
|
version: 1,
|
|
4184
|
-
features: [...
|
|
4184
|
+
features: [...He],
|
|
4185
4185
|
forms: e ? we().map(({ name: e, description: t, inputSchema: n, annotations: r }) => ({
|
|
4186
4186
|
name: e,
|
|
4187
4187
|
description: t,
|
|
4188
4188
|
inputSchema: n,
|
|
4189
4189
|
annotations: r
|
|
4190
4190
|
})) : []
|
|
4191
|
-
} : void 0,
|
|
4191
|
+
} : void 0, gt = (e) => {
|
|
4192
4192
|
if (e?.provider !== "page") {
|
|
4193
4193
|
le.value = void 0;
|
|
4194
4194
|
return;
|
|
@@ -4203,29 +4203,29 @@ function Ua(e) {
|
|
|
4203
4203
|
...pe.value,
|
|
4204
4204
|
[e.toolCallId]: n
|
|
4205
4205
|
}), e.readOnly ? le.value = void 0 : (le.value = { title: n ?? t?.annotations?.title ?? e.toolName }, he.value = !0);
|
|
4206
|
-
},
|
|
4206
|
+
}, _t = pt({
|
|
4207
4207
|
registry: () => [
|
|
4208
|
-
...(ne.value ?? []).filter((e) => !
|
|
4208
|
+
...(ne.value ?? []).filter((e) => !We(e.name)),
|
|
4209
4209
|
...Ce.value,
|
|
4210
4210
|
...we()
|
|
4211
4211
|
],
|
|
4212
4212
|
capability: () => te.value,
|
|
4213
|
-
addToolOutput: (e) => void
|
|
4214
|
-
confirm:
|
|
4215
|
-
waitForResume:
|
|
4213
|
+
addToolOutput: (e) => void F.value.addToolOutput(e),
|
|
4214
|
+
confirm: ut,
|
|
4215
|
+
waitForResume: nt,
|
|
4216
4216
|
onPendingChange: (e) => {
|
|
4217
4217
|
re.value = e;
|
|
4218
4218
|
},
|
|
4219
|
-
onActivity:
|
|
4219
|
+
onActivity: gt,
|
|
4220
4220
|
mode: () => Oe.value,
|
|
4221
|
-
onSkip:
|
|
4222
|
-
}),
|
|
4223
|
-
let n =
|
|
4224
|
-
|
|
4225
|
-
},
|
|
4221
|
+
onSkip: ht
|
|
4222
|
+
}), vt = /* @__PURE__ */ new Map(), yt = 0, bt = (e, t) => {
|
|
4223
|
+
let n = vt.get(e);
|
|
4224
|
+
vt.delete(e), n?.(JSON.stringify(t));
|
|
4225
|
+
}, xt = pt({
|
|
4226
4226
|
registry: () => Ce.value,
|
|
4227
4227
|
capability: () => te.value,
|
|
4228
|
-
addToolOutput: (e) =>
|
|
4228
|
+
addToolOutput: (e) => bt(e.toolCallId, "output" in e ? e.output : {
|
|
4229
4229
|
content: [{
|
|
4230
4230
|
type: "text",
|
|
4231
4231
|
text: e.errorText
|
|
@@ -4238,37 +4238,37 @@ function Ua(e) {
|
|
|
4238
4238
|
n || (t(), e());
|
|
4239
4239
|
});
|
|
4240
4240
|
});
|
|
4241
|
-
return
|
|
4241
|
+
return vt.has(e.toolCallId) ? ut(e, t) : !1;
|
|
4242
4242
|
},
|
|
4243
|
-
waitForResume: () => new Promise((e) => setTimeout(() => e(!0),
|
|
4243
|
+
waitForResume: () => new Promise((e) => setTimeout(() => e(!0), Ea)),
|
|
4244
4244
|
onPendingChange: (e) => {
|
|
4245
4245
|
ie.value = e;
|
|
4246
4246
|
},
|
|
4247
|
-
onActivity:
|
|
4248
|
-
mode: () =>
|
|
4249
|
-
}),
|
|
4250
|
-
function
|
|
4251
|
-
|
|
4247
|
+
onActivity: gt,
|
|
4248
|
+
mode: () => St
|
|
4249
|
+
}), St = "manual";
|
|
4250
|
+
function Ct() {
|
|
4251
|
+
St = Oe.value;
|
|
4252
4252
|
let e = j({ forms: !1 });
|
|
4253
4253
|
if (e) return {
|
|
4254
4254
|
declaration: e,
|
|
4255
4255
|
clientTools: Object.fromEntries(Ce.value.map((e) => [e.name, (t) => new Promise((n) => {
|
|
4256
|
-
|
|
4257
|
-
let r = `page-call-${
|
|
4258
|
-
|
|
4256
|
+
yt += 1;
|
|
4257
|
+
let r = `page-call-${yt}`;
|
|
4258
|
+
vt.set(r, n), xt.enqueue({
|
|
4259
4259
|
toolCallId: r,
|
|
4260
4260
|
toolName: e.name,
|
|
4261
4261
|
input: t ?? {},
|
|
4262
|
-
messageId:
|
|
4262
|
+
messageId: zt()?.id ?? "",
|
|
4263
4263
|
readOnly: e.annotations?.readOnlyHint === !0,
|
|
4264
4264
|
provider: "page"
|
|
4265
4265
|
});
|
|
4266
4266
|
})]))
|
|
4267
4267
|
};
|
|
4268
4268
|
}
|
|
4269
|
-
function
|
|
4270
|
-
|
|
4271
|
-
for (let e of [...
|
|
4269
|
+
function wt() {
|
|
4270
|
+
xt.cancelAll(), A.value && vt.has(A.value.toolCallId) && A.value.answer(!1);
|
|
4271
|
+
for (let e of [...vt.keys()]) bt(e, {
|
|
4272
4272
|
content: [{
|
|
4273
4273
|
type: "text",
|
|
4274
4274
|
text: "Stopped by the user."
|
|
@@ -4276,30 +4276,30 @@ function Ua(e) {
|
|
|
4276
4276
|
isError: !0
|
|
4277
4277
|
});
|
|
4278
4278
|
}
|
|
4279
|
-
async function
|
|
4280
|
-
|
|
4279
|
+
async function Tt() {
|
|
4280
|
+
Et(), wt(), le.value = void 0, he.value = !1, W.value = "", await F.value.stop();
|
|
4281
4281
|
}
|
|
4282
|
-
function
|
|
4283
|
-
|
|
4282
|
+
function Et() {
|
|
4283
|
+
_t.cancelAll(), A.value && !vt.has(A.value.toolCallId) && A.value.answer(!1);
|
|
4284
4284
|
}
|
|
4285
|
-
async function
|
|
4286
|
-
Se.value = e, e && await
|
|
4285
|
+
async function Dt(e) {
|
|
4286
|
+
Se.value = e, e && await Tt();
|
|
4287
4287
|
}
|
|
4288
|
-
k(w, () =>
|
|
4289
|
-
let
|
|
4290
|
-
function
|
|
4291
|
-
N.value.includes(e) || (N.value = [...N.value, e]),
|
|
4292
|
-
...
|
|
4288
|
+
k(w, () => Et(), { flush: "sync" });
|
|
4289
|
+
let Ot = !1, M, kt = D(), At, jt = D([]), N = D([]), P = D([]), Mt = D({}), Nt = /* @__PURE__ */ new Map(), Pt = /* @__PURE__ */ new Set();
|
|
4290
|
+
function Ft(e, t, n) {
|
|
4291
|
+
N.value.includes(e) || (N.value = [...N.value, e]), Nt.set(e, Date.now()), n ? Pt.add(e) : Pt.delete(e), t && (Mt.value = {
|
|
4292
|
+
...Mt.value,
|
|
4293
4293
|
[e]: t
|
|
4294
|
-
}),
|
|
4294
|
+
}), nr || ar();
|
|
4295
4295
|
}
|
|
4296
|
-
function
|
|
4297
|
-
|
|
4296
|
+
function It(e) {
|
|
4297
|
+
Mt.value = Object.fromEntries(Object.entries(Mt.value).filter(([t]) => t !== e));
|
|
4298
4298
|
}
|
|
4299
|
-
function
|
|
4300
|
-
|
|
4299
|
+
function Lt(e) {
|
|
4300
|
+
Nt.delete(e), N.value = N.value.filter((t) => t !== e), P.value = P.value.filter((t) => t !== e), It(e);
|
|
4301
4301
|
}
|
|
4302
|
-
let
|
|
4302
|
+
let Rt = wa(() => ({
|
|
4303
4303
|
id: w.value,
|
|
4304
4304
|
transport: new qi({
|
|
4305
4305
|
api: E.value.getChatEndpoint(o.value, C.value ? "reasoning" : "chat"),
|
|
@@ -4318,60 +4318,61 @@ function Ua(e) {
|
|
|
4318
4318
|
reasoning: d.value?.reasoning,
|
|
4319
4319
|
webSearch: f.value?.webSearch,
|
|
4320
4320
|
smoothStream: u.value?.smoothStream,
|
|
4321
|
-
deviceContext:
|
|
4321
|
+
deviceContext: tt(),
|
|
4322
4322
|
externalContext: ee.value,
|
|
4323
4323
|
disabledTools: f.value?.disabled,
|
|
4324
4324
|
fallbackModels: y.value,
|
|
4325
4325
|
gatewayOptions: b.value,
|
|
4326
|
-
hostTools:
|
|
4326
|
+
hostTools: ft(ne.value, te.value),
|
|
4327
4327
|
pageTools: j({ forms: !0 }),
|
|
4328
|
+
...Zt(t) && { projectId: Zt(t) },
|
|
4328
4329
|
...Oe.value === "automatic" && { confirmations: "automatic" }
|
|
4329
4330
|
} }),
|
|
4330
4331
|
credentials: "include",
|
|
4331
4332
|
headers: () => p.value ?? {}
|
|
4332
4333
|
}),
|
|
4333
|
-
sendAutomaticallyWhen: (e) =>
|
|
4334
|
+
sendAutomaticallyWhen: (e) => !I.value && (Ua(e) || Yi(e)),
|
|
4334
4335
|
onError: (e) => {
|
|
4335
|
-
|
|
4336
|
+
Ot ? Xe.warn(e) : Ke(e);
|
|
4336
4337
|
},
|
|
4337
4338
|
onToolCall: ({ toolCall: e }) => {
|
|
4338
|
-
if (!
|
|
4339
|
+
if (!dt(e) || Ot || I.value) return;
|
|
4339
4340
|
let t = e;
|
|
4340
|
-
|
|
4341
|
+
_t.enqueue({
|
|
4341
4342
|
toolCallId: t.toolCallId,
|
|
4342
4343
|
toolName: t.toolName,
|
|
4343
4344
|
input: t.input,
|
|
4344
|
-
messageId:
|
|
4345
|
+
messageId: zt()?.id ?? "",
|
|
4345
4346
|
readOnly: t.toolMetadata?.readOnly === !0,
|
|
4346
4347
|
provider: t.toolMetadata?.provider === "page" ? "page" : "app"
|
|
4347
4348
|
});
|
|
4348
4349
|
},
|
|
4349
4350
|
onData: (e) => {
|
|
4350
|
-
e.type === "data-turnStream" ?
|
|
4351
|
+
e.type === "data-turnStream" ? At = e.data.streamId : e.type === "data-audioTranscripts" && (F.value.messages = Je(F.value.messages, e.data));
|
|
4351
4352
|
},
|
|
4352
4353
|
onFinish: () => {
|
|
4353
4354
|
let e = w.value;
|
|
4354
|
-
!C.value && !
|
|
4355
|
+
!C.value && !R.value.some((t) => t.id === e) && q(o.value);
|
|
4355
4356
|
}
|
|
4356
|
-
})),
|
|
4357
|
+
})), F = T(() => et(Rt)), zt = () => F.value.messages[F.value.messages.length - 1];
|
|
4357
4358
|
k(w, (e, t) => {
|
|
4358
|
-
if (t && !C.value && (
|
|
4359
|
-
let e =
|
|
4360
|
-
|
|
4359
|
+
if (t && !C.value && (Nn() || M?.chatId === t)) {
|
|
4360
|
+
let e = F.value.messages.filter((e) => e.role === "user"), n = e[e.length - 1];
|
|
4361
|
+
Ft(t, n ? Ye(n) ?? "" : "", F.value.status === "streaming" || M?.chatId === t);
|
|
4361
4362
|
}
|
|
4362
|
-
|
|
4363
|
+
Lt(e), At = void 0, clearTimeout(Qn), Zn.value = !1, F.value.stop();
|
|
4363
4364
|
}, { flush: "sync" });
|
|
4364
|
-
let
|
|
4365
|
+
let Bt = T(() => {
|
|
4365
4366
|
let e = u.value?.initialMessage;
|
|
4366
4367
|
return e?.[r.value] ? e[r.value] : n("message.defaultAgentWelcome") ? t("message.defaultAgentWelcome") : "";
|
|
4367
|
-
}),
|
|
4368
|
-
id:
|
|
4368
|
+
}), Vt = Qt(), Ht = T(() => ({
|
|
4369
|
+
id: Vt,
|
|
4369
4370
|
role: "assistant",
|
|
4370
4371
|
parts: [{
|
|
4371
4372
|
type: "text",
|
|
4372
|
-
text:
|
|
4373
|
+
text: Bt.value
|
|
4373
4374
|
}]
|
|
4374
|
-
})),
|
|
4375
|
+
})), Ut = T(() => {
|
|
4375
4376
|
let e = (e) => e.map((e) => e.role !== "user" || !e.parts.some((e) => e.type === "file") ? e : {
|
|
4376
4377
|
...e,
|
|
4377
4378
|
parts: e.parts.map((e) => {
|
|
@@ -4389,152 +4390,169 @@ function Ua(e) {
|
|
|
4389
4390
|
url: E.value.appendAuthToken(t.url)
|
|
4390
4391
|
};
|
|
4391
4392
|
})
|
|
4392
|
-
}), t =
|
|
4393
|
-
return C.value ? e(t) : !ve.value && t[0]?.role !== "assistant" ? [
|
|
4394
|
-
}),
|
|
4393
|
+
}), t = F.value.id === w.value ? F.value.messages : [];
|
|
4394
|
+
return C.value ? e(t) : !ve.value && t[0]?.role !== "assistant" ? [Ht.value, ...e(t)] : e(t);
|
|
4395
|
+
}), Wt = T(() => {
|
|
4395
4396
|
let e = u.value?.messagePlaceholder;
|
|
4396
4397
|
return e?.[r.value] ? e[r.value] : n("placeholder.askAnything") ? t("placeholder.askAnything") : "";
|
|
4397
|
-
}),
|
|
4398
|
-
function
|
|
4399
|
-
|
|
4400
|
-
|
|
4398
|
+
}), Gt = D(!1), Kt = D();
|
|
4399
|
+
function qt(e, t) {
|
|
4400
|
+
Kt.value = {
|
|
4401
|
+
chatId: e,
|
|
4402
|
+
authorId: t.authorId,
|
|
4403
|
+
projectId: t.projectId ?? void 0
|
|
4404
|
+
};
|
|
4405
|
+
}
|
|
4406
|
+
let Jt = (e) => Kt.value?.chatId === e ? Kt.value : void 0, Yt = T(() => Jt(w.value)?.authorId), Xt = T(() => Jt(w.value)?.projectId), I = T(() => Yt.value !== void 0 && l.value !== void 0 && Yt.value !== l.value), Zt = (e) => {
|
|
4407
|
+
let t = Jt(e);
|
|
4408
|
+
return t && t.authorId === void 0 ? t.projectId : void 0;
|
|
4409
|
+
}, L = () => Gt.value ? { projectId: Re } : void 0, R = D([]), $t = D(!1), en = D(1), tn = D(!1), nn = D(!1), rn, z = D([]), B = D(!1), an = D("chat"), on = D(0), sn = D([]), V = D(), cn = D(!1), ln = D(!1), un = D(), dn = D(!1), fn = D(!1), pn = D(), H = D(""), U = D([]), W = D(""), mn = D(!0), hn = O(), gn = D(0), _n = Fe(T(() => `${o.value}-queue`), {}), vn = T(() => _n.value[w.value] ?? []), G = T(() => !C.value);
|
|
4410
|
+
function yn(e, t) {
|
|
4411
|
+
let n = Object.fromEntries(Object.entries(_n.value).filter(([t]) => t !== e));
|
|
4412
|
+
_n.value = t.length > 0 ? {
|
|
4401
4413
|
...n,
|
|
4402
4414
|
[e]: t
|
|
4403
4415
|
} : n;
|
|
4404
4416
|
}
|
|
4405
|
-
function
|
|
4406
|
-
let t = (
|
|
4407
|
-
return
|
|
4417
|
+
function bn(e) {
|
|
4418
|
+
let t = (_n.value[e] ?? []).join(Ba);
|
|
4419
|
+
return yn(e, []), t;
|
|
4408
4420
|
}
|
|
4409
|
-
function
|
|
4410
|
-
e && (
|
|
4421
|
+
function xn(e) {
|
|
4422
|
+
e && (H.value = H.value ? `${H.value}${Ba}${e}` : e);
|
|
4411
4423
|
}
|
|
4412
|
-
function
|
|
4413
|
-
|
|
4424
|
+
function Sn(e) {
|
|
4425
|
+
yn(w.value, vn.value.filter((t, n) => n !== e));
|
|
4414
4426
|
}
|
|
4415
|
-
function
|
|
4416
|
-
let t =
|
|
4417
|
-
|
|
4427
|
+
function K(e) {
|
|
4428
|
+
let t = vn.value[e];
|
|
4429
|
+
Sn(e), xn(t ?? "");
|
|
4418
4430
|
}
|
|
4419
|
-
async function
|
|
4420
|
-
if (C.value)
|
|
4431
|
+
async function q(e) {
|
|
4432
|
+
if (C.value) R.value = [];
|
|
4421
4433
|
else {
|
|
4422
|
-
|
|
4434
|
+
$t.value = !0;
|
|
4423
4435
|
try {
|
|
4424
|
-
let t = await E.value.getConversations(e, l.value), n = new Set(t.map((e) => e.id)), r = N.value.filter((e) => !n.has(e) &&
|
|
4436
|
+
let t = await E.value.getConversations(e, l.value, L()), n = new Set(t.map((e) => e.id)), r = N.value.filter((e) => !n.has(e) && Mt.value[e]).map((t) => ({
|
|
4425
4437
|
id: t,
|
|
4426
4438
|
agentId: e,
|
|
4427
|
-
title:
|
|
4439
|
+
title: Mt.value[t],
|
|
4428
4440
|
summary: null,
|
|
4429
4441
|
messages: [],
|
|
4430
4442
|
lastMessageAt: /* @__PURE__ */ new Date()
|
|
4431
4443
|
})), i = `${e}:${l.value ?? ""}`;
|
|
4432
|
-
i !==
|
|
4433
|
-
let a = new Set(r.map((e) => e.id)), o =
|
|
4434
|
-
|
|
4444
|
+
i !== rn && (en.value = 1);
|
|
4445
|
+
let a = new Set(r.map((e) => e.id)), o = en.value > 1 ? R.value.filter((e) => !n.has(e.id) && !a.has(e.id)) : [];
|
|
4446
|
+
R.value = [
|
|
4435
4447
|
...r,
|
|
4436
4448
|
...t,
|
|
4437
4449
|
...o
|
|
4438
|
-
],
|
|
4450
|
+
], rn = i, en.value === 1 && (tn.value = t.length >= 100);
|
|
4439
4451
|
} catch {
|
|
4440
|
-
|
|
4452
|
+
R.value = [], en.value = 1, rn = void 0, tn.value = !1;
|
|
4441
4453
|
return;
|
|
4442
4454
|
} finally {
|
|
4443
|
-
|
|
4455
|
+
$t.value = !1;
|
|
4444
4456
|
}
|
|
4445
|
-
|
|
4457
|
+
or([.../* @__PURE__ */ new Set([...er(), ...R.value.map((e) => e.id)])]);
|
|
4446
4458
|
}
|
|
4447
4459
|
}
|
|
4448
|
-
async function
|
|
4449
|
-
if (!
|
|
4450
|
-
|
|
4451
|
-
let e =
|
|
4460
|
+
async function Cn() {
|
|
4461
|
+
if (!tn.value || nn.value || C.value) return;
|
|
4462
|
+
nn.value = !0;
|
|
4463
|
+
let e = rn;
|
|
4452
4464
|
try {
|
|
4453
|
-
let t =
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4465
|
+
let t = en.value + 1, n = await E.value.getConversations(o.value, l.value, {
|
|
4466
|
+
...L(),
|
|
4467
|
+
page: t
|
|
4468
|
+
});
|
|
4469
|
+
if (e !== rn) return;
|
|
4470
|
+
let r = new Set(R.value.map((e) => e.id));
|
|
4471
|
+
R.value = [...R.value, ...n.filter((e) => !r.has(e.id))], en.value = t, tn.value = n.length >= 100;
|
|
4457
4472
|
} catch {} finally {
|
|
4458
|
-
|
|
4473
|
+
nn.value = !1;
|
|
4459
4474
|
}
|
|
4460
4475
|
}
|
|
4461
|
-
async function
|
|
4476
|
+
async function wn(e) {
|
|
4462
4477
|
return C.value ? [] : E.value.getConversations(o.value, l.value, { search: e });
|
|
4463
4478
|
}
|
|
4464
|
-
async function
|
|
4479
|
+
async function Tn() {
|
|
4465
4480
|
let e = w.value;
|
|
4466
|
-
if (!e)
|
|
4481
|
+
if (!e) z.value = [];
|
|
4467
4482
|
else {
|
|
4468
|
-
|
|
4483
|
+
B.value = !0;
|
|
4469
4484
|
try {
|
|
4470
|
-
|
|
4485
|
+
z.value = await E.value.getChatFiles(e);
|
|
4471
4486
|
} catch {
|
|
4472
|
-
|
|
4487
|
+
z.value = [];
|
|
4473
4488
|
} finally {
|
|
4474
|
-
|
|
4489
|
+
B.value = !1;
|
|
4475
4490
|
}
|
|
4476
4491
|
}
|
|
4477
4492
|
}
|
|
4478
|
-
function
|
|
4493
|
+
function En(e, t = !1) {
|
|
4479
4494
|
return E.value.getChatFileDownloadUrl(e, t);
|
|
4480
4495
|
}
|
|
4481
|
-
function
|
|
4496
|
+
function Dn(e) {
|
|
4482
4497
|
return E.value.getChatFilePreviewUrl(e);
|
|
4483
4498
|
}
|
|
4484
|
-
async function
|
|
4499
|
+
async function On(e) {
|
|
4485
4500
|
await E.value.deleteChatFile(e);
|
|
4486
|
-
let t =
|
|
4487
|
-
|
|
4501
|
+
let t = z.value.find((t) => t.documentId === e), n = t?.kind === "spreadsheet" ? t.sourceAttachmentId ?? t.documentId : void 0;
|
|
4502
|
+
z.value = z.value.filter((t) => t.documentId !== e && (!n || t.documentId !== n && t.sourceAttachmentId !== n));
|
|
4488
4503
|
}
|
|
4489
|
-
async function
|
|
4504
|
+
async function kn(e, t) {
|
|
4490
4505
|
if (!C.value) try {
|
|
4491
4506
|
let n = await E.value.getChat(e, t);
|
|
4492
|
-
if (t !== w.value ||
|
|
4493
|
-
|
|
4507
|
+
if (t !== w.value || (n && qt(t, {
|
|
4508
|
+
authorId: n.userId,
|
|
4509
|
+
projectId: n.projectId
|
|
4510
|
+
}), F.value.status !== "ready" || F.value.messages.length > 0)) return;
|
|
4511
|
+
n && (F.value.messages = n.messages, Le.value = n.blocked ?? !1, An(e, t, n.turnInProgress === !0));
|
|
4494
4512
|
} catch {}
|
|
4495
4513
|
}
|
|
4496
|
-
async function
|
|
4497
|
-
n && (await
|
|
4514
|
+
async function An(e, t, n) {
|
|
4515
|
+
n && (await jn(t), t !== w.value || Nn()) || (await Mn(e, t), t === w.value && await Ln());
|
|
4498
4516
|
}
|
|
4499
|
-
async function
|
|
4517
|
+
async function jn(e) {
|
|
4500
4518
|
let t = { chatId: e };
|
|
4501
|
-
M = t,
|
|
4502
|
-
let n = () => M === t && e === w.value, r = Date.now() +
|
|
4519
|
+
M = t, kt.value = e;
|
|
4520
|
+
let n = () => M === t && e === w.value, r = Date.now() + Ma;
|
|
4503
4521
|
try {
|
|
4504
|
-
for (; n() && !
|
|
4505
|
-
|
|
4522
|
+
for (; n() && !Nn() && Date.now() < r;) {
|
|
4523
|
+
Ot = !0;
|
|
4506
4524
|
try {
|
|
4507
|
-
await
|
|
4525
|
+
await F.value.resumeStream();
|
|
4508
4526
|
} finally {
|
|
4509
|
-
|
|
4527
|
+
Ot = !1;
|
|
4510
4528
|
}
|
|
4511
4529
|
if (!n()) return;
|
|
4512
|
-
|
|
4530
|
+
F.value.clearError();
|
|
4513
4531
|
let t = await E.value.getChat(o.value, e).catch(() => null);
|
|
4514
|
-
if (!t || !n() ||
|
|
4532
|
+
if (!t || !n() || Nn()) return;
|
|
4515
4533
|
if (!t.turnInProgress) {
|
|
4516
|
-
|
|
4534
|
+
F.value.messages = t.messages;
|
|
4517
4535
|
return;
|
|
4518
4536
|
}
|
|
4519
|
-
await new Promise((e) => setTimeout(e,
|
|
4537
|
+
await new Promise((e) => setTimeout(e, Na));
|
|
4520
4538
|
}
|
|
4521
4539
|
} finally {
|
|
4522
|
-
M === t && (M = void 0,
|
|
4540
|
+
M === t && (M = void 0, kt.value = void 0);
|
|
4523
4541
|
}
|
|
4524
4542
|
}
|
|
4525
|
-
async function
|
|
4543
|
+
async function Mn(e, t) {
|
|
4526
4544
|
let n;
|
|
4527
4545
|
try {
|
|
4528
|
-
n = Number(sessionStorage.getItem(
|
|
4546
|
+
n = Number(sessionStorage.getItem(lt)), sessionStorage.removeItem(lt);
|
|
4529
4547
|
} catch {
|
|
4530
4548
|
return;
|
|
4531
4549
|
}
|
|
4532
4550
|
if (!(!n || Date.now() - n > 6e4 || Se.value)) for (let n = 0; n < 12; n++) {
|
|
4533
|
-
let n =
|
|
4551
|
+
let n = F.value.messages[F.value.messages.length - 1];
|
|
4534
4552
|
if (n?.role === "assistant") {
|
|
4535
|
-
let e = n.parts.filter((e) =>
|
|
4553
|
+
let e = n.parts.filter((e) => qe(e) && e.state === "input-available"), t = e.filter((e) => e.toolMetadata?.provider === "page" && e.toolMetadata.readOnly === !0);
|
|
4536
4554
|
if (e.length > 0) {
|
|
4537
|
-
if (t.length === e.length && !Se.value) for (let e of t)
|
|
4555
|
+
if (t.length === e.length && !Se.value) for (let e of t) _t.enqueue({
|
|
4538
4556
|
toolCallId: e.toolCallId,
|
|
4539
4557
|
toolName: e.toolName,
|
|
4540
4558
|
input: e.input,
|
|
@@ -4546,319 +4564,324 @@ function Ua(e) {
|
|
|
4546
4564
|
}
|
|
4547
4565
|
if (n.parts[n.parts.length - 1]?.type === "text") return;
|
|
4548
4566
|
}
|
|
4549
|
-
if (await new Promise((e) => setTimeout(e, 1500)), t !== w.value ||
|
|
4567
|
+
if (await new Promise((e) => setTimeout(e, 1500)), t !== w.value || F.value.status !== "ready") return;
|
|
4550
4568
|
try {
|
|
4551
4569
|
let n = await E.value.getChat(e, t);
|
|
4552
|
-
n && t === w.value && (
|
|
4570
|
+
n && t === w.value && (F.value.messages = n.messages);
|
|
4553
4571
|
} catch {
|
|
4554
4572
|
return;
|
|
4555
4573
|
}
|
|
4556
4574
|
}
|
|
4557
4575
|
}
|
|
4558
|
-
let
|
|
4559
|
-
let e =
|
|
4576
|
+
let Nn = () => {
|
|
4577
|
+
let e = F.value.status;
|
|
4560
4578
|
return e === "submitted" || e === "streaming";
|
|
4561
|
-
},
|
|
4562
|
-
let e =
|
|
4563
|
-
return A.value !== void 0 ||
|
|
4564
|
-
},
|
|
4565
|
-
async function
|
|
4579
|
+
}, Pn = () => Nn() || M?.chatId === w.value || re.value > 0, Fn = () => {
|
|
4580
|
+
let e = zt();
|
|
4581
|
+
return A.value !== void 0 || Da(e) || Ha(e);
|
|
4582
|
+
}, In = /* @__PURE__ */ new Set();
|
|
4583
|
+
async function Ln() {
|
|
4566
4584
|
let e = w.value;
|
|
4567
|
-
if (!(
|
|
4568
|
-
if (
|
|
4585
|
+
if (!(In.has(e) || vn.value.length === 0 || Pn() || Pe.value)) {
|
|
4586
|
+
if (Fn()) xn(bn(e));
|
|
4569
4587
|
else {
|
|
4570
|
-
|
|
4588
|
+
In.add(e);
|
|
4571
4589
|
try {
|
|
4572
|
-
let t = Date.now() +
|
|
4573
|
-
for (; Date.now() < t && (await Promise.race([E.value.getRunningTurns(o.value, [e]).catch(() => []), new Promise((t) => setTimeout(() => t([e]),
|
|
4574
|
-
if (e !== w.value ||
|
|
4575
|
-
let n =
|
|
4576
|
-
n &&
|
|
4590
|
+
let t = Date.now() + La;
|
|
4591
|
+
for (; Date.now() < t && (await Promise.race([E.value.getRunningTurns(o.value, [e]).catch(() => []), new Promise((t) => setTimeout(() => t([e]), za))])).includes(e);) await new Promise((e) => setTimeout(e, Ra));
|
|
4592
|
+
if (e !== w.value || Pn()) return;
|
|
4593
|
+
let n = bn(e);
|
|
4594
|
+
n && qn(n);
|
|
4577
4595
|
} finally {
|
|
4578
|
-
|
|
4596
|
+
In.delete(e);
|
|
4579
4597
|
}
|
|
4580
4598
|
}
|
|
4581
4599
|
}
|
|
4582
4600
|
}
|
|
4583
|
-
let
|
|
4584
|
-
async function
|
|
4585
|
-
if (C.value ||
|
|
4586
|
-
let e = w.value, t =
|
|
4601
|
+
let Rn = 0, zn = 0;
|
|
4602
|
+
async function Bn() {
|
|
4603
|
+
if (C.value || Nn()) return "indeterminate";
|
|
4604
|
+
let e = w.value, t = Rn += 1;
|
|
4587
4605
|
try {
|
|
4588
4606
|
let n = await E.value.getChat(o.value, e);
|
|
4589
|
-
if (!n || e !== w.value ||
|
|
4590
|
-
|
|
4591
|
-
let r = n.messages, i =
|
|
4592
|
-
return
|
|
4607
|
+
if (!n || e !== w.value || Nn() || t <= zn) return "indeterminate";
|
|
4608
|
+
zn = t;
|
|
4609
|
+
let r = n.messages, i = ja(r, F.value.messages);
|
|
4610
|
+
return F.value.messages = [...r, ...i], Le.value = n.blocked ?? !1, i.length > 0 ? "pending" : "caught-up";
|
|
4593
4611
|
} catch {}
|
|
4594
4612
|
return "indeterminate";
|
|
4595
4613
|
}
|
|
4596
|
-
function
|
|
4597
|
-
|
|
4614
|
+
function Vn(e) {
|
|
4615
|
+
F.value.messages = [...F.value.messages, e];
|
|
4598
4616
|
}
|
|
4599
|
-
async function
|
|
4617
|
+
async function Hn(e) {
|
|
4600
4618
|
try {
|
|
4601
|
-
|
|
4619
|
+
sn.value = await E.value.getMessageFeedbacks(e);
|
|
4602
4620
|
} catch {
|
|
4603
|
-
|
|
4621
|
+
sn.value = [];
|
|
4604
4622
|
}
|
|
4605
4623
|
}
|
|
4606
|
-
function
|
|
4607
|
-
let t =
|
|
4608
|
-
t >= 0 ?
|
|
4624
|
+
function Un(e) {
|
|
4625
|
+
let t = sn.value.findIndex((t) => t.messageId === e.messageId);
|
|
4626
|
+
t >= 0 ? sn.value[t] = e : sn.value.push(e);
|
|
4609
4627
|
}
|
|
4610
|
-
function
|
|
4611
|
-
let t =
|
|
4628
|
+
function Wn(e) {
|
|
4629
|
+
let t = Ut.value, n = t.findIndex((t) => t.id === e.id), r = Ye(e) ?? "", i = t.slice(0, n).reverse().find((e) => e.role === "user");
|
|
4612
4630
|
return {
|
|
4613
|
-
userQuestion:
|
|
4631
|
+
userQuestion: Ye(i ?? e) ?? "",
|
|
4614
4632
|
assistantMessage: r
|
|
4615
4633
|
};
|
|
4616
4634
|
}
|
|
4617
|
-
async function
|
|
4635
|
+
async function Gn(e, t) {
|
|
4618
4636
|
await Promise.all([
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
]),
|
|
4623
|
-
e && (
|
|
4637
|
+
kn(e, t),
|
|
4638
|
+
q(e),
|
|
4639
|
+
Hn(t)
|
|
4640
|
+
]), Ze.value || ct((e, t) => E.value.reverseGeocode(e, t, r.value)).then((e) => {
|
|
4641
|
+
e && (Ze.value = e);
|
|
4624
4642
|
});
|
|
4625
4643
|
}
|
|
4626
|
-
async function
|
|
4627
|
-
if (
|
|
4628
|
-
let e =
|
|
4644
|
+
async function Kn() {
|
|
4645
|
+
if (I.value || U.value.some((e) => e.state !== "done")) return;
|
|
4646
|
+
let e = H.value.trim(), t = U.value.filter((e) => e.state === "done" && e.mediaSource !== void 0).map((e) => ({
|
|
4629
4647
|
type: "file",
|
|
4630
4648
|
mediaType: e.mediaSource.mimeType,
|
|
4631
4649
|
url: e.localUrl,
|
|
4632
4650
|
filename: e.mediaSource.name,
|
|
4633
4651
|
providerMetadata: { "8bot": { media: e.mediaSource } }
|
|
4634
4652
|
})), n = Ae.value ? ue.value : void 0;
|
|
4635
|
-
!C.value &&
|
|
4653
|
+
!C.value && Pn() ? e && t.length === 0 && !n && (yn(w.value, [...vn.value, e]), H.value = "") : (C.value && Ut.value.length > 0 && await dr(), qn(e, t, n && { pagePointer: n }), H.value = "", ue.value = void 0, ur());
|
|
4636
4654
|
}
|
|
4637
|
-
function
|
|
4655
|
+
function J(e, t) {
|
|
4638
4656
|
let n = e.trim();
|
|
4639
|
-
return !n ||
|
|
4657
|
+
return !n || Le.value || I.value || Pn() || F.value.status !== "ready" ? !1 : (qn(n, [], t, { toInput: !1 }), !0);
|
|
4640
4658
|
}
|
|
4641
|
-
function
|
|
4642
|
-
|
|
4643
|
-
|
|
4659
|
+
function qn(e, t = [], n, { toInput: r = !0 } = {}) {
|
|
4660
|
+
if (I.value) return;
|
|
4661
|
+
Et(), W.value = e, mn.value = r, hn.value = r && n && "pagePointer" in n ? n.pagePointer : void 0, gn.value = F.value.messages.length;
|
|
4662
|
+
let i = F.value.sendMessage;
|
|
4644
4663
|
i({
|
|
4645
4664
|
text: e,
|
|
4646
4665
|
files: t.length > 0 ? t : void 0,
|
|
4647
4666
|
...n && { metadata: n }
|
|
4648
4667
|
});
|
|
4649
4668
|
}
|
|
4650
|
-
function
|
|
4669
|
+
function Jn(e) {
|
|
4651
4670
|
let t = e.trim();
|
|
4652
|
-
if (!t) return;
|
|
4653
|
-
if (
|
|
4654
|
-
|
|
4671
|
+
if (!t || I.value) return;
|
|
4672
|
+
if (F.value.status !== "ready") {
|
|
4673
|
+
Xe.warn("[useChatbotStore] sendMessage called before chat is ready. Listen for the \"ready\" event on the widget element.");
|
|
4655
4674
|
return;
|
|
4656
4675
|
}
|
|
4657
|
-
let n =
|
|
4658
|
-
|
|
4676
|
+
let n = F.value.sendMessage;
|
|
4677
|
+
Et(), n({ text: t });
|
|
4659
4678
|
}
|
|
4660
|
-
async function
|
|
4661
|
-
let e =
|
|
4662
|
-
|
|
4679
|
+
async function Yn() {
|
|
4680
|
+
let e = F.value.messages.slice(gn.value).some((e) => e.parts.some(qe)), t = W.value, n = mn.value, r = hn.value, i = t.length > 0 && !e, a = w.value, s = gn.value, c = M?.chatId === a, l = At, u = bn(a), d = (e = "") => {
|
|
4681
|
+
H.value = [
|
|
4663
4682
|
e,
|
|
4664
4683
|
u,
|
|
4665
|
-
|
|
4666
|
-
].filter(Boolean).join(
|
|
4667
|
-
}, f = () => a === w.value && !
|
|
4668
|
-
M = void 0,
|
|
4684
|
+
H.value
|
|
4685
|
+
].filter(Boolean).join(Ba);
|
|
4686
|
+
}, f = () => a === w.value && !Nn() && gn.value === s ? !1 : (u && yn(a, [u, ..._n.value[a] ?? []]), !0);
|
|
4687
|
+
M = void 0, kt.value = void 0, Et(), await F.value.stop();
|
|
4669
4688
|
let p = C.value || e && !c || await E.value.stopChatTurn(o.value, a, l).catch(() => !0);
|
|
4670
4689
|
if (!f()) {
|
|
4671
4690
|
if (c || !p) {
|
|
4672
|
-
if (await
|
|
4673
|
-
if (c ||
|
|
4674
|
-
|
|
4691
|
+
if (await Bn(), f()) return;
|
|
4692
|
+
if (c || F.value.messages.length > gn.value) {
|
|
4693
|
+
W.value = "", d();
|
|
4675
4694
|
return;
|
|
4676
4695
|
}
|
|
4677
4696
|
}
|
|
4678
|
-
i ? (d(n ? t : ""), ue.value ??= r,
|
|
4697
|
+
i ? (d(n ? t : ""), ue.value ??= r, F.value.messages = F.value.messages.slice(0, gn.value), W.value = "") : d();
|
|
4679
4698
|
}
|
|
4680
4699
|
}
|
|
4681
|
-
k(() =>
|
|
4700
|
+
k(() => F.value.messages, (e) => {
|
|
4682
4701
|
let t = A.value?.toolCallId;
|
|
4683
|
-
t && !
|
|
4684
|
-
}), k(() =>
|
|
4685
|
-
e === "submitted" && (ge.value++,
|
|
4702
|
+
t && !vt.has(t) && !e.some((e) => e.parts.some((e) => e.toolCallId === t)) && Et();
|
|
4703
|
+
}), k(() => F.value.status, (e) => {
|
|
4704
|
+
e === "submitted" && (ge.value++, At = void 0);
|
|
4686
4705
|
});
|
|
4687
|
-
let
|
|
4706
|
+
let Xn;
|
|
4688
4707
|
k(() => [
|
|
4689
|
-
|
|
4708
|
+
F.value.status,
|
|
4690
4709
|
re.value,
|
|
4691
4710
|
ie.value
|
|
4692
4711
|
], ([e, t, n]) => {
|
|
4693
|
-
clearTimeout(
|
|
4712
|
+
clearTimeout(Xn), e === "ready" && t === 0 && n === 0 && (Xn = setTimeout(() => {
|
|
4694
4713
|
he.value = !1;
|
|
4695
4714
|
}, 1500));
|
|
4696
4715
|
});
|
|
4697
|
-
let
|
|
4698
|
-
k(() => !A.value && !
|
|
4699
|
-
clearTimeout(
|
|
4700
|
-
|
|
4716
|
+
let Zn = D(!1), Qn;
|
|
4717
|
+
k(() => !A.value && !Da(zt()) && (Nn() || re.value > 0), (e) => {
|
|
4718
|
+
clearTimeout(Qn), e ? Zn.value = !0 : Qn = setTimeout(() => {
|
|
4719
|
+
Zn.value = !1;
|
|
4701
4720
|
}, 400);
|
|
4702
4721
|
}, { immediate: !0 });
|
|
4703
|
-
let
|
|
4704
|
-
let e =
|
|
4705
|
-
return
|
|
4706
|
-
}),
|
|
4707
|
-
function
|
|
4708
|
-
clearTimeout(
|
|
4709
|
-
|
|
4710
|
-
},
|
|
4722
|
+
let $n = T(() => {
|
|
4723
|
+
let e = jt.value.filter((e) => e !== w.value);
|
|
4724
|
+
return Zn.value || kt.value === w.value ? [...e, w.value] : e;
|
|
4725
|
+
}), er = () => [.../* @__PURE__ */ new Set([...jt.value, ...N.value])], tr = at(), nr, rr = 0, ir = 0;
|
|
4726
|
+
function ar() {
|
|
4727
|
+
clearTimeout(nr), nr = void 0, er().length !== 0 && tr.value === "visible" && (nr = setTimeout(() => {
|
|
4728
|
+
nr = void 0, or(er());
|
|
4729
|
+
}, Pa));
|
|
4711
4730
|
}
|
|
4712
|
-
async function
|
|
4713
|
-
let t = e.slice(0,
|
|
4731
|
+
async function or(e) {
|
|
4732
|
+
let t = e.slice(0, Fa);
|
|
4714
4733
|
if (C.value || t.length === 0) {
|
|
4715
|
-
|
|
4734
|
+
ar();
|
|
4716
4735
|
return;
|
|
4717
4736
|
}
|
|
4718
|
-
let n =
|
|
4737
|
+
let n = rr += 1, r;
|
|
4719
4738
|
try {
|
|
4720
4739
|
r = await E.value.getRunningTurns(o.value, t);
|
|
4721
4740
|
} catch {
|
|
4722
|
-
|
|
4741
|
+
ar();
|
|
4723
4742
|
return;
|
|
4724
4743
|
}
|
|
4725
|
-
if (n <=
|
|
4726
|
-
|
|
4727
|
-
for (let e of r)
|
|
4728
|
-
let i = new Set(t), a =
|
|
4729
|
-
|
|
4744
|
+
if (n <= ir) return;
|
|
4745
|
+
ir = n;
|
|
4746
|
+
for (let e of r) Pt.add(e);
|
|
4747
|
+
let i = new Set(t), a = er().filter((e) => i.has(e) && !r.includes(e)), s = (e) => N.value.includes(e) && !Pt.has(e), c = a.filter((e) => s(e) && Date.now() - (Nt.get(e) ?? 0) > Ia), l = a.filter((e) => !s(e));
|
|
4748
|
+
jt.value = [...jt.value.filter((e) => !i.has(e)), ...r];
|
|
4730
4749
|
let u = l.filter((e) => N.value.includes(e));
|
|
4731
|
-
(u.length > 0 || c.length > 0) && (N.value = N.value.filter((e) => !u.includes(e) && !c.includes(e)), P.value = [...P.value, ...u.filter((e) => e !== w.value && !P.value.includes(e))]), l.length > 0 &&
|
|
4750
|
+
(u.length > 0 || c.length > 0) && (N.value = N.value.filter((e) => !u.includes(e) && !c.includes(e)), P.value = [...P.value, ...u.filter((e) => e !== w.value && !P.value.includes(e))]), l.length > 0 && q(o.value), ar();
|
|
4732
4751
|
}
|
|
4733
|
-
k(
|
|
4734
|
-
e === "visible" ?
|
|
4735
|
-
}),
|
|
4736
|
-
let
|
|
4752
|
+
k(tr, (e) => {
|
|
4753
|
+
e === "visible" ? or(er()) : (clearTimeout(nr), nr = void 0);
|
|
4754
|
+
}), $e(() => clearTimeout(nr));
|
|
4755
|
+
let sr = T(() => P.value.map((e) => ({
|
|
4737
4756
|
chatId: e,
|
|
4738
|
-
title:
|
|
4757
|
+
title: R.value.find((t) => t.id === e)?.title || Mt.value[e] || void 0
|
|
4739
4758
|
})));
|
|
4740
|
-
function
|
|
4741
|
-
|
|
4759
|
+
function cr(e) {
|
|
4760
|
+
Lt(e), w.value = e, Ir("chat");
|
|
4742
4761
|
}
|
|
4743
|
-
function
|
|
4744
|
-
P.value = P.value.filter((t) => t !== e),
|
|
4762
|
+
function lr(e) {
|
|
4763
|
+
P.value = P.value.filter((t) => t !== e), It(e);
|
|
4745
4764
|
}
|
|
4746
|
-
k(() => [
|
|
4765
|
+
k(() => [F.value.status, F.value.id], ([e, t], [n, r]) => {
|
|
4747
4766
|
if (t === r) {
|
|
4748
|
-
if (e === "error") M?.chatId !== w.value &&
|
|
4767
|
+
if (e === "error") M?.chatId !== w.value && xn(bn(w.value));
|
|
4749
4768
|
else if (e === "ready" && (n === "streaming" || n === "submitted")) {
|
|
4750
|
-
if (
|
|
4751
|
-
|
|
4769
|
+
if (Fn()) {
|
|
4770
|
+
xn(bn(w.value));
|
|
4752
4771
|
return;
|
|
4753
4772
|
}
|
|
4754
|
-
|
|
4773
|
+
Ln();
|
|
4755
4774
|
}
|
|
4756
4775
|
}
|
|
4757
4776
|
}), k(re, (e) => {
|
|
4758
|
-
e === 0 &&
|
|
4759
|
-
}), k(() =>
|
|
4760
|
-
e === "ready" &&
|
|
4777
|
+
e === 0 && F.value.status === "ready" && Ln();
|
|
4778
|
+
}), k(() => F.value.status, (e) => {
|
|
4779
|
+
e === "ready" && W.value.length > 0 && (W.value = "");
|
|
4761
4780
|
});
|
|
4762
|
-
function
|
|
4763
|
-
for (let t of
|
|
4764
|
-
|
|
4781
|
+
function ur(e = !1) {
|
|
4782
|
+
for (let t of U.value) (e || t.state !== "done") && URL.revokeObjectURL(t.localUrl);
|
|
4783
|
+
U.value = [], yr.value = null;
|
|
4765
4784
|
}
|
|
4766
|
-
async function
|
|
4767
|
-
|
|
4785
|
+
async function dr(e) {
|
|
4786
|
+
let t = typeof e?.projectId == "string" ? e.projectId : void 0;
|
|
4787
|
+
return W.value = "", pe.value = {}, me.value = {}, w.value = Qt(), qt(w.value, { projectId: t }), await Qe(), F.value.clearError(), Pe.value = void 0, Le.value = !1, ur(!0), Ir("chat"), w.value;
|
|
4768
4788
|
}
|
|
4769
|
-
async function
|
|
4770
|
-
I.value.status !== "ready" && (
|
|
4789
|
+
async function fr(e) {
|
|
4790
|
+
I.value || (F.value.status !== "ready" && (W.value = "", await Yn()), Et(), await F.value.regenerate(e));
|
|
4771
4791
|
}
|
|
4772
|
-
function
|
|
4773
|
-
if (
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4792
|
+
function Y(e) {
|
|
4793
|
+
if (!I.value) {
|
|
4794
|
+
if (e.tool === "requestGeolocation") {
|
|
4795
|
+
let t = e.output;
|
|
4796
|
+
"latitude" in t && (Ze.value = {
|
|
4797
|
+
geolocationLatitude: t.latitude,
|
|
4798
|
+
geolocationLongitude: t.longitude,
|
|
4799
|
+
geolocationAccuracy: t.accuracy,
|
|
4800
|
+
geolocationCity: t.city
|
|
4801
|
+
});
|
|
4802
|
+
}
|
|
4803
|
+
F.value.addToolOutput(e);
|
|
4781
4804
|
}
|
|
4782
|
-
I.value.addToolOutput(e);
|
|
4783
4805
|
}
|
|
4784
|
-
function
|
|
4785
|
-
I.value.addToolApprovalResponse(e);
|
|
4806
|
+
function pr(e) {
|
|
4807
|
+
I.value || F.value.addToolApprovalResponse(e);
|
|
4786
4808
|
}
|
|
4787
|
-
let
|
|
4788
|
-
|
|
4809
|
+
let mr = T(() => F.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), hr = T(() => _.value?.maxFilesPerMessage ?? 5), gr = T(() => _.value?.maxFilesPerChat ?? 20), _r = T(() => Math.max(0, Math.min(hr.value - U.value.length, gr.value - mr.value - U.value.length))), vr = T(() => _r.value <= 0), yr = D(null), br = () => {
|
|
4810
|
+
yr.value = null;
|
|
4789
4811
|
};
|
|
4790
|
-
k(
|
|
4791
|
-
e || (
|
|
4812
|
+
k(vr, (e) => {
|
|
4813
|
+
e || (yr.value = null);
|
|
4792
4814
|
});
|
|
4793
|
-
async function
|
|
4794
|
-
if (
|
|
4795
|
-
|
|
4815
|
+
async function xr(e) {
|
|
4816
|
+
if (I.value) return;
|
|
4817
|
+
if (vr.value) {
|
|
4818
|
+
yr.value = gr.value - mr.value - U.value.length <= hr.value - U.value.length ? {
|
|
4796
4819
|
reason: "per-chat",
|
|
4797
|
-
max:
|
|
4820
|
+
max: gr.value
|
|
4798
4821
|
} : {
|
|
4799
4822
|
reason: "per-message",
|
|
4800
|
-
max:
|
|
4823
|
+
max: hr.value
|
|
4801
4824
|
};
|
|
4802
4825
|
return;
|
|
4803
4826
|
}
|
|
4804
|
-
let t =
|
|
4805
|
-
|
|
4827
|
+
let t = wr(e);
|
|
4828
|
+
U.value = [...U.value, t], await Tr(t);
|
|
4806
4829
|
}
|
|
4807
|
-
async function
|
|
4808
|
-
let n =
|
|
4830
|
+
async function Sr(e, t) {
|
|
4831
|
+
let n = U.value.find((t) => t.id === e.id);
|
|
4809
4832
|
if (!n) return;
|
|
4810
4833
|
URL.revokeObjectURL(n.localUrl);
|
|
4811
|
-
let r =
|
|
4812
|
-
|
|
4834
|
+
let r = wr(t);
|
|
4835
|
+
U.value = U.value.map((e) => e.id === n.id ? r : e), await Promise.all([Er(n), Tr(r)]);
|
|
4813
4836
|
}
|
|
4814
|
-
async function
|
|
4815
|
-
let t =
|
|
4816
|
-
t && (
|
|
4837
|
+
async function Cr(e) {
|
|
4838
|
+
let t = U.value.find((t) => t.id === e.id && t.state === "error");
|
|
4839
|
+
t && (U.value = U.value.map((e) => e.id === t.id ? {
|
|
4817
4840
|
...e,
|
|
4818
4841
|
state: "uploading",
|
|
4819
4842
|
error: void 0
|
|
4820
|
-
} : e), await
|
|
4843
|
+
} : e), await Tr(t));
|
|
4821
4844
|
}
|
|
4822
|
-
function
|
|
4845
|
+
function wr(e) {
|
|
4823
4846
|
return {
|
|
4824
|
-
id:
|
|
4847
|
+
id: Qt(),
|
|
4825
4848
|
file: e,
|
|
4826
4849
|
localUrl: URL.createObjectURL(e),
|
|
4827
4850
|
state: "uploading"
|
|
4828
4851
|
};
|
|
4829
4852
|
}
|
|
4830
|
-
async function
|
|
4853
|
+
async function Tr({ id: e, file: t }) {
|
|
4831
4854
|
try {
|
|
4832
4855
|
let n = await E.value.uploadMedia(o.value, w.value, t);
|
|
4833
|
-
if (!
|
|
4834
|
-
await
|
|
4856
|
+
if (!U.value.some((t) => t.id === e)) {
|
|
4857
|
+
await Dr(n);
|
|
4835
4858
|
return;
|
|
4836
4859
|
}
|
|
4837
|
-
|
|
4860
|
+
U.value = U.value.map((t) => t.id === e ? {
|
|
4838
4861
|
...t,
|
|
4839
4862
|
state: "done",
|
|
4840
4863
|
mediaSource: n
|
|
4841
4864
|
} : t);
|
|
4842
4865
|
} catch (t) {
|
|
4843
4866
|
let n = t instanceof Error ? t.message : "Upload failed";
|
|
4844
|
-
|
|
4867
|
+
U.value = U.value.map((t) => t.id === e ? {
|
|
4845
4868
|
...t,
|
|
4846
4869
|
state: "error",
|
|
4847
4870
|
error: n
|
|
4848
4871
|
} : t);
|
|
4849
4872
|
}
|
|
4850
4873
|
}
|
|
4851
|
-
async function
|
|
4852
|
-
e.mediaSource && await
|
|
4874
|
+
async function Er(e) {
|
|
4875
|
+
e.mediaSource && await Dr(e.mediaSource);
|
|
4853
4876
|
}
|
|
4854
|
-
async function
|
|
4877
|
+
async function Dr(e) {
|
|
4855
4878
|
try {
|
|
4856
4879
|
await E.value.discardMedia(e);
|
|
4857
4880
|
} catch {}
|
|
4858
4881
|
}
|
|
4859
|
-
async function
|
|
4860
|
-
let { userQuestion: n, assistantMessage: r } =
|
|
4861
|
-
|
|
4882
|
+
async function Or(e, t) {
|
|
4883
|
+
let { userQuestion: n, assistantMessage: r } = Wn(e);
|
|
4884
|
+
Un(await E.value.submitMessageFeedback({
|
|
4862
4885
|
messageId: e.id,
|
|
4863
4886
|
chatId: w.value,
|
|
4864
4887
|
agentId: o.value,
|
|
@@ -4867,73 +4890,76 @@ function Ua(e) {
|
|
|
4867
4890
|
assistantMessage: r
|
|
4868
4891
|
}));
|
|
4869
4892
|
}
|
|
4870
|
-
async function
|
|
4871
|
-
await
|
|
4893
|
+
async function kr(e) {
|
|
4894
|
+
await Or(e, "upvote");
|
|
4872
4895
|
}
|
|
4873
|
-
async function
|
|
4874
|
-
await
|
|
4896
|
+
async function Ar(e) {
|
|
4897
|
+
await Or(e, "downvote");
|
|
4875
4898
|
}
|
|
4876
|
-
function
|
|
4877
|
-
|
|
4899
|
+
function jr(e) {
|
|
4900
|
+
ln.value = !1, un.value = void 0, V.value = e;
|
|
4878
4901
|
}
|
|
4879
|
-
async function
|
|
4880
|
-
if (
|
|
4881
|
-
|
|
4882
|
-
let { userQuestion: t, assistantMessage: n } =
|
|
4883
|
-
|
|
4884
|
-
messageId:
|
|
4902
|
+
async function Mr(e) {
|
|
4903
|
+
if (V.value) try {
|
|
4904
|
+
cn.value = !0, ln.value = !1, un.value = void 0;
|
|
4905
|
+
let { userQuestion: t, assistantMessage: n } = Wn(V.value);
|
|
4906
|
+
Un(await E.value.submitMessageFeedback({
|
|
4907
|
+
messageId: V.value.id,
|
|
4885
4908
|
chatId: w.value,
|
|
4886
4909
|
agentId: o.value,
|
|
4887
4910
|
userQuestion: t,
|
|
4888
4911
|
assistantMessage: n,
|
|
4889
4912
|
comment: e
|
|
4890
|
-
})),
|
|
4913
|
+
})), ln.value = !0, await Hn(w.value);
|
|
4891
4914
|
} catch {
|
|
4892
|
-
|
|
4915
|
+
un.value = n("message.feedbackSubmitError") ? t("message.feedbackSubmitError") : "Failed to submit feedback";
|
|
4893
4916
|
} finally {
|
|
4894
|
-
|
|
4917
|
+
cn.value = !1;
|
|
4895
4918
|
}
|
|
4896
4919
|
}
|
|
4897
|
-
async function
|
|
4920
|
+
async function Nr(e) {
|
|
4898
4921
|
try {
|
|
4899
|
-
|
|
4922
|
+
fn.value = !0, dn.value = !1, pn.value = void 0, await E.value.submitLead({
|
|
4900
4923
|
agentId: o.value,
|
|
4901
4924
|
chatId: w.value,
|
|
4902
4925
|
...e
|
|
4903
|
-
}),
|
|
4926
|
+
}), dn.value = !0;
|
|
4904
4927
|
} catch {
|
|
4905
|
-
|
|
4928
|
+
pn.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
|
|
4906
4929
|
} finally {
|
|
4907
|
-
|
|
4930
|
+
fn.value = !1;
|
|
4908
4931
|
}
|
|
4909
4932
|
}
|
|
4910
|
-
async function
|
|
4933
|
+
async function Pr(e, t) {
|
|
4911
4934
|
let n = await E.value.updateChatTitle(o.value, e, t);
|
|
4912
|
-
|
|
4935
|
+
R.value = R.value.map((t) => t.id === e ? {
|
|
4913
4936
|
...t,
|
|
4914
4937
|
title: n.title
|
|
4915
4938
|
} : t);
|
|
4916
4939
|
}
|
|
4917
|
-
async function
|
|
4918
|
-
await E.value.deleteChat(o.value, e),
|
|
4940
|
+
async function Fr(e) {
|
|
4941
|
+
await E.value.deleteChat(o.value, e), R.value = R.value.filter((t) => t.id !== e), w.value === e && await dr();
|
|
4919
4942
|
}
|
|
4920
|
-
function
|
|
4921
|
-
|
|
4943
|
+
function Ir(e) {
|
|
4944
|
+
an.value = e;
|
|
4922
4945
|
}
|
|
4923
|
-
function
|
|
4924
|
-
|
|
4946
|
+
function Lr() {
|
|
4947
|
+
Ir("chat"), on.value++;
|
|
4925
4948
|
}
|
|
4926
|
-
let
|
|
4927
|
-
function
|
|
4928
|
-
let t = () => E.value.getChat(o.value, e)
|
|
4929
|
-
return t().catch(() => t().catch(() =>
|
|
4949
|
+
let Rr;
|
|
4950
|
+
function zr(e) {
|
|
4951
|
+
let t = () => E.value.getChat(o.value, e);
|
|
4952
|
+
return t().catch(() => t().catch(() => null));
|
|
4930
4953
|
}
|
|
4931
4954
|
return k(l, async (e) => {
|
|
4932
|
-
if (!e || e ===
|
|
4933
|
-
let t =
|
|
4934
|
-
if (
|
|
4935
|
-
let n = w.value, r =
|
|
4936
|
-
l.value === e && w.value === n && (r ?
|
|
4955
|
+
if (!e || e === Rr) return;
|
|
4956
|
+
let t = Rr;
|
|
4957
|
+
if (Rr = e, t === void 0) return;
|
|
4958
|
+
let n = w.value, r = C.value ? null : await zr(n);
|
|
4959
|
+
l.value === e && w.value === n && (r ? (qt(n, {
|
|
4960
|
+
authorId: r.userId,
|
|
4961
|
+
projectId: r.projectId
|
|
4962
|
+
}), q(o.value)) : (R.value = [], sn.value = [], z.value = [], jt.value = [], N.value = [], P.value = [], Mt.value = {}, await dr(), H.value = ""));
|
|
4937
4963
|
}), {
|
|
4938
4964
|
apiClient: E,
|
|
4939
4965
|
baseUrl: i,
|
|
@@ -4965,20 +4991,20 @@ function Ua(e) {
|
|
|
4965
4991
|
hostStepTitles: pe,
|
|
4966
4992
|
hostStepChanges: me,
|
|
4967
4993
|
pageControlActive: he,
|
|
4968
|
-
isWorking:
|
|
4969
|
-
stopHostActions:
|
|
4970
|
-
voicePageTools:
|
|
4971
|
-
cancelVoicePageCalls:
|
|
4994
|
+
isWorking: Zn,
|
|
4995
|
+
stopHostActions: Tt,
|
|
4996
|
+
voicePageTools: Ct,
|
|
4997
|
+
cancelVoicePageCalls: wt,
|
|
4972
4998
|
pageNoticeLevel: Me,
|
|
4973
4999
|
closePageNotice: Ne,
|
|
4974
5000
|
hostConfirmation: A,
|
|
4975
|
-
respondHostConfirmation:
|
|
5001
|
+
respondHostConfirmation: mt,
|
|
4976
5002
|
pageAccessAvailable: Te,
|
|
4977
5003
|
pageAccessOff: Se,
|
|
4978
|
-
setPageAccessOff:
|
|
5004
|
+
setPageAccessOff: Dt,
|
|
4979
5005
|
agentConfirmations: oe,
|
|
4980
5006
|
agentSelectionActions: x,
|
|
4981
|
-
sendSelection:
|
|
5007
|
+
sendSelection: J,
|
|
4982
5008
|
confirmationsAvailable: De,
|
|
4983
5009
|
confirmationMode: Oe,
|
|
4984
5010
|
setConfirmationMode: ke,
|
|
@@ -4989,76 +5015,81 @@ function Ua(e) {
|
|
|
4989
5015
|
systemTheme: _e,
|
|
4990
5016
|
hideWelcomeMessage: ve,
|
|
4991
5017
|
isDark: S,
|
|
4992
|
-
chat:
|
|
4993
|
-
messages:
|
|
4994
|
-
conversations:
|
|
4995
|
-
isLoadingConversations:
|
|
4996
|
-
hasMoreConversations:
|
|
4997
|
-
isLoadingMoreConversations:
|
|
4998
|
-
chatFiles:
|
|
4999
|
-
isLoadingChatFiles:
|
|
5000
|
-
input:
|
|
5001
|
-
pendingAttachments:
|
|
5002
|
-
isAttachmentLimitReached:
|
|
5003
|
-
fileLimitError:
|
|
5018
|
+
chat: F,
|
|
5019
|
+
messages: Ut,
|
|
5020
|
+
conversations: R,
|
|
5021
|
+
isLoadingConversations: $t,
|
|
5022
|
+
hasMoreConversations: tn,
|
|
5023
|
+
isLoadingMoreConversations: nn,
|
|
5024
|
+
chatFiles: z,
|
|
5025
|
+
isLoadingChatFiles: B,
|
|
5026
|
+
input: H,
|
|
5027
|
+
pendingAttachments: U,
|
|
5028
|
+
isAttachmentLimitReached: vr,
|
|
5029
|
+
fileLimitError: yr,
|
|
5004
5030
|
localChatId: w,
|
|
5005
|
-
isConversationBlocked:
|
|
5006
|
-
inputMessagePlaceholder:
|
|
5031
|
+
isConversationBlocked: Le,
|
|
5032
|
+
inputMessagePlaceholder: Wt,
|
|
5007
5033
|
chatError: Pe,
|
|
5008
|
-
runningChatIds:
|
|
5009
|
-
backgroundAnswers:
|
|
5010
|
-
openBackgroundAnswer:
|
|
5011
|
-
dismissBackgroundAnswer:
|
|
5012
|
-
canQueue:
|
|
5013
|
-
queuedMessages:
|
|
5014
|
-
removeQueuedMessage:
|
|
5015
|
-
editQueuedMessage:
|
|
5016
|
-
activeView:
|
|
5017
|
-
inputFocusRequest:
|
|
5018
|
-
messageFeedbacks:
|
|
5019
|
-
feedbackDialogMessage:
|
|
5020
|
-
isFeedbackSubmitting:
|
|
5021
|
-
isFeedbackSubmitted:
|
|
5022
|
-
feedbackSubmitError:
|
|
5023
|
-
isLeadSubmitted:
|
|
5024
|
-
isLoadingSubmitLead:
|
|
5025
|
-
submitLeadError:
|
|
5026
|
-
buildDeviceContext:
|
|
5027
|
-
initialize:
|
|
5028
|
-
loadConversations:
|
|
5029
|
-
loadMoreConversations:
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5034
|
+
runningChatIds: $n,
|
|
5035
|
+
backgroundAnswers: sr,
|
|
5036
|
+
openBackgroundAnswer: cr,
|
|
5037
|
+
dismissBackgroundAnswer: lr,
|
|
5038
|
+
canQueue: G,
|
|
5039
|
+
queuedMessages: vn,
|
|
5040
|
+
removeQueuedMessage: Sn,
|
|
5041
|
+
editQueuedMessage: K,
|
|
5042
|
+
activeView: an,
|
|
5043
|
+
inputFocusRequest: on,
|
|
5044
|
+
messageFeedbacks: sn,
|
|
5045
|
+
feedbackDialogMessage: V,
|
|
5046
|
+
isFeedbackSubmitting: cn,
|
|
5047
|
+
isFeedbackSubmitted: ln,
|
|
5048
|
+
feedbackSubmitError: un,
|
|
5049
|
+
isLeadSubmitted: dn,
|
|
5050
|
+
isLoadingSubmitLead: fn,
|
|
5051
|
+
submitLeadError: pn,
|
|
5052
|
+
buildDeviceContext: tt,
|
|
5053
|
+
initialize: Gn,
|
|
5054
|
+
loadConversations: q,
|
|
5055
|
+
loadMoreConversations: Cn,
|
|
5056
|
+
projectsEnabled: Gt,
|
|
5057
|
+
chatAuthorId: Yt,
|
|
5058
|
+
chatProjectId: Xt,
|
|
5059
|
+
isReadOnlyChat: I,
|
|
5060
|
+
describeChat: qt,
|
|
5061
|
+
searchConversations: wn,
|
|
5062
|
+
loadChatFiles: Tn,
|
|
5063
|
+
refreshMessages: Bn,
|
|
5064
|
+
appendMessage: Vn,
|
|
5065
|
+
getChatFileUrl: En,
|
|
5066
|
+
getChatFilePreviewUrl: Dn,
|
|
5067
|
+
deleteChatFile: On,
|
|
5068
|
+
handleSubmit: Kn,
|
|
5069
|
+
sendMessage: Jn,
|
|
5070
|
+
stopGeneration: Yn,
|
|
5071
|
+
startNewChat: dr,
|
|
5072
|
+
regenerate: fr,
|
|
5073
|
+
addToolOutput: Y,
|
|
5074
|
+
addToolApprovalResponse: pr,
|
|
5075
|
+
handleFileSelect: xr,
|
|
5076
|
+
discardPendingAttachment: Er,
|
|
5077
|
+
replacePendingAttachment: Sr,
|
|
5078
|
+
retryPendingAttachment: Cr,
|
|
5079
|
+
clearFileLimitError: br,
|
|
5080
|
+
clearPendingAttachments: ur,
|
|
5081
|
+
onUpvote: kr,
|
|
5082
|
+
onDownvote: Ar,
|
|
5083
|
+
onFeedback: jr,
|
|
5084
|
+
onFeedbackSubmit: Mr,
|
|
5085
|
+
onLeadSubmit: Nr,
|
|
5086
|
+
navigate: Ir,
|
|
5087
|
+
focusInput: Lr,
|
|
5088
|
+
renameChatTitle: Pr,
|
|
5089
|
+
deleteChat: Fr
|
|
5059
5090
|
};
|
|
5060
5091
|
})();
|
|
5061
5092
|
}
|
|
5062
|
-
export {
|
|
5093
|
+
export { Qt as a, qi as i, Wa as n, wa as r, Ta as t };
|
|
5063
5094
|
|
|
5064
|
-
//# sourceMappingURL=useChatbotStore-
|
|
5095
|
+
//# sourceMappingURL=useChatbotStore-ChrZVIDt.js.map
|