@8wave/ai-elements 0.123.0-beta.11 → 0.123.0-beta.12
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/README.md +30 -3
- package/dist/_chunks/{Agent-C0JtGK2t.js → Agent-CsSvagZw.js} +13 -2
- package/dist/_chunks/Agent-CsSvagZw.js.map +1 -0
- package/dist/_chunks/{PkStreamingMarkdown-DGdyf4_3.js → PkStreamingMarkdown-ReRKQNAO.js} +3 -3
- package/dist/_chunks/{PkStreamingMarkdown-DGdyf4_3.js.map → PkStreamingMarkdown-ReRKQNAO.js.map} +1 -1
- package/dist/_chunks/{PkToolChatFile-NrOBCzk2.js → PkToolChatFile-QJi6bOuS.js} +2 -2
- package/dist/_chunks/{PkToolChatFile-NrOBCzk2.js.map → PkToolChatFile-QJi6bOuS.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestGeolocation-BIfpxvX5.js → PkToolRequestGeolocation-CUjRsNs9.js} +2 -2
- package/dist/_chunks/{PkToolRequestGeolocation-BIfpxvX5.js.map → PkToolRequestGeolocation-CUjRsNs9.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestOAuthConnection-CJgoiSgi.js → PkToolRequestOAuthConnection-CbxVIAPg.js} +2 -2
- package/dist/_chunks/{PkToolRequestOAuthConnection-CJgoiSgi.js.map → PkToolRequestOAuthConnection-CbxVIAPg.js.map} +1 -1
- package/dist/_chunks/{PkToolShowArtifact-DmZEQMSm.js → PkToolShowArtifact-D0HZ_qWx.js} +2 -2
- package/dist/_chunks/{PkToolShowArtifact-DmZEQMSm.js.map → PkToolShowArtifact-D0HZ_qWx.js.map} +1 -1
- package/dist/_chunks/{PkToolShowContactForm-BaX3d5Yq.js → PkToolShowContactForm-DkJB0EO1.js} +2 -2
- package/dist/_chunks/{PkToolShowContactForm-BaX3d5Yq.js.map → PkToolShowContactForm-DkJB0EO1.js.map} +1 -1
- package/dist/_chunks/{PkToolShowForm-BKyZnpPB.js → PkToolShowForm-zAprG0yl.js} +3 -3
- package/dist/_chunks/{PkToolShowForm-BKyZnpPB.js.map → PkToolShowForm-zAprG0yl.js.map} +1 -1
- package/dist/_chunks/{PkToolShowImageGallery-GBaXxucK.js → PkToolShowImageGallery-o62SZ6tq.js} +2 -2
- package/dist/_chunks/{PkToolShowImageGallery-GBaXxucK.js.map → PkToolShowImageGallery-o62SZ6tq.js.map} +1 -1
- package/dist/_chunks/{PkToolShowProductList-DBVtBJXU.js → PkToolShowProductList-CWLxVreB.js} +2 -2
- package/dist/_chunks/{PkToolShowProductList-DBVtBJXU.js.map → PkToolShowProductList-CWLxVreB.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSources-Ciuizdl3.js → PkToolShowSources-dJEqZn6T.js} +3 -3
- package/dist/_chunks/{PkToolShowSources-Ciuizdl3.js.map → PkToolShowSources-dJEqZn6T.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSuggestedReply-Dbti20SV.js → PkToolShowSuggestedReply-BHAltyxH.js} +2 -2
- package/dist/_chunks/{PkToolShowSuggestedReply-Dbti20SV.js.map → PkToolShowSuggestedReply-BHAltyxH.js.map} +1 -1
- package/dist/_chunks/{PkToolShowVideo-DKDR3zmI.js → PkToolShowVideo-DtJ0nEJk.js} +2 -2
- package/dist/_chunks/{PkToolShowVideo-DKDR3zmI.js.map → PkToolShowVideo-DtJ0nEJk.js.map} +1 -1
- package/dist/_chunks/{PkToolShowWebPages-CuJ12tdE.js → PkToolShowWebPages-D-tG9JH8.js} +2 -2
- package/dist/_chunks/{PkToolShowWebPages-CuJ12tdE.js.map → PkToolShowWebPages-D-tG9JH8.js.map} +1 -1
- package/dist/_chunks/{chatImagePolicy-D3zIP7-i.js → chatImagePolicy-Dhxqcirq.js} +2 -2
- package/dist/_chunks/{chatImagePolicy-D3zIP7-i.js.map → chatImagePolicy-Dhxqcirq.js.map} +1 -1
- package/dist/_chunks/{markdown-BxOlM5SY.js → markdown-CUaXq5OY.js} +2 -2
- package/dist/_chunks/{markdown-BxOlM5SY.js.map → markdown-CUaXq5OY.js.map} +1 -1
- package/dist/ai-elements.es.js +2720 -2269
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotEmptyState.js +1 -1
- package/dist-vue/PkChatbotInput.js +1 -1
- package/dist-vue/PkChatbotMessages.js +1 -1
- package/dist-vue/PkChatbotStepPayload.js +1 -1
- package/dist-vue/PkChatbotStepToolDetail.js +1 -1
- package/dist-vue/PkChatbotSteps.js +1 -1
- package/dist-vue/PkChatbotViewChat.js +1 -1
- package/dist-vue/PkChatbotViewConversations.js +1 -1
- package/dist-vue/PkChatbotViewFiles.js +1 -1
- package/dist-vue/PkChatbotViewProfile.js +1 -1
- package/dist-vue/_chunks/{Agent-Dsi_xGvV.js → Agent-D3US-D1x.js} +13 -2
- package/dist-vue/_chunks/Agent-D3US-D1x.js.map +1 -0
- package/dist-vue/_chunks/{Document-B5R1PJnc.js → Document-D5FVOcP9.js} +2 -2
- package/dist-vue/_chunks/{Document-B5R1PJnc.js.map → Document-D5FVOcP9.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbot-CBpViucq.js → PkChatbot-DxPT26Vn.js} +8 -8
- package/dist-vue/_chunks/{PkChatbot-CBpViucq.js.map → PkChatbot-DxPT26Vn.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotEmptyState-DKrmLdVU.js → PkChatbotEmptyState-3VeE3lFA.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotEmptyState-DKrmLdVU.js.map → PkChatbotEmptyState-3VeE3lFA.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotInput-C1i14Ur_.js → PkChatbotInput-SWQVz3m7.js} +212 -175
- package/dist-vue/_chunks/PkChatbotInput-SWQVz3m7.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotMessages-Ce8h0QNX.js → PkChatbotMessages-DFimKbCj.js} +122 -114
- package/dist-vue/_chunks/PkChatbotMessages-DFimKbCj.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotStepPayload-Dp_akrQu.js → PkChatbotStepPayload-Di0FNaTC.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotStepPayload-Dp_akrQu.js.map → PkChatbotStepPayload-Di0FNaTC.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-CKxl4_lQ.js → PkChatbotStepToolDetail-Bne48uS8.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-CKxl4_lQ.js.map → PkChatbotStepToolDetail-Bne48uS8.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotSteps-ChaHkHjG.js → PkChatbotSteps-Cr9nwMQj.js} +5 -5
- package/dist-vue/_chunks/{PkChatbotSteps-ChaHkHjG.js.map → PkChatbotSteps-Cr9nwMQj.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewChat-Bjw6x7VD.js → PkChatbotViewChat-CQy-k_dp.js} +417 -404
- package/dist-vue/_chunks/PkChatbotViewChat-CQy-k_dp.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewConversations-D-UK4paq.js → PkChatbotViewConversations-Bng-dyqd.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewConversations-D-UK4paq.js.map → PkChatbotViewConversations-Bng-dyqd.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewFiles-57kQRbZm.js → PkChatbotViewFiles-Ccti1JAS.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewFiles-57kQRbZm.js.map → PkChatbotViewFiles-Ccti1JAS.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewProfile-BZTify2Q.js → PkChatbotViewProfile-ChEItAHZ.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewProfile-BZTify2Q.js.map → PkChatbotViewProfile-ChEItAHZ.js.map} +1 -1
- package/dist-vue/_chunks/{PkStreamingMarkdown-4Ez-DDFq.js → PkStreamingMarkdown-92GXUXrG.js} +3 -3
- package/dist-vue/_chunks/{PkStreamingMarkdown-4Ez-DDFq.js.map → PkStreamingMarkdown-92GXUXrG.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolChatFile-DaivFIhK.js → PkToolChatFile-Ca45de6q.js} +2 -2
- package/dist-vue/_chunks/{PkToolChatFile-DaivFIhK.js.map → PkToolChatFile-Ca45de6q.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolRequestGeolocation-B__wk6m3.js → PkToolRequestGeolocation-gEDbmudT.js} +2 -2
- package/dist-vue/_chunks/{PkToolRequestGeolocation-B__wk6m3.js.map → PkToolRequestGeolocation-gEDbmudT.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolRequestOAuthConnection-BAttadSC.js → PkToolRequestOAuthConnection-Dy0GXNwC.js} +2 -2
- package/dist-vue/_chunks/{PkToolRequestOAuthConnection-BAttadSC.js.map → PkToolRequestOAuthConnection-Dy0GXNwC.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowArtifact-CncSr7Z8.js → PkToolShowArtifact-B-BUIMju.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowArtifact-CncSr7Z8.js.map → PkToolShowArtifact-B-BUIMju.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowContactForm-Bi5N1fFe.js → PkToolShowContactForm-NRfvmPLV.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowContactForm-Bi5N1fFe.js.map → PkToolShowContactForm-NRfvmPLV.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowDiagram-D8NF9lZu.js → PkToolShowDiagram-VTi8vwcN.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowDiagram-D8NF9lZu.js.map → PkToolShowDiagram-VTi8vwcN.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowForm-Dmyn6cMU.js → PkToolShowForm-C4JnalBU.js} +4 -4
- package/dist-vue/_chunks/{PkToolShowForm-Dmyn6cMU.js.map → PkToolShowForm-C4JnalBU.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowImageGallery-XZiRk6FK.js → PkToolShowImageGallery-ORfqyhhh.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowImageGallery-XZiRk6FK.js.map → PkToolShowImageGallery-ORfqyhhh.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowProductList-DzvPUdbo.js → PkToolShowProductList-C9kbfutK.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowProductList-DzvPUdbo.js.map → PkToolShowProductList-C9kbfutK.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSources-NOSBkQCi.js → PkToolShowSources-BVfcp1iE.js} +3 -3
- package/dist-vue/_chunks/{PkToolShowSources-NOSBkQCi.js.map → PkToolShowSources-BVfcp1iE.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSuggestedReply-C7dUB3dz.js → PkToolShowSuggestedReply-Bb7Inxa4.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowSuggestedReply-C7dUB3dz.js.map → PkToolShowSuggestedReply-Bb7Inxa4.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowVideo-sSZyISJH.js → PkToolShowVideo-CUNITpHh.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowVideo-sSZyISJH.js.map → PkToolShowVideo-CUNITpHh.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowWebPages-B1c4X_cH.js → PkToolShowWebPages-C-yl2smm.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowWebPages-B1c4X_cH.js.map → PkToolShowWebPages-C-yl2smm.js.map} +1 -1
- package/dist-vue/_chunks/{createChatbotApiClient-BmBo5IQR.js → createChatbotApiClient-CuqGJGHD.js} +2 -2
- package/dist-vue/_chunks/createChatbotApiClient-CuqGJGHD.js.map +1 -0
- package/dist-vue/_chunks/{useChatbotStore-D7ZMA7Tr.js → useChatbotStore-C1lW6qXE.js} +1143 -1134
- package/dist-vue/_chunks/useChatbotStore-C1lW6qXE.js.map +1 -0
- package/dist-vue/_chunks/{utils-CKsn0vxx.js → utils-CoLdYTZq.js} +2 -2
- package/dist-vue/_chunks/{utils-CKsn0vxx.js.map → utils-CoLdYTZq.js.map} +1 -1
- package/dist-vue/api.js +1 -1
- package/dist-vue/apps/web-component/src/components/EmbeddedChatWidget.ce.d.ts +4 -4
- package/dist-vue/apps/web-component/src/composables/useChatbotAgent.d.ts +2 -0
- package/dist-vue/apps/web-component/src/composables/useChatbotAuth.d.ts +3 -3
- package/dist-vue/apps/web-component/src/composables/usePagePointer.d.ts +50 -0
- package/dist-vue/apps/web-component/src/composables/usePageTools.d.ts +21 -0
- package/dist-vue/apps/web-component/src/pageTools/index.d.ts +8 -1
- package/dist-vue/apps/web-component/src/pageTools/pointing.d.ts +41 -0
- package/dist-vue/apps/web-component/src/pageTools/snapshot.d.ts +2 -0
- package/dist-vue/composables.js +24 -8
- package/dist-vue/composables.js.map +1 -1
- package/dist-vue/index.js +47 -30
- package/dist-vue/index.js.map +1 -1
- package/dist-vue/locales.js +20 -0
- package/dist-vue/packages/components/src/chat/PkAgentPageAccessSettings.d.ts +2 -0
- package/dist-vue/packages/components/src/chat/PkAgentSettingsPanel.d.ts +2 -0
- package/dist-vue/packages/components/src/chat/PkChatbotInput.d.ts +16 -3
- package/dist-vue/packages/components/src/chat/PkPagePointer.d.ts +41 -0
- package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +150 -6
- package/dist-vue/packages/models/src/schema/Agent.d.ts +7 -0
- package/dist-vue/packages/models/src/schema/Chat.d.ts +8 -0
- package/dist-vue/packages/models/src/schema/PageAccess.d.ts +29 -1
- package/dist-vue/packages/models/src/schema/ReasoningChat.d.ts +2 -0
- package/dist-vue/packages/models/src/schema/SubAgent.d.ts +2 -0
- package/dist-vue/style.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/Agent-C0JtGK2t.js.map +0 -1
- package/dist-vue/_chunks/Agent-Dsi_xGvV.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotInput-C1i14Ur_.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotMessages-Ce8h0QNX.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotViewChat-Bjw6x7VD.js.map +0 -1
- package/dist-vue/_chunks/createChatbotApiClient-BmBo5IQR.js.map +0 -1
- package/dist-vue/_chunks/useChatbotStore-D7ZMA7Tr.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
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-BO5QlXAp.js";
|
|
2
|
-
import { $ as
|
|
3
|
-
import { r as
|
|
4
|
-
import { n as
|
|
5
|
-
import { d as
|
|
6
|
-
import { n as
|
|
7
|
-
import { computed as
|
|
2
|
+
import { $ as ee, B as y, G as te, Q as ne, W as re, Y as ie, et as ae, q as oe } from "./Agent-D3US-D1x.js";
|
|
3
|
+
import { r as se, t as ce } from "./createChatbotApiClient-CuqGJGHD.js";
|
|
4
|
+
import { n as le } from "./src-j7iLdNe4.js";
|
|
5
|
+
import { d as ue, r as de } from "./message-DuibQyHy.js";
|
|
6
|
+
import { n as fe, t as pe } from "./useSafeLocalStorage-DImmddot.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 S, toRefs as ye, toValue as be, watch as C, watchEffect as xe } from "vue";
|
|
8
8
|
import { useI18n as Se } from "vue-i18n";
|
|
9
9
|
import { useDocumentVisibility as Ce, usePreferredDark as we } from "@vueuse/core";
|
|
10
10
|
import { defineStore as Te } from "pinia";
|
|
@@ -57,9 +57,9 @@ async function De(e) {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
// ../../packages/composable/src/chatbot/hostTools.ts
|
|
60
|
-
var Oe = "agentstudio:page-navigation", ke = (e) => typeof e?.afterOutput == "function", Ae = (e) => e.toolMetadata?.source ===
|
|
60
|
+
var Oe = "agentstudio:page-navigation", ke = (e) => typeof e?.afterOutput == "function", Ae = (e) => e.toolMetadata?.source === ne, je = (e, t) => {
|
|
61
61
|
if (!t || !e?.length) return;
|
|
62
|
-
let n = new Set(t.allowed), r = e.filter((e) => n.has(e.name) && !
|
|
62
|
+
let n = new Set(t.allowed), r = e.filter((e) => n.has(e.name) && !oe(e.name)).map(({ execute: e, confirmation: t, policy: n, ...r }) => r);
|
|
63
63
|
return r.length > 0 ? r : void 0;
|
|
64
64
|
};
|
|
65
65
|
function Me(e) {
|
|
@@ -80,7 +80,7 @@ function Me(e) {
|
|
|
80
80
|
async function d(n, r) {
|
|
81
81
|
let i = () => r === t, d = e.capability(), f = e.registry()?.find((e) => e.name === n.toolName), p = f?.policy?.timeoutMs ?? d?.timeoutMs;
|
|
82
82
|
if (!f || p === void 0) {
|
|
83
|
-
u(n,
|
|
83
|
+
u(n, ee(n.readOnly));
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
let m;
|
|
@@ -129,7 +129,7 @@ function Me(e) {
|
|
|
129
129
|
} catch (e) {
|
|
130
130
|
if (v?.then(s, () => void 0), !i()) return;
|
|
131
131
|
let t = g.signal.aborted;
|
|
132
|
-
u(n, t ?
|
|
132
|
+
u(n, t ? ee(n.readOnly) : e instanceof Error && e.message ? e.message : "The host app failed to run this call.");
|
|
133
133
|
} finally {
|
|
134
134
|
clearTimeout(_), a.delete(n.toolCallId), e.onActivity?.(void 0);
|
|
135
135
|
}
|
|
@@ -172,43 +172,43 @@ var Ne = "vercel.ai.error", Pe = Symbol.for(Ne), w = class e extends Error {
|
|
|
172
172
|
static isInstance(e) {
|
|
173
173
|
return w.hasMarker(e, Ie);
|
|
174
174
|
}
|
|
175
|
-
}, ze = "AI_EmptyResponseBodyError",
|
|
175
|
+
}, ze = "AI_EmptyResponseBodyError", Be = `vercel.ai.error.${ze}`, Ve = Symbol.for(Be), He = class extends w {
|
|
176
176
|
constructor({ message: e = "Empty response body" } = {}) {
|
|
177
177
|
super({
|
|
178
178
|
name: ze,
|
|
179
179
|
message: e
|
|
180
|
-
}), this[
|
|
180
|
+
}), this[Ve] = !0;
|
|
181
181
|
}
|
|
182
182
|
static isInstance(e) {
|
|
183
|
-
return w.hasMarker(e,
|
|
183
|
+
return w.hasMarker(e, Be);
|
|
184
184
|
}
|
|
185
185
|
};
|
|
186
|
-
function
|
|
186
|
+
function T(e) {
|
|
187
187
|
return e == null ? "unknown error" : typeof e == "string" ? e : e instanceof Error ? e.toString() : JSON.stringify(e);
|
|
188
188
|
}
|
|
189
|
-
var
|
|
189
|
+
var Ue = "AI_InvalidArgumentError", We = `vercel.ai.error.${Ue}`, E = Symbol.for(We), Ge = class extends w {
|
|
190
190
|
constructor({ message: e, cause: t, argument: n }) {
|
|
191
191
|
super({
|
|
192
|
-
name:
|
|
192
|
+
name: Ue,
|
|
193
193
|
message: e,
|
|
194
194
|
cause: t
|
|
195
|
-
}), this[
|
|
195
|
+
}), this[E] = !0, this.argument = n;
|
|
196
196
|
}
|
|
197
197
|
static isInstance(e) {
|
|
198
|
-
return w.hasMarker(e,
|
|
198
|
+
return w.hasMarker(e, We);
|
|
199
199
|
}
|
|
200
|
-
},
|
|
200
|
+
}, D = "AI_JSONParseError", Ke = `vercel.ai.error.${D}`, qe = Symbol.for(Ke), Je = class extends w {
|
|
201
201
|
constructor({ text: e, cause: t }) {
|
|
202
202
|
super({
|
|
203
|
-
name:
|
|
204
|
-
message: `JSON parsing failed: Text: ${e}.\nError message: ${
|
|
203
|
+
name: D,
|
|
204
|
+
message: `JSON parsing failed: Text: ${e}.\nError message: ${T(t)}`,
|
|
205
205
|
cause: t
|
|
206
|
-
}), this[
|
|
206
|
+
}), this[qe] = !0, this.text = e;
|
|
207
207
|
}
|
|
208
208
|
static isInstance(e) {
|
|
209
|
-
return w.hasMarker(e,
|
|
209
|
+
return w.hasMarker(e, Ke);
|
|
210
210
|
}
|
|
211
|
-
},
|
|
211
|
+
}, Ye = "AI_TypeValidationError", Xe = `vercel.ai.error.${Ye}`, Ze = Symbol.for(Xe), O = class e extends w {
|
|
212
212
|
constructor({ value: e, cause: t, context: n }) {
|
|
213
213
|
let r = "Type validation failed";
|
|
214
214
|
if (n?.field && (r += ` for ${n.field}`), n?.entityName || n?.entityId) {
|
|
@@ -217,13 +217,13 @@ var He = "AI_InvalidArgumentError", Ue = `vercel.ai.error.${He}`, We = Symbol.fo
|
|
|
217
217
|
n.entityName && e.push(n.entityName), n.entityId && e.push(`id: "${n.entityId}"`), r += e.join(", "), r += ")";
|
|
218
218
|
}
|
|
219
219
|
super({
|
|
220
|
-
name:
|
|
221
|
-
message: `${r}: Value: ${JSON.stringify(e)}.\nError message: ${
|
|
220
|
+
name: Ye,
|
|
221
|
+
message: `${r}: Value: ${JSON.stringify(e)}.\nError message: ${T(t)}`,
|
|
222
222
|
cause: t
|
|
223
|
-
}), this[
|
|
223
|
+
}), this[Ze] = !0, this.value = e, this.context = n;
|
|
224
224
|
}
|
|
225
225
|
static isInstance(e) {
|
|
226
|
-
return w.hasMarker(e,
|
|
226
|
+
return w.hasMarker(e, Xe);
|
|
227
227
|
}
|
|
228
228
|
static wrap({ value: t, cause: n, context: r }) {
|
|
229
229
|
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({
|
|
@@ -232,25 +232,25 @@ var He = "AI_InvalidArgumentError", Ue = `vercel.ai.error.${He}`, We = Symbol.fo
|
|
|
232
232
|
context: r
|
|
233
233
|
});
|
|
234
234
|
}
|
|
235
|
-
},
|
|
235
|
+
}, Qe = "AI_UnsupportedFunctionalityError", $e = `vercel.ai.error.${Qe}`, et = Symbol.for($e), tt = class extends w {
|
|
236
236
|
constructor({ functionality: e, message: t = `'${e}' functionality not supported.` }) {
|
|
237
237
|
super({
|
|
238
|
-
name:
|
|
238
|
+
name: Qe,
|
|
239
239
|
message: t
|
|
240
|
-
}), this[
|
|
240
|
+
}), this[et] = !0, this.functionality = e;
|
|
241
241
|
}
|
|
242
242
|
static isInstance(e) {
|
|
243
|
-
return w.hasMarker(e,
|
|
243
|
+
return w.hasMarker(e, $e);
|
|
244
244
|
}
|
|
245
|
-
},
|
|
245
|
+
}, k = class extends Error {
|
|
246
246
|
constructor(e, t) {
|
|
247
247
|
super(e), this.name = "ParseError", this.type = t.type, this.field = t.field, this.value = t.value, this.line = t.line;
|
|
248
248
|
}
|
|
249
|
-
},
|
|
250
|
-
function
|
|
251
|
-
function
|
|
249
|
+
}, nt = 10, rt = 13, it = 32;
|
|
250
|
+
function A(e) {}
|
|
251
|
+
function at(e) {
|
|
252
252
|
if (typeof e == "function") throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");
|
|
253
|
-
let { onEvent: t =
|
|
253
|
+
let { onEvent: t = A, onError: n = A, onRetry: r = A, onComment: i, maxBufferSize: a } = e, o = [], s = 0, c = !0, l, u = "", d = 0, f, p = !1;
|
|
254
254
|
function m(e) {
|
|
255
255
|
if (p) throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");
|
|
256
256
|
if (c && (c = !1, e.charCodeAt(0) === 239 && e.charCodeAt(1) === 187 && e.charCodeAt(2) === 191 && (e = e.slice(3))), o.length === 0) {
|
|
@@ -269,7 +269,7 @@ function ot(e) {
|
|
|
269
269
|
n !== "" && (o.push(n), s = n.length), h();
|
|
270
270
|
}
|
|
271
271
|
function h() {
|
|
272
|
-
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
|
|
272
|
+
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 k(`Buffered data exceeded max buffer size of ${a} characters`, { type: "max-buffer-size-exceeded" }))));
|
|
273
273
|
}
|
|
274
274
|
function g(e) {
|
|
275
275
|
let n = 0;
|
|
@@ -285,9 +285,9 @@ function ot(e) {
|
|
|
285
285
|
continue;
|
|
286
286
|
}
|
|
287
287
|
let i = e.charCodeAt(n);
|
|
288
|
-
if (
|
|
289
|
-
let i = e.charCodeAt(n + 5) ===
|
|
290
|
-
if (d === 0 && e.charCodeAt(r + 1) ===
|
|
288
|
+
if (ot(e, n, i)) {
|
|
289
|
+
let i = e.charCodeAt(n + 5) === it ? n + 6 : n + 5, a = e.slice(i, r);
|
|
290
|
+
if (d === 0 && e.charCodeAt(r + 1) === nt) {
|
|
291
291
|
t({
|
|
292
292
|
id: l,
|
|
293
293
|
event: f,
|
|
@@ -297,7 +297,7 @@ function ot(e) {
|
|
|
297
297
|
}
|
|
298
298
|
u = d === 0 ? a : `${u}
|
|
299
299
|
${a}`, d++;
|
|
300
|
-
} else st(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) ===
|
|
300
|
+
} else st(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) === it ? n + 7 : n + 6, r) || void 0 : _(e, n, r);
|
|
301
301
|
n = r + 1, r = e.indexOf("\n", n);
|
|
302
302
|
}
|
|
303
303
|
return e.slice(n);
|
|
@@ -305,35 +305,35 @@ ${a}`, d++;
|
|
|
305
305
|
for (; n < e.length;) {
|
|
306
306
|
let t = e.indexOf("\r", n), r = e.indexOf("\n", n), i = -1;
|
|
307
307
|
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;
|
|
308
|
-
_(e, n, i), n = i + 1, e.charCodeAt(n - 1) ===
|
|
308
|
+
_(e, n, i), n = i + 1, e.charCodeAt(n - 1) === rt && e.charCodeAt(n) === nt && n++;
|
|
309
309
|
}
|
|
310
310
|
return e.slice(n);
|
|
311
311
|
}
|
|
312
312
|
function _(e, t, n) {
|
|
313
313
|
if (t === n) {
|
|
314
|
-
|
|
314
|
+
ee();
|
|
315
315
|
return;
|
|
316
316
|
}
|
|
317
317
|
let r = e.charCodeAt(t);
|
|
318
|
-
if (
|
|
319
|
-
let r = e.charCodeAt(t + 5) ===
|
|
318
|
+
if (ot(e, t, r)) {
|
|
319
|
+
let r = e.charCodeAt(t + 5) === it ? t + 6 : t + 5, i = e.slice(r, n);
|
|
320
320
|
u = d === 0 ? i : `${u}
|
|
321
321
|
${i}`, d++;
|
|
322
322
|
return;
|
|
323
323
|
}
|
|
324
324
|
if (st(e, t, r)) {
|
|
325
|
-
f = e.slice(e.charCodeAt(t + 6) ===
|
|
325
|
+
f = e.slice(e.charCodeAt(t + 6) === it ? t + 7 : t + 6, n) || void 0;
|
|
326
326
|
return;
|
|
327
327
|
}
|
|
328
328
|
if (r === 105 && e.charCodeAt(t + 1) === 100 && e.charCodeAt(t + 2) === 58) {
|
|
329
|
-
let r = e.slice(e.charCodeAt(t + 3) ===
|
|
329
|
+
let r = e.slice(e.charCodeAt(t + 3) === it ? t + 4 : t + 3, n);
|
|
330
330
|
l = r.includes("\0") ? void 0 : r;
|
|
331
331
|
return;
|
|
332
332
|
}
|
|
333
333
|
if (r === 58) {
|
|
334
334
|
if (i) {
|
|
335
335
|
let r = e.slice(t, n);
|
|
336
|
-
i(r.slice(e.charCodeAt(t + 1) ===
|
|
336
|
+
i(r.slice(e.charCodeAt(t + 1) === it ? 2 : 1));
|
|
337
337
|
}
|
|
338
338
|
return;
|
|
339
339
|
}
|
|
@@ -342,7 +342,7 @@ ${i}`, d++;
|
|
|
342
342
|
v(a, "", a);
|
|
343
343
|
return;
|
|
344
344
|
}
|
|
345
|
-
let s = a.slice(0, o), c = a.charCodeAt(o + 1) ===
|
|
345
|
+
let s = a.slice(0, o), c = a.charCodeAt(o + 1) === it ? 2 : 1;
|
|
346
346
|
v(s, a.slice(o + c), a);
|
|
347
347
|
}
|
|
348
348
|
function v(e, t, i) {
|
|
@@ -358,13 +358,13 @@ ${t}`, d++;
|
|
|
358
358
|
l = t.includes("\0") ? void 0 : t;
|
|
359
359
|
break;
|
|
360
360
|
case "retry":
|
|
361
|
-
/^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new
|
|
361
|
+
/^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new k(`Invalid \`retry\` value: "${t}"`, {
|
|
362
362
|
type: "invalid-retry",
|
|
363
363
|
value: t,
|
|
364
364
|
line: i
|
|
365
365
|
}));
|
|
366
366
|
break;
|
|
367
|
-
default: n(new
|
|
367
|
+
default: n(new k(`Unknown field "${e.length > 20 ? `${e.slice(0, 20)}\u2026` : e}"`, {
|
|
368
368
|
type: "unknown-field",
|
|
369
369
|
field: e,
|
|
370
370
|
value: t,
|
|
@@ -372,14 +372,14 @@ ${t}`, d++;
|
|
|
372
372
|
}));
|
|
373
373
|
}
|
|
374
374
|
}
|
|
375
|
-
function
|
|
375
|
+
function ee() {
|
|
376
376
|
d > 0 && t({
|
|
377
377
|
id: l,
|
|
378
378
|
event: f,
|
|
379
379
|
data: u
|
|
380
380
|
}), l = void 0, u = "", d = 0, f = void 0;
|
|
381
381
|
}
|
|
382
|
-
function
|
|
382
|
+
function y(e = {}) {
|
|
383
383
|
if (e.consume && o.length > 0) {
|
|
384
384
|
let e = o.join("");
|
|
385
385
|
_(e, 0, e.length);
|
|
@@ -388,10 +388,10 @@ ${t}`, d++;
|
|
|
388
388
|
}
|
|
389
389
|
return {
|
|
390
390
|
feed: m,
|
|
391
|
-
reset:
|
|
391
|
+
reset: y
|
|
392
392
|
};
|
|
393
393
|
}
|
|
394
|
-
function
|
|
394
|
+
function ot(e, t, n) {
|
|
395
395
|
return n === 100 && e.charCodeAt(t + 1) === 97 && e.charCodeAt(t + 2) === 116 && e.charCodeAt(t + 3) === 97 && e.charCodeAt(t + 4) === 58;
|
|
396
396
|
}
|
|
397
397
|
function st(e, t, n) {
|
|
@@ -403,7 +403,7 @@ var ct = class extends TransformStream {
|
|
|
403
403
|
let i;
|
|
404
404
|
super({
|
|
405
405
|
start(a) {
|
|
406
|
-
i =
|
|
406
|
+
i = at({
|
|
407
407
|
onEvent: (e) => {
|
|
408
408
|
a.enqueue(e);
|
|
409
409
|
},
|
|
@@ -452,11 +452,11 @@ function pt(e) {
|
|
|
452
452
|
return globalThis.Buffer?.isBuffer(e) ?? !1;
|
|
453
453
|
}
|
|
454
454
|
var mt = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/, ht = /"(?: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*:/;
|
|
455
|
-
function
|
|
455
|
+
function gt(e) {
|
|
456
456
|
let t = JSON.parse(e);
|
|
457
|
-
return typeof t != "object" || !t || mt.test(e) === !1 && ht.test(e) === !1 ? t :
|
|
457
|
+
return typeof t != "object" || !t || mt.test(e) === !1 && ht.test(e) === !1 ? t : _t(t);
|
|
458
458
|
}
|
|
459
|
-
function
|
|
459
|
+
function _t(e) {
|
|
460
460
|
let t = [e];
|
|
461
461
|
for (; t.length;) {
|
|
462
462
|
let e = t;
|
|
@@ -471,35 +471,35 @@ function gt(e) {
|
|
|
471
471
|
}
|
|
472
472
|
return e;
|
|
473
473
|
}
|
|
474
|
-
function
|
|
474
|
+
function vt(e) {
|
|
475
475
|
let { stackTraceLimit: t } = Error;
|
|
476
476
|
try {
|
|
477
477
|
Error.stackTraceLimit = 0;
|
|
478
478
|
} catch {
|
|
479
|
-
return
|
|
479
|
+
return gt(e);
|
|
480
480
|
}
|
|
481
481
|
try {
|
|
482
|
-
return
|
|
482
|
+
return gt(e);
|
|
483
483
|
} finally {
|
|
484
484
|
Error.stackTraceLimit = t;
|
|
485
485
|
}
|
|
486
486
|
}
|
|
487
|
-
function
|
|
487
|
+
function yt(e) {
|
|
488
488
|
if (e.type === "object" || Array.isArray(e.type) && e.type.includes("object")) {
|
|
489
489
|
let { additionalProperties: t } = e;
|
|
490
|
-
e.additionalProperties = t != null && typeof t != "boolean" &&
|
|
490
|
+
e.additionalProperties = t != null && typeof t != "boolean" && M(t);
|
|
491
491
|
let { properties: n } = e;
|
|
492
|
-
if (n != null) for (let e of Object.keys(n)) n[e] =
|
|
492
|
+
if (n != null) for (let e of Object.keys(n)) n[e] = M(n[e]);
|
|
493
493
|
}
|
|
494
|
-
e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(
|
|
494
|
+
e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(M) : M(e.items)), e.anyOf != null && (e.anyOf = e.anyOf.map(M)), e.allOf != null && (e.allOf = e.allOf.map(M)), e.oneOf != null && (e.oneOf = e.oneOf.map(M));
|
|
495
495
|
let { definitions: t } = e;
|
|
496
|
-
if (t != null) for (let e of Object.keys(t)) t[e] =
|
|
496
|
+
if (t != null) for (let e of Object.keys(t)) t[e] = M(t[e]);
|
|
497
497
|
return e;
|
|
498
498
|
}
|
|
499
|
-
function
|
|
500
|
-
return typeof e == "boolean" ? e :
|
|
499
|
+
function M(e) {
|
|
500
|
+
return typeof e == "boolean" ? e : yt(e);
|
|
501
501
|
}
|
|
502
|
-
var
|
|
502
|
+
var bt = Symbol("Let zodToJsonSchema decide on which parser to use"), xt = {
|
|
503
503
|
name: void 0,
|
|
504
504
|
$refStrategy: "root",
|
|
505
505
|
basePath: ["#"],
|
|
@@ -519,24 +519,24 @@ var P = Symbol("Let zodToJsonSchema decide on which parser to use"), F = {
|
|
|
519
519
|
emailStrategy: "format:email",
|
|
520
520
|
base64Strategy: "contentEncoding:base64",
|
|
521
521
|
nameStrategy: "ref"
|
|
522
|
-
},
|
|
523
|
-
...
|
|
522
|
+
}, St = (e) => typeof e == "string" ? {
|
|
523
|
+
...xt,
|
|
524
524
|
name: e
|
|
525
525
|
} : {
|
|
526
|
-
...
|
|
526
|
+
...xt,
|
|
527
527
|
...e
|
|
528
528
|
};
|
|
529
|
-
function
|
|
529
|
+
function N() {
|
|
530
530
|
return {};
|
|
531
531
|
}
|
|
532
|
-
function
|
|
532
|
+
function P(e, t) {
|
|
533
533
|
let n = { type: "array" };
|
|
534
|
-
return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items =
|
|
534
|
+
return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = G(e.type._def, {
|
|
535
535
|
...t,
|
|
536
536
|
currentPath: [...t.currentPath, "items"]
|
|
537
537
|
})), 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;
|
|
538
538
|
}
|
|
539
|
-
function
|
|
539
|
+
function F(e) {
|
|
540
540
|
let t = {
|
|
541
541
|
type: "integer",
|
|
542
542
|
format: "int64"
|
|
@@ -553,16 +553,16 @@ function xt(e) {
|
|
|
553
553
|
}
|
|
554
554
|
return t;
|
|
555
555
|
}
|
|
556
|
-
function
|
|
556
|
+
function Ct() {
|
|
557
557
|
return { type: "boolean" };
|
|
558
558
|
}
|
|
559
|
-
function
|
|
560
|
-
return
|
|
559
|
+
function wt(e, t) {
|
|
560
|
+
return G(e.type._def, t);
|
|
561
561
|
}
|
|
562
|
-
var
|
|
563
|
-
function
|
|
562
|
+
var Tt = (e, t) => G(e.innerType._def, t);
|
|
563
|
+
function Et(e, t, n) {
|
|
564
564
|
let r = n ?? t.dateStrategy;
|
|
565
|
-
if (Array.isArray(r)) return { anyOf: r.map((n) =>
|
|
565
|
+
if (Array.isArray(r)) return { anyOf: r.map((n) => Et(e, t, n)) };
|
|
566
566
|
switch (r) {
|
|
567
567
|
case "string":
|
|
568
568
|
case "format:date-time": return {
|
|
@@ -573,10 +573,10 @@ function wt(e, t, n) {
|
|
|
573
573
|
type: "string",
|
|
574
574
|
format: "date"
|
|
575
575
|
};
|
|
576
|
-
case "integer": return
|
|
576
|
+
case "integer": return Dt(e);
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
|
-
var
|
|
579
|
+
var Dt = (e) => {
|
|
580
580
|
let t = {
|
|
581
581
|
type: "integer",
|
|
582
582
|
format: "unix-time"
|
|
@@ -589,31 +589,31 @@ var Tt = (e) => {
|
|
|
589
589
|
}
|
|
590
590
|
return t;
|
|
591
591
|
};
|
|
592
|
-
function
|
|
592
|
+
function Ot(e, t) {
|
|
593
593
|
return {
|
|
594
|
-
...
|
|
594
|
+
...G(e.innerType._def, t),
|
|
595
595
|
default: e.defaultValue()
|
|
596
596
|
};
|
|
597
597
|
}
|
|
598
|
-
function
|
|
599
|
-
return t.effectStrategy === "input" ?
|
|
598
|
+
function I(e, t) {
|
|
599
|
+
return t.effectStrategy === "input" ? G(e.schema._def, t) : N();
|
|
600
600
|
}
|
|
601
|
-
function
|
|
601
|
+
function kt(e) {
|
|
602
602
|
return {
|
|
603
603
|
type: "string",
|
|
604
604
|
enum: Array.from(e.values)
|
|
605
605
|
};
|
|
606
606
|
}
|
|
607
|
-
var
|
|
608
|
-
function
|
|
609
|
-
let n = [
|
|
607
|
+
var At = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
|
|
608
|
+
function jt(e, t) {
|
|
609
|
+
let n = [G(e.left._def, {
|
|
610
610
|
...t,
|
|
611
611
|
currentPath: [
|
|
612
612
|
...t.currentPath,
|
|
613
613
|
"allOf",
|
|
614
614
|
"0"
|
|
615
615
|
]
|
|
616
|
-
}),
|
|
616
|
+
}), G(e.right._def, {
|
|
617
617
|
...t,
|
|
618
618
|
currentPath: [
|
|
619
619
|
...t.currentPath,
|
|
@@ -622,7 +622,7 @@ function R(e, t) {
|
|
|
622
622
|
]
|
|
623
623
|
})].filter((e) => !!e), r = [];
|
|
624
624
|
return n.forEach((e) => {
|
|
625
|
-
if (
|
|
625
|
+
if (At(e)) r.push(...e.allOf);
|
|
626
626
|
else {
|
|
627
627
|
let t = e;
|
|
628
628
|
if ("additionalProperties" in e && e.additionalProperties === !1) {
|
|
@@ -633,19 +633,19 @@ function R(e, t) {
|
|
|
633
633
|
}
|
|
634
634
|
}), r.length ? { allOf: r } : void 0;
|
|
635
635
|
}
|
|
636
|
-
function
|
|
636
|
+
function Mt(e) {
|
|
637
637
|
let t = typeof e.value;
|
|
638
638
|
return t !== "bigint" && t !== "number" && t !== "boolean" && t !== "string" ? { type: Array.isArray(e.value) ? "array" : "object" } : {
|
|
639
639
|
type: t === "bigint" ? "integer" : t,
|
|
640
640
|
const: e.value
|
|
641
641
|
};
|
|
642
642
|
}
|
|
643
|
-
var
|
|
643
|
+
var Nt = void 0, L = {
|
|
644
644
|
cuid: /^[cC][^\s-]{8,}$/,
|
|
645
645
|
cuid2: /^[0-9a-z]+$/,
|
|
646
646
|
ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
|
|
647
647
|
email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}$/,
|
|
648
|
-
emoji: () => (
|
|
648
|
+
emoji: () => (Nt === void 0 && (Nt = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u")), Nt),
|
|
649
649
|
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}$/,
|
|
650
650
|
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])$/,
|
|
651
651
|
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])$/,
|
|
@@ -656,7 +656,7 @@ var z = void 0, B = {
|
|
|
656
656
|
nanoid: /^[a-zA-Z0-9_-]{21}$/,
|
|
657
657
|
jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
|
|
658
658
|
};
|
|
659
|
-
function
|
|
659
|
+
function R(e, t) {
|
|
660
660
|
let n = { type: "string" };
|
|
661
661
|
if (e.checks) for (let r of e.checks) switch (r.kind) {
|
|
662
662
|
case "min":
|
|
@@ -668,108 +668,108 @@ function jt(e, t) {
|
|
|
668
668
|
case "email":
|
|
669
669
|
switch (t.emailStrategy) {
|
|
670
670
|
case "format:email":
|
|
671
|
-
|
|
671
|
+
z(n, "email", r.message, t);
|
|
672
672
|
break;
|
|
673
673
|
case "format:idn-email":
|
|
674
|
-
|
|
674
|
+
z(n, "idn-email", r.message, t);
|
|
675
675
|
break;
|
|
676
|
-
case "pattern:zod":
|
|
676
|
+
case "pattern:zod": B(n, L.email, r.message, t);
|
|
677
677
|
}
|
|
678
678
|
break;
|
|
679
679
|
case "url":
|
|
680
|
-
|
|
680
|
+
z(n, "uri", r.message, t);
|
|
681
681
|
break;
|
|
682
682
|
case "uuid":
|
|
683
|
-
|
|
683
|
+
z(n, "uuid", r.message, t);
|
|
684
684
|
break;
|
|
685
685
|
case "regex":
|
|
686
|
-
|
|
686
|
+
B(n, r.regex, r.message, t);
|
|
687
687
|
break;
|
|
688
688
|
case "cuid":
|
|
689
|
-
|
|
689
|
+
B(n, L.cuid, r.message, t);
|
|
690
690
|
break;
|
|
691
691
|
case "cuid2":
|
|
692
|
-
|
|
692
|
+
B(n, L.cuid2, r.message, t);
|
|
693
693
|
break;
|
|
694
694
|
case "startsWith":
|
|
695
|
-
|
|
695
|
+
B(n, RegExp(`^${Pt(r.value, t)}`), r.message, t);
|
|
696
696
|
break;
|
|
697
697
|
case "endsWith":
|
|
698
|
-
|
|
698
|
+
B(n, RegExp(`${Pt(r.value, t)}$`), r.message, t);
|
|
699
699
|
break;
|
|
700
700
|
case "datetime":
|
|
701
|
-
|
|
701
|
+
z(n, "date-time", r.message, t);
|
|
702
702
|
break;
|
|
703
703
|
case "date":
|
|
704
|
-
|
|
704
|
+
z(n, "date", r.message, t);
|
|
705
705
|
break;
|
|
706
706
|
case "time":
|
|
707
|
-
|
|
707
|
+
z(n, "time", r.message, t);
|
|
708
708
|
break;
|
|
709
709
|
case "duration":
|
|
710
|
-
|
|
710
|
+
z(n, "duration", r.message, t);
|
|
711
711
|
break;
|
|
712
712
|
case "length":
|
|
713
713
|
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;
|
|
714
714
|
break;
|
|
715
715
|
case "includes":
|
|
716
|
-
|
|
716
|
+
B(n, RegExp(Pt(r.value, t)), r.message, t);
|
|
717
717
|
break;
|
|
718
718
|
case "ip":
|
|
719
|
-
r.version !== "v6" &&
|
|
719
|
+
r.version !== "v6" && z(n, "ipv4", r.message, t), r.version !== "v4" && z(n, "ipv6", r.message, t);
|
|
720
720
|
break;
|
|
721
721
|
case "base64url":
|
|
722
|
-
|
|
722
|
+
B(n, L.base64url, r.message, t);
|
|
723
723
|
break;
|
|
724
724
|
case "jwt":
|
|
725
|
-
|
|
725
|
+
B(n, L.jwt, r.message, t);
|
|
726
726
|
break;
|
|
727
727
|
case "cidr":
|
|
728
|
-
r.version !== "v6" &&
|
|
728
|
+
r.version !== "v6" && B(n, L.ipv4Cidr, r.message, t), r.version !== "v4" && B(n, L.ipv6Cidr, r.message, t);
|
|
729
729
|
break;
|
|
730
730
|
case "emoji":
|
|
731
|
-
|
|
731
|
+
B(n, L.emoji(), r.message, t);
|
|
732
732
|
break;
|
|
733
733
|
case "ulid":
|
|
734
|
-
|
|
734
|
+
B(n, L.ulid, r.message, t);
|
|
735
735
|
break;
|
|
736
736
|
case "base64":
|
|
737
737
|
switch (t.base64Strategy) {
|
|
738
738
|
case "format:binary":
|
|
739
|
-
|
|
739
|
+
z(n, "binary", r.message, t);
|
|
740
740
|
break;
|
|
741
741
|
case "contentEncoding:base64":
|
|
742
742
|
n.contentEncoding = "base64";
|
|
743
743
|
break;
|
|
744
|
-
case "pattern:zod":
|
|
744
|
+
case "pattern:zod": B(n, L.base64, r.message, t);
|
|
745
745
|
}
|
|
746
746
|
break;
|
|
747
|
-
case "nanoid":
|
|
747
|
+
case "nanoid": B(n, L.nanoid, r.message, t);
|
|
748
748
|
}
|
|
749
749
|
return n;
|
|
750
750
|
}
|
|
751
|
-
function
|
|
752
|
-
return t.patternStrategy === "escape" ?
|
|
751
|
+
function Pt(e, t) {
|
|
752
|
+
return t.patternStrategy === "escape" ? It(e) : e;
|
|
753
753
|
}
|
|
754
|
-
var
|
|
755
|
-
function
|
|
754
|
+
var Ft = /* @__PURE__ */ new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
755
|
+
function It(e) {
|
|
756
756
|
let t = "";
|
|
757
|
-
for (let n = 0; n < e.length; n++)
|
|
757
|
+
for (let n = 0; n < e.length; n++) Ft.has(e[n]) || (t += "\\"), t += e[n];
|
|
758
758
|
return t;
|
|
759
759
|
}
|
|
760
|
-
function
|
|
760
|
+
function z(e, t, n, r) {
|
|
761
761
|
e.format || e.anyOf?.some((e) => e.format) ? (e.anyOf ||= [], e.format && (e.anyOf.push({ format: e.format }), delete e.format), e.anyOf.push({
|
|
762
762
|
format: t,
|
|
763
763
|
...n && r.errorMessages && { errorMessage: { format: n } }
|
|
764
764
|
})) : e.format = t;
|
|
765
765
|
}
|
|
766
|
-
function
|
|
766
|
+
function B(e, t, n, r) {
|
|
767
767
|
e.pattern || e.allOf?.some((e) => e.pattern) ? (e.allOf ||= [], e.pattern && (e.allOf.push({ pattern: e.pattern }), delete e.pattern), e.allOf.push({
|
|
768
|
-
pattern:
|
|
768
|
+
pattern: V(t, r),
|
|
769
769
|
...n && r.errorMessages && { errorMessage: { pattern: n } }
|
|
770
|
-
})) : e.pattern =
|
|
770
|
+
})) : e.pattern = V(t, r);
|
|
771
771
|
}
|
|
772
|
-
function
|
|
772
|
+
function V(e, t) {
|
|
773
773
|
if (!t.applyRegexFlags || !e.flags) return e.source;
|
|
774
774
|
let n = {
|
|
775
775
|
i: e.flags.includes("i"),
|
|
@@ -808,16 +808,16 @@ function Pt(e, t) {
|
|
|
808
808
|
}
|
|
809
809
|
return i;
|
|
810
810
|
}
|
|
811
|
-
function
|
|
811
|
+
function Lt(e, t) {
|
|
812
812
|
let n = {
|
|
813
813
|
type: "object",
|
|
814
|
-
additionalProperties:
|
|
814
|
+
additionalProperties: G(e.valueType._def, {
|
|
815
815
|
...t,
|
|
816
816
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
817
817
|
}) ?? t.allowedAdditionalProperties
|
|
818
818
|
};
|
|
819
819
|
if (e.keyType?._def.typeName === "ZodString" && e.keyType._def.checks?.length) {
|
|
820
|
-
let { type: r, ...i } =
|
|
820
|
+
let { type: r, ...i } = R(e.keyType._def, t);
|
|
821
821
|
return {
|
|
822
822
|
...n,
|
|
823
823
|
propertyNames: i
|
|
@@ -828,7 +828,7 @@ function Ft(e, t) {
|
|
|
828
828
|
propertyNames: { enum: e.keyType._def.values }
|
|
829
829
|
};
|
|
830
830
|
if (e.keyType?._def.typeName === "ZodBranded" && e.keyType._def.type._def.typeName === "ZodString" && e.keyType._def.type._def.checks?.length) {
|
|
831
|
-
let { type: r, ...i } =
|
|
831
|
+
let { type: r, ...i } = wt(e.keyType._def, t);
|
|
832
832
|
return {
|
|
833
833
|
...n,
|
|
834
834
|
propertyNames: i
|
|
@@ -836,13 +836,13 @@ function Ft(e, t) {
|
|
|
836
836
|
}
|
|
837
837
|
return n;
|
|
838
838
|
}
|
|
839
|
-
function
|
|
840
|
-
return t.mapStrategy === "record" ?
|
|
839
|
+
function Rt(e, t) {
|
|
840
|
+
return t.mapStrategy === "record" ? Lt(e, t) : {
|
|
841
841
|
type: "array",
|
|
842
842
|
maxItems: 125,
|
|
843
843
|
items: {
|
|
844
844
|
type: "array",
|
|
845
|
-
items: [
|
|
845
|
+
items: [G(e.keyType._def, {
|
|
846
846
|
...t,
|
|
847
847
|
currentPath: [
|
|
848
848
|
...t.currentPath,
|
|
@@ -850,7 +850,7 @@ function It(e, t) {
|
|
|
850
850
|
"items",
|
|
851
851
|
"0"
|
|
852
852
|
]
|
|
853
|
-
}) ||
|
|
853
|
+
}) || N(), G(e.valueType._def, {
|
|
854
854
|
...t,
|
|
855
855
|
currentPath: [
|
|
856
856
|
...t.currentPath,
|
|
@@ -858,37 +858,37 @@ function It(e, t) {
|
|
|
858
858
|
"items",
|
|
859
859
|
"1"
|
|
860
860
|
]
|
|
861
|
-
}) ||
|
|
861
|
+
}) || N()],
|
|
862
862
|
minItems: 2,
|
|
863
863
|
maxItems: 2
|
|
864
864
|
}
|
|
865
865
|
};
|
|
866
866
|
}
|
|
867
|
-
function
|
|
867
|
+
function zt(e) {
|
|
868
868
|
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)));
|
|
869
869
|
return {
|
|
870
870
|
type: r.length === 1 ? r[0] === "string" ? "string" : "number" : ["string", "number"],
|
|
871
871
|
enum: n
|
|
872
872
|
};
|
|
873
873
|
}
|
|
874
|
-
function
|
|
875
|
-
return { not:
|
|
874
|
+
function Bt() {
|
|
875
|
+
return { not: N() };
|
|
876
876
|
}
|
|
877
|
-
function
|
|
877
|
+
function Vt() {
|
|
878
878
|
return { type: "null" };
|
|
879
879
|
}
|
|
880
|
-
var
|
|
880
|
+
var Ht = {
|
|
881
881
|
ZodString: "string",
|
|
882
882
|
ZodNumber: "number",
|
|
883
883
|
ZodBigInt: "integer",
|
|
884
884
|
ZodBoolean: "boolean",
|
|
885
885
|
ZodNull: "null"
|
|
886
886
|
};
|
|
887
|
-
function
|
|
887
|
+
function Ut(e, t) {
|
|
888
888
|
let n = e.options instanceof Map ? Array.from(e.options.values()) : e.options;
|
|
889
|
-
if (n.every((e) => e._def.typeName in
|
|
889
|
+
if (n.every((e) => e._def.typeName in Ht && (!e._def.checks || !e._def.checks.length))) {
|
|
890
890
|
let e = n.reduce((e, t) => {
|
|
891
|
-
let n =
|
|
891
|
+
let n = Ht[t._def.typeName];
|
|
892
892
|
return n && !e.includes(n) ? [...e, n] : e;
|
|
893
893
|
}, []);
|
|
894
894
|
return { type: e.length > 1 ? e : e[0] };
|
|
@@ -916,10 +916,10 @@ function Vt(e, t) {
|
|
|
916
916
|
type: "string",
|
|
917
917
|
enum: n.reduce((e, t) => [...e, ...t._def.values.filter((t) => !e.includes(t))], [])
|
|
918
918
|
};
|
|
919
|
-
return
|
|
919
|
+
return Wt(e, t);
|
|
920
920
|
}
|
|
921
|
-
var
|
|
922
|
-
let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) =>
|
|
921
|
+
var Wt = (e, t) => {
|
|
922
|
+
let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => G(e._def, {
|
|
923
923
|
...t,
|
|
924
924
|
currentPath: [
|
|
925
925
|
...t.currentPath,
|
|
@@ -929,15 +929,15 @@ var W = (e, t) => {
|
|
|
929
929
|
})).filter((e) => !!e && (!t.strictUnions || typeof e == "object" && Object.keys(e).length > 0));
|
|
930
930
|
return n.length ? { anyOf: n } : void 0;
|
|
931
931
|
};
|
|
932
|
-
function
|
|
932
|
+
function Gt(e, t) {
|
|
933
933
|
if ([
|
|
934
934
|
"ZodString",
|
|
935
935
|
"ZodNumber",
|
|
936
936
|
"ZodBigInt",
|
|
937
937
|
"ZodBoolean",
|
|
938
938
|
"ZodNull"
|
|
939
|
-
].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [
|
|
940
|
-
let n =
|
|
939
|
+
].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [Ht[e.innerType._def.typeName], "null"] };
|
|
940
|
+
let n = G(e.innerType._def, {
|
|
941
941
|
...t,
|
|
942
942
|
currentPath: [
|
|
943
943
|
...t.currentPath,
|
|
@@ -947,7 +947,7 @@ function G(e, t) {
|
|
|
947
947
|
});
|
|
948
948
|
return n && { anyOf: [n, { type: "null" }] };
|
|
949
949
|
}
|
|
950
|
-
function
|
|
950
|
+
function Kt(e) {
|
|
951
951
|
let t = { type: "number" };
|
|
952
952
|
if (!e.checks) return t;
|
|
953
953
|
for (let n of e.checks) switch (n.kind) {
|
|
@@ -964,7 +964,7 @@ function K(e) {
|
|
|
964
964
|
}
|
|
965
965
|
return t;
|
|
966
966
|
}
|
|
967
|
-
function
|
|
967
|
+
function qt(e, t) {
|
|
968
968
|
let n = {
|
|
969
969
|
type: "object",
|
|
970
970
|
properties: {}
|
|
@@ -972,7 +972,7 @@ function Ht(e, t) {
|
|
|
972
972
|
for (let e in i) {
|
|
973
973
|
let a = i[e];
|
|
974
974
|
if (a === void 0 || a._def === void 0) continue;
|
|
975
|
-
let o =
|
|
975
|
+
let o = U(a), s = G(a._def, {
|
|
976
976
|
...t,
|
|
977
977
|
currentPath: [
|
|
978
978
|
...t.currentPath,
|
|
@@ -988,11 +988,11 @@ function Ht(e, t) {
|
|
|
988
988
|
s !== void 0 && (n.properties[e] = s, o || r.push(e));
|
|
989
989
|
}
|
|
990
990
|
r.length && (n.required = r);
|
|
991
|
-
let a =
|
|
991
|
+
let a = H(e, t);
|
|
992
992
|
return a !== void 0 && (n.additionalProperties = a), n;
|
|
993
993
|
}
|
|
994
|
-
function
|
|
995
|
-
if (e.catchall._def.typeName !== "ZodNever") return
|
|
994
|
+
function H(e, t) {
|
|
995
|
+
if (e.catchall._def.typeName !== "ZodNever") return G(e.catchall._def, {
|
|
996
996
|
...t,
|
|
997
997
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
998
998
|
});
|
|
@@ -1002,16 +1002,16 @@ function Ut(e, t) {
|
|
|
1002
1002
|
case "strip": return t.removeAdditionalStrategy === "strict" ? t.allowedAdditionalProperties : t.rejectedAdditionalProperties;
|
|
1003
1003
|
}
|
|
1004
1004
|
}
|
|
1005
|
-
function
|
|
1005
|
+
function U(e) {
|
|
1006
1006
|
try {
|
|
1007
1007
|
return e.isOptional();
|
|
1008
1008
|
} catch {
|
|
1009
1009
|
return !0;
|
|
1010
1010
|
}
|
|
1011
1011
|
}
|
|
1012
|
-
var
|
|
1013
|
-
if (t.currentPath.toString() === t.propertyPath?.toString()) return
|
|
1014
|
-
let n =
|
|
1012
|
+
var W = (e, t) => {
|
|
1013
|
+
if (t.currentPath.toString() === t.propertyPath?.toString()) return G(e.innerType._def, t);
|
|
1014
|
+
let n = G(e.innerType._def, {
|
|
1015
1015
|
...t,
|
|
1016
1016
|
currentPath: [
|
|
1017
1017
|
...t.currentPath,
|
|
@@ -1019,11 +1019,11 @@ var Gt = (e, t) => {
|
|
|
1019
1019
|
"1"
|
|
1020
1020
|
]
|
|
1021
1021
|
});
|
|
1022
|
-
return n ? { anyOf: [{ not:
|
|
1023
|
-
},
|
|
1024
|
-
if (t.pipeStrategy === "input") return
|
|
1025
|
-
if (t.pipeStrategy === "output") return
|
|
1026
|
-
let n =
|
|
1022
|
+
return n ? { anyOf: [{ not: N() }, n] } : N();
|
|
1023
|
+
}, Jt = (e, t) => {
|
|
1024
|
+
if (t.pipeStrategy === "input") return G(e.in._def, t);
|
|
1025
|
+
if (t.pipeStrategy === "output") return G(e.out._def, t);
|
|
1026
|
+
let n = G(e.in._def, {
|
|
1027
1027
|
...t,
|
|
1028
1028
|
currentPath: [
|
|
1029
1029
|
...t.currentPath,
|
|
@@ -1031,7 +1031,7 @@ var Gt = (e, t) => {
|
|
|
1031
1031
|
"0"
|
|
1032
1032
|
]
|
|
1033
1033
|
});
|
|
1034
|
-
return { allOf: [n,
|
|
1034
|
+
return { allOf: [n, G(e.out._def, {
|
|
1035
1035
|
...t,
|
|
1036
1036
|
currentPath: [
|
|
1037
1037
|
...t.currentPath,
|
|
@@ -1040,25 +1040,25 @@ var Gt = (e, t) => {
|
|
|
1040
1040
|
]
|
|
1041
1041
|
})].filter((e) => e !== void 0) };
|
|
1042
1042
|
};
|
|
1043
|
-
function
|
|
1044
|
-
return
|
|
1043
|
+
function Yt(e, t) {
|
|
1044
|
+
return G(e.type._def, t);
|
|
1045
1045
|
}
|
|
1046
|
-
function
|
|
1046
|
+
function Xt(e, t) {
|
|
1047
1047
|
let n = {
|
|
1048
1048
|
type: "array",
|
|
1049
1049
|
uniqueItems: !0,
|
|
1050
|
-
items:
|
|
1050
|
+
items: G(e.valueType._def, {
|
|
1051
1051
|
...t,
|
|
1052
1052
|
currentPath: [...t.currentPath, "items"]
|
|
1053
1053
|
})
|
|
1054
1054
|
};
|
|
1055
1055
|
return e.minSize && (n.minItems = e.minSize.value), e.maxSize && (n.maxItems = e.maxSize.value), n;
|
|
1056
1056
|
}
|
|
1057
|
-
function
|
|
1057
|
+
function Zt(e, t) {
|
|
1058
1058
|
return e.rest ? {
|
|
1059
1059
|
type: "array",
|
|
1060
1060
|
minItems: e.items.length,
|
|
1061
|
-
items: e.items.map((e, n) =>
|
|
1061
|
+
items: e.items.map((e, n) => G(e._def, {
|
|
1062
1062
|
...t,
|
|
1063
1063
|
currentPath: [
|
|
1064
1064
|
...t.currentPath,
|
|
@@ -1066,7 +1066,7 @@ function Yt(e, t) {
|
|
|
1066
1066
|
`${n}`
|
|
1067
1067
|
]
|
|
1068
1068
|
})).reduce((e, t) => t === void 0 ? e : [...e, t], []),
|
|
1069
|
-
additionalItems:
|
|
1069
|
+
additionalItems: G(e.rest._def, {
|
|
1070
1070
|
...t,
|
|
1071
1071
|
currentPath: [...t.currentPath, "additionalItems"]
|
|
1072
1072
|
})
|
|
@@ -1074,7 +1074,7 @@ function Yt(e, t) {
|
|
|
1074
1074
|
type: "array",
|
|
1075
1075
|
minItems: e.items.length,
|
|
1076
1076
|
maxItems: e.items.length,
|
|
1077
|
-
items: e.items.map((e, n) =>
|
|
1077
|
+
items: e.items.map((e, n) => G(e._def, {
|
|
1078
1078
|
...t,
|
|
1079
1079
|
currentPath: [
|
|
1080
1080
|
...t.currentPath,
|
|
@@ -1084,47 +1084,47 @@ function Yt(e, t) {
|
|
|
1084
1084
|
})).reduce((e, t) => t === void 0 ? e : [...e, t], [])
|
|
1085
1085
|
};
|
|
1086
1086
|
}
|
|
1087
|
-
function
|
|
1088
|
-
return { not:
|
|
1087
|
+
function Qt() {
|
|
1088
|
+
return { not: N() };
|
|
1089
1089
|
}
|
|
1090
|
-
function
|
|
1091
|
-
return
|
|
1090
|
+
function $t() {
|
|
1091
|
+
return N();
|
|
1092
1092
|
}
|
|
1093
|
-
var
|
|
1093
|
+
var en = (e, t) => G(e.innerType._def, t), tn = (e, t, n) => {
|
|
1094
1094
|
switch (t) {
|
|
1095
|
-
case "ZodString": return
|
|
1096
|
-
case "ZodNumber": return
|
|
1097
|
-
case "ZodObject": return
|
|
1098
|
-
case "ZodBigInt": return
|
|
1099
|
-
case "ZodBoolean": return
|
|
1100
|
-
case "ZodDate": return
|
|
1101
|
-
case "ZodUndefined": return
|
|
1102
|
-
case "ZodNull": return
|
|
1103
|
-
case "ZodArray": return
|
|
1095
|
+
case "ZodString": return R(e, n);
|
|
1096
|
+
case "ZodNumber": return Kt(e);
|
|
1097
|
+
case "ZodObject": return qt(e, n);
|
|
1098
|
+
case "ZodBigInt": return F(e);
|
|
1099
|
+
case "ZodBoolean": return Ct();
|
|
1100
|
+
case "ZodDate": return Et(e, n);
|
|
1101
|
+
case "ZodUndefined": return Qt();
|
|
1102
|
+
case "ZodNull": return Vt();
|
|
1103
|
+
case "ZodArray": return P(e, n);
|
|
1104
1104
|
case "ZodUnion":
|
|
1105
|
-
case "ZodDiscriminatedUnion": return
|
|
1106
|
-
case "ZodIntersection": return
|
|
1107
|
-
case "ZodTuple": return
|
|
1108
|
-
case "ZodRecord": return
|
|
1109
|
-
case "ZodLiteral": return
|
|
1110
|
-
case "ZodEnum": return
|
|
1111
|
-
case "ZodNativeEnum": return
|
|
1112
|
-
case "ZodNullable": return
|
|
1113
|
-
case "ZodOptional": return
|
|
1114
|
-
case "ZodMap": return
|
|
1115
|
-
case "ZodSet": return
|
|
1105
|
+
case "ZodDiscriminatedUnion": return Ut(e, n);
|
|
1106
|
+
case "ZodIntersection": return jt(e, n);
|
|
1107
|
+
case "ZodTuple": return Zt(e, n);
|
|
1108
|
+
case "ZodRecord": return Lt(e, n);
|
|
1109
|
+
case "ZodLiteral": return Mt(e);
|
|
1110
|
+
case "ZodEnum": return kt(e);
|
|
1111
|
+
case "ZodNativeEnum": return zt(e);
|
|
1112
|
+
case "ZodNullable": return Gt(e, n);
|
|
1113
|
+
case "ZodOptional": return W(e, n);
|
|
1114
|
+
case "ZodMap": return Rt(e, n);
|
|
1115
|
+
case "ZodSet": return Xt(e, n);
|
|
1116
1116
|
case "ZodLazy": return () => e.getter()._def;
|
|
1117
|
-
case "ZodPromise": return
|
|
1117
|
+
case "ZodPromise": return Yt(e, n);
|
|
1118
1118
|
case "ZodNaN":
|
|
1119
|
-
case "ZodNever": return
|
|
1120
|
-
case "ZodEffects": return
|
|
1121
|
-
case "ZodAny": return
|
|
1122
|
-
case "ZodUnknown": return
|
|
1123
|
-
case "ZodDefault": return
|
|
1124
|
-
case "ZodBranded": return
|
|
1125
|
-
case "ZodReadonly": return
|
|
1126
|
-
case "ZodCatch": return
|
|
1127
|
-
case "ZodPipeline": return
|
|
1119
|
+
case "ZodNever": return Bt();
|
|
1120
|
+
case "ZodEffects": return I(e, n);
|
|
1121
|
+
case "ZodAny": return N();
|
|
1122
|
+
case "ZodUnknown": return $t();
|
|
1123
|
+
case "ZodDefault": return Ot(e, n);
|
|
1124
|
+
case "ZodBranded": return wt(e, n);
|
|
1125
|
+
case "ZodReadonly": return en(e, n);
|
|
1126
|
+
case "ZodCatch": return Tt(e, n);
|
|
1127
|
+
case "ZodPipeline": return Jt(e, n);
|
|
1128
1128
|
case "ZodFunction":
|
|
1129
1129
|
case "ZodVoid":
|
|
1130
1130
|
case "ZodSymbol": return;
|
|
@@ -1132,19 +1132,19 @@ var Qt = (e, t) => q(e.innerType._def, t), $t = (e, t, n) => {
|
|
|
1132
1132
|
/* c8 ignore next */
|
|
1133
1133
|
return ((e) => void 0)(t);
|
|
1134
1134
|
}
|
|
1135
|
-
},
|
|
1135
|
+
}, nn = (e, t) => {
|
|
1136
1136
|
let n = 0;
|
|
1137
1137
|
for (; n < e.length && n < t.length && e[n] === t[n]; n++);
|
|
1138
1138
|
return [(e.length - n).toString(), ...t.slice(n)].join("/");
|
|
1139
1139
|
};
|
|
1140
|
-
function
|
|
1140
|
+
function G(e, t, n = !1) {
|
|
1141
1141
|
let r = t.seen.get(e);
|
|
1142
1142
|
if (t.override) {
|
|
1143
1143
|
let i = t.override?.(e, t, r, n);
|
|
1144
|
-
if (i !==
|
|
1144
|
+
if (i !== bt) return i;
|
|
1145
1145
|
}
|
|
1146
1146
|
if (r && !n) {
|
|
1147
|
-
let e =
|
|
1147
|
+
let e = rn(r, t);
|
|
1148
1148
|
if (e !== void 0) return e;
|
|
1149
1149
|
}
|
|
1150
1150
|
let i = {
|
|
@@ -1153,22 +1153,22 @@ function q(e, t, n = !1) {
|
|
|
1153
1153
|
jsonSchema: void 0
|
|
1154
1154
|
};
|
|
1155
1155
|
t.seen.set(e, i);
|
|
1156
|
-
let a =
|
|
1157
|
-
if (o &&
|
|
1156
|
+
let a = tn(e, e.typeName, t), o = typeof a == "function" ? G(a(), t) : a;
|
|
1157
|
+
if (o && an(e, t, o), t.postProcess) {
|
|
1158
1158
|
let n = t.postProcess(o, e, t);
|
|
1159
1159
|
return i.jsonSchema = o, n;
|
|
1160
1160
|
}
|
|
1161
1161
|
return i.jsonSchema = o, o;
|
|
1162
1162
|
}
|
|
1163
|
-
var
|
|
1163
|
+
var rn = (e, t) => {
|
|
1164
1164
|
switch (t.$refStrategy) {
|
|
1165
1165
|
case "root": return { $ref: e.path.join("/") };
|
|
1166
|
-
case "relative": return { $ref:
|
|
1166
|
+
case "relative": return { $ref: nn(t.currentPath, e.path) };
|
|
1167
1167
|
case "none":
|
|
1168
|
-
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`),
|
|
1168
|
+
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`), N()) : t.$refStrategy === "seen" ? N() : void 0;
|
|
1169
1169
|
}
|
|
1170
|
-
},
|
|
1171
|
-
let t =
|
|
1170
|
+
}, an = (e, t, n) => (e.description && (n.description = e.description), n), on = (e) => {
|
|
1171
|
+
let t = St(e), n = t.name === void 0 ? t.basePath : [
|
|
1172
1172
|
...t.basePath,
|
|
1173
1173
|
t.definitionPath,
|
|
1174
1174
|
t.name
|
|
@@ -1187,25 +1187,25 @@ var tn = (e, t) => {
|
|
|
1187
1187
|
jsonSchema: void 0
|
|
1188
1188
|
}]))
|
|
1189
1189
|
};
|
|
1190
|
-
},
|
|
1191
|
-
let n =
|
|
1190
|
+
}, sn = (e, t) => {
|
|
1191
|
+
let n = on(t), r = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((e, [t, r]) => ({
|
|
1192
1192
|
...e,
|
|
1193
|
-
[t]:
|
|
1193
|
+
[t]: G(r._def, {
|
|
1194
1194
|
...n,
|
|
1195
1195
|
currentPath: [
|
|
1196
1196
|
...n.basePath,
|
|
1197
1197
|
n.definitionPath,
|
|
1198
1198
|
t
|
|
1199
1199
|
]
|
|
1200
|
-
}, !0) ??
|
|
1201
|
-
}), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a =
|
|
1200
|
+
}, !0) ?? N()
|
|
1201
|
+
}), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = G(e._def, i === void 0 ? n : {
|
|
1202
1202
|
...n,
|
|
1203
1203
|
currentPath: [
|
|
1204
1204
|
...n.basePath,
|
|
1205
1205
|
n.definitionPath,
|
|
1206
1206
|
i
|
|
1207
1207
|
]
|
|
1208
|
-
}, !1) ??
|
|
1208
|
+
}, !1) ?? N(), o = typeof t == "object" && t.name !== void 0 && t.nameStrategy === "title" ? t.name : void 0;
|
|
1209
1209
|
o !== void 0 && (a.title = o);
|
|
1210
1210
|
let s = i === void 0 ? r ? {
|
|
1211
1211
|
...a,
|
|
@@ -1222,14 +1222,14 @@ var tn = (e, t) => {
|
|
|
1222
1222
|
}
|
|
1223
1223
|
};
|
|
1224
1224
|
return s.$schema = "http://json-schema.org/draft-07/schema#", s;
|
|
1225
|
-
},
|
|
1226
|
-
function
|
|
1225
|
+
}, cn = Symbol.for("vercel.ai.schema");
|
|
1226
|
+
function ln(e) {
|
|
1227
1227
|
let t;
|
|
1228
1228
|
return () => (t ??= e(), t);
|
|
1229
1229
|
}
|
|
1230
|
-
function
|
|
1230
|
+
function un(e, { validate: t } = {}) {
|
|
1231
1231
|
return {
|
|
1232
|
-
[
|
|
1232
|
+
[cn]: !0,
|
|
1233
1233
|
_type: void 0,
|
|
1234
1234
|
get jsonSchema() {
|
|
1235
1235
|
return typeof e == "function" && (e = e()), e;
|
|
@@ -1237,20 +1237,20 @@ function J(e, { validate: t } = {}) {
|
|
|
1237
1237
|
validate: t
|
|
1238
1238
|
};
|
|
1239
1239
|
}
|
|
1240
|
-
function
|
|
1241
|
-
return typeof e == "object" && !!e &&
|
|
1240
|
+
function dn(e) {
|
|
1241
|
+
return typeof e == "object" && !!e && cn in e && e[cn] === !0 && "jsonSchema" in e && "validate" in e;
|
|
1242
1242
|
}
|
|
1243
|
-
function
|
|
1244
|
-
return e == null ?
|
|
1243
|
+
function fn(e) {
|
|
1244
|
+
return e == null ? un({
|
|
1245
1245
|
type: "object",
|
|
1246
1246
|
properties: {},
|
|
1247
1247
|
additionalProperties: !1
|
|
1248
|
-
}) :
|
|
1248
|
+
}) : dn(e) ? e : "~standard" in e ? e["~standard"].vendor === "zod" ? _n(e) : pn(e) : e();
|
|
1249
1249
|
}
|
|
1250
|
-
function
|
|
1251
|
-
return
|
|
1252
|
-
if (!
|
|
1253
|
-
return
|
|
1250
|
+
function pn(e) {
|
|
1251
|
+
return un(() => {
|
|
1252
|
+
if (!mn(e)) throw Error(`Standard schema vendor '${e["~standard"].vendor}' does not support JSON Schema conversion.`);
|
|
1253
|
+
return yt(e["~standard"].jsonSchema.input({ target: "draft-07" }));
|
|
1254
1254
|
}, { validate: async (t) => {
|
|
1255
1255
|
let n = await e["~standard"].validate(t);
|
|
1256
1256
|
return "value" in n ? {
|
|
@@ -1258,19 +1258,19 @@ function un(e) {
|
|
|
1258
1258
|
value: n.value
|
|
1259
1259
|
} : {
|
|
1260
1260
|
success: !1,
|
|
1261
|
-
error: new
|
|
1261
|
+
error: new O({
|
|
1262
1262
|
value: t,
|
|
1263
1263
|
cause: n.issues
|
|
1264
1264
|
})
|
|
1265
1265
|
};
|
|
1266
1266
|
} });
|
|
1267
1267
|
}
|
|
1268
|
-
function
|
|
1268
|
+
function mn(e) {
|
|
1269
1269
|
return e["~standard"].jsonSchema != null;
|
|
1270
1270
|
}
|
|
1271
|
-
function
|
|
1271
|
+
function K(e, t) {
|
|
1272
1272
|
let n = t?.useReferences ?? !1;
|
|
1273
|
-
return
|
|
1273
|
+
return un(() => sn(e, { $refStrategy: n ? "root" : "none" }), { validate: async (t) => {
|
|
1274
1274
|
let n = await e.safeParseAsync(t);
|
|
1275
1275
|
return n.success ? {
|
|
1276
1276
|
success: !0,
|
|
@@ -1281,9 +1281,9 @@ function fn(e, t) {
|
|
|
1281
1281
|
};
|
|
1282
1282
|
} });
|
|
1283
1283
|
}
|
|
1284
|
-
function
|
|
1284
|
+
function hn(e, r) {
|
|
1285
1285
|
let i = r?.useReferences ?? !1;
|
|
1286
|
-
return
|
|
1286
|
+
return un(() => yt(n(e, {
|
|
1287
1287
|
target: "draft-7",
|
|
1288
1288
|
io: "input",
|
|
1289
1289
|
reused: i ? "ref" : "inline"
|
|
@@ -1298,27 +1298,27 @@ function pn(e, r) {
|
|
|
1298
1298
|
};
|
|
1299
1299
|
} });
|
|
1300
1300
|
}
|
|
1301
|
-
function
|
|
1301
|
+
function gn(e) {
|
|
1302
1302
|
return "_zod" in e;
|
|
1303
1303
|
}
|
|
1304
|
-
function
|
|
1305
|
-
return
|
|
1304
|
+
function _n(e, t) {
|
|
1305
|
+
return gn(e) ? hn(e, t) : K(e, t);
|
|
1306
1306
|
}
|
|
1307
|
-
async function
|
|
1308
|
-
let r = await
|
|
1307
|
+
async function vn({ value: e, schema: t, context: n }) {
|
|
1308
|
+
let r = await yn({
|
|
1309
1309
|
value: e,
|
|
1310
1310
|
schema: t,
|
|
1311
1311
|
context: n
|
|
1312
1312
|
});
|
|
1313
|
-
if (!r.success) throw
|
|
1313
|
+
if (!r.success) throw O.wrap({
|
|
1314
1314
|
value: e,
|
|
1315
1315
|
cause: r.error,
|
|
1316
1316
|
context: n
|
|
1317
1317
|
});
|
|
1318
1318
|
return r.value;
|
|
1319
1319
|
}
|
|
1320
|
-
async function
|
|
1321
|
-
let r =
|
|
1320
|
+
async function yn({ value: e, schema: t, context: n }) {
|
|
1321
|
+
let r = fn(t);
|
|
1322
1322
|
try {
|
|
1323
1323
|
if (r.validate == null) return {
|
|
1324
1324
|
success: !0,
|
|
@@ -1332,7 +1332,7 @@ async function _n({ value: e, schema: t, context: n }) {
|
|
|
1332
1332
|
rawValue: e
|
|
1333
1333
|
} : {
|
|
1334
1334
|
success: !1,
|
|
1335
|
-
error:
|
|
1335
|
+
error: O.wrap({
|
|
1336
1336
|
value: e,
|
|
1337
1337
|
cause: t.error,
|
|
1338
1338
|
context: n
|
|
@@ -1342,7 +1342,7 @@ async function _n({ value: e, schema: t, context: n }) {
|
|
|
1342
1342
|
} catch (t) {
|
|
1343
1343
|
return {
|
|
1344
1344
|
success: !1,
|
|
1345
|
-
error:
|
|
1345
|
+
error: O.wrap({
|
|
1346
1346
|
value: e,
|
|
1347
1347
|
cause: t,
|
|
1348
1348
|
context: n
|
|
@@ -1351,21 +1351,21 @@ async function _n({ value: e, schema: t, context: n }) {
|
|
|
1351
1351
|
};
|
|
1352
1352
|
}
|
|
1353
1353
|
}
|
|
1354
|
-
async function
|
|
1354
|
+
async function bn({ text: e, schema: t }) {
|
|
1355
1355
|
try {
|
|
1356
|
-
let n =
|
|
1356
|
+
let n = vt(e);
|
|
1357
1357
|
return t == null ? {
|
|
1358
1358
|
success: !0,
|
|
1359
1359
|
value: n,
|
|
1360
1360
|
rawValue: n
|
|
1361
|
-
} : await
|
|
1361
|
+
} : await yn({
|
|
1362
1362
|
value: n,
|
|
1363
1363
|
schema: t
|
|
1364
1364
|
});
|
|
1365
1365
|
} catch (t) {
|
|
1366
1366
|
return {
|
|
1367
1367
|
success: !1,
|
|
1368
|
-
error:
|
|
1368
|
+
error: Je.isInstance(t) ? t : new Je({
|
|
1369
1369
|
text: e,
|
|
1370
1370
|
cause: t
|
|
1371
1371
|
}),
|
|
@@ -1373,41 +1373,41 @@ async function vn({ text: e, schema: t }) {
|
|
|
1373
1373
|
};
|
|
1374
1374
|
}
|
|
1375
1375
|
}
|
|
1376
|
-
function
|
|
1376
|
+
function xn({ stream: e, schema: t }) {
|
|
1377
1377
|
return e.pipeThrough(new TextDecoderStream()).pipeThrough(new ct()).pipeThrough(new TransformStream({ async transform({ data: e }, n) {
|
|
1378
|
-
e !== "[DONE]" && n.enqueue(await
|
|
1378
|
+
e !== "[DONE]" && n.enqueue(await bn({
|
|
1379
1379
|
text: e,
|
|
1380
1380
|
schema: t
|
|
1381
1381
|
}));
|
|
1382
1382
|
} }));
|
|
1383
1383
|
}
|
|
1384
|
-
async function
|
|
1384
|
+
async function Sn(e) {
|
|
1385
1385
|
return typeof e == "function" && (e = e()), e;
|
|
1386
1386
|
}
|
|
1387
1387
|
new TextDecoder();
|
|
1388
1388
|
// ../../node_modules/.pnpm/ai@7.0.154_zod@4.6.7/node_modules/ai/dist/index.js
|
|
1389
|
-
var
|
|
1389
|
+
var Cn = "AI_InvalidArgumentError", wn = `vercel.ai.error.${Cn}`, Tn = Symbol.for(wn), En = class extends w {
|
|
1390
1390
|
constructor({ parameter: e, value: t, message: n }) {
|
|
1391
1391
|
super({
|
|
1392
|
-
name:
|
|
1392
|
+
name: Cn,
|
|
1393
1393
|
message: `Invalid argument for parameter ${e}: ${n}`
|
|
1394
|
-
}), this[
|
|
1394
|
+
}), this[Tn] = !0, this.parameter = e, this.value = t;
|
|
1395
1395
|
}
|
|
1396
1396
|
static isInstance(e) {
|
|
1397
|
-
return w.hasMarker(e,
|
|
1397
|
+
return w.hasMarker(e, wn);
|
|
1398
1398
|
}
|
|
1399
|
-
},
|
|
1399
|
+
}, Dn = "AI_UIMessageStreamError", On = `vercel.ai.error.${Dn}`, kn = Symbol.for(On), An = class extends w {
|
|
1400
1400
|
constructor({ chunkType: e, chunkId: t, message: n }) {
|
|
1401
1401
|
super({
|
|
1402
|
-
name:
|
|
1402
|
+
name: Dn,
|
|
1403
1403
|
message: n
|
|
1404
|
-
}), this[
|
|
1404
|
+
}), this[kn] = !0, this.chunkType = e, this.chunkId = t;
|
|
1405
1405
|
}
|
|
1406
1406
|
static isInstance(e) {
|
|
1407
|
-
return w.hasMarker(e,
|
|
1407
|
+
return w.hasMarker(e, On);
|
|
1408
1408
|
}
|
|
1409
1409
|
};
|
|
1410
|
-
function
|
|
1410
|
+
function jn(e, t) {
|
|
1411
1411
|
if (e === void 0 && t === void 0) return;
|
|
1412
1412
|
if (e === void 0) return t;
|
|
1413
1413
|
if (t === void 0) return e;
|
|
@@ -1416,11 +1416,11 @@ function On(e, t) {
|
|
|
1416
1416
|
let i = t[r];
|
|
1417
1417
|
if (i === void 0) continue;
|
|
1418
1418
|
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);
|
|
1419
|
-
n[r] = o && s ?
|
|
1419
|
+
n[r] = o && s ? jn(a, i) : i;
|
|
1420
1420
|
}
|
|
1421
1421
|
return n;
|
|
1422
1422
|
}
|
|
1423
|
-
var
|
|
1423
|
+
var q = {
|
|
1424
1424
|
array: d,
|
|
1425
1425
|
boolean: m,
|
|
1426
1426
|
custom: l,
|
|
@@ -1438,215 +1438,215 @@ var X = {
|
|
|
1438
1438
|
string: r,
|
|
1439
1439
|
union: e,
|
|
1440
1440
|
unknown: _
|
|
1441
|
-
},
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
])),
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
]),
|
|
1454
|
-
type:
|
|
1455
|
-
text:
|
|
1456
|
-
providerOptions:
|
|
1457
|
-
}), Nn =
|
|
1458
|
-
type:
|
|
1459
|
-
image:
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1441
|
+
}, J = q.lazy(() => q.union([
|
|
1442
|
+
q.null(),
|
|
1443
|
+
q.string(),
|
|
1444
|
+
q.number(),
|
|
1445
|
+
q.boolean(),
|
|
1446
|
+
q.record(q.string(), J.optional()),
|
|
1447
|
+
q.array(J)
|
|
1448
|
+
])), Y = q.record(q.string(), q.record(q.string(), J.optional())), X = q.union([
|
|
1449
|
+
q.string(),
|
|
1450
|
+
q.instanceof(Uint8Array),
|
|
1451
|
+
q.instanceof(ArrayBuffer),
|
|
1452
|
+
q.custom(pt, { message: "Must be a Buffer" })
|
|
1453
|
+
]), Mn = q.record(q.string(), q.string()), Z = q.object({
|
|
1454
|
+
type: q.literal("text"),
|
|
1455
|
+
text: q.string(),
|
|
1456
|
+
providerOptions: Y.optional()
|
|
1457
|
+
}), Nn = q.object({
|
|
1458
|
+
type: q.literal("image"),
|
|
1459
|
+
image: q.union([
|
|
1460
|
+
X,
|
|
1461
|
+
q.instanceof(URL),
|
|
1462
|
+
Mn
|
|
1463
1463
|
]),
|
|
1464
|
-
mediaType:
|
|
1465
|
-
providerOptions:
|
|
1466
|
-
}), Pn =
|
|
1467
|
-
|
|
1468
|
-
type:
|
|
1469
|
-
data:
|
|
1464
|
+
mediaType: q.string().optional(),
|
|
1465
|
+
providerOptions: Y.optional()
|
|
1466
|
+
}), Pn = q.discriminatedUnion("type", [
|
|
1467
|
+
q.object({
|
|
1468
|
+
type: q.literal("data"),
|
|
1469
|
+
data: X
|
|
1470
1470
|
}),
|
|
1471
|
-
|
|
1472
|
-
type:
|
|
1473
|
-
url:
|
|
1471
|
+
q.object({
|
|
1472
|
+
type: q.literal("url"),
|
|
1473
|
+
url: q.instanceof(URL)
|
|
1474
1474
|
}),
|
|
1475
|
-
|
|
1476
|
-
type:
|
|
1477
|
-
reference:
|
|
1475
|
+
q.object({
|
|
1476
|
+
type: q.literal("reference"),
|
|
1477
|
+
reference: Mn
|
|
1478
1478
|
}),
|
|
1479
|
-
|
|
1480
|
-
type:
|
|
1481
|
-
text:
|
|
1479
|
+
q.object({
|
|
1480
|
+
type: q.literal("text"),
|
|
1481
|
+
text: q.string()
|
|
1482
1482
|
})
|
|
1483
|
-
]), Fn =
|
|
1484
|
-
type:
|
|
1485
|
-
data:
|
|
1486
|
-
}),
|
|
1487
|
-
type:
|
|
1488
|
-
url:
|
|
1489
|
-
})]), In =
|
|
1490
|
-
type:
|
|
1491
|
-
data:
|
|
1483
|
+
]), Fn = q.discriminatedUnion("type", [q.object({
|
|
1484
|
+
type: q.literal("data"),
|
|
1485
|
+
data: X
|
|
1486
|
+
}), q.object({
|
|
1487
|
+
type: q.literal("url"),
|
|
1488
|
+
url: q.instanceof(URL)
|
|
1489
|
+
})]), In = q.object({
|
|
1490
|
+
type: q.literal("file"),
|
|
1491
|
+
data: q.union([
|
|
1492
1492
|
Pn,
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1493
|
+
X,
|
|
1494
|
+
q.instanceof(URL),
|
|
1495
|
+
Mn
|
|
1496
1496
|
]),
|
|
1497
|
-
filename:
|
|
1498
|
-
mediaType:
|
|
1499
|
-
providerOptions:
|
|
1500
|
-
}), Ln =
|
|
1501
|
-
type:
|
|
1502
|
-
text:
|
|
1503
|
-
providerOptions:
|
|
1504
|
-
}), Rn =
|
|
1505
|
-
type:
|
|
1506
|
-
kind:
|
|
1507
|
-
providerOptions:
|
|
1508
|
-
}), zn =
|
|
1509
|
-
type:
|
|
1510
|
-
data:
|
|
1497
|
+
filename: q.string().optional(),
|
|
1498
|
+
mediaType: q.string(),
|
|
1499
|
+
providerOptions: Y.optional()
|
|
1500
|
+
}), Ln = q.object({
|
|
1501
|
+
type: q.literal("reasoning"),
|
|
1502
|
+
text: q.string(),
|
|
1503
|
+
providerOptions: Y.optional()
|
|
1504
|
+
}), Rn = q.object({
|
|
1505
|
+
type: q.literal("custom"),
|
|
1506
|
+
kind: q.string().transform((e) => e),
|
|
1507
|
+
providerOptions: Y.optional()
|
|
1508
|
+
}), zn = q.object({
|
|
1509
|
+
type: q.literal("reasoning-file"),
|
|
1510
|
+
data: q.union([
|
|
1511
1511
|
Fn,
|
|
1512
|
-
|
|
1513
|
-
|
|
1512
|
+
X,
|
|
1513
|
+
q.instanceof(URL)
|
|
1514
1514
|
]),
|
|
1515
|
-
mediaType:
|
|
1516
|
-
providerOptions:
|
|
1517
|
-
}), Bn =
|
|
1518
|
-
type:
|
|
1519
|
-
toolCallId:
|
|
1520
|
-
toolName:
|
|
1521
|
-
input:
|
|
1522
|
-
providerOptions:
|
|
1523
|
-
providerExecuted:
|
|
1524
|
-
}), Vn =
|
|
1525
|
-
|
|
1526
|
-
type:
|
|
1527
|
-
value:
|
|
1528
|
-
providerOptions:
|
|
1515
|
+
mediaType: q.string(),
|
|
1516
|
+
providerOptions: Y.optional()
|
|
1517
|
+
}), Bn = q.object({
|
|
1518
|
+
type: q.literal("tool-call"),
|
|
1519
|
+
toolCallId: q.string(),
|
|
1520
|
+
toolName: q.string(),
|
|
1521
|
+
input: q.unknown(),
|
|
1522
|
+
providerOptions: Y.optional(),
|
|
1523
|
+
providerExecuted: q.boolean().optional()
|
|
1524
|
+
}), Vn = q.discriminatedUnion("type", [
|
|
1525
|
+
q.object({
|
|
1526
|
+
type: q.literal("text"),
|
|
1527
|
+
value: q.string(),
|
|
1528
|
+
providerOptions: Y.optional()
|
|
1529
1529
|
}),
|
|
1530
|
-
|
|
1531
|
-
type:
|
|
1532
|
-
value:
|
|
1533
|
-
providerOptions:
|
|
1530
|
+
q.object({
|
|
1531
|
+
type: q.literal("json"),
|
|
1532
|
+
value: J,
|
|
1533
|
+
providerOptions: Y.optional()
|
|
1534
1534
|
}),
|
|
1535
|
-
|
|
1536
|
-
type:
|
|
1537
|
-
reason:
|
|
1538
|
-
providerOptions:
|
|
1535
|
+
q.object({
|
|
1536
|
+
type: q.literal("execution-denied"),
|
|
1537
|
+
reason: q.string().optional(),
|
|
1538
|
+
providerOptions: Y.optional()
|
|
1539
1539
|
}),
|
|
1540
|
-
|
|
1541
|
-
type:
|
|
1542
|
-
value:
|
|
1543
|
-
providerOptions:
|
|
1540
|
+
q.object({
|
|
1541
|
+
type: q.literal("error-text"),
|
|
1542
|
+
value: q.string(),
|
|
1543
|
+
providerOptions: Y.optional()
|
|
1544
1544
|
}),
|
|
1545
|
-
|
|
1546
|
-
type:
|
|
1547
|
-
value:
|
|
1548
|
-
providerOptions:
|
|
1545
|
+
q.object({
|
|
1546
|
+
type: q.literal("error-json"),
|
|
1547
|
+
value: J,
|
|
1548
|
+
providerOptions: Y.optional()
|
|
1549
1549
|
}),
|
|
1550
|
-
|
|
1551
|
-
type:
|
|
1552
|
-
value:
|
|
1553
|
-
|
|
1554
|
-
type:
|
|
1555
|
-
text:
|
|
1556
|
-
providerOptions:
|
|
1550
|
+
q.object({
|
|
1551
|
+
type: q.literal("content"),
|
|
1552
|
+
value: q.array(q.union([
|
|
1553
|
+
q.object({
|
|
1554
|
+
type: q.literal("text"),
|
|
1555
|
+
text: q.string(),
|
|
1556
|
+
providerOptions: Y.optional()
|
|
1557
1557
|
}),
|
|
1558
|
-
|
|
1559
|
-
type:
|
|
1558
|
+
q.object({
|
|
1559
|
+
type: q.literal("file"),
|
|
1560
1560
|
data: Pn,
|
|
1561
|
-
mediaType:
|
|
1562
|
-
filename:
|
|
1563
|
-
providerOptions:
|
|
1561
|
+
mediaType: q.string(),
|
|
1562
|
+
filename: q.string().optional(),
|
|
1563
|
+
providerOptions: Y.optional()
|
|
1564
1564
|
}),
|
|
1565
|
-
|
|
1566
|
-
type:
|
|
1567
|
-
data:
|
|
1568
|
-
mediaType:
|
|
1569
|
-
filename:
|
|
1570
|
-
providerOptions:
|
|
1565
|
+
q.object({
|
|
1566
|
+
type: q.literal("file-data"),
|
|
1567
|
+
data: q.string(),
|
|
1568
|
+
mediaType: q.string(),
|
|
1569
|
+
filename: q.string().optional(),
|
|
1570
|
+
providerOptions: Y.optional()
|
|
1571
1571
|
}),
|
|
1572
|
-
|
|
1573
|
-
type:
|
|
1574
|
-
url:
|
|
1575
|
-
mediaType:
|
|
1576
|
-
providerOptions:
|
|
1572
|
+
q.object({
|
|
1573
|
+
type: q.literal("file-url"),
|
|
1574
|
+
url: q.string(),
|
|
1575
|
+
mediaType: q.string().optional(),
|
|
1576
|
+
providerOptions: Y.optional()
|
|
1577
1577
|
}),
|
|
1578
|
-
|
|
1579
|
-
type:
|
|
1580
|
-
fileId:
|
|
1581
|
-
providerOptions:
|
|
1578
|
+
q.object({
|
|
1579
|
+
type: q.literal("file-id"),
|
|
1580
|
+
fileId: q.union([q.string(), q.record(q.string(), q.string())]),
|
|
1581
|
+
providerOptions: Y.optional()
|
|
1582
1582
|
}),
|
|
1583
|
-
|
|
1584
|
-
type:
|
|
1585
|
-
providerReference:
|
|
1586
|
-
providerOptions:
|
|
1583
|
+
q.object({
|
|
1584
|
+
type: q.literal("file-reference"),
|
|
1585
|
+
providerReference: q.record(q.string(), q.string()),
|
|
1586
|
+
providerOptions: Y.optional()
|
|
1587
1587
|
}),
|
|
1588
|
-
|
|
1589
|
-
type:
|
|
1590
|
-
data:
|
|
1591
|
-
mediaType:
|
|
1592
|
-
providerOptions:
|
|
1588
|
+
q.object({
|
|
1589
|
+
type: q.literal("image-data"),
|
|
1590
|
+
data: q.string(),
|
|
1591
|
+
mediaType: q.string(),
|
|
1592
|
+
providerOptions: Y.optional()
|
|
1593
1593
|
}),
|
|
1594
|
-
|
|
1595
|
-
type:
|
|
1596
|
-
url:
|
|
1597
|
-
providerOptions:
|
|
1594
|
+
q.object({
|
|
1595
|
+
type: q.literal("image-url"),
|
|
1596
|
+
url: q.string(),
|
|
1597
|
+
providerOptions: Y.optional()
|
|
1598
1598
|
}),
|
|
1599
|
-
|
|
1600
|
-
type:
|
|
1601
|
-
fileId:
|
|
1602
|
-
providerOptions:
|
|
1599
|
+
q.object({
|
|
1600
|
+
type: q.literal("image-file-id"),
|
|
1601
|
+
fileId: q.union([q.string(), q.record(q.string(), q.string())]),
|
|
1602
|
+
providerOptions: Y.optional()
|
|
1603
1603
|
}),
|
|
1604
|
-
|
|
1605
|
-
type:
|
|
1606
|
-
providerReference:
|
|
1607
|
-
providerOptions:
|
|
1604
|
+
q.object({
|
|
1605
|
+
type: q.literal("image-file-reference"),
|
|
1606
|
+
providerReference: q.record(q.string(), q.string()),
|
|
1607
|
+
providerOptions: Y.optional()
|
|
1608
1608
|
}),
|
|
1609
|
-
|
|
1610
|
-
type:
|
|
1611
|
-
providerOptions:
|
|
1609
|
+
q.object({
|
|
1610
|
+
type: q.literal("custom"),
|
|
1611
|
+
providerOptions: Y.optional()
|
|
1612
1612
|
})
|
|
1613
1613
|
]))
|
|
1614
1614
|
})
|
|
1615
|
-
]), Hn =
|
|
1616
|
-
type:
|
|
1617
|
-
toolCallId:
|
|
1618
|
-
toolName:
|
|
1615
|
+
]), Hn = q.object({
|
|
1616
|
+
type: q.literal("tool-result"),
|
|
1617
|
+
toolCallId: q.string(),
|
|
1618
|
+
toolName: q.string(),
|
|
1619
1619
|
output: Vn,
|
|
1620
|
-
providerOptions:
|
|
1621
|
-
}), Un =
|
|
1622
|
-
type:
|
|
1623
|
-
approvalId:
|
|
1624
|
-
toolCallId:
|
|
1625
|
-
reason:
|
|
1626
|
-
isAutomatic:
|
|
1627
|
-
signature:
|
|
1628
|
-
inputSchemaInput:
|
|
1629
|
-
}), Wn =
|
|
1630
|
-
type:
|
|
1631
|
-
approvalId:
|
|
1632
|
-
approved:
|
|
1633
|
-
reason:
|
|
1634
|
-
}), Gn =
|
|
1635
|
-
role:
|
|
1636
|
-
content:
|
|
1637
|
-
providerOptions:
|
|
1638
|
-
}), Kn =
|
|
1639
|
-
role:
|
|
1640
|
-
content:
|
|
1641
|
-
|
|
1620
|
+
providerOptions: Y.optional()
|
|
1621
|
+
}), Un = q.object({
|
|
1622
|
+
type: q.literal("tool-approval-request"),
|
|
1623
|
+
approvalId: q.string(),
|
|
1624
|
+
toolCallId: q.string(),
|
|
1625
|
+
reason: q.string().optional(),
|
|
1626
|
+
isAutomatic: q.boolean().optional(),
|
|
1627
|
+
signature: q.string().optional(),
|
|
1628
|
+
inputSchemaInput: q.unknown().optional()
|
|
1629
|
+
}), Wn = q.object({
|
|
1630
|
+
type: q.literal("tool-approval-response"),
|
|
1631
|
+
approvalId: q.string(),
|
|
1632
|
+
approved: q.boolean(),
|
|
1633
|
+
reason: q.string().optional()
|
|
1634
|
+
}), Gn = q.object({
|
|
1635
|
+
role: q.literal("system"),
|
|
1636
|
+
content: q.string(),
|
|
1637
|
+
providerOptions: Y.optional()
|
|
1638
|
+
}), Kn = q.object({
|
|
1639
|
+
role: q.literal("user"),
|
|
1640
|
+
content: q.union([q.string(), q.array(q.union([
|
|
1641
|
+
Z,
|
|
1642
1642
|
Nn,
|
|
1643
1643
|
In
|
|
1644
1644
|
]))]),
|
|
1645
|
-
providerOptions:
|
|
1646
|
-
}), qn =
|
|
1647
|
-
role:
|
|
1648
|
-
content:
|
|
1649
|
-
|
|
1645
|
+
providerOptions: Y.optional()
|
|
1646
|
+
}), qn = q.object({
|
|
1647
|
+
role: q.literal("assistant"),
|
|
1648
|
+
content: q.union([q.string(), q.array(q.union([
|
|
1649
|
+
Z,
|
|
1650
1650
|
Rn,
|
|
1651
1651
|
In,
|
|
1652
1652
|
Ln,
|
|
@@ -1655,13 +1655,13 @@ var X = {
|
|
|
1655
1655
|
Hn,
|
|
1656
1656
|
Un
|
|
1657
1657
|
]))]),
|
|
1658
|
-
providerOptions:
|
|
1659
|
-
}), Jn =
|
|
1660
|
-
role:
|
|
1661
|
-
content:
|
|
1662
|
-
providerOptions:
|
|
1658
|
+
providerOptions: Y.optional()
|
|
1659
|
+
}), Jn = q.object({
|
|
1660
|
+
role: q.literal("tool"),
|
|
1661
|
+
content: q.array(q.union([Hn, Wn])),
|
|
1662
|
+
providerOptions: Y.optional()
|
|
1663
1663
|
});
|
|
1664
|
-
|
|
1664
|
+
q.union([
|
|
1665
1665
|
Gn,
|
|
1666
1666
|
Kn,
|
|
1667
1667
|
qn,
|
|
@@ -1854,11 +1854,11 @@ async function Xn(e) {
|
|
|
1854
1854
|
value: void 0,
|
|
1855
1855
|
state: "undefined-input"
|
|
1856
1856
|
};
|
|
1857
|
-
let t = await
|
|
1857
|
+
let t = await bn({ text: e });
|
|
1858
1858
|
return t.success ? {
|
|
1859
1859
|
value: t.value,
|
|
1860
1860
|
state: "successful-parse"
|
|
1861
|
-
} : (t = await
|
|
1861
|
+
} : (t = await bn({ text: Yn(e) }), t.success ? {
|
|
1862
1862
|
value: t.value,
|
|
1863
1863
|
state: "repaired-parse"
|
|
1864
1864
|
} : {
|
|
@@ -1876,193 +1876,193 @@ j({
|
|
|
1876
1876
|
prefix: "call",
|
|
1877
1877
|
size: 24
|
|
1878
1878
|
}), TransformStream;
|
|
1879
|
-
var Zn =
|
|
1880
|
-
source:
|
|
1881
|
-
type:
|
|
1882
|
-
sourceType:
|
|
1883
|
-
id:
|
|
1884
|
-
url:
|
|
1885
|
-
title:
|
|
1886
|
-
providerMetadata:
|
|
1887
|
-
}),
|
|
1888
|
-
type:
|
|
1889
|
-
sourceType:
|
|
1890
|
-
id:
|
|
1891
|
-
mediaType:
|
|
1892
|
-
title:
|
|
1893
|
-
filename:
|
|
1894
|
-
providerMetadata:
|
|
1879
|
+
var Zn = q.object({
|
|
1880
|
+
source: q.discriminatedUnion("sourceType", [q.object({
|
|
1881
|
+
type: q.literal("source"),
|
|
1882
|
+
sourceType: q.literal("url"),
|
|
1883
|
+
id: q.string(),
|
|
1884
|
+
url: q.string(),
|
|
1885
|
+
title: q.string().optional(),
|
|
1886
|
+
providerMetadata: Y.optional()
|
|
1887
|
+
}), q.object({
|
|
1888
|
+
type: q.literal("source"),
|
|
1889
|
+
sourceType: q.literal("document"),
|
|
1890
|
+
id: q.string(),
|
|
1891
|
+
mediaType: q.string(),
|
|
1892
|
+
title: q.string(),
|
|
1893
|
+
filename: q.string().optional(),
|
|
1894
|
+
providerMetadata: Y.optional()
|
|
1895
1895
|
})]),
|
|
1896
|
-
startIndex:
|
|
1897
|
-
endIndex:
|
|
1898
|
-
citedText:
|
|
1899
|
-
}), Qn =
|
|
1900
|
-
|
|
1901
|
-
type:
|
|
1902
|
-
id:
|
|
1903
|
-
providerMetadata:
|
|
1896
|
+
startIndex: q.number().int().nonnegative().optional(),
|
|
1897
|
+
endIndex: q.number().int().nonnegative().optional(),
|
|
1898
|
+
citedText: q.string().optional()
|
|
1899
|
+
}), Qn = q.record(q.string(), J.optional()), $n = ln(() => _n(q.union([
|
|
1900
|
+
q.looseObject({
|
|
1901
|
+
type: q.literal("text-start"),
|
|
1902
|
+
id: q.string(),
|
|
1903
|
+
providerMetadata: Y.optional()
|
|
1904
1904
|
}),
|
|
1905
|
-
|
|
1906
|
-
type:
|
|
1907
|
-
id:
|
|
1908
|
-
delta:
|
|
1909
|
-
providerMetadata:
|
|
1905
|
+
q.looseObject({
|
|
1906
|
+
type: q.literal("text-delta"),
|
|
1907
|
+
id: q.string(),
|
|
1908
|
+
delta: q.string(),
|
|
1909
|
+
providerMetadata: Y.optional()
|
|
1910
1910
|
}),
|
|
1911
|
-
|
|
1912
|
-
type:
|
|
1913
|
-
id:
|
|
1914
|
-
citations:
|
|
1915
|
-
providerMetadata:
|
|
1911
|
+
q.looseObject({
|
|
1912
|
+
type: q.literal("text-end"),
|
|
1913
|
+
id: q.string(),
|
|
1914
|
+
citations: q.array(Zn).optional(),
|
|
1915
|
+
providerMetadata: Y.optional()
|
|
1916
1916
|
}),
|
|
1917
|
-
|
|
1918
|
-
type:
|
|
1919
|
-
errorText:
|
|
1917
|
+
q.looseObject({
|
|
1918
|
+
type: q.literal("error"),
|
|
1919
|
+
errorText: q.string()
|
|
1920
1920
|
}),
|
|
1921
|
-
|
|
1922
|
-
type:
|
|
1923
|
-
toolCallId:
|
|
1924
|
-
toolName:
|
|
1925
|
-
inputEncoding:
|
|
1926
|
-
providerExecuted:
|
|
1927
|
-
providerMetadata:
|
|
1921
|
+
q.looseObject({
|
|
1922
|
+
type: q.literal("tool-input-start"),
|
|
1923
|
+
toolCallId: q.string(),
|
|
1924
|
+
toolName: q.string(),
|
|
1925
|
+
inputEncoding: q.enum(["json", "text"]).optional(),
|
|
1926
|
+
providerExecuted: q.boolean().optional(),
|
|
1927
|
+
providerMetadata: Y.optional(),
|
|
1928
1928
|
toolMetadata: Qn.optional(),
|
|
1929
|
-
dynamic:
|
|
1930
|
-
title:
|
|
1929
|
+
dynamic: q.boolean().optional(),
|
|
1930
|
+
title: q.string().optional()
|
|
1931
1931
|
}),
|
|
1932
|
-
|
|
1933
|
-
type:
|
|
1934
|
-
toolCallId:
|
|
1935
|
-
inputTextDelta:
|
|
1932
|
+
q.looseObject({
|
|
1933
|
+
type: q.literal("tool-input-delta"),
|
|
1934
|
+
toolCallId: q.string(),
|
|
1935
|
+
inputTextDelta: q.string()
|
|
1936
1936
|
}),
|
|
1937
|
-
|
|
1938
|
-
type:
|
|
1939
|
-
toolCallId:
|
|
1940
|
-
toolName:
|
|
1941
|
-
input:
|
|
1942
|
-
providerExecuted:
|
|
1943
|
-
providerMetadata:
|
|
1937
|
+
q.looseObject({
|
|
1938
|
+
type: q.literal("tool-input-available"),
|
|
1939
|
+
toolCallId: q.string(),
|
|
1940
|
+
toolName: q.string(),
|
|
1941
|
+
input: q.unknown(),
|
|
1942
|
+
providerExecuted: q.boolean().optional(),
|
|
1943
|
+
providerMetadata: Y.optional(),
|
|
1944
1944
|
toolMetadata: Qn.optional(),
|
|
1945
|
-
dynamic:
|
|
1946
|
-
title:
|
|
1945
|
+
dynamic: q.boolean().optional(),
|
|
1946
|
+
title: q.string().optional()
|
|
1947
1947
|
}),
|
|
1948
|
-
|
|
1949
|
-
type:
|
|
1950
|
-
toolCallId:
|
|
1951
|
-
toolName:
|
|
1952
|
-
input:
|
|
1953
|
-
providerExecuted:
|
|
1954
|
-
providerMetadata:
|
|
1948
|
+
q.looseObject({
|
|
1949
|
+
type: q.literal("tool-input-error"),
|
|
1950
|
+
toolCallId: q.string(),
|
|
1951
|
+
toolName: q.string(),
|
|
1952
|
+
input: q.unknown(),
|
|
1953
|
+
providerExecuted: q.boolean().optional(),
|
|
1954
|
+
providerMetadata: Y.optional(),
|
|
1955
1955
|
toolMetadata: Qn.optional(),
|
|
1956
|
-
dynamic:
|
|
1957
|
-
errorText:
|
|
1958
|
-
title:
|
|
1956
|
+
dynamic: q.boolean().optional(),
|
|
1957
|
+
errorText: q.string(),
|
|
1958
|
+
title: q.string().optional()
|
|
1959
1959
|
}),
|
|
1960
|
-
|
|
1961
|
-
type:
|
|
1962
|
-
approvalId:
|
|
1963
|
-
toolCallId:
|
|
1964
|
-
approvalDescriptor:
|
|
1965
|
-
inputSchemaInput:
|
|
1966
|
-
reason:
|
|
1967
|
-
isAutomatic:
|
|
1968
|
-
signature:
|
|
1960
|
+
q.looseObject({
|
|
1961
|
+
type: q.literal("tool-approval-request"),
|
|
1962
|
+
approvalId: q.string(),
|
|
1963
|
+
toolCallId: q.string(),
|
|
1964
|
+
approvalDescriptor: q.unknown().optional(),
|
|
1965
|
+
inputSchemaInput: q.unknown().optional(),
|
|
1966
|
+
reason: q.string().optional(),
|
|
1967
|
+
isAutomatic: q.boolean().optional(),
|
|
1968
|
+
signature: q.string().optional()
|
|
1969
1969
|
}),
|
|
1970
|
-
|
|
1971
|
-
type:
|
|
1972
|
-
approvalId:
|
|
1973
|
-
approved:
|
|
1974
|
-
reason:
|
|
1975
|
-
providerExecuted:
|
|
1976
|
-
providerMetadata:
|
|
1970
|
+
q.looseObject({
|
|
1971
|
+
type: q.literal("tool-approval-response"),
|
|
1972
|
+
approvalId: q.string(),
|
|
1973
|
+
approved: q.boolean(),
|
|
1974
|
+
reason: q.string().optional(),
|
|
1975
|
+
providerExecuted: q.boolean().optional(),
|
|
1976
|
+
providerMetadata: Y.optional()
|
|
1977
1977
|
}),
|
|
1978
|
-
|
|
1979
|
-
type:
|
|
1980
|
-
toolCallId:
|
|
1981
|
-
output:
|
|
1982
|
-
providerExecuted:
|
|
1983
|
-
providerMetadata:
|
|
1978
|
+
q.looseObject({
|
|
1979
|
+
type: q.literal("tool-output-available"),
|
|
1980
|
+
toolCallId: q.string(),
|
|
1981
|
+
output: q.unknown(),
|
|
1982
|
+
providerExecuted: q.boolean().optional(),
|
|
1983
|
+
providerMetadata: Y.optional(),
|
|
1984
1984
|
toolMetadata: Qn.optional(),
|
|
1985
|
-
dynamic:
|
|
1986
|
-
preliminary:
|
|
1985
|
+
dynamic: q.boolean().optional(),
|
|
1986
|
+
preliminary: q.boolean().optional()
|
|
1987
1987
|
}),
|
|
1988
|
-
|
|
1989
|
-
type:
|
|
1990
|
-
toolCallId:
|
|
1991
|
-
errorText:
|
|
1992
|
-
providerExecuted:
|
|
1993
|
-
providerMetadata:
|
|
1988
|
+
q.looseObject({
|
|
1989
|
+
type: q.literal("tool-output-error"),
|
|
1990
|
+
toolCallId: q.string(),
|
|
1991
|
+
errorText: q.string(),
|
|
1992
|
+
providerExecuted: q.boolean().optional(),
|
|
1993
|
+
providerMetadata: Y.optional(),
|
|
1994
1994
|
toolMetadata: Qn.optional(),
|
|
1995
|
-
dynamic:
|
|
1995
|
+
dynamic: q.boolean().optional()
|
|
1996
1996
|
}),
|
|
1997
|
-
|
|
1998
|
-
type:
|
|
1999
|
-
toolCallId:
|
|
1997
|
+
q.looseObject({
|
|
1998
|
+
type: q.literal("tool-output-denied"),
|
|
1999
|
+
toolCallId: q.string()
|
|
2000
2000
|
}),
|
|
2001
|
-
|
|
2002
|
-
type:
|
|
2003
|
-
id:
|
|
2004
|
-
providerMetadata:
|
|
2001
|
+
q.looseObject({
|
|
2002
|
+
type: q.literal("reasoning-start"),
|
|
2003
|
+
id: q.string(),
|
|
2004
|
+
providerMetadata: Y.optional()
|
|
2005
2005
|
}),
|
|
2006
|
-
|
|
2007
|
-
type:
|
|
2008
|
-
id:
|
|
2009
|
-
delta:
|
|
2010
|
-
providerMetadata:
|
|
2006
|
+
q.looseObject({
|
|
2007
|
+
type: q.literal("reasoning-delta"),
|
|
2008
|
+
id: q.string(),
|
|
2009
|
+
delta: q.string(),
|
|
2010
|
+
providerMetadata: Y.optional()
|
|
2011
2011
|
}),
|
|
2012
|
-
|
|
2013
|
-
type:
|
|
2014
|
-
id:
|
|
2015
|
-
providerMetadata:
|
|
2012
|
+
q.looseObject({
|
|
2013
|
+
type: q.literal("reasoning-end"),
|
|
2014
|
+
id: q.string(),
|
|
2015
|
+
providerMetadata: Y.optional()
|
|
2016
2016
|
}),
|
|
2017
|
-
|
|
2018
|
-
type:
|
|
2019
|
-
kind:
|
|
2020
|
-
providerMetadata:
|
|
2017
|
+
q.looseObject({
|
|
2018
|
+
type: q.literal("custom"),
|
|
2019
|
+
kind: q.string().transform((e) => e),
|
|
2020
|
+
providerMetadata: Y.optional()
|
|
2021
2021
|
}),
|
|
2022
|
-
|
|
2023
|
-
type:
|
|
2024
|
-
sourceId:
|
|
2025
|
-
url:
|
|
2026
|
-
title:
|
|
2027
|
-
providerMetadata:
|
|
2022
|
+
q.looseObject({
|
|
2023
|
+
type: q.literal("source-url"),
|
|
2024
|
+
sourceId: q.string(),
|
|
2025
|
+
url: q.string(),
|
|
2026
|
+
title: q.string().optional(),
|
|
2027
|
+
providerMetadata: Y.optional()
|
|
2028
2028
|
}),
|
|
2029
|
-
|
|
2030
|
-
type:
|
|
2031
|
-
sourceId:
|
|
2032
|
-
mediaType:
|
|
2033
|
-
title:
|
|
2034
|
-
filename:
|
|
2035
|
-
providerMetadata:
|
|
2029
|
+
q.looseObject({
|
|
2030
|
+
type: q.literal("source-document"),
|
|
2031
|
+
sourceId: q.string(),
|
|
2032
|
+
mediaType: q.string(),
|
|
2033
|
+
title: q.string(),
|
|
2034
|
+
filename: q.string().optional(),
|
|
2035
|
+
providerMetadata: Y.optional()
|
|
2036
2036
|
}),
|
|
2037
|
-
|
|
2038
|
-
type:
|
|
2039
|
-
url:
|
|
2040
|
-
mediaType:
|
|
2041
|
-
providerMetadata:
|
|
2037
|
+
q.looseObject({
|
|
2038
|
+
type: q.literal("file"),
|
|
2039
|
+
url: q.string(),
|
|
2040
|
+
mediaType: q.string(),
|
|
2041
|
+
providerMetadata: Y.optional()
|
|
2042
2042
|
}),
|
|
2043
|
-
|
|
2044
|
-
type:
|
|
2045
|
-
url:
|
|
2046
|
-
mediaType:
|
|
2047
|
-
providerMetadata:
|
|
2043
|
+
q.looseObject({
|
|
2044
|
+
type: q.literal("reasoning-file"),
|
|
2045
|
+
url: q.string(),
|
|
2046
|
+
mediaType: q.string(),
|
|
2047
|
+
providerMetadata: Y.optional()
|
|
2048
2048
|
}),
|
|
2049
|
-
|
|
2050
|
-
type:
|
|
2051
|
-
id:
|
|
2052
|
-
data:
|
|
2053
|
-
transient:
|
|
2049
|
+
q.looseObject({
|
|
2050
|
+
type: q.custom((e) => typeof e == "string" && e.startsWith("data-"), { message: "Type must start with \"data-\"" }),
|
|
2051
|
+
id: q.string().optional(),
|
|
2052
|
+
data: q.unknown(),
|
|
2053
|
+
transient: q.boolean().optional()
|
|
2054
2054
|
}),
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
type:
|
|
2060
|
-
messageId:
|
|
2061
|
-
messageMetadata:
|
|
2055
|
+
q.looseObject({ type: q.literal("start-step") }),
|
|
2056
|
+
q.looseObject({ type: q.literal("finish-step") }),
|
|
2057
|
+
q.looseObject({ type: q.literal("reset-step") }),
|
|
2058
|
+
q.looseObject({
|
|
2059
|
+
type: q.literal("start"),
|
|
2060
|
+
messageId: q.string().optional(),
|
|
2061
|
+
messageMetadata: q.unknown().optional()
|
|
2062
2062
|
}),
|
|
2063
|
-
|
|
2064
|
-
type:
|
|
2065
|
-
finishReason:
|
|
2063
|
+
q.looseObject({
|
|
2064
|
+
type: q.literal("finish"),
|
|
2065
|
+
finishReason: q.enum([
|
|
2066
2066
|
"stop",
|
|
2067
2067
|
"length",
|
|
2068
2068
|
"content-filter",
|
|
@@ -2071,15 +2071,15 @@ var Zn = X.object({
|
|
|
2071
2071
|
"interrupted",
|
|
2072
2072
|
"other"
|
|
2073
2073
|
]).optional(),
|
|
2074
|
-
messageMetadata:
|
|
2074
|
+
messageMetadata: q.unknown().optional()
|
|
2075
2075
|
}),
|
|
2076
|
-
|
|
2077
|
-
type:
|
|
2078
|
-
reason:
|
|
2076
|
+
q.looseObject({
|
|
2077
|
+
type: q.literal("abort"),
|
|
2078
|
+
reason: q.string().optional()
|
|
2079
2079
|
}),
|
|
2080
|
-
|
|
2081
|
-
type:
|
|
2082
|
-
messageMetadata:
|
|
2080
|
+
q.looseObject({
|
|
2081
|
+
type: q.literal("message-metadata"),
|
|
2082
|
+
messageMetadata: q.unknown()
|
|
2083
2083
|
})
|
|
2084
2084
|
])));
|
|
2085
2085
|
function er(e) {
|
|
@@ -2151,7 +2151,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2151
2151
|
}
|
|
2152
2152
|
}
|
|
2153
2153
|
}
|
|
2154
|
-
if (t == null) throw new
|
|
2154
|
+
if (t == null) throw new An({
|
|
2155
2155
|
chunkType: "tool-invocation",
|
|
2156
2156
|
chunkId: e,
|
|
2157
2157
|
message: `No tool invocation found for tool call ID "${e}".`
|
|
@@ -2160,7 +2160,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2160
2160
|
}
|
|
2161
2161
|
function h(e) {
|
|
2162
2162
|
let t = r.message.parts.filter(Q).find((t) => t.approval?.id === e);
|
|
2163
|
-
if (t == null) throw new
|
|
2163
|
+
if (t == null) throw new An({
|
|
2164
2164
|
chunkType: "tool-approval-response",
|
|
2165
2165
|
chunkId: e,
|
|
2166
2166
|
message: `No tool invocation found for approval ID "${e}".`
|
|
@@ -2225,8 +2225,8 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2225
2225
|
}
|
|
2226
2226
|
async function v(e) {
|
|
2227
2227
|
if (e != null) {
|
|
2228
|
-
let n = r.message.metadata == null ? e :
|
|
2229
|
-
t != null && await
|
|
2228
|
+
let n = r.message.metadata == null ? e : jn(r.message.metadata, e);
|
|
2229
|
+
t != null && await vn({
|
|
2230
2230
|
value: n,
|
|
2231
2231
|
schema: t,
|
|
2232
2232
|
context: {
|
|
@@ -2249,7 +2249,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2249
2249
|
}
|
|
2250
2250
|
case "text-delta": {
|
|
2251
2251
|
let t = r.activeTextParts[e.id];
|
|
2252
|
-
if (t == null) throw new
|
|
2252
|
+
if (t == null) throw new An({
|
|
2253
2253
|
chunkType: "text-delta",
|
|
2254
2254
|
chunkId: e.id,
|
|
2255
2255
|
message: `Received text-delta for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`
|
|
@@ -2259,7 +2259,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2259
2259
|
}
|
|
2260
2260
|
case "text-end": {
|
|
2261
2261
|
let t = r.activeTextParts[e.id];
|
|
2262
|
-
if (t == null) throw new
|
|
2262
|
+
if (t == null) throw new An({
|
|
2263
2263
|
chunkType: "text-end",
|
|
2264
2264
|
chunkId: e.id,
|
|
2265
2265
|
message: `Received text-end for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`
|
|
@@ -2289,7 +2289,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2289
2289
|
}
|
|
2290
2290
|
case "reasoning-delta": {
|
|
2291
2291
|
let t = r.activeReasoningParts[e.id];
|
|
2292
|
-
if (t == null) throw new
|
|
2292
|
+
if (t == null) throw new An({
|
|
2293
2293
|
chunkType: "reasoning-delta",
|
|
2294
2294
|
chunkId: e.id,
|
|
2295
2295
|
message: `Received reasoning-delta for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`
|
|
@@ -2299,7 +2299,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2299
2299
|
}
|
|
2300
2300
|
case "reasoning-end": {
|
|
2301
2301
|
let t = r.activeReasoningParts[e.id];
|
|
2302
|
-
if (t == null) throw new
|
|
2302
|
+
if (t == null) throw new An({
|
|
2303
2303
|
chunkType: "reasoning-end",
|
|
2304
2304
|
chunkId: e.id,
|
|
2305
2305
|
message: `Received reasoning-end for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`
|
|
@@ -2370,7 +2370,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2370
2370
|
}
|
|
2371
2371
|
case "tool-input-delta": {
|
|
2372
2372
|
let t = r.partialToolCalls[e.toolCallId];
|
|
2373
|
-
if (t == null) throw new
|
|
2373
|
+
if (t == null) throw new An({
|
|
2374
2374
|
chunkType: "tool-input-delta",
|
|
2375
2375
|
chunkId: e.toolCallId,
|
|
2376
2376
|
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.`
|
|
@@ -2551,7 +2551,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2551
2551
|
default: if (er(e)) {
|
|
2552
2552
|
if (n?.[e.type] != null) {
|
|
2553
2553
|
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;
|
|
2554
|
-
await
|
|
2554
|
+
await vn({
|
|
2555
2555
|
value: e.data,
|
|
2556
2556
|
schema: n[e.type],
|
|
2557
2557
|
context: {
|
|
@@ -2612,7 +2612,7 @@ j({
|
|
|
2612
2612
|
}), j({
|
|
2613
2613
|
prefix: "call",
|
|
2614
2614
|
size: 24
|
|
2615
|
-
}),
|
|
2615
|
+
}), q.record(q.string(), J.optional()), q.record(q.string(), q.string()), j({
|
|
2616
2616
|
prefix: "call",
|
|
2617
2617
|
size: 24
|
|
2618
2618
|
}), j({
|
|
@@ -2663,9 +2663,9 @@ j({
|
|
|
2663
2663
|
}), j({
|
|
2664
2664
|
prefix: "call",
|
|
2665
2665
|
size: 24
|
|
2666
|
-
}),
|
|
2667
|
-
token:
|
|
2668
|
-
url:
|
|
2666
|
+
}), q.object({
|
|
2667
|
+
token: q.string().refine((e) => e.trim().length > 0),
|
|
2668
|
+
url: q.string().refine((e) => {
|
|
2669
2669
|
try {
|
|
2670
2670
|
let t = new URL(e);
|
|
2671
2671
|
return (t.protocol === "ws:" || t.protocol === "wss:") && t.hostname !== "";
|
|
@@ -2673,12 +2673,12 @@ j({
|
|
|
2673
2673
|
return !1;
|
|
2674
2674
|
}
|
|
2675
2675
|
}),
|
|
2676
|
-
expiresAt:
|
|
2677
|
-
tools:
|
|
2678
|
-
type:
|
|
2679
|
-
name:
|
|
2680
|
-
description:
|
|
2681
|
-
parameters:
|
|
2676
|
+
expiresAt: q.number().positive().max(2 ** 53 - 1).optional(),
|
|
2677
|
+
tools: q.array(q.object({
|
|
2678
|
+
type: q.literal("function"),
|
|
2679
|
+
name: q.string().min(1),
|
|
2680
|
+
description: q.string().optional(),
|
|
2681
|
+
parameters: q.record(q.string(), q.unknown())
|
|
2682
2682
|
})).optional()
|
|
2683
2683
|
}), j({
|
|
2684
2684
|
prefix: "call",
|
|
@@ -2702,7 +2702,7 @@ async function dr({ response: e, url: t, fallbackMessage: n }) {
|
|
|
2702
2702
|
}
|
|
2703
2703
|
async function fr(e) {
|
|
2704
2704
|
if (e == null) return [];
|
|
2705
|
-
if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new
|
|
2705
|
+
if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new tt({
|
|
2706
2706
|
functionality: "FileList",
|
|
2707
2707
|
message: "FileList is not supported in the current environment"
|
|
2708
2708
|
});
|
|
@@ -2730,7 +2730,7 @@ var mr = class {
|
|
|
2730
2730
|
this.api = e, this.credentials = t, this.headers = n, this.body = r, this.fetch = i, this.prepareSendMessagesRequest = a, this.prepareReconnectToStreamRequest = o;
|
|
2731
2731
|
}
|
|
2732
2732
|
async sendMessages({ abortSignal: e, ...t }) {
|
|
2733
|
-
let n = await
|
|
2733
|
+
let n = await Sn(this.body), r = await Sn(this.headers), i = await Sn(this.credentials), a = {
|
|
2734
2734
|
...dt(r),
|
|
2735
2735
|
...dt(t.headers)
|
|
2736
2736
|
}, o = await this.prepareSendMessagesRequest?.({
|
|
@@ -2768,11 +2768,11 @@ var mr = class {
|
|
|
2768
2768
|
url: s,
|
|
2769
2769
|
fallbackMessage: "Failed to fetch the chat response."
|
|
2770
2770
|
});
|
|
2771
|
-
if (!d.body) throw new
|
|
2771
|
+
if (!d.body) throw new He({ message: "The response body is empty." });
|
|
2772
2772
|
return this.processResponseStream(d.body);
|
|
2773
2773
|
}
|
|
2774
2774
|
async reconnectToStream(e) {
|
|
2775
|
-
let t = await
|
|
2775
|
+
let t = await Sn(this.body), n = await Sn(this.headers), r = await Sn(this.credentials), i = {
|
|
2776
2776
|
...dt(n),
|
|
2777
2777
|
...dt(e.headers)
|
|
2778
2778
|
}, a = await this.prepareReconnectToStreamRequest?.({
|
|
@@ -2787,7 +2787,7 @@ var mr = class {
|
|
|
2787
2787
|
requestMetadata: e.metadata
|
|
2788
2788
|
}), o = a?.api;
|
|
2789
2789
|
if (o == null) {
|
|
2790
|
-
if (e.chatId === "." || e.chatId === "..") throw new
|
|
2790
|
+
if (e.chatId === "." || e.chatId === "..") throw new En({
|
|
2791
2791
|
parameter: "chatId",
|
|
2792
2792
|
value: e.chatId,
|
|
2793
2793
|
message: "Chat IDs must not be \".\" or \"..\" when using the default reconnect URL."
|
|
@@ -2806,7 +2806,7 @@ var mr = class {
|
|
|
2806
2806
|
url: o,
|
|
2807
2807
|
fallbackMessage: "Failed to fetch the chat response."
|
|
2808
2808
|
});
|
|
2809
|
-
if (!l.body) throw new
|
|
2809
|
+
if (!l.body) throw new He({ message: "The response body is empty." });
|
|
2810
2810
|
return this.processResponseStream(l.body);
|
|
2811
2811
|
}
|
|
2812
2812
|
}, hr = class extends mr {
|
|
@@ -2814,7 +2814,7 @@ var mr = class {
|
|
|
2814
2814
|
super(t), this.resumeStreamIsReplay = e;
|
|
2815
2815
|
}
|
|
2816
2816
|
processResponseStream(e) {
|
|
2817
|
-
return
|
|
2817
|
+
return xn({
|
|
2818
2818
|
stream: e,
|
|
2819
2819
|
schema: $n
|
|
2820
2820
|
}).pipeThrough(new TransformStream({ async transform(e, t) {
|
|
@@ -2866,12 +2866,12 @@ var mr = class {
|
|
|
2866
2866
|
} else n = e;
|
|
2867
2867
|
if (e.messageId != null) {
|
|
2868
2868
|
let t = this.state.messages.findIndex((t) => t.id === e.messageId);
|
|
2869
|
-
if (t === -1) throw new
|
|
2869
|
+
if (t === -1) throw new En({
|
|
2870
2870
|
parameter: "message.messageId",
|
|
2871
2871
|
value: e.messageId,
|
|
2872
2872
|
message: `message with id ${e.messageId} not found`
|
|
2873
2873
|
});
|
|
2874
|
-
if (this.state.messages[t].role !== "user") throw new
|
|
2874
|
+
if (this.state.messages[t].role !== "user") throw new En({
|
|
2875
2875
|
parameter: "message.messageId",
|
|
2876
2876
|
value: e.messageId,
|
|
2877
2877
|
message: `message with id ${e.messageId} is not a user message`
|
|
@@ -2895,7 +2895,7 @@ var mr = class {
|
|
|
2895
2895
|
});
|
|
2896
2896
|
}, this.regenerate = async ({ messageId: e, ...t } = {}) => {
|
|
2897
2897
|
let n = e == null ? this.state.messages.length - 1 : this.state.messages.findIndex((t) => t.id === e);
|
|
2898
|
-
if (n === -1) throw new
|
|
2898
|
+
if (n === -1) throw new En({
|
|
2899
2899
|
parameter: "messageId",
|
|
2900
2900
|
value: e,
|
|
2901
2901
|
message: `message ${e} not found`
|
|
@@ -3083,7 +3083,7 @@ var mr = class {
|
|
|
3083
3083
|
status: "submitted",
|
|
3084
3084
|
error: void 0
|
|
3085
3085
|
});
|
|
3086
|
-
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,
|
|
3086
|
+
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;
|
|
3087
3087
|
try {
|
|
3088
3088
|
let s = {
|
|
3089
3089
|
state: e === "resume-stream" && this.resumableStreamState != null ? this.resumableStreamState : ar({
|
|
@@ -3093,7 +3093,7 @@ var mr = class {
|
|
|
3093
3093
|
abortController: o,
|
|
3094
3094
|
completionPromise: a
|
|
3095
3095
|
};
|
|
3096
|
-
|
|
3096
|
+
y = s, s.abortController.signal.addEventListener("abort", () => {
|
|
3097
3097
|
_ = !0;
|
|
3098
3098
|
}), this.activeResponse = s;
|
|
3099
3099
|
let l;
|
|
@@ -3139,34 +3139,34 @@ var mr = class {
|
|
|
3139
3139
|
}), _) return c() && (this.setStatus({ status: "ready" }), this.resumableStreamState === s.state && (this.resumableStreamState = void 0)), null;
|
|
3140
3140
|
c() && (this.setStatus({ status: "ready" }), this.resumableStreamState === s.state && (this.resumableStreamState = void 0));
|
|
3141
3141
|
} catch (e) {
|
|
3142
|
-
if (_ || e.name === "AbortError") return _ = !0, c() && (this.setStatus({ status: "ready" }), this.resumableStreamState ===
|
|
3142
|
+
if (_ || e.name === "AbortError") return _ = !0, c() && (this.setStatus({ status: "ready" }), this.resumableStreamState === y?.state && (this.resumableStreamState = void 0)), null;
|
|
3143
3143
|
if (!c()) return null;
|
|
3144
|
-
if (
|
|
3144
|
+
if (ee = !0, e instanceof TypeError) {
|
|
3145
3145
|
let t = e.message.toLowerCase();
|
|
3146
3146
|
v = t.includes("fetch") || t.includes("network") || t === "load failed";
|
|
3147
3147
|
}
|
|
3148
|
-
v ? this.resumableStreamState =
|
|
3148
|
+
v ? this.resumableStreamState = y?.state : this.resumableStreamState === y?.state && (this.resumableStreamState = void 0), this.onError && e instanceof Error && this.onError(e), this.setStatus({
|
|
3149
3149
|
status: "error",
|
|
3150
3150
|
error: e
|
|
3151
3151
|
});
|
|
3152
3152
|
} finally {
|
|
3153
3153
|
try {
|
|
3154
|
-
if (
|
|
3155
|
-
let { message: e, finishReason: t } =
|
|
3156
|
-
t === "interrupted" ? this.interruptedMessageIds.add(e.id) : !_ && !
|
|
3157
|
-
message:
|
|
3154
|
+
if (y) {
|
|
3155
|
+
let { message: e, finishReason: t } = y.state;
|
|
3156
|
+
t === "interrupted" ? this.interruptedMessageIds.add(e.id) : !_ && !ee && this.interruptedMessageIds.delete(e.id), this.onFinish?.({
|
|
3157
|
+
message: y.state.message,
|
|
3158
3158
|
messages: this.state.messages,
|
|
3159
3159
|
isAbort: _,
|
|
3160
3160
|
isDisconnect: v,
|
|
3161
|
-
isError:
|
|
3162
|
-
finishReason:
|
|
3161
|
+
isError: ee,
|
|
3162
|
+
finishReason: y.state.finishReason
|
|
3163
3163
|
});
|
|
3164
3164
|
}
|
|
3165
3165
|
} finally {
|
|
3166
|
-
this.activeResponse ===
|
|
3166
|
+
this.activeResponse === y && (this.activeResponse = void 0), l();
|
|
3167
3167
|
}
|
|
3168
3168
|
}
|
|
3169
|
-
!_ && !
|
|
3169
|
+
!_ && !ee && y?.state.finishReason !== "interrupted" && await this.runAutomaticRequest(() => this.makeRequest({
|
|
3170
3170
|
trigger: "submit-message",
|
|
3171
3171
|
messageId: this.lastMessage?.id,
|
|
3172
3172
|
metadata: t,
|
|
@@ -3437,13 +3437,13 @@ var Lr = function(e, t, n, r) {
|
|
|
3437
3437
|
function Rr() {
|
|
3438
3438
|
for (var e = this, t = [], n = 0; n < arguments.length; n++) t[n] = arguments[n];
|
|
3439
3439
|
var r, i, a = $({}, Nr), o = !1, s = !1;
|
|
3440
|
-
if (!
|
|
3440
|
+
if (!me()) return console.error("useSWRV must be called inside setup() or an active effectScope()."), null;
|
|
3441
3441
|
var c = typeof window > "u" || typeof document > "u";
|
|
3442
3442
|
t.length >= 1 && (r = t[0]), t.length >= 2 && (i = t[1]), t.length > 2 && (a = $($({}, a), t[2]));
|
|
3443
|
-
var l = c ? a.serverTTL : a.ttl, u = typeof r == "function" ? r :
|
|
3443
|
+
var l = c ? a.serverTTL : a.ttl, u = typeof r == "function" ? r : x(r);
|
|
3444
3444
|
i === void 0 && (i = a.fetcher);
|
|
3445
3445
|
var d = null;
|
|
3446
|
-
d ||=
|
|
3446
|
+
d ||= ve({
|
|
3447
3447
|
data: void 0,
|
|
3448
3448
|
error: void 0,
|
|
3449
3449
|
isValidating: !0,
|
|
@@ -3513,7 +3513,7 @@ function Rr() {
|
|
|
3513
3513
|
};
|
|
3514
3514
|
a.refreshInterval && (m = setTimeout(h, a.refreshInterval)), a.revalidateOnFocus && (document.addEventListener("visibilitychange", p, !1), window.addEventListener("focus", p, !1));
|
|
3515
3515
|
}
|
|
3516
|
-
|
|
3516
|
+
_e(function() {
|
|
3517
3517
|
o = !0, m &&= (clearTimeout(m), null), !c && a.revalidateOnFocus && (document.removeEventListener("visibilitychange", p, !1), window.removeEventListener("focus", p, !1));
|
|
3518
3518
|
var e = jr.get(u.value);
|
|
3519
3519
|
e && (e.data = e.data.filter(function(e) {
|
|
@@ -3522,7 +3522,7 @@ function Rr() {
|
|
|
3522
3522
|
});
|
|
3523
3523
|
try {
|
|
3524
3524
|
C(u, function(e) {
|
|
3525
|
-
|
|
3525
|
+
he(u) || (u.value = e), d.key = e, d.isValidating = !!e, Pr(u.value, d, l), !c && !s && u.value && f(), s = !1;
|
|
3526
3526
|
}, { immediate: !0 });
|
|
3527
3527
|
} catch {}
|
|
3528
3528
|
return $($({}, ye(d)), { mutate: function(e, t) {
|
|
@@ -3613,7 +3613,7 @@ var Ur = class {
|
|
|
3613
3613
|
}
|
|
3614
3614
|
};
|
|
3615
3615
|
function Gr(e) {
|
|
3616
|
-
let t =
|
|
3616
|
+
let t = S([]), n = S("ready"), r = S(), i = S(), a;
|
|
3617
3617
|
return C(t, (e) => {
|
|
3618
3618
|
a != null && !a.isPublishing && a.setMessagesFromConsumer(e);
|
|
3619
3619
|
}, { flush: "sync" }), C(() => be(e), (e) => {
|
|
@@ -3629,10 +3629,10 @@ function Gr(e) {
|
|
|
3629
3629
|
...s,
|
|
3630
3630
|
state: c
|
|
3631
3631
|
});
|
|
3632
|
-
}, { immediate: !0 }),
|
|
3632
|
+
}, { immediate: !0 }), me() != null && _e(() => {
|
|
3633
3633
|
a?.dispose();
|
|
3634
3634
|
}), {
|
|
3635
|
-
id:
|
|
3635
|
+
id: b(() => i.value.id),
|
|
3636
3636
|
status: n,
|
|
3637
3637
|
messages: t,
|
|
3638
3638
|
error: r,
|
|
@@ -3659,39 +3659,43 @@ var Kr = "voice-", qr = 300, Jr = (e) => e?.role === "assistant" && e.parts.some
|
|
|
3659
3659
|
}, $r = 12e4, ei = 1e3, ti = 5e3, ni = 100, ri = 3e4, ii = 5e3, ai = 250, oi = 1e3, si = "\n\n", ci = (e) => {
|
|
3660
3660
|
let t = e.type ?? "";
|
|
3661
3661
|
return t === "dynamic-tool" ? e.toolName ?? "" : t.startsWith("tool-") ? t.slice(5) : "";
|
|
3662
|
-
}, li = (e) => e?.role === "assistant" && e.parts.some((e) =>
|
|
3662
|
+
}, li = (e) => e?.role === "assistant" && e.parts.some((e) => y(ci(e)) && !e.providerExecuted && !se.has(e.state ?? "")), ui = ({ messages: e }) => {
|
|
3663
3663
|
let t = e[e.length - 1];
|
|
3664
3664
|
if (!t || t.role !== "assistant") return !1;
|
|
3665
|
-
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 && (
|
|
3666
|
-
return r.length > 0 && r.every((e) =>
|
|
3665
|
+
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 && (y(ci(e)) || ae(e)));
|
|
3666
|
+
return r.length > 0 && r.every((e) => se.has(e.state ?? ""));
|
|
3667
3667
|
};
|
|
3668
3668
|
function di(e) {
|
|
3669
3669
|
return Te(`chatbot-${e}`, () => {
|
|
3670
|
-
let { t, te: n, locale: r } = Se({ useScope: "global" }), i =
|
|
3670
|
+
let { t, te: n, locale: r } = Se({ 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(), ee = x(), y = x(), ne = x(), se = x(), me = S(), he = x(0), ye = x(0), be = x(), Te = S(), ke = S(), Ne = x(), Pe = x(), w = S(), Fe = x(!1), Ie = x({}), Le = x(!1), Re = x(0), ze = x(), Be = x(!1), Ve = we(), He = b(() => {
|
|
3671
3671
|
let e = u.value?.theme;
|
|
3672
|
-
return e && e !== "auto" || (e =
|
|
3673
|
-
}), T =
|
|
3672
|
+
return e && e !== "auto" || (e = ze.value), e ? e === "dark" : Ve.value;
|
|
3673
|
+
}), T = b(() => c.value === "reasoning"), Ue = b(() => T.value ? g.value?.filter((e) => ![
|
|
3674
3674
|
"upvote",
|
|
3675
3675
|
"downvote",
|
|
3676
3676
|
"feedback"
|
|
3677
|
-
].includes(e)) : g.value),
|
|
3677
|
+
].includes(e)) : g.value), We = pe(b(() => `${o.value}-chatId`), null);
|
|
3678
3678
|
xe(() => {
|
|
3679
|
-
|
|
3679
|
+
We.value ||= ft();
|
|
3680
3680
|
});
|
|
3681
|
-
let E =
|
|
3682
|
-
get: () =>
|
|
3681
|
+
let E = b({
|
|
3682
|
+
get: () => We.value,
|
|
3683
3683
|
set: (e) => {
|
|
3684
|
-
|
|
3684
|
+
We.value = e;
|
|
3685
3685
|
}
|
|
3686
|
-
}),
|
|
3686
|
+
}), Ge = fe(b(() => `${o.value}-pageAccessOff`), !1), D = b(() => Ge.value ? [] : Te.value ?? []), Ke = () => Ge.value ? [] : ke.value?.() ?? [], qe = b(() => !!(be.value && Te.value?.length)), Je = b(() => !!w.value && be.value?.pointer === !0 && D.value.length > 0);
|
|
3687
|
+
C(Je, (e) => {
|
|
3688
|
+
e || (Pe.value = void 0);
|
|
3689
|
+
});
|
|
3690
|
+
let Ye = pe(b(() => `${o.value}-pageNotice`), null), Xe = b(() => {
|
|
3687
3691
|
let e = be.value?.level;
|
|
3688
|
-
return e && e !==
|
|
3692
|
+
return e && e !== te.Off && D.value.length && !ie(Ye.value ?? void 0, e) ? e : void 0;
|
|
3689
3693
|
});
|
|
3690
|
-
function
|
|
3691
|
-
|
|
3694
|
+
function Ze() {
|
|
3695
|
+
Ye.value = be.value?.level ?? null;
|
|
3692
3696
|
}
|
|
3693
|
-
let
|
|
3694
|
-
function
|
|
3697
|
+
let O = x(), Qe = x(!1), $e = b(() => O.value?.message?.toLowerCase().includes("conversation-blocked") ?? !1);
|
|
3698
|
+
function et(e) {
|
|
3695
3699
|
try {
|
|
3696
3700
|
let t = JSON.parse(e.message);
|
|
3697
3701
|
return t.status === 404 || t.type?.includes("entity-not-found");
|
|
@@ -3699,88 +3703,88 @@ function di(e) {
|
|
|
3699
3703
|
return !1;
|
|
3700
3704
|
}
|
|
3701
3705
|
}
|
|
3702
|
-
function
|
|
3703
|
-
if (
|
|
3704
|
-
let e =
|
|
3705
|
-
E.value = ft(),
|
|
3706
|
-
|
|
3706
|
+
function tt(e) {
|
|
3707
|
+
if (et(e)) {
|
|
3708
|
+
let e = I.value.messages.filter((e) => e.role === "user"), t = e[e.length - 1], n = t ? de(t) : void 0;
|
|
3709
|
+
E.value = ft(), O.value = void 0, ge(() => {
|
|
3710
|
+
I.value.clearError(), n && I.value.sendMessage({ text: n });
|
|
3707
3711
|
});
|
|
3708
|
-
} else
|
|
3712
|
+
} else le.error(e), O.value = e, $e.value && (Qe.value = !0);
|
|
3709
3713
|
}
|
|
3710
|
-
let
|
|
3714
|
+
let k = b(() => ce({
|
|
3711
3715
|
baseUrl: i.value,
|
|
3712
3716
|
basePath: a.value,
|
|
3713
3717
|
headers: () => p.value
|
|
3714
|
-
})),
|
|
3718
|
+
})), nt = x(null), rt = () => ({
|
|
3715
3719
|
...Ee(),
|
|
3716
|
-
...
|
|
3717
|
-
}),
|
|
3718
|
-
let e =
|
|
3720
|
+
...nt.value ?? {}
|
|
3721
|
+
}), it = () => {
|
|
3722
|
+
let e = Re.value;
|
|
3719
3723
|
return new Promise((t) => {
|
|
3720
3724
|
let n = setTimeout(() => {
|
|
3721
3725
|
r(), t(!1);
|
|
3722
|
-
}, 3e4), r = C(() => [
|
|
3726
|
+
}, 3e4), r = C(() => [Re.value, I.value.status], ([i, a]) => {
|
|
3723
3727
|
i > e && a === "streaming" && (clearTimeout(n), r(), t(!0));
|
|
3724
3728
|
});
|
|
3725
3729
|
});
|
|
3726
|
-
},
|
|
3727
|
-
|
|
3730
|
+
}, A = S(), at = (e, t) => new Promise((n) => {
|
|
3731
|
+
A.value?.answer(!1), A.value = {
|
|
3728
3732
|
toolCallId: e.toolCallId,
|
|
3729
3733
|
question: t?.question,
|
|
3730
3734
|
details: t?.details,
|
|
3731
3735
|
answer: (e) => {
|
|
3732
|
-
|
|
3736
|
+
A.value = void 0, n(e);
|
|
3733
3737
|
}
|
|
3734
3738
|
};
|
|
3735
3739
|
});
|
|
3736
|
-
function
|
|
3737
|
-
|
|
3740
|
+
function ot(e) {
|
|
3741
|
+
A.value?.answer(e);
|
|
3738
3742
|
}
|
|
3739
|
-
let
|
|
3743
|
+
let st = ({ forms: e }) => be.value && D.value.length ? {
|
|
3740
3744
|
version: 1,
|
|
3741
|
-
features: [...
|
|
3742
|
-
forms: e ?
|
|
3745
|
+
features: [...re],
|
|
3746
|
+
forms: e ? Ke().map(({ name: e, description: t, inputSchema: n, annotations: r }) => ({
|
|
3743
3747
|
name: e,
|
|
3744
3748
|
description: t,
|
|
3745
3749
|
inputSchema: n,
|
|
3746
3750
|
annotations: r
|
|
3747
3751
|
})) : []
|
|
3748
|
-
} : void 0,
|
|
3752
|
+
} : void 0, ct = (e) => {
|
|
3749
3753
|
if (e?.provider !== "page") {
|
|
3750
3754
|
Ne.value = void 0;
|
|
3751
3755
|
return;
|
|
3752
3756
|
}
|
|
3753
|
-
let t = [...
|
|
3757
|
+
let t = [...D.value, ...Ke()].find((t) => t.name === e.toolName), n;
|
|
3754
3758
|
try {
|
|
3755
3759
|
n = t?.describe?.(e.input);
|
|
3756
3760
|
} catch {
|
|
3757
3761
|
n = void 0;
|
|
3758
3762
|
}
|
|
3759
|
-
n && (
|
|
3760
|
-
...
|
|
3763
|
+
n && (Ie.value = {
|
|
3764
|
+
...Ie.value,
|
|
3761
3765
|
[e.toolCallId]: n
|
|
3762
|
-
}), e.readOnly ? Ne.value = void 0 : (Ne.value = { title: n ?? t?.annotations?.title ?? e.toolName },
|
|
3763
|
-
},
|
|
3766
|
+
}), e.readOnly ? Ne.value = void 0 : (Ne.value = { title: n ?? t?.annotations?.title ?? e.toolName }, Le.value = !0);
|
|
3767
|
+
}, lt = Me({
|
|
3764
3768
|
registry: () => [
|
|
3765
|
-
...(
|
|
3766
|
-
...
|
|
3767
|
-
...
|
|
3769
|
+
...(me.value ?? []).filter((e) => !oe(e.name)),
|
|
3770
|
+
...D.value,
|
|
3771
|
+
...Ke()
|
|
3768
3772
|
],
|
|
3769
|
-
capability: () =>
|
|
3770
|
-
addToolOutput: (e) => void
|
|
3771
|
-
confirm:
|
|
3772
|
-
waitForResume:
|
|
3773
|
+
capability: () => se.value,
|
|
3774
|
+
addToolOutput: (e) => void I.value.addToolOutput(e),
|
|
3775
|
+
confirm: at,
|
|
3776
|
+
waitForResume: it,
|
|
3773
3777
|
onPendingChange: (e) => {
|
|
3774
|
-
|
|
3778
|
+
he.value = e;
|
|
3775
3779
|
},
|
|
3776
|
-
onActivity:
|
|
3777
|
-
}),
|
|
3778
|
-
let n =
|
|
3779
|
-
|
|
3780
|
-
},
|
|
3781
|
-
registry: () =>
|
|
3782
|
-
capability: () =>
|
|
3783
|
-
addToolOutput: (e) =>
|
|
3780
|
+
onActivity: ct
|
|
3781
|
+
}), ut = /* @__PURE__ */ new Map(), dt = 0, j = (e, t) => {
|
|
3782
|
+
let n = ut.get(e);
|
|
3783
|
+
ut.delete(e), n?.(JSON.stringify(t));
|
|
3784
|
+
}, pt = Me({
|
|
3785
|
+
registry: () => D.value,
|
|
3786
|
+
capability: () => se.value,
|
|
3787
|
+
addToolOutput: (e) => j(e.toolCallId, "output" in e ? e.output : {
|
|
3784
3788
|
content: [{
|
|
3785
3789
|
type: "text",
|
|
3786
3790
|
text: e.errorText
|
|
@@ -3788,40 +3792,40 @@ function di(e) {
|
|
|
3788
3792
|
isError: !0
|
|
3789
3793
|
}),
|
|
3790
3794
|
confirm: async (e, t) => {
|
|
3791
|
-
for (;
|
|
3792
|
-
let t = C(
|
|
3795
|
+
for (; A.value;) await new Promise((e) => {
|
|
3796
|
+
let t = C(A, (n) => {
|
|
3793
3797
|
n || (t(), e());
|
|
3794
3798
|
});
|
|
3795
3799
|
});
|
|
3796
|
-
return
|
|
3800
|
+
return ut.has(e.toolCallId) ? at(e, t) : !1;
|
|
3797
3801
|
},
|
|
3798
3802
|
waitForResume: () => new Promise((e) => setTimeout(() => e(!0), qr)),
|
|
3799
3803
|
onPendingChange: (e) => {
|
|
3800
3804
|
ye.value = e;
|
|
3801
3805
|
},
|
|
3802
|
-
onActivity:
|
|
3806
|
+
onActivity: ct
|
|
3803
3807
|
});
|
|
3804
|
-
function
|
|
3805
|
-
let e =
|
|
3808
|
+
function mt() {
|
|
3809
|
+
let e = st({ forms: !1 });
|
|
3806
3810
|
if (e) return {
|
|
3807
3811
|
declaration: e,
|
|
3808
|
-
clientTools: Object.fromEntries(
|
|
3809
|
-
|
|
3810
|
-
let r = `page-call-${
|
|
3811
|
-
|
|
3812
|
+
clientTools: Object.fromEntries(D.value.map((e) => [e.name, (t) => new Promise((n) => {
|
|
3813
|
+
dt += 1;
|
|
3814
|
+
let r = `page-call-${dt}`;
|
|
3815
|
+
ut.set(r, n), pt.enqueue({
|
|
3812
3816
|
toolCallId: r,
|
|
3813
3817
|
toolName: e.name,
|
|
3814
3818
|
input: t ?? {},
|
|
3815
|
-
messageId:
|
|
3819
|
+
messageId: kt()?.id ?? "",
|
|
3816
3820
|
readOnly: e.annotations?.readOnlyHint === !0,
|
|
3817
3821
|
provider: "page"
|
|
3818
3822
|
});
|
|
3819
3823
|
})]))
|
|
3820
3824
|
};
|
|
3821
3825
|
}
|
|
3822
|
-
function
|
|
3823
|
-
|
|
3824
|
-
for (let e of [...
|
|
3826
|
+
function ht() {
|
|
3827
|
+
pt.cancelAll(), A.value && ut.has(A.value.toolCallId) && A.value.answer(!1);
|
|
3828
|
+
for (let e of [...ut.keys()]) j(e, {
|
|
3825
3829
|
content: [{
|
|
3826
3830
|
type: "text",
|
|
3827
3831
|
text: "Stopped by the user."
|
|
@@ -3829,34 +3833,34 @@ function di(e) {
|
|
|
3829
3833
|
isError: !0
|
|
3830
3834
|
});
|
|
3831
3835
|
}
|
|
3832
|
-
async function
|
|
3833
|
-
|
|
3836
|
+
async function gt() {
|
|
3837
|
+
_t(), ht(), Ne.value = void 0, Le.value = !1, W.value = "", await I.value.stop();
|
|
3834
3838
|
}
|
|
3835
|
-
function
|
|
3836
|
-
|
|
3839
|
+
function _t() {
|
|
3840
|
+
lt.cancelAll(), A.value && !ut.has(A.value.toolCallId) && A.value.answer(!1);
|
|
3837
3841
|
}
|
|
3838
|
-
async function
|
|
3839
|
-
|
|
3842
|
+
async function vt(e) {
|
|
3843
|
+
Ge.value = e, e && await gt();
|
|
3840
3844
|
}
|
|
3841
|
-
C(E, () =>
|
|
3842
|
-
let
|
|
3843
|
-
function
|
|
3844
|
-
N.value.includes(e) || (N.value = [...N.value, e]),
|
|
3845
|
+
C(E, () => _t(), { flush: "sync" });
|
|
3846
|
+
let yt = !1, M, bt = x(), xt, St = x([]), N = x([]), P = x([]), F = x({}), Ct = /* @__PURE__ */ new Map(), wt = /* @__PURE__ */ new Set();
|
|
3847
|
+
function Tt(e, t, n) {
|
|
3848
|
+
N.value.includes(e) || (N.value = [...N.value, e]), Ct.set(e, Date.now()), n ? wt.add(e) : wt.delete(e), t && (F.value = {
|
|
3845
3849
|
...F.value,
|
|
3846
3850
|
[e]: t
|
|
3847
|
-
}),
|
|
3851
|
+
}), Z || Fn();
|
|
3848
3852
|
}
|
|
3849
|
-
function
|
|
3853
|
+
function Et(e) {
|
|
3850
3854
|
F.value = Object.fromEntries(Object.entries(F.value).filter(([t]) => t !== e));
|
|
3851
3855
|
}
|
|
3852
|
-
function
|
|
3853
|
-
|
|
3856
|
+
function Dt(e) {
|
|
3857
|
+
Ct.delete(e), N.value = N.value.filter((t) => t !== e), P.value = P.value.filter((t) => t !== e), Et(e);
|
|
3854
3858
|
}
|
|
3855
|
-
let
|
|
3859
|
+
let Ot = Gr(() => ({
|
|
3856
3860
|
id: E.value,
|
|
3857
3861
|
transport: new hr({
|
|
3858
|
-
api:
|
|
3859
|
-
prepareReconnectToStreamRequest: ({ id: e }) => ({ api:
|
|
3862
|
+
api: k.value.getChatEndpoint(o.value, T.value ? "reasoning" : "chat"),
|
|
3863
|
+
prepareReconnectToStreamRequest: ({ id: e }) => ({ api: k.value.getChatStreamEndpoint(o.value, e) }),
|
|
3860
3864
|
prepareSendMessagesRequest: ({ messages: e, id: t }) => ({ body: {
|
|
3861
3865
|
id: t,
|
|
3862
3866
|
messages: [e[e.length - 1]],
|
|
@@ -3871,59 +3875,59 @@ function di(e) {
|
|
|
3871
3875
|
reasoning: d.value?.reasoning,
|
|
3872
3876
|
webSearch: f.value?.webSearch,
|
|
3873
3877
|
smoothStream: u.value?.smoothStream,
|
|
3874
|
-
deviceContext:
|
|
3875
|
-
externalContext:
|
|
3878
|
+
deviceContext: rt(),
|
|
3879
|
+
externalContext: ne.value,
|
|
3876
3880
|
disabledTools: f.value?.disabled,
|
|
3877
|
-
fallbackModels:
|
|
3878
|
-
gatewayOptions:
|
|
3879
|
-
hostTools: je(
|
|
3880
|
-
pageTools:
|
|
3881
|
+
fallbackModels: ee.value,
|
|
3882
|
+
gatewayOptions: y.value,
|
|
3883
|
+
hostTools: je(me.value, se.value),
|
|
3884
|
+
pageTools: st({ forms: !0 })
|
|
3881
3885
|
} }),
|
|
3882
3886
|
credentials: "include",
|
|
3883
3887
|
headers: () => p.value ?? {}
|
|
3884
3888
|
}),
|
|
3885
3889
|
sendAutomaticallyWhen: (e) => ui(e) || _r(e),
|
|
3886
3890
|
onError: (e) => {
|
|
3887
|
-
|
|
3891
|
+
yt ? le.warn(e) : tt(e);
|
|
3888
3892
|
},
|
|
3889
3893
|
onToolCall: ({ toolCall: e }) => {
|
|
3890
|
-
if (!Ae(e) ||
|
|
3894
|
+
if (!Ae(e) || yt) return;
|
|
3891
3895
|
let t = e;
|
|
3892
|
-
|
|
3896
|
+
lt.enqueue({
|
|
3893
3897
|
toolCallId: t.toolCallId,
|
|
3894
3898
|
toolName: t.toolName,
|
|
3895
3899
|
input: t.input,
|
|
3896
|
-
messageId:
|
|
3900
|
+
messageId: kt()?.id ?? "",
|
|
3897
3901
|
readOnly: t.toolMetadata?.readOnly === !0,
|
|
3898
3902
|
provider: t.toolMetadata?.provider === "page" ? "page" : "app"
|
|
3899
3903
|
});
|
|
3900
3904
|
},
|
|
3901
3905
|
onData: (e) => {
|
|
3902
|
-
e.type === "data-turnStream" ?
|
|
3906
|
+
e.type === "data-turnStream" ? xt = e.data.streamId : e.type === "data-audioTranscripts" && (I.value.messages = ue(I.value.messages, e.data));
|
|
3903
3907
|
},
|
|
3904
3908
|
onFinish: () => {
|
|
3905
3909
|
let e = E.value;
|
|
3906
|
-
!T.value && !R.value.some((t) => t.id === e) &&
|
|
3910
|
+
!T.value && !R.value.some((t) => t.id === e) && rn(o.value);
|
|
3907
3911
|
}
|
|
3908
|
-
})),
|
|
3912
|
+
})), I = b(() => ve(Ot)), kt = () => I.value.messages[I.value.messages.length - 1];
|
|
3909
3913
|
C(E, (e, t) => {
|
|
3910
|
-
if (t && !T.value && (
|
|
3911
|
-
let e =
|
|
3912
|
-
|
|
3914
|
+
if (t && !T.value && (K() || M?.chatId === t)) {
|
|
3915
|
+
let e = I.value.messages.filter((e) => e.role === "user"), n = e[e.length - 1];
|
|
3916
|
+
Tt(t, n ? de(n) ?? "" : "", I.value.status === "streaming" || M?.chatId === t);
|
|
3913
3917
|
}
|
|
3914
|
-
|
|
3918
|
+
Dt(e), xt = void 0, clearTimeout(J), q.value = !1, I.value.stop();
|
|
3915
3919
|
}, { flush: "sync" });
|
|
3916
|
-
let
|
|
3920
|
+
let At = b(() => {
|
|
3917
3921
|
let e = u.value?.initialMessage;
|
|
3918
3922
|
return e?.[r.value] ? e[r.value] : n("message.defaultAgentWelcome") ? t("message.defaultAgentWelcome") : "";
|
|
3919
|
-
}),
|
|
3920
|
-
id:
|
|
3923
|
+
}), jt = ft(), Mt = b(() => ({
|
|
3924
|
+
id: jt,
|
|
3921
3925
|
role: "assistant",
|
|
3922
3926
|
parts: [{
|
|
3923
3927
|
type: "text",
|
|
3924
|
-
text:
|
|
3928
|
+
text: At.value
|
|
3925
3929
|
}]
|
|
3926
|
-
})),
|
|
3930
|
+
})), Nt = b(() => {
|
|
3927
3931
|
let e = (e) => e.map((e) => e.role !== "user" || !e.parts.some((e) => e.type === "file") ? e : {
|
|
3928
3932
|
...e,
|
|
3929
3933
|
parts: e.parts.map((e) => {
|
|
@@ -3933,47 +3937,47 @@ function di(e) {
|
|
|
3933
3937
|
let e = t.url.slice(13);
|
|
3934
3938
|
return {
|
|
3935
3939
|
...t,
|
|
3936
|
-
url:
|
|
3940
|
+
url: k.value.getMediaUrl(o.value, E.value, e)
|
|
3937
3941
|
};
|
|
3938
3942
|
}
|
|
3939
3943
|
return t.url.startsWith("blob:") ? t : {
|
|
3940
3944
|
...t,
|
|
3941
|
-
url:
|
|
3945
|
+
url: k.value.appendAuthToken(t.url)
|
|
3942
3946
|
};
|
|
3943
3947
|
})
|
|
3944
|
-
}), t =
|
|
3945
|
-
return T.value ? e(t) : !
|
|
3946
|
-
}),
|
|
3948
|
+
}), t = I.value.id === E.value ? I.value.messages : [];
|
|
3949
|
+
return T.value ? e(t) : !Be.value && t[0]?.role !== "assistant" ? [Mt.value, ...e(t)] : e(t);
|
|
3950
|
+
}), L = b(() => {
|
|
3947
3951
|
let e = u.value?.messagePlaceholder;
|
|
3948
3952
|
return e?.[r.value] ? e[r.value] : n("placeholder.askAnything") ? t("placeholder.askAnything") : "";
|
|
3949
|
-
}), R =
|
|
3950
|
-
function
|
|
3951
|
-
let n = Object.fromEntries(Object.entries(
|
|
3952
|
-
|
|
3953
|
+
}), R = x([]), Pt = x(!1), Ft = x(1), It = x(!1), z = x(!1), B, V = x([]), Lt = x(!1), Rt = x("chat"), zt = x(0), Bt = x([]), Vt = x(), Ht = x(!1), Ut = x(!1), Wt = x(), Gt = x(!1), Kt = x(!1), qt = x(), H = x(""), U = x([]), W = x(""), Jt = S(), Yt = x(0), Xt = fe(b(() => `${o.value}-queue`), {}), Zt = b(() => Xt.value[E.value] ?? []), Qt = b(() => !T.value);
|
|
3954
|
+
function $t(e, t) {
|
|
3955
|
+
let n = Object.fromEntries(Object.entries(Xt.value).filter(([t]) => t !== e));
|
|
3956
|
+
Xt.value = t.length > 0 ? {
|
|
3953
3957
|
...n,
|
|
3954
3958
|
[e]: t
|
|
3955
3959
|
} : n;
|
|
3956
3960
|
}
|
|
3957
|
-
function
|
|
3958
|
-
let t = (
|
|
3959
|
-
return
|
|
3961
|
+
function en(e) {
|
|
3962
|
+
let t = (Xt.value[e] ?? []).join(si);
|
|
3963
|
+
return $t(e, []), t;
|
|
3960
3964
|
}
|
|
3961
|
-
function
|
|
3962
|
-
e && (
|
|
3965
|
+
function tn(e) {
|
|
3966
|
+
e && (H.value = H.value ? `${H.value}${si}${e}` : e);
|
|
3963
3967
|
}
|
|
3964
|
-
function
|
|
3965
|
-
|
|
3968
|
+
function nn(e) {
|
|
3969
|
+
$t(E.value, Zt.value.filter((t, n) => n !== e));
|
|
3966
3970
|
}
|
|
3967
|
-
function
|
|
3968
|
-
let t =
|
|
3969
|
-
|
|
3971
|
+
function G(e) {
|
|
3972
|
+
let t = Zt.value[e];
|
|
3973
|
+
nn(e), tn(t ?? "");
|
|
3970
3974
|
}
|
|
3971
|
-
async function
|
|
3975
|
+
async function rn(e) {
|
|
3972
3976
|
if (T.value) R.value = [];
|
|
3973
3977
|
else {
|
|
3974
|
-
|
|
3978
|
+
Pt.value = !0;
|
|
3975
3979
|
try {
|
|
3976
|
-
let t = await
|
|
3980
|
+
let t = await k.value.getConversations(e, l.value), n = new Set(t.map((e) => e.id)), r = N.value.filter((e) => !n.has(e) && F.value[e]).map((t) => ({
|
|
3977
3981
|
id: t,
|
|
3978
3982
|
agentId: e,
|
|
3979
3983
|
title: F.value[t],
|
|
@@ -3981,112 +3985,112 @@ function di(e) {
|
|
|
3981
3985
|
messages: [],
|
|
3982
3986
|
lastMessageAt: /* @__PURE__ */ new Date()
|
|
3983
3987
|
})), i = `${e}:${l.value ?? ""}`;
|
|
3984
|
-
i !==
|
|
3985
|
-
let a = new Set(r.map((e) => e.id)), o =
|
|
3988
|
+
i !== B && (Ft.value = 1);
|
|
3989
|
+
let a = new Set(r.map((e) => e.id)), o = Ft.value > 1 ? R.value.filter((e) => !n.has(e.id) && !a.has(e.id)) : [];
|
|
3986
3990
|
R.value = [
|
|
3987
3991
|
...r,
|
|
3988
3992
|
...t,
|
|
3989
3993
|
...o
|
|
3990
|
-
],
|
|
3994
|
+
], B = i, Ft.value === 1 && (It.value = t.length >= 100);
|
|
3991
3995
|
} catch {
|
|
3992
|
-
R.value = [],
|
|
3996
|
+
R.value = [], Ft.value = 1, B = void 0, It.value = !1;
|
|
3993
3997
|
return;
|
|
3994
3998
|
} finally {
|
|
3995
|
-
|
|
3999
|
+
Pt.value = !1;
|
|
3996
4000
|
}
|
|
3997
|
-
|
|
4001
|
+
In([.../* @__PURE__ */ new Set([...X(), ...R.value.map((e) => e.id)])]);
|
|
3998
4002
|
}
|
|
3999
4003
|
}
|
|
4000
|
-
async function
|
|
4001
|
-
if (!
|
|
4002
|
-
|
|
4003
|
-
let e =
|
|
4004
|
+
async function an() {
|
|
4005
|
+
if (!It.value || z.value || T.value) return;
|
|
4006
|
+
z.value = !0;
|
|
4007
|
+
let e = B;
|
|
4004
4008
|
try {
|
|
4005
|
-
let t =
|
|
4006
|
-
if (e !==
|
|
4009
|
+
let t = Ft.value + 1, n = await k.value.getConversations(o.value, l.value, { page: t });
|
|
4010
|
+
if (e !== B) return;
|
|
4007
4011
|
let r = new Set(R.value.map((e) => e.id));
|
|
4008
|
-
R.value = [...R.value, ...n.filter((e) => !r.has(e.id))],
|
|
4012
|
+
R.value = [...R.value, ...n.filter((e) => !r.has(e.id))], Ft.value = t, It.value = n.length >= 100;
|
|
4009
4013
|
} catch {} finally {
|
|
4010
|
-
|
|
4014
|
+
z.value = !1;
|
|
4011
4015
|
}
|
|
4012
4016
|
}
|
|
4013
|
-
async function
|
|
4014
|
-
return T.value ? [] :
|
|
4017
|
+
async function on(e) {
|
|
4018
|
+
return T.value ? [] : k.value.getConversations(o.value, l.value, { search: e });
|
|
4015
4019
|
}
|
|
4016
|
-
async function
|
|
4020
|
+
async function sn() {
|
|
4017
4021
|
let e = E.value;
|
|
4018
4022
|
if (!e) V.value = [];
|
|
4019
4023
|
else {
|
|
4020
|
-
|
|
4024
|
+
Lt.value = !0;
|
|
4021
4025
|
try {
|
|
4022
|
-
V.value = await
|
|
4026
|
+
V.value = await k.value.getChatFiles(e);
|
|
4023
4027
|
} catch {
|
|
4024
4028
|
V.value = [];
|
|
4025
4029
|
} finally {
|
|
4026
|
-
|
|
4030
|
+
Lt.value = !1;
|
|
4027
4031
|
}
|
|
4028
4032
|
}
|
|
4029
4033
|
}
|
|
4030
|
-
function
|
|
4031
|
-
return
|
|
4034
|
+
function cn(e, t = !1) {
|
|
4035
|
+
return k.value.getChatFileDownloadUrl(e, t);
|
|
4032
4036
|
}
|
|
4033
|
-
function
|
|
4034
|
-
return
|
|
4037
|
+
function ln(e) {
|
|
4038
|
+
return k.value.getChatFilePreviewUrl(e);
|
|
4035
4039
|
}
|
|
4036
|
-
async function
|
|
4037
|
-
await
|
|
4040
|
+
async function un(e) {
|
|
4041
|
+
await k.value.deleteChatFile(e);
|
|
4038
4042
|
let t = V.value.find((t) => t.documentId === e), n = t?.kind === "spreadsheet" ? t.sourceAttachmentId ?? t.documentId : void 0;
|
|
4039
4043
|
V.value = V.value.filter((t) => t.documentId !== e && (!n || t.documentId !== n && t.sourceAttachmentId !== n));
|
|
4040
4044
|
}
|
|
4041
|
-
async function
|
|
4045
|
+
async function dn(e, t) {
|
|
4042
4046
|
if (!T.value) try {
|
|
4043
|
-
let n = await
|
|
4044
|
-
if (t !== E.value ||
|
|
4045
|
-
n && (
|
|
4047
|
+
let n = await k.value.getChat(e, t);
|
|
4048
|
+
if (t !== E.value || I.value.status !== "ready" || I.value.messages.length > 0) return;
|
|
4049
|
+
n && (I.value.messages = n.messages, Qe.value = n.blocked ?? !1, fn(e, t, n.turnInProgress === !0));
|
|
4046
4050
|
} catch {}
|
|
4047
4051
|
}
|
|
4048
|
-
async function
|
|
4049
|
-
n && (await
|
|
4052
|
+
async function fn(e, t, n) {
|
|
4053
|
+
n && (await pn(t), t !== E.value || K()) || (await mn(e, t), t === E.value && await vn());
|
|
4050
4054
|
}
|
|
4051
|
-
async function
|
|
4055
|
+
async function pn(e) {
|
|
4052
4056
|
let t = { chatId: e };
|
|
4053
|
-
M = t,
|
|
4057
|
+
M = t, bt.value = e;
|
|
4054
4058
|
let n = () => M === t && e === E.value, r = Date.now() + $r;
|
|
4055
4059
|
try {
|
|
4056
|
-
for (; n() && !
|
|
4057
|
-
|
|
4060
|
+
for (; n() && !K() && Date.now() < r;) {
|
|
4061
|
+
yt = !0;
|
|
4058
4062
|
try {
|
|
4059
|
-
await
|
|
4063
|
+
await I.value.resumeStream();
|
|
4060
4064
|
} finally {
|
|
4061
|
-
|
|
4065
|
+
yt = !1;
|
|
4062
4066
|
}
|
|
4063
4067
|
if (!n()) return;
|
|
4064
|
-
|
|
4065
|
-
let t = await
|
|
4066
|
-
if (!t || !n() ||
|
|
4068
|
+
I.value.clearError();
|
|
4069
|
+
let t = await k.value.getChat(o.value, e).catch(() => null);
|
|
4070
|
+
if (!t || !n() || K()) return;
|
|
4067
4071
|
if (!t.turnInProgress) {
|
|
4068
|
-
|
|
4072
|
+
I.value.messages = t.messages;
|
|
4069
4073
|
return;
|
|
4070
4074
|
}
|
|
4071
4075
|
await new Promise((e) => setTimeout(e, ei));
|
|
4072
4076
|
}
|
|
4073
4077
|
} finally {
|
|
4074
|
-
M === t && (M = void 0,
|
|
4078
|
+
M === t && (M = void 0, bt.value = void 0);
|
|
4075
4079
|
}
|
|
4076
4080
|
}
|
|
4077
|
-
async function
|
|
4081
|
+
async function mn(e, t) {
|
|
4078
4082
|
let n;
|
|
4079
4083
|
try {
|
|
4080
4084
|
n = Number(sessionStorage.getItem(Oe)), sessionStorage.removeItem(Oe);
|
|
4081
4085
|
} catch {
|
|
4082
4086
|
return;
|
|
4083
4087
|
}
|
|
4084
|
-
if (!(!n || Date.now() - n > 6e4 ||
|
|
4085
|
-
let n =
|
|
4088
|
+
if (!(!n || Date.now() - n > 6e4 || Ge.value)) for (let n = 0; n < 12; n++) {
|
|
4089
|
+
let n = I.value.messages[I.value.messages.length - 1];
|
|
4086
4090
|
if (n?.role === "assistant") {
|
|
4087
|
-
let e = n.parts.filter((e) =>
|
|
4091
|
+
let e = n.parts.filter((e) => ae(e) && e.state === "input-available"), t = e.filter((e) => e.toolMetadata?.provider === "page" && e.toolMetadata.readOnly === !0);
|
|
4088
4092
|
if (e.length > 0) {
|
|
4089
|
-
if (t.length === e.length && !
|
|
4093
|
+
if (t.length === e.length && !Ge.value) for (let e of t) lt.enqueue({
|
|
4090
4094
|
toolCallId: e.toolCallId,
|
|
4091
4095
|
toolName: e.toolName,
|
|
4092
4096
|
input: e.input,
|
|
@@ -4098,252 +4102,253 @@ function di(e) {
|
|
|
4098
4102
|
}
|
|
4099
4103
|
if (n.parts[n.parts.length - 1]?.type === "text") return;
|
|
4100
4104
|
}
|
|
4101
|
-
if (await new Promise((e) => setTimeout(e, 1500)), t !== E.value ||
|
|
4105
|
+
if (await new Promise((e) => setTimeout(e, 1500)), t !== E.value || I.value.status !== "ready") return;
|
|
4102
4106
|
try {
|
|
4103
|
-
let n = await
|
|
4104
|
-
n && t === E.value && (
|
|
4107
|
+
let n = await k.value.getChat(e, t);
|
|
4108
|
+
n && t === E.value && (I.value.messages = n.messages);
|
|
4105
4109
|
} catch {
|
|
4106
4110
|
return;
|
|
4107
4111
|
}
|
|
4108
4112
|
}
|
|
4109
4113
|
}
|
|
4110
|
-
let
|
|
4111
|
-
let e =
|
|
4114
|
+
let K = () => {
|
|
4115
|
+
let e = I.value.status;
|
|
4112
4116
|
return e === "submitted" || e === "streaming";
|
|
4113
|
-
},
|
|
4114
|
-
let e =
|
|
4115
|
-
return
|
|
4116
|
-
},
|
|
4117
|
-
async function
|
|
4117
|
+
}, hn = () => K() || M?.chatId === E.value || he.value > 0, gn = () => {
|
|
4118
|
+
let e = kt();
|
|
4119
|
+
return A.value !== void 0 || Jr(e) || li(e);
|
|
4120
|
+
}, _n = /* @__PURE__ */ new Set();
|
|
4121
|
+
async function vn() {
|
|
4118
4122
|
let e = E.value;
|
|
4119
|
-
if (!(
|
|
4120
|
-
if (
|
|
4123
|
+
if (!(_n.has(e) || Zt.value.length === 0 || hn() || O.value)) {
|
|
4124
|
+
if (gn()) tn(en(e));
|
|
4121
4125
|
else {
|
|
4122
|
-
|
|
4126
|
+
_n.add(e);
|
|
4123
4127
|
try {
|
|
4124
4128
|
let t = Date.now() + ii;
|
|
4125
|
-
for (; Date.now() < t && (await Promise.race([
|
|
4126
|
-
if (e !== E.value ||
|
|
4127
|
-
let n =
|
|
4128
|
-
n &&
|
|
4129
|
+
for (; Date.now() < t && (await Promise.race([k.value.getRunningTurns(o.value, [e]).catch(() => []), new Promise((t) => setTimeout(() => t([e]), oi))])).includes(e);) await new Promise((e) => setTimeout(e, ai));
|
|
4130
|
+
if (e !== E.value || hn()) return;
|
|
4131
|
+
let n = en(e);
|
|
4132
|
+
n && On(n);
|
|
4129
4133
|
} finally {
|
|
4130
|
-
|
|
4134
|
+
_n.delete(e);
|
|
4131
4135
|
}
|
|
4132
4136
|
}
|
|
4133
4137
|
}
|
|
4134
4138
|
}
|
|
4135
|
-
let
|
|
4136
|
-
async function
|
|
4137
|
-
if (T.value ||
|
|
4138
|
-
let e = E.value, t =
|
|
4139
|
+
let yn = 0, bn = 0;
|
|
4140
|
+
async function xn() {
|
|
4141
|
+
if (T.value || K()) return "indeterminate";
|
|
4142
|
+
let e = E.value, t = yn += 1;
|
|
4139
4143
|
try {
|
|
4140
|
-
let n = await
|
|
4141
|
-
if (!n || e !== E.value ||
|
|
4142
|
-
|
|
4143
|
-
let r = n.messages, i = Qr(r,
|
|
4144
|
-
return
|
|
4144
|
+
let n = await k.value.getChat(o.value, e);
|
|
4145
|
+
if (!n || e !== E.value || K() || t <= bn) return "indeterminate";
|
|
4146
|
+
bn = t;
|
|
4147
|
+
let r = n.messages, i = Qr(r, I.value.messages);
|
|
4148
|
+
return I.value.messages = [...r, ...i], Qe.value = n.blocked ?? !1, i.length > 0 ? "pending" : "caught-up";
|
|
4145
4149
|
} catch {}
|
|
4146
4150
|
return "indeterminate";
|
|
4147
4151
|
}
|
|
4148
|
-
function
|
|
4149
|
-
|
|
4152
|
+
function Sn(e) {
|
|
4153
|
+
I.value.messages = [...I.value.messages, e];
|
|
4150
4154
|
}
|
|
4151
|
-
async function
|
|
4155
|
+
async function Cn(e) {
|
|
4152
4156
|
try {
|
|
4153
|
-
|
|
4157
|
+
Bt.value = await k.value.getMessageFeedbacks(e);
|
|
4154
4158
|
} catch {
|
|
4155
|
-
|
|
4159
|
+
Bt.value = [];
|
|
4156
4160
|
}
|
|
4157
4161
|
}
|
|
4158
|
-
function
|
|
4159
|
-
let t =
|
|
4160
|
-
t >= 0 ?
|
|
4162
|
+
function wn(e) {
|
|
4163
|
+
let t = Bt.value.findIndex((t) => t.messageId === e.messageId);
|
|
4164
|
+
t >= 0 ? Bt.value[t] = e : Bt.value.push(e);
|
|
4161
4165
|
}
|
|
4162
|
-
function
|
|
4163
|
-
let t =
|
|
4166
|
+
function Tn(e) {
|
|
4167
|
+
let t = Nt.value, n = t.findIndex((t) => t.id === e.id), r = de(e) ?? "", i = t.slice(0, n).reverse().find((e) => e.role === "user");
|
|
4164
4168
|
return {
|
|
4165
|
-
userQuestion:
|
|
4169
|
+
userQuestion: de(i ?? e) ?? "",
|
|
4166
4170
|
assistantMessage: r
|
|
4167
4171
|
};
|
|
4168
4172
|
}
|
|
4169
|
-
async function
|
|
4173
|
+
async function En(e, t) {
|
|
4170
4174
|
await Promise.all([
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
]),
|
|
4175
|
-
e && (
|
|
4175
|
+
dn(e, t),
|
|
4176
|
+
rn(e),
|
|
4177
|
+
Cn(t)
|
|
4178
|
+
]), nt.value || De((e, t) => k.value.reverseGeocode(e, t, r.value)).then((e) => {
|
|
4179
|
+
e && (nt.value = e);
|
|
4176
4180
|
});
|
|
4177
4181
|
}
|
|
4178
|
-
async function
|
|
4179
|
-
let e =
|
|
4182
|
+
async function Dn() {
|
|
4183
|
+
let e = H.value.trim(), t = U.value.filter((e) => e.state === "done" && e.mediaSource !== void 0).map((e) => ({
|
|
4180
4184
|
type: "file",
|
|
4181
4185
|
mediaType: e.mediaSource.mimeType,
|
|
4182
4186
|
url: e.localUrl,
|
|
4183
4187
|
filename: e.mediaSource.name,
|
|
4184
4188
|
providerMetadata: { "8bot": { media: e.mediaSource } }
|
|
4185
|
-
}));
|
|
4186
|
-
!T.value &&
|
|
4189
|
+
})), n = Je.value ? Pe.value : void 0;
|
|
4190
|
+
!T.value && hn() ? e && t.length === 0 && !n && ($t(E.value, [...Zt.value, e]), H.value = "") : (T.value && Nt.value.length > 0 && await Vn(), On(e, t, n), H.value = "", Pe.value = void 0, Bn());
|
|
4187
4191
|
}
|
|
4188
|
-
function
|
|
4189
|
-
|
|
4190
|
-
let
|
|
4191
|
-
|
|
4192
|
+
function On(e, t = [], n) {
|
|
4193
|
+
_t(), W.value = e, Jt.value = n, Yt.value = I.value.messages.length;
|
|
4194
|
+
let r = I.value.sendMessage;
|
|
4195
|
+
r({
|
|
4192
4196
|
text: e,
|
|
4193
|
-
files: t.length > 0 ? t : void 0
|
|
4197
|
+
files: t.length > 0 ? t : void 0,
|
|
4198
|
+
...n && { metadata: { pagePointer: n } }
|
|
4194
4199
|
});
|
|
4195
4200
|
}
|
|
4196
|
-
function
|
|
4201
|
+
function kn(e) {
|
|
4197
4202
|
let t = e.trim();
|
|
4198
4203
|
if (!t) return;
|
|
4199
|
-
if (
|
|
4200
|
-
|
|
4204
|
+
if (I.value.status !== "ready") {
|
|
4205
|
+
le.warn("[useChatbotStore] sendMessage called before chat is ready. Listen for the \"ready\" event on the widget element.");
|
|
4201
4206
|
return;
|
|
4202
4207
|
}
|
|
4203
|
-
let n =
|
|
4204
|
-
|
|
4208
|
+
let n = I.value.sendMessage;
|
|
4209
|
+
_t(), n({ text: t });
|
|
4205
4210
|
}
|
|
4206
|
-
async function
|
|
4207
|
-
let e =
|
|
4208
|
-
|
|
4211
|
+
async function An() {
|
|
4212
|
+
let e = I.value.messages.slice(Yt.value).some((e) => e.parts.some(ae)), t = W.value, n = Jt.value, r = t.length > 0 && !e, i = E.value, a = Yt.value, s = M?.chatId === i, c = xt, l = en(i), u = (e = "") => {
|
|
4213
|
+
H.value = [
|
|
4209
4214
|
e,
|
|
4210
|
-
|
|
4211
|
-
|
|
4215
|
+
l,
|
|
4216
|
+
H.value
|
|
4212
4217
|
].filter(Boolean).join(si);
|
|
4213
|
-
},
|
|
4214
|
-
M = void 0,
|
|
4215
|
-
let
|
|
4216
|
-
if (!
|
|
4217
|
-
if (
|
|
4218
|
-
if (await
|
|
4219
|
-
if (
|
|
4220
|
-
|
|
4218
|
+
}, d = () => i === E.value && !K() && Yt.value === a ? !1 : (l && $t(i, [l, ...Xt.value[i] ?? []]), !0);
|
|
4219
|
+
M = void 0, bt.value = void 0, _t(), await I.value.stop();
|
|
4220
|
+
let f = T.value || e && !s || await k.value.stopChatTurn(o.value, i, c).catch(() => !0);
|
|
4221
|
+
if (!d()) {
|
|
4222
|
+
if (s || !f) {
|
|
4223
|
+
if (await xn(), d()) return;
|
|
4224
|
+
if (s || I.value.messages.length > Yt.value) {
|
|
4225
|
+
W.value = "", u();
|
|
4221
4226
|
return;
|
|
4222
4227
|
}
|
|
4223
4228
|
}
|
|
4224
|
-
|
|
4229
|
+
r ? (u(t), Pe.value ??= n, I.value.messages = I.value.messages.slice(0, Yt.value), W.value = "") : u();
|
|
4225
4230
|
}
|
|
4226
4231
|
}
|
|
4227
|
-
C(() =>
|
|
4228
|
-
let t =
|
|
4229
|
-
t && !
|
|
4230
|
-
}), C(() =>
|
|
4231
|
-
e === "submitted" && (
|
|
4232
|
+
C(() => I.value.messages, (e) => {
|
|
4233
|
+
let t = A.value?.toolCallId;
|
|
4234
|
+
t && !ut.has(t) && !e.some((e) => e.parts.some((e) => e.toolCallId === t)) && _t();
|
|
4235
|
+
}), C(() => I.value.status, (e) => {
|
|
4236
|
+
e === "submitted" && (Re.value++, xt = void 0);
|
|
4232
4237
|
});
|
|
4233
|
-
let
|
|
4238
|
+
let jn;
|
|
4234
4239
|
C(() => [
|
|
4235
|
-
|
|
4236
|
-
|
|
4240
|
+
I.value.status,
|
|
4241
|
+
he.value,
|
|
4237
4242
|
ye.value
|
|
4238
4243
|
], ([e, t, n]) => {
|
|
4239
|
-
clearTimeout(
|
|
4240
|
-
|
|
4244
|
+
clearTimeout(jn), e === "ready" && t === 0 && n === 0 && (jn = setTimeout(() => {
|
|
4245
|
+
Le.value = !1;
|
|
4241
4246
|
}, 1500));
|
|
4242
4247
|
});
|
|
4243
|
-
let
|
|
4244
|
-
C(() => !
|
|
4245
|
-
clearTimeout(
|
|
4246
|
-
|
|
4248
|
+
let q = x(!1), J;
|
|
4249
|
+
C(() => !A.value && !Jr(kt()) && (K() || he.value > 0), (e) => {
|
|
4250
|
+
clearTimeout(J), e ? q.value = !0 : J = setTimeout(() => {
|
|
4251
|
+
q.value = !1;
|
|
4247
4252
|
}, 400);
|
|
4248
4253
|
}, { immediate: !0 });
|
|
4249
|
-
let
|
|
4250
|
-
let e =
|
|
4251
|
-
return
|
|
4252
|
-
}),
|
|
4253
|
-
function
|
|
4254
|
-
clearTimeout(
|
|
4255
|
-
|
|
4254
|
+
let Y = b(() => {
|
|
4255
|
+
let e = St.value.filter((e) => e !== E.value);
|
|
4256
|
+
return q.value || bt.value === E.value ? [...e, E.value] : e;
|
|
4257
|
+
}), X = () => [.../* @__PURE__ */ new Set([...St.value, ...N.value])], Mn = Ce(), Z, Nn = 0, Pn = 0;
|
|
4258
|
+
function Fn() {
|
|
4259
|
+
clearTimeout(Z), Z = void 0, X().length !== 0 && Mn.value === "visible" && (Z = setTimeout(() => {
|
|
4260
|
+
Z = void 0, In(X());
|
|
4256
4261
|
}, ti));
|
|
4257
4262
|
}
|
|
4258
|
-
async function
|
|
4263
|
+
async function In(e) {
|
|
4259
4264
|
let t = e.slice(0, ni);
|
|
4260
4265
|
if (T.value || t.length === 0) {
|
|
4261
|
-
|
|
4266
|
+
Fn();
|
|
4262
4267
|
return;
|
|
4263
4268
|
}
|
|
4264
|
-
let n =
|
|
4269
|
+
let n = Nn += 1, r;
|
|
4265
4270
|
try {
|
|
4266
|
-
r = await
|
|
4271
|
+
r = await k.value.getRunningTurns(o.value, t);
|
|
4267
4272
|
} catch {
|
|
4268
|
-
|
|
4273
|
+
Fn();
|
|
4269
4274
|
return;
|
|
4270
4275
|
}
|
|
4271
|
-
if (n <=
|
|
4272
|
-
|
|
4273
|
-
for (let e of r)
|
|
4274
|
-
let i = new Set(t), a =
|
|
4275
|
-
|
|
4276
|
+
if (n <= Pn) return;
|
|
4277
|
+
Pn = n;
|
|
4278
|
+
for (let e of r) wt.add(e);
|
|
4279
|
+
let i = new Set(t), a = X().filter((e) => i.has(e) && !r.includes(e)), s = (e) => N.value.includes(e) && !wt.has(e), c = a.filter((e) => s(e) && Date.now() - (Ct.get(e) ?? 0) > ri), l = a.filter((e) => !s(e));
|
|
4280
|
+
St.value = [...St.value.filter((e) => !i.has(e)), ...r];
|
|
4276
4281
|
let u = l.filter((e) => N.value.includes(e));
|
|
4277
|
-
(u.length > 0 || c.length > 0) && (N.value = N.value.filter((e) => !u.includes(e) && !c.includes(e)), P.value = [...P.value, ...u.filter((e) => e !== E.value && !P.value.includes(e))]), l.length > 0 &&
|
|
4282
|
+
(u.length > 0 || c.length > 0) && (N.value = N.value.filter((e) => !u.includes(e) && !c.includes(e)), P.value = [...P.value, ...u.filter((e) => e !== E.value && !P.value.includes(e))]), l.length > 0 && rn(o.value), Fn();
|
|
4278
4283
|
}
|
|
4279
|
-
C(
|
|
4280
|
-
e === "visible" ?
|
|
4281
|
-
}),
|
|
4282
|
-
let
|
|
4284
|
+
C(Mn, (e) => {
|
|
4285
|
+
e === "visible" ? In(X()) : (clearTimeout(Z), Z = void 0);
|
|
4286
|
+
}), _e(() => clearTimeout(Z));
|
|
4287
|
+
let Ln = b(() => P.value.map((e) => ({
|
|
4283
4288
|
chatId: e,
|
|
4284
4289
|
title: R.value.find((t) => t.id === e)?.title || F.value[e] || void 0
|
|
4285
4290
|
})));
|
|
4286
|
-
function
|
|
4287
|
-
|
|
4291
|
+
function Rn(e) {
|
|
4292
|
+
Dt(e), E.value = e, or("chat");
|
|
4288
4293
|
}
|
|
4289
|
-
function
|
|
4290
|
-
P.value = P.value.filter((t) => t !== e),
|
|
4294
|
+
function zn(e) {
|
|
4295
|
+
P.value = P.value.filter((t) => t !== e), Et(e);
|
|
4291
4296
|
}
|
|
4292
|
-
C(() => [
|
|
4297
|
+
C(() => [I.value.status, I.value.id], ([e, t], [n, r]) => {
|
|
4293
4298
|
if (t === r) {
|
|
4294
|
-
if (e === "error") M?.chatId !== E.value &&
|
|
4299
|
+
if (e === "error") M?.chatId !== E.value && tn(en(E.value));
|
|
4295
4300
|
else if (e === "ready" && (n === "streaming" || n === "submitted")) {
|
|
4296
|
-
if (
|
|
4297
|
-
|
|
4301
|
+
if (gn()) {
|
|
4302
|
+
tn(en(E.value));
|
|
4298
4303
|
return;
|
|
4299
4304
|
}
|
|
4300
|
-
|
|
4305
|
+
vn();
|
|
4301
4306
|
}
|
|
4302
4307
|
}
|
|
4303
|
-
}), C(
|
|
4304
|
-
e === 0 &&
|
|
4305
|
-
}), C(() =>
|
|
4306
|
-
e === "ready" &&
|
|
4308
|
+
}), C(he, (e) => {
|
|
4309
|
+
e === 0 && I.value.status === "ready" && vn();
|
|
4310
|
+
}), C(() => I.value.status, (e) => {
|
|
4311
|
+
e === "ready" && W.value.length > 0 && (W.value = "");
|
|
4307
4312
|
});
|
|
4308
|
-
function
|
|
4309
|
-
for (let t of
|
|
4310
|
-
|
|
4313
|
+
function Bn(e = !1) {
|
|
4314
|
+
for (let t of U.value) (e || t.state !== "done") && URL.revokeObjectURL(t.localUrl);
|
|
4315
|
+
U.value = [], Xn.value = null;
|
|
4311
4316
|
}
|
|
4312
|
-
async function
|
|
4313
|
-
return
|
|
4317
|
+
async function Vn() {
|
|
4318
|
+
return W.value = "", Ie.value = {}, E.value = ft(), await ge(), I.value.clearError(), O.value = void 0, Qe.value = !1, Bn(!0), or("chat"), E.value;
|
|
4314
4319
|
}
|
|
4315
|
-
async function
|
|
4316
|
-
|
|
4320
|
+
async function Hn(e) {
|
|
4321
|
+
I.value.status !== "ready" && (W.value = "", await An()), _t(), await I.value.regenerate(e);
|
|
4317
4322
|
}
|
|
4318
|
-
function
|
|
4323
|
+
function Un(e) {
|
|
4319
4324
|
if (e.tool === "requestGeolocation") {
|
|
4320
4325
|
let t = e.output;
|
|
4321
|
-
"latitude" in t && (
|
|
4326
|
+
"latitude" in t && (nt.value = {
|
|
4322
4327
|
geolocationLatitude: t.latitude,
|
|
4323
4328
|
geolocationLongitude: t.longitude,
|
|
4324
4329
|
geolocationAccuracy: t.accuracy,
|
|
4325
4330
|
geolocationCity: t.city
|
|
4326
4331
|
});
|
|
4327
4332
|
}
|
|
4328
|
-
|
|
4333
|
+
I.value.addToolOutput(e);
|
|
4329
4334
|
}
|
|
4330
|
-
function
|
|
4331
|
-
|
|
4335
|
+
function Wn(e) {
|
|
4336
|
+
I.value.addToolApprovalResponse(e);
|
|
4332
4337
|
}
|
|
4333
|
-
let
|
|
4334
|
-
|
|
4338
|
+
let Gn = b(() => I.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), Kn = b(() => _.value?.maxFilesPerMessage ?? 5), qn = b(() => _.value?.maxFilesPerChat ?? 20), Jn = b(() => Math.max(0, Math.min(Kn.value - U.value.length, qn.value - Gn.value - U.value.length))), Yn = b(() => Jn.value <= 0), Xn = x(null), Zn = () => {
|
|
4339
|
+
Xn.value = null;
|
|
4335
4340
|
};
|
|
4336
|
-
C(
|
|
4337
|
-
e || (
|
|
4341
|
+
C(Yn, (e) => {
|
|
4342
|
+
e || (Xn.value = null);
|
|
4338
4343
|
});
|
|
4339
|
-
async function
|
|
4340
|
-
if (
|
|
4341
|
-
|
|
4344
|
+
async function Qn(e) {
|
|
4345
|
+
if (Yn.value) {
|
|
4346
|
+
Xn.value = qn.value - Gn.value - U.value.length <= Kn.value - U.value.length ? {
|
|
4342
4347
|
reason: "per-chat",
|
|
4343
|
-
max:
|
|
4348
|
+
max: qn.value
|
|
4344
4349
|
} : {
|
|
4345
4350
|
reason: "per-message",
|
|
4346
|
-
max:
|
|
4351
|
+
max: Kn.value
|
|
4347
4352
|
};
|
|
4348
4353
|
return;
|
|
4349
4354
|
}
|
|
@@ -4353,26 +4358,26 @@ function di(e) {
|
|
|
4353
4358
|
localUrl: URL.createObjectURL(e),
|
|
4354
4359
|
state: "uploading"
|
|
4355
4360
|
};
|
|
4356
|
-
|
|
4361
|
+
U.value = [...U.value, n];
|
|
4357
4362
|
try {
|
|
4358
|
-
let n = await
|
|
4359
|
-
|
|
4363
|
+
let n = await k.value.uploadMedia(o.value, E.value, e);
|
|
4364
|
+
U.value = U.value.map((e) => e.id === t ? {
|
|
4360
4365
|
...e,
|
|
4361
4366
|
state: "done",
|
|
4362
4367
|
mediaSource: n
|
|
4363
4368
|
} : e);
|
|
4364
4369
|
} catch (e) {
|
|
4365
4370
|
let n = e instanceof Error ? e.message : "Upload failed";
|
|
4366
|
-
|
|
4371
|
+
U.value = U.value.map((e) => e.id === t ? {
|
|
4367
4372
|
...e,
|
|
4368
4373
|
state: "error",
|
|
4369
4374
|
error: n
|
|
4370
4375
|
} : e);
|
|
4371
4376
|
}
|
|
4372
4377
|
}
|
|
4373
|
-
async function
|
|
4374
|
-
let { userQuestion: n, assistantMessage: r } =
|
|
4375
|
-
|
|
4378
|
+
async function $n(e, t) {
|
|
4379
|
+
let { userQuestion: n, assistantMessage: r } = Tn(e);
|
|
4380
|
+
wn(await k.value.submitMessageFeedback({
|
|
4376
4381
|
messageId: e.id,
|
|
4377
4382
|
chatId: E.value,
|
|
4378
4383
|
agentId: o.value,
|
|
@@ -4381,75 +4386,75 @@ function di(e) {
|
|
|
4381
4386
|
assistantMessage: r
|
|
4382
4387
|
}));
|
|
4383
4388
|
}
|
|
4384
|
-
async function
|
|
4385
|
-
await
|
|
4389
|
+
async function er(e) {
|
|
4390
|
+
await $n(e, "upvote");
|
|
4386
4391
|
}
|
|
4387
|
-
async function
|
|
4388
|
-
await
|
|
4392
|
+
async function tr(e) {
|
|
4393
|
+
await $n(e, "downvote");
|
|
4389
4394
|
}
|
|
4390
|
-
function
|
|
4391
|
-
|
|
4395
|
+
function nr(e) {
|
|
4396
|
+
Ut.value = !1, Wt.value = void 0, Vt.value = e;
|
|
4392
4397
|
}
|
|
4393
|
-
async function
|
|
4394
|
-
if (
|
|
4395
|
-
|
|
4396
|
-
let { userQuestion: t, assistantMessage: n } =
|
|
4397
|
-
|
|
4398
|
-
messageId:
|
|
4398
|
+
async function rr(e) {
|
|
4399
|
+
if (Vt.value) try {
|
|
4400
|
+
Ht.value = !0, Ut.value = !1, Wt.value = void 0;
|
|
4401
|
+
let { userQuestion: t, assistantMessage: n } = Tn(Vt.value);
|
|
4402
|
+
wn(await k.value.submitMessageFeedback({
|
|
4403
|
+
messageId: Vt.value.id,
|
|
4399
4404
|
chatId: E.value,
|
|
4400
4405
|
agentId: o.value,
|
|
4401
4406
|
userQuestion: t,
|
|
4402
4407
|
assistantMessage: n,
|
|
4403
4408
|
comment: e
|
|
4404
|
-
})),
|
|
4409
|
+
})), Ut.value = !0, await Cn(E.value);
|
|
4405
4410
|
} catch {
|
|
4406
|
-
|
|
4411
|
+
Wt.value = n("message.feedbackSubmitError") ? t("message.feedbackSubmitError") : "Failed to submit feedback";
|
|
4407
4412
|
} finally {
|
|
4408
|
-
|
|
4413
|
+
Ht.value = !1;
|
|
4409
4414
|
}
|
|
4410
4415
|
}
|
|
4411
|
-
async function
|
|
4416
|
+
async function Q(e) {
|
|
4412
4417
|
try {
|
|
4413
|
-
|
|
4418
|
+
Kt.value = !0, Gt.value = !1, qt.value = void 0, await k.value.submitLead({
|
|
4414
4419
|
agentId: o.value,
|
|
4415
4420
|
chatId: E.value,
|
|
4416
4421
|
...e
|
|
4417
|
-
}),
|
|
4422
|
+
}), Gt.value = !0;
|
|
4418
4423
|
} catch {
|
|
4419
|
-
|
|
4424
|
+
qt.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
|
|
4420
4425
|
} finally {
|
|
4421
|
-
|
|
4426
|
+
Kt.value = !1;
|
|
4422
4427
|
}
|
|
4423
4428
|
}
|
|
4424
|
-
async function
|
|
4425
|
-
let n = await
|
|
4429
|
+
async function ir(e, t) {
|
|
4430
|
+
let n = await k.value.updateChatTitle(o.value, e, t);
|
|
4426
4431
|
R.value = R.value.map((t) => t.id === e ? {
|
|
4427
4432
|
...t,
|
|
4428
4433
|
title: n.title
|
|
4429
4434
|
} : t);
|
|
4430
4435
|
}
|
|
4431
|
-
async function
|
|
4432
|
-
await
|
|
4436
|
+
async function ar(e) {
|
|
4437
|
+
await k.value.deleteChat(o.value, e), R.value = R.value.filter((t) => t.id !== e), E.value === e && await Vn();
|
|
4433
4438
|
}
|
|
4434
|
-
function
|
|
4435
|
-
|
|
4439
|
+
function or(e) {
|
|
4440
|
+
Rt.value = e;
|
|
4436
4441
|
}
|
|
4437
|
-
function
|
|
4438
|
-
|
|
4442
|
+
function sr() {
|
|
4443
|
+
or("chat"), zt.value++;
|
|
4439
4444
|
}
|
|
4440
|
-
let
|
|
4441
|
-
function
|
|
4442
|
-
let t = () =>
|
|
4445
|
+
let cr;
|
|
4446
|
+
function lr(e) {
|
|
4447
|
+
let t = () => k.value.getChat(o.value, e).then((e) => e !== null);
|
|
4443
4448
|
return t().catch(() => t().catch(() => !1));
|
|
4444
4449
|
}
|
|
4445
4450
|
return C(l, async (e) => {
|
|
4446
|
-
if (!e || e ===
|
|
4447
|
-
let t =
|
|
4448
|
-
if (
|
|
4449
|
-
let n = E.value, r = !T.value && await
|
|
4450
|
-
l.value === e && E.value === n && (r ?
|
|
4451
|
+
if (!e || e === cr) return;
|
|
4452
|
+
let t = cr;
|
|
4453
|
+
if (cr = e, t === void 0) return;
|
|
4454
|
+
let n = E.value, r = !T.value && await lr(n);
|
|
4455
|
+
l.value === e && E.value === n && (r ? rn(o.value) : (R.value = [], Bt.value = [], V.value = [], St.value = [], N.value = [], P.value = [], F.value = {}, await Vn(), H.value = ""));
|
|
4451
4456
|
}), {
|
|
4452
|
-
apiClient:
|
|
4457
|
+
apiClient: k,
|
|
4453
4458
|
baseUrl: i,
|
|
4454
4459
|
basePath: a,
|
|
4455
4460
|
agentId: o,
|
|
@@ -4463,102 +4468,106 @@ function di(e) {
|
|
|
4463
4468
|
revisedAnswers: m,
|
|
4464
4469
|
model: h,
|
|
4465
4470
|
actionsInput: g,
|
|
4466
|
-
actions:
|
|
4471
|
+
actions: Ue,
|
|
4467
4472
|
agentFileUpload: _,
|
|
4468
4473
|
agentVoice: v,
|
|
4469
|
-
fallbackModels:
|
|
4470
|
-
gatewayOptions:
|
|
4471
|
-
externalContext:
|
|
4472
|
-
agentHostTools:
|
|
4473
|
-
hostToolRegistry:
|
|
4474
|
-
hostToolsPending:
|
|
4474
|
+
fallbackModels: ee,
|
|
4475
|
+
gatewayOptions: y,
|
|
4476
|
+
externalContext: ne,
|
|
4477
|
+
agentHostTools: se,
|
|
4478
|
+
hostToolRegistry: me,
|
|
4479
|
+
hostToolsPending: he,
|
|
4475
4480
|
agentPageAccess: be,
|
|
4476
4481
|
pageToolRegistry: Te,
|
|
4477
4482
|
pageFormsProvider: ke,
|
|
4478
4483
|
pageAction: Ne,
|
|
4479
|
-
hostStepTitles:
|
|
4480
|
-
pageControlActive:
|
|
4481
|
-
isWorking:
|
|
4482
|
-
stopHostActions:
|
|
4483
|
-
voicePageTools:
|
|
4484
|
-
cancelVoicePageCalls:
|
|
4485
|
-
pageNoticeLevel:
|
|
4486
|
-
closePageNotice:
|
|
4487
|
-
hostConfirmation:
|
|
4488
|
-
respondHostConfirmation:
|
|
4489
|
-
pageAccessAvailable:
|
|
4490
|
-
pageAccessOff:
|
|
4491
|
-
setPageAccessOff:
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4484
|
+
hostStepTitles: Ie,
|
|
4485
|
+
pageControlActive: Le,
|
|
4486
|
+
isWorking: q,
|
|
4487
|
+
stopHostActions: gt,
|
|
4488
|
+
voicePageTools: mt,
|
|
4489
|
+
cancelVoicePageCalls: ht,
|
|
4490
|
+
pageNoticeLevel: Xe,
|
|
4491
|
+
closePageNotice: Ze,
|
|
4492
|
+
hostConfirmation: A,
|
|
4493
|
+
respondHostConfirmation: ot,
|
|
4494
|
+
pageAccessAvailable: qe,
|
|
4495
|
+
pageAccessOff: Ge,
|
|
4496
|
+
setPageAccessOff: vt,
|
|
4497
|
+
pagePointer: Pe,
|
|
4498
|
+
pagePointerStart: w,
|
|
4499
|
+
pagePointing: Fe,
|
|
4500
|
+
pagePointerAvailable: Je,
|
|
4501
|
+
systemTheme: ze,
|
|
4502
|
+
hideWelcomeMessage: Be,
|
|
4503
|
+
isDark: He,
|
|
4504
|
+
chat: I,
|
|
4505
|
+
messages: Nt,
|
|
4497
4506
|
conversations: R,
|
|
4498
|
-
isLoadingConversations:
|
|
4499
|
-
hasMoreConversations:
|
|
4500
|
-
isLoadingMoreConversations:
|
|
4507
|
+
isLoadingConversations: Pt,
|
|
4508
|
+
hasMoreConversations: It,
|
|
4509
|
+
isLoadingMoreConversations: z,
|
|
4501
4510
|
chatFiles: V,
|
|
4502
|
-
isLoadingChatFiles:
|
|
4503
|
-
input:
|
|
4504
|
-
pendingAttachments:
|
|
4505
|
-
isAttachmentLimitReached:
|
|
4506
|
-
fileLimitError:
|
|
4511
|
+
isLoadingChatFiles: Lt,
|
|
4512
|
+
input: H,
|
|
4513
|
+
pendingAttachments: U,
|
|
4514
|
+
isAttachmentLimitReached: Yn,
|
|
4515
|
+
fileLimitError: Xn,
|
|
4507
4516
|
localChatId: E,
|
|
4508
|
-
isConversationBlocked:
|
|
4509
|
-
inputMessagePlaceholder:
|
|
4510
|
-
chatError:
|
|
4511
|
-
runningChatIds:
|
|
4512
|
-
backgroundAnswers:
|
|
4513
|
-
openBackgroundAnswer:
|
|
4514
|
-
dismissBackgroundAnswer:
|
|
4515
|
-
canQueue:
|
|
4516
|
-
queuedMessages:
|
|
4517
|
-
removeQueuedMessage:
|
|
4518
|
-
editQueuedMessage:
|
|
4519
|
-
activeView:
|
|
4520
|
-
inputFocusRequest:
|
|
4521
|
-
messageFeedbacks:
|
|
4522
|
-
feedbackDialogMessage:
|
|
4523
|
-
isFeedbackSubmitting:
|
|
4524
|
-
isFeedbackSubmitted:
|
|
4525
|
-
feedbackSubmitError:
|
|
4526
|
-
isLeadSubmitted:
|
|
4527
|
-
isLoadingSubmitLead:
|
|
4528
|
-
submitLeadError:
|
|
4529
|
-
buildDeviceContext:
|
|
4530
|
-
initialize:
|
|
4531
|
-
loadConversations:
|
|
4532
|
-
loadMoreConversations:
|
|
4533
|
-
searchConversations:
|
|
4534
|
-
loadChatFiles:
|
|
4535
|
-
refreshMessages:
|
|
4536
|
-
appendMessage:
|
|
4537
|
-
getChatFileUrl:
|
|
4538
|
-
getChatFilePreviewUrl:
|
|
4539
|
-
deleteChatFile:
|
|
4540
|
-
handleSubmit:
|
|
4541
|
-
sendMessage:
|
|
4542
|
-
stopGeneration:
|
|
4543
|
-
startNewChat:
|
|
4544
|
-
regenerate:
|
|
4545
|
-
addToolOutput:
|
|
4546
|
-
addToolApprovalResponse:
|
|
4547
|
-
handleFileSelect:
|
|
4548
|
-
clearFileLimitError:
|
|
4549
|
-
clearPendingAttachments:
|
|
4550
|
-
onUpvote:
|
|
4551
|
-
onDownvote:
|
|
4552
|
-
onFeedback:
|
|
4553
|
-
onFeedbackSubmit:
|
|
4554
|
-
onLeadSubmit:
|
|
4555
|
-
navigate:
|
|
4556
|
-
focusInput:
|
|
4557
|
-
renameChatTitle:
|
|
4558
|
-
deleteChat:
|
|
4517
|
+
isConversationBlocked: Qe,
|
|
4518
|
+
inputMessagePlaceholder: L,
|
|
4519
|
+
chatError: O,
|
|
4520
|
+
runningChatIds: Y,
|
|
4521
|
+
backgroundAnswers: Ln,
|
|
4522
|
+
openBackgroundAnswer: Rn,
|
|
4523
|
+
dismissBackgroundAnswer: zn,
|
|
4524
|
+
canQueue: Qt,
|
|
4525
|
+
queuedMessages: Zt,
|
|
4526
|
+
removeQueuedMessage: nn,
|
|
4527
|
+
editQueuedMessage: G,
|
|
4528
|
+
activeView: Rt,
|
|
4529
|
+
inputFocusRequest: zt,
|
|
4530
|
+
messageFeedbacks: Bt,
|
|
4531
|
+
feedbackDialogMessage: Vt,
|
|
4532
|
+
isFeedbackSubmitting: Ht,
|
|
4533
|
+
isFeedbackSubmitted: Ut,
|
|
4534
|
+
feedbackSubmitError: Wt,
|
|
4535
|
+
isLeadSubmitted: Gt,
|
|
4536
|
+
isLoadingSubmitLead: Kt,
|
|
4537
|
+
submitLeadError: qt,
|
|
4538
|
+
buildDeviceContext: rt,
|
|
4539
|
+
initialize: En,
|
|
4540
|
+
loadConversations: rn,
|
|
4541
|
+
loadMoreConversations: an,
|
|
4542
|
+
searchConversations: on,
|
|
4543
|
+
loadChatFiles: sn,
|
|
4544
|
+
refreshMessages: xn,
|
|
4545
|
+
appendMessage: Sn,
|
|
4546
|
+
getChatFileUrl: cn,
|
|
4547
|
+
getChatFilePreviewUrl: ln,
|
|
4548
|
+
deleteChatFile: un,
|
|
4549
|
+
handleSubmit: Dn,
|
|
4550
|
+
sendMessage: kn,
|
|
4551
|
+
stopGeneration: An,
|
|
4552
|
+
startNewChat: Vn,
|
|
4553
|
+
regenerate: Hn,
|
|
4554
|
+
addToolOutput: Un,
|
|
4555
|
+
addToolApprovalResponse: Wn,
|
|
4556
|
+
handleFileSelect: Qn,
|
|
4557
|
+
clearFileLimitError: Zn,
|
|
4558
|
+
clearPendingAttachments: Bn,
|
|
4559
|
+
onUpvote: er,
|
|
4560
|
+
onDownvote: tr,
|
|
4561
|
+
onFeedback: nr,
|
|
4562
|
+
onFeedbackSubmit: rr,
|
|
4563
|
+
onLeadSubmit: Q,
|
|
4564
|
+
navigate: or,
|
|
4565
|
+
focusInput: sr,
|
|
4566
|
+
renameChatTitle: ir,
|
|
4567
|
+
deleteChat: ar
|
|
4559
4568
|
};
|
|
4560
4569
|
})();
|
|
4561
4570
|
}
|
|
4562
4571
|
export { ft as a, hr as i, di as n, Gr as r, Kr as t };
|
|
4563
4572
|
|
|
4564
|
-
//# sourceMappingURL=useChatbotStore-
|
|
4573
|
+
//# sourceMappingURL=useChatbotStore-C1lW6qXE.js.map
|