@8wave/ai-elements 0.121.0-beta.35 → 0.121.0-beta.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{Agent-BPIcUM9P.js → Agent-C3m0UmlL.js} +21 -3
- package/dist/_chunks/Agent-C3m0UmlL.js.map +1 -0
- package/dist/_chunks/{PkStreamingMarkdown-C8_9bk_Y.js → PkStreamingMarkdown--PCkA4Fg.js} +3 -3
- package/dist/_chunks/{PkStreamingMarkdown-C8_9bk_Y.js.map → PkStreamingMarkdown--PCkA4Fg.js.map} +1 -1
- package/dist/_chunks/{PkToolEditSpreadsheet-DM5BCKd2.js → PkToolEditSpreadsheet-DAMWWIVt.js} +2 -2
- package/dist/_chunks/{PkToolEditSpreadsheet-DM5BCKd2.js.map → PkToolEditSpreadsheet-DAMWWIVt.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestGeolocation-DnZFIG1Q.js → PkToolRequestGeolocation-BgsvQb7Q.js} +2 -2
- package/dist/_chunks/{PkToolRequestGeolocation-DnZFIG1Q.js.map → PkToolRequestGeolocation-BgsvQb7Q.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestOAuthConnection-9LX5kQ43.js → PkToolRequestOAuthConnection-DtuZw7yk.js} +2 -2
- package/dist/_chunks/{PkToolRequestOAuthConnection-9LX5kQ43.js.map → PkToolRequestOAuthConnection-DtuZw7yk.js.map} +1 -1
- package/dist/_chunks/{PkToolShowArtifact-2ovT7cCd.js → PkToolShowArtifact-B163OvqY.js} +2 -2
- package/dist/_chunks/{PkToolShowArtifact-2ovT7cCd.js.map → PkToolShowArtifact-B163OvqY.js.map} +1 -1
- package/dist/_chunks/{PkToolShowContactForm-Bkoa-XYM.js → PkToolShowContactForm-C_ptr7Xs.js} +2 -2
- package/dist/_chunks/{PkToolShowContactForm-Bkoa-XYM.js.map → PkToolShowContactForm-C_ptr7Xs.js.map} +1 -1
- package/dist/_chunks/{PkToolShowForm-CvAgDlx8.js → PkToolShowForm-fburTpQm.js} +3 -3
- package/dist/_chunks/{PkToolShowForm-CvAgDlx8.js.map → PkToolShowForm-fburTpQm.js.map} +1 -1
- package/dist/_chunks/{PkToolShowImageGallery-CjA-r8o5.js → PkToolShowImageGallery-ChauJukk.js} +2 -2
- package/dist/_chunks/{PkToolShowImageGallery-CjA-r8o5.js.map → PkToolShowImageGallery-ChauJukk.js.map} +1 -1
- package/dist/_chunks/{PkToolShowProductList-DGPs57sX.js → PkToolShowProductList-B_XZezYw.js} +2 -2
- package/dist/_chunks/{PkToolShowProductList-DGPs57sX.js.map → PkToolShowProductList-B_XZezYw.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSources-BVuYkrXs.js → PkToolShowSources-CS4nEuL0.js} +3 -3
- package/dist/_chunks/{PkToolShowSources-BVuYkrXs.js.map → PkToolShowSources-CS4nEuL0.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSuggestedReply-B869o1YP.js → PkToolShowSuggestedReply-BIe56XdA.js} +2 -2
- package/dist/_chunks/{PkToolShowSuggestedReply-B869o1YP.js.map → PkToolShowSuggestedReply-BIe56XdA.js.map} +1 -1
- package/dist/_chunks/{PkToolShowVideo-DayRkHzW.js → PkToolShowVideo-DzU1XJqv.js} +2 -2
- package/dist/_chunks/{PkToolShowVideo-DayRkHzW.js.map → PkToolShowVideo-DzU1XJqv.js.map} +1 -1
- package/dist/_chunks/{PkToolShowWebPages-DTwnqmP-.js → PkToolShowWebPages-BlKe8Arf.js} +2 -2
- package/dist/_chunks/{PkToolShowWebPages-DTwnqmP-.js.map → PkToolShowWebPages-BlKe8Arf.js.map} +1 -1
- package/dist/_chunks/{chatImagePolicy-IKP98mdB.js → chatImagePolicy-ChSkpiw6.js} +2 -2
- package/dist/_chunks/{chatImagePolicy-IKP98mdB.js.map → chatImagePolicy-ChSkpiw6.js.map} +1 -1
- package/dist/_chunks/{markdown-D7lXKAr4.js → markdown-D3iMlF6T.js} +2 -2
- package/dist/_chunks/{markdown-D7lXKAr4.js.map → markdown-D3iMlF6T.js.map} +1 -1
- package/dist/ai-elements.es.js +76 -34
- 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-D70vAgX4.js → Agent-3IHYHv05.js} +153 -137
- package/dist-vue/_chunks/Agent-3IHYHv05.js.map +1 -0
- package/dist-vue/_chunks/{Document-Bo4xInDb.js → Document-B0A_y6N5.js} +10 -10
- package/dist-vue/_chunks/{Document-Bo4xInDb.js.map → Document-B0A_y6N5.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbot-65tNfhpY.js → PkChatbot-Bu76hH4F.js} +8 -8
- package/dist-vue/_chunks/{PkChatbot-65tNfhpY.js.map → PkChatbot-Bu76hH4F.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotEmptyState-CcRoSIb7.js → PkChatbotEmptyState-ilPJoYjk.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotEmptyState-CcRoSIb7.js.map → PkChatbotEmptyState-ilPJoYjk.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotInput-BeXWvNLw.js → PkChatbotInput-CY0YRGkG.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotInput-BeXWvNLw.js.map → PkChatbotInput-CY0YRGkG.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotMessages-BGOyBww5.js → PkChatbotMessages-BfKqJ8n_.js} +20 -20
- package/dist-vue/_chunks/{PkChatbotMessages-BGOyBww5.js.map → PkChatbotMessages-BfKqJ8n_.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepPayload-DsqiKy3M.js → PkChatbotStepPayload-CiEcIlzW.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotStepPayload-DsqiKy3M.js.map → PkChatbotStepPayload-CiEcIlzW.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-Bg4IBzGh.js → PkChatbotStepToolDetail-VqLkuWi7.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-Bg4IBzGh.js.map → PkChatbotStepToolDetail-VqLkuWi7.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotSteps-DfeBzC1S.js → PkChatbotSteps-CoDtEaL7.js} +5 -5
- package/dist-vue/_chunks/{PkChatbotSteps-DfeBzC1S.js.map → PkChatbotSteps-CoDtEaL7.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewChat-Cj3MKRFE.js → PkChatbotViewChat-t-XkwFbe.js} +7 -7
- package/dist-vue/_chunks/{PkChatbotViewChat-Cj3MKRFE.js.map → PkChatbotViewChat-t-XkwFbe.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewConversations-GqapFcx3.js → PkChatbotViewConversations-CgRMohUQ.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewConversations-GqapFcx3.js.map → PkChatbotViewConversations-CgRMohUQ.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewFiles-B-P6z7eN.js → PkChatbotViewFiles-DkeysDGW.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewFiles-B-P6z7eN.js.map → PkChatbotViewFiles-DkeysDGW.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewProfile-Bbu10IMd.js → PkChatbotViewProfile-kgqu10ED.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewProfile-Bbu10IMd.js.map → PkChatbotViewProfile-kgqu10ED.js.map} +1 -1
- package/dist-vue/_chunks/{PkStreamingMarkdown-BFrymqYD.js → PkStreamingMarkdown-CDlpb5w0.js} +3 -3
- package/dist-vue/_chunks/{PkStreamingMarkdown-BFrymqYD.js.map → PkStreamingMarkdown-CDlpb5w0.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolEditSpreadsheet-CfNQMSWR.js → PkToolEditSpreadsheet-D0EPgCmp.js} +2 -2
- package/dist-vue/_chunks/{PkToolEditSpreadsheet-CfNQMSWR.js.map → PkToolEditSpreadsheet-D0EPgCmp.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolRequestGeolocation-DvO0z7sQ.js → PkToolRequestGeolocation-DZnJd1od.js} +2 -2
- package/dist-vue/_chunks/{PkToolRequestGeolocation-DvO0z7sQ.js.map → PkToolRequestGeolocation-DZnJd1od.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolRequestOAuthConnection-CTqtzwJm.js → PkToolRequestOAuthConnection-C8MGtBlh.js} +2 -2
- package/dist-vue/_chunks/{PkToolRequestOAuthConnection-CTqtzwJm.js.map → PkToolRequestOAuthConnection-C8MGtBlh.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowArtifact-BKZKi6J4.js → PkToolShowArtifact-CtXB1-vJ.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowArtifact-BKZKi6J4.js.map → PkToolShowArtifact-CtXB1-vJ.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowContactForm-CWpQaNOh.js → PkToolShowContactForm-DlZdfcNw.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowContactForm-CWpQaNOh.js.map → PkToolShowContactForm-DlZdfcNw.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowDiagram-DElkZZVV.js → PkToolShowDiagram-BUUjmUpE.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowDiagram-DElkZZVV.js.map → PkToolShowDiagram-BUUjmUpE.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowForm-BnM1fsi4.js → PkToolShowForm-DxiiMSCC.js} +4 -4
- package/dist-vue/_chunks/{PkToolShowForm-BnM1fsi4.js.map → PkToolShowForm-DxiiMSCC.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowImageGallery-CzcPqcoS.js → PkToolShowImageGallery-D01aM-9U.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowImageGallery-CzcPqcoS.js.map → PkToolShowImageGallery-D01aM-9U.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowProductList-Cpf5SLLk.js → PkToolShowProductList-BRMF3WJf.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowProductList-Cpf5SLLk.js.map → PkToolShowProductList-BRMF3WJf.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSources-E7BcGvof.js → PkToolShowSources-C0_MwX7m.js} +3 -3
- package/dist-vue/_chunks/{PkToolShowSources-E7BcGvof.js.map → PkToolShowSources-C0_MwX7m.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSuggestedReply-JTMiOpHZ.js → PkToolShowSuggestedReply-BcjKYwbk.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowSuggestedReply-JTMiOpHZ.js.map → PkToolShowSuggestedReply-BcjKYwbk.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowVideo-DFdmzUkS.js → PkToolShowVideo-CjjoQH7j.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowVideo-DFdmzUkS.js.map → PkToolShowVideo-CjjoQH7j.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowWebPages-CG_Mq77j.js → PkToolShowWebPages-B5reGh4g.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowWebPages-CG_Mq77j.js.map → PkToolShowWebPages-B5reGh4g.js.map} +1 -1
- package/dist-vue/_chunks/{createChatbotApiClient-BTrOwIYi.js → createChatbotApiClient-DcLpptlt.js} +18 -18
- package/dist-vue/_chunks/{createChatbotApiClient-BTrOwIYi.js.map → createChatbotApiClient-DcLpptlt.js.map} +1 -1
- package/dist-vue/_chunks/{useChatbotStore-KjeThRAo.js → useChatbotStore-BliRphuB.js} +1012 -1012
- package/dist-vue/_chunks/{useChatbotStore-KjeThRAo.js.map → useChatbotStore-BliRphuB.js.map} +1 -1
- package/dist-vue/_chunks/{utils-Bf29zWlC.js → utils-C7-KrzRE.js} +7 -7
- package/dist-vue/_chunks/{utils-Bf29zWlC.js.map → utils-C7-KrzRE.js.map} +1 -1
- package/dist-vue/api.js +1 -1
- package/dist-vue/composables.js +64 -22
- package/dist-vue/composables.js.map +1 -1
- package/dist-vue/index.js +5293 -5288
- package/dist-vue/index.js.map +1 -1
- package/dist-vue/locales.js +4 -12
- package/dist-vue/packages/components/src/agentGlyphs.d.ts +5 -4
- package/dist-vue/packages/components/src/chat/PkAgentSettingsPanel.d.ts +10 -2
- package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +1 -1
- package/dist-vue/packages/models/src/schema/Agent.d.ts +58 -6
- package/dist-vue/packages/models/src/schema/Chat.d.ts +1 -1
- package/dist-vue/packages/models/src/schema/Invitation.d.ts +1 -1
- package/dist-vue/packages/models/src/schema/Lead.d.ts +5 -5
- package/dist-vue/packages/models/src/schema/Member.d.ts +4 -1
- package/dist-vue/packages/models/src/schema/SignInSecurity.d.ts +1 -1
- package/package.json +1 -1
- package/dist/_chunks/Agent-BPIcUM9P.js.map +0 -1
- package/dist-vue/_chunks/Agent-D70vAgX4.js.map +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { C as e, D as t, O as n, S as r, _ as i, a, g as o, h as s, i as c, l, m as u, o as d, p as f, r as p, s as m, u as h, v as g, w as _, x as v } from "./schemas-Bu1lick6.js";
|
|
2
|
-
import {
|
|
3
|
-
import { r as
|
|
4
|
-
import { n as
|
|
5
|
-
import { d as
|
|
6
|
-
import { n as
|
|
7
|
-
import { computed as
|
|
8
|
-
import { useI18n as
|
|
9
|
-
import { usePreferredDark as
|
|
10
|
-
import { defineStore as
|
|
2
|
+
import { G as ee, J as y, L as te, U as ne, V as re, X as ie, Y as ae, q as oe } from "./Agent-3IHYHv05.js";
|
|
3
|
+
import { r as se, t as ce } from "./createChatbotApiClient-DcLpptlt.js";
|
|
4
|
+
import { n as le } from "./src-BZRiAJsH.js";
|
|
5
|
+
import { d as ue, r as de } from "./message-DZvfzt9j.js";
|
|
6
|
+
import { n as fe, t as pe } from "./useSafeLocalStorage-C1BlCeKw.js";
|
|
7
|
+
import { computed as b, getCurrentScope as me, isReadonly as he, nextTick as ge, onScopeDispose as _e, reactive as ve, ref as x, shallowRef as S, toRefs as ye, toValue as be, watch as C, watchEffect as xe } from "vue";
|
|
8
|
+
import { useI18n as Se } from "vue-i18n";
|
|
9
|
+
import { usePreferredDark as Ce } from "@vueuse/core";
|
|
10
|
+
import { defineStore as we } from "pinia";
|
|
11
11
|
//#region ../../packages/utils/src/device-context.ts
|
|
12
|
-
function
|
|
12
|
+
function Te() {
|
|
13
13
|
let e = navigator.connection, t = navigator.userAgentData;
|
|
14
14
|
return {
|
|
15
15
|
dateTime: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -39,7 +39,7 @@ function we() {
|
|
|
39
39
|
historyLength: window.history.length
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
async function
|
|
42
|
+
async function Ee(e) {
|
|
43
43
|
if (!navigator.geolocation || !navigator.permissions) return null;
|
|
44
44
|
try {
|
|
45
45
|
if ((await navigator.permissions.query({ name: "geolocation" })).state !== "granted") return null;
|
|
@@ -58,12 +58,12 @@ async function Te(e) {
|
|
|
58
58
|
}
|
|
59
59
|
//#endregion
|
|
60
60
|
//#region ../../packages/composable/src/chatbot/hostTools.ts
|
|
61
|
-
var
|
|
61
|
+
var De = "agentstudio:page-navigation", Oe = (e) => typeof e?.afterOutput == "function", ke = (e) => e.toolMetadata?.source === y, Ae = (e, t) => {
|
|
62
62
|
if (!t || !e?.length) return;
|
|
63
|
-
let n = new Set(t.allowed), r = e.filter((e) => n.has(e.name) && !
|
|
63
|
+
let n = new Set(t.allowed), r = e.filter((e) => n.has(e.name) && !ne(e.name)).map(({ execute: e, confirmation: t, policy: n, ...r }) => r);
|
|
64
64
|
return r.length > 0 ? r : void 0;
|
|
65
65
|
};
|
|
66
|
-
function
|
|
66
|
+
function je(e) {
|
|
67
67
|
let t = 0, n = 0, r = (t) => {
|
|
68
68
|
n = t, e.onPendingChange?.(n);
|
|
69
69
|
}, i = Promise.resolve(), a = /* @__PURE__ */ new Map(), o = (e, t) => t.requireConfirmation.includes(e.name) || t.confirmDestructive && e.annotations?.destructiveHint === !0, s = (t, n) => e.addToolOutput({
|
|
@@ -79,7 +79,7 @@ function Ae(e) {
|
|
|
79
79
|
async function l(n, r) {
|
|
80
80
|
let i = () => r === t, l = e.capability(), u = e.registry()?.find((e) => e.name === n.toolName), d = u?.policy?.timeoutMs ?? l?.timeoutMs;
|
|
81
81
|
if (!u || d === void 0) {
|
|
82
|
-
c(n,
|
|
82
|
+
c(n, ae(n.readOnly));
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
85
|
let f;
|
|
@@ -94,7 +94,7 @@ function Ae(e) {
|
|
|
94
94
|
let t = await e.confirm(n, f);
|
|
95
95
|
if (!i()) return;
|
|
96
96
|
if (!t) {
|
|
97
|
-
c(n,
|
|
97
|
+
c(n, oe);
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
100
|
}
|
|
@@ -110,13 +110,13 @@ function Ae(e) {
|
|
|
110
110
|
messageId: n.messageId
|
|
111
111
|
}), t]);
|
|
112
112
|
if (!i()) return;
|
|
113
|
-
|
|
113
|
+
Oe(r) ? (s(n, r.result ?? null), e.waitForResume().then((e) => {
|
|
114
114
|
e && i() && r.afterOutput();
|
|
115
115
|
})) : s(n, r ?? null);
|
|
116
116
|
} catch (e) {
|
|
117
117
|
if (!i()) return;
|
|
118
118
|
let t = m.signal.aborted;
|
|
119
|
-
c(n, t ?
|
|
119
|
+
c(n, t ? ae(n.readOnly) : e instanceof Error && e.message ? e.message : "The host app failed to run this call.");
|
|
120
120
|
} finally {
|
|
121
121
|
clearTimeout(h), a.delete(n.toolCallId), e.onActivity?.(void 0);
|
|
122
122
|
}
|
|
@@ -137,65 +137,65 @@ function Ae(e) {
|
|
|
137
137
|
}
|
|
138
138
|
//#endregion
|
|
139
139
|
//#region ../../node_modules/.pnpm/@ai-sdk+provider@4.0.27/node_modules/@ai-sdk/provider/dist/index.js
|
|
140
|
-
var
|
|
140
|
+
var Me = "vercel.ai.error", Ne = Symbol.for(Me), w = class e extends Error {
|
|
141
141
|
constructor({ name: e, message: t, cause: n }) {
|
|
142
|
-
super(t), this[
|
|
142
|
+
super(t), this[Ne] = !0, this.name = e, this.cause = n;
|
|
143
143
|
}
|
|
144
144
|
static isInstance(t) {
|
|
145
|
-
return e.hasMarker(t,
|
|
145
|
+
return e.hasMarker(t, Me);
|
|
146
146
|
}
|
|
147
147
|
static hasMarker(e, t) {
|
|
148
148
|
let n = Symbol.for(t);
|
|
149
149
|
return typeof e == "object" && !!e && n in e && typeof e[n] == "boolean" && e[n] === !0;
|
|
150
150
|
}
|
|
151
|
-
},
|
|
151
|
+
}, Pe = "AI_APICallError", T = `vercel.ai.error.${Pe}`, Fe = Symbol.for(T), Ie = class extends w {
|
|
152
152
|
constructor({ message: e, url: t, requestBodyValues: n, statusCode: r, responseHeaders: i, responseBody: a, cause: o, isRetryable: s = r != null && (r === 408 || r === 409 || r === 429 || r >= 500), data: c }) {
|
|
153
153
|
super({
|
|
154
|
-
name:
|
|
154
|
+
name: Pe,
|
|
155
155
|
message: e,
|
|
156
156
|
cause: o
|
|
157
|
-
}), this[
|
|
157
|
+
}), this[Fe] = !0, this.url = t, this.requestBodyValues = n, this.statusCode = r, this.responseHeaders = i, this.responseBody = a, this.isRetryable = s, this.data = c;
|
|
158
158
|
}
|
|
159
159
|
static isInstance(e) {
|
|
160
|
-
return
|
|
160
|
+
return w.hasMarker(e, T);
|
|
161
161
|
}
|
|
162
|
-
},
|
|
162
|
+
}, E = "AI_EmptyResponseBodyError", D = `vercel.ai.error.${E}`, Le = Symbol.for(D), Re = class extends w {
|
|
163
163
|
constructor({ message: e = "Empty response body" } = {}) {
|
|
164
164
|
super({
|
|
165
|
-
name:
|
|
165
|
+
name: E,
|
|
166
166
|
message: e
|
|
167
|
-
}), this[
|
|
167
|
+
}), this[Le] = !0;
|
|
168
168
|
}
|
|
169
169
|
static isInstance(e) {
|
|
170
|
-
return
|
|
170
|
+
return w.hasMarker(e, D);
|
|
171
171
|
}
|
|
172
172
|
};
|
|
173
|
-
function
|
|
173
|
+
function ze(e) {
|
|
174
174
|
return e == null ? "unknown error" : typeof e == "string" ? e : e instanceof Error ? e.toString() : JSON.stringify(e);
|
|
175
175
|
}
|
|
176
|
-
var
|
|
176
|
+
var Be = "AI_InvalidArgumentError", Ve = `vercel.ai.error.${Be}`, He = Symbol.for(Ve), Ue = class extends w {
|
|
177
177
|
constructor({ message: e, cause: t, argument: n }) {
|
|
178
178
|
super({
|
|
179
|
-
name:
|
|
179
|
+
name: Be,
|
|
180
180
|
message: e,
|
|
181
181
|
cause: t
|
|
182
|
-
}), this[
|
|
182
|
+
}), this[He] = !0, this.argument = n;
|
|
183
183
|
}
|
|
184
184
|
static isInstance(e) {
|
|
185
|
-
return
|
|
185
|
+
return w.hasMarker(e, Ve);
|
|
186
186
|
}
|
|
187
|
-
},
|
|
187
|
+
}, We = "AI_JSONParseError", Ge = `vercel.ai.error.${We}`, Ke = Symbol.for(Ge), qe = class extends w {
|
|
188
188
|
constructor({ text: e, cause: t }) {
|
|
189
189
|
super({
|
|
190
|
-
name:
|
|
191
|
-
message: `JSON parsing failed: Text: ${e}.\nError message: ${
|
|
190
|
+
name: We,
|
|
191
|
+
message: `JSON parsing failed: Text: ${e}.\nError message: ${ze(t)}`,
|
|
192
192
|
cause: t
|
|
193
|
-
}), this[
|
|
193
|
+
}), this[Ke] = !0, this.text = e;
|
|
194
194
|
}
|
|
195
195
|
static isInstance(e) {
|
|
196
|
-
return
|
|
196
|
+
return w.hasMarker(e, Ge);
|
|
197
197
|
}
|
|
198
|
-
},
|
|
198
|
+
}, O = "AI_TypeValidationError", Je = `vercel.ai.error.${O}`, Ye = Symbol.for(Je), Xe = class e extends w {
|
|
199
199
|
constructor({ value: e, cause: t, context: n }) {
|
|
200
200
|
let r = "Type validation failed";
|
|
201
201
|
if (n?.field && (r += ` for ${n.field}`), n?.entityName || n?.entityId) {
|
|
@@ -204,13 +204,13 @@ var ze = "AI_InvalidArgumentError", Be = `vercel.ai.error.${ze}`, Ve = Symbol.fo
|
|
|
204
204
|
n.entityName && e.push(n.entityName), n.entityId && e.push(`id: "${n.entityId}"`), r += e.join(", "), r += ")";
|
|
205
205
|
}
|
|
206
206
|
super({
|
|
207
|
-
name:
|
|
208
|
-
message: `${r}: Value: ${JSON.stringify(e)}.\nError message: ${
|
|
207
|
+
name: O,
|
|
208
|
+
message: `${r}: Value: ${JSON.stringify(e)}.\nError message: ${ze(t)}`,
|
|
209
209
|
cause: t
|
|
210
|
-
}), this[
|
|
210
|
+
}), this[Ye] = !0, this.value = e, this.context = n;
|
|
211
211
|
}
|
|
212
212
|
static isInstance(e) {
|
|
213
|
-
return
|
|
213
|
+
return w.hasMarker(e, Je);
|
|
214
214
|
}
|
|
215
215
|
static wrap({ value: t, cause: n, context: r }) {
|
|
216
216
|
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({
|
|
@@ -219,25 +219,25 @@ var ze = "AI_InvalidArgumentError", Be = `vercel.ai.error.${ze}`, Ve = Symbol.fo
|
|
|
219
219
|
context: r
|
|
220
220
|
});
|
|
221
221
|
}
|
|
222
|
-
},
|
|
222
|
+
}, k = "AI_UnsupportedFunctionalityError", Ze = `vercel.ai.error.${k}`, Qe = Symbol.for(Ze), $e = class extends w {
|
|
223
223
|
constructor({ functionality: e, message: t = `'${e}' functionality not supported.` }) {
|
|
224
224
|
super({
|
|
225
|
-
name:
|
|
225
|
+
name: k,
|
|
226
226
|
message: t
|
|
227
|
-
}), this[
|
|
227
|
+
}), this[Qe] = !0, this.functionality = e;
|
|
228
228
|
}
|
|
229
229
|
static isInstance(e) {
|
|
230
|
-
return
|
|
230
|
+
return w.hasMarker(e, Ze);
|
|
231
231
|
}
|
|
232
|
-
},
|
|
232
|
+
}, et = class extends Error {
|
|
233
233
|
constructor(e, t) {
|
|
234
234
|
super(e), this.name = "ParseError", this.type = t.type, this.field = t.field, this.value = t.value, this.line = t.line;
|
|
235
235
|
}
|
|
236
|
-
},
|
|
237
|
-
function
|
|
238
|
-
function
|
|
236
|
+
}, A = 10, tt = 13, j = 32;
|
|
237
|
+
function M(e) {}
|
|
238
|
+
function nt(e) {
|
|
239
239
|
if (typeof e == "function") throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");
|
|
240
|
-
let { onEvent: t =
|
|
240
|
+
let { onEvent: t = M, onError: n = M, onRetry: r = M, onComment: i, maxBufferSize: a } = e, o = [], s = 0, c = !0, l, u = "", d = 0, f, p = !1;
|
|
241
241
|
function m(e) {
|
|
242
242
|
if (p) throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");
|
|
243
243
|
if (c && (c = !1, e.charCodeAt(0) === 239 && e.charCodeAt(1) === 187 && e.charCodeAt(2) === 191 && (e = e.slice(3))), o.length === 0) {
|
|
@@ -256,7 +256,7 @@ function tt(e) {
|
|
|
256
256
|
n !== "" && (o.push(n), s = n.length), h();
|
|
257
257
|
}
|
|
258
258
|
function h() {
|
|
259
|
-
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
|
|
259
|
+
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 et(`Buffered data exceeded max buffer size of ${a} characters`, { type: "max-buffer-size-exceeded" }))));
|
|
260
260
|
}
|
|
261
261
|
function g(e) {
|
|
262
262
|
let n = 0;
|
|
@@ -272,9 +272,9 @@ function tt(e) {
|
|
|
272
272
|
continue;
|
|
273
273
|
}
|
|
274
274
|
let i = e.charCodeAt(n);
|
|
275
|
-
if (
|
|
276
|
-
let i = e.charCodeAt(n + 5) ===
|
|
277
|
-
if (d === 0 && e.charCodeAt(r + 1) ===
|
|
275
|
+
if (N(e, n, i)) {
|
|
276
|
+
let i = e.charCodeAt(n + 5) === j ? n + 6 : n + 5, a = e.slice(i, r);
|
|
277
|
+
if (d === 0 && e.charCodeAt(r + 1) === A) {
|
|
278
278
|
t({
|
|
279
279
|
id: l,
|
|
280
280
|
event: f,
|
|
@@ -284,7 +284,7 @@ function tt(e) {
|
|
|
284
284
|
}
|
|
285
285
|
u = d === 0 ? a : `${u}
|
|
286
286
|
${a}`, d++;
|
|
287
|
-
} else
|
|
287
|
+
} else rt(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) === j ? n + 7 : n + 6, r) || void 0 : _(e, n, r);
|
|
288
288
|
n = r + 1, r = e.indexOf("\n", n);
|
|
289
289
|
}
|
|
290
290
|
return e.slice(n);
|
|
@@ -292,35 +292,35 @@ ${a}`, d++;
|
|
|
292
292
|
for (; n < e.length;) {
|
|
293
293
|
let t = e.indexOf("\r", n), r = e.indexOf("\n", n), i = -1;
|
|
294
294
|
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;
|
|
295
|
-
_(e, n, i), n = i + 1, e.charCodeAt(n - 1) ===
|
|
295
|
+
_(e, n, i), n = i + 1, e.charCodeAt(n - 1) === tt && e.charCodeAt(n) === A && n++;
|
|
296
296
|
}
|
|
297
297
|
return e.slice(n);
|
|
298
298
|
}
|
|
299
299
|
function _(e, t, n) {
|
|
300
300
|
if (t === n) {
|
|
301
|
-
|
|
301
|
+
ee();
|
|
302
302
|
return;
|
|
303
303
|
}
|
|
304
304
|
let r = e.charCodeAt(t);
|
|
305
|
-
if (
|
|
306
|
-
let r = e.charCodeAt(t + 5) ===
|
|
305
|
+
if (N(e, t, r)) {
|
|
306
|
+
let r = e.charCodeAt(t + 5) === j ? t + 6 : t + 5, i = e.slice(r, n);
|
|
307
307
|
u = d === 0 ? i : `${u}
|
|
308
308
|
${i}`, d++;
|
|
309
309
|
return;
|
|
310
310
|
}
|
|
311
|
-
if (
|
|
312
|
-
f = e.slice(e.charCodeAt(t + 6) ===
|
|
311
|
+
if (rt(e, t, r)) {
|
|
312
|
+
f = e.slice(e.charCodeAt(t + 6) === j ? t + 7 : t + 6, n) || void 0;
|
|
313
313
|
return;
|
|
314
314
|
}
|
|
315
315
|
if (r === 105 && e.charCodeAt(t + 1) === 100 && e.charCodeAt(t + 2) === 58) {
|
|
316
|
-
let r = e.slice(e.charCodeAt(t + 3) ===
|
|
316
|
+
let r = e.slice(e.charCodeAt(t + 3) === j ? t + 4 : t + 3, n);
|
|
317
317
|
l = r.includes("\0") ? void 0 : r;
|
|
318
318
|
return;
|
|
319
319
|
}
|
|
320
320
|
if (r === 58) {
|
|
321
321
|
if (i) {
|
|
322
322
|
let r = e.slice(t, n);
|
|
323
|
-
i(r.slice(e.charCodeAt(t + 1) ===
|
|
323
|
+
i(r.slice(e.charCodeAt(t + 1) === j ? 2 : 1));
|
|
324
324
|
}
|
|
325
325
|
return;
|
|
326
326
|
}
|
|
@@ -329,7 +329,7 @@ ${i}`, d++;
|
|
|
329
329
|
v(a, "", a);
|
|
330
330
|
return;
|
|
331
331
|
}
|
|
332
|
-
let s = a.slice(0, o), c = a.charCodeAt(o + 1) ===
|
|
332
|
+
let s = a.slice(0, o), c = a.charCodeAt(o + 1) === j ? 2 : 1;
|
|
333
333
|
v(s, a.slice(o + c), a);
|
|
334
334
|
}
|
|
335
335
|
function v(e, t, i) {
|
|
@@ -345,13 +345,13 @@ ${t}`, d++;
|
|
|
345
345
|
l = t.includes("\0") ? void 0 : t;
|
|
346
346
|
break;
|
|
347
347
|
case "retry":
|
|
348
|
-
/^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new
|
|
348
|
+
/^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new et(`Invalid \`retry\` value: "${t}"`, {
|
|
349
349
|
type: "invalid-retry",
|
|
350
350
|
value: t,
|
|
351
351
|
line: i
|
|
352
352
|
}));
|
|
353
353
|
break;
|
|
354
|
-
default: n(new
|
|
354
|
+
default: n(new et(`Unknown field "${e.length > 20 ? `${e.slice(0, 20)}\u2026` : e}"`, {
|
|
355
355
|
type: "unknown-field",
|
|
356
356
|
field: e,
|
|
357
357
|
value: t,
|
|
@@ -359,14 +359,14 @@ ${t}`, d++;
|
|
|
359
359
|
}));
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
|
-
function
|
|
362
|
+
function ee() {
|
|
363
363
|
d > 0 && t({
|
|
364
364
|
id: l,
|
|
365
365
|
event: f,
|
|
366
366
|
data: u
|
|
367
367
|
}), l = void 0, u = "", d = 0, f = void 0;
|
|
368
368
|
}
|
|
369
|
-
function
|
|
369
|
+
function y(e = {}) {
|
|
370
370
|
if (e.consume && o.length > 0) {
|
|
371
371
|
let e = o.join("");
|
|
372
372
|
_(e, 0, e.length);
|
|
@@ -375,23 +375,23 @@ ${t}`, d++;
|
|
|
375
375
|
}
|
|
376
376
|
return {
|
|
377
377
|
feed: m,
|
|
378
|
-
reset:
|
|
378
|
+
reset: y
|
|
379
379
|
};
|
|
380
380
|
}
|
|
381
|
-
function
|
|
381
|
+
function N(e, t, n) {
|
|
382
382
|
return n === 100 && e.charCodeAt(t + 1) === 97 && e.charCodeAt(t + 2) === 116 && e.charCodeAt(t + 3) === 97 && e.charCodeAt(t + 4) === 58;
|
|
383
383
|
}
|
|
384
|
-
function
|
|
384
|
+
function rt(e, t, n) {
|
|
385
385
|
return n === 101 && e.charCodeAt(t + 1) === 118 && e.charCodeAt(t + 2) === 101 && e.charCodeAt(t + 3) === 110 && e.charCodeAt(t + 4) === 116 && e.charCodeAt(t + 5) === 58;
|
|
386
386
|
}
|
|
387
387
|
//#endregion
|
|
388
388
|
//#region ../../node_modules/.pnpm/eventsource-parser@3.1.0/node_modules/eventsource-parser/dist/stream.js
|
|
389
|
-
var
|
|
389
|
+
var it = class extends TransformStream {
|
|
390
390
|
constructor({ onError: e, onRetry: t, onComment: n, maxBufferSize: r } = {}) {
|
|
391
391
|
let i;
|
|
392
392
|
super({
|
|
393
393
|
start(a) {
|
|
394
|
-
i =
|
|
394
|
+
i = nt({
|
|
395
395
|
onEvent: (e) => {
|
|
396
396
|
a.enqueue(e);
|
|
397
397
|
},
|
|
@@ -410,8 +410,8 @@ var rt = class extends TransformStream {
|
|
|
410
410
|
}
|
|
411
411
|
};
|
|
412
412
|
new TextDecoder();
|
|
413
|
-
var { btoa:
|
|
414
|
-
function
|
|
413
|
+
var { btoa: at, atob: ot } = globalThis;
|
|
414
|
+
function P(e) {
|
|
415
415
|
if (e == null) return {};
|
|
416
416
|
let t = {};
|
|
417
417
|
if (e instanceof Headers) e.forEach((e, n) => {
|
|
@@ -423,28 +423,28 @@ function F(e) {
|
|
|
423
423
|
}
|
|
424
424
|
return t;
|
|
425
425
|
}
|
|
426
|
-
var
|
|
426
|
+
var F = ({ prefix: e, size: t = 16, alphabet: n = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", separator: r = "-" } = {}) => {
|
|
427
427
|
let i = () => {
|
|
428
428
|
let e = n.length, r = Array(t);
|
|
429
429
|
for (let i = 0; i < t; i++) r[i] = n[Math.random() * e | 0];
|
|
430
430
|
return r.join("");
|
|
431
431
|
};
|
|
432
432
|
if (e == null) return i;
|
|
433
|
-
if (n.includes(r)) throw new
|
|
433
|
+
if (n.includes(r)) throw new Ue({
|
|
434
434
|
argument: "separator",
|
|
435
435
|
message: `The separator "${r}" must not be part of the alphabet "${n}".`
|
|
436
436
|
});
|
|
437
437
|
return () => `${e}${r}${i()}`;
|
|
438
|
-
},
|
|
439
|
-
function
|
|
438
|
+
}, st = F();
|
|
439
|
+
function I(e) {
|
|
440
440
|
return globalThis.Buffer?.isBuffer(e) ?? !1;
|
|
441
441
|
}
|
|
442
|
-
var
|
|
443
|
-
function
|
|
442
|
+
var ct = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/, L = /"(?: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*:/;
|
|
443
|
+
function lt(e) {
|
|
444
444
|
let t = JSON.parse(e);
|
|
445
|
-
return typeof t != "object" || !t ||
|
|
445
|
+
return typeof t != "object" || !t || ct.test(e) === !1 && L.test(e) === !1 ? t : ut(t);
|
|
446
446
|
}
|
|
447
|
-
function
|
|
447
|
+
function ut(e) {
|
|
448
448
|
let t = [e];
|
|
449
449
|
for (; t.length;) {
|
|
450
450
|
let e = t;
|
|
@@ -459,35 +459,35 @@ function ct(e) {
|
|
|
459
459
|
}
|
|
460
460
|
return e;
|
|
461
461
|
}
|
|
462
|
-
function
|
|
462
|
+
function R(e) {
|
|
463
463
|
let { stackTraceLimit: t } = Error;
|
|
464
464
|
try {
|
|
465
465
|
Error.stackTraceLimit = 0;
|
|
466
466
|
} catch {
|
|
467
|
-
return
|
|
467
|
+
return lt(e);
|
|
468
468
|
}
|
|
469
469
|
try {
|
|
470
|
-
return
|
|
470
|
+
return lt(e);
|
|
471
471
|
} finally {
|
|
472
472
|
Error.stackTraceLimit = t;
|
|
473
473
|
}
|
|
474
474
|
}
|
|
475
|
-
function
|
|
475
|
+
function z(e) {
|
|
476
476
|
if (e.type === "object" || Array.isArray(e.type) && e.type.includes("object")) {
|
|
477
477
|
let { additionalProperties: t } = e;
|
|
478
|
-
e.additionalProperties = t != null && typeof t != "boolean" &&
|
|
478
|
+
e.additionalProperties = t != null && typeof t != "boolean" && B(t);
|
|
479
479
|
let { properties: n } = e;
|
|
480
|
-
if (n != null) for (let e of Object.keys(n)) n[e] =
|
|
480
|
+
if (n != null) for (let e of Object.keys(n)) n[e] = B(n[e]);
|
|
481
481
|
}
|
|
482
|
-
e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(
|
|
482
|
+
e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(B) : B(e.items)), e.anyOf != null && (e.anyOf = e.anyOf.map(B)), e.allOf != null && (e.allOf = e.allOf.map(B)), e.oneOf != null && (e.oneOf = e.oneOf.map(B));
|
|
483
483
|
let { definitions: t } = e;
|
|
484
|
-
if (t != null) for (let e of Object.keys(t)) t[e] =
|
|
484
|
+
if (t != null) for (let e of Object.keys(t)) t[e] = B(t[e]);
|
|
485
485
|
return e;
|
|
486
486
|
}
|
|
487
|
-
function
|
|
488
|
-
return typeof e == "boolean" ? e :
|
|
487
|
+
function B(e) {
|
|
488
|
+
return typeof e == "boolean" ? e : z(e);
|
|
489
489
|
}
|
|
490
|
-
var
|
|
490
|
+
var dt = Symbol("Let zodToJsonSchema decide on which parser to use"), ft = {
|
|
491
491
|
name: void 0,
|
|
492
492
|
$refStrategy: "root",
|
|
493
493
|
basePath: ["#"],
|
|
@@ -507,24 +507,24 @@ var lt = Symbol("Let zodToJsonSchema decide on which parser to use"), ut = {
|
|
|
507
507
|
emailStrategy: "format:email",
|
|
508
508
|
base64Strategy: "contentEncoding:base64",
|
|
509
509
|
nameStrategy: "ref"
|
|
510
|
-
},
|
|
511
|
-
...
|
|
510
|
+
}, pt = (e) => typeof e == "string" ? {
|
|
511
|
+
...ft,
|
|
512
512
|
name: e
|
|
513
513
|
} : {
|
|
514
|
-
...
|
|
514
|
+
...ft,
|
|
515
515
|
...e
|
|
516
516
|
};
|
|
517
|
-
function
|
|
517
|
+
function V() {
|
|
518
518
|
return {};
|
|
519
519
|
}
|
|
520
|
-
function
|
|
520
|
+
function mt(e, t) {
|
|
521
521
|
let n = { type: "array" };
|
|
522
|
-
return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items =
|
|
522
|
+
return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = J(e.type._def, {
|
|
523
523
|
...t,
|
|
524
524
|
currentPath: [...t.currentPath, "items"]
|
|
525
525
|
})), 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;
|
|
526
526
|
}
|
|
527
|
-
function
|
|
527
|
+
function ht(e) {
|
|
528
528
|
let t = {
|
|
529
529
|
type: "integer",
|
|
530
530
|
format: "int64"
|
|
@@ -541,16 +541,16 @@ function pt(e) {
|
|
|
541
541
|
}
|
|
542
542
|
return t;
|
|
543
543
|
}
|
|
544
|
-
function
|
|
544
|
+
function H() {
|
|
545
545
|
return { type: "boolean" };
|
|
546
546
|
}
|
|
547
|
-
function
|
|
548
|
-
return
|
|
547
|
+
function U(e, t) {
|
|
548
|
+
return J(e.type._def, t);
|
|
549
549
|
}
|
|
550
|
-
var
|
|
551
|
-
function
|
|
550
|
+
var W = (e, t) => J(e.innerType._def, t);
|
|
551
|
+
function gt(e, t, n) {
|
|
552
552
|
let r = n ?? t.dateStrategy;
|
|
553
|
-
if (Array.isArray(r)) return { anyOf: r.map((n) =>
|
|
553
|
+
if (Array.isArray(r)) return { anyOf: r.map((n) => gt(e, t, n)) };
|
|
554
554
|
switch (r) {
|
|
555
555
|
case "string":
|
|
556
556
|
case "format:date-time": return {
|
|
@@ -561,10 +561,10 @@ function ht(e, t, n) {
|
|
|
561
561
|
type: "string",
|
|
562
562
|
format: "date"
|
|
563
563
|
};
|
|
564
|
-
case "integer": return
|
|
564
|
+
case "integer": return _t(e);
|
|
565
565
|
}
|
|
566
566
|
}
|
|
567
|
-
var
|
|
567
|
+
var _t = (e) => {
|
|
568
568
|
let t = {
|
|
569
569
|
type: "integer",
|
|
570
570
|
format: "unix-time"
|
|
@@ -577,31 +577,31 @@ var gt = (e) => {
|
|
|
577
577
|
}
|
|
578
578
|
return t;
|
|
579
579
|
};
|
|
580
|
-
function
|
|
580
|
+
function vt(e, t) {
|
|
581
581
|
return {
|
|
582
|
-
...
|
|
582
|
+
...J(e.innerType._def, t),
|
|
583
583
|
default: e.defaultValue()
|
|
584
584
|
};
|
|
585
585
|
}
|
|
586
|
-
function
|
|
587
|
-
return t.effectStrategy === "input" ?
|
|
586
|
+
function yt(e, t) {
|
|
587
|
+
return t.effectStrategy === "input" ? J(e.schema._def, t) : V();
|
|
588
588
|
}
|
|
589
|
-
function
|
|
589
|
+
function bt(e) {
|
|
590
590
|
return {
|
|
591
591
|
type: "string",
|
|
592
592
|
enum: Array.from(e.values)
|
|
593
593
|
};
|
|
594
594
|
}
|
|
595
|
-
var
|
|
596
|
-
function
|
|
597
|
-
let n = [
|
|
595
|
+
var xt = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
|
|
596
|
+
function St(e, t) {
|
|
597
|
+
let n = [J(e.left._def, {
|
|
598
598
|
...t,
|
|
599
599
|
currentPath: [
|
|
600
600
|
...t.currentPath,
|
|
601
601
|
"allOf",
|
|
602
602
|
"0"
|
|
603
603
|
]
|
|
604
|
-
}),
|
|
604
|
+
}), J(e.right._def, {
|
|
605
605
|
...t,
|
|
606
606
|
currentPath: [
|
|
607
607
|
...t.currentPath,
|
|
@@ -610,7 +610,7 @@ function xt(e, t) {
|
|
|
610
610
|
]
|
|
611
611
|
})].filter((e) => !!e), r = [];
|
|
612
612
|
return n.forEach((e) => {
|
|
613
|
-
if (
|
|
613
|
+
if (xt(e)) r.push(...e.allOf);
|
|
614
614
|
else {
|
|
615
615
|
let t = e;
|
|
616
616
|
if ("additionalProperties" in e && e.additionalProperties === !1) {
|
|
@@ -621,19 +621,19 @@ function xt(e, t) {
|
|
|
621
621
|
}
|
|
622
622
|
}), r.length ? { allOf: r } : void 0;
|
|
623
623
|
}
|
|
624
|
-
function
|
|
624
|
+
function Ct(e) {
|
|
625
625
|
let t = typeof e.value;
|
|
626
626
|
return t !== "bigint" && t !== "number" && t !== "boolean" && t !== "string" ? { type: Array.isArray(e.value) ? "array" : "object" } : {
|
|
627
627
|
type: t === "bigint" ? "integer" : t,
|
|
628
628
|
const: e.value
|
|
629
629
|
};
|
|
630
630
|
}
|
|
631
|
-
var
|
|
631
|
+
var wt = void 0, G = {
|
|
632
632
|
cuid: /^[cC][^\s-]{8,}$/,
|
|
633
633
|
cuid2: /^[0-9a-z]+$/,
|
|
634
634
|
ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
|
|
635
635
|
email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}$/,
|
|
636
|
-
emoji: () => (
|
|
636
|
+
emoji: () => (wt === void 0 && (wt = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u")), wt),
|
|
637
637
|
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}$/,
|
|
638
638
|
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])$/,
|
|
639
639
|
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])$/,
|
|
@@ -644,7 +644,7 @@ var Ct = void 0, K = {
|
|
|
644
644
|
nanoid: /^[a-zA-Z0-9_-]{21}$/,
|
|
645
645
|
jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
|
|
646
646
|
};
|
|
647
|
-
function
|
|
647
|
+
function Tt(e, t) {
|
|
648
648
|
let n = { type: "string" };
|
|
649
649
|
if (e.checks) for (let r of e.checks) switch (r.kind) {
|
|
650
650
|
case "min":
|
|
@@ -656,108 +656,108 @@ function wt(e, t) {
|
|
|
656
656
|
case "email":
|
|
657
657
|
switch (t.emailStrategy) {
|
|
658
658
|
case "format:email":
|
|
659
|
-
|
|
659
|
+
K(n, "email", r.message, t);
|
|
660
660
|
break;
|
|
661
661
|
case "format:idn-email":
|
|
662
|
-
|
|
662
|
+
K(n, "idn-email", r.message, t);
|
|
663
663
|
break;
|
|
664
|
-
case "pattern:zod":
|
|
664
|
+
case "pattern:zod": q(n, G.email, r.message, t);
|
|
665
665
|
}
|
|
666
666
|
break;
|
|
667
667
|
case "url":
|
|
668
|
-
|
|
668
|
+
K(n, "uri", r.message, t);
|
|
669
669
|
break;
|
|
670
670
|
case "uuid":
|
|
671
|
-
|
|
671
|
+
K(n, "uuid", r.message, t);
|
|
672
672
|
break;
|
|
673
673
|
case "regex":
|
|
674
|
-
|
|
674
|
+
q(n, r.regex, r.message, t);
|
|
675
675
|
break;
|
|
676
676
|
case "cuid":
|
|
677
|
-
|
|
677
|
+
q(n, G.cuid, r.message, t);
|
|
678
678
|
break;
|
|
679
679
|
case "cuid2":
|
|
680
|
-
|
|
680
|
+
q(n, G.cuid2, r.message, t);
|
|
681
681
|
break;
|
|
682
682
|
case "startsWith":
|
|
683
|
-
|
|
683
|
+
q(n, RegExp(`^${Et(r.value, t)}`), r.message, t);
|
|
684
684
|
break;
|
|
685
685
|
case "endsWith":
|
|
686
|
-
|
|
686
|
+
q(n, RegExp(`${Et(r.value, t)}$`), r.message, t);
|
|
687
687
|
break;
|
|
688
688
|
case "datetime":
|
|
689
|
-
|
|
689
|
+
K(n, "date-time", r.message, t);
|
|
690
690
|
break;
|
|
691
691
|
case "date":
|
|
692
|
-
|
|
692
|
+
K(n, "date", r.message, t);
|
|
693
693
|
break;
|
|
694
694
|
case "time":
|
|
695
|
-
|
|
695
|
+
K(n, "time", r.message, t);
|
|
696
696
|
break;
|
|
697
697
|
case "duration":
|
|
698
|
-
|
|
698
|
+
K(n, "duration", r.message, t);
|
|
699
699
|
break;
|
|
700
700
|
case "length":
|
|
701
701
|
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;
|
|
702
702
|
break;
|
|
703
703
|
case "includes":
|
|
704
|
-
|
|
704
|
+
q(n, RegExp(Et(r.value, t)), r.message, t);
|
|
705
705
|
break;
|
|
706
706
|
case "ip":
|
|
707
|
-
r.version !== "v6" &&
|
|
707
|
+
r.version !== "v6" && K(n, "ipv4", r.message, t), r.version !== "v4" && K(n, "ipv6", r.message, t);
|
|
708
708
|
break;
|
|
709
709
|
case "base64url":
|
|
710
|
-
|
|
710
|
+
q(n, G.base64url, r.message, t);
|
|
711
711
|
break;
|
|
712
712
|
case "jwt":
|
|
713
|
-
|
|
713
|
+
q(n, G.jwt, r.message, t);
|
|
714
714
|
break;
|
|
715
715
|
case "cidr":
|
|
716
|
-
r.version !== "v6" &&
|
|
716
|
+
r.version !== "v6" && q(n, G.ipv4Cidr, r.message, t), r.version !== "v4" && q(n, G.ipv6Cidr, r.message, t);
|
|
717
717
|
break;
|
|
718
718
|
case "emoji":
|
|
719
|
-
|
|
719
|
+
q(n, G.emoji(), r.message, t);
|
|
720
720
|
break;
|
|
721
721
|
case "ulid":
|
|
722
|
-
|
|
722
|
+
q(n, G.ulid, r.message, t);
|
|
723
723
|
break;
|
|
724
724
|
case "base64":
|
|
725
725
|
switch (t.base64Strategy) {
|
|
726
726
|
case "format:binary":
|
|
727
|
-
|
|
727
|
+
K(n, "binary", r.message, t);
|
|
728
728
|
break;
|
|
729
729
|
case "contentEncoding:base64":
|
|
730
730
|
n.contentEncoding = "base64";
|
|
731
731
|
break;
|
|
732
|
-
case "pattern:zod":
|
|
732
|
+
case "pattern:zod": q(n, G.base64, r.message, t);
|
|
733
733
|
}
|
|
734
734
|
break;
|
|
735
|
-
case "nanoid":
|
|
735
|
+
case "nanoid": q(n, G.nanoid, r.message, t);
|
|
736
736
|
}
|
|
737
737
|
return n;
|
|
738
738
|
}
|
|
739
|
-
function
|
|
740
|
-
return t.patternStrategy === "escape" ?
|
|
739
|
+
function Et(e, t) {
|
|
740
|
+
return t.patternStrategy === "escape" ? Ot(e) : e;
|
|
741
741
|
}
|
|
742
|
-
var
|
|
743
|
-
function
|
|
742
|
+
var Dt = /* @__PURE__ */ new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
743
|
+
function Ot(e) {
|
|
744
744
|
let t = "";
|
|
745
|
-
for (let n = 0; n < e.length; n++)
|
|
745
|
+
for (let n = 0; n < e.length; n++) Dt.has(e[n]) || (t += "\\"), t += e[n];
|
|
746
746
|
return t;
|
|
747
747
|
}
|
|
748
|
-
function
|
|
748
|
+
function K(e, t, n, r) {
|
|
749
749
|
e.format || e.anyOf?.some((e) => e.format) ? (e.anyOf ||= [], e.format && (e.anyOf.push({ format: e.format }), delete e.format), e.anyOf.push({
|
|
750
750
|
format: t,
|
|
751
751
|
...n && r.errorMessages && { errorMessage: { format: n } }
|
|
752
752
|
})) : e.format = t;
|
|
753
753
|
}
|
|
754
|
-
function
|
|
754
|
+
function q(e, t, n, r) {
|
|
755
755
|
e.pattern || e.allOf?.some((e) => e.pattern) ? (e.allOf ||= [], e.pattern && (e.allOf.push({ pattern: e.pattern }), delete e.pattern), e.allOf.push({
|
|
756
|
-
pattern:
|
|
756
|
+
pattern: kt(t, r),
|
|
757
757
|
...n && r.errorMessages && { errorMessage: { pattern: n } }
|
|
758
|
-
})) : e.pattern =
|
|
758
|
+
})) : e.pattern = kt(t, r);
|
|
759
759
|
}
|
|
760
|
-
function
|
|
760
|
+
function kt(e, t) {
|
|
761
761
|
if (!t.applyRegexFlags || !e.flags) return e.source;
|
|
762
762
|
let n = {
|
|
763
763
|
i: e.flags.includes("i"),
|
|
@@ -796,16 +796,16 @@ function Ot(e, t) {
|
|
|
796
796
|
}
|
|
797
797
|
return i;
|
|
798
798
|
}
|
|
799
|
-
function
|
|
799
|
+
function At(e, t) {
|
|
800
800
|
let n = {
|
|
801
801
|
type: "object",
|
|
802
|
-
additionalProperties:
|
|
802
|
+
additionalProperties: J(e.valueType._def, {
|
|
803
803
|
...t,
|
|
804
804
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
805
805
|
}) ?? t.allowedAdditionalProperties
|
|
806
806
|
};
|
|
807
807
|
if (e.keyType?._def.typeName === "ZodString" && e.keyType._def.checks?.length) {
|
|
808
|
-
let { type: r, ...i } =
|
|
808
|
+
let { type: r, ...i } = Tt(e.keyType._def, t);
|
|
809
809
|
return {
|
|
810
810
|
...n,
|
|
811
811
|
propertyNames: i
|
|
@@ -816,7 +816,7 @@ function kt(e, t) {
|
|
|
816
816
|
propertyNames: { enum: e.keyType._def.values }
|
|
817
817
|
};
|
|
818
818
|
if (e.keyType?._def.typeName === "ZodBranded" && e.keyType._def.type._def.typeName === "ZodString" && e.keyType._def.type._def.checks?.length) {
|
|
819
|
-
let { type: r, ...i } =
|
|
819
|
+
let { type: r, ...i } = U(e.keyType._def, t);
|
|
820
820
|
return {
|
|
821
821
|
...n,
|
|
822
822
|
propertyNames: i
|
|
@@ -824,13 +824,13 @@ function kt(e, t) {
|
|
|
824
824
|
}
|
|
825
825
|
return n;
|
|
826
826
|
}
|
|
827
|
-
function
|
|
828
|
-
return t.mapStrategy === "record" ?
|
|
827
|
+
function jt(e, t) {
|
|
828
|
+
return t.mapStrategy === "record" ? At(e, t) : {
|
|
829
829
|
type: "array",
|
|
830
830
|
maxItems: 125,
|
|
831
831
|
items: {
|
|
832
832
|
type: "array",
|
|
833
|
-
items: [
|
|
833
|
+
items: [J(e.keyType._def, {
|
|
834
834
|
...t,
|
|
835
835
|
currentPath: [
|
|
836
836
|
...t.currentPath,
|
|
@@ -838,7 +838,7 @@ function At(e, t) {
|
|
|
838
838
|
"items",
|
|
839
839
|
"0"
|
|
840
840
|
]
|
|
841
|
-
}) ||
|
|
841
|
+
}) || V(), J(e.valueType._def, {
|
|
842
842
|
...t,
|
|
843
843
|
currentPath: [
|
|
844
844
|
...t.currentPath,
|
|
@@ -846,37 +846,37 @@ function At(e, t) {
|
|
|
846
846
|
"items",
|
|
847
847
|
"1"
|
|
848
848
|
]
|
|
849
|
-
}) ||
|
|
849
|
+
}) || V()],
|
|
850
850
|
minItems: 2,
|
|
851
851
|
maxItems: 2
|
|
852
852
|
}
|
|
853
853
|
};
|
|
854
854
|
}
|
|
855
|
-
function
|
|
855
|
+
function Mt(e) {
|
|
856
856
|
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)));
|
|
857
857
|
return {
|
|
858
858
|
type: r.length === 1 ? r[0] === "string" ? "string" : "number" : ["string", "number"],
|
|
859
859
|
enum: n
|
|
860
860
|
};
|
|
861
861
|
}
|
|
862
|
-
function Mt() {
|
|
863
|
-
return { not: U() };
|
|
864
|
-
}
|
|
865
862
|
function Nt() {
|
|
863
|
+
return { not: V() };
|
|
864
|
+
}
|
|
865
|
+
function Pt() {
|
|
866
866
|
return { type: "null" };
|
|
867
867
|
}
|
|
868
|
-
var
|
|
868
|
+
var Ft = {
|
|
869
869
|
ZodString: "string",
|
|
870
870
|
ZodNumber: "number",
|
|
871
871
|
ZodBigInt: "integer",
|
|
872
872
|
ZodBoolean: "boolean",
|
|
873
873
|
ZodNull: "null"
|
|
874
874
|
};
|
|
875
|
-
function
|
|
875
|
+
function It(e, t) {
|
|
876
876
|
let n = e.options instanceof Map ? Array.from(e.options.values()) : e.options;
|
|
877
|
-
if (n.every((e) => e._def.typeName in
|
|
877
|
+
if (n.every((e) => e._def.typeName in Ft && (!e._def.checks || !e._def.checks.length))) {
|
|
878
878
|
let e = n.reduce((e, t) => {
|
|
879
|
-
let n =
|
|
879
|
+
let n = Ft[t._def.typeName];
|
|
880
880
|
return n && !e.includes(n) ? [...e, n] : e;
|
|
881
881
|
}, []);
|
|
882
882
|
return { type: e.length > 1 ? e : e[0] };
|
|
@@ -904,10 +904,10 @@ function Ft(e, t) {
|
|
|
904
904
|
type: "string",
|
|
905
905
|
enum: n.reduce((e, t) => [...e, ...t._def.values.filter((t) => !e.includes(t))], [])
|
|
906
906
|
};
|
|
907
|
-
return
|
|
907
|
+
return Lt(e, t);
|
|
908
908
|
}
|
|
909
|
-
var
|
|
910
|
-
let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) =>
|
|
909
|
+
var Lt = (e, t) => {
|
|
910
|
+
let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => J(e._def, {
|
|
911
911
|
...t,
|
|
912
912
|
currentPath: [
|
|
913
913
|
...t.currentPath,
|
|
@@ -917,15 +917,15 @@ var It = (e, t) => {
|
|
|
917
917
|
})).filter((e) => !!e && (!t.strictUnions || typeof e == "object" && Object.keys(e).length > 0));
|
|
918
918
|
return n.length ? { anyOf: n } : void 0;
|
|
919
919
|
};
|
|
920
|
-
function
|
|
920
|
+
function Rt(e, t) {
|
|
921
921
|
if ([
|
|
922
922
|
"ZodString",
|
|
923
923
|
"ZodNumber",
|
|
924
924
|
"ZodBigInt",
|
|
925
925
|
"ZodBoolean",
|
|
926
926
|
"ZodNull"
|
|
927
|
-
].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [
|
|
928
|
-
let n =
|
|
927
|
+
].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [Ft[e.innerType._def.typeName], "null"] };
|
|
928
|
+
let n = J(e.innerType._def, {
|
|
929
929
|
...t,
|
|
930
930
|
currentPath: [
|
|
931
931
|
...t.currentPath,
|
|
@@ -935,7 +935,7 @@ function Lt(e, t) {
|
|
|
935
935
|
});
|
|
936
936
|
return n && { anyOf: [n, { type: "null" }] };
|
|
937
937
|
}
|
|
938
|
-
function
|
|
938
|
+
function zt(e) {
|
|
939
939
|
let t = { type: "number" };
|
|
940
940
|
if (!e.checks) return t;
|
|
941
941
|
for (let n of e.checks) switch (n.kind) {
|
|
@@ -952,7 +952,7 @@ function Rt(e) {
|
|
|
952
952
|
}
|
|
953
953
|
return t;
|
|
954
954
|
}
|
|
955
|
-
function
|
|
955
|
+
function Bt(e, t) {
|
|
956
956
|
let n = {
|
|
957
957
|
type: "object",
|
|
958
958
|
properties: {}
|
|
@@ -960,7 +960,7 @@ function zt(e, t) {
|
|
|
960
960
|
for (let e in i) {
|
|
961
961
|
let a = i[e];
|
|
962
962
|
if (a === void 0 || a._def === void 0) continue;
|
|
963
|
-
let o =
|
|
963
|
+
let o = Ht(a), s = J(a._def, {
|
|
964
964
|
...t,
|
|
965
965
|
currentPath: [
|
|
966
966
|
...t.currentPath,
|
|
@@ -976,11 +976,11 @@ function zt(e, t) {
|
|
|
976
976
|
s !== void 0 && (n.properties[e] = s, o || r.push(e));
|
|
977
977
|
}
|
|
978
978
|
r.length && (n.required = r);
|
|
979
|
-
let a =
|
|
979
|
+
let a = Vt(e, t);
|
|
980
980
|
return a !== void 0 && (n.additionalProperties = a), n;
|
|
981
981
|
}
|
|
982
|
-
function
|
|
983
|
-
if (e.catchall._def.typeName !== "ZodNever") return
|
|
982
|
+
function Vt(e, t) {
|
|
983
|
+
if (e.catchall._def.typeName !== "ZodNever") return J(e.catchall._def, {
|
|
984
984
|
...t,
|
|
985
985
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
986
986
|
});
|
|
@@ -990,16 +990,16 @@ function Bt(e, t) {
|
|
|
990
990
|
case "strip": return t.removeAdditionalStrategy === "strict" ? t.allowedAdditionalProperties : t.rejectedAdditionalProperties;
|
|
991
991
|
}
|
|
992
992
|
}
|
|
993
|
-
function
|
|
993
|
+
function Ht(e) {
|
|
994
994
|
try {
|
|
995
995
|
return e.isOptional();
|
|
996
996
|
} catch {
|
|
997
997
|
return !0;
|
|
998
998
|
}
|
|
999
999
|
}
|
|
1000
|
-
var
|
|
1001
|
-
if (t.currentPath.toString() === t.propertyPath?.toString()) return
|
|
1002
|
-
let n =
|
|
1000
|
+
var Ut = (e, t) => {
|
|
1001
|
+
if (t.currentPath.toString() === t.propertyPath?.toString()) return J(e.innerType._def, t);
|
|
1002
|
+
let n = J(e.innerType._def, {
|
|
1003
1003
|
...t,
|
|
1004
1004
|
currentPath: [
|
|
1005
1005
|
...t.currentPath,
|
|
@@ -1007,11 +1007,11 @@ var Ht = (e, t) => {
|
|
|
1007
1007
|
"1"
|
|
1008
1008
|
]
|
|
1009
1009
|
});
|
|
1010
|
-
return n ? { anyOf: [{ not:
|
|
1011
|
-
},
|
|
1012
|
-
if (t.pipeStrategy === "input") return
|
|
1013
|
-
if (t.pipeStrategy === "output") return
|
|
1014
|
-
let n =
|
|
1010
|
+
return n ? { anyOf: [{ not: V() }, n] } : V();
|
|
1011
|
+
}, Wt = (e, t) => {
|
|
1012
|
+
if (t.pipeStrategy === "input") return J(e.in._def, t);
|
|
1013
|
+
if (t.pipeStrategy === "output") return J(e.out._def, t);
|
|
1014
|
+
let n = J(e.in._def, {
|
|
1015
1015
|
...t,
|
|
1016
1016
|
currentPath: [
|
|
1017
1017
|
...t.currentPath,
|
|
@@ -1019,7 +1019,7 @@ var Ht = (e, t) => {
|
|
|
1019
1019
|
"0"
|
|
1020
1020
|
]
|
|
1021
1021
|
});
|
|
1022
|
-
return { allOf: [n,
|
|
1022
|
+
return { allOf: [n, J(e.out._def, {
|
|
1023
1023
|
...t,
|
|
1024
1024
|
currentPath: [
|
|
1025
1025
|
...t.currentPath,
|
|
@@ -1028,25 +1028,25 @@ var Ht = (e, t) => {
|
|
|
1028
1028
|
]
|
|
1029
1029
|
})].filter((e) => e !== void 0) };
|
|
1030
1030
|
};
|
|
1031
|
-
function Wt(e, t) {
|
|
1032
|
-
return Y(e.type._def, t);
|
|
1033
|
-
}
|
|
1034
1031
|
function Gt(e, t) {
|
|
1032
|
+
return J(e.type._def, t);
|
|
1033
|
+
}
|
|
1034
|
+
function Kt(e, t) {
|
|
1035
1035
|
let n = {
|
|
1036
1036
|
type: "array",
|
|
1037
1037
|
uniqueItems: !0,
|
|
1038
|
-
items:
|
|
1038
|
+
items: J(e.valueType._def, {
|
|
1039
1039
|
...t,
|
|
1040
1040
|
currentPath: [...t.currentPath, "items"]
|
|
1041
1041
|
})
|
|
1042
1042
|
};
|
|
1043
1043
|
return e.minSize && (n.minItems = e.minSize.value), e.maxSize && (n.maxItems = e.maxSize.value), n;
|
|
1044
1044
|
}
|
|
1045
|
-
function
|
|
1045
|
+
function qt(e, t) {
|
|
1046
1046
|
return e.rest ? {
|
|
1047
1047
|
type: "array",
|
|
1048
1048
|
minItems: e.items.length,
|
|
1049
|
-
items: e.items.map((e, n) =>
|
|
1049
|
+
items: e.items.map((e, n) => J(e._def, {
|
|
1050
1050
|
...t,
|
|
1051
1051
|
currentPath: [
|
|
1052
1052
|
...t.currentPath,
|
|
@@ -1054,7 +1054,7 @@ function Kt(e, t) {
|
|
|
1054
1054
|
`${n}`
|
|
1055
1055
|
]
|
|
1056
1056
|
})).reduce((e, t) => t === void 0 ? e : [...e, t], []),
|
|
1057
|
-
additionalItems:
|
|
1057
|
+
additionalItems: J(e.rest._def, {
|
|
1058
1058
|
...t,
|
|
1059
1059
|
currentPath: [...t.currentPath, "additionalItems"]
|
|
1060
1060
|
})
|
|
@@ -1062,7 +1062,7 @@ function Kt(e, t) {
|
|
|
1062
1062
|
type: "array",
|
|
1063
1063
|
minItems: e.items.length,
|
|
1064
1064
|
maxItems: e.items.length,
|
|
1065
|
-
items: e.items.map((e, n) =>
|
|
1065
|
+
items: e.items.map((e, n) => J(e._def, {
|
|
1066
1066
|
...t,
|
|
1067
1067
|
currentPath: [
|
|
1068
1068
|
...t.currentPath,
|
|
@@ -1072,47 +1072,47 @@ function Kt(e, t) {
|
|
|
1072
1072
|
})).reduce((e, t) => t === void 0 ? e : [...e, t], [])
|
|
1073
1073
|
};
|
|
1074
1074
|
}
|
|
1075
|
-
function qt() {
|
|
1076
|
-
return { not: U() };
|
|
1077
|
-
}
|
|
1078
1075
|
function Jt() {
|
|
1079
|
-
return
|
|
1076
|
+
return { not: V() };
|
|
1080
1077
|
}
|
|
1081
|
-
|
|
1078
|
+
function Yt() {
|
|
1079
|
+
return V();
|
|
1080
|
+
}
|
|
1081
|
+
var Xt = (e, t) => J(e.innerType._def, t), Zt = (e, t, n) => {
|
|
1082
1082
|
switch (t) {
|
|
1083
|
-
case "ZodString": return
|
|
1084
|
-
case "ZodNumber": return
|
|
1085
|
-
case "ZodObject": return
|
|
1086
|
-
case "ZodBigInt": return
|
|
1087
|
-
case "ZodBoolean": return
|
|
1088
|
-
case "ZodDate": return
|
|
1089
|
-
case "ZodUndefined": return
|
|
1090
|
-
case "ZodNull": return
|
|
1091
|
-
case "ZodArray": return
|
|
1083
|
+
case "ZodString": return Tt(e, n);
|
|
1084
|
+
case "ZodNumber": return zt(e);
|
|
1085
|
+
case "ZodObject": return Bt(e, n);
|
|
1086
|
+
case "ZodBigInt": return ht(e);
|
|
1087
|
+
case "ZodBoolean": return H();
|
|
1088
|
+
case "ZodDate": return gt(e, n);
|
|
1089
|
+
case "ZodUndefined": return Jt();
|
|
1090
|
+
case "ZodNull": return Pt();
|
|
1091
|
+
case "ZodArray": return mt(e, n);
|
|
1092
1092
|
case "ZodUnion":
|
|
1093
|
-
case "ZodDiscriminatedUnion": return
|
|
1094
|
-
case "ZodIntersection": return
|
|
1095
|
-
case "ZodTuple": return
|
|
1096
|
-
case "ZodRecord": return
|
|
1097
|
-
case "ZodLiteral": return
|
|
1098
|
-
case "ZodEnum": return
|
|
1099
|
-
case "ZodNativeEnum": return
|
|
1100
|
-
case "ZodNullable": return
|
|
1101
|
-
case "ZodOptional": return
|
|
1102
|
-
case "ZodMap": return
|
|
1103
|
-
case "ZodSet": return
|
|
1093
|
+
case "ZodDiscriminatedUnion": return It(e, n);
|
|
1094
|
+
case "ZodIntersection": return St(e, n);
|
|
1095
|
+
case "ZodTuple": return qt(e, n);
|
|
1096
|
+
case "ZodRecord": return At(e, n);
|
|
1097
|
+
case "ZodLiteral": return Ct(e);
|
|
1098
|
+
case "ZodEnum": return bt(e);
|
|
1099
|
+
case "ZodNativeEnum": return Mt(e);
|
|
1100
|
+
case "ZodNullable": return Rt(e, n);
|
|
1101
|
+
case "ZodOptional": return Ut(e, n);
|
|
1102
|
+
case "ZodMap": return jt(e, n);
|
|
1103
|
+
case "ZodSet": return Kt(e, n);
|
|
1104
1104
|
case "ZodLazy": return () => e.getter()._def;
|
|
1105
|
-
case "ZodPromise": return
|
|
1105
|
+
case "ZodPromise": return Gt(e, n);
|
|
1106
1106
|
case "ZodNaN":
|
|
1107
|
-
case "ZodNever": return
|
|
1108
|
-
case "ZodEffects": return
|
|
1109
|
-
case "ZodAny": return
|
|
1110
|
-
case "ZodUnknown": return
|
|
1111
|
-
case "ZodDefault": return
|
|
1112
|
-
case "ZodBranded": return
|
|
1113
|
-
case "ZodReadonly": return
|
|
1114
|
-
case "ZodCatch": return
|
|
1115
|
-
case "ZodPipeline": return
|
|
1107
|
+
case "ZodNever": return Nt();
|
|
1108
|
+
case "ZodEffects": return yt(e, n);
|
|
1109
|
+
case "ZodAny": return V();
|
|
1110
|
+
case "ZodUnknown": return Yt();
|
|
1111
|
+
case "ZodDefault": return vt(e, n);
|
|
1112
|
+
case "ZodBranded": return U(e, n);
|
|
1113
|
+
case "ZodReadonly": return Xt(e, n);
|
|
1114
|
+
case "ZodCatch": return W(e, n);
|
|
1115
|
+
case "ZodPipeline": return Wt(e, n);
|
|
1116
1116
|
case "ZodFunction":
|
|
1117
1117
|
case "ZodVoid":
|
|
1118
1118
|
case "ZodSymbol": return;
|
|
@@ -1120,19 +1120,19 @@ var Yt = (e, t) => Y(e.innerType._def, t), Xt = (e, t, n) => {
|
|
|
1120
1120
|
/* c8 ignore next */
|
|
1121
1121
|
return ((e) => void 0)(t);
|
|
1122
1122
|
}
|
|
1123
|
-
},
|
|
1123
|
+
}, Qt = (e, t) => {
|
|
1124
1124
|
let n = 0;
|
|
1125
1125
|
for (; n < e.length && n < t.length && e[n] === t[n]; n++);
|
|
1126
1126
|
return [(e.length - n).toString(), ...t.slice(n)].join("/");
|
|
1127
1127
|
};
|
|
1128
|
-
function
|
|
1128
|
+
function J(e, t, n = !1) {
|
|
1129
1129
|
let r = t.seen.get(e);
|
|
1130
1130
|
if (t.override) {
|
|
1131
1131
|
let i = t.override?.(e, t, r, n);
|
|
1132
|
-
if (i !==
|
|
1132
|
+
if (i !== dt) return i;
|
|
1133
1133
|
}
|
|
1134
1134
|
if (r && !n) {
|
|
1135
|
-
let e =
|
|
1135
|
+
let e = $t(r, t);
|
|
1136
1136
|
if (e !== void 0) return e;
|
|
1137
1137
|
}
|
|
1138
1138
|
let i = {
|
|
@@ -1141,22 +1141,22 @@ function Y(e, t, n = !1) {
|
|
|
1141
1141
|
jsonSchema: void 0
|
|
1142
1142
|
};
|
|
1143
1143
|
t.seen.set(e, i);
|
|
1144
|
-
let a =
|
|
1145
|
-
if (o &&
|
|
1144
|
+
let a = Zt(e, e.typeName, t), o = typeof a == "function" ? J(a(), t) : a;
|
|
1145
|
+
if (o && en(e, t, o), t.postProcess) {
|
|
1146
1146
|
let n = t.postProcess(o, e, t);
|
|
1147
1147
|
return i.jsonSchema = o, n;
|
|
1148
1148
|
}
|
|
1149
1149
|
return i.jsonSchema = o, o;
|
|
1150
1150
|
}
|
|
1151
|
-
var
|
|
1151
|
+
var $t = (e, t) => {
|
|
1152
1152
|
switch (t.$refStrategy) {
|
|
1153
1153
|
case "root": return { $ref: e.path.join("/") };
|
|
1154
|
-
case "relative": return { $ref:
|
|
1154
|
+
case "relative": return { $ref: Qt(t.currentPath, e.path) };
|
|
1155
1155
|
case "none":
|
|
1156
|
-
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`),
|
|
1156
|
+
case "seen": return e.path.length < t.currentPath.length && e.path.every((e, n) => t.currentPath[n] === e) ? (console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`), V()) : t.$refStrategy === "seen" ? V() : void 0;
|
|
1157
1157
|
}
|
|
1158
|
-
},
|
|
1159
|
-
let t =
|
|
1158
|
+
}, en = (e, t, n) => (e.description && (n.description = e.description), n), tn = (e) => {
|
|
1159
|
+
let t = pt(e), n = t.name === void 0 ? t.basePath : [
|
|
1160
1160
|
...t.basePath,
|
|
1161
1161
|
t.definitionPath,
|
|
1162
1162
|
t.name
|
|
@@ -1175,25 +1175,25 @@ var Qt = (e, t) => {
|
|
|
1175
1175
|
jsonSchema: void 0
|
|
1176
1176
|
}]))
|
|
1177
1177
|
};
|
|
1178
|
-
},
|
|
1179
|
-
let n =
|
|
1178
|
+
}, nn = (e, t) => {
|
|
1179
|
+
let n = tn(t), r = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((e, [t, r]) => ({
|
|
1180
1180
|
...e,
|
|
1181
|
-
[t]:
|
|
1181
|
+
[t]: J(r._def, {
|
|
1182
1182
|
...n,
|
|
1183
1183
|
currentPath: [
|
|
1184
1184
|
...n.basePath,
|
|
1185
1185
|
n.definitionPath,
|
|
1186
1186
|
t
|
|
1187
1187
|
]
|
|
1188
|
-
}, !0) ??
|
|
1189
|
-
}), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a =
|
|
1188
|
+
}, !0) ?? V()
|
|
1189
|
+
}), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = J(e._def, i === void 0 ? n : {
|
|
1190
1190
|
...n,
|
|
1191
1191
|
currentPath: [
|
|
1192
1192
|
...n.basePath,
|
|
1193
1193
|
n.definitionPath,
|
|
1194
1194
|
i
|
|
1195
1195
|
]
|
|
1196
|
-
}, !1) ??
|
|
1196
|
+
}, !1) ?? V(), o = typeof t == "object" && t.name !== void 0 && t.nameStrategy === "title" ? t.name : void 0;
|
|
1197
1197
|
o !== void 0 && (a.title = o);
|
|
1198
1198
|
let s = i === void 0 ? r ? {
|
|
1199
1199
|
...a,
|
|
@@ -1210,14 +1210,14 @@ var Qt = (e, t) => {
|
|
|
1210
1210
|
}
|
|
1211
1211
|
};
|
|
1212
1212
|
return s.$schema = "http://json-schema.org/draft-07/schema#", s;
|
|
1213
|
-
},
|
|
1214
|
-
function
|
|
1213
|
+
}, rn = Symbol.for("vercel.ai.schema");
|
|
1214
|
+
function an(e) {
|
|
1215
1215
|
let t;
|
|
1216
1216
|
return () => (t ??= e(), t);
|
|
1217
1217
|
}
|
|
1218
|
-
function
|
|
1218
|
+
function on(e, { validate: t } = {}) {
|
|
1219
1219
|
return {
|
|
1220
|
-
[
|
|
1220
|
+
[rn]: !0,
|
|
1221
1221
|
_type: void 0,
|
|
1222
1222
|
get jsonSchema() {
|
|
1223
1223
|
return typeof e == "function" && (e = e()), e;
|
|
@@ -1225,20 +1225,20 @@ function an(e, { validate: t } = {}) {
|
|
|
1225
1225
|
validate: t
|
|
1226
1226
|
};
|
|
1227
1227
|
}
|
|
1228
|
-
function on(e) {
|
|
1229
|
-
return typeof e == "object" && !!e && nn in e && e[nn] === !0 && "jsonSchema" in e && "validate" in e;
|
|
1230
|
-
}
|
|
1231
1228
|
function sn(e) {
|
|
1232
|
-
return e ==
|
|
1229
|
+
return typeof e == "object" && !!e && rn in e && e[rn] === !0 && "jsonSchema" in e && "validate" in e;
|
|
1230
|
+
}
|
|
1231
|
+
function cn(e) {
|
|
1232
|
+
return e == null ? on({
|
|
1233
1233
|
type: "object",
|
|
1234
1234
|
properties: {},
|
|
1235
1235
|
additionalProperties: !1
|
|
1236
|
-
}) :
|
|
1236
|
+
}) : sn(e) ? e : "~standard" in e ? e["~standard"].vendor === "zod" ? mn(e) : ln(e) : e();
|
|
1237
1237
|
}
|
|
1238
|
-
function
|
|
1239
|
-
return
|
|
1240
|
-
if (!
|
|
1241
|
-
return
|
|
1238
|
+
function ln(e) {
|
|
1239
|
+
return on(() => {
|
|
1240
|
+
if (!un(e)) throw Error(`Standard schema vendor '${e["~standard"].vendor}' does not support JSON Schema conversion.`);
|
|
1241
|
+
return z(e["~standard"].jsonSchema.input({ target: "draft-07" }));
|
|
1242
1242
|
}, { validate: async (t) => {
|
|
1243
1243
|
let n = await e["~standard"].validate(t);
|
|
1244
1244
|
return "value" in n ? {
|
|
@@ -1246,19 +1246,19 @@ function cn(e) {
|
|
|
1246
1246
|
value: n.value
|
|
1247
1247
|
} : {
|
|
1248
1248
|
success: !1,
|
|
1249
|
-
error: new
|
|
1249
|
+
error: new Xe({
|
|
1250
1250
|
value: t,
|
|
1251
1251
|
cause: n.issues
|
|
1252
1252
|
})
|
|
1253
1253
|
};
|
|
1254
1254
|
} });
|
|
1255
1255
|
}
|
|
1256
|
-
function
|
|
1256
|
+
function un(e) {
|
|
1257
1257
|
return e["~standard"].jsonSchema != null;
|
|
1258
1258
|
}
|
|
1259
|
-
function
|
|
1259
|
+
function dn(e, t) {
|
|
1260
1260
|
let n = t?.useReferences ?? !1;
|
|
1261
|
-
return
|
|
1261
|
+
return on(() => nn(e, { $refStrategy: n ? "root" : "none" }), { validate: async (t) => {
|
|
1262
1262
|
let n = await e.safeParseAsync(t);
|
|
1263
1263
|
return n.success ? {
|
|
1264
1264
|
success: !0,
|
|
@@ -1269,9 +1269,9 @@ function un(e, t) {
|
|
|
1269
1269
|
};
|
|
1270
1270
|
} });
|
|
1271
1271
|
}
|
|
1272
|
-
function
|
|
1272
|
+
function fn(e, r) {
|
|
1273
1273
|
let i = r?.useReferences ?? !1;
|
|
1274
|
-
return
|
|
1274
|
+
return on(() => z(n(e, {
|
|
1275
1275
|
target: "draft-7",
|
|
1276
1276
|
io: "input",
|
|
1277
1277
|
reused: i ? "ref" : "inline"
|
|
@@ -1286,27 +1286,27 @@ function dn(e, r) {
|
|
|
1286
1286
|
};
|
|
1287
1287
|
} });
|
|
1288
1288
|
}
|
|
1289
|
-
function
|
|
1289
|
+
function pn(e) {
|
|
1290
1290
|
return "_zod" in e;
|
|
1291
1291
|
}
|
|
1292
|
-
function
|
|
1293
|
-
return
|
|
1292
|
+
function mn(e, t) {
|
|
1293
|
+
return pn(e) ? fn(e, t) : dn(e, t);
|
|
1294
1294
|
}
|
|
1295
|
-
async function
|
|
1296
|
-
let r = await
|
|
1295
|
+
async function hn({ value: e, schema: t, context: n }) {
|
|
1296
|
+
let r = await gn({
|
|
1297
1297
|
value: e,
|
|
1298
1298
|
schema: t,
|
|
1299
1299
|
context: n
|
|
1300
1300
|
});
|
|
1301
|
-
if (!r.success) throw
|
|
1301
|
+
if (!r.success) throw Xe.wrap({
|
|
1302
1302
|
value: e,
|
|
1303
1303
|
cause: r.error,
|
|
1304
1304
|
context: n
|
|
1305
1305
|
});
|
|
1306
1306
|
return r.value;
|
|
1307
1307
|
}
|
|
1308
|
-
async function
|
|
1309
|
-
let r =
|
|
1308
|
+
async function gn({ value: e, schema: t, context: n }) {
|
|
1309
|
+
let r = cn(t);
|
|
1310
1310
|
try {
|
|
1311
1311
|
if (r.validate == null) return {
|
|
1312
1312
|
success: !0,
|
|
@@ -1320,7 +1320,7 @@ async function hn({ value: e, schema: t, context: n }) {
|
|
|
1320
1320
|
rawValue: e
|
|
1321
1321
|
} : {
|
|
1322
1322
|
success: !1,
|
|
1323
|
-
error:
|
|
1323
|
+
error: Xe.wrap({
|
|
1324
1324
|
value: e,
|
|
1325
1325
|
cause: t.error,
|
|
1326
1326
|
context: n
|
|
@@ -1330,7 +1330,7 @@ async function hn({ value: e, schema: t, context: n }) {
|
|
|
1330
1330
|
} catch (t) {
|
|
1331
1331
|
return {
|
|
1332
1332
|
success: !1,
|
|
1333
|
-
error:
|
|
1333
|
+
error: Xe.wrap({
|
|
1334
1334
|
value: e,
|
|
1335
1335
|
cause: t,
|
|
1336
1336
|
context: n
|
|
@@ -1339,21 +1339,21 @@ async function hn({ value: e, schema: t, context: n }) {
|
|
|
1339
1339
|
};
|
|
1340
1340
|
}
|
|
1341
1341
|
}
|
|
1342
|
-
async function
|
|
1342
|
+
async function _n({ text: e, schema: t }) {
|
|
1343
1343
|
try {
|
|
1344
|
-
let n =
|
|
1344
|
+
let n = R(e);
|
|
1345
1345
|
return t == null ? {
|
|
1346
1346
|
success: !0,
|
|
1347
1347
|
value: n,
|
|
1348
1348
|
rawValue: n
|
|
1349
|
-
} : await
|
|
1349
|
+
} : await gn({
|
|
1350
1350
|
value: n,
|
|
1351
1351
|
schema: t
|
|
1352
1352
|
});
|
|
1353
1353
|
} catch (t) {
|
|
1354
1354
|
return {
|
|
1355
1355
|
success: !1,
|
|
1356
|
-
error:
|
|
1356
|
+
error: qe.isInstance(t) ? t : new qe({
|
|
1357
1357
|
text: e,
|
|
1358
1358
|
cause: t
|
|
1359
1359
|
}),
|
|
@@ -1361,42 +1361,42 @@ async function gn({ text: e, schema: t }) {
|
|
|
1361
1361
|
};
|
|
1362
1362
|
}
|
|
1363
1363
|
}
|
|
1364
|
-
function
|
|
1365
|
-
return e.pipeThrough(new TextDecoderStream()).pipeThrough(new
|
|
1366
|
-
e !== "[DONE]" && n.enqueue(await
|
|
1364
|
+
function vn({ stream: e, schema: t }) {
|
|
1365
|
+
return e.pipeThrough(new TextDecoderStream()).pipeThrough(new it()).pipeThrough(new TransformStream({ async transform({ data: e }, n) {
|
|
1366
|
+
e !== "[DONE]" && n.enqueue(await _n({
|
|
1367
1367
|
text: e,
|
|
1368
1368
|
schema: t
|
|
1369
1369
|
}));
|
|
1370
1370
|
} }));
|
|
1371
1371
|
}
|
|
1372
|
-
async function
|
|
1372
|
+
async function yn(e) {
|
|
1373
1373
|
return typeof e == "function" && (e = e()), e;
|
|
1374
1374
|
}
|
|
1375
1375
|
new TextDecoder();
|
|
1376
1376
|
//#endregion
|
|
1377
1377
|
//#region ../../node_modules/.pnpm/ai@7.0.140_zod@4.6.7/node_modules/ai/dist/index.js
|
|
1378
|
-
var
|
|
1378
|
+
var bn = "AI_InvalidArgumentError", xn = `vercel.ai.error.${bn}`, Sn = Symbol.for(xn), Cn = class extends w {
|
|
1379
1379
|
constructor({ parameter: e, value: t, message: n }) {
|
|
1380
1380
|
super({
|
|
1381
|
-
name:
|
|
1381
|
+
name: bn,
|
|
1382
1382
|
message: `Invalid argument for parameter ${e}: ${n}`
|
|
1383
|
-
}), this[
|
|
1383
|
+
}), this[Sn] = !0, this.parameter = e, this.value = t;
|
|
1384
1384
|
}
|
|
1385
1385
|
static isInstance(e) {
|
|
1386
|
-
return
|
|
1386
|
+
return w.hasMarker(e, xn);
|
|
1387
1387
|
}
|
|
1388
|
-
},
|
|
1388
|
+
}, wn = "AI_UIMessageStreamError", Tn = `vercel.ai.error.${wn}`, En = Symbol.for(Tn), Dn = class extends w {
|
|
1389
1389
|
constructor({ chunkType: e, chunkId: t, message: n }) {
|
|
1390
1390
|
super({
|
|
1391
|
-
name:
|
|
1391
|
+
name: wn,
|
|
1392
1392
|
message: n
|
|
1393
|
-
}), this[
|
|
1393
|
+
}), this[En] = !0, this.chunkType = e, this.chunkId = t;
|
|
1394
1394
|
}
|
|
1395
1395
|
static isInstance(e) {
|
|
1396
|
-
return
|
|
1396
|
+
return w.hasMarker(e, Tn);
|
|
1397
1397
|
}
|
|
1398
1398
|
};
|
|
1399
|
-
function
|
|
1399
|
+
function On(e, t) {
|
|
1400
1400
|
if (e === void 0 && t === void 0) return;
|
|
1401
1401
|
if (e === void 0) return t;
|
|
1402
1402
|
if (t === void 0) return e;
|
|
@@ -1405,11 +1405,11 @@ function Dn(e, t) {
|
|
|
1405
1405
|
let i = t[r];
|
|
1406
1406
|
if (i === void 0) continue;
|
|
1407
1407
|
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);
|
|
1408
|
-
n[r] = o && s ?
|
|
1408
|
+
n[r] = o && s ? On(a, i) : i;
|
|
1409
1409
|
}
|
|
1410
1410
|
return n;
|
|
1411
1411
|
}
|
|
1412
|
-
var
|
|
1412
|
+
var Y = {
|
|
1413
1413
|
array: d,
|
|
1414
1414
|
boolean: m,
|
|
1415
1415
|
custom: l,
|
|
@@ -1427,214 +1427,214 @@ var X = {
|
|
|
1427
1427
|
string: r,
|
|
1428
1428
|
union: e,
|
|
1429
1429
|
unknown: _
|
|
1430
|
-
},
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
])), Z =
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
]), An =
|
|
1443
|
-
type:
|
|
1444
|
-
text:
|
|
1430
|
+
}, X = Y.lazy(() => Y.union([
|
|
1431
|
+
Y.null(),
|
|
1432
|
+
Y.string(),
|
|
1433
|
+
Y.number(),
|
|
1434
|
+
Y.boolean(),
|
|
1435
|
+
Y.record(Y.string(), X.optional()),
|
|
1436
|
+
Y.array(X)
|
|
1437
|
+
])), Z = Y.record(Y.string(), Y.record(Y.string(), X.optional())), kn = Y.union([
|
|
1438
|
+
Y.string(),
|
|
1439
|
+
Y.instanceof(Uint8Array),
|
|
1440
|
+
Y.instanceof(ArrayBuffer),
|
|
1441
|
+
Y.custom(I, { message: "Must be a Buffer" })
|
|
1442
|
+
]), An = Y.record(Y.string(), Y.string()), jn = Y.object({
|
|
1443
|
+
type: Y.literal("text"),
|
|
1444
|
+
text: Y.string(),
|
|
1445
1445
|
providerOptions: Z.optional()
|
|
1446
|
-
}), Mn =
|
|
1447
|
-
type:
|
|
1448
|
-
image:
|
|
1446
|
+
}), Mn = Y.object({
|
|
1447
|
+
type: Y.literal("image"),
|
|
1448
|
+
image: Y.union([
|
|
1449
1449
|
kn,
|
|
1450
|
-
|
|
1450
|
+
Y.instanceof(URL),
|
|
1451
1451
|
An
|
|
1452
1452
|
]),
|
|
1453
|
-
mediaType:
|
|
1453
|
+
mediaType: Y.string().optional(),
|
|
1454
1454
|
providerOptions: Z.optional()
|
|
1455
|
-
}), Nn =
|
|
1456
|
-
|
|
1457
|
-
type:
|
|
1455
|
+
}), Nn = Y.discriminatedUnion("type", [
|
|
1456
|
+
Y.object({
|
|
1457
|
+
type: Y.literal("data"),
|
|
1458
1458
|
data: kn
|
|
1459
1459
|
}),
|
|
1460
|
-
|
|
1461
|
-
type:
|
|
1462
|
-
url:
|
|
1460
|
+
Y.object({
|
|
1461
|
+
type: Y.literal("url"),
|
|
1462
|
+
url: Y.instanceof(URL)
|
|
1463
1463
|
}),
|
|
1464
|
-
|
|
1465
|
-
type:
|
|
1464
|
+
Y.object({
|
|
1465
|
+
type: Y.literal("reference"),
|
|
1466
1466
|
reference: An
|
|
1467
1467
|
}),
|
|
1468
|
-
|
|
1469
|
-
type:
|
|
1470
|
-
text:
|
|
1468
|
+
Y.object({
|
|
1469
|
+
type: Y.literal("text"),
|
|
1470
|
+
text: Y.string()
|
|
1471
1471
|
})
|
|
1472
|
-
]), Pn =
|
|
1473
|
-
type:
|
|
1472
|
+
]), Pn = Y.discriminatedUnion("type", [Y.object({
|
|
1473
|
+
type: Y.literal("data"),
|
|
1474
1474
|
data: kn
|
|
1475
|
-
}),
|
|
1476
|
-
type:
|
|
1477
|
-
url:
|
|
1478
|
-
})]), Fn =
|
|
1479
|
-
type:
|
|
1480
|
-
data:
|
|
1475
|
+
}), Y.object({
|
|
1476
|
+
type: Y.literal("url"),
|
|
1477
|
+
url: Y.instanceof(URL)
|
|
1478
|
+
})]), Fn = Y.object({
|
|
1479
|
+
type: Y.literal("file"),
|
|
1480
|
+
data: Y.union([
|
|
1481
1481
|
Nn,
|
|
1482
1482
|
kn,
|
|
1483
|
-
|
|
1483
|
+
Y.instanceof(URL),
|
|
1484
1484
|
An
|
|
1485
1485
|
]),
|
|
1486
|
-
filename:
|
|
1487
|
-
mediaType:
|
|
1486
|
+
filename: Y.string().optional(),
|
|
1487
|
+
mediaType: Y.string(),
|
|
1488
1488
|
providerOptions: Z.optional()
|
|
1489
|
-
}), In =
|
|
1490
|
-
type:
|
|
1491
|
-
text:
|
|
1489
|
+
}), In = Y.object({
|
|
1490
|
+
type: Y.literal("reasoning"),
|
|
1491
|
+
text: Y.string(),
|
|
1492
1492
|
providerOptions: Z.optional()
|
|
1493
|
-
}), Ln =
|
|
1494
|
-
type:
|
|
1495
|
-
kind:
|
|
1493
|
+
}), Ln = Y.object({
|
|
1494
|
+
type: Y.literal("custom"),
|
|
1495
|
+
kind: Y.string().transform((e) => e),
|
|
1496
1496
|
providerOptions: Z.optional()
|
|
1497
|
-
}), Rn =
|
|
1498
|
-
type:
|
|
1499
|
-
data:
|
|
1497
|
+
}), Rn = Y.object({
|
|
1498
|
+
type: Y.literal("reasoning-file"),
|
|
1499
|
+
data: Y.union([
|
|
1500
1500
|
Pn,
|
|
1501
1501
|
kn,
|
|
1502
|
-
|
|
1502
|
+
Y.instanceof(URL)
|
|
1503
1503
|
]),
|
|
1504
|
-
mediaType:
|
|
1504
|
+
mediaType: Y.string(),
|
|
1505
1505
|
providerOptions: Z.optional()
|
|
1506
|
-
}), zn =
|
|
1507
|
-
type:
|
|
1508
|
-
toolCallId:
|
|
1509
|
-
toolName:
|
|
1510
|
-
input:
|
|
1506
|
+
}), zn = Y.object({
|
|
1507
|
+
type: Y.literal("tool-call"),
|
|
1508
|
+
toolCallId: Y.string(),
|
|
1509
|
+
toolName: Y.string(),
|
|
1510
|
+
input: Y.unknown(),
|
|
1511
1511
|
providerOptions: Z.optional(),
|
|
1512
|
-
providerExecuted:
|
|
1513
|
-
}), Bn =
|
|
1514
|
-
|
|
1515
|
-
type:
|
|
1516
|
-
value:
|
|
1512
|
+
providerExecuted: Y.boolean().optional()
|
|
1513
|
+
}), Bn = Y.discriminatedUnion("type", [
|
|
1514
|
+
Y.object({
|
|
1515
|
+
type: Y.literal("text"),
|
|
1516
|
+
value: Y.string(),
|
|
1517
1517
|
providerOptions: Z.optional()
|
|
1518
1518
|
}),
|
|
1519
|
-
|
|
1520
|
-
type:
|
|
1521
|
-
value:
|
|
1519
|
+
Y.object({
|
|
1520
|
+
type: Y.literal("json"),
|
|
1521
|
+
value: X,
|
|
1522
1522
|
providerOptions: Z.optional()
|
|
1523
1523
|
}),
|
|
1524
|
-
|
|
1525
|
-
type:
|
|
1526
|
-
reason:
|
|
1524
|
+
Y.object({
|
|
1525
|
+
type: Y.literal("execution-denied"),
|
|
1526
|
+
reason: Y.string().optional(),
|
|
1527
1527
|
providerOptions: Z.optional()
|
|
1528
1528
|
}),
|
|
1529
|
-
|
|
1530
|
-
type:
|
|
1531
|
-
value:
|
|
1529
|
+
Y.object({
|
|
1530
|
+
type: Y.literal("error-text"),
|
|
1531
|
+
value: Y.string(),
|
|
1532
1532
|
providerOptions: Z.optional()
|
|
1533
1533
|
}),
|
|
1534
|
-
|
|
1535
|
-
type:
|
|
1536
|
-
value:
|
|
1534
|
+
Y.object({
|
|
1535
|
+
type: Y.literal("error-json"),
|
|
1536
|
+
value: X,
|
|
1537
1537
|
providerOptions: Z.optional()
|
|
1538
1538
|
}),
|
|
1539
|
-
|
|
1540
|
-
type:
|
|
1541
|
-
value:
|
|
1542
|
-
|
|
1543
|
-
type:
|
|
1544
|
-
text:
|
|
1539
|
+
Y.object({
|
|
1540
|
+
type: Y.literal("content"),
|
|
1541
|
+
value: Y.array(Y.union([
|
|
1542
|
+
Y.object({
|
|
1543
|
+
type: Y.literal("text"),
|
|
1544
|
+
text: Y.string(),
|
|
1545
1545
|
providerOptions: Z.optional()
|
|
1546
1546
|
}),
|
|
1547
|
-
|
|
1548
|
-
type:
|
|
1547
|
+
Y.object({
|
|
1548
|
+
type: Y.literal("file"),
|
|
1549
1549
|
data: Nn,
|
|
1550
|
-
mediaType:
|
|
1551
|
-
filename:
|
|
1550
|
+
mediaType: Y.string(),
|
|
1551
|
+
filename: Y.string().optional(),
|
|
1552
1552
|
providerOptions: Z.optional()
|
|
1553
1553
|
}),
|
|
1554
|
-
|
|
1555
|
-
type:
|
|
1556
|
-
data:
|
|
1557
|
-
mediaType:
|
|
1558
|
-
filename:
|
|
1554
|
+
Y.object({
|
|
1555
|
+
type: Y.literal("file-data"),
|
|
1556
|
+
data: Y.string(),
|
|
1557
|
+
mediaType: Y.string(),
|
|
1558
|
+
filename: Y.string().optional(),
|
|
1559
1559
|
providerOptions: Z.optional()
|
|
1560
1560
|
}),
|
|
1561
|
-
|
|
1562
|
-
type:
|
|
1563
|
-
url:
|
|
1564
|
-
mediaType:
|
|
1561
|
+
Y.object({
|
|
1562
|
+
type: Y.literal("file-url"),
|
|
1563
|
+
url: Y.string(),
|
|
1564
|
+
mediaType: Y.string().optional(),
|
|
1565
1565
|
providerOptions: Z.optional()
|
|
1566
1566
|
}),
|
|
1567
|
-
|
|
1568
|
-
type:
|
|
1569
|
-
fileId:
|
|
1567
|
+
Y.object({
|
|
1568
|
+
type: Y.literal("file-id"),
|
|
1569
|
+
fileId: Y.union([Y.string(), Y.record(Y.string(), Y.string())]),
|
|
1570
1570
|
providerOptions: Z.optional()
|
|
1571
1571
|
}),
|
|
1572
|
-
|
|
1573
|
-
type:
|
|
1574
|
-
providerReference:
|
|
1572
|
+
Y.object({
|
|
1573
|
+
type: Y.literal("file-reference"),
|
|
1574
|
+
providerReference: Y.record(Y.string(), Y.string()),
|
|
1575
1575
|
providerOptions: Z.optional()
|
|
1576
1576
|
}),
|
|
1577
|
-
|
|
1578
|
-
type:
|
|
1579
|
-
data:
|
|
1580
|
-
mediaType:
|
|
1577
|
+
Y.object({
|
|
1578
|
+
type: Y.literal("image-data"),
|
|
1579
|
+
data: Y.string(),
|
|
1580
|
+
mediaType: Y.string(),
|
|
1581
1581
|
providerOptions: Z.optional()
|
|
1582
1582
|
}),
|
|
1583
|
-
|
|
1584
|
-
type:
|
|
1585
|
-
url:
|
|
1583
|
+
Y.object({
|
|
1584
|
+
type: Y.literal("image-url"),
|
|
1585
|
+
url: Y.string(),
|
|
1586
1586
|
providerOptions: Z.optional()
|
|
1587
1587
|
}),
|
|
1588
|
-
|
|
1589
|
-
type:
|
|
1590
|
-
fileId:
|
|
1588
|
+
Y.object({
|
|
1589
|
+
type: Y.literal("image-file-id"),
|
|
1590
|
+
fileId: Y.union([Y.string(), Y.record(Y.string(), Y.string())]),
|
|
1591
1591
|
providerOptions: Z.optional()
|
|
1592
1592
|
}),
|
|
1593
|
-
|
|
1594
|
-
type:
|
|
1595
|
-
providerReference:
|
|
1593
|
+
Y.object({
|
|
1594
|
+
type: Y.literal("image-file-reference"),
|
|
1595
|
+
providerReference: Y.record(Y.string(), Y.string()),
|
|
1596
1596
|
providerOptions: Z.optional()
|
|
1597
1597
|
}),
|
|
1598
|
-
|
|
1599
|
-
type:
|
|
1598
|
+
Y.object({
|
|
1599
|
+
type: Y.literal("custom"),
|
|
1600
1600
|
providerOptions: Z.optional()
|
|
1601
1601
|
})
|
|
1602
1602
|
]))
|
|
1603
1603
|
})
|
|
1604
|
-
]), Vn =
|
|
1605
|
-
type:
|
|
1606
|
-
toolCallId:
|
|
1607
|
-
toolName:
|
|
1604
|
+
]), Vn = Y.object({
|
|
1605
|
+
type: Y.literal("tool-result"),
|
|
1606
|
+
toolCallId: Y.string(),
|
|
1607
|
+
toolName: Y.string(),
|
|
1608
1608
|
output: Bn,
|
|
1609
1609
|
providerOptions: Z.optional()
|
|
1610
|
-
}), Hn =
|
|
1611
|
-
type:
|
|
1612
|
-
approvalId:
|
|
1613
|
-
toolCallId:
|
|
1614
|
-
reason:
|
|
1615
|
-
isAutomatic:
|
|
1616
|
-
signature:
|
|
1617
|
-
inputSchemaInput:
|
|
1618
|
-
}), Un =
|
|
1619
|
-
type:
|
|
1620
|
-
approvalId:
|
|
1621
|
-
approved:
|
|
1622
|
-
reason:
|
|
1623
|
-
}), Wn =
|
|
1624
|
-
role:
|
|
1625
|
-
content:
|
|
1610
|
+
}), Hn = Y.object({
|
|
1611
|
+
type: Y.literal("tool-approval-request"),
|
|
1612
|
+
approvalId: Y.string(),
|
|
1613
|
+
toolCallId: Y.string(),
|
|
1614
|
+
reason: Y.string().optional(),
|
|
1615
|
+
isAutomatic: Y.boolean().optional(),
|
|
1616
|
+
signature: Y.string().optional(),
|
|
1617
|
+
inputSchemaInput: Y.unknown().optional()
|
|
1618
|
+
}), Un = Y.object({
|
|
1619
|
+
type: Y.literal("tool-approval-response"),
|
|
1620
|
+
approvalId: Y.string(),
|
|
1621
|
+
approved: Y.boolean(),
|
|
1622
|
+
reason: Y.string().optional()
|
|
1623
|
+
}), Wn = Y.object({
|
|
1624
|
+
role: Y.literal("system"),
|
|
1625
|
+
content: Y.string(),
|
|
1626
1626
|
providerOptions: Z.optional()
|
|
1627
|
-
}), Gn =
|
|
1628
|
-
role:
|
|
1629
|
-
content:
|
|
1627
|
+
}), Gn = Y.object({
|
|
1628
|
+
role: Y.literal("user"),
|
|
1629
|
+
content: Y.union([Y.string(), Y.array(Y.union([
|
|
1630
1630
|
jn,
|
|
1631
1631
|
Mn,
|
|
1632
1632
|
Fn
|
|
1633
1633
|
]))]),
|
|
1634
1634
|
providerOptions: Z.optional()
|
|
1635
|
-
}), Kn =
|
|
1636
|
-
role:
|
|
1637
|
-
content:
|
|
1635
|
+
}), Kn = Y.object({
|
|
1636
|
+
role: Y.literal("assistant"),
|
|
1637
|
+
content: Y.union([Y.string(), Y.array(Y.union([
|
|
1638
1638
|
jn,
|
|
1639
1639
|
Ln,
|
|
1640
1640
|
Fn,
|
|
@@ -1645,12 +1645,12 @@ var X = {
|
|
|
1645
1645
|
Hn
|
|
1646
1646
|
]))]),
|
|
1647
1647
|
providerOptions: Z.optional()
|
|
1648
|
-
}), qn =
|
|
1649
|
-
role:
|
|
1650
|
-
content:
|
|
1648
|
+
}), qn = Y.object({
|
|
1649
|
+
role: Y.literal("tool"),
|
|
1650
|
+
content: Y.array(Y.union([Vn, Un])),
|
|
1651
1651
|
providerOptions: Z.optional()
|
|
1652
1652
|
});
|
|
1653
|
-
|
|
1653
|
+
Y.union([
|
|
1654
1654
|
Wn,
|
|
1655
1655
|
Gn,
|
|
1656
1656
|
Kn,
|
|
@@ -1843,11 +1843,11 @@ async function Yn(e) {
|
|
|
1843
1843
|
value: void 0,
|
|
1844
1844
|
state: "undefined-input"
|
|
1845
1845
|
};
|
|
1846
|
-
let t = await
|
|
1846
|
+
let t = await _n({ text: e });
|
|
1847
1847
|
return t.success ? {
|
|
1848
1848
|
value: t.value,
|
|
1849
1849
|
state: "successful-parse"
|
|
1850
|
-
} : (t = await
|
|
1850
|
+
} : (t = await _n({ text: Jn(e) }), t.success ? {
|
|
1851
1851
|
value: t.value,
|
|
1852
1852
|
state: "repaired-parse"
|
|
1853
1853
|
} : {
|
|
@@ -1855,199 +1855,199 @@ async function Yn(e) {
|
|
|
1855
1855
|
state: "failed-parse"
|
|
1856
1856
|
});
|
|
1857
1857
|
}
|
|
1858
|
-
new TextEncoder(), new TextEncoder(),
|
|
1858
|
+
new TextEncoder(), new TextEncoder(), F({
|
|
1859
1859
|
prefix: "aitxt",
|
|
1860
1860
|
size: 24
|
|
1861
|
-
}),
|
|
1861
|
+
}), F({
|
|
1862
1862
|
prefix: "call",
|
|
1863
1863
|
size: 24
|
|
1864
1864
|
}), TransformStream;
|
|
1865
|
-
var Xn =
|
|
1866
|
-
source:
|
|
1867
|
-
type:
|
|
1868
|
-
sourceType:
|
|
1869
|
-
id:
|
|
1870
|
-
url:
|
|
1871
|
-
title:
|
|
1865
|
+
var Xn = Y.object({
|
|
1866
|
+
source: Y.discriminatedUnion("sourceType", [Y.object({
|
|
1867
|
+
type: Y.literal("source"),
|
|
1868
|
+
sourceType: Y.literal("url"),
|
|
1869
|
+
id: Y.string(),
|
|
1870
|
+
url: Y.string(),
|
|
1871
|
+
title: Y.string().optional(),
|
|
1872
1872
|
providerMetadata: Z.optional()
|
|
1873
|
-
}),
|
|
1874
|
-
type:
|
|
1875
|
-
sourceType:
|
|
1876
|
-
id:
|
|
1877
|
-
mediaType:
|
|
1878
|
-
title:
|
|
1879
|
-
filename:
|
|
1873
|
+
}), Y.object({
|
|
1874
|
+
type: Y.literal("source"),
|
|
1875
|
+
sourceType: Y.literal("document"),
|
|
1876
|
+
id: Y.string(),
|
|
1877
|
+
mediaType: Y.string(),
|
|
1878
|
+
title: Y.string(),
|
|
1879
|
+
filename: Y.string().optional(),
|
|
1880
1880
|
providerMetadata: Z.optional()
|
|
1881
1881
|
})]),
|
|
1882
|
-
startIndex:
|
|
1883
|
-
endIndex:
|
|
1884
|
-
citedText:
|
|
1885
|
-
}), Zn =
|
|
1886
|
-
|
|
1887
|
-
type:
|
|
1888
|
-
id:
|
|
1882
|
+
startIndex: Y.number().int().nonnegative().optional(),
|
|
1883
|
+
endIndex: Y.number().int().nonnegative().optional(),
|
|
1884
|
+
citedText: Y.string().optional()
|
|
1885
|
+
}), Zn = Y.record(Y.string(), X.optional()), Qn = an(() => mn(Y.union([
|
|
1886
|
+
Y.looseObject({
|
|
1887
|
+
type: Y.literal("text-start"),
|
|
1888
|
+
id: Y.string(),
|
|
1889
1889
|
providerMetadata: Z.optional()
|
|
1890
1890
|
}),
|
|
1891
|
-
|
|
1892
|
-
type:
|
|
1893
|
-
id:
|
|
1894
|
-
delta:
|
|
1891
|
+
Y.looseObject({
|
|
1892
|
+
type: Y.literal("text-delta"),
|
|
1893
|
+
id: Y.string(),
|
|
1894
|
+
delta: Y.string(),
|
|
1895
1895
|
providerMetadata: Z.optional()
|
|
1896
1896
|
}),
|
|
1897
|
-
|
|
1898
|
-
type:
|
|
1899
|
-
id:
|
|
1900
|
-
citations:
|
|
1897
|
+
Y.looseObject({
|
|
1898
|
+
type: Y.literal("text-end"),
|
|
1899
|
+
id: Y.string(),
|
|
1900
|
+
citations: Y.array(Xn).optional(),
|
|
1901
1901
|
providerMetadata: Z.optional()
|
|
1902
1902
|
}),
|
|
1903
|
-
|
|
1904
|
-
type:
|
|
1905
|
-
errorText:
|
|
1903
|
+
Y.looseObject({
|
|
1904
|
+
type: Y.literal("error"),
|
|
1905
|
+
errorText: Y.string()
|
|
1906
1906
|
}),
|
|
1907
|
-
|
|
1908
|
-
type:
|
|
1909
|
-
toolCallId:
|
|
1910
|
-
toolName:
|
|
1911
|
-
providerExecuted:
|
|
1907
|
+
Y.looseObject({
|
|
1908
|
+
type: Y.literal("tool-input-start"),
|
|
1909
|
+
toolCallId: Y.string(),
|
|
1910
|
+
toolName: Y.string(),
|
|
1911
|
+
providerExecuted: Y.boolean().optional(),
|
|
1912
1912
|
providerMetadata: Z.optional(),
|
|
1913
1913
|
toolMetadata: Zn.optional(),
|
|
1914
|
-
dynamic:
|
|
1915
|
-
title:
|
|
1914
|
+
dynamic: Y.boolean().optional(),
|
|
1915
|
+
title: Y.string().optional()
|
|
1916
1916
|
}),
|
|
1917
|
-
|
|
1918
|
-
type:
|
|
1919
|
-
toolCallId:
|
|
1920
|
-
inputTextDelta:
|
|
1917
|
+
Y.looseObject({
|
|
1918
|
+
type: Y.literal("tool-input-delta"),
|
|
1919
|
+
toolCallId: Y.string(),
|
|
1920
|
+
inputTextDelta: Y.string()
|
|
1921
1921
|
}),
|
|
1922
|
-
|
|
1923
|
-
type:
|
|
1924
|
-
toolCallId:
|
|
1925
|
-
toolName:
|
|
1926
|
-
input:
|
|
1927
|
-
providerExecuted:
|
|
1922
|
+
Y.looseObject({
|
|
1923
|
+
type: Y.literal("tool-input-available"),
|
|
1924
|
+
toolCallId: Y.string(),
|
|
1925
|
+
toolName: Y.string(),
|
|
1926
|
+
input: Y.unknown(),
|
|
1927
|
+
providerExecuted: Y.boolean().optional(),
|
|
1928
1928
|
providerMetadata: Z.optional(),
|
|
1929
1929
|
toolMetadata: Zn.optional(),
|
|
1930
|
-
dynamic:
|
|
1931
|
-
title:
|
|
1930
|
+
dynamic: Y.boolean().optional(),
|
|
1931
|
+
title: Y.string().optional()
|
|
1932
1932
|
}),
|
|
1933
|
-
|
|
1934
|
-
type:
|
|
1935
|
-
toolCallId:
|
|
1936
|
-
toolName:
|
|
1937
|
-
input:
|
|
1938
|
-
providerExecuted:
|
|
1933
|
+
Y.looseObject({
|
|
1934
|
+
type: Y.literal("tool-input-error"),
|
|
1935
|
+
toolCallId: Y.string(),
|
|
1936
|
+
toolName: Y.string(),
|
|
1937
|
+
input: Y.unknown(),
|
|
1938
|
+
providerExecuted: Y.boolean().optional(),
|
|
1939
1939
|
providerMetadata: Z.optional(),
|
|
1940
1940
|
toolMetadata: Zn.optional(),
|
|
1941
|
-
dynamic:
|
|
1942
|
-
errorText:
|
|
1943
|
-
title:
|
|
1941
|
+
dynamic: Y.boolean().optional(),
|
|
1942
|
+
errorText: Y.string(),
|
|
1943
|
+
title: Y.string().optional()
|
|
1944
1944
|
}),
|
|
1945
|
-
|
|
1946
|
-
type:
|
|
1947
|
-
approvalId:
|
|
1948
|
-
toolCallId:
|
|
1949
|
-
approvalDescriptor:
|
|
1950
|
-
inputSchemaInput:
|
|
1951
|
-
reason:
|
|
1952
|
-
isAutomatic:
|
|
1953
|
-
signature:
|
|
1945
|
+
Y.looseObject({
|
|
1946
|
+
type: Y.literal("tool-approval-request"),
|
|
1947
|
+
approvalId: Y.string(),
|
|
1948
|
+
toolCallId: Y.string(),
|
|
1949
|
+
approvalDescriptor: Y.unknown().optional(),
|
|
1950
|
+
inputSchemaInput: Y.unknown().optional(),
|
|
1951
|
+
reason: Y.string().optional(),
|
|
1952
|
+
isAutomatic: Y.boolean().optional(),
|
|
1953
|
+
signature: Y.string().optional()
|
|
1954
1954
|
}),
|
|
1955
|
-
|
|
1956
|
-
type:
|
|
1957
|
-
approvalId:
|
|
1958
|
-
approved:
|
|
1959
|
-
reason:
|
|
1960
|
-
providerExecuted:
|
|
1955
|
+
Y.looseObject({
|
|
1956
|
+
type: Y.literal("tool-approval-response"),
|
|
1957
|
+
approvalId: Y.string(),
|
|
1958
|
+
approved: Y.boolean(),
|
|
1959
|
+
reason: Y.string().optional(),
|
|
1960
|
+
providerExecuted: Y.boolean().optional(),
|
|
1961
1961
|
providerMetadata: Z.optional()
|
|
1962
1962
|
}),
|
|
1963
|
-
|
|
1964
|
-
type:
|
|
1965
|
-
toolCallId:
|
|
1966
|
-
output:
|
|
1967
|
-
providerExecuted:
|
|
1963
|
+
Y.looseObject({
|
|
1964
|
+
type: Y.literal("tool-output-available"),
|
|
1965
|
+
toolCallId: Y.string(),
|
|
1966
|
+
output: Y.unknown(),
|
|
1967
|
+
providerExecuted: Y.boolean().optional(),
|
|
1968
1968
|
providerMetadata: Z.optional(),
|
|
1969
1969
|
toolMetadata: Zn.optional(),
|
|
1970
|
-
dynamic:
|
|
1971
|
-
preliminary:
|
|
1970
|
+
dynamic: Y.boolean().optional(),
|
|
1971
|
+
preliminary: Y.boolean().optional()
|
|
1972
1972
|
}),
|
|
1973
|
-
|
|
1974
|
-
type:
|
|
1975
|
-
toolCallId:
|
|
1976
|
-
errorText:
|
|
1977
|
-
providerExecuted:
|
|
1973
|
+
Y.looseObject({
|
|
1974
|
+
type: Y.literal("tool-output-error"),
|
|
1975
|
+
toolCallId: Y.string(),
|
|
1976
|
+
errorText: Y.string(),
|
|
1977
|
+
providerExecuted: Y.boolean().optional(),
|
|
1978
1978
|
providerMetadata: Z.optional(),
|
|
1979
1979
|
toolMetadata: Zn.optional(),
|
|
1980
|
-
dynamic:
|
|
1980
|
+
dynamic: Y.boolean().optional()
|
|
1981
1981
|
}),
|
|
1982
|
-
|
|
1983
|
-
type:
|
|
1984
|
-
toolCallId:
|
|
1982
|
+
Y.looseObject({
|
|
1983
|
+
type: Y.literal("tool-output-denied"),
|
|
1984
|
+
toolCallId: Y.string()
|
|
1985
1985
|
}),
|
|
1986
|
-
|
|
1987
|
-
type:
|
|
1988
|
-
id:
|
|
1986
|
+
Y.looseObject({
|
|
1987
|
+
type: Y.literal("reasoning-start"),
|
|
1988
|
+
id: Y.string(),
|
|
1989
1989
|
providerMetadata: Z.optional()
|
|
1990
1990
|
}),
|
|
1991
|
-
|
|
1992
|
-
type:
|
|
1993
|
-
id:
|
|
1994
|
-
delta:
|
|
1991
|
+
Y.looseObject({
|
|
1992
|
+
type: Y.literal("reasoning-delta"),
|
|
1993
|
+
id: Y.string(),
|
|
1994
|
+
delta: Y.string(),
|
|
1995
1995
|
providerMetadata: Z.optional()
|
|
1996
1996
|
}),
|
|
1997
|
-
|
|
1998
|
-
type:
|
|
1999
|
-
id:
|
|
1997
|
+
Y.looseObject({
|
|
1998
|
+
type: Y.literal("reasoning-end"),
|
|
1999
|
+
id: Y.string(),
|
|
2000
2000
|
providerMetadata: Z.optional()
|
|
2001
2001
|
}),
|
|
2002
|
-
|
|
2003
|
-
type:
|
|
2004
|
-
kind:
|
|
2002
|
+
Y.looseObject({
|
|
2003
|
+
type: Y.literal("custom"),
|
|
2004
|
+
kind: Y.string().transform((e) => e),
|
|
2005
2005
|
providerMetadata: Z.optional()
|
|
2006
2006
|
}),
|
|
2007
|
-
|
|
2008
|
-
type:
|
|
2009
|
-
sourceId:
|
|
2010
|
-
url:
|
|
2011
|
-
title:
|
|
2007
|
+
Y.looseObject({
|
|
2008
|
+
type: Y.literal("source-url"),
|
|
2009
|
+
sourceId: Y.string(),
|
|
2010
|
+
url: Y.string(),
|
|
2011
|
+
title: Y.string().optional(),
|
|
2012
2012
|
providerMetadata: Z.optional()
|
|
2013
2013
|
}),
|
|
2014
|
-
|
|
2015
|
-
type:
|
|
2016
|
-
sourceId:
|
|
2017
|
-
mediaType:
|
|
2018
|
-
title:
|
|
2019
|
-
filename:
|
|
2014
|
+
Y.looseObject({
|
|
2015
|
+
type: Y.literal("source-document"),
|
|
2016
|
+
sourceId: Y.string(),
|
|
2017
|
+
mediaType: Y.string(),
|
|
2018
|
+
title: Y.string(),
|
|
2019
|
+
filename: Y.string().optional(),
|
|
2020
2020
|
providerMetadata: Z.optional()
|
|
2021
2021
|
}),
|
|
2022
|
-
|
|
2023
|
-
type:
|
|
2024
|
-
url:
|
|
2025
|
-
mediaType:
|
|
2022
|
+
Y.looseObject({
|
|
2023
|
+
type: Y.literal("file"),
|
|
2024
|
+
url: Y.string(),
|
|
2025
|
+
mediaType: Y.string(),
|
|
2026
2026
|
providerMetadata: Z.optional()
|
|
2027
2027
|
}),
|
|
2028
|
-
|
|
2029
|
-
type:
|
|
2030
|
-
url:
|
|
2031
|
-
mediaType:
|
|
2028
|
+
Y.looseObject({
|
|
2029
|
+
type: Y.literal("reasoning-file"),
|
|
2030
|
+
url: Y.string(),
|
|
2031
|
+
mediaType: Y.string(),
|
|
2032
2032
|
providerMetadata: Z.optional()
|
|
2033
2033
|
}),
|
|
2034
|
-
|
|
2035
|
-
type:
|
|
2036
|
-
id:
|
|
2037
|
-
data:
|
|
2038
|
-
transient:
|
|
2034
|
+
Y.looseObject({
|
|
2035
|
+
type: Y.custom((e) => typeof e == "string" && e.startsWith("data-"), { message: "Type must start with \"data-\"" }),
|
|
2036
|
+
id: Y.string().optional(),
|
|
2037
|
+
data: Y.unknown(),
|
|
2038
|
+
transient: Y.boolean().optional()
|
|
2039
2039
|
}),
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
type:
|
|
2045
|
-
messageId:
|
|
2046
|
-
messageMetadata:
|
|
2040
|
+
Y.looseObject({ type: Y.literal("start-step") }),
|
|
2041
|
+
Y.looseObject({ type: Y.literal("finish-step") }),
|
|
2042
|
+
Y.looseObject({ type: Y.literal("reset-step") }),
|
|
2043
|
+
Y.looseObject({
|
|
2044
|
+
type: Y.literal("start"),
|
|
2045
|
+
messageId: Y.string().optional(),
|
|
2046
|
+
messageMetadata: Y.unknown().optional()
|
|
2047
2047
|
}),
|
|
2048
|
-
|
|
2049
|
-
type:
|
|
2050
|
-
finishReason:
|
|
2048
|
+
Y.looseObject({
|
|
2049
|
+
type: Y.literal("finish"),
|
|
2050
|
+
finishReason: Y.enum([
|
|
2051
2051
|
"stop",
|
|
2052
2052
|
"length",
|
|
2053
2053
|
"content-filter",
|
|
@@ -2055,15 +2055,15 @@ var Xn = X.object({
|
|
|
2055
2055
|
"error",
|
|
2056
2056
|
"other"
|
|
2057
2057
|
]).optional(),
|
|
2058
|
-
messageMetadata:
|
|
2058
|
+
messageMetadata: Y.unknown().optional()
|
|
2059
2059
|
}),
|
|
2060
|
-
|
|
2061
|
-
type:
|
|
2062
|
-
reason:
|
|
2060
|
+
Y.looseObject({
|
|
2061
|
+
type: Y.literal("abort"),
|
|
2062
|
+
reason: Y.string().optional()
|
|
2063
2063
|
}),
|
|
2064
|
-
|
|
2065
|
-
type:
|
|
2066
|
-
messageMetadata:
|
|
2064
|
+
Y.looseObject({
|
|
2065
|
+
type: Y.literal("message-metadata"),
|
|
2066
|
+
messageMetadata: Y.unknown()
|
|
2067
2067
|
})
|
|
2068
2068
|
])));
|
|
2069
2069
|
function $n(e) {
|
|
@@ -2134,7 +2134,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2134
2134
|
}
|
|
2135
2135
|
}
|
|
2136
2136
|
}
|
|
2137
|
-
if (t == null) throw new
|
|
2137
|
+
if (t == null) throw new Dn({
|
|
2138
2138
|
chunkType: "tool-invocation",
|
|
2139
2139
|
chunkId: e,
|
|
2140
2140
|
message: `No tool invocation found for tool call ID "${e}".`
|
|
@@ -2143,7 +2143,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2143
2143
|
}
|
|
2144
2144
|
function h(e) {
|
|
2145
2145
|
let t = r.message.parts.filter(Q).find((t) => t.approval?.id === e);
|
|
2146
|
-
if (t == null) throw new
|
|
2146
|
+
if (t == null) throw new Dn({
|
|
2147
2147
|
chunkType: "tool-approval-response",
|
|
2148
2148
|
chunkId: e,
|
|
2149
2149
|
message: `No tool invocation found for approval ID "${e}".`
|
|
@@ -2206,8 +2206,8 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2206
2206
|
}
|
|
2207
2207
|
async function v(e) {
|
|
2208
2208
|
if (e != null) {
|
|
2209
|
-
let n = r.message.metadata == null ? e :
|
|
2210
|
-
t != null && await
|
|
2209
|
+
let n = r.message.metadata == null ? e : On(r.message.metadata, e);
|
|
2210
|
+
t != null && await hn({
|
|
2211
2211
|
value: n,
|
|
2212
2212
|
schema: t,
|
|
2213
2213
|
context: {
|
|
@@ -2230,7 +2230,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2230
2230
|
}
|
|
2231
2231
|
case "text-delta": {
|
|
2232
2232
|
let t = r.activeTextParts[e.id];
|
|
2233
|
-
if (t == null) throw new
|
|
2233
|
+
if (t == null) throw new Dn({
|
|
2234
2234
|
chunkType: "text-delta",
|
|
2235
2235
|
chunkId: e.id,
|
|
2236
2236
|
message: `Received text-delta for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`
|
|
@@ -2240,7 +2240,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2240
2240
|
}
|
|
2241
2241
|
case "text-end": {
|
|
2242
2242
|
let t = r.activeTextParts[e.id];
|
|
2243
|
-
if (t == null) throw new
|
|
2243
|
+
if (t == null) throw new Dn({
|
|
2244
2244
|
chunkType: "text-end",
|
|
2245
2245
|
chunkId: e.id,
|
|
2246
2246
|
message: `Received text-end for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`
|
|
@@ -2270,7 +2270,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2270
2270
|
}
|
|
2271
2271
|
case "reasoning-delta": {
|
|
2272
2272
|
let t = r.activeReasoningParts[e.id];
|
|
2273
|
-
if (t == null) throw new
|
|
2273
|
+
if (t == null) throw new Dn({
|
|
2274
2274
|
chunkType: "reasoning-delta",
|
|
2275
2275
|
chunkId: e.id,
|
|
2276
2276
|
message: `Received reasoning-delta for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`
|
|
@@ -2280,7 +2280,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2280
2280
|
}
|
|
2281
2281
|
case "reasoning-end": {
|
|
2282
2282
|
let t = r.activeReasoningParts[e.id];
|
|
2283
|
-
if (t == null) throw new
|
|
2283
|
+
if (t == null) throw new Dn({
|
|
2284
2284
|
chunkType: "reasoning-end",
|
|
2285
2285
|
chunkId: e.id,
|
|
2286
2286
|
message: `Received reasoning-end for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`
|
|
@@ -2348,7 +2348,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2348
2348
|
}
|
|
2349
2349
|
case "tool-input-delta": {
|
|
2350
2350
|
let t = r.partialToolCalls[e.toolCallId];
|
|
2351
|
-
if (t == null) throw new
|
|
2351
|
+
if (t == null) throw new Dn({
|
|
2352
2352
|
chunkType: "tool-input-delta",
|
|
2353
2353
|
chunkId: e.toolCallId,
|
|
2354
2354
|
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.`
|
|
@@ -2527,7 +2527,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2527
2527
|
default: if ($n(e)) {
|
|
2528
2528
|
if (n?.[e.type] != null) {
|
|
2529
2529
|
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;
|
|
2530
|
-
await
|
|
2530
|
+
await hn({
|
|
2531
2531
|
value: e.data,
|
|
2532
2532
|
schema: n[e.type],
|
|
2533
2533
|
context: {
|
|
@@ -2576,28 +2576,28 @@ function sr() {
|
|
|
2576
2576
|
reject: t
|
|
2577
2577
|
};
|
|
2578
2578
|
}
|
|
2579
|
-
|
|
2579
|
+
F({
|
|
2580
2580
|
prefix: "aitxt",
|
|
2581
2581
|
size: 24
|
|
2582
|
-
}),
|
|
2582
|
+
}), F({
|
|
2583
2583
|
prefix: "call",
|
|
2584
2584
|
size: 24
|
|
2585
|
-
}),
|
|
2585
|
+
}), F({
|
|
2586
2586
|
prefix: "aitxt",
|
|
2587
2587
|
size: 24
|
|
2588
|
-
}),
|
|
2588
|
+
}), F({
|
|
2589
2589
|
prefix: "call",
|
|
2590
2590
|
size: 24
|
|
2591
|
-
}),
|
|
2591
|
+
}), Y.record(Y.string(), X.optional()), Y.record(Y.string(), Y.string()), F({
|
|
2592
2592
|
prefix: "call",
|
|
2593
2593
|
size: 24
|
|
2594
|
-
}),
|
|
2594
|
+
}), F({
|
|
2595
2595
|
prefix: "call",
|
|
2596
2596
|
size: 24
|
|
2597
|
-
}), new TextEncoder(),
|
|
2597
|
+
}), new TextEncoder(), F({
|
|
2598
2598
|
prefix: "call",
|
|
2599
2599
|
size: 24
|
|
2600
|
-
}),
|
|
2600
|
+
}), F({
|
|
2601
2601
|
prefix: "aiobj",
|
|
2602
2602
|
size: 24
|
|
2603
2603
|
});
|
|
@@ -2633,15 +2633,15 @@ var { atob: cr } = globalThis, lr = class {
|
|
|
2633
2633
|
});
|
|
2634
2634
|
}
|
|
2635
2635
|
};
|
|
2636
|
-
|
|
2636
|
+
F({
|
|
2637
2637
|
prefix: "aiobj",
|
|
2638
2638
|
size: 24
|
|
2639
|
-
}),
|
|
2639
|
+
}), F({
|
|
2640
2640
|
prefix: "call",
|
|
2641
2641
|
size: 24
|
|
2642
|
-
}),
|
|
2643
|
-
token:
|
|
2644
|
-
url:
|
|
2642
|
+
}), Y.object({
|
|
2643
|
+
token: Y.string().refine((e) => e.trim().length > 0),
|
|
2644
|
+
url: Y.string().refine((e) => {
|
|
2645
2645
|
try {
|
|
2646
2646
|
let t = new URL(e);
|
|
2647
2647
|
return (t.protocol === "ws:" || t.protocol === "wss:") && t.hostname !== "";
|
|
@@ -2649,26 +2649,26 @@ I({
|
|
|
2649
2649
|
return !1;
|
|
2650
2650
|
}
|
|
2651
2651
|
}),
|
|
2652
|
-
expiresAt:
|
|
2653
|
-
tools:
|
|
2654
|
-
type:
|
|
2655
|
-
name:
|
|
2656
|
-
description:
|
|
2657
|
-
parameters:
|
|
2652
|
+
expiresAt: Y.number().positive().max(2 ** 53 - 1).optional(),
|
|
2653
|
+
tools: Y.array(Y.object({
|
|
2654
|
+
type: Y.literal("function"),
|
|
2655
|
+
name: Y.string().min(1),
|
|
2656
|
+
description: Y.string().optional(),
|
|
2657
|
+
parameters: Y.record(Y.string(), Y.unknown())
|
|
2658
2658
|
})).optional()
|
|
2659
|
-
}),
|
|
2659
|
+
}), F({
|
|
2660
2660
|
prefix: "call",
|
|
2661
2661
|
size: 24
|
|
2662
|
-
}),
|
|
2662
|
+
}), F({
|
|
2663
2663
|
prefix: "call",
|
|
2664
2664
|
size: 24
|
|
2665
|
-
}),
|
|
2665
|
+
}), F({
|
|
2666
2666
|
prefix: "call",
|
|
2667
2667
|
size: 24
|
|
2668
2668
|
});
|
|
2669
2669
|
async function ur({ response: e, url: t, fallbackMessage: n }) {
|
|
2670
2670
|
let r = await e.text();
|
|
2671
|
-
return new
|
|
2671
|
+
return new Ie({
|
|
2672
2672
|
message: r || n,
|
|
2673
2673
|
url: t,
|
|
2674
2674
|
requestBodyValues: void 0,
|
|
@@ -2678,7 +2678,7 @@ async function ur({ response: e, url: t, fallbackMessage: n }) {
|
|
|
2678
2678
|
}
|
|
2679
2679
|
async function dr(e) {
|
|
2680
2680
|
if (e == null) return [];
|
|
2681
|
-
if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new
|
|
2681
|
+
if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new $e({
|
|
2682
2682
|
functionality: "FileList",
|
|
2683
2683
|
message: "FileList is not supported in the current environment"
|
|
2684
2684
|
});
|
|
@@ -2706,9 +2706,9 @@ var pr = class {
|
|
|
2706
2706
|
this.api = e, this.credentials = t, this.headers = n, this.body = r, this.fetch = i, this.prepareSendMessagesRequest = a, this.prepareReconnectToStreamRequest = o;
|
|
2707
2707
|
}
|
|
2708
2708
|
async sendMessages({ abortSignal: e, ...t }) {
|
|
2709
|
-
let n = await
|
|
2710
|
-
...
|
|
2711
|
-
...
|
|
2709
|
+
let n = await yn(this.body), r = await yn(this.headers), i = await yn(this.credentials), a = {
|
|
2710
|
+
...P(r),
|
|
2711
|
+
...P(t.headers)
|
|
2712
2712
|
}, o = await this.prepareSendMessagesRequest?.({
|
|
2713
2713
|
api: this.api,
|
|
2714
2714
|
id: t.chatId,
|
|
@@ -2722,7 +2722,7 @@ var pr = class {
|
|
|
2722
2722
|
requestMetadata: t.metadata,
|
|
2723
2723
|
trigger: t.trigger,
|
|
2724
2724
|
messageId: t.messageId
|
|
2725
|
-
}), s = o?.api ?? this.api, c = o?.headers === void 0 ? a :
|
|
2725
|
+
}), s = o?.api ?? this.api, c = o?.headers === void 0 ? a : P(o.headers), l = o?.body === void 0 ? {
|
|
2726
2726
|
...n,
|
|
2727
2727
|
...t.body,
|
|
2728
2728
|
id: t.chatId,
|
|
@@ -2744,13 +2744,13 @@ var pr = class {
|
|
|
2744
2744
|
url: s,
|
|
2745
2745
|
fallbackMessage: "Failed to fetch the chat response."
|
|
2746
2746
|
});
|
|
2747
|
-
if (!d.body) throw new
|
|
2747
|
+
if (!d.body) throw new Re({ message: "The response body is empty." });
|
|
2748
2748
|
return this.processResponseStream(d.body);
|
|
2749
2749
|
}
|
|
2750
2750
|
async reconnectToStream(e) {
|
|
2751
|
-
let t = await
|
|
2752
|
-
...
|
|
2753
|
-
...
|
|
2751
|
+
let t = await yn(this.body), n = await yn(this.headers), r = await yn(this.credentials), i = {
|
|
2752
|
+
...P(n),
|
|
2753
|
+
...P(e.headers)
|
|
2754
2754
|
}, a = await this.prepareReconnectToStreamRequest?.({
|
|
2755
2755
|
api: this.api,
|
|
2756
2756
|
id: e.chatId,
|
|
@@ -2763,14 +2763,14 @@ var pr = class {
|
|
|
2763
2763
|
requestMetadata: e.metadata
|
|
2764
2764
|
}), o = a?.api;
|
|
2765
2765
|
if (o == null) {
|
|
2766
|
-
if (e.chatId === "." || e.chatId === "..") throw new
|
|
2766
|
+
if (e.chatId === "." || e.chatId === "..") throw new Cn({
|
|
2767
2767
|
parameter: "chatId",
|
|
2768
2768
|
value: e.chatId,
|
|
2769
2769
|
message: "Chat IDs must not be \".\" or \"..\" when using the default reconnect URL."
|
|
2770
2770
|
});
|
|
2771
2771
|
o = fr(this.api, `/${encodeURIComponent(e.chatId)}/stream`);
|
|
2772
2772
|
}
|
|
2773
|
-
let s = a?.headers === void 0 ? i :
|
|
2773
|
+
let s = a?.headers === void 0 ? i : P(a.headers), c = a?.credentials ?? r, l = await (this.fetch ?? globalThis.fetch)(o, {
|
|
2774
2774
|
method: "GET",
|
|
2775
2775
|
headers: s,
|
|
2776
2776
|
credentials: c,
|
|
@@ -2782,7 +2782,7 @@ var pr = class {
|
|
|
2782
2782
|
url: o,
|
|
2783
2783
|
fallbackMessage: "Failed to fetch the chat response."
|
|
2784
2784
|
});
|
|
2785
|
-
if (!l.body) throw new
|
|
2785
|
+
if (!l.body) throw new Re({ message: "The response body is empty." });
|
|
2786
2786
|
return this.processResponseStream(l.body);
|
|
2787
2787
|
}
|
|
2788
2788
|
}, mr = class extends pr {
|
|
@@ -2790,7 +2790,7 @@ var pr = class {
|
|
|
2790
2790
|
super(t), this.resumeStreamIsReplay = e;
|
|
2791
2791
|
}
|
|
2792
2792
|
processResponseStream(e) {
|
|
2793
|
-
return
|
|
2793
|
+
return vn({
|
|
2794
2794
|
stream: e,
|
|
2795
2795
|
schema: Qn
|
|
2796
2796
|
}).pipeThrough(new TransformStream({ async transform(e, t) {
|
|
@@ -2799,7 +2799,7 @@ var pr = class {
|
|
|
2799
2799
|
} }));
|
|
2800
2800
|
}
|
|
2801
2801
|
}, hr = class {
|
|
2802
|
-
constructor({ generateId: e =
|
|
2802
|
+
constructor({ generateId: e = st, id: t = e(), transport: n = new mr(), messageMetadataSchema: r, dataPartSchemas: i, state: a, onError: o, onToolCall: s, onFinish: c, onData: l, sendAutomaticallyWhen: u }) {
|
|
2803
2803
|
this.pendingMessagePreparations = /* @__PURE__ */ new Set(), this.activeResponse = void 0, this.activeResumeRequest = void 0, this.resumableStreamState = void 0, this.jobExecutor = new lr(), this.activeStopCount = 0, this.stopGeneration = 0, this.sendMessage = async (e, t) => {
|
|
2804
2804
|
if (e == null) {
|
|
2805
2805
|
let e = this.pendingApprovalMessageId;
|
|
@@ -2839,12 +2839,12 @@ var pr = class {
|
|
|
2839
2839
|
} else n = e;
|
|
2840
2840
|
if (e.messageId != null) {
|
|
2841
2841
|
let t = this.state.messages.findIndex((t) => t.id === e.messageId);
|
|
2842
|
-
if (t === -1) throw new
|
|
2842
|
+
if (t === -1) throw new Cn({
|
|
2843
2843
|
parameter: "message.messageId",
|
|
2844
2844
|
value: e.messageId,
|
|
2845
2845
|
message: `message with id ${e.messageId} not found`
|
|
2846
2846
|
});
|
|
2847
|
-
if (this.state.messages[t].role !== "user") throw new
|
|
2847
|
+
if (this.state.messages[t].role !== "user") throw new Cn({
|
|
2848
2848
|
parameter: "message.messageId",
|
|
2849
2849
|
value: e.messageId,
|
|
2850
2850
|
message: `message with id ${e.messageId} is not a user message`
|
|
@@ -2868,7 +2868,7 @@ var pr = class {
|
|
|
2868
2868
|
});
|
|
2869
2869
|
}, this.regenerate = async ({ messageId: e, ...t } = {}) => {
|
|
2870
2870
|
let n = e == null ? this.state.messages.length - 1 : this.state.messages.findIndex((t) => t.id === e);
|
|
2871
|
-
if (n === -1) throw new
|
|
2871
|
+
if (n === -1) throw new Cn({
|
|
2872
2872
|
parameter: "messageId",
|
|
2873
2873
|
value: e,
|
|
2874
2874
|
message: `message ${e} not found`
|
|
@@ -3057,7 +3057,7 @@ var pr = class {
|
|
|
3057
3057
|
status: "submitted",
|
|
3058
3058
|
error: void 0
|
|
3059
3059
|
});
|
|
3060
|
-
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,
|
|
3060
|
+
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;
|
|
3061
3061
|
try {
|
|
3062
3062
|
let s = {
|
|
3063
3063
|
state: e === "resume-stream" && this.resumableStreamState != null ? this.resumableStreamState : ir({
|
|
@@ -3067,7 +3067,7 @@ var pr = class {
|
|
|
3067
3067
|
abortController: o,
|
|
3068
3068
|
completionPromise: a
|
|
3069
3069
|
};
|
|
3070
|
-
|
|
3070
|
+
y = s, s.abortController.signal.addEventListener("abort", () => {
|
|
3071
3071
|
_ = !0;
|
|
3072
3072
|
}), this.activeResponse = s;
|
|
3073
3073
|
let l;
|
|
@@ -3113,31 +3113,31 @@ var pr = class {
|
|
|
3113
3113
|
}), _) return c() && (this.setStatus({ status: "ready" }), this.resumableStreamState === s.state && (this.resumableStreamState = void 0)), null;
|
|
3114
3114
|
c() && (this.setStatus({ status: "ready" }), this.resumableStreamState === s.state && (this.resumableStreamState = void 0));
|
|
3115
3115
|
} catch (e) {
|
|
3116
|
-
if (_ || e.name === "AbortError") return _ = !0, c() && (this.setStatus({ status: "ready" }), this.resumableStreamState ===
|
|
3116
|
+
if (_ || e.name === "AbortError") return _ = !0, c() && (this.setStatus({ status: "ready" }), this.resumableStreamState === y?.state && (this.resumableStreamState = void 0)), null;
|
|
3117
3117
|
if (!c()) return null;
|
|
3118
|
-
if (
|
|
3118
|
+
if (ee = !0, e instanceof TypeError) {
|
|
3119
3119
|
let t = e.message.toLowerCase();
|
|
3120
3120
|
v = t.includes("fetch") || t.includes("network") || t === "load failed";
|
|
3121
3121
|
}
|
|
3122
|
-
v ? this.resumableStreamState =
|
|
3122
|
+
v ? this.resumableStreamState = y?.state : this.resumableStreamState === y?.state && (this.resumableStreamState = void 0), this.onError && e instanceof Error && this.onError(e), this.setStatus({
|
|
3123
3123
|
status: "error",
|
|
3124
3124
|
error: e
|
|
3125
3125
|
});
|
|
3126
3126
|
} finally {
|
|
3127
3127
|
try {
|
|
3128
|
-
|
|
3129
|
-
message:
|
|
3128
|
+
y && this.onFinish?.({
|
|
3129
|
+
message: y.state.message,
|
|
3130
3130
|
messages: this.state.messages,
|
|
3131
3131
|
isAbort: _,
|
|
3132
3132
|
isDisconnect: v,
|
|
3133
|
-
isError:
|
|
3134
|
-
finishReason:
|
|
3133
|
+
isError: ee,
|
|
3134
|
+
finishReason: y.state.finishReason
|
|
3135
3135
|
});
|
|
3136
3136
|
} finally {
|
|
3137
|
-
this.activeResponse ===
|
|
3137
|
+
this.activeResponse === y && (this.activeResponse = void 0), l();
|
|
3138
3138
|
}
|
|
3139
3139
|
}
|
|
3140
|
-
!_ && !
|
|
3140
|
+
!_ && !ee && await this.runAutomaticRequest(() => this.makeRequest({
|
|
3141
3141
|
trigger: "submit-message",
|
|
3142
3142
|
messageId: this.lastMessage?.id,
|
|
3143
3143
|
metadata: t,
|
|
@@ -3411,13 +3411,13 @@ var Ir = function(e, t, n, r) {
|
|
|
3411
3411
|
function Lr() {
|
|
3412
3412
|
for (var e = this, t = [], n = 0; n < arguments.length; n++) t[n] = arguments[n];
|
|
3413
3413
|
var r, i, a = $({}, Mr), o = !1, s = !1;
|
|
3414
|
-
if (!
|
|
3414
|
+
if (!me()) return console.error("useSWRV must be called inside setup() or an active effectScope()."), null;
|
|
3415
3415
|
var c = typeof window > "u" || typeof document > "u";
|
|
3416
3416
|
t.length >= 1 && (r = t[0]), t.length >= 2 && (i = t[1]), t.length > 2 && (a = $($({}, a), t[2]));
|
|
3417
|
-
var l = c ? a.serverTTL : a.ttl, u = typeof r == "function" ? r :
|
|
3417
|
+
var l = c ? a.serverTTL : a.ttl, u = typeof r == "function" ? r : x(r);
|
|
3418
3418
|
i === void 0 && (i = a.fetcher);
|
|
3419
3419
|
var d = null;
|
|
3420
|
-
d ||=
|
|
3420
|
+
d ||= ve({
|
|
3421
3421
|
data: void 0,
|
|
3422
3422
|
error: void 0,
|
|
3423
3423
|
isValidating: !0,
|
|
@@ -3487,7 +3487,7 @@ function Lr() {
|
|
|
3487
3487
|
};
|
|
3488
3488
|
a.refreshInterval && (m = setTimeout(h, a.refreshInterval)), a.revalidateOnFocus && (document.addEventListener("visibilitychange", p, !1), window.addEventListener("focus", p, !1));
|
|
3489
3489
|
}
|
|
3490
|
-
|
|
3490
|
+
_e(function() {
|
|
3491
3491
|
o = !0, m &&= (clearTimeout(m), null), !c && a.revalidateOnFocus && (document.removeEventListener("visibilitychange", p, !1), window.removeEventListener("focus", p, !1));
|
|
3492
3492
|
var e = Ar.get(u.value);
|
|
3493
3493
|
e && (e.data = e.data.filter(function(e) {
|
|
@@ -3495,11 +3495,11 @@ function Lr() {
|
|
|
3495
3495
|
}));
|
|
3496
3496
|
});
|
|
3497
3497
|
try {
|
|
3498
|
-
|
|
3499
|
-
|
|
3498
|
+
C(u, function(e) {
|
|
3499
|
+
he(u) || (u.value = e), d.key = e, d.isValidating = !!e, Nr(u.value, d, l), !c && !s && u.value && f(), s = !1;
|
|
3500
3500
|
}, { immediate: !0 });
|
|
3501
3501
|
} catch {}
|
|
3502
|
-
return $($({},
|
|
3502
|
+
return $($({}, ye(d)), { mutate: function(e, t) {
|
|
3503
3503
|
return f(e, $($({}, t), { forceRevalidate: !0 }));
|
|
3504
3504
|
} });
|
|
3505
3505
|
}
|
|
@@ -3588,10 +3588,10 @@ var Hr = class {
|
|
|
3588
3588
|
}
|
|
3589
3589
|
};
|
|
3590
3590
|
function Wr(e) {
|
|
3591
|
-
let t =
|
|
3592
|
-
return
|
|
3591
|
+
let t = S([]), n = S("ready"), r = S(), i = S(), a;
|
|
3592
|
+
return C(t, (e) => {
|
|
3593
3593
|
a != null && !a.isPublishing && a.setMessagesFromConsumer(e);
|
|
3594
|
-
}, { flush: "sync" }),
|
|
3594
|
+
}, { flush: "sync" }), C(() => be(e), (e) => {
|
|
3595
3595
|
a?.dispose();
|
|
3596
3596
|
let { throttle: o, ...s } = e ?? {}, c = new Hr({
|
|
3597
3597
|
initialMessages: s.messages ?? [],
|
|
@@ -3604,10 +3604,10 @@ function Wr(e) {
|
|
|
3604
3604
|
...s,
|
|
3605
3605
|
state: c
|
|
3606
3606
|
});
|
|
3607
|
-
}, { immediate: !0 }),
|
|
3607
|
+
}, { immediate: !0 }), me() != null && _e(() => {
|
|
3608
3608
|
a?.dispose();
|
|
3609
3609
|
}), {
|
|
3610
|
-
id:
|
|
3610
|
+
id: b(() => i.value.id),
|
|
3611
3611
|
status: n,
|
|
3612
3612
|
messages: t,
|
|
3613
3613
|
error: r,
|
|
@@ -3638,36 +3638,36 @@ var Gr = "voice-", Kr = (e) => e?.role === "assistant" && e.parts.some((e) => e.
|
|
|
3638
3638
|
}, ei = ({ messages: e }) => {
|
|
3639
3639
|
let t = e[e.length - 1];
|
|
3640
3640
|
if (!t || t.role !== "assistant") return !1;
|
|
3641
|
-
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 && (
|
|
3642
|
-
return r.length > 0 && r.every((e) =>
|
|
3641
|
+
let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter((e) => !e.providerExecuted && (te($r(e)) || ie(e)));
|
|
3642
|
+
return r.length > 0 && r.every((e) => se.has(e.state ?? ""));
|
|
3643
3643
|
};
|
|
3644
3644
|
function ti(e) {
|
|
3645
|
-
return
|
|
3646
|
-
let { t, te: n, locale: r } =
|
|
3645
|
+
return we(`chatbot-${e}`, () => {
|
|
3646
|
+
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(), y = x(), te = x(), ae = x(), oe = x(), se = S(), me = x(0), he = x(), _e = S(), ye = S(), be = x(), we = x(!1), Oe = x(0), Me = x(), Ne = x(!1), w = Ce(), Pe = b(() => {
|
|
3647
3647
|
let e = u.value?.theme;
|
|
3648
|
-
return (!e || e === "auto") && (e =
|
|
3649
|
-
}),
|
|
3648
|
+
return (!e || e === "auto") && (e = Me.value), e ? e === "dark" : w.value;
|
|
3649
|
+
}), T = b(() => c.value === "reasoning"), Fe = b(() => T.value ? g.value?.filter((e) => ![
|
|
3650
3650
|
"upvote",
|
|
3651
3651
|
"downvote",
|
|
3652
3652
|
"feedback"
|
|
3653
|
-
].includes(e)) : g.value),
|
|
3654
|
-
|
|
3655
|
-
|
|
3653
|
+
].includes(e)) : g.value), Ie = pe(b(() => `${o.value}-chatId`), null);
|
|
3654
|
+
xe(() => {
|
|
3655
|
+
Ie.value ||= st();
|
|
3656
3656
|
});
|
|
3657
|
-
let
|
|
3658
|
-
get: () =>
|
|
3657
|
+
let E = b({
|
|
3658
|
+
get: () => Ie.value,
|
|
3659
3659
|
set: (e) => {
|
|
3660
|
-
|
|
3660
|
+
Ie.value = e;
|
|
3661
3661
|
}
|
|
3662
|
-
}),
|
|
3663
|
-
let e =
|
|
3664
|
-
return e && e !==
|
|
3662
|
+
}), D = fe(b(() => `${o.value}-pageAccessOff`), !1), Le = b(() => D.value ? [] : _e.value ?? []), Re = () => D.value ? [] : ye.value?.() ?? [], ze = b(() => !!(he.value && _e.value?.length)), Be = pe(b(() => `${o.value}-pageNotice`), null), Ve = b(() => {
|
|
3663
|
+
let e = he.value?.level;
|
|
3664
|
+
return e && e !== re.Off && Le.value.length && !ee(Be.value ?? void 0, e) ? e : void 0;
|
|
3665
3665
|
});
|
|
3666
|
-
function
|
|
3667
|
-
|
|
3666
|
+
function He() {
|
|
3667
|
+
Be.value = he.value?.level ?? null;
|
|
3668
3668
|
}
|
|
3669
|
-
let
|
|
3670
|
-
function
|
|
3669
|
+
let Ue = x(), We = x(!1), Ge = b(() => Ue.value?.message?.toLowerCase().includes("conversation-blocked") ?? !1);
|
|
3670
|
+
function Ke(e) {
|
|
3671
3671
|
try {
|
|
3672
3672
|
let t = JSON.parse(e.message);
|
|
3673
3673
|
return t.status === 404 || t.type?.includes("entity-not-found");
|
|
@@ -3675,79 +3675,79 @@ function ti(e) {
|
|
|
3675
3675
|
return !1;
|
|
3676
3676
|
}
|
|
3677
3677
|
}
|
|
3678
|
-
function
|
|
3679
|
-
if (
|
|
3680
|
-
let e =
|
|
3681
|
-
|
|
3682
|
-
|
|
3678
|
+
function qe(e) {
|
|
3679
|
+
if (Ke(e)) {
|
|
3680
|
+
let e = N.value.messages.filter((e) => e.role === "user"), t = e[e.length - 1], n = t ? de(t) : void 0;
|
|
3681
|
+
E.value = st(), Ue.value = void 0, ge(() => {
|
|
3682
|
+
N.value.clearError(), n && N.value.sendMessage({ text: n });
|
|
3683
3683
|
});
|
|
3684
|
-
} else
|
|
3684
|
+
} else le.error(e), Ue.value = e, Ge.value && (We.value = !0);
|
|
3685
3685
|
}
|
|
3686
|
-
let
|
|
3686
|
+
let O = b(() => ce({
|
|
3687
3687
|
baseUrl: i.value,
|
|
3688
3688
|
basePath: a.value,
|
|
3689
3689
|
headers: () => p.value
|
|
3690
|
-
})),
|
|
3691
|
-
...
|
|
3692
|
-
...
|
|
3693
|
-
}),
|
|
3694
|
-
let e =
|
|
3690
|
+
})), Je = x(null), Ye = () => ({
|
|
3691
|
+
...Te(),
|
|
3692
|
+
...Je.value ?? {}
|
|
3693
|
+
}), Xe = () => {
|
|
3694
|
+
let e = Oe.value;
|
|
3695
3695
|
return new Promise((t) => {
|
|
3696
3696
|
let n = setTimeout(() => {
|
|
3697
3697
|
r(), t(!1);
|
|
3698
|
-
}, 3e4), r =
|
|
3698
|
+
}, 3e4), r = C(() => [Oe.value, N.value.status], ([i, a]) => {
|
|
3699
3699
|
i > e && a === "streaming" && (clearTimeout(n), r(), t(!0));
|
|
3700
3700
|
});
|
|
3701
3701
|
});
|
|
3702
|
-
},
|
|
3703
|
-
|
|
3702
|
+
}, k = S(), Ze = (e, t) => new Promise((n) => {
|
|
3703
|
+
k.value?.answer(!1), k.value = {
|
|
3704
3704
|
toolCallId: e.toolCallId,
|
|
3705
3705
|
question: t,
|
|
3706
3706
|
answer: (e) => {
|
|
3707
|
-
|
|
3707
|
+
k.value = void 0, n(e);
|
|
3708
3708
|
}
|
|
3709
3709
|
};
|
|
3710
3710
|
});
|
|
3711
|
-
function
|
|
3712
|
-
|
|
3711
|
+
function Qe(e) {
|
|
3712
|
+
k.value?.answer(e);
|
|
3713
3713
|
}
|
|
3714
|
-
let
|
|
3714
|
+
let $e = je({
|
|
3715
3715
|
registry: () => [
|
|
3716
|
-
...(
|
|
3717
|
-
...
|
|
3718
|
-
...
|
|
3716
|
+
...(se.value ?? []).filter((e) => !ne(e.name)),
|
|
3717
|
+
...Le.value,
|
|
3718
|
+
...Re()
|
|
3719
3719
|
],
|
|
3720
|
-
capability: () =>
|
|
3721
|
-
addToolOutput: (e) => void
|
|
3722
|
-
confirm:
|
|
3723
|
-
waitForResume:
|
|
3720
|
+
capability: () => oe.value,
|
|
3721
|
+
addToolOutput: (e) => void N.value.addToolOutput(e),
|
|
3722
|
+
confirm: Ze,
|
|
3723
|
+
waitForResume: Xe,
|
|
3724
3724
|
onPendingChange: (e) => {
|
|
3725
|
-
|
|
3725
|
+
me.value = e;
|
|
3726
3726
|
},
|
|
3727
3727
|
onActivity: (e) => {
|
|
3728
3728
|
if (e?.provider !== "page" || e.readOnly) {
|
|
3729
|
-
|
|
3729
|
+
be.value = void 0;
|
|
3730
3730
|
return;
|
|
3731
3731
|
}
|
|
3732
|
-
let t = [...
|
|
3733
|
-
|
|
3732
|
+
let t = [...Le.value, ...Re()].find((t) => t.name === e.toolName);
|
|
3733
|
+
be.value = { title: t?.annotations?.title ?? e.toolName }, we.value = !0;
|
|
3734
3734
|
}
|
|
3735
3735
|
});
|
|
3736
|
-
async function
|
|
3737
|
-
|
|
3736
|
+
async function et() {
|
|
3737
|
+
A(), be.value = void 0, we.value = !1, U.value = "", await N.value.stop();
|
|
3738
3738
|
}
|
|
3739
|
-
function
|
|
3740
|
-
|
|
3739
|
+
function A() {
|
|
3740
|
+
$e.cancelAll(), k.value?.answer(!1);
|
|
3741
3741
|
}
|
|
3742
|
-
async function
|
|
3743
|
-
|
|
3742
|
+
async function tt(e) {
|
|
3743
|
+
D.value = e, e && await et();
|
|
3744
3744
|
}
|
|
3745
|
-
|
|
3746
|
-
let
|
|
3747
|
-
id:
|
|
3745
|
+
C(E, () => A(), { flush: "sync" });
|
|
3746
|
+
let j = !1, M, nt = Wr(() => ({
|
|
3747
|
+
id: E.value,
|
|
3748
3748
|
transport: new mr({
|
|
3749
|
-
api:
|
|
3750
|
-
prepareReconnectToStreamRequest: ({ id: e }) => ({ api:
|
|
3749
|
+
api: O.value.getChatEndpoint(o.value, T.value ? "reasoning" : "chat"),
|
|
3750
|
+
prepareReconnectToStreamRequest: ({ id: e }) => ({ api: O.value.getChatStreamEndpoint(o.value, e) }),
|
|
3751
3751
|
prepareSendMessagesRequest: ({ messages: e, id: t }) => ({ body: {
|
|
3752
3752
|
id: t,
|
|
3753
3753
|
messages: [e[e.length - 1]],
|
|
@@ -3762,15 +3762,15 @@ function ti(e) {
|
|
|
3762
3762
|
reasoning: d.value?.reasoning,
|
|
3763
3763
|
webSearch: f.value?.webSearch,
|
|
3764
3764
|
smoothStream: u.value?.smoothStream,
|
|
3765
|
-
deviceContext:
|
|
3766
|
-
externalContext:
|
|
3765
|
+
deviceContext: Ye(),
|
|
3766
|
+
externalContext: ae.value,
|
|
3767
3767
|
disabledTools: f.value?.disabled,
|
|
3768
3768
|
fallbackModels: y.value,
|
|
3769
|
-
gatewayOptions:
|
|
3770
|
-
hostTools:
|
|
3771
|
-
pageTools:
|
|
3769
|
+
gatewayOptions: te.value,
|
|
3770
|
+
hostTools: Ae(se.value, oe.value),
|
|
3771
|
+
pageTools: he.value && Le.value.length ? {
|
|
3772
3772
|
version: 1,
|
|
3773
|
-
forms:
|
|
3773
|
+
forms: Re().map(({ name: e, description: t, inputSchema: n, annotations: r }) => ({
|
|
3774
3774
|
name: e,
|
|
3775
3775
|
description: t,
|
|
3776
3776
|
inputSchema: n,
|
|
@@ -3783,42 +3783,42 @@ function ti(e) {
|
|
|
3783
3783
|
}),
|
|
3784
3784
|
sendAutomaticallyWhen: (e) => ei(e) || gr(e),
|
|
3785
3785
|
onError: (e) => {
|
|
3786
|
-
|
|
3786
|
+
j ? le.warn(e) : qe(e);
|
|
3787
3787
|
},
|
|
3788
3788
|
onToolCall: ({ toolCall: e }) => {
|
|
3789
|
-
if (!
|
|
3789
|
+
if (!ke(e) || j) return;
|
|
3790
3790
|
let t = e;
|
|
3791
|
-
|
|
3791
|
+
$e.enqueue({
|
|
3792
3792
|
toolCallId: t.toolCallId,
|
|
3793
3793
|
toolName: t.toolName,
|
|
3794
3794
|
input: t.input,
|
|
3795
|
-
messageId:
|
|
3795
|
+
messageId: rt()?.id ?? "",
|
|
3796
3796
|
readOnly: t.toolMetadata?.readOnly === !0,
|
|
3797
3797
|
provider: t.toolMetadata?.provider === "page" ? "page" : "app"
|
|
3798
3798
|
});
|
|
3799
3799
|
},
|
|
3800
3800
|
onData: (e) => {
|
|
3801
|
-
e.type === "data-audioTranscripts" && (
|
|
3801
|
+
e.type === "data-audioTranscripts" && (N.value.messages = ue(N.value.messages, e.data));
|
|
3802
3802
|
},
|
|
3803
3803
|
onFinish: () => {
|
|
3804
|
-
let e =
|
|
3805
|
-
!
|
|
3804
|
+
let e = E.value;
|
|
3805
|
+
!T.value && !I.value.some((t) => t.id === e) && gt(o.value);
|
|
3806
3806
|
}
|
|
3807
|
-
})),
|
|
3808
|
-
|
|
3809
|
-
|
|
3807
|
+
})), N = b(() => ve(nt)), rt = () => N.value.messages[N.value.messages.length - 1];
|
|
3808
|
+
C(E, () => {
|
|
3809
|
+
N.value.stop();
|
|
3810
3810
|
}, { flush: "sync" });
|
|
3811
|
-
let
|
|
3811
|
+
let it = b(() => {
|
|
3812
3812
|
let e = u.value?.initialMessage;
|
|
3813
3813
|
return e?.[r.value] ? e[r.value] : n("message.defaultAgentWelcome") ? t("message.defaultAgentWelcome") : "";
|
|
3814
|
-
}),
|
|
3815
|
-
id:
|
|
3814
|
+
}), at = st(), ot = b(() => ({
|
|
3815
|
+
id: at,
|
|
3816
3816
|
role: "assistant",
|
|
3817
3817
|
parts: [{
|
|
3818
3818
|
type: "text",
|
|
3819
|
-
text:
|
|
3819
|
+
text: it.value
|
|
3820
3820
|
}]
|
|
3821
|
-
})),
|
|
3821
|
+
})), P = b(() => {
|
|
3822
3822
|
let e = (e) => e.map((e) => e.role !== "user" || !e.parts.some((e) => e.type === "file") ? e : {
|
|
3823
3823
|
...e,
|
|
3824
3824
|
parts: e.parts.map((e) => {
|
|
@@ -3828,107 +3828,107 @@ function ti(e) {
|
|
|
3828
3828
|
let e = t.url.slice(13);
|
|
3829
3829
|
return {
|
|
3830
3830
|
...t,
|
|
3831
|
-
url:
|
|
3831
|
+
url: O.value.getMediaUrl(o.value, E.value, e)
|
|
3832
3832
|
};
|
|
3833
3833
|
}
|
|
3834
3834
|
return t.url.startsWith("blob:") ? t : {
|
|
3835
3835
|
...t,
|
|
3836
|
-
url:
|
|
3836
|
+
url: O.value.appendAuthToken(t.url)
|
|
3837
3837
|
};
|
|
3838
3838
|
})
|
|
3839
|
-
}), t =
|
|
3840
|
-
return
|
|
3841
|
-
}),
|
|
3839
|
+
}), t = N.value.id === E.value ? N.value.messages : [];
|
|
3840
|
+
return T.value ? e(t) : !Ne.value && t[0]?.role !== "assistant" ? [ot.value, ...e(t)] : e(t);
|
|
3841
|
+
}), F = b(() => {
|
|
3842
3842
|
let e = u.value?.messagePlaceholder;
|
|
3843
3843
|
return e?.[r.value] ? e[r.value] : n("placeholder.askAnything") ? t("placeholder.askAnything") : "";
|
|
3844
|
-
}),
|
|
3845
|
-
async function
|
|
3846
|
-
if (
|
|
3844
|
+
}), I = x([]), ct = x(!1), L = x([]), lt = x(!1), ut = x("chat"), R = x([]), z = x(), B = x(!1), dt = x(!1), ft = x(), pt = x(!1), V = x(!1), mt = x(), ht = x(""), H = x([]), U = x(""), W = x(0);
|
|
3845
|
+
async function gt(e) {
|
|
3846
|
+
if (T.value) I.value = [];
|
|
3847
3847
|
else {
|
|
3848
|
-
|
|
3848
|
+
ct.value = !0;
|
|
3849
3849
|
try {
|
|
3850
|
-
|
|
3850
|
+
I.value = await O.value.getConversations(e, l.value);
|
|
3851
3851
|
} catch {
|
|
3852
|
-
|
|
3852
|
+
I.value = [];
|
|
3853
3853
|
} finally {
|
|
3854
|
-
|
|
3854
|
+
ct.value = !1;
|
|
3855
3855
|
}
|
|
3856
3856
|
}
|
|
3857
3857
|
}
|
|
3858
|
-
async function
|
|
3859
|
-
let e =
|
|
3860
|
-
if (!e)
|
|
3858
|
+
async function _t() {
|
|
3859
|
+
let e = E.value;
|
|
3860
|
+
if (!e) L.value = [];
|
|
3861
3861
|
else {
|
|
3862
|
-
|
|
3862
|
+
lt.value = !0;
|
|
3863
3863
|
try {
|
|
3864
|
-
|
|
3864
|
+
L.value = await O.value.getChatFiles(e);
|
|
3865
3865
|
} catch {
|
|
3866
|
-
|
|
3866
|
+
L.value = [];
|
|
3867
3867
|
} finally {
|
|
3868
|
-
|
|
3868
|
+
lt.value = !1;
|
|
3869
3869
|
}
|
|
3870
3870
|
}
|
|
3871
3871
|
}
|
|
3872
|
-
function
|
|
3873
|
-
return
|
|
3872
|
+
function vt(e, t = !1) {
|
|
3873
|
+
return O.value.getChatFileDownloadUrl(e, t);
|
|
3874
3874
|
}
|
|
3875
|
-
function
|
|
3876
|
-
return
|
|
3875
|
+
function yt(e) {
|
|
3876
|
+
return O.value.getChatFilePreviewUrl(e);
|
|
3877
3877
|
}
|
|
3878
|
-
async function
|
|
3879
|
-
await
|
|
3880
|
-
let t =
|
|
3881
|
-
|
|
3878
|
+
async function bt(e) {
|
|
3879
|
+
await O.value.deleteChatFile(e);
|
|
3880
|
+
let t = L.value.find((t) => t.documentId === e), n = t?.kind === "spreadsheet" ? t.sourceAttachmentId ?? t.documentId : void 0;
|
|
3881
|
+
L.value = L.value.filter((t) => t.documentId !== e && (!n || t.documentId !== n && t.sourceAttachmentId !== n));
|
|
3882
3882
|
}
|
|
3883
|
-
async function
|
|
3884
|
-
if (!
|
|
3885
|
-
let n = await
|
|
3886
|
-
if (t !==
|
|
3887
|
-
n && (
|
|
3883
|
+
async function xt(e, t) {
|
|
3884
|
+
if (!T.value) try {
|
|
3885
|
+
let n = await O.value.getChat(e, t);
|
|
3886
|
+
if (t !== E.value || N.value.status !== "ready" || N.value.messages.length > 0) return;
|
|
3887
|
+
n && (N.value.messages = n.messages, We.value = n.blocked ?? !1, St(e, t, n.turnInProgress === !0));
|
|
3888
3888
|
} catch {}
|
|
3889
3889
|
}
|
|
3890
|
-
async function
|
|
3891
|
-
n && (await
|
|
3890
|
+
async function St(e, t, n) {
|
|
3891
|
+
n && (await Ct(t), t !== E.value || G()) || await wt(e, t);
|
|
3892
3892
|
}
|
|
3893
|
-
async function
|
|
3893
|
+
async function Ct(e) {
|
|
3894
3894
|
let t = { chatId: e };
|
|
3895
|
-
|
|
3896
|
-
let n = () =>
|
|
3895
|
+
M = t;
|
|
3896
|
+
let n = () => M === t && e === E.value, r = Date.now() + Zr;
|
|
3897
3897
|
try {
|
|
3898
|
-
for (; n() && !
|
|
3899
|
-
|
|
3898
|
+
for (; n() && !G() && Date.now() < r;) {
|
|
3899
|
+
j = !0;
|
|
3900
3900
|
try {
|
|
3901
|
-
await
|
|
3901
|
+
await N.value.resumeStream();
|
|
3902
3902
|
} finally {
|
|
3903
|
-
|
|
3903
|
+
j = !1;
|
|
3904
3904
|
}
|
|
3905
3905
|
if (!n()) return;
|
|
3906
|
-
|
|
3907
|
-
let t = await
|
|
3908
|
-
if (!t || !n() ||
|
|
3906
|
+
N.value.clearError();
|
|
3907
|
+
let t = await O.value.getChat(o.value, e).catch(() => null);
|
|
3908
|
+
if (!t || !n() || G()) return;
|
|
3909
3909
|
if (!t.turnInProgress) {
|
|
3910
|
-
|
|
3910
|
+
N.value.messages = t.messages;
|
|
3911
3911
|
return;
|
|
3912
3912
|
}
|
|
3913
3913
|
await new Promise((e) => setTimeout(e, Qr));
|
|
3914
3914
|
}
|
|
3915
3915
|
} finally {
|
|
3916
|
-
|
|
3916
|
+
M === t && (M = void 0);
|
|
3917
3917
|
}
|
|
3918
3918
|
}
|
|
3919
|
-
async function
|
|
3919
|
+
async function wt(e, t) {
|
|
3920
3920
|
let n;
|
|
3921
3921
|
try {
|
|
3922
|
-
n = Number(sessionStorage.getItem(
|
|
3922
|
+
n = Number(sessionStorage.getItem(De)), sessionStorage.removeItem(De);
|
|
3923
3923
|
} catch {
|
|
3924
3924
|
return;
|
|
3925
3925
|
}
|
|
3926
|
-
if (!(!n || Date.now() - n > 6e4 ||
|
|
3927
|
-
let n =
|
|
3926
|
+
if (!(!n || Date.now() - n > 6e4 || D.value)) for (let n = 0; n < 12; n++) {
|
|
3927
|
+
let n = N.value.messages[N.value.messages.length - 1];
|
|
3928
3928
|
if (n?.role === "assistant") {
|
|
3929
|
-
let e = n.parts.filter((e) =>
|
|
3929
|
+
let e = n.parts.filter((e) => ie(e) && e.state === "input-available"), t = e.filter((e) => e.toolMetadata?.provider === "page" && e.toolMetadata.readOnly === !0);
|
|
3930
3930
|
if (e.length > 0) {
|
|
3931
|
-
if (t.length === e.length && !
|
|
3931
|
+
if (t.length === e.length && !D.value) for (let e of t) $e.enqueue({
|
|
3932
3932
|
toolCallId: e.toolCallId,
|
|
3933
3933
|
toolName: e.toolName,
|
|
3934
3934
|
input: e.input,
|
|
@@ -3940,254 +3940,254 @@ function ti(e) {
|
|
|
3940
3940
|
}
|
|
3941
3941
|
if (n.parts[n.parts.length - 1]?.type === "text") return;
|
|
3942
3942
|
}
|
|
3943
|
-
if (await new Promise((e) => setTimeout(e, 1500)), t !==
|
|
3943
|
+
if (await new Promise((e) => setTimeout(e, 1500)), t !== E.value || N.value.status !== "ready") return;
|
|
3944
3944
|
try {
|
|
3945
|
-
let n = await
|
|
3946
|
-
n && t ===
|
|
3945
|
+
let n = await O.value.getChat(e, t);
|
|
3946
|
+
n && t === E.value && (N.value.messages = n.messages);
|
|
3947
3947
|
} catch {
|
|
3948
3948
|
return;
|
|
3949
3949
|
}
|
|
3950
3950
|
}
|
|
3951
3951
|
}
|
|
3952
|
-
let
|
|
3953
|
-
let e =
|
|
3952
|
+
let G = () => {
|
|
3953
|
+
let e = N.value.status;
|
|
3954
3954
|
return e === "submitted" || e === "streaming";
|
|
3955
|
-
},
|
|
3956
|
-
async function
|
|
3957
|
-
if (
|
|
3958
|
-
let e =
|
|
3955
|
+
}, Tt = 0, Et = 0;
|
|
3956
|
+
async function Dt() {
|
|
3957
|
+
if (T.value || G()) return "indeterminate";
|
|
3958
|
+
let e = E.value, t = Tt += 1;
|
|
3959
3959
|
try {
|
|
3960
|
-
let n = await
|
|
3961
|
-
if (!n || e !==
|
|
3962
|
-
|
|
3963
|
-
let r = n.messages, i = Xr(r,
|
|
3964
|
-
return
|
|
3960
|
+
let n = await O.value.getChat(o.value, e);
|
|
3961
|
+
if (!n || e !== E.value || G() || t <= Et) return "indeterminate";
|
|
3962
|
+
Et = t;
|
|
3963
|
+
let r = n.messages, i = Xr(r, N.value.messages);
|
|
3964
|
+
return N.value.messages = [...r, ...i], We.value = n.blocked ?? !1, i.length > 0 ? "pending" : "caught-up";
|
|
3965
3965
|
} catch {}
|
|
3966
3966
|
return "indeterminate";
|
|
3967
3967
|
}
|
|
3968
|
-
function
|
|
3969
|
-
|
|
3968
|
+
function Ot(e) {
|
|
3969
|
+
N.value.messages = [...N.value.messages, e];
|
|
3970
3970
|
}
|
|
3971
|
-
async function
|
|
3971
|
+
async function K(e) {
|
|
3972
3972
|
try {
|
|
3973
|
-
|
|
3973
|
+
R.value = await O.value.getMessageFeedbacks(e);
|
|
3974
3974
|
} catch {
|
|
3975
|
-
|
|
3975
|
+
R.value = [];
|
|
3976
3976
|
}
|
|
3977
3977
|
}
|
|
3978
|
-
function
|
|
3979
|
-
let t =
|
|
3980
|
-
t >= 0 ?
|
|
3978
|
+
function q(e) {
|
|
3979
|
+
let t = R.value.findIndex((t) => t.messageId === e.messageId);
|
|
3980
|
+
t >= 0 ? R.value[t] = e : R.value.push(e);
|
|
3981
3981
|
}
|
|
3982
|
-
function
|
|
3983
|
-
let t =
|
|
3982
|
+
function kt(e) {
|
|
3983
|
+
let t = P.value, n = t.findIndex((t) => t.id === e.id), r = de(e) ?? "", i = t.slice(0, n).reverse().find((e) => e.role === "user");
|
|
3984
3984
|
return {
|
|
3985
|
-
userQuestion:
|
|
3985
|
+
userQuestion: de(i ?? e) ?? "",
|
|
3986
3986
|
assistantMessage: r
|
|
3987
3987
|
};
|
|
3988
3988
|
}
|
|
3989
|
-
async function
|
|
3989
|
+
async function At(e, t) {
|
|
3990
3990
|
await Promise.all([
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
]),
|
|
3995
|
-
e && (
|
|
3991
|
+
xt(e, t),
|
|
3992
|
+
gt(e),
|
|
3993
|
+
K(t)
|
|
3994
|
+
]), Je.value || Ee((e, t) => O.value.reverseGeocode(e, t, r.value)).then((e) => {
|
|
3995
|
+
e && (Je.value = e);
|
|
3996
3996
|
});
|
|
3997
3997
|
}
|
|
3998
|
-
async function
|
|
3999
|
-
let e =
|
|
3998
|
+
async function jt() {
|
|
3999
|
+
let e = ht.value.trim(), t = H.value.filter((e) => e.state === "done" && e.mediaSource !== void 0).map((e) => ({
|
|
4000
4000
|
type: "file",
|
|
4001
4001
|
mediaType: e.mediaSource.mimeType,
|
|
4002
4002
|
url: e.localUrl,
|
|
4003
4003
|
filename: e.mediaSource.name,
|
|
4004
4004
|
providerMetadata: { "8bot": { media: e.mediaSource } }
|
|
4005
4005
|
}));
|
|
4006
|
-
|
|
4007
|
-
let n =
|
|
4006
|
+
T.value && P.value.length > 0 && await Rt(), A(), U.value = e, W.value = N.value.messages.length;
|
|
4007
|
+
let n = N.value.sendMessage;
|
|
4008
4008
|
n({
|
|
4009
4009
|
text: e,
|
|
4010
4010
|
files: t.length > 0 ? t : void 0
|
|
4011
|
-
}),
|
|
4011
|
+
}), ht.value = "", Lt();
|
|
4012
4012
|
}
|
|
4013
|
-
function
|
|
4013
|
+
function Mt(e) {
|
|
4014
4014
|
let t = e.trim();
|
|
4015
4015
|
if (!t) return;
|
|
4016
|
-
if (
|
|
4017
|
-
|
|
4016
|
+
if (N.value.status !== "ready") {
|
|
4017
|
+
le.warn("[useChatbotStore] sendMessage called before chat is ready. Listen for the \"ready\" event on the widget element.");
|
|
4018
4018
|
return;
|
|
4019
4019
|
}
|
|
4020
|
-
let n =
|
|
4021
|
-
|
|
4020
|
+
let n = N.value.sendMessage;
|
|
4021
|
+
A(), n({ text: t });
|
|
4022
4022
|
}
|
|
4023
|
-
async function
|
|
4024
|
-
let e =
|
|
4025
|
-
|
|
4026
|
-
let s =
|
|
4027
|
-
r !==
|
|
4023
|
+
async function Nt() {
|
|
4024
|
+
let e = N.value.messages.slice(W.value).some((e) => e.parts.some(ie)), t = U.value, n = t.length > 0 && !e, r = E.value, i = W.value, a = M?.chatId === r;
|
|
4025
|
+
M = void 0, A(), await N.value.stop();
|
|
4026
|
+
let s = T.value || e && !a || await O.value.stopChatTurn(o.value, r).catch(() => !0);
|
|
4027
|
+
r !== E.value || G() || W.value !== i || ((a || !s) && (await Dt(), a || N.value.messages.length > W.value) ? U.value = "" : n && (ht.value = t, N.value.messages = N.value.messages.slice(0, W.value), U.value = ""));
|
|
4028
4028
|
}
|
|
4029
|
-
|
|
4030
|
-
let t =
|
|
4031
|
-
t && !e.some((e) => e.parts.some((e) => e.toolCallId === t)) &&
|
|
4032
|
-
}),
|
|
4033
|
-
e === "submitted" &&
|
|
4029
|
+
C(() => N.value.messages, (e) => {
|
|
4030
|
+
let t = k.value?.toolCallId;
|
|
4031
|
+
t && !e.some((e) => e.parts.some((e) => e.toolCallId === t)) && A();
|
|
4032
|
+
}), C(() => N.value.status, (e) => {
|
|
4033
|
+
e === "submitted" && Oe.value++;
|
|
4034
4034
|
});
|
|
4035
|
-
let
|
|
4036
|
-
|
|
4037
|
-
clearTimeout(
|
|
4038
|
-
|
|
4035
|
+
let Pt;
|
|
4036
|
+
C(() => [N.value.status, me.value], ([e, t]) => {
|
|
4037
|
+
clearTimeout(Pt), e === "ready" && t === 0 && (Pt = setTimeout(() => {
|
|
4038
|
+
we.value = !1;
|
|
4039
4039
|
}, 1500));
|
|
4040
4040
|
});
|
|
4041
|
-
let
|
|
4042
|
-
|
|
4043
|
-
clearTimeout(
|
|
4044
|
-
|
|
4041
|
+
let Ft = x(!1), It;
|
|
4042
|
+
C(() => !k.value && !Kr(rt()) && (G() || me.value > 0), (e) => {
|
|
4043
|
+
clearTimeout(It), e ? Ft.value = !0 : It = setTimeout(() => {
|
|
4044
|
+
Ft.value = !1;
|
|
4045
4045
|
}, 400);
|
|
4046
|
-
}, { immediate: !0 }),
|
|
4047
|
-
e === "ready" &&
|
|
4046
|
+
}, { immediate: !0 }), C(() => N.value.status, (e) => {
|
|
4047
|
+
e === "ready" && U.value.length > 0 && (U.value = "");
|
|
4048
4048
|
});
|
|
4049
|
-
function
|
|
4050
|
-
for (let t of
|
|
4051
|
-
|
|
4049
|
+
function Lt(e = !1) {
|
|
4050
|
+
for (let t of H.value) (e || t.state !== "done") && URL.revokeObjectURL(t.localUrl);
|
|
4051
|
+
H.value = [], qt.value = null;
|
|
4052
4052
|
}
|
|
4053
|
-
async function
|
|
4054
|
-
return
|
|
4053
|
+
async function Rt() {
|
|
4054
|
+
return U.value = "", E.value = st(), await ge(), N.value.clearError(), Ue.value = void 0, We.value = !1, Lt(!0), rn("chat"), E.value;
|
|
4055
4055
|
}
|
|
4056
|
-
async function
|
|
4057
|
-
|
|
4056
|
+
async function zt(e) {
|
|
4057
|
+
N.value.status !== "ready" && (U.value = "", await Nt()), A(), await N.value.regenerate(e);
|
|
4058
4058
|
}
|
|
4059
|
-
function
|
|
4059
|
+
function Bt(e) {
|
|
4060
4060
|
if (e.tool === "requestGeolocation") {
|
|
4061
4061
|
let t = e.output;
|
|
4062
|
-
"latitude" in t && (
|
|
4062
|
+
"latitude" in t && (Je.value = {
|
|
4063
4063
|
geolocationLatitude: t.latitude,
|
|
4064
4064
|
geolocationLongitude: t.longitude,
|
|
4065
4065
|
geolocationAccuracy: t.accuracy,
|
|
4066
4066
|
geolocationCity: t.city
|
|
4067
4067
|
});
|
|
4068
4068
|
}
|
|
4069
|
-
|
|
4069
|
+
N.value.addToolOutput(e);
|
|
4070
4070
|
}
|
|
4071
|
-
function
|
|
4072
|
-
|
|
4071
|
+
function Vt(e) {
|
|
4072
|
+
N.value.addToolApprovalResponse(e);
|
|
4073
4073
|
}
|
|
4074
|
-
let
|
|
4075
|
-
|
|
4074
|
+
let Ht = b(() => N.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), Ut = b(() => _.value?.maxFilesPerMessage ?? 5), Wt = b(() => _.value?.maxFilesPerChat ?? 20), Gt = b(() => Math.max(0, Math.min(Ut.value - H.value.length, Wt.value - Ht.value - H.value.length))), Kt = b(() => Gt.value <= 0), qt = x(null), Jt = () => {
|
|
4075
|
+
qt.value = null;
|
|
4076
4076
|
};
|
|
4077
|
-
|
|
4078
|
-
e || (
|
|
4077
|
+
C(Kt, (e) => {
|
|
4078
|
+
e || (qt.value = null);
|
|
4079
4079
|
});
|
|
4080
|
-
async function
|
|
4081
|
-
if (
|
|
4082
|
-
|
|
4080
|
+
async function Yt(e) {
|
|
4081
|
+
if (Kt.value) {
|
|
4082
|
+
qt.value = Wt.value - Ht.value - H.value.length <= Ut.value - H.value.length ? {
|
|
4083
4083
|
reason: "per-chat",
|
|
4084
|
-
max:
|
|
4084
|
+
max: Wt.value
|
|
4085
4085
|
} : {
|
|
4086
4086
|
reason: "per-message",
|
|
4087
|
-
max:
|
|
4087
|
+
max: Ut.value
|
|
4088
4088
|
};
|
|
4089
4089
|
return;
|
|
4090
4090
|
}
|
|
4091
|
-
let t =
|
|
4091
|
+
let t = st(), n = {
|
|
4092
4092
|
id: t,
|
|
4093
4093
|
file: e,
|
|
4094
4094
|
localUrl: URL.createObjectURL(e),
|
|
4095
4095
|
state: "uploading"
|
|
4096
4096
|
};
|
|
4097
|
-
|
|
4097
|
+
H.value = [...H.value, n];
|
|
4098
4098
|
try {
|
|
4099
|
-
let n = await
|
|
4100
|
-
|
|
4099
|
+
let n = await O.value.uploadMedia(o.value, E.value, e);
|
|
4100
|
+
H.value = H.value.map((e) => e.id === t ? {
|
|
4101
4101
|
...e,
|
|
4102
4102
|
state: "done",
|
|
4103
4103
|
mediaSource: n
|
|
4104
4104
|
} : e);
|
|
4105
4105
|
} catch (e) {
|
|
4106
4106
|
let n = e instanceof Error ? e.message : "Upload failed";
|
|
4107
|
-
|
|
4107
|
+
H.value = H.value.map((e) => e.id === t ? {
|
|
4108
4108
|
...e,
|
|
4109
4109
|
state: "error",
|
|
4110
4110
|
error: n
|
|
4111
4111
|
} : e);
|
|
4112
4112
|
}
|
|
4113
4113
|
}
|
|
4114
|
-
async function
|
|
4115
|
-
let { userQuestion: n, assistantMessage: r } =
|
|
4116
|
-
|
|
4114
|
+
async function Xt(e, t) {
|
|
4115
|
+
let { userQuestion: n, assistantMessage: r } = kt(e);
|
|
4116
|
+
q(await O.value.submitMessageFeedback({
|
|
4117
4117
|
messageId: e.id,
|
|
4118
|
-
chatId:
|
|
4118
|
+
chatId: E.value,
|
|
4119
4119
|
agentId: o.value,
|
|
4120
4120
|
vote: t,
|
|
4121
4121
|
userQuestion: n,
|
|
4122
4122
|
assistantMessage: r
|
|
4123
4123
|
}));
|
|
4124
4124
|
}
|
|
4125
|
-
async function Xt(e) {
|
|
4126
|
-
await Yt(e, "upvote");
|
|
4127
|
-
}
|
|
4128
4125
|
async function Zt(e) {
|
|
4129
|
-
await
|
|
4130
|
-
}
|
|
4131
|
-
function Y(e) {
|
|
4132
|
-
lt.value = !1, ut.value = void 0, V.value = e;
|
|
4126
|
+
await Xt(e, "upvote");
|
|
4133
4127
|
}
|
|
4134
4128
|
async function Qt(e) {
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4129
|
+
await Xt(e, "downvote");
|
|
4130
|
+
}
|
|
4131
|
+
function J(e) {
|
|
4132
|
+
dt.value = !1, ft.value = void 0, z.value = e;
|
|
4133
|
+
}
|
|
4134
|
+
async function $t(e) {
|
|
4135
|
+
if (z.value) try {
|
|
4136
|
+
B.value = !0, dt.value = !1, ft.value = void 0;
|
|
4137
|
+
let { userQuestion: t, assistantMessage: n } = kt(z.value);
|
|
4138
|
+
q(await O.value.submitMessageFeedback({
|
|
4139
|
+
messageId: z.value.id,
|
|
4140
|
+
chatId: E.value,
|
|
4141
4141
|
agentId: o.value,
|
|
4142
4142
|
userQuestion: t,
|
|
4143
4143
|
assistantMessage: n,
|
|
4144
4144
|
comment: e
|
|
4145
|
-
})),
|
|
4145
|
+
})), dt.value = !0, await K(E.value);
|
|
4146
4146
|
} catch {
|
|
4147
|
-
|
|
4147
|
+
ft.value = n("message.feedbackSubmitError") ? t("message.feedbackSubmitError") : "Failed to submit feedback";
|
|
4148
4148
|
} finally {
|
|
4149
|
-
|
|
4149
|
+
B.value = !1;
|
|
4150
4150
|
}
|
|
4151
4151
|
}
|
|
4152
|
-
async function
|
|
4152
|
+
async function en(e) {
|
|
4153
4153
|
try {
|
|
4154
|
-
|
|
4154
|
+
V.value = !0, pt.value = !1, mt.value = void 0, await O.value.submitLead({
|
|
4155
4155
|
agentId: o.value,
|
|
4156
|
-
chatId:
|
|
4156
|
+
chatId: E.value,
|
|
4157
4157
|
...e
|
|
4158
|
-
}),
|
|
4158
|
+
}), pt.value = !0;
|
|
4159
4159
|
} catch {
|
|
4160
|
-
|
|
4160
|
+
mt.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
|
|
4161
4161
|
} finally {
|
|
4162
|
-
|
|
4162
|
+
V.value = !1;
|
|
4163
4163
|
}
|
|
4164
4164
|
}
|
|
4165
|
-
async function
|
|
4166
|
-
let n = await
|
|
4167
|
-
|
|
4165
|
+
async function tn(e, t) {
|
|
4166
|
+
let n = await O.value.updateChatTitle(o.value, e, t);
|
|
4167
|
+
I.value = I.value.map((t) => t.id === e ? {
|
|
4168
4168
|
...t,
|
|
4169
4169
|
title: n.title
|
|
4170
4170
|
} : t);
|
|
4171
4171
|
}
|
|
4172
|
-
async function
|
|
4173
|
-
await
|
|
4172
|
+
async function nn(e) {
|
|
4173
|
+
await O.value.deleteChat(o.value, e), I.value = I.value.filter((t) => t.id !== e), E.value === e && await Rt();
|
|
4174
4174
|
}
|
|
4175
|
-
function
|
|
4176
|
-
|
|
4175
|
+
function rn(e) {
|
|
4176
|
+
ut.value = e;
|
|
4177
4177
|
}
|
|
4178
|
-
let
|
|
4179
|
-
function
|
|
4180
|
-
let t = () =>
|
|
4178
|
+
let an;
|
|
4179
|
+
function on(e) {
|
|
4180
|
+
let t = () => O.value.getChat(o.value, e).then((e) => e !== null);
|
|
4181
4181
|
return t().catch(() => t().catch(() => !1));
|
|
4182
4182
|
}
|
|
4183
|
-
return
|
|
4184
|
-
if (!e || e ===
|
|
4185
|
-
let t =
|
|
4186
|
-
if (
|
|
4187
|
-
let n =
|
|
4188
|
-
l.value === e &&
|
|
4183
|
+
return C(l, async (e) => {
|
|
4184
|
+
if (!e || e === an) return;
|
|
4185
|
+
let t = an;
|
|
4186
|
+
if (an = e, t === void 0) return;
|
|
4187
|
+
let n = E.value, r = !T.value && await on(n);
|
|
4188
|
+
l.value === e && E.value === n && (r ? gt(o.value) : (I.value = [], R.value = [], L.value = [], await Rt(), ht.value = ""));
|
|
4189
4189
|
}), {
|
|
4190
|
-
apiClient:
|
|
4190
|
+
apiClient: O,
|
|
4191
4191
|
baseUrl: i,
|
|
4192
4192
|
basePath: a,
|
|
4193
4193
|
agentId: o,
|
|
@@ -4201,86 +4201,86 @@ function ti(e) {
|
|
|
4201
4201
|
revisedAnswers: m,
|
|
4202
4202
|
model: h,
|
|
4203
4203
|
actionsInput: g,
|
|
4204
|
-
actions:
|
|
4204
|
+
actions: Fe,
|
|
4205
4205
|
agentFileUpload: _,
|
|
4206
4206
|
agentVoice: v,
|
|
4207
4207
|
fallbackModels: y,
|
|
4208
|
-
gatewayOptions:
|
|
4209
|
-
externalContext:
|
|
4210
|
-
agentHostTools:
|
|
4211
|
-
hostToolRegistry:
|
|
4212
|
-
hostToolsPending:
|
|
4213
|
-
agentPageAccess:
|
|
4214
|
-
pageToolRegistry:
|
|
4215
|
-
pageFormsProvider:
|
|
4216
|
-
pageAction:
|
|
4217
|
-
pageControlActive:
|
|
4218
|
-
isWorking:
|
|
4219
|
-
stopHostActions:
|
|
4220
|
-
pageNoticeLevel:
|
|
4221
|
-
closePageNotice:
|
|
4222
|
-
hostConfirmation:
|
|
4223
|
-
respondHostConfirmation:
|
|
4224
|
-
pageAccessAvailable:
|
|
4225
|
-
pageAccessOff:
|
|
4226
|
-
setPageAccessOff:
|
|
4227
|
-
systemTheme:
|
|
4228
|
-
hideWelcomeMessage:
|
|
4229
|
-
isDark:
|
|
4230
|
-
chat:
|
|
4231
|
-
messages:
|
|
4232
|
-
conversations:
|
|
4233
|
-
isLoadingConversations:
|
|
4234
|
-
chatFiles:
|
|
4235
|
-
isLoadingChatFiles:
|
|
4236
|
-
input:
|
|
4237
|
-
pendingAttachments:
|
|
4238
|
-
isAttachmentLimitReached:
|
|
4239
|
-
fileLimitError:
|
|
4240
|
-
localChatId:
|
|
4241
|
-
isConversationBlocked:
|
|
4242
|
-
inputMessagePlaceholder:
|
|
4243
|
-
chatError:
|
|
4244
|
-
activeView:
|
|
4245
|
-
messageFeedbacks:
|
|
4246
|
-
feedbackDialogMessage:
|
|
4247
|
-
isFeedbackSubmitting:
|
|
4248
|
-
isFeedbackSubmitted:
|
|
4249
|
-
feedbackSubmitError:
|
|
4250
|
-
isLeadSubmitted:
|
|
4251
|
-
isLoadingSubmitLead:
|
|
4252
|
-
submitLeadError:
|
|
4253
|
-
buildDeviceContext:
|
|
4254
|
-
initialize:
|
|
4255
|
-
loadConversations:
|
|
4256
|
-
loadChatFiles:
|
|
4257
|
-
refreshMessages:
|
|
4258
|
-
appendMessage:
|
|
4259
|
-
getChatFileUrl:
|
|
4260
|
-
getChatFilePreviewUrl:
|
|
4261
|
-
deleteChatFile:
|
|
4262
|
-
handleSubmit:
|
|
4263
|
-
sendMessage:
|
|
4264
|
-
stopGeneration:
|
|
4265
|
-
startNewChat:
|
|
4266
|
-
regenerate:
|
|
4267
|
-
addToolOutput:
|
|
4268
|
-
addToolApprovalResponse:
|
|
4269
|
-
handleFileSelect:
|
|
4270
|
-
clearFileLimitError:
|
|
4271
|
-
clearPendingAttachments:
|
|
4272
|
-
onUpvote:
|
|
4273
|
-
onDownvote:
|
|
4274
|
-
onFeedback:
|
|
4275
|
-
onFeedbackSubmit:
|
|
4276
|
-
onLeadSubmit:
|
|
4277
|
-
navigate:
|
|
4278
|
-
renameChatTitle:
|
|
4279
|
-
deleteChat:
|
|
4208
|
+
gatewayOptions: te,
|
|
4209
|
+
externalContext: ae,
|
|
4210
|
+
agentHostTools: oe,
|
|
4211
|
+
hostToolRegistry: se,
|
|
4212
|
+
hostToolsPending: me,
|
|
4213
|
+
agentPageAccess: he,
|
|
4214
|
+
pageToolRegistry: _e,
|
|
4215
|
+
pageFormsProvider: ye,
|
|
4216
|
+
pageAction: be,
|
|
4217
|
+
pageControlActive: we,
|
|
4218
|
+
isWorking: Ft,
|
|
4219
|
+
stopHostActions: et,
|
|
4220
|
+
pageNoticeLevel: Ve,
|
|
4221
|
+
closePageNotice: He,
|
|
4222
|
+
hostConfirmation: k,
|
|
4223
|
+
respondHostConfirmation: Qe,
|
|
4224
|
+
pageAccessAvailable: ze,
|
|
4225
|
+
pageAccessOff: D,
|
|
4226
|
+
setPageAccessOff: tt,
|
|
4227
|
+
systemTheme: Me,
|
|
4228
|
+
hideWelcomeMessage: Ne,
|
|
4229
|
+
isDark: Pe,
|
|
4230
|
+
chat: N,
|
|
4231
|
+
messages: P,
|
|
4232
|
+
conversations: I,
|
|
4233
|
+
isLoadingConversations: ct,
|
|
4234
|
+
chatFiles: L,
|
|
4235
|
+
isLoadingChatFiles: lt,
|
|
4236
|
+
input: ht,
|
|
4237
|
+
pendingAttachments: H,
|
|
4238
|
+
isAttachmentLimitReached: Kt,
|
|
4239
|
+
fileLimitError: qt,
|
|
4240
|
+
localChatId: E,
|
|
4241
|
+
isConversationBlocked: We,
|
|
4242
|
+
inputMessagePlaceholder: F,
|
|
4243
|
+
chatError: Ue,
|
|
4244
|
+
activeView: ut,
|
|
4245
|
+
messageFeedbacks: R,
|
|
4246
|
+
feedbackDialogMessage: z,
|
|
4247
|
+
isFeedbackSubmitting: B,
|
|
4248
|
+
isFeedbackSubmitted: dt,
|
|
4249
|
+
feedbackSubmitError: ft,
|
|
4250
|
+
isLeadSubmitted: pt,
|
|
4251
|
+
isLoadingSubmitLead: V,
|
|
4252
|
+
submitLeadError: mt,
|
|
4253
|
+
buildDeviceContext: Ye,
|
|
4254
|
+
initialize: At,
|
|
4255
|
+
loadConversations: gt,
|
|
4256
|
+
loadChatFiles: _t,
|
|
4257
|
+
refreshMessages: Dt,
|
|
4258
|
+
appendMessage: Ot,
|
|
4259
|
+
getChatFileUrl: vt,
|
|
4260
|
+
getChatFilePreviewUrl: yt,
|
|
4261
|
+
deleteChatFile: bt,
|
|
4262
|
+
handleSubmit: jt,
|
|
4263
|
+
sendMessage: Mt,
|
|
4264
|
+
stopGeneration: Nt,
|
|
4265
|
+
startNewChat: Rt,
|
|
4266
|
+
regenerate: zt,
|
|
4267
|
+
addToolOutput: Bt,
|
|
4268
|
+
addToolApprovalResponse: Vt,
|
|
4269
|
+
handleFileSelect: Yt,
|
|
4270
|
+
clearFileLimitError: Jt,
|
|
4271
|
+
clearPendingAttachments: Lt,
|
|
4272
|
+
onUpvote: Zt,
|
|
4273
|
+
onDownvote: Qt,
|
|
4274
|
+
onFeedback: J,
|
|
4275
|
+
onFeedbackSubmit: $t,
|
|
4276
|
+
onLeadSubmit: en,
|
|
4277
|
+
navigate: rn,
|
|
4278
|
+
renameChatTitle: tn,
|
|
4279
|
+
deleteChat: nn
|
|
4280
4280
|
};
|
|
4281
4281
|
})();
|
|
4282
4282
|
}
|
|
4283
4283
|
//#endregion
|
|
4284
|
-
export {
|
|
4284
|
+
export { st as a, mr as i, ti as n, Wr as r, Gr as t };
|
|
4285
4285
|
|
|
4286
|
-
//# sourceMappingURL=useChatbotStore-
|
|
4286
|
+
//# sourceMappingURL=useChatbotStore-BliRphuB.js.map
|