@agimon-ai/po-cloudflare 0.0.2-alpha.2 → 0.0.2-alpha.20
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 +4 -3
- package/dist/abort-signals-2GUraIGq.js +34 -0
- package/dist/agent-DTjnYFAN.js +6850 -0
- package/dist/anthropic-messages-5ODquUB-.js +14317 -0
- package/dist/{apiContracts-CHOiCbS_.js → apiContracts-DepyzMNr.js} +94 -81
- package/dist/{approval-BMXqnTYd.js → approval-Biq3NCWj.js} +19 -3
- package/dist/{approvalPrompt-Bg1JrEEY.js → approvalPrompt-DoHlIPkU.js} +2 -2
- package/dist/assets/assets/{CodeEditorView-BnyZHaYM.js → CodeEditorView-BU8DeV_G.js} +2 -2
- package/dist/assets/assets/{abnfDiagram-WEYOIA3C-muME0eCj.js → abnfDiagram-WEYOIA3C-BkzARjqu.js} +2 -2
- package/dist/assets/assets/{architecture-WOLXFQ4H-DMnhK1WH.js → architecture-WOLXFQ4H-B_dgnlXa.js} +1 -1
- package/dist/assets/assets/{architectureDiagram-ZHVYKT53-DKn7XGP7.js → architectureDiagram-ZHVYKT53-DMGAifk0.js} +2 -2
- package/dist/assets/assets/{blockDiagram-RJAE7QA3-DtDctXZg.js → blockDiagram-RJAE7QA3-DwTSK4lj.js} +2 -2
- package/dist/assets/assets/{c4Diagram-XDPPPE54-23pGLJeP.js → c4Diagram-XDPPPE54-IRaOcC_u.js} +2 -2
- package/dist/assets/assets/channel-BXwM62E-.js +2 -0
- package/dist/assets/assets/{chunk-2E7WHVMD-BZ2nGNPa.js → chunk-2E7WHVMD-BvS46crW.js} +2 -2
- package/dist/assets/assets/{chunk-4EMNKR2T-Dui1SYFi.js → chunk-4EMNKR2T--n96Xbj0.js} +2 -2
- package/dist/assets/assets/{chunk-55XCU76K-CUB92Evl.js → chunk-55XCU76K-D3h_hFRi.js} +2 -2
- package/dist/assets/assets/{chunk-7S6XSTFO-CVayPHfE.js → chunk-7S6XSTFO-Cj18feJl.js} +2 -2
- package/dist/assets/assets/{chunk-AQDTSKZB---wakYqY.js → chunk-AQDTSKZB-DXsT43bg.js} +2 -2
- package/dist/assets/assets/{chunk-DSNLSHJZ-DfbdohUR.js → chunk-DSNLSHJZ-Br7dX7yf.js} +2 -2
- package/dist/assets/assets/{chunk-HAGFOTED-Dr4KRh-b.js → chunk-HAGFOTED-BcozAtPo.js} +2 -2
- package/dist/assets/assets/{chunk-HNE4Q36P-D06cR91Z.js → chunk-HNE4Q36P-B8kgXgRq.js} +2 -2
- package/dist/assets/assets/{chunk-NQOKRVIF-Ca4gLeDb.js → chunk-NQOKRVIF-Dn7UnsqE.js} +2 -2
- package/dist/assets/assets/{chunk-UHW7PFBP-DmL638jN.js → chunk-UHW7PFBP-BSJot0vi.js} +2 -2
- package/dist/assets/assets/{chunk-VQ5W62QI-pkxSW5Zj.js → chunk-VQ5W62QI-Cpf1EfZK.js} +2 -2
- package/dist/assets/assets/{chunk-WQQL4CDK-Dcc8hV4U.js → chunk-WQQL4CDK-Dnc36uZR.js} +2 -2
- package/dist/assets/assets/chunk-XXDRQBXY-C9Ka5KSI.js +2 -0
- package/dist/assets/assets/{chunk-YZO67HFG-B_HKcFrw.js → chunk-YZO67HFG-BV8_A7x3.js} +2 -2
- package/dist/assets/assets/{chunk-ZAUX2LTX-DAzZUysS.js → chunk-ZAUX2LTX-C4Ne_31B.js} +2 -2
- package/dist/assets/assets/{chunk-ZCHMQSOR-DAVgjymL.js → chunk-ZCHMQSOR-Dq9ModsA.js} +2 -2
- package/dist/assets/assets/{classDiagram-v2-4MYWR3UA-Fsw8TGPu.js → classDiagram-v2-4MYWR3UA-1BWEjXP9.js} +2 -2
- package/dist/assets/assets/{cose-bilkent-JH36ORCC-CgUbISYV.js → cose-bilkent-JH36ORCC-DREkvC_x.js} +2 -2
- package/dist/assets/assets/{cynefin-EF2NZ3EQ-D1LxAU2x.js → cynefin-EF2NZ3EQ-CWziP8nx.js} +1 -1
- package/dist/assets/assets/{cynefinDiagram-WF24UDRP-D54I1jil.js → cynefinDiagram-WF24UDRP-DOoYmcvz.js} +2 -2
- package/dist/assets/assets/{dagre-NK4GIZVX-DC7zL16U.js → dagre-NK4GIZVX-OoAtEico.js} +2 -2
- package/dist/assets/assets/{diagram-CBK3MWTC-DB0ptUdz.js → diagram-CBK3MWTC-B-pl2-iR.js} +2 -2
- package/dist/assets/assets/{diagram-I5XIIV2D-CozSftPJ.js → diagram-I5XIIV2D-uKzNJSZ2.js} +2 -2
- package/dist/assets/assets/{diagram-ODIL2UCW-g3WOEWDS.js → diagram-ODIL2UCW-CEXY_Tzu.js} +2 -2
- package/dist/assets/assets/{diagram-PFBEJUXE-CFxGeOYi.js → diagram-PFBEJUXE-MKlRQo-g.js} +2 -2
- package/dist/assets/assets/{diagram-RJA3I4VV-BQBsLche.js → diagram-RJA3I4VV-c2qlCEVs.js} +2 -2
- package/dist/assets/assets/{diagram-TYUNFSNR-DrjpW2yq.js → diagram-TYUNFSNR-DTdqLA6J.js} +2 -2
- package/dist/assets/assets/{dist-B3JXhDWV.js → dist-4TUOlkyl.js} +2 -2
- package/dist/assets/assets/{dist-1-mhYUBH.js → dist-BzTxJnSR.js} +2 -2
- package/dist/assets/assets/{dist-XIZum9n5.js → dist-D9lacOpq.js} +2 -2
- package/dist/assets/assets/{dist-gfbb4ygy.js → dist-DCKskbBE.js} +2 -2
- package/dist/assets/assets/{dist-h6SOnP8-.js → dist-DCc8tQ7G.js} +2 -2
- package/dist/assets/assets/{dist-Izr2SB3q.js → dist-DXlts_H5.js} +2 -2
- package/dist/assets/assets/{dist-DvgCCshF.js → dist-DvZCwSZ8.js} +2 -2
- package/dist/assets/assets/{dist-BabjcJ3j.js → dist-mQUN8X3n.js} +2 -2
- package/dist/assets/assets/{dist-DjL8d1jZ.js → dist-qZHwVT1x.js} +2 -2
- package/dist/assets/assets/{ebnfDiagram-V4P3TTPT-BZS_aAve.js → ebnfDiagram-V4P3TTPT-C89wxfCd.js} +2 -2
- package/dist/assets/assets/{elk-QONTBCTQ-B2ksVmMA.js → elk-QONTBCTQ-BMBgLOae.js} +2 -2
- package/dist/assets/assets/{erDiagram-KYQIGQAA-7P6zF-Z-.js → erDiagram-KYQIGQAA-Bb04CRa4.js} +2 -2
- package/dist/assets/assets/{eventmodeling-K75KTNOO-RoGQoRq-.js → eventmodeling-K75KTNOO-DSyNf2MV.js} +1 -1
- package/dist/assets/assets/flowDiagram-IUGLLWBU-DXuTqLUd.js +1 -0
- package/dist/assets/assets/{ganttDiagram-R7GPNTJY-CTOlRy7M.js → ganttDiagram-R7GPNTJY-sB7-pF_t.js} +2 -2
- package/dist/assets/assets/{gitGraph-VSP46ZUC-CPqytIt0.js → gitGraph-VSP46ZUC-pWPBCmdT.js} +1 -1
- package/dist/assets/assets/{gitGraphDiagram-PDYL7XHY-BffLxuxg.js → gitGraphDiagram-PDYL7XHY-DronDRed.js} +2 -2
- package/dist/assets/assets/index-CBNQEGK3.css +1 -0
- package/dist/assets/assets/index-DdAdCxGc.js +155 -0
- package/dist/assets/assets/{info-OHQRW6UA-BI8RK0Ow.js → info-OHQRW6UA-B375mT1i.js} +1 -1
- package/dist/assets/assets/{infoDiagram-MVDRKAX5-DUIst1FB.js → infoDiagram-MVDRKAX5-9Hw3wWP7.js} +2 -2
- package/dist/assets/assets/{ishikawaDiagram-HPEHV2GE-CA17Eho5.js → ishikawaDiagram-HPEHV2GE-CdPAuupk.js} +2 -2
- package/dist/assets/assets/{journeyDiagram-BOSHW7O7-CNri5Ap9.js → journeyDiagram-BOSHW7O7-hqmaHM9u.js} +2 -2
- package/dist/assets/assets/{kanban-definition-FNSA4HC5-DnXna7jO.js → kanban-definition-FNSA4HC5-BdOHplX4.js} +2 -2
- package/dist/assets/assets/{line-BsXJZn93.js → line-BCSC3Bu2.js} +2 -2
- package/dist/assets/assets/{linear-BHYaD5T0.js → linear-D5ddQU3r.js} +2 -2
- package/dist/assets/assets/{mermaid-parser.core-B64Eo-8a.js → mermaid-parser.core-BaSUi_Ph.js} +4 -4
- package/dist/assets/assets/{mermaid.core-Zw9qmTzg.js → mermaid.core-CUUsU9Ou.js} +5 -5
- package/dist/assets/assets/{mindmap-definition-6OY57UG3-E5qz4KNc.js → mindmap-definition-6OY57UG3-BtVkhvIZ.js} +2 -2
- package/dist/assets/assets/{packet-JDAUHWVQ-DgfizTr3.js → packet-JDAUHWVQ-CQ3OUDwI.js} +1 -1
- package/dist/assets/assets/{pegDiagram-ECIUJNBX-D0WK_agM.js → pegDiagram-ECIUJNBX-DDnq-Kn3.js} +2 -2
- package/dist/assets/assets/{pie-XZMESJXO-PJR1sXD4.js → pie-XZMESJXO-BvOFTkQB.js} +1 -1
- package/dist/assets/assets/{pieDiagram-GNMPY74T-CPuU-NTs.js → pieDiagram-GNMPY74T-Bdwhl9jD.js} +2 -2
- package/dist/assets/assets/{quadrantDiagram-D57K4MC3-5C9yjM1b.js → quadrantDiagram-D57K4MC3-GHKoDEeT.js} +2 -2
- package/dist/assets/assets/{radar-ABXABTNO-BspdXgl0.js → radar-ABXABTNO-Yk9rKkKW.js} +1 -1
- package/dist/assets/assets/{railroad-I3PHUGI6-Ct0a6hLD.js → railroad-I3PHUGI6-Crr2QEwm.js} +1 -1
- package/dist/assets/assets/{railroad-abnf-LNEFI6M7-fduYB4SA.js → railroad-abnf-LNEFI6M7-CLrgwBog.js} +1 -1
- package/dist/assets/assets/{railroad-ebnf-DWYD2UWJ-CTQa8Sww.js → railroad-ebnf-DWYD2UWJ-zWReI6MC.js} +1 -1
- package/dist/assets/assets/{railroad-peg-JR7BVNR7-DatoH3GJ.js → railroad-peg-JR7BVNR7-CnVnlaHi.js} +1 -1
- package/dist/assets/assets/{railroadDiagram-Y72NRBL7-C8sWN8l2.js → railroadDiagram-Y72NRBL7-MJ68mMla.js} +2 -2
- package/dist/assets/assets/{requirementDiagram-EQYSW5RA-CqRz4RcT.js → requirementDiagram-EQYSW5RA-BYb-mTCH.js} +2 -2
- package/dist/assets/assets/{sankeyDiagram-SY24JHO5-bdiuKKlX.js → sankeyDiagram-SY24JHO5-DzONJsqQ.js} +2 -2
- package/dist/assets/assets/{sequenceDiagram-BLEHNHQU-Zy-8I0Hy.js → sequenceDiagram-BLEHNHQU-0vav9YWV.js} +2 -2
- package/dist/assets/assets/{src-gihY33R9.js → src-DZJUnjaM.js} +2 -2
- package/dist/assets/assets/{stateDiagram-v2-A6IESKWZ-DXQERPvz.js → stateDiagram-v2-A6IESKWZ-B0M8THPh.js} +2 -2
- package/dist/assets/assets/{swimlanes-B3ENRKFQ-1gjZQElg.js → swimlanes-B3ENRKFQ-5YJZCHIB.js} +2 -2
- package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-aJTRXiIU.js +9 -0
- package/dist/assets/assets/{timeline-definition-JXYKGLGB-CTeYEw-9.js → timeline-definition-JXYKGLGB-us1LwUHo.js} +2 -2
- package/dist/assets/assets/{treeView-D4JQ5SDB-DD-EsLLT.js → treeView-D4JQ5SDB-BSLlcDre.js} +1 -1
- package/dist/assets/assets/{treemap-SAJKECNS-BLdFeS5J.js → treemap-SAJKECNS-DZ2SwLmk.js} +1 -1
- package/dist/assets/assets/{usecaseDiagram-WPOLBNNX-C1GikSSP.js → usecaseDiagram-WPOLBNNX-BrmvO_6k.js} +2 -2
- package/dist/assets/assets/{vennDiagram-Q3Y3IDCW-B1FoA3g8.js → vennDiagram-Q3Y3IDCW-FKXSeKp5.js} +2 -2
- package/dist/assets/assets/{wardley-7MLQ67FV-BrHb5Bjf.js → wardley-7MLQ67FV-DZ_vIMp2.js} +1 -1
- package/dist/assets/assets/{wardleyDiagram-IVAIDKWA-CmPLD1X4.js → wardleyDiagram-IVAIDKWA-CfLYNckm.js} +2 -2
- package/dist/assets/assets/{webpack-BYWDFj_R.js → webpack-CiS_BB3R.js} +2 -2
- package/dist/assets/assets/{xychartDiagram-4URNHDU4-DR5pfEjl.js → xychartDiagram-4URNHDU4-DBucwhQh.js} +2 -2
- package/dist/assets/bundle-asset-policy.json +1 -1
- package/dist/assets/index.html +2 -2
- package/dist/assets/plugins/assets/base-C3j1WCCq.css +2 -0
- package/dist/assets/plugins/assets/ibm-plex-sans-cyrillic-ext-wght-normal-d45eAU9y.woff2 +0 -0
- package/dist/assets/plugins/assets/ibm-plex-sans-cyrillic-wght-normal-BAAhND-U.woff2 +0 -0
- package/dist/assets/plugins/assets/ibm-plex-sans-greek-wght-normal-CmyJS8uq.woff2 +0 -0
- package/dist/assets/plugins/assets/ibm-plex-sans-latin-ext-wght-normal-CIII54If.woff2 +0 -0
- package/dist/assets/plugins/assets/ibm-plex-sans-latin-wght-normal-IvpUvPa2.woff2 +0 -0
- package/dist/assets/plugins/assets/ibm-plex-sans-vietnamese-wght-normal-Dg1JeJN0.woff2 +0 -0
- package/dist/assets/plugins/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
- package/dist/assets/plugins/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/dist/assets/plugins/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/dist/assets/plugins/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/dist/assets/plugins/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/dist/assets/plugins/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/dist/assets/plugins/chunks/po-web-runtime-Czm_C4SJ.js +1 -0
- package/dist/assets/plugins/compositions.json +1 -0
- package/dist/assets/plugins/slots/approval.3e4ea6e4-CqQk6XG_.js +2 -0
- package/dist/assets/plugins/slots/artifacts.84980c32-DQlO5IFk.js +1 -0
- package/dist/assets/plugins/slots/autocompact.ec8f713f-B3KTYwW1.js +1 -0
- package/dist/assets/plugins/slots/builtin-tools.16ef5e25-CZRYQVIP.js +7 -0
- package/dist/assets/plugins/slots/codemode.5f359b9c-Bzl_K_vt.js +10 -0
- package/dist/assets/plugins/slots/domain.832848c8-CvnpuKCY.js +1 -0
- package/dist/assets/plugins/slots/edit.7c802139-kaxIknZ-.js +7 -0
- package/dist/assets/plugins/slots/files.364f16c9-wuB8gcQA.js +2 -0
- package/dist/assets/plugins/slots/grep.d8bf9f57-3FnU8p-d.js +1 -0
- package/dist/assets/plugins/slots/log.07fd59a4-C0PXQ0O1.js +4 -0
- package/dist/assets/plugins/slots/mcp.ea8b6aa2-D0CkHnIw.js +109 -0
- package/dist/assets/plugins/slots/profile.63bc3ae6-BSY3iYfJ.js +1 -0
- package/dist/assets/plugins/slots/prompts.9d9b47cc-xdCkNkoA.js +3 -0
- package/dist/assets/plugins/slots/read.926c024f-qqaxVlEX.js +1 -0
- package/dist/assets/plugins/slots/runner.5393fa6c-DfO2Z9HG.js +8 -0
- package/dist/assets/plugins/slots/skill.56c1cc07-CL_n-l4h.js +4 -0
- package/dist/assets/plugins/slots/vault.587549ba-DbG3F_on.js +1 -0
- package/dist/assets/pwa/pwa.js +12 -12
- package/dist/assets/pwa/sw.js +4 -4
- package/dist/{atomicJson-BJfPFSYF.js → atomicJson-DCIsEywH.js} +3 -3
- package/dist/azure-openai-config-COZUaRzM.js +55 -0
- package/dist/azure-openai-responses-Cs4k2HOd.js +183 -0
- package/dist/{backgroundWork-CeFrbRnj.js → backgroundWork-Bswjs1av.js} +1 -1
- package/dist/browser-BWf8OMfl.js +3 -0
- package/dist/childSession-Cf2-kH4O.js +22 -0
- package/dist/classifier-shared-IhSH9hhh.js +106 -0
- package/dist/cloudflare-workers-ai-system-one-BNnc8MuH.js +52 -0
- package/dist/{codemode-DbPu0yJN.js → codemode-CgVosRtU.js} +5 -2
- package/dist/contracts-CylyLZC8.js +19 -0
- package/dist/diagnostics-1lYFeSJe.js +131 -0
- package/dist/{server-D3PQk1Gt.js → dist-B-vqs6tA.js} +1 -546
- package/dist/dist-Dvx5mlIR.js +50 -0
- package/dist/{domains-BNjGTOPj.js → domains-BqChtBLN.js} +90 -16
- package/dist/env-api-keys-Bow6MJe2.js +32 -0
- package/dist/error-body-CJk7jMUh.js +102 -0
- package/dist/esm-BKJy3O9-.js +1553 -0
- package/dist/{exports-BNZz2DNU.js → exports-C_dclnKs.js} +24 -9
- package/dist/{remoteMcp-CMqZldeA.js → exports-DERO0cQf.js} +1154 -175
- package/dist/{extensionFile-CXOa5G4C.js → extensionFile-Ds7RCpnb.js} +12 -2
- package/dist/github-copilot-headers-D1RedfLn.js +22 -0
- package/dist/google-generative-ai-DXTILNT0.js +328 -0
- package/dist/google-shared-e4JDCTVP.js +19588 -0
- package/dist/google-vertex-a1lzvJfq.js +374 -0
- package/dist/{harnessStore-BT706Ly6.js → harnessStore-BectazJQ.js} +4 -4
- package/dist/harnessStore-C0Zwvny8.js +1 -0
- package/dist/hash-Dt6RIbkn.js +16 -0
- package/dist/headers-CwtEVQvr.js +17 -0
- package/dist/help-Dpm82qDr.js +91 -0
- package/dist/{hubChannel-BHQyzcOo.js → hubChannel-COvmdWGO.js} +11 -28
- package/dist/hubRevisions-58pU2dW5.js +363 -0
- package/dist/identity-BgfHobJH.js +165 -0
- package/dist/index.edge-B0D_Lgbx.js +56 -0
- package/dist/index.edge-BLmsRNW8.js +57 -0
- package/dist/index.edge-COJJ_Dv2.js +937 -0
- package/dist/index.edge-ChYa2LU4.js +14 -0
- package/dist/index.edge-ClLTmPFz.js +191 -0
- package/dist/{index.edge-BgSx_gRO.js → index.edge-b0z7PQ6b.js} +10 -5
- package/dist/iso-BPQViXM8.js +10 -0
- package/dist/{layeredConfig-DPQAnlXD.js → layeredConfig-pQGjhAks.js} +124 -15
- package/dist/{majorModes-DbCfLZH3.js → majorModes-BrL4EtzH.js} +5 -14
- package/dist/majorModes-WXt22_km.js +1 -0
- package/dist/{mcpProjection-BsP0IEnb.js → mcpProjection-pbPBBuvs.js} +2 -2
- package/dist/migrations-5gbLIQIc.js +32 -0
- package/dist/mistral-conversations-CLwhVDjA.js +689 -0
- package/dist/models-Chzm15vC.js +1511 -0
- package/dist/node-BT4GsJQp.js +2479 -0
- package/dist/node-DytJOfYf.js +23 -0
- package/dist/notification-CINsJWDL.js +102 -0
- package/dist/openai-codex-responses-DRMONxDE.js +1210 -0
- package/dist/openai-completions-CcNhAv8l.js +984 -0
- package/dist/openai-decisions-BsFjaAGw.js +142 -0
- package/dist/openai-kPrtlgjl.js +17357 -0
- package/dist/openai-prompt-cache-Bc6qNWt0.js +8 -0
- package/dist/openai-responses-C5Gp2UOV.js +281 -0
- package/dist/openai-responses-shared-BbSi-wBR.js +661 -0
- package/dist/openrouter-cost-CvC52g3b.js +30 -0
- package/dist/openrouter-images-BoHl8g8p.js +124 -0
- package/dist/photon_rs_bg.wasm +0 -0
- package/dist/pi-messages-BXfrZLC7.js +312 -0
- package/dist/piConfig-BDUpA6w0.js +127 -0
- package/dist/piSettings-tdui0CZI.js +1 -0
- package/dist/{platform-B4AAgwJ0.js → platform-yhQXrrM_.js} +1 -1
- package/dist/{platformFiles-C_bXo4Ig.js → platformFiles-DB3Cw1l_.js} +27 -2
- package/dist/pluginContributions-Be9EnCAW.js +16 -0
- package/dist/{protocol-Xpm_mCNN.js → protocol-B6LbEIe6.js} +2 -2
- package/dist/provider-env-CxhHUFiF.js +38 -0
- package/dist/provider-retry-BUoezuw8.js +79 -0
- package/dist/sanitize-unicode-C3Ec8oL6.js +26 -0
- package/dist/sealedChannel-BeWNTWys.js +27 -0
- package/dist/{server-BZh1ZXz_.js → server-1O3JEYO0.js} +8 -19
- package/dist/server-B2G-c0hg.js +639 -0
- package/dist/{server-Dpgh8PDh.js → server-B8P-UkxF.js} +14 -5
- package/dist/server-BR9yl54i.js +2658 -0
- package/dist/{server-tvgQ99rv.js → server-BXFDsLgm.js} +371 -120
- package/dist/{server-BAAL9-NA.js → server-Bt6Zsqo8.js} +3 -10
- package/dist/server-CCwwnpH0.js +148 -0
- package/dist/{server-D4W7EdJY.js → server-Cgym-G0a.js} +16 -16
- package/dist/{server-DJAanjoI.js → server-Ci3ls6LL.js} +492 -103
- package/dist/{server-36iuA3MI.js → server-Ci_BGVwd.js} +3 -3
- package/dist/{server-A-_GFpPr.js → server-CyYesT-G.js} +10 -9
- package/dist/server-CzJjYgVk.js +295 -0
- package/dist/server-DFCXmDed.js +1806 -0
- package/dist/{server-BE6VqEiA.js → server-DL6UyXfJ.js} +19 -12
- package/dist/{server-D8ndq0wL.js → server-DPTp6GXS.js} +11 -9
- package/dist/server-DRcCuj6P.js +217 -0
- package/dist/server-Dgn4el5K.js +190 -0
- package/dist/server-DhkR6ugd.js +577 -0
- package/dist/server-GIQIpf33.js +489 -0
- package/dist/server-OerXqXJT.js +680 -0
- package/dist/server-Re1VNk9s.js +1517 -0
- package/dist/{server-Dt4y1rZD.js → server-V8W5mcGu.js} +6 -6
- package/dist/server-_0288DYR.js +935 -0
- package/dist/server-cStfn1Yv.js +505 -0
- package/dist/server-pY027myK.js +1057 -0
- package/dist/{build-2gFaVEfG.js → serverPlugin-OOfjB8tm.js} +3937 -3
- package/dist/{sessionConfig-rBQgzXlT.js → sessionConfig-DfwcUKO2.js} +551 -760
- package/dist/simple-options-CFzI5Pd_.js +156 -0
- package/dist/streaming-json-BWTHTwz-.js +858 -0
- package/dist/system-one-shared-CiIrx29d.js +132 -0
- package/dist/{notification-D76PSL7r.js → telemetry-Csv1ZxAn.js} +1 -92
- package/dist/transform-messages-D77af7Bx.js +356 -0
- package/dist/truncate-M3KbFyVj.js +89 -0
- package/dist/typesafe-system-one-DGxeggJh.js +37 -0
- package/dist/uuid-B0QJx6Kr.js +31 -0
- package/dist/{validation-D77NZBrx.js → validation-DuOGOKEi.js} +2 -2
- package/dist/{value-Djvc2foV.js → value-DyVsxCwZ.js} +1 -1
- package/dist/vaultSettings-BFCRCBM3.js +328 -0
- package/dist/web-cN41ySs9.js +3 -0
- package/dist/worker.js +95189 -49865
- package/dist/workflow-BgwWq0nq.js +79 -0
- package/package.json +32 -22
- package/wrangler.jsonc +2 -2
- package/dist/assets/assets/channel-CMrEzemr.js +0 -2
- package/dist/assets/assets/chunk-XXDRQBXY-CFf0S6bN.js +0 -2
- package/dist/assets/assets/flowDiagram-IUGLLWBU-BhGbWVf0.js +0 -1
- package/dist/assets/assets/index-Bx_K4Joy.js +0 -155
- package/dist/assets/assets/index-DZM68mTk.css +0 -1
- package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-q91tR8ri.js +0 -9
- package/dist/contextProjection-DVP2Vc5j.js +0 -188
- package/dist/harnessStore-BiH9vSuD.js +0 -1
- package/dist/majorModes-BvWNqoHt.js +0 -1
- package/dist/piSettings-B6fsgIBA.js +0 -1
- package/dist/server-BZaPPoQp.js +0 -592
- package/dist/server-D75MWDhB.js +0 -118
- package/dist/server-r358hzQg.js +0 -280
- package/dist/serverPlugin-BOI6c6s5.js +0 -3393
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { Bn as BACKGROUND_CONTEXT, pn as poHomeDirectory, rr as defineServiceContract } from "./serverPlugin-OOfjB8tm.js";
|
|
2
|
+
import { i as readTextIfExists, s as writeFileAtomic } from "./platformFiles-DB3Cw1l_.js";
|
|
3
|
+
import "./platform-yhQXrrM_.js";
|
|
4
|
+
import "./piSettings-tdui0CZI.js";
|
|
5
|
+
import { n as Check } from "./value-DyVsxCwZ.js";
|
|
6
|
+
import { A as string$1, C as looseObject, D as preprocess, E as optional, F as safeParse, I as toJSONSchema, L as _coercedBoolean, M as unknown, N as url, O as record$2, R as _coercedNumber, S as literal, T as object, U as NEVER, _ as intersection, c as _enum, d as any, f as array, g as email, h as discriminatedUnion, i as ZodNumber, j as union, l as _null, p as boolean$1, s as ZodString, t as ZodBoolean, w as number$1, x as lazy, z as _coercedString } from "./schemas-Vj8-rCR4.js";
|
|
7
|
+
import { n as datetime, t as date$1 } from "./iso-BPQViXM8.js";
|
|
8
|
+
import { r as PO_USER_MCP_CONFIG_FILE } from "./mcpProjection-pbPBBuvs.js";
|
|
9
|
+
import { a as assertRevision, i as assertEntryName, l as VAULT_ACCOUNT_OPERATIONS, n as VaultError, o as serializeValue } from "./vaultSettings-BFCRCBM3.js";
|
|
10
|
+
import { createHash } from "node:crypto";
|
|
11
|
+
import { join } from "node:path";
|
|
4
12
|
//#region ../../core/po-web-security/src/services/outboundHost/index.ts
|
|
5
13
|
/** Cloud metadata endpoints reachable by name. Their IP forms are refused as IP literals. */
|
|
6
14
|
const METADATA_HOSTS = /* @__PURE__ */ new Set([
|
|
@@ -94,69 +102,6 @@ function guardedFetch(options) {
|
|
|
94
102
|
};
|
|
95
103
|
}
|
|
96
104
|
//#endregion
|
|
97
|
-
//#region ../../../node_modules/.pnpm/@modelcontextprotocol+client@2.3.1/node_modules/@modelcontextprotocol/client/dist/chunk-Br0eD_fh.mjs
|
|
98
|
-
var __create = Object.create;
|
|
99
|
-
var __defProp = Object.defineProperty;
|
|
100
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
101
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
102
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
103
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
104
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
105
|
-
var __exportAll = (all, symbols) => {
|
|
106
|
-
let target = {};
|
|
107
|
-
for (var name in all) __defProp(target, name, {
|
|
108
|
-
get: all[name],
|
|
109
|
-
enumerable: true
|
|
110
|
-
});
|
|
111
|
-
if (symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
112
|
-
return target;
|
|
113
|
-
};
|
|
114
|
-
var __copyProps = (to, from, except, desc) => {
|
|
115
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
116
|
-
key = keys[i];
|
|
117
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
118
|
-
get: ((k) => from[k]).bind(null, key),
|
|
119
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
return to;
|
|
123
|
-
};
|
|
124
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
125
|
-
value: mod,
|
|
126
|
-
enumerable: true
|
|
127
|
-
}) : target, mod));
|
|
128
|
-
//#endregion
|
|
129
|
-
//#region ../../../node_modules/.pnpm/@modelcontextprotocol+client@2.3.1/node_modules/@modelcontextprotocol/client/dist/dialects-BOhdv1Fc.mjs
|
|
130
|
-
/**
|
|
131
|
-
* Canonical `$schema` URIs per supported dialect (http + https variants, trailing-`#` stripped).
|
|
132
|
-
*/
|
|
133
|
-
const DRAFT_2020_12_URIS = /* @__PURE__ */ new Set(["https://json-schema.org/draft/2020-12/schema", "http://json-schema.org/draft/2020-12/schema"]);
|
|
134
|
-
const DRAFT_2019_09_URIS = /* @__PURE__ */ new Set(["https://json-schema.org/draft/2019-09/schema", "http://json-schema.org/draft/2019-09/schema"]);
|
|
135
|
-
const DRAFT_07_URIS = /* @__PURE__ */ new Set(["https://json-schema.org/draft-07/schema", "http://json-schema.org/draft-07/schema"]);
|
|
136
|
-
const DRAFT_06_URIS = /* @__PURE__ */ new Set(["https://json-schema.org/draft-06/schema", "http://json-schema.org/draft-06/schema"]);
|
|
137
|
-
/**
|
|
138
|
-
* Whether a `$schema` value declares the 2019-09 dialect — the only supported dialect with
|
|
139
|
-
* `$recursiveRef`/`$recursiveAnchor`. Non-throwing (unlike {@linkcode declaredDialect}) so
|
|
140
|
-
* wire-layer callers can consult it for documents whose dialect may be unsupported.
|
|
141
|
-
*/
|
|
142
|
-
function declares2019Dialect($schema) {
|
|
143
|
-
return typeof $schema === "string" && DRAFT_2019_09_URIS.has($schema.replace(/#$/, ""));
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Classify a schema's declared `$schema` dialect. No `$schema` (or a non-string one) means
|
|
147
|
-
* 2020-12. Any other dialect throws a plain `Error` with a clear message rather than letting the
|
|
148
|
-
* engine crash on an opaque internal error or silently mis-validate; `remedy` names the calling
|
|
149
|
-
* provider's escape hatch in that message.
|
|
150
|
-
*/
|
|
151
|
-
function declaredDialect(schema, remedy) {
|
|
152
|
-
if (!("$schema" in schema) || typeof schema.$schema !== "string") return "2020-12";
|
|
153
|
-
const declared = schema.$schema.replace(/#$/, "");
|
|
154
|
-
if (DRAFT_2020_12_URIS.has(declared)) return "2020-12";
|
|
155
|
-
if (DRAFT_2019_09_URIS.has(declared)) return "2019-09";
|
|
156
|
-
if (DRAFT_07_URIS.has(declared) || DRAFT_06_URIS.has(declared)) return "draft-7";
|
|
157
|
-
throw new Error(`JSON Schema declares an unsupported dialect ("$schema": "${schema.$schema.slice(0, 200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${remedy}`);
|
|
158
|
-
}
|
|
159
|
-
//#endregion
|
|
160
105
|
//#region ../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/compat.js
|
|
161
106
|
/** @deprecated Use the raw string literal codes instead, e.g. "invalid_type". */
|
|
162
107
|
const ZodIssueCode = {
|
|
@@ -176,14 +121,6 @@ const ZodIssueCode = {
|
|
|
176
121
|
var ZodFirstPartyTypeKind;
|
|
177
122
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
178
123
|
//#endregion
|
|
179
|
-
//#region ../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/iso.js
|
|
180
|
-
function datetime(params) {
|
|
181
|
-
return _isoDateTime(ZodISODateTime, params);
|
|
182
|
-
}
|
|
183
|
-
function date$1(params) {
|
|
184
|
-
return _isoDate(ZodISODate, params);
|
|
185
|
-
}
|
|
186
|
-
//#endregion
|
|
187
124
|
//#region ../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/coerce.js
|
|
188
125
|
function string(params) {
|
|
189
126
|
return _coercedString(ZodString, params);
|
|
@@ -197,6 +134,7 @@ function boolean(params) {
|
|
|
197
134
|
//#endregion
|
|
198
135
|
//#region ../../../node_modules/.pnpm/@modelcontextprotocol+core@2.3.1/node_modules/@modelcontextprotocol/core/dist/auth-BNDyLTqp.mjs
|
|
199
136
|
const LATEST_PROTOCOL_VERSION = "2025-11-25";
|
|
137
|
+
const DEFAULT_NEGOTIATED_PROTOCOL_VERSION = "2025-03-26";
|
|
200
138
|
const SUPPORTED_PROTOCOL_VERSIONS = [
|
|
201
139
|
LATEST_PROTOCOL_VERSION,
|
|
202
140
|
"2025-06-18",
|
|
@@ -266,10 +204,10 @@ const JSONValueSchema = lazy(() => union([
|
|
|
266
204
|
number$1(),
|
|
267
205
|
boolean$1(),
|
|
268
206
|
_null(),
|
|
269
|
-
record$
|
|
207
|
+
record$2(string$1(), JSONValueSchema),
|
|
270
208
|
array(JSONValueSchema)
|
|
271
209
|
]));
|
|
272
|
-
const JSONObjectSchema = record$
|
|
210
|
+
const JSONObjectSchema = record$2(string$1(), JSONValueSchema);
|
|
273
211
|
const JSONArraySchema = array(JSONValueSchema);
|
|
274
212
|
/**
|
|
275
213
|
* A progress token, used to associate progress notifications with the original request.
|
|
@@ -457,7 +395,7 @@ const ServerTasksCapabilitySchema = looseObject({
|
|
|
457
395
|
* Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities.
|
|
458
396
|
*/
|
|
459
397
|
const ClientCapabilitiesSchema = object({
|
|
460
|
-
experimental: record$
|
|
398
|
+
experimental: record$2(string$1(), JSONObjectSchema).optional(),
|
|
461
399
|
sampling: object({
|
|
462
400
|
context: JSONObjectSchema.optional(),
|
|
463
401
|
tools: JSONObjectSchema.optional()
|
|
@@ -465,7 +403,7 @@ const ClientCapabilitiesSchema = object({
|
|
|
465
403
|
elicitation: ElicitationCapabilitySchema.optional(),
|
|
466
404
|
roots: object({ listChanged: boolean$1().optional() }).optional(),
|
|
467
405
|
tasks: ClientTasksCapabilitySchema.optional(),
|
|
468
|
-
extensions: record$
|
|
406
|
+
extensions: record$2(string$1(), JSONObjectSchema).optional()
|
|
469
407
|
});
|
|
470
408
|
const InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
471
409
|
protocolVersion: string$1(),
|
|
@@ -483,7 +421,7 @@ const InitializeRequestSchema = RequestSchema.extend({
|
|
|
483
421
|
* Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities.
|
|
484
422
|
*/
|
|
485
423
|
const ServerCapabilitiesSchema = object({
|
|
486
|
-
experimental: record$
|
|
424
|
+
experimental: record$2(string$1(), JSONObjectSchema).optional(),
|
|
487
425
|
logging: JSONObjectSchema.optional(),
|
|
488
426
|
completions: JSONObjectSchema.optional(),
|
|
489
427
|
prompts: object({ listChanged: boolean$1().optional() }).optional(),
|
|
@@ -493,7 +431,7 @@ const ServerCapabilitiesSchema = object({
|
|
|
493
431
|
}).optional(),
|
|
494
432
|
tools: object({ listChanged: boolean$1().optional() }).optional(),
|
|
495
433
|
tasks: ServerTasksCapabilitySchema.optional(),
|
|
496
|
-
extensions: record$
|
|
434
|
+
extensions: record$2(string$1(), JSONObjectSchema).optional()
|
|
497
435
|
});
|
|
498
436
|
/**
|
|
499
437
|
* After receiving an initialize request from the client, the server sends this response.
|
|
@@ -564,7 +502,7 @@ const PaginatedResultSchema = ResultSchema.extend({ nextCursor: CursorSchema.opt
|
|
|
564
502
|
const ResourceContentsSchema = object({
|
|
565
503
|
uri: string$1(),
|
|
566
504
|
mimeType: optional(string$1()),
|
|
567
|
-
_meta: record$
|
|
505
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
568
506
|
});
|
|
569
507
|
const TextResourceContentsSchema = ResourceContentsSchema.extend({ text: string$1() });
|
|
570
508
|
/**
|
|
@@ -762,7 +700,7 @@ const ListPromptsResultSchema = PaginatedResultSchema.extend({ prompts: array(Pr
|
|
|
762
700
|
*/
|
|
763
701
|
const GetPromptRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
764
702
|
name: string$1(),
|
|
765
|
-
arguments: record$
|
|
703
|
+
arguments: record$2(string$1(), string$1()).optional()
|
|
766
704
|
});
|
|
767
705
|
/**
|
|
768
706
|
* Used by the client to get a prompt provided by the server.
|
|
@@ -778,7 +716,7 @@ const TextContentSchema = object({
|
|
|
778
716
|
type: literal("text"),
|
|
779
717
|
text: string$1(),
|
|
780
718
|
annotations: AnnotationsSchema.optional(),
|
|
781
|
-
_meta: record$
|
|
719
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
782
720
|
});
|
|
783
721
|
/**
|
|
784
722
|
* An image provided to or from an LLM.
|
|
@@ -788,7 +726,7 @@ const ImageContentSchema = object({
|
|
|
788
726
|
data: Base64Schema,
|
|
789
727
|
mimeType: string$1(),
|
|
790
728
|
annotations: AnnotationsSchema.optional(),
|
|
791
|
-
_meta: record$
|
|
729
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
792
730
|
});
|
|
793
731
|
/**
|
|
794
732
|
* Audio content provided to or from an LLM.
|
|
@@ -798,7 +736,7 @@ const AudioContentSchema = object({
|
|
|
798
736
|
data: Base64Schema,
|
|
799
737
|
mimeType: string$1(),
|
|
800
738
|
annotations: AnnotationsSchema.optional(),
|
|
801
|
-
_meta: record$
|
|
739
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
802
740
|
});
|
|
803
741
|
/**
|
|
804
742
|
* A tool call request from an assistant (LLM).
|
|
@@ -812,8 +750,8 @@ const ToolUseContentSchema = object({
|
|
|
812
750
|
type: literal("tool_use"),
|
|
813
751
|
name: string$1(),
|
|
814
752
|
id: string$1(),
|
|
815
|
-
input: record$
|
|
816
|
-
_meta: record$
|
|
753
|
+
input: record$2(string$1(), unknown()),
|
|
754
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
817
755
|
});
|
|
818
756
|
/**
|
|
819
757
|
* The contents of a resource, embedded into a prompt or tool call result.
|
|
@@ -822,7 +760,7 @@ const EmbeddedResourceSchema = object({
|
|
|
822
760
|
type: literal("resource"),
|
|
823
761
|
resource: union([TextResourceContentsSchema, BlobResourceContentsSchema]),
|
|
824
762
|
annotations: AnnotationsSchema.optional(),
|
|
825
|
-
_meta: record$
|
|
763
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
826
764
|
});
|
|
827
765
|
/**
|
|
828
766
|
* A resource that the server is capable of reading, included in a prompt or tool call result.
|
|
@@ -895,13 +833,13 @@ const ToolSchema = object({
|
|
|
895
833
|
description: string$1().optional(),
|
|
896
834
|
inputSchema: object({
|
|
897
835
|
type: literal("object"),
|
|
898
|
-
properties: record$
|
|
836
|
+
properties: record$2(string$1(), JSONValueSchema).optional(),
|
|
899
837
|
required: array(string$1()).optional()
|
|
900
838
|
}).catchall(unknown()),
|
|
901
839
|
outputSchema: looseObject({ $schema: string$1().optional() }).optional(),
|
|
902
840
|
annotations: ToolAnnotationsSchema.optional(),
|
|
903
841
|
execution: ToolExecutionSchema.optional(),
|
|
904
|
-
_meta: record$
|
|
842
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
905
843
|
});
|
|
906
844
|
/**
|
|
907
845
|
* Sent from the client to request a list of tools the server has.
|
|
@@ -928,7 +866,7 @@ const CompatibilityCallToolResultSchema = CallToolResultSchema.or(ResultSchema.e
|
|
|
928
866
|
*/
|
|
929
867
|
const CallToolRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({
|
|
930
868
|
name: string$1(),
|
|
931
|
-
arguments: record$
|
|
869
|
+
arguments: record$2(string$1(), unknown()).optional()
|
|
932
870
|
});
|
|
933
871
|
/**
|
|
934
872
|
* Used by the client to invoke a tool provided by the server.
|
|
@@ -1058,7 +996,7 @@ const ToolResultContentSchema = object({
|
|
|
1058
996
|
content: array(ContentBlockSchema),
|
|
1059
997
|
structuredContent: unknown().optional(),
|
|
1060
998
|
isError: boolean$1().optional(),
|
|
1061
|
-
_meta: record$
|
|
999
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
1062
1000
|
});
|
|
1063
1001
|
/**
|
|
1064
1002
|
* Basic content types for sampling responses (without tool use).
|
|
@@ -1098,7 +1036,7 @@ const SamplingMessageContentBlockSchema = discriminatedUnion("type", [
|
|
|
1098
1036
|
const SamplingMessageSchema = object({
|
|
1099
1037
|
role: RoleSchema,
|
|
1100
1038
|
content: union([SamplingMessageContentBlockSchema, array(SamplingMessageContentBlockSchema)]),
|
|
1101
|
-
_meta: record$
|
|
1039
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
1102
1040
|
});
|
|
1103
1041
|
/**
|
|
1104
1042
|
* Parameters for a `sampling/createMessage` request.
|
|
@@ -1304,7 +1242,7 @@ const ElicitRequestFormParamsSchema = TaskAugmentedRequestParamsSchema.extend({
|
|
|
1304
1242
|
message: string$1(),
|
|
1305
1243
|
requestedSchema: object({
|
|
1306
1244
|
type: literal("object"),
|
|
1307
|
-
properties: record$
|
|
1245
|
+
properties: record$2(string$1(), PrimitiveSchemaDefinitionSchema),
|
|
1308
1246
|
required: array(string$1()).optional()
|
|
1309
1247
|
}).catchall(unknown())
|
|
1310
1248
|
});
|
|
@@ -1362,7 +1300,7 @@ const ElicitResultSchema = ResultSchema.extend({
|
|
|
1362
1300
|
"decline",
|
|
1363
1301
|
"cancel"
|
|
1364
1302
|
]),
|
|
1365
|
-
content: preprocess((val) => val === null ? void 0 : val, record$
|
|
1303
|
+
content: preprocess((val) => val === null ? void 0 : val, record$2(string$1(), union([
|
|
1366
1304
|
string$1(),
|
|
1367
1305
|
number$1(),
|
|
1368
1306
|
boolean$1(),
|
|
@@ -1392,7 +1330,7 @@ const CompleteRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
|
1392
1330
|
name: string$1(),
|
|
1393
1331
|
value: string$1()
|
|
1394
1332
|
}),
|
|
1395
|
-
context: object({ arguments: record$
|
|
1333
|
+
context: object({ arguments: record$2(string$1(), string$1()).optional() }).optional()
|
|
1396
1334
|
});
|
|
1397
1335
|
/**
|
|
1398
1336
|
* A request from the client to the server, to ask for completion options.
|
|
@@ -1419,7 +1357,7 @@ const CompleteResultSchema = ResultSchema.extend({ completion: looseObject({
|
|
|
1419
1357
|
const RootSchema = object({
|
|
1420
1358
|
uri: string$1().startsWith("file://"),
|
|
1421
1359
|
name: string$1().optional(),
|
|
1422
|
-
_meta: record$
|
|
1360
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
1423
1361
|
});
|
|
1424
1362
|
/**
|
|
1425
1363
|
* Sent from the server to request a list of root URIs from the client.
|
|
@@ -1831,6 +1769,69 @@ const OAuthTokenRevocationRequestSchema = object({
|
|
|
1831
1769
|
token_type_hint: string$1().optional()
|
|
1832
1770
|
}).strip();
|
|
1833
1771
|
//#endregion
|
|
1772
|
+
//#region ../../../node_modules/.pnpm/@modelcontextprotocol+client@2.3.1/node_modules/@modelcontextprotocol/client/dist/chunk-Br0eD_fh.mjs
|
|
1773
|
+
var __create = Object.create;
|
|
1774
|
+
var __defProp = Object.defineProperty;
|
|
1775
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
1776
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
1777
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
1778
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1779
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
1780
|
+
var __exportAll = (all, symbols) => {
|
|
1781
|
+
let target = {};
|
|
1782
|
+
for (var name in all) __defProp(target, name, {
|
|
1783
|
+
get: all[name],
|
|
1784
|
+
enumerable: true
|
|
1785
|
+
});
|
|
1786
|
+
if (symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
1787
|
+
return target;
|
|
1788
|
+
};
|
|
1789
|
+
var __copyProps = (to, from, except, desc) => {
|
|
1790
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
1791
|
+
key = keys[i];
|
|
1792
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
1793
|
+
get: ((k) => from[k]).bind(null, key),
|
|
1794
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
1795
|
+
});
|
|
1796
|
+
}
|
|
1797
|
+
return to;
|
|
1798
|
+
};
|
|
1799
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
1800
|
+
value: mod,
|
|
1801
|
+
enumerable: true
|
|
1802
|
+
}) : target, mod));
|
|
1803
|
+
//#endregion
|
|
1804
|
+
//#region ../../../node_modules/.pnpm/@modelcontextprotocol+client@2.3.1/node_modules/@modelcontextprotocol/client/dist/dialects-BOhdv1Fc.mjs
|
|
1805
|
+
/**
|
|
1806
|
+
* Canonical `$schema` URIs per supported dialect (http + https variants, trailing-`#` stripped).
|
|
1807
|
+
*/
|
|
1808
|
+
const DRAFT_2020_12_URIS = /* @__PURE__ */ new Set(["https://json-schema.org/draft/2020-12/schema", "http://json-schema.org/draft/2020-12/schema"]);
|
|
1809
|
+
const DRAFT_2019_09_URIS = /* @__PURE__ */ new Set(["https://json-schema.org/draft/2019-09/schema", "http://json-schema.org/draft/2019-09/schema"]);
|
|
1810
|
+
const DRAFT_07_URIS = /* @__PURE__ */ new Set(["https://json-schema.org/draft-07/schema", "http://json-schema.org/draft-07/schema"]);
|
|
1811
|
+
const DRAFT_06_URIS = /* @__PURE__ */ new Set(["https://json-schema.org/draft-06/schema", "http://json-schema.org/draft-06/schema"]);
|
|
1812
|
+
/**
|
|
1813
|
+
* Whether a `$schema` value declares the 2019-09 dialect — the only supported dialect with
|
|
1814
|
+
* `$recursiveRef`/`$recursiveAnchor`. Non-throwing (unlike {@linkcode declaredDialect}) so
|
|
1815
|
+
* wire-layer callers can consult it for documents whose dialect may be unsupported.
|
|
1816
|
+
*/
|
|
1817
|
+
function declares2019Dialect($schema) {
|
|
1818
|
+
return typeof $schema === "string" && DRAFT_2019_09_URIS.has($schema.replace(/#$/, ""));
|
|
1819
|
+
}
|
|
1820
|
+
/**
|
|
1821
|
+
* Classify a schema's declared `$schema` dialect. No `$schema` (or a non-string one) means
|
|
1822
|
+
* 2020-12. Any other dialect throws a plain `Error` with a clear message rather than letting the
|
|
1823
|
+
* engine crash on an opaque internal error or silently mis-validate; `remedy` names the calling
|
|
1824
|
+
* provider's escape hatch in that message.
|
|
1825
|
+
*/
|
|
1826
|
+
function declaredDialect(schema, remedy) {
|
|
1827
|
+
if (!("$schema" in schema) || typeof schema.$schema !== "string") return "2020-12";
|
|
1828
|
+
const declared = schema.$schema.replace(/#$/, "");
|
|
1829
|
+
if (DRAFT_2020_12_URIS.has(declared)) return "2020-12";
|
|
1830
|
+
if (DRAFT_2019_09_URIS.has(declared)) return "2019-09";
|
|
1831
|
+
if (DRAFT_07_URIS.has(declared) || DRAFT_06_URIS.has(declared)) return "draft-7";
|
|
1832
|
+
throw new Error(`JSON Schema declares an unsupported dialect ("$schema": "${schema.$schema.slice(0, 200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${remedy}`);
|
|
1833
|
+
}
|
|
1834
|
+
//#endregion
|
|
1834
1835
|
//#region ../../../node_modules/.pnpm/@modelcontextprotocol+client@2.3.1/node_modules/@modelcontextprotocol/client/dist/src-WCy6ifGf.mjs
|
|
1835
1836
|
/**
|
|
1836
1837
|
* Cross-bundle `instanceof` support for the SDK error classes.
|
|
@@ -2387,10 +2388,10 @@ function build$1() {
|
|
|
2387
2388
|
number$1(),
|
|
2388
2389
|
boolean$1(),
|
|
2389
2390
|
_null(),
|
|
2390
|
-
record$
|
|
2391
|
+
record$2(string$1(), JSONValueSchema$1),
|
|
2391
2392
|
array(JSONValueSchema$1)
|
|
2392
2393
|
]));
|
|
2393
|
-
const JSONObjectSchema$1 = record$
|
|
2394
|
+
const JSONObjectSchema$1 = record$2(string$1(), JSONValueSchema$1);
|
|
2394
2395
|
/**
|
|
2395
2396
|
* A progress token, used to associate progress notifications with the original request.
|
|
2396
2397
|
*/
|
|
@@ -2523,7 +2524,7 @@ function build$1() {
|
|
|
2523
2524
|
* Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities.
|
|
2524
2525
|
*/
|
|
2525
2526
|
const ClientCapabilitiesSchema$1 = object({
|
|
2526
|
-
experimental: record$
|
|
2527
|
+
experimental: record$2(string$1(), JSONObjectSchema$1).optional(),
|
|
2527
2528
|
sampling: object({
|
|
2528
2529
|
context: JSONObjectSchema$1.optional(),
|
|
2529
2530
|
tools: JSONObjectSchema$1.optional()
|
|
@@ -2531,7 +2532,7 @@ function build$1() {
|
|
|
2531
2532
|
elicitation: ElicitationCapabilitySchema.optional(),
|
|
2532
2533
|
roots: object({ listChanged: boolean$1().optional() }).optional(),
|
|
2533
2534
|
tasks: ClientTasksCapabilitySchema$1.optional(),
|
|
2534
|
-
extensions: record$
|
|
2535
|
+
extensions: record$2(string$1(), JSONObjectSchema$1).optional()
|
|
2535
2536
|
});
|
|
2536
2537
|
const InitializeRequestParamsSchema$1 = BaseRequestParamsSchema$1.extend({
|
|
2537
2538
|
protocolVersion: string$1(),
|
|
@@ -2549,7 +2550,7 @@ function build$1() {
|
|
|
2549
2550
|
* Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities.
|
|
2550
2551
|
*/
|
|
2551
2552
|
const ServerCapabilitiesSchema$1 = object({
|
|
2552
|
-
experimental: record$
|
|
2553
|
+
experimental: record$2(string$1(), JSONObjectSchema$1).optional(),
|
|
2553
2554
|
logging: JSONObjectSchema$1.optional(),
|
|
2554
2555
|
completions: JSONObjectSchema$1.optional(),
|
|
2555
2556
|
prompts: object({ listChanged: boolean$1().optional() }).optional(),
|
|
@@ -2559,7 +2560,7 @@ function build$1() {
|
|
|
2559
2560
|
}).optional(),
|
|
2560
2561
|
tools: object({ listChanged: boolean$1().optional() }).optional(),
|
|
2561
2562
|
tasks: ServerTasksCapabilitySchema$1.optional(),
|
|
2562
|
-
extensions: record$
|
|
2563
|
+
extensions: record$2(string$1(), JSONObjectSchema$1).optional()
|
|
2563
2564
|
});
|
|
2564
2565
|
/**
|
|
2565
2566
|
* After receiving an initialize request from the client, the server sends this response.
|
|
@@ -2612,7 +2613,7 @@ function build$1() {
|
|
|
2612
2613
|
const ResourceContentsSchema$1 = object({
|
|
2613
2614
|
uri: string$1(),
|
|
2614
2615
|
mimeType: optional(string$1()),
|
|
2615
|
-
_meta: record$
|
|
2616
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
2616
2617
|
});
|
|
2617
2618
|
const TextResourceContentsSchema$1 = ResourceContentsSchema$1.extend({ text: string$1() });
|
|
2618
2619
|
/**
|
|
@@ -2763,7 +2764,7 @@ function build$1() {
|
|
|
2763
2764
|
*/
|
|
2764
2765
|
const GetPromptRequestParamsSchema$1 = BaseRequestParamsSchema$1.extend({
|
|
2765
2766
|
name: string$1(),
|
|
2766
|
-
arguments: record$
|
|
2767
|
+
arguments: record$2(string$1(), string$1()).optional()
|
|
2767
2768
|
});
|
|
2768
2769
|
/**
|
|
2769
2770
|
* Used by the client to get a prompt provided by the server.
|
|
@@ -2779,7 +2780,7 @@ function build$1() {
|
|
|
2779
2780
|
type: literal("text"),
|
|
2780
2781
|
text: string$1(),
|
|
2781
2782
|
annotations: AnnotationsSchema$1.optional(),
|
|
2782
|
-
_meta: record$
|
|
2783
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
2783
2784
|
});
|
|
2784
2785
|
/**
|
|
2785
2786
|
* An image provided to or from an LLM.
|
|
@@ -2789,7 +2790,7 @@ function build$1() {
|
|
|
2789
2790
|
data: Base64Schema,
|
|
2790
2791
|
mimeType: string$1(),
|
|
2791
2792
|
annotations: AnnotationsSchema$1.optional(),
|
|
2792
|
-
_meta: record$
|
|
2793
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
2793
2794
|
});
|
|
2794
2795
|
/**
|
|
2795
2796
|
* Audio content provided to or from an LLM.
|
|
@@ -2799,7 +2800,7 @@ function build$1() {
|
|
|
2799
2800
|
data: Base64Schema,
|
|
2800
2801
|
mimeType: string$1(),
|
|
2801
2802
|
annotations: AnnotationsSchema$1.optional(),
|
|
2802
|
-
_meta: record$
|
|
2803
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
2803
2804
|
});
|
|
2804
2805
|
/**
|
|
2805
2806
|
* A tool call request from an assistant (LLM).
|
|
@@ -2813,8 +2814,8 @@ function build$1() {
|
|
|
2813
2814
|
type: literal("tool_use"),
|
|
2814
2815
|
name: string$1(),
|
|
2815
2816
|
id: string$1(),
|
|
2816
|
-
input: record$
|
|
2817
|
-
_meta: record$
|
|
2817
|
+
input: record$2(string$1(), unknown()),
|
|
2818
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
2818
2819
|
});
|
|
2819
2820
|
/**
|
|
2820
2821
|
* The contents of a resource, embedded into a prompt or tool call result.
|
|
@@ -2823,7 +2824,7 @@ function build$1() {
|
|
|
2823
2824
|
type: literal("resource"),
|
|
2824
2825
|
resource: union([TextResourceContentsSchema$1, BlobResourceContentsSchema$1]),
|
|
2825
2826
|
annotations: AnnotationsSchema$1.optional(),
|
|
2826
|
-
_meta: record$
|
|
2827
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
2827
2828
|
});
|
|
2828
2829
|
/**
|
|
2829
2830
|
* A resource that the server is capable of reading, included in a prompt or tool call result.
|
|
@@ -2896,17 +2897,17 @@ function build$1() {
|
|
|
2896
2897
|
description: string$1().optional(),
|
|
2897
2898
|
inputSchema: object({
|
|
2898
2899
|
type: literal("object"),
|
|
2899
|
-
properties: record$
|
|
2900
|
+
properties: record$2(string$1(), JSONValueSchema$1).optional(),
|
|
2900
2901
|
required: array(string$1()).optional()
|
|
2901
2902
|
}).catchall(unknown()),
|
|
2902
2903
|
outputSchema: object({
|
|
2903
2904
|
type: literal("object"),
|
|
2904
|
-
properties: record$
|
|
2905
|
+
properties: record$2(string$1(), JSONValueSchema$1).optional(),
|
|
2905
2906
|
required: array(string$1()).optional()
|
|
2906
2907
|
}).catchall(unknown()).optional(),
|
|
2907
2908
|
annotations: ToolAnnotationsSchema$1.optional(),
|
|
2908
2909
|
execution: ToolExecutionSchema$1.optional(),
|
|
2909
|
-
_meta: record$
|
|
2910
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
2910
2911
|
});
|
|
2911
2912
|
/**
|
|
2912
2913
|
* Sent from the client to request a list of tools the server has.
|
|
@@ -2921,7 +2922,7 @@ function build$1() {
|
|
|
2921
2922
|
*/
|
|
2922
2923
|
const CallToolResultSchema$1 = ResultSchema$1.extend({
|
|
2923
2924
|
content: array(ContentBlockSchema$1),
|
|
2924
|
-
structuredContent: record$
|
|
2925
|
+
structuredContent: record$2(string$1(), unknown()).optional(),
|
|
2925
2926
|
isError: boolean$1().optional()
|
|
2926
2927
|
});
|
|
2927
2928
|
/**
|
|
@@ -2929,7 +2930,7 @@ function build$1() {
|
|
|
2929
2930
|
*/
|
|
2930
2931
|
const CallToolRequestParamsSchema$1 = TaskAugmentedRequestParamsSchema$1.extend({
|
|
2931
2932
|
name: string$1(),
|
|
2932
|
-
arguments: record$
|
|
2933
|
+
arguments: record$2(string$1(), unknown()).optional()
|
|
2933
2934
|
});
|
|
2934
2935
|
/**
|
|
2935
2936
|
* Used by the client to invoke a tool provided by the server.
|
|
@@ -3051,7 +3052,7 @@ function build$1() {
|
|
|
3051
3052
|
content: array(ContentBlockSchema$1),
|
|
3052
3053
|
structuredContent: object({}).loose().optional(),
|
|
3053
3054
|
isError: boolean$1().optional(),
|
|
3054
|
-
_meta: record$
|
|
3055
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
3055
3056
|
});
|
|
3056
3057
|
/**
|
|
3057
3058
|
* Basic content types for sampling responses (without tool use).
|
|
@@ -3091,7 +3092,7 @@ function build$1() {
|
|
|
3091
3092
|
const SamplingMessageSchema$1 = object({
|
|
3092
3093
|
role: RoleSchema$1,
|
|
3093
3094
|
content: union([SamplingMessageContentBlockSchema$1, array(SamplingMessageContentBlockSchema$1)]),
|
|
3094
|
-
_meta: record$
|
|
3095
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
3095
3096
|
});
|
|
3096
3097
|
/**
|
|
3097
3098
|
* Parameters for a `sampling/createMessage` request.
|
|
@@ -3297,7 +3298,7 @@ function build$1() {
|
|
|
3297
3298
|
message: string$1(),
|
|
3298
3299
|
requestedSchema: object({
|
|
3299
3300
|
type: literal("object"),
|
|
3300
|
-
properties: record$
|
|
3301
|
+
properties: record$2(string$1(), PrimitiveSchemaDefinitionSchema$1),
|
|
3301
3302
|
required: array(string$1()).optional()
|
|
3302
3303
|
}).catchall(unknown())
|
|
3303
3304
|
});
|
|
@@ -3347,7 +3348,7 @@ function build$1() {
|
|
|
3347
3348
|
"decline",
|
|
3348
3349
|
"cancel"
|
|
3349
3350
|
]),
|
|
3350
|
-
content: preprocess((val) => val === null ? void 0 : val, record$
|
|
3351
|
+
content: preprocess((val) => val === null ? void 0 : val, record$2(string$1(), union([
|
|
3351
3352
|
string$1(),
|
|
3352
3353
|
number$1(),
|
|
3353
3354
|
boolean$1(),
|
|
@@ -3377,7 +3378,7 @@ function build$1() {
|
|
|
3377
3378
|
name: string$1(),
|
|
3378
3379
|
value: string$1()
|
|
3379
3380
|
}),
|
|
3380
|
-
context: object({ arguments: record$
|
|
3381
|
+
context: object({ arguments: record$2(string$1(), string$1()).optional() }).optional()
|
|
3381
3382
|
});
|
|
3382
3383
|
/**
|
|
3383
3384
|
* A request from the client to the server, to ask for completion options.
|
|
@@ -3404,7 +3405,7 @@ function build$1() {
|
|
|
3404
3405
|
const RootSchema$1 = object({
|
|
3405
3406
|
uri: string$1().startsWith("file://"),
|
|
3406
3407
|
name: string$1().optional(),
|
|
3407
|
-
_meta: record$
|
|
3408
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
3408
3409
|
});
|
|
3409
3410
|
/**
|
|
3410
3411
|
* Sent from the server to request a list of root URIs from the client.
|
|
@@ -4168,10 +4169,10 @@ function build() {
|
|
|
4168
4169
|
number$1(),
|
|
4169
4170
|
boolean$1(),
|
|
4170
4171
|
_null(),
|
|
4171
|
-
record$
|
|
4172
|
+
record$2(string$1(), JSONValueSchema$1),
|
|
4172
4173
|
array(JSONValueSchema$1)
|
|
4173
4174
|
]));
|
|
4174
|
-
const JSONObjectSchema$1 = record$
|
|
4175
|
+
const JSONObjectSchema$1 = record$2(string$1(), JSONValueSchema$1);
|
|
4175
4176
|
/**
|
|
4176
4177
|
* A progress token, used to associate progress notifications with the original request.
|
|
4177
4178
|
*/
|
|
@@ -4272,7 +4273,7 @@ function build() {
|
|
|
4272
4273
|
requests: looseObject({ tools: looseObject({ call: JSONObjectSchema$1.optional() }).optional() }).optional()
|
|
4273
4274
|
});
|
|
4274
4275
|
const ClientCapabilitiesSchema$1 = object({
|
|
4275
|
-
experimental: record$
|
|
4276
|
+
experimental: record$2(string$1(), JSONObjectSchema$1).optional(),
|
|
4276
4277
|
sampling: object({
|
|
4277
4278
|
context: JSONObjectSchema$1.optional(),
|
|
4278
4279
|
tools: JSONObjectSchema$1.optional()
|
|
@@ -4280,10 +4281,10 @@ function build() {
|
|
|
4280
4281
|
elicitation: ElicitationCapabilitySchema.optional(),
|
|
4281
4282
|
roots: object({ listChanged: boolean$1().optional() }).optional(),
|
|
4282
4283
|
tasks: ClientTasksCapabilitySchema$1.optional(),
|
|
4283
|
-
extensions: record$
|
|
4284
|
+
extensions: record$2(string$1(), JSONObjectSchema$1).optional()
|
|
4284
4285
|
});
|
|
4285
4286
|
const ServerCapabilitiesSchema$1 = object({
|
|
4286
|
-
experimental: record$
|
|
4287
|
+
experimental: record$2(string$1(), JSONObjectSchema$1).optional(),
|
|
4287
4288
|
logging: JSONObjectSchema$1.optional(),
|
|
4288
4289
|
completions: JSONObjectSchema$1.optional(),
|
|
4289
4290
|
prompts: object({ listChanged: boolean$1().optional() }).optional(),
|
|
@@ -4293,7 +4294,7 @@ function build() {
|
|
|
4293
4294
|
}).optional(),
|
|
4294
4295
|
tools: object({ listChanged: boolean$1().optional() }).optional(),
|
|
4295
4296
|
tasks: ServerTasksCapabilitySchema$1.optional(),
|
|
4296
|
-
extensions: record$
|
|
4297
|
+
extensions: record$2(string$1(), JSONObjectSchema$1).optional()
|
|
4297
4298
|
});
|
|
4298
4299
|
const ProgressSchema$1 = object({
|
|
4299
4300
|
progress: number$1(),
|
|
@@ -4321,7 +4322,7 @@ function build() {
|
|
|
4321
4322
|
const ResourceContentsSchema$1 = object({
|
|
4322
4323
|
uri: string$1(),
|
|
4323
4324
|
mimeType: optional(string$1()),
|
|
4324
|
-
_meta: record$
|
|
4325
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
4325
4326
|
});
|
|
4326
4327
|
const TextResourceContentsSchema$1 = ResourceContentsSchema$1.extend({ text: string$1() });
|
|
4327
4328
|
const BlobResourceContentsSchema$1 = ResourceContentsSchema$1.extend({ blob: Base64Schema });
|
|
@@ -4378,34 +4379,34 @@ function build() {
|
|
|
4378
4379
|
type: literal("text"),
|
|
4379
4380
|
text: string$1(),
|
|
4380
4381
|
annotations: AnnotationsSchema$1.optional(),
|
|
4381
|
-
_meta: record$
|
|
4382
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
4382
4383
|
});
|
|
4383
4384
|
const ImageContentSchema$1 = object({
|
|
4384
4385
|
type: literal("image"),
|
|
4385
4386
|
data: Base64Schema,
|
|
4386
4387
|
mimeType: string$1(),
|
|
4387
4388
|
annotations: AnnotationsSchema$1.optional(),
|
|
4388
|
-
_meta: record$
|
|
4389
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
4389
4390
|
});
|
|
4390
4391
|
const AudioContentSchema$1 = object({
|
|
4391
4392
|
type: literal("audio"),
|
|
4392
4393
|
data: Base64Schema,
|
|
4393
4394
|
mimeType: string$1(),
|
|
4394
4395
|
annotations: AnnotationsSchema$1.optional(),
|
|
4395
|
-
_meta: record$
|
|
4396
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
4396
4397
|
});
|
|
4397
4398
|
const ToolUseContentSchema$1 = object({
|
|
4398
4399
|
type: literal("tool_use"),
|
|
4399
4400
|
name: string$1(),
|
|
4400
4401
|
id: string$1(),
|
|
4401
|
-
input: record$
|
|
4402
|
-
_meta: record$
|
|
4402
|
+
input: record$2(string$1(), unknown()),
|
|
4403
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
4403
4404
|
});
|
|
4404
4405
|
const EmbeddedResourceSchema$1 = object({
|
|
4405
4406
|
type: literal("resource"),
|
|
4406
4407
|
resource: union([TextResourceContentsSchema$1, BlobResourceContentsSchema$1]),
|
|
4407
4408
|
annotations: AnnotationsSchema$1.optional(),
|
|
4408
|
-
_meta: record$
|
|
4409
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
4409
4410
|
});
|
|
4410
4411
|
const ResourceLinkSchema$1 = ResourceSchema$1.extend({ type: literal("resource_link") });
|
|
4411
4412
|
const ContentBlockSchema$1 = union([
|
|
@@ -4537,7 +4538,7 @@ function build() {
|
|
|
4537
4538
|
message: string$1(),
|
|
4538
4539
|
requestedSchema: object({
|
|
4539
4540
|
type: literal("object"),
|
|
4540
|
-
properties: record$
|
|
4541
|
+
properties: record$2(string$1(), PrimitiveSchemaDefinitionSchema$1),
|
|
4541
4542
|
required: array(string$1()).optional()
|
|
4542
4543
|
}).catchall(unknown())
|
|
4543
4544
|
});
|
|
@@ -4552,7 +4553,7 @@ function build() {
|
|
|
4552
4553
|
const RootSchema$1 = object({
|
|
4553
4554
|
uri: string$1().startsWith("file://"),
|
|
4554
4555
|
name: string$1().optional(),
|
|
4555
|
-
_meta: record$
|
|
4556
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
4556
4557
|
});
|
|
4557
4558
|
const sharedClientCapabilityShape = ClientCapabilitiesSchema$1.shape;
|
|
4558
4559
|
const ClientCapabilities2026Schema = object({
|
|
@@ -4601,7 +4602,7 @@ function build() {
|
|
|
4601
4602
|
}),
|
|
4602
4603
|
outputSchema: looseObject({ $schema: string$1().optional() }).optional(),
|
|
4603
4604
|
annotations: ToolAnnotationsSchema$1.optional(),
|
|
4604
|
-
_meta: record$
|
|
4605
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
4605
4606
|
});
|
|
4606
4607
|
/** 2026-era ToolResultContent (anchor-exact: `structuredContent?: unknown`). */
|
|
4607
4608
|
const ToolResultContentSchema$1 = object({
|
|
@@ -4610,7 +4611,7 @@ function build() {
|
|
|
4610
4611
|
content: array(ContentBlockSchema$1),
|
|
4611
4612
|
structuredContent: unknown().optional(),
|
|
4612
4613
|
isError: boolean$1().optional(),
|
|
4613
|
-
_meta: record$
|
|
4614
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
4614
4615
|
});
|
|
4615
4616
|
/** 2026-era sampling content union (composes the forked tool-result shape). */
|
|
4616
4617
|
const SamplingMessageContentBlockSchema$1 = union([
|
|
@@ -4624,7 +4625,7 @@ function build() {
|
|
|
4624
4625
|
const SamplingMessageSchema$1 = object({
|
|
4625
4626
|
role: RoleSchema$1,
|
|
4626
4627
|
content: union([SamplingMessageContentBlockSchema$1, array(SamplingMessageContentBlockSchema$1)]),
|
|
4627
|
-
_meta: record$
|
|
4628
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
4628
4629
|
});
|
|
4629
4630
|
/** Open union per the anchor: 'complete' | 'input_required' | string. */
|
|
4630
4631
|
const ResultTypeSchema = string$1();
|
|
@@ -4728,7 +4729,7 @@ function build() {
|
|
|
4728
4729
|
*/
|
|
4729
4730
|
const ListRootsRequestSchema$1 = object({
|
|
4730
4731
|
method: literal("roots/list"),
|
|
4731
|
-
params: object({ _meta: record$
|
|
4732
|
+
params: object({ _meta: record$2(string$1(), unknown()).optional() }).optional()
|
|
4732
4733
|
});
|
|
4733
4734
|
/** 2026-era embedded sampling response (anchor-exact: extends the forked SamplingMessage). */
|
|
4734
4735
|
const CreateMessageResultSchema$1 = object({
|
|
@@ -4745,7 +4746,7 @@ function build() {
|
|
|
4745
4746
|
"decline",
|
|
4746
4747
|
"cancel"
|
|
4747
4748
|
]),
|
|
4748
|
-
content: record$
|
|
4749
|
+
content: record$2(string$1(), union([
|
|
4749
4750
|
string$1(),
|
|
4750
4751
|
number$1(),
|
|
4751
4752
|
boolean$1(),
|
|
@@ -4783,9 +4784,9 @@ function build() {
|
|
|
4783
4784
|
ElicitResultSchema$1
|
|
4784
4785
|
]);
|
|
4785
4786
|
/** Map of embedded input requests, keyed by server-assigned identifiers. */
|
|
4786
|
-
const InputRequestsSchema = record$
|
|
4787
|
+
const InputRequestsSchema = record$2(string$1(), InputRequestSchema);
|
|
4787
4788
|
/** Map of embedded input responses, keyed by the corresponding request identifiers. */
|
|
4788
|
-
const InputResponsesSchema = record$
|
|
4789
|
+
const InputResponsesSchema = record$2(string$1(), InputResponseSchema);
|
|
4789
4790
|
/**
|
|
4790
4791
|
* The wire InputRequiredResult: `resultType: 'input_required'` plus at least
|
|
4791
4792
|
* one of `inputRequests` / `requestState` (the at-least-one rule is enforced
|
|
@@ -4827,7 +4828,7 @@ function build() {
|
|
|
4827
4828
|
}
|
|
4828
4829
|
const callToolParamsShape = {
|
|
4829
4830
|
name: string$1(),
|
|
4830
|
-
arguments: record$
|
|
4831
|
+
arguments: record$2(string$1(), unknown()).optional(),
|
|
4831
4832
|
...retryParamsShape
|
|
4832
4833
|
};
|
|
4833
4834
|
const paginatedParamsShape = { cursor: CursorSchema$1.optional() };
|
|
@@ -4836,7 +4837,7 @@ function build() {
|
|
|
4836
4837
|
const ListPromptsRequestSchema$1 = wireRequest("prompts/list", paginatedParamsShape);
|
|
4837
4838
|
const GetPromptRequestSchema$1 = wireRequest("prompts/get", {
|
|
4838
4839
|
name: string$1(),
|
|
4839
|
-
arguments: record$
|
|
4840
|
+
arguments: record$2(string$1(), string$1()).optional(),
|
|
4840
4841
|
...retryParamsShape
|
|
4841
4842
|
});
|
|
4842
4843
|
const ListResourcesRequestSchema$1 = wireRequest("resources/list", paginatedParamsShape);
|
|
@@ -4851,7 +4852,7 @@ function build() {
|
|
|
4851
4852
|
name: string$1(),
|
|
4852
4853
|
value: string$1()
|
|
4853
4854
|
}),
|
|
4854
|
-
context: object({ arguments: record$
|
|
4855
|
+
context: object({ arguments: record$2(string$1(), string$1()).optional() }).optional()
|
|
4855
4856
|
};
|
|
4856
4857
|
const CompleteRequestSchema$1 = wireRequest("completion/complete", completeParamsShape);
|
|
4857
4858
|
const DiscoverRequestSchema$1 = wireRequest("server/discover", {});
|
|
@@ -4886,7 +4887,7 @@ function build() {
|
|
|
4886
4887
|
"tools/list": dispatchRequest("tools/list", paginatedParamsShape),
|
|
4887
4888
|
"prompts/get": dispatchRequest("prompts/get", {
|
|
4888
4889
|
name: string$1(),
|
|
4889
|
-
arguments: record$
|
|
4890
|
+
arguments: record$2(string$1(), string$1()).optional()
|
|
4890
4891
|
}),
|
|
4891
4892
|
"prompts/list": dispatchRequest("prompts/list", paginatedParamsShape),
|
|
4892
4893
|
"resources/list": dispatchRequest("resources/list", paginatedParamsShape),
|
|
@@ -9281,15 +9282,15 @@ var CfWorkerJsonSchemaValidator = class {
|
|
|
9281
9282
|
preloadSchemas();
|
|
9282
9283
|
//#endregion
|
|
9283
9284
|
//#region ../../../node_modules/.pnpm/pkce-challenge@5.0.1/node_modules/pkce-challenge/dist/index.browser.js
|
|
9284
|
-
let crypto$
|
|
9285
|
-
crypto$
|
|
9285
|
+
let crypto$2;
|
|
9286
|
+
crypto$2 = globalThis.crypto;
|
|
9286
9287
|
/**
|
|
9287
9288
|
* Creates an array of length `size` of random bytes
|
|
9288
9289
|
* @param size
|
|
9289
9290
|
* @returns Array of random ints (0 to 255)
|
|
9290
9291
|
*/
|
|
9291
9292
|
async function getRandomValues(size) {
|
|
9292
|
-
return (await crypto$
|
|
9293
|
+
return (await crypto$2).getRandomValues(new Uint8Array(size));
|
|
9293
9294
|
}
|
|
9294
9295
|
/** Generate cryptographically strong random string
|
|
9295
9296
|
* @param size The desired length of the string
|
|
@@ -9317,7 +9318,7 @@ async function generateVerifier(length) {
|
|
|
9317
9318
|
* @returns The base64 url encoded code challenge
|
|
9318
9319
|
*/
|
|
9319
9320
|
async function generateChallenge(code_verifier) {
|
|
9320
|
-
const buffer = await (await crypto$
|
|
9321
|
+
const buffer = await (await crypto$2).subtle.digest("SHA-256", new TextEncoder().encode(code_verifier));
|
|
9321
9322
|
return btoa(String.fromCharCode(...new Uint8Array(buffer))).replace(/\//g, "_").replace(/\+/g, "-").replace(/=/g, "");
|
|
9322
9323
|
}
|
|
9323
9324
|
/** Generate a PKCE challenge pair
|
|
@@ -14150,6 +14151,104 @@ var StreamableHTTPClientTransport = class {
|
|
|
14150
14151
|
}
|
|
14151
14152
|
};
|
|
14152
14153
|
//#endregion
|
|
14154
|
+
//#region ../../default/po-mcp/src/services/mcpApproval/index.ts
|
|
14155
|
+
const ARGUMENTS_PREVIEW_LIMIT = 2e3;
|
|
14156
|
+
/**
|
|
14157
|
+
* The MCP spec defaults: a tool is read-only only when it says so, and a tool that is not read-only
|
|
14158
|
+
* is destructive unless it says it is not. Most third-party tools send no annotations at all.
|
|
14159
|
+
*/
|
|
14160
|
+
function isDestructiveMcpTool(annotations) {
|
|
14161
|
+
return annotations?.readOnlyHint !== true && annotations?.destructiveHint !== false;
|
|
14162
|
+
}
|
|
14163
|
+
function grantKey(piName, parameters) {
|
|
14164
|
+
return `${piName}\u0000${JSON.stringify(parameters ?? {})}`;
|
|
14165
|
+
}
|
|
14166
|
+
function createMcpApprovalState(options) {
|
|
14167
|
+
let session = false;
|
|
14168
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
14169
|
+
const grants = /* @__PURE__ */ new Map();
|
|
14170
|
+
const release = (key) => {
|
|
14171
|
+
const count = grants.get(key) ?? 0;
|
|
14172
|
+
if (count <= 1) grants.delete(key);
|
|
14173
|
+
else grants.set(key, count - 1);
|
|
14174
|
+
};
|
|
14175
|
+
return {
|
|
14176
|
+
autoApproved: () => session || options.globalAutoApprove(),
|
|
14177
|
+
sessionAutoApprove: () => session,
|
|
14178
|
+
globalAutoApprove: () => options.globalAutoApprove(),
|
|
14179
|
+
setSessionAutoApprove(enabled) {
|
|
14180
|
+
if (session === enabled) return;
|
|
14181
|
+
session = enabled;
|
|
14182
|
+
for (const listener of listeners) listener();
|
|
14183
|
+
},
|
|
14184
|
+
onChange(listener) {
|
|
14185
|
+
listeners.add(listener);
|
|
14186
|
+
const stopGlobal = options.onGlobalChange?.(listener);
|
|
14187
|
+
return () => {
|
|
14188
|
+
listeners.delete(listener);
|
|
14189
|
+
stopGlobal?.();
|
|
14190
|
+
};
|
|
14191
|
+
},
|
|
14192
|
+
grant(piName, parameters) {
|
|
14193
|
+
const key = grantKey(piName, parameters);
|
|
14194
|
+
grants.set(key, (grants.get(key) ?? 0) + 1);
|
|
14195
|
+
let released = false;
|
|
14196
|
+
return () => {
|
|
14197
|
+
if (released) return;
|
|
14198
|
+
released = true;
|
|
14199
|
+
release(key);
|
|
14200
|
+
};
|
|
14201
|
+
},
|
|
14202
|
+
consume(piName, parameters) {
|
|
14203
|
+
const key = grantKey(piName, parameters);
|
|
14204
|
+
if (!grants.has(key)) return false;
|
|
14205
|
+
release(key);
|
|
14206
|
+
return true;
|
|
14207
|
+
}
|
|
14208
|
+
};
|
|
14209
|
+
}
|
|
14210
|
+
function argumentsPreview(parameters) {
|
|
14211
|
+
let text;
|
|
14212
|
+
try {
|
|
14213
|
+
text = JSON.stringify(parameters ?? {});
|
|
14214
|
+
} catch {
|
|
14215
|
+
text = "(arguments could not be shown)";
|
|
14216
|
+
}
|
|
14217
|
+
return text.length > ARGUMENTS_PREVIEW_LIMIT ? `${text.slice(0, 1999)}…` : text;
|
|
14218
|
+
}
|
|
14219
|
+
/** The person-facing card for one MCP tool call. */
|
|
14220
|
+
function describeMcpToolCall(tool, parameters) {
|
|
14221
|
+
return {
|
|
14222
|
+
title: `${tool.serverName}: ${tool.toolName}`,
|
|
14223
|
+
summary: tool.description ?? `Run ${tool.toolName} on the ${tool.serverName} MCP server.`,
|
|
14224
|
+
details: [
|
|
14225
|
+
{
|
|
14226
|
+
label: "Server",
|
|
14227
|
+
value: tool.serverName
|
|
14228
|
+
},
|
|
14229
|
+
{
|
|
14230
|
+
label: "Tool",
|
|
14231
|
+
value: tool.toolName
|
|
14232
|
+
},
|
|
14233
|
+
{
|
|
14234
|
+
label: "Arguments",
|
|
14235
|
+
value: argumentsPreview(parameters)
|
|
14236
|
+
}
|
|
14237
|
+
]
|
|
14238
|
+
};
|
|
14239
|
+
}
|
|
14240
|
+
/**
|
|
14241
|
+
* Approval for one destructive MCP tool. Declared whatever the toggles say, so a call queued before
|
|
14242
|
+
* auto-approve flipped still replays; `applies` reads the toggles and any App grant per call.
|
|
14243
|
+
*/
|
|
14244
|
+
function mcpToolApproval(tool, state) {
|
|
14245
|
+
return {
|
|
14246
|
+
requirement: "ask",
|
|
14247
|
+
applies: (parameters) => !state.autoApproved() && !state.consume(tool.piName, parameters),
|
|
14248
|
+
describe: (parameters) => describeMcpToolCall(tool, parameters)
|
|
14249
|
+
};
|
|
14250
|
+
}
|
|
14251
|
+
//#endregion
|
|
14153
14252
|
//#region ../../default/po-mcp/src/services/mcpCatalog/index.ts
|
|
14154
14253
|
function metadataRecord(value) {
|
|
14155
14254
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
@@ -14207,13 +14306,13 @@ function toPiToolName(serverName, toolName) {
|
|
|
14207
14306
|
/** ChatGPT Apps metadata naming the top-level arguments that carry a file. */
|
|
14208
14307
|
const FILE_PARAMS_META_KEY = "openai/fileParams";
|
|
14209
14308
|
const MAX_FILE_PARAMS = 16;
|
|
14210
|
-
function record(value) {
|
|
14309
|
+
function record$1(value) {
|
|
14211
14310
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
14212
14311
|
}
|
|
14213
14312
|
/** Declared file parameters that the input schema really has at its top level. */
|
|
14214
14313
|
function fileParamNames(tool) {
|
|
14215
14314
|
const declared = tool._meta?.[FILE_PARAMS_META_KEY];
|
|
14216
|
-
const properties = record(tool.inputSchema.properties);
|
|
14315
|
+
const properties = record$1(tool.inputSchema.properties);
|
|
14217
14316
|
if (!Array.isArray(declared) || properties === void 0) return [];
|
|
14218
14317
|
const names = declared.filter((name) => typeof name === "string" && Object.hasOwn(properties, name));
|
|
14219
14318
|
return [...new Set(names)].slice(0, MAX_FILE_PARAMS);
|
|
@@ -14226,9 +14325,9 @@ function modelInputSchema(tool) {
|
|
|
14226
14325
|
};
|
|
14227
14326
|
const names = fileParamNames(tool);
|
|
14228
14327
|
if (names.length === 0) return tool.inputSchema;
|
|
14229
|
-
const properties = { ...record(tool.inputSchema.properties) };
|
|
14328
|
+
const properties = { ...record$1(tool.inputSchema.properties) };
|
|
14230
14329
|
for (const name of names) {
|
|
14231
|
-
const description = record(properties[name])?.description;
|
|
14330
|
+
const description = record$1(properties[name])?.description;
|
|
14232
14331
|
properties[name] = {
|
|
14233
14332
|
type: "object",
|
|
14234
14333
|
description: `${typeof description === "string" ? description : "A file."} Pass {"path": "<file in the working directory, or the path from an Attached file note>"}.`,
|
|
@@ -14243,6 +14342,220 @@ function modelInputSchema(tool) {
|
|
|
14243
14342
|
};
|
|
14244
14343
|
}
|
|
14245
14344
|
//#endregion
|
|
14345
|
+
//#region ../../default/po-mcp/src/services/mcpScope/index.edge.ts
|
|
14346
|
+
/** Edge build of `mcpScope`: same names, no filesystem, so a repository is keyed by its path as given. */
|
|
14347
|
+
const USER_MCP_SCOPE = "user";
|
|
14348
|
+
//#endregion
|
|
14349
|
+
//#region ../../default/po-mcp/src/services/mcpSecrets/index.ts
|
|
14350
|
+
/**
|
|
14351
|
+
* `${vault:NAME}` secrets for MCP server headers and environment.
|
|
14352
|
+
*
|
|
14353
|
+
* Each secret is stored per credential scope (user, repository, plugin) and bound to where it may
|
|
14354
|
+
* go: a URL origin, or a command with its exact arguments. A secret read for any other destination
|
|
14355
|
+
* counts as missing, so editing a server's URL or command never sends an old secret somewhere new.
|
|
14356
|
+
*/
|
|
14357
|
+
const MCP_SECRET_NAMESPACE = "mcp.secret";
|
|
14358
|
+
const SECRET_NAME = /^[A-Za-z0-9._-]{1,64}$/u;
|
|
14359
|
+
const SLUG_INVALID = /[^A-Za-z0-9._-]/gu;
|
|
14360
|
+
const MAX_SECRET_VALUE = 4096;
|
|
14361
|
+
const MAX_SECRET_FIELDS = 64;
|
|
14362
|
+
const VAULT_REF_MARKER$1 = "${vault:";
|
|
14363
|
+
/** `${scope}/${name}`: one secret per name per scope. */
|
|
14364
|
+
function mcpSecretVaultKey(scope, name) {
|
|
14365
|
+
return `${scope}/${name}`;
|
|
14366
|
+
}
|
|
14367
|
+
/** The reference written into configuration in place of a secret value. */
|
|
14368
|
+
function vaultReference(name) {
|
|
14369
|
+
return `\${vault:${name}}`;
|
|
14370
|
+
}
|
|
14371
|
+
/** True for a name a `${vault:NAME}` reference accepts. */
|
|
14372
|
+
function isSecretName(value) {
|
|
14373
|
+
return typeof value === "string" && SECRET_NAME.test(value);
|
|
14374
|
+
}
|
|
14375
|
+
/** A secret value the vault keeps: one line, at most 4 KiB. */
|
|
14376
|
+
function isSecretValue(value) {
|
|
14377
|
+
return typeof value === "string" && value.length > 0 && value.length <= MAX_SECRET_VALUE && !/[\r\n\0]/u.test(value) && !value.includes(VAULT_REF_MARKER$1);
|
|
14378
|
+
}
|
|
14379
|
+
/** The sha256 of `JSON.stringify([command, args])`, so a changed argument list reads as a new destination. */
|
|
14380
|
+
function argsDigest(command, args) {
|
|
14381
|
+
return createHash("sha256").update(JSON.stringify([command, args])).digest("hex");
|
|
14382
|
+
}
|
|
14383
|
+
/** Where a connection is about to send a secret, or undefined when the target names no destination. */
|
|
14384
|
+
function secretBindingOf(target) {
|
|
14385
|
+
if (target.origin !== void 0) return { origin: target.origin };
|
|
14386
|
+
if (target.command !== void 0) return {
|
|
14387
|
+
command: target.command,
|
|
14388
|
+
argsDigest: argsDigest(target.command, target.args ?? [])
|
|
14389
|
+
};
|
|
14390
|
+
}
|
|
14391
|
+
function sameBinding(left, right) {
|
|
14392
|
+
if ("origin" in left || "origin" in right) return "origin" in left && "origin" in right && left.origin === right.origin;
|
|
14393
|
+
return left.command === right.command && left.argsDigest === right.argsDigest;
|
|
14394
|
+
}
|
|
14395
|
+
function readStoredSecret(value) {
|
|
14396
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
14397
|
+
const { value: secret, boundTo } = value;
|
|
14398
|
+
if (typeof secret !== "string" || typeof boundTo !== "object" || boundTo === null || Array.isArray(boundTo)) return void 0;
|
|
14399
|
+
if (typeof boundTo.origin === "string") return {
|
|
14400
|
+
value: secret,
|
|
14401
|
+
boundTo: { origin: boundTo.origin }
|
|
14402
|
+
};
|
|
14403
|
+
if (typeof boundTo.command === "string" && typeof boundTo.argsDigest === "string") return {
|
|
14404
|
+
value: secret,
|
|
14405
|
+
boundTo: {
|
|
14406
|
+
command: boundTo.command,
|
|
14407
|
+
argsDigest: boundTo.argsDigest
|
|
14408
|
+
}
|
|
14409
|
+
};
|
|
14410
|
+
}
|
|
14411
|
+
function toMiss(target) {
|
|
14412
|
+
const { signal: _signal, ...miss } = target;
|
|
14413
|
+
return {
|
|
14414
|
+
...miss,
|
|
14415
|
+
...miss.args ? { args: [...miss.args] } : {}
|
|
14416
|
+
};
|
|
14417
|
+
}
|
|
14418
|
+
/**
|
|
14419
|
+
* The proxy's `resolveSecret` callback over the vault.
|
|
14420
|
+
*
|
|
14421
|
+
* A server with no scope (session-only servers) or a host with no vault resolves nothing and
|
|
14422
|
+
* records nothing, since there is nowhere to supply the secret. A vault failure propagates, which
|
|
14423
|
+
* the proxy turns into its one generic connection error.
|
|
14424
|
+
*/
|
|
14425
|
+
function createSecretResolver(options) {
|
|
14426
|
+
return async (target) => {
|
|
14427
|
+
const scope = options.scopeOf(target.serverName);
|
|
14428
|
+
const vault = options.vault();
|
|
14429
|
+
const expected = secretBindingOf(target);
|
|
14430
|
+
if (scope === void 0 || !vault || !expected || !isSecretName(target.name)) return void 0;
|
|
14431
|
+
const stored = readStoredSecret((await vault.get(MCP_SECRET_NAMESPACE, mcpSecretVaultKey(scope, target.name)))?.value);
|
|
14432
|
+
if (!stored || !sameBinding(stored.boundTo, expected)) {
|
|
14433
|
+
options.onMissing?.(toMiss(target));
|
|
14434
|
+
return;
|
|
14435
|
+
}
|
|
14436
|
+
return stored.value;
|
|
14437
|
+
};
|
|
14438
|
+
}
|
|
14439
|
+
/** Writes one secret, last write wins. */
|
|
14440
|
+
async function storeSecret(vault, scope, write) {
|
|
14441
|
+
const value = {
|
|
14442
|
+
value: write.value,
|
|
14443
|
+
boundTo: write.boundTo
|
|
14444
|
+
};
|
|
14445
|
+
await vault.put(MCP_SECRET_NAMESPACE, mcpSecretVaultKey(scope, write.name), {
|
|
14446
|
+
...value,
|
|
14447
|
+
boundTo: { ...value.boundTo }
|
|
14448
|
+
});
|
|
14449
|
+
}
|
|
14450
|
+
/**
|
|
14451
|
+
* Writes every secret of one add-server request and returns how to undo them.
|
|
14452
|
+
*
|
|
14453
|
+
* A name that already held a secret is restored on undo rather than deleted, so a failed add never
|
|
14454
|
+
* erases a secret another server still references. A failed write undoes the earlier ones before
|
|
14455
|
+
* rethrowing.
|
|
14456
|
+
*/
|
|
14457
|
+
async function writeSecrets(vault, scope, writes) {
|
|
14458
|
+
const undo = [];
|
|
14459
|
+
const rollback = async () => {
|
|
14460
|
+
for (const step of undo.reverse()) await step().catch(() => void 0);
|
|
14461
|
+
};
|
|
14462
|
+
try {
|
|
14463
|
+
for (const write of writes) {
|
|
14464
|
+
const key = mcpSecretVaultKey(scope, write.name);
|
|
14465
|
+
const previous = await vault.get(MCP_SECRET_NAMESPACE, key);
|
|
14466
|
+
await storeSecret(vault, scope, write);
|
|
14467
|
+
undo.push(() => previous ? vault.put(MCP_SECRET_NAMESPACE, key, previous.value).then(() => void 0) : vault.delete(MCP_SECRET_NAMESPACE, key));
|
|
14468
|
+
}
|
|
14469
|
+
} catch (error) {
|
|
14470
|
+
await rollback();
|
|
14471
|
+
throw error;
|
|
14472
|
+
}
|
|
14473
|
+
return rollback;
|
|
14474
|
+
}
|
|
14475
|
+
function refuse$1(error) {
|
|
14476
|
+
return {
|
|
14477
|
+
ok: false,
|
|
14478
|
+
status: 400,
|
|
14479
|
+
error
|
|
14480
|
+
};
|
|
14481
|
+
}
|
|
14482
|
+
function isCredentialOrigin(url) {
|
|
14483
|
+
return url.protocol === "https:" || url.protocol === "http:" && [
|
|
14484
|
+
"localhost",
|
|
14485
|
+
"127.0.0.1",
|
|
14486
|
+
"[::1]"
|
|
14487
|
+
].includes(url.hostname);
|
|
14488
|
+
}
|
|
14489
|
+
/**
|
|
14490
|
+
* Moves the named header or env values of an add-server request into vault writes, leaving
|
|
14491
|
+
* `${vault:<server>-<field>}` in the entry. Every field is untrusted input.
|
|
14492
|
+
*/
|
|
14493
|
+
function prepareSecretAddition(addition, secretFields) {
|
|
14494
|
+
if (secretFields === void 0) return {
|
|
14495
|
+
ok: true,
|
|
14496
|
+
value: {
|
|
14497
|
+
addition,
|
|
14498
|
+
secrets: []
|
|
14499
|
+
}
|
|
14500
|
+
};
|
|
14501
|
+
if (!Array.isArray(secretFields) || secretFields.length > MAX_SECRET_FIELDS || !secretFields.every((field) => typeof field === "string") || new Set(secretFields).size !== secretFields.length) return refuse$1("Name each secret field once.");
|
|
14502
|
+
if (secretFields.length === 0) return {
|
|
14503
|
+
ok: true,
|
|
14504
|
+
value: {
|
|
14505
|
+
addition,
|
|
14506
|
+
secrets: []
|
|
14507
|
+
}
|
|
14508
|
+
};
|
|
14509
|
+
const { entry } = addition;
|
|
14510
|
+
let boundTo;
|
|
14511
|
+
let values;
|
|
14512
|
+
if ("command" in entry) {
|
|
14513
|
+
boundTo = {
|
|
14514
|
+
command: entry.command,
|
|
14515
|
+
argsDigest: argsDigest(entry.command, entry.args)
|
|
14516
|
+
};
|
|
14517
|
+
values = { ...entry.env };
|
|
14518
|
+
} else {
|
|
14519
|
+
const url = new URL(entry.url);
|
|
14520
|
+
if (!isCredentialOrigin(url) || url.username || url.password) return refuse$1("A secret is only sent over https, or over plain http to this machine.");
|
|
14521
|
+
boundTo = { origin: url.origin };
|
|
14522
|
+
values = { ...entry.headers };
|
|
14523
|
+
}
|
|
14524
|
+
const secrets = [];
|
|
14525
|
+
for (const field of secretFields) {
|
|
14526
|
+
const value = Object.hasOwn(values, field) ? values[field] : void 0;
|
|
14527
|
+
if (!isSecretValue(value)) return refuse$1("Each secret field needs a value you entered.");
|
|
14528
|
+
const name = `${addition.name}-${field.replace(SLUG_INVALID, "_")}`;
|
|
14529
|
+
if (!isSecretName(name)) return refuse$1("Shorten the server or field name so the secret name fits in 64 characters.");
|
|
14530
|
+
if (secrets.some((secret) => secret.name === name)) return refuse$1("Two secret fields map to the same vault name.");
|
|
14531
|
+
secrets.push({
|
|
14532
|
+
name,
|
|
14533
|
+
value,
|
|
14534
|
+
boundTo
|
|
14535
|
+
});
|
|
14536
|
+
values[field] = vaultReference(name);
|
|
14537
|
+
}
|
|
14538
|
+
const next = "command" in entry ? {
|
|
14539
|
+
command: entry.command,
|
|
14540
|
+
args: [...entry.args],
|
|
14541
|
+
env: values
|
|
14542
|
+
} : {
|
|
14543
|
+
type: "http",
|
|
14544
|
+
url: entry.url,
|
|
14545
|
+
headers: values
|
|
14546
|
+
};
|
|
14547
|
+
return {
|
|
14548
|
+
ok: true,
|
|
14549
|
+
value: {
|
|
14550
|
+
addition: {
|
|
14551
|
+
name: addition.name,
|
|
14552
|
+
entry: next
|
|
14553
|
+
},
|
|
14554
|
+
secrets
|
|
14555
|
+
}
|
|
14556
|
+
};
|
|
14557
|
+
}
|
|
14558
|
+
//#endregion
|
|
14246
14559
|
//#region ../../default/po-mcp/src/services/remoteMcp/index.ts
|
|
14247
14560
|
const PO_MCP_REMOTE_SERVERS_SERVICE = "po/mcp-remote-servers";
|
|
14248
14561
|
/** Bound by the host at the global level, so every session it opens inherits it. */
|
|
@@ -14256,6 +14569,10 @@ const CLIENT_INFO = {
|
|
|
14256
14569
|
name: "po-cloud",
|
|
14257
14570
|
version: "1.0.0"
|
|
14258
14571
|
};
|
|
14572
|
+
/** The one failure for any unresolved reference, as the Node proxy reports it: never a name or a value. */
|
|
14573
|
+
const REMOTE_MCP_SECRET_ERROR = "MCP secret reference could not be resolved.";
|
|
14574
|
+
const VAULT_REF = /\$\{vault:([A-Za-z0-9._-]{1,64})\}/gu;
|
|
14575
|
+
const VAULT_REF_MARKER = "${vault:";
|
|
14259
14576
|
function readPoMcpRemoteServers(context) {
|
|
14260
14577
|
return context.get(PO_MCP_REMOTE_SERVERS_SERVICE);
|
|
14261
14578
|
}
|
|
@@ -14282,6 +14599,10 @@ function toResult(result) {
|
|
|
14282
14599
|
function message(error) {
|
|
14283
14600
|
return (error instanceof Error ? error.message : String(error)).slice(0, 300);
|
|
14284
14601
|
}
|
|
14602
|
+
/** A 401 or 403 means the stored header no longer works; retrying with the same one cannot help. */
|
|
14603
|
+
function isUnauthorized(error) {
|
|
14604
|
+
return error instanceof UnauthorizedError || error instanceof SdkHttpError && (error.status === 401 || error.status === 403);
|
|
14605
|
+
}
|
|
14285
14606
|
async function listTools(client, server, signal) {
|
|
14286
14607
|
const tools = [];
|
|
14287
14608
|
let cursor;
|
|
@@ -14307,10 +14628,51 @@ async function listTools(client, server, signal) {
|
|
|
14307
14628
|
return tools;
|
|
14308
14629
|
}
|
|
14309
14630
|
/**
|
|
14631
|
+
* The server's headers with every `${vault:NAME}` replaced from the vault's `mcp.secret` entries.
|
|
14632
|
+
*
|
|
14633
|
+
* Host-configured servers are the edge's only configuration layer, so they read the user scope with the Node
|
|
14634
|
+
* session's key scheme and origin binding. A malformed reference, a miss, a missing vault or any vault failure
|
|
14635
|
+
* (`unavailable` included) throws the one generic error, as the Node proxy does, so that server alone fails.
|
|
14636
|
+
*/
|
|
14637
|
+
async function resolveRemoteMcpHeaders(server, vault, signal) {
|
|
14638
|
+
const headers = { ...server.headers };
|
|
14639
|
+
const resolveSecret = createSecretResolver({
|
|
14640
|
+
vault,
|
|
14641
|
+
scopeOf: () => USER_MCP_SCOPE
|
|
14642
|
+
});
|
|
14643
|
+
const origin = new URL(server.url).origin;
|
|
14644
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
14645
|
+
if (!value.includes(VAULT_REF_MARKER)) continue;
|
|
14646
|
+
if (value.replace(VAULT_REF, "").includes(VAULT_REF_MARKER)) throw new Error(REMOTE_MCP_SECRET_ERROR);
|
|
14647
|
+
const secrets = /* @__PURE__ */ new Map();
|
|
14648
|
+
for (const [, name] of value.matchAll(VAULT_REF)) {
|
|
14649
|
+
if (secrets.has(name)) continue;
|
|
14650
|
+
let secret;
|
|
14651
|
+
try {
|
|
14652
|
+
secret = await resolveSecret({
|
|
14653
|
+
serverName: server.name,
|
|
14654
|
+
field: "header",
|
|
14655
|
+
key,
|
|
14656
|
+
name,
|
|
14657
|
+
transport: "http",
|
|
14658
|
+
origin
|
|
14659
|
+
});
|
|
14660
|
+
} catch {
|
|
14661
|
+
secret = void 0;
|
|
14662
|
+
}
|
|
14663
|
+
signal?.throwIfAborted();
|
|
14664
|
+
if (secret === void 0) throw new Error(REMOTE_MCP_SECRET_ERROR);
|
|
14665
|
+
secrets.set(name, secret);
|
|
14666
|
+
}
|
|
14667
|
+
headers[key] = value.replace(VAULT_REF, (_match, name) => secrets.get(name));
|
|
14668
|
+
}
|
|
14669
|
+
return headers;
|
|
14670
|
+
}
|
|
14671
|
+
/**
|
|
14310
14672
|
* Connects every server the host hands over, once. A server that the policy refuses or that fails to
|
|
14311
14673
|
* answer is reported in `failures` and contributes no tools; the others still connect.
|
|
14312
14674
|
*/
|
|
14313
|
-
async function connectRemoteMcpServers(service, signal) {
|
|
14675
|
+
async function connectRemoteMcpServers(service, signal, approval, vault = () => void 0) {
|
|
14314
14676
|
const policy = {
|
|
14315
14677
|
protocols: REMOTE_MCP_PROTOCOLS,
|
|
14316
14678
|
blockedHosts: service.blockedHosts
|
|
@@ -14324,6 +14686,20 @@ async function connectRemoteMcpServers(service, signal) {
|
|
|
14324
14686
|
const servers = await service.load(signal);
|
|
14325
14687
|
const failures = [];
|
|
14326
14688
|
const clients = [];
|
|
14689
|
+
let disposed = false;
|
|
14690
|
+
let revision = 0;
|
|
14691
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
14692
|
+
const lost = /* @__PURE__ */ new Set();
|
|
14693
|
+
const lose = (name, reason) => {
|
|
14694
|
+
if (disposed || lost.has(name)) return;
|
|
14695
|
+
lost.add(name);
|
|
14696
|
+
revision++;
|
|
14697
|
+
failures.push({
|
|
14698
|
+
name,
|
|
14699
|
+
message: reason
|
|
14700
|
+
});
|
|
14701
|
+
for (const listener of listeners) listener();
|
|
14702
|
+
};
|
|
14327
14703
|
const entries = (await Promise.all(servers.map(async (server) => {
|
|
14328
14704
|
const refusal = outboundHostRefusal(server.url, policy);
|
|
14329
14705
|
if (refusal) {
|
|
@@ -14334,17 +14710,19 @@ async function connectRemoteMcpServers(service, signal) {
|
|
|
14334
14710
|
return [];
|
|
14335
14711
|
}
|
|
14336
14712
|
const client = new Client(CLIENT_INFO, { capabilities: {} });
|
|
14337
|
-
const transport = new StreamableHTTPClientTransport(new URL(server.url), {
|
|
14338
|
-
fetch: fetcher,
|
|
14339
|
-
requestInit: { headers: { ...server.headers } }
|
|
14340
|
-
});
|
|
14341
14713
|
try {
|
|
14714
|
+
const transport = new StreamableHTTPClientTransport(new URL(server.url), {
|
|
14715
|
+
fetch: fetcher,
|
|
14716
|
+
requestInit: { headers: await resolveRemoteMcpHeaders(server, vault, signal) }
|
|
14717
|
+
});
|
|
14342
14718
|
await client.connect(transport, {
|
|
14343
14719
|
signal,
|
|
14344
14720
|
timeout: REMOTE_MCP_TIMEOUT_MS
|
|
14345
14721
|
});
|
|
14346
14722
|
clients.push(client);
|
|
14347
|
-
|
|
14723
|
+
const tools = await listTools(client, server.name, signal);
|
|
14724
|
+
client.onclose = () => lose(server.name, "The connection closed.");
|
|
14725
|
+
return tools.map((tool) => ({
|
|
14348
14726
|
tool,
|
|
14349
14727
|
client
|
|
14350
14728
|
}));
|
|
@@ -14357,8 +14735,6 @@ async function connectRemoteMcpServers(service, signal) {
|
|
|
14357
14735
|
return [];
|
|
14358
14736
|
}
|
|
14359
14737
|
}))).flat();
|
|
14360
|
-
let disposed = false;
|
|
14361
|
-
const listeners = /* @__PURE__ */ new Set();
|
|
14362
14738
|
const projected = entries.map(({ tool, client }) => {
|
|
14363
14739
|
const parameters = modelInputSchema(tool);
|
|
14364
14740
|
return {
|
|
@@ -14366,6 +14742,7 @@ async function connectRemoteMcpServers(service, signal) {
|
|
|
14366
14742
|
label: `${tool.serverName}: ${tool.toolName}`,
|
|
14367
14743
|
description: tool.description ?? `${tool.toolName} on the ${tool.serverName} MCP server.`,
|
|
14368
14744
|
...tool.annotations === void 0 ? {} : { annotations: tool.annotations },
|
|
14745
|
+
...approval !== void 0 && isDestructiveMcpTool(tool.annotations) ? { approval: mcpToolApproval(tool, approval) } : {},
|
|
14369
14746
|
...tool._meta === void 0 ? {} : { _meta: mcpToolExecutionMetadata(tool) },
|
|
14370
14747
|
...tool.outputSchema === void 0 ? {} : { outputSchema: tool.outputSchema },
|
|
14371
14748
|
parameters,
|
|
@@ -14374,21 +14751,33 @@ async function connectRemoteMcpServers(service, signal) {
|
|
|
14374
14751
|
callSignal?.throwIfAborted();
|
|
14375
14752
|
const args = input === void 0 ? {} : input;
|
|
14376
14753
|
if (!Check(parameters, args)) throw new Error(`Invalid arguments for MCP tool ${tool.piName}.`);
|
|
14377
|
-
|
|
14378
|
-
|
|
14379
|
-
|
|
14380
|
-
|
|
14381
|
-
|
|
14382
|
-
|
|
14383
|
-
|
|
14754
|
+
let result;
|
|
14755
|
+
try {
|
|
14756
|
+
result = await client.callTool({
|
|
14757
|
+
name: tool.toolName,
|
|
14758
|
+
arguments: args
|
|
14759
|
+
}, {
|
|
14760
|
+
...callSignal ? { signal: callSignal } : {},
|
|
14761
|
+
timeout: REMOTE_MCP_TIMEOUT_MS
|
|
14762
|
+
});
|
|
14763
|
+
} catch (error) {
|
|
14764
|
+
if (isUnauthorized(error)) lose(tool.serverName, "The server no longer accepts its credentials.");
|
|
14765
|
+
throw error;
|
|
14766
|
+
}
|
|
14767
|
+
return toResult(result);
|
|
14384
14768
|
}
|
|
14385
14769
|
};
|
|
14386
14770
|
});
|
|
14387
|
-
const
|
|
14388
|
-
const
|
|
14771
|
+
const live = () => disposed ? [] : entries.filter(({ tool }) => !lost.has(tool.serverName));
|
|
14772
|
+
const snapshot = () => live().map(({ tool }) => tool);
|
|
14773
|
+
const project = () => {
|
|
14774
|
+
const names = new Set(live().map(({ tool }) => tool.piName));
|
|
14775
|
+
return projected.filter((tool) => names.has(tool.name));
|
|
14776
|
+
};
|
|
14389
14777
|
const sessionTools = Object.freeze({
|
|
14390
14778
|
generation: `remote:${crypto.randomUUID()}`,
|
|
14391
|
-
|
|
14779
|
+
approval,
|
|
14780
|
+
runtimeRevision: () => revision,
|
|
14392
14781
|
readAppResource: async () => {
|
|
14393
14782
|
throw new Error("MCP Apps are not available on this host.");
|
|
14394
14783
|
},
|
|
@@ -14428,4 +14817,594 @@ async function connectRemoteMcpServers(service, signal) {
|
|
|
14428
14817
|
};
|
|
14429
14818
|
}
|
|
14430
14819
|
//#endregion
|
|
14431
|
-
|
|
14820
|
+
//#region ../../default/po-mcp/src/services/mcpGlobalSettings/index.ts
|
|
14821
|
+
/** Beside `mcp.json` in Po's home, kept separate so MCP clients that read `mcp.json` never see it. */
|
|
14822
|
+
const MCP_SETTINGS_FILE = "mcp-settings.json";
|
|
14823
|
+
const AUTO_APPROVE_KEY = "autoApproveDestructiveTools";
|
|
14824
|
+
function record(value) {
|
|
14825
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
14826
|
+
}
|
|
14827
|
+
/** The file's object, or an empty one when it is missing. A malformed file is refused rather than overwritten. */
|
|
14828
|
+
async function readDocument(fs, filePath) {
|
|
14829
|
+
const text = await readTextIfExists(fs, filePath, BACKGROUND_CONTEXT);
|
|
14830
|
+
if (text === void 0) return {};
|
|
14831
|
+
let parsed;
|
|
14832
|
+
try {
|
|
14833
|
+
parsed = JSON.parse(text);
|
|
14834
|
+
} catch (error) {
|
|
14835
|
+
throw new Error(`${MCP_SETTINGS_FILE} is not valid JSON.`, { cause: error });
|
|
14836
|
+
}
|
|
14837
|
+
const document = record(parsed);
|
|
14838
|
+
if (!document) throw new Error(`${MCP_SETTINGS_FILE} must hold a JSON object.`);
|
|
14839
|
+
return document;
|
|
14840
|
+
}
|
|
14841
|
+
function createMcpGlobalSettings(getFs) {
|
|
14842
|
+
let autoApprove = false;
|
|
14843
|
+
let loaded;
|
|
14844
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
14845
|
+
const removalListeners = /* @__PURE__ */ new Set();
|
|
14846
|
+
const requireFs = () => {
|
|
14847
|
+
const fs = getFs();
|
|
14848
|
+
if (!fs) throw new Error("MCP settings need the host filesystem.");
|
|
14849
|
+
return fs;
|
|
14850
|
+
};
|
|
14851
|
+
const set = (enabled) => {
|
|
14852
|
+
if (autoApprove === enabled) return;
|
|
14853
|
+
autoApprove = enabled;
|
|
14854
|
+
for (const listener of listeners) listener();
|
|
14855
|
+
};
|
|
14856
|
+
return {
|
|
14857
|
+
autoApprove: () => autoApprove,
|
|
14858
|
+
load(filePath) {
|
|
14859
|
+
if (loaded?.path === filePath) return loaded.read;
|
|
14860
|
+
const read = (async () => {
|
|
14861
|
+
const document = await readDocument(requireFs(), filePath);
|
|
14862
|
+
set(document[AUTO_APPROVE_KEY] === true);
|
|
14863
|
+
return autoApprove;
|
|
14864
|
+
})();
|
|
14865
|
+
loaded = {
|
|
14866
|
+
path: filePath,
|
|
14867
|
+
read
|
|
14868
|
+
};
|
|
14869
|
+
read.catch(() => {
|
|
14870
|
+
if (loaded?.read === read) loaded = void 0;
|
|
14871
|
+
});
|
|
14872
|
+
return read;
|
|
14873
|
+
},
|
|
14874
|
+
async setAutoApprove(filePath, enabled) {
|
|
14875
|
+
const fs = requireFs();
|
|
14876
|
+
const document = await readDocument(fs, filePath);
|
|
14877
|
+
await writeFileAtomic(fs, filePath, `${JSON.stringify({
|
|
14878
|
+
...document,
|
|
14879
|
+
[AUTO_APPROVE_KEY]: enabled
|
|
14880
|
+
}, null, 2)}\n`, BACKGROUND_CONTEXT);
|
|
14881
|
+
loaded = {
|
|
14882
|
+
path: filePath,
|
|
14883
|
+
read: Promise.resolve(enabled)
|
|
14884
|
+
};
|
|
14885
|
+
set(enabled);
|
|
14886
|
+
},
|
|
14887
|
+
onChange(listener) {
|
|
14888
|
+
listeners.add(listener);
|
|
14889
|
+
return () => {
|
|
14890
|
+
listeners.delete(listener);
|
|
14891
|
+
};
|
|
14892
|
+
},
|
|
14893
|
+
serverRemoved(removal) {
|
|
14894
|
+
for (const listener of removalListeners) listener(removal);
|
|
14895
|
+
},
|
|
14896
|
+
onServerRemoved(listener) {
|
|
14897
|
+
removalListeners.add(listener);
|
|
14898
|
+
return () => {
|
|
14899
|
+
removalListeners.delete(listener);
|
|
14900
|
+
};
|
|
14901
|
+
}
|
|
14902
|
+
};
|
|
14903
|
+
}
|
|
14904
|
+
//#endregion
|
|
14905
|
+
//#region ../../default/po-mcp/src/constants/mcp.ts
|
|
14906
|
+
const SERVER_COMMAND_DESCRIPTION = "Show MCP configuration or begin an authorization request.";
|
|
14907
|
+
/** Matched by the hub API, which answers 503. */
|
|
14908
|
+
const VAULT_UNAVAILABLE = "Po's vault is unavailable, so MCP sign-ins cannot be saved.";
|
|
14909
|
+
new RegExp(`${String.fromCharCode(27)}\\[[0-?]*[ -/]*[@-~]`, "gu");
|
|
14910
|
+
/** Session route for one reachable tool's description and schema. */
|
|
14911
|
+
const MCP_SESSION_TOOL_API_PATH = "/tool";
|
|
14912
|
+
const MCP_SESSION_TOOL_SERVER_QUERY = "server";
|
|
14913
|
+
const MCP_SESSION_TOOL_NAME_QUERY = "tool";
|
|
14914
|
+
/** Session route that stores a `${vault:NAME}` secret the session reported missing. */
|
|
14915
|
+
const MCP_SESSION_SECRETS_API_PATH = "/secrets";
|
|
14916
|
+
/** Hub API paths for repository-scoped MCP management. */
|
|
14917
|
+
const MCP_REPOSITORY_API_PATH = "/repository";
|
|
14918
|
+
const MCP_DISCOVERY_API_PATH = "/repository/discover";
|
|
14919
|
+
const MCP_AUTHORIZATION_API_PATH = "/repository/authorize";
|
|
14920
|
+
/** The repository every route is asked about, and the flow segment the two flow routes carry. */
|
|
14921
|
+
const MCP_REPOSITORY_ID_QUERY = "repositoryId";
|
|
14922
|
+
const MCP_FLOW_ID_PARAM = "flowId";
|
|
14923
|
+
/** Adds one server to the repository's `.mcp.json` or to the person's own config. */
|
|
14924
|
+
const MCP_SERVERS_API_PATH = "/servers";
|
|
14925
|
+
/** Lists the servers in the person's own config. */
|
|
14926
|
+
const MCP_GLOBAL_SERVERS_API_PATH = "/servers/global";
|
|
14927
|
+
/** Reads and saves Po-wide MCP preferences. */
|
|
14928
|
+
const MCP_SETTINGS_API_PATH = "/settings";
|
|
14929
|
+
//#endregion
|
|
14930
|
+
//#region ../../default/po-mcp/src/types/apiRoutes.ts
|
|
14931
|
+
/** One authorization flow, addressed by id below the flow collection. */
|
|
14932
|
+
const AUTHORIZATION_FLOW_PATH = `${MCP_AUTHORIZATION_API_PATH}/:${MCP_FLOW_ID_PARAM}`;
|
|
14933
|
+
/**
|
|
14934
|
+
* This package's routes, as data.
|
|
14935
|
+
*
|
|
14936
|
+
* No scope and no base path. The build reads both off
|
|
14937
|
+
* `src/extensions/(backend)/api/mcp/`, so the mount is stated once, by the
|
|
14938
|
+
* folder that creates it. The sub-paths come from `webMcp`, which already owned
|
|
14939
|
+
* them, so this table names where a route sits and nothing else.
|
|
14940
|
+
*
|
|
14941
|
+
* This is the one file the hub handler and the settings panel both read, so a
|
|
14942
|
+
* path cannot move on one side alone. The handler matches on these strings
|
|
14943
|
+
* rather than parsing its own copies of them.
|
|
14944
|
+
*
|
|
14945
|
+
* `:flowId` is the client's parameter syntax; the handler reads the segment off
|
|
14946
|
+
* the same path, so the two cannot disagree about where the id sits.
|
|
14947
|
+
*/
|
|
14948
|
+
const routes = {
|
|
14949
|
+
catalog: {
|
|
14950
|
+
method: "GET",
|
|
14951
|
+
path: MCP_REPOSITORY_API_PATH,
|
|
14952
|
+
query: [MCP_REPOSITORY_ID_QUERY],
|
|
14953
|
+
response: void 0
|
|
14954
|
+
},
|
|
14955
|
+
discover: {
|
|
14956
|
+
method: "POST",
|
|
14957
|
+
path: MCP_DISCOVERY_API_PATH,
|
|
14958
|
+
response: void 0
|
|
14959
|
+
},
|
|
14960
|
+
authorize: {
|
|
14961
|
+
method: "POST",
|
|
14962
|
+
path: MCP_AUTHORIZATION_API_PATH,
|
|
14963
|
+
response: void 0
|
|
14964
|
+
},
|
|
14965
|
+
readAuthorization: {
|
|
14966
|
+
method: "GET",
|
|
14967
|
+
path: AUTHORIZATION_FLOW_PATH,
|
|
14968
|
+
query: [MCP_REPOSITORY_ID_QUERY],
|
|
14969
|
+
response: void 0
|
|
14970
|
+
},
|
|
14971
|
+
/** The same path as `readAuthorization`; the method is the whole of the difference. */
|
|
14972
|
+
cancelAuthorization: {
|
|
14973
|
+
method: "DELETE",
|
|
14974
|
+
path: AUTHORIZATION_FLOW_PATH,
|
|
14975
|
+
query: [MCP_REPOSITORY_ID_QUERY],
|
|
14976
|
+
response: void 0
|
|
14977
|
+
},
|
|
14978
|
+
/** Adds one server to the repository's `.mcp.json` or the person's own config, by the body's scope. */
|
|
14979
|
+
addServer: {
|
|
14980
|
+
method: "POST",
|
|
14981
|
+
path: MCP_SERVERS_API_PATH,
|
|
14982
|
+
response: void 0
|
|
14983
|
+
},
|
|
14984
|
+
editServer: {
|
|
14985
|
+
method: "PATCH",
|
|
14986
|
+
path: MCP_SERVERS_API_PATH,
|
|
14987
|
+
response: void 0
|
|
14988
|
+
},
|
|
14989
|
+
removeServer: {
|
|
14990
|
+
method: "DELETE",
|
|
14991
|
+
path: MCP_SERVERS_API_PATH,
|
|
14992
|
+
response: void 0
|
|
14993
|
+
},
|
|
14994
|
+
globalServers: {
|
|
14995
|
+
method: "GET",
|
|
14996
|
+
path: MCP_GLOBAL_SERVERS_API_PATH,
|
|
14997
|
+
response: void 0
|
|
14998
|
+
},
|
|
14999
|
+
readSettings: {
|
|
15000
|
+
method: "GET",
|
|
15001
|
+
path: MCP_SETTINGS_API_PATH,
|
|
15002
|
+
response: void 0
|
|
15003
|
+
},
|
|
15004
|
+
/** The same path as `readSettings`; saves the body and answers with what was saved. */
|
|
15005
|
+
saveSettings: {
|
|
15006
|
+
method: "PUT",
|
|
15007
|
+
path: MCP_SETTINGS_API_PATH,
|
|
15008
|
+
response: void 0
|
|
15009
|
+
},
|
|
15010
|
+
/** Session scope: one available tool's registered name, description and schema. */
|
|
15011
|
+
sessionTool: {
|
|
15012
|
+
method: "GET",
|
|
15013
|
+
path: MCP_SESSION_TOOL_API_PATH,
|
|
15014
|
+
query: [MCP_SESSION_TOOL_SERVER_QUERY, MCP_SESSION_TOOL_NAME_QUERY],
|
|
15015
|
+
response: void 0
|
|
15016
|
+
},
|
|
15017
|
+
/** Session scope: stores a secret the session reported missing. Owner-only; the value is never echoed. */
|
|
15018
|
+
sessionSecret: {
|
|
15019
|
+
method: "POST",
|
|
15020
|
+
path: MCP_SESSION_SECRETS_API_PATH,
|
|
15021
|
+
response: void 0
|
|
15022
|
+
}
|
|
15023
|
+
};
|
|
15024
|
+
//#endregion
|
|
15025
|
+
//#region ../../default/po-mcp/src/services/mcpHubApi/http.ts
|
|
15026
|
+
/**
|
|
15027
|
+
* What the Node hub API and the edge global API share: JSON bodies and answers, the person's own config
|
|
15028
|
+
* paths, and the approval settings route. None of it touches a filesystem or a process, so both hosts run it.
|
|
15029
|
+
*/
|
|
15030
|
+
const JSON_HEADERS = { "content-type": "application/json" };
|
|
15031
|
+
const MAX_BODY_BYTES = 8192;
|
|
15032
|
+
const MAX_SERVER_NAME = 160;
|
|
15033
|
+
function json(body, status = 200) {
|
|
15034
|
+
return new Response(JSON.stringify(body), {
|
|
15035
|
+
status,
|
|
15036
|
+
headers: JSON_HEADERS
|
|
15037
|
+
});
|
|
15038
|
+
}
|
|
15039
|
+
function isRecord$1(value) {
|
|
15040
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
15041
|
+
}
|
|
15042
|
+
async function bodyOf(request) {
|
|
15043
|
+
const text = await request.text();
|
|
15044
|
+
if (text.length > MAX_BODY_BYTES) return void 0;
|
|
15045
|
+
try {
|
|
15046
|
+
const parsed = JSON.parse(text);
|
|
15047
|
+
return isRecord$1(parsed) ? parsed : void 0;
|
|
15048
|
+
} catch {
|
|
15049
|
+
return;
|
|
15050
|
+
}
|
|
15051
|
+
}
|
|
15052
|
+
function serverNameOf(value) {
|
|
15053
|
+
return typeof value === "string" && value.length > 0 && value.length <= MAX_SERVER_NAME && !Array.from(value).some((character) => character.charCodeAt(0) <= 31) ? value : void 0;
|
|
15054
|
+
}
|
|
15055
|
+
/**
|
|
15056
|
+
* The person's own MCP files under Po's home: their servers and their Po-wide preferences. The hub API writes
|
|
15057
|
+
* them and the saved-state reader reads them, so both take the paths from here. Undefined when the host gave no home.
|
|
15058
|
+
*/
|
|
15059
|
+
function userMcpFilePaths(homeDirectory, environment = {}) {
|
|
15060
|
+
if (!homeDirectory) return void 0;
|
|
15061
|
+
const poHome = poHomeDirectory(homeDirectory, environment);
|
|
15062
|
+
return {
|
|
15063
|
+
config: join(poHome, PO_USER_MCP_CONFIG_FILE),
|
|
15064
|
+
settings: join(poHome, MCP_SETTINGS_FILE)
|
|
15065
|
+
};
|
|
15066
|
+
}
|
|
15067
|
+
/** `<po home>/mcp.json` for the person this hub runs as, or undefined when the host gave no home. */
|
|
15068
|
+
function userConfigPath(context) {
|
|
15069
|
+
return userMcpFilePaths(context.homeDirectory, context.environment)?.config;
|
|
15070
|
+
}
|
|
15071
|
+
function settingsPath(context) {
|
|
15072
|
+
return userMcpFilePaths(context.homeDirectory, context.environment)?.settings;
|
|
15073
|
+
}
|
|
15074
|
+
/** A missing vault, or a VaultError the store raised (matched by code, never by class). */
|
|
15075
|
+
function isVaultUnavailable(error) {
|
|
15076
|
+
if (typeof error === "object" && error !== null && "code" in error && error.code === "unavailable") return true;
|
|
15077
|
+
return error instanceof Error && error.message === "Po's vault is unavailable, so MCP sign-ins cannot be saved.";
|
|
15078
|
+
}
|
|
15079
|
+
/** Reads or saves the approval setting. A file that cannot be read or written is a 500, never an `off` answer. */
|
|
15080
|
+
async function handleSettings(settings, request, context) {
|
|
15081
|
+
const filePath = settingsPath(context);
|
|
15082
|
+
if (!filePath) return json({ error: "Po couldn't find your home directory on this hub." }, 503);
|
|
15083
|
+
try {
|
|
15084
|
+
if (request.method === routes.saveSettings.method) {
|
|
15085
|
+
const body = await bodyOf(request);
|
|
15086
|
+
if (!body || Object.keys(body).length !== 1 || typeof body.autoApproveDestructiveTools !== "boolean") return json({ error: "Send { \"autoApproveDestructiveTools\": true | false }." }, 400);
|
|
15087
|
+
await settings.setAutoApprove(filePath, body.autoApproveDestructiveTools);
|
|
15088
|
+
} else await settings.load(filePath);
|
|
15089
|
+
return json({ autoApproveDestructiveTools: settings.autoApprove() });
|
|
15090
|
+
} catch (error) {
|
|
15091
|
+
return json({ error: `Po couldn't use ${MCP_SETTINGS_FILE}: ${error instanceof Error ? error.message : String(error)}` }, 500);
|
|
15092
|
+
}
|
|
15093
|
+
}
|
|
15094
|
+
/** Every name a client may give the wrapper entry. */
|
|
15095
|
+
const PROXY_SERVER_ALIASES = /* @__PURE__ */ new Set(["mcp-proxy", "agiflow-proxy"]);
|
|
15096
|
+
/** Whether a server name is the proxy wrapper, which Po strips on load instead of connecting. */
|
|
15097
|
+
function isProxyWrapper(name) {
|
|
15098
|
+
return PROXY_SERVER_ALIASES.has(name);
|
|
15099
|
+
}
|
|
15100
|
+
//#endregion
|
|
15101
|
+
//#region ../../default/po-mcp/src/services/mcpServerConfig/index.ts
|
|
15102
|
+
const NAME = /^[A-Za-z0-9_-]{1,64}$/u;
|
|
15103
|
+
const HEADER_NAME = /^[A-Za-z0-9!#$%&'*+.^_`|~-]{1,128}$/u;
|
|
15104
|
+
const ENV_NAME = /^[A-Za-z_][A-Za-z0-9_]{0,127}$/u;
|
|
15105
|
+
const MAX_URL = 2048;
|
|
15106
|
+
const MAX_COMMAND = 1024;
|
|
15107
|
+
const MAX_VALUE = 4096;
|
|
15108
|
+
const MAX_ARGS = 64;
|
|
15109
|
+
const MAX_PAIRS = 64;
|
|
15110
|
+
function isRecord(value) {
|
|
15111
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
15112
|
+
}
|
|
15113
|
+
function refuse(error, status = 400) {
|
|
15114
|
+
return {
|
|
15115
|
+
ok: false,
|
|
15116
|
+
status,
|
|
15117
|
+
error
|
|
15118
|
+
};
|
|
15119
|
+
}
|
|
15120
|
+
function hasControl(value) {
|
|
15121
|
+
return Array.from(value).some((character) => character.charCodeAt(0) <= 31 || character.charCodeAt(0) === 127);
|
|
15122
|
+
}
|
|
15123
|
+
/** Header values and environment values may hold anything but a line break or NUL. */
|
|
15124
|
+
function isPlainValue(value) {
|
|
15125
|
+
return typeof value === "string" && value.length <= MAX_VALUE && !/[\r\n\0]/u.test(value);
|
|
15126
|
+
}
|
|
15127
|
+
function stringPairs(value, keyPattern) {
|
|
15128
|
+
if (value === void 0) return void 0;
|
|
15129
|
+
if (!isRecord(value)) return null;
|
|
15130
|
+
const entries = Object.entries(value);
|
|
15131
|
+
if (entries.length > MAX_PAIRS) return null;
|
|
15132
|
+
for (const [key, item] of entries) if (!keyPattern.test(key) || !isPlainValue(item)) return null;
|
|
15133
|
+
return entries.length > 0 ? Object.fromEntries(entries) : void 0;
|
|
15134
|
+
}
|
|
15135
|
+
function remoteEntry(value) {
|
|
15136
|
+
const url = value.url;
|
|
15137
|
+
if (typeof url !== "string" || url.length > MAX_URL) return refuse("Enter an http or https address.");
|
|
15138
|
+
let protocol;
|
|
15139
|
+
try {
|
|
15140
|
+
protocol = new URL(url).protocol;
|
|
15141
|
+
} catch {
|
|
15142
|
+
return refuse("Enter an http or https address.");
|
|
15143
|
+
}
|
|
15144
|
+
if (protocol !== "https:" && protocol !== "http:") return refuse("Enter an http or https address.");
|
|
15145
|
+
const headers = stringPairs(value.headers, HEADER_NAME);
|
|
15146
|
+
if (headers === null) return refuse("Each header needs a plain name and a one-line value.");
|
|
15147
|
+
return {
|
|
15148
|
+
ok: true,
|
|
15149
|
+
value: {
|
|
15150
|
+
type: "http",
|
|
15151
|
+
url,
|
|
15152
|
+
...headers ? { headers } : {}
|
|
15153
|
+
}
|
|
15154
|
+
};
|
|
15155
|
+
}
|
|
15156
|
+
function localEntry(value, trusted) {
|
|
15157
|
+
const command = typeof value.command === "string" ? value.command.trim() : "";
|
|
15158
|
+
if (command === "" || command.length > MAX_COMMAND || hasControl(command)) return refuse("Enter the command to run.");
|
|
15159
|
+
const args = value.args ?? [];
|
|
15160
|
+
if (!Array.isArray(args) || args.length > MAX_ARGS || !args.every((arg) => typeof arg === "string" && arg.length <= MAX_VALUE && !arg.includes("\0"))) return refuse("Arguments must be plain text, one per line.");
|
|
15161
|
+
const env = stringPairs(value.env, ENV_NAME);
|
|
15162
|
+
if (env === null) return refuse("Each environment variable needs a NAME and a one-line value.");
|
|
15163
|
+
if (!trusted) return refuse("Confirm that you trust this command before adding it.");
|
|
15164
|
+
return {
|
|
15165
|
+
ok: true,
|
|
15166
|
+
value: {
|
|
15167
|
+
command,
|
|
15168
|
+
args,
|
|
15169
|
+
...env ? { env } : {}
|
|
15170
|
+
}
|
|
15171
|
+
};
|
|
15172
|
+
}
|
|
15173
|
+
/** Checks a server name and entry from the settings UI. Every field is untrusted input. */
|
|
15174
|
+
function parseMcpServerAddition(name, entry, trusted) {
|
|
15175
|
+
if (typeof name !== "string" || !NAME.test(name)) return refuse("Use letters, numbers, dashes or underscores.");
|
|
15176
|
+
if (isProxyWrapper(name)) return refuse(`${name} is reserved for Po's MCP proxy. Choose another name.`);
|
|
15177
|
+
if (!isRecord(entry)) return refuse("Enter a server URL or a command.");
|
|
15178
|
+
const parsed = "command" in entry ? localEntry(entry, trusted === true) : remoteEntry(entry);
|
|
15179
|
+
return parsed.ok ? {
|
|
15180
|
+
ok: true,
|
|
15181
|
+
value: {
|
|
15182
|
+
name,
|
|
15183
|
+
entry: parsed.value
|
|
15184
|
+
}
|
|
15185
|
+
} : parsed;
|
|
15186
|
+
}
|
|
15187
|
+
/**
|
|
15188
|
+
* The document with one server added, every other key kept as it was.
|
|
15189
|
+
* Refuses rather than replaces: a name that exists already stays as the person wrote it.
|
|
15190
|
+
*/
|
|
15191
|
+
function addMcpServer(document, addition, fileLabel) {
|
|
15192
|
+
const config = document === void 0 ? {} : document;
|
|
15193
|
+
if (!isRecord(config)) return refuse(`${fileLabel} isn't a JSON object, so Po left it alone.`, 409);
|
|
15194
|
+
const servers = config.mcpServers ?? {};
|
|
15195
|
+
if (!isRecord(servers)) return refuse(`mcpServers in ${fileLabel} isn't an object, so Po left it alone.`, 409);
|
|
15196
|
+
if (Object.hasOwn(servers, addition.name)) return refuse(`A server named ${addition.name} already exists in ${fileLabel}.`, 409);
|
|
15197
|
+
return {
|
|
15198
|
+
ok: true,
|
|
15199
|
+
value: {
|
|
15200
|
+
...config,
|
|
15201
|
+
mcpServers: {
|
|
15202
|
+
...servers,
|
|
15203
|
+
[addition.name]: addition.entry
|
|
15204
|
+
}
|
|
15205
|
+
}
|
|
15206
|
+
};
|
|
15207
|
+
}
|
|
15208
|
+
/** The servers a config document names, without their headers or environment. */
|
|
15209
|
+
function listMcpServers(document) {
|
|
15210
|
+
const servers = isRecord(document) && isRecord(document.mcpServers) ? document.mcpServers : {};
|
|
15211
|
+
return Object.entries(servers).filter(([name]) => !isProxyWrapper(name)).map(([name, definition]) => {
|
|
15212
|
+
const record = isRecord(definition) ? definition : {};
|
|
15213
|
+
return typeof record.command === "string" ? {
|
|
15214
|
+
name,
|
|
15215
|
+
kind: "local",
|
|
15216
|
+
target: record.command
|
|
15217
|
+
} : {
|
|
15218
|
+
name,
|
|
15219
|
+
kind: "remote",
|
|
15220
|
+
target: safeMcpTarget(record.url)
|
|
15221
|
+
};
|
|
15222
|
+
}).sort((left, right) => left.name.localeCompare(right.name));
|
|
15223
|
+
}
|
|
15224
|
+
/**
|
|
15225
|
+
* The servers a config document names, each with what the person may do to it. A definition that is not an
|
|
15226
|
+
* object is listed but read-only, and an edit that would move a remote server to a new URL is not offered.
|
|
15227
|
+
*/
|
|
15228
|
+
function listManagedMcpServers(document) {
|
|
15229
|
+
const servers = isRecord(document) && isRecord(document.mcpServers) ? document.mcpServers : {};
|
|
15230
|
+
return listMcpServers(document).map((server) => {
|
|
15231
|
+
const definition = servers[server.name];
|
|
15232
|
+
const writable = isRecord(definition);
|
|
15233
|
+
return {
|
|
15234
|
+
...server,
|
|
15235
|
+
management: {
|
|
15236
|
+
owner: writable ? "global" : "read-only",
|
|
15237
|
+
target: server.target,
|
|
15238
|
+
kind: server.kind,
|
|
15239
|
+
canEdit: writable && (server.kind === "local" || server.target === definition.url),
|
|
15240
|
+
canRemove: writable,
|
|
15241
|
+
...writable ? { revision: mcpServerRevision(definition) } : {}
|
|
15242
|
+
}
|
|
15243
|
+
};
|
|
15244
|
+
});
|
|
15245
|
+
}
|
|
15246
|
+
/** Opaque optimistic concurrency identity, including fields never returned to the browser. */
|
|
15247
|
+
function mcpServerRevision(entry) {
|
|
15248
|
+
return createHash("sha256").update(JSON.stringify(entry) ?? "undefined").digest("hex");
|
|
15249
|
+
}
|
|
15250
|
+
/** Changes only one existing entry. Credentials and unknown saved fields stay in place. */
|
|
15251
|
+
function mutateMcpServer(document, name, revision, addition, preserveArgs = false) {
|
|
15252
|
+
if (isProxyWrapper(name) || !isRecord(document) || !isRecord(document.mcpServers)) return refuse("That saved server is not writable. Refresh settings.", 409);
|
|
15253
|
+
const servers = document.mcpServers;
|
|
15254
|
+
if (!Object.hasOwn(servers, name) || !isRecord(servers[name]) || mcpServerRevision(servers[name]) !== revision) return refuse("That saved server changed. Refresh settings before trying again.", 409);
|
|
15255
|
+
const old = servers[name];
|
|
15256
|
+
const next = { ...servers };
|
|
15257
|
+
if (addition) {
|
|
15258
|
+
const entry = addition.entry;
|
|
15259
|
+
if (addition.name !== name) return refuse("A saved server name cannot be changed.");
|
|
15260
|
+
if (("command" in entry ? entry.command !== old.command : entry.url !== old.url || "command" in old) || "command" in entry && (!("command" in old) || !preserveArgs && JSON.stringify(entry.args) !== JSON.stringify(old.args ?? [])) || !("command" in entry) && old.type !== void 0 && old.type !== "http") return refuse("Changing endpoint, transport, command or arguments needs a separate credential decision. Po left the server and credentials unchanged.", 409);
|
|
15261
|
+
const pairs = "command" in entry ? "env" : "headers";
|
|
15262
|
+
const values = entry[pairs];
|
|
15263
|
+
next[name] = {
|
|
15264
|
+
...old,
|
|
15265
|
+
...entry,
|
|
15266
|
+
..."command" in entry && preserveArgs && Array.isArray(old.args) ? { args: old.args } : {},
|
|
15267
|
+
...isRecord(old[pairs]) || isRecord(values) ? { [pairs]: {
|
|
15268
|
+
...isRecord(old[pairs]) ? old[pairs] : {},
|
|
15269
|
+
...isRecord(values) ? values : {}
|
|
15270
|
+
} } : {}
|
|
15271
|
+
};
|
|
15272
|
+
} else delete next[name];
|
|
15273
|
+
return {
|
|
15274
|
+
ok: true,
|
|
15275
|
+
value: {
|
|
15276
|
+
...document,
|
|
15277
|
+
mcpServers: next
|
|
15278
|
+
}
|
|
15279
|
+
};
|
|
15280
|
+
}
|
|
15281
|
+
/** URLs can embed credentials. A read projection never returns userinfo, query or fragment. */
|
|
15282
|
+
function safeMcpTarget(value) {
|
|
15283
|
+
if (typeof value !== "string") return "";
|
|
15284
|
+
try {
|
|
15285
|
+
const url = new URL(value);
|
|
15286
|
+
if (url.username === "" && url.password === "" && url.search === "" && url.hash === "") return value;
|
|
15287
|
+
url.username = "";
|
|
15288
|
+
url.password = "";
|
|
15289
|
+
url.search = "";
|
|
15290
|
+
url.hash = "";
|
|
15291
|
+
return url.toString();
|
|
15292
|
+
} catch {
|
|
15293
|
+
return "";
|
|
15294
|
+
}
|
|
15295
|
+
}
|
|
15296
|
+
//#endregion
|
|
15297
|
+
//#region ../../foundations/po-vault/src/services/localLock/index.ts
|
|
15298
|
+
/**
|
|
15299
|
+
* `Vault.withLock` for a vault whose lock only has to hold inside this process: calls on one name
|
|
15300
|
+
* run one after another, and the op's signal aborts only when the caller's does.
|
|
15301
|
+
*/
|
|
15302
|
+
function createLocalLock() {
|
|
15303
|
+
const locks = /* @__PURE__ */ new Map();
|
|
15304
|
+
return async (namespace, key, op, signal) => {
|
|
15305
|
+
assertEntryName(namespace, key);
|
|
15306
|
+
if (typeof op !== "function") throw new VaultError("invalid");
|
|
15307
|
+
const name = `${namespace}\0${key}`;
|
|
15308
|
+
const previous = locks.get(name) ?? Promise.resolve();
|
|
15309
|
+
let release = () => void 0;
|
|
15310
|
+
const held = new Promise((resolve) => {
|
|
15311
|
+
release = resolve;
|
|
15312
|
+
});
|
|
15313
|
+
const tail = previous.then(() => held);
|
|
15314
|
+
locks.set(name, tail);
|
|
15315
|
+
try {
|
|
15316
|
+
await previous;
|
|
15317
|
+
signal?.throwIfAborted();
|
|
15318
|
+
const controller = new AbortController();
|
|
15319
|
+
const onAbort = () => controller.abort(signal?.reason);
|
|
15320
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
15321
|
+
try {
|
|
15322
|
+
return await op(controller.signal);
|
|
15323
|
+
} finally {
|
|
15324
|
+
signal?.removeEventListener("abort", onAbort);
|
|
15325
|
+
}
|
|
15326
|
+
} finally {
|
|
15327
|
+
release();
|
|
15328
|
+
if (locks.get(name) === tail) locks.delete(name);
|
|
15329
|
+
}
|
|
15330
|
+
};
|
|
15331
|
+
}
|
|
15332
|
+
//#endregion
|
|
15333
|
+
//#region ../../foundations/po-vault/src/services/accountVault/index.ts
|
|
15334
|
+
function isVaultAccountOperation(operation) {
|
|
15335
|
+
return VAULT_ACCOUNT_OPERATIONS.includes(operation);
|
|
15336
|
+
}
|
|
15337
|
+
/** A well-formed answer, or `undefined` for anything else: an unreachable account or a reply from an older cloud. */
|
|
15338
|
+
async function ask(call, operation, input) {
|
|
15339
|
+
let answer;
|
|
15340
|
+
try {
|
|
15341
|
+
answer = await call(operation, input);
|
|
15342
|
+
} catch {
|
|
15343
|
+
return;
|
|
15344
|
+
}
|
|
15345
|
+
if (typeof answer !== "object" || answer === null || typeof answer.ok !== "boolean") return;
|
|
15346
|
+
return answer;
|
|
15347
|
+
}
|
|
15348
|
+
/** Writes can't pretend: no answer, or a refused one, throws with the answer's code. */
|
|
15349
|
+
async function write(call, operation, input) {
|
|
15350
|
+
const answer = await ask(call, operation, input);
|
|
15351
|
+
if (answer === void 0) throw new VaultError("unavailable");
|
|
15352
|
+
if (!answer.ok) throw new VaultError(answer.code);
|
|
15353
|
+
return answer;
|
|
15354
|
+
}
|
|
15355
|
+
/**
|
|
15356
|
+
* The signed-in account's vault over any transport. Names, revisions and value size are checked
|
|
15357
|
+
* here first, so a bad call never leaves the host. Reads that can't reach the account, or that the
|
|
15358
|
+
* account can't serve, answer as if the entry is missing; writes throw `unavailable`. `connected`
|
|
15359
|
+
* tells whether a host is signed in at all.
|
|
15360
|
+
*/
|
|
15361
|
+
function createAccountVault(call, connected = () => true) {
|
|
15362
|
+
return {
|
|
15363
|
+
async get(namespace, key) {
|
|
15364
|
+
assertEntryName(namespace, key);
|
|
15365
|
+
const answer = await ask(call, "vault.get", {
|
|
15366
|
+
namespace,
|
|
15367
|
+
key
|
|
15368
|
+
});
|
|
15369
|
+
if (answer?.ok !== true) {
|
|
15370
|
+
if (answer?.ok === false && answer.code === "invalid") throw new VaultError("invalid");
|
|
15371
|
+
return;
|
|
15372
|
+
}
|
|
15373
|
+
return answer.record;
|
|
15374
|
+
},
|
|
15375
|
+
async put(namespace, key, value, options) {
|
|
15376
|
+
assertEntryName(namespace, key);
|
|
15377
|
+
const expectRevision = options?.expectRevision;
|
|
15378
|
+
if (expectRevision !== void 0 && expectRevision !== null) assertRevision(expectRevision);
|
|
15379
|
+
serializeValue(value);
|
|
15380
|
+
const answer = await write(call, "vault.put", {
|
|
15381
|
+
namespace,
|
|
15382
|
+
key,
|
|
15383
|
+
value,
|
|
15384
|
+
...expectRevision === void 0 ? {} : { expectRevision }
|
|
15385
|
+
});
|
|
15386
|
+
if (answer.record === void 0) throw new VaultError("unavailable");
|
|
15387
|
+
return answer.record;
|
|
15388
|
+
},
|
|
15389
|
+
async delete(namespace, key, options) {
|
|
15390
|
+
assertEntryName(namespace, key);
|
|
15391
|
+
const expectRevision = options?.expectRevision;
|
|
15392
|
+
if (expectRevision !== void 0) assertRevision(expectRevision);
|
|
15393
|
+
await write(call, "vault.delete", {
|
|
15394
|
+
namespace,
|
|
15395
|
+
key,
|
|
15396
|
+
...expectRevision === void 0 ? {} : { expectRevision }
|
|
15397
|
+
});
|
|
15398
|
+
},
|
|
15399
|
+
async list() {
|
|
15400
|
+
const answer = await ask(call, "vault.list", {});
|
|
15401
|
+
return answer?.ok === true ? answer.entries ?? [] : [];
|
|
15402
|
+
},
|
|
15403
|
+
withLock: createLocalLock(),
|
|
15404
|
+
status() {
|
|
15405
|
+
return { backend: connected() ? "account" : void 0 };
|
|
15406
|
+
}
|
|
15407
|
+
};
|
|
15408
|
+
}
|
|
15409
|
+
//#endregion
|
|
15410
|
+
export { ClientRequestSchema as $, RequestMetaSchema as $n, ToolListChangedNotificationSchema as $r, LegacyTitledEnumSchemaSchema as $t, modelInputSchema as A, OAuthTokensSchema as An, SubscribeRequestParamsSchema as Ar, GetTaskPayloadResultSchema as At, BlobResourceContentsSchema as B, ProgressNotificationSchema as Bn, TaskCreationParamsSchema as Br, InitializeResultSchema as Bt, PO_MCP_REMOTE_SERVERS_CONTRACT as C, OAuthClientInformationSchema as Cn, ServerRequestSchema as Cr, EmbeddedResourceSchema as Ct, prepareSecretAddition as D, OAuthMetadataSchema as Dn, SetLevelRequestSchema as Dr, GetPromptRequestSchema as Dt, readPoMcpRemoteServers as E, OAuthErrorResponseSchema as En, SetLevelRequestParamsSchema as Er, GetPromptRequestParamsSchema as Et, mcpToolApproval as F, PaginatedRequestSchema as Fn, SubscriptionsListenRequestParamsSchema as Fr, IdJagTokenExchangeResponseSchema as Ft, CallToolRequestSchema as G, PromptMessageSchema as Gn, TaskStatusSchema as Gr, JSONRPCMessageSchema as Gt, CLIENT_CAPABILITIES_META_KEY as H, ProgressTokenSchema as Hn, TaskSchema as Hr, JSONArraySchema as Ht, AnnotationsSchema as I, PaginatedResultSchema as In, SubscriptionsListenRequestSchema as Ir, ImageContentSchema as It, CancelTaskResultSchema as J, ReadResourceRequestParamsSchema as Jn, TitledMultiSelectEnumSchemaSchema as Jr, JSONRPCResponseSchema as Jt, CallToolResultSchema as K, PromptReferenceSchema as Kn, TextContentSchema as Kr, JSONRPCNotificationSchema as Kt, AudioContentSchema as L, PingRequestSchema as Ln, SubscriptionsListenResultMetaSchema as Lr, ImplementationSchema as Lt, normalizeMcpAppMetadata as M, OpenIdProviderMetadataSchema as Mn, SubscriptionFilterSchema as Mr, GetTaskResultSchema as Mt, createMcpApprovalState as N, PROTOCOL_VERSION_META_KEY as Nn, SubscriptionsAcknowledgedNotificationParamsSchema as Nr, IconSchema as Nt, writeSecrets as O, OAuthProtectedResourceMetadataSchema as On, SingleSelectEnumSchemaSchema as Or, GetPromptResultSchema as Ot, isDestructiveMcpTool as P, PaginatedRequestParamsSchema as Pn, SubscriptionsAcknowledgedNotificationSchema as Pr, IconsSchema as Pt, ClientNotificationSchema as Q, RequestIdSchema as Qn, ToolExecutionSchema as Qr, LOG_LEVEL_META_KEY as Qt, BaseMetadataSchema as R, PrimitiveSchemaDefinitionSchema as Rn, SubscriptionsListenResultSchema as Rr, InitializeRequestParamsSchema as Rt, createMcpGlobalSettings as S, OAuthClientInformationFullSchema as Sn, ServerNotificationSchema as Sr, ElicitationCompleteNotificationSchema as St, connectRemoteMcpServers as T, OAuthClientRegistrationErrorSchema as Tn, ServerTasksCapabilitySchema as Tr, EnumSchemaSchema as Tt, CLIENT_INFO_META_KEY as U, PromptArgumentSchema as Un, TaskStatusNotificationParamsSchema as Ur, JSONObjectSchema as Ut, BooleanSchemaSchema as V, ProgressSchema as Vn, TaskMetadataSchema as Vr, InitializedNotificationSchema as Vt, CallToolRequestParamsSchema as W, PromptListChangedNotificationSchema as Wn, TaskStatusNotificationSchema as Wr, JSONRPCErrorResponseSchema as Wt, CancelledNotificationSchema as X, ReadResourceResultSchema as Xn, ToolAnnotationsSchema as Xr, JSONValueSchema as Xt, CancelledNotificationParamsSchema as Y, ReadResourceRequestSchema as Yn, TitledSingleSelectEnumSchemaSchema as Yr, JSONRPCResultResponseSchema as Yt, ClientCapabilitiesSchema as Z, RelatedTaskMetadataSchema as Zn, ToolChoiceSchema as Zr, LATEST_PROTOCOL_VERSION as Zt, userMcpFilePaths as _, ModelPreferencesSchema as _n, SUPPORTED_PROTOCOL_VERSIONS as _r, ElicitRequestParamsSchema as _t, listManagedMcpServers as a, UntitledMultiSelectEnumSchemaSchema as ai, ListResourcesRequestSchema as an, ResourceSchema as ar, CompleteResultSchema as at, SERVER_COMMAND_DESCRIPTION as b, NotificationsParamsSchema as bn, SamplingMessageSchema as br, ElicitResultSchema as bt, parseMcpServerAddition as c, string as ci, ListRootsResultSchema as cn, ResourceUpdatedNotificationParamsSchema as cr, CreateMessageRequestSchema as ct, handleSettings as d, ownZone as di, ListToolsRequestSchema as dn, ResultSchema as dr, CreateTaskResultSchema as dt, ToolResultContentSchema as ei, ListChangedOptionsBaseSchema as en, RequestSchema as er, ClientResultSchema as et, isRecord$1 as f, ListToolsResultSchema as fn, RoleSchema as fr, CursorSchema as ft, userConfigPath as g, ModelHintSchema as gn, SUBSCRIPTION_ID_META_KEY as gr, ElicitRequestFormParamsSchema as gt, serverNameOf as h, LoggingMessageNotificationSchema as hn, SERVER_INFO_META_KEY as hr, DiscoverResultSchema as ht, addMcpServer as i, UnsubscribeRequestSchema as ii, ListResourceTemplatesResultSchema as in, ResourceRequestParamsSchema as ir, CompleteRequestSchema as it, isModelVisibleMcpTool as j, OpenIdProviderDiscoveryMetadataSchema as jn, SubscribeRequestSchema as jr, GetTaskRequestSchema as jt, USER_MCP_SCOPE as k, OAuthTokenRevocationRequestSchema as kn, StringSchemaSchema as kr, GetTaskPayloadRequestSchema as kt, isProxyWrapper as l, OutboundRefusedError as li, ListTasksRequestSchema as ln, ResourceUpdatedNotificationSchema as lr, CreateMessageResultSchema as lt, json as m, LoggingMessageNotificationParamsSchema as mn, RootsListChangedNotificationSchema as mr, DiscoverRequestSchema as mt, isVaultAccountOperation as n, ToolUseContentSchema as ni, ListPromptsResultSchema as nn, ResourceLinkSchema as nr, CompatibilityCallToolResultSchema as nt, mcpServerRevision as o, UntitledSingleSelectEnumSchemaSchema as oi, ListResourcesResultSchema as on, ResourceTemplateReferenceSchema as or, ContentBlockSchema as ot, isVaultUnavailable as p, LoggingLevelSchema as pn, RootSchema as pr, DEFAULT_NEGOTIATED_PROTOCOL_VERSION as pt, CancelTaskRequestSchema as q, PromptSchema as qn, TextResourceContentsSchema as qr, JSONRPCRequestSchema as qt, createLocalLock as r, UnsubscribeRequestParamsSchema as ri, ListResourceTemplatesRequestSchema as rn, ResourceListChangedNotificationSchema as rr, CompleteRequestParamsSchema as rt, mutateMcpServer as s, boolean as si, ListRootsRequestSchema as sn, ResourceTemplateSchema as sr, CreateMessageRequestParamsSchema as st, createAccountVault as t, ToolSchema as ti, ListPromptsRequestSchema as tn, ResourceContentsSchema as tr, ClientTasksCapabilitySchema as tt, bodyOf as u, outboundHostRefusal as ui, ListTasksResultSchema as un, ResultMetaObjectSchema as ur, CreateMessageResultWithToolsSchema as ut, routes as v, MultiSelectEnumSchemaSchema as vn, SamplingContentSchema as vr, ElicitRequestSchema as vt, PO_MCP_REMOTE_SERVERS_SERVICE as w, OAuthClientMetadataSchema as wn, ServerResultSchema as wr, EmptyResultSchema as wt, VAULT_UNAVAILABLE as x, NumberSchemaSchema as xn, ServerCapabilitiesSchema as xr, ElicitationCompleteNotificationParamsSchema as xt, MCP_FLOW_ID_PARAM as y, NotificationSchema as yn, SamplingMessageContentBlockSchema as yr, ElicitRequestURLParamsSchema as yt, BaseRequestParamsSchema as z, ProgressNotificationParamsSchema as zn, TaskAugmentedRequestParamsSchema as zr, InitializeRequestSchema as zt };
|