@8wave/ai-elements 0.125.0-beta.16 → 0.125.0-beta.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/dist/_chunks/{PkChatbotFilePreview-xDlDvl5m.js → PkChatbotFilePreview-CFGqa-tX.js} +2 -2
- package/dist/_chunks/{PkChatbotFilePreview-xDlDvl5m.js.map → PkChatbotFilePreview-CFGqa-tX.js.map} +1 -1
- package/dist/_chunks/{PkFilePreview-8nVPKv8k.js → PkFilePreview-BIFkMsAC.js} +559 -718
- package/dist/_chunks/PkFilePreview-BIFkMsAC.js.map +1 -0
- package/dist/_chunks/{PkFilePreviewDialog-BHPcGlnF.js → PkFilePreviewDialog-NLk4gZMd.js} +8 -8
- package/dist/_chunks/{PkFilePreviewDialog-BHPcGlnF.js.map → PkFilePreviewDialog-NLk4gZMd.js.map} +1 -1
- package/dist/_chunks/PkSelectionActions-CUymhwsG.js +168 -0
- package/dist/_chunks/PkSelectionActions-CUymhwsG.js.map +1 -0
- package/dist/_chunks/{PkStreamingMarkdown-BFTTLuPc.js → PkStreamingMarkdown-CqLpNWQv.js} +2 -2
- package/dist/_chunks/{PkStreamingMarkdown-BFTTLuPc.js.map → PkStreamingMarkdown-CqLpNWQv.js.map} +1 -1
- package/dist/_chunks/{PkToolChatFile-Buv7Qkes.js → PkToolChatFile-iE4ZokYD.js} +2 -2
- package/dist/_chunks/{PkToolChatFile-Buv7Qkes.js.map → PkToolChatFile-iE4ZokYD.js.map} +1 -1
- package/dist/_chunks/{PkToolShareDocument-kB0qoQda.js → PkToolShareDocument-lTHNZodf.js} +2 -2
- package/dist/_chunks/{PkToolShareDocument-kB0qoQda.js.map → PkToolShareDocument-lTHNZodf.js.map} +1 -1
- package/dist/_chunks/{PkToolShowArtifact-ClYqvIqB.js → PkToolShowArtifact-BNQrM5fY.js} +2 -2
- package/dist/_chunks/{PkToolShowArtifact-ClYqvIqB.js.map → PkToolShowArtifact-BNQrM5fY.js.map} +1 -1
- package/dist/_chunks/{PkToolShowContactForm-C0ABjvtZ.js → PkToolShowContactForm-CvQoLumn.js} +2 -2
- package/dist/_chunks/{PkToolShowContactForm-C0ABjvtZ.js.map → PkToolShowContactForm-CvQoLumn.js.map} +1 -1
- package/dist/_chunks/{PkToolShowDiagram-BZbHtEs5.js → PkToolShowDiagram-COt1Z3q9.js} +2 -2
- package/dist/_chunks/{PkToolShowDiagram-BZbHtEs5.js.map → PkToolShowDiagram-COt1Z3q9.js.map} +1 -1
- package/dist/_chunks/{PkToolShowForm-DUjR-9o1.js → PkToolShowForm-DcPccCEU.js} +2 -2
- package/dist/_chunks/{PkToolShowForm-DUjR-9o1.js.map → PkToolShowForm-DcPccCEU.js.map} +1 -1
- package/dist/_chunks/{PkToolShowImageGallery-CNU2Zvso.js → PkToolShowImageGallery-DefXra8-.js} +2 -2
- package/dist/_chunks/{PkToolShowImageGallery-CNU2Zvso.js.map → PkToolShowImageGallery-DefXra8-.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSources-DhDjNIFa.js → PkToolShowSources-BE3Zv_uz.js} +2 -2
- package/dist/_chunks/{PkToolShowSources-DhDjNIFa.js.map → PkToolShowSources-BE3Zv_uz.js.map} +1 -1
- package/dist/_chunks/{useLightbox-BEEzZ0qT.js → useLightbox-D2Zi-Fpe.js} +72 -13
- package/dist/_chunks/useLightbox-D2Zi-Fpe.js.map +1 -0
- package/dist/ai-elements.es.js +4692 -4268
- 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/PkChatbotFilePreview.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-DmxsItHG.js → Agent-Cm1LrkYm.js} +162 -162
- package/dist-vue/_chunks/{Agent-DmxsItHG.js.map → Agent-Cm1LrkYm.js.map} +1 -1
- package/dist-vue/_chunks/{Document-CXfJxfu6.js → Document-DHBTrCuO.js} +10 -10
- package/dist-vue/_chunks/{Document-CXfJxfu6.js.map → Document-DHBTrCuO.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbot-Bpo22_yE.js → PkChatbot-DCGQnndK.js} +10 -9
- package/dist-vue/_chunks/PkChatbot-DCGQnndK.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotEmptyState-CQ_Qdkge.js → PkChatbotEmptyState-COya3H3C.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotEmptyState-CQ_Qdkge.js.map → PkChatbotEmptyState-COya3H3C.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotFilePreview-BpVM850N.js → PkChatbotFilePreview-BsvT6orx.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotFilePreview-BpVM850N.js.map → PkChatbotFilePreview-BsvT6orx.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotInput-BVu1b2Te.js → PkChatbotInput-D0KUEkAs.js} +5 -4
- package/dist-vue/_chunks/PkChatbotInput-D0KUEkAs.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotMessages-DftNL5ZQ.js → PkChatbotMessages-l-IzEWsN.js} +21 -21
- package/dist-vue/_chunks/{PkChatbotMessages-DftNL5ZQ.js.map → PkChatbotMessages-l-IzEWsN.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepPayload-AiDZPbds.js → PkChatbotStepPayload-cuYclK_2.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotStepPayload-AiDZPbds.js.map → PkChatbotStepPayload-cuYclK_2.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-CALZDpfQ.js → PkChatbotStepToolDetail-Yd8cUQJP.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-CALZDpfQ.js.map → PkChatbotStepToolDetail-Yd8cUQJP.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotSteps-CY7pN2Gl.js → PkChatbotSteps-_Aqft0em.js} +5 -5
- package/dist-vue/_chunks/{PkChatbotSteps-CY7pN2Gl.js.map → PkChatbotSteps-_Aqft0em.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewChat-Drp0At_n.js → PkChatbotViewChat-CHvtUHuO.js} +180 -178
- package/dist-vue/_chunks/PkChatbotViewChat-CHvtUHuO.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewConversations-C0KqM_Wq.js → PkChatbotViewConversations-7JU_5-F2.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewConversations-C0KqM_Wq.js.map → PkChatbotViewConversations-7JU_5-F2.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewFiles-B9mYRoNK.js → PkChatbotViewFiles-D53wtRPS.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewFiles-B9mYRoNK.js.map → PkChatbotViewFiles-D53wtRPS.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewProfile-BfNE3d7F.js → PkChatbotViewProfile-BRlLIofM.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewProfile-BfNE3d7F.js.map → PkChatbotViewProfile-BRlLIofM.js.map} +1 -1
- package/dist-vue/_chunks/{PkFilePreview-z7JcRtjP.js → PkFilePreview-DLo9nI2g.js} +426 -426
- package/dist-vue/_chunks/PkFilePreview-DLo9nI2g.js.map +1 -0
- package/dist-vue/_chunks/{PkFilePreviewDialog-zVon3aPY.js → PkFilePreviewDialog-CgDJQgIJ.js} +2 -2
- package/dist-vue/_chunks/{PkFilePreviewDialog-zVon3aPY.js.map → PkFilePreviewDialog-CgDJQgIJ.js.map} +1 -1
- package/dist-vue/_chunks/{PkStreamingMarkdown-bJEDk-kM.js → PkStreamingMarkdown-2FN4WMQD.js} +4 -4
- package/dist-vue/_chunks/{PkStreamingMarkdown-bJEDk-kM.js.map → PkStreamingMarkdown-2FN4WMQD.js.map} +1 -1
- package/dist-vue/_chunks/{PkSvgViewer-DmkElalq.js → PkSvgViewer-BsdSOBpH.js} +2 -2
- package/dist-vue/_chunks/{PkSvgViewer-DmkElalq.js.map → PkSvgViewer-BsdSOBpH.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolChatFile-DqLGwJxp.js → PkToolChatFile-DAT1tv52.js} +4 -4
- package/dist-vue/_chunks/{PkToolChatFile-DqLGwJxp.js.map → PkToolChatFile-DAT1tv52.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolRequestGeolocation-BnV7A6SW.js → PkToolRequestGeolocation-p7Ip17F7.js} +2 -2
- package/dist-vue/_chunks/{PkToolRequestGeolocation-BnV7A6SW.js.map → PkToolRequestGeolocation-p7Ip17F7.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolRequestOAuthConnection-QCbQ7bnl.js → PkToolRequestOAuthConnection-CtXSzKzM.js} +2 -2
- package/dist-vue/_chunks/{PkToolRequestOAuthConnection-QCbQ7bnl.js.map → PkToolRequestOAuthConnection-CtXSzKzM.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShareDocument-BIZkgcJ3.js → PkToolShareDocument-Qb2Lu5vh.js} +2 -2
- package/dist-vue/_chunks/{PkToolShareDocument-BIZkgcJ3.js.map → PkToolShareDocument-Qb2Lu5vh.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowArtifact-DanzULWt.js → PkToolShowArtifact-Bskomw05.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowArtifact-DanzULWt.js.map → PkToolShowArtifact-Bskomw05.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowContactForm-DzttQBG6.js → PkToolShowContactForm-iQrlqv7j.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowContactForm-DzttQBG6.js.map → PkToolShowContactForm-iQrlqv7j.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowDiagram-BNa89wcw.js → PkToolShowDiagram-C-43uUoh.js} +3 -3
- package/dist-vue/_chunks/{PkToolShowDiagram-BNa89wcw.js.map → PkToolShowDiagram-C-43uUoh.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowForm-BXol1WE3.js → PkToolShowForm-CKXpqQxy.js} +4 -4
- package/dist-vue/_chunks/{PkToolShowForm-BXol1WE3.js.map → PkToolShowForm-CKXpqQxy.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowImageGallery-Dmr5zXTj.js → PkToolShowImageGallery-DLTn6JmU.js} +3 -3
- package/dist-vue/_chunks/{PkToolShowImageGallery-Dmr5zXTj.js.map → PkToolShowImageGallery-DLTn6JmU.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowLocation-DCPaDtBI.js → PkToolShowLocation-B8FE_Sqd.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowLocation-DCPaDtBI.js.map → PkToolShowLocation-B8FE_Sqd.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowProductList-C_uIUG_G.js → PkToolShowProductList-hhSBAQVC.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowProductList-C_uIUG_G.js.map → PkToolShowProductList-hhSBAQVC.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSources-BHRNGn4s.js → PkToolShowSources-BiP9fVV2.js} +3 -3
- package/dist-vue/_chunks/{PkToolShowSources-BHRNGn4s.js.map → PkToolShowSources-BiP9fVV2.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSuggestedReply-DHCqxA1P.js → PkToolShowSuggestedReply-BRIzGNwx.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowSuggestedReply-DHCqxA1P.js.map → PkToolShowSuggestedReply-BRIzGNwx.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowVideo-P4H5A7ke.js → PkToolShowVideo-DJhsbDuX.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowVideo-P4H5A7ke.js.map → PkToolShowVideo-DJhsbDuX.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowWebPages-BzNZHR7Q.js → PkToolShowWebPages-BAv66f5H.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowWebPages-BzNZHR7Q.js.map → PkToolShowWebPages-BAv66f5H.js.map} +1 -1
- package/dist-vue/_chunks/{createChatbotApiClient-CQjxHqLr.js → createChatbotApiClient-DO4_I5hT.js} +21 -14
- package/dist-vue/_chunks/createChatbotApiClient-DO4_I5hT.js.map +1 -0
- package/dist-vue/_chunks/{useChatbotStore-CyZha9pf.js → useChatbotStore-Bj00X4yT.js} +1255 -1242
- package/dist-vue/_chunks/useChatbotStore-Bj00X4yT.js.map +1 -0
- package/dist-vue/_chunks/{useLightbox-gSzoBgNv.js → useLightbox-FDyQrPWe.js} +72 -13
- package/dist-vue/_chunks/useLightbox-FDyQrPWe.js.map +1 -0
- package/dist-vue/_chunks/{utils-8lO2Gj-m.js → utils-RwaXl9-x.js} +4 -4
- package/dist-vue/_chunks/{utils-8lO2Gj-m.js.map → utils-RwaXl9-x.js.map} +1 -1
- package/dist-vue/api.js +1 -1
- package/dist-vue/apps/web-component/src/components/EmbeddedChatWidget.ce.d.ts +4 -4
- package/dist-vue/apps/web-component/src/composables/usePagePointer.d.ts +14 -9
- package/dist-vue/apps/web-component/src/composables/usePendingMessage.d.ts +29 -15
- package/dist-vue/apps/web-component/src/composables/useSelectionActions.d.ts +77 -0
- package/dist-vue/composables.js +40 -8
- package/dist-vue/composables.js.map +1 -1
- package/dist-vue/index.js +5401 -5321
- package/dist-vue/index.js.map +1 -1
- package/dist-vue/locales.js +28 -2
- package/dist-vue/packages/components/src/chat/PkAgentSelectionActionsSettings.d.ts +25 -0
- package/dist-vue/packages/components/src/chat/PkAgentSettingsPanel.d.ts +23 -3
- package/dist-vue/packages/components/src/chat/PkChatbot.d.ts +2 -1
- package/dist-vue/packages/components/src/chat/PkChatbotInput.d.ts +2 -0
- package/dist-vue/packages/components/src/chat/PkSelectionActions.d.ts +2 -12
- package/dist-vue/packages/components/src/chat/PkSelectionAnswerCard.d.ts +41 -0
- package/dist-vue/packages/composable/src/chatbot/api/createChatbotApiClient.d.ts +6 -0
- package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +4 -1
- package/package.json +1 -1
- package/dist/_chunks/PkFilePreview-8nVPKv8k.js.map +0 -1
- package/dist/_chunks/useLightbox-BEEzZ0qT.js.map +0 -1
- package/dist-vue/_chunks/PkChatbot-Bpo22_yE.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotInput-BVu1b2Te.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotViewChat-Drp0At_n.js.map +0 -1
- package/dist-vue/_chunks/PkFilePreview-z7JcRtjP.js.map +0 -1
- package/dist-vue/_chunks/createChatbotApiClient-CQjxHqLr.js.map +0 -1
- package/dist-vue/_chunks/useChatbotStore-CyZha9pf.js.map +0 -1
- package/dist-vue/_chunks/useLightbox-gSzoBgNv.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 {
|
|
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 { Q as ee, V as y, X as te, Y as ne, at as re, et as ie, it as ae, rt as oe } from "./Agent-Cm1LrkYm.js";
|
|
3
|
+
import { r as se, t as ce } from "./createChatbotApiClient-DO4_I5hT.js";
|
|
4
|
+
import { n as le } from "./src-nb8MU1sh.js";
|
|
5
|
+
import { d as ue, r as de } from "./message-DuibQyHy.js";
|
|
6
|
+
import { n as fe, t as pe } from "./useSafeLocalStorage-Bn4SsL8C.js";
|
|
7
|
+
import { computed as b, getCurrentScope as me, isReadonly as he, nextTick as ge, onScopeDispose as _e, reactive as ve, ref as x, shallowRef as S, toRefs as ye, toValue as be, watch as C, watchEffect as xe } from "vue";
|
|
8
|
+
import { useI18n as Se } from "vue-i18n";
|
|
9
|
+
import { useDocumentVisibility as Ce, usePreferredDark as we } from "@vueuse/core";
|
|
10
|
+
import { defineStore as Te } from "pinia";
|
|
11
11
|
// ../../packages/utils/src/device-context.ts
|
|
12
|
-
function
|
|
12
|
+
function Ee() {
|
|
13
13
|
let e = navigator.connection, t = navigator.userAgentData;
|
|
14
14
|
return {
|
|
15
15
|
dateTime: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -39,7 +39,7 @@ function Te() {
|
|
|
39
39
|
historyLength: window.history.length
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
async function
|
|
42
|
+
async function De(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 Ee(e) {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
// ../../packages/composable/src/chatbot/hostTools.ts
|
|
60
|
-
var
|
|
60
|
+
var Oe = "agentstudio:page-navigation", ke = (e) => typeof e?.afterOutput == "function", Ae = (e) => e.toolMetadata?.source === oe, je = (e, t) => {
|
|
61
61
|
if (!t || !e?.length) return;
|
|
62
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 Me(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
|
+
ke(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 je(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, ae(n.readOnly));
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
let m;
|
|
@@ -103,22 +103,22 @@ function je(e) {
|
|
|
103
103
|
}
|
|
104
104
|
let v = new AbortController();
|
|
105
105
|
a.set(n.toolCallId, v), e.onActivity?.(n);
|
|
106
|
-
let
|
|
106
|
+
let ee = setTimeout(() => v.abort(/* @__PURE__ */ Error("timeout")), p), y;
|
|
107
107
|
try {
|
|
108
108
|
let t = new Promise((e, t) => {
|
|
109
109
|
v.signal.addEventListener("abort", () => t(v.signal.reason), { once: !0 });
|
|
110
110
|
});
|
|
111
|
-
|
|
111
|
+
y = Promise.resolve(f.execute(n.input, {
|
|
112
112
|
signal: v.signal,
|
|
113
113
|
callId: n.toolCallId,
|
|
114
114
|
messageId: n.messageId
|
|
115
115
|
}));
|
|
116
|
-
let r = await Promise.race([
|
|
116
|
+
let r = await Promise.race([y, t]);
|
|
117
117
|
if (!i()) {
|
|
118
118
|
s(r);
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
121
|
-
if (
|
|
121
|
+
if (ke(r)) {
|
|
122
122
|
l(n, r.result ?? null);
|
|
123
123
|
let t = !1, a = () => {
|
|
124
124
|
t || (t = !0, o.delete(a), r.abandon?.());
|
|
@@ -128,11 +128,11 @@ function je(e) {
|
|
|
128
128
|
});
|
|
129
129
|
} else l(n, r ?? null);
|
|
130
130
|
} catch (e) {
|
|
131
|
-
if (
|
|
131
|
+
if (y?.then(s, () => void 0), !i()) return;
|
|
132
132
|
let t = v.signal.aborted;
|
|
133
|
-
u(n, t ?
|
|
133
|
+
u(n, t ? ae(n.readOnly) : e instanceof Error && e.message ? e.message : "The host app failed to run this call.");
|
|
134
134
|
} finally {
|
|
135
|
-
clearTimeout(
|
|
135
|
+
clearTimeout(ee), a.delete(n.toolCallId), e.onActivity?.(void 0);
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
return {
|
|
@@ -151,65 +151,65 @@ function je(e) {
|
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
153
|
// ../../node_modules/.pnpm/@ai-sdk+provider@4.0.34/node_modules/@ai-sdk/provider/dist/index.js
|
|
154
|
-
var
|
|
154
|
+
var Ne = "vercel.ai.error", Pe = Symbol.for(Ne), w = class e extends Error {
|
|
155
155
|
constructor({ name: e, message: t, cause: n }) {
|
|
156
|
-
super(t), this[
|
|
156
|
+
super(t), this[Pe] = !0, this.name = e, this.cause = n;
|
|
157
157
|
}
|
|
158
158
|
static isInstance(t) {
|
|
159
|
-
return e.hasMarker(t,
|
|
159
|
+
return e.hasMarker(t, Ne);
|
|
160
160
|
}
|
|
161
161
|
static hasMarker(e, t) {
|
|
162
162
|
let n = Symbol.for(t);
|
|
163
163
|
return typeof e == "object" && !!e && n in e && typeof e[n] == "boolean" && e[n] === !0;
|
|
164
164
|
}
|
|
165
|
-
},
|
|
165
|
+
}, Fe = "AI_APICallError", Ie = `vercel.ai.error.${Fe}`, Le = Symbol.for(Ie), Re = class extends w {
|
|
166
166
|
constructor({ message: e, url: t, requestBodyValues: n, statusCode: r, responseHeaders: i, responseBody: a, cause: o, isRetryable: s = r != null && (r === 408 || r === 409 || r === 429 || r >= 500), data: c }) {
|
|
167
167
|
super({
|
|
168
|
-
name:
|
|
168
|
+
name: Fe,
|
|
169
169
|
message: e,
|
|
170
170
|
cause: o
|
|
171
|
-
}), this[
|
|
171
|
+
}), this[Le] = !0, this.url = t, this.requestBodyValues = n, this.statusCode = r, this.responseHeaders = i, this.responseBody = a, this.isRetryable = s, this.data = c;
|
|
172
172
|
}
|
|
173
173
|
static isInstance(e) {
|
|
174
|
-
return
|
|
174
|
+
return w.hasMarker(e, Ie);
|
|
175
175
|
}
|
|
176
|
-
},
|
|
176
|
+
}, ze = "AI_EmptyResponseBodyError", Be = `vercel.ai.error.${ze}`, Ve = Symbol.for(Be), He = class extends w {
|
|
177
177
|
constructor({ message: e = "Empty response body" } = {}) {
|
|
178
178
|
super({
|
|
179
|
-
name:
|
|
179
|
+
name: ze,
|
|
180
180
|
message: e
|
|
181
|
-
}), this[
|
|
181
|
+
}), this[Ve] = !0;
|
|
182
182
|
}
|
|
183
183
|
static isInstance(e) {
|
|
184
|
-
return
|
|
184
|
+
return w.hasMarker(e, Be);
|
|
185
185
|
}
|
|
186
186
|
};
|
|
187
|
-
function
|
|
187
|
+
function Ue(e) {
|
|
188
188
|
return e == null ? "unknown error" : typeof e == "string" ? e : e instanceof Error ? e.toString() : JSON.stringify(e);
|
|
189
189
|
}
|
|
190
|
-
var
|
|
190
|
+
var We = "AI_InvalidArgumentError", Ge = `vercel.ai.error.${We}`, T = Symbol.for(Ge), Ke = class extends w {
|
|
191
191
|
constructor({ message: e, cause: t, argument: n }) {
|
|
192
192
|
super({
|
|
193
|
-
name:
|
|
193
|
+
name: We,
|
|
194
194
|
message: e,
|
|
195
195
|
cause: t
|
|
196
|
-
}), this[
|
|
196
|
+
}), this[T] = !0, this.argument = n;
|
|
197
197
|
}
|
|
198
198
|
static isInstance(e) {
|
|
199
|
-
return
|
|
199
|
+
return w.hasMarker(e, Ge);
|
|
200
200
|
}
|
|
201
|
-
},
|
|
201
|
+
}, qe = "AI_JSONParseError", E = `vercel.ai.error.${qe}`, Je = Symbol.for(E), D = class extends w {
|
|
202
202
|
constructor({ text: e, cause: t }) {
|
|
203
203
|
super({
|
|
204
|
-
name:
|
|
205
|
-
message: `JSON parsing failed: Text: ${e}.\nError message: ${
|
|
204
|
+
name: qe,
|
|
205
|
+
message: `JSON parsing failed: Text: ${e}.\nError message: ${Ue(t)}`,
|
|
206
206
|
cause: t
|
|
207
|
-
}), this[
|
|
207
|
+
}), this[Je] = !0, this.text = e;
|
|
208
208
|
}
|
|
209
209
|
static isInstance(e) {
|
|
210
|
-
return
|
|
210
|
+
return w.hasMarker(e, E);
|
|
211
211
|
}
|
|
212
|
-
},
|
|
212
|
+
}, Ye = "AI_TypeValidationError", Xe = `vercel.ai.error.${Ye}`, Ze = Symbol.for(Xe), Qe = class e extends w {
|
|
213
213
|
constructor({ value: e, cause: t, context: n }) {
|
|
214
214
|
let r = "Type validation failed";
|
|
215
215
|
if (n?.field && (r += ` for ${n.field}`), n?.entityName || n?.entityId) {
|
|
@@ -218,13 +218,13 @@ var Ue = "AI_InvalidArgumentError", We = `vercel.ai.error.${Ue}`, E = Symbol.for
|
|
|
218
218
|
n.entityName && e.push(n.entityName), n.entityId && e.push(`id: "${n.entityId}"`), r += e.join(", "), r += ")";
|
|
219
219
|
}
|
|
220
220
|
super({
|
|
221
|
-
name:
|
|
222
|
-
message: `${r}: Value: ${JSON.stringify(e)}.\nError message: ${
|
|
221
|
+
name: Ye,
|
|
222
|
+
message: `${r}: Value: ${JSON.stringify(e)}.\nError message: ${Ue(t)}`,
|
|
223
223
|
cause: t
|
|
224
|
-
}), this[
|
|
224
|
+
}), this[Ze] = !0, this.value = e, this.context = n;
|
|
225
225
|
}
|
|
226
226
|
static isInstance(e) {
|
|
227
|
-
return
|
|
227
|
+
return w.hasMarker(e, Xe);
|
|
228
228
|
}
|
|
229
229
|
static wrap({ value: t, cause: n, context: r }) {
|
|
230
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({
|
|
@@ -233,25 +233,25 @@ var Ue = "AI_InvalidArgumentError", We = `vercel.ai.error.${Ue}`, E = Symbol.for
|
|
|
233
233
|
context: r
|
|
234
234
|
});
|
|
235
235
|
}
|
|
236
|
-
},
|
|
236
|
+
}, $e = "AI_UnsupportedFunctionalityError", et = `vercel.ai.error.${$e}`, tt = Symbol.for(et), nt = class extends w {
|
|
237
237
|
constructor({ functionality: e, message: t = `'${e}' functionality not supported.` }) {
|
|
238
238
|
super({
|
|
239
|
-
name:
|
|
239
|
+
name: $e,
|
|
240
240
|
message: t
|
|
241
|
-
}), this[
|
|
241
|
+
}), this[tt] = !0, this.functionality = e;
|
|
242
242
|
}
|
|
243
243
|
static isInstance(e) {
|
|
244
|
-
return
|
|
244
|
+
return w.hasMarker(e, et);
|
|
245
245
|
}
|
|
246
|
-
},
|
|
246
|
+
}, rt = class extends Error {
|
|
247
247
|
constructor(e, t) {
|
|
248
248
|
super(e), this.name = "ParseError", this.type = t.type, this.field = t.field, this.value = t.value, this.line = t.line;
|
|
249
249
|
}
|
|
250
|
-
},
|
|
251
|
-
function
|
|
252
|
-
function
|
|
250
|
+
}, it = 10, at = 13, O = 32;
|
|
251
|
+
function ot(e) {}
|
|
252
|
+
function st(e) {
|
|
253
253
|
if (typeof e == "function") throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");
|
|
254
|
-
let { onEvent: t =
|
|
254
|
+
let { onEvent: t = ot, onError: n = ot, onRetry: r = ot, onComment: i, maxBufferSize: a } = e, o = [], s = 0, c = !0, l, u = "", d = 0, f, p = !1;
|
|
255
255
|
function m(e) {
|
|
256
256
|
if (p) throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");
|
|
257
257
|
if (c && (c = !1, e.charCodeAt(0) === 239 && e.charCodeAt(1) === 187 && e.charCodeAt(2) === 191 && (e = e.slice(3))), o.length === 0) {
|
|
@@ -270,7 +270,7 @@ function ot(e) {
|
|
|
270
270
|
n !== "" && (o.push(n), s = n.length), h();
|
|
271
271
|
}
|
|
272
272
|
function h() {
|
|
273
|
-
a !== void 0 && (s + u.length <= a || (p = !0, o.length = 0, s = 0, l = void 0, u = "", d = 0, f = void 0, n(new
|
|
273
|
+
a !== void 0 && (s + u.length <= a || (p = !0, o.length = 0, s = 0, l = void 0, u = "", d = 0, f = void 0, n(new rt(`Buffered data exceeded max buffer size of ${a} characters`, { type: "max-buffer-size-exceeded" }))));
|
|
274
274
|
}
|
|
275
275
|
function g(e) {
|
|
276
276
|
let n = 0;
|
|
@@ -286,9 +286,9 @@ function ot(e) {
|
|
|
286
286
|
continue;
|
|
287
287
|
}
|
|
288
288
|
let i = e.charCodeAt(n);
|
|
289
|
-
if (
|
|
290
|
-
let i = e.charCodeAt(n + 5) ===
|
|
291
|
-
if (d === 0 && e.charCodeAt(r + 1) ===
|
|
289
|
+
if (ct(e, n, i)) {
|
|
290
|
+
let i = e.charCodeAt(n + 5) === O ? n + 6 : n + 5, a = e.slice(i, r);
|
|
291
|
+
if (d === 0 && e.charCodeAt(r + 1) === it) {
|
|
292
292
|
t({
|
|
293
293
|
id: l,
|
|
294
294
|
event: f,
|
|
@@ -298,7 +298,7 @@ function ot(e) {
|
|
|
298
298
|
}
|
|
299
299
|
u = d === 0 ? a : `${u}
|
|
300
300
|
${a}`, d++;
|
|
301
|
-
} else
|
|
301
|
+
} else k(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) === O ? n + 7 : n + 6, r) || void 0 : _(e, n, r);
|
|
302
302
|
n = r + 1, r = e.indexOf("\n", n);
|
|
303
303
|
}
|
|
304
304
|
return e.slice(n);
|
|
@@ -306,35 +306,35 @@ ${a}`, d++;
|
|
|
306
306
|
for (; n < e.length;) {
|
|
307
307
|
let t = e.indexOf("\r", n), r = e.indexOf("\n", n), i = -1;
|
|
308
308
|
if (t !== -1 && r !== -1 ? i = t < r ? t : r : t === -1 ? r !== -1 && (i = r) : i = t === e.length - 1 ? -1 : t, i === -1) break;
|
|
309
|
-
_(e, n, i), n = i + 1, e.charCodeAt(n - 1) ===
|
|
309
|
+
_(e, n, i), n = i + 1, e.charCodeAt(n - 1) === at && e.charCodeAt(n) === it && n++;
|
|
310
310
|
}
|
|
311
311
|
return e.slice(n);
|
|
312
312
|
}
|
|
313
313
|
function _(e, t, n) {
|
|
314
314
|
if (t === n) {
|
|
315
|
-
|
|
315
|
+
ee();
|
|
316
316
|
return;
|
|
317
317
|
}
|
|
318
318
|
let r = e.charCodeAt(t);
|
|
319
|
-
if (
|
|
320
|
-
let r = e.charCodeAt(t + 5) ===
|
|
319
|
+
if (ct(e, t, r)) {
|
|
320
|
+
let r = e.charCodeAt(t + 5) === O ? t + 6 : t + 5, i = e.slice(r, n);
|
|
321
321
|
u = d === 0 ? i : `${u}
|
|
322
322
|
${i}`, d++;
|
|
323
323
|
return;
|
|
324
324
|
}
|
|
325
|
-
if (
|
|
326
|
-
f = e.slice(e.charCodeAt(t + 6) ===
|
|
325
|
+
if (k(e, t, r)) {
|
|
326
|
+
f = e.slice(e.charCodeAt(t + 6) === O ? t + 7 : t + 6, n) || void 0;
|
|
327
327
|
return;
|
|
328
328
|
}
|
|
329
329
|
if (r === 105 && e.charCodeAt(t + 1) === 100 && e.charCodeAt(t + 2) === 58) {
|
|
330
|
-
let r = e.slice(e.charCodeAt(t + 3) ===
|
|
330
|
+
let r = e.slice(e.charCodeAt(t + 3) === O ? t + 4 : t + 3, n);
|
|
331
331
|
l = r.includes("\0") ? void 0 : r;
|
|
332
332
|
return;
|
|
333
333
|
}
|
|
334
334
|
if (r === 58) {
|
|
335
335
|
if (i) {
|
|
336
336
|
let r = e.slice(t, n);
|
|
337
|
-
i(r.slice(e.charCodeAt(t + 1) ===
|
|
337
|
+
i(r.slice(e.charCodeAt(t + 1) === O ? 2 : 1));
|
|
338
338
|
}
|
|
339
339
|
return;
|
|
340
340
|
}
|
|
@@ -343,7 +343,7 @@ ${i}`, d++;
|
|
|
343
343
|
v(a, "", a);
|
|
344
344
|
return;
|
|
345
345
|
}
|
|
346
|
-
let s = a.slice(0, o), c = a.charCodeAt(o + 1) ===
|
|
346
|
+
let s = a.slice(0, o), c = a.charCodeAt(o + 1) === O ? 2 : 1;
|
|
347
347
|
v(s, a.slice(o + c), a);
|
|
348
348
|
}
|
|
349
349
|
function v(e, t, i) {
|
|
@@ -359,13 +359,13 @@ ${t}`, d++;
|
|
|
359
359
|
l = t.includes("\0") ? void 0 : t;
|
|
360
360
|
break;
|
|
361
361
|
case "retry":
|
|
362
|
-
/^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new
|
|
362
|
+
/^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new rt(`Invalid \`retry\` value: "${t}"`, {
|
|
363
363
|
type: "invalid-retry",
|
|
364
364
|
value: t,
|
|
365
365
|
line: i
|
|
366
366
|
}));
|
|
367
367
|
break;
|
|
368
|
-
default: n(new
|
|
368
|
+
default: n(new rt(`Unknown field "${e.length > 20 ? `${e.slice(0, 20)}\u2026` : e}"`, {
|
|
369
369
|
type: "unknown-field",
|
|
370
370
|
field: e,
|
|
371
371
|
value: t,
|
|
@@ -373,14 +373,14 @@ ${t}`, d++;
|
|
|
373
373
|
}));
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
|
-
function
|
|
376
|
+
function ee() {
|
|
377
377
|
d > 0 && t({
|
|
378
378
|
id: l,
|
|
379
379
|
event: f,
|
|
380
380
|
data: u
|
|
381
381
|
}), l = void 0, u = "", d = 0, f = void 0;
|
|
382
382
|
}
|
|
383
|
-
function
|
|
383
|
+
function y(e = {}) {
|
|
384
384
|
if (e.consume && o.length > 0) {
|
|
385
385
|
let e = o.join("");
|
|
386
386
|
_(e, 0, e.length);
|
|
@@ -389,22 +389,22 @@ ${t}`, d++;
|
|
|
389
389
|
}
|
|
390
390
|
return {
|
|
391
391
|
feed: m,
|
|
392
|
-
reset:
|
|
392
|
+
reset: y
|
|
393
393
|
};
|
|
394
394
|
}
|
|
395
|
-
function
|
|
395
|
+
function ct(e, t, n) {
|
|
396
396
|
return n === 100 && e.charCodeAt(t + 1) === 97 && e.charCodeAt(t + 2) === 116 && e.charCodeAt(t + 3) === 97 && e.charCodeAt(t + 4) === 58;
|
|
397
397
|
}
|
|
398
|
-
function
|
|
398
|
+
function k(e, t, n) {
|
|
399
399
|
return n === 101 && e.charCodeAt(t + 1) === 118 && e.charCodeAt(t + 2) === 101 && e.charCodeAt(t + 3) === 110 && e.charCodeAt(t + 4) === 116 && e.charCodeAt(t + 5) === 58;
|
|
400
400
|
}
|
|
401
401
|
// ../../node_modules/.pnpm/eventsource-parser@3.1.0/node_modules/eventsource-parser/dist/stream.js
|
|
402
|
-
var
|
|
402
|
+
var lt = class extends TransformStream {
|
|
403
403
|
constructor({ onError: e, onRetry: t, onComment: n, maxBufferSize: r } = {}) {
|
|
404
404
|
let i;
|
|
405
405
|
super({
|
|
406
406
|
start(a) {
|
|
407
|
-
i =
|
|
407
|
+
i = st({
|
|
408
408
|
onEvent: (e) => {
|
|
409
409
|
a.enqueue(e);
|
|
410
410
|
},
|
|
@@ -423,8 +423,8 @@ var ct = class extends TransformStream {
|
|
|
423
423
|
}
|
|
424
424
|
};
|
|
425
425
|
new TextDecoder();
|
|
426
|
-
var { btoa:
|
|
427
|
-
function
|
|
426
|
+
var { btoa: ut, atob: dt } = globalThis;
|
|
427
|
+
function A(e) {
|
|
428
428
|
if (e == null) return {};
|
|
429
429
|
let t = {};
|
|
430
430
|
if (e instanceof Headers) e.forEach((e, n) => {
|
|
@@ -436,28 +436,28 @@ function j(e) {
|
|
|
436
436
|
}
|
|
437
437
|
return t;
|
|
438
438
|
}
|
|
439
|
-
var
|
|
439
|
+
var j = ({ prefix: e, size: t = 16, alphabet: n = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", separator: r = "-" } = {}) => {
|
|
440
440
|
let i = () => {
|
|
441
441
|
let e = n.length, r = Array(t);
|
|
442
442
|
for (let i = 0; i < t; i++) r[i] = n[Math.random() * e | 0];
|
|
443
443
|
return r.join("");
|
|
444
444
|
};
|
|
445
445
|
if (e == null) return i;
|
|
446
|
-
if (n.includes(r)) throw new
|
|
446
|
+
if (n.includes(r)) throw new Ke({
|
|
447
447
|
argument: "separator",
|
|
448
448
|
message: `The separator "${r}" must not be part of the alphabet "${n}".`
|
|
449
449
|
});
|
|
450
450
|
return () => `${e}${r}${i()}`;
|
|
451
|
-
},
|
|
452
|
-
function
|
|
451
|
+
}, ft = j();
|
|
452
|
+
function pt(e) {
|
|
453
453
|
return globalThis.Buffer?.isBuffer(e) ?? !1;
|
|
454
454
|
}
|
|
455
|
-
var
|
|
456
|
-
function
|
|
455
|
+
var mt = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/, ht = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
|
|
456
|
+
function gt(e) {
|
|
457
457
|
let t = JSON.parse(e);
|
|
458
|
-
return typeof t != "object" || !t ||
|
|
458
|
+
return typeof t != "object" || !t || mt.test(e) === !1 && ht.test(e) === !1 ? t : _t(t);
|
|
459
459
|
}
|
|
460
|
-
function
|
|
460
|
+
function _t(e) {
|
|
461
461
|
let t = [e];
|
|
462
462
|
for (; t.length;) {
|
|
463
463
|
let e = t;
|
|
@@ -472,35 +472,35 @@ function gt(e) {
|
|
|
472
472
|
}
|
|
473
473
|
return e;
|
|
474
474
|
}
|
|
475
|
-
function
|
|
475
|
+
function M(e) {
|
|
476
476
|
let { stackTraceLimit: t } = Error;
|
|
477
477
|
try {
|
|
478
478
|
Error.stackTraceLimit = 0;
|
|
479
479
|
} catch {
|
|
480
|
-
return
|
|
480
|
+
return gt(e);
|
|
481
481
|
}
|
|
482
482
|
try {
|
|
483
|
-
return
|
|
483
|
+
return gt(e);
|
|
484
484
|
} finally {
|
|
485
485
|
Error.stackTraceLimit = t;
|
|
486
486
|
}
|
|
487
487
|
}
|
|
488
|
-
function
|
|
488
|
+
function vt(e) {
|
|
489
489
|
if (e.type === "object" || Array.isArray(e.type) && e.type.includes("object")) {
|
|
490
490
|
let { additionalProperties: t } = e;
|
|
491
|
-
e.additionalProperties = t != null && typeof t != "boolean" &&
|
|
491
|
+
e.additionalProperties = t != null && typeof t != "boolean" && N(t);
|
|
492
492
|
let { properties: n } = e;
|
|
493
|
-
if (n != null) for (let e of Object.keys(n)) n[e] =
|
|
493
|
+
if (n != null) for (let e of Object.keys(n)) n[e] = N(n[e]);
|
|
494
494
|
}
|
|
495
|
-
e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(
|
|
495
|
+
e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(N) : N(e.items)), e.anyOf != null && (e.anyOf = e.anyOf.map(N)), e.allOf != null && (e.allOf = e.allOf.map(N)), e.oneOf != null && (e.oneOf = e.oneOf.map(N));
|
|
496
496
|
let { definitions: t } = e;
|
|
497
|
-
if (t != null) for (let e of Object.keys(t)) t[e] =
|
|
497
|
+
if (t != null) for (let e of Object.keys(t)) t[e] = N(t[e]);
|
|
498
498
|
return e;
|
|
499
499
|
}
|
|
500
|
-
function
|
|
501
|
-
return typeof e == "boolean" ? e :
|
|
500
|
+
function N(e) {
|
|
501
|
+
return typeof e == "boolean" ? e : vt(e);
|
|
502
502
|
}
|
|
503
|
-
var
|
|
503
|
+
var yt = Symbol("Let zodToJsonSchema decide on which parser to use"), bt = {
|
|
504
504
|
name: void 0,
|
|
505
505
|
$refStrategy: "root",
|
|
506
506
|
basePath: ["#"],
|
|
@@ -520,24 +520,24 @@ var vt = Symbol("Let zodToJsonSchema decide on which parser to use"), yt = {
|
|
|
520
520
|
emailStrategy: "format:email",
|
|
521
521
|
base64Strategy: "contentEncoding:base64",
|
|
522
522
|
nameStrategy: "ref"
|
|
523
|
-
},
|
|
524
|
-
...
|
|
523
|
+
}, xt = (e) => typeof e == "string" ? {
|
|
524
|
+
...bt,
|
|
525
525
|
name: e
|
|
526
526
|
} : {
|
|
527
|
-
...
|
|
527
|
+
...bt,
|
|
528
528
|
...e
|
|
529
529
|
};
|
|
530
|
-
function
|
|
530
|
+
function P() {
|
|
531
531
|
return {};
|
|
532
532
|
}
|
|
533
|
-
function
|
|
533
|
+
function St(e, t) {
|
|
534
534
|
let n = { type: "array" };
|
|
535
|
-
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, {
|
|
536
536
|
...t,
|
|
537
537
|
currentPath: [...t.currentPath, "items"]
|
|
538
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;
|
|
539
539
|
}
|
|
540
|
-
function
|
|
540
|
+
function Ct(e) {
|
|
541
541
|
let t = {
|
|
542
542
|
type: "integer",
|
|
543
543
|
format: "int64"
|
|
@@ -554,16 +554,16 @@ function St(e) {
|
|
|
554
554
|
}
|
|
555
555
|
return t;
|
|
556
556
|
}
|
|
557
|
-
function
|
|
557
|
+
function wt() {
|
|
558
558
|
return { type: "boolean" };
|
|
559
559
|
}
|
|
560
|
-
function
|
|
561
|
-
return
|
|
560
|
+
function Tt(e, t) {
|
|
561
|
+
return q(e.type._def, t);
|
|
562
562
|
}
|
|
563
|
-
var
|
|
564
|
-
function
|
|
563
|
+
var F = (e, t) => q(e.innerType._def, t);
|
|
564
|
+
function Et(e, t, n) {
|
|
565
565
|
let r = n ?? t.dateStrategy;
|
|
566
|
-
if (Array.isArray(r)) return { anyOf: r.map((n) =>
|
|
566
|
+
if (Array.isArray(r)) return { anyOf: r.map((n) => Et(e, t, n)) };
|
|
567
567
|
switch (r) {
|
|
568
568
|
case "string":
|
|
569
569
|
case "format:date-time": return {
|
|
@@ -574,10 +574,10 @@ function Tt(e, t, n) {
|
|
|
574
574
|
type: "string",
|
|
575
575
|
format: "date"
|
|
576
576
|
};
|
|
577
|
-
case "integer": return
|
|
577
|
+
case "integer": return Dt(e);
|
|
578
578
|
}
|
|
579
579
|
}
|
|
580
|
-
var
|
|
580
|
+
var Dt = (e) => {
|
|
581
581
|
let t = {
|
|
582
582
|
type: "integer",
|
|
583
583
|
format: "unix-time"
|
|
@@ -590,31 +590,31 @@ var Et = (e) => {
|
|
|
590
590
|
}
|
|
591
591
|
return t;
|
|
592
592
|
};
|
|
593
|
-
function
|
|
593
|
+
function Ot(e, t) {
|
|
594
594
|
return {
|
|
595
|
-
...
|
|
595
|
+
...q(e.innerType._def, t),
|
|
596
596
|
default: e.defaultValue()
|
|
597
597
|
};
|
|
598
598
|
}
|
|
599
|
-
function
|
|
600
|
-
return t.effectStrategy === "input" ?
|
|
599
|
+
function I(e, t) {
|
|
600
|
+
return t.effectStrategy === "input" ? q(e.schema._def, t) : P();
|
|
601
601
|
}
|
|
602
|
-
function
|
|
602
|
+
function L(e) {
|
|
603
603
|
return {
|
|
604
604
|
type: "string",
|
|
605
605
|
enum: Array.from(e.values)
|
|
606
606
|
};
|
|
607
607
|
}
|
|
608
|
-
var
|
|
608
|
+
var R = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
|
|
609
609
|
function kt(e, t) {
|
|
610
|
-
let n = [
|
|
610
|
+
let n = [q(e.left._def, {
|
|
611
611
|
...t,
|
|
612
612
|
currentPath: [
|
|
613
613
|
...t.currentPath,
|
|
614
614
|
"allOf",
|
|
615
615
|
"0"
|
|
616
616
|
]
|
|
617
|
-
}),
|
|
617
|
+
}), q(e.right._def, {
|
|
618
618
|
...t,
|
|
619
619
|
currentPath: [
|
|
620
620
|
...t.currentPath,
|
|
@@ -623,7 +623,7 @@ function kt(e, t) {
|
|
|
623
623
|
]
|
|
624
624
|
})].filter((e) => !!e), r = [];
|
|
625
625
|
return n.forEach((e) => {
|
|
626
|
-
if (
|
|
626
|
+
if (R(e)) r.push(...e.allOf);
|
|
627
627
|
else {
|
|
628
628
|
let t = e;
|
|
629
629
|
if ("additionalProperties" in e && e.additionalProperties === !1) {
|
|
@@ -812,7 +812,7 @@ function Ft(e, t) {
|
|
|
812
812
|
function It(e, t) {
|
|
813
813
|
let n = {
|
|
814
814
|
type: "object",
|
|
815
|
-
additionalProperties:
|
|
815
|
+
additionalProperties: q(e.valueType._def, {
|
|
816
816
|
...t,
|
|
817
817
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
818
818
|
}) ?? t.allowedAdditionalProperties
|
|
@@ -829,7 +829,7 @@ function It(e, t) {
|
|
|
829
829
|
propertyNames: { enum: e.keyType._def.values }
|
|
830
830
|
};
|
|
831
831
|
if (e.keyType?._def.typeName === "ZodBranded" && e.keyType._def.type._def.typeName === "ZodString" && e.keyType._def.type._def.checks?.length) {
|
|
832
|
-
let { type: r, ...i } =
|
|
832
|
+
let { type: r, ...i } = Tt(e.keyType._def, t);
|
|
833
833
|
return {
|
|
834
834
|
...n,
|
|
835
835
|
propertyNames: i
|
|
@@ -843,7 +843,7 @@ function Lt(e, t) {
|
|
|
843
843
|
maxItems: 125,
|
|
844
844
|
items: {
|
|
845
845
|
type: "array",
|
|
846
|
-
items: [
|
|
846
|
+
items: [q(e.keyType._def, {
|
|
847
847
|
...t,
|
|
848
848
|
currentPath: [
|
|
849
849
|
...t.currentPath,
|
|
@@ -851,7 +851,7 @@ function Lt(e, t) {
|
|
|
851
851
|
"items",
|
|
852
852
|
"0"
|
|
853
853
|
]
|
|
854
|
-
}) ||
|
|
854
|
+
}) || P(), q(e.valueType._def, {
|
|
855
855
|
...t,
|
|
856
856
|
currentPath: [
|
|
857
857
|
...t.currentPath,
|
|
@@ -859,7 +859,7 @@ function Lt(e, t) {
|
|
|
859
859
|
"items",
|
|
860
860
|
"1"
|
|
861
861
|
]
|
|
862
|
-
}) ||
|
|
862
|
+
}) || P()],
|
|
863
863
|
minItems: 2,
|
|
864
864
|
maxItems: 2
|
|
865
865
|
}
|
|
@@ -873,7 +873,7 @@ function U(e) {
|
|
|
873
873
|
};
|
|
874
874
|
}
|
|
875
875
|
function Rt() {
|
|
876
|
-
return { not:
|
|
876
|
+
return { not: P() };
|
|
877
877
|
}
|
|
878
878
|
function zt() {
|
|
879
879
|
return { type: "null" };
|
|
@@ -920,7 +920,7 @@ function Vt(e, t) {
|
|
|
920
920
|
return Ht(e, t);
|
|
921
921
|
}
|
|
922
922
|
var Ht = (e, t) => {
|
|
923
|
-
let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) =>
|
|
923
|
+
let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => q(e._def, {
|
|
924
924
|
...t,
|
|
925
925
|
currentPath: [
|
|
926
926
|
...t.currentPath,
|
|
@@ -930,7 +930,7 @@ var Ht = (e, t) => {
|
|
|
930
930
|
})).filter((e) => !!e && (!t.strictUnions || typeof e == "object" && Object.keys(e).length > 0));
|
|
931
931
|
return n.length ? { anyOf: n } : void 0;
|
|
932
932
|
};
|
|
933
|
-
function
|
|
933
|
+
function Ut(e, t) {
|
|
934
934
|
if ([
|
|
935
935
|
"ZodString",
|
|
936
936
|
"ZodNumber",
|
|
@@ -938,7 +938,7 @@ function W(e, t) {
|
|
|
938
938
|
"ZodBoolean",
|
|
939
939
|
"ZodNull"
|
|
940
940
|
].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [Bt[e.innerType._def.typeName], "null"] };
|
|
941
|
-
let n =
|
|
941
|
+
let n = q(e.innerType._def, {
|
|
942
942
|
...t,
|
|
943
943
|
currentPath: [
|
|
944
944
|
...t.currentPath,
|
|
@@ -948,7 +948,7 @@ function W(e, t) {
|
|
|
948
948
|
});
|
|
949
949
|
return n && { anyOf: [n, { type: "null" }] };
|
|
950
950
|
}
|
|
951
|
-
function
|
|
951
|
+
function Wt(e) {
|
|
952
952
|
let t = { type: "number" };
|
|
953
953
|
if (!e.checks) return t;
|
|
954
954
|
for (let n of e.checks) switch (n.kind) {
|
|
@@ -965,7 +965,7 @@ function Ut(e) {
|
|
|
965
965
|
}
|
|
966
966
|
return t;
|
|
967
967
|
}
|
|
968
|
-
function
|
|
968
|
+
function Gt(e, t) {
|
|
969
969
|
let n = {
|
|
970
970
|
type: "object",
|
|
971
971
|
properties: {}
|
|
@@ -973,7 +973,7 @@ function Wt(e, t) {
|
|
|
973
973
|
for (let e in i) {
|
|
974
974
|
let a = i[e];
|
|
975
975
|
if (a === void 0 || a._def === void 0) continue;
|
|
976
|
-
let o =
|
|
976
|
+
let o = qt(a), s = q(a._def, {
|
|
977
977
|
...t,
|
|
978
978
|
currentPath: [
|
|
979
979
|
...t.currentPath,
|
|
@@ -989,11 +989,11 @@ function Wt(e, t) {
|
|
|
989
989
|
s !== void 0 && (n.properties[e] = s, o || r.push(e));
|
|
990
990
|
}
|
|
991
991
|
r.length && (n.required = r);
|
|
992
|
-
let a =
|
|
992
|
+
let a = Kt(e, t);
|
|
993
993
|
return a !== void 0 && (n.additionalProperties = a), n;
|
|
994
994
|
}
|
|
995
|
-
function
|
|
996
|
-
if (e.catchall._def.typeName !== "ZodNever") return
|
|
995
|
+
function Kt(e, t) {
|
|
996
|
+
if (e.catchall._def.typeName !== "ZodNever") return q(e.catchall._def, {
|
|
997
997
|
...t,
|
|
998
998
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
999
999
|
});
|
|
@@ -1003,16 +1003,16 @@ function Gt(e, t) {
|
|
|
1003
1003
|
case "strip": return t.removeAdditionalStrategy === "strict" ? t.allowedAdditionalProperties : t.rejectedAdditionalProperties;
|
|
1004
1004
|
}
|
|
1005
1005
|
}
|
|
1006
|
-
function
|
|
1006
|
+
function qt(e) {
|
|
1007
1007
|
try {
|
|
1008
1008
|
return e.isOptional();
|
|
1009
1009
|
} catch {
|
|
1010
1010
|
return !0;
|
|
1011
1011
|
}
|
|
1012
1012
|
}
|
|
1013
|
-
var
|
|
1014
|
-
if (t.currentPath.toString() === t.propertyPath?.toString()) return
|
|
1015
|
-
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, {
|
|
1016
1016
|
...t,
|
|
1017
1017
|
currentPath: [
|
|
1018
1018
|
...t.currentPath,
|
|
@@ -1020,11 +1020,11 @@ var qt = (e, t) => {
|
|
|
1020
1020
|
"1"
|
|
1021
1021
|
]
|
|
1022
1022
|
});
|
|
1023
|
-
return n ? { anyOf: [{ not:
|
|
1024
|
-
},
|
|
1025
|
-
if (t.pipeStrategy === "input") return
|
|
1026
|
-
if (t.pipeStrategy === "output") return
|
|
1027
|
-
let n =
|
|
1023
|
+
return n ? { anyOf: [{ not: P() }, n] } : P();
|
|
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, {
|
|
1028
1028
|
...t,
|
|
1029
1029
|
currentPath: [
|
|
1030
1030
|
...t.currentPath,
|
|
@@ -1032,7 +1032,7 @@ var qt = (e, t) => {
|
|
|
1032
1032
|
"0"
|
|
1033
1033
|
]
|
|
1034
1034
|
});
|
|
1035
|
-
return { allOf: [n,
|
|
1035
|
+
return { allOf: [n, q(e.out._def, {
|
|
1036
1036
|
...t,
|
|
1037
1037
|
currentPath: [
|
|
1038
1038
|
...t.currentPath,
|
|
@@ -1041,25 +1041,25 @@ var qt = (e, t) => {
|
|
|
1041
1041
|
]
|
|
1042
1042
|
})].filter((e) => e !== void 0) };
|
|
1043
1043
|
};
|
|
1044
|
-
function Yt(e, t) {
|
|
1045
|
-
return J(e.type._def, t);
|
|
1046
|
-
}
|
|
1047
1044
|
function Xt(e, t) {
|
|
1045
|
+
return q(e.type._def, t);
|
|
1046
|
+
}
|
|
1047
|
+
function Zt(e, t) {
|
|
1048
1048
|
let n = {
|
|
1049
1049
|
type: "array",
|
|
1050
1050
|
uniqueItems: !0,
|
|
1051
|
-
items:
|
|
1051
|
+
items: q(e.valueType._def, {
|
|
1052
1052
|
...t,
|
|
1053
1053
|
currentPath: [...t.currentPath, "items"]
|
|
1054
1054
|
})
|
|
1055
1055
|
};
|
|
1056
1056
|
return e.minSize && (n.minItems = e.minSize.value), e.maxSize && (n.maxItems = e.maxSize.value), n;
|
|
1057
1057
|
}
|
|
1058
|
-
function
|
|
1058
|
+
function Qt(e, t) {
|
|
1059
1059
|
return e.rest ? {
|
|
1060
1060
|
type: "array",
|
|
1061
1061
|
minItems: e.items.length,
|
|
1062
|
-
items: e.items.map((e, n) =>
|
|
1062
|
+
items: e.items.map((e, n) => q(e._def, {
|
|
1063
1063
|
...t,
|
|
1064
1064
|
currentPath: [
|
|
1065
1065
|
...t.currentPath,
|
|
@@ -1067,7 +1067,7 @@ function Zt(e, t) {
|
|
|
1067
1067
|
`${n}`
|
|
1068
1068
|
]
|
|
1069
1069
|
})).reduce((e, t) => t === void 0 ? e : [...e, t], []),
|
|
1070
|
-
additionalItems:
|
|
1070
|
+
additionalItems: q(e.rest._def, {
|
|
1071
1071
|
...t,
|
|
1072
1072
|
currentPath: [...t.currentPath, "additionalItems"]
|
|
1073
1073
|
})
|
|
@@ -1075,7 +1075,7 @@ function Zt(e, t) {
|
|
|
1075
1075
|
type: "array",
|
|
1076
1076
|
minItems: e.items.length,
|
|
1077
1077
|
maxItems: e.items.length,
|
|
1078
|
-
items: e.items.map((e, n) =>
|
|
1078
|
+
items: e.items.map((e, n) => q(e._def, {
|
|
1079
1079
|
...t,
|
|
1080
1080
|
currentPath: [
|
|
1081
1081
|
...t.currentPath,
|
|
@@ -1085,47 +1085,47 @@ function Zt(e, t) {
|
|
|
1085
1085
|
})).reduce((e, t) => t === void 0 ? e : [...e, t], [])
|
|
1086
1086
|
};
|
|
1087
1087
|
}
|
|
1088
|
-
function Qt() {
|
|
1089
|
-
return { not: F() };
|
|
1090
|
-
}
|
|
1091
1088
|
function $t() {
|
|
1092
|
-
return
|
|
1089
|
+
return { not: P() };
|
|
1090
|
+
}
|
|
1091
|
+
function en() {
|
|
1092
|
+
return P();
|
|
1093
1093
|
}
|
|
1094
|
-
var
|
|
1094
|
+
var W = (e, t) => q(e.innerType._def, t), G = (e, t, n) => {
|
|
1095
1095
|
switch (t) {
|
|
1096
1096
|
case "ZodString": return Mt(e, n);
|
|
1097
|
-
case "ZodNumber": return
|
|
1098
|
-
case "ZodObject": return
|
|
1099
|
-
case "ZodBigInt": return
|
|
1100
|
-
case "ZodBoolean": return
|
|
1101
|
-
case "ZodDate": return
|
|
1102
|
-
case "ZodUndefined": return
|
|
1097
|
+
case "ZodNumber": return Wt(e);
|
|
1098
|
+
case "ZodObject": return Gt(e, n);
|
|
1099
|
+
case "ZodBigInt": return Ct(e);
|
|
1100
|
+
case "ZodBoolean": return wt();
|
|
1101
|
+
case "ZodDate": return Et(e, n);
|
|
1102
|
+
case "ZodUndefined": return $t();
|
|
1103
1103
|
case "ZodNull": return zt();
|
|
1104
|
-
case "ZodArray": return
|
|
1104
|
+
case "ZodArray": return St(e, n);
|
|
1105
1105
|
case "ZodUnion":
|
|
1106
1106
|
case "ZodDiscriminatedUnion": return Vt(e, n);
|
|
1107
1107
|
case "ZodIntersection": return kt(e, n);
|
|
1108
|
-
case "ZodTuple": return
|
|
1108
|
+
case "ZodTuple": return Qt(e, n);
|
|
1109
1109
|
case "ZodRecord": return It(e, n);
|
|
1110
1110
|
case "ZodLiteral": return At(e);
|
|
1111
|
-
case "ZodEnum": return
|
|
1111
|
+
case "ZodEnum": return L(e);
|
|
1112
1112
|
case "ZodNativeEnum": return U(e);
|
|
1113
|
-
case "ZodNullable": return
|
|
1114
|
-
case "ZodOptional": return
|
|
1113
|
+
case "ZodNullable": return Ut(e, n);
|
|
1114
|
+
case "ZodOptional": return Jt(e, n);
|
|
1115
1115
|
case "ZodMap": return Lt(e, n);
|
|
1116
|
-
case "ZodSet": return
|
|
1116
|
+
case "ZodSet": return Zt(e, n);
|
|
1117
1117
|
case "ZodLazy": return () => e.getter()._def;
|
|
1118
|
-
case "ZodPromise": return
|
|
1118
|
+
case "ZodPromise": return Xt(e, n);
|
|
1119
1119
|
case "ZodNaN":
|
|
1120
1120
|
case "ZodNever": return Rt();
|
|
1121
|
-
case "ZodEffects": return
|
|
1122
|
-
case "ZodAny": return
|
|
1123
|
-
case "ZodUnknown": return
|
|
1124
|
-
case "ZodDefault": return
|
|
1125
|
-
case "ZodBranded": return
|
|
1126
|
-
case "ZodReadonly": return
|
|
1127
|
-
case "ZodCatch": return
|
|
1128
|
-
case "ZodPipeline": return
|
|
1121
|
+
case "ZodEffects": return I(e, n);
|
|
1122
|
+
case "ZodAny": return P();
|
|
1123
|
+
case "ZodUnknown": return en();
|
|
1124
|
+
case "ZodDefault": return Ot(e, n);
|
|
1125
|
+
case "ZodBranded": return Tt(e, n);
|
|
1126
|
+
case "ZodReadonly": return W(e, n);
|
|
1127
|
+
case "ZodCatch": return F(e, n);
|
|
1128
|
+
case "ZodPipeline": return Yt(e, n);
|
|
1129
1129
|
case "ZodFunction":
|
|
1130
1130
|
case "ZodVoid":
|
|
1131
1131
|
case "ZodSymbol": return;
|
|
@@ -1133,19 +1133,19 @@ var G = (e, t) => J(e.innerType._def, t), K = (e, t, n) => {
|
|
|
1133
1133
|
/* c8 ignore next */
|
|
1134
1134
|
return ((e) => void 0)(t);
|
|
1135
1135
|
}
|
|
1136
|
-
},
|
|
1136
|
+
}, K = (e, t) => {
|
|
1137
1137
|
let n = 0;
|
|
1138
1138
|
for (; n < e.length && n < t.length && e[n] === t[n]; n++);
|
|
1139
1139
|
return [(e.length - n).toString(), ...t.slice(n)].join("/");
|
|
1140
1140
|
};
|
|
1141
|
-
function
|
|
1141
|
+
function q(e, t, n = !1) {
|
|
1142
1142
|
let r = t.seen.get(e);
|
|
1143
1143
|
if (t.override) {
|
|
1144
1144
|
let i = t.override?.(e, t, r, n);
|
|
1145
|
-
if (i !==
|
|
1145
|
+
if (i !== yt) return i;
|
|
1146
1146
|
}
|
|
1147
1147
|
if (r && !n) {
|
|
1148
|
-
let e =
|
|
1148
|
+
let e = tn(r, t);
|
|
1149
1149
|
if (e !== void 0) return e;
|
|
1150
1150
|
}
|
|
1151
1151
|
let i = {
|
|
@@ -1154,22 +1154,22 @@ function J(e, t, n = !1) {
|
|
|
1154
1154
|
jsonSchema: void 0
|
|
1155
1155
|
};
|
|
1156
1156
|
t.seen.set(e, i);
|
|
1157
|
-
let a =
|
|
1158
|
-
if (o &&
|
|
1157
|
+
let a = G(e, e.typeName, t), o = typeof a == "function" ? q(a(), t) : a;
|
|
1158
|
+
if (o && nn(e, t, o), t.postProcess) {
|
|
1159
1159
|
let n = t.postProcess(o, e, t);
|
|
1160
1160
|
return i.jsonSchema = o, n;
|
|
1161
1161
|
}
|
|
1162
1162
|
return i.jsonSchema = o, o;
|
|
1163
1163
|
}
|
|
1164
|
-
var
|
|
1164
|
+
var tn = (e, t) => {
|
|
1165
1165
|
switch (t.$refStrategy) {
|
|
1166
1166
|
case "root": return { $ref: e.path.join("/") };
|
|
1167
|
-
case "relative": return { $ref:
|
|
1167
|
+
case "relative": return { $ref: K(t.currentPath, e.path) };
|
|
1168
1168
|
case "none":
|
|
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`),
|
|
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`), P()) : t.$refStrategy === "seen" ? P() : void 0;
|
|
1170
1170
|
}
|
|
1171
|
-
},
|
|
1172
|
-
let t =
|
|
1171
|
+
}, nn = (e, t, n) => (e.description && (n.description = e.description), n), rn = (e) => {
|
|
1172
|
+
let t = xt(e), n = t.name === void 0 ? t.basePath : [
|
|
1173
1173
|
...t.basePath,
|
|
1174
1174
|
t.definitionPath,
|
|
1175
1175
|
t.name
|
|
@@ -1188,25 +1188,25 @@ var en = (e, t) => {
|
|
|
1188
1188
|
jsonSchema: void 0
|
|
1189
1189
|
}]))
|
|
1190
1190
|
};
|
|
1191
|
-
},
|
|
1192
|
-
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]) => ({
|
|
1193
1193
|
...e,
|
|
1194
|
-
[t]:
|
|
1194
|
+
[t]: q(r._def, {
|
|
1195
1195
|
...n,
|
|
1196
1196
|
currentPath: [
|
|
1197
1197
|
...n.basePath,
|
|
1198
1198
|
n.definitionPath,
|
|
1199
1199
|
t
|
|
1200
1200
|
]
|
|
1201
|
-
}, !0) ??
|
|
1202
|
-
}), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a =
|
|
1201
|
+
}, !0) ?? P()
|
|
1202
|
+
}), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = q(e._def, i === void 0 ? n : {
|
|
1203
1203
|
...n,
|
|
1204
1204
|
currentPath: [
|
|
1205
1205
|
...n.basePath,
|
|
1206
1206
|
n.definitionPath,
|
|
1207
1207
|
i
|
|
1208
1208
|
]
|
|
1209
|
-
}, !1) ??
|
|
1209
|
+
}, !1) ?? P(), o = typeof t == "object" && t.name !== void 0 && t.nameStrategy === "title" ? t.name : void 0;
|
|
1210
1210
|
o !== void 0 && (a.title = o);
|
|
1211
1211
|
let s = i === void 0 ? r ? {
|
|
1212
1212
|
...a,
|
|
@@ -1223,14 +1223,14 @@ var en = (e, t) => {
|
|
|
1223
1223
|
}
|
|
1224
1224
|
};
|
|
1225
1225
|
return s.$schema = "http://json-schema.org/draft-07/schema#", s;
|
|
1226
|
-
},
|
|
1227
|
-
function
|
|
1226
|
+
}, on = Symbol.for("vercel.ai.schema");
|
|
1227
|
+
function sn(e) {
|
|
1228
1228
|
let t;
|
|
1229
1229
|
return () => (t ??= e(), t);
|
|
1230
1230
|
}
|
|
1231
|
-
function
|
|
1231
|
+
function cn(e, { validate: t } = {}) {
|
|
1232
1232
|
return {
|
|
1233
|
-
[
|
|
1233
|
+
[on]: !0,
|
|
1234
1234
|
_type: void 0,
|
|
1235
1235
|
get jsonSchema() {
|
|
1236
1236
|
return typeof e == "function" && (e = e()), e;
|
|
@@ -1238,20 +1238,20 @@ function sn(e, { validate: t } = {}) {
|
|
|
1238
1238
|
validate: t
|
|
1239
1239
|
};
|
|
1240
1240
|
}
|
|
1241
|
-
function cn(e) {
|
|
1242
|
-
return typeof e == "object" && !!e && an in e && e[an] === !0 && "jsonSchema" in e && "validate" in e;
|
|
1243
|
-
}
|
|
1244
1241
|
function ln(e) {
|
|
1245
|
-
return e ==
|
|
1242
|
+
return typeof e == "object" && !!e && on in e && e[on] === !0 && "jsonSchema" in e && "validate" in e;
|
|
1243
|
+
}
|
|
1244
|
+
function un(e) {
|
|
1245
|
+
return e == null ? cn({
|
|
1246
1246
|
type: "object",
|
|
1247
1247
|
properties: {},
|
|
1248
1248
|
additionalProperties: !1
|
|
1249
|
-
}) :
|
|
1249
|
+
}) : ln(e) ? e : "~standard" in e ? e["~standard"].vendor === "zod" ? gn(e) : dn(e) : e();
|
|
1250
1250
|
}
|
|
1251
|
-
function
|
|
1252
|
-
return
|
|
1253
|
-
if (!
|
|
1254
|
-
return
|
|
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.`);
|
|
1254
|
+
return vt(e["~standard"].jsonSchema.input({ target: "draft-07" }));
|
|
1255
1255
|
}, { validate: async (t) => {
|
|
1256
1256
|
let n = await e["~standard"].validate(t);
|
|
1257
1257
|
return "value" in n ? {
|
|
@@ -1259,19 +1259,19 @@ function un(e) {
|
|
|
1259
1259
|
value: n.value
|
|
1260
1260
|
} : {
|
|
1261
1261
|
success: !1,
|
|
1262
|
-
error: new
|
|
1262
|
+
error: new Qe({
|
|
1263
1263
|
value: t,
|
|
1264
1264
|
cause: n.issues
|
|
1265
1265
|
})
|
|
1266
1266
|
};
|
|
1267
1267
|
} });
|
|
1268
1268
|
}
|
|
1269
|
-
function
|
|
1269
|
+
function fn(e) {
|
|
1270
1270
|
return e["~standard"].jsonSchema != null;
|
|
1271
1271
|
}
|
|
1272
|
-
function
|
|
1272
|
+
function pn(e, t) {
|
|
1273
1273
|
let n = t?.useReferences ?? !1;
|
|
1274
|
-
return
|
|
1274
|
+
return cn(() => an(e, { $refStrategy: n ? "root" : "none" }), { validate: async (t) => {
|
|
1275
1275
|
let n = await e.safeParseAsync(t);
|
|
1276
1276
|
return n.success ? {
|
|
1277
1277
|
success: !0,
|
|
@@ -1282,9 +1282,9 @@ function fn(e, t) {
|
|
|
1282
1282
|
};
|
|
1283
1283
|
} });
|
|
1284
1284
|
}
|
|
1285
|
-
function
|
|
1285
|
+
function mn(e, r) {
|
|
1286
1286
|
let i = r?.useReferences ?? !1;
|
|
1287
|
-
return
|
|
1287
|
+
return cn(() => vt(n(e, {
|
|
1288
1288
|
target: "draft-7",
|
|
1289
1289
|
io: "input",
|
|
1290
1290
|
reused: i ? "ref" : "inline"
|
|
@@ -1299,27 +1299,27 @@ function pn(e, r) {
|
|
|
1299
1299
|
};
|
|
1300
1300
|
} });
|
|
1301
1301
|
}
|
|
1302
|
-
function
|
|
1302
|
+
function hn(e) {
|
|
1303
1303
|
return "_zod" in e;
|
|
1304
1304
|
}
|
|
1305
|
-
function
|
|
1306
|
-
return
|
|
1305
|
+
function gn(e, t) {
|
|
1306
|
+
return hn(e) ? mn(e, t) : pn(e, t);
|
|
1307
1307
|
}
|
|
1308
|
-
async function
|
|
1309
|
-
let r = await
|
|
1308
|
+
async function _n({ value: e, schema: t, context: n }) {
|
|
1309
|
+
let r = await vn({
|
|
1310
1310
|
value: e,
|
|
1311
1311
|
schema: t,
|
|
1312
1312
|
context: n
|
|
1313
1313
|
});
|
|
1314
|
-
if (!r.success) throw
|
|
1314
|
+
if (!r.success) throw Qe.wrap({
|
|
1315
1315
|
value: e,
|
|
1316
1316
|
cause: r.error,
|
|
1317
1317
|
context: n
|
|
1318
1318
|
});
|
|
1319
1319
|
return r.value;
|
|
1320
1320
|
}
|
|
1321
|
-
async function
|
|
1322
|
-
let r =
|
|
1321
|
+
async function vn({ value: e, schema: t, context: n }) {
|
|
1322
|
+
let r = un(t);
|
|
1323
1323
|
try {
|
|
1324
1324
|
if (r.validate == null) return {
|
|
1325
1325
|
success: !0,
|
|
@@ -1333,7 +1333,7 @@ async function _n({ value: e, schema: t, context: n }) {
|
|
|
1333
1333
|
rawValue: e
|
|
1334
1334
|
} : {
|
|
1335
1335
|
success: !1,
|
|
1336
|
-
error:
|
|
1336
|
+
error: Qe.wrap({
|
|
1337
1337
|
value: e,
|
|
1338
1338
|
cause: t.error,
|
|
1339
1339
|
context: n
|
|
@@ -1343,7 +1343,7 @@ async function _n({ value: e, schema: t, context: n }) {
|
|
|
1343
1343
|
} catch (t) {
|
|
1344
1344
|
return {
|
|
1345
1345
|
success: !1,
|
|
1346
|
-
error:
|
|
1346
|
+
error: Qe.wrap({
|
|
1347
1347
|
value: e,
|
|
1348
1348
|
cause: t,
|
|
1349
1349
|
context: n
|
|
@@ -1352,21 +1352,21 @@ async function _n({ value: e, schema: t, context: n }) {
|
|
|
1352
1352
|
};
|
|
1353
1353
|
}
|
|
1354
1354
|
}
|
|
1355
|
-
async function
|
|
1355
|
+
async function yn({ text: e, schema: t }) {
|
|
1356
1356
|
try {
|
|
1357
|
-
let n =
|
|
1357
|
+
let n = M(e);
|
|
1358
1358
|
return t == null ? {
|
|
1359
1359
|
success: !0,
|
|
1360
1360
|
value: n,
|
|
1361
1361
|
rawValue: n
|
|
1362
|
-
} : await
|
|
1362
|
+
} : await vn({
|
|
1363
1363
|
value: n,
|
|
1364
1364
|
schema: t
|
|
1365
1365
|
});
|
|
1366
1366
|
} catch (t) {
|
|
1367
1367
|
return {
|
|
1368
1368
|
success: !1,
|
|
1369
|
-
error:
|
|
1369
|
+
error: D.isInstance(t) ? t : new D({
|
|
1370
1370
|
text: e,
|
|
1371
1371
|
cause: t
|
|
1372
1372
|
}),
|
|
@@ -1374,41 +1374,41 @@ async function vn({ text: e, schema: t }) {
|
|
|
1374
1374
|
};
|
|
1375
1375
|
}
|
|
1376
1376
|
}
|
|
1377
|
-
function
|
|
1378
|
-
return e.pipeThrough(new TextDecoderStream()).pipeThrough(new
|
|
1379
|
-
e !== "[DONE]" && n.enqueue(await
|
|
1377
|
+
function bn({ stream: e, schema: t }) {
|
|
1378
|
+
return e.pipeThrough(new TextDecoderStream()).pipeThrough(new lt()).pipeThrough(new TransformStream({ async transform({ data: e }, n) {
|
|
1379
|
+
e !== "[DONE]" && n.enqueue(await yn({
|
|
1380
1380
|
text: e,
|
|
1381
1381
|
schema: t
|
|
1382
1382
|
}));
|
|
1383
1383
|
} }));
|
|
1384
1384
|
}
|
|
1385
|
-
async function
|
|
1385
|
+
async function xn(e) {
|
|
1386
1386
|
return typeof e == "function" && (e = e()), e;
|
|
1387
1387
|
}
|
|
1388
1388
|
new TextDecoder();
|
|
1389
1389
|
// ../../node_modules/.pnpm/ai@7.0.154_zod@4.6.7/node_modules/ai/dist/index.js
|
|
1390
|
-
var
|
|
1390
|
+
var J = "AI_InvalidArgumentError", Sn = `vercel.ai.error.${J}`, Cn = Symbol.for(Sn), wn = class extends w {
|
|
1391
1391
|
constructor({ parameter: e, value: t, message: n }) {
|
|
1392
1392
|
super({
|
|
1393
|
-
name:
|
|
1393
|
+
name: J,
|
|
1394
1394
|
message: `Invalid argument for parameter ${e}: ${n}`
|
|
1395
|
-
}), this[
|
|
1395
|
+
}), this[Cn] = !0, this.parameter = e, this.value = t;
|
|
1396
1396
|
}
|
|
1397
1397
|
static isInstance(e) {
|
|
1398
|
-
return
|
|
1398
|
+
return w.hasMarker(e, Sn);
|
|
1399
1399
|
}
|
|
1400
|
-
},
|
|
1400
|
+
}, Tn = "AI_UIMessageStreamError", En = `vercel.ai.error.${Tn}`, Dn = Symbol.for(En), On = class extends w {
|
|
1401
1401
|
constructor({ chunkType: e, chunkId: t, message: n }) {
|
|
1402
1402
|
super({
|
|
1403
|
-
name:
|
|
1403
|
+
name: Tn,
|
|
1404
1404
|
message: n
|
|
1405
|
-
}), this[
|
|
1405
|
+
}), this[Dn] = !0, this.chunkType = e, this.chunkId = t;
|
|
1406
1406
|
}
|
|
1407
1407
|
static isInstance(e) {
|
|
1408
|
-
return
|
|
1408
|
+
return w.hasMarker(e, En);
|
|
1409
1409
|
}
|
|
1410
1410
|
};
|
|
1411
|
-
function
|
|
1411
|
+
function kn(e, t) {
|
|
1412
1412
|
if (e === void 0 && t === void 0) return;
|
|
1413
1413
|
if (e === void 0) return t;
|
|
1414
1414
|
if (t === void 0) return e;
|
|
@@ -1417,11 +1417,11 @@ function On(e, t) {
|
|
|
1417
1417
|
let i = t[r];
|
|
1418
1418
|
if (i === void 0) continue;
|
|
1419
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);
|
|
1420
|
-
n[r] = o && s ?
|
|
1420
|
+
n[r] = o && s ? kn(a, i) : i;
|
|
1421
1421
|
}
|
|
1422
1422
|
return n;
|
|
1423
1423
|
}
|
|
1424
|
-
var
|
|
1424
|
+
var Y = {
|
|
1425
1425
|
array: d,
|
|
1426
1426
|
boolean: m,
|
|
1427
1427
|
custom: l,
|
|
@@ -1439,236 +1439,236 @@ var X = {
|
|
|
1439
1439
|
string: r,
|
|
1440
1440
|
union: e,
|
|
1441
1441
|
unknown: _
|
|
1442
|
-
},
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
])),
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
]),
|
|
1455
|
-
type:
|
|
1456
|
-
text:
|
|
1457
|
-
providerOptions:
|
|
1458
|
-
}),
|
|
1459
|
-
type:
|
|
1460
|
-
image:
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1442
|
+
}, An = Y.lazy(() => Y.union([
|
|
1443
|
+
Y.null(),
|
|
1444
|
+
Y.string(),
|
|
1445
|
+
Y.number(),
|
|
1446
|
+
Y.boolean(),
|
|
1447
|
+
Y.record(Y.string(), An.optional()),
|
|
1448
|
+
Y.array(An)
|
|
1449
|
+
])), X = Y.record(Y.string(), Y.record(Y.string(), An.optional())), jn = Y.union([
|
|
1450
|
+
Y.string(),
|
|
1451
|
+
Y.instanceof(Uint8Array),
|
|
1452
|
+
Y.instanceof(ArrayBuffer),
|
|
1453
|
+
Y.custom(pt, { message: "Must be a Buffer" })
|
|
1454
|
+
]), Mn = Y.record(Y.string(), Y.string()), Nn = Y.object({
|
|
1455
|
+
type: Y.literal("text"),
|
|
1456
|
+
text: Y.string(),
|
|
1457
|
+
providerOptions: X.optional()
|
|
1458
|
+
}), Pn = Y.object({
|
|
1459
|
+
type: Y.literal("image"),
|
|
1460
|
+
image: Y.union([
|
|
1461
|
+
jn,
|
|
1462
|
+
Y.instanceof(URL),
|
|
1463
|
+
Mn
|
|
1464
1464
|
]),
|
|
1465
|
-
mediaType:
|
|
1466
|
-
providerOptions:
|
|
1467
|
-
}),
|
|
1468
|
-
|
|
1469
|
-
type:
|
|
1470
|
-
data:
|
|
1465
|
+
mediaType: Y.string().optional(),
|
|
1466
|
+
providerOptions: X.optional()
|
|
1467
|
+
}), Fn = Y.discriminatedUnion("type", [
|
|
1468
|
+
Y.object({
|
|
1469
|
+
type: Y.literal("data"),
|
|
1470
|
+
data: jn
|
|
1471
1471
|
}),
|
|
1472
|
-
|
|
1473
|
-
type:
|
|
1474
|
-
url:
|
|
1472
|
+
Y.object({
|
|
1473
|
+
type: Y.literal("url"),
|
|
1474
|
+
url: Y.instanceof(URL)
|
|
1475
1475
|
}),
|
|
1476
|
-
|
|
1477
|
-
type:
|
|
1478
|
-
reference:
|
|
1476
|
+
Y.object({
|
|
1477
|
+
type: Y.literal("reference"),
|
|
1478
|
+
reference: Mn
|
|
1479
1479
|
}),
|
|
1480
|
-
|
|
1481
|
-
type:
|
|
1482
|
-
text:
|
|
1480
|
+
Y.object({
|
|
1481
|
+
type: Y.literal("text"),
|
|
1482
|
+
text: Y.string()
|
|
1483
1483
|
})
|
|
1484
|
-
]),
|
|
1485
|
-
type:
|
|
1486
|
-
data:
|
|
1487
|
-
}),
|
|
1488
|
-
type:
|
|
1489
|
-
url:
|
|
1490
|
-
})]),
|
|
1491
|
-
type:
|
|
1492
|
-
data:
|
|
1493
|
-
Pn,
|
|
1494
|
-
An,
|
|
1495
|
-
X.instanceof(URL),
|
|
1496
|
-
jn
|
|
1497
|
-
]),
|
|
1498
|
-
filename: X.string().optional(),
|
|
1499
|
-
mediaType: X.string(),
|
|
1500
|
-
providerOptions: Z.optional()
|
|
1501
|
-
}), Ln = X.object({
|
|
1502
|
-
type: X.literal("reasoning"),
|
|
1503
|
-
text: X.string(),
|
|
1504
|
-
providerOptions: Z.optional()
|
|
1505
|
-
}), Rn = X.object({
|
|
1506
|
-
type: X.literal("custom"),
|
|
1507
|
-
kind: X.string().transform((e) => e),
|
|
1508
|
-
providerOptions: Z.optional()
|
|
1509
|
-
}), zn = X.object({
|
|
1510
|
-
type: X.literal("reasoning-file"),
|
|
1511
|
-
data: X.union([
|
|
1484
|
+
]), In = Y.discriminatedUnion("type", [Y.object({
|
|
1485
|
+
type: Y.literal("data"),
|
|
1486
|
+
data: jn
|
|
1487
|
+
}), Y.object({
|
|
1488
|
+
type: Y.literal("url"),
|
|
1489
|
+
url: Y.instanceof(URL)
|
|
1490
|
+
})]), Ln = Y.object({
|
|
1491
|
+
type: Y.literal("file"),
|
|
1492
|
+
data: Y.union([
|
|
1512
1493
|
Fn,
|
|
1513
|
-
|
|
1514
|
-
|
|
1494
|
+
jn,
|
|
1495
|
+
Y.instanceof(URL),
|
|
1496
|
+
Mn
|
|
1497
|
+
]),
|
|
1498
|
+
filename: Y.string().optional(),
|
|
1499
|
+
mediaType: Y.string(),
|
|
1500
|
+
providerOptions: X.optional()
|
|
1501
|
+
}), Rn = Y.object({
|
|
1502
|
+
type: Y.literal("reasoning"),
|
|
1503
|
+
text: Y.string(),
|
|
1504
|
+
providerOptions: X.optional()
|
|
1505
|
+
}), zn = Y.object({
|
|
1506
|
+
type: Y.literal("custom"),
|
|
1507
|
+
kind: Y.string().transform((e) => e),
|
|
1508
|
+
providerOptions: X.optional()
|
|
1509
|
+
}), Bn = Y.object({
|
|
1510
|
+
type: Y.literal("reasoning-file"),
|
|
1511
|
+
data: Y.union([
|
|
1512
|
+
In,
|
|
1513
|
+
jn,
|
|
1514
|
+
Y.instanceof(URL)
|
|
1515
1515
|
]),
|
|
1516
|
-
mediaType:
|
|
1517
|
-
providerOptions:
|
|
1518
|
-
}),
|
|
1519
|
-
type:
|
|
1520
|
-
toolCallId:
|
|
1521
|
-
toolName:
|
|
1522
|
-
input:
|
|
1523
|
-
providerOptions:
|
|
1524
|
-
providerExecuted:
|
|
1525
|
-
}),
|
|
1526
|
-
|
|
1527
|
-
type:
|
|
1528
|
-
value:
|
|
1529
|
-
providerOptions:
|
|
1516
|
+
mediaType: Y.string(),
|
|
1517
|
+
providerOptions: X.optional()
|
|
1518
|
+
}), Vn = Y.object({
|
|
1519
|
+
type: Y.literal("tool-call"),
|
|
1520
|
+
toolCallId: Y.string(),
|
|
1521
|
+
toolName: Y.string(),
|
|
1522
|
+
input: Y.unknown(),
|
|
1523
|
+
providerOptions: X.optional(),
|
|
1524
|
+
providerExecuted: Y.boolean().optional()
|
|
1525
|
+
}), Hn = Y.discriminatedUnion("type", [
|
|
1526
|
+
Y.object({
|
|
1527
|
+
type: Y.literal("text"),
|
|
1528
|
+
value: Y.string(),
|
|
1529
|
+
providerOptions: X.optional()
|
|
1530
1530
|
}),
|
|
1531
|
-
|
|
1532
|
-
type:
|
|
1533
|
-
value:
|
|
1534
|
-
providerOptions:
|
|
1531
|
+
Y.object({
|
|
1532
|
+
type: Y.literal("json"),
|
|
1533
|
+
value: An,
|
|
1534
|
+
providerOptions: X.optional()
|
|
1535
1535
|
}),
|
|
1536
|
-
|
|
1537
|
-
type:
|
|
1538
|
-
reason:
|
|
1539
|
-
providerOptions:
|
|
1536
|
+
Y.object({
|
|
1537
|
+
type: Y.literal("execution-denied"),
|
|
1538
|
+
reason: Y.string().optional(),
|
|
1539
|
+
providerOptions: X.optional()
|
|
1540
1540
|
}),
|
|
1541
|
-
|
|
1542
|
-
type:
|
|
1543
|
-
value:
|
|
1544
|
-
providerOptions:
|
|
1541
|
+
Y.object({
|
|
1542
|
+
type: Y.literal("error-text"),
|
|
1543
|
+
value: Y.string(),
|
|
1544
|
+
providerOptions: X.optional()
|
|
1545
1545
|
}),
|
|
1546
|
-
|
|
1547
|
-
type:
|
|
1548
|
-
value:
|
|
1549
|
-
providerOptions:
|
|
1546
|
+
Y.object({
|
|
1547
|
+
type: Y.literal("error-json"),
|
|
1548
|
+
value: An,
|
|
1549
|
+
providerOptions: X.optional()
|
|
1550
1550
|
}),
|
|
1551
|
-
|
|
1552
|
-
type:
|
|
1553
|
-
value:
|
|
1554
|
-
|
|
1555
|
-
type:
|
|
1556
|
-
text:
|
|
1557
|
-
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: X.optional()
|
|
1558
1558
|
}),
|
|
1559
|
-
|
|
1560
|
-
type:
|
|
1561
|
-
data:
|
|
1562
|
-
mediaType:
|
|
1563
|
-
filename:
|
|
1564
|
-
providerOptions:
|
|
1559
|
+
Y.object({
|
|
1560
|
+
type: Y.literal("file"),
|
|
1561
|
+
data: Fn,
|
|
1562
|
+
mediaType: Y.string(),
|
|
1563
|
+
filename: Y.string().optional(),
|
|
1564
|
+
providerOptions: X.optional()
|
|
1565
1565
|
}),
|
|
1566
|
-
|
|
1567
|
-
type:
|
|
1568
|
-
data:
|
|
1569
|
-
mediaType:
|
|
1570
|
-
filename:
|
|
1571
|
-
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: X.optional()
|
|
1572
1572
|
}),
|
|
1573
|
-
|
|
1574
|
-
type:
|
|
1575
|
-
url:
|
|
1576
|
-
mediaType:
|
|
1577
|
-
providerOptions:
|
|
1573
|
+
Y.object({
|
|
1574
|
+
type: Y.literal("file-url"),
|
|
1575
|
+
url: Y.string(),
|
|
1576
|
+
mediaType: Y.string().optional(),
|
|
1577
|
+
providerOptions: X.optional()
|
|
1578
1578
|
}),
|
|
1579
|
-
|
|
1580
|
-
type:
|
|
1581
|
-
fileId:
|
|
1582
|
-
providerOptions:
|
|
1579
|
+
Y.object({
|
|
1580
|
+
type: Y.literal("file-id"),
|
|
1581
|
+
fileId: Y.union([Y.string(), Y.record(Y.string(), Y.string())]),
|
|
1582
|
+
providerOptions: X.optional()
|
|
1583
1583
|
}),
|
|
1584
|
-
|
|
1585
|
-
type:
|
|
1586
|
-
providerReference:
|
|
1587
|
-
providerOptions:
|
|
1584
|
+
Y.object({
|
|
1585
|
+
type: Y.literal("file-reference"),
|
|
1586
|
+
providerReference: Y.record(Y.string(), Y.string()),
|
|
1587
|
+
providerOptions: X.optional()
|
|
1588
1588
|
}),
|
|
1589
|
-
|
|
1590
|
-
type:
|
|
1591
|
-
data:
|
|
1592
|
-
mediaType:
|
|
1593
|
-
providerOptions:
|
|
1589
|
+
Y.object({
|
|
1590
|
+
type: Y.literal("image-data"),
|
|
1591
|
+
data: Y.string(),
|
|
1592
|
+
mediaType: Y.string(),
|
|
1593
|
+
providerOptions: X.optional()
|
|
1594
1594
|
}),
|
|
1595
|
-
|
|
1596
|
-
type:
|
|
1597
|
-
url:
|
|
1598
|
-
providerOptions:
|
|
1595
|
+
Y.object({
|
|
1596
|
+
type: Y.literal("image-url"),
|
|
1597
|
+
url: Y.string(),
|
|
1598
|
+
providerOptions: X.optional()
|
|
1599
1599
|
}),
|
|
1600
|
-
|
|
1601
|
-
type:
|
|
1602
|
-
fileId:
|
|
1603
|
-
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: X.optional()
|
|
1604
1604
|
}),
|
|
1605
|
-
|
|
1606
|
-
type:
|
|
1607
|
-
providerReference:
|
|
1608
|
-
providerOptions:
|
|
1605
|
+
Y.object({
|
|
1606
|
+
type: Y.literal("image-file-reference"),
|
|
1607
|
+
providerReference: Y.record(Y.string(), Y.string()),
|
|
1608
|
+
providerOptions: X.optional()
|
|
1609
1609
|
}),
|
|
1610
|
-
|
|
1611
|
-
type:
|
|
1612
|
-
providerOptions:
|
|
1610
|
+
Y.object({
|
|
1611
|
+
type: Y.literal("custom"),
|
|
1612
|
+
providerOptions: X.optional()
|
|
1613
1613
|
})
|
|
1614
1614
|
]))
|
|
1615
1615
|
})
|
|
1616
|
-
]),
|
|
1617
|
-
type:
|
|
1618
|
-
toolCallId:
|
|
1619
|
-
toolName:
|
|
1620
|
-
output:
|
|
1621
|
-
providerOptions:
|
|
1622
|
-
}),
|
|
1623
|
-
type:
|
|
1624
|
-
approvalId:
|
|
1625
|
-
toolCallId:
|
|
1626
|
-
reason:
|
|
1627
|
-
isAutomatic:
|
|
1628
|
-
signature:
|
|
1629
|
-
inputSchemaInput:
|
|
1630
|
-
}),
|
|
1631
|
-
type:
|
|
1632
|
-
approvalId:
|
|
1633
|
-
approved:
|
|
1634
|
-
reason:
|
|
1635
|
-
}),
|
|
1636
|
-
role:
|
|
1637
|
-
content:
|
|
1638
|
-
providerOptions:
|
|
1639
|
-
}),
|
|
1640
|
-
role:
|
|
1641
|
-
content:
|
|
1642
|
-
Mn,
|
|
1616
|
+
]), Z = Y.object({
|
|
1617
|
+
type: Y.literal("tool-result"),
|
|
1618
|
+
toolCallId: Y.string(),
|
|
1619
|
+
toolName: Y.string(),
|
|
1620
|
+
output: Hn,
|
|
1621
|
+
providerOptions: X.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: X.optional()
|
|
1639
|
+
}), Kn = Y.object({
|
|
1640
|
+
role: Y.literal("user"),
|
|
1641
|
+
content: Y.union([Y.string(), Y.array(Y.union([
|
|
1643
1642
|
Nn,
|
|
1644
|
-
|
|
1643
|
+
Pn,
|
|
1644
|
+
Ln
|
|
1645
1645
|
]))]),
|
|
1646
|
-
providerOptions:
|
|
1647
|
-
}),
|
|
1648
|
-
role:
|
|
1649
|
-
content:
|
|
1650
|
-
|
|
1651
|
-
Rn,
|
|
1652
|
-
In,
|
|
1653
|
-
Ln,
|
|
1646
|
+
providerOptions: X.optional()
|
|
1647
|
+
}), qn = Y.object({
|
|
1648
|
+
role: Y.literal("assistant"),
|
|
1649
|
+
content: Y.union([Y.string(), Y.array(Y.union([
|
|
1650
|
+
Nn,
|
|
1654
1651
|
zn,
|
|
1652
|
+
Ln,
|
|
1653
|
+
Rn,
|
|
1655
1654
|
Bn,
|
|
1656
|
-
|
|
1657
|
-
|
|
1655
|
+
Vn,
|
|
1656
|
+
Z,
|
|
1657
|
+
Un
|
|
1658
1658
|
]))]),
|
|
1659
|
-
providerOptions:
|
|
1660
|
-
}),
|
|
1661
|
-
role:
|
|
1662
|
-
content:
|
|
1663
|
-
providerOptions:
|
|
1659
|
+
providerOptions: X.optional()
|
|
1660
|
+
}), Jn = Y.object({
|
|
1661
|
+
role: Y.literal("tool"),
|
|
1662
|
+
content: Y.array(Y.union([Z, Wn])),
|
|
1663
|
+
providerOptions: X.optional()
|
|
1664
1664
|
});
|
|
1665
|
-
|
|
1666
|
-
Wn,
|
|
1665
|
+
Y.union([
|
|
1667
1666
|
Gn,
|
|
1668
1667
|
Kn,
|
|
1669
|
-
qn
|
|
1668
|
+
qn,
|
|
1669
|
+
Jn
|
|
1670
1670
|
]);
|
|
1671
|
-
function
|
|
1671
|
+
function Yn(e) {
|
|
1672
1672
|
let t = ["ROOT"], n = -1, r = null, i = 0;
|
|
1673
1673
|
function a(e) {
|
|
1674
1674
|
return e >= "0" && e <= "9" || e >= "A" && e <= "F" || e >= "a" && e <= "f";
|
|
@@ -1850,16 +1850,16 @@ function Jn(e) {
|
|
|
1850
1850
|
}
|
|
1851
1851
|
return l;
|
|
1852
1852
|
}
|
|
1853
|
-
async function
|
|
1853
|
+
async function Xn(e) {
|
|
1854
1854
|
if (e === void 0) return {
|
|
1855
1855
|
value: void 0,
|
|
1856
1856
|
state: "undefined-input"
|
|
1857
1857
|
};
|
|
1858
|
-
let t = await
|
|
1858
|
+
let t = await yn({ text: e });
|
|
1859
1859
|
return t.success ? {
|
|
1860
1860
|
value: t.value,
|
|
1861
1861
|
state: "successful-parse"
|
|
1862
|
-
} : (t = await
|
|
1862
|
+
} : (t = await yn({ text: Yn(e) }), t.success ? {
|
|
1863
1863
|
value: t.value,
|
|
1864
1864
|
state: "repaired-parse"
|
|
1865
1865
|
} : {
|
|
@@ -1867,203 +1867,203 @@ async function Yn(e) {
|
|
|
1867
1867
|
state: "failed-parse"
|
|
1868
1868
|
});
|
|
1869
1869
|
}
|
|
1870
|
-
|
|
1870
|
+
j({
|
|
1871
1871
|
prefix: "steer",
|
|
1872
1872
|
size: 24
|
|
1873
|
-
}), new TextEncoder(), new TextEncoder(),
|
|
1873
|
+
}), new TextEncoder(), new TextEncoder(), j({
|
|
1874
1874
|
prefix: "aitxt",
|
|
1875
1875
|
size: 24
|
|
1876
|
-
}),
|
|
1876
|
+
}), j({
|
|
1877
1877
|
prefix: "call",
|
|
1878
1878
|
size: 24
|
|
1879
1879
|
}), TransformStream;
|
|
1880
|
-
var
|
|
1881
|
-
source:
|
|
1882
|
-
type:
|
|
1883
|
-
sourceType:
|
|
1884
|
-
id:
|
|
1885
|
-
url:
|
|
1886
|
-
title:
|
|
1887
|
-
providerMetadata:
|
|
1888
|
-
}),
|
|
1889
|
-
type:
|
|
1890
|
-
sourceType:
|
|
1891
|
-
id:
|
|
1892
|
-
mediaType:
|
|
1893
|
-
title:
|
|
1894
|
-
filename:
|
|
1895
|
-
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: X.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: X.optional()
|
|
1896
1896
|
})]),
|
|
1897
|
-
startIndex:
|
|
1898
|
-
endIndex:
|
|
1899
|
-
citedText:
|
|
1900
|
-
}),
|
|
1901
|
-
|
|
1902
|
-
type:
|
|
1903
|
-
id:
|
|
1904
|
-
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(), An.optional()), $n = sn(() => gn(Y.union([
|
|
1901
|
+
Y.looseObject({
|
|
1902
|
+
type: Y.literal("text-start"),
|
|
1903
|
+
id: Y.string(),
|
|
1904
|
+
providerMetadata: X.optional()
|
|
1905
1905
|
}),
|
|
1906
|
-
|
|
1907
|
-
type:
|
|
1908
|
-
id:
|
|
1909
|
-
delta:
|
|
1910
|
-
providerMetadata:
|
|
1906
|
+
Y.looseObject({
|
|
1907
|
+
type: Y.literal("text-delta"),
|
|
1908
|
+
id: Y.string(),
|
|
1909
|
+
delta: Y.string(),
|
|
1910
|
+
providerMetadata: X.optional()
|
|
1911
1911
|
}),
|
|
1912
|
-
|
|
1913
|
-
type:
|
|
1914
|
-
id:
|
|
1915
|
-
citations:
|
|
1916
|
-
providerMetadata:
|
|
1912
|
+
Y.looseObject({
|
|
1913
|
+
type: Y.literal("text-end"),
|
|
1914
|
+
id: Y.string(),
|
|
1915
|
+
citations: Y.array(Zn).optional(),
|
|
1916
|
+
providerMetadata: X.optional()
|
|
1917
1917
|
}),
|
|
1918
|
-
|
|
1919
|
-
type:
|
|
1920
|
-
errorText:
|
|
1918
|
+
Y.looseObject({
|
|
1919
|
+
type: Y.literal("error"),
|
|
1920
|
+
errorText: Y.string()
|
|
1921
1921
|
}),
|
|
1922
|
-
|
|
1923
|
-
type:
|
|
1924
|
-
toolCallId:
|
|
1925
|
-
toolName:
|
|
1926
|
-
inputEncoding:
|
|
1927
|
-
providerExecuted:
|
|
1928
|
-
providerMetadata:
|
|
1929
|
-
toolMetadata:
|
|
1930
|
-
dynamic:
|
|
1931
|
-
title:
|
|
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: X.optional(),
|
|
1929
|
+
toolMetadata: Qn.optional(),
|
|
1930
|
+
dynamic: Y.boolean().optional(),
|
|
1931
|
+
title: Y.string().optional()
|
|
1932
1932
|
}),
|
|
1933
|
-
|
|
1934
|
-
type:
|
|
1935
|
-
toolCallId:
|
|
1936
|
-
inputTextDelta:
|
|
1933
|
+
Y.looseObject({
|
|
1934
|
+
type: Y.literal("tool-input-delta"),
|
|
1935
|
+
toolCallId: Y.string(),
|
|
1936
|
+
inputTextDelta: Y.string()
|
|
1937
1937
|
}),
|
|
1938
|
-
|
|
1939
|
-
type:
|
|
1940
|
-
toolCallId:
|
|
1941
|
-
toolName:
|
|
1942
|
-
input:
|
|
1943
|
-
providerExecuted:
|
|
1944
|
-
providerMetadata:
|
|
1945
|
-
toolMetadata:
|
|
1946
|
-
dynamic:
|
|
1947
|
-
title:
|
|
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: X.optional(),
|
|
1945
|
+
toolMetadata: Qn.optional(),
|
|
1946
|
+
dynamic: Y.boolean().optional(),
|
|
1947
|
+
title: Y.string().optional()
|
|
1948
1948
|
}),
|
|
1949
|
-
|
|
1950
|
-
type:
|
|
1951
|
-
toolCallId:
|
|
1952
|
-
toolName:
|
|
1953
|
-
input:
|
|
1954
|
-
providerExecuted:
|
|
1955
|
-
providerMetadata:
|
|
1956
|
-
toolMetadata:
|
|
1957
|
-
dynamic:
|
|
1958
|
-
errorText:
|
|
1959
|
-
title:
|
|
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: X.optional(),
|
|
1956
|
+
toolMetadata: Qn.optional(),
|
|
1957
|
+
dynamic: Y.boolean().optional(),
|
|
1958
|
+
errorText: Y.string(),
|
|
1959
|
+
title: Y.string().optional()
|
|
1960
1960
|
}),
|
|
1961
|
-
|
|
1962
|
-
type:
|
|
1963
|
-
approvalId:
|
|
1964
|
-
toolCallId:
|
|
1965
|
-
approvalDescriptor:
|
|
1966
|
-
inputSchemaInput:
|
|
1967
|
-
reason:
|
|
1968
|
-
isAutomatic:
|
|
1969
|
-
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()
|
|
1970
1970
|
}),
|
|
1971
|
-
|
|
1972
|
-
type:
|
|
1973
|
-
approvalId:
|
|
1974
|
-
approved:
|
|
1975
|
-
reason:
|
|
1976
|
-
providerExecuted:
|
|
1977
|
-
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: X.optional()
|
|
1978
1978
|
}),
|
|
1979
|
-
|
|
1980
|
-
type:
|
|
1981
|
-
toolCallId:
|
|
1982
|
-
output:
|
|
1983
|
-
providerExecuted:
|
|
1984
|
-
providerMetadata:
|
|
1985
|
-
toolMetadata:
|
|
1986
|
-
dynamic:
|
|
1987
|
-
preliminary:
|
|
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: X.optional(),
|
|
1985
|
+
toolMetadata: Qn.optional(),
|
|
1986
|
+
dynamic: Y.boolean().optional(),
|
|
1987
|
+
preliminary: Y.boolean().optional()
|
|
1988
1988
|
}),
|
|
1989
|
-
|
|
1990
|
-
type:
|
|
1991
|
-
toolCallId:
|
|
1992
|
-
errorText:
|
|
1993
|
-
providerExecuted:
|
|
1994
|
-
providerMetadata:
|
|
1995
|
-
toolMetadata:
|
|
1996
|
-
dynamic:
|
|
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: X.optional(),
|
|
1995
|
+
toolMetadata: Qn.optional(),
|
|
1996
|
+
dynamic: Y.boolean().optional()
|
|
1997
1997
|
}),
|
|
1998
|
-
|
|
1999
|
-
type:
|
|
2000
|
-
toolCallId:
|
|
1998
|
+
Y.looseObject({
|
|
1999
|
+
type: Y.literal("tool-output-denied"),
|
|
2000
|
+
toolCallId: Y.string()
|
|
2001
2001
|
}),
|
|
2002
|
-
|
|
2003
|
-
type:
|
|
2004
|
-
id:
|
|
2005
|
-
providerMetadata:
|
|
2002
|
+
Y.looseObject({
|
|
2003
|
+
type: Y.literal("reasoning-start"),
|
|
2004
|
+
id: Y.string(),
|
|
2005
|
+
providerMetadata: X.optional()
|
|
2006
2006
|
}),
|
|
2007
|
-
|
|
2008
|
-
type:
|
|
2009
|
-
id:
|
|
2010
|
-
delta:
|
|
2011
|
-
providerMetadata:
|
|
2007
|
+
Y.looseObject({
|
|
2008
|
+
type: Y.literal("reasoning-delta"),
|
|
2009
|
+
id: Y.string(),
|
|
2010
|
+
delta: Y.string(),
|
|
2011
|
+
providerMetadata: X.optional()
|
|
2012
2012
|
}),
|
|
2013
|
-
|
|
2014
|
-
type:
|
|
2015
|
-
id:
|
|
2016
|
-
providerMetadata:
|
|
2013
|
+
Y.looseObject({
|
|
2014
|
+
type: Y.literal("reasoning-end"),
|
|
2015
|
+
id: Y.string(),
|
|
2016
|
+
providerMetadata: X.optional()
|
|
2017
2017
|
}),
|
|
2018
|
-
|
|
2019
|
-
type:
|
|
2020
|
-
kind:
|
|
2021
|
-
providerMetadata:
|
|
2018
|
+
Y.looseObject({
|
|
2019
|
+
type: Y.literal("custom"),
|
|
2020
|
+
kind: Y.string().transform((e) => e),
|
|
2021
|
+
providerMetadata: X.optional()
|
|
2022
2022
|
}),
|
|
2023
|
-
|
|
2024
|
-
type:
|
|
2025
|
-
sourceId:
|
|
2026
|
-
url:
|
|
2027
|
-
title:
|
|
2028
|
-
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: X.optional()
|
|
2029
2029
|
}),
|
|
2030
|
-
|
|
2031
|
-
type:
|
|
2032
|
-
sourceId:
|
|
2033
|
-
mediaType:
|
|
2034
|
-
title:
|
|
2035
|
-
filename:
|
|
2036
|
-
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: X.optional()
|
|
2037
2037
|
}),
|
|
2038
|
-
|
|
2039
|
-
type:
|
|
2040
|
-
url:
|
|
2041
|
-
mediaType:
|
|
2042
|
-
providerMetadata:
|
|
2038
|
+
Y.looseObject({
|
|
2039
|
+
type: Y.literal("file"),
|
|
2040
|
+
url: Y.string(),
|
|
2041
|
+
mediaType: Y.string(),
|
|
2042
|
+
providerMetadata: X.optional()
|
|
2043
2043
|
}),
|
|
2044
|
-
|
|
2045
|
-
type:
|
|
2046
|
-
url:
|
|
2047
|
-
mediaType:
|
|
2048
|
-
providerMetadata:
|
|
2044
|
+
Y.looseObject({
|
|
2045
|
+
type: Y.literal("reasoning-file"),
|
|
2046
|
+
url: Y.string(),
|
|
2047
|
+
mediaType: Y.string(),
|
|
2048
|
+
providerMetadata: X.optional()
|
|
2049
2049
|
}),
|
|
2050
|
-
|
|
2051
|
-
type:
|
|
2052
|
-
id:
|
|
2053
|
-
data:
|
|
2054
|
-
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()
|
|
2055
2055
|
}),
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
type:
|
|
2061
|
-
messageId:
|
|
2062
|
-
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()
|
|
2063
2063
|
}),
|
|
2064
|
-
|
|
2065
|
-
type:
|
|
2066
|
-
finishReason:
|
|
2064
|
+
Y.looseObject({
|
|
2065
|
+
type: Y.literal("finish"),
|
|
2066
|
+
finishReason: Y.enum([
|
|
2067
2067
|
"stop",
|
|
2068
2068
|
"length",
|
|
2069
2069
|
"content-filter",
|
|
@@ -2072,50 +2072,50 @@ var Xn = X.object({
|
|
|
2072
2072
|
"interrupted",
|
|
2073
2073
|
"other"
|
|
2074
2074
|
]).optional(),
|
|
2075
|
-
messageMetadata:
|
|
2075
|
+
messageMetadata: Y.unknown().optional()
|
|
2076
2076
|
}),
|
|
2077
|
-
|
|
2078
|
-
type:
|
|
2079
|
-
reason:
|
|
2077
|
+
Y.looseObject({
|
|
2078
|
+
type: Y.literal("abort"),
|
|
2079
|
+
reason: Y.string().optional()
|
|
2080
2080
|
}),
|
|
2081
|
-
|
|
2082
|
-
type:
|
|
2083
|
-
messageMetadata:
|
|
2081
|
+
Y.looseObject({
|
|
2082
|
+
type: Y.literal("message-metadata"),
|
|
2083
|
+
messageMetadata: Y.unknown()
|
|
2084
2084
|
})
|
|
2085
2085
|
])));
|
|
2086
|
-
function
|
|
2086
|
+
function er(e) {
|
|
2087
2087
|
return e.type.startsWith("data-");
|
|
2088
2088
|
}
|
|
2089
|
-
function
|
|
2089
|
+
function tr() {
|
|
2090
2090
|
return Object.create(null);
|
|
2091
2091
|
}
|
|
2092
|
-
function
|
|
2092
|
+
function nr(e) {
|
|
2093
2093
|
return e.type.startsWith("tool-");
|
|
2094
2094
|
}
|
|
2095
|
-
function
|
|
2095
|
+
function rr(e) {
|
|
2096
2096
|
return e.type === "dynamic-tool";
|
|
2097
2097
|
}
|
|
2098
|
-
function
|
|
2099
|
-
return
|
|
2098
|
+
function Q(e) {
|
|
2099
|
+
return nr(e) || rr(e);
|
|
2100
2100
|
}
|
|
2101
|
-
function
|
|
2101
|
+
function ir(e) {
|
|
2102
2102
|
return e.type.split("-").slice(1).join("-");
|
|
2103
2103
|
}
|
|
2104
|
-
function
|
|
2104
|
+
function ar({ lastMessage: e, messageId: t }) {
|
|
2105
2105
|
let n = e?.role === "assistant" ? e : {
|
|
2106
2106
|
id: t,
|
|
2107
2107
|
metadata: void 0,
|
|
2108
2108
|
role: "assistant",
|
|
2109
2109
|
parts: []
|
|
2110
|
-
}, r =
|
|
2110
|
+
}, r = tr(), i = n.parts.findLastIndex((e) => e.type === "step-start"), a = 0;
|
|
2111
2111
|
for (let e of n.parts.slice(i + 1)) {
|
|
2112
|
-
if (
|
|
2112
|
+
if (!Q(e)) continue;
|
|
2113
2113
|
let t = a;
|
|
2114
|
-
|
|
2114
|
+
nr(e) && a++, e.state === "input-streaming" && (r[e.toolCallId] = {
|
|
2115
2115
|
text: e.rawInput ?? "",
|
|
2116
2116
|
inputEncoding: e.inputEncoding,
|
|
2117
2117
|
index: t,
|
|
2118
|
-
toolName: e.type === "dynamic-tool" ? e.toolName :
|
|
2118
|
+
toolName: e.type === "dynamic-tool" ? e.toolName : ir(e),
|
|
2119
2119
|
dynamic: e.type === "dynamic-tool",
|
|
2120
2120
|
title: e.title,
|
|
2121
2121
|
toolMetadata: e.toolMetadata
|
|
@@ -2123,12 +2123,12 @@ function ir({ lastMessage: e, messageId: t }) {
|
|
|
2123
2123
|
}
|
|
2124
2124
|
return {
|
|
2125
2125
|
message: n,
|
|
2126
|
-
activeTextParts:
|
|
2127
|
-
activeReasoningParts:
|
|
2126
|
+
activeTextParts: tr(),
|
|
2127
|
+
activeReasoningParts: tr(),
|
|
2128
2128
|
partialToolCalls: r
|
|
2129
2129
|
};
|
|
2130
2130
|
}
|
|
2131
|
-
function
|
|
2131
|
+
function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdateMessageJob: r, onError: i, onToolCall: a, onData: o, resetStateOnMessageIdChange: s = !1, resetStateOnFirstMessageStart: c = !1 }) {
|
|
2132
2132
|
let l = !0;
|
|
2133
2133
|
return e.pipeThrough(new TransformStream({ async transform(e, u) {
|
|
2134
2134
|
await r(async ({ state: r, write: d }) => {
|
|
@@ -2138,7 +2138,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2138
2138
|
return e.slice(t + 1);
|
|
2139
2139
|
}
|
|
2140
2140
|
function p() {
|
|
2141
|
-
return f().filter(
|
|
2141
|
+
return f().filter(Q);
|
|
2142
2142
|
}
|
|
2143
2143
|
function m(e) {
|
|
2144
2144
|
let t = p().find((t) => t.toolCallId === e);
|
|
@@ -2146,13 +2146,13 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2146
2146
|
let n = r.message.parts;
|
|
2147
2147
|
for (let r = n.length - 1; r >= 0; r--) {
|
|
2148
2148
|
let i = n[r];
|
|
2149
|
-
if (
|
|
2149
|
+
if (Q(i) && i.toolCallId === e) {
|
|
2150
2150
|
t = i;
|
|
2151
2151
|
break;
|
|
2152
2152
|
}
|
|
2153
2153
|
}
|
|
2154
2154
|
}
|
|
2155
|
-
if (t == null) throw new
|
|
2155
|
+
if (t == null) throw new On({
|
|
2156
2156
|
chunkType: "tool-invocation",
|
|
2157
2157
|
chunkId: e,
|
|
2158
2158
|
message: `No tool invocation found for tool call ID "${e}".`
|
|
@@ -2160,8 +2160,8 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2160
2160
|
return t;
|
|
2161
2161
|
}
|
|
2162
2162
|
function h(e) {
|
|
2163
|
-
let t = r.message.parts.filter(
|
|
2164
|
-
if (t == null) throw new
|
|
2163
|
+
let t = r.message.parts.filter(Q).find((t) => t.approval?.id === e);
|
|
2164
|
+
if (t == null) throw new On({
|
|
2165
2165
|
chunkType: "tool-approval-response",
|
|
2166
2166
|
chunkId: e,
|
|
2167
2167
|
message: `No tool invocation found for approval ID "${e}".`
|
|
@@ -2169,7 +2169,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2169
2169
|
return t;
|
|
2170
2170
|
}
|
|
2171
2171
|
function g(e, t) {
|
|
2172
|
-
let n = t ?? f().find((t) =>
|
|
2172
|
+
let n = t ?? f().find((t) => nr(t) && t.toolCallId === e.toolCallId), i = e, a = n;
|
|
2173
2173
|
if (n != null) {
|
|
2174
2174
|
n.state = e.state, a.type = `tool-${e.toolName}`, a.input = i.input, a.output = i.output, a.errorText = i.errorText, a.rawInput = i.rawInput, i.inputEncoding == null ? delete a.inputEncoding : a.inputEncoding = i.inputEncoding, a.preliminary = i.preliminary, e.title !== void 0 && (a.title = e.title), e.toolMetadata !== void 0 && (a.toolMetadata = e.toolMetadata), a.providerExecuted = i.providerExecuted ?? n.providerExecuted;
|
|
2175
2175
|
let t = i.providerMetadata;
|
|
@@ -2226,8 +2226,8 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2226
2226
|
}
|
|
2227
2227
|
async function v(e) {
|
|
2228
2228
|
if (e != null) {
|
|
2229
|
-
let n = r.message.metadata == null ? e :
|
|
2230
|
-
t != null && await
|
|
2229
|
+
let n = r.message.metadata == null ? e : kn(r.message.metadata, e);
|
|
2230
|
+
t != null && await _n({
|
|
2231
2231
|
value: n,
|
|
2232
2232
|
schema: t,
|
|
2233
2233
|
context: {
|
|
@@ -2250,7 +2250,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2250
2250
|
}
|
|
2251
2251
|
case "text-delta": {
|
|
2252
2252
|
let t = r.activeTextParts[e.id];
|
|
2253
|
-
if (t == null) throw new
|
|
2253
|
+
if (t == null) throw new On({
|
|
2254
2254
|
chunkType: "text-delta",
|
|
2255
2255
|
chunkId: e.id,
|
|
2256
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.`
|
|
@@ -2260,7 +2260,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2260
2260
|
}
|
|
2261
2261
|
case "text-end": {
|
|
2262
2262
|
let t = r.activeTextParts[e.id];
|
|
2263
|
-
if (t == null) throw new
|
|
2263
|
+
if (t == null) throw new On({
|
|
2264
2264
|
chunkType: "text-end",
|
|
2265
2265
|
chunkId: e.id,
|
|
2266
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.`
|
|
@@ -2290,7 +2290,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2290
2290
|
}
|
|
2291
2291
|
case "reasoning-delta": {
|
|
2292
2292
|
let t = r.activeReasoningParts[e.id];
|
|
2293
|
-
if (t == null) throw new
|
|
2293
|
+
if (t == null) throw new On({
|
|
2294
2294
|
chunkType: "reasoning-delta",
|
|
2295
2295
|
chunkId: e.id,
|
|
2296
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.`
|
|
@@ -2300,7 +2300,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2300
2300
|
}
|
|
2301
2301
|
case "reasoning-end": {
|
|
2302
2302
|
let t = r.activeReasoningParts[e.id];
|
|
2303
|
-
if (t == null) throw new
|
|
2303
|
+
if (t == null) throw new On({
|
|
2304
2304
|
chunkType: "reasoning-end",
|
|
2305
2305
|
chunkId: e.id,
|
|
2306
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.`
|
|
@@ -2337,7 +2337,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2337
2337
|
}), d();
|
|
2338
2338
|
break;
|
|
2339
2339
|
case "tool-input-start": {
|
|
2340
|
-
let t = f().filter(
|
|
2340
|
+
let t = f().filter(nr);
|
|
2341
2341
|
r.partialToolCalls[e.toolCallId] = {
|
|
2342
2342
|
text: "",
|
|
2343
2343
|
inputEncoding: e.inputEncoding,
|
|
@@ -2371,13 +2371,13 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2371
2371
|
}
|
|
2372
2372
|
case "tool-input-delta": {
|
|
2373
2373
|
let t = r.partialToolCalls[e.toolCallId];
|
|
2374
|
-
if (t == null) throw new
|
|
2374
|
+
if (t == null) throw new On({
|
|
2375
2375
|
chunkType: "tool-input-delta",
|
|
2376
2376
|
chunkId: e.toolCallId,
|
|
2377
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.`
|
|
2378
2378
|
});
|
|
2379
2379
|
t.text += e.inputTextDelta;
|
|
2380
|
-
let n = t.inputEncoding === "text" ? t.text : (await
|
|
2380
|
+
let n = t.inputEncoding === "text" ? t.text : (await Xn(t.text)).value;
|
|
2381
2381
|
t.dynamic ? _({
|
|
2382
2382
|
toolCallId: e.toolCallId,
|
|
2383
2383
|
toolName: t.toolName,
|
|
@@ -2421,7 +2421,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2421
2421
|
}), d(), a && !e.providerExecuted && await a({ toolCall: e });
|
|
2422
2422
|
break;
|
|
2423
2423
|
case "tool-input-error": {
|
|
2424
|
-
let t = f().filter(
|
|
2424
|
+
let t = f().filter(Q).find((t) => t.toolCallId === e.toolCallId);
|
|
2425
2425
|
(t == null ? e.dynamic : t.type === "dynamic-tool") ? _({
|
|
2426
2426
|
toolCallId: e.toolCallId,
|
|
2427
2427
|
toolName: e.toolName,
|
|
@@ -2485,7 +2485,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2485
2485
|
toolMetadata: e.toolMetadata ?? t.toolMetadata
|
|
2486
2486
|
}, t) : g({
|
|
2487
2487
|
toolCallId: e.toolCallId,
|
|
2488
|
-
toolName:
|
|
2488
|
+
toolName: ir(t),
|
|
2489
2489
|
state: "output-available",
|
|
2490
2490
|
input: t.input,
|
|
2491
2491
|
output: e.output,
|
|
@@ -2511,7 +2511,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2511
2511
|
toolMetadata: e.toolMetadata ?? t.toolMetadata
|
|
2512
2512
|
}, t) : g({
|
|
2513
2513
|
toolCallId: e.toolCallId,
|
|
2514
|
-
toolName:
|
|
2514
|
+
toolName: ir(t),
|
|
2515
2515
|
state: "output-error",
|
|
2516
2516
|
input: t.input,
|
|
2517
2517
|
rawInput: t.rawInput,
|
|
@@ -2529,12 +2529,12 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2529
2529
|
case "finish-step": break;
|
|
2530
2530
|
case "reset-step": {
|
|
2531
2531
|
let e = f();
|
|
2532
|
-
r.activeTextParts =
|
|
2532
|
+
r.activeTextParts = tr(), r.activeReasoningParts = tr(), r.partialToolCalls = tr(), e.length > 0 && (r.message.parts.splice(r.message.parts.length - e.length, e.length), d());
|
|
2533
2533
|
break;
|
|
2534
2534
|
}
|
|
2535
2535
|
case "start": {
|
|
2536
2536
|
let t = c && l || s && e.messageId != null && e.messageId !== r.message.id;
|
|
2537
|
-
l = !1, t && Object.assign(r,
|
|
2537
|
+
l = !1, t && Object.assign(r, ar({
|
|
2538
2538
|
lastMessage: void 0,
|
|
2539
2539
|
messageId: e.messageId ?? r.message.id
|
|
2540
2540
|
}), { finishReason: void 0 }), e.messageId != null && (r.message.id = e.messageId), await v(e.messageMetadata), (t || e.messageId != null || e.messageMetadata != null) && d({ updateStatus: !1 });
|
|
@@ -2549,10 +2549,10 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2549
2549
|
case "error":
|
|
2550
2550
|
i?.(Error(e.errorText));
|
|
2551
2551
|
break;
|
|
2552
|
-
default: if (
|
|
2552
|
+
default: if (er(e)) {
|
|
2553
2553
|
if (n?.[e.type] != null) {
|
|
2554
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;
|
|
2555
|
-
await
|
|
2555
|
+
await _n({
|
|
2556
2556
|
value: e.data,
|
|
2557
2557
|
schema: n[e.type],
|
|
2558
2558
|
context: {
|
|
@@ -2575,7 +2575,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2575
2575
|
});
|
|
2576
2576
|
} }));
|
|
2577
2577
|
}
|
|
2578
|
-
async function
|
|
2578
|
+
async function sr({ stream: e, onError: t, abortSignal: n }) {
|
|
2579
2579
|
let r = e.getReader(), i = () => {
|
|
2580
2580
|
r.cancel().catch(() => {});
|
|
2581
2581
|
};
|
|
@@ -2591,7 +2591,7 @@ async function or({ stream: e, onError: t, abortSignal: n }) {
|
|
|
2591
2591
|
n?.removeEventListener("abort", i), r.releaseLock();
|
|
2592
2592
|
}
|
|
2593
2593
|
}
|
|
2594
|
-
function
|
|
2594
|
+
function cr() {
|
|
2595
2595
|
let e, t;
|
|
2596
2596
|
return {
|
|
2597
2597
|
promise: new Promise((n, r) => {
|
|
@@ -2601,32 +2601,32 @@ function sr() {
|
|
|
2601
2601
|
reject: t
|
|
2602
2602
|
};
|
|
2603
2603
|
}
|
|
2604
|
-
|
|
2604
|
+
j({
|
|
2605
2605
|
prefix: "aitxt",
|
|
2606
2606
|
size: 24
|
|
2607
|
-
}),
|
|
2607
|
+
}), j({
|
|
2608
2608
|
prefix: "call",
|
|
2609
2609
|
size: 24
|
|
2610
|
-
}),
|
|
2610
|
+
}), j({
|
|
2611
2611
|
prefix: "aitxt",
|
|
2612
2612
|
size: 24
|
|
2613
|
-
}),
|
|
2613
|
+
}), j({
|
|
2614
2614
|
prefix: "call",
|
|
2615
2615
|
size: 24
|
|
2616
|
-
}),
|
|
2616
|
+
}), Y.record(Y.string(), An.optional()), Y.record(Y.string(), Y.string()), j({
|
|
2617
2617
|
prefix: "call",
|
|
2618
2618
|
size: 24
|
|
2619
|
-
}),
|
|
2619
|
+
}), j({
|
|
2620
2620
|
prefix: "call",
|
|
2621
2621
|
size: 24
|
|
2622
|
-
}), new TextEncoder(),
|
|
2622
|
+
}), new TextEncoder(), j({
|
|
2623
2623
|
prefix: "call",
|
|
2624
2624
|
size: 24
|
|
2625
|
-
}),
|
|
2625
|
+
}), j({
|
|
2626
2626
|
prefix: "aiobj",
|
|
2627
2627
|
size: 24
|
|
2628
2628
|
});
|
|
2629
|
-
var { atob:
|
|
2629
|
+
var { atob: lr } = globalThis, ur = class {
|
|
2630
2630
|
constructor() {
|
|
2631
2631
|
this.queue = [], this.isProcessing = !1, this.idleWaiters = [];
|
|
2632
2632
|
}
|
|
@@ -2658,15 +2658,15 @@ var { atob: cr } = globalThis, lr = class {
|
|
|
2658
2658
|
});
|
|
2659
2659
|
}
|
|
2660
2660
|
};
|
|
2661
|
-
|
|
2661
|
+
j({
|
|
2662
2662
|
prefix: "aiobj",
|
|
2663
2663
|
size: 24
|
|
2664
|
-
}),
|
|
2664
|
+
}), j({
|
|
2665
2665
|
prefix: "call",
|
|
2666
2666
|
size: 24
|
|
2667
|
-
}),
|
|
2668
|
-
token:
|
|
2669
|
-
url:
|
|
2667
|
+
}), Y.object({
|
|
2668
|
+
token: Y.string().refine((e) => e.trim().length > 0),
|
|
2669
|
+
url: Y.string().refine((e) => {
|
|
2670
2670
|
try {
|
|
2671
2671
|
let t = new URL(e);
|
|
2672
2672
|
return (t.protocol === "ws:" || t.protocol === "wss:") && t.hostname !== "";
|
|
@@ -2674,26 +2674,26 @@ M({
|
|
|
2674
2674
|
return !1;
|
|
2675
2675
|
}
|
|
2676
2676
|
}),
|
|
2677
|
-
expiresAt:
|
|
2678
|
-
tools:
|
|
2679
|
-
type:
|
|
2680
|
-
name:
|
|
2681
|
-
description:
|
|
2682
|
-
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())
|
|
2683
2683
|
})).optional()
|
|
2684
|
-
}),
|
|
2684
|
+
}), j({
|
|
2685
2685
|
prefix: "call",
|
|
2686
2686
|
size: 24
|
|
2687
|
-
}),
|
|
2687
|
+
}), j({
|
|
2688
2688
|
prefix: "call",
|
|
2689
2689
|
size: 24
|
|
2690
|
-
}),
|
|
2690
|
+
}), j({
|
|
2691
2691
|
prefix: "call",
|
|
2692
2692
|
size: 24
|
|
2693
2693
|
});
|
|
2694
|
-
async function
|
|
2694
|
+
async function dr({ response: e, url: t, fallbackMessage: n }) {
|
|
2695
2695
|
let r = await e.text();
|
|
2696
|
-
return new
|
|
2696
|
+
return new Re({
|
|
2697
2697
|
message: r || n,
|
|
2698
2698
|
url: t,
|
|
2699
2699
|
requestBodyValues: void 0,
|
|
@@ -2701,9 +2701,9 @@ async function ur({ response: e, url: t, fallbackMessage: n }) {
|
|
|
2701
2701
|
responseBody: r
|
|
2702
2702
|
});
|
|
2703
2703
|
}
|
|
2704
|
-
async function
|
|
2704
|
+
async function fr(e) {
|
|
2705
2705
|
if (e == null) return [];
|
|
2706
|
-
if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new
|
|
2706
|
+
if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new nt({
|
|
2707
2707
|
functionality: "FileList",
|
|
2708
2708
|
message: "FileList is not supported in the current environment"
|
|
2709
2709
|
});
|
|
@@ -2722,18 +2722,18 @@ async function dr(e) {
|
|
|
2722
2722
|
};
|
|
2723
2723
|
}));
|
|
2724
2724
|
}
|
|
2725
|
-
function
|
|
2725
|
+
function pr(e, t) {
|
|
2726
2726
|
let n = e.search(/[?#]/), r = n === -1 ? e : e.slice(0, n), i = n === -1 ? "" : e.slice(n);
|
|
2727
2727
|
return `${r.endsWith("/") && t.startsWith("/") ? r.slice(0, -1) : r}${t}${i}`;
|
|
2728
2728
|
}
|
|
2729
|
-
var
|
|
2729
|
+
var mr = class {
|
|
2730
2730
|
constructor({ api: e = "/api/chat", credentials: t, headers: n, body: r, fetch: i, prepareSendMessagesRequest: a, prepareReconnectToStreamRequest: o }) {
|
|
2731
2731
|
this.api = e, this.credentials = t, this.headers = n, this.body = r, this.fetch = i, this.prepareSendMessagesRequest = a, this.prepareReconnectToStreamRequest = o;
|
|
2732
2732
|
}
|
|
2733
2733
|
async sendMessages({ abortSignal: e, ...t }) {
|
|
2734
|
-
let n = await
|
|
2735
|
-
...
|
|
2736
|
-
...
|
|
2734
|
+
let n = await xn(this.body), r = await xn(this.headers), i = await xn(this.credentials), a = {
|
|
2735
|
+
...A(r),
|
|
2736
|
+
...A(t.headers)
|
|
2737
2737
|
}, o = await this.prepareSendMessagesRequest?.({
|
|
2738
2738
|
api: this.api,
|
|
2739
2739
|
id: t.chatId,
|
|
@@ -2747,7 +2747,7 @@ var pr = class {
|
|
|
2747
2747
|
requestMetadata: t.metadata,
|
|
2748
2748
|
trigger: t.trigger,
|
|
2749
2749
|
messageId: t.messageId
|
|
2750
|
-
}), s = o?.api ?? this.api, c = o?.headers === void 0 ? a :
|
|
2750
|
+
}), s = o?.api ?? this.api, c = o?.headers === void 0 ? a : A(o.headers), l = o?.body === void 0 ? {
|
|
2751
2751
|
...n,
|
|
2752
2752
|
...t.body,
|
|
2753
2753
|
id: t.chatId,
|
|
@@ -2764,18 +2764,18 @@ var pr = class {
|
|
|
2764
2764
|
credentials: u,
|
|
2765
2765
|
signal: e
|
|
2766
2766
|
});
|
|
2767
|
-
if (!d.ok) throw await
|
|
2767
|
+
if (!d.ok) throw await dr({
|
|
2768
2768
|
response: d,
|
|
2769
2769
|
url: s,
|
|
2770
2770
|
fallbackMessage: "Failed to fetch the chat response."
|
|
2771
2771
|
});
|
|
2772
|
-
if (!d.body) throw new
|
|
2772
|
+
if (!d.body) throw new He({ message: "The response body is empty." });
|
|
2773
2773
|
return this.processResponseStream(d.body);
|
|
2774
2774
|
}
|
|
2775
2775
|
async reconnectToStream(e) {
|
|
2776
|
-
let t = await
|
|
2777
|
-
...
|
|
2778
|
-
...
|
|
2776
|
+
let t = await xn(this.body), n = await xn(this.headers), r = await xn(this.credentials), i = {
|
|
2777
|
+
...A(n),
|
|
2778
|
+
...A(e.headers)
|
|
2779
2779
|
}, a = await this.prepareReconnectToStreamRequest?.({
|
|
2780
2780
|
api: this.api,
|
|
2781
2781
|
id: e.chatId,
|
|
@@ -2788,54 +2788,54 @@ var pr = class {
|
|
|
2788
2788
|
requestMetadata: e.metadata
|
|
2789
2789
|
}), o = a?.api;
|
|
2790
2790
|
if (o == null) {
|
|
2791
|
-
if (e.chatId === "." || e.chatId === "..") throw new
|
|
2791
|
+
if (e.chatId === "." || e.chatId === "..") throw new wn({
|
|
2792
2792
|
parameter: "chatId",
|
|
2793
2793
|
value: e.chatId,
|
|
2794
2794
|
message: "Chat IDs must not be \".\" or \"..\" when using the default reconnect URL."
|
|
2795
2795
|
});
|
|
2796
|
-
o =
|
|
2796
|
+
o = pr(this.api, `/${encodeURIComponent(e.chatId)}/stream`);
|
|
2797
2797
|
}
|
|
2798
|
-
let s = a?.headers === void 0 ? i :
|
|
2798
|
+
let s = a?.headers === void 0 ? i : A(a.headers), c = a?.credentials ?? r, l = await (this.fetch ?? globalThis.fetch)(o, {
|
|
2799
2799
|
method: "GET",
|
|
2800
2800
|
headers: s,
|
|
2801
2801
|
credentials: c,
|
|
2802
2802
|
signal: e.abortSignal
|
|
2803
2803
|
});
|
|
2804
2804
|
if (l.status === 204) return null;
|
|
2805
|
-
if (!l.ok) throw await
|
|
2805
|
+
if (!l.ok) throw await dr({
|
|
2806
2806
|
response: l,
|
|
2807
2807
|
url: o,
|
|
2808
2808
|
fallbackMessage: "Failed to fetch the chat response."
|
|
2809
2809
|
});
|
|
2810
|
-
if (!l.body) throw new
|
|
2810
|
+
if (!l.body) throw new He({ message: "The response body is empty." });
|
|
2811
2811
|
return this.processResponseStream(l.body);
|
|
2812
2812
|
}
|
|
2813
|
-
},
|
|
2813
|
+
}, hr = class extends mr {
|
|
2814
2814
|
constructor({ resumeStreamIsReplay: e = !0, ...t } = {}) {
|
|
2815
2815
|
super(t), this.resumeStreamIsReplay = e;
|
|
2816
2816
|
}
|
|
2817
2817
|
processResponseStream(e) {
|
|
2818
|
-
return
|
|
2818
|
+
return bn({
|
|
2819
2819
|
stream: e,
|
|
2820
|
-
schema:
|
|
2820
|
+
schema: $n
|
|
2821
2821
|
}).pipeThrough(new TransformStream({ async transform(e, t) {
|
|
2822
2822
|
if (!e.success) throw e.error;
|
|
2823
2823
|
t.enqueue(e.value);
|
|
2824
2824
|
} }));
|
|
2825
2825
|
}
|
|
2826
|
-
},
|
|
2826
|
+
}, gr = class {
|
|
2827
2827
|
get id() {
|
|
2828
2828
|
return this._id ??= this.generateId();
|
|
2829
2829
|
}
|
|
2830
|
-
constructor({ generateId: e =
|
|
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
|
|
2830
|
+
constructor({ generateId: e = ft, id: t, transport: n = new hr(), messageMetadataSchema: r, dataPartSchemas: i, state: a, onError: o, onToolCall: s, onFinish: c, onData: l, sendAutomaticallyWhen: u }) {
|
|
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) => {
|
|
2832
2832
|
if (e == null) {
|
|
2833
2833
|
let e = this.pendingApprovalMessageId;
|
|
2834
2834
|
if (e == null) {
|
|
2835
2835
|
e = this.lastMessage?.id;
|
|
2836
2836
|
for (let t = this.state.messages.length - 1; t >= 0; t--) {
|
|
2837
2837
|
let n = this.state.messages[t];
|
|
2838
|
-
if (n.role === "assistant" && n.parts.some((e) =>
|
|
2838
|
+
if (n.role === "assistant" && n.parts.some((e) => Q(e) && e.state === "approval-responded")) {
|
|
2839
2839
|
e = n.id;
|
|
2840
2840
|
break;
|
|
2841
2841
|
}
|
|
@@ -2855,7 +2855,7 @@ var pr = class {
|
|
|
2855
2855
|
this.pendingMessagePreparations.add(t);
|
|
2856
2856
|
let r;
|
|
2857
2857
|
try {
|
|
2858
|
-
r = Array.isArray(e.files) ? e.files : await
|
|
2858
|
+
r = Array.isArray(e.files) ? e.files : await fr(e.files);
|
|
2859
2859
|
} finally {
|
|
2860
2860
|
this.pendingMessagePreparations.delete(t);
|
|
2861
2861
|
}
|
|
@@ -2867,12 +2867,12 @@ var pr = class {
|
|
|
2867
2867
|
} else n = e;
|
|
2868
2868
|
if (e.messageId != null) {
|
|
2869
2869
|
let t = this.state.messages.findIndex((t) => t.id === e.messageId);
|
|
2870
|
-
if (t === -1) throw new
|
|
2870
|
+
if (t === -1) throw new wn({
|
|
2871
2871
|
parameter: "message.messageId",
|
|
2872
2872
|
value: e.messageId,
|
|
2873
2873
|
message: `message with id ${e.messageId} not found`
|
|
2874
2874
|
});
|
|
2875
|
-
if (this.state.messages[t].role !== "user") throw new
|
|
2875
|
+
if (this.state.messages[t].role !== "user") throw new wn({
|
|
2876
2876
|
parameter: "message.messageId",
|
|
2877
2877
|
value: e.messageId,
|
|
2878
2878
|
message: `message with id ${e.messageId} is not a user message`
|
|
@@ -2896,7 +2896,7 @@ var pr = class {
|
|
|
2896
2896
|
});
|
|
2897
2897
|
}, this.regenerate = async ({ messageId: e, ...t } = {}) => {
|
|
2898
2898
|
let n = e == null ? this.state.messages.length - 1 : this.state.messages.findIndex((t) => t.id === e);
|
|
2899
|
-
if (n === -1) throw new
|
|
2899
|
+
if (n === -1) throw new wn({
|
|
2900
2900
|
parameter: "messageId",
|
|
2901
2901
|
value: e,
|
|
2902
2902
|
message: `message ${e} not found`
|
|
@@ -2917,7 +2917,7 @@ var pr = class {
|
|
|
2917
2917
|
}, this.clearError = () => {
|
|
2918
2918
|
this.status === "error" && (this.state.error = void 0, this.setStatus({ status: "ready" }));
|
|
2919
2919
|
}, this.addToolApprovalResponse = async ({ id: e, approved: t, reason: n, options: r }) => this.jobExecutor.run(async () => {
|
|
2920
|
-
let i = this.state.messages, a = (r) =>
|
|
2920
|
+
let i = this.state.messages, a = (r) => Q(r) && r.state === "approval-requested" && r.approval.id === e ? {
|
|
2921
2921
|
...r,
|
|
2922
2922
|
state: "approval-responded",
|
|
2923
2923
|
approval: {
|
|
@@ -2926,7 +2926,7 @@ var pr = class {
|
|
|
2926
2926
|
approved: t,
|
|
2927
2927
|
reason: n
|
|
2928
2928
|
}
|
|
2929
|
-
} : r, o = i.findIndex((t) => t.parts.some((t) =>
|
|
2929
|
+
} : r, o = i.findIndex((t) => t.parts.some((t) => Q(t) && t.state === "approval-requested" && t.approval.id === e));
|
|
2930
2930
|
if (o !== -1) {
|
|
2931
2931
|
let e = i[o];
|
|
2932
2932
|
this.state.replaceMessage(o, {
|
|
@@ -2947,7 +2947,7 @@ var pr = class {
|
|
|
2947
2947
|
}
|
|
2948
2948
|
}), this.addToolOutput = async ({ state: e, toolCallId: t, output: n, errorText: r, options: i }) => this.jobExecutor.run(async () => {
|
|
2949
2949
|
let a = this.state.messages, o = (i) => {
|
|
2950
|
-
if (
|
|
2950
|
+
if (!Q(i) || i.toolCallId !== t) return i;
|
|
2951
2951
|
let { approval: a, ...o } = i, s = a?.approved === !0 ? { approval: {
|
|
2952
2952
|
...a,
|
|
2953
2953
|
approved: a.approved
|
|
@@ -2967,7 +2967,7 @@ var pr = class {
|
|
|
2967
2967
|
output: n,
|
|
2968
2968
|
errorText: void 0
|
|
2969
2969
|
};
|
|
2970
|
-
}, s = a.findIndex((e) => e.parts.some((e) =>
|
|
2970
|
+
}, s = a.findIndex((e) => e.parts.some((e) => Q(e) && e.toolCallId === t));
|
|
2971
2971
|
if (s !== -1) {
|
|
2972
2972
|
let e = a[s];
|
|
2973
2973
|
this.state.replaceMessage(s, {
|
|
@@ -3031,7 +3031,7 @@ var pr = class {
|
|
|
3031
3031
|
}), r && this.status === "error" && this.pendingApprovalMessageId == null && (this.pendingApprovalMessageId = this.state.messages[t]?.id ?? e);
|
|
3032
3032
|
}
|
|
3033
3033
|
async makeRequest(e) {
|
|
3034
|
-
let t =
|
|
3034
|
+
let t = cr();
|
|
3035
3035
|
try {
|
|
3036
3036
|
await this.makeRequestImpl({
|
|
3037
3037
|
...e,
|
|
@@ -3084,17 +3084,17 @@ var pr = class {
|
|
|
3084
3084
|
status: "submitted",
|
|
3085
3085
|
error: void 0
|
|
3086
3086
|
});
|
|
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) =>
|
|
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, ee = !1, y;
|
|
3088
3088
|
try {
|
|
3089
3089
|
let s = {
|
|
3090
|
-
state: e === "resume-stream" && this.resumableStreamState != null ? this.resumableStreamState :
|
|
3090
|
+
state: e === "resume-stream" && this.resumableStreamState != null ? this.resumableStreamState : ar({
|
|
3091
3091
|
lastMessage: e === "resume-stream" ? h : e === "regenerate-message" ? void 0 : this.state.snapshot(p),
|
|
3092
3092
|
messageId: this.generateId()
|
|
3093
3093
|
}),
|
|
3094
3094
|
abortController: o,
|
|
3095
3095
|
completionPromise: a
|
|
3096
3096
|
};
|
|
3097
|
-
|
|
3097
|
+
y = s, s.abortController.signal.addEventListener("abort", () => {
|
|
3098
3098
|
_ = !0;
|
|
3099
3099
|
}), this.activeResponse = s;
|
|
3100
3100
|
let l;
|
|
@@ -3107,8 +3107,8 @@ var pr = class {
|
|
|
3107
3107
|
body: r,
|
|
3108
3108
|
trigger: e,
|
|
3109
3109
|
messageId: i
|
|
3110
|
-
}), await
|
|
3111
|
-
stream:
|
|
3110
|
+
}), await sr({
|
|
3111
|
+
stream: or({
|
|
3112
3112
|
stream: l,
|
|
3113
3113
|
resetStateOnMessageIdChange: e === "resume-stream",
|
|
3114
3114
|
resetStateOnFirstMessageStart: e === "resume-stream" && this.transport.resumeStreamIsReplay,
|
|
@@ -3140,34 +3140,34 @@ var pr = class {
|
|
|
3140
3140
|
}), _) return c() && (this.setStatus({ status: "ready" }), this.resumableStreamState === s.state && (this.resumableStreamState = void 0)), null;
|
|
3141
3141
|
c() && (this.setStatus({ status: "ready" }), this.resumableStreamState === s.state && (this.resumableStreamState = void 0));
|
|
3142
3142
|
} catch (e) {
|
|
3143
|
-
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 === y?.state && (this.resumableStreamState = void 0)), null;
|
|
3144
3144
|
if (!c()) return null;
|
|
3145
|
-
if (
|
|
3145
|
+
if (ee = !0, e instanceof TypeError) {
|
|
3146
3146
|
let t = e.message.toLowerCase();
|
|
3147
3147
|
v = t.includes("fetch") || t.includes("network") || t === "load failed";
|
|
3148
3148
|
}
|
|
3149
|
-
v ? this.resumableStreamState =
|
|
3149
|
+
v ? this.resumableStreamState = y?.state : this.resumableStreamState === y?.state && (this.resumableStreamState = void 0), this.onError && e instanceof Error && this.onError(e), this.setStatus({
|
|
3150
3150
|
status: "error",
|
|
3151
3151
|
error: e
|
|
3152
3152
|
});
|
|
3153
3153
|
} finally {
|
|
3154
3154
|
try {
|
|
3155
|
-
if (
|
|
3156
|
-
let { message: e, finishReason: t } =
|
|
3157
|
-
t === "interrupted" ? this.interruptedMessageIds.add(e.id) : !_ && !
|
|
3158
|
-
message:
|
|
3155
|
+
if (y) {
|
|
3156
|
+
let { message: e, finishReason: t } = y.state;
|
|
3157
|
+
t === "interrupted" ? this.interruptedMessageIds.add(e.id) : !_ && !ee && this.interruptedMessageIds.delete(e.id), this.onFinish?.({
|
|
3158
|
+
message: y.state.message,
|
|
3159
3159
|
messages: this.state.messages,
|
|
3160
3160
|
isAbort: _,
|
|
3161
3161
|
isDisconnect: v,
|
|
3162
|
-
isError:
|
|
3163
|
-
finishReason:
|
|
3162
|
+
isError: ee,
|
|
3163
|
+
finishReason: y.state.finishReason
|
|
3164
3164
|
});
|
|
3165
3165
|
}
|
|
3166
3166
|
} finally {
|
|
3167
|
-
this.activeResponse ===
|
|
3167
|
+
this.activeResponse === y && (this.activeResponse = void 0), l();
|
|
3168
3168
|
}
|
|
3169
3169
|
}
|
|
3170
|
-
!_ && !
|
|
3170
|
+
!_ && !ee && y?.state.finishReason !== "interrupted" && await this.runAutomaticRequest(() => this.makeRequest({
|
|
3171
3171
|
trigger: "submit-message",
|
|
3172
3172
|
messageId: this.lastMessage?.id,
|
|
3173
3173
|
metadata: t,
|
|
@@ -3176,37 +3176,37 @@ var pr = class {
|
|
|
3176
3176
|
}));
|
|
3177
3177
|
}
|
|
3178
3178
|
};
|
|
3179
|
-
function
|
|
3179
|
+
function _r({ messages: e }) {
|
|
3180
3180
|
let t = e[e.length - 1];
|
|
3181
3181
|
if (!t || t.role !== "assistant") return !1;
|
|
3182
|
-
let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter(
|
|
3182
|
+
let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter(Q);
|
|
3183
3183
|
return r.filter((e) => e.state === "approval-responded").length > 0 && r.every((e) => e.state === "output-available" && e.preliminary !== !0 || e.state === "output-error" || e.state === "output-denied" || e.state === "approval-responded");
|
|
3184
3184
|
}
|
|
3185
3185
|
// ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.44_typescript@6.0.3_/node_modules/swrv/esm/lib/hash.js
|
|
3186
|
-
var
|
|
3187
|
-
function
|
|
3186
|
+
var vr = /* @__PURE__ */ new WeakMap(), yr = 0;
|
|
3187
|
+
function br(e) {
|
|
3188
3188
|
if (!e.length) return "";
|
|
3189
3189
|
for (var t = "arg", n = 0; n < e.length; ++n) {
|
|
3190
3190
|
var r = void 0;
|
|
3191
|
-
e[n] === null || typeof e[n] != "object" && typeof e[n] != "function" ? r = typeof e[n] == "string" ? "\"" + e[n] + "\"" : String(e[n]) :
|
|
3191
|
+
e[n] === null || typeof e[n] != "object" && typeof e[n] != "function" ? r = typeof e[n] == "string" ? "\"" + e[n] + "\"" : String(e[n]) : vr.has(e[n]) ? r = vr.get(e[n]) : (r = yr, vr.set(e[n], yr++)), t += "@" + r;
|
|
3192
3192
|
}
|
|
3193
3193
|
return t;
|
|
3194
3194
|
}
|
|
3195
3195
|
// ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.44_typescript@6.0.3_/node_modules/swrv/esm/cache/index.js
|
|
3196
|
-
function
|
|
3196
|
+
function xr(e) {
|
|
3197
3197
|
if (typeof e == "function") try {
|
|
3198
3198
|
e = e();
|
|
3199
3199
|
} catch {
|
|
3200
3200
|
e = "";
|
|
3201
3201
|
}
|
|
3202
|
-
return e = Array.isArray(e) ?
|
|
3202
|
+
return e = Array.isArray(e) ? br(e) : String(e || ""), e;
|
|
3203
3203
|
}
|
|
3204
|
-
var
|
|
3204
|
+
var Sr = function() {
|
|
3205
3205
|
function e(e) {
|
|
3206
3206
|
e === void 0 && (e = 0), this.items = /* @__PURE__ */ new Map(), this.ttl = e;
|
|
3207
3207
|
}
|
|
3208
3208
|
return e.prototype.serializeKey = function(e) {
|
|
3209
|
-
return
|
|
3209
|
+
return xr(e);
|
|
3210
3210
|
}, e.prototype.get = function(e) {
|
|
3211
3211
|
var t = this.serializeKey(e);
|
|
3212
3212
|
return this.items.get(t);
|
|
@@ -3227,25 +3227,25 @@ var xr = function() {
|
|
|
3227
3227
|
}, e;
|
|
3228
3228
|
}();
|
|
3229
3229
|
// ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.44_typescript@6.0.3_/node_modules/swrv/esm/lib/web-preset.js
|
|
3230
|
-
function
|
|
3230
|
+
function Cr() {
|
|
3231
3231
|
return navigator.onLine === void 0 || navigator.onLine;
|
|
3232
3232
|
}
|
|
3233
|
-
function
|
|
3233
|
+
function wr() {
|
|
3234
3234
|
return typeof document < "u" && document.visibilityState !== void 0 ? document.visibilityState !== "hidden" : !0;
|
|
3235
3235
|
}
|
|
3236
|
-
var
|
|
3237
|
-
isOnline:
|
|
3238
|
-
isDocumentVisible:
|
|
3236
|
+
var Tr = {
|
|
3237
|
+
isOnline: Cr,
|
|
3238
|
+
isDocumentVisible: wr,
|
|
3239
3239
|
fetcher: function(e) {
|
|
3240
3240
|
return fetch(e).then(function(e) {
|
|
3241
3241
|
return e.json();
|
|
3242
3242
|
});
|
|
3243
3243
|
}
|
|
3244
|
-
},
|
|
3245
|
-
return
|
|
3244
|
+
}, $ = function() {
|
|
3245
|
+
return $ = Object.assign || function(e) {
|
|
3246
3246
|
for (var t, n = 1, r = arguments.length; n < r; n++) for (var i in t = arguments[n], t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
|
|
3247
3247
|
return e;
|
|
3248
|
-
},
|
|
3248
|
+
}, $.apply(this, arguments);
|
|
3249
3249
|
}, Er = function(e, t, n, r) {
|
|
3250
3250
|
function i(e) {
|
|
3251
3251
|
return e instanceof n ? e : new n(function(t) {
|
|
@@ -3364,7 +3364,7 @@ var wr = {
|
|
|
3364
3364
|
}, kr = function(e, t, n) {
|
|
3365
3365
|
if (n || arguments.length === 2) for (var r = 0, i = t.length, a; r < i; r++) (a || !(r in t)) && (a ||= Array.prototype.slice.call(t, 0, r), a[r] = t[r]);
|
|
3366
3366
|
return e.concat(a || Array.prototype.slice.call(t));
|
|
3367
|
-
}, Ar = new
|
|
3367
|
+
}, Ar = new Sr(), jr = new Sr(), Mr = new Sr(), Nr = {
|
|
3368
3368
|
cache: Ar,
|
|
3369
3369
|
refreshInterval: 0,
|
|
3370
3370
|
ttl: 0,
|
|
@@ -3375,9 +3375,9 @@ var wr = {
|
|
|
3375
3375
|
shouldRetryOnError: !0,
|
|
3376
3376
|
errorRetryInterval: 5e3,
|
|
3377
3377
|
errorRetryCount: 5,
|
|
3378
|
-
fetcher:
|
|
3379
|
-
isOnline:
|
|
3380
|
-
isDocumentVisible:
|
|
3378
|
+
fetcher: Tr.fetcher,
|
|
3379
|
+
isOnline: Tr.isOnline,
|
|
3380
|
+
isDocumentVisible: Tr.isDocumentVisible
|
|
3381
3381
|
};
|
|
3382
3382
|
function Pr(e, t, n) {
|
|
3383
3383
|
var r = jr.get(e);
|
|
@@ -3437,14 +3437,14 @@ var Lr = function(e, t, n, r) {
|
|
|
3437
3437
|
};
|
|
3438
3438
|
function Rr() {
|
|
3439
3439
|
for (var e = this, t = [], n = 0; n < arguments.length; n++) t[n] = arguments[n];
|
|
3440
|
-
var r, i, a =
|
|
3441
|
-
if (!
|
|
3440
|
+
var r, i, a = $({}, Nr), o = !1, s = !1;
|
|
3441
|
+
if (!me()) return console.error("useSWRV must be called inside setup() or an active effectScope()."), null;
|
|
3442
3442
|
var c = typeof window > "u" || typeof document > "u";
|
|
3443
|
-
t.length >= 1 && (r = t[0]), t.length >= 2 && (i = t[1]), t.length > 2 && (a =
|
|
3444
|
-
var l = c ? a.serverTTL : a.ttl, u = typeof r == "function" ? r :
|
|
3443
|
+
t.length >= 1 && (r = t[0]), t.length >= 2 && (i = t[1]), t.length > 2 && (a = $($({}, a), t[2]));
|
|
3444
|
+
var l = c ? a.serverTTL : a.ttl, u = typeof r == "function" ? r : x(r);
|
|
3445
3445
|
i === void 0 && (i = a.fetcher);
|
|
3446
3446
|
var d = null;
|
|
3447
|
-
d ||=
|
|
3447
|
+
d ||= ve({
|
|
3448
3448
|
data: void 0,
|
|
3449
3449
|
error: void 0,
|
|
3450
3450
|
isValidating: !0,
|
|
@@ -3514,7 +3514,7 @@ function Rr() {
|
|
|
3514
3514
|
};
|
|
3515
3515
|
a.refreshInterval && (m = setTimeout(h, a.refreshInterval)), a.revalidateOnFocus && (document.addEventListener("visibilitychange", p, !1), window.addEventListener("focus", p, !1));
|
|
3516
3516
|
}
|
|
3517
|
-
|
|
3517
|
+
_e(function() {
|
|
3518
3518
|
o = !0, m &&= (clearTimeout(m), null), !c && a.revalidateOnFocus && (document.removeEventListener("visibilitychange", p, !1), window.removeEventListener("focus", p, !1));
|
|
3519
3519
|
var e = jr.get(u.value);
|
|
3520
3520
|
e && (e.data = e.data.filter(function(e) {
|
|
@@ -3522,12 +3522,12 @@ function Rr() {
|
|
|
3522
3522
|
}));
|
|
3523
3523
|
});
|
|
3524
3524
|
try {
|
|
3525
|
-
|
|
3526
|
-
|
|
3525
|
+
C(u, function(e) {
|
|
3526
|
+
he(u) || (u.value = e), d.key = e, d.isValidating = !!e, Pr(u.value, d, l), !c && !s && u.value && f(), s = !1;
|
|
3527
3527
|
}, { immediate: !0 });
|
|
3528
3528
|
} catch {}
|
|
3529
|
-
return
|
|
3530
|
-
return f(e,
|
|
3529
|
+
return $($({}, ye(d)), { mutate: function(e, t) {
|
|
3530
|
+
return f(e, $($({}, t), { forceRevalidate: !0 }));
|
|
3531
3531
|
} });
|
|
3532
3532
|
}
|
|
3533
3533
|
function zr(e) {
|
|
@@ -3605,7 +3605,7 @@ var Ur = class {
|
|
|
3605
3605
|
this.isPublishing = !1;
|
|
3606
3606
|
}
|
|
3607
3607
|
}
|
|
3608
|
-
}, Wr = class extends
|
|
3608
|
+
}, Wr = class extends gr {
|
|
3609
3609
|
constructor({ state: e, ...t }) {
|
|
3610
3610
|
super({
|
|
3611
3611
|
...t,
|
|
@@ -3614,10 +3614,10 @@ var Ur = class {
|
|
|
3614
3614
|
}
|
|
3615
3615
|
};
|
|
3616
3616
|
function Gr(e) {
|
|
3617
|
-
let t =
|
|
3618
|
-
return
|
|
3617
|
+
let t = S([]), n = S("ready"), r = S(), i = S(), a;
|
|
3618
|
+
return C(t, (e) => {
|
|
3619
3619
|
a != null && !a.isPublishing && a.setMessagesFromConsumer(e);
|
|
3620
|
-
}, { flush: "sync" }),
|
|
3620
|
+
}, { flush: "sync" }), C(() => be(e), (e) => {
|
|
3621
3621
|
a?.dispose();
|
|
3622
3622
|
let { throttle: o, ...s } = e ?? {}, c = new Ur({
|
|
3623
3623
|
initialMessages: s.messages ?? [],
|
|
@@ -3630,10 +3630,10 @@ function Gr(e) {
|
|
|
3630
3630
|
...s,
|
|
3631
3631
|
state: c
|
|
3632
3632
|
});
|
|
3633
|
-
}, { immediate: !0 }),
|
|
3633
|
+
}, { immediate: !0 }), me() != null && _e(() => {
|
|
3634
3634
|
a?.dispose();
|
|
3635
3635
|
}), {
|
|
3636
|
-
id:
|
|
3636
|
+
id: b(() => i.value.id),
|
|
3637
3637
|
status: n,
|
|
3638
3638
|
messages: t,
|
|
3639
3639
|
error: r,
|
|
@@ -3660,47 +3660,47 @@ var Kr = "voice-", qr = 300, Jr = (e) => e?.role === "assistant" && e.parts.some
|
|
|
3660
3660
|
}, $r = 12e4, ei = 1e3, ti = 5e3, ni = 100, ri = 3e4, ii = 5e3, ai = 250, oi = 1e3, si = "\n\n", ci = (e) => {
|
|
3661
3661
|
let t = e.type ?? "";
|
|
3662
3662
|
return t === "dynamic-tool" ? e.toolName ?? "" : t.startsWith("tool-") ? t.slice(5) : "";
|
|
3663
|
-
}, li = (e) => e?.role === "assistant" && e.parts.some((e) =>
|
|
3663
|
+
}, li = (e) => e?.role === "assistant" && e.parts.some((e) => y(ci(e)) && !e.providerExecuted && !se.has(e.state ?? "")), ui = ({ messages: e }) => {
|
|
3664
3664
|
let t = e[e.length - 1];
|
|
3665
3665
|
if (!t || t.role !== "assistant") return !1;
|
|
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 && (
|
|
3667
|
-
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 && (y(ci(e)) || re(e)));
|
|
3667
|
+
return r.length > 0 && r.every((e) => se.has(e.state ?? ""));
|
|
3668
3668
|
};
|
|
3669
3669
|
function di(e) {
|
|
3670
|
-
return
|
|
3671
|
-
let { t, te: n, locale: r } =
|
|
3670
|
+
return Te(`chatbot-${e}`, () => {
|
|
3671
|
+
let { t, te: n, locale: r } = Se({ useScope: "global" }), i = x(""), a = x(), o = x(e), s = x(), c = x(), l = x(), u = x(), d = x(), f = x(), p = x(), m = x(), h = x(), g = x(), _ = x(), v = x(), y = x(), ae = x(), oe = x(), se = x(), me = S(), he = x(0), ye = x(0), be = x(), Te = x(), ke = x(), Ne = S(), Pe = S(), w = x(), Fe = x(), Ie = S(), Le = x(!1), Re = x({}), ze = x({}), Be = x(!1), Ve = x(0), He = x(), Ue = x(!1), We = we(), Ge = b(() => {
|
|
3672
3672
|
let e = u.value?.theme;
|
|
3673
|
-
return e && e !== "auto" || (e =
|
|
3674
|
-
}),
|
|
3673
|
+
return e && e !== "auto" || (e = He.value), e ? e === "dark" : We.value;
|
|
3674
|
+
}), T = b(() => c.value === "reasoning"), Ke = b(() => T.value ? g.value?.filter((e) => ![
|
|
3675
3675
|
"upvote",
|
|
3676
3676
|
"downvote",
|
|
3677
3677
|
"feedback"
|
|
3678
|
-
].includes(e)) : g.value),
|
|
3679
|
-
|
|
3680
|
-
|
|
3678
|
+
].includes(e)) : g.value), qe = pe(b(() => `${o.value}-chatId`), null);
|
|
3679
|
+
xe(() => {
|
|
3680
|
+
qe.value ||= ft();
|
|
3681
3681
|
});
|
|
3682
|
-
let
|
|
3683
|
-
get: () =>
|
|
3682
|
+
let E = b({
|
|
3683
|
+
get: () => qe.value,
|
|
3684
3684
|
set: (e) => {
|
|
3685
|
-
|
|
3685
|
+
qe.value = e;
|
|
3686
3686
|
}
|
|
3687
|
-
}),
|
|
3688
|
-
function
|
|
3689
|
-
|
|
3687
|
+
}), Je = fe(b(() => `${o.value}-pageAccessOff`), !1), D = b(() => Je.value ? [] : Ne.value ?? []), Ye = () => Je.value ? [] : Pe.value?.() ?? [], Xe = b(() => !!(be.value && Ne.value?.length)), Ze = pe(b(() => `${o.value}-${l.value ?? "anonymous"}-confirmations`), "manual"), Qe = b(() => Te.value?.allowAutomatic === !0), $e = b(() => Qe.value && Ze.value === "automatic" ? "automatic" : "manual");
|
|
3688
|
+
function et(e) {
|
|
3689
|
+
Ze.value = e;
|
|
3690
3690
|
}
|
|
3691
|
-
let
|
|
3692
|
-
|
|
3693
|
-
e || (
|
|
3691
|
+
let tt = b(() => !!Ie.value && be.value?.pointer === !0 && D.value.length > 0);
|
|
3692
|
+
C(tt, (e) => {
|
|
3693
|
+
e || (Fe.value = void 0);
|
|
3694
3694
|
});
|
|
3695
|
-
let
|
|
3696
|
-
let e =
|
|
3697
|
-
return e && e !== te.Off &&
|
|
3695
|
+
let nt = pe(b(() => `${o.value}-pageNotice`), null), rt = b(() => {
|
|
3696
|
+
let e = be.value?.level;
|
|
3697
|
+
return e && e !== te.Off && D.value.length && !ie(nt.value ?? void 0, e) ? e : void 0;
|
|
3698
3698
|
});
|
|
3699
|
-
function
|
|
3700
|
-
|
|
3699
|
+
function it() {
|
|
3700
|
+
nt.value = be.value?.level ?? null;
|
|
3701
3701
|
}
|
|
3702
|
-
let
|
|
3703
|
-
function
|
|
3702
|
+
let at = x(), O = x(!1), ot = b(() => at.value?.message?.toLowerCase().includes("conversation-blocked") ?? !1);
|
|
3703
|
+
function st(e) {
|
|
3704
3704
|
try {
|
|
3705
3705
|
let t = JSON.parse(e.message);
|
|
3706
3706
|
return t.status === 404 || t.type?.includes("entity-not-found");
|
|
@@ -3708,99 +3708,99 @@ function di(e) {
|
|
|
3708
3708
|
return !1;
|
|
3709
3709
|
}
|
|
3710
3710
|
}
|
|
3711
|
-
function
|
|
3712
|
-
if (
|
|
3713
|
-
let e = B.value.messages.filter((e) => e.role === "user"), t = e[e.length - 1], n = t ?
|
|
3714
|
-
|
|
3711
|
+
function ct(e) {
|
|
3712
|
+
if (st(e)) {
|
|
3713
|
+
let e = B.value.messages.filter((e) => e.role === "user"), t = e[e.length - 1], n = t ? de(t) : void 0;
|
|
3714
|
+
E.value = ft(), at.value = void 0, ge(() => {
|
|
3715
3715
|
B.value.clearError(), n && B.value.sendMessage({ text: n });
|
|
3716
3716
|
});
|
|
3717
|
-
} else
|
|
3717
|
+
} else le.error(e), at.value = e, ot.value && (O.value = !0);
|
|
3718
3718
|
}
|
|
3719
|
-
let
|
|
3719
|
+
let k = b(() => ce({
|
|
3720
3720
|
baseUrl: i.value,
|
|
3721
3721
|
basePath: a.value,
|
|
3722
3722
|
headers: () => p.value
|
|
3723
|
-
})),
|
|
3724
|
-
...
|
|
3725
|
-
...
|
|
3726
|
-
}),
|
|
3727
|
-
let e =
|
|
3723
|
+
})), lt = x(null), ut = () => ({
|
|
3724
|
+
...Ee(),
|
|
3725
|
+
...lt.value ?? {}
|
|
3726
|
+
}), dt = () => {
|
|
3727
|
+
let e = Ve.value;
|
|
3728
3728
|
return new Promise((t) => {
|
|
3729
3729
|
let n = setTimeout(() => {
|
|
3730
3730
|
r(), t(!1);
|
|
3731
|
-
}, 3e4), r =
|
|
3731
|
+
}, 3e4), r = C(() => [Ve.value, B.value.status], ([i, a]) => {
|
|
3732
3732
|
i > e && a === "streaming" && (clearTimeout(n), r(), t(!0));
|
|
3733
3733
|
});
|
|
3734
3734
|
});
|
|
3735
|
-
},
|
|
3736
|
-
|
|
3735
|
+
}, A = S(), j = (e, t) => new Promise((n) => {
|
|
3736
|
+
A.value?.answer(!1), A.value = {
|
|
3737
3737
|
toolCallId: e.toolCallId,
|
|
3738
3738
|
question: t?.question,
|
|
3739
3739
|
details: t?.details,
|
|
3740
3740
|
unchanged: t?.unchanged,
|
|
3741
3741
|
answer: (e) => {
|
|
3742
|
-
|
|
3742
|
+
A.value = void 0, n(e);
|
|
3743
3743
|
}
|
|
3744
3744
|
};
|
|
3745
3745
|
});
|
|
3746
|
-
function
|
|
3747
|
-
|
|
3746
|
+
function pt(e) {
|
|
3747
|
+
A.value?.answer(e);
|
|
3748
3748
|
}
|
|
3749
|
-
let
|
|
3750
|
-
t.details?.some((e) => e.before !== void 0) && (
|
|
3751
|
-
...
|
|
3749
|
+
let mt = (e, t) => {
|
|
3750
|
+
t.details?.some((e) => e.before !== void 0) && (ze.value = {
|
|
3751
|
+
...ze.value,
|
|
3752
3752
|
[e.toolCallId]: {
|
|
3753
3753
|
details: t.details,
|
|
3754
3754
|
unchanged: t.unchanged
|
|
3755
3755
|
}
|
|
3756
3756
|
});
|
|
3757
|
-
},
|
|
3757
|
+
}, ht = ({ forms: e }) => be.value && D.value.length ? {
|
|
3758
3758
|
version: 1,
|
|
3759
|
-
features: [...
|
|
3760
|
-
forms: e ?
|
|
3759
|
+
features: [...ne],
|
|
3760
|
+
forms: e ? Ye().map(({ name: e, description: t, inputSchema: n, annotations: r }) => ({
|
|
3761
3761
|
name: e,
|
|
3762
3762
|
description: t,
|
|
3763
3763
|
inputSchema: n,
|
|
3764
3764
|
annotations: r
|
|
3765
3765
|
})) : []
|
|
3766
|
-
} : void 0,
|
|
3766
|
+
} : void 0, gt = (e) => {
|
|
3767
3767
|
if (e?.provider !== "page") {
|
|
3768
|
-
|
|
3768
|
+
w.value = void 0;
|
|
3769
3769
|
return;
|
|
3770
3770
|
}
|
|
3771
|
-
let t = [...
|
|
3771
|
+
let t = [...D.value, ...Ye()].find((t) => t.name === e.toolName), n;
|
|
3772
3772
|
try {
|
|
3773
3773
|
n = t?.describe?.(e.input);
|
|
3774
3774
|
} catch {
|
|
3775
3775
|
n = void 0;
|
|
3776
3776
|
}
|
|
3777
|
-
n && (
|
|
3778
|
-
...
|
|
3777
|
+
n && (Re.value = {
|
|
3778
|
+
...Re.value,
|
|
3779
3779
|
[e.toolCallId]: n
|
|
3780
|
-
}), e.readOnly ?
|
|
3781
|
-
},
|
|
3780
|
+
}), e.readOnly ? w.value = void 0 : (w.value = { title: n ?? t?.annotations?.title ?? e.toolName }, Be.value = !0);
|
|
3781
|
+
}, _t = Me({
|
|
3782
3782
|
registry: () => [
|
|
3783
|
-
...(
|
|
3784
|
-
...
|
|
3785
|
-
...
|
|
3783
|
+
...(me.value ?? []).filter((e) => !ee(e.name)),
|
|
3784
|
+
...D.value,
|
|
3785
|
+
...Ye()
|
|
3786
3786
|
],
|
|
3787
|
-
capability: () =>
|
|
3787
|
+
capability: () => se.value,
|
|
3788
3788
|
addToolOutput: (e) => void B.value.addToolOutput(e),
|
|
3789
|
-
confirm:
|
|
3790
|
-
waitForResume:
|
|
3789
|
+
confirm: j,
|
|
3790
|
+
waitForResume: dt,
|
|
3791
3791
|
onPendingChange: (e) => {
|
|
3792
|
-
|
|
3792
|
+
he.value = e;
|
|
3793
3793
|
},
|
|
3794
|
-
onActivity:
|
|
3795
|
-
mode: () =>
|
|
3796
|
-
onSkip:
|
|
3797
|
-
}),
|
|
3798
|
-
let n =
|
|
3799
|
-
|
|
3800
|
-
},
|
|
3801
|
-
registry: () =>
|
|
3802
|
-
capability: () =>
|
|
3803
|
-
addToolOutput: (e) =>
|
|
3794
|
+
onActivity: gt,
|
|
3795
|
+
mode: () => $e.value,
|
|
3796
|
+
onSkip: mt
|
|
3797
|
+
}), M = /* @__PURE__ */ new Map(), vt = 0, N = (e, t) => {
|
|
3798
|
+
let n = M.get(e);
|
|
3799
|
+
M.delete(e), n?.(JSON.stringify(t));
|
|
3800
|
+
}, yt = Me({
|
|
3801
|
+
registry: () => D.value,
|
|
3802
|
+
capability: () => se.value,
|
|
3803
|
+
addToolOutput: (e) => N(e.toolCallId, "output" in e ? e.output : {
|
|
3804
3804
|
content: [{
|
|
3805
3805
|
type: "text",
|
|
3806
3806
|
text: e.errorText
|
|
@@ -3808,29 +3808,29 @@ function di(e) {
|
|
|
3808
3808
|
isError: !0
|
|
3809
3809
|
}),
|
|
3810
3810
|
confirm: async (e, t) => {
|
|
3811
|
-
for (;
|
|
3812
|
-
let t =
|
|
3811
|
+
for (; A.value;) await new Promise((e) => {
|
|
3812
|
+
let t = C(A, (n) => {
|
|
3813
3813
|
n || (t(), e());
|
|
3814
3814
|
});
|
|
3815
3815
|
});
|
|
3816
|
-
return
|
|
3816
|
+
return M.has(e.toolCallId) ? j(e, t) : !1;
|
|
3817
3817
|
},
|
|
3818
3818
|
waitForResume: () => new Promise((e) => setTimeout(() => e(!0), qr)),
|
|
3819
3819
|
onPendingChange: (e) => {
|
|
3820
|
-
|
|
3820
|
+
ye.value = e;
|
|
3821
3821
|
},
|
|
3822
|
-
onActivity:
|
|
3823
|
-
mode: () =>
|
|
3824
|
-
}),
|
|
3825
|
-
function
|
|
3826
|
-
|
|
3827
|
-
let e =
|
|
3822
|
+
onActivity: gt,
|
|
3823
|
+
mode: () => bt
|
|
3824
|
+
}), bt = "manual";
|
|
3825
|
+
function xt() {
|
|
3826
|
+
bt = $e.value;
|
|
3827
|
+
let e = ht({ forms: !1 });
|
|
3828
3828
|
if (e) return {
|
|
3829
3829
|
declaration: e,
|
|
3830
|
-
clientTools: Object.fromEntries(
|
|
3831
|
-
|
|
3832
|
-
let r = `page-call-${
|
|
3833
|
-
|
|
3830
|
+
clientTools: Object.fromEntries(D.value.map((e) => [e.name, (t) => new Promise((n) => {
|
|
3831
|
+
vt += 1;
|
|
3832
|
+
let r = `page-call-${vt}`;
|
|
3833
|
+
M.set(r, n), yt.enqueue({
|
|
3834
3834
|
toolCallId: r,
|
|
3835
3835
|
toolName: e.name,
|
|
3836
3836
|
input: t ?? {},
|
|
@@ -3841,9 +3841,9 @@ function di(e) {
|
|
|
3841
3841
|
})]))
|
|
3842
3842
|
};
|
|
3843
3843
|
}
|
|
3844
|
-
function
|
|
3845
|
-
|
|
3846
|
-
for (let e of [...
|
|
3844
|
+
function P() {
|
|
3845
|
+
yt.cancelAll(), A.value && M.has(A.value.toolCallId) && A.value.answer(!1);
|
|
3846
|
+
for (let e of [...M.keys()]) N(e, {
|
|
3847
3847
|
content: [{
|
|
3848
3848
|
type: "text",
|
|
3849
3849
|
text: "Stopped by the user."
|
|
@@ -3851,34 +3851,34 @@ function di(e) {
|
|
|
3851
3851
|
isError: !0
|
|
3852
3852
|
});
|
|
3853
3853
|
}
|
|
3854
|
-
async function
|
|
3855
|
-
|
|
3854
|
+
async function St() {
|
|
3855
|
+
Ct(), P(), w.value = void 0, Be.value = !1, K.value = "", await B.value.stop();
|
|
3856
3856
|
}
|
|
3857
|
-
function
|
|
3858
|
-
|
|
3857
|
+
function Ct() {
|
|
3858
|
+
_t.cancelAll(), A.value && !M.has(A.value.toolCallId) && A.value.answer(!1);
|
|
3859
3859
|
}
|
|
3860
|
-
async function
|
|
3861
|
-
|
|
3860
|
+
async function wt(e) {
|
|
3861
|
+
Je.value = e, e && await St();
|
|
3862
3862
|
}
|
|
3863
|
-
|
|
3864
|
-
let
|
|
3863
|
+
C(E, () => Ct(), { flush: "sync" });
|
|
3864
|
+
let Tt = !1, F, Et = x(), Dt, Ot = x([]), I = x([]), L = x([]), R = x({}), kt = /* @__PURE__ */ new Map(), At = /* @__PURE__ */ new Set();
|
|
3865
3865
|
function jt(e, t, n) {
|
|
3866
|
-
|
|
3867
|
-
...
|
|
3866
|
+
I.value.includes(e) || (I.value = [...I.value, e]), kt.set(e, Date.now()), n ? At.add(e) : At.delete(e), t && (R.value = {
|
|
3867
|
+
...R.value,
|
|
3868
3868
|
[e]: t
|
|
3869
|
-
}),
|
|
3869
|
+
}), Z || Gn();
|
|
3870
3870
|
}
|
|
3871
3871
|
function z(e) {
|
|
3872
|
-
|
|
3872
|
+
R.value = Object.fromEntries(Object.entries(R.value).filter(([t]) => t !== e));
|
|
3873
3873
|
}
|
|
3874
3874
|
function Mt(e) {
|
|
3875
|
-
kt.delete(e),
|
|
3875
|
+
kt.delete(e), I.value = I.value.filter((t) => t !== e), L.value = L.value.filter((t) => t !== e), z(e);
|
|
3876
3876
|
}
|
|
3877
3877
|
let Nt = Gr(() => ({
|
|
3878
|
-
id:
|
|
3879
|
-
transport: new
|
|
3880
|
-
api:
|
|
3881
|
-
prepareReconnectToStreamRequest: ({ id: e }) => ({ api:
|
|
3878
|
+
id: E.value,
|
|
3879
|
+
transport: new hr({
|
|
3880
|
+
api: k.value.getChatEndpoint(o.value, T.value ? "reasoning" : "chat"),
|
|
3881
|
+
prepareReconnectToStreamRequest: ({ id: e }) => ({ api: k.value.getChatStreamEndpoint(o.value, e) }),
|
|
3882
3882
|
prepareSendMessagesRequest: ({ messages: e, id: t }) => ({ body: {
|
|
3883
3883
|
id: t,
|
|
3884
3884
|
messages: [e[e.length - 1]],
|
|
@@ -3893,26 +3893,26 @@ function di(e) {
|
|
|
3893
3893
|
reasoning: d.value?.reasoning,
|
|
3894
3894
|
webSearch: f.value?.webSearch,
|
|
3895
3895
|
smoothStream: u.value?.smoothStream,
|
|
3896
|
-
deviceContext:
|
|
3897
|
-
externalContext:
|
|
3896
|
+
deviceContext: ut(),
|
|
3897
|
+
externalContext: oe.value,
|
|
3898
3898
|
disabledTools: f.value?.disabled,
|
|
3899
3899
|
fallbackModels: y.value,
|
|
3900
|
-
gatewayOptions:
|
|
3901
|
-
hostTools:
|
|
3902
|
-
pageTools:
|
|
3903
|
-
|
|
3900
|
+
gatewayOptions: ae.value,
|
|
3901
|
+
hostTools: je(me.value, se.value),
|
|
3902
|
+
pageTools: ht({ forms: !0 }),
|
|
3903
|
+
...$e.value === "automatic" && { confirmations: "automatic" }
|
|
3904
3904
|
} }),
|
|
3905
3905
|
credentials: "include",
|
|
3906
3906
|
headers: () => p.value ?? {}
|
|
3907
3907
|
}),
|
|
3908
|
-
sendAutomaticallyWhen: (e) => ui(e) ||
|
|
3908
|
+
sendAutomaticallyWhen: (e) => ui(e) || _r(e),
|
|
3909
3909
|
onError: (e) => {
|
|
3910
|
-
|
|
3910
|
+
Tt ? le.warn(e) : ct(e);
|
|
3911
3911
|
},
|
|
3912
3912
|
onToolCall: ({ toolCall: e }) => {
|
|
3913
|
-
if (!
|
|
3913
|
+
if (!Ae(e) || Tt) return;
|
|
3914
3914
|
let t = e;
|
|
3915
|
-
|
|
3915
|
+
_t.enqueue({
|
|
3916
3916
|
toolCallId: t.toolCallId,
|
|
3917
3917
|
toolName: t.toolName,
|
|
3918
3918
|
input: t.input,
|
|
@@ -3922,31 +3922,31 @@ function di(e) {
|
|
|
3922
3922
|
});
|
|
3923
3923
|
},
|
|
3924
3924
|
onData: (e) => {
|
|
3925
|
-
e.type === "data-turnStream" ?
|
|
3925
|
+
e.type === "data-turnStream" ? Dt = e.data.streamId : e.type === "data-audioTranscripts" && (B.value.messages = ue(B.value.messages, e.data));
|
|
3926
3926
|
},
|
|
3927
3927
|
onFinish: () => {
|
|
3928
|
-
let e =
|
|
3929
|
-
!
|
|
3928
|
+
let e = E.value;
|
|
3929
|
+
!T.value && !U.value.some((t) => t.id === e) && dn(o.value);
|
|
3930
3930
|
}
|
|
3931
|
-
})), B =
|
|
3932
|
-
|
|
3933
|
-
if (t && !
|
|
3931
|
+
})), B = b(() => ve(Nt)), Pt = () => B.value.messages[B.value.messages.length - 1];
|
|
3932
|
+
C(E, (e, t) => {
|
|
3933
|
+
if (t && !T.value && (J() || F?.chatId === t)) {
|
|
3934
3934
|
let e = B.value.messages.filter((e) => e.role === "user"), n = e[e.length - 1];
|
|
3935
|
-
jt(t, n ?
|
|
3935
|
+
jt(t, n ? de(n) ?? "" : "", B.value.status === "streaming" || F?.chatId === t);
|
|
3936
3936
|
}
|
|
3937
|
-
Mt(e),
|
|
3937
|
+
Mt(e), Dt = void 0, clearTimeout(zn), Rn.value = !1, B.value.stop();
|
|
3938
3938
|
}, { flush: "sync" });
|
|
3939
|
-
let V =
|
|
3939
|
+
let V = b(() => {
|
|
3940
3940
|
let e = u.value?.initialMessage;
|
|
3941
3941
|
return e?.[r.value] ? e[r.value] : n("message.defaultAgentWelcome") ? t("message.defaultAgentWelcome") : "";
|
|
3942
|
-
}), H =
|
|
3942
|
+
}), H = ft(), Ft = b(() => ({
|
|
3943
3943
|
id: H,
|
|
3944
3944
|
role: "assistant",
|
|
3945
3945
|
parts: [{
|
|
3946
3946
|
type: "text",
|
|
3947
3947
|
text: V.value
|
|
3948
3948
|
}]
|
|
3949
|
-
})), It =
|
|
3949
|
+
})), It = b(() => {
|
|
3950
3950
|
let e = (e) => e.map((e) => e.role !== "user" || !e.parts.some((e) => e.type === "file") ? e : {
|
|
3951
3951
|
...e,
|
|
3952
3952
|
parts: e.parts.map((e) => {
|
|
@@ -3956,50 +3956,50 @@ function di(e) {
|
|
|
3956
3956
|
let e = t.url.slice(13);
|
|
3957
3957
|
return {
|
|
3958
3958
|
...t,
|
|
3959
|
-
url:
|
|
3959
|
+
url: k.value.getMediaUrl(o.value, E.value, e)
|
|
3960
3960
|
};
|
|
3961
3961
|
}
|
|
3962
3962
|
return t.url.startsWith("blob:") ? t : {
|
|
3963
3963
|
...t,
|
|
3964
|
-
url:
|
|
3964
|
+
url: k.value.appendAuthToken(t.url)
|
|
3965
3965
|
};
|
|
3966
3966
|
})
|
|
3967
|
-
}), t = B.value.id ===
|
|
3968
|
-
return
|
|
3969
|
-
}), Lt =
|
|
3967
|
+
}), t = B.value.id === E.value ? B.value.messages : [];
|
|
3968
|
+
return T.value ? e(t) : !Ue.value && t[0]?.role !== "assistant" ? [Ft.value, ...e(t)] : e(t);
|
|
3969
|
+
}), Lt = b(() => {
|
|
3970
3970
|
let e = u.value?.messagePlaceholder;
|
|
3971
3971
|
return e?.[r.value] ? e[r.value] : n("placeholder.askAnything") ? t("placeholder.askAnything") : "";
|
|
3972
|
-
}), U =
|
|
3973
|
-
function
|
|
3974
|
-
let n = Object.fromEntries(Object.entries(
|
|
3975
|
-
|
|
3972
|
+
}), U = x([]), Rt = x(!1), zt = x(1), Bt = x(!1), Vt = x(!1), Ht, Ut = x([]), Wt = x(!1), Gt = x("chat"), Kt = x(0), qt = x([]), Jt = x(), Yt = x(!1), Xt = x(!1), Zt = x(), Qt = x(!1), $t = x(!1), en = x(), W = x(""), G = x([]), K = x(""), q = S(), tn = x(0), nn = fe(b(() => `${o.value}-queue`), {}), rn = b(() => nn.value[E.value] ?? []), an = b(() => !T.value);
|
|
3973
|
+
function on(e, t) {
|
|
3974
|
+
let n = Object.fromEntries(Object.entries(nn.value).filter(([t]) => t !== e));
|
|
3975
|
+
nn.value = t.length > 0 ? {
|
|
3976
3976
|
...n,
|
|
3977
3977
|
[e]: t
|
|
3978
3978
|
} : n;
|
|
3979
3979
|
}
|
|
3980
|
-
function on(e) {
|
|
3981
|
-
let t = (tn.value[e] ?? []).join(si);
|
|
3982
|
-
return an(e, []), t;
|
|
3983
|
-
}
|
|
3984
3980
|
function sn(e) {
|
|
3985
|
-
|
|
3981
|
+
let t = (nn.value[e] ?? []).join(si);
|
|
3982
|
+
return on(e, []), t;
|
|
3986
3983
|
}
|
|
3987
3984
|
function cn(e) {
|
|
3988
|
-
|
|
3985
|
+
e && (W.value = W.value ? `${W.value}${si}${e}` : e);
|
|
3989
3986
|
}
|
|
3990
3987
|
function ln(e) {
|
|
3991
|
-
|
|
3992
|
-
|
|
3988
|
+
on(E.value, rn.value.filter((t, n) => n !== e));
|
|
3989
|
+
}
|
|
3990
|
+
function un(e) {
|
|
3991
|
+
let t = rn.value[e];
|
|
3992
|
+
ln(e), cn(t ?? "");
|
|
3993
3993
|
}
|
|
3994
|
-
async function
|
|
3995
|
-
if (
|
|
3994
|
+
async function dn(e) {
|
|
3995
|
+
if (T.value) U.value = [];
|
|
3996
3996
|
else {
|
|
3997
3997
|
Rt.value = !0;
|
|
3998
3998
|
try {
|
|
3999
|
-
let t = await
|
|
3999
|
+
let t = await k.value.getConversations(e, l.value), n = new Set(t.map((e) => e.id)), r = I.value.filter((e) => !n.has(e) && R.value[e]).map((t) => ({
|
|
4000
4000
|
id: t,
|
|
4001
4001
|
agentId: e,
|
|
4002
|
-
title:
|
|
4002
|
+
title: R.value[t],
|
|
4003
4003
|
summary: null,
|
|
4004
4004
|
messages: [],
|
|
4005
4005
|
lastMessageAt: /* @__PURE__ */ new Date()
|
|
@@ -4017,15 +4017,15 @@ function di(e) {
|
|
|
4017
4017
|
} finally {
|
|
4018
4018
|
Rt.value = !1;
|
|
4019
4019
|
}
|
|
4020
|
-
|
|
4020
|
+
Kn([.../* @__PURE__ */ new Set([...Vn(), ...U.value.map((e) => e.id)])]);
|
|
4021
4021
|
}
|
|
4022
4022
|
}
|
|
4023
|
-
async function
|
|
4024
|
-
if (!Bt.value || Vt.value ||
|
|
4023
|
+
async function fn() {
|
|
4024
|
+
if (!Bt.value || Vt.value || T.value) return;
|
|
4025
4025
|
Vt.value = !0;
|
|
4026
4026
|
let e = Ht;
|
|
4027
4027
|
try {
|
|
4028
|
-
let t = zt.value + 1, n = await
|
|
4028
|
+
let t = zt.value + 1, n = await k.value.getConversations(o.value, l.value, { page: t });
|
|
4029
4029
|
if (e !== Ht) return;
|
|
4030
4030
|
let r = new Set(U.value.map((e) => e.id));
|
|
4031
4031
|
U.value = [...U.value, ...n.filter((e) => !r.has(e.id))], zt.value = t, Bt.value = n.length >= 100;
|
|
@@ -4033,60 +4033,60 @@ function di(e) {
|
|
|
4033
4033
|
Vt.value = !1;
|
|
4034
4034
|
}
|
|
4035
4035
|
}
|
|
4036
|
-
async function
|
|
4037
|
-
return
|
|
4036
|
+
async function pn(e) {
|
|
4037
|
+
return T.value ? [] : k.value.getConversations(o.value, l.value, { search: e });
|
|
4038
4038
|
}
|
|
4039
|
-
async function
|
|
4040
|
-
let e =
|
|
4041
|
-
if (!e)
|
|
4039
|
+
async function mn() {
|
|
4040
|
+
let e = E.value;
|
|
4041
|
+
if (!e) Ut.value = [];
|
|
4042
4042
|
else {
|
|
4043
|
-
|
|
4043
|
+
Wt.value = !0;
|
|
4044
4044
|
try {
|
|
4045
|
-
|
|
4045
|
+
Ut.value = await k.value.getChatFiles(e);
|
|
4046
4046
|
} catch {
|
|
4047
|
-
|
|
4047
|
+
Ut.value = [];
|
|
4048
4048
|
} finally {
|
|
4049
|
-
|
|
4049
|
+
Wt.value = !1;
|
|
4050
4050
|
}
|
|
4051
4051
|
}
|
|
4052
4052
|
}
|
|
4053
|
-
function
|
|
4054
|
-
return
|
|
4053
|
+
function hn(e, t = !1) {
|
|
4054
|
+
return k.value.getChatFileDownloadUrl(e, t);
|
|
4055
4055
|
}
|
|
4056
|
-
function
|
|
4057
|
-
return
|
|
4056
|
+
function gn(e) {
|
|
4057
|
+
return k.value.getChatFilePreviewUrl(e);
|
|
4058
4058
|
}
|
|
4059
|
-
async function
|
|
4060
|
-
await
|
|
4061
|
-
let t =
|
|
4062
|
-
|
|
4059
|
+
async function _n(e) {
|
|
4060
|
+
await k.value.deleteChatFile(e);
|
|
4061
|
+
let t = Ut.value.find((t) => t.documentId === e), n = t?.kind === "spreadsheet" ? t.sourceAttachmentId ?? t.documentId : void 0;
|
|
4062
|
+
Ut.value = Ut.value.filter((t) => t.documentId !== e && (!n || t.documentId !== n && t.sourceAttachmentId !== n));
|
|
4063
4063
|
}
|
|
4064
|
-
async function
|
|
4065
|
-
if (!
|
|
4066
|
-
let n = await
|
|
4067
|
-
if (t !==
|
|
4068
|
-
n && (B.value.messages = n.messages,
|
|
4064
|
+
async function vn(e, t) {
|
|
4065
|
+
if (!T.value) try {
|
|
4066
|
+
let n = await k.value.getChat(e, t);
|
|
4067
|
+
if (t !== E.value || B.value.status !== "ready" || B.value.messages.length > 0) return;
|
|
4068
|
+
n && (B.value.messages = n.messages, O.value = n.blocked ?? !1, yn(e, t, n.turnInProgress === !0));
|
|
4069
4069
|
} catch {}
|
|
4070
4070
|
}
|
|
4071
|
-
async function
|
|
4072
|
-
n && (await
|
|
4071
|
+
async function yn(e, t, n) {
|
|
4072
|
+
n && (await bn(t), t !== E.value || J()) || (await xn(e, t), t === E.value && await Tn());
|
|
4073
4073
|
}
|
|
4074
|
-
async function
|
|
4074
|
+
async function bn(e) {
|
|
4075
4075
|
let t = { chatId: e };
|
|
4076
|
-
|
|
4077
|
-
let n = () =>
|
|
4076
|
+
F = t, Et.value = e;
|
|
4077
|
+
let n = () => F === t && e === E.value, r = Date.now() + $r;
|
|
4078
4078
|
try {
|
|
4079
|
-
for (; n() && !
|
|
4080
|
-
|
|
4079
|
+
for (; n() && !J() && Date.now() < r;) {
|
|
4080
|
+
Tt = !0;
|
|
4081
4081
|
try {
|
|
4082
4082
|
await B.value.resumeStream();
|
|
4083
4083
|
} finally {
|
|
4084
|
-
|
|
4084
|
+
Tt = !1;
|
|
4085
4085
|
}
|
|
4086
4086
|
if (!n()) return;
|
|
4087
4087
|
B.value.clearError();
|
|
4088
|
-
let t = await
|
|
4089
|
-
if (!t || !n() ||
|
|
4088
|
+
let t = await k.value.getChat(o.value, e).catch(() => null);
|
|
4089
|
+
if (!t || !n() || J()) return;
|
|
4090
4090
|
if (!t.turnInProgress) {
|
|
4091
4091
|
B.value.messages = t.messages;
|
|
4092
4092
|
return;
|
|
@@ -4094,22 +4094,22 @@ function di(e) {
|
|
|
4094
4094
|
await new Promise((e) => setTimeout(e, ei));
|
|
4095
4095
|
}
|
|
4096
4096
|
} finally {
|
|
4097
|
-
|
|
4097
|
+
F === t && (F = void 0, Et.value = void 0);
|
|
4098
4098
|
}
|
|
4099
4099
|
}
|
|
4100
|
-
async function
|
|
4100
|
+
async function xn(e, t) {
|
|
4101
4101
|
let n;
|
|
4102
4102
|
try {
|
|
4103
|
-
n = Number(sessionStorage.getItem(
|
|
4103
|
+
n = Number(sessionStorage.getItem(Oe)), sessionStorage.removeItem(Oe);
|
|
4104
4104
|
} catch {
|
|
4105
4105
|
return;
|
|
4106
4106
|
}
|
|
4107
|
-
if (!(!n || Date.now() - n > 6e4 ||
|
|
4107
|
+
if (!(!n || Date.now() - n > 6e4 || Je.value)) for (let n = 0; n < 12; n++) {
|
|
4108
4108
|
let n = B.value.messages[B.value.messages.length - 1];
|
|
4109
4109
|
if (n?.role === "assistant") {
|
|
4110
|
-
let e = n.parts.filter((e) =>
|
|
4110
|
+
let e = n.parts.filter((e) => re(e) && e.state === "input-available"), t = e.filter((e) => e.toolMetadata?.provider === "page" && e.toolMetadata.readOnly === !0);
|
|
4111
4111
|
if (e.length > 0) {
|
|
4112
|
-
if (t.length === e.length && !
|
|
4112
|
+
if (t.length === e.length && !Je.value) for (let e of t) _t.enqueue({
|
|
4113
4113
|
toolCallId: e.toolCallId,
|
|
4114
4114
|
toolName: e.toolName,
|
|
4115
4115
|
input: e.input,
|
|
@@ -4121,99 +4121,99 @@ function di(e) {
|
|
|
4121
4121
|
}
|
|
4122
4122
|
if (n.parts[n.parts.length - 1]?.type === "text") return;
|
|
4123
4123
|
}
|
|
4124
|
-
if (await new Promise((e) => setTimeout(e, 1500)), t !==
|
|
4124
|
+
if (await new Promise((e) => setTimeout(e, 1500)), t !== E.value || B.value.status !== "ready") return;
|
|
4125
4125
|
try {
|
|
4126
|
-
let n = await
|
|
4127
|
-
n && t ===
|
|
4126
|
+
let n = await k.value.getChat(e, t);
|
|
4127
|
+
n && t === E.value && (B.value.messages = n.messages);
|
|
4128
4128
|
} catch {
|
|
4129
4129
|
return;
|
|
4130
4130
|
}
|
|
4131
4131
|
}
|
|
4132
4132
|
}
|
|
4133
|
-
let
|
|
4133
|
+
let J = () => {
|
|
4134
4134
|
let e = B.value.status;
|
|
4135
4135
|
return e === "submitted" || e === "streaming";
|
|
4136
|
-
},
|
|
4136
|
+
}, Sn = () => J() || F?.chatId === E.value || he.value > 0, Cn = () => {
|
|
4137
4137
|
let e = Pt();
|
|
4138
|
-
return
|
|
4139
|
-
},
|
|
4140
|
-
async function
|
|
4141
|
-
let e =
|
|
4142
|
-
if (!(
|
|
4143
|
-
if (
|
|
4138
|
+
return A.value !== void 0 || Jr(e) || li(e);
|
|
4139
|
+
}, wn = /* @__PURE__ */ new Set();
|
|
4140
|
+
async function Tn() {
|
|
4141
|
+
let e = E.value;
|
|
4142
|
+
if (!(wn.has(e) || rn.value.length === 0 || Sn() || at.value)) {
|
|
4143
|
+
if (Cn()) cn(sn(e));
|
|
4144
4144
|
else {
|
|
4145
|
-
|
|
4145
|
+
wn.add(e);
|
|
4146
4146
|
try {
|
|
4147
4147
|
let t = Date.now() + ii;
|
|
4148
|
-
for (; Date.now() < t && (await Promise.race([
|
|
4149
|
-
if (e !==
|
|
4150
|
-
let n =
|
|
4151
|
-
n &&
|
|
4148
|
+
for (; Date.now() < t && (await Promise.race([k.value.getRunningTurns(o.value, [e]).catch(() => []), new Promise((t) => setTimeout(() => t([e]), oi))])).includes(e);) await new Promise((e) => setTimeout(e, ai));
|
|
4149
|
+
if (e !== E.value || Sn()) return;
|
|
4150
|
+
let n = sn(e);
|
|
4151
|
+
n && Pn(n);
|
|
4152
4152
|
} finally {
|
|
4153
|
-
|
|
4153
|
+
wn.delete(e);
|
|
4154
4154
|
}
|
|
4155
4155
|
}
|
|
4156
4156
|
}
|
|
4157
4157
|
}
|
|
4158
|
-
let
|
|
4159
|
-
async function
|
|
4160
|
-
if (
|
|
4161
|
-
let e =
|
|
4158
|
+
let En = 0, Dn = 0;
|
|
4159
|
+
async function On() {
|
|
4160
|
+
if (T.value || J()) return "indeterminate";
|
|
4161
|
+
let e = E.value, t = En += 1;
|
|
4162
4162
|
try {
|
|
4163
|
-
let n = await
|
|
4164
|
-
if (!n || e !==
|
|
4165
|
-
|
|
4163
|
+
let n = await k.value.getChat(o.value, e);
|
|
4164
|
+
if (!n || e !== E.value || J() || t <= Dn) return "indeterminate";
|
|
4165
|
+
Dn = t;
|
|
4166
4166
|
let r = n.messages, i = Qr(r, B.value.messages);
|
|
4167
|
-
return B.value.messages = [...r, ...i],
|
|
4167
|
+
return B.value.messages = [...r, ...i], O.value = n.blocked ?? !1, i.length > 0 ? "pending" : "caught-up";
|
|
4168
4168
|
} catch {}
|
|
4169
4169
|
return "indeterminate";
|
|
4170
4170
|
}
|
|
4171
|
-
function
|
|
4171
|
+
function kn(e) {
|
|
4172
4172
|
B.value.messages = [...B.value.messages, e];
|
|
4173
4173
|
}
|
|
4174
|
-
async function
|
|
4174
|
+
async function Y(e) {
|
|
4175
4175
|
try {
|
|
4176
|
-
|
|
4176
|
+
qt.value = await k.value.getMessageFeedbacks(e);
|
|
4177
4177
|
} catch {
|
|
4178
|
-
|
|
4178
|
+
qt.value = [];
|
|
4179
4179
|
}
|
|
4180
4180
|
}
|
|
4181
|
-
function
|
|
4182
|
-
let t =
|
|
4183
|
-
t >= 0 ?
|
|
4181
|
+
function An(e) {
|
|
4182
|
+
let t = qt.value.findIndex((t) => t.messageId === e.messageId);
|
|
4183
|
+
t >= 0 ? qt.value[t] = e : qt.value.push(e);
|
|
4184
4184
|
}
|
|
4185
|
-
function
|
|
4186
|
-
let t = It.value, n = t.findIndex((t) => t.id === e.id), r =
|
|
4185
|
+
function X(e) {
|
|
4186
|
+
let t = It.value, n = t.findIndex((t) => t.id === e.id), r = de(e) ?? "", i = t.slice(0, n).reverse().find((e) => e.role === "user");
|
|
4187
4187
|
return {
|
|
4188
|
-
userQuestion:
|
|
4188
|
+
userQuestion: de(i ?? e) ?? "",
|
|
4189
4189
|
assistantMessage: r
|
|
4190
4190
|
};
|
|
4191
4191
|
}
|
|
4192
|
-
async function
|
|
4192
|
+
async function jn(e, t) {
|
|
4193
4193
|
await Promise.all([
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
]),
|
|
4198
|
-
e && (
|
|
4194
|
+
vn(e, t),
|
|
4195
|
+
dn(e),
|
|
4196
|
+
Y(t)
|
|
4197
|
+
]), lt.value || De((e, t) => k.value.reverseGeocode(e, t, r.value)).then((e) => {
|
|
4198
|
+
e && (lt.value = e);
|
|
4199
4199
|
});
|
|
4200
4200
|
}
|
|
4201
|
-
async function
|
|
4202
|
-
let e =
|
|
4201
|
+
async function Mn() {
|
|
4202
|
+
let e = W.value.trim(), t = G.value.filter((e) => e.state === "done" && e.mediaSource !== void 0).map((e) => ({
|
|
4203
4203
|
type: "file",
|
|
4204
4204
|
mediaType: e.mediaSource.mimeType,
|
|
4205
4205
|
url: e.localUrl,
|
|
4206
4206
|
filename: e.mediaSource.name,
|
|
4207
4207
|
providerMetadata: { "8bot": { media: e.mediaSource } }
|
|
4208
|
-
})), n =
|
|
4209
|
-
!
|
|
4208
|
+
})), n = tt.value ? Fe.value : void 0;
|
|
4209
|
+
!T.value && Sn() ? e && t.length === 0 && !n && (on(E.value, [...rn.value, e]), W.value = "") : (T.value && It.value.length > 0 && await Zn(), Pn(e, t, n && { pagePointer: n }), W.value = "", Fe.value = void 0, Xn());
|
|
4210
4210
|
}
|
|
4211
|
-
function
|
|
4211
|
+
function Nn(e, t) {
|
|
4212
4212
|
let n = e.trim();
|
|
4213
|
-
return !n ||
|
|
4213
|
+
return !n || O.value || Sn() || B.value.status !== "ready" ? !1 : (Pn(n, [], t, { rollback: !1 }), !0);
|
|
4214
4214
|
}
|
|
4215
|
-
function
|
|
4216
|
-
|
|
4215
|
+
function Pn(e, t = [], n, { rollback: r = !0 } = {}) {
|
|
4216
|
+
Ct(), K.value = r ? e : "", q.value = r && n && "pagePointer" in n ? n.pagePointer : void 0, tn.value = B.value.messages.length;
|
|
4217
4217
|
let i = B.value.sendMessage;
|
|
4218
4218
|
i({
|
|
4219
4219
|
text: e,
|
|
@@ -4221,132 +4221,132 @@ function di(e) {
|
|
|
4221
4221
|
...n && { metadata: n }
|
|
4222
4222
|
});
|
|
4223
4223
|
}
|
|
4224
|
-
function
|
|
4224
|
+
function Fn(e) {
|
|
4225
4225
|
let t = e.trim();
|
|
4226
4226
|
if (!t) return;
|
|
4227
4227
|
if (B.value.status !== "ready") {
|
|
4228
|
-
|
|
4228
|
+
le.warn("[useChatbotStore] sendMessage called before chat is ready. Listen for the \"ready\" event on the widget element.");
|
|
4229
4229
|
return;
|
|
4230
4230
|
}
|
|
4231
4231
|
let n = B.value.sendMessage;
|
|
4232
|
-
|
|
4232
|
+
Ct(), n({ text: t });
|
|
4233
4233
|
}
|
|
4234
|
-
async function
|
|
4235
|
-
let e = B.value.messages.slice(
|
|
4236
|
-
|
|
4234
|
+
async function In() {
|
|
4235
|
+
let e = B.value.messages.slice(tn.value).some((e) => e.parts.some(re)), t = K.value, n = q.value, r = t.length > 0 && !e, i = E.value, a = tn.value, s = F?.chatId === i, c = Dt, l = sn(i), u = (e = "") => {
|
|
4236
|
+
W.value = [
|
|
4237
4237
|
e,
|
|
4238
4238
|
l,
|
|
4239
|
-
|
|
4239
|
+
W.value
|
|
4240
4240
|
].filter(Boolean).join(si);
|
|
4241
|
-
}, d = () => i ===
|
|
4242
|
-
|
|
4243
|
-
let f =
|
|
4241
|
+
}, d = () => i === E.value && !J() && tn.value === a ? !1 : (l && on(i, [l, ...nn.value[i] ?? []]), !0);
|
|
4242
|
+
F = void 0, Et.value = void 0, Ct(), await B.value.stop();
|
|
4243
|
+
let f = T.value || e && !s || await k.value.stopChatTurn(o.value, i, c).catch(() => !0);
|
|
4244
4244
|
if (!d()) {
|
|
4245
4245
|
if (s || !f) {
|
|
4246
|
-
if (await
|
|
4247
|
-
if (s || B.value.messages.length >
|
|
4248
|
-
|
|
4246
|
+
if (await On(), d()) return;
|
|
4247
|
+
if (s || B.value.messages.length > tn.value) {
|
|
4248
|
+
K.value = "", u();
|
|
4249
4249
|
return;
|
|
4250
4250
|
}
|
|
4251
4251
|
}
|
|
4252
|
-
r ? (u(t),
|
|
4252
|
+
r ? (u(t), Fe.value ??= n, B.value.messages = B.value.messages.slice(0, tn.value), K.value = "") : u();
|
|
4253
4253
|
}
|
|
4254
4254
|
}
|
|
4255
|
-
|
|
4256
|
-
let t =
|
|
4257
|
-
t && !
|
|
4258
|
-
}),
|
|
4259
|
-
e === "submitted" && (
|
|
4255
|
+
C(() => B.value.messages, (e) => {
|
|
4256
|
+
let t = A.value?.toolCallId;
|
|
4257
|
+
t && !M.has(t) && !e.some((e) => e.parts.some((e) => e.toolCallId === t)) && Ct();
|
|
4258
|
+
}), C(() => B.value.status, (e) => {
|
|
4259
|
+
e === "submitted" && (Ve.value++, Dt = void 0);
|
|
4260
4260
|
});
|
|
4261
|
-
let
|
|
4262
|
-
|
|
4261
|
+
let Ln;
|
|
4262
|
+
C(() => [
|
|
4263
4263
|
B.value.status,
|
|
4264
|
-
|
|
4265
|
-
|
|
4264
|
+
he.value,
|
|
4265
|
+
ye.value
|
|
4266
4266
|
], ([e, t, n]) => {
|
|
4267
|
-
clearTimeout(
|
|
4268
|
-
|
|
4267
|
+
clearTimeout(Ln), e === "ready" && t === 0 && n === 0 && (Ln = setTimeout(() => {
|
|
4268
|
+
Be.value = !1;
|
|
4269
4269
|
}, 1500));
|
|
4270
4270
|
});
|
|
4271
|
-
let
|
|
4272
|
-
|
|
4273
|
-
clearTimeout(
|
|
4274
|
-
|
|
4271
|
+
let Rn = x(!1), zn;
|
|
4272
|
+
C(() => !A.value && !Jr(Pt()) && (J() || he.value > 0), (e) => {
|
|
4273
|
+
clearTimeout(zn), e ? Rn.value = !0 : zn = setTimeout(() => {
|
|
4274
|
+
Rn.value = !1;
|
|
4275
4275
|
}, 400);
|
|
4276
4276
|
}, { immediate: !0 });
|
|
4277
|
-
let
|
|
4278
|
-
let e =
|
|
4279
|
-
return
|
|
4280
|
-
}),
|
|
4281
|
-
function
|
|
4282
|
-
clearTimeout(
|
|
4283
|
-
|
|
4277
|
+
let Bn = b(() => {
|
|
4278
|
+
let e = Ot.value.filter((e) => e !== E.value);
|
|
4279
|
+
return Rn.value || Et.value === E.value ? [...e, E.value] : e;
|
|
4280
|
+
}), Vn = () => [.../* @__PURE__ */ new Set([...Ot.value, ...I.value])], Hn = Ce(), Z, Un = 0, Wn = 0;
|
|
4281
|
+
function Gn() {
|
|
4282
|
+
clearTimeout(Z), Z = void 0, Vn().length !== 0 && Hn.value === "visible" && (Z = setTimeout(() => {
|
|
4283
|
+
Z = void 0, Kn(Vn());
|
|
4284
4284
|
}, ti));
|
|
4285
4285
|
}
|
|
4286
|
-
async function
|
|
4286
|
+
async function Kn(e) {
|
|
4287
4287
|
let t = e.slice(0, ni);
|
|
4288
|
-
if (
|
|
4289
|
-
|
|
4288
|
+
if (T.value || t.length === 0) {
|
|
4289
|
+
Gn();
|
|
4290
4290
|
return;
|
|
4291
4291
|
}
|
|
4292
|
-
let n =
|
|
4292
|
+
let n = Un += 1, r;
|
|
4293
4293
|
try {
|
|
4294
|
-
r = await
|
|
4294
|
+
r = await k.value.getRunningTurns(o.value, t);
|
|
4295
4295
|
} catch {
|
|
4296
|
-
|
|
4296
|
+
Gn();
|
|
4297
4297
|
return;
|
|
4298
4298
|
}
|
|
4299
|
-
if (n <=
|
|
4300
|
-
|
|
4299
|
+
if (n <= Wn) return;
|
|
4300
|
+
Wn = n;
|
|
4301
4301
|
for (let e of r) At.add(e);
|
|
4302
|
-
let i = new Set(t), a =
|
|
4303
|
-
|
|
4304
|
-
let u = l.filter((e) =>
|
|
4305
|
-
(u.length > 0 || c.length > 0) && (
|
|
4302
|
+
let i = new Set(t), a = Vn().filter((e) => i.has(e) && !r.includes(e)), s = (e) => I.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));
|
|
4303
|
+
Ot.value = [...Ot.value.filter((e) => !i.has(e)), ...r];
|
|
4304
|
+
let u = l.filter((e) => I.value.includes(e));
|
|
4305
|
+
(u.length > 0 || c.length > 0) && (I.value = I.value.filter((e) => !u.includes(e) && !c.includes(e)), L.value = [...L.value, ...u.filter((e) => e !== E.value && !L.value.includes(e))]), l.length > 0 && dn(o.value), Gn();
|
|
4306
4306
|
}
|
|
4307
|
-
|
|
4308
|
-
e === "visible" ?
|
|
4309
|
-
}),
|
|
4310
|
-
let
|
|
4307
|
+
C(Hn, (e) => {
|
|
4308
|
+
e === "visible" ? Kn(Vn()) : (clearTimeout(Z), Z = void 0);
|
|
4309
|
+
}), _e(() => clearTimeout(Z));
|
|
4310
|
+
let qn = b(() => L.value.map((e) => ({
|
|
4311
4311
|
chatId: e,
|
|
4312
|
-
title: U.value.find((t) => t.id === e)?.title ||
|
|
4312
|
+
title: U.value.find((t) => t.id === e)?.title || R.value[e] || void 0
|
|
4313
4313
|
})));
|
|
4314
|
-
function qn(e) {
|
|
4315
|
-
Mt(e), D.value = e, _r("chat");
|
|
4316
|
-
}
|
|
4317
4314
|
function Jn(e) {
|
|
4318
|
-
|
|
4315
|
+
Mt(e), E.value = e, br("chat");
|
|
4319
4316
|
}
|
|
4320
|
-
|
|
4317
|
+
function Yn(e) {
|
|
4318
|
+
L.value = L.value.filter((t) => t !== e), z(e);
|
|
4319
|
+
}
|
|
4320
|
+
C(() => [B.value.status, B.value.id], ([e, t], [n, r]) => {
|
|
4321
4321
|
if (t === r) {
|
|
4322
|
-
if (e === "error")
|
|
4322
|
+
if (e === "error") F?.chatId !== E.value && cn(sn(E.value));
|
|
4323
4323
|
else if (e === "ready" && (n === "streaming" || n === "submitted")) {
|
|
4324
|
-
if (
|
|
4325
|
-
sn(
|
|
4324
|
+
if (Cn()) {
|
|
4325
|
+
cn(sn(E.value));
|
|
4326
4326
|
return;
|
|
4327
4327
|
}
|
|
4328
|
-
|
|
4328
|
+
Tn();
|
|
4329
4329
|
}
|
|
4330
4330
|
}
|
|
4331
|
-
}),
|
|
4332
|
-
e === 0 && B.value.status === "ready" &&
|
|
4333
|
-
}),
|
|
4334
|
-
e === "ready" &&
|
|
4331
|
+
}), C(he, (e) => {
|
|
4332
|
+
e === 0 && B.value.status === "ready" && Tn();
|
|
4333
|
+
}), C(() => B.value.status, (e) => {
|
|
4334
|
+
e === "ready" && K.value.length > 0 && (K.value = "");
|
|
4335
4335
|
});
|
|
4336
|
-
function
|
|
4337
|
-
for (let t of
|
|
4338
|
-
|
|
4336
|
+
function Xn(e = !1) {
|
|
4337
|
+
for (let t of G.value) (e || t.state !== "done") && URL.revokeObjectURL(t.localUrl);
|
|
4338
|
+
G.value = [], ar.value = null;
|
|
4339
4339
|
}
|
|
4340
|
-
async function
|
|
4341
|
-
return
|
|
4340
|
+
async function Zn() {
|
|
4341
|
+
return K.value = "", Re.value = {}, ze.value = {}, E.value = ft(), await ge(), B.value.clearError(), at.value = void 0, O.value = !1, Xn(!0), br("chat"), E.value;
|
|
4342
4342
|
}
|
|
4343
|
-
async function
|
|
4344
|
-
B.value.status !== "ready" && (
|
|
4343
|
+
async function Qn(e) {
|
|
4344
|
+
B.value.status !== "ready" && (K.value = "", await In()), Ct(), await B.value.regenerate(e);
|
|
4345
4345
|
}
|
|
4346
|
-
function
|
|
4346
|
+
function $n(e) {
|
|
4347
4347
|
if (e.tool === "requestGeolocation") {
|
|
4348
4348
|
let t = e.output;
|
|
4349
|
-
"latitude" in t && (
|
|
4349
|
+
"latitude" in t && (lt.value = {
|
|
4350
4350
|
geolocationLatitude: t.latitude,
|
|
4351
4351
|
geolocationLongitude: t.longitude,
|
|
4352
4352
|
geolocationAccuracy: t.accuracy,
|
|
@@ -4355,129 +4355,141 @@ function di(e) {
|
|
|
4355
4355
|
}
|
|
4356
4356
|
B.value.addToolOutput(e);
|
|
4357
4357
|
}
|
|
4358
|
-
function
|
|
4358
|
+
function er(e) {
|
|
4359
4359
|
B.value.addToolApprovalResponse(e);
|
|
4360
4360
|
}
|
|
4361
|
-
let
|
|
4362
|
-
|
|
4361
|
+
let tr = b(() => B.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), nr = b(() => _.value?.maxFilesPerMessage ?? 5), rr = b(() => _.value?.maxFilesPerChat ?? 20), Q = b(() => Math.max(0, Math.min(nr.value - G.value.length, rr.value - tr.value - G.value.length))), ir = b(() => Q.value <= 0), ar = x(null), or = () => {
|
|
4362
|
+
ar.value = null;
|
|
4363
4363
|
};
|
|
4364
|
-
|
|
4365
|
-
e || (
|
|
4364
|
+
C(ir, (e) => {
|
|
4365
|
+
e || (ar.value = null);
|
|
4366
4366
|
});
|
|
4367
|
-
async function
|
|
4368
|
-
if (
|
|
4369
|
-
|
|
4367
|
+
async function sr(e) {
|
|
4368
|
+
if (ir.value) {
|
|
4369
|
+
ar.value = rr.value - tr.value - G.value.length <= nr.value - G.value.length ? {
|
|
4370
4370
|
reason: "per-chat",
|
|
4371
|
-
max:
|
|
4371
|
+
max: rr.value
|
|
4372
4372
|
} : {
|
|
4373
4373
|
reason: "per-message",
|
|
4374
|
-
max:
|
|
4374
|
+
max: nr.value
|
|
4375
4375
|
};
|
|
4376
4376
|
return;
|
|
4377
4377
|
}
|
|
4378
|
-
let t =
|
|
4378
|
+
let t = ft(), n = {
|
|
4379
4379
|
id: t,
|
|
4380
4380
|
file: e,
|
|
4381
4381
|
localUrl: URL.createObjectURL(e),
|
|
4382
4382
|
state: "uploading"
|
|
4383
4383
|
};
|
|
4384
|
-
|
|
4384
|
+
G.value = [...G.value, n];
|
|
4385
4385
|
try {
|
|
4386
|
-
let n = await
|
|
4387
|
-
|
|
4386
|
+
let n = await k.value.uploadMedia(o.value, E.value, e);
|
|
4387
|
+
if (!G.value.some((e) => e.id === t)) {
|
|
4388
|
+
await lr(n);
|
|
4389
|
+
return;
|
|
4390
|
+
}
|
|
4391
|
+
G.value = G.value.map((e) => e.id === t ? {
|
|
4388
4392
|
...e,
|
|
4389
4393
|
state: "done",
|
|
4390
4394
|
mediaSource: n
|
|
4391
4395
|
} : e);
|
|
4392
4396
|
} catch (e) {
|
|
4393
4397
|
let n = e instanceof Error ? e.message : "Upload failed";
|
|
4394
|
-
|
|
4398
|
+
G.value = G.value.map((e) => e.id === t ? {
|
|
4395
4399
|
...e,
|
|
4396
4400
|
state: "error",
|
|
4397
4401
|
error: n
|
|
4398
4402
|
} : e);
|
|
4399
4403
|
}
|
|
4400
4404
|
}
|
|
4401
|
-
async function
|
|
4402
|
-
|
|
4403
|
-
|
|
4405
|
+
async function cr(e) {
|
|
4406
|
+
e.mediaSource && await lr(e.mediaSource);
|
|
4407
|
+
}
|
|
4408
|
+
async function lr(e) {
|
|
4409
|
+
try {
|
|
4410
|
+
await k.value.discardMedia(e);
|
|
4411
|
+
} catch {}
|
|
4412
|
+
}
|
|
4413
|
+
async function ur(e, t) {
|
|
4414
|
+
let { userQuestion: n, assistantMessage: r } = X(e);
|
|
4415
|
+
An(await k.value.submitMessageFeedback({
|
|
4404
4416
|
messageId: e.id,
|
|
4405
|
-
chatId:
|
|
4417
|
+
chatId: E.value,
|
|
4406
4418
|
agentId: o.value,
|
|
4407
4419
|
vote: t,
|
|
4408
4420
|
userQuestion: n,
|
|
4409
4421
|
assistantMessage: r
|
|
4410
4422
|
}));
|
|
4411
4423
|
}
|
|
4412
|
-
async function
|
|
4413
|
-
await
|
|
4424
|
+
async function dr(e) {
|
|
4425
|
+
await ur(e, "upvote");
|
|
4414
4426
|
}
|
|
4415
|
-
async function
|
|
4416
|
-
await
|
|
4427
|
+
async function fr(e) {
|
|
4428
|
+
await ur(e, "downvote");
|
|
4417
4429
|
}
|
|
4418
|
-
function
|
|
4419
|
-
|
|
4430
|
+
function pr(e) {
|
|
4431
|
+
Xt.value = !1, Zt.value = void 0, Jt.value = e;
|
|
4420
4432
|
}
|
|
4421
|
-
async function
|
|
4422
|
-
if (
|
|
4423
|
-
|
|
4424
|
-
let { userQuestion: t, assistantMessage: n } =
|
|
4425
|
-
|
|
4426
|
-
messageId:
|
|
4427
|
-
chatId:
|
|
4433
|
+
async function mr(e) {
|
|
4434
|
+
if (Jt.value) try {
|
|
4435
|
+
Yt.value = !0, Xt.value = !1, Zt.value = void 0;
|
|
4436
|
+
let { userQuestion: t, assistantMessage: n } = X(Jt.value);
|
|
4437
|
+
An(await k.value.submitMessageFeedback({
|
|
4438
|
+
messageId: Jt.value.id,
|
|
4439
|
+
chatId: E.value,
|
|
4428
4440
|
agentId: o.value,
|
|
4429
4441
|
userQuestion: t,
|
|
4430
4442
|
assistantMessage: n,
|
|
4431
4443
|
comment: e
|
|
4432
|
-
})),
|
|
4444
|
+
})), Xt.value = !0, await Y(E.value);
|
|
4433
4445
|
} catch {
|
|
4434
|
-
|
|
4446
|
+
Zt.value = n("message.feedbackSubmitError") ? t("message.feedbackSubmitError") : "Failed to submit feedback";
|
|
4435
4447
|
} finally {
|
|
4436
|
-
|
|
4448
|
+
Yt.value = !1;
|
|
4437
4449
|
}
|
|
4438
4450
|
}
|
|
4439
|
-
async function
|
|
4451
|
+
async function gr(e) {
|
|
4440
4452
|
try {
|
|
4441
|
-
|
|
4453
|
+
$t.value = !0, Qt.value = !1, en.value = void 0, await k.value.submitLead({
|
|
4442
4454
|
agentId: o.value,
|
|
4443
|
-
chatId:
|
|
4455
|
+
chatId: E.value,
|
|
4444
4456
|
...e
|
|
4445
|
-
}),
|
|
4457
|
+
}), Qt.value = !0;
|
|
4446
4458
|
} catch {
|
|
4447
|
-
|
|
4459
|
+
en.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
|
|
4448
4460
|
} finally {
|
|
4449
|
-
|
|
4461
|
+
$t.value = !1;
|
|
4450
4462
|
}
|
|
4451
4463
|
}
|
|
4452
|
-
async function
|
|
4453
|
-
let n = await
|
|
4464
|
+
async function vr(e, t) {
|
|
4465
|
+
let n = await k.value.updateChatTitle(o.value, e, t);
|
|
4454
4466
|
U.value = U.value.map((t) => t.id === e ? {
|
|
4455
4467
|
...t,
|
|
4456
4468
|
title: n.title
|
|
4457
4469
|
} : t);
|
|
4458
4470
|
}
|
|
4459
|
-
async function
|
|
4460
|
-
await
|
|
4471
|
+
async function yr(e) {
|
|
4472
|
+
await k.value.deleteChat(o.value, e), U.value = U.value.filter((t) => t.id !== e), E.value === e && await Zn();
|
|
4461
4473
|
}
|
|
4462
|
-
function
|
|
4463
|
-
|
|
4474
|
+
function br(e) {
|
|
4475
|
+
Gt.value = e;
|
|
4464
4476
|
}
|
|
4465
|
-
function
|
|
4466
|
-
|
|
4477
|
+
function xr() {
|
|
4478
|
+
br("chat"), Kt.value++;
|
|
4467
4479
|
}
|
|
4468
|
-
let
|
|
4469
|
-
function
|
|
4470
|
-
let t = () =>
|
|
4480
|
+
let Sr;
|
|
4481
|
+
function Cr(e) {
|
|
4482
|
+
let t = () => k.value.getChat(o.value, e).then((e) => e !== null);
|
|
4471
4483
|
return t().catch(() => t().catch(() => !1));
|
|
4472
4484
|
}
|
|
4473
|
-
return
|
|
4474
|
-
if (!e || e ===
|
|
4475
|
-
let t =
|
|
4476
|
-
if (
|
|
4477
|
-
let n =
|
|
4478
|
-
l.value === e &&
|
|
4485
|
+
return C(l, async (e) => {
|
|
4486
|
+
if (!e || e === Sr) return;
|
|
4487
|
+
let t = Sr;
|
|
4488
|
+
if (Sr = e, t === void 0) return;
|
|
4489
|
+
let n = E.value, r = !T.value && await Cr(n);
|
|
4490
|
+
l.value === e && E.value === n && (r ? dn(o.value) : (U.value = [], qt.value = [], Ut.value = [], Ot.value = [], I.value = [], L.value = [], R.value = {}, await Zn(), W.value = ""));
|
|
4479
4491
|
}), {
|
|
4480
|
-
apiClient:
|
|
4492
|
+
apiClient: k,
|
|
4481
4493
|
baseUrl: i,
|
|
4482
4494
|
basePath: a,
|
|
4483
4495
|
agentId: o,
|
|
@@ -4491,113 +4503,114 @@ function di(e) {
|
|
|
4491
4503
|
revisedAnswers: m,
|
|
4492
4504
|
model: h,
|
|
4493
4505
|
actionsInput: g,
|
|
4494
|
-
actions:
|
|
4506
|
+
actions: Ke,
|
|
4495
4507
|
agentFileUpload: _,
|
|
4496
4508
|
agentVoice: v,
|
|
4497
4509
|
fallbackModels: y,
|
|
4498
|
-
gatewayOptions:
|
|
4499
|
-
externalContext:
|
|
4500
|
-
agentHostTools:
|
|
4501
|
-
hostToolRegistry:
|
|
4502
|
-
hostToolsPending:
|
|
4503
|
-
agentPageAccess:
|
|
4504
|
-
pageToolRegistry:
|
|
4505
|
-
pageFormsProvider:
|
|
4506
|
-
pageAction:
|
|
4507
|
-
hostStepTitles:
|
|
4508
|
-
hostStepChanges:
|
|
4509
|
-
pageControlActive:
|
|
4510
|
-
isWorking:
|
|
4511
|
-
stopHostActions:
|
|
4512
|
-
voicePageTools:
|
|
4513
|
-
cancelVoicePageCalls:
|
|
4514
|
-
pageNoticeLevel:
|
|
4515
|
-
closePageNotice:
|
|
4516
|
-
hostConfirmation:
|
|
4517
|
-
respondHostConfirmation:
|
|
4518
|
-
pageAccessAvailable:
|
|
4519
|
-
pageAccessOff:
|
|
4520
|
-
setPageAccessOff:
|
|
4521
|
-
agentConfirmations:
|
|
4522
|
-
agentSelectionActions:
|
|
4523
|
-
sendSelection:
|
|
4524
|
-
confirmationsAvailable:
|
|
4525
|
-
confirmationMode:
|
|
4526
|
-
setConfirmationMode:
|
|
4527
|
-
pagePointer:
|
|
4528
|
-
pagePointerStart:
|
|
4529
|
-
pagePointing:
|
|
4530
|
-
pagePointerAvailable:
|
|
4531
|
-
systemTheme:
|
|
4532
|
-
hideWelcomeMessage:
|
|
4533
|
-
isDark:
|
|
4510
|
+
gatewayOptions: ae,
|
|
4511
|
+
externalContext: oe,
|
|
4512
|
+
agentHostTools: se,
|
|
4513
|
+
hostToolRegistry: me,
|
|
4514
|
+
hostToolsPending: he,
|
|
4515
|
+
agentPageAccess: be,
|
|
4516
|
+
pageToolRegistry: Ne,
|
|
4517
|
+
pageFormsProvider: Pe,
|
|
4518
|
+
pageAction: w,
|
|
4519
|
+
hostStepTitles: Re,
|
|
4520
|
+
hostStepChanges: ze,
|
|
4521
|
+
pageControlActive: Be,
|
|
4522
|
+
isWorking: Rn,
|
|
4523
|
+
stopHostActions: St,
|
|
4524
|
+
voicePageTools: xt,
|
|
4525
|
+
cancelVoicePageCalls: P,
|
|
4526
|
+
pageNoticeLevel: rt,
|
|
4527
|
+
closePageNotice: it,
|
|
4528
|
+
hostConfirmation: A,
|
|
4529
|
+
respondHostConfirmation: pt,
|
|
4530
|
+
pageAccessAvailable: Xe,
|
|
4531
|
+
pageAccessOff: Je,
|
|
4532
|
+
setPageAccessOff: wt,
|
|
4533
|
+
agentConfirmations: Te,
|
|
4534
|
+
agentSelectionActions: ke,
|
|
4535
|
+
sendSelection: Nn,
|
|
4536
|
+
confirmationsAvailable: Qe,
|
|
4537
|
+
confirmationMode: $e,
|
|
4538
|
+
setConfirmationMode: et,
|
|
4539
|
+
pagePointer: Fe,
|
|
4540
|
+
pagePointerStart: Ie,
|
|
4541
|
+
pagePointing: Le,
|
|
4542
|
+
pagePointerAvailable: tt,
|
|
4543
|
+
systemTheme: He,
|
|
4544
|
+
hideWelcomeMessage: Ue,
|
|
4545
|
+
isDark: Ge,
|
|
4534
4546
|
chat: B,
|
|
4535
4547
|
messages: It,
|
|
4536
4548
|
conversations: U,
|
|
4537
4549
|
isLoadingConversations: Rt,
|
|
4538
4550
|
hasMoreConversations: Bt,
|
|
4539
4551
|
isLoadingMoreConversations: Vt,
|
|
4540
|
-
chatFiles:
|
|
4541
|
-
isLoadingChatFiles:
|
|
4542
|
-
input:
|
|
4543
|
-
pendingAttachments:
|
|
4544
|
-
isAttachmentLimitReached:
|
|
4545
|
-
fileLimitError:
|
|
4546
|
-
localChatId:
|
|
4547
|
-
isConversationBlocked:
|
|
4552
|
+
chatFiles: Ut,
|
|
4553
|
+
isLoadingChatFiles: Wt,
|
|
4554
|
+
input: W,
|
|
4555
|
+
pendingAttachments: G,
|
|
4556
|
+
isAttachmentLimitReached: ir,
|
|
4557
|
+
fileLimitError: ar,
|
|
4558
|
+
localChatId: E,
|
|
4559
|
+
isConversationBlocked: O,
|
|
4548
4560
|
inputMessagePlaceholder: Lt,
|
|
4549
|
-
chatError:
|
|
4550
|
-
runningChatIds:
|
|
4551
|
-
backgroundAnswers:
|
|
4552
|
-
openBackgroundAnswer:
|
|
4553
|
-
dismissBackgroundAnswer:
|
|
4554
|
-
canQueue:
|
|
4555
|
-
queuedMessages:
|
|
4556
|
-
removeQueuedMessage:
|
|
4557
|
-
editQueuedMessage:
|
|
4558
|
-
activeView:
|
|
4559
|
-
inputFocusRequest:
|
|
4560
|
-
messageFeedbacks:
|
|
4561
|
-
feedbackDialogMessage:
|
|
4562
|
-
isFeedbackSubmitting:
|
|
4563
|
-
isFeedbackSubmitted:
|
|
4564
|
-
feedbackSubmitError:
|
|
4565
|
-
isLeadSubmitted:
|
|
4566
|
-
isLoadingSubmitLead:
|
|
4567
|
-
submitLeadError:
|
|
4568
|
-
buildDeviceContext:
|
|
4569
|
-
initialize:
|
|
4570
|
-
loadConversations:
|
|
4571
|
-
loadMoreConversations:
|
|
4572
|
-
searchConversations:
|
|
4573
|
-
loadChatFiles:
|
|
4574
|
-
refreshMessages:
|
|
4575
|
-
appendMessage:
|
|
4576
|
-
getChatFileUrl:
|
|
4577
|
-
getChatFilePreviewUrl:
|
|
4578
|
-
deleteChatFile:
|
|
4579
|
-
handleSubmit:
|
|
4580
|
-
sendMessage:
|
|
4581
|
-
stopGeneration:
|
|
4582
|
-
startNewChat:
|
|
4583
|
-
regenerate:
|
|
4584
|
-
addToolOutput:
|
|
4585
|
-
addToolApprovalResponse:
|
|
4586
|
-
handleFileSelect:
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4561
|
+
chatError: at,
|
|
4562
|
+
runningChatIds: Bn,
|
|
4563
|
+
backgroundAnswers: qn,
|
|
4564
|
+
openBackgroundAnswer: Jn,
|
|
4565
|
+
dismissBackgroundAnswer: Yn,
|
|
4566
|
+
canQueue: an,
|
|
4567
|
+
queuedMessages: rn,
|
|
4568
|
+
removeQueuedMessage: ln,
|
|
4569
|
+
editQueuedMessage: un,
|
|
4570
|
+
activeView: Gt,
|
|
4571
|
+
inputFocusRequest: Kt,
|
|
4572
|
+
messageFeedbacks: qt,
|
|
4573
|
+
feedbackDialogMessage: Jt,
|
|
4574
|
+
isFeedbackSubmitting: Yt,
|
|
4575
|
+
isFeedbackSubmitted: Xt,
|
|
4576
|
+
feedbackSubmitError: Zt,
|
|
4577
|
+
isLeadSubmitted: Qt,
|
|
4578
|
+
isLoadingSubmitLead: $t,
|
|
4579
|
+
submitLeadError: en,
|
|
4580
|
+
buildDeviceContext: ut,
|
|
4581
|
+
initialize: jn,
|
|
4582
|
+
loadConversations: dn,
|
|
4583
|
+
loadMoreConversations: fn,
|
|
4584
|
+
searchConversations: pn,
|
|
4585
|
+
loadChatFiles: mn,
|
|
4586
|
+
refreshMessages: On,
|
|
4587
|
+
appendMessage: kn,
|
|
4588
|
+
getChatFileUrl: hn,
|
|
4589
|
+
getChatFilePreviewUrl: gn,
|
|
4590
|
+
deleteChatFile: _n,
|
|
4591
|
+
handleSubmit: Mn,
|
|
4592
|
+
sendMessage: Fn,
|
|
4593
|
+
stopGeneration: In,
|
|
4594
|
+
startNewChat: Zn,
|
|
4595
|
+
regenerate: Qn,
|
|
4596
|
+
addToolOutput: $n,
|
|
4597
|
+
addToolApprovalResponse: er,
|
|
4598
|
+
handleFileSelect: sr,
|
|
4599
|
+
discardPendingAttachment: cr,
|
|
4600
|
+
clearFileLimitError: or,
|
|
4601
|
+
clearPendingAttachments: Xn,
|
|
4602
|
+
onUpvote: dr,
|
|
4603
|
+
onDownvote: fr,
|
|
4604
|
+
onFeedback: pr,
|
|
4605
|
+
onFeedbackSubmit: mr,
|
|
4606
|
+
onLeadSubmit: gr,
|
|
4607
|
+
navigate: br,
|
|
4608
|
+
focusInput: xr,
|
|
4609
|
+
renameChatTitle: vr,
|
|
4610
|
+
deleteChat: yr
|
|
4598
4611
|
};
|
|
4599
4612
|
})();
|
|
4600
4613
|
}
|
|
4601
|
-
export {
|
|
4614
|
+
export { ft as a, hr as i, di as n, Gr as r, Kr as t };
|
|
4602
4615
|
|
|
4603
|
-
//# sourceMappingURL=useChatbotStore-
|
|
4616
|
+
//# sourceMappingURL=useChatbotStore-Bj00X4yT.js.map
|