@agimon-ai/po-cloudflare 0.0.2-alpha.63 → 0.0.2-alpha.64
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 +13 -0
- package/dist/apiContracts-CNEgbJwj.js +1715 -0
- package/dist/assets/assets/{CodeEditorView-CNdPF2Z8.js → CodeEditorView-D7pzNIoH.js} +2 -2
- package/dist/assets/assets/{abnfDiagram-WEYOIA3C-BpEuH9tc.js → abnfDiagram-WEYOIA3C-CxtSKgjr.js} +2 -2
- package/dist/assets/assets/{architecture-WOLXFQ4H-CO9IcYuJ.js → architecture-WOLXFQ4H-CtnQTAsr.js} +1 -1
- package/dist/assets/assets/{architectureDiagram-ZHVYKT53-B94avglc.js → architectureDiagram-ZHVYKT53-DE2dNllJ.js} +2 -2
- package/dist/assets/assets/{blockDiagram-RJAE7QA3-Dyj_IG8P.js → blockDiagram-RJAE7QA3-Cw4dFyL6.js} +2 -2
- package/dist/assets/assets/{c4Diagram-XDPPPE54-kCCb9Nvu.js → c4Diagram-XDPPPE54-BX8ZmJNh.js} +2 -2
- package/dist/assets/assets/channel-CMUucV-0.js +2 -0
- package/dist/assets/assets/{chunk-2E7WHVMD-aabTbQRn.js → chunk-2E7WHVMD-CjyWoAjP.js} +2 -2
- package/dist/assets/assets/{chunk-4EMNKR2T-BfyoxA4A.js → chunk-4EMNKR2T-BGT3YuPv.js} +2 -2
- package/dist/assets/assets/{chunk-55XCU76K-Cb2-H5PY.js → chunk-55XCU76K-zOmV9K85.js} +2 -2
- package/dist/assets/assets/{chunk-7S6XSTFO-DF4Vz0iS.js → chunk-7S6XSTFO-CT9Du8QX.js} +2 -2
- package/dist/assets/assets/{chunk-AQDTSKZB-DYfgedyG.js → chunk-AQDTSKZB-DlFeSSC4.js} +2 -2
- package/dist/assets/assets/{chunk-DSNLSHJZ-ELMVWOH-.js → chunk-DSNLSHJZ-C-ZPBYet.js} +2 -2
- package/dist/assets/assets/{chunk-HAGFOTED-BfFyqWkw.js → chunk-HAGFOTED-BoAjQX39.js} +2 -2
- package/dist/assets/assets/{chunk-HNE4Q36P-brfLLH1k.js → chunk-HNE4Q36P-DIq-EGSJ.js} +2 -2
- package/dist/assets/assets/{chunk-NQOKRVIF-BPeBTdMj.js → chunk-NQOKRVIF-DCZggr3o.js} +2 -2
- package/dist/assets/assets/{chunk-UHW7PFBP-Pm1hUsoy.js → chunk-UHW7PFBP-Do_Zzrrp.js} +2 -2
- package/dist/assets/assets/{chunk-VQ5W62QI-DNrJHI3b.js → chunk-VQ5W62QI-CTQ1DMtJ.js} +2 -2
- package/dist/assets/assets/{chunk-WQQL4CDK-Bn-i8xPd.js → chunk-WQQL4CDK-Ki6uR6r0.js} +2 -2
- package/dist/assets/assets/chunk-XXDRQBXY-CQICwlCf.js +2 -0
- package/dist/assets/assets/{chunk-YZO67HFG-Bm3Y2k41.js → chunk-YZO67HFG-B296g6FE.js} +2 -2
- package/dist/assets/assets/{chunk-ZAUX2LTX-wKlSN4SY.js → chunk-ZAUX2LTX-BpPT7rvX.js} +2 -2
- package/dist/assets/assets/{chunk-ZCHMQSOR-vvsZwzKx.js → chunk-ZCHMQSOR-Di0VGZer.js} +2 -2
- package/dist/assets/assets/{classDiagram-v2-4MYWR3UA-B4fv93fc.js → classDiagram-v2-4MYWR3UA-CGj_lJO_.js} +2 -2
- package/dist/assets/assets/{cose-bilkent-JH36ORCC-CakncvlM.js → cose-bilkent-JH36ORCC-DY0BbQbd.js} +2 -2
- package/dist/assets/assets/{cynefin-EF2NZ3EQ-BmPuG-jp.js → cynefin-EF2NZ3EQ-CMMUJeFf.js} +1 -1
- package/dist/assets/assets/{cynefinDiagram-WF24UDRP-w05E3pMy.js → cynefinDiagram-WF24UDRP-BbOif1OC.js} +2 -2
- package/dist/assets/assets/{dagre-NK4GIZVX-DtBjSPFH.js → dagre-NK4GIZVX-CphjGdnN.js} +2 -2
- package/dist/assets/assets/{diagram-CBK3MWTC-BFSVYioV.js → diagram-CBK3MWTC-DpGUyRf7.js} +2 -2
- package/dist/assets/assets/{diagram-I5XIIV2D-BDvStF0J.js → diagram-I5XIIV2D-DcYA8tlL.js} +2 -2
- package/dist/assets/assets/{diagram-ODIL2UCW-DARMBHRQ.js → diagram-ODIL2UCW-ChPOrrmO.js} +2 -2
- package/dist/assets/assets/{diagram-PFBEJUXE-Pj4fyqwM.js → diagram-PFBEJUXE-BfPiSQ9L.js} +2 -2
- package/dist/assets/assets/{diagram-RJA3I4VV-BaKg3wpn.js → diagram-RJA3I4VV-rLXVMix5.js} +2 -2
- package/dist/assets/assets/{diagram-TYUNFSNR-CefzxlNs.js → diagram-TYUNFSNR-BTmEjrYt.js} +2 -2
- package/dist/assets/assets/{dist-DEWrC__B.js → dist-1L_Ajly9.js} +2 -2
- package/dist/assets/assets/{dist-Cghv4o0_.js → dist-48390Dmg.js} +2 -2
- package/dist/assets/assets/{dist-CHFfGcfR.js → dist-BAD8d1kv.js} +2 -2
- package/dist/assets/assets/{dist-B9ZDItnO.js → dist-BJLZuu6S.js} +2 -2
- package/dist/assets/assets/{dist-EAEtfW9R.js → dist-BlSnUUI6.js} +2 -2
- package/dist/assets/assets/{dist-D5maITN-.js → dist-CobUSto6.js} +2 -2
- package/dist/assets/assets/{dist-CxVXLY-8.js → dist-DAGWxegY.js} +2 -2
- package/dist/assets/assets/{dist-CGCZs-fG.js → dist-DLPWqzfx.js} +2 -2
- package/dist/assets/assets/{dist-DtehQ6Vh.js → dist-QjSb6UwP.js} +2 -2
- package/dist/assets/assets/{ebnfDiagram-V4P3TTPT-YewZYnYk.js → ebnfDiagram-V4P3TTPT-BN1myPAM.js} +2 -2
- package/dist/assets/assets/{elk-QONTBCTQ-dVpXxU0t.js → elk-QONTBCTQ-C4yJXrim.js} +2 -2
- package/dist/assets/assets/{erDiagram-KYQIGQAA-DppuSwGu.js → erDiagram-KYQIGQAA-BLGAHUjY.js} +2 -2
- package/dist/assets/assets/{eventmodeling-K75KTNOO-CjOlr5k9.js → eventmodeling-K75KTNOO-BNsbrLPW.js} +1 -1
- package/dist/assets/assets/flowDiagram-IUGLLWBU-GEvUvJMe.js +1 -0
- package/dist/assets/assets/{ganttDiagram-R7GPNTJY-BiP9tCoR.js → ganttDiagram-R7GPNTJY-Dtt1cLvU.js} +2 -2
- package/dist/assets/assets/{gitGraph-VSP46ZUC-D_37KmzW.js → gitGraph-VSP46ZUC-BB3jyory.js} +1 -1
- package/dist/assets/assets/{gitGraphDiagram-PDYL7XHY-BpPyCOnT.js → gitGraphDiagram-PDYL7XHY-5dxhMcQJ.js} +2 -2
- package/dist/assets/assets/index-BEh1IFrK.js +256 -0
- package/dist/assets/assets/{info-OHQRW6UA-BzB_vPCs.js → info-OHQRW6UA-B6a4Z_NG.js} +1 -1
- package/dist/assets/assets/{infoDiagram-MVDRKAX5-H2O0q8Pc.js → infoDiagram-MVDRKAX5-D4WPnECO.js} +2 -2
- package/dist/assets/assets/{ishikawaDiagram-HPEHV2GE-CxgN92Oj.js → ishikawaDiagram-HPEHV2GE-7qHvZhsy.js} +2 -2
- package/dist/assets/assets/{journeyDiagram-BOSHW7O7-Cgi2OOJn.js → journeyDiagram-BOSHW7O7-CX3Bn1wZ.js} +2 -2
- package/dist/assets/assets/{kanban-definition-FNSA4HC5-DfNFv9yJ.js → kanban-definition-FNSA4HC5-DhEPG70e.js} +2 -2
- package/dist/assets/assets/{line-BsuG8Uxt.js → line-ChDBcVMC.js} +2 -2
- package/dist/assets/assets/{linear-5ygNOtpj.js → linear-BnYwLNuy.js} +2 -2
- package/dist/assets/assets/{mermaid-parser.core-BQKUlQNj.js → mermaid-parser.core-CqVdBIHT.js} +4 -4
- package/dist/assets/assets/{mermaid.core-mIsoHdG8.js → mermaid.core-q29P4JOO.js} +5 -5
- package/dist/assets/assets/{mindmap-definition-6OY57UG3-CwRI3Joj.js → mindmap-definition-6OY57UG3-C74KuyjY.js} +2 -2
- package/dist/assets/assets/{packet-JDAUHWVQ-DA3pnTHc.js → packet-JDAUHWVQ-B4LCADWh.js} +1 -1
- package/dist/assets/assets/{pegDiagram-ECIUJNBX-CDCKGOxK.js → pegDiagram-ECIUJNBX-Cv2MJ170.js} +2 -2
- package/dist/assets/assets/{pie-XZMESJXO-BLhJFhYu.js → pie-XZMESJXO-DotbpRpk.js} +1 -1
- package/dist/assets/assets/{pieDiagram-GNMPY74T-DYR-R-dX.js → pieDiagram-GNMPY74T-CChjMnDW.js} +2 -2
- package/dist/assets/assets/{quadrantDiagram-D57K4MC3-Bc1eK1F-.js → quadrantDiagram-D57K4MC3-DEYttxps.js} +2 -2
- package/dist/assets/assets/{radar-ABXABTNO-EtUBQBSs.js → radar-ABXABTNO-4s5FAd4E.js} +1 -1
- package/dist/assets/assets/{railroad-I3PHUGI6-B21qPap-.js → railroad-I3PHUGI6-DBTlhGxt.js} +1 -1
- package/dist/assets/assets/{railroad-abnf-LNEFI6M7-BIiwJieY.js → railroad-abnf-LNEFI6M7-D6ziSuiX.js} +1 -1
- package/dist/assets/assets/{railroad-ebnf-DWYD2UWJ-DqZK9K0J.js → railroad-ebnf-DWYD2UWJ-CqEIKDB8.js} +1 -1
- package/dist/assets/assets/{railroad-peg-JR7BVNR7-CIQgGVCU.js → railroad-peg-JR7BVNR7-CJtfKFNH.js} +1 -1
- package/dist/assets/assets/{railroadDiagram-Y72NRBL7-BD_lzGk4.js → railroadDiagram-Y72NRBL7-4mBAJ-Jl.js} +2 -2
- package/dist/assets/assets/{requirementDiagram-EQYSW5RA-aDbnnoHS.js → requirementDiagram-EQYSW5RA-BEhHi0QF.js} +2 -2
- package/dist/assets/assets/{sankeyDiagram-SY24JHO5-DDdGARNy.js → sankeyDiagram-SY24JHO5-nj_cSwlP.js} +2 -2
- package/dist/assets/assets/{sequenceDiagram-BLEHNHQU-BIH_jN1c.js → sequenceDiagram-BLEHNHQU-DNY4na4z.js} +2 -2
- package/dist/assets/assets/{src-BaA7Sf5p.js → src-WiWJj6f2.js} +2 -2
- package/dist/assets/assets/{stateDiagram-v2-A6IESKWZ-C-dVVPfs.js → stateDiagram-v2-A6IESKWZ-BB9jYF4B.js} +2 -2
- package/dist/assets/assets/{swimlanes-B3ENRKFQ-Bw5IOyh7.js → swimlanes-B3ENRKFQ-D87jJRda.js} +2 -2
- package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-DehW4Jm2.js +9 -0
- package/dist/assets/assets/{timeline-definition-JXYKGLGB-By_uqQTe.js → timeline-definition-JXYKGLGB-C2a6EPko.js} +2 -2
- package/dist/assets/assets/{treeView-D4JQ5SDB-BZU7wRHU.js → treeView-D4JQ5SDB-BdB3JJaH.js} +1 -1
- package/dist/assets/assets/{treemap-SAJKECNS-N8z3Rl5u.js → treemap-SAJKECNS-BJjjYPG9.js} +1 -1
- package/dist/assets/assets/{usecaseDiagram-WPOLBNNX-CuUha2nb.js → usecaseDiagram-WPOLBNNX-DlLWyckj.js} +2 -2
- package/dist/assets/assets/{vennDiagram-Q3Y3IDCW-g3YaAylz.js → vennDiagram-Q3Y3IDCW-D6fIfwd9.js} +2 -2
- package/dist/assets/assets/{wardley-7MLQ67FV-BvmZvcdT.js → wardley-7MLQ67FV-CSM_VWdu.js} +1 -1
- package/dist/assets/assets/{wardleyDiagram-IVAIDKWA-CvNsC8vq.js → wardleyDiagram-IVAIDKWA-CTsqqv0l.js} +2 -2
- package/dist/assets/assets/{webpack-mxF5RTCn.js → webpack-Dliwyah1.js} +2 -2
- package/dist/assets/assets/{xychartDiagram-4URNHDU4-vCSk0HHw.js → xychartDiagram-4URNHDU4-D49cqPPi.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-BsvoTtxC.css +2 -0
- package/dist/assets/plugins/chunks/po-web-runtime-B5XS1Vkn.js +1 -0
- package/dist/assets/plugins/compositions.json +1 -1
- package/dist/assets/plugins/slots/approval.09e72f36-vdtrYSJE.js +2 -0
- package/dist/assets/plugins/slots/artifacts.50b639bb-Difr6PJG.js +1 -0
- package/dist/assets/plugins/slots/author.fe075392-1ypXiPa9.js +93 -0
- package/dist/assets/plugins/slots/{autocompact.f08b6833-BLrybOV_.js → autocompact.6f428144-Da_u6U6S.js} +1 -1
- package/dist/assets/plugins/slots/backdrop-bamboo.6e4c928d-BJmw6J1H.js +1 -0
- package/dist/assets/plugins/slots/browse.fa1f1a50-DVXthO2Y.js +1 -0
- package/dist/assets/plugins/slots/builtin-tools.75108f21-CZVTaRlo.js +7 -0
- package/dist/assets/plugins/slots/calendar.d8b70190-It_2gT_o.js +2 -0
- package/dist/assets/plugins/slots/codemode.c58fb583--R-ayMy6.js +11 -0
- package/dist/assets/plugins/slots/domain.753f9f92-CTWPJ3K3.js +1 -0
- package/dist/assets/plugins/slots/edit.804fec90-CnhEiTi_.js +7 -0
- package/dist/assets/plugins/slots/files.66ffc636-bPZ6eGF5.js +2 -0
- package/dist/assets/plugins/slots/goal.45dffa01-hcQ21LSV.js +1 -0
- package/dist/assets/plugins/slots/grep.98262cff-zdlPKmsW.js +1 -0
- package/dist/assets/plugins/slots/help.5fbd20f7-DmUDRYKt.js +3 -0
- package/dist/assets/plugins/slots/log.cb964209-j2FTMopd.js +4 -0
- package/dist/assets/plugins/slots/mcp.82cc1ff5-DJAarFoV.js +55 -0
- package/dist/assets/plugins/slots/plan.3852ba52-BAjhNPLw.js +3 -0
- package/dist/assets/plugins/slots/{profile.1b4aeee4-NbT6f8xl.js → profile.ab16dcec-DcqHKZZu.js} +1 -1
- package/dist/assets/plugins/slots/{prompts.a5509377-D8btnu7Y.js → prompts.ae48c07a-DSpV7n6y.js} +21 -21
- package/dist/assets/plugins/slots/read.4560591a-B3vKeI4d.js +1 -0
- package/dist/assets/plugins/slots/runner.6e494d59-D7Z9dlE2.js +9 -0
- package/dist/assets/plugins/slots/scaffold.d87a6ee0-Cvh_qC8k.js +1 -0
- package/dist/assets/plugins/slots/sessions.6f47cb4c-feejch_0.js +1 -0
- package/dist/assets/plugins/slots/skill.62a0a1b3-DLuQV0P-.js +4 -0
- package/dist/assets/plugins/slots/space.65a27e5a-iOxXji2v.js +1 -0
- package/dist/assets/plugins/slots/subagents.8bb9992c-ChTnezHO.js +7 -0
- package/dist/assets/plugins/slots/template-advanced.59f3f98a-VbYOjCWb.js +1 -0
- package/dist/assets/plugins/slots/template-desktop.0f0b8491-D_LDs6R3.js +7 -0
- package/dist/assets/plugins/slots/template-elegant.0e3b0acf-C_Aw5CVD.js +1 -0
- package/dist/assets/plugins/slots/vault.3cbfcdc3-BLLijqYx.js +1 -0
- package/dist/assets/plugins/slots/voice.a952113d-0N-vCkeV.js +1 -0
- package/dist/assets/plugins/slots/web-search.65013836-DSo04wY4.js +1 -0
- package/dist/assets/plugins/slots/workflows.cbc5c5c0-pDf69-fN.js +16 -0
- package/dist/{index.edge-B0YYwNF0.js → index.edge-CSOYqxQ2.js} +2 -1
- package/dist/{server-CCqvf6yh.js → server-BKJC6UYx.js} +1 -2
- package/dist/{server-1LZR9ZRX.js → server-BOiCHhpU.js} +1 -1
- package/dist/{server-D97tm0wK.js → server-BQxIPMSa.js} +2 -3
- package/dist/{server-DhuzpcVR.js → server-BVW5OV5j.js} +1 -1
- package/dist/{server-3HPXqwI6.js → server-C8gWYGFl.js} +1 -1
- package/dist/{server-rIQkmCUx.js → server-CFLUZq0Z.js} +1 -1
- package/dist/{server-DSe28Ebi.js → server-CGUm_4c6.js} +1 -1
- package/dist/{server-Nb7tgHv2.js → server-CjL_6u1x.js} +1 -1
- package/dist/{server-DNtprCHS.js → server-CkBvJEiI.js} +2 -2
- package/dist/{server-COD1HYtb.js → server-CyiKrR7j.js} +1 -1
- package/dist/{server-38vPt49q.js → server-DBN_CZxx.js} +1 -1
- package/dist/{server-DeBXj3re.js → server-DKFXelb3.js} +2 -2
- package/dist/{server-B7ow4_os.js → server-DOI9mJ00.js} +1 -1
- package/dist/{server-bO3F28gq.js → server-D_v7Nt6L.js} +1 -1
- package/dist/{server-D_0XHzYJ.js → server-DjBZj5Be.js} +1 -1
- package/dist/{server-SR4ElcIH.js → server-DpuKPbyY.js} +1 -1
- package/dist/{server-CqsGbX44.js → server-DrbaM9P2.js} +2 -3
- package/dist/{server-KzfsJGF8.js → server-DykrhovZ.js} +1 -1
- package/dist/{server-CR3v0zcN.js → server-EPw6De2W.js} +2 -2
- package/dist/{server-B_g35a-5.js → server-FD4p5fz5.js} +1 -1
- package/dist/{server-D1_V9Vmd.js → server-XTBK1WrD.js} +1 -1
- package/dist/server-c93sCvo3.js +466 -0
- package/dist/{server-B7FH93rx.js → server-g9_wMnMD.js} +1 -1
- package/dist/worker.js +267 -122
- package/package.json +48 -43
- package/dist/apiContracts-C5xYJZfw.js +0 -561
- package/dist/assets/assets/channel-BDLbYxu3.js +0 -2
- package/dist/assets/assets/chunk-XXDRQBXY-D9IZWvba.js +0 -2
- package/dist/assets/assets/flowDiagram-IUGLLWBU-9R5zxYVV.js +0 -1
- package/dist/assets/assets/index-Dus9Cw5p.js +0 -256
- package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-coH9laQJ.js +0 -9
- package/dist/assets/plugins/assets/base-ByEdw6HI.css +0 -2
- package/dist/assets/plugins/chunks/po-web-runtime-DZvTbTGl.js +0 -1
- package/dist/assets/plugins/slots/approval.72ae703a-MJpYBBW3.js +0 -2
- package/dist/assets/plugins/slots/artifacts.77a5ce89-BqGpkxIz.js +0 -1
- package/dist/assets/plugins/slots/author.1714bd0b-vpvWaIsO.js +0 -93
- package/dist/assets/plugins/slots/backdrop-bamboo.8ee8a555-Djii7v-K.js +0 -1
- package/dist/assets/plugins/slots/browse.59782354-BCYYZIGg.js +0 -1
- package/dist/assets/plugins/slots/builtin-tools.abc3edcc-QrPdFMQO.js +0 -7
- package/dist/assets/plugins/slots/calendar.d83ca386-BsY3VUmV.js +0 -2
- package/dist/assets/plugins/slots/codemode.c68822dc-BUQr5ZVr.js +0 -11
- package/dist/assets/plugins/slots/domain.d3fc60b5-CG6iqO2H.js +0 -1
- package/dist/assets/plugins/slots/edit.2aa43041-Bkj7M18J.js +0 -7
- package/dist/assets/plugins/slots/files.c1e584ee-CxGGfZ7q.js +0 -2
- package/dist/assets/plugins/slots/goal.0d58b5cd-B93fwx0M.js +0 -1
- package/dist/assets/plugins/slots/grep.b067b8cb-BH487fbj.js +0 -1
- package/dist/assets/plugins/slots/help.e5f29767-Cc-1UAi2.js +0 -3
- package/dist/assets/plugins/slots/log.24faf8a0-BmKGSUhs.js +0 -4
- package/dist/assets/plugins/slots/mcp.a6805ffa-B1pF9U1U.js +0 -55
- package/dist/assets/plugins/slots/plan.cf1a06d8-Bp6s-HU-.js +0 -3
- package/dist/assets/plugins/slots/read.a43eeb4a-D8J587IR.js +0 -1
- package/dist/assets/plugins/slots/runner.03b699da-kZzobG85.js +0 -9
- package/dist/assets/plugins/slots/scaffold.f3763f9c-DSiG8h1F.js +0 -1
- package/dist/assets/plugins/slots/sessions.dc7ce5f8-Pqp4CAW1.js +0 -1
- package/dist/assets/plugins/slots/skill.2b6ba429-BPCu7SmU.js +0 -4
- package/dist/assets/plugins/slots/space.a8901278-DmJaW-f6.js +0 -1
- package/dist/assets/plugins/slots/subagents.6f67a972-9xrGKpLe.js +0 -7
- package/dist/assets/plugins/slots/vault.593b32bd-BOhqzgok.js +0 -1
- package/dist/assets/plugins/slots/voice.fa8f3d31-PQ3c795m.js +0 -1
- package/dist/assets/plugins/slots/workflows.41d5eec7-DACCrvVZ.js +0 -16
- package/dist/presets-JqH9Fwy9.js +0 -1
- package/dist/sessionApiContracts-BDVrjHG1.js +0 -1157
|
@@ -0,0 +1,1715 @@
|
|
|
1
|
+
import { $ as _Object_, B as Omit, G as Number$1, H as Tuple, J as Integer, K as Null, Q as Unknown, U as Union, V as Record, W as String, X as Intersect, Y as Boolean, Z as Unsafe, et as Optional$3, q as Literal, s as definePoContract, tt as _Array_, z as Partial } from "./serverPlugin-CjaTvpLx.js";
|
|
2
|
+
import { n as PoPluginWireCallSchema, t as PO_WIRE_HOST_SCOPE } from "./pluginProtocol-D4EljPZv.js";
|
|
3
|
+
import "./pluginCatalog-BAALyedS.js";
|
|
4
|
+
//#region ../../core/po-core/src/schemas/protocolChannelsContract.ts
|
|
5
|
+
const Json$4 = Unsafe({});
|
|
6
|
+
const ChannelFrameSchema = _Object_({
|
|
7
|
+
type: String({ minLength: 1 }),
|
|
8
|
+
payload: Json$4
|
|
9
|
+
});
|
|
10
|
+
/** Latest payload per extension channel frame type. */
|
|
11
|
+
const PoChannelsStateSchema = Record(String(), Json$4);
|
|
12
|
+
/** A session's extension channels as seen by one connection. */
|
|
13
|
+
const PoChannelsContract = definePoContract("po.channels", {
|
|
14
|
+
version: 1,
|
|
15
|
+
params: { sessionId: String({ minLength: 1 }) },
|
|
16
|
+
state: { latest: PoChannelsStateSchema },
|
|
17
|
+
methods: { receive: { args: ChannelFrameSchema } }
|
|
18
|
+
});
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region ../../core/po-core/src/constants/contextApi.ts
|
|
21
|
+
/**
|
|
22
|
+
* What one entry in the composition actually is, for a reader who clicked it.
|
|
23
|
+
*
|
|
24
|
+
* The projection prices the composition and stops there: names, owners, and
|
|
25
|
+
* integer counts, small enough to republish whenever the composition changes.
|
|
26
|
+
* The prose and the schema behind a figure are an order of magnitude larger and
|
|
27
|
+
* are wanted one row at a time, so they travel on request instead. This module
|
|
28
|
+
* is the contract both ends of that request share, and it is deliberately free
|
|
29
|
+
* of Node imports so a browser can hold it too.
|
|
30
|
+
*/
|
|
31
|
+
/** Where a host mounts this package's API; the segment after /api/plugins/. */
|
|
32
|
+
const API_BASE_PATH = "context";
|
|
33
|
+
const ITEM_ROUTE = "/item";
|
|
34
|
+
const CURRENT_ROUTE = "/current";
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region ../../core/po-core/src/schemas/httpApiContracts.ts
|
|
37
|
+
const Text$3 = String();
|
|
38
|
+
const Optional$2 = Optional$3;
|
|
39
|
+
const Strings$1 = _Array_(Text$3);
|
|
40
|
+
const Flag$2 = Boolean();
|
|
41
|
+
const NumberValue$2 = Number$1();
|
|
42
|
+
const ApiErrorSchema = _Object_({
|
|
43
|
+
error: Text$3,
|
|
44
|
+
hash: Optional$2(Text$3)
|
|
45
|
+
});
|
|
46
|
+
const ApiOkSchema = _Object_({ ok: Literal(true) });
|
|
47
|
+
const Json$3 = Unknown({ description: "Value whose schema is supplied by the selected runtime contribution." });
|
|
48
|
+
/** Common JSON response construction; status and payload remain explicit at the declaration. */
|
|
49
|
+
function jsonApiResponses(schema, status = 200) {
|
|
50
|
+
return {
|
|
51
|
+
[status]: {
|
|
52
|
+
description: "Successful response",
|
|
53
|
+
contentType: "application/json",
|
|
54
|
+
schema
|
|
55
|
+
},
|
|
56
|
+
"400": {
|
|
57
|
+
description: "Invalid request",
|
|
58
|
+
schema: ApiErrorSchema
|
|
59
|
+
},
|
|
60
|
+
"401": {
|
|
61
|
+
description: "Authentication required",
|
|
62
|
+
schema: ApiErrorSchema
|
|
63
|
+
},
|
|
64
|
+
"403": {
|
|
65
|
+
description: "Request is not authorized",
|
|
66
|
+
schema: ApiErrorSchema
|
|
67
|
+
},
|
|
68
|
+
"404": {
|
|
69
|
+
description: "Resource or capability unavailable",
|
|
70
|
+
schema: ApiErrorSchema
|
|
71
|
+
},
|
|
72
|
+
"409": {
|
|
73
|
+
description: "Conflicting state",
|
|
74
|
+
schema: ApiErrorSchema
|
|
75
|
+
},
|
|
76
|
+
"422": {
|
|
77
|
+
description: "Invalid operation",
|
|
78
|
+
schema: ApiErrorSchema
|
|
79
|
+
},
|
|
80
|
+
"500": {
|
|
81
|
+
description: "Host operation failed",
|
|
82
|
+
schema: ApiErrorSchema
|
|
83
|
+
},
|
|
84
|
+
"502": {
|
|
85
|
+
description: "Provider failed",
|
|
86
|
+
schema: ApiErrorSchema
|
|
87
|
+
},
|
|
88
|
+
"503": {
|
|
89
|
+
description: "Service unavailable",
|
|
90
|
+
schema: ApiErrorSchema
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
const WebCompositionSchema = _Object_({
|
|
95
|
+
id: Text$3,
|
|
96
|
+
scope: Union([
|
|
97
|
+
Literal(PO_WIRE_HOST_SCOPE),
|
|
98
|
+
Literal("workspace"),
|
|
99
|
+
Literal("session")
|
|
100
|
+
]),
|
|
101
|
+
revision: NumberValue$2,
|
|
102
|
+
manifestUrl: Text$3,
|
|
103
|
+
rawAssetBaseUrl: Text$3,
|
|
104
|
+
verifiedAssetBaseUrl: Text$3,
|
|
105
|
+
pluginEntries: _Array_(Tuple([Text$3, Text$3])),
|
|
106
|
+
assetPaths: Strings$1,
|
|
107
|
+
stylePaths: Strings$1,
|
|
108
|
+
channels: Strings$1
|
|
109
|
+
});
|
|
110
|
+
const NativeCompositionSchema = _Object_({
|
|
111
|
+
id: Text$3,
|
|
112
|
+
scope: Union([
|
|
113
|
+
Literal(PO_WIRE_HOST_SCOPE),
|
|
114
|
+
Literal("workspace"),
|
|
115
|
+
Literal("session")
|
|
116
|
+
]),
|
|
117
|
+
revision: NumberValue$2,
|
|
118
|
+
manifestUrl: Text$3,
|
|
119
|
+
rawAssetBaseUrl: Text$3,
|
|
120
|
+
pluginEntries: _Array_(Tuple([Text$3, Text$3])),
|
|
121
|
+
uiEntry: Optional$2(Text$3),
|
|
122
|
+
channels: Strings$1,
|
|
123
|
+
plugins: Strings$1
|
|
124
|
+
});
|
|
125
|
+
/** A configured template id and the mount whose compositions offer it. */
|
|
126
|
+
const TemplateDecisionSchema = _Object_({
|
|
127
|
+
id: Optional$2(Text$3),
|
|
128
|
+
mount: Union([_Object_({ scope: Literal(PO_WIRE_HOST_SCOPE) }), _Object_({
|
|
129
|
+
scope: Literal("workspace"),
|
|
130
|
+
workspaceId: Text$3
|
|
131
|
+
})])
|
|
132
|
+
});
|
|
133
|
+
const SessionSummarySchema = _Object_({
|
|
134
|
+
id: Text$3,
|
|
135
|
+
workspaceId: Optional$2(Text$3),
|
|
136
|
+
webComposition: Optional$2(WebCompositionSchema),
|
|
137
|
+
nativeComposition: Optional$2(NativeCompositionSchema),
|
|
138
|
+
name: Text$3,
|
|
139
|
+
cwd: Text$3,
|
|
140
|
+
createdAt: Text$3,
|
|
141
|
+
updatedAt: Text$3,
|
|
142
|
+
phase: Union([
|
|
143
|
+
Literal("idle"),
|
|
144
|
+
Literal("turn"),
|
|
145
|
+
Literal("compaction"),
|
|
146
|
+
Literal("retry")
|
|
147
|
+
]),
|
|
148
|
+
phaseSince: Text$3,
|
|
149
|
+
attach: Literal("attached"),
|
|
150
|
+
pendingMessageCount: NumberValue$2,
|
|
151
|
+
everPrompted: Flag$2,
|
|
152
|
+
awaitingInput: Flag$2,
|
|
153
|
+
lastSettledAt: Optional$2(Text$3),
|
|
154
|
+
git: Optional$2(_Object_({
|
|
155
|
+
branch: Text$3,
|
|
156
|
+
dirty: Flag$2
|
|
157
|
+
})),
|
|
158
|
+
profile: Optional$2(_Object_({
|
|
159
|
+
name: Text$3,
|
|
160
|
+
displayName: Optional$2(Text$3),
|
|
161
|
+
iconVersion: Optional$2(Text$3)
|
|
162
|
+
})),
|
|
163
|
+
parentSessionId: Optional$2(Text$3),
|
|
164
|
+
sessionProvenance: Optional$2(Text$3),
|
|
165
|
+
interaction: Optional$2(Union([Literal("interactive"), Literal("unattended")])),
|
|
166
|
+
/** The line the session's extension published about background work it runs. */
|
|
167
|
+
activity: Optional$2(_Object_({
|
|
168
|
+
label: Text$3,
|
|
169
|
+
attention: Optional$2(Flag$2),
|
|
170
|
+
since: Optional$2(Text$3)
|
|
171
|
+
})),
|
|
172
|
+
/** Tool calls waiting for the person's approval. */
|
|
173
|
+
pendingApprovalCount: Optional$2(Integer({ minimum: 1 })),
|
|
174
|
+
pendingSetups: Optional$2(_Array_(_Object_({
|
|
175
|
+
id: Text$3,
|
|
176
|
+
name: Text$3,
|
|
177
|
+
createdAt: Text$3,
|
|
178
|
+
cwd: Optional$2(Text$3),
|
|
179
|
+
setupKind: Optional$2(Union([Literal("managed-worktree"), Literal("existing-directory")])),
|
|
180
|
+
status: Optional$2(Union([
|
|
181
|
+
Literal("provisioning"),
|
|
182
|
+
Literal("failed"),
|
|
183
|
+
Literal("interrupted")
|
|
184
|
+
])),
|
|
185
|
+
errorCode: Optional$2(Union([Literal("SESSION_WORKTREE_PROVISION_FAILED"), Literal("SESSION_UNAVAILABLE")]))
|
|
186
|
+
}))),
|
|
187
|
+
groups: Optional$2(Strings$1),
|
|
188
|
+
backgroundWorkActive: Optional$2(Flag$2),
|
|
189
|
+
/** Present and true for a recorded session the server has not reopened yet. */
|
|
190
|
+
dormant: Optional$2(Flag$2)
|
|
191
|
+
});
|
|
192
|
+
const WorkspaceSchema = _Object_({
|
|
193
|
+
kind: Optional$2(Literal("session")),
|
|
194
|
+
instructions: Optional$2(Text$3),
|
|
195
|
+
id: Text$3,
|
|
196
|
+
root: Text$3,
|
|
197
|
+
name: Optional$2(Text$3),
|
|
198
|
+
available: Optional$2(Flag$2),
|
|
199
|
+
sandbox: Optional$2(Text$3),
|
|
200
|
+
/**
|
|
201
|
+
* The sandbox's state, live: `starting` while it starts or sessions move in, `running` once the host is linked,
|
|
202
|
+
* `stopping` while it is switched off, `failed` when a start or a switch failed, `unavailable` when its provider
|
|
203
|
+
* cannot run it. On a workspace without `sandbox`, `unavailable` means the sandbox provider cannot run it now, so
|
|
204
|
+
* it cannot be switched on; absent means nothing stands in the way.
|
|
205
|
+
*/
|
|
206
|
+
sandboxState: Optional$2(Union([
|
|
207
|
+
Literal("starting"),
|
|
208
|
+
Literal("running"),
|
|
209
|
+
Literal("stopping"),
|
|
210
|
+
Literal("unavailable"),
|
|
211
|
+
Literal("failed")
|
|
212
|
+
])),
|
|
213
|
+
/** A plain sentence for `failed` or `unavailable`, such as 'Docker is not running.'. */
|
|
214
|
+
sandboxReason: Optional$2(Text$3)
|
|
215
|
+
});
|
|
216
|
+
const SavedSession = _Object_({
|
|
217
|
+
id: Text$3,
|
|
218
|
+
name: Optional$2(Text$3),
|
|
219
|
+
firstMessage: Text$3,
|
|
220
|
+
createdAt: Text$3,
|
|
221
|
+
updatedAt: Text$3
|
|
222
|
+
});
|
|
223
|
+
const query = (name, schema = Text$3, required = false) => ({
|
|
224
|
+
name,
|
|
225
|
+
in: "query",
|
|
226
|
+
required,
|
|
227
|
+
schema
|
|
228
|
+
});
|
|
229
|
+
const body = (schema) => ({
|
|
230
|
+
contentType: "application/json",
|
|
231
|
+
required: true,
|
|
232
|
+
schema
|
|
233
|
+
});
|
|
234
|
+
const host = (id, path, method, result, extra = {}) => ({
|
|
235
|
+
id,
|
|
236
|
+
path,
|
|
237
|
+
method,
|
|
238
|
+
scope: "host",
|
|
239
|
+
authentication: "owner",
|
|
240
|
+
description: id,
|
|
241
|
+
responses: jsonApiResponses(result),
|
|
242
|
+
...extra
|
|
243
|
+
});
|
|
244
|
+
const Principal = _Object_({
|
|
245
|
+
issuer: Text$3,
|
|
246
|
+
subject: Text$3
|
|
247
|
+
});
|
|
248
|
+
const ProviderGrant = _Object_({
|
|
249
|
+
tag: Literal("po/grant/v1"),
|
|
250
|
+
signature: Text$3,
|
|
251
|
+
payload: _Object_({
|
|
252
|
+
issuer: Text$3,
|
|
253
|
+
subject: Text$3,
|
|
254
|
+
grantId: Text$3,
|
|
255
|
+
deviceKeyId: Text$3,
|
|
256
|
+
networkId: Text$3,
|
|
257
|
+
workspaceId: Text$3,
|
|
258
|
+
callingHostId: Text$3,
|
|
259
|
+
targetHostId: Text$3,
|
|
260
|
+
operations: Strings$1,
|
|
261
|
+
constraints: Record(Text$3, Union([
|
|
262
|
+
Text$3,
|
|
263
|
+
NumberValue$2,
|
|
264
|
+
Flag$2,
|
|
265
|
+
Null()
|
|
266
|
+
])),
|
|
267
|
+
issuedAt: NumberValue$2,
|
|
268
|
+
notBefore: NumberValue$2,
|
|
269
|
+
expiresAt: NumberValue$2,
|
|
270
|
+
redelegable: Literal(false),
|
|
271
|
+
revocationEpoch: Optional$2(NumberValue$2)
|
|
272
|
+
})
|
|
273
|
+
});
|
|
274
|
+
const ProviderConsent = _Object_({
|
|
275
|
+
workspaceId: Text$3,
|
|
276
|
+
providerHostId: Text$3,
|
|
277
|
+
packageName: Text$3,
|
|
278
|
+
owner: Principal,
|
|
279
|
+
grants: _Array_(ProviderGrant, {
|
|
280
|
+
minItems: 2,
|
|
281
|
+
maxItems: 2
|
|
282
|
+
}),
|
|
283
|
+
createdAt: NumberValue$2,
|
|
284
|
+
expiresAt: NumberValue$2
|
|
285
|
+
});
|
|
286
|
+
const ConsentCandidate = _Object_({
|
|
287
|
+
hostId: Text$3,
|
|
288
|
+
packageName: Text$3,
|
|
289
|
+
version: Text$3,
|
|
290
|
+
operations: Strings$1,
|
|
291
|
+
manifestExpiresAt: NumberValue$2
|
|
292
|
+
});
|
|
293
|
+
const ConsentWorkspaceParameter = {
|
|
294
|
+
name: "workspaceId",
|
|
295
|
+
in: "path",
|
|
296
|
+
required: true,
|
|
297
|
+
schema: Text$3
|
|
298
|
+
};
|
|
299
|
+
const Binary = String({ contentEncoding: "binary" });
|
|
300
|
+
const headlessHttpContracts = [
|
|
301
|
+
host("health", "/api/health", "GET", _Object_({
|
|
302
|
+
ok: Literal(true),
|
|
303
|
+
role: Literal("hub"),
|
|
304
|
+
protocol: Literal(1),
|
|
305
|
+
sessions: NumberValue$2
|
|
306
|
+
}), { authentication: "none" }),
|
|
307
|
+
host("telemetry.browser", "/api/telemetry/browser", "POST", ApiOkSchema, { body: body(_Object_({
|
|
308
|
+
v: Literal(1),
|
|
309
|
+
events: _Array_(_Object_({
|
|
310
|
+
name: String({ pattern: "^web\\.browser\\.[a-z_]{1,40}$" }),
|
|
311
|
+
duration_ms: Optional$2(NumberValue$2),
|
|
312
|
+
count: Optional$2(NumberValue$2),
|
|
313
|
+
level: Optional$2(Literal("warn")),
|
|
314
|
+
attributes: Optional$2(Record(String({ pattern: "^[a-z_]{1,32}$" }), Union([String({ maxLength: 256 }), NumberValue$2]), { maxProperties: 12 }))
|
|
315
|
+
}), { maxItems: 10 })
|
|
316
|
+
})) }),
|
|
317
|
+
host("compositions", "/api/compositions", "GET", _Object_({
|
|
318
|
+
network: Optional$2(_Object_({
|
|
319
|
+
hostId: Text$3,
|
|
320
|
+
networkId: Text$3,
|
|
321
|
+
enrollmentGeneration: Optional$2(NumberValue$2)
|
|
322
|
+
})),
|
|
323
|
+
/** The computer's own name, which phones show instead of a tunnel address. */
|
|
324
|
+
displayName: Optional$2(Text$3),
|
|
325
|
+
host: Optional$2(WebCompositionSchema),
|
|
326
|
+
nativeHost: Optional$2(NativeCompositionSchema),
|
|
327
|
+
publicKey: Optional$2(Text$3),
|
|
328
|
+
shell: Optional$2(_Object_({
|
|
329
|
+
publicKey: Text$3,
|
|
330
|
+
revision: NumberValue$2
|
|
331
|
+
})),
|
|
332
|
+
template: Optional$2(TemplateDecisionSchema),
|
|
333
|
+
/** The phone app's `native.template` choice, resolved the same way. */
|
|
334
|
+
nativeTemplate: Optional$2(TemplateDecisionSchema),
|
|
335
|
+
workspaces: _Array_(_Object_({
|
|
336
|
+
id: Text$3,
|
|
337
|
+
root: Text$3,
|
|
338
|
+
/** `null` for a sandboxed workspace: its plugins run in its sandbox, the host has none for it. */
|
|
339
|
+
webComposition: Optional$2(Union([WebCompositionSchema, Null()])),
|
|
340
|
+
nativeComposition: Optional$2(Union([NativeCompositionSchema, Null()])),
|
|
341
|
+
providers: Optional$2(_Array_(_Object_({
|
|
342
|
+
hostId: Text$3,
|
|
343
|
+
packageName: Text$3,
|
|
344
|
+
version: Text$3,
|
|
345
|
+
operations: _Array_(_Object_({
|
|
346
|
+
scope: Union([
|
|
347
|
+
Literal(PO_WIRE_HOST_SCOPE),
|
|
348
|
+
Literal("workspace"),
|
|
349
|
+
Literal("session")
|
|
350
|
+
]),
|
|
351
|
+
names: Strings$1
|
|
352
|
+
})),
|
|
353
|
+
provenance: Union([
|
|
354
|
+
Literal("local"),
|
|
355
|
+
Literal("own"),
|
|
356
|
+
Literal("consented")
|
|
357
|
+
]),
|
|
358
|
+
status: Union([Literal("available"), Literal("unavailable")]),
|
|
359
|
+
reason: Optional$2(Union([
|
|
360
|
+
Literal("manifest-missing"),
|
|
361
|
+
Literal("manifest-expired"),
|
|
362
|
+
Literal("roster-stale"),
|
|
363
|
+
Literal("host-removed"),
|
|
364
|
+
Literal("consent-expired")
|
|
365
|
+
])),
|
|
366
|
+
expiresAt: Optional$2(NumberValue$2)
|
|
367
|
+
})))
|
|
368
|
+
}))
|
|
369
|
+
})),
|
|
370
|
+
host("compositions.remote", "/api/compositions/remote", "GET", _Object_({
|
|
371
|
+
workspace: WebCompositionSchema,
|
|
372
|
+
session: WebCompositionSchema
|
|
373
|
+
}), {
|
|
374
|
+
parameters: [query("plugins", Text$3, true)],
|
|
375
|
+
availability: "Host has published a web build"
|
|
376
|
+
}),
|
|
377
|
+
host("network.voters.propose", "/api/network/voters", "POST", Json$3, { body: body(_Object_({
|
|
378
|
+
change: Union([_Object_({
|
|
379
|
+
network: Text$3,
|
|
380
|
+
epoch: NumberValue$2,
|
|
381
|
+
kind: Literal("add"),
|
|
382
|
+
added: Text$3,
|
|
383
|
+
addedKey: Text$3
|
|
384
|
+
}), _Object_({
|
|
385
|
+
network: Text$3,
|
|
386
|
+
epoch: NumberValue$2,
|
|
387
|
+
kind: Literal("evict"),
|
|
388
|
+
removed: Text$3
|
|
389
|
+
})]),
|
|
390
|
+
authorization: Text$3
|
|
391
|
+
})) }),
|
|
392
|
+
host("network.consents.list", "/api/network/workspaces/{workspaceId}/consents", "GET", _Object_({
|
|
393
|
+
consents: _Array_(ProviderConsent),
|
|
394
|
+
candidates: _Array_(ConsentCandidate)
|
|
395
|
+
}), { parameters: [ConsentWorkspaceParameter] }),
|
|
396
|
+
host("network.consents.approve", "/api/network/workspaces/{workspaceId}/consents", "POST", ProviderConsent, {
|
|
397
|
+
parameters: [ConsentWorkspaceParameter],
|
|
398
|
+
body: body(_Object_({
|
|
399
|
+
providerHostId: Text$3,
|
|
400
|
+
packageName: Text$3,
|
|
401
|
+
grants: _Array_(ProviderGrant, {
|
|
402
|
+
minItems: 2,
|
|
403
|
+
maxItems: 2
|
|
404
|
+
})
|
|
405
|
+
})),
|
|
406
|
+
responses: jsonApiResponses(ProviderConsent, 201)
|
|
407
|
+
}),
|
|
408
|
+
host("network.consents.revoke", "/api/network/workspaces/{workspaceId}/consents/{providerHostId}/{packageName}", "DELETE", Null(), {
|
|
409
|
+
parameters: [
|
|
410
|
+
ConsentWorkspaceParameter,
|
|
411
|
+
{
|
|
412
|
+
name: "providerHostId",
|
|
413
|
+
in: "path",
|
|
414
|
+
required: true,
|
|
415
|
+
schema: Text$3
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
name: "packageName",
|
|
419
|
+
in: "path",
|
|
420
|
+
required: true,
|
|
421
|
+
schema: Text$3
|
|
422
|
+
}
|
|
423
|
+
],
|
|
424
|
+
responses: { "204": { description: "Provider consent revoked" } }
|
|
425
|
+
}),
|
|
426
|
+
host("directories", "/api/directories", "GET", _Object_({ directories: Strings$1 }), { parameters: [query("q")] }),
|
|
427
|
+
host("directories.children", "/api/directories/children", "GET", _Object_({
|
|
428
|
+
path: Text$3,
|
|
429
|
+
parent: Optional$2(Text$3),
|
|
430
|
+
directories: Strings$1
|
|
431
|
+
}), { parameters: [query("path")] }),
|
|
432
|
+
host("directories.workspaces", "/api/directories/workspaces", "GET", _Object_({
|
|
433
|
+
root: Text$3,
|
|
434
|
+
declarations: _Array_(_Object_({
|
|
435
|
+
name: Text$3,
|
|
436
|
+
instructions: Optional$2(Text$3),
|
|
437
|
+
workspaceId: Optional$2(Text$3)
|
|
438
|
+
}))
|
|
439
|
+
}), {
|
|
440
|
+
parameters: [query("path")],
|
|
441
|
+
availability: "Host provides declaredWorkspaces"
|
|
442
|
+
}),
|
|
443
|
+
host("directories.po", "/api/directories/po", "GET", _Object_({ directories: Strings$1 })),
|
|
444
|
+
host("sessions.list", "/api/workspaces/{workspaceId}/sessions", "GET", _Object_({ sessions: _Array_(SessionSummarySchema) })),
|
|
445
|
+
host("sessions.create", "/api/workspaces/{workspaceId}/sessions", "POST", _Object_({ sessionId: Text$3 }), {
|
|
446
|
+
body: body(_Object_({ name: Optional$2(Text$3) })),
|
|
447
|
+
responses: jsonApiResponses(_Object_({ sessionId: Text$3 }), 201)
|
|
448
|
+
}),
|
|
449
|
+
host("sessions.createGeneral", "/api/sessions", "POST", _Object_({
|
|
450
|
+
sessionId: Text$3,
|
|
451
|
+
workspace: Optional$2(WorkspaceSchema),
|
|
452
|
+
session: Optional$2(SessionSummarySchema)
|
|
453
|
+
}), {
|
|
454
|
+
body: body(_Object_({
|
|
455
|
+
name: Optional$2(Text$3),
|
|
456
|
+
cwd: Optional$2(String({ minLength: 1 }))
|
|
457
|
+
})),
|
|
458
|
+
availability: "Host provides createGeneralSession when cwd is omitted; explicit cwd remains supported for compatibility",
|
|
459
|
+
responses: jsonApiResponses(_Object_({
|
|
460
|
+
sessionId: Text$3,
|
|
461
|
+
workspace: Optional$2(WorkspaceSchema),
|
|
462
|
+
session: Optional$2(SessionSummarySchema)
|
|
463
|
+
}), 201)
|
|
464
|
+
}),
|
|
465
|
+
host("coordinators.home", "/api/coordinators/home", "POST", _Object_({
|
|
466
|
+
sessionId: Text$3,
|
|
467
|
+
created: Boolean()
|
|
468
|
+
}), {
|
|
469
|
+
body: body(_Object_({
|
|
470
|
+
profile: String({ minLength: 1 }),
|
|
471
|
+
model: Optional$2(String({ minLength: 1 })),
|
|
472
|
+
name: String({ minLength: 1 })
|
|
473
|
+
}, { additionalProperties: false })),
|
|
474
|
+
availability: "Host provides ensureHomeCoordinator; otherwise 501"
|
|
475
|
+
}),
|
|
476
|
+
host("coordinators.add", "/api/coordinators", "POST", _Object_({
|
|
477
|
+
sessionId: Text$3,
|
|
478
|
+
created: Boolean()
|
|
479
|
+
}), {
|
|
480
|
+
body: body(_Object_({
|
|
481
|
+
workspaceId: Optional$2(String({ minLength: 1 })),
|
|
482
|
+
profile: Optional$2(String({
|
|
483
|
+
minLength: 1,
|
|
484
|
+
pattern: "\\S"
|
|
485
|
+
}))
|
|
486
|
+
}, { additionalProperties: false })),
|
|
487
|
+
responses: {
|
|
488
|
+
...jsonApiResponses(_Object_({
|
|
489
|
+
sessionId: Text$3,
|
|
490
|
+
created: Boolean()
|
|
491
|
+
})),
|
|
492
|
+
"422": {
|
|
493
|
+
description: "Profile required or invalid operation",
|
|
494
|
+
schema: Union([_Object_({
|
|
495
|
+
profileRequired: Literal(true),
|
|
496
|
+
error: Text$3
|
|
497
|
+
}), ApiErrorSchema])
|
|
498
|
+
}
|
|
499
|
+
},
|
|
500
|
+
availability: "Host provides addCoordinator; otherwise 501"
|
|
501
|
+
}),
|
|
502
|
+
host("sessions.get", "/api/workspaces/{workspaceId}/sessions/{sessionId}", "GET", SessionSummarySchema),
|
|
503
|
+
host("sessions.delete", "/api/workspaces/{workspaceId}/sessions/{sessionId}", "DELETE", ApiOkSchema),
|
|
504
|
+
host("sessions.history", "/api/workspaces/{workspaceId}/sessions/{sessionId}/history", "GET", _Object_({ sessions: _Array_(SavedSession) }), { availability: "Host provides sessionHistory" }),
|
|
505
|
+
host("sessions.restart", "/api/workspaces/{workspaceId}/sessions/{sessionId}/restart", "POST", ApiOkSchema, { availability: "Host provides restartSession" }),
|
|
506
|
+
host("sessions.move", "/api/workspaces/{workspaceId}/sessions/{sessionId}/move", "POST", ApiOkSchema, {
|
|
507
|
+
body: body(_Object_({ workspaceId: String({
|
|
508
|
+
minLength: 1,
|
|
509
|
+
pattern: "\\S"
|
|
510
|
+
}) }, { additionalProperties: false })),
|
|
511
|
+
availability: "Host provides moveSession; otherwise 501",
|
|
512
|
+
responses: {
|
|
513
|
+
...jsonApiResponses(ApiOkSchema),
|
|
514
|
+
"501": {
|
|
515
|
+
description: "Host does not support session moves",
|
|
516
|
+
schema: ApiErrorSchema
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}),
|
|
520
|
+
host("sessions.role", "/api/workspaces/{workspaceId}/sessions/{sessionId}/role", "POST", ApiOkSchema, {
|
|
521
|
+
body: body(_Object_({ coordinator: Boolean() }, { additionalProperties: false })),
|
|
522
|
+
availability: "Host provides setSessionRole"
|
|
523
|
+
}),
|
|
524
|
+
host("sessions.revive", "/api/workspaces/{workspaceId}/sessions/{sessionId}/revive", "POST", ApiOkSchema, { availability: "Host provides reviveSession" }),
|
|
525
|
+
host("sessions.resume", "/api/workspaces/{workspaceId}/sessions/{sessionId}/resume", "POST", _Object_({ sessionId: Text$3 }), {
|
|
526
|
+
availability: "Host provides resumeSession",
|
|
527
|
+
body: body(_Object_({ targetSessionId: String({ pattern: "^[A-Za-z0-9_-]+$" }) }))
|
|
528
|
+
}),
|
|
529
|
+
host("sessions.file", "/api/workspaces/{workspaceId}/sessions/{sessionId}/file", "GET", Binary, {
|
|
530
|
+
parameters: [query("path", Text$3, true)],
|
|
531
|
+
responses: {
|
|
532
|
+
...jsonApiResponses(Binary),
|
|
533
|
+
"200": {
|
|
534
|
+
description: "File bytes, MIME type follows the file extension",
|
|
535
|
+
contentType: "*/*",
|
|
536
|
+
schema: Binary
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}),
|
|
540
|
+
host("workspaces.list", "/api/workspaces", "GET", _Object_({ workspaces: _Array_(WorkspaceSchema) })),
|
|
541
|
+
host("workspaces.admit", "/api/workspaces", "POST", _Object_({ workspace: WorkspaceSchema }), {
|
|
542
|
+
body: body(_Object_({
|
|
543
|
+
root: Optional$2(Text$3),
|
|
544
|
+
name: Optional$2(Text$3),
|
|
545
|
+
declaration: Optional$2(Text$3),
|
|
546
|
+
instructions: Optional$2(Text$3)
|
|
547
|
+
})),
|
|
548
|
+
responses: jsonApiResponses(_Object_({ workspace: WorkspaceSchema }), 201)
|
|
549
|
+
}),
|
|
550
|
+
host("workspaces.get", "/api/workspaces/{workspaceId}", "GET", _Object_({ workspace: WorkspaceSchema })),
|
|
551
|
+
host("workspaces.history", "/api/workspaces/{workspaceId}/history", "GET", _Object_({ sessions: _Array_(SavedSession) }), { availability: "Host provides workspaceHistory" }),
|
|
552
|
+
host("workspaces.resume", "/api/workspaces/{workspaceId}/resume", "POST", _Object_({ sessionId: Text$3 }), {
|
|
553
|
+
availability: "Host provides resumeWorkspaceSession",
|
|
554
|
+
body: body(_Object_({ targetSessionId: String({ pattern: "^[A-Za-z0-9_-]+$" }) }))
|
|
555
|
+
}),
|
|
556
|
+
host("workspaces.removed", "/api/workspaces/{workspaceId}/removed", "GET", _Object_({ sessions: _Array_(Intersect([SavedSession, _Object_({
|
|
557
|
+
removedAt: Text$3,
|
|
558
|
+
purgeAt: Text$3
|
|
559
|
+
})])) }), { availability: "Host provides removedSessions" }),
|
|
560
|
+
host("workspaces.restoreRemoved", "/api/workspaces/{workspaceId}/removed/{sessionId}/restore", "POST", ApiOkSchema, { availability: "Host provides restoreRemovedSession" }),
|
|
561
|
+
host("workspaces.setSandbox", "/api/workspaces/{workspaceId}", "PATCH", _Object_({ workspace: WorkspaceSchema }), {
|
|
562
|
+
availability: "Host provides setWorkspaceSandbox or setWorkspaceInstructions",
|
|
563
|
+
body: body(Union([_Object_({ sandbox: Union([Text$3, Null()]) }, { additionalProperties: false }), _Object_({ instructions: Text$3 }, { additionalProperties: false })]))
|
|
564
|
+
}),
|
|
565
|
+
host("workspaces.remove", "/api/workspaces/{workspaceId}", "DELETE", ApiOkSchema)
|
|
566
|
+
];
|
|
567
|
+
const AuthType = Union([Literal("api_key"), Literal("oauth")]);
|
|
568
|
+
const Provider = _Object_({
|
|
569
|
+
id: Text$3,
|
|
570
|
+
name: Text$3,
|
|
571
|
+
methods: _Array_(_Object_({
|
|
572
|
+
type: AuthType,
|
|
573
|
+
label: Text$3
|
|
574
|
+
})),
|
|
575
|
+
authenticated: Optional$2(_Object_({
|
|
576
|
+
type: AuthType,
|
|
577
|
+
source: Optional$2(Text$3)
|
|
578
|
+
}))
|
|
579
|
+
});
|
|
580
|
+
const LoginEvent = Union([
|
|
581
|
+
_Object_({
|
|
582
|
+
type: Literal("info"),
|
|
583
|
+
message: Text$3,
|
|
584
|
+
links: Optional$2(_Array_(_Object_({
|
|
585
|
+
url: Text$3,
|
|
586
|
+
label: Optional$2(Text$3)
|
|
587
|
+
})))
|
|
588
|
+
}),
|
|
589
|
+
_Object_({
|
|
590
|
+
type: Literal("auth_url"),
|
|
591
|
+
url: Text$3,
|
|
592
|
+
instructions: Optional$2(Text$3)
|
|
593
|
+
}),
|
|
594
|
+
_Object_({
|
|
595
|
+
type: Literal("device_code"),
|
|
596
|
+
userCode: Text$3,
|
|
597
|
+
verificationUri: Text$3,
|
|
598
|
+
intervalSeconds: Optional$2(NumberValue$2),
|
|
599
|
+
expiresInSeconds: Optional$2(NumberValue$2)
|
|
600
|
+
}),
|
|
601
|
+
_Object_({
|
|
602
|
+
type: Literal("progress"),
|
|
603
|
+
message: Text$3
|
|
604
|
+
})
|
|
605
|
+
]);
|
|
606
|
+
const LoginFlowSchema = _Object_({
|
|
607
|
+
id: Text$3,
|
|
608
|
+
providerId: Text$3,
|
|
609
|
+
providerName: Text$3,
|
|
610
|
+
type: AuthType,
|
|
611
|
+
status: Union([
|
|
612
|
+
Literal("running"),
|
|
613
|
+
Literal("succeeded"),
|
|
614
|
+
Literal("failed"),
|
|
615
|
+
Literal("cancelled")
|
|
616
|
+
]),
|
|
617
|
+
events: _Array_(LoginEvent),
|
|
618
|
+
prompt: Optional$2(_Object_({
|
|
619
|
+
id: Text$3,
|
|
620
|
+
type: Union([
|
|
621
|
+
Literal("text"),
|
|
622
|
+
Literal("secret"),
|
|
623
|
+
Literal("select"),
|
|
624
|
+
Literal("manual_code")
|
|
625
|
+
]),
|
|
626
|
+
message: Text$3,
|
|
627
|
+
placeholder: Optional$2(Text$3),
|
|
628
|
+
options: Optional$2(_Array_(_Object_({
|
|
629
|
+
id: Text$3,
|
|
630
|
+
label: Text$3,
|
|
631
|
+
description: Optional$2(Text$3)
|
|
632
|
+
})))
|
|
633
|
+
})),
|
|
634
|
+
remote: Optional$2(Flag$2),
|
|
635
|
+
error: Optional$2(Text$3)
|
|
636
|
+
});
|
|
637
|
+
const Flow = _Object_({ flow: LoginFlowSchema });
|
|
638
|
+
const machineHttpContracts = [
|
|
639
|
+
host("providers.list", "/providers", "GET", _Object_({ providers: _Array_(Provider) })),
|
|
640
|
+
host("models.list", "/models", "GET", _Object_({ models: _Array_(_Object_({
|
|
641
|
+
value: Text$3,
|
|
642
|
+
label: Text$3,
|
|
643
|
+
group: Text$3
|
|
644
|
+
})) })),
|
|
645
|
+
host("providers.logout", "/providers/{providerId}", "DELETE", ApiOkSchema),
|
|
646
|
+
host("logins.create", "/logins", "POST", Flow, {
|
|
647
|
+
body: body(_Object_({
|
|
648
|
+
providerId: Text$3,
|
|
649
|
+
type: AuthType
|
|
650
|
+
})),
|
|
651
|
+
responses: jsonApiResponses(Flow, 201)
|
|
652
|
+
}),
|
|
653
|
+
host("logins.get", "/logins/{flowId}", "GET", Flow),
|
|
654
|
+
host("logins.cancel", "/logins/{flowId}", "DELETE", Flow),
|
|
655
|
+
host("logins.answer", "/logins/{flowId}/answer", "POST", Flow, { body: body(_Object_({
|
|
656
|
+
promptId: Text$3,
|
|
657
|
+
value: Text$3
|
|
658
|
+
})) })
|
|
659
|
+
].map((route) => ({
|
|
660
|
+
...route,
|
|
661
|
+
basePath: "po"
|
|
662
|
+
}));
|
|
663
|
+
const Source = Union([
|
|
664
|
+
Literal("extension"),
|
|
665
|
+
Literal("mcp"),
|
|
666
|
+
Literal("plugin"),
|
|
667
|
+
Literal("core")
|
|
668
|
+
]);
|
|
669
|
+
const Detail = Union([
|
|
670
|
+
_Object_({
|
|
671
|
+
itemKind: Literal("tool"),
|
|
672
|
+
name: Text$3,
|
|
673
|
+
owner: Text$3,
|
|
674
|
+
source: Source,
|
|
675
|
+
active: Flag$2,
|
|
676
|
+
tokens: _Object_({
|
|
677
|
+
schemaTokens: NumberValue$2,
|
|
678
|
+
promptTokens: NumberValue$2,
|
|
679
|
+
totalTokens: NumberValue$2
|
|
680
|
+
}),
|
|
681
|
+
description: Optional$2(Text$3),
|
|
682
|
+
promptSnippet: Optional$2(Text$3),
|
|
683
|
+
promptGuidelines: Optional$2(Strings$1),
|
|
684
|
+
parameters: Optional$2(Json$3)
|
|
685
|
+
}),
|
|
686
|
+
_Object_({
|
|
687
|
+
itemKind: Literal("skill"),
|
|
688
|
+
name: Text$3,
|
|
689
|
+
owner: Text$3,
|
|
690
|
+
source: Source,
|
|
691
|
+
active: Literal(true),
|
|
692
|
+
tokens: NumberValue$2,
|
|
693
|
+
description: Text$3,
|
|
694
|
+
filePath: Optional$2(Text$3),
|
|
695
|
+
modelInvocable: Flag$2
|
|
696
|
+
}),
|
|
697
|
+
_Object_({
|
|
698
|
+
itemKind: Literal("prompt"),
|
|
699
|
+
name: Literal("system"),
|
|
700
|
+
tokens: NumberValue$2,
|
|
701
|
+
stage: Union([Literal("base"), Literal("effective")]),
|
|
702
|
+
text: Text$3
|
|
703
|
+
})
|
|
704
|
+
]);
|
|
705
|
+
const sessionHttpContracts = [
|
|
706
|
+
{
|
|
707
|
+
...host("context.current", CURRENT_ROUTE, "GET", _Object_({
|
|
708
|
+
version: Literal(1),
|
|
709
|
+
revision: NumberValue$2,
|
|
710
|
+
selection: _Object_({
|
|
711
|
+
preset: Text$3,
|
|
712
|
+
domains: Strings$1,
|
|
713
|
+
profile: Optional$2(Text$3)
|
|
714
|
+
}),
|
|
715
|
+
groups: _Array_(_Object_({
|
|
716
|
+
id: Text$3,
|
|
717
|
+
label: Text$3,
|
|
718
|
+
kind: Union([
|
|
719
|
+
Literal("preset"),
|
|
720
|
+
Literal("mode"),
|
|
721
|
+
Literal("domain"),
|
|
722
|
+
Literal("shared"),
|
|
723
|
+
Literal("core")
|
|
724
|
+
]),
|
|
725
|
+
items: _Array_(_Object_({
|
|
726
|
+
name: Text$3,
|
|
727
|
+
itemKind: Union([Literal("tool"), Literal("skill")]),
|
|
728
|
+
source: Source,
|
|
729
|
+
owner: Text$3,
|
|
730
|
+
tokens: NumberValue$2,
|
|
731
|
+
active: Flag$2
|
|
732
|
+
})),
|
|
733
|
+
tokens: NumberValue$2,
|
|
734
|
+
inactiveTokens: NumberValue$2
|
|
735
|
+
})),
|
|
736
|
+
totalTokens: NumberValue$2,
|
|
737
|
+
inactiveTokens: NumberValue$2,
|
|
738
|
+
systemPrompt: Optional$2(_Object_({
|
|
739
|
+
tokens: NumberValue$2,
|
|
740
|
+
stage: Union([Literal("base"), Literal("effective")])
|
|
741
|
+
})),
|
|
742
|
+
estimator: Literal("gpt-tokenizer")
|
|
743
|
+
})),
|
|
744
|
+
scope: "session",
|
|
745
|
+
basePath: API_BASE_PATH
|
|
746
|
+
},
|
|
747
|
+
{
|
|
748
|
+
...host("context.item", ITEM_ROUTE, "GET", _Object_({
|
|
749
|
+
revision: NumberValue$2,
|
|
750
|
+
item: Detail
|
|
751
|
+
}), { parameters: [query("kind", Union([
|
|
752
|
+
Literal("tool"),
|
|
753
|
+
Literal("skill"),
|
|
754
|
+
Literal("prompt")
|
|
755
|
+
]), true), query("name", Text$3, true)] }),
|
|
756
|
+
scope: "session",
|
|
757
|
+
basePath: API_BASE_PATH
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
...host("files.complete", "/", "GET", _Object_({ files: Strings$1 }), { parameters: [query("q", String({ maxLength: 256 }))] }),
|
|
761
|
+
scope: "session",
|
|
762
|
+
basePath: "files"
|
|
763
|
+
}
|
|
764
|
+
];
|
|
765
|
+
//#endregion
|
|
766
|
+
//#region ../../core/po-core/src/schemas/protocolHubContract.ts
|
|
767
|
+
const Text$2 = String();
|
|
768
|
+
const Json$2 = Unsafe({});
|
|
769
|
+
/** A live session frame every hub client needs (notification entries and agent dialogs) until it is acknowledged. */
|
|
770
|
+
const HubNoticeSchema = _Object_({
|
|
771
|
+
id: Text$2,
|
|
772
|
+
sessionId: Text$2,
|
|
773
|
+
frame: Record(Text$2, Json$2)
|
|
774
|
+
});
|
|
775
|
+
/** Native UI delivery metadata is HTTP-only; adding it must not refuse existing po.hub@1 clients. */
|
|
776
|
+
const HubSessionSchema = _Object_({
|
|
777
|
+
...SessionSummarySchema.properties,
|
|
778
|
+
nativeComposition: Optional$3(Omit(NativeCompositionSchema, ["uiEntry"]))
|
|
779
|
+
});
|
|
780
|
+
/** Instructions are HTTP-only so existing po.hub@1 clients keep the same wire contract. */
|
|
781
|
+
const HubWorkspaceSchema = Omit(WorkspaceSchema, ["instructions"]);
|
|
782
|
+
/** Per shared mount (`global`, `workspace:<id>`), a counter that rises when its plugin composition changes. */
|
|
783
|
+
const HubCompositionsSchema = Record(Text$2, Integer({ minimum: 0 }));
|
|
784
|
+
const HubState = {
|
|
785
|
+
sessions: Record(Text$2, HubSessionSchema),
|
|
786
|
+
workspaces: Record(Text$2, HubWorkspaceSchema),
|
|
787
|
+
pending: _Array_(HubNoticeSchema),
|
|
788
|
+
compositions: HubCompositionsSchema
|
|
789
|
+
};
|
|
790
|
+
const PoHubStateSchema = _Object_(HubState);
|
|
791
|
+
/** What one connection may see: its sessions, its workspaces, and the notices it has not acknowledged. */
|
|
792
|
+
const PoHubContract = definePoContract("po.hub", {
|
|
793
|
+
version: 1,
|
|
794
|
+
params: {},
|
|
795
|
+
state: HubState,
|
|
796
|
+
methods: {
|
|
797
|
+
readHome: {
|
|
798
|
+
args: _Object_({
|
|
799
|
+
offset: Optional$3(Integer({ minimum: 0 })),
|
|
800
|
+
limit: Optional$3(Integer({ minimum: 1 })),
|
|
801
|
+
source: Optional$3(Text$2),
|
|
802
|
+
workspaceId: Optional$3(Text$2)
|
|
803
|
+
}),
|
|
804
|
+
result: Unsafe({})
|
|
805
|
+
},
|
|
806
|
+
invoke: {
|
|
807
|
+
args: PoPluginWireCallSchema,
|
|
808
|
+
result: Json$2
|
|
809
|
+
},
|
|
810
|
+
ackNotice: { args: _Object_({ id: Text$2 }) }
|
|
811
|
+
}
|
|
812
|
+
});
|
|
813
|
+
/**
|
|
814
|
+
* Per topic (`global:<name>` on the wire for the host, `workspace:<id>:<name>`), a counter the host raises when that data changes, so a
|
|
815
|
+
* client fetches it again instead of polling. A separate contract: a host without it leaves clients on
|
|
816
|
+
* fetch-on-open rather than refusing the whole hub as out of date.
|
|
817
|
+
*/
|
|
818
|
+
const HubRevisionsSchema = Record(Text$2, Integer({ minimum: 0 }));
|
|
819
|
+
const PoHubRevisionsContract = definePoContract("po.hub.revisions", {
|
|
820
|
+
version: 1,
|
|
821
|
+
params: {},
|
|
822
|
+
state: { revisions: HubRevisionsSchema },
|
|
823
|
+
methods: {}
|
|
824
|
+
});
|
|
825
|
+
/** Caller-specific UI permissions. Separate so existing po.hub@1 schemas remain unchanged. */
|
|
826
|
+
const PoHubAccessContract = definePoContract("po.hub.access", {
|
|
827
|
+
version: 1,
|
|
828
|
+
params: {},
|
|
829
|
+
state: { interact: Record(Text$2, Boolean()) },
|
|
830
|
+
methods: {}
|
|
831
|
+
});
|
|
832
|
+
//#endregion
|
|
833
|
+
//#region ../../core/po-core/src/schemas/protocolThreadContract.ts
|
|
834
|
+
/** The thread's latest frame: `transcript_state` while its child runs, `transcript_ready` once it has finished. */
|
|
835
|
+
const PoThreadFrameSchema = Union([Null(), Intersect([_Object_({ type: String() }), Record(String(), Unsafe({}))])]);
|
|
836
|
+
/** One child thread of a session, followed only while someone holds it. */
|
|
837
|
+
const PoThreadContract = definePoContract("po.thread", {
|
|
838
|
+
version: 1,
|
|
839
|
+
params: {
|
|
840
|
+
sessionId: String({ minLength: 1 }),
|
|
841
|
+
threadId: String({ minLength: 1 })
|
|
842
|
+
},
|
|
843
|
+
state: { frame: PoThreadFrameSchema },
|
|
844
|
+
methods: {}
|
|
845
|
+
});
|
|
846
|
+
//#endregion
|
|
847
|
+
//#region ../../core/po-core/src/schemas/sessionApiContracts.ts
|
|
848
|
+
const Text$1 = String();
|
|
849
|
+
const NumberValue$1 = Number$1();
|
|
850
|
+
const Flag$1 = Boolean();
|
|
851
|
+
const Json$1 = Unsafe(Unknown({ description: "Strict JSON application value supplied by the active tool, journal entry, or extension; validated by the Pi codec." }));
|
|
852
|
+
const Optional$1 = Optional$3;
|
|
853
|
+
const Strings = _Array_(Text$1);
|
|
854
|
+
const Model = _Object_({
|
|
855
|
+
provider: Text$1,
|
|
856
|
+
id: Text$1
|
|
857
|
+
});
|
|
858
|
+
const Thinking = Union([
|
|
859
|
+
Literal("off"),
|
|
860
|
+
Literal("minimal"),
|
|
861
|
+
Literal("low"),
|
|
862
|
+
Literal("medium"),
|
|
863
|
+
Literal("high"),
|
|
864
|
+
Literal("max"),
|
|
865
|
+
Literal("xhigh")
|
|
866
|
+
]);
|
|
867
|
+
const Phase = Union([
|
|
868
|
+
Literal("idle"),
|
|
869
|
+
Literal("turn"),
|
|
870
|
+
Literal("compaction"),
|
|
871
|
+
Literal("retry")
|
|
872
|
+
]);
|
|
873
|
+
const Image = _Object_({
|
|
874
|
+
type: Literal("image"),
|
|
875
|
+
data: Text$1,
|
|
876
|
+
mimeType: Text$1
|
|
877
|
+
});
|
|
878
|
+
const TextPart = _Object_({
|
|
879
|
+
type: Literal("text"),
|
|
880
|
+
text: Text$1
|
|
881
|
+
});
|
|
882
|
+
const ThinkingPart = _Object_({
|
|
883
|
+
type: Literal("thinking"),
|
|
884
|
+
thinking: Text$1,
|
|
885
|
+
redacted: Optional$1(Literal(true))
|
|
886
|
+
});
|
|
887
|
+
const Content = Union([Image, TextPart]);
|
|
888
|
+
const Usage = _Object_({
|
|
889
|
+
input: NumberValue$1,
|
|
890
|
+
output: NumberValue$1,
|
|
891
|
+
cacheRead: NumberValue$1,
|
|
892
|
+
cacheWrite: NumberValue$1,
|
|
893
|
+
total: NumberValue$1
|
|
894
|
+
});
|
|
895
|
+
/** `timeZone` is the sender's device IANA zone; additive and optional so older clients and hosts still agree. */
|
|
896
|
+
const Message = _Object_({
|
|
897
|
+
text: Text$1,
|
|
898
|
+
images: Optional$1(_Array_(Image)),
|
|
899
|
+
timeZone: Optional$1(Text$1)
|
|
900
|
+
});
|
|
901
|
+
const Lifecycle = _Object_({
|
|
902
|
+
revision: NumberValue$1,
|
|
903
|
+
operation: Union([Null(), _Object_({
|
|
904
|
+
id: Text$1,
|
|
905
|
+
kind: Union([
|
|
906
|
+
Literal("run"),
|
|
907
|
+
Literal("compaction"),
|
|
908
|
+
Literal("navigation")
|
|
909
|
+
]),
|
|
910
|
+
status: Union([Literal("open"), Literal("aborting")])
|
|
911
|
+
})]),
|
|
912
|
+
paused: Flag$1,
|
|
913
|
+
queue: _Array_(_Object_({
|
|
914
|
+
id: Text$1,
|
|
915
|
+
text: Text$1,
|
|
916
|
+
images: Optional$1(_Array_(Image)),
|
|
917
|
+
delivery: Union([
|
|
918
|
+
Literal("steer"),
|
|
919
|
+
Literal("followUp"),
|
|
920
|
+
Literal("nextRun")
|
|
921
|
+
]),
|
|
922
|
+
scheduling: Union([Literal("automatic"), Literal("held")]),
|
|
923
|
+
disposition: Union([Literal("pending"), Literal("handoff")])
|
|
924
|
+
}))
|
|
925
|
+
});
|
|
926
|
+
const Frame = Intersect([_Object_({ type: Text$1 }), Record(Text$1, Json$1)], { description: "Discriminated extension presentation frame; selected channel schemas describe package payloads." });
|
|
927
|
+
const ProtocolEvent = _Object_({
|
|
928
|
+
sequence: NumberValue$1,
|
|
929
|
+
frame: Frame
|
|
930
|
+
});
|
|
931
|
+
const SessionServiceStateSchema = _Object_({
|
|
932
|
+
snapshot: _Object_({
|
|
933
|
+
fastMode: Flag$1,
|
|
934
|
+
locked: Flag$1,
|
|
935
|
+
lifecycle: Optional$1(Lifecycle)
|
|
936
|
+
}),
|
|
937
|
+
presentation: Optional$1(_Object_({
|
|
938
|
+
revision: NumberValue$1,
|
|
939
|
+
dropped: NumberValue$1,
|
|
940
|
+
resetRevision: Optional$1(NumberValue$1),
|
|
941
|
+
events: _Array_(ProtocolEvent),
|
|
942
|
+
projections: _Array_(ProtocolEvent)
|
|
943
|
+
})),
|
|
944
|
+
live: Optional$1(_Object_({
|
|
945
|
+
phase: Phase,
|
|
946
|
+
message: Optional$1(_Object_({
|
|
947
|
+
role: Literal("assistant"),
|
|
948
|
+
content: _Array_(Union([TextPart, ThinkingPart])),
|
|
949
|
+
model: Text$1,
|
|
950
|
+
timestamp: NumberValue$1
|
|
951
|
+
})),
|
|
952
|
+
tools: Record(Text$1, _Object_({
|
|
953
|
+
toolCallId: Text$1,
|
|
954
|
+
toolName: Text$1,
|
|
955
|
+
args: Json$1,
|
|
956
|
+
partialResult: Optional$1(_Object_({
|
|
957
|
+
content: _Array_(Content),
|
|
958
|
+
details: Optional$1(Json$1)
|
|
959
|
+
}))
|
|
960
|
+
}))
|
|
961
|
+
}))
|
|
962
|
+
});
|
|
963
|
+
/** Argument and result schemas of the `po.session` methods; the protocol contract and the API docs both read them. */
|
|
964
|
+
const SessionMethodSchemas = {
|
|
965
|
+
readTranscriptPage: {
|
|
966
|
+
args: _Object_({
|
|
967
|
+
cursor: Optional$1(Text$1),
|
|
968
|
+
direction: Optional$1(Union([Literal("older"), Literal("newer")])),
|
|
969
|
+
limit: Optional$1(NumberValue$1),
|
|
970
|
+
threadId: Optional$1(Text$1),
|
|
971
|
+
entryId: Optional$1(Text$1)
|
|
972
|
+
}),
|
|
973
|
+
result: _Object_({
|
|
974
|
+
entries: _Array_(Json$1),
|
|
975
|
+
startCursor: Union([Text$1, Null()]),
|
|
976
|
+
endCursor: Union([Text$1, Null()]),
|
|
977
|
+
olderCursor: Union([Text$1, Null()]),
|
|
978
|
+
newerCursor: Union([Text$1, Null()]),
|
|
979
|
+
generation: NumberValue$1,
|
|
980
|
+
revision: NumberValue$1,
|
|
981
|
+
context: _Array_(Json$1)
|
|
982
|
+
})
|
|
983
|
+
},
|
|
984
|
+
prompt: { args: Union([Text$1, _Object_({
|
|
985
|
+
...Message.properties,
|
|
986
|
+
waitFor: Optional$1(Union([Literal("accepted"), Literal("settled")]))
|
|
987
|
+
})]) },
|
|
988
|
+
steer: { args: Union([Text$1, Message]) },
|
|
989
|
+
abort: {},
|
|
990
|
+
abortOperation: { args: _Object_({ operationId: Text$1 }) },
|
|
991
|
+
setModel: { args: Model },
|
|
992
|
+
setThinking: { args: Thinking },
|
|
993
|
+
setFastMode: { args: Flag$1 },
|
|
994
|
+
setAgentLock: { args: Flag$1 },
|
|
995
|
+
followUp: { args: Message },
|
|
996
|
+
enqueueAutomatic: {
|
|
997
|
+
args: Message,
|
|
998
|
+
result: _Object_({ id: Text$1 })
|
|
999
|
+
},
|
|
1000
|
+
removeQueued: {
|
|
1001
|
+
args: _Object_({ id: Text$1 }),
|
|
1002
|
+
result: Union([
|
|
1003
|
+
Literal("removed"),
|
|
1004
|
+
Literal("in_flight"),
|
|
1005
|
+
Literal("already_consumed"),
|
|
1006
|
+
Literal("not_found")
|
|
1007
|
+
])
|
|
1008
|
+
},
|
|
1009
|
+
promoteQueued: {
|
|
1010
|
+
args: _Object_({
|
|
1011
|
+
id: Text$1,
|
|
1012
|
+
operationId: Optional$1(Text$1)
|
|
1013
|
+
}),
|
|
1014
|
+
result: Union([
|
|
1015
|
+
Literal("promoted"),
|
|
1016
|
+
Literal("in_flight"),
|
|
1017
|
+
Literal("target_changed"),
|
|
1018
|
+
Literal("not_found")
|
|
1019
|
+
])
|
|
1020
|
+
},
|
|
1021
|
+
resumeQueue: {},
|
|
1022
|
+
clearQueue: { result: _Object_({
|
|
1023
|
+
steering: Strings,
|
|
1024
|
+
followUp: Strings
|
|
1025
|
+
}) },
|
|
1026
|
+
rewind: {
|
|
1027
|
+
args: _Object_({
|
|
1028
|
+
itemId: Text$1,
|
|
1029
|
+
summarize: Optional$1(Flag$1),
|
|
1030
|
+
customInstructions: Optional$1(Text$1),
|
|
1031
|
+
replaceInstructions: Optional$1(Flag$1),
|
|
1032
|
+
label: Optional$1(Text$1)
|
|
1033
|
+
}),
|
|
1034
|
+
result: _Object_({
|
|
1035
|
+
editorText: Optional$1(Text$1),
|
|
1036
|
+
cancelled: Flag$1,
|
|
1037
|
+
aborted: Optional$1(Flag$1),
|
|
1038
|
+
summaryEntry: Optional$1(_Object_({
|
|
1039
|
+
id: Text$1,
|
|
1040
|
+
parentId: Union([Text$1, Null()]),
|
|
1041
|
+
timestamp: Text$1,
|
|
1042
|
+
fromId: Text$1,
|
|
1043
|
+
summary: Text$1,
|
|
1044
|
+
details: Optional$1(Json$1),
|
|
1045
|
+
usage: Optional$1(Usage),
|
|
1046
|
+
fromHook: Optional$1(Flag$1)
|
|
1047
|
+
}))
|
|
1048
|
+
})
|
|
1049
|
+
},
|
|
1050
|
+
extensionUiResponse: { args: Union([
|
|
1051
|
+
_Object_({
|
|
1052
|
+
id: Text$1,
|
|
1053
|
+
value: Text$1
|
|
1054
|
+
}),
|
|
1055
|
+
_Object_({
|
|
1056
|
+
id: Text$1,
|
|
1057
|
+
confirmed: Flag$1
|
|
1058
|
+
}),
|
|
1059
|
+
_Object_({
|
|
1060
|
+
id: Text$1,
|
|
1061
|
+
cancelled: Literal(true)
|
|
1062
|
+
})
|
|
1063
|
+
]) },
|
|
1064
|
+
getState: { result: _Object_({
|
|
1065
|
+
model: Optional$1(Model),
|
|
1066
|
+
thinkingLevel: Thinking,
|
|
1067
|
+
fastMode: Flag$1,
|
|
1068
|
+
agentLocked: Optional$1(Flag$1),
|
|
1069
|
+
isStreaming: Flag$1,
|
|
1070
|
+
isCompacting: Flag$1,
|
|
1071
|
+
steeringMode: Union([Literal("all"), Literal("one-at-a-time")]),
|
|
1072
|
+
followUpMode: Union([Literal("all"), Literal("one-at-a-time")]),
|
|
1073
|
+
sessionId: Text$1,
|
|
1074
|
+
sessionName: Optional$1(Text$1),
|
|
1075
|
+
autoCompactionEnabled: Flag$1,
|
|
1076
|
+
messageCount: NumberValue$1,
|
|
1077
|
+
pendingMessageCount: NumberValue$1,
|
|
1078
|
+
operationId: Optional$1(Text$1),
|
|
1079
|
+
executionStatus: Optional$1(Union([Literal("open"), Literal("aborting")])),
|
|
1080
|
+
queuePaused: Optional$1(Flag$1),
|
|
1081
|
+
queueRevision: Optional$1(NumberValue$1)
|
|
1082
|
+
}) },
|
|
1083
|
+
getSessionStats: { result: _Object_({
|
|
1084
|
+
sessionId: Text$1,
|
|
1085
|
+
totalMessages: NumberValue$1,
|
|
1086
|
+
tokens: Usage,
|
|
1087
|
+
cost: NumberValue$1,
|
|
1088
|
+
contextUsage: Optional$1(_Object_({
|
|
1089
|
+
tokens: Union([NumberValue$1, Null()]),
|
|
1090
|
+
contextWindow: NumberValue$1,
|
|
1091
|
+
percent: Union([NumberValue$1, Null()])
|
|
1092
|
+
}))
|
|
1093
|
+
}) },
|
|
1094
|
+
getCommands: { result: _Array_(_Object_({
|
|
1095
|
+
name: Text$1,
|
|
1096
|
+
description: Optional$1(Text$1),
|
|
1097
|
+
source: Union([
|
|
1098
|
+
Literal("extension"),
|
|
1099
|
+
Literal("prompt"),
|
|
1100
|
+
Literal("skill")
|
|
1101
|
+
]),
|
|
1102
|
+
sourceInfo: Optional$1(_Object_({
|
|
1103
|
+
path: Text$1,
|
|
1104
|
+
source: Text$1,
|
|
1105
|
+
scope: Union([
|
|
1106
|
+
Literal("user"),
|
|
1107
|
+
Literal("project"),
|
|
1108
|
+
Literal("temporary")
|
|
1109
|
+
]),
|
|
1110
|
+
origin: Union([Literal("package"), Literal("top-level")]),
|
|
1111
|
+
baseDir: Optional$1(Text$1)
|
|
1112
|
+
}))
|
|
1113
|
+
})) },
|
|
1114
|
+
getAvailableModels: { result: _Array_(Model) },
|
|
1115
|
+
getAvailableThinkingLevels: { result: _Array_(Thinking) },
|
|
1116
|
+
compact: {
|
|
1117
|
+
args: _Object_({ customInstructions: Optional$1(Text$1) }),
|
|
1118
|
+
result: Json$1
|
|
1119
|
+
},
|
|
1120
|
+
setName: { args: Text$1 },
|
|
1121
|
+
setGroups: { args: _Array_(Text$1) }
|
|
1122
|
+
};
|
|
1123
|
+
const ErrorSchema = _Object_({
|
|
1124
|
+
code: Text$1,
|
|
1125
|
+
message: Text$1
|
|
1126
|
+
});
|
|
1127
|
+
const documented = (id, service, member, direction, input, description) => ({
|
|
1128
|
+
id,
|
|
1129
|
+
scope: service === "po.hub" ? "host" : "session",
|
|
1130
|
+
service,
|
|
1131
|
+
member,
|
|
1132
|
+
direction,
|
|
1133
|
+
kind: direction === "server-to-client" ? "state" : "method",
|
|
1134
|
+
input,
|
|
1135
|
+
...direction === "server-to-client" ? {} : { errors: ErrorSchema },
|
|
1136
|
+
description
|
|
1137
|
+
});
|
|
1138
|
+
const sessionSocketContracts = [
|
|
1139
|
+
...Object.entries(SessionMethodSchemas).map(([member, { args, result }]) => ({
|
|
1140
|
+
id: `session.${member}`,
|
|
1141
|
+
scope: "session",
|
|
1142
|
+
service: "po.session",
|
|
1143
|
+
member,
|
|
1144
|
+
direction: "client-to-server",
|
|
1145
|
+
kind: "method",
|
|
1146
|
+
description: `Session ${member}. The protocol call carries the argument; a void result is null.`,
|
|
1147
|
+
input: Tuple(args === void 0 ? [] : [args]),
|
|
1148
|
+
...result === void 0 ? {} : { output: result },
|
|
1149
|
+
errors: ErrorSchema
|
|
1150
|
+
})),
|
|
1151
|
+
documented("session.state", "po.session", "state", "server-to-client", SessionServiceStateSchema, "The `state` member of `po.session`, as the Po protocol client follows it."),
|
|
1152
|
+
documented("hub.state", "po.hub", "state", "server-to-client", PoHubStateSchema, "Sessions and workspaces this connection may see, and notices it has not acknowledged."),
|
|
1153
|
+
documented("thread.frame", "po.thread", "frame", "server-to-client", PoThreadFrameSchema, "The latest frame of one child thread: transcript_state while it runs, transcript_ready once finished."),
|
|
1154
|
+
documented("channels.latest", "po.channels", "latest", "server-to-client", PoChannelsStateSchema, "The latest payload of each extension channel frame type for one session."),
|
|
1155
|
+
documented("channels.receive", "po.channels", "receive", "client-to-server", Tuple([ChannelFrameSchema]), "Send one extension channel frame to the session.")
|
|
1156
|
+
];
|
|
1157
|
+
const Schema = Unsafe(Union([Boolean(), Record(String(), Unknown())]));
|
|
1158
|
+
const Scope = Union([
|
|
1159
|
+
Literal("host"),
|
|
1160
|
+
Literal("workspace"),
|
|
1161
|
+
Literal("session")
|
|
1162
|
+
]);
|
|
1163
|
+
const Named = String({ minLength: 1 });
|
|
1164
|
+
const ResponseSchema = _Object_({
|
|
1165
|
+
description: Named,
|
|
1166
|
+
contentType: Optional$3(Named),
|
|
1167
|
+
schema: Optional$3(Schema),
|
|
1168
|
+
events: Optional$3(Record(Named, Schema))
|
|
1169
|
+
});
|
|
1170
|
+
_Object_({
|
|
1171
|
+
version: Literal(1),
|
|
1172
|
+
protocols: Optional$3(Record(Named, Named)),
|
|
1173
|
+
schemas: Optional$3(Record(Named, Schema)),
|
|
1174
|
+
http: _Array_(_Object_({
|
|
1175
|
+
id: Named,
|
|
1176
|
+
scope: Scope,
|
|
1177
|
+
/** Omit for host-owned absolute routes. */
|
|
1178
|
+
basePath: Optional$3(String({ pattern: "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$" })),
|
|
1179
|
+
path: String({ pattern: "^/" }),
|
|
1180
|
+
method: Union([
|
|
1181
|
+
Literal("GET"),
|
|
1182
|
+
Literal("POST"),
|
|
1183
|
+
Literal("PUT"),
|
|
1184
|
+
Literal("PATCH"),
|
|
1185
|
+
Literal("DELETE"),
|
|
1186
|
+
Literal("HEAD"),
|
|
1187
|
+
Literal("OPTIONS")
|
|
1188
|
+
]),
|
|
1189
|
+
description: Named,
|
|
1190
|
+
availability: Optional$3(Named),
|
|
1191
|
+
authentication: Union([
|
|
1192
|
+
Literal("none"),
|
|
1193
|
+
Literal("owner"),
|
|
1194
|
+
Literal("device")
|
|
1195
|
+
]),
|
|
1196
|
+
parameters: Optional$3(_Array_(_Object_({
|
|
1197
|
+
name: Named,
|
|
1198
|
+
in: Union([
|
|
1199
|
+
Literal("path"),
|
|
1200
|
+
Literal("query"),
|
|
1201
|
+
Literal("header")
|
|
1202
|
+
]),
|
|
1203
|
+
required: Boolean(),
|
|
1204
|
+
schema: Schema
|
|
1205
|
+
}))),
|
|
1206
|
+
body: Optional$3(_Object_({
|
|
1207
|
+
contentType: Named,
|
|
1208
|
+
contentTypes: Optional$3(_Array_(Named, { minItems: 1 })),
|
|
1209
|
+
required: Boolean(),
|
|
1210
|
+
schema: Schema
|
|
1211
|
+
})),
|
|
1212
|
+
responses: Record(String({ pattern: "^(?:[1-5][0-9]{2}|default)$" }), ResponseSchema, { minProperties: 1 })
|
|
1213
|
+
})),
|
|
1214
|
+
sockets: _Array_(_Object_({
|
|
1215
|
+
id: Named,
|
|
1216
|
+
scope: Scope,
|
|
1217
|
+
description: Named,
|
|
1218
|
+
availability: Optional$3(Named),
|
|
1219
|
+
service: Named,
|
|
1220
|
+
member: Named,
|
|
1221
|
+
direction: Union([Literal("client-to-server"), Literal("server-to-client")]),
|
|
1222
|
+
kind: Union([
|
|
1223
|
+
Literal("method"),
|
|
1224
|
+
Literal("state"),
|
|
1225
|
+
Literal("channel")
|
|
1226
|
+
]),
|
|
1227
|
+
input: Schema,
|
|
1228
|
+
output: Optional$3(Schema),
|
|
1229
|
+
errors: Optional$3(Schema)
|
|
1230
|
+
})),
|
|
1231
|
+
/** Explicitly enumerate dynamic values whose shape is supplied at runtime. */
|
|
1232
|
+
dynamic: _Array_(String({ minLength: 1 })),
|
|
1233
|
+
gaps: Optional$3(_Array_(Named))
|
|
1234
|
+
});
|
|
1235
|
+
function defineApiContract(contract) {
|
|
1236
|
+
return contract;
|
|
1237
|
+
}
|
|
1238
|
+
//#endregion
|
|
1239
|
+
//#region ../../core/po-core/src/schemas/pluginMarketplace.ts
|
|
1240
|
+
const PluginInstallRequestSchema = _Object_({
|
|
1241
|
+
layer: String({ minLength: 1 }),
|
|
1242
|
+
scope: String({ pattern: "^(host|workspace:[^/]+)$" }),
|
|
1243
|
+
name: String(),
|
|
1244
|
+
expectedHash: String()
|
|
1245
|
+
}, { additionalProperties: false });
|
|
1246
|
+
const PluginInstallOperationSchema = _Object_({
|
|
1247
|
+
id: String(),
|
|
1248
|
+
layer: String(),
|
|
1249
|
+
state: Union([
|
|
1250
|
+
Literal("queued"),
|
|
1251
|
+
Literal("installing"),
|
|
1252
|
+
Literal("verifying"),
|
|
1253
|
+
Literal("committing"),
|
|
1254
|
+
Literal("reconciling"),
|
|
1255
|
+
Literal("succeeded"),
|
|
1256
|
+
Literal("failed"),
|
|
1257
|
+
Literal("cancelled")
|
|
1258
|
+
]),
|
|
1259
|
+
membershipCommitted: Boolean(),
|
|
1260
|
+
error: Optional$3(String()),
|
|
1261
|
+
conflict: Optional$3(Literal(true)),
|
|
1262
|
+
clash: Optional$3(_Object_({
|
|
1263
|
+
preset: String(),
|
|
1264
|
+
installedVersion: String(),
|
|
1265
|
+
wantedVersion: String()
|
|
1266
|
+
})),
|
|
1267
|
+
rollbackError: Optional$3(String())
|
|
1268
|
+
});
|
|
1269
|
+
const pluginMarketplaceHttpContracts = [
|
|
1270
|
+
{
|
|
1271
|
+
id: "marketplace.catalog",
|
|
1272
|
+
scope: "host",
|
|
1273
|
+
basePath: "marketplace",
|
|
1274
|
+
path: "/catalog",
|
|
1275
|
+
method: "GET",
|
|
1276
|
+
description: "Read curated layers and runtime availability without exposing install targets.",
|
|
1277
|
+
authentication: "owner",
|
|
1278
|
+
responses: jsonApiResponses(_Object_({
|
|
1279
|
+
supportedScopes: Optional$3(_Array_(Union([Literal("host"), Literal("workspace")]))),
|
|
1280
|
+
layers: _Array_(_Object_({
|
|
1281
|
+
id: String(),
|
|
1282
|
+
name: String(),
|
|
1283
|
+
description: String(),
|
|
1284
|
+
category: String(),
|
|
1285
|
+
icon: String(),
|
|
1286
|
+
logo: Optional$3(String()),
|
|
1287
|
+
publisher: String(),
|
|
1288
|
+
tier: Union([
|
|
1289
|
+
Literal("core"),
|
|
1290
|
+
Literal("foundation"),
|
|
1291
|
+
Literal("default"),
|
|
1292
|
+
Literal("mode"),
|
|
1293
|
+
Literal("plugin")
|
|
1294
|
+
]),
|
|
1295
|
+
packages: _Array_(String()),
|
|
1296
|
+
installable: Boolean(),
|
|
1297
|
+
installed: Boolean(),
|
|
1298
|
+
version: Optional$3(String())
|
|
1299
|
+
}))
|
|
1300
|
+
}))
|
|
1301
|
+
},
|
|
1302
|
+
{
|
|
1303
|
+
id: "marketplace.install",
|
|
1304
|
+
scope: "host",
|
|
1305
|
+
basePath: "marketplace",
|
|
1306
|
+
path: "/installs",
|
|
1307
|
+
method: "POST",
|
|
1308
|
+
description: "Install a server-curated layer and commit its preset membership.",
|
|
1309
|
+
authentication: "owner",
|
|
1310
|
+
body: {
|
|
1311
|
+
contentType: "application/json",
|
|
1312
|
+
required: true,
|
|
1313
|
+
schema: PluginInstallRequestSchema
|
|
1314
|
+
},
|
|
1315
|
+
responses: jsonApiResponses(PluginInstallOperationSchema, 202)
|
|
1316
|
+
},
|
|
1317
|
+
...["GET", "DELETE"].map((method) => ({
|
|
1318
|
+
id: method === "GET" ? "marketplace.status" : "marketplace.cancel",
|
|
1319
|
+
scope: "host",
|
|
1320
|
+
basePath: "marketplace",
|
|
1321
|
+
path: "/installs/{id}",
|
|
1322
|
+
method,
|
|
1323
|
+
authentication: "owner",
|
|
1324
|
+
description: method === "GET" ? "Read an install result." : "Cancel before membership is committed.",
|
|
1325
|
+
parameters: [{
|
|
1326
|
+
name: "id",
|
|
1327
|
+
in: "path",
|
|
1328
|
+
required: true,
|
|
1329
|
+
schema: String()
|
|
1330
|
+
}],
|
|
1331
|
+
responses: jsonApiResponses(PluginInstallOperationSchema)
|
|
1332
|
+
}))
|
|
1333
|
+
];
|
|
1334
|
+
//#endregion
|
|
1335
|
+
//#region ../../core/po-core/src/schemas/remoteApiContracts.ts
|
|
1336
|
+
const Text = String();
|
|
1337
|
+
const NumberValue = Number$1();
|
|
1338
|
+
const Optional = Optional$3;
|
|
1339
|
+
const Flag = Boolean();
|
|
1340
|
+
const JsonObject = Record(Text, Unknown({ description: "WebAuthn ceremony fields supplied and verified by the installed WebAuthn implementation." }));
|
|
1341
|
+
const Tunnel = Union([_Object_({ kind: Literal("quick") }), _Object_({
|
|
1342
|
+
kind: Literal("named"),
|
|
1343
|
+
hostname: Text,
|
|
1344
|
+
name: Optional(Text),
|
|
1345
|
+
tokenFile: Optional(Text),
|
|
1346
|
+
configFile: Optional(Text)
|
|
1347
|
+
})]);
|
|
1348
|
+
const Settings = _Object_({
|
|
1349
|
+
autoCloseEnabled: Flag,
|
|
1350
|
+
autoCloseMinutes: NumberValue,
|
|
1351
|
+
sessionExpiryEnabled: Flag,
|
|
1352
|
+
idleMinutes: NumberValue,
|
|
1353
|
+
absoluteHours: NumberValue,
|
|
1354
|
+
tunnel: Tunnel
|
|
1355
|
+
});
|
|
1356
|
+
const State = _Object_({
|
|
1357
|
+
status: Union([
|
|
1358
|
+
Literal("off"),
|
|
1359
|
+
Literal("starting"),
|
|
1360
|
+
Literal("on"),
|
|
1361
|
+
Literal("failed")
|
|
1362
|
+
]),
|
|
1363
|
+
publicUrl: Optional(Text),
|
|
1364
|
+
startedAt: Optional(Text),
|
|
1365
|
+
closesAt: Optional(Text),
|
|
1366
|
+
error: Optional(Text),
|
|
1367
|
+
devices: _Array_(_Object_({
|
|
1368
|
+
id: Text,
|
|
1369
|
+
label: Text,
|
|
1370
|
+
userAgent: Text,
|
|
1371
|
+
createdAt: Text,
|
|
1372
|
+
lastSeenAt: Text,
|
|
1373
|
+
self: Flag
|
|
1374
|
+
})),
|
|
1375
|
+
pending: _Array_(_Object_({
|
|
1376
|
+
id: Text,
|
|
1377
|
+
userAgent: Text,
|
|
1378
|
+
edgeIp: Text,
|
|
1379
|
+
createdAt: Text,
|
|
1380
|
+
expiresAt: Text
|
|
1381
|
+
})),
|
|
1382
|
+
trustedDevices: _Array_(_Object_({
|
|
1383
|
+
id: Text,
|
|
1384
|
+
label: Text,
|
|
1385
|
+
platform: Union([Literal("ios"), Literal("android")]),
|
|
1386
|
+
createdAt: Text,
|
|
1387
|
+
lastSeenAt: Text,
|
|
1388
|
+
self: Flag
|
|
1389
|
+
})),
|
|
1390
|
+
settings: Settings
|
|
1391
|
+
});
|
|
1392
|
+
const StateResponse = _Object_({ state: State });
|
|
1393
|
+
const Trust = _Object_({
|
|
1394
|
+
publicKey: Text,
|
|
1395
|
+
fingerprint: Text,
|
|
1396
|
+
revision: NumberValue
|
|
1397
|
+
});
|
|
1398
|
+
const Begun = _Object_({
|
|
1399
|
+
ceremonyId: Text,
|
|
1400
|
+
options: JsonObject
|
|
1401
|
+
});
|
|
1402
|
+
const DeviceKeyBegun = _Object_({
|
|
1403
|
+
ceremonyId: Text,
|
|
1404
|
+
challenge: Text,
|
|
1405
|
+
kind: Literal("device-key")
|
|
1406
|
+
});
|
|
1407
|
+
const ChannelKeys = _Object_({
|
|
1408
|
+
session: Text,
|
|
1409
|
+
protocol: Text,
|
|
1410
|
+
http: Text
|
|
1411
|
+
});
|
|
1412
|
+
const Finish = _Object_({
|
|
1413
|
+
ceremonyId: Text,
|
|
1414
|
+
response: JsonObject
|
|
1415
|
+
});
|
|
1416
|
+
const SealedEnvelopeSchema = _Object_({
|
|
1417
|
+
v: Literal(1),
|
|
1418
|
+
n: Text,
|
|
1419
|
+
c: Text
|
|
1420
|
+
});
|
|
1421
|
+
_Object_({
|
|
1422
|
+
v: Literal(1),
|
|
1423
|
+
method: Text,
|
|
1424
|
+
target: Text,
|
|
1425
|
+
headers: _Array_(Tuple([Text, Text])),
|
|
1426
|
+
body: Optional(Text)
|
|
1427
|
+
});
|
|
1428
|
+
_Object_({
|
|
1429
|
+
v: Literal(1),
|
|
1430
|
+
status: NumberValue,
|
|
1431
|
+
headers: _Array_(Tuple([Text, Text])),
|
|
1432
|
+
body: Text
|
|
1433
|
+
});
|
|
1434
|
+
const route = (id, path, method, result, input, extra = {}) => ({
|
|
1435
|
+
id: `remote.${id}`,
|
|
1436
|
+
path: `/api/remote${path}`,
|
|
1437
|
+
method,
|
|
1438
|
+
scope: "host",
|
|
1439
|
+
authentication: "owner",
|
|
1440
|
+
description: `Remote Control ${id}.`,
|
|
1441
|
+
availability: "Global host provides Remote Control. Tunnel routes additionally enforce device, origin and step-up policy.",
|
|
1442
|
+
responses: {
|
|
1443
|
+
...jsonApiResponses(result),
|
|
1444
|
+
"429": {
|
|
1445
|
+
description: "Rate limit exceeded",
|
|
1446
|
+
schema: ApiErrorSchema
|
|
1447
|
+
}
|
|
1448
|
+
},
|
|
1449
|
+
...input ? { body: {
|
|
1450
|
+
contentType: "application/json",
|
|
1451
|
+
required: true,
|
|
1452
|
+
schema: input
|
|
1453
|
+
} } : {},
|
|
1454
|
+
...extra
|
|
1455
|
+
});
|
|
1456
|
+
const direct = [
|
|
1457
|
+
route("state", "", "GET", StateResponse),
|
|
1458
|
+
route("enable", "/enable", "POST", StateResponse),
|
|
1459
|
+
route("disable", "/disable", "POST", StateResponse, void 0, { responses: {
|
|
1460
|
+
...jsonApiResponses(StateResponse),
|
|
1461
|
+
"202": {
|
|
1462
|
+
description: "Tunnel closing",
|
|
1463
|
+
schema: _Object_({ status: Literal("closing") })
|
|
1464
|
+
}
|
|
1465
|
+
} }),
|
|
1466
|
+
route("codes", "/codes", "POST", _Object_({
|
|
1467
|
+
...Trust.properties,
|
|
1468
|
+
code: Text,
|
|
1469
|
+
manualCode: Text,
|
|
1470
|
+
pairUrl: Text,
|
|
1471
|
+
expiresAt: Text
|
|
1472
|
+
}), void 0, { responses: jsonApiResponses(_Object_({
|
|
1473
|
+
...Trust.properties,
|
|
1474
|
+
code: Text,
|
|
1475
|
+
manualCode: Text,
|
|
1476
|
+
pairUrl: Text,
|
|
1477
|
+
expiresAt: Text
|
|
1478
|
+
}), 201) }),
|
|
1479
|
+
route("approve", "/pairing/{id}/approve", "POST", StateResponse),
|
|
1480
|
+
route("deny", "/pairing/{id}/deny", "POST", StateResponse),
|
|
1481
|
+
route("revoke", "/devices/{id}", "DELETE", StateResponse),
|
|
1482
|
+
route("settings", "/settings", "PUT", _Object_({ settings: Settings }), Partial(Settings)),
|
|
1483
|
+
route("passkeys", "/passkeys", "GET", _Object_({
|
|
1484
|
+
support: Union([_Object_({
|
|
1485
|
+
supported: Literal(true),
|
|
1486
|
+
rpId: Text
|
|
1487
|
+
}), _Object_({
|
|
1488
|
+
supported: Literal(false),
|
|
1489
|
+
reason: Text
|
|
1490
|
+
})]),
|
|
1491
|
+
credentials: _Array_(_Object_({
|
|
1492
|
+
id: Text,
|
|
1493
|
+
label: Text,
|
|
1494
|
+
createdAt: Text,
|
|
1495
|
+
lastUsedAt: Text
|
|
1496
|
+
}))
|
|
1497
|
+
})),
|
|
1498
|
+
route("passkeys.remove", "/passkeys/{id}", "DELETE", ApiOkSchema),
|
|
1499
|
+
route("register.begin", "/passkeys/register/begin", "POST", Begun, void 0, { authentication: "device" }),
|
|
1500
|
+
route("register.finish", "/passkeys/register/finish", "POST", _Object_({ id: Text }), Finish, { authentication: "device" }),
|
|
1501
|
+
route("authenticate.begin", "/passkeys/authenticate/begin", "POST", Begun, void 0, { authentication: "none" }),
|
|
1502
|
+
route("authenticate.finish", "/passkeys/authenticate/finish", "POST", _Object_({
|
|
1503
|
+
ok: Literal(true),
|
|
1504
|
+
hostPublicKey: Text
|
|
1505
|
+
}), Finish, { authentication: "none" }),
|
|
1506
|
+
route("challenge", "/challenge", "POST", Union([Begun, DeviceKeyBegun]), _Object_({ action: Text }), { authentication: "device" }),
|
|
1507
|
+
route("trusted-devices.register", "/trusted-devices", "POST", _Object_({ trustedDeviceId: Text }), _Object_({
|
|
1508
|
+
identityPublicKey: Text,
|
|
1509
|
+
stepUpPublicKey: Text,
|
|
1510
|
+
label: Text,
|
|
1511
|
+
platform: Union([Literal("ios"), Literal("android")]),
|
|
1512
|
+
identityProof: Text,
|
|
1513
|
+
stepUpProof: Text
|
|
1514
|
+
}), {
|
|
1515
|
+
authentication: "device",
|
|
1516
|
+
description: "Registers a native device from a sealed, QR-approved pairing session.",
|
|
1517
|
+
responses: jsonApiResponses(_Object_({ trustedDeviceId: Text }), 201)
|
|
1518
|
+
}),
|
|
1519
|
+
route("trusted-devices.revoke", "/trusted-devices/{id}", "DELETE", StateResponse, void 0, { description: "Revokes a trusted native device. Local callers, or sealed callers with verified step-up." }),
|
|
1520
|
+
route("device-auth.challenge", "/device-auth/challenge", "POST", _Object_({
|
|
1521
|
+
challengeId: Text,
|
|
1522
|
+
challenge: Text,
|
|
1523
|
+
hostPublicKey: Text,
|
|
1524
|
+
attestation: Text
|
|
1525
|
+
}), _Object_({
|
|
1526
|
+
trustedDeviceId: Text,
|
|
1527
|
+
nonce: Text
|
|
1528
|
+
}), { authentication: "none" }),
|
|
1529
|
+
route("device-auth.authenticate", "/device-auth/authenticate", "POST", _Object_({ ok: Literal(true) }), _Object_({
|
|
1530
|
+
challengeId: Text,
|
|
1531
|
+
trustedDeviceId: Text,
|
|
1532
|
+
signature: Text,
|
|
1533
|
+
channels: ChannelKeys
|
|
1534
|
+
}), { authentication: "none" }),
|
|
1535
|
+
route("channel", "/channel", "POST", ApiOkSchema, _Object_({
|
|
1536
|
+
clientPublicKey: Text,
|
|
1537
|
+
scope: Union([
|
|
1538
|
+
Literal("session"),
|
|
1539
|
+
Literal("protocol"),
|
|
1540
|
+
Literal("http")
|
|
1541
|
+
])
|
|
1542
|
+
}), { authentication: "device" }),
|
|
1543
|
+
route("request", "/request", "POST", SealedEnvelopeSchema, SealedEnvelopeSchema, {
|
|
1544
|
+
authentication: "device",
|
|
1545
|
+
description: "Sealed HTTP gateway. Decrypted requests/responses use the SealedHttpRequest and SealedHttpResponse envelopes."
|
|
1546
|
+
}),
|
|
1547
|
+
route("pair", "/pair", "POST", _Object_({
|
|
1548
|
+
requestId: Text,
|
|
1549
|
+
status: Literal("pending")
|
|
1550
|
+
}), _Object_({ code: String({ minLength: 1 }) }), {
|
|
1551
|
+
authentication: "none",
|
|
1552
|
+
responses: {
|
|
1553
|
+
...jsonApiResponses(_Object_({
|
|
1554
|
+
requestId: Text,
|
|
1555
|
+
status: Literal("pending")
|
|
1556
|
+
}), 202),
|
|
1557
|
+
"410": {
|
|
1558
|
+
description: "Pairing code is no longer valid",
|
|
1559
|
+
schema: ApiErrorSchema
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
}),
|
|
1563
|
+
route("pair.status", "/pair/status", "GET", _Object_({
|
|
1564
|
+
status: Union([
|
|
1565
|
+
Literal("pending"),
|
|
1566
|
+
Literal("approved"),
|
|
1567
|
+
Literal("denied"),
|
|
1568
|
+
Literal("expired"),
|
|
1569
|
+
Literal("consumed")
|
|
1570
|
+
]),
|
|
1571
|
+
bundleTrust: Optional(Trust),
|
|
1572
|
+
hostPublicKey: Optional(Text)
|
|
1573
|
+
}), void 0, {
|
|
1574
|
+
authentication: "none",
|
|
1575
|
+
parameters: [{
|
|
1576
|
+
name: "request",
|
|
1577
|
+
in: "query",
|
|
1578
|
+
required: true,
|
|
1579
|
+
schema: Text
|
|
1580
|
+
}]
|
|
1581
|
+
})
|
|
1582
|
+
];
|
|
1583
|
+
const remoteHttpContracts = [
|
|
1584
|
+
route("frontend", "/frontend", "POST", ApiOkSchema, _Object_({ origin: Text }), {
|
|
1585
|
+
authentication: "owner",
|
|
1586
|
+
availability: "Internal loopback frontend registration; blocked by the browser proxy.",
|
|
1587
|
+
parameters: [{
|
|
1588
|
+
name: "x-po-web-registration",
|
|
1589
|
+
in: "header",
|
|
1590
|
+
required: true,
|
|
1591
|
+
schema: Text
|
|
1592
|
+
}]
|
|
1593
|
+
}),
|
|
1594
|
+
...direct,
|
|
1595
|
+
...direct.map((operation) => ({
|
|
1596
|
+
...operation,
|
|
1597
|
+
id: `${operation.id}.plugin`,
|
|
1598
|
+
basePath: "remote",
|
|
1599
|
+
path: operation.path.slice(11) || "/",
|
|
1600
|
+
authentication: "owner",
|
|
1601
|
+
availability: "Global Remote Control plugin mount, reached through the authenticated headless listener."
|
|
1602
|
+
})),
|
|
1603
|
+
{
|
|
1604
|
+
id: "remote.pair.page",
|
|
1605
|
+
scope: "host",
|
|
1606
|
+
path: "/pair",
|
|
1607
|
+
method: "GET",
|
|
1608
|
+
authentication: "none",
|
|
1609
|
+
availability: "Remote listener only",
|
|
1610
|
+
description: "Pairing and passkey bootstrap page.",
|
|
1611
|
+
responses: { "200": {
|
|
1612
|
+
description: "Pairing page",
|
|
1613
|
+
contentType: "text/html",
|
|
1614
|
+
schema: Text
|
|
1615
|
+
} }
|
|
1616
|
+
}
|
|
1617
|
+
];
|
|
1618
|
+
const Asset = _Object_({
|
|
1619
|
+
path: Text,
|
|
1620
|
+
sha256: String({ pattern: "^[a-f0-9]{64}$" }),
|
|
1621
|
+
byteLength: Integer({ minimum: 0 }),
|
|
1622
|
+
contentType: Text
|
|
1623
|
+
});
|
|
1624
|
+
const Signed = _Object_({
|
|
1625
|
+
manifest: _Object_({
|
|
1626
|
+
version: Literal(2),
|
|
1627
|
+
revision: Integer({ minimum: 1 }),
|
|
1628
|
+
builtAt: NumberValue,
|
|
1629
|
+
assets: _Array_(Asset)
|
|
1630
|
+
}),
|
|
1631
|
+
signature: Text,
|
|
1632
|
+
publicKey: Text
|
|
1633
|
+
});
|
|
1634
|
+
const bundleHttpContracts = [...["/bundle-manifest.json", "/api/web-plugins/{id}/{revision}/manifest"].flatMap((path) => ["GET", "HEAD"].map((method) => ({
|
|
1635
|
+
id: `bundle.${path}.${method}`,
|
|
1636
|
+
scope: "host",
|
|
1637
|
+
path,
|
|
1638
|
+
method,
|
|
1639
|
+
authentication: "owner",
|
|
1640
|
+
availability: "Host publishes a web bundle",
|
|
1641
|
+
description: "Read an immutable signed browser bundle manifest.",
|
|
1642
|
+
responses: method === "HEAD" ? {
|
|
1643
|
+
"200": { description: "Manifest response headers" },
|
|
1644
|
+
"404": { description: "Bundle not published" }
|
|
1645
|
+
} : jsonApiResponses(Signed)
|
|
1646
|
+
}))), ...["/bundle-assets/{revision}/{assetPath}", "/api/web-plugins/{id}/{revision}/assets/{assetPath}"].flatMap((path) => ["GET", "HEAD"].map((method) => ({
|
|
1647
|
+
id: `asset.${path}.${method}`,
|
|
1648
|
+
scope: "host",
|
|
1649
|
+
path,
|
|
1650
|
+
method,
|
|
1651
|
+
authentication: "owner",
|
|
1652
|
+
availability: "Host publishes a web bundle",
|
|
1653
|
+
description: "Read an asset from the signed manifest. assetPath may contain multiple path segments.",
|
|
1654
|
+
responses: {
|
|
1655
|
+
"200": {
|
|
1656
|
+
description: "Manifest-listed asset, original MIME type",
|
|
1657
|
+
...method === "GET" ? {
|
|
1658
|
+
contentType: "*/*",
|
|
1659
|
+
schema: String({ contentEncoding: "binary" })
|
|
1660
|
+
} : {}
|
|
1661
|
+
},
|
|
1662
|
+
"404": { description: "Asset not published" }
|
|
1663
|
+
}
|
|
1664
|
+
})))];
|
|
1665
|
+
const Json = Unknown({ description: "JSON value; its application shape is defined by the addressed contract member." });
|
|
1666
|
+
const WireError = _Object_({
|
|
1667
|
+
code: String(),
|
|
1668
|
+
message: String(),
|
|
1669
|
+
reason: Optional$3(String())
|
|
1670
|
+
});
|
|
1671
|
+
const ProtocolMessage = _Array_(Unknown(), { description: `A Chord 1.5 link message: one JSON array per text message. Its format is Chord's.` });
|
|
1672
|
+
const transportSocketContracts = [
|
|
1673
|
+
{
|
|
1674
|
+
id: "chord.client",
|
|
1675
|
+
scope: "host",
|
|
1676
|
+
service: "$chord",
|
|
1677
|
+
member: "client",
|
|
1678
|
+
direction: "client-to-server",
|
|
1679
|
+
kind: "channel",
|
|
1680
|
+
input: ProtocolMessage,
|
|
1681
|
+
description: "Protocol message from a client, sealed for remote delivery. Hold `po.hub` ({}) and `po.session` ({ sessionId }) through the Po protocol client."
|
|
1682
|
+
},
|
|
1683
|
+
{
|
|
1684
|
+
id: "chord.server",
|
|
1685
|
+
scope: "host",
|
|
1686
|
+
service: "$chord",
|
|
1687
|
+
member: "server",
|
|
1688
|
+
direction: "server-to-client",
|
|
1689
|
+
kind: "channel",
|
|
1690
|
+
input: ProtocolMessage,
|
|
1691
|
+
description: "Protocol message from the server."
|
|
1692
|
+
},
|
|
1693
|
+
{
|
|
1694
|
+
id: "plugin.invoke",
|
|
1695
|
+
scope: "host",
|
|
1696
|
+
service: "po.hub",
|
|
1697
|
+
member: "invoke",
|
|
1698
|
+
direction: "client-to-server",
|
|
1699
|
+
kind: "method",
|
|
1700
|
+
input: PoPluginWireCallSchema,
|
|
1701
|
+
output: Json,
|
|
1702
|
+
errors: WireError,
|
|
1703
|
+
description: "Invoke the selected scoped plugin method. Its declaration supplies input and output shapes."
|
|
1704
|
+
}
|
|
1705
|
+
];
|
|
1706
|
+
[
|
|
1707
|
+
...headlessHttpContracts,
|
|
1708
|
+
...pluginMarketplaceHttpContracts,
|
|
1709
|
+
...machineHttpContracts,
|
|
1710
|
+
...sessionHttpContracts,
|
|
1711
|
+
...remoteHttpContracts,
|
|
1712
|
+
...bundleHttpContracts
|
|
1713
|
+
], [...sessionSocketContracts, ...transportSocketContracts];
|
|
1714
|
+
//#endregion
|
|
1715
|
+
export { PoThreadContract as a, PoHubRevisionsContract as c, SessionServiceStateSchema as i, jsonApiResponses as l, defineApiContract as n, PoHubAccessContract as o, SessionMethodSchemas as r, PoHubContract as s, PluginInstallRequestSchema as t, PoChannelsContract as u };
|