@agimon-ai/po-cloudflare 0.0.2-alpha.4 → 0.0.2-alpha.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -6
- package/container/Dockerfile +27 -0
- package/dist/{BrowserWebSocketTransport-C2SC2VeJ.js → BrowserWebSocketTransport-B4heNdrp.js} +1 -1
- package/dist/{NodeWebSocketTransport-CKilJesa.js → NodeWebSocketTransport-BCiOXUEz.js} +2 -2
- package/dist/{abort-signals-Bkmp_euQ.js → abort-signals-BPGaXWA5.js} +1 -1
- package/dist/agent-COvApaVM.js +3878 -0
- package/dist/{anthropic-messages-CkYm8M3V.js → anthropic-messages-BxS7qXqx.js} +291 -63
- package/dist/apiContracts-BCr_ULWJ.js +1603 -0
- package/dist/{approval-Eu7UgGL-.js → approval-Cg-PCa5M.js} +19 -3
- package/dist/{approvalPrompt-Bg1JrEEY.js → approvalPrompt-D7peArNh.js} +1 -2
- package/dist/artifactFiles-CbGIbj93.js +1 -0
- package/dist/assets/assets/{CodeEditorView-rEfljuRK.js → CodeEditorView-J2_5q1WT.js} +2 -2
- package/dist/assets/assets/{abnfDiagram-WEYOIA3C-J6Iu5p17.js → abnfDiagram-WEYOIA3C-_gWnN1r-.js} +2 -2
- package/dist/assets/assets/{architecture-WOLXFQ4H-DKj_xMR1.js → architecture-WOLXFQ4H-DOEVRwUT.js} +1 -1
- package/dist/assets/assets/{architectureDiagram-ZHVYKT53--D1MzuBo.js → architectureDiagram-ZHVYKT53-BI3jFrO0.js} +2 -2
- package/dist/assets/assets/{blockDiagram-RJAE7QA3-CrWO0t-Q.js → blockDiagram-RJAE7QA3-B_PkpROK.js} +2 -2
- package/dist/assets/assets/{c4Diagram-XDPPPE54-CBMOJREz.js → c4Diagram-XDPPPE54-DhSjpw5T.js} +2 -2
- package/dist/assets/assets/channel-CVgc46nD.js +2 -0
- package/dist/assets/assets/{chunk-2E7WHVMD-CR9NMk46.js → chunk-2E7WHVMD-BrDo2biY.js} +2 -2
- package/dist/assets/assets/{chunk-4EMNKR2T-B4D0falO.js → chunk-4EMNKR2T-CdlJ35FL.js} +2 -2
- package/dist/assets/assets/{chunk-55XCU76K-CKrttFen.js → chunk-55XCU76K-D9eb1FTZ.js} +2 -2
- package/dist/assets/assets/{chunk-7S6XSTFO-BPNrdjSb.js → chunk-7S6XSTFO-VVyUsBaV.js} +2 -2
- package/dist/assets/assets/{chunk-AQDTSKZB-Ddx2gPU_.js → chunk-AQDTSKZB-DJmW9j7o.js} +2 -2
- package/dist/assets/assets/{chunk-DSNLSHJZ-iQg3RbZ_.js → chunk-DSNLSHJZ-bQ4kpxiE.js} +2 -2
- package/dist/assets/assets/{chunk-HAGFOTED-CGlDRwnk.js → chunk-HAGFOTED-CXTtS6oc.js} +2 -2
- package/dist/assets/assets/{chunk-HNE4Q36P-CN7VMEsn.js → chunk-HNE4Q36P-CjJ9StOJ.js} +2 -2
- package/dist/assets/assets/{chunk-NQOKRVIF-DQKmIS4j.js → chunk-NQOKRVIF-CEttWQFT.js} +2 -2
- package/dist/assets/assets/{chunk-UHW7PFBP-BKSG_d1a.js → chunk-UHW7PFBP-CJZzmAtC.js} +2 -2
- package/dist/assets/assets/{chunk-VQ5W62QI-AbFHiDOg.js → chunk-VQ5W62QI-Bp76YSjS.js} +2 -2
- package/dist/assets/assets/{chunk-WQQL4CDK-C5a4DmCb.js → chunk-WQQL4CDK-wm0yUUcN.js} +2 -2
- package/dist/assets/assets/chunk-XXDRQBXY-BkEG_5cB.js +2 -0
- package/dist/assets/assets/{chunk-YZO67HFG-UbKezTdY.js → chunk-YZO67HFG-BmXRKyV5.js} +2 -2
- package/dist/assets/assets/{chunk-ZAUX2LTX-BShGGpRc.js → chunk-ZAUX2LTX-DJCmQeWP.js} +2 -2
- package/dist/assets/assets/{chunk-ZCHMQSOR-BmV-PDP0.js → chunk-ZCHMQSOR-D3pxm97L.js} +2 -2
- package/dist/assets/assets/{classDiagram-v2-4MYWR3UA-DB-cfBNq.js → classDiagram-v2-4MYWR3UA-DxMxFm6d.js} +2 -2
- package/dist/assets/assets/{cose-bilkent-JH36ORCC-Dprqh48h.js → cose-bilkent-JH36ORCC-Ck_lCjTR.js} +2 -2
- package/dist/assets/assets/{cynefin-EF2NZ3EQ-Bz4CND4n.js → cynefin-EF2NZ3EQ-CgjU58bC.js} +1 -1
- package/dist/assets/assets/{cynefinDiagram-WF24UDRP-Cv0Tq-0q.js → cynefinDiagram-WF24UDRP-CUP0NVKn.js} +2 -2
- package/dist/assets/assets/{dagre-NK4GIZVX-H4d8oeNm.js → dagre-NK4GIZVX-DkvcOoGp.js} +2 -2
- package/dist/assets/assets/{diagram-CBK3MWTC-D75OthTM.js → diagram-CBK3MWTC-CFl4wUVN.js} +2 -2
- package/dist/assets/assets/{diagram-I5XIIV2D-CB_W2jXU.js → diagram-I5XIIV2D-CldqmFr0.js} +2 -2
- package/dist/assets/assets/{diagram-ODIL2UCW-DPO0lYZ-.js → diagram-ODIL2UCW-CPieOVfl.js} +2 -2
- package/dist/assets/assets/{diagram-PFBEJUXE-DJ9olXAC.js → diagram-PFBEJUXE-DgTWsRKS.js} +2 -2
- package/dist/assets/assets/{diagram-RJA3I4VV-DL3974PI.js → diagram-RJA3I4VV-DmxD5RVL.js} +2 -2
- package/dist/assets/assets/{diagram-TYUNFSNR-ZuYESp4p.js → diagram-TYUNFSNR-DC_QoE9Q.js} +2 -2
- package/dist/assets/assets/{dist-CeotBqYt.js → dist-BoXKbh_9.js} +2 -2
- package/dist/assets/assets/{dist-CdrEbsAL.js → dist-C-aQ-0ab.js} +2 -2
- package/dist/assets/assets/{dist-CXqaT1wB.js → dist-CHKWIm0j.js} +2 -2
- package/dist/assets/assets/{dist-BnkGKHOV.js → dist-CeZ4Dyeb.js} +2 -2
- package/dist/assets/assets/{dist-C8iSs-hT.js → dist-DtfkqVX-.js} +2 -2
- package/dist/assets/assets/{dist-G3vL_xw7.js → dist-JVpnlOn0.js} +2 -2
- package/dist/assets/assets/{dist-DvCNYjgK.js → dist-L_xVrjFQ.js} +2 -2
- package/dist/assets/assets/{dist-zXhaMKmO.js → dist-_Q_eXWhh.js} +2 -2
- package/dist/assets/assets/{dist-D2iSi_lg.js → dist-m3yHSyxW.js} +2 -2
- package/dist/assets/assets/{ebnfDiagram-V4P3TTPT-DNfHKEsm.js → ebnfDiagram-V4P3TTPT-BdrqTmnC.js} +2 -2
- package/dist/assets/assets/{elk-QONTBCTQ-C0FX9D60.js → elk-QONTBCTQ-BBnxKz3T.js} +2 -2
- package/dist/assets/assets/{erDiagram-KYQIGQAA-BI1O9lW0.js → erDiagram-KYQIGQAA-DX45_hK2.js} +2 -2
- package/dist/assets/assets/{eventmodeling-K75KTNOO-BmWt-aOv.js → eventmodeling-K75KTNOO-EIuQjWpD.js} +1 -1
- package/dist/assets/assets/flowDiagram-IUGLLWBU-Bdol35Vj.js +1 -0
- package/dist/assets/assets/{ganttDiagram-R7GPNTJY-pM7PmQ6B.js → ganttDiagram-R7GPNTJY-CveiRngd.js} +2 -2
- package/dist/assets/assets/{gitGraph-VSP46ZUC-D0QXMQxv.js → gitGraph-VSP46ZUC-D4yRXN3j.js} +1 -1
- package/dist/assets/assets/{gitGraphDiagram-PDYL7XHY-BsMltgt3.js → gitGraphDiagram-PDYL7XHY-D5DsbgCK.js} +2 -2
- package/dist/assets/assets/index-BDUEIar6.css +1 -0
- package/dist/assets/assets/index-BfW-zJ-Y.js +200 -0
- package/dist/assets/assets/{info-OHQRW6UA-Dp5Eu5PX.js → info-OHQRW6UA-C0PnFIek.js} +1 -1
- package/dist/assets/assets/{infoDiagram-MVDRKAX5-TgXRfZiq.js → infoDiagram-MVDRKAX5-DpwE-14N.js} +2 -2
- package/dist/assets/assets/{ishikawaDiagram-HPEHV2GE-Qzrmih4p.js → ishikawaDiagram-HPEHV2GE-X1GxSc7S.js} +2 -2
- package/dist/assets/assets/{journeyDiagram-BOSHW7O7-BksI3QOT.js → journeyDiagram-BOSHW7O7-0cwzSgYT.js} +2 -2
- package/dist/assets/assets/{kanban-definition-FNSA4HC5-l_IuN5_k.js → kanban-definition-FNSA4HC5-C-U-zp3B.js} +2 -2
- package/dist/assets/assets/{line-BDKssGoM.js → line-CxMWkCyB.js} +2 -2
- package/dist/assets/assets/{linear-C9vmtzBC.js → linear-BpB8rX3C.js} +2 -2
- package/dist/assets/assets/{mermaid-parser.core-O1yFX7K_.js → mermaid-parser.core-CmAfQFuk.js} +4 -4
- package/dist/assets/assets/{mermaid.core-CIq57361.js → mermaid.core-BTk7Bw6z.js} +5 -5
- package/dist/assets/assets/{mindmap-definition-6OY57UG3-BkVuZ010.js → mindmap-definition-6OY57UG3-B2sMo2jC.js} +2 -2
- package/dist/assets/assets/{packet-JDAUHWVQ-PPNcSWeV.js → packet-JDAUHWVQ-BzzVSUon.js} +1 -1
- package/dist/assets/assets/{pegDiagram-ECIUJNBX-ClwrHXhM.js → pegDiagram-ECIUJNBX-VIiN2lIU.js} +2 -2
- package/dist/assets/assets/{pie-XZMESJXO-BAE4Cy9j.js → pie-XZMESJXO-B-jSi7x9.js} +1 -1
- package/dist/assets/assets/{pieDiagram-GNMPY74T-CvQ62Knb.js → pieDiagram-GNMPY74T-190bpqyE.js} +2 -2
- package/dist/assets/assets/{quadrantDiagram-D57K4MC3-CzAyT5ZB.js → quadrantDiagram-D57K4MC3-CHsQo88q.js} +2 -2
- package/dist/assets/assets/{radar-ABXABTNO-CoEe8B7b.js → radar-ABXABTNO-CW2EglFo.js} +1 -1
- package/dist/assets/assets/{railroad-I3PHUGI6-BbK5J8H5.js → railroad-I3PHUGI6-C1b0ftsy.js} +1 -1
- package/dist/assets/assets/{railroad-abnf-LNEFI6M7-DlGngfop.js → railroad-abnf-LNEFI6M7-DTT_CP-y.js} +1 -1
- package/dist/assets/assets/{railroad-ebnf-DWYD2UWJ-BRk4ifMx.js → railroad-ebnf-DWYD2UWJ-RCPkVVI9.js} +1 -1
- package/dist/assets/assets/{railroad-peg-JR7BVNR7-Rz-3vbj2.js → railroad-peg-JR7BVNR7-DixVu6c8.js} +1 -1
- package/dist/assets/assets/{railroadDiagram-Y72NRBL7-DQISBRHH.js → railroadDiagram-Y72NRBL7-DbdG32pF.js} +2 -2
- package/dist/assets/assets/{requirementDiagram-EQYSW5RA-DcK4FnTB.js → requirementDiagram-EQYSW5RA-U_x9QFHY.js} +2 -2
- package/dist/assets/assets/{sankeyDiagram-SY24JHO5-N2EXBOYb.js → sankeyDiagram-SY24JHO5-qfiLv1KI.js} +2 -2
- package/dist/assets/assets/{sequenceDiagram-BLEHNHQU-CMJ2EqC_.js → sequenceDiagram-BLEHNHQU-DMBomC37.js} +2 -2
- package/dist/assets/assets/{src-Df9VBjd7.js → src-DaNTNLrJ.js} +2 -2
- package/dist/assets/assets/{stateDiagram-v2-A6IESKWZ-D6Cxm8wj.js → stateDiagram-v2-A6IESKWZ-BgAnpbx_.js} +2 -2
- package/dist/assets/assets/{swimlanes-B3ENRKFQ-BybuzSPd.js → swimlanes-B3ENRKFQ-Dihe5c6o.js} +2 -2
- package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-Cgg-RsbC.js +9 -0
- package/dist/assets/assets/{timeline-definition-JXYKGLGB-BzjkWUdz.js → timeline-definition-JXYKGLGB-BISDYTXW.js} +2 -2
- package/dist/assets/assets/{treeView-D4JQ5SDB-DIDWwDtU.js → treeView-D4JQ5SDB-DMSWtiHi.js} +1 -1
- package/dist/assets/assets/{treemap-SAJKECNS-SWP4JszI.js → treemap-SAJKECNS-0SsdPE-3.js} +1 -1
- package/dist/assets/assets/{usecaseDiagram-WPOLBNNX-ZfCxSJdE.js → usecaseDiagram-WPOLBNNX-CY0WaaL_.js} +2 -2
- package/dist/assets/assets/{vennDiagram-Q3Y3IDCW-o44wkgGH.js → vennDiagram-Q3Y3IDCW-DXXcHfKI.js} +2 -2
- package/dist/assets/assets/{wardley-7MLQ67FV-0zKRsI4Z.js → wardley-7MLQ67FV-BzVdmZfO.js} +1 -1
- package/dist/assets/assets/{wardleyDiagram-IVAIDKWA-CyBVyB40.js → wardleyDiagram-IVAIDKWA-BiDG6ka7.js} +2 -2
- package/dist/assets/assets/{webpack-C4nkEwJD.js → webpack-CUCfmjk-.js} +2 -2
- package/dist/assets/assets/{xychartDiagram-4URNHDU4-BMvRihYC.js → xychartDiagram-4URNHDU4-DTR1zwTC.js} +2 -2
- package/dist/assets/bundle-asset-policy.json +1 -1
- package/dist/assets/index.html +8 -2
- package/dist/assets/plugins/assets/base-LmdY6uBA.css +2 -0
- package/dist/assets/plugins/assets/browserCaptureWorklet-Droj0fW0-Droj0fW0.js +13 -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-Ka6K4y6i.js +1 -0
- package/dist/assets/plugins/compositions.json +1 -1
- package/dist/assets/plugins/slots/approval.dd60ec90-D_Iw2VJn.js +2 -0
- package/dist/assets/plugins/slots/artifacts.a078f1a5-CS9a_zNA.js +1 -0
- package/dist/assets/plugins/slots/author.497633d0-BFa_H5ZE.js +93 -0
- package/dist/assets/plugins/slots/autocompact.86aeccf4-B0hGnck7.js +1 -0
- package/dist/assets/plugins/slots/browse.5fcf164c-CVRtiGzR.js +1 -0
- package/dist/assets/plugins/slots/builtin-tools.0a7f0b8e-CJTf-98P.js +7 -0
- package/dist/assets/plugins/slots/codemode.ff16ac06-BRYQKsyR.js +11 -0
- package/dist/assets/plugins/slots/domain.3ddea842-02QPrhJk.js +1 -0
- package/dist/assets/plugins/slots/edit.c5b0b072-CETRuGf0.js +7 -0
- package/dist/assets/plugins/slots/files.8ffcdcc0-DgGX5poR.js +2 -0
- package/dist/assets/plugins/slots/goal.423c7a26-D67j7FqW.js +1 -0
- package/dist/assets/plugins/slots/grep.95f470b3-CmhMD_DW.js +1 -0
- package/dist/assets/plugins/slots/help.03b9ba99-os14i52k.js +3 -0
- package/dist/assets/plugins/slots/log.19bda339-DvprmzHk.js +4 -0
- package/dist/assets/plugins/slots/mcp.ffbe405a-CcCIF5cJ.js +109 -0
- package/dist/assets/plugins/slots/plan.5eac6563-CqYx6E9R.js +3 -0
- package/dist/assets/plugins/slots/{profile.ab16dcec-Cu6ev2uW.js → profile.176710dd-BDgBh-Su.js} +1 -1
- package/dist/assets/plugins/slots/prompts.2c187969-Bls5s3m1.js +3 -0
- package/dist/assets/plugins/slots/read.1629d556-Bg9NIMAZ.js +1 -0
- package/dist/assets/plugins/slots/runner.962030e5-_04Fb699.js +8 -0
- package/dist/assets/plugins/slots/sessions.fc763f42-BaHBIWGm.js +1 -0
- package/dist/assets/plugins/slots/skill.f5396fde-MNxJbIRc.js +4 -0
- package/dist/assets/plugins/slots/subagents.d815a296-DNYKN2_3.js +7 -0
- package/dist/assets/plugins/slots/vault.57fd9047-C3YDx6j4.js +1 -0
- package/dist/assets/plugins/slots/voice.b709d05c-BT788wX1.js +1 -0
- package/dist/assets/pwa/pwa.js +12 -12
- package/dist/assets/pwa/sw.js +4 -4
- package/dist/{atomicJson-DwSqByUJ.js → atomicJson-CU27fWtF.js} +2 -3
- package/dist/{azure-openai-config-DHMgdIa-.js → azure-openai-config-DkmTos8T.js} +2 -2
- package/dist/{azure-openai-responses-CTgRdQ4m.js → azure-openai-responses-sm_U3omr.js} +13 -13
- package/dist/backgroundWork-C3TYOD5X.js +49 -0
- package/dist/browser-BWf8OMfl.js +3 -0
- package/dist/{browser-EJ5_ffnN.js → browser-IsHIcvFg.js} +1 -1
- package/dist/childSession-Cf2-kH4O.js +22 -0
- package/dist/{classifier-shared-jXm-plIK.js → classifier-shared-B7BdEyPa.js} +5 -5
- package/dist/{cloudflare-workers-ai-system-one-B0wH6HU5.js → cloudflare-workers-ai-system-one-DpnCKwVj.js} +3 -3
- package/dist/{codemode-yHAHBZO-.js → codemode-CU_gontV.js} +5 -2
- package/dist/contracts-B_eb2dl9.js +19 -0
- package/dist/contracts-mVtrvUmY.js +40 -0
- package/dist/{diagnostics-DPTP-yrt.js → diagnostics-C43OHsIc.js} +2 -2
- package/dist/{server-y9pjeHJM.js → dist-B-vqs6tA.js} +1 -546
- package/dist/{dist-Dvx5mlIR.js → dist-CLdzaXdw.js} +16 -3
- package/dist/{dist-BVBi6VMV.js → dist-CfOWb6f7.js} +1 -1
- package/dist/{dist-PDDFdqDX.js → dist-Dd6zUvjw.js} +1 -1
- package/dist/edge-accj222e.js +266 -0
- package/dist/{emscripten-module.cloudflare-D4Bc9Ykz.js → emscripten-module.cloudflare-B4fhfquU.js} +1 -1
- package/dist/{env-api-keys-CAnjjnsR.js → env-api-keys-CSPKWgJn.js} +1 -1
- package/dist/{error-body-DQZRsyL5.js → error-body-BvLDKbXN.js} +26 -4
- package/dist/esm-BKJy3O9-.js +1553 -0
- package/dist/{exports-CrJqsTU6.js → exports-BlsXYnB_.js} +27 -9
- package/dist/{remoteMcp-Ci8crSU9.js → exports-CHx8bsjQ.js} +1062 -176
- package/dist/exports-CUM-AowA.js +34 -0
- package/dist/extensionFile-Bf1PbYVu.js +121 -0
- package/dist/{factory-Cs8iaUtc.js → factory-DwoANAyi.js} +1 -1
- package/dist/{github-copilot-headers-DpQQAh-s.js → github-copilot-headers-CZIImZmD.js} +1 -1
- package/dist/{google-generative-ai-BTTOo5RQ.js → google-generative-ai-P4ubvgcU.js} +9 -9
- package/dist/{google-shared-S7bqOccz.js → google-shared-C8Kez75I.js} +6 -6
- package/dist/{google-vertex-BcMU_DMb.js → google-vertex-T1trcCEz.js} +10 -10
- package/dist/{domains-dHfk2U8X.js → harnessState-DMini_AN.js} +175 -16
- package/dist/{harnessStore-CRtlTdbI.js → harnessStore-CTomNyVl.js} +4 -5
- package/dist/{hash-B3RRpLS2.js → hash-CMLRVP3c.js} +1 -1
- package/dist/{headers-BEuxFxDI.js → headers-CX-ZuPIi.js} +1 -1
- package/dist/help-BxTDP41H.js +1 -0
- package/dist/help-C4aC-kWh.js +100 -0
- package/dist/http-4lVtjwa7.js +59 -0
- package/dist/{hubChannel-Cj1iF847.js → hubChannel-Bq4zyVgX.js} +12 -29
- package/dist/hubRevisions-BknPawK7.js +364 -0
- package/dist/{identity-BIeAyilV.js → identity-DEwhWpjw.js} +3 -3
- package/dist/index.edge-ClLTmPFz.js +191 -0
- package/dist/index.edge-CwcYQLj9.js +70 -0
- package/dist/index.edge-D2RirEwK.js +14 -0
- package/dist/index.edge-Dw11TL5F.js +56 -0
- package/dist/index.edge-DyUqSroq.js +67 -0
- package/dist/index.edge-Ts1NG9b4.js +937 -0
- package/dist/iso-BCXA5x1w.js +10 -0
- package/dist/{kysely-adapter-D51abb3q.js → kysely-adapter-D3TQ9BKb.js} +1 -1
- package/dist/{layeredConfig-BqIwPJ-I.js → layeredConfig-DVe-JMGQ.js} +217 -24
- package/dist/{majorModes-C-OD4PBc.js → majorModes-BBT0wftm.js} +4 -14
- package/dist/majorModes-BcA8pk7t.js +1 -0
- package/dist/{mcpProjection-BsP0IEnb.js → mcpProjection-BZoy_uKa.js} +1 -2
- package/dist/{mistral-conversations-DN8VSERk.js → mistral-conversations-jEBsA1Xz.js} +12 -12
- package/dist/modeDefinition-C3Zbrw48.js +44 -0
- package/dist/{models-D6d73jcW.js → models-BoBYu6VI.js} +41 -46
- package/dist/narration-BtGsZwE7.js +127 -0
- package/dist/{node-UuMT2C3q.js → node-CdIUdDAa.js} +2 -2
- package/dist/{node-DytJOfYf.js → node-CjBe953N.js} +2 -2
- package/dist/notification-BHaYyLJJ.js +101 -0
- package/dist/{openai-bt3ZRBZv.js → openai-69NOv-G_.js} +187 -187
- package/dist/{openai-codex-responses-cL36x0ml.js → openai-codex-responses-x01Vnd68.js} +21 -25
- package/dist/{openai-completions-BWsTNYyT.js → openai-completions-B81ryS-E.js} +26 -19
- package/dist/{openai-decisions-Dfn_KgQd.js → openai-decisions-Kybq6lsr.js} +3 -3
- package/dist/{openai-responses-aa0LoyCJ.js → openai-responses-BK5Zz1Ib.js} +17 -15
- package/dist/{openai-responses-shared-H-jH5SlM.js → openai-responses-shared-b4nN_ZS7.js} +7 -7
- package/dist/{openrouter-cost-D99Qqcs6.js → openrouter-cost-C4M4CjUF.js} +1 -1
- package/dist/{openrouter-images-BpwVpALC.js → openrouter-images-DMMiksXo.js} +7 -7
- package/dist/photon_rs_bg.wasm +0 -0
- package/dist/{pi-messages-BHAIkYBj.js → pi-messages-D3F6NGQb.js} +6 -6
- package/dist/piConfig-BeRtzEWI.js +126 -0
- package/dist/piSettings-CDcdxob2.js +1 -0
- package/dist/platform-CAhzdBhg.js +113 -0
- package/dist/pluginContributions-Be9EnCAW.js +16 -0
- package/dist/pluginProtocol-ZOY2-HIL.js +136 -0
- package/dist/{protocol-Xpm_mCNN.js → protocol-Db1l1xpe.js} +1 -2
- package/dist/{provider-env-DgfpjgTa.js → provider-env-C6KlbHmf.js} +2 -2
- package/dist/{provider-retry-ChD-K2Gv.js → provider-retry-C8AvzuUi.js} +1 -1
- package/dist/{puppeteer-cloudflare-B-GHrPGO.js → puppeteer-cloudflare-D4l8smMS.js} +3 -3
- package/dist/{rolldown-runtime-B-lAHAz2.js → rolldown-runtime-DbVrKiKs.js} +1 -1
- package/dist/{sanitize-unicode-Dl4ROF7y.js → sanitize-unicode-Di-31Zpn.js} +1 -1
- package/dist/{schemas-Vj8-rCR4.js → schemas-BMBR99Q5.js} +3 -2
- package/dist/server-4R5ZprW5.js +978 -0
- package/dist/server-B0PFs3Yl.js +288 -0
- package/dist/server-B4f5d7ka.js +1811 -0
- package/dist/server-BQ0I9oeZ.js +1359 -0
- package/dist/server-BZ_bk5i9.js +295 -0
- package/dist/{server-CUvohcAm.js → server-Ba7pnDkx.js} +54 -47
- package/dist/server-BayLsR7Z.js +343 -0
- package/dist/{server-BccTx_r6.js → server-BbNo0APc.js} +121 -19
- package/dist/server-Bi9VOAOP.js +833 -0
- package/dist/{server-De_PIOty.js → server-BkmcRLIT.js} +47 -27
- package/dist/{server-DwWTQg1J.js → server-BwtSRROE.js} +14 -5
- package/dist/server-BxzzL3_G.js +1883 -0
- package/dist/{server-CYQHzqaQ.js → server-By1ctEvA.js} +11 -9
- package/dist/server-CA5TuWDo.js +3125 -0
- package/dist/{server-C1ijZQp4.js → server-CBHlRlm4.js} +3 -10
- package/dist/server-CDypk2xJ.js +1296 -0
- package/dist/server-ChlBgWIn.js +1116 -0
- package/dist/server-CkMqSsYi.js +15105 -0
- package/dist/server-CnsLcuj-.js +1518 -0
- package/dist/server-CrqcdtBx.js +178 -0
- package/dist/server-CwlDZ2N-.js +491 -0
- package/dist/server-D3j7dywQ.js +576 -0
- package/dist/server-DXD7cbH0.js +679 -0
- package/dist/server-DesEguVZ.js +640 -0
- package/dist/server-Dqjcc8p0.js +2656 -0
- package/dist/{server-BPvd3Ya5.js → server-DrmY-Chg.js} +570 -127
- package/dist/{server-B2xd7WTP.js → server-DtCOCPGp.js} +9 -20
- package/dist/server-DuAckacI.js +1522 -0
- package/dist/server-EgPpwMaj.js +505 -0
- package/dist/server-h0TSZCjm.js +189 -0
- package/dist/serverPlugin-Cx6a5RT0.js +36624 -0
- package/dist/session-resources-DLg07yAP.js +10 -0
- package/dist/{sessionConfig-2a4LWInR.js → sessionConfig-6NVRcVwL.js} +615 -766
- package/dist/{simple-options-DWrW31_K.js → simple-options-DM-a_ljY.js} +13 -6
- package/dist/{streaming-json-t4rzNHEp.js → streaming-json-Bs_lERVE.js} +6 -6
- package/dist/{system-one-shared-DLVLdzYL.js → system-one-shared-B63vQ3Om.js} +3 -3
- package/dist/{notification-D76PSL7r.js → telemetry-CrTcxeA5.js} +2 -93
- package/dist/{transform-messages-CjTSwW9q.js → transform-messages-Bbr4sgbB.js} +3 -16
- package/dist/truncate-M3KbFyVj.js +89 -0
- package/dist/{server-DrZBZ17y.js → type-CuAiPMD4.js} +569 -1409
- package/dist/type-yokaDI_F.js +7 -0
- package/dist/{typesafe-system-one-DBVcjcUQ.js → typesafe-system-one-7g930h9C.js} +3 -3
- package/dist/{uuid-mkNGilLv.js → uuid-D5Z4Ivdo.js} +1 -1
- package/dist/{validation-D77NZBrx.js → validation-DesEfRe-.js} +8 -3
- package/dist/vaultSettings-BdkqnmJf.js +292 -0
- package/dist/voiceTools-Chad-LEE.js +246 -0
- package/dist/web-QeFwt_Vl.js +3 -0
- package/dist/worker.js +56560 -35339
- package/dist/workflow-BLBCriNp.js +113 -0
- package/package.json +44 -25
- package/wrangler.jsonc +13 -3
- package/dist/apiContracts-CHOiCbS_.js +0 -4451
- package/dist/assets/assets/channel-CNegK3Rr.js +0 -2
- package/dist/assets/assets/chunk-XXDRQBXY-BbVKQGnw.js +0 -2
- package/dist/assets/assets/flowDiagram-IUGLLWBU-DQj3H5a6.js +0 -1
- package/dist/assets/assets/index-BTHzc8EN.js +0 -155
- package/dist/assets/assets/index-DZM68mTk.css +0 -1
- package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-CXJkO6sc.js +0 -9
- package/dist/assets/plugins/assets/base-B5jpmLBl.css +0 -2
- package/dist/assets/plugins/chunks/po-web-runtime-D4qQFtJO.js +0 -1
- package/dist/assets/plugins/slots/approval.09e72f36-Cck_K9ex.js +0 -2
- package/dist/assets/plugins/slots/artifacts.50b639bb-BZM7uEbe.js +0 -1
- package/dist/assets/plugins/slots/builtin-tools.75108f21-EWWGTveL.js +0 -7
- package/dist/assets/plugins/slots/codemode.c58fb583-CgfTL6kt.js +0 -9
- package/dist/assets/plugins/slots/domain.753f9f92-BU0ilfwM.js +0 -1
- package/dist/assets/plugins/slots/mcp.82cc1ff5-BaCD2xZB.js +0 -109
- package/dist/assets/plugins/slots/skill.62a0a1b3-Bz20F1eA.js +0 -4
- package/dist/backgroundWork-bE3pc-R9.js +0 -25
- package/dist/build-2gFaVEfG.js +0 -3355
- package/dist/contextProjection-DVP2Vc5j.js +0 -188
- package/dist/extensionFile-CY4EFNHQ.js +0 -409
- package/dist/harnessState-gmzJcPGt.js +0 -88
- package/dist/harnessStore-DZ4lDIq6.js +0 -1
- package/dist/index.edge-BgSx_gRO.js +0 -45
- package/dist/majorModes-AYZvnOpU.js +0 -1
- package/dist/piSettings-B6fsgIBA.js +0 -1
- package/dist/platform-CNhm9zLi.js +0 -16
- package/dist/platformFiles-3rzOh9cg.js +0 -39
- package/dist/server-Bf3_VTkt.js +0 -592
- package/dist/server-BmAziQml.js +0 -657
- package/dist/server-BvV-GqDO.js +0 -280
- package/dist/server-xiuzwJ1C.js +0 -118
- package/dist/serverPlugin-H4T49sac.js +0 -3347
- package/dist/value-Djvc2foV.js +0 -2247
|
@@ -1,25 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as
|
|
3
|
-
import { n as
|
|
4
|
-
import { t as uuidv7 } from "./uuid-
|
|
5
|
-
import { i as AssistantMessageEventStream, n as createAssistantMessageDiagnostic, r as formatThrownValue, t as appendAssistantMessageDiagnostic } from "./diagnostics-
|
|
6
|
-
import { t as getProviderEnvValue } from "./provider-env-
|
|
7
|
-
import { t as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
1
|
+
import { n as getIdentityHeaders, s as getSystemMessageText } from "./identity-DEwhWpjw.js";
|
|
2
|
+
import { n as buildBaseOptions } from "./simple-options-DM-a_ljY.js";
|
|
3
|
+
import { _ as normalizeContext, g as getInitialSystemMessage, h as getDeclaredTools, n as clampThinkingLevel, v as resolveTranscript, y as resolveTranscriptTools } from "./models-BoBYu6VI.js";
|
|
4
|
+
import { t as uuidv7 } from "./uuid-D5Z4Ivdo.js";
|
|
5
|
+
import { i as AssistantMessageEventStream, n as createAssistantMessageDiagnostic, r as formatThrownValue, t as appendAssistantMessageDiagnostic } from "./diagnostics-C43OHsIc.js";
|
|
6
|
+
import { t as getProviderEnvValue } from "./provider-env-C6KlbHmf.js";
|
|
7
|
+
import { t as registerSessionResourceCleanup } from "./session-resources-DLg07yAP.js";
|
|
8
|
+
import { n as normalizeProviderError, t as formatProviderError } from "./error-body-BvLDKbXN.js";
|
|
9
|
+
import { t as headersToRecord } from "./headers-CX-ZuPIi.js";
|
|
10
|
+
import { a as createGrammarToolInputProperties } from "./transform-messages-Bbr4sgbB.js";
|
|
10
11
|
import { t as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-Bc6qNWt0.js";
|
|
11
|
-
import { i as processResponsesStream, n as convertResponsesTools, r as getResponsesToolSupport, t as convertResponsesMessages } from "./openai-responses-shared-
|
|
12
|
-
import { t as combineAbortSignals } from "./abort-signals-
|
|
13
|
-
//#region ../../../node_modules/.pnpm/@earendil-works+pi-ai@1.5.
|
|
14
|
-
const sessionResourceCleanups = /* @__PURE__ */ new Set();
|
|
15
|
-
function registerSessionResourceCleanup(cleanup) {
|
|
16
|
-
sessionResourceCleanups.add(cleanup);
|
|
17
|
-
return () => {
|
|
18
|
-
sessionResourceCleanups.delete(cleanup);
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
//#endregion
|
|
22
|
-
//#region ../../../node_modules/.pnpm/@earendil-works+pi-ai@1.5.0_@aws-sdk+credential-provider-node@3.972.86_@modelcontextpro_cbd356c737d8e30c7d704b4728fb9233/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.js
|
|
12
|
+
import { i as processResponsesStream, n as convertResponsesTools, r as getResponsesToolSupport, t as convertResponsesMessages } from "./openai-responses-shared-b4nN_ZS7.js";
|
|
13
|
+
import { t as combineAbortSignals } from "./abort-signals-BPGaXWA5.js";
|
|
14
|
+
//#region ../../../node_modules/.pnpm/@earendil-works+pi-ai@1.5.1_@aws-sdk+credential-provider-node@3.972.86_@modelcontextpro_0dceae40f01aa62256473b6c7092d65b/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.js
|
|
23
15
|
const DEFAULT_PROXY_PORTS = {
|
|
24
16
|
ftp: 21,
|
|
25
17
|
gopher: 70,
|
|
@@ -124,7 +116,7 @@ function resolveHttpProxyUrlForTarget(targetUrl, env) {
|
|
|
124
116
|
return proxyUrl;
|
|
125
117
|
}
|
|
126
118
|
//#endregion
|
|
127
|
-
//#region ../../../node_modules/.pnpm/@earendil-works+pi-ai@1.5.
|
|
119
|
+
//#region ../../../node_modules/.pnpm/@earendil-works+pi-ai@1.5.1_@aws-sdk+credential-provider-node@3.972.86_@modelcontextpro_0dceae40f01aa62256473b6c7092d65b/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js
|
|
128
120
|
const DEFAULT_CODEX_BASE_URL = "https://chatgpt.com/backend-api";
|
|
129
121
|
const JWT_CLAIM_PATH = "https://api.openai.com/auth";
|
|
130
122
|
const DEFAULT_MAX_RETRIES = 0;
|
|
@@ -185,11 +177,15 @@ function sleep(ms, signal) {
|
|
|
185
177
|
reject(/* @__PURE__ */ new Error("Request was aborted"));
|
|
186
178
|
return;
|
|
187
179
|
}
|
|
188
|
-
const
|
|
189
|
-
signal?.addEventListener("abort", () => {
|
|
180
|
+
const onAbort = () => {
|
|
190
181
|
clearTimeout(timeout);
|
|
191
182
|
reject(/* @__PURE__ */ new Error("Request was aborted"));
|
|
192
|
-
}
|
|
183
|
+
};
|
|
184
|
+
const timeout = setTimeout(() => {
|
|
185
|
+
signal?.removeEventListener("abort", onAbort);
|
|
186
|
+
resolve();
|
|
187
|
+
}, ms);
|
|
188
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
193
189
|
});
|
|
194
190
|
}
|
|
195
191
|
function normalizeTimeoutMs(value) {
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { n as ToolCallArgumentsStream } from "./streaming-json-
|
|
5
|
-
import { i as AssistantMessageEventStream } from "./diagnostics-
|
|
6
|
-
import { t as getProviderEnvValue } from "./provider-env-
|
|
7
|
-
import { t as
|
|
8
|
-
import {
|
|
9
|
-
import { t as
|
|
10
|
-
import { t as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { n as
|
|
14
|
-
import { n as
|
|
1
|
+
import { l as renderSystemMessageUpdate, n as getIdentityHeaders, s as getSystemMessageText } from "./identity-DEwhWpjw.js";
|
|
2
|
+
import { a as resolveSamplingParams, i as clampThinkingBudgetToAnswerRoom, n as buildBaseOptions, o as thinkingBudgetForLevel } from "./simple-options-DM-a_ljY.js";
|
|
3
|
+
import { h as getDeclaredTools, n as clampThinkingLevel, t as calculateCost, v as resolveTranscript, y as resolveTranscriptTools } from "./models-BoBYu6VI.js";
|
|
4
|
+
import { n as ToolCallArgumentsStream } from "./streaming-json-Bs_lERVE.js";
|
|
5
|
+
import { i as AssistantMessageEventStream } from "./diagnostics-C43OHsIc.js";
|
|
6
|
+
import { t as getProviderEnvValue } from "./provider-env-C6KlbHmf.js";
|
|
7
|
+
import { n as normalizeProviderError, t as formatProviderError } from "./error-body-BvLDKbXN.js";
|
|
8
|
+
import { t as shortHash } from "./hash-CMLRVP3c.js";
|
|
9
|
+
import { t as headersToRecord } from "./headers-CX-ZuPIi.js";
|
|
10
|
+
import { n as isOpenRouterModel, t as applyOpenRouterReportedCost } from "./openrouter-cost-C4M4CjUF.js";
|
|
11
|
+
import { t as retryProviderRequest } from "./provider-retry-C8AvzuUi.js";
|
|
12
|
+
import { t as sanitizeSurrogates } from "./sanitize-unicode-Di-31Zpn.js";
|
|
13
|
+
import { a as createGrammarToolInputProperties, i as closeGrammarToolInputJson, l as resolveGrammarConstrainedSampling, n as transformMessages, o as getGrammarToolInput, r as appendGrammarToolInputJsonDelta, s as getJsonSchemaToolParameters, u as resolveJsonSchemaStrictSampling } from "./transform-messages-Bbr4sgbB.js";
|
|
14
|
+
import { n as hasCopilotVisionInput, t as buildCopilotDynamicHeaders } from "./github-copilot-headers-CZIImZmD.js";
|
|
15
|
+
import { n as OpenAI } from "./openai-69NOv-G_.js";
|
|
15
16
|
import { t as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-Bc6qNWt0.js";
|
|
16
|
-
|
|
17
|
-
//#region ../../../node_modules/.pnpm/@earendil-works+pi-ai@1.5.0_@aws-sdk+credential-provider-node@3.972.86_@modelcontextpro_cbd356c737d8e30c7d704b4728fb9233/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js
|
|
17
|
+
//#region ../../../node_modules/.pnpm/@earendil-works+pi-ai@1.5.1_@aws-sdk+credential-provider-node@3.972.86_@modelcontextpro_0dceae40f01aa62256473b6c7092d65b/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js
|
|
18
18
|
/**
|
|
19
19
|
* Check if conversation messages contain tool calls or tool results.
|
|
20
20
|
* This is needed because Anthropic (via proxy) requires the tools param
|
|
@@ -471,11 +471,13 @@ function buildParams(model, context, options, compat = getCompat(model), cacheRe
|
|
|
471
471
|
const transcriptTools = resolveTranscriptTools(context.messages, compat.supportsMidConvoSystemMessages === true && compat.supportsMidConvoToolAdditions === true ? "additions" : "none");
|
|
472
472
|
const messages = convertMessages(model, context, compat, { grammarToolInputProperties });
|
|
473
473
|
const cacheControl = getCompatCacheControl(compat, cacheRetention);
|
|
474
|
+
const promptCacheKeyMode = compat.promptCacheKeyMode ?? "auto";
|
|
475
|
+
const supportsPromptCacheKey = promptCacheKeyMode === "enabled" || promptCacheKeyMode === "auto" && (model.baseUrl.includes("api.openai.com") || cacheRetention === "long" && compat.supportsLongCacheRetention);
|
|
474
476
|
const params = {
|
|
475
477
|
model: model.id,
|
|
476
478
|
messages,
|
|
477
479
|
stream: true,
|
|
478
|
-
prompt_cache_key:
|
|
480
|
+
prompt_cache_key: cacheRetention !== "none" && supportsPromptCacheKey ? clampOpenAIPromptCacheKey(options?.sessionId) : void 0,
|
|
479
481
|
prompt_cache_retention: cacheRetention === "long" && compat.supportsLongCacheRetention ? "24h" : void 0
|
|
480
482
|
};
|
|
481
483
|
if (compat.supportsUsageInStreaming !== false) params.stream_options = { include_usage: true };
|
|
@@ -488,7 +490,7 @@ function buildParams(model, context, options, compat = getCompat(model), cacheRe
|
|
|
488
490
|
if (transcriptTools.requestTools.length > 0) {
|
|
489
491
|
params.tools = convertTools(transcriptTools.requestTools, compat);
|
|
490
492
|
if (compat.zaiToolStream) params.tool_stream = true;
|
|
491
|
-
} else if (hasToolHistory(context.messages)) params.tools = [];
|
|
493
|
+
} else if (compat.requiresToolsWithToolHistory && hasToolHistory(context.messages)) params.tools = [];
|
|
492
494
|
if (cacheControl) applyAnthropicCacheControl(messages, params.tools, cacheControl);
|
|
493
495
|
if (options?.toolChoice) params.tool_choice = options.toolChoice;
|
|
494
496
|
if (compat.vllmPriority !== void 0) params.priority = compat.vllmPriority;
|
|
@@ -721,7 +723,7 @@ function convertMessages(model, context, compat, options) {
|
|
|
721
723
|
} else if (msg.role === "assistant") {
|
|
722
724
|
const assistantMsg = {
|
|
723
725
|
role: "assistant",
|
|
724
|
-
content: compat.requiresAssistantAfterToolResult ? "" : null
|
|
726
|
+
content: compat.requiresAssistantAfterToolResult || compat.requiresNonNullAssistantContent ? "" : null
|
|
725
727
|
};
|
|
726
728
|
const assistantTextParts = msg.content.filter(isTextContentBlock).filter((block) => block.text.trim().length > 0).map((block) => ({
|
|
727
729
|
type: "text",
|
|
@@ -923,6 +925,8 @@ function detectCompat(model) {
|
|
|
923
925
|
maxTokensField: useMaxTokens ? "max_tokens" : "max_completion_tokens",
|
|
924
926
|
requiresToolResultName: false,
|
|
925
927
|
requiresAssistantAfterToolResult: false,
|
|
928
|
+
requiresNonNullAssistantContent: false,
|
|
929
|
+
requiresToolsWithToolHistory: false,
|
|
926
930
|
requiresThinkingAsText: false,
|
|
927
931
|
requiresReasoningContentOnAssistantMessages: isDeepSeek,
|
|
928
932
|
thinkingFormat: isDeepSeek ? "deepseek" : isZai ? "zai" : isTogether ? "together" : isAntLing ? "ant-ling" : isOpenRouter ? "openrouter" : "openai",
|
|
@@ -959,6 +963,8 @@ function getCompat(model) {
|
|
|
959
963
|
maxTokensField: model.compat.maxTokensField ?? detected.maxTokensField,
|
|
960
964
|
requiresToolResultName: model.compat.requiresToolResultName ?? detected.requiresToolResultName,
|
|
961
965
|
requiresAssistantAfterToolResult: model.compat.requiresAssistantAfterToolResult ?? detected.requiresAssistantAfterToolResult,
|
|
966
|
+
requiresNonNullAssistantContent: model.compat.requiresNonNullAssistantContent ?? detected.requiresNonNullAssistantContent,
|
|
967
|
+
requiresToolsWithToolHistory: model.compat.requiresToolsWithToolHistory ?? detected.requiresToolsWithToolHistory,
|
|
962
968
|
requiresThinkingAsText: model.compat.requiresThinkingAsText ?? detected.requiresThinkingAsText,
|
|
963
969
|
requiresReasoningContentOnAssistantMessages: model.compat.requiresReasoningContentOnAssistantMessages ?? detected.requiresReasoningContentOnAssistantMessages,
|
|
964
970
|
thinkingFormat: model.compat.thinkingFormat ?? detected.thinkingFormat,
|
|
@@ -977,6 +983,7 @@ function getCompat(model) {
|
|
|
977
983
|
sendSessionAffinityHeaders: model.compat.sendSessionAffinityHeaders ?? detected.sendSessionAffinityHeaders,
|
|
978
984
|
sessionAffinityFormat: model.compat.sessionAffinityFormat ?? detected.sessionAffinityFormat,
|
|
979
985
|
supportsLongCacheRetention: model.compat.supportsLongCacheRetention ?? detected.supportsLongCacheRetention,
|
|
986
|
+
promptCacheKeyMode: model.compat.promptCacheKeyMode,
|
|
980
987
|
vllmPriority: model.compat.vllmPriority
|
|
981
988
|
};
|
|
982
989
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as normalizeProviderError, t as formatProviderError } from "./error-body-
|
|
2
|
-
import { i as requiredNumber, n as parseClassifierUsage, r as postClassifierRequest, t as isRecord } from "./classifier-shared-
|
|
3
|
-
//#region ../../../node_modules/.pnpm/@earendil-works+pi-ai@1.5.
|
|
1
|
+
import { n as normalizeProviderError, t as formatProviderError } from "./error-body-BvLDKbXN.js";
|
|
2
|
+
import { i as requiredNumber, n as parseClassifierUsage, r as postClassifierRequest, t as isRecord } from "./classifier-shared-B7BdEyPa.js";
|
|
3
|
+
//#region ../../../node_modules/.pnpm/@earendil-works+pi-ai@1.5.1_@aws-sdk+credential-provider-node@3.972.86_@modelcontextpro_0dceae40f01aa62256473b6c7092d65b/node_modules/@earendil-works/pi-ai/dist/api/openai-decisions.js
|
|
4
4
|
/**
|
|
5
5
|
* OpenAI's Decisions API: `POST /v1/decisions` with `{ model, input, questions }`.
|
|
6
6
|
* https://developers.openai.com/api/docs/guides/decisions
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as
|
|
3
|
-
import {
|
|
4
|
-
import { i as AssistantMessageEventStream } from "./diagnostics-
|
|
5
|
-
import { t as getProviderEnvValue } from "./provider-env-
|
|
6
|
-
import { t as
|
|
7
|
-
import { t as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { n as
|
|
11
|
-
import { n as
|
|
1
|
+
import { n as getIdentityHeaders } from "./identity-DEwhWpjw.js";
|
|
2
|
+
import { a as resolveSamplingParams, n as buildBaseOptions } from "./simple-options-DM-a_ljY.js";
|
|
3
|
+
import { h as getDeclaredTools, n as clampThinkingLevel, v as resolveTranscript, y as resolveTranscriptTools } from "./models-BoBYu6VI.js";
|
|
4
|
+
import { i as AssistantMessageEventStream } from "./diagnostics-C43OHsIc.js";
|
|
5
|
+
import { t as getProviderEnvValue } from "./provider-env-C6KlbHmf.js";
|
|
6
|
+
import { n as normalizeProviderError, t as formatProviderError } from "./error-body-BvLDKbXN.js";
|
|
7
|
+
import { t as headersToRecord } from "./headers-CX-ZuPIi.js";
|
|
8
|
+
import { t as retryProviderRequest } from "./provider-retry-C8AvzuUi.js";
|
|
9
|
+
import { a as createGrammarToolInputProperties } from "./transform-messages-Bbr4sgbB.js";
|
|
10
|
+
import { n as hasCopilotVisionInput, t as buildCopilotDynamicHeaders } from "./github-copilot-headers-CZIImZmD.js";
|
|
11
|
+
import { n as OpenAI } from "./openai-69NOv-G_.js";
|
|
12
12
|
import { t as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-Bc6qNWt0.js";
|
|
13
|
-
import { i as processResponsesStream, n as convertResponsesTools, r as getResponsesToolSupport, t as convertResponsesMessages } from "./openai-responses-shared-
|
|
14
|
-
//#region ../../../node_modules/.pnpm/@earendil-works+pi-ai@1.5.
|
|
13
|
+
import { i as processResponsesStream, n as convertResponsesTools, r as getResponsesToolSupport, t as convertResponsesMessages } from "./openai-responses-shared-b4nN_ZS7.js";
|
|
14
|
+
//#region ../../../node_modules/.pnpm/@earendil-works+pi-ai@1.5.1_@aws-sdk+credential-provider-node@3.972.86_@modelcontextpro_0dceae40f01aa62256473b6c7092d65b/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js
|
|
15
15
|
const OPENAI_TOOL_CALL_PROVIDERS = /* @__PURE__ */ new Set([
|
|
16
16
|
"openai",
|
|
17
17
|
"openai-codex",
|
|
@@ -56,6 +56,7 @@ function getCompat(model) {
|
|
|
56
56
|
supportsDeveloperRole: model.compat?.supportsDeveloperRole ?? true,
|
|
57
57
|
supportsMidConvoSystemMessages: model.compat?.supportsMidConvoSystemMessages ?? false,
|
|
58
58
|
sessionAffinityFormat: model.compat?.sessionAffinityFormat ?? detectSessionAffinityFormat(model),
|
|
59
|
+
promptCacheKeyMode: model.compat?.promptCacheKeyMode ?? "auto",
|
|
59
60
|
supportsLongCacheRetention: model.compat?.supportsLongCacheRetention ?? true,
|
|
60
61
|
supportsStrictMode: model.compat?.supportsStrictMode ?? false,
|
|
61
62
|
supportsOpenAIGrammarTools: model.compat?.supportsOpenAIGrammarTools ?? false,
|
|
@@ -199,7 +200,7 @@ function createClient(model, context, apiKey, optionsHeaders, identity, fetch, s
|
|
|
199
200
|
if (sessionId) {
|
|
200
201
|
if (compat.sessionAffinityFormat === "openrouter") headers["x-session-id"] = sessionId;
|
|
201
202
|
else {
|
|
202
|
-
if (compat.sessionAffinityFormat === "openai") headers
|
|
203
|
+
if (compat.sessionAffinityFormat === "openai") headers["session-id"] = sessionId;
|
|
203
204
|
headers["x-client-request-id"] = sessionId;
|
|
204
205
|
}
|
|
205
206
|
}
|
|
@@ -226,12 +227,13 @@ function buildParams(model, context, options, compat, grammarToolInputProperties
|
|
|
226
227
|
configurationUpdateEffort
|
|
227
228
|
});
|
|
228
229
|
const cacheRetention = resolveCacheRetention(options?.cacheRetention, options?.env);
|
|
230
|
+
const sendPromptCacheKey = cacheRetention !== "none" && compat.promptCacheKeyMode !== "disabled";
|
|
229
231
|
const omitUnsupportedFields = isChatGPTSignIn(model, options?.apiKey);
|
|
230
232
|
const params = {
|
|
231
233
|
model: model.id,
|
|
232
234
|
input: messages,
|
|
233
235
|
stream: true,
|
|
234
|
-
prompt_cache_key:
|
|
236
|
+
prompt_cache_key: sendPromptCacheKey ? clampOpenAIPromptCacheKey(options?.sessionId) : void 0,
|
|
235
237
|
prompt_cache_retention: omitUnsupportedFields ? void 0 : getPromptCacheRetention(compat, cacheRetention),
|
|
236
238
|
prompt_cache_options: omitUnsupportedFields ? void 0 : getPromptCacheOptions(compat, cacheRetention),
|
|
237
239
|
store: false
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { n as ToolCallArgumentsStream } from "./streaming-json-
|
|
4
|
-
import { t as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
//#region ../../../node_modules/.pnpm/@earendil-works+pi-ai@1.5.
|
|
1
|
+
import { l as renderSystemMessageUpdate, s as getSystemMessageText } from "./identity-DEwhWpjw.js";
|
|
2
|
+
import { t as calculateCost, v as resolveTranscript, y as resolveTranscriptTools } from "./models-BoBYu6VI.js";
|
|
3
|
+
import { n as ToolCallArgumentsStream } from "./streaming-json-Bs_lERVE.js";
|
|
4
|
+
import { t as shortHash } from "./hash-CMLRVP3c.js";
|
|
5
|
+
import { t as sanitizeSurrogates } from "./sanitize-unicode-Di-31Zpn.js";
|
|
6
|
+
import { i as closeGrammarToolInputJson, l as resolveGrammarConstrainedSampling, n as transformMessages, o as getGrammarToolInput, r as appendGrammarToolInputJsonDelta, s as getJsonSchemaToolParameters, u as resolveJsonSchemaStrictSampling } from "./transform-messages-Bbr4sgbB.js";
|
|
7
|
+
//#region ../../../node_modules/.pnpm/@earendil-works+pi-ai@1.5.1_@aws-sdk+credential-provider-node@3.972.86_@modelcontextpro_0dceae40f01aa62256473b6c7092d65b/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js
|
|
8
8
|
function encodeTextSignatureV1(id, phase) {
|
|
9
9
|
const payload = {
|
|
10
10
|
v: 1,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../../node_modules/.pnpm/@earendil-works+pi-ai@1.5.
|
|
1
|
+
//#region ../../../node_modules/.pnpm/@earendil-works+pi-ai@1.5.1_@aws-sdk+credential-provider-node@3.972.86_@modelcontextpro_0dceae40f01aa62256473b6c7092d65b/node_modules/@earendil-works/pi-ai/dist/utils/openrouter-cost.js
|
|
2
2
|
function isValidCost(value) {
|
|
3
3
|
return typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
4
4
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { n as getIdentityHeaders } from "./identity-
|
|
2
|
-
import { n as
|
|
3
|
-
import { t as
|
|
4
|
-
import { t as
|
|
5
|
-
import {
|
|
6
|
-
import { n as
|
|
7
|
-
//#region ../../../node_modules/.pnpm/@earendil-works+pi-ai@1.5.
|
|
1
|
+
import { n as getIdentityHeaders } from "./identity-DEwhWpjw.js";
|
|
2
|
+
import { n as normalizeProviderError, t as formatProviderError } from "./error-body-BvLDKbXN.js";
|
|
3
|
+
import { n as providerHeadersToRecord, t as headersToRecord } from "./headers-CX-ZuPIi.js";
|
|
4
|
+
import { t as retryProviderRequest } from "./provider-retry-C8AvzuUi.js";
|
|
5
|
+
import { t as sanitizeSurrogates } from "./sanitize-unicode-Di-31Zpn.js";
|
|
6
|
+
import { n as OpenAI } from "./openai-69NOv-G_.js";
|
|
7
|
+
//#region ../../../node_modules/.pnpm/@earendil-works+pi-ai@1.5.1_@aws-sdk+credential-provider-node@3.972.86_@modelcontextpro_0dceae40f01aa62256473b6c7092d65b/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.js
|
|
8
8
|
/** Image generation over OpenRouter's chat completions endpoint. */
|
|
9
9
|
const generateImages = async (model, context, options) => {
|
|
10
10
|
const output = {
|
|
Binary file
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { c as ownedSlice, n as getIdentityHeaders } from "./identity-
|
|
2
|
-
import { n as ToolCallArgumentsStream } from "./streaming-json-
|
|
3
|
-
import { i as AssistantMessageEventStream, n as createAssistantMessageDiagnostic, t as appendAssistantMessageDiagnostic } from "./diagnostics-
|
|
4
|
-
import { t as getProviderEnvValue } from "./provider-env-
|
|
5
|
-
import { n as providerHeadersToRecord, t as headersToRecord } from "./headers-
|
|
6
|
-
//#region ../../../node_modules/.pnpm/@earendil-works+pi-ai@1.5.
|
|
1
|
+
import { c as ownedSlice, n as getIdentityHeaders } from "./identity-DEwhWpjw.js";
|
|
2
|
+
import { n as ToolCallArgumentsStream } from "./streaming-json-Bs_lERVE.js";
|
|
3
|
+
import { i as AssistantMessageEventStream, n as createAssistantMessageDiagnostic, t as appendAssistantMessageDiagnostic } from "./diagnostics-C43OHsIc.js";
|
|
4
|
+
import { t as getProviderEnvValue } from "./provider-env-C6KlbHmf.js";
|
|
5
|
+
import { n as providerHeadersToRecord, t as headersToRecord } from "./headers-CX-ZuPIi.js";
|
|
6
|
+
//#region ../../../node_modules/.pnpm/@earendil-works+pi-ai@1.5.1_@aws-sdk+credential-provider-node@3.972.86_@modelcontextpro_0dceae40f01aa62256473b6c7092d65b/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js
|
|
7
7
|
/**
|
|
8
8
|
* pi-messages API implementation.
|
|
9
9
|
*
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { et as piAgentDirectory, it as nodeHost, nt as createSerialRunner } from "./serverPlugin-Cx6a5RT0.js";
|
|
2
|
+
import { s as readTextIfExists } from "./platform-CAhzdBhg.js";
|
|
3
|
+
import { n as writePrivateAtomicJsonAsync } from "./atomicJson-CU27fWtF.js";
|
|
4
|
+
import "./piSettings-CDcdxob2.js";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
//#region ../../foundations/po-config/src/services/imageSettings/index.ts
|
|
7
|
+
const IMAGE_SETTINGS_KEY = "images";
|
|
8
|
+
const IMAGE_AUTO_RESIZE_KEY = "autoResize";
|
|
9
|
+
const IMAGE_MAX_DIMENSION_KEY = "maxDimension";
|
|
10
|
+
/** Pi's own cap, from its resize core; also the largest value worth writing. */
|
|
11
|
+
const DEFAULT_IMAGE_MAX_DIMENSION = 2e3;
|
|
12
|
+
function clampImageMaxDimension(value) {
|
|
13
|
+
const rounded = Math.round(value);
|
|
14
|
+
if (rounded < 256) return 256;
|
|
15
|
+
if (rounded > 2e3) return DEFAULT_IMAGE_MAX_DIMENSION;
|
|
16
|
+
return rounded;
|
|
17
|
+
}
|
|
18
|
+
function isRecord(value) {
|
|
19
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
20
|
+
}
|
|
21
|
+
/** Resolves the effective limits, defaulting anything absent or unusable. */
|
|
22
|
+
function parsePiImageSettings(config) {
|
|
23
|
+
const images = config[IMAGE_SETTINGS_KEY];
|
|
24
|
+
if (!isRecord(images)) return {
|
|
25
|
+
autoResize: true,
|
|
26
|
+
maxDimension: DEFAULT_IMAGE_MAX_DIMENSION
|
|
27
|
+
};
|
|
28
|
+
const autoResize = images[IMAGE_AUTO_RESIZE_KEY];
|
|
29
|
+
const maxDimension = images[IMAGE_MAX_DIMENSION_KEY];
|
|
30
|
+
return {
|
|
31
|
+
autoResize: typeof autoResize === "boolean" ? autoResize : true,
|
|
32
|
+
maxDimension: typeof maxDimension === "number" && Number.isFinite(maxDimension) ? clampImageMaxDimension(maxDimension) : DEFAULT_IMAGE_MAX_DIMENSION
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Folds a change into the `images` object of a settings document, leaving every
|
|
37
|
+
* other key of that document, and of `images` itself, as it was.
|
|
38
|
+
*/
|
|
39
|
+
function applyPiImageSettings(config, update) {
|
|
40
|
+
const existing = config[IMAGE_SETTINGS_KEY];
|
|
41
|
+
const images = isRecord(existing) ? { ...existing } : {};
|
|
42
|
+
if (update.autoResize !== void 0) images[IMAGE_AUTO_RESIZE_KEY] = update.autoResize;
|
|
43
|
+
if (update.maxDimension !== void 0) images[IMAGE_MAX_DIMENSION_KEY] = clampImageMaxDimension(update.maxDimension);
|
|
44
|
+
return {
|
|
45
|
+
...config,
|
|
46
|
+
[IMAGE_SETTINGS_KEY]: images
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region ../../foundations/po-config/src/services/piConfig/core.ts
|
|
51
|
+
const SETTINGS_FILE_NAME = "settings.json";
|
|
52
|
+
const CONFIG_DIR_NAME = ".pi";
|
|
53
|
+
/** An explicit home other than the real one is isolated from the process environment. */
|
|
54
|
+
function defaultAgentDirectory(homeDirectory) {
|
|
55
|
+
return piAgentDirectory(homeDirectory === nodeHost.homeDirectory() ? process.env : {}, homeDirectory);
|
|
56
|
+
}
|
|
57
|
+
function isObject(value) {
|
|
58
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
59
|
+
}
|
|
60
|
+
function mergeConfig(base, override) {
|
|
61
|
+
const result = { ...base };
|
|
62
|
+
for (const [key, value] of Object.entries(override)) {
|
|
63
|
+
const current = result[key];
|
|
64
|
+
result[key] = isObject(current) && isObject(value) ? mergeConfig(current, value) : value;
|
|
65
|
+
}
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
68
|
+
/** Parses one settings file; `undefined` text means the file is missing. */
|
|
69
|
+
function configFromText(text, filePath) {
|
|
70
|
+
if (text === void 0) return {};
|
|
71
|
+
let parsed;
|
|
72
|
+
try {
|
|
73
|
+
parsed = JSON.parse(text);
|
|
74
|
+
} catch (error) {
|
|
75
|
+
throw new Error(`Could not parse Pi settings at ${filePath}`, { cause: error });
|
|
76
|
+
}
|
|
77
|
+
if (!isObject(parsed)) throw new Error(`Pi settings at ${filePath} must be a JSON object`);
|
|
78
|
+
return parsed;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Where the image limits are read from and written to.
|
|
82
|
+
*
|
|
83
|
+
* The user layer only. Pi merges a trusted project settings.json over it, but
|
|
84
|
+
* these limits describe one machine's tolerance for image payloads rather than
|
|
85
|
+
* one repository's, and the cockpit page that writes them has no repository
|
|
86
|
+
* scope to offer. The legacy user path is still read, because a machine that
|
|
87
|
+
* has not been migrated still answers from it.
|
|
88
|
+
*/
|
|
89
|
+
function userSettingsPaths(homeDirectory) {
|
|
90
|
+
return {
|
|
91
|
+
legacy: path.join(homeDirectory, CONFIG_DIR_NAME, SETTINGS_FILE_NAME),
|
|
92
|
+
canonical: path.join(defaultAgentDirectory(homeDirectory), SETTINGS_FILE_NAME)
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region ../../foundations/po-config/src/services/piConfig/index.ts
|
|
97
|
+
/** Image settings saves in this process are queued per file, so none reads a stale document. */
|
|
98
|
+
const imageSettingsWrites = createSerialRunner();
|
|
99
|
+
async function readConfig(fs, filePath, context) {
|
|
100
|
+
return configFromText(await readTextIfExists(fs, filePath, context), filePath);
|
|
101
|
+
}
|
|
102
|
+
async function readConfigPaths(fs, paths, context) {
|
|
103
|
+
return (await Promise.all(paths.map((filePath) => readConfig(fs, filePath, context)))).reduce(mergeConfig, {});
|
|
104
|
+
}
|
|
105
|
+
async function readPiImageSettings(fs, context, homeDirectory = nodeHost.homeDirectory()) {
|
|
106
|
+
const paths = userSettingsPaths(homeDirectory);
|
|
107
|
+
return parsePiImageSettings(await readConfigPaths(fs, [paths.legacy, paths.canonical], context));
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Writes the changed keys back and reports the limits that now apply.
|
|
111
|
+
*
|
|
112
|
+
* Read-modify-write on Pi's own file, so a save races a concurrent Pi settings
|
|
113
|
+
* save rather than merging with it. Pi writes only the fields its UI touched,
|
|
114
|
+
* as this does, which keeps the window to the one setting being changed on
|
|
115
|
+
* both sides at once. Saves from this process are queued.
|
|
116
|
+
*/
|
|
117
|
+
async function savePiImageSettingsAsync(fs, update, context, homeDirectory = nodeHost.homeDirectory()) {
|
|
118
|
+
const paths = userSettingsPaths(homeDirectory);
|
|
119
|
+
await imageSettingsWrites.forKey(path.resolve(paths.canonical))(async () => {
|
|
120
|
+
const current = await readConfig(fs, paths.canonical, context);
|
|
121
|
+
await writePrivateAtomicJsonAsync(fs, paths.canonical, applyPiImageSettings(current, update), context);
|
|
122
|
+
});
|
|
123
|
+
return readPiImageSettings(fs, context, homeDirectory);
|
|
124
|
+
}
|
|
125
|
+
//#endregion
|
|
126
|
+
export { savePiImageSettingsAsync as n, DEFAULT_IMAGE_MAX_DIMENSION as r, readPiImageSettings as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./serverPlugin-Cx6a5RT0.js";
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { Lt as BACKGROUND_CONTEXT, ct as getOrThrow, mt as SessionIdentityDoc, rt as fileMutationRunner, zt as withAbortSignal } from "./serverPlugin-Cx6a5RT0.js";
|
|
2
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
//#region ../../core/po-core/src/services/platformFiles/index.ts
|
|
5
|
+
let largestTranscriptEntryBytes = 0;
|
|
6
|
+
/** Exact JSON bytes of a browser projection, not the durable source entry size. */
|
|
7
|
+
function recordTranscriptProjection(bytes) {
|
|
8
|
+
if (Number.isSafeInteger(bytes) && bytes > 0) largestTranscriptEntryBytes = Math.max(largestTranscriptEntryBytes, bytes);
|
|
9
|
+
}
|
|
10
|
+
var FileTooLargeError = class extends Error {
|
|
11
|
+
constructor(filePath, maxBytes) {
|
|
12
|
+
super(`File exceeds ${maxBytes} byte read limit: ${filePath}`);
|
|
13
|
+
this.name = "FileTooLargeError";
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
/** Bounds allocation even when a file grows between stat and read. */
|
|
17
|
+
async function readBoundedFile(fs, filePath, maxBytes, context) {
|
|
18
|
+
if (!Number.isSafeInteger(maxBytes) || maxBytes < 0) throw new RangeError("Invalid read limit.");
|
|
19
|
+
const reader = getOrThrow(await fs.openBinaryReader(filePath, {}, context));
|
|
20
|
+
try {
|
|
21
|
+
const info = getOrThrow(await reader.info(context));
|
|
22
|
+
if (info.size > maxBytes) throw new FileTooLargeError(filePath, maxBytes);
|
|
23
|
+
const data = getOrThrow(await reader.read(0, info.size, context));
|
|
24
|
+
const after = getOrThrow(await reader.info(context));
|
|
25
|
+
if (after.size > maxBytes) throw new FileTooLargeError(filePath, maxBytes);
|
|
26
|
+
if (data.length !== info.size || after.size !== info.size || after.mtimeMs !== info.mtimeMs) throw new Error(`File changed during access: ${filePath}`);
|
|
27
|
+
return data;
|
|
28
|
+
} finally {
|
|
29
|
+
await reader.close(BACKGROUND_CONTEXT);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/** File text, or undefined when the file does not exist. Every other failure throws. */
|
|
33
|
+
async function readTextIfExists(fs, filePath, context) {
|
|
34
|
+
const result = await fs.readTextFile(filePath, context);
|
|
35
|
+
if (!result.ok && result.error.code === "not_found") return void 0;
|
|
36
|
+
return getOrThrow(result);
|
|
37
|
+
}
|
|
38
|
+
async function pathExists(fs, filePath, context) {
|
|
39
|
+
return getOrThrow(await fs.exists(filePath, context));
|
|
40
|
+
}
|
|
41
|
+
/** Removes a file or directory tree; a missing path is not an error. */
|
|
42
|
+
async function removePath(fs, filePath, context) {
|
|
43
|
+
getOrThrow(await fs.remove(filePath, {
|
|
44
|
+
recursive: true,
|
|
45
|
+
force: true
|
|
46
|
+
}, context));
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Writes through a uniquely named temporary file beside the target, then renames it into
|
|
50
|
+
* place, so a reader never sees a torn file. A failed write removes its temporary file.
|
|
51
|
+
* Callers that read-modify-write the same target serialise through `serialRunner.forKey`.
|
|
52
|
+
*/
|
|
53
|
+
async function writeFileAtomic(fs, filePath, content, context) {
|
|
54
|
+
getOrThrow(await fs.createDir(path.dirname(filePath), { recursive: true }, context));
|
|
55
|
+
const temporaryPath = `${filePath}.${randomUUID()}.tmp`;
|
|
56
|
+
const written = await fs.writeFile(temporaryPath, content, context);
|
|
57
|
+
const renamed = written.ok ? await fs.renameFile(temporaryPath, filePath, context) : written;
|
|
58
|
+
if (!renamed.ok) {
|
|
59
|
+
await fs.remove(temporaryPath, { force: true }, context);
|
|
60
|
+
getOrThrow(renamed);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region ../../core/po-core/src/services/platformFiles/rootBoundReplace.edge.ts
|
|
65
|
+
var RootBoundReplaceError = class extends Error {
|
|
66
|
+
status;
|
|
67
|
+
constructor(message, status) {
|
|
68
|
+
super(message);
|
|
69
|
+
this.status = status;
|
|
70
|
+
this.name = "RootBoundReplaceError";
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const digest = (bytes) => createHash("sha256").update(bytes).digest("hex");
|
|
74
|
+
/** Replace an existing file in host-owned virtual storage, retaining optimistic concurrency. */
|
|
75
|
+
async function replaceRootBoundFile(options) {
|
|
76
|
+
const { root, relativePath, expectedSha256, maxBytes, signal, fileSystem } = options;
|
|
77
|
+
if (!Number.isSafeInteger(maxBytes) || maxBytes < 0) throw new RangeError("Invalid save limit.");
|
|
78
|
+
if (options.bytes.byteLength > maxBytes) throw new RootBoundReplaceError("File exceeds the save limit.", 413);
|
|
79
|
+
if (!/^[a-f0-9]{64}$/.test(expectedSha256)) throw new RootBoundReplaceError("A SHA-256 is required.", 400);
|
|
80
|
+
if (!path.isAbsolute(root) || !relativePath || relativePath.includes("\\") || relativePath.includes("\0") || path.isAbsolute(relativePath) || relativePath.split("/").some((part) => !part || part === "." || part === "..")) throw new RootBoundReplaceError("A relative file path under an admitted root is required.", 403);
|
|
81
|
+
if (fileSystem === void 0) throw new Error("Root-bound replacement requires the host filesystem.");
|
|
82
|
+
signal?.throwIfAborted();
|
|
83
|
+
const context = signal ? withAbortSignal(signal, BACKGROUND_CONTEXT) : BACKGROUND_CONTEXT;
|
|
84
|
+
const bytes = Uint8Array.from(options.bytes);
|
|
85
|
+
const target = path.join(root, relativePath);
|
|
86
|
+
return fileMutationRunner.forKey(target)(async () => {
|
|
87
|
+
signal?.throwIfAborted();
|
|
88
|
+
if (getOrThrow(await fileSystem.canonicalPath(root, context)) !== path.resolve(root) || getOrThrow(await fileSystem.canonicalPath(target, context)) !== target) throw new RootBoundReplaceError("The save path changed or contains a symlink.", 403);
|
|
89
|
+
const info = getOrThrow(await fileSystem.fileInfo(target, context));
|
|
90
|
+
if (info.kind !== "file") throw new RootBoundReplaceError("The save target is not a regular file.", 403);
|
|
91
|
+
if (info.size > maxBytes) throw new RootBoundReplaceError("File exceeds the save limit.", 413);
|
|
92
|
+
if (digest(await readBoundedFile(fileSystem, target, maxBytes, context)) !== expectedSha256) throw new RootBoundReplaceError("This file changed elsewhere. Reopen it before saving.", 409);
|
|
93
|
+
signal?.throwIfAborted();
|
|
94
|
+
await writeFileAtomic(fileSystem, target, bytes, context);
|
|
95
|
+
return digest(bytes);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region ../../core/po-core/src/services/durableSession/index.ts
|
|
100
|
+
/** Stamps a new session's identity, or checks an existing one matches the requested id. */
|
|
101
|
+
async function initializeSessionIdentity(session, request, context) {
|
|
102
|
+
const identity = await session.snapshot(SessionIdentityDoc, context);
|
|
103
|
+
if (request.existing && (!identity || identity.id !== request.id)) throw new Error("SQLite session id does not match the requested session");
|
|
104
|
+
if (request.existing) return;
|
|
105
|
+
await session.commit(async (tx) => {
|
|
106
|
+
const doc = await tx.doc(SessionIdentityDoc);
|
|
107
|
+
doc.id = request.id;
|
|
108
|
+
doc.createdAt = Date.now();
|
|
109
|
+
doc.parentSessionId = request.parentSessionId ?? "";
|
|
110
|
+
}, context);
|
|
111
|
+
}
|
|
112
|
+
//#endregion
|
|
113
|
+
export { pathExists as a, recordTranscriptProjection as c, FileTooLargeError as i, removePath as l, RootBoundReplaceError as n, readBoundedFile as o, replaceRootBoundFile as r, readTextIfExists as s, initializeSessionIdentity as t, writeFileAtomic as u };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region ../../core/po-core/src/schemas/pluginContributions.ts
|
|
2
|
+
/** Preserve schema inference at the declaration, before heterogeneous composition. */
|
|
3
|
+
function defineTool(tool) {
|
|
4
|
+
return {
|
|
5
|
+
...tool,
|
|
6
|
+
kind: "tool"
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
function defineCommand(command) {
|
|
10
|
+
return {
|
|
11
|
+
...command,
|
|
12
|
+
kind: "command"
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { defineTool as n, defineCommand as t };
|