@agimon-ai/po-cloudflare 0.0.2-alpha.20 → 0.0.2-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-DTjnYFAN.js → agent-DZ-OKOHn.js} +1 -1
- package/dist/{apiContracts-DepyzMNr.js → apiContracts-b33nSAAI.js} +4 -80
- package/dist/{approval-Biq3NCWj.js → approval-r3NnI1VC.js} +2 -2
- package/dist/{approvalPrompt-DoHlIPkU.js → approvalPrompt-DWoXxu3S.js} +2 -2
- package/dist/artifactFiles-DLCReI0-.js +1 -0
- package/dist/assets/assets/{CodeEditorView-BU8DeV_G.js → CodeEditorView-XeNS0L9M.js} +2 -2
- package/dist/assets/assets/{abnfDiagram-WEYOIA3C-BkzARjqu.js → abnfDiagram-WEYOIA3C-B6ZW0nkR.js} +2 -2
- package/dist/assets/assets/{architecture-WOLXFQ4H-B_dgnlXa.js → architecture-WOLXFQ4H-bVR64sHO.js} +1 -1
- package/dist/assets/assets/{architectureDiagram-ZHVYKT53-DMGAifk0.js → architectureDiagram-ZHVYKT53-D7tZz3io.js} +2 -2
- package/dist/assets/assets/{blockDiagram-RJAE7QA3-DwTSK4lj.js → blockDiagram-RJAE7QA3-DdwScfiX.js} +2 -2
- package/dist/assets/assets/{c4Diagram-XDPPPE54-IRaOcC_u.js → c4Diagram-XDPPPE54-DgSxZJCV.js} +2 -2
- package/dist/assets/assets/channel-TPcVvp_3.js +2 -0
- package/dist/assets/assets/{chunk-2E7WHVMD-BvS46crW.js → chunk-2E7WHVMD-D5TXC2SM.js} +2 -2
- package/dist/assets/assets/{chunk-4EMNKR2T--n96Xbj0.js → chunk-4EMNKR2T-BWhOSvo1.js} +2 -2
- package/dist/assets/assets/{chunk-55XCU76K-D3h_hFRi.js → chunk-55XCU76K-HkkBzLtZ.js} +2 -2
- package/dist/assets/assets/{chunk-7S6XSTFO-Cj18feJl.js → chunk-7S6XSTFO-CBnjycLU.js} +2 -2
- package/dist/assets/assets/{chunk-AQDTSKZB-DXsT43bg.js → chunk-AQDTSKZB-75lIIq8T.js} +2 -2
- package/dist/assets/assets/{chunk-DSNLSHJZ-Br7dX7yf.js → chunk-DSNLSHJZ-D8PpnXMk.js} +2 -2
- package/dist/assets/assets/{chunk-HAGFOTED-BcozAtPo.js → chunk-HAGFOTED-CXRS2NIN.js} +2 -2
- package/dist/assets/assets/{chunk-HNE4Q36P-B8kgXgRq.js → chunk-HNE4Q36P-BocUqS94.js} +2 -2
- package/dist/assets/assets/{chunk-NQOKRVIF-Dn7UnsqE.js → chunk-NQOKRVIF-CHf_ogYT.js} +2 -2
- package/dist/assets/assets/{chunk-UHW7PFBP-BSJot0vi.js → chunk-UHW7PFBP-DrW1PaIv.js} +2 -2
- package/dist/assets/assets/{chunk-VQ5W62QI-Cpf1EfZK.js → chunk-VQ5W62QI-CLoA7bFm.js} +2 -2
- package/dist/assets/assets/{chunk-WQQL4CDK-Dnc36uZR.js → chunk-WQQL4CDK-BmBsrj9I.js} +2 -2
- package/dist/assets/assets/chunk-XXDRQBXY-iFE4Tl8c.js +2 -0
- package/dist/assets/assets/{chunk-YZO67HFG-BV8_A7x3.js → chunk-YZO67HFG-DShE_cgv.js} +2 -2
- package/dist/assets/assets/{chunk-ZAUX2LTX-C4Ne_31B.js → chunk-ZAUX2LTX-B3oLvSXy.js} +2 -2
- package/dist/assets/assets/{chunk-ZCHMQSOR-Dq9ModsA.js → chunk-ZCHMQSOR-B14vKK7C.js} +2 -2
- package/dist/assets/assets/{classDiagram-v2-4MYWR3UA-1BWEjXP9.js → classDiagram-v2-4MYWR3UA-Da8elIW2.js} +2 -2
- package/dist/assets/assets/{cose-bilkent-JH36ORCC-DREkvC_x.js → cose-bilkent-JH36ORCC-Du4tGtiJ.js} +2 -2
- package/dist/assets/assets/{cynefin-EF2NZ3EQ-CWziP8nx.js → cynefin-EF2NZ3EQ-Cyj6i_WI.js} +1 -1
- package/dist/assets/assets/{cynefinDiagram-WF24UDRP-DOoYmcvz.js → cynefinDiagram-WF24UDRP-DFWXwO7A.js} +2 -2
- package/dist/assets/assets/{dagre-NK4GIZVX-OoAtEico.js → dagre-NK4GIZVX-C1wB_cf-.js} +2 -2
- package/dist/assets/assets/{diagram-CBK3MWTC-B-pl2-iR.js → diagram-CBK3MWTC-MYCOBYl6.js} +2 -2
- package/dist/assets/assets/{diagram-I5XIIV2D-uKzNJSZ2.js → diagram-I5XIIV2D-BFYbKUFf.js} +2 -2
- package/dist/assets/assets/{diagram-ODIL2UCW-CEXY_Tzu.js → diagram-ODIL2UCW-6siqTpv_.js} +2 -2
- package/dist/assets/assets/{diagram-PFBEJUXE-MKlRQo-g.js → diagram-PFBEJUXE-CaBr9CoB.js} +2 -2
- package/dist/assets/assets/{diagram-RJA3I4VV-c2qlCEVs.js → diagram-RJA3I4VV-DAvmuDpc.js} +2 -2
- package/dist/assets/assets/{diagram-TYUNFSNR-DTdqLA6J.js → diagram-TYUNFSNR-CJnhgCpo.js} +2 -2
- package/dist/assets/assets/{dist-qZHwVT1x.js → dist-BQ4W1R18.js} +2 -2
- package/dist/assets/assets/{dist-DvZCwSZ8.js → dist-BnzFckPF.js} +2 -2
- package/dist/assets/assets/{dist-DCKskbBE.js → dist-CFtBpcYL.js} +2 -2
- package/dist/assets/assets/{dist-mQUN8X3n.js → dist-CIQX1z4W.js} +2 -2
- package/dist/assets/assets/{dist-D9lacOpq.js → dist-ChHYoe9_.js} +2 -2
- package/dist/assets/assets/{dist-BzTxJnSR.js → dist-DKxZO8d9.js} +2 -2
- package/dist/assets/assets/{dist-DCc8tQ7G.js → dist-DL6z28wl.js} +2 -2
- package/dist/assets/assets/{dist-4TUOlkyl.js → dist-DNyn1p9Z.js} +2 -2
- package/dist/assets/assets/{dist-DXlts_H5.js → dist-qYlLXIa8.js} +2 -2
- package/dist/assets/assets/{ebnfDiagram-V4P3TTPT-C89wxfCd.js → ebnfDiagram-V4P3TTPT-AUcqDTM3.js} +2 -2
- package/dist/assets/assets/{elk-QONTBCTQ-BMBgLOae.js → elk-QONTBCTQ-aA10PEHJ.js} +2 -2
- package/dist/assets/assets/{erDiagram-KYQIGQAA-Bb04CRa4.js → erDiagram-KYQIGQAA-hhYiqA-x.js} +2 -2
- package/dist/assets/assets/{eventmodeling-K75KTNOO-DSyNf2MV.js → eventmodeling-K75KTNOO-BQZqbRo5.js} +1 -1
- package/dist/assets/assets/flowDiagram-IUGLLWBU-BuyysPYC.js +1 -0
- package/dist/assets/assets/{ganttDiagram-R7GPNTJY-sB7-pF_t.js → ganttDiagram-R7GPNTJY-CLON1GpW.js} +2 -2
- package/dist/assets/assets/{gitGraph-VSP46ZUC-pWPBCmdT.js → gitGraph-VSP46ZUC-DbmvNwR2.js} +1 -1
- package/dist/assets/assets/{gitGraphDiagram-PDYL7XHY-DronDRed.js → gitGraphDiagram-PDYL7XHY-DJVO0WlL.js} +2 -2
- package/dist/assets/assets/index-BiTVAj5E.js +155 -0
- package/dist/assets/assets/{info-OHQRW6UA-B375mT1i.js → info-OHQRW6UA-CAt3Nt3g.js} +1 -1
- package/dist/assets/assets/{infoDiagram-MVDRKAX5-9Hw3wWP7.js → infoDiagram-MVDRKAX5-DTuqH-Zb.js} +2 -2
- package/dist/assets/assets/{ishikawaDiagram-HPEHV2GE-CdPAuupk.js → ishikawaDiagram-HPEHV2GE-BnWvdonT.js} +2 -2
- package/dist/assets/assets/{journeyDiagram-BOSHW7O7-hqmaHM9u.js → journeyDiagram-BOSHW7O7-Btxtcgvl.js} +2 -2
- package/dist/assets/assets/{kanban-definition-FNSA4HC5-BdOHplX4.js → kanban-definition-FNSA4HC5-q7ek9o_H.js} +2 -2
- package/dist/assets/assets/{line-BCSC3Bu2.js → line-B7yLilmC.js} +2 -2
- package/dist/assets/assets/{linear-D5ddQU3r.js → linear-y8aSKEli.js} +2 -2
- package/dist/assets/assets/{mermaid-parser.core-BaSUi_Ph.js → mermaid-parser.core-B4rH50nD.js} +4 -4
- package/dist/assets/assets/{mermaid.core-CUUsU9Ou.js → mermaid.core-DnRVHTjE.js} +5 -5
- package/dist/assets/assets/{mindmap-definition-6OY57UG3-BtVkhvIZ.js → mindmap-definition-6OY57UG3-DT9Afs2v.js} +2 -2
- package/dist/assets/assets/{packet-JDAUHWVQ-CQ3OUDwI.js → packet-JDAUHWVQ-CnqNbu4p.js} +1 -1
- package/dist/assets/assets/{pegDiagram-ECIUJNBX-DDnq-Kn3.js → pegDiagram-ECIUJNBX-cvxdBBFq.js} +2 -2
- package/dist/assets/assets/{pie-XZMESJXO-BvOFTkQB.js → pie-XZMESJXO-etXMNsaL.js} +1 -1
- package/dist/assets/assets/{pieDiagram-GNMPY74T-Bdwhl9jD.js → pieDiagram-GNMPY74T-CBN-R3_j.js} +2 -2
- package/dist/assets/assets/{quadrantDiagram-D57K4MC3-GHKoDEeT.js → quadrantDiagram-D57K4MC3-C5jjVPIH.js} +2 -2
- package/dist/assets/assets/{radar-ABXABTNO-Yk9rKkKW.js → radar-ABXABTNO-CAMd_mrV.js} +1 -1
- package/dist/assets/assets/{railroad-I3PHUGI6-Crr2QEwm.js → railroad-I3PHUGI6-DIs3auoe.js} +1 -1
- package/dist/assets/assets/{railroad-abnf-LNEFI6M7-CLrgwBog.js → railroad-abnf-LNEFI6M7-CJXr1qWy.js} +1 -1
- package/dist/assets/assets/{railroad-ebnf-DWYD2UWJ-zWReI6MC.js → railroad-ebnf-DWYD2UWJ-DfwtykqI.js} +1 -1
- package/dist/assets/assets/{railroad-peg-JR7BVNR7-CnVnlaHi.js → railroad-peg-JR7BVNR7-B8beAhTs.js} +1 -1
- package/dist/assets/assets/{railroadDiagram-Y72NRBL7-MJ68mMla.js → railroadDiagram-Y72NRBL7-BDcQE-EL.js} +2 -2
- package/dist/assets/assets/{requirementDiagram-EQYSW5RA-BYb-mTCH.js → requirementDiagram-EQYSW5RA-KJ4-QjZM.js} +2 -2
- package/dist/assets/assets/{sankeyDiagram-SY24JHO5-DzONJsqQ.js → sankeyDiagram-SY24JHO5-VjIB-Ybr.js} +2 -2
- package/dist/assets/assets/{sequenceDiagram-BLEHNHQU-0vav9YWV.js → sequenceDiagram-BLEHNHQU-MfMuWq1M.js} +2 -2
- package/dist/assets/assets/{src-DZJUnjaM.js → src-BAxIj8GJ.js} +2 -2
- package/dist/assets/assets/{stateDiagram-v2-A6IESKWZ-B0M8THPh.js → stateDiagram-v2-A6IESKWZ-mHwLRRCY.js} +2 -2
- package/dist/assets/assets/{swimlanes-B3ENRKFQ-5YJZCHIB.js → swimlanes-B3ENRKFQ-PArlYoqV.js} +2 -2
- package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-The09-5S.js +9 -0
- package/dist/assets/assets/{timeline-definition-JXYKGLGB-us1LwUHo.js → timeline-definition-JXYKGLGB-B2nKiNFU.js} +2 -2
- package/dist/assets/assets/{treeView-D4JQ5SDB-BSLlcDre.js → treeView-D4JQ5SDB-gU23_RuI.js} +1 -1
- package/dist/assets/assets/{treemap-SAJKECNS-DZ2SwLmk.js → treemap-SAJKECNS-CiqoMvZa.js} +1 -1
- package/dist/assets/assets/{usecaseDiagram-WPOLBNNX-BrmvO_6k.js → usecaseDiagram-WPOLBNNX-DpeoWpMK.js} +2 -2
- package/dist/assets/assets/{vennDiagram-Q3Y3IDCW-FKXSeKp5.js → vennDiagram-Q3Y3IDCW-C31iGKvM.js} +2 -2
- package/dist/assets/assets/{wardley-7MLQ67FV-DZ_vIMp2.js → wardley-7MLQ67FV-CIzHhzNw.js} +1 -1
- package/dist/assets/assets/{wardleyDiagram-IVAIDKWA-CfLYNckm.js → wardleyDiagram-IVAIDKWA-DIIkoezc.js} +2 -2
- package/dist/assets/assets/{webpack-CiS_BB3R.js → webpack-RFseiMZW.js} +2 -2
- package/dist/assets/assets/{xychartDiagram-4URNHDU4-DBucwhQh.js → xychartDiagram-4URNHDU4-QiHL91kC.js} +2 -2
- package/dist/assets/bundle-asset-policy.json +1 -1
- package/dist/assets/index.html +1 -1
- package/dist/assets/plugins/assets/base-CKKRZ7-h.css +2 -0
- package/dist/assets/plugins/assets/browserCaptureWorklet-Droj0fW0-Droj0fW0.js +13 -0
- package/dist/assets/plugins/assets/sileroVadWorker-D894njUe-DjN_BMWf.mjs +110 -0
- package/dist/assets/plugins/assets/silero_vad_v6.2.1-SjbCxFXk-SjbCxFXk.onnx +0 -0
- package/dist/assets/plugins/chunks/po-web-runtime-BJDT6Lbw.js +1 -0
- package/dist/assets/plugins/compositions.json +1 -1
- package/dist/assets/plugins/slots/approval.293d9a00-BXIhaPlQ.js +2 -0
- package/dist/assets/plugins/slots/artifacts.24567664-ZzR0gbvy.js +1 -0
- package/dist/assets/plugins/slots/author.0998a880-DAbA-7rb.js +93 -0
- package/dist/assets/plugins/slots/{autocompact.ec8f713f-B3KTYwW1.js → autocompact.dd97d013-IVq4Z6qm.js} +1 -1
- package/dist/assets/plugins/slots/builtin-tools.36d7400b-CpCLjRRN.js +7 -0
- package/dist/assets/plugins/slots/codemode.8eaee717-VWt9PqsU.js +10 -0
- package/dist/assets/plugins/slots/domain.5e95fc37-5PIUBqDe.js +1 -0
- package/dist/assets/plugins/slots/edit.385c9aa9-DNAjPNG5.js +7 -0
- package/dist/assets/plugins/slots/files.daf34ed8-CQaTz0i1.js +2 -0
- package/dist/assets/plugins/slots/goal.77ec9930-B8EkarBq.js +1 -0
- package/dist/assets/plugins/slots/grep.02052cdc-CIRhO2gY.js +1 -0
- package/dist/assets/plugins/slots/help.ecd4c0f9-naMF9NN1.js +3 -0
- package/dist/assets/plugins/slots/log.a86eb6d0-D5__rAZJ.js +4 -0
- package/dist/assets/plugins/slots/{mcp.ea8b6aa2-D0CkHnIw.js → mcp.974af249-DPNHn9XH.js} +10 -10
- package/dist/assets/plugins/slots/plan.bafb8f68-C5GEpybF.js +3 -0
- package/dist/assets/plugins/slots/{profile.63bc3ae6-BSY3iYfJ.js → profile.48851a1d-yX6tzV3x.js} +1 -1
- package/dist/assets/plugins/slots/prompts.723d7748-B7zpPeoF.js +3 -0
- package/dist/assets/plugins/slots/read.46bf6536-Cw5Z5z5T.js +1 -0
- package/dist/assets/plugins/slots/runner.53e9bd76-CiQR_FPX.js +8 -0
- package/dist/assets/plugins/slots/skill.086701a4-CL6h_F-x.js +4 -0
- package/dist/assets/plugins/slots/vault.ac9935c8-DKERQYg4.js +1 -0
- package/dist/assets/plugins/slots/voice.e85ca7f9-DEgb-U9m.js +1 -0
- package/dist/{atomicJson-DCIsEywH.js → atomicJson-C_7F2zD1.js} +2 -3
- package/dist/{backgroundWork-Bswjs1av.js → backgroundWork-B1mPDYlf.js} +1 -1
- package/dist/{codemode-CgVosRtU.js → codemode-DQFmrosw.js} +1 -1
- package/dist/{contracts-CylyLZC8.js → contracts-DD3f1Lpn.js} +1 -1
- package/dist/exports-B0WMEXCP.js +34 -0
- package/dist/{exports-DERO0cQf.js → exports-D09VsUk-.js} +6 -7
- package/dist/{exports-C_dclnKs.js → exports-nV43ShA7.js} +10 -9
- package/dist/{extensionFile-Ds7RCpnb.js → extensionFile-DNM4xsje.js} +16 -2
- package/dist/{domains-BqChtBLN.js → harnessState-Dwrk3lfv.js} +90 -5
- package/dist/{harnessStore-BectazJQ.js → harnessStore-Z7yDLO45.js} +4 -5
- package/dist/{help-Dpm82qDr.js → help-w6vVEZGL.js} +15 -5
- package/dist/hubChannel-Cm-sxOvU.js +21 -0
- package/dist/{index.edge-b0z7PQ6b.js → index.edge-DyYmurS7.js} +14 -2
- package/dist/{index.edge-B0D_Lgbx.js → index.edge-K0w5auwG.js} +2 -2
- package/dist/{index.edge-BLmsRNW8.js → index.edge-Xa5LLtxz.js} +13 -3
- package/dist/{layeredConfig-pQGjhAks.js → layeredConfig-CUkYUs1f.js} +74 -5
- package/dist/{majorModes-BrL4EtzH.js → majorModes-BB0PXgFn.js} +3 -4
- package/dist/majorModes-C7vtBs4D.js +1 -0
- package/dist/{mcpProjection-pbPBBuvs.js → mcpProjection-BtKzB6oK.js} +2 -2
- package/dist/modeDefinition-C3Zbrw48.js +44 -0
- package/dist/narration-CpRurWLO.js +127 -0
- package/dist/{notification-CINsJWDL.js → notification-kckG3leF.js} +2 -2
- package/dist/{hubChannel-COvmdWGO.js → packageApi-t1oCjNDU.js} +2 -22
- package/dist/{piConfig-BDUpA6w0.js → piConfig-DQzlbPY4.js} +4 -5
- package/dist/piSettings-Cf1QofNe.js +1 -0
- package/dist/platform-BIEiM4TG.js +113 -0
- package/dist/pluginProtocol-BqXXyI4z.js +80 -0
- package/dist/{protocol-B6LbEIe6.js → protocol-DDL8geoS.js} +2 -2
- package/dist/{server-DRcCuj6P.js → server-AbXyhXlY.js} +4 -4
- package/dist/{server-Re1VNk9s.js → server-B6dqQoh2.js} +7 -6
- package/dist/{server-cStfn1Yv.js → server-BIHo9TFu.js} +4 -4
- package/dist/{server-1O3JEYO0.js → server-BJ7DNzCp.js} +7 -7
- package/dist/server-BO-j_GbD.js +15106 -0
- package/dist/{server-Cgym-G0a.js → server-BQzAiMns.js} +11 -11
- package/dist/server-BR7SZtj7.js +3125 -0
- package/dist/{server-DL6UyXfJ.js → server-BT2ORK83.js} +9 -8
- package/dist/{server-CzJjYgVk.js → server-BbSHYRnY.js} +3 -3
- package/dist/{server-DFCXmDed.js → server-BqoKlEGk.js} +8 -8
- package/dist/{server-BXFDsLgm.js → server-Busl0pQI.js} +8 -9
- package/dist/server-CIHM4jqu.js +1116 -0
- package/dist/{server-DhkR6ugd.js → server-CgWSSdvd.js} +6 -7
- package/dist/{server-B8P-UkxF.js → server-Co_UWKrR.js} +5 -5
- package/dist/{server-Bt6Zsqo8.js → server-CuEPb7u-.js} +2 -2
- package/dist/{server-V8W5mcGu.js → server-D40q2Jpx.js} +47 -27
- package/dist/{server-OerXqXJT.js → server-DCyf2Asb.js} +3 -4
- package/dist/{server-CCwwnpH0.js → server-DH7PfLln.js} +5 -5
- package/dist/{server-_0288DYR.js → server-DJ8bc89M.js} +3 -4
- package/dist/{server-GIQIpf33.js → server-DYdp0W9v.js} +7 -7
- package/dist/{server-B2G-c0hg.js → server-DsdPEYGu.js} +5 -5
- package/dist/{server-Dgn4el5K.js → server-DymH4Ucq.js} +4 -5
- package/dist/{server-pY027myK.js → server-IqECnUrb.js} +13 -236
- package/dist/{server-Ci_BGVwd.js → server-KBgW77zh.js} +3 -3
- package/dist/server-RW_9R3R3.js +1522 -0
- package/dist/server-aUit8j6r.js +1028 -0
- package/dist/{server-Ci3ls6LL.js → server-gifRriZK.js} +10 -11
- package/dist/{server-BR9yl54i.js → server-nkUlqnAL.js} +10 -10
- package/dist/server-oxyEbv1a.js +1256 -0
- package/dist/{server-DPTp6GXS.js → server-ub3s16Mc.js} +4 -4
- package/dist/{serverPlugin-OOfjB8tm.js → serverPlugin-CELT6P0Q.js} +12 -3
- package/dist/{sessionConfig-DfwcUKO2.js → sessionConfig-RQGvfm6E.js} +9 -10
- package/dist/{server-CyYesT-G.js → type-ASYnCGVW.js} +9 -1031
- package/dist/{validation-DuOGOKEi.js → validation-BJxVSAwx.js} +8 -3
- package/dist/{value-DyVsxCwZ.js → value-_W31So3B.js} +1 -1
- package/dist/{vaultSettings-BFCRCBM3.js → vaultSettings-Di3n5YIg.js} +1 -1
- package/dist/voiceTools-RMn4HvWo.js +246 -0
- package/dist/web-DCP7ELJj.js +3 -0
- package/dist/worker.js +345 -244
- package/dist/{workflow-BgwWq0nq.js → workflow-B7qx0Vv9.js} +1 -1
- package/package.json +37 -32
- package/wrangler.jsonc +2 -0
- package/dist/assets/assets/channel-BXwM62E-.js +0 -2
- package/dist/assets/assets/chunk-XXDRQBXY-C9Ka5KSI.js +0 -2
- package/dist/assets/assets/flowDiagram-IUGLLWBU-DXuTqLUd.js +0 -1
- package/dist/assets/assets/index-DdAdCxGc.js +0 -155
- package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-aJTRXiIU.js +0 -9
- package/dist/assets/plugins/assets/base-C3j1WCCq.css +0 -2
- package/dist/assets/plugins/chunks/po-web-runtime-Czm_C4SJ.js +0 -1
- package/dist/assets/plugins/slots/approval.3e4ea6e4-CqQk6XG_.js +0 -2
- package/dist/assets/plugins/slots/artifacts.84980c32-DQlO5IFk.js +0 -1
- package/dist/assets/plugins/slots/builtin-tools.16ef5e25-CZRYQVIP.js +0 -7
- package/dist/assets/plugins/slots/codemode.5f359b9c-Bzl_K_vt.js +0 -10
- package/dist/assets/plugins/slots/domain.832848c8-CvnpuKCY.js +0 -1
- package/dist/assets/plugins/slots/edit.7c802139-kaxIknZ-.js +0 -7
- package/dist/assets/plugins/slots/files.364f16c9-wuB8gcQA.js +0 -2
- package/dist/assets/plugins/slots/grep.d8bf9f57-3FnU8p-d.js +0 -1
- package/dist/assets/plugins/slots/log.07fd59a4-C0PXQ0O1.js +0 -4
- package/dist/assets/plugins/slots/prompts.9d9b47cc-xdCkNkoA.js +0 -3
- package/dist/assets/plugins/slots/read.926c024f-qqaxVlEX.js +0 -1
- package/dist/assets/plugins/slots/runner.5393fa6c-DfO2Z9HG.js +0 -8
- package/dist/assets/plugins/slots/skill.56c1cc07-CL_n-l4h.js +0 -4
- package/dist/assets/plugins/slots/vault.587549ba-DbG3F_on.js +0 -1
- package/dist/harnessState-gmzJcPGt.js +0 -88
- package/dist/harnessStore-C0Zwvny8.js +0 -1
- package/dist/majorModes-WXt22_km.js +0 -1
- package/dist/piSettings-tdui0CZI.js +0 -1
- package/dist/platform-yhQXrrM_.js +0 -16
- package/dist/platformFiles-DB3Cw1l_.js +0 -64
- package/dist/web-cN41ySs9.js +0 -3
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as PO_SESSION_ATTENTION_EVENT, u as poApiCallerFrom } from "./hubChannel-COvmdWGO.js";
|
|
1
|
+
import { Hn as BACKGROUND_CONTEXT, Sn as getOrThrow, ar as defineServiceContract, gn as createSerialRunner, hn as poHomeDirectory, vn as nodeHost } from "./serverPlugin-CELT6P0Q.js";
|
|
3
2
|
import { n as infoFor, r as isSealedEnvelope, t as MAX_MESSAGES_PER_KEY } from "./sealedChannel-BeWNTWys.js";
|
|
4
|
-
import {
|
|
5
|
-
import "./
|
|
6
|
-
import
|
|
7
|
-
import "./
|
|
8
|
-
import {
|
|
9
|
-
import { c as defineRoute, n as composeRootInjects, p as defineServerPlugin, s as defineRoot, t as composeRootHooks } from "./extensionFile-Ds7RCpnb.js";
|
|
10
|
-
import { a as PO_BACKGROUND_WORK_SERVICE, i as PO_BACKGROUND_WORK_CHANGED_EVENT, r as BackgroundProviderWorkItemSchema } from "./backgroundWork-Bswjs1av.js";
|
|
3
|
+
import { s as readTextIfExists } from "./platform-BIEiM4TG.js";
|
|
4
|
+
import { n as writePrivateAtomicJsonAsync } from "./atomicJson-C_7F2zD1.js";
|
|
5
|
+
import "./piSettings-Cf1QofNe.js";
|
|
6
|
+
import { n as Check } from "./value-_W31So3B.js";
|
|
7
|
+
import { a as PO_BACKGROUND_WORK_SERVICE, i as PO_BACKGROUND_WORK_CHANGED_EVENT, r as BackgroundProviderWorkItemSchema } from "./backgroundWork-B1mPDYlf.js";
|
|
11
8
|
import { ECDH, createCipheriv, createDecipheriv, createECDH, createHash, createHmac, hkdfSync, randomBytes, timingSafeEqual } from "node:crypto";
|
|
12
9
|
import path from "node:path";
|
|
13
|
-
import { clearInterval as clearInterval$1, setInterval as setInterval$1, setTimeout } from "node:timers";
|
|
14
10
|
//#region ../../core/po-web-security/src/services/nodeSealedChannel/index.ts
|
|
15
11
|
const CURVE = "prime256v1";
|
|
16
12
|
const CIPHER = "aes-256-gcm";
|
|
@@ -488,7 +484,7 @@ function verifyPeerRequest(config, request, body, now = Date.now()) {
|
|
|
488
484
|
const actual = Buffer.from(supplied);
|
|
489
485
|
return actual.byteLength === expected.byteLength && timingSafeEqual(actual, expected) ? peer : void 0;
|
|
490
486
|
}
|
|
491
|
-
function envelopeOf
|
|
487
|
+
function envelopeOf(value) {
|
|
492
488
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
493
489
|
const record = value;
|
|
494
490
|
return validId(record.sourceSessionId) && validId(record.targetSessionId) && typeof record.type === "string" && record.type !== "" ? {
|
|
@@ -499,7 +495,7 @@ function envelopeOf$1(value) {
|
|
|
499
495
|
} : void 0;
|
|
500
496
|
}
|
|
501
497
|
function parseSessionPeerEnvelope(value) {
|
|
502
|
-
return envelopeOf
|
|
498
|
+
return envelopeOf(value);
|
|
503
499
|
}
|
|
504
500
|
/** Adds asynchronous tunnel publication to a host-bound local communication endpoint. */
|
|
505
501
|
function createPeerCommunication(options) {
|
|
@@ -709,109 +705,6 @@ function readSessionGroupBridge(context) {
|
|
|
709
705
|
return context.get(PO_SESSION_GROUP_BRIDGE_SERVICE);
|
|
710
706
|
}
|
|
711
707
|
//#endregion
|
|
712
|
-
//#region ../../foundations/po-session/src/services/sessionGroups/type.ts
|
|
713
|
-
var SessionGroupRevisionError = class extends Error {
|
|
714
|
-
constructor(groupId, expected, actual) {
|
|
715
|
-
super(`Session group '${groupId}' revision conflict: expected ${expected}, current ${actual}.`);
|
|
716
|
-
this.name = "SessionGroupRevisionError";
|
|
717
|
-
}
|
|
718
|
-
};
|
|
719
|
-
//#endregion
|
|
720
|
-
//#region ../../foundations/po-session/src/services/sessionGroups/index.ts
|
|
721
|
-
const ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/u;
|
|
722
|
-
const REFERENCE_PATTERN = /^peer\/[A-Za-z0-9][A-Za-z0-9._-]{0,127}\/[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/u;
|
|
723
|
-
function validateGroupId(value) {
|
|
724
|
-
if (!ID_PATTERN.test(value)) throw new TypeError("Session group IDs must be safe opaque IDs.");
|
|
725
|
-
}
|
|
726
|
-
function validateReference(value) {
|
|
727
|
-
if (!REFERENCE_PATTERN.test(value)) throw new TypeError(`Session group member '${value}' is not a qualified reference.`);
|
|
728
|
-
}
|
|
729
|
-
const SCHEMA$1 = `
|
|
730
|
-
CREATE TABLE IF NOT EXISTS session_groups (
|
|
731
|
-
group_id TEXT PRIMARY KEY,
|
|
732
|
-
owner_authority TEXT NOT NULL,
|
|
733
|
-
revision INTEGER NOT NULL
|
|
734
|
-
);
|
|
735
|
-
CREATE TABLE IF NOT EXISTS session_group_members (
|
|
736
|
-
group_id TEXT NOT NULL REFERENCES session_groups(group_id) ON DELETE CASCADE,
|
|
737
|
-
member_reference TEXT NOT NULL,
|
|
738
|
-
PRIMARY KEY (group_id, member_reference)
|
|
739
|
-
);
|
|
740
|
-
`;
|
|
741
|
-
async function readGroup(database, groupId) {
|
|
742
|
-
const row = await database.get("SELECT * FROM session_groups WHERE group_id = ?", groupId);
|
|
743
|
-
if (!row) return void 0;
|
|
744
|
-
const members = await database.all("SELECT member_reference FROM session_group_members WHERE group_id = ? ORDER BY member_reference", groupId);
|
|
745
|
-
return Object.freeze({
|
|
746
|
-
id: row.group_id,
|
|
747
|
-
ownerAuthority: row.owner_authority,
|
|
748
|
-
revision: Number(row.revision),
|
|
749
|
-
members: Object.freeze(members.map((member) => member.member_reference))
|
|
750
|
-
});
|
|
751
|
-
}
|
|
752
|
-
/** Opens a revisioned SQLite registry for communication-only group membership. */
|
|
753
|
-
async function createSessionGroupStore(options) {
|
|
754
|
-
const { database } = options;
|
|
755
|
-
try {
|
|
756
|
-
await database.exec("PRAGMA foreign_keys = ON");
|
|
757
|
-
} catch {}
|
|
758
|
-
await database.exec(SCHEMA$1);
|
|
759
|
-
const enroll = async (transaction, groupId, members) => {
|
|
760
|
-
for (const member of new Set(members)) {
|
|
761
|
-
validateReference(member);
|
|
762
|
-
if (options.validateEnrollment?.(groupId, member) === false) throw new Error(`Session group enrollment policy rejected '${member}'.`);
|
|
763
|
-
await transaction.run("INSERT OR IGNORE INTO session_group_members (group_id, member_reference) VALUES (?, ?)", groupId, member);
|
|
764
|
-
}
|
|
765
|
-
};
|
|
766
|
-
return {
|
|
767
|
-
async create(groupId, ownerAuthority, members) {
|
|
768
|
-
validateGroupId(groupId);
|
|
769
|
-
if (!ownerAuthority.trim()) throw new TypeError("Session group owner authority is required.");
|
|
770
|
-
return database.transaction(async (transaction) => {
|
|
771
|
-
await transaction.run("INSERT INTO session_groups (group_id, owner_authority, revision) VALUES (?, ?, 1)", groupId, ownerAuthority);
|
|
772
|
-
await enroll(transaction, groupId, members);
|
|
773
|
-
return await readGroup(transaction, groupId);
|
|
774
|
-
});
|
|
775
|
-
},
|
|
776
|
-
async mutate(mutation) {
|
|
777
|
-
return database.transaction(async (transaction) => {
|
|
778
|
-
const current = await readGroup(transaction, mutation.groupId);
|
|
779
|
-
if (!current) throw new Error(`Session group '${mutation.groupId}' does not exist.`);
|
|
780
|
-
if (mutation.authority !== current.ownerAuthority && options.authorizeManagement?.(mutation.authority, current) !== true) throw new Error(`Authority '${mutation.authority}' cannot manage Session group '${mutation.groupId}'.`);
|
|
781
|
-
if (mutation.expectedRevision !== current.revision) throw new SessionGroupRevisionError(mutation.groupId, mutation.expectedRevision, current.revision);
|
|
782
|
-
await enroll(transaction, mutation.groupId, mutation.add ?? []);
|
|
783
|
-
for (const member of new Set(mutation.remove ?? [])) {
|
|
784
|
-
validateReference(member);
|
|
785
|
-
await transaction.run("DELETE FROM session_group_members WHERE group_id = ? AND member_reference = ?", mutation.groupId, member);
|
|
786
|
-
}
|
|
787
|
-
await transaction.run("UPDATE session_groups SET revision = revision + 1 WHERE group_id = ? AND revision = ?", mutation.groupId, current.revision);
|
|
788
|
-
return await readGroup(transaction, mutation.groupId);
|
|
789
|
-
});
|
|
790
|
-
},
|
|
791
|
-
get: (groupId) => readGroup(database, groupId),
|
|
792
|
-
async groupsFor(memberReference) {
|
|
793
|
-
validateReference(memberReference);
|
|
794
|
-
const rows = await database.all(`SELECT g.group_id FROM session_groups g
|
|
795
|
-
INNER JOIN session_group_members m ON m.group_id = g.group_id
|
|
796
|
-
WHERE m.member_reference = ? ORDER BY g.group_id`, memberReference);
|
|
797
|
-
const groups = [];
|
|
798
|
-
for (const row of rows) {
|
|
799
|
-
const group = await readGroup(database, row.group_id);
|
|
800
|
-
if (group) groups.push(group);
|
|
801
|
-
}
|
|
802
|
-
return groups;
|
|
803
|
-
},
|
|
804
|
-
async canMessage(groupId, sourceReference, targetReference) {
|
|
805
|
-
validateReference(sourceReference);
|
|
806
|
-
validateReference(targetReference);
|
|
807
|
-
const row = await database.get(`SELECT COUNT(*) AS count FROM session_group_members
|
|
808
|
-
WHERE group_id = ? AND member_reference IN (?, ?)`, groupId, sourceReference, targetReference);
|
|
809
|
-
return Number(row?.count ?? 0) === (sourceReference === targetReference ? 1 : 2);
|
|
810
|
-
},
|
|
811
|
-
close: () => database.close()
|
|
812
|
-
};
|
|
813
|
-
}
|
|
814
|
-
//#endregion
|
|
815
708
|
//#region ../../foundations/po-session/src/services/sessionPeers/index.ts
|
|
816
709
|
const PO_SESSION_PEERS_SERVICE = "po/session-peers";
|
|
817
710
|
const PO_SESSION_PEERS_CONTRACT = defineServiceContract(PO_SESSION_PEERS_SERVICE, { scope: "global" });
|
|
@@ -912,66 +805,6 @@ function requireSessionPeers(context) {
|
|
|
912
805
|
return service;
|
|
913
806
|
}
|
|
914
807
|
//#endregion
|
|
915
|
-
//#region ../../foundations/po-session/src/extensions/(backend)/root.server.ts
|
|
916
|
-
var root_server_default$1 = defineRoot((plugin) => ({
|
|
917
|
-
value: void 0,
|
|
918
|
-
services: [async (context) => {
|
|
919
|
-
await context.inject([
|
|
920
|
-
PO_FS_SERVICE,
|
|
921
|
-
PO_SQLITE_SERVICE,
|
|
922
|
-
PO_SERVER_SCOPE_SERVICE
|
|
923
|
-
], async (scoped) => {
|
|
924
|
-
const homeDirectory = plugin.host.context.homeDirectory;
|
|
925
|
-
if (!homeDirectory) throw new Error("Host links require an explicit host home directory.");
|
|
926
|
-
const peers = await createSessionPeers({
|
|
927
|
-
fs: requirePoFs(scoped),
|
|
928
|
-
homeDirectory
|
|
929
|
-
});
|
|
930
|
-
await peers.identity();
|
|
931
|
-
const directory = path.join(poHomeDirectory(homeDirectory), "session");
|
|
932
|
-
await ensurePrivateDirectory(requirePoFs(scoped), directory, BACKGROUND_CONTEXT);
|
|
933
|
-
const database = await requirePoSqlite(scoped).open(path.join(directory, "groups.sqlite"), BACKGROUND_CONTEXT);
|
|
934
|
-
const groups = await createSessionGroupStore({ database });
|
|
935
|
-
await database.run("DELETE FROM session_group_members WHERE group_id IN (SELECT group_id FROM session_groups WHERE owner_authority = 'session-group-bridge')");
|
|
936
|
-
await database.run("DELETE FROM session_groups WHERE owner_authority = 'session-group-bridge'");
|
|
937
|
-
const bridge = createSessionGroupBridge({
|
|
938
|
-
groups,
|
|
939
|
-
peers,
|
|
940
|
-
onError: (error) => plugin.host.context.onNotice(`Group bridge failed: ${String(error)}`),
|
|
941
|
-
send: async (hostId, advert) => {
|
|
942
|
-
const config = peers.current();
|
|
943
|
-
const peer = config?.peers.find((entry) => entry.hostId === hostId);
|
|
944
|
-
if (!config || !peer) return;
|
|
945
|
-
await authenticatedPeerPost({
|
|
946
|
-
config,
|
|
947
|
-
peer,
|
|
948
|
-
path: "/api/plugins/session-peer/control",
|
|
949
|
-
value: {
|
|
950
|
-
type: "groups",
|
|
951
|
-
groups: advert
|
|
952
|
-
}
|
|
953
|
-
});
|
|
954
|
-
}
|
|
955
|
-
});
|
|
956
|
-
const scope = requirePoServerScope(scoped);
|
|
957
|
-
const releasePeers = plugin.host.scope === "global" ? await scope.provide(PO_SESSION_PEERS_CONTRACT, peers) : scoped.provide(PO_SESSION_PEERS_SERVICE, peers);
|
|
958
|
-
let releaseBridge;
|
|
959
|
-
try {
|
|
960
|
-
releaseBridge = plugin.host.scope === "global" ? await scope.provide(PO_SESSION_GROUP_BRIDGE_CONTRACT, bridge) : scoped.provide(PO_SESSION_GROUP_BRIDGE_SERVICE, bridge);
|
|
961
|
-
} catch (error) {
|
|
962
|
-
await Promise.resolve(releasePeers());
|
|
963
|
-
await bridge.close();
|
|
964
|
-
throw error;
|
|
965
|
-
}
|
|
966
|
-
return async () => {
|
|
967
|
-
await releaseBridge();
|
|
968
|
-
await Promise.resolve(releasePeers());
|
|
969
|
-
await bridge.close();
|
|
970
|
-
};
|
|
971
|
-
});
|
|
972
|
-
}]
|
|
973
|
-
}));
|
|
974
|
-
//#endregion
|
|
975
808
|
//#region ../../foundations/po-session/src/services/backgroundWorkService/index.ts
|
|
976
809
|
/** Creates the generation-bound, pull-based coordinator shared by session extensions. */
|
|
977
810
|
function createBackgroundWorkService(ctx) {
|
|
@@ -1045,365 +878,6 @@ function provideBackgroundWorkService(context) {
|
|
|
1045
878
|
context.provide(PO_BACKGROUND_WORK_SERVICE, createBackgroundWorkService(context));
|
|
1046
879
|
}
|
|
1047
880
|
//#endregion
|
|
1048
|
-
//#region ../../foundations/po-session/src/services/peerInbox/index.ts
|
|
1049
|
-
const inboxes = /* @__PURE__ */ new Map();
|
|
1050
|
-
/**
|
|
1051
|
-
* Registers one live session-owned peer inbox. This registry is reachable only by the Session route.
|
|
1052
|
-
* The newest registration wins: a Durable Object evicted without disposal leaves its entry in the
|
|
1053
|
-
* isolate's module state, and the restarted session must replace it. The hub still rejects two live
|
|
1054
|
-
* sessions with one id, and an older unregister cannot remove a newer inbox.
|
|
1055
|
-
*/
|
|
1056
|
-
function registerSessionPeerInbox(sessionId, inbox) {
|
|
1057
|
-
inboxes.set(sessionId, inbox);
|
|
1058
|
-
return () => {
|
|
1059
|
-
if (inboxes.get(sessionId) === inbox) inboxes.delete(sessionId);
|
|
1060
|
-
};
|
|
1061
|
-
}
|
|
1062
|
-
async function deliverSessionPeerEnvelope(targetSessionId, sourceKey, type, payload) {
|
|
1063
|
-
return inboxes.get(targetSessionId)?.(sourceKey, type, payload);
|
|
1064
|
-
}
|
|
1065
|
-
//#endregion
|
|
1066
|
-
//#region ../../foundations/po-session/src/services/sessionDelivery/type.ts
|
|
1067
|
-
const PO_SESSION_DELIVERY_SERVICE = "po/session-delivery";
|
|
1068
|
-
//#endregion
|
|
1069
|
-
//#region ../../foundations/po-session/src/services/sessionDelivery/index.ts
|
|
1070
|
-
const DELIVERY_EVENT = "po/session-delivery/envelope";
|
|
1071
|
-
const ACK_EVENT = "po/session-delivery/ack";
|
|
1072
|
-
const DEFAULT_DELIVERY = "prompt";
|
|
1073
|
-
const INBOX_STATES = /* @__PURE__ */ new Set([
|
|
1074
|
-
"accepted",
|
|
1075
|
-
"admitting",
|
|
1076
|
-
"admitted",
|
|
1077
|
-
"recovery_required",
|
|
1078
|
-
"revoked"
|
|
1079
|
-
]);
|
|
1080
|
-
function isRecord(value) {
|
|
1081
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1082
|
-
}
|
|
1083
|
-
function isMode(value) {
|
|
1084
|
-
return value === "prompt" || value === "steer" || value === "followUp";
|
|
1085
|
-
}
|
|
1086
|
-
function metadataOf(value) {
|
|
1087
|
-
if (!isRecord(value)) return void 0;
|
|
1088
|
-
const metadata = {};
|
|
1089
|
-
for (const [key, item] of Object.entries(value)) {
|
|
1090
|
-
if (typeof item !== "string") return void 0;
|
|
1091
|
-
metadata[key] = item;
|
|
1092
|
-
}
|
|
1093
|
-
return metadata;
|
|
1094
|
-
}
|
|
1095
|
-
function envelopeOf(value) {
|
|
1096
|
-
if (!isRecord(value)) return void 0;
|
|
1097
|
-
const metadata = metadataOf(value.metadata);
|
|
1098
|
-
if (typeof value.deliveryId !== "string" || !value.deliveryId || typeof value.kind !== "string" || !value.kind || typeof value.prompt !== "string" || !isMode(value.delivery) || metadata === void 0) return;
|
|
1099
|
-
return {
|
|
1100
|
-
deliveryId: value.deliveryId,
|
|
1101
|
-
kind: value.kind,
|
|
1102
|
-
prompt: value.prompt,
|
|
1103
|
-
delivery: value.delivery,
|
|
1104
|
-
metadata
|
|
1105
|
-
};
|
|
1106
|
-
}
|
|
1107
|
-
function ackOf(value) {
|
|
1108
|
-
if (!isRecord(value)) return void 0;
|
|
1109
|
-
if (typeof value.deliveryId !== "string" || typeof value.state !== "string" || !INBOX_STATES.has(value.state)) return;
|
|
1110
|
-
return value;
|
|
1111
|
-
}
|
|
1112
|
-
function normalizedMetadata(metadata) {
|
|
1113
|
-
const normalized = {};
|
|
1114
|
-
for (const [key, value] of Object.entries(metadata ?? {})) if (value !== void 0) normalized[key] = value;
|
|
1115
|
-
return normalized;
|
|
1116
|
-
}
|
|
1117
|
-
function matchesMetadata(entry, query) {
|
|
1118
|
-
return Object.entries(query ?? {}).every(([key, value]) => value === void 0 || entry[key] === value);
|
|
1119
|
-
}
|
|
1120
|
-
function sameMetadata(left, right) {
|
|
1121
|
-
return matchesMetadata(left, right) && matchesMetadata(right, left);
|
|
1122
|
-
}
|
|
1123
|
-
const SCHEMA = `
|
|
1124
|
-
CREATE TABLE IF NOT EXISTS session_delivery_outbox (
|
|
1125
|
-
delivery_id TEXT PRIMARY KEY,
|
|
1126
|
-
recipient_key TEXT NOT NULL,
|
|
1127
|
-
kind TEXT NOT NULL,
|
|
1128
|
-
prompt TEXT NOT NULL,
|
|
1129
|
-
delivery_mode TEXT NOT NULL,
|
|
1130
|
-
metadata_json TEXT NOT NULL,
|
|
1131
|
-
state TEXT NOT NULL,
|
|
1132
|
-
recipient_state TEXT,
|
|
1133
|
-
created_at INTEGER NOT NULL,
|
|
1134
|
-
acknowledged_at INTEGER
|
|
1135
|
-
);
|
|
1136
|
-
CREATE TABLE IF NOT EXISTS session_delivery_inbox (
|
|
1137
|
-
delivery_id TEXT PRIMARY KEY,
|
|
1138
|
-
sender_key TEXT NOT NULL,
|
|
1139
|
-
recipient_key TEXT NOT NULL,
|
|
1140
|
-
kind TEXT NOT NULL,
|
|
1141
|
-
prompt TEXT NOT NULL,
|
|
1142
|
-
delivery_mode TEXT NOT NULL,
|
|
1143
|
-
metadata_json TEXT NOT NULL,
|
|
1144
|
-
state TEXT NOT NULL,
|
|
1145
|
-
created_at INTEGER NOT NULL,
|
|
1146
|
-
updated_at INTEGER NOT NULL,
|
|
1147
|
-
consumed_at INTEGER
|
|
1148
|
-
);
|
|
1149
|
-
`;
|
|
1150
|
-
const SET_INBOX_STATE = "UPDATE session_delivery_inbox SET state = ?, updated_at = ? WHERE delivery_id = ?";
|
|
1151
|
-
const UNSETTLED_OUTBOX = "state != 'revoked' AND (recipient_state IS NULL OR recipient_state NOT IN ('admitted', 'recovery_required', 'revoked'))";
|
|
1152
|
-
/** Opens and starts one durable delivery endpoint. */
|
|
1153
|
-
async function createSessionDeliveryService(options) {
|
|
1154
|
-
if (!options.recipientKey.trim() || options.recipientKey !== options.recipientKey.trim()) throw new TypeError("Session delivery requires a trimmed, non-empty recipient key.");
|
|
1155
|
-
const database = options.database;
|
|
1156
|
-
try {
|
|
1157
|
-
await database.exec(SCHEMA);
|
|
1158
|
-
await database.run("UPDATE session_delivery_inbox SET state = 'accepted', updated_at = ? WHERE state = 'admitting'", Date.now());
|
|
1159
|
-
} catch (error) {
|
|
1160
|
-
await database.close();
|
|
1161
|
-
throw error;
|
|
1162
|
-
}
|
|
1163
|
-
let closed = false;
|
|
1164
|
-
const scheduled = /* @__PURE__ */ new Set();
|
|
1165
|
-
let admissionQueue = Promise.resolve();
|
|
1166
|
-
const pending = /* @__PURE__ */ new Set();
|
|
1167
|
-
/** Tracks fire-and-forget work so close() can wait for it before the database closes. */
|
|
1168
|
-
const track = (work) => {
|
|
1169
|
-
const settled = work.catch(() => void 0);
|
|
1170
|
-
pending.add(settled);
|
|
1171
|
-
settled.finally(() => pending.delete(settled));
|
|
1172
|
-
};
|
|
1173
|
-
const authorized = async (peerKey, metadata) => await options.authorizePeer(peerKey, metadata) === true;
|
|
1174
|
-
const publishAck = (deliveryId, senderKey, state) => {
|
|
1175
|
-
options.communication.publish(senderKey, ACK_EVENT, {
|
|
1176
|
-
deliveryId,
|
|
1177
|
-
state
|
|
1178
|
-
});
|
|
1179
|
-
};
|
|
1180
|
-
const readInboxRow = (deliveryId) => database.get("SELECT * FROM session_delivery_inbox WHERE delivery_id = ?", deliveryId);
|
|
1181
|
-
const scheduleAdmission = (deliveryId) => {
|
|
1182
|
-
if (closed || scheduled.has(deliveryId)) return;
|
|
1183
|
-
scheduled.add(deliveryId);
|
|
1184
|
-
admissionQueue = admissionQueue.then(async () => {
|
|
1185
|
-
try {
|
|
1186
|
-
if (closed) return;
|
|
1187
|
-
const row = await database.get("UPDATE session_delivery_inbox SET state = 'admitting', updated_at = ? WHERE delivery_id = ? AND state = 'accepted' RETURNING *", Date.now(), deliveryId);
|
|
1188
|
-
if (!row) return;
|
|
1189
|
-
publishAck(deliveryId, row.sender_key, "admitting");
|
|
1190
|
-
try {
|
|
1191
|
-
if (!await authorized(row.sender_key, JSON.parse(row.metadata_json))) {
|
|
1192
|
-
await database.run(SET_INBOX_STATE, "revoked", Date.now(), deliveryId);
|
|
1193
|
-
publishAck(deliveryId, row.sender_key, "revoked");
|
|
1194
|
-
return;
|
|
1195
|
-
}
|
|
1196
|
-
await options.admitPrompt(row.prompt, row.delivery_mode, deliveryId, JSON.parse(row.metadata_json));
|
|
1197
|
-
} catch {
|
|
1198
|
-
await database.run(SET_INBOX_STATE, "recovery_required", Date.now(), deliveryId);
|
|
1199
|
-
publishAck(deliveryId, row.sender_key, "recovery_required");
|
|
1200
|
-
return;
|
|
1201
|
-
}
|
|
1202
|
-
await database.run(SET_INBOX_STATE, "admitted", Date.now(), deliveryId);
|
|
1203
|
-
publishAck(deliveryId, row.sender_key, "admitted");
|
|
1204
|
-
} finally {
|
|
1205
|
-
scheduled.delete(deliveryId);
|
|
1206
|
-
}
|
|
1207
|
-
}).catch(async () => {
|
|
1208
|
-
scheduled.delete(deliveryId);
|
|
1209
|
-
try {
|
|
1210
|
-
const row = await readInboxRow(deliveryId);
|
|
1211
|
-
if (row?.state !== "admitting") return;
|
|
1212
|
-
await database.run(SET_INBOX_STATE, "recovery_required", Date.now(), deliveryId);
|
|
1213
|
-
try {
|
|
1214
|
-
publishAck(deliveryId, row.sender_key, "recovery_required");
|
|
1215
|
-
} catch {}
|
|
1216
|
-
} catch {}
|
|
1217
|
-
});
|
|
1218
|
-
};
|
|
1219
|
-
const receiveEnvelope = async (senderKey, value) => {
|
|
1220
|
-
if (closed) return void 0;
|
|
1221
|
-
const envelope = envelopeOf(value);
|
|
1222
|
-
if (!envelope || !await authorized(senderKey, envelope.metadata) || closed) return void 0;
|
|
1223
|
-
await database.run(`INSERT OR IGNORE INTO session_delivery_inbox
|
|
1224
|
-
(delivery_id, sender_key, recipient_key, kind, prompt, delivery_mode, metadata_json, state, created_at, updated_at)
|
|
1225
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, 'accepted', ?, ?)`, envelope.deliveryId, senderKey, options.recipientKey, envelope.kind, envelope.prompt, envelope.delivery, JSON.stringify(envelope.metadata), Date.now(), Date.now());
|
|
1226
|
-
const current = await readInboxRow(envelope.deliveryId);
|
|
1227
|
-
if (!current) return void 0;
|
|
1228
|
-
if (!(current.sender_key === senderKey && current.recipient_key === options.recipientKey && current.kind === envelope.kind && current.prompt === envelope.prompt && current.delivery_mode === envelope.delivery && sameMetadata(JSON.parse(current.metadata_json), envelope.metadata))) return void 0;
|
|
1229
|
-
publishAck(envelope.deliveryId, current.sender_key, current.state);
|
|
1230
|
-
if (current.state === "accepted") scheduleAdmission(envelope.deliveryId);
|
|
1231
|
-
return current.state;
|
|
1232
|
-
};
|
|
1233
|
-
const receiveAck = async (recipientKey, value) => {
|
|
1234
|
-
const ack = ackOf(value);
|
|
1235
|
-
if (closed || !ack) return;
|
|
1236
|
-
await database.run(`UPDATE session_delivery_outbox
|
|
1237
|
-
SET state = CASE WHEN ? = 'revoked' THEN 'revoked' ELSE 'acknowledged' END, recipient_state = ?, acknowledged_at = ?
|
|
1238
|
-
WHERE delivery_id = ? AND recipient_key = ? AND state != 'revoked'
|
|
1239
|
-
AND (recipient_state IS NULL
|
|
1240
|
-
OR (recipient_state = 'accepted' AND ? != 'accepted')
|
|
1241
|
-
OR (recipient_state = 'admitting' AND ? IN ('admitted', 'recovery_required', 'revoked')))`, ack.state, ack.state, Date.now(), ack.deliveryId, recipientKey, ack.state, ack.state);
|
|
1242
|
-
};
|
|
1243
|
-
const publishOutbox = async (deliveryId) => {
|
|
1244
|
-
if (closed) return;
|
|
1245
|
-
const row = await database.get(`SELECT * FROM session_delivery_outbox WHERE delivery_id = ? AND ${UNSETTLED_OUTBOX}`, deliveryId);
|
|
1246
|
-
if (!row) return;
|
|
1247
|
-
const metadata = JSON.parse(row.metadata_json);
|
|
1248
|
-
if (!await authorized(row.recipient_key, metadata)) {
|
|
1249
|
-
await database.run("UPDATE session_delivery_outbox SET state = 'revoked', recipient_state = 'revoked' WHERE delivery_id = ? AND " + UNSETTLED_OUTBOX, deliveryId);
|
|
1250
|
-
return;
|
|
1251
|
-
}
|
|
1252
|
-
if (closed) return;
|
|
1253
|
-
options.communication.publish(row.recipient_key, DELIVERY_EVENT, {
|
|
1254
|
-
deliveryId: row.delivery_id,
|
|
1255
|
-
kind: row.kind,
|
|
1256
|
-
prompt: row.prompt,
|
|
1257
|
-
delivery: row.delivery_mode,
|
|
1258
|
-
metadata
|
|
1259
|
-
});
|
|
1260
|
-
};
|
|
1261
|
-
const publishQueued = async (recipientKey) => {
|
|
1262
|
-
if (closed) return;
|
|
1263
|
-
for (const row of await database.all(`SELECT delivery_id FROM session_delivery_outbox WHERE recipient_key = ? AND ${UNSETTLED_OUTBOX}`, recipientKey)) await publishOutbox(row.delivery_id);
|
|
1264
|
-
};
|
|
1265
|
-
let retryTimer;
|
|
1266
|
-
const startRetry = () => {
|
|
1267
|
-
if (closed || retryTimer) return;
|
|
1268
|
-
retryTimer = setInterval$1(() => track(publishAllQueued()), 1e3);
|
|
1269
|
-
retryTimer.unref?.();
|
|
1270
|
-
};
|
|
1271
|
-
const stopRetry = () => {
|
|
1272
|
-
if (retryTimer) clearInterval$1(retryTimer);
|
|
1273
|
-
retryTimer = void 0;
|
|
1274
|
-
};
|
|
1275
|
-
let retrying;
|
|
1276
|
-
const publishAllQueued = () => {
|
|
1277
|
-
retrying ??= (async () => {
|
|
1278
|
-
try {
|
|
1279
|
-
if (closed) return;
|
|
1280
|
-
const rows = await database.all(`SELECT delivery_id FROM session_delivery_outbox WHERE ${UNSETTLED_OUTBOX}`);
|
|
1281
|
-
if (rows.length === 0) stopRetry();
|
|
1282
|
-
else startRetry();
|
|
1283
|
-
for (const row of rows) await publishOutbox(row.delivery_id);
|
|
1284
|
-
} finally {
|
|
1285
|
-
retrying = void 0;
|
|
1286
|
-
}
|
|
1287
|
-
})();
|
|
1288
|
-
return retrying;
|
|
1289
|
-
};
|
|
1290
|
-
const releaseEnvelope = options.communication.subscribe(DELIVERY_EVENT, (senderKey, payload) => {
|
|
1291
|
-
track(receiveEnvelope(senderKey, payload));
|
|
1292
|
-
});
|
|
1293
|
-
const releaseAck = options.communication.subscribe(ACK_EVENT, (recipientKey, payload) => {
|
|
1294
|
-
track(receiveAck(recipientKey, payload));
|
|
1295
|
-
});
|
|
1296
|
-
const releaseReady = options.communication.onPeerReady((recipientKey) => {
|
|
1297
|
-
track(publishQueued(recipientKey));
|
|
1298
|
-
});
|
|
1299
|
-
for (const row of await database.all("SELECT delivery_id, sender_key FROM session_delivery_inbox WHERE state = 'recovery_required'")) publishAck(row.delivery_id, row.sender_key, "recovery_required");
|
|
1300
|
-
for (const row of await database.all("SELECT delivery_id FROM session_delivery_inbox WHERE state = 'accepted'")) scheduleAdmission(row.delivery_id);
|
|
1301
|
-
track(publishAllQueued());
|
|
1302
|
-
return Object.freeze({
|
|
1303
|
-
recipientKey: options.recipientKey,
|
|
1304
|
-
async deliver(request) {
|
|
1305
|
-
if (closed) throw new Error("Session delivery service is closed.");
|
|
1306
|
-
const deliveryId = request.deliveryId ?? crypto.randomUUID();
|
|
1307
|
-
const mode = request.delivery ?? DEFAULT_DELIVERY;
|
|
1308
|
-
if (!deliveryId.trim() || !request.recipientKey.trim() || !request.kind.trim() || !isMode(mode)) throw new TypeError("Delivery id, recipient key, kind, and mode must be valid.");
|
|
1309
|
-
if (!await authorized(request.recipientKey, request.metadata)) throw new Error(`Session '${request.recipientKey}' is not an authorized communication peer.`);
|
|
1310
|
-
if (closed) throw new Error("Session delivery service is closed.");
|
|
1311
|
-
const metadata = normalizedMetadata(request.metadata);
|
|
1312
|
-
await database.run(`INSERT OR IGNORE INTO session_delivery_outbox
|
|
1313
|
-
(delivery_id, recipient_key, kind, prompt, delivery_mode, metadata_json, state, created_at)
|
|
1314
|
-
VALUES (?, ?, ?, ?, ?, ?, 'queued', ?)`, deliveryId, request.recipientKey, request.kind, request.prompt, mode, JSON.stringify(metadata), Date.now());
|
|
1315
|
-
const current = await database.get("SELECT * FROM session_delivery_outbox WHERE delivery_id = ?", deliveryId);
|
|
1316
|
-
if (!current || current.recipient_key !== request.recipientKey || current.kind !== request.kind || current.prompt !== request.prompt || current.delivery_mode !== mode || !sameMetadata(JSON.parse(current.metadata_json), metadata)) throw new TypeError(`Delivery id '${deliveryId}' is already bound to another envelope.`);
|
|
1317
|
-
startRetry();
|
|
1318
|
-
await publishOutbox(deliveryId);
|
|
1319
|
-
return { deliveryId };
|
|
1320
|
-
},
|
|
1321
|
-
async waitForAdmission(deliveryId, timeoutMs = 5e3) {
|
|
1322
|
-
const deadline = Date.now() + Math.max(0, timeoutMs);
|
|
1323
|
-
let state;
|
|
1324
|
-
do {
|
|
1325
|
-
state = (await database.get("SELECT recipient_state FROM session_delivery_outbox WHERE delivery_id = ?", deliveryId))?.recipient_state ?? void 0;
|
|
1326
|
-
if (state === "admitted" || state === "recovery_required" || state === "revoked") return state;
|
|
1327
|
-
if (Date.now() >= deadline) return state;
|
|
1328
|
-
await new Promise((resolve) => setTimeout(resolve, Math.min(10, deadline - Date.now())));
|
|
1329
|
-
} while (!closed);
|
|
1330
|
-
return state;
|
|
1331
|
-
},
|
|
1332
|
-
async receive(senderKey, kind, payload) {
|
|
1333
|
-
if (kind === DELIVERY_EVENT) return receiveEnvelope(senderKey, payload);
|
|
1334
|
-
if (kind === ACK_EVENT) {
|
|
1335
|
-
await receiveAck(senderKey, payload);
|
|
1336
|
-
return "accepted";
|
|
1337
|
-
}
|
|
1338
|
-
},
|
|
1339
|
-
async inbox(query = {}) {
|
|
1340
|
-
return (await database.all("SELECT * FROM session_delivery_inbox ORDER BY created_at, delivery_id")).map((row) => {
|
|
1341
|
-
const metadata = JSON.parse(row.metadata_json);
|
|
1342
|
-
return {
|
|
1343
|
-
deliveryId: row.delivery_id,
|
|
1344
|
-
senderKey: row.sender_key,
|
|
1345
|
-
recipientKey: row.recipient_key,
|
|
1346
|
-
kind: row.kind,
|
|
1347
|
-
prompt: row.prompt,
|
|
1348
|
-
delivery: row.delivery_mode,
|
|
1349
|
-
metadata,
|
|
1350
|
-
state: row.state,
|
|
1351
|
-
consumed: row.consumed_at !== null
|
|
1352
|
-
};
|
|
1353
|
-
}).filter((entry) => (query.kind === void 0 || entry.kind === query.kind) && (query.state === void 0 || entry.state === query.state) && (query.consumed === void 0 || entry.consumed === query.consumed) && matchesMetadata(entry.metadata, query.metadata));
|
|
1354
|
-
},
|
|
1355
|
-
async consume(deliveryId) {
|
|
1356
|
-
return await database.get("UPDATE session_delivery_inbox SET consumed_at = ? WHERE delivery_id = ? AND state IN ('admitted', 'recovery_required') AND consumed_at IS NULL RETURNING delivery_id", Date.now(), deliveryId) !== void 0;
|
|
1357
|
-
},
|
|
1358
|
-
async outbox(deliveryId) {
|
|
1359
|
-
const row = await database.get("SELECT delivery_id, recipient_key, kind, metadata_json, state, recipient_state FROM session_delivery_outbox WHERE delivery_id = ?", deliveryId);
|
|
1360
|
-
if (!row) return void 0;
|
|
1361
|
-
return {
|
|
1362
|
-
deliveryId: row.delivery_id,
|
|
1363
|
-
recipientKey: row.recipient_key,
|
|
1364
|
-
kind: row.kind,
|
|
1365
|
-
metadata: JSON.parse(row.metadata_json),
|
|
1366
|
-
state: row.state,
|
|
1367
|
-
...row.recipient_state === null ? {} : { recipientState: row.recipient_state }
|
|
1368
|
-
};
|
|
1369
|
-
},
|
|
1370
|
-
reauthorize: publishAllQueued,
|
|
1371
|
-
async close() {
|
|
1372
|
-
if (closed) return;
|
|
1373
|
-
closed = true;
|
|
1374
|
-
stopRetry();
|
|
1375
|
-
releaseEnvelope();
|
|
1376
|
-
releaseAck();
|
|
1377
|
-
releaseReady();
|
|
1378
|
-
try {
|
|
1379
|
-
await admissionQueue;
|
|
1380
|
-
await Promise.all(pending);
|
|
1381
|
-
} finally {
|
|
1382
|
-
await database.close();
|
|
1383
|
-
}
|
|
1384
|
-
}
|
|
1385
|
-
});
|
|
1386
|
-
}
|
|
1387
|
-
/**
|
|
1388
|
-
* Installs a provider-owned endpoint in the current Cordis context.
|
|
1389
|
-
*
|
|
1390
|
-
* Returns the instance because a provider cannot read its own service back out:
|
|
1391
|
-
* `ctx.get` is strict and hides an implementation while its providing fiber is
|
|
1392
|
-
* LOADING, which is the whole of that fiber's own callback.
|
|
1393
|
-
*/
|
|
1394
|
-
async function provideSessionDeliveryService(context, options) {
|
|
1395
|
-
const service = await createSessionDeliveryService(options);
|
|
1396
|
-
const unprovide = context.provide(PO_SESSION_DELIVERY_SERVICE, service);
|
|
1397
|
-
context.effect(() => () => service.close(), "session delivery database");
|
|
1398
|
-
return {
|
|
1399
|
-
service,
|
|
1400
|
-
close: async () => {
|
|
1401
|
-
unprovide();
|
|
1402
|
-
await service.close();
|
|
1403
|
-
}
|
|
1404
|
-
};
|
|
1405
|
-
}
|
|
1406
|
-
//#endregion
|
|
1407
881
|
//#region ../../foundations/po-session/src/services/sessionDirectory/index.ts
|
|
1408
882
|
const UNKNOWN_FACTS = Object.freeze({
|
|
1409
883
|
reachability: "unknown",
|
|
@@ -1528,250 +1002,6 @@ function createSessionDirectory(options) {
|
|
|
1528
1002
|
};
|
|
1529
1003
|
}
|
|
1530
1004
|
//#endregion
|
|
1531
|
-
//#region ../../foundations/po-session/src/services/sessionIntercom/type.ts
|
|
1532
|
-
const PO_SESSION_INTERCOM_SERVICE = "po/session-intercom";
|
|
1533
|
-
//#endregion
|
|
1534
|
-
//#region ../../foundations/po-session/src/services/sessionIntercom/index.ts
|
|
1535
|
-
const MESSAGE_KIND = "session-message";
|
|
1536
|
-
const REPORT_KIND = "session-report";
|
|
1537
|
-
async function metadataFor(options, request, reportStatus) {
|
|
1538
|
-
const group = await options.groups.get(request.groupId);
|
|
1539
|
-
if (!group || !await options.groups.canMessage(request.groupId, options.selfReference, request.targetReference)) throw new Error(`Session group '${request.groupId}' does not authorize this message.`);
|
|
1540
|
-
return {
|
|
1541
|
-
sourceReference: options.selfReference,
|
|
1542
|
-
targetReference: request.targetReference,
|
|
1543
|
-
groupId: request.groupId,
|
|
1544
|
-
groupRevision: String(group.revision),
|
|
1545
|
-
...request.correlationId === void 0 ? {} : { correlationId: request.correlationId },
|
|
1546
|
-
...reportStatus === void 0 ? {} : { reportStatus }
|
|
1547
|
-
};
|
|
1548
|
-
}
|
|
1549
|
-
/** The group IDs, among those given, whose current membership includes this session. */
|
|
1550
|
-
async function groupMembership(options, groupIds) {
|
|
1551
|
-
const memberOf = /* @__PURE__ */ new Set();
|
|
1552
|
-
for (const groupId of new Set(groupIds)) {
|
|
1553
|
-
if (groupId === void 0) continue;
|
|
1554
|
-
if ((await options.groups.get(groupId))?.members.includes(options.selfReference) === true) memberOf.add(groupId);
|
|
1555
|
-
}
|
|
1556
|
-
return memberOf;
|
|
1557
|
-
}
|
|
1558
|
-
/** Agent-facing intercom operations. A composition may acquire this service without gaining session controls. */
|
|
1559
|
-
function createSessionIntercom(options) {
|
|
1560
|
-
const deliver = async (request, kind, status) => {
|
|
1561
|
-
const recipientKey = await options.directory.resolveDeliveryTarget(options.selfReference, request.targetReference);
|
|
1562
|
-
if (!recipientKey) throw new Error(`Session '${request.targetReference}' is not discoverable.`);
|
|
1563
|
-
const metadata = await metadataFor(options, request, status);
|
|
1564
|
-
return options.delivery.deliver({
|
|
1565
|
-
...request.deliveryId === void 0 ? {} : { deliveryId: request.deliveryId },
|
|
1566
|
-
recipientKey,
|
|
1567
|
-
kind,
|
|
1568
|
-
prompt: `[Session ${status === void 0 ? "message" : `report: ${status}`} from ${options.selfReference}] ${request.text}`,
|
|
1569
|
-
metadata
|
|
1570
|
-
});
|
|
1571
|
-
};
|
|
1572
|
-
return Object.freeze({
|
|
1573
|
-
async discover() {
|
|
1574
|
-
const members = new Set((await options.groups.groupsFor(options.selfReference)).flatMap((group) => group.members).filter((reference) => reference !== options.selfReference));
|
|
1575
|
-
return options.directory.discover(options.selfReference, members);
|
|
1576
|
-
},
|
|
1577
|
-
send: (request) => deliver(request, MESSAGE_KIND),
|
|
1578
|
-
report: (request) => deliver(request, REPORT_KIND, request.status),
|
|
1579
|
-
async messages() {
|
|
1580
|
-
const entries = (await options.delivery.inbox()).filter((entry) => entry.kind === MESSAGE_KIND || entry.kind === REPORT_KIND);
|
|
1581
|
-
const memberOf = await groupMembership(options, entries.map((entry) => entry.metadata.groupId));
|
|
1582
|
-
return entries.filter((entry) => {
|
|
1583
|
-
const groupId = entry.metadata.groupId;
|
|
1584
|
-
return groupId !== void 0 && memberOf.has(groupId);
|
|
1585
|
-
}).flatMap((entry) => {
|
|
1586
|
-
const sourceReference = entry.metadata.sourceReference;
|
|
1587
|
-
const targetReference = entry.metadata.targetReference;
|
|
1588
|
-
const groupId = entry.metadata.groupId;
|
|
1589
|
-
if (!sourceReference || !targetReference || !groupId) return [];
|
|
1590
|
-
const reportStatus = entry.metadata.reportStatus;
|
|
1591
|
-
return [{
|
|
1592
|
-
deliveryId: entry.deliveryId,
|
|
1593
|
-
sourceReference,
|
|
1594
|
-
targetReference,
|
|
1595
|
-
groupId,
|
|
1596
|
-
...entry.metadata.correlationId === void 0 ? {} : { correlationId: entry.metadata.correlationId },
|
|
1597
|
-
text: entry.prompt,
|
|
1598
|
-
...reportStatus === "done" || reportStatus === "blocked" || reportStatus === "failed" ? { reportStatus } : {},
|
|
1599
|
-
state: entry.state,
|
|
1600
|
-
consumed: entry.consumed
|
|
1601
|
-
}];
|
|
1602
|
-
});
|
|
1603
|
-
},
|
|
1604
|
-
async delivery(deliveryId) {
|
|
1605
|
-
const entry = await options.delivery.outbox(deliveryId);
|
|
1606
|
-
const groupId = entry?.metadata.groupId;
|
|
1607
|
-
return entry && groupId !== void 0 && (await groupMembership(options, [groupId])).has(groupId) ? entry : void 0;
|
|
1608
|
-
}
|
|
1609
|
-
});
|
|
1610
|
-
}
|
|
1611
|
-
/** Builds the dynamic delivery check used before every send, retry, and recipient acceptance. */
|
|
1612
|
-
function createSessionGroupDeliveryAuthorizer(options) {
|
|
1613
|
-
return async (peerKey, metadata) => {
|
|
1614
|
-
const sourceReference = metadata?.sourceReference;
|
|
1615
|
-
const targetReference = metadata?.targetReference;
|
|
1616
|
-
const groupId = metadata?.groupId;
|
|
1617
|
-
if (sourceReference && targetReference && groupId) {
|
|
1618
|
-
const peerReference = options.peerReference(peerKey);
|
|
1619
|
-
if (!peerReference) return false;
|
|
1620
|
-
return (sourceReference === options.selfReference && targetReference === peerReference || targetReference === options.selfReference && sourceReference === peerReference) && await options.groups.canMessage(groupId, sourceReference, targetReference);
|
|
1621
|
-
}
|
|
1622
|
-
return await options.fallback?.(peerKey, metadata) === true;
|
|
1623
|
-
};
|
|
1624
|
-
}
|
|
1625
|
-
//#endregion
|
|
1626
|
-
//#region ../../foundations/po-session/src/extensions/workspaces/sessions/(backend)/root.server.ts
|
|
1627
|
-
var root_server_default = defineRoot((pluginContext) => ({
|
|
1628
|
-
value: void 0,
|
|
1629
|
-
services: [provideBackgroundWorkService, (owner) => {
|
|
1630
|
-
owner.inject([
|
|
1631
|
-
PO_SESSION_PEERS_SERVICE,
|
|
1632
|
-
PO_SESSION_GROUP_BRIDGE_SERVICE,
|
|
1633
|
-
PO_FS_SERVICE,
|
|
1634
|
-
PO_SQLITE_SERVICE
|
|
1635
|
-
], async (context) => {
|
|
1636
|
-
const agent = pluginContext.agent;
|
|
1637
|
-
const session = agent?.context.session;
|
|
1638
|
-
const communication = pluginContext.host.context.sessionCommunication;
|
|
1639
|
-
const homeDirectory = pluginContext.host.context.homeDirectory;
|
|
1640
|
-
const sessionService = pluginContext.host.context.sessionService;
|
|
1641
|
-
if (!agent || !session?.admitPrompt || !communication || !homeDirectory || !sessionService?.canCommunicate) throw new Error("Session delivery requires the headless agent, authenticated session communication, host home directory, and communication policy.");
|
|
1642
|
-
const fs = requirePoFs(context);
|
|
1643
|
-
const sqlite = requirePoSqlite(context);
|
|
1644
|
-
const io = BACKGROUND_CONTEXT;
|
|
1645
|
-
const sessionDirectory = path.join(poHomeDirectory(homeDirectory), "session");
|
|
1646
|
-
const deliveryDirectory = path.join(sessionDirectory, "delivery");
|
|
1647
|
-
await ensurePrivateDirectory(fs, deliveryDirectory, io);
|
|
1648
|
-
const peers = requireSessionPeers(context);
|
|
1649
|
-
const peerConfig = peers.current();
|
|
1650
|
-
const peerCommunication = createPeerCommunication({
|
|
1651
|
-
local: communication,
|
|
1652
|
-
config: () => peers.current(),
|
|
1653
|
-
canPublish: (target, type, payload) => {
|
|
1654
|
-
if (type === "po/session-delivery/ack") return true;
|
|
1655
|
-
const metadata = payload?.metadata;
|
|
1656
|
-
return bridge?.peersFor(agent.context.sessionId).some((peer) => peer.sessionId === target && peer.sharedGroups.some((name) => namedSessionGroupId(name) === metadata?.groupId)) === true;
|
|
1657
|
-
},
|
|
1658
|
-
onError: (error) => pluginContext.host.context.onNotice(`Peer delivery failed: ${String(error)}`)
|
|
1659
|
-
});
|
|
1660
|
-
const remotePeerIsGranted = (peerKey) => {
|
|
1661
|
-
const peer = parseRemoteSessionReference(peerKey);
|
|
1662
|
-
return peer !== void 0 && peers.current()?.peers.some((candidate) => candidate.hostId === peer.hostId && candidate.allowedSessionIds.includes(agent.context.sessionId)) === true;
|
|
1663
|
-
};
|
|
1664
|
-
const fallbackAuthorization = (peerKey) => sessionService.canCommunicate?.(agent.context.sessionId, peerKey) === true || remotePeerIsGranted(peerKey);
|
|
1665
|
-
const bridge = readSessionGroupBridge(context);
|
|
1666
|
-
const groups = bridge?.groups;
|
|
1667
|
-
await bridge?.updateLocal(agent.context.sessionId, communication.sessionName ?? agent.context.sessionId, communication.groups ?? []);
|
|
1668
|
-
const localHostId = peerConfig?.hostId;
|
|
1669
|
-
const selfReference = localHostId ? peerSessionReference(localHostId, agent.context.sessionId) : void 0;
|
|
1670
|
-
const groupAuthorization = groups && selfReference && localHostId ? createSessionGroupDeliveryAuthorizer({
|
|
1671
|
-
selfReference,
|
|
1672
|
-
groups,
|
|
1673
|
-
peerReference: (peerKey) => parseRemoteSessionReference(peerKey) === void 0 ? peerSessionReference(localHostId, peerKey) : peerKey,
|
|
1674
|
-
fallback: fallbackAuthorization
|
|
1675
|
-
}) : void 0;
|
|
1676
|
-
let delivery;
|
|
1677
|
-
try {
|
|
1678
|
-
delivery = await provideSessionDeliveryService(context, {
|
|
1679
|
-
database: await sqlite.open(path.join(deliveryDirectory, `${agent.context.sessionId}.sqlite`), io),
|
|
1680
|
-
recipientKey: agent.context.sessionId,
|
|
1681
|
-
communication: peerCommunication,
|
|
1682
|
-
authorizePeer: (peerKey, metadata) => {
|
|
1683
|
-
const remote = parseRemoteSessionReference(peerKey);
|
|
1684
|
-
if (remote && !peers.current()?.peers.some((peer) => peer.hostId === remote.hostId)) return false;
|
|
1685
|
-
if (remote) {
|
|
1686
|
-
if (!bridge?.metadataFor(agent.context.sessionId, peerKey) || !metadata?.groupId || !bridge?.peersFor(agent.context.sessionId).find((peer) => peer.sessionId === peerKey)?.sharedGroups.some((name) => namedSessionGroupId(name) === metadata.groupId)) return false;
|
|
1687
|
-
return groupAuthorization ? groupAuthorization(peerKey, metadata) : false;
|
|
1688
|
-
}
|
|
1689
|
-
return groupAuthorization ? groupAuthorization(peerKey, metadata) : fallbackAuthorization(peerKey);
|
|
1690
|
-
},
|
|
1691
|
-
admitPrompt: async (prompt, admission, requestId, metadata) => {
|
|
1692
|
-
if (!metadata.customType) {
|
|
1693
|
-
await session.admitPrompt(prompt, admission, void 0, requestId);
|
|
1694
|
-
return;
|
|
1695
|
-
}
|
|
1696
|
-
if (!session.admitMessage) throw new Error("The session cannot admit a custom delivery.");
|
|
1697
|
-
await session.admitMessage({
|
|
1698
|
-
type: metadata.customType,
|
|
1699
|
-
text: prompt,
|
|
1700
|
-
display: true,
|
|
1701
|
-
details: metadata.customDetails === void 0 ? void 0 : JSON.parse(metadata.customDetails)
|
|
1702
|
-
}, admission === "steer" ? "steer" : "followUp", requestId);
|
|
1703
|
-
}
|
|
1704
|
-
});
|
|
1705
|
-
} catch (error) {
|
|
1706
|
-
await bridge?.removeLocal(agent.context.sessionId);
|
|
1707
|
-
throw error;
|
|
1708
|
-
}
|
|
1709
|
-
const { service, close: closeDelivery } = delivery;
|
|
1710
|
-
const unprovide = [];
|
|
1711
|
-
if (groups && selfReference && peerConfig) {
|
|
1712
|
-
const directory = createSessionDirectory({ authorizeDiscovery: (_caller, subject) => {
|
|
1713
|
-
const reference = peerSessionReference(subject.hostId, subject.sessionId);
|
|
1714
|
-
return bridge?.peersFor(agent.context.sessionId).some((peer) => peer.sessionId === reference) ? { capabilities: ["message"] } : void 0;
|
|
1715
|
-
} });
|
|
1716
|
-
const observedHosts = /* @__PURE__ */ new Set();
|
|
1717
|
-
let sequence = 0;
|
|
1718
|
-
const observeRemote = () => {
|
|
1719
|
-
const remotePeers = bridge?.peersFor(agent.context.sessionId) ?? [];
|
|
1720
|
-
for (const peer of remotePeers) observedHosts.add(parseRemoteSessionReference(peer.sessionId).hostId);
|
|
1721
|
-
sequence += 1;
|
|
1722
|
-
for (const hostId of observedHosts) directory.replaceHostSnapshot(hostId, "linked", remotePeers.flatMap((peer) => {
|
|
1723
|
-
const remote = parseRemoteSessionReference(peer.sessionId);
|
|
1724
|
-
return remote.hostId !== hostId ? [] : [{
|
|
1725
|
-
hostId,
|
|
1726
|
-
sessionId: remote.sessionId,
|
|
1727
|
-
label: peer.name,
|
|
1728
|
-
hostIncarnation: "linked",
|
|
1729
|
-
sessionIncarnation: "live",
|
|
1730
|
-
sequence,
|
|
1731
|
-
observedAt: Date.now(),
|
|
1732
|
-
staleAfterMs: 12e4,
|
|
1733
|
-
deliveryTarget: peer.sessionId,
|
|
1734
|
-
reachability: "unknown",
|
|
1735
|
-
runtime: "unknown",
|
|
1736
|
-
activity: "unknown",
|
|
1737
|
-
voice: {
|
|
1738
|
-
eligible: "unknown",
|
|
1739
|
-
readiness: "unknown"
|
|
1740
|
-
}
|
|
1741
|
-
}];
|
|
1742
|
-
}));
|
|
1743
|
-
};
|
|
1744
|
-
observeRemote();
|
|
1745
|
-
unprovide.push(bridge.subscribe(() => {
|
|
1746
|
-
observeRemote();
|
|
1747
|
-
service.reauthorize?.().catch((error) => pluginContext.host.context.onNotice(`Delivery reauthorization failed: ${String(error)}`));
|
|
1748
|
-
}));
|
|
1749
|
-
unprovide.push(context.provide(PO_SESSION_INTERCOM_SERVICE, createSessionIntercom({
|
|
1750
|
-
selfReference,
|
|
1751
|
-
directory,
|
|
1752
|
-
groups,
|
|
1753
|
-
delivery: service
|
|
1754
|
-
})));
|
|
1755
|
-
}
|
|
1756
|
-
const releaseGroups = pluginContext.host.context.directEvents?.subscribe(PO_SESSION_ATTENTION_EVENT, agent.context.sessionId, () => {
|
|
1757
|
-
bridge?.updateLocal(agent.context.sessionId, communication.sessionName ?? agent.context.sessionId, communication.groups ?? []).catch((error) => pluginContext.host.context.onNotice(`Group update failed: ${String(error)}`));
|
|
1758
|
-
});
|
|
1759
|
-
const unregister = registerSessionPeerInbox(agent.context.sessionId, (sourceKey, kind, payload) => service.receive?.(sourceKey, kind, payload));
|
|
1760
|
-
return async () => {
|
|
1761
|
-
unregister();
|
|
1762
|
-
releaseGroups?.();
|
|
1763
|
-
await bridge?.removeLocal(agent.context.sessionId);
|
|
1764
|
-
for (const release of unprovide.reverse()) release();
|
|
1765
|
-
await closeDelivery();
|
|
1766
|
-
};
|
|
1767
|
-
});
|
|
1768
|
-
}]
|
|
1769
|
-
}));
|
|
1770
|
-
//#endregion
|
|
1771
|
-
//#region ../../core/po-core/src/schemas/remoteOrigin.ts
|
|
1772
|
-
const PO_REMOTE_ORIGIN_SERVICE = "po/remote-origin";
|
|
1773
|
-
defineServiceContract(PO_REMOTE_ORIGIN_SERVICE, { scope: "global" });
|
|
1774
|
-
//#endregion
|
|
1775
1005
|
//#region ../../foundations/po-session/src/services/peerLink/index.ts
|
|
1776
1006
|
const INVITE_TTL_MS = 6e4;
|
|
1777
1007
|
const MAX_INVITES = 64;
|
|
@@ -2018,260 +1248,8 @@ function createPeerLink(options) {
|
|
|
2018
1248
|
};
|
|
2019
1249
|
}
|
|
2020
1250
|
//#endregion
|
|
2021
|
-
//#region ../../foundations/po-session/src/services/peerInboxApi/index.ts
|
|
2022
|
-
const MAX_BODY_BYTES = 65536;
|
|
2023
|
-
const DELIVERY_TYPES = /* @__PURE__ */ new Set(["po/session-delivery/envelope", "po/session-delivery/ack"]);
|
|
2024
|
-
function response(status, error) {
|
|
2025
|
-
return Response.json({ error }, { status });
|
|
2026
|
-
}
|
|
2027
|
-
/** Narrow HMAC-authenticated endpoint that a trusted tunnel may forward without device authentication. */
|
|
2028
|
-
function createPeerInboxApi(platform) {
|
|
2029
|
-
return {
|
|
2030
|
-
basePath: "session-peer",
|
|
2031
|
-
start(context) {
|
|
2032
|
-
const homeDirectory = context.homeDirectory;
|
|
2033
|
-
let opened;
|
|
2034
|
-
const channels = createSealedPeerChannels();
|
|
2035
|
-
let link;
|
|
2036
|
-
let announcing = false;
|
|
2037
|
-
const announce = () => {
|
|
2038
|
-
if (!link || announcing) return;
|
|
2039
|
-
announcing = true;
|
|
2040
|
-
link.announce().catch((error) => context.onNotice(`Peer URL announcement failed: ${String(error)}`)).finally(() => {
|
|
2041
|
-
announcing = false;
|
|
2042
|
-
});
|
|
2043
|
-
};
|
|
2044
|
-
const timer = platform.peers && platform.origin ? setInterval(() => {
|
|
2045
|
-
open().then(announce).catch((error) => context.onNotice(`Host links could not start: ${String(error)}`));
|
|
2046
|
-
}, 1e3) : void 0;
|
|
2047
|
-
timer?.unref?.();
|
|
2048
|
-
const open = () => opened ??= (async () => {
|
|
2049
|
-
if (homeDirectory === void 0) return {
|
|
2050
|
-
config: void 0,
|
|
2051
|
-
replay: void 0
|
|
2052
|
-
};
|
|
2053
|
-
const config = platform.peers ? platform.peers.current() : await readSessionPeerConfigAsync(platform.fs, homeDirectory, BACKGROUND_CONTEXT);
|
|
2054
|
-
const file = path.join(path.dirname(sessionPeerConfigPath(homeDirectory)), PEER_REPLAY_DATABASE_FILE);
|
|
2055
|
-
await ensurePrivateDirectory(platform.fs, path.dirname(file), BACKGROUND_CONTEXT);
|
|
2056
|
-
const replay = await createPeerReplayGuardAsync(await platform.sqlite.open(file, BACKGROUND_CONTEXT));
|
|
2057
|
-
if (platform.peers) link = createPeerLink({
|
|
2058
|
-
peers: platform.peers,
|
|
2059
|
-
network: platform.network,
|
|
2060
|
-
groups: platform.groups,
|
|
2061
|
-
replay,
|
|
2062
|
-
channels,
|
|
2063
|
-
origin: platform.origin ?? (() => void 0),
|
|
2064
|
-
fetch: platform.fetch
|
|
2065
|
-
});
|
|
2066
|
-
announce();
|
|
2067
|
-
return {
|
|
2068
|
-
config,
|
|
2069
|
-
replay
|
|
2070
|
-
};
|
|
2071
|
-
})().catch((error) => {
|
|
2072
|
-
opened = void 0;
|
|
2073
|
-
throw error;
|
|
2074
|
-
});
|
|
2075
|
-
if (platform.peers) open().catch((error) => context.onNotice(`Host links could not start: ${String(error)}`));
|
|
2076
|
-
return {
|
|
2077
|
-
async fetch(request) {
|
|
2078
|
-
const pathname = new URL(request.url).pathname;
|
|
2079
|
-
const openedState = await open();
|
|
2080
|
-
const config = platform.peers ? platform.peers.current() : openedState.config;
|
|
2081
|
-
const replay = openedState.replay;
|
|
2082
|
-
if (request.method === "GET" && pathname === "/links" && platform.peers) {
|
|
2083
|
-
if (!poApiCallerFrom(request.headers)) return response(403, "An authenticated caller is required.");
|
|
2084
|
-
return Response.json({
|
|
2085
|
-
hostId: config?.hostId,
|
|
2086
|
-
peers: config?.peers.map(({ hostId, url, urlGeneration }) => ({
|
|
2087
|
-
hostId,
|
|
2088
|
-
url,
|
|
2089
|
-
urlGeneration
|
|
2090
|
-
})) ?? []
|
|
2091
|
-
});
|
|
2092
|
-
}
|
|
2093
|
-
if (request.method !== "POST" || ![
|
|
2094
|
-
"/inbox",
|
|
2095
|
-
"/control",
|
|
2096
|
-
"/link/prepare",
|
|
2097
|
-
"/link/accept",
|
|
2098
|
-
"/link/unlink",
|
|
2099
|
-
"/link/hint"
|
|
2100
|
-
].includes(pathname)) return response(404, "Not found.");
|
|
2101
|
-
const length = request.headers.get("content-length");
|
|
2102
|
-
if (length !== null && (!/^\d+$/u.test(length) || Number(length) > MAX_BODY_BYTES)) return response(413, "Request body is too large.");
|
|
2103
|
-
const body = await request.text();
|
|
2104
|
-
if (Buffer.byteLength(body) > MAX_BODY_BYTES) return response(413, "Request body is too large.");
|
|
2105
|
-
if (pathname.startsWith("/link/")) {
|
|
2106
|
-
const caller = poApiCallerFrom(request.headers);
|
|
2107
|
-
if (!caller || caller.locality === "remote" && pathname !== "/link/hint" && caller.stepUp !== "verified") return response(403, "Linking hosts needs a fresh peer.link step-up.");
|
|
2108
|
-
if (!link) return response(503, "Host links are unavailable.");
|
|
2109
|
-
try {
|
|
2110
|
-
const input = body === "" ? {} : JSON.parse(body);
|
|
2111
|
-
if (pathname === "/link/prepare") return Response.json(await link.prepare());
|
|
2112
|
-
if (pathname === "/link/accept") {
|
|
2113
|
-
await link.accept(input.invite);
|
|
2114
|
-
return Response.json({ linked: true });
|
|
2115
|
-
}
|
|
2116
|
-
if (typeof input.hostId !== "string") return response(400, "A host identity is required.");
|
|
2117
|
-
if (pathname === "/link/unlink") {
|
|
2118
|
-
await link.unlink(input.hostId);
|
|
2119
|
-
return Response.json({ unlinked: true });
|
|
2120
|
-
}
|
|
2121
|
-
if (typeof input.url !== "string") return response(400, "A URL hint is required.");
|
|
2122
|
-
return Response.json({ rebound: await link.hint(input.hostId, input.url) });
|
|
2123
|
-
} catch (error) {
|
|
2124
|
-
return response(400, error instanceof Error ? error.message : "Host link failed.");
|
|
2125
|
-
}
|
|
2126
|
-
}
|
|
2127
|
-
if (pathname === "/control") {
|
|
2128
|
-
if (!link) return response(503, "Host links are unavailable.");
|
|
2129
|
-
try {
|
|
2130
|
-
return await link.control(request, body);
|
|
2131
|
-
} catch (error) {
|
|
2132
|
-
return response(400, error instanceof Error ? error.message : "Invalid peer control.");
|
|
2133
|
-
}
|
|
2134
|
-
}
|
|
2135
|
-
if (!config) return response(503, "Paired Session delivery is not configured.");
|
|
2136
|
-
const peer = verifyPeerRequest(config, request, body);
|
|
2137
|
-
if (!peer) return response(401, "Paired Session request is unauthorized.");
|
|
2138
|
-
if (!await replay?.admit(request)) return response(409, "Paired Session request was already received.");
|
|
2139
|
-
let parsed;
|
|
2140
|
-
try {
|
|
2141
|
-
parsed = JSON.parse(body);
|
|
2142
|
-
} catch {
|
|
2143
|
-
return response(400, "Paired Session request is malformed.");
|
|
2144
|
-
}
|
|
2145
|
-
let peerChannel;
|
|
2146
|
-
if (peer.linkGeneration) {
|
|
2147
|
-
const sealed = parsed;
|
|
2148
|
-
peerChannel = typeof sealed?.epochId === "string" ? channels.take(peer, sealed.epochId) : void 0;
|
|
2149
|
-
const opened = peerChannel?.open(sealed?.envelope);
|
|
2150
|
-
if (!opened?.ok) return response(401, "A fresh sealed peer channel is required.");
|
|
2151
|
-
try {
|
|
2152
|
-
parsed = JSON.parse(Buffer.from(opened.plaintext).toString("utf8"));
|
|
2153
|
-
} catch {
|
|
2154
|
-
return response(400, "Invalid sealed peer envelope.");
|
|
2155
|
-
}
|
|
2156
|
-
}
|
|
2157
|
-
const envelope = parseSessionPeerEnvelope(parsed);
|
|
2158
|
-
if (!envelope || !DELIVERY_TYPES.has(envelope.type)) return response(400, "Paired Session envelope is invalid.");
|
|
2159
|
-
if (!peer.linkGeneration && !peer.allowedSessionIds.includes(envelope.targetSessionId)) return response(403, "Peer is not granted this session.");
|
|
2160
|
-
const state = await deliverSessionPeerEnvelope(envelope.targetSessionId, peerSessionReference(peer.hostId, envelope.sourceSessionId), envelope.type, envelope.payload);
|
|
2161
|
-
if (state !== void 0 && peerChannel) {
|
|
2162
|
-
const sealed = peerChannel.seal(Buffer.from(JSON.stringify({
|
|
2163
|
-
accepted: true,
|
|
2164
|
-
state
|
|
2165
|
-
})));
|
|
2166
|
-
if (!sealed.ok) return response(503, "Peer acknowledgement could not be sealed.");
|
|
2167
|
-
const text = JSON.stringify(sealed.envelope);
|
|
2168
|
-
return new Response(text, { headers: peerRequestHeaders(config.hostId, peer, "RESPONSE", "/inbox", text) });
|
|
2169
|
-
}
|
|
2170
|
-
return state === void 0 ? response(404, "Target Session is unavailable.") : Response.json({
|
|
2171
|
-
accepted: true,
|
|
2172
|
-
state
|
|
2173
|
-
}, { status: 202 });
|
|
2174
|
-
},
|
|
2175
|
-
async close() {
|
|
2176
|
-
if (timer) clearInterval(timer);
|
|
2177
|
-
const state = await opened?.catch(() => void 0);
|
|
2178
|
-
link?.close();
|
|
2179
|
-
await state?.replay?.close();
|
|
2180
|
-
}
|
|
2181
|
-
};
|
|
2182
|
-
}
|
|
2183
|
-
};
|
|
2184
|
-
}
|
|
2185
|
-
//#endregion
|
|
2186
1251
|
//#region ../../foundations/po-session/src/services/peerLink/type.ts
|
|
2187
1252
|
const PO_ROSTER_PEER_SERVICE = "po/roster-peer";
|
|
2188
1253
|
defineServiceContract(PO_ROSTER_PEER_SERVICE, { scope: "global" });
|
|
2189
1254
|
//#endregion
|
|
2190
|
-
|
|
2191
|
-
var route_server_default = defineRoute(({ context }) => {
|
|
2192
|
-
let origin;
|
|
2193
|
-
let network;
|
|
2194
|
-
context.inject([PO_ROSTER_PEER_SERVICE], (scoped) => {
|
|
2195
|
-
network = scoped.get(PO_ROSTER_PEER_SERVICE);
|
|
2196
|
-
return () => {
|
|
2197
|
-
network = void 0;
|
|
2198
|
-
};
|
|
2199
|
-
});
|
|
2200
|
-
context.inject([PO_REMOTE_ORIGIN_SERVICE], (scoped) => {
|
|
2201
|
-
origin = scoped.get(PO_REMOTE_ORIGIN_SERVICE);
|
|
2202
|
-
return () => {
|
|
2203
|
-
origin = void 0;
|
|
2204
|
-
};
|
|
2205
|
-
});
|
|
2206
|
-
const hasOrigin = origin !== void 0;
|
|
2207
|
-
return createPeerInboxApi({
|
|
2208
|
-
fs: requirePoFs(context),
|
|
2209
|
-
sqlite: requirePoSqlite(context),
|
|
2210
|
-
peers: requireSessionPeers(context),
|
|
2211
|
-
network,
|
|
2212
|
-
groups: () => readSessionGroupBridge(context),
|
|
2213
|
-
...hasOrigin ? { origin: () => origin?.current() } : {}
|
|
2214
|
-
});
|
|
2215
|
-
});
|
|
2216
|
-
//#endregion
|
|
2217
|
-
//#region ../../foundations/po-session/generated/server.ts
|
|
2218
|
-
const at = (value, context) => typeof value === "function" ? value(context) : value;
|
|
2219
|
-
/* v8 ignore next -- generated normalization branch */
|
|
2220
|
-
const defined = (values) => values.filter((value) => value !== void 0);
|
|
2221
|
-
const serverPlugin = defineServerPlugin({
|
|
2222
|
-
name: "@agimon-ai/po-session",
|
|
2223
|
-
providerOverrides: composeServerProviderOverrides(root_server_default$1, root_server_default),
|
|
2224
|
-
injects: composeRootInjects({
|
|
2225
|
-
global: [root_server_default$1],
|
|
2226
|
-
workspace: [root_server_default$1],
|
|
2227
|
-
session: [root_server_default$1, root_server_default]
|
|
2228
|
-
}),
|
|
2229
|
-
global: async (context) => {
|
|
2230
|
-
const scopeGlobal = await context.scopeRoot("global", root_server_default$1, context);
|
|
2231
|
-
const contextGlobal = {
|
|
2232
|
-
...context,
|
|
2233
|
-
root: scopeGlobal.value
|
|
2234
|
-
};
|
|
2235
|
-
return {
|
|
2236
|
-
...composeRootHooks(scopeGlobal),
|
|
2237
|
-
get api() {
|
|
2238
|
-
return [at(route_server_default, contextGlobal)];
|
|
2239
|
-
},
|
|
2240
|
-
services: [...scopeGlobal.services ?? []]
|
|
2241
|
-
};
|
|
2242
|
-
},
|
|
2243
|
-
workspace: async (context) => {
|
|
2244
|
-
const scopeGlobal = await context.scopeRoot("global", root_server_default$1, context);
|
|
2245
|
-
const contextGlobal = {
|
|
2246
|
-
...context,
|
|
2247
|
-
root: scopeGlobal.value
|
|
2248
|
-
};
|
|
2249
|
-
return {
|
|
2250
|
-
...composeRootHooks(scopeGlobal),
|
|
2251
|
-
get api() {
|
|
2252
|
-
return defined([context.hosted("global") ? void 0 : at(route_server_default, contextGlobal)]);
|
|
2253
|
-
},
|
|
2254
|
-
services: [...scopeGlobal.services ?? []]
|
|
2255
|
-
};
|
|
2256
|
-
},
|
|
2257
|
-
session: async (context) => {
|
|
2258
|
-
const scopeGlobal = await context.scopeRoot("global", root_server_default$1, context);
|
|
2259
|
-
const contextGlobal = {
|
|
2260
|
-
...context,
|
|
2261
|
-
root: scopeGlobal.value
|
|
2262
|
-
};
|
|
2263
|
-
const scopeSession = await context.scopeRoot("session", root_server_default, contextGlobal);
|
|
2264
|
-
return {
|
|
2265
|
-
...composeRootHooks(scopeGlobal, scopeSession),
|
|
2266
|
-
get api() {
|
|
2267
|
-
return defined([context.hosted("global") ? void 0 : at(route_server_default, contextGlobal)]);
|
|
2268
|
-
},
|
|
2269
|
-
services: [...scopeGlobal.services ?? [], ...scopeSession.services ?? []],
|
|
2270
|
-
get activities() {
|
|
2271
|
-
return [...scopeGlobal.activities ?? [], ...scopeSession.activities ?? []];
|
|
2272
|
-
}
|
|
2273
|
-
};
|
|
2274
|
-
}
|
|
2275
|
-
});
|
|
2276
|
-
//#endregion
|
|
2277
|
-
export { serverPlugin as default, serverPlugin };
|
|
1255
|
+
export { authenticatedPeerPost as C, sessionPeerConfigPath as E, verifyPeerRequest as S, PEER_REPLAY_DATABASE_FILE as T, parseRemoteSessionReference as _, PO_SESSION_PEERS_CONTRACT as a, peerSessionReference as b, requireSessionPeers as c, createSessionGroupBridge as d, namedSessionGroupId as f, ensurePrivateDirectory as g, createPeerReplayGuardAsync as h, provideBackgroundWorkService as i, PO_SESSION_GROUP_BRIDGE_CONTRACT as l, createPeerCommunication as m, createPeerLink as n, PO_SESSION_PEERS_SERVICE as o, readSessionGroupBridge as p, createSessionDirectory as r, createSessionPeers as s, PO_ROSTER_PEER_SERVICE as t, PO_SESSION_GROUP_BRIDGE_SERVICE as u, parseSessionPeerEnvelope as v, createSealedPeerChannels as w, readSessionPeerConfigAsync as x, peerRequestHeaders as y };
|