@8wave/ai-elements 0.117.0-beta.12 → 0.117.0-beta.14
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-BxyaZeuL.js → Agent-CFkAjuTy.js} +204 -168
- package/dist/_chunks/Agent-CFkAjuTy.js.map +1 -0
- package/dist/_chunks/{PkStreamingMarkdown-B8mvCNou.js → PkStreamingMarkdown-BoVR7gtl.js} +670 -644
- package/dist/_chunks/PkStreamingMarkdown-BoVR7gtl.js.map +1 -0
- package/dist/_chunks/{PkToolEditSpreadsheet-Bp-ES8B0.js → PkToolEditSpreadsheet-BlfsM7Qp.js} +2 -2
- package/dist/_chunks/{PkToolEditSpreadsheet-Bp-ES8B0.js.map → PkToolEditSpreadsheet-BlfsM7Qp.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestGeolocation-DcPMMyJH.js → PkToolRequestGeolocation-DdQ91rpB.js} +2 -2
- package/dist/_chunks/{PkToolRequestGeolocation-DcPMMyJH.js.map → PkToolRequestGeolocation-DdQ91rpB.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestOAuthConnection-Cc2qViGX.js → PkToolRequestOAuthConnection-yuTNMEFj.js} +2 -2
- package/dist/_chunks/{PkToolRequestOAuthConnection-Cc2qViGX.js.map → PkToolRequestOAuthConnection-yuTNMEFj.js.map} +1 -1
- package/dist/_chunks/{PkToolShowArtifact-CcwAlOFM.js → PkToolShowArtifact-DaTlDsDo.js} +2 -2
- package/dist/_chunks/{PkToolShowArtifact-CcwAlOFM.js.map → PkToolShowArtifact-DaTlDsDo.js.map} +1 -1
- package/dist/_chunks/{PkToolShowContactForm-DByjGK_F.js → PkToolShowContactForm-Dxh6bEZt.js} +2 -2
- package/dist/_chunks/{PkToolShowContactForm-DByjGK_F.js.map → PkToolShowContactForm-Dxh6bEZt.js.map} +1 -1
- package/dist/_chunks/{PkToolShowForm-CGrjJ-9k.js → PkToolShowForm-D1VzwMmq.js} +3 -3
- package/dist/_chunks/{PkToolShowForm-CGrjJ-9k.js.map → PkToolShowForm-D1VzwMmq.js.map} +1 -1
- package/dist/_chunks/{PkToolShowImageGallery-C3ZaW1jQ.js → PkToolShowImageGallery-Cs8FxK9V.js} +2 -2
- package/dist/_chunks/{PkToolShowImageGallery-C3ZaW1jQ.js.map → PkToolShowImageGallery-Cs8FxK9V.js.map} +1 -1
- package/dist/_chunks/{PkToolShowProductList-BAHoB6mi.js → PkToolShowProductList-B4fxqFaf.js} +2 -2
- package/dist/_chunks/{PkToolShowProductList-BAHoB6mi.js.map → PkToolShowProductList-B4fxqFaf.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSources-BgnumOzQ.js → PkToolShowSources-DNiiBz9b.js} +3 -3
- package/dist/_chunks/{PkToolShowSources-BgnumOzQ.js.map → PkToolShowSources-DNiiBz9b.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSuggestedReply-CpixDpsJ.js → PkToolShowSuggestedReply-Bn1w6HdI.js} +2 -2
- package/dist/_chunks/{PkToolShowSuggestedReply-CpixDpsJ.js.map → PkToolShowSuggestedReply-Bn1w6HdI.js.map} +1 -1
- package/dist/_chunks/{PkToolShowVideo-94-l_bBW.js → PkToolShowVideo-Be5bKhUf.js} +2 -2
- package/dist/_chunks/{PkToolShowVideo-94-l_bBW.js.map → PkToolShowVideo-Be5bKhUf.js.map} +1 -1
- package/dist/_chunks/{PkToolShowWebPages-q1gLOgDl.js → PkToolShowWebPages-Bs251x0h.js} +2 -2
- package/dist/_chunks/{PkToolShowWebPages-q1gLOgDl.js.map → PkToolShowWebPages-Bs251x0h.js.map} +1 -1
- package/dist/_chunks/{chatImagePolicy-D4kQJejM.js → chatImagePolicy-BACuW8x3.js} +2 -2
- package/dist/_chunks/{chatImagePolicy-D4kQJejM.js.map → chatImagePolicy-BACuW8x3.js.map} +1 -1
- package/dist/_chunks/{markdown-DCYDJNwF.js → markdown-Bk1clNA6.js} +13 -13
- package/dist/_chunks/{markdown-DCYDJNwF.js.map → markdown-Bk1clNA6.js.map} +1 -1
- package/dist/ai-elements.es.js +1963 -1881
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotAudioTranscript.d.ts +2 -0
- package/dist-vue/PkChatbotAudioTranscript.js +1 -0
- package/dist-vue/PkChatbotAuth.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-CSXbmC44.js → Agent-CNJ3b9Je.js} +2 -2
- package/dist-vue/_chunks/{Agent-CSXbmC44.js.map → Agent-CNJ3b9Je.js.map} +1 -1
- package/dist-vue/_chunks/{Document-Ol8nGgij.js → Document-Bp3YJuQQ.js} +11 -11
- package/dist-vue/_chunks/{Document-Ol8nGgij.js.map → Document-Bp3YJuQQ.js.map} +1 -1
- package/dist-vue/_chunks/{Media-Cv7ou2tP.js → Media-C6Xsb1Lm.js} +77 -27
- package/dist-vue/_chunks/Media-C6Xsb1Lm.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbot-BmpFnkde.js → PkChatbot-CSMWib9A.js} +8 -8
- package/dist-vue/_chunks/{PkChatbot-BmpFnkde.js.map → PkChatbot-CSMWib9A.js.map} +1 -1
- package/dist-vue/_chunks/PkChatbotAudioTranscript-B-cSKvWR.js +52 -0
- package/dist-vue/_chunks/PkChatbotAudioTranscript-B-cSKvWR.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotAuth-Dolfz0pa.js → PkChatbotAuth-C0qfDOGh.js} +8 -8
- package/dist-vue/_chunks/{PkChatbotAuth-Dolfz0pa.js.map → PkChatbotAuth-C0qfDOGh.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotEmptyState-BaiGfaAD.js → PkChatbotEmptyState-DjmF3dcI.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotEmptyState-BaiGfaAD.js.map → PkChatbotEmptyState-DjmF3dcI.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotInput-BjfW_bML.js → PkChatbotInput-B8hKYdD9.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotInput-BjfW_bML.js.map → PkChatbotInput-B8hKYdD9.js.map} +1 -1
- package/dist-vue/_chunks/PkChatbotMessages-DJmRPFB8.js +861 -0
- package/dist-vue/_chunks/PkChatbotMessages-DJmRPFB8.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotStepPayload-CGAdiGR5.js → PkChatbotStepPayload-BGYwwXaT.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotStepPayload-CGAdiGR5.js.map → PkChatbotStepPayload-BGYwwXaT.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-DQsmXnKT.js → PkChatbotStepToolDetail-BH07XycE.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-DQsmXnKT.js.map → PkChatbotStepToolDetail-BH07XycE.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotSteps-DzajeHKc.js → PkChatbotSteps-qyUOh42z.js} +6 -6
- package/dist-vue/_chunks/{PkChatbotSteps-DzajeHKc.js.map → PkChatbotSteps-qyUOh42z.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewChat-DZbQQNQn.js → PkChatbotViewChat-C7eA7hef.js} +7 -7
- package/dist-vue/_chunks/{PkChatbotViewChat-DZbQQNQn.js.map → PkChatbotViewChat-C7eA7hef.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewConversations-BXtTZ3kb.js → PkChatbotViewConversations-ClJLe1bm.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewConversations-BXtTZ3kb.js.map → PkChatbotViewConversations-ClJLe1bm.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewFiles--wM5SVAl.js → PkChatbotViewFiles-Do6tpo9O.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewFiles--wM5SVAl.js.map → PkChatbotViewFiles-Do6tpo9O.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewProfile-B8T0AQC8.js → PkChatbotViewProfile-590b78yi.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewProfile-B8T0AQC8.js.map → PkChatbotViewProfile-590b78yi.js.map} +1 -1
- package/dist-vue/_chunks/{PkStreamingMarkdown-D6y6g6vP.js → PkStreamingMarkdown-NWO3WTw9.js} +3 -3
- package/dist-vue/_chunks/{PkStreamingMarkdown-D6y6g6vP.js.map → PkStreamingMarkdown-NWO3WTw9.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolEditSpreadsheet-BkjEQag2.js → PkToolEditSpreadsheet-BnMSzlCi.js} +2 -2
- package/dist-vue/_chunks/{PkToolEditSpreadsheet-BkjEQag2.js.map → PkToolEditSpreadsheet-BnMSzlCi.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolRequestGeolocation-BWWUGKHJ.js → PkToolRequestGeolocation-B2UNj6dx.js} +2 -2
- package/dist-vue/_chunks/{PkToolRequestGeolocation-BWWUGKHJ.js.map → PkToolRequestGeolocation-B2UNj6dx.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolRequestOAuthConnection-DvvLZ8yi.js → PkToolRequestOAuthConnection-B262JqNh.js} +2 -2
- package/dist-vue/_chunks/{PkToolRequestOAuthConnection-DvvLZ8yi.js.map → PkToolRequestOAuthConnection-B262JqNh.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowArtifact-CP-dG3-Y.js → PkToolShowArtifact-Dr0NHXDG.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowArtifact-CP-dG3-Y.js.map → PkToolShowArtifact-Dr0NHXDG.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowContactForm-BK7B-Qzr.js → PkToolShowContactForm-BDm1w3UK.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowContactForm-BK7B-Qzr.js.map → PkToolShowContactForm-BDm1w3UK.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowDiagram-9THUQfbg.js → PkToolShowDiagram-BKz7OPHC.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowDiagram-9THUQfbg.js.map → PkToolShowDiagram-BKz7OPHC.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowForm-CjN-_-1j.js → PkToolShowForm-cKgWwvPD.js} +4 -4
- package/dist-vue/_chunks/{PkToolShowForm-CjN-_-1j.js.map → PkToolShowForm-cKgWwvPD.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowImageGallery-8cmWigYT.js → PkToolShowImageGallery-DsAQhyOq.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowImageGallery-8cmWigYT.js.map → PkToolShowImageGallery-DsAQhyOq.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowProductList-BxsK6LXl.js → PkToolShowProductList-OwGaM5qj.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowProductList-BxsK6LXl.js.map → PkToolShowProductList-OwGaM5qj.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSources-BfWNsyLw.js → PkToolShowSources-BVOqH-ZV.js} +3 -3
- package/dist-vue/_chunks/{PkToolShowSources-BfWNsyLw.js.map → PkToolShowSources-BVOqH-ZV.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSuggestedReply-_bH3Jikn.js → PkToolShowSuggestedReply-CF31zmck.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowSuggestedReply-_bH3Jikn.js.map → PkToolShowSuggestedReply-CF31zmck.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowVideo-2_EdyT_U.js → PkToolShowVideo-BAqSAfdq.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowVideo-2_EdyT_U.js.map → PkToolShowVideo-BAqSAfdq.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowWebPages-B0glenu5.js → PkToolShowWebPages-BeMJqIkW.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowWebPages-B0glenu5.js.map → PkToolShowWebPages-BeMJqIkW.js.map} +1 -1
- package/dist-vue/_chunks/{createChatbotApiClient-DgtSqixO.js → createChatbotApiClient-DmqgH9Ul.js} +3 -3
- package/dist-vue/_chunks/{createChatbotApiClient-DgtSqixO.js.map → createChatbotApiClient-DmqgH9Ul.js.map} +1 -1
- package/dist-vue/_chunks/message-BOiF6Bt5.js +59 -0
- package/dist-vue/_chunks/message-BOiF6Bt5.js.map +1 -0
- package/dist-vue/_chunks/{useChatbotStore-A33jT5Cp.js → useChatbotStore-CiF_gfIk.js} +656 -653
- package/dist-vue/_chunks/useChatbotStore-CiF_gfIk.js.map +1 -0
- package/dist-vue/_chunks/{utils-ByN6GORv.js → utils-DxuGvgWg.js} +37 -37
- package/dist-vue/_chunks/{utils-ByN6GORv.js.map → utils-DxuGvgWg.js.map} +1 -1
- package/dist-vue/api.js +1 -1
- package/dist-vue/composables.js +15 -5
- package/dist-vue/composables.js.map +1 -1
- package/dist-vue/index.js +4754 -4749
- package/dist-vue/index.js.map +1 -1
- package/dist-vue/locales.js +52 -40
- package/dist-vue/packages/components/src/chat/PkChatbotAudioTranscript.d.ts +13 -0
- package/dist-vue/packages/components/src/chat/PkChatbotMessages.d.ts +2 -2
- package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +1 -1
- package/dist-vue/packages/models/src/schema/Agent.d.ts +4 -4
- package/dist-vue/packages/models/src/schema/Media.d.ts +21 -0
- package/dist-vue/packages/models/src/schema/Tabular.d.ts +1 -1
- package/dist-vue/style.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/Agent-BxyaZeuL.js.map +0 -1
- package/dist/_chunks/PkStreamingMarkdown-B8mvCNou.js.map +0 -1
- package/dist-vue/_chunks/Media-Cv7ou2tP.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotMessages-CztL_AMB.js +0 -837
- package/dist-vue/_chunks/PkChatbotMessages-CztL_AMB.js.map +0 -1
- package/dist-vue/_chunks/message-RohfrdWS.js +0 -33
- package/dist-vue/_chunks/message-RohfrdWS.js.map +0 -1
- package/dist-vue/_chunks/useChatbotStore-A33jT5Cp.js.map +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { C as e, D as t, E as n, S as r, _ as i, a, b as o, g as s, h as c, i as l, l as u, m as d, o as f, p, r as m, s as h, u as g, v as _, x as v } from "./schemas-COXYARAA.js";
|
|
2
|
-
import { O as y } from "./Agent-
|
|
3
|
-
import { r as ee, t as te } from "./createChatbotApiClient-
|
|
2
|
+
import { O as y } from "./Agent-CNJ3b9Je.js";
|
|
3
|
+
import { r as ee, t as te } from "./createChatbotApiClient-DmqgH9Ul.js";
|
|
4
4
|
import { t as ne } from "./src-DCfvejyT.js";
|
|
5
|
-
import {
|
|
6
|
-
import { t as
|
|
7
|
-
import { computed as b, getCurrentScope as
|
|
8
|
-
import { useI18n as
|
|
9
|
-
import { usePreferredDark as
|
|
5
|
+
import { r as re, u as ie } from "./message-BOiF6Bt5.js";
|
|
6
|
+
import { t as ae } from "./useSafeLocalStorage-OwzVTZud.js";
|
|
7
|
+
import { computed as b, getCurrentScope as oe, isReadonly as se, onScopeDispose as ce, reactive as le, ref as x, toRefs as ue, watch as de, watchEffect as fe } from "vue";
|
|
8
|
+
import { useI18n as pe } from "vue-i18n";
|
|
9
|
+
import { usePreferredDark as me } from "@vueuse/core";
|
|
10
10
|
import { defineStore as S } from "pinia";
|
|
11
11
|
//#region ../../packages/utils/src/device-context.ts
|
|
12
|
-
function
|
|
12
|
+
function he() {
|
|
13
13
|
let e = navigator.connection, t = navigator.userAgentData;
|
|
14
14
|
return {
|
|
15
15
|
dateTime: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -39,7 +39,7 @@ function me() {
|
|
|
39
39
|
historyLength: window.history.length
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
async function
|
|
42
|
+
async function ge(e) {
|
|
43
43
|
if (!navigator.geolocation || !navigator.permissions) return null;
|
|
44
44
|
try {
|
|
45
45
|
if ((await navigator.permissions.query({ name: "geolocation" })).state !== "granted") return null;
|
|
@@ -58,34 +58,34 @@ async function he(e) {
|
|
|
58
58
|
}
|
|
59
59
|
//#endregion
|
|
60
60
|
//#region ../../node_modules/.pnpm/@ai-sdk+provider@4.0.26/node_modules/@ai-sdk/provider/dist/index.js
|
|
61
|
-
var
|
|
61
|
+
var _e = "vercel.ai.error", ve = Symbol.for(_e), C = class e extends Error {
|
|
62
62
|
constructor({ name: e, message: t, cause: n }) {
|
|
63
|
-
super(t), this[
|
|
63
|
+
super(t), this[ve] = !0, this.name = e, this.cause = n;
|
|
64
64
|
}
|
|
65
65
|
static isInstance(t) {
|
|
66
|
-
return e.hasMarker(t,
|
|
66
|
+
return e.hasMarker(t, _e);
|
|
67
67
|
}
|
|
68
68
|
static hasMarker(e, t) {
|
|
69
69
|
let n = Symbol.for(t);
|
|
70
70
|
return typeof e == "object" && !!e && n in e && typeof e[n] == "boolean" && e[n] === !0;
|
|
71
71
|
}
|
|
72
|
-
}, w = "AI_APICallError", T = `vercel.ai.error.${w}`,
|
|
72
|
+
}, w = "AI_APICallError", T = `vercel.ai.error.${w}`, ye = Symbol.for(T), be = class extends C {
|
|
73
73
|
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 }) {
|
|
74
74
|
super({
|
|
75
75
|
name: w,
|
|
76
76
|
message: e,
|
|
77
77
|
cause: o
|
|
78
|
-
}), this[
|
|
78
|
+
}), this[ye] = !0, this.url = t, this.requestBodyValues = n, this.statusCode = r, this.responseHeaders = i, this.responseBody = a, this.isRetryable = s, this.data = c;
|
|
79
79
|
}
|
|
80
80
|
static isInstance(e) {
|
|
81
81
|
return C.hasMarker(e, T);
|
|
82
82
|
}
|
|
83
|
-
},
|
|
83
|
+
}, xe = "AI_EmptyResponseBodyError", E = `vercel.ai.error.${xe}`, Se = Symbol.for(E), Ce = class extends C {
|
|
84
84
|
constructor({ message: e = "Empty response body" } = {}) {
|
|
85
85
|
super({
|
|
86
|
-
name:
|
|
86
|
+
name: xe,
|
|
87
87
|
message: e
|
|
88
|
-
}), this[
|
|
88
|
+
}), this[Se] = !0;
|
|
89
89
|
}
|
|
90
90
|
static isInstance(e) {
|
|
91
91
|
return C.hasMarker(e, E);
|
|
@@ -94,29 +94,29 @@ var ge = "vercel.ai.error", _e = Symbol.for(ge), C = class e extends Error {
|
|
|
94
94
|
function D(e) {
|
|
95
95
|
return e == null ? "unknown error" : typeof e == "string" ? e : e instanceof Error ? e.toString() : JSON.stringify(e);
|
|
96
96
|
}
|
|
97
|
-
var
|
|
97
|
+
var we = "AI_InvalidArgumentError", Te = `vercel.ai.error.${we}`, Ee = Symbol.for(Te), De = class extends C {
|
|
98
98
|
constructor({ message: e, cause: t, argument: n }) {
|
|
99
99
|
super({
|
|
100
|
-
name:
|
|
100
|
+
name: we,
|
|
101
101
|
message: e,
|
|
102
102
|
cause: t
|
|
103
|
-
}), this[
|
|
103
|
+
}), this[Ee] = !0, this.argument = n;
|
|
104
104
|
}
|
|
105
105
|
static isInstance(e) {
|
|
106
|
-
return C.hasMarker(e,
|
|
106
|
+
return C.hasMarker(e, Te);
|
|
107
107
|
}
|
|
108
|
-
},
|
|
108
|
+
}, Oe = "AI_JSONParseError", O = `vercel.ai.error.${Oe}`, ke = Symbol.for(O), k = class extends C {
|
|
109
109
|
constructor({ text: e, cause: t }) {
|
|
110
110
|
super({
|
|
111
|
-
name:
|
|
111
|
+
name: Oe,
|
|
112
112
|
message: `JSON parsing failed: Text: ${e}.\nError message: ${D(t)}`,
|
|
113
113
|
cause: t
|
|
114
|
-
}), this[
|
|
114
|
+
}), this[ke] = !0, this.text = e;
|
|
115
115
|
}
|
|
116
116
|
static isInstance(e) {
|
|
117
117
|
return C.hasMarker(e, O);
|
|
118
118
|
}
|
|
119
|
-
},
|
|
119
|
+
}, Ae = "AI_TypeValidationError", je = `vercel.ai.error.${Ae}`, A = Symbol.for(je), j = class e extends C {
|
|
120
120
|
constructor({ value: e, cause: t, context: n }) {
|
|
121
121
|
let r = "Type validation failed";
|
|
122
122
|
if (n?.field && (r += ` for ${n.field}`), n?.entityName || n?.entityId) {
|
|
@@ -125,13 +125,13 @@ var Ce = "AI_InvalidArgumentError", we = `vercel.ai.error.${Ce}`, Te = Symbol.fo
|
|
|
125
125
|
n.entityName && e.push(n.entityName), n.entityId && e.push(`id: "${n.entityId}"`), r += e.join(", "), r += ")";
|
|
126
126
|
}
|
|
127
127
|
super({
|
|
128
|
-
name:
|
|
128
|
+
name: Ae,
|
|
129
129
|
message: `${r}: Value: ${JSON.stringify(e)}.\nError message: ${D(t)}`,
|
|
130
130
|
cause: t
|
|
131
131
|
}), this[A] = !0, this.value = e, this.context = n;
|
|
132
132
|
}
|
|
133
133
|
static isInstance(e) {
|
|
134
|
-
return C.hasMarker(e,
|
|
134
|
+
return C.hasMarker(e, je);
|
|
135
135
|
}
|
|
136
136
|
static wrap({ value: t, cause: n, context: r }) {
|
|
137
137
|
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({
|
|
@@ -140,12 +140,12 @@ var Ce = "AI_InvalidArgumentError", we = `vercel.ai.error.${Ce}`, Te = Symbol.fo
|
|
|
140
140
|
context: r
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
|
-
},
|
|
143
|
+
}, Me = "AI_UnsupportedFunctionalityError", M = `vercel.ai.error.${Me}`, Ne = Symbol.for(M), Pe = class extends C {
|
|
144
144
|
constructor({ functionality: e, message: t = `'${e}' functionality not supported.` }) {
|
|
145
145
|
super({
|
|
146
|
-
name:
|
|
146
|
+
name: Me,
|
|
147
147
|
message: t
|
|
148
|
-
}), this[
|
|
148
|
+
}), this[Ne] = !0, this.functionality = e;
|
|
149
149
|
}
|
|
150
150
|
static isInstance(e) {
|
|
151
151
|
return C.hasMarker(e, M);
|
|
@@ -154,11 +154,11 @@ var Ce = "AI_InvalidArgumentError", we = `vercel.ai.error.${Ce}`, Te = Symbol.fo
|
|
|
154
154
|
constructor(e, t) {
|
|
155
155
|
super(e), this.name = "ParseError", this.type = t.type, this.field = t.field, this.value = t.value, this.line = t.line;
|
|
156
156
|
}
|
|
157
|
-
},
|
|
158
|
-
function
|
|
157
|
+
}, Fe = 10, P = 13, F = 32;
|
|
158
|
+
function I(e) {}
|
|
159
159
|
function Ie(e) {
|
|
160
160
|
if (typeof e == "function") throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");
|
|
161
|
-
let { onEvent: t =
|
|
161
|
+
let { onEvent: t = I, onError: n = I, onRetry: r = I, onComment: i, maxBufferSize: a } = e, o = [], s = 0, c = !0, l, u = "", d = 0, f, p = !1;
|
|
162
162
|
function m(e) {
|
|
163
163
|
if (p) throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");
|
|
164
164
|
if (c && (c = !1, e.charCodeAt(0) === 239 && e.charCodeAt(1) === 187 && e.charCodeAt(2) === 191 && (e = e.slice(3))), o.length === 0) {
|
|
@@ -194,8 +194,8 @@ function Ie(e) {
|
|
|
194
194
|
}
|
|
195
195
|
let i = e.charCodeAt(n);
|
|
196
196
|
if (Le(e, n, i)) {
|
|
197
|
-
let i = e.charCodeAt(n + 5) ===
|
|
198
|
-
if (d === 0 && e.charCodeAt(r + 1) ===
|
|
197
|
+
let i = e.charCodeAt(n + 5) === F ? n + 6 : n + 5, a = e.slice(i, r);
|
|
198
|
+
if (d === 0 && e.charCodeAt(r + 1) === Fe) {
|
|
199
199
|
t({
|
|
200
200
|
id: l,
|
|
201
201
|
event: f,
|
|
@@ -205,7 +205,7 @@ function Ie(e) {
|
|
|
205
205
|
}
|
|
206
206
|
u = d === 0 ? a : `${u}
|
|
207
207
|
${a}`, d++;
|
|
208
|
-
} else Re(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) ===
|
|
208
|
+
} else Re(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) === F ? n + 7 : n + 6, r) || void 0 : _(e, n, r);
|
|
209
209
|
n = r + 1, r = e.indexOf("\n", n);
|
|
210
210
|
}
|
|
211
211
|
return e.slice(n);
|
|
@@ -213,7 +213,7 @@ ${a}`, d++;
|
|
|
213
213
|
for (; n < e.length;) {
|
|
214
214
|
let t = e.indexOf("\r", n), r = e.indexOf("\n", n), i = -1;
|
|
215
215
|
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;
|
|
216
|
-
_(e, n, i), n = i + 1, e.charCodeAt(n - 1) ===
|
|
216
|
+
_(e, n, i), n = i + 1, e.charCodeAt(n - 1) === P && e.charCodeAt(n) === Fe && n++;
|
|
217
217
|
}
|
|
218
218
|
return e.slice(n);
|
|
219
219
|
}
|
|
@@ -224,24 +224,24 @@ ${a}`, d++;
|
|
|
224
224
|
}
|
|
225
225
|
let r = e.charCodeAt(t);
|
|
226
226
|
if (Le(e, t, r)) {
|
|
227
|
-
let r = e.charCodeAt(t + 5) ===
|
|
227
|
+
let r = e.charCodeAt(t + 5) === F ? t + 6 : t + 5, i = e.slice(r, n);
|
|
228
228
|
u = d === 0 ? i : `${u}
|
|
229
229
|
${i}`, d++;
|
|
230
230
|
return;
|
|
231
231
|
}
|
|
232
232
|
if (Re(e, t, r)) {
|
|
233
|
-
f = e.slice(e.charCodeAt(t + 6) ===
|
|
233
|
+
f = e.slice(e.charCodeAt(t + 6) === F ? t + 7 : t + 6, n) || void 0;
|
|
234
234
|
return;
|
|
235
235
|
}
|
|
236
236
|
if (r === 105 && e.charCodeAt(t + 1) === 100 && e.charCodeAt(t + 2) === 58) {
|
|
237
|
-
let r = e.slice(e.charCodeAt(t + 3) ===
|
|
237
|
+
let r = e.slice(e.charCodeAt(t + 3) === F ? t + 4 : t + 3, n);
|
|
238
238
|
l = r.includes("\0") ? void 0 : r;
|
|
239
239
|
return;
|
|
240
240
|
}
|
|
241
241
|
if (r === 58) {
|
|
242
242
|
if (i) {
|
|
243
243
|
let r = e.slice(t, n);
|
|
244
|
-
i(r.slice(e.charCodeAt(t + 1) ===
|
|
244
|
+
i(r.slice(e.charCodeAt(t + 1) === F ? 2 : 1));
|
|
245
245
|
}
|
|
246
246
|
return;
|
|
247
247
|
}
|
|
@@ -250,7 +250,7 @@ ${i}`, d++;
|
|
|
250
250
|
v(a, "", a);
|
|
251
251
|
return;
|
|
252
252
|
}
|
|
253
|
-
let s = a.slice(0, o), c = a.charCodeAt(o + 1) ===
|
|
253
|
+
let s = a.slice(0, o), c = a.charCodeAt(o + 1) === F ? 2 : 1;
|
|
254
254
|
v(s, a.slice(o + c), a);
|
|
255
255
|
}
|
|
256
256
|
function v(e, t, i) {
|
|
@@ -332,7 +332,7 @@ var ze = class extends TransformStream {
|
|
|
332
332
|
};
|
|
333
333
|
new TextDecoder();
|
|
334
334
|
var { btoa: Be, atob: Ve } = globalThis;
|
|
335
|
-
function
|
|
335
|
+
function L(e) {
|
|
336
336
|
if (e == null) return {};
|
|
337
337
|
let t = {};
|
|
338
338
|
if (e instanceof Headers) e.forEach((e, n) => {
|
|
@@ -344,19 +344,19 @@ function I(e) {
|
|
|
344
344
|
}
|
|
345
345
|
return t;
|
|
346
346
|
}
|
|
347
|
-
var
|
|
347
|
+
var R = ({ prefix: e, size: t = 16, alphabet: n = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", separator: r = "-" } = {}) => {
|
|
348
348
|
let i = () => {
|
|
349
349
|
let e = n.length, r = Array(t);
|
|
350
350
|
for (let i = 0; i < t; i++) r[i] = n[Math.random() * e | 0];
|
|
351
351
|
return r.join("");
|
|
352
352
|
};
|
|
353
353
|
if (e == null) return i;
|
|
354
|
-
if (n.includes(r)) throw new
|
|
354
|
+
if (n.includes(r)) throw new De({
|
|
355
355
|
argument: "separator",
|
|
356
356
|
message: `The separator "${r}" must not be part of the alphabet "${n}".`
|
|
357
357
|
});
|
|
358
358
|
return () => `${e}${r}${i()}`;
|
|
359
|
-
},
|
|
359
|
+
}, z = R();
|
|
360
360
|
function He(e) {
|
|
361
361
|
return globalThis.Buffer?.isBuffer(e) ?? !1;
|
|
362
362
|
}
|
|
@@ -396,16 +396,16 @@ function qe(e) {
|
|
|
396
396
|
function Je(e) {
|
|
397
397
|
if (e.type === "object" || Array.isArray(e.type) && e.type.includes("object")) {
|
|
398
398
|
let { additionalProperties: t } = e;
|
|
399
|
-
e.additionalProperties = t != null && typeof t != "boolean" &&
|
|
399
|
+
e.additionalProperties = t != null && typeof t != "boolean" && B(t);
|
|
400
400
|
let { properties: n } = e;
|
|
401
|
-
if (n != null) for (let e of Object.keys(n)) n[e] =
|
|
401
|
+
if (n != null) for (let e of Object.keys(n)) n[e] = B(n[e]);
|
|
402
402
|
}
|
|
403
|
-
e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(
|
|
403
|
+
e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(B) : B(e.items)), e.anyOf != null && (e.anyOf = e.anyOf.map(B)), e.allOf != null && (e.allOf = e.allOf.map(B)), e.oneOf != null && (e.oneOf = e.oneOf.map(B));
|
|
404
404
|
let { definitions: t } = e;
|
|
405
|
-
if (t != null) for (let e of Object.keys(t)) t[e] =
|
|
405
|
+
if (t != null) for (let e of Object.keys(t)) t[e] = B(t[e]);
|
|
406
406
|
return e;
|
|
407
407
|
}
|
|
408
|
-
function
|
|
408
|
+
function B(e) {
|
|
409
409
|
return typeof e == "boolean" ? e : Je(e);
|
|
410
410
|
}
|
|
411
411
|
var Ye = Symbol("Let zodToJsonSchema decide on which parser to use"), Xe = {
|
|
@@ -435,12 +435,12 @@ var Ye = Symbol("Let zodToJsonSchema decide on which parser to use"), Xe = {
|
|
|
435
435
|
...Xe,
|
|
436
436
|
...e
|
|
437
437
|
};
|
|
438
|
-
function
|
|
438
|
+
function V() {
|
|
439
439
|
return {};
|
|
440
440
|
}
|
|
441
441
|
function Qe(e, t) {
|
|
442
442
|
let n = { type: "array" };
|
|
443
|
-
return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items =
|
|
443
|
+
return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = K(e.type._def, {
|
|
444
444
|
...t,
|
|
445
445
|
currentPath: [...t.currentPath, "items"]
|
|
446
446
|
})), 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;
|
|
@@ -466,9 +466,9 @@ function et() {
|
|
|
466
466
|
return { type: "boolean" };
|
|
467
467
|
}
|
|
468
468
|
function tt(e, t) {
|
|
469
|
-
return
|
|
469
|
+
return K(e.type._def, t);
|
|
470
470
|
}
|
|
471
|
-
var nt = (e, t) =>
|
|
471
|
+
var nt = (e, t) => K(e.innerType._def, t);
|
|
472
472
|
function rt(e, t, n) {
|
|
473
473
|
let r = n ?? t.dateStrategy;
|
|
474
474
|
if (Array.isArray(r)) return { anyOf: r.map((n) => rt(e, t, n)) };
|
|
@@ -500,14 +500,14 @@ var it = (e) => {
|
|
|
500
500
|
};
|
|
501
501
|
function at(e, t) {
|
|
502
502
|
return {
|
|
503
|
-
...
|
|
503
|
+
...K(e.innerType._def, t),
|
|
504
504
|
default: e.defaultValue()
|
|
505
505
|
};
|
|
506
506
|
}
|
|
507
507
|
function ot(e, t) {
|
|
508
|
-
return t.effectStrategy === "input" ?
|
|
508
|
+
return t.effectStrategy === "input" ? K(e.schema._def, t) : V();
|
|
509
509
|
}
|
|
510
|
-
function
|
|
510
|
+
function H(e) {
|
|
511
511
|
return {
|
|
512
512
|
type: "string",
|
|
513
513
|
enum: Array.from(e.values)
|
|
@@ -515,14 +515,14 @@ function V(e) {
|
|
|
515
515
|
}
|
|
516
516
|
var st = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
|
|
517
517
|
function ct(e, t) {
|
|
518
|
-
let n = [
|
|
518
|
+
let n = [K(e.left._def, {
|
|
519
519
|
...t,
|
|
520
520
|
currentPath: [
|
|
521
521
|
...t.currentPath,
|
|
522
522
|
"allOf",
|
|
523
523
|
"0"
|
|
524
524
|
]
|
|
525
|
-
}),
|
|
525
|
+
}), K(e.right._def, {
|
|
526
526
|
...t,
|
|
527
527
|
currentPath: [
|
|
528
528
|
...t.currentPath,
|
|
@@ -549,7 +549,7 @@ function lt(e) {
|
|
|
549
549
|
const: e.value
|
|
550
550
|
};
|
|
551
551
|
}
|
|
552
|
-
var ut = void 0,
|
|
552
|
+
var ut = void 0, U = {
|
|
553
553
|
cuid: /^[cC][^\s-]{8,}$/,
|
|
554
554
|
cuid2: /^[0-9a-z]+$/,
|
|
555
555
|
ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
|
|
@@ -577,83 +577,83 @@ function dt(e, t) {
|
|
|
577
577
|
case "email":
|
|
578
578
|
switch (t.emailStrategy) {
|
|
579
579
|
case "format:email":
|
|
580
|
-
|
|
580
|
+
W(n, "email", r.message, t);
|
|
581
581
|
break;
|
|
582
582
|
case "format:idn-email":
|
|
583
|
-
|
|
583
|
+
W(n, "idn-email", r.message, t);
|
|
584
584
|
break;
|
|
585
|
-
case "pattern:zod":
|
|
585
|
+
case "pattern:zod": G(n, U.email, r.message, t);
|
|
586
586
|
}
|
|
587
587
|
break;
|
|
588
588
|
case "url":
|
|
589
|
-
|
|
589
|
+
W(n, "uri", r.message, t);
|
|
590
590
|
break;
|
|
591
591
|
case "uuid":
|
|
592
|
-
|
|
592
|
+
W(n, "uuid", r.message, t);
|
|
593
593
|
break;
|
|
594
594
|
case "regex":
|
|
595
|
-
|
|
595
|
+
G(n, r.regex, r.message, t);
|
|
596
596
|
break;
|
|
597
597
|
case "cuid":
|
|
598
|
-
|
|
598
|
+
G(n, U.cuid, r.message, t);
|
|
599
599
|
break;
|
|
600
600
|
case "cuid2":
|
|
601
|
-
|
|
601
|
+
G(n, U.cuid2, r.message, t);
|
|
602
602
|
break;
|
|
603
603
|
case "startsWith":
|
|
604
|
-
|
|
604
|
+
G(n, RegExp(`^${ft(r.value, t)}`), r.message, t);
|
|
605
605
|
break;
|
|
606
606
|
case "endsWith":
|
|
607
|
-
|
|
607
|
+
G(n, RegExp(`${ft(r.value, t)}$`), r.message, t);
|
|
608
608
|
break;
|
|
609
609
|
case "datetime":
|
|
610
|
-
|
|
610
|
+
W(n, "date-time", r.message, t);
|
|
611
611
|
break;
|
|
612
612
|
case "date":
|
|
613
|
-
|
|
613
|
+
W(n, "date", r.message, t);
|
|
614
614
|
break;
|
|
615
615
|
case "time":
|
|
616
|
-
|
|
616
|
+
W(n, "time", r.message, t);
|
|
617
617
|
break;
|
|
618
618
|
case "duration":
|
|
619
|
-
|
|
619
|
+
W(n, "duration", r.message, t);
|
|
620
620
|
break;
|
|
621
621
|
case "length":
|
|
622
622
|
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;
|
|
623
623
|
break;
|
|
624
624
|
case "includes":
|
|
625
|
-
|
|
625
|
+
G(n, RegExp(ft(r.value, t)), r.message, t);
|
|
626
626
|
break;
|
|
627
627
|
case "ip":
|
|
628
|
-
r.version !== "v6" &&
|
|
628
|
+
r.version !== "v6" && W(n, "ipv4", r.message, t), r.version !== "v4" && W(n, "ipv6", r.message, t);
|
|
629
629
|
break;
|
|
630
630
|
case "base64url":
|
|
631
|
-
|
|
631
|
+
G(n, U.base64url, r.message, t);
|
|
632
632
|
break;
|
|
633
633
|
case "jwt":
|
|
634
|
-
|
|
634
|
+
G(n, U.jwt, r.message, t);
|
|
635
635
|
break;
|
|
636
636
|
case "cidr":
|
|
637
|
-
r.version !== "v6" &&
|
|
637
|
+
r.version !== "v6" && G(n, U.ipv4Cidr, r.message, t), r.version !== "v4" && G(n, U.ipv6Cidr, r.message, t);
|
|
638
638
|
break;
|
|
639
639
|
case "emoji":
|
|
640
|
-
|
|
640
|
+
G(n, U.emoji(), r.message, t);
|
|
641
641
|
break;
|
|
642
642
|
case "ulid":
|
|
643
|
-
|
|
643
|
+
G(n, U.ulid, r.message, t);
|
|
644
644
|
break;
|
|
645
645
|
case "base64":
|
|
646
646
|
switch (t.base64Strategy) {
|
|
647
647
|
case "format:binary":
|
|
648
|
-
|
|
648
|
+
W(n, "binary", r.message, t);
|
|
649
649
|
break;
|
|
650
650
|
case "contentEncoding:base64":
|
|
651
651
|
n.contentEncoding = "base64";
|
|
652
652
|
break;
|
|
653
|
-
case "pattern:zod":
|
|
653
|
+
case "pattern:zod": G(n, U.base64, r.message, t);
|
|
654
654
|
}
|
|
655
655
|
break;
|
|
656
|
-
case "nanoid":
|
|
656
|
+
case "nanoid": G(n, U.nanoid, r.message, t);
|
|
657
657
|
}
|
|
658
658
|
return n;
|
|
659
659
|
}
|
|
@@ -666,13 +666,13 @@ function mt(e) {
|
|
|
666
666
|
for (let n = 0; n < e.length; n++) pt.has(e[n]) || (t += "\\"), t += e[n];
|
|
667
667
|
return t;
|
|
668
668
|
}
|
|
669
|
-
function
|
|
669
|
+
function W(e, t, n, r) {
|
|
670
670
|
e.format || e.anyOf?.some((e) => e.format) ? (e.anyOf ||= [], e.format && (e.anyOf.push({ format: e.format }), delete e.format), e.anyOf.push({
|
|
671
671
|
format: t,
|
|
672
672
|
...n && r.errorMessages && { errorMessage: { format: n } }
|
|
673
673
|
})) : e.format = t;
|
|
674
674
|
}
|
|
675
|
-
function
|
|
675
|
+
function G(e, t, n, r) {
|
|
676
676
|
e.pattern || e.allOf?.some((e) => e.pattern) ? (e.allOf ||= [], e.pattern && (e.allOf.push({ pattern: e.pattern }), delete e.pattern), e.allOf.push({
|
|
677
677
|
pattern: ht(t, r),
|
|
678
678
|
...n && r.errorMessages && { errorMessage: { pattern: n } }
|
|
@@ -720,7 +720,7 @@ function ht(e, t) {
|
|
|
720
720
|
function gt(e, t) {
|
|
721
721
|
let n = {
|
|
722
722
|
type: "object",
|
|
723
|
-
additionalProperties:
|
|
723
|
+
additionalProperties: K(e.valueType._def, {
|
|
724
724
|
...t,
|
|
725
725
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
726
726
|
}) ?? t.allowedAdditionalProperties
|
|
@@ -751,7 +751,7 @@ function _t(e, t) {
|
|
|
751
751
|
maxItems: 125,
|
|
752
752
|
items: {
|
|
753
753
|
type: "array",
|
|
754
|
-
items: [
|
|
754
|
+
items: [K(e.keyType._def, {
|
|
755
755
|
...t,
|
|
756
756
|
currentPath: [
|
|
757
757
|
...t.currentPath,
|
|
@@ -759,7 +759,7 @@ function _t(e, t) {
|
|
|
759
759
|
"items",
|
|
760
760
|
"0"
|
|
761
761
|
]
|
|
762
|
-
}) ||
|
|
762
|
+
}) || V(), K(e.valueType._def, {
|
|
763
763
|
...t,
|
|
764
764
|
currentPath: [
|
|
765
765
|
...t.currentPath,
|
|
@@ -767,7 +767,7 @@ function _t(e, t) {
|
|
|
767
767
|
"items",
|
|
768
768
|
"1"
|
|
769
769
|
]
|
|
770
|
-
}) ||
|
|
770
|
+
}) || V()],
|
|
771
771
|
minItems: 2,
|
|
772
772
|
maxItems: 2
|
|
773
773
|
}
|
|
@@ -781,7 +781,7 @@ function vt(e) {
|
|
|
781
781
|
};
|
|
782
782
|
}
|
|
783
783
|
function yt() {
|
|
784
|
-
return { not:
|
|
784
|
+
return { not: V() };
|
|
785
785
|
}
|
|
786
786
|
function bt() {
|
|
787
787
|
return { type: "null" };
|
|
@@ -828,7 +828,7 @@ function St(e, t) {
|
|
|
828
828
|
return Ct(e, t);
|
|
829
829
|
}
|
|
830
830
|
var Ct = (e, t) => {
|
|
831
|
-
let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) =>
|
|
831
|
+
let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => K(e._def, {
|
|
832
832
|
...t,
|
|
833
833
|
currentPath: [
|
|
834
834
|
...t.currentPath,
|
|
@@ -846,7 +846,7 @@ function wt(e, t) {
|
|
|
846
846
|
"ZodBoolean",
|
|
847
847
|
"ZodNull"
|
|
848
848
|
].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [xt[e.innerType._def.typeName], "null"] };
|
|
849
|
-
let n =
|
|
849
|
+
let n = K(e.innerType._def, {
|
|
850
850
|
...t,
|
|
851
851
|
currentPath: [
|
|
852
852
|
...t.currentPath,
|
|
@@ -881,7 +881,7 @@ function Et(e, t) {
|
|
|
881
881
|
for (let e in i) {
|
|
882
882
|
let a = i[e];
|
|
883
883
|
if (a === void 0 || a._def === void 0) continue;
|
|
884
|
-
let o = Ot(a), s =
|
|
884
|
+
let o = Ot(a), s = K(a._def, {
|
|
885
885
|
...t,
|
|
886
886
|
currentPath: [
|
|
887
887
|
...t.currentPath,
|
|
@@ -901,7 +901,7 @@ function Et(e, t) {
|
|
|
901
901
|
return a !== void 0 && (n.additionalProperties = a), n;
|
|
902
902
|
}
|
|
903
903
|
function Dt(e, t) {
|
|
904
|
-
if (e.catchall._def.typeName !== "ZodNever") return
|
|
904
|
+
if (e.catchall._def.typeName !== "ZodNever") return K(e.catchall._def, {
|
|
905
905
|
...t,
|
|
906
906
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
907
907
|
});
|
|
@@ -919,8 +919,8 @@ function Ot(e) {
|
|
|
919
919
|
}
|
|
920
920
|
}
|
|
921
921
|
var kt = (e, t) => {
|
|
922
|
-
if (t.currentPath.toString() === t.propertyPath?.toString()) return
|
|
923
|
-
let n =
|
|
922
|
+
if (t.currentPath.toString() === t.propertyPath?.toString()) return K(e.innerType._def, t);
|
|
923
|
+
let n = K(e.innerType._def, {
|
|
924
924
|
...t,
|
|
925
925
|
currentPath: [
|
|
926
926
|
...t.currentPath,
|
|
@@ -928,11 +928,11 @@ var kt = (e, t) => {
|
|
|
928
928
|
"1"
|
|
929
929
|
]
|
|
930
930
|
});
|
|
931
|
-
return n ? { anyOf: [{ not:
|
|
931
|
+
return n ? { anyOf: [{ not: V() }, n] } : V();
|
|
932
932
|
}, At = (e, t) => {
|
|
933
|
-
if (t.pipeStrategy === "input") return
|
|
934
|
-
if (t.pipeStrategy === "output") return
|
|
935
|
-
let n =
|
|
933
|
+
if (t.pipeStrategy === "input") return K(e.in._def, t);
|
|
934
|
+
if (t.pipeStrategy === "output") return K(e.out._def, t);
|
|
935
|
+
let n = K(e.in._def, {
|
|
936
936
|
...t,
|
|
937
937
|
currentPath: [
|
|
938
938
|
...t.currentPath,
|
|
@@ -940,7 +940,7 @@ var kt = (e, t) => {
|
|
|
940
940
|
"0"
|
|
941
941
|
]
|
|
942
942
|
});
|
|
943
|
-
return { allOf: [n,
|
|
943
|
+
return { allOf: [n, K(e.out._def, {
|
|
944
944
|
...t,
|
|
945
945
|
currentPath: [
|
|
946
946
|
...t.currentPath,
|
|
@@ -950,13 +950,13 @@ var kt = (e, t) => {
|
|
|
950
950
|
})].filter((e) => e !== void 0) };
|
|
951
951
|
};
|
|
952
952
|
function jt(e, t) {
|
|
953
|
-
return
|
|
953
|
+
return K(e.type._def, t);
|
|
954
954
|
}
|
|
955
955
|
function Mt(e, t) {
|
|
956
956
|
let n = {
|
|
957
957
|
type: "array",
|
|
958
958
|
uniqueItems: !0,
|
|
959
|
-
items:
|
|
959
|
+
items: K(e.valueType._def, {
|
|
960
960
|
...t,
|
|
961
961
|
currentPath: [...t.currentPath, "items"]
|
|
962
962
|
})
|
|
@@ -967,7 +967,7 @@ function Nt(e, t) {
|
|
|
967
967
|
return e.rest ? {
|
|
968
968
|
type: "array",
|
|
969
969
|
minItems: e.items.length,
|
|
970
|
-
items: e.items.map((e, n) =>
|
|
970
|
+
items: e.items.map((e, n) => K(e._def, {
|
|
971
971
|
...t,
|
|
972
972
|
currentPath: [
|
|
973
973
|
...t.currentPath,
|
|
@@ -975,7 +975,7 @@ function Nt(e, t) {
|
|
|
975
975
|
`${n}`
|
|
976
976
|
]
|
|
977
977
|
})).reduce((e, t) => t === void 0 ? e : [...e, t], []),
|
|
978
|
-
additionalItems:
|
|
978
|
+
additionalItems: K(e.rest._def, {
|
|
979
979
|
...t,
|
|
980
980
|
currentPath: [...t.currentPath, "additionalItems"]
|
|
981
981
|
})
|
|
@@ -983,7 +983,7 @@ function Nt(e, t) {
|
|
|
983
983
|
type: "array",
|
|
984
984
|
minItems: e.items.length,
|
|
985
985
|
maxItems: e.items.length,
|
|
986
|
-
items: e.items.map((e, n) =>
|
|
986
|
+
items: e.items.map((e, n) => K(e._def, {
|
|
987
987
|
...t,
|
|
988
988
|
currentPath: [
|
|
989
989
|
...t.currentPath,
|
|
@@ -994,12 +994,12 @@ function Nt(e, t) {
|
|
|
994
994
|
};
|
|
995
995
|
}
|
|
996
996
|
function Pt() {
|
|
997
|
-
return { not:
|
|
997
|
+
return { not: V() };
|
|
998
998
|
}
|
|
999
999
|
function Ft() {
|
|
1000
|
-
return
|
|
1000
|
+
return V();
|
|
1001
1001
|
}
|
|
1002
|
-
var It = (e, t) =>
|
|
1002
|
+
var It = (e, t) => K(e.innerType._def, t), Lt = (e, t, n) => {
|
|
1003
1003
|
switch (t) {
|
|
1004
1004
|
case "ZodString": return dt(e, n);
|
|
1005
1005
|
case "ZodNumber": return Tt(e);
|
|
@@ -1016,7 +1016,7 @@ var It = (e, t) => G(e.innerType._def, t), Lt = (e, t, n) => {
|
|
|
1016
1016
|
case "ZodTuple": return Nt(e, n);
|
|
1017
1017
|
case "ZodRecord": return gt(e, n);
|
|
1018
1018
|
case "ZodLiteral": return lt(e);
|
|
1019
|
-
case "ZodEnum": return
|
|
1019
|
+
case "ZodEnum": return H(e);
|
|
1020
1020
|
case "ZodNativeEnum": return vt(e);
|
|
1021
1021
|
case "ZodNullable": return wt(e, n);
|
|
1022
1022
|
case "ZodOptional": return kt(e, n);
|
|
@@ -1027,7 +1027,7 @@ var It = (e, t) => G(e.innerType._def, t), Lt = (e, t, n) => {
|
|
|
1027
1027
|
case "ZodNaN":
|
|
1028
1028
|
case "ZodNever": return yt();
|
|
1029
1029
|
case "ZodEffects": return ot(e, n);
|
|
1030
|
-
case "ZodAny": return
|
|
1030
|
+
case "ZodAny": return V();
|
|
1031
1031
|
case "ZodUnknown": return Ft();
|
|
1032
1032
|
case "ZodDefault": return at(e, n);
|
|
1033
1033
|
case "ZodBranded": return tt(e, n);
|
|
@@ -1046,7 +1046,7 @@ var It = (e, t) => G(e.innerType._def, t), Lt = (e, t, n) => {
|
|
|
1046
1046
|
for (; n < e.length && n < t.length && e[n] === t[n]; n++);
|
|
1047
1047
|
return [(e.length - n).toString(), ...t.slice(n)].join("/");
|
|
1048
1048
|
};
|
|
1049
|
-
function
|
|
1049
|
+
function K(e, t, n = !1) {
|
|
1050
1050
|
let r = t.seen.get(e);
|
|
1051
1051
|
if (t.override) {
|
|
1052
1052
|
let i = t.override?.(e, t, r, n);
|
|
@@ -1062,7 +1062,7 @@ function G(e, t, n = !1) {
|
|
|
1062
1062
|
jsonSchema: void 0
|
|
1063
1063
|
};
|
|
1064
1064
|
t.seen.set(e, i);
|
|
1065
|
-
let a = Lt(e, e.typeName, t), o = typeof a == "function" ?
|
|
1065
|
+
let a = Lt(e, e.typeName, t), o = typeof a == "function" ? K(a(), t) : a;
|
|
1066
1066
|
if (o && Bt(e, t, o), t.postProcess) {
|
|
1067
1067
|
let n = t.postProcess(o, e, t);
|
|
1068
1068
|
return i.jsonSchema = o, n;
|
|
@@ -1074,7 +1074,7 @@ var zt = (e, t) => {
|
|
|
1074
1074
|
case "root": return { $ref: e.path.join("/") };
|
|
1075
1075
|
case "relative": return { $ref: Rt(t.currentPath, e.path) };
|
|
1076
1076
|
case "none":
|
|
1077
|
-
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`),
|
|
1077
|
+
case "seen": return e.path.length < t.currentPath.length && e.path.every((e, n) => t.currentPath[n] === e) ? (console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`), V()) : t.$refStrategy === "seen" ? V() : void 0;
|
|
1078
1078
|
}
|
|
1079
1079
|
}, Bt = (e, t, n) => (e.description && (n.description = e.description), n), Vt = (e) => {
|
|
1080
1080
|
let t = Ze(e), n = t.name === void 0 ? t.basePath : [
|
|
@@ -1099,22 +1099,22 @@ var zt = (e, t) => {
|
|
|
1099
1099
|
}, Ht = (e, t) => {
|
|
1100
1100
|
let n = Vt(t), r = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((e, [t, r]) => ({
|
|
1101
1101
|
...e,
|
|
1102
|
-
[t]:
|
|
1102
|
+
[t]: K(r._def, {
|
|
1103
1103
|
...n,
|
|
1104
1104
|
currentPath: [
|
|
1105
1105
|
...n.basePath,
|
|
1106
1106
|
n.definitionPath,
|
|
1107
1107
|
t
|
|
1108
1108
|
]
|
|
1109
|
-
}, !0) ??
|
|
1110
|
-
}), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a =
|
|
1109
|
+
}, !0) ?? V()
|
|
1110
|
+
}), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = K(e._def, i === void 0 ? n : {
|
|
1111
1111
|
...n,
|
|
1112
1112
|
currentPath: [
|
|
1113
1113
|
...n.basePath,
|
|
1114
1114
|
n.definitionPath,
|
|
1115
1115
|
i
|
|
1116
1116
|
]
|
|
1117
|
-
}, !1) ??
|
|
1117
|
+
}, !1) ?? V(), o = typeof t == "object" && t.name !== void 0 && t.nameStrategy === "title" ? t.name : void 0;
|
|
1118
1118
|
o !== void 0 && (a.title = o);
|
|
1119
1119
|
let s = i === void 0 ? r ? {
|
|
1120
1120
|
...a,
|
|
@@ -1290,7 +1290,7 @@ function rn({ stream: e, schema: t }) {
|
|
|
1290
1290
|
}));
|
|
1291
1291
|
} }));
|
|
1292
1292
|
}
|
|
1293
|
-
async function
|
|
1293
|
+
async function q(e) {
|
|
1294
1294
|
return typeof e == "function" && (e = e()), e;
|
|
1295
1295
|
}
|
|
1296
1296
|
new TextDecoder();
|
|
@@ -1306,7 +1306,7 @@ var an = "AI_InvalidArgumentError", on = `vercel.ai.error.${an}`, sn = Symbol.fo
|
|
|
1306
1306
|
static isInstance(e) {
|
|
1307
1307
|
return C.hasMarker(e, on);
|
|
1308
1308
|
}
|
|
1309
|
-
}, ln = "AI_UIMessageStreamError", un = `vercel.ai.error.${ln}`, dn = Symbol.for(un),
|
|
1309
|
+
}, ln = "AI_UIMessageStreamError", un = `vercel.ai.error.${ln}`, dn = Symbol.for(un), J = class extends C {
|
|
1310
1310
|
constructor({ chunkType: e, chunkId: t, message: n }) {
|
|
1311
1311
|
super({
|
|
1312
1312
|
name: ln,
|
|
@@ -1330,7 +1330,7 @@ function fn(e, t) {
|
|
|
1330
1330
|
}
|
|
1331
1331
|
return n;
|
|
1332
1332
|
}
|
|
1333
|
-
var
|
|
1333
|
+
var Y = {
|
|
1334
1334
|
array: f,
|
|
1335
1335
|
boolean: h,
|
|
1336
1336
|
custom: u,
|
|
@@ -1348,214 +1348,214 @@ var J = {
|
|
|
1348
1348
|
string: v,
|
|
1349
1349
|
union: r,
|
|
1350
1350
|
unknown: e
|
|
1351
|
-
},
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
])),
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
]), mn =
|
|
1364
|
-
type:
|
|
1365
|
-
text:
|
|
1366
|
-
providerOptions:
|
|
1367
|
-
}), gn =
|
|
1368
|
-
type:
|
|
1369
|
-
image:
|
|
1351
|
+
}, X = Y.lazy(() => Y.union([
|
|
1352
|
+
Y.null(),
|
|
1353
|
+
Y.string(),
|
|
1354
|
+
Y.number(),
|
|
1355
|
+
Y.boolean(),
|
|
1356
|
+
Y.record(Y.string(), X.optional()),
|
|
1357
|
+
Y.array(X)
|
|
1358
|
+
])), Z = Y.record(Y.string(), Y.record(Y.string(), X.optional())), pn = Y.union([
|
|
1359
|
+
Y.string(),
|
|
1360
|
+
Y.instanceof(Uint8Array),
|
|
1361
|
+
Y.instanceof(ArrayBuffer),
|
|
1362
|
+
Y.custom(He, { message: "Must be a Buffer" })
|
|
1363
|
+
]), mn = Y.record(Y.string(), Y.string()), hn = Y.object({
|
|
1364
|
+
type: Y.literal("text"),
|
|
1365
|
+
text: Y.string(),
|
|
1366
|
+
providerOptions: Z.optional()
|
|
1367
|
+
}), gn = Y.object({
|
|
1368
|
+
type: Y.literal("image"),
|
|
1369
|
+
image: Y.union([
|
|
1370
1370
|
pn,
|
|
1371
|
-
|
|
1371
|
+
Y.instanceof(URL),
|
|
1372
1372
|
mn
|
|
1373
1373
|
]),
|
|
1374
|
-
mediaType:
|
|
1375
|
-
providerOptions:
|
|
1376
|
-
}), _n =
|
|
1377
|
-
|
|
1378
|
-
type:
|
|
1374
|
+
mediaType: Y.string().optional(),
|
|
1375
|
+
providerOptions: Z.optional()
|
|
1376
|
+
}), _n = Y.discriminatedUnion("type", [
|
|
1377
|
+
Y.object({
|
|
1378
|
+
type: Y.literal("data"),
|
|
1379
1379
|
data: pn
|
|
1380
1380
|
}),
|
|
1381
|
-
|
|
1382
|
-
type:
|
|
1383
|
-
url:
|
|
1381
|
+
Y.object({
|
|
1382
|
+
type: Y.literal("url"),
|
|
1383
|
+
url: Y.instanceof(URL)
|
|
1384
1384
|
}),
|
|
1385
|
-
|
|
1386
|
-
type:
|
|
1385
|
+
Y.object({
|
|
1386
|
+
type: Y.literal("reference"),
|
|
1387
1387
|
reference: mn
|
|
1388
1388
|
}),
|
|
1389
|
-
|
|
1390
|
-
type:
|
|
1391
|
-
text:
|
|
1389
|
+
Y.object({
|
|
1390
|
+
type: Y.literal("text"),
|
|
1391
|
+
text: Y.string()
|
|
1392
1392
|
})
|
|
1393
|
-
]), vn =
|
|
1394
|
-
type:
|
|
1393
|
+
]), vn = Y.discriminatedUnion("type", [Y.object({
|
|
1394
|
+
type: Y.literal("data"),
|
|
1395
1395
|
data: pn
|
|
1396
|
-
}),
|
|
1397
|
-
type:
|
|
1398
|
-
url:
|
|
1399
|
-
})]), yn =
|
|
1400
|
-
type:
|
|
1401
|
-
data:
|
|
1396
|
+
}), Y.object({
|
|
1397
|
+
type: Y.literal("url"),
|
|
1398
|
+
url: Y.instanceof(URL)
|
|
1399
|
+
})]), yn = Y.object({
|
|
1400
|
+
type: Y.literal("file"),
|
|
1401
|
+
data: Y.union([
|
|
1402
1402
|
_n,
|
|
1403
1403
|
pn,
|
|
1404
|
-
|
|
1404
|
+
Y.instanceof(URL),
|
|
1405
1405
|
mn
|
|
1406
1406
|
]),
|
|
1407
|
-
filename:
|
|
1408
|
-
mediaType:
|
|
1409
|
-
providerOptions:
|
|
1410
|
-
}), bn =
|
|
1411
|
-
type:
|
|
1412
|
-
text:
|
|
1413
|
-
providerOptions:
|
|
1414
|
-
}), xn =
|
|
1415
|
-
type:
|
|
1416
|
-
kind:
|
|
1417
|
-
providerOptions:
|
|
1418
|
-
}), Sn =
|
|
1419
|
-
type:
|
|
1420
|
-
data:
|
|
1407
|
+
filename: Y.string().optional(),
|
|
1408
|
+
mediaType: Y.string(),
|
|
1409
|
+
providerOptions: Z.optional()
|
|
1410
|
+
}), bn = Y.object({
|
|
1411
|
+
type: Y.literal("reasoning"),
|
|
1412
|
+
text: Y.string(),
|
|
1413
|
+
providerOptions: Z.optional()
|
|
1414
|
+
}), xn = Y.object({
|
|
1415
|
+
type: Y.literal("custom"),
|
|
1416
|
+
kind: Y.string().transform((e) => e),
|
|
1417
|
+
providerOptions: Z.optional()
|
|
1418
|
+
}), Sn = Y.object({
|
|
1419
|
+
type: Y.literal("reasoning-file"),
|
|
1420
|
+
data: Y.union([
|
|
1421
1421
|
vn,
|
|
1422
1422
|
pn,
|
|
1423
|
-
|
|
1423
|
+
Y.instanceof(URL)
|
|
1424
1424
|
]),
|
|
1425
|
-
mediaType:
|
|
1426
|
-
providerOptions:
|
|
1427
|
-
}), Cn =
|
|
1428
|
-
type:
|
|
1429
|
-
toolCallId:
|
|
1430
|
-
toolName:
|
|
1431
|
-
input:
|
|
1432
|
-
providerOptions:
|
|
1433
|
-
providerExecuted:
|
|
1434
|
-
}), wn =
|
|
1435
|
-
|
|
1436
|
-
type:
|
|
1437
|
-
value:
|
|
1438
|
-
providerOptions:
|
|
1425
|
+
mediaType: Y.string(),
|
|
1426
|
+
providerOptions: Z.optional()
|
|
1427
|
+
}), Cn = Y.object({
|
|
1428
|
+
type: Y.literal("tool-call"),
|
|
1429
|
+
toolCallId: Y.string(),
|
|
1430
|
+
toolName: Y.string(),
|
|
1431
|
+
input: Y.unknown(),
|
|
1432
|
+
providerOptions: Z.optional(),
|
|
1433
|
+
providerExecuted: Y.boolean().optional()
|
|
1434
|
+
}), wn = Y.discriminatedUnion("type", [
|
|
1435
|
+
Y.object({
|
|
1436
|
+
type: Y.literal("text"),
|
|
1437
|
+
value: Y.string(),
|
|
1438
|
+
providerOptions: Z.optional()
|
|
1439
1439
|
}),
|
|
1440
|
-
|
|
1441
|
-
type:
|
|
1442
|
-
value:
|
|
1443
|
-
providerOptions:
|
|
1440
|
+
Y.object({
|
|
1441
|
+
type: Y.literal("json"),
|
|
1442
|
+
value: X,
|
|
1443
|
+
providerOptions: Z.optional()
|
|
1444
1444
|
}),
|
|
1445
|
-
|
|
1446
|
-
type:
|
|
1447
|
-
reason:
|
|
1448
|
-
providerOptions:
|
|
1445
|
+
Y.object({
|
|
1446
|
+
type: Y.literal("execution-denied"),
|
|
1447
|
+
reason: Y.string().optional(),
|
|
1448
|
+
providerOptions: Z.optional()
|
|
1449
1449
|
}),
|
|
1450
|
-
|
|
1451
|
-
type:
|
|
1452
|
-
value:
|
|
1453
|
-
providerOptions:
|
|
1450
|
+
Y.object({
|
|
1451
|
+
type: Y.literal("error-text"),
|
|
1452
|
+
value: Y.string(),
|
|
1453
|
+
providerOptions: Z.optional()
|
|
1454
1454
|
}),
|
|
1455
|
-
|
|
1456
|
-
type:
|
|
1457
|
-
value:
|
|
1458
|
-
providerOptions:
|
|
1455
|
+
Y.object({
|
|
1456
|
+
type: Y.literal("error-json"),
|
|
1457
|
+
value: X,
|
|
1458
|
+
providerOptions: Z.optional()
|
|
1459
1459
|
}),
|
|
1460
|
-
|
|
1461
|
-
type:
|
|
1462
|
-
value:
|
|
1463
|
-
|
|
1464
|
-
type:
|
|
1465
|
-
text:
|
|
1466
|
-
providerOptions:
|
|
1460
|
+
Y.object({
|
|
1461
|
+
type: Y.literal("content"),
|
|
1462
|
+
value: Y.array(Y.union([
|
|
1463
|
+
Y.object({
|
|
1464
|
+
type: Y.literal("text"),
|
|
1465
|
+
text: Y.string(),
|
|
1466
|
+
providerOptions: Z.optional()
|
|
1467
1467
|
}),
|
|
1468
|
-
|
|
1469
|
-
type:
|
|
1468
|
+
Y.object({
|
|
1469
|
+
type: Y.literal("file"),
|
|
1470
1470
|
data: _n,
|
|
1471
|
-
mediaType:
|
|
1472
|
-
filename:
|
|
1473
|
-
providerOptions:
|
|
1471
|
+
mediaType: Y.string(),
|
|
1472
|
+
filename: Y.string().optional(),
|
|
1473
|
+
providerOptions: Z.optional()
|
|
1474
1474
|
}),
|
|
1475
|
-
|
|
1476
|
-
type:
|
|
1477
|
-
data:
|
|
1478
|
-
mediaType:
|
|
1479
|
-
filename:
|
|
1480
|
-
providerOptions:
|
|
1475
|
+
Y.object({
|
|
1476
|
+
type: Y.literal("file-data"),
|
|
1477
|
+
data: Y.string(),
|
|
1478
|
+
mediaType: Y.string(),
|
|
1479
|
+
filename: Y.string().optional(),
|
|
1480
|
+
providerOptions: Z.optional()
|
|
1481
1481
|
}),
|
|
1482
|
-
|
|
1483
|
-
type:
|
|
1484
|
-
url:
|
|
1485
|
-
mediaType:
|
|
1486
|
-
providerOptions:
|
|
1482
|
+
Y.object({
|
|
1483
|
+
type: Y.literal("file-url"),
|
|
1484
|
+
url: Y.string(),
|
|
1485
|
+
mediaType: Y.string().optional(),
|
|
1486
|
+
providerOptions: Z.optional()
|
|
1487
1487
|
}),
|
|
1488
|
-
|
|
1489
|
-
type:
|
|
1490
|
-
fileId:
|
|
1491
|
-
providerOptions:
|
|
1488
|
+
Y.object({
|
|
1489
|
+
type: Y.literal("file-id"),
|
|
1490
|
+
fileId: Y.union([Y.string(), Y.record(Y.string(), Y.string())]),
|
|
1491
|
+
providerOptions: Z.optional()
|
|
1492
1492
|
}),
|
|
1493
|
-
|
|
1494
|
-
type:
|
|
1495
|
-
providerReference:
|
|
1496
|
-
providerOptions:
|
|
1493
|
+
Y.object({
|
|
1494
|
+
type: Y.literal("file-reference"),
|
|
1495
|
+
providerReference: Y.record(Y.string(), Y.string()),
|
|
1496
|
+
providerOptions: Z.optional()
|
|
1497
1497
|
}),
|
|
1498
|
-
|
|
1499
|
-
type:
|
|
1500
|
-
data:
|
|
1501
|
-
mediaType:
|
|
1502
|
-
providerOptions:
|
|
1498
|
+
Y.object({
|
|
1499
|
+
type: Y.literal("image-data"),
|
|
1500
|
+
data: Y.string(),
|
|
1501
|
+
mediaType: Y.string(),
|
|
1502
|
+
providerOptions: Z.optional()
|
|
1503
1503
|
}),
|
|
1504
|
-
|
|
1505
|
-
type:
|
|
1506
|
-
url:
|
|
1507
|
-
providerOptions:
|
|
1504
|
+
Y.object({
|
|
1505
|
+
type: Y.literal("image-url"),
|
|
1506
|
+
url: Y.string(),
|
|
1507
|
+
providerOptions: Z.optional()
|
|
1508
1508
|
}),
|
|
1509
|
-
|
|
1510
|
-
type:
|
|
1511
|
-
fileId:
|
|
1512
|
-
providerOptions:
|
|
1509
|
+
Y.object({
|
|
1510
|
+
type: Y.literal("image-file-id"),
|
|
1511
|
+
fileId: Y.union([Y.string(), Y.record(Y.string(), Y.string())]),
|
|
1512
|
+
providerOptions: Z.optional()
|
|
1513
1513
|
}),
|
|
1514
|
-
|
|
1515
|
-
type:
|
|
1516
|
-
providerReference:
|
|
1517
|
-
providerOptions:
|
|
1514
|
+
Y.object({
|
|
1515
|
+
type: Y.literal("image-file-reference"),
|
|
1516
|
+
providerReference: Y.record(Y.string(), Y.string()),
|
|
1517
|
+
providerOptions: Z.optional()
|
|
1518
1518
|
}),
|
|
1519
|
-
|
|
1520
|
-
type:
|
|
1521
|
-
providerOptions:
|
|
1519
|
+
Y.object({
|
|
1520
|
+
type: Y.literal("custom"),
|
|
1521
|
+
providerOptions: Z.optional()
|
|
1522
1522
|
})
|
|
1523
1523
|
]))
|
|
1524
1524
|
})
|
|
1525
|
-
]), Tn =
|
|
1526
|
-
type:
|
|
1527
|
-
toolCallId:
|
|
1528
|
-
toolName:
|
|
1525
|
+
]), Tn = Y.object({
|
|
1526
|
+
type: Y.literal("tool-result"),
|
|
1527
|
+
toolCallId: Y.string(),
|
|
1528
|
+
toolName: Y.string(),
|
|
1529
1529
|
output: wn,
|
|
1530
|
-
providerOptions:
|
|
1531
|
-
}), En =
|
|
1532
|
-
type:
|
|
1533
|
-
approvalId:
|
|
1534
|
-
toolCallId:
|
|
1535
|
-
reason:
|
|
1536
|
-
isAutomatic:
|
|
1537
|
-
signature:
|
|
1538
|
-
inputSchemaInput:
|
|
1539
|
-
}), Dn =
|
|
1540
|
-
type:
|
|
1541
|
-
approvalId:
|
|
1542
|
-
approved:
|
|
1543
|
-
reason:
|
|
1544
|
-
}), On =
|
|
1545
|
-
role:
|
|
1546
|
-
content:
|
|
1547
|
-
providerOptions:
|
|
1548
|
-
}), kn =
|
|
1549
|
-
role:
|
|
1550
|
-
content:
|
|
1530
|
+
providerOptions: Z.optional()
|
|
1531
|
+
}), En = Y.object({
|
|
1532
|
+
type: Y.literal("tool-approval-request"),
|
|
1533
|
+
approvalId: Y.string(),
|
|
1534
|
+
toolCallId: Y.string(),
|
|
1535
|
+
reason: Y.string().optional(),
|
|
1536
|
+
isAutomatic: Y.boolean().optional(),
|
|
1537
|
+
signature: Y.string().optional(),
|
|
1538
|
+
inputSchemaInput: Y.unknown().optional()
|
|
1539
|
+
}), Dn = Y.object({
|
|
1540
|
+
type: Y.literal("tool-approval-response"),
|
|
1541
|
+
approvalId: Y.string(),
|
|
1542
|
+
approved: Y.boolean(),
|
|
1543
|
+
reason: Y.string().optional()
|
|
1544
|
+
}), On = Y.object({
|
|
1545
|
+
role: Y.literal("system"),
|
|
1546
|
+
content: Y.string(),
|
|
1547
|
+
providerOptions: Z.optional()
|
|
1548
|
+
}), kn = Y.object({
|
|
1549
|
+
role: Y.literal("user"),
|
|
1550
|
+
content: Y.union([Y.string(), Y.array(Y.union([
|
|
1551
1551
|
hn,
|
|
1552
1552
|
gn,
|
|
1553
1553
|
yn
|
|
1554
1554
|
]))]),
|
|
1555
|
-
providerOptions:
|
|
1556
|
-
}), An =
|
|
1557
|
-
role:
|
|
1558
|
-
content:
|
|
1555
|
+
providerOptions: Z.optional()
|
|
1556
|
+
}), An = Y.object({
|
|
1557
|
+
role: Y.literal("assistant"),
|
|
1558
|
+
content: Y.union([Y.string(), Y.array(Y.union([
|
|
1559
1559
|
hn,
|
|
1560
1560
|
xn,
|
|
1561
1561
|
yn,
|
|
@@ -1565,13 +1565,13 @@ var J = {
|
|
|
1565
1565
|
Tn,
|
|
1566
1566
|
En
|
|
1567
1567
|
]))]),
|
|
1568
|
-
providerOptions:
|
|
1569
|
-
}), jn =
|
|
1570
|
-
role:
|
|
1571
|
-
content:
|
|
1572
|
-
providerOptions:
|
|
1568
|
+
providerOptions: Z.optional()
|
|
1569
|
+
}), jn = Y.object({
|
|
1570
|
+
role: Y.literal("tool"),
|
|
1571
|
+
content: Y.array(Y.union([Tn, Dn])),
|
|
1572
|
+
providerOptions: Z.optional()
|
|
1573
1573
|
});
|
|
1574
|
-
|
|
1574
|
+
Y.union([
|
|
1575
1575
|
On,
|
|
1576
1576
|
kn,
|
|
1577
1577
|
An,
|
|
@@ -1776,178 +1776,178 @@ async function Nn(e) {
|
|
|
1776
1776
|
state: "failed-parse"
|
|
1777
1777
|
});
|
|
1778
1778
|
}
|
|
1779
|
-
new TextEncoder(), new TextEncoder(),
|
|
1779
|
+
new TextEncoder(), new TextEncoder(), R({
|
|
1780
1780
|
prefix: "aitxt",
|
|
1781
1781
|
size: 24
|
|
1782
|
-
}),
|
|
1782
|
+
}), R({
|
|
1783
1783
|
prefix: "call",
|
|
1784
1784
|
size: 24
|
|
1785
1785
|
}), TransformStream;
|
|
1786
|
-
var Pn =
|
|
1787
|
-
|
|
1788
|
-
type:
|
|
1789
|
-
id:
|
|
1790
|
-
providerMetadata:
|
|
1786
|
+
var Pn = Y.record(Y.string(), X.optional()), Fn = Wt(() => $t(Y.union([
|
|
1787
|
+
Y.looseObject({
|
|
1788
|
+
type: Y.literal("text-start"),
|
|
1789
|
+
id: Y.string(),
|
|
1790
|
+
providerMetadata: Z.optional()
|
|
1791
1791
|
}),
|
|
1792
|
-
|
|
1793
|
-
type:
|
|
1794
|
-
id:
|
|
1795
|
-
delta:
|
|
1796
|
-
providerMetadata:
|
|
1792
|
+
Y.looseObject({
|
|
1793
|
+
type: Y.literal("text-delta"),
|
|
1794
|
+
id: Y.string(),
|
|
1795
|
+
delta: Y.string(),
|
|
1796
|
+
providerMetadata: Z.optional()
|
|
1797
1797
|
}),
|
|
1798
|
-
|
|
1799
|
-
type:
|
|
1800
|
-
id:
|
|
1801
|
-
providerMetadata:
|
|
1798
|
+
Y.looseObject({
|
|
1799
|
+
type: Y.literal("text-end"),
|
|
1800
|
+
id: Y.string(),
|
|
1801
|
+
providerMetadata: Z.optional()
|
|
1802
1802
|
}),
|
|
1803
|
-
|
|
1804
|
-
type:
|
|
1805
|
-
errorText:
|
|
1803
|
+
Y.looseObject({
|
|
1804
|
+
type: Y.literal("error"),
|
|
1805
|
+
errorText: Y.string()
|
|
1806
1806
|
}),
|
|
1807
|
-
|
|
1808
|
-
type:
|
|
1809
|
-
toolCallId:
|
|
1810
|
-
toolName:
|
|
1811
|
-
providerExecuted:
|
|
1812
|
-
providerMetadata:
|
|
1807
|
+
Y.looseObject({
|
|
1808
|
+
type: Y.literal("tool-input-start"),
|
|
1809
|
+
toolCallId: Y.string(),
|
|
1810
|
+
toolName: Y.string(),
|
|
1811
|
+
providerExecuted: Y.boolean().optional(),
|
|
1812
|
+
providerMetadata: Z.optional(),
|
|
1813
1813
|
toolMetadata: Pn.optional(),
|
|
1814
|
-
dynamic:
|
|
1815
|
-
title:
|
|
1814
|
+
dynamic: Y.boolean().optional(),
|
|
1815
|
+
title: Y.string().optional()
|
|
1816
1816
|
}),
|
|
1817
|
-
|
|
1818
|
-
type:
|
|
1819
|
-
toolCallId:
|
|
1820
|
-
inputTextDelta:
|
|
1817
|
+
Y.looseObject({
|
|
1818
|
+
type: Y.literal("tool-input-delta"),
|
|
1819
|
+
toolCallId: Y.string(),
|
|
1820
|
+
inputTextDelta: Y.string()
|
|
1821
1821
|
}),
|
|
1822
|
-
|
|
1823
|
-
type:
|
|
1824
|
-
toolCallId:
|
|
1825
|
-
toolName:
|
|
1826
|
-
input:
|
|
1827
|
-
providerExecuted:
|
|
1828
|
-
providerMetadata:
|
|
1822
|
+
Y.looseObject({
|
|
1823
|
+
type: Y.literal("tool-input-available"),
|
|
1824
|
+
toolCallId: Y.string(),
|
|
1825
|
+
toolName: Y.string(),
|
|
1826
|
+
input: Y.unknown(),
|
|
1827
|
+
providerExecuted: Y.boolean().optional(),
|
|
1828
|
+
providerMetadata: Z.optional(),
|
|
1829
1829
|
toolMetadata: Pn.optional(),
|
|
1830
|
-
dynamic:
|
|
1831
|
-
title:
|
|
1830
|
+
dynamic: Y.boolean().optional(),
|
|
1831
|
+
title: Y.string().optional()
|
|
1832
1832
|
}),
|
|
1833
|
-
|
|
1834
|
-
type:
|
|
1835
|
-
toolCallId:
|
|
1836
|
-
toolName:
|
|
1837
|
-
input:
|
|
1838
|
-
providerExecuted:
|
|
1839
|
-
providerMetadata:
|
|
1833
|
+
Y.looseObject({
|
|
1834
|
+
type: Y.literal("tool-input-error"),
|
|
1835
|
+
toolCallId: Y.string(),
|
|
1836
|
+
toolName: Y.string(),
|
|
1837
|
+
input: Y.unknown(),
|
|
1838
|
+
providerExecuted: Y.boolean().optional(),
|
|
1839
|
+
providerMetadata: Z.optional(),
|
|
1840
1840
|
toolMetadata: Pn.optional(),
|
|
1841
|
-
dynamic:
|
|
1842
|
-
errorText:
|
|
1843
|
-
title:
|
|
1841
|
+
dynamic: Y.boolean().optional(),
|
|
1842
|
+
errorText: Y.string(),
|
|
1843
|
+
title: Y.string().optional()
|
|
1844
1844
|
}),
|
|
1845
|
-
|
|
1846
|
-
type:
|
|
1847
|
-
approvalId:
|
|
1848
|
-
toolCallId:
|
|
1849
|
-
approvalDescriptor:
|
|
1850
|
-
inputSchemaInput:
|
|
1851
|
-
reason:
|
|
1852
|
-
isAutomatic:
|
|
1853
|
-
signature:
|
|
1845
|
+
Y.looseObject({
|
|
1846
|
+
type: Y.literal("tool-approval-request"),
|
|
1847
|
+
approvalId: Y.string(),
|
|
1848
|
+
toolCallId: Y.string(),
|
|
1849
|
+
approvalDescriptor: Y.unknown().optional(),
|
|
1850
|
+
inputSchemaInput: Y.unknown().optional(),
|
|
1851
|
+
reason: Y.string().optional(),
|
|
1852
|
+
isAutomatic: Y.boolean().optional(),
|
|
1853
|
+
signature: Y.string().optional()
|
|
1854
1854
|
}),
|
|
1855
|
-
|
|
1856
|
-
type:
|
|
1857
|
-
approvalId:
|
|
1858
|
-
approved:
|
|
1859
|
-
reason:
|
|
1860
|
-
providerExecuted:
|
|
1861
|
-
providerMetadata:
|
|
1855
|
+
Y.looseObject({
|
|
1856
|
+
type: Y.literal("tool-approval-response"),
|
|
1857
|
+
approvalId: Y.string(),
|
|
1858
|
+
approved: Y.boolean(),
|
|
1859
|
+
reason: Y.string().optional(),
|
|
1860
|
+
providerExecuted: Y.boolean().optional(),
|
|
1861
|
+
providerMetadata: Z.optional()
|
|
1862
1862
|
}),
|
|
1863
|
-
|
|
1864
|
-
type:
|
|
1865
|
-
toolCallId:
|
|
1866
|
-
output:
|
|
1867
|
-
providerExecuted:
|
|
1868
|
-
providerMetadata:
|
|
1863
|
+
Y.looseObject({
|
|
1864
|
+
type: Y.literal("tool-output-available"),
|
|
1865
|
+
toolCallId: Y.string(),
|
|
1866
|
+
output: Y.unknown(),
|
|
1867
|
+
providerExecuted: Y.boolean().optional(),
|
|
1868
|
+
providerMetadata: Z.optional(),
|
|
1869
1869
|
toolMetadata: Pn.optional(),
|
|
1870
|
-
dynamic:
|
|
1871
|
-
preliminary:
|
|
1870
|
+
dynamic: Y.boolean().optional(),
|
|
1871
|
+
preliminary: Y.boolean().optional()
|
|
1872
1872
|
}),
|
|
1873
|
-
|
|
1874
|
-
type:
|
|
1875
|
-
toolCallId:
|
|
1876
|
-
errorText:
|
|
1877
|
-
providerExecuted:
|
|
1878
|
-
providerMetadata:
|
|
1873
|
+
Y.looseObject({
|
|
1874
|
+
type: Y.literal("tool-output-error"),
|
|
1875
|
+
toolCallId: Y.string(),
|
|
1876
|
+
errorText: Y.string(),
|
|
1877
|
+
providerExecuted: Y.boolean().optional(),
|
|
1878
|
+
providerMetadata: Z.optional(),
|
|
1879
1879
|
toolMetadata: Pn.optional(),
|
|
1880
|
-
dynamic:
|
|
1880
|
+
dynamic: Y.boolean().optional()
|
|
1881
1881
|
}),
|
|
1882
|
-
|
|
1883
|
-
type:
|
|
1884
|
-
toolCallId:
|
|
1882
|
+
Y.looseObject({
|
|
1883
|
+
type: Y.literal("tool-output-denied"),
|
|
1884
|
+
toolCallId: Y.string()
|
|
1885
1885
|
}),
|
|
1886
|
-
|
|
1887
|
-
type:
|
|
1888
|
-
id:
|
|
1889
|
-
providerMetadata:
|
|
1886
|
+
Y.looseObject({
|
|
1887
|
+
type: Y.literal("reasoning-start"),
|
|
1888
|
+
id: Y.string(),
|
|
1889
|
+
providerMetadata: Z.optional()
|
|
1890
1890
|
}),
|
|
1891
|
-
|
|
1892
|
-
type:
|
|
1893
|
-
id:
|
|
1894
|
-
delta:
|
|
1895
|
-
providerMetadata:
|
|
1891
|
+
Y.looseObject({
|
|
1892
|
+
type: Y.literal("reasoning-delta"),
|
|
1893
|
+
id: Y.string(),
|
|
1894
|
+
delta: Y.string(),
|
|
1895
|
+
providerMetadata: Z.optional()
|
|
1896
1896
|
}),
|
|
1897
|
-
|
|
1898
|
-
type:
|
|
1899
|
-
id:
|
|
1900
|
-
providerMetadata:
|
|
1897
|
+
Y.looseObject({
|
|
1898
|
+
type: Y.literal("reasoning-end"),
|
|
1899
|
+
id: Y.string(),
|
|
1900
|
+
providerMetadata: Z.optional()
|
|
1901
1901
|
}),
|
|
1902
|
-
|
|
1903
|
-
type:
|
|
1904
|
-
kind:
|
|
1905
|
-
providerMetadata:
|
|
1902
|
+
Y.looseObject({
|
|
1903
|
+
type: Y.literal("custom"),
|
|
1904
|
+
kind: Y.string().transform((e) => e),
|
|
1905
|
+
providerMetadata: Z.optional()
|
|
1906
1906
|
}),
|
|
1907
|
-
|
|
1908
|
-
type:
|
|
1909
|
-
sourceId:
|
|
1910
|
-
url:
|
|
1911
|
-
title:
|
|
1912
|
-
providerMetadata:
|
|
1907
|
+
Y.looseObject({
|
|
1908
|
+
type: Y.literal("source-url"),
|
|
1909
|
+
sourceId: Y.string(),
|
|
1910
|
+
url: Y.string(),
|
|
1911
|
+
title: Y.string().optional(),
|
|
1912
|
+
providerMetadata: Z.optional()
|
|
1913
1913
|
}),
|
|
1914
|
-
|
|
1915
|
-
type:
|
|
1916
|
-
sourceId:
|
|
1917
|
-
mediaType:
|
|
1918
|
-
title:
|
|
1919
|
-
filename:
|
|
1920
|
-
providerMetadata:
|
|
1914
|
+
Y.looseObject({
|
|
1915
|
+
type: Y.literal("source-document"),
|
|
1916
|
+
sourceId: Y.string(),
|
|
1917
|
+
mediaType: Y.string(),
|
|
1918
|
+
title: Y.string(),
|
|
1919
|
+
filename: Y.string().optional(),
|
|
1920
|
+
providerMetadata: Z.optional()
|
|
1921
1921
|
}),
|
|
1922
|
-
|
|
1923
|
-
type:
|
|
1924
|
-
url:
|
|
1925
|
-
mediaType:
|
|
1926
|
-
providerMetadata:
|
|
1922
|
+
Y.looseObject({
|
|
1923
|
+
type: Y.literal("file"),
|
|
1924
|
+
url: Y.string(),
|
|
1925
|
+
mediaType: Y.string(),
|
|
1926
|
+
providerMetadata: Z.optional()
|
|
1927
1927
|
}),
|
|
1928
|
-
|
|
1929
|
-
type:
|
|
1930
|
-
url:
|
|
1931
|
-
mediaType:
|
|
1932
|
-
providerMetadata:
|
|
1928
|
+
Y.looseObject({
|
|
1929
|
+
type: Y.literal("reasoning-file"),
|
|
1930
|
+
url: Y.string(),
|
|
1931
|
+
mediaType: Y.string(),
|
|
1932
|
+
providerMetadata: Z.optional()
|
|
1933
1933
|
}),
|
|
1934
|
-
|
|
1935
|
-
type:
|
|
1936
|
-
id:
|
|
1937
|
-
data:
|
|
1938
|
-
transient:
|
|
1934
|
+
Y.looseObject({
|
|
1935
|
+
type: Y.custom((e) => typeof e == "string" && e.startsWith("data-"), { message: "Type must start with \"data-\"" }),
|
|
1936
|
+
id: Y.string().optional(),
|
|
1937
|
+
data: Y.unknown(),
|
|
1938
|
+
transient: Y.boolean().optional()
|
|
1939
1939
|
}),
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
type:
|
|
1945
|
-
messageId:
|
|
1946
|
-
messageMetadata:
|
|
1940
|
+
Y.looseObject({ type: Y.literal("start-step") }),
|
|
1941
|
+
Y.looseObject({ type: Y.literal("finish-step") }),
|
|
1942
|
+
Y.looseObject({ type: Y.literal("reset-step") }),
|
|
1943
|
+
Y.looseObject({
|
|
1944
|
+
type: Y.literal("start"),
|
|
1945
|
+
messageId: Y.string().optional(),
|
|
1946
|
+
messageMetadata: Y.unknown().optional()
|
|
1947
1947
|
}),
|
|
1948
|
-
|
|
1949
|
-
type:
|
|
1950
|
-
finishReason:
|
|
1948
|
+
Y.looseObject({
|
|
1949
|
+
type: Y.literal("finish"),
|
|
1950
|
+
finishReason: Y.enum([
|
|
1951
1951
|
"stop",
|
|
1952
1952
|
"length",
|
|
1953
1953
|
"content-filter",
|
|
@@ -1955,15 +1955,15 @@ var Pn = J.record(J.string(), Y.optional()), Fn = Wt(() => $t(J.union([
|
|
|
1955
1955
|
"error",
|
|
1956
1956
|
"other"
|
|
1957
1957
|
]).optional(),
|
|
1958
|
-
messageMetadata:
|
|
1958
|
+
messageMetadata: Y.unknown().optional()
|
|
1959
1959
|
}),
|
|
1960
|
-
|
|
1961
|
-
type:
|
|
1962
|
-
reason:
|
|
1960
|
+
Y.looseObject({
|
|
1961
|
+
type: Y.literal("abort"),
|
|
1962
|
+
reason: Y.string().optional()
|
|
1963
1963
|
}),
|
|
1964
|
-
|
|
1965
|
-
type:
|
|
1966
|
-
messageMetadata:
|
|
1964
|
+
Y.looseObject({
|
|
1965
|
+
type: Y.literal("message-metadata"),
|
|
1966
|
+
messageMetadata: Y.unknown()
|
|
1967
1967
|
})
|
|
1968
1968
|
])));
|
|
1969
1969
|
function In(e) {
|
|
@@ -1978,7 +1978,7 @@ function Rn(e) {
|
|
|
1978
1978
|
function zn(e) {
|
|
1979
1979
|
return e.type === "dynamic-tool";
|
|
1980
1980
|
}
|
|
1981
|
-
function
|
|
1981
|
+
function Q(e) {
|
|
1982
1982
|
return Rn(e) || zn(e);
|
|
1983
1983
|
}
|
|
1984
1984
|
function Bn(e) {
|
|
@@ -1992,7 +1992,7 @@ function Vn({ lastMessage: e, messageId: t }) {
|
|
|
1992
1992
|
parts: []
|
|
1993
1993
|
}, r = Ln(), i = n.parts.findLastIndex((e) => e.type === "step-start"), a = 0;
|
|
1994
1994
|
for (let e of n.parts.slice(i + 1)) {
|
|
1995
|
-
if (!
|
|
1995
|
+
if (!Q(e)) continue;
|
|
1996
1996
|
let t = a;
|
|
1997
1997
|
Rn(e) && a++, e.state === "input-streaming" && (r[e.toolCallId] = {
|
|
1998
1998
|
text: e.rawInput ?? "",
|
|
@@ -2019,7 +2019,7 @@ function Hn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2019
2019
|
return e.slice(t + 1);
|
|
2020
2020
|
}
|
|
2021
2021
|
function f() {
|
|
2022
|
-
return d().filter(
|
|
2022
|
+
return d().filter(Q);
|
|
2023
2023
|
}
|
|
2024
2024
|
function p(e) {
|
|
2025
2025
|
let t = f().find((t) => t.toolCallId === e);
|
|
@@ -2027,13 +2027,13 @@ function Hn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2027
2027
|
let n = r.message.parts;
|
|
2028
2028
|
for (let r = n.length - 1; r >= 0; r--) {
|
|
2029
2029
|
let i = n[r];
|
|
2030
|
-
if (
|
|
2030
|
+
if (Q(i) && i.toolCallId === e) {
|
|
2031
2031
|
t = i;
|
|
2032
2032
|
break;
|
|
2033
2033
|
}
|
|
2034
2034
|
}
|
|
2035
2035
|
}
|
|
2036
|
-
if (t == null) throw new
|
|
2036
|
+
if (t == null) throw new J({
|
|
2037
2037
|
chunkType: "tool-invocation",
|
|
2038
2038
|
chunkId: e,
|
|
2039
2039
|
message: `No tool invocation found for tool call ID "${e}".`
|
|
@@ -2041,8 +2041,8 @@ function Hn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2041
2041
|
return t;
|
|
2042
2042
|
}
|
|
2043
2043
|
function m(e) {
|
|
2044
|
-
let t = r.message.parts.filter(
|
|
2045
|
-
if (t == null) throw new
|
|
2044
|
+
let t = r.message.parts.filter(Q).find((t) => t.approval?.id === e);
|
|
2045
|
+
if (t == null) throw new J({
|
|
2046
2046
|
chunkType: "tool-approval-response",
|
|
2047
2047
|
chunkId: e,
|
|
2048
2048
|
message: `No tool invocation found for approval ID "${e}".`
|
|
@@ -2129,7 +2129,7 @@ function Hn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2129
2129
|
}
|
|
2130
2130
|
case "text-delta": {
|
|
2131
2131
|
let t = r.activeTextParts[e.id];
|
|
2132
|
-
if (t == null) throw new
|
|
2132
|
+
if (t == null) throw new J({
|
|
2133
2133
|
chunkType: "text-delta",
|
|
2134
2134
|
chunkId: e.id,
|
|
2135
2135
|
message: `Received text-delta for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`
|
|
@@ -2139,7 +2139,7 @@ function Hn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2139
2139
|
}
|
|
2140
2140
|
case "text-end": {
|
|
2141
2141
|
let t = r.activeTextParts[e.id];
|
|
2142
|
-
if (t == null) throw new
|
|
2142
|
+
if (t == null) throw new J({
|
|
2143
2143
|
chunkType: "text-end",
|
|
2144
2144
|
chunkId: e.id,
|
|
2145
2145
|
message: `Received text-end for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`
|
|
@@ -2169,7 +2169,7 @@ function Hn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2169
2169
|
}
|
|
2170
2170
|
case "reasoning-delta": {
|
|
2171
2171
|
let t = r.activeReasoningParts[e.id];
|
|
2172
|
-
if (t == null) throw new
|
|
2172
|
+
if (t == null) throw new J({
|
|
2173
2173
|
chunkType: "reasoning-delta",
|
|
2174
2174
|
chunkId: e.id,
|
|
2175
2175
|
message: `Received reasoning-delta for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`
|
|
@@ -2179,7 +2179,7 @@ function Hn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2179
2179
|
}
|
|
2180
2180
|
case "reasoning-end": {
|
|
2181
2181
|
let t = r.activeReasoningParts[e.id];
|
|
2182
|
-
if (t == null) throw new
|
|
2182
|
+
if (t == null) throw new J({
|
|
2183
2183
|
chunkType: "reasoning-end",
|
|
2184
2184
|
chunkId: e.id,
|
|
2185
2185
|
message: `Received reasoning-end for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`
|
|
@@ -2247,7 +2247,7 @@ function Hn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2247
2247
|
}
|
|
2248
2248
|
case "tool-input-delta": {
|
|
2249
2249
|
let t = r.partialToolCalls[e.toolCallId];
|
|
2250
|
-
if (t == null) throw new
|
|
2250
|
+
if (t == null) throw new J({
|
|
2251
2251
|
chunkType: "tool-input-delta",
|
|
2252
2252
|
chunkId: e.toolCallId,
|
|
2253
2253
|
message: `Received tool-input-delta for missing tool call with ID "${e.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`
|
|
@@ -2295,7 +2295,7 @@ function Hn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2295
2295
|
}), u(), a && !e.providerExecuted && await a({ toolCall: e });
|
|
2296
2296
|
break;
|
|
2297
2297
|
case "tool-input-error": {
|
|
2298
|
-
let t = d().filter(
|
|
2298
|
+
let t = d().filter(Q).find((t) => t.toolCallId === e.toolCallId);
|
|
2299
2299
|
(t == null ? e.dynamic : t.type === "dynamic-tool") ? g({
|
|
2300
2300
|
toolCallId: e.toolCallId,
|
|
2301
2301
|
toolName: e.toolName,
|
|
@@ -2473,28 +2473,28 @@ function Wn() {
|
|
|
2473
2473
|
reject: t
|
|
2474
2474
|
};
|
|
2475
2475
|
}
|
|
2476
|
-
|
|
2476
|
+
R({
|
|
2477
2477
|
prefix: "aitxt",
|
|
2478
2478
|
size: 24
|
|
2479
|
-
}),
|
|
2479
|
+
}), R({
|
|
2480
2480
|
prefix: "call",
|
|
2481
2481
|
size: 24
|
|
2482
|
-
}),
|
|
2482
|
+
}), R({
|
|
2483
2483
|
prefix: "aitxt",
|
|
2484
2484
|
size: 24
|
|
2485
|
-
}),
|
|
2485
|
+
}), R({
|
|
2486
2486
|
prefix: "call",
|
|
2487
2487
|
size: 24
|
|
2488
|
-
}),
|
|
2488
|
+
}), Y.record(Y.string(), X.optional()), Y.record(Y.string(), Y.string()), R({
|
|
2489
2489
|
prefix: "call",
|
|
2490
2490
|
size: 24
|
|
2491
|
-
}),
|
|
2491
|
+
}), R({
|
|
2492
2492
|
prefix: "call",
|
|
2493
2493
|
size: 24
|
|
2494
|
-
}), new TextEncoder(),
|
|
2494
|
+
}), new TextEncoder(), R({
|
|
2495
2495
|
prefix: "call",
|
|
2496
2496
|
size: 24
|
|
2497
|
-
}),
|
|
2497
|
+
}), R({
|
|
2498
2498
|
prefix: "aiobj",
|
|
2499
2499
|
size: 24
|
|
2500
2500
|
});
|
|
@@ -2530,15 +2530,15 @@ var { atob: Gn } = globalThis, Kn = class {
|
|
|
2530
2530
|
});
|
|
2531
2531
|
}
|
|
2532
2532
|
};
|
|
2533
|
-
|
|
2533
|
+
R({
|
|
2534
2534
|
prefix: "aiobj",
|
|
2535
2535
|
size: 24
|
|
2536
|
-
}),
|
|
2536
|
+
}), R({
|
|
2537
2537
|
prefix: "call",
|
|
2538
2538
|
size: 24
|
|
2539
|
-
}),
|
|
2540
|
-
token:
|
|
2541
|
-
url:
|
|
2539
|
+
}), Y.object({
|
|
2540
|
+
token: Y.string().refine((e) => e.trim().length > 0),
|
|
2541
|
+
url: Y.string().refine((e) => {
|
|
2542
2542
|
try {
|
|
2543
2543
|
let t = new URL(e);
|
|
2544
2544
|
return (t.protocol === "ws:" || t.protocol === "wss:") && t.hostname !== "";
|
|
@@ -2546,26 +2546,26 @@ L({
|
|
|
2546
2546
|
return !1;
|
|
2547
2547
|
}
|
|
2548
2548
|
}),
|
|
2549
|
-
expiresAt:
|
|
2550
|
-
tools:
|
|
2551
|
-
type:
|
|
2552
|
-
name:
|
|
2553
|
-
description:
|
|
2554
|
-
parameters:
|
|
2549
|
+
expiresAt: Y.number().positive().max(2 ** 53 - 1).optional(),
|
|
2550
|
+
tools: Y.array(Y.object({
|
|
2551
|
+
type: Y.literal("function"),
|
|
2552
|
+
name: Y.string().min(1),
|
|
2553
|
+
description: Y.string().optional(),
|
|
2554
|
+
parameters: Y.record(Y.string(), Y.unknown())
|
|
2555
2555
|
})).optional()
|
|
2556
|
-
}),
|
|
2556
|
+
}), R({
|
|
2557
2557
|
prefix: "call",
|
|
2558
2558
|
size: 24
|
|
2559
|
-
}),
|
|
2559
|
+
}), R({
|
|
2560
2560
|
prefix: "call",
|
|
2561
2561
|
size: 24
|
|
2562
|
-
}),
|
|
2562
|
+
}), R({
|
|
2563
2563
|
prefix: "call",
|
|
2564
2564
|
size: 24
|
|
2565
2565
|
});
|
|
2566
2566
|
async function qn({ response: e, url: t, fallbackMessage: n }) {
|
|
2567
2567
|
let r = await e.text();
|
|
2568
|
-
return new
|
|
2568
|
+
return new be({
|
|
2569
2569
|
message: r || n,
|
|
2570
2570
|
url: t,
|
|
2571
2571
|
requestBodyValues: void 0,
|
|
@@ -2575,7 +2575,7 @@ async function qn({ response: e, url: t, fallbackMessage: n }) {
|
|
|
2575
2575
|
}
|
|
2576
2576
|
async function Jn(e) {
|
|
2577
2577
|
if (e == null) return [];
|
|
2578
|
-
if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new
|
|
2578
|
+
if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new Pe({
|
|
2579
2579
|
functionality: "FileList",
|
|
2580
2580
|
message: "FileList is not supported in the current environment"
|
|
2581
2581
|
});
|
|
@@ -2603,9 +2603,9 @@ var Xn = class {
|
|
|
2603
2603
|
this.api = e, this.credentials = t, this.headers = n, this.body = r, this.fetch = i, this.prepareSendMessagesRequest = a, this.prepareReconnectToStreamRequest = o;
|
|
2604
2604
|
}
|
|
2605
2605
|
async sendMessages({ abortSignal: e, ...t }) {
|
|
2606
|
-
let n = await
|
|
2607
|
-
...
|
|
2608
|
-
...
|
|
2606
|
+
let n = await q(this.body), r = await q(this.headers), i = await q(this.credentials), a = {
|
|
2607
|
+
...L(r),
|
|
2608
|
+
...L(t.headers)
|
|
2609
2609
|
}, o = await this.prepareSendMessagesRequest?.({
|
|
2610
2610
|
api: this.api,
|
|
2611
2611
|
id: t.chatId,
|
|
@@ -2619,7 +2619,7 @@ var Xn = class {
|
|
|
2619
2619
|
requestMetadata: t.metadata,
|
|
2620
2620
|
trigger: t.trigger,
|
|
2621
2621
|
messageId: t.messageId
|
|
2622
|
-
}), s = o?.api ?? this.api, c = o?.headers === void 0 ? a :
|
|
2622
|
+
}), s = o?.api ?? this.api, c = o?.headers === void 0 ? a : L(o.headers), l = o?.body === void 0 ? {
|
|
2623
2623
|
...n,
|
|
2624
2624
|
...t.body,
|
|
2625
2625
|
id: t.chatId,
|
|
@@ -2641,13 +2641,13 @@ var Xn = class {
|
|
|
2641
2641
|
url: s,
|
|
2642
2642
|
fallbackMessage: "Failed to fetch the chat response."
|
|
2643
2643
|
});
|
|
2644
|
-
if (!d.body) throw new
|
|
2644
|
+
if (!d.body) throw new Ce({ message: "The response body is empty." });
|
|
2645
2645
|
return this.processResponseStream(d.body);
|
|
2646
2646
|
}
|
|
2647
2647
|
async reconnectToStream(e) {
|
|
2648
|
-
let t = await
|
|
2649
|
-
...
|
|
2650
|
-
...
|
|
2648
|
+
let t = await q(this.body), n = await q(this.headers), r = await q(this.credentials), i = {
|
|
2649
|
+
...L(n),
|
|
2650
|
+
...L(e.headers)
|
|
2651
2651
|
}, a = await this.prepareReconnectToStreamRequest?.({
|
|
2652
2652
|
api: this.api,
|
|
2653
2653
|
id: e.chatId,
|
|
@@ -2667,7 +2667,7 @@ var Xn = class {
|
|
|
2667
2667
|
});
|
|
2668
2668
|
o = Yn(this.api, `/${encodeURIComponent(e.chatId)}/stream`);
|
|
2669
2669
|
}
|
|
2670
|
-
let s = a?.headers === void 0 ? i :
|
|
2670
|
+
let s = a?.headers === void 0 ? i : L(a.headers), c = a?.credentials ?? r, l = await (this.fetch ?? globalThis.fetch)(o, {
|
|
2671
2671
|
method: "GET",
|
|
2672
2672
|
headers: s,
|
|
2673
2673
|
credentials: c,
|
|
@@ -2679,7 +2679,7 @@ var Xn = class {
|
|
|
2679
2679
|
url: o,
|
|
2680
2680
|
fallbackMessage: "Failed to fetch the chat response."
|
|
2681
2681
|
});
|
|
2682
|
-
if (!l.body) throw new
|
|
2682
|
+
if (!l.body) throw new Ce({ message: "The response body is empty." });
|
|
2683
2683
|
return this.processResponseStream(l.body);
|
|
2684
2684
|
}
|
|
2685
2685
|
}, Zn = class extends Xn {
|
|
@@ -2696,7 +2696,7 @@ var Xn = class {
|
|
|
2696
2696
|
} }));
|
|
2697
2697
|
}
|
|
2698
2698
|
}, Qn = class {
|
|
2699
|
-
constructor({ generateId: e =
|
|
2699
|
+
constructor({ generateId: e = z, id: t = e(), transport: n = new Zn(), messageMetadataSchema: r, dataPartSchemas: i, state: a, onError: o, onToolCall: s, onFinish: c, onData: l, sendAutomaticallyWhen: u }) {
|
|
2700
2700
|
this.pendingMessagePreparations = /* @__PURE__ */ new Set(), this.activeResponse = void 0, this.activeResumeRequest = void 0, this.resumableStreamState = void 0, this.jobExecutor = new Kn(), this.activeStopCount = 0, this.stopGeneration = 0, this.sendMessage = async (e, t) => {
|
|
2701
2701
|
if (e == null) {
|
|
2702
2702
|
let e = this.pendingApprovalMessageId;
|
|
@@ -2704,7 +2704,7 @@ var Xn = class {
|
|
|
2704
2704
|
e = this.lastMessage?.id;
|
|
2705
2705
|
for (let t = this.state.messages.length - 1; t >= 0; t--) {
|
|
2706
2706
|
let n = this.state.messages[t];
|
|
2707
|
-
if (n.role === "assistant" && n.parts.some((e) =>
|
|
2707
|
+
if (n.role === "assistant" && n.parts.some((e) => Q(e) && e.state === "approval-responded")) {
|
|
2708
2708
|
e = n.id;
|
|
2709
2709
|
break;
|
|
2710
2710
|
}
|
|
@@ -2783,7 +2783,7 @@ var Xn = class {
|
|
|
2783
2783
|
}, this.clearError = () => {
|
|
2784
2784
|
this.status === "error" && (this.state.error = void 0, this.setStatus({ status: "ready" }));
|
|
2785
2785
|
}, this.addToolApprovalResponse = async ({ id: e, approved: t, reason: n, options: r }) => this.jobExecutor.run(async () => {
|
|
2786
|
-
let i = this.state.messages, a = (r) =>
|
|
2786
|
+
let i = this.state.messages, a = (r) => Q(r) && r.state === "approval-requested" && r.approval.id === e ? {
|
|
2787
2787
|
...r,
|
|
2788
2788
|
state: "approval-responded",
|
|
2789
2789
|
approval: {
|
|
@@ -2792,7 +2792,7 @@ var Xn = class {
|
|
|
2792
2792
|
approved: t,
|
|
2793
2793
|
reason: n
|
|
2794
2794
|
}
|
|
2795
|
-
} : r, o = i.findIndex((t) => t.parts.some((t) =>
|
|
2795
|
+
} : r, o = i.findIndex((t) => t.parts.some((t) => Q(t) && t.state === "approval-requested" && t.approval.id === e));
|
|
2796
2796
|
if (o !== -1) {
|
|
2797
2797
|
let e = i[o];
|
|
2798
2798
|
this.state.replaceMessage(o, {
|
|
@@ -2813,7 +2813,7 @@ var Xn = class {
|
|
|
2813
2813
|
}
|
|
2814
2814
|
}), this.addToolOutput = async ({ state: e, toolCallId: t, output: n, errorText: r, options: i }) => this.jobExecutor.run(async () => {
|
|
2815
2815
|
let a = this.state.messages, o = a[a.length - 1], s = (i) => {
|
|
2816
|
-
if (!
|
|
2816
|
+
if (!Q(i) || i.toolCallId !== t) return i;
|
|
2817
2817
|
let { approval: a, ...o } = i, s = a?.approved === !0 ? { approval: {
|
|
2818
2818
|
...a,
|
|
2819
2819
|
approved: a.approved
|
|
@@ -2947,7 +2947,7 @@ var Xn = class {
|
|
|
2947
2947
|
status: "submitted",
|
|
2948
2948
|
error: void 0
|
|
2949
2949
|
});
|
|
2950
|
-
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 = e === "resume-stream" && p?.role === "assistant" && p.parts.some((e) =>
|
|
2950
|
+
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 = e === "resume-stream" && p?.role === "assistant" && p.parts.some((e) => Q(e) && (e.state === "input-streaming" || e.state === "input-available" && e.providerExecuted || e.state === "approval-responded")) ? this.state.snapshot(p) : void 0, h = f !== -1 && f < this.state.messages.length - 1 && p?.role === "assistant", g = !1, _ = !1, v = !1, y;
|
|
2951
2951
|
try {
|
|
2952
2952
|
let s = {
|
|
2953
2953
|
state: e === "resume-stream" && this.resumableStreamState != null ? this.resumableStreamState : Vn({
|
|
@@ -3032,7 +3032,7 @@ var Xn = class {
|
|
|
3032
3032
|
function $n({ messages: e }) {
|
|
3033
3033
|
let t = e[e.length - 1];
|
|
3034
3034
|
if (!t || t.role !== "assistant") return !1;
|
|
3035
|
-
let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter(
|
|
3035
|
+
let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter(Q);
|
|
3036
3036
|
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");
|
|
3037
3037
|
}
|
|
3038
3038
|
//#endregion
|
|
@@ -3097,11 +3097,11 @@ var sr = {
|
|
|
3097
3097
|
return e.json();
|
|
3098
3098
|
});
|
|
3099
3099
|
}
|
|
3100
|
-
},
|
|
3101
|
-
return
|
|
3100
|
+
}, $ = function() {
|
|
3101
|
+
return $ = Object.assign || function(e) {
|
|
3102
3102
|
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]);
|
|
3103
3103
|
return e;
|
|
3104
|
-
},
|
|
3104
|
+
}, $.apply(this, arguments);
|
|
3105
3105
|
}, cr = function(e, t, n, r) {
|
|
3106
3106
|
function i(e) {
|
|
3107
3107
|
return e instanceof n ? e : new n(function(t) {
|
|
@@ -3128,7 +3128,7 @@ var sr = {
|
|
|
3128
3128
|
}
|
|
3129
3129
|
c((r = r.apply(e, t || [])).next());
|
|
3130
3130
|
});
|
|
3131
|
-
},
|
|
3131
|
+
}, lr = function(e, t) {
|
|
3132
3132
|
var n = {
|
|
3133
3133
|
label: 0,
|
|
3134
3134
|
sent: function() {
|
|
@@ -3201,7 +3201,7 @@ var sr = {
|
|
|
3201
3201
|
done: !0
|
|
3202
3202
|
};
|
|
3203
3203
|
}
|
|
3204
|
-
},
|
|
3204
|
+
}, ur = function(e, t) {
|
|
3205
3205
|
var n = typeof Symbol == "function" && e[Symbol.iterator];
|
|
3206
3206
|
if (!n) return e;
|
|
3207
3207
|
var r = n.call(e), i, a = [], o;
|
|
@@ -3217,11 +3217,11 @@ var sr = {
|
|
|
3217
3217
|
}
|
|
3218
3218
|
}
|
|
3219
3219
|
return a;
|
|
3220
|
-
},
|
|
3220
|
+
}, dr = function(e, t, n) {
|
|
3221
3221
|
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]);
|
|
3222
3222
|
return e.concat(a || Array.prototype.slice.call(t));
|
|
3223
|
-
},
|
|
3224
|
-
cache:
|
|
3223
|
+
}, fr = new ir(), pr = new ir(), mr = new ir(), hr = {
|
|
3224
|
+
cache: fr,
|
|
3225
3225
|
refreshInterval: 0,
|
|
3226
3226
|
ttl: 0,
|
|
3227
3227
|
serverTTL: 1e3,
|
|
@@ -3235,11 +3235,11 @@ var sr = {
|
|
|
3235
3235
|
isOnline: sr.isOnline,
|
|
3236
3236
|
isDocumentVisible: sr.isDocumentVisible
|
|
3237
3237
|
};
|
|
3238
|
-
function hr(e, t, n) {
|
|
3239
|
-
var r = fr.get(e);
|
|
3240
|
-
r ? r.data.push(t) : fr.set(e, [t], n > 0 ? n + 5e3 : n);
|
|
3241
|
-
}
|
|
3242
3238
|
function gr(e, t, n) {
|
|
3239
|
+
var r = pr.get(e);
|
|
3240
|
+
r ? r.data.push(t) : pr.set(e, [t], n > 0 ? n + 5e3 : n);
|
|
3241
|
+
}
|
|
3242
|
+
function _r(e, t, n) {
|
|
3243
3243
|
if (n.isDocumentVisible() && !(n.errorRetryCount !== void 0 && t > n.errorRetryCount)) {
|
|
3244
3244
|
var r = Math.min(t || 0, n.errorRetryCount), i = r * n.errorRetryInterval;
|
|
3245
3245
|
setTimeout(function() {
|
|
@@ -3250,17 +3250,17 @@ function gr(e, t, n) {
|
|
|
3250
3250
|
}, i);
|
|
3251
3251
|
}
|
|
3252
3252
|
}
|
|
3253
|
-
function
|
|
3253
|
+
function vr(e) {
|
|
3254
3254
|
var t = e.shouldRetry, n = t === void 0 ? void 0 : t, r = e.error;
|
|
3255
|
-
return typeof n == "function" ? n(r) : typeof n == "boolean" ? n :
|
|
3255
|
+
return typeof n == "function" ? n(r) : typeof n == "boolean" ? n : hr.shouldRetryOnError;
|
|
3256
3256
|
}
|
|
3257
|
-
var
|
|
3258
|
-
return n === void 0 && (n =
|
|
3257
|
+
var yr = function(e, t, n, r) {
|
|
3258
|
+
return n === void 0 && (n = fr), r === void 0 && (r = hr.ttl), cr(void 0, void 0, void 0, function() {
|
|
3259
3259
|
var i, a, o, s, c, l, u;
|
|
3260
|
-
return
|
|
3260
|
+
return lr(this, function(d) {
|
|
3261
3261
|
switch (d.label) {
|
|
3262
3262
|
case 0:
|
|
3263
|
-
if (!
|
|
3263
|
+
if (!xr(t)) return [3, 5];
|
|
3264
3264
|
d.label = 1;
|
|
3265
3265
|
case 1: return d.trys.push([
|
|
3266
3266
|
1,
|
|
@@ -3282,7 +3282,7 @@ var vr = function(e, t, n, r) {
|
|
|
3282
3282
|
} catch (e) {
|
|
3283
3283
|
console.error("swrv(mutate): failed to set cache", e);
|
|
3284
3284
|
}
|
|
3285
|
-
return l =
|
|
3285
|
+
return l = pr.get(e), l && l.data.length && (u = l.data.filter(function(t) {
|
|
3286
3286
|
return t.key === e;
|
|
3287
3287
|
}), u.forEach(function(e, t) {
|
|
3288
3288
|
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];
|
|
@@ -3291,16 +3291,16 @@ var vr = function(e, t, n, r) {
|
|
|
3291
3291
|
});
|
|
3292
3292
|
});
|
|
3293
3293
|
};
|
|
3294
|
-
function
|
|
3294
|
+
function br() {
|
|
3295
3295
|
for (var e = this, t = [], n = 0; n < arguments.length; n++) t[n] = arguments[n];
|
|
3296
|
-
var r, i, a =
|
|
3297
|
-
if (!
|
|
3296
|
+
var r, i, a = $({}, hr), o = !1, s = !1;
|
|
3297
|
+
if (!oe()) return console.error("useSWRV must be called inside setup() or an active effectScope()."), null;
|
|
3298
3298
|
var c = typeof window > "u" || typeof document > "u";
|
|
3299
|
-
t.length >= 1 && (r = t[0]), t.length >= 2 && (i = t[1]), t.length > 2 && (a =
|
|
3299
|
+
t.length >= 1 && (r = t[0]), t.length >= 2 && (i = t[1]), t.length > 2 && (a = $($({}, a), t[2]));
|
|
3300
3300
|
var l = c ? a.serverTTL : a.ttl, u = typeof r == "function" ? r : x(r);
|
|
3301
3301
|
i === void 0 && (i = a.fetcher);
|
|
3302
3302
|
var d = null;
|
|
3303
|
-
d ||=
|
|
3303
|
+
d ||= le({
|
|
3304
3304
|
data: void 0,
|
|
3305
3305
|
error: void 0,
|
|
3306
3306
|
isValidating: !0,
|
|
@@ -3310,30 +3310,30 @@ function yr() {
|
|
|
3310
3310
|
var f = function(t, n) {
|
|
3311
3311
|
return cr(e, void 0, void 0, function() {
|
|
3312
3312
|
var e, r, s, c, p, m, h, g = this;
|
|
3313
|
-
return
|
|
3313
|
+
return lr(this, function(_) {
|
|
3314
3314
|
switch (_.label) {
|
|
3315
3315
|
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() {
|
|
3316
3316
|
return cr(g, void 0, void 0, function() {
|
|
3317
3317
|
var e, t, i, s, c, u;
|
|
3318
|
-
return
|
|
3318
|
+
return lr(this, function(m) {
|
|
3319
3319
|
switch (m.label) {
|
|
3320
|
-
case 0: return e =
|
|
3320
|
+
case 0: return e = mr.get(r), e ? [3, 2] : (t = Array.isArray(r) ? r : [r], i = p.apply(void 0, dr([], ur(t), !1)), mr.set(r, i, a.dedupingInterval), [4, yr(r, i, a.cache, l)]);
|
|
3321
3321
|
case 1: return m.sent(), [3, 4];
|
|
3322
|
-
case 2: return [4,
|
|
3322
|
+
case 2: return [4, yr(r, e.data, a.cache, l)];
|
|
3323
3323
|
case 3: m.sent(), m.label = 4;
|
|
3324
|
-
case 4: return d.isValidating = !1, d.isLoading = !1,
|
|
3324
|
+
case 4: return d.isValidating = !1, d.isLoading = !1, mr.delete(r), d.error !== void 0 && (s = vr({
|
|
3325
3325
|
shouldRetry: a.shouldRetryOnError,
|
|
3326
3326
|
error: d.error
|
|
3327
|
-
}), c =
|
|
3327
|
+
}), c = vr({
|
|
3328
3328
|
shouldRetry: !n || n.shouldRetryOnError,
|
|
3329
3329
|
error: d.error
|
|
3330
|
-
}), u = !o && s && c, u &&
|
|
3330
|
+
}), u = !o && s && c, u && _r(f, n ? n.errorRetryCount : 1, a)), [2];
|
|
3331
3331
|
}
|
|
3332
3332
|
});
|
|
3333
3333
|
});
|
|
3334
3334
|
}, c && a.revalidateDebounce ? (setTimeout(function() {
|
|
3335
3335
|
return cr(g, void 0, void 0, function() {
|
|
3336
|
-
return
|
|
3336
|
+
return lr(this, function(e) {
|
|
3337
3337
|
switch (e.label) {
|
|
3338
3338
|
case 0: return o ? [3, 2] : [4, h()];
|
|
3339
3339
|
case 1: e.sent(), e.label = 2;
|
|
@@ -3350,7 +3350,7 @@ function yr() {
|
|
|
3350
3350
|
});
|
|
3351
3351
|
}, p = function() {
|
|
3352
3352
|
return cr(e, void 0, void 0, function() {
|
|
3353
|
-
return
|
|
3353
|
+
return lr(this, function(e) {
|
|
3354
3354
|
return [2, f(null, { shouldRetryOnError: !1 })];
|
|
3355
3355
|
});
|
|
3356
3356
|
});
|
|
@@ -3358,7 +3358,7 @@ function yr() {
|
|
|
3358
3358
|
if (!c) {
|
|
3359
3359
|
var h = function() {
|
|
3360
3360
|
return cr(e, void 0, void 0, function() {
|
|
3361
|
-
return
|
|
3361
|
+
return lr(this, function(e) {
|
|
3362
3362
|
switch (e.label) {
|
|
3363
3363
|
case 0: return d.error || !a.isOnline() ? [3, 2] : [4, f()];
|
|
3364
3364
|
case 1: return e.sent(), [3, 3];
|
|
@@ -3370,30 +3370,30 @@ function yr() {
|
|
|
3370
3370
|
};
|
|
3371
3371
|
a.refreshInterval && (m = setTimeout(h, a.refreshInterval)), a.revalidateOnFocus && (document.addEventListener("visibilitychange", p, !1), window.addEventListener("focus", p, !1));
|
|
3372
3372
|
}
|
|
3373
|
-
|
|
3373
|
+
ce(function() {
|
|
3374
3374
|
o = !0, m &&= (clearTimeout(m), null), !c && a.revalidateOnFocus && (document.removeEventListener("visibilitychange", p, !1), window.removeEventListener("focus", p, !1));
|
|
3375
|
-
var e =
|
|
3375
|
+
var e = pr.get(u.value);
|
|
3376
3376
|
e && (e.data = e.data.filter(function(e) {
|
|
3377
3377
|
return e !== d;
|
|
3378
3378
|
}));
|
|
3379
3379
|
});
|
|
3380
3380
|
try {
|
|
3381
|
-
|
|
3382
|
-
|
|
3381
|
+
de(u, function(e) {
|
|
3382
|
+
se(u) || (u.value = e), d.key = e, d.isValidating = !!e, gr(u.value, d, l), !c && !s && u.value && f(), s = !1;
|
|
3383
3383
|
}, { immediate: !0 });
|
|
3384
3384
|
} catch {}
|
|
3385
|
-
return
|
|
3386
|
-
return f(e,
|
|
3385
|
+
return $($({}, ue(d)), { mutate: function(e, t) {
|
|
3386
|
+
return f(e, $($({}, t), { forceRevalidate: !0 }));
|
|
3387
3387
|
} });
|
|
3388
3388
|
}
|
|
3389
|
-
function
|
|
3389
|
+
function xr(e) {
|
|
3390
3390
|
return typeof e == "object" && !!e && typeof e.then == "function";
|
|
3391
3391
|
}
|
|
3392
3392
|
//#endregion
|
|
3393
3393
|
//#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.43_typescript@6.0.3_/node_modules/swrv/esm/index.js
|
|
3394
|
-
var
|
|
3395
|
-
|
|
3396
|
-
var
|
|
3394
|
+
var Sr = br;
|
|
3395
|
+
Sr.default, Sr.default;
|
|
3396
|
+
var Cr = class {
|
|
3397
3397
|
constructor(e) {
|
|
3398
3398
|
this.statusRef = x("ready"), this.errorRef = x(void 0), this.pushMessage = (e) => {
|
|
3399
3399
|
this.messagesRef.value = [...this.messagesRef.value, e];
|
|
@@ -3421,52 +3421,52 @@ var Sr = class {
|
|
|
3421
3421
|
set error(e) {
|
|
3422
3422
|
this.errorRef.value = e;
|
|
3423
3423
|
}
|
|
3424
|
-
},
|
|
3424
|
+
}, wr = class extends Qn {
|
|
3425
3425
|
constructor({ messages: e, ...t }) {
|
|
3426
3426
|
super({
|
|
3427
3427
|
...t,
|
|
3428
|
-
state: new
|
|
3428
|
+
state: new Cr(e)
|
|
3429
3429
|
});
|
|
3430
3430
|
}
|
|
3431
|
-
},
|
|
3431
|
+
}, Tr = "voice-", Er = (e) => e.replace(/\s+/g, " ").trim().toLowerCase(), Dr = (e) => Er(e.parts.filter((e) => e.type === "text").map((e) => "text" in e ? e.text : "").join(" ")), Or = 8, kr = (e, t) => {
|
|
3432
3432
|
let n = e.filter((e) => e.role === "user").map((e) => ({
|
|
3433
|
-
text:
|
|
3433
|
+
text: Dr(e),
|
|
3434
3434
|
taken: !1
|
|
3435
3435
|
}));
|
|
3436
3436
|
return t.filter((e) => {
|
|
3437
3437
|
if (!e.id.startsWith("voice-") || e.role !== "user") return !1;
|
|
3438
|
-
let t =
|
|
3438
|
+
let t = Dr(e), r = n.find((e) => !e.taken && e.text.length > 0 && (e.text === t || e.text.length >= Or && t.endsWith(e.text)));
|
|
3439
3439
|
return !r || (r.taken = !0, !1);
|
|
3440
3440
|
});
|
|
3441
|
-
},
|
|
3441
|
+
}, Ar = (e) => {
|
|
3442
3442
|
let t = e.type ?? "";
|
|
3443
3443
|
return t === "dynamic-tool" ? e.toolName ?? "" : t.startsWith("tool-") ? t.slice(5) : "";
|
|
3444
|
-
},
|
|
3444
|
+
}, jr = ({ messages: e }) => {
|
|
3445
3445
|
let t = e[e.length - 1];
|
|
3446
3446
|
if (!t || t.role !== "assistant") return !1;
|
|
3447
|
-
let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter((e) => !e.providerExecuted && y(
|
|
3447
|
+
let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter((e) => !e.providerExecuted && y(Ar(e)));
|
|
3448
3448
|
return r.length > 0 && r.every((e) => ee.has(e.state ?? ""));
|
|
3449
3449
|
};
|
|
3450
|
-
function
|
|
3450
|
+
function Mr(e) {
|
|
3451
3451
|
return S(`chatbot-${e}`, () => {
|
|
3452
|
-
let { t, te: n, locale: r } =
|
|
3452
|
+
let { t, te: n, locale: r } = pe({ useScope: "global" }), i = x(""), a = x(), o = x(e), s = x(), c = x(), l = x(), u = x(), d = x(), f = x(), p = x(), m = x(), h = x(), g = x(), _ = x(), v = x(), y = x(), ee = x(), oe = x(), se = x(), ce = x(!1), le = me(), ue = b(() => {
|
|
3453
3453
|
let e = u.value?.theme;
|
|
3454
|
-
return (!e || e === "auto") && (e =
|
|
3455
|
-
}), S = b(() => c.value === "reasoning"),
|
|
3454
|
+
return (!e || e === "auto") && (e = se.value), e ? e === "dark" : le.value;
|
|
3455
|
+
}), S = b(() => c.value === "reasoning"), _e = b(() => S.value ? g.value?.filter((e) => ![
|
|
3456
3456
|
"upvote",
|
|
3457
3457
|
"downvote",
|
|
3458
3458
|
"feedback"
|
|
3459
|
-
].includes(e)) : g.value),
|
|
3460
|
-
|
|
3461
|
-
|
|
3459
|
+
].includes(e)) : g.value), ve = ae(b(() => `${o.value}-chatId`), null);
|
|
3460
|
+
fe(() => {
|
|
3461
|
+
ve.value ||= z();
|
|
3462
3462
|
});
|
|
3463
3463
|
let C = b({
|
|
3464
|
-
get: () =>
|
|
3464
|
+
get: () => ve.value,
|
|
3465
3465
|
set: (e) => {
|
|
3466
|
-
|
|
3466
|
+
ve.value = e;
|
|
3467
3467
|
}
|
|
3468
|
-
}), w = x(), T = x(!1),
|
|
3469
|
-
function
|
|
3468
|
+
}), w = x(), T = x(!1), ye = b(() => w.value?.message?.toLowerCase().includes("conversation-blocked") ?? !1);
|
|
3469
|
+
function be(e) {
|
|
3470
3470
|
try {
|
|
3471
3471
|
let t = JSON.parse(e.message);
|
|
3472
3472
|
return t.status === 404 || t.type?.includes("entity-not-found");
|
|
@@ -3474,20 +3474,20 @@ function jr(e) {
|
|
|
3474
3474
|
return !1;
|
|
3475
3475
|
}
|
|
3476
3476
|
}
|
|
3477
|
-
function
|
|
3478
|
-
if (
|
|
3477
|
+
function xe(e) {
|
|
3478
|
+
if (be(e)) {
|
|
3479
3479
|
let e = D.value.messages.filter((e) => e.role === "user"), t = e[e.length - 1], n = t ? re(t) : void 0;
|
|
3480
|
-
C.value =
|
|
3481
|
-
} else ne.error(e), w.value = e,
|
|
3480
|
+
C.value = z(), D.value.clearError(), w.value = void 0, n && D.value.sendMessage({ text: n });
|
|
3481
|
+
} else ne.error(e), w.value = e, ye.value && (T.value = !0);
|
|
3482
3482
|
}
|
|
3483
3483
|
let E = b(() => te({
|
|
3484
3484
|
baseUrl: i.value,
|
|
3485
3485
|
basePath: a.value,
|
|
3486
3486
|
headers: () => p.value
|
|
3487
|
-
})),
|
|
3488
|
-
...
|
|
3489
|
-
...
|
|
3490
|
-
}), D = b(() => new
|
|
3487
|
+
})), Se = x(null), Ce = () => ({
|
|
3488
|
+
...he(),
|
|
3489
|
+
...Se.value ?? {}
|
|
3490
|
+
}), D = b(() => new wr({
|
|
3491
3491
|
id: C.value,
|
|
3492
3492
|
transport: new Zn({
|
|
3493
3493
|
api: E.value.getChatEndpoint(o.value, S.value ? "reasoning" : "chat"),
|
|
@@ -3505,8 +3505,8 @@ function jr(e) {
|
|
|
3505
3505
|
reasoning: d.value?.reasoning,
|
|
3506
3506
|
webSearch: f.value?.webSearch,
|
|
3507
3507
|
smoothStream: u.value?.smoothStream,
|
|
3508
|
-
deviceContext:
|
|
3509
|
-
externalContext:
|
|
3508
|
+
deviceContext: Ce(),
|
|
3509
|
+
externalContext: oe.value,
|
|
3510
3510
|
disabledTools: f.value?.disabled,
|
|
3511
3511
|
fallbackModels: y.value,
|
|
3512
3512
|
gatewayOptions: ee.value
|
|
@@ -3514,23 +3514,26 @@ function jr(e) {
|
|
|
3514
3514
|
credentials: "include",
|
|
3515
3515
|
headers: () => p.value ?? {}
|
|
3516
3516
|
}),
|
|
3517
|
-
sendAutomaticallyWhen: (e) =>
|
|
3518
|
-
onError:
|
|
3517
|
+
sendAutomaticallyWhen: (e) => jr(e) || $n(e),
|
|
3518
|
+
onError: xe,
|
|
3519
|
+
onData: (e) => {
|
|
3520
|
+
e.type === "data-audioTranscripts" && (D.value.messages = ie(D.value.messages, e.data));
|
|
3521
|
+
},
|
|
3519
3522
|
onFinish: () => {
|
|
3520
3523
|
let e = C.value;
|
|
3521
3524
|
!S.value && !O.value.some((t) => t.id === e) && Le(o.value);
|
|
3522
3525
|
}
|
|
3523
|
-
})),
|
|
3526
|
+
})), we = b(() => {
|
|
3524
3527
|
let e = u.value?.initialMessage;
|
|
3525
3528
|
return e?.[r.value] ? e[r.value] : n("message.defaultAgentWelcome") ? t("message.defaultAgentWelcome") : "";
|
|
3526
|
-
}),
|
|
3527
|
-
id:
|
|
3529
|
+
}), Te = z(), Ee = b(() => ({
|
|
3530
|
+
id: Te,
|
|
3528
3531
|
role: "assistant",
|
|
3529
3532
|
parts: [{
|
|
3530
3533
|
type: "text",
|
|
3531
|
-
text:
|
|
3534
|
+
text: we.value
|
|
3532
3535
|
}]
|
|
3533
|
-
})),
|
|
3536
|
+
})), De = b(() => {
|
|
3534
3537
|
let e = (e) => e.map((e) => e.role !== "user" || !e.parts.some((e) => e.type === "file") ? e : {
|
|
3535
3538
|
...e,
|
|
3536
3539
|
parts: e.parts.map((e) => {
|
|
@@ -3549,21 +3552,21 @@ function jr(e) {
|
|
|
3549
3552
|
};
|
|
3550
3553
|
})
|
|
3551
3554
|
});
|
|
3552
|
-
return S.value ? e(D.value.messages) : !
|
|
3553
|
-
}),
|
|
3555
|
+
return S.value ? e(D.value.messages) : !ce.value && D.value.messages?.[0]?.role !== "assistant" ? [Ee.value, ...e(D.value.messages)] : e(D.value.messages);
|
|
3556
|
+
}), Oe = b(() => {
|
|
3554
3557
|
let e = u.value?.messagePlaceholder;
|
|
3555
3558
|
return e?.[r.value] ? e[r.value] : n("placeholder.askAnything") ? t("placeholder.askAnything") : "";
|
|
3556
|
-
}), O = x([]),
|
|
3559
|
+
}), O = x([]), ke = x(!1), k = x([]), Ae = x(!1), je = x("chat"), A = x([]), j = x(), Me = x(!1), M = x(!1), Ne = x(), Pe = x(!1), N = x(!1), Fe = x(), P = x(""), F = x([]), I = x(""), Ie = x(0);
|
|
3557
3560
|
async function Le(e) {
|
|
3558
3561
|
if (S.value) O.value = [];
|
|
3559
3562
|
else {
|
|
3560
|
-
|
|
3563
|
+
ke.value = !0;
|
|
3561
3564
|
try {
|
|
3562
3565
|
O.value = await E.value.getConversations(e, l.value);
|
|
3563
3566
|
} catch {
|
|
3564
3567
|
O.value = [];
|
|
3565
3568
|
} finally {
|
|
3566
|
-
|
|
3569
|
+
ke.value = !1;
|
|
3567
3570
|
}
|
|
3568
3571
|
}
|
|
3569
3572
|
}
|
|
@@ -3571,13 +3574,13 @@ function jr(e) {
|
|
|
3571
3574
|
let e = C.value;
|
|
3572
3575
|
if (!e) k.value = [];
|
|
3573
3576
|
else {
|
|
3574
|
-
|
|
3577
|
+
Ae.value = !0;
|
|
3575
3578
|
try {
|
|
3576
3579
|
k.value = await E.value.getChatFiles(e);
|
|
3577
3580
|
} catch {
|
|
3578
3581
|
k.value = [];
|
|
3579
3582
|
} finally {
|
|
3580
|
-
|
|
3583
|
+
Ae.value = !1;
|
|
3581
3584
|
}
|
|
3582
3585
|
}
|
|
3583
3586
|
}
|
|
@@ -3592,25 +3595,25 @@ function jr(e) {
|
|
|
3592
3595
|
let t = k.value.find((t) => t.documentId === e), n = t?.kind === "spreadsheet" ? t.sourceAttachmentId ?? t.documentId : void 0;
|
|
3593
3596
|
k.value = k.value.filter((t) => t.documentId !== e && (!n || t.documentId !== n && t.sourceAttachmentId !== n));
|
|
3594
3597
|
}
|
|
3595
|
-
async function
|
|
3598
|
+
async function L(e, t) {
|
|
3596
3599
|
if (!S.value) try {
|
|
3597
3600
|
let n = await E.value.getChat(e, t);
|
|
3598
3601
|
if (t !== C.value || D.value.status !== "ready" || D.value.messages.length > 0) return;
|
|
3599
3602
|
n && (D.value.messages = n.messages, T.value = n.blocked ?? !1);
|
|
3600
3603
|
} catch {}
|
|
3601
3604
|
}
|
|
3602
|
-
let
|
|
3605
|
+
let R = () => {
|
|
3603
3606
|
let e = D.value.status;
|
|
3604
3607
|
return e === "submitted" || e === "streaming";
|
|
3605
3608
|
}, He = 0, Ue = 0;
|
|
3606
3609
|
async function We() {
|
|
3607
|
-
if (S.value ||
|
|
3610
|
+
if (S.value || R()) return "indeterminate";
|
|
3608
3611
|
let e = C.value, t = He += 1;
|
|
3609
3612
|
try {
|
|
3610
3613
|
let n = await E.value.getChat(o.value, e);
|
|
3611
|
-
if (!n || e !== C.value ||
|
|
3614
|
+
if (!n || e !== C.value || R() || t <= Ue) return "indeterminate";
|
|
3612
3615
|
Ue = t;
|
|
3613
|
-
let r = n.messages, i =
|
|
3616
|
+
let r = n.messages, i = kr(r, D.value.messages);
|
|
3614
3617
|
return D.value.messages = [...r, ...i], T.value = n.blocked ?? !1, i.length > 0 ? "pending" : "caught-up";
|
|
3615
3618
|
} catch {}
|
|
3616
3619
|
return "indeterminate";
|
|
@@ -3630,35 +3633,35 @@ function jr(e) {
|
|
|
3630
3633
|
t >= 0 ? A.value[t] = e : A.value.push(e);
|
|
3631
3634
|
}
|
|
3632
3635
|
function Je(e) {
|
|
3633
|
-
let t =
|
|
3636
|
+
let t = De.value, n = t.findIndex((t) => t.id === e.id), r = re(e) ?? "", i = t.slice(0, n).reverse().find((e) => e.role === "user");
|
|
3634
3637
|
return {
|
|
3635
3638
|
userQuestion: re(i ?? e) ?? "",
|
|
3636
3639
|
assistantMessage: r
|
|
3637
3640
|
};
|
|
3638
3641
|
}
|
|
3639
|
-
async function
|
|
3642
|
+
async function B(e, t) {
|
|
3640
3643
|
await Promise.all([
|
|
3641
|
-
|
|
3644
|
+
L(e, t),
|
|
3642
3645
|
Le(e),
|
|
3643
3646
|
Ke(t)
|
|
3644
|
-
]),
|
|
3645
|
-
e && (
|
|
3647
|
+
]), Se.value || ge((e, t) => E.value.reverseGeocode(e, t, r.value)).then((e) => {
|
|
3648
|
+
e && (Se.value = e);
|
|
3646
3649
|
});
|
|
3647
3650
|
}
|
|
3648
3651
|
async function Ye() {
|
|
3649
|
-
let e =
|
|
3652
|
+
let e = P.value.trim(), t = F.value.filter((e) => e.state === "done" && e.mediaSource !== void 0).map((e) => ({
|
|
3650
3653
|
type: "file",
|
|
3651
3654
|
mediaType: e.mediaSource.mimeType,
|
|
3652
3655
|
url: e.localUrl,
|
|
3653
3656
|
filename: e.mediaSource.name,
|
|
3654
3657
|
providerMetadata: { "8bot": { media: e.mediaSource } }
|
|
3655
3658
|
}));
|
|
3656
|
-
S.value &&
|
|
3659
|
+
S.value && De.value.length > 0 && await Qe(), I.value = e, Ie.value = D.value.messages.length;
|
|
3657
3660
|
let n = D.value.sendMessage;
|
|
3658
3661
|
n({
|
|
3659
3662
|
text: e,
|
|
3660
3663
|
files: t.length > 0 ? t : void 0
|
|
3661
|
-
}),
|
|
3664
|
+
}), P.value = "", V();
|
|
3662
3665
|
}
|
|
3663
3666
|
function Xe(e) {
|
|
3664
3667
|
let t = e.trim();
|
|
@@ -3671,26 +3674,26 @@ function jr(e) {
|
|
|
3671
3674
|
n({ text: t });
|
|
3672
3675
|
}
|
|
3673
3676
|
async function Ze() {
|
|
3674
|
-
let e =
|
|
3675
|
-
await D.value.stop(), e && (
|
|
3677
|
+
let e = I.value.length > 0;
|
|
3678
|
+
await D.value.stop(), e && (P.value = I.value, D.value.messages = D.value.messages.slice(0, Ie.value), I.value = "");
|
|
3676
3679
|
}
|
|
3677
|
-
|
|
3678
|
-
e === "ready" &&
|
|
3680
|
+
de(() => D.value.status, (e) => {
|
|
3681
|
+
e === "ready" && I.value.length > 0 && (I.value = "");
|
|
3679
3682
|
});
|
|
3680
|
-
function
|
|
3681
|
-
for (let t of
|
|
3682
|
-
|
|
3683
|
+
function V(e = !1) {
|
|
3684
|
+
for (let t of F.value) (e || t.state !== "done") && URL.revokeObjectURL(t.localUrl);
|
|
3685
|
+
F.value = [], H.value = null;
|
|
3683
3686
|
}
|
|
3684
3687
|
async function Qe() {
|
|
3685
|
-
return
|
|
3688
|
+
return I.value = "", await Ze(), C.value = z(), D.value.clearError(), w.value = void 0, T.value = !1, V(!0), G("chat"), C.value;
|
|
3686
3689
|
}
|
|
3687
3690
|
async function $e(e) {
|
|
3688
|
-
D.value.status !== "ready" && (
|
|
3691
|
+
D.value.status !== "ready" && (I.value = "", await Ze()), await D.value.regenerate(e);
|
|
3689
3692
|
}
|
|
3690
3693
|
function et(e) {
|
|
3691
3694
|
if (e.tool === "requestGeolocation") {
|
|
3692
3695
|
let t = e.output;
|
|
3693
|
-
"latitude" in t && (
|
|
3696
|
+
"latitude" in t && (Se.value = {
|
|
3694
3697
|
geolocationLatitude: t.latitude,
|
|
3695
3698
|
geolocationLongitude: t.longitude,
|
|
3696
3699
|
geolocationAccuracy: t.accuracy,
|
|
@@ -3702,15 +3705,15 @@ function jr(e) {
|
|
|
3702
3705
|
function tt(e) {
|
|
3703
3706
|
D.value.addToolApprovalResponse(e);
|
|
3704
3707
|
}
|
|
3705
|
-
let nt = b(() => D.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), rt = b(() => _.value?.maxFilesPerMessage ?? 5), it = b(() => _.value?.maxFilesPerChat ?? 20), at = b(() => Math.max(0, Math.min(rt.value -
|
|
3706
|
-
|
|
3708
|
+
let nt = b(() => D.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), rt = b(() => _.value?.maxFilesPerMessage ?? 5), it = b(() => _.value?.maxFilesPerChat ?? 20), at = b(() => Math.max(0, Math.min(rt.value - F.value.length, it.value - nt.value - F.value.length))), ot = b(() => at.value <= 0), H = x(null), st = () => {
|
|
3709
|
+
H.value = null;
|
|
3707
3710
|
};
|
|
3708
|
-
|
|
3709
|
-
e || (
|
|
3711
|
+
de(ot, (e) => {
|
|
3712
|
+
e || (H.value = null);
|
|
3710
3713
|
});
|
|
3711
3714
|
async function ct(e) {
|
|
3712
3715
|
if (ot.value) {
|
|
3713
|
-
|
|
3716
|
+
H.value = it.value - nt.value - F.value.length <= rt.value - F.value.length ? {
|
|
3714
3717
|
reason: "per-chat",
|
|
3715
3718
|
max: it.value
|
|
3716
3719
|
} : {
|
|
@@ -3719,23 +3722,23 @@ function jr(e) {
|
|
|
3719
3722
|
};
|
|
3720
3723
|
return;
|
|
3721
3724
|
}
|
|
3722
|
-
let t =
|
|
3725
|
+
let t = z(), n = {
|
|
3723
3726
|
id: t,
|
|
3724
3727
|
file: e,
|
|
3725
3728
|
localUrl: URL.createObjectURL(e),
|
|
3726
3729
|
state: "uploading"
|
|
3727
3730
|
};
|
|
3728
|
-
|
|
3731
|
+
F.value = [...F.value, n];
|
|
3729
3732
|
try {
|
|
3730
3733
|
let n = await E.value.uploadMedia(o.value, C.value, e);
|
|
3731
|
-
|
|
3734
|
+
F.value = F.value.map((e) => e.id === t ? {
|
|
3732
3735
|
...e,
|
|
3733
3736
|
state: "done",
|
|
3734
3737
|
mediaSource: n
|
|
3735
3738
|
} : e);
|
|
3736
3739
|
} catch (e) {
|
|
3737
3740
|
let n = e instanceof Error ? e.message : "Upload failed";
|
|
3738
|
-
|
|
3741
|
+
F.value = F.value.map((e) => e.id === t ? {
|
|
3739
3742
|
...e,
|
|
3740
3743
|
state: "error",
|
|
3741
3744
|
error: n
|
|
@@ -3756,15 +3759,15 @@ function jr(e) {
|
|
|
3756
3759
|
async function ut(e) {
|
|
3757
3760
|
await lt(e, "upvote");
|
|
3758
3761
|
}
|
|
3759
|
-
async function
|
|
3762
|
+
async function U(e) {
|
|
3760
3763
|
await lt(e, "downvote");
|
|
3761
3764
|
}
|
|
3762
3765
|
function dt(e) {
|
|
3763
|
-
M.value = !1,
|
|
3766
|
+
M.value = !1, Ne.value = void 0, j.value = e;
|
|
3764
3767
|
}
|
|
3765
3768
|
async function ft(e) {
|
|
3766
3769
|
if (j.value) try {
|
|
3767
|
-
|
|
3770
|
+
Me.value = !0, M.value = !1, Ne.value = void 0;
|
|
3768
3771
|
let { userQuestion: t, assistantMessage: n } = Je(j.value);
|
|
3769
3772
|
qe(await E.value.submitMessageFeedback({
|
|
3770
3773
|
messageId: j.value.id,
|
|
@@ -3775,20 +3778,20 @@ function jr(e) {
|
|
|
3775
3778
|
comment: e
|
|
3776
3779
|
})), M.value = !0, await Ke(C.value);
|
|
3777
3780
|
} catch {
|
|
3778
|
-
|
|
3781
|
+
Ne.value = n("message.feedbackSubmitError") ? t("message.feedbackSubmitError") : "Failed to submit feedback";
|
|
3779
3782
|
} finally {
|
|
3780
|
-
|
|
3783
|
+
Me.value = !1;
|
|
3781
3784
|
}
|
|
3782
3785
|
}
|
|
3783
3786
|
async function pt(e) {
|
|
3784
3787
|
try {
|
|
3785
|
-
N.value = !0,
|
|
3788
|
+
N.value = !0, Pe.value = !1, Fe.value = void 0, await E.value.submitLead({
|
|
3786
3789
|
agentId: o.value,
|
|
3787
3790
|
chatId: C.value,
|
|
3788
3791
|
...e
|
|
3789
|
-
}),
|
|
3792
|
+
}), Pe.value = !0;
|
|
3790
3793
|
} catch {
|
|
3791
|
-
|
|
3794
|
+
Fe.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
|
|
3792
3795
|
} finally {
|
|
3793
3796
|
N.value = !1;
|
|
3794
3797
|
}
|
|
@@ -3800,23 +3803,23 @@ function jr(e) {
|
|
|
3800
3803
|
title: n.title
|
|
3801
3804
|
} : t);
|
|
3802
3805
|
}
|
|
3803
|
-
async function
|
|
3806
|
+
async function W(e) {
|
|
3804
3807
|
await E.value.deleteChat(o.value, e), O.value = O.value.filter((t) => t.id !== e), C.value === e && await Qe();
|
|
3805
3808
|
}
|
|
3806
|
-
function
|
|
3807
|
-
|
|
3809
|
+
function G(e) {
|
|
3810
|
+
je.value = e;
|
|
3808
3811
|
}
|
|
3809
3812
|
let ht;
|
|
3810
3813
|
function gt(e) {
|
|
3811
3814
|
let t = () => E.value.getChat(o.value, e).then((e) => e !== null);
|
|
3812
3815
|
return t().catch(() => t().catch(() => !1));
|
|
3813
3816
|
}
|
|
3814
|
-
return
|
|
3817
|
+
return de(l, async (e) => {
|
|
3815
3818
|
if (!e || e === ht) return;
|
|
3816
3819
|
let t = ht;
|
|
3817
3820
|
if (ht = e, t === void 0) return;
|
|
3818
3821
|
let n = C.value, r = !S.value && await gt(n);
|
|
3819
|
-
l.value === e && C.value === n && (r ? Le(o.value) : (O.value = [], A.value = [], k.value = [], await Qe(),
|
|
3822
|
+
l.value === e && C.value === n && (r ? Le(o.value) : (O.value = [], A.value = [], k.value = [], await Qe(), P.value = ""));
|
|
3820
3823
|
}), {
|
|
3821
3824
|
apiClient: E,
|
|
3822
3825
|
baseUrl: i,
|
|
@@ -3832,40 +3835,40 @@ function jr(e) {
|
|
|
3832
3835
|
revisedAnswers: m,
|
|
3833
3836
|
model: h,
|
|
3834
3837
|
actionsInput: g,
|
|
3835
|
-
actions:
|
|
3838
|
+
actions: _e,
|
|
3836
3839
|
agentFileUpload: _,
|
|
3837
3840
|
agentVoice: v,
|
|
3838
3841
|
fallbackModels: y,
|
|
3839
3842
|
gatewayOptions: ee,
|
|
3840
|
-
externalContext:
|
|
3841
|
-
systemTheme:
|
|
3842
|
-
hideWelcomeMessage:
|
|
3843
|
-
isDark:
|
|
3843
|
+
externalContext: oe,
|
|
3844
|
+
systemTheme: se,
|
|
3845
|
+
hideWelcomeMessage: ce,
|
|
3846
|
+
isDark: ue,
|
|
3844
3847
|
chat: D,
|
|
3845
|
-
messages:
|
|
3848
|
+
messages: De,
|
|
3846
3849
|
conversations: O,
|
|
3847
|
-
isLoadingConversations:
|
|
3850
|
+
isLoadingConversations: ke,
|
|
3848
3851
|
chatFiles: k,
|
|
3849
|
-
isLoadingChatFiles:
|
|
3850
|
-
input:
|
|
3851
|
-
pendingAttachments:
|
|
3852
|
+
isLoadingChatFiles: Ae,
|
|
3853
|
+
input: P,
|
|
3854
|
+
pendingAttachments: F,
|
|
3852
3855
|
isAttachmentLimitReached: ot,
|
|
3853
|
-
fileLimitError:
|
|
3856
|
+
fileLimitError: H,
|
|
3854
3857
|
localChatId: C,
|
|
3855
3858
|
isConversationBlocked: T,
|
|
3856
|
-
inputMessagePlaceholder:
|
|
3859
|
+
inputMessagePlaceholder: Oe,
|
|
3857
3860
|
chatError: w,
|
|
3858
|
-
activeView:
|
|
3861
|
+
activeView: je,
|
|
3859
3862
|
messageFeedbacks: A,
|
|
3860
3863
|
feedbackDialogMessage: j,
|
|
3861
|
-
isFeedbackSubmitting:
|
|
3864
|
+
isFeedbackSubmitting: Me,
|
|
3862
3865
|
isFeedbackSubmitted: M,
|
|
3863
|
-
feedbackSubmitError:
|
|
3864
|
-
isLeadSubmitted:
|
|
3866
|
+
feedbackSubmitError: Ne,
|
|
3867
|
+
isLeadSubmitted: Pe,
|
|
3865
3868
|
isLoadingSubmitLead: N,
|
|
3866
|
-
submitLeadError:
|
|
3867
|
-
buildDeviceContext:
|
|
3868
|
-
initialize:
|
|
3869
|
+
submitLeadError: Fe,
|
|
3870
|
+
buildDeviceContext: Ce,
|
|
3871
|
+
initialize: B,
|
|
3869
3872
|
loadConversations: Le,
|
|
3870
3873
|
loadChatFiles: Re,
|
|
3871
3874
|
refreshMessages: We,
|
|
@@ -3882,19 +3885,19 @@ function jr(e) {
|
|
|
3882
3885
|
addToolApprovalResponse: tt,
|
|
3883
3886
|
handleFileSelect: ct,
|
|
3884
3887
|
clearFileLimitError: st,
|
|
3885
|
-
clearPendingAttachments:
|
|
3888
|
+
clearPendingAttachments: V,
|
|
3886
3889
|
onUpvote: ut,
|
|
3887
|
-
onDownvote:
|
|
3890
|
+
onDownvote: U,
|
|
3888
3891
|
onFeedback: dt,
|
|
3889
3892
|
onFeedbackSubmit: ft,
|
|
3890
3893
|
onLeadSubmit: pt,
|
|
3891
|
-
navigate:
|
|
3894
|
+
navigate: G,
|
|
3892
3895
|
renameChatTitle: mt,
|
|
3893
|
-
deleteChat:
|
|
3896
|
+
deleteChat: W
|
|
3894
3897
|
};
|
|
3895
3898
|
})();
|
|
3896
3899
|
}
|
|
3897
3900
|
//#endregion
|
|
3898
|
-
export {
|
|
3901
|
+
export { z as a, Zn as i, Mr as n, wr as r, Tr as t };
|
|
3899
3902
|
|
|
3900
|
-
//# sourceMappingURL=useChatbotStore-
|
|
3903
|
+
//# sourceMappingURL=useChatbotStore-CiF_gfIk.js.map
|