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