uigraph 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -51
- package/dist/bin.mjs +1608 -59037
- package/dist/viewer/assets/abnfDiagram-VCTEODGH-D7zWJuPJ.js +1 -0
- package/dist/viewer/assets/actor-avatar-Bu-mKKXB.js +1 -0
- package/dist/viewer/assets/{api-adapters-CnQpLiWI.js → api-adapters-tfr51BsS.js} +1 -1
- package/dist/viewer/assets/{api-endpoints-DCA5GNpC.js → api-endpoints-D-Whnnwd.js} +9 -9
- package/dist/viewer/assets/{api-group-endpoints-page-Di42W69y.js → api-group-endpoints-page-B9R1EI4i.js} +9 -9
- package/dist/viewer/assets/{arc-Cn8owoDw.js → arc-DauzQXFu.js} +1 -1
- package/dist/viewer/assets/architectureDiagram-5GKGNRK7-CXzgHd-c.js +36 -0
- package/dist/viewer/assets/{arrow-left-DWcMgM2U.js → arrow-left-DpQqmf17.js} +1 -1
- package/dist/viewer/assets/avatar-DAFUyk1i.js +43 -0
- package/dist/viewer/assets/badge-hR3QvPWv.js +1 -0
- package/dist/viewer/assets/better-delete-confirmation-modal-CGEQ5O4X.js +1 -0
- package/dist/viewer/assets/better-dialog-DcIxFWwk.js +1 -0
- package/dist/viewer/assets/{blockDiagram-I7D4REHJ-CbYzOsL_.js → blockDiagram-I7D4REHJ-CFHWUw4z.js} +2 -2
- package/dist/viewer/assets/{brands-Bd4RklRx.js → brands-DtmA1AhP.js} +1 -1
- package/dist/viewer/assets/button-DZj74qS7.js +1 -0
- package/dist/viewer/assets/{c4Diagram-7LVT6UL2-CLkVbphC.js → c4Diagram-7LVT6UL2-BHSggPKI.js} +6 -6
- package/dist/viewer/assets/{calendar-C0xdI_ag.js → calendar-Bolgc8E5.js} +1 -1
- package/dist/viewer/assets/channel-CNRSofFP.js +1 -0
- package/dist/viewer/assets/{check-XjanpAFg.js → check-BpmCQNbj.js} +1 -1
- package/dist/viewer/assets/checkbox-CFJfXL6R.js +1 -0
- package/dist/viewer/assets/{chevron-down-R7pQzyLD.js → chevron-down-DDsUE_xz.js} +1 -1
- package/dist/viewer/assets/{chevron-up-CRPypfOs.js → chevron-up-DVznKMGv.js} +1 -1
- package/dist/viewer/assets/{chunk-2Q5K7J3B-CcvtugCu.js → chunk-2Q5K7J3B-CNfz5YDQ.js} +1 -1
- package/dist/viewer/assets/{chunk-5VM5RSS4-CpZHHr12.js → chunk-5VM5RSS4-CwIhjvMe.js} +1 -1
- package/dist/viewer/assets/{chunk-F27PBJKO-DeAl4iOc.js → chunk-F27PBJKO-YFexFJof.js} +1 -1
- package/dist/viewer/assets/{chunk-IMKFNOWR-BfrPe7pS.js → chunk-IMKFNOWR-GY2yrvuo.js} +1 -1
- package/dist/viewer/assets/{chunk-JWPE2WC7-DDjyvUmZ.js → chunk-JWPE2WC7-xd0JGvne.js} +1 -1
- package/dist/viewer/assets/chunk-OB3PAWPO-DJIP1M4r.js +12 -0
- package/dist/viewer/assets/{chunk-POPQ4Y6H-DkDb0mzz.js → chunk-POPQ4Y6H-Bh6rizEy.js} +1 -1
- package/dist/viewer/assets/{chunk-SVP7TREG-D-K2XIGs.js → chunk-SVP7TREG-DtNrjvpq.js} +1 -1
- package/dist/viewer/assets/{chunk-TICWLB2K-DWMQQx6z.js → chunk-TICWLB2K-DrERwtw8.js} +1 -1
- package/dist/viewer/assets/{chunk-XXDRQBXY-DfkljAyM.js → chunk-XXDRQBXY-fYo04iwY.js} +1 -1
- package/dist/viewer/assets/{circle-alert-pm13M-Ef.js → circle-alert-Bl7DXYD_.js} +1 -1
- package/dist/viewer/assets/classDiagram-ZZMXUADV-D7PO-ME9.js +1 -0
- package/dist/viewer/assets/classDiagram-v2-VYDZK3BY-D7PO-ME9.js +1 -0
- package/dist/viewer/assets/color-input-ClkkG_kZ.js +11 -0
- package/dist/viewer/assets/{common-Y7ySZBdh.js → common-DLCsGQ-t.js} +1 -1
- package/dist/viewer/assets/{component-icons-D1BDAuEt.js → component-icons-MJ61E9nt.js} +2 -2
- package/dist/viewer/assets/{copy-CN4K2f_R.js → copy-DMJJonQF.js} +1 -1
- package/dist/viewer/assets/cose-bilkent-JH36ORCC-Dplz8nVT.js +1 -0
- package/dist/viewer/assets/cross-button-D5qst1tj.js +1 -0
- package/dist/viewer/assets/{cynefin-OW5HDTMX-yz-uw9Kz.js → cynefin-OW5HDTMX-DiBs4CI8.js} +1 -1
- package/dist/viewer/assets/cynefinDiagram-5FMLGOSQ-COXS8-dI.js +62 -0
- package/dist/viewer/assets/{dagre-GXQ25YYZ-zjZDwXOe.js → dagre-GXQ25YYZ-K8qvfG8D.js} +2 -2
- package/dist/viewer/assets/dashboard-diagrams-page-Cb0xNr4W.js +2 -0
- package/dist/viewer/assets/dashboard-diagrams-page-inner-CD--zr5q.js +1 -0
- package/dist/viewer/assets/dashboard-docs-page-BfWR9Ai9.js +2 -0
- package/dist/viewer/assets/dashboard-docs-page-inner-BLbX-YwF.js +67 -0
- package/dist/viewer/assets/dashboard-layout-sTeeHNsZ.js +1 -0
- package/dist/viewer/assets/dashboard-lens-layout-D-tu_4kn.js +1 -0
- package/dist/viewer/assets/dashboard-map-frame-page-7pDmbTSe.js +1 -0
- package/dist/viewer/assets/dashboard-plans-page-CfwOZ34A.js +1 -0
- package/dist/viewer/assets/dashboard-service-apis-k93fjW51.js +1 -0
- package/dist/viewer/assets/{dashboard-service-diagrams-CIjk95Jk.js → dashboard-service-diagrams-BIWUxX-Y.js} +3 -3
- package/dist/viewer/assets/dashboard-service-docs-CnniTD6Q.js +1 -0
- package/dist/viewer/assets/{dashboard-service-overview-CzePVPjl.js → dashboard-service-overview-CGBu4omY.js} +5 -5
- package/dist/viewer/assets/dashboard-services-DEscIO2O.js +1 -0
- package/dist/viewer/assets/{db-type-badge-DOgu1Pyc.js → db-type-badge-UbPgpwQf.js} +2 -2
- package/dist/viewer/assets/debounce-Cp8eREM4-D7o-Pzb-.js +2 -0
- package/dist/viewer/assets/{dependencies-CYdEztHw.js → dependencies-DK2GDlhQ.js} +1 -1
- package/dist/viewer/assets/{dependency-graph-DbyfN-rC.js → dependency-graph-xBEnCS0J.js} +3 -3
- package/dist/viewer/assets/{diagram-S7CK7UJ4-q-NHkUCx.js → diagram-S7CK7UJ4-D-liadVe.js} +2 -2
- package/dist/viewer/assets/diagram-UQ7AKVKN-CnA8mgXp.js +41 -0
- package/dist/viewer/assets/{diagram-VSXAHHWV-DZc1kHGx.js → diagram-VSXAHHWV-Ck7dgRFR.js} +2 -2
- package/dist/viewer/assets/diagram-VX7I27RA-Cm1LHbu3.js +24 -0
- package/dist/viewer/assets/diagram-Z3DM3KII-DV3yBUCB.js +24 -0
- package/dist/viewer/assets/diagram-live-preview-DzJ7Nxp1.js +2 -0
- package/dist/viewer/assets/{diagram-portal-page-CWxuok9E.js → diagram-portal-page-gguGLULH.js} +24 -24
- package/dist/viewer/assets/{diagrams-C1xkRPqT.js → diagrams-BqBSv2eb.js} +4 -4
- package/dist/viewer/assets/dialog-D7wzTt0L.js +6 -0
- package/dist/viewer/assets/{doc-file-content-B06roi8L.js → doc-file-content-Be0au9Vo.js} +4 -4
- package/dist/viewer/assets/{download-CLdCXVsO.js → download-DhyZ3g4F.js} +1 -1
- package/dist/viewer/assets/ebnfDiagram-PWID7BFC-BXbHVQvG.js +1 -0
- package/dist/viewer/assets/{editor-vqK4qAnB.js → editor-F9o4zoeB.js} +2 -2
- package/dist/viewer/assets/{erDiagram-RLTQ6QDP-BWuA-aqV.js → erDiagram-RLTQ6QDP-DMfiWput.js} +2 -2
- package/dist/viewer/assets/{file-text-BvszilVL.js → file-text-BFqJQ67P.js} +1 -1
- package/dist/viewer/assets/flow-diagram-preview-B83UU1n_.js +1 -0
- package/dist/viewer/assets/{flowDiagram-HODETNUW-Db0QtNj4.js → flowDiagram-HODETNUW-BNFS2Mkr.js} +1 -1
- package/dist/viewer/assets/ganttDiagram-EL5Y4UJY-DFDsYJNp.js +292 -0
- package/dist/viewer/assets/gitGraphDiagram-WWUBYQGX-BVHabPDp.js +106 -0
- package/dist/viewer/assets/global-loader-XJO9_e0l.js +1 -0
- package/dist/viewer/assets/{globe-Jl6eIZmG.js → globe-CJ35KsQW.js} +1 -1
- package/dist/viewer/assets/gql-FFIj8zdp.js +1 -0
- package/dist/viewer/assets/{grid-scroll-body-CPqSxU6-.js → grid-scroll-body-DC5pYDPJ.js} +2 -2
- package/dist/viewer/assets/iconBase-DtqdW2XR.js +1 -0
- package/dist/viewer/assets/index-B6MxYIzs.js +1 -0
- package/dist/viewer/assets/index-BC5xdBQU.js +48 -0
- package/dist/viewer/assets/index-BIrx3oY4.js +1 -0
- package/dist/viewer/assets/{index-jm22RWpY.js → index-BZGsDmUx.js} +5 -5
- package/dist/viewer/assets/{index-Poftp9f1.js → index-BZXhpoWr.js} +4 -4
- package/dist/viewer/assets/index-Bn2bqqMd.js +1 -0
- package/dist/viewer/assets/{index-HU5pz3kj.js → index-BpCVYTvP.js} +36 -36
- package/dist/viewer/assets/{index-Bt2YHgxl.js → index-CBOYhBKJ.js} +1 -1
- package/dist/viewer/assets/index-CH7cEAxj.js +17 -0
- package/dist/viewer/assets/index-CIf0GId3.js +74 -0
- package/dist/viewer/assets/{index-D7MEHpJf.js → index-Ck66Ic_p.js} +4 -4
- package/dist/viewer/assets/index-Cp9mIQ8F.js +1 -0
- package/dist/viewer/assets/{index-c6Bxcoqm.js → index-DDmBuMKI.js} +1 -1
- package/dist/viewer/assets/{index-BSyJbFDG.js → index-DY3BFyb6.js} +1 -1
- package/dist/viewer/assets/{index-BS94XVnd.js → index-DkzZ-ZvR.js} +1 -1
- package/dist/viewer/assets/{index-C_43VC19.js → index-PglMbhys.js} +1 -1
- package/dist/viewer/assets/infoDiagram-27XIBGKW-CG-wwxBf.js +2 -0
- package/dist/viewer/assets/input--C59pq6j.js +1 -0
- package/dist/viewer/assets/{ishikawaDiagram-5VMMS53U-C4PzFnZ4.js → ishikawaDiagram-5VMMS53U-BlgV7ceJ.js} +2 -2
- package/dist/viewer/assets/{journeyDiagram-3NMN7TZE-Dpn3bBNo.js → journeyDiagram-3NMN7TZE-Cn03_Xl6.js} +2 -2
- package/dist/viewer/assets/{kanban-definition-UXKFOSKX-CJ99H4G6.js → kanban-definition-UXKFOSKX-CJogvDPY.js} +6 -6
- package/dist/viewer/assets/{layout-Bfvxt_D5.js → layout-B26eC4yQ.js} +1 -1
- package/dist/viewer/assets/{lens-run-page-DZneics-.js → lens-run-page-Ba1ppzJt.js} +3 -3
- package/dist/viewer/assets/lens-runs-page-BnUS57LM.js +1 -0
- package/dist/viewer/assets/{link-2-C75goIOt.js → link-2-D1e0xznG.js} +1 -1
- package/dist/viewer/assets/linked-project-dot-BY1gEES9.js +543 -0
- package/dist/viewer/assets/{loader-circle-C5jZoM7X.js → loader-circle-CiqyoJF7.js} +1 -1
- package/dist/viewer/assets/{merge-Cy7YkrN7.js → merge-BhOMvhW1.js} +1 -1
- package/dist/viewer/assets/mermaid.core-BDgZg3kW.js +312 -0
- package/dist/viewer/assets/method-badge-DErZP7y5.js +1 -0
- package/dist/viewer/assets/{mindmap-definition-YA3MSWOX-yQCKA-K4.js → mindmap-definition-YA3MSWOX-DFkLu0ac.js} +2 -2
- package/dist/viewer/assets/nav-links-DZWMpwMR.js +61 -0
- package/dist/viewer/assets/{network-COWNXGMM.js → network-B1apzT1s.js} +1 -1
- package/dist/viewer/assets/{nosql-editor-modal-DTiWkc_r.js → nosql-editor-modal-CvH0SWAi.js} +5 -5
- package/dist/viewer/assets/not-found-page-C-fn8QeM.js +1 -0
- package/dist/viewer/assets/organization-dependency-graph-page-BryP-iJL.js +1 -0
- package/dist/viewer/assets/pegDiagram-XKGWAZYB-g1cM14-L.js +1 -0
- package/dist/viewer/assets/{pieDiagram-E7YTZNPT-DqnkpCX4.js → pieDiagram-E7YTZNPT-WEnDsMY3.js} +2 -2
- package/dist/viewer/assets/{plus-DQakmTjA.js → plus-DbyuOgKB.js} +1 -1
- package/dist/viewer/assets/popover-476u3TN0.js +1 -0
- package/dist/viewer/assets/preload-helper-BlTxHScW.js +1 -0
- package/dist/viewer/assets/{quadrantDiagram-AXDQQJYC-iQjJfars.js → quadrantDiagram-AXDQQJYC-NdfQCpzF.js} +2 -2
- package/dist/viewer/assets/query-D9oj6LGx.js +50 -0
- package/dist/viewer/assets/{quill-rCHj4fCw.js → quill-Cde5JMRD.js} +1 -1
- package/dist/viewer/assets/railroadDiagram-O6MQD6OU-BYhlXlMY.js +1 -0
- package/dist/viewer/assets/{react-BNzYaZuG.js → react-Bx48XWN4.js} +1 -1
- package/dist/viewer/assets/react-flow-wrapper-BcbvHgxz.js +277 -0
- package/dist/viewer/assets/{requirementDiagram-BXWQKSXE-Bv-Vh1dW.js → requirementDiagram-BXWQKSXE-C25Bcm2L.js} +2 -2
- package/dist/viewer/assets/{sankeyDiagram-P5KCCOFB-C__uD07f.js → sankeyDiagram-P5KCCOFB-h8LiCsgk.js} +2 -2
- package/dist/viewer/assets/scroll-area-RagrStGj.js +6 -0
- package/dist/viewer/assets/{search-DW-qhXLk.js → search-vw7ucoOs.js} +1 -1
- package/dist/viewer/assets/section-loader-C4hOfhQS.js +1 -0
- package/dist/viewer/assets/section-not-found-BnrXiPog.js +1 -0
- package/dist/viewer/assets/select-D9fbrr7O.js +1 -0
- package/dist/viewer/assets/{sequenceDiagram-WJ2MYXX4-1RbvcHwO.js → sequenceDiagram-WJ2MYXX4-CDRVvD30.js} +2 -2
- package/dist/viewer/assets/{service-context-C17u_Fw9.js → service-context-D5nBtU18.js} +1 -1
- package/dist/viewer/assets/{service-database-list-page-cYuDHIls.js → service-database-list-page-DBjaDLVy.js} +2 -2
- package/dist/viewer/assets/service-database-page-CenNCgwf.js +2 -0
- package/dist/viewer/assets/service-database-page-inner-gS51TQTZ.js +85 -0
- package/dist/viewer/assets/{service-doc-Dir8g83J.js → service-doc-C-jHqT1U.js} +4 -4
- package/dist/viewer/assets/{service-doc-preview-modal-bJ6tJ5YR.js → service-doc-preview-modal-5sX6FOu1.js} +2 -2
- package/dist/viewer/assets/service-layout-Bf0vZBCH.js +1 -0
- package/dist/viewer/assets/service-pages-CFikvX4t.js +1 -0
- package/dist/viewer/assets/{services-Crqkffr5.js → services-Ivav34WC.js} +4 -4
- package/dist/viewer/assets/{share-2-BmYmqN4k.js → share-2-CQEaWbfH.js} +1 -1
- package/dist/viewer/assets/sizeCapture-INFHLROL-BJ6ndnPM.js +1 -0
- package/dist/viewer/assets/stateDiagram-D77RDMKH-B_tNCX3o.js +1 -0
- package/dist/viewer/assets/stateDiagram-v2-MP3YSRHH-Dl9wqdli.js +1 -0
- package/dist/viewer/assets/{style-DgSU0bQl.js → style-BPesJvJr.js} +8 -8
- package/dist/viewer/assets/super-circle-loader-DSkos6uP.js +1 -0
- package/dist/viewer/assets/super-logo-loader-Cxlbn6MB.js +1 -0
- package/dist/viewer/assets/swimlanes-42K2YHIH-CzURzYwf.js +1 -0
- package/dist/viewer/assets/swimlanesDiagram-VR7AAH4N-DrIlwFtk.js +8 -0
- package/dist/viewer/assets/table-B4pFND-o.js +1 -0
- package/dist/viewer/assets/textarea-Clgdv3Oi.js +1 -0
- package/dist/viewer/assets/{timeline-definition-24CTP7MA-C4yuLwUH.js → timeline-definition-24CTP7MA-D0YXQE1U.js} +2 -2
- package/dist/viewer/assets/ui-graph-logo-gHowu5gP.js +1 -0
- package/dist/viewer/assets/{upload-CRsS43j9.js → upload-CYb3nN_5.js} +1 -1
- package/dist/viewer/assets/{uploads-BOQHX9l4.js → uploads-CX2kdXbM.js} +8 -8
- package/dist/viewer/assets/{use-debounced-value-Ba-kkCUY.js → use-debounced-value-BpNFJd3C.js} +1 -1
- package/dist/viewer/assets/{use-localstorage-DIisTx-J.js → use-localstorage-D233xVb0.js} +1 -1
- package/dist/viewer/assets/use-permissions-BvmxJJ5r.js +1 -0
- package/dist/viewer/assets/{use-scoped-storage-C4RzED-E.js → use-scoped-storage-DL1XVp1j.js} +1 -1
- package/dist/viewer/assets/useMutation-D5ZHwHsx.js +1 -0
- package/dist/viewer/assets/useQuery-Dhe6uxrL.js +1 -0
- package/dist/viewer/assets/{vennDiagram-4TSXK5OY-BCtqXZqe.js → vennDiagram-4TSXK5OY-SSjHlqCQ.js} +2 -2
- package/dist/viewer/assets/{wardleyDiagram-VM6X3IG4-D3OtZJoT.js → wardleyDiagram-VM6X3IG4-CZWNdQxH.js} +2 -2
- package/dist/viewer/assets/{xychartDiagram-S5SC5T6Z-DxLL2CHH.js → xychartDiagram-S5SC5T6Z-B2qAGeb0.js} +2 -2
- package/dist/viewer/assets/zod-BMU4UTQt.js +1 -0
- package/dist/viewer/index.html +10 -1
- package/package.json +57 -57
- package/dist/abort-signals-B4fc3ahg.mjs +0 -34
- package/dist/agents.md +0 -28
- package/dist/anthropic-messages-KPxCHqBN.mjs +0 -14327
- package/dist/auth-storage-BvNH97p9.mjs +0 -2180
- package/dist/azure-openai-config-BbeCSg4y.mjs +0 -55
- package/dist/azure-openai-responses-BRzy8RfL.mjs +0 -182
- package/dist/classifier-shared-DBUHiTGw.mjs +0 -105
- package/dist/cli-2R6QQFp1.mjs +0 -451
- package/dist/cloudflare-workers-ai-system-one-BfqwmRQf.mjs +0 -44
- package/dist/config-D8DMGzIq.mjs +0 -647
- package/dist/cross-spawn-B2jIQPlu.mjs +0 -404
- package/dist/diagnostics-xdSgQR8t.mjs +0 -131
- package/dist/dist-BRyghrKX.mjs +0 -404
- package/dist/dist-D0EzrblG.mjs +0 -12161
- package/dist/dist-EKhnHWHG.mjs +0 -140221
- package/dist/dist-pQtuusFv.mjs +0 -1243
- package/dist/easter-egg-3d-C9_btlWn.mjs +0 -1225
- package/dist/env-api-keys-uytNub6O.mjs +0 -122
- package/dist/error-body-FhmCtR7m.mjs +0 -101
- package/dist/esm-D5isprgl.mjs +0 -1533
- package/dist/esm-DnqE4pfM.mjs +0 -104876
- package/dist/execute-BoTKl80U.mjs +0 -1715
- package/dist/github-copilot-headers-DWcTgoXr.mjs +0 -22
- package/dist/google-generative-ai-Brs5YpJo.mjs +0 -332
- package/dist/google-shared-2CyYa4VE.mjs +0 -33438
- package/dist/google-vertex-DZDUQPKa.mjs +0 -378
- package/dist/hash-DN7ukSfd.mjs +0 -16
- package/dist/headers-GhQHLk-3.mjs +0 -17
- package/dist/jiti-9kWALm4Y.mjs +0 -5439
- package/dist/jiti-loader-f21DrY1K.mjs +0 -27
- package/dist/jiti-static-loader-BI_w28l7.mjs +0 -41704
- package/dist/json-parse-B2mHg7o7.mjs +0 -381
- package/dist/keybinding-hints-D0nLU3ZH.mjs +0 -17899
- package/dist/lib-Dj1gKQJc.mjs +0 -24379
- package/dist/llama-cpp-classify-C73BoMYd.mjs +0 -344
- package/dist/mistral-conversations-DXVR7znL.mjs +0 -698
- package/dist/models-DBdii9gQ.mjs +0 -1255
- package/dist/multipart-parser-DLw9Z0uJ.mjs +0 -298
- package/dist/node-B0NU8X55.mjs +0 -2479
- package/dist/node-B8gaKm9g.mjs +0 -23
- package/dist/openai-I3_AqKDX.mjs +0 -17357
- package/dist/openai-codex-responses-PcZHDuBD.mjs +0 -1198
- package/dist/openai-completions-a_mH01ii.mjs +0 -994
- package/dist/openai-decisions-Du8y4mQG.mjs +0 -142
- package/dist/openai-prompt-cache-Bc6qNWt0.mjs +0 -8
- package/dist/openai-responses-a9lV_U7O.mjs +0 -270
- package/dist/openai-responses-shared-CDs_PBiH.mjs +0 -598
- package/dist/openrouter-images-D0Zc8Cjs.mjs +0 -125
- package/dist/photon_rs-DCvMOMu0.mjs +0 -4252
- package/dist/pi-messages-B5ietIBq.mjs +0 -306
- package/dist/plan-prompt.md +0 -56
- package/dist/prompt.md +0 -44
- package/dist/provider-env-BJhgA66g.mjs +0 -37
- package/dist/provider-retry-DXYM7rVE.mjs +0 -79
- package/dist/runtime-DTkBxiaM.mjs +0 -2822
- package/dist/sanitize-unicode-CqChtoM6.mjs +0 -26
- package/dist/shell-836_JFnI.mjs +0 -162
- package/dist/source-CKPndhKl.mjs +0 -478
- package/dist/src-DNm2QRm3.mjs +0 -5028
- package/dist/system-one-shared-DUAFtNa8.mjs +0 -75
- package/dist/token-DEUkymby.mjs +0 -56
- package/dist/token-util-Cx5S4eKt.mjs +0 -3
- package/dist/tool-DHDYqsyG.mjs +0 -6673
- package/dist/transform-messages-BClk99Vn.mjs +0 -477
- package/dist/typesafe-system-one-D2d8j8hZ.mjs +0 -24
- package/dist/typescript-Br-vsRJV.mjs +0 -6737
- package/dist/uuid-CNCZqNBb.mjs +0 -49
- package/dist/v2-1z8ijsD3.mjs +0 -6120
- package/dist/viewer/assets/abnfDiagram-VCTEODGH-j5YaKnl9.js +0 -1
- package/dist/viewer/assets/actor-avatar-DqmoY8Xc.js +0 -1
- package/dist/viewer/assets/architectureDiagram-5GKGNRK7-D80cJKz_.js +0 -36
- package/dist/viewer/assets/avatar-BI7D-Aia.js +0 -43
- package/dist/viewer/assets/badge-870-A4Y6.js +0 -1
- package/dist/viewer/assets/better-delete-confirmation-modal-Dib31LVb.js +0 -1
- package/dist/viewer/assets/better-dialog-D3AAiahr.js +0 -1
- package/dist/viewer/assets/button-DadqadpO.js +0 -1
- package/dist/viewer/assets/channel-DRkt3LIn.js +0 -1
- package/dist/viewer/assets/checkbox-BXpR079x.js +0 -1
- package/dist/viewer/assets/classDiagram-ZZMXUADV-G5CebNaC.js +0 -1
- package/dist/viewer/assets/classDiagram-v2-VYDZK3BY-G5CebNaC.js +0 -1
- package/dist/viewer/assets/color-input-Efm-lxDy.js +0 -11
- package/dist/viewer/assets/cose-bilkent-JH36ORCC-CrSHFmnp.js +0 -1
- package/dist/viewer/assets/cross-button-5Sr5rWVP.js +0 -1
- package/dist/viewer/assets/cynefinDiagram-5FMLGOSQ-Bdl_eBdu.js +0 -62
- package/dist/viewer/assets/dashboard-diagrams-page-DMupOe1m.js +0 -2
- package/dist/viewer/assets/dashboard-diagrams-page-inner-Dh0yKh2A.js +0 -1
- package/dist/viewer/assets/dashboard-docs-page-DWJ1qOQz.js +0 -2
- package/dist/viewer/assets/dashboard-docs-page-inner-Fs6G3oGo.js +0 -67
- package/dist/viewer/assets/dashboard-layout-D36InAaB.js +0 -1
- package/dist/viewer/assets/dashboard-lens-layout-Cv1Xx3hY.js +0 -1
- package/dist/viewer/assets/dashboard-map-frame-page-CTn61NUO.js +0 -1
- package/dist/viewer/assets/dashboard-plans-page-DxFJkrgK.js +0 -1
- package/dist/viewer/assets/dashboard-service-apis-BHtD9s5z.js +0 -1
- package/dist/viewer/assets/dashboard-service-docs-Uv_1uxxO.js +0 -1
- package/dist/viewer/assets/dashboard-services-CUP-L4Jg.js +0 -1
- package/dist/viewer/assets/diagram-UQ7AKVKN-DhFcurW6.js +0 -41
- package/dist/viewer/assets/diagram-VX7I27RA-DE1nREE8.js +0 -24
- package/dist/viewer/assets/diagram-Z3DM3KII-CSrYcCbc.js +0 -24
- package/dist/viewer/assets/diagram-live-preview-i5doxXLH.js +0 -2
- package/dist/viewer/assets/dialog-D_HtNS17.js +0 -6
- package/dist/viewer/assets/ebnfDiagram-PWID7BFC-BfL8m_sf.js +0 -1
- package/dist/viewer/assets/flow-diagram-preview-T0Z4iMVU.js +0 -1
- package/dist/viewer/assets/ganttDiagram-EL5Y4UJY-CsITpniw.js +0 -292
- package/dist/viewer/assets/gitGraphDiagram-WWUBYQGX-B4eCBGoe.js +0 -106
- package/dist/viewer/assets/iconBase-BoDZfJgC.js +0 -1
- package/dist/viewer/assets/index-5E1tJ7yK.js +0 -125
- package/dist/viewer/assets/index-7XpV2DRw.js +0 -1
- package/dist/viewer/assets/index-C0Rs3s9Z.js +0 -1
- package/dist/viewer/assets/index-CzHjJWeV.js +0 -1
- package/dist/viewer/assets/index-DcEA6SIV.js +0 -74
- package/dist/viewer/assets/infoDiagram-27XIBGKW-lTebN5Ix.js +0 -2
- package/dist/viewer/assets/input-YvHTVS0E.js +0 -1
- package/dist/viewer/assets/lens-runs-page-DoAOObxx.js +0 -1
- package/dist/viewer/assets/linked-project-dot-Ds2uEmJ9.js +0 -543
- package/dist/viewer/assets/mermaid.core-BCRBv8Us.js +0 -312
- package/dist/viewer/assets/method-badge-DMYDKdDZ.js +0 -1
- package/dist/viewer/assets/nav-links-8vT2ixiI.js +0 -61
- package/dist/viewer/assets/not-found-page-CnfLlhS4.js +0 -1
- package/dist/viewer/assets/organization-dependency-graph-page-3xqIxjNx.js +0 -1
- package/dist/viewer/assets/pegDiagram-XKGWAZYB-CMXqeAum.js +0 -1
- package/dist/viewer/assets/popover-CN9ni1N3.js +0 -1
- package/dist/viewer/assets/railroadDiagram-O6MQD6OU-CfqToX3W.js +0 -1
- package/dist/viewer/assets/react-flow-wrapper-BPlRstyO.js +0 -276
- package/dist/viewer/assets/scroll-area-BodE-n7W.js +0 -6
- package/dist/viewer/assets/section-loader-BzpYM_Nx.js +0 -1
- package/dist/viewer/assets/select-DDtnmSET.js +0 -1
- package/dist/viewer/assets/service-database-page-CMi1wF4h.js +0 -2
- package/dist/viewer/assets/service-database-page-inner-CoqAj93L.js +0 -85
- package/dist/viewer/assets/service-layout-0NMm_bKG.js +0 -1
- package/dist/viewer/assets/service-pages-dfnc91SU.js +0 -1
- package/dist/viewer/assets/sizeCapture-INFHLROL-BRJi3gCg.js +0 -1
- package/dist/viewer/assets/stateDiagram-D77RDMKH-DdLsfxgy.js +0 -1
- package/dist/viewer/assets/stateDiagram-v2-MP3YSRHH-DFwg8Qki.js +0 -1
- package/dist/viewer/assets/super-circle-loader-D8MElOMh.js +0 -1
- package/dist/viewer/assets/super-logo-loader-DJYiRbCS.js +0 -1
- package/dist/viewer/assets/swimlanes-42K2YHIH-AuYjrPqh.js +0 -1
- package/dist/viewer/assets/swimlanesDiagram-VR7AAH4N-0nIGA8_4.js +0 -8
- package/dist/viewer/assets/table-Bi4Auk9Z.js +0 -1
- package/dist/viewer/assets/textarea-MgxZ5x6-.js +0 -1
- package/dist/viewer/assets/ui-graph-logo-D4jRhd4z.js +0 -1
- package/dist/viewer/assets/use-permissions-6JVET753.js +0 -1
- package/dist/viewer/assets/useMutation-CmVaR9zz.js +0 -1
- package/dist/viewer/assets/useQuery-B8yYhO0c.js +0 -1
- package/dist/viewer/assets/zod-Dc4H6VVJ.js +0 -1
- package/dist/virtual-modules-DnCx0Gdx.mjs +0 -340
|
@@ -1,698 +0,0 @@
|
|
|
1
|
-
import { a as AssistantMessageEventStream } from "./diagnostics-xdSgQR8t.mjs";
|
|
2
|
-
import { E as renderSystemMessageUpdate, T as getSystemMessageText, b as resolveTranscript, n as clampThinkingLevel, p as getCurrentTools, t as calculateCost } from "./models-DBdii9gQ.mjs";
|
|
3
|
-
import { t as headersToRecord } from "./headers-GhQHLk-3.mjs";
|
|
4
|
-
import { n as parseStreamingJson } from "./json-parse-B2mHg7o7.mjs";
|
|
5
|
-
import { d as getJsonSchemaToolParameters, m as getPiUserAgent, p as resolveJsonSchemaStrictSampling, r as buildBaseOptions, t as transformMessages } from "./transform-messages-BClk99Vn.mjs";
|
|
6
|
-
import { t as sanitizeSurrogates } from "./sanitize-unicode-CqChtoM6.mjs";
|
|
7
|
-
import { t as shortHash } from "./hash-DN7ukSfd.mjs";
|
|
8
|
-
import { t as combineAbortSignals } from "./abort-signals-B4fc3ahg.mjs";
|
|
9
|
-
//#region node_modules/.pnpm/@earendil-works+pi-ai@1.2.0_@aws-sdk+credential-provider-node@3.972.86_@modelcontextpro_dcf109e705e96235bfb9a180457030de/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js
|
|
10
|
-
const MISTRAL_TOOL_CALL_ID_LENGTH = 9;
|
|
11
|
-
const MAX_MISTRAL_ERROR_BODY_CHARS = 4e3;
|
|
12
|
-
/**
|
|
13
|
-
* Stream responses from the native Mistral Chat Completions endpoint.
|
|
14
|
-
*/
|
|
15
|
-
const stream = (model, context, options) => {
|
|
16
|
-
const stream = new AssistantMessageEventStream();
|
|
17
|
-
const normalizedContext = resolveTranscript(context, model.compat?.supportsMidConvoSystemMessages);
|
|
18
|
-
(async () => {
|
|
19
|
-
const output = createOutput(model);
|
|
20
|
-
try {
|
|
21
|
-
const apiKey = options?.apiKey;
|
|
22
|
-
if (!apiKey) throw new Error(`No API key for provider: ${model.provider}`);
|
|
23
|
-
const normalizeMistralToolCallId = createMistralToolCallIdNormalizer();
|
|
24
|
-
const transformedMessages = transformMessages(normalizedContext.messages, model, (id) => normalizeMistralToolCallId(id));
|
|
25
|
-
let payload = buildChatPayload(model, normalizedContext, transformedMessages, options);
|
|
26
|
-
const nextPayload = await options?.onPayload?.(payload, model);
|
|
27
|
-
if (nextPayload !== void 0) payload = nextPayload;
|
|
28
|
-
const mistralStream = await requestMistralStream(model, payload, apiKey, options);
|
|
29
|
-
stream.push({
|
|
30
|
-
type: "start",
|
|
31
|
-
partial: output
|
|
32
|
-
});
|
|
33
|
-
await consumeChatStream(model, output, stream, mistralStream, options?.onProviderStreamEvent);
|
|
34
|
-
if (options?.signal?.aborted) throw new Error("Request was aborted");
|
|
35
|
-
if (output.stopReason === "pending") throw new Error("Mistral stream ended without a finish reason");
|
|
36
|
-
if (output.stopReason === "aborted" || output.stopReason === "error") throw new Error(output.errorMessage || "An unknown error occurred");
|
|
37
|
-
stream.push({
|
|
38
|
-
type: "done",
|
|
39
|
-
reason: output.stopReason,
|
|
40
|
-
message: output
|
|
41
|
-
});
|
|
42
|
-
stream.end();
|
|
43
|
-
} catch (error) {
|
|
44
|
-
for (const block of output.content) delete block.partialArgs;
|
|
45
|
-
output.stopReason = options?.signal?.aborted ? "aborted" : "error";
|
|
46
|
-
output.errorMessage = formatMistralError(error);
|
|
47
|
-
stream.push({
|
|
48
|
-
type: "error",
|
|
49
|
-
reason: output.stopReason,
|
|
50
|
-
error: output
|
|
51
|
-
});
|
|
52
|
-
stream.end();
|
|
53
|
-
}
|
|
54
|
-
})();
|
|
55
|
-
return stream;
|
|
56
|
-
};
|
|
57
|
-
/**
|
|
58
|
-
* Maps provider-agnostic `SimpleStreamOptions` to Mistral options.
|
|
59
|
-
*/
|
|
60
|
-
const streamSimple = (model, context, options) => {
|
|
61
|
-
const apiKey = options?.apiKey;
|
|
62
|
-
if (!apiKey) throw new Error(`No API key for provider: ${model.provider}`);
|
|
63
|
-
const base = {
|
|
64
|
-
...buildBaseOptions(model, context, options, apiKey),
|
|
65
|
-
toolChoice: options?.toolChoice
|
|
66
|
-
};
|
|
67
|
-
const clampedReasoning = options?.reasoning ? clampThinkingLevel(model, options.reasoning) : void 0;
|
|
68
|
-
const reasoning = clampedReasoning === "off" ? void 0 : clampedReasoning;
|
|
69
|
-
const effortMap = model.reasoning ? model.thinkingLevelMap : void 0;
|
|
70
|
-
const reasoningEffort = effortMap ? reasoning ? effortMap[reasoning] ?? "high" : effortMap.off ?? void 0 : void 0;
|
|
71
|
-
return stream(model, context, {
|
|
72
|
-
...base,
|
|
73
|
-
promptMode: model.reasoning && !effortMap && reasoning ? "reasoning" : void 0,
|
|
74
|
-
reasoningEffort
|
|
75
|
-
});
|
|
76
|
-
};
|
|
77
|
-
function createOutput(model) {
|
|
78
|
-
return {
|
|
79
|
-
role: "assistant",
|
|
80
|
-
content: [],
|
|
81
|
-
api: model.api,
|
|
82
|
-
provider: model.provider,
|
|
83
|
-
model: model.id,
|
|
84
|
-
usage: {
|
|
85
|
-
input: 0,
|
|
86
|
-
output: 0,
|
|
87
|
-
cacheRead: 0,
|
|
88
|
-
cacheWrite: 0,
|
|
89
|
-
totalTokens: 0,
|
|
90
|
-
cost: {
|
|
91
|
-
input: 0,
|
|
92
|
-
output: 0,
|
|
93
|
-
cacheRead: 0,
|
|
94
|
-
cacheWrite: 0,
|
|
95
|
-
total: 0
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
stopReason: "pending",
|
|
99
|
-
timestamp: Date.now()
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
function createMistralToolCallIdNormalizer() {
|
|
103
|
-
const idMap = /* @__PURE__ */ new Map();
|
|
104
|
-
const reverseMap = /* @__PURE__ */ new Map();
|
|
105
|
-
return (id) => {
|
|
106
|
-
const existing = idMap.get(id);
|
|
107
|
-
if (existing) return existing;
|
|
108
|
-
let attempt = 0;
|
|
109
|
-
while (true) {
|
|
110
|
-
const candidate = deriveMistralToolCallId(id, attempt);
|
|
111
|
-
const owner = reverseMap.get(candidate);
|
|
112
|
-
if (!owner || owner === id) {
|
|
113
|
-
idMap.set(id, candidate);
|
|
114
|
-
reverseMap.set(candidate, id);
|
|
115
|
-
return candidate;
|
|
116
|
-
}
|
|
117
|
-
attempt++;
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
function deriveMistralToolCallId(id, attempt) {
|
|
122
|
-
const normalized = id.replace(/[^a-zA-Z0-9]/g, "");
|
|
123
|
-
if (attempt === 0 && normalized.length === MISTRAL_TOOL_CALL_ID_LENGTH) return normalized;
|
|
124
|
-
const seedBase = normalized || id;
|
|
125
|
-
const seed = attempt === 0 ? seedBase : `${seedBase}:${attempt}`;
|
|
126
|
-
return shortHash(seed).replace(/[^a-zA-Z0-9]/g, "").slice(0, MISTRAL_TOOL_CALL_ID_LENGTH);
|
|
127
|
-
}
|
|
128
|
-
function formatMistralError(error) {
|
|
129
|
-
if (error instanceof Error) {
|
|
130
|
-
const httpError = error;
|
|
131
|
-
const statusCode = typeof httpError.statusCode === "number" ? httpError.statusCode : void 0;
|
|
132
|
-
const bodyText = typeof httpError.body === "string" ? httpError.body.trim() : void 0;
|
|
133
|
-
if (statusCode !== void 0 && bodyText) return `Mistral API error (${statusCode}): ${truncateErrorText(bodyText, MAX_MISTRAL_ERROR_BODY_CHARS)}`;
|
|
134
|
-
if (statusCode !== void 0) return `Mistral API error (${statusCode}): ${error.message}`;
|
|
135
|
-
return error.message;
|
|
136
|
-
}
|
|
137
|
-
return safeJsonStringify(error);
|
|
138
|
-
}
|
|
139
|
-
function truncateErrorText(text, maxChars) {
|
|
140
|
-
if (text.length <= maxChars) return text;
|
|
141
|
-
return `${text.slice(0, maxChars)}... [truncated ${text.length - maxChars} chars]`;
|
|
142
|
-
}
|
|
143
|
-
function safeJsonStringify(value) {
|
|
144
|
-
try {
|
|
145
|
-
const serialized = JSON.stringify(value);
|
|
146
|
-
return serialized === void 0 ? String(value) : serialized;
|
|
147
|
-
} catch {
|
|
148
|
-
return String(value);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
async function requestMistralStream(model, payload, apiKey, options) {
|
|
152
|
-
const baseUrl = new URL(model.baseUrl);
|
|
153
|
-
baseUrl.pathname = `${baseUrl.pathname.replace(/\/+$/u, "")}/`;
|
|
154
|
-
const url = new URL("v1/chat/completions", baseUrl);
|
|
155
|
-
const headers = buildMistralHeaders(model, apiKey, options);
|
|
156
|
-
const timeoutMs = options?.timeoutMs ?? 6e4;
|
|
157
|
-
const headerTimeoutSignal = AbortSignal.timeout(timeoutMs);
|
|
158
|
-
const combinedSignal = combineAbortSignals([options?.signal, headerTimeoutSignal]);
|
|
159
|
-
let response;
|
|
160
|
-
try {
|
|
161
|
-
response = await (options?.fetch ?? globalThis.fetch)(url, {
|
|
162
|
-
method: "POST",
|
|
163
|
-
headers,
|
|
164
|
-
body: JSON.stringify(toMistralWirePayload(payload)),
|
|
165
|
-
signal: combinedSignal.signal
|
|
166
|
-
});
|
|
167
|
-
} catch (error) {
|
|
168
|
-
if (headerTimeoutSignal.aborted && !options?.signal?.aborted) throw new Error(`Mistral response headers timed out after ${timeoutMs}ms`);
|
|
169
|
-
throw error;
|
|
170
|
-
} finally {
|
|
171
|
-
combinedSignal.cleanup();
|
|
172
|
-
}
|
|
173
|
-
await options?.onResponse?.({
|
|
174
|
-
status: response.status,
|
|
175
|
-
headers: headersToRecord(response.headers)
|
|
176
|
-
}, model);
|
|
177
|
-
if (!response.ok) {
|
|
178
|
-
const body = await response.text();
|
|
179
|
-
throw new MistralHttpError(response.status, body, response.statusText);
|
|
180
|
-
}
|
|
181
|
-
if (!response.body) throw new Error("Mistral response has no body");
|
|
182
|
-
return readMistralEvents(response.body, options?.signal);
|
|
183
|
-
}
|
|
184
|
-
var MistralHttpError = class extends Error {
|
|
185
|
-
statusCode;
|
|
186
|
-
body;
|
|
187
|
-
constructor(statusCode, body, statusText) {
|
|
188
|
-
super(statusText || `Request failed with status ${statusCode}`);
|
|
189
|
-
this.name = "MistralHttpError";
|
|
190
|
-
this.statusCode = statusCode;
|
|
191
|
-
this.body = body;
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
function buildMistralHeaders(model, apiKey, options) {
|
|
195
|
-
const headers = new Headers({
|
|
196
|
-
"User-Agent": getPiUserAgent(),
|
|
197
|
-
accept: "text/event-stream",
|
|
198
|
-
authorization: `Bearer ${apiKey}`,
|
|
199
|
-
"content-type": "application/json"
|
|
200
|
-
});
|
|
201
|
-
applyMistralHeaderOverrides(headers, model.headers);
|
|
202
|
-
applyMistralHeaderOverrides(headers, options?.headers);
|
|
203
|
-
const hasExplicitAffinity = hasMistralHeaderOverride(model.headers, "x-affinity") || hasMistralHeaderOverride(options?.headers, "x-affinity");
|
|
204
|
-
if (shouldUsePromptCaching(options) && !hasExplicitAffinity) headers.set("x-affinity", options.sessionId);
|
|
205
|
-
return headers;
|
|
206
|
-
}
|
|
207
|
-
function applyMistralHeaderOverrides(headers, overrides) {
|
|
208
|
-
if (!overrides) return;
|
|
209
|
-
for (const [name, value] of Object.entries(overrides)) if (value === null) headers.delete(name);
|
|
210
|
-
else headers.set(name, value);
|
|
211
|
-
}
|
|
212
|
-
function hasMistralHeaderOverride(overrides, target) {
|
|
213
|
-
return !!overrides && Object.keys(overrides).some((name) => name.toLowerCase() === target);
|
|
214
|
-
}
|
|
215
|
-
function toMistralWirePayload(payload) {
|
|
216
|
-
const wirePayload = { ...payload };
|
|
217
|
-
for (const [source, target] of [
|
|
218
|
-
["topP", "top_p"],
|
|
219
|
-
["maxTokens", "max_tokens"],
|
|
220
|
-
["randomSeed", "random_seed"],
|
|
221
|
-
["responseFormat", "response_format"],
|
|
222
|
-
["toolChoice", "tool_choice"],
|
|
223
|
-
["presencePenalty", "presence_penalty"],
|
|
224
|
-
["frequencyPenalty", "frequency_penalty"],
|
|
225
|
-
["parallelToolCalls", "parallel_tool_calls"],
|
|
226
|
-
["reasoningEffort", "reasoning_effort"],
|
|
227
|
-
["promptMode", "prompt_mode"],
|
|
228
|
-
["promptCacheKey", "prompt_cache_key"],
|
|
229
|
-
["safePrompt", "safe_prompt"]
|
|
230
|
-
]) remapMistralProperty(wirePayload, source, target);
|
|
231
|
-
wirePayload.messages = payload.messages.map((message) => toMistralWireMessage(message));
|
|
232
|
-
const responseFormat = wirePayload.response_format;
|
|
233
|
-
if (isMistralRecord(responseFormat)) {
|
|
234
|
-
const wireResponseFormat = { ...responseFormat };
|
|
235
|
-
remapMistralProperty(wireResponseFormat, "jsonSchema", "json_schema");
|
|
236
|
-
const jsonSchema = wireResponseFormat.json_schema;
|
|
237
|
-
if (isMistralRecord(jsonSchema)) {
|
|
238
|
-
const wireJsonSchema = { ...jsonSchema };
|
|
239
|
-
remapMistralProperty(wireJsonSchema, "schemaDefinition", "schema");
|
|
240
|
-
wireResponseFormat.json_schema = wireJsonSchema;
|
|
241
|
-
}
|
|
242
|
-
wirePayload.response_format = wireResponseFormat;
|
|
243
|
-
}
|
|
244
|
-
return wirePayload;
|
|
245
|
-
}
|
|
246
|
-
function toMistralWireMessage(message) {
|
|
247
|
-
const wireMessage = { ...message };
|
|
248
|
-
remapMistralProperty(wireMessage, "toolCalls", "tool_calls");
|
|
249
|
-
remapMistralProperty(wireMessage, "toolCallId", "tool_call_id");
|
|
250
|
-
if (Array.isArray(message.content)) wireMessage.content = message.content.map((chunk) => toMistralWireContentChunk(chunk));
|
|
251
|
-
return wireMessage;
|
|
252
|
-
}
|
|
253
|
-
function toMistralWireContentChunk(chunk) {
|
|
254
|
-
const wireChunk = { ...chunk };
|
|
255
|
-
for (const [source, target] of [
|
|
256
|
-
["imageUrl", "image_url"],
|
|
257
|
-
["documentUrl", "document_url"],
|
|
258
|
-
["documentName", "document_name"],
|
|
259
|
-
["fileId", "file_id"],
|
|
260
|
-
["referenceIds", "reference_ids"],
|
|
261
|
-
["inputAudio", "input_audio"]
|
|
262
|
-
]) remapMistralProperty(wireChunk, source, target);
|
|
263
|
-
return wireChunk;
|
|
264
|
-
}
|
|
265
|
-
function remapMistralProperty(record, source, target) {
|
|
266
|
-
if (!(source in record)) return;
|
|
267
|
-
record[target] = record[source];
|
|
268
|
-
delete record[source];
|
|
269
|
-
}
|
|
270
|
-
function isMistralRecord(value) {
|
|
271
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
272
|
-
}
|
|
273
|
-
const MISTRAL_STREAM_DONE = Symbol("mistral-stream-done");
|
|
274
|
-
async function* readMistralEvents(body, signal) {
|
|
275
|
-
const reader = body.getReader();
|
|
276
|
-
const decoder = new TextDecoder();
|
|
277
|
-
let buffer = "";
|
|
278
|
-
const onAbort = () => {
|
|
279
|
-
reader.cancel().catch(() => {});
|
|
280
|
-
};
|
|
281
|
-
signal?.addEventListener("abort", onAbort, { once: true });
|
|
282
|
-
try {
|
|
283
|
-
while (true) {
|
|
284
|
-
if (signal?.aborted) throw signal.reason;
|
|
285
|
-
const { done, value } = await reader.read();
|
|
286
|
-
if (signal?.aborted) throw signal.reason;
|
|
287
|
-
buffer += done ? decoder.decode() : decoder.decode(value, { stream: true });
|
|
288
|
-
let boundary = findMistralEventBoundary(buffer);
|
|
289
|
-
while (boundary) {
|
|
290
|
-
const event = parseMistralEvent(buffer.slice(0, boundary.index));
|
|
291
|
-
buffer = buffer.slice(boundary.index + boundary.length);
|
|
292
|
-
if (event === MISTRAL_STREAM_DONE) return;
|
|
293
|
-
if (event) yield event;
|
|
294
|
-
boundary = findMistralEventBoundary(buffer);
|
|
295
|
-
}
|
|
296
|
-
if (done) break;
|
|
297
|
-
}
|
|
298
|
-
if (buffer.trim()) {
|
|
299
|
-
const event = parseMistralEvent(buffer);
|
|
300
|
-
if (event !== MISTRAL_STREAM_DONE && event) yield event;
|
|
301
|
-
}
|
|
302
|
-
} finally {
|
|
303
|
-
signal?.removeEventListener("abort", onAbort);
|
|
304
|
-
try {
|
|
305
|
-
await reader.cancel();
|
|
306
|
-
} catch {}
|
|
307
|
-
try {
|
|
308
|
-
reader.releaseLock();
|
|
309
|
-
} catch {}
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
function findMistralEventBoundary(buffer) {
|
|
313
|
-
const match = /\r\n\r\n|\r\n\r|\r\n\n|\r\r\n|\n\r\n|\r\r|\n\r|\n\n/u.exec(buffer);
|
|
314
|
-
return match?.index === void 0 ? void 0 : {
|
|
315
|
-
index: match.index,
|
|
316
|
-
length: match[0].length
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
|
-
function parseMistralEvent(raw) {
|
|
320
|
-
const data = raw.split(/\r\n|\r|\n/u).filter((line) => line.startsWith("data:")).map((line) => line.slice(5).trimStart()).join("\n").trim();
|
|
321
|
-
if (!data) return void 0;
|
|
322
|
-
if (data === "[DONE]") return MISTRAL_STREAM_DONE;
|
|
323
|
-
const parsed = JSON.parse(data);
|
|
324
|
-
if (!isMistralRecord(parsed) || !Array.isArray(parsed.choices)) throw new Error("Invalid Mistral streaming event");
|
|
325
|
-
return { data: parsed };
|
|
326
|
-
}
|
|
327
|
-
function buildChatPayload(model, context, messages, options) {
|
|
328
|
-
const payload = {
|
|
329
|
-
model: model.id,
|
|
330
|
-
stream: true,
|
|
331
|
-
messages: toChatMessages(messages, model.input.includes("image"))
|
|
332
|
-
};
|
|
333
|
-
const currentTools = getCurrentTools(context.messages);
|
|
334
|
-
if (currentTools.length > 0) payload.tools = toFunctionTools(currentTools);
|
|
335
|
-
if (options?.temperature !== void 0) payload.temperature = options.temperature;
|
|
336
|
-
if (options?.maxTokens !== void 0) payload.maxTokens = options.maxTokens;
|
|
337
|
-
if (options?.toolChoice) payload.toolChoice = mapToolChoice(options.toolChoice);
|
|
338
|
-
if (options?.promptMode) payload.promptMode = options.promptMode;
|
|
339
|
-
if (options?.reasoningEffort) payload.reasoningEffort = options.reasoningEffort;
|
|
340
|
-
if (shouldUsePromptCaching(options)) payload.promptCacheKey = options.sessionId;
|
|
341
|
-
return payload;
|
|
342
|
-
}
|
|
343
|
-
function shouldUsePromptCaching(options) {
|
|
344
|
-
return options?.cacheRetention !== "none" && !!options?.sessionId;
|
|
345
|
-
}
|
|
346
|
-
function getMistralCachedPromptTokens(usage, promptTokens) {
|
|
347
|
-
const rawUsage = usage;
|
|
348
|
-
const rawCachedTokens = rawUsage.promptTokensDetails?.cachedTokens ?? rawUsage.prompt_tokens_details?.cached_tokens ?? rawUsage.promptTokenDetails?.cachedTokens ?? rawUsage.prompt_token_details?.cached_tokens ?? rawUsage.numCachedTokens ?? rawUsage.num_cached_tokens ?? 0;
|
|
349
|
-
return Math.min(promptTokens, Math.max(0, typeof rawCachedTokens === "number" && Number.isFinite(rawCachedTokens) ? rawCachedTokens : 0));
|
|
350
|
-
}
|
|
351
|
-
async function consumeChatStream(model, output, stream, mistralStream, onProviderStreamEvent) {
|
|
352
|
-
let currentBlock = null;
|
|
353
|
-
const blocks = output.content;
|
|
354
|
-
const blockIndex = () => blocks.length - 1;
|
|
355
|
-
const toolBlocksByKey = /* @__PURE__ */ new Map();
|
|
356
|
-
const finishCurrentBlock = (block) => {
|
|
357
|
-
if (!block) return;
|
|
358
|
-
if (block.type === "text") {
|
|
359
|
-
stream.push({
|
|
360
|
-
type: "text_end",
|
|
361
|
-
contentIndex: blockIndex(),
|
|
362
|
-
content: block.text,
|
|
363
|
-
partial: output
|
|
364
|
-
});
|
|
365
|
-
return;
|
|
366
|
-
}
|
|
367
|
-
if (block.type === "thinking") stream.push({
|
|
368
|
-
type: "thinking_end",
|
|
369
|
-
contentIndex: blockIndex(),
|
|
370
|
-
content: block.thinking,
|
|
371
|
-
partial: output
|
|
372
|
-
});
|
|
373
|
-
};
|
|
374
|
-
for await (const event of mistralStream) {
|
|
375
|
-
const chunk = event.data;
|
|
376
|
-
await onProviderStreamEvent?.(chunk, model);
|
|
377
|
-
output.responseId ||= chunk.id;
|
|
378
|
-
if (chunk.usage) {
|
|
379
|
-
const promptTokens = chunk.usage.prompt_tokens || 0;
|
|
380
|
-
const cachedPromptTokens = getMistralCachedPromptTokens(chunk.usage, promptTokens);
|
|
381
|
-
output.usage.input = Math.max(0, promptTokens - cachedPromptTokens);
|
|
382
|
-
output.usage.output = chunk.usage.completion_tokens || 0;
|
|
383
|
-
output.usage.cacheRead = cachedPromptTokens;
|
|
384
|
-
output.usage.cacheWrite = 0;
|
|
385
|
-
output.usage.totalTokens = chunk.usage.total_tokens || output.usage.input + output.usage.output + output.usage.cacheRead + output.usage.cacheWrite;
|
|
386
|
-
calculateCost(model, output.usage);
|
|
387
|
-
}
|
|
388
|
-
const choice = chunk.choices[0];
|
|
389
|
-
if (!choice) continue;
|
|
390
|
-
if (choice.finish_reason) {
|
|
391
|
-
output.rawStopReason = choice.finish_reason;
|
|
392
|
-
const stopReasonResult = mapChatStopReason(choice.finish_reason);
|
|
393
|
-
output.stopReason = stopReasonResult.stopReason;
|
|
394
|
-
if (stopReasonResult.errorMessage) output.errorMessage = stopReasonResult.errorMessage;
|
|
395
|
-
}
|
|
396
|
-
const delta = choice.delta;
|
|
397
|
-
if (delta.content !== null && delta.content !== void 0) {
|
|
398
|
-
const contentItems = typeof delta.content === "string" ? [delta.content] : delta.content;
|
|
399
|
-
for (const item of contentItems) {
|
|
400
|
-
if (typeof item === "string") {
|
|
401
|
-
const textDelta = sanitizeSurrogates(item);
|
|
402
|
-
if (!textDelta) continue;
|
|
403
|
-
if (!currentBlock || currentBlock.type !== "text") {
|
|
404
|
-
finishCurrentBlock(currentBlock);
|
|
405
|
-
currentBlock = {
|
|
406
|
-
type: "text",
|
|
407
|
-
text: ""
|
|
408
|
-
};
|
|
409
|
-
output.content.push(currentBlock);
|
|
410
|
-
stream.push({
|
|
411
|
-
type: "text_start",
|
|
412
|
-
contentIndex: blockIndex(),
|
|
413
|
-
partial: output
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
currentBlock.text += textDelta;
|
|
417
|
-
stream.push({
|
|
418
|
-
type: "text_delta",
|
|
419
|
-
contentIndex: blockIndex(),
|
|
420
|
-
delta: textDelta,
|
|
421
|
-
partial: output
|
|
422
|
-
});
|
|
423
|
-
continue;
|
|
424
|
-
}
|
|
425
|
-
if (item.type === "thinking") {
|
|
426
|
-
const deltaText = (item.thinking ?? []).map((part) => part.text ?? "").filter((text) => text.length > 0).join("");
|
|
427
|
-
const thinkingDelta = sanitizeSurrogates(deltaText);
|
|
428
|
-
if (!thinkingDelta) continue;
|
|
429
|
-
if (!currentBlock || currentBlock.type !== "thinking") {
|
|
430
|
-
finishCurrentBlock(currentBlock);
|
|
431
|
-
currentBlock = {
|
|
432
|
-
type: "thinking",
|
|
433
|
-
thinking: ""
|
|
434
|
-
};
|
|
435
|
-
output.content.push(currentBlock);
|
|
436
|
-
stream.push({
|
|
437
|
-
type: "thinking_start",
|
|
438
|
-
contentIndex: blockIndex(),
|
|
439
|
-
partial: output
|
|
440
|
-
});
|
|
441
|
-
}
|
|
442
|
-
currentBlock.thinking += thinkingDelta;
|
|
443
|
-
stream.push({
|
|
444
|
-
type: "thinking_delta",
|
|
445
|
-
contentIndex: blockIndex(),
|
|
446
|
-
delta: thinkingDelta,
|
|
447
|
-
partial: output
|
|
448
|
-
});
|
|
449
|
-
continue;
|
|
450
|
-
}
|
|
451
|
-
if (item.type === "text") {
|
|
452
|
-
const textDelta = sanitizeSurrogates(item.text ?? "");
|
|
453
|
-
if (!textDelta) continue;
|
|
454
|
-
if (!currentBlock || currentBlock.type !== "text") {
|
|
455
|
-
finishCurrentBlock(currentBlock);
|
|
456
|
-
currentBlock = {
|
|
457
|
-
type: "text",
|
|
458
|
-
text: ""
|
|
459
|
-
};
|
|
460
|
-
output.content.push(currentBlock);
|
|
461
|
-
stream.push({
|
|
462
|
-
type: "text_start",
|
|
463
|
-
contentIndex: blockIndex(),
|
|
464
|
-
partial: output
|
|
465
|
-
});
|
|
466
|
-
}
|
|
467
|
-
currentBlock.text += textDelta;
|
|
468
|
-
stream.push({
|
|
469
|
-
type: "text_delta",
|
|
470
|
-
contentIndex: blockIndex(),
|
|
471
|
-
delta: textDelta,
|
|
472
|
-
partial: output
|
|
473
|
-
});
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
const toolCalls = delta.tool_calls || [];
|
|
478
|
-
for (const toolCall of toolCalls) {
|
|
479
|
-
if (currentBlock) {
|
|
480
|
-
finishCurrentBlock(currentBlock);
|
|
481
|
-
currentBlock = null;
|
|
482
|
-
}
|
|
483
|
-
const callId = toolCall.id && toolCall.id !== "null" ? toolCall.id : deriveMistralToolCallId(`toolcall:${toolCall.index ?? 0}`, 0);
|
|
484
|
-
const key = toolCall.index ?? callId;
|
|
485
|
-
const existingIndex = toolBlocksByKey.get(key);
|
|
486
|
-
let block;
|
|
487
|
-
if (existingIndex !== void 0) {
|
|
488
|
-
const existing = output.content[existingIndex];
|
|
489
|
-
if (existing?.type === "toolCall") block = existing;
|
|
490
|
-
}
|
|
491
|
-
if (!block) {
|
|
492
|
-
block = {
|
|
493
|
-
type: "toolCall",
|
|
494
|
-
id: callId,
|
|
495
|
-
name: toolCall.function.name,
|
|
496
|
-
arguments: {},
|
|
497
|
-
partialArgs: ""
|
|
498
|
-
};
|
|
499
|
-
output.content.push(block);
|
|
500
|
-
toolBlocksByKey.set(key, output.content.length - 1);
|
|
501
|
-
stream.push({
|
|
502
|
-
type: "toolcall_start",
|
|
503
|
-
contentIndex: output.content.length - 1,
|
|
504
|
-
partial: output
|
|
505
|
-
});
|
|
506
|
-
}
|
|
507
|
-
const argsDelta = typeof toolCall.function.arguments === "string" ? toolCall.function.arguments : JSON.stringify(toolCall.function.arguments || {});
|
|
508
|
-
block.partialArgs = (block.partialArgs || "") + argsDelta;
|
|
509
|
-
block.arguments = parseStreamingJson(block.partialArgs);
|
|
510
|
-
stream.push({
|
|
511
|
-
type: "toolcall_delta",
|
|
512
|
-
contentIndex: toolBlocksByKey.get(key),
|
|
513
|
-
delta: argsDelta,
|
|
514
|
-
partial: output
|
|
515
|
-
});
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
finishCurrentBlock(currentBlock);
|
|
519
|
-
for (const index of toolBlocksByKey.values()) {
|
|
520
|
-
const block = output.content[index];
|
|
521
|
-
if (block.type !== "toolCall") continue;
|
|
522
|
-
const toolBlock = block;
|
|
523
|
-
toolBlock.arguments = parseStreamingJson(toolBlock.partialArgs);
|
|
524
|
-
delete toolBlock.partialArgs;
|
|
525
|
-
stream.push({
|
|
526
|
-
type: "toolcall_end",
|
|
527
|
-
contentIndex: index,
|
|
528
|
-
toolCall: toolBlock,
|
|
529
|
-
partial: output
|
|
530
|
-
});
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
function toFunctionTools(tools) {
|
|
534
|
-
return tools.map((tool) => {
|
|
535
|
-
const strict = resolveJsonSchemaStrictSampling(tool, true);
|
|
536
|
-
return {
|
|
537
|
-
type: "function",
|
|
538
|
-
function: {
|
|
539
|
-
name: tool.name,
|
|
540
|
-
description: tool.description,
|
|
541
|
-
parameters: stripSymbolKeys(getJsonSchemaToolParameters(tool, strict)),
|
|
542
|
-
strict: strict ?? false
|
|
543
|
-
}
|
|
544
|
-
};
|
|
545
|
-
});
|
|
546
|
-
}
|
|
547
|
-
function stripSymbolKeys(value) {
|
|
548
|
-
if (Array.isArray(value)) return value.map((item) => stripSymbolKeys(item));
|
|
549
|
-
if (value && typeof value === "object") {
|
|
550
|
-
const result = {};
|
|
551
|
-
for (const [key, entry] of Object.entries(value)) result[key] = stripSymbolKeys(entry);
|
|
552
|
-
return result;
|
|
553
|
-
}
|
|
554
|
-
return value;
|
|
555
|
-
}
|
|
556
|
-
function toChatMessages(messages, supportsImages) {
|
|
557
|
-
const result = [];
|
|
558
|
-
for (const [index, msg] of messages.entries()) {
|
|
559
|
-
if (msg.role === "system") {
|
|
560
|
-
const text = index === 0 ? getSystemMessageText(msg) : renderSystemMessageUpdate(msg);
|
|
561
|
-
if (text.length > 0) result.push({
|
|
562
|
-
role: "system",
|
|
563
|
-
content: sanitizeSurrogates(text)
|
|
564
|
-
});
|
|
565
|
-
continue;
|
|
566
|
-
}
|
|
567
|
-
if (msg.role === "user") {
|
|
568
|
-
if (typeof msg.content === "string") {
|
|
569
|
-
result.push({
|
|
570
|
-
role: "user",
|
|
571
|
-
content: sanitizeSurrogates(msg.content)
|
|
572
|
-
});
|
|
573
|
-
continue;
|
|
574
|
-
}
|
|
575
|
-
const hadImages = msg.content.some((item) => item.type === "image");
|
|
576
|
-
const content = msg.content.filter((item) => item.type === "text" || supportsImages).map((item) => {
|
|
577
|
-
if (item.type === "text") return {
|
|
578
|
-
type: "text",
|
|
579
|
-
text: sanitizeSurrogates(item.text)
|
|
580
|
-
};
|
|
581
|
-
return {
|
|
582
|
-
type: "image_url",
|
|
583
|
-
imageUrl: `data:${item.mimeType};base64,${item.data}`
|
|
584
|
-
};
|
|
585
|
-
});
|
|
586
|
-
if (content.length > 0) {
|
|
587
|
-
result.push({
|
|
588
|
-
role: "user",
|
|
589
|
-
content
|
|
590
|
-
});
|
|
591
|
-
continue;
|
|
592
|
-
}
|
|
593
|
-
if (hadImages && !supportsImages) result.push({
|
|
594
|
-
role: "user",
|
|
595
|
-
content: "(image omitted: model does not support images)"
|
|
596
|
-
});
|
|
597
|
-
continue;
|
|
598
|
-
}
|
|
599
|
-
if (msg.role === "assistant") {
|
|
600
|
-
const contentParts = [];
|
|
601
|
-
const toolCalls = [];
|
|
602
|
-
for (const block of msg.content) {
|
|
603
|
-
if (block.type === "text") {
|
|
604
|
-
if (block.text.trim().length > 0) contentParts.push({
|
|
605
|
-
type: "text",
|
|
606
|
-
text: sanitizeSurrogates(block.text)
|
|
607
|
-
});
|
|
608
|
-
continue;
|
|
609
|
-
}
|
|
610
|
-
if (block.type === "thinking") {
|
|
611
|
-
if (block.thinking.trim().length > 0) contentParts.push({
|
|
612
|
-
type: "thinking",
|
|
613
|
-
thinking: [{
|
|
614
|
-
type: "text",
|
|
615
|
-
text: sanitizeSurrogates(block.thinking)
|
|
616
|
-
}]
|
|
617
|
-
});
|
|
618
|
-
continue;
|
|
619
|
-
}
|
|
620
|
-
toolCalls.push({
|
|
621
|
-
id: block.id,
|
|
622
|
-
type: "function",
|
|
623
|
-
function: {
|
|
624
|
-
name: block.name,
|
|
625
|
-
arguments: JSON.stringify(block.arguments || {})
|
|
626
|
-
},
|
|
627
|
-
index: 0
|
|
628
|
-
});
|
|
629
|
-
}
|
|
630
|
-
const assistantMessage = {
|
|
631
|
-
role: "assistant",
|
|
632
|
-
prefix: false
|
|
633
|
-
};
|
|
634
|
-
if (contentParts.length > 0) assistantMessage.content = contentParts;
|
|
635
|
-
if (toolCalls.length > 0) assistantMessage.toolCalls = toolCalls;
|
|
636
|
-
if (contentParts.length > 0 || toolCalls.length > 0) result.push(assistantMessage);
|
|
637
|
-
continue;
|
|
638
|
-
}
|
|
639
|
-
const toolContent = [];
|
|
640
|
-
const toolText = buildToolResultText(msg.content.filter((part) => part.type === "text").map((part) => part.type === "text" ? sanitizeSurrogates(part.text) : "").join("\n"), msg.content.some((part) => part.type === "image"), supportsImages, msg.isError);
|
|
641
|
-
toolContent.push({
|
|
642
|
-
type: "text",
|
|
643
|
-
text: toolText
|
|
644
|
-
});
|
|
645
|
-
for (const part of msg.content) {
|
|
646
|
-
if (!supportsImages) continue;
|
|
647
|
-
if (part.type !== "image") continue;
|
|
648
|
-
toolContent.push({
|
|
649
|
-
type: "image_url",
|
|
650
|
-
imageUrl: `data:${part.mimeType};base64,${part.data}`
|
|
651
|
-
});
|
|
652
|
-
}
|
|
653
|
-
result.push({
|
|
654
|
-
role: "tool",
|
|
655
|
-
toolCallId: msg.toolCallId,
|
|
656
|
-
name: msg.toolName,
|
|
657
|
-
content: toolContent
|
|
658
|
-
});
|
|
659
|
-
}
|
|
660
|
-
return result;
|
|
661
|
-
}
|
|
662
|
-
function buildToolResultText(text, hasImages, supportsImages, isError) {
|
|
663
|
-
const trimmed = text.trim();
|
|
664
|
-
const errorPrefix = isError ? "[tool error] " : "";
|
|
665
|
-
if (trimmed.length > 0) return `${errorPrefix}${trimmed}${hasImages && !supportsImages ? "\n[tool image omitted: model does not support images]" : ""}`;
|
|
666
|
-
if (hasImages) {
|
|
667
|
-
if (supportsImages) return isError ? "[tool error] (see attached image)" : "(see attached image)";
|
|
668
|
-
return isError ? "[tool error] (image omitted: model does not support images)" : "(image omitted: model does not support images)";
|
|
669
|
-
}
|
|
670
|
-
return isError ? "[tool error] (no tool output)" : "(no tool output)";
|
|
671
|
-
}
|
|
672
|
-
function mapToolChoice(choice) {
|
|
673
|
-
if (!choice) return void 0;
|
|
674
|
-
if (choice === "auto" || choice === "none" || choice === "any" || choice === "required") return choice;
|
|
675
|
-
return {
|
|
676
|
-
type: "function",
|
|
677
|
-
function: { name: choice.function.name }
|
|
678
|
-
};
|
|
679
|
-
}
|
|
680
|
-
function mapChatStopReason(reason) {
|
|
681
|
-
if (reason === null) return { stopReason: "stop" };
|
|
682
|
-
switch (reason) {
|
|
683
|
-
case "stop": return { stopReason: "stop" };
|
|
684
|
-
case "length":
|
|
685
|
-
case "model_length": return { stopReason: "length" };
|
|
686
|
-
case "tool_calls": return { stopReason: "toolUse" };
|
|
687
|
-
case "error": return {
|
|
688
|
-
stopReason: "error",
|
|
689
|
-
errorMessage: "Provider stopped with: error (server error)"
|
|
690
|
-
};
|
|
691
|
-
default: return {
|
|
692
|
-
stopReason: "error",
|
|
693
|
-
errorMessage: `Provider stopped with: ${reason}`
|
|
694
|
-
};
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
//#endregion
|
|
698
|
-
export { stream, streamSimple };
|