uigraph 1.0.0 → 1.0.1
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/bin.mjs +134 -56911
- 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 +56 -56
- package/dist/abort-signals-B4fc3ahg.mjs +0 -34
- 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/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,994 +0,0 @@
|
|
|
1
|
-
import { t as getProviderEnvValue } from "./provider-env-BJhgA66g.mjs";
|
|
2
|
-
import { a as AssistantMessageEventStream } from "./diagnostics-xdSgQR8t.mjs";
|
|
3
|
-
import { E as renderSystemMessageUpdate, T as getSystemMessageText, b as resolveTranscript, m as getDeclaredTools, n as clampThinkingLevel, t as calculateCost, x as resolveTranscriptTools } from "./models-DBdii9gQ.mjs";
|
|
4
|
-
import { t as headersToRecord } from "./headers-GhQHLk-3.mjs";
|
|
5
|
-
import { n as parseStreamingJson } from "./json-parse-B2mHg7o7.mjs";
|
|
6
|
-
import { a as clampThinkingBudgetToAnswerRoom, c as appendGrammarToolInputJsonDelta, d as getJsonSchemaToolParameters, f as resolveGrammarConstrainedSampling, l as createGrammarToolInputProperties, m as getPiUserAgent, o as resolveSamplingParams, p as resolveJsonSchemaStrictSampling, r as buildBaseOptions, s as thinkingBudgetForLevel, t as transformMessages, u as getGrammarToolInput } from "./transform-messages-BClk99Vn.mjs";
|
|
7
|
-
import { t as retryProviderRequest } from "./provider-retry-DXYM7rVE.mjs";
|
|
8
|
-
import { t as sanitizeSurrogates } from "./sanitize-unicode-CqChtoM6.mjs";
|
|
9
|
-
import { n as hasCopilotVisionInput, t as buildCopilotDynamicHeaders } from "./github-copilot-headers-DWcTgoXr.mjs";
|
|
10
|
-
import { n as OpenAI } from "./openai-I3_AqKDX.mjs";
|
|
11
|
-
import { n as normalizeProviderError, t as formatProviderError } from "./error-body-FhmCtR7m.mjs";
|
|
12
|
-
import { t as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-Bc6qNWt0.mjs";
|
|
13
|
-
import { t as shortHash } from "./hash-DN7ukSfd.mjs";
|
|
14
|
-
//#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/openai-completions.js
|
|
15
|
-
/**
|
|
16
|
-
* Check if conversation messages contain tool calls or tool results.
|
|
17
|
-
* This is needed because Anthropic (via proxy) requires the tools param
|
|
18
|
-
* to be present when messages include tool_calls or tool role messages.
|
|
19
|
-
*/
|
|
20
|
-
function hasHeader(headers, name) {
|
|
21
|
-
if (!headers) return false;
|
|
22
|
-
const expected = name.toLowerCase();
|
|
23
|
-
for (const [key, value] of Object.entries(headers)) if (key.toLowerCase() === expected && value !== null && value.trim().length > 0) return true;
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
function getClientApiKey(provider, apiKey, headers) {
|
|
27
|
-
if (apiKey) return apiKey;
|
|
28
|
-
if (hasHeader(headers, "authorization") || hasHeader(headers, "cf-aig-authorization")) return "unused";
|
|
29
|
-
throw new Error(`No API key for provider: ${provider}`);
|
|
30
|
-
}
|
|
31
|
-
function hasToolHistory(messages) {
|
|
32
|
-
for (const msg of messages) {
|
|
33
|
-
if (msg.role === "toolResult") return true;
|
|
34
|
-
if (msg.role === "assistant") {
|
|
35
|
-
if (msg.content.some((block) => block.type === "toolCall")) return true;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
function isTextContentBlock(block) {
|
|
41
|
-
return block.type === "text";
|
|
42
|
-
}
|
|
43
|
-
function isThinkingContentBlock(block) {
|
|
44
|
-
return block.type === "thinking";
|
|
45
|
-
}
|
|
46
|
-
function isToolCallBlock(block) {
|
|
47
|
-
return block.type === "toolCall";
|
|
48
|
-
}
|
|
49
|
-
function isImageContentBlock(block) {
|
|
50
|
-
return block.type === "image";
|
|
51
|
-
}
|
|
52
|
-
function isReasoningDetailObject(detail) {
|
|
53
|
-
return typeof detail === "object" && detail !== null && !Array.isArray(detail);
|
|
54
|
-
}
|
|
55
|
-
function hasValidCommonReasoningDetailFields(candidate) {
|
|
56
|
-
return (candidate.id === void 0 || candidate.id === null || typeof candidate.id === "string") && (candidate.format === void 0 || typeof candidate.format === "string") && (candidate.index === void 0 || typeof candidate.index === "number");
|
|
57
|
-
}
|
|
58
|
-
function isOpenAIReasoningDetail(detail) {
|
|
59
|
-
if (!isReasoningDetailObject(detail) || !hasValidCommonReasoningDetailFields(detail)) return false;
|
|
60
|
-
switch (detail.type) {
|
|
61
|
-
case "reasoning.summary": return typeof detail.summary === "string";
|
|
62
|
-
case "reasoning.encrypted": return typeof detail.data === "string";
|
|
63
|
-
case "reasoning.text": return typeof detail.text === "string" && (detail.signature === void 0 || detail.signature === null || typeof detail.signature === "string");
|
|
64
|
-
default: return false;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
function parseOpenAIReasoningDetails(signature) {
|
|
68
|
-
if (!signature) return void 0;
|
|
69
|
-
try {
|
|
70
|
-
const parsed = JSON.parse(signature);
|
|
71
|
-
return Array.isArray(parsed) && parsed.length > 0 && parsed.every(isOpenAIReasoningDetail) ? parsed : void 0;
|
|
72
|
-
} catch {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
function parseLegacyEncryptedReasoningDetail(signature) {
|
|
77
|
-
if (!signature) return void 0;
|
|
78
|
-
try {
|
|
79
|
-
const parsed = JSON.parse(signature);
|
|
80
|
-
return isOpenAIReasoningDetail(parsed) && parsed.type === "reasoning.encrypted" && typeof parsed.id === "string" && parsed.id.length > 0 && parsed.data.length > 0 ? parsed : void 0;
|
|
81
|
-
} catch {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
function fillMissingCommonReasoningDetailFields(target, source) {
|
|
86
|
-
target.id ??= source.id;
|
|
87
|
-
target.format ||= source.format;
|
|
88
|
-
target.index ??= source.index;
|
|
89
|
-
}
|
|
90
|
-
function appendOpenAIReasoningDetail(details, detail) {
|
|
91
|
-
const lastDetail = details[details.length - 1];
|
|
92
|
-
if (detail.type === "reasoning.text" && lastDetail?.type === "reasoning.text") {
|
|
93
|
-
lastDetail.text += detail.text;
|
|
94
|
-
lastDetail.signature ||= detail.signature;
|
|
95
|
-
fillMissingCommonReasoningDetailFields(lastDetail, detail);
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
if (detail.type === "reasoning.summary" && lastDetail?.type === "reasoning.summary") {
|
|
99
|
-
lastDetail.summary += detail.summary;
|
|
100
|
-
fillMissingCommonReasoningDetailFields(lastDetail, detail);
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
details.push({ ...detail });
|
|
104
|
-
}
|
|
105
|
-
const OPENAI_COMPLETIONS_REASONING_FIELDS = [
|
|
106
|
-
"reasoning",
|
|
107
|
-
"reasoning_content",
|
|
108
|
-
"reasoning_text"
|
|
109
|
-
];
|
|
110
|
-
function isOpenAICompletionsReasoningField(field) {
|
|
111
|
-
return OPENAI_COMPLETIONS_REASONING_FIELDS.includes(field);
|
|
112
|
-
}
|
|
113
|
-
function resolveCacheRetention(cacheRetention, env) {
|
|
114
|
-
if (cacheRetention) return cacheRetention;
|
|
115
|
-
if (getProviderEnvValue("PI_CACHE_RETENTION", env) === "long") return "long";
|
|
116
|
-
return "short";
|
|
117
|
-
}
|
|
118
|
-
const stream = (model, context, options) => {
|
|
119
|
-
const stream = new AssistantMessageEventStream();
|
|
120
|
-
const normalizedContext = resolveTranscript(context, getCompat(model).supportsMidConvoSystemMessages);
|
|
121
|
-
(async () => {
|
|
122
|
-
const output = {
|
|
123
|
-
role: "assistant",
|
|
124
|
-
content: [],
|
|
125
|
-
api: model.api,
|
|
126
|
-
provider: model.provider,
|
|
127
|
-
model: model.id,
|
|
128
|
-
usage: {
|
|
129
|
-
input: 0,
|
|
130
|
-
output: 0,
|
|
131
|
-
cacheRead: 0,
|
|
132
|
-
cacheWrite: 0,
|
|
133
|
-
totalTokens: 0,
|
|
134
|
-
cost: {
|
|
135
|
-
input: 0,
|
|
136
|
-
output: 0,
|
|
137
|
-
cacheRead: 0,
|
|
138
|
-
cacheWrite: 0,
|
|
139
|
-
total: 0
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
stopReason: "pending",
|
|
143
|
-
timestamp: Date.now()
|
|
144
|
-
};
|
|
145
|
-
let streamedReasoningDetails;
|
|
146
|
-
const applyStreamedReasoningDetails = (block) => {
|
|
147
|
-
if (streamedReasoningDetails !== void 0) block.thinkingSignature = JSON.stringify(streamedReasoningDetails);
|
|
148
|
-
};
|
|
149
|
-
try {
|
|
150
|
-
const apiKey = getClientApiKey(model.provider, options?.apiKey, options?.headers);
|
|
151
|
-
const compat = getCompat(model);
|
|
152
|
-
const grammarToolInputProperties = createGrammarToolInputProperties(getDeclaredTools(normalizedContext.messages), compat.supportsOpenAIGrammarTools);
|
|
153
|
-
const cacheRetention = resolveCacheRetention(options?.cacheRetention, options?.env);
|
|
154
|
-
const cacheSessionId = cacheRetention === "none" ? void 0 : options?.sessionId;
|
|
155
|
-
const client = createClient(model, normalizedContext, apiKey, options?.headers, options?.fetch, cacheSessionId, compat);
|
|
156
|
-
let params = buildParams(model, normalizedContext, options, compat, cacheRetention, grammarToolInputProperties);
|
|
157
|
-
const nextParams = await options?.onPayload?.(params, model);
|
|
158
|
-
if (nextParams !== void 0) params = nextParams;
|
|
159
|
-
const requestOptions = {
|
|
160
|
-
...options?.signal ? { signal: options.signal } : {},
|
|
161
|
-
...options?.timeoutMs !== void 0 ? { timeout: options.timeoutMs } : {},
|
|
162
|
-
maxRetries: 0
|
|
163
|
-
};
|
|
164
|
-
const { data: openaiStream, response } = await retryProviderRequest(() => client.chat.completions.create(params, requestOptions).withResponse(), {
|
|
165
|
-
maxRetries: options?.maxRetries,
|
|
166
|
-
maxRetryDelayMs: options?.maxRetryDelayMs,
|
|
167
|
-
signal: options?.signal
|
|
168
|
-
});
|
|
169
|
-
await options?.onResponse?.({
|
|
170
|
-
status: response.status,
|
|
171
|
-
headers: headersToRecord(response.headers)
|
|
172
|
-
}, model);
|
|
173
|
-
stream.push({
|
|
174
|
-
type: "start",
|
|
175
|
-
partial: output
|
|
176
|
-
});
|
|
177
|
-
let textBlock = null;
|
|
178
|
-
let thinkingBlock = null;
|
|
179
|
-
let hasFinishReason = false;
|
|
180
|
-
const toolCallBlocksByIndex = /* @__PURE__ */ new Map();
|
|
181
|
-
const toolCallBlocksById = /* @__PURE__ */ new Map();
|
|
182
|
-
const blocks = output.content;
|
|
183
|
-
const getContentIndex = (block) => blocks.indexOf(block);
|
|
184
|
-
const getCustomToolCallInput = (block) => {
|
|
185
|
-
const property = block.customInput?.property;
|
|
186
|
-
if (property === void 0) return "";
|
|
187
|
-
const value = block.arguments[property];
|
|
188
|
-
return typeof value === "string" ? value : "";
|
|
189
|
-
};
|
|
190
|
-
const appendCustomToolCallInput = (block, nextInput, close) => {
|
|
191
|
-
const customInput = block.customInput;
|
|
192
|
-
if (!customInput) return void 0;
|
|
193
|
-
const delta = appendGrammarToolInputJsonDelta(customInput.jsonBuffer, customInput.property, nextInput, close);
|
|
194
|
-
block.arguments = { [customInput.property]: nextInput };
|
|
195
|
-
return delta;
|
|
196
|
-
};
|
|
197
|
-
const finishBlock = (block) => {
|
|
198
|
-
const contentIndex = getContentIndex(block);
|
|
199
|
-
if (contentIndex === -1) return;
|
|
200
|
-
if (block.type === "text") stream.push({
|
|
201
|
-
type: "text_end",
|
|
202
|
-
contentIndex,
|
|
203
|
-
content: block.text,
|
|
204
|
-
partial: output
|
|
205
|
-
});
|
|
206
|
-
else if (block.type === "thinking") {
|
|
207
|
-
applyStreamedReasoningDetails(block);
|
|
208
|
-
stream.push({
|
|
209
|
-
type: "thinking_end",
|
|
210
|
-
contentIndex,
|
|
211
|
-
content: block.thinking,
|
|
212
|
-
partial: output
|
|
213
|
-
});
|
|
214
|
-
} else if (block.type === "toolCall") {
|
|
215
|
-
if (block.customInput) {
|
|
216
|
-
const delta = appendCustomToolCallInput(block, getCustomToolCallInput(block), true);
|
|
217
|
-
if (delta !== void 0) stream.push({
|
|
218
|
-
type: "toolcall_delta",
|
|
219
|
-
contentIndex,
|
|
220
|
-
delta,
|
|
221
|
-
partial: output
|
|
222
|
-
});
|
|
223
|
-
} else block.arguments = parseStreamingJson(block.partialArgs);
|
|
224
|
-
delete block.partialArgs;
|
|
225
|
-
delete block.customInput;
|
|
226
|
-
delete block.streamIndex;
|
|
227
|
-
stream.push({
|
|
228
|
-
type: "toolcall_end",
|
|
229
|
-
contentIndex,
|
|
230
|
-
toolCall: block,
|
|
231
|
-
partial: output
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
const ensureTextBlock = () => {
|
|
236
|
-
if (!textBlock) {
|
|
237
|
-
textBlock = {
|
|
238
|
-
type: "text",
|
|
239
|
-
text: ""
|
|
240
|
-
};
|
|
241
|
-
blocks.push(textBlock);
|
|
242
|
-
stream.push({
|
|
243
|
-
type: "text_start",
|
|
244
|
-
contentIndex: getContentIndex(textBlock),
|
|
245
|
-
partial: output
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
return textBlock;
|
|
249
|
-
};
|
|
250
|
-
const ensureThinkingBlock = (thinkingSignature) => {
|
|
251
|
-
if (!thinkingBlock) {
|
|
252
|
-
thinkingBlock = {
|
|
253
|
-
type: "thinking",
|
|
254
|
-
thinking: "",
|
|
255
|
-
thinkingSignature
|
|
256
|
-
};
|
|
257
|
-
blocks.push(thinkingBlock);
|
|
258
|
-
stream.push({
|
|
259
|
-
type: "thinking_start",
|
|
260
|
-
contentIndex: getContentIndex(thinkingBlock),
|
|
261
|
-
partial: output
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
return thinkingBlock;
|
|
265
|
-
};
|
|
266
|
-
const ensureToolCallBlock = (toolCall) => {
|
|
267
|
-
const streamIndex = typeof toolCall.index === "number" ? toolCall.index : void 0;
|
|
268
|
-
const name = toolCall.function?.name ?? toolCall.custom?.name ?? "";
|
|
269
|
-
let block = streamIndex !== void 0 ? toolCallBlocksByIndex.get(streamIndex) : void 0;
|
|
270
|
-
if (!block && toolCall.id) block = toolCallBlocksById.get(toolCall.id);
|
|
271
|
-
if (!block) {
|
|
272
|
-
const customInputProperty = toolCall.custom && !toolCall.function ? grammarToolInputProperties.get(name) ?? "input" : void 0;
|
|
273
|
-
const hasCustomInput = customInputProperty !== void 0;
|
|
274
|
-
block = {
|
|
275
|
-
type: "toolCall",
|
|
276
|
-
id: toolCall.id || "",
|
|
277
|
-
name,
|
|
278
|
-
arguments: hasCustomInput ? { [customInputProperty]: "" } : {},
|
|
279
|
-
partialArgs: hasCustomInput ? void 0 : "",
|
|
280
|
-
customInput: hasCustomInput ? {
|
|
281
|
-
property: customInputProperty,
|
|
282
|
-
jsonBuffer: {
|
|
283
|
-
input: "",
|
|
284
|
-
started: false,
|
|
285
|
-
closed: false
|
|
286
|
-
}
|
|
287
|
-
} : void 0,
|
|
288
|
-
streamIndex
|
|
289
|
-
};
|
|
290
|
-
if (streamIndex !== void 0) toolCallBlocksByIndex.set(streamIndex, block);
|
|
291
|
-
if (toolCall.id) toolCallBlocksById.set(toolCall.id, block);
|
|
292
|
-
blocks.push(block);
|
|
293
|
-
stream.push({
|
|
294
|
-
type: "toolcall_start",
|
|
295
|
-
contentIndex: getContentIndex(block),
|
|
296
|
-
partial: output
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
if (streamIndex !== void 0 && block.streamIndex === void 0) {
|
|
300
|
-
block.streamIndex = streamIndex;
|
|
301
|
-
toolCallBlocksByIndex.set(streamIndex, block);
|
|
302
|
-
}
|
|
303
|
-
if (toolCall.id) toolCallBlocksById.set(toolCall.id, block);
|
|
304
|
-
if (!block.name && name) block.name = name;
|
|
305
|
-
if (toolCall.custom && !toolCall.function && !block.customInput) {
|
|
306
|
-
const customInputProperty = grammarToolInputProperties.get(block.name) ?? "input";
|
|
307
|
-
block.arguments = { [customInputProperty]: "" };
|
|
308
|
-
block.customInput = {
|
|
309
|
-
property: customInputProperty,
|
|
310
|
-
jsonBuffer: {
|
|
311
|
-
input: "",
|
|
312
|
-
started: false,
|
|
313
|
-
closed: false
|
|
314
|
-
}
|
|
315
|
-
};
|
|
316
|
-
delete block.partialArgs;
|
|
317
|
-
}
|
|
318
|
-
return block;
|
|
319
|
-
};
|
|
320
|
-
for await (const chunk of openaiStream) {
|
|
321
|
-
await options?.onProviderStreamEvent?.(chunk, model);
|
|
322
|
-
if (!chunk || typeof chunk !== "object") continue;
|
|
323
|
-
output.responseId ||= chunk.id;
|
|
324
|
-
if (typeof chunk.model === "string" && chunk.model.length > 0 && chunk.model !== model.id) output.responseModel ||= chunk.model;
|
|
325
|
-
if (chunk.usage) output.usage = parseChunkUsage(chunk.usage, model);
|
|
326
|
-
const choice = Array.isArray(chunk.choices) ? chunk.choices[0] : void 0;
|
|
327
|
-
if (!choice) continue;
|
|
328
|
-
if (!chunk.usage && choice.usage) output.usage = parseChunkUsage(choice.usage, model);
|
|
329
|
-
if (choice.finish_reason) {
|
|
330
|
-
output.rawStopReason = choice.finish_reason;
|
|
331
|
-
const finishReasonResult = mapStopReason(choice.finish_reason);
|
|
332
|
-
output.stopReason = finishReasonResult.stopReason;
|
|
333
|
-
if (finishReasonResult.errorMessage) output.errorMessage = finishReasonResult.errorMessage;
|
|
334
|
-
hasFinishReason = true;
|
|
335
|
-
}
|
|
336
|
-
if (choice.delta) {
|
|
337
|
-
if (choice.delta.content !== null && choice.delta.content !== void 0 && choice.delta.content.length > 0) {
|
|
338
|
-
const block = ensureTextBlock();
|
|
339
|
-
block.text += choice.delta.content;
|
|
340
|
-
stream.push({
|
|
341
|
-
type: "text_delta",
|
|
342
|
-
contentIndex: getContentIndex(block),
|
|
343
|
-
delta: choice.delta.content,
|
|
344
|
-
partial: output
|
|
345
|
-
});
|
|
346
|
-
}
|
|
347
|
-
const reasoningFields = [
|
|
348
|
-
"reasoning_content",
|
|
349
|
-
"reasoning",
|
|
350
|
-
"reasoning_text"
|
|
351
|
-
];
|
|
352
|
-
const deltaFields = choice.delta;
|
|
353
|
-
let foundReasoningField = null;
|
|
354
|
-
for (const field of reasoningFields) {
|
|
355
|
-
const value = deltaFields[field];
|
|
356
|
-
if (typeof value === "string" && value.length > 0) {
|
|
357
|
-
foundReasoningField = field;
|
|
358
|
-
break;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
if (foundReasoningField) {
|
|
362
|
-
const delta = deltaFields[foundReasoningField];
|
|
363
|
-
if (typeof delta === "string" && delta.length > 0) {
|
|
364
|
-
const block = ensureThinkingBlock(model.provider === "opencode-go" && foundReasoningField === "reasoning" ? "reasoning_content" : foundReasoningField);
|
|
365
|
-
block.thinking += delta;
|
|
366
|
-
stream.push({
|
|
367
|
-
type: "thinking_delta",
|
|
368
|
-
contentIndex: getContentIndex(block),
|
|
369
|
-
delta,
|
|
370
|
-
partial: output
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
if (choice?.delta?.tool_calls) for (const toolCall of choice.delta.tool_calls) {
|
|
375
|
-
const block = ensureToolCallBlock(toolCall);
|
|
376
|
-
if (!block.id && toolCall.id) {
|
|
377
|
-
block.id = toolCall.id;
|
|
378
|
-
toolCallBlocksById.set(toolCall.id, block);
|
|
379
|
-
}
|
|
380
|
-
const name = toolCall.function?.name ?? toolCall.custom?.name;
|
|
381
|
-
if (!block.name && name) block.name = name;
|
|
382
|
-
let delta = "";
|
|
383
|
-
if (toolCall.function?.arguments) {
|
|
384
|
-
delta = toolCall.function.arguments;
|
|
385
|
-
block.partialArgs = (block.partialArgs ?? "") + toolCall.function.arguments;
|
|
386
|
-
block.arguments = parseStreamingJson(block.partialArgs);
|
|
387
|
-
} else if (toolCall.custom?.input) delta = appendCustomToolCallInput(block, getCustomToolCallInput(block) + toolCall.custom.input, false) ?? "";
|
|
388
|
-
stream.push({
|
|
389
|
-
type: "toolcall_delta",
|
|
390
|
-
contentIndex: getContentIndex(block),
|
|
391
|
-
delta,
|
|
392
|
-
partial: output
|
|
393
|
-
});
|
|
394
|
-
}
|
|
395
|
-
const reasoningDetails = choice.delta.reasoning_details;
|
|
396
|
-
if (Array.isArray(reasoningDetails)) for (const detail of reasoningDetails) {
|
|
397
|
-
if (!isOpenAIReasoningDetail(detail)) continue;
|
|
398
|
-
ensureThinkingBlock("");
|
|
399
|
-
streamedReasoningDetails ??= [];
|
|
400
|
-
appendOpenAIReasoningDetail(streamedReasoningDetails, detail);
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
for (const block of blocks) finishBlock(block);
|
|
405
|
-
if (options?.signal?.aborted) throw new Error("Request was aborted");
|
|
406
|
-
if (output.stopReason === "aborted") throw new Error("Request was aborted");
|
|
407
|
-
if (!hasFinishReason && !compat.supportsFinishReason) output.stopReason = output.content.some((block) => block.type === "toolCall") ? "toolUse" : "stop";
|
|
408
|
-
if (output.stopReason === "error") throw new Error(output.errorMessage || "Provider returned an error stop reason");
|
|
409
|
-
if (compat.supportsFinishReason && !hasFinishReason || output.stopReason === "pending") throw new Error("Stream ended without finish_reason");
|
|
410
|
-
stream.push({
|
|
411
|
-
type: "done",
|
|
412
|
-
reason: output.stopReason,
|
|
413
|
-
message: output
|
|
414
|
-
});
|
|
415
|
-
stream.end();
|
|
416
|
-
} catch (error) {
|
|
417
|
-
for (const block of output.content) {
|
|
418
|
-
if (block.type === "thinking") applyStreamedReasoningDetails(block);
|
|
419
|
-
delete block.index;
|
|
420
|
-
delete block.partialArgs;
|
|
421
|
-
delete block.customInput;
|
|
422
|
-
delete block.streamIndex;
|
|
423
|
-
}
|
|
424
|
-
output.stopReason = options?.signal?.aborted ? "aborted" : "error";
|
|
425
|
-
output.errorMessage = formatProviderError(normalizeProviderError(error));
|
|
426
|
-
const rawMetadata = error?.error?.metadata?.raw;
|
|
427
|
-
if (rawMetadata && !output.errorMessage.includes(String(rawMetadata))) output.errorMessage += `\n${rawMetadata}`;
|
|
428
|
-
stream.push({
|
|
429
|
-
type: "error",
|
|
430
|
-
reason: output.stopReason,
|
|
431
|
-
error: output
|
|
432
|
-
});
|
|
433
|
-
stream.end();
|
|
434
|
-
}
|
|
435
|
-
})();
|
|
436
|
-
return stream;
|
|
437
|
-
};
|
|
438
|
-
const streamSimple = (model, context, options) => {
|
|
439
|
-
getClientApiKey(model.provider, options?.apiKey, options?.headers);
|
|
440
|
-
const base = {
|
|
441
|
-
...buildBaseOptions(model, context, options, options?.apiKey),
|
|
442
|
-
toolChoice: options?.toolChoice
|
|
443
|
-
};
|
|
444
|
-
const clampedReasoning = options?.reasoning ? clampThinkingLevel(model, options.reasoning) : void 0;
|
|
445
|
-
const reasoningEffort = clampedReasoning === "off" ? void 0 : clampedReasoning;
|
|
446
|
-
return stream(model, context, {
|
|
447
|
-
...base,
|
|
448
|
-
reasoningEffort,
|
|
449
|
-
thinkingBudgets: options?.thinkingBudgets
|
|
450
|
-
});
|
|
451
|
-
};
|
|
452
|
-
function createClient(model, context, apiKey, optionsHeaders, fetch, sessionId, compat = getCompat(model)) {
|
|
453
|
-
const headers = {
|
|
454
|
-
"User-Agent": getPiUserAgent(),
|
|
455
|
-
...model.headers
|
|
456
|
-
};
|
|
457
|
-
if (model.provider === "github-copilot") {
|
|
458
|
-
const hasImages = hasCopilotVisionInput(context.messages);
|
|
459
|
-
const copilotHeaders = buildCopilotDynamicHeaders({
|
|
460
|
-
messages: context.messages,
|
|
461
|
-
hasImages
|
|
462
|
-
});
|
|
463
|
-
Object.assign(headers, copilotHeaders);
|
|
464
|
-
}
|
|
465
|
-
if (sessionId && compat.sendSessionAffinityHeaders) {
|
|
466
|
-
if (compat.sessionAffinityFormat === "openrouter") headers["x-session-id"] = sessionId;
|
|
467
|
-
else {
|
|
468
|
-
if (compat.sessionAffinityFormat === "openai") headers.session_id = sessionId;
|
|
469
|
-
headers["x-client-request-id"] = sessionId;
|
|
470
|
-
headers["x-session-affinity"] = sessionId;
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
if (optionsHeaders) Object.assign(headers, optionsHeaders);
|
|
474
|
-
return new OpenAI({
|
|
475
|
-
apiKey,
|
|
476
|
-
baseURL: model.baseUrl,
|
|
477
|
-
dangerouslyAllowBrowser: true,
|
|
478
|
-
fetch,
|
|
479
|
-
defaultHeaders: headers
|
|
480
|
-
});
|
|
481
|
-
}
|
|
482
|
-
function buildParams(model, context, options, compat = getCompat(model), cacheRetention = resolveCacheRetention(options?.cacheRetention, options?.env), grammarToolInputProperties = createGrammarToolInputProperties(getDeclaredTools(context.messages), compat.supportsOpenAIGrammarTools)) {
|
|
483
|
-
const transcriptTools = resolveTranscriptTools(context.messages, compat.supportsMidConvoSystemMessages === true && compat.supportsMidConvoToolAdditions === true);
|
|
484
|
-
const messages = convertMessages(model, context, compat, { grammarToolInputProperties });
|
|
485
|
-
const cacheControl = getCompatCacheControl(compat, cacheRetention);
|
|
486
|
-
const params = {
|
|
487
|
-
model: model.id,
|
|
488
|
-
messages,
|
|
489
|
-
stream: true,
|
|
490
|
-
prompt_cache_key: model.baseUrl.includes("api.openai.com") && cacheRetention !== "none" || cacheRetention === "long" && compat.supportsLongCacheRetention ? clampOpenAIPromptCacheKey(options?.sessionId) : void 0,
|
|
491
|
-
prompt_cache_retention: cacheRetention === "long" && compat.supportsLongCacheRetention ? "24h" : void 0
|
|
492
|
-
};
|
|
493
|
-
if (compat.supportsUsageInStreaming !== false) params.stream_options = { include_usage: true };
|
|
494
|
-
if (compat.supportsStore) params.store = false;
|
|
495
|
-
if (options?.maxTokens) {
|
|
496
|
-
if (compat.maxTokensField === "max_tokens") params.max_tokens = options.maxTokens;
|
|
497
|
-
else params.max_completion_tokens = options.maxTokens;
|
|
498
|
-
}
|
|
499
|
-
if (options?.temperature !== void 0) params.temperature = options.temperature;
|
|
500
|
-
if (transcriptTools.requestTools.length > 0) {
|
|
501
|
-
params.tools = convertTools(transcriptTools.requestTools, compat);
|
|
502
|
-
if (compat.zaiToolStream) params.tool_stream = true;
|
|
503
|
-
} else if (hasToolHistory(context.messages)) params.tools = [];
|
|
504
|
-
if (cacheControl) applyAnthropicCacheControl(messages, params.tools, cacheControl);
|
|
505
|
-
if (options?.toolChoice) params.tool_choice = options.toolChoice;
|
|
506
|
-
if (compat.vllmPriority !== void 0) params.priority = compat.vllmPriority;
|
|
507
|
-
const thinkingTokenBudgetField = resolveThinkingTokenBudgetField(compat);
|
|
508
|
-
const thinkingBudget = resolveClampedThinkingBudget(model, options, params);
|
|
509
|
-
if (compat.thinkingFormat === "zai" && model.reasoning) {
|
|
510
|
-
const zaiParams = params;
|
|
511
|
-
zaiParams.thinking = options?.reasoningEffort ? {
|
|
512
|
-
type: "enabled",
|
|
513
|
-
clear_thinking: false
|
|
514
|
-
} : { type: "disabled" };
|
|
515
|
-
if (options?.reasoningEffort && compat.supportsReasoningEffort) {
|
|
516
|
-
const mappedEffort = model.thinkingLevelMap?.[options.reasoningEffort];
|
|
517
|
-
const effort = mappedEffort === void 0 ? options.reasoningEffort : mappedEffort;
|
|
518
|
-
if (typeof effort === "string") zaiParams.reasoning_effort = effort;
|
|
519
|
-
}
|
|
520
|
-
} else if (compat.thinkingFormat === "qwen" && model.reasoning) {
|
|
521
|
-
params.enable_thinking = !!options?.reasoningEffort;
|
|
522
|
-
if (options?.reasoningEffort && compat.supportsReasoningEffort) {
|
|
523
|
-
const effort = model.thinkingLevelMap?.[options.reasoningEffort] ?? options.reasoningEffort;
|
|
524
|
-
if (typeof effort === "string") params.reasoning_effort = effort;
|
|
525
|
-
}
|
|
526
|
-
} else if (compat.thinkingFormat === "qwen-chat-template" && model.reasoning) params.chat_template_kwargs = {
|
|
527
|
-
enable_thinking: !!options?.reasoningEffort,
|
|
528
|
-
preserve_thinking: true
|
|
529
|
-
};
|
|
530
|
-
else if (compat.thinkingFormat === "chat-template" && model.reasoning) {
|
|
531
|
-
const chatTemplateKwargs = buildChatTemplateValues(model, options, compat.chatTemplateKwargs, thinkingBudget);
|
|
532
|
-
if (chatTemplateKwargs) params.chat_template_kwargs = chatTemplateKwargs;
|
|
533
|
-
} else if (compat.thinkingFormat === "baseten" && model.reasoning) {
|
|
534
|
-
const basetenParams = params;
|
|
535
|
-
const chatTemplateArgs = buildChatTemplateValues(model, options, compat.chatTemplateArgs, thinkingBudget);
|
|
536
|
-
if (chatTemplateArgs) basetenParams.chat_template_args = chatTemplateArgs;
|
|
537
|
-
if (compat.supportsReasoningEffort) {
|
|
538
|
-
const requestedEffort = options?.reasoningEffort;
|
|
539
|
-
const mappedEffort = requestedEffort ? model.thinkingLevelMap?.[requestedEffort] : model.thinkingLevelMap?.off;
|
|
540
|
-
const effort = mappedEffort === void 0 ? requestedEffort : mappedEffort;
|
|
541
|
-
if (typeof effort === "string") basetenParams.reasoning_effort = effort;
|
|
542
|
-
}
|
|
543
|
-
} else if (compat.thinkingFormat === "deepseek" && model.reasoning) {
|
|
544
|
-
if (options?.reasoningEffort) params.thinking = { type: "enabled" };
|
|
545
|
-
else if (model.thinkingLevelMap?.off !== null) params.thinking = { type: "disabled" };
|
|
546
|
-
if (options?.reasoningEffort && compat.supportsReasoningEffort) params.reasoning_effort = model.thinkingLevelMap?.[options.reasoningEffort] ?? options.reasoningEffort;
|
|
547
|
-
} else if (compat.thinkingFormat === "openrouter" && model.reasoning) {
|
|
548
|
-
const openRouterParams = params;
|
|
549
|
-
if (options?.reasoningEffort) openRouterParams.reasoning = { effort: model.thinkingLevelMap?.[options.reasoningEffort] ?? options.reasoningEffort };
|
|
550
|
-
else if (model.thinkingLevelMap?.off !== null) openRouterParams.reasoning = { effort: model.thinkingLevelMap?.off ?? "none" };
|
|
551
|
-
} else if (compat.thinkingFormat === "ant-ling" && model.reasoning && options?.reasoningEffort) {
|
|
552
|
-
const effort = model.thinkingLevelMap?.[options.reasoningEffort];
|
|
553
|
-
if (typeof effort === "string") params.reasoning = { effort };
|
|
554
|
-
} else if (compat.thinkingFormat === "together" && model.reasoning) {
|
|
555
|
-
const togetherParams = params;
|
|
556
|
-
togetherParams.reasoning = { enabled: !!options?.reasoningEffort };
|
|
557
|
-
if (options?.reasoningEffort && compat.supportsReasoningEffort) togetherParams.reasoning_effort = model.thinkingLevelMap?.[options.reasoningEffort] ?? options.reasoningEffort;
|
|
558
|
-
} else if (compat.thinkingFormat === "string-thinking" && model.reasoning) {
|
|
559
|
-
const stringThinkingParams = params;
|
|
560
|
-
if (options?.reasoningEffort) stringThinkingParams.thinking = model.thinkingLevelMap?.[options.reasoningEffort] ?? options.reasoningEffort;
|
|
561
|
-
else if (model.thinkingLevelMap?.off !== null) stringThinkingParams.thinking = model.thinkingLevelMap?.off ?? "none";
|
|
562
|
-
} else if (options?.reasoningEffort && model.reasoning && compat.supportsReasoningEffort) params.reasoning_effort = model.thinkingLevelMap?.[options.reasoningEffort] ?? options.reasoningEffort;
|
|
563
|
-
else if (!options?.reasoningEffort && model.reasoning && compat.supportsReasoningEffort) {
|
|
564
|
-
const offValue = model.thinkingLevelMap?.off;
|
|
565
|
-
if (typeof offValue === "string") params.reasoning_effort = offValue;
|
|
566
|
-
}
|
|
567
|
-
if (thinkingTokenBudgetField && thinkingBudget !== void 0) Object.assign(params, { [thinkingTokenBudgetField]: thinkingBudget });
|
|
568
|
-
if (model.compat?.openRouterRouting) params.provider = model.compat.openRouterRouting;
|
|
569
|
-
if (model.compat?.vercelGatewayRouting) {
|
|
570
|
-
const routing = model.compat.vercelGatewayRouting;
|
|
571
|
-
if (routing.only || routing.order) {
|
|
572
|
-
const gatewayOptions = {};
|
|
573
|
-
if (routing.only) gatewayOptions.only = routing.only;
|
|
574
|
-
if (routing.order) gatewayOptions.order = routing.order;
|
|
575
|
-
params.providerOptions = { gateway: gatewayOptions };
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
const samplingParams = resolveSamplingParams(model, options?.reasoningEffort ?? "off", options?.samplingParams);
|
|
579
|
-
if (samplingParams) Object.assign(params, samplingParams);
|
|
580
|
-
return params;
|
|
581
|
-
}
|
|
582
|
-
function resolveThinkingTokenBudgetField(compat) {
|
|
583
|
-
if (compat.thinkingTokenBudgetField) return compat.thinkingTokenBudgetField;
|
|
584
|
-
if (compat.supportsThinkingTokenBudget) return "thinking_token_budget";
|
|
585
|
-
}
|
|
586
|
-
function resolveClampedThinkingBudget(model, options, params) {
|
|
587
|
-
if (!options?.reasoningEffort || !model.reasoning) return void 0;
|
|
588
|
-
const ceiling = params.max_tokens ?? params.max_completion_tokens ?? model.maxTokens;
|
|
589
|
-
const budget = clampThinkingBudgetToAnswerRoom(thinkingBudgetForLevel(options.reasoningEffort, options.thinkingBudgets), ceiling);
|
|
590
|
-
return budget > 0 ? budget : void 0;
|
|
591
|
-
}
|
|
592
|
-
function buildChatTemplateValues(model, options, values, thinkingBudget) {
|
|
593
|
-
const resolvedValues = {};
|
|
594
|
-
for (const [key, value] of Object.entries(values)) {
|
|
595
|
-
const resolved = resolveChatTemplateKwargValue(model, options, value, thinkingBudget);
|
|
596
|
-
if (resolved !== void 0) resolvedValues[key] = resolved;
|
|
597
|
-
}
|
|
598
|
-
return Object.keys(resolvedValues).length > 0 ? resolvedValues : void 0;
|
|
599
|
-
}
|
|
600
|
-
function resolveChatTemplateKwargValue(model, options, value, thinkingBudget) {
|
|
601
|
-
if (typeof value !== "object" || value === null) return value;
|
|
602
|
-
const reasoningEffort = options?.reasoningEffort;
|
|
603
|
-
if (!reasoningEffort && value.omitWhenOff) return;
|
|
604
|
-
if (value.$var === "thinking.enabled") return !!reasoningEffort;
|
|
605
|
-
if (value.$var === "thinking.budget") return thinkingBudget;
|
|
606
|
-
const mappedValue = reasoningEffort ? model.thinkingLevelMap?.[reasoningEffort] : model.thinkingLevelMap?.off;
|
|
607
|
-
return mappedValue === void 0 ? reasoningEffort : typeof mappedValue === "string" ? mappedValue : void 0;
|
|
608
|
-
}
|
|
609
|
-
function getCompatCacheControl(compat, cacheRetention) {
|
|
610
|
-
if (compat.cacheControlFormat !== "anthropic" || cacheRetention === "none") return;
|
|
611
|
-
const ttl = cacheRetention === "long" && compat.supportsLongCacheRetention ? "1h" : void 0;
|
|
612
|
-
return {
|
|
613
|
-
type: "ephemeral",
|
|
614
|
-
...ttl ? { ttl } : {}
|
|
615
|
-
};
|
|
616
|
-
}
|
|
617
|
-
function applyAnthropicCacheControl(messages, tools, cacheControl) {
|
|
618
|
-
addCacheControlToSystemPrompt(messages, cacheControl);
|
|
619
|
-
addCacheControlToLastTool(tools, cacheControl);
|
|
620
|
-
addCacheControlToLastConversationMessage(messages, cacheControl);
|
|
621
|
-
}
|
|
622
|
-
function addCacheControlToSystemPrompt(messages, cacheControl) {
|
|
623
|
-
for (const message of messages) if (message.role === "system" || message.role === "developer") {
|
|
624
|
-
addCacheControlToInstructionMessage(message, cacheControl);
|
|
625
|
-
return;
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
function addCacheControlToLastConversationMessage(messages, cacheControl) {
|
|
629
|
-
for (let i = messages.length - 1; i >= 0; i--) {
|
|
630
|
-
const message = messages[i];
|
|
631
|
-
if (message.role === "user" || message.role === "assistant" || message.role === "tool") {
|
|
632
|
-
if (addCacheControlToMessage(message, cacheControl)) return;
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
function addCacheControlToLastTool(tools, cacheControl) {
|
|
637
|
-
if (!tools || tools.length === 0) return;
|
|
638
|
-
const lastTool = tools[tools.length - 1];
|
|
639
|
-
lastTool.cache_control = cacheControl;
|
|
640
|
-
}
|
|
641
|
-
function addCacheControlToInstructionMessage(message, cacheControl) {
|
|
642
|
-
return addCacheControlToTextContent(message, cacheControl);
|
|
643
|
-
}
|
|
644
|
-
function addCacheControlToMessage(message, cacheControl) {
|
|
645
|
-
if (message.role === "user" || message.role === "assistant" || message.role === "tool") return addCacheControlToTextContent(message, cacheControl);
|
|
646
|
-
return false;
|
|
647
|
-
}
|
|
648
|
-
function addCacheControlToTextContent(message, cacheControl) {
|
|
649
|
-
const content = message.content;
|
|
650
|
-
if (typeof content === "string") {
|
|
651
|
-
if (content.length === 0) return false;
|
|
652
|
-
message.content = [{
|
|
653
|
-
type: "text",
|
|
654
|
-
text: content,
|
|
655
|
-
cache_control: cacheControl
|
|
656
|
-
}];
|
|
657
|
-
return true;
|
|
658
|
-
}
|
|
659
|
-
if (!Array.isArray(content)) return false;
|
|
660
|
-
for (let i = content.length - 1; i >= 0; i--) {
|
|
661
|
-
const part = content[i];
|
|
662
|
-
if (part?.type === "text") {
|
|
663
|
-
const textPart = part;
|
|
664
|
-
textPart.cache_control = cacheControl;
|
|
665
|
-
return true;
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
return false;
|
|
669
|
-
}
|
|
670
|
-
function convertMessages(model, context, compat, options) {
|
|
671
|
-
const normalizedContext = resolveTranscript(context, compat.supportsMidConvoSystemMessages);
|
|
672
|
-
const params = [];
|
|
673
|
-
const normalizeToolCallId = (id) => {
|
|
674
|
-
if (id.includes("|")) {
|
|
675
|
-
const separatorIndex = id.indexOf("|");
|
|
676
|
-
const callId = id.slice(0, separatorIndex).replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
677
|
-
const itemId = id.slice(separatorIndex + 1).replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
678
|
-
const combinedId = itemId.length > 0 ? `${callId}_${itemId}` : callId;
|
|
679
|
-
if (combinedId.length <= 40) return combinedId;
|
|
680
|
-
const hash = shortHash(id).slice(0, 8);
|
|
681
|
-
return `${callId.slice(0, Math.max(1, 40 - hash.length - 1))}_${hash}`;
|
|
682
|
-
}
|
|
683
|
-
if (model.provider === "openai") return id.length > 40 ? id.slice(0, 40) : id;
|
|
684
|
-
return id;
|
|
685
|
-
};
|
|
686
|
-
const transformedMessages = transformMessages(normalizedContext.messages, model, (id) => normalizeToolCallId(id));
|
|
687
|
-
const transcriptTools = resolveTranscriptTools(normalizedContext.messages, compat.supportsMidConvoSystemMessages === true && compat.supportsMidConvoToolAdditions === true);
|
|
688
|
-
const instructionRole = model.reasoning && compat.supportsDeveloperRole ? "developer" : "system";
|
|
689
|
-
let lastRole = null;
|
|
690
|
-
for (let i = 0; i < transformedMessages.length; i++) {
|
|
691
|
-
const msg = transformedMessages[i];
|
|
692
|
-
if (compat.requiresAssistantAfterToolResult && lastRole === "toolResult" && msg.role === "user") params.push({
|
|
693
|
-
role: "assistant",
|
|
694
|
-
content: "I have processed the tool results."
|
|
695
|
-
});
|
|
696
|
-
if (msg.role === "system") {
|
|
697
|
-
const addedTools = i > 0 && transcriptTools.anchorsAdditions ? msg.toolsAdded ?? [] : [];
|
|
698
|
-
if (addedTools.length > 0) {
|
|
699
|
-
const kimiToolMessage = {
|
|
700
|
-
role: "system",
|
|
701
|
-
tools: convertTools(addedTools, compat)
|
|
702
|
-
};
|
|
703
|
-
params.push(kimiToolMessage);
|
|
704
|
-
}
|
|
705
|
-
const text = i === 0 ? getSystemMessageText(msg) : renderSystemMessageUpdate(msg);
|
|
706
|
-
if (text.length > 0) params.push({
|
|
707
|
-
role: instructionRole,
|
|
708
|
-
content: sanitizeSurrogates(text)
|
|
709
|
-
});
|
|
710
|
-
} else if (msg.role === "user") {
|
|
711
|
-
if (typeof msg.content === "string") params.push({
|
|
712
|
-
role: "user",
|
|
713
|
-
content: sanitizeSurrogates(msg.content)
|
|
714
|
-
});
|
|
715
|
-
else {
|
|
716
|
-
const content = msg.content.filter((item) => item.type !== "text" || item.text.length > 0).map((item) => {
|
|
717
|
-
if (item.type === "text") return {
|
|
718
|
-
type: "text",
|
|
719
|
-
text: sanitizeSurrogates(item.text)
|
|
720
|
-
};
|
|
721
|
-
else return {
|
|
722
|
-
type: "image_url",
|
|
723
|
-
image_url: { url: `data:${item.mimeType};base64,${item.data}` }
|
|
724
|
-
};
|
|
725
|
-
});
|
|
726
|
-
if (content.length === 0) continue;
|
|
727
|
-
params.push({
|
|
728
|
-
role: "user",
|
|
729
|
-
content
|
|
730
|
-
});
|
|
731
|
-
}
|
|
732
|
-
} else if (msg.role === "assistant") {
|
|
733
|
-
const assistantMsg = {
|
|
734
|
-
role: "assistant",
|
|
735
|
-
content: compat.requiresAssistantAfterToolResult ? "" : null
|
|
736
|
-
};
|
|
737
|
-
const assistantTextParts = msg.content.filter(isTextContentBlock).filter((block) => block.text.trim().length > 0).map((block) => ({
|
|
738
|
-
type: "text",
|
|
739
|
-
text: sanitizeSurrogates(block.text)
|
|
740
|
-
}));
|
|
741
|
-
const assistantText = assistantTextParts.map((part) => part.text).join("");
|
|
742
|
-
const thinkingBlocks = msg.content.filter(isThinkingContentBlock);
|
|
743
|
-
const toolCalls = msg.content.filter(isToolCallBlock);
|
|
744
|
-
const signedReasoningDetails = thinkingBlocks.map((block) => parseOpenAIReasoningDetails(block.thinkingSignature)).find((details) => details !== void 0);
|
|
745
|
-
const legacyReasoningDetails = toolCalls.map((toolCall) => parseLegacyEncryptedReasoningDetail(toolCall.thoughtSignature)).filter((detail) => detail !== void 0);
|
|
746
|
-
const preservedReasoningDetails = signedReasoningDetails ?? (legacyReasoningDetails.length > 0 ? legacyReasoningDetails : void 0);
|
|
747
|
-
const nonEmptyThinkingBlocks = thinkingBlocks.filter((block) => block.thinking.trim().length > 0);
|
|
748
|
-
if (nonEmptyThinkingBlocks.length > 0) {
|
|
749
|
-
if (compat.requiresThinkingAsText) assistantMsg.content = [{
|
|
750
|
-
type: "text",
|
|
751
|
-
text: nonEmptyThinkingBlocks.map((block) => sanitizeSurrogates(block.thinking)).join("\n\n")
|
|
752
|
-
}, ...assistantTextParts];
|
|
753
|
-
else {
|
|
754
|
-
if (assistantText.length > 0) assistantMsg.content = assistantText;
|
|
755
|
-
if (!preservedReasoningDetails) {
|
|
756
|
-
let signature = nonEmptyThinkingBlocks[0].thinkingSignature;
|
|
757
|
-
if (model.provider === "opencode-go" && signature === "reasoning") signature = "reasoning_content";
|
|
758
|
-
if (signature && isOpenAICompletionsReasoningField(signature)) assistantMsg[signature] = nonEmptyThinkingBlocks.map((block) => block.thinking).join("\n");
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
} else if (assistantText.length > 0) assistantMsg.content = assistantText;
|
|
762
|
-
if (toolCalls.length > 0) assistantMsg.tool_calls = toolCalls.map((tc) => {
|
|
763
|
-
const customInputProperty = options?.grammarToolInputProperties?.get(tc.name);
|
|
764
|
-
if (customInputProperty !== void 0) return {
|
|
765
|
-
id: tc.id,
|
|
766
|
-
type: "custom",
|
|
767
|
-
custom: {
|
|
768
|
-
name: tc.name,
|
|
769
|
-
input: sanitizeSurrogates(getGrammarToolInput(tc.name, tc.arguments, customInputProperty))
|
|
770
|
-
}
|
|
771
|
-
};
|
|
772
|
-
return {
|
|
773
|
-
id: tc.id,
|
|
774
|
-
type: "function",
|
|
775
|
-
function: {
|
|
776
|
-
name: tc.name,
|
|
777
|
-
arguments: JSON.stringify(tc.arguments)
|
|
778
|
-
}
|
|
779
|
-
};
|
|
780
|
-
});
|
|
781
|
-
if (preservedReasoningDetails) assistantMsg.reasoning_details = preservedReasoningDetails;
|
|
782
|
-
if (compat.requiresReasoningContentOnAssistantMessages && model.reasoning && assistantMsg.reasoning_content === void 0) assistantMsg.reasoning_content = "";
|
|
783
|
-
const content = assistantMsg.content;
|
|
784
|
-
if (!(content !== null && content !== void 0 && (typeof content === "string" ? content.length > 0 : content.length > 0)) && !assistantMsg.tool_calls) continue;
|
|
785
|
-
params.push(assistantMsg);
|
|
786
|
-
} else if (msg.role === "toolResult") {
|
|
787
|
-
const imageBlocks = [];
|
|
788
|
-
let j = i;
|
|
789
|
-
for (; j < transformedMessages.length && transformedMessages[j].role === "toolResult"; j++) {
|
|
790
|
-
const toolMsg = transformedMessages[j];
|
|
791
|
-
const textResult = toolMsg.content.filter(isTextContentBlock).map((block) => block.text).join("\n");
|
|
792
|
-
const hasImages = toolMsg.content.some((c) => c.type === "image");
|
|
793
|
-
const toolResultText = textResult.length > 0 ? textResult : hasImages ? "(see attached image)" : "(no tool output)";
|
|
794
|
-
const toolResultMsg = {
|
|
795
|
-
role: "tool",
|
|
796
|
-
content: sanitizeSurrogates(toolResultText),
|
|
797
|
-
tool_call_id: toolMsg.toolCallId
|
|
798
|
-
};
|
|
799
|
-
if (compat.requiresToolResultName && toolMsg.toolName) toolResultMsg.name = toolMsg.toolName;
|
|
800
|
-
params.push(toolResultMsg);
|
|
801
|
-
if (hasImages && model.input.includes("image")) {
|
|
802
|
-
for (const block of toolMsg.content) if (isImageContentBlock(block)) imageBlocks.push({
|
|
803
|
-
type: "image_url",
|
|
804
|
-
image_url: { url: `data:${block.mimeType};base64,${block.data}` }
|
|
805
|
-
});
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
i = j - 1;
|
|
809
|
-
if (imageBlocks.length > 0) {
|
|
810
|
-
if (compat.requiresAssistantAfterToolResult) params.push({
|
|
811
|
-
role: "assistant",
|
|
812
|
-
content: "I have processed the tool results."
|
|
813
|
-
});
|
|
814
|
-
params.push({
|
|
815
|
-
role: "user",
|
|
816
|
-
content: [{
|
|
817
|
-
type: "text",
|
|
818
|
-
text: "Attached image(s) from tool result:"
|
|
819
|
-
}, ...imageBlocks]
|
|
820
|
-
});
|
|
821
|
-
lastRole = "user";
|
|
822
|
-
} else lastRole = "toolResult";
|
|
823
|
-
continue;
|
|
824
|
-
}
|
|
825
|
-
lastRole = msg.role;
|
|
826
|
-
}
|
|
827
|
-
return params;
|
|
828
|
-
}
|
|
829
|
-
function convertTools(tools, compat) {
|
|
830
|
-
return tools.map((tool) => {
|
|
831
|
-
const grammar = resolveGrammarConstrainedSampling(tool, compat.supportsOpenAIGrammarTools);
|
|
832
|
-
if (grammar) return {
|
|
833
|
-
type: "custom",
|
|
834
|
-
custom: {
|
|
835
|
-
name: tool.name,
|
|
836
|
-
description: tool.description,
|
|
837
|
-
format: {
|
|
838
|
-
type: "grammar",
|
|
839
|
-
grammar: {
|
|
840
|
-
syntax: grammar.format,
|
|
841
|
-
definition: grammar.definition
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
}
|
|
845
|
-
};
|
|
846
|
-
const strict = resolveJsonSchemaStrictSampling(tool, compat.supportsStrictMode !== false);
|
|
847
|
-
return {
|
|
848
|
-
type: "function",
|
|
849
|
-
function: {
|
|
850
|
-
name: tool.name,
|
|
851
|
-
description: tool.description,
|
|
852
|
-
parameters: getJsonSchemaToolParameters(tool, strict),
|
|
853
|
-
...compat.supportsStrictMode !== false && { strict: strict ?? false }
|
|
854
|
-
}
|
|
855
|
-
};
|
|
856
|
-
});
|
|
857
|
-
}
|
|
858
|
-
function parseChunkUsage(rawUsage, model) {
|
|
859
|
-
const promptTokens = rawUsage.prompt_tokens || 0;
|
|
860
|
-
const cacheReadTokens = rawUsage.prompt_tokens_details?.cached_tokens ?? rawUsage.prompt_cache_hit_tokens ?? rawUsage.cached_tokens ?? 0;
|
|
861
|
-
const cacheWriteTokens = rawUsage.prompt_tokens_details?.cache_write_tokens || 0;
|
|
862
|
-
const input = Math.max(0, promptTokens - cacheReadTokens - cacheWriteTokens);
|
|
863
|
-
const outputTokens = rawUsage.completion_tokens || 0;
|
|
864
|
-
const usage = {
|
|
865
|
-
input,
|
|
866
|
-
output: outputTokens,
|
|
867
|
-
cacheRead: cacheReadTokens,
|
|
868
|
-
cacheWrite: cacheWriteTokens,
|
|
869
|
-
reasoning: rawUsage.completion_tokens_details?.reasoning_tokens || 0,
|
|
870
|
-
totalTokens: input + outputTokens + cacheReadTokens + cacheWriteTokens,
|
|
871
|
-
cost: {
|
|
872
|
-
input: 0,
|
|
873
|
-
output: 0,
|
|
874
|
-
cacheRead: 0,
|
|
875
|
-
cacheWrite: 0,
|
|
876
|
-
total: 0
|
|
877
|
-
}
|
|
878
|
-
};
|
|
879
|
-
calculateCost(model, usage);
|
|
880
|
-
return usage;
|
|
881
|
-
}
|
|
882
|
-
function mapStopReason(reason) {
|
|
883
|
-
if (reason === null) return { stopReason: "stop" };
|
|
884
|
-
switch (reason) {
|
|
885
|
-
case "stop":
|
|
886
|
-
case "end": return { stopReason: "stop" };
|
|
887
|
-
case "length": return { stopReason: "length" };
|
|
888
|
-
case "function_call":
|
|
889
|
-
case "tool_calls": return { stopReason: "toolUse" };
|
|
890
|
-
case "content_filter": return {
|
|
891
|
-
stopReason: "error",
|
|
892
|
-
errorMessage: "Provider finish_reason: content_filter"
|
|
893
|
-
};
|
|
894
|
-
case "network_error": return {
|
|
895
|
-
stopReason: "error",
|
|
896
|
-
errorMessage: "Provider finish_reason: network_error"
|
|
897
|
-
};
|
|
898
|
-
default: return {
|
|
899
|
-
stopReason: "error",
|
|
900
|
-
errorMessage: `Provider finish_reason: ${reason}`
|
|
901
|
-
};
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
/**
|
|
905
|
-
* Auto-detect compatibility settings from provider name and baseUrl.
|
|
906
|
-
* Used as the base when model.compat is not set; explicit model.compat
|
|
907
|
-
* entries override these detected values.
|
|
908
|
-
*/
|
|
909
|
-
function detectCompat(model) {
|
|
910
|
-
const provider = model.provider;
|
|
911
|
-
const baseUrl = model.baseUrl;
|
|
912
|
-
const isZai = provider === "zai" || provider === "zai-coding-cn" || baseUrl.includes("api.z.ai") || baseUrl.includes("open.bigmodel.cn");
|
|
913
|
-
const isTogether = provider === "together" || baseUrl.includes("api.together.ai") || baseUrl.includes("api.together.xyz");
|
|
914
|
-
const isMoonshot = provider === "moonshotai" || provider === "moonshotai-cn" || baseUrl.includes("api.moonshot.");
|
|
915
|
-
const isOpenRouter = provider === "openrouter" || baseUrl.includes("openrouter.ai");
|
|
916
|
-
const isCloudflareWorkersAI = provider === "cloudflare-workers-ai" || baseUrl.includes("api.cloudflare.com");
|
|
917
|
-
const isCloudflareAiGateway = provider === "cloudflare-ai-gateway" || baseUrl.includes("gateway.ai.cloudflare.com");
|
|
918
|
-
const isNvidia = provider === "nvidia" || baseUrl.includes("integrate.api.nvidia.com");
|
|
919
|
-
const isAntLing = provider === "ant-ling" || baseUrl.includes("api.ant-ling.com");
|
|
920
|
-
const isCerebras = provider === "cerebras" || baseUrl.includes("cerebras.ai");
|
|
921
|
-
const isDeepSeek = provider === "deepseek" || baseUrl.toLowerCase().includes("deepseek.com");
|
|
922
|
-
const isNonStandard = isNvidia || isCerebras || provider === "xai" || baseUrl.includes("api.x.ai") || isTogether || baseUrl.includes("chutes.ai") || isDeepSeek || isZai || isMoonshot || provider === "opencode" || baseUrl.includes("opencode.ai") || isCloudflareWorkersAI || isCloudflareAiGateway || isAntLing;
|
|
923
|
-
const useMaxTokens = baseUrl.includes("chutes.ai") || isDeepSeek || isMoonshot || isCloudflareAiGateway || isTogether || isNvidia || isAntLing || isZai;
|
|
924
|
-
const isGrok = provider === "xai" || baseUrl.includes("api.x.ai");
|
|
925
|
-
const isOpenRouterDeveloperRoleModel = isOpenRouter && (model.id.startsWith("anthropic/") || model.id.startsWith("openai/"));
|
|
926
|
-
const cacheControlFormat = provider === "openrouter" && model.id.startsWith("anthropic/") ? "anthropic" : void 0;
|
|
927
|
-
return {
|
|
928
|
-
supportsStore: !isNonStandard,
|
|
929
|
-
supportsDeveloperRole: isOpenRouterDeveloperRoleModel || !isNonStandard && !isOpenRouter,
|
|
930
|
-
supportsReasoningEffort: !isGrok && !isZai && !isMoonshot && !isTogether && !isCloudflareAiGateway && !isNvidia && !isAntLing,
|
|
931
|
-
supportsUsageInStreaming: true,
|
|
932
|
-
supportsFinishReason: true,
|
|
933
|
-
maxTokensField: useMaxTokens ? "max_tokens" : "max_completion_tokens",
|
|
934
|
-
requiresToolResultName: false,
|
|
935
|
-
requiresAssistantAfterToolResult: false,
|
|
936
|
-
requiresThinkingAsText: false,
|
|
937
|
-
requiresReasoningContentOnAssistantMessages: isDeepSeek,
|
|
938
|
-
thinkingFormat: isDeepSeek ? "deepseek" : isZai ? "zai" : isTogether ? "together" : isAntLing ? "ant-ling" : isOpenRouter ? "openrouter" : "openai",
|
|
939
|
-
openRouterRouting: {},
|
|
940
|
-
vercelGatewayRouting: {},
|
|
941
|
-
chatTemplateKwargs: {},
|
|
942
|
-
chatTemplateArgs: {},
|
|
943
|
-
zaiToolStream: false,
|
|
944
|
-
supportsThinkingTokenBudget: false,
|
|
945
|
-
thinkingTokenBudgetField: void 0,
|
|
946
|
-
supportsStrictMode: false,
|
|
947
|
-
supportsOpenAIGrammarTools: false,
|
|
948
|
-
supportsMidConvoSystemMessages: false,
|
|
949
|
-
supportsMidConvoToolAdditions: false,
|
|
950
|
-
cacheControlFormat,
|
|
951
|
-
sendSessionAffinityHeaders: isOpenRouter,
|
|
952
|
-
sessionAffinityFormat: isOpenRouter ? "openrouter" : "openai",
|
|
953
|
-
supportsLongCacheRetention: !(isTogether || isCloudflareWorkersAI || isCloudflareAiGateway || isNvidia || isAntLing)
|
|
954
|
-
};
|
|
955
|
-
}
|
|
956
|
-
/**
|
|
957
|
-
* Get resolved compatibility settings for a model.
|
|
958
|
-
* Auto-detects from provider/URL then overrides with explicit model.compat.
|
|
959
|
-
*/
|
|
960
|
-
function getCompat(model) {
|
|
961
|
-
const detected = detectCompat(model);
|
|
962
|
-
if (!model.compat) return detected;
|
|
963
|
-
return {
|
|
964
|
-
supportsStore: model.compat.supportsStore ?? detected.supportsStore,
|
|
965
|
-
supportsDeveloperRole: model.compat.supportsDeveloperRole ?? detected.supportsDeveloperRole,
|
|
966
|
-
supportsReasoningEffort: model.compat.supportsReasoningEffort ?? detected.supportsReasoningEffort,
|
|
967
|
-
supportsUsageInStreaming: model.compat.supportsUsageInStreaming ?? detected.supportsUsageInStreaming,
|
|
968
|
-
supportsFinishReason: model.compat.supportsFinishReason ?? detected.supportsFinishReason,
|
|
969
|
-
maxTokensField: model.compat.maxTokensField ?? detected.maxTokensField,
|
|
970
|
-
requiresToolResultName: model.compat.requiresToolResultName ?? detected.requiresToolResultName,
|
|
971
|
-
requiresAssistantAfterToolResult: model.compat.requiresAssistantAfterToolResult ?? detected.requiresAssistantAfterToolResult,
|
|
972
|
-
requiresThinkingAsText: model.compat.requiresThinkingAsText ?? detected.requiresThinkingAsText,
|
|
973
|
-
requiresReasoningContentOnAssistantMessages: model.compat.requiresReasoningContentOnAssistantMessages ?? detected.requiresReasoningContentOnAssistantMessages,
|
|
974
|
-
thinkingFormat: model.compat.thinkingFormat ?? detected.thinkingFormat,
|
|
975
|
-
openRouterRouting: model.compat.openRouterRouting ?? {},
|
|
976
|
-
vercelGatewayRouting: model.compat.vercelGatewayRouting ?? detected.vercelGatewayRouting,
|
|
977
|
-
chatTemplateKwargs: model.compat.chatTemplateKwargs ?? detected.chatTemplateKwargs,
|
|
978
|
-
chatTemplateArgs: model.compat.chatTemplateArgs ?? detected.chatTemplateArgs,
|
|
979
|
-
zaiToolStream: model.compat.zaiToolStream ?? detected.zaiToolStream,
|
|
980
|
-
supportsThinkingTokenBudget: model.compat.supportsThinkingTokenBudget ?? detected.supportsThinkingTokenBudget,
|
|
981
|
-
thinkingTokenBudgetField: model.compat.thinkingTokenBudgetField ?? detected.thinkingTokenBudgetField,
|
|
982
|
-
supportsStrictMode: model.compat.supportsStrictMode ?? detected.supportsStrictMode,
|
|
983
|
-
supportsOpenAIGrammarTools: model.compat.supportsOpenAIGrammarTools ?? detected.supportsOpenAIGrammarTools,
|
|
984
|
-
supportsMidConvoSystemMessages: model.compat.supportsMidConvoSystemMessages ?? detected.supportsMidConvoSystemMessages,
|
|
985
|
-
supportsMidConvoToolAdditions: model.compat.supportsMidConvoToolAdditions ?? detected.supportsMidConvoToolAdditions,
|
|
986
|
-
cacheControlFormat: model.compat.cacheControlFormat ?? detected.cacheControlFormat,
|
|
987
|
-
sendSessionAffinityHeaders: model.compat.sendSessionAffinityHeaders ?? detected.sendSessionAffinityHeaders,
|
|
988
|
-
sessionAffinityFormat: model.compat.sessionAffinityFormat ?? detected.sessionAffinityFormat,
|
|
989
|
-
supportsLongCacheRetention: model.compat.supportsLongCacheRetention ?? detected.supportsLongCacheRetention,
|
|
990
|
-
vllmPriority: model.compat.vllmPriority
|
|
991
|
-
};
|
|
992
|
-
}
|
|
993
|
-
//#endregion
|
|
994
|
-
export { convertMessages, stream, streamSimple };
|