@marimo-team/islands 0.25.3-dev3 → 0.25.3-dev31
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/{ConnectedDataExplorerComponent-CNSxdKyJ.js → ConnectedDataExplorerComponent-7EaP9VWb.js} +12 -12
- package/dist/{ErrorBoundary-iHE9DnZC.js → ErrorBoundary-DrVykO0s.js} +8 -8
- package/dist/{abnfDiagram-VCTEODGH-DQDjNXt3.js → abnfDiagram-VCTEODGH-z_OSynK8.js} +2 -2
- package/dist/{any-language-editor-B9REGlD9.js → any-language-editor-D4q-IFcM.js} +2 -2
- package/dist/{architectureDiagram-5GKGNRK7-Nmls7Wxn.js → architectureDiagram-5GKGNRK7-Cs8J8BZr.js} +1 -1
- package/dist/{chat-ui-BDpymeoe.js → chat-ui-BeKQyQQI.js} +1151 -1152
- package/dist/{check-EDwSwP89.js → check-BMKBBrdc.js} +1 -1
- package/dist/{chunk-IMKFNOWR-CoIFEo-1.js → chunk-IMKFNOWR-aoSFasqF.js} +1 -1
- package/dist/{chunk-SHT3W25Y-lHiGx3ZC.js → chunk-SHT3W25Y-CMaybO3O.js} +1 -1
- package/dist/{chunk-SVP7TREG-BvsHIrY_.js → chunk-SVP7TREG-BNBrTAw1.js} +1 -1
- package/dist/{chunk-TICWLB2K-BC8YIm_n.js → chunk-TICWLB2K-DXNxvUJn.js} +1 -1
- package/dist/{chunk-YOKDWASO-DPZk8vhS.js → chunk-YOKDWASO-DKplTrBY.js} +20 -20
- package/dist/{classDiagram-ZZMXUADV-Bt98lkkv.js → classDiagram-ZZMXUADV-DXdCCDOg.js} +2 -2
- package/dist/{classDiagram-v2-VYDZK3BY-D9bfbcC3.js → classDiagram-v2-VYDZK3BY-DyZqrtLP.js} +2 -2
- package/dist/{code-visibility-BCpXa0Xh.js → code-visibility-UR3IN3fl.js} +16 -16
- package/dist/{common-BrBUdtPy.js → common-C6uebScP.js} +5737 -5439
- package/dist/{copy-icon-Ft7t9bqz.js → copy-icon-BgUO8jsi.js} +2 -2
- package/dist/{cynefinDiagram-5FMLGOSQ-CgWra7wt.js → cynefinDiagram-5FMLGOSQ-DWHuKJs8.js} +1 -1
- package/dist/{dagre-GXQ25YYZ-CFZ8-35c.js → dagre-GXQ25YYZ-DYLu-OCU.js} +1 -1
- package/dist/{data-grid-overlay-editor-Ch2SgmvG.js → data-grid-overlay-editor-DhdeVwuk.js} +5 -5
- package/dist/{data-grid-types-BH_r7g7l.js → data-grid-types-0PJ-9N5n.js} +1 -1
- package/dist/{diagram-S7CK7UJ4-lCNQrW7d.js → diagram-S7CK7UJ4-PwwcUOHP.js} +1 -1
- package/dist/{diagram-UQ7AKVKN-CQPQ6pP_.js → diagram-UQ7AKVKN-CvJbL_IM.js} +1 -1
- package/dist/{diagram-VX7I27RA-Cf3b0llz.js → diagram-VX7I27RA-B5RkqnzN.js} +1 -1
- package/dist/{diagram-Z3DM3KII-Bt4QLrpn.js → diagram-Z3DM3KII-CyijwTR2.js} +1 -1
- package/dist/{dialog-CEBFZNyc.js → dialog-Cc479ZEH.js} +24 -24
- package/dist/{dist-DpBpA_n1.js → dist-Lm-D-Vr6.js} +3 -3
- package/dist/{dropdown-menu-CP_qCYHC.js → dropdown-menu-BuE2b8Yb.js} +790 -790
- package/dist/{ebnfDiagram-PWID7BFC-D3NAyPFY.js → ebnfDiagram-PWID7BFC-DG90ELFp.js} +2 -2
- package/dist/{erDiagram-RLTQ6QDP-Tlu09_Nm.js → erDiagram-RLTQ6QDP-FMo_SpyX.js} +1 -1
- package/dist/{error-banner-Da600cwz.js → error-banner-CFPHFw4h.js} +26 -21
- package/dist/{cells-C8iCYvLU.js → error-entries-CnqKxhU9.js} +1370 -1314
- package/dist/{feedback-button-DxXNcC6q.js → feedback-button-DGkGODB3.js} +121 -122
- package/dist/{flowDiagram-HODETNUW-CAYbpJmV.js → flowDiagram-HODETNUW-DQ4JuadE.js} +2 -2
- package/dist/{formats-BGh2thRc.js → formats-DRHUWwSK.js} +2 -2
- package/dist/{ganttDiagram-EL5Y4UJY-BQT16JSc.js → ganttDiagram-EL5Y4UJY-Dh_4cBJZ.js} +2 -2
- package/dist/{glide-data-editor-BQ7uKbeo.js → glide-data-editor-E8Z7sC5t.js} +55 -55
- package/dist/{glide-utils-DJyqh0EM.js → glide-utils-pisbYVjH.js} +3 -3
- package/dist/{globals-DSavh2ZB.js → globals-D7sKfXY8.js} +3 -3
- package/dist/{highlighted-body-KPVGNVTW-zwjq21tf.js → highlighted-body-KPVGNVTW-3Ziwfz-V.js} +2 -2
- package/dist/{html-to-image-CZY1pIZH.js → html-to-image-BsG_zyNW.js} +68 -68
- package/dist/{infoDiagram-27XIBGKW-XrDxhr0x.js → infoDiagram-27XIBGKW-CRSDtRrd.js} +1 -1
- package/dist/{ishikawaDiagram-5VMMS53U-CD1muzov.js → ishikawaDiagram-5VMMS53U-DxLEUldB.js} +1 -1
- package/dist/{kanban-definition-UXKFOSKX-Dg9W142_.js → kanban-definition-UXKFOSKX-BLhvu8o4.js} +1 -1
- package/dist/{label-BDKF3Afc.js → label-DoysmLMW.js} +1 -1
- package/dist/{linear-Cnaq3Tfb.js → linear-DWERh7eI.js} +121 -73
- package/dist/{loader-BQOfjTIJ.js → loader-BPdQhmlq.js} +10 -10
- package/dist/main.js +759 -759
- package/dist/{mermaid-CiAXjLpA.js → mermaid-Bjm6C1qN.js} +37 -37
- package/dist/mermaid-HWGCJPDP-Du3-HPQA.js +2 -0
- package/dist/{mindmap-definition-YA3MSWOX-DgCidgYJ.js → mindmap-definition-YA3MSWOX-g2LwxnYQ.js} +1 -1
- package/dist/{number-overlay-editor-D6kYaqh5.js → number-overlay-editor-BV4UMoL2.js} +3 -3
- package/dist/{pegDiagram-XKGWAZYB-coOYYKB6.js → pegDiagram-XKGWAZYB-CpMAt3Qs.js} +2 -2
- package/dist/{pieDiagram-E7YTZNPT-BnXTc3bj.js → pieDiagram-E7YTZNPT-CVTthoZo.js} +1 -1
- package/dist/precisionRound-DhAzeRcm.js +49 -0
- package/dist/{process-output-e4jj9Ijt.js → process-output-DgQrilBD.js} +5 -5
- package/dist/{quadrantDiagram-AXDQQJYC-Ccw0xMjN.js → quadrantDiagram-AXDQQJYC-Blrm7V7_.js} +1 -1
- package/dist/{railroadDiagram-O6MQD6OU-B28-u83n.js → railroadDiagram-O6MQD6OU-ao8cqqFB.js} +2 -2
- package/dist/{react-vega-BED0DjiB.js → react-vega-BDpbvBCb.js} +12284 -12270
- package/dist/{requirementDiagram-BXWQKSXE-CdYCTMu0.js → requirementDiagram-BXWQKSXE--J8vyfm-.js} +1 -1
- package/dist/{reveal-component-BTBfJ3ju.js → reveal-component-CpEtzUCU.js} +9 -9
- package/dist/{select-BButFi-d.js → select-DemoKT4G.js} +199 -199
- package/dist/{sequenceDiagram-WJ2MYXX4-CM3aRAe_.js → sequenceDiagram-WJ2MYXX4-CiQbn62x.js} +1 -1
- package/dist/{spec-BwarBpUJ.js → spec-D_u2ipzF.js} +4 -4
- package/dist/{stateDiagram-D77RDMKH-DOZUMVj8.js → stateDiagram-D77RDMKH-DVEeGs5b.js} +2 -2
- package/dist/{stateDiagram-v2-MP3YSRHH-CISYxma6.js → stateDiagram-v2-MP3YSRHH-1OQRe6iA.js} +2 -2
- package/dist/style.css +1 -1
- package/dist/{swimlanes-42K2YHIH-BkSppxp8.js → swimlanes-42K2YHIH-CqkGoGqn.js} +1 -1
- package/dist/{swimlanesDiagram-VR7AAH4N-c8G5pGxC.js → swimlanesDiagram-VR7AAH4N-CszjkrKo.js} +2 -2
- package/dist/{time-BieKwdYS.js → time-BaMbJs4z.js} +18 -18
- package/dist/{timeline-definition-24CTP7MA-CaMQayqK.js → timeline-definition-24CTP7MA-DLRUNVAx.js} +1 -1
- package/dist/toDate-gyi35XS2.js +1185 -0
- package/dist/{toast-B9UMEi8u.js → toast-PkdZraM8.js} +221 -221
- package/dist/{tooltip-BO1REbqs.js → tooltip-CtBZ5q8p.js} +51 -51
- package/dist/{use-restore-focus-BEM7sFWl.js → use-restore-focus-CKjfFjLM.js} +1 -1
- package/dist/{useAsyncData-Deh5kszT.js → useAsyncData-BneN349z.js} +1 -1
- package/dist/{useDateFormatter-D8XruNGG.js → useDateFormatter-DkajGwwd.js} +2 -2
- package/dist/{useDeepCompareMemoize-DXwzRINI.js → useDeepCompareMemoize-Z_7R8wTt.js} +1 -1
- package/dist/{useLifecycle-j7D9uD1o.js → useLifecycle-Dfq8UD-b.js} +2 -2
- package/dist/{useTheme-CRnjkku0.js → useTheme-Bu5bBgrh.js} +86 -86
- package/dist/{vega-component-DG29TAB7.js → vega-component-1lFfDE_8.js} +10 -10
- package/dist/{vega-embed-container-BNHE18G9.js → vega-embed-container-BgKnsDbB.js} +2 -2
- package/dist/{vega-loader.browser-DNST6uVf.js → vega-loader.browser-CpbZAXub.js} +297 -506
- package/dist/{vennDiagram-4TSXK5OY-CF8pfaK3.js → vennDiagram-4TSXK5OY-CypgoBVZ.js} +1 -1
- package/dist/{wardleyDiagram-VM6X3IG4-dGPu39d-.js → wardleyDiagram-VM6X3IG4-B6xjiQ_g.js} +1 -1
- package/dist/{xychartDiagram-S5SC5T6Z-CP6-9q56.js → xychartDiagram-S5SC5T6Z-e0PefDVs.js} +2 -2
- package/package.json +4 -2
- package/src/__tests__/fixtures/{pair-preview.ts → pair-config.ts} +3 -2
- package/src/__tests__/mount.test.ts +28 -8
- package/src/components/data-table/__tests__/context-menu.test.ts +176 -0
- package/src/components/data-table/__tests__/date-filter-inputs.test.tsx +24 -1
- package/src/components/data-table/__tests__/export-actions.test.tsx +329 -6
- package/src/components/data-table/context-menu.tsx +125 -26
- package/src/components/data-table/date-filter-inputs.tsx +15 -42
- package/src/components/data-table/export-actions.tsx +192 -116
- package/src/components/data-table/schemas.ts +14 -36
- package/src/components/data-table/utils.ts +18 -0
- package/src/components/editor/Output.tsx +9 -2
- package/src/components/editor/__tests__/dynamic-favicon.test.tsx +111 -18
- package/src/components/editor/actions/__tests__/pair-with-agent-commands.test.ts +80 -252
- package/src/components/editor/actions/__tests__/pair-with-agent-modal.test.tsx +186 -34
- package/src/components/editor/actions/pair-with-agent-commands.ts +42 -51
- package/src/components/editor/actions/pair-with-agent-modal.tsx +96 -36
- package/src/components/editor/chrome/panels/error-panel.tsx +1 -0
- package/src/components/editor/chrome/wrapper/__tests__/attachment-status.test.tsx +366 -0
- package/src/components/editor/chrome/wrapper/footer-item.tsx +32 -24
- package/src/components/editor/chrome/wrapper/footer-items/attachment-status.tsx +237 -0
- package/src/components/editor/chrome/wrapper/footer.tsx +2 -0
- package/src/components/editor/controls/__tests__/command-palette.test.tsx +53 -0
- package/src/components/editor/controls/command-palette.tsx +22 -10
- package/src/components/editor/dynamic-favicon.tsx +21 -40
- package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +537 -0
- package/src/components/editor/errors/send-error-report-button.tsx +69 -0
- package/src/components/editor/output/MarimoErrorOutput.tsx +21 -5
- package/src/components/editor/output/MarimoTracebackOutput.tsx +35 -20
- package/src/components/editor/output/__tests__/ansi-reduce.test.ts +18 -0
- package/src/components/editor/output/ansi-reduce.ts +6 -0
- package/src/core/attachments/__tests__/toast.test.tsx +58 -0
- package/src/core/attachments/state.ts +18 -0
- package/src/core/attachments/toast.ts +15 -0
- package/src/core/cells/__tests__/cells.test.ts +52 -0
- package/src/core/cells/__tests__/error-report.test.ts +139 -0
- package/src/core/cells/__tests__/notebook-outline.test.ts +113 -0
- package/src/core/cells/__tests__/session.test.ts +50 -1
- package/src/core/cells/cells.ts +2 -1
- package/src/core/cells/error-report.ts +63 -0
- package/src/core/cells/session.ts +28 -1
- package/src/core/config/pair.ts +5 -3
- package/src/core/edit-app.tsx +2 -2
- package/src/core/host/AGENTS.md +5 -0
- package/src/core/host/__tests__/attachments.test.ts +57 -0
- package/src/core/host/__tests__/document.test.ts +124 -0
- package/src/core/host/__tests__/events.test.ts +46 -0
- package/src/core/host/__tests__/fixtures.ts +39 -0
- package/src/core/host/__tests__/notebook-client.test.ts +433 -0
- package/src/core/host/__tests__/protocol.test.ts +15 -0
- package/src/core/host/__tests__/stream.test.ts +209 -0
- package/src/core/host/connection.ts +81 -0
- package/src/core/host/events.ts +61 -0
- package/src/core/host/notebook-client.ts +290 -0
- package/src/core/host/protocol.ts +11 -6
- package/src/core/host/resources/attachments.ts +19 -0
- package/src/core/host/resources/document.ts +101 -0
- package/src/core/host/resources/resource.ts +47 -0
- package/src/core/host/stream.ts +211 -0
- package/src/core/network/connection.ts +4 -2
- package/src/core/run-app.tsx +2 -2
- package/src/core/runtime/__tests__/runtime.test.ts +55 -11
- package/src/core/runtime/runtime.ts +15 -1
- package/src/core/runtime/types.ts +2 -0
- package/src/core/websocket/__tests__/{useMarimoKernelConnection.test.ts → connection-state.test.ts} +15 -17
- package/src/core/websocket/__tests__/{useWebSocket.test.ts → createConnectionTransport.test.ts} +1 -1
- package/src/core/websocket/__tests__/useNotebookClient.hook.test.tsx +170 -0
- package/src/core/websocket/__tests__/{useMarimoKernelConnection.hook.test.tsx → useNotebookSession.hook.test.tsx} +181 -65
- package/src/core/websocket/connection-state.ts +70 -0
- package/src/core/websocket/state.ts +7 -0
- package/src/core/websocket/transports/__tests__/sse.test.ts +1 -4
- package/src/core/websocket/transports/create.ts +31 -0
- package/src/core/websocket/transports/transport.ts +12 -23
- package/src/core/websocket/types.ts +9 -39
- package/src/core/websocket/useNotebookClient.ts +88 -0
- package/src/core/websocket/{useMarimoKernelConnection.tsx → useNotebookSession.tsx} +59 -225
- package/src/mount.tsx +7 -3
- package/src/plugins/impl/__tests__/DataTablePlugin.test.tsx +84 -0
- package/src/utils/__tests__/dates.test.ts +116 -0
- package/src/utils/dates.ts +94 -0
- package/src/utils/once.ts +19 -19
- package/dist/error-entries-CzoYkIQZ.js +0 -56
- package/dist/mermaid-HWGCJPDP-ByCsZnYF.js +0 -2
- package/dist/precisionRound-DMIVQrt2.js +0 -97
- package/dist/toDate-BNJf01u1.js +0 -703
- package/src/core/websocket/useWebSocket.tsx +0 -88
|
@@ -2,28 +2,27 @@ import { a as e, t } from "./rolldown-runtime-Cb76FRpK.js";
|
|
|
2
2
|
import { c as n, g as r, h as i, t as a } from "./button-CvjkwdSk.js";
|
|
3
3
|
import { t as o } from "./react-sHtZdjeP.js";
|
|
4
4
|
import { t as s } from "./compiler-runtime-CldRdSsv.js";
|
|
5
|
-
import { i as c, t as l } from "./copy-icon-
|
|
6
|
-
import { F as u, H as d, U as f, V as p, X as m, Y as h, Z as g, _, a as v, c as y, d as b, f as x, g as S, h as C, l as w, m as T, n as E, p as D, r as O, t as k, v as A, x as ee, y as
|
|
7
|
-
import { h as
|
|
8
|
-
import {
|
|
9
|
-
import { A as
|
|
10
|
-
import { _ as
|
|
11
|
-
import {
|
|
12
|
-
import { d as
|
|
13
|
-
import { t as
|
|
14
|
-
import { A as
|
|
15
|
-
import { n as
|
|
16
|
-
import { t as
|
|
17
|
-
import { t as
|
|
18
|
-
import { A as
|
|
19
|
-
import { $ as
|
|
20
|
-
import { t as
|
|
21
|
-
import { n as
|
|
22
|
-
import { n as
|
|
23
|
-
import { n as
|
|
24
|
-
import { t as
|
|
25
|
-
|
|
26
|
-
var Rt = M("ban", [["circle", {
|
|
5
|
+
import { i as c, t as l } from "./copy-icon-BgUO8jsi.js";
|
|
6
|
+
import { F as u, H as d, U as f, V as p, X as m, Y as h, Z as g, _, a as v, c as y, d as b, f as x, g as S, h as C, l as w, m as T, n as E, p as D, r as O, t as k, v as A, x as ee, y as te, z as ne } from "./html-to-image-BsG_zyNW.js";
|
|
7
|
+
import { h as j, t as re } from "./tooltip-CtBZ5q8p.js";
|
|
8
|
+
import { Ct as ie, Et as ae, Ht as oe, L as se, Lt as ce, Nt as le, St as ue, X as de, cn as fe, ct as pe, dn as me, en as he, et as ge, h as _e, i as ve, ln as ye, mn as be, mt as xe, r as Se, rt as Ce, st as we, t as Te, w as Ee, xt as De } from "./error-entries-CnqKxhU9.js";
|
|
9
|
+
import { A as Oe, C as ke, M as Ae, b as je } from "./select-DemoKT4G.js";
|
|
10
|
+
import { _ as Me, f as Ne, h as Pe, i as Fe, n as Ie, t as Le } from "./dropdown-menu-BuE2b8Yb.js";
|
|
11
|
+
import { C as Re, d as ze } from "./toDate-gyi35XS2.js";
|
|
12
|
+
import { d as Be, f as Ve, i as He, n as Ue, t as We, u as Ge } from "./process-output-DgQrilBD.js";
|
|
13
|
+
import { t as Ke } from "./jsx-runtime-3BD1kT0s.js";
|
|
14
|
+
import { A as qe, B as Je, C as Ye, E as Xe, I as Ze, L as Qe, M as $e, N as et, O as tt, P as nt, S as rt, T as it, U as at, V as ot, b as st, k as ct, w as lt, x as ut, y as dt, z as ft } from "./use-restore-focus-CKjfFjLM.js";
|
|
15
|
+
import { n as pt } from "./error-banner-CFPHFw4h.js";
|
|
16
|
+
import { t as mt } from "./label-DoysmLMW.js";
|
|
17
|
+
import { t as ht } from "./isEmpty-BSZ1LaUo.js";
|
|
18
|
+
import { A as gt, T as _t, n as vt } from "./useTheme-Bu5bBgrh.js";
|
|
19
|
+
import { $ as yt, Mt as bt, Pt as xt, Rt as St, Vt as Ct, Z as wt, ht as Tt, jt as Et, mt as Dt, nt as Ot, tt as kt, zt as At } from "./dist-DoE4XJBC.js";
|
|
20
|
+
import { t as jt } from "./objects-CzUgoMIF.js";
|
|
21
|
+
import { n as Mt, o as Nt, r as Pt } from "./dist-CkTTIdBe.js";
|
|
22
|
+
import { n as Ft } from "./dist-CrSP_H1M.js";
|
|
23
|
+
import { n as It, t as Lt } from "./esm-AMFssoNp.js";
|
|
24
|
+
import { t as Rt } from "./useAsyncData-BneN349z.js";
|
|
25
|
+
var zt = j("ban", [["circle", {
|
|
27
26
|
cx: "12",
|
|
28
27
|
cy: "12",
|
|
29
28
|
r: "10",
|
|
@@ -31,7 +30,7 @@ var Rt = M("ban", [["circle", {
|
|
|
31
30
|
}], ["path", {
|
|
32
31
|
d: "M4.929 4.929 19.07 19.071",
|
|
33
32
|
key: "196cmz"
|
|
34
|
-
}]]),
|
|
33
|
+
}]]), Bt = j("bot-message-square", [
|
|
35
34
|
["path", {
|
|
36
35
|
d: "M12 6V2H8",
|
|
37
36
|
key: "1155em"
|
|
@@ -56,13 +55,13 @@ var Rt = M("ban", [["circle", {
|
|
|
56
55
|
d: "M9 11v2",
|
|
57
56
|
key: "1ueba0"
|
|
58
57
|
}]
|
|
59
|
-
]),
|
|
58
|
+
]), Vt = j("circle-check-big", [["path", {
|
|
60
59
|
d: "M21.801 10A10 10 0 1 1 17 3.335",
|
|
61
60
|
key: "yps3ct"
|
|
62
61
|
}], ["path", {
|
|
63
62
|
d: "m9 11 3 3L22 4",
|
|
64
63
|
key: "1pflzl"
|
|
65
|
-
}]]),
|
|
64
|
+
}]]), Ht = j("circle-slash", [["circle", {
|
|
66
65
|
cx: "12",
|
|
67
66
|
cy: "12",
|
|
68
67
|
r: "10",
|
|
@@ -73,22 +72,22 @@ var Rt = M("ban", [["circle", {
|
|
|
73
72
|
y1: "15",
|
|
74
73
|
y2: "9",
|
|
75
74
|
key: "1dfufj"
|
|
76
|
-
}]]),
|
|
75
|
+
}]]), Ut = j("paperclip", [["path", {
|
|
77
76
|
d: "m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",
|
|
78
77
|
key: "1miecu"
|
|
79
|
-
}]]),
|
|
78
|
+
}]]), Wt = j("rotate-cw", [["path", {
|
|
80
79
|
d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",
|
|
81
80
|
key: "1p45f6"
|
|
82
81
|
}], ["path", {
|
|
83
82
|
d: "M21 3v5h-5",
|
|
84
83
|
key: "1q7to0"
|
|
85
|
-
}]]),
|
|
84
|
+
}]]), Gt = j("send-horizontal", [["path", {
|
|
86
85
|
d: "M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",
|
|
87
86
|
key: "117uat"
|
|
88
87
|
}], ["path", {
|
|
89
88
|
d: "M6 12h16",
|
|
90
89
|
key: "s4cdu5"
|
|
91
|
-
}]]),
|
|
90
|
+
}]]), Kt = j("settings", [["path", {
|
|
92
91
|
d: "M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",
|
|
93
92
|
key: "1i5ecw"
|
|
94
93
|
}], ["circle", {
|
|
@@ -96,7 +95,7 @@ var Rt = M("ban", [["circle", {
|
|
|
96
95
|
cy: "12",
|
|
97
96
|
r: "3",
|
|
98
97
|
key: "1v7zrd"
|
|
99
|
-
}]]),
|
|
98
|
+
}]]), qt = j("shield-question-mark", [
|
|
100
99
|
["path", {
|
|
101
100
|
d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
|
|
102
101
|
key: "oel41y"
|
|
@@ -109,66 +108,66 @@ var Rt = M("ban", [["circle", {
|
|
|
109
108
|
d: "M12 17h.01",
|
|
110
109
|
key: "p32p05"
|
|
111
110
|
}]
|
|
112
|
-
]),
|
|
111
|
+
]), M = s(), Jt = "vercel.ai.error", Yt = Symbol.for(Jt), Xt, Zt, N = class e extends (Zt = Error, Xt = Yt, Zt) {
|
|
113
112
|
constructor({ name: e, message: t, cause: n }) {
|
|
114
|
-
super(t), this[
|
|
113
|
+
super(t), this[Xt] = !0, this.name = e, this.cause = n;
|
|
115
114
|
}
|
|
116
115
|
static isInstance(t) {
|
|
117
|
-
return e.hasMarker(t,
|
|
116
|
+
return e.hasMarker(t, Jt);
|
|
118
117
|
}
|
|
119
118
|
static hasMarker(e, t) {
|
|
120
119
|
let n = Symbol.for(t);
|
|
121
120
|
return typeof e == "object" && !!e && n in e && typeof e[n] == "boolean" && e[n] === !0;
|
|
122
121
|
}
|
|
123
|
-
},
|
|
122
|
+
}, Qt = "AI_APICallError", $t = `vercel.ai.error.${Qt}`, en = Symbol.for($t), tn, nn, rn = class extends (nn = N, tn = en, nn) {
|
|
124
123
|
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 }) {
|
|
125
124
|
super({
|
|
126
|
-
name:
|
|
125
|
+
name: Qt,
|
|
127
126
|
message: e,
|
|
128
127
|
cause: o
|
|
129
|
-
}), this[
|
|
128
|
+
}), this[tn] = !0, this.url = t, this.requestBodyValues = n, this.statusCode = r, this.responseHeaders = i, this.responseBody = a, this.isRetryable = s, this.data = c;
|
|
130
129
|
}
|
|
131
130
|
static isInstance(e) {
|
|
132
|
-
return
|
|
131
|
+
return N.hasMarker(e, $t);
|
|
133
132
|
}
|
|
134
|
-
},
|
|
133
|
+
}, an = "AI_EmptyResponseBodyError", on = `vercel.ai.error.${an}`, sn = Symbol.for(on), cn, ln, un = class extends (ln = N, cn = sn, ln) {
|
|
135
134
|
constructor({ message: e = "Empty response body" } = {}) {
|
|
136
135
|
super({
|
|
137
|
-
name:
|
|
136
|
+
name: an,
|
|
138
137
|
message: e
|
|
139
|
-
}), this[
|
|
138
|
+
}), this[cn] = !0;
|
|
140
139
|
}
|
|
141
140
|
static isInstance(e) {
|
|
142
|
-
return
|
|
141
|
+
return N.hasMarker(e, on);
|
|
143
142
|
}
|
|
144
143
|
};
|
|
145
|
-
function
|
|
144
|
+
function dn(e) {
|
|
146
145
|
return e == null ? "unknown error" : typeof e == "string" ? e : e instanceof Error ? e.toString() : JSON.stringify(e);
|
|
147
146
|
}
|
|
148
|
-
var
|
|
147
|
+
var fn = "AI_InvalidArgumentError", pn = `vercel.ai.error.${fn}`, mn = Symbol.for(pn), hn, gn, _n = class extends (gn = N, hn = mn, gn) {
|
|
149
148
|
constructor({ message: e, cause: t, argument: n }) {
|
|
150
149
|
super({
|
|
151
|
-
name:
|
|
150
|
+
name: fn,
|
|
152
151
|
message: e,
|
|
153
152
|
cause: t
|
|
154
|
-
}), this[
|
|
153
|
+
}), this[hn] = !0, this.argument = n;
|
|
155
154
|
}
|
|
156
155
|
static isInstance(e) {
|
|
157
|
-
return
|
|
156
|
+
return N.hasMarker(e, pn);
|
|
158
157
|
}
|
|
159
|
-
},
|
|
158
|
+
}, vn = "AI_JSONParseError", yn = `vercel.ai.error.${vn}`, bn = Symbol.for(yn), xn, Sn, Cn = class extends (Sn = N, xn = bn, Sn) {
|
|
160
159
|
constructor({ text: e, cause: t }) {
|
|
161
160
|
super({
|
|
162
|
-
name:
|
|
161
|
+
name: vn,
|
|
163
162
|
message: `JSON parsing failed: Text: ${e}.
|
|
164
|
-
Error message: ${
|
|
163
|
+
Error message: ${dn(t)}`,
|
|
165
164
|
cause: t
|
|
166
|
-
}), this[
|
|
165
|
+
}), this[xn] = !0, this.text = e;
|
|
167
166
|
}
|
|
168
167
|
static isInstance(e) {
|
|
169
|
-
return
|
|
168
|
+
return N.hasMarker(e, yn);
|
|
170
169
|
}
|
|
171
|
-
},
|
|
170
|
+
}, wn = "AI_TypeValidationError", Tn = `vercel.ai.error.${wn}`, En = Symbol.for(Tn), Dn, On, P = class e extends (On = N, Dn = En, On) {
|
|
172
171
|
constructor({ value: e, cause: t, context: n }) {
|
|
173
172
|
let r = "Type validation failed";
|
|
174
173
|
if (n?.field && (r += ` for ${n.field}`), n?.entityName || n?.entityId) {
|
|
@@ -177,14 +176,14 @@ Error message: ${un(t)}`,
|
|
|
177
176
|
n.entityName && e.push(n.entityName), n.entityId && e.push(`id: "${n.entityId}"`), r += e.join(", "), r += ")";
|
|
178
177
|
}
|
|
179
178
|
super({
|
|
180
|
-
name:
|
|
179
|
+
name: wn,
|
|
181
180
|
message: `${r}: Value: ${JSON.stringify(e)}.
|
|
182
|
-
Error message: ${
|
|
181
|
+
Error message: ${dn(t)}`,
|
|
183
182
|
cause: t
|
|
184
|
-
}), this[
|
|
183
|
+
}), this[Dn] = !0, this.value = e, this.context = n;
|
|
185
184
|
}
|
|
186
185
|
static isInstance(e) {
|
|
187
|
-
return
|
|
186
|
+
return N.hasMarker(e, Tn);
|
|
188
187
|
}
|
|
189
188
|
static wrap({ value: t, cause: n, context: r }) {
|
|
190
189
|
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({
|
|
@@ -193,25 +192,25 @@ Error message: ${un(t)}`,
|
|
|
193
192
|
context: r
|
|
194
193
|
});
|
|
195
194
|
}
|
|
196
|
-
},
|
|
195
|
+
}, kn = "AI_UnsupportedFunctionalityError", An = `vercel.ai.error.${kn}`, jn = Symbol.for(An), Mn, Nn, Pn = class extends (Nn = N, Mn = jn, Nn) {
|
|
197
196
|
constructor({ functionality: e, message: t = `'${e}' functionality not supported.` }) {
|
|
198
197
|
super({
|
|
199
|
-
name:
|
|
198
|
+
name: kn,
|
|
200
199
|
message: t
|
|
201
|
-
}), this[
|
|
200
|
+
}), this[Mn] = !0, this.functionality = e;
|
|
202
201
|
}
|
|
203
202
|
static isInstance(e) {
|
|
204
|
-
return
|
|
203
|
+
return N.hasMarker(e, An);
|
|
205
204
|
}
|
|
206
|
-
},
|
|
205
|
+
}, Fn = class extends Error {
|
|
207
206
|
constructor(e, t) {
|
|
208
207
|
super(e), this.name = "ParseError", this.type = t.type, this.field = t.field, this.value = t.value, this.line = t.line;
|
|
209
208
|
}
|
|
210
|
-
},
|
|
211
|
-
function
|
|
212
|
-
function
|
|
209
|
+
}, In = 10, Ln = 13, Rn = 32;
|
|
210
|
+
function zn(e) {}
|
|
211
|
+
function Bn(e) {
|
|
213
212
|
if (typeof e == "function") throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");
|
|
214
|
-
let { onEvent: t =
|
|
213
|
+
let { onEvent: t = zn, onError: n = zn, onRetry: r = zn, onComment: i, maxBufferSize: a } = e, o = [], s = 0, c = !0, l, u = "", d = 0, f, p = !1;
|
|
215
214
|
function m(e) {
|
|
216
215
|
if (p) throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");
|
|
217
216
|
if (c && (c = !1, e.charCodeAt(0) === 239 && e.charCodeAt(1) === 187 && e.charCodeAt(2) === 191 && (e = e.slice(3))), o.length === 0) {
|
|
@@ -230,7 +229,7 @@ function zn(e) {
|
|
|
230
229
|
n !== "" && (o.push(n), s = n.length), h();
|
|
231
230
|
}
|
|
232
231
|
function h() {
|
|
233
|
-
a !== void 0 && (s + u.length <= a || (p = !0, o.length = 0, s = 0, l = void 0, u = "", d = 0, f = void 0, n(new
|
|
232
|
+
a !== void 0 && (s + u.length <= a || (p = !0, o.length = 0, s = 0, l = void 0, u = "", d = 0, f = void 0, n(new Fn(`Buffered data exceeded max buffer size of ${a} characters`, { type: "max-buffer-size-exceeded" }))));
|
|
234
233
|
}
|
|
235
234
|
function g(e) {
|
|
236
235
|
let n = 0;
|
|
@@ -246,9 +245,9 @@ function zn(e) {
|
|
|
246
245
|
continue;
|
|
247
246
|
}
|
|
248
247
|
let i = e.charCodeAt(n);
|
|
249
|
-
if (
|
|
250
|
-
let i = e.charCodeAt(n + 5) ===
|
|
251
|
-
if (d === 0 && e.charCodeAt(r + 1) ===
|
|
248
|
+
if (Vn(e, n, i)) {
|
|
249
|
+
let i = e.charCodeAt(n + 5) === Rn ? n + 6 : n + 5, a = e.slice(i, r);
|
|
250
|
+
if (d === 0 && e.charCodeAt(r + 1) === In) {
|
|
252
251
|
t({
|
|
253
252
|
id: l,
|
|
254
253
|
event: f,
|
|
@@ -258,7 +257,7 @@ function zn(e) {
|
|
|
258
257
|
}
|
|
259
258
|
u = d === 0 ? a : `${u}
|
|
260
259
|
${a}`, d++;
|
|
261
|
-
} else
|
|
260
|
+
} else Hn(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) === Rn ? n + 7 : n + 6, r) || void 0 : _(e, n, r);
|
|
262
261
|
n = r + 1, r = e.indexOf("\n", n);
|
|
263
262
|
}
|
|
264
263
|
return e.slice(n);
|
|
@@ -266,7 +265,7 @@ ${a}`, d++;
|
|
|
266
265
|
for (; n < e.length;) {
|
|
267
266
|
let t = e.indexOf("\r", n), r = e.indexOf("\n", n), i = -1;
|
|
268
267
|
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;
|
|
269
|
-
_(e, n, i), n = i + 1, e.charCodeAt(n - 1) ===
|
|
268
|
+
_(e, n, i), n = i + 1, e.charCodeAt(n - 1) === Ln && e.charCodeAt(n) === In && n++;
|
|
270
269
|
}
|
|
271
270
|
return e.slice(n);
|
|
272
271
|
}
|
|
@@ -276,25 +275,25 @@ ${a}`, d++;
|
|
|
276
275
|
return;
|
|
277
276
|
}
|
|
278
277
|
let r = e.charCodeAt(t);
|
|
279
|
-
if (
|
|
280
|
-
let r = e.charCodeAt(t + 5) ===
|
|
278
|
+
if (Vn(e, t, r)) {
|
|
279
|
+
let r = e.charCodeAt(t + 5) === Rn ? t + 6 : t + 5, i = e.slice(r, n);
|
|
281
280
|
u = d === 0 ? i : `${u}
|
|
282
281
|
${i}`, d++;
|
|
283
282
|
return;
|
|
284
283
|
}
|
|
285
|
-
if (
|
|
286
|
-
f = e.slice(e.charCodeAt(t + 6) ===
|
|
284
|
+
if (Hn(e, t, r)) {
|
|
285
|
+
f = e.slice(e.charCodeAt(t + 6) === Rn ? t + 7 : t + 6, n) || void 0;
|
|
287
286
|
return;
|
|
288
287
|
}
|
|
289
288
|
if (r === 105 && e.charCodeAt(t + 1) === 100 && e.charCodeAt(t + 2) === 58) {
|
|
290
|
-
let r = e.slice(e.charCodeAt(t + 3) ===
|
|
289
|
+
let r = e.slice(e.charCodeAt(t + 3) === Rn ? t + 4 : t + 3, n);
|
|
291
290
|
l = r.includes("\0") ? void 0 : r;
|
|
292
291
|
return;
|
|
293
292
|
}
|
|
294
293
|
if (r === 58) {
|
|
295
294
|
if (i) {
|
|
296
295
|
let r = e.slice(t, n);
|
|
297
|
-
i(r.slice(e.charCodeAt(t + 1) ===
|
|
296
|
+
i(r.slice(e.charCodeAt(t + 1) === Rn ? 2 : 1));
|
|
298
297
|
}
|
|
299
298
|
return;
|
|
300
299
|
}
|
|
@@ -303,7 +302,7 @@ ${i}`, d++;
|
|
|
303
302
|
v(a, "", a);
|
|
304
303
|
return;
|
|
305
304
|
}
|
|
306
|
-
let s = a.slice(0, o), c = a.charCodeAt(o + 1) ===
|
|
305
|
+
let s = a.slice(0, o), c = a.charCodeAt(o + 1) === Rn ? 2 : 1;
|
|
307
306
|
v(s, a.slice(o + c), a);
|
|
308
307
|
}
|
|
309
308
|
function v(e, t, i) {
|
|
@@ -319,13 +318,13 @@ ${t}`, d++;
|
|
|
319
318
|
l = t.includes("\0") ? void 0 : t;
|
|
320
319
|
break;
|
|
321
320
|
case "retry":
|
|
322
|
-
/^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new
|
|
321
|
+
/^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new Fn(`Invalid \`retry\` value: "${t}"`, {
|
|
323
322
|
type: "invalid-retry",
|
|
324
323
|
value: t,
|
|
325
324
|
line: i
|
|
326
325
|
}));
|
|
327
326
|
break;
|
|
328
|
-
default: n(new
|
|
327
|
+
default: n(new Fn(`Unknown field "${e.length > 20 ? `${e.slice(0, 20)}\u2026` : e}"`, {
|
|
329
328
|
type: "unknown-field",
|
|
330
329
|
field: e,
|
|
331
330
|
value: t,
|
|
@@ -352,20 +351,20 @@ ${t}`, d++;
|
|
|
352
351
|
reset: b
|
|
353
352
|
};
|
|
354
353
|
}
|
|
355
|
-
function
|
|
354
|
+
function Vn(e, t, n) {
|
|
356
355
|
return n === 100 && e.charCodeAt(t + 1) === 97 && e.charCodeAt(t + 2) === 116 && e.charCodeAt(t + 3) === 97 && e.charCodeAt(t + 4) === 58;
|
|
357
356
|
}
|
|
358
|
-
function
|
|
357
|
+
function Hn(e, t, n) {
|
|
359
358
|
return n === 101 && e.charCodeAt(t + 1) === 118 && e.charCodeAt(t + 2) === 101 && e.charCodeAt(t + 3) === 110 && e.charCodeAt(t + 4) === 116 && e.charCodeAt(t + 5) === 58;
|
|
360
359
|
}
|
|
361
360
|
//#endregion
|
|
362
361
|
//#region ../node_modules/.pnpm/eventsource-parser@3.1.0/node_modules/eventsource-parser/dist/stream.js
|
|
363
|
-
var
|
|
362
|
+
var Un = class extends TransformStream {
|
|
364
363
|
constructor({ onError: e, onRetry: t, onComment: n, maxBufferSize: r } = {}) {
|
|
365
364
|
let i;
|
|
366
365
|
super({
|
|
367
366
|
start(a) {
|
|
368
|
-
i =
|
|
367
|
+
i = Bn({
|
|
369
368
|
onEvent: (e) => {
|
|
370
369
|
a.enqueue(e);
|
|
371
370
|
},
|
|
@@ -384,8 +383,8 @@ var Hn = class extends TransformStream {
|
|
|
384
383
|
}
|
|
385
384
|
};
|
|
386
385
|
new TextDecoder();
|
|
387
|
-
var { btoa:
|
|
388
|
-
function
|
|
386
|
+
var { btoa: Wn, atob: Gn } = globalThis;
|
|
387
|
+
function Kn(e) {
|
|
389
388
|
if (e == null) return {};
|
|
390
389
|
let t = {};
|
|
391
390
|
if (e instanceof Headers) e.forEach((e, n) => {
|
|
@@ -397,28 +396,28 @@ function Gn(e) {
|
|
|
397
396
|
}
|
|
398
397
|
return t;
|
|
399
398
|
}
|
|
400
|
-
var
|
|
399
|
+
var F = ({ prefix: e, size: t = 16, alphabet: n = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", separator: r = "-" } = {}) => {
|
|
401
400
|
let i = () => {
|
|
402
401
|
let e = n.length, r = Array(t);
|
|
403
402
|
for (let i = 0; i < t; i++) r[i] = n[Math.random() * e | 0];
|
|
404
403
|
return r.join("");
|
|
405
404
|
};
|
|
406
405
|
if (e == null) return i;
|
|
407
|
-
if (n.includes(r)) throw new
|
|
406
|
+
if (n.includes(r)) throw new _n({
|
|
408
407
|
argument: "separator",
|
|
409
408
|
message: `The separator "${r}" must not be part of the alphabet "${n}".`
|
|
410
409
|
});
|
|
411
410
|
return () => `${e}${r}${i()}`;
|
|
412
|
-
},
|
|
413
|
-
function
|
|
411
|
+
}, qn = F();
|
|
412
|
+
function Jn(e) {
|
|
414
413
|
return globalThis.Buffer?.isBuffer(e) ?? !1;
|
|
415
414
|
}
|
|
416
|
-
var
|
|
417
|
-
function
|
|
415
|
+
var Yn = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/, Xn = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
|
|
416
|
+
function Zn(e) {
|
|
418
417
|
let t = JSON.parse(e);
|
|
419
|
-
return typeof t != "object" || !t ||
|
|
418
|
+
return typeof t != "object" || !t || Yn.test(e) === !1 && Xn.test(e) === !1 ? t : Qn(t);
|
|
420
419
|
}
|
|
421
|
-
function
|
|
420
|
+
function Qn(e) {
|
|
422
421
|
let t = [e];
|
|
423
422
|
for (; t.length;) {
|
|
424
423
|
let e = t;
|
|
@@ -433,35 +432,35 @@ function Zn(e) {
|
|
|
433
432
|
}
|
|
434
433
|
return e;
|
|
435
434
|
}
|
|
436
|
-
function
|
|
435
|
+
function $n(e) {
|
|
437
436
|
let { stackTraceLimit: t } = Error;
|
|
438
437
|
try {
|
|
439
438
|
Error.stackTraceLimit = 0;
|
|
440
439
|
} catch {
|
|
441
|
-
return
|
|
440
|
+
return Zn(e);
|
|
442
441
|
}
|
|
443
442
|
try {
|
|
444
|
-
return
|
|
443
|
+
return Zn(e);
|
|
445
444
|
} finally {
|
|
446
445
|
Error.stackTraceLimit = t;
|
|
447
446
|
}
|
|
448
447
|
}
|
|
449
|
-
function
|
|
448
|
+
function er(e) {
|
|
450
449
|
if (e.type === "object" || Array.isArray(e.type) && e.type.includes("object")) {
|
|
451
450
|
let { additionalProperties: t } = e;
|
|
452
|
-
e.additionalProperties = t != null && typeof t != "boolean" &&
|
|
451
|
+
e.additionalProperties = t != null && typeof t != "boolean" && tr(t);
|
|
453
452
|
let { properties: n } = e;
|
|
454
|
-
if (n != null) for (let e of Object.keys(n)) n[e] =
|
|
453
|
+
if (n != null) for (let e of Object.keys(n)) n[e] = tr(n[e]);
|
|
455
454
|
}
|
|
456
|
-
e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(
|
|
455
|
+
e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(tr) : tr(e.items)), e.anyOf != null && (e.anyOf = e.anyOf.map(tr)), e.allOf != null && (e.allOf = e.allOf.map(tr)), e.oneOf != null && (e.oneOf = e.oneOf.map(tr));
|
|
457
456
|
let { definitions: t } = e;
|
|
458
|
-
if (t != null) for (let e of Object.keys(t)) t[e] =
|
|
457
|
+
if (t != null) for (let e of Object.keys(t)) t[e] = tr(t[e]);
|
|
459
458
|
return e;
|
|
460
459
|
}
|
|
461
|
-
function
|
|
462
|
-
return typeof e == "boolean" ? e :
|
|
460
|
+
function tr(e) {
|
|
461
|
+
return typeof e == "boolean" ? e : er(e);
|
|
463
462
|
}
|
|
464
|
-
var
|
|
463
|
+
var nr = /* @__PURE__ */ Symbol("Let zodToJsonSchema decide on which parser to use"), rr = {
|
|
465
464
|
name: void 0,
|
|
466
465
|
$refStrategy: "root",
|
|
467
466
|
basePath: ["#"],
|
|
@@ -481,24 +480,24 @@ var er = /* @__PURE__ */ Symbol("Let zodToJsonSchema decide on which parser to u
|
|
|
481
480
|
emailStrategy: "format:email",
|
|
482
481
|
base64Strategy: "contentEncoding:base64",
|
|
483
482
|
nameStrategy: "ref"
|
|
484
|
-
},
|
|
485
|
-
...
|
|
483
|
+
}, ir = (e) => typeof e == "string" ? {
|
|
484
|
+
...rr,
|
|
486
485
|
name: e
|
|
487
486
|
} : {
|
|
488
|
-
...
|
|
487
|
+
...rr,
|
|
489
488
|
...e
|
|
490
489
|
};
|
|
491
|
-
function
|
|
490
|
+
function I() {
|
|
492
491
|
return {};
|
|
493
492
|
}
|
|
494
|
-
function
|
|
493
|
+
function ar(e, t) {
|
|
495
494
|
let n = { type: "array" };
|
|
496
|
-
return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items =
|
|
495
|
+
return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = B(e.type._def, {
|
|
497
496
|
...t,
|
|
498
497
|
currentPath: [...t.currentPath, "items"]
|
|
499
498
|
})), 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;
|
|
500
499
|
}
|
|
501
|
-
function
|
|
500
|
+
function or(e) {
|
|
502
501
|
let t = {
|
|
503
502
|
type: "integer",
|
|
504
503
|
format: "int64"
|
|
@@ -515,16 +514,16 @@ function ir(e) {
|
|
|
515
514
|
}
|
|
516
515
|
return t;
|
|
517
516
|
}
|
|
518
|
-
function
|
|
517
|
+
function sr() {
|
|
519
518
|
return { type: "boolean" };
|
|
520
519
|
}
|
|
521
|
-
function
|
|
522
|
-
return
|
|
520
|
+
function cr(e, t) {
|
|
521
|
+
return B(e.type._def, t);
|
|
523
522
|
}
|
|
524
|
-
var
|
|
525
|
-
function
|
|
523
|
+
var lr = (e, t) => B(e.innerType._def, t);
|
|
524
|
+
function ur(e, t, n) {
|
|
526
525
|
let r = n ?? t.dateStrategy;
|
|
527
|
-
if (Array.isArray(r)) return { anyOf: r.map((n) =>
|
|
526
|
+
if (Array.isArray(r)) return { anyOf: r.map((n) => ur(e, t, n)) };
|
|
528
527
|
switch (r) {
|
|
529
528
|
case "string":
|
|
530
529
|
case "format:date-time": return {
|
|
@@ -535,10 +534,10 @@ function cr(e, t, n) {
|
|
|
535
534
|
type: "string",
|
|
536
535
|
format: "date"
|
|
537
536
|
};
|
|
538
|
-
case "integer": return
|
|
537
|
+
case "integer": return dr(e);
|
|
539
538
|
}
|
|
540
539
|
}
|
|
541
|
-
var
|
|
540
|
+
var dr = (e) => {
|
|
542
541
|
let t = {
|
|
543
542
|
type: "integer",
|
|
544
543
|
format: "unix-time"
|
|
@@ -551,31 +550,31 @@ var lr = (e) => {
|
|
|
551
550
|
}
|
|
552
551
|
return t;
|
|
553
552
|
};
|
|
554
|
-
function
|
|
553
|
+
function fr(e, t) {
|
|
555
554
|
return {
|
|
556
|
-
...
|
|
555
|
+
...B(e.innerType._def, t),
|
|
557
556
|
default: e.defaultValue()
|
|
558
557
|
};
|
|
559
558
|
}
|
|
560
|
-
function
|
|
561
|
-
return t.effectStrategy === "input" ?
|
|
559
|
+
function pr(e, t) {
|
|
560
|
+
return t.effectStrategy === "input" ? B(e.schema._def, t) : I();
|
|
562
561
|
}
|
|
563
|
-
function
|
|
562
|
+
function mr(e) {
|
|
564
563
|
return {
|
|
565
564
|
type: "string",
|
|
566
565
|
enum: Array.from(e.values)
|
|
567
566
|
};
|
|
568
567
|
}
|
|
569
|
-
var
|
|
570
|
-
function
|
|
571
|
-
let n = [
|
|
568
|
+
var hr = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
|
|
569
|
+
function gr(e, t) {
|
|
570
|
+
let n = [B(e.left._def, {
|
|
572
571
|
...t,
|
|
573
572
|
currentPath: [
|
|
574
573
|
...t.currentPath,
|
|
575
574
|
"allOf",
|
|
576
575
|
"0"
|
|
577
576
|
]
|
|
578
|
-
}),
|
|
577
|
+
}), B(e.right._def, {
|
|
579
578
|
...t,
|
|
580
579
|
currentPath: [
|
|
581
580
|
...t.currentPath,
|
|
@@ -584,7 +583,7 @@ function mr(e, t) {
|
|
|
584
583
|
]
|
|
585
584
|
})].filter((e) => !!e), r = [];
|
|
586
585
|
return n.forEach((e) => {
|
|
587
|
-
if (
|
|
586
|
+
if (hr(e)) r.push(...e.allOf);
|
|
588
587
|
else {
|
|
589
588
|
let t = e;
|
|
590
589
|
if ("additionalProperties" in e && e.additionalProperties === !1) {
|
|
@@ -595,19 +594,19 @@ function mr(e, t) {
|
|
|
595
594
|
}
|
|
596
595
|
}), r.length ? { allOf: r } : void 0;
|
|
597
596
|
}
|
|
598
|
-
function
|
|
597
|
+
function _r(e) {
|
|
599
598
|
let t = typeof e.value;
|
|
600
599
|
return t !== "bigint" && t !== "number" && t !== "boolean" && t !== "string" ? { type: Array.isArray(e.value) ? "array" : "object" } : {
|
|
601
600
|
type: t === "bigint" ? "integer" : t,
|
|
602
601
|
const: e.value
|
|
603
602
|
};
|
|
604
603
|
}
|
|
605
|
-
var
|
|
604
|
+
var vr = void 0, L = {
|
|
606
605
|
cuid: /^[cC][^\s-]{8,}$/,
|
|
607
606
|
cuid2: /^[0-9a-z]+$/,
|
|
608
607
|
ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
|
|
609
608
|
email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,
|
|
610
|
-
emoji: () => (
|
|
609
|
+
emoji: () => (vr === void 0 && (vr = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u")), vr),
|
|
611
610
|
uuid: /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,
|
|
612
611
|
ipv4: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,
|
|
613
612
|
ipv4Cidr: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,
|
|
@@ -618,7 +617,7 @@ var gr = void 0, z = {
|
|
|
618
617
|
nanoid: /^[a-zA-Z0-9_-]{21}$/,
|
|
619
618
|
jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
|
|
620
619
|
};
|
|
621
|
-
function
|
|
620
|
+
function yr(e, t) {
|
|
622
621
|
let n = { type: "string" };
|
|
623
622
|
if (e.checks) for (let r of e.checks) switch (r.kind) {
|
|
624
623
|
case "min":
|
|
@@ -630,108 +629,108 @@ function _r(e, t) {
|
|
|
630
629
|
case "email":
|
|
631
630
|
switch (t.emailStrategy) {
|
|
632
631
|
case "format:email":
|
|
633
|
-
|
|
632
|
+
R(n, "email", r.message, t);
|
|
634
633
|
break;
|
|
635
634
|
case "format:idn-email":
|
|
636
|
-
|
|
635
|
+
R(n, "idn-email", r.message, t);
|
|
637
636
|
break;
|
|
638
|
-
case "pattern:zod":
|
|
637
|
+
case "pattern:zod": z(n, L.email, r.message, t);
|
|
639
638
|
}
|
|
640
639
|
break;
|
|
641
640
|
case "url":
|
|
642
|
-
|
|
641
|
+
R(n, "uri", r.message, t);
|
|
643
642
|
break;
|
|
644
643
|
case "uuid":
|
|
645
|
-
|
|
644
|
+
R(n, "uuid", r.message, t);
|
|
646
645
|
break;
|
|
647
646
|
case "regex":
|
|
648
|
-
|
|
647
|
+
z(n, r.regex, r.message, t);
|
|
649
648
|
break;
|
|
650
649
|
case "cuid":
|
|
651
|
-
|
|
650
|
+
z(n, L.cuid, r.message, t);
|
|
652
651
|
break;
|
|
653
652
|
case "cuid2":
|
|
654
|
-
|
|
653
|
+
z(n, L.cuid2, r.message, t);
|
|
655
654
|
break;
|
|
656
655
|
case "startsWith":
|
|
657
|
-
|
|
656
|
+
z(n, RegExp(`^${br(r.value, t)}`), r.message, t);
|
|
658
657
|
break;
|
|
659
658
|
case "endsWith":
|
|
660
|
-
|
|
659
|
+
z(n, RegExp(`${br(r.value, t)}$`), r.message, t);
|
|
661
660
|
break;
|
|
662
661
|
case "datetime":
|
|
663
|
-
|
|
662
|
+
R(n, "date-time", r.message, t);
|
|
664
663
|
break;
|
|
665
664
|
case "date":
|
|
666
|
-
|
|
665
|
+
R(n, "date", r.message, t);
|
|
667
666
|
break;
|
|
668
667
|
case "time":
|
|
669
|
-
|
|
668
|
+
R(n, "time", r.message, t);
|
|
670
669
|
break;
|
|
671
670
|
case "duration":
|
|
672
|
-
|
|
671
|
+
R(n, "duration", r.message, t);
|
|
673
672
|
break;
|
|
674
673
|
case "length":
|
|
675
674
|
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;
|
|
676
675
|
break;
|
|
677
676
|
case "includes":
|
|
678
|
-
|
|
677
|
+
z(n, RegExp(br(r.value, t)), r.message, t);
|
|
679
678
|
break;
|
|
680
679
|
case "ip":
|
|
681
|
-
r.version !== "v6" &&
|
|
680
|
+
r.version !== "v6" && R(n, "ipv4", r.message, t), r.version !== "v4" && R(n, "ipv6", r.message, t);
|
|
682
681
|
break;
|
|
683
682
|
case "base64url":
|
|
684
|
-
|
|
683
|
+
z(n, L.base64url, r.message, t);
|
|
685
684
|
break;
|
|
686
685
|
case "jwt":
|
|
687
|
-
|
|
686
|
+
z(n, L.jwt, r.message, t);
|
|
688
687
|
break;
|
|
689
688
|
case "cidr":
|
|
690
|
-
r.version !== "v6" &&
|
|
689
|
+
r.version !== "v6" && z(n, L.ipv4Cidr, r.message, t), r.version !== "v4" && z(n, L.ipv6Cidr, r.message, t);
|
|
691
690
|
break;
|
|
692
691
|
case "emoji":
|
|
693
|
-
|
|
692
|
+
z(n, L.emoji(), r.message, t);
|
|
694
693
|
break;
|
|
695
694
|
case "ulid":
|
|
696
|
-
|
|
695
|
+
z(n, L.ulid, r.message, t);
|
|
697
696
|
break;
|
|
698
697
|
case "base64":
|
|
699
698
|
switch (t.base64Strategy) {
|
|
700
699
|
case "format:binary":
|
|
701
|
-
|
|
700
|
+
R(n, "binary", r.message, t);
|
|
702
701
|
break;
|
|
703
702
|
case "contentEncoding:base64":
|
|
704
703
|
n.contentEncoding = "base64";
|
|
705
704
|
break;
|
|
706
|
-
case "pattern:zod":
|
|
705
|
+
case "pattern:zod": z(n, L.base64, r.message, t);
|
|
707
706
|
}
|
|
708
707
|
break;
|
|
709
|
-
case "nanoid":
|
|
708
|
+
case "nanoid": z(n, L.nanoid, r.message, t);
|
|
710
709
|
}
|
|
711
710
|
return n;
|
|
712
711
|
}
|
|
713
|
-
function
|
|
714
|
-
return t.patternStrategy === "escape" ?
|
|
712
|
+
function br(e, t) {
|
|
713
|
+
return t.patternStrategy === "escape" ? Sr(e) : e;
|
|
715
714
|
}
|
|
716
|
-
var
|
|
717
|
-
function
|
|
715
|
+
var xr = /* @__PURE__ */ new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
716
|
+
function Sr(e) {
|
|
718
717
|
let t = "";
|
|
719
|
-
for (let n = 0; n < e.length; n++)
|
|
718
|
+
for (let n = 0; n < e.length; n++) xr.has(e[n]) || (t += "\\"), t += e[n];
|
|
720
719
|
return t;
|
|
721
720
|
}
|
|
722
|
-
function
|
|
721
|
+
function R(e, t, n, r) {
|
|
723
722
|
e.format || e.anyOf?.some((e) => e.format) ? (e.anyOf ||= [], e.format && (e.anyOf.push({ format: e.format }), delete e.format), e.anyOf.push({
|
|
724
723
|
format: t,
|
|
725
724
|
...n && r.errorMessages && { errorMessage: { format: n } }
|
|
726
725
|
})) : e.format = t;
|
|
727
726
|
}
|
|
728
|
-
function
|
|
727
|
+
function z(e, t, n, r) {
|
|
729
728
|
e.pattern || e.allOf?.some((e) => e.pattern) ? (e.allOf ||= [], e.pattern && (e.allOf.push({ pattern: e.pattern }), delete e.pattern), e.allOf.push({
|
|
730
|
-
pattern:
|
|
729
|
+
pattern: Cr(t, r),
|
|
731
730
|
...n && r.errorMessages && { errorMessage: { pattern: n } }
|
|
732
|
-
})) : e.pattern =
|
|
731
|
+
})) : e.pattern = Cr(t, r);
|
|
733
732
|
}
|
|
734
|
-
function
|
|
733
|
+
function Cr(e, t) {
|
|
735
734
|
if (!t.applyRegexFlags || !e.flags) return e.source;
|
|
736
735
|
let n = {
|
|
737
736
|
i: e.flags.includes("i"),
|
|
@@ -779,16 +778,16 @@ function xr(e, t) {
|
|
|
779
778
|
}
|
|
780
779
|
return i;
|
|
781
780
|
}
|
|
782
|
-
function
|
|
781
|
+
function wr(e, t) {
|
|
783
782
|
let n = {
|
|
784
783
|
type: "object",
|
|
785
|
-
additionalProperties:
|
|
784
|
+
additionalProperties: B(e.valueType._def, {
|
|
786
785
|
...t,
|
|
787
786
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
788
787
|
}) ?? t.allowedAdditionalProperties
|
|
789
788
|
};
|
|
790
789
|
if (e.keyType?._def.typeName === "ZodString" && e.keyType._def.checks?.length) {
|
|
791
|
-
let { type: r, ...i } =
|
|
790
|
+
let { type: r, ...i } = yr(e.keyType._def, t);
|
|
792
791
|
return {
|
|
793
792
|
...n,
|
|
794
793
|
propertyNames: i
|
|
@@ -799,7 +798,7 @@ function Sr(e, t) {
|
|
|
799
798
|
propertyNames: { enum: e.keyType._def.values }
|
|
800
799
|
};
|
|
801
800
|
if (e.keyType?._def.typeName === "ZodBranded" && e.keyType._def.type._def.typeName === "ZodString" && e.keyType._def.type._def.checks?.length) {
|
|
802
|
-
let { type: r, ...i } =
|
|
801
|
+
let { type: r, ...i } = cr(e.keyType._def, t);
|
|
803
802
|
return {
|
|
804
803
|
...n,
|
|
805
804
|
propertyNames: i
|
|
@@ -807,13 +806,13 @@ function Sr(e, t) {
|
|
|
807
806
|
}
|
|
808
807
|
return n;
|
|
809
808
|
}
|
|
810
|
-
function
|
|
811
|
-
return t.mapStrategy === "record" ?
|
|
809
|
+
function Tr(e, t) {
|
|
810
|
+
return t.mapStrategy === "record" ? wr(e, t) : {
|
|
812
811
|
type: "array",
|
|
813
812
|
maxItems: 125,
|
|
814
813
|
items: {
|
|
815
814
|
type: "array",
|
|
816
|
-
items: [
|
|
815
|
+
items: [B(e.keyType._def, {
|
|
817
816
|
...t,
|
|
818
817
|
currentPath: [
|
|
819
818
|
...t.currentPath,
|
|
@@ -821,7 +820,7 @@ function Cr(e, t) {
|
|
|
821
820
|
"items",
|
|
822
821
|
"0"
|
|
823
822
|
]
|
|
824
|
-
}) ||
|
|
823
|
+
}) || I(), B(e.valueType._def, {
|
|
825
824
|
...t,
|
|
826
825
|
currentPath: [
|
|
827
826
|
...t.currentPath,
|
|
@@ -829,37 +828,37 @@ function Cr(e, t) {
|
|
|
829
828
|
"items",
|
|
830
829
|
"1"
|
|
831
830
|
]
|
|
832
|
-
}) ||
|
|
831
|
+
}) || I()],
|
|
833
832
|
minItems: 2,
|
|
834
833
|
maxItems: 2
|
|
835
834
|
}
|
|
836
835
|
};
|
|
837
836
|
}
|
|
838
|
-
function
|
|
837
|
+
function Er(e) {
|
|
839
838
|
let t = e.values, n = Object.keys(e.values).filter((e) => typeof t[t[e]] != "number").map((e) => t[e]), r = Array.from(new Set(n.map((e) => typeof e)));
|
|
840
839
|
return {
|
|
841
840
|
type: r.length === 1 ? r[0] === "string" ? "string" : "number" : ["string", "number"],
|
|
842
841
|
enum: n
|
|
843
842
|
};
|
|
844
843
|
}
|
|
845
|
-
function
|
|
846
|
-
return { not:
|
|
844
|
+
function Dr() {
|
|
845
|
+
return { not: I() };
|
|
847
846
|
}
|
|
848
|
-
function
|
|
847
|
+
function Or() {
|
|
849
848
|
return { type: "null" };
|
|
850
849
|
}
|
|
851
|
-
var
|
|
850
|
+
var kr = {
|
|
852
851
|
ZodString: "string",
|
|
853
852
|
ZodNumber: "number",
|
|
854
853
|
ZodBigInt: "integer",
|
|
855
854
|
ZodBoolean: "boolean",
|
|
856
855
|
ZodNull: "null"
|
|
857
856
|
};
|
|
858
|
-
function
|
|
857
|
+
function Ar(e, t) {
|
|
859
858
|
let n = e.options instanceof Map ? Array.from(e.options.values()) : e.options;
|
|
860
|
-
if (n.every((e) => e._def.typeName in
|
|
859
|
+
if (n.every((e) => e._def.typeName in kr && (!e._def.checks || !e._def.checks.length))) {
|
|
861
860
|
let e = n.reduce((e, t) => {
|
|
862
|
-
let n =
|
|
861
|
+
let n = kr[t._def.typeName];
|
|
863
862
|
return n && !e.includes(n) ? [...e, n] : e;
|
|
864
863
|
}, []);
|
|
865
864
|
return { type: e.length > 1 ? e : e[0] };
|
|
@@ -887,10 +886,10 @@ function Or(e, t) {
|
|
|
887
886
|
type: "string",
|
|
888
887
|
enum: n.reduce((e, t) => [...e, ...t._def.values.filter((t) => !e.includes(t))], [])
|
|
889
888
|
};
|
|
890
|
-
return
|
|
889
|
+
return jr(e, t);
|
|
891
890
|
}
|
|
892
|
-
var
|
|
893
|
-
let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) =>
|
|
891
|
+
var jr = (e, t) => {
|
|
892
|
+
let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => B(e._def, {
|
|
894
893
|
...t,
|
|
895
894
|
currentPath: [
|
|
896
895
|
...t.currentPath,
|
|
@@ -900,15 +899,15 @@ var kr = (e, t) => {
|
|
|
900
899
|
})).filter((e) => !!e && (!t.strictUnions || typeof e == "object" && Object.keys(e).length > 0));
|
|
901
900
|
return n.length ? { anyOf: n } : void 0;
|
|
902
901
|
};
|
|
903
|
-
function
|
|
902
|
+
function Mr(e, t) {
|
|
904
903
|
if ([
|
|
905
904
|
"ZodString",
|
|
906
905
|
"ZodNumber",
|
|
907
906
|
"ZodBigInt",
|
|
908
907
|
"ZodBoolean",
|
|
909
908
|
"ZodNull"
|
|
910
|
-
].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [
|
|
911
|
-
let n =
|
|
909
|
+
].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [kr[e.innerType._def.typeName], "null"] };
|
|
910
|
+
let n = B(e.innerType._def, {
|
|
912
911
|
...t,
|
|
913
912
|
currentPath: [
|
|
914
913
|
...t.currentPath,
|
|
@@ -918,7 +917,7 @@ function Ar(e, t) {
|
|
|
918
917
|
});
|
|
919
918
|
return n && { anyOf: [n, { type: "null" }] };
|
|
920
919
|
}
|
|
921
|
-
function
|
|
920
|
+
function Nr(e) {
|
|
922
921
|
let t = { type: "number" };
|
|
923
922
|
if (!e.checks) return t;
|
|
924
923
|
for (let n of e.checks) switch (n.kind) {
|
|
@@ -935,7 +934,7 @@ function jr(e) {
|
|
|
935
934
|
}
|
|
936
935
|
return t;
|
|
937
936
|
}
|
|
938
|
-
function
|
|
937
|
+
function Pr(e, t) {
|
|
939
938
|
let n = {
|
|
940
939
|
type: "object",
|
|
941
940
|
properties: {}
|
|
@@ -943,7 +942,7 @@ function Mr(e, t) {
|
|
|
943
942
|
for (let e in i) {
|
|
944
943
|
let a = i[e];
|
|
945
944
|
if (a === void 0 || a._def === void 0) continue;
|
|
946
|
-
let o =
|
|
945
|
+
let o = Ir(a), s = B(a._def, {
|
|
947
946
|
...t,
|
|
948
947
|
currentPath: [
|
|
949
948
|
...t.currentPath,
|
|
@@ -959,11 +958,11 @@ function Mr(e, t) {
|
|
|
959
958
|
s !== void 0 && (n.properties[e] = s, o || r.push(e));
|
|
960
959
|
}
|
|
961
960
|
r.length && (n.required = r);
|
|
962
|
-
let a =
|
|
961
|
+
let a = Fr(e, t);
|
|
963
962
|
return a !== void 0 && (n.additionalProperties = a), n;
|
|
964
963
|
}
|
|
965
|
-
function
|
|
966
|
-
if (e.catchall._def.typeName !== "ZodNever") return
|
|
964
|
+
function Fr(e, t) {
|
|
965
|
+
if (e.catchall._def.typeName !== "ZodNever") return B(e.catchall._def, {
|
|
967
966
|
...t,
|
|
968
967
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
969
968
|
});
|
|
@@ -973,16 +972,16 @@ function Nr(e, t) {
|
|
|
973
972
|
case "strip": return t.removeAdditionalStrategy === "strict" ? t.allowedAdditionalProperties : t.rejectedAdditionalProperties;
|
|
974
973
|
}
|
|
975
974
|
}
|
|
976
|
-
function
|
|
975
|
+
function Ir(e) {
|
|
977
976
|
try {
|
|
978
977
|
return e.isOptional();
|
|
979
978
|
} catch {
|
|
980
979
|
return !0;
|
|
981
980
|
}
|
|
982
981
|
}
|
|
983
|
-
var
|
|
984
|
-
if (t.currentPath.toString() === t.propertyPath?.toString()) return
|
|
985
|
-
let n =
|
|
982
|
+
var Lr = (e, t) => {
|
|
983
|
+
if (t.currentPath.toString() === t.propertyPath?.toString()) return B(e.innerType._def, t);
|
|
984
|
+
let n = B(e.innerType._def, {
|
|
986
985
|
...t,
|
|
987
986
|
currentPath: [
|
|
988
987
|
...t.currentPath,
|
|
@@ -990,11 +989,11 @@ var Fr = (e, t) => {
|
|
|
990
989
|
"1"
|
|
991
990
|
]
|
|
992
991
|
});
|
|
993
|
-
return n ? { anyOf: [{ not:
|
|
994
|
-
},
|
|
995
|
-
if (t.pipeStrategy === "input") return
|
|
996
|
-
if (t.pipeStrategy === "output") return
|
|
997
|
-
let n =
|
|
992
|
+
return n ? { anyOf: [{ not: I() }, n] } : I();
|
|
993
|
+
}, Rr = (e, t) => {
|
|
994
|
+
if (t.pipeStrategy === "input") return B(e.in._def, t);
|
|
995
|
+
if (t.pipeStrategy === "output") return B(e.out._def, t);
|
|
996
|
+
let n = B(e.in._def, {
|
|
998
997
|
...t,
|
|
999
998
|
currentPath: [
|
|
1000
999
|
...t.currentPath,
|
|
@@ -1002,7 +1001,7 @@ var Fr = (e, t) => {
|
|
|
1002
1001
|
"0"
|
|
1003
1002
|
]
|
|
1004
1003
|
});
|
|
1005
|
-
return { allOf: [n,
|
|
1004
|
+
return { allOf: [n, B(e.out._def, {
|
|
1006
1005
|
...t,
|
|
1007
1006
|
currentPath: [
|
|
1008
1007
|
...t.currentPath,
|
|
@@ -1011,25 +1010,25 @@ var Fr = (e, t) => {
|
|
|
1011
1010
|
]
|
|
1012
1011
|
})].filter((e) => e !== void 0) };
|
|
1013
1012
|
};
|
|
1014
|
-
function
|
|
1015
|
-
return
|
|
1013
|
+
function zr(e, t) {
|
|
1014
|
+
return B(e.type._def, t);
|
|
1016
1015
|
}
|
|
1017
|
-
function
|
|
1016
|
+
function Br(e, t) {
|
|
1018
1017
|
let n = {
|
|
1019
1018
|
type: "array",
|
|
1020
1019
|
uniqueItems: !0,
|
|
1021
|
-
items:
|
|
1020
|
+
items: B(e.valueType._def, {
|
|
1022
1021
|
...t,
|
|
1023
1022
|
currentPath: [...t.currentPath, "items"]
|
|
1024
1023
|
})
|
|
1025
1024
|
};
|
|
1026
1025
|
return e.minSize && (n.minItems = e.minSize.value), e.maxSize && (n.maxItems = e.maxSize.value), n;
|
|
1027
1026
|
}
|
|
1028
|
-
function
|
|
1027
|
+
function Vr(e, t) {
|
|
1029
1028
|
return e.rest ? {
|
|
1030
1029
|
type: "array",
|
|
1031
1030
|
minItems: e.items.length,
|
|
1032
|
-
items: e.items.map((e, n) =>
|
|
1031
|
+
items: e.items.map((e, n) => B(e._def, {
|
|
1033
1032
|
...t,
|
|
1034
1033
|
currentPath: [
|
|
1035
1034
|
...t.currentPath,
|
|
@@ -1037,7 +1036,7 @@ function zr(e, t) {
|
|
|
1037
1036
|
`${n}`
|
|
1038
1037
|
]
|
|
1039
1038
|
})).reduce((e, t) => t === void 0 ? e : [...e, t], []),
|
|
1040
|
-
additionalItems:
|
|
1039
|
+
additionalItems: B(e.rest._def, {
|
|
1041
1040
|
...t,
|
|
1042
1041
|
currentPath: [...t.currentPath, "additionalItems"]
|
|
1043
1042
|
})
|
|
@@ -1045,7 +1044,7 @@ function zr(e, t) {
|
|
|
1045
1044
|
type: "array",
|
|
1046
1045
|
minItems: e.items.length,
|
|
1047
1046
|
maxItems: e.items.length,
|
|
1048
|
-
items: e.items.map((e, n) =>
|
|
1047
|
+
items: e.items.map((e, n) => B(e._def, {
|
|
1049
1048
|
...t,
|
|
1050
1049
|
currentPath: [
|
|
1051
1050
|
...t.currentPath,
|
|
@@ -1055,65 +1054,65 @@ function zr(e, t) {
|
|
|
1055
1054
|
})).reduce((e, t) => t === void 0 ? e : [...e, t], [])
|
|
1056
1055
|
};
|
|
1057
1056
|
}
|
|
1058
|
-
function
|
|
1059
|
-
return { not:
|
|
1057
|
+
function Hr() {
|
|
1058
|
+
return { not: I() };
|
|
1060
1059
|
}
|
|
1061
|
-
function
|
|
1062
|
-
return
|
|
1060
|
+
function Ur() {
|
|
1061
|
+
return I();
|
|
1063
1062
|
}
|
|
1064
|
-
var
|
|
1063
|
+
var Wr = (e, t) => B(e.innerType._def, t), Gr = (e, t, n) => {
|
|
1065
1064
|
switch (t) {
|
|
1066
|
-
case "ZodString": return
|
|
1067
|
-
case "ZodNumber": return
|
|
1068
|
-
case "ZodObject": return
|
|
1069
|
-
case "ZodBigInt": return
|
|
1070
|
-
case "ZodBoolean": return
|
|
1071
|
-
case "ZodDate": return
|
|
1072
|
-
case "ZodUndefined": return
|
|
1073
|
-
case "ZodNull": return
|
|
1074
|
-
case "ZodArray": return
|
|
1065
|
+
case "ZodString": return yr(e, n);
|
|
1066
|
+
case "ZodNumber": return Nr(e);
|
|
1067
|
+
case "ZodObject": return Pr(e, n);
|
|
1068
|
+
case "ZodBigInt": return or(e);
|
|
1069
|
+
case "ZodBoolean": return sr();
|
|
1070
|
+
case "ZodDate": return ur(e, n);
|
|
1071
|
+
case "ZodUndefined": return Hr();
|
|
1072
|
+
case "ZodNull": return Or();
|
|
1073
|
+
case "ZodArray": return ar(e, n);
|
|
1075
1074
|
case "ZodUnion":
|
|
1076
|
-
case "ZodDiscriminatedUnion": return
|
|
1077
|
-
case "ZodIntersection": return
|
|
1078
|
-
case "ZodTuple": return
|
|
1079
|
-
case "ZodRecord": return
|
|
1080
|
-
case "ZodLiteral": return
|
|
1081
|
-
case "ZodEnum": return
|
|
1082
|
-
case "ZodNativeEnum": return
|
|
1083
|
-
case "ZodNullable": return
|
|
1084
|
-
case "ZodOptional": return
|
|
1085
|
-
case "ZodMap": return
|
|
1086
|
-
case "ZodSet": return
|
|
1075
|
+
case "ZodDiscriminatedUnion": return Ar(e, n);
|
|
1076
|
+
case "ZodIntersection": return gr(e, n);
|
|
1077
|
+
case "ZodTuple": return Vr(e, n);
|
|
1078
|
+
case "ZodRecord": return wr(e, n);
|
|
1079
|
+
case "ZodLiteral": return _r(e);
|
|
1080
|
+
case "ZodEnum": return mr(e);
|
|
1081
|
+
case "ZodNativeEnum": return Er(e);
|
|
1082
|
+
case "ZodNullable": return Mr(e, n);
|
|
1083
|
+
case "ZodOptional": return Lr(e, n);
|
|
1084
|
+
case "ZodMap": return Tr(e, n);
|
|
1085
|
+
case "ZodSet": return Br(e, n);
|
|
1087
1086
|
case "ZodLazy": return () => e.getter()._def;
|
|
1088
|
-
case "ZodPromise": return
|
|
1087
|
+
case "ZodPromise": return zr(e, n);
|
|
1089
1088
|
case "ZodNaN":
|
|
1090
|
-
case "ZodNever": return
|
|
1091
|
-
case "ZodEffects": return
|
|
1092
|
-
case "ZodAny": return
|
|
1093
|
-
case "ZodUnknown": return
|
|
1094
|
-
case "ZodDefault": return
|
|
1095
|
-
case "ZodBranded": return
|
|
1096
|
-
case "ZodReadonly": return
|
|
1097
|
-
case "ZodCatch": return
|
|
1098
|
-
case "ZodPipeline": return
|
|
1089
|
+
case "ZodNever": return Dr();
|
|
1090
|
+
case "ZodEffects": return pr(e, n);
|
|
1091
|
+
case "ZodAny": return I();
|
|
1092
|
+
case "ZodUnknown": return Ur();
|
|
1093
|
+
case "ZodDefault": return fr(e, n);
|
|
1094
|
+
case "ZodBranded": return cr(e, n);
|
|
1095
|
+
case "ZodReadonly": return Wr(e, n);
|
|
1096
|
+
case "ZodCatch": return lr(e, n);
|
|
1097
|
+
case "ZodPipeline": return Rr(e, n);
|
|
1099
1098
|
case "ZodFunction":
|
|
1100
1099
|
case "ZodVoid":
|
|
1101
1100
|
case "ZodSymbol": return;
|
|
1102
1101
|
default: return /* @__PURE__ */ ((e) => void 0)(t);
|
|
1103
1102
|
}
|
|
1104
|
-
},
|
|
1103
|
+
}, Kr = (e, t) => {
|
|
1105
1104
|
let n = 0;
|
|
1106
1105
|
for (; n < e.length && n < t.length && e[n] === t[n]; n++);
|
|
1107
1106
|
return [(e.length - n).toString(), ...t.slice(n)].join("/");
|
|
1108
1107
|
};
|
|
1109
|
-
function
|
|
1108
|
+
function B(e, t, n = !1) {
|
|
1110
1109
|
let r = t.seen.get(e);
|
|
1111
1110
|
if (t.override) {
|
|
1112
1111
|
let i = t.override?.call(t, e, t, r, n);
|
|
1113
|
-
if (i !==
|
|
1112
|
+
if (i !== nr) return i;
|
|
1114
1113
|
}
|
|
1115
1114
|
if (r && !n) {
|
|
1116
|
-
let e =
|
|
1115
|
+
let e = qr(r, t);
|
|
1117
1116
|
if (e !== void 0) return e;
|
|
1118
1117
|
}
|
|
1119
1118
|
let i = {
|
|
@@ -1122,22 +1121,22 @@ function H(e, t, n = !1) {
|
|
|
1122
1121
|
jsonSchema: void 0
|
|
1123
1122
|
};
|
|
1124
1123
|
t.seen.set(e, i);
|
|
1125
|
-
let a =
|
|
1126
|
-
if (o &&
|
|
1124
|
+
let a = Gr(e, e.typeName, t), o = typeof a == "function" ? B(a(), t) : a;
|
|
1125
|
+
if (o && Jr(e, t, o), t.postProcess) {
|
|
1127
1126
|
let n = t.postProcess(o, e, t);
|
|
1128
1127
|
return i.jsonSchema = o, n;
|
|
1129
1128
|
}
|
|
1130
1129
|
return i.jsonSchema = o, o;
|
|
1131
1130
|
}
|
|
1132
|
-
var
|
|
1131
|
+
var qr = (e, t) => {
|
|
1133
1132
|
switch (t.$refStrategy) {
|
|
1134
1133
|
case "root": return { $ref: e.path.join("/") };
|
|
1135
|
-
case "relative": return { $ref:
|
|
1134
|
+
case "relative": return { $ref: Kr(t.currentPath, e.path) };
|
|
1136
1135
|
case "none":
|
|
1137
|
-
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`),
|
|
1136
|
+
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`), I()) : t.$refStrategy === "seen" ? I() : void 0;
|
|
1138
1137
|
}
|
|
1139
|
-
},
|
|
1140
|
-
let t =
|
|
1138
|
+
}, Jr = (e, t, n) => (e.description && (n.description = e.description), n), Yr = (e) => {
|
|
1139
|
+
let t = ir(e), n = t.name === void 0 ? t.basePath : [
|
|
1141
1140
|
...t.basePath,
|
|
1142
1141
|
t.definitionPath,
|
|
1143
1142
|
t.name
|
|
@@ -1156,25 +1155,25 @@ var Gr = (e, t) => {
|
|
|
1156
1155
|
jsonSchema: void 0
|
|
1157
1156
|
}]))
|
|
1158
1157
|
};
|
|
1159
|
-
},
|
|
1160
|
-
let n =
|
|
1158
|
+
}, Xr = (e, t) => {
|
|
1159
|
+
let n = Yr(t), r = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((e, [t, r]) => ({
|
|
1161
1160
|
...e,
|
|
1162
|
-
[t]:
|
|
1161
|
+
[t]: B(r._def, {
|
|
1163
1162
|
...n,
|
|
1164
1163
|
currentPath: [
|
|
1165
1164
|
...n.basePath,
|
|
1166
1165
|
n.definitionPath,
|
|
1167
1166
|
t
|
|
1168
1167
|
]
|
|
1169
|
-
}, !0) ??
|
|
1170
|
-
}), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a =
|
|
1168
|
+
}, !0) ?? I()
|
|
1169
|
+
}), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = B(e._def, i === void 0 ? n : {
|
|
1171
1170
|
...n,
|
|
1172
1171
|
currentPath: [
|
|
1173
1172
|
...n.basePath,
|
|
1174
1173
|
n.definitionPath,
|
|
1175
1174
|
i
|
|
1176
1175
|
]
|
|
1177
|
-
}, !1) ??
|
|
1176
|
+
}, !1) ?? I(), o = typeof t == "object" && t.name !== void 0 && t.nameStrategy === "title" ? t.name : void 0;
|
|
1178
1177
|
o !== void 0 && (a.title = o);
|
|
1179
1178
|
let s = i === void 0 ? r ? {
|
|
1180
1179
|
...a,
|
|
@@ -1191,14 +1190,14 @@ var Gr = (e, t) => {
|
|
|
1191
1190
|
}
|
|
1192
1191
|
};
|
|
1193
1192
|
return s.$schema = "http://json-schema.org/draft-07/schema#", s;
|
|
1194
|
-
},
|
|
1195
|
-
function
|
|
1193
|
+
}, Zr = /* @__PURE__ */ Symbol.for("vercel.ai.schema");
|
|
1194
|
+
function Qr(e) {
|
|
1196
1195
|
let t;
|
|
1197
1196
|
return () => (t ??= e(), t);
|
|
1198
1197
|
}
|
|
1199
|
-
function
|
|
1198
|
+
function $r(e, { validate: t } = {}) {
|
|
1200
1199
|
return {
|
|
1201
|
-
[
|
|
1200
|
+
[Zr]: !0,
|
|
1202
1201
|
_type: void 0,
|
|
1203
1202
|
get jsonSchema() {
|
|
1204
1203
|
return typeof e == "function" && (e = e()), e;
|
|
@@ -1206,20 +1205,20 @@ function Zr(e, { validate: t } = {}) {
|
|
|
1206
1205
|
validate: t
|
|
1207
1206
|
};
|
|
1208
1207
|
}
|
|
1209
|
-
function
|
|
1210
|
-
return typeof e == "object" && !!e &&
|
|
1208
|
+
function ei(e) {
|
|
1209
|
+
return typeof e == "object" && !!e && Zr in e && e[Zr] === !0 && "jsonSchema" in e && "validate" in e;
|
|
1211
1210
|
}
|
|
1212
|
-
function
|
|
1213
|
-
return e == null ?
|
|
1211
|
+
function ti(e) {
|
|
1212
|
+
return e == null ? $r({
|
|
1214
1213
|
type: "object",
|
|
1215
1214
|
properties: {},
|
|
1216
1215
|
additionalProperties: !1
|
|
1217
|
-
}) :
|
|
1216
|
+
}) : ei(e) ? e : "~standard" in e ? e["~standard"].vendor === "zod" ? si(e) : ni(e) : e();
|
|
1218
1217
|
}
|
|
1219
|
-
function
|
|
1220
|
-
return
|
|
1221
|
-
if (!
|
|
1222
|
-
return
|
|
1218
|
+
function ni(e) {
|
|
1219
|
+
return $r(() => {
|
|
1220
|
+
if (!ri(e)) throw Error(`Standard schema vendor '${e["~standard"].vendor}' does not support JSON Schema conversion.`);
|
|
1221
|
+
return er(e["~standard"].jsonSchema.input({ target: "draft-07" }));
|
|
1223
1222
|
}, { validate: async (t) => {
|
|
1224
1223
|
let n = await e["~standard"].validate(t);
|
|
1225
1224
|
return "value" in n ? {
|
|
@@ -1227,19 +1226,19 @@ function ei(e) {
|
|
|
1227
1226
|
value: n.value
|
|
1228
1227
|
} : {
|
|
1229
1228
|
success: !1,
|
|
1230
|
-
error: new
|
|
1229
|
+
error: new P({
|
|
1231
1230
|
value: t,
|
|
1232
1231
|
cause: n.issues
|
|
1233
1232
|
})
|
|
1234
1233
|
};
|
|
1235
1234
|
} });
|
|
1236
1235
|
}
|
|
1237
|
-
function
|
|
1236
|
+
function ri(e) {
|
|
1238
1237
|
return e["~standard"].jsonSchema != null;
|
|
1239
1238
|
}
|
|
1240
|
-
function
|
|
1239
|
+
function ii(e, t) {
|
|
1241
1240
|
let n = t?.useReferences ?? !1;
|
|
1242
|
-
return
|
|
1241
|
+
return $r(() => Xr(e, { $refStrategy: n ? "root" : "none" }), { validate: async (t) => {
|
|
1243
1242
|
let n = await e.safeParseAsync(t);
|
|
1244
1243
|
return n.success ? {
|
|
1245
1244
|
success: !0,
|
|
@@ -1250,14 +1249,14 @@ function ni(e, t) {
|
|
|
1250
1249
|
};
|
|
1251
1250
|
} });
|
|
1252
1251
|
}
|
|
1253
|
-
function
|
|
1252
|
+
function ai(e, t) {
|
|
1254
1253
|
let n = t?.useReferences ?? !1;
|
|
1255
|
-
return
|
|
1254
|
+
return $r(() => er(at(e, {
|
|
1256
1255
|
target: "draft-7",
|
|
1257
1256
|
io: "input",
|
|
1258
1257
|
reused: n ? "ref" : "inline"
|
|
1259
1258
|
})), { validate: async (t) => {
|
|
1260
|
-
let n = await
|
|
1259
|
+
let n = await ot(e, t);
|
|
1261
1260
|
return n.success ? {
|
|
1262
1261
|
success: !0,
|
|
1263
1262
|
value: n.data
|
|
@@ -1267,27 +1266,27 @@ function ri(e, t) {
|
|
|
1267
1266
|
};
|
|
1268
1267
|
} });
|
|
1269
1268
|
}
|
|
1270
|
-
function
|
|
1269
|
+
function oi(e) {
|
|
1271
1270
|
return "_zod" in e;
|
|
1272
1271
|
}
|
|
1273
|
-
function
|
|
1274
|
-
return
|
|
1272
|
+
function si(e, t) {
|
|
1273
|
+
return oi(e) ? ai(e, t) : ii(e, t);
|
|
1275
1274
|
}
|
|
1276
|
-
async function
|
|
1277
|
-
let r = await
|
|
1275
|
+
async function ci({ value: e, schema: t, context: n }) {
|
|
1276
|
+
let r = await li({
|
|
1278
1277
|
value: e,
|
|
1279
1278
|
schema: t,
|
|
1280
1279
|
context: n
|
|
1281
1280
|
});
|
|
1282
|
-
if (!r.success) throw
|
|
1281
|
+
if (!r.success) throw P.wrap({
|
|
1283
1282
|
value: e,
|
|
1284
1283
|
cause: r.error,
|
|
1285
1284
|
context: n
|
|
1286
1285
|
});
|
|
1287
1286
|
return r.value;
|
|
1288
1287
|
}
|
|
1289
|
-
async function
|
|
1290
|
-
let r =
|
|
1288
|
+
async function li({ value: e, schema: t, context: n }) {
|
|
1289
|
+
let r = ti(t);
|
|
1291
1290
|
try {
|
|
1292
1291
|
if (r.validate == null) return {
|
|
1293
1292
|
success: !0,
|
|
@@ -1301,7 +1300,7 @@ async function si({ value: e, schema: t, context: n }) {
|
|
|
1301
1300
|
rawValue: e
|
|
1302
1301
|
} : {
|
|
1303
1302
|
success: !1,
|
|
1304
|
-
error:
|
|
1303
|
+
error: P.wrap({
|
|
1305
1304
|
value: e,
|
|
1306
1305
|
cause: t.error,
|
|
1307
1306
|
context: n
|
|
@@ -1311,7 +1310,7 @@ async function si({ value: e, schema: t, context: n }) {
|
|
|
1311
1310
|
} catch (t) {
|
|
1312
1311
|
return {
|
|
1313
1312
|
success: !1,
|
|
1314
|
-
error:
|
|
1313
|
+
error: P.wrap({
|
|
1315
1314
|
value: e,
|
|
1316
1315
|
cause: t,
|
|
1317
1316
|
context: n
|
|
@@ -1320,21 +1319,21 @@ async function si({ value: e, schema: t, context: n }) {
|
|
|
1320
1319
|
};
|
|
1321
1320
|
}
|
|
1322
1321
|
}
|
|
1323
|
-
async function
|
|
1322
|
+
async function ui({ text: e, schema: t }) {
|
|
1324
1323
|
try {
|
|
1325
|
-
let n =
|
|
1324
|
+
let n = $n(e);
|
|
1326
1325
|
return t == null ? {
|
|
1327
1326
|
success: !0,
|
|
1328
1327
|
value: n,
|
|
1329
1328
|
rawValue: n
|
|
1330
|
-
} : await
|
|
1329
|
+
} : await li({
|
|
1331
1330
|
value: n,
|
|
1332
1331
|
schema: t
|
|
1333
1332
|
});
|
|
1334
1333
|
} catch (t) {
|
|
1335
1334
|
return {
|
|
1336
1335
|
success: !1,
|
|
1337
|
-
error:
|
|
1336
|
+
error: Cn.isInstance(t) ? t : new Cn({
|
|
1338
1337
|
text: e,
|
|
1339
1338
|
cause: t
|
|
1340
1339
|
}),
|
|
@@ -1342,56 +1341,56 @@ async function ci({ text: e, schema: t }) {
|
|
|
1342
1341
|
};
|
|
1343
1342
|
}
|
|
1344
1343
|
}
|
|
1345
|
-
function
|
|
1346
|
-
return e.pipeThrough(new TextDecoderStream()).pipeThrough(new
|
|
1347
|
-
e !== "[DONE]" && n.enqueue(await
|
|
1344
|
+
function di({ stream: e, schema: t }) {
|
|
1345
|
+
return e.pipeThrough(new TextDecoderStream()).pipeThrough(new Un()).pipeThrough(new TransformStream({ async transform({ data: e }, n) {
|
|
1346
|
+
e !== "[DONE]" && n.enqueue(await ui({
|
|
1348
1347
|
text: e,
|
|
1349
1348
|
schema: t
|
|
1350
1349
|
}));
|
|
1351
1350
|
} }));
|
|
1352
1351
|
}
|
|
1353
|
-
async function
|
|
1352
|
+
async function V(e) {
|
|
1354
1353
|
return typeof e == "function" && (e = e()), Promise.resolve(e);
|
|
1355
1354
|
}
|
|
1356
1355
|
new TextDecoder();
|
|
1357
|
-
var
|
|
1358
|
-
for (var n in t)
|
|
1356
|
+
var fi = Object.defineProperty, pi = (e, t) => {
|
|
1357
|
+
for (var n in t) fi(e, n, {
|
|
1359
1358
|
get: t[n],
|
|
1360
1359
|
enumerable: !0
|
|
1361
1360
|
});
|
|
1362
|
-
},
|
|
1361
|
+
}, mi = "AI_InvalidArgumentError", hi = `vercel.ai.error.${mi}`, gi = Symbol.for(hi), _i, vi, yi = class extends (vi = N, _i = gi, vi) {
|
|
1363
1362
|
constructor({ parameter: e, value: t, message: n }) {
|
|
1364
1363
|
super({
|
|
1365
|
-
name:
|
|
1364
|
+
name: mi,
|
|
1366
1365
|
message: `Invalid argument for parameter ${e}: ${n}`
|
|
1367
|
-
}), this[
|
|
1366
|
+
}), this[_i] = !0, this.parameter = e, this.value = t;
|
|
1368
1367
|
}
|
|
1369
1368
|
static isInstance(e) {
|
|
1370
|
-
return
|
|
1369
|
+
return N.hasMarker(e, hi);
|
|
1371
1370
|
}
|
|
1372
|
-
},
|
|
1371
|
+
}, bi = "AI_NoObjectGeneratedError", xi = `vercel.ai.error.${bi}`, Si = Symbol.for(xi), Ci, wi, H = class extends (wi = N, Ci = Si, wi) {
|
|
1373
1372
|
constructor({ message: e = "No object generated.", cause: t, text: n, response: r, usage: i, finishReason: a }) {
|
|
1374
1373
|
super({
|
|
1375
|
-
name:
|
|
1374
|
+
name: bi,
|
|
1376
1375
|
message: e,
|
|
1377
1376
|
cause: t
|
|
1378
|
-
}), this[
|
|
1377
|
+
}), this[Ci] = !0, this.text = n, this.response = r, this.usage = i, this.finishReason = a;
|
|
1379
1378
|
}
|
|
1380
1379
|
static isInstance(e) {
|
|
1381
|
-
return
|
|
1380
|
+
return N.hasMarker(e, xi);
|
|
1382
1381
|
}
|
|
1383
|
-
},
|
|
1382
|
+
}, Ti = "AI_UIMessageStreamError", Ei = `vercel.ai.error.${Ti}`, Di = Symbol.for(Ei), Oi, ki, Ai = class extends (ki = N, Oi = Di, ki) {
|
|
1384
1383
|
constructor({ chunkType: e, chunkId: t, message: n }) {
|
|
1385
1384
|
super({
|
|
1386
|
-
name:
|
|
1385
|
+
name: Ti,
|
|
1387
1386
|
message: n
|
|
1388
|
-
}), this[
|
|
1387
|
+
}), this[Oi] = !0, this.chunkType = e, this.chunkId = t;
|
|
1389
1388
|
}
|
|
1390
1389
|
static isInstance(e) {
|
|
1391
|
-
return
|
|
1390
|
+
return N.hasMarker(e, Ei);
|
|
1392
1391
|
}
|
|
1393
1392
|
};
|
|
1394
|
-
function
|
|
1393
|
+
function ji({ warning: e, provider: t, model: n }) {
|
|
1395
1394
|
let r = `AI SDK Warning${t != null && n != null ? ` (${t} / ${n})` : ""}:`;
|
|
1396
1395
|
switch (e.type) {
|
|
1397
1396
|
case "unsupported": {
|
|
@@ -1407,11 +1406,11 @@ function Ai({ warning: e, provider: t, model: n }) {
|
|
|
1407
1406
|
default: return `${r} ${JSON.stringify(e, null, 2)}`;
|
|
1408
1407
|
}
|
|
1409
1408
|
}
|
|
1410
|
-
var
|
|
1411
|
-
function
|
|
1409
|
+
var Mi = "AI SDK Warning System: To turn off warning logging, set the AI_SDK_LOG_WARNINGS global to false.", Ni = !1;
|
|
1410
|
+
function Pi({ message: e, type: t }) {
|
|
1412
1411
|
typeof process < "u" && typeof process.emitWarning == "function" ? process.emitWarning(e, { type: t }) : console.warn(e);
|
|
1413
1412
|
}
|
|
1414
|
-
var
|
|
1413
|
+
var Fi = (e) => {
|
|
1415
1414
|
if (e.warnings.length === 0) return;
|
|
1416
1415
|
let t = globalThis.AI_SDK_LOG_WARNINGS;
|
|
1417
1416
|
if (t !== !1) {
|
|
@@ -1419,12 +1418,12 @@ var Pi = (e) => {
|
|
|
1419
1418
|
t(e);
|
|
1420
1419
|
return;
|
|
1421
1420
|
}
|
|
1422
|
-
|
|
1423
|
-
message:
|
|
1421
|
+
Ni || (Ni = !0, Pi({
|
|
1422
|
+
message: Mi,
|
|
1424
1423
|
type: "Warning"
|
|
1425
1424
|
}));
|
|
1426
|
-
for (let t of e.warnings)
|
|
1427
|
-
message:
|
|
1425
|
+
for (let t of e.warnings) Pi({
|
|
1426
|
+
message: ji({
|
|
1428
1427
|
warning: t,
|
|
1429
1428
|
provider: e.provider,
|
|
1430
1429
|
model: e.model
|
|
@@ -1433,7 +1432,7 @@ var Pi = (e) => {
|
|
|
1433
1432
|
});
|
|
1434
1433
|
}
|
|
1435
1434
|
};
|
|
1436
|
-
function
|
|
1435
|
+
function Ii(e, t) {
|
|
1437
1436
|
if (e === void 0 && t === void 0) return;
|
|
1438
1437
|
if (e === void 0) return t;
|
|
1439
1438
|
if (t === void 0) return e;
|
|
@@ -1442,261 +1441,261 @@ function Fi(e, t) {
|
|
|
1442
1441
|
let i = t[r];
|
|
1443
1442
|
if (i === void 0) continue;
|
|
1444
1443
|
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);
|
|
1445
|
-
n[r] = o && s ?
|
|
1444
|
+
n[r] = o && s ? Ii(a, i) : i;
|
|
1446
1445
|
}
|
|
1447
1446
|
return n;
|
|
1448
1447
|
}
|
|
1449
|
-
var
|
|
1450
|
-
array:
|
|
1451
|
-
boolean:
|
|
1452
|
-
custom:
|
|
1453
|
-
discriminatedUnion:
|
|
1454
|
-
enum:
|
|
1448
|
+
var U = {
|
|
1449
|
+
array: Ye,
|
|
1450
|
+
boolean: lt,
|
|
1451
|
+
custom: it,
|
|
1452
|
+
discriminatedUnion: Xe,
|
|
1453
|
+
enum: dt,
|
|
1455
1454
|
instanceof: st,
|
|
1456
|
-
lazy:
|
|
1457
|
-
literal:
|
|
1458
|
-
looseObject:
|
|
1459
|
-
never:
|
|
1460
|
-
null:
|
|
1461
|
-
number:
|
|
1462
|
-
object:
|
|
1455
|
+
lazy: tt,
|
|
1456
|
+
literal: ct,
|
|
1457
|
+
looseObject: qe,
|
|
1458
|
+
never: $e,
|
|
1459
|
+
null: ut,
|
|
1460
|
+
number: et,
|
|
1461
|
+
object: nt,
|
|
1463
1462
|
record: Ze,
|
|
1464
|
-
string:
|
|
1465
|
-
union:
|
|
1466
|
-
unknown:
|
|
1467
|
-
},
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
])),
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
]),
|
|
1480
|
-
type:
|
|
1481
|
-
text:
|
|
1482
|
-
providerOptions:
|
|
1483
|
-
}),
|
|
1484
|
-
type:
|
|
1485
|
-
image:
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1463
|
+
string: Qe,
|
|
1464
|
+
union: ft,
|
|
1465
|
+
unknown: Je
|
|
1466
|
+
}, Li = U.lazy(() => U.union([
|
|
1467
|
+
U.null(),
|
|
1468
|
+
U.string(),
|
|
1469
|
+
U.number(),
|
|
1470
|
+
U.boolean(),
|
|
1471
|
+
U.record(U.string(), Li.optional()),
|
|
1472
|
+
U.array(Li)
|
|
1473
|
+
])), W = U.record(U.string(), U.record(U.string(), Li.optional())), Ri = U.union([
|
|
1474
|
+
U.string(),
|
|
1475
|
+
U.instanceof(Uint8Array),
|
|
1476
|
+
U.instanceof(ArrayBuffer),
|
|
1477
|
+
U.custom(Jn, { message: "Must be a Buffer" })
|
|
1478
|
+
]), zi = U.record(U.string(), U.string()), Bi = U.object({
|
|
1479
|
+
type: U.literal("text"),
|
|
1480
|
+
text: U.string(),
|
|
1481
|
+
providerOptions: W.optional()
|
|
1482
|
+
}), Vi = U.object({
|
|
1483
|
+
type: U.literal("image"),
|
|
1484
|
+
image: U.union([
|
|
1485
|
+
Ri,
|
|
1486
|
+
U.instanceof(URL),
|
|
1487
|
+
zi
|
|
1489
1488
|
]),
|
|
1490
|
-
mediaType:
|
|
1491
|
-
providerOptions:
|
|
1492
|
-
}),
|
|
1493
|
-
|
|
1494
|
-
type:
|
|
1495
|
-
data:
|
|
1489
|
+
mediaType: U.string().optional(),
|
|
1490
|
+
providerOptions: W.optional()
|
|
1491
|
+
}), Hi = U.discriminatedUnion("type", [
|
|
1492
|
+
U.object({
|
|
1493
|
+
type: U.literal("data"),
|
|
1494
|
+
data: Ri
|
|
1496
1495
|
}),
|
|
1497
|
-
|
|
1498
|
-
type:
|
|
1499
|
-
url:
|
|
1496
|
+
U.object({
|
|
1497
|
+
type: U.literal("url"),
|
|
1498
|
+
url: U.instanceof(URL)
|
|
1500
1499
|
}),
|
|
1501
|
-
|
|
1502
|
-
type:
|
|
1503
|
-
reference:
|
|
1500
|
+
U.object({
|
|
1501
|
+
type: U.literal("reference"),
|
|
1502
|
+
reference: zi
|
|
1504
1503
|
}),
|
|
1505
|
-
|
|
1506
|
-
type:
|
|
1507
|
-
text:
|
|
1504
|
+
U.object({
|
|
1505
|
+
type: U.literal("text"),
|
|
1506
|
+
text: U.string()
|
|
1508
1507
|
})
|
|
1509
|
-
]),
|
|
1510
|
-
type:
|
|
1511
|
-
data:
|
|
1512
|
-
}),
|
|
1513
|
-
type:
|
|
1514
|
-
url:
|
|
1515
|
-
})]),
|
|
1516
|
-
type:
|
|
1517
|
-
data:
|
|
1518
|
-
Vi,
|
|
1519
|
-
Li,
|
|
1520
|
-
W.instanceof(URL),
|
|
1521
|
-
Ri
|
|
1522
|
-
]),
|
|
1523
|
-
filename: W.string().optional(),
|
|
1524
|
-
mediaType: W.string(),
|
|
1525
|
-
providerOptions: G.optional()
|
|
1526
|
-
}), Wi = W.object({
|
|
1527
|
-
type: W.literal("reasoning"),
|
|
1528
|
-
text: W.string(),
|
|
1529
|
-
providerOptions: G.optional()
|
|
1530
|
-
}), Gi = W.object({
|
|
1531
|
-
type: W.literal("custom"),
|
|
1532
|
-
kind: W.string().transform((e) => e),
|
|
1533
|
-
providerOptions: G.optional()
|
|
1534
|
-
}), Ki = W.object({
|
|
1535
|
-
type: W.literal("reasoning-file"),
|
|
1536
|
-
data: W.union([
|
|
1508
|
+
]), Ui = U.discriminatedUnion("type", [U.object({
|
|
1509
|
+
type: U.literal("data"),
|
|
1510
|
+
data: Ri
|
|
1511
|
+
}), U.object({
|
|
1512
|
+
type: U.literal("url"),
|
|
1513
|
+
url: U.instanceof(URL)
|
|
1514
|
+
})]), Wi = U.object({
|
|
1515
|
+
type: U.literal("file"),
|
|
1516
|
+
data: U.union([
|
|
1537
1517
|
Hi,
|
|
1538
|
-
|
|
1539
|
-
|
|
1518
|
+
Ri,
|
|
1519
|
+
U.instanceof(URL),
|
|
1520
|
+
zi
|
|
1540
1521
|
]),
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
W.
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1522
|
+
filename: U.string().optional(),
|
|
1523
|
+
mediaType: U.string(),
|
|
1524
|
+
providerOptions: W.optional()
|
|
1525
|
+
}), Gi = U.object({
|
|
1526
|
+
type: U.literal("reasoning"),
|
|
1527
|
+
text: U.string(),
|
|
1528
|
+
providerOptions: W.optional()
|
|
1529
|
+
}), Ki = U.object({
|
|
1530
|
+
type: U.literal("custom"),
|
|
1531
|
+
kind: U.string().transform((e) => e),
|
|
1532
|
+
providerOptions: W.optional()
|
|
1533
|
+
}), qi = U.object({
|
|
1534
|
+
type: U.literal("reasoning-file"),
|
|
1535
|
+
data: U.union([
|
|
1536
|
+
Ui,
|
|
1537
|
+
Ri,
|
|
1538
|
+
U.instanceof(URL)
|
|
1539
|
+
]),
|
|
1540
|
+
mediaType: U.string(),
|
|
1541
|
+
providerOptions: W.optional()
|
|
1542
|
+
}), Ji = U.object({
|
|
1543
|
+
type: U.literal("tool-call"),
|
|
1544
|
+
toolCallId: U.string(),
|
|
1545
|
+
toolName: U.string(),
|
|
1546
|
+
input: U.unknown(),
|
|
1547
|
+
providerOptions: W.optional(),
|
|
1548
|
+
providerExecuted: U.boolean().optional()
|
|
1549
|
+
}), Yi = U.discriminatedUnion("type", [
|
|
1550
|
+
U.object({
|
|
1551
|
+
type: U.literal("text"),
|
|
1552
|
+
value: U.string(),
|
|
1553
|
+
providerOptions: W.optional()
|
|
1555
1554
|
}),
|
|
1556
|
-
|
|
1557
|
-
type:
|
|
1558
|
-
value:
|
|
1559
|
-
providerOptions:
|
|
1555
|
+
U.object({
|
|
1556
|
+
type: U.literal("json"),
|
|
1557
|
+
value: Li,
|
|
1558
|
+
providerOptions: W.optional()
|
|
1560
1559
|
}),
|
|
1561
|
-
|
|
1562
|
-
type:
|
|
1563
|
-
reason:
|
|
1564
|
-
providerOptions:
|
|
1560
|
+
U.object({
|
|
1561
|
+
type: U.literal("execution-denied"),
|
|
1562
|
+
reason: U.string().optional(),
|
|
1563
|
+
providerOptions: W.optional()
|
|
1565
1564
|
}),
|
|
1566
|
-
|
|
1567
|
-
type:
|
|
1568
|
-
value:
|
|
1569
|
-
providerOptions:
|
|
1565
|
+
U.object({
|
|
1566
|
+
type: U.literal("error-text"),
|
|
1567
|
+
value: U.string(),
|
|
1568
|
+
providerOptions: W.optional()
|
|
1570
1569
|
}),
|
|
1571
|
-
|
|
1572
|
-
type:
|
|
1573
|
-
value:
|
|
1574
|
-
providerOptions:
|
|
1570
|
+
U.object({
|
|
1571
|
+
type: U.literal("error-json"),
|
|
1572
|
+
value: Li,
|
|
1573
|
+
providerOptions: W.optional()
|
|
1575
1574
|
}),
|
|
1576
|
-
|
|
1577
|
-
type:
|
|
1578
|
-
value:
|
|
1579
|
-
|
|
1580
|
-
type:
|
|
1581
|
-
text:
|
|
1582
|
-
providerOptions:
|
|
1575
|
+
U.object({
|
|
1576
|
+
type: U.literal("content"),
|
|
1577
|
+
value: U.array(U.union([
|
|
1578
|
+
U.object({
|
|
1579
|
+
type: U.literal("text"),
|
|
1580
|
+
text: U.string(),
|
|
1581
|
+
providerOptions: W.optional()
|
|
1583
1582
|
}),
|
|
1584
|
-
|
|
1585
|
-
type:
|
|
1586
|
-
data:
|
|
1587
|
-
mediaType:
|
|
1588
|
-
filename:
|
|
1589
|
-
providerOptions:
|
|
1583
|
+
U.object({
|
|
1584
|
+
type: U.literal("file"),
|
|
1585
|
+
data: Hi,
|
|
1586
|
+
mediaType: U.string(),
|
|
1587
|
+
filename: U.string().optional(),
|
|
1588
|
+
providerOptions: W.optional()
|
|
1590
1589
|
}),
|
|
1591
|
-
|
|
1592
|
-
type:
|
|
1593
|
-
data:
|
|
1594
|
-
mediaType:
|
|
1595
|
-
filename:
|
|
1596
|
-
providerOptions:
|
|
1590
|
+
U.object({
|
|
1591
|
+
type: U.literal("file-data"),
|
|
1592
|
+
data: U.string(),
|
|
1593
|
+
mediaType: U.string(),
|
|
1594
|
+
filename: U.string().optional(),
|
|
1595
|
+
providerOptions: W.optional()
|
|
1597
1596
|
}),
|
|
1598
|
-
|
|
1599
|
-
type:
|
|
1600
|
-
url:
|
|
1601
|
-
mediaType:
|
|
1602
|
-
providerOptions:
|
|
1597
|
+
U.object({
|
|
1598
|
+
type: U.literal("file-url"),
|
|
1599
|
+
url: U.string(),
|
|
1600
|
+
mediaType: U.string().optional(),
|
|
1601
|
+
providerOptions: W.optional()
|
|
1603
1602
|
}),
|
|
1604
|
-
|
|
1605
|
-
type:
|
|
1606
|
-
fileId:
|
|
1607
|
-
providerOptions:
|
|
1603
|
+
U.object({
|
|
1604
|
+
type: U.literal("file-id"),
|
|
1605
|
+
fileId: U.union([U.string(), U.record(U.string(), U.string())]),
|
|
1606
|
+
providerOptions: W.optional()
|
|
1608
1607
|
}),
|
|
1609
|
-
|
|
1610
|
-
type:
|
|
1611
|
-
providerReference:
|
|
1612
|
-
providerOptions:
|
|
1608
|
+
U.object({
|
|
1609
|
+
type: U.literal("file-reference"),
|
|
1610
|
+
providerReference: U.record(U.string(), U.string()),
|
|
1611
|
+
providerOptions: W.optional()
|
|
1613
1612
|
}),
|
|
1614
|
-
|
|
1615
|
-
type:
|
|
1616
|
-
data:
|
|
1617
|
-
mediaType:
|
|
1618
|
-
providerOptions:
|
|
1613
|
+
U.object({
|
|
1614
|
+
type: U.literal("image-data"),
|
|
1615
|
+
data: U.string(),
|
|
1616
|
+
mediaType: U.string(),
|
|
1617
|
+
providerOptions: W.optional()
|
|
1619
1618
|
}),
|
|
1620
|
-
|
|
1621
|
-
type:
|
|
1622
|
-
url:
|
|
1623
|
-
providerOptions:
|
|
1619
|
+
U.object({
|
|
1620
|
+
type: U.literal("image-url"),
|
|
1621
|
+
url: U.string(),
|
|
1622
|
+
providerOptions: W.optional()
|
|
1624
1623
|
}),
|
|
1625
|
-
|
|
1626
|
-
type:
|
|
1627
|
-
fileId:
|
|
1628
|
-
providerOptions:
|
|
1624
|
+
U.object({
|
|
1625
|
+
type: U.literal("image-file-id"),
|
|
1626
|
+
fileId: U.union([U.string(), U.record(U.string(), U.string())]),
|
|
1627
|
+
providerOptions: W.optional()
|
|
1629
1628
|
}),
|
|
1630
|
-
|
|
1631
|
-
type:
|
|
1632
|
-
providerReference:
|
|
1633
|
-
providerOptions:
|
|
1629
|
+
U.object({
|
|
1630
|
+
type: U.literal("image-file-reference"),
|
|
1631
|
+
providerReference: U.record(U.string(), U.string()),
|
|
1632
|
+
providerOptions: W.optional()
|
|
1634
1633
|
}),
|
|
1635
|
-
|
|
1636
|
-
type:
|
|
1637
|
-
providerOptions:
|
|
1634
|
+
U.object({
|
|
1635
|
+
type: U.literal("custom"),
|
|
1636
|
+
providerOptions: W.optional()
|
|
1638
1637
|
})
|
|
1639
1638
|
]))
|
|
1640
1639
|
})
|
|
1641
|
-
]),
|
|
1642
|
-
type:
|
|
1643
|
-
toolCallId:
|
|
1644
|
-
toolName:
|
|
1645
|
-
output:
|
|
1646
|
-
providerOptions:
|
|
1647
|
-
}),
|
|
1648
|
-
type:
|
|
1649
|
-
approvalId:
|
|
1650
|
-
toolCallId:
|
|
1651
|
-
reason:
|
|
1652
|
-
}),
|
|
1653
|
-
type:
|
|
1654
|
-
approvalId:
|
|
1655
|
-
approved:
|
|
1656
|
-
reason:
|
|
1657
|
-
}),
|
|
1658
|
-
role:
|
|
1659
|
-
content:
|
|
1660
|
-
providerOptions:
|
|
1661
|
-
}),
|
|
1662
|
-
role:
|
|
1663
|
-
content:
|
|
1664
|
-
zi,
|
|
1640
|
+
]), Xi = U.object({
|
|
1641
|
+
type: U.literal("tool-result"),
|
|
1642
|
+
toolCallId: U.string(),
|
|
1643
|
+
toolName: U.string(),
|
|
1644
|
+
output: Yi,
|
|
1645
|
+
providerOptions: W.optional()
|
|
1646
|
+
}), Zi = U.object({
|
|
1647
|
+
type: U.literal("tool-approval-request"),
|
|
1648
|
+
approvalId: U.string(),
|
|
1649
|
+
toolCallId: U.string(),
|
|
1650
|
+
reason: U.string().optional()
|
|
1651
|
+
}), Qi = U.object({
|
|
1652
|
+
type: U.literal("tool-approval-response"),
|
|
1653
|
+
approvalId: U.string(),
|
|
1654
|
+
approved: U.boolean(),
|
|
1655
|
+
reason: U.string().optional()
|
|
1656
|
+
}), $i = U.object({
|
|
1657
|
+
role: U.literal("system"),
|
|
1658
|
+
content: U.string(),
|
|
1659
|
+
providerOptions: W.optional()
|
|
1660
|
+
}), ea = U.object({
|
|
1661
|
+
role: U.literal("user"),
|
|
1662
|
+
content: U.union([U.string(), U.array(U.union([
|
|
1665
1663
|
Bi,
|
|
1666
|
-
|
|
1664
|
+
Vi,
|
|
1665
|
+
Wi
|
|
1667
1666
|
]))]),
|
|
1668
|
-
providerOptions:
|
|
1669
|
-
}),
|
|
1670
|
-
role:
|
|
1671
|
-
content:
|
|
1672
|
-
|
|
1673
|
-
Gi,
|
|
1674
|
-
Ui,
|
|
1675
|
-
Wi,
|
|
1667
|
+
providerOptions: W.optional()
|
|
1668
|
+
}), ta = U.object({
|
|
1669
|
+
role: U.literal("assistant"),
|
|
1670
|
+
content: U.union([U.string(), U.array(U.union([
|
|
1671
|
+
Bi,
|
|
1676
1672
|
Ki,
|
|
1673
|
+
Wi,
|
|
1674
|
+
Gi,
|
|
1677
1675
|
qi,
|
|
1678
|
-
|
|
1679
|
-
Xi
|
|
1676
|
+
Ji,
|
|
1677
|
+
Xi,
|
|
1678
|
+
Zi
|
|
1680
1679
|
]))]),
|
|
1681
|
-
providerOptions:
|
|
1682
|
-
}),
|
|
1683
|
-
role:
|
|
1684
|
-
content:
|
|
1685
|
-
providerOptions:
|
|
1680
|
+
providerOptions: W.optional()
|
|
1681
|
+
}), na = U.object({
|
|
1682
|
+
role: U.literal("tool"),
|
|
1683
|
+
content: U.array(U.union([Xi, Qi])),
|
|
1684
|
+
providerOptions: W.optional()
|
|
1686
1685
|
});
|
|
1687
|
-
|
|
1688
|
-
Qi,
|
|
1686
|
+
U.union([
|
|
1689
1687
|
$i,
|
|
1690
1688
|
ea,
|
|
1691
|
-
ta
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1689
|
+
ta,
|
|
1690
|
+
na
|
|
1691
|
+
]), pi({}, {
|
|
1692
|
+
array: () => sa,
|
|
1693
|
+
choice: () => ua,
|
|
1694
|
+
json: () => da,
|
|
1695
|
+
object: () => oa,
|
|
1696
|
+
text: () => aa
|
|
1698
1697
|
});
|
|
1699
|
-
function
|
|
1698
|
+
function ra(e) {
|
|
1700
1699
|
let t = ["ROOT"], n = -1, r = null, i = 0;
|
|
1701
1700
|
function a(e) {
|
|
1702
1701
|
return e >= "0" && e <= "9" || e >= "A" && e <= "F" || e >= "a" && e <= "f";
|
|
@@ -1878,16 +1877,16 @@ function na(e) {
|
|
|
1878
1877
|
}
|
|
1879
1878
|
return l;
|
|
1880
1879
|
}
|
|
1881
|
-
async function
|
|
1880
|
+
async function ia(e) {
|
|
1882
1881
|
if (e === void 0) return {
|
|
1883
1882
|
value: void 0,
|
|
1884
1883
|
state: "undefined-input"
|
|
1885
1884
|
};
|
|
1886
|
-
let t = await
|
|
1885
|
+
let t = await ui({ text: e });
|
|
1887
1886
|
return t.success ? {
|
|
1888
1887
|
value: t.value,
|
|
1889
1888
|
state: "successful-parse"
|
|
1890
|
-
} : (t = await
|
|
1889
|
+
} : (t = await ui({ text: ra(e) }), t.success ? {
|
|
1891
1890
|
value: t.value,
|
|
1892
1891
|
state: "repaired-parse"
|
|
1893
1892
|
} : {
|
|
@@ -1895,7 +1894,7 @@ async function ra(e) {
|
|
|
1895
1894
|
state: "failed-parse"
|
|
1896
1895
|
});
|
|
1897
1896
|
}
|
|
1898
|
-
var
|
|
1897
|
+
var aa = () => ({
|
|
1899
1898
|
name: "text",
|
|
1900
1899
|
responseFormat: Promise.resolve({ type: "text" }),
|
|
1901
1900
|
async parseCompleteOutput({ text: e }) {
|
|
@@ -1905,19 +1904,19 @@ var ia = () => ({
|
|
|
1905
1904
|
return { partial: e };
|
|
1906
1905
|
},
|
|
1907
1906
|
createElementStreamTransform() {}
|
|
1908
|
-
}),
|
|
1909
|
-
let r =
|
|
1907
|
+
}), oa = ({ schema: e, name: t, description: n }) => {
|
|
1908
|
+
let r = ti(e);
|
|
1910
1909
|
return {
|
|
1911
1910
|
name: "object",
|
|
1912
|
-
responseFormat:
|
|
1911
|
+
responseFormat: V(r.jsonSchema).then((e) => ({
|
|
1913
1912
|
type: "json",
|
|
1914
1913
|
schema: e,
|
|
1915
1914
|
...t != null && { name: t },
|
|
1916
1915
|
...n != null && { description: n }
|
|
1917
1916
|
})),
|
|
1918
1917
|
async parseCompleteOutput({ text: e }, t) {
|
|
1919
|
-
let n = await
|
|
1920
|
-
if (!n.success) throw new
|
|
1918
|
+
let n = await ui({ text: e });
|
|
1919
|
+
if (!n.success) throw new H({
|
|
1921
1920
|
message: "No object generated: could not parse the response.",
|
|
1922
1921
|
cause: n.error,
|
|
1923
1922
|
text: e,
|
|
@@ -1925,11 +1924,11 @@ var ia = () => ({
|
|
|
1925
1924
|
usage: t.usage,
|
|
1926
1925
|
finishReason: t.finishReason
|
|
1927
1926
|
});
|
|
1928
|
-
let i = await
|
|
1927
|
+
let i = await li({
|
|
1929
1928
|
value: n.value,
|
|
1930
1929
|
schema: r
|
|
1931
1930
|
});
|
|
1932
|
-
if (!i.success) throw new
|
|
1931
|
+
if (!i.success) throw new H({
|
|
1933
1932
|
message: "No object generated: response did not match schema.",
|
|
1934
1933
|
cause: i.error,
|
|
1935
1934
|
text: e,
|
|
@@ -1940,7 +1939,7 @@ var ia = () => ({
|
|
|
1940
1939
|
return i.value;
|
|
1941
1940
|
},
|
|
1942
1941
|
async parsePartialOutput({ text: e }) {
|
|
1943
|
-
let t = await
|
|
1942
|
+
let t = await ia(e);
|
|
1944
1943
|
switch (t.state) {
|
|
1945
1944
|
case "failed-parse":
|
|
1946
1945
|
case "undefined-input": return;
|
|
@@ -1950,22 +1949,22 @@ var ia = () => ({
|
|
|
1950
1949
|
},
|
|
1951
1950
|
createElementStreamTransform() {}
|
|
1952
1951
|
};
|
|
1953
|
-
},
|
|
1954
|
-
if (
|
|
1952
|
+
}, sa = ({ element: e, minItems: t, maxItems: n, name: r, description: i }) => {
|
|
1953
|
+
if (ca({
|
|
1955
1954
|
name: "minItems",
|
|
1956
1955
|
value: t
|
|
1957
|
-
}),
|
|
1956
|
+
}), ca({
|
|
1958
1957
|
name: "maxItems",
|
|
1959
1958
|
value: n
|
|
1960
|
-
}), t != null && n != null && t > n) throw new
|
|
1959
|
+
}), t != null && n != null && t > n) throw new yi({
|
|
1961
1960
|
parameter: "minItems",
|
|
1962
1961
|
value: t,
|
|
1963
1962
|
message: "minItems must be less than or equal to maxItems"
|
|
1964
1963
|
});
|
|
1965
|
-
let a =
|
|
1964
|
+
let a = ti(e);
|
|
1966
1965
|
return {
|
|
1967
1966
|
name: "array",
|
|
1968
|
-
responseFormat:
|
|
1967
|
+
responseFormat: V(a.jsonSchema).then((e) => {
|
|
1969
1968
|
let { $schema: a, definitions: o, $defs: s, ...c } = e;
|
|
1970
1969
|
return {
|
|
1971
1970
|
type: "json",
|
|
@@ -1988,8 +1987,8 @@ var ia = () => ({
|
|
|
1988
1987
|
};
|
|
1989
1988
|
}),
|
|
1990
1989
|
async parseCompleteOutput({ text: e }, r) {
|
|
1991
|
-
let i = await
|
|
1992
|
-
if (!i.success) throw new
|
|
1990
|
+
let i = await ui({ text: e });
|
|
1991
|
+
if (!i.success) throw new H({
|
|
1993
1992
|
message: "No object generated: could not parse the response.",
|
|
1994
1993
|
cause: i.error,
|
|
1995
1994
|
text: e,
|
|
@@ -1998,9 +1997,9 @@ var ia = () => ({
|
|
|
1998
1997
|
finishReason: r.finishReason
|
|
1999
1998
|
});
|
|
2000
1999
|
let o = i.value;
|
|
2001
|
-
if (typeof o != "object" || !o || !("elements" in o) || !Array.isArray(o.elements)) throw new
|
|
2000
|
+
if (typeof o != "object" || !o || !("elements" in o) || !Array.isArray(o.elements)) throw new H({
|
|
2002
2001
|
message: "No object generated: response did not match schema.",
|
|
2003
|
-
cause: new
|
|
2002
|
+
cause: new P({
|
|
2004
2003
|
value: o,
|
|
2005
2004
|
cause: "response must be an object with an elements array"
|
|
2006
2005
|
}),
|
|
@@ -2009,12 +2008,12 @@ var ia = () => ({
|
|
|
2009
2008
|
usage: r.usage,
|
|
2010
2009
|
finishReason: r.finishReason
|
|
2011
2010
|
});
|
|
2012
|
-
let s =
|
|
2011
|
+
let s = la({
|
|
2013
2012
|
value: o.elements,
|
|
2014
2013
|
minItems: t,
|
|
2015
2014
|
maxItems: n
|
|
2016
2015
|
});
|
|
2017
|
-
if (s != null) throw new
|
|
2016
|
+
if (s != null) throw new H({
|
|
2018
2017
|
message: "No object generated: response did not match schema.",
|
|
2019
2018
|
cause: s,
|
|
2020
2019
|
text: e,
|
|
@@ -2024,11 +2023,11 @@ var ia = () => ({
|
|
|
2024
2023
|
});
|
|
2025
2024
|
let c = [];
|
|
2026
2025
|
for (let t of o.elements) {
|
|
2027
|
-
let n = await
|
|
2026
|
+
let n = await li({
|
|
2028
2027
|
value: t,
|
|
2029
2028
|
schema: a
|
|
2030
2029
|
});
|
|
2031
|
-
if (!n.success) throw new
|
|
2030
|
+
if (!n.success) throw new H({
|
|
2032
2031
|
message: "No object generated: response did not match schema.",
|
|
2033
2032
|
cause: n.error,
|
|
2034
2033
|
text: e,
|
|
@@ -2041,7 +2040,7 @@ var ia = () => ({
|
|
|
2041
2040
|
return c;
|
|
2042
2041
|
},
|
|
2043
2042
|
async parsePartialOutput({ text: e }) {
|
|
2044
|
-
let t = await
|
|
2043
|
+
let t = await ia(e);
|
|
2045
2044
|
switch (t.state) {
|
|
2046
2045
|
case "failed-parse":
|
|
2047
2046
|
case "undefined-input": return;
|
|
@@ -2051,7 +2050,7 @@ var ia = () => ({
|
|
|
2051
2050
|
if (typeof e != "object" || !e || !("elements" in e) || !Array.isArray(e.elements)) return;
|
|
2052
2051
|
let n = t.state === "repaired-parse" && e.elements.length > 0 ? e.elements.slice(0, -1) : e.elements, r = [];
|
|
2053
2052
|
for (let e of n) {
|
|
2054
|
-
let t = await
|
|
2053
|
+
let t = await li({
|
|
2055
2054
|
value: e,
|
|
2056
2055
|
schema: a
|
|
2057
2056
|
});
|
|
@@ -2066,7 +2065,7 @@ var ia = () => ({
|
|
|
2066
2065
|
return new TransformStream({ transform({ partialOutput: t }, r) {
|
|
2067
2066
|
if (t != null) for (; e < t.length; e++) {
|
|
2068
2067
|
if (n != null && e >= n) {
|
|
2069
|
-
r.error(
|
|
2068
|
+
r.error(la({
|
|
2070
2069
|
value: t,
|
|
2071
2070
|
maxItems: n
|
|
2072
2071
|
}));
|
|
@@ -2078,31 +2077,31 @@ var ia = () => ({
|
|
|
2078
2077
|
}
|
|
2079
2078
|
};
|
|
2080
2079
|
};
|
|
2081
|
-
function
|
|
2080
|
+
function ca({ name: e, value: t }) {
|
|
2082
2081
|
if (t != null) {
|
|
2083
|
-
if (!Number.isInteger(t)) throw new
|
|
2082
|
+
if (!Number.isInteger(t)) throw new yi({
|
|
2084
2083
|
parameter: e,
|
|
2085
2084
|
value: t,
|
|
2086
2085
|
message: `${e} must be an integer`
|
|
2087
2086
|
});
|
|
2088
|
-
if (t < 0) throw new
|
|
2087
|
+
if (t < 0) throw new yi({
|
|
2089
2088
|
parameter: e,
|
|
2090
2089
|
value: t,
|
|
2091
2090
|
message: `${e} must be greater than or equal to 0`
|
|
2092
2091
|
});
|
|
2093
2092
|
}
|
|
2094
2093
|
}
|
|
2095
|
-
function
|
|
2096
|
-
if (t != null && e.length < t) return new
|
|
2094
|
+
function la({ value: e, minItems: t, maxItems: n }) {
|
|
2095
|
+
if (t != null && e.length < t) return new P({
|
|
2097
2096
|
value: e,
|
|
2098
2097
|
cause: `elements array must contain at least ${t} items`
|
|
2099
2098
|
});
|
|
2100
|
-
if (n != null && e.length > n) return new
|
|
2099
|
+
if (n != null && e.length > n) return new P({
|
|
2101
2100
|
value: e,
|
|
2102
2101
|
cause: `elements array must contain at most ${n} items`
|
|
2103
2102
|
});
|
|
2104
2103
|
}
|
|
2105
|
-
var
|
|
2104
|
+
var ua = ({ options: e, name: t, description: n }) => ({
|
|
2106
2105
|
name: "choice",
|
|
2107
2106
|
responseFormat: Promise.resolve({
|
|
2108
2107
|
type: "json",
|
|
@@ -2120,8 +2119,8 @@ var la = ({ options: e, name: t, description: n }) => ({
|
|
|
2120
2119
|
...n != null && { description: n }
|
|
2121
2120
|
}),
|
|
2122
2121
|
async parseCompleteOutput({ text: t }, n) {
|
|
2123
|
-
let r = await
|
|
2124
|
-
if (!r.success) throw new
|
|
2122
|
+
let r = await ui({ text: t });
|
|
2123
|
+
if (!r.success) throw new H({
|
|
2125
2124
|
message: "No object generated: could not parse the response.",
|
|
2126
2125
|
cause: r.error,
|
|
2127
2126
|
text: t,
|
|
@@ -2130,9 +2129,9 @@ var la = ({ options: e, name: t, description: n }) => ({
|
|
|
2130
2129
|
finishReason: n.finishReason
|
|
2131
2130
|
});
|
|
2132
2131
|
let i = r.value;
|
|
2133
|
-
if (typeof i != "object" || !i || !("result" in i) || typeof i.result != "string" || !e.includes(i.result)) throw new
|
|
2132
|
+
if (typeof i != "object" || !i || !("result" in i) || typeof i.result != "string" || !e.includes(i.result)) throw new H({
|
|
2134
2133
|
message: "No object generated: response did not match schema.",
|
|
2135
|
-
cause: new
|
|
2134
|
+
cause: new P({
|
|
2136
2135
|
value: i,
|
|
2137
2136
|
cause: "response must be an object that contains a choice value."
|
|
2138
2137
|
}),
|
|
@@ -2144,7 +2143,7 @@ var la = ({ options: e, name: t, description: n }) => ({
|
|
|
2144
2143
|
return i.result;
|
|
2145
2144
|
},
|
|
2146
2145
|
async parsePartialOutput({ text: t }) {
|
|
2147
|
-
let n = await
|
|
2146
|
+
let n = await ia(t);
|
|
2148
2147
|
switch (n.state) {
|
|
2149
2148
|
case "failed-parse":
|
|
2150
2149
|
case "undefined-input": return;
|
|
@@ -2158,7 +2157,7 @@ var la = ({ options: e, name: t, description: n }) => ({
|
|
|
2158
2157
|
}
|
|
2159
2158
|
},
|
|
2160
2159
|
createElementStreamTransform() {}
|
|
2161
|
-
}),
|
|
2160
|
+
}), da = ({ name: e, description: t } = {}) => ({
|
|
2162
2161
|
name: "json",
|
|
2163
2162
|
responseFormat: Promise.resolve({
|
|
2164
2163
|
type: "json",
|
|
@@ -2166,8 +2165,8 @@ var la = ({ options: e, name: t, description: n }) => ({
|
|
|
2166
2165
|
...t != null && { description: t }
|
|
2167
2166
|
}),
|
|
2168
2167
|
async parseCompleteOutput({ text: e }, t) {
|
|
2169
|
-
let n = await
|
|
2170
|
-
if (!n.success) throw new
|
|
2168
|
+
let n = await ui({ text: e });
|
|
2169
|
+
if (!n.success) throw new H({
|
|
2171
2170
|
message: "No object generated: could not parse the response.",
|
|
2172
2171
|
cause: n.error,
|
|
2173
2172
|
text: e,
|
|
@@ -2178,7 +2177,7 @@ var la = ({ options: e, name: t, description: n }) => ({
|
|
|
2178
2177
|
return n.value;
|
|
2179
2178
|
},
|
|
2180
2179
|
async parsePartialOutput({ text: e }) {
|
|
2181
|
-
let t = await
|
|
2180
|
+
let t = await ia(e);
|
|
2182
2181
|
switch (t.state) {
|
|
2183
2182
|
case "failed-parse":
|
|
2184
2183
|
case "undefined-input": return;
|
|
@@ -2188,19 +2187,19 @@ var la = ({ options: e, name: t, description: n }) => ({
|
|
|
2188
2187
|
},
|
|
2189
2188
|
createElementStreamTransform() {}
|
|
2190
2189
|
});
|
|
2191
|
-
new TextEncoder(), new TextEncoder(),
|
|
2190
|
+
new TextEncoder(), new TextEncoder(), F({
|
|
2192
2191
|
prefix: "aitxt",
|
|
2193
2192
|
size: 24
|
|
2194
|
-
}),
|
|
2193
|
+
}), F({
|
|
2195
2194
|
prefix: "call",
|
|
2196
2195
|
size: 24
|
|
2197
2196
|
});
|
|
2198
|
-
function
|
|
2197
|
+
function fa(e, t) {
|
|
2199
2198
|
let n = new Headers(e ?? {});
|
|
2200
2199
|
for (let [e, r] of Object.entries(t)) n.has(e) || n.set(e, r);
|
|
2201
2200
|
return n;
|
|
2202
2201
|
}
|
|
2203
|
-
var
|
|
2202
|
+
var pa = class extends TransformStream {
|
|
2204
2203
|
constructor() {
|
|
2205
2204
|
super({
|
|
2206
2205
|
transform(e, t) {
|
|
@@ -2213,15 +2212,15 @@ var fa = class extends TransformStream {
|
|
|
2213
2212
|
}
|
|
2214
2213
|
});
|
|
2215
2214
|
}
|
|
2216
|
-
},
|
|
2215
|
+
}, ma = {
|
|
2217
2216
|
"content-type": "text/event-stream",
|
|
2218
2217
|
"cache-control": "no-cache",
|
|
2219
2218
|
connection: "keep-alive",
|
|
2220
2219
|
"x-vercel-ai-ui-message-stream": "v1",
|
|
2221
2220
|
"x-accel-buffering": "no"
|
|
2222
2221
|
};
|
|
2223
|
-
function
|
|
2224
|
-
let a = r.pipeThrough(new
|
|
2222
|
+
function ha({ status: e, statusText: t, headers: n, stream: r, consumeSseStream: i }) {
|
|
2223
|
+
let a = r.pipeThrough(new pa());
|
|
2225
2224
|
if (i) {
|
|
2226
2225
|
let [e, t] = a.tee();
|
|
2227
2226
|
a = e, i({ stream: t });
|
|
@@ -2229,173 +2228,173 @@ function ma({ status: e, statusText: t, headers: n, stream: r, consumeSseStream:
|
|
|
2229
2228
|
return new Response(a.pipeThrough(new TextEncoderStream()), {
|
|
2230
2229
|
status: e,
|
|
2231
2230
|
statusText: t,
|
|
2232
|
-
headers:
|
|
2231
|
+
headers: fa(n, ma)
|
|
2233
2232
|
});
|
|
2234
2233
|
}
|
|
2235
|
-
var
|
|
2236
|
-
|
|
2237
|
-
type:
|
|
2238
|
-
id:
|
|
2239
|
-
providerMetadata:
|
|
2234
|
+
var ga = U.record(U.string(), Li.optional()), _a = Qr(() => si(U.union([
|
|
2235
|
+
U.looseObject({
|
|
2236
|
+
type: U.literal("text-start"),
|
|
2237
|
+
id: U.string(),
|
|
2238
|
+
providerMetadata: W.optional()
|
|
2240
2239
|
}),
|
|
2241
|
-
|
|
2242
|
-
type:
|
|
2243
|
-
id:
|
|
2244
|
-
delta:
|
|
2245
|
-
providerMetadata:
|
|
2240
|
+
U.looseObject({
|
|
2241
|
+
type: U.literal("text-delta"),
|
|
2242
|
+
id: U.string(),
|
|
2243
|
+
delta: U.string(),
|
|
2244
|
+
providerMetadata: W.optional()
|
|
2246
2245
|
}),
|
|
2247
|
-
|
|
2248
|
-
type:
|
|
2249
|
-
id:
|
|
2250
|
-
providerMetadata:
|
|
2246
|
+
U.looseObject({
|
|
2247
|
+
type: U.literal("text-end"),
|
|
2248
|
+
id: U.string(),
|
|
2249
|
+
providerMetadata: W.optional()
|
|
2251
2250
|
}),
|
|
2252
|
-
|
|
2253
|
-
type:
|
|
2254
|
-
errorText:
|
|
2251
|
+
U.looseObject({
|
|
2252
|
+
type: U.literal("error"),
|
|
2253
|
+
errorText: U.string()
|
|
2255
2254
|
}),
|
|
2256
|
-
|
|
2257
|
-
type:
|
|
2258
|
-
toolCallId:
|
|
2259
|
-
toolName:
|
|
2260
|
-
providerExecuted:
|
|
2261
|
-
providerMetadata:
|
|
2262
|
-
toolMetadata:
|
|
2263
|
-
dynamic:
|
|
2264
|
-
title:
|
|
2255
|
+
U.looseObject({
|
|
2256
|
+
type: U.literal("tool-input-start"),
|
|
2257
|
+
toolCallId: U.string(),
|
|
2258
|
+
toolName: U.string(),
|
|
2259
|
+
providerExecuted: U.boolean().optional(),
|
|
2260
|
+
providerMetadata: W.optional(),
|
|
2261
|
+
toolMetadata: ga.optional(),
|
|
2262
|
+
dynamic: U.boolean().optional(),
|
|
2263
|
+
title: U.string().optional()
|
|
2265
2264
|
}),
|
|
2266
|
-
|
|
2267
|
-
type:
|
|
2268
|
-
toolCallId:
|
|
2269
|
-
inputTextDelta:
|
|
2265
|
+
U.looseObject({
|
|
2266
|
+
type: U.literal("tool-input-delta"),
|
|
2267
|
+
toolCallId: U.string(),
|
|
2268
|
+
inputTextDelta: U.string()
|
|
2270
2269
|
}),
|
|
2271
|
-
|
|
2272
|
-
type:
|
|
2273
|
-
toolCallId:
|
|
2274
|
-
toolName:
|
|
2275
|
-
input:
|
|
2276
|
-
providerExecuted:
|
|
2277
|
-
providerMetadata:
|
|
2278
|
-
toolMetadata:
|
|
2279
|
-
dynamic:
|
|
2280
|
-
title:
|
|
2270
|
+
U.looseObject({
|
|
2271
|
+
type: U.literal("tool-input-available"),
|
|
2272
|
+
toolCallId: U.string(),
|
|
2273
|
+
toolName: U.string(),
|
|
2274
|
+
input: U.unknown(),
|
|
2275
|
+
providerExecuted: U.boolean().optional(),
|
|
2276
|
+
providerMetadata: W.optional(),
|
|
2277
|
+
toolMetadata: ga.optional(),
|
|
2278
|
+
dynamic: U.boolean().optional(),
|
|
2279
|
+
title: U.string().optional()
|
|
2281
2280
|
}),
|
|
2282
|
-
|
|
2283
|
-
type:
|
|
2284
|
-
toolCallId:
|
|
2285
|
-
toolName:
|
|
2286
|
-
input:
|
|
2287
|
-
providerExecuted:
|
|
2288
|
-
providerMetadata:
|
|
2289
|
-
toolMetadata:
|
|
2290
|
-
dynamic:
|
|
2291
|
-
errorText:
|
|
2292
|
-
title:
|
|
2281
|
+
U.looseObject({
|
|
2282
|
+
type: U.literal("tool-input-error"),
|
|
2283
|
+
toolCallId: U.string(),
|
|
2284
|
+
toolName: U.string(),
|
|
2285
|
+
input: U.unknown(),
|
|
2286
|
+
providerExecuted: U.boolean().optional(),
|
|
2287
|
+
providerMetadata: W.optional(),
|
|
2288
|
+
toolMetadata: ga.optional(),
|
|
2289
|
+
dynamic: U.boolean().optional(),
|
|
2290
|
+
errorText: U.string(),
|
|
2291
|
+
title: U.string().optional()
|
|
2293
2292
|
}),
|
|
2294
|
-
|
|
2295
|
-
type:
|
|
2296
|
-
approvalId:
|
|
2297
|
-
toolCallId:
|
|
2298
|
-
approvalDescriptor:
|
|
2299
|
-
reason:
|
|
2300
|
-
isAutomatic:
|
|
2301
|
-
signature:
|
|
2293
|
+
U.looseObject({
|
|
2294
|
+
type: U.literal("tool-approval-request"),
|
|
2295
|
+
approvalId: U.string(),
|
|
2296
|
+
toolCallId: U.string(),
|
|
2297
|
+
approvalDescriptor: U.unknown().optional(),
|
|
2298
|
+
reason: U.string().optional(),
|
|
2299
|
+
isAutomatic: U.boolean().optional(),
|
|
2300
|
+
signature: U.string().optional()
|
|
2302
2301
|
}),
|
|
2303
|
-
|
|
2304
|
-
type:
|
|
2305
|
-
approvalId:
|
|
2306
|
-
approved:
|
|
2307
|
-
reason:
|
|
2308
|
-
providerExecuted:
|
|
2309
|
-
providerMetadata:
|
|
2302
|
+
U.looseObject({
|
|
2303
|
+
type: U.literal("tool-approval-response"),
|
|
2304
|
+
approvalId: U.string(),
|
|
2305
|
+
approved: U.boolean(),
|
|
2306
|
+
reason: U.string().optional(),
|
|
2307
|
+
providerExecuted: U.boolean().optional(),
|
|
2308
|
+
providerMetadata: W.optional()
|
|
2310
2309
|
}),
|
|
2311
|
-
|
|
2312
|
-
type:
|
|
2313
|
-
toolCallId:
|
|
2314
|
-
output:
|
|
2315
|
-
providerExecuted:
|
|
2316
|
-
providerMetadata:
|
|
2317
|
-
toolMetadata:
|
|
2318
|
-
dynamic:
|
|
2319
|
-
preliminary:
|
|
2310
|
+
U.looseObject({
|
|
2311
|
+
type: U.literal("tool-output-available"),
|
|
2312
|
+
toolCallId: U.string(),
|
|
2313
|
+
output: U.unknown(),
|
|
2314
|
+
providerExecuted: U.boolean().optional(),
|
|
2315
|
+
providerMetadata: W.optional(),
|
|
2316
|
+
toolMetadata: ga.optional(),
|
|
2317
|
+
dynamic: U.boolean().optional(),
|
|
2318
|
+
preliminary: U.boolean().optional()
|
|
2320
2319
|
}),
|
|
2321
|
-
|
|
2322
|
-
type:
|
|
2323
|
-
toolCallId:
|
|
2324
|
-
errorText:
|
|
2325
|
-
providerExecuted:
|
|
2326
|
-
providerMetadata:
|
|
2327
|
-
toolMetadata:
|
|
2328
|
-
dynamic:
|
|
2320
|
+
U.looseObject({
|
|
2321
|
+
type: U.literal("tool-output-error"),
|
|
2322
|
+
toolCallId: U.string(),
|
|
2323
|
+
errorText: U.string(),
|
|
2324
|
+
providerExecuted: U.boolean().optional(),
|
|
2325
|
+
providerMetadata: W.optional(),
|
|
2326
|
+
toolMetadata: ga.optional(),
|
|
2327
|
+
dynamic: U.boolean().optional()
|
|
2329
2328
|
}),
|
|
2330
|
-
|
|
2331
|
-
type:
|
|
2332
|
-
toolCallId:
|
|
2329
|
+
U.looseObject({
|
|
2330
|
+
type: U.literal("tool-output-denied"),
|
|
2331
|
+
toolCallId: U.string()
|
|
2333
2332
|
}),
|
|
2334
|
-
|
|
2335
|
-
type:
|
|
2336
|
-
id:
|
|
2337
|
-
providerMetadata:
|
|
2333
|
+
U.looseObject({
|
|
2334
|
+
type: U.literal("reasoning-start"),
|
|
2335
|
+
id: U.string(),
|
|
2336
|
+
providerMetadata: W.optional()
|
|
2338
2337
|
}),
|
|
2339
|
-
|
|
2340
|
-
type:
|
|
2341
|
-
id:
|
|
2342
|
-
delta:
|
|
2343
|
-
providerMetadata:
|
|
2338
|
+
U.looseObject({
|
|
2339
|
+
type: U.literal("reasoning-delta"),
|
|
2340
|
+
id: U.string(),
|
|
2341
|
+
delta: U.string(),
|
|
2342
|
+
providerMetadata: W.optional()
|
|
2344
2343
|
}),
|
|
2345
|
-
|
|
2346
|
-
type:
|
|
2347
|
-
id:
|
|
2348
|
-
providerMetadata:
|
|
2344
|
+
U.looseObject({
|
|
2345
|
+
type: U.literal("reasoning-end"),
|
|
2346
|
+
id: U.string(),
|
|
2347
|
+
providerMetadata: W.optional()
|
|
2349
2348
|
}),
|
|
2350
|
-
|
|
2351
|
-
type:
|
|
2352
|
-
kind:
|
|
2353
|
-
providerMetadata:
|
|
2349
|
+
U.looseObject({
|
|
2350
|
+
type: U.literal("custom"),
|
|
2351
|
+
kind: U.string().transform((e) => e),
|
|
2352
|
+
providerMetadata: W.optional()
|
|
2354
2353
|
}),
|
|
2355
|
-
|
|
2356
|
-
type:
|
|
2357
|
-
sourceId:
|
|
2358
|
-
url:
|
|
2359
|
-
title:
|
|
2360
|
-
providerMetadata:
|
|
2354
|
+
U.looseObject({
|
|
2355
|
+
type: U.literal("source-url"),
|
|
2356
|
+
sourceId: U.string(),
|
|
2357
|
+
url: U.string(),
|
|
2358
|
+
title: U.string().optional(),
|
|
2359
|
+
providerMetadata: W.optional()
|
|
2361
2360
|
}),
|
|
2362
|
-
|
|
2363
|
-
type:
|
|
2364
|
-
sourceId:
|
|
2365
|
-
mediaType:
|
|
2366
|
-
title:
|
|
2367
|
-
filename:
|
|
2368
|
-
providerMetadata:
|
|
2361
|
+
U.looseObject({
|
|
2362
|
+
type: U.literal("source-document"),
|
|
2363
|
+
sourceId: U.string(),
|
|
2364
|
+
mediaType: U.string(),
|
|
2365
|
+
title: U.string(),
|
|
2366
|
+
filename: U.string().optional(),
|
|
2367
|
+
providerMetadata: W.optional()
|
|
2369
2368
|
}),
|
|
2370
|
-
|
|
2371
|
-
type:
|
|
2372
|
-
url:
|
|
2373
|
-
mediaType:
|
|
2374
|
-
providerMetadata:
|
|
2369
|
+
U.looseObject({
|
|
2370
|
+
type: U.literal("file"),
|
|
2371
|
+
url: U.string(),
|
|
2372
|
+
mediaType: U.string(),
|
|
2373
|
+
providerMetadata: W.optional()
|
|
2375
2374
|
}),
|
|
2376
|
-
|
|
2377
|
-
type:
|
|
2378
|
-
url:
|
|
2379
|
-
mediaType:
|
|
2380
|
-
providerMetadata:
|
|
2375
|
+
U.looseObject({
|
|
2376
|
+
type: U.literal("reasoning-file"),
|
|
2377
|
+
url: U.string(),
|
|
2378
|
+
mediaType: U.string(),
|
|
2379
|
+
providerMetadata: W.optional()
|
|
2381
2380
|
}),
|
|
2382
|
-
|
|
2383
|
-
type:
|
|
2384
|
-
id:
|
|
2385
|
-
data:
|
|
2386
|
-
transient:
|
|
2381
|
+
U.looseObject({
|
|
2382
|
+
type: U.custom((e) => typeof e == "string" && e.startsWith("data-"), { message: "Type must start with \"data-\"" }),
|
|
2383
|
+
id: U.string().optional(),
|
|
2384
|
+
data: U.unknown(),
|
|
2385
|
+
transient: U.boolean().optional()
|
|
2387
2386
|
}),
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
type:
|
|
2393
|
-
messageId:
|
|
2394
|
-
messageMetadata:
|
|
2387
|
+
U.looseObject({ type: U.literal("start-step") }),
|
|
2388
|
+
U.looseObject({ type: U.literal("finish-step") }),
|
|
2389
|
+
U.looseObject({ type: U.literal("reset-step") }),
|
|
2390
|
+
U.looseObject({
|
|
2391
|
+
type: U.literal("start"),
|
|
2392
|
+
messageId: U.string().optional(),
|
|
2393
|
+
messageMetadata: U.unknown().optional()
|
|
2395
2394
|
}),
|
|
2396
|
-
|
|
2397
|
-
type:
|
|
2398
|
-
finishReason:
|
|
2395
|
+
U.looseObject({
|
|
2396
|
+
type: U.literal("finish"),
|
|
2397
|
+
finishReason: U.enum([
|
|
2399
2398
|
"stop",
|
|
2400
2399
|
"length",
|
|
2401
2400
|
"content-filter",
|
|
@@ -2403,44 +2402,44 @@ var ha = W.record(W.string(), Ii.optional()), ga = Xr(() => ai(W.union([
|
|
|
2403
2402
|
"error",
|
|
2404
2403
|
"other"
|
|
2405
2404
|
]).optional(),
|
|
2406
|
-
messageMetadata:
|
|
2405
|
+
messageMetadata: U.unknown().optional()
|
|
2407
2406
|
}),
|
|
2408
|
-
|
|
2409
|
-
type:
|
|
2410
|
-
reason:
|
|
2407
|
+
U.looseObject({
|
|
2408
|
+
type: U.literal("abort"),
|
|
2409
|
+
reason: U.string().optional()
|
|
2411
2410
|
}),
|
|
2412
|
-
|
|
2413
|
-
type:
|
|
2414
|
-
messageMetadata:
|
|
2411
|
+
U.looseObject({
|
|
2412
|
+
type: U.literal("message-metadata"),
|
|
2413
|
+
messageMetadata: U.unknown()
|
|
2415
2414
|
})
|
|
2416
2415
|
])));
|
|
2417
|
-
function
|
|
2416
|
+
function va(e) {
|
|
2418
2417
|
return e.type.startsWith("data-");
|
|
2419
2418
|
}
|
|
2420
|
-
function
|
|
2419
|
+
function ya() {
|
|
2421
2420
|
return /* @__PURE__ */ Object.create(null);
|
|
2422
2421
|
}
|
|
2423
|
-
function
|
|
2422
|
+
function ba(e) {
|
|
2424
2423
|
return e.type.startsWith("tool-");
|
|
2425
2424
|
}
|
|
2426
|
-
function
|
|
2425
|
+
function xa(e) {
|
|
2427
2426
|
return e.type === "dynamic-tool";
|
|
2428
2427
|
}
|
|
2429
|
-
function
|
|
2430
|
-
return
|
|
2428
|
+
function G(e) {
|
|
2429
|
+
return ba(e) || xa(e);
|
|
2431
2430
|
}
|
|
2432
|
-
function
|
|
2431
|
+
function Sa(e) {
|
|
2433
2432
|
return e.type.split("-").slice(1).join("-");
|
|
2434
2433
|
}
|
|
2435
|
-
var
|
|
2434
|
+
var Ca = {
|
|
2436
2435
|
type: "deprecated",
|
|
2437
2436
|
setting: "rawInput in output-error UI message parts",
|
|
2438
2437
|
message: "Use the \"input\" field instead. The \"rawInput\" field will be removed in the next major version."
|
|
2439
2438
|
};
|
|
2440
|
-
function
|
|
2441
|
-
e.some((e) => e.parts.some((e) => typeof e == "object" && !!e && "type" in e && typeof e.type == "string" && (e.type === "dynamic-tool" || e.type.startsWith("tool-")) && "state" in e && e.state === "output-error" && Object.prototype.hasOwnProperty.call(e, "rawInput") && "rawInput" in e && e.rawInput !== void 0)) &&
|
|
2439
|
+
function wa(e) {
|
|
2440
|
+
e.some((e) => e.parts.some((e) => typeof e == "object" && !!e && "type" in e && typeof e.type == "string" && (e.type === "dynamic-tool" || e.type.startsWith("tool-")) && "state" in e && e.state === "output-error" && Object.prototype.hasOwnProperty.call(e, "rawInput") && "rawInput" in e && e.rawInput !== void 0)) && Fi({ warnings: [Ca] });
|
|
2442
2441
|
}
|
|
2443
|
-
function
|
|
2442
|
+
function Ta({ lastMessage: e, messageId: t }) {
|
|
2444
2443
|
return {
|
|
2445
2444
|
message: e?.role === "assistant" ? e : {
|
|
2446
2445
|
id: t,
|
|
@@ -2448,12 +2447,12 @@ function wa({ lastMessage: e, messageId: t }) {
|
|
|
2448
2447
|
role: "assistant",
|
|
2449
2448
|
parts: []
|
|
2450
2449
|
},
|
|
2451
|
-
activeTextParts:
|
|
2452
|
-
activeReasoningParts:
|
|
2453
|
-
partialToolCalls:
|
|
2450
|
+
activeTextParts: ya(),
|
|
2451
|
+
activeReasoningParts: ya(),
|
|
2452
|
+
partialToolCalls: ya()
|
|
2454
2453
|
};
|
|
2455
2454
|
}
|
|
2456
|
-
function
|
|
2455
|
+
function Ea({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdateMessageJob: r, onError: i, onToolCall: a, onData: o }) {
|
|
2457
2456
|
return e.pipeThrough(new TransformStream({ async transform(e, s) {
|
|
2458
2457
|
await r(async ({ state: r, write: c }) => {
|
|
2459
2458
|
function l() {
|
|
@@ -2462,7 +2461,7 @@ function Ta({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2462
2461
|
return e.slice(t + 1);
|
|
2463
2462
|
}
|
|
2464
2463
|
function u() {
|
|
2465
|
-
return l().filter(
|
|
2464
|
+
return l().filter(G);
|
|
2466
2465
|
}
|
|
2467
2466
|
function d(e) {
|
|
2468
2467
|
let t = u().find((t) => t.toolCallId === e);
|
|
@@ -2470,13 +2469,13 @@ function Ta({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2470
2469
|
let n = r.message.parts;
|
|
2471
2470
|
for (let r = n.length - 1; r >= 0; r--) {
|
|
2472
2471
|
let i = n[r];
|
|
2473
|
-
if (
|
|
2472
|
+
if (G(i) && i.toolCallId === e) {
|
|
2474
2473
|
t = i;
|
|
2475
2474
|
break;
|
|
2476
2475
|
}
|
|
2477
2476
|
}
|
|
2478
2477
|
}
|
|
2479
|
-
if (t == null) throw new
|
|
2478
|
+
if (t == null) throw new Ai({
|
|
2480
2479
|
chunkType: "tool-invocation",
|
|
2481
2480
|
chunkId: e,
|
|
2482
2481
|
message: `No tool invocation found for tool call ID "${e}".`
|
|
@@ -2484,8 +2483,8 @@ function Ta({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2484
2483
|
return t;
|
|
2485
2484
|
}
|
|
2486
2485
|
function f(e) {
|
|
2487
|
-
let t = r.message.parts.filter(
|
|
2488
|
-
if (t == null) throw new
|
|
2486
|
+
let t = r.message.parts.filter(G).find((t) => t.approval?.id === e);
|
|
2487
|
+
if (t == null) throw new Ai({
|
|
2489
2488
|
chunkType: "tool-approval-response",
|
|
2490
2489
|
chunkId: e,
|
|
2491
2490
|
message: `No tool invocation found for approval ID "${e}".`
|
|
@@ -2493,7 +2492,7 @@ function Ta({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2493
2492
|
return t;
|
|
2494
2493
|
}
|
|
2495
2494
|
function p(e, t) {
|
|
2496
|
-
let n = t ?? l().find((t) =>
|
|
2495
|
+
let n = t ?? l().find((t) => ba(t) && t.toolCallId === e.toolCallId), i = e, a = n;
|
|
2497
2496
|
if (n != null) {
|
|
2498
2497
|
n.state = e.state, a.input = i.input, a.output = i.output, a.errorText = i.errorText, a.rawInput = i.rawInput, a.preliminary = i.preliminary, e.title !== void 0 && (a.title = e.title), e.toolMetadata !== void 0 && (a.toolMetadata = e.toolMetadata), a.providerExecuted = i.providerExecuted ?? n.providerExecuted;
|
|
2499
2498
|
let t = i.providerMetadata;
|
|
@@ -2548,8 +2547,8 @@ function Ta({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2548
2547
|
}
|
|
2549
2548
|
async function h(e) {
|
|
2550
2549
|
if (e != null) {
|
|
2551
|
-
let n = r.message.metadata == null ? e :
|
|
2552
|
-
t != null && await
|
|
2550
|
+
let n = r.message.metadata == null ? e : Ii(r.message.metadata, e);
|
|
2551
|
+
t != null && await ci({
|
|
2553
2552
|
value: n,
|
|
2554
2553
|
schema: t,
|
|
2555
2554
|
context: {
|
|
@@ -2572,7 +2571,7 @@ function Ta({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2572
2571
|
}
|
|
2573
2572
|
case "text-delta": {
|
|
2574
2573
|
let t = r.activeTextParts[e.id];
|
|
2575
|
-
if (t == null) throw new
|
|
2574
|
+
if (t == null) throw new Ai({
|
|
2576
2575
|
chunkType: "text-delta",
|
|
2577
2576
|
chunkId: e.id,
|
|
2578
2577
|
message: `Received text-delta for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`
|
|
@@ -2582,7 +2581,7 @@ function Ta({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2582
2581
|
}
|
|
2583
2582
|
case "text-end": {
|
|
2584
2583
|
let t = r.activeTextParts[e.id];
|
|
2585
|
-
if (t == null) throw new
|
|
2584
|
+
if (t == null) throw new Ai({
|
|
2586
2585
|
chunkType: "text-end",
|
|
2587
2586
|
chunkId: e.id,
|
|
2588
2587
|
message: `Received text-end for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`
|
|
@@ -2612,7 +2611,7 @@ function Ta({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2612
2611
|
}
|
|
2613
2612
|
case "reasoning-delta": {
|
|
2614
2613
|
let t = r.activeReasoningParts[e.id];
|
|
2615
|
-
if (t == null) throw new
|
|
2614
|
+
if (t == null) throw new Ai({
|
|
2616
2615
|
chunkType: "reasoning-delta",
|
|
2617
2616
|
chunkId: e.id,
|
|
2618
2617
|
message: `Received reasoning-delta for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`
|
|
@@ -2622,7 +2621,7 @@ function Ta({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2622
2621
|
}
|
|
2623
2622
|
case "reasoning-end": {
|
|
2624
2623
|
let t = r.activeReasoningParts[e.id];
|
|
2625
|
-
if (t == null) throw new
|
|
2624
|
+
if (t == null) throw new Ai({
|
|
2626
2625
|
chunkType: "reasoning-end",
|
|
2627
2626
|
chunkId: e.id,
|
|
2628
2627
|
message: `Received reasoning-end for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`
|
|
@@ -2659,7 +2658,7 @@ function Ta({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2659
2658
|
}), c();
|
|
2660
2659
|
break;
|
|
2661
2660
|
case "tool-input-start": {
|
|
2662
|
-
let t = l().filter(
|
|
2661
|
+
let t = l().filter(ba);
|
|
2663
2662
|
r.partialToolCalls[e.toolCallId] = {
|
|
2664
2663
|
text: "",
|
|
2665
2664
|
toolName: e.toolName,
|
|
@@ -2690,13 +2689,13 @@ function Ta({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2690
2689
|
}
|
|
2691
2690
|
case "tool-input-delta": {
|
|
2692
2691
|
let t = r.partialToolCalls[e.toolCallId];
|
|
2693
|
-
if (t == null) throw new
|
|
2692
|
+
if (t == null) throw new Ai({
|
|
2694
2693
|
chunkType: "tool-input-delta",
|
|
2695
2694
|
chunkId: e.toolCallId,
|
|
2696
2695
|
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.`
|
|
2697
2696
|
});
|
|
2698
2697
|
t.text += e.inputTextDelta;
|
|
2699
|
-
let { value: n } = await
|
|
2698
|
+
let { value: n } = await ia(t.text);
|
|
2700
2699
|
t.dynamic ? m({
|
|
2701
2700
|
toolCallId: e.toolCallId,
|
|
2702
2701
|
toolName: t.toolName,
|
|
@@ -2736,7 +2735,7 @@ function Ta({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2736
2735
|
}), c(), a && !e.providerExecuted && await a({ toolCall: e });
|
|
2737
2736
|
break;
|
|
2738
2737
|
case "tool-input-error": {
|
|
2739
|
-
let t = l().filter(
|
|
2738
|
+
let t = l().filter(G).find((t) => t.toolCallId === e.toolCallId);
|
|
2740
2739
|
(t == null ? e.dynamic : t.type === "dynamic-tool") ? m({
|
|
2741
2740
|
toolCallId: e.toolCallId,
|
|
2742
2741
|
toolName: e.toolName,
|
|
@@ -2756,7 +2755,7 @@ function Ta({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2756
2755
|
providerExecuted: e.providerExecuted,
|
|
2757
2756
|
providerMetadata: e.providerMetadata,
|
|
2758
2757
|
toolMetadata: e.toolMetadata
|
|
2759
|
-
}),
|
|
2758
|
+
}), wa([r.message])), c();
|
|
2760
2759
|
break;
|
|
2761
2760
|
}
|
|
2762
2761
|
case "tool-approval-request": {
|
|
@@ -2800,7 +2799,7 @@ function Ta({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2800
2799
|
toolMetadata: t.toolMetadata
|
|
2801
2800
|
}, t) : p({
|
|
2802
2801
|
toolCallId: e.toolCallId,
|
|
2803
|
-
toolName:
|
|
2802
|
+
toolName: Sa(t),
|
|
2804
2803
|
state: "output-available",
|
|
2805
2804
|
input: t.input,
|
|
2806
2805
|
output: e.output,
|
|
@@ -2826,7 +2825,7 @@ function Ta({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2826
2825
|
toolMetadata: t.toolMetadata
|
|
2827
2826
|
}, t) : p({
|
|
2828
2827
|
toolCallId: e.toolCallId,
|
|
2829
|
-
toolName:
|
|
2828
|
+
toolName: Sa(t),
|
|
2830
2829
|
state: "output-error",
|
|
2831
2830
|
input: t.input,
|
|
2832
2831
|
rawInput: t.rawInput,
|
|
@@ -2844,7 +2843,7 @@ function Ta({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2844
2843
|
case "finish-step": break;
|
|
2845
2844
|
case "reset-step": {
|
|
2846
2845
|
let e = l();
|
|
2847
|
-
r.activeTextParts =
|
|
2846
|
+
r.activeTextParts = ya(), r.activeReasoningParts = ya(), r.partialToolCalls = ya(), e.length > 0 && (r.message.parts.splice(r.message.parts.length - e.length, e.length), c());
|
|
2848
2847
|
break;
|
|
2849
2848
|
}
|
|
2850
2849
|
case "start":
|
|
@@ -2859,10 +2858,10 @@ function Ta({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2859
2858
|
case "error":
|
|
2860
2859
|
i?.(Error(e.errorText));
|
|
2861
2860
|
break;
|
|
2862
|
-
default: if (
|
|
2861
|
+
default: if (va(e)) {
|
|
2863
2862
|
if (n?.[e.type] != null) {
|
|
2864
2863
|
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;
|
|
2865
|
-
await
|
|
2864
|
+
await ci({
|
|
2866
2865
|
value: e.data,
|
|
2867
2866
|
schema: n[e.type],
|
|
2868
2867
|
context: {
|
|
@@ -2885,7 +2884,7 @@ function Ta({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2885
2884
|
});
|
|
2886
2885
|
} }));
|
|
2887
2886
|
}
|
|
2888
|
-
async function
|
|
2887
|
+
async function Da({ stream: e, onError: t, abortSignal: n }) {
|
|
2889
2888
|
let r = e.getReader(), i = () => {
|
|
2890
2889
|
r.cancel().catch(() => {});
|
|
2891
2890
|
};
|
|
@@ -2901,29 +2900,29 @@ async function Ea({ stream: e, onError: t, abortSignal: n }) {
|
|
|
2901
2900
|
n?.removeEventListener("abort", i), r.releaseLock();
|
|
2902
2901
|
}
|
|
2903
2902
|
}
|
|
2904
|
-
|
|
2903
|
+
F({
|
|
2905
2904
|
prefix: "aitxt",
|
|
2906
2905
|
size: 24
|
|
2907
|
-
}),
|
|
2906
|
+
}), F({
|
|
2908
2907
|
prefix: "call",
|
|
2909
2908
|
size: 24
|
|
2910
|
-
}),
|
|
2909
|
+
}), F({
|
|
2911
2910
|
prefix: "aitxt",
|
|
2912
2911
|
size: 24
|
|
2913
|
-
}),
|
|
2912
|
+
}), F({
|
|
2914
2913
|
prefix: "call",
|
|
2915
2914
|
size: 24
|
|
2916
|
-
}),
|
|
2915
|
+
}), U.record(U.string(), Li.optional()), U.record(U.string(), U.string()), F({
|
|
2917
2916
|
prefix: "call",
|
|
2918
2917
|
size: 24
|
|
2919
|
-
}),
|
|
2918
|
+
}), F({
|
|
2920
2919
|
prefix: "call",
|
|
2921
2920
|
size: 24
|
|
2922
|
-
}), new TextEncoder(),
|
|
2921
|
+
}), new TextEncoder(), F({
|
|
2923
2922
|
prefix: "aiobj",
|
|
2924
2923
|
size: 24
|
|
2925
2924
|
});
|
|
2926
|
-
var { atob:
|
|
2925
|
+
var { atob: Oa } = globalThis, ka = class {
|
|
2927
2926
|
constructor() {
|
|
2928
2927
|
this.queue = [], this.isProcessing = !1;
|
|
2929
2928
|
}
|
|
@@ -2945,12 +2944,12 @@ var { atob: Da } = globalThis, Oa = class {
|
|
|
2945
2944
|
});
|
|
2946
2945
|
}
|
|
2947
2946
|
};
|
|
2948
|
-
|
|
2947
|
+
F({
|
|
2949
2948
|
prefix: "aiobj",
|
|
2950
2949
|
size: 24
|
|
2951
|
-
}),
|
|
2952
|
-
token:
|
|
2953
|
-
url:
|
|
2950
|
+
}), U.object({
|
|
2951
|
+
token: U.string().refine((e) => e.trim().length > 0),
|
|
2952
|
+
url: U.string().refine((e) => {
|
|
2954
2953
|
try {
|
|
2955
2954
|
let t = new URL(e);
|
|
2956
2955
|
return (t.protocol === "ws:" || t.protocol === "wss:") && t.hostname !== "";
|
|
@@ -2958,20 +2957,20 @@ I({
|
|
|
2958
2957
|
return !1;
|
|
2959
2958
|
}
|
|
2960
2959
|
}),
|
|
2961
|
-
expiresAt:
|
|
2962
|
-
tools:
|
|
2963
|
-
type:
|
|
2964
|
-
name:
|
|
2965
|
-
description:
|
|
2966
|
-
parameters:
|
|
2960
|
+
expiresAt: U.number().positive().max(2 ** 53 - 1).optional(),
|
|
2961
|
+
tools: U.array(U.object({
|
|
2962
|
+
type: U.literal("function"),
|
|
2963
|
+
name: U.string().min(1),
|
|
2964
|
+
description: U.string().optional(),
|
|
2965
|
+
parameters: U.record(U.string(), U.unknown())
|
|
2967
2966
|
})).optional()
|
|
2968
|
-
}),
|
|
2967
|
+
}), F({
|
|
2969
2968
|
prefix: "call",
|
|
2970
2969
|
size: 24
|
|
2971
2970
|
});
|
|
2972
|
-
async function
|
|
2971
|
+
async function Aa({ response: e, url: t, fallbackMessage: n }) {
|
|
2973
2972
|
let r = await e.text();
|
|
2974
|
-
return new
|
|
2973
|
+
return new rn({
|
|
2975
2974
|
message: r || n,
|
|
2976
2975
|
url: t,
|
|
2977
2976
|
requestBodyValues: void 0,
|
|
@@ -2979,9 +2978,9 @@ async function ka({ response: e, url: t, fallbackMessage: n }) {
|
|
|
2979
2978
|
responseBody: r
|
|
2980
2979
|
});
|
|
2981
2980
|
}
|
|
2982
|
-
async function
|
|
2981
|
+
async function ja(e) {
|
|
2983
2982
|
if (e == null) return [];
|
|
2984
|
-
if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new
|
|
2983
|
+
if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new Pn({
|
|
2985
2984
|
functionality: "FileList",
|
|
2986
2985
|
message: "FileList is not supported in the current environment"
|
|
2987
2986
|
});
|
|
@@ -3000,18 +2999,18 @@ async function Aa(e) {
|
|
|
3000
2999
|
};
|
|
3001
3000
|
}));
|
|
3002
3001
|
}
|
|
3003
|
-
function
|
|
3002
|
+
function Ma(e, t) {
|
|
3004
3003
|
let n = e.search(/[?#]/);
|
|
3005
3004
|
return n === -1 ? `${e}${t}` : `${e.slice(0, n)}${t}${e.slice(n)}`;
|
|
3006
3005
|
}
|
|
3007
|
-
var
|
|
3006
|
+
var Na = class {
|
|
3008
3007
|
constructor({ api: e = "/api/chat", credentials: t, headers: n, body: r, fetch: i, prepareSendMessagesRequest: a, prepareReconnectToStreamRequest: o }) {
|
|
3009
3008
|
this.api = e, this.credentials = t, this.headers = n, this.body = r, this.fetch = i, this.prepareSendMessagesRequest = a, this.prepareReconnectToStreamRequest = o;
|
|
3010
3009
|
}
|
|
3011
3010
|
async sendMessages({ abortSignal: e, ...t }) {
|
|
3012
|
-
let n = await
|
|
3013
|
-
...
|
|
3014
|
-
...
|
|
3011
|
+
let n = await V(this.body), r = await V(this.headers), i = await V(this.credentials), a = {
|
|
3012
|
+
...Kn(r),
|
|
3013
|
+
...Kn(t.headers)
|
|
3015
3014
|
}, o = await this.prepareSendMessagesRequest?.call(this, {
|
|
3016
3015
|
api: this.api,
|
|
3017
3016
|
id: t.chatId,
|
|
@@ -3025,7 +3024,7 @@ var Ma = class {
|
|
|
3025
3024
|
requestMetadata: t.metadata,
|
|
3026
3025
|
trigger: t.trigger,
|
|
3027
3026
|
messageId: t.messageId
|
|
3028
|
-
}), s = o?.api ?? this.api, c = o?.headers === void 0 ? a :
|
|
3027
|
+
}), s = o?.api ?? this.api, c = o?.headers === void 0 ? a : Kn(o.headers), l = o?.body === void 0 ? {
|
|
3029
3028
|
...n,
|
|
3030
3029
|
...t.body,
|
|
3031
3030
|
id: t.chatId,
|
|
@@ -3042,18 +3041,18 @@ var Ma = class {
|
|
|
3042
3041
|
credentials: u,
|
|
3043
3042
|
signal: e
|
|
3044
3043
|
});
|
|
3045
|
-
if (!d.ok) throw await
|
|
3044
|
+
if (!d.ok) throw await Aa({
|
|
3046
3045
|
response: d,
|
|
3047
3046
|
url: s,
|
|
3048
3047
|
fallbackMessage: "Failed to fetch the chat response."
|
|
3049
3048
|
});
|
|
3050
|
-
if (!d.body) throw new
|
|
3049
|
+
if (!d.body) throw new un({ message: "The response body is empty." });
|
|
3051
3050
|
return this.processResponseStream(d.body);
|
|
3052
3051
|
}
|
|
3053
3052
|
async reconnectToStream(e) {
|
|
3054
|
-
let t = await
|
|
3055
|
-
...
|
|
3056
|
-
...
|
|
3053
|
+
let t = await V(this.body), n = await V(this.headers), r = await V(this.credentials), i = {
|
|
3054
|
+
...Kn(n),
|
|
3055
|
+
...Kn(e.headers)
|
|
3057
3056
|
}, a = await this.prepareReconnectToStreamRequest?.call(this, {
|
|
3058
3057
|
api: this.api,
|
|
3059
3058
|
id: e.chatId,
|
|
@@ -3064,37 +3063,37 @@ var Ma = class {
|
|
|
3064
3063
|
headers: i,
|
|
3065
3064
|
credentials: r,
|
|
3066
3065
|
requestMetadata: e.metadata
|
|
3067
|
-
}), o = a?.api ??
|
|
3066
|
+
}), o = a?.api ?? Ma(this.api, `/${e.chatId}/stream`), s = a?.headers === void 0 ? i : Kn(a.headers), c = a?.credentials ?? r, l = await (this.fetch ?? globalThis.fetch)(o, {
|
|
3068
3067
|
method: "GET",
|
|
3069
3068
|
headers: s,
|
|
3070
3069
|
credentials: c,
|
|
3071
3070
|
signal: e.abortSignal
|
|
3072
3071
|
});
|
|
3073
3072
|
if (l.status === 204) return null;
|
|
3074
|
-
if (!l.ok) throw await
|
|
3073
|
+
if (!l.ok) throw await Aa({
|
|
3075
3074
|
response: l,
|
|
3076
3075
|
url: o,
|
|
3077
3076
|
fallbackMessage: "Failed to fetch the chat response."
|
|
3078
3077
|
});
|
|
3079
|
-
if (!l.body) throw new
|
|
3078
|
+
if (!l.body) throw new un({ message: "The response body is empty." });
|
|
3080
3079
|
return this.processResponseStream(l.body);
|
|
3081
3080
|
}
|
|
3082
|
-
},
|
|
3081
|
+
}, Pa = class extends Na {
|
|
3083
3082
|
constructor(e = {}) {
|
|
3084
3083
|
super(e);
|
|
3085
3084
|
}
|
|
3086
3085
|
processResponseStream(e) {
|
|
3087
|
-
return
|
|
3086
|
+
return di({
|
|
3088
3087
|
stream: e,
|
|
3089
|
-
schema:
|
|
3088
|
+
schema: _a
|
|
3090
3089
|
}).pipeThrough(new TransformStream({ async transform(e, t) {
|
|
3091
3090
|
if (!e.success) throw e.error;
|
|
3092
3091
|
t.enqueue(e.value);
|
|
3093
3092
|
} }));
|
|
3094
3093
|
}
|
|
3095
|
-
},
|
|
3096
|
-
constructor({ generateId: e =
|
|
3097
|
-
this.pendingMessagePreparations = /* @__PURE__ */ new Set(), this.activeResponse = void 0, this.activeResumeRequest = void 0, this.jobExecutor = new
|
|
3094
|
+
}, Fa = class {
|
|
3095
|
+
constructor({ generateId: e = qn, id: t = e(), transport: n = new Pa(), messageMetadataSchema: r, dataPartSchemas: i, state: a, onError: o, onToolCall: s, onFinish: c, onData: l, sendAutomaticallyWhen: u }) {
|
|
3096
|
+
this.pendingMessagePreparations = /* @__PURE__ */ new Set(), this.activeResponse = void 0, this.activeResumeRequest = void 0, this.jobExecutor = new ka(), this.sendMessage = async (e, t) => {
|
|
3098
3097
|
if (e == null) {
|
|
3099
3098
|
await this.makeRequest({
|
|
3100
3099
|
trigger: "submit-message",
|
|
@@ -3109,7 +3108,7 @@ var Ma = class {
|
|
|
3109
3108
|
this.pendingMessagePreparations.add(t);
|
|
3110
3109
|
let r;
|
|
3111
3110
|
try {
|
|
3112
|
-
r = Array.isArray(e.files) ? e.files : await
|
|
3111
|
+
r = Array.isArray(e.files) ? e.files : await ja(e.files);
|
|
3113
3112
|
} finally {
|
|
3114
3113
|
this.pendingMessagePreparations.delete(t);
|
|
3115
3114
|
}
|
|
@@ -3121,12 +3120,12 @@ var Ma = class {
|
|
|
3121
3120
|
} else n = e;
|
|
3122
3121
|
if (e.messageId != null) {
|
|
3123
3122
|
let t = this.state.messages.findIndex((t) => t.id === e.messageId);
|
|
3124
|
-
if (t === -1) throw new
|
|
3123
|
+
if (t === -1) throw new yi({
|
|
3125
3124
|
parameter: "message.messageId",
|
|
3126
3125
|
value: e.messageId,
|
|
3127
3126
|
message: `message with id ${e.messageId} not found`
|
|
3128
3127
|
});
|
|
3129
|
-
if (this.state.messages[t].role !== "user") throw new
|
|
3128
|
+
if (this.state.messages[t].role !== "user") throw new yi({
|
|
3130
3129
|
parameter: "message.messageId",
|
|
3131
3130
|
value: e.messageId,
|
|
3132
3131
|
message: `message with id ${e.messageId} is not a user message`
|
|
@@ -3150,7 +3149,7 @@ var Ma = class {
|
|
|
3150
3149
|
});
|
|
3151
3150
|
}, this.regenerate = async ({ messageId: e, ...t } = {}) => {
|
|
3152
3151
|
let n = e == null ? this.state.messages.length - 1 : this.state.messages.findIndex((t) => t.id === e);
|
|
3153
|
-
if (n === -1) throw new
|
|
3152
|
+
if (n === -1) throw new yi({
|
|
3154
3153
|
parameter: "messageId",
|
|
3155
3154
|
value: e,
|
|
3156
3155
|
message: `message ${e} not found`
|
|
@@ -3168,7 +3167,7 @@ var Ma = class {
|
|
|
3168
3167
|
}, this.clearError = () => {
|
|
3169
3168
|
this.status === "error" && (this.state.error = void 0, this.setStatus({ status: "ready" }));
|
|
3170
3169
|
}, this.addToolApprovalResponse = async ({ id: e, approved: t, reason: n, options: r }) => this.jobExecutor.run(async () => {
|
|
3171
|
-
let i = this.state.messages, a = i[i.length - 1], o = (r) =>
|
|
3170
|
+
let i = this.state.messages, a = i[i.length - 1], o = (r) => G(r) && r.state === "approval-requested" && r.approval.id === e ? {
|
|
3172
3171
|
...r,
|
|
3173
3172
|
state: "approval-responded",
|
|
3174
3173
|
approval: {
|
|
@@ -3189,7 +3188,7 @@ var Ma = class {
|
|
|
3189
3188
|
});
|
|
3190
3189
|
});
|
|
3191
3190
|
}), this.addToolOutput = async ({ state: e = "output-available", toolCallId: t, output: n, errorText: r, options: i }) => this.jobExecutor.run(async () => {
|
|
3192
|
-
let a = this.state.messages, o = a[a.length - 1], s = (i) =>
|
|
3191
|
+
let a = this.state.messages, o = a[a.length - 1], s = (i) => G(i) && i.toolCallId === t ? {
|
|
3193
3192
|
...i,
|
|
3194
3193
|
state: e,
|
|
3195
3194
|
output: n,
|
|
@@ -3277,7 +3276,7 @@ var Ma = class {
|
|
|
3277
3276
|
let f = this.lastMessage, p = !1, m = !1, h = !1, g;
|
|
3278
3277
|
try {
|
|
3279
3278
|
let a = {
|
|
3280
|
-
state:
|
|
3279
|
+
state: Ta({
|
|
3281
3280
|
lastMessage: e === "resume-stream" || e === "regenerate-message" ? void 0 : this.state.snapshot(f),
|
|
3282
3281
|
messageId: this.generateId()
|
|
3283
3282
|
}),
|
|
@@ -3296,8 +3295,8 @@ var Ma = class {
|
|
|
3296
3295
|
body: r,
|
|
3297
3296
|
trigger: e,
|
|
3298
3297
|
messageId: i
|
|
3299
|
-
}), await
|
|
3300
|
-
stream:
|
|
3298
|
+
}), await Da({
|
|
3299
|
+
stream: Ea({
|
|
3301
3300
|
stream: o,
|
|
3302
3301
|
onToolCall: this.onToolCall,
|
|
3303
3302
|
onData: this.onData,
|
|
@@ -3349,21 +3348,21 @@ var Ma = class {
|
|
|
3349
3348
|
});
|
|
3350
3349
|
}
|
|
3351
3350
|
};
|
|
3352
|
-
function
|
|
3351
|
+
function Ia({ messages: e }) {
|
|
3353
3352
|
let t = e[e.length - 1];
|
|
3354
3353
|
if (!t || t.role !== "assistant") return !1;
|
|
3355
|
-
let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter(
|
|
3354
|
+
let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter(G);
|
|
3356
3355
|
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");
|
|
3357
3356
|
}
|
|
3358
|
-
function
|
|
3357
|
+
function La({ messages: e }) {
|
|
3359
3358
|
let t = e[e.length - 1];
|
|
3360
3359
|
if (!t || t.role !== "assistant") return !1;
|
|
3361
|
-
let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter(
|
|
3360
|
+
let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter(G).filter((e) => !e.providerExecuted);
|
|
3362
3361
|
return r.length > 0 && r.every((e) => e.state === "output-available" && e.preliminary !== !0 || e.state === "output-error");
|
|
3363
3362
|
}
|
|
3364
3363
|
//#endregion
|
|
3365
3364
|
//#region ../node_modules/.pnpm/throttleit@2.1.0/node_modules/throttleit/index.js
|
|
3366
|
-
var
|
|
3365
|
+
var Ra = /* @__PURE__ */ t(((e, t) => {
|
|
3367
3366
|
function n(e, t) {
|
|
3368
3367
|
if (typeof e != "function") throw TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);
|
|
3369
3368
|
let n, r = 0;
|
|
@@ -3376,30 +3375,30 @@ var La = /* @__PURE__ */ t(((e, t) => {
|
|
|
3376
3375
|
};
|
|
3377
3376
|
}
|
|
3378
3377
|
t.exports = n;
|
|
3379
|
-
})),
|
|
3378
|
+
})), K = /* @__PURE__ */ e(o(), 1), za = /* @__PURE__ */ e(Ra(), 1), q = Ke(), Ba = (e, t, n) => {
|
|
3380
3379
|
if (!t.has(e)) throw TypeError("Cannot " + n);
|
|
3381
|
-
},
|
|
3380
|
+
}, J = (e, t, n) => (Ba(e, t, "read from private field"), n ? n.call(e) : t.get(e)), Y = (e, t, n) => {
|
|
3382
3381
|
if (t.has(e)) throw TypeError("Cannot add the same private member more than once");
|
|
3383
3382
|
t instanceof WeakSet ? t.add(e) : t.set(e, n);
|
|
3384
|
-
},
|
|
3383
|
+
}, X = (e, t, n, r) => (Ba(e, t, "write to private field"), r ? r.call(e, n) : t.set(e, n), n);
|
|
3385
3384
|
function Va(e, t) {
|
|
3386
|
-
return t == null ? e : (0,
|
|
3385
|
+
return t == null ? e : (0, za.default)(e, t);
|
|
3387
3386
|
}
|
|
3388
3387
|
function Ha(e) {
|
|
3389
3388
|
return Array.isArray(e) ? [...e] : typeof e == "object" && e && (Object.getPrototypeOf(e) === Object.prototype || Object.getPrototypeOf(e) === null) ? { ...e } : e;
|
|
3390
3389
|
}
|
|
3391
3390
|
var Z, Ua, Wa, Ga, Ka, qa, Ja, Ya, Xa, Za = class {
|
|
3392
3391
|
constructor(e = []) {
|
|
3393
|
-
|
|
3394
|
-
|
|
3392
|
+
Y(this, Z, void 0), Y(this, Ua, "ready"), Y(this, Wa, void 0), Y(this, Ga, /* @__PURE__ */ new Set()), Y(this, Ka, /* @__PURE__ */ new Set()), Y(this, qa, /* @__PURE__ */ new Set()), this.pushMessage = (e) => {
|
|
3393
|
+
X(this, Z, J(this, Z).concat(e)), J(this, Ja).call(this);
|
|
3395
3394
|
}, this.popMessage = () => {
|
|
3396
|
-
|
|
3395
|
+
X(this, Z, J(this, Z).slice(0, -1)), J(this, Ja).call(this);
|
|
3397
3396
|
}, this.replaceMessage = (e, t) => {
|
|
3398
|
-
|
|
3399
|
-
...
|
|
3397
|
+
X(this, Z, [
|
|
3398
|
+
...J(this, Z).slice(0, e),
|
|
3400
3399
|
this.snapshot(t),
|
|
3401
|
-
...
|
|
3402
|
-
]),
|
|
3400
|
+
...J(this, Z).slice(e + 1)
|
|
3401
|
+
]), J(this, Ja).call(this);
|
|
3403
3402
|
}, this.snapshot = (e) => {
|
|
3404
3403
|
if (typeof e != "object" || !e || !("parts" in e) || !Array.isArray(e.parts)) return e;
|
|
3405
3404
|
let t = e, n = {
|
|
@@ -3409,53 +3408,53 @@ var Z, Ua, Wa, Ga, Ka, qa, Ja, Ya, Xa, Za = class {
|
|
|
3409
3408
|
return "metadata" in t && (n.metadata = Ha(t.metadata)), n;
|
|
3410
3409
|
}, this["~registerMessagesCallback"] = (e, t) => {
|
|
3411
3410
|
let n = t ? Va(e, t) : e;
|
|
3412
|
-
return
|
|
3413
|
-
|
|
3411
|
+
return J(this, Ga).add(n), () => {
|
|
3412
|
+
J(this, Ga).delete(n);
|
|
3414
3413
|
};
|
|
3415
|
-
}, this["~registerStatusCallback"] = (e) => (
|
|
3416
|
-
|
|
3417
|
-
}), this["~registerErrorCallback"] = (e) => (
|
|
3418
|
-
|
|
3419
|
-
}),
|
|
3420
|
-
|
|
3421
|
-
}),
|
|
3422
|
-
|
|
3423
|
-
}),
|
|
3424
|
-
|
|
3425
|
-
}),
|
|
3414
|
+
}, this["~registerStatusCallback"] = (e) => (J(this, Ka).add(e), () => {
|
|
3415
|
+
J(this, Ka).delete(e);
|
|
3416
|
+
}), this["~registerErrorCallback"] = (e) => (J(this, qa).add(e), () => {
|
|
3417
|
+
J(this, qa).delete(e);
|
|
3418
|
+
}), Y(this, Ja, () => {
|
|
3419
|
+
J(this, Ga).forEach((e) => e());
|
|
3420
|
+
}), Y(this, Ya, () => {
|
|
3421
|
+
J(this, Ka).forEach((e) => e());
|
|
3422
|
+
}), Y(this, Xa, () => {
|
|
3423
|
+
J(this, qa).forEach((e) => e());
|
|
3424
|
+
}), X(this, Z, e);
|
|
3426
3425
|
}
|
|
3427
3426
|
get status() {
|
|
3428
|
-
return
|
|
3427
|
+
return J(this, Ua);
|
|
3429
3428
|
}
|
|
3430
3429
|
set status(e) {
|
|
3431
|
-
|
|
3430
|
+
X(this, Ua, e), J(this, Ya).call(this);
|
|
3432
3431
|
}
|
|
3433
3432
|
get error() {
|
|
3434
|
-
return
|
|
3433
|
+
return J(this, Wa);
|
|
3435
3434
|
}
|
|
3436
3435
|
set error(e) {
|
|
3437
|
-
|
|
3436
|
+
X(this, Wa, e), J(this, Xa).call(this);
|
|
3438
3437
|
}
|
|
3439
3438
|
get messages() {
|
|
3440
|
-
return
|
|
3439
|
+
return J(this, Z);
|
|
3441
3440
|
}
|
|
3442
3441
|
set messages(e) {
|
|
3443
|
-
|
|
3442
|
+
X(this, Z, [...e]), J(this, Ja).call(this);
|
|
3444
3443
|
}
|
|
3445
3444
|
};
|
|
3446
3445
|
Z = /* @__PURE__ */ new WeakMap(), Ua = /* @__PURE__ */ new WeakMap(), Wa = /* @__PURE__ */ new WeakMap(), Ga = /* @__PURE__ */ new WeakMap(), Ka = /* @__PURE__ */ new WeakMap(), qa = /* @__PURE__ */ new WeakMap(), Ja = /* @__PURE__ */ new WeakMap(), Ya = /* @__PURE__ */ new WeakMap(), Xa = /* @__PURE__ */ new WeakMap();
|
|
3447
|
-
var Qa, $a = class extends
|
|
3446
|
+
var Qa, $a = class extends Fa {
|
|
3448
3447
|
constructor({ messages: e, ...t }) {
|
|
3449
3448
|
let n = new Za(e);
|
|
3450
3449
|
super({
|
|
3451
3450
|
...t,
|
|
3452
3451
|
state: n
|
|
3453
|
-
}),
|
|
3452
|
+
}), Y(this, Qa, void 0), this["~registerMessagesCallback"] = (e, t) => J(this, Qa)["~registerMessagesCallback"](e, t), this["~registerStatusCallback"] = (e) => J(this, Qa)["~registerStatusCallback"](e), this["~registerErrorCallback"] = (e) => J(this, Qa)["~registerErrorCallback"](e), X(this, Qa, n);
|
|
3454
3453
|
}
|
|
3455
3454
|
};
|
|
3456
3455
|
Qa = /* @__PURE__ */ new WeakMap();
|
|
3457
3456
|
function eo({ throttle: e, experimental_throttle: t, resume: n = !1, ...r } = {}) {
|
|
3458
|
-
let i = e ?? t, a = (0,
|
|
3457
|
+
let i = e ?? t, a = (0, K.useRef)({});
|
|
3459
3458
|
"chat" in r || (a.current = {
|
|
3460
3459
|
onToolCall: r.onToolCall,
|
|
3461
3460
|
onData: r.onData,
|
|
@@ -3464,7 +3463,7 @@ function eo({ throttle: e, experimental_throttle: t, resume: n = !1, ...r } = {}
|
|
|
3464
3463
|
sendAutomaticallyWhen: r.sendAutomaticallyWhen,
|
|
3465
3464
|
transport: r.transport
|
|
3466
3465
|
});
|
|
3467
|
-
let o, s = () => a.current.transport ?? (o ??= new
|
|
3466
|
+
let o, s = () => a.current.transport ?? (o ??= new Pa()), c = {
|
|
3468
3467
|
...r,
|
|
3469
3468
|
transport: {
|
|
3470
3469
|
sendMessages: (e) => s().sendMessages(e),
|
|
@@ -3490,16 +3489,16 @@ function eo({ throttle: e, experimental_throttle: t, resume: n = !1, ...r } = {}
|
|
|
3490
3489
|
var t;
|
|
3491
3490
|
return (t = a.current).sendAutomaticallyWhen?.call(t, e) ?? !1;
|
|
3492
3491
|
}
|
|
3493
|
-
}, l = "chat" in r ? r.chat : r.id, { chat: u, isExternallyManaged: d } = (0,
|
|
3492
|
+
}, l = "chat" in r ? r.chat : r.id, { chat: u, isExternallyManaged: d } = (0, K.useMemo)(() => ({
|
|
3494
3493
|
chat: "chat" in r ? r.chat : new $a(c),
|
|
3495
3494
|
isExternallyManaged: "chat" in r
|
|
3496
3495
|
}), [l]);
|
|
3497
|
-
(0,
|
|
3496
|
+
(0, K.useEffect)(() => {
|
|
3498
3497
|
if (!d) return () => {
|
|
3499
3498
|
u.stop();
|
|
3500
3499
|
};
|
|
3501
3500
|
}, [u, d]);
|
|
3502
|
-
let f = (0,
|
|
3501
|
+
let f = (0, K.useMemo)(() => ({ messages: u.messages }), [u]), p = (0, K.useCallback)((e) => {
|
|
3503
3502
|
let t = !0, n = u["~registerMessagesCallback"](() => {
|
|
3504
3503
|
t && (f.messages = u.messages, e());
|
|
3505
3504
|
}, i);
|
|
@@ -3510,12 +3509,12 @@ function eo({ throttle: e, experimental_throttle: t, resume: n = !1, ...r } = {}
|
|
|
3510
3509
|
u,
|
|
3511
3510
|
f,
|
|
3512
3511
|
i
|
|
3513
|
-
]), m = (0,
|
|
3512
|
+
]), m = (0, K.useCallback)(() => f.messages, [f]), h = (0, K.useSyncExternalStore)(p, m, m), g = (0, K.useCallback)((e) => u["~registerStatusCallback"](() => {
|
|
3514
3513
|
(u.status === "ready" || u.status === "error") && (f.messages = u.messages), e();
|
|
3515
|
-
}), [u, f]), _ = (0,
|
|
3514
|
+
}), [u, f]), _ = (0, K.useCallback)(() => u.status, [u]), v = (0, K.useSyncExternalStore)(g, _, _), y = (0, K.useSyncExternalStore)(u["~registerErrorCallback"], () => u.error, () => u.error), b = (0, K.useCallback)((e) => {
|
|
3516
3515
|
typeof e == "function" && (e = e(u.messages)), u.messages = e;
|
|
3517
3516
|
}, [u]);
|
|
3518
|
-
return (0,
|
|
3517
|
+
return (0, K.useEffect)(() => {
|
|
3519
3518
|
n && u.resumeStream();
|
|
3520
3519
|
}, [n, u]), {
|
|
3521
3520
|
id: u.id,
|
|
@@ -3576,7 +3575,7 @@ var oo = class extends T {
|
|
|
3576
3575
|
super(), this.store = e;
|
|
3577
3576
|
}
|
|
3578
3577
|
getItems() {
|
|
3579
|
-
let e = this.store.get(
|
|
3578
|
+
let e = this.store.get(_e), t = [];
|
|
3580
3579
|
for (let n of e.cellIds.inOrderIds) {
|
|
3581
3580
|
let r = lo(n, e), i = r.cellOutput;
|
|
3582
3581
|
if (!i) continue;
|
|
@@ -3654,7 +3653,7 @@ async function so(e, t, n) {
|
|
|
3654
3653
|
let i = e.filter((e) => e.shouldDownloadImage && e.outputType === "media");
|
|
3655
3654
|
if (i.length === 0) return [];
|
|
3656
3655
|
let a = i.flatMap((e) => {
|
|
3657
|
-
let i = document.getElementById(
|
|
3656
|
+
let i = document.getElementById(oe.create(t));
|
|
3658
3657
|
return i ? {
|
|
3659
3658
|
cellId: t,
|
|
3660
3659
|
cellName: n,
|
|
@@ -3675,7 +3674,7 @@ async function so(e, t, n) {
|
|
|
3675
3674
|
}
|
|
3676
3675
|
function co(e) {
|
|
3677
3676
|
if (v(e)) return null;
|
|
3678
|
-
let t = e.mimetype, n = ao(t, String(e.data)) ? "media" : "text", r =
|
|
3677
|
+
let t = e.mimetype, n = ao(t, String(e.data)) ? "media" : "text", r = We(e), i, a = !1;
|
|
3679
3678
|
return n === "media" && (typeof e.data == "string" && e.data.startsWith("data:") || typeof e.data == "string" && e.data.startsWith("http") ? i = e.data : a = !0), {
|
|
3680
3679
|
processedContent: r,
|
|
3681
3680
|
imageUrl: i,
|
|
@@ -3685,7 +3684,7 @@ function co(e) {
|
|
|
3685
3684
|
};
|
|
3686
3685
|
}
|
|
3687
3686
|
function lo(e, t, n) {
|
|
3688
|
-
let { includeConsoleOutput: r = !1 } = n || {}, i = t.cellRuntime[e], a = t.cellData[e], o = t.cellIds.inOrderIds.indexOf(e), s =
|
|
3687
|
+
let { includeConsoleOutput: r = !1 } = n || {}, i = t.cellRuntime[e], a = t.cellData[e], o = t.cellIds.inOrderIds.indexOf(e), s = se(a.name, o), c;
|
|
3689
3688
|
r && (c = i.consoleOutputs.map((e) => co(e)).filter((e) => e !== null));
|
|
3690
3689
|
let l, u = i.output;
|
|
3691
3690
|
return u && !v(u) && (l = co(u) ?? void 0), {
|
|
@@ -3700,7 +3699,7 @@ function lo(e, t, n) {
|
|
|
3700
3699
|
//#region src/core/ai/context/providers/error.ts
|
|
3701
3700
|
function uo(e, t) {
|
|
3702
3701
|
let n = [`Code:\n${e.cellCode}`];
|
|
3703
|
-
if (e.tracebackHtml && n.push(`Traceback:\n${
|
|
3702
|
+
if (e.tracebackHtml && n.push(`Traceback:\n${Ee(e.tracebackHtml)}`), e.errorData.length > 0 && n.push(e.errorData.map((e) => Se(e)).join("\n\n")), e.errorData.some((e) => e.type === "sql-error")) {
|
|
3704
3703
|
let r = w(e.cellId, t);
|
|
3705
3704
|
r && n.push(`Database schema:\n${r}`);
|
|
3706
3705
|
}
|
|
@@ -3717,7 +3716,7 @@ function fo(e, t) {
|
|
|
3717
3716
|
});
|
|
3718
3717
|
}
|
|
3719
3718
|
function po(e) {
|
|
3720
|
-
return e.errorData.length === 1 ?
|
|
3719
|
+
return e.errorData.length === 1 ? Te(e.errorData[0]) : e.errorData.length > 1 ? `${e.errorData.length} errors` : e.tracebackHtml ? Ee(e.tracebackHtml).trim().split("\n").find((e) => e.trim())?.trim() || "traceback" : "error";
|
|
3721
3720
|
}
|
|
3722
3721
|
function mo(e) {
|
|
3723
3722
|
return `Error: ${e.cellName || `Cell ${e.cellId}`}`;
|
|
@@ -3731,7 +3730,7 @@ var ho = new xe("error", "errors"), go = class extends T {
|
|
|
3731
3730
|
super(), this.store = e;
|
|
3732
3731
|
}
|
|
3733
3732
|
getItems() {
|
|
3734
|
-
let e =
|
|
3733
|
+
let e = ve(this.store);
|
|
3735
3734
|
if (e.length === 0) return [];
|
|
3736
3735
|
let t = [{
|
|
3737
3736
|
uri: this.asURI("all"),
|
|
@@ -3796,7 +3795,7 @@ var ho = new xe("error", "errors"), go = class extends T {
|
|
|
3796
3795
|
formatContext(e) {
|
|
3797
3796
|
return (e.data.type === "all-errors" ? e.data.errors : [e.data.error]).map((e) => fo(e, this.store)).join("\n\n");
|
|
3798
3797
|
}
|
|
3799
|
-
}, _o =
|
|
3798
|
+
}, _o = le(), vo = {
|
|
3800
3799
|
maxDepth: 3,
|
|
3801
3800
|
maxResults: 20,
|
|
3802
3801
|
defaultResultsLimit: 5,
|
|
@@ -3918,7 +3917,7 @@ var ho = new xe("error", "errors"), go = class extends T {
|
|
|
3918
3917
|
description: e.message
|
|
3919
3918
|
}), null));
|
|
3920
3919
|
if (!l) return;
|
|
3921
|
-
let u = l.mimeType || "text/plain", d =
|
|
3920
|
+
let u = l.mimeType || "text/plain", d = Ge({
|
|
3922
3921
|
contents: l.contents ?? "",
|
|
3923
3922
|
mimeType: u,
|
|
3924
3923
|
isBase64: l.isBase64 ?? !1
|
|
@@ -3927,7 +3926,7 @@ var ho = new xe("error", "errors"), go = class extends T {
|
|
|
3927
3926
|
from: a,
|
|
3928
3927
|
to: o,
|
|
3929
3928
|
insert: ""
|
|
3930
|
-
} }),
|
|
3929
|
+
} }), Nt(e);
|
|
3931
3930
|
},
|
|
3932
3931
|
info: () => {
|
|
3933
3932
|
let e = document.createElement("div");
|
|
@@ -3997,10 +3996,10 @@ var ho = new xe("error", "errors"), go = class extends T {
|
|
|
3997
3996
|
displayLabel: t,
|
|
3998
3997
|
detail: n.source === "memory" ? "in-memory" : n.source,
|
|
3999
3998
|
boost: n.source_type === "local" ? b.LOCAL_TABLE : b.REMOTE_TABLE,
|
|
4000
|
-
type:
|
|
3999
|
+
type: ie(n),
|
|
4001
4000
|
apply: `@${t}`,
|
|
4002
4001
|
section: {
|
|
4003
|
-
name:
|
|
4002
|
+
name: ie(n) === "dataframe" ? "Dataframe" : "Table",
|
|
4004
4003
|
rank: x.TABLE.rank
|
|
4005
4004
|
},
|
|
4006
4005
|
info: () => this.createTableInfoElement(t, n)
|
|
@@ -4087,7 +4086,7 @@ var ho = new xe("error", "errors"), go = class extends T {
|
|
|
4087
4086
|
detail: n.dataType ?? "",
|
|
4088
4087
|
type: this.contextType,
|
|
4089
4088
|
section: x.VARIABLE,
|
|
4090
|
-
info: () =>
|
|
4089
|
+
info: () => de(n)
|
|
4091
4090
|
};
|
|
4092
4091
|
}
|
|
4093
4092
|
formatContext(e) {
|
|
@@ -4105,11 +4104,11 @@ var ho = new xe("error", "errors"), go = class extends T {
|
|
|
4105
4104
|
//#endregion
|
|
4106
4105
|
//#region src/core/ai/context/context.ts
|
|
4107
4106
|
function So(e) {
|
|
4108
|
-
let t = e.get(
|
|
4107
|
+
let t = e.get(ue), n = e.get(De), r = e.get(pe);
|
|
4109
4108
|
return new C().register(new bo(n)).register(new xo(r, n)).register(new go(e)).register(new oo(e)).register(new y(t.connectionsMap, n));
|
|
4110
4109
|
}
|
|
4111
4110
|
function Co() {
|
|
4112
|
-
return new yo(
|
|
4111
|
+
return new yo(ae());
|
|
4113
4112
|
}
|
|
4114
4113
|
//#endregion
|
|
4115
4114
|
//#region src/components/editor/ai/completion-utils.ts
|
|
@@ -4129,42 +4128,42 @@ async function To(e) {
|
|
|
4129
4128
|
type: "file",
|
|
4130
4129
|
mediaType: e.type,
|
|
4131
4130
|
filename: e.name,
|
|
4132
|
-
url: await
|
|
4131
|
+
url: await Ue(e, "dataUrl")
|
|
4133
4132
|
})));
|
|
4134
4133
|
}
|
|
4135
4134
|
function Eo(e) {
|
|
4136
4135
|
let t = e.at(-1);
|
|
4137
4136
|
if (!t || t.role !== "assistant") return !1;
|
|
4138
4137
|
let n = t.parts.at(-1);
|
|
4139
|
-
return !n || !
|
|
4138
|
+
return !n || !G(n) ? !1 : La({ messages: e }) || Ia({ messages: e }) || n.state === "output-denied" && !n.providerExecuted;
|
|
4140
4139
|
}
|
|
4141
4140
|
//#endregion
|
|
4142
4141
|
//#region src/components/chat/chat-components.tsx
|
|
4143
4142
|
var Do = (e) => {
|
|
4144
|
-
let t = (0,
|
|
4143
|
+
let t = (0, M.c)(6), { attachment: n } = e;
|
|
4145
4144
|
if (n.mediaType?.startsWith("image/")) {
|
|
4146
4145
|
let e = n.filename || "Attachment", r;
|
|
4147
|
-
return t[0] !== n.url || t[1] !== e ? (r = /* @__PURE__ */ (0,
|
|
4146
|
+
return t[0] !== n.url || t[1] !== e ? (r = /* @__PURE__ */ (0, q.jsx)("img", {
|
|
4148
4147
|
src: n.url,
|
|
4149
4148
|
alt: e,
|
|
4150
4149
|
className: "max-h-[100px] max-w-[100px] object-contain mb-1.5"
|
|
4151
4150
|
}), t[0] = n.url, t[1] = e, t[2] = r) : r = t[2], r;
|
|
4152
4151
|
}
|
|
4153
4152
|
let r;
|
|
4154
|
-
t[3] === Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ (0,
|
|
4153
|
+
t[3] === Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ (0, q.jsx)(Ve, { className: "h-3 w-3 mt-0.5" }), t[3] = r) : r = t[3];
|
|
4155
4154
|
let i = n.filename || "Attachment", a;
|
|
4156
|
-
return t[4] === i ? a = t[5] : (a = /* @__PURE__ */ (0,
|
|
4155
|
+
return t[4] === i ? a = t[5] : (a = /* @__PURE__ */ (0, q.jsxs)("div", {
|
|
4157
4156
|
className: "flex flex-row gap-1 items-center text-xs",
|
|
4158
4157
|
children: [r, i]
|
|
4159
4158
|
}), t[4] = i, t[5] = a), a;
|
|
4160
4159
|
}, Oo = (e) => {
|
|
4161
|
-
let t = (0,
|
|
4162
|
-
t[0] === r ? o = t[1] : (o = /* @__PURE__ */ (0,
|
|
4160
|
+
let t = (0, M.c)(15), { icon: n, title: r, subtitle: i, href: a } = e, o;
|
|
4161
|
+
t[0] === r ? o = t[1] : (o = /* @__PURE__ */ (0, q.jsx)("span", {
|
|
4163
4162
|
className: "truncate font-medium",
|
|
4164
4163
|
children: r
|
|
4165
4164
|
}), t[0] = r, t[1] = o);
|
|
4166
4165
|
let s;
|
|
4167
|
-
t[2] === i ? s = t[3] : (s = i && /* @__PURE__ */ (0,
|
|
4166
|
+
t[2] === i ? s = t[3] : (s = i && /* @__PURE__ */ (0, q.jsxs)("span", {
|
|
4168
4167
|
className: "truncate opacity-70",
|
|
4169
4168
|
children: [
|
|
4170
4169
|
"(",
|
|
@@ -4173,15 +4172,15 @@ var Do = (e) => {
|
|
|
4173
4172
|
]
|
|
4174
4173
|
}), t[2] = i, t[3] = s);
|
|
4175
4174
|
let c;
|
|
4176
|
-
t[4] !== n || t[5] !== o || t[6] !== s ? (c = /* @__PURE__ */ (0,
|
|
4175
|
+
t[4] !== n || t[5] !== o || t[6] !== s ? (c = /* @__PURE__ */ (0, q.jsxs)(q.Fragment, { children: [
|
|
4177
4176
|
n,
|
|
4178
4177
|
o,
|
|
4179
4178
|
s
|
|
4180
4179
|
] }), t[4] = n, t[5] = o, t[6] = s, t[7] = c) : c = t[7];
|
|
4181
4180
|
let l = c;
|
|
4182
|
-
if (a &&
|
|
4181
|
+
if (a && ze(a)) {
|
|
4183
4182
|
let e = i ?? r, n;
|
|
4184
|
-
return t[8] !== l || t[9] !== a || t[10] !== e ? (n = /* @__PURE__ */ (0,
|
|
4183
|
+
return t[8] !== l || t[9] !== a || t[10] !== e ? (n = /* @__PURE__ */ (0, q.jsx)("a", {
|
|
4185
4184
|
href: a,
|
|
4186
4185
|
target: "_blank",
|
|
4187
4186
|
rel: "noopener noreferrer",
|
|
@@ -4191,20 +4190,20 @@ var Do = (e) => {
|
|
|
4191
4190
|
}), t[8] = l, t[9] = a, t[10] = e, t[11] = n) : n = t[11], n;
|
|
4192
4191
|
}
|
|
4193
4192
|
let u = i ?? r, d;
|
|
4194
|
-
return t[12] !== l || t[13] !== u ? (d = /* @__PURE__ */ (0,
|
|
4193
|
+
return t[12] !== l || t[13] !== u ? (d = /* @__PURE__ */ (0, q.jsx)("div", {
|
|
4195
4194
|
className: "inline-flex max-w-full items-center gap-1.5 rounded-md border bg-muted/50 px-2 py-1 my-1 text-xs text-muted-foreground",
|
|
4196
4195
|
title: u,
|
|
4197
4196
|
children: l
|
|
4198
4197
|
}), t[12] = l, t[13] = u, t[14] = d) : d = t[14], d;
|
|
4199
4198
|
}, ko = (e) => {
|
|
4200
|
-
let t = (0,
|
|
4199
|
+
let t = (0, M.c)(13), { reasoning: n, index: r, isStreaming: i } = e, a = r === void 0 ? 0 : r, o = i !== void 0 && i, [s, c] = K.useState("");
|
|
4201
4200
|
if (!n && !o) return null;
|
|
4202
4201
|
let l = o ? "reasoning" : s, u;
|
|
4203
|
-
t[0] === Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ (0,
|
|
4202
|
+
t[0] === Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ (0, q.jsx)(Bt, { className: "h-3 w-3" }), t[0] = u) : u = t[0];
|
|
4204
4203
|
let d = o ? "Thinking" : "View reasoning", f = n.length > 0 && ` (${n.length} chars)`, p;
|
|
4205
|
-
t[1] !== d || t[2] !== f ? (p = /* @__PURE__ */ (0,
|
|
4204
|
+
t[1] !== d || t[2] !== f ? (p = /* @__PURE__ */ (0, q.jsx)(te, {
|
|
4206
4205
|
className: "text-xs text-muted-foreground hover:bg-muted/50 px-2 py-1 h-auto rounded-sm [&[data-state=open]>svg]:rotate-180",
|
|
4207
|
-
children: /* @__PURE__ */ (0,
|
|
4206
|
+
children: /* @__PURE__ */ (0, q.jsxs)("span", {
|
|
4208
4207
|
className: "flex items-center gap-2",
|
|
4209
4208
|
children: [
|
|
4210
4209
|
u,
|
|
@@ -4214,24 +4213,24 @@ var Do = (e) => {
|
|
|
4214
4213
|
})
|
|
4215
4214
|
}), t[1] = d, t[2] = f, t[3] = p) : p = t[3];
|
|
4216
4215
|
let m;
|
|
4217
|
-
t[4] === n ? m = t[5] : (m = /* @__PURE__ */ (0,
|
|
4216
|
+
t[4] === n ? m = t[5] : (m = /* @__PURE__ */ (0, q.jsx)(_, {
|
|
4218
4217
|
className: "pb-2 px-2",
|
|
4219
|
-
children: /* @__PURE__ */ (0,
|
|
4218
|
+
children: /* @__PURE__ */ (0, q.jsx)("div", {
|
|
4220
4219
|
className: "bg-muted/30 border border-muted/50 rounded-md p-3 italic text-muted-foreground/90 relative",
|
|
4221
|
-
children: /* @__PURE__ */ (0,
|
|
4220
|
+
children: /* @__PURE__ */ (0, q.jsx)("div", {
|
|
4222
4221
|
className: "pr-6",
|
|
4223
|
-
children: /* @__PURE__ */ (0,
|
|
4222
|
+
children: /* @__PURE__ */ (0, q.jsx)(O, { content: n })
|
|
4224
4223
|
})
|
|
4225
4224
|
})
|
|
4226
4225
|
}), t[4] = n, t[5] = m);
|
|
4227
4226
|
let h;
|
|
4228
|
-
t[6] !== p || t[7] !== m ? (h = /* @__PURE__ */ (0,
|
|
4227
|
+
t[6] !== p || t[7] !== m ? (h = /* @__PURE__ */ (0, q.jsxs)(A, {
|
|
4229
4228
|
value: "reasoning",
|
|
4230
4229
|
className: "border-0",
|
|
4231
4230
|
children: [p, m]
|
|
4232
4231
|
}), t[6] = p, t[7] = m, t[8] = h) : h = t[8];
|
|
4233
4232
|
let g;
|
|
4234
|
-
return t[9] !== a || t[10] !== l || t[11] !== h ? (g = /* @__PURE__ */ (0,
|
|
4233
|
+
return t[9] !== a || t[10] !== l || t[11] !== h ? (g = /* @__PURE__ */ (0, q.jsx)(S, {
|
|
4235
4234
|
type: "single",
|
|
4236
4235
|
collapsible: !0,
|
|
4237
4236
|
className: "w-full mb-2",
|
|
@@ -4248,48 +4247,48 @@ function Ao(e) {
|
|
|
4248
4247
|
//#endregion
|
|
4249
4248
|
//#region src/components/chat/tool-call/tool-args.tsx
|
|
4250
4249
|
var jo = (e) => {
|
|
4251
|
-
let t = (0,
|
|
4250
|
+
let t = (0, M.c)(9), { input: n, label: r } = e, i = r === void 0 ? "Tool Request" : r;
|
|
4252
4251
|
if (n == null) return null;
|
|
4253
4252
|
let a;
|
|
4254
|
-
t[0] === i ? a = t[1] : (a = /* @__PURE__ */ (0,
|
|
4253
|
+
t[0] === i ? a = t[1] : (a = /* @__PURE__ */ (0, q.jsx)("h3", {
|
|
4255
4254
|
className: "text-xs font-semibold text-muted-foreground",
|
|
4256
4255
|
children: i
|
|
4257
4256
|
}), t[0] = i, t[1] = a);
|
|
4258
4257
|
let o;
|
|
4259
4258
|
t[2] === n ? o = t[3] : (o = JSON.stringify(n, null, 2), t[2] = n, t[3] = o);
|
|
4260
4259
|
let s;
|
|
4261
|
-
t[4] === o ? s = t[5] : (s = /* @__PURE__ */ (0,
|
|
4260
|
+
t[4] === o ? s = t[5] : (s = /* @__PURE__ */ (0, q.jsx)("pre", {
|
|
4262
4261
|
className: "bg-(--slate-2) p-2 text-muted-foreground border border-(--slate-4) rounded text-xs overflow-auto scrollbar-thin max-h-64",
|
|
4263
4262
|
children: o
|
|
4264
4263
|
}), t[4] = o, t[5] = s);
|
|
4265
4264
|
let c;
|
|
4266
|
-
return t[6] !== a || t[7] !== s ? (c = /* @__PURE__ */ (0,
|
|
4265
|
+
return t[6] !== a || t[7] !== s ? (c = /* @__PURE__ */ (0, q.jsxs)("div", {
|
|
4267
4266
|
className: "space-y-2",
|
|
4268
4267
|
children: [a, s]
|
|
4269
4268
|
}), t[6] = a, t[7] = s, t[8] = c) : c = t[8], c;
|
|
4270
4269
|
}, Mo = (e) => {
|
|
4271
|
-
let t = (0,
|
|
4270
|
+
let t = (0, M.c)(27), { toolName: n, input: r, approval: o, onApprove: s, className: c } = e, l;
|
|
4272
4271
|
t[0] === c ? l = t[1] : (l = i("rounded-md border border-(--amber-6) bg-(--amber-2) p-3 space-y-3", c), t[0] = c, t[1] = l);
|
|
4273
4272
|
let u;
|
|
4274
4273
|
t[2] === n ? u = t[3] : (u = Ao(n), t[2] = n, t[3] = u);
|
|
4275
4274
|
let d = `Approval required for ${u}`, f;
|
|
4276
|
-
t[4] === Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */ (0,
|
|
4275
|
+
t[4] === Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */ (0, q.jsx)(qt, { className: "h-4 w-4 text-(--amber-11) mt-0.5 shrink-0" }), t[4] = f) : f = t[4];
|
|
4277
4276
|
let p;
|
|
4278
|
-
t[5] === Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ (0,
|
|
4277
|
+
t[5] === Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ (0, q.jsx)("span", {
|
|
4279
4278
|
className: "font-semibold",
|
|
4280
4279
|
children: "Approval required:"
|
|
4281
4280
|
}), t[5] = p) : p = t[5];
|
|
4282
4281
|
let m;
|
|
4283
4282
|
t[6] === n ? m = t[7] : (m = Ao(n), t[6] = n, t[7] = m);
|
|
4284
4283
|
let h;
|
|
4285
|
-
t[8] === m ? h = t[9] : (h = /* @__PURE__ */ (0,
|
|
4284
|
+
t[8] === m ? h = t[9] : (h = /* @__PURE__ */ (0, q.jsxs)("div", {
|
|
4286
4285
|
className: "flex items-start gap-2",
|
|
4287
|
-
children: [f, /* @__PURE__ */ (0,
|
|
4286
|
+
children: [f, /* @__PURE__ */ (0, q.jsxs)("div", {
|
|
4288
4287
|
className: "text-xs text-(--amber-11) leading-relaxed",
|
|
4289
4288
|
children: [
|
|
4290
4289
|
p,
|
|
4291
4290
|
" ",
|
|
4292
|
-
/* @__PURE__ */ (0,
|
|
4291
|
+
/* @__PURE__ */ (0, q.jsx)("code", {
|
|
4293
4292
|
className: "font-mono",
|
|
4294
4293
|
children: m
|
|
4295
4294
|
})
|
|
@@ -4297,9 +4296,9 @@ var jo = (e) => {
|
|
|
4297
4296
|
})]
|
|
4298
4297
|
}), t[8] = m, t[9] = h);
|
|
4299
4298
|
let g;
|
|
4300
|
-
t[10] === r ? g = t[11] : (g = /* @__PURE__ */ (0,
|
|
4299
|
+
t[10] === r ? g = t[11] : (g = /* @__PURE__ */ (0, q.jsx)(jo, { input: r }), t[10] = r, t[11] = g);
|
|
4301
4300
|
let _;
|
|
4302
|
-
t[12] !== o.id || t[13] !== s ? (_ = /* @__PURE__ */ (0,
|
|
4301
|
+
t[12] !== o.id || t[13] !== s ? (_ = /* @__PURE__ */ (0, q.jsx)(a, {
|
|
4303
4302
|
size: "xs",
|
|
4304
4303
|
variant: "outline",
|
|
4305
4304
|
onClick: () => s({
|
|
@@ -4309,7 +4308,7 @@ var jo = (e) => {
|
|
|
4309
4308
|
children: "Deny"
|
|
4310
4309
|
}), t[12] = o.id, t[13] = s, t[14] = _) : _ = t[14];
|
|
4311
4310
|
let v;
|
|
4312
|
-
t[15] !== o.id || t[16] !== s ? (v = /* @__PURE__ */ (0,
|
|
4311
|
+
t[15] !== o.id || t[16] !== s ? (v = /* @__PURE__ */ (0, q.jsx)(a, {
|
|
4313
4312
|
size: "xs",
|
|
4314
4313
|
onClick: () => s({
|
|
4315
4314
|
id: o.id,
|
|
@@ -4318,12 +4317,12 @@ var jo = (e) => {
|
|
|
4318
4317
|
children: "Approve"
|
|
4319
4318
|
}), t[15] = o.id, t[16] = s, t[17] = v) : v = t[17];
|
|
4320
4319
|
let y;
|
|
4321
|
-
t[18] !== v || t[19] !== _ ? (y = /* @__PURE__ */ (0,
|
|
4320
|
+
t[18] !== v || t[19] !== _ ? (y = /* @__PURE__ */ (0, q.jsxs)("div", {
|
|
4322
4321
|
className: "flex items-center justify-end gap-2",
|
|
4323
4322
|
children: [_, v]
|
|
4324
4323
|
}), t[18] = v, t[19] = _, t[20] = y) : y = t[20];
|
|
4325
4324
|
let b;
|
|
4326
|
-
return t[21] !== l || t[22] !== y || t[23] !== d || t[24] !== h || t[25] !== g ? (b = /* @__PURE__ */ (0,
|
|
4325
|
+
return t[21] !== l || t[22] !== y || t[23] !== d || t[24] !== h || t[25] !== g ? (b = /* @__PURE__ */ (0, q.jsxs)("div", {
|
|
4327
4326
|
className: l,
|
|
4328
4327
|
role: "alertdialog",
|
|
4329
4328
|
"aria-label": d,
|
|
@@ -4334,30 +4333,30 @@ var jo = (e) => {
|
|
|
4334
4333
|
]
|
|
4335
4334
|
}), t[21] = l, t[22] = y, t[23] = d, t[24] = h, t[25] = g, t[26] = b) : b = t[26], b;
|
|
4336
4335
|
}, No = (e) => {
|
|
4337
|
-
let t = (0,
|
|
4336
|
+
let t = (0, M.c)(28), { toolName: n, input: r, errorText: a, isLive: o, className: s } = e, [c, l] = K.useState(o), u = K.useRef(o), d, f;
|
|
4338
4337
|
t[0] === o ? (d = t[1], f = t[2]) : (d = () => {
|
|
4339
4338
|
u.current && !o && l(!1), u.current = o;
|
|
4340
|
-
}, f = [o], t[0] = o, t[1] = d, t[2] = f),
|
|
4339
|
+
}, f = [o], t[0] = o, t[1] = d, t[2] = f), K.useEffect(d, f);
|
|
4341
4340
|
let p;
|
|
4342
4341
|
t[3] === s ? p = t[4] : (p = i("rounded-md border border-(--red-6) bg-(--red-2)", s), t[3] = s, t[4] = p);
|
|
4343
4342
|
let m;
|
|
4344
4343
|
t[5] === Symbol.for("react.memo_cache_sentinel") ? (m = () => l(Po), t[5] = m) : m = t[5];
|
|
4345
4344
|
let h;
|
|
4346
|
-
t[6] === Symbol.for("react.memo_cache_sentinel") ? (h = /* @__PURE__ */ (0,
|
|
4345
|
+
t[6] === Symbol.for("react.memo_cache_sentinel") ? (h = /* @__PURE__ */ (0, q.jsx)(be, { className: "h-3.5 w-3.5 shrink-0" }), t[6] = h) : h = t[6];
|
|
4347
4346
|
let g;
|
|
4348
|
-
t[7] === Symbol.for("react.memo_cache_sentinel") ? (g = /* @__PURE__ */ (0,
|
|
4347
|
+
t[7] === Symbol.for("react.memo_cache_sentinel") ? (g = /* @__PURE__ */ (0, q.jsx)("span", {
|
|
4349
4348
|
className: "font-semibold",
|
|
4350
4349
|
children: "Failed:"
|
|
4351
4350
|
}), t[7] = g) : g = t[7];
|
|
4352
4351
|
let _;
|
|
4353
4352
|
t[8] === n ? _ = t[9] : (_ = Ao(n), t[8] = n, t[9] = _);
|
|
4354
4353
|
let v;
|
|
4355
|
-
t[10] === _ ? v = t[11] : (v = /* @__PURE__ */ (0,
|
|
4354
|
+
t[10] === _ ? v = t[11] : (v = /* @__PURE__ */ (0, q.jsxs)("span", {
|
|
4356
4355
|
className: "flex-1 text-left",
|
|
4357
4356
|
children: [
|
|
4358
4357
|
g,
|
|
4359
4358
|
" ",
|
|
4360
|
-
/* @__PURE__ */ (0,
|
|
4359
|
+
/* @__PURE__ */ (0, q.jsx)("code", {
|
|
4361
4360
|
className: "font-mono",
|
|
4362
4361
|
children: _
|
|
4363
4362
|
})
|
|
@@ -4366,9 +4365,9 @@ var jo = (e) => {
|
|
|
4366
4365
|
let y = c && "rotate-180", b;
|
|
4367
4366
|
t[12] === y ? b = t[13] : (b = i("h-3.5 w-3.5 shrink-0 transition-transform", y), t[12] = y, t[13] = b);
|
|
4368
4367
|
let x;
|
|
4369
|
-
t[14] === b ? x = t[15] : (x = /* @__PURE__ */ (0,
|
|
4368
|
+
t[14] === b ? x = t[15] : (x = /* @__PURE__ */ (0, q.jsx)(Ae, { className: b }), t[14] = b, t[15] = x);
|
|
4370
4369
|
let S;
|
|
4371
|
-
t[16] !== c || t[17] !== x || t[18] !== v ? (S = /* @__PURE__ */ (0,
|
|
4370
|
+
t[16] !== c || t[17] !== x || t[18] !== v ? (S = /* @__PURE__ */ (0, q.jsxs)("button", {
|
|
4372
4371
|
type: "button",
|
|
4373
4372
|
onClick: m,
|
|
4374
4373
|
className: "w-full flex items-center gap-2 px-3 py-2 text-xs text-(--red-11) hover:bg-(--red-3) rounded-md transition-colors",
|
|
@@ -4380,18 +4379,18 @@ var jo = (e) => {
|
|
|
4380
4379
|
]
|
|
4381
4380
|
}), t[16] = c, t[17] = x, t[18] = v, t[19] = S) : S = t[19];
|
|
4382
4381
|
let C;
|
|
4383
|
-
t[20] !== a || t[21] !== r || t[22] !== c ? (C = c && /* @__PURE__ */ (0,
|
|
4382
|
+
t[20] !== a || t[21] !== r || t[22] !== c ? (C = c && /* @__PURE__ */ (0, q.jsxs)("div", {
|
|
4384
4383
|
className: "px-3 pb-3 space-y-3 border-t border-(--red-6)/40 pt-3",
|
|
4385
|
-
children: [/* @__PURE__ */ (0,
|
|
4384
|
+
children: [/* @__PURE__ */ (0, q.jsx)(jo, { input: r }), a && /* @__PURE__ */ (0, q.jsxs)("div", { children: [/* @__PURE__ */ (0, q.jsx)("h3", {
|
|
4386
4385
|
className: "text-xs font-semibold text-(--red-11) mb-1",
|
|
4387
4386
|
children: "Error"
|
|
4388
|
-
}), /* @__PURE__ */ (0,
|
|
4387
|
+
}), /* @__PURE__ */ (0, q.jsx)("pre", {
|
|
4389
4388
|
className: "bg-(--red-2) border border-(--red-6) rounded p-2 text-xs text-(--red-11) leading-relaxed overflow-auto scrollbar-thin max-h-64 whitespace-pre-wrap",
|
|
4390
4389
|
children: a
|
|
4391
4390
|
})] })]
|
|
4392
4391
|
}), t[20] = a, t[21] = r, t[22] = c, t[23] = C) : C = t[23];
|
|
4393
4392
|
let w;
|
|
4394
|
-
return t[24] !== S || t[25] !== C || t[26] !== p ? (w = /* @__PURE__ */ (0,
|
|
4393
|
+
return t[24] !== S || t[25] !== C || t[26] !== p ? (w = /* @__PURE__ */ (0, q.jsxs)("div", {
|
|
4395
4394
|
className: p,
|
|
4396
4395
|
children: [S, C]
|
|
4397
4396
|
}), t[24] = S, t[25] = C, t[26] = p, t[27] = w) : w = t[27], w;
|
|
@@ -4402,54 +4401,54 @@ function Po(e) {
|
|
|
4402
4401
|
//#endregion
|
|
4403
4402
|
//#region src/components/chat/tool-call/tool-result.tsx
|
|
4404
4403
|
function Fo(e) {
|
|
4405
|
-
return e == null || typeof e == "object" &&
|
|
4406
|
-
}
|
|
4407
|
-
var Io =
|
|
4408
|
-
status:
|
|
4409
|
-
auth_required:
|
|
4410
|
-
action_url:
|
|
4411
|
-
next_steps:
|
|
4412
|
-
meta:
|
|
4413
|
-
message:
|
|
4404
|
+
return e == null || typeof e == "object" && ht(e);
|
|
4405
|
+
}
|
|
4406
|
+
var Io = qe({
|
|
4407
|
+
status: Qe().default("success"),
|
|
4408
|
+
auth_required: lt().default(!1),
|
|
4409
|
+
action_url: rt().optional(),
|
|
4410
|
+
next_steps: rt().optional(),
|
|
4411
|
+
meta: rt().optional(),
|
|
4412
|
+
message: Qe().nullish()
|
|
4414
4413
|
}), Lo = (e) => {
|
|
4415
|
-
let t = (0,
|
|
4414
|
+
let t = (0, M.c)(12), { data: n } = e, r;
|
|
4416
4415
|
if (t[0] !== n) {
|
|
4417
4416
|
let { status: e, auth_required: i, action_url: a, meta: o, next_steps: s, message: c, ...l } = n, u;
|
|
4418
|
-
t[2] === Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ (0,
|
|
4417
|
+
t[2] === Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ (0, q.jsx)("h3", {
|
|
4419
4418
|
className: "text-xs font-semibold text-muted-foreground",
|
|
4420
4419
|
children: "Tool Result"
|
|
4421
4420
|
}), t[2] = u) : u = t[2];
|
|
4422
4421
|
let d;
|
|
4423
|
-
t[3] === e ? d = t[4] : (d = /* @__PURE__ */ (0,
|
|
4422
|
+
t[3] === e ? d = t[4] : (d = /* @__PURE__ */ (0, q.jsx)("span", {
|
|
4424
4423
|
className: "text-xs px-2 py-0.5 bg-(--grass-2) text-(--grass-11) rounded-full font-medium capitalize",
|
|
4425
4424
|
children: e
|
|
4426
4425
|
}), t[3] = e, t[4] = d);
|
|
4427
4426
|
let f;
|
|
4428
|
-
t[5] === i ? f = t[6] : (f = i && /* @__PURE__ */ (0,
|
|
4427
|
+
t[5] === i ? f = t[6] : (f = i && /* @__PURE__ */ (0, q.jsx)("span", {
|
|
4429
4428
|
className: "text-xs px-2 py-0.5 bg-(--amber-2) text-(--amber-11) rounded-full",
|
|
4430
4429
|
children: "Auth Required"
|
|
4431
4430
|
}), t[5] = i, t[6] = f);
|
|
4432
4431
|
let p;
|
|
4433
|
-
t[7] !== d || t[8] !== f ? (p = /* @__PURE__ */ (0,
|
|
4432
|
+
t[7] !== d || t[8] !== f ? (p = /* @__PURE__ */ (0, q.jsxs)("div", {
|
|
4434
4433
|
className: "flex items-center justify-between",
|
|
4435
|
-
children: [u, /* @__PURE__ */ (0,
|
|
4434
|
+
children: [u, /* @__PURE__ */ (0, q.jsxs)("div", {
|
|
4436
4435
|
className: "flex items-center gap-2",
|
|
4437
4436
|
children: [d, f]
|
|
4438
4437
|
})]
|
|
4439
4438
|
}), t[7] = d, t[8] = f, t[9] = p) : p = t[9];
|
|
4440
4439
|
let m;
|
|
4441
|
-
t[10] === c ? m = t[11] : (m = c && /* @__PURE__ */ (0,
|
|
4440
|
+
t[10] === c ? m = t[11] : (m = c && /* @__PURE__ */ (0, q.jsxs)("div", {
|
|
4442
4441
|
className: "flex items-start gap-2",
|
|
4443
|
-
children: [/* @__PURE__ */ (0,
|
|
4442
|
+
children: [/* @__PURE__ */ (0, q.jsx)(fe, { className: "h-3 w-3 text-(--blue-11) mt-0.5 shrink-0" }), /* @__PURE__ */ (0, q.jsx)("div", {
|
|
4444
4443
|
className: "text-xs text-foreground",
|
|
4445
4444
|
children: c
|
|
4446
4445
|
})]
|
|
4447
|
-
}), t[10] = c, t[11] = m), r = /* @__PURE__ */ (0,
|
|
4446
|
+
}), t[10] = c, t[11] = m), r = /* @__PURE__ */ (0, q.jsxs)("div", {
|
|
4448
4447
|
className: "flex flex-col gap-1.5",
|
|
4449
4448
|
children: [
|
|
4450
4449
|
p,
|
|
4451
4450
|
m,
|
|
4452
|
-
l && /* @__PURE__ */ (0,
|
|
4451
|
+
l && /* @__PURE__ */ (0, q.jsx)("div", {
|
|
4453
4452
|
className: "space-y-3",
|
|
4454
4453
|
children: Object.entries(l).map(zo)
|
|
4455
4454
|
})
|
|
@@ -4458,29 +4457,29 @@ var Io = Xe({
|
|
|
4458
4457
|
} else r = t[1];
|
|
4459
4458
|
return r;
|
|
4460
4459
|
}, Ro = (e) => {
|
|
4461
|
-
let t = (0,
|
|
4460
|
+
let t = (0, M.c)(8), { result: n } = e, r;
|
|
4462
4461
|
t[0] === n ? r = t[1] : (r = Io.safeParse(n), t[0] = n, t[1] = r);
|
|
4463
4462
|
let i = r;
|
|
4464
4463
|
if (i.success) {
|
|
4465
4464
|
let e;
|
|
4466
|
-
return t[2] === i.data ? e = t[3] : (e = /* @__PURE__ */ (0,
|
|
4465
|
+
return t[2] === i.data ? e = t[3] : (e = /* @__PURE__ */ (0, q.jsx)(Lo, { data: i.data }), t[2] = i.data, t[3] = e), e;
|
|
4467
4466
|
}
|
|
4468
4467
|
let a;
|
|
4469
4468
|
t[4] === n ? a = t[5] : (a = typeof n == "string" ? n : JSON.stringify(n, null, 2), t[4] = n, t[5] = a);
|
|
4470
4469
|
let o;
|
|
4471
|
-
return t[6] === a ? o = t[7] : (o = /* @__PURE__ */ (0,
|
|
4470
|
+
return t[6] === a ? o = t[7] : (o = /* @__PURE__ */ (0, q.jsx)("div", {
|
|
4472
4471
|
className: "text-xs font-medium text-muted-foreground mb-1 max-h-64 overflow-y-auto scrollbar-thin",
|
|
4473
4472
|
children: a
|
|
4474
4473
|
}), t[6] = a, t[7] = o), o;
|
|
4475
4474
|
};
|
|
4476
4475
|
function zo(e) {
|
|
4477
4476
|
let [t, n] = e;
|
|
4478
|
-
return Fo(n) ? null : /* @__PURE__ */ (0,
|
|
4477
|
+
return Fo(n) ? null : /* @__PURE__ */ (0, q.jsxs)("div", {
|
|
4479
4478
|
className: "space-y-1.5",
|
|
4480
|
-
children: [/* @__PURE__ */ (0,
|
|
4479
|
+
children: [/* @__PURE__ */ (0, q.jsx)("span", {
|
|
4481
4480
|
className: "text-xs text-muted-foreground",
|
|
4482
4481
|
children: t
|
|
4483
|
-
}), /* @__PURE__ */ (0,
|
|
4482
|
+
}), /* @__PURE__ */ (0, q.jsx)("pre", {
|
|
4484
4483
|
className: "bg-(--slate-2) p-2 text-muted-foreground border border-(--slate-4) rounded text-xs overflow-auto scrollbar-thin max-h-64",
|
|
4485
4484
|
children: JSON.stringify(n, null, 2)
|
|
4486
4485
|
})]
|
|
@@ -4499,30 +4498,30 @@ var Bo = {
|
|
|
4499
4498
|
"input-available",
|
|
4500
4499
|
"approval-responded"
|
|
4501
4500
|
]), Ho = (e) => {
|
|
4502
|
-
let t = (0,
|
|
4501
|
+
let t = (0, M.c)(5), { state: n, interrupted: r } = e;
|
|
4503
4502
|
if (r) {
|
|
4504
4503
|
let e;
|
|
4505
|
-
return t[0] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ (0,
|
|
4504
|
+
return t[0] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ (0, q.jsx)(Ht, { className: "h-3 w-3 text-muted-foreground" }), t[0] = e) : e = t[0], e;
|
|
4506
4505
|
}
|
|
4507
4506
|
switch (n) {
|
|
4508
4507
|
case "input-streaming":
|
|
4509
4508
|
case "input-available":
|
|
4510
4509
|
case "approval-responded": {
|
|
4511
4510
|
let e;
|
|
4512
|
-
return t[1] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ (0,
|
|
4511
|
+
return t[1] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ (0, q.jsx)(g, { className: "h-3 w-3 animate-spin" }), t[1] = e) : e = t[1], e;
|
|
4513
4512
|
}
|
|
4514
4513
|
case "output-available": {
|
|
4515
4514
|
let e;
|
|
4516
|
-
return t[2] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ (0,
|
|
4515
|
+
return t[2] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ (0, q.jsx)(Vt, { className: "h-3 w-3 text-(--grass-11)" }), t[2] = e) : e = t[2], e;
|
|
4517
4516
|
}
|
|
4518
4517
|
case "output-denied": {
|
|
4519
4518
|
let e;
|
|
4520
|
-
return t[3] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ (0,
|
|
4519
|
+
return t[3] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ (0, q.jsx)(zt, { className: "h-3 w-3 text-muted-foreground" }), t[3] = e) : e = t[3], e;
|
|
4521
4520
|
}
|
|
4522
4521
|
default: {
|
|
4523
|
-
|
|
4522
|
+
ke(n);
|
|
4524
4523
|
let e;
|
|
4525
|
-
return t[4] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ (0,
|
|
4524
|
+
return t[4] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ (0, q.jsx)(h, { className: "h-3 w-3" }), t[4] = e) : e = t[4], e;
|
|
4526
4525
|
}
|
|
4527
4526
|
}
|
|
4528
4527
|
};
|
|
@@ -4533,30 +4532,30 @@ function Uo(e) {
|
|
|
4533
4532
|
case "input-streaming":
|
|
4534
4533
|
case "input-available":
|
|
4535
4534
|
case "approval-responded": return "";
|
|
4536
|
-
default: return
|
|
4535
|
+
default: return ke(e), "";
|
|
4537
4536
|
}
|
|
4538
4537
|
}
|
|
4539
4538
|
var Wo = (e) => {
|
|
4540
|
-
let t = (0,
|
|
4539
|
+
let t = (0, M.c)(34), { toolName: n, state: r, input: a, result: o, approval: s, index: c, className: l, isActive: u } = e, d = c === void 0 ? 0 : c, f = u === void 0 || u, p;
|
|
4541
4540
|
t[0] !== f || t[1] !== r ? (p = !f && Vo.has(r), t[0] = f, t[1] = r, t[2] = p) : p = t[2];
|
|
4542
4541
|
let m = p, h = `tool-${d}`, g;
|
|
4543
4542
|
t[3] === l ? g = t[4] : (g = i("w-full", l), t[3] = l, t[4] = g);
|
|
4544
4543
|
let v;
|
|
4545
4544
|
t[5] !== m || t[6] !== r ? (v = i("h-6 text-xs border-border shadow-none! ring-0! bg-muted/60 hover:bg-muted py-0 px-2 gap-1 rounded-sm [&[data-state=open]>svg]:rotate-180 hover:no-underline", m ? "text-muted-foreground" : Uo(r)), t[5] = m, t[6] = r, t[7] = v) : v = t[7];
|
|
4546
4545
|
let y;
|
|
4547
|
-
t[8] !== m || t[9] !== r ? (y = /* @__PURE__ */ (0,
|
|
4546
|
+
t[8] !== m || t[9] !== r ? (y = /* @__PURE__ */ (0, q.jsx)(Ho, {
|
|
4548
4547
|
state: r,
|
|
4549
4548
|
interrupted: m
|
|
4550
4549
|
}), t[8] = m, t[9] = r, t[10] = y) : y = t[10];
|
|
4551
4550
|
let b = m ? "Interrupted" : Bo[r], x;
|
|
4552
4551
|
t[11] === n ? x = t[12] : (x = Ao(n), t[11] = n, t[12] = x);
|
|
4553
4552
|
let C;
|
|
4554
|
-
t[13] === x ? C = t[14] : (C = /* @__PURE__ */ (0,
|
|
4553
|
+
t[13] === x ? C = t[14] : (C = /* @__PURE__ */ (0, q.jsx)("code", {
|
|
4555
4554
|
className: "font-mono text-xs",
|
|
4556
4555
|
children: x
|
|
4557
4556
|
}), t[13] = x, t[14] = C);
|
|
4558
4557
|
let w;
|
|
4559
|
-
t[15] !== C || t[16] !== y || t[17] !== b ? (w = /* @__PURE__ */ (0,
|
|
4558
|
+
t[15] !== C || t[16] !== y || t[17] !== b ? (w = /* @__PURE__ */ (0, q.jsxs)("span", {
|
|
4560
4559
|
className: "flex items-center gap-1",
|
|
4561
4560
|
children: [
|
|
4562
4561
|
y,
|
|
@@ -4566,14 +4565,14 @@ var Wo = (e) => {
|
|
|
4566
4565
|
]
|
|
4567
4566
|
}), t[15] = C, t[16] = y, t[17] = b, t[18] = w) : w = t[18];
|
|
4568
4567
|
let T;
|
|
4569
|
-
t[19] !== w || t[20] !== v ? (T = /* @__PURE__ */ (0,
|
|
4568
|
+
t[19] !== w || t[20] !== v ? (T = /* @__PURE__ */ (0, q.jsx)(te, {
|
|
4570
4569
|
className: v,
|
|
4571
4570
|
children: w
|
|
4572
4571
|
}), t[19] = w, t[20] = v, t[21] = T) : T = t[21];
|
|
4573
4572
|
let E;
|
|
4574
|
-
t[22] !== s || t[23] !== a || t[24] !== o || t[25] !== r ? (E = /* @__PURE__ */ (0,
|
|
4573
|
+
t[22] !== s || t[23] !== a || t[24] !== o || t[25] !== r ? (E = /* @__PURE__ */ (0, q.jsx)(_, {
|
|
4575
4574
|
className: "py-2 px-2",
|
|
4576
|
-
children: /* @__PURE__ */ (0,
|
|
4575
|
+
children: /* @__PURE__ */ (0, q.jsx)(Go, {
|
|
4577
4576
|
state: r,
|
|
4578
4577
|
input: a,
|
|
4579
4578
|
result: o,
|
|
@@ -4581,61 +4580,61 @@ var Wo = (e) => {
|
|
|
4581
4580
|
})
|
|
4582
4581
|
}), t[22] = s, t[23] = a, t[24] = o, t[25] = r, t[26] = E) : E = t[26];
|
|
4583
4582
|
let D;
|
|
4584
|
-
t[27] !== T || t[28] !== E ? (D = /* @__PURE__ */ (0,
|
|
4583
|
+
t[27] !== T || t[28] !== E ? (D = /* @__PURE__ */ (0, q.jsxs)(A, {
|
|
4585
4584
|
value: "tool-call",
|
|
4586
4585
|
className: "border-0",
|
|
4587
4586
|
children: [T, E]
|
|
4588
4587
|
}), t[27] = T, t[28] = E, t[29] = D) : D = t[29];
|
|
4589
4588
|
let O;
|
|
4590
|
-
return t[30] !== D || t[31] !== h || t[32] !== g ? (O = /* @__PURE__ */ (0,
|
|
4589
|
+
return t[30] !== D || t[31] !== h || t[32] !== g ? (O = /* @__PURE__ */ (0, q.jsx)(S, {
|
|
4591
4590
|
type: "single",
|
|
4592
4591
|
collapsible: !0,
|
|
4593
4592
|
className: g,
|
|
4594
4593
|
children: D
|
|
4595
4594
|
}, h), t[30] = D, t[31] = h, t[32] = g, t[33] = O) : O = t[33], O;
|
|
4596
4595
|
}, Go = (e) => {
|
|
4597
|
-
let t = (0,
|
|
4596
|
+
let t = (0, M.c)(16), { state: n, input: r, result: i, approval: a } = e;
|
|
4598
4597
|
switch (n) {
|
|
4599
4598
|
case "input-streaming":
|
|
4600
4599
|
case "input-available":
|
|
4601
4600
|
case "approval-responded": {
|
|
4602
4601
|
let e;
|
|
4603
|
-
return t[0] === r ? e = t[1] : (e = /* @__PURE__ */ (0,
|
|
4602
|
+
return t[0] === r ? e = t[1] : (e = /* @__PURE__ */ (0, q.jsx)(jo, { input: r }), t[0] = r, t[1] = e), e;
|
|
4604
4603
|
}
|
|
4605
4604
|
case "output-available": {
|
|
4606
4605
|
let e;
|
|
4607
|
-
t[2] === r ? e = t[3] : (e = /* @__PURE__ */ (0,
|
|
4606
|
+
t[2] === r ? e = t[3] : (e = /* @__PURE__ */ (0, q.jsx)(jo, { input: r }), t[2] = r, t[3] = e);
|
|
4608
4607
|
let n;
|
|
4609
|
-
t[4] === i ? n = t[5] : (n = i != null && /* @__PURE__ */ (0,
|
|
4608
|
+
t[4] === i ? n = t[5] : (n = i != null && /* @__PURE__ */ (0, q.jsx)(Ro, { result: i }), t[4] = i, t[5] = n);
|
|
4610
4609
|
let a;
|
|
4611
|
-
return t[6] !== e || t[7] !== n ? (a = /* @__PURE__ */ (0,
|
|
4610
|
+
return t[6] !== e || t[7] !== n ? (a = /* @__PURE__ */ (0, q.jsxs)("div", {
|
|
4612
4611
|
className: "space-y-3",
|
|
4613
4612
|
children: [e, n]
|
|
4614
4613
|
}), t[6] = e, t[7] = n, t[8] = a) : a = t[8], a;
|
|
4615
4614
|
}
|
|
4616
4615
|
case "output-denied": {
|
|
4617
4616
|
let e;
|
|
4618
|
-
t[9] === r ? e = t[10] : (e = /* @__PURE__ */ (0,
|
|
4617
|
+
t[9] === r ? e = t[10] : (e = /* @__PURE__ */ (0, q.jsx)(jo, { input: r }), t[9] = r, t[10] = e);
|
|
4619
4618
|
let n = a?.reason ? `: ${a.reason}` : ".", i;
|
|
4620
|
-
t[11] === n ? i = t[12] : (i = /* @__PURE__ */ (0,
|
|
4619
|
+
t[11] === n ? i = t[12] : (i = /* @__PURE__ */ (0, q.jsxs)("div", {
|
|
4621
4620
|
className: "bg-muted/40 border border-border rounded-md p-3 text-xs text-muted-foreground leading-relaxed",
|
|
4622
4621
|
children: ["Tool execution was denied", n]
|
|
4623
4622
|
}), t[11] = n, t[12] = i);
|
|
4624
4623
|
let o;
|
|
4625
|
-
return t[13] !== e || t[14] !== i ? (o = /* @__PURE__ */ (0,
|
|
4624
|
+
return t[13] !== e || t[14] !== i ? (o = /* @__PURE__ */ (0, q.jsxs)("div", {
|
|
4626
4625
|
className: "space-y-3",
|
|
4627
4626
|
children: [e, i]
|
|
4628
4627
|
}), t[13] = e, t[14] = i, t[15] = o) : o = t[15], o;
|
|
4629
4628
|
}
|
|
4630
|
-
default: return
|
|
4629
|
+
default: return ke(n), null;
|
|
4631
4630
|
}
|
|
4632
4631
|
}, Ko = (e) => {
|
|
4633
|
-
let t = (0,
|
|
4632
|
+
let t = (0, M.c)(27), { toolName: n, state: r, result: i, errorText: a, input: o, approval: s, onApprove: c, index: l, className: u, isLive: d, isActive: f } = e, p = d === void 0 || d, m = f === void 0 || f;
|
|
4634
4633
|
switch (r) {
|
|
4635
4634
|
case "approval-requested": {
|
|
4636
4635
|
if (s != null && c != null) {
|
|
4637
4636
|
let e;
|
|
4638
|
-
return t[0] !== s || t[1] !== u || t[2] !== o || t[3] !== c || t[4] !== n ? (e = /* @__PURE__ */ (0,
|
|
4637
|
+
return t[0] !== s || t[1] !== u || t[2] !== o || t[3] !== c || t[4] !== n ? (e = /* @__PURE__ */ (0, q.jsx)(Mo, {
|
|
4639
4638
|
toolName: n,
|
|
4640
4639
|
input: o,
|
|
4641
4640
|
approval: s,
|
|
@@ -4644,7 +4643,7 @@ var Wo = (e) => {
|
|
|
4644
4643
|
}), t[0] = s, t[1] = u, t[2] = o, t[3] = c, t[4] = n, t[5] = e) : e = t[5], e;
|
|
4645
4644
|
}
|
|
4646
4645
|
let e;
|
|
4647
|
-
return t[6] !== u || t[7] !== l || t[8] !== o || t[9] !== m || t[10] !== n ? (e = /* @__PURE__ */ (0,
|
|
4646
|
+
return t[6] !== u || t[7] !== l || t[8] !== o || t[9] !== m || t[10] !== n ? (e = /* @__PURE__ */ (0, q.jsx)(Wo, {
|
|
4648
4647
|
toolName: n,
|
|
4649
4648
|
state: "input-available",
|
|
4650
4649
|
input: o,
|
|
@@ -4655,7 +4654,7 @@ var Wo = (e) => {
|
|
|
4655
4654
|
}
|
|
4656
4655
|
case "output-error": {
|
|
4657
4656
|
let e;
|
|
4658
|
-
return t[12] !== u || t[13] !== a || t[14] !== o || t[15] !== p || t[16] !== n ? (e = /* @__PURE__ */ (0,
|
|
4657
|
+
return t[12] !== u || t[13] !== a || t[14] !== o || t[15] !== p || t[16] !== n ? (e = /* @__PURE__ */ (0, q.jsx)(No, {
|
|
4659
4658
|
toolName: n,
|
|
4660
4659
|
input: o,
|
|
4661
4660
|
errorText: a,
|
|
@@ -4669,7 +4668,7 @@ var Wo = (e) => {
|
|
|
4669
4668
|
case "output-available":
|
|
4670
4669
|
case "output-denied": {
|
|
4671
4670
|
let e;
|
|
4672
|
-
return t[18] !== s || t[19] !== u || t[20] !== l || t[21] !== o || t[22] !== m || t[23] !== i || t[24] !== r || t[25] !== n ? (e = /* @__PURE__ */ (0,
|
|
4671
|
+
return t[18] !== s || t[19] !== u || t[20] !== l || t[21] !== o || t[22] !== m || t[23] !== i || t[24] !== r || t[25] !== n ? (e = /* @__PURE__ */ (0, q.jsx)(Wo, {
|
|
4673
4672
|
toolName: n,
|
|
4674
4673
|
state: r,
|
|
4675
4674
|
input: o,
|
|
@@ -4680,12 +4679,12 @@ var Wo = (e) => {
|
|
|
4680
4679
|
isActive: m
|
|
4681
4680
|
}), t[18] = s, t[19] = u, t[20] = l, t[21] = o, t[22] = m, t[23] = i, t[24] = r, t[25] = n, t[26] = e) : e = t[26], e;
|
|
4682
4681
|
}
|
|
4683
|
-
default: return
|
|
4682
|
+
default: return ke(r), null;
|
|
4684
4683
|
}
|
|
4685
4684
|
}, qo = ({ message: e, isStreamingReasoning: t, isLast: n, isActive: i, addToolApprovalResponse: a }) => {
|
|
4686
|
-
return /* @__PURE__ */ (0,
|
|
4685
|
+
return /* @__PURE__ */ (0, q.jsx)(q.Fragment, { children: e.parts.map((e, t) => o(e, t)) });
|
|
4687
4686
|
function o(o, s) {
|
|
4688
|
-
if (Jo(o)) return /* @__PURE__ */ (0,
|
|
4687
|
+
if (Jo(o)) return /* @__PURE__ */ (0, q.jsx)(Ko, {
|
|
4689
4688
|
index: s,
|
|
4690
4689
|
toolName: o.type,
|
|
4691
4690
|
result: o.output,
|
|
@@ -4700,19 +4699,19 @@ var Wo = (e) => {
|
|
|
4700
4699
|
}, s);
|
|
4701
4700
|
if (Yo(o)) return r.debug("Found data part", o), null;
|
|
4702
4701
|
switch (o.type) {
|
|
4703
|
-
case "text": return o.text.includes("<marimo-") ? /* @__PURE__ */ (0,
|
|
4704
|
-
case "reasoning": return /* @__PURE__ */ (0,
|
|
4702
|
+
case "text": return o.text.includes("<marimo-") ? /* @__PURE__ */ (0, q.jsx)(K.Fragment, { children: u({ html: o.text }) }, s) : /* @__PURE__ */ (0, q.jsx)(O, { content: o.text }, s);
|
|
4703
|
+
case "reasoning": return /* @__PURE__ */ (0, q.jsx)(ko, {
|
|
4705
4704
|
reasoning: o.text,
|
|
4706
4705
|
index: s,
|
|
4707
4706
|
isStreaming: t && n && s === (e.parts.length || 0) - 1
|
|
4708
4707
|
}, s);
|
|
4709
|
-
case "file": return /* @__PURE__ */ (0,
|
|
4710
|
-
case "reasoning-file": return /* @__PURE__ */ (0,
|
|
4708
|
+
case "file": return /* @__PURE__ */ (0, q.jsx)(Do, { attachment: o }, s);
|
|
4709
|
+
case "reasoning-file": return /* @__PURE__ */ (0, q.jsx)(Do, { attachment: {
|
|
4711
4710
|
type: "file",
|
|
4712
4711
|
mediaType: o.mediaType,
|
|
4713
4712
|
url: o.url
|
|
4714
4713
|
} }, s);
|
|
4715
|
-
case "dynamic-tool": return /* @__PURE__ */ (0,
|
|
4714
|
+
case "dynamic-tool": return /* @__PURE__ */ (0, q.jsx)(Ko, {
|
|
4716
4715
|
toolName: o.toolName,
|
|
4717
4716
|
result: o.output,
|
|
4718
4717
|
errorText: o.state === "output-error" ? o.errorText : void 0,
|
|
@@ -4723,23 +4722,23 @@ var Wo = (e) => {
|
|
|
4723
4722
|
isLive: n,
|
|
4724
4723
|
isActive: i
|
|
4725
4724
|
}, s);
|
|
4726
|
-
case "source-document": return /* @__PURE__ */ (0,
|
|
4727
|
-
icon: /* @__PURE__ */ (0,
|
|
4725
|
+
case "source-document": return /* @__PURE__ */ (0, q.jsx)(Oo, {
|
|
4726
|
+
icon: /* @__PURE__ */ (0, q.jsx)(ye, { className: "h-3 w-3 shrink-0" }),
|
|
4728
4727
|
title: o.title,
|
|
4729
4728
|
subtitle: o.filename
|
|
4730
4729
|
}, s);
|
|
4731
|
-
case "source-url": return /* @__PURE__ */ (0,
|
|
4732
|
-
icon: /* @__PURE__ */ (0,
|
|
4730
|
+
case "source-url": return /* @__PURE__ */ (0, q.jsx)(Oo, {
|
|
4731
|
+
icon: /* @__PURE__ */ (0, q.jsx)(me, { className: "h-3 w-3 shrink-0" }),
|
|
4733
4732
|
title: o.title ?? o.url,
|
|
4734
4733
|
subtitle: o.title ? o.url : void 0,
|
|
4735
4734
|
href: o.url
|
|
4736
4735
|
}, s);
|
|
4737
|
-
case "custom": return /* @__PURE__ */ (0,
|
|
4736
|
+
case "custom": return /* @__PURE__ */ (0, q.jsx)("div", {
|
|
4738
4737
|
className: "text-sm text-muted-foreground",
|
|
4739
4738
|
children: o.kind
|
|
4740
4739
|
}, s);
|
|
4741
4740
|
case "step-start": return null;
|
|
4742
|
-
default: return
|
|
4741
|
+
default: return ke(o), null;
|
|
4743
4742
|
}
|
|
4744
4743
|
}
|
|
4745
4744
|
};
|
|
@@ -4752,11 +4751,11 @@ function Yo(e) {
|
|
|
4752
4751
|
//#endregion
|
|
4753
4752
|
//#region ../node_modules/.pnpm/@marimo-team+codemirror-ai@0.3.10_@codemirror+state@6.7.6_@codemirror+view@6.43.13/node_modules/@marimo-team/codemirror-ai/dist/utils/facet.js
|
|
4754
4753
|
function Xo(e) {
|
|
4755
|
-
return
|
|
4754
|
+
return bt.define({ combine: (t) => t[0] ?? e });
|
|
4756
4755
|
}
|
|
4757
4756
|
//#endregion
|
|
4758
4757
|
//#region ../node_modules/.pnpm/@marimo-team+codemirror-ai@0.3.10_@codemirror+state@6.7.6_@codemirror+view@6.43.13/node_modules/@marimo-team/codemirror-ai/dist/prompt-history/extension.js
|
|
4759
|
-
var Zo = Xo({}), Qo =
|
|
4758
|
+
var Zo = Xo({}), Qo = St.define(), $o = St.define(), es = 50, ts = At.define({
|
|
4760
4759
|
create() {
|
|
4761
4760
|
return {
|
|
4762
4761
|
prompts: [],
|
|
@@ -4815,7 +4814,7 @@ function is(e = {}) {
|
|
|
4815
4814
|
navigationIndex: -1,
|
|
4816
4815
|
originalText: ""
|
|
4817
4816
|
})), Zo.of(t ?? {})];
|
|
4818
|
-
return n && r.push(
|
|
4817
|
+
return n && r.push(Tt.of([{
|
|
4819
4818
|
key: "ArrowUp",
|
|
4820
4819
|
run: ns
|
|
4821
4820
|
}, {
|
|
@@ -4824,8 +4823,8 @@ function is(e = {}) {
|
|
|
4824
4823
|
}])), r;
|
|
4825
4824
|
}
|
|
4826
4825
|
//#endregion
|
|
4827
|
-
//#region ../node_modules/.pnpm/@marimo-team+codemirror-mcp@0.1.7_@codemirror+autocomplete@6.20.3_@codemirror+state@6.
|
|
4828
|
-
var as =
|
|
4826
|
+
//#region ../node_modules/.pnpm/@marimo-team+codemirror-mcp@0.1.7_@codemirror+autocomplete@6.20.3_@codemirror+state@6.7_6b342e94e942eed410acc909cdad6bca/node_modules/@marimo-team/codemirror-mcp/dist/state.js
|
|
4827
|
+
var as = St.define(), Q = At.define({
|
|
4829
4828
|
create() {
|
|
4830
4829
|
return /* @__PURE__ */ new Map();
|
|
4831
4830
|
},
|
|
@@ -4837,7 +4836,7 @@ var as = vt.define(), Q = Et.define({
|
|
|
4837
4836
|
}
|
|
4838
4837
|
return r;
|
|
4839
4838
|
}
|
|
4840
|
-
}), os =
|
|
4839
|
+
}), os = At.define({
|
|
4841
4840
|
create() {
|
|
4842
4841
|
return {
|
|
4843
4842
|
onResourceClick: void 0,
|
|
@@ -4849,8 +4848,8 @@ var as = vt.define(), Q = Et.define({
|
|
|
4849
4848
|
update(e) {
|
|
4850
4849
|
return e;
|
|
4851
4850
|
}
|
|
4852
|
-
}), ss =
|
|
4853
|
-
|
|
4851
|
+
}), ss = St.define();
|
|
4852
|
+
At.define({
|
|
4854
4853
|
create() {
|
|
4855
4854
|
return /* @__PURE__ */ new Map();
|
|
4856
4855
|
},
|
|
@@ -4864,7 +4863,7 @@ Et.define({
|
|
|
4864
4863
|
}
|
|
4865
4864
|
});
|
|
4866
4865
|
//#endregion
|
|
4867
|
-
//#region ../node_modules/.pnpm/@marimo-team+codemirror-mcp@0.1.7_@codemirror+autocomplete@6.20.3_@codemirror+state@6.
|
|
4866
|
+
//#region ../node_modules/.pnpm/@marimo-team+codemirror-mcp@0.1.7_@codemirror+autocomplete@6.20.3_@codemirror+state@6.7_6b342e94e942eed410acc909cdad6bca/node_modules/@marimo-team/codemirror-mcp/dist/resources/completion.js
|
|
4868
4867
|
var cs = (e, t) => async (n) => {
|
|
4869
4868
|
let r = n.matchBefore(/@(\w+)?/);
|
|
4870
4869
|
if (!r || r.from === r.to && !n.explicit) return null;
|
|
@@ -4897,8 +4896,8 @@ function $(e) {
|
|
|
4897
4896
|
return e.matchAll(new RegExp(ls.source, "g"));
|
|
4898
4897
|
}
|
|
4899
4898
|
//#endregion
|
|
4900
|
-
//#region ../node_modules/.pnpm/@marimo-team+codemirror-mcp@0.1.7_@codemirror+autocomplete@6.20.3_@codemirror+state@6.
|
|
4901
|
-
var us = class extends
|
|
4899
|
+
//#region ../node_modules/.pnpm/@marimo-team+codemirror-mcp@0.1.7_@codemirror+autocomplete@6.20.3_@codemirror+state@6.7_6b342e94e942eed410acc909cdad6bca/node_modules/@marimo-team/codemirror-mcp/dist/resources/decoration.js
|
|
4900
|
+
var us = class extends Ot {
|
|
4902
4901
|
resource;
|
|
4903
4902
|
view;
|
|
4904
4903
|
constructor(e, t) {
|
|
@@ -4919,7 +4918,7 @@ var us = class extends wt {
|
|
|
4919
4918
|
e.preventDefault(), e.stopPropagation(), i(this.resource);
|
|
4920
4919
|
}), e;
|
|
4921
4920
|
}
|
|
4922
|
-
}, ds = class extends
|
|
4921
|
+
}, ds = class extends Ot {
|
|
4923
4922
|
uri;
|
|
4924
4923
|
view;
|
|
4925
4924
|
constructor(e, t) {
|
|
@@ -4939,12 +4938,12 @@ function fs(e) {
|
|
|
4939
4938
|
let a = e.state.doc.sliceString(r, i);
|
|
4940
4939
|
for (let i of $(a)) {
|
|
4941
4940
|
let a = r + i.index, o = i[0].slice(1), s = t.get(o);
|
|
4942
|
-
s ? n.push(
|
|
4941
|
+
s ? n.push(wt.replace({ widget: new us(s, e) }).range(a, a + i[0].length)) : n.push(wt.replace({ widget: new ds(o, e) }).range(a, a + i[0].length));
|
|
4943
4942
|
}
|
|
4944
4943
|
}
|
|
4945
|
-
return
|
|
4944
|
+
return wt.set(n);
|
|
4946
4945
|
}
|
|
4947
|
-
var ps =
|
|
4946
|
+
var ps = kt.fromClass(class {
|
|
4948
4947
|
decorations;
|
|
4949
4948
|
constructor(e) {
|
|
4950
4949
|
this.decorations = fs(e);
|
|
@@ -4954,7 +4953,7 @@ var ps = Tt.fromClass(class {
|
|
|
4954
4953
|
}
|
|
4955
4954
|
}, { decorations: (e) => e.decorations });
|
|
4956
4955
|
//#endregion
|
|
4957
|
-
//#region ../node_modules/.pnpm/@marimo-team+codemirror-mcp@0.1.7_@codemirror+autocomplete@6.20.3_@codemirror+state@6.
|
|
4956
|
+
//#region ../node_modules/.pnpm/@marimo-team+codemirror-mcp@0.1.7_@codemirror+autocomplete@6.20.3_@codemirror+state@6.7_6b342e94e942eed410acc909cdad6bca/node_modules/@marimo-team/codemirror-mcp/dist/resources/hover.js
|
|
4958
4957
|
function ms(e) {
|
|
4959
4958
|
let t = document.createElement("div");
|
|
4960
4959
|
t.className = "cm-tooltip-cursor";
|
|
@@ -4984,7 +4983,7 @@ function hs(e, t, n, r = 0) {
|
|
|
4984
4983
|
return null;
|
|
4985
4984
|
}
|
|
4986
4985
|
function gs(e) {
|
|
4987
|
-
return
|
|
4986
|
+
return Dt((t, n) => {
|
|
4988
4987
|
let { from: r, text: i } = t.state.doc.lineAt(n), a = hs(i, n, t.state.field(Q), r);
|
|
4989
4988
|
return a ? {
|
|
4990
4989
|
pos: a.start,
|
|
@@ -4997,7 +4996,7 @@ function gs(e) {
|
|
|
4997
4996
|
});
|
|
4998
4997
|
}
|
|
4999
4998
|
//#endregion
|
|
5000
|
-
//#region ../node_modules/.pnpm/@marimo-team+codemirror-mcp@0.1.7_@codemirror+autocomplete@6.20.3_@codemirror+state@6.
|
|
4999
|
+
//#region ../node_modules/.pnpm/@marimo-team+codemirror-mcp@0.1.7_@codemirror+autocomplete@6.20.3_@codemirror+state@6.7_6b342e94e942eed410acc909cdad6bca/node_modules/@marimo-team/codemirror-mcp/dist/resources/input-filter.js
|
|
5001
5000
|
function _s(e, t) {
|
|
5002
5001
|
let n = e.field(Q), r = e.doc, i = r.lineAt(t), a = r.sliceString(i.from, i.to), o = Array.from($(a));
|
|
5003
5002
|
if (o.length === 0) return null;
|
|
@@ -5054,8 +5053,8 @@ function xs(e, t) {
|
|
|
5054
5053
|
}
|
|
5055
5054
|
return null;
|
|
5056
5055
|
}
|
|
5057
|
-
var Ss =
|
|
5058
|
-
let t = e.annotation(
|
|
5056
|
+
var Ss = Et.transactionFilter.of((e) => {
|
|
5057
|
+
let t = e.annotation(Ct.userEvent);
|
|
5059
5058
|
if (!t) return e;
|
|
5060
5059
|
let n = e.startState.selection.main;
|
|
5061
5060
|
if (!n.empty) return e;
|
|
@@ -5237,11 +5236,11 @@ function Os(e, t) {
|
|
|
5237
5236
|
};
|
|
5238
5237
|
}
|
|
5239
5238
|
function ks(e, t = {}) {
|
|
5240
|
-
return
|
|
5239
|
+
return kt.fromClass(Os(e, t));
|
|
5241
5240
|
}
|
|
5242
5241
|
//#endregion
|
|
5243
|
-
//#region ../node_modules/.pnpm/@marimo-team+codemirror-mcp@0.1.7_@codemirror+autocomplete@6.20.3_@codemirror+state@6.
|
|
5244
|
-
var As =
|
|
5242
|
+
//#region ../node_modules/.pnpm/@marimo-team+codemirror-mcp@0.1.7_@codemirror+autocomplete@6.20.3_@codemirror+state@6.7_6b342e94e942eed410acc909cdad6bca/node_modules/@marimo-team/codemirror-mcp/dist/theme.js
|
|
5243
|
+
var As = yt.baseTheme({
|
|
5245
5244
|
".cm-resource-widget": {
|
|
5246
5245
|
background: "light-dark(rgba(86,156,214,0.08),rgba(86,156,214,0.18))",
|
|
5247
5246
|
borderRadius: "4px",
|
|
@@ -5274,10 +5273,10 @@ function Fs(e) {
|
|
|
5274
5273
|
let { language: t, store: n, onAddFiles: i } = e, a = () => Ps(n);
|
|
5275
5274
|
return [
|
|
5276
5275
|
t.data.of({ autocomplete: cs(async () => a(), (e) => e.type === js ? Ns : So(n).getProvider(e.type)?.formatCompletion(e) || {}) }),
|
|
5277
|
-
|
|
5276
|
+
xt.high(Tt.of([{
|
|
5278
5277
|
key: "Tab",
|
|
5279
5278
|
preventDefault: !0,
|
|
5280
|
-
run: (e) =>
|
|
5279
|
+
run: (e) => Mt(e)
|
|
5281
5280
|
}])),
|
|
5282
5281
|
_o.of({ addAttachment: (e) => i?.([e]) }),
|
|
5283
5282
|
...i ? [t.data.of({ autocomplete: Co().createCompletionSource() })] : [],
|
|
@@ -5304,14 +5303,14 @@ function Is(e) {
|
|
|
5304
5303
|
let t = document.createElement("div");
|
|
5305
5304
|
return t.innerHTML = e, { dom: t };
|
|
5306
5305
|
}
|
|
5307
|
-
|
|
5308
|
-
var Ls = "marimo:ai-prompt-history", Rs = new
|
|
5309
|
-
let t = (0,
|
|
5306
|
+
he("marimo:ai-language", "python", we);
|
|
5307
|
+
var Ls = "marimo:ai-prompt-history", Rs = new ce(Ye(Qe()), () => []), zs = (e) => {
|
|
5308
|
+
let t = (0, M.c)(35), { value: n, placeholder: r, inputRef: a, className: o, onChange: s, onSubmit: c, onKeyDown: l, onClose: u, onAddFiles: d, additionalCompletions: f, maxHeight: p } = e, m = c, h = u, g = _t(), { theme: _ } = vt(), v;
|
|
5310
5309
|
t[0] === f ? v = t[1] : (v = (e) => f ? wo([f.triggerCompletionRegex], f.completions)(e) : null, t[0] = f, t[1] = v);
|
|
5311
|
-
let y =
|
|
5310
|
+
let y = gt(v), b, x, S, C;
|
|
5312
5311
|
if (t[2] !== y || t[3] !== d || t[4] !== g) {
|
|
5313
|
-
let e =
|
|
5314
|
-
t[9] === Symbol.for("react.memo_cache_sentinel") ? (b =
|
|
5312
|
+
let e = Ft();
|
|
5313
|
+
t[9] === Symbol.for("react.memo_cache_sentinel") ? (b = Pt({}), t[9] = b) : b = t[9], x = e, S = Fs({
|
|
5315
5314
|
language: e.language,
|
|
5316
5315
|
store: g,
|
|
5317
5316
|
onAddFiles: d
|
|
@@ -5323,9 +5322,9 @@ var Ls = "marimo:ai-prompt-history", Rs = new ae($e(qe()), () => []), zs = (e) =
|
|
|
5323
5322
|
save: Vs
|
|
5324
5323
|
} }), t[10] = w) : w = t[10];
|
|
5325
5324
|
let T;
|
|
5326
|
-
t[11] === Symbol.for("react.memo_cache_sentinel") ? (T =
|
|
5325
|
+
t[11] === Symbol.for("react.memo_cache_sentinel") ? (T = It(), t[11] = T) : T = t[11];
|
|
5327
5326
|
let E;
|
|
5328
|
-
t[12] === m ? E = t[13] : (E =
|
|
5327
|
+
t[12] === m ? E = t[13] : (E = xt.highest(Tt.of([{
|
|
5329
5328
|
preventDefault: !0,
|
|
5330
5329
|
stopPropagation: !0,
|
|
5331
5330
|
any: (e, t) => {
|
|
@@ -5349,7 +5348,7 @@ var Ls = "marimo:ai-prompt-history", Rs = new ae($e(qe()), () => []), zs = (e) =
|
|
|
5349
5348
|
}
|
|
5350
5349
|
}])), t[12] = m, t[13] = E);
|
|
5351
5350
|
let D;
|
|
5352
|
-
t[14] === h ? D = t[15] : (D =
|
|
5351
|
+
t[14] === h ? D = t[15] : (D = Tt.of([{
|
|
5353
5352
|
key: "Escape",
|
|
5354
5353
|
preventDefault: !0,
|
|
5355
5354
|
stopPropagation: !0,
|
|
@@ -5362,15 +5361,15 @@ var Ls = "marimo:ai-prompt-history", Rs = new ae($e(qe()), () => []), zs = (e) =
|
|
|
5362
5361
|
S,
|
|
5363
5362
|
C,
|
|
5364
5363
|
w,
|
|
5365
|
-
|
|
5364
|
+
yt.lineWrapping,
|
|
5366
5365
|
T,
|
|
5367
5366
|
E,
|
|
5368
5367
|
D
|
|
5369
5368
|
], t[16] = b, t[17] = x, t[18] = S, t[19] = C, t[20] = E, t[21] = D, t[22] = O) : O = t[22];
|
|
5370
5369
|
let k = O, A;
|
|
5371
5370
|
t[23] === o ? A = t[24] : (A = i("flex-1 font-sans overflow-auto my-1", o), t[23] = o, t[24] = A);
|
|
5372
|
-
let ee = _ === "dark" ? "dark" : "light",
|
|
5373
|
-
return t[25] !== k || t[26] !== a || t[27] !== p || t[28] !== s || t[29] !== l || t[30] !== A || t[31] !== ee || t[32] !==
|
|
5371
|
+
let ee = _ === "dark" ? "dark" : "light", te = r || "Generate with AI, @ to include context", ne;
|
|
5372
|
+
return t[25] !== k || t[26] !== a || t[27] !== p || t[28] !== s || t[29] !== l || t[30] !== A || t[31] !== ee || t[32] !== te || t[33] !== n ? (ne = /* @__PURE__ */ (0, q.jsx)(Lt, {
|
|
5374
5373
|
ref: a,
|
|
5375
5374
|
className: A,
|
|
5376
5375
|
width: "100%",
|
|
@@ -5381,8 +5380,8 @@ var Ls = "marimo:ai-prompt-history", Rs = new ae($e(qe()), () => []), zs = (e) =
|
|
|
5381
5380
|
onChange: s,
|
|
5382
5381
|
onKeyDown: l,
|
|
5383
5382
|
theme: ee,
|
|
5384
|
-
placeholder:
|
|
5385
|
-
}), t[25] = k, t[26] = a, t[27] = p, t[28] = s, t[29] = l, t[30] = A, t[31] = ee, t[32] =
|
|
5383
|
+
placeholder: te
|
|
5384
|
+
}), t[25] = k, t[26] = a, t[27] = p, t[28] = s, t[29] = l, t[30] = A, t[31] = ee, t[32] = te, t[33] = n, t[34] = ne) : ne = t[34], ne;
|
|
5386
5385
|
};
|
|
5387
5386
|
function Bs() {
|
|
5388
5387
|
return Rs.get(Ls);
|
|
@@ -5392,11 +5391,11 @@ function Vs(e) {
|
|
|
5392
5391
|
}
|
|
5393
5392
|
//#endregion
|
|
5394
5393
|
//#region src/plugins/impl/chat/chat-ui.tsx
|
|
5395
|
-
var Hs = f, Us =
|
|
5396
|
-
type:
|
|
5397
|
-
message_id:
|
|
5398
|
-
content:
|
|
5399
|
-
is_final:
|
|
5394
|
+
var Hs = f, Us = nt({
|
|
5395
|
+
type: ct("stream_chunk"),
|
|
5396
|
+
message_id: Qe(),
|
|
5397
|
+
content: rt().nullable().transform((e) => e),
|
|
5398
|
+
is_final: lt().optional()
|
|
5400
5399
|
});
|
|
5401
5400
|
function Ws(e, t) {
|
|
5402
5401
|
let { controllerRef: n, activeRequestIdRef: i } = t, a = n.current;
|
|
@@ -5408,15 +5407,15 @@ function Ws(e, t) {
|
|
|
5408
5407
|
}), "dropped-stale") : (e.content && a.enqueue(e.content), e.is_final ? (a.close(), n.current = null, i.current = null, "closed") : "enqueued");
|
|
5409
5408
|
}
|
|
5410
5409
|
var Gs = (e) => {
|
|
5411
|
-
let [t, o] = (0,
|
|
5410
|
+
let [t, o] = (0, K.useState)(""), [s, c] = (0, K.useState)(e.config), [u, d] = (0, K.useState)(e.config), [f, p] = (0, K.useState)(void 0), h = (0, K.useRef)(null), g = (0, K.useRef)(null), _ = (0, K.useRef)(null), v = (0, K.useRef)(null);
|
|
5412
5411
|
Object.keys(e.config).some((t) => e.config[t] !== u[t]) && (c(e.config), d(e.config));
|
|
5413
|
-
let y = (0,
|
|
5412
|
+
let y = (0, K.useRef)(s);
|
|
5414
5413
|
y.current = s;
|
|
5415
|
-
let b = (0,
|
|
5414
|
+
let b = (0, K.useRef)(null), x = (0, K.useRef)(null), S = (0, K.useRef)(null), [C, w] = (0, K.useState)(null), T = () => {
|
|
5416
5415
|
S.current = null, w(null);
|
|
5417
|
-
}, { data: D } =
|
|
5416
|
+
}, { data: D } = Rt(async () => (await e.get_chat_history({})).messages, []), O = e.value.length > 0 ? e.value : D, { messages: k, sendMessage: A, setMessages: ee, status: te, stop: ne, error: j, regenerate: ie, clearError: ae, addToolApprovalResponse: oe } = eo({
|
|
5418
5417
|
sendAutomaticallyWhen: ({ messages: e }) => Eo(e),
|
|
5419
|
-
transport: new
|
|
5418
|
+
transport: new Pa({ fetch: async (t, n) => {
|
|
5420
5419
|
if (n === void 0) return fetch(t);
|
|
5421
5420
|
let i = JSON.parse(n.body), a = n.signal, o = {
|
|
5422
5421
|
max_tokens: y.current.max_tokens,
|
|
@@ -5430,7 +5429,7 @@ var Gs = (e) => {
|
|
|
5430
5429
|
let t = i.messages.map((e) => ({
|
|
5431
5430
|
...e,
|
|
5432
5431
|
content: e.parts?.map((e) => "text" in e ? e.text : "").join("\n")
|
|
5433
|
-
})), n =
|
|
5432
|
+
})), n = Ce();
|
|
5434
5433
|
T();
|
|
5435
5434
|
let s = new ReadableStream({
|
|
5436
5435
|
start(t) {
|
|
@@ -5459,7 +5458,7 @@ var Gs = (e) => {
|
|
|
5459
5458
|
config: o
|
|
5460
5459
|
}).catch((e) => {
|
|
5461
5460
|
b.current?.error(e), b.current = null, x.current = null;
|
|
5462
|
-
}),
|
|
5461
|
+
}), ha({ stream: s });
|
|
5463
5462
|
} catch (e) {
|
|
5464
5463
|
if (e instanceof Error && e.name === "AbortError") return new Response("Aborted", { status: 499 });
|
|
5465
5464
|
let t = e.message?.split("failed with exception ").pop();
|
|
@@ -5490,7 +5489,7 @@ var Gs = (e) => {
|
|
|
5490
5489
|
r.error("An error occurred:", e);
|
|
5491
5490
|
}
|
|
5492
5491
|
});
|
|
5493
|
-
n(e.host,
|
|
5492
|
+
n(e.host, He.TYPE, (e) => {
|
|
5494
5493
|
let t = Us.safeParse(e.detail.message);
|
|
5495
5494
|
if (t.success) {
|
|
5496
5495
|
if (t.data.content && t.data.message_id === x.current) {
|
|
@@ -5503,7 +5502,7 @@ var Gs = (e) => {
|
|
|
5503
5502
|
});
|
|
5504
5503
|
}
|
|
5505
5504
|
});
|
|
5506
|
-
let se =
|
|
5505
|
+
let se = te === "submitted" || te === "streaming", ce = (t) => {
|
|
5507
5506
|
let n = k.findIndex((e) => e.id === t);
|
|
5508
5507
|
if (n !== -1) {
|
|
5509
5508
|
let r = k.filter((e) => e.id !== t);
|
|
@@ -5516,17 +5515,17 @@ var Gs = (e) => {
|
|
|
5516
5515
|
displayLabel: e,
|
|
5517
5516
|
apply: e
|
|
5518
5517
|
}))
|
|
5519
|
-
},
|
|
5520
|
-
(0,
|
|
5518
|
+
}, de = e.prompts.length > 0 ? "Type your message here, / for prompts" : "Type your message here...";
|
|
5519
|
+
(0, K.useEffect)(() => {
|
|
5521
5520
|
v.current?.scrollTo({
|
|
5522
5521
|
top: v.current.scrollHeight,
|
|
5523
5522
|
behavior: "smooth"
|
|
5524
5523
|
});
|
|
5525
5524
|
}, [k.length, v]);
|
|
5526
|
-
let
|
|
5527
|
-
if (
|
|
5528
|
-
let e =
|
|
5529
|
-
|
|
5525
|
+
let fe = _.current?.view, pe = () => {
|
|
5526
|
+
if (fe) {
|
|
5527
|
+
let e = fe.state.doc.length;
|
|
5528
|
+
fe.dispatch({ changes: {
|
|
5530
5529
|
from: 0,
|
|
5531
5530
|
to: e,
|
|
5532
5531
|
insert: ""
|
|
@@ -5534,35 +5533,35 @@ var Gs = (e) => {
|
|
|
5534
5533
|
}
|
|
5535
5534
|
o("");
|
|
5536
5535
|
};
|
|
5537
|
-
return /* @__PURE__ */ (0,
|
|
5536
|
+
return /* @__PURE__ */ (0, q.jsxs)("div", {
|
|
5538
5537
|
className: "flex flex-col h-full bg-(--slate-1) rounded-lg shadow border border-(--slate-6) overflow-hidden relative",
|
|
5539
5538
|
style: { maxHeight: e.maxHeight },
|
|
5540
5539
|
children: [
|
|
5541
|
-
/* @__PURE__ */ (0,
|
|
5540
|
+
/* @__PURE__ */ (0, q.jsx)("div", {
|
|
5542
5541
|
className: "absolute top-0 right-0 flex justify-end z-10 border border-(--slate-6) bg-inherit rounded-bl-lg",
|
|
5543
|
-
children: /* @__PURE__ */ (0,
|
|
5542
|
+
children: /* @__PURE__ */ (0, q.jsx)(a, {
|
|
5544
5543
|
variant: "text",
|
|
5545
5544
|
size: "icon",
|
|
5546
5545
|
disabled: k.length === 0,
|
|
5547
5546
|
onClick: () => {
|
|
5548
5547
|
ee([]), e.setValue([]), e.delete_chat_history({}), ae(), T();
|
|
5549
5548
|
},
|
|
5550
|
-
children: /* @__PURE__ */ (0,
|
|
5549
|
+
children: /* @__PURE__ */ (0, q.jsx)(Wt, { className: "h-3 w-3" })
|
|
5551
5550
|
})
|
|
5552
5551
|
}),
|
|
5553
|
-
/* @__PURE__ */ (0,
|
|
5552
|
+
/* @__PURE__ */ (0, q.jsxs)("div", {
|
|
5554
5553
|
className: "grow overflow-y-auto gap-4 pt-8 pb-4 px-2 flex flex-col",
|
|
5555
5554
|
ref: v,
|
|
5556
5555
|
children: [
|
|
5557
|
-
k.length === 0 && /* @__PURE__ */ (0,
|
|
5556
|
+
k.length === 0 && /* @__PURE__ */ (0, q.jsxs)("div", {
|
|
5558
5557
|
className: "flex flex-col items-center justify-center h-full text-muted-foreground text-center p-4",
|
|
5559
5558
|
children: [
|
|
5560
|
-
/* @__PURE__ */ (0,
|
|
5561
|
-
/* @__PURE__ */ (0,
|
|
5559
|
+
/* @__PURE__ */ (0, q.jsx)(Bt, { className: "h-12 w-12 mb-4" }),
|
|
5560
|
+
/* @__PURE__ */ (0, q.jsx)("h3", {
|
|
5562
5561
|
className: "text-lg font-semibold mb-2",
|
|
5563
5562
|
children: "No messages yet"
|
|
5564
5563
|
}),
|
|
5565
|
-
/* @__PURE__ */ (0,
|
|
5564
|
+
/* @__PURE__ */ (0, q.jsx)("p", {
|
|
5566
5565
|
className: "text-sm",
|
|
5567
5566
|
children: "Start a conversation by typing a message below."
|
|
5568
5567
|
})
|
|
@@ -5570,55 +5569,55 @@ var Gs = (e) => {
|
|
|
5570
5569
|
}),
|
|
5571
5570
|
k.map((e, t) => {
|
|
5572
5571
|
let n = e.parts?.filter((e) => e.type === "text").map((e) => e.text).join("\n"), r = t === k.length - 1;
|
|
5573
|
-
return /* @__PURE__ */ (0,
|
|
5572
|
+
return /* @__PURE__ */ (0, q.jsxs)("div", {
|
|
5574
5573
|
className: i("flex flex-col group gap-2", e.role === "user" ? "items-end" : "items-start"),
|
|
5575
|
-
children: [/* @__PURE__ */ (0,
|
|
5574
|
+
children: [/* @__PURE__ */ (0, q.jsx)("div", {
|
|
5576
5575
|
className: `max-w-[80%] p-3 rounded-lg ${e.role === "user" ? "bg-(--sky-11) text-(--slate-1) whitespace-pre-wrap" : "bg-(--slate-4) text-(--slate-12)"}`,
|
|
5577
5576
|
children: qo({
|
|
5578
5577
|
message: e,
|
|
5579
|
-
isStreamingReasoning:
|
|
5578
|
+
isStreamingReasoning: te === "streaming",
|
|
5580
5579
|
isLast: r,
|
|
5581
5580
|
isActive: se,
|
|
5582
5581
|
addToolApprovalResponse: r ? oe : void 0
|
|
5583
5582
|
})
|
|
5584
|
-
}), /* @__PURE__ */ (0,
|
|
5583
|
+
}), /* @__PURE__ */ (0, q.jsxs)("div", {
|
|
5585
5584
|
className: "flex justify-end text-xs gap-2 invisible group-hover:visible",
|
|
5586
|
-
children: [/* @__PURE__ */ (0,
|
|
5585
|
+
children: [/* @__PURE__ */ (0, q.jsx)(l, {
|
|
5587
5586
|
value: n,
|
|
5588
5587
|
className: "h-3 w-3",
|
|
5589
5588
|
buttonClassName: "text-xs text-(--slate-9) hover:text-(--slate-11)"
|
|
5590
|
-
}), /* @__PURE__ */ (0,
|
|
5589
|
+
}), /* @__PURE__ */ (0, q.jsx)("button", {
|
|
5591
5590
|
type: "button",
|
|
5592
5591
|
onClick: () => ce(e.id),
|
|
5593
5592
|
className: "text-xs text-(--slate-9) hover:text-(--slate-11)",
|
|
5594
|
-
children: /* @__PURE__ */ (0,
|
|
5593
|
+
children: /* @__PURE__ */ (0, q.jsx)(m, { className: "h-3 w-3 text-(--red-9)" })
|
|
5595
5594
|
})]
|
|
5596
5595
|
})]
|
|
5597
5596
|
}, `${e.id}-${t}`);
|
|
5598
5597
|
}),
|
|
5599
|
-
se && /* @__PURE__ */ (0,
|
|
5598
|
+
se && /* @__PURE__ */ (0, q.jsx)("div", {
|
|
5600
5599
|
className: "flex items-center justify-center mb-4",
|
|
5601
|
-
children: /* @__PURE__ */ (0,
|
|
5600
|
+
children: /* @__PURE__ */ (0, q.jsx)(E, { size: "small" })
|
|
5602
5601
|
}),
|
|
5603
|
-
|
|
5602
|
+
j && /* @__PURE__ */ (0, q.jsxs)("div", {
|
|
5604
5603
|
className: "flex items-center justify-center space-x-2 mb-4",
|
|
5605
|
-
children: [/* @__PURE__ */ (0,
|
|
5604
|
+
children: [/* @__PURE__ */ (0, q.jsx)(pt, { error: j }), /* @__PURE__ */ (0, q.jsx)(a, {
|
|
5606
5605
|
variant: "outline",
|
|
5607
5606
|
size: "sm",
|
|
5608
5607
|
onClick: () => ie(),
|
|
5609
5608
|
children: "Retry"
|
|
5610
5609
|
})]
|
|
5611
5610
|
}),
|
|
5612
|
-
C && !se && !
|
|
5611
|
+
C && !se && !j && /* @__PURE__ */ (0, q.jsx)("div", {
|
|
5613
5612
|
className: "flex justify-center py-2",
|
|
5614
|
-
children: /* @__PURE__ */ (0,
|
|
5613
|
+
children: /* @__PURE__ */ (0, q.jsx)("span", {
|
|
5615
5614
|
className: "text-xs text-muted-foreground",
|
|
5616
5615
|
children: C
|
|
5617
5616
|
})
|
|
5618
5617
|
})
|
|
5619
5618
|
]
|
|
5620
5619
|
}),
|
|
5621
|
-
/* @__PURE__ */ (0,
|
|
5620
|
+
/* @__PURE__ */ (0, q.jsxs)("form", {
|
|
5622
5621
|
onSubmit: async (n) => {
|
|
5623
5622
|
if (n.preventDefault(), e.disabled) return;
|
|
5624
5623
|
let r = f ? await To(f) : void 0;
|
|
@@ -5628,27 +5627,27 @@ var Gs = (e) => {
|
|
|
5628
5627
|
type: "text",
|
|
5629
5628
|
text: t
|
|
5630
5629
|
}, ...r ?? []]
|
|
5631
|
-
}),
|
|
5630
|
+
}), pe();
|
|
5632
5631
|
},
|
|
5633
5632
|
ref: g,
|
|
5634
5633
|
inert: e.disabled || void 0,
|
|
5635
5634
|
className: i("flex w-full border-t border-(--slate-6) px-2 py-1 items-center", e.disabled && "opacity-50 cursor-not-allowed"),
|
|
5636
5635
|
children: [
|
|
5637
|
-
e.showConfigurationControls && /* @__PURE__ */ (0,
|
|
5636
|
+
e.showConfigurationControls && /* @__PURE__ */ (0, q.jsx)(qs, {
|
|
5638
5637
|
config: s,
|
|
5639
5638
|
onChange: c
|
|
5640
5639
|
}),
|
|
5641
|
-
e.prompts.length > 0 && /* @__PURE__ */ (0,
|
|
5640
|
+
e.prompts.length > 0 && /* @__PURE__ */ (0, q.jsx)(Js, {
|
|
5642
5641
|
prompts: e.prompts,
|
|
5643
5642
|
onSelect: (e) => {
|
|
5644
5643
|
o(e), requestAnimationFrame(() => {
|
|
5645
|
-
|
|
5644
|
+
fe?.focus(), ge(fe);
|
|
5646
5645
|
});
|
|
5647
5646
|
}
|
|
5648
5647
|
}),
|
|
5649
|
-
/* @__PURE__ */ (0,
|
|
5648
|
+
/* @__PURE__ */ (0, q.jsx)(zs, {
|
|
5650
5649
|
className: "rounded-sm mr-2",
|
|
5651
|
-
placeholder:
|
|
5650
|
+
placeholder: de,
|
|
5652
5651
|
value: t,
|
|
5653
5652
|
inputRef: _,
|
|
5654
5653
|
maxHeight: e.maxHeight ? `${e.maxHeight / 2}px` : void 0,
|
|
@@ -5659,32 +5658,32 @@ var Gs = (e) => {
|
|
|
5659
5658
|
onClose: () => {},
|
|
5660
5659
|
additionalCompletions: ue
|
|
5661
5660
|
}),
|
|
5662
|
-
f && f.length === 1 && /* @__PURE__ */ (0,
|
|
5661
|
+
f && f.length === 1 && /* @__PURE__ */ (0, q.jsx)("span", {
|
|
5663
5662
|
title: f[0].name,
|
|
5664
5663
|
className: "text-sm text-(--slate-11) truncate shrink-0 w-fit max-w-24",
|
|
5665
5664
|
children: f[0].name
|
|
5666
5665
|
}),
|
|
5667
|
-
f && f.length > 1 && /* @__PURE__ */ (0,
|
|
5666
|
+
f && f.length > 1 && /* @__PURE__ */ (0, q.jsxs)("span", {
|
|
5668
5667
|
title: [...f].map((e) => e.name).join("\n"),
|
|
5669
5668
|
className: "text-sm text-(--slate-11) truncate shrink-0",
|
|
5670
5669
|
children: [f.length, " files"]
|
|
5671
5670
|
}),
|
|
5672
|
-
f && f.length > 0 && /* @__PURE__ */ (0,
|
|
5671
|
+
f && f.length > 0 && /* @__PURE__ */ (0, q.jsx)(a, {
|
|
5673
5672
|
type: "button",
|
|
5674
5673
|
variant: "text",
|
|
5675
5674
|
size: "sm",
|
|
5676
5675
|
onClick: () => {
|
|
5677
5676
|
p(void 0), h.current && (h.current.value = "");
|
|
5678
5677
|
},
|
|
5679
|
-
children: /* @__PURE__ */ (0,
|
|
5678
|
+
children: /* @__PURE__ */ (0, q.jsx)(Oe, { className: "size-3" })
|
|
5680
5679
|
}),
|
|
5681
|
-
le && /* @__PURE__ */ (0,
|
|
5680
|
+
le && /* @__PURE__ */ (0, q.jsxs)(q.Fragment, { children: [/* @__PURE__ */ (0, q.jsx)(a, {
|
|
5682
5681
|
type: "button",
|
|
5683
5682
|
variant: "text",
|
|
5684
5683
|
size: "sm",
|
|
5685
5684
|
onClick: () => h.current?.click(),
|
|
5686
|
-
children: /* @__PURE__ */ (0,
|
|
5687
|
-
}), /* @__PURE__ */ (0,
|
|
5685
|
+
children: /* @__PURE__ */ (0, q.jsx)(Ut, { className: "h-4" })
|
|
5686
|
+
}), /* @__PURE__ */ (0, q.jsx)("input", {
|
|
5688
5687
|
type: "file",
|
|
5689
5688
|
ref: h,
|
|
5690
5689
|
className: "hidden",
|
|
@@ -5694,24 +5693,24 @@ var Gs = (e) => {
|
|
|
5694
5693
|
e.target.files && p([...e.target.files]);
|
|
5695
5694
|
}
|
|
5696
5695
|
})] }),
|
|
5697
|
-
se ? /* @__PURE__ */ (0,
|
|
5696
|
+
se ? /* @__PURE__ */ (0, q.jsx)(re, {
|
|
5698
5697
|
content: "Stop generating",
|
|
5699
|
-
children: /* @__PURE__ */ (0,
|
|
5698
|
+
children: /* @__PURE__ */ (0, q.jsx)(a, {
|
|
5700
5699
|
type: "button",
|
|
5701
5700
|
variant: "link",
|
|
5702
5701
|
size: "xs",
|
|
5703
|
-
onClick: () =>
|
|
5702
|
+
onClick: () => ne(),
|
|
5704
5703
|
className: "text-(--red-9) hover:text-(--red-11)",
|
|
5705
|
-
children: /* @__PURE__ */ (0,
|
|
5704
|
+
children: /* @__PURE__ */ (0, q.jsx)(Be, { className: "h-4 w-4 fill-current" })
|
|
5706
5705
|
})
|
|
5707
|
-
}) : /* @__PURE__ */ (0,
|
|
5706
|
+
}) : /* @__PURE__ */ (0, q.jsx)(a, {
|
|
5708
5707
|
type: "submit",
|
|
5709
5708
|
disabled: !t,
|
|
5710
5709
|
variant: "outline",
|
|
5711
5710
|
size: "xs",
|
|
5712
5711
|
className: "text-(--slate-11)",
|
|
5713
5712
|
"aria-label": "Send message",
|
|
5714
|
-
children: /* @__PURE__ */ (0,
|
|
5713
|
+
children: /* @__PURE__ */ (0, q.jsx)(Gt, { className: "h-4 w-4" })
|
|
5715
5714
|
})
|
|
5716
5715
|
]
|
|
5717
5716
|
})
|
|
@@ -5751,7 +5750,7 @@ var Gs = (e) => {
|
|
|
5751
5750
|
description: "Penalizes new tokens (-2: favor, 2: avoid)"
|
|
5752
5751
|
}
|
|
5753
5752
|
}, qs = (e) => {
|
|
5754
|
-
let t = (0,
|
|
5753
|
+
let t = (0, M.c)(16), { config: n, onChange: r } = e, [i, o] = (0, K.useState)(!1), s;
|
|
5755
5754
|
t[0] !== n || t[1] !== r ? (s = (e, t) => {
|
|
5756
5755
|
let i = t === null || Number.isNaN(t) ? null : t;
|
|
5757
5756
|
if (i !== null) {
|
|
@@ -5769,20 +5768,20 @@ var Gs = (e) => {
|
|
|
5769
5768
|
e.key === "Enter" && (e.preventDefault(), o(!1));
|
|
5770
5769
|
}, t[3] = l) : l = t[3];
|
|
5771
5770
|
let u = l, f;
|
|
5772
|
-
t[4] === Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */ (0,
|
|
5771
|
+
t[4] === Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */ (0, q.jsx)(re, {
|
|
5773
5772
|
content: "Configuration",
|
|
5774
|
-
children: /* @__PURE__ */ (0,
|
|
5773
|
+
children: /* @__PURE__ */ (0, q.jsx)(d, {
|
|
5775
5774
|
asChild: !0,
|
|
5776
|
-
children: /* @__PURE__ */ (0,
|
|
5775
|
+
children: /* @__PURE__ */ (0, q.jsx)(a, {
|
|
5777
5776
|
variant: "outline",
|
|
5778
5777
|
size: "sm",
|
|
5779
5778
|
className: "border-none shadow-none hover:bg-transparent",
|
|
5780
|
-
children: /* @__PURE__ */ (0,
|
|
5779
|
+
children: /* @__PURE__ */ (0, q.jsx)(Kt, { className: "h-3 w-3" })
|
|
5781
5780
|
})
|
|
5782
5781
|
})
|
|
5783
5782
|
}), t[4] = f) : f = t[4];
|
|
5784
5783
|
let m;
|
|
5785
|
-
t[5] === Symbol.for("react.memo_cache_sentinel") ? (m = /* @__PURE__ */ (0,
|
|
5784
|
+
t[5] === Symbol.for("react.memo_cache_sentinel") ? (m = /* @__PURE__ */ (0, q.jsx)("h4", {
|
|
5786
5785
|
className: "font-bold leading-none",
|
|
5787
5786
|
children: "Configuration"
|
|
5788
5787
|
}), t[5] = m) : m = t[5];
|
|
@@ -5791,21 +5790,21 @@ var Gs = (e) => {
|
|
|
5791
5790
|
let e;
|
|
5792
5791
|
t[9] === c ? e = t[10] : (e = (e) => {
|
|
5793
5792
|
let [t, n] = e;
|
|
5794
|
-
return /* @__PURE__ */ (0,
|
|
5793
|
+
return /* @__PURE__ */ (0, q.jsxs)("div", {
|
|
5795
5794
|
className: "grid grid-cols-3 items-center gap-1",
|
|
5796
|
-
children: [/* @__PURE__ */ (0,
|
|
5795
|
+
children: [/* @__PURE__ */ (0, q.jsxs)(mt, {
|
|
5797
5796
|
htmlFor: t,
|
|
5798
5797
|
className: "flex w-full justify-between col-span-3 align-end",
|
|
5799
|
-
children: [
|
|
5798
|
+
children: [je.startCase(t), /* @__PURE__ */ (0, q.jsx)(re, {
|
|
5800
5799
|
delayDuration: 200,
|
|
5801
5800
|
side: "top",
|
|
5802
|
-
content: /* @__PURE__ */ (0,
|
|
5801
|
+
content: /* @__PURE__ */ (0, q.jsx)("div", {
|
|
5803
5802
|
className: "text-xs flex flex-col",
|
|
5804
5803
|
children: Ks[t].description
|
|
5805
5804
|
}),
|
|
5806
|
-
children: /* @__PURE__ */ (0,
|
|
5805
|
+
children: /* @__PURE__ */ (0, q.jsx)(Re, { className: "h-3 w-3 cursor-help text-muted-foreground hover:text-foreground" })
|
|
5807
5806
|
})]
|
|
5808
|
-
}), /* @__PURE__ */ (0,
|
|
5807
|
+
}), /* @__PURE__ */ (0, q.jsx)(Me, {
|
|
5809
5808
|
id: t,
|
|
5810
5809
|
"aria-label": t,
|
|
5811
5810
|
value: n ?? NaN,
|
|
@@ -5818,51 +5817,51 @@ var Gs = (e) => {
|
|
|
5818
5817
|
className: "col-span-3"
|
|
5819
5818
|
})]
|
|
5820
5819
|
}, t);
|
|
5821
|
-
}, t[9] = c, t[10] = e), h =
|
|
5820
|
+
}, t[9] = c, t[10] = e), h = jt.entries(n).map(e), t[6] = n, t[7] = c, t[8] = h;
|
|
5822
5821
|
} else h = t[8];
|
|
5823
5822
|
let g;
|
|
5824
|
-
t[11] === h ? g = t[12] : (g = /* @__PURE__ */ (0,
|
|
5823
|
+
t[11] === h ? g = t[12] : (g = /* @__PURE__ */ (0, q.jsx)(p, {
|
|
5825
5824
|
className: "w-70 border",
|
|
5826
|
-
children: /* @__PURE__ */ (0,
|
|
5825
|
+
children: /* @__PURE__ */ (0, q.jsxs)("div", {
|
|
5827
5826
|
className: "grid gap-3",
|
|
5828
5827
|
children: [m, h]
|
|
5829
5828
|
})
|
|
5830
5829
|
}), t[11] = h, t[12] = g);
|
|
5831
5830
|
let _;
|
|
5832
|
-
return t[13] !== i || t[14] !== g ? (_ = /* @__PURE__ */ (0,
|
|
5831
|
+
return t[13] !== i || t[14] !== g ? (_ = /* @__PURE__ */ (0, q.jsxs)(ne, {
|
|
5833
5832
|
open: i,
|
|
5834
5833
|
onOpenChange: o,
|
|
5835
5834
|
children: [f, g]
|
|
5836
5835
|
}), t[13] = i, t[14] = g, t[15] = _) : _ = t[15], _;
|
|
5837
5836
|
}, Js = (e) => {
|
|
5838
|
-
let t = (0,
|
|
5837
|
+
let t = (0, M.c)(18), { prompts: n, onSelect: r } = e, [i, o] = (0, K.useState)(!1), [s, c] = (0, K.useState)(""), l;
|
|
5839
5838
|
t[0] === r ? l = t[1] : (l = (e) => {
|
|
5840
5839
|
[...e.matchAll(/{{(\w+)}}/g)].length > 0 ? (c(e), o(!0)) : r(e);
|
|
5841
5840
|
}, t[0] = r, t[1] = l);
|
|
5842
5841
|
let u = l, d;
|
|
5843
|
-
t[2] === Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ (0,
|
|
5842
|
+
t[2] === Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ (0, q.jsx)(re, {
|
|
5844
5843
|
content: "Select a prompt",
|
|
5845
|
-
children: /* @__PURE__ */ (0,
|
|
5844
|
+
children: /* @__PURE__ */ (0, q.jsx)(Ne, {
|
|
5846
5845
|
asChild: !0,
|
|
5847
|
-
children: /* @__PURE__ */ (0,
|
|
5846
|
+
children: /* @__PURE__ */ (0, q.jsx)(a, {
|
|
5848
5847
|
variant: "outline",
|
|
5849
5848
|
size: "sm",
|
|
5850
5849
|
className: "border-none shadow-none hover:bg-transparent",
|
|
5851
|
-
children: /* @__PURE__ */ (0,
|
|
5850
|
+
children: /* @__PURE__ */ (0, q.jsx)(ee, { className: "h-3 w-3" })
|
|
5852
5851
|
})
|
|
5853
5852
|
})
|
|
5854
5853
|
}), t[2] = d) : d = t[2];
|
|
5855
5854
|
let f;
|
|
5856
5855
|
if (t[3] !== u || t[4] !== n) {
|
|
5857
5856
|
let e;
|
|
5858
|
-
t[6] === u ? e = t[7] : (e = (e, t) => /* @__PURE__ */ (0,
|
|
5857
|
+
t[6] === u ? e = t[7] : (e = (e, t) => /* @__PURE__ */ (0, q.jsx)(Fe, {
|
|
5859
5858
|
onSelect: () => u(e),
|
|
5860
5859
|
className: "whitespace-normal text-left",
|
|
5861
5860
|
children: e
|
|
5862
5861
|
}, t), t[6] = u, t[7] = e), f = n.map(e), t[3] = u, t[4] = n, t[5] = f;
|
|
5863
5862
|
} else f = t[5];
|
|
5864
5863
|
let m;
|
|
5865
|
-
t[8] === f ? m = t[9] : (m = /* @__PURE__ */ (0,
|
|
5864
|
+
t[8] === f ? m = t[9] : (m = /* @__PURE__ */ (0, q.jsx)(Hs, { children: /* @__PURE__ */ (0, q.jsxs)(Le, { children: [d, /* @__PURE__ */ (0, q.jsx)(Ie, {
|
|
5866
5865
|
side: "right",
|
|
5867
5866
|
align: "end",
|
|
5868
5867
|
onCloseAutoFocus: Xs,
|
|
@@ -5872,30 +5871,30 @@ var Gs = (e) => {
|
|
|
5872
5871
|
let h;
|
|
5873
5872
|
t[10] === Symbol.for("react.memo_cache_sentinel") ? (h = () => o(!1), t[10] = h) : h = t[10];
|
|
5874
5873
|
let g;
|
|
5875
|
-
t[11] !== r || t[12] !== s ? (g = /* @__PURE__ */ (0,
|
|
5874
|
+
t[11] !== r || t[12] !== s ? (g = /* @__PURE__ */ (0, q.jsx)(p, {
|
|
5876
5875
|
side: "right",
|
|
5877
5876
|
align: "end",
|
|
5878
5877
|
className: "min-w-80 px-2",
|
|
5879
|
-
children: /* @__PURE__ */ (0,
|
|
5878
|
+
children: /* @__PURE__ */ (0, q.jsx)(Ys, {
|
|
5880
5879
|
prompt: s,
|
|
5881
5880
|
onClose: h,
|
|
5882
5881
|
onSelect: r
|
|
5883
5882
|
})
|
|
5884
5883
|
}), t[11] = r, t[12] = s, t[13] = g) : g = t[13];
|
|
5885
5884
|
let _;
|
|
5886
|
-
return t[14] !== i || t[15] !== m || t[16] !== g ? (_ = /* @__PURE__ */ (0,
|
|
5885
|
+
return t[14] !== i || t[15] !== m || t[16] !== g ? (_ = /* @__PURE__ */ (0, q.jsxs)(ne, {
|
|
5887
5886
|
open: i,
|
|
5888
5887
|
onOpenChange: o,
|
|
5889
5888
|
children: [m, g]
|
|
5890
5889
|
}), t[14] = i, t[15] = m, t[16] = g, t[17] = _) : _ = t[17], _;
|
|
5891
5890
|
}, Ys = (e) => {
|
|
5892
|
-
let t = (0,
|
|
5891
|
+
let t = (0, M.c)(32), { prompt: n, onClose: r, onSelect: i } = e, o;
|
|
5893
5892
|
t[0] === Symbol.for("react.memo_cache_sentinel") ? (o = {}, t[0] = o) : o = t[0];
|
|
5894
|
-
let [s, c] = (0,
|
|
5893
|
+
let [s, c] = (0, K.useState)(o), l, u;
|
|
5895
5894
|
t[1] === n ? (l = t[2], u = t[3]) : (l = () => {
|
|
5896
5895
|
let e = [...n.matchAll(/{{(\w+)}}/g)].reduce(Zs, {});
|
|
5897
5896
|
c(e);
|
|
5898
|
-
}, u = [n], t[1] = n, t[2] = l, t[3] = u), (0,
|
|
5897
|
+
}, u = [n], t[1] = n, t[2] = l, t[3] = u), (0, K.useEffect)(l, u);
|
|
5899
5898
|
let d;
|
|
5900
5899
|
t[4] === Symbol.for("react.memo_cache_sentinel") ? (d = (e, t) => {
|
|
5901
5900
|
c((n) => ({
|
|
@@ -5921,13 +5920,13 @@ var Gs = (e) => {
|
|
|
5921
5920
|
let b;
|
|
5922
5921
|
t[19] !== v || t[20] !== g || t[21] !== y ? (b = y.map((e, t) => {
|
|
5923
5922
|
let [n, r] = e;
|
|
5924
|
-
return /* @__PURE__ */ (0,
|
|
5923
|
+
return /* @__PURE__ */ (0, q.jsxs)("div", {
|
|
5925
5924
|
className: "grid grid-cols-4 items-center gap-2",
|
|
5926
|
-
children: [/* @__PURE__ */ (0,
|
|
5925
|
+
children: [/* @__PURE__ */ (0, q.jsx)(mt, {
|
|
5927
5926
|
htmlFor: n,
|
|
5928
5927
|
className: "font-semibold text-base",
|
|
5929
5928
|
children: n
|
|
5930
|
-
}), /* @__PURE__ */ (0,
|
|
5929
|
+
}), /* @__PURE__ */ (0, q.jsx)(Pe, {
|
|
5931
5930
|
id: n,
|
|
5932
5931
|
value: r,
|
|
5933
5932
|
onChange: (e) => f(n, e.target.value),
|
|
@@ -5942,22 +5941,22 @@ var Gs = (e) => {
|
|
|
5942
5941
|
}, n);
|
|
5943
5942
|
}), t[19] = v, t[20] = g, t[21] = y, t[22] = b) : b = t[22];
|
|
5944
5943
|
let x;
|
|
5945
|
-
t[23] === m ? x = t[24] : (x = /* @__PURE__ */ (0,
|
|
5944
|
+
t[23] === m ? x = t[24] : (x = /* @__PURE__ */ (0, q.jsx)("div", {
|
|
5946
5945
|
className: "grid gap-2 prose dark:prose-invert",
|
|
5947
|
-
children: /* @__PURE__ */ (0,
|
|
5946
|
+
children: /* @__PURE__ */ (0, q.jsx)("blockquote", {
|
|
5948
5947
|
className: "text-sm",
|
|
5949
5948
|
children: m
|
|
5950
5949
|
})
|
|
5951
5950
|
}), t[23] = m, t[24] = x);
|
|
5952
5951
|
let S;
|
|
5953
|
-
t[25] !== v || t[26] !== g ? (S = /* @__PURE__ */ (0,
|
|
5952
|
+
t[25] !== v || t[26] !== g ? (S = /* @__PURE__ */ (0, q.jsx)(a, {
|
|
5954
5953
|
onClick: v,
|
|
5955
5954
|
size: "xs",
|
|
5956
5955
|
disabled: g,
|
|
5957
5956
|
children: "Submit"
|
|
5958
5957
|
}), t[25] = v, t[26] = g, t[27] = S) : S = t[27];
|
|
5959
5958
|
let C;
|
|
5960
|
-
return t[28] !== x || t[29] !== S || t[30] !== b ? (C = /* @__PURE__ */ (0,
|
|
5959
|
+
return t[28] !== x || t[29] !== S || t[30] !== b ? (C = /* @__PURE__ */ (0, q.jsxs)("div", {
|
|
5961
5960
|
className: "grid gap-4",
|
|
5962
5961
|
children: [
|
|
5963
5962
|
b,
|