@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
|
@@ -0,0 +1,1379 @@
|
|
|
1
|
+
import { Et as composeServerProviderOverrides, Gt as Record, H as Compile, Jt as String$1, Qt as Integer, V as Check, Zt as Literal, in as Optional, ln as requirePoServerScope, mt as readPoHeadlessOwner, nn as Unknown, on as PO_SERVER_SCOPE_SERVICE, qt as Union, rn as _Object_, sn as defineServiceContract, t as defineServerPlugin } from "./serverPlugin-4nI5J6Zt.js";
|
|
2
|
+
import { t as Meta } from "./meta-CVgfTHQP.js";
|
|
3
|
+
import { n as defineTool } from "./pluginContributions-Be9EnCAW.js";
|
|
4
|
+
import { n as readPackageResource, t as packageResourcePath } from "./index.edge-BiVQ9LoZ.js";
|
|
5
|
+
import { h as readPoWorkflowLaunchService } from "./workflow-DTCt4n6k.js";
|
|
6
|
+
import { E as isCalendarJson, N as MAX_CALENDAR_SUMMARY_LENGTH, T as canonicalCalendarJson, _ as CalendarListInputSchema, a as createCalendarApi, d as resolveScheduleInput, h as CalendarCancelInputSchema, i as createCalendarSessionExecutor, n as CALENDAR_CLOUD_ROOT_SERVICE, o as CalendarRequestError, p as CalendarAgentDraftSchema, r as createCalendarExecutors, t as calendarSetup } from "./calendarSetup-CI3AACVo.js";
|
|
7
|
+
import { c as PROFILE_RESOLUTION_TIMEOUT_MS, h as PROFILE_RUNTIME_SERVICE, l as createDeadline } from "./profileSources-D1rymC97.js";
|
|
8
|
+
import { c as defineRoot, i as defineCommand, l as defineRoute, n as composeRootInjects, p as defineTool$1, s as defineResource, t as composeRootHooks } from "./extensionFile-B940JOEn.js";
|
|
9
|
+
import { r as requirePoConfigContext, x as readPoPersonTimeZone } from "./sessionConfig-UMlgu98q.js";
|
|
10
|
+
import "./exports-CBp_9dVk.js";
|
|
11
|
+
import { i as readPoCodemode, n as PO_CODEMODE_SERVICE } from "./codemode-LpcMFMYM.js";
|
|
12
|
+
import { t as PO_HELP_WHEN } from "./help-C9UGKetC.js";
|
|
13
|
+
import { t as PO_DB_CONTRACT } from "./contracts-CW8o6Xyi.js";
|
|
14
|
+
import "./exports-Cg0wxflf.js";
|
|
15
|
+
//#region ../../../layers/automation/po-calendar/src/schemas/calendarEvents.ts
|
|
16
|
+
const PO_CALENDAR_EVENTS_SERVICE = "po/calendar-events";
|
|
17
|
+
const PO_CALENDAR_SOURCES_SERVICE = "po/calendar-sources";
|
|
18
|
+
const CalendarExternalIdSchema = String$1({
|
|
19
|
+
minLength: 1,
|
|
20
|
+
maxLength: 256
|
|
21
|
+
});
|
|
22
|
+
const CalendarPluginTargetSchema = Union([_Object_({
|
|
23
|
+
kind: Literal("newSession"),
|
|
24
|
+
cwd: String$1({
|
|
25
|
+
minLength: 1,
|
|
26
|
+
maxLength: 4096
|
|
27
|
+
})
|
|
28
|
+
}, { additionalProperties: false }), _Object_({ kind: Literal("existingSession") }, { additionalProperties: false })]);
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region ../../../layers/automation/po-calendar/src/services/calendarEvents/index.ts
|
|
31
|
+
const packageOf = (context) => {
|
|
32
|
+
const packageName = readPoHeadlessOwner(context)?.packageName;
|
|
33
|
+
if (!packageName) throw new Error("Calendar events need a plugin declared in its package poServer field.");
|
|
34
|
+
return packageName;
|
|
35
|
+
};
|
|
36
|
+
/** Lets a plugin in a session keep its own Calendar events in sync, keyed by its package name and external id. */
|
|
37
|
+
function createCalendarEventsService({ root, owner: { workspaceId, sessionId }, validateAction }) {
|
|
38
|
+
let disposed = false;
|
|
39
|
+
return {
|
|
40
|
+
writer(context, level) {
|
|
41
|
+
const packageName = packageOf(context);
|
|
42
|
+
if (level !== "session" && level !== "workspace") throw new Error("Choose the 'session' or 'workspace' level.");
|
|
43
|
+
let writerClosed = false;
|
|
44
|
+
context.effect(() => () => {
|
|
45
|
+
writerClosed = true;
|
|
46
|
+
});
|
|
47
|
+
const owner = level === "session" ? {
|
|
48
|
+
level,
|
|
49
|
+
workspaceId,
|
|
50
|
+
sessionId
|
|
51
|
+
} : {
|
|
52
|
+
level,
|
|
53
|
+
workspaceId
|
|
54
|
+
};
|
|
55
|
+
const { scope } = root.forOwner(owner, { validateAction });
|
|
56
|
+
const live = () => {
|
|
57
|
+
if (disposed || writerClosed) throw new CalendarRequestError("This Calendar session has closed.", 409);
|
|
58
|
+
};
|
|
59
|
+
const source = (externalId) => {
|
|
60
|
+
if (!Check(CalendarExternalIdSchema, externalId)) throw new CalendarRequestError("Give an external id of 1 to 256 characters.");
|
|
61
|
+
return {
|
|
62
|
+
packageName,
|
|
63
|
+
externalId
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
const sourced = async (externalId) => {
|
|
67
|
+
live();
|
|
68
|
+
const key = source(externalId);
|
|
69
|
+
const event = (await scope.listSourced(packageName)).find((candidate) => candidate.source?.externalId === key.externalId);
|
|
70
|
+
if (!event) throw new CalendarRequestError("Calendar event was not found.", 404);
|
|
71
|
+
return event;
|
|
72
|
+
};
|
|
73
|
+
const write = async (externalId, draft, mode) => {
|
|
74
|
+
live();
|
|
75
|
+
const key = source(externalId);
|
|
76
|
+
if (typeof draft !== "object" || draft === null || Array.isArray(draft)) throw new CalendarRequestError("Give the event as an object.");
|
|
77
|
+
const requested = draft.target;
|
|
78
|
+
if (!Check(CalendarPluginTargetSchema, requested)) throw new CalendarRequestError("Target {kind:'newSession', cwd} or {kind:'existingSession'}.");
|
|
79
|
+
const target = requested.kind === "newSession" ? {
|
|
80
|
+
kind: "newSession",
|
|
81
|
+
workspaceId,
|
|
82
|
+
cwd: requested.cwd
|
|
83
|
+
} : {
|
|
84
|
+
kind: "existingSession",
|
|
85
|
+
sessionId
|
|
86
|
+
};
|
|
87
|
+
return structuredClone(await scope.writeSourced(key, {
|
|
88
|
+
...draft,
|
|
89
|
+
target
|
|
90
|
+
}, mode));
|
|
91
|
+
};
|
|
92
|
+
return {
|
|
93
|
+
create: (externalId, draft) => write(externalId, draft, "create"),
|
|
94
|
+
upsert: (externalId, draft) => write(externalId, draft, "upsert"),
|
|
95
|
+
async list() {
|
|
96
|
+
live();
|
|
97
|
+
return (await scope.listSourced(packageName)).map((event) => structuredClone(event));
|
|
98
|
+
},
|
|
99
|
+
async cancel(externalId) {
|
|
100
|
+
live();
|
|
101
|
+
const event = await scope.cancelSourced(source(externalId));
|
|
102
|
+
if (!event) throw new CalendarRequestError("Calendar event was not found.", 404);
|
|
103
|
+
return structuredClone(event);
|
|
104
|
+
},
|
|
105
|
+
async action(externalId, action) {
|
|
106
|
+
if (action !== "pause" && action !== "resume" && action !== "run-now") throw new CalendarRequestError("Choose 'pause', 'resume' or 'run-now'.");
|
|
107
|
+
const event = await sourced(externalId);
|
|
108
|
+
return structuredClone(await scope.action(event.id, action));
|
|
109
|
+
},
|
|
110
|
+
async history(externalId, cursor) {
|
|
111
|
+
const event = await sourced(externalId);
|
|
112
|
+
return structuredClone(await scope.history(event.id, cursor));
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
},
|
|
116
|
+
dispose() {
|
|
117
|
+
disposed = true;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
/** Lets a plugin read its own Calendar events in every workspace and session through the global scope. */
|
|
122
|
+
function createCalendarSourcesService(scope) {
|
|
123
|
+
return { reader(context) {
|
|
124
|
+
const packageName = packageOf(context);
|
|
125
|
+
return {
|
|
126
|
+
async list() {
|
|
127
|
+
const events = await scope.listVisibleSourced(packageName);
|
|
128
|
+
return Promise.all(events.map(async (event) => {
|
|
129
|
+
const [lastOccurrence] = (await scope.history(event.id)).occurrences;
|
|
130
|
+
return structuredClone(lastOccurrence ? {
|
|
131
|
+
...event,
|
|
132
|
+
lastOccurrence
|
|
133
|
+
} : event);
|
|
134
|
+
}));
|
|
135
|
+
},
|
|
136
|
+
async history(eventId, cursor) {
|
|
137
|
+
if (!(await scope.listVisibleSourced(packageName)).some((event) => event.id === eventId)) throw new CalendarRequestError("Calendar event was not found.", 404);
|
|
138
|
+
return structuredClone(await scope.history(eventId, cursor));
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
} };
|
|
142
|
+
}
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region ../../../layers/automation/po-calendar/src/services/calendarRoot/type.ts
|
|
145
|
+
const CALENDAR_ROOT_SERVICE = defineServiceContract("po/calendar-root", { scope: "host" });
|
|
146
|
+
const CALENDAR_SOURCES_SERVICE = defineServiceContract(PO_CALENDAR_SOURCES_SERVICE, {
|
|
147
|
+
scope: "host",
|
|
148
|
+
description: "Read the calling plugin's calendar events and fire history across workspaces and sessions."
|
|
149
|
+
});
|
|
150
|
+
//#endregion
|
|
151
|
+
//#region ../../../layers/automation/po-calendar/src/services/calendarRoot/index.edge.ts
|
|
152
|
+
/** A cloud host binds its Calendar root; any other edge mount refuses scheduling. */
|
|
153
|
+
async function createCalendarRoot(plugin) {
|
|
154
|
+
const unavailable = () => {
|
|
155
|
+
throw new CalendarRequestError("Calendar scheduling requires a Node host.", 409);
|
|
156
|
+
};
|
|
157
|
+
const executors = createCalendarExecutors();
|
|
158
|
+
const store = {
|
|
159
|
+
get: unavailable,
|
|
160
|
+
getOccurrence: unavailable
|
|
161
|
+
};
|
|
162
|
+
const forOwner = (owner) => {
|
|
163
|
+
const scope = {
|
|
164
|
+
owner,
|
|
165
|
+
list: unavailable,
|
|
166
|
+
listOwned: unavailable,
|
|
167
|
+
create: unavailable,
|
|
168
|
+
update: unavailable,
|
|
169
|
+
action: unavailable,
|
|
170
|
+
history: unavailable,
|
|
171
|
+
ask: unavailable,
|
|
172
|
+
writeSourced: unavailable,
|
|
173
|
+
cancelSourced: unavailable,
|
|
174
|
+
listSourced: unavailable,
|
|
175
|
+
listVisibleSourced: unavailable,
|
|
176
|
+
targets: () => ({
|
|
177
|
+
workspaces: [],
|
|
178
|
+
sessions: []
|
|
179
|
+
})
|
|
180
|
+
};
|
|
181
|
+
return {
|
|
182
|
+
scope,
|
|
183
|
+
api: createCalendarApi(scope, unavailable),
|
|
184
|
+
executors,
|
|
185
|
+
store,
|
|
186
|
+
forOwner,
|
|
187
|
+
changeScope: async () => void 0
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
let value;
|
|
191
|
+
let bound = false;
|
|
192
|
+
const provider = plugin.context.inject([PO_SERVER_SCOPE_SERVICE], async (scope) => {
|
|
193
|
+
const cloud = scope.get(CALENDAR_CLOUD_ROOT_SERVICE.name);
|
|
194
|
+
bound = cloud !== void 0;
|
|
195
|
+
const root = cloud ?? forOwner({ level: "global" });
|
|
196
|
+
value = root;
|
|
197
|
+
const removals = await Promise.all([requirePoServerScope(scope).provide(CALENDAR_ROOT_SERVICE, root), requirePoServerScope(scope).provide(CALENDAR_SOURCES_SERVICE, createCalendarSourcesService(root.scope))]);
|
|
198
|
+
return async () => {
|
|
199
|
+
for (const remove of removals) await remove();
|
|
200
|
+
};
|
|
201
|
+
});
|
|
202
|
+
await provider.await();
|
|
203
|
+
if (!value) throw new Error("Calendar platform services are unavailable.");
|
|
204
|
+
return {
|
|
205
|
+
value,
|
|
206
|
+
onDispose: () => provider.dispose(),
|
|
207
|
+
onStart: () => {
|
|
208
|
+
if (!bound) plugin.host.context.onNotice("Calendar scheduling is unavailable on the edge host.");
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
//#endregion
|
|
213
|
+
//#region ../../../layers/automation/po-calendar/src/extensions/(backend)/root.server.ts
|
|
214
|
+
var root_server_default$2 = defineRoot(createCalendarRoot, { inject: [PO_DB_CONTRACT] });
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region ../../../layers/automation/po-calendar/src/extensions/workspaces/(backend)/root.server.ts
|
|
217
|
+
var root_server_default$1 = defineRoot((context) => {
|
|
218
|
+
const workspaceId = context.host.context.workspaceId;
|
|
219
|
+
if (!workspaceId) throw new Error("Calendar workspace identity is unavailable.");
|
|
220
|
+
return { value: context.root.forOwner({
|
|
221
|
+
level: "workspace",
|
|
222
|
+
workspaceId
|
|
223
|
+
}) };
|
|
224
|
+
}, { inject: [CALENDAR_ROOT_SERVICE] });
|
|
225
|
+
//#endregion
|
|
226
|
+
//#region ../../../layers/automation/po-calendar/src/schemas/loopLaunchers.ts
|
|
227
|
+
/** Provider-owned Cordis service for session-scoped recurring-loop launchers. */
|
|
228
|
+
const PO_LOOP_LAUNCHERS_SERVICE = "po/loop-launchers";
|
|
229
|
+
_Object_({}, { additionalProperties: false });
|
|
230
|
+
const LoopStartSchema = _Object_({
|
|
231
|
+
launcherId: String$1({
|
|
232
|
+
minLength: 1,
|
|
233
|
+
maxLength: 256
|
|
234
|
+
}),
|
|
235
|
+
instanceId: Optional(String$1({
|
|
236
|
+
minLength: 1,
|
|
237
|
+
maxLength: 256
|
|
238
|
+
})),
|
|
239
|
+
input: Record(String$1(), Unknown())
|
|
240
|
+
}, { additionalProperties: false });
|
|
241
|
+
const LoopStopSchema = _Object_({
|
|
242
|
+
instanceId: String$1({
|
|
243
|
+
minLength: 1,
|
|
244
|
+
maxLength: 256
|
|
245
|
+
}),
|
|
246
|
+
reason: Optional(String$1({
|
|
247
|
+
minLength: 1,
|
|
248
|
+
maxLength: 512
|
|
249
|
+
}))
|
|
250
|
+
}, { additionalProperties: false });
|
|
251
|
+
const IntervalLoopSchema = _Object_({
|
|
252
|
+
prompt: String$1({
|
|
253
|
+
minLength: 1,
|
|
254
|
+
maxLength: 32768
|
|
255
|
+
}),
|
|
256
|
+
intervalSeconds: Integer({
|
|
257
|
+
minimum: 30,
|
|
258
|
+
maximum: 3600
|
|
259
|
+
})
|
|
260
|
+
}, { additionalProperties: false });
|
|
261
|
+
const CronLoopSchema = _Object_({
|
|
262
|
+
prompt: String$1({
|
|
263
|
+
minLength: 1,
|
|
264
|
+
maxLength: 32768
|
|
265
|
+
}),
|
|
266
|
+
cron: String$1({
|
|
267
|
+
minLength: 1,
|
|
268
|
+
maxLength: 256
|
|
269
|
+
}),
|
|
270
|
+
timezone: Optional(String$1({
|
|
271
|
+
minLength: 1,
|
|
272
|
+
maxLength: 128
|
|
273
|
+
}))
|
|
274
|
+
}, { additionalProperties: false });
|
|
275
|
+
function parseIntervalLoop(input) {
|
|
276
|
+
if (!Check(IntervalLoopSchema, input) || !input.prompt.trim()) throw new Error("Provide a non-empty prompt and an integer intervalSeconds between 30 and 3600.");
|
|
277
|
+
return {
|
|
278
|
+
...input,
|
|
279
|
+
prompt: input.prompt.trim()
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
function parseCronLoop(input) {
|
|
283
|
+
if (!Check(CronLoopSchema, input) || !input.prompt.trim() || input.cron.trim().split(/\s+/u).length !== 5) throw new Error("Provide a non-empty prompt and a five-field cron expression, with an optional IANA timezone.");
|
|
284
|
+
if (input.timezone !== void 0) new Intl.DateTimeFormat("en", { timeZone: input.timezone }).format();
|
|
285
|
+
return {
|
|
286
|
+
...input,
|
|
287
|
+
prompt: input.prompt.trim(),
|
|
288
|
+
cron: input.cron.trim()
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
//#endregion
|
|
292
|
+
//#region ../../../layers/automation/po-calendar/src/services/calendarNamespace/index.ts
|
|
293
|
+
const CALENDAR_WRITE_APPROVAL = {
|
|
294
|
+
requirement: "human",
|
|
295
|
+
describe: () => ({
|
|
296
|
+
title: "Schedule or change Calendar work",
|
|
297
|
+
summary: "Allow this event or recurring launcher to run work automatically at its scheduled times. Review the call before allowing it."
|
|
298
|
+
})
|
|
299
|
+
};
|
|
300
|
+
const DECLARATIONS = `type Json = null | boolean | number | string | Json[] | { [key: string]: Json };
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* tz defaults to the person's timezone (see the system prompt); name another IANA zone only when they do.
|
|
304
|
+
* once.at: local wall time in tz like '2026-05-01T09:00' (preferred), or future epoch ms.
|
|
305
|
+
* interval: 30 to 3600 seconds. cron: five fields, read in tz.
|
|
306
|
+
*/
|
|
307
|
+
type CalendarSchedule =
|
|
308
|
+
| { kind: 'once'; at: string | number; tz?: string }
|
|
309
|
+
| { kind: 'interval'; seconds: number }
|
|
310
|
+
| { kind: 'cron'; expr: string; tz?: string };
|
|
311
|
+
|
|
312
|
+
/** Omitted ids are filled from this session: newSession uses its workspace, existingSession is this session. */
|
|
313
|
+
type CalendarTarget =
|
|
314
|
+
| { kind: 'newSession'; cwd: string; workspaceId?: string }
|
|
315
|
+
| { kind: 'existingSession'; sessionId?: string };
|
|
316
|
+
|
|
317
|
+
/** The agent setup a new-session fire starts with. Omitted axes use the workspace defaults. */
|
|
318
|
+
interface CalendarAssignment { profile?: string; domains?: string[]; preset?: string; modes?: string[] }
|
|
319
|
+
/** A repository workflow key from workflow.list(). prompt is the launch override. */
|
|
320
|
+
interface CalendarWorkflow { key: string; inputs?: Record<string, string>; prompt?: string }
|
|
321
|
+
/** A launcher from calendar.loopList() with supportsActions, input checked against its schema. */
|
|
322
|
+
interface CalendarAction { launcherId: string; input: Record<string, Json> }
|
|
323
|
+
|
|
324
|
+
/** Central scheduling policy. The host supplies authorization and setup identity. */
|
|
325
|
+
interface CalendarCentralPolicy { portable?: boolean; pendingExpiryMs?: number; visibility?: 'private' | 'shared' }
|
|
326
|
+
/** Exactly one of prompt, workflow or action. workflow and assignment need a newSession target. */
|
|
327
|
+
interface CalendarDraft {
|
|
328
|
+
title: string;
|
|
329
|
+
schedule: CalendarSchedule;
|
|
330
|
+
target: CalendarTarget;
|
|
331
|
+
prompt?: string;
|
|
332
|
+
workflow?: CalendarWorkflow;
|
|
333
|
+
action?: CalendarAction;
|
|
334
|
+
assignment?: CalendarAssignment;
|
|
335
|
+
centralJob?: CalendarCentralPolicy;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/** Omission keeps a field; null clears an optional one. */
|
|
339
|
+
interface CalendarPatch {
|
|
340
|
+
title?: string;
|
|
341
|
+
schedule?: CalendarSchedule;
|
|
342
|
+
target?: CalendarTarget;
|
|
343
|
+
prompt?: string | null;
|
|
344
|
+
workflow?: CalendarWorkflow | null;
|
|
345
|
+
action?: CalendarAction | null;
|
|
346
|
+
assignment?: CalendarAssignment | null;
|
|
347
|
+
centralJob?: CalendarCentralPolicy;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
interface CalendarEvent extends CalendarDraft {
|
|
351
|
+
id: string;
|
|
352
|
+
revision: number;
|
|
353
|
+
status: 'active' | 'paused' | 'cancelled' | 'done';
|
|
354
|
+
pauseReason?: string;
|
|
355
|
+
/** Set on plugin-managed events. Those cannot be updated; pause, resume, runNow and cancel still work. */
|
|
356
|
+
source?: { packageName: string; externalId: string };
|
|
357
|
+
nextDueAt: number | null;
|
|
358
|
+
createdAt: number;
|
|
359
|
+
updatedAt: number;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
interface CalendarOccurrence {
|
|
363
|
+
id: string;
|
|
364
|
+
eventId: string;
|
|
365
|
+
revision: number;
|
|
366
|
+
dueAt: number;
|
|
367
|
+
state: 'queued' | 'running' | 'succeeded' | 'failed' | 'skipped' | 'interrupted' | 'blocked';
|
|
368
|
+
skippedCount: number;
|
|
369
|
+
skipUntil?: number;
|
|
370
|
+
sessionId?: string;
|
|
371
|
+
/** 'busy' when an earlier run of the event was still queued or running. */
|
|
372
|
+
error?: string;
|
|
373
|
+
workflowRun?: { runId: string; [key: string]: Json };
|
|
374
|
+
summary?: string;
|
|
375
|
+
createdAt: number;
|
|
376
|
+
updatedAt: number;
|
|
377
|
+
centralJob?: { phase: 'pending' | 'reserved' | 'started' | 'settled' | 'expired' | 'cancelled' | 'unknown'; sequence: number; expiresAt: number };
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
interface LoopLauncher {
|
|
381
|
+
id: string;
|
|
382
|
+
source: string;
|
|
383
|
+
label: string;
|
|
384
|
+
description?: string;
|
|
385
|
+
inputSchema?: Record<string, Json>;
|
|
386
|
+
actionInputSchema?: Record<string, Json>;
|
|
387
|
+
/** True when calendar.create can use it as an action. */
|
|
388
|
+
supportsActions?: boolean;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
interface LoopInstance {
|
|
392
|
+
instanceId: string;
|
|
393
|
+
launcherId: string;
|
|
394
|
+
launcherLabel: string;
|
|
395
|
+
label?: string;
|
|
396
|
+
detail?: string;
|
|
397
|
+
state: 'starting' | 'running' | 'stopping';
|
|
398
|
+
startedAt?: string;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
declare const calendar: {
|
|
402
|
+
/** Durable events this session owns that are active or paused. */
|
|
403
|
+
list(): Promise<CalendarEvent[]>;
|
|
404
|
+
create(draft: CalendarDraft): Promise<CalendarEvent>;
|
|
405
|
+
/** Refused for plugin-managed events. */
|
|
406
|
+
update(id: string, patch: CalendarPatch): Promise<CalendarEvent>;
|
|
407
|
+
cancel(id: string): Promise<CalendarEvent>;
|
|
408
|
+
pause(id: string): Promise<CalendarEvent>;
|
|
409
|
+
resume(id: string): Promise<CalendarEvent>;
|
|
410
|
+
/** Fires now. Throws when an earlier run is still going; that run is recorded as skipped busy. */
|
|
411
|
+
runNow(id: string): Promise<CalendarEvent>;
|
|
412
|
+
/** Newest runs first, a page at a time. Pass the returned cursor for the next page. */
|
|
413
|
+
history(id: string, cursor?: string): Promise<{ occurrences: CalendarOccurrence[]; cursor?: string }>;
|
|
414
|
+
/** po.default {prompt, intervalSeconds} and po.cron {prompt, cron, timezone?} become durable events; others start session-local loops. */
|
|
415
|
+
loopStart(request: { launcherId: string; input: Record<string, Json> }): Promise<LoopInstance | undefined>;
|
|
416
|
+
loopList(): Promise<{ launchers: LoopLauncher[]; instances: LoopInstance[] }>;
|
|
417
|
+
loopStop(request: { instanceId: string; reason?: string }): Promise<{ stopped: boolean }>;
|
|
418
|
+
};`;
|
|
419
|
+
const RUN_DISPOSED = "Calendar namespace run is disposed.";
|
|
420
|
+
const detached = (value) => value === void 0 ? value : JSON.parse(JSON.stringify(value));
|
|
421
|
+
/** The card name a member's call is drawn with: the direct tool where one exists, otherwise a card-only name. */
|
|
422
|
+
const CARD_TOOLS = {
|
|
423
|
+
create: "calendar_schedule",
|
|
424
|
+
list: "calendar_list",
|
|
425
|
+
update: "calendar_update",
|
|
426
|
+
cancel: "calendar_cancel",
|
|
427
|
+
pause: "calendar_pause",
|
|
428
|
+
resume: "calendar_resume",
|
|
429
|
+
runNow: "calendar_run_now",
|
|
430
|
+
history: "calendar_history",
|
|
431
|
+
loopStart: "loop_start",
|
|
432
|
+
loopList: "loop_list",
|
|
433
|
+
loopStop: "loop_stop"
|
|
434
|
+
};
|
|
435
|
+
const POSITIONAL = {
|
|
436
|
+
update: ["id", "patch"],
|
|
437
|
+
cancel: ["id"],
|
|
438
|
+
pause: ["id"],
|
|
439
|
+
resume: ["id"],
|
|
440
|
+
runNow: ["id"],
|
|
441
|
+
history: ["id", "cursor"]
|
|
442
|
+
};
|
|
443
|
+
/** A member's arguments as the named object its tool takes. */
|
|
444
|
+
function recordedArgs(member, args) {
|
|
445
|
+
const names = POSITIONAL[member];
|
|
446
|
+
const value = names ? Object.fromEntries(names.flatMap((key, index) => args[index] === void 0 ? [] : [[key, args[index]]])) : args[0];
|
|
447
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return {};
|
|
448
|
+
try {
|
|
449
|
+
return detached(value);
|
|
450
|
+
} catch {
|
|
451
|
+
return {};
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
function eventId(value) {
|
|
455
|
+
if (typeof value !== "string" || !value || value.length > 256) throw new Error("Provide the Calendar event id.");
|
|
456
|
+
return value;
|
|
457
|
+
}
|
|
458
|
+
/** Fills the ids a session already knows, so scripts never need to look them up. Anything else passes to the scope as is. */
|
|
459
|
+
function withTarget(value, options) {
|
|
460
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return value;
|
|
461
|
+
const target = value.target;
|
|
462
|
+
if (!target || typeof target !== "object" || Array.isArray(target)) return value;
|
|
463
|
+
const kind = target.kind;
|
|
464
|
+
if (kind === "newSession" && !("workspaceId" in target)) return {
|
|
465
|
+
...value,
|
|
466
|
+
target: {
|
|
467
|
+
...target,
|
|
468
|
+
workspaceId: options.workspaceId
|
|
469
|
+
}
|
|
470
|
+
};
|
|
471
|
+
if (kind === "existingSession" && !("sessionId" in target)) return {
|
|
472
|
+
...value,
|
|
473
|
+
target: {
|
|
474
|
+
...target,
|
|
475
|
+
sessionId: options.sessionId
|
|
476
|
+
}
|
|
477
|
+
};
|
|
478
|
+
return value;
|
|
479
|
+
}
|
|
480
|
+
/** The owning session's Calendar: the same operations as the direct Calendar and loop tools. */
|
|
481
|
+
function createCalendarNamespace(options) {
|
|
482
|
+
return {
|
|
483
|
+
name: "calendar",
|
|
484
|
+
summary: "Durable scheduled events this session owns: calendar.create/list/update/cancel/pause/resume/runNow/history for prompts, workflows and plugin actions on once, interval or cron schedules, plus calendar.loopStart/loopList/loopStop.",
|
|
485
|
+
declarations: DECLARATIONS,
|
|
486
|
+
portable: true,
|
|
487
|
+
approval: {
|
|
488
|
+
create: CALENDAR_WRITE_APPROVAL,
|
|
489
|
+
update: CALENDAR_WRITE_APPROVAL,
|
|
490
|
+
loopStart: CALENDAR_WRITE_APPROVAL
|
|
491
|
+
},
|
|
492
|
+
bind(run) {
|
|
493
|
+
if (run.sessionId !== options.sessionId) throw new Error("Calendar namespace belongs to another session.");
|
|
494
|
+
let disposed = false;
|
|
495
|
+
run.onDispose(() => {
|
|
496
|
+
disposed = true;
|
|
497
|
+
});
|
|
498
|
+
const call = async (work) => {
|
|
499
|
+
run.signal.throwIfAborted();
|
|
500
|
+
if (disposed) throw new Error(RUN_DISPOSED);
|
|
501
|
+
options.assertAvailable();
|
|
502
|
+
const value = await work();
|
|
503
|
+
run.signal.throwIfAborted();
|
|
504
|
+
if (disposed) throw new Error(RUN_DISPOSED);
|
|
505
|
+
options.assertAvailable();
|
|
506
|
+
return detached(value);
|
|
507
|
+
};
|
|
508
|
+
const { operations } = options;
|
|
509
|
+
const members = Object.create(null);
|
|
510
|
+
members.list = () => call(() => operations.list());
|
|
511
|
+
members.create = (draft) => call(() => operations.create(withTarget(draft, options)));
|
|
512
|
+
members.update = (id, patch) => call(() => operations.update(eventId(id), withTarget(patch, options)));
|
|
513
|
+
members.cancel = (id) => call(() => operations.action(eventId(id), "cancel"));
|
|
514
|
+
members.pause = (id) => call(() => operations.action(eventId(id), "pause"));
|
|
515
|
+
members.resume = (id) => call(() => operations.action(eventId(id), "resume"));
|
|
516
|
+
members.runNow = (id) => call(() => operations.action(eventId(id), "run-now"));
|
|
517
|
+
members.history = (id, cursor) => call(() => {
|
|
518
|
+
if (cursor !== void 0 && (typeof cursor !== "string" || cursor.length > 256)) throw new Error("A history cursor is the string a previous page returned.");
|
|
519
|
+
return operations.history(eventId(id), cursor);
|
|
520
|
+
});
|
|
521
|
+
members.loopStart = (request) => call(() => operations.loopStart(request, run.signal));
|
|
522
|
+
members.loopList = () => call(() => operations.loopList());
|
|
523
|
+
members.loopStop = (request) => call(() => operations.loopStop(request));
|
|
524
|
+
for (const [name, member] of Object.entries(members)) {
|
|
525
|
+
const invoke = member;
|
|
526
|
+
members[name] = async (...args) => {
|
|
527
|
+
const started = Date.now();
|
|
528
|
+
const base = {
|
|
529
|
+
name: `calendar.${name}`,
|
|
530
|
+
tool: CARD_TOOLS[name] ?? "calendar",
|
|
531
|
+
args: recordedArgs(name, args)
|
|
532
|
+
};
|
|
533
|
+
try {
|
|
534
|
+
const value = await invoke(...args);
|
|
535
|
+
run.record?.({
|
|
536
|
+
...base,
|
|
537
|
+
ok: true,
|
|
538
|
+
ms: Date.now() - started,
|
|
539
|
+
result: {
|
|
540
|
+
content: [{
|
|
541
|
+
type: "text",
|
|
542
|
+
text: JSON.stringify(value ?? null, null, 2)
|
|
543
|
+
}],
|
|
544
|
+
details: value
|
|
545
|
+
}
|
|
546
|
+
});
|
|
547
|
+
return value;
|
|
548
|
+
} catch (error) {
|
|
549
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
550
|
+
run.record?.({
|
|
551
|
+
...base,
|
|
552
|
+
ok: false,
|
|
553
|
+
ms: Date.now() - started,
|
|
554
|
+
error: message,
|
|
555
|
+
result: { content: [{
|
|
556
|
+
type: "text",
|
|
557
|
+
text: message
|
|
558
|
+
}] }
|
|
559
|
+
});
|
|
560
|
+
throw error;
|
|
561
|
+
}
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
return members;
|
|
565
|
+
}
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
//#endregion
|
|
569
|
+
//#region ../../../layers/automation/po-calendar/src/services/loopLaunchers/index.ts
|
|
570
|
+
const ACTION_SCHEMA_VALIDATOR = Compile(Meta["https://json-schema.org/draft/2020-12/schema"]);
|
|
571
|
+
const MAX_ID_LENGTH = 256;
|
|
572
|
+
const MAX_GENERATION_LENGTH = 256;
|
|
573
|
+
const LAUNCHER_ID_LABEL = "loop launcher id";
|
|
574
|
+
const INSTANCE_ID_LABEL = "loop instance id";
|
|
575
|
+
/** Last C0 control code point and DEL, both rejected in ids. */
|
|
576
|
+
const LAST_C0_CONTROL = 31;
|
|
577
|
+
const DELETE_CONTROL = 127;
|
|
578
|
+
const STATE_STARTING = "starting";
|
|
579
|
+
const STATE_RUNNING = "running";
|
|
580
|
+
const STATE_STOPPING = "stopping";
|
|
581
|
+
const ABORT_EVENT = "abort";
|
|
582
|
+
const LAUNCH_CANCELLED_REASON = "Loop launch was cancelled.";
|
|
583
|
+
const STOP_FAILED_MESSAGE = "One or more loop instances failed to stop.";
|
|
584
|
+
const ACTION_CANCELLED_MESSAGE = "Loop action was cancelled.";
|
|
585
|
+
function validId(value, label) {
|
|
586
|
+
if (typeof value !== "string") throw new TypeError(`Invalid ${label}.`);
|
|
587
|
+
const normalized = value.trim();
|
|
588
|
+
let hasControl = false;
|
|
589
|
+
for (const character of normalized) {
|
|
590
|
+
const code = character.codePointAt(0);
|
|
591
|
+
if (code !== void 0 && (code <= LAST_C0_CONTROL || code === DELETE_CONTROL)) {
|
|
592
|
+
hasControl = true;
|
|
593
|
+
break;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
if (!normalized || normalized.length > MAX_ID_LENGTH || hasControl) throw new Error(`Invalid ${label}.`);
|
|
597
|
+
return normalized;
|
|
598
|
+
}
|
|
599
|
+
function snapshot$1(entry) {
|
|
600
|
+
return {
|
|
601
|
+
instanceId: entry.instanceId,
|
|
602
|
+
launcherId: entry.launcher.definition.id,
|
|
603
|
+
launcherLabel: entry.launcher.definition.label,
|
|
604
|
+
...entry.handle?.label ? { label: entry.handle.label } : {},
|
|
605
|
+
...entry.handle?.detail ? { detail: entry.handle.detail } : {},
|
|
606
|
+
state: entry.state,
|
|
607
|
+
...entry.startedAt ? { startedAt: entry.startedAt } : {}
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
/** True when a schema points outside itself, which Calendar never fetches. */
|
|
611
|
+
function hasRemoteRef(value) {
|
|
612
|
+
if (Array.isArray(value)) return value.some(hasRemoteRef);
|
|
613
|
+
if (!value || typeof value !== "object") return false;
|
|
614
|
+
return Object.entries(value).some(([key, entry]) => (key === "$ref" || key === "$dynamicRef") && (typeof entry !== "string" || !entry.startsWith("#")) || hasRemoteRef(entry));
|
|
615
|
+
}
|
|
616
|
+
/** Creates the provider-owned launcher registry for one active Po session. */
|
|
617
|
+
function createPoLoopLaunchersService({ generation, createInstanceId, timestamp }) {
|
|
618
|
+
if (!generation || generation.length > MAX_GENERATION_LENGTH) throw new TypeError("Po loop launchers require a valid generation.");
|
|
619
|
+
const launchers = /* @__PURE__ */ new Map();
|
|
620
|
+
const instances = /* @__PURE__ */ new Map();
|
|
621
|
+
const actions = /* @__PURE__ */ new Map();
|
|
622
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
623
|
+
let registrationSequence = 0;
|
|
624
|
+
let disposed = false;
|
|
625
|
+
const ensureActive = () => {
|
|
626
|
+
if (disposed) throw new Error("The Po loop-launchers service is disposed.");
|
|
627
|
+
};
|
|
628
|
+
const notify = () => {
|
|
629
|
+
for (const listener of listeners) listener();
|
|
630
|
+
};
|
|
631
|
+
const stopEntry = async (entry, reason) => {
|
|
632
|
+
if (instances.get(entry.instanceId) !== entry || entry.state === STATE_STOPPING) return;
|
|
633
|
+
entry.state = STATE_STOPPING;
|
|
634
|
+
const unsubscribe = entry.unsubscribe;
|
|
635
|
+
entry.unsubscribe = void 0;
|
|
636
|
+
try {
|
|
637
|
+
unsubscribe?.();
|
|
638
|
+
} finally {
|
|
639
|
+
entry.abortController.abort(reason);
|
|
640
|
+
notify();
|
|
641
|
+
try {
|
|
642
|
+
await entry.handle?.stop(reason);
|
|
643
|
+
} finally {
|
|
644
|
+
if (instances.get(entry.instanceId) === entry) instances.delete(entry.instanceId);
|
|
645
|
+
notify();
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
};
|
|
649
|
+
/** Attempts every stop before reporting all failures together. */
|
|
650
|
+
const stopEntries = async (entries, reason) => {
|
|
651
|
+
const errors = (await Promise.allSettled(entries.map((entry) => stopEntry(entry, reason)))).flatMap((result) => result.status === "rejected" ? [result.reason] : []);
|
|
652
|
+
if (errors.length > 0) throw new AggregateError(errors, STOP_FAILED_MESSAGE);
|
|
653
|
+
};
|
|
654
|
+
const abortActions = (token, reason) => {
|
|
655
|
+
for (const [controller, owner] of actions) if (token === void 0 || owner === token) controller.abort(reason);
|
|
656
|
+
};
|
|
657
|
+
const actionLauncher = (launcherId) => {
|
|
658
|
+
const id = validId(launcherId, LAUNCHER_ID_LABEL);
|
|
659
|
+
const launcher = launchers.get(id);
|
|
660
|
+
if (!launcher) throw new Error(`Loop launcher '${id}' is unavailable.`);
|
|
661
|
+
const schema = launcher.definition.actionInputSchema ?? launcher.definition.inputSchema;
|
|
662
|
+
if (!launcher.definition.runOnce || !schema) throw new Error(`Loop launcher '${id}' has no Calendar action.`);
|
|
663
|
+
return {
|
|
664
|
+
id,
|
|
665
|
+
launcher,
|
|
666
|
+
schema
|
|
667
|
+
};
|
|
668
|
+
};
|
|
669
|
+
const checkAction = async (launcherId, input) => {
|
|
670
|
+
const action = actionLauncher(launcherId);
|
|
671
|
+
let valid;
|
|
672
|
+
try {
|
|
673
|
+
valid = isCalendarJson(input) && ACTION_SCHEMA_VALIDATOR.Check(action.schema) && !hasRemoteRef(action.schema) && Compile(action.schema).Check(input);
|
|
674
|
+
} catch {
|
|
675
|
+
valid = false;
|
|
676
|
+
}
|
|
677
|
+
if (!valid) throw new Error(`Input does not match loop launcher '${action.id}'.`);
|
|
678
|
+
await action.launcher.definition.validate?.(structuredClone(input));
|
|
679
|
+
return action;
|
|
680
|
+
};
|
|
681
|
+
return Object.freeze({
|
|
682
|
+
generation,
|
|
683
|
+
register(definition) {
|
|
684
|
+
ensureActive();
|
|
685
|
+
const id = validId(definition.id, LAUNCHER_ID_LABEL);
|
|
686
|
+
if (launchers.has(id)) throw new Error(`Loop launcher '${id}' is already registered.`);
|
|
687
|
+
const token = Symbol(id);
|
|
688
|
+
const entry = {
|
|
689
|
+
token,
|
|
690
|
+
definition: {
|
|
691
|
+
...definition,
|
|
692
|
+
id
|
|
693
|
+
}
|
|
694
|
+
};
|
|
695
|
+
launchers.set(id, entry);
|
|
696
|
+
registrationSequence += 1;
|
|
697
|
+
notify();
|
|
698
|
+
let registrationDisposed = false;
|
|
699
|
+
return Object.freeze({
|
|
700
|
+
id,
|
|
701
|
+
generation: `${generation}:launcher:${registrationSequence}`,
|
|
702
|
+
async dispose(reason = "Loop launcher disposed.") {
|
|
703
|
+
if (registrationDisposed) return;
|
|
704
|
+
registrationDisposed = true;
|
|
705
|
+
if (launchers.get(id)?.token !== token) return;
|
|
706
|
+
launchers.delete(id);
|
|
707
|
+
const owned = [...instances.values()].filter((instance) => instance.launcher.token === token);
|
|
708
|
+
try {
|
|
709
|
+
await stopEntries(owned, reason);
|
|
710
|
+
} finally {
|
|
711
|
+
notify();
|
|
712
|
+
abortActions(token, reason);
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
});
|
|
716
|
+
},
|
|
717
|
+
listLaunchers() {
|
|
718
|
+
ensureActive();
|
|
719
|
+
return [...launchers.values()].map(({ definition }) => ({
|
|
720
|
+
id: definition.id,
|
|
721
|
+
source: definition.source,
|
|
722
|
+
label: definition.label,
|
|
723
|
+
...definition.description ? { description: definition.description } : {},
|
|
724
|
+
...definition.inputSchema ? { inputSchema: definition.inputSchema } : {},
|
|
725
|
+
...definition.actionInputSchema ? { actionInputSchema: definition.actionInputSchema } : {},
|
|
726
|
+
supportsActions: Boolean(definition.runOnce && (definition.actionInputSchema ?? definition.inputSchema))
|
|
727
|
+
})).sort((left, right) => left.label.localeCompare(right.label) || left.id.localeCompare(right.id));
|
|
728
|
+
},
|
|
729
|
+
listInstances() {
|
|
730
|
+
ensureActive();
|
|
731
|
+
return [...instances.values()].map(snapshot$1).sort((left, right) => left.instanceId.localeCompare(right.instanceId));
|
|
732
|
+
},
|
|
733
|
+
async validateAction(launcherId, input) {
|
|
734
|
+
ensureActive();
|
|
735
|
+
await checkAction(launcherId, input);
|
|
736
|
+
},
|
|
737
|
+
async runOnce(launcherId, input, execution) {
|
|
738
|
+
ensureActive();
|
|
739
|
+
execution.signal.throwIfAborted();
|
|
740
|
+
const { id, launcher } = await checkAction(launcherId, input);
|
|
741
|
+
const controller = new AbortController();
|
|
742
|
+
const forward = () => controller.abort(execution.signal.reason);
|
|
743
|
+
execution.signal.addEventListener(ABORT_EVENT, forward, { once: true });
|
|
744
|
+
actions.set(controller, launcher.token);
|
|
745
|
+
try {
|
|
746
|
+
const result = await launcher.definition.runOnce(structuredClone(input), {
|
|
747
|
+
eventId: execution.eventId,
|
|
748
|
+
occurrenceId: execution.occurrenceId,
|
|
749
|
+
sessionId: execution.sessionId,
|
|
750
|
+
signal: controller.signal
|
|
751
|
+
});
|
|
752
|
+
if (controller.signal.aborted || disposed || launchers.get(id)?.token !== launcher.token) throw new Error(ACTION_CANCELLED_MESSAGE);
|
|
753
|
+
const summary = result && typeof result.summary === "string" ? result.summary : void 0;
|
|
754
|
+
return summary ? { summary: summary.slice(0, MAX_CALENDAR_SUMMARY_LENGTH) } : {};
|
|
755
|
+
} catch (error) {
|
|
756
|
+
if (controller.signal.aborted) throw new Error(ACTION_CANCELLED_MESSAGE);
|
|
757
|
+
throw error;
|
|
758
|
+
} finally {
|
|
759
|
+
actions.delete(controller);
|
|
760
|
+
execution.signal.removeEventListener(ABORT_EVENT, forward);
|
|
761
|
+
}
|
|
762
|
+
},
|
|
763
|
+
subscribe(listener) {
|
|
764
|
+
ensureActive();
|
|
765
|
+
listeners.add(listener);
|
|
766
|
+
let subscribed = true;
|
|
767
|
+
return () => {
|
|
768
|
+
if (!subscribed) return;
|
|
769
|
+
subscribed = false;
|
|
770
|
+
listeners.delete(listener);
|
|
771
|
+
};
|
|
772
|
+
},
|
|
773
|
+
async launch(launcherId, options) {
|
|
774
|
+
ensureActive();
|
|
775
|
+
options?.signal?.throwIfAborted();
|
|
776
|
+
const normalizedLauncherId = validId(launcherId, LAUNCHER_ID_LABEL);
|
|
777
|
+
const launcher = launchers.get(normalizedLauncherId);
|
|
778
|
+
if (!launcher) throw new Error(`Loop launcher '${normalizedLauncherId}' is unavailable.`);
|
|
779
|
+
const instanceId = validId(options?.instanceId ?? createInstanceId(), INSTANCE_ID_LABEL);
|
|
780
|
+
if (instances.has(instanceId)) throw new Error(`Loop instance '${instanceId}' already exists.`);
|
|
781
|
+
const entry = {
|
|
782
|
+
instanceId,
|
|
783
|
+
launcher,
|
|
784
|
+
abortController: new AbortController(),
|
|
785
|
+
state: STATE_STARTING
|
|
786
|
+
};
|
|
787
|
+
const abortSetup = () => entry.abortController.abort(options?.signal?.reason);
|
|
788
|
+
options?.signal?.addEventListener(ABORT_EVENT, abortSetup, { once: true });
|
|
789
|
+
instances.set(instanceId, entry);
|
|
790
|
+
notify();
|
|
791
|
+
try {
|
|
792
|
+
if (options?.interactive === false && !launcher.definition.inputSchema) throw new Error(`Loop launcher '${normalizedLauncherId}' requires manual setup in Activity.`);
|
|
793
|
+
const handle = await launcher.definition.launch({
|
|
794
|
+
instanceId,
|
|
795
|
+
signal: entry.abortController.signal,
|
|
796
|
+
...options?.input === void 0 ? {} : { input: options.input },
|
|
797
|
+
...options?.interactive === void 0 ? {} : { interactive: options.interactive }
|
|
798
|
+
});
|
|
799
|
+
const active = !disposed && instances.get(instanceId) === entry && !entry.abortController.signal.aborted;
|
|
800
|
+
if (!handle) {
|
|
801
|
+
if (instances.get(instanceId) === entry) instances.delete(instanceId);
|
|
802
|
+
notify();
|
|
803
|
+
return;
|
|
804
|
+
}
|
|
805
|
+
if (!active || handle.instanceId !== instanceId) {
|
|
806
|
+
await handle.stop(active ? "Loop launcher returned a mismatched instance id." : LAUNCH_CANCELLED_REASON);
|
|
807
|
+
if (instances.get(instanceId) === entry) instances.delete(instanceId);
|
|
808
|
+
notify();
|
|
809
|
+
if (active) throw new Error(`Loop launcher '${normalizedLauncherId}' returned a mismatched instance id.`);
|
|
810
|
+
return;
|
|
811
|
+
}
|
|
812
|
+
entry.handle = handle;
|
|
813
|
+
entry.state = STATE_RUNNING;
|
|
814
|
+
entry.startedAt = timestamp();
|
|
815
|
+
const unsubscribe = handle.subscribe?.(() => {
|
|
816
|
+
if (!disposed && instances.get(instanceId) === entry && entry.state === STATE_RUNNING) notify();
|
|
817
|
+
});
|
|
818
|
+
if (disposed || instances.get(instanceId) !== entry || entry.abortController.signal.aborted) {
|
|
819
|
+
unsubscribe?.();
|
|
820
|
+
await stopEntry(entry, LAUNCH_CANCELLED_REASON);
|
|
821
|
+
return;
|
|
822
|
+
}
|
|
823
|
+
entry.unsubscribe = unsubscribe;
|
|
824
|
+
notify();
|
|
825
|
+
return snapshot$1(entry);
|
|
826
|
+
} catch (error) {
|
|
827
|
+
const cancelled = entry.abortController.signal.aborted || disposed;
|
|
828
|
+
try {
|
|
829
|
+
if (entry.handle) await stopEntry(entry, "Loop launch failed.");
|
|
830
|
+
} finally {
|
|
831
|
+
if (instances.get(instanceId) === entry) instances.delete(instanceId);
|
|
832
|
+
notify();
|
|
833
|
+
}
|
|
834
|
+
if (cancelled) return void 0;
|
|
835
|
+
throw error;
|
|
836
|
+
} finally {
|
|
837
|
+
options?.signal?.removeEventListener(ABORT_EVENT, abortSetup);
|
|
838
|
+
}
|
|
839
|
+
},
|
|
840
|
+
async stop(instanceId, reason) {
|
|
841
|
+
ensureActive();
|
|
842
|
+
const entry = instances.get(validId(instanceId, INSTANCE_ID_LABEL));
|
|
843
|
+
if (!entry) return false;
|
|
844
|
+
await stopEntry(entry, reason);
|
|
845
|
+
return true;
|
|
846
|
+
},
|
|
847
|
+
async stopAll(reason) {
|
|
848
|
+
if (disposed && instances.size === 0) return;
|
|
849
|
+
await stopEntries([...instances.values()], reason);
|
|
850
|
+
},
|
|
851
|
+
async dispose(reason = "Po loop-launchers service disposed.") {
|
|
852
|
+
if (disposed) return;
|
|
853
|
+
disposed = true;
|
|
854
|
+
launchers.clear();
|
|
855
|
+
abortActions(void 0, reason);
|
|
856
|
+
try {
|
|
857
|
+
await stopEntries([...instances.values()], reason);
|
|
858
|
+
} finally {
|
|
859
|
+
listeners.clear();
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
//#endregion
|
|
865
|
+
//#region ../../../layers/automation/po-calendar/src/services/calendarSession/index.ts
|
|
866
|
+
const SOURCE = "@agimon-ai/po-calendar";
|
|
867
|
+
const SESSION_DETACHED = "Calendar session detached.";
|
|
868
|
+
const result = (details) => ({
|
|
869
|
+
content: [{
|
|
870
|
+
type: "text",
|
|
871
|
+
text: JSON.stringify(details, null, 2)
|
|
872
|
+
}],
|
|
873
|
+
details
|
|
874
|
+
});
|
|
875
|
+
const snapshot = (event) => ({
|
|
876
|
+
instanceId: event.id,
|
|
877
|
+
launcherId: event.schedule.kind === "cron" ? "po.cron" : "po.default",
|
|
878
|
+
launcherLabel: "Calendar event",
|
|
879
|
+
label: event.title,
|
|
880
|
+
detail: event.prompt ?? event.workflow?.key ?? event.action?.launcherId,
|
|
881
|
+
state: event.status === "active" ? "running" : "stopping",
|
|
882
|
+
startedAt: new Date(event.createdAt).toISOString()
|
|
883
|
+
});
|
|
884
|
+
function createCalendarSessionState(agent, root, owner) {
|
|
885
|
+
const launchers = createPoLoopLaunchersService({
|
|
886
|
+
generation: crypto.randomUUID(),
|
|
887
|
+
createInstanceId: () => crypto.randomUUID(),
|
|
888
|
+
timestamp: () => (/* @__PURE__ */ new Date()).toISOString()
|
|
889
|
+
});
|
|
890
|
+
const validateAction = (action) => launchers.validateAction(action.launcherId, action.input);
|
|
891
|
+
let profileRuntime;
|
|
892
|
+
const lifetime = new AbortController();
|
|
893
|
+
const ready = async () => {
|
|
894
|
+
if (!profileRuntime) throw new Error("Calendar profile provider readiness is unavailable.");
|
|
895
|
+
const profile = profileRuntime.readSelection();
|
|
896
|
+
const deadline = createDeadline(AbortSignal.any([lifetime.signal, profile.signal]), PROFILE_RESOLUTION_TIMEOUT_MS);
|
|
897
|
+
try {
|
|
898
|
+
const result = await deadline.within(() => profileRuntime.ready());
|
|
899
|
+
if (result.status !== "done") throw new Error(`Calendar profile provider readiness ${result.status}.`);
|
|
900
|
+
if (profile.signal.aborted || profile.generation !== profileRuntime.readSelection().generation) throw new Error("The applied Calendar profile changed.");
|
|
901
|
+
} finally {
|
|
902
|
+
deadline.dispose();
|
|
903
|
+
}
|
|
904
|
+
};
|
|
905
|
+
const value = root.forOwner({
|
|
906
|
+
level: "session",
|
|
907
|
+
...owner
|
|
908
|
+
}, {
|
|
909
|
+
validateAction,
|
|
910
|
+
selection: () => ({
|
|
911
|
+
profile: profileRuntime?.readSelection().profileName,
|
|
912
|
+
domains: agent?.context.selection.state?.["domain"]?.slice(),
|
|
913
|
+
preset: agent?.context.selection.state?.["preset"]?.[0],
|
|
914
|
+
modes: agent?.context.selection.state?.["mode"]?.slice()
|
|
915
|
+
}),
|
|
916
|
+
ready,
|
|
917
|
+
signal: lifetime.signal,
|
|
918
|
+
setup: async () => {
|
|
919
|
+
await ready();
|
|
920
|
+
const runtime = agent?.context.readRuntimeSetup?.();
|
|
921
|
+
if (!runtime || !profileRuntime || !serviceContext) throw new Error("The applied Calendar setup is unavailable.");
|
|
922
|
+
const profile = profileRuntime.readSelection();
|
|
923
|
+
const config = requirePoConfigContext(serviceContext);
|
|
924
|
+
const { modes, profileMemory, subagents } = config.settings;
|
|
925
|
+
const identity = await calendarSetup({
|
|
926
|
+
runtime,
|
|
927
|
+
profile,
|
|
928
|
+
settings: {
|
|
929
|
+
modes,
|
|
930
|
+
profileMemory,
|
|
931
|
+
subagents
|
|
932
|
+
}
|
|
933
|
+
});
|
|
934
|
+
if (lifetime.signal.aborted || profile.generation !== profileRuntime.readSelection().generation || canonicalCalendarJson(runtime) !== canonicalCalendarJson(agent.context.readRuntimeSetup()) || config !== requirePoConfigContext(serviceContext)) throw new Error("The applied Calendar setup changed.");
|
|
935
|
+
return identity;
|
|
936
|
+
}
|
|
937
|
+
});
|
|
938
|
+
const events = createCalendarEventsService({
|
|
939
|
+
root,
|
|
940
|
+
owner,
|
|
941
|
+
validateAction
|
|
942
|
+
});
|
|
943
|
+
const scope = value.scope;
|
|
944
|
+
let serviceContext;
|
|
945
|
+
const executor = createCalendarSessionExecutor({
|
|
946
|
+
sessionId: owner.sessionId,
|
|
947
|
+
store: root.store,
|
|
948
|
+
launchers,
|
|
949
|
+
workflows: () => serviceContext ? readPoWorkflowLaunchService(serviceContext) : void 0,
|
|
950
|
+
modes: () => agent?.context.selection.state?.["mode"] ?? []
|
|
951
|
+
});
|
|
952
|
+
let disposed = false;
|
|
953
|
+
const assertAvailable = () => {
|
|
954
|
+
if (disposed) throw new Error("Calendar session is closed.");
|
|
955
|
+
};
|
|
956
|
+
const list = async () => {
|
|
957
|
+
return (await scope.listOwned()).filter((event) => event.status === "active" || event.status === "paused");
|
|
958
|
+
};
|
|
959
|
+
const stop = async (id, reason) => {
|
|
960
|
+
if ((await list()).find((entry) => entry.id === id)) {
|
|
961
|
+
await scope.action(id, "cancel");
|
|
962
|
+
return true;
|
|
963
|
+
}
|
|
964
|
+
return launchers.stop(id, reason ?? "Stopped by the person.");
|
|
965
|
+
};
|
|
966
|
+
const scopeFor = async (id) => await root.changeScope(owner.sessionId, id) ?? scope;
|
|
967
|
+
const withSchedule = (value) => {
|
|
968
|
+
if (!value || typeof value !== "object" || Array.isArray(value) || !("schedule" in value)) return value;
|
|
969
|
+
const personTimeZone = serviceContext ? readPoPersonTimeZone(serviceContext)?.read()?.timeZone : void 0;
|
|
970
|
+
return {
|
|
971
|
+
...value,
|
|
972
|
+
schedule: resolveScheduleInput(value.schedule, personTimeZone)
|
|
973
|
+
};
|
|
974
|
+
};
|
|
975
|
+
const operations = {
|
|
976
|
+
create: (input) => scope.create(withSchedule(input)),
|
|
977
|
+
list,
|
|
978
|
+
update: async (id, patch) => (await scopeFor(id)).update(id, withSchedule(patch)),
|
|
979
|
+
action: async (id, action) => (await scopeFor(id)).action(id, action),
|
|
980
|
+
history: async (id, cursor) => (await scopeFor(id)).history(id, cursor),
|
|
981
|
+
async loopStart(input, signal) {
|
|
982
|
+
if (!Check(LoopStartSchema, input)) throw new Error("Provide launcherId and input.");
|
|
983
|
+
if (input.launcherId !== "po.default" && input.launcherId !== "po.cron") return await launchers.launch(input.launcherId, {
|
|
984
|
+
...input,
|
|
985
|
+
interactive: false,
|
|
986
|
+
signal
|
|
987
|
+
});
|
|
988
|
+
if (input.instanceId) throw new Error("Durable recurring event IDs are assigned by Calendar. Omit instanceId for built-in launchers.");
|
|
989
|
+
const prepared = input.launcherId === "po.cron" ? parseCronLoop(input.input) : parseIntervalLoop(input.input);
|
|
990
|
+
if (scope.owner.level !== "session") throw new Error("Loop tools require a session owner.");
|
|
991
|
+
const event = await scope.create(withSchedule({
|
|
992
|
+
title: prepared.prompt.slice(0, 80),
|
|
993
|
+
prompt: prepared.prompt,
|
|
994
|
+
schedule: "cron" in prepared ? {
|
|
995
|
+
kind: "cron",
|
|
996
|
+
expr: prepared.cron,
|
|
997
|
+
...prepared.timezone ? { tz: prepared.timezone } : {}
|
|
998
|
+
} : {
|
|
999
|
+
kind: "interval",
|
|
1000
|
+
seconds: prepared.intervalSeconds
|
|
1001
|
+
},
|
|
1002
|
+
target: {
|
|
1003
|
+
kind: "existingSession",
|
|
1004
|
+
sessionId: scope.owner.sessionId
|
|
1005
|
+
}
|
|
1006
|
+
}));
|
|
1007
|
+
return snapshot(event);
|
|
1008
|
+
},
|
|
1009
|
+
async loopList() {
|
|
1010
|
+
return {
|
|
1011
|
+
launchers: [
|
|
1012
|
+
{
|
|
1013
|
+
id: "po.default",
|
|
1014
|
+
source: SOURCE,
|
|
1015
|
+
label: "Interval event",
|
|
1016
|
+
inputSchema: { ...IntervalLoopSchema },
|
|
1017
|
+
supportsActions: false
|
|
1018
|
+
},
|
|
1019
|
+
{
|
|
1020
|
+
id: "po.cron",
|
|
1021
|
+
source: SOURCE,
|
|
1022
|
+
label: "Cron event",
|
|
1023
|
+
inputSchema: { ...CronLoopSchema },
|
|
1024
|
+
supportsActions: false
|
|
1025
|
+
},
|
|
1026
|
+
...launchers.listLaunchers()
|
|
1027
|
+
],
|
|
1028
|
+
instances: [...(await list()).filter((event) => event.schedule.kind !== "once").map(snapshot), ...launchers.listInstances()]
|
|
1029
|
+
};
|
|
1030
|
+
},
|
|
1031
|
+
async loopStop(input) {
|
|
1032
|
+
if (!Check(LoopStopSchema, input)) throw new Error("Provide instanceId.");
|
|
1033
|
+
return { stopped: await stop(input.instanceId, input.reason) };
|
|
1034
|
+
}
|
|
1035
|
+
};
|
|
1036
|
+
const tools = [
|
|
1037
|
+
defineTool({
|
|
1038
|
+
name: "calendar_schedule",
|
|
1039
|
+
approval: CALENDAR_WRITE_APPROVAL,
|
|
1040
|
+
label: "Schedule event",
|
|
1041
|
+
description: "Schedule a durable one-off, interval or cron prompt owned by this session. Times are in the person's timezone unless schedule.tz names another; a one-off may give at as local time like 2026-05-01T09:00. Missed runs are skipped. New-session runs sleep after settling; existing sleeping sessions wake. Session targets cannot drive other existing sessions.",
|
|
1042
|
+
parameters: CalendarAgentDraftSchema,
|
|
1043
|
+
executionMode: "serial",
|
|
1044
|
+
async execute(input, { signal }) {
|
|
1045
|
+
assertAvailable();
|
|
1046
|
+
signal?.throwIfAborted();
|
|
1047
|
+
return result(await operations.create(input));
|
|
1048
|
+
}
|
|
1049
|
+
}),
|
|
1050
|
+
defineTool({
|
|
1051
|
+
name: "calendar_list",
|
|
1052
|
+
label: "List events",
|
|
1053
|
+
description: "List this session’s scheduled events and their durable IDs.",
|
|
1054
|
+
parameters: CalendarListInputSchema,
|
|
1055
|
+
async execute(input, { signal }) {
|
|
1056
|
+
assertAvailable();
|
|
1057
|
+
signal?.throwIfAborted();
|
|
1058
|
+
if (!Check(CalendarListInputSchema, input)) throw new Error("calendar_list takes no arguments.");
|
|
1059
|
+
return result({ events: await operations.list() });
|
|
1060
|
+
}
|
|
1061
|
+
}),
|
|
1062
|
+
defineTool({
|
|
1063
|
+
name: "calendar_cancel",
|
|
1064
|
+
label: "Cancel event",
|
|
1065
|
+
description: "Cancel a durable event owned by this session.",
|
|
1066
|
+
parameters: CalendarCancelInputSchema,
|
|
1067
|
+
executionMode: "serial",
|
|
1068
|
+
async execute(input, { signal }) {
|
|
1069
|
+
assertAvailable();
|
|
1070
|
+
signal?.throwIfAborted();
|
|
1071
|
+
if (!Check(CalendarCancelInputSchema, input)) throw new Error("Provide the event id.");
|
|
1072
|
+
return result(await operations.action(input.id, "cancel"));
|
|
1073
|
+
}
|
|
1074
|
+
}),
|
|
1075
|
+
defineTool({
|
|
1076
|
+
name: "loop_start",
|
|
1077
|
+
approval: CALENDAR_WRITE_APPROVAL,
|
|
1078
|
+
label: "Start recurring event",
|
|
1079
|
+
description: "Compatibility alias. po.default uses prompt and intervalSeconds (30 to 3600); po.cron uses prompt, five-field cron, and optional timezone (the person's zone when omitted). These schedules persist after this session stops. Custom launcher closures remain session-local.",
|
|
1080
|
+
parameters: LoopStartSchema,
|
|
1081
|
+
executionMode: "serial",
|
|
1082
|
+
async execute(input, { signal }) {
|
|
1083
|
+
assertAvailable();
|
|
1084
|
+
signal?.throwIfAborted();
|
|
1085
|
+
return result(await operations.loopStart(input, signal));
|
|
1086
|
+
}
|
|
1087
|
+
}),
|
|
1088
|
+
defineTool({
|
|
1089
|
+
name: "loop_list",
|
|
1090
|
+
label: "List recurring events",
|
|
1091
|
+
description: "Compatibility alias. Lists durable session events and session-local custom launcher instances.",
|
|
1092
|
+
parameters: CalendarListInputSchema,
|
|
1093
|
+
async execute(input, { signal }) {
|
|
1094
|
+
assertAvailable();
|
|
1095
|
+
signal?.throwIfAborted();
|
|
1096
|
+
if (!Check(CalendarListInputSchema, input)) throw new Error("loop_list takes no arguments.");
|
|
1097
|
+
return result(await operations.loopList());
|
|
1098
|
+
}
|
|
1099
|
+
}),
|
|
1100
|
+
defineTool({
|
|
1101
|
+
name: "loop_stop",
|
|
1102
|
+
label: "Stop recurring event",
|
|
1103
|
+
description: "Compatibility alias. Cancels one durable session event or stops a session-local custom launcher.",
|
|
1104
|
+
parameters: LoopStopSchema,
|
|
1105
|
+
executionMode: "serial",
|
|
1106
|
+
async execute(input, { signal }) {
|
|
1107
|
+
assertAvailable();
|
|
1108
|
+
signal?.throwIfAborted();
|
|
1109
|
+
return result(await operations.loopStop(input));
|
|
1110
|
+
}
|
|
1111
|
+
})
|
|
1112
|
+
];
|
|
1113
|
+
return {
|
|
1114
|
+
value,
|
|
1115
|
+
tools,
|
|
1116
|
+
command: {
|
|
1117
|
+
description: "List or manage this session’s events: /calendar [pause|resume|cancel|run-now id]. /loops stop id is supported.",
|
|
1118
|
+
async execute(args, execution) {
|
|
1119
|
+
const parts = args.trim().split(/\s+/u);
|
|
1120
|
+
let value;
|
|
1121
|
+
if (!args.trim()) value = await list();
|
|
1122
|
+
else if (parts.length === 2 && parts[0] === "stop") value = { stopped: await stop(parts[1]) };
|
|
1123
|
+
else if (parts.length === 2 && [
|
|
1124
|
+
"pause",
|
|
1125
|
+
"resume",
|
|
1126
|
+
"cancel",
|
|
1127
|
+
"run-now"
|
|
1128
|
+
].includes(parts[0])) value = await scope.action(parts[1], parts[0]);
|
|
1129
|
+
else throw new Error("Usage: /calendar [pause|resume|cancel|run-now id] or /loops stop id");
|
|
1130
|
+
await execution.notify({
|
|
1131
|
+
body: JSON.stringify(value, null, 2),
|
|
1132
|
+
level: "info"
|
|
1133
|
+
});
|
|
1134
|
+
}
|
|
1135
|
+
},
|
|
1136
|
+
services: [
|
|
1137
|
+
(context) => {
|
|
1138
|
+
const fiber = context.inject([PROFILE_RUNTIME_SERVICE], (bound) => {
|
|
1139
|
+
profileRuntime = bound.get(PROFILE_RUNTIME_SERVICE);
|
|
1140
|
+
return () => {
|
|
1141
|
+
profileRuntime = void 0;
|
|
1142
|
+
};
|
|
1143
|
+
});
|
|
1144
|
+
return () => fiber.dispose();
|
|
1145
|
+
},
|
|
1146
|
+
(context) => context.provide(PO_LOOP_LAUNCHERS_SERVICE, launchers),
|
|
1147
|
+
(context) => context.provide(PO_CALENDAR_EVENTS_SERVICE, events),
|
|
1148
|
+
(context) => {
|
|
1149
|
+
serviceContext = context;
|
|
1150
|
+
const unregister = root.executors.register(owner.sessionId, executor);
|
|
1151
|
+
return () => {
|
|
1152
|
+
unregister();
|
|
1153
|
+
if (serviceContext === context) serviceContext = void 0;
|
|
1154
|
+
};
|
|
1155
|
+
},
|
|
1156
|
+
(context) => {
|
|
1157
|
+
context.inject([PO_CODEMODE_SERVICE], (bound) => {
|
|
1158
|
+
const codemode = readPoCodemode(bound);
|
|
1159
|
+
if (!codemode || !agent) return void 0;
|
|
1160
|
+
const registration = codemode.register(SOURCE, createCalendarNamespace({
|
|
1161
|
+
...owner,
|
|
1162
|
+
operations,
|
|
1163
|
+
assertAvailable
|
|
1164
|
+
}));
|
|
1165
|
+
const restriction = agent.registerToolRestriction({ excludedTools: tools.map((tool) => tool.name) });
|
|
1166
|
+
return () => {
|
|
1167
|
+
restriction.dispose();
|
|
1168
|
+
registration.dispose();
|
|
1169
|
+
};
|
|
1170
|
+
});
|
|
1171
|
+
}
|
|
1172
|
+
],
|
|
1173
|
+
async onStart() {
|
|
1174
|
+
agent?.context.client.setStatus("po-calendar", "Calendar ready");
|
|
1175
|
+
},
|
|
1176
|
+
onDispose: async () => {
|
|
1177
|
+
disposed = true;
|
|
1178
|
+
lifetime.abort(/* @__PURE__ */ new Error(SESSION_DETACHED));
|
|
1179
|
+
events.dispose();
|
|
1180
|
+
agent?.context.client.setStatus("po-calendar", void 0);
|
|
1181
|
+
await launchers.dispose(SESSION_DETACHED);
|
|
1182
|
+
}
|
|
1183
|
+
};
|
|
1184
|
+
}
|
|
1185
|
+
//#endregion
|
|
1186
|
+
//#region ../../../layers/automation/po-calendar/src/extensions/workspaces/sessions/(backend)/root.server.ts
|
|
1187
|
+
var root_server_default = defineRoot((context) => {
|
|
1188
|
+
const { workspaceId, sessionId } = context.host.context;
|
|
1189
|
+
if (!workspaceId || !sessionId) throw new Error("Calendar session identity is unavailable.");
|
|
1190
|
+
const session = createCalendarSessionState(context.agent, context.root, {
|
|
1191
|
+
workspaceId,
|
|
1192
|
+
sessionId
|
|
1193
|
+
});
|
|
1194
|
+
return {
|
|
1195
|
+
value: {
|
|
1196
|
+
...session.value,
|
|
1197
|
+
tools: session.tools,
|
|
1198
|
+
command: session.command
|
|
1199
|
+
},
|
|
1200
|
+
services: session.services,
|
|
1201
|
+
onStart: () => session.onStart(),
|
|
1202
|
+
onDispose: () => session.onDispose()
|
|
1203
|
+
};
|
|
1204
|
+
}, { inject: [CALENDAR_ROOT_SERVICE] });
|
|
1205
|
+
//#endregion
|
|
1206
|
+
//#region ../../../layers/automation/po-calendar/src/extensions/(backend)/contract/calendarSources.server.ts
|
|
1207
|
+
var calendarSources_server_default = CALENDAR_SOURCES_SERVICE;
|
|
1208
|
+
//#endregion
|
|
1209
|
+
//#region ../../../layers/automation/po-calendar/src/extensions/workspaces/sessions/(backend)/contract/calendarEvents.server.ts
|
|
1210
|
+
var calendarEvents_server_default = defineServiceContract(PO_CALENDAR_EVENTS_SERVICE, {
|
|
1211
|
+
scope: "session",
|
|
1212
|
+
description: "Create, update and cancel the calling plugin's scheduled events at its session or workspace level."
|
|
1213
|
+
});
|
|
1214
|
+
//#endregion
|
|
1215
|
+
//#region ../../../layers/automation/po-calendar/src/extensions/(backend)/api/calendar/route.server.ts
|
|
1216
|
+
var route_server_default$2 = defineRoute((context) => context.root.api);
|
|
1217
|
+
//#endregion
|
|
1218
|
+
//#region ../../../layers/automation/po-calendar/src/extensions/workspaces/(backend)/api/calendar/route.server.ts
|
|
1219
|
+
var route_server_default$1 = defineRoute((context) => context.root.api);
|
|
1220
|
+
//#endregion
|
|
1221
|
+
//#region ../../../layers/automation/po-calendar/src/extensions/workspaces/sessions/(backend)/api/calendar/route.server.ts
|
|
1222
|
+
var route_server_default = defineRoute((context) => context.root.api);
|
|
1223
|
+
//#endregion
|
|
1224
|
+
//#region ../../../layers/automation/po-calendar/src/extensions/workspaces/sessions/(backend)/command/calendar.server.ts
|
|
1225
|
+
var calendar_server_default = defineCommand((context) => context.root.command);
|
|
1226
|
+
//#endregion
|
|
1227
|
+
//#region ../../../layers/automation/po-calendar/src/extensions/workspaces/sessions/(backend)/command/loops.server.ts
|
|
1228
|
+
var loops_server_default = defineCommand((context) => ({
|
|
1229
|
+
...context.root.command,
|
|
1230
|
+
name: "loops"
|
|
1231
|
+
}));
|
|
1232
|
+
//#endregion
|
|
1233
|
+
//#region ../../../layers/automation/po-calendar/src/extensions/workspaces/sessions/(backend)/resource/codemode-how-to-calendar.server.ts
|
|
1234
|
+
var codemode_how_to_calendar_server_default = defineResource({
|
|
1235
|
+
name: "codemode-how-to-calendar",
|
|
1236
|
+
description: "Schedule durable prompts, workflows and plugin actions through the calendar namespace. Use for one-off, interval or cron events, assigned sessions, event history and recurring launcher discovery.",
|
|
1237
|
+
kind: "skill",
|
|
1238
|
+
pinned: true,
|
|
1239
|
+
path: packageResourcePath("bundle:///po-calendar/src/extensions/workspaces/sessions/(backend)/resource/codemode-how-to-calendar.server.ts", "src/prompts/codemode-how-to-calendar/SKILL.md"),
|
|
1240
|
+
read: () => readPackageResource("bundle:///po-calendar/src/extensions/workspaces/sessions/(backend)/resource/codemode-how-to-calendar.server.ts", "src/prompts/codemode-how-to-calendar/SKILL.md")
|
|
1241
|
+
});
|
|
1242
|
+
//#endregion
|
|
1243
|
+
//#region ../../../layers/automation/po-calendar/src/extensions/workspaces/sessions/(backend)/resource/help-how-to-calendar.server.ts
|
|
1244
|
+
var help_how_to_calendar_server_default = defineResource({
|
|
1245
|
+
name: "help-how-to-calendar",
|
|
1246
|
+
description: "Schedule durable prompts with Calendar and manage saved events",
|
|
1247
|
+
when: PO_HELP_WHEN,
|
|
1248
|
+
kind: "skill",
|
|
1249
|
+
path: packageResourcePath("bundle:///po-calendar/src/extensions/workspaces/sessions/(backend)/resource/help-how-to-calendar.server.ts", "src/prompts/help-how-to-calendar/SKILL.md"),
|
|
1250
|
+
read: () => readPackageResource("bundle:///po-calendar/src/extensions/workspaces/sessions/(backend)/resource/help-how-to-calendar.server.ts", "src/prompts/help-how-to-calendar/SKILL.md")
|
|
1251
|
+
});
|
|
1252
|
+
//#endregion
|
|
1253
|
+
//#region ../../../layers/automation/po-calendar/src/extensions/workspaces/sessions/(backend)/tool/calendar-cancel.server.ts
|
|
1254
|
+
var calendar_cancel_server_default = defineTool$1((context) => context.root.tools[2]);
|
|
1255
|
+
//#endregion
|
|
1256
|
+
//#region ../../../layers/automation/po-calendar/src/extensions/workspaces/sessions/(backend)/tool/calendar-list.server.ts
|
|
1257
|
+
var calendar_list_server_default = defineTool$1((context) => context.root.tools[1]);
|
|
1258
|
+
//#endregion
|
|
1259
|
+
//#region ../../../layers/automation/po-calendar/src/extensions/workspaces/sessions/(backend)/tool/calendar-schedule.server.ts
|
|
1260
|
+
var calendar_schedule_server_default = defineTool$1((context) => context.root.tools[0]);
|
|
1261
|
+
//#endregion
|
|
1262
|
+
//#region ../../../layers/automation/po-calendar/src/extensions/workspaces/sessions/(backend)/tool/loop-list.server.ts
|
|
1263
|
+
var loop_list_server_default = defineTool$1((context) => context.root.tools[4]);
|
|
1264
|
+
//#endregion
|
|
1265
|
+
//#region ../../../layers/automation/po-calendar/src/extensions/workspaces/sessions/(backend)/tool/loop-start.server.ts
|
|
1266
|
+
var loop_start_server_default = defineTool$1((context) => context.root.tools[3]);
|
|
1267
|
+
//#endregion
|
|
1268
|
+
//#region ../../../layers/automation/po-calendar/src/extensions/workspaces/sessions/(backend)/tool/loop-stop.server.ts
|
|
1269
|
+
var loop_stop_server_default = defineTool$1((context) => context.root.tools[5]);
|
|
1270
|
+
//#endregion
|
|
1271
|
+
//#region ../../../layers/automation/po-calendar/generated/server.ts
|
|
1272
|
+
const at = (value, context) => typeof value === "function" ? value(context) : value;
|
|
1273
|
+
const via = (identity, value) => value === void 0 ? void 0 : {
|
|
1274
|
+
...identity,
|
|
1275
|
+
...value
|
|
1276
|
+
};
|
|
1277
|
+
const serverPlugin = defineServerPlugin({
|
|
1278
|
+
name: "@agimon-ai/po-calendar",
|
|
1279
|
+
providerOverrides: composeServerProviderOverrides(root_server_default$2, root_server_default$1, root_server_default),
|
|
1280
|
+
provides: {
|
|
1281
|
+
host: [calendarSources_server_default],
|
|
1282
|
+
session: [calendarEvents_server_default]
|
|
1283
|
+
},
|
|
1284
|
+
injects: composeRootInjects({
|
|
1285
|
+
host: [root_server_default$2],
|
|
1286
|
+
workspace: [root_server_default$2, root_server_default$1],
|
|
1287
|
+
session: [
|
|
1288
|
+
root_server_default$2,
|
|
1289
|
+
root_server_default$1,
|
|
1290
|
+
root_server_default
|
|
1291
|
+
]
|
|
1292
|
+
}),
|
|
1293
|
+
host: async (context) => {
|
|
1294
|
+
const scopeHost = await context.scopeRoot("host", root_server_default$2, context);
|
|
1295
|
+
const contextHost = {
|
|
1296
|
+
...context,
|
|
1297
|
+
root: scopeHost.value
|
|
1298
|
+
};
|
|
1299
|
+
return {
|
|
1300
|
+
...composeRootHooks(scopeHost),
|
|
1301
|
+
get api() {
|
|
1302
|
+
return [at(route_server_default$2, contextHost)];
|
|
1303
|
+
},
|
|
1304
|
+
services: [...scopeHost.services ?? []]
|
|
1305
|
+
};
|
|
1306
|
+
},
|
|
1307
|
+
workspace: async (context) => {
|
|
1308
|
+
const scopeHost = await context.scopeRoot("host", root_server_default$2, context);
|
|
1309
|
+
const contextHost = {
|
|
1310
|
+
...context,
|
|
1311
|
+
root: scopeHost.value
|
|
1312
|
+
};
|
|
1313
|
+
const scopeWorkspace = await context.scopeRoot("workspace", root_server_default$1, contextHost);
|
|
1314
|
+
const contextWorkspace = {
|
|
1315
|
+
...contextHost,
|
|
1316
|
+
root: scopeWorkspace.value
|
|
1317
|
+
};
|
|
1318
|
+
return {
|
|
1319
|
+
...composeRootHooks(scopeHost, scopeWorkspace),
|
|
1320
|
+
get api() {
|
|
1321
|
+
return [at(route_server_default$1, contextWorkspace)];
|
|
1322
|
+
},
|
|
1323
|
+
services: [...scopeHost.services ?? [], ...scopeWorkspace.services ?? []]
|
|
1324
|
+
};
|
|
1325
|
+
},
|
|
1326
|
+
session: async (context) => {
|
|
1327
|
+
const scopeHost = await context.scopeRoot("host", root_server_default$2, context);
|
|
1328
|
+
const contextHost = {
|
|
1329
|
+
...context,
|
|
1330
|
+
root: scopeHost.value
|
|
1331
|
+
};
|
|
1332
|
+
const scopeWorkspace = await context.scopeRoot("workspace", root_server_default$1, contextHost);
|
|
1333
|
+
const contextWorkspace = {
|
|
1334
|
+
...contextHost,
|
|
1335
|
+
root: scopeWorkspace.value
|
|
1336
|
+
};
|
|
1337
|
+
const scopeSession = await context.scopeRoot("session", root_server_default, contextWorkspace);
|
|
1338
|
+
const contextSession = {
|
|
1339
|
+
...contextWorkspace,
|
|
1340
|
+
root: scopeSession.value
|
|
1341
|
+
};
|
|
1342
|
+
return {
|
|
1343
|
+
...composeRootHooks(scopeHost, scopeWorkspace, scopeSession),
|
|
1344
|
+
get api() {
|
|
1345
|
+
return [at(route_server_default, contextSession)];
|
|
1346
|
+
},
|
|
1347
|
+
get commands() {
|
|
1348
|
+
return [via({ name: "calendar" }, at(calendar_server_default, contextSession)), via({ name: "loops" }, at(loops_server_default, contextSession))];
|
|
1349
|
+
},
|
|
1350
|
+
get resources() {
|
|
1351
|
+
return [at(codemode_how_to_calendar_server_default, contextSession), at(help_how_to_calendar_server_default, contextSession)];
|
|
1352
|
+
},
|
|
1353
|
+
get tools() {
|
|
1354
|
+
return [
|
|
1355
|
+
via({ name: "calendar_cancel" }, at(calendar_cancel_server_default, contextSession)),
|
|
1356
|
+
via({ name: "calendar_list" }, at(calendar_list_server_default, contextSession)),
|
|
1357
|
+
via({ name: "calendar_schedule" }, at(calendar_schedule_server_default, contextSession)),
|
|
1358
|
+
via({ name: "loop_list" }, at(loop_list_server_default, contextSession)),
|
|
1359
|
+
via({ name: "loop_start" }, at(loop_start_server_default, contextSession)),
|
|
1360
|
+
via({ name: "loop_stop" }, at(loop_stop_server_default, contextSession))
|
|
1361
|
+
];
|
|
1362
|
+
},
|
|
1363
|
+
services: [
|
|
1364
|
+
...scopeHost.services ?? [],
|
|
1365
|
+
...scopeWorkspace.services ?? [],
|
|
1366
|
+
...scopeSession.services ?? []
|
|
1367
|
+
],
|
|
1368
|
+
get activities() {
|
|
1369
|
+
return [
|
|
1370
|
+
...scopeHost.activities ?? [],
|
|
1371
|
+
...scopeWorkspace.activities ?? [],
|
|
1372
|
+
...scopeSession.activities ?? []
|
|
1373
|
+
];
|
|
1374
|
+
}
|
|
1375
|
+
};
|
|
1376
|
+
}
|
|
1377
|
+
});
|
|
1378
|
+
//#endregion
|
|
1379
|
+
export { serverPlugin as default, serverPlugin };
|