@agimon-ai/po-cloudflare 0.0.2-alpha.2 → 0.0.2-alpha.21
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 +4 -3
- package/dist/abort-signals-2GUraIGq.js +34 -0
- package/dist/agent-DZ-OKOHn.js +6850 -0
- package/dist/anthropic-messages-5ODquUB-.js +14317 -0
- package/dist/{apiContracts-CHOiCbS_.js → apiContracts-b33nSAAI.js} +18 -81
- package/dist/{approval-BMXqnTYd.js → approval-r3NnI1VC.js} +19 -3
- package/dist/{approvalPrompt-Bg1JrEEY.js → approvalPrompt-DWoXxu3S.js} +2 -2
- package/dist/artifactFiles-DLCReI0-.js +1 -0
- package/dist/assets/assets/{CodeEditorView-BnyZHaYM.js → CodeEditorView-XeNS0L9M.js} +2 -2
- package/dist/assets/assets/{abnfDiagram-WEYOIA3C-muME0eCj.js → abnfDiagram-WEYOIA3C-B6ZW0nkR.js} +2 -2
- package/dist/assets/assets/{architecture-WOLXFQ4H-DMnhK1WH.js → architecture-WOLXFQ4H-bVR64sHO.js} +1 -1
- package/dist/assets/assets/{architectureDiagram-ZHVYKT53-DKn7XGP7.js → architectureDiagram-ZHVYKT53-D7tZz3io.js} +2 -2
- package/dist/assets/assets/{blockDiagram-RJAE7QA3-DtDctXZg.js → blockDiagram-RJAE7QA3-DdwScfiX.js} +2 -2
- package/dist/assets/assets/{c4Diagram-XDPPPE54-23pGLJeP.js → c4Diagram-XDPPPE54-DgSxZJCV.js} +2 -2
- package/dist/assets/assets/channel-TPcVvp_3.js +2 -0
- package/dist/assets/assets/{chunk-2E7WHVMD-BZ2nGNPa.js → chunk-2E7WHVMD-D5TXC2SM.js} +2 -2
- package/dist/assets/assets/{chunk-4EMNKR2T-Dui1SYFi.js → chunk-4EMNKR2T-BWhOSvo1.js} +2 -2
- package/dist/assets/assets/{chunk-55XCU76K-CUB92Evl.js → chunk-55XCU76K-HkkBzLtZ.js} +2 -2
- package/dist/assets/assets/{chunk-7S6XSTFO-CVayPHfE.js → chunk-7S6XSTFO-CBnjycLU.js} +2 -2
- package/dist/assets/assets/{chunk-AQDTSKZB---wakYqY.js → chunk-AQDTSKZB-75lIIq8T.js} +2 -2
- package/dist/assets/assets/{chunk-DSNLSHJZ-DfbdohUR.js → chunk-DSNLSHJZ-D8PpnXMk.js} +2 -2
- package/dist/assets/assets/{chunk-HAGFOTED-Dr4KRh-b.js → chunk-HAGFOTED-CXRS2NIN.js} +2 -2
- package/dist/assets/assets/{chunk-HNE4Q36P-D06cR91Z.js → chunk-HNE4Q36P-BocUqS94.js} +2 -2
- package/dist/assets/assets/{chunk-NQOKRVIF-Ca4gLeDb.js → chunk-NQOKRVIF-CHf_ogYT.js} +2 -2
- package/dist/assets/assets/{chunk-UHW7PFBP-DmL638jN.js → chunk-UHW7PFBP-DrW1PaIv.js} +2 -2
- package/dist/assets/assets/{chunk-VQ5W62QI-pkxSW5Zj.js → chunk-VQ5W62QI-CLoA7bFm.js} +2 -2
- package/dist/assets/assets/{chunk-WQQL4CDK-Dcc8hV4U.js → chunk-WQQL4CDK-BmBsrj9I.js} +2 -2
- package/dist/assets/assets/chunk-XXDRQBXY-iFE4Tl8c.js +2 -0
- package/dist/assets/assets/{chunk-YZO67HFG-B_HKcFrw.js → chunk-YZO67HFG-DShE_cgv.js} +2 -2
- package/dist/assets/assets/{chunk-ZAUX2LTX-DAzZUysS.js → chunk-ZAUX2LTX-B3oLvSXy.js} +2 -2
- package/dist/assets/assets/{chunk-ZCHMQSOR-DAVgjymL.js → chunk-ZCHMQSOR-B14vKK7C.js} +2 -2
- package/dist/assets/assets/{classDiagram-v2-4MYWR3UA-Fsw8TGPu.js → classDiagram-v2-4MYWR3UA-Da8elIW2.js} +2 -2
- package/dist/assets/assets/{cose-bilkent-JH36ORCC-CgUbISYV.js → cose-bilkent-JH36ORCC-Du4tGtiJ.js} +2 -2
- package/dist/assets/assets/{cynefin-EF2NZ3EQ-D1LxAU2x.js → cynefin-EF2NZ3EQ-Cyj6i_WI.js} +1 -1
- package/dist/assets/assets/{cynefinDiagram-WF24UDRP-D54I1jil.js → cynefinDiagram-WF24UDRP-DFWXwO7A.js} +2 -2
- package/dist/assets/assets/{dagre-NK4GIZVX-DC7zL16U.js → dagre-NK4GIZVX-C1wB_cf-.js} +2 -2
- package/dist/assets/assets/{diagram-CBK3MWTC-DB0ptUdz.js → diagram-CBK3MWTC-MYCOBYl6.js} +2 -2
- package/dist/assets/assets/{diagram-I5XIIV2D-CozSftPJ.js → diagram-I5XIIV2D-BFYbKUFf.js} +2 -2
- package/dist/assets/assets/{diagram-ODIL2UCW-g3WOEWDS.js → diagram-ODIL2UCW-6siqTpv_.js} +2 -2
- package/dist/assets/assets/{diagram-PFBEJUXE-CFxGeOYi.js → diagram-PFBEJUXE-CaBr9CoB.js} +2 -2
- package/dist/assets/assets/{diagram-RJA3I4VV-BQBsLche.js → diagram-RJA3I4VV-DAvmuDpc.js} +2 -2
- package/dist/assets/assets/{diagram-TYUNFSNR-DrjpW2yq.js → diagram-TYUNFSNR-CJnhgCpo.js} +2 -2
- package/dist/assets/assets/{dist-DjL8d1jZ.js → dist-BQ4W1R18.js} +2 -2
- package/dist/assets/assets/{dist-DvgCCshF.js → dist-BnzFckPF.js} +2 -2
- package/dist/assets/assets/{dist-gfbb4ygy.js → dist-CFtBpcYL.js} +2 -2
- package/dist/assets/assets/{dist-BabjcJ3j.js → dist-CIQX1z4W.js} +2 -2
- package/dist/assets/assets/{dist-XIZum9n5.js → dist-ChHYoe9_.js} +2 -2
- package/dist/assets/assets/{dist-1-mhYUBH.js → dist-DKxZO8d9.js} +2 -2
- package/dist/assets/assets/{dist-h6SOnP8-.js → dist-DL6z28wl.js} +2 -2
- package/dist/assets/assets/{dist-B3JXhDWV.js → dist-DNyn1p9Z.js} +2 -2
- package/dist/assets/assets/{dist-Izr2SB3q.js → dist-qYlLXIa8.js} +2 -2
- package/dist/assets/assets/{ebnfDiagram-V4P3TTPT-BZS_aAve.js → ebnfDiagram-V4P3TTPT-AUcqDTM3.js} +2 -2
- package/dist/assets/assets/{elk-QONTBCTQ-B2ksVmMA.js → elk-QONTBCTQ-aA10PEHJ.js} +2 -2
- package/dist/assets/assets/{erDiagram-KYQIGQAA-7P6zF-Z-.js → erDiagram-KYQIGQAA-hhYiqA-x.js} +2 -2
- package/dist/assets/assets/{eventmodeling-K75KTNOO-RoGQoRq-.js → eventmodeling-K75KTNOO-BQZqbRo5.js} +1 -1
- package/dist/assets/assets/flowDiagram-IUGLLWBU-BuyysPYC.js +1 -0
- package/dist/assets/assets/{ganttDiagram-R7GPNTJY-CTOlRy7M.js → ganttDiagram-R7GPNTJY-CLON1GpW.js} +2 -2
- package/dist/assets/assets/{gitGraph-VSP46ZUC-CPqytIt0.js → gitGraph-VSP46ZUC-DbmvNwR2.js} +1 -1
- package/dist/assets/assets/{gitGraphDiagram-PDYL7XHY-BffLxuxg.js → gitGraphDiagram-PDYL7XHY-DJVO0WlL.js} +2 -2
- package/dist/assets/assets/index-BiTVAj5E.js +155 -0
- package/dist/assets/assets/index-CBNQEGK3.css +1 -0
- package/dist/assets/assets/{info-OHQRW6UA-BI8RK0Ow.js → info-OHQRW6UA-CAt3Nt3g.js} +1 -1
- package/dist/assets/assets/{infoDiagram-MVDRKAX5-DUIst1FB.js → infoDiagram-MVDRKAX5-DTuqH-Zb.js} +2 -2
- package/dist/assets/assets/{ishikawaDiagram-HPEHV2GE-CA17Eho5.js → ishikawaDiagram-HPEHV2GE-BnWvdonT.js} +2 -2
- package/dist/assets/assets/{journeyDiagram-BOSHW7O7-CNri5Ap9.js → journeyDiagram-BOSHW7O7-Btxtcgvl.js} +2 -2
- package/dist/assets/assets/{kanban-definition-FNSA4HC5-DnXna7jO.js → kanban-definition-FNSA4HC5-q7ek9o_H.js} +2 -2
- package/dist/assets/assets/{line-BsXJZn93.js → line-B7yLilmC.js} +2 -2
- package/dist/assets/assets/{linear-BHYaD5T0.js → linear-y8aSKEli.js} +2 -2
- package/dist/assets/assets/{mermaid-parser.core-B64Eo-8a.js → mermaid-parser.core-B4rH50nD.js} +4 -4
- package/dist/assets/assets/{mermaid.core-Zw9qmTzg.js → mermaid.core-DnRVHTjE.js} +5 -5
- package/dist/assets/assets/{mindmap-definition-6OY57UG3-E5qz4KNc.js → mindmap-definition-6OY57UG3-DT9Afs2v.js} +2 -2
- package/dist/assets/assets/{packet-JDAUHWVQ-DgfizTr3.js → packet-JDAUHWVQ-CnqNbu4p.js} +1 -1
- package/dist/assets/assets/{pegDiagram-ECIUJNBX-D0WK_agM.js → pegDiagram-ECIUJNBX-cvxdBBFq.js} +2 -2
- package/dist/assets/assets/{pie-XZMESJXO-PJR1sXD4.js → pie-XZMESJXO-etXMNsaL.js} +1 -1
- package/dist/assets/assets/{pieDiagram-GNMPY74T-CPuU-NTs.js → pieDiagram-GNMPY74T-CBN-R3_j.js} +2 -2
- package/dist/assets/assets/{quadrantDiagram-D57K4MC3-5C9yjM1b.js → quadrantDiagram-D57K4MC3-C5jjVPIH.js} +2 -2
- package/dist/assets/assets/{radar-ABXABTNO-BspdXgl0.js → radar-ABXABTNO-CAMd_mrV.js} +1 -1
- package/dist/assets/assets/{railroad-I3PHUGI6-Ct0a6hLD.js → railroad-I3PHUGI6-DIs3auoe.js} +1 -1
- package/dist/assets/assets/{railroad-abnf-LNEFI6M7-fduYB4SA.js → railroad-abnf-LNEFI6M7-CJXr1qWy.js} +1 -1
- package/dist/assets/assets/{railroad-ebnf-DWYD2UWJ-CTQa8Sww.js → railroad-ebnf-DWYD2UWJ-DfwtykqI.js} +1 -1
- package/dist/assets/assets/{railroad-peg-JR7BVNR7-DatoH3GJ.js → railroad-peg-JR7BVNR7-B8beAhTs.js} +1 -1
- package/dist/assets/assets/{railroadDiagram-Y72NRBL7-C8sWN8l2.js → railroadDiagram-Y72NRBL7-BDcQE-EL.js} +2 -2
- package/dist/assets/assets/{requirementDiagram-EQYSW5RA-CqRz4RcT.js → requirementDiagram-EQYSW5RA-KJ4-QjZM.js} +2 -2
- package/dist/assets/assets/{sankeyDiagram-SY24JHO5-bdiuKKlX.js → sankeyDiagram-SY24JHO5-VjIB-Ybr.js} +2 -2
- package/dist/assets/assets/{sequenceDiagram-BLEHNHQU-Zy-8I0Hy.js → sequenceDiagram-BLEHNHQU-MfMuWq1M.js} +2 -2
- package/dist/assets/assets/{src-gihY33R9.js → src-BAxIj8GJ.js} +2 -2
- package/dist/assets/assets/{stateDiagram-v2-A6IESKWZ-DXQERPvz.js → stateDiagram-v2-A6IESKWZ-mHwLRRCY.js} +2 -2
- package/dist/assets/assets/{swimlanes-B3ENRKFQ-1gjZQElg.js → swimlanes-B3ENRKFQ-PArlYoqV.js} +2 -2
- package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-The09-5S.js +9 -0
- package/dist/assets/assets/{timeline-definition-JXYKGLGB-CTeYEw-9.js → timeline-definition-JXYKGLGB-B2nKiNFU.js} +2 -2
- package/dist/assets/assets/{treeView-D4JQ5SDB-DD-EsLLT.js → treeView-D4JQ5SDB-gU23_RuI.js} +1 -1
- package/dist/assets/assets/{treemap-SAJKECNS-BLdFeS5J.js → treemap-SAJKECNS-CiqoMvZa.js} +1 -1
- package/dist/assets/assets/{usecaseDiagram-WPOLBNNX-C1GikSSP.js → usecaseDiagram-WPOLBNNX-DpeoWpMK.js} +2 -2
- package/dist/assets/assets/{vennDiagram-Q3Y3IDCW-B1FoA3g8.js → vennDiagram-Q3Y3IDCW-C31iGKvM.js} +2 -2
- package/dist/assets/assets/{wardley-7MLQ67FV-BrHb5Bjf.js → wardley-7MLQ67FV-CIzHhzNw.js} +1 -1
- package/dist/assets/assets/{wardleyDiagram-IVAIDKWA-CmPLD1X4.js → wardleyDiagram-IVAIDKWA-DIIkoezc.js} +2 -2
- package/dist/assets/assets/{webpack-BYWDFj_R.js → webpack-RFseiMZW.js} +2 -2
- package/dist/assets/assets/{xychartDiagram-4URNHDU4-DR5pfEjl.js → xychartDiagram-4URNHDU4-QiHL91kC.js} +2 -2
- package/dist/assets/bundle-asset-policy.json +1 -1
- package/dist/assets/index.html +2 -2
- package/dist/assets/plugins/assets/base-CKKRZ7-h.css +2 -0
- package/dist/assets/plugins/assets/browserCaptureWorklet-Droj0fW0-Droj0fW0.js +13 -0
- package/dist/assets/plugins/assets/ibm-plex-sans-cyrillic-ext-wght-normal-d45eAU9y.woff2 +0 -0
- package/dist/assets/plugins/assets/ibm-plex-sans-cyrillic-wght-normal-BAAhND-U.woff2 +0 -0
- package/dist/assets/plugins/assets/ibm-plex-sans-greek-wght-normal-CmyJS8uq.woff2 +0 -0
- package/dist/assets/plugins/assets/ibm-plex-sans-latin-ext-wght-normal-CIII54If.woff2 +0 -0
- package/dist/assets/plugins/assets/ibm-plex-sans-latin-wght-normal-IvpUvPa2.woff2 +0 -0
- package/dist/assets/plugins/assets/ibm-plex-sans-vietnamese-wght-normal-Dg1JeJN0.woff2 +0 -0
- package/dist/assets/plugins/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
- package/dist/assets/plugins/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/dist/assets/plugins/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/dist/assets/plugins/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/dist/assets/plugins/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/dist/assets/plugins/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/dist/assets/plugins/assets/sileroVadWorker-D894njUe-DjN_BMWf.mjs +110 -0
- package/dist/assets/plugins/assets/silero_vad_v6.2.1-SjbCxFXk-SjbCxFXk.onnx +0 -0
- package/dist/assets/plugins/chunks/po-web-runtime-BJDT6Lbw.js +1 -0
- package/dist/assets/plugins/compositions.json +1 -0
- package/dist/assets/plugins/slots/approval.293d9a00-BXIhaPlQ.js +2 -0
- package/dist/assets/plugins/slots/artifacts.24567664-ZzR0gbvy.js +1 -0
- package/dist/assets/plugins/slots/author.0998a880-DAbA-7rb.js +93 -0
- package/dist/assets/plugins/slots/autocompact.dd97d013-IVq4Z6qm.js +1 -0
- package/dist/assets/plugins/slots/builtin-tools.36d7400b-CpCLjRRN.js +7 -0
- package/dist/assets/plugins/slots/codemode.8eaee717-VWt9PqsU.js +10 -0
- package/dist/assets/plugins/slots/domain.5e95fc37-5PIUBqDe.js +1 -0
- package/dist/assets/plugins/slots/edit.385c9aa9-DNAjPNG5.js +7 -0
- package/dist/assets/plugins/slots/files.daf34ed8-CQaTz0i1.js +2 -0
- package/dist/assets/plugins/slots/goal.77ec9930-B8EkarBq.js +1 -0
- package/dist/assets/plugins/slots/grep.02052cdc-CIRhO2gY.js +1 -0
- package/dist/assets/plugins/slots/help.ecd4c0f9-naMF9NN1.js +3 -0
- package/dist/assets/plugins/slots/log.a86eb6d0-D5__rAZJ.js +4 -0
- package/dist/assets/plugins/slots/mcp.974af249-DPNHn9XH.js +109 -0
- package/dist/assets/plugins/slots/plan.bafb8f68-C5GEpybF.js +3 -0
- package/dist/assets/plugins/slots/profile.48851a1d-yX6tzV3x.js +1 -0
- package/dist/assets/plugins/slots/prompts.723d7748-B7zpPeoF.js +3 -0
- package/dist/assets/plugins/slots/read.46bf6536-Cw5Z5z5T.js +1 -0
- package/dist/assets/plugins/slots/runner.53e9bd76-CiQR_FPX.js +8 -0
- package/dist/assets/plugins/slots/skill.086701a4-CL6h_F-x.js +4 -0
- package/dist/assets/plugins/slots/vault.ac9935c8-DKERQYg4.js +1 -0
- package/dist/assets/plugins/slots/voice.e85ca7f9-DEgb-U9m.js +1 -0
- package/dist/assets/pwa/pwa.js +12 -12
- package/dist/assets/pwa/sw.js +4 -4
- package/dist/{atomicJson-BJfPFSYF.js → atomicJson-C_7F2zD1.js} +2 -3
- package/dist/azure-openai-config-COZUaRzM.js +55 -0
- package/dist/azure-openai-responses-Cs4k2HOd.js +183 -0
- package/dist/{backgroundWork-CeFrbRnj.js → backgroundWork-B1mPDYlf.js} +1 -1
- package/dist/browser-BWf8OMfl.js +3 -0
- package/dist/childSession-Cf2-kH4O.js +22 -0
- package/dist/classifier-shared-IhSH9hhh.js +106 -0
- package/dist/cloudflare-workers-ai-system-one-BNnc8MuH.js +52 -0
- package/dist/{codemode-DbPu0yJN.js → codemode-DQFmrosw.js} +5 -2
- package/dist/contracts-DD3f1Lpn.js +19 -0
- package/dist/diagnostics-1lYFeSJe.js +131 -0
- package/dist/{server-D3PQk1Gt.js → dist-B-vqs6tA.js} +1 -546
- package/dist/dist-Dvx5mlIR.js +50 -0
- package/dist/env-api-keys-Bow6MJe2.js +32 -0
- package/dist/error-body-CJk7jMUh.js +102 -0
- package/dist/esm-BKJy3O9-.js +1553 -0
- package/dist/exports-B0WMEXCP.js +34 -0
- package/dist/{remoteMcp-CMqZldeA.js → exports-D09VsUk-.js} +1153 -175
- package/dist/{exports-BNZz2DNU.js → exports-nV43ShA7.js} +25 -9
- package/dist/{extensionFile-CXOa5G4C.js → extensionFile-DNM4xsje.js} +26 -2
- package/dist/github-copilot-headers-D1RedfLn.js +22 -0
- package/dist/google-generative-ai-DXTILNT0.js +328 -0
- package/dist/google-shared-e4JDCTVP.js +19588 -0
- package/dist/google-vertex-a1lzvJfq.js +374 -0
- package/dist/{domains-BNjGTOPj.js → harnessState-Dwrk3lfv.js} +175 -16
- package/dist/{harnessStore-BT706Ly6.js → harnessStore-Z7yDLO45.js} +4 -5
- package/dist/hash-Dt6RIbkn.js +16 -0
- package/dist/headers-CwtEVQvr.js +17 -0
- package/dist/help-w6vVEZGL.js +101 -0
- package/dist/hubChannel-Cm-sxOvU.js +21 -0
- package/dist/hubRevisions-58pU2dW5.js +363 -0
- package/dist/identity-BgfHobJH.js +165 -0
- package/dist/index.edge-COJJ_Dv2.js +937 -0
- package/dist/index.edge-ChYa2LU4.js +14 -0
- package/dist/index.edge-ClLTmPFz.js +191 -0
- package/dist/index.edge-DyYmurS7.js +62 -0
- package/dist/index.edge-K0w5auwG.js +56 -0
- package/dist/index.edge-Xa5LLtxz.js +67 -0
- package/dist/iso-BPQViXM8.js +10 -0
- package/dist/{layeredConfig-DPQAnlXD.js → layeredConfig-CUkYUs1f.js} +193 -15
- package/dist/{majorModes-DbCfLZH3.js → majorModes-BB0PXgFn.js} +4 -14
- package/dist/majorModes-C7vtBs4D.js +1 -0
- package/dist/{mcpProjection-BsP0IEnb.js → mcpProjection-BtKzB6oK.js} +2 -2
- package/dist/migrations-5gbLIQIc.js +32 -0
- package/dist/mistral-conversations-CLwhVDjA.js +689 -0
- package/dist/modeDefinition-C3Zbrw48.js +44 -0
- package/dist/models-Chzm15vC.js +1511 -0
- package/dist/narration-CpRurWLO.js +127 -0
- package/dist/node-BT4GsJQp.js +2479 -0
- package/dist/node-DytJOfYf.js +23 -0
- package/dist/notification-kckG3leF.js +102 -0
- package/dist/openai-codex-responses-DRMONxDE.js +1210 -0
- package/dist/openai-completions-CcNhAv8l.js +984 -0
- package/dist/openai-decisions-BsFjaAGw.js +142 -0
- package/dist/openai-kPrtlgjl.js +17357 -0
- package/dist/openai-prompt-cache-Bc6qNWt0.js +8 -0
- package/dist/openai-responses-C5Gp2UOV.js +281 -0
- package/dist/openai-responses-shared-BbSi-wBR.js +661 -0
- package/dist/openrouter-cost-CvC52g3b.js +30 -0
- package/dist/openrouter-images-BoHl8g8p.js +124 -0
- package/dist/{hubChannel-BHQyzcOo.js → packageApi-t1oCjNDU.js} +4 -41
- package/dist/photon_rs_bg.wasm +0 -0
- package/dist/pi-messages-BXfrZLC7.js +312 -0
- package/dist/piConfig-DQzlbPY4.js +126 -0
- package/dist/piSettings-Cf1QofNe.js +1 -0
- package/dist/platform-BIEiM4TG.js +113 -0
- package/dist/pluginContributions-Be9EnCAW.js +16 -0
- package/dist/pluginProtocol-BqXXyI4z.js +80 -0
- package/dist/{protocol-Xpm_mCNN.js → protocol-DDL8geoS.js} +2 -2
- package/dist/provider-env-CxhHUFiF.js +38 -0
- package/dist/provider-retry-BUoezuw8.js +79 -0
- package/dist/sanitize-unicode-C3Ec8oL6.js +26 -0
- package/dist/sealedChannel-BeWNTWys.js +27 -0
- package/dist/server-AbXyhXlY.js +217 -0
- package/dist/server-B6dqQoh2.js +1518 -0
- package/dist/server-BIHo9TFu.js +505 -0
- package/dist/{server-BZh1ZXz_.js → server-BJ7DNzCp.js} +8 -19
- package/dist/server-BO-j_GbD.js +15106 -0
- package/dist/{server-D4W7EdJY.js → server-BQzAiMns.js} +16 -16
- package/dist/server-BR7SZtj7.js +3125 -0
- package/dist/{server-BE6VqEiA.js → server-BT2ORK83.js} +20 -12
- package/dist/server-BbSHYRnY.js +295 -0
- package/dist/server-BqoKlEGk.js +1806 -0
- package/dist/{server-tvgQ99rv.js → server-Busl0pQI.js} +370 -120
- package/dist/server-CIHM4jqu.js +1116 -0
- package/dist/server-CgWSSdvd.js +576 -0
- package/dist/{server-Dpgh8PDh.js → server-Co_UWKrR.js} +14 -5
- package/dist/{server-BAAL9-NA.js → server-CuEPb7u-.js} +3 -10
- package/dist/{server-Dt4y1rZD.js → server-D40q2Jpx.js} +47 -27
- package/dist/server-DCyf2Asb.js +679 -0
- package/dist/server-DH7PfLln.js +148 -0
- package/dist/server-DJ8bc89M.js +934 -0
- package/dist/server-DYdp0W9v.js +489 -0
- package/dist/server-DsdPEYGu.js +639 -0
- package/dist/server-DymH4Ucq.js +189 -0
- package/dist/server-IqECnUrb.js +834 -0
- package/dist/{server-36iuA3MI.js → server-KBgW77zh.js} +3 -3
- package/dist/server-RW_9R3R3.js +1522 -0
- package/dist/server-aUit8j6r.js +1028 -0
- package/dist/{server-DJAanjoI.js → server-gifRriZK.js} +491 -103
- package/dist/server-nkUlqnAL.js +2658 -0
- package/dist/server-oxyEbv1a.js +1256 -0
- package/dist/{server-D8ndq0wL.js → server-ub3s16Mc.js} +11 -9
- package/dist/{build-2gFaVEfG.js → serverPlugin-CELT6P0Q.js} +3946 -3
- package/dist/{sessionConfig-rBQgzXlT.js → sessionConfig-RQGvfm6E.js} +550 -760
- package/dist/simple-options-CFzI5Pd_.js +156 -0
- package/dist/streaming-json-BWTHTwz-.js +858 -0
- package/dist/system-one-shared-CiIrx29d.js +132 -0
- package/dist/{notification-D76PSL7r.js → telemetry-Csv1ZxAn.js} +1 -92
- package/dist/transform-messages-D77af7Bx.js +356 -0
- package/dist/truncate-M3KbFyVj.js +89 -0
- package/dist/{server-A-_GFpPr.js → type-ASYnCGVW.js} +10 -1031
- package/dist/typesafe-system-one-DGxeggJh.js +37 -0
- package/dist/uuid-B0QJx6Kr.js +31 -0
- package/dist/{validation-D77NZBrx.js → validation-BJxVSAwx.js} +8 -3
- package/dist/{value-Djvc2foV.js → value-_W31So3B.js} +1 -1
- package/dist/vaultSettings-Di3n5YIg.js +328 -0
- package/dist/voiceTools-RMn4HvWo.js +246 -0
- package/dist/web-DCP7ELJj.js +3 -0
- package/dist/worker.js +95288 -49863
- package/dist/workflow-B7qx0Vv9.js +79 -0
- package/package.json +37 -22
- package/wrangler.jsonc +4 -2
- package/dist/assets/assets/channel-CMrEzemr.js +0 -2
- package/dist/assets/assets/chunk-XXDRQBXY-CFf0S6bN.js +0 -2
- package/dist/assets/assets/flowDiagram-IUGLLWBU-BhGbWVf0.js +0 -1
- package/dist/assets/assets/index-Bx_K4Joy.js +0 -155
- package/dist/assets/assets/index-DZM68mTk.css +0 -1
- package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-q91tR8ri.js +0 -9
- package/dist/contextProjection-DVP2Vc5j.js +0 -188
- package/dist/harnessState-gmzJcPGt.js +0 -88
- package/dist/harnessStore-BiH9vSuD.js +0 -1
- package/dist/index.edge-BgSx_gRO.js +0 -45
- package/dist/majorModes-BvWNqoHt.js +0 -1
- package/dist/piSettings-B6fsgIBA.js +0 -1
- package/dist/platform-B4AAgwJ0.js +0 -16
- package/dist/platformFiles-C_bXo4Ig.js +0 -39
- package/dist/server-BZaPPoQp.js +0 -592
- package/dist/server-D75MWDhB.js +0 -118
- package/dist/server-r358hzQg.js +0 -280
- package/dist/serverPlugin-BOI6c6s5.js +0 -3393
|
@@ -0,0 +1,661 @@
|
|
|
1
|
+
import { t as calculateCost, v as resolveTranscript, y as resolveTranscriptTools } from "./models-Chzm15vC.js";
|
|
2
|
+
import { l as renderSystemMessageUpdate, s as getSystemMessageText } from "./identity-BgfHobJH.js";
|
|
3
|
+
import { n as ToolCallArgumentsStream } from "./streaming-json-BWTHTwz-.js";
|
|
4
|
+
import { t as sanitizeSurrogates } from "./sanitize-unicode-C3Ec8oL6.js";
|
|
5
|
+
import { d as resolveJsonSchemaStrictSampling, i as closeGrammarToolInputJson, n as transformMessages, o as getGrammarToolInput, r as appendGrammarToolInputJsonDelta, s as getJsonSchemaToolParameters, u as resolveGrammarConstrainedSampling } from "./transform-messages-D77af7Bx.js";
|
|
6
|
+
import { t as shortHash } from "./hash-Dt6RIbkn.js";
|
|
7
|
+
//#region ../../../node_modules/.pnpm/@earendil-works+pi-ai@1.5.0_@aws-sdk+credential-provider-node@3.972.86_@modelcontextpro_018b33d3c6d4455b3921fdf11f2d0b63/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js
|
|
8
|
+
function encodeTextSignatureV1(id, phase) {
|
|
9
|
+
const payload = {
|
|
10
|
+
v: 1,
|
|
11
|
+
id
|
|
12
|
+
};
|
|
13
|
+
if (phase) payload.phase = phase;
|
|
14
|
+
return JSON.stringify(payload);
|
|
15
|
+
}
|
|
16
|
+
function parseTextSignature(signature) {
|
|
17
|
+
if (!signature) return void 0;
|
|
18
|
+
if (signature.startsWith("{")) try {
|
|
19
|
+
const parsed = JSON.parse(signature);
|
|
20
|
+
if (parsed.v === 1 && typeof parsed.id === "string") {
|
|
21
|
+
if (parsed.phase === "commentary" || parsed.phase === "final_answer") return {
|
|
22
|
+
id: parsed.id,
|
|
23
|
+
phase: parsed.phase
|
|
24
|
+
};
|
|
25
|
+
return { id: parsed.id };
|
|
26
|
+
}
|
|
27
|
+
} catch {}
|
|
28
|
+
return { id: signature };
|
|
29
|
+
}
|
|
30
|
+
function convertToolResultOutput(model, content) {
|
|
31
|
+
const textResult = content.filter((c) => c.type === "text").map((c) => c.text).join("\n");
|
|
32
|
+
const images = content.filter((c) => c.type === "image");
|
|
33
|
+
const hasText = textResult.trim().length > 0;
|
|
34
|
+
if (images.length === 0 || !model.input.includes("image")) return sanitizeSurrogates(hasText ? textResult : images.length > 0 ? "(see attached image)" : "(no tool output)");
|
|
35
|
+
const output = [];
|
|
36
|
+
if (hasText) output.push({
|
|
37
|
+
type: "input_text",
|
|
38
|
+
text: sanitizeSurrogates(textResult)
|
|
39
|
+
});
|
|
40
|
+
for (const image of images) output.push({
|
|
41
|
+
type: "input_image",
|
|
42
|
+
detail: "auto",
|
|
43
|
+
image_url: `data:${image.mimeType};base64,${image.data}`
|
|
44
|
+
});
|
|
45
|
+
return output;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* How a Responses transport expresses tool changes.
|
|
49
|
+
*
|
|
50
|
+
* `additional_tools` items accumulate: a later item adds tools and replaces same-name
|
|
51
|
+
* definitions from earlier items, but it cannot replace a top-level tool and cannot remove any
|
|
52
|
+
* tool (verified with strict schemas on the OpenAI, Codex, and Copilot backends, October 2026).
|
|
53
|
+
* Like Codex, every tool is therefore declared in `additional_tools` items, starting with one
|
|
54
|
+
* at the head of the input, and removals are announced as text. Synthetic tool search can
|
|
55
|
+
* only add tools. Without mid-conversation system messages there is nothing to anchor.
|
|
56
|
+
*/
|
|
57
|
+
function getResponsesToolSupport(options) {
|
|
58
|
+
if (options.supportsMidConvoSystemMessages && options.supportsAdditionalTools) return "changes";
|
|
59
|
+
return options.supportsToolSearch ? "additions" : "none";
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Precedes every additional_tools item after the first. Without it, models read the latest item as
|
|
63
|
+
* the complete tool set once a removal was announced; Codex precedes its incremental tool batches
|
|
64
|
+
* with the same guidance. Restating the tools that are still unavailable keeps smaller models
|
|
65
|
+
* (gpt-5.6-luna, gpt-6-luna) from calling them again after later loads (verified October 2026).
|
|
66
|
+
*/
|
|
67
|
+
function renderIncrementalToolsNotice(unavailable) {
|
|
68
|
+
const notice = "This is an incremental tools update. Previously declared tools remain available unless explicitly marked unavailable. A tool declared again here is available again, and its latest definition replaces the earlier one.";
|
|
69
|
+
return unavailable.size > 0 ? `${notice}\nStill unavailable: ${[...unavailable].join(", ")}.` : notice;
|
|
70
|
+
}
|
|
71
|
+
function renderToolRemovalNotice(names) {
|
|
72
|
+
return `The following tools are no longer available. Do not call them:\n${names.map((name) => `- ${name}`).join("\n")}`;
|
|
73
|
+
}
|
|
74
|
+
function convertResponsesMessages(model, context, allowedToolCallProviders, options) {
|
|
75
|
+
const normalizedContext = resolveTranscript(context, options?.supportsMidConvoSystemMessages);
|
|
76
|
+
const messages = [];
|
|
77
|
+
const normalizeIdPart = (part) => {
|
|
78
|
+
const sanitized = part.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
79
|
+
return (sanitized.length > 64 ? sanitized.slice(0, 64) : sanitized).replace(/_+$/, "");
|
|
80
|
+
};
|
|
81
|
+
const buildForeignResponsesItemId = (itemId) => {
|
|
82
|
+
const normalized = `fc_${shortHash(itemId)}`;
|
|
83
|
+
return normalized.length > 64 ? normalized.slice(0, 64) : normalized;
|
|
84
|
+
};
|
|
85
|
+
const normalizeToolCallId = (id, _targetModel, source) => {
|
|
86
|
+
if (!allowedToolCallProviders.has(model.provider)) return normalizeIdPart(id);
|
|
87
|
+
if (!id.includes("|")) return normalizeIdPart(id);
|
|
88
|
+
const [callId, itemId] = id.split("|");
|
|
89
|
+
const normalizedCallId = normalizeIdPart(callId);
|
|
90
|
+
let normalizedItemId = source.provider !== model.provider || source.api !== model.api ? buildForeignResponsesItemId(itemId) : normalizeIdPart(itemId);
|
|
91
|
+
if (!normalizedItemId.startsWith("fc_")) normalizedItemId = normalizeIdPart(`fc_${normalizedItemId}`);
|
|
92
|
+
return `${normalizedCallId}|${normalizedItemId}`;
|
|
93
|
+
};
|
|
94
|
+
const transformedMessages = transformMessages(normalizedContext.messages, model, normalizeToolCallId);
|
|
95
|
+
const toolSupport = getResponsesToolSupport(options ?? {});
|
|
96
|
+
const transcriptTools = resolveTranscriptTools(normalizedContext.messages, toolSupport);
|
|
97
|
+
let declaredAdditionalTools = false;
|
|
98
|
+
/** Tools announced as removed and not declared again since. */
|
|
99
|
+
const unavailableTools = /* @__PURE__ */ new Set();
|
|
100
|
+
const appendSystemToolAdditions = (message, seed) => {
|
|
101
|
+
const tools = message.toolsAdded ?? [];
|
|
102
|
+
for (const tool of tools) unavailableTools.delete(tool.name);
|
|
103
|
+
if (tools.length === 0) return;
|
|
104
|
+
if (toolSupport === "changes") {
|
|
105
|
+
if (declaredAdditionalTools) messages.push({
|
|
106
|
+
role: instructionRole,
|
|
107
|
+
content: renderIncrementalToolsNotice(unavailableTools)
|
|
108
|
+
});
|
|
109
|
+
declaredAdditionalTools = true;
|
|
110
|
+
messages.push({
|
|
111
|
+
type: "additional_tools",
|
|
112
|
+
role: "developer",
|
|
113
|
+
tools: convertResponsesTools(tools, options?.toolOptions)
|
|
114
|
+
});
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (toolSupport !== "additions") return;
|
|
118
|
+
const names = tools.map((tool) => tool.name);
|
|
119
|
+
const callId = `pi_tool_load_${shortHash(`${seed}:${names.join(",")}`)}`;
|
|
120
|
+
messages.push({
|
|
121
|
+
type: "tool_search_call",
|
|
122
|
+
call_id: callId,
|
|
123
|
+
execution: "client",
|
|
124
|
+
status: "completed",
|
|
125
|
+
arguments: {
|
|
126
|
+
query: names.join(" "),
|
|
127
|
+
limit: names.length
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
messages.push({
|
|
131
|
+
type: "tool_search_output",
|
|
132
|
+
call_id: callId,
|
|
133
|
+
execution: "client",
|
|
134
|
+
status: "completed",
|
|
135
|
+
tools: convertResponsesTools(tools, {
|
|
136
|
+
...options?.toolOptions,
|
|
137
|
+
toolSearchResult: true
|
|
138
|
+
})
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
const includeInitialSystemMessage = options?.includeSystemPrompt ?? true;
|
|
142
|
+
const pushConfigurationUpdate = (effort) => {
|
|
143
|
+
messages.push({
|
|
144
|
+
type: "configuration_update",
|
|
145
|
+
reasoning: { effort }
|
|
146
|
+
});
|
|
147
|
+
};
|
|
148
|
+
const compat = model.compat;
|
|
149
|
+
const instructionRole = model.reasoning && compat?.supportsDeveloperRole !== false ? "developer" : "system";
|
|
150
|
+
let msgIndex = 0;
|
|
151
|
+
let sourceIndex = 0;
|
|
152
|
+
let systemIndex = 0;
|
|
153
|
+
for (const msg of transformedMessages) {
|
|
154
|
+
const isLeadingSystemMessage = sourceIndex++ === 0 && msg.role === "system";
|
|
155
|
+
if (msg.role === "system") {
|
|
156
|
+
const anchorsToolChanges = systemIndex++ >= transcriptTools.foldedSystemMessages;
|
|
157
|
+
if (anchorsToolChanges) appendSystemToolAdditions(msg, `system:${msgIndex}`);
|
|
158
|
+
if (!isLeadingSystemMessage || includeInitialSystemMessage) {
|
|
159
|
+
const parts = [isLeadingSystemMessage ? getSystemMessageText(msg) : renderSystemMessageUpdate(msg)];
|
|
160
|
+
if (anchorsToolChanges) {
|
|
161
|
+
const added = new Set((msg.toolsAdded ?? []).map((tool) => tool.name));
|
|
162
|
+
const removed = (msg.toolsRemoved ?? []).map((tool) => tool.name).filter((name) => !added.has(name));
|
|
163
|
+
if (removed.length > 0) parts.push(renderToolRemovalNotice(removed));
|
|
164
|
+
for (const name of removed) unavailableTools.add(name);
|
|
165
|
+
}
|
|
166
|
+
const text = parts.filter((part) => part.length > 0).join("\n\n");
|
|
167
|
+
if (text.length > 0) messages.push({
|
|
168
|
+
role: instructionRole,
|
|
169
|
+
content: sanitizeSurrogates(text)
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
} else if (msg.role === "user") {
|
|
173
|
+
if (typeof msg.content === "string") messages.push({
|
|
174
|
+
role: "user",
|
|
175
|
+
content: [{
|
|
176
|
+
type: "input_text",
|
|
177
|
+
text: sanitizeSurrogates(msg.content)
|
|
178
|
+
}]
|
|
179
|
+
});
|
|
180
|
+
else {
|
|
181
|
+
const content = msg.content.map((item) => {
|
|
182
|
+
if (item.type === "text") return {
|
|
183
|
+
type: "input_text",
|
|
184
|
+
text: sanitizeSurrogates(item.text)
|
|
185
|
+
};
|
|
186
|
+
return {
|
|
187
|
+
type: "input_image",
|
|
188
|
+
detail: "auto",
|
|
189
|
+
image_url: `data:${item.mimeType};base64,${item.data}`
|
|
190
|
+
};
|
|
191
|
+
});
|
|
192
|
+
if (content.length === 0) continue;
|
|
193
|
+
messages.push({
|
|
194
|
+
role: "user",
|
|
195
|
+
content
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
} else if (msg.role === "assistant") {
|
|
199
|
+
const output = [];
|
|
200
|
+
const assistantMsg = msg;
|
|
201
|
+
const isSameProviderAndApi = assistantMsg.provider === model.provider && assistantMsg.api === model.api;
|
|
202
|
+
const isSameModel = isSameProviderAndApi && assistantMsg.model === model.id;
|
|
203
|
+
const isDifferentModel = isSameProviderAndApi && assistantMsg.model !== model.id;
|
|
204
|
+
let textBlockIndex = 0;
|
|
205
|
+
for (const block of msg.content) if (block.type === "thinking") {
|
|
206
|
+
if (block.thinkingSignature) {
|
|
207
|
+
const reasoningItem = JSON.parse(block.thinkingSignature);
|
|
208
|
+
output.push(reasoningItem);
|
|
209
|
+
}
|
|
210
|
+
} else if (block.type === "text") {
|
|
211
|
+
const textBlock = block;
|
|
212
|
+
const parsedSignature = parseTextSignature(textBlock.textSignature);
|
|
213
|
+
const fallbackMessageId = textBlockIndex === 0 ? `msg_pi_${msgIndex}` : `msg_pi_${msgIndex}_${textBlockIndex}`;
|
|
214
|
+
textBlockIndex++;
|
|
215
|
+
let msgId = parsedSignature?.id;
|
|
216
|
+
if (!msgId) msgId = fallbackMessageId;
|
|
217
|
+
else if (msgId.length > 64) msgId = `msg_${shortHash(msgId)}`;
|
|
218
|
+
output.push({
|
|
219
|
+
type: "message",
|
|
220
|
+
role: "assistant",
|
|
221
|
+
content: [{
|
|
222
|
+
type: "output_text",
|
|
223
|
+
text: sanitizeSurrogates(textBlock.text),
|
|
224
|
+
annotations: []
|
|
225
|
+
}],
|
|
226
|
+
status: "completed",
|
|
227
|
+
id: msgId,
|
|
228
|
+
phase: parsedSignature?.phase
|
|
229
|
+
});
|
|
230
|
+
} else if (block.type === "toolCall") {
|
|
231
|
+
const toolCall = block;
|
|
232
|
+
const [callId, itemIdRaw] = toolCall.id.split("|");
|
|
233
|
+
const customInputProperty = options?.grammarToolInputProperties?.get(toolCall.name);
|
|
234
|
+
let itemId = itemIdRaw;
|
|
235
|
+
const itemIdPrefix = customInputProperty === void 0 ? "fc_" : "ctc_";
|
|
236
|
+
if (isDifferentModel || !itemId?.startsWith(itemIdPrefix)) itemId = void 0;
|
|
237
|
+
if (customInputProperty !== void 0) output.push({
|
|
238
|
+
type: "custom_tool_call",
|
|
239
|
+
id: itemId,
|
|
240
|
+
call_id: callId,
|
|
241
|
+
name: toolCall.name,
|
|
242
|
+
input: sanitizeSurrogates(getGrammarToolInput(toolCall.name, toolCall.arguments, customInputProperty)),
|
|
243
|
+
...isSameModel && toolCall.namespace !== void 0 ? { namespace: toolCall.namespace } : {}
|
|
244
|
+
});
|
|
245
|
+
else output.push({
|
|
246
|
+
type: "function_call",
|
|
247
|
+
id: itemId,
|
|
248
|
+
call_id: callId,
|
|
249
|
+
name: toolCall.name,
|
|
250
|
+
arguments: JSON.stringify(toolCall.arguments),
|
|
251
|
+
...isSameModel && toolCall.namespace !== void 0 ? { namespace: toolCall.namespace } : {}
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
if (output.length === 0) continue;
|
|
255
|
+
if (options?.configurationUpdateEffort !== void 0 && isSameModel && msg.providerThinkingLevel !== void 0) pushConfigurationUpdate(msg.providerThinkingLevel);
|
|
256
|
+
messages.push(...output);
|
|
257
|
+
} else if (msg.role === "toolResult") {
|
|
258
|
+
const [callId] = msg.toolCallId.split("|");
|
|
259
|
+
const output = convertToolResultOutput(model, msg.content);
|
|
260
|
+
if (options?.grammarToolInputProperties?.has(msg.toolName)) messages.push({
|
|
261
|
+
type: "custom_tool_call_output",
|
|
262
|
+
call_id: callId,
|
|
263
|
+
output
|
|
264
|
+
});
|
|
265
|
+
else messages.push({
|
|
266
|
+
type: "function_call_output",
|
|
267
|
+
call_id: callId,
|
|
268
|
+
output
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
if (!isLeadingSystemMessage) msgIndex++;
|
|
272
|
+
}
|
|
273
|
+
if (options?.configurationUpdateEffort !== void 0) pushConfigurationUpdate(options.configurationUpdateEffort);
|
|
274
|
+
return messages;
|
|
275
|
+
}
|
|
276
|
+
function convertResponsesTools(tools, options) {
|
|
277
|
+
const defaultStrict = options?.strict === void 0 ? false : options.strict;
|
|
278
|
+
const supportsStrictMode = options?.supportsStrictMode ?? true;
|
|
279
|
+
const supportsOpenAIGrammarTools = options?.supportsOpenAIGrammarTools ?? false;
|
|
280
|
+
return tools.map((tool) => {
|
|
281
|
+
const grammar = resolveGrammarConstrainedSampling(tool, supportsOpenAIGrammarTools);
|
|
282
|
+
if (grammar) return {
|
|
283
|
+
type: "custom",
|
|
284
|
+
name: tool.name,
|
|
285
|
+
description: tool.description,
|
|
286
|
+
format: {
|
|
287
|
+
type: "grammar",
|
|
288
|
+
syntax: grammar.format,
|
|
289
|
+
definition: grammar.definition
|
|
290
|
+
},
|
|
291
|
+
...options?.toolSearchResult ? { defer_loading: true } : {}
|
|
292
|
+
};
|
|
293
|
+
const strict = resolveJsonSchemaStrictSampling(tool, supportsStrictMode) ?? defaultStrict;
|
|
294
|
+
const functionTool = {
|
|
295
|
+
type: "function",
|
|
296
|
+
name: tool.name,
|
|
297
|
+
description: tool.description,
|
|
298
|
+
parameters: getJsonSchemaToolParameters(tool, strict === true),
|
|
299
|
+
...options?.toolSearchResult ? { defer_loading: true } : {}
|
|
300
|
+
};
|
|
301
|
+
if (supportsStrictMode) functionTool.strict = strict;
|
|
302
|
+
return functionTool;
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
async function processResponsesStream(openaiStream, output, stream, model, options) {
|
|
306
|
+
let sawTerminalResponseEvent = false;
|
|
307
|
+
const outputSlots = /* @__PURE__ */ new Map();
|
|
308
|
+
const unfinishedToolCalls = /* @__PURE__ */ new Set();
|
|
309
|
+
const reasoningBlocksById = /* @__PURE__ */ new Map();
|
|
310
|
+
const applyMessagePhaseStopReason = (item) => {
|
|
311
|
+
if (item.type === "message" && item.phase === "final_answer") output.stopReason = "stop";
|
|
312
|
+
};
|
|
313
|
+
const getSlot = (outputIndex, type) => {
|
|
314
|
+
const slot = outputSlots.get(outputIndex);
|
|
315
|
+
return slot?.type === type ? slot : void 0;
|
|
316
|
+
};
|
|
317
|
+
const pushToolCallDelta = (slot, delta) => {
|
|
318
|
+
if (delta === void 0) return;
|
|
319
|
+
stream.push({
|
|
320
|
+
type: "toolcall_delta",
|
|
321
|
+
contentIndex: slot.contentIndex,
|
|
322
|
+
delta,
|
|
323
|
+
partial: output
|
|
324
|
+
});
|
|
325
|
+
};
|
|
326
|
+
const createSlot = (outputIndex, item) => {
|
|
327
|
+
if (item.type === "reasoning") {
|
|
328
|
+
const block = {
|
|
329
|
+
type: "thinking",
|
|
330
|
+
thinking: ""
|
|
331
|
+
};
|
|
332
|
+
output.content.push(block);
|
|
333
|
+
const slot = {
|
|
334
|
+
type: "thinking",
|
|
335
|
+
block,
|
|
336
|
+
contentIndex: output.content.length - 1
|
|
337
|
+
};
|
|
338
|
+
outputSlots.set(outputIndex, slot);
|
|
339
|
+
stream.push({
|
|
340
|
+
type: "thinking_start",
|
|
341
|
+
contentIndex: slot.contentIndex,
|
|
342
|
+
partial: output
|
|
343
|
+
});
|
|
344
|
+
return slot;
|
|
345
|
+
}
|
|
346
|
+
if (item.type === "message") {
|
|
347
|
+
applyMessagePhaseStopReason(item);
|
|
348
|
+
const block = {
|
|
349
|
+
type: "text",
|
|
350
|
+
text: ""
|
|
351
|
+
};
|
|
352
|
+
output.content.push(block);
|
|
353
|
+
const slot = {
|
|
354
|
+
type: "text",
|
|
355
|
+
block,
|
|
356
|
+
contentIndex: output.content.length - 1
|
|
357
|
+
};
|
|
358
|
+
outputSlots.set(outputIndex, slot);
|
|
359
|
+
stream.push({
|
|
360
|
+
type: "text_start",
|
|
361
|
+
contentIndex: slot.contentIndex,
|
|
362
|
+
partial: output
|
|
363
|
+
});
|
|
364
|
+
return slot;
|
|
365
|
+
}
|
|
366
|
+
if (item.type === "function_call") {
|
|
367
|
+
const args = new ToolCallArgumentsStream();
|
|
368
|
+
const block = {
|
|
369
|
+
type: "toolCall",
|
|
370
|
+
id: `${item.call_id}|${item.id}`,
|
|
371
|
+
name: item.name,
|
|
372
|
+
arguments: item.arguments ? args.append(item.arguments) : {},
|
|
373
|
+
...item.namespace !== void 0 ? { namespace: item.namespace } : {}
|
|
374
|
+
};
|
|
375
|
+
output.content.push(block);
|
|
376
|
+
unfinishedToolCalls.add(block);
|
|
377
|
+
const slot = {
|
|
378
|
+
type: "toolCall",
|
|
379
|
+
block,
|
|
380
|
+
contentIndex: output.content.length - 1,
|
|
381
|
+
input: {
|
|
382
|
+
kind: "json",
|
|
383
|
+
arguments: args
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
outputSlots.set(outputIndex, slot);
|
|
387
|
+
stream.push({
|
|
388
|
+
type: "toolcall_start",
|
|
389
|
+
contentIndex: slot.contentIndex,
|
|
390
|
+
partial: output
|
|
391
|
+
});
|
|
392
|
+
return slot;
|
|
393
|
+
}
|
|
394
|
+
if (item.type === "custom_tool_call") {
|
|
395
|
+
const inputProperty = options?.grammarToolInputProperties?.get(item.name) ?? "input";
|
|
396
|
+
const input = item.input || "";
|
|
397
|
+
const block = {
|
|
398
|
+
type: "toolCall",
|
|
399
|
+
id: `${item.call_id}|${item.id}`,
|
|
400
|
+
name: item.name,
|
|
401
|
+
arguments: { [inputProperty]: input },
|
|
402
|
+
...item.namespace !== void 0 ? { namespace: item.namespace } : {}
|
|
403
|
+
};
|
|
404
|
+
output.content.push(block);
|
|
405
|
+
unfinishedToolCalls.add(block);
|
|
406
|
+
const slot = {
|
|
407
|
+
type: "toolCall",
|
|
408
|
+
block,
|
|
409
|
+
contentIndex: output.content.length - 1,
|
|
410
|
+
input: customInput(inputProperty, input)
|
|
411
|
+
};
|
|
412
|
+
outputSlots.set(outputIndex, slot);
|
|
413
|
+
stream.push({
|
|
414
|
+
type: "toolcall_start",
|
|
415
|
+
contentIndex: slot.contentIndex,
|
|
416
|
+
partial: output
|
|
417
|
+
});
|
|
418
|
+
return slot;
|
|
419
|
+
}
|
|
420
|
+
};
|
|
421
|
+
const getOrCreateSlot = (outputIndex, item) => {
|
|
422
|
+
return outputSlots.get(outputIndex) ?? createSlot(outputIndex, item);
|
|
423
|
+
};
|
|
424
|
+
const backfillReasoningSignatures = (responseOutput) => {
|
|
425
|
+
for (const item of responseOutput) {
|
|
426
|
+
if (item.type !== "reasoning" || !item.encrypted_content) continue;
|
|
427
|
+
const block = reasoningBlocksById.get(item.id);
|
|
428
|
+
if (!block?.thinkingSignature) continue;
|
|
429
|
+
const storedItem = JSON.parse(block.thinkingSignature);
|
|
430
|
+
if (storedItem.encrypted_content) continue;
|
|
431
|
+
block.thinkingSignature = JSON.stringify({
|
|
432
|
+
...storedItem,
|
|
433
|
+
encrypted_content: item.encrypted_content
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
};
|
|
437
|
+
const finalizeResponse = (response) => {
|
|
438
|
+
sawTerminalResponseEvent = true;
|
|
439
|
+
backfillReasoningSignatures(response.output ?? []);
|
|
440
|
+
if (response?.id) output.responseId = response.id;
|
|
441
|
+
if (response?.usage) {
|
|
442
|
+
const inputDetails = response.usage.input_tokens_details;
|
|
443
|
+
const cachedTokens = inputDetails?.cached_tokens || 0;
|
|
444
|
+
const cacheWriteTokens = inputDetails?.cache_write_tokens || 0;
|
|
445
|
+
output.usage = {
|
|
446
|
+
input: Math.max(0, (response.usage.input_tokens || 0) - cachedTokens - cacheWriteTokens),
|
|
447
|
+
output: response.usage.output_tokens || 0,
|
|
448
|
+
cacheRead: cachedTokens,
|
|
449
|
+
cacheWrite: cacheWriteTokens,
|
|
450
|
+
reasoning: response.usage.output_tokens_details?.reasoning_tokens || 0,
|
|
451
|
+
totalTokens: response.usage.total_tokens || 0,
|
|
452
|
+
cost: {
|
|
453
|
+
input: 0,
|
|
454
|
+
output: 0,
|
|
455
|
+
cacheRead: 0,
|
|
456
|
+
cacheWrite: 0,
|
|
457
|
+
total: 0
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
calculateCost(model, output.usage);
|
|
462
|
+
if (options?.applyServiceTierPricing) {
|
|
463
|
+
const serviceTier = options.resolveServiceTier ? options.resolveServiceTier(response?.service_tier, options.serviceTier) : response?.service_tier ?? options.serviceTier;
|
|
464
|
+
options.applyServiceTierPricing(output.usage, serviceTier);
|
|
465
|
+
}
|
|
466
|
+
const status = response?.status;
|
|
467
|
+
const incompleteDetails = response?.incomplete_details;
|
|
468
|
+
const incompleteReason = typeof incompleteDetails?.reason === "string" ? incompleteDetails.reason : void 0;
|
|
469
|
+
output.rawStopReason = incompleteReason ? `${status}.${incompleteReason}` : status;
|
|
470
|
+
const mappedStop = mapStopReason(status, incompleteReason);
|
|
471
|
+
output.stopReason = mappedStop.stopReason;
|
|
472
|
+
if (mappedStop.errorMessage === void 0) delete output.errorMessage;
|
|
473
|
+
else output.errorMessage = mappedStop.errorMessage;
|
|
474
|
+
if (output.content.some((b) => b.type === "toolCall") && output.stopReason === "stop") output.stopReason = "toolUse";
|
|
475
|
+
};
|
|
476
|
+
for await (const event of openaiStream) {
|
|
477
|
+
await options?.onProviderStreamEvent?.(event, model);
|
|
478
|
+
if (event.type === "response.created") output.responseId = event.response.id;
|
|
479
|
+
else if (event.type === "response.output_item.added") createSlot(event.output_index, event.item);
|
|
480
|
+
else if (event.type === "response.reasoning_summary_text.delta") {
|
|
481
|
+
const slot = getSlot(event.output_index, "thinking");
|
|
482
|
+
if (!slot) continue;
|
|
483
|
+
slot.block.thinking += event.delta;
|
|
484
|
+
stream.push({
|
|
485
|
+
type: "thinking_delta",
|
|
486
|
+
contentIndex: slot.contentIndex,
|
|
487
|
+
delta: event.delta,
|
|
488
|
+
partial: output
|
|
489
|
+
});
|
|
490
|
+
} else if (event.type === "response.reasoning_summary_part.done") {
|
|
491
|
+
const slot = getSlot(event.output_index, "thinking");
|
|
492
|
+
if (!slot) continue;
|
|
493
|
+
slot.block.thinking += "\n\n";
|
|
494
|
+
stream.push({
|
|
495
|
+
type: "thinking_delta",
|
|
496
|
+
contentIndex: slot.contentIndex,
|
|
497
|
+
delta: "\n\n",
|
|
498
|
+
partial: output
|
|
499
|
+
});
|
|
500
|
+
} else if (event.type === "response.reasoning_text.delta") {
|
|
501
|
+
const slot = getSlot(event.output_index, "thinking");
|
|
502
|
+
if (!slot) continue;
|
|
503
|
+
slot.block.thinking += event.delta;
|
|
504
|
+
stream.push({
|
|
505
|
+
type: "thinking_delta",
|
|
506
|
+
contentIndex: slot.contentIndex,
|
|
507
|
+
delta: event.delta,
|
|
508
|
+
partial: output
|
|
509
|
+
});
|
|
510
|
+
} else if (event.type === "response.output_text.delta") {
|
|
511
|
+
const slot = getSlot(event.output_index, "text");
|
|
512
|
+
if (!slot) continue;
|
|
513
|
+
slot.block.text += event.delta;
|
|
514
|
+
stream.push({
|
|
515
|
+
type: "text_delta",
|
|
516
|
+
contentIndex: slot.contentIndex,
|
|
517
|
+
delta: event.delta,
|
|
518
|
+
partial: output
|
|
519
|
+
});
|
|
520
|
+
} else if (event.type === "response.refusal.delta") {
|
|
521
|
+
const slot = getSlot(event.output_index, "text");
|
|
522
|
+
if (!slot) continue;
|
|
523
|
+
slot.block.text += event.delta;
|
|
524
|
+
stream.push({
|
|
525
|
+
type: "text_delta",
|
|
526
|
+
contentIndex: slot.contentIndex,
|
|
527
|
+
delta: event.delta,
|
|
528
|
+
partial: output
|
|
529
|
+
});
|
|
530
|
+
} else if (event.type === "response.function_call_arguments.delta") {
|
|
531
|
+
const slot = getSlot(event.output_index, "toolCall");
|
|
532
|
+
if (slot?.input.kind !== "json") continue;
|
|
533
|
+
slot.block.arguments = slot.input.arguments.append(event.delta);
|
|
534
|
+
pushToolCallDelta(slot, event.delta);
|
|
535
|
+
} else if (event.type === "response.function_call_arguments.done") {
|
|
536
|
+
const slot = getSlot(event.output_index, "toolCall");
|
|
537
|
+
if (slot?.input.kind !== "json") continue;
|
|
538
|
+
const replaced = slot.input.arguments.replace(event.arguments);
|
|
539
|
+
slot.block.arguments = replaced.arguments;
|
|
540
|
+
if (replaced.delta) pushToolCallDelta(slot, replaced.delta);
|
|
541
|
+
} else if (event.type === "response.custom_tool_call_input.delta") {
|
|
542
|
+
const slot = getSlot(event.output_index, "toolCall");
|
|
543
|
+
if (slot?.input.kind !== "custom") continue;
|
|
544
|
+
pushToolCallDelta(slot, appendCustomInput(slot.block, slot.input, event.delta));
|
|
545
|
+
} else if (event.type === "response.custom_tool_call_input.done") {
|
|
546
|
+
const slot = getSlot(event.output_index, "toolCall");
|
|
547
|
+
if (slot?.input.kind !== "custom") continue;
|
|
548
|
+
pushToolCallDelta(slot, closeCustomInput(slot.block, slot.input, event.input));
|
|
549
|
+
} else if (event.type === "response.output_item.done") {
|
|
550
|
+
const item = event.item;
|
|
551
|
+
applyMessagePhaseStopReason(item);
|
|
552
|
+
const slot = getOrCreateSlot(event.output_index, item);
|
|
553
|
+
if (item.type === "reasoning" && slot?.type === "thinking") {
|
|
554
|
+
const summaryText = item.summary?.map((s) => s.text).join("\n\n") || "";
|
|
555
|
+
const contentText = item.content?.map((c) => c.text).join("\n\n") || "";
|
|
556
|
+
slot.block.thinking = summaryText || contentText || slot.block.thinking;
|
|
557
|
+
slot.block.thinkingSignature = JSON.stringify(item);
|
|
558
|
+
reasoningBlocksById.set(item.id, slot.block);
|
|
559
|
+
stream.push({
|
|
560
|
+
type: "thinking_end",
|
|
561
|
+
contentIndex: slot.contentIndex,
|
|
562
|
+
content: slot.block.thinking,
|
|
563
|
+
partial: output
|
|
564
|
+
});
|
|
565
|
+
outputSlots.delete(event.output_index);
|
|
566
|
+
} else if (item.type === "message" && slot?.type === "text") {
|
|
567
|
+
slot.block.text = item.content?.map((c) => c.type === "output_text" ? c.text : c.refusal).join("") || "";
|
|
568
|
+
slot.block.textSignature = encodeTextSignatureV1(item.id, item.phase ?? void 0);
|
|
569
|
+
stream.push({
|
|
570
|
+
type: "text_end",
|
|
571
|
+
contentIndex: slot.contentIndex,
|
|
572
|
+
content: slot.block.text,
|
|
573
|
+
partial: output
|
|
574
|
+
});
|
|
575
|
+
outputSlots.delete(event.output_index);
|
|
576
|
+
} else if (item.type === "function_call" && slot?.type === "toolCall" && slot.input.kind === "json") {
|
|
577
|
+
if (item.arguments) slot.input.arguments.replace(item.arguments);
|
|
578
|
+
Object.assign(slot.block, slot.input.arguments.finish());
|
|
579
|
+
if (item.namespace !== void 0) slot.block.namespace = item.namespace;
|
|
580
|
+
unfinishedToolCalls.delete(slot.block);
|
|
581
|
+
stream.push({
|
|
582
|
+
type: "toolcall_end",
|
|
583
|
+
contentIndex: slot.contentIndex,
|
|
584
|
+
toolCall: slot.block,
|
|
585
|
+
partial: output
|
|
586
|
+
});
|
|
587
|
+
outputSlots.delete(event.output_index);
|
|
588
|
+
} else if (item.type === "custom_tool_call" && slot?.type === "toolCall" && slot.input.kind === "custom") {
|
|
589
|
+
pushToolCallDelta(slot, closeCustomInput(slot.block, slot.input, item.input));
|
|
590
|
+
if (item.namespace !== void 0) slot.block.namespace = item.namespace;
|
|
591
|
+
unfinishedToolCalls.delete(slot.block);
|
|
592
|
+
stream.push({
|
|
593
|
+
type: "toolcall_end",
|
|
594
|
+
contentIndex: slot.contentIndex,
|
|
595
|
+
toolCall: slot.block,
|
|
596
|
+
partial: output
|
|
597
|
+
});
|
|
598
|
+
outputSlots.delete(event.output_index);
|
|
599
|
+
}
|
|
600
|
+
} else if (event.type === "response.completed" || event.type === "response.incomplete") finalizeResponse(event.response);
|
|
601
|
+
else if (event.type === "error") throw new Error(`Error Code ${event.code}: ${event.message}` || "Unknown error");
|
|
602
|
+
else if (event.type === "response.failed") {
|
|
603
|
+
sawTerminalResponseEvent = true;
|
|
604
|
+
output.rawStopReason = event.response?.status;
|
|
605
|
+
const error = event.response?.error;
|
|
606
|
+
const details = event.response?.incomplete_details;
|
|
607
|
+
const msg = error ? `${error.code || "unknown"}: ${error.message || "no message"}` : details?.reason ? `incomplete: ${details.reason}` : "Unknown error (no error details in response)";
|
|
608
|
+
throw new Error(msg);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
if (!sawTerminalResponseEvent) throw new Error("OpenAI Responses stream ended before a terminal response event");
|
|
612
|
+
if (output.stopReason === "toolUse") for (const toolCall of unfinishedToolCalls) throw new Error(`OpenAI Responses stream completed with an unfinished tool call: ${toolCall.name} (${toolCall.id})`);
|
|
613
|
+
}
|
|
614
|
+
/** Stream state of a custom tool call that starts with `initialInput`. */
|
|
615
|
+
function customInput(property, initialInput) {
|
|
616
|
+
const buffer = {
|
|
617
|
+
input: "",
|
|
618
|
+
started: false,
|
|
619
|
+
closed: false
|
|
620
|
+
};
|
|
621
|
+
return {
|
|
622
|
+
kind: "custom",
|
|
623
|
+
property,
|
|
624
|
+
buffer,
|
|
625
|
+
unsent: appendGrammarToolInputJsonDelta(buffer, property, initialInput) ?? ""
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
/** Append to a streaming custom tool input; returns the matching piece of its JSON arguments text. */
|
|
629
|
+
function appendCustomInput(block, input, delta) {
|
|
630
|
+
return sendCustomInput(block, input, appendGrammarToolInputJsonDelta(input.buffer, input.property, delta));
|
|
631
|
+
}
|
|
632
|
+
/** Close a custom tool input with the provider's complete input, if it sent one. */
|
|
633
|
+
function closeCustomInput(block, input, finalInput) {
|
|
634
|
+
return sendCustomInput(block, input, closeGrammarToolInputJson(input.buffer, input.property, finalInput));
|
|
635
|
+
}
|
|
636
|
+
function sendCustomInput(block, input, jsonDelta) {
|
|
637
|
+
block.arguments = { [input.property]: input.buffer.input };
|
|
638
|
+
if (input.unsent === "") return jsonDelta;
|
|
639
|
+
const sent = input.unsent + (jsonDelta ?? "");
|
|
640
|
+
input.unsent = "";
|
|
641
|
+
return sent;
|
|
642
|
+
}
|
|
643
|
+
function mapStopReason(status, incompleteReason) {
|
|
644
|
+
if (!status) return { stopReason: "stop" };
|
|
645
|
+
switch (status) {
|
|
646
|
+
case "completed": return { stopReason: "stop" };
|
|
647
|
+
case "incomplete":
|
|
648
|
+
if (incompleteReason === "max_output_tokens") return { stopReason: "length" };
|
|
649
|
+
return {
|
|
650
|
+
stopReason: "error",
|
|
651
|
+
errorMessage: incompleteReason ? `Response incomplete: ${incompleteReason}` : "Response incomplete without a provider reason"
|
|
652
|
+
};
|
|
653
|
+
case "failed":
|
|
654
|
+
case "cancelled": return { stopReason: "error" };
|
|
655
|
+
case "in_progress":
|
|
656
|
+
case "queued": return { stopReason: "stop" };
|
|
657
|
+
default: throw new Error(`Unhandled stop reason: ${status}`);
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
//#endregion
|
|
661
|
+
export { processResponsesStream as i, convertResponsesTools as n, getResponsesToolSupport as r, convertResponsesMessages as t };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region ../../../node_modules/.pnpm/@earendil-works+pi-ai@1.5.0_@aws-sdk+credential-provider-node@3.972.86_@modelcontextpro_018b33d3c6d4455b3921fdf11f2d0b63/node_modules/@earendil-works/pi-ai/dist/utils/openrouter-cost.js
|
|
2
|
+
function isValidCost(value) {
|
|
3
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
4
|
+
}
|
|
5
|
+
function isOpenRouterModel(model) {
|
|
6
|
+
return model.provider === "openrouter" || model.baseUrl.includes("openrouter.ai");
|
|
7
|
+
}
|
|
8
|
+
/** Replace the catalog total with OpenRouter's billed cost when the response contains complete, valid accounting. */
|
|
9
|
+
function applyOpenRouterReportedCost(usage, reported) {
|
|
10
|
+
if (!isValidCost(reported.cost)) return;
|
|
11
|
+
if (reported.is_byok === false) {
|
|
12
|
+
usage.cost.total = reported.cost;
|
|
13
|
+
usage.cost.totalFromProvider = true;
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (reported.is_byok === true) {
|
|
17
|
+
const details = reported.cost_details;
|
|
18
|
+
if (!details) return;
|
|
19
|
+
let upstreamCost = details.upstream_inference_cost;
|
|
20
|
+
if (upstreamCost === null) {
|
|
21
|
+
if (!isValidCost(details.upstream_inference_prompt_cost) || !isValidCost(details.upstream_inference_completions_cost)) return;
|
|
22
|
+
upstreamCost = details.upstream_inference_prompt_cost + details.upstream_inference_completions_cost;
|
|
23
|
+
}
|
|
24
|
+
if (!isValidCost(upstreamCost)) return;
|
|
25
|
+
usage.cost.total = reported.cost + upstreamCost;
|
|
26
|
+
usage.cost.totalFromProvider = true;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { isOpenRouterModel as n, applyOpenRouterReportedCost as t };
|