@8wave/ai-elements 0.125.0-beta.17 → 0.125.0-beta.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/_chunks/{PkChatbotFilePreview-xDlDvl5m.js → PkChatbotFilePreview-CFGqa-tX.js} +2 -2
- package/dist/_chunks/{PkChatbotFilePreview-xDlDvl5m.js.map → PkChatbotFilePreview-CFGqa-tX.js.map} +1 -1
- package/dist/_chunks/{PkFilePreview-BIFkMsAC.js → PkFilePreview-BzNLupQS.js} +318 -315
- package/dist/_chunks/PkFilePreview-BzNLupQS.js.map +1 -0
- package/dist/_chunks/{PkFilePreviewDialog-NLk4gZMd.js → PkFilePreviewDialog-BfZFgdOi.js} +2 -2
- package/dist/_chunks/{PkFilePreviewDialog-NLk4gZMd.js.map → PkFilePreviewDialog-BfZFgdOi.js.map} +1 -1
- package/dist/_chunks/{PkStreamingMarkdown-BFTTLuPc.js → PkStreamingMarkdown-CqLpNWQv.js} +2 -2
- package/dist/_chunks/{PkStreamingMarkdown-BFTTLuPc.js.map → PkStreamingMarkdown-CqLpNWQv.js.map} +1 -1
- package/dist/_chunks/{PkToolChatFile-Buv7Qkes.js → PkToolChatFile-iE4ZokYD.js} +2 -2
- package/dist/_chunks/{PkToolChatFile-Buv7Qkes.js.map → PkToolChatFile-iE4ZokYD.js.map} +1 -1
- package/dist/_chunks/{PkToolShareDocument-kB0qoQda.js → PkToolShareDocument-lTHNZodf.js} +2 -2
- package/dist/_chunks/{PkToolShareDocument-kB0qoQda.js.map → PkToolShareDocument-lTHNZodf.js.map} +1 -1
- package/dist/_chunks/{PkToolShowArtifact-ClYqvIqB.js → PkToolShowArtifact-BNQrM5fY.js} +2 -2
- package/dist/_chunks/{PkToolShowArtifact-ClYqvIqB.js.map → PkToolShowArtifact-BNQrM5fY.js.map} +1 -1
- package/dist/_chunks/{PkToolShowContactForm-C0ABjvtZ.js → PkToolShowContactForm-CvQoLumn.js} +2 -2
- package/dist/_chunks/{PkToolShowContactForm-C0ABjvtZ.js.map → PkToolShowContactForm-CvQoLumn.js.map} +1 -1
- package/dist/_chunks/{PkToolShowDiagram-BZbHtEs5.js → PkToolShowDiagram-COt1Z3q9.js} +2 -2
- package/dist/_chunks/{PkToolShowDiagram-BZbHtEs5.js.map → PkToolShowDiagram-COt1Z3q9.js.map} +1 -1
- package/dist/_chunks/{PkToolShowForm-DUjR-9o1.js → PkToolShowForm-DcPccCEU.js} +2 -2
- package/dist/_chunks/{PkToolShowForm-DUjR-9o1.js.map → PkToolShowForm-DcPccCEU.js.map} +1 -1
- package/dist/_chunks/{PkToolShowImageGallery-CNU2Zvso.js → PkToolShowImageGallery-DefXra8-.js} +2 -2
- package/dist/_chunks/{PkToolShowImageGallery-CNU2Zvso.js.map → PkToolShowImageGallery-DefXra8-.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSources-DhDjNIFa.js → PkToolShowSources-BE3Zv_uz.js} +2 -2
- package/dist/_chunks/{PkToolShowSources-DhDjNIFa.js.map → PkToolShowSources-BE3Zv_uz.js.map} +1 -1
- package/dist/_chunks/{useLightbox-BEEzZ0qT.js → useLightbox-D2Zi-Fpe.js} +72 -13
- package/dist/_chunks/useLightbox-D2Zi-Fpe.js.map +1 -0
- package/dist/ai-elements.es.js +461 -429
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotEmptyState.js +1 -1
- package/dist-vue/PkChatbotFilePreview.js +1 -1
- package/dist-vue/PkChatbotInput.js +1 -1
- package/dist-vue/PkChatbotMessages.js +1 -1
- package/dist-vue/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/{PkChatbot-BtUaZ-LR.js → PkChatbot-BVZgvanv.js} +7 -7
- package/dist-vue/_chunks/{PkChatbot-BtUaZ-LR.js.map → PkChatbot-BVZgvanv.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotEmptyState-DJIkAskP.js → PkChatbotEmptyState-COya3H3C.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotEmptyState-DJIkAskP.js.map → PkChatbotEmptyState-COya3H3C.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotFilePreview-BpVM850N.js → PkChatbotFilePreview-BsvT6orx.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotFilePreview-BpVM850N.js.map → PkChatbotFilePreview-BsvT6orx.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotInput-DzqaW3EE.js → PkChatbotInput-D0KUEkAs.js} +5 -4
- package/dist-vue/_chunks/PkChatbotInput-D0KUEkAs.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotMessages-vkbq5p1X.js → PkChatbotMessages-l-IzEWsN.js} +17 -17
- package/dist-vue/_chunks/{PkChatbotMessages-vkbq5p1X.js.map → PkChatbotMessages-l-IzEWsN.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotSteps-D5yz8lut.js → PkChatbotSteps-_Aqft0em.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotSteps-D5yz8lut.js.map → PkChatbotSteps-_Aqft0em.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewChat-DCPRePrE.js → PkChatbotViewChat-C1uzFQCJ.js} +458 -453
- package/dist-vue/_chunks/PkChatbotViewChat-C1uzFQCJ.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewConversations-BBd3XMmM.js → PkChatbotViewConversations-DjhiHp8-.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewConversations-BBd3XMmM.js.map → PkChatbotViewConversations-DjhiHp8-.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewFiles-BiQzDqJg.js → PkChatbotViewFiles-CtOhnFCc.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewFiles-BiQzDqJg.js.map → PkChatbotViewFiles-CtOhnFCc.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewProfile-7266UiRM.js → PkChatbotViewProfile-NfTamy9j.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewProfile-7266UiRM.js.map → PkChatbotViewProfile-NfTamy9j.js.map} +1 -1
- package/dist-vue/_chunks/{PkFilePreview-DLo9nI2g.js → PkFilePreview-C2VOU99H.js} +469 -466
- package/dist-vue/_chunks/PkFilePreview-C2VOU99H.js.map +1 -0
- package/dist-vue/_chunks/{PkFilePreviewDialog-CgDJQgIJ.js → PkFilePreviewDialog-C6QQMntW.js} +2 -2
- package/dist-vue/_chunks/{PkFilePreviewDialog-CgDJQgIJ.js.map → PkFilePreviewDialog-C6QQMntW.js.map} +1 -1
- package/dist-vue/_chunks/{PkStreamingMarkdown-C3UGCEXm.js → PkStreamingMarkdown-2FN4WMQD.js} +2 -2
- package/dist-vue/_chunks/{PkStreamingMarkdown-C3UGCEXm.js.map → PkStreamingMarkdown-2FN4WMQD.js.map} +1 -1
- package/dist-vue/_chunks/{PkSvgViewer-DmkElalq.js → PkSvgViewer-BsdSOBpH.js} +2 -2
- package/dist-vue/_chunks/{PkSvgViewer-DmkElalq.js.map → PkSvgViewer-BsdSOBpH.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolChatFile-Dy0rGC29.js → PkToolChatFile-DAT1tv52.js} +2 -2
- package/dist-vue/_chunks/{PkToolChatFile-Dy0rGC29.js.map → PkToolChatFile-DAT1tv52.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShareDocument-BIZkgcJ3.js → PkToolShareDocument-Qb2Lu5vh.js} +2 -2
- package/dist-vue/_chunks/{PkToolShareDocument-BIZkgcJ3.js.map → PkToolShareDocument-Qb2Lu5vh.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowArtifact-B7udnhpb.js → PkToolShowArtifact-Bskomw05.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowArtifact-B7udnhpb.js.map → PkToolShowArtifact-Bskomw05.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowContactForm-0SEgxn2S.js → PkToolShowContactForm-iQrlqv7j.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowContactForm-0SEgxn2S.js.map → PkToolShowContactForm-iQrlqv7j.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowDiagram-BqHBhZgd.js → PkToolShowDiagram-C-43uUoh.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowDiagram-BqHBhZgd.js.map → PkToolShowDiagram-C-43uUoh.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowForm-C4n_3mFL.js → PkToolShowForm-CKXpqQxy.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowForm-C4n_3mFL.js.map → PkToolShowForm-CKXpqQxy.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowImageGallery-DEpdtLns.js → PkToolShowImageGallery-DLTn6JmU.js} +3 -3
- package/dist-vue/_chunks/{PkToolShowImageGallery-DEpdtLns.js.map → PkToolShowImageGallery-DLTn6JmU.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowLocation-DCPaDtBI.js → PkToolShowLocation-B8FE_Sqd.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowLocation-DCPaDtBI.js.map → PkToolShowLocation-B8FE_Sqd.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowProductList-Bm2NLUGS.js → PkToolShowProductList-hhSBAQVC.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowProductList-Bm2NLUGS.js.map → PkToolShowProductList-hhSBAQVC.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSources-DwFqlit2.js → PkToolShowSources-BiP9fVV2.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowSources-DwFqlit2.js.map → PkToolShowSources-BiP9fVV2.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowVideo-BLEJ8tng.js → PkToolShowVideo-DJhsbDuX.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowVideo-BLEJ8tng.js.map → PkToolShowVideo-DJhsbDuX.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowWebPages-CeAXllAF.js → PkToolShowWebPages-BAv66f5H.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowWebPages-CeAXllAF.js.map → PkToolShowWebPages-BAv66f5H.js.map} +1 -1
- package/dist-vue/_chunks/{createChatbotApiClient-BPN6cLGF.js → createChatbotApiClient-DO4_I5hT.js} +8 -1
- package/dist-vue/_chunks/createChatbotApiClient-DO4_I5hT.js.map +1 -0
- package/dist-vue/_chunks/{useChatbotStore-C4xhJtrb.js → useChatbotStore-BZ1n3Hyx.js} +662 -649
- package/dist-vue/_chunks/useChatbotStore-BZ1n3Hyx.js.map +1 -0
- package/dist-vue/_chunks/{useLightbox-gSzoBgNv.js → useLightbox-FDyQrPWe.js} +72 -13
- package/dist-vue/_chunks/useLightbox-FDyQrPWe.js.map +1 -0
- package/dist-vue/api.js +1 -1
- package/dist-vue/composables.js +8 -2
- package/dist-vue/composables.js.map +1 -1
- package/dist-vue/index.js +25 -25
- package/dist-vue/locales.js +6 -0
- package/dist-vue/packages/components/src/chat/PkChatbotInput.d.ts +2 -0
- package/dist-vue/packages/composable/src/chatbot/api/createChatbotApiClient.d.ts +6 -0
- package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +4 -1
- package/package.json +1 -1
- package/dist/_chunks/PkFilePreview-BIFkMsAC.js.map +0 -1
- package/dist/_chunks/useLightbox-BEEzZ0qT.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotInput-DzqaW3EE.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotViewChat-DCPRePrE.js.map +0 -1
- package/dist-vue/_chunks/PkFilePreview-DLo9nI2g.js.map +0 -1
- package/dist-vue/_chunks/createChatbotApiClient-BPN6cLGF.js.map +0 -1
- package/dist-vue/_chunks/useChatbotStore-C4xhJtrb.js.map +0 -1
- package/dist-vue/_chunks/useLightbox-gSzoBgNv.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { C as e, D as t, O as n, S as r, _ as i, a, g as o, h as s, i as c, l, m as u, o as d, p as f, r as p, s as m, u as h, v as g, w as _, x as v } from "./schemas-BO5QlXAp.js";
|
|
2
2
|
import { Q as ee, V as y, X as te, Y as ne, at as re, et as ie, it as ae, rt as oe } from "./Agent-Cm1LrkYm.js";
|
|
3
|
-
import { r as se, t as ce } from "./createChatbotApiClient-
|
|
3
|
+
import { r as se, t as ce } from "./createChatbotApiClient-DO4_I5hT.js";
|
|
4
4
|
import { n as le } from "./src-nb8MU1sh.js";
|
|
5
5
|
import { d as ue, r as de } from "./message-DuibQyHy.js";
|
|
6
6
|
import { n as fe, t as pe } from "./useSafeLocalStorage-Bn4SsL8C.js";
|
|
@@ -532,7 +532,7 @@ function P() {
|
|
|
532
532
|
}
|
|
533
533
|
function St(e, t) {
|
|
534
534
|
let n = { type: "array" };
|
|
535
|
-
return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items =
|
|
535
|
+
return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = J(e.type._def, {
|
|
536
536
|
...t,
|
|
537
537
|
currentPath: [...t.currentPath, "items"]
|
|
538
538
|
})), e.minLength && (n.minItems = e.minLength.value), e.maxLength && (n.maxItems = e.maxLength.value), e.exactLength && (n.minItems = e.exactLength.value, n.maxItems = e.exactLength.value), n;
|
|
@@ -558,9 +558,9 @@ function wt() {
|
|
|
558
558
|
return { type: "boolean" };
|
|
559
559
|
}
|
|
560
560
|
function Tt(e, t) {
|
|
561
|
-
return
|
|
561
|
+
return J(e.type._def, t);
|
|
562
562
|
}
|
|
563
|
-
var F = (e, t) =>
|
|
563
|
+
var F = (e, t) => J(e.innerType._def, t);
|
|
564
564
|
function Et(e, t, n) {
|
|
565
565
|
let r = n ?? t.dateStrategy;
|
|
566
566
|
if (Array.isArray(r)) return { anyOf: r.map((n) => Et(e, t, n)) };
|
|
@@ -592,12 +592,12 @@ var Dt = (e) => {
|
|
|
592
592
|
};
|
|
593
593
|
function Ot(e, t) {
|
|
594
594
|
return {
|
|
595
|
-
...
|
|
595
|
+
...J(e.innerType._def, t),
|
|
596
596
|
default: e.defaultValue()
|
|
597
597
|
};
|
|
598
598
|
}
|
|
599
599
|
function I(e, t) {
|
|
600
|
-
return t.effectStrategy === "input" ?
|
|
600
|
+
return t.effectStrategy === "input" ? J(e.schema._def, t) : P();
|
|
601
601
|
}
|
|
602
602
|
function L(e) {
|
|
603
603
|
return {
|
|
@@ -607,14 +607,14 @@ function L(e) {
|
|
|
607
607
|
}
|
|
608
608
|
var R = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
|
|
609
609
|
function kt(e, t) {
|
|
610
|
-
let n = [
|
|
610
|
+
let n = [J(e.left._def, {
|
|
611
611
|
...t,
|
|
612
612
|
currentPath: [
|
|
613
613
|
...t.currentPath,
|
|
614
614
|
"allOf",
|
|
615
615
|
"0"
|
|
616
616
|
]
|
|
617
|
-
}),
|
|
617
|
+
}), J(e.right._def, {
|
|
618
618
|
...t,
|
|
619
619
|
currentPath: [
|
|
620
620
|
...t.currentPath,
|
|
@@ -812,7 +812,7 @@ function Ft(e, t) {
|
|
|
812
812
|
function It(e, t) {
|
|
813
813
|
let n = {
|
|
814
814
|
type: "object",
|
|
815
|
-
additionalProperties:
|
|
815
|
+
additionalProperties: J(e.valueType._def, {
|
|
816
816
|
...t,
|
|
817
817
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
818
818
|
}) ?? t.allowedAdditionalProperties
|
|
@@ -843,7 +843,7 @@ function Lt(e, t) {
|
|
|
843
843
|
maxItems: 125,
|
|
844
844
|
items: {
|
|
845
845
|
type: "array",
|
|
846
|
-
items: [
|
|
846
|
+
items: [J(e.keyType._def, {
|
|
847
847
|
...t,
|
|
848
848
|
currentPath: [
|
|
849
849
|
...t.currentPath,
|
|
@@ -851,7 +851,7 @@ function Lt(e, t) {
|
|
|
851
851
|
"items",
|
|
852
852
|
"0"
|
|
853
853
|
]
|
|
854
|
-
}) || P(),
|
|
854
|
+
}) || P(), J(e.valueType._def, {
|
|
855
855
|
...t,
|
|
856
856
|
currentPath: [
|
|
857
857
|
...t.currentPath,
|
|
@@ -920,7 +920,7 @@ function Vt(e, t) {
|
|
|
920
920
|
return Ht(e, t);
|
|
921
921
|
}
|
|
922
922
|
var Ht = (e, t) => {
|
|
923
|
-
let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) =>
|
|
923
|
+
let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => J(e._def, {
|
|
924
924
|
...t,
|
|
925
925
|
currentPath: [
|
|
926
926
|
...t.currentPath,
|
|
@@ -930,7 +930,7 @@ var Ht = (e, t) => {
|
|
|
930
930
|
})).filter((e) => !!e && (!t.strictUnions || typeof e == "object" && Object.keys(e).length > 0));
|
|
931
931
|
return n.length ? { anyOf: n } : void 0;
|
|
932
932
|
};
|
|
933
|
-
function
|
|
933
|
+
function W(e, t) {
|
|
934
934
|
if ([
|
|
935
935
|
"ZodString",
|
|
936
936
|
"ZodNumber",
|
|
@@ -938,7 +938,7 @@ function Ut(e, t) {
|
|
|
938
938
|
"ZodBoolean",
|
|
939
939
|
"ZodNull"
|
|
940
940
|
].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [Bt[e.innerType._def.typeName], "null"] };
|
|
941
|
-
let n =
|
|
941
|
+
let n = J(e.innerType._def, {
|
|
942
942
|
...t,
|
|
943
943
|
currentPath: [
|
|
944
944
|
...t.currentPath,
|
|
@@ -948,7 +948,7 @@ function Ut(e, t) {
|
|
|
948
948
|
});
|
|
949
949
|
return n && { anyOf: [n, { type: "null" }] };
|
|
950
950
|
}
|
|
951
|
-
function
|
|
951
|
+
function Ut(e) {
|
|
952
952
|
let t = { type: "number" };
|
|
953
953
|
if (!e.checks) return t;
|
|
954
954
|
for (let n of e.checks) switch (n.kind) {
|
|
@@ -965,7 +965,7 @@ function Wt(e) {
|
|
|
965
965
|
}
|
|
966
966
|
return t;
|
|
967
967
|
}
|
|
968
|
-
function
|
|
968
|
+
function Wt(e, t) {
|
|
969
969
|
let n = {
|
|
970
970
|
type: "object",
|
|
971
971
|
properties: {}
|
|
@@ -973,7 +973,7 @@ function Gt(e, t) {
|
|
|
973
973
|
for (let e in i) {
|
|
974
974
|
let a = i[e];
|
|
975
975
|
if (a === void 0 || a._def === void 0) continue;
|
|
976
|
-
let o =
|
|
976
|
+
let o = Kt(a), s = J(a._def, {
|
|
977
977
|
...t,
|
|
978
978
|
currentPath: [
|
|
979
979
|
...t.currentPath,
|
|
@@ -989,11 +989,11 @@ function Gt(e, t) {
|
|
|
989
989
|
s !== void 0 && (n.properties[e] = s, o || r.push(e));
|
|
990
990
|
}
|
|
991
991
|
r.length && (n.required = r);
|
|
992
|
-
let a =
|
|
992
|
+
let a = Gt(e, t);
|
|
993
993
|
return a !== void 0 && (n.additionalProperties = a), n;
|
|
994
994
|
}
|
|
995
|
-
function
|
|
996
|
-
if (e.catchall._def.typeName !== "ZodNever") return
|
|
995
|
+
function Gt(e, t) {
|
|
996
|
+
if (e.catchall._def.typeName !== "ZodNever") return J(e.catchall._def, {
|
|
997
997
|
...t,
|
|
998
998
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
999
999
|
});
|
|
@@ -1003,16 +1003,16 @@ function Kt(e, t) {
|
|
|
1003
1003
|
case "strip": return t.removeAdditionalStrategy === "strict" ? t.allowedAdditionalProperties : t.rejectedAdditionalProperties;
|
|
1004
1004
|
}
|
|
1005
1005
|
}
|
|
1006
|
-
function
|
|
1006
|
+
function Kt(e) {
|
|
1007
1007
|
try {
|
|
1008
1008
|
return e.isOptional();
|
|
1009
1009
|
} catch {
|
|
1010
1010
|
return !0;
|
|
1011
1011
|
}
|
|
1012
1012
|
}
|
|
1013
|
-
var
|
|
1014
|
-
if (t.currentPath.toString() === t.propertyPath?.toString()) return
|
|
1015
|
-
let n =
|
|
1013
|
+
var qt = (e, t) => {
|
|
1014
|
+
if (t.currentPath.toString() === t.propertyPath?.toString()) return J(e.innerType._def, t);
|
|
1015
|
+
let n = J(e.innerType._def, {
|
|
1016
1016
|
...t,
|
|
1017
1017
|
currentPath: [
|
|
1018
1018
|
...t.currentPath,
|
|
@@ -1021,10 +1021,10 @@ var Jt = (e, t) => {
|
|
|
1021
1021
|
]
|
|
1022
1022
|
});
|
|
1023
1023
|
return n ? { anyOf: [{ not: P() }, n] } : P();
|
|
1024
|
-
},
|
|
1025
|
-
if (t.pipeStrategy === "input") return
|
|
1026
|
-
if (t.pipeStrategy === "output") return
|
|
1027
|
-
let n =
|
|
1024
|
+
}, Jt = (e, t) => {
|
|
1025
|
+
if (t.pipeStrategy === "input") return J(e.in._def, t);
|
|
1026
|
+
if (t.pipeStrategy === "output") return J(e.out._def, t);
|
|
1027
|
+
let n = J(e.in._def, {
|
|
1028
1028
|
...t,
|
|
1029
1029
|
currentPath: [
|
|
1030
1030
|
...t.currentPath,
|
|
@@ -1032,7 +1032,7 @@ var Jt = (e, t) => {
|
|
|
1032
1032
|
"0"
|
|
1033
1033
|
]
|
|
1034
1034
|
});
|
|
1035
|
-
return { allOf: [n,
|
|
1035
|
+
return { allOf: [n, J(e.out._def, {
|
|
1036
1036
|
...t,
|
|
1037
1037
|
currentPath: [
|
|
1038
1038
|
...t.currentPath,
|
|
@@ -1041,25 +1041,25 @@ var Jt = (e, t) => {
|
|
|
1041
1041
|
]
|
|
1042
1042
|
})].filter((e) => e !== void 0) };
|
|
1043
1043
|
};
|
|
1044
|
-
function
|
|
1045
|
-
return
|
|
1044
|
+
function Yt(e, t) {
|
|
1045
|
+
return J(e.type._def, t);
|
|
1046
1046
|
}
|
|
1047
|
-
function
|
|
1047
|
+
function Xt(e, t) {
|
|
1048
1048
|
let n = {
|
|
1049
1049
|
type: "array",
|
|
1050
1050
|
uniqueItems: !0,
|
|
1051
|
-
items:
|
|
1051
|
+
items: J(e.valueType._def, {
|
|
1052
1052
|
...t,
|
|
1053
1053
|
currentPath: [...t.currentPath, "items"]
|
|
1054
1054
|
})
|
|
1055
1055
|
};
|
|
1056
1056
|
return e.minSize && (n.minItems = e.minSize.value), e.maxSize && (n.maxItems = e.maxSize.value), n;
|
|
1057
1057
|
}
|
|
1058
|
-
function
|
|
1058
|
+
function Zt(e, t) {
|
|
1059
1059
|
return e.rest ? {
|
|
1060
1060
|
type: "array",
|
|
1061
1061
|
minItems: e.items.length,
|
|
1062
|
-
items: e.items.map((e, n) =>
|
|
1062
|
+
items: e.items.map((e, n) => J(e._def, {
|
|
1063
1063
|
...t,
|
|
1064
1064
|
currentPath: [
|
|
1065
1065
|
...t.currentPath,
|
|
@@ -1067,7 +1067,7 @@ function Qt(e, t) {
|
|
|
1067
1067
|
`${n}`
|
|
1068
1068
|
]
|
|
1069
1069
|
})).reduce((e, t) => t === void 0 ? e : [...e, t], []),
|
|
1070
|
-
additionalItems:
|
|
1070
|
+
additionalItems: J(e.rest._def, {
|
|
1071
1071
|
...t,
|
|
1072
1072
|
currentPath: [...t.currentPath, "additionalItems"]
|
|
1073
1073
|
})
|
|
@@ -1075,7 +1075,7 @@ function Qt(e, t) {
|
|
|
1075
1075
|
type: "array",
|
|
1076
1076
|
minItems: e.items.length,
|
|
1077
1077
|
maxItems: e.items.length,
|
|
1078
|
-
items: e.items.map((e, n) =>
|
|
1078
|
+
items: e.items.map((e, n) => J(e._def, {
|
|
1079
1079
|
...t,
|
|
1080
1080
|
currentPath: [
|
|
1081
1081
|
...t.currentPath,
|
|
@@ -1085,47 +1085,47 @@ function Qt(e, t) {
|
|
|
1085
1085
|
})).reduce((e, t) => t === void 0 ? e : [...e, t], [])
|
|
1086
1086
|
};
|
|
1087
1087
|
}
|
|
1088
|
-
function
|
|
1088
|
+
function Qt() {
|
|
1089
1089
|
return { not: P() };
|
|
1090
1090
|
}
|
|
1091
|
-
function
|
|
1091
|
+
function $t() {
|
|
1092
1092
|
return P();
|
|
1093
1093
|
}
|
|
1094
|
-
var
|
|
1094
|
+
var G = (e, t) => J(e.innerType._def, t), K = (e, t, n) => {
|
|
1095
1095
|
switch (t) {
|
|
1096
1096
|
case "ZodString": return Mt(e, n);
|
|
1097
|
-
case "ZodNumber": return
|
|
1098
|
-
case "ZodObject": return
|
|
1097
|
+
case "ZodNumber": return Ut(e);
|
|
1098
|
+
case "ZodObject": return Wt(e, n);
|
|
1099
1099
|
case "ZodBigInt": return Ct(e);
|
|
1100
1100
|
case "ZodBoolean": return wt();
|
|
1101
1101
|
case "ZodDate": return Et(e, n);
|
|
1102
|
-
case "ZodUndefined": return
|
|
1102
|
+
case "ZodUndefined": return Qt();
|
|
1103
1103
|
case "ZodNull": return zt();
|
|
1104
1104
|
case "ZodArray": return St(e, n);
|
|
1105
1105
|
case "ZodUnion":
|
|
1106
1106
|
case "ZodDiscriminatedUnion": return Vt(e, n);
|
|
1107
1107
|
case "ZodIntersection": return kt(e, n);
|
|
1108
|
-
case "ZodTuple": return
|
|
1108
|
+
case "ZodTuple": return Zt(e, n);
|
|
1109
1109
|
case "ZodRecord": return It(e, n);
|
|
1110
1110
|
case "ZodLiteral": return At(e);
|
|
1111
1111
|
case "ZodEnum": return L(e);
|
|
1112
1112
|
case "ZodNativeEnum": return U(e);
|
|
1113
|
-
case "ZodNullable": return
|
|
1114
|
-
case "ZodOptional": return
|
|
1113
|
+
case "ZodNullable": return W(e, n);
|
|
1114
|
+
case "ZodOptional": return qt(e, n);
|
|
1115
1115
|
case "ZodMap": return Lt(e, n);
|
|
1116
|
-
case "ZodSet": return
|
|
1116
|
+
case "ZodSet": return Xt(e, n);
|
|
1117
1117
|
case "ZodLazy": return () => e.getter()._def;
|
|
1118
|
-
case "ZodPromise": return
|
|
1118
|
+
case "ZodPromise": return Yt(e, n);
|
|
1119
1119
|
case "ZodNaN":
|
|
1120
1120
|
case "ZodNever": return Rt();
|
|
1121
1121
|
case "ZodEffects": return I(e, n);
|
|
1122
1122
|
case "ZodAny": return P();
|
|
1123
|
-
case "ZodUnknown": return
|
|
1123
|
+
case "ZodUnknown": return $t();
|
|
1124
1124
|
case "ZodDefault": return Ot(e, n);
|
|
1125
1125
|
case "ZodBranded": return Tt(e, n);
|
|
1126
|
-
case "ZodReadonly": return
|
|
1126
|
+
case "ZodReadonly": return G(e, n);
|
|
1127
1127
|
case "ZodCatch": return F(e, n);
|
|
1128
|
-
case "ZodPipeline": return
|
|
1128
|
+
case "ZodPipeline": return Jt(e, n);
|
|
1129
1129
|
case "ZodFunction":
|
|
1130
1130
|
case "ZodVoid":
|
|
1131
1131
|
case "ZodSymbol": return;
|
|
@@ -1133,19 +1133,19 @@ var W = (e, t) => q(e.innerType._def, t), G = (e, t, n) => {
|
|
|
1133
1133
|
/* c8 ignore next */
|
|
1134
1134
|
return ((e) => void 0)(t);
|
|
1135
1135
|
}
|
|
1136
|
-
},
|
|
1136
|
+
}, q = (e, t) => {
|
|
1137
1137
|
let n = 0;
|
|
1138
1138
|
for (; n < e.length && n < t.length && e[n] === t[n]; n++);
|
|
1139
1139
|
return [(e.length - n).toString(), ...t.slice(n)].join("/");
|
|
1140
1140
|
};
|
|
1141
|
-
function
|
|
1141
|
+
function J(e, t, n = !1) {
|
|
1142
1142
|
let r = t.seen.get(e);
|
|
1143
1143
|
if (t.override) {
|
|
1144
1144
|
let i = t.override?.(e, t, r, n);
|
|
1145
1145
|
if (i !== yt) return i;
|
|
1146
1146
|
}
|
|
1147
1147
|
if (r && !n) {
|
|
1148
|
-
let e =
|
|
1148
|
+
let e = en(r, t);
|
|
1149
1149
|
if (e !== void 0) return e;
|
|
1150
1150
|
}
|
|
1151
1151
|
let i = {
|
|
@@ -1154,21 +1154,21 @@ function q(e, t, n = !1) {
|
|
|
1154
1154
|
jsonSchema: void 0
|
|
1155
1155
|
};
|
|
1156
1156
|
t.seen.set(e, i);
|
|
1157
|
-
let a =
|
|
1158
|
-
if (o &&
|
|
1157
|
+
let a = K(e, e.typeName, t), o = typeof a == "function" ? J(a(), t) : a;
|
|
1158
|
+
if (o && tn(e, t, o), t.postProcess) {
|
|
1159
1159
|
let n = t.postProcess(o, e, t);
|
|
1160
1160
|
return i.jsonSchema = o, n;
|
|
1161
1161
|
}
|
|
1162
1162
|
return i.jsonSchema = o, o;
|
|
1163
1163
|
}
|
|
1164
|
-
var
|
|
1164
|
+
var en = (e, t) => {
|
|
1165
1165
|
switch (t.$refStrategy) {
|
|
1166
1166
|
case "root": return { $ref: e.path.join("/") };
|
|
1167
|
-
case "relative": return { $ref:
|
|
1167
|
+
case "relative": return { $ref: q(t.currentPath, e.path) };
|
|
1168
1168
|
case "none":
|
|
1169
1169
|
case "seen": return e.path.length < t.currentPath.length && e.path.every((e, n) => t.currentPath[n] === e) ? (console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`), P()) : t.$refStrategy === "seen" ? P() : void 0;
|
|
1170
1170
|
}
|
|
1171
|
-
},
|
|
1171
|
+
}, tn = (e, t, n) => (e.description && (n.description = e.description), n), nn = (e) => {
|
|
1172
1172
|
let t = xt(e), n = t.name === void 0 ? t.basePath : [
|
|
1173
1173
|
...t.basePath,
|
|
1174
1174
|
t.definitionPath,
|
|
@@ -1188,10 +1188,10 @@ var tn = (e, t) => {
|
|
|
1188
1188
|
jsonSchema: void 0
|
|
1189
1189
|
}]))
|
|
1190
1190
|
};
|
|
1191
|
-
},
|
|
1192
|
-
let n =
|
|
1191
|
+
}, rn = (e, t) => {
|
|
1192
|
+
let n = nn(t), r = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((e, [t, r]) => ({
|
|
1193
1193
|
...e,
|
|
1194
|
-
[t]:
|
|
1194
|
+
[t]: J(r._def, {
|
|
1195
1195
|
...n,
|
|
1196
1196
|
currentPath: [
|
|
1197
1197
|
...n.basePath,
|
|
@@ -1199,7 +1199,7 @@ var tn = (e, t) => {
|
|
|
1199
1199
|
t
|
|
1200
1200
|
]
|
|
1201
1201
|
}, !0) ?? P()
|
|
1202
|
-
}), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a =
|
|
1202
|
+
}), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = J(e._def, i === void 0 ? n : {
|
|
1203
1203
|
...n,
|
|
1204
1204
|
currentPath: [
|
|
1205
1205
|
...n.basePath,
|
|
@@ -1223,14 +1223,14 @@ var tn = (e, t) => {
|
|
|
1223
1223
|
}
|
|
1224
1224
|
};
|
|
1225
1225
|
return s.$schema = "http://json-schema.org/draft-07/schema#", s;
|
|
1226
|
-
},
|
|
1227
|
-
function
|
|
1226
|
+
}, an = Symbol.for("vercel.ai.schema");
|
|
1227
|
+
function on(e) {
|
|
1228
1228
|
let t;
|
|
1229
1229
|
return () => (t ??= e(), t);
|
|
1230
1230
|
}
|
|
1231
|
-
function
|
|
1231
|
+
function sn(e, { validate: t } = {}) {
|
|
1232
1232
|
return {
|
|
1233
|
-
[
|
|
1233
|
+
[an]: !0,
|
|
1234
1234
|
_type: void 0,
|
|
1235
1235
|
get jsonSchema() {
|
|
1236
1236
|
return typeof e == "function" && (e = e()), e;
|
|
@@ -1238,19 +1238,19 @@ function cn(e, { validate: t } = {}) {
|
|
|
1238
1238
|
validate: t
|
|
1239
1239
|
};
|
|
1240
1240
|
}
|
|
1241
|
-
function
|
|
1242
|
-
return typeof e == "object" && !!e &&
|
|
1241
|
+
function cn(e) {
|
|
1242
|
+
return typeof e == "object" && !!e && an in e && e[an] === !0 && "jsonSchema" in e && "validate" in e;
|
|
1243
1243
|
}
|
|
1244
|
-
function
|
|
1245
|
-
return e == null ?
|
|
1244
|
+
function ln(e) {
|
|
1245
|
+
return e == null ? sn({
|
|
1246
1246
|
type: "object",
|
|
1247
1247
|
properties: {},
|
|
1248
1248
|
additionalProperties: !1
|
|
1249
|
-
}) :
|
|
1249
|
+
}) : cn(e) ? e : "~standard" in e ? e["~standard"].vendor === "zod" ? hn(e) : un(e) : e();
|
|
1250
1250
|
}
|
|
1251
|
-
function
|
|
1252
|
-
return
|
|
1253
|
-
if (!
|
|
1251
|
+
function un(e) {
|
|
1252
|
+
return sn(() => {
|
|
1253
|
+
if (!dn(e)) throw Error(`Standard schema vendor '${e["~standard"].vendor}' does not support JSON Schema conversion.`);
|
|
1254
1254
|
return vt(e["~standard"].jsonSchema.input({ target: "draft-07" }));
|
|
1255
1255
|
}, { validate: async (t) => {
|
|
1256
1256
|
let n = await e["~standard"].validate(t);
|
|
@@ -1266,12 +1266,12 @@ function dn(e) {
|
|
|
1266
1266
|
};
|
|
1267
1267
|
} });
|
|
1268
1268
|
}
|
|
1269
|
-
function
|
|
1269
|
+
function dn(e) {
|
|
1270
1270
|
return e["~standard"].jsonSchema != null;
|
|
1271
1271
|
}
|
|
1272
|
-
function
|
|
1272
|
+
function fn(e, t) {
|
|
1273
1273
|
let n = t?.useReferences ?? !1;
|
|
1274
|
-
return
|
|
1274
|
+
return sn(() => rn(e, { $refStrategy: n ? "root" : "none" }), { validate: async (t) => {
|
|
1275
1275
|
let n = await e.safeParseAsync(t);
|
|
1276
1276
|
return n.success ? {
|
|
1277
1277
|
success: !0,
|
|
@@ -1282,9 +1282,9 @@ function pn(e, t) {
|
|
|
1282
1282
|
};
|
|
1283
1283
|
} });
|
|
1284
1284
|
}
|
|
1285
|
-
function
|
|
1285
|
+
function pn(e, r) {
|
|
1286
1286
|
let i = r?.useReferences ?? !1;
|
|
1287
|
-
return
|
|
1287
|
+
return sn(() => vt(n(e, {
|
|
1288
1288
|
target: "draft-7",
|
|
1289
1289
|
io: "input",
|
|
1290
1290
|
reused: i ? "ref" : "inline"
|
|
@@ -1299,14 +1299,14 @@ function mn(e, r) {
|
|
|
1299
1299
|
};
|
|
1300
1300
|
} });
|
|
1301
1301
|
}
|
|
1302
|
-
function
|
|
1302
|
+
function mn(e) {
|
|
1303
1303
|
return "_zod" in e;
|
|
1304
1304
|
}
|
|
1305
|
-
function
|
|
1306
|
-
return
|
|
1305
|
+
function hn(e, t) {
|
|
1306
|
+
return mn(e) ? pn(e, t) : fn(e, t);
|
|
1307
1307
|
}
|
|
1308
|
-
async function
|
|
1309
|
-
let r = await
|
|
1308
|
+
async function gn({ value: e, schema: t, context: n }) {
|
|
1309
|
+
let r = await _n({
|
|
1310
1310
|
value: e,
|
|
1311
1311
|
schema: t,
|
|
1312
1312
|
context: n
|
|
@@ -1318,8 +1318,8 @@ async function _n({ value: e, schema: t, context: n }) {
|
|
|
1318
1318
|
});
|
|
1319
1319
|
return r.value;
|
|
1320
1320
|
}
|
|
1321
|
-
async function
|
|
1322
|
-
let r =
|
|
1321
|
+
async function _n({ value: e, schema: t, context: n }) {
|
|
1322
|
+
let r = ln(t);
|
|
1323
1323
|
try {
|
|
1324
1324
|
if (r.validate == null) return {
|
|
1325
1325
|
success: !0,
|
|
@@ -1352,14 +1352,14 @@ async function vn({ value: e, schema: t, context: n }) {
|
|
|
1352
1352
|
};
|
|
1353
1353
|
}
|
|
1354
1354
|
}
|
|
1355
|
-
async function
|
|
1355
|
+
async function vn({ text: e, schema: t }) {
|
|
1356
1356
|
try {
|
|
1357
1357
|
let n = M(e);
|
|
1358
1358
|
return t == null ? {
|
|
1359
1359
|
success: !0,
|
|
1360
1360
|
value: n,
|
|
1361
1361
|
rawValue: n
|
|
1362
|
-
} : await
|
|
1362
|
+
} : await _n({
|
|
1363
1363
|
value: n,
|
|
1364
1364
|
schema: t
|
|
1365
1365
|
});
|
|
@@ -1374,41 +1374,41 @@ async function yn({ text: e, schema: t }) {
|
|
|
1374
1374
|
};
|
|
1375
1375
|
}
|
|
1376
1376
|
}
|
|
1377
|
-
function
|
|
1377
|
+
function yn({ stream: e, schema: t }) {
|
|
1378
1378
|
return e.pipeThrough(new TextDecoderStream()).pipeThrough(new lt()).pipeThrough(new TransformStream({ async transform({ data: e }, n) {
|
|
1379
|
-
e !== "[DONE]" && n.enqueue(await
|
|
1379
|
+
e !== "[DONE]" && n.enqueue(await vn({
|
|
1380
1380
|
text: e,
|
|
1381
1381
|
schema: t
|
|
1382
1382
|
}));
|
|
1383
1383
|
} }));
|
|
1384
1384
|
}
|
|
1385
|
-
async function
|
|
1385
|
+
async function bn(e) {
|
|
1386
1386
|
return typeof e == "function" && (e = e()), e;
|
|
1387
1387
|
}
|
|
1388
1388
|
new TextDecoder();
|
|
1389
1389
|
// ../../node_modules/.pnpm/ai@7.0.154_zod@4.6.7/node_modules/ai/dist/index.js
|
|
1390
|
-
var
|
|
1390
|
+
var xn = "AI_InvalidArgumentError", Y = `vercel.ai.error.${xn}`, Sn = Symbol.for(Y), Cn = class extends w {
|
|
1391
1391
|
constructor({ parameter: e, value: t, message: n }) {
|
|
1392
1392
|
super({
|
|
1393
|
-
name:
|
|
1393
|
+
name: xn,
|
|
1394
1394
|
message: `Invalid argument for parameter ${e}: ${n}`
|
|
1395
|
-
}), this[
|
|
1395
|
+
}), this[Sn] = !0, this.parameter = e, this.value = t;
|
|
1396
1396
|
}
|
|
1397
1397
|
static isInstance(e) {
|
|
1398
|
-
return w.hasMarker(e,
|
|
1398
|
+
return w.hasMarker(e, Y);
|
|
1399
1399
|
}
|
|
1400
|
-
},
|
|
1400
|
+
}, wn = "AI_UIMessageStreamError", Tn = `vercel.ai.error.${wn}`, En = Symbol.for(Tn), Dn = class extends w {
|
|
1401
1401
|
constructor({ chunkType: e, chunkId: t, message: n }) {
|
|
1402
1402
|
super({
|
|
1403
|
-
name:
|
|
1403
|
+
name: wn,
|
|
1404
1404
|
message: n
|
|
1405
|
-
}), this[
|
|
1405
|
+
}), this[En] = !0, this.chunkType = e, this.chunkId = t;
|
|
1406
1406
|
}
|
|
1407
1407
|
static isInstance(e) {
|
|
1408
|
-
return w.hasMarker(e,
|
|
1408
|
+
return w.hasMarker(e, Tn);
|
|
1409
1409
|
}
|
|
1410
1410
|
};
|
|
1411
|
-
function
|
|
1411
|
+
function On(e, t) {
|
|
1412
1412
|
if (e === void 0 && t === void 0) return;
|
|
1413
1413
|
if (e === void 0) return t;
|
|
1414
1414
|
if (t === void 0) return e;
|
|
@@ -1417,11 +1417,11 @@ function kn(e, t) {
|
|
|
1417
1417
|
let i = t[r];
|
|
1418
1418
|
if (i === void 0) continue;
|
|
1419
1419
|
let a = r in e ? e[r] : void 0, o = typeof i == "object" && !!i && !Array.isArray(i) && !(i instanceof Date) && !(i instanceof RegExp), s = typeof a == "object" && !!a && !Array.isArray(a) && !(a instanceof Date) && !(a instanceof RegExp);
|
|
1420
|
-
n[r] = o && s ?
|
|
1420
|
+
n[r] = o && s ? On(a, i) : i;
|
|
1421
1421
|
}
|
|
1422
1422
|
return n;
|
|
1423
1423
|
}
|
|
1424
|
-
var
|
|
1424
|
+
var X = {
|
|
1425
1425
|
array: d,
|
|
1426
1426
|
boolean: m,
|
|
1427
1427
|
custom: l,
|
|
@@ -1439,230 +1439,230 @@ var Y = {
|
|
|
1439
1439
|
string: r,
|
|
1440
1440
|
union: e,
|
|
1441
1441
|
unknown: _
|
|
1442
|
-
},
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
])),
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
]),
|
|
1455
|
-
type:
|
|
1456
|
-
text:
|
|
1457
|
-
providerOptions:
|
|
1458
|
-
}),
|
|
1459
|
-
type:
|
|
1460
|
-
image:
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1442
|
+
}, kn = X.lazy(() => X.union([
|
|
1443
|
+
X.null(),
|
|
1444
|
+
X.string(),
|
|
1445
|
+
X.number(),
|
|
1446
|
+
X.boolean(),
|
|
1447
|
+
X.record(X.string(), kn.optional()),
|
|
1448
|
+
X.array(kn)
|
|
1449
|
+
])), Z = X.record(X.string(), X.record(X.string(), kn.optional())), An = X.union([
|
|
1450
|
+
X.string(),
|
|
1451
|
+
X.instanceof(Uint8Array),
|
|
1452
|
+
X.instanceof(ArrayBuffer),
|
|
1453
|
+
X.custom(pt, { message: "Must be a Buffer" })
|
|
1454
|
+
]), jn = X.record(X.string(), X.string()), Mn = X.object({
|
|
1455
|
+
type: X.literal("text"),
|
|
1456
|
+
text: X.string(),
|
|
1457
|
+
providerOptions: Z.optional()
|
|
1458
|
+
}), Nn = X.object({
|
|
1459
|
+
type: X.literal("image"),
|
|
1460
|
+
image: X.union([
|
|
1461
|
+
An,
|
|
1462
|
+
X.instanceof(URL),
|
|
1463
|
+
jn
|
|
1464
1464
|
]),
|
|
1465
|
-
mediaType:
|
|
1466
|
-
providerOptions:
|
|
1467
|
-
}),
|
|
1468
|
-
|
|
1469
|
-
type:
|
|
1470
|
-
data:
|
|
1465
|
+
mediaType: X.string().optional(),
|
|
1466
|
+
providerOptions: Z.optional()
|
|
1467
|
+
}), Pn = X.discriminatedUnion("type", [
|
|
1468
|
+
X.object({
|
|
1469
|
+
type: X.literal("data"),
|
|
1470
|
+
data: An
|
|
1471
1471
|
}),
|
|
1472
|
-
|
|
1473
|
-
type:
|
|
1474
|
-
url:
|
|
1472
|
+
X.object({
|
|
1473
|
+
type: X.literal("url"),
|
|
1474
|
+
url: X.instanceof(URL)
|
|
1475
1475
|
}),
|
|
1476
|
-
|
|
1477
|
-
type:
|
|
1478
|
-
reference:
|
|
1476
|
+
X.object({
|
|
1477
|
+
type: X.literal("reference"),
|
|
1478
|
+
reference: jn
|
|
1479
1479
|
}),
|
|
1480
|
-
|
|
1481
|
-
type:
|
|
1482
|
-
text:
|
|
1480
|
+
X.object({
|
|
1481
|
+
type: X.literal("text"),
|
|
1482
|
+
text: X.string()
|
|
1483
1483
|
})
|
|
1484
|
-
]),
|
|
1485
|
-
type:
|
|
1486
|
-
data:
|
|
1487
|
-
}),
|
|
1488
|
-
type:
|
|
1489
|
-
url:
|
|
1490
|
-
})]),
|
|
1491
|
-
type:
|
|
1492
|
-
data:
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1484
|
+
]), Fn = X.discriminatedUnion("type", [X.object({
|
|
1485
|
+
type: X.literal("data"),
|
|
1486
|
+
data: An
|
|
1487
|
+
}), X.object({
|
|
1488
|
+
type: X.literal("url"),
|
|
1489
|
+
url: X.instanceof(URL)
|
|
1490
|
+
})]), In = X.object({
|
|
1491
|
+
type: X.literal("file"),
|
|
1492
|
+
data: X.union([
|
|
1493
|
+
Pn,
|
|
1494
|
+
An,
|
|
1495
|
+
X.instanceof(URL),
|
|
1496
|
+
jn
|
|
1497
1497
|
]),
|
|
1498
|
-
filename:
|
|
1499
|
-
mediaType:
|
|
1500
|
-
providerOptions:
|
|
1501
|
-
}),
|
|
1502
|
-
type:
|
|
1503
|
-
text:
|
|
1504
|
-
providerOptions:
|
|
1505
|
-
}),
|
|
1506
|
-
type:
|
|
1507
|
-
kind:
|
|
1508
|
-
providerOptions:
|
|
1509
|
-
}),
|
|
1510
|
-
type:
|
|
1511
|
-
data:
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1498
|
+
filename: X.string().optional(),
|
|
1499
|
+
mediaType: X.string(),
|
|
1500
|
+
providerOptions: Z.optional()
|
|
1501
|
+
}), Ln = X.object({
|
|
1502
|
+
type: X.literal("reasoning"),
|
|
1503
|
+
text: X.string(),
|
|
1504
|
+
providerOptions: Z.optional()
|
|
1505
|
+
}), Rn = X.object({
|
|
1506
|
+
type: X.literal("custom"),
|
|
1507
|
+
kind: X.string().transform((e) => e),
|
|
1508
|
+
providerOptions: Z.optional()
|
|
1509
|
+
}), zn = X.object({
|
|
1510
|
+
type: X.literal("reasoning-file"),
|
|
1511
|
+
data: X.union([
|
|
1512
|
+
Fn,
|
|
1513
|
+
An,
|
|
1514
|
+
X.instanceof(URL)
|
|
1515
1515
|
]),
|
|
1516
|
-
mediaType:
|
|
1517
|
-
providerOptions:
|
|
1518
|
-
}),
|
|
1519
|
-
type:
|
|
1520
|
-
toolCallId:
|
|
1521
|
-
toolName:
|
|
1522
|
-
input:
|
|
1523
|
-
providerOptions:
|
|
1524
|
-
providerExecuted:
|
|
1525
|
-
}),
|
|
1526
|
-
|
|
1527
|
-
type:
|
|
1528
|
-
value:
|
|
1529
|
-
providerOptions:
|
|
1516
|
+
mediaType: X.string(),
|
|
1517
|
+
providerOptions: Z.optional()
|
|
1518
|
+
}), Bn = X.object({
|
|
1519
|
+
type: X.literal("tool-call"),
|
|
1520
|
+
toolCallId: X.string(),
|
|
1521
|
+
toolName: X.string(),
|
|
1522
|
+
input: X.unknown(),
|
|
1523
|
+
providerOptions: Z.optional(),
|
|
1524
|
+
providerExecuted: X.boolean().optional()
|
|
1525
|
+
}), Vn = X.discriminatedUnion("type", [
|
|
1526
|
+
X.object({
|
|
1527
|
+
type: X.literal("text"),
|
|
1528
|
+
value: X.string(),
|
|
1529
|
+
providerOptions: Z.optional()
|
|
1530
1530
|
}),
|
|
1531
|
-
|
|
1532
|
-
type:
|
|
1533
|
-
value:
|
|
1534
|
-
providerOptions:
|
|
1531
|
+
X.object({
|
|
1532
|
+
type: X.literal("json"),
|
|
1533
|
+
value: kn,
|
|
1534
|
+
providerOptions: Z.optional()
|
|
1535
1535
|
}),
|
|
1536
|
-
|
|
1537
|
-
type:
|
|
1538
|
-
reason:
|
|
1539
|
-
providerOptions:
|
|
1536
|
+
X.object({
|
|
1537
|
+
type: X.literal("execution-denied"),
|
|
1538
|
+
reason: X.string().optional(),
|
|
1539
|
+
providerOptions: Z.optional()
|
|
1540
1540
|
}),
|
|
1541
|
-
|
|
1542
|
-
type:
|
|
1543
|
-
value:
|
|
1544
|
-
providerOptions:
|
|
1541
|
+
X.object({
|
|
1542
|
+
type: X.literal("error-text"),
|
|
1543
|
+
value: X.string(),
|
|
1544
|
+
providerOptions: Z.optional()
|
|
1545
1545
|
}),
|
|
1546
|
-
|
|
1547
|
-
type:
|
|
1548
|
-
value:
|
|
1549
|
-
providerOptions:
|
|
1546
|
+
X.object({
|
|
1547
|
+
type: X.literal("error-json"),
|
|
1548
|
+
value: kn,
|
|
1549
|
+
providerOptions: Z.optional()
|
|
1550
1550
|
}),
|
|
1551
|
-
|
|
1552
|
-
type:
|
|
1553
|
-
value:
|
|
1554
|
-
|
|
1555
|
-
type:
|
|
1556
|
-
text:
|
|
1557
|
-
providerOptions:
|
|
1551
|
+
X.object({
|
|
1552
|
+
type: X.literal("content"),
|
|
1553
|
+
value: X.array(X.union([
|
|
1554
|
+
X.object({
|
|
1555
|
+
type: X.literal("text"),
|
|
1556
|
+
text: X.string(),
|
|
1557
|
+
providerOptions: Z.optional()
|
|
1558
1558
|
}),
|
|
1559
|
-
|
|
1560
|
-
type:
|
|
1561
|
-
data:
|
|
1562
|
-
mediaType:
|
|
1563
|
-
filename:
|
|
1564
|
-
providerOptions:
|
|
1559
|
+
X.object({
|
|
1560
|
+
type: X.literal("file"),
|
|
1561
|
+
data: Pn,
|
|
1562
|
+
mediaType: X.string(),
|
|
1563
|
+
filename: X.string().optional(),
|
|
1564
|
+
providerOptions: Z.optional()
|
|
1565
1565
|
}),
|
|
1566
|
-
|
|
1567
|
-
type:
|
|
1568
|
-
data:
|
|
1569
|
-
mediaType:
|
|
1570
|
-
filename:
|
|
1571
|
-
providerOptions:
|
|
1566
|
+
X.object({
|
|
1567
|
+
type: X.literal("file-data"),
|
|
1568
|
+
data: X.string(),
|
|
1569
|
+
mediaType: X.string(),
|
|
1570
|
+
filename: X.string().optional(),
|
|
1571
|
+
providerOptions: Z.optional()
|
|
1572
1572
|
}),
|
|
1573
|
-
|
|
1574
|
-
type:
|
|
1575
|
-
url:
|
|
1576
|
-
mediaType:
|
|
1577
|
-
providerOptions:
|
|
1573
|
+
X.object({
|
|
1574
|
+
type: X.literal("file-url"),
|
|
1575
|
+
url: X.string(),
|
|
1576
|
+
mediaType: X.string().optional(),
|
|
1577
|
+
providerOptions: Z.optional()
|
|
1578
1578
|
}),
|
|
1579
|
-
|
|
1580
|
-
type:
|
|
1581
|
-
fileId:
|
|
1582
|
-
providerOptions:
|
|
1579
|
+
X.object({
|
|
1580
|
+
type: X.literal("file-id"),
|
|
1581
|
+
fileId: X.union([X.string(), X.record(X.string(), X.string())]),
|
|
1582
|
+
providerOptions: Z.optional()
|
|
1583
1583
|
}),
|
|
1584
|
-
|
|
1585
|
-
type:
|
|
1586
|
-
providerReference:
|
|
1587
|
-
providerOptions:
|
|
1584
|
+
X.object({
|
|
1585
|
+
type: X.literal("file-reference"),
|
|
1586
|
+
providerReference: X.record(X.string(), X.string()),
|
|
1587
|
+
providerOptions: Z.optional()
|
|
1588
1588
|
}),
|
|
1589
|
-
|
|
1590
|
-
type:
|
|
1591
|
-
data:
|
|
1592
|
-
mediaType:
|
|
1593
|
-
providerOptions:
|
|
1589
|
+
X.object({
|
|
1590
|
+
type: X.literal("image-data"),
|
|
1591
|
+
data: X.string(),
|
|
1592
|
+
mediaType: X.string(),
|
|
1593
|
+
providerOptions: Z.optional()
|
|
1594
1594
|
}),
|
|
1595
|
-
|
|
1596
|
-
type:
|
|
1597
|
-
url:
|
|
1598
|
-
providerOptions:
|
|
1595
|
+
X.object({
|
|
1596
|
+
type: X.literal("image-url"),
|
|
1597
|
+
url: X.string(),
|
|
1598
|
+
providerOptions: Z.optional()
|
|
1599
1599
|
}),
|
|
1600
|
-
|
|
1601
|
-
type:
|
|
1602
|
-
fileId:
|
|
1603
|
-
providerOptions:
|
|
1600
|
+
X.object({
|
|
1601
|
+
type: X.literal("image-file-id"),
|
|
1602
|
+
fileId: X.union([X.string(), X.record(X.string(), X.string())]),
|
|
1603
|
+
providerOptions: Z.optional()
|
|
1604
1604
|
}),
|
|
1605
|
-
|
|
1606
|
-
type:
|
|
1607
|
-
providerReference:
|
|
1608
|
-
providerOptions:
|
|
1605
|
+
X.object({
|
|
1606
|
+
type: X.literal("image-file-reference"),
|
|
1607
|
+
providerReference: X.record(X.string(), X.string()),
|
|
1608
|
+
providerOptions: Z.optional()
|
|
1609
1609
|
}),
|
|
1610
|
-
|
|
1611
|
-
type:
|
|
1612
|
-
providerOptions:
|
|
1610
|
+
X.object({
|
|
1611
|
+
type: X.literal("custom"),
|
|
1612
|
+
providerOptions: Z.optional()
|
|
1613
1613
|
})
|
|
1614
1614
|
]))
|
|
1615
1615
|
})
|
|
1616
|
-
]),
|
|
1617
|
-
type:
|
|
1618
|
-
toolCallId:
|
|
1619
|
-
toolName:
|
|
1620
|
-
output:
|
|
1621
|
-
providerOptions:
|
|
1622
|
-
}), Un =
|
|
1623
|
-
type:
|
|
1624
|
-
approvalId:
|
|
1625
|
-
toolCallId:
|
|
1626
|
-
reason:
|
|
1627
|
-
isAutomatic:
|
|
1628
|
-
signature:
|
|
1629
|
-
inputSchemaInput:
|
|
1630
|
-
}), Wn =
|
|
1631
|
-
type:
|
|
1632
|
-
approvalId:
|
|
1633
|
-
approved:
|
|
1634
|
-
reason:
|
|
1635
|
-
}), Gn =
|
|
1636
|
-
role:
|
|
1637
|
-
content:
|
|
1638
|
-
providerOptions:
|
|
1639
|
-
}), Kn =
|
|
1640
|
-
role:
|
|
1641
|
-
content:
|
|
1616
|
+
]), Hn = X.object({
|
|
1617
|
+
type: X.literal("tool-result"),
|
|
1618
|
+
toolCallId: X.string(),
|
|
1619
|
+
toolName: X.string(),
|
|
1620
|
+
output: Vn,
|
|
1621
|
+
providerOptions: Z.optional()
|
|
1622
|
+
}), Un = X.object({
|
|
1623
|
+
type: X.literal("tool-approval-request"),
|
|
1624
|
+
approvalId: X.string(),
|
|
1625
|
+
toolCallId: X.string(),
|
|
1626
|
+
reason: X.string().optional(),
|
|
1627
|
+
isAutomatic: X.boolean().optional(),
|
|
1628
|
+
signature: X.string().optional(),
|
|
1629
|
+
inputSchemaInput: X.unknown().optional()
|
|
1630
|
+
}), Wn = X.object({
|
|
1631
|
+
type: X.literal("tool-approval-response"),
|
|
1632
|
+
approvalId: X.string(),
|
|
1633
|
+
approved: X.boolean(),
|
|
1634
|
+
reason: X.string().optional()
|
|
1635
|
+
}), Gn = X.object({
|
|
1636
|
+
role: X.literal("system"),
|
|
1637
|
+
content: X.string(),
|
|
1638
|
+
providerOptions: Z.optional()
|
|
1639
|
+
}), Kn = X.object({
|
|
1640
|
+
role: X.literal("user"),
|
|
1641
|
+
content: X.union([X.string(), X.array(X.union([
|
|
1642
|
+
Mn,
|
|
1642
1643
|
Nn,
|
|
1643
|
-
|
|
1644
|
-
Ln
|
|
1644
|
+
In
|
|
1645
1645
|
]))]),
|
|
1646
|
-
providerOptions:
|
|
1647
|
-
}), qn =
|
|
1648
|
-
role:
|
|
1649
|
-
content:
|
|
1650
|
-
|
|
1651
|
-
zn,
|
|
1652
|
-
Ln,
|
|
1646
|
+
providerOptions: Z.optional()
|
|
1647
|
+
}), qn = X.object({
|
|
1648
|
+
role: X.literal("assistant"),
|
|
1649
|
+
content: X.union([X.string(), X.array(X.union([
|
|
1650
|
+
Mn,
|
|
1653
1651
|
Rn,
|
|
1652
|
+
In,
|
|
1653
|
+
Ln,
|
|
1654
|
+
zn,
|
|
1654
1655
|
Bn,
|
|
1655
|
-
|
|
1656
|
-
Z,
|
|
1656
|
+
Hn,
|
|
1657
1657
|
Un
|
|
1658
1658
|
]))]),
|
|
1659
|
-
providerOptions:
|
|
1660
|
-
}), Jn =
|
|
1661
|
-
role:
|
|
1662
|
-
content:
|
|
1663
|
-
providerOptions:
|
|
1659
|
+
providerOptions: Z.optional()
|
|
1660
|
+
}), Jn = X.object({
|
|
1661
|
+
role: X.literal("tool"),
|
|
1662
|
+
content: X.array(X.union([Hn, Wn])),
|
|
1663
|
+
providerOptions: Z.optional()
|
|
1664
1664
|
});
|
|
1665
|
-
|
|
1665
|
+
X.union([
|
|
1666
1666
|
Gn,
|
|
1667
1667
|
Kn,
|
|
1668
1668
|
qn,
|
|
@@ -1855,11 +1855,11 @@ async function Xn(e) {
|
|
|
1855
1855
|
value: void 0,
|
|
1856
1856
|
state: "undefined-input"
|
|
1857
1857
|
};
|
|
1858
|
-
let t = await
|
|
1858
|
+
let t = await vn({ text: e });
|
|
1859
1859
|
return t.success ? {
|
|
1860
1860
|
value: t.value,
|
|
1861
1861
|
state: "successful-parse"
|
|
1862
|
-
} : (t = await
|
|
1862
|
+
} : (t = await vn({ text: Yn(e) }), t.success ? {
|
|
1863
1863
|
value: t.value,
|
|
1864
1864
|
state: "repaired-parse"
|
|
1865
1865
|
} : {
|
|
@@ -1877,193 +1877,193 @@ j({
|
|
|
1877
1877
|
prefix: "call",
|
|
1878
1878
|
size: 24
|
|
1879
1879
|
}), TransformStream;
|
|
1880
|
-
var Zn =
|
|
1881
|
-
source:
|
|
1882
|
-
type:
|
|
1883
|
-
sourceType:
|
|
1884
|
-
id:
|
|
1885
|
-
url:
|
|
1886
|
-
title:
|
|
1887
|
-
providerMetadata:
|
|
1888
|
-
}),
|
|
1889
|
-
type:
|
|
1890
|
-
sourceType:
|
|
1891
|
-
id:
|
|
1892
|
-
mediaType:
|
|
1893
|
-
title:
|
|
1894
|
-
filename:
|
|
1895
|
-
providerMetadata:
|
|
1880
|
+
var Zn = X.object({
|
|
1881
|
+
source: X.discriminatedUnion("sourceType", [X.object({
|
|
1882
|
+
type: X.literal("source"),
|
|
1883
|
+
sourceType: X.literal("url"),
|
|
1884
|
+
id: X.string(),
|
|
1885
|
+
url: X.string(),
|
|
1886
|
+
title: X.string().optional(),
|
|
1887
|
+
providerMetadata: Z.optional()
|
|
1888
|
+
}), X.object({
|
|
1889
|
+
type: X.literal("source"),
|
|
1890
|
+
sourceType: X.literal("document"),
|
|
1891
|
+
id: X.string(),
|
|
1892
|
+
mediaType: X.string(),
|
|
1893
|
+
title: X.string(),
|
|
1894
|
+
filename: X.string().optional(),
|
|
1895
|
+
providerMetadata: Z.optional()
|
|
1896
1896
|
})]),
|
|
1897
|
-
startIndex:
|
|
1898
|
-
endIndex:
|
|
1899
|
-
citedText:
|
|
1900
|
-
}), Qn =
|
|
1901
|
-
|
|
1902
|
-
type:
|
|
1903
|
-
id:
|
|
1904
|
-
providerMetadata:
|
|
1897
|
+
startIndex: X.number().int().nonnegative().optional(),
|
|
1898
|
+
endIndex: X.number().int().nonnegative().optional(),
|
|
1899
|
+
citedText: X.string().optional()
|
|
1900
|
+
}), Qn = X.record(X.string(), kn.optional()), $n = on(() => hn(X.union([
|
|
1901
|
+
X.looseObject({
|
|
1902
|
+
type: X.literal("text-start"),
|
|
1903
|
+
id: X.string(),
|
|
1904
|
+
providerMetadata: Z.optional()
|
|
1905
1905
|
}),
|
|
1906
|
-
|
|
1907
|
-
type:
|
|
1908
|
-
id:
|
|
1909
|
-
delta:
|
|
1910
|
-
providerMetadata:
|
|
1906
|
+
X.looseObject({
|
|
1907
|
+
type: X.literal("text-delta"),
|
|
1908
|
+
id: X.string(),
|
|
1909
|
+
delta: X.string(),
|
|
1910
|
+
providerMetadata: Z.optional()
|
|
1911
1911
|
}),
|
|
1912
|
-
|
|
1913
|
-
type:
|
|
1914
|
-
id:
|
|
1915
|
-
citations:
|
|
1916
|
-
providerMetadata:
|
|
1912
|
+
X.looseObject({
|
|
1913
|
+
type: X.literal("text-end"),
|
|
1914
|
+
id: X.string(),
|
|
1915
|
+
citations: X.array(Zn).optional(),
|
|
1916
|
+
providerMetadata: Z.optional()
|
|
1917
1917
|
}),
|
|
1918
|
-
|
|
1919
|
-
type:
|
|
1920
|
-
errorText:
|
|
1918
|
+
X.looseObject({
|
|
1919
|
+
type: X.literal("error"),
|
|
1920
|
+
errorText: X.string()
|
|
1921
1921
|
}),
|
|
1922
|
-
|
|
1923
|
-
type:
|
|
1924
|
-
toolCallId:
|
|
1925
|
-
toolName:
|
|
1926
|
-
inputEncoding:
|
|
1927
|
-
providerExecuted:
|
|
1928
|
-
providerMetadata:
|
|
1922
|
+
X.looseObject({
|
|
1923
|
+
type: X.literal("tool-input-start"),
|
|
1924
|
+
toolCallId: X.string(),
|
|
1925
|
+
toolName: X.string(),
|
|
1926
|
+
inputEncoding: X.enum(["json", "text"]).optional(),
|
|
1927
|
+
providerExecuted: X.boolean().optional(),
|
|
1928
|
+
providerMetadata: Z.optional(),
|
|
1929
1929
|
toolMetadata: Qn.optional(),
|
|
1930
|
-
dynamic:
|
|
1931
|
-
title:
|
|
1930
|
+
dynamic: X.boolean().optional(),
|
|
1931
|
+
title: X.string().optional()
|
|
1932
1932
|
}),
|
|
1933
|
-
|
|
1934
|
-
type:
|
|
1935
|
-
toolCallId:
|
|
1936
|
-
inputTextDelta:
|
|
1933
|
+
X.looseObject({
|
|
1934
|
+
type: X.literal("tool-input-delta"),
|
|
1935
|
+
toolCallId: X.string(),
|
|
1936
|
+
inputTextDelta: X.string()
|
|
1937
1937
|
}),
|
|
1938
|
-
|
|
1939
|
-
type:
|
|
1940
|
-
toolCallId:
|
|
1941
|
-
toolName:
|
|
1942
|
-
input:
|
|
1943
|
-
providerExecuted:
|
|
1944
|
-
providerMetadata:
|
|
1938
|
+
X.looseObject({
|
|
1939
|
+
type: X.literal("tool-input-available"),
|
|
1940
|
+
toolCallId: X.string(),
|
|
1941
|
+
toolName: X.string(),
|
|
1942
|
+
input: X.unknown(),
|
|
1943
|
+
providerExecuted: X.boolean().optional(),
|
|
1944
|
+
providerMetadata: Z.optional(),
|
|
1945
1945
|
toolMetadata: Qn.optional(),
|
|
1946
|
-
dynamic:
|
|
1947
|
-
title:
|
|
1946
|
+
dynamic: X.boolean().optional(),
|
|
1947
|
+
title: X.string().optional()
|
|
1948
1948
|
}),
|
|
1949
|
-
|
|
1950
|
-
type:
|
|
1951
|
-
toolCallId:
|
|
1952
|
-
toolName:
|
|
1953
|
-
input:
|
|
1954
|
-
providerExecuted:
|
|
1955
|
-
providerMetadata:
|
|
1949
|
+
X.looseObject({
|
|
1950
|
+
type: X.literal("tool-input-error"),
|
|
1951
|
+
toolCallId: X.string(),
|
|
1952
|
+
toolName: X.string(),
|
|
1953
|
+
input: X.unknown(),
|
|
1954
|
+
providerExecuted: X.boolean().optional(),
|
|
1955
|
+
providerMetadata: Z.optional(),
|
|
1956
1956
|
toolMetadata: Qn.optional(),
|
|
1957
|
-
dynamic:
|
|
1958
|
-
errorText:
|
|
1959
|
-
title:
|
|
1957
|
+
dynamic: X.boolean().optional(),
|
|
1958
|
+
errorText: X.string(),
|
|
1959
|
+
title: X.string().optional()
|
|
1960
1960
|
}),
|
|
1961
|
-
|
|
1962
|
-
type:
|
|
1963
|
-
approvalId:
|
|
1964
|
-
toolCallId:
|
|
1965
|
-
approvalDescriptor:
|
|
1966
|
-
inputSchemaInput:
|
|
1967
|
-
reason:
|
|
1968
|
-
isAutomatic:
|
|
1969
|
-
signature:
|
|
1961
|
+
X.looseObject({
|
|
1962
|
+
type: X.literal("tool-approval-request"),
|
|
1963
|
+
approvalId: X.string(),
|
|
1964
|
+
toolCallId: X.string(),
|
|
1965
|
+
approvalDescriptor: X.unknown().optional(),
|
|
1966
|
+
inputSchemaInput: X.unknown().optional(),
|
|
1967
|
+
reason: X.string().optional(),
|
|
1968
|
+
isAutomatic: X.boolean().optional(),
|
|
1969
|
+
signature: X.string().optional()
|
|
1970
1970
|
}),
|
|
1971
|
-
|
|
1972
|
-
type:
|
|
1973
|
-
approvalId:
|
|
1974
|
-
approved:
|
|
1975
|
-
reason:
|
|
1976
|
-
providerExecuted:
|
|
1977
|
-
providerMetadata:
|
|
1971
|
+
X.looseObject({
|
|
1972
|
+
type: X.literal("tool-approval-response"),
|
|
1973
|
+
approvalId: X.string(),
|
|
1974
|
+
approved: X.boolean(),
|
|
1975
|
+
reason: X.string().optional(),
|
|
1976
|
+
providerExecuted: X.boolean().optional(),
|
|
1977
|
+
providerMetadata: Z.optional()
|
|
1978
1978
|
}),
|
|
1979
|
-
|
|
1980
|
-
type:
|
|
1981
|
-
toolCallId:
|
|
1982
|
-
output:
|
|
1983
|
-
providerExecuted:
|
|
1984
|
-
providerMetadata:
|
|
1979
|
+
X.looseObject({
|
|
1980
|
+
type: X.literal("tool-output-available"),
|
|
1981
|
+
toolCallId: X.string(),
|
|
1982
|
+
output: X.unknown(),
|
|
1983
|
+
providerExecuted: X.boolean().optional(),
|
|
1984
|
+
providerMetadata: Z.optional(),
|
|
1985
1985
|
toolMetadata: Qn.optional(),
|
|
1986
|
-
dynamic:
|
|
1987
|
-
preliminary:
|
|
1986
|
+
dynamic: X.boolean().optional(),
|
|
1987
|
+
preliminary: X.boolean().optional()
|
|
1988
1988
|
}),
|
|
1989
|
-
|
|
1990
|
-
type:
|
|
1991
|
-
toolCallId:
|
|
1992
|
-
errorText:
|
|
1993
|
-
providerExecuted:
|
|
1994
|
-
providerMetadata:
|
|
1989
|
+
X.looseObject({
|
|
1990
|
+
type: X.literal("tool-output-error"),
|
|
1991
|
+
toolCallId: X.string(),
|
|
1992
|
+
errorText: X.string(),
|
|
1993
|
+
providerExecuted: X.boolean().optional(),
|
|
1994
|
+
providerMetadata: Z.optional(),
|
|
1995
1995
|
toolMetadata: Qn.optional(),
|
|
1996
|
-
dynamic:
|
|
1996
|
+
dynamic: X.boolean().optional()
|
|
1997
1997
|
}),
|
|
1998
|
-
|
|
1999
|
-
type:
|
|
2000
|
-
toolCallId:
|
|
1998
|
+
X.looseObject({
|
|
1999
|
+
type: X.literal("tool-output-denied"),
|
|
2000
|
+
toolCallId: X.string()
|
|
2001
2001
|
}),
|
|
2002
|
-
|
|
2003
|
-
type:
|
|
2004
|
-
id:
|
|
2005
|
-
providerMetadata:
|
|
2002
|
+
X.looseObject({
|
|
2003
|
+
type: X.literal("reasoning-start"),
|
|
2004
|
+
id: X.string(),
|
|
2005
|
+
providerMetadata: Z.optional()
|
|
2006
2006
|
}),
|
|
2007
|
-
|
|
2008
|
-
type:
|
|
2009
|
-
id:
|
|
2010
|
-
delta:
|
|
2011
|
-
providerMetadata:
|
|
2007
|
+
X.looseObject({
|
|
2008
|
+
type: X.literal("reasoning-delta"),
|
|
2009
|
+
id: X.string(),
|
|
2010
|
+
delta: X.string(),
|
|
2011
|
+
providerMetadata: Z.optional()
|
|
2012
2012
|
}),
|
|
2013
|
-
|
|
2014
|
-
type:
|
|
2015
|
-
id:
|
|
2016
|
-
providerMetadata:
|
|
2013
|
+
X.looseObject({
|
|
2014
|
+
type: X.literal("reasoning-end"),
|
|
2015
|
+
id: X.string(),
|
|
2016
|
+
providerMetadata: Z.optional()
|
|
2017
2017
|
}),
|
|
2018
|
-
|
|
2019
|
-
type:
|
|
2020
|
-
kind:
|
|
2021
|
-
providerMetadata:
|
|
2018
|
+
X.looseObject({
|
|
2019
|
+
type: X.literal("custom"),
|
|
2020
|
+
kind: X.string().transform((e) => e),
|
|
2021
|
+
providerMetadata: Z.optional()
|
|
2022
2022
|
}),
|
|
2023
|
-
|
|
2024
|
-
type:
|
|
2025
|
-
sourceId:
|
|
2026
|
-
url:
|
|
2027
|
-
title:
|
|
2028
|
-
providerMetadata:
|
|
2023
|
+
X.looseObject({
|
|
2024
|
+
type: X.literal("source-url"),
|
|
2025
|
+
sourceId: X.string(),
|
|
2026
|
+
url: X.string(),
|
|
2027
|
+
title: X.string().optional(),
|
|
2028
|
+
providerMetadata: Z.optional()
|
|
2029
2029
|
}),
|
|
2030
|
-
|
|
2031
|
-
type:
|
|
2032
|
-
sourceId:
|
|
2033
|
-
mediaType:
|
|
2034
|
-
title:
|
|
2035
|
-
filename:
|
|
2036
|
-
providerMetadata:
|
|
2030
|
+
X.looseObject({
|
|
2031
|
+
type: X.literal("source-document"),
|
|
2032
|
+
sourceId: X.string(),
|
|
2033
|
+
mediaType: X.string(),
|
|
2034
|
+
title: X.string(),
|
|
2035
|
+
filename: X.string().optional(),
|
|
2036
|
+
providerMetadata: Z.optional()
|
|
2037
2037
|
}),
|
|
2038
|
-
|
|
2039
|
-
type:
|
|
2040
|
-
url:
|
|
2041
|
-
mediaType:
|
|
2042
|
-
providerMetadata:
|
|
2038
|
+
X.looseObject({
|
|
2039
|
+
type: X.literal("file"),
|
|
2040
|
+
url: X.string(),
|
|
2041
|
+
mediaType: X.string(),
|
|
2042
|
+
providerMetadata: Z.optional()
|
|
2043
2043
|
}),
|
|
2044
|
-
|
|
2045
|
-
type:
|
|
2046
|
-
url:
|
|
2047
|
-
mediaType:
|
|
2048
|
-
providerMetadata:
|
|
2044
|
+
X.looseObject({
|
|
2045
|
+
type: X.literal("reasoning-file"),
|
|
2046
|
+
url: X.string(),
|
|
2047
|
+
mediaType: X.string(),
|
|
2048
|
+
providerMetadata: Z.optional()
|
|
2049
2049
|
}),
|
|
2050
|
-
|
|
2051
|
-
type:
|
|
2052
|
-
id:
|
|
2053
|
-
data:
|
|
2054
|
-
transient:
|
|
2050
|
+
X.looseObject({
|
|
2051
|
+
type: X.custom((e) => typeof e == "string" && e.startsWith("data-"), { message: "Type must start with \"data-\"" }),
|
|
2052
|
+
id: X.string().optional(),
|
|
2053
|
+
data: X.unknown(),
|
|
2054
|
+
transient: X.boolean().optional()
|
|
2055
2055
|
}),
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
type:
|
|
2061
|
-
messageId:
|
|
2062
|
-
messageMetadata:
|
|
2056
|
+
X.looseObject({ type: X.literal("start-step") }),
|
|
2057
|
+
X.looseObject({ type: X.literal("finish-step") }),
|
|
2058
|
+
X.looseObject({ type: X.literal("reset-step") }),
|
|
2059
|
+
X.looseObject({
|
|
2060
|
+
type: X.literal("start"),
|
|
2061
|
+
messageId: X.string().optional(),
|
|
2062
|
+
messageMetadata: X.unknown().optional()
|
|
2063
2063
|
}),
|
|
2064
|
-
|
|
2065
|
-
type:
|
|
2066
|
-
finishReason:
|
|
2064
|
+
X.looseObject({
|
|
2065
|
+
type: X.literal("finish"),
|
|
2066
|
+
finishReason: X.enum([
|
|
2067
2067
|
"stop",
|
|
2068
2068
|
"length",
|
|
2069
2069
|
"content-filter",
|
|
@@ -2072,15 +2072,15 @@ var Zn = Y.object({
|
|
|
2072
2072
|
"interrupted",
|
|
2073
2073
|
"other"
|
|
2074
2074
|
]).optional(),
|
|
2075
|
-
messageMetadata:
|
|
2075
|
+
messageMetadata: X.unknown().optional()
|
|
2076
2076
|
}),
|
|
2077
|
-
|
|
2078
|
-
type:
|
|
2079
|
-
reason:
|
|
2077
|
+
X.looseObject({
|
|
2078
|
+
type: X.literal("abort"),
|
|
2079
|
+
reason: X.string().optional()
|
|
2080
2080
|
}),
|
|
2081
|
-
|
|
2082
|
-
type:
|
|
2083
|
-
messageMetadata:
|
|
2081
|
+
X.looseObject({
|
|
2082
|
+
type: X.literal("message-metadata"),
|
|
2083
|
+
messageMetadata: X.unknown()
|
|
2084
2084
|
})
|
|
2085
2085
|
])));
|
|
2086
2086
|
function er(e) {
|
|
@@ -2152,7 +2152,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2152
2152
|
}
|
|
2153
2153
|
}
|
|
2154
2154
|
}
|
|
2155
|
-
if (t == null) throw new
|
|
2155
|
+
if (t == null) throw new Dn({
|
|
2156
2156
|
chunkType: "tool-invocation",
|
|
2157
2157
|
chunkId: e,
|
|
2158
2158
|
message: `No tool invocation found for tool call ID "${e}".`
|
|
@@ -2161,7 +2161,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2161
2161
|
}
|
|
2162
2162
|
function h(e) {
|
|
2163
2163
|
let t = r.message.parts.filter(Q).find((t) => t.approval?.id === e);
|
|
2164
|
-
if (t == null) throw new
|
|
2164
|
+
if (t == null) throw new Dn({
|
|
2165
2165
|
chunkType: "tool-approval-response",
|
|
2166
2166
|
chunkId: e,
|
|
2167
2167
|
message: `No tool invocation found for approval ID "${e}".`
|
|
@@ -2226,8 +2226,8 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2226
2226
|
}
|
|
2227
2227
|
async function v(e) {
|
|
2228
2228
|
if (e != null) {
|
|
2229
|
-
let n = r.message.metadata == null ? e :
|
|
2230
|
-
t != null && await
|
|
2229
|
+
let n = r.message.metadata == null ? e : On(r.message.metadata, e);
|
|
2230
|
+
t != null && await gn({
|
|
2231
2231
|
value: n,
|
|
2232
2232
|
schema: t,
|
|
2233
2233
|
context: {
|
|
@@ -2250,7 +2250,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2250
2250
|
}
|
|
2251
2251
|
case "text-delta": {
|
|
2252
2252
|
let t = r.activeTextParts[e.id];
|
|
2253
|
-
if (t == null) throw new
|
|
2253
|
+
if (t == null) throw new Dn({
|
|
2254
2254
|
chunkType: "text-delta",
|
|
2255
2255
|
chunkId: e.id,
|
|
2256
2256
|
message: `Received text-delta for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`
|
|
@@ -2260,7 +2260,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2260
2260
|
}
|
|
2261
2261
|
case "text-end": {
|
|
2262
2262
|
let t = r.activeTextParts[e.id];
|
|
2263
|
-
if (t == null) throw new
|
|
2263
|
+
if (t == null) throw new Dn({
|
|
2264
2264
|
chunkType: "text-end",
|
|
2265
2265
|
chunkId: e.id,
|
|
2266
2266
|
message: `Received text-end for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`
|
|
@@ -2290,7 +2290,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2290
2290
|
}
|
|
2291
2291
|
case "reasoning-delta": {
|
|
2292
2292
|
let t = r.activeReasoningParts[e.id];
|
|
2293
|
-
if (t == null) throw new
|
|
2293
|
+
if (t == null) throw new Dn({
|
|
2294
2294
|
chunkType: "reasoning-delta",
|
|
2295
2295
|
chunkId: e.id,
|
|
2296
2296
|
message: `Received reasoning-delta for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`
|
|
@@ -2300,7 +2300,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2300
2300
|
}
|
|
2301
2301
|
case "reasoning-end": {
|
|
2302
2302
|
let t = r.activeReasoningParts[e.id];
|
|
2303
|
-
if (t == null) throw new
|
|
2303
|
+
if (t == null) throw new Dn({
|
|
2304
2304
|
chunkType: "reasoning-end",
|
|
2305
2305
|
chunkId: e.id,
|
|
2306
2306
|
message: `Received reasoning-end for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`
|
|
@@ -2371,7 +2371,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2371
2371
|
}
|
|
2372
2372
|
case "tool-input-delta": {
|
|
2373
2373
|
let t = r.partialToolCalls[e.toolCallId];
|
|
2374
|
-
if (t == null) throw new
|
|
2374
|
+
if (t == null) throw new Dn({
|
|
2375
2375
|
chunkType: "tool-input-delta",
|
|
2376
2376
|
chunkId: e.toolCallId,
|
|
2377
2377
|
message: `Received tool-input-delta for missing tool call with ID "${e.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`
|
|
@@ -2552,7 +2552,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2552
2552
|
default: if (er(e)) {
|
|
2553
2553
|
if (n?.[e.type] != null) {
|
|
2554
2554
|
let t = r.message.parts.findIndex((t) => "id" in t && "data" in t && t.id === e.id && t.type === e.type), i = t >= 0 ? t : r.message.parts.length;
|
|
2555
|
-
await
|
|
2555
|
+
await gn({
|
|
2556
2556
|
value: e.data,
|
|
2557
2557
|
schema: n[e.type],
|
|
2558
2558
|
context: {
|
|
@@ -2613,7 +2613,7 @@ j({
|
|
|
2613
2613
|
}), j({
|
|
2614
2614
|
prefix: "call",
|
|
2615
2615
|
size: 24
|
|
2616
|
-
}),
|
|
2616
|
+
}), X.record(X.string(), kn.optional()), X.record(X.string(), X.string()), j({
|
|
2617
2617
|
prefix: "call",
|
|
2618
2618
|
size: 24
|
|
2619
2619
|
}), j({
|
|
@@ -2664,9 +2664,9 @@ j({
|
|
|
2664
2664
|
}), j({
|
|
2665
2665
|
prefix: "call",
|
|
2666
2666
|
size: 24
|
|
2667
|
-
}),
|
|
2668
|
-
token:
|
|
2669
|
-
url:
|
|
2667
|
+
}), X.object({
|
|
2668
|
+
token: X.string().refine((e) => e.trim().length > 0),
|
|
2669
|
+
url: X.string().refine((e) => {
|
|
2670
2670
|
try {
|
|
2671
2671
|
let t = new URL(e);
|
|
2672
2672
|
return (t.protocol === "ws:" || t.protocol === "wss:") && t.hostname !== "";
|
|
@@ -2674,12 +2674,12 @@ j({
|
|
|
2674
2674
|
return !1;
|
|
2675
2675
|
}
|
|
2676
2676
|
}),
|
|
2677
|
-
expiresAt:
|
|
2678
|
-
tools:
|
|
2679
|
-
type:
|
|
2680
|
-
name:
|
|
2681
|
-
description:
|
|
2682
|
-
parameters:
|
|
2677
|
+
expiresAt: X.number().positive().max(2 ** 53 - 1).optional(),
|
|
2678
|
+
tools: X.array(X.object({
|
|
2679
|
+
type: X.literal("function"),
|
|
2680
|
+
name: X.string().min(1),
|
|
2681
|
+
description: X.string().optional(),
|
|
2682
|
+
parameters: X.record(X.string(), X.unknown())
|
|
2683
2683
|
})).optional()
|
|
2684
2684
|
}), j({
|
|
2685
2685
|
prefix: "call",
|
|
@@ -2731,7 +2731,7 @@ var mr = class {
|
|
|
2731
2731
|
this.api = e, this.credentials = t, this.headers = n, this.body = r, this.fetch = i, this.prepareSendMessagesRequest = a, this.prepareReconnectToStreamRequest = o;
|
|
2732
2732
|
}
|
|
2733
2733
|
async sendMessages({ abortSignal: e, ...t }) {
|
|
2734
|
-
let n = await
|
|
2734
|
+
let n = await bn(this.body), r = await bn(this.headers), i = await bn(this.credentials), a = {
|
|
2735
2735
|
...A(r),
|
|
2736
2736
|
...A(t.headers)
|
|
2737
2737
|
}, o = await this.prepareSendMessagesRequest?.({
|
|
@@ -2773,7 +2773,7 @@ var mr = class {
|
|
|
2773
2773
|
return this.processResponseStream(d.body);
|
|
2774
2774
|
}
|
|
2775
2775
|
async reconnectToStream(e) {
|
|
2776
|
-
let t = await
|
|
2776
|
+
let t = await bn(this.body), n = await bn(this.headers), r = await bn(this.credentials), i = {
|
|
2777
2777
|
...A(n),
|
|
2778
2778
|
...A(e.headers)
|
|
2779
2779
|
}, a = await this.prepareReconnectToStreamRequest?.({
|
|
@@ -2788,7 +2788,7 @@ var mr = class {
|
|
|
2788
2788
|
requestMetadata: e.metadata
|
|
2789
2789
|
}), o = a?.api;
|
|
2790
2790
|
if (o == null) {
|
|
2791
|
-
if (e.chatId === "." || e.chatId === "..") throw new
|
|
2791
|
+
if (e.chatId === "." || e.chatId === "..") throw new Cn({
|
|
2792
2792
|
parameter: "chatId",
|
|
2793
2793
|
value: e.chatId,
|
|
2794
2794
|
message: "Chat IDs must not be \".\" or \"..\" when using the default reconnect URL."
|
|
@@ -2815,7 +2815,7 @@ var mr = class {
|
|
|
2815
2815
|
super(t), this.resumeStreamIsReplay = e;
|
|
2816
2816
|
}
|
|
2817
2817
|
processResponseStream(e) {
|
|
2818
|
-
return
|
|
2818
|
+
return yn({
|
|
2819
2819
|
stream: e,
|
|
2820
2820
|
schema: $n
|
|
2821
2821
|
}).pipeThrough(new TransformStream({ async transform(e, t) {
|
|
@@ -2867,12 +2867,12 @@ var mr = class {
|
|
|
2867
2867
|
} else n = e;
|
|
2868
2868
|
if (e.messageId != null) {
|
|
2869
2869
|
let t = this.state.messages.findIndex((t) => t.id === e.messageId);
|
|
2870
|
-
if (t === -1) throw new
|
|
2870
|
+
if (t === -1) throw new Cn({
|
|
2871
2871
|
parameter: "message.messageId",
|
|
2872
2872
|
value: e.messageId,
|
|
2873
2873
|
message: `message with id ${e.messageId} not found`
|
|
2874
2874
|
});
|
|
2875
|
-
if (this.state.messages[t].role !== "user") throw new
|
|
2875
|
+
if (this.state.messages[t].role !== "user") throw new Cn({
|
|
2876
2876
|
parameter: "message.messageId",
|
|
2877
2877
|
value: e.messageId,
|
|
2878
2878
|
message: `message with id ${e.messageId} is not a user message`
|
|
@@ -2896,7 +2896,7 @@ var mr = class {
|
|
|
2896
2896
|
});
|
|
2897
2897
|
}, this.regenerate = async ({ messageId: e, ...t } = {}) => {
|
|
2898
2898
|
let n = e == null ? this.state.messages.length - 1 : this.state.messages.findIndex((t) => t.id === e);
|
|
2899
|
-
if (n === -1) throw new
|
|
2899
|
+
if (n === -1) throw new Cn({
|
|
2900
2900
|
parameter: "messageId",
|
|
2901
2901
|
value: e,
|
|
2902
2902
|
message: `message ${e} not found`
|
|
@@ -3852,7 +3852,7 @@ function di(e) {
|
|
|
3852
3852
|
});
|
|
3853
3853
|
}
|
|
3854
3854
|
async function St() {
|
|
3855
|
-
Ct(), P(), w.value = void 0, Be.value = !1,
|
|
3855
|
+
Ct(), P(), w.value = void 0, Be.value = !1, q.value = "", await B.value.stop();
|
|
3856
3856
|
}
|
|
3857
3857
|
function Ct() {
|
|
3858
3858
|
_t.cancelAll(), A.value && !M.has(A.value.toolCallId) && A.value.answer(!1);
|
|
@@ -3866,7 +3866,7 @@ function di(e) {
|
|
|
3866
3866
|
I.value.includes(e) || (I.value = [...I.value, e]), kt.set(e, Date.now()), n ? At.add(e) : At.delete(e), t && (R.value = {
|
|
3867
3867
|
...R.value,
|
|
3868
3868
|
[e]: t
|
|
3869
|
-
}),
|
|
3869
|
+
}), Un || Kn();
|
|
3870
3870
|
}
|
|
3871
3871
|
function z(e) {
|
|
3872
3872
|
R.value = Object.fromEntries(Object.entries(R.value).filter(([t]) => t !== e));
|
|
@@ -3930,7 +3930,7 @@ function di(e) {
|
|
|
3930
3930
|
}
|
|
3931
3931
|
})), B = b(() => ve(Nt)), Pt = () => B.value.messages[B.value.messages.length - 1];
|
|
3932
3932
|
C(E, (e, t) => {
|
|
3933
|
-
if (t && !T.value && (
|
|
3933
|
+
if (t && !T.value && (Y() || F?.chatId === t)) {
|
|
3934
3934
|
let e = B.value.messages.filter((e) => e.role === "user"), n = e[e.length - 1];
|
|
3935
3935
|
jt(t, n ? de(n) ?? "" : "", B.value.status === "streaming" || F?.chatId === t);
|
|
3936
3936
|
}
|
|
@@ -3969,7 +3969,7 @@ function di(e) {
|
|
|
3969
3969
|
}), Lt = b(() => {
|
|
3970
3970
|
let e = u.value?.messagePlaceholder;
|
|
3971
3971
|
return e?.[r.value] ? e[r.value] : n("placeholder.askAnything") ? t("placeholder.askAnything") : "";
|
|
3972
|
-
}), U = x([]), Rt = x(!1), zt = x(1), Bt = x(!1), Vt = x(!1), Ht,
|
|
3972
|
+
}), U = x([]), Rt = x(!1), zt = x(1), Bt = x(!1), Vt = x(!1), Ht, W = x([]), Ut = x(!1), Wt = x("chat"), Gt = x(0), Kt = x([]), qt = x(), Jt = x(!1), Yt = x(!1), Xt = x(), Zt = x(!1), Qt = x(!1), $t = x(), G = x(""), K = x([]), q = x(""), J = x(!0), en = S(), tn = x(0), nn = fe(b(() => `${o.value}-queue`), {}), rn = b(() => nn.value[E.value] ?? []), an = b(() => !T.value);
|
|
3973
3973
|
function on(e, t) {
|
|
3974
3974
|
let n = Object.fromEntries(Object.entries(nn.value).filter(([t]) => t !== e));
|
|
3975
3975
|
nn.value = t.length > 0 ? {
|
|
@@ -3982,7 +3982,7 @@ function di(e) {
|
|
|
3982
3982
|
return on(e, []), t;
|
|
3983
3983
|
}
|
|
3984
3984
|
function cn(e) {
|
|
3985
|
-
e && (
|
|
3985
|
+
e && (G.value = G.value ? `${G.value}${si}${e}` : e);
|
|
3986
3986
|
}
|
|
3987
3987
|
function ln(e) {
|
|
3988
3988
|
on(E.value, rn.value.filter((t, n) => n !== e));
|
|
@@ -4017,7 +4017,7 @@ function di(e) {
|
|
|
4017
4017
|
} finally {
|
|
4018
4018
|
Rt.value = !1;
|
|
4019
4019
|
}
|
|
4020
|
-
|
|
4020
|
+
qn([.../* @__PURE__ */ new Set([...Vn(), ...U.value.map((e) => e.id)])]);
|
|
4021
4021
|
}
|
|
4022
4022
|
}
|
|
4023
4023
|
async function fn() {
|
|
@@ -4038,15 +4038,15 @@ function di(e) {
|
|
|
4038
4038
|
}
|
|
4039
4039
|
async function mn() {
|
|
4040
4040
|
let e = E.value;
|
|
4041
|
-
if (!e)
|
|
4041
|
+
if (!e) W.value = [];
|
|
4042
4042
|
else {
|
|
4043
|
-
|
|
4043
|
+
Ut.value = !0;
|
|
4044
4044
|
try {
|
|
4045
|
-
|
|
4045
|
+
W.value = await k.value.getChatFiles(e);
|
|
4046
4046
|
} catch {
|
|
4047
|
-
|
|
4047
|
+
W.value = [];
|
|
4048
4048
|
} finally {
|
|
4049
|
-
|
|
4049
|
+
Ut.value = !1;
|
|
4050
4050
|
}
|
|
4051
4051
|
}
|
|
4052
4052
|
}
|
|
@@ -4058,8 +4058,8 @@ function di(e) {
|
|
|
4058
4058
|
}
|
|
4059
4059
|
async function _n(e) {
|
|
4060
4060
|
await k.value.deleteChatFile(e);
|
|
4061
|
-
let t =
|
|
4062
|
-
|
|
4061
|
+
let t = W.value.find((t) => t.documentId === e), n = t?.kind === "spreadsheet" ? t.sourceAttachmentId ?? t.documentId : void 0;
|
|
4062
|
+
W.value = W.value.filter((t) => t.documentId !== e && (!n || t.documentId !== n && t.sourceAttachmentId !== n));
|
|
4063
4063
|
}
|
|
4064
4064
|
async function vn(e, t) {
|
|
4065
4065
|
if (!T.value) try {
|
|
@@ -4069,14 +4069,14 @@ function di(e) {
|
|
|
4069
4069
|
} catch {}
|
|
4070
4070
|
}
|
|
4071
4071
|
async function yn(e, t, n) {
|
|
4072
|
-
n && (await bn(t), t !== E.value ||
|
|
4072
|
+
n && (await bn(t), t !== E.value || Y()) || (await xn(e, t), t === E.value && await Tn());
|
|
4073
4073
|
}
|
|
4074
4074
|
async function bn(e) {
|
|
4075
4075
|
let t = { chatId: e };
|
|
4076
4076
|
F = t, Et.value = e;
|
|
4077
4077
|
let n = () => F === t && e === E.value, r = Date.now() + $r;
|
|
4078
4078
|
try {
|
|
4079
|
-
for (; n() && !
|
|
4079
|
+
for (; n() && !Y() && Date.now() < r;) {
|
|
4080
4080
|
Tt = !0;
|
|
4081
4081
|
try {
|
|
4082
4082
|
await B.value.resumeStream();
|
|
@@ -4086,7 +4086,7 @@ function di(e) {
|
|
|
4086
4086
|
if (!n()) return;
|
|
4087
4087
|
B.value.clearError();
|
|
4088
4088
|
let t = await k.value.getChat(o.value, e).catch(() => null);
|
|
4089
|
-
if (!t || !n() ||
|
|
4089
|
+
if (!t || !n() || Y()) return;
|
|
4090
4090
|
if (!t.turnInProgress) {
|
|
4091
4091
|
B.value.messages = t.messages;
|
|
4092
4092
|
return;
|
|
@@ -4130,10 +4130,10 @@ function di(e) {
|
|
|
4130
4130
|
}
|
|
4131
4131
|
}
|
|
4132
4132
|
}
|
|
4133
|
-
let
|
|
4133
|
+
let Y = () => {
|
|
4134
4134
|
let e = B.value.status;
|
|
4135
4135
|
return e === "submitted" || e === "streaming";
|
|
4136
|
-
}, Sn = () =>
|
|
4136
|
+
}, Sn = () => Y() || F?.chatId === E.value || he.value > 0, Cn = () => {
|
|
4137
4137
|
let e = Pt();
|
|
4138
4138
|
return A.value !== void 0 || Jr(e) || li(e);
|
|
4139
4139
|
}, wn = /* @__PURE__ */ new Set();
|
|
@@ -4157,32 +4157,32 @@ function di(e) {
|
|
|
4157
4157
|
}
|
|
4158
4158
|
let En = 0, Dn = 0;
|
|
4159
4159
|
async function On() {
|
|
4160
|
-
if (T.value ||
|
|
4160
|
+
if (T.value || Y()) return "indeterminate";
|
|
4161
4161
|
let e = E.value, t = En += 1;
|
|
4162
4162
|
try {
|
|
4163
4163
|
let n = await k.value.getChat(o.value, e);
|
|
4164
|
-
if (!n || e !== E.value ||
|
|
4164
|
+
if (!n || e !== E.value || Y() || t <= Dn) return "indeterminate";
|
|
4165
4165
|
Dn = t;
|
|
4166
4166
|
let r = n.messages, i = Qr(r, B.value.messages);
|
|
4167
4167
|
return B.value.messages = [...r, ...i], O.value = n.blocked ?? !1, i.length > 0 ? "pending" : "caught-up";
|
|
4168
4168
|
} catch {}
|
|
4169
4169
|
return "indeterminate";
|
|
4170
4170
|
}
|
|
4171
|
-
function
|
|
4171
|
+
function X(e) {
|
|
4172
4172
|
B.value.messages = [...B.value.messages, e];
|
|
4173
4173
|
}
|
|
4174
|
-
async function
|
|
4174
|
+
async function kn(e) {
|
|
4175
4175
|
try {
|
|
4176
|
-
|
|
4176
|
+
Kt.value = await k.value.getMessageFeedbacks(e);
|
|
4177
4177
|
} catch {
|
|
4178
|
-
|
|
4178
|
+
Kt.value = [];
|
|
4179
4179
|
}
|
|
4180
4180
|
}
|
|
4181
|
-
function
|
|
4182
|
-
let t =
|
|
4183
|
-
t >= 0 ?
|
|
4181
|
+
function Z(e) {
|
|
4182
|
+
let t = Kt.value.findIndex((t) => t.messageId === e.messageId);
|
|
4183
|
+
t >= 0 ? Kt.value[t] = e : Kt.value.push(e);
|
|
4184
4184
|
}
|
|
4185
|
-
function
|
|
4185
|
+
function An(e) {
|
|
4186
4186
|
let t = It.value, n = t.findIndex((t) => t.id === e.id), r = de(e) ?? "", i = t.slice(0, n).reverse().find((e) => e.role === "user");
|
|
4187
4187
|
return {
|
|
4188
4188
|
userQuestion: de(i ?? e) ?? "",
|
|
@@ -4193,27 +4193,27 @@ function di(e) {
|
|
|
4193
4193
|
await Promise.all([
|
|
4194
4194
|
vn(e, t),
|
|
4195
4195
|
dn(e),
|
|
4196
|
-
|
|
4196
|
+
kn(t)
|
|
4197
4197
|
]), lt.value || De((e, t) => k.value.reverseGeocode(e, t, r.value)).then((e) => {
|
|
4198
4198
|
e && (lt.value = e);
|
|
4199
4199
|
});
|
|
4200
4200
|
}
|
|
4201
4201
|
async function Mn() {
|
|
4202
|
-
let e =
|
|
4202
|
+
let e = G.value.trim(), t = K.value.filter((e) => e.state === "done" && e.mediaSource !== void 0).map((e) => ({
|
|
4203
4203
|
type: "file",
|
|
4204
4204
|
mediaType: e.mediaSource.mimeType,
|
|
4205
4205
|
url: e.localUrl,
|
|
4206
4206
|
filename: e.mediaSource.name,
|
|
4207
4207
|
providerMetadata: { "8bot": { media: e.mediaSource } }
|
|
4208
4208
|
})), n = tt.value ? Fe.value : void 0;
|
|
4209
|
-
!T.value && Sn() ? e && t.length === 0 && !n && (on(E.value, [...rn.value, e]),
|
|
4209
|
+
!T.value && Sn() ? e && t.length === 0 && !n && (on(E.value, [...rn.value, e]), G.value = "") : (T.value && It.value.length > 0 && await Qn(), Pn(e, t, n && { pagePointer: n }), G.value = "", Fe.value = void 0, Zn());
|
|
4210
4210
|
}
|
|
4211
4211
|
function Nn(e, t) {
|
|
4212
4212
|
let n = e.trim();
|
|
4213
|
-
return !n || O.value || Sn() || B.value.status !== "ready" ? !1 : (Pn(n, [], t, {
|
|
4213
|
+
return !n || O.value || Sn() || B.value.status !== "ready" ? !1 : (Pn(n, [], t, { toInput: !1 }), !0);
|
|
4214
4214
|
}
|
|
4215
|
-
function Pn(e, t = [], n, {
|
|
4216
|
-
Ct(),
|
|
4215
|
+
function Pn(e, t = [], n, { toInput: r = !0 } = {}) {
|
|
4216
|
+
Ct(), q.value = e, J.value = r, en.value = r && n && "pagePointer" in n ? n.pagePointer : void 0, tn.value = B.value.messages.length;
|
|
4217
4217
|
let i = B.value.sendMessage;
|
|
4218
4218
|
i({
|
|
4219
4219
|
text: e,
|
|
@@ -4232,24 +4232,24 @@ function di(e) {
|
|
|
4232
4232
|
Ct(), n({ text: t });
|
|
4233
4233
|
}
|
|
4234
4234
|
async function In() {
|
|
4235
|
-
let e = B.value.messages.slice(tn.value).some((e) => e.parts.some(re)), t =
|
|
4236
|
-
|
|
4235
|
+
let e = B.value.messages.slice(tn.value).some((e) => e.parts.some(re)), t = q.value, n = J.value, r = en.value, i = t.length > 0 && !e, a = E.value, s = tn.value, c = F?.chatId === a, l = Dt, u = sn(a), d = (e = "") => {
|
|
4236
|
+
G.value = [
|
|
4237
4237
|
e,
|
|
4238
|
-
|
|
4239
|
-
|
|
4238
|
+
u,
|
|
4239
|
+
G.value
|
|
4240
4240
|
].filter(Boolean).join(si);
|
|
4241
|
-
},
|
|
4241
|
+
}, f = () => a === E.value && !Y() && tn.value === s ? !1 : (u && on(a, [u, ...nn.value[a] ?? []]), !0);
|
|
4242
4242
|
F = void 0, Et.value = void 0, Ct(), await B.value.stop();
|
|
4243
|
-
let
|
|
4244
|
-
if (!
|
|
4245
|
-
if (
|
|
4246
|
-
if (await On(),
|
|
4247
|
-
if (
|
|
4248
|
-
|
|
4243
|
+
let p = T.value || e && !c || await k.value.stopChatTurn(o.value, a, l).catch(() => !0);
|
|
4244
|
+
if (!f()) {
|
|
4245
|
+
if (c || !p) {
|
|
4246
|
+
if (await On(), f()) return;
|
|
4247
|
+
if (c || B.value.messages.length > tn.value) {
|
|
4248
|
+
q.value = "", d();
|
|
4249
4249
|
return;
|
|
4250
4250
|
}
|
|
4251
4251
|
}
|
|
4252
|
-
|
|
4252
|
+
i ? (d(n ? t : ""), Fe.value ??= r, B.value.messages = B.value.messages.slice(0, tn.value), q.value = "") : d();
|
|
4253
4253
|
}
|
|
4254
4254
|
}
|
|
4255
4255
|
C(() => B.value.messages, (e) => {
|
|
@@ -4269,7 +4269,7 @@ function di(e) {
|
|
|
4269
4269
|
}, 1500));
|
|
4270
4270
|
});
|
|
4271
4271
|
let Rn = x(!1), zn;
|
|
4272
|
-
C(() => !A.value && !Jr(Pt()) && (
|
|
4272
|
+
C(() => !A.value && !Jr(Pt()) && (Y() || he.value > 0), (e) => {
|
|
4273
4273
|
clearTimeout(zn), e ? Rn.value = !0 : zn = setTimeout(() => {
|
|
4274
4274
|
Rn.value = !1;
|
|
4275
4275
|
}, 400);
|
|
@@ -4277,44 +4277,44 @@ function di(e) {
|
|
|
4277
4277
|
let Bn = b(() => {
|
|
4278
4278
|
let e = Ot.value.filter((e) => e !== E.value);
|
|
4279
4279
|
return Rn.value || Et.value === E.value ? [...e, E.value] : e;
|
|
4280
|
-
}), Vn = () => [.../* @__PURE__ */ new Set([...Ot.value, ...I.value])], Hn = Ce(),
|
|
4281
|
-
function
|
|
4282
|
-
clearTimeout(
|
|
4283
|
-
|
|
4280
|
+
}), Vn = () => [.../* @__PURE__ */ new Set([...Ot.value, ...I.value])], Hn = Ce(), Un, Wn = 0, Gn = 0;
|
|
4281
|
+
function Kn() {
|
|
4282
|
+
clearTimeout(Un), Un = void 0, Vn().length !== 0 && Hn.value === "visible" && (Un = setTimeout(() => {
|
|
4283
|
+
Un = void 0, qn(Vn());
|
|
4284
4284
|
}, ti));
|
|
4285
4285
|
}
|
|
4286
|
-
async function
|
|
4286
|
+
async function qn(e) {
|
|
4287
4287
|
let t = e.slice(0, ni);
|
|
4288
4288
|
if (T.value || t.length === 0) {
|
|
4289
|
-
|
|
4289
|
+
Kn();
|
|
4290
4290
|
return;
|
|
4291
4291
|
}
|
|
4292
|
-
let n =
|
|
4292
|
+
let n = Wn += 1, r;
|
|
4293
4293
|
try {
|
|
4294
4294
|
r = await k.value.getRunningTurns(o.value, t);
|
|
4295
4295
|
} catch {
|
|
4296
|
-
|
|
4296
|
+
Kn();
|
|
4297
4297
|
return;
|
|
4298
4298
|
}
|
|
4299
|
-
if (n <=
|
|
4300
|
-
|
|
4299
|
+
if (n <= Gn) return;
|
|
4300
|
+
Gn = n;
|
|
4301
4301
|
for (let e of r) At.add(e);
|
|
4302
4302
|
let i = new Set(t), a = Vn().filter((e) => i.has(e) && !r.includes(e)), s = (e) => I.value.includes(e) && !At.has(e), c = a.filter((e) => s(e) && Date.now() - (kt.get(e) ?? 0) > ri), l = a.filter((e) => !s(e));
|
|
4303
4303
|
Ot.value = [...Ot.value.filter((e) => !i.has(e)), ...r];
|
|
4304
4304
|
let u = l.filter((e) => I.value.includes(e));
|
|
4305
|
-
(u.length > 0 || c.length > 0) && (I.value = I.value.filter((e) => !u.includes(e) && !c.includes(e)), L.value = [...L.value, ...u.filter((e) => e !== E.value && !L.value.includes(e))]), l.length > 0 && dn(o.value),
|
|
4305
|
+
(u.length > 0 || c.length > 0) && (I.value = I.value.filter((e) => !u.includes(e) && !c.includes(e)), L.value = [...L.value, ...u.filter((e) => e !== E.value && !L.value.includes(e))]), l.length > 0 && dn(o.value), Kn();
|
|
4306
4306
|
}
|
|
4307
4307
|
C(Hn, (e) => {
|
|
4308
|
-
e === "visible" ?
|
|
4309
|
-
}), _e(() => clearTimeout(
|
|
4310
|
-
let
|
|
4308
|
+
e === "visible" ? qn(Vn()) : (clearTimeout(Un), Un = void 0);
|
|
4309
|
+
}), _e(() => clearTimeout(Un));
|
|
4310
|
+
let Jn = b(() => L.value.map((e) => ({
|
|
4311
4311
|
chatId: e,
|
|
4312
4312
|
title: U.value.find((t) => t.id === e)?.title || R.value[e] || void 0
|
|
4313
4313
|
})));
|
|
4314
|
-
function Jn(e) {
|
|
4315
|
-
Mt(e), E.value = e, vr("chat");
|
|
4316
|
-
}
|
|
4317
4314
|
function Yn(e) {
|
|
4315
|
+
Mt(e), E.value = e, xr("chat");
|
|
4316
|
+
}
|
|
4317
|
+
function Xn(e) {
|
|
4318
4318
|
L.value = L.value.filter((t) => t !== e), z(e);
|
|
4319
4319
|
}
|
|
4320
4320
|
C(() => [B.value.status, B.value.id], ([e, t], [n, r]) => {
|
|
@@ -4331,19 +4331,19 @@ function di(e) {
|
|
|
4331
4331
|
}), C(he, (e) => {
|
|
4332
4332
|
e === 0 && B.value.status === "ready" && Tn();
|
|
4333
4333
|
}), C(() => B.value.status, (e) => {
|
|
4334
|
-
e === "ready" &&
|
|
4334
|
+
e === "ready" && q.value.length > 0 && (q.value = "");
|
|
4335
4335
|
});
|
|
4336
|
-
function
|
|
4337
|
-
for (let t of
|
|
4338
|
-
|
|
4336
|
+
function Zn(e = !1) {
|
|
4337
|
+
for (let t of K.value) (e || t.state !== "done") && URL.revokeObjectURL(t.localUrl);
|
|
4338
|
+
K.value = [], or.value = null;
|
|
4339
4339
|
}
|
|
4340
|
-
async function
|
|
4341
|
-
return
|
|
4340
|
+
async function Qn() {
|
|
4341
|
+
return q.value = "", Re.value = {}, ze.value = {}, E.value = ft(), await ge(), B.value.clearError(), at.value = void 0, O.value = !1, Zn(!0), xr("chat"), E.value;
|
|
4342
4342
|
}
|
|
4343
|
-
async function
|
|
4344
|
-
B.value.status !== "ready" && (
|
|
4343
|
+
async function $n(e) {
|
|
4344
|
+
B.value.status !== "ready" && (q.value = "", await In()), Ct(), await B.value.regenerate(e);
|
|
4345
4345
|
}
|
|
4346
|
-
function
|
|
4346
|
+
function er(e) {
|
|
4347
4347
|
if (e.tool === "requestGeolocation") {
|
|
4348
4348
|
let t = e.output;
|
|
4349
4349
|
"latitude" in t && (lt.value = {
|
|
@@ -4355,23 +4355,23 @@ function di(e) {
|
|
|
4355
4355
|
}
|
|
4356
4356
|
B.value.addToolOutput(e);
|
|
4357
4357
|
}
|
|
4358
|
-
function
|
|
4358
|
+
function tr(e) {
|
|
4359
4359
|
B.value.addToolApprovalResponse(e);
|
|
4360
4360
|
}
|
|
4361
|
-
let
|
|
4362
|
-
|
|
4361
|
+
let nr = b(() => B.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), rr = b(() => _.value?.maxFilesPerMessage ?? 5), Q = b(() => _.value?.maxFilesPerChat ?? 20), ir = b(() => Math.max(0, Math.min(rr.value - K.value.length, Q.value - nr.value - K.value.length))), ar = b(() => ir.value <= 0), or = x(null), sr = () => {
|
|
4362
|
+
or.value = null;
|
|
4363
4363
|
};
|
|
4364
|
-
C(
|
|
4365
|
-
e || (
|
|
4364
|
+
C(ar, (e) => {
|
|
4365
|
+
e || (or.value = null);
|
|
4366
4366
|
});
|
|
4367
|
-
async function
|
|
4368
|
-
if (
|
|
4369
|
-
|
|
4367
|
+
async function cr(e) {
|
|
4368
|
+
if (ar.value) {
|
|
4369
|
+
or.value = Q.value - nr.value - K.value.length <= rr.value - K.value.length ? {
|
|
4370
4370
|
reason: "per-chat",
|
|
4371
|
-
max:
|
|
4371
|
+
max: Q.value
|
|
4372
4372
|
} : {
|
|
4373
4373
|
reason: "per-message",
|
|
4374
|
-
max:
|
|
4374
|
+
max: rr.value
|
|
4375
4375
|
};
|
|
4376
4376
|
return;
|
|
4377
4377
|
}
|
|
@@ -4381,26 +4381,38 @@ function di(e) {
|
|
|
4381
4381
|
localUrl: URL.createObjectURL(e),
|
|
4382
4382
|
state: "uploading"
|
|
4383
4383
|
};
|
|
4384
|
-
|
|
4384
|
+
K.value = [...K.value, n];
|
|
4385
4385
|
try {
|
|
4386
4386
|
let n = await k.value.uploadMedia(o.value, E.value, e);
|
|
4387
|
-
|
|
4387
|
+
if (!K.value.some((e) => e.id === t)) {
|
|
4388
|
+
await ur(n);
|
|
4389
|
+
return;
|
|
4390
|
+
}
|
|
4391
|
+
K.value = K.value.map((e) => e.id === t ? {
|
|
4388
4392
|
...e,
|
|
4389
4393
|
state: "done",
|
|
4390
4394
|
mediaSource: n
|
|
4391
4395
|
} : e);
|
|
4392
4396
|
} catch (e) {
|
|
4393
4397
|
let n = e instanceof Error ? e.message : "Upload failed";
|
|
4394
|
-
|
|
4398
|
+
K.value = K.value.map((e) => e.id === t ? {
|
|
4395
4399
|
...e,
|
|
4396
4400
|
state: "error",
|
|
4397
4401
|
error: n
|
|
4398
4402
|
} : e);
|
|
4399
4403
|
}
|
|
4400
4404
|
}
|
|
4401
|
-
async function
|
|
4402
|
-
|
|
4403
|
-
|
|
4405
|
+
async function lr(e) {
|
|
4406
|
+
e.mediaSource && await ur(e.mediaSource);
|
|
4407
|
+
}
|
|
4408
|
+
async function ur(e) {
|
|
4409
|
+
try {
|
|
4410
|
+
await k.value.discardMedia(e);
|
|
4411
|
+
} catch {}
|
|
4412
|
+
}
|
|
4413
|
+
async function dr(e, t) {
|
|
4414
|
+
let { userQuestion: n, assistantMessage: r } = An(e);
|
|
4415
|
+
Z(await k.value.submitMessageFeedback({
|
|
4404
4416
|
messageId: e.id,
|
|
4405
4417
|
chatId: E.value,
|
|
4406
4418
|
agentId: o.value,
|
|
@@ -4409,73 +4421,73 @@ function di(e) {
|
|
|
4409
4421
|
assistantMessage: r
|
|
4410
4422
|
}));
|
|
4411
4423
|
}
|
|
4412
|
-
async function
|
|
4413
|
-
await
|
|
4424
|
+
async function fr(e) {
|
|
4425
|
+
await dr(e, "upvote");
|
|
4414
4426
|
}
|
|
4415
|
-
async function
|
|
4416
|
-
await
|
|
4427
|
+
async function pr(e) {
|
|
4428
|
+
await dr(e, "downvote");
|
|
4417
4429
|
}
|
|
4418
|
-
function
|
|
4419
|
-
|
|
4430
|
+
function mr(e) {
|
|
4431
|
+
Yt.value = !1, Xt.value = void 0, qt.value = e;
|
|
4420
4432
|
}
|
|
4421
|
-
async function
|
|
4422
|
-
if (
|
|
4423
|
-
|
|
4424
|
-
let { userQuestion: t, assistantMessage: n } =
|
|
4425
|
-
|
|
4426
|
-
messageId:
|
|
4433
|
+
async function gr(e) {
|
|
4434
|
+
if (qt.value) try {
|
|
4435
|
+
Jt.value = !0, Yt.value = !1, Xt.value = void 0;
|
|
4436
|
+
let { userQuestion: t, assistantMessage: n } = An(qt.value);
|
|
4437
|
+
Z(await k.value.submitMessageFeedback({
|
|
4438
|
+
messageId: qt.value.id,
|
|
4427
4439
|
chatId: E.value,
|
|
4428
4440
|
agentId: o.value,
|
|
4429
4441
|
userQuestion: t,
|
|
4430
4442
|
assistantMessage: n,
|
|
4431
4443
|
comment: e
|
|
4432
|
-
})),
|
|
4444
|
+
})), Yt.value = !0, await kn(E.value);
|
|
4433
4445
|
} catch {
|
|
4434
|
-
|
|
4446
|
+
Xt.value = n("message.feedbackSubmitError") ? t("message.feedbackSubmitError") : "Failed to submit feedback";
|
|
4435
4447
|
} finally {
|
|
4436
|
-
|
|
4448
|
+
Jt.value = !1;
|
|
4437
4449
|
}
|
|
4438
4450
|
}
|
|
4439
|
-
async function
|
|
4451
|
+
async function vr(e) {
|
|
4440
4452
|
try {
|
|
4441
|
-
|
|
4453
|
+
Qt.value = !0, Zt.value = !1, $t.value = void 0, await k.value.submitLead({
|
|
4442
4454
|
agentId: o.value,
|
|
4443
4455
|
chatId: E.value,
|
|
4444
4456
|
...e
|
|
4445
|
-
}),
|
|
4457
|
+
}), Zt.value = !0;
|
|
4446
4458
|
} catch {
|
|
4447
|
-
|
|
4459
|
+
$t.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
|
|
4448
4460
|
} finally {
|
|
4449
|
-
|
|
4461
|
+
Qt.value = !1;
|
|
4450
4462
|
}
|
|
4451
4463
|
}
|
|
4452
|
-
async function
|
|
4464
|
+
async function yr(e, t) {
|
|
4453
4465
|
let n = await k.value.updateChatTitle(o.value, e, t);
|
|
4454
4466
|
U.value = U.value.map((t) => t.id === e ? {
|
|
4455
4467
|
...t,
|
|
4456
4468
|
title: n.title
|
|
4457
4469
|
} : t);
|
|
4458
4470
|
}
|
|
4459
|
-
async function
|
|
4460
|
-
await k.value.deleteChat(o.value, e), U.value = U.value.filter((t) => t.id !== e), E.value === e && await
|
|
4471
|
+
async function br(e) {
|
|
4472
|
+
await k.value.deleteChat(o.value, e), U.value = U.value.filter((t) => t.id !== e), E.value === e && await Qn();
|
|
4461
4473
|
}
|
|
4462
|
-
function
|
|
4463
|
-
|
|
4474
|
+
function xr(e) {
|
|
4475
|
+
Wt.value = e;
|
|
4464
4476
|
}
|
|
4465
|
-
function
|
|
4466
|
-
|
|
4477
|
+
function Sr() {
|
|
4478
|
+
xr("chat"), Gt.value++;
|
|
4467
4479
|
}
|
|
4468
|
-
let
|
|
4469
|
-
function
|
|
4480
|
+
let Cr;
|
|
4481
|
+
function wr(e) {
|
|
4470
4482
|
let t = () => k.value.getChat(o.value, e).then((e) => e !== null);
|
|
4471
4483
|
return t().catch(() => t().catch(() => !1));
|
|
4472
4484
|
}
|
|
4473
4485
|
return C(l, async (e) => {
|
|
4474
|
-
if (!e || e ===
|
|
4475
|
-
let t =
|
|
4476
|
-
if (
|
|
4477
|
-
let n = E.value, r = !T.value && await
|
|
4478
|
-
l.value === e && E.value === n && (r ? dn(o.value) : (U.value = [],
|
|
4486
|
+
if (!e || e === Cr) return;
|
|
4487
|
+
let t = Cr;
|
|
4488
|
+
if (Cr = e, t === void 0) return;
|
|
4489
|
+
let n = E.value, r = !T.value && await wr(n);
|
|
4490
|
+
l.value === e && E.value === n && (r ? dn(o.value) : (U.value = [], Kt.value = [], W.value = [], Ot.value = [], I.value = [], L.value = [], R.value = {}, await Qn(), G.value = ""));
|
|
4479
4491
|
}), {
|
|
4480
4492
|
apiClient: k,
|
|
4481
4493
|
baseUrl: i,
|
|
@@ -4537,34 +4549,34 @@ function di(e) {
|
|
|
4537
4549
|
isLoadingConversations: Rt,
|
|
4538
4550
|
hasMoreConversations: Bt,
|
|
4539
4551
|
isLoadingMoreConversations: Vt,
|
|
4540
|
-
chatFiles:
|
|
4541
|
-
isLoadingChatFiles:
|
|
4542
|
-
input:
|
|
4543
|
-
pendingAttachments:
|
|
4544
|
-
isAttachmentLimitReached:
|
|
4545
|
-
fileLimitError:
|
|
4552
|
+
chatFiles: W,
|
|
4553
|
+
isLoadingChatFiles: Ut,
|
|
4554
|
+
input: G,
|
|
4555
|
+
pendingAttachments: K,
|
|
4556
|
+
isAttachmentLimitReached: ar,
|
|
4557
|
+
fileLimitError: or,
|
|
4546
4558
|
localChatId: E,
|
|
4547
4559
|
isConversationBlocked: O,
|
|
4548
4560
|
inputMessagePlaceholder: Lt,
|
|
4549
4561
|
chatError: at,
|
|
4550
4562
|
runningChatIds: Bn,
|
|
4551
|
-
backgroundAnswers:
|
|
4552
|
-
openBackgroundAnswer:
|
|
4553
|
-
dismissBackgroundAnswer:
|
|
4563
|
+
backgroundAnswers: Jn,
|
|
4564
|
+
openBackgroundAnswer: Yn,
|
|
4565
|
+
dismissBackgroundAnswer: Xn,
|
|
4554
4566
|
canQueue: an,
|
|
4555
4567
|
queuedMessages: rn,
|
|
4556
4568
|
removeQueuedMessage: ln,
|
|
4557
4569
|
editQueuedMessage: un,
|
|
4558
|
-
activeView:
|
|
4559
|
-
inputFocusRequest:
|
|
4560
|
-
messageFeedbacks:
|
|
4561
|
-
feedbackDialogMessage:
|
|
4562
|
-
isFeedbackSubmitting:
|
|
4563
|
-
isFeedbackSubmitted:
|
|
4564
|
-
feedbackSubmitError:
|
|
4565
|
-
isLeadSubmitted:
|
|
4566
|
-
isLoadingSubmitLead:
|
|
4567
|
-
submitLeadError:
|
|
4570
|
+
activeView: Wt,
|
|
4571
|
+
inputFocusRequest: Gt,
|
|
4572
|
+
messageFeedbacks: Kt,
|
|
4573
|
+
feedbackDialogMessage: qt,
|
|
4574
|
+
isFeedbackSubmitting: Jt,
|
|
4575
|
+
isFeedbackSubmitted: Yt,
|
|
4576
|
+
feedbackSubmitError: Xt,
|
|
4577
|
+
isLeadSubmitted: Zt,
|
|
4578
|
+
isLoadingSubmitLead: Qt,
|
|
4579
|
+
submitLeadError: $t,
|
|
4568
4580
|
buildDeviceContext: ut,
|
|
4569
4581
|
initialize: jn,
|
|
4570
4582
|
loadConversations: dn,
|
|
@@ -4572,32 +4584,33 @@ function di(e) {
|
|
|
4572
4584
|
searchConversations: pn,
|
|
4573
4585
|
loadChatFiles: mn,
|
|
4574
4586
|
refreshMessages: On,
|
|
4575
|
-
appendMessage:
|
|
4587
|
+
appendMessage: X,
|
|
4576
4588
|
getChatFileUrl: hn,
|
|
4577
4589
|
getChatFilePreviewUrl: gn,
|
|
4578
4590
|
deleteChatFile: _n,
|
|
4579
4591
|
handleSubmit: Mn,
|
|
4580
4592
|
sendMessage: Fn,
|
|
4581
4593
|
stopGeneration: In,
|
|
4582
|
-
startNewChat:
|
|
4583
|
-
regenerate:
|
|
4584
|
-
addToolOutput:
|
|
4585
|
-
addToolApprovalResponse:
|
|
4586
|
-
handleFileSelect:
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4594
|
+
startNewChat: Qn,
|
|
4595
|
+
regenerate: $n,
|
|
4596
|
+
addToolOutput: er,
|
|
4597
|
+
addToolApprovalResponse: tr,
|
|
4598
|
+
handleFileSelect: cr,
|
|
4599
|
+
discardPendingAttachment: lr,
|
|
4600
|
+
clearFileLimitError: sr,
|
|
4601
|
+
clearPendingAttachments: Zn,
|
|
4602
|
+
onUpvote: fr,
|
|
4603
|
+
onDownvote: pr,
|
|
4604
|
+
onFeedback: mr,
|
|
4605
|
+
onFeedbackSubmit: gr,
|
|
4606
|
+
onLeadSubmit: vr,
|
|
4607
|
+
navigate: xr,
|
|
4608
|
+
focusInput: Sr,
|
|
4609
|
+
renameChatTitle: yr,
|
|
4610
|
+
deleteChat: br
|
|
4598
4611
|
};
|
|
4599
4612
|
})();
|
|
4600
4613
|
}
|
|
4601
4614
|
export { ft as a, hr as i, di as n, Gr as r, Kr as t };
|
|
4602
4615
|
|
|
4603
|
-
//# sourceMappingURL=useChatbotStore-
|
|
4616
|
+
//# sourceMappingURL=useChatbotStore-BZ1n3Hyx.js.map
|