@8wave/ai-elements 0.121.0-beta.41 → 0.121.0-beta.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{PkChatbotFilePreview-CpFXWpU7.js → PkChatbotFilePreview-DxpEIFOG.js} +2 -2
- package/dist/_chunks/{PkChatbotFilePreview-CpFXWpU7.js.map → PkChatbotFilePreview-DxpEIFOG.js.map} +1 -1
- package/dist/_chunks/{PkHeldImage-DvHKY7Vh.js → PkHeldImage-CztNY8OZ.js} +2 -2
- package/dist/_chunks/{PkHeldImage-DvHKY7Vh.js.map → PkHeldImage-CztNY8OZ.js.map} +1 -1
- package/dist/_chunks/{PkLazyImg-BBFsS16D.js → PkLazyImg-BqbuNQgf.js} +2 -2
- package/dist/_chunks/{PkLazyImg-BBFsS16D.js.map → PkLazyImg-BqbuNQgf.js.map} +1 -1
- package/dist/_chunks/{PkStreamingMarkdown-D2aqCD0I.js → PkStreamingMarkdown-BlTH2AJX.js} +2 -2
- package/dist/_chunks/{PkStreamingMarkdown-D2aqCD0I.js.map → PkStreamingMarkdown-BlTH2AJX.js.map} +1 -1
- package/dist/_chunks/{PkToolEditSpreadsheet-83ZdmGeA.js → PkToolEditSpreadsheet-CDxglslA.js} +2 -2
- package/dist/_chunks/{PkToolEditSpreadsheet-83ZdmGeA.js.map → PkToolEditSpreadsheet-CDxglslA.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestGeolocation-1cOmCG8P.js → PkToolRequestGeolocation-CxMAoAv6.js} +2 -2
- package/dist/_chunks/{PkToolRequestGeolocation-1cOmCG8P.js.map → PkToolRequestGeolocation-CxMAoAv6.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestOAuthConnection-CCu3FCyo.js → PkToolRequestOAuthConnection-DU1Y2odZ.js} +3 -3
- package/dist/_chunks/{PkToolRequestOAuthConnection-CCu3FCyo.js.map → PkToolRequestOAuthConnection-DU1Y2odZ.js.map} +1 -1
- package/dist/_chunks/{PkToolShareDocument-BhT59J9o.js → PkToolShareDocument-YrPrexhS.js} +5 -5
- package/dist/_chunks/{PkToolShareDocument-BhT59J9o.js.map → PkToolShareDocument-YrPrexhS.js.map} +1 -1
- package/dist/_chunks/{PkToolShowArtifact-CiYkZkpe.js → PkToolShowArtifact-jQeIv65U.js} +4 -4
- package/dist/_chunks/{PkToolShowArtifact-CiYkZkpe.js.map → PkToolShowArtifact-jQeIv65U.js.map} +1 -1
- package/dist/_chunks/{PkToolShowCalendarEvent-Dzh4JURs.js → PkToolShowCalendarEvent-CAN5-qnM.js} +4 -4
- package/dist/_chunks/{PkToolShowCalendarEvent-Dzh4JURs.js.map → PkToolShowCalendarEvent-CAN5-qnM.js.map} +1 -1
- package/dist/_chunks/{PkToolShowComparison-CFHrXnaB.js → PkToolShowComparison-DGxHYpl3.js} +4 -4
- package/dist/_chunks/{PkToolShowComparison-CFHrXnaB.js.map → PkToolShowComparison-DGxHYpl3.js.map} +1 -1
- package/dist/_chunks/{PkToolShowContactForm-D7TEzrYe.js → PkToolShowContactForm-D7wg3Jlu.js} +5 -5
- package/dist/_chunks/{PkToolShowContactForm-D7TEzrYe.js.map → PkToolShowContactForm-D7wg3Jlu.js.map} +1 -1
- package/dist/_chunks/{PkToolShowDiagram-DGnIuRst.js → PkToolShowDiagram-BBs1rh96.js} +4 -4
- package/dist/_chunks/{PkToolShowDiagram-DGnIuRst.js.map → PkToolShowDiagram-BBs1rh96.js.map} +1 -1
- package/dist/_chunks/{PkToolShowEmail-C3jped-R.js → PkToolShowEmail-CeiSo-zx.js} +4 -4
- package/dist/_chunks/{PkToolShowEmail-C3jped-R.js.map → PkToolShowEmail-CeiSo-zx.js.map} +1 -1
- package/dist/_chunks/{PkToolShowForm-CSh4Q6sl.js → PkToolShowForm-BMVgXxzl.js} +4 -4
- package/dist/_chunks/{PkToolShowForm-CSh4Q6sl.js.map → PkToolShowForm-BMVgXxzl.js.map} +1 -1
- package/dist/_chunks/{PkToolShowImageGallery-CQEaEfYE.js → PkToolShowImageGallery-Ba0CfKt6.js} +3 -3
- package/dist/_chunks/{PkToolShowImageGallery-CQEaEfYE.js.map → PkToolShowImageGallery-Ba0CfKt6.js.map} +1 -1
- package/dist/_chunks/{PkToolShowLocation-gyMiVjhi.js → PkToolShowLocation-Cp95-u2H.js} +4 -4
- package/dist/_chunks/{PkToolShowLocation-gyMiVjhi.js.map → PkToolShowLocation-Cp95-u2H.js.map} +1 -1
- package/dist/_chunks/{PkToolShowMessage-wGPPnOAM.js → PkToolShowMessage-Bn8O_W0D.js} +4 -4
- package/dist/_chunks/{PkToolShowMessage-wGPPnOAM.js.map → PkToolShowMessage-Bn8O_W0D.js.map} +1 -1
- package/dist/_chunks/{PkToolShowProductList-BCmULLct.js → PkToolShowProductList-DbZfUUWe.js} +4 -4
- package/dist/_chunks/{PkToolShowProductList-BCmULLct.js.map → PkToolShowProductList-DbZfUUWe.js.map} +1 -1
- package/dist/_chunks/{PkToolShowQrCode-CeZsvZvb.js → PkToolShowQrCode-D_9_c-Ws.js} +4 -4
- package/dist/_chunks/{PkToolShowQrCode-CeZsvZvb.js.map → PkToolShowQrCode-D_9_c-Ws.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSources-R9KWsfTQ.js → PkToolShowSources-Dkt4IId2.js} +4 -4
- package/dist/_chunks/{PkToolShowSources-R9KWsfTQ.js.map → PkToolShowSources-Dkt4IId2.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSuggestedReply-DYZz9aV2.js → PkToolShowSuggestedReply-BF2sT3B1.js} +2 -2
- package/dist/_chunks/{PkToolShowSuggestedReply-DYZz9aV2.js.map → PkToolShowSuggestedReply-BF2sT3B1.js.map} +1 -1
- package/dist/_chunks/{PkToolShowVideo-C_9SZtZM.js → PkToolShowVideo-l8JoSKCj.js} +3 -3
- package/dist/_chunks/{PkToolShowVideo-C_9SZtZM.js.map → PkToolShowVideo-l8JoSKCj.js.map} +1 -1
- package/dist/_chunks/{PkToolShowWeather-BgS4_SWb.js → PkToolShowWeather-DifqBB7o.js} +2 -2
- package/dist/_chunks/{PkToolShowWeather-BgS4_SWb.js.map → PkToolShowWeather-DifqBB7o.js.map} +1 -1
- package/dist/_chunks/{PkToolShowWebPages-DwRYfle9.js → PkToolShowWebPages-DtcEmrYt.js} +4 -4
- package/dist/_chunks/{PkToolShowWebPages-DwRYfle9.js.map → PkToolShowWebPages-DtcEmrYt.js.map} +1 -1
- package/dist/_chunks/{VvButtonLocalized-B6igS2e0.js → VvButtonLocalized-D7K9ZslZ.js} +2 -2
- package/dist/_chunks/{VvButtonLocalized-B6igS2e0.js.map → VvButtonLocalized-D7K9ZslZ.js.map} +1 -1
- package/dist/_chunks/{VvCheckboxGroup.es-OXhptnPU.js → VvCheckboxGroup.es-BebSMBKU.js} +2 -2
- package/dist/_chunks/{VvCheckboxGroup.es-OXhptnPU.js.map → VvCheckboxGroup.es-BebSMBKU.js.map} +1 -1
- package/dist/_chunks/{VvCombobox.es-SLzX9VnX.js → VvCombobox.es-BfiDcdcw.js} +481 -481
- package/dist/_chunks/{VvCombobox.es-SLzX9VnX.js.map → VvCombobox.es-BfiDcdcw.js.map} +1 -1
- package/dist/_chunks/{VvInputText.es-CETcNKlr.js → VvInputText.es-DllQ2Tue.js} +435 -435
- package/dist/_chunks/{VvInputText.es-CETcNKlr.js.map → VvInputText.es-DllQ2Tue.js.map} +1 -1
- package/dist/_chunks/{VvRadioGroup.es-UBZBB89A.js → VvRadioGroup.es-D6uqf6a1.js} +2 -2
- package/dist/_chunks/{VvRadioGroup.es-UBZBB89A.js.map → VvRadioGroup.es-D6uqf6a1.js.map} +1 -1
- package/dist/_chunks/{VvSelect.es-B_MShGnJ.js → VvSelect.es-BR5Ci5VC.js} +2 -2
- package/dist/_chunks/{VvSelect.es-B_MShGnJ.js.map → VvSelect.es-BR5Ci5VC.js.map} +1 -1
- package/dist/_chunks/{VvTextarea.es-Dm2Yq3WM.js → VvTextarea.es-Bwe5xjXl.js} +29 -29
- package/dist/_chunks/{VvTextarea.es-Dm2Yq3WM.js.map → VvTextarea.es-Bwe5xjXl.js.map} +1 -1
- package/dist/_chunks/{dist-Do_Ac5Yv.js → dist-CB7v_M5z.js} +52 -46
- package/dist/_chunks/dist-CB7v_M5z.js.map +1 -0
- package/dist/_chunks/{index.es-BTDKU45u.js → index.es-CKF2q-ww.js} +26 -26
- package/dist/_chunks/{index.es-BTDKU45u.js.map → index.es-CKF2q-ww.js.map} +1 -1
- package/dist/_chunks/{index.es-BZS9Cscn.js → index.es-CoWhnabo.js} +16 -16
- package/dist/_chunks/{index.es-BZS9Cscn.js.map → index.es-CoWhnabo.js.map} +1 -1
- package/dist/ai-elements.es.js +4171 -3913
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotInput.js +1 -1
- package/dist-vue/PkChatbotQueuedMessages.d.ts +2 -0
- package/dist-vue/PkChatbotQueuedMessages.js +1 -0
- 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-CObEhs2T.js +279 -0
- package/dist-vue/_chunks/PkChatbot-CObEhs2T.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotInput-BJHtmPR-.js → PkChatbotInput-CuEoeb_M.js} +47 -22
- package/dist-vue/_chunks/PkChatbotInput-CuEoeb_M.js.map +1 -0
- package/dist-vue/_chunks/PkChatbotQueuedMessages-DlydYgwC.js +51 -0
- package/dist-vue/_chunks/PkChatbotQueuedMessages-DlydYgwC.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewChat-BI_PtT72.js → PkChatbotViewChat-BZb-U7Ju.js} +246 -224
- package/dist-vue/_chunks/PkChatbotViewChat-BZb-U7Ju.js.map +1 -0
- package/dist-vue/_chunks/PkChatbotViewConversations-CCPRWCKs.js +210 -0
- package/dist-vue/_chunks/PkChatbotViewConversations-CCPRWCKs.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewFiles-Cwm-JQMF.js → PkChatbotViewFiles-BgqksCn0.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewFiles-Cwm-JQMF.js.map → PkChatbotViewFiles-BgqksCn0.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewProfile-C_GElIM3.js → PkChatbotViewProfile-B6tHWrqn.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewProfile-C_GElIM3.js.map → PkChatbotViewProfile-B6tHWrqn.js.map} +1 -1
- package/dist-vue/_chunks/{createChatbotApiClient-DUz4dwzY.js → createChatbotApiClient-hcFAulTq.js} +12 -3
- package/dist-vue/_chunks/createChatbotApiClient-hcFAulTq.js.map +1 -0
- package/dist-vue/_chunks/{useChatbotStore-D7LcpA-6.js → useChatbotStore-Ct7G-voO.js} +953 -800
- package/dist-vue/_chunks/useChatbotStore-Ct7G-voO.js.map +1 -0
- package/dist-vue/api.js +1 -1
- package/dist-vue/composables.js +10 -6
- package/dist-vue/composables.js.map +1 -1
- package/dist-vue/index.js +96 -82
- package/dist-vue/index.js.map +1 -1
- package/dist-vue/locales.js +16 -2
- package/dist-vue/packages/components/src/chat/PkChatSidebarConversationItem.d.ts +2 -0
- package/dist-vue/packages/components/src/chat/PkChatbotInput.d.ts +17 -3
- package/dist-vue/packages/components/src/chat/PkChatbotQueuedMessages.d.ts +22 -0
- package/dist-vue/packages/composable/src/chatbot/api/createChatbotApiClient.d.ts +5 -1
- package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +37 -2
- package/dist-vue/style.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/dist-Do_Ac5Yv.js.map +0 -1
- package/dist-vue/_chunks/PkChatbot-DIqduIwr.js +0 -290
- package/dist-vue/_chunks/PkChatbot-DIqduIwr.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotInput-BJHtmPR-.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotViewChat-BI_PtT72.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotViewConversations-Bg4jSO9a.js +0 -199
- package/dist-vue/_chunks/PkChatbotViewConversations-Bg4jSO9a.js.map +0 -1
- package/dist-vue/_chunks/createChatbotApiClient-DUz4dwzY.js.map +0 -1
- package/dist-vue/_chunks/useChatbotStore-D7LcpA-6.js.map +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { C as e, D as t, O as n, S as r, _ as i, a, g as o, h as s, i as c, l, m as u, o as d, p as f, r as p, s as m, u as h, v as g, w as _, x as v } from "./schemas-Bu1lick6.js";
|
|
2
2
|
import { H as ee, K as y, L as te, V as ne, W as re, X as ie, Y as ae, Z as oe } from "./Agent-DZb775Ak.js";
|
|
3
|
-
import { r as se, t as ce } from "./createChatbotApiClient-
|
|
3
|
+
import { r as se, t as ce } from "./createChatbotApiClient-hcFAulTq.js";
|
|
4
4
|
import { n as le } from "./src-BZRiAJsH.js";
|
|
5
5
|
import { d as ue, r as de } from "./message-DZvfzt9j.js";
|
|
6
6
|
import { n as fe, t as pe } from "./useSafeLocalStorage-C1BlCeKw.js";
|
|
7
|
-
import { computed as b, getCurrentScope as me, isReadonly as he, nextTick as ge, onScopeDispose as _e, reactive as ve, ref as x, shallowRef as
|
|
8
|
-
import { useI18n as
|
|
9
|
-
import { usePreferredDark as
|
|
10
|
-
import { defineStore as
|
|
7
|
+
import { computed as b, getCurrentScope as me, isReadonly as he, nextTick as ge, onScopeDispose as _e, reactive as ve, ref as x, shallowRef as ye, toRefs as be, toValue as xe, watch as S, watchEffect as Se } from "vue";
|
|
8
|
+
import { useI18n as Ce } from "vue-i18n";
|
|
9
|
+
import { useDocumentVisibility as we, usePreferredDark as Te } from "@vueuse/core";
|
|
10
|
+
import { defineStore as Ee } from "pinia";
|
|
11
11
|
//#region ../../packages/utils/src/device-context.ts
|
|
12
|
-
function
|
|
12
|
+
function De() {
|
|
13
13
|
let e = navigator.connection, t = navigator.userAgentData;
|
|
14
14
|
return {
|
|
15
15
|
dateTime: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -39,7 +39,7 @@ function Te() {
|
|
|
39
39
|
historyLength: window.history.length
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
async function
|
|
42
|
+
async function Oe(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;
|
|
@@ -58,16 +58,16 @@ async function Ee(e) {
|
|
|
58
58
|
}
|
|
59
59
|
//#endregion
|
|
60
60
|
//#region ../../packages/composable/src/chatbot/hostTools.ts
|
|
61
|
-
var
|
|
61
|
+
var ke = "agentstudio:page-navigation", Ae = (e) => typeof e?.afterOutput == "function", je = (e) => e.toolMetadata?.source === ae, Me = (e, t) => {
|
|
62
62
|
if (!t || !e?.length) return;
|
|
63
63
|
let n = new Set(t.allowed), r = e.filter((e) => n.has(e.name) && !re(e.name)).map(({ execute: e, confirmation: t, policy: n, ...r }) => r);
|
|
64
64
|
return r.length > 0 ? r : void 0;
|
|
65
65
|
};
|
|
66
|
-
function
|
|
66
|
+
function Ne(e) {
|
|
67
67
|
let t = 0, n = 0, r = (t) => {
|
|
68
68
|
n = t, e.onPendingChange?.(n);
|
|
69
69
|
}, i = Promise.resolve(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), s = (e) => {
|
|
70
|
-
|
|
70
|
+
Ae(e) && e.abandon?.();
|
|
71
71
|
}, c = (e, t) => t.requireConfirmation.includes(e.name) || t.confirmDestructive && e.annotations?.destructiveHint === !0, l = (t, n) => e.addToolOutput({
|
|
72
72
|
tool: t.toolName,
|
|
73
73
|
toolCallId: t.toolCallId,
|
|
@@ -118,7 +118,7 @@ function je(e) {
|
|
|
118
118
|
s(r);
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
121
|
-
if (
|
|
121
|
+
if (Ae(r)) {
|
|
122
122
|
l(n, r.result ?? null);
|
|
123
123
|
let t = !1, a = () => {
|
|
124
124
|
t || (t = !0, o.delete(a), r.abandon?.());
|
|
@@ -152,65 +152,65 @@ function je(e) {
|
|
|
152
152
|
}
|
|
153
153
|
//#endregion
|
|
154
154
|
//#region ../../node_modules/.pnpm/@ai-sdk+provider@4.0.27/node_modules/@ai-sdk/provider/dist/index.js
|
|
155
|
-
var
|
|
155
|
+
var Pe = "vercel.ai.error", Fe = Symbol.for(Pe), C = class e extends Error {
|
|
156
156
|
constructor({ name: e, message: t, cause: n }) {
|
|
157
|
-
super(t), this[
|
|
157
|
+
super(t), this[Fe] = !0, this.name = e, this.cause = n;
|
|
158
158
|
}
|
|
159
159
|
static isInstance(t) {
|
|
160
|
-
return e.hasMarker(t,
|
|
160
|
+
return e.hasMarker(t, Pe);
|
|
161
161
|
}
|
|
162
162
|
static hasMarker(e, t) {
|
|
163
163
|
let n = Symbol.for(t);
|
|
164
164
|
return typeof e == "object" && !!e && n in e && typeof e[n] == "boolean" && e[n] === !0;
|
|
165
165
|
}
|
|
166
|
-
},
|
|
166
|
+
}, Ie = "AI_APICallError", Le = `vercel.ai.error.${Ie}`, Re = Symbol.for(Le), ze = class extends C {
|
|
167
167
|
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 }) {
|
|
168
168
|
super({
|
|
169
|
-
name:
|
|
169
|
+
name: Ie,
|
|
170
170
|
message: e,
|
|
171
171
|
cause: o
|
|
172
|
-
}), this[
|
|
172
|
+
}), this[Re] = !0, this.url = t, this.requestBodyValues = n, this.statusCode = r, this.responseHeaders = i, this.responseBody = a, this.isRetryable = s, this.data = c;
|
|
173
173
|
}
|
|
174
174
|
static isInstance(e) {
|
|
175
|
-
return
|
|
175
|
+
return C.hasMarker(e, Le);
|
|
176
176
|
}
|
|
177
|
-
},
|
|
177
|
+
}, w = "AI_EmptyResponseBodyError", Be = `vercel.ai.error.${w}`, Ve = Symbol.for(Be), T = class extends C {
|
|
178
178
|
constructor({ message: e = "Empty response body" } = {}) {
|
|
179
179
|
super({
|
|
180
|
-
name:
|
|
180
|
+
name: w,
|
|
181
181
|
message: e
|
|
182
|
-
}), this[
|
|
182
|
+
}), this[Ve] = !0;
|
|
183
183
|
}
|
|
184
184
|
static isInstance(e) {
|
|
185
|
-
return
|
|
185
|
+
return C.hasMarker(e, Be);
|
|
186
186
|
}
|
|
187
187
|
};
|
|
188
|
-
function
|
|
188
|
+
function He(e) {
|
|
189
189
|
return e == null ? "unknown error" : typeof e == "string" ? e : e instanceof Error ? e.toString() : JSON.stringify(e);
|
|
190
190
|
}
|
|
191
|
-
var
|
|
191
|
+
var Ue = "AI_InvalidArgumentError", We = `vercel.ai.error.${Ue}`, Ge = Symbol.for(We), Ke = class extends C {
|
|
192
192
|
constructor({ message: e, cause: t, argument: n }) {
|
|
193
193
|
super({
|
|
194
|
-
name:
|
|
194
|
+
name: Ue,
|
|
195
195
|
message: e,
|
|
196
196
|
cause: t
|
|
197
|
-
}), this[
|
|
197
|
+
}), this[Ge] = !0, this.argument = n;
|
|
198
198
|
}
|
|
199
199
|
static isInstance(e) {
|
|
200
|
-
return
|
|
200
|
+
return C.hasMarker(e, We);
|
|
201
201
|
}
|
|
202
|
-
},
|
|
202
|
+
}, qe = "AI_JSONParseError", Je = `vercel.ai.error.${qe}`, Ye = Symbol.for(Je), Xe = class extends C {
|
|
203
203
|
constructor({ text: e, cause: t }) {
|
|
204
204
|
super({
|
|
205
|
-
name:
|
|
206
|
-
message: `JSON parsing failed: Text: ${e}.\nError message: ${
|
|
205
|
+
name: qe,
|
|
206
|
+
message: `JSON parsing failed: Text: ${e}.\nError message: ${He(t)}`,
|
|
207
207
|
cause: t
|
|
208
|
-
}), this[
|
|
208
|
+
}), this[Ye] = !0, this.text = e;
|
|
209
209
|
}
|
|
210
210
|
static isInstance(e) {
|
|
211
|
-
return
|
|
211
|
+
return C.hasMarker(e, Je);
|
|
212
212
|
}
|
|
213
|
-
},
|
|
213
|
+
}, Ze = "AI_TypeValidationError", Qe = `vercel.ai.error.${Ze}`, $e = Symbol.for(Qe), E = class e extends C {
|
|
214
214
|
constructor({ value: e, cause: t, context: n }) {
|
|
215
215
|
let r = "Type validation failed";
|
|
216
216
|
if (n?.field && (r += ` for ${n.field}`), n?.entityName || n?.entityId) {
|
|
@@ -219,13 +219,13 @@ var Be = "AI_InvalidArgumentError", Ve = `vercel.ai.error.${Be}`, He = Symbol.fo
|
|
|
219
219
|
n.entityName && e.push(n.entityName), n.entityId && e.push(`id: "${n.entityId}"`), r += e.join(", "), r += ")";
|
|
220
220
|
}
|
|
221
221
|
super({
|
|
222
|
-
name:
|
|
223
|
-
message: `${r}: Value: ${JSON.stringify(e)}.\nError message: ${
|
|
222
|
+
name: Ze,
|
|
223
|
+
message: `${r}: Value: ${JSON.stringify(e)}.\nError message: ${He(t)}`,
|
|
224
224
|
cause: t
|
|
225
|
-
}), this[
|
|
225
|
+
}), this[$e] = !0, this.value = e, this.context = n;
|
|
226
226
|
}
|
|
227
227
|
static isInstance(e) {
|
|
228
|
-
return
|
|
228
|
+
return C.hasMarker(e, Qe);
|
|
229
229
|
}
|
|
230
230
|
static wrap({ value: t, cause: n, context: r }) {
|
|
231
231
|
return e.isInstance(n) && n.value === t && n.context?.field === r?.field && n.context?.entityName === r?.entityName && n.context?.entityId === r?.entityId ? n : new e({
|
|
@@ -234,25 +234,25 @@ var Be = "AI_InvalidArgumentError", Ve = `vercel.ai.error.${Be}`, He = Symbol.fo
|
|
|
234
234
|
context: r
|
|
235
235
|
});
|
|
236
236
|
}
|
|
237
|
-
},
|
|
237
|
+
}, et = "AI_UnsupportedFunctionalityError", tt = `vercel.ai.error.${et}`, nt = Symbol.for(tt), D = class extends C {
|
|
238
238
|
constructor({ functionality: e, message: t = `'${e}' functionality not supported.` }) {
|
|
239
239
|
super({
|
|
240
|
-
name:
|
|
240
|
+
name: et,
|
|
241
241
|
message: t
|
|
242
|
-
}), this[
|
|
242
|
+
}), this[nt] = !0, this.functionality = e;
|
|
243
243
|
}
|
|
244
244
|
static isInstance(e) {
|
|
245
|
-
return
|
|
245
|
+
return C.hasMarker(e, tt);
|
|
246
246
|
}
|
|
247
|
-
},
|
|
247
|
+
}, rt = class extends Error {
|
|
248
248
|
constructor(e, t) {
|
|
249
249
|
super(e), this.name = "ParseError", this.type = t.type, this.field = t.field, this.value = t.value, this.line = t.line;
|
|
250
250
|
}
|
|
251
|
-
},
|
|
252
|
-
function
|
|
253
|
-
function
|
|
251
|
+
}, it = 10, at = 13, O = 32;
|
|
252
|
+
function k(e) {}
|
|
253
|
+
function ot(e) {
|
|
254
254
|
if (typeof e == "function") throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");
|
|
255
|
-
let { onEvent: t =
|
|
255
|
+
let { onEvent: t = k, onError: n = k, onRetry: r = k, onComment: i, maxBufferSize: a } = e, o = [], s = 0, c = !0, l, u = "", d = 0, f, p = !1;
|
|
256
256
|
function m(e) {
|
|
257
257
|
if (p) throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");
|
|
258
258
|
if (c && (c = !1, e.charCodeAt(0) === 239 && e.charCodeAt(1) === 187 && e.charCodeAt(2) === 191 && (e = e.slice(3))), o.length === 0) {
|
|
@@ -271,7 +271,7 @@ function nt(e) {
|
|
|
271
271
|
n !== "" && (o.push(n), s = n.length), h();
|
|
272
272
|
}
|
|
273
273
|
function h() {
|
|
274
|
-
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
|
|
274
|
+
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" }))));
|
|
275
275
|
}
|
|
276
276
|
function g(e) {
|
|
277
277
|
let n = 0;
|
|
@@ -287,9 +287,9 @@ function nt(e) {
|
|
|
287
287
|
continue;
|
|
288
288
|
}
|
|
289
289
|
let i = e.charCodeAt(n);
|
|
290
|
-
if (
|
|
291
|
-
let i = e.charCodeAt(n + 5) ===
|
|
292
|
-
if (d === 0 && e.charCodeAt(r + 1) ===
|
|
290
|
+
if (st(e, n, i)) {
|
|
291
|
+
let i = e.charCodeAt(n + 5) === O ? n + 6 : n + 5, a = e.slice(i, r);
|
|
292
|
+
if (d === 0 && e.charCodeAt(r + 1) === it) {
|
|
293
293
|
t({
|
|
294
294
|
id: l,
|
|
295
295
|
event: f,
|
|
@@ -299,7 +299,7 @@ function nt(e) {
|
|
|
299
299
|
}
|
|
300
300
|
u = d === 0 ? a : `${u}
|
|
301
301
|
${a}`, d++;
|
|
302
|
-
} else
|
|
302
|
+
} else A(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) === O ? n + 7 : n + 6, r) || void 0 : _(e, n, r);
|
|
303
303
|
n = r + 1, r = e.indexOf("\n", n);
|
|
304
304
|
}
|
|
305
305
|
return e.slice(n);
|
|
@@ -307,7 +307,7 @@ ${a}`, d++;
|
|
|
307
307
|
for (; n < e.length;) {
|
|
308
308
|
let t = e.indexOf("\r", n), r = e.indexOf("\n", n), i = -1;
|
|
309
309
|
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;
|
|
310
|
-
_(e, n, i), n = i + 1, e.charCodeAt(n - 1) ===
|
|
310
|
+
_(e, n, i), n = i + 1, e.charCodeAt(n - 1) === at && e.charCodeAt(n) === it && n++;
|
|
311
311
|
}
|
|
312
312
|
return e.slice(n);
|
|
313
313
|
}
|
|
@@ -317,25 +317,25 @@ ${a}`, d++;
|
|
|
317
317
|
return;
|
|
318
318
|
}
|
|
319
319
|
let r = e.charCodeAt(t);
|
|
320
|
-
if (
|
|
321
|
-
let r = e.charCodeAt(t + 5) ===
|
|
320
|
+
if (st(e, t, r)) {
|
|
321
|
+
let r = e.charCodeAt(t + 5) === O ? t + 6 : t + 5, i = e.slice(r, n);
|
|
322
322
|
u = d === 0 ? i : `${u}
|
|
323
323
|
${i}`, d++;
|
|
324
324
|
return;
|
|
325
325
|
}
|
|
326
|
-
if (
|
|
327
|
-
f = e.slice(e.charCodeAt(t + 6) ===
|
|
326
|
+
if (A(e, t, r)) {
|
|
327
|
+
f = e.slice(e.charCodeAt(t + 6) === O ? t + 7 : t + 6, n) || void 0;
|
|
328
328
|
return;
|
|
329
329
|
}
|
|
330
330
|
if (r === 105 && e.charCodeAt(t + 1) === 100 && e.charCodeAt(t + 2) === 58) {
|
|
331
|
-
let r = e.slice(e.charCodeAt(t + 3) ===
|
|
331
|
+
let r = e.slice(e.charCodeAt(t + 3) === O ? t + 4 : t + 3, n);
|
|
332
332
|
l = r.includes("\0") ? void 0 : r;
|
|
333
333
|
return;
|
|
334
334
|
}
|
|
335
335
|
if (r === 58) {
|
|
336
336
|
if (i) {
|
|
337
337
|
let r = e.slice(t, n);
|
|
338
|
-
i(r.slice(e.charCodeAt(t + 1) ===
|
|
338
|
+
i(r.slice(e.charCodeAt(t + 1) === O ? 2 : 1));
|
|
339
339
|
}
|
|
340
340
|
return;
|
|
341
341
|
}
|
|
@@ -344,7 +344,7 @@ ${i}`, d++;
|
|
|
344
344
|
v(a, "", a);
|
|
345
345
|
return;
|
|
346
346
|
}
|
|
347
|
-
let s = a.slice(0, o), c = a.charCodeAt(o + 1) ===
|
|
347
|
+
let s = a.slice(0, o), c = a.charCodeAt(o + 1) === O ? 2 : 1;
|
|
348
348
|
v(s, a.slice(o + c), a);
|
|
349
349
|
}
|
|
350
350
|
function v(e, t, i) {
|
|
@@ -360,13 +360,13 @@ ${t}`, d++;
|
|
|
360
360
|
l = t.includes("\0") ? void 0 : t;
|
|
361
361
|
break;
|
|
362
362
|
case "retry":
|
|
363
|
-
/^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new
|
|
363
|
+
/^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new rt(`Invalid \`retry\` value: "${t}"`, {
|
|
364
364
|
type: "invalid-retry",
|
|
365
365
|
value: t,
|
|
366
366
|
line: i
|
|
367
367
|
}));
|
|
368
368
|
break;
|
|
369
|
-
default: n(new
|
|
369
|
+
default: n(new rt(`Unknown field "${e.length > 20 ? `${e.slice(0, 20)}\u2026` : e}"`, {
|
|
370
370
|
type: "unknown-field",
|
|
371
371
|
field: e,
|
|
372
372
|
value: t,
|
|
@@ -393,20 +393,20 @@ ${t}`, d++;
|
|
|
393
393
|
reset: y
|
|
394
394
|
};
|
|
395
395
|
}
|
|
396
|
-
function
|
|
396
|
+
function st(e, t, n) {
|
|
397
397
|
return n === 100 && e.charCodeAt(t + 1) === 97 && e.charCodeAt(t + 2) === 116 && e.charCodeAt(t + 3) === 97 && e.charCodeAt(t + 4) === 58;
|
|
398
398
|
}
|
|
399
|
-
function
|
|
399
|
+
function A(e, t, n) {
|
|
400
400
|
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;
|
|
401
401
|
}
|
|
402
402
|
//#endregion
|
|
403
403
|
//#region ../../node_modules/.pnpm/eventsource-parser@3.1.0/node_modules/eventsource-parser/dist/stream.js
|
|
404
|
-
var
|
|
404
|
+
var ct = class extends TransformStream {
|
|
405
405
|
constructor({ onError: e, onRetry: t, onComment: n, maxBufferSize: r } = {}) {
|
|
406
406
|
let i;
|
|
407
407
|
super({
|
|
408
408
|
start(a) {
|
|
409
|
-
i =
|
|
409
|
+
i = ot({
|
|
410
410
|
onEvent: (e) => {
|
|
411
411
|
a.enqueue(e);
|
|
412
412
|
},
|
|
@@ -425,8 +425,8 @@ var P = class extends TransformStream {
|
|
|
425
425
|
}
|
|
426
426
|
};
|
|
427
427
|
new TextDecoder();
|
|
428
|
-
var { btoa:
|
|
429
|
-
function
|
|
428
|
+
var { btoa: lt, atob: ut } = globalThis;
|
|
429
|
+
function j(e) {
|
|
430
430
|
if (e == null) return {};
|
|
431
431
|
let t = {};
|
|
432
432
|
if (e instanceof Headers) e.forEach((e, n) => {
|
|
@@ -438,28 +438,28 @@ function ot(e) {
|
|
|
438
438
|
}
|
|
439
439
|
return t;
|
|
440
440
|
}
|
|
441
|
-
var
|
|
441
|
+
var M = ({ prefix: e, size: t = 16, alphabet: n = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", separator: r = "-" } = {}) => {
|
|
442
442
|
let i = () => {
|
|
443
443
|
let e = n.length, r = Array(t);
|
|
444
444
|
for (let i = 0; i < t; i++) r[i] = n[Math.random() * e | 0];
|
|
445
445
|
return r.join("");
|
|
446
446
|
};
|
|
447
447
|
if (e == null) return i;
|
|
448
|
-
if (n.includes(r)) throw new
|
|
448
|
+
if (n.includes(r)) throw new Ke({
|
|
449
449
|
argument: "separator",
|
|
450
450
|
message: `The separator "${r}" must not be part of the alphabet "${n}".`
|
|
451
451
|
});
|
|
452
452
|
return () => `${e}${r}${i()}`;
|
|
453
|
-
},
|
|
454
|
-
function
|
|
453
|
+
}, dt = M();
|
|
454
|
+
function N(e) {
|
|
455
455
|
return globalThis.Buffer?.isBuffer(e) ?? !1;
|
|
456
456
|
}
|
|
457
|
-
var
|
|
458
|
-
function
|
|
457
|
+
var ft = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/, pt = /"(?: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*:/;
|
|
458
|
+
function mt(e) {
|
|
459
459
|
let t = JSON.parse(e);
|
|
460
|
-
return typeof t != "object" || !t ||
|
|
460
|
+
return typeof t != "object" || !t || ft.test(e) === !1 && pt.test(e) === !1 ? t : ht(t);
|
|
461
461
|
}
|
|
462
|
-
function
|
|
462
|
+
function ht(e) {
|
|
463
463
|
let t = [e];
|
|
464
464
|
for (; t.length;) {
|
|
465
465
|
let e = t;
|
|
@@ -474,35 +474,35 @@ function L(e) {
|
|
|
474
474
|
}
|
|
475
475
|
return e;
|
|
476
476
|
}
|
|
477
|
-
function
|
|
477
|
+
function gt(e) {
|
|
478
478
|
let { stackTraceLimit: t } = Error;
|
|
479
479
|
try {
|
|
480
480
|
Error.stackTraceLimit = 0;
|
|
481
481
|
} catch {
|
|
482
|
-
return
|
|
482
|
+
return mt(e);
|
|
483
483
|
}
|
|
484
484
|
try {
|
|
485
|
-
return
|
|
485
|
+
return mt(e);
|
|
486
486
|
} finally {
|
|
487
487
|
Error.stackTraceLimit = t;
|
|
488
488
|
}
|
|
489
489
|
}
|
|
490
|
-
function
|
|
490
|
+
function _t(e) {
|
|
491
491
|
if (e.type === "object" || Array.isArray(e.type) && e.type.includes("object")) {
|
|
492
492
|
let { additionalProperties: t } = e;
|
|
493
|
-
e.additionalProperties = t != null && typeof t != "boolean" &&
|
|
493
|
+
e.additionalProperties = t != null && typeof t != "boolean" && P(t);
|
|
494
494
|
let { properties: n } = e;
|
|
495
|
-
if (n != null) for (let e of Object.keys(n)) n[e] =
|
|
495
|
+
if (n != null) for (let e of Object.keys(n)) n[e] = P(n[e]);
|
|
496
496
|
}
|
|
497
|
-
e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(
|
|
497
|
+
e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(P) : P(e.items)), e.anyOf != null && (e.anyOf = e.anyOf.map(P)), e.allOf != null && (e.allOf = e.allOf.map(P)), e.oneOf != null && (e.oneOf = e.oneOf.map(P));
|
|
498
498
|
let { definitions: t } = e;
|
|
499
|
-
if (t != null) for (let e of Object.keys(t)) t[e] =
|
|
499
|
+
if (t != null) for (let e of Object.keys(t)) t[e] = P(t[e]);
|
|
500
500
|
return e;
|
|
501
501
|
}
|
|
502
|
-
function
|
|
503
|
-
return typeof e == "boolean" ? e :
|
|
502
|
+
function P(e) {
|
|
503
|
+
return typeof e == "boolean" ? e : _t(e);
|
|
504
504
|
}
|
|
505
|
-
var
|
|
505
|
+
var vt = Symbol("Let zodToJsonSchema decide on which parser to use"), yt = {
|
|
506
506
|
name: void 0,
|
|
507
507
|
$refStrategy: "root",
|
|
508
508
|
basePath: ["#"],
|
|
@@ -522,24 +522,24 @@ var pt = Symbol("Let zodToJsonSchema decide on which parser to use"), mt = {
|
|
|
522
522
|
emailStrategy: "format:email",
|
|
523
523
|
base64Strategy: "contentEncoding:base64",
|
|
524
524
|
nameStrategy: "ref"
|
|
525
|
-
},
|
|
526
|
-
...
|
|
525
|
+
}, bt = (e) => typeof e == "string" ? {
|
|
526
|
+
...yt,
|
|
527
527
|
name: e
|
|
528
528
|
} : {
|
|
529
|
-
...
|
|
529
|
+
...yt,
|
|
530
530
|
...e
|
|
531
531
|
};
|
|
532
|
-
function
|
|
532
|
+
function F() {
|
|
533
533
|
return {};
|
|
534
534
|
}
|
|
535
|
-
function
|
|
535
|
+
function xt(e, t) {
|
|
536
536
|
let n = { type: "array" };
|
|
537
|
-
return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items =
|
|
537
|
+
return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = K(e.type._def, {
|
|
538
538
|
...t,
|
|
539
539
|
currentPath: [...t.currentPath, "items"]
|
|
540
540
|
})), 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;
|
|
541
541
|
}
|
|
542
|
-
function
|
|
542
|
+
function St(e) {
|
|
543
543
|
let t = {
|
|
544
544
|
type: "integer",
|
|
545
545
|
format: "int64"
|
|
@@ -556,16 +556,16 @@ function _t(e) {
|
|
|
556
556
|
}
|
|
557
557
|
return t;
|
|
558
558
|
}
|
|
559
|
-
function
|
|
559
|
+
function I() {
|
|
560
560
|
return { type: "boolean" };
|
|
561
561
|
}
|
|
562
|
-
function
|
|
563
|
-
return
|
|
562
|
+
function Ct(e, t) {
|
|
563
|
+
return K(e.type._def, t);
|
|
564
564
|
}
|
|
565
|
-
var
|
|
566
|
-
function
|
|
565
|
+
var L = (e, t) => K(e.innerType._def, t);
|
|
566
|
+
function wt(e, t, n) {
|
|
567
567
|
let r = n ?? t.dateStrategy;
|
|
568
|
-
if (Array.isArray(r)) return { anyOf: r.map((n) =>
|
|
568
|
+
if (Array.isArray(r)) return { anyOf: r.map((n) => wt(e, t, n)) };
|
|
569
569
|
switch (r) {
|
|
570
570
|
case "string":
|
|
571
571
|
case "format:date-time": return {
|
|
@@ -576,10 +576,10 @@ function H(e, t, n) {
|
|
|
576
576
|
type: "string",
|
|
577
577
|
format: "date"
|
|
578
578
|
};
|
|
579
|
-
case "integer": return
|
|
579
|
+
case "integer": return Tt(e);
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
|
-
var
|
|
582
|
+
var Tt = (e) => {
|
|
583
583
|
let t = {
|
|
584
584
|
type: "integer",
|
|
585
585
|
format: "unix-time"
|
|
@@ -592,31 +592,31 @@ var U = (e) => {
|
|
|
592
592
|
}
|
|
593
593
|
return t;
|
|
594
594
|
};
|
|
595
|
-
function
|
|
595
|
+
function R(e, t) {
|
|
596
596
|
return {
|
|
597
|
-
...
|
|
597
|
+
...K(e.innerType._def, t),
|
|
598
598
|
default: e.defaultValue()
|
|
599
599
|
};
|
|
600
600
|
}
|
|
601
|
-
function
|
|
602
|
-
return t.effectStrategy === "input" ?
|
|
601
|
+
function Et(e, t) {
|
|
602
|
+
return t.effectStrategy === "input" ? K(e.schema._def, t) : F();
|
|
603
603
|
}
|
|
604
|
-
function
|
|
604
|
+
function Dt(e) {
|
|
605
605
|
return {
|
|
606
606
|
type: "string",
|
|
607
607
|
enum: Array.from(e.values)
|
|
608
608
|
};
|
|
609
609
|
}
|
|
610
|
-
var
|
|
611
|
-
function
|
|
612
|
-
let n = [
|
|
610
|
+
var Ot = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
|
|
611
|
+
function kt(e, t) {
|
|
612
|
+
let n = [K(e.left._def, {
|
|
613
613
|
...t,
|
|
614
614
|
currentPath: [
|
|
615
615
|
...t.currentPath,
|
|
616
616
|
"allOf",
|
|
617
617
|
"0"
|
|
618
618
|
]
|
|
619
|
-
}),
|
|
619
|
+
}), K(e.right._def, {
|
|
620
620
|
...t,
|
|
621
621
|
currentPath: [
|
|
622
622
|
...t.currentPath,
|
|
@@ -625,7 +625,7 @@ function Ct(e, t) {
|
|
|
625
625
|
]
|
|
626
626
|
})].filter((e) => !!e), r = [];
|
|
627
627
|
return n.forEach((e) => {
|
|
628
|
-
if (
|
|
628
|
+
if (Ot(e)) r.push(...e.allOf);
|
|
629
629
|
else {
|
|
630
630
|
let t = e;
|
|
631
631
|
if ("additionalProperties" in e && e.additionalProperties === !1) {
|
|
@@ -636,19 +636,19 @@ function Ct(e, t) {
|
|
|
636
636
|
}
|
|
637
637
|
}), r.length ? { allOf: r } : void 0;
|
|
638
638
|
}
|
|
639
|
-
function
|
|
639
|
+
function At(e) {
|
|
640
640
|
let t = typeof e.value;
|
|
641
641
|
return t !== "bigint" && t !== "number" && t !== "boolean" && t !== "string" ? { type: Array.isArray(e.value) ? "array" : "object" } : {
|
|
642
642
|
type: t === "bigint" ? "integer" : t,
|
|
643
643
|
const: e.value
|
|
644
644
|
};
|
|
645
645
|
}
|
|
646
|
-
var
|
|
646
|
+
var jt = void 0, z = {
|
|
647
647
|
cuid: /^[cC][^\s-]{8,}$/,
|
|
648
648
|
cuid2: /^[0-9a-z]+$/,
|
|
649
649
|
ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
|
|
650
650
|
email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}$/,
|
|
651
|
-
emoji: () => (
|
|
651
|
+
emoji: () => (jt === void 0 && (jt = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u")), jt),
|
|
652
652
|
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}$/,
|
|
653
653
|
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])$/,
|
|
654
654
|
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])$/,
|
|
@@ -659,7 +659,7 @@ var Tt = void 0, W = {
|
|
|
659
659
|
nanoid: /^[a-zA-Z0-9_-]{21}$/,
|
|
660
660
|
jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
|
|
661
661
|
};
|
|
662
|
-
function
|
|
662
|
+
function B(e, t) {
|
|
663
663
|
let n = { type: "string" };
|
|
664
664
|
if (e.checks) for (let r of e.checks) switch (r.kind) {
|
|
665
665
|
case "min":
|
|
@@ -671,108 +671,108 @@ function Et(e, t) {
|
|
|
671
671
|
case "email":
|
|
672
672
|
switch (t.emailStrategy) {
|
|
673
673
|
case "format:email":
|
|
674
|
-
|
|
674
|
+
U(n, "email", r.message, t);
|
|
675
675
|
break;
|
|
676
676
|
case "format:idn-email":
|
|
677
|
-
|
|
677
|
+
U(n, "idn-email", r.message, t);
|
|
678
678
|
break;
|
|
679
|
-
case "pattern:zod":
|
|
679
|
+
case "pattern:zod": W(n, z.email, r.message, t);
|
|
680
680
|
}
|
|
681
681
|
break;
|
|
682
682
|
case "url":
|
|
683
|
-
|
|
683
|
+
U(n, "uri", r.message, t);
|
|
684
684
|
break;
|
|
685
685
|
case "uuid":
|
|
686
|
-
|
|
686
|
+
U(n, "uuid", r.message, t);
|
|
687
687
|
break;
|
|
688
688
|
case "regex":
|
|
689
|
-
|
|
689
|
+
W(n, r.regex, r.message, t);
|
|
690
690
|
break;
|
|
691
691
|
case "cuid":
|
|
692
|
-
|
|
692
|
+
W(n, z.cuid, r.message, t);
|
|
693
693
|
break;
|
|
694
694
|
case "cuid2":
|
|
695
|
-
|
|
695
|
+
W(n, z.cuid2, r.message, t);
|
|
696
696
|
break;
|
|
697
697
|
case "startsWith":
|
|
698
|
-
|
|
698
|
+
W(n, RegExp(`^${V(r.value, t)}`), r.message, t);
|
|
699
699
|
break;
|
|
700
700
|
case "endsWith":
|
|
701
|
-
|
|
701
|
+
W(n, RegExp(`${V(r.value, t)}$`), r.message, t);
|
|
702
702
|
break;
|
|
703
703
|
case "datetime":
|
|
704
|
-
|
|
704
|
+
U(n, "date-time", r.message, t);
|
|
705
705
|
break;
|
|
706
706
|
case "date":
|
|
707
|
-
|
|
707
|
+
U(n, "date", r.message, t);
|
|
708
708
|
break;
|
|
709
709
|
case "time":
|
|
710
|
-
|
|
710
|
+
U(n, "time", r.message, t);
|
|
711
711
|
break;
|
|
712
712
|
case "duration":
|
|
713
|
-
|
|
713
|
+
U(n, "duration", r.message, t);
|
|
714
714
|
break;
|
|
715
715
|
case "length":
|
|
716
716
|
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;
|
|
717
717
|
break;
|
|
718
718
|
case "includes":
|
|
719
|
-
|
|
719
|
+
W(n, RegExp(V(r.value, t)), r.message, t);
|
|
720
720
|
break;
|
|
721
721
|
case "ip":
|
|
722
|
-
r.version !== "v6" &&
|
|
722
|
+
r.version !== "v6" && U(n, "ipv4", r.message, t), r.version !== "v4" && U(n, "ipv6", r.message, t);
|
|
723
723
|
break;
|
|
724
724
|
case "base64url":
|
|
725
|
-
|
|
725
|
+
W(n, z.base64url, r.message, t);
|
|
726
726
|
break;
|
|
727
727
|
case "jwt":
|
|
728
|
-
|
|
728
|
+
W(n, z.jwt, r.message, t);
|
|
729
729
|
break;
|
|
730
730
|
case "cidr":
|
|
731
|
-
r.version !== "v6" &&
|
|
731
|
+
r.version !== "v6" && W(n, z.ipv4Cidr, r.message, t), r.version !== "v4" && W(n, z.ipv6Cidr, r.message, t);
|
|
732
732
|
break;
|
|
733
733
|
case "emoji":
|
|
734
|
-
|
|
734
|
+
W(n, z.emoji(), r.message, t);
|
|
735
735
|
break;
|
|
736
736
|
case "ulid":
|
|
737
|
-
|
|
737
|
+
W(n, z.ulid, r.message, t);
|
|
738
738
|
break;
|
|
739
739
|
case "base64":
|
|
740
740
|
switch (t.base64Strategy) {
|
|
741
741
|
case "format:binary":
|
|
742
|
-
|
|
742
|
+
U(n, "binary", r.message, t);
|
|
743
743
|
break;
|
|
744
744
|
case "contentEncoding:base64":
|
|
745
745
|
n.contentEncoding = "base64";
|
|
746
746
|
break;
|
|
747
|
-
case "pattern:zod":
|
|
747
|
+
case "pattern:zod": W(n, z.base64, r.message, t);
|
|
748
748
|
}
|
|
749
749
|
break;
|
|
750
|
-
case "nanoid":
|
|
750
|
+
case "nanoid": W(n, z.nanoid, r.message, t);
|
|
751
751
|
}
|
|
752
752
|
return n;
|
|
753
753
|
}
|
|
754
|
-
function
|
|
755
|
-
return t.patternStrategy === "escape" ?
|
|
754
|
+
function V(e, t) {
|
|
755
|
+
return t.patternStrategy === "escape" ? Mt(e) : e;
|
|
756
756
|
}
|
|
757
|
-
var
|
|
758
|
-
function
|
|
757
|
+
var H = /* @__PURE__ */ new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
758
|
+
function Mt(e) {
|
|
759
759
|
let t = "";
|
|
760
|
-
for (let n = 0; n < e.length; n++)
|
|
760
|
+
for (let n = 0; n < e.length; n++) H.has(e[n]) || (t += "\\"), t += e[n];
|
|
761
761
|
return t;
|
|
762
762
|
}
|
|
763
|
-
function
|
|
763
|
+
function U(e, t, n, r) {
|
|
764
764
|
e.format || e.anyOf?.some((e) => e.format) ? (e.anyOf ||= [], e.format && (e.anyOf.push({ format: e.format }), delete e.format), e.anyOf.push({
|
|
765
765
|
format: t,
|
|
766
766
|
...n && r.errorMessages && { errorMessage: { format: n } }
|
|
767
767
|
})) : e.format = t;
|
|
768
768
|
}
|
|
769
|
-
function
|
|
769
|
+
function W(e, t, n, r) {
|
|
770
770
|
e.pattern || e.allOf?.some((e) => e.pattern) ? (e.allOf ||= [], e.pattern && (e.allOf.push({ pattern: e.pattern }), delete e.pattern), e.allOf.push({
|
|
771
|
-
pattern:
|
|
771
|
+
pattern: Nt(t, r),
|
|
772
772
|
...n && r.errorMessages && { errorMessage: { pattern: n } }
|
|
773
|
-
})) : e.pattern =
|
|
773
|
+
})) : e.pattern = Nt(t, r);
|
|
774
774
|
}
|
|
775
|
-
function
|
|
775
|
+
function Nt(e, t) {
|
|
776
776
|
if (!t.applyRegexFlags || !e.flags) return e.source;
|
|
777
777
|
let n = {
|
|
778
778
|
i: e.flags.includes("i"),
|
|
@@ -811,16 +811,16 @@ function kt(e, t) {
|
|
|
811
811
|
}
|
|
812
812
|
return i;
|
|
813
813
|
}
|
|
814
|
-
function
|
|
814
|
+
function Pt(e, t) {
|
|
815
815
|
let n = {
|
|
816
816
|
type: "object",
|
|
817
|
-
additionalProperties:
|
|
817
|
+
additionalProperties: K(e.valueType._def, {
|
|
818
818
|
...t,
|
|
819
819
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
820
820
|
}) ?? t.allowedAdditionalProperties
|
|
821
821
|
};
|
|
822
822
|
if (e.keyType?._def.typeName === "ZodString" && e.keyType._def.checks?.length) {
|
|
823
|
-
let { type: r, ...i } =
|
|
823
|
+
let { type: r, ...i } = B(e.keyType._def, t);
|
|
824
824
|
return {
|
|
825
825
|
...n,
|
|
826
826
|
propertyNames: i
|
|
@@ -831,7 +831,7 @@ function At(e, t) {
|
|
|
831
831
|
propertyNames: { enum: e.keyType._def.values }
|
|
832
832
|
};
|
|
833
833
|
if (e.keyType?._def.typeName === "ZodBranded" && e.keyType._def.type._def.typeName === "ZodString" && e.keyType._def.type._def.checks?.length) {
|
|
834
|
-
let { type: r, ...i } =
|
|
834
|
+
let { type: r, ...i } = Ct(e.keyType._def, t);
|
|
835
835
|
return {
|
|
836
836
|
...n,
|
|
837
837
|
propertyNames: i
|
|
@@ -839,13 +839,13 @@ function At(e, t) {
|
|
|
839
839
|
}
|
|
840
840
|
return n;
|
|
841
841
|
}
|
|
842
|
-
function
|
|
843
|
-
return t.mapStrategy === "record" ?
|
|
842
|
+
function Ft(e, t) {
|
|
843
|
+
return t.mapStrategy === "record" ? Pt(e, t) : {
|
|
844
844
|
type: "array",
|
|
845
845
|
maxItems: 125,
|
|
846
846
|
items: {
|
|
847
847
|
type: "array",
|
|
848
|
-
items: [
|
|
848
|
+
items: [K(e.keyType._def, {
|
|
849
849
|
...t,
|
|
850
850
|
currentPath: [
|
|
851
851
|
...t.currentPath,
|
|
@@ -853,7 +853,7 @@ function jt(e, t) {
|
|
|
853
853
|
"items",
|
|
854
854
|
"0"
|
|
855
855
|
]
|
|
856
|
-
}) ||
|
|
856
|
+
}) || F(), K(e.valueType._def, {
|
|
857
857
|
...t,
|
|
858
858
|
currentPath: [
|
|
859
859
|
...t.currentPath,
|
|
@@ -861,37 +861,37 @@ function jt(e, t) {
|
|
|
861
861
|
"items",
|
|
862
862
|
"1"
|
|
863
863
|
]
|
|
864
|
-
}) ||
|
|
864
|
+
}) || F()],
|
|
865
865
|
minItems: 2,
|
|
866
866
|
maxItems: 2
|
|
867
867
|
}
|
|
868
868
|
};
|
|
869
869
|
}
|
|
870
|
-
function
|
|
870
|
+
function It(e) {
|
|
871
871
|
let t = e.values, n = Object.keys(e.values).filter((e) => typeof t[t[e]] != "number").map((e) => t[e]), r = Array.from(new Set(n.map((e) => typeof e)));
|
|
872
872
|
return {
|
|
873
873
|
type: r.length === 1 ? r[0] === "string" ? "string" : "number" : ["string", "number"],
|
|
874
874
|
enum: n
|
|
875
875
|
};
|
|
876
876
|
}
|
|
877
|
-
function
|
|
878
|
-
return { not:
|
|
877
|
+
function Lt() {
|
|
878
|
+
return { not: F() };
|
|
879
879
|
}
|
|
880
|
-
function
|
|
880
|
+
function Rt() {
|
|
881
881
|
return { type: "null" };
|
|
882
882
|
}
|
|
883
|
-
var
|
|
883
|
+
var zt = {
|
|
884
884
|
ZodString: "string",
|
|
885
885
|
ZodNumber: "number",
|
|
886
886
|
ZodBigInt: "integer",
|
|
887
887
|
ZodBoolean: "boolean",
|
|
888
888
|
ZodNull: "null"
|
|
889
889
|
};
|
|
890
|
-
function
|
|
890
|
+
function Bt(e, t) {
|
|
891
891
|
let n = e.options instanceof Map ? Array.from(e.options.values()) : e.options;
|
|
892
|
-
if (n.every((e) => e._def.typeName in
|
|
892
|
+
if (n.every((e) => e._def.typeName in zt && (!e._def.checks || !e._def.checks.length))) {
|
|
893
893
|
let e = n.reduce((e, t) => {
|
|
894
|
-
let n =
|
|
894
|
+
let n = zt[t._def.typeName];
|
|
895
895
|
return n && !e.includes(n) ? [...e, n] : e;
|
|
896
896
|
}, []);
|
|
897
897
|
return { type: e.length > 1 ? e : e[0] };
|
|
@@ -919,10 +919,10 @@ function It(e, t) {
|
|
|
919
919
|
type: "string",
|
|
920
920
|
enum: n.reduce((e, t) => [...e, ...t._def.values.filter((t) => !e.includes(t))], [])
|
|
921
921
|
};
|
|
922
|
-
return
|
|
922
|
+
return Vt(e, t);
|
|
923
923
|
}
|
|
924
|
-
var
|
|
925
|
-
let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) =>
|
|
924
|
+
var Vt = (e, t) => {
|
|
925
|
+
let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => K(e._def, {
|
|
926
926
|
...t,
|
|
927
927
|
currentPath: [
|
|
928
928
|
...t.currentPath,
|
|
@@ -932,15 +932,15 @@ var Lt = (e, t) => {
|
|
|
932
932
|
})).filter((e) => !!e && (!t.strictUnions || typeof e == "object" && Object.keys(e).length > 0));
|
|
933
933
|
return n.length ? { anyOf: n } : void 0;
|
|
934
934
|
};
|
|
935
|
-
function
|
|
935
|
+
function Ht(e, t) {
|
|
936
936
|
if ([
|
|
937
937
|
"ZodString",
|
|
938
938
|
"ZodNumber",
|
|
939
939
|
"ZodBigInt",
|
|
940
940
|
"ZodBoolean",
|
|
941
941
|
"ZodNull"
|
|
942
|
-
].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [
|
|
943
|
-
let n =
|
|
942
|
+
].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [zt[e.innerType._def.typeName], "null"] };
|
|
943
|
+
let n = K(e.innerType._def, {
|
|
944
944
|
...t,
|
|
945
945
|
currentPath: [
|
|
946
946
|
...t.currentPath,
|
|
@@ -950,7 +950,7 @@ function Rt(e, t) {
|
|
|
950
950
|
});
|
|
951
951
|
return n && { anyOf: [n, { type: "null" }] };
|
|
952
952
|
}
|
|
953
|
-
function
|
|
953
|
+
function Ut(e) {
|
|
954
954
|
let t = { type: "number" };
|
|
955
955
|
if (!e.checks) return t;
|
|
956
956
|
for (let n of e.checks) switch (n.kind) {
|
|
@@ -967,7 +967,7 @@ function zt(e) {
|
|
|
967
967
|
}
|
|
968
968
|
return t;
|
|
969
969
|
}
|
|
970
|
-
function
|
|
970
|
+
function Wt(e, t) {
|
|
971
971
|
let n = {
|
|
972
972
|
type: "object",
|
|
973
973
|
properties: {}
|
|
@@ -975,7 +975,7 @@ function Bt(e, t) {
|
|
|
975
975
|
for (let e in i) {
|
|
976
976
|
let a = i[e];
|
|
977
977
|
if (a === void 0 || a._def === void 0) continue;
|
|
978
|
-
let o =
|
|
978
|
+
let o = Kt(a), s = K(a._def, {
|
|
979
979
|
...t,
|
|
980
980
|
currentPath: [
|
|
981
981
|
...t.currentPath,
|
|
@@ -991,11 +991,11 @@ function Bt(e, t) {
|
|
|
991
991
|
s !== void 0 && (n.properties[e] = s, o || r.push(e));
|
|
992
992
|
}
|
|
993
993
|
r.length && (n.required = r);
|
|
994
|
-
let a =
|
|
994
|
+
let a = Gt(e, t);
|
|
995
995
|
return a !== void 0 && (n.additionalProperties = a), n;
|
|
996
996
|
}
|
|
997
|
-
function
|
|
998
|
-
if (e.catchall._def.typeName !== "ZodNever") return
|
|
997
|
+
function Gt(e, t) {
|
|
998
|
+
if (e.catchall._def.typeName !== "ZodNever") return K(e.catchall._def, {
|
|
999
999
|
...t,
|
|
1000
1000
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
1001
1001
|
});
|
|
@@ -1005,16 +1005,16 @@ function Vt(e, t) {
|
|
|
1005
1005
|
case "strip": return t.removeAdditionalStrategy === "strict" ? t.allowedAdditionalProperties : t.rejectedAdditionalProperties;
|
|
1006
1006
|
}
|
|
1007
1007
|
}
|
|
1008
|
-
function
|
|
1008
|
+
function Kt(e) {
|
|
1009
1009
|
try {
|
|
1010
1010
|
return e.isOptional();
|
|
1011
1011
|
} catch {
|
|
1012
1012
|
return !0;
|
|
1013
1013
|
}
|
|
1014
1014
|
}
|
|
1015
|
-
var
|
|
1016
|
-
if (t.currentPath.toString() === t.propertyPath?.toString()) return
|
|
1017
|
-
let n =
|
|
1015
|
+
var qt = (e, t) => {
|
|
1016
|
+
if (t.currentPath.toString() === t.propertyPath?.toString()) return K(e.innerType._def, t);
|
|
1017
|
+
let n = K(e.innerType._def, {
|
|
1018
1018
|
...t,
|
|
1019
1019
|
currentPath: [
|
|
1020
1020
|
...t.currentPath,
|
|
@@ -1022,11 +1022,11 @@ var Ut = (e, t) => {
|
|
|
1022
1022
|
"1"
|
|
1023
1023
|
]
|
|
1024
1024
|
});
|
|
1025
|
-
return n ? { anyOf: [{ not:
|
|
1026
|
-
},
|
|
1027
|
-
if (t.pipeStrategy === "input") return
|
|
1028
|
-
if (t.pipeStrategy === "output") return
|
|
1029
|
-
let n =
|
|
1025
|
+
return n ? { anyOf: [{ not: F() }, n] } : F();
|
|
1026
|
+
}, G = (e, t) => {
|
|
1027
|
+
if (t.pipeStrategy === "input") return K(e.in._def, t);
|
|
1028
|
+
if (t.pipeStrategy === "output") return K(e.out._def, t);
|
|
1029
|
+
let n = K(e.in._def, {
|
|
1030
1030
|
...t,
|
|
1031
1031
|
currentPath: [
|
|
1032
1032
|
...t.currentPath,
|
|
@@ -1034,7 +1034,7 @@ var Ut = (e, t) => {
|
|
|
1034
1034
|
"0"
|
|
1035
1035
|
]
|
|
1036
1036
|
});
|
|
1037
|
-
return { allOf: [n,
|
|
1037
|
+
return { allOf: [n, K(e.out._def, {
|
|
1038
1038
|
...t,
|
|
1039
1039
|
currentPath: [
|
|
1040
1040
|
...t.currentPath,
|
|
@@ -1043,25 +1043,25 @@ var Ut = (e, t) => {
|
|
|
1043
1043
|
]
|
|
1044
1044
|
})].filter((e) => e !== void 0) };
|
|
1045
1045
|
};
|
|
1046
|
-
function
|
|
1047
|
-
return
|
|
1046
|
+
function Jt(e, t) {
|
|
1047
|
+
return K(e.type._def, t);
|
|
1048
1048
|
}
|
|
1049
|
-
function
|
|
1049
|
+
function Yt(e, t) {
|
|
1050
1050
|
let n = {
|
|
1051
1051
|
type: "array",
|
|
1052
1052
|
uniqueItems: !0,
|
|
1053
|
-
items:
|
|
1053
|
+
items: K(e.valueType._def, {
|
|
1054
1054
|
...t,
|
|
1055
1055
|
currentPath: [...t.currentPath, "items"]
|
|
1056
1056
|
})
|
|
1057
1057
|
};
|
|
1058
1058
|
return e.minSize && (n.minItems = e.minSize.value), e.maxSize && (n.maxItems = e.maxSize.value), n;
|
|
1059
1059
|
}
|
|
1060
|
-
function
|
|
1060
|
+
function Xt(e, t) {
|
|
1061
1061
|
return e.rest ? {
|
|
1062
1062
|
type: "array",
|
|
1063
1063
|
minItems: e.items.length,
|
|
1064
|
-
items: e.items.map((e, n) =>
|
|
1064
|
+
items: e.items.map((e, n) => K(e._def, {
|
|
1065
1065
|
...t,
|
|
1066
1066
|
currentPath: [
|
|
1067
1067
|
...t.currentPath,
|
|
@@ -1069,7 +1069,7 @@ function qt(e, t) {
|
|
|
1069
1069
|
`${n}`
|
|
1070
1070
|
]
|
|
1071
1071
|
})).reduce((e, t) => t === void 0 ? e : [...e, t], []),
|
|
1072
|
-
additionalItems:
|
|
1072
|
+
additionalItems: K(e.rest._def, {
|
|
1073
1073
|
...t,
|
|
1074
1074
|
currentPath: [...t.currentPath, "additionalItems"]
|
|
1075
1075
|
})
|
|
@@ -1077,7 +1077,7 @@ function qt(e, t) {
|
|
|
1077
1077
|
type: "array",
|
|
1078
1078
|
minItems: e.items.length,
|
|
1079
1079
|
maxItems: e.items.length,
|
|
1080
|
-
items: e.items.map((e, n) =>
|
|
1080
|
+
items: e.items.map((e, n) => K(e._def, {
|
|
1081
1081
|
...t,
|
|
1082
1082
|
currentPath: [
|
|
1083
1083
|
...t.currentPath,
|
|
@@ -1087,47 +1087,47 @@ function qt(e, t) {
|
|
|
1087
1087
|
})).reduce((e, t) => t === void 0 ? e : [...e, t], [])
|
|
1088
1088
|
};
|
|
1089
1089
|
}
|
|
1090
|
-
function
|
|
1091
|
-
return { not:
|
|
1090
|
+
function Zt() {
|
|
1091
|
+
return { not: F() };
|
|
1092
1092
|
}
|
|
1093
|
-
function
|
|
1094
|
-
return
|
|
1093
|
+
function Qt() {
|
|
1094
|
+
return F();
|
|
1095
1095
|
}
|
|
1096
|
-
var
|
|
1096
|
+
var $t = (e, t) => K(e.innerType._def, t), en = (e, t, n) => {
|
|
1097
1097
|
switch (t) {
|
|
1098
|
-
case "ZodString": return
|
|
1099
|
-
case "ZodNumber": return
|
|
1100
|
-
case "ZodObject": return
|
|
1101
|
-
case "ZodBigInt": return
|
|
1102
|
-
case "ZodBoolean": return
|
|
1103
|
-
case "ZodDate": return
|
|
1104
|
-
case "ZodUndefined": return
|
|
1105
|
-
case "ZodNull": return
|
|
1106
|
-
case "ZodArray": return
|
|
1098
|
+
case "ZodString": return B(e, n);
|
|
1099
|
+
case "ZodNumber": return Ut(e);
|
|
1100
|
+
case "ZodObject": return Wt(e, n);
|
|
1101
|
+
case "ZodBigInt": return St(e);
|
|
1102
|
+
case "ZodBoolean": return I();
|
|
1103
|
+
case "ZodDate": return wt(e, n);
|
|
1104
|
+
case "ZodUndefined": return Zt();
|
|
1105
|
+
case "ZodNull": return Rt();
|
|
1106
|
+
case "ZodArray": return xt(e, n);
|
|
1107
1107
|
case "ZodUnion":
|
|
1108
|
-
case "ZodDiscriminatedUnion": return
|
|
1109
|
-
case "ZodIntersection": return
|
|
1110
|
-
case "ZodTuple": return
|
|
1111
|
-
case "ZodRecord": return
|
|
1112
|
-
case "ZodLiteral": return
|
|
1113
|
-
case "ZodEnum": return
|
|
1114
|
-
case "ZodNativeEnum": return
|
|
1115
|
-
case "ZodNullable": return
|
|
1116
|
-
case "ZodOptional": return
|
|
1117
|
-
case "ZodMap": return
|
|
1118
|
-
case "ZodSet": return
|
|
1108
|
+
case "ZodDiscriminatedUnion": return Bt(e, n);
|
|
1109
|
+
case "ZodIntersection": return kt(e, n);
|
|
1110
|
+
case "ZodTuple": return Xt(e, n);
|
|
1111
|
+
case "ZodRecord": return Pt(e, n);
|
|
1112
|
+
case "ZodLiteral": return At(e);
|
|
1113
|
+
case "ZodEnum": return Dt(e);
|
|
1114
|
+
case "ZodNativeEnum": return It(e);
|
|
1115
|
+
case "ZodNullable": return Ht(e, n);
|
|
1116
|
+
case "ZodOptional": return qt(e, n);
|
|
1117
|
+
case "ZodMap": return Ft(e, n);
|
|
1118
|
+
case "ZodSet": return Yt(e, n);
|
|
1119
1119
|
case "ZodLazy": return () => e.getter()._def;
|
|
1120
|
-
case "ZodPromise": return
|
|
1120
|
+
case "ZodPromise": return Jt(e, n);
|
|
1121
1121
|
case "ZodNaN":
|
|
1122
|
-
case "ZodNever": return
|
|
1123
|
-
case "ZodEffects": return
|
|
1124
|
-
case "ZodAny": return
|
|
1125
|
-
case "ZodUnknown": return
|
|
1126
|
-
case "ZodDefault": return
|
|
1127
|
-
case "ZodBranded": return
|
|
1128
|
-
case "ZodReadonly": return
|
|
1129
|
-
case "ZodCatch": return
|
|
1130
|
-
case "ZodPipeline": return
|
|
1122
|
+
case "ZodNever": return Lt();
|
|
1123
|
+
case "ZodEffects": return Et(e, n);
|
|
1124
|
+
case "ZodAny": return F();
|
|
1125
|
+
case "ZodUnknown": return Qt();
|
|
1126
|
+
case "ZodDefault": return R(e, n);
|
|
1127
|
+
case "ZodBranded": return Ct(e, n);
|
|
1128
|
+
case "ZodReadonly": return $t(e, n);
|
|
1129
|
+
case "ZodCatch": return L(e, n);
|
|
1130
|
+
case "ZodPipeline": return G(e, n);
|
|
1131
1131
|
case "ZodFunction":
|
|
1132
1132
|
case "ZodVoid":
|
|
1133
1133
|
case "ZodSymbol": return;
|
|
@@ -1135,19 +1135,19 @@ var Xt = (e, t) => J(e.innerType._def, t), Zt = (e, t, n) => {
|
|
|
1135
1135
|
/* c8 ignore next */
|
|
1136
1136
|
return ((e) => void 0)(t);
|
|
1137
1137
|
}
|
|
1138
|
-
},
|
|
1138
|
+
}, tn = (e, t) => {
|
|
1139
1139
|
let n = 0;
|
|
1140
1140
|
for (; n < e.length && n < t.length && e[n] === t[n]; n++);
|
|
1141
1141
|
return [(e.length - n).toString(), ...t.slice(n)].join("/");
|
|
1142
1142
|
};
|
|
1143
|
-
function
|
|
1143
|
+
function K(e, t, n = !1) {
|
|
1144
1144
|
let r = t.seen.get(e);
|
|
1145
1145
|
if (t.override) {
|
|
1146
1146
|
let i = t.override?.(e, t, r, n);
|
|
1147
|
-
if (i !==
|
|
1147
|
+
if (i !== vt) return i;
|
|
1148
1148
|
}
|
|
1149
1149
|
if (r && !n) {
|
|
1150
|
-
let e =
|
|
1150
|
+
let e = nn(r, t);
|
|
1151
1151
|
if (e !== void 0) return e;
|
|
1152
1152
|
}
|
|
1153
1153
|
let i = {
|
|
@@ -1156,22 +1156,22 @@ function J(e, t, n = !1) {
|
|
|
1156
1156
|
jsonSchema: void 0
|
|
1157
1157
|
};
|
|
1158
1158
|
t.seen.set(e, i);
|
|
1159
|
-
let a =
|
|
1160
|
-
if (o &&
|
|
1159
|
+
let a = en(e, e.typeName, t), o = typeof a == "function" ? K(a(), t) : a;
|
|
1160
|
+
if (o && rn(e, t, o), t.postProcess) {
|
|
1161
1161
|
let n = t.postProcess(o, e, t);
|
|
1162
1162
|
return i.jsonSchema = o, n;
|
|
1163
1163
|
}
|
|
1164
1164
|
return i.jsonSchema = o, o;
|
|
1165
1165
|
}
|
|
1166
|
-
var
|
|
1166
|
+
var nn = (e, t) => {
|
|
1167
1167
|
switch (t.$refStrategy) {
|
|
1168
1168
|
case "root": return { $ref: e.path.join("/") };
|
|
1169
|
-
case "relative": return { $ref:
|
|
1169
|
+
case "relative": return { $ref: tn(t.currentPath, e.path) };
|
|
1170
1170
|
case "none":
|
|
1171
|
-
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`),
|
|
1171
|
+
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`), F()) : t.$refStrategy === "seen" ? F() : void 0;
|
|
1172
1172
|
}
|
|
1173
|
-
},
|
|
1174
|
-
let t =
|
|
1173
|
+
}, rn = (e, t, n) => (e.description && (n.description = e.description), n), an = (e) => {
|
|
1174
|
+
let t = bt(e), n = t.name === void 0 ? t.basePath : [
|
|
1175
1175
|
...t.basePath,
|
|
1176
1176
|
t.definitionPath,
|
|
1177
1177
|
t.name
|
|
@@ -1190,25 +1190,25 @@ var $t = (e, t) => {
|
|
|
1190
1190
|
jsonSchema: void 0
|
|
1191
1191
|
}]))
|
|
1192
1192
|
};
|
|
1193
|
-
},
|
|
1194
|
-
let n =
|
|
1193
|
+
}, on = (e, t) => {
|
|
1194
|
+
let n = an(t), r = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((e, [t, r]) => ({
|
|
1195
1195
|
...e,
|
|
1196
|
-
[t]:
|
|
1196
|
+
[t]: K(r._def, {
|
|
1197
1197
|
...n,
|
|
1198
1198
|
currentPath: [
|
|
1199
1199
|
...n.basePath,
|
|
1200
1200
|
n.definitionPath,
|
|
1201
1201
|
t
|
|
1202
1202
|
]
|
|
1203
|
-
}, !0) ??
|
|
1204
|
-
}), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a =
|
|
1203
|
+
}, !0) ?? F()
|
|
1204
|
+
}), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = K(e._def, i === void 0 ? n : {
|
|
1205
1205
|
...n,
|
|
1206
1206
|
currentPath: [
|
|
1207
1207
|
...n.basePath,
|
|
1208
1208
|
n.definitionPath,
|
|
1209
1209
|
i
|
|
1210
1210
|
]
|
|
1211
|
-
}, !1) ??
|
|
1211
|
+
}, !1) ?? F(), o = typeof t == "object" && t.name !== void 0 && t.nameStrategy === "title" ? t.name : void 0;
|
|
1212
1212
|
o !== void 0 && (a.title = o);
|
|
1213
1213
|
let s = i === void 0 ? r ? {
|
|
1214
1214
|
...a,
|
|
@@ -1225,14 +1225,14 @@ var $t = (e, t) => {
|
|
|
1225
1225
|
}
|
|
1226
1226
|
};
|
|
1227
1227
|
return s.$schema = "http://json-schema.org/draft-07/schema#", s;
|
|
1228
|
-
},
|
|
1229
|
-
function
|
|
1228
|
+
}, sn = Symbol.for("vercel.ai.schema");
|
|
1229
|
+
function cn(e) {
|
|
1230
1230
|
let t;
|
|
1231
1231
|
return () => (t ??= e(), t);
|
|
1232
1232
|
}
|
|
1233
|
-
function
|
|
1233
|
+
function ln(e, { validate: t } = {}) {
|
|
1234
1234
|
return {
|
|
1235
|
-
[
|
|
1235
|
+
[sn]: !0,
|
|
1236
1236
|
_type: void 0,
|
|
1237
1237
|
get jsonSchema() {
|
|
1238
1238
|
return typeof e == "function" && (e = e()), e;
|
|
@@ -1240,20 +1240,20 @@ function on(e, { validate: t } = {}) {
|
|
|
1240
1240
|
validate: t
|
|
1241
1241
|
};
|
|
1242
1242
|
}
|
|
1243
|
-
function
|
|
1244
|
-
return typeof e == "object" && !!e &&
|
|
1243
|
+
function un(e) {
|
|
1244
|
+
return typeof e == "object" && !!e && sn in e && e[sn] === !0 && "jsonSchema" in e && "validate" in e;
|
|
1245
1245
|
}
|
|
1246
|
-
function
|
|
1247
|
-
return e == null ?
|
|
1246
|
+
function dn(e) {
|
|
1247
|
+
return e == null ? ln({
|
|
1248
1248
|
type: "object",
|
|
1249
1249
|
properties: {},
|
|
1250
1250
|
additionalProperties: !1
|
|
1251
|
-
}) :
|
|
1251
|
+
}) : un(e) ? e : "~standard" in e ? e["~standard"].vendor === "zod" ? gn(e) : fn(e) : e();
|
|
1252
1252
|
}
|
|
1253
|
-
function
|
|
1254
|
-
return
|
|
1255
|
-
if (!
|
|
1256
|
-
return
|
|
1253
|
+
function fn(e) {
|
|
1254
|
+
return ln(() => {
|
|
1255
|
+
if (!pn(e)) throw Error(`Standard schema vendor '${e["~standard"].vendor}' does not support JSON Schema conversion.`);
|
|
1256
|
+
return _t(e["~standard"].jsonSchema.input({ target: "draft-07" }));
|
|
1257
1257
|
}, { validate: async (t) => {
|
|
1258
1258
|
let n = await e["~standard"].validate(t);
|
|
1259
1259
|
return "value" in n ? {
|
|
@@ -1261,19 +1261,19 @@ function ln(e) {
|
|
|
1261
1261
|
value: n.value
|
|
1262
1262
|
} : {
|
|
1263
1263
|
success: !1,
|
|
1264
|
-
error: new
|
|
1264
|
+
error: new E({
|
|
1265
1265
|
value: t,
|
|
1266
1266
|
cause: n.issues
|
|
1267
1267
|
})
|
|
1268
1268
|
};
|
|
1269
1269
|
} });
|
|
1270
1270
|
}
|
|
1271
|
-
function
|
|
1271
|
+
function pn(e) {
|
|
1272
1272
|
return e["~standard"].jsonSchema != null;
|
|
1273
1273
|
}
|
|
1274
|
-
function
|
|
1274
|
+
function mn(e, t) {
|
|
1275
1275
|
let n = t?.useReferences ?? !1;
|
|
1276
|
-
return
|
|
1276
|
+
return ln(() => on(e, { $refStrategy: n ? "root" : "none" }), { validate: async (t) => {
|
|
1277
1277
|
let n = await e.safeParseAsync(t);
|
|
1278
1278
|
return n.success ? {
|
|
1279
1279
|
success: !0,
|
|
@@ -1284,9 +1284,9 @@ function dn(e, t) {
|
|
|
1284
1284
|
};
|
|
1285
1285
|
} });
|
|
1286
1286
|
}
|
|
1287
|
-
function
|
|
1287
|
+
function hn(e, r) {
|
|
1288
1288
|
let i = r?.useReferences ?? !1;
|
|
1289
|
-
return
|
|
1289
|
+
return ln(() => _t(n(e, {
|
|
1290
1290
|
target: "draft-7",
|
|
1291
1291
|
io: "input",
|
|
1292
1292
|
reused: i ? "ref" : "inline"
|
|
@@ -1301,27 +1301,27 @@ function fn(e, r) {
|
|
|
1301
1301
|
};
|
|
1302
1302
|
} });
|
|
1303
1303
|
}
|
|
1304
|
-
function
|
|
1304
|
+
function q(e) {
|
|
1305
1305
|
return "_zod" in e;
|
|
1306
1306
|
}
|
|
1307
|
-
function
|
|
1308
|
-
return
|
|
1307
|
+
function gn(e, t) {
|
|
1308
|
+
return q(e) ? hn(e, t) : mn(e, t);
|
|
1309
1309
|
}
|
|
1310
|
-
async function
|
|
1311
|
-
let r = await
|
|
1310
|
+
async function _n({ value: e, schema: t, context: n }) {
|
|
1311
|
+
let r = await vn({
|
|
1312
1312
|
value: e,
|
|
1313
1313
|
schema: t,
|
|
1314
1314
|
context: n
|
|
1315
1315
|
});
|
|
1316
|
-
if (!r.success) throw
|
|
1316
|
+
if (!r.success) throw E.wrap({
|
|
1317
1317
|
value: e,
|
|
1318
1318
|
cause: r.error,
|
|
1319
1319
|
context: n
|
|
1320
1320
|
});
|
|
1321
1321
|
return r.value;
|
|
1322
1322
|
}
|
|
1323
|
-
async function
|
|
1324
|
-
let r =
|
|
1323
|
+
async function vn({ value: e, schema: t, context: n }) {
|
|
1324
|
+
let r = dn(t);
|
|
1325
1325
|
try {
|
|
1326
1326
|
if (r.validate == null) return {
|
|
1327
1327
|
success: !0,
|
|
@@ -1335,7 +1335,7 @@ async function gn({ value: e, schema: t, context: n }) {
|
|
|
1335
1335
|
rawValue: e
|
|
1336
1336
|
} : {
|
|
1337
1337
|
success: !1,
|
|
1338
|
-
error:
|
|
1338
|
+
error: E.wrap({
|
|
1339
1339
|
value: e,
|
|
1340
1340
|
cause: t.error,
|
|
1341
1341
|
context: n
|
|
@@ -1345,7 +1345,7 @@ async function gn({ value: e, schema: t, context: n }) {
|
|
|
1345
1345
|
} catch (t) {
|
|
1346
1346
|
return {
|
|
1347
1347
|
success: !1,
|
|
1348
|
-
error:
|
|
1348
|
+
error: E.wrap({
|
|
1349
1349
|
value: e,
|
|
1350
1350
|
cause: t,
|
|
1351
1351
|
context: n
|
|
@@ -1354,21 +1354,21 @@ async function gn({ value: e, schema: t, context: n }) {
|
|
|
1354
1354
|
};
|
|
1355
1355
|
}
|
|
1356
1356
|
}
|
|
1357
|
-
async function
|
|
1357
|
+
async function yn({ text: e, schema: t }) {
|
|
1358
1358
|
try {
|
|
1359
|
-
let n =
|
|
1359
|
+
let n = gt(e);
|
|
1360
1360
|
return t == null ? {
|
|
1361
1361
|
success: !0,
|
|
1362
1362
|
value: n,
|
|
1363
1363
|
rawValue: n
|
|
1364
|
-
} : await
|
|
1364
|
+
} : await vn({
|
|
1365
1365
|
value: n,
|
|
1366
1366
|
schema: t
|
|
1367
1367
|
});
|
|
1368
1368
|
} catch (t) {
|
|
1369
1369
|
return {
|
|
1370
1370
|
success: !1,
|
|
1371
|
-
error:
|
|
1371
|
+
error: Xe.isInstance(t) ? t : new Xe({
|
|
1372
1372
|
text: e,
|
|
1373
1373
|
cause: t
|
|
1374
1374
|
}),
|
|
@@ -1376,42 +1376,42 @@ async function _n({ text: e, schema: t }) {
|
|
|
1376
1376
|
};
|
|
1377
1377
|
}
|
|
1378
1378
|
}
|
|
1379
|
-
function
|
|
1380
|
-
return e.pipeThrough(new TextDecoderStream()).pipeThrough(new
|
|
1381
|
-
e !== "[DONE]" && n.enqueue(await
|
|
1379
|
+
function bn({ stream: e, schema: t }) {
|
|
1380
|
+
return e.pipeThrough(new TextDecoderStream()).pipeThrough(new ct()).pipeThrough(new TransformStream({ async transform({ data: e }, n) {
|
|
1381
|
+
e !== "[DONE]" && n.enqueue(await yn({
|
|
1382
1382
|
text: e,
|
|
1383
1383
|
schema: t
|
|
1384
1384
|
}));
|
|
1385
1385
|
} }));
|
|
1386
1386
|
}
|
|
1387
|
-
async function
|
|
1387
|
+
async function xn(e) {
|
|
1388
1388
|
return typeof e == "function" && (e = e()), e;
|
|
1389
1389
|
}
|
|
1390
1390
|
new TextDecoder();
|
|
1391
1391
|
//#endregion
|
|
1392
1392
|
//#region ../../node_modules/.pnpm/ai@7.0.140_zod@4.6.7/node_modules/ai/dist/index.js
|
|
1393
|
-
var
|
|
1393
|
+
var Sn = "AI_InvalidArgumentError", Cn = `vercel.ai.error.${Sn}`, wn = Symbol.for(Cn), Tn = class extends C {
|
|
1394
1394
|
constructor({ parameter: e, value: t, message: n }) {
|
|
1395
1395
|
super({
|
|
1396
|
-
name:
|
|
1396
|
+
name: Sn,
|
|
1397
1397
|
message: `Invalid argument for parameter ${e}: ${n}`
|
|
1398
|
-
}), this[
|
|
1398
|
+
}), this[wn] = !0, this.parameter = e, this.value = t;
|
|
1399
1399
|
}
|
|
1400
1400
|
static isInstance(e) {
|
|
1401
|
-
return
|
|
1401
|
+
return C.hasMarker(e, Cn);
|
|
1402
1402
|
}
|
|
1403
|
-
},
|
|
1403
|
+
}, En = "AI_UIMessageStreamError", Dn = `vercel.ai.error.${En}`, On = Symbol.for(Dn), J = class extends C {
|
|
1404
1404
|
constructor({ chunkType: e, chunkId: t, message: n }) {
|
|
1405
1405
|
super({
|
|
1406
|
-
name:
|
|
1406
|
+
name: En,
|
|
1407
1407
|
message: n
|
|
1408
|
-
}), this[
|
|
1408
|
+
}), this[On] = !0, this.chunkType = e, this.chunkId = t;
|
|
1409
1409
|
}
|
|
1410
1410
|
static isInstance(e) {
|
|
1411
|
-
return
|
|
1411
|
+
return C.hasMarker(e, Dn);
|
|
1412
1412
|
}
|
|
1413
1413
|
};
|
|
1414
|
-
function
|
|
1414
|
+
function kn(e, t) {
|
|
1415
1415
|
if (e === void 0 && t === void 0) return;
|
|
1416
1416
|
if (e === void 0) return t;
|
|
1417
1417
|
if (t === void 0) return e;
|
|
@@ -1420,7 +1420,7 @@ function On(e, t) {
|
|
|
1420
1420
|
let i = t[r];
|
|
1421
1421
|
if (i === void 0) continue;
|
|
1422
1422
|
let a = r in e ? e[r] : void 0, o = typeof i == "object" && !!i && !Array.isArray(i) && !(i instanceof Date) && !(i instanceof RegExp), s = typeof a == "object" && !!a && !Array.isArray(a) && !(a instanceof Date) && !(a instanceof RegExp);
|
|
1423
|
-
n[r] = o && s ?
|
|
1423
|
+
n[r] = o && s ? kn(a, i) : i;
|
|
1424
1424
|
}
|
|
1425
1425
|
return n;
|
|
1426
1426
|
}
|
|
@@ -1449,28 +1449,28 @@ var Y = {
|
|
|
1449
1449
|
Y.boolean(),
|
|
1450
1450
|
Y.record(Y.string(), X.optional()),
|
|
1451
1451
|
Y.array(X)
|
|
1452
|
-
])), Z = Y.record(Y.string(), Y.record(Y.string(), X.optional())),
|
|
1452
|
+
])), Z = Y.record(Y.string(), Y.record(Y.string(), X.optional())), An = Y.union([
|
|
1453
1453
|
Y.string(),
|
|
1454
1454
|
Y.instanceof(Uint8Array),
|
|
1455
1455
|
Y.instanceof(ArrayBuffer),
|
|
1456
|
-
Y.custom(
|
|
1457
|
-
]),
|
|
1456
|
+
Y.custom(N, { message: "Must be a Buffer" })
|
|
1457
|
+
]), jn = Y.record(Y.string(), Y.string()), Mn = Y.object({
|
|
1458
1458
|
type: Y.literal("text"),
|
|
1459
1459
|
text: Y.string(),
|
|
1460
1460
|
providerOptions: Z.optional()
|
|
1461
|
-
}),
|
|
1461
|
+
}), Nn = Y.object({
|
|
1462
1462
|
type: Y.literal("image"),
|
|
1463
1463
|
image: Y.union([
|
|
1464
|
-
|
|
1464
|
+
An,
|
|
1465
1465
|
Y.instanceof(URL),
|
|
1466
|
-
|
|
1466
|
+
jn
|
|
1467
1467
|
]),
|
|
1468
1468
|
mediaType: Y.string().optional(),
|
|
1469
1469
|
providerOptions: Z.optional()
|
|
1470
|
-
}),
|
|
1470
|
+
}), Pn = Y.discriminatedUnion("type", [
|
|
1471
1471
|
Y.object({
|
|
1472
1472
|
type: Y.literal("data"),
|
|
1473
|
-
data:
|
|
1473
|
+
data: An
|
|
1474
1474
|
}),
|
|
1475
1475
|
Y.object({
|
|
1476
1476
|
type: Y.literal("url"),
|
|
@@ -1478,54 +1478,54 @@ var Y = {
|
|
|
1478
1478
|
}),
|
|
1479
1479
|
Y.object({
|
|
1480
1480
|
type: Y.literal("reference"),
|
|
1481
|
-
reference:
|
|
1481
|
+
reference: jn
|
|
1482
1482
|
}),
|
|
1483
1483
|
Y.object({
|
|
1484
1484
|
type: Y.literal("text"),
|
|
1485
1485
|
text: Y.string()
|
|
1486
1486
|
})
|
|
1487
|
-
]),
|
|
1487
|
+
]), Fn = Y.discriminatedUnion("type", [Y.object({
|
|
1488
1488
|
type: Y.literal("data"),
|
|
1489
|
-
data:
|
|
1489
|
+
data: An
|
|
1490
1490
|
}), Y.object({
|
|
1491
1491
|
type: Y.literal("url"),
|
|
1492
1492
|
url: Y.instanceof(URL)
|
|
1493
|
-
})]),
|
|
1493
|
+
})]), In = Y.object({
|
|
1494
1494
|
type: Y.literal("file"),
|
|
1495
1495
|
data: Y.union([
|
|
1496
|
-
|
|
1497
|
-
|
|
1496
|
+
Pn,
|
|
1497
|
+
An,
|
|
1498
1498
|
Y.instanceof(URL),
|
|
1499
|
-
|
|
1499
|
+
jn
|
|
1500
1500
|
]),
|
|
1501
1501
|
filename: Y.string().optional(),
|
|
1502
1502
|
mediaType: Y.string(),
|
|
1503
1503
|
providerOptions: Z.optional()
|
|
1504
|
-
}),
|
|
1504
|
+
}), Ln = Y.object({
|
|
1505
1505
|
type: Y.literal("reasoning"),
|
|
1506
1506
|
text: Y.string(),
|
|
1507
1507
|
providerOptions: Z.optional()
|
|
1508
|
-
}),
|
|
1508
|
+
}), Rn = Y.object({
|
|
1509
1509
|
type: Y.literal("custom"),
|
|
1510
1510
|
kind: Y.string().transform((e) => e),
|
|
1511
1511
|
providerOptions: Z.optional()
|
|
1512
|
-
}),
|
|
1512
|
+
}), zn = Y.object({
|
|
1513
1513
|
type: Y.literal("reasoning-file"),
|
|
1514
1514
|
data: Y.union([
|
|
1515
|
-
|
|
1516
|
-
|
|
1515
|
+
Fn,
|
|
1516
|
+
An,
|
|
1517
1517
|
Y.instanceof(URL)
|
|
1518
1518
|
]),
|
|
1519
1519
|
mediaType: Y.string(),
|
|
1520
1520
|
providerOptions: Z.optional()
|
|
1521
|
-
}),
|
|
1521
|
+
}), Bn = Y.object({
|
|
1522
1522
|
type: Y.literal("tool-call"),
|
|
1523
1523
|
toolCallId: Y.string(),
|
|
1524
1524
|
toolName: Y.string(),
|
|
1525
1525
|
input: Y.unknown(),
|
|
1526
1526
|
providerOptions: Z.optional(),
|
|
1527
1527
|
providerExecuted: Y.boolean().optional()
|
|
1528
|
-
}),
|
|
1528
|
+
}), Vn = Y.discriminatedUnion("type", [
|
|
1529
1529
|
Y.object({
|
|
1530
1530
|
type: Y.literal("text"),
|
|
1531
1531
|
value: Y.string(),
|
|
@@ -1561,7 +1561,7 @@ var Y = {
|
|
|
1561
1561
|
}),
|
|
1562
1562
|
Y.object({
|
|
1563
1563
|
type: Y.literal("file"),
|
|
1564
|
-
data:
|
|
1564
|
+
data: Pn,
|
|
1565
1565
|
mediaType: Y.string(),
|
|
1566
1566
|
filename: Y.string().optional(),
|
|
1567
1567
|
providerOptions: Z.optional()
|
|
@@ -1616,13 +1616,13 @@ var Y = {
|
|
|
1616
1616
|
})
|
|
1617
1617
|
]))
|
|
1618
1618
|
})
|
|
1619
|
-
]),
|
|
1619
|
+
]), Hn = Y.object({
|
|
1620
1620
|
type: Y.literal("tool-result"),
|
|
1621
1621
|
toolCallId: Y.string(),
|
|
1622
1622
|
toolName: Y.string(),
|
|
1623
|
-
output:
|
|
1623
|
+
output: Vn,
|
|
1624
1624
|
providerOptions: Z.optional()
|
|
1625
|
-
}),
|
|
1625
|
+
}), Un = Y.object({
|
|
1626
1626
|
type: Y.literal("tool-approval-request"),
|
|
1627
1627
|
approvalId: Y.string(),
|
|
1628
1628
|
toolCallId: Y.string(),
|
|
@@ -1630,48 +1630,48 @@ var Y = {
|
|
|
1630
1630
|
isAutomatic: Y.boolean().optional(),
|
|
1631
1631
|
signature: Y.string().optional(),
|
|
1632
1632
|
inputSchemaInput: Y.unknown().optional()
|
|
1633
|
-
}),
|
|
1633
|
+
}), Wn = Y.object({
|
|
1634
1634
|
type: Y.literal("tool-approval-response"),
|
|
1635
1635
|
approvalId: Y.string(),
|
|
1636
1636
|
approved: Y.boolean(),
|
|
1637
1637
|
reason: Y.string().optional()
|
|
1638
|
-
}),
|
|
1638
|
+
}), Gn = Y.object({
|
|
1639
1639
|
role: Y.literal("system"),
|
|
1640
1640
|
content: Y.string(),
|
|
1641
1641
|
providerOptions: Z.optional()
|
|
1642
|
-
}),
|
|
1642
|
+
}), Kn = Y.object({
|
|
1643
1643
|
role: Y.literal("user"),
|
|
1644
1644
|
content: Y.union([Y.string(), Y.array(Y.union([
|
|
1645
|
-
jn,
|
|
1646
1645
|
Mn,
|
|
1647
|
-
|
|
1646
|
+
Nn,
|
|
1647
|
+
In
|
|
1648
1648
|
]))]),
|
|
1649
1649
|
providerOptions: Z.optional()
|
|
1650
|
-
}),
|
|
1650
|
+
}), qn = Y.object({
|
|
1651
1651
|
role: Y.literal("assistant"),
|
|
1652
1652
|
content: Y.union([Y.string(), Y.array(Y.union([
|
|
1653
|
-
|
|
1654
|
-
Ln,
|
|
1655
|
-
Fn,
|
|
1656
|
-
In,
|
|
1653
|
+
Mn,
|
|
1657
1654
|
Rn,
|
|
1655
|
+
In,
|
|
1656
|
+
Ln,
|
|
1658
1657
|
zn,
|
|
1659
|
-
|
|
1660
|
-
Hn
|
|
1658
|
+
Bn,
|
|
1659
|
+
Hn,
|
|
1660
|
+
Un
|
|
1661
1661
|
]))]),
|
|
1662
1662
|
providerOptions: Z.optional()
|
|
1663
|
-
}),
|
|
1663
|
+
}), Jn = Y.object({
|
|
1664
1664
|
role: Y.literal("tool"),
|
|
1665
|
-
content: Y.array(Y.union([
|
|
1665
|
+
content: Y.array(Y.union([Hn, Wn])),
|
|
1666
1666
|
providerOptions: Z.optional()
|
|
1667
1667
|
});
|
|
1668
1668
|
Y.union([
|
|
1669
|
-
Wn,
|
|
1670
1669
|
Gn,
|
|
1671
1670
|
Kn,
|
|
1672
|
-
qn
|
|
1671
|
+
qn,
|
|
1672
|
+
Jn
|
|
1673
1673
|
]);
|
|
1674
|
-
function
|
|
1674
|
+
function Yn(e) {
|
|
1675
1675
|
let t = ["ROOT"], n = -1, r = null, i = 0;
|
|
1676
1676
|
function a(e) {
|
|
1677
1677
|
return e >= "0" && e <= "9" || e >= "A" && e <= "F" || e >= "a" && e <= "f";
|
|
@@ -1853,16 +1853,16 @@ function Jn(e) {
|
|
|
1853
1853
|
}
|
|
1854
1854
|
return l;
|
|
1855
1855
|
}
|
|
1856
|
-
async function
|
|
1856
|
+
async function Xn(e) {
|
|
1857
1857
|
if (e === void 0) return {
|
|
1858
1858
|
value: void 0,
|
|
1859
1859
|
state: "undefined-input"
|
|
1860
1860
|
};
|
|
1861
|
-
let t = await
|
|
1861
|
+
let t = await yn({ text: e });
|
|
1862
1862
|
return t.success ? {
|
|
1863
1863
|
value: t.value,
|
|
1864
1864
|
state: "successful-parse"
|
|
1865
|
-
} : (t = await
|
|
1865
|
+
} : (t = await yn({ text: Yn(e) }), t.success ? {
|
|
1866
1866
|
value: t.value,
|
|
1867
1867
|
state: "repaired-parse"
|
|
1868
1868
|
} : {
|
|
@@ -1870,14 +1870,14 @@ async function Yn(e) {
|
|
|
1870
1870
|
state: "failed-parse"
|
|
1871
1871
|
});
|
|
1872
1872
|
}
|
|
1873
|
-
new TextEncoder(), new TextEncoder(),
|
|
1873
|
+
new TextEncoder(), new TextEncoder(), M({
|
|
1874
1874
|
prefix: "aitxt",
|
|
1875
1875
|
size: 24
|
|
1876
|
-
}),
|
|
1876
|
+
}), M({
|
|
1877
1877
|
prefix: "call",
|
|
1878
1878
|
size: 24
|
|
1879
1879
|
}), TransformStream;
|
|
1880
|
-
var
|
|
1880
|
+
var Zn = Y.object({
|
|
1881
1881
|
source: Y.discriminatedUnion("sourceType", [Y.object({
|
|
1882
1882
|
type: Y.literal("source"),
|
|
1883
1883
|
sourceType: Y.literal("url"),
|
|
@@ -1897,7 +1897,7 @@ var Xn = Y.object({
|
|
|
1897
1897
|
startIndex: Y.number().int().nonnegative().optional(),
|
|
1898
1898
|
endIndex: Y.number().int().nonnegative().optional(),
|
|
1899
1899
|
citedText: Y.string().optional()
|
|
1900
|
-
}),
|
|
1900
|
+
}), Qn = Y.record(Y.string(), X.optional()), $n = cn(() => gn(Y.union([
|
|
1901
1901
|
Y.looseObject({
|
|
1902
1902
|
type: Y.literal("text-start"),
|
|
1903
1903
|
id: Y.string(),
|
|
@@ -1912,7 +1912,7 @@ var Xn = Y.object({
|
|
|
1912
1912
|
Y.looseObject({
|
|
1913
1913
|
type: Y.literal("text-end"),
|
|
1914
1914
|
id: Y.string(),
|
|
1915
|
-
citations: Y.array(
|
|
1915
|
+
citations: Y.array(Zn).optional(),
|
|
1916
1916
|
providerMetadata: Z.optional()
|
|
1917
1917
|
}),
|
|
1918
1918
|
Y.looseObject({
|
|
@@ -1925,7 +1925,7 @@ var Xn = Y.object({
|
|
|
1925
1925
|
toolName: Y.string(),
|
|
1926
1926
|
providerExecuted: Y.boolean().optional(),
|
|
1927
1927
|
providerMetadata: Z.optional(),
|
|
1928
|
-
toolMetadata:
|
|
1928
|
+
toolMetadata: Qn.optional(),
|
|
1929
1929
|
dynamic: Y.boolean().optional(),
|
|
1930
1930
|
title: Y.string().optional()
|
|
1931
1931
|
}),
|
|
@@ -1941,7 +1941,7 @@ var Xn = Y.object({
|
|
|
1941
1941
|
input: Y.unknown(),
|
|
1942
1942
|
providerExecuted: Y.boolean().optional(),
|
|
1943
1943
|
providerMetadata: Z.optional(),
|
|
1944
|
-
toolMetadata:
|
|
1944
|
+
toolMetadata: Qn.optional(),
|
|
1945
1945
|
dynamic: Y.boolean().optional(),
|
|
1946
1946
|
title: Y.string().optional()
|
|
1947
1947
|
}),
|
|
@@ -1952,7 +1952,7 @@ var Xn = Y.object({
|
|
|
1952
1952
|
input: Y.unknown(),
|
|
1953
1953
|
providerExecuted: Y.boolean().optional(),
|
|
1954
1954
|
providerMetadata: Z.optional(),
|
|
1955
|
-
toolMetadata:
|
|
1955
|
+
toolMetadata: Qn.optional(),
|
|
1956
1956
|
dynamic: Y.boolean().optional(),
|
|
1957
1957
|
errorText: Y.string(),
|
|
1958
1958
|
title: Y.string().optional()
|
|
@@ -1981,7 +1981,7 @@ var Xn = Y.object({
|
|
|
1981
1981
|
output: Y.unknown(),
|
|
1982
1982
|
providerExecuted: Y.boolean().optional(),
|
|
1983
1983
|
providerMetadata: Z.optional(),
|
|
1984
|
-
toolMetadata:
|
|
1984
|
+
toolMetadata: Qn.optional(),
|
|
1985
1985
|
dynamic: Y.boolean().optional(),
|
|
1986
1986
|
preliminary: Y.boolean().optional()
|
|
1987
1987
|
}),
|
|
@@ -1991,7 +1991,7 @@ var Xn = Y.object({
|
|
|
1991
1991
|
errorText: Y.string(),
|
|
1992
1992
|
providerExecuted: Y.boolean().optional(),
|
|
1993
1993
|
providerMetadata: Z.optional(),
|
|
1994
|
-
toolMetadata:
|
|
1994
|
+
toolMetadata: Qn.optional(),
|
|
1995
1995
|
dynamic: Y.boolean().optional()
|
|
1996
1996
|
}),
|
|
1997
1997
|
Y.looseObject({
|
|
@@ -2081,38 +2081,38 @@ var Xn = Y.object({
|
|
|
2081
2081
|
messageMetadata: Y.unknown()
|
|
2082
2082
|
})
|
|
2083
2083
|
])));
|
|
2084
|
-
function
|
|
2084
|
+
function er(e) {
|
|
2085
2085
|
return e.type.startsWith("data-");
|
|
2086
2086
|
}
|
|
2087
|
-
function
|
|
2087
|
+
function tr() {
|
|
2088
2088
|
return Object.create(null);
|
|
2089
2089
|
}
|
|
2090
|
-
function
|
|
2090
|
+
function nr(e) {
|
|
2091
2091
|
return e.type.startsWith("tool-");
|
|
2092
2092
|
}
|
|
2093
|
-
function
|
|
2093
|
+
function rr(e) {
|
|
2094
2094
|
return e.type === "dynamic-tool";
|
|
2095
2095
|
}
|
|
2096
2096
|
function Q(e) {
|
|
2097
|
-
return
|
|
2097
|
+
return nr(e) || rr(e);
|
|
2098
2098
|
}
|
|
2099
|
-
function
|
|
2099
|
+
function ir(e) {
|
|
2100
2100
|
return e.type.split("-").slice(1).join("-");
|
|
2101
2101
|
}
|
|
2102
|
-
function
|
|
2102
|
+
function ar({ lastMessage: e, messageId: t }) {
|
|
2103
2103
|
let n = e?.role === "assistant" ? e : {
|
|
2104
2104
|
id: t,
|
|
2105
2105
|
metadata: void 0,
|
|
2106
2106
|
role: "assistant",
|
|
2107
2107
|
parts: []
|
|
2108
|
-
}, r =
|
|
2108
|
+
}, r = tr(), i = n.parts.findLastIndex((e) => e.type === "step-start"), a = 0;
|
|
2109
2109
|
for (let e of n.parts.slice(i + 1)) {
|
|
2110
2110
|
if (!Q(e)) continue;
|
|
2111
2111
|
let t = a;
|
|
2112
|
-
|
|
2112
|
+
nr(e) && a++, e.state === "input-streaming" && (r[e.toolCallId] = {
|
|
2113
2113
|
text: e.rawInput ?? "",
|
|
2114
2114
|
index: t,
|
|
2115
|
-
toolName: e.type === "dynamic-tool" ? e.toolName :
|
|
2115
|
+
toolName: e.type === "dynamic-tool" ? e.toolName : ir(e),
|
|
2116
2116
|
dynamic: e.type === "dynamic-tool",
|
|
2117
2117
|
title: e.title,
|
|
2118
2118
|
toolMetadata: e.toolMetadata
|
|
@@ -2120,12 +2120,12 @@ function ir({ lastMessage: e, messageId: t }) {
|
|
|
2120
2120
|
}
|
|
2121
2121
|
return {
|
|
2122
2122
|
message: n,
|
|
2123
|
-
activeTextParts:
|
|
2124
|
-
activeReasoningParts:
|
|
2123
|
+
activeTextParts: tr(),
|
|
2124
|
+
activeReasoningParts: tr(),
|
|
2125
2125
|
partialToolCalls: r
|
|
2126
2126
|
};
|
|
2127
2127
|
}
|
|
2128
|
-
function
|
|
2128
|
+
function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdateMessageJob: r, onError: i, onToolCall: a, onData: o, resetStateOnMessageIdChange: s = !1, resetStateOnFirstMessageStart: c = !1 }) {
|
|
2129
2129
|
let l = !0;
|
|
2130
2130
|
return e.pipeThrough(new TransformStream({ async transform(e, u) {
|
|
2131
2131
|
await r(async ({ state: r, write: d }) => {
|
|
@@ -2149,7 +2149,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2149
2149
|
}
|
|
2150
2150
|
}
|
|
2151
2151
|
}
|
|
2152
|
-
if (t == null) throw new
|
|
2152
|
+
if (t == null) throw new J({
|
|
2153
2153
|
chunkType: "tool-invocation",
|
|
2154
2154
|
chunkId: e,
|
|
2155
2155
|
message: `No tool invocation found for tool call ID "${e}".`
|
|
@@ -2158,7 +2158,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2158
2158
|
}
|
|
2159
2159
|
function h(e) {
|
|
2160
2160
|
let t = r.message.parts.filter(Q).find((t) => t.approval?.id === e);
|
|
2161
|
-
if (t == null) throw new
|
|
2161
|
+
if (t == null) throw new J({
|
|
2162
2162
|
chunkType: "tool-approval-response",
|
|
2163
2163
|
chunkId: e,
|
|
2164
2164
|
message: `No tool invocation found for approval ID "${e}".`
|
|
@@ -2166,7 +2166,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2166
2166
|
return t;
|
|
2167
2167
|
}
|
|
2168
2168
|
function g(e, t) {
|
|
2169
|
-
let n = t ?? f().find((t) =>
|
|
2169
|
+
let n = t ?? f().find((t) => nr(t) && t.toolCallId === e.toolCallId), i = e, a = n;
|
|
2170
2170
|
if (n != null) {
|
|
2171
2171
|
n.state = e.state, a.input = i.input, a.output = i.output, a.errorText = i.errorText, a.rawInput = i.rawInput, a.preliminary = i.preliminary, e.title !== void 0 && (a.title = e.title), e.toolMetadata !== void 0 && (a.toolMetadata = e.toolMetadata), a.providerExecuted = i.providerExecuted ?? n.providerExecuted;
|
|
2172
2172
|
let t = i.providerMetadata;
|
|
@@ -2221,8 +2221,8 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2221
2221
|
}
|
|
2222
2222
|
async function v(e) {
|
|
2223
2223
|
if (e != null) {
|
|
2224
|
-
let n = r.message.metadata == null ? e :
|
|
2225
|
-
t != null && await
|
|
2224
|
+
let n = r.message.metadata == null ? e : kn(r.message.metadata, e);
|
|
2225
|
+
t != null && await _n({
|
|
2226
2226
|
value: n,
|
|
2227
2227
|
schema: t,
|
|
2228
2228
|
context: {
|
|
@@ -2245,7 +2245,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2245
2245
|
}
|
|
2246
2246
|
case "text-delta": {
|
|
2247
2247
|
let t = r.activeTextParts[e.id];
|
|
2248
|
-
if (t == null) throw new
|
|
2248
|
+
if (t == null) throw new J({
|
|
2249
2249
|
chunkType: "text-delta",
|
|
2250
2250
|
chunkId: e.id,
|
|
2251
2251
|
message: `Received text-delta for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`
|
|
@@ -2255,7 +2255,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2255
2255
|
}
|
|
2256
2256
|
case "text-end": {
|
|
2257
2257
|
let t = r.activeTextParts[e.id];
|
|
2258
|
-
if (t == null) throw new
|
|
2258
|
+
if (t == null) throw new J({
|
|
2259
2259
|
chunkType: "text-end",
|
|
2260
2260
|
chunkId: e.id,
|
|
2261
2261
|
message: `Received text-end for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`
|
|
@@ -2285,7 +2285,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2285
2285
|
}
|
|
2286
2286
|
case "reasoning-delta": {
|
|
2287
2287
|
let t = r.activeReasoningParts[e.id];
|
|
2288
|
-
if (t == null) throw new
|
|
2288
|
+
if (t == null) throw new J({
|
|
2289
2289
|
chunkType: "reasoning-delta",
|
|
2290
2290
|
chunkId: e.id,
|
|
2291
2291
|
message: `Received reasoning-delta for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`
|
|
@@ -2295,7 +2295,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2295
2295
|
}
|
|
2296
2296
|
case "reasoning-end": {
|
|
2297
2297
|
let t = r.activeReasoningParts[e.id];
|
|
2298
|
-
if (t == null) throw new
|
|
2298
|
+
if (t == null) throw new J({
|
|
2299
2299
|
chunkType: "reasoning-end",
|
|
2300
2300
|
chunkId: e.id,
|
|
2301
2301
|
message: `Received reasoning-end for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`
|
|
@@ -2332,7 +2332,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2332
2332
|
}), d();
|
|
2333
2333
|
break;
|
|
2334
2334
|
case "tool-input-start": {
|
|
2335
|
-
let t = f().filter(
|
|
2335
|
+
let t = f().filter(nr);
|
|
2336
2336
|
r.partialToolCalls[e.toolCallId] = {
|
|
2337
2337
|
text: "",
|
|
2338
2338
|
toolName: e.toolName,
|
|
@@ -2363,13 +2363,13 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2363
2363
|
}
|
|
2364
2364
|
case "tool-input-delta": {
|
|
2365
2365
|
let t = r.partialToolCalls[e.toolCallId];
|
|
2366
|
-
if (t == null) throw new
|
|
2366
|
+
if (t == null) throw new J({
|
|
2367
2367
|
chunkType: "tool-input-delta",
|
|
2368
2368
|
chunkId: e.toolCallId,
|
|
2369
2369
|
message: `Received tool-input-delta for missing tool call with ID "${e.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`
|
|
2370
2370
|
});
|
|
2371
2371
|
t.text += e.inputTextDelta;
|
|
2372
|
-
let { value: n } = await
|
|
2372
|
+
let { value: n } = await Xn(t.text);
|
|
2373
2373
|
t.dynamic ? _({
|
|
2374
2374
|
toolCallId: e.toolCallId,
|
|
2375
2375
|
toolName: t.toolName,
|
|
@@ -2475,7 +2475,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2475
2475
|
toolMetadata: e.toolMetadata ?? t.toolMetadata
|
|
2476
2476
|
}, t) : g({
|
|
2477
2477
|
toolCallId: e.toolCallId,
|
|
2478
|
-
toolName:
|
|
2478
|
+
toolName: ir(t),
|
|
2479
2479
|
state: "output-available",
|
|
2480
2480
|
input: t.input,
|
|
2481
2481
|
output: e.output,
|
|
@@ -2501,7 +2501,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2501
2501
|
toolMetadata: e.toolMetadata ?? t.toolMetadata
|
|
2502
2502
|
}, t) : g({
|
|
2503
2503
|
toolCallId: e.toolCallId,
|
|
2504
|
-
toolName:
|
|
2504
|
+
toolName: ir(t),
|
|
2505
2505
|
state: "output-error",
|
|
2506
2506
|
input: t.input,
|
|
2507
2507
|
rawInput: t.rawInput,
|
|
@@ -2519,12 +2519,12 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2519
2519
|
case "finish-step": break;
|
|
2520
2520
|
case "reset-step": {
|
|
2521
2521
|
let e = f();
|
|
2522
|
-
r.activeTextParts =
|
|
2522
|
+
r.activeTextParts = tr(), r.activeReasoningParts = tr(), r.partialToolCalls = tr(), e.length > 0 && (r.message.parts.splice(r.message.parts.length - e.length, e.length), d());
|
|
2523
2523
|
break;
|
|
2524
2524
|
}
|
|
2525
2525
|
case "start": {
|
|
2526
2526
|
let t = c && l || s && e.messageId != null && e.messageId !== r.message.id;
|
|
2527
|
-
l = !1, t && Object.assign(r,
|
|
2527
|
+
l = !1, t && Object.assign(r, ar({
|
|
2528
2528
|
lastMessage: void 0,
|
|
2529
2529
|
messageId: e.messageId ?? r.message.id
|
|
2530
2530
|
}), { finishReason: void 0 }), e.messageId != null && (r.message.id = e.messageId), await v(e.messageMetadata), (t || e.messageId != null || e.messageMetadata != null) && d({ updateStatus: !1 });
|
|
@@ -2539,10 +2539,10 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2539
2539
|
case "error":
|
|
2540
2540
|
i?.(Error(e.errorText));
|
|
2541
2541
|
break;
|
|
2542
|
-
default: if (
|
|
2542
|
+
default: if (er(e)) {
|
|
2543
2543
|
if (n?.[e.type] != null) {
|
|
2544
2544
|
let t = r.message.parts.findIndex((t) => "id" in t && "data" in t && t.id === e.id && t.type === e.type), i = t >= 0 ? t : r.message.parts.length;
|
|
2545
|
-
await
|
|
2545
|
+
await _n({
|
|
2546
2546
|
value: e.data,
|
|
2547
2547
|
schema: n[e.type],
|
|
2548
2548
|
context: {
|
|
@@ -2565,7 +2565,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2565
2565
|
});
|
|
2566
2566
|
} }));
|
|
2567
2567
|
}
|
|
2568
|
-
async function
|
|
2568
|
+
async function sr({ stream: e, onError: t, abortSignal: n }) {
|
|
2569
2569
|
let r = e.getReader(), i = () => {
|
|
2570
2570
|
r.cancel().catch(() => {});
|
|
2571
2571
|
};
|
|
@@ -2581,7 +2581,7 @@ async function or({ stream: e, onError: t, abortSignal: n }) {
|
|
|
2581
2581
|
n?.removeEventListener("abort", i), r.releaseLock();
|
|
2582
2582
|
}
|
|
2583
2583
|
}
|
|
2584
|
-
function
|
|
2584
|
+
function cr() {
|
|
2585
2585
|
let e, t;
|
|
2586
2586
|
return {
|
|
2587
2587
|
promise: new Promise((n, r) => {
|
|
@@ -2591,32 +2591,32 @@ function sr() {
|
|
|
2591
2591
|
reject: t
|
|
2592
2592
|
};
|
|
2593
2593
|
}
|
|
2594
|
-
|
|
2594
|
+
M({
|
|
2595
2595
|
prefix: "aitxt",
|
|
2596
2596
|
size: 24
|
|
2597
|
-
}),
|
|
2597
|
+
}), M({
|
|
2598
2598
|
prefix: "call",
|
|
2599
2599
|
size: 24
|
|
2600
|
-
}),
|
|
2600
|
+
}), M({
|
|
2601
2601
|
prefix: "aitxt",
|
|
2602
2602
|
size: 24
|
|
2603
|
-
}),
|
|
2603
|
+
}), M({
|
|
2604
2604
|
prefix: "call",
|
|
2605
2605
|
size: 24
|
|
2606
|
-
}), Y.record(Y.string(), X.optional()), Y.record(Y.string(), Y.string()),
|
|
2606
|
+
}), Y.record(Y.string(), X.optional()), Y.record(Y.string(), Y.string()), M({
|
|
2607
2607
|
prefix: "call",
|
|
2608
2608
|
size: 24
|
|
2609
|
-
}),
|
|
2609
|
+
}), M({
|
|
2610
2610
|
prefix: "call",
|
|
2611
2611
|
size: 24
|
|
2612
|
-
}), new TextEncoder(),
|
|
2612
|
+
}), new TextEncoder(), M({
|
|
2613
2613
|
prefix: "call",
|
|
2614
2614
|
size: 24
|
|
2615
|
-
}),
|
|
2615
|
+
}), M({
|
|
2616
2616
|
prefix: "aiobj",
|
|
2617
2617
|
size: 24
|
|
2618
2618
|
});
|
|
2619
|
-
var { atob:
|
|
2619
|
+
var { atob: lr } = globalThis, ur = class {
|
|
2620
2620
|
constructor() {
|
|
2621
2621
|
this.queue = [], this.isProcessing = !1, this.idleWaiters = [];
|
|
2622
2622
|
}
|
|
@@ -2648,10 +2648,10 @@ var { atob: cr } = globalThis, lr = class {
|
|
|
2648
2648
|
});
|
|
2649
2649
|
}
|
|
2650
2650
|
};
|
|
2651
|
-
|
|
2651
|
+
M({
|
|
2652
2652
|
prefix: "aiobj",
|
|
2653
2653
|
size: 24
|
|
2654
|
-
}),
|
|
2654
|
+
}), M({
|
|
2655
2655
|
prefix: "call",
|
|
2656
2656
|
size: 24
|
|
2657
2657
|
}), Y.object({
|
|
@@ -2671,19 +2671,19 @@ F({
|
|
|
2671
2671
|
description: Y.string().optional(),
|
|
2672
2672
|
parameters: Y.record(Y.string(), Y.unknown())
|
|
2673
2673
|
})).optional()
|
|
2674
|
-
}),
|
|
2674
|
+
}), M({
|
|
2675
2675
|
prefix: "call",
|
|
2676
2676
|
size: 24
|
|
2677
|
-
}),
|
|
2677
|
+
}), M({
|
|
2678
2678
|
prefix: "call",
|
|
2679
2679
|
size: 24
|
|
2680
|
-
}),
|
|
2680
|
+
}), M({
|
|
2681
2681
|
prefix: "call",
|
|
2682
2682
|
size: 24
|
|
2683
2683
|
});
|
|
2684
|
-
async function
|
|
2684
|
+
async function dr({ response: e, url: t, fallbackMessage: n }) {
|
|
2685
2685
|
let r = await e.text();
|
|
2686
|
-
return new
|
|
2686
|
+
return new ze({
|
|
2687
2687
|
message: r || n,
|
|
2688
2688
|
url: t,
|
|
2689
2689
|
requestBodyValues: void 0,
|
|
@@ -2691,9 +2691,9 @@ async function ur({ response: e, url: t, fallbackMessage: n }) {
|
|
|
2691
2691
|
responseBody: r
|
|
2692
2692
|
});
|
|
2693
2693
|
}
|
|
2694
|
-
async function
|
|
2694
|
+
async function fr(e) {
|
|
2695
2695
|
if (e == null) return [];
|
|
2696
|
-
if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new
|
|
2696
|
+
if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new D({
|
|
2697
2697
|
functionality: "FileList",
|
|
2698
2698
|
message: "FileList is not supported in the current environment"
|
|
2699
2699
|
});
|
|
@@ -2712,18 +2712,18 @@ async function dr(e) {
|
|
|
2712
2712
|
};
|
|
2713
2713
|
}));
|
|
2714
2714
|
}
|
|
2715
|
-
function
|
|
2715
|
+
function pr(e, t) {
|
|
2716
2716
|
let n = e.search(/[?#]/), r = n === -1 ? e : e.slice(0, n), i = n === -1 ? "" : e.slice(n);
|
|
2717
2717
|
return `${r.endsWith("/") && t.startsWith("/") ? r.slice(0, -1) : r}${t}${i}`;
|
|
2718
2718
|
}
|
|
2719
|
-
var
|
|
2719
|
+
var mr = class {
|
|
2720
2720
|
constructor({ api: e = "/api/chat", credentials: t, headers: n, body: r, fetch: i, prepareSendMessagesRequest: a, prepareReconnectToStreamRequest: o }) {
|
|
2721
2721
|
this.api = e, this.credentials = t, this.headers = n, this.body = r, this.fetch = i, this.prepareSendMessagesRequest = a, this.prepareReconnectToStreamRequest = o;
|
|
2722
2722
|
}
|
|
2723
2723
|
async sendMessages({ abortSignal: e, ...t }) {
|
|
2724
|
-
let n = await
|
|
2725
|
-
...
|
|
2726
|
-
...
|
|
2724
|
+
let n = await xn(this.body), r = await xn(this.headers), i = await xn(this.credentials), a = {
|
|
2725
|
+
...j(r),
|
|
2726
|
+
...j(t.headers)
|
|
2727
2727
|
}, o = await this.prepareSendMessagesRequest?.({
|
|
2728
2728
|
api: this.api,
|
|
2729
2729
|
id: t.chatId,
|
|
@@ -2737,7 +2737,7 @@ var pr = class {
|
|
|
2737
2737
|
requestMetadata: t.metadata,
|
|
2738
2738
|
trigger: t.trigger,
|
|
2739
2739
|
messageId: t.messageId
|
|
2740
|
-
}), s = o?.api ?? this.api, c = o?.headers === void 0 ? a :
|
|
2740
|
+
}), s = o?.api ?? this.api, c = o?.headers === void 0 ? a : j(o.headers), l = o?.body === void 0 ? {
|
|
2741
2741
|
...n,
|
|
2742
2742
|
...t.body,
|
|
2743
2743
|
id: t.chatId,
|
|
@@ -2754,18 +2754,18 @@ var pr = class {
|
|
|
2754
2754
|
credentials: u,
|
|
2755
2755
|
signal: e
|
|
2756
2756
|
});
|
|
2757
|
-
if (!d.ok) throw await
|
|
2757
|
+
if (!d.ok) throw await dr({
|
|
2758
2758
|
response: d,
|
|
2759
2759
|
url: s,
|
|
2760
2760
|
fallbackMessage: "Failed to fetch the chat response."
|
|
2761
2761
|
});
|
|
2762
|
-
if (!d.body) throw new
|
|
2762
|
+
if (!d.body) throw new T({ message: "The response body is empty." });
|
|
2763
2763
|
return this.processResponseStream(d.body);
|
|
2764
2764
|
}
|
|
2765
2765
|
async reconnectToStream(e) {
|
|
2766
|
-
let t = await
|
|
2767
|
-
...
|
|
2768
|
-
...
|
|
2766
|
+
let t = await xn(this.body), n = await xn(this.headers), r = await xn(this.credentials), i = {
|
|
2767
|
+
...j(n),
|
|
2768
|
+
...j(e.headers)
|
|
2769
2769
|
}, a = await this.prepareReconnectToStreamRequest?.({
|
|
2770
2770
|
api: this.api,
|
|
2771
2771
|
id: e.chatId,
|
|
@@ -2778,44 +2778,44 @@ var pr = class {
|
|
|
2778
2778
|
requestMetadata: e.metadata
|
|
2779
2779
|
}), o = a?.api;
|
|
2780
2780
|
if (o == null) {
|
|
2781
|
-
if (e.chatId === "." || e.chatId === "..") throw new
|
|
2781
|
+
if (e.chatId === "." || e.chatId === "..") throw new Tn({
|
|
2782
2782
|
parameter: "chatId",
|
|
2783
2783
|
value: e.chatId,
|
|
2784
2784
|
message: "Chat IDs must not be \".\" or \"..\" when using the default reconnect URL."
|
|
2785
2785
|
});
|
|
2786
|
-
o =
|
|
2786
|
+
o = pr(this.api, `/${encodeURIComponent(e.chatId)}/stream`);
|
|
2787
2787
|
}
|
|
2788
|
-
let s = a?.headers === void 0 ? i :
|
|
2788
|
+
let s = a?.headers === void 0 ? i : j(a.headers), c = a?.credentials ?? r, l = await (this.fetch ?? globalThis.fetch)(o, {
|
|
2789
2789
|
method: "GET",
|
|
2790
2790
|
headers: s,
|
|
2791
2791
|
credentials: c,
|
|
2792
2792
|
signal: e.abortSignal
|
|
2793
2793
|
});
|
|
2794
2794
|
if (l.status === 204) return null;
|
|
2795
|
-
if (!l.ok) throw await
|
|
2795
|
+
if (!l.ok) throw await dr({
|
|
2796
2796
|
response: l,
|
|
2797
2797
|
url: o,
|
|
2798
2798
|
fallbackMessage: "Failed to fetch the chat response."
|
|
2799
2799
|
});
|
|
2800
|
-
if (!l.body) throw new
|
|
2800
|
+
if (!l.body) throw new T({ message: "The response body is empty." });
|
|
2801
2801
|
return this.processResponseStream(l.body);
|
|
2802
2802
|
}
|
|
2803
|
-
},
|
|
2803
|
+
}, hr = class extends mr {
|
|
2804
2804
|
constructor({ resumeStreamIsReplay: e = !0, ...t } = {}) {
|
|
2805
2805
|
super(t), this.resumeStreamIsReplay = e;
|
|
2806
2806
|
}
|
|
2807
2807
|
processResponseStream(e) {
|
|
2808
|
-
return
|
|
2808
|
+
return bn({
|
|
2809
2809
|
stream: e,
|
|
2810
|
-
schema:
|
|
2810
|
+
schema: $n
|
|
2811
2811
|
}).pipeThrough(new TransformStream({ async transform(e, t) {
|
|
2812
2812
|
if (!e.success) throw e.error;
|
|
2813
2813
|
t.enqueue(e.value);
|
|
2814
2814
|
} }));
|
|
2815
2815
|
}
|
|
2816
|
-
},
|
|
2817
|
-
constructor({ generateId: e =
|
|
2818
|
-
this.pendingMessagePreparations = /* @__PURE__ */ new Set(), this.activeResponse = void 0, this.activeResumeRequest = void 0, this.resumableStreamState = void 0, this.jobExecutor = new
|
|
2816
|
+
}, gr = class {
|
|
2817
|
+
constructor({ generateId: e = dt, id: t = e(), transport: n = new hr(), messageMetadataSchema: r, dataPartSchemas: i, state: a, onError: o, onToolCall: s, onFinish: c, onData: l, sendAutomaticallyWhen: u }) {
|
|
2818
|
+
this.pendingMessagePreparations = /* @__PURE__ */ new Set(), this.activeResponse = void 0, this.activeResumeRequest = void 0, this.resumableStreamState = void 0, this.jobExecutor = new ur(), this.activeStopCount = 0, this.stopGeneration = 0, this.sendMessage = async (e, t) => {
|
|
2819
2819
|
if (e == null) {
|
|
2820
2820
|
let e = this.pendingApprovalMessageId;
|
|
2821
2821
|
if (e == null) {
|
|
@@ -2842,7 +2842,7 @@ var pr = class {
|
|
|
2842
2842
|
this.pendingMessagePreparations.add(t);
|
|
2843
2843
|
let r;
|
|
2844
2844
|
try {
|
|
2845
|
-
r = Array.isArray(e.files) ? e.files : await
|
|
2845
|
+
r = Array.isArray(e.files) ? e.files : await fr(e.files);
|
|
2846
2846
|
} finally {
|
|
2847
2847
|
this.pendingMessagePreparations.delete(t);
|
|
2848
2848
|
}
|
|
@@ -2854,12 +2854,12 @@ var pr = class {
|
|
|
2854
2854
|
} else n = e;
|
|
2855
2855
|
if (e.messageId != null) {
|
|
2856
2856
|
let t = this.state.messages.findIndex((t) => t.id === e.messageId);
|
|
2857
|
-
if (t === -1) throw new
|
|
2857
|
+
if (t === -1) throw new Tn({
|
|
2858
2858
|
parameter: "message.messageId",
|
|
2859
2859
|
value: e.messageId,
|
|
2860
2860
|
message: `message with id ${e.messageId} not found`
|
|
2861
2861
|
});
|
|
2862
|
-
if (this.state.messages[t].role !== "user") throw new
|
|
2862
|
+
if (this.state.messages[t].role !== "user") throw new Tn({
|
|
2863
2863
|
parameter: "message.messageId",
|
|
2864
2864
|
value: e.messageId,
|
|
2865
2865
|
message: `message with id ${e.messageId} is not a user message`
|
|
@@ -2883,7 +2883,7 @@ var pr = class {
|
|
|
2883
2883
|
});
|
|
2884
2884
|
}, this.regenerate = async ({ messageId: e, ...t } = {}) => {
|
|
2885
2885
|
let n = e == null ? this.state.messages.length - 1 : this.state.messages.findIndex((t) => t.id === e);
|
|
2886
|
-
if (n === -1) throw new
|
|
2886
|
+
if (n === -1) throw new Tn({
|
|
2887
2887
|
parameter: "messageId",
|
|
2888
2888
|
value: e,
|
|
2889
2889
|
message: `message ${e} not found`
|
|
@@ -3019,7 +3019,7 @@ var pr = class {
|
|
|
3019
3019
|
}), r && this.status === "error" && this.pendingApprovalMessageId == null && (this.pendingApprovalMessageId = this.state.messages[t]?.id ?? e);
|
|
3020
3020
|
}
|
|
3021
3021
|
async makeRequest(e) {
|
|
3022
|
-
let t =
|
|
3022
|
+
let t = cr();
|
|
3023
3023
|
try {
|
|
3024
3024
|
await this.makeRequestImpl({
|
|
3025
3025
|
...e,
|
|
@@ -3075,7 +3075,7 @@ var pr = class {
|
|
|
3075
3075
|
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) => Q(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, ee = !1, y;
|
|
3076
3076
|
try {
|
|
3077
3077
|
let s = {
|
|
3078
|
-
state: e === "resume-stream" && this.resumableStreamState != null ? this.resumableStreamState :
|
|
3078
|
+
state: e === "resume-stream" && this.resumableStreamState != null ? this.resumableStreamState : ar({
|
|
3079
3079
|
lastMessage: e === "resume-stream" ? h : e === "regenerate-message" ? void 0 : this.state.snapshot(p),
|
|
3080
3080
|
messageId: this.generateId()
|
|
3081
3081
|
}),
|
|
@@ -3095,8 +3095,8 @@ var pr = class {
|
|
|
3095
3095
|
body: r,
|
|
3096
3096
|
trigger: e,
|
|
3097
3097
|
messageId: i
|
|
3098
|
-
}), await
|
|
3099
|
-
stream:
|
|
3098
|
+
}), await sr({
|
|
3099
|
+
stream: or({
|
|
3100
3100
|
stream: l,
|
|
3101
3101
|
resetStateOnMessageIdChange: e === "resume-stream",
|
|
3102
3102
|
resetStateOnFirstMessageStart: e === "resume-stream" && this.transport.resumeStreamIsReplay,
|
|
@@ -3161,7 +3161,7 @@ var pr = class {
|
|
|
3161
3161
|
}));
|
|
3162
3162
|
}
|
|
3163
3163
|
};
|
|
3164
|
-
function
|
|
3164
|
+
function _r({ messages: e }) {
|
|
3165
3165
|
let t = e[e.length - 1];
|
|
3166
3166
|
if (!t || t.role !== "assistant") return !1;
|
|
3167
3167
|
let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter(Q);
|
|
@@ -3169,31 +3169,31 @@ function gr({ messages: e }) {
|
|
|
3169
3169
|
}
|
|
3170
3170
|
//#endregion
|
|
3171
3171
|
//#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.44_typescript@6.0.3_/node_modules/swrv/esm/lib/hash.js
|
|
3172
|
-
var
|
|
3173
|
-
function
|
|
3172
|
+
var vr = /* @__PURE__ */ new WeakMap(), yr = 0;
|
|
3173
|
+
function br(e) {
|
|
3174
3174
|
if (!e.length) return "";
|
|
3175
3175
|
for (var t = "arg", n = 0; n < e.length; ++n) {
|
|
3176
3176
|
var r = void 0;
|
|
3177
|
-
e[n] === null || typeof e[n] != "object" && typeof e[n] != "function" ? r = typeof e[n] == "string" ? "\"" + e[n] + "\"" : String(e[n]) :
|
|
3177
|
+
e[n] === null || typeof e[n] != "object" && typeof e[n] != "function" ? r = typeof e[n] == "string" ? "\"" + e[n] + "\"" : String(e[n]) : vr.has(e[n]) ? r = vr.get(e[n]) : (r = yr, vr.set(e[n], yr++)), t += "@" + r;
|
|
3178
3178
|
}
|
|
3179
3179
|
return t;
|
|
3180
3180
|
}
|
|
3181
3181
|
//#endregion
|
|
3182
3182
|
//#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.44_typescript@6.0.3_/node_modules/swrv/esm/cache/index.js
|
|
3183
|
-
function
|
|
3183
|
+
function xr(e) {
|
|
3184
3184
|
if (typeof e == "function") try {
|
|
3185
3185
|
e = e();
|
|
3186
3186
|
} catch {
|
|
3187
3187
|
e = "";
|
|
3188
3188
|
}
|
|
3189
|
-
return e = Array.isArray(e) ?
|
|
3189
|
+
return e = Array.isArray(e) ? br(e) : String(e || ""), e;
|
|
3190
3190
|
}
|
|
3191
|
-
var
|
|
3191
|
+
var Sr = function() {
|
|
3192
3192
|
function e(e) {
|
|
3193
3193
|
e === void 0 && (e = 0), this.items = /* @__PURE__ */ new Map(), this.ttl = e;
|
|
3194
3194
|
}
|
|
3195
3195
|
return e.prototype.serializeKey = function(e) {
|
|
3196
|
-
return
|
|
3196
|
+
return xr(e);
|
|
3197
3197
|
}, e.prototype.get = function(e) {
|
|
3198
3198
|
var t = this.serializeKey(e);
|
|
3199
3199
|
return this.items.get(t);
|
|
@@ -3215,15 +3215,15 @@ var xr = function() {
|
|
|
3215
3215
|
}();
|
|
3216
3216
|
//#endregion
|
|
3217
3217
|
//#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.44_typescript@6.0.3_/node_modules/swrv/esm/lib/web-preset.js
|
|
3218
|
-
function
|
|
3218
|
+
function Cr() {
|
|
3219
3219
|
return navigator.onLine === void 0 || navigator.onLine;
|
|
3220
3220
|
}
|
|
3221
|
-
function
|
|
3221
|
+
function wr() {
|
|
3222
3222
|
return typeof document < "u" && document.visibilityState !== void 0 ? document.visibilityState !== "hidden" : !0;
|
|
3223
3223
|
}
|
|
3224
|
-
var
|
|
3225
|
-
isOnline:
|
|
3226
|
-
isDocumentVisible:
|
|
3224
|
+
var Tr = {
|
|
3225
|
+
isOnline: Cr,
|
|
3226
|
+
isDocumentVisible: wr,
|
|
3227
3227
|
fetcher: function(e) {
|
|
3228
3228
|
return fetch(e).then(function(e) {
|
|
3229
3229
|
return e.json();
|
|
@@ -3234,7 +3234,7 @@ var wr = {
|
|
|
3234
3234
|
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]);
|
|
3235
3235
|
return e;
|
|
3236
3236
|
}, $.apply(this, arguments);
|
|
3237
|
-
},
|
|
3237
|
+
}, Er = function(e, t, n, r) {
|
|
3238
3238
|
function i(e) {
|
|
3239
3239
|
return e instanceof n ? e : new n(function(t) {
|
|
3240
3240
|
t(e);
|
|
@@ -3260,7 +3260,7 @@ var wr = {
|
|
|
3260
3260
|
}
|
|
3261
3261
|
c((r = r.apply(e, t || [])).next());
|
|
3262
3262
|
});
|
|
3263
|
-
},
|
|
3263
|
+
}, Dr = function(e, t) {
|
|
3264
3264
|
var n = {
|
|
3265
3265
|
label: 0,
|
|
3266
3266
|
sent: function() {
|
|
@@ -3333,7 +3333,7 @@ var wr = {
|
|
|
3333
3333
|
done: !0
|
|
3334
3334
|
};
|
|
3335
3335
|
}
|
|
3336
|
-
},
|
|
3336
|
+
}, Or = function(e, t) {
|
|
3337
3337
|
var n = typeof Symbol == "function" && e[Symbol.iterator];
|
|
3338
3338
|
if (!n) return e;
|
|
3339
3339
|
var r = n.call(e), i, a = [], o;
|
|
@@ -3349,11 +3349,11 @@ var wr = {
|
|
|
3349
3349
|
}
|
|
3350
3350
|
}
|
|
3351
3351
|
return a;
|
|
3352
|
-
},
|
|
3352
|
+
}, kr = function(e, t, n) {
|
|
3353
3353
|
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]);
|
|
3354
3354
|
return e.concat(a || Array.prototype.slice.call(t));
|
|
3355
|
-
},
|
|
3356
|
-
cache:
|
|
3355
|
+
}, Ar = new Sr(), jr = new Sr(), Mr = new Sr(), Nr = {
|
|
3356
|
+
cache: Ar,
|
|
3357
3357
|
refreshInterval: 0,
|
|
3358
3358
|
ttl: 0,
|
|
3359
3359
|
serverTTL: 1e3,
|
|
@@ -3363,15 +3363,15 @@ var wr = {
|
|
|
3363
3363
|
shouldRetryOnError: !0,
|
|
3364
3364
|
errorRetryInterval: 5e3,
|
|
3365
3365
|
errorRetryCount: 5,
|
|
3366
|
-
fetcher:
|
|
3367
|
-
isOnline:
|
|
3368
|
-
isDocumentVisible:
|
|
3366
|
+
fetcher: Tr.fetcher,
|
|
3367
|
+
isOnline: Tr.isOnline,
|
|
3368
|
+
isDocumentVisible: Tr.isDocumentVisible
|
|
3369
3369
|
};
|
|
3370
|
-
function Nr(e, t, n) {
|
|
3371
|
-
var r = Ar.get(e);
|
|
3372
|
-
r ? r.data.push(t) : Ar.set(e, [t], n > 0 ? n + 5e3 : n);
|
|
3373
|
-
}
|
|
3374
3370
|
function Pr(e, t, n) {
|
|
3371
|
+
var r = jr.get(e);
|
|
3372
|
+
r ? r.data.push(t) : jr.set(e, [t], n > 0 ? n + 5e3 : n);
|
|
3373
|
+
}
|
|
3374
|
+
function Fr(e, t, n) {
|
|
3375
3375
|
if (n.isDocumentVisible() && !(n.errorRetryCount !== void 0 && t > n.errorRetryCount)) {
|
|
3376
3376
|
var r = Math.min(t || 0, n.errorRetryCount), i = r * n.errorRetryInterval;
|
|
3377
3377
|
setTimeout(function() {
|
|
@@ -3382,17 +3382,17 @@ function Pr(e, t, n) {
|
|
|
3382
3382
|
}, i);
|
|
3383
3383
|
}
|
|
3384
3384
|
}
|
|
3385
|
-
function
|
|
3385
|
+
function Ir(e) {
|
|
3386
3386
|
var t = e.shouldRetry, n = t === void 0 ? void 0 : t, r = e.error;
|
|
3387
|
-
return typeof n == "function" ? n(r) : typeof n == "boolean" ? n :
|
|
3387
|
+
return typeof n == "function" ? n(r) : typeof n == "boolean" ? n : Nr.shouldRetryOnError;
|
|
3388
3388
|
}
|
|
3389
|
-
var
|
|
3390
|
-
return n === void 0 && (n =
|
|
3389
|
+
var Lr = function(e, t, n, r) {
|
|
3390
|
+
return n === void 0 && (n = Ar), r === void 0 && (r = Nr.ttl), Er(void 0, void 0, void 0, function() {
|
|
3391
3391
|
var i, a, o, s, c, l, u;
|
|
3392
|
-
return
|
|
3392
|
+
return Dr(this, function(d) {
|
|
3393
3393
|
switch (d.label) {
|
|
3394
3394
|
case 0:
|
|
3395
|
-
if (!
|
|
3395
|
+
if (!zr(t)) return [3, 5];
|
|
3396
3396
|
d.label = 1;
|
|
3397
3397
|
case 1: return d.trys.push([
|
|
3398
3398
|
1,
|
|
@@ -3414,7 +3414,7 @@ var Ir = function(e, t, n, r) {
|
|
|
3414
3414
|
} catch (e) {
|
|
3415
3415
|
console.error("swrv(mutate): failed to set cache", e);
|
|
3416
3416
|
}
|
|
3417
|
-
return l =
|
|
3417
|
+
return l = jr.get(e), l && l.data.length && (u = l.data.filter(function(t) {
|
|
3418
3418
|
return t.key === e;
|
|
3419
3419
|
}), u.forEach(function(e, t) {
|
|
3420
3420
|
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];
|
|
@@ -3423,9 +3423,9 @@ var Ir = function(e, t, n, r) {
|
|
|
3423
3423
|
});
|
|
3424
3424
|
});
|
|
3425
3425
|
};
|
|
3426
|
-
function
|
|
3426
|
+
function Rr() {
|
|
3427
3427
|
for (var e = this, t = [], n = 0; n < arguments.length; n++) t[n] = arguments[n];
|
|
3428
|
-
var r, i, a = $({},
|
|
3428
|
+
var r, i, a = $({}, Nr), o = !1, s = !1;
|
|
3429
3429
|
if (!me()) return console.error("useSWRV must be called inside setup() or an active effectScope()."), null;
|
|
3430
3430
|
var c = typeof window > "u" || typeof document > "u";
|
|
3431
3431
|
t.length >= 1 && (r = t[0]), t.length >= 2 && (i = t[1]), t.length > 2 && (a = $($({}, a), t[2]));
|
|
@@ -3440,32 +3440,32 @@ function Lr() {
|
|
|
3440
3440
|
key: null
|
|
3441
3441
|
});
|
|
3442
3442
|
var f = function(t, n) {
|
|
3443
|
-
return
|
|
3443
|
+
return Er(e, void 0, void 0, function() {
|
|
3444
3444
|
var e, r, s, c, p, m, h, g = this;
|
|
3445
|
-
return
|
|
3445
|
+
return Dr(this, function(_) {
|
|
3446
3446
|
switch (_.label) {
|
|
3447
3447
|
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() {
|
|
3448
|
-
return
|
|
3448
|
+
return Er(g, void 0, void 0, function() {
|
|
3449
3449
|
var e, t, i, s, c, u;
|
|
3450
|
-
return
|
|
3450
|
+
return Dr(this, function(m) {
|
|
3451
3451
|
switch (m.label) {
|
|
3452
|
-
case 0: return e =
|
|
3452
|
+
case 0: return e = Mr.get(r), e ? [3, 2] : (t = Array.isArray(r) ? r : [r], i = p.apply(void 0, kr([], Or(t), !1)), Mr.set(r, i, a.dedupingInterval), [4, Lr(r, i, a.cache, l)]);
|
|
3453
3453
|
case 1: return m.sent(), [3, 4];
|
|
3454
|
-
case 2: return [4,
|
|
3454
|
+
case 2: return [4, Lr(r, e.data, a.cache, l)];
|
|
3455
3455
|
case 3: m.sent(), m.label = 4;
|
|
3456
|
-
case 4: return d.isValidating = !1, d.isLoading = !1,
|
|
3456
|
+
case 4: return d.isValidating = !1, d.isLoading = !1, Mr.delete(r), d.error !== void 0 && (s = Ir({
|
|
3457
3457
|
shouldRetry: a.shouldRetryOnError,
|
|
3458
3458
|
error: d.error
|
|
3459
|
-
}), c =
|
|
3459
|
+
}), c = Ir({
|
|
3460
3460
|
shouldRetry: !n || n.shouldRetryOnError,
|
|
3461
3461
|
error: d.error
|
|
3462
|
-
}), u = !o && s && c, u &&
|
|
3462
|
+
}), u = !o && s && c, u && Fr(f, n ? n.errorRetryCount : 1, a)), [2];
|
|
3463
3463
|
}
|
|
3464
3464
|
});
|
|
3465
3465
|
});
|
|
3466
3466
|
}, c && a.revalidateDebounce ? (setTimeout(function() {
|
|
3467
|
-
return
|
|
3468
|
-
return
|
|
3467
|
+
return Er(g, void 0, void 0, function() {
|
|
3468
|
+
return Dr(this, function(e) {
|
|
3469
3469
|
switch (e.label) {
|
|
3470
3470
|
case 0: return o ? [3, 2] : [4, h()];
|
|
3471
3471
|
case 1: e.sent(), e.label = 2;
|
|
@@ -3481,16 +3481,16 @@ function Lr() {
|
|
|
3481
3481
|
});
|
|
3482
3482
|
});
|
|
3483
3483
|
}, p = function() {
|
|
3484
|
-
return
|
|
3485
|
-
return
|
|
3484
|
+
return Er(e, void 0, void 0, function() {
|
|
3485
|
+
return Dr(this, function(e) {
|
|
3486
3486
|
return [2, f(null, { shouldRetryOnError: !1 })];
|
|
3487
3487
|
});
|
|
3488
3488
|
});
|
|
3489
3489
|
}, m = null;
|
|
3490
3490
|
if (!c) {
|
|
3491
3491
|
var h = function() {
|
|
3492
|
-
return
|
|
3493
|
-
return
|
|
3492
|
+
return Er(e, void 0, void 0, function() {
|
|
3493
|
+
return Dr(this, function(e) {
|
|
3494
3494
|
switch (e.label) {
|
|
3495
3495
|
case 0: return d.error || !a.isOnline() ? [3, 2] : [4, f()];
|
|
3496
3496
|
case 1: return e.sent(), [3, 3];
|
|
@@ -3504,39 +3504,39 @@ function Lr() {
|
|
|
3504
3504
|
}
|
|
3505
3505
|
_e(function() {
|
|
3506
3506
|
o = !0, m &&= (clearTimeout(m), null), !c && a.revalidateOnFocus && (document.removeEventListener("visibilitychange", p, !1), window.removeEventListener("focus", p, !1));
|
|
3507
|
-
var e =
|
|
3507
|
+
var e = jr.get(u.value);
|
|
3508
3508
|
e && (e.data = e.data.filter(function(e) {
|
|
3509
3509
|
return e !== d;
|
|
3510
3510
|
}));
|
|
3511
3511
|
});
|
|
3512
3512
|
try {
|
|
3513
|
-
|
|
3514
|
-
he(u) || (u.value = e), d.key = e, d.isValidating = !!e,
|
|
3513
|
+
S(u, function(e) {
|
|
3514
|
+
he(u) || (u.value = e), d.key = e, d.isValidating = !!e, Pr(u.value, d, l), !c && !s && u.value && f(), s = !1;
|
|
3515
3515
|
}, { immediate: !0 });
|
|
3516
3516
|
} catch {}
|
|
3517
|
-
return $($({},
|
|
3517
|
+
return $($({}, be(d)), { mutate: function(e, t) {
|
|
3518
3518
|
return f(e, $($({}, t), { forceRevalidate: !0 }));
|
|
3519
3519
|
} });
|
|
3520
3520
|
}
|
|
3521
|
-
function
|
|
3521
|
+
function zr(e) {
|
|
3522
3522
|
return typeof e == "object" && !!e && typeof e.then == "function";
|
|
3523
3523
|
}
|
|
3524
3524
|
//#endregion
|
|
3525
3525
|
//#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.44_typescript@6.0.3_/node_modules/swrv/esm/index.js
|
|
3526
|
-
var
|
|
3527
|
-
|
|
3528
|
-
function
|
|
3526
|
+
var Br = Rr;
|
|
3527
|
+
Br.default, Br.default;
|
|
3528
|
+
function Vr(e) {
|
|
3529
3529
|
return Array.isArray(e) ? [...e] : typeof e == "object" && e && (Object.getPrototypeOf(e) === Object.prototype || Object.getPrototypeOf(e) === null) ? { ...e } : e;
|
|
3530
3530
|
}
|
|
3531
|
-
function
|
|
3531
|
+
function Hr(e) {
|
|
3532
3532
|
if (typeof e != "object" || !e || !("parts" in e) || !Array.isArray(e.parts)) return e;
|
|
3533
3533
|
let t = e, n = {
|
|
3534
3534
|
...t,
|
|
3535
3535
|
parts: t.parts.map((e) => ({ ...e }))
|
|
3536
3536
|
};
|
|
3537
|
-
return "metadata" in t && (n.metadata =
|
|
3537
|
+
return "metadata" in t && (n.metadata = Vr(t.metadata)), n;
|
|
3538
3538
|
}
|
|
3539
|
-
var
|
|
3539
|
+
var Ur = class {
|
|
3540
3540
|
constructor({ initialMessages: e, messagesRef: t, statusRef: n, errorRef: r, throttleWaitMs: i }) {
|
|
3541
3541
|
this.publishedMessages = [], this.publishedMessageSources = [], this.dirtyMessageIndices = /* @__PURE__ */ new Set(), this.statusValue = "ready", this.hasPendingPublication = !1, this.isActive = !0, this.isPublishing = !1, this.pushMessage = (e) => {
|
|
3542
3542
|
this.messagesValue.push(e), this.dirtyMessageIndices.add(this.messagesValue.length - 1), this.schedulePublication();
|
|
@@ -3544,7 +3544,7 @@ var Hr = class {
|
|
|
3544
3544
|
this.messagesValue.pop(), this.schedulePublication();
|
|
3545
3545
|
}, this.replaceMessage = (e, t) => {
|
|
3546
3546
|
this.messagesValue[e] = t, this.dirtyMessageIndices.add(e), this.schedulePublication();
|
|
3547
|
-
}, this.snapshot =
|
|
3547
|
+
}, this.snapshot = Hr, this.handleIntervalEnd = () => {
|
|
3548
3548
|
this.timeout = void 0, this.isActive && this.hasPendingPublication && (this.hasPendingPublication = !1, this.publishMessages(), this.timeout = setTimeout(this.handleIntervalEnd, this.throttleWaitMs));
|
|
3549
3549
|
}, this.messagesValue = e, this.messagesRef = t, this.statusRef = n, this.errorRef = r, this.throttleWaitMs = i != null && Number.isFinite(i) && i > 0 ? i : void 0;
|
|
3550
3550
|
}
|
|
@@ -3586,7 +3586,7 @@ var Hr = class {
|
|
|
3586
3586
|
}
|
|
3587
3587
|
publishMessages() {
|
|
3588
3588
|
if (!this.isActive) return;
|
|
3589
|
-
let e = this.messagesValue.map((e, t) => this.dirtyMessageIndices.has(t) || this.publishedMessageSources[t] !== e ?
|
|
3589
|
+
let e = this.messagesValue.map((e, t) => this.dirtyMessageIndices.has(t) || this.publishedMessageSources[t] !== e ? Hr(e) : this.publishedMessages[t]);
|
|
3590
3590
|
this.publishedMessages = e, this.publishedMessageSources = [...this.messagesValue], this.dirtyMessageIndices.clear(), this.isPublishing = !0;
|
|
3591
3591
|
try {
|
|
3592
3592
|
this.messagesRef.value = e;
|
|
@@ -3594,7 +3594,7 @@ var Hr = class {
|
|
|
3594
3594
|
this.isPublishing = !1;
|
|
3595
3595
|
}
|
|
3596
3596
|
}
|
|
3597
|
-
},
|
|
3597
|
+
}, Wr = class extends gr {
|
|
3598
3598
|
constructor({ state: e, ...t }) {
|
|
3599
3599
|
super({
|
|
3600
3600
|
...t,
|
|
@@ -3602,20 +3602,20 @@ var Hr = class {
|
|
|
3602
3602
|
});
|
|
3603
3603
|
}
|
|
3604
3604
|
};
|
|
3605
|
-
function
|
|
3606
|
-
let t =
|
|
3607
|
-
return
|
|
3605
|
+
function Gr(e) {
|
|
3606
|
+
let t = ye([]), n = ye("ready"), r = ye(), i = ye(), a;
|
|
3607
|
+
return S(t, (e) => {
|
|
3608
3608
|
a != null && !a.isPublishing && a.setMessagesFromConsumer(e);
|
|
3609
|
-
}, { flush: "sync" }),
|
|
3609
|
+
}, { flush: "sync" }), S(() => xe(e), (e) => {
|
|
3610
3610
|
a?.dispose();
|
|
3611
|
-
let { throttle: o, ...s } = e ?? {}, c = new
|
|
3611
|
+
let { throttle: o, ...s } = e ?? {}, c = new Ur({
|
|
3612
3612
|
initialMessages: s.messages ?? [],
|
|
3613
3613
|
messagesRef: t,
|
|
3614
3614
|
statusRef: n,
|
|
3615
3615
|
errorRef: r,
|
|
3616
3616
|
throttleWaitMs: o
|
|
3617
3617
|
});
|
|
3618
|
-
a = c, c.publishInitialState(), i.value = new
|
|
3618
|
+
a = c, c.publishInitialState(), i.value = new Wr({
|
|
3619
3619
|
...s,
|
|
3620
3620
|
state: c
|
|
3621
3621
|
});
|
|
@@ -3637,52 +3637,52 @@ function Wr(e) {
|
|
|
3637
3637
|
}
|
|
3638
3638
|
//#endregion
|
|
3639
3639
|
//#region ../../packages/composable/src/chatbot/useChatbotStore.ts
|
|
3640
|
-
var
|
|
3640
|
+
var Kr = "voice-", qr = (e) => e?.role === "assistant" && e.parts.some((e) => e.state === "approval-requested"), Jr = (e) => e.replace(/\s+/g, " ").trim().toLowerCase(), Yr = (e) => Jr(e.parts.filter((e) => e.type === "text").map((e) => "text" in e ? e.text : "").join(" ")), Xr = 8, Zr = (e, t) => {
|
|
3641
3641
|
let n = e.filter((e) => e.role === "user").map((e) => ({
|
|
3642
|
-
text:
|
|
3642
|
+
text: Yr(e),
|
|
3643
3643
|
taken: !1
|
|
3644
3644
|
}));
|
|
3645
3645
|
return t.filter((e) => {
|
|
3646
3646
|
if (!e.id.startsWith("voice-") || e.role !== "user") return !1;
|
|
3647
|
-
let t =
|
|
3647
|
+
let t = Yr(e), r = n.find((e) => !e.taken && e.text.length > 0 && (e.text === t || e.text.length >= Xr && t.endsWith(e.text)));
|
|
3648
3648
|
return !r || (r.taken = !0, !1);
|
|
3649
3649
|
});
|
|
3650
|
-
},
|
|
3650
|
+
}, Qr = 12e4, $r = 1e3, ei = 5e3, ti = 100, ni = 3e4, ri = 5e3, ii = 250, ai = 1e3, oi = "\n\n", si = (e) => {
|
|
3651
3651
|
let t = e.type ?? "";
|
|
3652
3652
|
return t === "dynamic-tool" ? e.toolName ?? "" : t.startsWith("tool-") ? t.slice(5) : "";
|
|
3653
|
-
},
|
|
3653
|
+
}, ci = (e) => e?.role === "assistant" && e.parts.some((e) => te(si(e)) && !e.providerExecuted && !se.has(e.state ?? "")), li = ({ messages: e }) => {
|
|
3654
3654
|
let t = e[e.length - 1];
|
|
3655
3655
|
if (!t || t.role !== "assistant") return !1;
|
|
3656
|
-
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 && (te(
|
|
3656
|
+
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 && (te(si(e)) || oe(e)));
|
|
3657
3657
|
return r.length > 0 && r.every((e) => se.has(e.state ?? ""));
|
|
3658
3658
|
};
|
|
3659
|
-
function
|
|
3660
|
-
return
|
|
3661
|
-
let { t, te: n, locale: r } =
|
|
3659
|
+
function ui(e) {
|
|
3660
|
+
return Ee(`chatbot-${e}`, () => {
|
|
3661
|
+
let { t, te: n, locale: r } = Ce({ useScope: "global" }), i = x(""), a = x(), o = x(e), s = x(), c = x(), l = x(), u = x(), d = x(), f = x(), p = x(), m = x(), h = x(), g = x(), _ = x(), v = x(), te = x(), ie = x(), ae = x(), se = x(), me = ye(), he = x(0), be = x(), xe = ye(), Ee = ye(), Ae = x(), Pe = x({}), Fe = x(!1), C = x(0), Ie = x(), Le = x(!1), Re = Te(), ze = b(() => {
|
|
3662
3662
|
let e = u.value?.theme;
|
|
3663
|
-
return (!e || e === "auto") && (e =
|
|
3664
|
-
}),
|
|
3663
|
+
return (!e || e === "auto") && (e = Ie.value), e ? e === "dark" : Re.value;
|
|
3664
|
+
}), w = b(() => c.value === "reasoning"), Be = b(() => w.value ? g.value?.filter((e) => ![
|
|
3665
3665
|
"upvote",
|
|
3666
3666
|
"downvote",
|
|
3667
3667
|
"feedback"
|
|
3668
|
-
].includes(e)) : g.value),
|
|
3669
|
-
|
|
3670
|
-
|
|
3668
|
+
].includes(e)) : g.value), Ve = pe(b(() => `${o.value}-chatId`), null);
|
|
3669
|
+
Se(() => {
|
|
3670
|
+
Ve.value ||= dt();
|
|
3671
3671
|
});
|
|
3672
|
-
let
|
|
3673
|
-
get: () =>
|
|
3672
|
+
let T = b({
|
|
3673
|
+
get: () => Ve.value,
|
|
3674
3674
|
set: (e) => {
|
|
3675
|
-
|
|
3675
|
+
Ve.value = e;
|
|
3676
3676
|
}
|
|
3677
|
-
}),
|
|
3678
|
-
let e =
|
|
3679
|
-
return e && e !== ee.Off &&
|
|
3677
|
+
}), He = fe(b(() => `${o.value}-pageAccessOff`), !1), Ue = b(() => He.value ? [] : xe.value ?? []), We = () => He.value ? [] : Ee.value?.() ?? [], Ge = b(() => !!(be.value && xe.value?.length)), Ke = pe(b(() => `${o.value}-pageNotice`), null), qe = b(() => {
|
|
3678
|
+
let e = be.value?.level;
|
|
3679
|
+
return e && e !== ee.Off && Ue.value.length && !y(Ke.value ?? void 0, e) ? e : void 0;
|
|
3680
3680
|
});
|
|
3681
|
-
function
|
|
3682
|
-
|
|
3681
|
+
function Je() {
|
|
3682
|
+
Ke.value = be.value?.level ?? null;
|
|
3683
3683
|
}
|
|
3684
|
-
let
|
|
3685
|
-
function
|
|
3684
|
+
let Ye = x(), Xe = x(!1), Ze = b(() => Ye.value?.message?.toLowerCase().includes("conversation-blocked") ?? !1);
|
|
3685
|
+
function Qe(e) {
|
|
3686
3686
|
try {
|
|
3687
3687
|
let t = JSON.parse(e.message);
|
|
3688
3688
|
return t.status === 404 || t.type?.includes("entity-not-found");
|
|
@@ -3690,88 +3690,101 @@ function ti(e) {
|
|
|
3690
3690
|
return !1;
|
|
3691
3691
|
}
|
|
3692
3692
|
}
|
|
3693
|
-
function
|
|
3694
|
-
if (
|
|
3693
|
+
function $e(e) {
|
|
3694
|
+
if (Qe(e)) {
|
|
3695
3695
|
let e = P.value.messages.filter((e) => e.role === "user"), t = e[e.length - 1], n = t ? de(t) : void 0;
|
|
3696
|
-
|
|
3696
|
+
T.value = dt(), Ye.value = void 0, ge(() => {
|
|
3697
3697
|
P.value.clearError(), n && P.value.sendMessage({ text: n });
|
|
3698
3698
|
});
|
|
3699
|
-
} else le.error(e),
|
|
3699
|
+
} else le.error(e), Ye.value = e, Ze.value && (Xe.value = !0);
|
|
3700
3700
|
}
|
|
3701
|
-
let
|
|
3701
|
+
let E = b(() => ce({
|
|
3702
3702
|
baseUrl: i.value,
|
|
3703
3703
|
basePath: a.value,
|
|
3704
3704
|
headers: () => p.value
|
|
3705
|
-
})),
|
|
3706
|
-
...
|
|
3707
|
-
...
|
|
3708
|
-
}),
|
|
3709
|
-
let e =
|
|
3705
|
+
})), et = x(null), tt = () => ({
|
|
3706
|
+
...De(),
|
|
3707
|
+
...et.value ?? {}
|
|
3708
|
+
}), nt = () => {
|
|
3709
|
+
let e = C.value;
|
|
3710
3710
|
return new Promise((t) => {
|
|
3711
3711
|
let n = setTimeout(() => {
|
|
3712
3712
|
r(), t(!1);
|
|
3713
|
-
}, 3e4), r =
|
|
3713
|
+
}, 3e4), r = S(() => [C.value, P.value.status], ([i, a]) => {
|
|
3714
3714
|
i > e && a === "streaming" && (clearTimeout(n), r(), t(!0));
|
|
3715
3715
|
});
|
|
3716
3716
|
});
|
|
3717
|
-
},
|
|
3718
|
-
|
|
3717
|
+
}, D = ye(), rt = (e, t) => new Promise((n) => {
|
|
3718
|
+
D.value?.answer(!1), D.value = {
|
|
3719
3719
|
toolCallId: e.toolCallId,
|
|
3720
3720
|
question: t?.question,
|
|
3721
3721
|
details: t?.details,
|
|
3722
3722
|
answer: (e) => {
|
|
3723
|
-
|
|
3723
|
+
D.value = void 0, n(e);
|
|
3724
3724
|
}
|
|
3725
3725
|
};
|
|
3726
3726
|
});
|
|
3727
|
-
function
|
|
3728
|
-
|
|
3727
|
+
function it(e) {
|
|
3728
|
+
D.value?.answer(e);
|
|
3729
3729
|
}
|
|
3730
|
-
let
|
|
3730
|
+
let at = Ne({
|
|
3731
3731
|
registry: () => [
|
|
3732
3732
|
...(me.value ?? []).filter((e) => !re(e.name)),
|
|
3733
|
-
...
|
|
3734
|
-
...
|
|
3733
|
+
...Ue.value,
|
|
3734
|
+
...We()
|
|
3735
3735
|
],
|
|
3736
3736
|
capability: () => se.value,
|
|
3737
3737
|
addToolOutput: (e) => void P.value.addToolOutput(e),
|
|
3738
|
-
confirm:
|
|
3739
|
-
waitForResume:
|
|
3738
|
+
confirm: rt,
|
|
3739
|
+
waitForResume: nt,
|
|
3740
3740
|
onPendingChange: (e) => {
|
|
3741
3741
|
he.value = e;
|
|
3742
3742
|
},
|
|
3743
3743
|
onActivity: (e) => {
|
|
3744
3744
|
if (e?.provider !== "page") {
|
|
3745
|
-
|
|
3745
|
+
Ae.value = void 0;
|
|
3746
3746
|
return;
|
|
3747
3747
|
}
|
|
3748
|
-
let t = [...
|
|
3748
|
+
let t = [...Ue.value, ...We()].find((t) => t.name === e.toolName), n;
|
|
3749
3749
|
try {
|
|
3750
3750
|
n = t?.describe?.(e.input);
|
|
3751
3751
|
} catch {
|
|
3752
3752
|
n = void 0;
|
|
3753
3753
|
}
|
|
3754
|
-
n && (
|
|
3755
|
-
...
|
|
3754
|
+
n && (Pe.value = {
|
|
3755
|
+
...Pe.value,
|
|
3756
3756
|
[e.toolCallId]: n
|
|
3757
|
-
}), e.readOnly ?
|
|
3757
|
+
}), e.readOnly ? Ae.value = void 0 : (Ae.value = { title: n ?? t?.annotations?.title ?? e.toolName }, Fe.value = !0);
|
|
3758
3758
|
}
|
|
3759
3759
|
});
|
|
3760
|
-
async function
|
|
3761
|
-
|
|
3760
|
+
async function O() {
|
|
3761
|
+
k(), Ae.value = void 0, Fe.value = !1, H.value = "", await P.value.stop();
|
|
3762
|
+
}
|
|
3763
|
+
function k() {
|
|
3764
|
+
at.cancelAll(), D.value?.answer(!1);
|
|
3762
3765
|
}
|
|
3763
|
-
function
|
|
3764
|
-
|
|
3766
|
+
async function ot(e) {
|
|
3767
|
+
He.value = e, e && await O();
|
|
3765
3768
|
}
|
|
3766
|
-
|
|
3767
|
-
|
|
3769
|
+
S(T, () => k(), { flush: "sync" });
|
|
3770
|
+
let st = !1, A, ct = x(), lt, ut = x([]), j = x([]), M = x([]), N = x({}), ft = /* @__PURE__ */ new Map(), pt = /* @__PURE__ */ new Set();
|
|
3771
|
+
function mt(e, t, n) {
|
|
3772
|
+
j.value.includes(e) || (j.value = [...j.value, e]), ft.set(e, Date.now()), n ? pt.add(e) : pt.delete(e), t && (N.value = {
|
|
3773
|
+
...N.value,
|
|
3774
|
+
[e]: t
|
|
3775
|
+
}), q || vn();
|
|
3768
3776
|
}
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3777
|
+
function ht(e) {
|
|
3778
|
+
N.value = Object.fromEntries(Object.entries(N.value).filter(([t]) => t !== e));
|
|
3779
|
+
}
|
|
3780
|
+
function gt(e) {
|
|
3781
|
+
ft.delete(e), j.value = j.value.filter((t) => t !== e), M.value = M.value.filter((t) => t !== e), ht(e);
|
|
3782
|
+
}
|
|
3783
|
+
let _t = Gr(() => ({
|
|
3784
|
+
id: T.value,
|
|
3785
|
+
transport: new hr({
|
|
3786
|
+
api: E.value.getChatEndpoint(o.value, w.value ? "reasoning" : "chat"),
|
|
3787
|
+
prepareReconnectToStreamRequest: ({ id: e }) => ({ api: E.value.getChatStreamEndpoint(o.value, e) }),
|
|
3775
3788
|
prepareSendMessagesRequest: ({ messages: e, id: t }) => ({ body: {
|
|
3776
3789
|
id: t,
|
|
3777
3790
|
messages: [e[e.length - 1]],
|
|
@@ -3786,16 +3799,16 @@ function ti(e) {
|
|
|
3786
3799
|
reasoning: d.value?.reasoning,
|
|
3787
3800
|
webSearch: f.value?.webSearch,
|
|
3788
3801
|
smoothStream: u.value?.smoothStream,
|
|
3789
|
-
deviceContext:
|
|
3802
|
+
deviceContext: tt(),
|
|
3790
3803
|
externalContext: ae.value,
|
|
3791
3804
|
disabledTools: f.value?.disabled,
|
|
3792
3805
|
fallbackModels: te.value,
|
|
3793
3806
|
gatewayOptions: ie.value,
|
|
3794
|
-
hostTools:
|
|
3795
|
-
pageTools:
|
|
3807
|
+
hostTools: Me(me.value, se.value),
|
|
3808
|
+
pageTools: be.value && Ue.value.length ? {
|
|
3796
3809
|
version: 1,
|
|
3797
3810
|
features: [...ne],
|
|
3798
|
-
forms:
|
|
3811
|
+
forms: We().map(({ name: e, description: t, inputSchema: n, annotations: r }) => ({
|
|
3799
3812
|
name: e,
|
|
3800
3813
|
description: t,
|
|
3801
3814
|
inputSchema: n,
|
|
@@ -3806,44 +3819,48 @@ function ti(e) {
|
|
|
3806
3819
|
credentials: "include",
|
|
3807
3820
|
headers: () => p.value ?? {}
|
|
3808
3821
|
}),
|
|
3809
|
-
sendAutomaticallyWhen: (e) =>
|
|
3822
|
+
sendAutomaticallyWhen: (e) => li(e) || _r(e),
|
|
3810
3823
|
onError: (e) => {
|
|
3811
|
-
|
|
3824
|
+
st ? le.warn(e) : $e(e);
|
|
3812
3825
|
},
|
|
3813
3826
|
onToolCall: ({ toolCall: e }) => {
|
|
3814
|
-
if (!
|
|
3827
|
+
if (!je(e) || st) return;
|
|
3815
3828
|
let t = e;
|
|
3816
|
-
|
|
3829
|
+
at.enqueue({
|
|
3817
3830
|
toolCallId: t.toolCallId,
|
|
3818
3831
|
toolName: t.toolName,
|
|
3819
3832
|
input: t.input,
|
|
3820
|
-
messageId:
|
|
3833
|
+
messageId: vt()?.id ?? "",
|
|
3821
3834
|
readOnly: t.toolMetadata?.readOnly === !0,
|
|
3822
3835
|
provider: t.toolMetadata?.provider === "page" ? "page" : "app"
|
|
3823
3836
|
});
|
|
3824
3837
|
},
|
|
3825
3838
|
onData: (e) => {
|
|
3826
|
-
e.type === "data-audioTranscripts" && (P.value.messages = ue(P.value.messages, e.data));
|
|
3839
|
+
e.type === "data-turnStream" ? lt = e.data.streamId : e.type === "data-audioTranscripts" && (P.value.messages = ue(P.value.messages, e.data));
|
|
3827
3840
|
},
|
|
3828
3841
|
onFinish: () => {
|
|
3829
|
-
let e =
|
|
3830
|
-
!
|
|
3842
|
+
let e = T.value;
|
|
3843
|
+
!w.value && !I.value.some((t) => t.id === e) && zt(o.value);
|
|
3831
3844
|
}
|
|
3832
|
-
})), P = b(() => ve(
|
|
3833
|
-
|
|
3834
|
-
|
|
3845
|
+
})), P = b(() => ve(_t)), vt = () => P.value.messages[P.value.messages.length - 1];
|
|
3846
|
+
S(T, (e, t) => {
|
|
3847
|
+
if (t && !w.value && (G() || A?.chatId === t)) {
|
|
3848
|
+
let e = P.value.messages.filter((e) => e.role === "user"), n = e[e.length - 1];
|
|
3849
|
+
mt(t, n ? de(n) ?? "" : "", P.value.status === "streaming" || A?.chatId === t);
|
|
3850
|
+
}
|
|
3851
|
+
gt(e), lt = void 0, clearTimeout(fn), dn.value = !1, P.value.stop();
|
|
3835
3852
|
}, { flush: "sync" });
|
|
3836
|
-
let
|
|
3853
|
+
let yt = b(() => {
|
|
3837
3854
|
let e = u.value?.initialMessage;
|
|
3838
3855
|
return e?.[r.value] ? e[r.value] : n("message.defaultAgentWelcome") ? t("message.defaultAgentWelcome") : "";
|
|
3839
|
-
}),
|
|
3840
|
-
id:
|
|
3856
|
+
}), bt = dt(), F = b(() => ({
|
|
3857
|
+
id: bt,
|
|
3841
3858
|
role: "assistant",
|
|
3842
3859
|
parts: [{
|
|
3843
3860
|
type: "text",
|
|
3844
|
-
text:
|
|
3861
|
+
text: yt.value
|
|
3845
3862
|
}]
|
|
3846
|
-
})),
|
|
3863
|
+
})), xt = b(() => {
|
|
3847
3864
|
let e = (e) => e.map((e) => e.role !== "user" || !e.parts.some((e) => e.type === "file") ? e : {
|
|
3848
3865
|
...e,
|
|
3849
3866
|
parts: e.parts.map((e) => {
|
|
@@ -3853,107 +3870,138 @@ function ti(e) {
|
|
|
3853
3870
|
let e = t.url.slice(13);
|
|
3854
3871
|
return {
|
|
3855
3872
|
...t,
|
|
3856
|
-
url:
|
|
3873
|
+
url: E.value.getMediaUrl(o.value, T.value, e)
|
|
3857
3874
|
};
|
|
3858
3875
|
}
|
|
3859
3876
|
return t.url.startsWith("blob:") ? t : {
|
|
3860
3877
|
...t,
|
|
3861
|
-
url:
|
|
3878
|
+
url: E.value.appendAuthToken(t.url)
|
|
3862
3879
|
};
|
|
3863
3880
|
})
|
|
3864
|
-
}), t = P.value.id ===
|
|
3865
|
-
return
|
|
3866
|
-
}),
|
|
3881
|
+
}), t = P.value.id === T.value ? P.value.messages : [];
|
|
3882
|
+
return w.value ? e(t) : !Le.value && t[0]?.role !== "assistant" ? [F.value, ...e(t)] : e(t);
|
|
3883
|
+
}), St = b(() => {
|
|
3867
3884
|
let e = u.value?.messagePlaceholder;
|
|
3868
3885
|
return e?.[r.value] ? e[r.value] : n("placeholder.askAnything") ? t("placeholder.askAnything") : "";
|
|
3869
|
-
}), I = x([]),
|
|
3870
|
-
|
|
3871
|
-
|
|
3886
|
+
}), I = x([]), Ct = x(!1), L = x([]), wt = x(!1), Tt = x("chat"), R = x([]), Et = x(), Dt = x(!1), Ot = x(!1), kt = x(), At = x(!1), jt = x(!1), z = x(), B = x(""), V = x([]), H = x(""), Mt = x(0), U = fe(b(() => `${o.value}-queue`), {}), W = b(() => U.value[T.value] ?? []), Nt = b(() => !w.value);
|
|
3887
|
+
function Pt(e, t) {
|
|
3888
|
+
let n = Object.fromEntries(Object.entries(U.value).filter(([t]) => t !== e));
|
|
3889
|
+
U.value = t.length > 0 ? {
|
|
3890
|
+
...n,
|
|
3891
|
+
[e]: t
|
|
3892
|
+
} : n;
|
|
3893
|
+
}
|
|
3894
|
+
function Ft(e) {
|
|
3895
|
+
let t = (U.value[e] ?? []).join(oi);
|
|
3896
|
+
return Pt(e, []), t;
|
|
3897
|
+
}
|
|
3898
|
+
function It(e) {
|
|
3899
|
+
e && (B.value = B.value ? `${B.value}${oi}${e}` : e);
|
|
3900
|
+
}
|
|
3901
|
+
function Lt(e) {
|
|
3902
|
+
Pt(T.value, W.value.filter((t, n) => n !== e));
|
|
3903
|
+
}
|
|
3904
|
+
function Rt(e) {
|
|
3905
|
+
let t = W.value[e];
|
|
3906
|
+
Lt(e), It(t ?? "");
|
|
3907
|
+
}
|
|
3908
|
+
async function zt(e) {
|
|
3909
|
+
if (w.value) I.value = [];
|
|
3872
3910
|
else {
|
|
3873
|
-
|
|
3911
|
+
Ct.value = !0;
|
|
3874
3912
|
try {
|
|
3875
|
-
|
|
3913
|
+
let t = await E.value.getConversations(e, l.value), n = new Set(t.map((e) => e.id)), r = j.value.filter((e) => !n.has(e) && N.value[e]).map((t) => ({
|
|
3914
|
+
id: t,
|
|
3915
|
+
agentId: e,
|
|
3916
|
+
title: N.value[t],
|
|
3917
|
+
summary: null,
|
|
3918
|
+
messages: [],
|
|
3919
|
+
lastMessageAt: /* @__PURE__ */ new Date()
|
|
3920
|
+
}));
|
|
3921
|
+
I.value = [...r, ...t];
|
|
3876
3922
|
} catch {
|
|
3877
3923
|
I.value = [];
|
|
3924
|
+
return;
|
|
3878
3925
|
} finally {
|
|
3879
|
-
|
|
3926
|
+
Ct.value = !1;
|
|
3880
3927
|
}
|
|
3928
|
+
yn([.../* @__PURE__ */ new Set([...mn(), ...I.value.map((e) => e.id)])]);
|
|
3881
3929
|
}
|
|
3882
3930
|
}
|
|
3883
|
-
async function
|
|
3884
|
-
let e =
|
|
3931
|
+
async function Bt() {
|
|
3932
|
+
let e = T.value;
|
|
3885
3933
|
if (!e) L.value = [];
|
|
3886
3934
|
else {
|
|
3887
|
-
|
|
3935
|
+
wt.value = !0;
|
|
3888
3936
|
try {
|
|
3889
|
-
L.value = await
|
|
3937
|
+
L.value = await E.value.getChatFiles(e);
|
|
3890
3938
|
} catch {
|
|
3891
3939
|
L.value = [];
|
|
3892
3940
|
} finally {
|
|
3893
|
-
|
|
3941
|
+
wt.value = !1;
|
|
3894
3942
|
}
|
|
3895
3943
|
}
|
|
3896
3944
|
}
|
|
3897
|
-
function
|
|
3898
|
-
return
|
|
3945
|
+
function Vt(e, t = !1) {
|
|
3946
|
+
return E.value.getChatFileDownloadUrl(e, t);
|
|
3899
3947
|
}
|
|
3900
|
-
function
|
|
3901
|
-
return
|
|
3948
|
+
function Ht(e) {
|
|
3949
|
+
return E.value.getChatFilePreviewUrl(e);
|
|
3902
3950
|
}
|
|
3903
|
-
async function
|
|
3904
|
-
await
|
|
3951
|
+
async function Ut(e) {
|
|
3952
|
+
await E.value.deleteChatFile(e);
|
|
3905
3953
|
let t = L.value.find((t) => t.documentId === e), n = t?.kind === "spreadsheet" ? t.sourceAttachmentId ?? t.documentId : void 0;
|
|
3906
3954
|
L.value = L.value.filter((t) => t.documentId !== e && (!n || t.documentId !== n && t.sourceAttachmentId !== n));
|
|
3907
3955
|
}
|
|
3908
|
-
async function
|
|
3909
|
-
if (!
|
|
3910
|
-
let n = await
|
|
3911
|
-
if (t !==
|
|
3912
|
-
n && (P.value.messages = n.messages,
|
|
3956
|
+
async function Wt(e, t) {
|
|
3957
|
+
if (!w.value) try {
|
|
3958
|
+
let n = await E.value.getChat(e, t);
|
|
3959
|
+
if (t !== T.value || P.value.status !== "ready" || P.value.messages.length > 0) return;
|
|
3960
|
+
n && (P.value.messages = n.messages, Xe.value = n.blocked ?? !1, Gt(e, t, n.turnInProgress === !0));
|
|
3913
3961
|
} catch {}
|
|
3914
3962
|
}
|
|
3915
|
-
async function
|
|
3916
|
-
n && (await
|
|
3963
|
+
async function Gt(e, t, n) {
|
|
3964
|
+
n && (await Kt(t), t !== T.value || G()) || (await qt(e, t), t === T.value && await Zt());
|
|
3917
3965
|
}
|
|
3918
|
-
async function
|
|
3966
|
+
async function Kt(e) {
|
|
3919
3967
|
let t = { chatId: e };
|
|
3920
|
-
|
|
3921
|
-
let n = () =>
|
|
3968
|
+
A = t, ct.value = e;
|
|
3969
|
+
let n = () => A === t && e === T.value, r = Date.now() + Qr;
|
|
3922
3970
|
try {
|
|
3923
3971
|
for (; n() && !G() && Date.now() < r;) {
|
|
3924
|
-
|
|
3972
|
+
st = !0;
|
|
3925
3973
|
try {
|
|
3926
3974
|
await P.value.resumeStream();
|
|
3927
3975
|
} finally {
|
|
3928
|
-
|
|
3976
|
+
st = !1;
|
|
3929
3977
|
}
|
|
3930
3978
|
if (!n()) return;
|
|
3931
3979
|
P.value.clearError();
|
|
3932
|
-
let t = await
|
|
3980
|
+
let t = await E.value.getChat(o.value, e).catch(() => null);
|
|
3933
3981
|
if (!t || !n() || G()) return;
|
|
3934
3982
|
if (!t.turnInProgress) {
|
|
3935
3983
|
P.value.messages = t.messages;
|
|
3936
3984
|
return;
|
|
3937
3985
|
}
|
|
3938
|
-
await new Promise((e) => setTimeout(e,
|
|
3986
|
+
await new Promise((e) => setTimeout(e, $r));
|
|
3939
3987
|
}
|
|
3940
3988
|
} finally {
|
|
3941
|
-
|
|
3989
|
+
A === t && (A = void 0, ct.value = void 0);
|
|
3942
3990
|
}
|
|
3943
3991
|
}
|
|
3944
|
-
async function
|
|
3992
|
+
async function qt(e, t) {
|
|
3945
3993
|
let n;
|
|
3946
3994
|
try {
|
|
3947
|
-
n = Number(sessionStorage.getItem(
|
|
3995
|
+
n = Number(sessionStorage.getItem(ke)), sessionStorage.removeItem(ke);
|
|
3948
3996
|
} catch {
|
|
3949
3997
|
return;
|
|
3950
3998
|
}
|
|
3951
|
-
if (!(!n || Date.now() - n > 6e4 ||
|
|
3999
|
+
if (!(!n || Date.now() - n > 6e4 || He.value)) for (let n = 0; n < 12; n++) {
|
|
3952
4000
|
let n = P.value.messages[P.value.messages.length - 1];
|
|
3953
4001
|
if (n?.role === "assistant") {
|
|
3954
4002
|
let e = n.parts.filter((e) => oe(e) && e.state === "input-available"), t = e.filter((e) => e.toolMetadata?.provider === "page" && e.toolMetadata.readOnly === !0);
|
|
3955
4003
|
if (e.length > 0) {
|
|
3956
|
-
if (t.length === e.length && !
|
|
4004
|
+
if (t.length === e.length && !He.value) for (let e of t) at.enqueue({
|
|
3957
4005
|
toolCallId: e.toolCallId,
|
|
3958
4006
|
toolName: e.toolName,
|
|
3959
4007
|
input: e.input,
|
|
@@ -3965,10 +4013,10 @@ function ti(e) {
|
|
|
3965
4013
|
}
|
|
3966
4014
|
if (n.parts[n.parts.length - 1]?.type === "text") return;
|
|
3967
4015
|
}
|
|
3968
|
-
if (await new Promise((e) => setTimeout(e, 1500)), t !==
|
|
4016
|
+
if (await new Promise((e) => setTimeout(e, 1500)), t !== T.value || P.value.status !== "ready") return;
|
|
3969
4017
|
try {
|
|
3970
|
-
let n = await
|
|
3971
|
-
n && t ===
|
|
4018
|
+
let n = await E.value.getChat(e, t);
|
|
4019
|
+
n && t === T.value && (P.value.messages = n.messages);
|
|
3972
4020
|
} catch {
|
|
3973
4021
|
return;
|
|
3974
4022
|
}
|
|
@@ -3977,50 +4025,72 @@ function ti(e) {
|
|
|
3977
4025
|
let G = () => {
|
|
3978
4026
|
let e = P.value.status;
|
|
3979
4027
|
return e === "submitted" || e === "streaming";
|
|
3980
|
-
},
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
4028
|
+
}, Jt = () => G() || A?.chatId === T.value || he.value > 0, Yt = () => {
|
|
4029
|
+
let e = vt();
|
|
4030
|
+
return D.value !== void 0 || qr(e) || ci(e);
|
|
4031
|
+
}, Xt = /* @__PURE__ */ new Set();
|
|
4032
|
+
async function Zt() {
|
|
4033
|
+
let e = T.value;
|
|
4034
|
+
if (!(Xt.has(e) || W.value.length === 0 || Jt() || Ye.value)) {
|
|
4035
|
+
if (Yt()) It(Ft(e));
|
|
4036
|
+
else {
|
|
4037
|
+
Xt.add(e);
|
|
4038
|
+
try {
|
|
4039
|
+
let t = Date.now() + ri;
|
|
4040
|
+
for (; Date.now() < t && (await Promise.race([E.value.getRunningTurns(o.value, [e]).catch(() => []), new Promise((t) => setTimeout(() => t([e]), ai))])).includes(e);) await new Promise((e) => setTimeout(e, ii));
|
|
4041
|
+
if (e !== T.value || Jt()) return;
|
|
4042
|
+
let n = Ft(e);
|
|
4043
|
+
n && sn(n);
|
|
4044
|
+
} finally {
|
|
4045
|
+
Xt.delete(e);
|
|
4046
|
+
}
|
|
4047
|
+
}
|
|
4048
|
+
}
|
|
4049
|
+
}
|
|
4050
|
+
let Qt = 0, $t = 0;
|
|
4051
|
+
async function en() {
|
|
4052
|
+
if (w.value || G()) return "indeterminate";
|
|
4053
|
+
let e = T.value, t = Qt += 1;
|
|
3984
4054
|
try {
|
|
3985
|
-
let n = await
|
|
3986
|
-
if (!n || e !==
|
|
3987
|
-
|
|
3988
|
-
let r = n.messages, i =
|
|
3989
|
-
return P.value.messages = [...r, ...i],
|
|
4055
|
+
let n = await E.value.getChat(o.value, e);
|
|
4056
|
+
if (!n || e !== T.value || G() || t <= $t) return "indeterminate";
|
|
4057
|
+
$t = t;
|
|
4058
|
+
let r = n.messages, i = Zr(r, P.value.messages);
|
|
4059
|
+
return P.value.messages = [...r, ...i], Xe.value = n.blocked ?? !1, i.length > 0 ? "pending" : "caught-up";
|
|
3990
4060
|
} catch {}
|
|
3991
4061
|
return "indeterminate";
|
|
3992
4062
|
}
|
|
3993
|
-
function
|
|
4063
|
+
function tn(e) {
|
|
3994
4064
|
P.value.messages = [...P.value.messages, e];
|
|
3995
4065
|
}
|
|
3996
|
-
async function
|
|
4066
|
+
async function K(e) {
|
|
3997
4067
|
try {
|
|
3998
|
-
R.value = await
|
|
4068
|
+
R.value = await E.value.getMessageFeedbacks(e);
|
|
3999
4069
|
} catch {
|
|
4000
4070
|
R.value = [];
|
|
4001
4071
|
}
|
|
4002
4072
|
}
|
|
4003
|
-
function
|
|
4073
|
+
function nn(e) {
|
|
4004
4074
|
let t = R.value.findIndex((t) => t.messageId === e.messageId);
|
|
4005
4075
|
t >= 0 ? R.value[t] = e : R.value.push(e);
|
|
4006
4076
|
}
|
|
4007
|
-
function
|
|
4008
|
-
let t =
|
|
4077
|
+
function rn(e) {
|
|
4078
|
+
let t = xt.value, n = t.findIndex((t) => t.id === e.id), r = de(e) ?? "", i = t.slice(0, n).reverse().find((e) => e.role === "user");
|
|
4009
4079
|
return {
|
|
4010
4080
|
userQuestion: de(i ?? e) ?? "",
|
|
4011
4081
|
assistantMessage: r
|
|
4012
4082
|
};
|
|
4013
4083
|
}
|
|
4014
|
-
async function
|
|
4084
|
+
async function an(e, t) {
|
|
4015
4085
|
await Promise.all([
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
]),
|
|
4020
|
-
e && (
|
|
4086
|
+
Wt(e, t),
|
|
4087
|
+
zt(e),
|
|
4088
|
+
K(t)
|
|
4089
|
+
]), et.value || Oe((e, t) => E.value.reverseGeocode(e, t, r.value)).then((e) => {
|
|
4090
|
+
e && (et.value = e);
|
|
4021
4091
|
});
|
|
4022
4092
|
}
|
|
4023
|
-
async function
|
|
4093
|
+
async function on() {
|
|
4024
4094
|
let e = B.value.trim(), t = V.value.filter((e) => e.state === "done" && e.mediaSource !== void 0).map((e) => ({
|
|
4025
4095
|
type: "file",
|
|
4026
4096
|
mediaType: e.mediaSource.mimeType,
|
|
@@ -4028,14 +4098,17 @@ function ti(e) {
|
|
|
4028
4098
|
filename: e.mediaSource.name,
|
|
4029
4099
|
providerMetadata: { "8bot": { media: e.mediaSource } }
|
|
4030
4100
|
}));
|
|
4031
|
-
T.value &&
|
|
4101
|
+
!w.value && Jt() ? e && t.length === 0 && (Pt(T.value, [...W.value, e]), B.value = "") : (w.value && xt.value.length > 0 && await wn(), sn(e, t), B.value = "", Cn());
|
|
4102
|
+
}
|
|
4103
|
+
function sn(e, t = []) {
|
|
4104
|
+
k(), H.value = e, Mt.value = P.value.messages.length;
|
|
4032
4105
|
let n = P.value.sendMessage;
|
|
4033
4106
|
n({
|
|
4034
4107
|
text: e,
|
|
4035
4108
|
files: t.length > 0 ? t : void 0
|
|
4036
|
-
})
|
|
4109
|
+
});
|
|
4037
4110
|
}
|
|
4038
|
-
function
|
|
4111
|
+
function cn(e) {
|
|
4039
4112
|
let t = e.trim();
|
|
4040
4113
|
if (!t) return;
|
|
4041
4114
|
if (P.value.status !== "ready") {
|
|
@@ -4043,48 +4116,120 @@ function ti(e) {
|
|
|
4043
4116
|
return;
|
|
4044
4117
|
}
|
|
4045
4118
|
let n = P.value.sendMessage;
|
|
4046
|
-
|
|
4119
|
+
k(), n({ text: t });
|
|
4047
4120
|
}
|
|
4048
|
-
async function
|
|
4049
|
-
let e = P.value.messages.slice(
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4121
|
+
async function ln() {
|
|
4122
|
+
let e = P.value.messages.slice(Mt.value).some((e) => e.parts.some(oe)), t = H.value, n = t.length > 0 && !e, r = T.value, i = Mt.value, a = A?.chatId === r, s = lt, c = Ft(r), l = (e = "") => {
|
|
4123
|
+
B.value = [
|
|
4124
|
+
e,
|
|
4125
|
+
c,
|
|
4126
|
+
B.value
|
|
4127
|
+
].filter(Boolean).join(oi);
|
|
4128
|
+
}, u = () => r === T.value && !G() && Mt.value === i ? !1 : (c && Pt(r, [c, ...U.value[r] ?? []]), !0);
|
|
4129
|
+
A = void 0, ct.value = void 0, k(), await P.value.stop();
|
|
4130
|
+
let d = w.value || e && !a || await E.value.stopChatTurn(o.value, r, s).catch(() => !0);
|
|
4131
|
+
if (!u()) {
|
|
4132
|
+
if (a || !d) {
|
|
4133
|
+
if (await en(), u()) return;
|
|
4134
|
+
if (a || P.value.messages.length > Mt.value) {
|
|
4135
|
+
H.value = "", l();
|
|
4136
|
+
return;
|
|
4137
|
+
}
|
|
4138
|
+
}
|
|
4139
|
+
n ? (l(t), P.value.messages = P.value.messages.slice(0, Mt.value), H.value = "") : l();
|
|
4140
|
+
}
|
|
4053
4141
|
}
|
|
4054
|
-
|
|
4055
|
-
let t =
|
|
4056
|
-
t && !e.some((e) => e.parts.some((e) => e.toolCallId === t)) &&
|
|
4057
|
-
}),
|
|
4058
|
-
e === "submitted" &&
|
|
4142
|
+
S(() => P.value.messages, (e) => {
|
|
4143
|
+
let t = D.value?.toolCallId;
|
|
4144
|
+
t && !e.some((e) => e.parts.some((e) => e.toolCallId === t)) && k();
|
|
4145
|
+
}), S(() => P.value.status, (e) => {
|
|
4146
|
+
e === "submitted" && (C.value++, lt = void 0);
|
|
4059
4147
|
});
|
|
4060
|
-
let
|
|
4061
|
-
|
|
4062
|
-
clearTimeout(
|
|
4063
|
-
|
|
4148
|
+
let un;
|
|
4149
|
+
S(() => [P.value.status, he.value], ([e, t]) => {
|
|
4150
|
+
clearTimeout(un), e === "ready" && t === 0 && (un = setTimeout(() => {
|
|
4151
|
+
Fe.value = !1;
|
|
4064
4152
|
}, 1500));
|
|
4065
4153
|
});
|
|
4066
|
-
let
|
|
4067
|
-
|
|
4068
|
-
clearTimeout(
|
|
4069
|
-
|
|
4154
|
+
let dn = x(!1), fn;
|
|
4155
|
+
S(() => !D.value && !qr(vt()) && (G() || he.value > 0), (e) => {
|
|
4156
|
+
clearTimeout(fn), e ? dn.value = !0 : fn = setTimeout(() => {
|
|
4157
|
+
dn.value = !1;
|
|
4070
4158
|
}, 400);
|
|
4071
|
-
}, { immediate: !0 })
|
|
4159
|
+
}, { immediate: !0 });
|
|
4160
|
+
let pn = b(() => {
|
|
4161
|
+
let e = ut.value.filter((e) => e !== T.value);
|
|
4162
|
+
return dn.value || ct.value === T.value ? [...e, T.value] : e;
|
|
4163
|
+
}), mn = () => [.../* @__PURE__ */ new Set([...ut.value, ...j.value])], hn = we(), q, gn = 0, _n = 0;
|
|
4164
|
+
function vn() {
|
|
4165
|
+
clearTimeout(q), q = void 0, mn().length !== 0 && hn.value === "visible" && (q = setTimeout(() => {
|
|
4166
|
+
q = void 0, yn(mn());
|
|
4167
|
+
}, ei));
|
|
4168
|
+
}
|
|
4169
|
+
async function yn(e) {
|
|
4170
|
+
let t = e.slice(0, ti);
|
|
4171
|
+
if (w.value || t.length === 0) {
|
|
4172
|
+
vn();
|
|
4173
|
+
return;
|
|
4174
|
+
}
|
|
4175
|
+
let n = gn += 1, r;
|
|
4176
|
+
try {
|
|
4177
|
+
r = await E.value.getRunningTurns(o.value, t);
|
|
4178
|
+
} catch {
|
|
4179
|
+
vn();
|
|
4180
|
+
return;
|
|
4181
|
+
}
|
|
4182
|
+
if (n <= _n) return;
|
|
4183
|
+
_n = n;
|
|
4184
|
+
for (let e of r) pt.add(e);
|
|
4185
|
+
let i = new Set(t), a = mn().filter((e) => i.has(e) && !r.includes(e)), s = (e) => j.value.includes(e) && !pt.has(e), c = a.filter((e) => s(e) && Date.now() - (ft.get(e) ?? 0) > ni), l = a.filter((e) => !s(e));
|
|
4186
|
+
ut.value = [...ut.value.filter((e) => !i.has(e)), ...r];
|
|
4187
|
+
let u = l.filter((e) => j.value.includes(e));
|
|
4188
|
+
(u.length > 0 || c.length > 0) && (j.value = j.value.filter((e) => !u.includes(e) && !c.includes(e)), M.value = [...M.value, ...u.filter((e) => e !== T.value && !M.value.includes(e))]), l.length > 0 && zt(o.value), vn();
|
|
4189
|
+
}
|
|
4190
|
+
S(hn, (e) => {
|
|
4191
|
+
e === "visible" ? yn(mn()) : (clearTimeout(q), q = void 0);
|
|
4192
|
+
}), _e(() => clearTimeout(q));
|
|
4193
|
+
let bn = b(() => M.value.map((e) => ({
|
|
4194
|
+
chatId: e,
|
|
4195
|
+
title: I.value.find((t) => t.id === e)?.title || N.value[e] || void 0
|
|
4196
|
+
})));
|
|
4197
|
+
function xn(e) {
|
|
4198
|
+
gt(e), T.value = e, Bn("chat");
|
|
4199
|
+
}
|
|
4200
|
+
function Sn(e) {
|
|
4201
|
+
M.value = M.value.filter((t) => t !== e), ht(e);
|
|
4202
|
+
}
|
|
4203
|
+
S(() => [P.value.status, P.value.id], ([e, t], [n, r]) => {
|
|
4204
|
+
if (t === r) {
|
|
4205
|
+
if (e === "error") A?.chatId !== T.value && It(Ft(T.value));
|
|
4206
|
+
else if (e === "ready" && (n === "streaming" || n === "submitted")) {
|
|
4207
|
+
if (Yt()) {
|
|
4208
|
+
It(Ft(T.value));
|
|
4209
|
+
return;
|
|
4210
|
+
}
|
|
4211
|
+
Zt();
|
|
4212
|
+
}
|
|
4213
|
+
}
|
|
4214
|
+
}), S(he, (e) => {
|
|
4215
|
+
e === 0 && P.value.status === "ready" && Zt();
|
|
4216
|
+
}), S(() => P.value.status, (e) => {
|
|
4072
4217
|
e === "ready" && H.value.length > 0 && (H.value = "");
|
|
4073
4218
|
});
|
|
4074
|
-
function
|
|
4219
|
+
function Cn(e = !1) {
|
|
4075
4220
|
for (let t of V.value) (e || t.state !== "done") && URL.revokeObjectURL(t.localUrl);
|
|
4076
|
-
V.value = [],
|
|
4221
|
+
V.value = [], Z.value = null;
|
|
4077
4222
|
}
|
|
4078
|
-
async function
|
|
4079
|
-
return H.value = "",
|
|
4223
|
+
async function wn() {
|
|
4224
|
+
return H.value = "", Pe.value = {}, T.value = dt(), await ge(), P.value.clearError(), Ye.value = void 0, Xe.value = !1, Cn(!0), Bn("chat"), T.value;
|
|
4080
4225
|
}
|
|
4081
|
-
async function
|
|
4082
|
-
P.value.status !== "ready" && (H.value = "", await
|
|
4226
|
+
async function Tn(e) {
|
|
4227
|
+
P.value.status !== "ready" && (H.value = "", await ln()), k(), await P.value.regenerate(e);
|
|
4083
4228
|
}
|
|
4084
|
-
function
|
|
4229
|
+
function En(e) {
|
|
4085
4230
|
if (e.tool === "requestGeolocation") {
|
|
4086
4231
|
let t = e.output;
|
|
4087
|
-
"latitude" in t && (
|
|
4232
|
+
"latitude" in t && (et.value = {
|
|
4088
4233
|
geolocationLatitude: t.latitude,
|
|
4089
4234
|
geolocationLongitude: t.longitude,
|
|
4090
4235
|
geolocationAccuracy: t.accuracy,
|
|
@@ -4093,27 +4238,27 @@ function ti(e) {
|
|
|
4093
4238
|
}
|
|
4094
4239
|
P.value.addToolOutput(e);
|
|
4095
4240
|
}
|
|
4096
|
-
function
|
|
4241
|
+
function Dn(e) {
|
|
4097
4242
|
P.value.addToolApprovalResponse(e);
|
|
4098
4243
|
}
|
|
4099
|
-
let
|
|
4100
|
-
|
|
4244
|
+
let On = b(() => P.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), J = b(() => _.value?.maxFilesPerMessage ?? 5), kn = b(() => _.value?.maxFilesPerChat ?? 20), Y = b(() => Math.max(0, Math.min(J.value - V.value.length, kn.value - On.value - V.value.length))), X = b(() => Y.value <= 0), Z = x(null), An = () => {
|
|
4245
|
+
Z.value = null;
|
|
4101
4246
|
};
|
|
4102
|
-
|
|
4103
|
-
e || (
|
|
4247
|
+
S(X, (e) => {
|
|
4248
|
+
e || (Z.value = null);
|
|
4104
4249
|
});
|
|
4105
|
-
async function
|
|
4106
|
-
if (
|
|
4107
|
-
|
|
4250
|
+
async function jn(e) {
|
|
4251
|
+
if (X.value) {
|
|
4252
|
+
Z.value = kn.value - On.value - V.value.length <= J.value - V.value.length ? {
|
|
4108
4253
|
reason: "per-chat",
|
|
4109
|
-
max:
|
|
4254
|
+
max: kn.value
|
|
4110
4255
|
} : {
|
|
4111
4256
|
reason: "per-message",
|
|
4112
|
-
max:
|
|
4257
|
+
max: J.value
|
|
4113
4258
|
};
|
|
4114
4259
|
return;
|
|
4115
4260
|
}
|
|
4116
|
-
let t =
|
|
4261
|
+
let t = dt(), n = {
|
|
4117
4262
|
id: t,
|
|
4118
4263
|
file: e,
|
|
4119
4264
|
localUrl: URL.createObjectURL(e),
|
|
@@ -4121,7 +4266,7 @@ function ti(e) {
|
|
|
4121
4266
|
};
|
|
4122
4267
|
V.value = [...V.value, n];
|
|
4123
4268
|
try {
|
|
4124
|
-
let n = await
|
|
4269
|
+
let n = await E.value.uploadMedia(o.value, T.value, e);
|
|
4125
4270
|
V.value = V.value.map((e) => e.id === t ? {
|
|
4126
4271
|
...e,
|
|
4127
4272
|
state: "done",
|
|
@@ -4136,83 +4281,83 @@ function ti(e) {
|
|
|
4136
4281
|
} : e);
|
|
4137
4282
|
}
|
|
4138
4283
|
}
|
|
4139
|
-
async function
|
|
4140
|
-
let { userQuestion: n, assistantMessage: r } =
|
|
4141
|
-
|
|
4284
|
+
async function Mn(e, t) {
|
|
4285
|
+
let { userQuestion: n, assistantMessage: r } = rn(e);
|
|
4286
|
+
nn(await E.value.submitMessageFeedback({
|
|
4142
4287
|
messageId: e.id,
|
|
4143
|
-
chatId:
|
|
4288
|
+
chatId: T.value,
|
|
4144
4289
|
agentId: o.value,
|
|
4145
4290
|
vote: t,
|
|
4146
4291
|
userQuestion: n,
|
|
4147
4292
|
assistantMessage: r
|
|
4148
4293
|
}));
|
|
4149
4294
|
}
|
|
4150
|
-
async function
|
|
4151
|
-
await
|
|
4295
|
+
async function Nn(e) {
|
|
4296
|
+
await Mn(e, "upvote");
|
|
4152
4297
|
}
|
|
4153
|
-
async function
|
|
4154
|
-
await
|
|
4298
|
+
async function Pn(e) {
|
|
4299
|
+
await Mn(e, "downvote");
|
|
4155
4300
|
}
|
|
4156
|
-
function
|
|
4157
|
-
|
|
4301
|
+
function Fn(e) {
|
|
4302
|
+
Ot.value = !1, kt.value = void 0, Et.value = e;
|
|
4158
4303
|
}
|
|
4159
|
-
async function
|
|
4160
|
-
if (
|
|
4161
|
-
|
|
4162
|
-
let { userQuestion: t, assistantMessage: n } =
|
|
4163
|
-
|
|
4164
|
-
messageId:
|
|
4165
|
-
chatId:
|
|
4304
|
+
async function In(e) {
|
|
4305
|
+
if (Et.value) try {
|
|
4306
|
+
Dt.value = !0, Ot.value = !1, kt.value = void 0;
|
|
4307
|
+
let { userQuestion: t, assistantMessage: n } = rn(Et.value);
|
|
4308
|
+
nn(await E.value.submitMessageFeedback({
|
|
4309
|
+
messageId: Et.value.id,
|
|
4310
|
+
chatId: T.value,
|
|
4166
4311
|
agentId: o.value,
|
|
4167
4312
|
userQuestion: t,
|
|
4168
4313
|
assistantMessage: n,
|
|
4169
4314
|
comment: e
|
|
4170
|
-
})),
|
|
4315
|
+
})), Ot.value = !0, await K(T.value);
|
|
4171
4316
|
} catch {
|
|
4172
|
-
|
|
4317
|
+
kt.value = n("message.feedbackSubmitError") ? t("message.feedbackSubmitError") : "Failed to submit feedback";
|
|
4173
4318
|
} finally {
|
|
4174
|
-
|
|
4319
|
+
Dt.value = !1;
|
|
4175
4320
|
}
|
|
4176
4321
|
}
|
|
4177
|
-
async function
|
|
4322
|
+
async function Ln(e) {
|
|
4178
4323
|
try {
|
|
4179
|
-
|
|
4324
|
+
jt.value = !0, At.value = !1, z.value = void 0, await E.value.submitLead({
|
|
4180
4325
|
agentId: o.value,
|
|
4181
|
-
chatId:
|
|
4326
|
+
chatId: T.value,
|
|
4182
4327
|
...e
|
|
4183
|
-
}),
|
|
4328
|
+
}), At.value = !0;
|
|
4184
4329
|
} catch {
|
|
4185
|
-
|
|
4330
|
+
z.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
|
|
4186
4331
|
} finally {
|
|
4187
|
-
|
|
4332
|
+
jt.value = !1;
|
|
4188
4333
|
}
|
|
4189
4334
|
}
|
|
4190
|
-
async function
|
|
4191
|
-
let n = await
|
|
4335
|
+
async function Rn(e, t) {
|
|
4336
|
+
let n = await E.value.updateChatTitle(o.value, e, t);
|
|
4192
4337
|
I.value = I.value.map((t) => t.id === e ? {
|
|
4193
4338
|
...t,
|
|
4194
4339
|
title: n.title
|
|
4195
4340
|
} : t);
|
|
4196
4341
|
}
|
|
4197
|
-
async function
|
|
4198
|
-
await
|
|
4342
|
+
async function zn(e) {
|
|
4343
|
+
await E.value.deleteChat(o.value, e), I.value = I.value.filter((t) => t.id !== e), T.value === e && await wn();
|
|
4199
4344
|
}
|
|
4200
|
-
function
|
|
4201
|
-
|
|
4345
|
+
function Bn(e) {
|
|
4346
|
+
Tt.value = e;
|
|
4202
4347
|
}
|
|
4203
|
-
let
|
|
4204
|
-
function
|
|
4205
|
-
let t = () =>
|
|
4348
|
+
let Vn;
|
|
4349
|
+
function Hn(e) {
|
|
4350
|
+
let t = () => E.value.getChat(o.value, e).then((e) => e !== null);
|
|
4206
4351
|
return t().catch(() => t().catch(() => !1));
|
|
4207
4352
|
}
|
|
4208
|
-
return
|
|
4209
|
-
if (!e || e ===
|
|
4210
|
-
let t =
|
|
4211
|
-
if (
|
|
4212
|
-
let n =
|
|
4213
|
-
l.value === e &&
|
|
4353
|
+
return S(l, async (e) => {
|
|
4354
|
+
if (!e || e === Vn) return;
|
|
4355
|
+
let t = Vn;
|
|
4356
|
+
if (Vn = e, t === void 0) return;
|
|
4357
|
+
let n = T.value, r = !w.value && await Hn(n);
|
|
4358
|
+
l.value === e && T.value === n && (r ? zt(o.value) : (I.value = [], R.value = [], L.value = [], ut.value = [], j.value = [], M.value = [], N.value = {}, await wn(), B.value = ""));
|
|
4214
4359
|
}), {
|
|
4215
|
-
apiClient:
|
|
4360
|
+
apiClient: E,
|
|
4216
4361
|
baseUrl: i,
|
|
4217
4362
|
basePath: a,
|
|
4218
4363
|
agentId: o,
|
|
@@ -4226,7 +4371,7 @@ function ti(e) {
|
|
|
4226
4371
|
revisedAnswers: m,
|
|
4227
4372
|
model: h,
|
|
4228
4373
|
actionsInput: g,
|
|
4229
|
-
actions:
|
|
4374
|
+
actions: Be,
|
|
4230
4375
|
agentFileUpload: _,
|
|
4231
4376
|
agentVoice: v,
|
|
4232
4377
|
fallbackModels: te,
|
|
@@ -4235,78 +4380,86 @@ function ti(e) {
|
|
|
4235
4380
|
agentHostTools: se,
|
|
4236
4381
|
hostToolRegistry: me,
|
|
4237
4382
|
hostToolsPending: he,
|
|
4238
|
-
agentPageAccess:
|
|
4239
|
-
pageToolRegistry:
|
|
4240
|
-
pageFormsProvider:
|
|
4241
|
-
pageAction:
|
|
4242
|
-
hostStepTitles:
|
|
4243
|
-
pageControlActive:
|
|
4244
|
-
isWorking:
|
|
4245
|
-
stopHostActions:
|
|
4246
|
-
pageNoticeLevel:
|
|
4247
|
-
closePageNotice:
|
|
4248
|
-
hostConfirmation:
|
|
4249
|
-
respondHostConfirmation:
|
|
4250
|
-
pageAccessAvailable:
|
|
4251
|
-
pageAccessOff:
|
|
4252
|
-
setPageAccessOff:
|
|
4253
|
-
systemTheme:
|
|
4254
|
-
hideWelcomeMessage:
|
|
4255
|
-
isDark:
|
|
4383
|
+
agentPageAccess: be,
|
|
4384
|
+
pageToolRegistry: xe,
|
|
4385
|
+
pageFormsProvider: Ee,
|
|
4386
|
+
pageAction: Ae,
|
|
4387
|
+
hostStepTitles: Pe,
|
|
4388
|
+
pageControlActive: Fe,
|
|
4389
|
+
isWorking: dn,
|
|
4390
|
+
stopHostActions: O,
|
|
4391
|
+
pageNoticeLevel: qe,
|
|
4392
|
+
closePageNotice: Je,
|
|
4393
|
+
hostConfirmation: D,
|
|
4394
|
+
respondHostConfirmation: it,
|
|
4395
|
+
pageAccessAvailable: Ge,
|
|
4396
|
+
pageAccessOff: He,
|
|
4397
|
+
setPageAccessOff: ot,
|
|
4398
|
+
systemTheme: Ie,
|
|
4399
|
+
hideWelcomeMessage: Le,
|
|
4400
|
+
isDark: ze,
|
|
4256
4401
|
chat: P,
|
|
4257
|
-
messages:
|
|
4402
|
+
messages: xt,
|
|
4258
4403
|
conversations: I,
|
|
4259
|
-
isLoadingConversations:
|
|
4404
|
+
isLoadingConversations: Ct,
|
|
4260
4405
|
chatFiles: L,
|
|
4261
|
-
isLoadingChatFiles:
|
|
4406
|
+
isLoadingChatFiles: wt,
|
|
4262
4407
|
input: B,
|
|
4263
4408
|
pendingAttachments: V,
|
|
4264
|
-
isAttachmentLimitReached:
|
|
4265
|
-
fileLimitError:
|
|
4266
|
-
localChatId:
|
|
4267
|
-
isConversationBlocked:
|
|
4268
|
-
inputMessagePlaceholder:
|
|
4269
|
-
chatError:
|
|
4270
|
-
|
|
4409
|
+
isAttachmentLimitReached: X,
|
|
4410
|
+
fileLimitError: Z,
|
|
4411
|
+
localChatId: T,
|
|
4412
|
+
isConversationBlocked: Xe,
|
|
4413
|
+
inputMessagePlaceholder: St,
|
|
4414
|
+
chatError: Ye,
|
|
4415
|
+
runningChatIds: pn,
|
|
4416
|
+
backgroundAnswers: bn,
|
|
4417
|
+
openBackgroundAnswer: xn,
|
|
4418
|
+
dismissBackgroundAnswer: Sn,
|
|
4419
|
+
canQueue: Nt,
|
|
4420
|
+
queuedMessages: W,
|
|
4421
|
+
removeQueuedMessage: Lt,
|
|
4422
|
+
editQueuedMessage: Rt,
|
|
4423
|
+
activeView: Tt,
|
|
4271
4424
|
messageFeedbacks: R,
|
|
4272
|
-
feedbackDialogMessage:
|
|
4273
|
-
isFeedbackSubmitting:
|
|
4274
|
-
isFeedbackSubmitted:
|
|
4275
|
-
feedbackSubmitError:
|
|
4276
|
-
isLeadSubmitted:
|
|
4277
|
-
isLoadingSubmitLead:
|
|
4278
|
-
submitLeadError:
|
|
4279
|
-
buildDeviceContext:
|
|
4280
|
-
initialize:
|
|
4281
|
-
loadConversations:
|
|
4282
|
-
loadChatFiles:
|
|
4283
|
-
refreshMessages:
|
|
4284
|
-
appendMessage:
|
|
4285
|
-
getChatFileUrl:
|
|
4286
|
-
getChatFilePreviewUrl:
|
|
4287
|
-
deleteChatFile:
|
|
4288
|
-
handleSubmit:
|
|
4289
|
-
sendMessage:
|
|
4290
|
-
stopGeneration:
|
|
4291
|
-
startNewChat:
|
|
4292
|
-
regenerate:
|
|
4293
|
-
addToolOutput:
|
|
4294
|
-
addToolApprovalResponse:
|
|
4295
|
-
handleFileSelect:
|
|
4296
|
-
clearFileLimitError:
|
|
4297
|
-
clearPendingAttachments:
|
|
4298
|
-
onUpvote:
|
|
4299
|
-
onDownvote:
|
|
4300
|
-
onFeedback:
|
|
4301
|
-
onFeedbackSubmit:
|
|
4302
|
-
onLeadSubmit:
|
|
4303
|
-
navigate:
|
|
4304
|
-
renameChatTitle:
|
|
4305
|
-
deleteChat:
|
|
4425
|
+
feedbackDialogMessage: Et,
|
|
4426
|
+
isFeedbackSubmitting: Dt,
|
|
4427
|
+
isFeedbackSubmitted: Ot,
|
|
4428
|
+
feedbackSubmitError: kt,
|
|
4429
|
+
isLeadSubmitted: At,
|
|
4430
|
+
isLoadingSubmitLead: jt,
|
|
4431
|
+
submitLeadError: z,
|
|
4432
|
+
buildDeviceContext: tt,
|
|
4433
|
+
initialize: an,
|
|
4434
|
+
loadConversations: zt,
|
|
4435
|
+
loadChatFiles: Bt,
|
|
4436
|
+
refreshMessages: en,
|
|
4437
|
+
appendMessage: tn,
|
|
4438
|
+
getChatFileUrl: Vt,
|
|
4439
|
+
getChatFilePreviewUrl: Ht,
|
|
4440
|
+
deleteChatFile: Ut,
|
|
4441
|
+
handleSubmit: on,
|
|
4442
|
+
sendMessage: cn,
|
|
4443
|
+
stopGeneration: ln,
|
|
4444
|
+
startNewChat: wn,
|
|
4445
|
+
regenerate: Tn,
|
|
4446
|
+
addToolOutput: En,
|
|
4447
|
+
addToolApprovalResponse: Dn,
|
|
4448
|
+
handleFileSelect: jn,
|
|
4449
|
+
clearFileLimitError: An,
|
|
4450
|
+
clearPendingAttachments: Cn,
|
|
4451
|
+
onUpvote: Nn,
|
|
4452
|
+
onDownvote: Pn,
|
|
4453
|
+
onFeedback: Fn,
|
|
4454
|
+
onFeedbackSubmit: In,
|
|
4455
|
+
onLeadSubmit: Ln,
|
|
4456
|
+
navigate: Bn,
|
|
4457
|
+
renameChatTitle: Rn,
|
|
4458
|
+
deleteChat: zn
|
|
4306
4459
|
};
|
|
4307
4460
|
})();
|
|
4308
4461
|
}
|
|
4309
4462
|
//#endregion
|
|
4310
|
-
export {
|
|
4463
|
+
export { dt as a, hr as i, ui as n, Gr as r, Kr as t };
|
|
4311
4464
|
|
|
4312
|
-
//# sourceMappingURL=useChatbotStore-
|
|
4465
|
+
//# sourceMappingURL=useChatbotStore-Ct7G-voO.js.map
|