@8wave/ai-elements 0.126.0-beta.46 → 0.126.0-beta.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{Agent-DJ6TBi6l.js → Agent-C1GMLvYc.js} +2 -2
- package/dist/_chunks/Agent-C1GMLvYc.js.map +1 -0
- package/dist/_chunks/{Document-CHcFWo2X.js → Document-CE96PH_Z.js} +2 -2
- package/dist/_chunks/{Document-CHcFWo2X.js.map → Document-CE96PH_Z.js.map} +1 -1
- package/dist/_chunks/{PkFilePreview-BdthRUlY.js → PkFilePreview-CtkjYYm0.js} +3 -3
- package/dist/_chunks/{PkFilePreview-BdthRUlY.js.map → PkFilePreview-CtkjYYm0.js.map} +1 -1
- package/dist/_chunks/{PkFilePreviewDialog-DyQtn85H.js → PkFilePreviewDialog-CSI_4eoa.js} +2 -2
- package/dist/_chunks/{PkFilePreviewDialog-DyQtn85H.js.map → PkFilePreviewDialog-CSI_4eoa.js.map} +1 -1
- package/dist/_chunks/{PkImageEditorDialog-DzA_qGj9.js → PkImageEditorDialog-Cs8daOKf.js} +2 -2
- package/dist/_chunks/{PkImageEditorDialog-DzA_qGj9.js.map → PkImageEditorDialog-Cs8daOKf.js.map} +1 -1
- package/dist/_chunks/{PkSelectionActions-BeREUy3h.js → PkSelectionActions-BkgCVAY6.js} +2 -2
- package/dist/_chunks/{PkSelectionActions-BeREUy3h.js.map → PkSelectionActions-BkgCVAY6.js.map} +1 -1
- package/dist/_chunks/{PkStreamingMarkdown-DLyBjSaH.js → PkStreamingMarkdown-BoD9GNXd.js} +3 -3
- package/dist/_chunks/{PkStreamingMarkdown-DLyBjSaH.js.map → PkStreamingMarkdown-BoD9GNXd.js.map} +1 -1
- package/dist/_chunks/{PkToolChatFile-Ck1uJvaj.js → PkToolChatFile-uuugwDtK.js} +3 -3
- package/dist/_chunks/{PkToolChatFile-Ck1uJvaj.js.map → PkToolChatFile-uuugwDtK.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestGeolocation-ZYzgy6kw.js → PkToolRequestGeolocation-VtAohA8r.js} +2 -2
- package/dist/_chunks/{PkToolRequestGeolocation-ZYzgy6kw.js.map → PkToolRequestGeolocation-VtAohA8r.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestOAuthConnection-Cj_IYnrW.js → PkToolRequestOAuthConnection-C6mz4a3r.js} +2 -2
- package/dist/_chunks/{PkToolRequestOAuthConnection-Cj_IYnrW.js.map → PkToolRequestOAuthConnection-C6mz4a3r.js.map} +1 -1
- package/dist/_chunks/{PkToolShowArtifact-CePvZJJ9.js → PkToolShowArtifact-DE2QAILB.js} +2 -2
- package/dist/_chunks/{PkToolShowArtifact-CePvZJJ9.js.map → PkToolShowArtifact-DE2QAILB.js.map} +1 -1
- package/dist/_chunks/{PkToolShowContactForm-B9u6KgjQ.js → PkToolShowContactForm-DbFbr4W4.js} +2 -2
- package/dist/_chunks/{PkToolShowContactForm-B9u6KgjQ.js.map → PkToolShowContactForm-DbFbr4W4.js.map} +1 -1
- package/dist/_chunks/{PkToolShowForm-B5A-Zj9m.js → PkToolShowForm-DUZRqE6L.js} +4 -4
- package/dist/_chunks/{PkToolShowForm-B5A-Zj9m.js.map → PkToolShowForm-DUZRqE6L.js.map} +1 -1
- package/dist/_chunks/{PkToolShowImageGallery-DOb626aG.js → PkToolShowImageGallery-BnXGmS-z.js} +2 -2
- package/dist/_chunks/{PkToolShowImageGallery-DOb626aG.js.map → PkToolShowImageGallery-BnXGmS-z.js.map} +1 -1
- package/dist/_chunks/{PkToolShowProductList-C-XQdsus.js → PkToolShowProductList-DjARkB8k.js} +2 -2
- package/dist/_chunks/{PkToolShowProductList-C-XQdsus.js.map → PkToolShowProductList-DjARkB8k.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSources-DceDrdbn.js → PkToolShowSources-DyqHj3k9.js} +3 -3
- package/dist/_chunks/{PkToolShowSources-DceDrdbn.js.map → PkToolShowSources-DyqHj3k9.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSuggestedReply-BYoW-L6k.js → PkToolShowSuggestedReply-BHloucB9.js} +2 -2
- package/dist/_chunks/{PkToolShowSuggestedReply-BYoW-L6k.js.map → PkToolShowSuggestedReply-BHloucB9.js.map} +1 -1
- package/dist/_chunks/{PkToolShowVideo-C_1ziurv.js → PkToolShowVideo-p4cHGjAv.js} +2 -2
- package/dist/_chunks/{PkToolShowVideo-C_1ziurv.js.map → PkToolShowVideo-p4cHGjAv.js.map} +1 -1
- package/dist/_chunks/{PkToolShowWebPages-yFdm0n0F.js → PkToolShowWebPages-DA0YtpMg.js} +2 -2
- package/dist/_chunks/{PkToolShowWebPages-yFdm0n0F.js.map → PkToolShowWebPages-DA0YtpMg.js.map} +1 -1
- package/dist/_chunks/{chatImagePolicy-Dqke0kDv.js → chatImagePolicy-DzkymjG_.js} +2 -2
- package/dist/_chunks/{chatImagePolicy-Dqke0kDv.js.map → chatImagePolicy-DzkymjG_.js.map} +1 -1
- package/dist/_chunks/{utils-CEzr10hz.js → utils-wfTrmetf.js} +2 -2
- package/dist/_chunks/{utils-CEzr10hz.js.map → utils-wfTrmetf.js.map} +1 -1
- package/dist/ai-elements.es.js +1574 -1523
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotEmptyState.js +1 -1
- package/dist-vue/PkChatbotInput.js +1 -1
- package/dist-vue/PkChatbotMessages.js +1 -1
- package/dist-vue/PkChatbotStepPayload.js +1 -1
- package/dist-vue/PkChatbotStepToolDetail.js +1 -1
- package/dist-vue/PkChatbotSteps.js +1 -1
- package/dist-vue/PkChatbotViewChat.js +1 -1
- package/dist-vue/PkChatbotViewConversations.js +1 -1
- package/dist-vue/PkChatbotViewFiles.js +1 -1
- package/dist-vue/PkChatbotViewProfile.js +1 -1
- package/dist-vue/_chunks/{Agent-DrnYCRFA.js → Agent-isVYBr_n.js} +2 -2
- package/dist-vue/_chunks/Agent-isVYBr_n.js.map +1 -0
- package/dist-vue/_chunks/{Document-CA7c3oZE.js → Document-CsEiPyJf.js} +2 -2
- package/dist-vue/_chunks/{Document-CA7c3oZE.js.map → Document-CsEiPyJf.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbot-BUHFAQYp.js → PkChatbot-DJ-kKNeV.js} +8 -8
- package/dist-vue/_chunks/{PkChatbot-BUHFAQYp.js.map → PkChatbot-DJ-kKNeV.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotEmptyState-CdE2z9C2.js → PkChatbotEmptyState-CQwz5hSb.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotEmptyState-CdE2z9C2.js.map → PkChatbotEmptyState-CQwz5hSb.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotInput-D6khxAJ8.js → PkChatbotInput-BGlJtAlP.js} +4 -4
- package/dist-vue/_chunks/{PkChatbotInput-D6khxAJ8.js.map → PkChatbotInput-BGlJtAlP.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotMessages-DqoPly0A.js → PkChatbotMessages-2mYFC4KH.js} +18 -18
- package/dist-vue/_chunks/{PkChatbotMessages-DqoPly0A.js.map → PkChatbotMessages-2mYFC4KH.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepPayload-Ksj_Mp7n.js → PkChatbotStepPayload-BxJcO_kc.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotStepPayload-Ksj_Mp7n.js.map → PkChatbotStepPayload-BxJcO_kc.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-BqAF4YZl.js → PkChatbotStepToolDetail-DfHNp8if.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-BqAF4YZl.js.map → PkChatbotStepToolDetail-DfHNp8if.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotSteps-C6GAEPfL.js → PkChatbotSteps-BrlFQA5a.js} +5 -5
- package/dist-vue/_chunks/{PkChatbotSteps-C6GAEPfL.js.map → PkChatbotSteps-BrlFQA5a.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewChat-DE0qVYZ-.js → PkChatbotViewChat-DyYzQ0_6.js} +7 -7
- package/dist-vue/_chunks/{PkChatbotViewChat-DE0qVYZ-.js.map → PkChatbotViewChat-DyYzQ0_6.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewConversations-HNJPIMeQ.js → PkChatbotViewConversations-Bfl-Cu3s.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewConversations-HNJPIMeQ.js.map → PkChatbotViewConversations-Bfl-Cu3s.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewFiles-gGshDAPk.js → PkChatbotViewFiles-D0Ym57Sc.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewFiles-gGshDAPk.js.map → PkChatbotViewFiles-D0Ym57Sc.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewProfile-BuJtqq8F.js → PkChatbotViewProfile-Da95mth_.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewProfile-BuJtqq8F.js.map → PkChatbotViewProfile-Da95mth_.js.map} +1 -1
- package/dist-vue/_chunks/{PkFilePreview-CGCMa6NV.js → PkFilePreview-jUCV8QJV.js} +4 -4
- package/dist-vue/_chunks/{PkFilePreview-CGCMa6NV.js.map → PkFilePreview-jUCV8QJV.js.map} +1 -1
- package/dist-vue/_chunks/{PkFilePreviewDialog-DRkXUy1_.js → PkFilePreviewDialog-Bzeqzrso.js} +2 -2
- package/dist-vue/_chunks/{PkFilePreviewDialog-DRkXUy1_.js.map → PkFilePreviewDialog-Bzeqzrso.js.map} +1 -1
- package/dist-vue/_chunks/{PkImageEditorDialog-M0xhsEUs.js → PkImageEditorDialog-DyKncQED.js} +2 -2
- package/dist-vue/_chunks/{PkImageEditorDialog-M0xhsEUs.js.map → PkImageEditorDialog-DyKncQED.js.map} +1 -1
- package/dist-vue/_chunks/{PkStreamingMarkdown-48T0DPih.js → PkStreamingMarkdown-BN35ztaH.js} +3 -3
- package/dist-vue/_chunks/{PkStreamingMarkdown-48T0DPih.js.map → PkStreamingMarkdown-BN35ztaH.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolChatFile-qKYe0XRX.js → PkToolChatFile-CjmR6vJr.js} +3 -3
- package/dist-vue/_chunks/{PkToolChatFile-qKYe0XRX.js.map → PkToolChatFile-CjmR6vJr.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolRequestGeolocation-BuknnxuZ.js → PkToolRequestGeolocation-4lo7rdw_.js} +2 -2
- package/dist-vue/_chunks/{PkToolRequestGeolocation-BuknnxuZ.js.map → PkToolRequestGeolocation-4lo7rdw_.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolRequestOAuthConnection-BaMZkvU5.js → PkToolRequestOAuthConnection-DLvI-FO1.js} +2 -2
- package/dist-vue/_chunks/{PkToolRequestOAuthConnection-BaMZkvU5.js.map → PkToolRequestOAuthConnection-DLvI-FO1.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowArtifact-D51SQ08X.js → PkToolShowArtifact-CUnLCfe2.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowArtifact-D51SQ08X.js.map → PkToolShowArtifact-CUnLCfe2.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowChart-Cf3Hi-Pb.js → PkToolShowChart-BKaqm4jB.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowChart-Cf3Hi-Pb.js.map → PkToolShowChart-BKaqm4jB.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowContactForm-D8Z4bRx9.js → PkToolShowContactForm-BPgCFRBO.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowContactForm-D8Z4bRx9.js.map → PkToolShowContactForm-BPgCFRBO.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowDiagram-Bla0_Vc2.js → PkToolShowDiagram-BA1ngT_R.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowDiagram-Bla0_Vc2.js.map → PkToolShowDiagram-BA1ngT_R.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowForm-BO3NuyAu.js → PkToolShowForm-CPzloHZG.js} +4 -4
- package/dist-vue/_chunks/{PkToolShowForm-BO3NuyAu.js.map → PkToolShowForm-CPzloHZG.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowImageGallery-BLISCC3h.js → PkToolShowImageGallery-Cf_xEnCc.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowImageGallery-BLISCC3h.js.map → PkToolShowImageGallery-Cf_xEnCc.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowProductList-D5JZ6W7c.js → PkToolShowProductList-BR74ZJ0y.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowProductList-D5JZ6W7c.js.map → PkToolShowProductList-BR74ZJ0y.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSources-SnQoTbvq.js → PkToolShowSources-98lDr3hZ.js} +3 -3
- package/dist-vue/_chunks/{PkToolShowSources-SnQoTbvq.js.map → PkToolShowSources-98lDr3hZ.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSuggestedReply-DCZbwFhR.js → PkToolShowSuggestedReply-C1bBBrWL.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowSuggestedReply-DCZbwFhR.js.map → PkToolShowSuggestedReply-C1bBBrWL.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowVideo-D7pwwsfX.js → PkToolShowVideo-BAHMp9Om.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowVideo-D7pwwsfX.js.map → PkToolShowVideo-BAHMp9Om.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowWebPages-dbNooGK_.js → PkToolShowWebPages-ChdvHjDW.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowWebPages-dbNooGK_.js.map → PkToolShowWebPages-ChdvHjDW.js.map} +1 -1
- package/dist-vue/_chunks/{createChatbotApiClient-_gh3Y1rl.js → createChatbotApiClient-BNRjO4rv.js} +2 -2
- package/dist-vue/_chunks/{createChatbotApiClient-_gh3Y1rl.js.map → createChatbotApiClient-BNRjO4rv.js.map} +1 -1
- package/dist-vue/_chunks/{useChatbotStore-CjFPM9Q5.js → useChatbotStore-BQ9areKD.js} +1071 -1020
- package/dist-vue/_chunks/useChatbotStore-BQ9areKD.js.map +1 -0
- package/dist-vue/_chunks/{utils-CaPUJibf.js → utils-3Tmkyrn8.js} +2 -2
- package/dist-vue/_chunks/{utils-CaPUJibf.js.map → utils-3Tmkyrn8.js.map} +1 -1
- package/dist-vue/api.js +1 -1
- package/dist-vue/composables.js +4 -4
- package/dist-vue/index.js +28 -28
- package/dist-vue/packages/models/src/schema/constants.d.ts +1 -1
- package/package.json +2 -2
- package/dist/_chunks/Agent-DJ6TBi6l.js.map +0 -1
- package/dist-vue/_chunks/Agent-DrnYCRFA.js.map +0 -1
- package/dist-vue/_chunks/useChatbotStore-CjFPM9Q5.js.map +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { $ as e, A as t, B as n, D as r, E as i, F as a, G as o, H as s, I as c, J as l, K as u, L as d, M as f, N as p, P as m, Q as h, R as g, S as _, T as v, U as
|
|
2
|
-
import { n as
|
|
3
|
-
import { i as
|
|
4
|
-
import { Q 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
|
|
1
|
+
import { $ as e, A as t, B as n, D as r, E as i, F as a, G as o, H as s, I as c, J as l, K as u, L as d, M as f, N as p, P as m, Q as h, R as g, S as _, T as v, U as ee, W as y, X as te, Y as ne, Z as re, _t as ie, a as ae, at as oe, b as se, bt as b, ct as ce, dt as le, et as ue, g as de, gt as fe, h as pe, ht as me, i as he, it as ge, k as _e, l as ve, lt as ye, m as be, mt as x, nt as S, o as xe, ot as Se, p as C, q as Ce, rt as we, s as Te, st as Ee, tt as De, u as Oe, ut as ke, vt as Ae, x as je, xt as Me, y as Ne, yt as Pe, z as Fe } from "./schemas-CwcNxjnD.js";
|
|
2
|
+
import { n as Ie, t as Le } from "./useSafeLocalStorage-Bn4SsL8C.js";
|
|
3
|
+
import { i as Re, r as ze, t as Be } from "./createChatbotApiClient-BNRjO4rv.js";
|
|
4
|
+
import { Q as Ve, V as He, Z as Ue, at as We, et as Ge, nt as Ke, ot as qe, st as Je } from "./Agent-isVYBr_n.js";
|
|
5
|
+
import { d as Ye, r as Xe } from "./message-DuibQyHy.js";
|
|
6
|
+
import { n as Ze } from "./src-nb8MU1sh.js";
|
|
7
|
+
import { computed as w, getCurrentScope as T, isReadonly as Qe, nextTick as $e, onScopeDispose as et, reactive as tt, ref as E, shallowRef as D, toRefs as nt, toValue as rt, watch as O, watchEffect as it } from "vue";
|
|
8
|
+
import { useI18n as at } from "vue-i18n";
|
|
9
|
+
import { useDocumentVisibility as ot, usePreferredDark as st } from "@vueuse/core";
|
|
10
|
+
import { defineStore as k } from "pinia";
|
|
11
11
|
// ../../packages/utils/src/device-context.ts
|
|
12
|
-
function
|
|
12
|
+
function ct() {
|
|
13
13
|
let e = navigator.connection, t = navigator.userAgentData;
|
|
14
14
|
return {
|
|
15
15
|
dateTime: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -39,7 +39,7 @@ function st() {
|
|
|
39
39
|
historyLength: window.history.length
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
async function
|
|
42
|
+
async function lt(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 ct(e) {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
// ../../packages/composable/src/chatbot/hostTools.ts
|
|
60
|
-
var
|
|
60
|
+
var ut = "agentstudio:page-navigation", dt = (e) => typeof e?.afterOutput == "function", ft = (e) => e.toolMetadata?.source === We, pt = (e, t) => {
|
|
61
61
|
if (!t || !e?.length) return;
|
|
62
|
-
let n = new Set(t.allowed), r = e.filter((e) => n.has(e.name) && !
|
|
62
|
+
let n = new Set(t.allowed), r = e.filter((e) => n.has(e.name) && !Ge(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 mt(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
|
+
dt(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 pt(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, qe(n.readOnly));
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
let m;
|
|
@@ -103,22 +103,22 @@ function pt(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 (dt(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 pt(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 ? qe(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 {
|
|
@@ -150,66 +150,66 @@ function pt(e) {
|
|
|
150
150
|
}
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
|
-
// ../../node_modules/.pnpm/@ai-sdk+provider@4.0.
|
|
154
|
-
var
|
|
153
|
+
// ../../node_modules/.pnpm/@ai-sdk+provider@4.0.39/node_modules/@ai-sdk/provider/dist/index.js
|
|
154
|
+
var ht = "vercel.ai.error", gt = Symbol.for(ht), A = class e extends Error {
|
|
155
155
|
constructor({ name: e, message: t, cause: n }) {
|
|
156
|
-
super(t), this[
|
|
156
|
+
super(t), this[gt] = !0, this.name = e, this.cause = n;
|
|
157
157
|
}
|
|
158
158
|
static isInstance(t) {
|
|
159
|
-
return e.hasMarker(t,
|
|
159
|
+
return e.hasMarker(t, ht);
|
|
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
|
+
}, _t = "AI_APICallError", vt = `vercel.ai.error.${_t}`, yt = Symbol.for(vt), bt = class extends A {
|
|
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: _t,
|
|
169
169
|
message: e,
|
|
170
170
|
cause: o
|
|
171
|
-
}), this[
|
|
171
|
+
}), this[yt] = !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 A.hasMarker(e, vt);
|
|
175
175
|
}
|
|
176
|
-
},
|
|
176
|
+
}, xt = "AI_EmptyResponseBodyError", St = `vercel.ai.error.${xt}`, Ct = Symbol.for(St), wt = class extends A {
|
|
177
177
|
constructor({ message: e = "Empty response body" } = {}) {
|
|
178
178
|
super({
|
|
179
|
-
name:
|
|
179
|
+
name: xt,
|
|
180
180
|
message: e
|
|
181
|
-
}), this[
|
|
181
|
+
}), this[Ct] = !0;
|
|
182
182
|
}
|
|
183
183
|
static isInstance(e) {
|
|
184
|
-
return
|
|
184
|
+
return A.hasMarker(e, St);
|
|
185
185
|
}
|
|
186
186
|
};
|
|
187
|
-
function
|
|
187
|
+
function Tt(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 Et = "AI_InvalidArgumentError", Dt = `vercel.ai.error.${Et}`, Ot = Symbol.for(Dt), kt = class extends A {
|
|
191
191
|
constructor({ message: e, cause: t, argument: n }) {
|
|
192
192
|
super({
|
|
193
|
-
name:
|
|
193
|
+
name: Et,
|
|
194
194
|
message: e,
|
|
195
195
|
cause: t
|
|
196
|
-
}), this[
|
|
196
|
+
}), this[Ot] = !0, this.argument = n;
|
|
197
197
|
}
|
|
198
198
|
static isInstance(e) {
|
|
199
|
-
return
|
|
199
|
+
return A.hasMarker(e, Dt);
|
|
200
200
|
}
|
|
201
|
-
},
|
|
201
|
+
}, j = "AI_JSONParseError", At = `vercel.ai.error.${j}`, jt = Symbol.for(At), Mt = class extends A {
|
|
202
202
|
constructor({ text: e, cause: t }) {
|
|
203
203
|
super({
|
|
204
|
-
name:
|
|
205
|
-
message: `JSON parsing failed: Text: ${e}.\nError message: ${
|
|
204
|
+
name: j,
|
|
205
|
+
message: `JSON parsing failed: Text: ${e}.\nError message: ${Tt(t)}`,
|
|
206
206
|
cause: t
|
|
207
|
-
}), this[
|
|
207
|
+
}), this[jt] = !0, this.text = e;
|
|
208
208
|
}
|
|
209
209
|
static isInstance(e) {
|
|
210
|
-
return
|
|
210
|
+
return A.hasMarker(e, At);
|
|
211
211
|
}
|
|
212
|
-
},
|
|
212
|
+
}, M = "AI_TypeValidationError", N = `vercel.ai.error.${M}`, Nt = Symbol.for(N), Pt = class e extends A {
|
|
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 Tt = "AI_InvalidArgumentError", Et = `vercel.ai.error.${Tt}`, Dt = Symbol.fo
|
|
|
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: M,
|
|
222
|
+
message: `${r}: Value: ${JSON.stringify(e)}.\nError message: ${Tt(t)}`,
|
|
223
223
|
cause: t
|
|
224
|
-
}), this[
|
|
224
|
+
}), this[Nt] = !0, this.value = e, this.context = n;
|
|
225
225
|
}
|
|
226
226
|
static isInstance(e) {
|
|
227
|
-
return
|
|
227
|
+
return A.hasMarker(e, N);
|
|
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 Tt = "AI_InvalidArgumentError", Et = `vercel.ai.error.${Tt}`, Dt = Symbol.fo
|
|
|
233
233
|
context: r
|
|
234
234
|
});
|
|
235
235
|
}
|
|
236
|
-
},
|
|
236
|
+
}, Ft = "AI_UnsupportedFunctionalityError", It = `vercel.ai.error.${Ft}`, Lt = Symbol.for(It), Rt = class extends A {
|
|
237
237
|
constructor({ functionality: e, message: t = `'${e}' functionality not supported.` }) {
|
|
238
238
|
super({
|
|
239
|
-
name:
|
|
239
|
+
name: Ft,
|
|
240
240
|
message: t
|
|
241
|
-
}), this[
|
|
241
|
+
}), this[Lt] = !0, this.functionality = e;
|
|
242
242
|
}
|
|
243
243
|
static isInstance(e) {
|
|
244
|
-
return
|
|
244
|
+
return A.hasMarker(e, It);
|
|
245
245
|
}
|
|
246
|
-
},
|
|
246
|
+
}, zt = 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
|
+
}, P = 10, Bt = 13, Vt = 32;
|
|
251
|
+
function Ht(e) {}
|
|
252
|
+
function Ut(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 = Ht, onError: n = Ht, onRetry: r = Ht, 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 Ht(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 zt(`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 Ht(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 (Wt(e, n, i)) {
|
|
290
|
+
let i = e.charCodeAt(n + 5) === Vt ? n + 6 : n + 5, a = e.slice(i, r);
|
|
291
|
+
if (d === 0 && e.charCodeAt(r + 1) === P) {
|
|
292
292
|
t({
|
|
293
293
|
id: l,
|
|
294
294
|
event: f,
|
|
@@ -298,7 +298,7 @@ function Ht(e) {
|
|
|
298
298
|
}
|
|
299
299
|
u = d === 0 ? a : `${u}
|
|
300
300
|
${a}`, d++;
|
|
301
|
-
} else
|
|
301
|
+
} else Gt(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) === Vt ? 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) === Bt && e.charCodeAt(n) === P && 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 (Wt(e, t, r)) {
|
|
320
|
+
let r = e.charCodeAt(t + 5) === Vt ? 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 (Gt(e, t, r)) {
|
|
326
|
+
f = e.slice(e.charCodeAt(t + 6) === Vt ? 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) === Vt ? 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) === Vt ? 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) === Vt ? 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 zt(`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 zt(`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 Wt(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 Gt(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 Kt = 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 = Ut({
|
|
408
408
|
onEvent: (e) => {
|
|
409
409
|
a.enqueue(e);
|
|
410
410
|
},
|
|
@@ -423,19 +423,19 @@ var Gt = class extends TransformStream {
|
|
|
423
423
|
}
|
|
424
424
|
};
|
|
425
425
|
new TextDecoder();
|
|
426
|
-
var { btoa:
|
|
427
|
-
function
|
|
428
|
-
return ArrayBuffer.isView(e) &&
|
|
426
|
+
var { btoa: qt, atob: Jt } = globalThis, Yt = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype), Symbol.toStringTag).get, Xt = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength").get;
|
|
427
|
+
function Zt(e) {
|
|
428
|
+
return ArrayBuffer.isView(e) && Yt.call(e) === "Uint8Array";
|
|
429
429
|
}
|
|
430
|
-
function
|
|
430
|
+
function F(e) {
|
|
431
431
|
if (typeof e != "object" || !e || !("byteLength" in e)) return !1;
|
|
432
432
|
try {
|
|
433
|
-
return
|
|
433
|
+
return Xt.call(e), !0;
|
|
434
434
|
} catch {
|
|
435
435
|
return !1;
|
|
436
436
|
}
|
|
437
437
|
}
|
|
438
|
-
function
|
|
438
|
+
function Qt(e) {
|
|
439
439
|
if (e == null) return {};
|
|
440
440
|
let t = {};
|
|
441
441
|
if (e instanceof Headers) e.forEach((e, n) => {
|
|
@@ -447,28 +447,28 @@ function Zt(e) {
|
|
|
447
447
|
}
|
|
448
448
|
return t;
|
|
449
449
|
}
|
|
450
|
-
var
|
|
450
|
+
var I = ({ prefix: e, size: t = 16, alphabet: n = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", separator: r = "-" } = {}) => {
|
|
451
451
|
let i = () => {
|
|
452
452
|
let e = n.length, r = Array(t);
|
|
453
453
|
for (let i = 0; i < t; i++) r[i] = n[Math.random() * e | 0];
|
|
454
454
|
return r.join("");
|
|
455
455
|
};
|
|
456
456
|
if (e == null) return i;
|
|
457
|
-
if (n.includes(r)) throw new
|
|
457
|
+
if (n.includes(r)) throw new kt({
|
|
458
458
|
argument: "separator",
|
|
459
459
|
message: `The separator "${r}" must not be part of the alphabet "${n}".`
|
|
460
460
|
});
|
|
461
461
|
return () => `${e}${r}${i()}`;
|
|
462
|
-
},
|
|
463
|
-
function
|
|
462
|
+
}, $t = I();
|
|
463
|
+
function L(e) {
|
|
464
464
|
return globalThis.Buffer?.isBuffer(e) ?? !1;
|
|
465
465
|
}
|
|
466
|
-
var
|
|
467
|
-
function
|
|
466
|
+
var en = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/, tn = /"(?: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*:/;
|
|
467
|
+
function nn(e) {
|
|
468
468
|
let t = JSON.parse(e);
|
|
469
|
-
return typeof t != "object" || !t ||
|
|
469
|
+
return typeof t != "object" || !t || en.test(e) === !1 && tn.test(e) === !1 ? t : rn(t);
|
|
470
470
|
}
|
|
471
|
-
function
|
|
471
|
+
function rn(e) {
|
|
472
472
|
let t = [e];
|
|
473
473
|
for (; t.length;) {
|
|
474
474
|
let e = t;
|
|
@@ -483,35 +483,35 @@ function nn(e) {
|
|
|
483
483
|
}
|
|
484
484
|
return e;
|
|
485
485
|
}
|
|
486
|
-
function
|
|
486
|
+
function an(e) {
|
|
487
487
|
let { stackTraceLimit: t } = Error;
|
|
488
488
|
try {
|
|
489
489
|
Error.stackTraceLimit = 0;
|
|
490
490
|
} catch {
|
|
491
|
-
return
|
|
491
|
+
return nn(e);
|
|
492
492
|
}
|
|
493
493
|
try {
|
|
494
|
-
return
|
|
494
|
+
return nn(e);
|
|
495
495
|
} finally {
|
|
496
496
|
Error.stackTraceLimit = t;
|
|
497
497
|
}
|
|
498
498
|
}
|
|
499
|
-
function
|
|
499
|
+
function R(e) {
|
|
500
500
|
if (e.type === "object" || Array.isArray(e.type) && e.type.includes("object")) {
|
|
501
501
|
let { additionalProperties: t } = e;
|
|
502
|
-
e.additionalProperties = t != null && typeof t != "boolean" &&
|
|
502
|
+
e.additionalProperties = t != null && typeof t != "boolean" && z(t);
|
|
503
503
|
let { properties: n } = e;
|
|
504
|
-
if (n != null) for (let e of Object.keys(n)) n[e] =
|
|
504
|
+
if (n != null) for (let e of Object.keys(n)) n[e] = z(n[e]);
|
|
505
505
|
}
|
|
506
|
-
e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(
|
|
506
|
+
e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(z) : z(e.items)), e.anyOf != null && (e.anyOf = e.anyOf.map(z)), e.allOf != null && (e.allOf = e.allOf.map(z)), e.oneOf != null && (e.oneOf = e.oneOf.map(z));
|
|
507
507
|
let { definitions: t } = e;
|
|
508
|
-
if (t != null) for (let e of Object.keys(t)) t[e] =
|
|
508
|
+
if (t != null) for (let e of Object.keys(t)) t[e] = z(t[e]);
|
|
509
509
|
return e;
|
|
510
510
|
}
|
|
511
|
-
function
|
|
512
|
-
return typeof e == "boolean" ? e :
|
|
511
|
+
function z(e) {
|
|
512
|
+
return typeof e == "boolean" ? e : R(e);
|
|
513
513
|
}
|
|
514
|
-
var
|
|
514
|
+
var on = Symbol("Let zodToJsonSchema decide on which parser to use"), sn = {
|
|
515
515
|
name: void 0,
|
|
516
516
|
$refStrategy: "root",
|
|
517
517
|
basePath: ["#"],
|
|
@@ -531,24 +531,24 @@ var an = Symbol("Let zodToJsonSchema decide on which parser to use"), on = {
|
|
|
531
531
|
emailStrategy: "format:email",
|
|
532
532
|
base64Strategy: "contentEncoding:base64",
|
|
533
533
|
nameStrategy: "ref"
|
|
534
|
-
},
|
|
535
|
-
...
|
|
534
|
+
}, cn = (e) => typeof e == "string" ? {
|
|
535
|
+
...sn,
|
|
536
536
|
name: e
|
|
537
537
|
} : {
|
|
538
|
-
...
|
|
538
|
+
...sn,
|
|
539
539
|
...e
|
|
540
540
|
};
|
|
541
|
-
function
|
|
541
|
+
function B() {
|
|
542
542
|
return {};
|
|
543
543
|
}
|
|
544
|
-
function
|
|
544
|
+
function ln(e, t) {
|
|
545
545
|
let n = { type: "array" };
|
|
546
546
|
return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = J(e.type._def, {
|
|
547
547
|
...t,
|
|
548
548
|
currentPath: [...t.currentPath, "items"]
|
|
549
549
|
})), 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;
|
|
550
550
|
}
|
|
551
|
-
function
|
|
551
|
+
function un(e) {
|
|
552
552
|
let t = {
|
|
553
553
|
type: "integer",
|
|
554
554
|
format: "int64"
|
|
@@ -565,16 +565,16 @@ function ln(e) {
|
|
|
565
565
|
}
|
|
566
566
|
return t;
|
|
567
567
|
}
|
|
568
|
-
function
|
|
568
|
+
function dn() {
|
|
569
569
|
return { type: "boolean" };
|
|
570
570
|
}
|
|
571
|
-
function
|
|
571
|
+
function fn(e, t) {
|
|
572
572
|
return J(e.type._def, t);
|
|
573
573
|
}
|
|
574
|
-
var
|
|
575
|
-
function
|
|
574
|
+
var pn = (e, t) => J(e.innerType._def, t);
|
|
575
|
+
function mn(e, t, n) {
|
|
576
576
|
let r = n ?? t.dateStrategy;
|
|
577
|
-
if (Array.isArray(r)) return { anyOf: r.map((n) =>
|
|
577
|
+
if (Array.isArray(r)) return { anyOf: r.map((n) => mn(e, t, n)) };
|
|
578
578
|
switch (r) {
|
|
579
579
|
case "string":
|
|
580
580
|
case "format:date-time": return {
|
|
@@ -585,10 +585,10 @@ function pn(e, t, n) {
|
|
|
585
585
|
type: "string",
|
|
586
586
|
format: "date"
|
|
587
587
|
};
|
|
588
|
-
case "integer": return
|
|
588
|
+
case "integer": return V(e);
|
|
589
589
|
}
|
|
590
590
|
}
|
|
591
|
-
var
|
|
591
|
+
var V = (e) => {
|
|
592
592
|
let t = {
|
|
593
593
|
type: "integer",
|
|
594
594
|
format: "unix-time"
|
|
@@ -601,23 +601,23 @@ var H = (e) => {
|
|
|
601
601
|
}
|
|
602
602
|
return t;
|
|
603
603
|
};
|
|
604
|
-
function
|
|
604
|
+
function H(e, t) {
|
|
605
605
|
return {
|
|
606
606
|
...J(e.innerType._def, t),
|
|
607
607
|
default: e.defaultValue()
|
|
608
608
|
};
|
|
609
609
|
}
|
|
610
|
-
function
|
|
611
|
-
return t.effectStrategy === "input" ? J(e.schema._def, t) :
|
|
610
|
+
function U(e, t) {
|
|
611
|
+
return t.effectStrategy === "input" ? J(e.schema._def, t) : B();
|
|
612
612
|
}
|
|
613
|
-
function
|
|
613
|
+
function hn(e) {
|
|
614
614
|
return {
|
|
615
615
|
type: "string",
|
|
616
616
|
enum: Array.from(e.values)
|
|
617
617
|
};
|
|
618
618
|
}
|
|
619
|
-
var
|
|
620
|
-
function
|
|
619
|
+
var gn = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
|
|
620
|
+
function _n(e, t) {
|
|
621
621
|
let n = [J(e.left._def, {
|
|
622
622
|
...t,
|
|
623
623
|
currentPath: [
|
|
@@ -634,7 +634,7 @@ function gn(e, t) {
|
|
|
634
634
|
]
|
|
635
635
|
})].filter((e) => !!e), r = [];
|
|
636
636
|
return n.forEach((e) => {
|
|
637
|
-
if (
|
|
637
|
+
if (gn(e)) r.push(...e.allOf);
|
|
638
638
|
else {
|
|
639
639
|
let t = e;
|
|
640
640
|
if ("additionalProperties" in e && e.additionalProperties === !1) {
|
|
@@ -645,19 +645,19 @@ function gn(e, t) {
|
|
|
645
645
|
}
|
|
646
646
|
}), r.length ? { allOf: r } : void 0;
|
|
647
647
|
}
|
|
648
|
-
function
|
|
648
|
+
function vn(e) {
|
|
649
649
|
let t = typeof e.value;
|
|
650
650
|
return t !== "bigint" && t !== "number" && t !== "boolean" && t !== "string" ? { type: Array.isArray(e.value) ? "array" : "object" } : {
|
|
651
651
|
type: t === "bigint" ? "integer" : t,
|
|
652
652
|
const: e.value
|
|
653
653
|
};
|
|
654
654
|
}
|
|
655
|
-
var
|
|
655
|
+
var yn = void 0, W = {
|
|
656
656
|
cuid: /^[cC][^\s-]{8,}$/,
|
|
657
657
|
cuid2: /^[0-9a-z]+$/,
|
|
658
658
|
ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
|
|
659
659
|
email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}$/,
|
|
660
|
-
emoji: () => (
|
|
660
|
+
emoji: () => (yn === void 0 && (yn = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u")), yn),
|
|
661
661
|
uuid: /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,
|
|
662
662
|
ipv4: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,
|
|
663
663
|
ipv4Cidr: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,
|
|
@@ -668,7 +668,7 @@ var vn = void 0, G = {
|
|
|
668
668
|
nanoid: /^[a-zA-Z0-9_-]{21}$/,
|
|
669
669
|
jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
|
|
670
670
|
};
|
|
671
|
-
function
|
|
671
|
+
function bn(e, t) {
|
|
672
672
|
let n = { type: "string" };
|
|
673
673
|
if (e.checks) for (let r of e.checks) switch (r.kind) {
|
|
674
674
|
case "min":
|
|
@@ -680,108 +680,108 @@ function yn(e, t) {
|
|
|
680
680
|
case "email":
|
|
681
681
|
switch (t.emailStrategy) {
|
|
682
682
|
case "format:email":
|
|
683
|
-
|
|
683
|
+
G(n, "email", r.message, t);
|
|
684
684
|
break;
|
|
685
685
|
case "format:idn-email":
|
|
686
|
-
|
|
686
|
+
G(n, "idn-email", r.message, t);
|
|
687
687
|
break;
|
|
688
|
-
case "pattern:zod":
|
|
688
|
+
case "pattern:zod": K(n, W.email, r.message, t);
|
|
689
689
|
}
|
|
690
690
|
break;
|
|
691
691
|
case "url":
|
|
692
|
-
|
|
692
|
+
G(n, "uri", r.message, t);
|
|
693
693
|
break;
|
|
694
694
|
case "uuid":
|
|
695
|
-
|
|
695
|
+
G(n, "uuid", r.message, t);
|
|
696
696
|
break;
|
|
697
697
|
case "regex":
|
|
698
|
-
|
|
698
|
+
K(n, r.regex, r.message, t);
|
|
699
699
|
break;
|
|
700
700
|
case "cuid":
|
|
701
|
-
|
|
701
|
+
K(n, W.cuid, r.message, t);
|
|
702
702
|
break;
|
|
703
703
|
case "cuid2":
|
|
704
|
-
|
|
704
|
+
K(n, W.cuid2, r.message, t);
|
|
705
705
|
break;
|
|
706
706
|
case "startsWith":
|
|
707
|
-
|
|
707
|
+
K(n, RegExp(`^${xn(r.value, t)}`), r.message, t);
|
|
708
708
|
break;
|
|
709
709
|
case "endsWith":
|
|
710
|
-
|
|
710
|
+
K(n, RegExp(`${xn(r.value, t)}$`), r.message, t);
|
|
711
711
|
break;
|
|
712
712
|
case "datetime":
|
|
713
|
-
|
|
713
|
+
G(n, "date-time", r.message, t);
|
|
714
714
|
break;
|
|
715
715
|
case "date":
|
|
716
|
-
|
|
716
|
+
G(n, "date", r.message, t);
|
|
717
717
|
break;
|
|
718
718
|
case "time":
|
|
719
|
-
|
|
719
|
+
G(n, "time", r.message, t);
|
|
720
720
|
break;
|
|
721
721
|
case "duration":
|
|
722
|
-
|
|
722
|
+
G(n, "duration", r.message, t);
|
|
723
723
|
break;
|
|
724
724
|
case "length":
|
|
725
725
|
n.minLength = typeof n.minLength == "number" ? Math.max(n.minLength, r.value) : r.value, n.maxLength = typeof n.maxLength == "number" ? Math.min(n.maxLength, r.value) : r.value;
|
|
726
726
|
break;
|
|
727
727
|
case "includes":
|
|
728
|
-
|
|
728
|
+
K(n, RegExp(xn(r.value, t)), r.message, t);
|
|
729
729
|
break;
|
|
730
730
|
case "ip":
|
|
731
|
-
r.version !== "v6" &&
|
|
731
|
+
r.version !== "v6" && G(n, "ipv4", r.message, t), r.version !== "v4" && G(n, "ipv6", r.message, t);
|
|
732
732
|
break;
|
|
733
733
|
case "base64url":
|
|
734
|
-
|
|
734
|
+
K(n, W.base64url, r.message, t);
|
|
735
735
|
break;
|
|
736
736
|
case "jwt":
|
|
737
|
-
|
|
737
|
+
K(n, W.jwt, r.message, t);
|
|
738
738
|
break;
|
|
739
739
|
case "cidr":
|
|
740
|
-
r.version !== "v6" &&
|
|
740
|
+
r.version !== "v6" && K(n, W.ipv4Cidr, r.message, t), r.version !== "v4" && K(n, W.ipv6Cidr, r.message, t);
|
|
741
741
|
break;
|
|
742
742
|
case "emoji":
|
|
743
|
-
|
|
743
|
+
K(n, W.emoji(), r.message, t);
|
|
744
744
|
break;
|
|
745
745
|
case "ulid":
|
|
746
|
-
|
|
746
|
+
K(n, W.ulid, r.message, t);
|
|
747
747
|
break;
|
|
748
748
|
case "base64":
|
|
749
749
|
switch (t.base64Strategy) {
|
|
750
750
|
case "format:binary":
|
|
751
|
-
|
|
751
|
+
G(n, "binary", r.message, t);
|
|
752
752
|
break;
|
|
753
753
|
case "contentEncoding:base64":
|
|
754
754
|
n.contentEncoding = "base64";
|
|
755
755
|
break;
|
|
756
|
-
case "pattern:zod":
|
|
756
|
+
case "pattern:zod": K(n, W.base64, r.message, t);
|
|
757
757
|
}
|
|
758
758
|
break;
|
|
759
|
-
case "nanoid":
|
|
759
|
+
case "nanoid": K(n, W.nanoid, r.message, t);
|
|
760
760
|
}
|
|
761
761
|
return n;
|
|
762
762
|
}
|
|
763
|
-
function
|
|
764
|
-
return t.patternStrategy === "escape" ?
|
|
763
|
+
function xn(e, t) {
|
|
764
|
+
return t.patternStrategy === "escape" ? Cn(e) : e;
|
|
765
765
|
}
|
|
766
|
-
var
|
|
767
|
-
function
|
|
766
|
+
var Sn = /* @__PURE__ */ new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
767
|
+
function Cn(e) {
|
|
768
768
|
let t = "";
|
|
769
|
-
for (let n = 0; n < e.length; n++)
|
|
769
|
+
for (let n = 0; n < e.length; n++) Sn.has(e[n]) || (t += "\\"), t += e[n];
|
|
770
770
|
return t;
|
|
771
771
|
}
|
|
772
|
-
function
|
|
772
|
+
function G(e, t, n, r) {
|
|
773
773
|
e.format || e.anyOf?.some((e) => e.format) ? (e.anyOf ||= [], e.format && (e.anyOf.push({ format: e.format }), delete e.format), e.anyOf.push({
|
|
774
774
|
format: t,
|
|
775
775
|
...n && r.errorMessages && { errorMessage: { format: n } }
|
|
776
776
|
})) : e.format = t;
|
|
777
777
|
}
|
|
778
|
-
function
|
|
778
|
+
function K(e, t, n, r) {
|
|
779
779
|
e.pattern || e.allOf?.some((e) => e.pattern) ? (e.allOf ||= [], e.pattern && (e.allOf.push({ pattern: e.pattern }), delete e.pattern), e.allOf.push({
|
|
780
|
-
pattern:
|
|
780
|
+
pattern: wn(t, r),
|
|
781
781
|
...n && r.errorMessages && { errorMessage: { pattern: n } }
|
|
782
|
-
})) : e.pattern =
|
|
782
|
+
})) : e.pattern = wn(t, r);
|
|
783
783
|
}
|
|
784
|
-
function
|
|
784
|
+
function wn(e, t) {
|
|
785
785
|
if (!t.applyRegexFlags || !e.flags) return e.source;
|
|
786
786
|
let n = {
|
|
787
787
|
i: e.flags.includes("i"),
|
|
@@ -820,7 +820,7 @@ function Cn(e, t) {
|
|
|
820
820
|
}
|
|
821
821
|
return i;
|
|
822
822
|
}
|
|
823
|
-
function
|
|
823
|
+
function Tn(e, t) {
|
|
824
824
|
let n = {
|
|
825
825
|
type: "object",
|
|
826
826
|
additionalProperties: J(e.valueType._def, {
|
|
@@ -829,7 +829,7 @@ function wn(e, t) {
|
|
|
829
829
|
}) ?? t.allowedAdditionalProperties
|
|
830
830
|
};
|
|
831
831
|
if (e.keyType?._def.typeName === "ZodString" && e.keyType._def.checks?.length) {
|
|
832
|
-
let { type: r, ...i } =
|
|
832
|
+
let { type: r, ...i } = bn(e.keyType._def, t);
|
|
833
833
|
return {
|
|
834
834
|
...n,
|
|
835
835
|
propertyNames: i
|
|
@@ -840,7 +840,7 @@ function wn(e, t) {
|
|
|
840
840
|
propertyNames: { enum: e.keyType._def.values }
|
|
841
841
|
};
|
|
842
842
|
if (e.keyType?._def.typeName === "ZodBranded" && e.keyType._def.type._def.typeName === "ZodString" && e.keyType._def.type._def.checks?.length) {
|
|
843
|
-
let { type: r, ...i } =
|
|
843
|
+
let { type: r, ...i } = fn(e.keyType._def, t);
|
|
844
844
|
return {
|
|
845
845
|
...n,
|
|
846
846
|
propertyNames: i
|
|
@@ -848,8 +848,8 @@ function wn(e, t) {
|
|
|
848
848
|
}
|
|
849
849
|
return n;
|
|
850
850
|
}
|
|
851
|
-
function
|
|
852
|
-
return t.mapStrategy === "record" ?
|
|
851
|
+
function En(e, t) {
|
|
852
|
+
return t.mapStrategy === "record" ? Tn(e, t) : {
|
|
853
853
|
type: "array",
|
|
854
854
|
maxItems: 125,
|
|
855
855
|
items: {
|
|
@@ -862,7 +862,7 @@ function Tn(e, t) {
|
|
|
862
862
|
"items",
|
|
863
863
|
"0"
|
|
864
864
|
]
|
|
865
|
-
}) ||
|
|
865
|
+
}) || B(), J(e.valueType._def, {
|
|
866
866
|
...t,
|
|
867
867
|
currentPath: [
|
|
868
868
|
...t.currentPath,
|
|
@@ -870,37 +870,37 @@ function Tn(e, t) {
|
|
|
870
870
|
"items",
|
|
871
871
|
"1"
|
|
872
872
|
]
|
|
873
|
-
}) ||
|
|
873
|
+
}) || B()],
|
|
874
874
|
minItems: 2,
|
|
875
875
|
maxItems: 2
|
|
876
876
|
}
|
|
877
877
|
};
|
|
878
878
|
}
|
|
879
|
-
function
|
|
879
|
+
function Dn(e) {
|
|
880
880
|
let t = e.values, n = Object.keys(e.values).filter((e) => typeof t[t[e]] != "number").map((e) => t[e]), r = Array.from(new Set(n.map((e) => typeof e)));
|
|
881
881
|
return {
|
|
882
882
|
type: r.length === 1 ? r[0] === "string" ? "string" : "number" : ["string", "number"],
|
|
883
883
|
enum: n
|
|
884
884
|
};
|
|
885
885
|
}
|
|
886
|
-
function Dn() {
|
|
887
|
-
return { not: V() };
|
|
888
|
-
}
|
|
889
886
|
function On() {
|
|
887
|
+
return { not: B() };
|
|
888
|
+
}
|
|
889
|
+
function kn() {
|
|
890
890
|
return { type: "null" };
|
|
891
891
|
}
|
|
892
|
-
var
|
|
892
|
+
var An = {
|
|
893
893
|
ZodString: "string",
|
|
894
894
|
ZodNumber: "number",
|
|
895
895
|
ZodBigInt: "integer",
|
|
896
896
|
ZodBoolean: "boolean",
|
|
897
897
|
ZodNull: "null"
|
|
898
898
|
};
|
|
899
|
-
function
|
|
899
|
+
function jn(e, t) {
|
|
900
900
|
let n = e.options instanceof Map ? Array.from(e.options.values()) : e.options;
|
|
901
|
-
if (n.every((e) => e._def.typeName in
|
|
901
|
+
if (n.every((e) => e._def.typeName in An && (!e._def.checks || !e._def.checks.length))) {
|
|
902
902
|
let e = n.reduce((e, t) => {
|
|
903
|
-
let n =
|
|
903
|
+
let n = An[t._def.typeName];
|
|
904
904
|
return n && !e.includes(n) ? [...e, n] : e;
|
|
905
905
|
}, []);
|
|
906
906
|
return { type: e.length > 1 ? e : e[0] };
|
|
@@ -928,9 +928,9 @@ function An(e, t) {
|
|
|
928
928
|
type: "string",
|
|
929
929
|
enum: n.reduce((e, t) => [...e, ...t._def.values.filter((t) => !e.includes(t))], [])
|
|
930
930
|
};
|
|
931
|
-
return
|
|
931
|
+
return Mn(e, t);
|
|
932
932
|
}
|
|
933
|
-
var
|
|
933
|
+
var Mn = (e, t) => {
|
|
934
934
|
let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => J(e._def, {
|
|
935
935
|
...t,
|
|
936
936
|
currentPath: [
|
|
@@ -941,14 +941,14 @@ var jn = (e, t) => {
|
|
|
941
941
|
})).filter((e) => !!e && (!t.strictUnions || typeof e == "object" && Object.keys(e).length > 0));
|
|
942
942
|
return n.length ? { anyOf: n } : void 0;
|
|
943
943
|
};
|
|
944
|
-
function
|
|
944
|
+
function Nn(e, t) {
|
|
945
945
|
if ([
|
|
946
946
|
"ZodString",
|
|
947
947
|
"ZodNumber",
|
|
948
948
|
"ZodBigInt",
|
|
949
949
|
"ZodBoolean",
|
|
950
950
|
"ZodNull"
|
|
951
|
-
].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [
|
|
951
|
+
].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [An[e.innerType._def.typeName], "null"] };
|
|
952
952
|
let n = J(e.innerType._def, {
|
|
953
953
|
...t,
|
|
954
954
|
currentPath: [
|
|
@@ -959,7 +959,7 @@ function Mn(e, t) {
|
|
|
959
959
|
});
|
|
960
960
|
return n && { anyOf: [n, { type: "null" }] };
|
|
961
961
|
}
|
|
962
|
-
function
|
|
962
|
+
function q(e) {
|
|
963
963
|
let t = { type: "number" };
|
|
964
964
|
if (!e.checks) return t;
|
|
965
965
|
for (let n of e.checks) switch (n.kind) {
|
|
@@ -1031,7 +1031,7 @@ var Ln = (e, t) => {
|
|
|
1031
1031
|
"1"
|
|
1032
1032
|
]
|
|
1033
1033
|
});
|
|
1034
|
-
return n ? { anyOf: [{ not:
|
|
1034
|
+
return n ? { anyOf: [{ not: B() }, n] } : B();
|
|
1035
1035
|
}, Rn = (e, t) => {
|
|
1036
1036
|
if (t.pipeStrategy === "input") return J(e.in._def, t);
|
|
1037
1037
|
if (t.pipeStrategy === "output") return J(e.out._def, t);
|
|
@@ -1097,45 +1097,45 @@ function Vn(e, t) {
|
|
|
1097
1097
|
};
|
|
1098
1098
|
}
|
|
1099
1099
|
function Hn() {
|
|
1100
|
-
return { not:
|
|
1100
|
+
return { not: B() };
|
|
1101
1101
|
}
|
|
1102
1102
|
function Un() {
|
|
1103
|
-
return
|
|
1103
|
+
return B();
|
|
1104
1104
|
}
|
|
1105
1105
|
var Wn = (e, t) => J(e.innerType._def, t), Gn = (e, t, n) => {
|
|
1106
1106
|
switch (t) {
|
|
1107
|
-
case "ZodString": return
|
|
1108
|
-
case "ZodNumber": return
|
|
1107
|
+
case "ZodString": return bn(e, n);
|
|
1108
|
+
case "ZodNumber": return q(e);
|
|
1109
1109
|
case "ZodObject": return Pn(e, n);
|
|
1110
|
-
case "ZodBigInt": return
|
|
1111
|
-
case "ZodBoolean": return
|
|
1112
|
-
case "ZodDate": return
|
|
1110
|
+
case "ZodBigInt": return un(e);
|
|
1111
|
+
case "ZodBoolean": return dn();
|
|
1112
|
+
case "ZodDate": return mn(e, n);
|
|
1113
1113
|
case "ZodUndefined": return Hn();
|
|
1114
|
-
case "ZodNull": return
|
|
1115
|
-
case "ZodArray": return
|
|
1114
|
+
case "ZodNull": return kn();
|
|
1115
|
+
case "ZodArray": return ln(e, n);
|
|
1116
1116
|
case "ZodUnion":
|
|
1117
|
-
case "ZodDiscriminatedUnion": return
|
|
1118
|
-
case "ZodIntersection": return
|
|
1117
|
+
case "ZodDiscriminatedUnion": return jn(e, n);
|
|
1118
|
+
case "ZodIntersection": return _n(e, n);
|
|
1119
1119
|
case "ZodTuple": return Vn(e, n);
|
|
1120
|
-
case "ZodRecord": return
|
|
1121
|
-
case "ZodLiteral": return
|
|
1122
|
-
case "ZodEnum": return
|
|
1123
|
-
case "ZodNativeEnum": return
|
|
1124
|
-
case "ZodNullable": return
|
|
1120
|
+
case "ZodRecord": return Tn(e, n);
|
|
1121
|
+
case "ZodLiteral": return vn(e);
|
|
1122
|
+
case "ZodEnum": return hn(e);
|
|
1123
|
+
case "ZodNativeEnum": return Dn(e);
|
|
1124
|
+
case "ZodNullable": return Nn(e, n);
|
|
1125
1125
|
case "ZodOptional": return Ln(e, n);
|
|
1126
|
-
case "ZodMap": return
|
|
1126
|
+
case "ZodMap": return En(e, n);
|
|
1127
1127
|
case "ZodSet": return Bn(e, n);
|
|
1128
1128
|
case "ZodLazy": return () => e.getter()._def;
|
|
1129
1129
|
case "ZodPromise": return zn(e, n);
|
|
1130
1130
|
case "ZodNaN":
|
|
1131
|
-
case "ZodNever": return
|
|
1132
|
-
case "ZodEffects": return
|
|
1133
|
-
case "ZodAny": return
|
|
1131
|
+
case "ZodNever": return On();
|
|
1132
|
+
case "ZodEffects": return U(e, n);
|
|
1133
|
+
case "ZodAny": return B();
|
|
1134
1134
|
case "ZodUnknown": return Un();
|
|
1135
|
-
case "ZodDefault": return
|
|
1136
|
-
case "ZodBranded": return
|
|
1135
|
+
case "ZodDefault": return H(e, n);
|
|
1136
|
+
case "ZodBranded": return fn(e, n);
|
|
1137
1137
|
case "ZodReadonly": return Wn(e, n);
|
|
1138
|
-
case "ZodCatch": return
|
|
1138
|
+
case "ZodCatch": return pn(e, n);
|
|
1139
1139
|
case "ZodPipeline": return Rn(e, n);
|
|
1140
1140
|
case "ZodFunction":
|
|
1141
1141
|
case "ZodVoid":
|
|
@@ -1153,7 +1153,7 @@ function J(e, t, n = !1) {
|
|
|
1153
1153
|
let r = t.seen.get(e);
|
|
1154
1154
|
if (t.override) {
|
|
1155
1155
|
let i = t.override?.(e, t, r, n);
|
|
1156
|
-
if (i !==
|
|
1156
|
+
if (i !== on) return i;
|
|
1157
1157
|
}
|
|
1158
1158
|
if (r && !n) {
|
|
1159
1159
|
let e = qn(r, t);
|
|
@@ -1177,10 +1177,10 @@ var qn = (e, t) => {
|
|
|
1177
1177
|
case "root": return { $ref: e.path.join("/") };
|
|
1178
1178
|
case "relative": return { $ref: Kn(t.currentPath, e.path) };
|
|
1179
1179
|
case "none":
|
|
1180
|
-
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`),
|
|
1180
|
+
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`), B()) : t.$refStrategy === "seen" ? B() : void 0;
|
|
1181
1181
|
}
|
|
1182
1182
|
}, Jn = (e, t, n) => (e.description && (n.description = e.description), n), Yn = (e) => {
|
|
1183
|
-
let t =
|
|
1183
|
+
let t = cn(e), n = t.name === void 0 ? t.basePath : [
|
|
1184
1184
|
...t.basePath,
|
|
1185
1185
|
t.definitionPath,
|
|
1186
1186
|
t.name
|
|
@@ -1209,7 +1209,7 @@ var qn = (e, t) => {
|
|
|
1209
1209
|
n.definitionPath,
|
|
1210
1210
|
t
|
|
1211
1211
|
]
|
|
1212
|
-
}, !0) ??
|
|
1212
|
+
}, !0) ?? B()
|
|
1213
1213
|
}), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = J(e._def, i === void 0 ? n : {
|
|
1214
1214
|
...n,
|
|
1215
1215
|
currentPath: [
|
|
@@ -1217,7 +1217,7 @@ var qn = (e, t) => {
|
|
|
1217
1217
|
n.definitionPath,
|
|
1218
1218
|
i
|
|
1219
1219
|
]
|
|
1220
|
-
}, !1) ??
|
|
1220
|
+
}, !1) ?? B(), o = typeof t == "object" && t.name !== void 0 && t.nameStrategy === "title" ? t.name : void 0;
|
|
1221
1221
|
o !== void 0 && (a.title = o);
|
|
1222
1222
|
let s = i === void 0 ? r ? {
|
|
1223
1223
|
...a,
|
|
@@ -1262,15 +1262,15 @@ function tr(e) {
|
|
|
1262
1262
|
function nr(e) {
|
|
1263
1263
|
return $n(() => {
|
|
1264
1264
|
if (!rr(e)) throw Error(`Standard schema vendor '${e["~standard"].vendor}' does not support JSON Schema conversion.`);
|
|
1265
|
-
return
|
|
1265
|
+
return R(e["~standard"].jsonSchema.input({ target: "draft-07" }));
|
|
1266
1266
|
}, { validate: async (t) => {
|
|
1267
1267
|
let n = await e["~standard"].validate(t);
|
|
1268
|
-
return "value" in n ? {
|
|
1268
|
+
return n.issues === void 0 && "value" in n ? {
|
|
1269
1269
|
success: !0,
|
|
1270
1270
|
value: n.value
|
|
1271
1271
|
} : {
|
|
1272
1272
|
success: !1,
|
|
1273
|
-
error: new
|
|
1273
|
+
error: new Pt({
|
|
1274
1274
|
value: t,
|
|
1275
1275
|
cause: n.issues
|
|
1276
1276
|
})
|
|
@@ -1294,9 +1294,9 @@ function ir(e, t) {
|
|
|
1294
1294
|
} });
|
|
1295
1295
|
}
|
|
1296
1296
|
function ar(e, t) {
|
|
1297
|
-
|
|
1297
|
+
fe().localeError || fe(ee());
|
|
1298
1298
|
let n = t?.useReferences ?? !1;
|
|
1299
|
-
return $n(() =>
|
|
1299
|
+
return $n(() => R(i(e, {
|
|
1300
1300
|
target: "draft-7",
|
|
1301
1301
|
io: "input",
|
|
1302
1302
|
reused: n ? "ref" : "inline"
|
|
@@ -1323,7 +1323,7 @@ async function cr({ value: e, schema: t, context: n }) {
|
|
|
1323
1323
|
schema: t,
|
|
1324
1324
|
context: n
|
|
1325
1325
|
});
|
|
1326
|
-
if (!r.success) throw
|
|
1326
|
+
if (!r.success) throw Pt.wrap({
|
|
1327
1327
|
value: e,
|
|
1328
1328
|
cause: r.error,
|
|
1329
1329
|
context: n
|
|
@@ -1345,7 +1345,7 @@ async function lr({ value: e, schema: t, context: n }) {
|
|
|
1345
1345
|
rawValue: e
|
|
1346
1346
|
} : {
|
|
1347
1347
|
success: !1,
|
|
1348
|
-
error:
|
|
1348
|
+
error: Pt.wrap({
|
|
1349
1349
|
value: e,
|
|
1350
1350
|
cause: t.error,
|
|
1351
1351
|
context: n
|
|
@@ -1355,7 +1355,7 @@ async function lr({ value: e, schema: t, context: n }) {
|
|
|
1355
1355
|
} catch (t) {
|
|
1356
1356
|
return {
|
|
1357
1357
|
success: !1,
|
|
1358
|
-
error:
|
|
1358
|
+
error: Pt.wrap({
|
|
1359
1359
|
value: e,
|
|
1360
1360
|
cause: t,
|
|
1361
1361
|
context: n
|
|
@@ -1366,7 +1366,7 @@ async function lr({ value: e, schema: t, context: n }) {
|
|
|
1366
1366
|
}
|
|
1367
1367
|
async function ur({ text: e, schema: t }) {
|
|
1368
1368
|
try {
|
|
1369
|
-
let n =
|
|
1369
|
+
let n = an(e);
|
|
1370
1370
|
return t == null ? {
|
|
1371
1371
|
success: !0,
|
|
1372
1372
|
value: n,
|
|
@@ -1378,7 +1378,7 @@ async function ur({ text: e, schema: t }) {
|
|
|
1378
1378
|
} catch (t) {
|
|
1379
1379
|
return {
|
|
1380
1380
|
success: !1,
|
|
1381
|
-
error:
|
|
1381
|
+
error: Mt.isInstance(t) ? t : new Mt({
|
|
1382
1382
|
text: e,
|
|
1383
1383
|
cause: t
|
|
1384
1384
|
}),
|
|
@@ -1387,7 +1387,7 @@ async function ur({ text: e, schema: t }) {
|
|
|
1387
1387
|
}
|
|
1388
1388
|
}
|
|
1389
1389
|
function dr({ stream: e, schema: t }) {
|
|
1390
|
-
return e.pipeThrough(new TextDecoderStream()).pipeThrough(new
|
|
1390
|
+
return e.pipeThrough(new TextDecoderStream()).pipeThrough(new Kt()).pipeThrough(new TransformStream({ async transform({ data: e }, n) {
|
|
1391
1391
|
e !== "[DONE]" && n.enqueue(await ur({
|
|
1392
1392
|
text: e,
|
|
1393
1393
|
schema: t
|
|
@@ -1399,27 +1399,27 @@ async function fr(e) {
|
|
|
1399
1399
|
}
|
|
1400
1400
|
new TextDecoder();
|
|
1401
1401
|
// ../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/mini/schemas.js
|
|
1402
|
-
var Y = /*@__PURE__*/
|
|
1402
|
+
var Y = /*@__PURE__*/ x("ZodMiniType", (e, t) => {
|
|
1403
1403
|
if (!e._zod) throw Error("Uninitialized schema in ZodMiniType.");
|
|
1404
|
-
|
|
1404
|
+
oe.init(e, t), e.def = t, e.type = t.type;
|
|
1405
1405
|
}, {
|
|
1406
1406
|
get with() {
|
|
1407
1407
|
return this.check;
|
|
1408
1408
|
},
|
|
1409
1409
|
set with(e) {
|
|
1410
|
-
|
|
1410
|
+
Me(this, "with", e);
|
|
1411
1411
|
},
|
|
1412
1412
|
parse(e, t) {
|
|
1413
|
-
return
|
|
1413
|
+
return ce(this, e, t, { callee: this.parse });
|
|
1414
1414
|
},
|
|
1415
1415
|
parseAsync(e, t) {
|
|
1416
|
-
return
|
|
1416
|
+
return ye(this, e, t, { callee: this.parseAsync });
|
|
1417
1417
|
},
|
|
1418
1418
|
safeParse(e, t) {
|
|
1419
|
-
return
|
|
1419
|
+
return ke(this, e, t);
|
|
1420
1420
|
},
|
|
1421
1421
|
safeParseAsync(e, t) {
|
|
1422
|
-
return
|
|
1422
|
+
return le(this, e, t);
|
|
1423
1423
|
},
|
|
1424
1424
|
check(...e) {
|
|
1425
1425
|
let t = this.def;
|
|
@@ -1433,7 +1433,7 @@ var Y = /*@__PURE__*/ S("ZodMiniType", (e, t) => {
|
|
|
1433
1433
|
}, { parent: !0 });
|
|
1434
1434
|
},
|
|
1435
1435
|
clone(e, t) {
|
|
1436
|
-
return
|
|
1436
|
+
return ie(this, e, t);
|
|
1437
1437
|
},
|
|
1438
1438
|
brand() {
|
|
1439
1439
|
return this;
|
|
@@ -1444,67 +1444,67 @@ var Y = /*@__PURE__*/ S("ZodMiniType", (e, t) => {
|
|
|
1444
1444
|
apply(e, ...t) {
|
|
1445
1445
|
return t.length === 0 ? e(this) : e(this, ...t);
|
|
1446
1446
|
}
|
|
1447
|
-
}), pr = /*@__PURE__*/
|
|
1448
|
-
|
|
1447
|
+
}), pr = /*@__PURE__*/ x("ZodMiniString", (e, t) => {
|
|
1448
|
+
we.init(e, t), Y.init(e, t);
|
|
1449
1449
|
});
|
|
1450
1450
|
// @__NO_SIDE_EFFECTS__
|
|
1451
1451
|
function mr(e) {
|
|
1452
1452
|
return n(pr, e);
|
|
1453
1453
|
}
|
|
1454
|
-
var hr = /*@__PURE__*/
|
|
1455
|
-
|
|
1454
|
+
var hr = /*@__PURE__*/ x("ZodMiniNumber", (e, t) => {
|
|
1455
|
+
re.init(e, t), Y.init(e, t);
|
|
1456
1456
|
});
|
|
1457
1457
|
// @__NO_SIDE_EFFECTS__
|
|
1458
1458
|
function gr(e) {
|
|
1459
1459
|
return c(hr, e);
|
|
1460
1460
|
}
|
|
1461
|
-
var _r = /*@__PURE__*/
|
|
1461
|
+
var _r = /*@__PURE__*/ x("ZodMiniNumberFormat", (e, t) => {
|
|
1462
1462
|
h.init(e, t), hr.init(e, t);
|
|
1463
1463
|
});
|
|
1464
1464
|
function vr(e) {
|
|
1465
1465
|
return t(_r, e);
|
|
1466
1466
|
}
|
|
1467
|
-
var yr = /*@__PURE__*/
|
|
1467
|
+
var yr = /*@__PURE__*/ x("ZodMiniBoolean", (e, t) => {
|
|
1468
1468
|
o.init(e, t), Y.init(e, t);
|
|
1469
1469
|
});
|
|
1470
1470
|
// @__NO_SIDE_EFFECTS__
|
|
1471
1471
|
function br(e) {
|
|
1472
1472
|
return r(yr, e);
|
|
1473
1473
|
}
|
|
1474
|
-
var xr = /*@__PURE__*/
|
|
1475
|
-
|
|
1474
|
+
var xr = /*@__PURE__*/ x("ZodMiniUnknown", (e, t) => {
|
|
1475
|
+
Ee.init(e, t), Y.init(e, t);
|
|
1476
1476
|
});
|
|
1477
1477
|
// @__NO_SIDE_EFFECTS__
|
|
1478
1478
|
function Sr() {
|
|
1479
1479
|
return s(xr);
|
|
1480
1480
|
}
|
|
1481
|
-
var Cr = /*@__PURE__*/
|
|
1482
|
-
|
|
1481
|
+
var Cr = /*@__PURE__*/ x("ZodMiniNever", (e, t) => {
|
|
1482
|
+
te.init(e, t), Y.init(e, t);
|
|
1483
1483
|
});
|
|
1484
1484
|
// @__NO_SIDE_EFFECTS__
|
|
1485
1485
|
function wr(e) {
|
|
1486
1486
|
return m(Cr, e);
|
|
1487
1487
|
}
|
|
1488
|
-
var Tr = /*@__PURE__*/
|
|
1489
|
-
|
|
1488
|
+
var Tr = /*@__PURE__*/ x("ZodMiniArray", (e, t) => {
|
|
1489
|
+
y.init(e, t), Y.init(e, t);
|
|
1490
1490
|
});
|
|
1491
1491
|
// @__NO_SIDE_EFFECTS__
|
|
1492
1492
|
function Er(e, t) {
|
|
1493
1493
|
return new Tr({
|
|
1494
1494
|
type: "array",
|
|
1495
1495
|
element: e,
|
|
1496
|
-
...
|
|
1496
|
+
...b(t)
|
|
1497
1497
|
});
|
|
1498
1498
|
}
|
|
1499
|
-
var Dr = /*@__PURE__*/
|
|
1500
|
-
e.init(t, n), Y.init(t, n),
|
|
1499
|
+
var Dr = /*@__PURE__*/ x("ZodMiniObject", (t, n) => {
|
|
1500
|
+
e.init(t, n), Y.init(t, n), Pe(t, "shape", (e) => e._zod.def.shape, !1);
|
|
1501
1501
|
});
|
|
1502
1502
|
// @__NO_SIDE_EFFECTS__
|
|
1503
1503
|
function Or(e, t) {
|
|
1504
1504
|
return new Dr({
|
|
1505
1505
|
type: "object",
|
|
1506
1506
|
shape: e ?? {},
|
|
1507
|
-
...
|
|
1507
|
+
...b(t)
|
|
1508
1508
|
});
|
|
1509
1509
|
}
|
|
1510
1510
|
// @__NO_SIDE_EFFECTS__
|
|
@@ -1513,26 +1513,26 @@ function kr(e, t) {
|
|
|
1513
1513
|
type: "object",
|
|
1514
1514
|
shape: e,
|
|
1515
1515
|
catchall: /* @__PURE__ */ Sr(),
|
|
1516
|
-
...
|
|
1516
|
+
...b(t)
|
|
1517
1517
|
});
|
|
1518
1518
|
}
|
|
1519
1519
|
// @__NO_SIDE_EFFECTS__
|
|
1520
1520
|
function Ar(e, t) {
|
|
1521
|
-
return
|
|
1521
|
+
return Ae(e, t);
|
|
1522
1522
|
}
|
|
1523
|
-
var jr = /*@__PURE__*/
|
|
1524
|
-
|
|
1523
|
+
var jr = /*@__PURE__*/ x("ZodMiniUnion", (e, t) => {
|
|
1524
|
+
Se.init(e, t), Y.init(e, t);
|
|
1525
1525
|
});
|
|
1526
1526
|
// @__NO_SIDE_EFFECTS__
|
|
1527
1527
|
function Mr(e, t) {
|
|
1528
1528
|
return new jr({
|
|
1529
1529
|
type: "union",
|
|
1530
1530
|
options: e,
|
|
1531
|
-
...
|
|
1531
|
+
...b(t)
|
|
1532
1532
|
});
|
|
1533
1533
|
}
|
|
1534
|
-
var Nr = /*@__PURE__*/
|
|
1535
|
-
|
|
1534
|
+
var Nr = /*@__PURE__*/ x("ZodMiniDiscriminatedUnion", (e, t) => {
|
|
1535
|
+
Ce.init(e, t), Y.init(e, t);
|
|
1536
1536
|
});
|
|
1537
1537
|
// @__NO_SIDE_EFFECTS__
|
|
1538
1538
|
function Pr(e, t, n) {
|
|
@@ -1540,11 +1540,11 @@ function Pr(e, t, n) {
|
|
|
1540
1540
|
type: "union",
|
|
1541
1541
|
options: t,
|
|
1542
1542
|
discriminator: e,
|
|
1543
|
-
...
|
|
1543
|
+
...b(n)
|
|
1544
1544
|
});
|
|
1545
1545
|
}
|
|
1546
|
-
var Fr = /*@__PURE__*/
|
|
1547
|
-
|
|
1546
|
+
var Fr = /*@__PURE__*/ x("ZodMiniRecord", (e, t) => {
|
|
1547
|
+
S.init(e, t), Y.init(e, t);
|
|
1548
1548
|
});
|
|
1549
1549
|
// @__NO_SIDE_EFFECTS__
|
|
1550
1550
|
function Ir(e, t, n) {
|
|
@@ -1552,15 +1552,15 @@ function Ir(e, t, n) {
|
|
|
1552
1552
|
type: "record",
|
|
1553
1553
|
keyType: /* @__PURE__ */ mr(),
|
|
1554
1554
|
valueType: e,
|
|
1555
|
-
...
|
|
1555
|
+
...b(t)
|
|
1556
1556
|
}) : new Fr({
|
|
1557
1557
|
type: "record",
|
|
1558
1558
|
keyType: e,
|
|
1559
1559
|
valueType: t,
|
|
1560
|
-
...
|
|
1560
|
+
...b(n)
|
|
1561
1561
|
});
|
|
1562
1562
|
}
|
|
1563
|
-
var Lr = /*@__PURE__*/
|
|
1563
|
+
var Lr = /*@__PURE__*/ x("ZodMiniEnum", (e, t) => {
|
|
1564
1564
|
l.init(e, t), Y.init(e, t), e.options = [...e._zod.values];
|
|
1565
1565
|
});
|
|
1566
1566
|
// @__NO_SIDE_EFFECTS__
|
|
@@ -1568,22 +1568,22 @@ function Rr(e, t) {
|
|
|
1568
1568
|
return new Lr({
|
|
1569
1569
|
type: "enum",
|
|
1570
1570
|
entries: Array.isArray(e) ? Object.fromEntries(e.map((e) => [e, e])) : e,
|
|
1571
|
-
...
|
|
1571
|
+
...b(t)
|
|
1572
1572
|
});
|
|
1573
1573
|
}
|
|
1574
|
-
var zr = /*@__PURE__*/
|
|
1575
|
-
|
|
1574
|
+
var zr = /*@__PURE__*/ x("ZodMiniLiteral", (e, t) => {
|
|
1575
|
+
ne.init(e, t), Y.init(e, t);
|
|
1576
1576
|
});
|
|
1577
1577
|
// @__NO_SIDE_EFFECTS__
|
|
1578
1578
|
function Br(e, t) {
|
|
1579
1579
|
return new zr({
|
|
1580
1580
|
type: "literal",
|
|
1581
1581
|
values: Array.isArray(e) ? e : [e],
|
|
1582
|
-
...
|
|
1582
|
+
...b(t)
|
|
1583
1583
|
});
|
|
1584
1584
|
}
|
|
1585
|
-
var Vr = /*@__PURE__*/
|
|
1586
|
-
|
|
1585
|
+
var Vr = /*@__PURE__*/ x("ZodMiniTransform", (e, t) => {
|
|
1586
|
+
ge.init(e, t), Y.init(e, t);
|
|
1587
1587
|
});
|
|
1588
1588
|
// @__NO_SIDE_EFFECTS__
|
|
1589
1589
|
function Hr(e) {
|
|
@@ -1592,8 +1592,8 @@ function Hr(e) {
|
|
|
1592
1592
|
transform: e
|
|
1593
1593
|
});
|
|
1594
1594
|
}
|
|
1595
|
-
var Ur = /*@__PURE__*/
|
|
1596
|
-
|
|
1595
|
+
var Ur = /*@__PURE__*/ x("ZodMiniOptional", (e, t) => {
|
|
1596
|
+
ue.init(e, t), Y.init(e, t);
|
|
1597
1597
|
});
|
|
1598
1598
|
// @__NO_SIDE_EFFECTS__
|
|
1599
1599
|
function Wr(e) {
|
|
@@ -1602,8 +1602,8 @@ function Wr(e) {
|
|
|
1602
1602
|
innerType: e
|
|
1603
1603
|
});
|
|
1604
1604
|
}
|
|
1605
|
-
var Gr = /*@__PURE__*/
|
|
1606
|
-
|
|
1605
|
+
var Gr = /*@__PURE__*/ x("ZodMiniPipe", (e, t) => {
|
|
1606
|
+
De.init(e, t), Y.init(e, t);
|
|
1607
1607
|
});
|
|
1608
1608
|
// @__NO_SIDE_EFFECTS__
|
|
1609
1609
|
function Kr(e, t) {
|
|
@@ -1613,19 +1613,19 @@ function Kr(e, t) {
|
|
|
1613
1613
|
out: t
|
|
1614
1614
|
});
|
|
1615
1615
|
}
|
|
1616
|
-
var qr = /*@__PURE__*/
|
|
1616
|
+
var qr = /*@__PURE__*/ x("ZodMiniCustom", (e, t) => {
|
|
1617
1617
|
u.init(e, t), Y.init(e, t);
|
|
1618
1618
|
});
|
|
1619
1619
|
// @__NO_SIDE_EFFECTS__
|
|
1620
1620
|
function Jr(e, t) {
|
|
1621
|
-
return
|
|
1621
|
+
return _e(qr, e ?? (() => !0), t);
|
|
1622
1622
|
}
|
|
1623
1623
|
// @__NO_SIDE_EFFECTS__
|
|
1624
1624
|
function Yr(e, t = {}) {
|
|
1625
1625
|
return g(qr, e, t);
|
|
1626
1626
|
}
|
|
1627
|
-
// ../../node_modules/.pnpm/ai@7.0.
|
|
1628
|
-
var Xr = "AI_InvalidArgumentError", Zr = `vercel.ai.error.${Xr}`, Qr = Symbol.for(Zr), $r = class extends
|
|
1627
|
+
// ../../node_modules/.pnpm/ai@7.0.176_zod@4.6.7/node_modules/ai/dist/index.js
|
|
1628
|
+
var Xr = "AI_InvalidArgumentError", Zr = `vercel.ai.error.${Xr}`, Qr = Symbol.for(Zr), $r = class extends A {
|
|
1629
1629
|
constructor({ parameter: e, value: t, message: n }) {
|
|
1630
1630
|
super({
|
|
1631
1631
|
name: Xr,
|
|
@@ -1633,9 +1633,9 @@ var Xr = "AI_InvalidArgumentError", Zr = `vercel.ai.error.${Xr}`, Qr = Symbol.fo
|
|
|
1633
1633
|
}), this[Qr] = !0, this.parameter = e, this.value = t;
|
|
1634
1634
|
}
|
|
1635
1635
|
static isInstance(e) {
|
|
1636
|
-
return
|
|
1636
|
+
return A.hasMarker(e, Zr);
|
|
1637
1637
|
}
|
|
1638
|
-
}, ei = "AI_UIMessageStreamError", ti = `vercel.ai.error.${ei}`, ni = Symbol.for(ti), ri = class extends
|
|
1638
|
+
}, ei = "AI_UIMessageStreamError", ti = `vercel.ai.error.${ei}`, ni = Symbol.for(ti), ri = class extends A {
|
|
1639
1639
|
constructor({ chunkType: e, chunkId: t, message: n }) {
|
|
1640
1640
|
super({
|
|
1641
1641
|
name: ei,
|
|
@@ -1643,7 +1643,7 @@ var Xr = "AI_InvalidArgumentError", Zr = `vercel.ai.error.${Xr}`, Qr = Symbol.fo
|
|
|
1643
1643
|
}), this[ni] = !0, this.chunkType = e, this.chunkId = t;
|
|
1644
1644
|
}
|
|
1645
1645
|
static isInstance(e) {
|
|
1646
|
-
return
|
|
1646
|
+
return A.hasMarker(e, ti);
|
|
1647
1647
|
}
|
|
1648
1648
|
};
|
|
1649
1649
|
function ii(e, t) {
|
|
@@ -1858,18 +1858,18 @@ async function oi(e) {
|
|
|
1858
1858
|
state: "failed-parse"
|
|
1859
1859
|
});
|
|
1860
1860
|
}
|
|
1861
|
-
|
|
1861
|
+
I({
|
|
1862
1862
|
prefix: "steer",
|
|
1863
1863
|
size: 24
|
|
1864
|
-
}), new TextEncoder(), new TextEncoder(),
|
|
1864
|
+
}), new TextEncoder(), new TextEncoder(), I({
|
|
1865
1865
|
prefix: "aitxt",
|
|
1866
1866
|
size: 24
|
|
1867
|
-
}),
|
|
1867
|
+
}), I({
|
|
1868
1868
|
prefix: "call",
|
|
1869
1869
|
size: 24
|
|
1870
1870
|
}), TransformStream;
|
|
1871
1871
|
var X = {
|
|
1872
|
-
NEVER:
|
|
1872
|
+
NEVER: me,
|
|
1873
1873
|
array: Er,
|
|
1874
1874
|
boolean: br,
|
|
1875
1875
|
custom: Jr,
|
|
@@ -1890,26 +1890,26 @@ var X = {
|
|
|
1890
1890
|
positive: d,
|
|
1891
1891
|
record: Ir,
|
|
1892
1892
|
refine: Yr,
|
|
1893
|
-
safeParse:
|
|
1894
|
-
startsWith:
|
|
1893
|
+
safeParse: ke,
|
|
1894
|
+
startsWith: Fe,
|
|
1895
1895
|
string: mr,
|
|
1896
1896
|
transform: Hr,
|
|
1897
1897
|
union: Mr,
|
|
1898
1898
|
unknown: Sr
|
|
1899
1899
|
}, Z = {
|
|
1900
|
-
array:
|
|
1901
|
-
boolean:
|
|
1902
|
-
custom:
|
|
1903
|
-
discriminatedUnion:
|
|
1904
|
-
instanceof:
|
|
1905
|
-
lazy:
|
|
1906
|
-
literal:
|
|
1907
|
-
null:
|
|
1908
|
-
number:
|
|
1909
|
-
object:
|
|
1910
|
-
record:
|
|
1911
|
-
string:
|
|
1912
|
-
union:
|
|
1900
|
+
array: xe,
|
|
1901
|
+
boolean: Te,
|
|
1902
|
+
custom: ve,
|
|
1903
|
+
discriminatedUnion: Oe,
|
|
1904
|
+
instanceof: he,
|
|
1905
|
+
lazy: C,
|
|
1906
|
+
literal: be,
|
|
1907
|
+
null: ae,
|
|
1908
|
+
number: pe,
|
|
1909
|
+
object: de,
|
|
1910
|
+
record: Ne,
|
|
1911
|
+
string: se,
|
|
1912
|
+
union: je,
|
|
1913
1913
|
unknown: _
|
|
1914
1914
|
}, si = Z.lazy(() => Z.union([
|
|
1915
1915
|
Z.null(),
|
|
@@ -1918,27 +1918,31 @@ var X = {
|
|
|
1918
1918
|
Z.boolean(),
|
|
1919
1919
|
Z.record(Z.string(), si.optional()),
|
|
1920
1920
|
Z.array(si)
|
|
1921
|
-
])), Q = Z.record(Z.string(), Z.record(Z.string(), si.optional()))
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1921
|
+
])), Q = Z.record(Z.string(), Z.record(Z.string(), si.optional()));
|
|
1922
|
+
function ci(e) {
|
|
1923
|
+
return X.object({
|
|
1924
|
+
source: X.discriminatedUnion("sourceType", [X.object({
|
|
1925
|
+
type: X.literal("source"),
|
|
1926
|
+
sourceType: X.literal("url"),
|
|
1927
|
+
id: X.string(),
|
|
1928
|
+
url: X.string(),
|
|
1929
|
+
title: X.optional(X.string()),
|
|
1930
|
+
providerMetadata: X.optional(e)
|
|
1931
|
+
}), X.object({
|
|
1932
|
+
type: X.literal("source"),
|
|
1933
|
+
sourceType: X.literal("document"),
|
|
1934
|
+
id: X.string(),
|
|
1935
|
+
mediaType: X.string(),
|
|
1936
|
+
title: X.string(),
|
|
1937
|
+
filename: X.optional(X.string()),
|
|
1938
|
+
providerMetadata: X.optional(e)
|
|
1939
|
+
})]),
|
|
1940
|
+
startIndex: X.optional(X.number().check(X.int()).check(X.nonnegative())),
|
|
1941
|
+
endIndex: X.optional(X.number().check(X.int()).check(X.nonnegative())),
|
|
1942
|
+
citedText: X.optional(X.string())
|
|
1943
|
+
});
|
|
1944
|
+
}
|
|
1945
|
+
var li = ci(Q), ui = X.record(X.string(), X.optional(si)), di = Qn(() => sr(X.union([
|
|
1942
1946
|
X.looseObject({
|
|
1943
1947
|
type: X.literal("text-start"),
|
|
1944
1948
|
id: X.string(),
|
|
@@ -1953,7 +1957,7 @@ var X = {
|
|
|
1953
1957
|
X.looseObject({
|
|
1954
1958
|
type: X.literal("text-end"),
|
|
1955
1959
|
id: X.string(),
|
|
1956
|
-
citations: X.optional(X.array(
|
|
1960
|
+
citations: X.optional(X.array(li)),
|
|
1957
1961
|
providerMetadata: X.optional(Q)
|
|
1958
1962
|
}),
|
|
1959
1963
|
X.looseObject({
|
|
@@ -1967,7 +1971,7 @@ var X = {
|
|
|
1967
1971
|
inputEncoding: X.optional(X.enum(["json", "text"])),
|
|
1968
1972
|
providerExecuted: X.optional(X.boolean()),
|
|
1969
1973
|
providerMetadata: X.optional(Q),
|
|
1970
|
-
toolMetadata: X.optional(
|
|
1974
|
+
toolMetadata: X.optional(ui),
|
|
1971
1975
|
dynamic: X.optional(X.boolean()),
|
|
1972
1976
|
title: X.optional(X.string())
|
|
1973
1977
|
}),
|
|
@@ -1983,7 +1987,7 @@ var X = {
|
|
|
1983
1987
|
input: X.unknown(),
|
|
1984
1988
|
providerExecuted: X.optional(X.boolean()),
|
|
1985
1989
|
providerMetadata: X.optional(Q),
|
|
1986
|
-
toolMetadata: X.optional(
|
|
1990
|
+
toolMetadata: X.optional(ui),
|
|
1987
1991
|
dynamic: X.optional(X.boolean()),
|
|
1988
1992
|
title: X.optional(X.string())
|
|
1989
1993
|
}),
|
|
@@ -1994,7 +1998,7 @@ var X = {
|
|
|
1994
1998
|
input: X.unknown(),
|
|
1995
1999
|
providerExecuted: X.optional(X.boolean()),
|
|
1996
2000
|
providerMetadata: X.optional(Q),
|
|
1997
|
-
toolMetadata: X.optional(
|
|
2001
|
+
toolMetadata: X.optional(ui),
|
|
1998
2002
|
dynamic: X.optional(X.boolean()),
|
|
1999
2003
|
errorText: X.string(),
|
|
2000
2004
|
title: X.optional(X.string())
|
|
@@ -2023,7 +2027,7 @@ var X = {
|
|
|
2023
2027
|
output: X.unknown(),
|
|
2024
2028
|
providerExecuted: X.optional(X.boolean()),
|
|
2025
2029
|
providerMetadata: X.optional(Q),
|
|
2026
|
-
toolMetadata: X.optional(
|
|
2030
|
+
toolMetadata: X.optional(ui),
|
|
2027
2031
|
dynamic: X.optional(X.boolean()),
|
|
2028
2032
|
preliminary: X.optional(X.boolean())
|
|
2029
2033
|
}),
|
|
@@ -2033,7 +2037,7 @@ var X = {
|
|
|
2033
2037
|
errorText: X.string(),
|
|
2034
2038
|
providerExecuted: X.optional(X.boolean()),
|
|
2035
2039
|
providerMetadata: X.optional(Q),
|
|
2036
|
-
toolMetadata: X.optional(
|
|
2040
|
+
toolMetadata: X.optional(ui),
|
|
2037
2041
|
dynamic: X.optional(X.boolean())
|
|
2038
2042
|
}),
|
|
2039
2043
|
X.looseObject({
|
|
@@ -2140,39 +2144,39 @@ var X = {
|
|
|
2140
2144
|
messageMetadata: X.unknown()
|
|
2141
2145
|
})
|
|
2142
2146
|
])));
|
|
2143
|
-
function
|
|
2147
|
+
function fi(e) {
|
|
2144
2148
|
return e.type.startsWith("data-");
|
|
2145
2149
|
}
|
|
2146
|
-
function
|
|
2150
|
+
function pi() {
|
|
2147
2151
|
return Object.create(null);
|
|
2148
2152
|
}
|
|
2149
|
-
function
|
|
2153
|
+
function mi(e) {
|
|
2150
2154
|
return e.type.startsWith("tool-");
|
|
2151
2155
|
}
|
|
2152
|
-
function
|
|
2156
|
+
function hi(e) {
|
|
2153
2157
|
return e.type === "dynamic-tool";
|
|
2154
2158
|
}
|
|
2155
2159
|
function $(e) {
|
|
2156
|
-
return
|
|
2160
|
+
return mi(e) || hi(e);
|
|
2157
2161
|
}
|
|
2158
|
-
function
|
|
2162
|
+
function gi(e) {
|
|
2159
2163
|
return e.type.split("-").slice(1).join("-");
|
|
2160
2164
|
}
|
|
2161
|
-
function
|
|
2165
|
+
function _i({ lastMessage: e, messageId: t }) {
|
|
2162
2166
|
let n = e?.role === "assistant" ? e : {
|
|
2163
2167
|
id: t,
|
|
2164
2168
|
metadata: void 0,
|
|
2165
2169
|
role: "assistant",
|
|
2166
2170
|
parts: []
|
|
2167
|
-
}, r =
|
|
2171
|
+
}, r = pi(), i = n.parts.findLastIndex((e) => e.type === "step-start"), a = 0;
|
|
2168
2172
|
for (let e of n.parts.slice(i + 1)) {
|
|
2169
2173
|
if (!$(e)) continue;
|
|
2170
2174
|
let t = a;
|
|
2171
|
-
|
|
2175
|
+
mi(e) && a++, e.state === "input-streaming" && (r[e.toolCallId] = {
|
|
2172
2176
|
text: e.rawInput ?? "",
|
|
2173
2177
|
inputEncoding: e.inputEncoding,
|
|
2174
2178
|
index: t,
|
|
2175
|
-
toolName: e.type === "dynamic-tool" ? e.toolName :
|
|
2179
|
+
toolName: e.type === "dynamic-tool" ? e.toolName : gi(e),
|
|
2176
2180
|
dynamic: e.type === "dynamic-tool",
|
|
2177
2181
|
title: e.title,
|
|
2178
2182
|
toolMetadata: e.toolMetadata
|
|
@@ -2180,12 +2184,12 @@ function gi({ lastMessage: e, messageId: t }) {
|
|
|
2180
2184
|
}
|
|
2181
2185
|
return {
|
|
2182
2186
|
message: n,
|
|
2183
|
-
activeTextParts:
|
|
2184
|
-
activeReasoningParts:
|
|
2187
|
+
activeTextParts: pi(),
|
|
2188
|
+
activeReasoningParts: pi(),
|
|
2185
2189
|
partialToolCalls: r
|
|
2186
2190
|
};
|
|
2187
2191
|
}
|
|
2188
|
-
function
|
|
2192
|
+
function vi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdateMessageJob: r, onError: i, onToolCall: a, onData: o, resetStateOnMessageIdChange: s = !1, resetStateOnFirstMessageStart: c = !1 }) {
|
|
2189
2193
|
let l = !0;
|
|
2190
2194
|
return e.pipeThrough(new TransformStream({ async transform(e, u) {
|
|
2191
2195
|
await r(async ({ state: r, write: d }) => {
|
|
@@ -2226,7 +2230,7 @@ function _i({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2226
2230
|
return t;
|
|
2227
2231
|
}
|
|
2228
2232
|
function g(e, t) {
|
|
2229
|
-
let n = t ?? f().find((t) =>
|
|
2233
|
+
let n = t ?? f().find((t) => mi(t) && t.toolCallId === e.toolCallId), i = e, a = n;
|
|
2230
2234
|
if (n != null) {
|
|
2231
2235
|
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;
|
|
2232
2236
|
let t = i.providerMetadata;
|
|
@@ -2394,7 +2398,7 @@ function _i({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2394
2398
|
}), d();
|
|
2395
2399
|
break;
|
|
2396
2400
|
case "tool-input-start": {
|
|
2397
|
-
let t = f().filter(
|
|
2401
|
+
let t = f().filter(mi);
|
|
2398
2402
|
r.partialToolCalls[e.toolCallId] = {
|
|
2399
2403
|
text: "",
|
|
2400
2404
|
inputEncoding: e.inputEncoding,
|
|
@@ -2542,7 +2546,7 @@ function _i({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2542
2546
|
toolMetadata: e.toolMetadata ?? t.toolMetadata
|
|
2543
2547
|
}, t) : g({
|
|
2544
2548
|
toolCallId: e.toolCallId,
|
|
2545
|
-
toolName:
|
|
2549
|
+
toolName: gi(t),
|
|
2546
2550
|
state: "output-available",
|
|
2547
2551
|
input: t.input,
|
|
2548
2552
|
output: e.output,
|
|
@@ -2568,7 +2572,7 @@ function _i({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2568
2572
|
toolMetadata: e.toolMetadata ?? t.toolMetadata
|
|
2569
2573
|
}, t) : g({
|
|
2570
2574
|
toolCallId: e.toolCallId,
|
|
2571
|
-
toolName:
|
|
2575
|
+
toolName: gi(t),
|
|
2572
2576
|
state: "output-error",
|
|
2573
2577
|
input: t.input,
|
|
2574
2578
|
rawInput: t.rawInput,
|
|
@@ -2593,12 +2597,12 @@ function _i({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2593
2597
|
case "finish-step": break;
|
|
2594
2598
|
case "reset-step": {
|
|
2595
2599
|
let e = f();
|
|
2596
|
-
r.activeTextParts =
|
|
2600
|
+
r.activeTextParts = pi(), r.activeReasoningParts = pi(), r.partialToolCalls = pi(), e.length > 0 && (r.message.parts.splice(r.message.parts.length - e.length, e.length), d());
|
|
2597
2601
|
break;
|
|
2598
2602
|
}
|
|
2599
2603
|
case "start": {
|
|
2600
2604
|
let t = c && l || s && e.messageId != null && e.messageId !== r.message.id;
|
|
2601
|
-
l = !1, t && Object.assign(r,
|
|
2605
|
+
l = !1, t && Object.assign(r, _i({
|
|
2602
2606
|
lastMessage: void 0,
|
|
2603
2607
|
messageId: e.messageId ?? r.message.id
|
|
2604
2608
|
}), { 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 });
|
|
@@ -2613,7 +2617,7 @@ function _i({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2613
2617
|
case "error":
|
|
2614
2618
|
i?.(Error(e.errorText));
|
|
2615
2619
|
break;
|
|
2616
|
-
default: if (
|
|
2620
|
+
default: if (fi(e)) {
|
|
2617
2621
|
let t = n?.[e.type.slice(5)];
|
|
2618
2622
|
if (t != null) {
|
|
2619
2623
|
let n = r.message.parts.findIndex((t) => "id" in t && "data" in t && t.id === e.id && t.type === e.type), i = n >= 0 ? n : r.message.parts.length;
|
|
@@ -2640,7 +2644,7 @@ function _i({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2640
2644
|
});
|
|
2641
2645
|
} }));
|
|
2642
2646
|
}
|
|
2643
|
-
async function
|
|
2647
|
+
async function yi({ stream: e, onError: t, abortSignal: n }) {
|
|
2644
2648
|
let r = e.getReader(), i = () => {
|
|
2645
2649
|
r.cancel().catch(() => {});
|
|
2646
2650
|
};
|
|
@@ -2656,7 +2660,7 @@ async function vi({ stream: e, onError: t, abortSignal: n }) {
|
|
|
2656
2660
|
n?.removeEventListener("abort", i), r.releaseLock();
|
|
2657
2661
|
}
|
|
2658
2662
|
}
|
|
2659
|
-
function
|
|
2663
|
+
function bi() {
|
|
2660
2664
|
let e, t;
|
|
2661
2665
|
return {
|
|
2662
2666
|
promise: new Promise((n, r) => {
|
|
@@ -2666,68 +2670,115 @@ function yi() {
|
|
|
2666
2670
|
reject: t
|
|
2667
2671
|
};
|
|
2668
2672
|
}
|
|
2669
|
-
|
|
2673
|
+
I({
|
|
2670
2674
|
prefix: "aitxt",
|
|
2671
2675
|
size: 24
|
|
2672
|
-
}),
|
|
2676
|
+
}), I({
|
|
2673
2677
|
prefix: "call",
|
|
2674
2678
|
size: 24
|
|
2675
|
-
}),
|
|
2679
|
+
}), I({
|
|
2676
2680
|
prefix: "aitxt",
|
|
2677
2681
|
size: 24
|
|
2678
|
-
}),
|
|
2682
|
+
}), I({
|
|
2679
2683
|
prefix: "call",
|
|
2680
2684
|
size: 24
|
|
2681
2685
|
});
|
|
2682
|
-
|
|
2686
|
+
var xi = Symbol("invalid");
|
|
2687
|
+
function Si(e) {
|
|
2688
|
+
let t = [], n = Ci(e, t, /* @__PURE__ */ new Set());
|
|
2689
|
+
return n === xi ? {
|
|
2690
|
+
success: !1,
|
|
2691
|
+
path: t
|
|
2692
|
+
} : {
|
|
2693
|
+
success: !0,
|
|
2694
|
+
value: n
|
|
2695
|
+
};
|
|
2696
|
+
}
|
|
2697
|
+
function Ci(e, t, n) {
|
|
2683
2698
|
switch (typeof e) {
|
|
2684
|
-
case "
|
|
2685
|
-
case "
|
|
2686
|
-
case "
|
|
2687
|
-
case "function": return [...t];
|
|
2699
|
+
case "string":
|
|
2700
|
+
case "boolean": return e;
|
|
2701
|
+
case "number": return Number.isFinite(e) ? e : xi;
|
|
2688
2702
|
case "object": {
|
|
2689
|
-
if (e === null
|
|
2703
|
+
if (e === null) return e;
|
|
2704
|
+
if (n.has(e)) return xi;
|
|
2690
2705
|
n.add(e);
|
|
2691
|
-
let r = Array.isArray(e) ? e
|
|
2692
|
-
|
|
2693
|
-
if (i === "__proto__") continue;
|
|
2694
|
-
t.push(i);
|
|
2695
|
-
let r = bi(e[i], t, n);
|
|
2696
|
-
if (r != null) return r;
|
|
2697
|
-
t.pop();
|
|
2698
|
-
}
|
|
2699
|
-
return;
|
|
2706
|
+
let r = Array.isArray(e) ? wi(e, t, n) : Ti(e, t, n);
|
|
2707
|
+
return n.delete(e), r;
|
|
2700
2708
|
}
|
|
2701
|
-
default: return;
|
|
2709
|
+
default: return xi;
|
|
2702
2710
|
}
|
|
2703
2711
|
}
|
|
2704
|
-
function
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2712
|
+
function wi(e, t, n) {
|
|
2713
|
+
let r;
|
|
2714
|
+
for (let i = 0; i < e.length; i++) {
|
|
2715
|
+
let a = e[i];
|
|
2716
|
+
t.push(i);
|
|
2717
|
+
let o = Ci(a, t, n);
|
|
2718
|
+
if (o === xi) return xi;
|
|
2719
|
+
t.pop(), r == null ? o !== a && (r = e.slice(0, i), r.push(o)) : r.push(o);
|
|
2720
|
+
}
|
|
2721
|
+
return r ?? e;
|
|
2722
|
+
}
|
|
2723
|
+
function Ti(e, t, n) {
|
|
2724
|
+
if (!Di(e) || Oi(e)) return xi;
|
|
2725
|
+
let r = Object.keys(e), i;
|
|
2726
|
+
for (let a = 0; a < r.length; a++) {
|
|
2727
|
+
let o = r[a];
|
|
2728
|
+
if (o === "__proto__") {
|
|
2729
|
+
i ??= Ei(e, r, a);
|
|
2730
|
+
continue;
|
|
2731
|
+
}
|
|
2732
|
+
let s = e[o], c = s;
|
|
2733
|
+
if (s !== void 0) {
|
|
2734
|
+
if (t.push(o), c = Ci(s, t, n), c === xi) return xi;
|
|
2735
|
+
t.pop();
|
|
2736
|
+
}
|
|
2737
|
+
i == null ? c !== s && (i = Ei(e, r, a), i[o] = c) : i[o] = c;
|
|
2738
|
+
}
|
|
2739
|
+
return i ?? e;
|
|
2740
|
+
}
|
|
2741
|
+
function Ei(e, t, n) {
|
|
2742
|
+
let r = {};
|
|
2743
|
+
for (let i = 0; i < n; i++) r[t[i]] = e[t[i]];
|
|
2744
|
+
return r;
|
|
2716
2745
|
}
|
|
2717
|
-
|
|
2746
|
+
function Di(e) {
|
|
2747
|
+
let t = e.constructor;
|
|
2748
|
+
if (typeof t != "function") return !0;
|
|
2749
|
+
let n = t.prototype;
|
|
2750
|
+
return typeof n == "object" && !!n && Object.prototype.hasOwnProperty.call(n, "isPrototypeOf");
|
|
2751
|
+
}
|
|
2752
|
+
function Oi(e) {
|
|
2753
|
+
let t = Object.getOwnPropertySymbols(e);
|
|
2754
|
+
for (let n = 0; n < t.length; n++) if (Object.prototype.propertyIsEnumerable.call(e, t[n])) return !0;
|
|
2755
|
+
return !1;
|
|
2756
|
+
}
|
|
2757
|
+
var ki = X.pipe(X.unknown(), X.transform((e, t) => {
|
|
2758
|
+
let n = Si(e);
|
|
2759
|
+
return n.success ? n.value : (t.issues.push({
|
|
2760
|
+
code: "custom",
|
|
2761
|
+
message: "Invalid JSON value. Expected null, a string, a finite number, a boolean, an array, or an object.",
|
|
2762
|
+
input: e,
|
|
2763
|
+
path: n.path
|
|
2764
|
+
}), X.NEVER);
|
|
2765
|
+
})), Ai = X.custom();
|
|
2766
|
+
X.pipe(ki, X.record(X.string(), Ai));
|
|
2767
|
+
var ji = X.pipe(ki, X.record(X.string(), X.record(X.string(), Ai)));
|
|
2768
|
+
X.record(X.string(), X.string()), ci(ji), I({
|
|
2718
2769
|
prefix: "call",
|
|
2719
2770
|
size: 24
|
|
2720
|
-
}),
|
|
2771
|
+
}), I({
|
|
2721
2772
|
prefix: "call",
|
|
2722
2773
|
size: 24
|
|
2723
|
-
}), new TextEncoder(),
|
|
2774
|
+
}), new TextEncoder(), I({
|
|
2724
2775
|
prefix: "call",
|
|
2725
2776
|
size: 24
|
|
2726
|
-
}),
|
|
2777
|
+
}), I({
|
|
2727
2778
|
prefix: "aiobj",
|
|
2728
2779
|
size: 24
|
|
2729
2780
|
});
|
|
2730
|
-
var { atob:
|
|
2781
|
+
var { atob: Mi } = globalThis, Ni = class {
|
|
2731
2782
|
constructor() {
|
|
2732
2783
|
this.queue = [], this.isProcessing = !1, this.idleWaiters = [];
|
|
2733
2784
|
}
|
|
@@ -2759,35 +2810,35 @@ var { atob: Si } = globalThis, Ci = class {
|
|
|
2759
2810
|
});
|
|
2760
2811
|
}
|
|
2761
2812
|
};
|
|
2762
|
-
|
|
2813
|
+
I({
|
|
2763
2814
|
prefix: "aiobj",
|
|
2764
2815
|
size: 24
|
|
2765
|
-
}),
|
|
2816
|
+
}), I({
|
|
2766
2817
|
prefix: "call",
|
|
2767
2818
|
size: 24
|
|
2768
2819
|
});
|
|
2769
|
-
var
|
|
2820
|
+
var Pi = Z.union([
|
|
2770
2821
|
Z.string(),
|
|
2771
|
-
Z.custom(
|
|
2772
|
-
Z.custom(
|
|
2773
|
-
Z.custom(
|
|
2774
|
-
]),
|
|
2822
|
+
Z.custom(Zt, { message: "Must be a Uint8Array" }),
|
|
2823
|
+
Z.custom(F, { message: "Must be an ArrayBuffer" }),
|
|
2824
|
+
Z.custom(L, { message: "Must be a Buffer" })
|
|
2825
|
+
]), Fi = Z.record(Z.string(), Z.string()), Ii = Z.object({
|
|
2775
2826
|
type: Z.literal("text"),
|
|
2776
2827
|
text: Z.string(),
|
|
2777
2828
|
providerOptions: Q.optional()
|
|
2778
|
-
}),
|
|
2829
|
+
}), Li = Z.object({
|
|
2779
2830
|
type: Z.literal("image"),
|
|
2780
2831
|
image: Z.union([
|
|
2781
|
-
|
|
2832
|
+
Pi,
|
|
2782
2833
|
Z.instanceof(URL),
|
|
2783
|
-
|
|
2834
|
+
Fi
|
|
2784
2835
|
]),
|
|
2785
2836
|
mediaType: Z.string().optional(),
|
|
2786
2837
|
providerOptions: Q.optional()
|
|
2787
|
-
}),
|
|
2838
|
+
}), Ri = Z.discriminatedUnion("type", [
|
|
2788
2839
|
Z.object({
|
|
2789
2840
|
type: Z.literal("data"),
|
|
2790
|
-
data:
|
|
2841
|
+
data: Pi
|
|
2791
2842
|
}),
|
|
2792
2843
|
Z.object({
|
|
2793
2844
|
type: Z.literal("url"),
|
|
@@ -2795,54 +2846,54 @@ var wi = Z.union([
|
|
|
2795
2846
|
}),
|
|
2796
2847
|
Z.object({
|
|
2797
2848
|
type: Z.literal("reference"),
|
|
2798
|
-
reference:
|
|
2849
|
+
reference: Fi
|
|
2799
2850
|
}),
|
|
2800
2851
|
Z.object({
|
|
2801
2852
|
type: Z.literal("text"),
|
|
2802
2853
|
text: Z.string()
|
|
2803
2854
|
})
|
|
2804
|
-
]),
|
|
2855
|
+
]), zi = Z.discriminatedUnion("type", [Z.object({
|
|
2805
2856
|
type: Z.literal("data"),
|
|
2806
|
-
data:
|
|
2857
|
+
data: Pi
|
|
2807
2858
|
}), Z.object({
|
|
2808
2859
|
type: Z.literal("url"),
|
|
2809
2860
|
url: Z.instanceof(URL)
|
|
2810
|
-
})]),
|
|
2861
|
+
})]), Bi = Z.object({
|
|
2811
2862
|
type: Z.literal("file"),
|
|
2812
2863
|
data: Z.union([
|
|
2813
|
-
|
|
2814
|
-
|
|
2864
|
+
Ri,
|
|
2865
|
+
Pi,
|
|
2815
2866
|
Z.instanceof(URL),
|
|
2816
|
-
|
|
2867
|
+
Fi
|
|
2817
2868
|
]),
|
|
2818
2869
|
filename: Z.string().optional(),
|
|
2819
2870
|
mediaType: Z.string(),
|
|
2820
2871
|
providerOptions: Q.optional()
|
|
2821
|
-
}),
|
|
2872
|
+
}), Vi = Z.object({
|
|
2822
2873
|
type: Z.literal("reasoning"),
|
|
2823
2874
|
text: Z.string(),
|
|
2824
2875
|
providerOptions: Q.optional()
|
|
2825
|
-
}),
|
|
2876
|
+
}), Hi = Z.object({
|
|
2826
2877
|
type: Z.literal("custom"),
|
|
2827
2878
|
kind: Z.string().transform((e) => e),
|
|
2828
2879
|
providerOptions: Q.optional()
|
|
2829
|
-
}),
|
|
2880
|
+
}), Ui = Z.object({
|
|
2830
2881
|
type: Z.literal("reasoning-file"),
|
|
2831
2882
|
data: Z.union([
|
|
2832
|
-
|
|
2833
|
-
|
|
2883
|
+
zi,
|
|
2884
|
+
Pi,
|
|
2834
2885
|
Z.instanceof(URL)
|
|
2835
2886
|
]),
|
|
2836
2887
|
mediaType: Z.string(),
|
|
2837
2888
|
providerOptions: Q.optional()
|
|
2838
|
-
}),
|
|
2889
|
+
}), Wi = Z.object({
|
|
2839
2890
|
type: Z.literal("tool-call"),
|
|
2840
2891
|
toolCallId: Z.string(),
|
|
2841
2892
|
toolName: Z.string(),
|
|
2842
2893
|
input: Z.unknown(),
|
|
2843
2894
|
providerOptions: Q.optional(),
|
|
2844
2895
|
providerExecuted: Z.boolean().optional()
|
|
2845
|
-
}),
|
|
2896
|
+
}), Gi = Z.discriminatedUnion("type", [
|
|
2846
2897
|
Z.object({
|
|
2847
2898
|
type: Z.literal("text"),
|
|
2848
2899
|
value: Z.string(),
|
|
@@ -2878,7 +2929,7 @@ var wi = Z.union([
|
|
|
2878
2929
|
}),
|
|
2879
2930
|
Z.object({
|
|
2880
2931
|
type: Z.literal("file"),
|
|
2881
|
-
data:
|
|
2932
|
+
data: Ri,
|
|
2882
2933
|
mediaType: Z.string(),
|
|
2883
2934
|
filename: Z.string().optional(),
|
|
2884
2935
|
providerOptions: Q.optional()
|
|
@@ -2933,13 +2984,13 @@ var wi = Z.union([
|
|
|
2933
2984
|
})
|
|
2934
2985
|
]))
|
|
2935
2986
|
})
|
|
2936
|
-
]),
|
|
2987
|
+
]), Ki = Z.object({
|
|
2937
2988
|
type: Z.literal("tool-result"),
|
|
2938
2989
|
toolCallId: Z.string(),
|
|
2939
2990
|
toolName: Z.string(),
|
|
2940
|
-
output:
|
|
2991
|
+
output: Gi,
|
|
2941
2992
|
providerOptions: Q.optional()
|
|
2942
|
-
}),
|
|
2993
|
+
}), qi = Z.object({
|
|
2943
2994
|
type: Z.literal("tool-approval-request"),
|
|
2944
2995
|
approvalId: Z.string(),
|
|
2945
2996
|
toolCallId: Z.string(),
|
|
@@ -2947,46 +2998,46 @@ var wi = Z.union([
|
|
|
2947
2998
|
isAutomatic: Z.boolean().optional(),
|
|
2948
2999
|
signature: Z.string().optional(),
|
|
2949
3000
|
inputSchemaInput: Z.unknown().optional()
|
|
2950
|
-
}),
|
|
3001
|
+
}), Ji = Z.object({
|
|
2951
3002
|
type: Z.literal("tool-approval-response"),
|
|
2952
3003
|
approvalId: Z.string(),
|
|
2953
3004
|
approved: Z.boolean(),
|
|
2954
3005
|
reason: Z.string().optional()
|
|
2955
|
-
}),
|
|
3006
|
+
}), Yi = Z.object({
|
|
2956
3007
|
role: Z.literal("system"),
|
|
2957
3008
|
content: Z.string(),
|
|
2958
3009
|
providerOptions: Q.optional()
|
|
2959
|
-
}),
|
|
3010
|
+
}), Xi = Z.object({
|
|
2960
3011
|
role: Z.literal("user"),
|
|
2961
3012
|
content: Z.union([Z.string(), Z.array(Z.union([
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
3013
|
+
Ii,
|
|
3014
|
+
Li,
|
|
3015
|
+
Bi
|
|
2965
3016
|
]))]),
|
|
2966
3017
|
providerOptions: Q.optional()
|
|
2967
|
-
}),
|
|
3018
|
+
}), Zi = Z.object({
|
|
2968
3019
|
role: Z.literal("assistant"),
|
|
2969
3020
|
content: Z.union([Z.string(), Z.array(Z.union([
|
|
2970
|
-
Ei,
|
|
2971
|
-
Mi,
|
|
2972
|
-
Ai,
|
|
2973
|
-
ji,
|
|
2974
|
-
Ni,
|
|
2975
|
-
Pi,
|
|
2976
3021
|
Ii,
|
|
2977
|
-
|
|
3022
|
+
Hi,
|
|
3023
|
+
Bi,
|
|
3024
|
+
Vi,
|
|
3025
|
+
Ui,
|
|
3026
|
+
Wi,
|
|
3027
|
+
Ki,
|
|
3028
|
+
qi
|
|
2978
3029
|
]))]),
|
|
2979
3030
|
providerOptions: Q.optional()
|
|
2980
|
-
}),
|
|
3031
|
+
}), Qi = Z.object({
|
|
2981
3032
|
role: Z.literal("tool"),
|
|
2982
|
-
content: Z.array(Z.union([
|
|
3033
|
+
content: Z.array(Z.union([Ki, Ji])),
|
|
2983
3034
|
providerOptions: Q.optional()
|
|
2984
3035
|
});
|
|
2985
3036
|
Z.union([
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
3037
|
+
Yi,
|
|
3038
|
+
Xi,
|
|
3039
|
+
Zi,
|
|
3040
|
+
Qi
|
|
2990
3041
|
]), X.object({
|
|
2991
3042
|
token: X.string().check(X.refine((e) => e.trim().length > 0)),
|
|
2992
3043
|
url: X.string().check(X.refine((e) => {
|
|
@@ -3004,19 +3055,19 @@ Z.union([
|
|
|
3004
3055
|
description: X.optional(X.string()),
|
|
3005
3056
|
parameters: X.record(X.string(), X.unknown())
|
|
3006
3057
|
})))
|
|
3007
|
-
}),
|
|
3058
|
+
}), I({
|
|
3008
3059
|
prefix: "call",
|
|
3009
3060
|
size: 24
|
|
3010
|
-
}),
|
|
3061
|
+
}), I({
|
|
3011
3062
|
prefix: "call",
|
|
3012
3063
|
size: 24
|
|
3013
|
-
}),
|
|
3064
|
+
}), I({
|
|
3014
3065
|
prefix: "call",
|
|
3015
3066
|
size: 24
|
|
3016
3067
|
});
|
|
3017
|
-
async function
|
|
3068
|
+
async function $i({ response: e, url: t, fallbackMessage: n }) {
|
|
3018
3069
|
let r = await e.text();
|
|
3019
|
-
return new
|
|
3070
|
+
return new bt({
|
|
3020
3071
|
message: r || n,
|
|
3021
3072
|
url: t,
|
|
3022
3073
|
requestBodyValues: void 0,
|
|
@@ -3024,9 +3075,9 @@ async function Ui({ response: e, url: t, fallbackMessage: n }) {
|
|
|
3024
3075
|
responseBody: r
|
|
3025
3076
|
});
|
|
3026
3077
|
}
|
|
3027
|
-
async function
|
|
3078
|
+
async function ea(e) {
|
|
3028
3079
|
if (e == null) return [];
|
|
3029
|
-
if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new
|
|
3080
|
+
if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new Rt({
|
|
3030
3081
|
functionality: "FileList",
|
|
3031
3082
|
message: "FileList is not supported in the current environment"
|
|
3032
3083
|
});
|
|
@@ -3045,18 +3096,18 @@ async function Wi(e) {
|
|
|
3045
3096
|
};
|
|
3046
3097
|
}));
|
|
3047
3098
|
}
|
|
3048
|
-
function
|
|
3099
|
+
function ta(e, t) {
|
|
3049
3100
|
let n = e.search(/[?#]/), r = n === -1 ? e : e.slice(0, n), i = n === -1 ? "" : e.slice(n);
|
|
3050
3101
|
return `${r.endsWith("/") && t.startsWith("/") ? r.slice(0, -1) : r}${t}${i}`;
|
|
3051
3102
|
}
|
|
3052
|
-
var
|
|
3103
|
+
var na = class {
|
|
3053
3104
|
constructor({ api: e = "/api/chat", credentials: t, headers: n, body: r, fetch: i, prepareSendMessagesRequest: a, prepareReconnectToStreamRequest: o }) {
|
|
3054
3105
|
this.api = e, this.credentials = t, this.headers = n, this.body = r, this.fetch = i, this.prepareSendMessagesRequest = a, this.prepareReconnectToStreamRequest = o;
|
|
3055
3106
|
}
|
|
3056
3107
|
async sendMessages({ abortSignal: e, ...t }) {
|
|
3057
3108
|
let n = await fr(this.body), r = await fr(this.headers), i = await fr(this.credentials), a = {
|
|
3058
|
-
...
|
|
3059
|
-
...
|
|
3109
|
+
...Qt(r),
|
|
3110
|
+
...Qt(t.headers)
|
|
3060
3111
|
}, o = await this.prepareSendMessagesRequest?.({
|
|
3061
3112
|
api: this.api,
|
|
3062
3113
|
id: t.chatId,
|
|
@@ -3070,7 +3121,7 @@ var Ki = class {
|
|
|
3070
3121
|
requestMetadata: t.metadata,
|
|
3071
3122
|
trigger: t.trigger,
|
|
3072
3123
|
messageId: t.messageId
|
|
3073
|
-
}), s = o?.api ?? this.api, c = o?.headers === void 0 ? a :
|
|
3124
|
+
}), s = o?.api ?? this.api, c = o?.headers === void 0 ? a : Qt(o.headers), l = o?.body === void 0 ? {
|
|
3074
3125
|
...n,
|
|
3075
3126
|
...t.body,
|
|
3076
3127
|
id: t.chatId,
|
|
@@ -3087,18 +3138,18 @@ var Ki = class {
|
|
|
3087
3138
|
credentials: u,
|
|
3088
3139
|
signal: e
|
|
3089
3140
|
});
|
|
3090
|
-
if (!d.ok) throw await
|
|
3141
|
+
if (!d.ok) throw await $i({
|
|
3091
3142
|
response: d,
|
|
3092
3143
|
url: s,
|
|
3093
3144
|
fallbackMessage: "Failed to fetch the chat response."
|
|
3094
3145
|
});
|
|
3095
|
-
if (!d.body) throw new
|
|
3146
|
+
if (!d.body) throw new wt({ message: "The response body is empty." });
|
|
3096
3147
|
return this.processResponseStream(d.body);
|
|
3097
3148
|
}
|
|
3098
3149
|
async reconnectToStream(e) {
|
|
3099
3150
|
let t = await fr(this.body), n = await fr(this.headers), r = await fr(this.credentials), i = {
|
|
3100
|
-
...
|
|
3101
|
-
...
|
|
3151
|
+
...Qt(n),
|
|
3152
|
+
...Qt(e.headers)
|
|
3102
3153
|
}, a = await this.prepareReconnectToStreamRequest?.({
|
|
3103
3154
|
api: this.api,
|
|
3104
3155
|
id: e.chatId,
|
|
@@ -3116,42 +3167,42 @@ var Ki = class {
|
|
|
3116
3167
|
value: e.chatId,
|
|
3117
3168
|
message: "Chat IDs must not be \".\" or \"..\" when using the default reconnect URL."
|
|
3118
3169
|
});
|
|
3119
|
-
o =
|
|
3170
|
+
o = ta(this.api, `/${encodeURIComponent(e.chatId)}/stream`);
|
|
3120
3171
|
}
|
|
3121
|
-
let s = a?.headers === void 0 ? i :
|
|
3172
|
+
let s = a?.headers === void 0 ? i : Qt(a.headers), c = a?.credentials ?? r, l = await (this.fetch ?? globalThis.fetch)(o, {
|
|
3122
3173
|
method: "GET",
|
|
3123
3174
|
headers: s,
|
|
3124
3175
|
credentials: c,
|
|
3125
3176
|
signal: e.abortSignal
|
|
3126
3177
|
});
|
|
3127
3178
|
if (l.status === 204) return null;
|
|
3128
|
-
if (!l.ok) throw await
|
|
3179
|
+
if (!l.ok) throw await $i({
|
|
3129
3180
|
response: l,
|
|
3130
3181
|
url: o,
|
|
3131
3182
|
fallbackMessage: "Failed to fetch the chat response."
|
|
3132
3183
|
});
|
|
3133
|
-
if (!l.body) throw new
|
|
3184
|
+
if (!l.body) throw new wt({ message: "The response body is empty." });
|
|
3134
3185
|
return this.processResponseStream(l.body);
|
|
3135
3186
|
}
|
|
3136
|
-
},
|
|
3187
|
+
}, ra = class extends na {
|
|
3137
3188
|
constructor({ resumeStreamIsReplay: e = !0, ...t } = {}) {
|
|
3138
3189
|
super(t), this.resumeStreamIsReplay = e;
|
|
3139
3190
|
}
|
|
3140
3191
|
processResponseStream(e) {
|
|
3141
3192
|
return dr({
|
|
3142
3193
|
stream: e,
|
|
3143
|
-
schema:
|
|
3194
|
+
schema: di
|
|
3144
3195
|
}).pipeThrough(new TransformStream({ async transform(e, t) {
|
|
3145
3196
|
if (!e.success) throw e.error;
|
|
3146
3197
|
t.enqueue(e.value);
|
|
3147
3198
|
} }));
|
|
3148
3199
|
}
|
|
3149
|
-
},
|
|
3200
|
+
}, ia = class {
|
|
3150
3201
|
get id() {
|
|
3151
3202
|
return this._id ??= this.generateId();
|
|
3152
3203
|
}
|
|
3153
|
-
constructor({ generateId: e =
|
|
3154
|
-
this.queuedMessagesFallback = [], this.queuedMessageOptions = /* @__PURE__ */ new Map(), this.isQueuePaused = !1, this.pendingAutomaticDecisions = [], 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
|
|
3204
|
+
constructor({ generateId: e = $t, id: t, transport: n = new ra(), messageMetadataSchema: r, dataPartSchemas: i, state: a, onError: o, onToolCall: s, onFinish: c, onData: l, sendAutomaticallyWhen: u, experimental_queue: d = !1 }) {
|
|
3205
|
+
this.queuedMessagesFallback = [], this.queuedMessageOptions = /* @__PURE__ */ new Map(), this.isQueuePaused = !1, this.pendingAutomaticDecisions = [], 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 Ni(), this.activeStopCount = 0, this.stopGeneration = 0, this.experimental_removeQueuedMessage = (e) => {
|
|
3155
3206
|
this.queuedMessageOptions.delete(e), this.setQueuedMessages(this.experimental_queuedMessages.filter((t) => t.id !== e));
|
|
3156
3207
|
}, this.experimental_sendQueuedMessageNow = async (e) => {
|
|
3157
3208
|
let t = this.experimental_queuedMessages.find((t) => t.id === e);
|
|
@@ -3189,7 +3240,7 @@ var Ki = class {
|
|
|
3189
3240
|
this.pendingMessagePreparations.add(t);
|
|
3190
3241
|
let r;
|
|
3191
3242
|
try {
|
|
3192
|
-
r = Array.isArray(e.files) ? e.files : await
|
|
3243
|
+
r = Array.isArray(e.files) ? e.files : await ea(e.files);
|
|
3193
3244
|
} finally {
|
|
3194
3245
|
this.pendingMessagePreparations.delete(t);
|
|
3195
3246
|
}
|
|
@@ -3443,7 +3494,7 @@ var Ki = class {
|
|
|
3443
3494
|
}), r && this.status === "error" && this.pendingApprovalMessageId == null && (this.pendingApprovalMessageId = this.state.messages[t]?.id ?? e);
|
|
3444
3495
|
}
|
|
3445
3496
|
async makeRequest(e) {
|
|
3446
|
-
let t =
|
|
3497
|
+
let t = bi();
|
|
3447
3498
|
try {
|
|
3448
3499
|
await this.makeRequestImpl({
|
|
3449
3500
|
...e,
|
|
@@ -3496,17 +3547,17 @@ var Ki = class {
|
|
|
3496
3547
|
status: "submitted",
|
|
3497
3548
|
error: void 0
|
|
3498
3549
|
});
|
|
3499
|
-
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) => $(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,
|
|
3550
|
+
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) => $(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;
|
|
3500
3551
|
try {
|
|
3501
3552
|
let s = {
|
|
3502
|
-
state: e === "resume-stream" && this.resumableStreamState != null ? this.resumableStreamState :
|
|
3553
|
+
state: e === "resume-stream" && this.resumableStreamState != null ? this.resumableStreamState : _i({
|
|
3503
3554
|
lastMessage: e === "resume-stream" ? h : e === "regenerate-message" ? void 0 : this.state.snapshot(p),
|
|
3504
3555
|
messageId: this.generateId()
|
|
3505
3556
|
}),
|
|
3506
3557
|
abortController: o,
|
|
3507
3558
|
completionPromise: a
|
|
3508
3559
|
};
|
|
3509
|
-
|
|
3560
|
+
y = s, s.abortController.signal.addEventListener("abort", () => {
|
|
3510
3561
|
_ = !0;
|
|
3511
3562
|
}), this.activeResponse = s;
|
|
3512
3563
|
let l;
|
|
@@ -3519,8 +3570,8 @@ var Ki = class {
|
|
|
3519
3570
|
body: r,
|
|
3520
3571
|
trigger: e,
|
|
3521
3572
|
messageId: i
|
|
3522
|
-
}), await
|
|
3523
|
-
stream:
|
|
3573
|
+
}), await yi({
|
|
3574
|
+
stream: vi({
|
|
3524
3575
|
stream: l,
|
|
3525
3576
|
resetStateOnMessageIdChange: e === "resume-stream",
|
|
3526
3577
|
resetStateOnFirstMessageStart: e === "resume-stream" && this.transport.resumeStreamIsReplay,
|
|
@@ -3552,34 +3603,34 @@ var Ki = class {
|
|
|
3552
3603
|
}), _) return c() && (this.setStatus({ status: "ready" }), this.resumableStreamState === s.state && (this.resumableStreamState = void 0)), null;
|
|
3553
3604
|
c() && (this.setStatus({ status: "ready" }), this.resumableStreamState === s.state && (this.resumableStreamState = void 0));
|
|
3554
3605
|
} catch (e) {
|
|
3555
|
-
if (_ || e.name === "AbortError") return _ = !0, c() && (this.setStatus({ status: "ready" }), this.resumableStreamState ===
|
|
3606
|
+
if (_ || e.name === "AbortError") return _ = !0, c() && (this.setStatus({ status: "ready" }), this.resumableStreamState === y?.state && (this.resumableStreamState = void 0)), null;
|
|
3556
3607
|
if (!c()) return null;
|
|
3557
|
-
if (
|
|
3608
|
+
if (ee = !0, e instanceof TypeError) {
|
|
3558
3609
|
let t = e.message.toLowerCase();
|
|
3559
3610
|
v = t.includes("fetch") || t.includes("network") || t === "load failed";
|
|
3560
3611
|
}
|
|
3561
|
-
v ? this.resumableStreamState =
|
|
3612
|
+
v ? this.resumableStreamState = y?.state : this.resumableStreamState === y?.state && (this.resumableStreamState = void 0), this.onError && e instanceof Error && this.onError(e), this.setStatus({
|
|
3562
3613
|
status: "error",
|
|
3563
3614
|
error: e
|
|
3564
3615
|
});
|
|
3565
3616
|
} finally {
|
|
3566
3617
|
try {
|
|
3567
|
-
if (
|
|
3568
|
-
let { message: e, finishReason: t } =
|
|
3569
|
-
t === "interrupted" ? this.interruptedMessageIds.add(e.id) : !_ && !
|
|
3570
|
-
message:
|
|
3618
|
+
if (y) {
|
|
3619
|
+
let { message: e, finishReason: t } = y.state;
|
|
3620
|
+
t === "interrupted" ? this.interruptedMessageIds.add(e.id) : !_ && !ee && this.interruptedMessageIds.delete(e.id), this.onFinish?.({
|
|
3621
|
+
message: y.state.message,
|
|
3571
3622
|
messages: this.state.messages,
|
|
3572
3623
|
isAbort: _,
|
|
3573
3624
|
isDisconnect: v,
|
|
3574
|
-
isError:
|
|
3575
|
-
finishReason:
|
|
3625
|
+
isError: ee,
|
|
3626
|
+
finishReason: y.state.finishReason
|
|
3576
3627
|
});
|
|
3577
3628
|
}
|
|
3578
3629
|
} finally {
|
|
3579
|
-
(_ ||
|
|
3630
|
+
(_ || ee || y?.state.finishReason === "interrupted") && (this.isQueuePaused = !0), this.activeResponse === y && (this.activeResponse = void 0), l();
|
|
3580
3631
|
}
|
|
3581
3632
|
}
|
|
3582
|
-
if (!_ && !
|
|
3633
|
+
if (!_ && !ee && y?.state.finishReason !== "interrupted") {
|
|
3583
3634
|
let e = this.stopGeneration;
|
|
3584
3635
|
await this.runAutomaticRequest(() => this.makeRequest({
|
|
3585
3636
|
trigger: "submit-message",
|
|
@@ -3591,37 +3642,37 @@ var Ki = class {
|
|
|
3591
3642
|
}
|
|
3592
3643
|
}
|
|
3593
3644
|
};
|
|
3594
|
-
function
|
|
3645
|
+
function aa({ messages: e }) {
|
|
3595
3646
|
let t = e[e.length - 1];
|
|
3596
3647
|
if (!t || t.role !== "assistant") return !1;
|
|
3597
3648
|
let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter($);
|
|
3598
3649
|
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");
|
|
3599
3650
|
}
|
|
3600
3651
|
// ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.45_typescript@6.0.3_/node_modules/swrv/esm/lib/hash.js
|
|
3601
|
-
var
|
|
3602
|
-
function
|
|
3652
|
+
var oa = /* @__PURE__ */ new WeakMap(), sa = 0;
|
|
3653
|
+
function ca(e) {
|
|
3603
3654
|
if (!e.length) return "";
|
|
3604
3655
|
for (var t = "arg", n = 0; n < e.length; ++n) {
|
|
3605
3656
|
var r = void 0;
|
|
3606
|
-
e[n] === null || typeof e[n] != "object" && typeof e[n] != "function" ? r = typeof e[n] == "string" ? "\"" + e[n] + "\"" : String(e[n]) :
|
|
3657
|
+
e[n] === null || typeof e[n] != "object" && typeof e[n] != "function" ? r = typeof e[n] == "string" ? "\"" + e[n] + "\"" : String(e[n]) : oa.has(e[n]) ? r = oa.get(e[n]) : (r = sa, oa.set(e[n], sa++)), t += "@" + r;
|
|
3607
3658
|
}
|
|
3608
3659
|
return t;
|
|
3609
3660
|
}
|
|
3610
3661
|
// ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.45_typescript@6.0.3_/node_modules/swrv/esm/cache/index.js
|
|
3611
|
-
function
|
|
3662
|
+
function la(e) {
|
|
3612
3663
|
if (typeof e == "function") try {
|
|
3613
3664
|
e = e();
|
|
3614
3665
|
} catch {
|
|
3615
3666
|
e = "";
|
|
3616
3667
|
}
|
|
3617
|
-
return e = Array.isArray(e) ?
|
|
3668
|
+
return e = Array.isArray(e) ? ca(e) : String(e || ""), e;
|
|
3618
3669
|
}
|
|
3619
|
-
var
|
|
3670
|
+
var ua = function() {
|
|
3620
3671
|
function e(e) {
|
|
3621
3672
|
e === void 0 && (e = 0), this.items = /* @__PURE__ */ new Map(), this.ttl = e;
|
|
3622
3673
|
}
|
|
3623
3674
|
return e.prototype.serializeKey = function(e) {
|
|
3624
|
-
return
|
|
3675
|
+
return la(e);
|
|
3625
3676
|
}, e.prototype.get = function(e) {
|
|
3626
3677
|
var t = this.serializeKey(e);
|
|
3627
3678
|
return this.items.get(t);
|
|
@@ -3642,26 +3693,26 @@ var ea = function() {
|
|
|
3642
3693
|
}, e;
|
|
3643
3694
|
}();
|
|
3644
3695
|
// ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.45_typescript@6.0.3_/node_modules/swrv/esm/lib/web-preset.js
|
|
3645
|
-
function
|
|
3696
|
+
function da() {
|
|
3646
3697
|
return navigator.onLine === void 0 || navigator.onLine;
|
|
3647
3698
|
}
|
|
3648
|
-
function
|
|
3699
|
+
function fa() {
|
|
3649
3700
|
return typeof document < "u" && document.visibilityState !== void 0 ? document.visibilityState !== "hidden" : !0;
|
|
3650
3701
|
}
|
|
3651
|
-
var
|
|
3652
|
-
isOnline:
|
|
3653
|
-
isDocumentVisible:
|
|
3702
|
+
var pa = {
|
|
3703
|
+
isOnline: da,
|
|
3704
|
+
isDocumentVisible: fa,
|
|
3654
3705
|
fetcher: function(e) {
|
|
3655
3706
|
return fetch(e).then(function(e) {
|
|
3656
3707
|
return e.json();
|
|
3657
3708
|
});
|
|
3658
3709
|
}
|
|
3659
|
-
},
|
|
3660
|
-
return
|
|
3710
|
+
}, ma = function() {
|
|
3711
|
+
return ma = Object.assign || function(e) {
|
|
3661
3712
|
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]);
|
|
3662
3713
|
return e;
|
|
3663
|
-
},
|
|
3664
|
-
},
|
|
3714
|
+
}, ma.apply(this, arguments);
|
|
3715
|
+
}, ha = function(e, t, n, r) {
|
|
3665
3716
|
function i(e) {
|
|
3666
3717
|
return e instanceof n ? e : new n(function(t) {
|
|
3667
3718
|
t(e);
|
|
@@ -3687,7 +3738,7 @@ var ra = {
|
|
|
3687
3738
|
}
|
|
3688
3739
|
c((r = r.apply(e, t || [])).next());
|
|
3689
3740
|
});
|
|
3690
|
-
},
|
|
3741
|
+
}, ga = function(e, t) {
|
|
3691
3742
|
var n = {
|
|
3692
3743
|
label: 0,
|
|
3693
3744
|
sent: function() {
|
|
@@ -3760,7 +3811,7 @@ var ra = {
|
|
|
3760
3811
|
done: !0
|
|
3761
3812
|
};
|
|
3762
3813
|
}
|
|
3763
|
-
},
|
|
3814
|
+
}, _a = function(e, t) {
|
|
3764
3815
|
var n = typeof Symbol == "function" && e[Symbol.iterator];
|
|
3765
3816
|
if (!n) return e;
|
|
3766
3817
|
var r = n.call(e), i, a = [], o;
|
|
@@ -3776,11 +3827,11 @@ var ra = {
|
|
|
3776
3827
|
}
|
|
3777
3828
|
}
|
|
3778
3829
|
return a;
|
|
3779
|
-
},
|
|
3830
|
+
}, va = function(e, t, n) {
|
|
3780
3831
|
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]);
|
|
3781
3832
|
return e.concat(a || Array.prototype.slice.call(t));
|
|
3782
|
-
},
|
|
3783
|
-
cache:
|
|
3833
|
+
}, ya = new ua(), ba = new ua(), xa = new ua(), Sa = {
|
|
3834
|
+
cache: ya,
|
|
3784
3835
|
refreshInterval: 0,
|
|
3785
3836
|
ttl: 0,
|
|
3786
3837
|
serverTTL: 1e3,
|
|
@@ -3790,15 +3841,15 @@ var ra = {
|
|
|
3790
3841
|
shouldRetryOnError: !0,
|
|
3791
3842
|
errorRetryInterval: 5e3,
|
|
3792
3843
|
errorRetryCount: 5,
|
|
3793
|
-
fetcher:
|
|
3794
|
-
isOnline:
|
|
3795
|
-
isDocumentVisible:
|
|
3844
|
+
fetcher: pa.fetcher,
|
|
3845
|
+
isOnline: pa.isOnline,
|
|
3846
|
+
isDocumentVisible: pa.isDocumentVisible
|
|
3796
3847
|
};
|
|
3797
|
-
function
|
|
3798
|
-
var r =
|
|
3799
|
-
r ? r.data.push(t) :
|
|
3848
|
+
function Ca(e, t, n) {
|
|
3849
|
+
var r = ba.get(e);
|
|
3850
|
+
r ? r.data.push(t) : ba.set(e, [t], n > 0 ? n + 5e3 : n);
|
|
3800
3851
|
}
|
|
3801
|
-
function
|
|
3852
|
+
function wa(e, t, n) {
|
|
3802
3853
|
if (n.isDocumentVisible() && !(n.errorRetryCount !== void 0 && t > n.errorRetryCount)) {
|
|
3803
3854
|
var r = Math.min(t || 0, n.errorRetryCount), i = r * n.errorRetryInterval;
|
|
3804
3855
|
setTimeout(function() {
|
|
@@ -3809,17 +3860,17 @@ function ma(e, t, n) {
|
|
|
3809
3860
|
}, i);
|
|
3810
3861
|
}
|
|
3811
3862
|
}
|
|
3812
|
-
function
|
|
3863
|
+
function Ta(e) {
|
|
3813
3864
|
var t = e.shouldRetry, n = t === void 0 ? void 0 : t, r = e.error;
|
|
3814
|
-
return typeof n == "function" ? n(r) : typeof n == "boolean" ? n :
|
|
3865
|
+
return typeof n == "function" ? n(r) : typeof n == "boolean" ? n : Sa.shouldRetryOnError;
|
|
3815
3866
|
}
|
|
3816
|
-
var
|
|
3817
|
-
return n === void 0 && (n =
|
|
3867
|
+
var Ea = function(e, t, n, r) {
|
|
3868
|
+
return n === void 0 && (n = ya), r === void 0 && (r = Sa.ttl), ha(void 0, void 0, void 0, function() {
|
|
3818
3869
|
var i, a, o, s, c, l, u;
|
|
3819
|
-
return
|
|
3870
|
+
return ga(this, function(d) {
|
|
3820
3871
|
switch (d.label) {
|
|
3821
3872
|
case 0:
|
|
3822
|
-
if (!
|
|
3873
|
+
if (!Oa(t)) return [3, 5];
|
|
3823
3874
|
d.label = 1;
|
|
3824
3875
|
case 1: return d.trys.push([
|
|
3825
3876
|
1,
|
|
@@ -3841,7 +3892,7 @@ var ga = function(e, t, n, r) {
|
|
|
3841
3892
|
} catch (e) {
|
|
3842
3893
|
console.error("swrv(mutate): failed to set cache", e);
|
|
3843
3894
|
}
|
|
3844
|
-
return l =
|
|
3895
|
+
return l = ba.get(e), l && l.data.length && (u = l.data.filter(function(t) {
|
|
3845
3896
|
return t.key === e;
|
|
3846
3897
|
}), u.forEach(function(e, t) {
|
|
3847
3898
|
c.data !== void 0 && (e.data = c.data), e.error = c.error, e.isValidating = c.isValidating, e.isLoading = c.isValidating, t !== u.length - 1 && delete u[t];
|
|
@@ -3850,16 +3901,16 @@ var ga = function(e, t, n, r) {
|
|
|
3850
3901
|
});
|
|
3851
3902
|
});
|
|
3852
3903
|
};
|
|
3853
|
-
function
|
|
3904
|
+
function Da() {
|
|
3854
3905
|
for (var e = this, t = [], n = 0; n < arguments.length; n++) t[n] = arguments[n];
|
|
3855
|
-
var r, i, a =
|
|
3856
|
-
if (!
|
|
3906
|
+
var r, i, a = ma({}, Sa), o = !1, s = !1;
|
|
3907
|
+
if (!T()) return console.error("useSWRV must be called inside setup() or an active effectScope()."), null;
|
|
3857
3908
|
var c = typeof window > "u" || typeof document > "u";
|
|
3858
|
-
t.length >= 1 && (r = t[0]), t.length >= 2 && (i = t[1]), t.length > 2 && (a =
|
|
3859
|
-
var l = c ? a.serverTTL : a.ttl, u = typeof r == "function" ? r :
|
|
3909
|
+
t.length >= 1 && (r = t[0]), t.length >= 2 && (i = t[1]), t.length > 2 && (a = ma(ma({}, a), t[2]));
|
|
3910
|
+
var l = c ? a.serverTTL : a.ttl, u = typeof r == "function" ? r : E(r);
|
|
3860
3911
|
i === void 0 && (i = a.fetcher);
|
|
3861
3912
|
var d = null;
|
|
3862
|
-
d ||=
|
|
3913
|
+
d ||= tt({
|
|
3863
3914
|
data: void 0,
|
|
3864
3915
|
error: void 0,
|
|
3865
3916
|
isValidating: !0,
|
|
@@ -3867,32 +3918,32 @@ function _a() {
|
|
|
3867
3918
|
key: null
|
|
3868
3919
|
});
|
|
3869
3920
|
var f = function(t, n) {
|
|
3870
|
-
return
|
|
3921
|
+
return ha(e, void 0, void 0, function() {
|
|
3871
3922
|
var e, r, s, c, p, m, h, g = this;
|
|
3872
|
-
return
|
|
3923
|
+
return ga(this, function(_) {
|
|
3873
3924
|
switch (_.label) {
|
|
3874
3925
|
case 0: return e = d.data === void 0, r = u.value, r ? (s = a.cache.get(r), c = s && s.data, d.isValidating = !0, d.isLoading = !c, c && (d.data = c.data, d.error = c.error), p = t || i, !p || !a.isDocumentVisible() && !e || n?.forceRevalidate !== void 0 && !n?.forceRevalidate || s && (m = !!(Date.now() - s.createdAt >= a.dedupingInterval || n?.forceRevalidate), !m) ? (d.isValidating = !1, d.isLoading = !1, [2]) : (h = function() {
|
|
3875
|
-
return
|
|
3926
|
+
return ha(g, void 0, void 0, function() {
|
|
3876
3927
|
var e, t, i, s, c, u;
|
|
3877
|
-
return
|
|
3928
|
+
return ga(this, function(m) {
|
|
3878
3929
|
switch (m.label) {
|
|
3879
|
-
case 0: return e =
|
|
3930
|
+
case 0: return e = xa.get(r), e ? [3, 2] : (t = Array.isArray(r) ? r : [r], i = p.apply(void 0, va([], _a(t), !1)), xa.set(r, i, a.dedupingInterval), [4, Ea(r, i, a.cache, l)]);
|
|
3880
3931
|
case 1: return m.sent(), [3, 4];
|
|
3881
|
-
case 2: return [4,
|
|
3932
|
+
case 2: return [4, Ea(r, e.data, a.cache, l)];
|
|
3882
3933
|
case 3: m.sent(), m.label = 4;
|
|
3883
|
-
case 4: return d.isValidating = !1, d.isLoading = !1,
|
|
3934
|
+
case 4: return d.isValidating = !1, d.isLoading = !1, xa.delete(r), d.error !== void 0 && (s = Ta({
|
|
3884
3935
|
shouldRetry: a.shouldRetryOnError,
|
|
3885
3936
|
error: d.error
|
|
3886
|
-
}), c =
|
|
3937
|
+
}), c = Ta({
|
|
3887
3938
|
shouldRetry: !n || n.shouldRetryOnError,
|
|
3888
3939
|
error: d.error
|
|
3889
|
-
}), u = !o && s && c, u &&
|
|
3940
|
+
}), u = !o && s && c, u && wa(f, n ? n.errorRetryCount : 1, a)), [2];
|
|
3890
3941
|
}
|
|
3891
3942
|
});
|
|
3892
3943
|
});
|
|
3893
3944
|
}, c && a.revalidateDebounce ? (setTimeout(function() {
|
|
3894
|
-
return
|
|
3895
|
-
return
|
|
3945
|
+
return ha(g, void 0, void 0, function() {
|
|
3946
|
+
return ga(this, function(e) {
|
|
3896
3947
|
switch (e.label) {
|
|
3897
3948
|
case 0: return o ? [3, 2] : [4, h()];
|
|
3898
3949
|
case 1: e.sent(), e.label = 2;
|
|
@@ -3908,16 +3959,16 @@ function _a() {
|
|
|
3908
3959
|
});
|
|
3909
3960
|
});
|
|
3910
3961
|
}, p = function() {
|
|
3911
|
-
return
|
|
3912
|
-
return
|
|
3962
|
+
return ha(e, void 0, void 0, function() {
|
|
3963
|
+
return ga(this, function(e) {
|
|
3913
3964
|
return [2, f(null, { shouldRetryOnError: !1 })];
|
|
3914
3965
|
});
|
|
3915
3966
|
});
|
|
3916
3967
|
}, m = null;
|
|
3917
3968
|
if (!c) {
|
|
3918
3969
|
var h = function() {
|
|
3919
|
-
return
|
|
3920
|
-
return
|
|
3970
|
+
return ha(e, void 0, void 0, function() {
|
|
3971
|
+
return ga(this, function(e) {
|
|
3921
3972
|
switch (e.label) {
|
|
3922
3973
|
case 0: return d.error || !a.isOnline() ? [3, 2] : [4, f()];
|
|
3923
3974
|
case 1: return e.sent(), [3, 3];
|
|
@@ -3929,40 +3980,40 @@ function _a() {
|
|
|
3929
3980
|
};
|
|
3930
3981
|
a.refreshInterval && (m = setTimeout(h, a.refreshInterval)), a.revalidateOnFocus && (document.addEventListener("visibilitychange", p, !1), window.addEventListener("focus", p, !1));
|
|
3931
3982
|
}
|
|
3932
|
-
|
|
3983
|
+
et(function() {
|
|
3933
3984
|
o = !0, m &&= (clearTimeout(m), null), !c && a.revalidateOnFocus && (document.removeEventListener("visibilitychange", p, !1), window.removeEventListener("focus", p, !1));
|
|
3934
|
-
var e =
|
|
3985
|
+
var e = ba.get(u.value);
|
|
3935
3986
|
e && (e.data = e.data.filter(function(e) {
|
|
3936
3987
|
return e !== d;
|
|
3937
3988
|
}));
|
|
3938
3989
|
});
|
|
3939
3990
|
try {
|
|
3940
|
-
|
|
3941
|
-
|
|
3991
|
+
O(u, function(e) {
|
|
3992
|
+
Qe(u) || (u.value = e), d.key = e, d.isValidating = !!e, Ca(u.value, d, l), !c && !s && u.value && f(), s = !1;
|
|
3942
3993
|
}, { immediate: !0 });
|
|
3943
3994
|
} catch {}
|
|
3944
|
-
return
|
|
3945
|
-
return f(e,
|
|
3995
|
+
return ma(ma({}, nt(d)), { mutate: function(e, t) {
|
|
3996
|
+
return f(e, ma(ma({}, t), { forceRevalidate: !0 }));
|
|
3946
3997
|
} });
|
|
3947
3998
|
}
|
|
3948
|
-
function
|
|
3999
|
+
function Oa(e) {
|
|
3949
4000
|
return typeof e == "object" && !!e && typeof e.then == "function";
|
|
3950
4001
|
}
|
|
3951
4002
|
// ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.45_typescript@6.0.3_/node_modules/swrv/esm/index.js
|
|
3952
|
-
var
|
|
3953
|
-
|
|
3954
|
-
function
|
|
4003
|
+
var ka = Da;
|
|
4004
|
+
ka.default, ka.default;
|
|
4005
|
+
function Aa(e) {
|
|
3955
4006
|
return Array.isArray(e) ? [...e] : typeof e == "object" && e && (Object.getPrototypeOf(e) === Object.prototype || Object.getPrototypeOf(e) === null) ? { ...e } : e;
|
|
3956
4007
|
}
|
|
3957
|
-
function
|
|
4008
|
+
function ja(e) {
|
|
3958
4009
|
if (typeof e != "object" || !e || !("parts" in e) || !Array.isArray(e.parts)) return e;
|
|
3959
4010
|
let t = e, n = {
|
|
3960
4011
|
...t,
|
|
3961
4012
|
parts: t.parts.map((e) => ({ ...e }))
|
|
3962
4013
|
};
|
|
3963
|
-
return "metadata" in t && (n.metadata =
|
|
4014
|
+
return "metadata" in t && (n.metadata = Aa(t.metadata)), n;
|
|
3964
4015
|
}
|
|
3965
|
-
var
|
|
4016
|
+
var Ma = class {
|
|
3966
4017
|
constructor({ initialMessages: e, messagesRef: t, statusRef: n, errorRef: r, queuedMessagesRef: i, throttleWaitMs: a }) {
|
|
3967
4018
|
this.publishedMessages = [], this.publishedMessageSources = [], this.dirtyMessageIndices = /* @__PURE__ */ new Set(), this.statusValue = "ready", this.queuedMessagesValue = [], this.hasPendingPublication = !1, this.isActive = !0, this.isPublishing = !1, this.pushMessage = (e) => {
|
|
3968
4019
|
this.messagesValue.push(e), this.dirtyMessageIndices.add(this.messagesValue.length - 1), this.schedulePublication();
|
|
@@ -3970,7 +4021,7 @@ var Sa = class {
|
|
|
3970
4021
|
this.messagesValue.pop(), this.schedulePublication();
|
|
3971
4022
|
}, this.replaceMessage = (e, t) => {
|
|
3972
4023
|
this.messagesValue[e] = t, this.dirtyMessageIndices.add(e), this.schedulePublication();
|
|
3973
|
-
}, this.snapshot =
|
|
4024
|
+
}, this.snapshot = ja, this.handleIntervalEnd = () => {
|
|
3974
4025
|
this.timeout = void 0, this.isActive && this.hasPendingPublication && (this.hasPendingPublication = !1, this.publishMessages(), this.timeout = setTimeout(this.handleIntervalEnd, this.throttleWaitMs));
|
|
3975
4026
|
}, this.messagesValue = e, this.messagesRef = t, this.statusRef = n, this.errorRef = r, this.queuedMessagesRef = i, this.throttleWaitMs = a != null && Number.isFinite(a) && a > 0 ? a : void 0;
|
|
3976
4027
|
}
|
|
@@ -4018,7 +4069,7 @@ var Sa = class {
|
|
|
4018
4069
|
}
|
|
4019
4070
|
publishMessages() {
|
|
4020
4071
|
if (!this.isActive) return;
|
|
4021
|
-
let e = this.messagesValue.map((e, t) => this.dirtyMessageIndices.has(t) || this.publishedMessageSources[t] !== e ?
|
|
4072
|
+
let e = this.messagesValue.map((e, t) => this.dirtyMessageIndices.has(t) || this.publishedMessageSources[t] !== e ? ja(e) : this.publishedMessages[t]);
|
|
4022
4073
|
this.publishedMessages = e, this.publishedMessageSources = [...this.messagesValue], this.dirtyMessageIndices.clear(), this.isPublishing = !0;
|
|
4023
4074
|
try {
|
|
4024
4075
|
this.messagesRef.value = e;
|
|
@@ -4026,7 +4077,7 @@ var Sa = class {
|
|
|
4026
4077
|
this.isPublishing = !1;
|
|
4027
4078
|
}
|
|
4028
4079
|
}
|
|
4029
|
-
},
|
|
4080
|
+
}, Na = class extends ia {
|
|
4030
4081
|
constructor({ state: e, ...t }) {
|
|
4031
4082
|
super({
|
|
4032
4083
|
...t,
|
|
@@ -4034,13 +4085,13 @@ var Sa = class {
|
|
|
4034
4085
|
});
|
|
4035
4086
|
}
|
|
4036
4087
|
};
|
|
4037
|
-
function
|
|
4038
|
-
let t =
|
|
4039
|
-
return
|
|
4088
|
+
function Pa(e) {
|
|
4089
|
+
let t = D([]), n = D("ready"), r = D(), i = D([]), a = D(), o;
|
|
4090
|
+
return O(t, (e) => {
|
|
4040
4091
|
o != null && !o.isPublishing && o.setMessagesFromConsumer(e);
|
|
4041
|
-
}, { flush: "sync" }),
|
|
4092
|
+
}, { flush: "sync" }), O(() => rt(e), (e) => {
|
|
4042
4093
|
o?.dispose();
|
|
4043
|
-
let { throttle: s, ...c } = e ?? {}, l = new
|
|
4094
|
+
let { throttle: s, ...c } = e ?? {}, l = new Ma({
|
|
4044
4095
|
initialMessages: c.messages ?? [],
|
|
4045
4096
|
messagesRef: t,
|
|
4046
4097
|
statusRef: n,
|
|
@@ -4048,14 +4099,14 @@ function wa(e) {
|
|
|
4048
4099
|
queuedMessagesRef: i,
|
|
4049
4100
|
throttleWaitMs: s
|
|
4050
4101
|
});
|
|
4051
|
-
o = l, l.publishInitialState(), a.value = new
|
|
4102
|
+
o = l, l.publishInitialState(), a.value = new Na({
|
|
4052
4103
|
...c,
|
|
4053
4104
|
state: l
|
|
4054
4105
|
});
|
|
4055
|
-
}, { immediate: !0 }),
|
|
4106
|
+
}, { immediate: !0 }), T() != null && et(() => {
|
|
4056
4107
|
o?.dispose();
|
|
4057
4108
|
}), {
|
|
4058
|
-
id:
|
|
4109
|
+
id: w(() => a.value.id),
|
|
4059
4110
|
status: n,
|
|
4060
4111
|
messages: t,
|
|
4061
4112
|
error: r,
|
|
@@ -4072,60 +4123,60 @@ function wa(e) {
|
|
|
4072
4123
|
};
|
|
4073
4124
|
}
|
|
4074
4125
|
// ../../packages/composable/src/chatbot/useChatbotStore.ts
|
|
4075
|
-
var
|
|
4126
|
+
var Fa = "voice-", Ia = 300, La = (e) => e?.role === "assistant" && e.parts.some((e) => e.state === "approval-requested"), Ra = (e) => e.replace(/\s+/g, " ").trim().toLowerCase(), za = (e) => Ra(e.parts.filter((e) => e.type === "text").map((e) => "text" in e ? e.text : "").join(" ")), Ba = 8, Va = (e, t) => {
|
|
4076
4127
|
let n = new Set(t.map((e) => e.id)), r = e.filter((e) => e.role === "user" && !n.has(e.id)).map((e) => ({
|
|
4077
|
-
text:
|
|
4128
|
+
text: za(e),
|
|
4078
4129
|
taken: !1
|
|
4079
4130
|
}));
|
|
4080
4131
|
return t.filter((e) => {
|
|
4081
4132
|
if (!e.id.startsWith("voice-") || e.role !== "user") return !1;
|
|
4082
|
-
let t =
|
|
4133
|
+
let t = za(e), n = r.find((e) => !e.taken && e.text.length > 0 && (e.text === t || e.text.length >= Ba && t.endsWith(e.text)));
|
|
4083
4134
|
return !n || (n.taken = !0, !1);
|
|
4084
4135
|
});
|
|
4085
|
-
},
|
|
4136
|
+
}, Ha = 12e4, Ua = 1e3, Wa = 5e3, Ga = 100, Ka = 3e4, qa = 5e3, Ja = 250, Ya = 1e3, Xa = "\n\n", Za = (e) => {
|
|
4086
4137
|
let t = e.type ?? "";
|
|
4087
4138
|
return t === "dynamic-tool" ? e.toolName ?? "" : t.startsWith("tool-") ? t.slice(5) : "";
|
|
4088
|
-
},
|
|
4139
|
+
}, Qa = (e) => e?.role === "assistant" && e.parts.some((e) => He(Za(e)) && !e.providerExecuted && !Re.has(e.state ?? "")), $a = ({ messages: e }) => {
|
|
4089
4140
|
let t = e[e.length - 1];
|
|
4090
4141
|
if (!t || t.role !== "assistant") return !1;
|
|
4091
|
-
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 && (
|
|
4092
|
-
return r.length > 0 && r.every((e) =>
|
|
4142
|
+
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 && (He(Za(e)) || Je(e)));
|
|
4143
|
+
return r.length > 0 && r.every((e) => Re.has(e.state ?? ""));
|
|
4093
4144
|
};
|
|
4094
|
-
function
|
|
4095
|
-
return
|
|
4096
|
-
let { t, te: n, locale: r } =
|
|
4145
|
+
function eo(e) {
|
|
4146
|
+
return k(`chatbot-${e}`, () => {
|
|
4147
|
+
let { t, te: n, locale: r } = at({ useScope: "global" }), i = E(""), a = E(), o = E(e), s = E(), c = E(), l = E(), u = E(), d = E(), f = E(), p = E(), m = E(), h = E(), g = E(), _ = E(), v = E(), ee = E(), y = E(), te = E(), ne = E(), re = D(), ie = E(0), ae = E(0), oe = E(), se = E(), b = E(), ce = D(), le = D(), ue = E(), de = E(), fe = D(), pe = E(!1), me = E({}), he = E({}), ge = E(!1), _e = E(0), ve = E(), ye = E(!1), be = st(), x = w(() => {
|
|
4097
4148
|
let e = u.value?.theme;
|
|
4098
|
-
return e && e !== "auto" || (e =
|
|
4099
|
-
}),
|
|
4149
|
+
return e && e !== "auto" || (e = ve.value), e ? e === "dark" : be.value;
|
|
4150
|
+
}), S = w(() => c.value === "reasoning"), xe = w(() => S.value ? g.value?.filter((e) => ![
|
|
4100
4151
|
"upvote",
|
|
4101
4152
|
"downvote",
|
|
4102
4153
|
"feedback"
|
|
4103
|
-
].includes(e)) : g.value),
|
|
4104
|
-
|
|
4105
|
-
|
|
4154
|
+
].includes(e)) : g.value), Se = Le(w(() => `${o.value}-chatId`), null);
|
|
4155
|
+
it(() => {
|
|
4156
|
+
Se.value ||= $t();
|
|
4106
4157
|
});
|
|
4107
|
-
let
|
|
4108
|
-
get: () =>
|
|
4158
|
+
let C = w({
|
|
4159
|
+
get: () => Se.value,
|
|
4109
4160
|
set: (e) => {
|
|
4110
|
-
|
|
4161
|
+
Se.value = e;
|
|
4111
4162
|
}
|
|
4112
|
-
}),
|
|
4113
|
-
function
|
|
4114
|
-
|
|
4163
|
+
}), Ce = Ie(w(() => `${o.value}-pageAccessOff`), !1), we = w(() => Ce.value ? [] : ce.value ?? []), Te = () => Ce.value ? [] : le.value?.() ?? [], Ee = w(() => !!(oe.value && ce.value?.length)), De = Le(w(() => `${o.value}-${l.value ?? "anonymous"}-confirmations`), "manual"), Oe = w(() => se.value?.allowAutomatic === !0), ke = w(() => Oe.value && De.value === "automatic" ? "automatic" : "manual");
|
|
4164
|
+
function Ae(e) {
|
|
4165
|
+
De.value = e;
|
|
4115
4166
|
}
|
|
4116
|
-
let
|
|
4117
|
-
|
|
4118
|
-
e || (
|
|
4167
|
+
let je = w(() => !!fe.value && oe.value?.pointer === !0 && we.value.length > 0);
|
|
4168
|
+
O(je, (e) => {
|
|
4169
|
+
e || (de.value = void 0);
|
|
4119
4170
|
});
|
|
4120
|
-
let
|
|
4121
|
-
let e =
|
|
4122
|
-
return e && e !==
|
|
4171
|
+
let Me = Le(w(() => `${o.value}-pageNotice`), null), Ne = w(() => {
|
|
4172
|
+
let e = oe.value?.level;
|
|
4173
|
+
return e && e !== Ve.Off && we.value.length && !Ke(Me.value ?? void 0, e) ? e : void 0;
|
|
4123
4174
|
});
|
|
4124
|
-
function
|
|
4125
|
-
|
|
4175
|
+
function Pe() {
|
|
4176
|
+
Me.value = oe.value?.level ?? null;
|
|
4126
4177
|
}
|
|
4127
|
-
let
|
|
4128
|
-
function
|
|
4178
|
+
let Fe = E(), Re = E(!1), He = w(() => Fe.value?.message?.toLowerCase().includes("conversation-blocked") ?? !1);
|
|
4179
|
+
function We(e) {
|
|
4129
4180
|
try {
|
|
4130
4181
|
let t = JSON.parse(e.message);
|
|
4131
4182
|
return t.status === 404 || t.type?.includes("entity-not-found");
|
|
@@ -4133,99 +4184,99 @@ function Wa(e) {
|
|
|
4133
4184
|
return !1;
|
|
4134
4185
|
}
|
|
4135
4186
|
}
|
|
4136
|
-
function
|
|
4137
|
-
if (
|
|
4138
|
-
let e =
|
|
4139
|
-
|
|
4140
|
-
|
|
4187
|
+
function qe(e) {
|
|
4188
|
+
if (We(e) && !F.value) {
|
|
4189
|
+
let e = P.value.messages.filter((e) => e.role === "user"), t = e[e.length - 1], n = t ? Xe(t) : void 0;
|
|
4190
|
+
C.value = $t(), Fe.value = void 0, $e(() => {
|
|
4191
|
+
P.value.clearError(), n && P.value.sendMessage({ text: n });
|
|
4141
4192
|
});
|
|
4142
|
-
} else
|
|
4193
|
+
} else Ze.error(e), Fe.value = e, He.value && (Re.value = !0);
|
|
4143
4194
|
}
|
|
4144
|
-
let
|
|
4195
|
+
let T = w(() => Be({
|
|
4145
4196
|
baseUrl: i.value,
|
|
4146
4197
|
basePath: a.value,
|
|
4147
4198
|
headers: () => p.value
|
|
4148
|
-
})),
|
|
4149
|
-
...
|
|
4150
|
-
...
|
|
4151
|
-
}),
|
|
4152
|
-
let e =
|
|
4199
|
+
})), Qe = E(null), nt = () => ({
|
|
4200
|
+
...ct(),
|
|
4201
|
+
...Qe.value ?? {}
|
|
4202
|
+
}), rt = () => {
|
|
4203
|
+
let e = _e.value;
|
|
4153
4204
|
return new Promise((t) => {
|
|
4154
4205
|
let n = setTimeout(() => {
|
|
4155
4206
|
r(), t(!1);
|
|
4156
|
-
}, 3e4), r =
|
|
4207
|
+
}, 3e4), r = O(() => [_e.value, P.value.status], ([i, a]) => {
|
|
4157
4208
|
i > e && a === "streaming" && (clearTimeout(n), r(), t(!0));
|
|
4158
4209
|
});
|
|
4159
4210
|
});
|
|
4160
|
-
},
|
|
4161
|
-
|
|
4211
|
+
}, k = D(), dt = (e, t) => new Promise((n) => {
|
|
4212
|
+
k.value?.answer(!1), k.value = {
|
|
4162
4213
|
toolCallId: e.toolCallId,
|
|
4163
4214
|
question: t?.question,
|
|
4164
4215
|
details: t?.details,
|
|
4165
4216
|
unchanged: t?.unchanged,
|
|
4166
4217
|
answer: (e) => {
|
|
4167
|
-
|
|
4218
|
+
k.value = void 0, n(e);
|
|
4168
4219
|
}
|
|
4169
4220
|
};
|
|
4170
4221
|
});
|
|
4171
|
-
function
|
|
4172
|
-
|
|
4222
|
+
function ht(e) {
|
|
4223
|
+
k.value?.answer(e);
|
|
4173
4224
|
}
|
|
4174
|
-
let
|
|
4175
|
-
t.details?.some((e) => e.before !== void 0) && (
|
|
4176
|
-
...
|
|
4225
|
+
let gt = (e, t) => {
|
|
4226
|
+
t.details?.some((e) => e.before !== void 0) && (he.value = {
|
|
4227
|
+
...he.value,
|
|
4177
4228
|
[e.toolCallId]: {
|
|
4178
4229
|
details: t.details,
|
|
4179
4230
|
unchanged: t.unchanged
|
|
4180
4231
|
}
|
|
4181
4232
|
});
|
|
4182
|
-
},
|
|
4233
|
+
}, A = ({ forms: e }) => oe.value && we.value.length ? {
|
|
4183
4234
|
version: 1,
|
|
4184
|
-
features: [...
|
|
4185
|
-
forms: e ?
|
|
4235
|
+
features: [...Ue],
|
|
4236
|
+
forms: e ? Te().map(({ name: e, description: t, inputSchema: n, annotations: r }) => ({
|
|
4186
4237
|
name: e,
|
|
4187
4238
|
description: t,
|
|
4188
4239
|
inputSchema: n,
|
|
4189
4240
|
annotations: r
|
|
4190
4241
|
})) : []
|
|
4191
|
-
} : void 0,
|
|
4242
|
+
} : void 0, _t = (e) => {
|
|
4192
4243
|
if (e?.provider !== "page") {
|
|
4193
|
-
|
|
4244
|
+
ue.value = void 0;
|
|
4194
4245
|
return;
|
|
4195
4246
|
}
|
|
4196
|
-
let t = [...
|
|
4247
|
+
let t = [...we.value, ...Te()].find((t) => t.name === e.toolName), n;
|
|
4197
4248
|
try {
|
|
4198
4249
|
n = t?.describe?.(e.input);
|
|
4199
4250
|
} catch {
|
|
4200
4251
|
n = void 0;
|
|
4201
4252
|
}
|
|
4202
|
-
n && (
|
|
4203
|
-
...
|
|
4253
|
+
n && (me.value = {
|
|
4254
|
+
...me.value,
|
|
4204
4255
|
[e.toolCallId]: n
|
|
4205
|
-
}), e.readOnly ?
|
|
4206
|
-
},
|
|
4256
|
+
}), e.readOnly ? ue.value = void 0 : (ue.value = { title: n ?? t?.annotations?.title ?? e.toolName }, ge.value = !0);
|
|
4257
|
+
}, vt = mt({
|
|
4207
4258
|
registry: () => [
|
|
4208
|
-
...(
|
|
4209
|
-
...
|
|
4210
|
-
...
|
|
4259
|
+
...(re.value ?? []).filter((e) => !Ge(e.name)),
|
|
4260
|
+
...we.value,
|
|
4261
|
+
...Te()
|
|
4211
4262
|
],
|
|
4212
|
-
capability: () =>
|
|
4213
|
-
addToolOutput: (e) => void
|
|
4214
|
-
confirm:
|
|
4215
|
-
waitForResume:
|
|
4263
|
+
capability: () => ne.value,
|
|
4264
|
+
addToolOutput: (e) => void P.value.addToolOutput(e),
|
|
4265
|
+
confirm: dt,
|
|
4266
|
+
waitForResume: rt,
|
|
4216
4267
|
onPendingChange: (e) => {
|
|
4217
|
-
|
|
4268
|
+
ie.value = e;
|
|
4218
4269
|
},
|
|
4219
|
-
onActivity:
|
|
4220
|
-
mode: () =>
|
|
4221
|
-
onSkip:
|
|
4222
|
-
}),
|
|
4223
|
-
let n =
|
|
4224
|
-
|
|
4225
|
-
},
|
|
4226
|
-
registry: () =>
|
|
4227
|
-
capability: () =>
|
|
4228
|
-
addToolOutput: (e) =>
|
|
4270
|
+
onActivity: _t,
|
|
4271
|
+
mode: () => ke.value,
|
|
4272
|
+
onSkip: gt
|
|
4273
|
+
}), yt = /* @__PURE__ */ new Map(), bt = 0, xt = (e, t) => {
|
|
4274
|
+
let n = yt.get(e);
|
|
4275
|
+
yt.delete(e), n?.(JSON.stringify(t));
|
|
4276
|
+
}, St = mt({
|
|
4277
|
+
registry: () => we.value,
|
|
4278
|
+
capability: () => ne.value,
|
|
4279
|
+
addToolOutput: (e) => xt(e.toolCallId, "output" in e ? e.output : {
|
|
4229
4280
|
content: [{
|
|
4230
4281
|
type: "text",
|
|
4231
4282
|
text: e.errorText
|
|
@@ -4233,42 +4284,42 @@ function Wa(e) {
|
|
|
4233
4284
|
isError: !0
|
|
4234
4285
|
}),
|
|
4235
4286
|
confirm: async (e, t) => {
|
|
4236
|
-
for (;
|
|
4237
|
-
let t = k
|
|
4287
|
+
for (; k.value;) await new Promise((e) => {
|
|
4288
|
+
let t = O(k, (n) => {
|
|
4238
4289
|
n || (t(), e());
|
|
4239
4290
|
});
|
|
4240
4291
|
});
|
|
4241
|
-
return
|
|
4292
|
+
return yt.has(e.toolCallId) ? dt(e, t) : !1;
|
|
4242
4293
|
},
|
|
4243
|
-
waitForResume: () => new Promise((e) => setTimeout(() => e(!0),
|
|
4294
|
+
waitForResume: () => new Promise((e) => setTimeout(() => e(!0), Ia)),
|
|
4244
4295
|
onPendingChange: (e) => {
|
|
4245
|
-
|
|
4296
|
+
ae.value = e;
|
|
4246
4297
|
},
|
|
4247
|
-
onActivity:
|
|
4248
|
-
mode: () =>
|
|
4249
|
-
}),
|
|
4250
|
-
function
|
|
4251
|
-
|
|
4252
|
-
let e =
|
|
4298
|
+
onActivity: _t,
|
|
4299
|
+
mode: () => Ct
|
|
4300
|
+
}), Ct = "manual";
|
|
4301
|
+
function wt() {
|
|
4302
|
+
Ct = ke.value;
|
|
4303
|
+
let e = A({ forms: !1 });
|
|
4253
4304
|
if (e) return {
|
|
4254
4305
|
declaration: e,
|
|
4255
|
-
clientTools: Object.fromEntries(
|
|
4256
|
-
|
|
4257
|
-
let r = `page-call-${
|
|
4258
|
-
|
|
4306
|
+
clientTools: Object.fromEntries(we.value.map((e) => [e.name, (t) => new Promise((n) => {
|
|
4307
|
+
bt += 1;
|
|
4308
|
+
let r = `page-call-${bt}`;
|
|
4309
|
+
yt.set(r, n), St.enqueue({
|
|
4259
4310
|
toolCallId: r,
|
|
4260
4311
|
toolName: e.name,
|
|
4261
4312
|
input: t ?? {},
|
|
4262
|
-
messageId:
|
|
4313
|
+
messageId: Bt()?.id ?? "",
|
|
4263
4314
|
readOnly: e.annotations?.readOnlyHint === !0,
|
|
4264
4315
|
provider: "page"
|
|
4265
4316
|
});
|
|
4266
4317
|
})]))
|
|
4267
4318
|
};
|
|
4268
4319
|
}
|
|
4269
|
-
function
|
|
4270
|
-
|
|
4271
|
-
for (let e of [...
|
|
4320
|
+
function Tt() {
|
|
4321
|
+
St.cancelAll(), k.value && yt.has(k.value.toolCallId) && k.value.answer(!1);
|
|
4322
|
+
for (let e of [...yt.keys()]) xt(e, {
|
|
4272
4323
|
content: [{
|
|
4273
4324
|
type: "text",
|
|
4274
4325
|
text: "Stopped by the user."
|
|
@@ -4276,34 +4327,34 @@ function Wa(e) {
|
|
|
4276
4327
|
isError: !0
|
|
4277
4328
|
});
|
|
4278
4329
|
}
|
|
4279
|
-
async function
|
|
4280
|
-
|
|
4330
|
+
async function Et() {
|
|
4331
|
+
Dt(), Tt(), ue.value = void 0, ge.value = !1, U.value = "", await P.value.stop();
|
|
4281
4332
|
}
|
|
4282
|
-
function
|
|
4283
|
-
|
|
4333
|
+
function Dt() {
|
|
4334
|
+
vt.cancelAll(), k.value && !yt.has(k.value.toolCallId) && k.value.answer(!1);
|
|
4284
4335
|
}
|
|
4285
|
-
async function
|
|
4286
|
-
|
|
4336
|
+
async function Ot(e) {
|
|
4337
|
+
Ce.value = e, e && await Et();
|
|
4287
4338
|
}
|
|
4288
|
-
|
|
4289
|
-
let
|
|
4290
|
-
function
|
|
4291
|
-
|
|
4292
|
-
...
|
|
4339
|
+
O(C, () => Dt(), { flush: "sync" });
|
|
4340
|
+
let kt = !1, j, At = E(), jt, Mt = E([]), M = E([]), N = E([]), Nt = E({}), Pt = /* @__PURE__ */ new Map(), Ft = /* @__PURE__ */ new Set();
|
|
4341
|
+
function It(e, t, n) {
|
|
4342
|
+
M.value.includes(e) || (M.value = [...M.value, e]), Pt.set(e, Date.now()), n ? Ft.add(e) : Ft.delete(e), t && (Nt.value = {
|
|
4343
|
+
...Nt.value,
|
|
4293
4344
|
[e]: t
|
|
4294
4345
|
}), nr || ar();
|
|
4295
4346
|
}
|
|
4296
|
-
function It(e) {
|
|
4297
|
-
Mt.value = Object.fromEntries(Object.entries(Mt.value).filter(([t]) => t !== e));
|
|
4298
|
-
}
|
|
4299
4347
|
function Lt(e) {
|
|
4300
|
-
Nt.
|
|
4348
|
+
Nt.value = Object.fromEntries(Object.entries(Nt.value).filter(([t]) => t !== e));
|
|
4349
|
+
}
|
|
4350
|
+
function Rt(e) {
|
|
4351
|
+
Pt.delete(e), M.value = M.value.filter((t) => t !== e), N.value = N.value.filter((t) => t !== e), Lt(e);
|
|
4301
4352
|
}
|
|
4302
|
-
let
|
|
4303
|
-
id:
|
|
4304
|
-
transport: new
|
|
4305
|
-
api:
|
|
4306
|
-
prepareReconnectToStreamRequest: ({ id: e }) => ({ api:
|
|
4353
|
+
let zt = Pa(() => ({
|
|
4354
|
+
id: C.value,
|
|
4355
|
+
transport: new ra({
|
|
4356
|
+
api: T.value.getChatEndpoint(o.value, S.value ? "reasoning" : "chat"),
|
|
4357
|
+
prepareReconnectToStreamRequest: ({ id: e }) => ({ api: T.value.getChatStreamEndpoint(o.value, e) }),
|
|
4307
4358
|
prepareSendMessagesRequest: ({ messages: e, id: t }) => ({ body: {
|
|
4308
4359
|
id: t,
|
|
4309
4360
|
messages: [e[e.length - 1]],
|
|
@@ -4318,61 +4369,61 @@ function Wa(e) {
|
|
|
4318
4369
|
reasoning: d.value?.reasoning,
|
|
4319
4370
|
webSearch: f.value?.webSearch,
|
|
4320
4371
|
smoothStream: u.value?.smoothStream,
|
|
4321
|
-
deviceContext:
|
|
4322
|
-
externalContext:
|
|
4372
|
+
deviceContext: nt(),
|
|
4373
|
+
externalContext: te.value,
|
|
4323
4374
|
disabledTools: f.value?.disabled,
|
|
4324
|
-
fallbackModels:
|
|
4325
|
-
gatewayOptions:
|
|
4326
|
-
hostTools:
|
|
4327
|
-
pageTools:
|
|
4328
|
-
...
|
|
4329
|
-
...
|
|
4375
|
+
fallbackModels: ee.value,
|
|
4376
|
+
gatewayOptions: y.value,
|
|
4377
|
+
hostTools: pt(re.value, ne.value),
|
|
4378
|
+
pageTools: A({ forms: !0 }),
|
|
4379
|
+
...Qt(t) && { projectId: Qt(t) },
|
|
4380
|
+
...ke.value === "automatic" && { confirmations: "automatic" }
|
|
4330
4381
|
} }),
|
|
4331
4382
|
credentials: "include",
|
|
4332
4383
|
headers: () => p.value ?? {}
|
|
4333
4384
|
}),
|
|
4334
|
-
sendAutomaticallyWhen: (e) => !
|
|
4385
|
+
sendAutomaticallyWhen: (e) => !F.value && ($a(e) || aa(e)),
|
|
4335
4386
|
onError: (e) => {
|
|
4336
|
-
|
|
4387
|
+
kt ? Ze.warn(e) : qe(e);
|
|
4337
4388
|
},
|
|
4338
4389
|
onToolCall: ({ toolCall: e }) => {
|
|
4339
|
-
if (!
|
|
4390
|
+
if (!ft(e) || kt || F.value) return;
|
|
4340
4391
|
let t = e;
|
|
4341
|
-
|
|
4392
|
+
vt.enqueue({
|
|
4342
4393
|
toolCallId: t.toolCallId,
|
|
4343
4394
|
toolName: t.toolName,
|
|
4344
4395
|
input: t.input,
|
|
4345
|
-
messageId:
|
|
4396
|
+
messageId: Bt()?.id ?? "",
|
|
4346
4397
|
readOnly: t.toolMetadata?.readOnly === !0,
|
|
4347
4398
|
provider: t.toolMetadata?.provider === "page" ? "page" : "app"
|
|
4348
4399
|
});
|
|
4349
4400
|
},
|
|
4350
4401
|
onData: (e) => {
|
|
4351
|
-
e.type === "data-turnStream" ?
|
|
4402
|
+
e.type === "data-turnStream" ? jt = e.data.streamId : e.type === "data-audioTranscripts" && (P.value.messages = Ye(P.value.messages, e.data));
|
|
4352
4403
|
},
|
|
4353
4404
|
onFinish: () => {
|
|
4354
|
-
let e =
|
|
4355
|
-
!
|
|
4405
|
+
let e = C.value;
|
|
4406
|
+
!S.value && !L.value.some((t) => t.id === e) && K(o.value);
|
|
4356
4407
|
}
|
|
4357
|
-
})),
|
|
4358
|
-
|
|
4359
|
-
if (t && !
|
|
4360
|
-
let e =
|
|
4361
|
-
|
|
4408
|
+
})), P = w(() => tt(zt)), Bt = () => P.value.messages[P.value.messages.length - 1];
|
|
4409
|
+
O(C, (e, t) => {
|
|
4410
|
+
if (t && !S.value && (q() || j?.chatId === t)) {
|
|
4411
|
+
let e = P.value.messages.filter((e) => e.role === "user"), n = e[e.length - 1];
|
|
4412
|
+
It(t, n ? Xe(n) ?? "" : "", P.value.status === "streaming" || j?.chatId === t);
|
|
4362
4413
|
}
|
|
4363
|
-
|
|
4414
|
+
Rt(e), jt = void 0, clearTimeout(Qn), Zn.value = !1, P.value.stop();
|
|
4364
4415
|
}, { flush: "sync" });
|
|
4365
|
-
let
|
|
4416
|
+
let Vt = w(() => {
|
|
4366
4417
|
let e = u.value?.initialMessage;
|
|
4367
4418
|
return e?.[r.value] ? e[r.value] : n("message.defaultAgentWelcome") ? t("message.defaultAgentWelcome") : "";
|
|
4368
|
-
}),
|
|
4369
|
-
id:
|
|
4419
|
+
}), Ht = $t(), Ut = w(() => ({
|
|
4420
|
+
id: Ht,
|
|
4370
4421
|
role: "assistant",
|
|
4371
4422
|
parts: [{
|
|
4372
4423
|
type: "text",
|
|
4373
|
-
text:
|
|
4424
|
+
text: Vt.value
|
|
4374
4425
|
}]
|
|
4375
|
-
})),
|
|
4426
|
+
})), Wt = w(() => {
|
|
4376
4427
|
let e = (e) => e.map((e) => e.role !== "user" || !e.parts.some((e) => e.type === "file") ? e : {
|
|
4377
4428
|
...e,
|
|
4378
4429
|
parts: e.parts.map((e) => {
|
|
@@ -4382,177 +4433,177 @@ function Wa(e) {
|
|
|
4382
4433
|
let e = t.url.slice(13);
|
|
4383
4434
|
return {
|
|
4384
4435
|
...t,
|
|
4385
|
-
url:
|
|
4436
|
+
url: T.value.getMediaUrl(o.value, C.value, e)
|
|
4386
4437
|
};
|
|
4387
4438
|
}
|
|
4388
4439
|
return t.url.startsWith("blob:") ? t : {
|
|
4389
4440
|
...t,
|
|
4390
|
-
url:
|
|
4441
|
+
url: T.value.appendAuthToken(t.url)
|
|
4391
4442
|
};
|
|
4392
4443
|
})
|
|
4393
|
-
}), t =
|
|
4394
|
-
return
|
|
4395
|
-
}),
|
|
4444
|
+
}), t = P.value.id === C.value ? P.value.messages : [];
|
|
4445
|
+
return S.value ? e(t) : !ye.value && t[0]?.role !== "assistant" ? [Ut.value, ...e(t)] : e(t);
|
|
4446
|
+
}), Gt = w(() => {
|
|
4396
4447
|
let e = u.value?.messagePlaceholder;
|
|
4397
4448
|
return e?.[r.value] ? e[r.value] : n("placeholder.askAnything") ? t("placeholder.askAnything") : "";
|
|
4398
|
-
}),
|
|
4399
|
-
function
|
|
4400
|
-
|
|
4449
|
+
}), Kt = E(!1), qt = E();
|
|
4450
|
+
function Jt(e, t) {
|
|
4451
|
+
qt.value = {
|
|
4401
4452
|
chatId: e,
|
|
4402
4453
|
authorId: t.authorId,
|
|
4403
4454
|
projectId: t.projectId ?? void 0
|
|
4404
4455
|
};
|
|
4405
4456
|
}
|
|
4406
|
-
let
|
|
4407
|
-
let t =
|
|
4457
|
+
let Yt = (e) => qt.value?.chatId === e ? qt.value : void 0, Xt = w(() => Yt(C.value)?.authorId), Zt = w(() => Yt(C.value)?.projectId), F = w(() => Xt.value !== void 0 && l.value !== void 0 && Xt.value !== l.value), Qt = (e) => {
|
|
4458
|
+
let t = Yt(e);
|
|
4408
4459
|
return t && t.authorId === void 0 ? t.projectId : void 0;
|
|
4409
|
-
},
|
|
4410
|
-
function
|
|
4411
|
-
let n = Object.fromEntries(Object.entries(
|
|
4412
|
-
|
|
4460
|
+
}, I = () => Kt.value ? { projectId: ze } : void 0, L = E([]), en = E(!1), tn = E(1), nn = E(!1), rn = E(!1), an, R = E([]), z = E(!1), on = E("chat"), sn = E(0), cn = E([]), B = E(), ln = E(!1), un = E(!1), dn = E(), fn = E(!1), pn = E(!1), mn = E(), V = E(""), H = E([]), U = E(""), hn = E(!0), gn = D(), _n = E(0), vn = Ie(w(() => `${o.value}-queue`), {}), yn = w(() => vn.value[C.value] ?? []), W = w(() => !S.value);
|
|
4461
|
+
function bn(e, t) {
|
|
4462
|
+
let n = Object.fromEntries(Object.entries(vn.value).filter(([t]) => t !== e));
|
|
4463
|
+
vn.value = t.length > 0 ? {
|
|
4413
4464
|
...n,
|
|
4414
4465
|
[e]: t
|
|
4415
4466
|
} : n;
|
|
4416
4467
|
}
|
|
4417
|
-
function bn(e) {
|
|
4418
|
-
let t = (_n.value[e] ?? []).join(Ba);
|
|
4419
|
-
return yn(e, []), t;
|
|
4420
|
-
}
|
|
4421
4468
|
function xn(e) {
|
|
4422
|
-
|
|
4469
|
+
let t = (vn.value[e] ?? []).join(Xa);
|
|
4470
|
+
return bn(e, []), t;
|
|
4423
4471
|
}
|
|
4424
4472
|
function Sn(e) {
|
|
4425
|
-
|
|
4473
|
+
e && (V.value = V.value ? `${V.value}${Xa}${e}` : e);
|
|
4474
|
+
}
|
|
4475
|
+
function Cn(e) {
|
|
4476
|
+
bn(C.value, yn.value.filter((t, n) => n !== e));
|
|
4426
4477
|
}
|
|
4427
|
-
function
|
|
4428
|
-
let t =
|
|
4429
|
-
|
|
4478
|
+
function G(e) {
|
|
4479
|
+
let t = yn.value[e];
|
|
4480
|
+
Cn(e), Sn(t ?? "");
|
|
4430
4481
|
}
|
|
4431
|
-
async function
|
|
4432
|
-
if (
|
|
4482
|
+
async function K(e) {
|
|
4483
|
+
if (S.value) L.value = [];
|
|
4433
4484
|
else {
|
|
4434
|
-
|
|
4485
|
+
en.value = !0;
|
|
4435
4486
|
try {
|
|
4436
|
-
let t = await
|
|
4487
|
+
let t = await T.value.getConversations(e, l.value, I()), n = new Set(t.map((e) => e.id)), r = M.value.filter((e) => !n.has(e) && Nt.value[e]).map((t) => ({
|
|
4437
4488
|
id: t,
|
|
4438
4489
|
agentId: e,
|
|
4439
|
-
title:
|
|
4490
|
+
title: Nt.value[t],
|
|
4440
4491
|
summary: null,
|
|
4441
4492
|
messages: [],
|
|
4442
4493
|
lastMessageAt: /* @__PURE__ */ new Date()
|
|
4443
4494
|
})), i = `${e}:${l.value ?? ""}`;
|
|
4444
|
-
i !==
|
|
4445
|
-
let a = new Set(r.map((e) => e.id)), o =
|
|
4446
|
-
|
|
4495
|
+
i !== an && (tn.value = 1);
|
|
4496
|
+
let a = new Set(r.map((e) => e.id)), o = tn.value > 1 ? L.value.filter((e) => !n.has(e.id) && !a.has(e.id)) : [];
|
|
4497
|
+
L.value = [
|
|
4447
4498
|
...r,
|
|
4448
4499
|
...t,
|
|
4449
4500
|
...o
|
|
4450
|
-
],
|
|
4501
|
+
], an = i, tn.value === 1 && (nn.value = t.length >= 100);
|
|
4451
4502
|
} catch {
|
|
4452
|
-
|
|
4503
|
+
L.value = [], tn.value = 1, an = void 0, nn.value = !1;
|
|
4453
4504
|
return;
|
|
4454
4505
|
} finally {
|
|
4455
|
-
|
|
4506
|
+
en.value = !1;
|
|
4456
4507
|
}
|
|
4457
|
-
sr([.../* @__PURE__ */ new Set([...er(), ...
|
|
4508
|
+
sr([.../* @__PURE__ */ new Set([...er(), ...L.value.map((e) => e.id)])]);
|
|
4458
4509
|
}
|
|
4459
4510
|
}
|
|
4460
|
-
async function
|
|
4461
|
-
if (!
|
|
4462
|
-
|
|
4463
|
-
let e =
|
|
4511
|
+
async function wn() {
|
|
4512
|
+
if (!nn.value || rn.value || S.value) return;
|
|
4513
|
+
rn.value = !0;
|
|
4514
|
+
let e = an;
|
|
4464
4515
|
try {
|
|
4465
|
-
let t =
|
|
4466
|
-
...
|
|
4516
|
+
let t = tn.value + 1, n = await T.value.getConversations(o.value, l.value, {
|
|
4517
|
+
...I(),
|
|
4467
4518
|
page: t
|
|
4468
4519
|
});
|
|
4469
|
-
if (e !==
|
|
4470
|
-
let r = new Set(
|
|
4471
|
-
|
|
4520
|
+
if (e !== an) return;
|
|
4521
|
+
let r = new Set(L.value.map((e) => e.id));
|
|
4522
|
+
L.value = [...L.value, ...n.filter((e) => !r.has(e.id))], tn.value = t, nn.value = n.length >= 100;
|
|
4472
4523
|
} catch {} finally {
|
|
4473
|
-
|
|
4524
|
+
rn.value = !1;
|
|
4474
4525
|
}
|
|
4475
4526
|
}
|
|
4476
|
-
async function
|
|
4477
|
-
return
|
|
4527
|
+
async function Tn(e) {
|
|
4528
|
+
return S.value ? [] : T.value.getConversations(o.value, l.value, { search: e });
|
|
4478
4529
|
}
|
|
4479
|
-
async function
|
|
4480
|
-
let e =
|
|
4481
|
-
if (!e)
|
|
4530
|
+
async function En() {
|
|
4531
|
+
let e = C.value;
|
|
4532
|
+
if (!e) R.value = [];
|
|
4482
4533
|
else {
|
|
4483
|
-
|
|
4534
|
+
z.value = !0;
|
|
4484
4535
|
try {
|
|
4485
|
-
|
|
4536
|
+
R.value = await T.value.getChatFiles(e);
|
|
4486
4537
|
} catch {
|
|
4487
|
-
|
|
4538
|
+
R.value = [];
|
|
4488
4539
|
} finally {
|
|
4489
|
-
|
|
4540
|
+
z.value = !1;
|
|
4490
4541
|
}
|
|
4491
4542
|
}
|
|
4492
4543
|
}
|
|
4493
|
-
function
|
|
4494
|
-
return
|
|
4544
|
+
function Dn(e, t = !1) {
|
|
4545
|
+
return T.value.getChatFileDownloadUrl(e, t);
|
|
4495
4546
|
}
|
|
4496
|
-
function
|
|
4497
|
-
return
|
|
4547
|
+
function On(e) {
|
|
4548
|
+
return T.value.getChatFilePreviewUrl(e);
|
|
4498
4549
|
}
|
|
4499
|
-
async function
|
|
4500
|
-
await
|
|
4501
|
-
let t =
|
|
4502
|
-
|
|
4550
|
+
async function kn(e) {
|
|
4551
|
+
await T.value.deleteChatFile(e);
|
|
4552
|
+
let t = R.value.find((t) => t.documentId === e), n = t?.kind === "spreadsheet" ? t.sourceAttachmentId ?? t.documentId : void 0;
|
|
4553
|
+
R.value = R.value.filter((t) => t.documentId !== e && (!n || t.documentId !== n && t.sourceAttachmentId !== n));
|
|
4503
4554
|
}
|
|
4504
|
-
async function
|
|
4505
|
-
if (!
|
|
4506
|
-
let n = await
|
|
4507
|
-
if (t !==
|
|
4555
|
+
async function An(e, t) {
|
|
4556
|
+
if (!S.value) try {
|
|
4557
|
+
let n = await T.value.getChat(e, t);
|
|
4558
|
+
if (t !== C.value || (n && Jt(t, {
|
|
4508
4559
|
authorId: n.userId,
|
|
4509
4560
|
projectId: n.projectId
|
|
4510
|
-
}),
|
|
4511
|
-
n && (
|
|
4561
|
+
}), P.value.status !== "ready" || P.value.messages.length > 0)) return;
|
|
4562
|
+
n && (P.value.messages = n.messages, Re.value = n.blocked ?? !1, jn(e, t, n.turnInProgress === !0));
|
|
4512
4563
|
} catch {}
|
|
4513
4564
|
}
|
|
4514
|
-
async function
|
|
4515
|
-
n && (await
|
|
4565
|
+
async function jn(e, t, n) {
|
|
4566
|
+
n && (await Mn(t), t !== C.value || q()) || (await Nn(e, t), t === C.value && await Ln());
|
|
4516
4567
|
}
|
|
4517
|
-
async function
|
|
4568
|
+
async function Mn(e) {
|
|
4518
4569
|
let t = { chatId: e };
|
|
4519
|
-
|
|
4520
|
-
let n = () =>
|
|
4570
|
+
j = t, At.value = e;
|
|
4571
|
+
let n = () => j === t && e === C.value, r = Date.now() + Ha;
|
|
4521
4572
|
try {
|
|
4522
|
-
for (; n() && !
|
|
4523
|
-
|
|
4573
|
+
for (; n() && !q() && Date.now() < r;) {
|
|
4574
|
+
kt = !0;
|
|
4524
4575
|
try {
|
|
4525
|
-
await
|
|
4576
|
+
await P.value.resumeStream();
|
|
4526
4577
|
} finally {
|
|
4527
|
-
|
|
4578
|
+
kt = !1;
|
|
4528
4579
|
}
|
|
4529
4580
|
if (!n()) return;
|
|
4530
|
-
|
|
4531
|
-
let t = await
|
|
4532
|
-
if (!t || !n() ||
|
|
4581
|
+
P.value.clearError();
|
|
4582
|
+
let t = await T.value.getChat(o.value, e).catch(() => null);
|
|
4583
|
+
if (!t || !n() || q()) return;
|
|
4533
4584
|
if (!t.turnInProgress) {
|
|
4534
|
-
|
|
4585
|
+
P.value.messages = t.messages;
|
|
4535
4586
|
return;
|
|
4536
4587
|
}
|
|
4537
|
-
await new Promise((e) => setTimeout(e,
|
|
4588
|
+
await new Promise((e) => setTimeout(e, Ua));
|
|
4538
4589
|
}
|
|
4539
4590
|
} finally {
|
|
4540
|
-
|
|
4591
|
+
j === t && (j = void 0, At.value = void 0);
|
|
4541
4592
|
}
|
|
4542
4593
|
}
|
|
4543
|
-
async function
|
|
4594
|
+
async function Nn(e, t) {
|
|
4544
4595
|
let n;
|
|
4545
4596
|
try {
|
|
4546
|
-
n = Number(sessionStorage.getItem(
|
|
4597
|
+
n = Number(sessionStorage.getItem(ut)), sessionStorage.removeItem(ut);
|
|
4547
4598
|
} catch {
|
|
4548
4599
|
return;
|
|
4549
4600
|
}
|
|
4550
|
-
if (!(!n || Date.now() - n > 6e4 ||
|
|
4551
|
-
let n =
|
|
4601
|
+
if (!(!n || Date.now() - n > 6e4 || Ce.value)) for (let n = 0; n < 12; n++) {
|
|
4602
|
+
let n = P.value.messages[P.value.messages.length - 1];
|
|
4552
4603
|
if (n?.role === "assistant") {
|
|
4553
|
-
let e = n.parts.filter((e) =>
|
|
4604
|
+
let e = n.parts.filter((e) => Je(e) && e.state === "input-available"), t = e.filter((e) => e.toolMetadata?.provider === "page" && e.toolMetadata.readOnly === !0);
|
|
4554
4605
|
if (e.length > 0) {
|
|
4555
|
-
if (t.length === e.length && !
|
|
4606
|
+
if (t.length === e.length && !Ce.value) for (let e of t) vt.enqueue({
|
|
4556
4607
|
toolCallId: e.toolCallId,
|
|
4557
4608
|
toolName: e.toolName,
|
|
4558
4609
|
input: e.input,
|
|
@@ -4564,33 +4615,33 @@ function Wa(e) {
|
|
|
4564
4615
|
}
|
|
4565
4616
|
if (n.parts[n.parts.length - 1]?.type === "text") return;
|
|
4566
4617
|
}
|
|
4567
|
-
if (await new Promise((e) => setTimeout(e, 1500)), t !==
|
|
4618
|
+
if (await new Promise((e) => setTimeout(e, 1500)), t !== C.value || P.value.status !== "ready") return;
|
|
4568
4619
|
try {
|
|
4569
|
-
let n = await
|
|
4570
|
-
n && t ===
|
|
4620
|
+
let n = await T.value.getChat(e, t);
|
|
4621
|
+
n && t === C.value && (P.value.messages = n.messages);
|
|
4571
4622
|
} catch {
|
|
4572
4623
|
return;
|
|
4573
4624
|
}
|
|
4574
4625
|
}
|
|
4575
4626
|
}
|
|
4576
|
-
let
|
|
4577
|
-
let e =
|
|
4627
|
+
let q = () => {
|
|
4628
|
+
let e = P.value.status;
|
|
4578
4629
|
return e === "submitted" || e === "streaming";
|
|
4579
|
-
}, Pn = () =>
|
|
4580
|
-
let e =
|
|
4581
|
-
return
|
|
4630
|
+
}, Pn = () => q() || j?.chatId === C.value || ie.value > 0, Fn = () => {
|
|
4631
|
+
let e = Bt();
|
|
4632
|
+
return k.value !== void 0 || La(e) || Qa(e);
|
|
4582
4633
|
}, In = /* @__PURE__ */ new Set();
|
|
4583
4634
|
async function Ln() {
|
|
4584
|
-
let e =
|
|
4585
|
-
if (!(In.has(e) ||
|
|
4586
|
-
if (Fn()) xn(
|
|
4635
|
+
let e = C.value;
|
|
4636
|
+
if (!(In.has(e) || yn.value.length === 0 || Pn() || Fe.value)) {
|
|
4637
|
+
if (Fn()) Sn(xn(e));
|
|
4587
4638
|
else {
|
|
4588
4639
|
In.add(e);
|
|
4589
4640
|
try {
|
|
4590
|
-
let t = Date.now() +
|
|
4591
|
-
for (; Date.now() < t && (await Promise.race([
|
|
4592
|
-
if (e !==
|
|
4593
|
-
let n =
|
|
4641
|
+
let t = Date.now() + qa;
|
|
4642
|
+
for (; Date.now() < t && (await Promise.race([T.value.getRunningTurns(o.value, [e]).catch(() => []), new Promise((t) => setTimeout(() => t([e]), Ya))])).includes(e);) await new Promise((e) => setTimeout(e, Ja));
|
|
4643
|
+
if (e !== C.value || Pn()) return;
|
|
4644
|
+
let n = xn(e);
|
|
4594
4645
|
n && qn(n);
|
|
4595
4646
|
} finally {
|
|
4596
4647
|
In.delete(e);
|
|
@@ -4600,66 +4651,66 @@ function Wa(e) {
|
|
|
4600
4651
|
}
|
|
4601
4652
|
let Rn = 0, zn = 0;
|
|
4602
4653
|
async function Bn() {
|
|
4603
|
-
if (
|
|
4604
|
-
let e =
|
|
4654
|
+
if (S.value || q()) return "indeterminate";
|
|
4655
|
+
let e = C.value, t = Rn += 1;
|
|
4605
4656
|
try {
|
|
4606
|
-
let n = await
|
|
4607
|
-
if (!n || e !==
|
|
4657
|
+
let n = await T.value.getChat(o.value, e);
|
|
4658
|
+
if (!n || e !== C.value || q() || t <= zn) return "indeterminate";
|
|
4608
4659
|
zn = t;
|
|
4609
|
-
let r = n.messages, i =
|
|
4610
|
-
return
|
|
4660
|
+
let r = n.messages, i = Va(r, P.value.messages);
|
|
4661
|
+
return P.value.messages = [...r, ...i], Re.value = n.blocked ?? !1, i.length > 0 ? "pending" : "caught-up";
|
|
4611
4662
|
} catch {}
|
|
4612
4663
|
return "indeterminate";
|
|
4613
4664
|
}
|
|
4614
4665
|
function Vn(e) {
|
|
4615
|
-
|
|
4666
|
+
P.value.messages = [...P.value.messages, e];
|
|
4616
4667
|
}
|
|
4617
4668
|
async function Hn(e) {
|
|
4618
4669
|
try {
|
|
4619
|
-
|
|
4670
|
+
cn.value = await T.value.getMessageFeedbacks(e);
|
|
4620
4671
|
} catch {
|
|
4621
|
-
|
|
4672
|
+
cn.value = [];
|
|
4622
4673
|
}
|
|
4623
4674
|
}
|
|
4624
4675
|
function Un(e) {
|
|
4625
|
-
let t =
|
|
4626
|
-
t >= 0 ?
|
|
4676
|
+
let t = cn.value.findIndex((t) => t.messageId === e.messageId);
|
|
4677
|
+
t >= 0 ? cn.value[t] = e : cn.value.push(e);
|
|
4627
4678
|
}
|
|
4628
4679
|
function Wn(e) {
|
|
4629
|
-
let t =
|
|
4680
|
+
let t = Wt.value, n = t.findIndex((t) => t.id === e.id), r = Xe(e) ?? "", i = t.slice(0, n).reverse().find((e) => e.role === "user");
|
|
4630
4681
|
return {
|
|
4631
|
-
userQuestion:
|
|
4682
|
+
userQuestion: Xe(i ?? e) ?? "",
|
|
4632
4683
|
assistantMessage: r
|
|
4633
4684
|
};
|
|
4634
4685
|
}
|
|
4635
4686
|
async function Gn(e, t) {
|
|
4636
4687
|
await Promise.all([
|
|
4637
|
-
|
|
4638
|
-
|
|
4688
|
+
An(e, t),
|
|
4689
|
+
K(e),
|
|
4639
4690
|
Hn(t)
|
|
4640
|
-
]),
|
|
4641
|
-
e && (
|
|
4691
|
+
]), Qe.value || lt((e, t) => T.value.reverseGeocode(e, t, r.value)).then((e) => {
|
|
4692
|
+
e && (Qe.value = e);
|
|
4642
4693
|
});
|
|
4643
4694
|
}
|
|
4644
4695
|
async function Kn() {
|
|
4645
|
-
if (
|
|
4646
|
-
let e =
|
|
4696
|
+
if (F.value || H.value.some((e) => e.state !== "done")) return;
|
|
4697
|
+
let e = V.value.trim(), t = H.value.filter((e) => e.state === "done" && e.mediaSource !== void 0).map((e) => ({
|
|
4647
4698
|
type: "file",
|
|
4648
4699
|
mediaType: e.mediaSource.mimeType,
|
|
4649
4700
|
url: e.localUrl,
|
|
4650
4701
|
filename: e.mediaSource.name,
|
|
4651
4702
|
providerMetadata: { "8bot": { media: e.mediaSource } }
|
|
4652
|
-
})), n =
|
|
4653
|
-
!
|
|
4703
|
+
})), n = je.value ? de.value : void 0;
|
|
4704
|
+
!S.value && Pn() ? e && t.length === 0 && !n && (bn(C.value, [...yn.value, e]), V.value = "") : (S.value && Wt.value.length > 0 && await fr(), qn(e, t, n && { pagePointer: n }), V.value = "", de.value = void 0, dr());
|
|
4654
4705
|
}
|
|
4655
4706
|
function J(e, t) {
|
|
4656
4707
|
let n = e.trim();
|
|
4657
|
-
return !n ||
|
|
4708
|
+
return !n || Re.value || F.value || Pn() || P.value.status !== "ready" ? !1 : (qn(n, [], t, { toInput: !1 }), !0);
|
|
4658
4709
|
}
|
|
4659
4710
|
function qn(e, t = [], n, { toInput: r = !0 } = {}) {
|
|
4660
|
-
if (
|
|
4661
|
-
|
|
4662
|
-
let i =
|
|
4711
|
+
if (F.value) return;
|
|
4712
|
+
Dt(), U.value = e, hn.value = r, gn.value = r && n && "pagePointer" in n ? n.pagePointer : void 0, _n.value = P.value.messages.length;
|
|
4713
|
+
let i = P.value.sendMessage;
|
|
4663
4714
|
i({
|
|
4664
4715
|
text: e,
|
|
4665
4716
|
files: t.length > 0 ? t : void 0,
|
|
@@ -4668,162 +4719,162 @@ function Wa(e) {
|
|
|
4668
4719
|
}
|
|
4669
4720
|
function Jn(e) {
|
|
4670
4721
|
let t = e.trim();
|
|
4671
|
-
if (!t ||
|
|
4672
|
-
if (
|
|
4673
|
-
|
|
4722
|
+
if (!t || F.value) return;
|
|
4723
|
+
if (P.value.status !== "ready") {
|
|
4724
|
+
Ze.warn("[useChatbotStore] sendMessage called before chat is ready. Listen for the \"ready\" event on the widget element.");
|
|
4674
4725
|
return;
|
|
4675
4726
|
}
|
|
4676
|
-
let n =
|
|
4677
|
-
|
|
4727
|
+
let n = P.value.sendMessage;
|
|
4728
|
+
Dt(), n({ text: t });
|
|
4678
4729
|
}
|
|
4679
4730
|
async function Yn() {
|
|
4680
|
-
let e =
|
|
4681
|
-
|
|
4731
|
+
let e = P.value.messages.slice(_n.value).some((e) => e.parts.some(Je)), t = U.value, n = hn.value, r = gn.value, i = t.length > 0 && !e, a = C.value, s = _n.value, c = j?.chatId === a, l = jt, u = xn(a), d = (e = "") => {
|
|
4732
|
+
V.value = [
|
|
4682
4733
|
e,
|
|
4683
4734
|
u,
|
|
4684
|
-
|
|
4685
|
-
].filter(Boolean).join(
|
|
4686
|
-
}, f = () => a ===
|
|
4687
|
-
|
|
4688
|
-
let p =
|
|
4735
|
+
V.value
|
|
4736
|
+
].filter(Boolean).join(Xa);
|
|
4737
|
+
}, f = () => a === C.value && !q() && _n.value === s ? !1 : (u && bn(a, [u, ...vn.value[a] ?? []]), !0);
|
|
4738
|
+
j = void 0, At.value = void 0, Dt(), await P.value.stop();
|
|
4739
|
+
let p = S.value || e && !c || await T.value.stopChatTurn(o.value, a, l).catch(() => !0);
|
|
4689
4740
|
if (!f()) {
|
|
4690
4741
|
if (c || !p) {
|
|
4691
4742
|
if (await Bn(), f()) return;
|
|
4692
|
-
if (c ||
|
|
4693
|
-
|
|
4743
|
+
if (c || P.value.messages.length > _n.value) {
|
|
4744
|
+
U.value = "", d();
|
|
4694
4745
|
return;
|
|
4695
4746
|
}
|
|
4696
4747
|
}
|
|
4697
|
-
i ? (d(n ? t : ""),
|
|
4748
|
+
i ? (d(n ? t : ""), de.value ??= r, P.value.messages = P.value.messages.slice(0, _n.value), U.value = "") : d();
|
|
4698
4749
|
}
|
|
4699
4750
|
}
|
|
4700
|
-
|
|
4701
|
-
let t =
|
|
4702
|
-
t && !
|
|
4703
|
-
}),
|
|
4704
|
-
e === "submitted" && (
|
|
4751
|
+
O(() => P.value.messages, (e) => {
|
|
4752
|
+
let t = k.value?.toolCallId;
|
|
4753
|
+
t && !yt.has(t) && !e.some((e) => e.parts.some((e) => e.toolCallId === t)) && Dt();
|
|
4754
|
+
}), O(() => P.value.status, (e) => {
|
|
4755
|
+
e === "submitted" && (_e.value++, jt = void 0);
|
|
4705
4756
|
});
|
|
4706
4757
|
let Xn;
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4758
|
+
O(() => [
|
|
4759
|
+
P.value.status,
|
|
4760
|
+
ie.value,
|
|
4761
|
+
ae.value
|
|
4711
4762
|
], ([e, t, n]) => {
|
|
4712
4763
|
clearTimeout(Xn), e === "ready" && t === 0 && n === 0 && (Xn = setTimeout(() => {
|
|
4713
|
-
|
|
4764
|
+
ge.value = !1;
|
|
4714
4765
|
}, 1500));
|
|
4715
4766
|
});
|
|
4716
|
-
let Zn =
|
|
4717
|
-
|
|
4767
|
+
let Zn = E(!1), Qn;
|
|
4768
|
+
O(() => !k.value && !La(Bt()) && (q() || ie.value > 0), (e) => {
|
|
4718
4769
|
clearTimeout(Qn), e ? Zn.value = !0 : Qn = setTimeout(() => {
|
|
4719
4770
|
Zn.value = !1;
|
|
4720
4771
|
}, 400);
|
|
4721
4772
|
}, { immediate: !0 });
|
|
4722
|
-
let $n =
|
|
4723
|
-
let e =
|
|
4724
|
-
return Zn.value ||
|
|
4725
|
-
}), er = () => [.../* @__PURE__ */ new Set([...
|
|
4773
|
+
let $n = w(() => {
|
|
4774
|
+
let e = Mt.value.filter((e) => e !== C.value);
|
|
4775
|
+
return Zn.value || At.value === C.value ? [...e, C.value] : e;
|
|
4776
|
+
}), er = () => [.../* @__PURE__ */ new Set([...Mt.value, ...M.value])], tr = ot(), nr, rr = 0, ir = 0;
|
|
4726
4777
|
function ar() {
|
|
4727
4778
|
clearTimeout(nr), nr = void 0, er().length !== 0 && tr.value === "visible" && (nr = setTimeout(() => {
|
|
4728
4779
|
nr = void 0, sr(er());
|
|
4729
|
-
},
|
|
4780
|
+
}, Wa));
|
|
4730
4781
|
}
|
|
4731
4782
|
async function or(e) {
|
|
4732
|
-
let t =
|
|
4733
|
-
if (u.value?.nextMessageSuggestion && !
|
|
4734
|
-
return await
|
|
4783
|
+
let t = C.value;
|
|
4784
|
+
if (u.value?.nextMessageSuggestion && !S.value && t) try {
|
|
4785
|
+
return await T.value.suggestNextMessage(o.value, t, e) ?? void 0;
|
|
4735
4786
|
} catch {
|
|
4736
4787
|
return;
|
|
4737
4788
|
}
|
|
4738
4789
|
}
|
|
4739
4790
|
async function sr(e) {
|
|
4740
|
-
let t = e.slice(0,
|
|
4741
|
-
if (
|
|
4791
|
+
let t = e.slice(0, Ga);
|
|
4792
|
+
if (S.value || t.length === 0) {
|
|
4742
4793
|
ar();
|
|
4743
4794
|
return;
|
|
4744
4795
|
}
|
|
4745
4796
|
let n = rr += 1, r;
|
|
4746
4797
|
try {
|
|
4747
|
-
r = await
|
|
4798
|
+
r = await T.value.getRunningTurns(o.value, t);
|
|
4748
4799
|
} catch {
|
|
4749
4800
|
ar();
|
|
4750
4801
|
return;
|
|
4751
4802
|
}
|
|
4752
4803
|
if (n <= ir) return;
|
|
4753
4804
|
ir = n;
|
|
4754
|
-
for (let e of r)
|
|
4755
|
-
let i = new Set(t), a = er().filter((e) => i.has(e) && !r.includes(e)), s = (e) =>
|
|
4756
|
-
|
|
4757
|
-
let u = l.filter((e) =>
|
|
4758
|
-
(u.length > 0 || c.length > 0) && (
|
|
4805
|
+
for (let e of r) Ft.add(e);
|
|
4806
|
+
let i = new Set(t), a = er().filter((e) => i.has(e) && !r.includes(e)), s = (e) => M.value.includes(e) && !Ft.has(e), c = a.filter((e) => s(e) && Date.now() - (Pt.get(e) ?? 0) > Ka), l = a.filter((e) => !s(e));
|
|
4807
|
+
Mt.value = [...Mt.value.filter((e) => !i.has(e)), ...r];
|
|
4808
|
+
let u = l.filter((e) => M.value.includes(e));
|
|
4809
|
+
(u.length > 0 || c.length > 0) && (M.value = M.value.filter((e) => !u.includes(e) && !c.includes(e)), N.value = [...N.value, ...u.filter((e) => e !== C.value && !N.value.includes(e))]), l.length > 0 && K(o.value), ar();
|
|
4759
4810
|
}
|
|
4760
|
-
|
|
4811
|
+
O(tr, (e) => {
|
|
4761
4812
|
e === "visible" ? sr(er()) : (clearTimeout(nr), nr = void 0);
|
|
4762
|
-
}),
|
|
4763
|
-
let cr =
|
|
4813
|
+
}), et(() => clearTimeout(nr));
|
|
4814
|
+
let cr = w(() => N.value.map((e) => ({
|
|
4764
4815
|
chatId: e,
|
|
4765
|
-
title:
|
|
4816
|
+
title: L.value.find((t) => t.id === e)?.title || Nt.value[e] || void 0
|
|
4766
4817
|
})));
|
|
4767
4818
|
function lr(e) {
|
|
4768
|
-
|
|
4819
|
+
Rt(e), C.value = e, Lr("chat");
|
|
4769
4820
|
}
|
|
4770
4821
|
function ur(e) {
|
|
4771
|
-
|
|
4822
|
+
N.value = N.value.filter((t) => t !== e), Lt(e);
|
|
4772
4823
|
}
|
|
4773
|
-
|
|
4824
|
+
O(() => [P.value.status, P.value.id], ([e, t], [n, r]) => {
|
|
4774
4825
|
if (t === r) {
|
|
4775
|
-
if (e === "error")
|
|
4826
|
+
if (e === "error") j?.chatId !== C.value && Sn(xn(C.value));
|
|
4776
4827
|
else if (e === "ready" && (n === "streaming" || n === "submitted")) {
|
|
4777
4828
|
if (Fn()) {
|
|
4778
|
-
xn(
|
|
4829
|
+
Sn(xn(C.value));
|
|
4779
4830
|
return;
|
|
4780
4831
|
}
|
|
4781
4832
|
Ln();
|
|
4782
4833
|
}
|
|
4783
4834
|
}
|
|
4784
|
-
}),
|
|
4785
|
-
e === 0 &&
|
|
4786
|
-
}),
|
|
4787
|
-
e === "ready" &&
|
|
4835
|
+
}), O(ie, (e) => {
|
|
4836
|
+
e === 0 && P.value.status === "ready" && Ln();
|
|
4837
|
+
}), O(() => P.value.status, (e) => {
|
|
4838
|
+
e === "ready" && U.value.length > 0 && (U.value = "");
|
|
4788
4839
|
});
|
|
4789
4840
|
function dr(e = !1) {
|
|
4790
|
-
for (let t of
|
|
4791
|
-
|
|
4841
|
+
for (let t of H.value) (e || t.state !== "done") && URL.revokeObjectURL(t.localUrl);
|
|
4842
|
+
H.value = [], br.value = null;
|
|
4792
4843
|
}
|
|
4793
4844
|
async function fr(e) {
|
|
4794
4845
|
let t = typeof e?.projectId == "string" ? e.projectId : void 0;
|
|
4795
|
-
return
|
|
4846
|
+
return U.value = "", me.value = {}, he.value = {}, C.value = $t(), Jt(C.value, { projectId: t }), await $e(), P.value.clearError(), Fe.value = void 0, Re.value = !1, dr(!0), Lr("chat"), C.value;
|
|
4796
4847
|
}
|
|
4797
4848
|
async function Y(e) {
|
|
4798
|
-
|
|
4849
|
+
F.value || (P.value.status !== "ready" && (U.value = "", await Yn()), Dt(), await P.value.regenerate(e));
|
|
4799
4850
|
}
|
|
4800
4851
|
function pr(e) {
|
|
4801
|
-
if (!
|
|
4852
|
+
if (!F.value) {
|
|
4802
4853
|
if (e.tool === "requestGeolocation") {
|
|
4803
4854
|
let t = e.output;
|
|
4804
|
-
"latitude" in t && (
|
|
4855
|
+
"latitude" in t && (Qe.value = {
|
|
4805
4856
|
geolocationLatitude: t.latitude,
|
|
4806
4857
|
geolocationLongitude: t.longitude,
|
|
4807
4858
|
geolocationAccuracy: t.accuracy,
|
|
4808
4859
|
geolocationCity: t.city
|
|
4809
4860
|
});
|
|
4810
4861
|
}
|
|
4811
|
-
|
|
4862
|
+
P.value.addToolOutput(e);
|
|
4812
4863
|
}
|
|
4813
4864
|
}
|
|
4814
4865
|
function mr(e) {
|
|
4815
|
-
|
|
4866
|
+
F.value || P.value.addToolApprovalResponse(e);
|
|
4816
4867
|
}
|
|
4817
|
-
let hr =
|
|
4868
|
+
let hr = w(() => P.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), gr = w(() => _.value?.maxFilesPerMessage ?? 5), _r = w(() => _.value?.maxFilesPerChat ?? 20), vr = w(() => Math.max(0, Math.min(gr.value - H.value.length, _r.value - hr.value - H.value.length))), yr = w(() => vr.value <= 0), br = E(null), xr = () => {
|
|
4818
4869
|
br.value = null;
|
|
4819
4870
|
};
|
|
4820
|
-
|
|
4871
|
+
O(yr, (e) => {
|
|
4821
4872
|
e || (br.value = null);
|
|
4822
4873
|
});
|
|
4823
4874
|
async function Sr(e) {
|
|
4824
|
-
if (
|
|
4875
|
+
if (F.value) return;
|
|
4825
4876
|
if (yr.value) {
|
|
4826
|
-
br.value = _r.value - hr.value -
|
|
4877
|
+
br.value = _r.value - hr.value - H.value.length <= gr.value - H.value.length ? {
|
|
4827
4878
|
reason: "per-chat",
|
|
4828
4879
|
max: _r.value
|
|
4829
4880
|
} : {
|
|
@@ -4833,18 +4884,18 @@ function Wa(e) {
|
|
|
4833
4884
|
return;
|
|
4834
4885
|
}
|
|
4835
4886
|
let t = Tr(e);
|
|
4836
|
-
|
|
4887
|
+
H.value = [...H.value, t], await Er(t);
|
|
4837
4888
|
}
|
|
4838
4889
|
async function Cr(e, t) {
|
|
4839
|
-
let n =
|
|
4890
|
+
let n = H.value.find((t) => t.id === e.id);
|
|
4840
4891
|
if (!n) return;
|
|
4841
4892
|
URL.revokeObjectURL(n.localUrl);
|
|
4842
4893
|
let r = Tr(t);
|
|
4843
|
-
|
|
4894
|
+
H.value = H.value.map((e) => e.id === n.id ? r : e), await Promise.all([Dr(n), Er(r)]);
|
|
4844
4895
|
}
|
|
4845
4896
|
async function wr(e) {
|
|
4846
|
-
let t =
|
|
4847
|
-
t && (
|
|
4897
|
+
let t = H.value.find((t) => t.id === e.id && t.state === "error");
|
|
4898
|
+
t && (H.value = H.value.map((e) => e.id === t.id ? {
|
|
4848
4899
|
...e,
|
|
4849
4900
|
state: "uploading",
|
|
4850
4901
|
error: void 0
|
|
@@ -4852,7 +4903,7 @@ function Wa(e) {
|
|
|
4852
4903
|
}
|
|
4853
4904
|
function Tr(e) {
|
|
4854
4905
|
return {
|
|
4855
|
-
id:
|
|
4906
|
+
id: $t(),
|
|
4856
4907
|
file: e,
|
|
4857
4908
|
localUrl: URL.createObjectURL(e),
|
|
4858
4909
|
state: "uploading"
|
|
@@ -4860,19 +4911,19 @@ function Wa(e) {
|
|
|
4860
4911
|
}
|
|
4861
4912
|
async function Er({ id: e, file: t }) {
|
|
4862
4913
|
try {
|
|
4863
|
-
let n = await
|
|
4864
|
-
if (!
|
|
4914
|
+
let n = await T.value.uploadMedia(o.value, C.value, t);
|
|
4915
|
+
if (!H.value.some((t) => t.id === e)) {
|
|
4865
4916
|
await Or(n);
|
|
4866
4917
|
return;
|
|
4867
4918
|
}
|
|
4868
|
-
|
|
4919
|
+
H.value = H.value.map((t) => t.id === e ? {
|
|
4869
4920
|
...t,
|
|
4870
4921
|
state: "done",
|
|
4871
4922
|
mediaSource: n
|
|
4872
4923
|
} : t);
|
|
4873
4924
|
} catch (t) {
|
|
4874
4925
|
let n = t instanceof Error ? t.message : "Upload failed";
|
|
4875
|
-
|
|
4926
|
+
H.value = H.value.map((t) => t.id === e ? {
|
|
4876
4927
|
...t,
|
|
4877
4928
|
state: "error",
|
|
4878
4929
|
error: n
|
|
@@ -4884,14 +4935,14 @@ function Wa(e) {
|
|
|
4884
4935
|
}
|
|
4885
4936
|
async function Or(e) {
|
|
4886
4937
|
try {
|
|
4887
|
-
await
|
|
4938
|
+
await T.value.discardMedia(e);
|
|
4888
4939
|
} catch {}
|
|
4889
4940
|
}
|
|
4890
4941
|
async function kr(e, t) {
|
|
4891
4942
|
let { userQuestion: n, assistantMessage: r } = Wn(e);
|
|
4892
|
-
Un(await
|
|
4943
|
+
Un(await T.value.submitMessageFeedback({
|
|
4893
4944
|
messageId: e.id,
|
|
4894
|
-
chatId:
|
|
4945
|
+
chatId: C.value,
|
|
4895
4946
|
agentId: o.value,
|
|
4896
4947
|
vote: t,
|
|
4897
4948
|
userQuestion: n,
|
|
@@ -4905,71 +4956,71 @@ function Wa(e) {
|
|
|
4905
4956
|
await kr(e, "downvote");
|
|
4906
4957
|
}
|
|
4907
4958
|
function Mr(e) {
|
|
4908
|
-
|
|
4959
|
+
un.value = !1, dn.value = void 0, B.value = e;
|
|
4909
4960
|
}
|
|
4910
4961
|
async function Nr(e) {
|
|
4911
|
-
if (
|
|
4912
|
-
|
|
4913
|
-
let { userQuestion: t, assistantMessage: n } = Wn(
|
|
4914
|
-
Un(await
|
|
4915
|
-
messageId:
|
|
4916
|
-
chatId:
|
|
4962
|
+
if (B.value) try {
|
|
4963
|
+
ln.value = !0, un.value = !1, dn.value = void 0;
|
|
4964
|
+
let { userQuestion: t, assistantMessage: n } = Wn(B.value);
|
|
4965
|
+
Un(await T.value.submitMessageFeedback({
|
|
4966
|
+
messageId: B.value.id,
|
|
4967
|
+
chatId: C.value,
|
|
4917
4968
|
agentId: o.value,
|
|
4918
4969
|
userQuestion: t,
|
|
4919
4970
|
assistantMessage: n,
|
|
4920
4971
|
comment: e
|
|
4921
|
-
})),
|
|
4972
|
+
})), un.value = !0, await Hn(C.value);
|
|
4922
4973
|
} catch {
|
|
4923
|
-
|
|
4974
|
+
dn.value = n("message.feedbackSubmitError") ? t("message.feedbackSubmitError") : "Failed to submit feedback";
|
|
4924
4975
|
} finally {
|
|
4925
|
-
|
|
4976
|
+
ln.value = !1;
|
|
4926
4977
|
}
|
|
4927
4978
|
}
|
|
4928
4979
|
async function Pr(e) {
|
|
4929
4980
|
try {
|
|
4930
|
-
|
|
4981
|
+
pn.value = !0, fn.value = !1, mn.value = void 0, await T.value.submitLead({
|
|
4931
4982
|
agentId: o.value,
|
|
4932
|
-
chatId:
|
|
4983
|
+
chatId: C.value,
|
|
4933
4984
|
...e
|
|
4934
|
-
}),
|
|
4985
|
+
}), fn.value = !0;
|
|
4935
4986
|
} catch {
|
|
4936
|
-
|
|
4987
|
+
mn.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
|
|
4937
4988
|
} finally {
|
|
4938
|
-
|
|
4989
|
+
pn.value = !1;
|
|
4939
4990
|
}
|
|
4940
4991
|
}
|
|
4941
4992
|
async function Fr(e, t) {
|
|
4942
|
-
let n = await
|
|
4943
|
-
|
|
4993
|
+
let n = await T.value.updateChatTitle(o.value, e, t);
|
|
4994
|
+
L.value = L.value.map((t) => t.id === e ? {
|
|
4944
4995
|
...t,
|
|
4945
4996
|
title: n.title
|
|
4946
4997
|
} : t);
|
|
4947
4998
|
}
|
|
4948
4999
|
async function Ir(e) {
|
|
4949
|
-
await
|
|
5000
|
+
await T.value.deleteChat(o.value, e), L.value = L.value.filter((t) => t.id !== e), C.value === e && await fr();
|
|
4950
5001
|
}
|
|
4951
5002
|
function Lr(e) {
|
|
4952
|
-
|
|
5003
|
+
on.value = e;
|
|
4953
5004
|
}
|
|
4954
5005
|
function Rr() {
|
|
4955
|
-
Lr("chat"),
|
|
5006
|
+
Lr("chat"), sn.value++;
|
|
4956
5007
|
}
|
|
4957
5008
|
let zr;
|
|
4958
5009
|
function Br(e) {
|
|
4959
|
-
let t = () =>
|
|
5010
|
+
let t = () => T.value.getChat(o.value, e);
|
|
4960
5011
|
return t().catch(() => t().catch(() => null));
|
|
4961
5012
|
}
|
|
4962
|
-
return
|
|
5013
|
+
return O(l, async (e) => {
|
|
4963
5014
|
if (!e || e === zr) return;
|
|
4964
5015
|
let t = zr;
|
|
4965
5016
|
if (zr = e, t === void 0) return;
|
|
4966
|
-
let n =
|
|
4967
|
-
l.value === e &&
|
|
5017
|
+
let n = C.value, r = S.value ? null : await Br(n);
|
|
5018
|
+
l.value === e && C.value === n && (r ? (Jt(n, {
|
|
4968
5019
|
authorId: r.userId,
|
|
4969
5020
|
projectId: r.projectId
|
|
4970
|
-
}),
|
|
5021
|
+
}), K(o.value)) : (L.value = [], cn.value = [], R.value = [], Mt.value = [], M.value = [], N.value = [], Nt.value = {}, await fr(), V.value = ""));
|
|
4971
5022
|
}), {
|
|
4972
|
-
apiClient:
|
|
5023
|
+
apiClient: T,
|
|
4973
5024
|
baseUrl: i,
|
|
4974
5025
|
basePath: a,
|
|
4975
5026
|
agentId: o,
|
|
@@ -4984,96 +5035,96 @@ function Wa(e) {
|
|
|
4984
5035
|
revisedAnswers: m,
|
|
4985
5036
|
model: h,
|
|
4986
5037
|
actionsInput: g,
|
|
4987
|
-
actions:
|
|
5038
|
+
actions: xe,
|
|
4988
5039
|
agentFileUpload: _,
|
|
4989
5040
|
agentVoice: v,
|
|
4990
|
-
fallbackModels:
|
|
4991
|
-
gatewayOptions:
|
|
4992
|
-
externalContext:
|
|
4993
|
-
agentHostTools:
|
|
4994
|
-
hostToolRegistry:
|
|
4995
|
-
hostToolsPending:
|
|
4996
|
-
agentPageAccess:
|
|
4997
|
-
pageToolRegistry:
|
|
4998
|
-
pageFormsProvider:
|
|
4999
|
-
pageAction:
|
|
5000
|
-
hostStepTitles:
|
|
5001
|
-
hostStepChanges:
|
|
5002
|
-
pageControlActive:
|
|
5041
|
+
fallbackModels: ee,
|
|
5042
|
+
gatewayOptions: y,
|
|
5043
|
+
externalContext: te,
|
|
5044
|
+
agentHostTools: ne,
|
|
5045
|
+
hostToolRegistry: re,
|
|
5046
|
+
hostToolsPending: ie,
|
|
5047
|
+
agentPageAccess: oe,
|
|
5048
|
+
pageToolRegistry: ce,
|
|
5049
|
+
pageFormsProvider: le,
|
|
5050
|
+
pageAction: ue,
|
|
5051
|
+
hostStepTitles: me,
|
|
5052
|
+
hostStepChanges: he,
|
|
5053
|
+
pageControlActive: ge,
|
|
5003
5054
|
isWorking: Zn,
|
|
5004
|
-
stopHostActions:
|
|
5005
|
-
voicePageTools:
|
|
5006
|
-
cancelVoicePageCalls:
|
|
5007
|
-
pageNoticeLevel:
|
|
5008
|
-
closePageNotice:
|
|
5009
|
-
hostConfirmation:
|
|
5010
|
-
respondHostConfirmation:
|
|
5011
|
-
pageAccessAvailable:
|
|
5012
|
-
pageAccessOff:
|
|
5013
|
-
setPageAccessOff:
|
|
5014
|
-
agentConfirmations:
|
|
5015
|
-
agentSelectionActions:
|
|
5055
|
+
stopHostActions: Et,
|
|
5056
|
+
voicePageTools: wt,
|
|
5057
|
+
cancelVoicePageCalls: Tt,
|
|
5058
|
+
pageNoticeLevel: Ne,
|
|
5059
|
+
closePageNotice: Pe,
|
|
5060
|
+
hostConfirmation: k,
|
|
5061
|
+
respondHostConfirmation: ht,
|
|
5062
|
+
pageAccessAvailable: Ee,
|
|
5063
|
+
pageAccessOff: Ce,
|
|
5064
|
+
setPageAccessOff: Ot,
|
|
5065
|
+
agentConfirmations: se,
|
|
5066
|
+
agentSelectionActions: b,
|
|
5016
5067
|
sendSelection: J,
|
|
5017
|
-
confirmationsAvailable:
|
|
5018
|
-
confirmationMode:
|
|
5019
|
-
setConfirmationMode:
|
|
5020
|
-
pagePointer:
|
|
5021
|
-
pagePointerStart:
|
|
5022
|
-
pagePointing:
|
|
5023
|
-
pagePointerAvailable:
|
|
5024
|
-
systemTheme:
|
|
5025
|
-
hideWelcomeMessage:
|
|
5026
|
-
isDark:
|
|
5027
|
-
chat:
|
|
5028
|
-
messages:
|
|
5029
|
-
conversations:
|
|
5030
|
-
isLoadingConversations:
|
|
5031
|
-
hasMoreConversations:
|
|
5032
|
-
isLoadingMoreConversations:
|
|
5033
|
-
chatFiles:
|
|
5034
|
-
isLoadingChatFiles:
|
|
5035
|
-
input:
|
|
5036
|
-
pendingAttachments:
|
|
5068
|
+
confirmationsAvailable: Oe,
|
|
5069
|
+
confirmationMode: ke,
|
|
5070
|
+
setConfirmationMode: Ae,
|
|
5071
|
+
pagePointer: de,
|
|
5072
|
+
pagePointerStart: fe,
|
|
5073
|
+
pagePointing: pe,
|
|
5074
|
+
pagePointerAvailable: je,
|
|
5075
|
+
systemTheme: ve,
|
|
5076
|
+
hideWelcomeMessage: ye,
|
|
5077
|
+
isDark: x,
|
|
5078
|
+
chat: P,
|
|
5079
|
+
messages: Wt,
|
|
5080
|
+
conversations: L,
|
|
5081
|
+
isLoadingConversations: en,
|
|
5082
|
+
hasMoreConversations: nn,
|
|
5083
|
+
isLoadingMoreConversations: rn,
|
|
5084
|
+
chatFiles: R,
|
|
5085
|
+
isLoadingChatFiles: z,
|
|
5086
|
+
input: V,
|
|
5087
|
+
pendingAttachments: H,
|
|
5037
5088
|
isAttachmentLimitReached: yr,
|
|
5038
5089
|
fileLimitError: br,
|
|
5039
|
-
localChatId:
|
|
5040
|
-
isConversationBlocked:
|
|
5041
|
-
inputMessagePlaceholder:
|
|
5042
|
-
chatError:
|
|
5090
|
+
localChatId: C,
|
|
5091
|
+
isConversationBlocked: Re,
|
|
5092
|
+
inputMessagePlaceholder: Gt,
|
|
5093
|
+
chatError: Fe,
|
|
5043
5094
|
runningChatIds: $n,
|
|
5044
5095
|
backgroundAnswers: cr,
|
|
5045
5096
|
openBackgroundAnswer: lr,
|
|
5046
5097
|
dismissBackgroundAnswer: ur,
|
|
5047
|
-
canQueue:
|
|
5048
|
-
queuedMessages:
|
|
5049
|
-
removeQueuedMessage:
|
|
5050
|
-
editQueuedMessage:
|
|
5051
|
-
activeView:
|
|
5052
|
-
inputFocusRequest:
|
|
5053
|
-
messageFeedbacks:
|
|
5054
|
-
feedbackDialogMessage:
|
|
5055
|
-
isFeedbackSubmitting:
|
|
5056
|
-
isFeedbackSubmitted:
|
|
5057
|
-
feedbackSubmitError:
|
|
5058
|
-
isLeadSubmitted:
|
|
5059
|
-
isLoadingSubmitLead:
|
|
5060
|
-
submitLeadError:
|
|
5061
|
-
buildDeviceContext:
|
|
5098
|
+
canQueue: W,
|
|
5099
|
+
queuedMessages: yn,
|
|
5100
|
+
removeQueuedMessage: Cn,
|
|
5101
|
+
editQueuedMessage: G,
|
|
5102
|
+
activeView: on,
|
|
5103
|
+
inputFocusRequest: sn,
|
|
5104
|
+
messageFeedbacks: cn,
|
|
5105
|
+
feedbackDialogMessage: B,
|
|
5106
|
+
isFeedbackSubmitting: ln,
|
|
5107
|
+
isFeedbackSubmitted: un,
|
|
5108
|
+
feedbackSubmitError: dn,
|
|
5109
|
+
isLeadSubmitted: fn,
|
|
5110
|
+
isLoadingSubmitLead: pn,
|
|
5111
|
+
submitLeadError: mn,
|
|
5112
|
+
buildDeviceContext: nt,
|
|
5062
5113
|
initialize: Gn,
|
|
5063
|
-
loadConversations:
|
|
5064
|
-
loadMoreConversations:
|
|
5065
|
-
projectsEnabled:
|
|
5066
|
-
chatAuthorId:
|
|
5067
|
-
chatProjectId:
|
|
5068
|
-
isReadOnlyChat:
|
|
5069
|
-
describeChat:
|
|
5070
|
-
searchConversations:
|
|
5071
|
-
loadChatFiles:
|
|
5114
|
+
loadConversations: K,
|
|
5115
|
+
loadMoreConversations: wn,
|
|
5116
|
+
projectsEnabled: Kt,
|
|
5117
|
+
chatAuthorId: Xt,
|
|
5118
|
+
chatProjectId: Zt,
|
|
5119
|
+
isReadOnlyChat: F,
|
|
5120
|
+
describeChat: Jt,
|
|
5121
|
+
searchConversations: Tn,
|
|
5122
|
+
loadChatFiles: En,
|
|
5072
5123
|
refreshMessages: Bn,
|
|
5073
5124
|
appendMessage: Vn,
|
|
5074
|
-
getChatFileUrl:
|
|
5075
|
-
getChatFilePreviewUrl:
|
|
5076
|
-
deleteChatFile:
|
|
5125
|
+
getChatFileUrl: Dn,
|
|
5126
|
+
getChatFilePreviewUrl: On,
|
|
5127
|
+
deleteChatFile: kn,
|
|
5077
5128
|
handleSubmit: Kn,
|
|
5078
5129
|
sendMessage: Jn,
|
|
5079
5130
|
stopGeneration: Yn,
|
|
@@ -5099,6 +5150,6 @@ function Wa(e) {
|
|
|
5099
5150
|
};
|
|
5100
5151
|
})();
|
|
5101
5152
|
}
|
|
5102
|
-
export {
|
|
5153
|
+
export { $t as a, ra as i, eo as n, Pa as r, Fa as t };
|
|
5103
5154
|
|
|
5104
|
-
//# sourceMappingURL=useChatbotStore-
|
|
5155
|
+
//# sourceMappingURL=useChatbotStore-BQ9areKD.js.map
|