@agimon-ai/po-cloudflare 0.0.2-alpha.7 → 0.0.2-alpha.71
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 +64 -241
- 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-C8CttjsR.js} +1 -1
- package/dist/agent-CEqvgRl6.js +3878 -0
- package/dist/{anthropic-messages-CkYm8M3V.js → anthropic-messages-DCLLLNuM.js} +292 -64
- package/dist/apiContracts-DaOpUHnu.js +1719 -0
- package/dist/{approval-CQ3ZuoTy.js → approval-DXPV7Vm5.js} +15 -2
- package/dist/{approvalPrompt-CylV3C84.js → approvalPrompt-CBaxjb_g.js} +1 -2
- package/dist/approvalSession-C9bg7tPo.js +132 -0
- package/dist/artifactFiles-5KwXIxYf.js +1 -0
- package/dist/artifactsApi-bg2wMYWg.js +200 -0
- package/dist/assets/assets/{CodeEditorView-D4q94XH-.js → CodeEditorView-CfrVwzvL.js} +2 -2
- package/dist/assets/assets/{abnfDiagram-WEYOIA3C-C85p4OYZ.js → abnfDiagram-WEYOIA3C-B80H4Cm4.js} +2 -2
- package/dist/assets/assets/{architecture-WOLXFQ4H-Bt_NOdwE.js → architecture-WOLXFQ4H-Dr4hXaql.js} +1 -1
- package/dist/assets/assets/{architectureDiagram-ZHVYKT53-DzH1GKMm.js → architectureDiagram-ZHVYKT53-DWyt7oXu.js} +2 -2
- package/dist/assets/assets/{blockDiagram-RJAE7QA3-BmWU34j3.js → blockDiagram-RJAE7QA3-OxNTLdmi.js} +2 -2
- package/dist/assets/assets/{c4Diagram-XDPPPE54-BpGOdOuo.js → c4Diagram-XDPPPE54-B4YtcH0s.js} +2 -2
- package/dist/assets/assets/channel-bXj00dGj.js +2 -0
- package/dist/assets/assets/{chunk-2E7WHVMD-AycP1cXU.js → chunk-2E7WHVMD-CD6FFMOX.js} +2 -2
- package/dist/assets/assets/{chunk-4EMNKR2T-DX-DrZzc.js → chunk-4EMNKR2T-CEIoX5oo.js} +2 -2
- package/dist/assets/assets/{chunk-55XCU76K-BdwnLWzI.js → chunk-55XCU76K-CD3t0IJi.js} +2 -2
- package/dist/assets/assets/{chunk-7S6XSTFO-D-RBAwAn.js → chunk-7S6XSTFO-Cyt75UCF.js} +2 -2
- package/dist/assets/assets/{chunk-AQDTSKZB-CCxNNhKs.js → chunk-AQDTSKZB-DRtqYBj9.js} +2 -2
- package/dist/assets/assets/{chunk-DSNLSHJZ-D2hGwWm1.js → chunk-DSNLSHJZ-C8Fx2F8s.js} +2 -2
- package/dist/assets/assets/{chunk-HAGFOTED-BPi-cqGh.js → chunk-HAGFOTED-wOLWRRnd.js} +2 -2
- package/dist/assets/assets/{chunk-HNE4Q36P-D-r1ChHT.js → chunk-HNE4Q36P-CurJg4Hf.js} +2 -2
- package/dist/assets/assets/{chunk-NQOKRVIF-RgmZCAdn.js → chunk-NQOKRVIF-Dzcc5nOG.js} +2 -2
- package/dist/assets/assets/{chunk-UHW7PFBP-B-Hul-rZ.js → chunk-UHW7PFBP-B_ULFf2h.js} +2 -2
- package/dist/assets/assets/{chunk-VQ5W62QI-D1zlXCt8.js → chunk-VQ5W62QI-DH0VY4_p.js} +2 -2
- package/dist/assets/assets/{chunk-WQQL4CDK-CtjIbVJn.js → chunk-WQQL4CDK-DNxfLyXM.js} +2 -2
- package/dist/assets/assets/chunk-XXDRQBXY-B2bMWgN9.js +2 -0
- package/dist/assets/assets/{chunk-YZO67HFG-BQOgXG99.js → chunk-YZO67HFG-COuMUh9U.js} +2 -2
- package/dist/assets/assets/{chunk-ZAUX2LTX-CsDDxmqv.js → chunk-ZAUX2LTX-BJrCnubF.js} +2 -2
- package/dist/assets/assets/{chunk-ZCHMQSOR-deyEYMjx.js → chunk-ZCHMQSOR-D1lFKPtk.js} +2 -2
- package/dist/assets/assets/{classDiagram-v2-4MYWR3UA-DVJHeFlq.js → classDiagram-v2-4MYWR3UA-DfZIbyVL.js} +2 -2
- package/dist/assets/assets/{cose-bilkent-JH36ORCC-ipcN28Fw.js → cose-bilkent-JH36ORCC-CpGhv9_S.js} +2 -2
- package/dist/assets/assets/{cynefin-EF2NZ3EQ-s9ZkPF55.js → cynefin-EF2NZ3EQ-Cxdc6nQl.js} +1 -1
- package/dist/assets/assets/{cynefinDiagram-WF24UDRP-Ksr2qjsS.js → cynefinDiagram-WF24UDRP-qoj0w3lp.js} +2 -2
- package/dist/assets/assets/{dagre-NK4GIZVX-2_Wl-XEW.js → dagre-NK4GIZVX-DL6QbNDS.js} +2 -2
- package/dist/assets/assets/{diagram-CBK3MWTC-C7PeyT7l.js → diagram-CBK3MWTC-CJB3jq1_.js} +2 -2
- package/dist/assets/assets/{diagram-I5XIIV2D-DPYzeKdj.js → diagram-I5XIIV2D-4cPOxCxF.js} +2 -2
- package/dist/assets/assets/{diagram-ODIL2UCW-DHw1cAmn.js → diagram-ODIL2UCW-BG3-jAxE.js} +2 -2
- package/dist/assets/assets/{diagram-PFBEJUXE-C2wA8i-1.js → diagram-PFBEJUXE-Bx8dFaXj.js} +2 -2
- package/dist/assets/assets/{diagram-RJA3I4VV-tM3moCIs.js → diagram-RJA3I4VV-CUUHND91.js} +2 -2
- package/dist/assets/assets/{diagram-TYUNFSNR-CInyJxF7.js → diagram-TYUNFSNR-BDMoN-kr.js} +2 -2
- package/dist/assets/assets/{dist-BDqjNLTC.js → dist-5AxNm-uy.js} +2 -2
- package/dist/assets/assets/{dist-hpZIQBl4.js → dist-9_Rmyj2I.js} +2 -2
- package/dist/assets/assets/{dist-DSLprmec.js → dist-BE3CLKv4.js} +2 -2
- package/dist/assets/assets/{dist-BASEd5LC.js → dist-BfNCu-7x.js} +2 -2
- package/dist/assets/assets/{dist-BuYBvf4F.js → dist-BjI0b36Z.js} +2 -2
- package/dist/assets/assets/{dist-DUS0U_ge.js → dist-CM7b5P9a.js} +2 -2
- package/dist/assets/assets/{dist-CeOy6PjJ.js → dist-Ccxb9U1G.js} +2 -2
- package/dist/assets/assets/{dist-ChXoRSS6.js → dist-CjCWP21A.js} +2 -2
- package/dist/assets/assets/{dist-07dRlnp1.js → dist-DSTAktnR.js} +2 -2
- package/dist/assets/assets/{ebnfDiagram-V4P3TTPT-4nZgqaSt.js → ebnfDiagram-V4P3TTPT-BivOMXZb.js} +2 -2
- package/dist/assets/assets/{elk-QONTBCTQ-nFh54c1Q.js → elk-QONTBCTQ-CrJ1Qpy_.js} +2 -2
- package/dist/assets/assets/{erDiagram-KYQIGQAA-CIQ0_IgZ.js → erDiagram-KYQIGQAA-w9Bqp4sV.js} +2 -2
- package/dist/assets/assets/{eventmodeling-K75KTNOO-Cw4BlbYP.js → eventmodeling-K75KTNOO-CBjFM3kV.js} +1 -1
- package/dist/assets/assets/flowDiagram-IUGLLWBU-C6Fnfgm0.js +1 -0
- package/dist/assets/assets/{ganttDiagram-R7GPNTJY-C97qoUpX.js → ganttDiagram-R7GPNTJY-CsWtGaqD.js} +2 -2
- package/dist/assets/assets/{gitGraph-VSP46ZUC-B8HWVkEX.js → gitGraph-VSP46ZUC-DsBSV9_h.js} +1 -1
- package/dist/assets/assets/{gitGraphDiagram-PDYL7XHY-B4Js56_8.js → gitGraphDiagram-PDYL7XHY-D5GxuYHW.js} +2 -2
- package/dist/assets/assets/index-CNDyKUDF.css +1 -0
- package/dist/assets/assets/index-DWDYnZsq.js +256 -0
- package/dist/assets/assets/{info-OHQRW6UA-A4qythhA.js → info-OHQRW6UA-C7x5dSJu.js} +1 -1
- package/dist/assets/assets/{infoDiagram-MVDRKAX5-BSNwG9yI.js → infoDiagram-MVDRKAX5-CwpI-uAa.js} +2 -2
- package/dist/assets/assets/{ishikawaDiagram-HPEHV2GE-D4gU-3RA.js → ishikawaDiagram-HPEHV2GE-DAa7J5G6.js} +2 -2
- package/dist/assets/assets/{journeyDiagram-BOSHW7O7-CxxDrw7o.js → journeyDiagram-BOSHW7O7-BmiZnxE_.js} +2 -2
- package/dist/assets/assets/{kanban-definition-FNSA4HC5-DUxQv3v0.js → kanban-definition-FNSA4HC5-DUR_mA3L.js} +2 -2
- package/dist/assets/assets/{line-BKODXUmk.js → line-DHY49wSg.js} +2 -2
- package/dist/assets/assets/{linear-Cm5uyUun.js → linear-pTo-a9xT.js} +2 -2
- package/dist/assets/assets/{mermaid-parser.core-CYst2kCg.js → mermaid-parser.core-DMg3hN3T.js} +4 -4
- package/dist/assets/assets/{mermaid.core-B4Qq8SMa.js → mermaid.core-DKtPCltA.js} +5 -5
- package/dist/assets/assets/{mindmap-definition-6OY57UG3-CZFvUTIM.js → mindmap-definition-6OY57UG3-DwTkFbnV.js} +2 -2
- package/dist/assets/assets/{packet-JDAUHWVQ-DZMlaiuy.js → packet-JDAUHWVQ-Tu9TrQ1x.js} +1 -1
- package/dist/assets/assets/{pegDiagram-ECIUJNBX-BjM668dT.js → pegDiagram-ECIUJNBX-B7My4tsz.js} +2 -2
- package/dist/assets/assets/{pie-XZMESJXO-CmpJ6vb8.js → pie-XZMESJXO-QPQm5Gdx.js} +1 -1
- package/dist/assets/assets/{pieDiagram-GNMPY74T-BCA9DCDe.js → pieDiagram-GNMPY74T-Bv-zAD_z.js} +2 -2
- package/dist/assets/assets/{quadrantDiagram-D57K4MC3-CUnpC-Rl.js → quadrantDiagram-D57K4MC3-HTjoGQPd.js} +2 -2
- package/dist/assets/assets/{radar-ABXABTNO-C9x42-KP.js → radar-ABXABTNO-LDBlEoFo.js} +1 -1
- package/dist/assets/assets/{railroad-I3PHUGI6-CLvHKrsC.js → railroad-I3PHUGI6-Dy3_ymgZ.js} +1 -1
- package/dist/assets/assets/{railroad-abnf-LNEFI6M7-B0LGF3gx.js → railroad-abnf-LNEFI6M7-QLVvYs6e.js} +1 -1
- package/dist/assets/assets/{railroad-ebnf-DWYD2UWJ-SKnYapAj.js → railroad-ebnf-DWYD2UWJ-CFRlv9a8.js} +1 -1
- package/dist/assets/assets/{railroad-peg-JR7BVNR7-wsUpPloN.js → railroad-peg-JR7BVNR7-BOlq3d9c.js} +1 -1
- package/dist/assets/assets/{railroadDiagram-Y72NRBL7-BYJtosKO.js → railroadDiagram-Y72NRBL7-Chg32HoU.js} +2 -2
- package/dist/assets/assets/{requirementDiagram-EQYSW5RA-YYdoWMnl.js → requirementDiagram-EQYSW5RA-VenIs_eg.js} +2 -2
- package/dist/assets/assets/{sankeyDiagram-SY24JHO5-DtZyCTdM.js → sankeyDiagram-SY24JHO5-BdByqMKF.js} +2 -2
- package/dist/assets/assets/{sequenceDiagram-BLEHNHQU-BPE8f413.js → sequenceDiagram-BLEHNHQU-D3Do4GJE.js} +2 -2
- package/dist/assets/assets/{src-BNTOLq2G.js → src-DmfN-DA-.js} +2 -2
- package/dist/assets/assets/{stateDiagram-v2-A6IESKWZ-9f8Ow4Fl.js → stateDiagram-v2-A6IESKWZ-CZkRbPlf.js} +2 -2
- package/dist/assets/assets/{swimlanes-B3ENRKFQ-DdAEbxGp.js → swimlanes-B3ENRKFQ-DRTdF9AF.js} +2 -2
- package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-BYr_4JUb.js +9 -0
- package/dist/assets/assets/{timeline-definition-JXYKGLGB-DJNGd2mU.js → timeline-definition-JXYKGLGB-BVcuws_M.js} +2 -2
- package/dist/assets/assets/{treeView-D4JQ5SDB-BHONoCCw.js → treeView-D4JQ5SDB-BLtOJGqO.js} +1 -1
- package/dist/assets/assets/{treemap-SAJKECNS-pOaYkxq7.js → treemap-SAJKECNS-Dn3BWJ4v.js} +1 -1
- package/dist/assets/assets/{usecaseDiagram-WPOLBNNX-C3eDYL9v.js → usecaseDiagram-WPOLBNNX-CBExIKDY.js} +2 -2
- package/dist/assets/assets/{vennDiagram-Q3Y3IDCW-CJi1xfsR.js → vennDiagram-Q3Y3IDCW-C6FIx2L4.js} +2 -2
- package/dist/assets/assets/{wardley-7MLQ67FV-CEy4w7Ir.js → wardley-7MLQ67FV-Cjj2xSBp.js} +1 -1
- package/dist/assets/assets/{wardleyDiagram-IVAIDKWA-DfdLMMpN.js → wardleyDiagram-IVAIDKWA-sQPCBCFK.js} +2 -2
- package/dist/assets/assets/{webpack-v8XGbQTa.js → webpack-DDCA0aDL.js} +2 -2
- package/dist/assets/assets/{xychartDiagram-4URNHDU4-Aw-Ix4uC.js → xychartDiagram-4URNHDU4-bZ4rifSw.js} +2 -2
- package/dist/assets/bundle-asset-policy.json +1 -1
- package/dist/assets/index.html +8 -2
- package/dist/assets/mascot/cta-provider.png +0 -0
- package/dist/assets/mascot/cta-sign-in.png +0 -0
- package/dist/assets/plugins/assets/base-GzIOAd-t.css +2 -0
- package/dist/assets/plugins/assets/browserCaptureWorklet-Droj0fW0-Droj0fW0.js +13 -0
- package/dist/assets/plugins/assets/day-bottom-left-5um-x02r-5um-x02r.webp +0 -0
- package/dist/assets/plugins/assets/day-grain-CvEuNhlI-CvEuNhlI.webp +0 -0
- package/dist/assets/plugins/assets/day-right-C9W-XtjV-C9W-XtjV.webp +0 -0
- package/dist/assets/plugins/assets/day-top-left-B544Eq9J-B544Eq9J.webp +0 -0
- package/dist/assets/plugins/assets/night-bottom-left-N03ST5Uz-N03ST5Uz.webp +0 -0
- package/dist/assets/plugins/assets/night-grain-BY9q-tNN-BY9q-tNN.webp +0 -0
- package/dist/assets/plugins/assets/night-right-C6Denrqj-C6Denrqj.webp +0 -0
- package/dist/assets/plugins/assets/night-top-left-KOou6UxY-KOou6UxY.webp +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-D8FIos2q.js +1 -0
- package/dist/assets/plugins/chunks/schemas-DVQ8BvvP.js +55 -0
- package/dist/assets/plugins/compositions.json +1 -1
- package/dist/assets/plugins/slots/approval.09e72f36-DxS_uibk.js +2 -0
- package/dist/assets/plugins/slots/artifacts.50b639bb-Cp37TAkd.js +1 -0
- package/dist/assets/plugins/slots/author.ea449ace-Ds9Y-tjN.js +93 -0
- package/dist/assets/plugins/slots/autocompact.6f428144-CDZpN7I7.js +1 -0
- package/dist/assets/plugins/slots/backdrop-bamboo.6e4c928d-qbifuMc6.js +1 -0
- package/dist/assets/plugins/slots/browse.fa1f1a50-CVYvo1M5.js +1 -0
- package/dist/assets/plugins/slots/builtin-tools.75108f21-Cq1ljoL-.js +7 -0
- package/dist/assets/plugins/slots/calendar.d8b70190-BBjpOs1v.js +2 -0
- package/dist/assets/plugins/slots/codemode.c58fb583-DOR6OR7R.js +11 -0
- package/dist/assets/plugins/slots/domain.753f9f92-CJrXxig9.js +1 -0
- package/dist/assets/plugins/slots/edit.804fec90-BFF7_xN9.js +7 -0
- package/dist/assets/plugins/slots/files.66ffc636-CzOlZrRm.js +2 -0
- package/dist/assets/plugins/slots/goal.45dffa01-BtQBp3sw.js +1 -0
- package/dist/assets/plugins/slots/grep.98262cff-9bUDfjyT.js +1 -0
- package/dist/assets/plugins/slots/help.5fbd20f7-B4-y6gYK.js +3 -0
- package/dist/assets/plugins/slots/log.cb964209-BRPa3cVs.js +4 -0
- package/dist/assets/plugins/slots/mcp.82cc1ff5-CFtzPkPC.js +55 -0
- package/dist/assets/plugins/slots/plan.3852ba52-CH59Ff49.js +3 -0
- package/dist/assets/plugins/slots/profile.ab16dcec-0e9fWWyE.js +1 -0
- package/dist/assets/plugins/slots/prompts.ae48c07a-BTqYnBX5.js +38 -0
- package/dist/assets/plugins/slots/read.4560591a-C7fMXDEH.js +1 -0
- package/dist/assets/plugins/slots/runner.6e494d59-CqrpqhW9.js +9 -0
- package/dist/assets/plugins/slots/scaffold.d87a6ee0-9qY5gkYW.js +1 -0
- package/dist/assets/plugins/slots/session-mcp.2be84084-Cf0cqopp.js +2 -0
- package/dist/assets/plugins/slots/sessions.6f47cb4c-B1_eqPJQ.js +1 -0
- package/dist/assets/plugins/slots/skill.62a0a1b3-D-SKX8iw.js +4 -0
- package/dist/assets/plugins/slots/space.65a27e5a-fbLHc-DX.js +1 -0
- package/dist/assets/plugins/slots/subagents.8bb9992c-Cm_YMEnn.js +7 -0
- package/dist/assets/plugins/slots/template-advanced.59f3f98a-L0WOM4JT.js +1 -0
- package/dist/assets/plugins/slots/template-desktop.0f0b8491-By9BZlaL.js +7 -0
- package/dist/assets/plugins/slots/template-elegant.0e3b0acf-El05x7HK.js +1 -0
- package/dist/assets/plugins/slots/vault.3cbfcdc3-DpU_65Wy.js +1 -0
- package/dist/assets/plugins/slots/voice.a952113d-CvcuL__m.js +1 -0
- package/dist/assets/plugins/slots/web-search.65013836-NVh9fdvE.js +1 -0
- package/dist/assets/plugins/slots/workflows.cbc5c5c0-OLKSY9PE.js +16 -0
- package/dist/assets/pwa/pwa.js +12 -12
- package/dist/assets/pwa/sw.js +58 -4
- package/dist/{atomicJson-wczZBXQP.js → atomicJson-XYtxz032.js} +2 -3
- package/dist/{azure-openai-config-DHMgdIa-.js → azure-openai-config-S-quxzTC.js} +2 -2
- package/dist/{azure-openai-responses-CTgRdQ4m.js → azure-openai-responses-DdpV5zh7.js} +13 -13
- package/dist/backgroundWork-Bv0ib_lY.js +49 -0
- package/dist/{layeredConfig-xmTHGrw8.js → browser-DwY5dXHX.js} +21 -983
- package/dist/{browser-EJ5_ffnN.js → browser-IsHIcvFg.js} +1 -1
- package/dist/browser-ks_k-6KA.js +36 -0
- package/dist/calendarSetup-CI3AACVo.js +3892 -0
- package/dist/childProcess-Cv8rJuUf.js +32 -0
- package/dist/childSession-BrDCrNtL.js +25 -0
- package/dist/{classifier-shared-jXm-plIK.js → classifier-shared-DFprgrML.js} +5 -5
- package/dist/{cloudflare-workers-ai-system-one-B0wH6HU5.js → cloudflare-workers-ai-system-one-B0MD19yZ.js} +3 -3
- package/dist/{codemode-CFVDmyGm.js → codemode-LpcMFMYM.js} +1 -1
- package/dist/coerce-DM9YrILC.js +13 -0
- package/dist/config-DeWkdjj7.js +1372 -0
- package/dist/contextContributions-C1bsEJef.js +13 -0
- package/dist/contracts-CW8o6Xyi.js +19 -0
- package/dist/contracts-WRa9e98H.js +40 -0
- package/dist/cordisHost-_-jtkneB.js +25 -0
- package/dist/delegation-B2rBgv8A.js +100 -0
- package/dist/{diagnostics-DPTP-yrt.js → diagnostics-BY5LXbHJ.js} +2 -2
- package/dist/{dist-BVBi6VMV.js → dist-B2ArMqge.js} +1 -1
- package/dist/{server-Cg07O2W6.js → dist-C6IqjC-m.js} +1 -546
- package/dist/{dist-PDDFdqDX.js → dist-CDz5dYMj.js} +1 -1
- package/dist/{dist-Dvx5mlIR.js → dist-kgi2Ix1y.js} +16 -3
- package/dist/{emscripten-module.cloudflare-D4Bc9Ykz.js → emscripten-module.cloudflare-B4fhfquU.js} +1 -1
- package/dist/{env-api-keys-CAnjjnsR.js → env-api-keys-BgCPpU9t.js} +1 -1
- package/dist/{error-body-DQZRsyL5.js → error-body-CeumezyR.js} +26 -4
- package/dist/esm-BKJy3O9-.js +1553 -0
- package/dist/{remoteMcp-DqE2xFWS.js → exports-BEEgtkya.js} +1588 -714
- package/dist/{exports-LjvSY7Y6.js → exports-CBp_9dVk.js} +47 -28
- package/dist/exports-CRjRvvX0.js +34 -0
- package/dist/exports-Cg0wxflf.js +1 -0
- package/dist/exports-Ct56PRB9.js +46 -0
- package/dist/extensionFile-B940JOEn.js +121 -0
- package/dist/{factory-Cs8iaUtc.js → factory-BU0cZY0I.js} +1 -1
- package/dist/{github-copilot-headers-DpQQAh-s.js → github-copilot-headers-Cq9pnpl2.js} +1 -1
- package/dist/{google-generative-ai-BTTOo5RQ.js → google-generative-ai-DmbUlCGv.js} +9 -9
- package/dist/{google-shared-S7bqOccz.js → google-shared-Diz2uk39.js} +6 -6
- package/dist/{google-vertex-BcMU_DMb.js → google-vertex-CGCpI9Po.js} +10 -10
- package/dist/{domains-B6Ae4swm.js → harnessState-Df--jB5z.js} +162 -42
- package/dist/{harnessStore-Ccbia9_u.js → harnessStore-DInwiLYb.js} +4 -5
- package/dist/{hash-B3RRpLS2.js → hash-IQBoLxOB.js} +1 -1
- package/dist/{headers-BEuxFxDI.js → headers-Dkgiqogr.js} +1 -1
- package/dist/help-C9UGKetC.js +100 -0
- package/dist/home-kwZFHqOx.js +60 -0
- package/dist/http-BekstF5S.js +64 -0
- package/dist/hubChannel-Dldv3EEb.js +32 -0
- package/dist/hubRevisions-BPoC6quI.js +364 -0
- package/dist/{identity-BIeAyilV.js → identity-BzB1N-Sn.js} +3 -3
- package/dist/index.edge-BiVQ9LoZ.js +198 -0
- package/dist/index.edge-CSGx6QOL.js +56 -0
- package/dist/index.edge-ClLTmPFz.js +191 -0
- package/dist/index.edge-CzoLWbyl.js +238 -0
- package/dist/index.edge-D1biKw71.js +946 -0
- package/dist/index.edge-D2RirEwK.js +14 -0
- package/dist/iso-BGFmgtky.js +27 -0
- package/dist/{kysely-adapter-D51abb3q.js → kysely-adapter-D8KUrWxm.js} +1 -1
- package/dist/liquid.browser-1BcykmIN.js +4596 -0
- package/dist/manualTranscription-DN56fzgj.js +96 -0
- package/dist/{mcpProjection-BXiECnW0.js → mcpProjection-D2U50Pel.js} +1 -2
- package/dist/meta-CVgfTHQP.js +1030 -0
- package/dist/migrations-DJBPDwSR.js +32 -0
- package/dist/{mistral-conversations-DN8VSERk.js → mistral-conversations-Bv_m1MRF.js} +12 -12
- package/dist/modeDefinition-Di95_IiU.js +44 -0
- package/dist/{models-D6d73jcW.js → models-D50yN8Ag.js} +41 -46
- package/dist/{node-UuMT2C3q.js → node-B4kSjHeD.js} +2 -2
- package/dist/{node-DytJOfYf.js → node-CBLSc-YH.js} +1 -1
- package/dist/notification-DjxbNoMR.js +143 -0
- package/dist/{openai-bt3ZRBZv.js → openai-D6Q-l6hT.js} +187 -187
- package/dist/{openai-codex-responses-cL36x0ml.js → openai-codex-responses-BnoiTqYV.js} +21 -25
- package/dist/{openai-completions-BWsTNYyT.js → openai-completions-C68qs5rI.js} +26 -19
- package/dist/{openai-decisions-Dfn_KgQd.js → openai-decisions-BSxU_aoV.js} +3 -3
- package/dist/{openai-responses-aa0LoyCJ.js → openai-responses-D6hXen-k.js} +17 -15
- package/dist/{openai-responses-shared-H-jH5SlM.js → openai-responses-shared-BD8K7FAC.js} +7 -7
- package/dist/{openrouter-cost-D99Qqcs6.js → openrouter-cost-BPam8wyW.js} +1 -1
- package/dist/{openrouter-images-BpwVpALC.js → openrouter-images-DylXiHy7.js} +7 -7
- package/dist/{hubChannel-Dn5NMpvu.js → packageApi-DYkaxP59.js} +33 -42
- package/dist/photon_rs_bg.wasm +0 -0
- package/dist/{pi-messages-BHAIkYBj.js → pi-messages-DaIlYYlO.js} +6 -6
- package/dist/piConfig-5tRPD0ov.js +126 -0
- package/dist/piSettings-ekBG5OeF.js +1 -0
- package/dist/platform-CQahdzpG.js +138 -0
- package/dist/pluginCatalog-BAALyedS.js +30 -0
- package/dist/pluginContributions-Be9EnCAW.js +16 -0
- package/dist/pluginProtocol-7_gVUeM9.js +1 -0
- package/dist/pluginProtocol-DVIfJnav.js +135 -0
- package/dist/portableConfig-0tnk9anb.js +49 -0
- package/dist/presetConfig-n-oiNd3h.js +541 -0
- package/dist/profileSources-D1rymC97.js +537 -0
- package/dist/{protocol-DUeE0Q8z.js → protocol-Cri0GpZR.js} +1 -2
- package/dist/{provider-env-DgfpjgTa.js → provider-env-DJb40UF7.js} +2 -2
- package/dist/{provider-retry-ChD-K2Gv.js → provider-retry-jpvs7ixx.js} +1 -1
- package/dist/{puppeteer-cloudflare-B-GHrPGO.js → puppeteer-cloudflare-D4l8smMS.js} +3 -3
- package/dist/{server-BWJmxCrm.js → readiness-Ydw5zrKy.js} +4 -169
- package/dist/{rolldown-runtime-B-lAHAz2.js → rolldown-runtime-DbVrKiKs.js} +1 -1
- package/dist/{sanitize-unicode-Dl4ROF7y.js → sanitize-unicode-B1ZFaEtf.js} +1 -1
- package/dist/scaffoldRegistry-CeFe3Pf0.js +1240 -0
- package/dist/{schemas-Vj8-rCR4.js → schemas-D2dRon18.js} +1901 -53
- package/dist/server-AKM07WcM.js +466 -0
- package/dist/server-B0tM5Ygf.js +1300 -0
- package/dist/server-B8-vStCx.js +1116 -0
- package/dist/server-BAbdiL38.js +15108 -0
- package/dist/server-BCZ_R3kX.js +3326 -0
- package/dist/server-BGKAeB3M.js +492 -0
- package/dist/server-BIQhg1jS.js +26985 -0
- package/dist/server-BcPD_6a2.js +1533 -0
- package/dist/server-BeoA0QB-.js +580 -0
- package/dist/server-BsgvOpBF.js +24 -0
- package/dist/server-BtnOqSB5.js +156 -0
- package/dist/server-C-HBjWRo.js +2800 -0
- package/dist/{server-CWg0m_wq.js → server-C0Lt6nTt.js} +269 -1062
- package/dist/server-C8NPfG1H.js +148 -0
- package/dist/server-CKkaxOc0.js +978 -0
- package/dist/server-CMaWF5UA.js +1379 -0
- package/dist/server-CQPI6jIa.js +295 -0
- package/dist/{server-BhYE7Vqk.js → server-CQmb0lYL.js} +114 -176
- package/dist/server-CWR34Vx6.js +1884 -0
- package/dist/server-CZiAy2v5.js +641 -0
- package/dist/server-Cjtr0oVJ.js +584 -0
- package/dist/server-CkJQJ3Oo.js +571 -0
- package/dist/server-ClQQGtsI.js +679 -0
- package/dist/server-Cy2FhGBm.js +1744 -0
- package/dist/server-D8yEblCB.js +24 -0
- package/dist/server-DF0YIUeI.js +9603 -0
- package/dist/server-DRFESCq1.js +1527 -0
- package/dist/{server-zkcrP99W.js → server-Df1defzp.js} +89 -87
- package/dist/server-DgZd_TuT.js +189 -0
- package/dist/server-Dkc9Kth2.js +1830 -0
- package/dist/server-DlRePYOB.js +343 -0
- package/dist/{server-BpPEzRes.js → server-_HZm8wEC.js} +654 -745
- package/dist/{server-yABhJa2K.js → server-_jWkMESg.js} +60 -39
- package/dist/server-lgV6liTt.js +140 -0
- package/dist/server-nHPXbRDA.js +742 -0
- package/dist/server-p7qANgrf.js +877 -0
- package/dist/server-vhmQi3co.js +112 -0
- package/dist/{server-SA0dsIJ2.js → server-w1aKMZOs.js} +3 -10
- package/dist/serverPlugin-4nI5J6Zt.js +39622 -0
- package/dist/session-resources-BvR3cwiH.js +10 -0
- package/dist/{sessionConfig-DgnPcGBu.js → sessionConfig-UMlgu98q.js} +926 -844
- package/dist/{simple-options-DWrW31_K.js → simple-options-Cp5p46f9.js} +13 -6
- package/dist/space-C3Wnli1l.js +92 -0
- package/dist/sse-XlzXs1es.js +151 -0
- package/dist/{streaming-json-t4rzNHEp.js → streaming-json-CZyrX_Ux.js} +6 -6
- package/dist/{system-one-shared-DLVLdzYL.js → system-one-shared-Du6bka0h.js} +3 -3
- package/dist/{notification-valMY1zH.js → telemetry-CrTcxeA5.js} +2 -93
- package/dist/{transform-messages-CjTSwW9q.js → transform-messages-CBj9g2mx.js} +3 -16
- package/dist/truncate-M3KbFyVj.js +89 -0
- package/dist/{server-BXjfQYeU.js → type-DppaYz6F.js} +955 -1187
- package/dist/type-yokaDI_F.js +7 -0
- package/dist/{typesafe-system-one-DBVcjcUQ.js → typesafe-system-one-C7YFgvrX.js} +3 -3
- package/dist/{uuid-mkNGilLv.js → uuid-BVI0BZsx.js} +1 -1
- package/dist/{validation-BLnxgJU_.js → validation-QWuk6kwJ.js} +79 -74
- package/dist/vaultSettings-Bq8wkbDv.js +292 -0
- package/dist/voiceTools-BdJyfzwB.js +246 -0
- package/dist/web-B2sdV-F2.js +4 -0
- package/dist/worker.js +97821 -72579
- package/dist/workflow-DTCt4n6k.js +171 -0
- package/dist/workflowServices-RlswfHWp.js +300 -0
- package/package.json +55 -25
- package/wrangler.jsonc +16 -3
- package/dist/apiContracts-sG5b90Qa.js +0 -4451
- package/dist/assets/assets/channel-BOT7In0s.js +0 -2
- package/dist/assets/assets/chunk-XXDRQBXY-Dp9-QbR6.js +0 -2
- package/dist/assets/assets/flowDiagram-IUGLLWBU-B9D9uWwn.js +0 -1
- package/dist/assets/assets/index-BlPEYpuN.css +0 -1
- package/dist/assets/assets/index-DS9w_Q1B.js +0 -155
- package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-CyUKtW7v.js +0 -9
- package/dist/assets/plugins/assets/base-DyDpY0zD.css +0 -2
- package/dist/assets/plugins/chunks/po-web-runtime-4JiBsb_c.js +0 -1
- package/dist/assets/plugins/slots/approval.09e72f36-DwFz-UMh.js +0 -2
- package/dist/assets/plugins/slots/artifacts.50b639bb-CUtFC806.js +0 -1
- package/dist/assets/plugins/slots/builtin-tools.75108f21-B69GLfY_.js +0 -7
- package/dist/assets/plugins/slots/codemode.c58fb583-C0Gmb7_s.js +0 -9
- package/dist/assets/plugins/slots/domain.753f9f92-BTBYRLkE.js +0 -1
- package/dist/assets/plugins/slots/mcp.82cc1ff5-Ecacjn0a.js +0 -109
- package/dist/assets/plugins/slots/profile.ab16dcec-DIVXNHmh.js +0 -1
- package/dist/assets/plugins/slots/skill.62a0a1b3-BNr7DmPH.js +0 -4
- package/dist/backgroundWork-CSpsJ-Rg.js +0 -25
- package/dist/contextProjection-DDIQRgN4.js +0 -188
- package/dist/extensionFile-CacKVegY.js +0 -409
- package/dist/harnessState-gmzJcPGt.js +0 -88
- package/dist/harnessStore-Ch6hdYYe.js +0 -1
- package/dist/index.edge-BgSx_gRO.js +0 -45
- package/dist/majorModes-CCnwAjfF.js +0 -333
- package/dist/majorModes-DNQbxkpt.js +0 -1
- package/dist/piSettings-B6fsgIBA.js +0 -1
- package/dist/platform-Bs2_X_dK.js +0 -16
- package/dist/platformFiles-CCGujP9o.js +0 -39
- package/dist/server-5hLs7M43.js +0 -656
- package/dist/server-B3iqBHOP.js +0 -118
- package/dist/server-Dv0EKLwc.js +0 -108
- package/dist/server-Y5A21sJf.js +0 -591
- package/dist/server-a1K226XK.js +0 -279
- package/dist/serverPlugin-DUc4gGep.js +0 -7279
- package/dist/value-Bd477RDX.js +0 -2247
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as PoProtocolError } from "./protocol-
|
|
4
|
-
import { a as
|
|
5
|
-
//#region ../../foundations/po-
|
|
6
|
-
const
|
|
1
|
+
import { Et as composeServerProviderOverrides, n as runCleanups, t as defineServerPlugin } from "./serverPlugin-4nI5J6Zt.js";
|
|
2
|
+
import { a as defineHook, c as defineRoot, d as defineServerCommand, l as defineRoute, n as composeRootInjects, t as composeRootHooks } from "./extensionFile-B940JOEn.js";
|
|
3
|
+
import { t as PoProtocolError } from "./protocol-Cri0GpZR.js";
|
|
4
|
+
import { a as MODE_CATALOG_SOURCE, c as PO_MODE_ENTRY_TYPE, n as validateModeActionArguments, o as MODE_ERROR_CODE, r as validateModeDefinition, s as PO_MODE_CATALOG_SERVICE, t as modeKey } from "./validation-QWuk6kwJ.js";
|
|
5
|
+
//#region ../../foundations/po-mode/src/constants/command.ts
|
|
6
|
+
const MODE_COMMAND_DESCRIPTION = "Toggle or drive modes";
|
|
7
7
|
//#endregion
|
|
8
|
-
//#region ../../foundations/po-
|
|
9
|
-
const
|
|
8
|
+
//#region ../../foundations/po-mode/src/services/command/index.ts
|
|
9
|
+
const MODE_COMMAND = "mode";
|
|
10
10
|
const REQUESTER_SOURCE = "@agimon-ai/po/mode-catalog/ui-command";
|
|
11
11
|
function isOn(record) {
|
|
12
12
|
return record.state.activation === "active" || record.state.activation === "deactivating";
|
|
13
13
|
}
|
|
14
14
|
/** A catalog mode addressed the way a person types it: id, label, or id stem. */
|
|
15
|
-
function
|
|
15
|
+
function matchMode(records, query) {
|
|
16
16
|
const needle = query.toLowerCase();
|
|
17
17
|
return records.find((record) => record.descriptor.id.toLowerCase() === needle || record.descriptor.label.toLowerCase() === needle || record.descriptor.id.toLowerCase().split(".")[0] === needle);
|
|
18
18
|
}
|
|
@@ -56,31 +56,31 @@ async function promptArguments(ui, action) {
|
|
|
56
56
|
return collected;
|
|
57
57
|
}
|
|
58
58
|
/** Runs the catalog command against an explicit interaction surface. */
|
|
59
|
-
async function
|
|
59
|
+
async function executeModeCommand(args, options) {
|
|
60
60
|
const { catalog, kind, ui } = options;
|
|
61
61
|
if (!catalog) {
|
|
62
|
-
await ui.notify("
|
|
62
|
+
await ui.notify("Modes are unavailable in this session.", "warning");
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
65
|
const records = catalog.list();
|
|
66
66
|
const [modeQuery, actionQuery] = args.trim().split(/\s+/).filter(Boolean);
|
|
67
67
|
let record;
|
|
68
68
|
if (modeQuery) {
|
|
69
|
-
record =
|
|
69
|
+
record = matchMode(records, modeQuery);
|
|
70
70
|
if (!record) {
|
|
71
71
|
const known = records.map((entry) => entry.descriptor.label.toLowerCase()).join(", ") || "none";
|
|
72
|
-
await ui.notify(`No
|
|
72
|
+
await ui.notify(`No mode matches "${modeQuery}". Available: ${known}. Presets are selected with /preset.`, "warning");
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
75
|
} else {
|
|
76
76
|
const listed = records.filter((entry) => actionsFor(entry, kind).length > 0);
|
|
77
77
|
if (listed.length === 0) {
|
|
78
|
-
await ui.notify("No
|
|
78
|
+
await ui.notify("No modes are available in this session.", "info");
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
81
|
const labels = listed.map((entry) => `${isOn(entry) ? "[x]" : "[ ]"} ${entry.descriptor.label}: ${entry.descriptor.description}`);
|
|
82
82
|
const on = listed.filter(isOn).length;
|
|
83
|
-
const picked = await ui.select(`
|
|
83
|
+
const picked = await ui.select(`Modes (${String(on)} on)`, labels);
|
|
84
84
|
if (picked === void 0) return;
|
|
85
85
|
record = listed[labels.indexOf(picked)];
|
|
86
86
|
if (!record) return;
|
|
@@ -121,7 +121,7 @@ async function executeMinorModeCommand(args, options) {
|
|
|
121
121
|
},
|
|
122
122
|
actionId: action.id,
|
|
123
123
|
arguments: argumentsValue
|
|
124
|
-
}, REQUESTER_SOURCE);
|
|
124
|
+
}, REQUESTER_SOURCE, void 0, options.clientMetadata);
|
|
125
125
|
const state = response.mode.state;
|
|
126
126
|
const detail = state.detail ? `: ${state.detail}` : "";
|
|
127
127
|
await ui.notify(response.message ?? `${record.descriptor.label} is ${state.activation}${detail}.`, "info");
|
|
@@ -130,16 +130,17 @@ async function executeMinorModeCommand(args, options) {
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
//#endregion
|
|
133
|
-
//#region ../../foundations/po-
|
|
134
|
-
function
|
|
133
|
+
//#region ../../foundations/po-mode/src/services/headlessCommand/index.ts
|
|
134
|
+
function headlessModeCommand(catalog) {
|
|
135
135
|
return {
|
|
136
|
-
name:
|
|
137
|
-
description:
|
|
136
|
+
name: MODE_COMMAND,
|
|
137
|
+
description: MODE_COMMAND_DESCRIPTION,
|
|
138
138
|
async execute(args, execution) {
|
|
139
139
|
const executionClient = execution.client;
|
|
140
|
-
await
|
|
140
|
+
await executeModeCommand(args, {
|
|
141
141
|
catalog,
|
|
142
142
|
kind: "headless",
|
|
143
|
+
...execution.clientMetadata === void 0 ? {} : { clientMetadata: execution.clientMetadata },
|
|
143
144
|
ui: {
|
|
144
145
|
async select(title, options) {
|
|
145
146
|
const selected = await executionClient.request({
|
|
@@ -178,7 +179,7 @@ function headlessMinorModeCommand(catalog) {
|
|
|
178
179
|
};
|
|
179
180
|
}
|
|
180
181
|
//#endregion
|
|
181
|
-
//#region ../../foundations/po-
|
|
182
|
+
//#region ../../foundations/po-mode/src/services/catalog/index.ts
|
|
182
183
|
function protocolError(code, message, retryable = false) {
|
|
183
184
|
return new PoProtocolError({
|
|
184
185
|
code,
|
|
@@ -201,8 +202,8 @@ function sameRequest(left, right) {
|
|
|
201
202
|
return JSON.stringify(left) === JSON.stringify(right);
|
|
202
203
|
}
|
|
203
204
|
function abortError(signal) {
|
|
204
|
-
const timeout = signal.reason === "
|
|
205
|
-
return protocolError(timeout ?
|
|
205
|
+
const timeout = signal.reason === "mode-timeout";
|
|
206
|
+
return protocolError(timeout ? MODE_ERROR_CODE.actionTimeout : MODE_ERROR_CODE.actionAborted, timeout ? "Mode action timed out." : "Mode action was aborted.", timeout);
|
|
206
207
|
}
|
|
207
208
|
async function runAbortable(operation, signal) {
|
|
208
209
|
if (signal.aborted) throw abortError(signal);
|
|
@@ -212,15 +213,15 @@ async function runAbortable(operation, signal) {
|
|
|
212
213
|
operation.then(resolve, reject).finally(() => signal.removeEventListener("abort", aborted));
|
|
213
214
|
});
|
|
214
215
|
}
|
|
215
|
-
function
|
|
216
|
-
const generation = `${
|
|
216
|
+
function createModeCatalogHost(options) {
|
|
217
|
+
const generation = `${MODE_CATALOG_SOURCE}:${crypto.randomUUID()}`;
|
|
217
218
|
const actionTimeoutMs = options.actionTimeoutMs ?? 3e4;
|
|
218
219
|
const owners = /* @__PURE__ */ new Map();
|
|
219
220
|
const activeByMode = /* @__PURE__ */ new Map();
|
|
220
221
|
const pending = /* @__PURE__ */ new Map();
|
|
221
222
|
const listeners = /* @__PURE__ */ new Set();
|
|
222
223
|
const restoreTimers = /* @__PURE__ */ new Set();
|
|
223
|
-
const restoreRecords = new Map((options.restoreSnapshot?.modes ?? []).filter(({ state }) => state.activation === "active" || state.activation === "activating").map((record) => [
|
|
224
|
+
const restoreRecords = new Map((options.restoreSnapshot?.modes ?? []).filter(({ state }) => state.activation === "active" || state.activation === "activating").map((record) => [modeKey(record.descriptor), structuredClone(record)]));
|
|
224
225
|
let revision = 0;
|
|
225
226
|
let disposed = false;
|
|
226
227
|
const notify = () => {
|
|
@@ -232,22 +233,23 @@ function createMinorModeCatalogHost(options) {
|
|
|
232
233
|
revision,
|
|
233
234
|
modes: [...owners.values()].map(({ record }) => structuredClone(record)).toSorted((left, right) => left.descriptor.order - right.descriptor.order || left.descriptor.source.localeCompare(right.descriptor.source) || left.descriptor.id.localeCompare(right.descriptor.id))
|
|
234
235
|
});
|
|
235
|
-
const invokeOwner = async (owner, request, signal) => {
|
|
236
|
+
const invokeOwner = async (owner, request, signal, clientMetadata) => {
|
|
236
237
|
const action = owner.record.descriptor.actions.find(({ id }) => id === request.actionId);
|
|
237
238
|
const availability = owner.record.state.actions.find(({ id }) => id === request.actionId);
|
|
238
|
-
if (!action) throw protocolError(
|
|
239
|
-
if (!availability?.enabled) throw protocolError(
|
|
240
|
-
if (!action.contexts.includes(options.sessionKind)) throw protocolError(
|
|
241
|
-
|
|
239
|
+
if (!action) throw protocolError(MODE_ERROR_CODE.actionNotFound, `Mode action '${request.actionId}' was not found.`);
|
|
240
|
+
if (!availability?.enabled) throw protocolError(MODE_ERROR_CODE.actionDisabled, availability?.disabledReason ?? `Mode action '${request.actionId}' is disabled.`);
|
|
241
|
+
if (!action.contexts.includes(options.sessionKind)) throw protocolError(MODE_ERROR_CODE.unsupportedContext, `Action '${action.id}' is unavailable in ${options.sessionKind} sessions.`);
|
|
242
|
+
validateModeActionArguments(action, request.arguments);
|
|
242
243
|
try {
|
|
243
244
|
const result = await runAbortable(Promise.resolve(owner.definition.handleAction(request.actionId, structuredClone(request.arguments), {
|
|
244
245
|
context: options.context,
|
|
245
246
|
operationId: request.operationId,
|
|
246
247
|
sessionKind: options.sessionKind,
|
|
247
|
-
signal
|
|
248
|
+
signal,
|
|
249
|
+
...clientMetadata === void 0 ? {} : { clientMetadata }
|
|
248
250
|
})), signal);
|
|
249
|
-
const current = owners.get(
|
|
250
|
-
if (disposed || current !== owner) throw protocolError(
|
|
251
|
+
const current = owners.get(modeKey(owner.record.descriptor));
|
|
252
|
+
if (disposed || current !== owner) throw protocolError(MODE_ERROR_CODE.staleRegistration, "Mode owner was replaced.");
|
|
251
253
|
return {
|
|
252
254
|
operationId: request.operationId,
|
|
253
255
|
catalogRevision: revision,
|
|
@@ -258,27 +260,27 @@ function createMinorModeCatalogHost(options) {
|
|
|
258
260
|
if (signal.aborted) throw abortError(signal);
|
|
259
261
|
if (error instanceof PoProtocolError) throw error;
|
|
260
262
|
owner.definition.onError?.(error);
|
|
261
|
-
throw protocolError(
|
|
263
|
+
throw protocolError(MODE_ERROR_CODE.ownerFailed, error instanceof Error ? error.message : String(error));
|
|
262
264
|
}
|
|
263
265
|
};
|
|
264
|
-
const invoke = (request, requesterSource, signal) => {
|
|
265
|
-
if (disposed) return Promise.reject(protocolError(
|
|
266
|
+
const invoke = (request, requesterSource, signal, clientMetadata) => {
|
|
267
|
+
if (disposed) return Promise.reject(protocolError(MODE_ERROR_CODE.sessionReplaced, "Mode catalog is disposed."));
|
|
266
268
|
const terminal = pending.get(request.operationId);
|
|
267
269
|
if (terminal) {
|
|
268
|
-
if (terminal.requesterSource !== requesterSource || !sameRequest(terminal.request, request)) return Promise.reject(protocolError(
|
|
270
|
+
if (terminal.requesterSource !== requesterSource || !sameRequest(terminal.request, request)) return Promise.reject(protocolError(MODE_ERROR_CODE.registrationConflict, "Mode operation id was reused."));
|
|
269
271
|
return terminal.promise;
|
|
270
272
|
}
|
|
271
|
-
const key =
|
|
273
|
+
const key = modeKey(request.mode);
|
|
272
274
|
const owner = owners.get(key);
|
|
273
|
-
if (!owner || !sameRegistration(owner.record, request.mode)) return Promise.reject(protocolError(
|
|
274
|
-
if (activeByMode.has(key)) return Promise.reject(protocolError(
|
|
275
|
+
if (!owner || !sameRegistration(owner.record, request.mode)) return Promise.reject(protocolError(MODE_ERROR_CODE.modeNotFound, "Mode is unavailable."));
|
|
276
|
+
if (activeByMode.has(key)) return Promise.reject(protocolError(MODE_ERROR_CODE.modeBusy, "Mode already has an active action."));
|
|
275
277
|
const controller = new AbortController();
|
|
276
278
|
const onAbort = () => controller.abort(signal?.reason);
|
|
277
279
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
278
|
-
const timer = setTimeout(() => controller.abort("
|
|
280
|
+
const timer = setTimeout(() => controller.abort("mode-timeout"), actionTimeoutMs);
|
|
279
281
|
owner.operations.add(controller);
|
|
280
282
|
activeByMode.set(key, request.operationId);
|
|
281
|
-
const direct = () => invokeOwner(owner, request, controller.signal);
|
|
283
|
+
const direct = () => invokeOwner(owner, request, controller.signal, clientMetadata);
|
|
282
284
|
const promise = Promise.resolve(options.routeInvocation ? options.routeInvocation(request, requesterSource, direct) : direct()).finally(() => {
|
|
283
285
|
clearTimeout(timer);
|
|
284
286
|
signal?.removeEventListener("abort", onAbort);
|
|
@@ -294,7 +296,7 @@ function createMinorModeCatalogHost(options) {
|
|
|
294
296
|
return promise;
|
|
295
297
|
};
|
|
296
298
|
const scheduleRestoration = (owner) => {
|
|
297
|
-
const key =
|
|
299
|
+
const key = modeKey(owner.record.descriptor);
|
|
298
300
|
const previous = restoreRecords.get(key);
|
|
299
301
|
restoreRecords.delete(key);
|
|
300
302
|
if (!previous) return;
|
|
@@ -305,11 +307,11 @@ function createMinorModeCatalogHost(options) {
|
|
|
305
307
|
const availability = owner.record.state.actions.find(({ id }) => id === "activate");
|
|
306
308
|
if (!action || action.parameters.some(({ required }) => required) || !availability?.enabled) return;
|
|
307
309
|
invoke({
|
|
308
|
-
operationId: `
|
|
310
|
+
operationId: `mode-restore:${crypto.randomUUID()}`,
|
|
309
311
|
mode: registrationRef(owner.record),
|
|
310
312
|
actionId: "activate",
|
|
311
313
|
arguments: {}
|
|
312
|
-
},
|
|
314
|
+
}, MODE_CATALOG_SOURCE).catch((error) => {
|
|
313
315
|
if (options.onRestorationError) options.onRestorationError(error);
|
|
314
316
|
else queueMicrotask(() => {
|
|
315
317
|
throw error instanceof Error ? error : new Error(String(error));
|
|
@@ -327,13 +329,13 @@ function createMinorModeCatalogHost(options) {
|
|
|
327
329
|
return () => listeners.delete(listener);
|
|
328
330
|
},
|
|
329
331
|
registerOwner(definition) {
|
|
330
|
-
if (disposed) throw protocolError(
|
|
331
|
-
if (owners.size >= 128) throw protocolError(
|
|
332
|
+
if (disposed) throw protocolError(MODE_ERROR_CODE.sessionReplaced, "Mode catalog is disposed.");
|
|
333
|
+
if (owners.size >= 128) throw protocolError(MODE_ERROR_CODE.registrationConflict, "Mode catalog capacity reached.");
|
|
332
334
|
const initialState = structuredClone(definition.initialState);
|
|
333
|
-
const invalid =
|
|
334
|
-
if (invalid) throw protocolError(
|
|
335
|
-
const key =
|
|
336
|
-
if (owners.has(key)) throw protocolError(
|
|
335
|
+
const invalid = validateModeDefinition(definition.descriptor, initialState);
|
|
336
|
+
if (invalid) throw protocolError(MODE_ERROR_CODE.registrationConflict, invalid);
|
|
337
|
+
const key = modeKey(definition.descriptor);
|
|
338
|
+
if (owners.has(key)) throw protocolError(MODE_ERROR_CODE.registrationConflict, `Mode '${definition.descriptor.source}/${definition.descriptor.id}' already has a live owner.`);
|
|
337
339
|
const owner = {
|
|
338
340
|
token: Symbol(key),
|
|
339
341
|
definition,
|
|
@@ -342,7 +344,7 @@ function createMinorModeCatalogHost(options) {
|
|
|
342
344
|
descriptor: structuredClone(definition.descriptor),
|
|
343
345
|
state: initialState,
|
|
344
346
|
ownerGeneration: `${key}:${crypto.randomUUID()}`,
|
|
345
|
-
registrationId: `
|
|
347
|
+
registrationId: `mode-registration:${crypto.randomUUID()}`,
|
|
346
348
|
stateRevision: 0
|
|
347
349
|
}
|
|
348
350
|
};
|
|
@@ -354,7 +356,7 @@ function createMinorModeCatalogHost(options) {
|
|
|
354
356
|
getState: () => structuredClone(owner.record.state),
|
|
355
357
|
publish(state) {
|
|
356
358
|
if (ownerDisposed || owners.get(key) !== owner) return;
|
|
357
|
-
const validation =
|
|
359
|
+
const validation = validateModeDefinition(owner.record.descriptor, state);
|
|
358
360
|
if (validation) throw new Error(validation);
|
|
359
361
|
if (JSON.stringify(state) === JSON.stringify(owner.record.state)) return;
|
|
360
362
|
owner.record = {
|
|
@@ -368,7 +370,7 @@ function createMinorModeCatalogHost(options) {
|
|
|
368
370
|
if (ownerDisposed) return;
|
|
369
371
|
ownerDisposed = true;
|
|
370
372
|
if (owners.get(key) !== owner) return;
|
|
371
|
-
for (const controller of owner.operations) controller.abort("
|
|
373
|
+
for (const controller of owner.operations) controller.abort("mode-owner-disposed");
|
|
372
374
|
owner.operations.clear();
|
|
373
375
|
owners.delete(key);
|
|
374
376
|
notify();
|
|
@@ -382,7 +384,7 @@ function createMinorModeCatalogHost(options) {
|
|
|
382
384
|
for (const timer of restoreTimers) clearTimeout(timer);
|
|
383
385
|
restoreTimers.clear();
|
|
384
386
|
for (const owner of owners.values()) {
|
|
385
|
-
for (const controller of owner.operations) controller.abort("
|
|
387
|
+
for (const controller of owner.operations) controller.abort("mode-catalog-disposed");
|
|
386
388
|
owner.operations.clear();
|
|
387
389
|
}
|
|
388
390
|
owners.clear();
|
|
@@ -395,13 +397,13 @@ function createMinorModeCatalogHost(options) {
|
|
|
395
397
|
};
|
|
396
398
|
}
|
|
397
399
|
//#endregion
|
|
398
|
-
//#region ../../foundations/po-
|
|
400
|
+
//#region ../../foundations/po-mode/src/services/projection/index.ts
|
|
399
401
|
/**
|
|
400
402
|
* The catalog as a client should see it: one entry per mode, sorted the way
|
|
401
403
|
* the leader menu sorts, with only the actions this session kind can take and
|
|
402
404
|
* none of the registration bookkeeping a client has no use for.
|
|
403
405
|
*/
|
|
404
|
-
function
|
|
406
|
+
function projectModes(snapshot, kind) {
|
|
405
407
|
const modes = snapshot.modes.map((record) => ({
|
|
406
408
|
id: record.descriptor.id,
|
|
407
409
|
label: record.descriptor.label,
|
|
@@ -429,22 +431,22 @@ function projectMinorModes(snapshot, kind) {
|
|
|
429
431
|
};
|
|
430
432
|
}
|
|
431
433
|
/** Pure write-time policy. Bump schemaId at the caller if acceptance changes. */
|
|
432
|
-
function
|
|
434
|
+
function acceptsModeSelection(data) {
|
|
433
435
|
return !!data && typeof data === "object" && "modes" in data && Array.isArray(data.modes);
|
|
434
436
|
}
|
|
435
437
|
/** Reads the latest valid persisted activation set; absence preserves caller defaults. */
|
|
436
|
-
function
|
|
438
|
+
function restoreModeSelection(entries) {
|
|
437
439
|
for (const entry of [...entries].reverse()) {
|
|
438
|
-
if (!entry || typeof entry !== "object" || !("customType" in entry) || entry.customType !== "po-
|
|
440
|
+
if (!entry || typeof entry !== "object" || !("customType" in entry) || entry.customType !== "po-modes" || !("data" in entry)) continue;
|
|
439
441
|
const data = entry.data;
|
|
440
442
|
if (!data || typeof data !== "object" || !("modes" in data) || !Array.isArray(data.modes)) continue;
|
|
441
443
|
return [...new Set(data.modes.filter((mode) => mode && typeof mode === "object" && mode.activation === "active" && typeof mode.id === "string").map((mode) => mode.id))];
|
|
442
444
|
}
|
|
443
445
|
}
|
|
444
446
|
//#endregion
|
|
445
|
-
//#region ../../foundations/po-
|
|
447
|
+
//#region ../../foundations/po-mode/src/extensions/workspaces/sessions/(backend)/root.server.ts
|
|
446
448
|
var root_server_default = defineRoot(({ agent }) => {
|
|
447
|
-
if (!agent) throw new Error("
|
|
449
|
+
if (!agent) throw new Error("Modes require a session host");
|
|
448
450
|
let started = false;
|
|
449
451
|
let stopped = false;
|
|
450
452
|
let pending = Promise.resolve();
|
|
@@ -452,16 +454,16 @@ var root_server_default = defineRoot(({ agent }) => {
|
|
|
452
454
|
const publish = () => {
|
|
453
455
|
const operation = pending.then(async () => {
|
|
454
456
|
if (!started || stopped) return;
|
|
455
|
-
const projection =
|
|
457
|
+
const projection = projectModes(catalog.getSnapshot(), "headless");
|
|
456
458
|
const key = JSON.stringify(projection);
|
|
457
459
|
if (key === published) return;
|
|
458
|
-
await agent.context.session.appendCustomEntry(
|
|
460
|
+
await agent.context.session.appendCustomEntry(PO_MODE_ENTRY_TYPE, projection);
|
|
459
461
|
published = key;
|
|
460
462
|
});
|
|
461
463
|
pending = operation.catch(() => void 0);
|
|
462
464
|
return operation;
|
|
463
465
|
};
|
|
464
|
-
const catalog =
|
|
466
|
+
const catalog = createModeCatalogHost({
|
|
465
467
|
sessionKind: "headless",
|
|
466
468
|
context: { sessionManager: { getSessionId: () => agent.context.sessionId } },
|
|
467
469
|
async routeInvocation(_request, _source, invoke) {
|
|
@@ -473,7 +475,7 @@ var root_server_default = defineRoot(({ agent }) => {
|
|
|
473
475
|
});
|
|
474
476
|
const contributions = {
|
|
475
477
|
api: [{
|
|
476
|
-
basePath: "
|
|
478
|
+
basePath: "modes",
|
|
477
479
|
start: () => ({
|
|
478
480
|
fetch(request) {
|
|
479
481
|
if (new URL(request.url).pathname !== "/current") return Response.json({ error: "Not found" }, { status: 404 });
|
|
@@ -481,22 +483,22 @@ var root_server_default = defineRoot(({ agent }) => {
|
|
|
481
483
|
status: 405,
|
|
482
484
|
headers: { Allow: "GET" }
|
|
483
485
|
});
|
|
484
|
-
if (!started || stopped) return Response.json({ error: "
|
|
485
|
-
return Response.json(
|
|
486
|
+
if (!started || stopped) return Response.json({ error: "Modes not started" }, { status: 503 });
|
|
487
|
+
return Response.json(projectModes(catalog.getSnapshot(), "headless"));
|
|
486
488
|
},
|
|
487
489
|
close() {}
|
|
488
490
|
})
|
|
489
491
|
}],
|
|
490
|
-
commands: [
|
|
492
|
+
commands: [headlessModeCommand(catalog)],
|
|
491
493
|
services: [(context) => {
|
|
492
494
|
context.plugin((providerContext) => {
|
|
493
|
-
providerContext.provide(
|
|
495
|
+
providerContext.provide(PO_MODE_CATALOG_SERVICE, catalog);
|
|
494
496
|
});
|
|
495
497
|
context.effect(() => catalog.subscribe(() => {
|
|
496
498
|
publish().catch(async (error) => {
|
|
497
499
|
if (stopped) return;
|
|
498
500
|
await agent.context.client.notify({
|
|
499
|
-
body: `
|
|
501
|
+
body: `Mode projection failed: ${String(error)}`,
|
|
500
502
|
level: "error"
|
|
501
503
|
});
|
|
502
504
|
});
|
|
@@ -512,14 +514,14 @@ var root_server_default = defineRoot(({ agent }) => {
|
|
|
512
514
|
}, {
|
|
513
515
|
event: "session_start",
|
|
514
516
|
async handle() {
|
|
515
|
-
const snapshot = await agent.context.session.customSnapshot?.(
|
|
516
|
-
schemaId: "po-
|
|
517
|
-
accepts:
|
|
517
|
+
const snapshot = await agent.context.session.customSnapshot?.(PO_MODE_ENTRY_TYPE, {
|
|
518
|
+
schemaId: "po-modes:selection:v1",
|
|
519
|
+
accepts: acceptsModeSelection
|
|
518
520
|
});
|
|
519
|
-
const values = snapshot?.available && snapshot.entry ?
|
|
521
|
+
const values = snapshot?.available && snapshot.entry ? restoreModeSelection([snapshot.entry]) : void 0;
|
|
520
522
|
if (values) await agent.changeSelection({
|
|
521
523
|
axis: "state",
|
|
522
|
-
key: "
|
|
524
|
+
key: "mode",
|
|
523
525
|
values
|
|
524
526
|
});
|
|
525
527
|
started = true;
|
|
@@ -532,31 +534,31 @@ var root_server_default = defineRoot(({ agent }) => {
|
|
|
532
534
|
services: contributions.services,
|
|
533
535
|
async onDispose() {
|
|
534
536
|
stopped = true;
|
|
535
|
-
await runCleanups([() => catalog.dispose(), () => pending], "
|
|
537
|
+
await runCleanups([() => catalog.dispose(), () => pending], "Mode cleanup failed.");
|
|
536
538
|
}
|
|
537
539
|
};
|
|
538
540
|
});
|
|
539
541
|
//#endregion
|
|
540
|
-
//#region ../../foundations/po-
|
|
542
|
+
//#region ../../foundations/po-mode/src/extensions/workspaces/sessions/(backend)/api/modes/route.server.ts
|
|
541
543
|
var route_server_default = defineRoute((context) => context.root.api[0]);
|
|
542
544
|
//#endregion
|
|
543
|
-
//#region ../../foundations/po-
|
|
544
|
-
var
|
|
545
|
+
//#region ../../foundations/po-mode/src/extensions/workspaces/sessions/(backend)/command/modes.server.ts
|
|
546
|
+
var modes_server_default = defineServerCommand((context) => context.root.commands[0]);
|
|
545
547
|
//#endregion
|
|
546
|
-
//#region ../../foundations/po-
|
|
548
|
+
//#region ../../foundations/po-mode/src/extensions/workspaces/sessions/(backend)/hook/session-shutdown.server.ts
|
|
547
549
|
var session_shutdown_server_default = defineHook((context) => context.root.hooks.find((hook) => hook.event === "session_shutdown"));
|
|
548
550
|
//#endregion
|
|
549
|
-
//#region ../../foundations/po-
|
|
551
|
+
//#region ../../foundations/po-mode/src/extensions/workspaces/sessions/(backend)/hook/session-start.server.ts
|
|
550
552
|
var session_start_server_default = defineHook((context) => context.root.hooks.find((hook) => hook.event === "session_start"));
|
|
551
553
|
//#endregion
|
|
552
|
-
//#region ../../foundations/po-
|
|
554
|
+
//#region ../../foundations/po-mode/generated/server.ts
|
|
553
555
|
const at = (value, context) => typeof value === "function" ? value(context) : value;
|
|
554
556
|
const via = (identity, value) => value === void 0 ? void 0 : {
|
|
555
557
|
...identity,
|
|
556
558
|
...value
|
|
557
559
|
};
|
|
558
560
|
const serverPlugin = defineServerPlugin({
|
|
559
|
-
name: "@agimon-ai/po-
|
|
561
|
+
name: "@agimon-ai/po-mode",
|
|
560
562
|
providerOverrides: composeServerProviderOverrides(root_server_default),
|
|
561
563
|
injects: composeRootInjects({ session: [root_server_default] }),
|
|
562
564
|
session: async (context) => {
|
|
@@ -571,7 +573,7 @@ const serverPlugin = defineServerPlugin({
|
|
|
571
573
|
return [at(route_server_default, contextSession)];
|
|
572
574
|
},
|
|
573
575
|
get commands() {
|
|
574
|
-
return [via({ name: "
|
|
576
|
+
return [via({ name: "modes" }, at(modes_server_default, contextSession))];
|
|
575
577
|
},
|
|
576
578
|
get hooks() {
|
|
577
579
|
return [via({ event: "session_shutdown" }, at(session_shutdown_server_default, contextSession)), via({ event: "session_start" }, at(session_start_server_default, contextSession))];
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { Jt as String, Qt as Integer, _t as BACKGROUND_CONTEXT, in as Optional, jt as PO_FS_SERVICE, rn as _Object_, t as defineServerPlugin, yt as withAbortSignal, zt as requirePoFs } from "./serverPlugin-4nI5J6Zt.js";
|
|
2
|
+
import { d as readBoundedFile, l as FileTooLargeError } from "./platform-CQahdzpG.js";
|
|
3
|
+
import { f as defineServerTool } from "./extensionFile-B940JOEn.js";
|
|
4
|
+
import { t as readPiImageSettings } from "./piConfig-5tRPD0ov.js";
|
|
5
|
+
import { n as formatDimensionNote, r as resizeImage } from "./index.edge-D1biKw71.js";
|
|
6
|
+
import { a as decodeUtf8, c as formatFileHeader, i as computeFileTag, l as formatTaggedLine, o as displayPath, p as splitLines, r as resolveReadInputPath, t as isWritableFile } from "./index.edge-ClLTmPFz.js";
|
|
7
|
+
import { i as truncateLine, n as formatSize, r as truncateHead, t as DEFAULT_MAX_BYTES } from "./truncate-M3KbFyVj.js";
|
|
8
|
+
//#region ../../default/po-read/src/schemas/readTool.ts
|
|
9
|
+
const ReadParamsSchema = _Object_({
|
|
10
|
+
path: String({ description: "Path to the file to read." }),
|
|
11
|
+
offset: Optional(Integer({
|
|
12
|
+
minimum: 1,
|
|
13
|
+
description: "One-based line offset."
|
|
14
|
+
})),
|
|
15
|
+
limit: Optional(Integer({
|
|
16
|
+
minimum: 1,
|
|
17
|
+
description: "Maximum number of lines to return."
|
|
18
|
+
}))
|
|
19
|
+
});
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region ../../default/po-read/src/services/readHost/index.edge.ts
|
|
22
|
+
const resizeOperations = {
|
|
23
|
+
resize: resizeImage,
|
|
24
|
+
formatDimensionNote
|
|
25
|
+
};
|
|
26
|
+
function readImageLimits(filesystem, context) {
|
|
27
|
+
return readPiImageSettings(filesystem, context);
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region ../../default/po-read/src/services/readImage/index.ts
|
|
31
|
+
const OMITTED_NOTE = "[Image omitted: could not be resized below the inline image size limit.]";
|
|
32
|
+
async function applyImageLimits(content, limits, operations) {
|
|
33
|
+
if (!limits.autoResize || !content.some((part) => part.type === "image")) return content;
|
|
34
|
+
const resolved = [];
|
|
35
|
+
for (const part of content) {
|
|
36
|
+
if (part.type !== "image") {
|
|
37
|
+
resolved.push(part);
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
const resized = await operations.resize(Buffer.from(part.data, "base64"), part.mimeType, {
|
|
41
|
+
maxWidth: limits.maxDimension,
|
|
42
|
+
maxHeight: limits.maxDimension
|
|
43
|
+
});
|
|
44
|
+
if (!resized) {
|
|
45
|
+
resolved.push({
|
|
46
|
+
type: "text",
|
|
47
|
+
text: OMITTED_NOTE
|
|
48
|
+
});
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
resolved.push({
|
|
52
|
+
type: "image",
|
|
53
|
+
data: resized.data,
|
|
54
|
+
mimeType: resized.mimeType
|
|
55
|
+
});
|
|
56
|
+
const note = operations.formatDimensionNote(resized);
|
|
57
|
+
if (note) resolved.push({
|
|
58
|
+
type: "text",
|
|
59
|
+
text: note
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
return resolved;
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region ../../default/po-read/src/services/readTool/index.ts
|
|
66
|
+
function assertNotAborted(signal) {
|
|
67
|
+
if (signal?.aborted) throw new Error("Operation aborted");
|
|
68
|
+
}
|
|
69
|
+
function isImagePath(filePath) {
|
|
70
|
+
const extension = filePath.toLowerCase().match(/\.([a-z0-9]+)$/u)?.[1];
|
|
71
|
+
if (!extension) return void 0;
|
|
72
|
+
return {
|
|
73
|
+
avif: "image/avif",
|
|
74
|
+
gif: "image/gif",
|
|
75
|
+
jpeg: "image/jpeg",
|
|
76
|
+
jpg: "image/jpeg",
|
|
77
|
+
png: "image/png",
|
|
78
|
+
webp: "image/webp"
|
|
79
|
+
}[extension];
|
|
80
|
+
}
|
|
81
|
+
async function executeHeadlessRead(params, cwd, signal, filesystem) {
|
|
82
|
+
assertNotAborted(signal);
|
|
83
|
+
const absolutePath = await resolveReadInputPath(params.path, cwd);
|
|
84
|
+
const context = signal ? withAbortSignal(signal, BACKGROUND_CONTEXT) : BACKGROUND_CONTEXT;
|
|
85
|
+
let bytes;
|
|
86
|
+
try {
|
|
87
|
+
bytes = Buffer.from(await readBoundedFile(filesystem, absolutePath, 8388608, context));
|
|
88
|
+
} catch (error) {
|
|
89
|
+
if (error instanceof FileTooLargeError) throw new Error("File is over 8 MiB, hashline read refuses; use runner log tools for logs.", { cause: error });
|
|
90
|
+
throw error;
|
|
91
|
+
}
|
|
92
|
+
assertNotAborted(signal);
|
|
93
|
+
const mimeType = isImagePath(absolutePath);
|
|
94
|
+
if (mimeType) return { content: await applyImageLimits([{
|
|
95
|
+
type: "text",
|
|
96
|
+
text: `Read image file ${displayPath(absolutePath, cwd)} [${mimeType}]`
|
|
97
|
+
}, {
|
|
98
|
+
type: "image",
|
|
99
|
+
data: bytes.toString("base64"),
|
|
100
|
+
mimeType
|
|
101
|
+
}], await readImageLimits(filesystem, context), resizeOperations) };
|
|
102
|
+
if (!await isWritableFile(absolutePath)) return { content: [{
|
|
103
|
+
type: "text",
|
|
104
|
+
text: decodeUtf8(bytes, displayPath(absolutePath, cwd))
|
|
105
|
+
}] };
|
|
106
|
+
return createTaggedReadResult(bytes, displayPath(absolutePath, cwd), params);
|
|
107
|
+
}
|
|
108
|
+
function createTaggedReadResult(bytes, path, params) {
|
|
109
|
+
const lines = splitLines(decodeUtf8(bytes, path));
|
|
110
|
+
const startIndex = params.offset === void 0 ? 0 : params.offset - 1;
|
|
111
|
+
if (startIndex >= lines.length) throw new Error(`Offset ${params.offset} is beyond end of file (${lines.length} lines total).`);
|
|
112
|
+
const endIndex = params.limit === void 0 ? lines.length : Math.min(lines.length, startIndex + params.limit);
|
|
113
|
+
const selected = lines.slice(startIndex, endIndex);
|
|
114
|
+
const header = formatFileHeader(path, computeFileTag(bytes));
|
|
115
|
+
const compactedLines = [];
|
|
116
|
+
const headerBytes = Buffer.byteLength(header, "utf8") + 1;
|
|
117
|
+
const tagged = selected.map((line, index) => {
|
|
118
|
+
const lineNumber = startIndex + index + 1;
|
|
119
|
+
const full = formatTaggedLine(line, lineNumber);
|
|
120
|
+
if (Buffer.byteLength(full, "utf8") <= 51200 - headerBytes) return full;
|
|
121
|
+
compactedLines.push(lineNumber);
|
|
122
|
+
return formatTaggedLine(truncateLine(line).text, lineNumber, "", line);
|
|
123
|
+
});
|
|
124
|
+
const truncation = truncateHead([header, ...tagged].join("\n"));
|
|
125
|
+
let text = truncation.content;
|
|
126
|
+
let details;
|
|
127
|
+
if (truncation.truncated) {
|
|
128
|
+
const shownLines = Math.max(0, truncation.outputLines - 1);
|
|
129
|
+
const nextOffset = startIndex + shownLines + 1;
|
|
130
|
+
const reason = truncation.truncatedBy === "bytes" ? `, ${formatSize(DEFAULT_MAX_BYTES)} limit` : "";
|
|
131
|
+
text += `\n\n[Showing ${shownLines} anchored lines${reason}. Use offset=${nextOffset} to continue.]`;
|
|
132
|
+
details = { truncation };
|
|
133
|
+
} else {
|
|
134
|
+
const notices = [];
|
|
135
|
+
if (compactedLines.length > 0) notices.push(`Lines ${compactedLines.join(", ")} shown compactly. Their anchors hash the full original lines`);
|
|
136
|
+
if (endIndex < lines.length) notices.push(`${lines.length - endIndex} more lines in file. Use offset=${endIndex + 1} to continue`);
|
|
137
|
+
if (notices.length > 0) text += `\n\n[${notices.join(". ")}.]`;
|
|
138
|
+
}
|
|
139
|
+
return {
|
|
140
|
+
content: [{
|
|
141
|
+
type: "text",
|
|
142
|
+
text
|
|
143
|
+
}],
|
|
144
|
+
details
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function createHeadlessReadTool(filesystem) {
|
|
148
|
+
return {
|
|
149
|
+
name: "read",
|
|
150
|
+
label: "read",
|
|
151
|
+
description: "Read a writable text file with an exact-byte file tag and stable line anchors. Non-writable files and images return native-compatible content. Files over 8 MiB are refused. Text is truncated to 50.0KB.",
|
|
152
|
+
promptSnippet: "Read file contents with snapshot-bound line anchors",
|
|
153
|
+
promptGuidelines: ["Use read before edit. When hashline metadata is present, preserve the @file hash and anchors such as 5#abc exactly.", "Continue large reads with offset until the required anchored lines are visible."],
|
|
154
|
+
parameters: ReadParamsSchema,
|
|
155
|
+
executionMode: "parallel",
|
|
156
|
+
execute: async (_toolCallId, params, signal, _onUpdate, context) => executeHeadlessRead(params, context.cwd, signal, typeof filesystem === "function" ? filesystem() : filesystem)
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
//#endregion
|
|
160
|
+
//#region ../../default/po-read/src/extensions/workspaces/sessions/(backend)/tool/read.server.ts
|
|
161
|
+
var read_server_default = defineServerTool(({ context }) => {
|
|
162
|
+
let filesystem;
|
|
163
|
+
context.inject([PO_FS_SERVICE], (scoped) => {
|
|
164
|
+
const bound = requirePoFs(scoped);
|
|
165
|
+
filesystem = bound;
|
|
166
|
+
return () => {
|
|
167
|
+
if (filesystem === bound) filesystem = void 0;
|
|
168
|
+
};
|
|
169
|
+
});
|
|
170
|
+
return createHeadlessReadTool(() => {
|
|
171
|
+
if (!filesystem) throw new Error("Read filesystem service is unavailable.");
|
|
172
|
+
return filesystem;
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region ../../default/po-read/generated/server.ts
|
|
177
|
+
const at = (value, context) => typeof value === "function" ? value(context) : value;
|
|
178
|
+
const via = (identity, value) => value === void 0 ? void 0 : {
|
|
179
|
+
...identity,
|
|
180
|
+
...value
|
|
181
|
+
};
|
|
182
|
+
const serverPlugin = defineServerPlugin({
|
|
183
|
+
name: "@agimon-ai/po-read",
|
|
184
|
+
session: (context) => ({ get tools() {
|
|
185
|
+
return [via({ name: "read" }, at(read_server_default, context))];
|
|
186
|
+
} })
|
|
187
|
+
});
|
|
188
|
+
//#endregion
|
|
189
|
+
export { serverPlugin as default, serverPlugin };
|