@agimon-ai/po-cloudflare 0.0.2-alpha.2 → 0.0.2-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/dist/abort-signals-2GUraIGq.js +34 -0
- package/dist/agent-DZ-OKOHn.js +6850 -0
- package/dist/anthropic-messages-5ODquUB-.js +14317 -0
- package/dist/{apiContracts-CHOiCbS_.js → apiContracts-b33nSAAI.js} +18 -81
- package/dist/{approval-BMXqnTYd.js → approval-r3NnI1VC.js} +19 -3
- package/dist/{approvalPrompt-Bg1JrEEY.js → approvalPrompt-DWoXxu3S.js} +2 -2
- package/dist/artifactFiles-DLCReI0-.js +1 -0
- package/dist/assets/assets/{CodeEditorView-BnyZHaYM.js → CodeEditorView-XeNS0L9M.js} +2 -2
- package/dist/assets/assets/{abnfDiagram-WEYOIA3C-muME0eCj.js → abnfDiagram-WEYOIA3C-B6ZW0nkR.js} +2 -2
- package/dist/assets/assets/{architecture-WOLXFQ4H-DMnhK1WH.js → architecture-WOLXFQ4H-bVR64sHO.js} +1 -1
- package/dist/assets/assets/{architectureDiagram-ZHVYKT53-DKn7XGP7.js → architectureDiagram-ZHVYKT53-D7tZz3io.js} +2 -2
- package/dist/assets/assets/{blockDiagram-RJAE7QA3-DtDctXZg.js → blockDiagram-RJAE7QA3-DdwScfiX.js} +2 -2
- package/dist/assets/assets/{c4Diagram-XDPPPE54-23pGLJeP.js → c4Diagram-XDPPPE54-DgSxZJCV.js} +2 -2
- package/dist/assets/assets/channel-TPcVvp_3.js +2 -0
- package/dist/assets/assets/{chunk-2E7WHVMD-BZ2nGNPa.js → chunk-2E7WHVMD-D5TXC2SM.js} +2 -2
- package/dist/assets/assets/{chunk-4EMNKR2T-Dui1SYFi.js → chunk-4EMNKR2T-BWhOSvo1.js} +2 -2
- package/dist/assets/assets/{chunk-55XCU76K-CUB92Evl.js → chunk-55XCU76K-HkkBzLtZ.js} +2 -2
- package/dist/assets/assets/{chunk-7S6XSTFO-CVayPHfE.js → chunk-7S6XSTFO-CBnjycLU.js} +2 -2
- package/dist/assets/assets/{chunk-AQDTSKZB---wakYqY.js → chunk-AQDTSKZB-75lIIq8T.js} +2 -2
- package/dist/assets/assets/{chunk-DSNLSHJZ-DfbdohUR.js → chunk-DSNLSHJZ-D8PpnXMk.js} +2 -2
- package/dist/assets/assets/{chunk-HAGFOTED-Dr4KRh-b.js → chunk-HAGFOTED-CXRS2NIN.js} +2 -2
- package/dist/assets/assets/{chunk-HNE4Q36P-D06cR91Z.js → chunk-HNE4Q36P-BocUqS94.js} +2 -2
- package/dist/assets/assets/{chunk-NQOKRVIF-Ca4gLeDb.js → chunk-NQOKRVIF-CHf_ogYT.js} +2 -2
- package/dist/assets/assets/{chunk-UHW7PFBP-DmL638jN.js → chunk-UHW7PFBP-DrW1PaIv.js} +2 -2
- package/dist/assets/assets/{chunk-VQ5W62QI-pkxSW5Zj.js → chunk-VQ5W62QI-CLoA7bFm.js} +2 -2
- package/dist/assets/assets/{chunk-WQQL4CDK-Dcc8hV4U.js → chunk-WQQL4CDK-BmBsrj9I.js} +2 -2
- package/dist/assets/assets/chunk-XXDRQBXY-iFE4Tl8c.js +2 -0
- package/dist/assets/assets/{chunk-YZO67HFG-B_HKcFrw.js → chunk-YZO67HFG-DShE_cgv.js} +2 -2
- package/dist/assets/assets/{chunk-ZAUX2LTX-DAzZUysS.js → chunk-ZAUX2LTX-B3oLvSXy.js} +2 -2
- package/dist/assets/assets/{chunk-ZCHMQSOR-DAVgjymL.js → chunk-ZCHMQSOR-B14vKK7C.js} +2 -2
- package/dist/assets/assets/{classDiagram-v2-4MYWR3UA-Fsw8TGPu.js → classDiagram-v2-4MYWR3UA-Da8elIW2.js} +2 -2
- package/dist/assets/assets/{cose-bilkent-JH36ORCC-CgUbISYV.js → cose-bilkent-JH36ORCC-Du4tGtiJ.js} +2 -2
- package/dist/assets/assets/{cynefin-EF2NZ3EQ-D1LxAU2x.js → cynefin-EF2NZ3EQ-Cyj6i_WI.js} +1 -1
- package/dist/assets/assets/{cynefinDiagram-WF24UDRP-D54I1jil.js → cynefinDiagram-WF24UDRP-DFWXwO7A.js} +2 -2
- package/dist/assets/assets/{dagre-NK4GIZVX-DC7zL16U.js → dagre-NK4GIZVX-C1wB_cf-.js} +2 -2
- package/dist/assets/assets/{diagram-CBK3MWTC-DB0ptUdz.js → diagram-CBK3MWTC-MYCOBYl6.js} +2 -2
- package/dist/assets/assets/{diagram-I5XIIV2D-CozSftPJ.js → diagram-I5XIIV2D-BFYbKUFf.js} +2 -2
- package/dist/assets/assets/{diagram-ODIL2UCW-g3WOEWDS.js → diagram-ODIL2UCW-6siqTpv_.js} +2 -2
- package/dist/assets/assets/{diagram-PFBEJUXE-CFxGeOYi.js → diagram-PFBEJUXE-CaBr9CoB.js} +2 -2
- package/dist/assets/assets/{diagram-RJA3I4VV-BQBsLche.js → diagram-RJA3I4VV-DAvmuDpc.js} +2 -2
- package/dist/assets/assets/{diagram-TYUNFSNR-DrjpW2yq.js → diagram-TYUNFSNR-CJnhgCpo.js} +2 -2
- package/dist/assets/assets/{dist-DjL8d1jZ.js → dist-BQ4W1R18.js} +2 -2
- package/dist/assets/assets/{dist-DvgCCshF.js → dist-BnzFckPF.js} +2 -2
- package/dist/assets/assets/{dist-gfbb4ygy.js → dist-CFtBpcYL.js} +2 -2
- package/dist/assets/assets/{dist-BabjcJ3j.js → dist-CIQX1z4W.js} +2 -2
- package/dist/assets/assets/{dist-XIZum9n5.js → dist-ChHYoe9_.js} +2 -2
- package/dist/assets/assets/{dist-1-mhYUBH.js → dist-DKxZO8d9.js} +2 -2
- package/dist/assets/assets/{dist-h6SOnP8-.js → dist-DL6z28wl.js} +2 -2
- package/dist/assets/assets/{dist-B3JXhDWV.js → dist-DNyn1p9Z.js} +2 -2
- package/dist/assets/assets/{dist-Izr2SB3q.js → dist-qYlLXIa8.js} +2 -2
- package/dist/assets/assets/{ebnfDiagram-V4P3TTPT-BZS_aAve.js → ebnfDiagram-V4P3TTPT-AUcqDTM3.js} +2 -2
- package/dist/assets/assets/{elk-QONTBCTQ-B2ksVmMA.js → elk-QONTBCTQ-aA10PEHJ.js} +2 -2
- package/dist/assets/assets/{erDiagram-KYQIGQAA-7P6zF-Z-.js → erDiagram-KYQIGQAA-hhYiqA-x.js} +2 -2
- package/dist/assets/assets/{eventmodeling-K75KTNOO-RoGQoRq-.js → eventmodeling-K75KTNOO-BQZqbRo5.js} +1 -1
- package/dist/assets/assets/flowDiagram-IUGLLWBU-BuyysPYC.js +1 -0
- package/dist/assets/assets/{ganttDiagram-R7GPNTJY-CTOlRy7M.js → ganttDiagram-R7GPNTJY-CLON1GpW.js} +2 -2
- package/dist/assets/assets/{gitGraph-VSP46ZUC-CPqytIt0.js → gitGraph-VSP46ZUC-DbmvNwR2.js} +1 -1
- package/dist/assets/assets/{gitGraphDiagram-PDYL7XHY-BffLxuxg.js → gitGraphDiagram-PDYL7XHY-DJVO0WlL.js} +2 -2
- package/dist/assets/assets/index-BiTVAj5E.js +155 -0
- package/dist/assets/assets/index-CBNQEGK3.css +1 -0
- package/dist/assets/assets/{info-OHQRW6UA-BI8RK0Ow.js → info-OHQRW6UA-CAt3Nt3g.js} +1 -1
- package/dist/assets/assets/{infoDiagram-MVDRKAX5-DUIst1FB.js → infoDiagram-MVDRKAX5-DTuqH-Zb.js} +2 -2
- package/dist/assets/assets/{ishikawaDiagram-HPEHV2GE-CA17Eho5.js → ishikawaDiagram-HPEHV2GE-BnWvdonT.js} +2 -2
- package/dist/assets/assets/{journeyDiagram-BOSHW7O7-CNri5Ap9.js → journeyDiagram-BOSHW7O7-Btxtcgvl.js} +2 -2
- package/dist/assets/assets/{kanban-definition-FNSA4HC5-DnXna7jO.js → kanban-definition-FNSA4HC5-q7ek9o_H.js} +2 -2
- package/dist/assets/assets/{line-BsXJZn93.js → line-B7yLilmC.js} +2 -2
- package/dist/assets/assets/{linear-BHYaD5T0.js → linear-y8aSKEli.js} +2 -2
- package/dist/assets/assets/{mermaid-parser.core-B64Eo-8a.js → mermaid-parser.core-B4rH50nD.js} +4 -4
- package/dist/assets/assets/{mermaid.core-Zw9qmTzg.js → mermaid.core-DnRVHTjE.js} +5 -5
- package/dist/assets/assets/{mindmap-definition-6OY57UG3-E5qz4KNc.js → mindmap-definition-6OY57UG3-DT9Afs2v.js} +2 -2
- package/dist/assets/assets/{packet-JDAUHWVQ-DgfizTr3.js → packet-JDAUHWVQ-CnqNbu4p.js} +1 -1
- package/dist/assets/assets/{pegDiagram-ECIUJNBX-D0WK_agM.js → pegDiagram-ECIUJNBX-cvxdBBFq.js} +2 -2
- package/dist/assets/assets/{pie-XZMESJXO-PJR1sXD4.js → pie-XZMESJXO-etXMNsaL.js} +1 -1
- package/dist/assets/assets/{pieDiagram-GNMPY74T-CPuU-NTs.js → pieDiagram-GNMPY74T-CBN-R3_j.js} +2 -2
- package/dist/assets/assets/{quadrantDiagram-D57K4MC3-5C9yjM1b.js → quadrantDiagram-D57K4MC3-C5jjVPIH.js} +2 -2
- package/dist/assets/assets/{radar-ABXABTNO-BspdXgl0.js → radar-ABXABTNO-CAMd_mrV.js} +1 -1
- package/dist/assets/assets/{railroad-I3PHUGI6-Ct0a6hLD.js → railroad-I3PHUGI6-DIs3auoe.js} +1 -1
- package/dist/assets/assets/{railroad-abnf-LNEFI6M7-fduYB4SA.js → railroad-abnf-LNEFI6M7-CJXr1qWy.js} +1 -1
- package/dist/assets/assets/{railroad-ebnf-DWYD2UWJ-CTQa8Sww.js → railroad-ebnf-DWYD2UWJ-DfwtykqI.js} +1 -1
- package/dist/assets/assets/{railroad-peg-JR7BVNR7-DatoH3GJ.js → railroad-peg-JR7BVNR7-B8beAhTs.js} +1 -1
- package/dist/assets/assets/{railroadDiagram-Y72NRBL7-C8sWN8l2.js → railroadDiagram-Y72NRBL7-BDcQE-EL.js} +2 -2
- package/dist/assets/assets/{requirementDiagram-EQYSW5RA-CqRz4RcT.js → requirementDiagram-EQYSW5RA-KJ4-QjZM.js} +2 -2
- package/dist/assets/assets/{sankeyDiagram-SY24JHO5-bdiuKKlX.js → sankeyDiagram-SY24JHO5-VjIB-Ybr.js} +2 -2
- package/dist/assets/assets/{sequenceDiagram-BLEHNHQU-Zy-8I0Hy.js → sequenceDiagram-BLEHNHQU-MfMuWq1M.js} +2 -2
- package/dist/assets/assets/{src-gihY33R9.js → src-BAxIj8GJ.js} +2 -2
- package/dist/assets/assets/{stateDiagram-v2-A6IESKWZ-DXQERPvz.js → stateDiagram-v2-A6IESKWZ-mHwLRRCY.js} +2 -2
- package/dist/assets/assets/{swimlanes-B3ENRKFQ-1gjZQElg.js → swimlanes-B3ENRKFQ-PArlYoqV.js} +2 -2
- package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-The09-5S.js +9 -0
- package/dist/assets/assets/{timeline-definition-JXYKGLGB-CTeYEw-9.js → timeline-definition-JXYKGLGB-B2nKiNFU.js} +2 -2
- package/dist/assets/assets/{treeView-D4JQ5SDB-DD-EsLLT.js → treeView-D4JQ5SDB-gU23_RuI.js} +1 -1
- package/dist/assets/assets/{treemap-SAJKECNS-BLdFeS5J.js → treemap-SAJKECNS-CiqoMvZa.js} +1 -1
- package/dist/assets/assets/{usecaseDiagram-WPOLBNNX-C1GikSSP.js → usecaseDiagram-WPOLBNNX-DpeoWpMK.js} +2 -2
- package/dist/assets/assets/{vennDiagram-Q3Y3IDCW-B1FoA3g8.js → vennDiagram-Q3Y3IDCW-C31iGKvM.js} +2 -2
- package/dist/assets/assets/{wardley-7MLQ67FV-BrHb5Bjf.js → wardley-7MLQ67FV-CIzHhzNw.js} +1 -1
- package/dist/assets/assets/{wardleyDiagram-IVAIDKWA-CmPLD1X4.js → wardleyDiagram-IVAIDKWA-DIIkoezc.js} +2 -2
- package/dist/assets/assets/{webpack-BYWDFj_R.js → webpack-RFseiMZW.js} +2 -2
- package/dist/assets/assets/{xychartDiagram-4URNHDU4-DR5pfEjl.js → xychartDiagram-4URNHDU4-QiHL91kC.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-CKKRZ7-h.css +2 -0
- package/dist/assets/plugins/assets/browserCaptureWorklet-Droj0fW0-Droj0fW0.js +13 -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/assets/sileroVadWorker-D894njUe-DjN_BMWf.mjs +110 -0
- package/dist/assets/plugins/assets/silero_vad_v6.2.1-SjbCxFXk-SjbCxFXk.onnx +0 -0
- package/dist/assets/plugins/chunks/po-web-runtime-BJDT6Lbw.js +1 -0
- package/dist/assets/plugins/compositions.json +1 -0
- package/dist/assets/plugins/slots/approval.293d9a00-BXIhaPlQ.js +2 -0
- package/dist/assets/plugins/slots/artifacts.24567664-ZzR0gbvy.js +1 -0
- package/dist/assets/plugins/slots/author.0998a880-DAbA-7rb.js +93 -0
- package/dist/assets/plugins/slots/autocompact.dd97d013-IVq4Z6qm.js +1 -0
- package/dist/assets/plugins/slots/builtin-tools.36d7400b-CpCLjRRN.js +7 -0
- package/dist/assets/plugins/slots/codemode.8eaee717-VWt9PqsU.js +10 -0
- package/dist/assets/plugins/slots/domain.5e95fc37-5PIUBqDe.js +1 -0
- package/dist/assets/plugins/slots/edit.385c9aa9-DNAjPNG5.js +7 -0
- package/dist/assets/plugins/slots/files.daf34ed8-CQaTz0i1.js +2 -0
- package/dist/assets/plugins/slots/goal.77ec9930-B8EkarBq.js +1 -0
- package/dist/assets/plugins/slots/grep.02052cdc-CIRhO2gY.js +1 -0
- package/dist/assets/plugins/slots/help.ecd4c0f9-naMF9NN1.js +3 -0
- package/dist/assets/plugins/slots/log.a86eb6d0-D5__rAZJ.js +4 -0
- package/dist/assets/plugins/slots/mcp.974af249-DPNHn9XH.js +109 -0
- package/dist/assets/plugins/slots/plan.bafb8f68-C5GEpybF.js +3 -0
- package/dist/assets/plugins/slots/profile.48851a1d-yX6tzV3x.js +1 -0
- package/dist/assets/plugins/slots/prompts.723d7748-B7zpPeoF.js +3 -0
- package/dist/assets/plugins/slots/read.46bf6536-Cw5Z5z5T.js +1 -0
- package/dist/assets/plugins/slots/runner.53e9bd76-CiQR_FPX.js +8 -0
- package/dist/assets/plugins/slots/skill.086701a4-CL6h_F-x.js +4 -0
- package/dist/assets/plugins/slots/vault.ac9935c8-DKERQYg4.js +1 -0
- package/dist/assets/plugins/slots/voice.e85ca7f9-DEgb-U9m.js +1 -0
- package/dist/assets/pwa/pwa.js +12 -12
- package/dist/assets/pwa/sw.js +4 -4
- package/dist/{atomicJson-BJfPFSYF.js → atomicJson-C_7F2zD1.js} +2 -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-B1mPDYlf.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-DQFmrosw.js} +5 -2
- package/dist/contracts-DD3f1Lpn.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/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-B0WMEXCP.js +34 -0
- package/dist/{remoteMcp-CMqZldeA.js → exports-D09VsUk-.js} +1153 -175
- package/dist/{exports-BNZz2DNU.js → exports-nV43ShA7.js} +25 -9
- package/dist/{extensionFile-CXOa5G4C.js → extensionFile-DNM4xsje.js} +26 -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/{domains-BNjGTOPj.js → harnessState-Dwrk3lfv.js} +175 -16
- package/dist/{harnessStore-BT706Ly6.js → harnessStore-Z7yDLO45.js} +4 -5
- package/dist/hash-Dt6RIbkn.js +16 -0
- package/dist/headers-CwtEVQvr.js +17 -0
- package/dist/help-w6vVEZGL.js +101 -0
- package/dist/hubChannel-Cm-sxOvU.js +21 -0
- package/dist/hubRevisions-58pU2dW5.js +363 -0
- package/dist/identity-BgfHobJH.js +165 -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-DyYmurS7.js +62 -0
- package/dist/index.edge-K0w5auwG.js +56 -0
- package/dist/index.edge-Xa5LLtxz.js +67 -0
- package/dist/iso-BPQViXM8.js +10 -0
- package/dist/{layeredConfig-DPQAnlXD.js → layeredConfig-CUkYUs1f.js} +193 -15
- package/dist/{majorModes-DbCfLZH3.js → majorModes-BB0PXgFn.js} +4 -14
- package/dist/majorModes-C7vtBs4D.js +1 -0
- package/dist/{mcpProjection-BsP0IEnb.js → mcpProjection-BtKzB6oK.js} +2 -2
- package/dist/migrations-5gbLIQIc.js +32 -0
- package/dist/mistral-conversations-CLwhVDjA.js +689 -0
- package/dist/modeDefinition-C3Zbrw48.js +44 -0
- package/dist/models-Chzm15vC.js +1511 -0
- package/dist/narration-CpRurWLO.js +127 -0
- package/dist/node-BT4GsJQp.js +2479 -0
- package/dist/node-DytJOfYf.js +23 -0
- package/dist/notification-kckG3leF.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/{hubChannel-BHQyzcOo.js → packageApi-t1oCjNDU.js} +4 -41
- package/dist/photon_rs_bg.wasm +0 -0
- package/dist/pi-messages-BXfrZLC7.js +312 -0
- package/dist/piConfig-DQzlbPY4.js +126 -0
- package/dist/piSettings-Cf1QofNe.js +1 -0
- package/dist/platform-BIEiM4TG.js +113 -0
- package/dist/pluginContributions-Be9EnCAW.js +16 -0
- package/dist/pluginProtocol-BqXXyI4z.js +80 -0
- package/dist/{protocol-Xpm_mCNN.js → protocol-DDL8geoS.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-AbXyhXlY.js +217 -0
- package/dist/server-B6dqQoh2.js +1518 -0
- package/dist/server-BIHo9TFu.js +505 -0
- package/dist/{server-BZh1ZXz_.js → server-BJ7DNzCp.js} +8 -19
- package/dist/server-BO-j_GbD.js +15106 -0
- package/dist/{server-D4W7EdJY.js → server-BQzAiMns.js} +16 -16
- package/dist/server-BR7SZtj7.js +3125 -0
- package/dist/{server-BE6VqEiA.js → server-BT2ORK83.js} +20 -12
- package/dist/server-BbSHYRnY.js +295 -0
- package/dist/server-BqoKlEGk.js +1806 -0
- package/dist/{server-tvgQ99rv.js → server-Busl0pQI.js} +370 -120
- package/dist/server-CIHM4jqu.js +1116 -0
- package/dist/server-CgWSSdvd.js +576 -0
- package/dist/{server-Dpgh8PDh.js → server-Co_UWKrR.js} +14 -5
- package/dist/{server-BAAL9-NA.js → server-CuEPb7u-.js} +3 -10
- package/dist/{server-Dt4y1rZD.js → server-D40q2Jpx.js} +47 -27
- package/dist/server-DCyf2Asb.js +679 -0
- package/dist/server-DH7PfLln.js +148 -0
- package/dist/server-DJ8bc89M.js +934 -0
- package/dist/server-DYdp0W9v.js +489 -0
- package/dist/server-DsdPEYGu.js +639 -0
- package/dist/server-DymH4Ucq.js +189 -0
- package/dist/server-IqECnUrb.js +834 -0
- package/dist/{server-36iuA3MI.js → server-KBgW77zh.js} +3 -3
- package/dist/server-RW_9R3R3.js +1522 -0
- package/dist/server-aUit8j6r.js +1028 -0
- package/dist/{server-DJAanjoI.js → server-gifRriZK.js} +491 -103
- package/dist/server-nkUlqnAL.js +2658 -0
- package/dist/server-oxyEbv1a.js +1256 -0
- package/dist/{server-D8ndq0wL.js → server-ub3s16Mc.js} +11 -9
- package/dist/{build-2gFaVEfG.js → serverPlugin-CELT6P0Q.js} +3946 -3
- package/dist/{sessionConfig-rBQgzXlT.js → sessionConfig-RQGvfm6E.js} +550 -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/{server-A-_GFpPr.js → type-ASYnCGVW.js} +10 -1031
- package/dist/typesafe-system-one-DGxeggJh.js +37 -0
- package/dist/uuid-B0QJx6Kr.js +31 -0
- package/dist/{validation-D77NZBrx.js → validation-BJxVSAwx.js} +8 -3
- package/dist/{value-Djvc2foV.js → value-_W31So3B.js} +1 -1
- package/dist/vaultSettings-Di3n5YIg.js +328 -0
- package/dist/voiceTools-RMn4HvWo.js +246 -0
- package/dist/web-DCP7ELJj.js +3 -0
- package/dist/worker.js +95288 -49863
- package/dist/workflow-B7qx0Vv9.js +79 -0
- package/package.json +37 -22
- package/wrangler.jsonc +4 -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/harnessState-gmzJcPGt.js +0 -88
- package/dist/harnessStore-BiH9vSuD.js +0 -1
- package/dist/index.edge-BgSx_gRO.js +0 -45
- package/dist/majorModes-BvWNqoHt.js +0 -1
- package/dist/piSettings-B6fsgIBA.js +0 -1
- package/dist/platform-B4AAgwJ0.js +0 -16
- package/dist/platformFiles-C_bXo4Ig.js +0 -39
- 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,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { Hn as BACKGROUND_CONTEXT, ar as defineServiceContract, hn as poHomeDirectory } from "./serverPlugin-CELT6P0Q.js";
|
|
2
|
+
import { s as readTextIfExists, u as writeFileAtomic } from "./platform-BIEiM4TG.js";
|
|
3
|
+
import "./piSettings-Cf1QofNe.js";
|
|
4
|
+
import { n as Check } from "./value-_W31So3B.js";
|
|
5
|
+
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";
|
|
6
|
+
import { n as datetime, t as date$1 } from "./iso-BPQViXM8.js";
|
|
7
|
+
import { r as PO_USER_MCP_CONFIG_FILE } from "./mcpProjection-BtKzB6oK.js";
|
|
8
|
+
import { a as assertRevision, i as assertEntryName, l as VAULT_ACCOUNT_OPERATIONS, n as VaultError, o as serializeValue } from "./vaultSettings-Di3n5YIg.js";
|
|
9
|
+
import { createHash } from "node:crypto";
|
|
10
|
+
import { join } from "node:path";
|
|
4
11
|
//#region ../../core/po-web-security/src/services/outboundHost/index.ts
|
|
5
12
|
/** Cloud metadata endpoints reachable by name. Their IP forms are refused as IP literals. */
|
|
6
13
|
const METADATA_HOSTS = /* @__PURE__ */ new Set([
|
|
@@ -94,69 +101,6 @@ function guardedFetch(options) {
|
|
|
94
101
|
};
|
|
95
102
|
}
|
|
96
103
|
//#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
104
|
//#region ../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/compat.js
|
|
161
105
|
/** @deprecated Use the raw string literal codes instead, e.g. "invalid_type". */
|
|
162
106
|
const ZodIssueCode = {
|
|
@@ -176,14 +120,6 @@ const ZodIssueCode = {
|
|
|
176
120
|
var ZodFirstPartyTypeKind;
|
|
177
121
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
178
122
|
//#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
123
|
//#region ../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/coerce.js
|
|
188
124
|
function string(params) {
|
|
189
125
|
return _coercedString(ZodString, params);
|
|
@@ -197,6 +133,7 @@ function boolean(params) {
|
|
|
197
133
|
//#endregion
|
|
198
134
|
//#region ../../../node_modules/.pnpm/@modelcontextprotocol+core@2.3.1/node_modules/@modelcontextprotocol/core/dist/auth-BNDyLTqp.mjs
|
|
199
135
|
const LATEST_PROTOCOL_VERSION = "2025-11-25";
|
|
136
|
+
const DEFAULT_NEGOTIATED_PROTOCOL_VERSION = "2025-03-26";
|
|
200
137
|
const SUPPORTED_PROTOCOL_VERSIONS = [
|
|
201
138
|
LATEST_PROTOCOL_VERSION,
|
|
202
139
|
"2025-06-18",
|
|
@@ -266,10 +203,10 @@ const JSONValueSchema = lazy(() => union([
|
|
|
266
203
|
number$1(),
|
|
267
204
|
boolean$1(),
|
|
268
205
|
_null(),
|
|
269
|
-
record$
|
|
206
|
+
record$2(string$1(), JSONValueSchema),
|
|
270
207
|
array(JSONValueSchema)
|
|
271
208
|
]));
|
|
272
|
-
const JSONObjectSchema = record$
|
|
209
|
+
const JSONObjectSchema = record$2(string$1(), JSONValueSchema);
|
|
273
210
|
const JSONArraySchema = array(JSONValueSchema);
|
|
274
211
|
/**
|
|
275
212
|
* A progress token, used to associate progress notifications with the original request.
|
|
@@ -457,7 +394,7 @@ const ServerTasksCapabilitySchema = looseObject({
|
|
|
457
394
|
* 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
395
|
*/
|
|
459
396
|
const ClientCapabilitiesSchema = object({
|
|
460
|
-
experimental: record$
|
|
397
|
+
experimental: record$2(string$1(), JSONObjectSchema).optional(),
|
|
461
398
|
sampling: object({
|
|
462
399
|
context: JSONObjectSchema.optional(),
|
|
463
400
|
tools: JSONObjectSchema.optional()
|
|
@@ -465,7 +402,7 @@ const ClientCapabilitiesSchema = object({
|
|
|
465
402
|
elicitation: ElicitationCapabilitySchema.optional(),
|
|
466
403
|
roots: object({ listChanged: boolean$1().optional() }).optional(),
|
|
467
404
|
tasks: ClientTasksCapabilitySchema.optional(),
|
|
468
|
-
extensions: record$
|
|
405
|
+
extensions: record$2(string$1(), JSONObjectSchema).optional()
|
|
469
406
|
});
|
|
470
407
|
const InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
471
408
|
protocolVersion: string$1(),
|
|
@@ -483,7 +420,7 @@ const InitializeRequestSchema = RequestSchema.extend({
|
|
|
483
420
|
* 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
421
|
*/
|
|
485
422
|
const ServerCapabilitiesSchema = object({
|
|
486
|
-
experimental: record$
|
|
423
|
+
experimental: record$2(string$1(), JSONObjectSchema).optional(),
|
|
487
424
|
logging: JSONObjectSchema.optional(),
|
|
488
425
|
completions: JSONObjectSchema.optional(),
|
|
489
426
|
prompts: object({ listChanged: boolean$1().optional() }).optional(),
|
|
@@ -493,7 +430,7 @@ const ServerCapabilitiesSchema = object({
|
|
|
493
430
|
}).optional(),
|
|
494
431
|
tools: object({ listChanged: boolean$1().optional() }).optional(),
|
|
495
432
|
tasks: ServerTasksCapabilitySchema.optional(),
|
|
496
|
-
extensions: record$
|
|
433
|
+
extensions: record$2(string$1(), JSONObjectSchema).optional()
|
|
497
434
|
});
|
|
498
435
|
/**
|
|
499
436
|
* After receiving an initialize request from the client, the server sends this response.
|
|
@@ -564,7 +501,7 @@ const PaginatedResultSchema = ResultSchema.extend({ nextCursor: CursorSchema.opt
|
|
|
564
501
|
const ResourceContentsSchema = object({
|
|
565
502
|
uri: string$1(),
|
|
566
503
|
mimeType: optional(string$1()),
|
|
567
|
-
_meta: record$
|
|
504
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
568
505
|
});
|
|
569
506
|
const TextResourceContentsSchema = ResourceContentsSchema.extend({ text: string$1() });
|
|
570
507
|
/**
|
|
@@ -762,7 +699,7 @@ const ListPromptsResultSchema = PaginatedResultSchema.extend({ prompts: array(Pr
|
|
|
762
699
|
*/
|
|
763
700
|
const GetPromptRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
764
701
|
name: string$1(),
|
|
765
|
-
arguments: record$
|
|
702
|
+
arguments: record$2(string$1(), string$1()).optional()
|
|
766
703
|
});
|
|
767
704
|
/**
|
|
768
705
|
* Used by the client to get a prompt provided by the server.
|
|
@@ -778,7 +715,7 @@ const TextContentSchema = object({
|
|
|
778
715
|
type: literal("text"),
|
|
779
716
|
text: string$1(),
|
|
780
717
|
annotations: AnnotationsSchema.optional(),
|
|
781
|
-
_meta: record$
|
|
718
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
782
719
|
});
|
|
783
720
|
/**
|
|
784
721
|
* An image provided to or from an LLM.
|
|
@@ -788,7 +725,7 @@ const ImageContentSchema = object({
|
|
|
788
725
|
data: Base64Schema,
|
|
789
726
|
mimeType: string$1(),
|
|
790
727
|
annotations: AnnotationsSchema.optional(),
|
|
791
|
-
_meta: record$
|
|
728
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
792
729
|
});
|
|
793
730
|
/**
|
|
794
731
|
* Audio content provided to or from an LLM.
|
|
@@ -798,7 +735,7 @@ const AudioContentSchema = object({
|
|
|
798
735
|
data: Base64Schema,
|
|
799
736
|
mimeType: string$1(),
|
|
800
737
|
annotations: AnnotationsSchema.optional(),
|
|
801
|
-
_meta: record$
|
|
738
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
802
739
|
});
|
|
803
740
|
/**
|
|
804
741
|
* A tool call request from an assistant (LLM).
|
|
@@ -812,8 +749,8 @@ const ToolUseContentSchema = object({
|
|
|
812
749
|
type: literal("tool_use"),
|
|
813
750
|
name: string$1(),
|
|
814
751
|
id: string$1(),
|
|
815
|
-
input: record$
|
|
816
|
-
_meta: record$
|
|
752
|
+
input: record$2(string$1(), unknown()),
|
|
753
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
817
754
|
});
|
|
818
755
|
/**
|
|
819
756
|
* The contents of a resource, embedded into a prompt or tool call result.
|
|
@@ -822,7 +759,7 @@ const EmbeddedResourceSchema = object({
|
|
|
822
759
|
type: literal("resource"),
|
|
823
760
|
resource: union([TextResourceContentsSchema, BlobResourceContentsSchema]),
|
|
824
761
|
annotations: AnnotationsSchema.optional(),
|
|
825
|
-
_meta: record$
|
|
762
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
826
763
|
});
|
|
827
764
|
/**
|
|
828
765
|
* A resource that the server is capable of reading, included in a prompt or tool call result.
|
|
@@ -895,13 +832,13 @@ const ToolSchema = object({
|
|
|
895
832
|
description: string$1().optional(),
|
|
896
833
|
inputSchema: object({
|
|
897
834
|
type: literal("object"),
|
|
898
|
-
properties: record$
|
|
835
|
+
properties: record$2(string$1(), JSONValueSchema).optional(),
|
|
899
836
|
required: array(string$1()).optional()
|
|
900
837
|
}).catchall(unknown()),
|
|
901
838
|
outputSchema: looseObject({ $schema: string$1().optional() }).optional(),
|
|
902
839
|
annotations: ToolAnnotationsSchema.optional(),
|
|
903
840
|
execution: ToolExecutionSchema.optional(),
|
|
904
|
-
_meta: record$
|
|
841
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
905
842
|
});
|
|
906
843
|
/**
|
|
907
844
|
* Sent from the client to request a list of tools the server has.
|
|
@@ -928,7 +865,7 @@ const CompatibilityCallToolResultSchema = CallToolResultSchema.or(ResultSchema.e
|
|
|
928
865
|
*/
|
|
929
866
|
const CallToolRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({
|
|
930
867
|
name: string$1(),
|
|
931
|
-
arguments: record$
|
|
868
|
+
arguments: record$2(string$1(), unknown()).optional()
|
|
932
869
|
});
|
|
933
870
|
/**
|
|
934
871
|
* Used by the client to invoke a tool provided by the server.
|
|
@@ -1058,7 +995,7 @@ const ToolResultContentSchema = object({
|
|
|
1058
995
|
content: array(ContentBlockSchema),
|
|
1059
996
|
structuredContent: unknown().optional(),
|
|
1060
997
|
isError: boolean$1().optional(),
|
|
1061
|
-
_meta: record$
|
|
998
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
1062
999
|
});
|
|
1063
1000
|
/**
|
|
1064
1001
|
* Basic content types for sampling responses (without tool use).
|
|
@@ -1098,7 +1035,7 @@ const SamplingMessageContentBlockSchema = discriminatedUnion("type", [
|
|
|
1098
1035
|
const SamplingMessageSchema = object({
|
|
1099
1036
|
role: RoleSchema,
|
|
1100
1037
|
content: union([SamplingMessageContentBlockSchema, array(SamplingMessageContentBlockSchema)]),
|
|
1101
|
-
_meta: record$
|
|
1038
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
1102
1039
|
});
|
|
1103
1040
|
/**
|
|
1104
1041
|
* Parameters for a `sampling/createMessage` request.
|
|
@@ -1304,7 +1241,7 @@ const ElicitRequestFormParamsSchema = TaskAugmentedRequestParamsSchema.extend({
|
|
|
1304
1241
|
message: string$1(),
|
|
1305
1242
|
requestedSchema: object({
|
|
1306
1243
|
type: literal("object"),
|
|
1307
|
-
properties: record$
|
|
1244
|
+
properties: record$2(string$1(), PrimitiveSchemaDefinitionSchema),
|
|
1308
1245
|
required: array(string$1()).optional()
|
|
1309
1246
|
}).catchall(unknown())
|
|
1310
1247
|
});
|
|
@@ -1362,7 +1299,7 @@ const ElicitResultSchema = ResultSchema.extend({
|
|
|
1362
1299
|
"decline",
|
|
1363
1300
|
"cancel"
|
|
1364
1301
|
]),
|
|
1365
|
-
content: preprocess((val) => val === null ? void 0 : val, record$
|
|
1302
|
+
content: preprocess((val) => val === null ? void 0 : val, record$2(string$1(), union([
|
|
1366
1303
|
string$1(),
|
|
1367
1304
|
number$1(),
|
|
1368
1305
|
boolean$1(),
|
|
@@ -1392,7 +1329,7 @@ const CompleteRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
|
1392
1329
|
name: string$1(),
|
|
1393
1330
|
value: string$1()
|
|
1394
1331
|
}),
|
|
1395
|
-
context: object({ arguments: record$
|
|
1332
|
+
context: object({ arguments: record$2(string$1(), string$1()).optional() }).optional()
|
|
1396
1333
|
});
|
|
1397
1334
|
/**
|
|
1398
1335
|
* A request from the client to the server, to ask for completion options.
|
|
@@ -1419,7 +1356,7 @@ const CompleteResultSchema = ResultSchema.extend({ completion: looseObject({
|
|
|
1419
1356
|
const RootSchema = object({
|
|
1420
1357
|
uri: string$1().startsWith("file://"),
|
|
1421
1358
|
name: string$1().optional(),
|
|
1422
|
-
_meta: record$
|
|
1359
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
1423
1360
|
});
|
|
1424
1361
|
/**
|
|
1425
1362
|
* Sent from the server to request a list of root URIs from the client.
|
|
@@ -1831,6 +1768,69 @@ const OAuthTokenRevocationRequestSchema = object({
|
|
|
1831
1768
|
token_type_hint: string$1().optional()
|
|
1832
1769
|
}).strip();
|
|
1833
1770
|
//#endregion
|
|
1771
|
+
//#region ../../../node_modules/.pnpm/@modelcontextprotocol+client@2.3.1/node_modules/@modelcontextprotocol/client/dist/chunk-Br0eD_fh.mjs
|
|
1772
|
+
var __create = Object.create;
|
|
1773
|
+
var __defProp = Object.defineProperty;
|
|
1774
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
1775
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
1776
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
1777
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1778
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
1779
|
+
var __exportAll = (all, symbols) => {
|
|
1780
|
+
let target = {};
|
|
1781
|
+
for (var name in all) __defProp(target, name, {
|
|
1782
|
+
get: all[name],
|
|
1783
|
+
enumerable: true
|
|
1784
|
+
});
|
|
1785
|
+
if (symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
1786
|
+
return target;
|
|
1787
|
+
};
|
|
1788
|
+
var __copyProps = (to, from, except, desc) => {
|
|
1789
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
1790
|
+
key = keys[i];
|
|
1791
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
1792
|
+
get: ((k) => from[k]).bind(null, key),
|
|
1793
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
1794
|
+
});
|
|
1795
|
+
}
|
|
1796
|
+
return to;
|
|
1797
|
+
};
|
|
1798
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
1799
|
+
value: mod,
|
|
1800
|
+
enumerable: true
|
|
1801
|
+
}) : target, mod));
|
|
1802
|
+
//#endregion
|
|
1803
|
+
//#region ../../../node_modules/.pnpm/@modelcontextprotocol+client@2.3.1/node_modules/@modelcontextprotocol/client/dist/dialects-BOhdv1Fc.mjs
|
|
1804
|
+
/**
|
|
1805
|
+
* Canonical `$schema` URIs per supported dialect (http + https variants, trailing-`#` stripped).
|
|
1806
|
+
*/
|
|
1807
|
+
const DRAFT_2020_12_URIS = /* @__PURE__ */ new Set(["https://json-schema.org/draft/2020-12/schema", "http://json-schema.org/draft/2020-12/schema"]);
|
|
1808
|
+
const DRAFT_2019_09_URIS = /* @__PURE__ */ new Set(["https://json-schema.org/draft/2019-09/schema", "http://json-schema.org/draft/2019-09/schema"]);
|
|
1809
|
+
const DRAFT_07_URIS = /* @__PURE__ */ new Set(["https://json-schema.org/draft-07/schema", "http://json-schema.org/draft-07/schema"]);
|
|
1810
|
+
const DRAFT_06_URIS = /* @__PURE__ */ new Set(["https://json-schema.org/draft-06/schema", "http://json-schema.org/draft-06/schema"]);
|
|
1811
|
+
/**
|
|
1812
|
+
* Whether a `$schema` value declares the 2019-09 dialect — the only supported dialect with
|
|
1813
|
+
* `$recursiveRef`/`$recursiveAnchor`. Non-throwing (unlike {@linkcode declaredDialect}) so
|
|
1814
|
+
* wire-layer callers can consult it for documents whose dialect may be unsupported.
|
|
1815
|
+
*/
|
|
1816
|
+
function declares2019Dialect($schema) {
|
|
1817
|
+
return typeof $schema === "string" && DRAFT_2019_09_URIS.has($schema.replace(/#$/, ""));
|
|
1818
|
+
}
|
|
1819
|
+
/**
|
|
1820
|
+
* Classify a schema's declared `$schema` dialect. No `$schema` (or a non-string one) means
|
|
1821
|
+
* 2020-12. Any other dialect throws a plain `Error` with a clear message rather than letting the
|
|
1822
|
+
* engine crash on an opaque internal error or silently mis-validate; `remedy` names the calling
|
|
1823
|
+
* provider's escape hatch in that message.
|
|
1824
|
+
*/
|
|
1825
|
+
function declaredDialect(schema, remedy) {
|
|
1826
|
+
if (!("$schema" in schema) || typeof schema.$schema !== "string") return "2020-12";
|
|
1827
|
+
const declared = schema.$schema.replace(/#$/, "");
|
|
1828
|
+
if (DRAFT_2020_12_URIS.has(declared)) return "2020-12";
|
|
1829
|
+
if (DRAFT_2019_09_URIS.has(declared)) return "2019-09";
|
|
1830
|
+
if (DRAFT_07_URIS.has(declared) || DRAFT_06_URIS.has(declared)) return "draft-7";
|
|
1831
|
+
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}`);
|
|
1832
|
+
}
|
|
1833
|
+
//#endregion
|
|
1834
1834
|
//#region ../../../node_modules/.pnpm/@modelcontextprotocol+client@2.3.1/node_modules/@modelcontextprotocol/client/dist/src-WCy6ifGf.mjs
|
|
1835
1835
|
/**
|
|
1836
1836
|
* Cross-bundle `instanceof` support for the SDK error classes.
|
|
@@ -2387,10 +2387,10 @@ function build$1() {
|
|
|
2387
2387
|
number$1(),
|
|
2388
2388
|
boolean$1(),
|
|
2389
2389
|
_null(),
|
|
2390
|
-
record$
|
|
2390
|
+
record$2(string$1(), JSONValueSchema$1),
|
|
2391
2391
|
array(JSONValueSchema$1)
|
|
2392
2392
|
]));
|
|
2393
|
-
const JSONObjectSchema$1 = record$
|
|
2393
|
+
const JSONObjectSchema$1 = record$2(string$1(), JSONValueSchema$1);
|
|
2394
2394
|
/**
|
|
2395
2395
|
* A progress token, used to associate progress notifications with the original request.
|
|
2396
2396
|
*/
|
|
@@ -2523,7 +2523,7 @@ function build$1() {
|
|
|
2523
2523
|
* 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
2524
|
*/
|
|
2525
2525
|
const ClientCapabilitiesSchema$1 = object({
|
|
2526
|
-
experimental: record$
|
|
2526
|
+
experimental: record$2(string$1(), JSONObjectSchema$1).optional(),
|
|
2527
2527
|
sampling: object({
|
|
2528
2528
|
context: JSONObjectSchema$1.optional(),
|
|
2529
2529
|
tools: JSONObjectSchema$1.optional()
|
|
@@ -2531,7 +2531,7 @@ function build$1() {
|
|
|
2531
2531
|
elicitation: ElicitationCapabilitySchema.optional(),
|
|
2532
2532
|
roots: object({ listChanged: boolean$1().optional() }).optional(),
|
|
2533
2533
|
tasks: ClientTasksCapabilitySchema$1.optional(),
|
|
2534
|
-
extensions: record$
|
|
2534
|
+
extensions: record$2(string$1(), JSONObjectSchema$1).optional()
|
|
2535
2535
|
});
|
|
2536
2536
|
const InitializeRequestParamsSchema$1 = BaseRequestParamsSchema$1.extend({
|
|
2537
2537
|
protocolVersion: string$1(),
|
|
@@ -2549,7 +2549,7 @@ function build$1() {
|
|
|
2549
2549
|
* 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
2550
|
*/
|
|
2551
2551
|
const ServerCapabilitiesSchema$1 = object({
|
|
2552
|
-
experimental: record$
|
|
2552
|
+
experimental: record$2(string$1(), JSONObjectSchema$1).optional(),
|
|
2553
2553
|
logging: JSONObjectSchema$1.optional(),
|
|
2554
2554
|
completions: JSONObjectSchema$1.optional(),
|
|
2555
2555
|
prompts: object({ listChanged: boolean$1().optional() }).optional(),
|
|
@@ -2559,7 +2559,7 @@ function build$1() {
|
|
|
2559
2559
|
}).optional(),
|
|
2560
2560
|
tools: object({ listChanged: boolean$1().optional() }).optional(),
|
|
2561
2561
|
tasks: ServerTasksCapabilitySchema$1.optional(),
|
|
2562
|
-
extensions: record$
|
|
2562
|
+
extensions: record$2(string$1(), JSONObjectSchema$1).optional()
|
|
2563
2563
|
});
|
|
2564
2564
|
/**
|
|
2565
2565
|
* After receiving an initialize request from the client, the server sends this response.
|
|
@@ -2612,7 +2612,7 @@ function build$1() {
|
|
|
2612
2612
|
const ResourceContentsSchema$1 = object({
|
|
2613
2613
|
uri: string$1(),
|
|
2614
2614
|
mimeType: optional(string$1()),
|
|
2615
|
-
_meta: record$
|
|
2615
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
2616
2616
|
});
|
|
2617
2617
|
const TextResourceContentsSchema$1 = ResourceContentsSchema$1.extend({ text: string$1() });
|
|
2618
2618
|
/**
|
|
@@ -2763,7 +2763,7 @@ function build$1() {
|
|
|
2763
2763
|
*/
|
|
2764
2764
|
const GetPromptRequestParamsSchema$1 = BaseRequestParamsSchema$1.extend({
|
|
2765
2765
|
name: string$1(),
|
|
2766
|
-
arguments: record$
|
|
2766
|
+
arguments: record$2(string$1(), string$1()).optional()
|
|
2767
2767
|
});
|
|
2768
2768
|
/**
|
|
2769
2769
|
* Used by the client to get a prompt provided by the server.
|
|
@@ -2779,7 +2779,7 @@ function build$1() {
|
|
|
2779
2779
|
type: literal("text"),
|
|
2780
2780
|
text: string$1(),
|
|
2781
2781
|
annotations: AnnotationsSchema$1.optional(),
|
|
2782
|
-
_meta: record$
|
|
2782
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
2783
2783
|
});
|
|
2784
2784
|
/**
|
|
2785
2785
|
* An image provided to or from an LLM.
|
|
@@ -2789,7 +2789,7 @@ function build$1() {
|
|
|
2789
2789
|
data: Base64Schema,
|
|
2790
2790
|
mimeType: string$1(),
|
|
2791
2791
|
annotations: AnnotationsSchema$1.optional(),
|
|
2792
|
-
_meta: record$
|
|
2792
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
2793
2793
|
});
|
|
2794
2794
|
/**
|
|
2795
2795
|
* Audio content provided to or from an LLM.
|
|
@@ -2799,7 +2799,7 @@ function build$1() {
|
|
|
2799
2799
|
data: Base64Schema,
|
|
2800
2800
|
mimeType: string$1(),
|
|
2801
2801
|
annotations: AnnotationsSchema$1.optional(),
|
|
2802
|
-
_meta: record$
|
|
2802
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
2803
2803
|
});
|
|
2804
2804
|
/**
|
|
2805
2805
|
* A tool call request from an assistant (LLM).
|
|
@@ -2813,8 +2813,8 @@ function build$1() {
|
|
|
2813
2813
|
type: literal("tool_use"),
|
|
2814
2814
|
name: string$1(),
|
|
2815
2815
|
id: string$1(),
|
|
2816
|
-
input: record$
|
|
2817
|
-
_meta: record$
|
|
2816
|
+
input: record$2(string$1(), unknown()),
|
|
2817
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
2818
2818
|
});
|
|
2819
2819
|
/**
|
|
2820
2820
|
* The contents of a resource, embedded into a prompt or tool call result.
|
|
@@ -2823,7 +2823,7 @@ function build$1() {
|
|
|
2823
2823
|
type: literal("resource"),
|
|
2824
2824
|
resource: union([TextResourceContentsSchema$1, BlobResourceContentsSchema$1]),
|
|
2825
2825
|
annotations: AnnotationsSchema$1.optional(),
|
|
2826
|
-
_meta: record$
|
|
2826
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
2827
2827
|
});
|
|
2828
2828
|
/**
|
|
2829
2829
|
* A resource that the server is capable of reading, included in a prompt or tool call result.
|
|
@@ -2896,17 +2896,17 @@ function build$1() {
|
|
|
2896
2896
|
description: string$1().optional(),
|
|
2897
2897
|
inputSchema: object({
|
|
2898
2898
|
type: literal("object"),
|
|
2899
|
-
properties: record$
|
|
2899
|
+
properties: record$2(string$1(), JSONValueSchema$1).optional(),
|
|
2900
2900
|
required: array(string$1()).optional()
|
|
2901
2901
|
}).catchall(unknown()),
|
|
2902
2902
|
outputSchema: object({
|
|
2903
2903
|
type: literal("object"),
|
|
2904
|
-
properties: record$
|
|
2904
|
+
properties: record$2(string$1(), JSONValueSchema$1).optional(),
|
|
2905
2905
|
required: array(string$1()).optional()
|
|
2906
2906
|
}).catchall(unknown()).optional(),
|
|
2907
2907
|
annotations: ToolAnnotationsSchema$1.optional(),
|
|
2908
2908
|
execution: ToolExecutionSchema$1.optional(),
|
|
2909
|
-
_meta: record$
|
|
2909
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
2910
2910
|
});
|
|
2911
2911
|
/**
|
|
2912
2912
|
* Sent from the client to request a list of tools the server has.
|
|
@@ -2921,7 +2921,7 @@ function build$1() {
|
|
|
2921
2921
|
*/
|
|
2922
2922
|
const CallToolResultSchema$1 = ResultSchema$1.extend({
|
|
2923
2923
|
content: array(ContentBlockSchema$1),
|
|
2924
|
-
structuredContent: record$
|
|
2924
|
+
structuredContent: record$2(string$1(), unknown()).optional(),
|
|
2925
2925
|
isError: boolean$1().optional()
|
|
2926
2926
|
});
|
|
2927
2927
|
/**
|
|
@@ -2929,7 +2929,7 @@ function build$1() {
|
|
|
2929
2929
|
*/
|
|
2930
2930
|
const CallToolRequestParamsSchema$1 = TaskAugmentedRequestParamsSchema$1.extend({
|
|
2931
2931
|
name: string$1(),
|
|
2932
|
-
arguments: record$
|
|
2932
|
+
arguments: record$2(string$1(), unknown()).optional()
|
|
2933
2933
|
});
|
|
2934
2934
|
/**
|
|
2935
2935
|
* Used by the client to invoke a tool provided by the server.
|
|
@@ -3051,7 +3051,7 @@ function build$1() {
|
|
|
3051
3051
|
content: array(ContentBlockSchema$1),
|
|
3052
3052
|
structuredContent: object({}).loose().optional(),
|
|
3053
3053
|
isError: boolean$1().optional(),
|
|
3054
|
-
_meta: record$
|
|
3054
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
3055
3055
|
});
|
|
3056
3056
|
/**
|
|
3057
3057
|
* Basic content types for sampling responses (without tool use).
|
|
@@ -3091,7 +3091,7 @@ function build$1() {
|
|
|
3091
3091
|
const SamplingMessageSchema$1 = object({
|
|
3092
3092
|
role: RoleSchema$1,
|
|
3093
3093
|
content: union([SamplingMessageContentBlockSchema$1, array(SamplingMessageContentBlockSchema$1)]),
|
|
3094
|
-
_meta: record$
|
|
3094
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
3095
3095
|
});
|
|
3096
3096
|
/**
|
|
3097
3097
|
* Parameters for a `sampling/createMessage` request.
|
|
@@ -3297,7 +3297,7 @@ function build$1() {
|
|
|
3297
3297
|
message: string$1(),
|
|
3298
3298
|
requestedSchema: object({
|
|
3299
3299
|
type: literal("object"),
|
|
3300
|
-
properties: record$
|
|
3300
|
+
properties: record$2(string$1(), PrimitiveSchemaDefinitionSchema$1),
|
|
3301
3301
|
required: array(string$1()).optional()
|
|
3302
3302
|
}).catchall(unknown())
|
|
3303
3303
|
});
|
|
@@ -3347,7 +3347,7 @@ function build$1() {
|
|
|
3347
3347
|
"decline",
|
|
3348
3348
|
"cancel"
|
|
3349
3349
|
]),
|
|
3350
|
-
content: preprocess((val) => val === null ? void 0 : val, record$
|
|
3350
|
+
content: preprocess((val) => val === null ? void 0 : val, record$2(string$1(), union([
|
|
3351
3351
|
string$1(),
|
|
3352
3352
|
number$1(),
|
|
3353
3353
|
boolean$1(),
|
|
@@ -3377,7 +3377,7 @@ function build$1() {
|
|
|
3377
3377
|
name: string$1(),
|
|
3378
3378
|
value: string$1()
|
|
3379
3379
|
}),
|
|
3380
|
-
context: object({ arguments: record$
|
|
3380
|
+
context: object({ arguments: record$2(string$1(), string$1()).optional() }).optional()
|
|
3381
3381
|
});
|
|
3382
3382
|
/**
|
|
3383
3383
|
* A request from the client to the server, to ask for completion options.
|
|
@@ -3404,7 +3404,7 @@ function build$1() {
|
|
|
3404
3404
|
const RootSchema$1 = object({
|
|
3405
3405
|
uri: string$1().startsWith("file://"),
|
|
3406
3406
|
name: string$1().optional(),
|
|
3407
|
-
_meta: record$
|
|
3407
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
3408
3408
|
});
|
|
3409
3409
|
/**
|
|
3410
3410
|
* Sent from the server to request a list of root URIs from the client.
|
|
@@ -4168,10 +4168,10 @@ function build() {
|
|
|
4168
4168
|
number$1(),
|
|
4169
4169
|
boolean$1(),
|
|
4170
4170
|
_null(),
|
|
4171
|
-
record$
|
|
4171
|
+
record$2(string$1(), JSONValueSchema$1),
|
|
4172
4172
|
array(JSONValueSchema$1)
|
|
4173
4173
|
]));
|
|
4174
|
-
const JSONObjectSchema$1 = record$
|
|
4174
|
+
const JSONObjectSchema$1 = record$2(string$1(), JSONValueSchema$1);
|
|
4175
4175
|
/**
|
|
4176
4176
|
* A progress token, used to associate progress notifications with the original request.
|
|
4177
4177
|
*/
|
|
@@ -4272,7 +4272,7 @@ function build() {
|
|
|
4272
4272
|
requests: looseObject({ tools: looseObject({ call: JSONObjectSchema$1.optional() }).optional() }).optional()
|
|
4273
4273
|
});
|
|
4274
4274
|
const ClientCapabilitiesSchema$1 = object({
|
|
4275
|
-
experimental: record$
|
|
4275
|
+
experimental: record$2(string$1(), JSONObjectSchema$1).optional(),
|
|
4276
4276
|
sampling: object({
|
|
4277
4277
|
context: JSONObjectSchema$1.optional(),
|
|
4278
4278
|
tools: JSONObjectSchema$1.optional()
|
|
@@ -4280,10 +4280,10 @@ function build() {
|
|
|
4280
4280
|
elicitation: ElicitationCapabilitySchema.optional(),
|
|
4281
4281
|
roots: object({ listChanged: boolean$1().optional() }).optional(),
|
|
4282
4282
|
tasks: ClientTasksCapabilitySchema$1.optional(),
|
|
4283
|
-
extensions: record$
|
|
4283
|
+
extensions: record$2(string$1(), JSONObjectSchema$1).optional()
|
|
4284
4284
|
});
|
|
4285
4285
|
const ServerCapabilitiesSchema$1 = object({
|
|
4286
|
-
experimental: record$
|
|
4286
|
+
experimental: record$2(string$1(), JSONObjectSchema$1).optional(),
|
|
4287
4287
|
logging: JSONObjectSchema$1.optional(),
|
|
4288
4288
|
completions: JSONObjectSchema$1.optional(),
|
|
4289
4289
|
prompts: object({ listChanged: boolean$1().optional() }).optional(),
|
|
@@ -4293,7 +4293,7 @@ function build() {
|
|
|
4293
4293
|
}).optional(),
|
|
4294
4294
|
tools: object({ listChanged: boolean$1().optional() }).optional(),
|
|
4295
4295
|
tasks: ServerTasksCapabilitySchema$1.optional(),
|
|
4296
|
-
extensions: record$
|
|
4296
|
+
extensions: record$2(string$1(), JSONObjectSchema$1).optional()
|
|
4297
4297
|
});
|
|
4298
4298
|
const ProgressSchema$1 = object({
|
|
4299
4299
|
progress: number$1(),
|
|
@@ -4321,7 +4321,7 @@ function build() {
|
|
|
4321
4321
|
const ResourceContentsSchema$1 = object({
|
|
4322
4322
|
uri: string$1(),
|
|
4323
4323
|
mimeType: optional(string$1()),
|
|
4324
|
-
_meta: record$
|
|
4324
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
4325
4325
|
});
|
|
4326
4326
|
const TextResourceContentsSchema$1 = ResourceContentsSchema$1.extend({ text: string$1() });
|
|
4327
4327
|
const BlobResourceContentsSchema$1 = ResourceContentsSchema$1.extend({ blob: Base64Schema });
|
|
@@ -4378,34 +4378,34 @@ function build() {
|
|
|
4378
4378
|
type: literal("text"),
|
|
4379
4379
|
text: string$1(),
|
|
4380
4380
|
annotations: AnnotationsSchema$1.optional(),
|
|
4381
|
-
_meta: record$
|
|
4381
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
4382
4382
|
});
|
|
4383
4383
|
const ImageContentSchema$1 = object({
|
|
4384
4384
|
type: literal("image"),
|
|
4385
4385
|
data: Base64Schema,
|
|
4386
4386
|
mimeType: string$1(),
|
|
4387
4387
|
annotations: AnnotationsSchema$1.optional(),
|
|
4388
|
-
_meta: record$
|
|
4388
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
4389
4389
|
});
|
|
4390
4390
|
const AudioContentSchema$1 = object({
|
|
4391
4391
|
type: literal("audio"),
|
|
4392
4392
|
data: Base64Schema,
|
|
4393
4393
|
mimeType: string$1(),
|
|
4394
4394
|
annotations: AnnotationsSchema$1.optional(),
|
|
4395
|
-
_meta: record$
|
|
4395
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
4396
4396
|
});
|
|
4397
4397
|
const ToolUseContentSchema$1 = object({
|
|
4398
4398
|
type: literal("tool_use"),
|
|
4399
4399
|
name: string$1(),
|
|
4400
4400
|
id: string$1(),
|
|
4401
|
-
input: record$
|
|
4402
|
-
_meta: record$
|
|
4401
|
+
input: record$2(string$1(), unknown()),
|
|
4402
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
4403
4403
|
});
|
|
4404
4404
|
const EmbeddedResourceSchema$1 = object({
|
|
4405
4405
|
type: literal("resource"),
|
|
4406
4406
|
resource: union([TextResourceContentsSchema$1, BlobResourceContentsSchema$1]),
|
|
4407
4407
|
annotations: AnnotationsSchema$1.optional(),
|
|
4408
|
-
_meta: record$
|
|
4408
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
4409
4409
|
});
|
|
4410
4410
|
const ResourceLinkSchema$1 = ResourceSchema$1.extend({ type: literal("resource_link") });
|
|
4411
4411
|
const ContentBlockSchema$1 = union([
|
|
@@ -4537,7 +4537,7 @@ function build() {
|
|
|
4537
4537
|
message: string$1(),
|
|
4538
4538
|
requestedSchema: object({
|
|
4539
4539
|
type: literal("object"),
|
|
4540
|
-
properties: record$
|
|
4540
|
+
properties: record$2(string$1(), PrimitiveSchemaDefinitionSchema$1),
|
|
4541
4541
|
required: array(string$1()).optional()
|
|
4542
4542
|
}).catchall(unknown())
|
|
4543
4543
|
});
|
|
@@ -4552,7 +4552,7 @@ function build() {
|
|
|
4552
4552
|
const RootSchema$1 = object({
|
|
4553
4553
|
uri: string$1().startsWith("file://"),
|
|
4554
4554
|
name: string$1().optional(),
|
|
4555
|
-
_meta: record$
|
|
4555
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
4556
4556
|
});
|
|
4557
4557
|
const sharedClientCapabilityShape = ClientCapabilitiesSchema$1.shape;
|
|
4558
4558
|
const ClientCapabilities2026Schema = object({
|
|
@@ -4601,7 +4601,7 @@ function build() {
|
|
|
4601
4601
|
}),
|
|
4602
4602
|
outputSchema: looseObject({ $schema: string$1().optional() }).optional(),
|
|
4603
4603
|
annotations: ToolAnnotationsSchema$1.optional(),
|
|
4604
|
-
_meta: record$
|
|
4604
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
4605
4605
|
});
|
|
4606
4606
|
/** 2026-era ToolResultContent (anchor-exact: `structuredContent?: unknown`). */
|
|
4607
4607
|
const ToolResultContentSchema$1 = object({
|
|
@@ -4610,7 +4610,7 @@ function build() {
|
|
|
4610
4610
|
content: array(ContentBlockSchema$1),
|
|
4611
4611
|
structuredContent: unknown().optional(),
|
|
4612
4612
|
isError: boolean$1().optional(),
|
|
4613
|
-
_meta: record$
|
|
4613
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
4614
4614
|
});
|
|
4615
4615
|
/** 2026-era sampling content union (composes the forked tool-result shape). */
|
|
4616
4616
|
const SamplingMessageContentBlockSchema$1 = union([
|
|
@@ -4624,7 +4624,7 @@ function build() {
|
|
|
4624
4624
|
const SamplingMessageSchema$1 = object({
|
|
4625
4625
|
role: RoleSchema$1,
|
|
4626
4626
|
content: union([SamplingMessageContentBlockSchema$1, array(SamplingMessageContentBlockSchema$1)]),
|
|
4627
|
-
_meta: record$
|
|
4627
|
+
_meta: record$2(string$1(), unknown()).optional()
|
|
4628
4628
|
});
|
|
4629
4629
|
/** Open union per the anchor: 'complete' | 'input_required' | string. */
|
|
4630
4630
|
const ResultTypeSchema = string$1();
|
|
@@ -4728,7 +4728,7 @@ function build() {
|
|
|
4728
4728
|
*/
|
|
4729
4729
|
const ListRootsRequestSchema$1 = object({
|
|
4730
4730
|
method: literal("roots/list"),
|
|
4731
|
-
params: object({ _meta: record$
|
|
4731
|
+
params: object({ _meta: record$2(string$1(), unknown()).optional() }).optional()
|
|
4732
4732
|
});
|
|
4733
4733
|
/** 2026-era embedded sampling response (anchor-exact: extends the forked SamplingMessage). */
|
|
4734
4734
|
const CreateMessageResultSchema$1 = object({
|
|
@@ -4745,7 +4745,7 @@ function build() {
|
|
|
4745
4745
|
"decline",
|
|
4746
4746
|
"cancel"
|
|
4747
4747
|
]),
|
|
4748
|
-
content: record$
|
|
4748
|
+
content: record$2(string$1(), union([
|
|
4749
4749
|
string$1(),
|
|
4750
4750
|
number$1(),
|
|
4751
4751
|
boolean$1(),
|
|
@@ -4783,9 +4783,9 @@ function build() {
|
|
|
4783
4783
|
ElicitResultSchema$1
|
|
4784
4784
|
]);
|
|
4785
4785
|
/** Map of embedded input requests, keyed by server-assigned identifiers. */
|
|
4786
|
-
const InputRequestsSchema = record$
|
|
4786
|
+
const InputRequestsSchema = record$2(string$1(), InputRequestSchema);
|
|
4787
4787
|
/** Map of embedded input responses, keyed by the corresponding request identifiers. */
|
|
4788
|
-
const InputResponsesSchema = record$
|
|
4788
|
+
const InputResponsesSchema = record$2(string$1(), InputResponseSchema);
|
|
4789
4789
|
/**
|
|
4790
4790
|
* The wire InputRequiredResult: `resultType: 'input_required'` plus at least
|
|
4791
4791
|
* one of `inputRequests` / `requestState` (the at-least-one rule is enforced
|
|
@@ -4827,7 +4827,7 @@ function build() {
|
|
|
4827
4827
|
}
|
|
4828
4828
|
const callToolParamsShape = {
|
|
4829
4829
|
name: string$1(),
|
|
4830
|
-
arguments: record$
|
|
4830
|
+
arguments: record$2(string$1(), unknown()).optional(),
|
|
4831
4831
|
...retryParamsShape
|
|
4832
4832
|
};
|
|
4833
4833
|
const paginatedParamsShape = { cursor: CursorSchema$1.optional() };
|
|
@@ -4836,7 +4836,7 @@ function build() {
|
|
|
4836
4836
|
const ListPromptsRequestSchema$1 = wireRequest("prompts/list", paginatedParamsShape);
|
|
4837
4837
|
const GetPromptRequestSchema$1 = wireRequest("prompts/get", {
|
|
4838
4838
|
name: string$1(),
|
|
4839
|
-
arguments: record$
|
|
4839
|
+
arguments: record$2(string$1(), string$1()).optional(),
|
|
4840
4840
|
...retryParamsShape
|
|
4841
4841
|
});
|
|
4842
4842
|
const ListResourcesRequestSchema$1 = wireRequest("resources/list", paginatedParamsShape);
|
|
@@ -4851,7 +4851,7 @@ function build() {
|
|
|
4851
4851
|
name: string$1(),
|
|
4852
4852
|
value: string$1()
|
|
4853
4853
|
}),
|
|
4854
|
-
context: object({ arguments: record$
|
|
4854
|
+
context: object({ arguments: record$2(string$1(), string$1()).optional() }).optional()
|
|
4855
4855
|
};
|
|
4856
4856
|
const CompleteRequestSchema$1 = wireRequest("completion/complete", completeParamsShape);
|
|
4857
4857
|
const DiscoverRequestSchema$1 = wireRequest("server/discover", {});
|
|
@@ -4886,7 +4886,7 @@ function build() {
|
|
|
4886
4886
|
"tools/list": dispatchRequest("tools/list", paginatedParamsShape),
|
|
4887
4887
|
"prompts/get": dispatchRequest("prompts/get", {
|
|
4888
4888
|
name: string$1(),
|
|
4889
|
-
arguments: record$
|
|
4889
|
+
arguments: record$2(string$1(), string$1()).optional()
|
|
4890
4890
|
}),
|
|
4891
4891
|
"prompts/list": dispatchRequest("prompts/list", paginatedParamsShape),
|
|
4892
4892
|
"resources/list": dispatchRequest("resources/list", paginatedParamsShape),
|
|
@@ -9281,15 +9281,15 @@ var CfWorkerJsonSchemaValidator = class {
|
|
|
9281
9281
|
preloadSchemas();
|
|
9282
9282
|
//#endregion
|
|
9283
9283
|
//#region ../../../node_modules/.pnpm/pkce-challenge@5.0.1/node_modules/pkce-challenge/dist/index.browser.js
|
|
9284
|
-
let crypto$
|
|
9285
|
-
crypto$
|
|
9284
|
+
let crypto$2;
|
|
9285
|
+
crypto$2 = globalThis.crypto;
|
|
9286
9286
|
/**
|
|
9287
9287
|
* Creates an array of length `size` of random bytes
|
|
9288
9288
|
* @param size
|
|
9289
9289
|
* @returns Array of random ints (0 to 255)
|
|
9290
9290
|
*/
|
|
9291
9291
|
async function getRandomValues(size) {
|
|
9292
|
-
return (await crypto$
|
|
9292
|
+
return (await crypto$2).getRandomValues(new Uint8Array(size));
|
|
9293
9293
|
}
|
|
9294
9294
|
/** Generate cryptographically strong random string
|
|
9295
9295
|
* @param size The desired length of the string
|
|
@@ -9317,7 +9317,7 @@ async function generateVerifier(length) {
|
|
|
9317
9317
|
* @returns The base64 url encoded code challenge
|
|
9318
9318
|
*/
|
|
9319
9319
|
async function generateChallenge(code_verifier) {
|
|
9320
|
-
const buffer = await (await crypto$
|
|
9320
|
+
const buffer = await (await crypto$2).subtle.digest("SHA-256", new TextEncoder().encode(code_verifier));
|
|
9321
9321
|
return btoa(String.fromCharCode(...new Uint8Array(buffer))).replace(/\//g, "_").replace(/\+/g, "-").replace(/=/g, "");
|
|
9322
9322
|
}
|
|
9323
9323
|
/** Generate a PKCE challenge pair
|
|
@@ -14150,6 +14150,104 @@ var StreamableHTTPClientTransport = class {
|
|
|
14150
14150
|
}
|
|
14151
14151
|
};
|
|
14152
14152
|
//#endregion
|
|
14153
|
+
//#region ../../default/po-mcp/src/services/mcpApproval/index.ts
|
|
14154
|
+
const ARGUMENTS_PREVIEW_LIMIT = 2e3;
|
|
14155
|
+
/**
|
|
14156
|
+
* The MCP spec defaults: a tool is read-only only when it says so, and a tool that is not read-only
|
|
14157
|
+
* is destructive unless it says it is not. Most third-party tools send no annotations at all.
|
|
14158
|
+
*/
|
|
14159
|
+
function isDestructiveMcpTool(annotations) {
|
|
14160
|
+
return annotations?.readOnlyHint !== true && annotations?.destructiveHint !== false;
|
|
14161
|
+
}
|
|
14162
|
+
function grantKey(piName, parameters) {
|
|
14163
|
+
return `${piName}\u0000${JSON.stringify(parameters ?? {})}`;
|
|
14164
|
+
}
|
|
14165
|
+
function createMcpApprovalState(options) {
|
|
14166
|
+
let session = false;
|
|
14167
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
14168
|
+
const grants = /* @__PURE__ */ new Map();
|
|
14169
|
+
const release = (key) => {
|
|
14170
|
+
const count = grants.get(key) ?? 0;
|
|
14171
|
+
if (count <= 1) grants.delete(key);
|
|
14172
|
+
else grants.set(key, count - 1);
|
|
14173
|
+
};
|
|
14174
|
+
return {
|
|
14175
|
+
autoApproved: () => session || options.globalAutoApprove(),
|
|
14176
|
+
sessionAutoApprove: () => session,
|
|
14177
|
+
globalAutoApprove: () => options.globalAutoApprove(),
|
|
14178
|
+
setSessionAutoApprove(enabled) {
|
|
14179
|
+
if (session === enabled) return;
|
|
14180
|
+
session = enabled;
|
|
14181
|
+
for (const listener of listeners) listener();
|
|
14182
|
+
},
|
|
14183
|
+
onChange(listener) {
|
|
14184
|
+
listeners.add(listener);
|
|
14185
|
+
const stopGlobal = options.onGlobalChange?.(listener);
|
|
14186
|
+
return () => {
|
|
14187
|
+
listeners.delete(listener);
|
|
14188
|
+
stopGlobal?.();
|
|
14189
|
+
};
|
|
14190
|
+
},
|
|
14191
|
+
grant(piName, parameters) {
|
|
14192
|
+
const key = grantKey(piName, parameters);
|
|
14193
|
+
grants.set(key, (grants.get(key) ?? 0) + 1);
|
|
14194
|
+
let released = false;
|
|
14195
|
+
return () => {
|
|
14196
|
+
if (released) return;
|
|
14197
|
+
released = true;
|
|
14198
|
+
release(key);
|
|
14199
|
+
};
|
|
14200
|
+
},
|
|
14201
|
+
consume(piName, parameters) {
|
|
14202
|
+
const key = grantKey(piName, parameters);
|
|
14203
|
+
if (!grants.has(key)) return false;
|
|
14204
|
+
release(key);
|
|
14205
|
+
return true;
|
|
14206
|
+
}
|
|
14207
|
+
};
|
|
14208
|
+
}
|
|
14209
|
+
function argumentsPreview(parameters) {
|
|
14210
|
+
let text;
|
|
14211
|
+
try {
|
|
14212
|
+
text = JSON.stringify(parameters ?? {});
|
|
14213
|
+
} catch {
|
|
14214
|
+
text = "(arguments could not be shown)";
|
|
14215
|
+
}
|
|
14216
|
+
return text.length > ARGUMENTS_PREVIEW_LIMIT ? `${text.slice(0, 1999)}…` : text;
|
|
14217
|
+
}
|
|
14218
|
+
/** The person-facing card for one MCP tool call. */
|
|
14219
|
+
function describeMcpToolCall(tool, parameters) {
|
|
14220
|
+
return {
|
|
14221
|
+
title: `${tool.serverName}: ${tool.toolName}`,
|
|
14222
|
+
summary: tool.description ?? `Run ${tool.toolName} on the ${tool.serverName} MCP server.`,
|
|
14223
|
+
details: [
|
|
14224
|
+
{
|
|
14225
|
+
label: "Server",
|
|
14226
|
+
value: tool.serverName
|
|
14227
|
+
},
|
|
14228
|
+
{
|
|
14229
|
+
label: "Tool",
|
|
14230
|
+
value: tool.toolName
|
|
14231
|
+
},
|
|
14232
|
+
{
|
|
14233
|
+
label: "Arguments",
|
|
14234
|
+
value: argumentsPreview(parameters)
|
|
14235
|
+
}
|
|
14236
|
+
]
|
|
14237
|
+
};
|
|
14238
|
+
}
|
|
14239
|
+
/**
|
|
14240
|
+
* Approval for one destructive MCP tool. Declared whatever the toggles say, so a call queued before
|
|
14241
|
+
* auto-approve flipped still replays; `applies` reads the toggles and any App grant per call.
|
|
14242
|
+
*/
|
|
14243
|
+
function mcpToolApproval(tool, state) {
|
|
14244
|
+
return {
|
|
14245
|
+
requirement: "ask",
|
|
14246
|
+
applies: (parameters) => !state.autoApproved() && !state.consume(tool.piName, parameters),
|
|
14247
|
+
describe: (parameters) => describeMcpToolCall(tool, parameters)
|
|
14248
|
+
};
|
|
14249
|
+
}
|
|
14250
|
+
//#endregion
|
|
14153
14251
|
//#region ../../default/po-mcp/src/services/mcpCatalog/index.ts
|
|
14154
14252
|
function metadataRecord(value) {
|
|
14155
14253
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
@@ -14207,13 +14305,13 @@ function toPiToolName(serverName, toolName) {
|
|
|
14207
14305
|
/** ChatGPT Apps metadata naming the top-level arguments that carry a file. */
|
|
14208
14306
|
const FILE_PARAMS_META_KEY = "openai/fileParams";
|
|
14209
14307
|
const MAX_FILE_PARAMS = 16;
|
|
14210
|
-
function record(value) {
|
|
14308
|
+
function record$1(value) {
|
|
14211
14309
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
14212
14310
|
}
|
|
14213
14311
|
/** Declared file parameters that the input schema really has at its top level. */
|
|
14214
14312
|
function fileParamNames(tool) {
|
|
14215
14313
|
const declared = tool._meta?.[FILE_PARAMS_META_KEY];
|
|
14216
|
-
const properties = record(tool.inputSchema.properties);
|
|
14314
|
+
const properties = record$1(tool.inputSchema.properties);
|
|
14217
14315
|
if (!Array.isArray(declared) || properties === void 0) return [];
|
|
14218
14316
|
const names = declared.filter((name) => typeof name === "string" && Object.hasOwn(properties, name));
|
|
14219
14317
|
return [...new Set(names)].slice(0, MAX_FILE_PARAMS);
|
|
@@ -14226,9 +14324,9 @@ function modelInputSchema(tool) {
|
|
|
14226
14324
|
};
|
|
14227
14325
|
const names = fileParamNames(tool);
|
|
14228
14326
|
if (names.length === 0) return tool.inputSchema;
|
|
14229
|
-
const properties = { ...record(tool.inputSchema.properties) };
|
|
14327
|
+
const properties = { ...record$1(tool.inputSchema.properties) };
|
|
14230
14328
|
for (const name of names) {
|
|
14231
|
-
const description = record(properties[name])?.description;
|
|
14329
|
+
const description = record$1(properties[name])?.description;
|
|
14232
14330
|
properties[name] = {
|
|
14233
14331
|
type: "object",
|
|
14234
14332
|
description: `${typeof description === "string" ? description : "A file."} Pass {"path": "<file in the working directory, or the path from an Attached file note>"}.`,
|
|
@@ -14243,6 +14341,220 @@ function modelInputSchema(tool) {
|
|
|
14243
14341
|
};
|
|
14244
14342
|
}
|
|
14245
14343
|
//#endregion
|
|
14344
|
+
//#region ../../default/po-mcp/src/services/mcpScope/index.edge.ts
|
|
14345
|
+
/** Edge build of `mcpScope`: same names, no filesystem, so a repository is keyed by its path as given. */
|
|
14346
|
+
const USER_MCP_SCOPE = "user";
|
|
14347
|
+
//#endregion
|
|
14348
|
+
//#region ../../default/po-mcp/src/services/mcpSecrets/index.ts
|
|
14349
|
+
/**
|
|
14350
|
+
* `${vault:NAME}` secrets for MCP server headers and environment.
|
|
14351
|
+
*
|
|
14352
|
+
* Each secret is stored per credential scope (user, repository, plugin) and bound to where it may
|
|
14353
|
+
* go: a URL origin, or a command with its exact arguments. A secret read for any other destination
|
|
14354
|
+
* counts as missing, so editing a server's URL or command never sends an old secret somewhere new.
|
|
14355
|
+
*/
|
|
14356
|
+
const MCP_SECRET_NAMESPACE = "mcp.secret";
|
|
14357
|
+
const SECRET_NAME = /^[A-Za-z0-9._-]{1,64}$/u;
|
|
14358
|
+
const SLUG_INVALID = /[^A-Za-z0-9._-]/gu;
|
|
14359
|
+
const MAX_SECRET_VALUE = 4096;
|
|
14360
|
+
const MAX_SECRET_FIELDS = 64;
|
|
14361
|
+
const VAULT_REF_MARKER$1 = "${vault:";
|
|
14362
|
+
/** `${scope}/${name}`: one secret per name per scope. */
|
|
14363
|
+
function mcpSecretVaultKey(scope, name) {
|
|
14364
|
+
return `${scope}/${name}`;
|
|
14365
|
+
}
|
|
14366
|
+
/** The reference written into configuration in place of a secret value. */
|
|
14367
|
+
function vaultReference(name) {
|
|
14368
|
+
return `\${vault:${name}}`;
|
|
14369
|
+
}
|
|
14370
|
+
/** True for a name a `${vault:NAME}` reference accepts. */
|
|
14371
|
+
function isSecretName(value) {
|
|
14372
|
+
return typeof value === "string" && SECRET_NAME.test(value);
|
|
14373
|
+
}
|
|
14374
|
+
/** A secret value the vault keeps: one line, at most 4 KiB. */
|
|
14375
|
+
function isSecretValue(value) {
|
|
14376
|
+
return typeof value === "string" && value.length > 0 && value.length <= MAX_SECRET_VALUE && !/[\r\n\0]/u.test(value) && !value.includes(VAULT_REF_MARKER$1);
|
|
14377
|
+
}
|
|
14378
|
+
/** The sha256 of `JSON.stringify([command, args])`, so a changed argument list reads as a new destination. */
|
|
14379
|
+
function argsDigest(command, args) {
|
|
14380
|
+
return createHash("sha256").update(JSON.stringify([command, args])).digest("hex");
|
|
14381
|
+
}
|
|
14382
|
+
/** Where a connection is about to send a secret, or undefined when the target names no destination. */
|
|
14383
|
+
function secretBindingOf(target) {
|
|
14384
|
+
if (target.origin !== void 0) return { origin: target.origin };
|
|
14385
|
+
if (target.command !== void 0) return {
|
|
14386
|
+
command: target.command,
|
|
14387
|
+
argsDigest: argsDigest(target.command, target.args ?? [])
|
|
14388
|
+
};
|
|
14389
|
+
}
|
|
14390
|
+
function sameBinding(left, right) {
|
|
14391
|
+
if ("origin" in left || "origin" in right) return "origin" in left && "origin" in right && left.origin === right.origin;
|
|
14392
|
+
return left.command === right.command && left.argsDigest === right.argsDigest;
|
|
14393
|
+
}
|
|
14394
|
+
function readStoredSecret(value) {
|
|
14395
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
14396
|
+
const { value: secret, boundTo } = value;
|
|
14397
|
+
if (typeof secret !== "string" || typeof boundTo !== "object" || boundTo === null || Array.isArray(boundTo)) return void 0;
|
|
14398
|
+
if (typeof boundTo.origin === "string") return {
|
|
14399
|
+
value: secret,
|
|
14400
|
+
boundTo: { origin: boundTo.origin }
|
|
14401
|
+
};
|
|
14402
|
+
if (typeof boundTo.command === "string" && typeof boundTo.argsDigest === "string") return {
|
|
14403
|
+
value: secret,
|
|
14404
|
+
boundTo: {
|
|
14405
|
+
command: boundTo.command,
|
|
14406
|
+
argsDigest: boundTo.argsDigest
|
|
14407
|
+
}
|
|
14408
|
+
};
|
|
14409
|
+
}
|
|
14410
|
+
function toMiss(target) {
|
|
14411
|
+
const { signal: _signal, ...miss } = target;
|
|
14412
|
+
return {
|
|
14413
|
+
...miss,
|
|
14414
|
+
...miss.args ? { args: [...miss.args] } : {}
|
|
14415
|
+
};
|
|
14416
|
+
}
|
|
14417
|
+
/**
|
|
14418
|
+
* The proxy's `resolveSecret` callback over the vault.
|
|
14419
|
+
*
|
|
14420
|
+
* A server with no scope (session-only servers) or a host with no vault resolves nothing and
|
|
14421
|
+
* records nothing, since there is nowhere to supply the secret. A vault failure propagates, which
|
|
14422
|
+
* the proxy turns into its one generic connection error.
|
|
14423
|
+
*/
|
|
14424
|
+
function createSecretResolver(options) {
|
|
14425
|
+
return async (target) => {
|
|
14426
|
+
const scope = options.scopeOf(target.serverName);
|
|
14427
|
+
const vault = options.vault();
|
|
14428
|
+
const expected = secretBindingOf(target);
|
|
14429
|
+
if (scope === void 0 || !vault || !expected || !isSecretName(target.name)) return void 0;
|
|
14430
|
+
const stored = readStoredSecret((await vault.get(MCP_SECRET_NAMESPACE, mcpSecretVaultKey(scope, target.name)))?.value);
|
|
14431
|
+
if (!stored || !sameBinding(stored.boundTo, expected)) {
|
|
14432
|
+
options.onMissing?.(toMiss(target));
|
|
14433
|
+
return;
|
|
14434
|
+
}
|
|
14435
|
+
return stored.value;
|
|
14436
|
+
};
|
|
14437
|
+
}
|
|
14438
|
+
/** Writes one secret, last write wins. */
|
|
14439
|
+
async function storeSecret(vault, scope, write) {
|
|
14440
|
+
const value = {
|
|
14441
|
+
value: write.value,
|
|
14442
|
+
boundTo: write.boundTo
|
|
14443
|
+
};
|
|
14444
|
+
await vault.put(MCP_SECRET_NAMESPACE, mcpSecretVaultKey(scope, write.name), {
|
|
14445
|
+
...value,
|
|
14446
|
+
boundTo: { ...value.boundTo }
|
|
14447
|
+
});
|
|
14448
|
+
}
|
|
14449
|
+
/**
|
|
14450
|
+
* Writes every secret of one add-server request and returns how to undo them.
|
|
14451
|
+
*
|
|
14452
|
+
* A name that already held a secret is restored on undo rather than deleted, so a failed add never
|
|
14453
|
+
* erases a secret another server still references. A failed write undoes the earlier ones before
|
|
14454
|
+
* rethrowing.
|
|
14455
|
+
*/
|
|
14456
|
+
async function writeSecrets(vault, scope, writes) {
|
|
14457
|
+
const undo = [];
|
|
14458
|
+
const rollback = async () => {
|
|
14459
|
+
for (const step of undo.reverse()) await step().catch(() => void 0);
|
|
14460
|
+
};
|
|
14461
|
+
try {
|
|
14462
|
+
for (const write of writes) {
|
|
14463
|
+
const key = mcpSecretVaultKey(scope, write.name);
|
|
14464
|
+
const previous = await vault.get(MCP_SECRET_NAMESPACE, key);
|
|
14465
|
+
await storeSecret(vault, scope, write);
|
|
14466
|
+
undo.push(() => previous ? vault.put(MCP_SECRET_NAMESPACE, key, previous.value).then(() => void 0) : vault.delete(MCP_SECRET_NAMESPACE, key));
|
|
14467
|
+
}
|
|
14468
|
+
} catch (error) {
|
|
14469
|
+
await rollback();
|
|
14470
|
+
throw error;
|
|
14471
|
+
}
|
|
14472
|
+
return rollback;
|
|
14473
|
+
}
|
|
14474
|
+
function refuse$1(error) {
|
|
14475
|
+
return {
|
|
14476
|
+
ok: false,
|
|
14477
|
+
status: 400,
|
|
14478
|
+
error
|
|
14479
|
+
};
|
|
14480
|
+
}
|
|
14481
|
+
function isCredentialOrigin(url) {
|
|
14482
|
+
return url.protocol === "https:" || url.protocol === "http:" && [
|
|
14483
|
+
"localhost",
|
|
14484
|
+
"127.0.0.1",
|
|
14485
|
+
"[::1]"
|
|
14486
|
+
].includes(url.hostname);
|
|
14487
|
+
}
|
|
14488
|
+
/**
|
|
14489
|
+
* Moves the named header or env values of an add-server request into vault writes, leaving
|
|
14490
|
+
* `${vault:<server>-<field>}` in the entry. Every field is untrusted input.
|
|
14491
|
+
*/
|
|
14492
|
+
function prepareSecretAddition(addition, secretFields) {
|
|
14493
|
+
if (secretFields === void 0) return {
|
|
14494
|
+
ok: true,
|
|
14495
|
+
value: {
|
|
14496
|
+
addition,
|
|
14497
|
+
secrets: []
|
|
14498
|
+
}
|
|
14499
|
+
};
|
|
14500
|
+
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.");
|
|
14501
|
+
if (secretFields.length === 0) return {
|
|
14502
|
+
ok: true,
|
|
14503
|
+
value: {
|
|
14504
|
+
addition,
|
|
14505
|
+
secrets: []
|
|
14506
|
+
}
|
|
14507
|
+
};
|
|
14508
|
+
const { entry } = addition;
|
|
14509
|
+
let boundTo;
|
|
14510
|
+
let values;
|
|
14511
|
+
if ("command" in entry) {
|
|
14512
|
+
boundTo = {
|
|
14513
|
+
command: entry.command,
|
|
14514
|
+
argsDigest: argsDigest(entry.command, entry.args)
|
|
14515
|
+
};
|
|
14516
|
+
values = { ...entry.env };
|
|
14517
|
+
} else {
|
|
14518
|
+
const url = new URL(entry.url);
|
|
14519
|
+
if (!isCredentialOrigin(url) || url.username || url.password) return refuse$1("A secret is only sent over https, or over plain http to this machine.");
|
|
14520
|
+
boundTo = { origin: url.origin };
|
|
14521
|
+
values = { ...entry.headers };
|
|
14522
|
+
}
|
|
14523
|
+
const secrets = [];
|
|
14524
|
+
for (const field of secretFields) {
|
|
14525
|
+
const value = Object.hasOwn(values, field) ? values[field] : void 0;
|
|
14526
|
+
if (!isSecretValue(value)) return refuse$1("Each secret field needs a value you entered.");
|
|
14527
|
+
const name = `${addition.name}-${field.replace(SLUG_INVALID, "_")}`;
|
|
14528
|
+
if (!isSecretName(name)) return refuse$1("Shorten the server or field name so the secret name fits in 64 characters.");
|
|
14529
|
+
if (secrets.some((secret) => secret.name === name)) return refuse$1("Two secret fields map to the same vault name.");
|
|
14530
|
+
secrets.push({
|
|
14531
|
+
name,
|
|
14532
|
+
value,
|
|
14533
|
+
boundTo
|
|
14534
|
+
});
|
|
14535
|
+
values[field] = vaultReference(name);
|
|
14536
|
+
}
|
|
14537
|
+
const next = "command" in entry ? {
|
|
14538
|
+
command: entry.command,
|
|
14539
|
+
args: [...entry.args],
|
|
14540
|
+
env: values
|
|
14541
|
+
} : {
|
|
14542
|
+
type: "http",
|
|
14543
|
+
url: entry.url,
|
|
14544
|
+
headers: values
|
|
14545
|
+
};
|
|
14546
|
+
return {
|
|
14547
|
+
ok: true,
|
|
14548
|
+
value: {
|
|
14549
|
+
addition: {
|
|
14550
|
+
name: addition.name,
|
|
14551
|
+
entry: next
|
|
14552
|
+
},
|
|
14553
|
+
secrets
|
|
14554
|
+
}
|
|
14555
|
+
};
|
|
14556
|
+
}
|
|
14557
|
+
//#endregion
|
|
14246
14558
|
//#region ../../default/po-mcp/src/services/remoteMcp/index.ts
|
|
14247
14559
|
const PO_MCP_REMOTE_SERVERS_SERVICE = "po/mcp-remote-servers";
|
|
14248
14560
|
/** Bound by the host at the global level, so every session it opens inherits it. */
|
|
@@ -14256,6 +14568,10 @@ const CLIENT_INFO = {
|
|
|
14256
14568
|
name: "po-cloud",
|
|
14257
14569
|
version: "1.0.0"
|
|
14258
14570
|
};
|
|
14571
|
+
/** The one failure for any unresolved reference, as the Node proxy reports it: never a name or a value. */
|
|
14572
|
+
const REMOTE_MCP_SECRET_ERROR = "MCP secret reference could not be resolved.";
|
|
14573
|
+
const VAULT_REF = /\$\{vault:([A-Za-z0-9._-]{1,64})\}/gu;
|
|
14574
|
+
const VAULT_REF_MARKER = "${vault:";
|
|
14259
14575
|
function readPoMcpRemoteServers(context) {
|
|
14260
14576
|
return context.get(PO_MCP_REMOTE_SERVERS_SERVICE);
|
|
14261
14577
|
}
|
|
@@ -14282,6 +14598,10 @@ function toResult(result) {
|
|
|
14282
14598
|
function message(error) {
|
|
14283
14599
|
return (error instanceof Error ? error.message : String(error)).slice(0, 300);
|
|
14284
14600
|
}
|
|
14601
|
+
/** A 401 or 403 means the stored header no longer works; retrying with the same one cannot help. */
|
|
14602
|
+
function isUnauthorized(error) {
|
|
14603
|
+
return error instanceof UnauthorizedError || error instanceof SdkHttpError && (error.status === 401 || error.status === 403);
|
|
14604
|
+
}
|
|
14285
14605
|
async function listTools(client, server, signal) {
|
|
14286
14606
|
const tools = [];
|
|
14287
14607
|
let cursor;
|
|
@@ -14307,10 +14627,51 @@ async function listTools(client, server, signal) {
|
|
|
14307
14627
|
return tools;
|
|
14308
14628
|
}
|
|
14309
14629
|
/**
|
|
14630
|
+
* The server's headers with every `${vault:NAME}` replaced from the vault's `mcp.secret` entries.
|
|
14631
|
+
*
|
|
14632
|
+
* Host-configured servers are the edge's only configuration layer, so they read the user scope with the Node
|
|
14633
|
+
* session's key scheme and origin binding. A malformed reference, a miss, a missing vault or any vault failure
|
|
14634
|
+
* (`unavailable` included) throws the one generic error, as the Node proxy does, so that server alone fails.
|
|
14635
|
+
*/
|
|
14636
|
+
async function resolveRemoteMcpHeaders(server, vault, signal) {
|
|
14637
|
+
const headers = { ...server.headers };
|
|
14638
|
+
const resolveSecret = createSecretResolver({
|
|
14639
|
+
vault,
|
|
14640
|
+
scopeOf: () => USER_MCP_SCOPE
|
|
14641
|
+
});
|
|
14642
|
+
const origin = new URL(server.url).origin;
|
|
14643
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
14644
|
+
if (!value.includes(VAULT_REF_MARKER)) continue;
|
|
14645
|
+
if (value.replace(VAULT_REF, "").includes(VAULT_REF_MARKER)) throw new Error(REMOTE_MCP_SECRET_ERROR);
|
|
14646
|
+
const secrets = /* @__PURE__ */ new Map();
|
|
14647
|
+
for (const [, name] of value.matchAll(VAULT_REF)) {
|
|
14648
|
+
if (secrets.has(name)) continue;
|
|
14649
|
+
let secret;
|
|
14650
|
+
try {
|
|
14651
|
+
secret = await resolveSecret({
|
|
14652
|
+
serverName: server.name,
|
|
14653
|
+
field: "header",
|
|
14654
|
+
key,
|
|
14655
|
+
name,
|
|
14656
|
+
transport: "http",
|
|
14657
|
+
origin
|
|
14658
|
+
});
|
|
14659
|
+
} catch {
|
|
14660
|
+
secret = void 0;
|
|
14661
|
+
}
|
|
14662
|
+
signal?.throwIfAborted();
|
|
14663
|
+
if (secret === void 0) throw new Error(REMOTE_MCP_SECRET_ERROR);
|
|
14664
|
+
secrets.set(name, secret);
|
|
14665
|
+
}
|
|
14666
|
+
headers[key] = value.replace(VAULT_REF, (_match, name) => secrets.get(name));
|
|
14667
|
+
}
|
|
14668
|
+
return headers;
|
|
14669
|
+
}
|
|
14670
|
+
/**
|
|
14310
14671
|
* Connects every server the host hands over, once. A server that the policy refuses or that fails to
|
|
14311
14672
|
* answer is reported in `failures` and contributes no tools; the others still connect.
|
|
14312
14673
|
*/
|
|
14313
|
-
async function connectRemoteMcpServers(service, signal) {
|
|
14674
|
+
async function connectRemoteMcpServers(service, signal, approval, vault = () => void 0) {
|
|
14314
14675
|
const policy = {
|
|
14315
14676
|
protocols: REMOTE_MCP_PROTOCOLS,
|
|
14316
14677
|
blockedHosts: service.blockedHosts
|
|
@@ -14324,6 +14685,20 @@ async function connectRemoteMcpServers(service, signal) {
|
|
|
14324
14685
|
const servers = await service.load(signal);
|
|
14325
14686
|
const failures = [];
|
|
14326
14687
|
const clients = [];
|
|
14688
|
+
let disposed = false;
|
|
14689
|
+
let revision = 0;
|
|
14690
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
14691
|
+
const lost = /* @__PURE__ */ new Set();
|
|
14692
|
+
const lose = (name, reason) => {
|
|
14693
|
+
if (disposed || lost.has(name)) return;
|
|
14694
|
+
lost.add(name);
|
|
14695
|
+
revision++;
|
|
14696
|
+
failures.push({
|
|
14697
|
+
name,
|
|
14698
|
+
message: reason
|
|
14699
|
+
});
|
|
14700
|
+
for (const listener of listeners) listener();
|
|
14701
|
+
};
|
|
14327
14702
|
const entries = (await Promise.all(servers.map(async (server) => {
|
|
14328
14703
|
const refusal = outboundHostRefusal(server.url, policy);
|
|
14329
14704
|
if (refusal) {
|
|
@@ -14334,17 +14709,19 @@ async function connectRemoteMcpServers(service, signal) {
|
|
|
14334
14709
|
return [];
|
|
14335
14710
|
}
|
|
14336
14711
|
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
14712
|
try {
|
|
14713
|
+
const transport = new StreamableHTTPClientTransport(new URL(server.url), {
|
|
14714
|
+
fetch: fetcher,
|
|
14715
|
+
requestInit: { headers: await resolveRemoteMcpHeaders(server, vault, signal) }
|
|
14716
|
+
});
|
|
14342
14717
|
await client.connect(transport, {
|
|
14343
14718
|
signal,
|
|
14344
14719
|
timeout: REMOTE_MCP_TIMEOUT_MS
|
|
14345
14720
|
});
|
|
14346
14721
|
clients.push(client);
|
|
14347
|
-
|
|
14722
|
+
const tools = await listTools(client, server.name, signal);
|
|
14723
|
+
client.onclose = () => lose(server.name, "The connection closed.");
|
|
14724
|
+
return tools.map((tool) => ({
|
|
14348
14725
|
tool,
|
|
14349
14726
|
client
|
|
14350
14727
|
}));
|
|
@@ -14357,8 +14734,6 @@ async function connectRemoteMcpServers(service, signal) {
|
|
|
14357
14734
|
return [];
|
|
14358
14735
|
}
|
|
14359
14736
|
}))).flat();
|
|
14360
|
-
let disposed = false;
|
|
14361
|
-
const listeners = /* @__PURE__ */ new Set();
|
|
14362
14737
|
const projected = entries.map(({ tool, client }) => {
|
|
14363
14738
|
const parameters = modelInputSchema(tool);
|
|
14364
14739
|
return {
|
|
@@ -14366,6 +14741,7 @@ async function connectRemoteMcpServers(service, signal) {
|
|
|
14366
14741
|
label: `${tool.serverName}: ${tool.toolName}`,
|
|
14367
14742
|
description: tool.description ?? `${tool.toolName} on the ${tool.serverName} MCP server.`,
|
|
14368
14743
|
...tool.annotations === void 0 ? {} : { annotations: tool.annotations },
|
|
14744
|
+
...approval !== void 0 && isDestructiveMcpTool(tool.annotations) ? { approval: mcpToolApproval(tool, approval) } : {},
|
|
14369
14745
|
...tool._meta === void 0 ? {} : { _meta: mcpToolExecutionMetadata(tool) },
|
|
14370
14746
|
...tool.outputSchema === void 0 ? {} : { outputSchema: tool.outputSchema },
|
|
14371
14747
|
parameters,
|
|
@@ -14374,21 +14750,33 @@ async function connectRemoteMcpServers(service, signal) {
|
|
|
14374
14750
|
callSignal?.throwIfAborted();
|
|
14375
14751
|
const args = input === void 0 ? {} : input;
|
|
14376
14752
|
if (!Check(parameters, args)) throw new Error(`Invalid arguments for MCP tool ${tool.piName}.`);
|
|
14377
|
-
|
|
14378
|
-
|
|
14379
|
-
|
|
14380
|
-
|
|
14381
|
-
|
|
14382
|
-
|
|
14383
|
-
|
|
14753
|
+
let result;
|
|
14754
|
+
try {
|
|
14755
|
+
result = await client.callTool({
|
|
14756
|
+
name: tool.toolName,
|
|
14757
|
+
arguments: args
|
|
14758
|
+
}, {
|
|
14759
|
+
...callSignal ? { signal: callSignal } : {},
|
|
14760
|
+
timeout: REMOTE_MCP_TIMEOUT_MS
|
|
14761
|
+
});
|
|
14762
|
+
} catch (error) {
|
|
14763
|
+
if (isUnauthorized(error)) lose(tool.serverName, "The server no longer accepts its credentials.");
|
|
14764
|
+
throw error;
|
|
14765
|
+
}
|
|
14766
|
+
return toResult(result);
|
|
14384
14767
|
}
|
|
14385
14768
|
};
|
|
14386
14769
|
});
|
|
14387
|
-
const
|
|
14388
|
-
const
|
|
14770
|
+
const live = () => disposed ? [] : entries.filter(({ tool }) => !lost.has(tool.serverName));
|
|
14771
|
+
const snapshot = () => live().map(({ tool }) => tool);
|
|
14772
|
+
const project = () => {
|
|
14773
|
+
const names = new Set(live().map(({ tool }) => tool.piName));
|
|
14774
|
+
return projected.filter((tool) => names.has(tool.name));
|
|
14775
|
+
};
|
|
14389
14776
|
const sessionTools = Object.freeze({
|
|
14390
14777
|
generation: `remote:${crypto.randomUUID()}`,
|
|
14391
|
-
|
|
14778
|
+
approval,
|
|
14779
|
+
runtimeRevision: () => revision,
|
|
14392
14780
|
readAppResource: async () => {
|
|
14393
14781
|
throw new Error("MCP Apps are not available on this host.");
|
|
14394
14782
|
},
|
|
@@ -14428,4 +14816,594 @@ async function connectRemoteMcpServers(service, signal) {
|
|
|
14428
14816
|
};
|
|
14429
14817
|
}
|
|
14430
14818
|
//#endregion
|
|
14431
|
-
|
|
14819
|
+
//#region ../../default/po-mcp/src/services/mcpGlobalSettings/index.ts
|
|
14820
|
+
/** Beside `mcp.json` in Po's home, kept separate so MCP clients that read `mcp.json` never see it. */
|
|
14821
|
+
const MCP_SETTINGS_FILE = "mcp-settings.json";
|
|
14822
|
+
const AUTO_APPROVE_KEY = "autoApproveDestructiveTools";
|
|
14823
|
+
function record(value) {
|
|
14824
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
14825
|
+
}
|
|
14826
|
+
/** The file's object, or an empty one when it is missing. A malformed file is refused rather than overwritten. */
|
|
14827
|
+
async function readDocument(fs, filePath) {
|
|
14828
|
+
const text = await readTextIfExists(fs, filePath, BACKGROUND_CONTEXT);
|
|
14829
|
+
if (text === void 0) return {};
|
|
14830
|
+
let parsed;
|
|
14831
|
+
try {
|
|
14832
|
+
parsed = JSON.parse(text);
|
|
14833
|
+
} catch (error) {
|
|
14834
|
+
throw new Error(`${MCP_SETTINGS_FILE} is not valid JSON.`, { cause: error });
|
|
14835
|
+
}
|
|
14836
|
+
const document = record(parsed);
|
|
14837
|
+
if (!document) throw new Error(`${MCP_SETTINGS_FILE} must hold a JSON object.`);
|
|
14838
|
+
return document;
|
|
14839
|
+
}
|
|
14840
|
+
function createMcpGlobalSettings(getFs) {
|
|
14841
|
+
let autoApprove = false;
|
|
14842
|
+
let loaded;
|
|
14843
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
14844
|
+
const removalListeners = /* @__PURE__ */ new Set();
|
|
14845
|
+
const requireFs = () => {
|
|
14846
|
+
const fs = getFs();
|
|
14847
|
+
if (!fs) throw new Error("MCP settings need the host filesystem.");
|
|
14848
|
+
return fs;
|
|
14849
|
+
};
|
|
14850
|
+
const set = (enabled) => {
|
|
14851
|
+
if (autoApprove === enabled) return;
|
|
14852
|
+
autoApprove = enabled;
|
|
14853
|
+
for (const listener of listeners) listener();
|
|
14854
|
+
};
|
|
14855
|
+
return {
|
|
14856
|
+
autoApprove: () => autoApprove,
|
|
14857
|
+
load(filePath) {
|
|
14858
|
+
if (loaded?.path === filePath) return loaded.read;
|
|
14859
|
+
const read = (async () => {
|
|
14860
|
+
const document = await readDocument(requireFs(), filePath);
|
|
14861
|
+
set(document[AUTO_APPROVE_KEY] === true);
|
|
14862
|
+
return autoApprove;
|
|
14863
|
+
})();
|
|
14864
|
+
loaded = {
|
|
14865
|
+
path: filePath,
|
|
14866
|
+
read
|
|
14867
|
+
};
|
|
14868
|
+
read.catch(() => {
|
|
14869
|
+
if (loaded?.read === read) loaded = void 0;
|
|
14870
|
+
});
|
|
14871
|
+
return read;
|
|
14872
|
+
},
|
|
14873
|
+
async setAutoApprove(filePath, enabled) {
|
|
14874
|
+
const fs = requireFs();
|
|
14875
|
+
const document = await readDocument(fs, filePath);
|
|
14876
|
+
await writeFileAtomic(fs, filePath, `${JSON.stringify({
|
|
14877
|
+
...document,
|
|
14878
|
+
[AUTO_APPROVE_KEY]: enabled
|
|
14879
|
+
}, null, 2)}\n`, BACKGROUND_CONTEXT);
|
|
14880
|
+
loaded = {
|
|
14881
|
+
path: filePath,
|
|
14882
|
+
read: Promise.resolve(enabled)
|
|
14883
|
+
};
|
|
14884
|
+
set(enabled);
|
|
14885
|
+
},
|
|
14886
|
+
onChange(listener) {
|
|
14887
|
+
listeners.add(listener);
|
|
14888
|
+
return () => {
|
|
14889
|
+
listeners.delete(listener);
|
|
14890
|
+
};
|
|
14891
|
+
},
|
|
14892
|
+
serverRemoved(removal) {
|
|
14893
|
+
for (const listener of removalListeners) listener(removal);
|
|
14894
|
+
},
|
|
14895
|
+
onServerRemoved(listener) {
|
|
14896
|
+
removalListeners.add(listener);
|
|
14897
|
+
return () => {
|
|
14898
|
+
removalListeners.delete(listener);
|
|
14899
|
+
};
|
|
14900
|
+
}
|
|
14901
|
+
};
|
|
14902
|
+
}
|
|
14903
|
+
//#endregion
|
|
14904
|
+
//#region ../../default/po-mcp/src/constants/mcp.ts
|
|
14905
|
+
const SERVER_COMMAND_DESCRIPTION = "Show MCP configuration or begin an authorization request.";
|
|
14906
|
+
/** Matched by the hub API, which answers 503. */
|
|
14907
|
+
const VAULT_UNAVAILABLE = "Po's vault is unavailable, so MCP sign-ins cannot be saved.";
|
|
14908
|
+
new RegExp(`${String.fromCharCode(27)}\\[[0-?]*[ -/]*[@-~]`, "gu");
|
|
14909
|
+
/** Session route for one reachable tool's description and schema. */
|
|
14910
|
+
const MCP_SESSION_TOOL_API_PATH = "/tool";
|
|
14911
|
+
const MCP_SESSION_TOOL_SERVER_QUERY = "server";
|
|
14912
|
+
const MCP_SESSION_TOOL_NAME_QUERY = "tool";
|
|
14913
|
+
/** Session route that stores a `${vault:NAME}` secret the session reported missing. */
|
|
14914
|
+
const MCP_SESSION_SECRETS_API_PATH = "/secrets";
|
|
14915
|
+
/** Hub API paths for repository-scoped MCP management. */
|
|
14916
|
+
const MCP_REPOSITORY_API_PATH = "/repository";
|
|
14917
|
+
const MCP_DISCOVERY_API_PATH = "/repository/discover";
|
|
14918
|
+
const MCP_AUTHORIZATION_API_PATH = "/repository/authorize";
|
|
14919
|
+
/** The repository every route is asked about, and the flow segment the two flow routes carry. */
|
|
14920
|
+
const MCP_REPOSITORY_ID_QUERY = "repositoryId";
|
|
14921
|
+
const MCP_FLOW_ID_PARAM = "flowId";
|
|
14922
|
+
/** Adds one server to the repository's `.mcp.json` or to the person's own config. */
|
|
14923
|
+
const MCP_SERVERS_API_PATH = "/servers";
|
|
14924
|
+
/** Lists the servers in the person's own config. */
|
|
14925
|
+
const MCP_GLOBAL_SERVERS_API_PATH = "/servers/global";
|
|
14926
|
+
/** Reads and saves Po-wide MCP preferences. */
|
|
14927
|
+
const MCP_SETTINGS_API_PATH = "/settings";
|
|
14928
|
+
//#endregion
|
|
14929
|
+
//#region ../../default/po-mcp/src/types/apiRoutes.ts
|
|
14930
|
+
/** One authorization flow, addressed by id below the flow collection. */
|
|
14931
|
+
const AUTHORIZATION_FLOW_PATH = `${MCP_AUTHORIZATION_API_PATH}/:${MCP_FLOW_ID_PARAM}`;
|
|
14932
|
+
/**
|
|
14933
|
+
* This package's routes, as data.
|
|
14934
|
+
*
|
|
14935
|
+
* No scope and no base path. The build reads both off
|
|
14936
|
+
* `src/extensions/(backend)/api/mcp/`, so the mount is stated once, by the
|
|
14937
|
+
* folder that creates it. The sub-paths come from `webMcp`, which already owned
|
|
14938
|
+
* them, so this table names where a route sits and nothing else.
|
|
14939
|
+
*
|
|
14940
|
+
* This is the one file the hub handler and the settings panel both read, so a
|
|
14941
|
+
* path cannot move on one side alone. The handler matches on these strings
|
|
14942
|
+
* rather than parsing its own copies of them.
|
|
14943
|
+
*
|
|
14944
|
+
* `:flowId` is the client's parameter syntax; the handler reads the segment off
|
|
14945
|
+
* the same path, so the two cannot disagree about where the id sits.
|
|
14946
|
+
*/
|
|
14947
|
+
const routes = {
|
|
14948
|
+
catalog: {
|
|
14949
|
+
method: "GET",
|
|
14950
|
+
path: MCP_REPOSITORY_API_PATH,
|
|
14951
|
+
query: [MCP_REPOSITORY_ID_QUERY],
|
|
14952
|
+
response: void 0
|
|
14953
|
+
},
|
|
14954
|
+
discover: {
|
|
14955
|
+
method: "POST",
|
|
14956
|
+
path: MCP_DISCOVERY_API_PATH,
|
|
14957
|
+
response: void 0
|
|
14958
|
+
},
|
|
14959
|
+
authorize: {
|
|
14960
|
+
method: "POST",
|
|
14961
|
+
path: MCP_AUTHORIZATION_API_PATH,
|
|
14962
|
+
response: void 0
|
|
14963
|
+
},
|
|
14964
|
+
readAuthorization: {
|
|
14965
|
+
method: "GET",
|
|
14966
|
+
path: AUTHORIZATION_FLOW_PATH,
|
|
14967
|
+
query: [MCP_REPOSITORY_ID_QUERY],
|
|
14968
|
+
response: void 0
|
|
14969
|
+
},
|
|
14970
|
+
/** The same path as `readAuthorization`; the method is the whole of the difference. */
|
|
14971
|
+
cancelAuthorization: {
|
|
14972
|
+
method: "DELETE",
|
|
14973
|
+
path: AUTHORIZATION_FLOW_PATH,
|
|
14974
|
+
query: [MCP_REPOSITORY_ID_QUERY],
|
|
14975
|
+
response: void 0
|
|
14976
|
+
},
|
|
14977
|
+
/** Adds one server to the repository's `.mcp.json` or the person's own config, by the body's scope. */
|
|
14978
|
+
addServer: {
|
|
14979
|
+
method: "POST",
|
|
14980
|
+
path: MCP_SERVERS_API_PATH,
|
|
14981
|
+
response: void 0
|
|
14982
|
+
},
|
|
14983
|
+
editServer: {
|
|
14984
|
+
method: "PATCH",
|
|
14985
|
+
path: MCP_SERVERS_API_PATH,
|
|
14986
|
+
response: void 0
|
|
14987
|
+
},
|
|
14988
|
+
removeServer: {
|
|
14989
|
+
method: "DELETE",
|
|
14990
|
+
path: MCP_SERVERS_API_PATH,
|
|
14991
|
+
response: void 0
|
|
14992
|
+
},
|
|
14993
|
+
globalServers: {
|
|
14994
|
+
method: "GET",
|
|
14995
|
+
path: MCP_GLOBAL_SERVERS_API_PATH,
|
|
14996
|
+
response: void 0
|
|
14997
|
+
},
|
|
14998
|
+
readSettings: {
|
|
14999
|
+
method: "GET",
|
|
15000
|
+
path: MCP_SETTINGS_API_PATH,
|
|
15001
|
+
response: void 0
|
|
15002
|
+
},
|
|
15003
|
+
/** The same path as `readSettings`; saves the body and answers with what was saved. */
|
|
15004
|
+
saveSettings: {
|
|
15005
|
+
method: "PUT",
|
|
15006
|
+
path: MCP_SETTINGS_API_PATH,
|
|
15007
|
+
response: void 0
|
|
15008
|
+
},
|
|
15009
|
+
/** Session scope: one available tool's registered name, description and schema. */
|
|
15010
|
+
sessionTool: {
|
|
15011
|
+
method: "GET",
|
|
15012
|
+
path: MCP_SESSION_TOOL_API_PATH,
|
|
15013
|
+
query: [MCP_SESSION_TOOL_SERVER_QUERY, MCP_SESSION_TOOL_NAME_QUERY],
|
|
15014
|
+
response: void 0
|
|
15015
|
+
},
|
|
15016
|
+
/** Session scope: stores a secret the session reported missing. Owner-only; the value is never echoed. */
|
|
15017
|
+
sessionSecret: {
|
|
15018
|
+
method: "POST",
|
|
15019
|
+
path: MCP_SESSION_SECRETS_API_PATH,
|
|
15020
|
+
response: void 0
|
|
15021
|
+
}
|
|
15022
|
+
};
|
|
15023
|
+
//#endregion
|
|
15024
|
+
//#region ../../default/po-mcp/src/services/mcpHubApi/http.ts
|
|
15025
|
+
/**
|
|
15026
|
+
* What the Node hub API and the edge global API share: JSON bodies and answers, the person's own config
|
|
15027
|
+
* paths, and the approval settings route. None of it touches a filesystem or a process, so both hosts run it.
|
|
15028
|
+
*/
|
|
15029
|
+
const JSON_HEADERS = { "content-type": "application/json" };
|
|
15030
|
+
const MAX_BODY_BYTES = 8192;
|
|
15031
|
+
const MAX_SERVER_NAME = 160;
|
|
15032
|
+
function json(body, status = 200) {
|
|
15033
|
+
return new Response(JSON.stringify(body), {
|
|
15034
|
+
status,
|
|
15035
|
+
headers: JSON_HEADERS
|
|
15036
|
+
});
|
|
15037
|
+
}
|
|
15038
|
+
function isRecord$1(value) {
|
|
15039
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
15040
|
+
}
|
|
15041
|
+
async function bodyOf(request) {
|
|
15042
|
+
const text = await request.text();
|
|
15043
|
+
if (text.length > MAX_BODY_BYTES) return void 0;
|
|
15044
|
+
try {
|
|
15045
|
+
const parsed = JSON.parse(text);
|
|
15046
|
+
return isRecord$1(parsed) ? parsed : void 0;
|
|
15047
|
+
} catch {
|
|
15048
|
+
return;
|
|
15049
|
+
}
|
|
15050
|
+
}
|
|
15051
|
+
function serverNameOf(value) {
|
|
15052
|
+
return typeof value === "string" && value.length > 0 && value.length <= MAX_SERVER_NAME && !Array.from(value).some((character) => character.charCodeAt(0) <= 31) ? value : void 0;
|
|
15053
|
+
}
|
|
15054
|
+
/**
|
|
15055
|
+
* The person's own MCP files under Po's home: their servers and their Po-wide preferences. The hub API writes
|
|
15056
|
+
* them and the saved-state reader reads them, so both take the paths from here. Undefined when the host gave no home.
|
|
15057
|
+
*/
|
|
15058
|
+
function userMcpFilePaths(homeDirectory, environment = {}) {
|
|
15059
|
+
if (!homeDirectory) return void 0;
|
|
15060
|
+
const poHome = poHomeDirectory(homeDirectory, environment);
|
|
15061
|
+
return {
|
|
15062
|
+
config: join(poHome, PO_USER_MCP_CONFIG_FILE),
|
|
15063
|
+
settings: join(poHome, MCP_SETTINGS_FILE)
|
|
15064
|
+
};
|
|
15065
|
+
}
|
|
15066
|
+
/** `<po home>/mcp.json` for the person this hub runs as, or undefined when the host gave no home. */
|
|
15067
|
+
function userConfigPath(context) {
|
|
15068
|
+
return userMcpFilePaths(context.homeDirectory, context.environment)?.config;
|
|
15069
|
+
}
|
|
15070
|
+
function settingsPath(context) {
|
|
15071
|
+
return userMcpFilePaths(context.homeDirectory, context.environment)?.settings;
|
|
15072
|
+
}
|
|
15073
|
+
/** A missing vault, or a VaultError the store raised (matched by code, never by class). */
|
|
15074
|
+
function isVaultUnavailable(error) {
|
|
15075
|
+
if (typeof error === "object" && error !== null && "code" in error && error.code === "unavailable") return true;
|
|
15076
|
+
return error instanceof Error && error.message === "Po's vault is unavailable, so MCP sign-ins cannot be saved.";
|
|
15077
|
+
}
|
|
15078
|
+
/** Reads or saves the approval setting. A file that cannot be read or written is a 500, never an `off` answer. */
|
|
15079
|
+
async function handleSettings(settings, request, context) {
|
|
15080
|
+
const filePath = settingsPath(context);
|
|
15081
|
+
if (!filePath) return json({ error: "Po couldn't find your home directory on this hub." }, 503);
|
|
15082
|
+
try {
|
|
15083
|
+
if (request.method === routes.saveSettings.method) {
|
|
15084
|
+
const body = await bodyOf(request);
|
|
15085
|
+
if (!body || Object.keys(body).length !== 1 || typeof body.autoApproveDestructiveTools !== "boolean") return json({ error: "Send { \"autoApproveDestructiveTools\": true | false }." }, 400);
|
|
15086
|
+
await settings.setAutoApprove(filePath, body.autoApproveDestructiveTools);
|
|
15087
|
+
} else await settings.load(filePath);
|
|
15088
|
+
return json({ autoApproveDestructiveTools: settings.autoApprove() });
|
|
15089
|
+
} catch (error) {
|
|
15090
|
+
return json({ error: `Po couldn't use ${MCP_SETTINGS_FILE}: ${error instanceof Error ? error.message : String(error)}` }, 500);
|
|
15091
|
+
}
|
|
15092
|
+
}
|
|
15093
|
+
/** Every name a client may give the wrapper entry. */
|
|
15094
|
+
const PROXY_SERVER_ALIASES = /* @__PURE__ */ new Set(["mcp-proxy", "agiflow-proxy"]);
|
|
15095
|
+
/** Whether a server name is the proxy wrapper, which Po strips on load instead of connecting. */
|
|
15096
|
+
function isProxyWrapper(name) {
|
|
15097
|
+
return PROXY_SERVER_ALIASES.has(name);
|
|
15098
|
+
}
|
|
15099
|
+
//#endregion
|
|
15100
|
+
//#region ../../default/po-mcp/src/services/mcpServerConfig/index.ts
|
|
15101
|
+
const NAME = /^[A-Za-z0-9_-]{1,64}$/u;
|
|
15102
|
+
const HEADER_NAME = /^[A-Za-z0-9!#$%&'*+.^_`|~-]{1,128}$/u;
|
|
15103
|
+
const ENV_NAME = /^[A-Za-z_][A-Za-z0-9_]{0,127}$/u;
|
|
15104
|
+
const MAX_URL = 2048;
|
|
15105
|
+
const MAX_COMMAND = 1024;
|
|
15106
|
+
const MAX_VALUE = 4096;
|
|
15107
|
+
const MAX_ARGS = 64;
|
|
15108
|
+
const MAX_PAIRS = 64;
|
|
15109
|
+
function isRecord(value) {
|
|
15110
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
15111
|
+
}
|
|
15112
|
+
function refuse(error, status = 400) {
|
|
15113
|
+
return {
|
|
15114
|
+
ok: false,
|
|
15115
|
+
status,
|
|
15116
|
+
error
|
|
15117
|
+
};
|
|
15118
|
+
}
|
|
15119
|
+
function hasControl(value) {
|
|
15120
|
+
return Array.from(value).some((character) => character.charCodeAt(0) <= 31 || character.charCodeAt(0) === 127);
|
|
15121
|
+
}
|
|
15122
|
+
/** Header values and environment values may hold anything but a line break or NUL. */
|
|
15123
|
+
function isPlainValue(value) {
|
|
15124
|
+
return typeof value === "string" && value.length <= MAX_VALUE && !/[\r\n\0]/u.test(value);
|
|
15125
|
+
}
|
|
15126
|
+
function stringPairs(value, keyPattern) {
|
|
15127
|
+
if (value === void 0) return void 0;
|
|
15128
|
+
if (!isRecord(value)) return null;
|
|
15129
|
+
const entries = Object.entries(value);
|
|
15130
|
+
if (entries.length > MAX_PAIRS) return null;
|
|
15131
|
+
for (const [key, item] of entries) if (!keyPattern.test(key) || !isPlainValue(item)) return null;
|
|
15132
|
+
return entries.length > 0 ? Object.fromEntries(entries) : void 0;
|
|
15133
|
+
}
|
|
15134
|
+
function remoteEntry(value) {
|
|
15135
|
+
const url = value.url;
|
|
15136
|
+
if (typeof url !== "string" || url.length > MAX_URL) return refuse("Enter an http or https address.");
|
|
15137
|
+
let protocol;
|
|
15138
|
+
try {
|
|
15139
|
+
protocol = new URL(url).protocol;
|
|
15140
|
+
} catch {
|
|
15141
|
+
return refuse("Enter an http or https address.");
|
|
15142
|
+
}
|
|
15143
|
+
if (protocol !== "https:" && protocol !== "http:") return refuse("Enter an http or https address.");
|
|
15144
|
+
const headers = stringPairs(value.headers, HEADER_NAME);
|
|
15145
|
+
if (headers === null) return refuse("Each header needs a plain name and a one-line value.");
|
|
15146
|
+
return {
|
|
15147
|
+
ok: true,
|
|
15148
|
+
value: {
|
|
15149
|
+
type: "http",
|
|
15150
|
+
url,
|
|
15151
|
+
...headers ? { headers } : {}
|
|
15152
|
+
}
|
|
15153
|
+
};
|
|
15154
|
+
}
|
|
15155
|
+
function localEntry(value, trusted) {
|
|
15156
|
+
const command = typeof value.command === "string" ? value.command.trim() : "";
|
|
15157
|
+
if (command === "" || command.length > MAX_COMMAND || hasControl(command)) return refuse("Enter the command to run.");
|
|
15158
|
+
const args = value.args ?? [];
|
|
15159
|
+
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.");
|
|
15160
|
+
const env = stringPairs(value.env, ENV_NAME);
|
|
15161
|
+
if (env === null) return refuse("Each environment variable needs a NAME and a one-line value.");
|
|
15162
|
+
if (!trusted) return refuse("Confirm that you trust this command before adding it.");
|
|
15163
|
+
return {
|
|
15164
|
+
ok: true,
|
|
15165
|
+
value: {
|
|
15166
|
+
command,
|
|
15167
|
+
args,
|
|
15168
|
+
...env ? { env } : {}
|
|
15169
|
+
}
|
|
15170
|
+
};
|
|
15171
|
+
}
|
|
15172
|
+
/** Checks a server name and entry from the settings UI. Every field is untrusted input. */
|
|
15173
|
+
function parseMcpServerAddition(name, entry, trusted) {
|
|
15174
|
+
if (typeof name !== "string" || !NAME.test(name)) return refuse("Use letters, numbers, dashes or underscores.");
|
|
15175
|
+
if (isProxyWrapper(name)) return refuse(`${name} is reserved for Po's MCP proxy. Choose another name.`);
|
|
15176
|
+
if (!isRecord(entry)) return refuse("Enter a server URL or a command.");
|
|
15177
|
+
const parsed = "command" in entry ? localEntry(entry, trusted === true) : remoteEntry(entry);
|
|
15178
|
+
return parsed.ok ? {
|
|
15179
|
+
ok: true,
|
|
15180
|
+
value: {
|
|
15181
|
+
name,
|
|
15182
|
+
entry: parsed.value
|
|
15183
|
+
}
|
|
15184
|
+
} : parsed;
|
|
15185
|
+
}
|
|
15186
|
+
/**
|
|
15187
|
+
* The document with one server added, every other key kept as it was.
|
|
15188
|
+
* Refuses rather than replaces: a name that exists already stays as the person wrote it.
|
|
15189
|
+
*/
|
|
15190
|
+
function addMcpServer(document, addition, fileLabel) {
|
|
15191
|
+
const config = document === void 0 ? {} : document;
|
|
15192
|
+
if (!isRecord(config)) return refuse(`${fileLabel} isn't a JSON object, so Po left it alone.`, 409);
|
|
15193
|
+
const servers = config.mcpServers ?? {};
|
|
15194
|
+
if (!isRecord(servers)) return refuse(`mcpServers in ${fileLabel} isn't an object, so Po left it alone.`, 409);
|
|
15195
|
+
if (Object.hasOwn(servers, addition.name)) return refuse(`A server named ${addition.name} already exists in ${fileLabel}.`, 409);
|
|
15196
|
+
return {
|
|
15197
|
+
ok: true,
|
|
15198
|
+
value: {
|
|
15199
|
+
...config,
|
|
15200
|
+
mcpServers: {
|
|
15201
|
+
...servers,
|
|
15202
|
+
[addition.name]: addition.entry
|
|
15203
|
+
}
|
|
15204
|
+
}
|
|
15205
|
+
};
|
|
15206
|
+
}
|
|
15207
|
+
/** The servers a config document names, without their headers or environment. */
|
|
15208
|
+
function listMcpServers(document) {
|
|
15209
|
+
const servers = isRecord(document) && isRecord(document.mcpServers) ? document.mcpServers : {};
|
|
15210
|
+
return Object.entries(servers).filter(([name]) => !isProxyWrapper(name)).map(([name, definition]) => {
|
|
15211
|
+
const record = isRecord(definition) ? definition : {};
|
|
15212
|
+
return typeof record.command === "string" ? {
|
|
15213
|
+
name,
|
|
15214
|
+
kind: "local",
|
|
15215
|
+
target: record.command
|
|
15216
|
+
} : {
|
|
15217
|
+
name,
|
|
15218
|
+
kind: "remote",
|
|
15219
|
+
target: safeMcpTarget(record.url)
|
|
15220
|
+
};
|
|
15221
|
+
}).sort((left, right) => left.name.localeCompare(right.name));
|
|
15222
|
+
}
|
|
15223
|
+
/**
|
|
15224
|
+
* The servers a config document names, each with what the person may do to it. A definition that is not an
|
|
15225
|
+
* object is listed but read-only, and an edit that would move a remote server to a new URL is not offered.
|
|
15226
|
+
*/
|
|
15227
|
+
function listManagedMcpServers(document) {
|
|
15228
|
+
const servers = isRecord(document) && isRecord(document.mcpServers) ? document.mcpServers : {};
|
|
15229
|
+
return listMcpServers(document).map((server) => {
|
|
15230
|
+
const definition = servers[server.name];
|
|
15231
|
+
const writable = isRecord(definition);
|
|
15232
|
+
return {
|
|
15233
|
+
...server,
|
|
15234
|
+
management: {
|
|
15235
|
+
owner: writable ? "global" : "read-only",
|
|
15236
|
+
target: server.target,
|
|
15237
|
+
kind: server.kind,
|
|
15238
|
+
canEdit: writable && (server.kind === "local" || server.target === definition.url),
|
|
15239
|
+
canRemove: writable,
|
|
15240
|
+
...writable ? { revision: mcpServerRevision(definition) } : {}
|
|
15241
|
+
}
|
|
15242
|
+
};
|
|
15243
|
+
});
|
|
15244
|
+
}
|
|
15245
|
+
/** Opaque optimistic concurrency identity, including fields never returned to the browser. */
|
|
15246
|
+
function mcpServerRevision(entry) {
|
|
15247
|
+
return createHash("sha256").update(JSON.stringify(entry) ?? "undefined").digest("hex");
|
|
15248
|
+
}
|
|
15249
|
+
/** Changes only one existing entry. Credentials and unknown saved fields stay in place. */
|
|
15250
|
+
function mutateMcpServer(document, name, revision, addition, preserveArgs = false) {
|
|
15251
|
+
if (isProxyWrapper(name) || !isRecord(document) || !isRecord(document.mcpServers)) return refuse("That saved server is not writable. Refresh settings.", 409);
|
|
15252
|
+
const servers = document.mcpServers;
|
|
15253
|
+
if (!Object.hasOwn(servers, name) || !isRecord(servers[name]) || mcpServerRevision(servers[name]) !== revision) return refuse("That saved server changed. Refresh settings before trying again.", 409);
|
|
15254
|
+
const old = servers[name];
|
|
15255
|
+
const next = { ...servers };
|
|
15256
|
+
if (addition) {
|
|
15257
|
+
const entry = addition.entry;
|
|
15258
|
+
if (addition.name !== name) return refuse("A saved server name cannot be changed.");
|
|
15259
|
+
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);
|
|
15260
|
+
const pairs = "command" in entry ? "env" : "headers";
|
|
15261
|
+
const values = entry[pairs];
|
|
15262
|
+
next[name] = {
|
|
15263
|
+
...old,
|
|
15264
|
+
...entry,
|
|
15265
|
+
..."command" in entry && preserveArgs && Array.isArray(old.args) ? { args: old.args } : {},
|
|
15266
|
+
...isRecord(old[pairs]) || isRecord(values) ? { [pairs]: {
|
|
15267
|
+
...isRecord(old[pairs]) ? old[pairs] : {},
|
|
15268
|
+
...isRecord(values) ? values : {}
|
|
15269
|
+
} } : {}
|
|
15270
|
+
};
|
|
15271
|
+
} else delete next[name];
|
|
15272
|
+
return {
|
|
15273
|
+
ok: true,
|
|
15274
|
+
value: {
|
|
15275
|
+
...document,
|
|
15276
|
+
mcpServers: next
|
|
15277
|
+
}
|
|
15278
|
+
};
|
|
15279
|
+
}
|
|
15280
|
+
/** URLs can embed credentials. A read projection never returns userinfo, query or fragment. */
|
|
15281
|
+
function safeMcpTarget(value) {
|
|
15282
|
+
if (typeof value !== "string") return "";
|
|
15283
|
+
try {
|
|
15284
|
+
const url = new URL(value);
|
|
15285
|
+
if (url.username === "" && url.password === "" && url.search === "" && url.hash === "") return value;
|
|
15286
|
+
url.username = "";
|
|
15287
|
+
url.password = "";
|
|
15288
|
+
url.search = "";
|
|
15289
|
+
url.hash = "";
|
|
15290
|
+
return url.toString();
|
|
15291
|
+
} catch {
|
|
15292
|
+
return "";
|
|
15293
|
+
}
|
|
15294
|
+
}
|
|
15295
|
+
//#endregion
|
|
15296
|
+
//#region ../../foundations/po-vault/src/services/localLock/index.ts
|
|
15297
|
+
/**
|
|
15298
|
+
* `Vault.withLock` for a vault whose lock only has to hold inside this process: calls on one name
|
|
15299
|
+
* run one after another, and the op's signal aborts only when the caller's does.
|
|
15300
|
+
*/
|
|
15301
|
+
function createLocalLock() {
|
|
15302
|
+
const locks = /* @__PURE__ */ new Map();
|
|
15303
|
+
return async (namespace, key, op, signal) => {
|
|
15304
|
+
assertEntryName(namespace, key);
|
|
15305
|
+
if (typeof op !== "function") throw new VaultError("invalid");
|
|
15306
|
+
const name = `${namespace}\0${key}`;
|
|
15307
|
+
const previous = locks.get(name) ?? Promise.resolve();
|
|
15308
|
+
let release = () => void 0;
|
|
15309
|
+
const held = new Promise((resolve) => {
|
|
15310
|
+
release = resolve;
|
|
15311
|
+
});
|
|
15312
|
+
const tail = previous.then(() => held);
|
|
15313
|
+
locks.set(name, tail);
|
|
15314
|
+
try {
|
|
15315
|
+
await previous;
|
|
15316
|
+
signal?.throwIfAborted();
|
|
15317
|
+
const controller = new AbortController();
|
|
15318
|
+
const onAbort = () => controller.abort(signal?.reason);
|
|
15319
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
15320
|
+
try {
|
|
15321
|
+
return await op(controller.signal);
|
|
15322
|
+
} finally {
|
|
15323
|
+
signal?.removeEventListener("abort", onAbort);
|
|
15324
|
+
}
|
|
15325
|
+
} finally {
|
|
15326
|
+
release();
|
|
15327
|
+
if (locks.get(name) === tail) locks.delete(name);
|
|
15328
|
+
}
|
|
15329
|
+
};
|
|
15330
|
+
}
|
|
15331
|
+
//#endregion
|
|
15332
|
+
//#region ../../foundations/po-vault/src/services/accountVault/index.ts
|
|
15333
|
+
function isVaultAccountOperation(operation) {
|
|
15334
|
+
return VAULT_ACCOUNT_OPERATIONS.includes(operation);
|
|
15335
|
+
}
|
|
15336
|
+
/** A well-formed answer, or `undefined` for anything else: an unreachable account or a reply from an older cloud. */
|
|
15337
|
+
async function ask(call, operation, input) {
|
|
15338
|
+
let answer;
|
|
15339
|
+
try {
|
|
15340
|
+
answer = await call(operation, input);
|
|
15341
|
+
} catch {
|
|
15342
|
+
return;
|
|
15343
|
+
}
|
|
15344
|
+
if (typeof answer !== "object" || answer === null || typeof answer.ok !== "boolean") return;
|
|
15345
|
+
return answer;
|
|
15346
|
+
}
|
|
15347
|
+
/** Writes can't pretend: no answer, or a refused one, throws with the answer's code. */
|
|
15348
|
+
async function write(call, operation, input) {
|
|
15349
|
+
const answer = await ask(call, operation, input);
|
|
15350
|
+
if (answer === void 0) throw new VaultError("unavailable");
|
|
15351
|
+
if (!answer.ok) throw new VaultError(answer.code);
|
|
15352
|
+
return answer;
|
|
15353
|
+
}
|
|
15354
|
+
/**
|
|
15355
|
+
* The signed-in account's vault over any transport. Names, revisions and value size are checked
|
|
15356
|
+
* here first, so a bad call never leaves the host. Reads that can't reach the account, or that the
|
|
15357
|
+
* account can't serve, answer as if the entry is missing; writes throw `unavailable`. `connected`
|
|
15358
|
+
* tells whether a host is signed in at all.
|
|
15359
|
+
*/
|
|
15360
|
+
function createAccountVault(call, connected = () => true) {
|
|
15361
|
+
return {
|
|
15362
|
+
async get(namespace, key) {
|
|
15363
|
+
assertEntryName(namespace, key);
|
|
15364
|
+
const answer = await ask(call, "vault.get", {
|
|
15365
|
+
namespace,
|
|
15366
|
+
key
|
|
15367
|
+
});
|
|
15368
|
+
if (answer?.ok !== true) {
|
|
15369
|
+
if (answer?.ok === false && answer.code === "invalid") throw new VaultError("invalid");
|
|
15370
|
+
return;
|
|
15371
|
+
}
|
|
15372
|
+
return answer.record;
|
|
15373
|
+
},
|
|
15374
|
+
async put(namespace, key, value, options) {
|
|
15375
|
+
assertEntryName(namespace, key);
|
|
15376
|
+
const expectRevision = options?.expectRevision;
|
|
15377
|
+
if (expectRevision !== void 0 && expectRevision !== null) assertRevision(expectRevision);
|
|
15378
|
+
serializeValue(value);
|
|
15379
|
+
const answer = await write(call, "vault.put", {
|
|
15380
|
+
namespace,
|
|
15381
|
+
key,
|
|
15382
|
+
value,
|
|
15383
|
+
...expectRevision === void 0 ? {} : { expectRevision }
|
|
15384
|
+
});
|
|
15385
|
+
if (answer.record === void 0) throw new VaultError("unavailable");
|
|
15386
|
+
return answer.record;
|
|
15387
|
+
},
|
|
15388
|
+
async delete(namespace, key, options) {
|
|
15389
|
+
assertEntryName(namespace, key);
|
|
15390
|
+
const expectRevision = options?.expectRevision;
|
|
15391
|
+
if (expectRevision !== void 0) assertRevision(expectRevision);
|
|
15392
|
+
await write(call, "vault.delete", {
|
|
15393
|
+
namespace,
|
|
15394
|
+
key,
|
|
15395
|
+
...expectRevision === void 0 ? {} : { expectRevision }
|
|
15396
|
+
});
|
|
15397
|
+
},
|
|
15398
|
+
async list() {
|
|
15399
|
+
const answer = await ask(call, "vault.list", {});
|
|
15400
|
+
return answer?.ok === true ? answer.entries ?? [] : [];
|
|
15401
|
+
},
|
|
15402
|
+
withLock: createLocalLock(),
|
|
15403
|
+
status() {
|
|
15404
|
+
return { backend: connected() ? "account" : void 0 };
|
|
15405
|
+
}
|
|
15406
|
+
};
|
|
15407
|
+
}
|
|
15408
|
+
//#endregion
|
|
15409
|
+
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 };
|