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