@agimon-ai/po-cloudflare 0.0.2-alpha.7 → 0.0.2-alpha.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -241
- package/container/Dockerfile +27 -0
- package/dist/{BrowserWebSocketTransport-C2SC2VeJ.js → BrowserWebSocketTransport-B4heNdrp.js} +1 -1
- package/dist/{NodeWebSocketTransport-CKilJesa.js → NodeWebSocketTransport-BCiOXUEz.js} +2 -2
- package/dist/{abort-signals-Bkmp_euQ.js → abort-signals-C8CttjsR.js} +1 -1
- package/dist/agent-CEqvgRl6.js +3878 -0
- package/dist/{anthropic-messages-CkYm8M3V.js → anthropic-messages-DCLLLNuM.js} +292 -64
- package/dist/apiContracts-DaOpUHnu.js +1719 -0
- package/dist/{approval-CQ3ZuoTy.js → approval-DXPV7Vm5.js} +15 -2
- package/dist/{approvalPrompt-CylV3C84.js → approvalPrompt-CBaxjb_g.js} +1 -2
- package/dist/approvalSession-C9bg7tPo.js +132 -0
- package/dist/artifactFiles-5KwXIxYf.js +1 -0
- package/dist/artifactsApi-bg2wMYWg.js +200 -0
- package/dist/assets/assets/{CodeEditorView-D4q94XH-.js → CodeEditorView-CfrVwzvL.js} +2 -2
- package/dist/assets/assets/{abnfDiagram-WEYOIA3C-C85p4OYZ.js → abnfDiagram-WEYOIA3C-B80H4Cm4.js} +2 -2
- package/dist/assets/assets/{architecture-WOLXFQ4H-Bt_NOdwE.js → architecture-WOLXFQ4H-Dr4hXaql.js} +1 -1
- package/dist/assets/assets/{architectureDiagram-ZHVYKT53-DzH1GKMm.js → architectureDiagram-ZHVYKT53-DWyt7oXu.js} +2 -2
- package/dist/assets/assets/{blockDiagram-RJAE7QA3-BmWU34j3.js → blockDiagram-RJAE7QA3-OxNTLdmi.js} +2 -2
- package/dist/assets/assets/{c4Diagram-XDPPPE54-BpGOdOuo.js → c4Diagram-XDPPPE54-B4YtcH0s.js} +2 -2
- package/dist/assets/assets/channel-bXj00dGj.js +2 -0
- package/dist/assets/assets/{chunk-2E7WHVMD-AycP1cXU.js → chunk-2E7WHVMD-CD6FFMOX.js} +2 -2
- package/dist/assets/assets/{chunk-4EMNKR2T-DX-DrZzc.js → chunk-4EMNKR2T-CEIoX5oo.js} +2 -2
- package/dist/assets/assets/{chunk-55XCU76K-BdwnLWzI.js → chunk-55XCU76K-CD3t0IJi.js} +2 -2
- package/dist/assets/assets/{chunk-7S6XSTFO-D-RBAwAn.js → chunk-7S6XSTFO-Cyt75UCF.js} +2 -2
- package/dist/assets/assets/{chunk-AQDTSKZB-CCxNNhKs.js → chunk-AQDTSKZB-DRtqYBj9.js} +2 -2
- package/dist/assets/assets/{chunk-DSNLSHJZ-D2hGwWm1.js → chunk-DSNLSHJZ-C8Fx2F8s.js} +2 -2
- package/dist/assets/assets/{chunk-HAGFOTED-BPi-cqGh.js → chunk-HAGFOTED-wOLWRRnd.js} +2 -2
- package/dist/assets/assets/{chunk-HNE4Q36P-D-r1ChHT.js → chunk-HNE4Q36P-CurJg4Hf.js} +2 -2
- package/dist/assets/assets/{chunk-NQOKRVIF-RgmZCAdn.js → chunk-NQOKRVIF-Dzcc5nOG.js} +2 -2
- package/dist/assets/assets/{chunk-UHW7PFBP-B-Hul-rZ.js → chunk-UHW7PFBP-B_ULFf2h.js} +2 -2
- package/dist/assets/assets/{chunk-VQ5W62QI-D1zlXCt8.js → chunk-VQ5W62QI-DH0VY4_p.js} +2 -2
- package/dist/assets/assets/{chunk-WQQL4CDK-CtjIbVJn.js → chunk-WQQL4CDK-DNxfLyXM.js} +2 -2
- package/dist/assets/assets/chunk-XXDRQBXY-B2bMWgN9.js +2 -0
- package/dist/assets/assets/{chunk-YZO67HFG-BQOgXG99.js → chunk-YZO67HFG-COuMUh9U.js} +2 -2
- package/dist/assets/assets/{chunk-ZAUX2LTX-CsDDxmqv.js → chunk-ZAUX2LTX-BJrCnubF.js} +2 -2
- package/dist/assets/assets/{chunk-ZCHMQSOR-deyEYMjx.js → chunk-ZCHMQSOR-D1lFKPtk.js} +2 -2
- package/dist/assets/assets/{classDiagram-v2-4MYWR3UA-DVJHeFlq.js → classDiagram-v2-4MYWR3UA-DfZIbyVL.js} +2 -2
- package/dist/assets/assets/{cose-bilkent-JH36ORCC-ipcN28Fw.js → cose-bilkent-JH36ORCC-CpGhv9_S.js} +2 -2
- package/dist/assets/assets/{cynefin-EF2NZ3EQ-s9ZkPF55.js → cynefin-EF2NZ3EQ-Cxdc6nQl.js} +1 -1
- package/dist/assets/assets/{cynefinDiagram-WF24UDRP-Ksr2qjsS.js → cynefinDiagram-WF24UDRP-qoj0w3lp.js} +2 -2
- package/dist/assets/assets/{dagre-NK4GIZVX-2_Wl-XEW.js → dagre-NK4GIZVX-DL6QbNDS.js} +2 -2
- package/dist/assets/assets/{diagram-CBK3MWTC-C7PeyT7l.js → diagram-CBK3MWTC-CJB3jq1_.js} +2 -2
- package/dist/assets/assets/{diagram-I5XIIV2D-DPYzeKdj.js → diagram-I5XIIV2D-4cPOxCxF.js} +2 -2
- package/dist/assets/assets/{diagram-ODIL2UCW-DHw1cAmn.js → diagram-ODIL2UCW-BG3-jAxE.js} +2 -2
- package/dist/assets/assets/{diagram-PFBEJUXE-C2wA8i-1.js → diagram-PFBEJUXE-Bx8dFaXj.js} +2 -2
- package/dist/assets/assets/{diagram-RJA3I4VV-tM3moCIs.js → diagram-RJA3I4VV-CUUHND91.js} +2 -2
- package/dist/assets/assets/{diagram-TYUNFSNR-CInyJxF7.js → diagram-TYUNFSNR-BDMoN-kr.js} +2 -2
- package/dist/assets/assets/{dist-BDqjNLTC.js → dist-5AxNm-uy.js} +2 -2
- package/dist/assets/assets/{dist-hpZIQBl4.js → dist-9_Rmyj2I.js} +2 -2
- package/dist/assets/assets/{dist-DSLprmec.js → dist-BE3CLKv4.js} +2 -2
- package/dist/assets/assets/{dist-BASEd5LC.js → dist-BfNCu-7x.js} +2 -2
- package/dist/assets/assets/{dist-BuYBvf4F.js → dist-BjI0b36Z.js} +2 -2
- package/dist/assets/assets/{dist-DUS0U_ge.js → dist-CM7b5P9a.js} +2 -2
- package/dist/assets/assets/{dist-CeOy6PjJ.js → dist-Ccxb9U1G.js} +2 -2
- package/dist/assets/assets/{dist-ChXoRSS6.js → dist-CjCWP21A.js} +2 -2
- package/dist/assets/assets/{dist-07dRlnp1.js → dist-DSTAktnR.js} +2 -2
- package/dist/assets/assets/{ebnfDiagram-V4P3TTPT-4nZgqaSt.js → ebnfDiagram-V4P3TTPT-BivOMXZb.js} +2 -2
- package/dist/assets/assets/{elk-QONTBCTQ-nFh54c1Q.js → elk-QONTBCTQ-CrJ1Qpy_.js} +2 -2
- package/dist/assets/assets/{erDiagram-KYQIGQAA-CIQ0_IgZ.js → erDiagram-KYQIGQAA-w9Bqp4sV.js} +2 -2
- package/dist/assets/assets/{eventmodeling-K75KTNOO-Cw4BlbYP.js → eventmodeling-K75KTNOO-CBjFM3kV.js} +1 -1
- package/dist/assets/assets/flowDiagram-IUGLLWBU-C6Fnfgm0.js +1 -0
- package/dist/assets/assets/{ganttDiagram-R7GPNTJY-C97qoUpX.js → ganttDiagram-R7GPNTJY-CsWtGaqD.js} +2 -2
- package/dist/assets/assets/{gitGraph-VSP46ZUC-B8HWVkEX.js → gitGraph-VSP46ZUC-DsBSV9_h.js} +1 -1
- package/dist/assets/assets/{gitGraphDiagram-PDYL7XHY-B4Js56_8.js → gitGraphDiagram-PDYL7XHY-D5GxuYHW.js} +2 -2
- package/dist/assets/assets/index-CNDyKUDF.css +1 -0
- package/dist/assets/assets/index-DWDYnZsq.js +256 -0
- package/dist/assets/assets/{info-OHQRW6UA-A4qythhA.js → info-OHQRW6UA-C7x5dSJu.js} +1 -1
- package/dist/assets/assets/{infoDiagram-MVDRKAX5-BSNwG9yI.js → infoDiagram-MVDRKAX5-CwpI-uAa.js} +2 -2
- package/dist/assets/assets/{ishikawaDiagram-HPEHV2GE-D4gU-3RA.js → ishikawaDiagram-HPEHV2GE-DAa7J5G6.js} +2 -2
- package/dist/assets/assets/{journeyDiagram-BOSHW7O7-CxxDrw7o.js → journeyDiagram-BOSHW7O7-BmiZnxE_.js} +2 -2
- package/dist/assets/assets/{kanban-definition-FNSA4HC5-DUxQv3v0.js → kanban-definition-FNSA4HC5-DUR_mA3L.js} +2 -2
- package/dist/assets/assets/{line-BKODXUmk.js → line-DHY49wSg.js} +2 -2
- package/dist/assets/assets/{linear-Cm5uyUun.js → linear-pTo-a9xT.js} +2 -2
- package/dist/assets/assets/{mermaid-parser.core-CYst2kCg.js → mermaid-parser.core-DMg3hN3T.js} +4 -4
- package/dist/assets/assets/{mermaid.core-B4Qq8SMa.js → mermaid.core-DKtPCltA.js} +5 -5
- package/dist/assets/assets/{mindmap-definition-6OY57UG3-CZFvUTIM.js → mindmap-definition-6OY57UG3-DwTkFbnV.js} +2 -2
- package/dist/assets/assets/{packet-JDAUHWVQ-DZMlaiuy.js → packet-JDAUHWVQ-Tu9TrQ1x.js} +1 -1
- package/dist/assets/assets/{pegDiagram-ECIUJNBX-BjM668dT.js → pegDiagram-ECIUJNBX-B7My4tsz.js} +2 -2
- package/dist/assets/assets/{pie-XZMESJXO-CmpJ6vb8.js → pie-XZMESJXO-QPQm5Gdx.js} +1 -1
- package/dist/assets/assets/{pieDiagram-GNMPY74T-BCA9DCDe.js → pieDiagram-GNMPY74T-Bv-zAD_z.js} +2 -2
- package/dist/assets/assets/{quadrantDiagram-D57K4MC3-CUnpC-Rl.js → quadrantDiagram-D57K4MC3-HTjoGQPd.js} +2 -2
- package/dist/assets/assets/{radar-ABXABTNO-C9x42-KP.js → radar-ABXABTNO-LDBlEoFo.js} +1 -1
- package/dist/assets/assets/{railroad-I3PHUGI6-CLvHKrsC.js → railroad-I3PHUGI6-Dy3_ymgZ.js} +1 -1
- package/dist/assets/assets/{railroad-abnf-LNEFI6M7-B0LGF3gx.js → railroad-abnf-LNEFI6M7-QLVvYs6e.js} +1 -1
- package/dist/assets/assets/{railroad-ebnf-DWYD2UWJ-SKnYapAj.js → railroad-ebnf-DWYD2UWJ-CFRlv9a8.js} +1 -1
- package/dist/assets/assets/{railroad-peg-JR7BVNR7-wsUpPloN.js → railroad-peg-JR7BVNR7-BOlq3d9c.js} +1 -1
- package/dist/assets/assets/{railroadDiagram-Y72NRBL7-BYJtosKO.js → railroadDiagram-Y72NRBL7-Chg32HoU.js} +2 -2
- package/dist/assets/assets/{requirementDiagram-EQYSW5RA-YYdoWMnl.js → requirementDiagram-EQYSW5RA-VenIs_eg.js} +2 -2
- package/dist/assets/assets/{sankeyDiagram-SY24JHO5-DtZyCTdM.js → sankeyDiagram-SY24JHO5-BdByqMKF.js} +2 -2
- package/dist/assets/assets/{sequenceDiagram-BLEHNHQU-BPE8f413.js → sequenceDiagram-BLEHNHQU-D3Do4GJE.js} +2 -2
- package/dist/assets/assets/{src-BNTOLq2G.js → src-DmfN-DA-.js} +2 -2
- package/dist/assets/assets/{stateDiagram-v2-A6IESKWZ-9f8Ow4Fl.js → stateDiagram-v2-A6IESKWZ-CZkRbPlf.js} +2 -2
- package/dist/assets/assets/{swimlanes-B3ENRKFQ-DdAEbxGp.js → swimlanes-B3ENRKFQ-DRTdF9AF.js} +2 -2
- package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-BYr_4JUb.js +9 -0
- package/dist/assets/assets/{timeline-definition-JXYKGLGB-DJNGd2mU.js → timeline-definition-JXYKGLGB-BVcuws_M.js} +2 -2
- package/dist/assets/assets/{treeView-D4JQ5SDB-BHONoCCw.js → treeView-D4JQ5SDB-BLtOJGqO.js} +1 -1
- package/dist/assets/assets/{treemap-SAJKECNS-pOaYkxq7.js → treemap-SAJKECNS-Dn3BWJ4v.js} +1 -1
- package/dist/assets/assets/{usecaseDiagram-WPOLBNNX-C3eDYL9v.js → usecaseDiagram-WPOLBNNX-CBExIKDY.js} +2 -2
- package/dist/assets/assets/{vennDiagram-Q3Y3IDCW-CJi1xfsR.js → vennDiagram-Q3Y3IDCW-C6FIx2L4.js} +2 -2
- package/dist/assets/assets/{wardley-7MLQ67FV-CEy4w7Ir.js → wardley-7MLQ67FV-Cjj2xSBp.js} +1 -1
- package/dist/assets/assets/{wardleyDiagram-IVAIDKWA-DfdLMMpN.js → wardleyDiagram-IVAIDKWA-sQPCBCFK.js} +2 -2
- package/dist/assets/assets/{webpack-v8XGbQTa.js → webpack-DDCA0aDL.js} +2 -2
- package/dist/assets/assets/{xychartDiagram-4URNHDU4-Aw-Ix4uC.js → xychartDiagram-4URNHDU4-bZ4rifSw.js} +2 -2
- package/dist/assets/bundle-asset-policy.json +1 -1
- package/dist/assets/index.html +8 -2
- package/dist/assets/mascot/cta-provider.png +0 -0
- package/dist/assets/mascot/cta-sign-in.png +0 -0
- package/dist/assets/plugins/assets/base-GzIOAd-t.css +2 -0
- package/dist/assets/plugins/assets/browserCaptureWorklet-Droj0fW0-Droj0fW0.js +13 -0
- package/dist/assets/plugins/assets/day-bottom-left-5um-x02r-5um-x02r.webp +0 -0
- package/dist/assets/plugins/assets/day-grain-CvEuNhlI-CvEuNhlI.webp +0 -0
- package/dist/assets/plugins/assets/day-right-C9W-XtjV-C9W-XtjV.webp +0 -0
- package/dist/assets/plugins/assets/day-top-left-B544Eq9J-B544Eq9J.webp +0 -0
- package/dist/assets/plugins/assets/night-bottom-left-N03ST5Uz-N03ST5Uz.webp +0 -0
- package/dist/assets/plugins/assets/night-grain-BY9q-tNN-BY9q-tNN.webp +0 -0
- package/dist/assets/plugins/assets/night-right-C6Denrqj-C6Denrqj.webp +0 -0
- package/dist/assets/plugins/assets/night-top-left-KOou6UxY-KOou6UxY.webp +0 -0
- package/dist/assets/plugins/assets/sileroVadWorker-D894njUe-DjN_BMWf.mjs +110 -0
- package/dist/assets/plugins/assets/silero_vad_v6.2.1-SjbCxFXk-SjbCxFXk.onnx +0 -0
- package/dist/assets/plugins/chunks/po-web-runtime-D8FIos2q.js +1 -0
- package/dist/assets/plugins/chunks/schemas-DVQ8BvvP.js +55 -0
- package/dist/assets/plugins/compositions.json +1 -1
- package/dist/assets/plugins/slots/approval.09e72f36-DxS_uibk.js +2 -0
- package/dist/assets/plugins/slots/artifacts.50b639bb-Cp37TAkd.js +1 -0
- package/dist/assets/plugins/slots/author.ea449ace-Ds9Y-tjN.js +93 -0
- package/dist/assets/plugins/slots/autocompact.6f428144-CDZpN7I7.js +1 -0
- package/dist/assets/plugins/slots/backdrop-bamboo.6e4c928d-qbifuMc6.js +1 -0
- package/dist/assets/plugins/slots/browse.fa1f1a50-CVYvo1M5.js +1 -0
- package/dist/assets/plugins/slots/builtin-tools.75108f21-Cq1ljoL-.js +7 -0
- package/dist/assets/plugins/slots/calendar.d8b70190-BBjpOs1v.js +2 -0
- package/dist/assets/plugins/slots/codemode.c58fb583-DOR6OR7R.js +11 -0
- package/dist/assets/plugins/slots/domain.753f9f92-CJrXxig9.js +1 -0
- package/dist/assets/plugins/slots/edit.804fec90-BFF7_xN9.js +7 -0
- package/dist/assets/plugins/slots/files.66ffc636-CzOlZrRm.js +2 -0
- package/dist/assets/plugins/slots/goal.45dffa01-BtQBp3sw.js +1 -0
- package/dist/assets/plugins/slots/grep.98262cff-9bUDfjyT.js +1 -0
- package/dist/assets/plugins/slots/help.5fbd20f7-B4-y6gYK.js +3 -0
- package/dist/assets/plugins/slots/log.cb964209-BRPa3cVs.js +4 -0
- package/dist/assets/plugins/slots/mcp.82cc1ff5-CFtzPkPC.js +55 -0
- package/dist/assets/plugins/slots/plan.3852ba52-CH59Ff49.js +3 -0
- package/dist/assets/plugins/slots/profile.ab16dcec-0e9fWWyE.js +1 -0
- package/dist/assets/plugins/slots/prompts.ae48c07a-BTqYnBX5.js +38 -0
- package/dist/assets/plugins/slots/read.4560591a-C7fMXDEH.js +1 -0
- package/dist/assets/plugins/slots/runner.6e494d59-CqrpqhW9.js +9 -0
- package/dist/assets/plugins/slots/scaffold.d87a6ee0-9qY5gkYW.js +1 -0
- package/dist/assets/plugins/slots/session-mcp.2be84084-Cf0cqopp.js +2 -0
- package/dist/assets/plugins/slots/sessions.6f47cb4c-B1_eqPJQ.js +1 -0
- package/dist/assets/plugins/slots/skill.62a0a1b3-D-SKX8iw.js +4 -0
- package/dist/assets/plugins/slots/space.65a27e5a-fbLHc-DX.js +1 -0
- package/dist/assets/plugins/slots/subagents.8bb9992c-Cm_YMEnn.js +7 -0
- package/dist/assets/plugins/slots/template-advanced.59f3f98a-L0WOM4JT.js +1 -0
- package/dist/assets/plugins/slots/template-desktop.0f0b8491-By9BZlaL.js +7 -0
- package/dist/assets/plugins/slots/template-elegant.0e3b0acf-El05x7HK.js +1 -0
- package/dist/assets/plugins/slots/vault.3cbfcdc3-DpU_65Wy.js +1 -0
- package/dist/assets/plugins/slots/voice.a952113d-CvcuL__m.js +1 -0
- package/dist/assets/plugins/slots/web-search.65013836-NVh9fdvE.js +1 -0
- package/dist/assets/plugins/slots/workflows.cbc5c5c0-OLKSY9PE.js +16 -0
- package/dist/assets/pwa/pwa.js +12 -12
- package/dist/assets/pwa/sw.js +58 -4
- package/dist/{atomicJson-wczZBXQP.js → atomicJson-XYtxz032.js} +2 -3
- package/dist/{azure-openai-config-DHMgdIa-.js → azure-openai-config-S-quxzTC.js} +2 -2
- package/dist/{azure-openai-responses-CTgRdQ4m.js → azure-openai-responses-DdpV5zh7.js} +13 -13
- package/dist/backgroundWork-Bv0ib_lY.js +49 -0
- package/dist/{layeredConfig-xmTHGrw8.js → browser-DwY5dXHX.js} +21 -983
- package/dist/{browser-EJ5_ffnN.js → browser-IsHIcvFg.js} +1 -1
- package/dist/browser-ks_k-6KA.js +36 -0
- package/dist/calendarSetup-CI3AACVo.js +3892 -0
- package/dist/childProcess-Cv8rJuUf.js +32 -0
- package/dist/childSession-BrDCrNtL.js +25 -0
- package/dist/{classifier-shared-jXm-plIK.js → classifier-shared-DFprgrML.js} +5 -5
- package/dist/{cloudflare-workers-ai-system-one-B0wH6HU5.js → cloudflare-workers-ai-system-one-B0MD19yZ.js} +3 -3
- package/dist/{codemode-CFVDmyGm.js → codemode-LpcMFMYM.js} +1 -1
- package/dist/coerce-DM9YrILC.js +13 -0
- package/dist/config-DeWkdjj7.js +1372 -0
- package/dist/contextContributions-C1bsEJef.js +13 -0
- package/dist/contracts-CW8o6Xyi.js +19 -0
- package/dist/contracts-WRa9e98H.js +40 -0
- package/dist/cordisHost-_-jtkneB.js +25 -0
- package/dist/delegation-B2rBgv8A.js +100 -0
- package/dist/{diagnostics-DPTP-yrt.js → diagnostics-BY5LXbHJ.js} +2 -2
- package/dist/{dist-BVBi6VMV.js → dist-B2ArMqge.js} +1 -1
- package/dist/{server-Cg07O2W6.js → dist-C6IqjC-m.js} +1 -546
- package/dist/{dist-PDDFdqDX.js → dist-CDz5dYMj.js} +1 -1
- package/dist/{dist-Dvx5mlIR.js → dist-kgi2Ix1y.js} +16 -3
- package/dist/{emscripten-module.cloudflare-D4Bc9Ykz.js → emscripten-module.cloudflare-B4fhfquU.js} +1 -1
- package/dist/{env-api-keys-CAnjjnsR.js → env-api-keys-BgCPpU9t.js} +1 -1
- package/dist/{error-body-DQZRsyL5.js → error-body-CeumezyR.js} +26 -4
- package/dist/esm-BKJy3O9-.js +1553 -0
- package/dist/{remoteMcp-DqE2xFWS.js → exports-BEEgtkya.js} +1588 -714
- package/dist/{exports-LjvSY7Y6.js → exports-CBp_9dVk.js} +47 -28
- package/dist/exports-CRjRvvX0.js +34 -0
- package/dist/exports-Cg0wxflf.js +1 -0
- package/dist/exports-Ct56PRB9.js +46 -0
- package/dist/extensionFile-B940JOEn.js +121 -0
- package/dist/{factory-Cs8iaUtc.js → factory-BU0cZY0I.js} +1 -1
- package/dist/{github-copilot-headers-DpQQAh-s.js → github-copilot-headers-Cq9pnpl2.js} +1 -1
- package/dist/{google-generative-ai-BTTOo5RQ.js → google-generative-ai-DmbUlCGv.js} +9 -9
- package/dist/{google-shared-S7bqOccz.js → google-shared-Diz2uk39.js} +6 -6
- package/dist/{google-vertex-BcMU_DMb.js → google-vertex-CGCpI9Po.js} +10 -10
- package/dist/{domains-B6Ae4swm.js → harnessState-Df--jB5z.js} +162 -42
- package/dist/{harnessStore-Ccbia9_u.js → harnessStore-DInwiLYb.js} +4 -5
- package/dist/{hash-B3RRpLS2.js → hash-IQBoLxOB.js} +1 -1
- package/dist/{headers-BEuxFxDI.js → headers-Dkgiqogr.js} +1 -1
- package/dist/help-C9UGKetC.js +100 -0
- package/dist/home-kwZFHqOx.js +60 -0
- package/dist/http-BekstF5S.js +64 -0
- package/dist/hubChannel-Dldv3EEb.js +32 -0
- package/dist/hubRevisions-BPoC6quI.js +364 -0
- package/dist/{identity-BIeAyilV.js → identity-BzB1N-Sn.js} +3 -3
- package/dist/index.edge-BiVQ9LoZ.js +198 -0
- package/dist/index.edge-CSGx6QOL.js +56 -0
- package/dist/index.edge-ClLTmPFz.js +191 -0
- package/dist/index.edge-CzoLWbyl.js +238 -0
- package/dist/index.edge-D1biKw71.js +946 -0
- package/dist/index.edge-D2RirEwK.js +14 -0
- package/dist/iso-BGFmgtky.js +27 -0
- package/dist/{kysely-adapter-D51abb3q.js → kysely-adapter-D8KUrWxm.js} +1 -1
- package/dist/liquid.browser-1BcykmIN.js +4596 -0
- package/dist/manualTranscription-DN56fzgj.js +96 -0
- package/dist/{mcpProjection-BXiECnW0.js → mcpProjection-D2U50Pel.js} +1 -2
- package/dist/meta-CVgfTHQP.js +1030 -0
- package/dist/migrations-DJBPDwSR.js +32 -0
- package/dist/{mistral-conversations-DN8VSERk.js → mistral-conversations-Bv_m1MRF.js} +12 -12
- package/dist/modeDefinition-Di95_IiU.js +44 -0
- package/dist/{models-D6d73jcW.js → models-D50yN8Ag.js} +41 -46
- package/dist/{node-UuMT2C3q.js → node-B4kSjHeD.js} +2 -2
- package/dist/{node-DytJOfYf.js → node-CBLSc-YH.js} +1 -1
- package/dist/notification-DjxbNoMR.js +143 -0
- package/dist/{openai-bt3ZRBZv.js → openai-D6Q-l6hT.js} +187 -187
- package/dist/{openai-codex-responses-cL36x0ml.js → openai-codex-responses-BnoiTqYV.js} +21 -25
- package/dist/{openai-completions-BWsTNYyT.js → openai-completions-C68qs5rI.js} +26 -19
- package/dist/{openai-decisions-Dfn_KgQd.js → openai-decisions-BSxU_aoV.js} +3 -3
- package/dist/{openai-responses-aa0LoyCJ.js → openai-responses-D6hXen-k.js} +17 -15
- package/dist/{openai-responses-shared-H-jH5SlM.js → openai-responses-shared-BD8K7FAC.js} +7 -7
- package/dist/{openrouter-cost-D99Qqcs6.js → openrouter-cost-BPam8wyW.js} +1 -1
- package/dist/{openrouter-images-BpwVpALC.js → openrouter-images-DylXiHy7.js} +7 -7
- package/dist/{hubChannel-Dn5NMpvu.js → packageApi-DYkaxP59.js} +33 -42
- package/dist/photon_rs_bg.wasm +0 -0
- package/dist/{pi-messages-BHAIkYBj.js → pi-messages-DaIlYYlO.js} +6 -6
- package/dist/piConfig-5tRPD0ov.js +126 -0
- package/dist/piSettings-ekBG5OeF.js +1 -0
- package/dist/platform-CQahdzpG.js +138 -0
- package/dist/pluginCatalog-BAALyedS.js +30 -0
- package/dist/pluginContributions-Be9EnCAW.js +16 -0
- package/dist/pluginProtocol-7_gVUeM9.js +1 -0
- package/dist/pluginProtocol-DVIfJnav.js +135 -0
- package/dist/portableConfig-0tnk9anb.js +49 -0
- package/dist/presetConfig-n-oiNd3h.js +541 -0
- package/dist/profileSources-D1rymC97.js +537 -0
- package/dist/{protocol-DUeE0Q8z.js → protocol-Cri0GpZR.js} +1 -2
- package/dist/{provider-env-DgfpjgTa.js → provider-env-DJb40UF7.js} +2 -2
- package/dist/{provider-retry-ChD-K2Gv.js → provider-retry-jpvs7ixx.js} +1 -1
- package/dist/{puppeteer-cloudflare-B-GHrPGO.js → puppeteer-cloudflare-D4l8smMS.js} +3 -3
- package/dist/{server-BWJmxCrm.js → readiness-Ydw5zrKy.js} +4 -169
- package/dist/{rolldown-runtime-B-lAHAz2.js → rolldown-runtime-DbVrKiKs.js} +1 -1
- package/dist/{sanitize-unicode-Dl4ROF7y.js → sanitize-unicode-B1ZFaEtf.js} +1 -1
- package/dist/scaffoldRegistry-CeFe3Pf0.js +1240 -0
- package/dist/{schemas-Vj8-rCR4.js → schemas-D2dRon18.js} +1901 -53
- package/dist/server-AKM07WcM.js +466 -0
- package/dist/server-B0tM5Ygf.js +1300 -0
- package/dist/server-B8-vStCx.js +1116 -0
- package/dist/server-BAbdiL38.js +15108 -0
- package/dist/server-BCZ_R3kX.js +3326 -0
- package/dist/server-BGKAeB3M.js +492 -0
- package/dist/server-BIQhg1jS.js +26985 -0
- package/dist/server-BcPD_6a2.js +1533 -0
- package/dist/server-BeoA0QB-.js +580 -0
- package/dist/server-BsgvOpBF.js +24 -0
- package/dist/server-BtnOqSB5.js +156 -0
- package/dist/server-C-HBjWRo.js +2800 -0
- package/dist/{server-CWg0m_wq.js → server-C0Lt6nTt.js} +269 -1062
- package/dist/server-C8NPfG1H.js +148 -0
- package/dist/server-CKkaxOc0.js +978 -0
- package/dist/server-CMaWF5UA.js +1379 -0
- package/dist/server-CQPI6jIa.js +295 -0
- package/dist/{server-BhYE7Vqk.js → server-CQmb0lYL.js} +114 -176
- package/dist/server-CWR34Vx6.js +1884 -0
- package/dist/server-CZiAy2v5.js +641 -0
- package/dist/server-Cjtr0oVJ.js +584 -0
- package/dist/server-CkJQJ3Oo.js +571 -0
- package/dist/server-ClQQGtsI.js +679 -0
- package/dist/server-Cy2FhGBm.js +1744 -0
- package/dist/server-D8yEblCB.js +24 -0
- package/dist/server-DF0YIUeI.js +9603 -0
- package/dist/server-DRFESCq1.js +1527 -0
- package/dist/{server-zkcrP99W.js → server-Df1defzp.js} +89 -87
- package/dist/server-DgZd_TuT.js +189 -0
- package/dist/server-Dkc9Kth2.js +1830 -0
- package/dist/server-DlRePYOB.js +343 -0
- package/dist/{server-BpPEzRes.js → server-_HZm8wEC.js} +654 -745
- package/dist/{server-yABhJa2K.js → server-_jWkMESg.js} +60 -39
- package/dist/server-lgV6liTt.js +140 -0
- package/dist/server-nHPXbRDA.js +742 -0
- package/dist/server-p7qANgrf.js +877 -0
- package/dist/server-vhmQi3co.js +112 -0
- package/dist/{server-SA0dsIJ2.js → server-w1aKMZOs.js} +3 -10
- package/dist/serverPlugin-4nI5J6Zt.js +39622 -0
- package/dist/session-resources-BvR3cwiH.js +10 -0
- package/dist/{sessionConfig-DgnPcGBu.js → sessionConfig-UMlgu98q.js} +926 -844
- package/dist/{simple-options-DWrW31_K.js → simple-options-Cp5p46f9.js} +13 -6
- package/dist/space-C3Wnli1l.js +92 -0
- package/dist/sse-XlzXs1es.js +151 -0
- package/dist/{streaming-json-t4rzNHEp.js → streaming-json-CZyrX_Ux.js} +6 -6
- package/dist/{system-one-shared-DLVLdzYL.js → system-one-shared-Du6bka0h.js} +3 -3
- package/dist/{notification-valMY1zH.js → telemetry-CrTcxeA5.js} +2 -93
- package/dist/{transform-messages-CjTSwW9q.js → transform-messages-CBj9g2mx.js} +3 -16
- package/dist/truncate-M3KbFyVj.js +89 -0
- package/dist/{server-BXjfQYeU.js → type-DppaYz6F.js} +955 -1187
- package/dist/type-yokaDI_F.js +7 -0
- package/dist/{typesafe-system-one-DBVcjcUQ.js → typesafe-system-one-C7YFgvrX.js} +3 -3
- package/dist/{uuid-mkNGilLv.js → uuid-BVI0BZsx.js} +1 -1
- package/dist/{validation-BLnxgJU_.js → validation-QWuk6kwJ.js} +79 -74
- package/dist/vaultSettings-Bq8wkbDv.js +292 -0
- package/dist/voiceTools-BdJyfzwB.js +246 -0
- package/dist/web-B2sdV-F2.js +4 -0
- package/dist/worker.js +97821 -72579
- package/dist/workflow-DTCt4n6k.js +171 -0
- package/dist/workflowServices-RlswfHWp.js +300 -0
- package/package.json +55 -25
- package/wrangler.jsonc +16 -3
- package/dist/apiContracts-sG5b90Qa.js +0 -4451
- package/dist/assets/assets/channel-BOT7In0s.js +0 -2
- package/dist/assets/assets/chunk-XXDRQBXY-Dp9-QbR6.js +0 -2
- package/dist/assets/assets/flowDiagram-IUGLLWBU-B9D9uWwn.js +0 -1
- package/dist/assets/assets/index-BlPEYpuN.css +0 -1
- package/dist/assets/assets/index-DS9w_Q1B.js +0 -155
- package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-CyUKtW7v.js +0 -9
- package/dist/assets/plugins/assets/base-DyDpY0zD.css +0 -2
- package/dist/assets/plugins/chunks/po-web-runtime-4JiBsb_c.js +0 -1
- package/dist/assets/plugins/slots/approval.09e72f36-DwFz-UMh.js +0 -2
- package/dist/assets/plugins/slots/artifacts.50b639bb-CUtFC806.js +0 -1
- package/dist/assets/plugins/slots/builtin-tools.75108f21-B69GLfY_.js +0 -7
- package/dist/assets/plugins/slots/codemode.c58fb583-C0Gmb7_s.js +0 -9
- package/dist/assets/plugins/slots/domain.753f9f92-BTBYRLkE.js +0 -1
- package/dist/assets/plugins/slots/mcp.82cc1ff5-Ecacjn0a.js +0 -109
- package/dist/assets/plugins/slots/profile.ab16dcec-DIVXNHmh.js +0 -1
- package/dist/assets/plugins/slots/skill.62a0a1b3-BNr7DmPH.js +0 -4
- package/dist/backgroundWork-CSpsJ-Rg.js +0 -25
- package/dist/contextProjection-DDIQRgN4.js +0 -188
- package/dist/extensionFile-CacKVegY.js +0 -409
- package/dist/harnessState-gmzJcPGt.js +0 -88
- package/dist/harnessStore-Ch6hdYYe.js +0 -1
- package/dist/index.edge-BgSx_gRO.js +0 -45
- package/dist/majorModes-CCnwAjfF.js +0 -333
- package/dist/majorModes-DNQbxkpt.js +0 -1
- package/dist/piSettings-B6fsgIBA.js +0 -1
- package/dist/platform-Bs2_X_dK.js +0 -16
- package/dist/platformFiles-CCGujP9o.js +0 -39
- package/dist/server-5hLs7M43.js +0 -656
- package/dist/server-B3iqBHOP.js +0 -118
- package/dist/server-Dv0EKLwc.js +0 -108
- package/dist/server-Y5A21sJf.js +0 -591
- package/dist/server-a1K226XK.js +0 -279
- package/dist/serverPlugin-DUc4gGep.js +0 -7279
- package/dist/value-Bd477RDX.js +0 -2247
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { V as Check, _t as BACKGROUND_CONTEXT, c as poHomeDirectory, sn as defineServiceContract } from "./serverPlugin-4nI5J6Zt.js";
|
|
2
|
+
import { f as readTextIfExists, h as writeFileAtomic } from "./platform-CQahdzpG.js";
|
|
3
|
+
import "./piSettings-ekBG5OeF.js";
|
|
4
|
+
import { A as optional, B as safeParse, E as looseObject, F as string, I as union, L as unknown, M as record$2, O as number, Ot as NEVER, R as url, T as literal, V as toJSONSchema, b as intersection, d as _null, h as boolean, j as preprocess, k as object, m as array, p as any, u as _enum, v as discriminatedUnion, w as lazy, y as email } from "./schemas-D2dRon18.js";
|
|
5
|
+
import { n as datetime, t as date$1 } from "./iso-BGFmgtky.js";
|
|
6
|
+
import { n as number$1 } from "./coerce-DM9YrILC.js";
|
|
7
|
+
import { r as PO_USER_MCP_CONFIG_FILE } from "./mcpProjection-D2U50Pel.js";
|
|
8
|
+
import "./contracts-WRa9e98H.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,6 +101,25 @@ function guardedFetch(options) {
|
|
|
94
101
|
};
|
|
95
102
|
}
|
|
96
103
|
//#endregion
|
|
104
|
+
//#region ../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/compat.js
|
|
105
|
+
/** @deprecated Use the raw string literal codes instead, e.g. "invalid_type". */
|
|
106
|
+
const ZodIssueCode = {
|
|
107
|
+
invalid_type: "invalid_type",
|
|
108
|
+
too_big: "too_big",
|
|
109
|
+
too_small: "too_small",
|
|
110
|
+
invalid_format: "invalid_format",
|
|
111
|
+
not_multiple_of: "not_multiple_of",
|
|
112
|
+
unrecognized_keys: "unrecognized_keys",
|
|
113
|
+
invalid_union: "invalid_union",
|
|
114
|
+
invalid_key: "invalid_key",
|
|
115
|
+
invalid_element: "invalid_element",
|
|
116
|
+
invalid_value: "invalid_value",
|
|
117
|
+
custom: "custom"
|
|
118
|
+
};
|
|
119
|
+
/** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
|
|
120
|
+
var ZodFirstPartyTypeKind;
|
|
121
|
+
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
122
|
+
//#endregion
|
|
97
123
|
//#region ../../../node_modules/.pnpm/@modelcontextprotocol+client@2.3.1/node_modules/@modelcontextprotocol/client/dist/chunk-Br0eD_fh.mjs
|
|
98
124
|
var __create = Object.create;
|
|
99
125
|
var __defProp = Object.defineProperty;
|
|
@@ -157,46 +183,9 @@ function declaredDialect(schema, remedy) {
|
|
|
157
183
|
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
184
|
}
|
|
159
185
|
//#endregion
|
|
160
|
-
//#region ../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/compat.js
|
|
161
|
-
/** @deprecated Use the raw string literal codes instead, e.g. "invalid_type". */
|
|
162
|
-
const ZodIssueCode = {
|
|
163
|
-
invalid_type: "invalid_type",
|
|
164
|
-
too_big: "too_big",
|
|
165
|
-
too_small: "too_small",
|
|
166
|
-
invalid_format: "invalid_format",
|
|
167
|
-
not_multiple_of: "not_multiple_of",
|
|
168
|
-
unrecognized_keys: "unrecognized_keys",
|
|
169
|
-
invalid_union: "invalid_union",
|
|
170
|
-
invalid_key: "invalid_key",
|
|
171
|
-
invalid_element: "invalid_element",
|
|
172
|
-
invalid_value: "invalid_value",
|
|
173
|
-
custom: "custom"
|
|
174
|
-
};
|
|
175
|
-
/** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
|
|
176
|
-
var ZodFirstPartyTypeKind;
|
|
177
|
-
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
178
|
-
//#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
|
-
//#region ../../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/coerce.js
|
|
188
|
-
function string(params) {
|
|
189
|
-
return _coercedString(ZodString, params);
|
|
190
|
-
}
|
|
191
|
-
function number(params) {
|
|
192
|
-
return _coercedNumber(ZodNumber, params);
|
|
193
|
-
}
|
|
194
|
-
function boolean(params) {
|
|
195
|
-
return _coercedBoolean(ZodBoolean, params);
|
|
196
|
-
}
|
|
197
|
-
//#endregion
|
|
198
186
|
//#region ../../../node_modules/.pnpm/@modelcontextprotocol+core@2.3.1/node_modules/@modelcontextprotocol/core/dist/auth-BNDyLTqp.mjs
|
|
199
187
|
const LATEST_PROTOCOL_VERSION = "2025-11-25";
|
|
188
|
+
const DEFAULT_NEGOTIATED_PROTOCOL_VERSION = "2025-03-26";
|
|
200
189
|
const SUPPORTED_PROTOCOL_VERSIONS = [
|
|
201
190
|
LATEST_PROTOCOL_VERSION,
|
|
202
191
|
"2025-06-18",
|
|
@@ -262,32 +251,32 @@ const SUBSCRIPTION_ID_META_KEY = "io.modelcontextprotocol/subscriptionId";
|
|
|
262
251
|
*/
|
|
263
252
|
const LOG_LEVEL_META_KEY = "io.modelcontextprotocol/logLevel";
|
|
264
253
|
const JSONValueSchema = lazy(() => union([
|
|
265
|
-
string
|
|
266
|
-
number
|
|
267
|
-
boolean
|
|
254
|
+
string(),
|
|
255
|
+
number(),
|
|
256
|
+
boolean(),
|
|
268
257
|
_null(),
|
|
269
|
-
record$
|
|
258
|
+
record$2(string(), JSONValueSchema),
|
|
270
259
|
array(JSONValueSchema)
|
|
271
260
|
]));
|
|
272
|
-
const JSONObjectSchema = record$
|
|
261
|
+
const JSONObjectSchema = record$2(string(), JSONValueSchema);
|
|
273
262
|
const JSONArraySchema = array(JSONValueSchema);
|
|
274
263
|
/**
|
|
275
264
|
* A progress token, used to associate progress notifications with the original request.
|
|
276
265
|
*/
|
|
277
|
-
const ProgressTokenSchema = union([string
|
|
266
|
+
const ProgressTokenSchema = union([string(), number().int()]);
|
|
278
267
|
/**
|
|
279
268
|
* An opaque token used to represent a cursor for pagination.
|
|
280
269
|
*/
|
|
281
|
-
const CursorSchema = string
|
|
270
|
+
const CursorSchema = string();
|
|
282
271
|
/** @deprecated 2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only. */
|
|
283
|
-
const TaskMetadataSchema = object({ ttl: number
|
|
272
|
+
const TaskMetadataSchema = object({ ttl: number().optional() });
|
|
284
273
|
/**
|
|
285
274
|
* Metadata for associating messages with a task.
|
|
286
275
|
* Include this in the `_meta` field under the key `io.modelcontextprotocol/related-task`.
|
|
287
276
|
*
|
|
288
277
|
* @deprecated 2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only.
|
|
289
278
|
*/
|
|
290
|
-
const RelatedTaskMetadataSchema = object({ taskId: string
|
|
279
|
+
const RelatedTaskMetadataSchema = object({ taskId: string() });
|
|
291
280
|
const RequestMetaSchema = looseObject({
|
|
292
281
|
progressToken: ProgressTokenSchema.optional(),
|
|
293
282
|
[RELATED_TASK_META_KEY]: RelatedTaskMetadataSchema.optional()
|
|
@@ -303,12 +292,12 @@ const BaseRequestParamsSchema = object({ _meta: RequestMetaSchema.optional() });
|
|
|
303
292
|
*/
|
|
304
293
|
const TaskAugmentedRequestParamsSchema = BaseRequestParamsSchema.extend({ task: TaskMetadataSchema.optional() });
|
|
305
294
|
const RequestSchema = object({
|
|
306
|
-
method: string
|
|
295
|
+
method: string(),
|
|
307
296
|
params: BaseRequestParamsSchema.loose().optional()
|
|
308
297
|
});
|
|
309
298
|
const NotificationsParamsSchema = object({ _meta: RequestMetaSchema.optional() });
|
|
310
299
|
const NotificationSchema = object({
|
|
311
|
-
method: string
|
|
300
|
+
method: string(),
|
|
312
301
|
params: NotificationsParamsSchema.loose().optional()
|
|
313
302
|
});
|
|
314
303
|
/**
|
|
@@ -327,7 +316,7 @@ const ResultSchema = looseObject({ _meta: ResultMetaObjectSchema.optional() });
|
|
|
327
316
|
/**
|
|
328
317
|
* A uniquely identifying ID for a request in JSON-RPC.
|
|
329
318
|
*/
|
|
330
|
-
const RequestIdSchema = union([string
|
|
319
|
+
const RequestIdSchema = union([string(), number().int()]);
|
|
331
320
|
/**
|
|
332
321
|
* A request that expects a response.
|
|
333
322
|
*/
|
|
@@ -358,8 +347,8 @@ const JSONRPCErrorResponseSchema = object({
|
|
|
358
347
|
jsonrpc: literal("2.0"),
|
|
359
348
|
id: RequestIdSchema.optional(),
|
|
360
349
|
error: object({
|
|
361
|
-
code: number
|
|
362
|
-
message: string
|
|
350
|
+
code: number().int(),
|
|
351
|
+
message: string(),
|
|
363
352
|
data: unknown().optional()
|
|
364
353
|
})
|
|
365
354
|
}).strict();
|
|
@@ -376,7 +365,7 @@ const JSONRPCResponseSchema = union([JSONRPCResultResponseSchema, JSONRPCErrorRe
|
|
|
376
365
|
const EmptyResultSchema = ResultSchema.strict();
|
|
377
366
|
const CancelledNotificationParamsSchema = NotificationsParamsSchema.extend({
|
|
378
367
|
requestId: RequestIdSchema.optional(),
|
|
379
|
-
reason: string
|
|
368
|
+
reason: string().optional()
|
|
380
369
|
});
|
|
381
370
|
/**
|
|
382
371
|
* This notification can be sent by either side to indicate that it is cancelling a previously-issued request.
|
|
@@ -395,9 +384,9 @@ const CancelledNotificationSchema = NotificationSchema.extend({
|
|
|
395
384
|
* Icon schema for use in {@link Tool | tools}, {@link Prompt | prompts}, {@link Resource | resources}, and {@link Implementation | implementations}.
|
|
396
385
|
*/
|
|
397
386
|
const IconSchema = object({
|
|
398
|
-
src: string
|
|
399
|
-
mimeType: string
|
|
400
|
-
sizes: array(string
|
|
387
|
+
src: string(),
|
|
388
|
+
mimeType: string().optional(),
|
|
389
|
+
sizes: array(string()).optional(),
|
|
401
390
|
theme: _enum(["light", "dark"]).optional()
|
|
402
391
|
});
|
|
403
392
|
/**
|
|
@@ -409,8 +398,8 @@ const IconsSchema = object({ icons: array(IconSchema).optional() });
|
|
|
409
398
|
* Base metadata interface for common properties across {@link Resource | resources}, {@link Tool | tools}, {@link Prompt | prompts}, and {@link Implementation | implementations}.
|
|
410
399
|
*/
|
|
411
400
|
const BaseMetadataSchema = object({
|
|
412
|
-
name: string
|
|
413
|
-
title: string
|
|
401
|
+
name: string(),
|
|
402
|
+
title: string().optional()
|
|
414
403
|
});
|
|
415
404
|
/**
|
|
416
405
|
* Describes the name and version of an MCP implementation.
|
|
@@ -418,11 +407,11 @@ const BaseMetadataSchema = object({
|
|
|
418
407
|
const ImplementationSchema = BaseMetadataSchema.extend({
|
|
419
408
|
...BaseMetadataSchema.shape,
|
|
420
409
|
...IconsSchema.shape,
|
|
421
|
-
version: string
|
|
422
|
-
websiteUrl: string
|
|
423
|
-
description: string
|
|
410
|
+
version: string(),
|
|
411
|
+
websiteUrl: string().optional(),
|
|
412
|
+
description: string().optional()
|
|
424
413
|
});
|
|
425
|
-
const FormElicitationCapabilitySchema = intersection(object({ applyDefaults: boolean
|
|
414
|
+
const FormElicitationCapabilitySchema = intersection(object({ applyDefaults: boolean().optional() }), JSONObjectSchema);
|
|
426
415
|
const ElicitationCapabilitySchema = preprocess((value) => {
|
|
427
416
|
if (value && typeof value === "object" && !Array.isArray(value) && Object.keys(value).length === 0) return { form: {} };
|
|
428
417
|
return value;
|
|
@@ -457,18 +446,18 @@ const ServerTasksCapabilitySchema = looseObject({
|
|
|
457
446
|
* 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
447
|
*/
|
|
459
448
|
const ClientCapabilitiesSchema = object({
|
|
460
|
-
experimental: record$
|
|
449
|
+
experimental: record$2(string(), JSONObjectSchema).optional(),
|
|
461
450
|
sampling: object({
|
|
462
451
|
context: JSONObjectSchema.optional(),
|
|
463
452
|
tools: JSONObjectSchema.optional()
|
|
464
453
|
}).optional(),
|
|
465
454
|
elicitation: ElicitationCapabilitySchema.optional(),
|
|
466
|
-
roots: object({ listChanged: boolean
|
|
455
|
+
roots: object({ listChanged: boolean().optional() }).optional(),
|
|
467
456
|
tasks: ClientTasksCapabilitySchema.optional(),
|
|
468
|
-
extensions: record$
|
|
457
|
+
extensions: record$2(string(), JSONObjectSchema).optional()
|
|
469
458
|
});
|
|
470
459
|
const InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
471
|
-
protocolVersion: string
|
|
460
|
+
protocolVersion: string(),
|
|
472
461
|
capabilities: ClientCapabilitiesSchema,
|
|
473
462
|
clientInfo: ImplementationSchema
|
|
474
463
|
});
|
|
@@ -483,26 +472,26 @@ const InitializeRequestSchema = RequestSchema.extend({
|
|
|
483
472
|
* 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
473
|
*/
|
|
485
474
|
const ServerCapabilitiesSchema = object({
|
|
486
|
-
experimental: record$
|
|
475
|
+
experimental: record$2(string(), JSONObjectSchema).optional(),
|
|
487
476
|
logging: JSONObjectSchema.optional(),
|
|
488
477
|
completions: JSONObjectSchema.optional(),
|
|
489
|
-
prompts: object({ listChanged: boolean
|
|
478
|
+
prompts: object({ listChanged: boolean().optional() }).optional(),
|
|
490
479
|
resources: object({
|
|
491
|
-
subscribe: boolean
|
|
492
|
-
listChanged: boolean
|
|
480
|
+
subscribe: boolean().optional(),
|
|
481
|
+
listChanged: boolean().optional()
|
|
493
482
|
}).optional(),
|
|
494
|
-
tools: object({ listChanged: boolean
|
|
483
|
+
tools: object({ listChanged: boolean().optional() }).optional(),
|
|
495
484
|
tasks: ServerTasksCapabilitySchema.optional(),
|
|
496
|
-
extensions: record$
|
|
485
|
+
extensions: record$2(string(), JSONObjectSchema).optional()
|
|
497
486
|
});
|
|
498
487
|
/**
|
|
499
488
|
* After receiving an initialize request from the client, the server sends this response.
|
|
500
489
|
*/
|
|
501
490
|
const InitializeResultSchema = ResultSchema.extend({
|
|
502
|
-
protocolVersion: string
|
|
491
|
+
protocolVersion: string(),
|
|
503
492
|
capabilities: ServerCapabilitiesSchema,
|
|
504
493
|
serverInfo: ImplementationSchema,
|
|
505
|
-
instructions: string
|
|
494
|
+
instructions: string().optional()
|
|
506
495
|
});
|
|
507
496
|
/**
|
|
508
497
|
* This notification is sent from the client to the server after initialization has finished.
|
|
@@ -525,9 +514,9 @@ const DiscoverRequestSchema = RequestSchema.extend({
|
|
|
525
514
|
* The result returned by the server for a `server/discover` request.
|
|
526
515
|
*/
|
|
527
516
|
const DiscoverResultSchema = ResultSchema.extend({
|
|
528
|
-
supportedVersions: array(string
|
|
517
|
+
supportedVersions: array(string()),
|
|
529
518
|
capabilities: ServerCapabilitiesSchema,
|
|
530
|
-
instructions: string
|
|
519
|
+
instructions: string().optional()
|
|
531
520
|
});
|
|
532
521
|
/**
|
|
533
522
|
* A ping, issued by either the server or the client, to check that the other party is still alive. The receiver must promptly respond, or else may be disconnected.
|
|
@@ -537,9 +526,9 @@ const PingRequestSchema = RequestSchema.extend({
|
|
|
537
526
|
params: BaseRequestParamsSchema.optional()
|
|
538
527
|
});
|
|
539
528
|
const ProgressSchema = object({
|
|
540
|
-
progress: number
|
|
541
|
-
total: optional(number
|
|
542
|
-
message: optional(string
|
|
529
|
+
progress: number(),
|
|
530
|
+
total: optional(number()),
|
|
531
|
+
message: optional(string())
|
|
543
532
|
});
|
|
544
533
|
const ProgressNotificationParamsSchema = object({
|
|
545
534
|
...NotificationsParamsSchema.shape,
|
|
@@ -562,17 +551,17 @@ const PaginatedResultSchema = ResultSchema.extend({ nextCursor: CursorSchema.opt
|
|
|
562
551
|
* The contents of a specific resource or sub-resource.
|
|
563
552
|
*/
|
|
564
553
|
const ResourceContentsSchema = object({
|
|
565
|
-
uri: string
|
|
566
|
-
mimeType: optional(string
|
|
567
|
-
_meta: record$
|
|
554
|
+
uri: string(),
|
|
555
|
+
mimeType: optional(string()),
|
|
556
|
+
_meta: record$2(string(), unknown()).optional()
|
|
568
557
|
});
|
|
569
|
-
const TextResourceContentsSchema = ResourceContentsSchema.extend({ text: string
|
|
558
|
+
const TextResourceContentsSchema = ResourceContentsSchema.extend({ text: string() });
|
|
570
559
|
/**
|
|
571
560
|
* A Zod schema for validating Base64 strings that is more performant and
|
|
572
561
|
* robust for very large inputs than the default regex-based check. It avoids
|
|
573
562
|
* stack overflows by using the native `atob` function for validation.
|
|
574
563
|
*/
|
|
575
|
-
const Base64Schema = string
|
|
564
|
+
const Base64Schema = string().refine((val) => {
|
|
576
565
|
try {
|
|
577
566
|
atob(val);
|
|
578
567
|
return true;
|
|
@@ -590,7 +579,7 @@ const RoleSchema = _enum(["user", "assistant"]);
|
|
|
590
579
|
*/
|
|
591
580
|
const AnnotationsSchema = object({
|
|
592
581
|
audience: array(RoleSchema).optional(),
|
|
593
|
-
priority: number
|
|
582
|
+
priority: number().min(0).max(1).optional(),
|
|
594
583
|
lastModified: datetime({ offset: true }).optional()
|
|
595
584
|
});
|
|
596
585
|
/**
|
|
@@ -599,10 +588,10 @@ const AnnotationsSchema = object({
|
|
|
599
588
|
const ResourceSchema = object({
|
|
600
589
|
...BaseMetadataSchema.shape,
|
|
601
590
|
...IconsSchema.shape,
|
|
602
|
-
uri: string
|
|
603
|
-
description: optional(string
|
|
604
|
-
mimeType: optional(string
|
|
605
|
-
size: optional(number
|
|
591
|
+
uri: string(),
|
|
592
|
+
description: optional(string()),
|
|
593
|
+
mimeType: optional(string()),
|
|
594
|
+
size: optional(number()),
|
|
606
595
|
annotations: AnnotationsSchema.optional(),
|
|
607
596
|
_meta: optional(looseObject({}))
|
|
608
597
|
});
|
|
@@ -612,9 +601,9 @@ const ResourceSchema = object({
|
|
|
612
601
|
const ResourceTemplateSchema = object({
|
|
613
602
|
...BaseMetadataSchema.shape,
|
|
614
603
|
...IconsSchema.shape,
|
|
615
|
-
uriTemplate: string
|
|
616
|
-
description: optional(string
|
|
617
|
-
mimeType: optional(string
|
|
604
|
+
uriTemplate: string(),
|
|
605
|
+
description: optional(string()),
|
|
606
|
+
mimeType: optional(string()),
|
|
618
607
|
annotations: AnnotationsSchema.optional(),
|
|
619
608
|
_meta: optional(looseObject({}))
|
|
620
609
|
});
|
|
@@ -634,7 +623,7 @@ const ListResourceTemplatesRequestSchema = PaginatedRequestSchema.extend({ metho
|
|
|
634
623
|
* The server's response to a {@linkcode ListResourceTemplatesRequest | resources/templates/list} request from the client.
|
|
635
624
|
*/
|
|
636
625
|
const ListResourceTemplatesResultSchema = PaginatedResultSchema.extend({ resourceTemplates: array(ResourceTemplateSchema) });
|
|
637
|
-
const ResourceRequestParamsSchema = BaseRequestParamsSchema.extend({ uri: string
|
|
626
|
+
const ResourceRequestParamsSchema = BaseRequestParamsSchema.extend({ uri: string() });
|
|
638
627
|
/**
|
|
639
628
|
* Parameters for a {@linkcode ReadResourceRequest | resources/read} request.
|
|
640
629
|
*/
|
|
@@ -679,10 +668,10 @@ const UnsubscribeRequestSchema = RequestSchema.extend({
|
|
|
679
668
|
* the client has not explicitly requested here.
|
|
680
669
|
*/
|
|
681
670
|
const SubscriptionFilterSchema = object({
|
|
682
|
-
toolsListChanged: boolean
|
|
683
|
-
promptsListChanged: boolean
|
|
684
|
-
resourcesListChanged: boolean
|
|
685
|
-
resourceSubscriptions: array(string
|
|
671
|
+
toolsListChanged: boolean().optional(),
|
|
672
|
+
promptsListChanged: boolean().optional(),
|
|
673
|
+
resourcesListChanged: boolean().optional(),
|
|
674
|
+
resourceSubscriptions: array(string()).optional()
|
|
686
675
|
});
|
|
687
676
|
const SubscriptionsListenRequestParamsSchema = BaseRequestParamsSchema.extend({ notifications: SubscriptionFilterSchema });
|
|
688
677
|
/**
|
|
@@ -723,7 +712,7 @@ const SubscriptionsListenResultSchema = ResultSchema.extend({ _meta: Subscriptio
|
|
|
723
712
|
/**
|
|
724
713
|
* Parameters for a {@linkcode ResourceUpdatedNotification | notifications/resources/updated} notification.
|
|
725
714
|
*/
|
|
726
|
-
const ResourceUpdatedNotificationParamsSchema = NotificationsParamsSchema.extend({ uri: string
|
|
715
|
+
const ResourceUpdatedNotificationParamsSchema = NotificationsParamsSchema.extend({ uri: string() });
|
|
727
716
|
/**
|
|
728
717
|
* A notification from the server to the client, informing it that a resource has changed and may need to be read again. This should only be sent if the client previously sent a {@linkcode SubscribeRequest | resources/subscribe} request.
|
|
729
718
|
*/
|
|
@@ -735,9 +724,9 @@ const ResourceUpdatedNotificationSchema = NotificationSchema.extend({
|
|
|
735
724
|
* Describes an argument that a prompt can accept.
|
|
736
725
|
*/
|
|
737
726
|
const PromptArgumentSchema = object({
|
|
738
|
-
name: string
|
|
739
|
-
description: optional(string
|
|
740
|
-
required: optional(boolean
|
|
727
|
+
name: string(),
|
|
728
|
+
description: optional(string()),
|
|
729
|
+
required: optional(boolean())
|
|
741
730
|
});
|
|
742
731
|
/**
|
|
743
732
|
* A prompt or prompt template that the server offers.
|
|
@@ -745,7 +734,7 @@ const PromptArgumentSchema = object({
|
|
|
745
734
|
const PromptSchema = object({
|
|
746
735
|
...BaseMetadataSchema.shape,
|
|
747
736
|
...IconsSchema.shape,
|
|
748
|
-
description: optional(string
|
|
737
|
+
description: optional(string()),
|
|
749
738
|
arguments: optional(array(PromptArgumentSchema)),
|
|
750
739
|
_meta: optional(looseObject({}))
|
|
751
740
|
});
|
|
@@ -761,8 +750,8 @@ const ListPromptsResultSchema = PaginatedResultSchema.extend({ prompts: array(Pr
|
|
|
761
750
|
* Parameters for a {@linkcode GetPromptRequest | prompts/get} request.
|
|
762
751
|
*/
|
|
763
752
|
const GetPromptRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
764
|
-
name: string
|
|
765
|
-
arguments: record$
|
|
753
|
+
name: string(),
|
|
754
|
+
arguments: record$2(string(), string()).optional()
|
|
766
755
|
});
|
|
767
756
|
/**
|
|
768
757
|
* Used by the client to get a prompt provided by the server.
|
|
@@ -776,9 +765,9 @@ const GetPromptRequestSchema = RequestSchema.extend({
|
|
|
776
765
|
*/
|
|
777
766
|
const TextContentSchema = object({
|
|
778
767
|
type: literal("text"),
|
|
779
|
-
text: string
|
|
768
|
+
text: string(),
|
|
780
769
|
annotations: AnnotationsSchema.optional(),
|
|
781
|
-
_meta: record$
|
|
770
|
+
_meta: record$2(string(), unknown()).optional()
|
|
782
771
|
});
|
|
783
772
|
/**
|
|
784
773
|
* An image provided to or from an LLM.
|
|
@@ -786,9 +775,9 @@ const TextContentSchema = object({
|
|
|
786
775
|
const ImageContentSchema = object({
|
|
787
776
|
type: literal("image"),
|
|
788
777
|
data: Base64Schema,
|
|
789
|
-
mimeType: string
|
|
778
|
+
mimeType: string(),
|
|
790
779
|
annotations: AnnotationsSchema.optional(),
|
|
791
|
-
_meta: record$
|
|
780
|
+
_meta: record$2(string(), unknown()).optional()
|
|
792
781
|
});
|
|
793
782
|
/**
|
|
794
783
|
* Audio content provided to or from an LLM.
|
|
@@ -796,9 +785,9 @@ const ImageContentSchema = object({
|
|
|
796
785
|
const AudioContentSchema = object({
|
|
797
786
|
type: literal("audio"),
|
|
798
787
|
data: Base64Schema,
|
|
799
|
-
mimeType: string
|
|
788
|
+
mimeType: string(),
|
|
800
789
|
annotations: AnnotationsSchema.optional(),
|
|
801
|
-
_meta: record$
|
|
790
|
+
_meta: record$2(string(), unknown()).optional()
|
|
802
791
|
});
|
|
803
792
|
/**
|
|
804
793
|
* A tool call request from an assistant (LLM).
|
|
@@ -810,10 +799,10 @@ const AudioContentSchema = object({
|
|
|
810
799
|
*/
|
|
811
800
|
const ToolUseContentSchema = object({
|
|
812
801
|
type: literal("tool_use"),
|
|
813
|
-
name: string
|
|
814
|
-
id: string
|
|
815
|
-
input: record$
|
|
816
|
-
_meta: record$
|
|
802
|
+
name: string(),
|
|
803
|
+
id: string(),
|
|
804
|
+
input: record$2(string(), unknown()),
|
|
805
|
+
_meta: record$2(string(), unknown()).optional()
|
|
817
806
|
});
|
|
818
807
|
/**
|
|
819
808
|
* The contents of a resource, embedded into a prompt or tool call result.
|
|
@@ -822,7 +811,7 @@ const EmbeddedResourceSchema = object({
|
|
|
822
811
|
type: literal("resource"),
|
|
823
812
|
resource: union([TextResourceContentsSchema, BlobResourceContentsSchema]),
|
|
824
813
|
annotations: AnnotationsSchema.optional(),
|
|
825
|
-
_meta: record$
|
|
814
|
+
_meta: record$2(string(), unknown()).optional()
|
|
826
815
|
});
|
|
827
816
|
/**
|
|
828
817
|
* A resource that the server is capable of reading, included in a prompt or tool call result.
|
|
@@ -851,7 +840,7 @@ const PromptMessageSchema = object({
|
|
|
851
840
|
* The server's response to a {@linkcode GetPromptRequest | prompts/get} request from the client.
|
|
852
841
|
*/
|
|
853
842
|
const GetPromptResultSchema = ResultSchema.extend({
|
|
854
|
-
description: string
|
|
843
|
+
description: string().optional(),
|
|
855
844
|
messages: array(PromptMessageSchema)
|
|
856
845
|
});
|
|
857
846
|
/**
|
|
@@ -872,11 +861,11 @@ const PromptListChangedNotificationSchema = NotificationSchema.extend({
|
|
|
872
861
|
* received from untrusted servers.
|
|
873
862
|
*/
|
|
874
863
|
const ToolAnnotationsSchema = object({
|
|
875
|
-
title: string
|
|
876
|
-
readOnlyHint: boolean
|
|
877
|
-
destructiveHint: boolean
|
|
878
|
-
idempotentHint: boolean
|
|
879
|
-
openWorldHint: boolean
|
|
864
|
+
title: string().optional(),
|
|
865
|
+
readOnlyHint: boolean().optional(),
|
|
866
|
+
destructiveHint: boolean().optional(),
|
|
867
|
+
idempotentHint: boolean().optional(),
|
|
868
|
+
openWorldHint: boolean().optional()
|
|
880
869
|
});
|
|
881
870
|
/**
|
|
882
871
|
* Execution-related properties for a tool.
|
|
@@ -892,16 +881,16 @@ const ToolExecutionSchema = object({ taskSupport: _enum([
|
|
|
892
881
|
const ToolSchema = object({
|
|
893
882
|
...BaseMetadataSchema.shape,
|
|
894
883
|
...IconsSchema.shape,
|
|
895
|
-
description: string
|
|
884
|
+
description: string().optional(),
|
|
896
885
|
inputSchema: object({
|
|
897
886
|
type: literal("object"),
|
|
898
|
-
properties: record$
|
|
899
|
-
required: array(string
|
|
887
|
+
properties: record$2(string(), JSONValueSchema).optional(),
|
|
888
|
+
required: array(string()).optional()
|
|
900
889
|
}).catchall(unknown()),
|
|
901
|
-
outputSchema: looseObject({ $schema: string
|
|
890
|
+
outputSchema: looseObject({ $schema: string().optional() }).optional(),
|
|
902
891
|
annotations: ToolAnnotationsSchema.optional(),
|
|
903
892
|
execution: ToolExecutionSchema.optional(),
|
|
904
|
-
_meta: record$
|
|
893
|
+
_meta: record$2(string(), unknown()).optional()
|
|
905
894
|
});
|
|
906
895
|
/**
|
|
907
896
|
* Sent from the client to request a list of tools the server has.
|
|
@@ -917,7 +906,7 @@ const ListToolsResultSchema = PaginatedResultSchema.extend({ tools: array(ToolSc
|
|
|
917
906
|
const CallToolResultSchema = ResultSchema.extend({
|
|
918
907
|
content: array(ContentBlockSchema).default([]),
|
|
919
908
|
structuredContent: unknown().optional(),
|
|
920
|
-
isError: boolean
|
|
909
|
+
isError: boolean().optional()
|
|
921
910
|
});
|
|
922
911
|
/**
|
|
923
912
|
* {@linkcode CallToolResultSchema} extended with backwards compatibility to protocol version 2024-10-07.
|
|
@@ -927,8 +916,8 @@ const CompatibilityCallToolResultSchema = CallToolResultSchema.or(ResultSchema.e
|
|
|
927
916
|
* Parameters for a `tools/call` request.
|
|
928
917
|
*/
|
|
929
918
|
const CallToolRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({
|
|
930
|
-
name: string
|
|
931
|
-
arguments: record$
|
|
919
|
+
name: string(),
|
|
920
|
+
arguments: record$2(string(), unknown()).optional()
|
|
932
921
|
});
|
|
933
922
|
/**
|
|
934
923
|
* Used by the client to invoke a tool provided by the server.
|
|
@@ -949,8 +938,8 @@ const ToolListChangedNotificationSchema = NotificationSchema.extend({
|
|
|
949
938
|
* Used internally for Zod validation of `autoRefresh` and `debounceMs`.
|
|
950
939
|
*/
|
|
951
940
|
const ListChangedOptionsBaseSchema = object({
|
|
952
|
-
autoRefresh: boolean
|
|
953
|
-
debounceMs: number
|
|
941
|
+
autoRefresh: boolean().default(true),
|
|
942
|
+
debounceMs: number().int().nonnegative().default(300)
|
|
954
943
|
});
|
|
955
944
|
/**
|
|
956
945
|
* The severity of a log message.
|
|
@@ -997,7 +986,7 @@ const SetLevelRequestSchema = RequestSchema.extend({
|
|
|
997
986
|
*/
|
|
998
987
|
const LoggingMessageNotificationParamsSchema = NotificationsParamsSchema.extend({
|
|
999
988
|
level: LoggingLevelSchema,
|
|
1000
|
-
logger: string
|
|
989
|
+
logger: string().optional(),
|
|
1001
990
|
data: unknown()
|
|
1002
991
|
});
|
|
1003
992
|
/**
|
|
@@ -1018,7 +1007,7 @@ const LoggingMessageNotificationSchema = NotificationSchema.extend({
|
|
|
1018
1007
|
* in the specification for at least twelve months. Migrate to calling LLM
|
|
1019
1008
|
* provider APIs directly.
|
|
1020
1009
|
*/
|
|
1021
|
-
const ModelHintSchema = object({ name: string
|
|
1010
|
+
const ModelHintSchema = object({ name: string().optional() });
|
|
1022
1011
|
/**
|
|
1023
1012
|
* The server's preferences for model selection, requested of the client during sampling.
|
|
1024
1013
|
*
|
|
@@ -1028,9 +1017,9 @@ const ModelHintSchema = object({ name: string$1().optional() });
|
|
|
1028
1017
|
*/
|
|
1029
1018
|
const ModelPreferencesSchema = object({
|
|
1030
1019
|
hints: array(ModelHintSchema).optional(),
|
|
1031
|
-
costPriority: number
|
|
1032
|
-
speedPriority: number
|
|
1033
|
-
intelligencePriority: number
|
|
1020
|
+
costPriority: number().min(0).max(1).optional(),
|
|
1021
|
+
speedPriority: number().min(0).max(1).optional(),
|
|
1022
|
+
intelligencePriority: number().min(0).max(1).optional()
|
|
1034
1023
|
});
|
|
1035
1024
|
/**
|
|
1036
1025
|
* Controls tool usage behavior in sampling requests.
|
|
@@ -1054,11 +1043,11 @@ const ToolChoiceSchema = object({ mode: _enum([
|
|
|
1054
1043
|
*/
|
|
1055
1044
|
const ToolResultContentSchema = object({
|
|
1056
1045
|
type: literal("tool_result"),
|
|
1057
|
-
toolUseId: string
|
|
1046
|
+
toolUseId: string().describe("The unique identifier for the corresponding tool call."),
|
|
1058
1047
|
content: array(ContentBlockSchema),
|
|
1059
1048
|
structuredContent: unknown().optional(),
|
|
1060
|
-
isError: boolean
|
|
1061
|
-
_meta: record$
|
|
1049
|
+
isError: boolean().optional(),
|
|
1050
|
+
_meta: record$2(string(), unknown()).optional()
|
|
1062
1051
|
});
|
|
1063
1052
|
/**
|
|
1064
1053
|
* Basic content types for sampling responses (without tool use).
|
|
@@ -1098,7 +1087,7 @@ const SamplingMessageContentBlockSchema = discriminatedUnion("type", [
|
|
|
1098
1087
|
const SamplingMessageSchema = object({
|
|
1099
1088
|
role: RoleSchema,
|
|
1100
1089
|
content: union([SamplingMessageContentBlockSchema, array(SamplingMessageContentBlockSchema)]),
|
|
1101
|
-
_meta: record$
|
|
1090
|
+
_meta: record$2(string(), unknown()).optional()
|
|
1102
1091
|
});
|
|
1103
1092
|
/**
|
|
1104
1093
|
* Parameters for a `sampling/createMessage` request.
|
|
@@ -1110,15 +1099,15 @@ const SamplingMessageSchema = object({
|
|
|
1110
1099
|
const CreateMessageRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({
|
|
1111
1100
|
messages: array(SamplingMessageSchema),
|
|
1112
1101
|
modelPreferences: ModelPreferencesSchema.optional(),
|
|
1113
|
-
systemPrompt: string
|
|
1102
|
+
systemPrompt: string().optional(),
|
|
1114
1103
|
includeContext: _enum([
|
|
1115
1104
|
"none",
|
|
1116
1105
|
"thisServer",
|
|
1117
1106
|
"allServers"
|
|
1118
1107
|
]).optional(),
|
|
1119
|
-
temperature: number
|
|
1120
|
-
maxTokens: number
|
|
1121
|
-
stopSequences: array(string
|
|
1108
|
+
temperature: number().optional(),
|
|
1109
|
+
maxTokens: number().int(),
|
|
1110
|
+
stopSequences: array(string()).optional(),
|
|
1122
1111
|
metadata: JSONObjectSchema.optional(),
|
|
1123
1112
|
tools: array(ToolSchema).optional(),
|
|
1124
1113
|
toolChoice: ToolChoiceSchema.optional()
|
|
@@ -1144,12 +1133,12 @@ const CreateMessageRequestSchema = RequestSchema.extend({
|
|
|
1144
1133
|
* provider APIs directly.
|
|
1145
1134
|
*/
|
|
1146
1135
|
const CreateMessageResultSchema = ResultSchema.extend({
|
|
1147
|
-
model: string
|
|
1136
|
+
model: string(),
|
|
1148
1137
|
stopReason: optional(_enum([
|
|
1149
1138
|
"endTurn",
|
|
1150
1139
|
"stopSequence",
|
|
1151
1140
|
"maxTokens"
|
|
1152
|
-
]).or(string
|
|
1141
|
+
]).or(string())),
|
|
1153
1142
|
role: RoleSchema,
|
|
1154
1143
|
content: SamplingContentSchema
|
|
1155
1144
|
});
|
|
@@ -1162,13 +1151,13 @@ const CreateMessageResultSchema = ResultSchema.extend({
|
|
|
1162
1151
|
* provider APIs directly.
|
|
1163
1152
|
*/
|
|
1164
1153
|
const CreateMessageResultWithToolsSchema = ResultSchema.extend({
|
|
1165
|
-
model: string
|
|
1154
|
+
model: string(),
|
|
1166
1155
|
stopReason: optional(_enum([
|
|
1167
1156
|
"endTurn",
|
|
1168
1157
|
"stopSequence",
|
|
1169
1158
|
"maxTokens",
|
|
1170
1159
|
"toolUse"
|
|
1171
|
-
]).or(string
|
|
1160
|
+
]).or(string())),
|
|
1172
1161
|
role: RoleSchema,
|
|
1173
1162
|
content: union([SamplingMessageContentBlockSchema, array(SamplingMessageContentBlockSchema)])
|
|
1174
1163
|
});
|
|
@@ -1177,60 +1166,60 @@ const CreateMessageResultWithToolsSchema = ResultSchema.extend({
|
|
|
1177
1166
|
*/
|
|
1178
1167
|
const BooleanSchemaSchema = object({
|
|
1179
1168
|
type: literal("boolean"),
|
|
1180
|
-
title: string
|
|
1181
|
-
description: string
|
|
1182
|
-
default: boolean
|
|
1169
|
+
title: string().optional(),
|
|
1170
|
+
description: string().optional(),
|
|
1171
|
+
default: boolean().optional()
|
|
1183
1172
|
});
|
|
1184
1173
|
/**
|
|
1185
1174
|
* Primitive schema definition for string fields.
|
|
1186
1175
|
*/
|
|
1187
1176
|
const StringSchemaSchema = object({
|
|
1188
1177
|
type: literal("string"),
|
|
1189
|
-
title: string
|
|
1190
|
-
description: string
|
|
1191
|
-
minLength: number
|
|
1192
|
-
maxLength: number
|
|
1178
|
+
title: string().optional(),
|
|
1179
|
+
description: string().optional(),
|
|
1180
|
+
minLength: number().optional(),
|
|
1181
|
+
maxLength: number().optional(),
|
|
1193
1182
|
format: _enum([
|
|
1194
1183
|
"email",
|
|
1195
1184
|
"uri",
|
|
1196
1185
|
"date",
|
|
1197
1186
|
"date-time"
|
|
1198
1187
|
]).optional(),
|
|
1199
|
-
default: string
|
|
1188
|
+
default: string().optional()
|
|
1200
1189
|
});
|
|
1201
1190
|
/**
|
|
1202
1191
|
* Primitive schema definition for number fields.
|
|
1203
1192
|
*/
|
|
1204
1193
|
const NumberSchemaSchema = object({
|
|
1205
1194
|
type: _enum(["number", "integer"]),
|
|
1206
|
-
title: string
|
|
1207
|
-
description: string
|
|
1208
|
-
minimum: number
|
|
1209
|
-
maximum: number
|
|
1210
|
-
default: number
|
|
1195
|
+
title: string().optional(),
|
|
1196
|
+
description: string().optional(),
|
|
1197
|
+
minimum: number().optional(),
|
|
1198
|
+
maximum: number().optional(),
|
|
1199
|
+
default: number().optional()
|
|
1211
1200
|
});
|
|
1212
1201
|
/**
|
|
1213
1202
|
* Schema for single-selection enumeration without display titles for options.
|
|
1214
1203
|
*/
|
|
1215
1204
|
const UntitledSingleSelectEnumSchemaSchema = object({
|
|
1216
1205
|
type: literal("string"),
|
|
1217
|
-
title: string
|
|
1218
|
-
description: string
|
|
1219
|
-
enum: array(string
|
|
1220
|
-
default: string
|
|
1206
|
+
title: string().optional(),
|
|
1207
|
+
description: string().optional(),
|
|
1208
|
+
enum: array(string()),
|
|
1209
|
+
default: string().optional()
|
|
1221
1210
|
});
|
|
1222
1211
|
/**
|
|
1223
1212
|
* Schema for single-selection enumeration with display titles for each option.
|
|
1224
1213
|
*/
|
|
1225
1214
|
const TitledSingleSelectEnumSchemaSchema = object({
|
|
1226
1215
|
type: literal("string"),
|
|
1227
|
-
title: string
|
|
1228
|
-
description: string
|
|
1216
|
+
title: string().optional(),
|
|
1217
|
+
description: string().optional(),
|
|
1229
1218
|
oneOf: array(object({
|
|
1230
|
-
const: string
|
|
1231
|
-
title: string
|
|
1219
|
+
const: string(),
|
|
1220
|
+
title: string()
|
|
1232
1221
|
})),
|
|
1233
|
-
default: string
|
|
1222
|
+
default: string().optional()
|
|
1234
1223
|
});
|
|
1235
1224
|
/**
|
|
1236
1225
|
* Use {@linkcode TitledSingleSelectEnumSchema} instead.
|
|
@@ -1238,11 +1227,11 @@ const TitledSingleSelectEnumSchemaSchema = object({
|
|
|
1238
1227
|
*/
|
|
1239
1228
|
const LegacyTitledEnumSchemaSchema = object({
|
|
1240
1229
|
type: literal("string"),
|
|
1241
|
-
title: string
|
|
1242
|
-
description: string
|
|
1243
|
-
enum: array(string
|
|
1244
|
-
enumNames: array(string
|
|
1245
|
-
default: string
|
|
1230
|
+
title: string().optional(),
|
|
1231
|
+
description: string().optional(),
|
|
1232
|
+
enum: array(string()),
|
|
1233
|
+
enumNames: array(string()).optional(),
|
|
1234
|
+
default: string().optional()
|
|
1246
1235
|
});
|
|
1247
1236
|
const SingleSelectEnumSchemaSchema = union([UntitledSingleSelectEnumSchemaSchema, TitledSingleSelectEnumSchemaSchema]);
|
|
1248
1237
|
/**
|
|
@@ -1250,30 +1239,30 @@ const SingleSelectEnumSchemaSchema = union([UntitledSingleSelectEnumSchemaSchema
|
|
|
1250
1239
|
*/
|
|
1251
1240
|
const UntitledMultiSelectEnumSchemaSchema = object({
|
|
1252
1241
|
type: literal("array"),
|
|
1253
|
-
title: string
|
|
1254
|
-
description: string
|
|
1255
|
-
minItems: number
|
|
1256
|
-
maxItems: number
|
|
1242
|
+
title: string().optional(),
|
|
1243
|
+
description: string().optional(),
|
|
1244
|
+
minItems: number().optional(),
|
|
1245
|
+
maxItems: number().optional(),
|
|
1257
1246
|
items: object({
|
|
1258
1247
|
type: literal("string"),
|
|
1259
|
-
enum: array(string
|
|
1248
|
+
enum: array(string())
|
|
1260
1249
|
}),
|
|
1261
|
-
default: array(string
|
|
1250
|
+
default: array(string()).optional()
|
|
1262
1251
|
});
|
|
1263
1252
|
/**
|
|
1264
1253
|
* Schema for multiple-selection enumeration with display titles for each option.
|
|
1265
1254
|
*/
|
|
1266
1255
|
const TitledMultiSelectEnumSchemaSchema = object({
|
|
1267
1256
|
type: literal("array"),
|
|
1268
|
-
title: string
|
|
1269
|
-
description: string
|
|
1270
|
-
minItems: number
|
|
1271
|
-
maxItems: number
|
|
1257
|
+
title: string().optional(),
|
|
1258
|
+
description: string().optional(),
|
|
1259
|
+
minItems: number().optional(),
|
|
1260
|
+
maxItems: number().optional(),
|
|
1272
1261
|
items: object({ anyOf: array(object({
|
|
1273
|
-
const: string
|
|
1274
|
-
title: string
|
|
1262
|
+
const: string(),
|
|
1263
|
+
title: string()
|
|
1275
1264
|
})) }),
|
|
1276
|
-
default: array(string
|
|
1265
|
+
default: array(string()).optional()
|
|
1277
1266
|
});
|
|
1278
1267
|
/**
|
|
1279
1268
|
* Combined schema for multiple-selection enumeration
|
|
@@ -1301,11 +1290,11 @@ const PrimitiveSchemaDefinitionSchema = union([
|
|
|
1301
1290
|
*/
|
|
1302
1291
|
const ElicitRequestFormParamsSchema = TaskAugmentedRequestParamsSchema.extend({
|
|
1303
1292
|
mode: literal("form").optional(),
|
|
1304
|
-
message: string
|
|
1293
|
+
message: string(),
|
|
1305
1294
|
requestedSchema: object({
|
|
1306
1295
|
type: literal("object"),
|
|
1307
|
-
properties: record$
|
|
1308
|
-
required: array(string
|
|
1296
|
+
properties: record$2(string(), PrimitiveSchemaDefinitionSchema),
|
|
1297
|
+
required: array(string()).optional()
|
|
1309
1298
|
}).catchall(unknown())
|
|
1310
1299
|
});
|
|
1311
1300
|
/**
|
|
@@ -1313,9 +1302,9 @@ const ElicitRequestFormParamsSchema = TaskAugmentedRequestParamsSchema.extend({
|
|
|
1313
1302
|
*/
|
|
1314
1303
|
const ElicitRequestURLParamsSchema = TaskAugmentedRequestParamsSchema.extend({
|
|
1315
1304
|
mode: literal("url"),
|
|
1316
|
-
message: string
|
|
1317
|
-
elicitationId: string
|
|
1318
|
-
url: string
|
|
1305
|
+
message: string(),
|
|
1306
|
+
elicitationId: string(),
|
|
1307
|
+
url: string().url()
|
|
1319
1308
|
});
|
|
1320
1309
|
/**
|
|
1321
1310
|
* The parameters for a request to elicit additional information from the user via the client.
|
|
@@ -1339,7 +1328,7 @@ const ElicitRequestSchema = RequestSchema.extend({
|
|
|
1339
1328
|
* only. The 2026-07-28 wire codec excludes this notification.
|
|
1340
1329
|
* @category notifications/elicitation/complete
|
|
1341
1330
|
*/
|
|
1342
|
-
const ElicitationCompleteNotificationParamsSchema = NotificationsParamsSchema.extend({ elicitationId: string
|
|
1331
|
+
const ElicitationCompleteNotificationParamsSchema = NotificationsParamsSchema.extend({ elicitationId: string() });
|
|
1343
1332
|
/**
|
|
1344
1333
|
* A notification from the server to the client, informing it of a completion of an out-of-band elicitation request.
|
|
1345
1334
|
*
|
|
@@ -1362,11 +1351,11 @@ const ElicitResultSchema = ResultSchema.extend({
|
|
|
1362
1351
|
"decline",
|
|
1363
1352
|
"cancel"
|
|
1364
1353
|
]),
|
|
1365
|
-
content: preprocess((val) => val === null ? void 0 : val, record$
|
|
1366
|
-
string
|
|
1367
|
-
number
|
|
1368
|
-
boolean
|
|
1369
|
-
array(string
|
|
1354
|
+
content: preprocess((val) => val === null ? void 0 : val, record$2(string(), union([
|
|
1355
|
+
string(),
|
|
1356
|
+
number(),
|
|
1357
|
+
boolean(),
|
|
1358
|
+
array(string())
|
|
1370
1359
|
])).optional())
|
|
1371
1360
|
});
|
|
1372
1361
|
/**
|
|
@@ -1374,14 +1363,14 @@ const ElicitResultSchema = ResultSchema.extend({
|
|
|
1374
1363
|
*/
|
|
1375
1364
|
const ResourceTemplateReferenceSchema = object({
|
|
1376
1365
|
type: literal("ref/resource"),
|
|
1377
|
-
uri: string
|
|
1366
|
+
uri: string()
|
|
1378
1367
|
});
|
|
1379
1368
|
/**
|
|
1380
1369
|
* Identifies a prompt.
|
|
1381
1370
|
*/
|
|
1382
1371
|
const PromptReferenceSchema = object({
|
|
1383
1372
|
type: literal("ref/prompt"),
|
|
1384
|
-
name: string
|
|
1373
|
+
name: string()
|
|
1385
1374
|
});
|
|
1386
1375
|
/**
|
|
1387
1376
|
* Parameters for a {@linkcode CompleteRequest | completion/complete} request.
|
|
@@ -1389,10 +1378,10 @@ const PromptReferenceSchema = object({
|
|
|
1389
1378
|
const CompleteRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
1390
1379
|
ref: union([PromptReferenceSchema, ResourceTemplateReferenceSchema]),
|
|
1391
1380
|
argument: object({
|
|
1392
|
-
name: string
|
|
1393
|
-
value: string
|
|
1381
|
+
name: string(),
|
|
1382
|
+
value: string()
|
|
1394
1383
|
}),
|
|
1395
|
-
context: object({ arguments: record$
|
|
1384
|
+
context: object({ arguments: record$2(string(), string()).optional() }).optional()
|
|
1396
1385
|
});
|
|
1397
1386
|
/**
|
|
1398
1387
|
* A request from the client to the server, to ask for completion options.
|
|
@@ -1405,9 +1394,9 @@ const CompleteRequestSchema = RequestSchema.extend({
|
|
|
1405
1394
|
* The server's response to a {@linkcode CompleteRequest | completion/complete} request
|
|
1406
1395
|
*/
|
|
1407
1396
|
const CompleteResultSchema = ResultSchema.extend({ completion: looseObject({
|
|
1408
|
-
values: array(string
|
|
1409
|
-
total: optional(number
|
|
1410
|
-
hasMore: optional(boolean
|
|
1397
|
+
values: array(string()).max(100),
|
|
1398
|
+
total: optional(number().int()),
|
|
1399
|
+
hasMore: optional(boolean())
|
|
1411
1400
|
}) });
|
|
1412
1401
|
/**
|
|
1413
1402
|
* Represents a root directory or file that the server can operate on.
|
|
@@ -1417,9 +1406,9 @@ const CompleteResultSchema = ResultSchema.extend({ completion: looseObject({
|
|
|
1417
1406
|
* tool parameters, resource URIs, or configuration.
|
|
1418
1407
|
*/
|
|
1419
1408
|
const RootSchema = object({
|
|
1420
|
-
uri: string
|
|
1421
|
-
name: string
|
|
1422
|
-
_meta: record$
|
|
1409
|
+
uri: string().startsWith("file://"),
|
|
1410
|
+
name: string().optional(),
|
|
1411
|
+
_meta: record$2(string(), unknown()).optional()
|
|
1423
1412
|
});
|
|
1424
1413
|
/**
|
|
1425
1414
|
* Sent from the server to request a list of root URIs from the client.
|
|
@@ -1457,8 +1446,8 @@ const RootsListChangedNotificationSchema = NotificationSchema.extend({
|
|
|
1457
1446
|
* @deprecated 2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only.
|
|
1458
1447
|
*/
|
|
1459
1448
|
const TaskCreationParamsSchema = looseObject({
|
|
1460
|
-
ttl: number
|
|
1461
|
-
pollInterval: number
|
|
1449
|
+
ttl: number().optional(),
|
|
1450
|
+
pollInterval: number().optional()
|
|
1462
1451
|
});
|
|
1463
1452
|
/**
|
|
1464
1453
|
* The status of a task.
|
|
@@ -1478,13 +1467,13 @@ const TaskStatusSchema = _enum([
|
|
|
1478
1467
|
* @deprecated 2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only.
|
|
1479
1468
|
*/
|
|
1480
1469
|
const TaskSchema = object({
|
|
1481
|
-
taskId: string
|
|
1470
|
+
taskId: string(),
|
|
1482
1471
|
status: TaskStatusSchema,
|
|
1483
|
-
ttl: union([number
|
|
1484
|
-
createdAt: string
|
|
1485
|
-
lastUpdatedAt: string
|
|
1486
|
-
pollInterval: optional(number
|
|
1487
|
-
statusMessage: optional(string
|
|
1472
|
+
ttl: union([number(), _null()]),
|
|
1473
|
+
createdAt: string(),
|
|
1474
|
+
lastUpdatedAt: string(),
|
|
1475
|
+
pollInterval: optional(number()),
|
|
1476
|
+
statusMessage: optional(string())
|
|
1488
1477
|
});
|
|
1489
1478
|
/**
|
|
1490
1479
|
* Result returned when a task is created, containing the task data wrapped in a `task` field.
|
|
@@ -1514,7 +1503,7 @@ const TaskStatusNotificationSchema = NotificationSchema.extend({
|
|
|
1514
1503
|
*/
|
|
1515
1504
|
const GetTaskRequestSchema = RequestSchema.extend({
|
|
1516
1505
|
method: literal("tasks/get"),
|
|
1517
|
-
params: BaseRequestParamsSchema.extend({ taskId: string
|
|
1506
|
+
params: BaseRequestParamsSchema.extend({ taskId: string() })
|
|
1518
1507
|
});
|
|
1519
1508
|
/**
|
|
1520
1509
|
* The response to a {@linkcode GetTaskRequest | tasks/get} request.
|
|
@@ -1529,7 +1518,7 @@ const GetTaskResultSchema = ResultSchema.merge(TaskSchema);
|
|
|
1529
1518
|
*/
|
|
1530
1519
|
const GetTaskPayloadRequestSchema = RequestSchema.extend({
|
|
1531
1520
|
method: literal("tasks/result"),
|
|
1532
|
-
params: BaseRequestParamsSchema.extend({ taskId: string
|
|
1521
|
+
params: BaseRequestParamsSchema.extend({ taskId: string() })
|
|
1533
1522
|
});
|
|
1534
1523
|
/**
|
|
1535
1524
|
* The response to a `tasks/result` request.
|
|
@@ -1559,7 +1548,7 @@ const ListTasksResultSchema = PaginatedResultSchema.extend({ tasks: array(TaskSc
|
|
|
1559
1548
|
*/
|
|
1560
1549
|
const CancelTaskRequestSchema = RequestSchema.extend({
|
|
1561
1550
|
method: literal("tasks/cancel"),
|
|
1562
|
-
params: BaseRequestParamsSchema.extend({ taskId: string
|
|
1551
|
+
params: BaseRequestParamsSchema.extend({ taskId: string() })
|
|
1563
1552
|
});
|
|
1564
1553
|
/**
|
|
1565
1554
|
* The response to a {@linkcode CancelTaskRequest | tasks/cancel} request.
|
|
@@ -1648,46 +1637,46 @@ const SafeUrlSchema = url().superRefine((val, ctx) => {
|
|
|
1648
1637
|
* RFC 9728 OAuth Protected Resource Metadata
|
|
1649
1638
|
*/
|
|
1650
1639
|
const OAuthProtectedResourceMetadataSchema = looseObject({
|
|
1651
|
-
resource: string
|
|
1640
|
+
resource: string().url(),
|
|
1652
1641
|
authorization_servers: array(SafeUrlSchema).optional(),
|
|
1653
|
-
jwks_uri: string
|
|
1654
|
-
scopes_supported: array(string
|
|
1655
|
-
bearer_methods_supported: array(string
|
|
1656
|
-
resource_signing_alg_values_supported: array(string
|
|
1657
|
-
resource_name: string
|
|
1658
|
-
resource_documentation: string
|
|
1659
|
-
resource_policy_uri: string
|
|
1660
|
-
resource_tos_uri: string
|
|
1661
|
-
tls_client_certificate_bound_access_tokens: boolean
|
|
1662
|
-
authorization_details_types_supported: array(string
|
|
1663
|
-
dpop_signing_alg_values_supported: array(string
|
|
1664
|
-
dpop_bound_access_tokens_required: boolean
|
|
1642
|
+
jwks_uri: string().url().optional(),
|
|
1643
|
+
scopes_supported: array(string()).optional(),
|
|
1644
|
+
bearer_methods_supported: array(string()).optional(),
|
|
1645
|
+
resource_signing_alg_values_supported: array(string()).optional(),
|
|
1646
|
+
resource_name: string().optional(),
|
|
1647
|
+
resource_documentation: string().optional(),
|
|
1648
|
+
resource_policy_uri: string().url().optional(),
|
|
1649
|
+
resource_tos_uri: string().url().optional(),
|
|
1650
|
+
tls_client_certificate_bound_access_tokens: boolean().optional(),
|
|
1651
|
+
authorization_details_types_supported: array(string()).optional(),
|
|
1652
|
+
dpop_signing_alg_values_supported: array(string()).optional(),
|
|
1653
|
+
dpop_bound_access_tokens_required: boolean().optional()
|
|
1665
1654
|
});
|
|
1666
1655
|
/**
|
|
1667
1656
|
* RFC 8414 OAuth 2.0 Authorization Server Metadata
|
|
1668
1657
|
*/
|
|
1669
1658
|
const OAuthMetadataSchema = looseObject({
|
|
1670
|
-
issuer: string
|
|
1659
|
+
issuer: string(),
|
|
1671
1660
|
authorization_endpoint: SafeUrlSchema,
|
|
1672
1661
|
token_endpoint: SafeUrlSchema,
|
|
1673
1662
|
registration_endpoint: SafeUrlSchema.optional(),
|
|
1674
|
-
scopes_supported: array(string
|
|
1675
|
-
response_types_supported: array(string
|
|
1676
|
-
response_modes_supported: array(string
|
|
1677
|
-
grant_types_supported: array(string
|
|
1678
|
-
token_endpoint_auth_methods_supported: array(string
|
|
1679
|
-
token_endpoint_auth_signing_alg_values_supported: array(string
|
|
1663
|
+
scopes_supported: array(string()).optional(),
|
|
1664
|
+
response_types_supported: array(string()),
|
|
1665
|
+
response_modes_supported: array(string()).optional(),
|
|
1666
|
+
grant_types_supported: array(string()).optional(),
|
|
1667
|
+
token_endpoint_auth_methods_supported: array(string()).optional(),
|
|
1668
|
+
token_endpoint_auth_signing_alg_values_supported: array(string()).optional(),
|
|
1680
1669
|
service_documentation: SafeUrlSchema.optional(),
|
|
1681
1670
|
revocation_endpoint: SafeUrlSchema.optional(),
|
|
1682
|
-
revocation_endpoint_auth_methods_supported: array(string
|
|
1683
|
-
revocation_endpoint_auth_signing_alg_values_supported: array(string
|
|
1684
|
-
introspection_endpoint: string
|
|
1685
|
-
introspection_endpoint_auth_methods_supported: array(string
|
|
1686
|
-
introspection_endpoint_auth_signing_alg_values_supported: array(string
|
|
1687
|
-
code_challenge_methods_supported: array(string
|
|
1688
|
-
client_id_metadata_document_supported: boolean
|
|
1689
|
-
authorization_response_iss_parameter_supported: boolean
|
|
1690
|
-
dpop_signing_alg_values_supported: array(string
|
|
1671
|
+
revocation_endpoint_auth_methods_supported: array(string()).optional(),
|
|
1672
|
+
revocation_endpoint_auth_signing_alg_values_supported: array(string()).optional(),
|
|
1673
|
+
introspection_endpoint: string().optional(),
|
|
1674
|
+
introspection_endpoint_auth_methods_supported: array(string()).optional(),
|
|
1675
|
+
introspection_endpoint_auth_signing_alg_values_supported: array(string()).optional(),
|
|
1676
|
+
code_challenge_methods_supported: array(string()).optional(),
|
|
1677
|
+
client_id_metadata_document_supported: boolean().optional(),
|
|
1678
|
+
authorization_response_iss_parameter_supported: boolean().optional().catch(void 0),
|
|
1679
|
+
dpop_signing_alg_values_supported: array(string()).optional()
|
|
1691
1680
|
});
|
|
1692
1681
|
/**
|
|
1693
1682
|
* OpenID Connect Discovery 1.0 Provider Metadata
|
|
@@ -1695,43 +1684,43 @@ const OAuthMetadataSchema = looseObject({
|
|
|
1695
1684
|
* @see https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata
|
|
1696
1685
|
*/
|
|
1697
1686
|
const OpenIdProviderMetadataSchema = looseObject({
|
|
1698
|
-
issuer: string
|
|
1687
|
+
issuer: string(),
|
|
1699
1688
|
authorization_endpoint: SafeUrlSchema,
|
|
1700
1689
|
token_endpoint: SafeUrlSchema,
|
|
1701
1690
|
userinfo_endpoint: SafeUrlSchema.optional(),
|
|
1702
1691
|
jwks_uri: SafeUrlSchema,
|
|
1703
1692
|
registration_endpoint: SafeUrlSchema.optional(),
|
|
1704
|
-
scopes_supported: array(string
|
|
1705
|
-
response_types_supported: array(string
|
|
1706
|
-
response_modes_supported: array(string
|
|
1707
|
-
grant_types_supported: array(string
|
|
1708
|
-
acr_values_supported: array(string
|
|
1709
|
-
subject_types_supported: array(string
|
|
1710
|
-
id_token_signing_alg_values_supported: array(string
|
|
1711
|
-
id_token_encryption_alg_values_supported: array(string
|
|
1712
|
-
id_token_encryption_enc_values_supported: array(string
|
|
1713
|
-
userinfo_signing_alg_values_supported: array(string
|
|
1714
|
-
userinfo_encryption_alg_values_supported: array(string
|
|
1715
|
-
userinfo_encryption_enc_values_supported: array(string
|
|
1716
|
-
request_object_signing_alg_values_supported: array(string
|
|
1717
|
-
request_object_encryption_alg_values_supported: array(string
|
|
1718
|
-
request_object_encryption_enc_values_supported: array(string
|
|
1719
|
-
token_endpoint_auth_methods_supported: array(string
|
|
1720
|
-
token_endpoint_auth_signing_alg_values_supported: array(string
|
|
1721
|
-
display_values_supported: array(string
|
|
1722
|
-
claim_types_supported: array(string
|
|
1723
|
-
claims_supported: array(string
|
|
1724
|
-
service_documentation: string
|
|
1725
|
-
claims_locales_supported: array(string
|
|
1726
|
-
ui_locales_supported: array(string
|
|
1727
|
-
claims_parameter_supported: boolean
|
|
1728
|
-
request_parameter_supported: boolean
|
|
1729
|
-
request_uri_parameter_supported: boolean
|
|
1730
|
-
require_request_uri_registration: boolean
|
|
1693
|
+
scopes_supported: array(string()).optional(),
|
|
1694
|
+
response_types_supported: array(string()),
|
|
1695
|
+
response_modes_supported: array(string()).optional(),
|
|
1696
|
+
grant_types_supported: array(string()).optional(),
|
|
1697
|
+
acr_values_supported: array(string()).optional(),
|
|
1698
|
+
subject_types_supported: array(string()),
|
|
1699
|
+
id_token_signing_alg_values_supported: array(string()),
|
|
1700
|
+
id_token_encryption_alg_values_supported: array(string()).optional(),
|
|
1701
|
+
id_token_encryption_enc_values_supported: array(string()).optional(),
|
|
1702
|
+
userinfo_signing_alg_values_supported: array(string()).optional(),
|
|
1703
|
+
userinfo_encryption_alg_values_supported: array(string()).optional(),
|
|
1704
|
+
userinfo_encryption_enc_values_supported: array(string()).optional(),
|
|
1705
|
+
request_object_signing_alg_values_supported: array(string()).optional(),
|
|
1706
|
+
request_object_encryption_alg_values_supported: array(string()).optional(),
|
|
1707
|
+
request_object_encryption_enc_values_supported: array(string()).optional(),
|
|
1708
|
+
token_endpoint_auth_methods_supported: array(string()).optional(),
|
|
1709
|
+
token_endpoint_auth_signing_alg_values_supported: array(string()).optional(),
|
|
1710
|
+
display_values_supported: array(string()).optional(),
|
|
1711
|
+
claim_types_supported: array(string()).optional(),
|
|
1712
|
+
claims_supported: array(string()).optional(),
|
|
1713
|
+
service_documentation: string().optional(),
|
|
1714
|
+
claims_locales_supported: array(string()).optional(),
|
|
1715
|
+
ui_locales_supported: array(string()).optional(),
|
|
1716
|
+
claims_parameter_supported: boolean().optional(),
|
|
1717
|
+
request_parameter_supported: boolean().optional(),
|
|
1718
|
+
request_uri_parameter_supported: boolean().optional(),
|
|
1719
|
+
require_request_uri_registration: boolean().optional(),
|
|
1731
1720
|
op_policy_uri: SafeUrlSchema.optional(),
|
|
1732
1721
|
op_tos_uri: SafeUrlSchema.optional(),
|
|
1733
|
-
client_id_metadata_document_supported: boolean
|
|
1734
|
-
authorization_response_iss_parameter_supported: boolean
|
|
1722
|
+
client_id_metadata_document_supported: boolean().optional(),
|
|
1723
|
+
authorization_response_iss_parameter_supported: boolean().optional().catch(void 0)
|
|
1735
1724
|
});
|
|
1736
1725
|
/**
|
|
1737
1726
|
* OpenID Connect Discovery metadata that may include OAuth 2.0 fields
|
|
@@ -1746,13 +1735,13 @@ const OpenIdProviderDiscoveryMetadataSchema = object({
|
|
|
1746
1735
|
* OAuth 2.1 token response
|
|
1747
1736
|
*/
|
|
1748
1737
|
const OAuthTokensSchema = object({
|
|
1749
|
-
access_token: string
|
|
1750
|
-
id_token: string
|
|
1751
|
-
token_type: string
|
|
1752
|
-
expires_in: number().optional(),
|
|
1753
|
-
scope: string
|
|
1754
|
-
refresh_token: string
|
|
1755
|
-
issuer: string
|
|
1738
|
+
access_token: string(),
|
|
1739
|
+
id_token: string().optional(),
|
|
1740
|
+
token_type: string(),
|
|
1741
|
+
expires_in: number$1().optional(),
|
|
1742
|
+
scope: string().optional(),
|
|
1743
|
+
refresh_token: string().optional(),
|
|
1744
|
+
issuer: string().optional().catch(void 0)
|
|
1756
1745
|
}).strip();
|
|
1757
1746
|
/**
|
|
1758
1747
|
* RFC 8693 §2.2.1 Token Exchange response for ID-JAG tokens.
|
|
@@ -1763,18 +1752,18 @@ const OAuthTokensSchema = object({
|
|
|
1763
1752
|
*/
|
|
1764
1753
|
const IdJagTokenExchangeResponseSchema = object({
|
|
1765
1754
|
issued_token_type: literal("urn:ietf:params:oauth:token-type:id-jag"),
|
|
1766
|
-
access_token: string
|
|
1767
|
-
token_type: string
|
|
1768
|
-
expires_in: number
|
|
1769
|
-
scope: string
|
|
1755
|
+
access_token: string(),
|
|
1756
|
+
token_type: string().optional(),
|
|
1757
|
+
expires_in: number().optional(),
|
|
1758
|
+
scope: string().optional()
|
|
1770
1759
|
}).strip();
|
|
1771
1760
|
/**
|
|
1772
1761
|
* OAuth 2.1 error response
|
|
1773
1762
|
*/
|
|
1774
1763
|
const OAuthErrorResponseSchema = object({
|
|
1775
|
-
error: string
|
|
1776
|
-
error_description: string
|
|
1777
|
-
error_uri: string
|
|
1764
|
+
error: string(),
|
|
1765
|
+
error_description: string().optional(),
|
|
1766
|
+
error_uri: string().optional()
|
|
1778
1767
|
});
|
|
1779
1768
|
/**
|
|
1780
1769
|
* Optional version of {@linkcode SafeUrlSchema} that allows empty string for backward compatibility on `tos_uri` and `logo_uri`
|
|
@@ -1785,32 +1774,32 @@ const OptionalSafeUrlSchema = SafeUrlSchema.optional().or(literal("").transform(
|
|
|
1785
1774
|
*/
|
|
1786
1775
|
const OAuthClientMetadataSchema = object({
|
|
1787
1776
|
redirect_uris: array(SafeUrlSchema),
|
|
1788
|
-
token_endpoint_auth_method: string
|
|
1789
|
-
grant_types: array(string
|
|
1790
|
-
response_types: array(string
|
|
1791
|
-
application_type: string
|
|
1792
|
-
client_name: string
|
|
1777
|
+
token_endpoint_auth_method: string().optional(),
|
|
1778
|
+
grant_types: array(string()).optional(),
|
|
1779
|
+
response_types: array(string()).optional(),
|
|
1780
|
+
application_type: string().optional(),
|
|
1781
|
+
client_name: string().optional(),
|
|
1793
1782
|
client_uri: SafeUrlSchema.optional(),
|
|
1794
1783
|
logo_uri: OptionalSafeUrlSchema,
|
|
1795
|
-
scope: string
|
|
1796
|
-
contacts: array(string
|
|
1784
|
+
scope: string().optional(),
|
|
1785
|
+
contacts: array(string()).optional(),
|
|
1797
1786
|
tos_uri: OptionalSafeUrlSchema,
|
|
1798
|
-
policy_uri: string
|
|
1787
|
+
policy_uri: string().optional(),
|
|
1799
1788
|
jwks_uri: SafeUrlSchema.optional(),
|
|
1800
1789
|
jwks: any().optional(),
|
|
1801
|
-
software_id: string
|
|
1802
|
-
software_version: string
|
|
1803
|
-
software_statement: string
|
|
1790
|
+
software_id: string().optional(),
|
|
1791
|
+
software_version: string().optional(),
|
|
1792
|
+
software_statement: string().optional()
|
|
1804
1793
|
}).strip();
|
|
1805
1794
|
/**
|
|
1806
1795
|
* RFC 7591 OAuth 2.0 Dynamic Client Registration client information
|
|
1807
1796
|
*/
|
|
1808
1797
|
const OAuthClientInformationSchema = object({
|
|
1809
|
-
client_id: string
|
|
1810
|
-
client_secret: string
|
|
1811
|
-
client_id_issued_at: number
|
|
1812
|
-
client_secret_expires_at: number
|
|
1813
|
-
issuer: string
|
|
1798
|
+
client_id: string(),
|
|
1799
|
+
client_secret: string().optional(),
|
|
1800
|
+
client_id_issued_at: number().optional(),
|
|
1801
|
+
client_secret_expires_at: number().optional(),
|
|
1802
|
+
issuer: string().optional().catch(void 0)
|
|
1814
1803
|
}).strip();
|
|
1815
1804
|
/**
|
|
1816
1805
|
* RFC 7591 OAuth 2.0 Dynamic Client Registration full response (client information plus metadata)
|
|
@@ -1820,15 +1809,15 @@ const OAuthClientInformationFullSchema = OAuthClientMetadataSchema.merge(OAuthCl
|
|
|
1820
1809
|
* RFC 7591 OAuth 2.0 Dynamic Client Registration error response
|
|
1821
1810
|
*/
|
|
1822
1811
|
const OAuthClientRegistrationErrorSchema = object({
|
|
1823
|
-
error: string
|
|
1824
|
-
error_description: string
|
|
1812
|
+
error: string(),
|
|
1813
|
+
error_description: string().optional()
|
|
1825
1814
|
}).strip();
|
|
1826
1815
|
/**
|
|
1827
1816
|
* RFC 7009 OAuth 2.0 Token Revocation request
|
|
1828
1817
|
*/
|
|
1829
1818
|
const OAuthTokenRevocationRequestSchema = object({
|
|
1830
|
-
token: string
|
|
1831
|
-
token_type_hint: string
|
|
1819
|
+
token: string(),
|
|
1820
|
+
token_type_hint: string().optional()
|
|
1832
1821
|
}).strip();
|
|
1833
1822
|
//#endregion
|
|
1834
1823
|
//#region ../../../node_modules/.pnpm/@modelcontextprotocol+client@2.3.1/node_modules/@modelcontextprotocol/client/dist/src-WCy6ifGf.mjs
|
|
@@ -2383,31 +2372,31 @@ function normalizeContentlessToolResult(value) {
|
|
|
2383
2372
|
*/
|
|
2384
2373
|
function build$1() {
|
|
2385
2374
|
const JSONValueSchema$1 = lazy(() => union([
|
|
2386
|
-
string
|
|
2387
|
-
number
|
|
2388
|
-
boolean
|
|
2375
|
+
string(),
|
|
2376
|
+
number(),
|
|
2377
|
+
boolean(),
|
|
2389
2378
|
_null(),
|
|
2390
|
-
record$
|
|
2379
|
+
record$2(string(), JSONValueSchema$1),
|
|
2391
2380
|
array(JSONValueSchema$1)
|
|
2392
2381
|
]));
|
|
2393
|
-
const JSONObjectSchema$1 = record$
|
|
2382
|
+
const JSONObjectSchema$1 = record$2(string(), JSONValueSchema$1);
|
|
2394
2383
|
/**
|
|
2395
2384
|
* A progress token, used to associate progress notifications with the original request.
|
|
2396
2385
|
*/
|
|
2397
|
-
const ProgressTokenSchema$1 = union([string
|
|
2386
|
+
const ProgressTokenSchema$1 = union([string(), number().int()]);
|
|
2398
2387
|
/**
|
|
2399
2388
|
* An opaque token used to represent a cursor for pagination.
|
|
2400
2389
|
*/
|
|
2401
|
-
const CursorSchema$1 = string
|
|
2390
|
+
const CursorSchema$1 = string();
|
|
2402
2391
|
/** @deprecated 2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only. */
|
|
2403
|
-
const TaskMetadataSchema$1 = object({ ttl: number
|
|
2392
|
+
const TaskMetadataSchema$1 = object({ ttl: number().optional() });
|
|
2404
2393
|
/**
|
|
2405
2394
|
* Metadata for associating messages with a task.
|
|
2406
2395
|
* Include this in the `_meta` field under the key `io.modelcontextprotocol/related-task`.
|
|
2407
2396
|
*
|
|
2408
2397
|
* @deprecated 2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only.
|
|
2409
2398
|
*/
|
|
2410
|
-
const RelatedTaskMetadataSchema$1 = object({ taskId: string
|
|
2399
|
+
const RelatedTaskMetadataSchema$1 = object({ taskId: string() });
|
|
2411
2400
|
const RequestMetaSchema$1 = looseObject({
|
|
2412
2401
|
progressToken: ProgressTokenSchema$1.optional(),
|
|
2413
2402
|
"io.modelcontextprotocol/related-task": RelatedTaskMetadataSchema$1.optional()
|
|
@@ -2423,26 +2412,26 @@ function build$1() {
|
|
|
2423
2412
|
*/
|
|
2424
2413
|
const TaskAugmentedRequestParamsSchema$1 = BaseRequestParamsSchema$1.extend({ task: TaskMetadataSchema$1.optional() });
|
|
2425
2414
|
const RequestSchema$1 = object({
|
|
2426
|
-
method: string
|
|
2415
|
+
method: string(),
|
|
2427
2416
|
params: BaseRequestParamsSchema$1.loose().optional()
|
|
2428
2417
|
});
|
|
2429
2418
|
const NotificationsParamsSchema$1 = object({ _meta: RequestMetaSchema$1.optional() });
|
|
2430
2419
|
const NotificationSchema$1 = object({
|
|
2431
|
-
method: string
|
|
2420
|
+
method: string(),
|
|
2432
2421
|
params: NotificationsParamsSchema$1.loose().optional()
|
|
2433
2422
|
});
|
|
2434
2423
|
const ResultSchema$1 = looseObject({ _meta: RequestMetaSchema$1.optional() });
|
|
2435
2424
|
/**
|
|
2436
2425
|
* A uniquely identifying ID for a request in JSON-RPC.
|
|
2437
2426
|
*/
|
|
2438
|
-
const RequestIdSchema$1 = union([string
|
|
2427
|
+
const RequestIdSchema$1 = union([string(), number().int()]);
|
|
2439
2428
|
/**
|
|
2440
2429
|
* A response that indicates success but carries no data.
|
|
2441
2430
|
*/
|
|
2442
2431
|
const EmptyResultSchema$1 = ResultSchema$1.strict();
|
|
2443
2432
|
const CancelledNotificationParamsSchema$1 = NotificationsParamsSchema$1.extend({
|
|
2444
2433
|
requestId: RequestIdSchema$1.optional(),
|
|
2445
|
-
reason: string
|
|
2434
|
+
reason: string().optional()
|
|
2446
2435
|
});
|
|
2447
2436
|
/**
|
|
2448
2437
|
* This notification can be sent by either side to indicate that it is cancelling a previously-issued request.
|
|
@@ -2461,9 +2450,9 @@ function build$1() {
|
|
|
2461
2450
|
* Icon schema for use in {@link Tool | tools}, {@link Prompt | prompts}, {@link Resource | resources}, and {@link Implementation | implementations}.
|
|
2462
2451
|
*/
|
|
2463
2452
|
const IconSchema$1 = object({
|
|
2464
|
-
src: string
|
|
2465
|
-
mimeType: string
|
|
2466
|
-
sizes: array(string
|
|
2453
|
+
src: string(),
|
|
2454
|
+
mimeType: string().optional(),
|
|
2455
|
+
sizes: array(string()).optional(),
|
|
2467
2456
|
theme: _enum(["light", "dark"]).optional()
|
|
2468
2457
|
});
|
|
2469
2458
|
/**
|
|
@@ -2475,8 +2464,8 @@ function build$1() {
|
|
|
2475
2464
|
* Base metadata interface for common properties across {@link Resource | resources}, {@link Tool | tools}, {@link Prompt | prompts}, and {@link Implementation | implementations}.
|
|
2476
2465
|
*/
|
|
2477
2466
|
const BaseMetadataSchema$1 = object({
|
|
2478
|
-
name: string
|
|
2479
|
-
title: string
|
|
2467
|
+
name: string(),
|
|
2468
|
+
title: string().optional()
|
|
2480
2469
|
});
|
|
2481
2470
|
/**
|
|
2482
2471
|
* Describes the name and version of an MCP implementation.
|
|
@@ -2484,11 +2473,11 @@ function build$1() {
|
|
|
2484
2473
|
const ImplementationSchema$1 = BaseMetadataSchema$1.extend({
|
|
2485
2474
|
...BaseMetadataSchema$1.shape,
|
|
2486
2475
|
...IconsSchema$1.shape,
|
|
2487
|
-
version: string
|
|
2488
|
-
websiteUrl: string
|
|
2489
|
-
description: string
|
|
2476
|
+
version: string(),
|
|
2477
|
+
websiteUrl: string().optional(),
|
|
2478
|
+
description: string().optional()
|
|
2490
2479
|
});
|
|
2491
|
-
const FormElicitationCapabilitySchema = intersection(object({ applyDefaults: boolean
|
|
2480
|
+
const FormElicitationCapabilitySchema = intersection(object({ applyDefaults: boolean().optional() }), JSONObjectSchema$1);
|
|
2492
2481
|
const ElicitationCapabilitySchema = preprocess((value) => {
|
|
2493
2482
|
if (value && typeof value === "object" && !Array.isArray(value) && Object.keys(value).length === 0) return { form: {} };
|
|
2494
2483
|
return value;
|
|
@@ -2523,18 +2512,18 @@ function build$1() {
|
|
|
2523
2512
|
* 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
2513
|
*/
|
|
2525
2514
|
const ClientCapabilitiesSchema$1 = object({
|
|
2526
|
-
experimental: record$
|
|
2515
|
+
experimental: record$2(string(), JSONObjectSchema$1).optional(),
|
|
2527
2516
|
sampling: object({
|
|
2528
2517
|
context: JSONObjectSchema$1.optional(),
|
|
2529
2518
|
tools: JSONObjectSchema$1.optional()
|
|
2530
2519
|
}).optional(),
|
|
2531
2520
|
elicitation: ElicitationCapabilitySchema.optional(),
|
|
2532
|
-
roots: object({ listChanged: boolean
|
|
2521
|
+
roots: object({ listChanged: boolean().optional() }).optional(),
|
|
2533
2522
|
tasks: ClientTasksCapabilitySchema$1.optional(),
|
|
2534
|
-
extensions: record$
|
|
2523
|
+
extensions: record$2(string(), JSONObjectSchema$1).optional()
|
|
2535
2524
|
});
|
|
2536
2525
|
const InitializeRequestParamsSchema$1 = BaseRequestParamsSchema$1.extend({
|
|
2537
|
-
protocolVersion: string
|
|
2526
|
+
protocolVersion: string(),
|
|
2538
2527
|
capabilities: ClientCapabilitiesSchema$1,
|
|
2539
2528
|
clientInfo: ImplementationSchema$1
|
|
2540
2529
|
});
|
|
@@ -2549,26 +2538,26 @@ function build$1() {
|
|
|
2549
2538
|
* 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
2539
|
*/
|
|
2551
2540
|
const ServerCapabilitiesSchema$1 = object({
|
|
2552
|
-
experimental: record$
|
|
2541
|
+
experimental: record$2(string(), JSONObjectSchema$1).optional(),
|
|
2553
2542
|
logging: JSONObjectSchema$1.optional(),
|
|
2554
2543
|
completions: JSONObjectSchema$1.optional(),
|
|
2555
|
-
prompts: object({ listChanged: boolean
|
|
2544
|
+
prompts: object({ listChanged: boolean().optional() }).optional(),
|
|
2556
2545
|
resources: object({
|
|
2557
|
-
subscribe: boolean
|
|
2558
|
-
listChanged: boolean
|
|
2546
|
+
subscribe: boolean().optional(),
|
|
2547
|
+
listChanged: boolean().optional()
|
|
2559
2548
|
}).optional(),
|
|
2560
|
-
tools: object({ listChanged: boolean
|
|
2549
|
+
tools: object({ listChanged: boolean().optional() }).optional(),
|
|
2561
2550
|
tasks: ServerTasksCapabilitySchema$1.optional(),
|
|
2562
|
-
extensions: record$
|
|
2551
|
+
extensions: record$2(string(), JSONObjectSchema$1).optional()
|
|
2563
2552
|
});
|
|
2564
2553
|
/**
|
|
2565
2554
|
* After receiving an initialize request from the client, the server sends this response.
|
|
2566
2555
|
*/
|
|
2567
2556
|
const InitializeResultSchema$1 = ResultSchema$1.extend({
|
|
2568
|
-
protocolVersion: string
|
|
2557
|
+
protocolVersion: string(),
|
|
2569
2558
|
capabilities: ServerCapabilitiesSchema$1,
|
|
2570
2559
|
serverInfo: ImplementationSchema$1,
|
|
2571
|
-
instructions: string
|
|
2560
|
+
instructions: string().optional()
|
|
2572
2561
|
});
|
|
2573
2562
|
/**
|
|
2574
2563
|
* This notification is sent from the client to the server after initialization has finished.
|
|
@@ -2585,9 +2574,9 @@ function build$1() {
|
|
|
2585
2574
|
params: BaseRequestParamsSchema$1.optional()
|
|
2586
2575
|
});
|
|
2587
2576
|
const ProgressSchema$1 = object({
|
|
2588
|
-
progress: number
|
|
2589
|
-
total: optional(number
|
|
2590
|
-
message: optional(string
|
|
2577
|
+
progress: number(),
|
|
2578
|
+
total: optional(number()),
|
|
2579
|
+
message: optional(string())
|
|
2591
2580
|
});
|
|
2592
2581
|
const ProgressNotificationParamsSchema$1 = object({
|
|
2593
2582
|
...NotificationsParamsSchema$1.shape,
|
|
@@ -2610,17 +2599,17 @@ function build$1() {
|
|
|
2610
2599
|
* The contents of a specific resource or sub-resource.
|
|
2611
2600
|
*/
|
|
2612
2601
|
const ResourceContentsSchema$1 = object({
|
|
2613
|
-
uri: string
|
|
2614
|
-
mimeType: optional(string
|
|
2615
|
-
_meta: record$
|
|
2602
|
+
uri: string(),
|
|
2603
|
+
mimeType: optional(string()),
|
|
2604
|
+
_meta: record$2(string(), unknown()).optional()
|
|
2616
2605
|
});
|
|
2617
|
-
const TextResourceContentsSchema$1 = ResourceContentsSchema$1.extend({ text: string
|
|
2606
|
+
const TextResourceContentsSchema$1 = ResourceContentsSchema$1.extend({ text: string() });
|
|
2618
2607
|
/**
|
|
2619
2608
|
* A Zod schema for validating Base64 strings that is more performant and
|
|
2620
2609
|
* robust for very large inputs than the default regex-based check. It avoids
|
|
2621
2610
|
* stack overflows by using the native `atob` function for validation.
|
|
2622
2611
|
*/
|
|
2623
|
-
const Base64Schema = string
|
|
2612
|
+
const Base64Schema = string().refine((val) => {
|
|
2624
2613
|
try {
|
|
2625
2614
|
atob(val);
|
|
2626
2615
|
return true;
|
|
@@ -2638,7 +2627,7 @@ function build$1() {
|
|
|
2638
2627
|
*/
|
|
2639
2628
|
const AnnotationsSchema$1 = object({
|
|
2640
2629
|
audience: array(RoleSchema$1).optional(),
|
|
2641
|
-
priority: number
|
|
2630
|
+
priority: number().min(0).max(1).optional(),
|
|
2642
2631
|
lastModified: datetime({ offset: true }).optional()
|
|
2643
2632
|
});
|
|
2644
2633
|
/**
|
|
@@ -2647,10 +2636,10 @@ function build$1() {
|
|
|
2647
2636
|
const ResourceSchema$1 = object({
|
|
2648
2637
|
...BaseMetadataSchema$1.shape,
|
|
2649
2638
|
...IconsSchema$1.shape,
|
|
2650
|
-
uri: string
|
|
2651
|
-
description: optional(string
|
|
2652
|
-
mimeType: optional(string
|
|
2653
|
-
size: optional(number
|
|
2639
|
+
uri: string(),
|
|
2640
|
+
description: optional(string()),
|
|
2641
|
+
mimeType: optional(string()),
|
|
2642
|
+
size: optional(number()),
|
|
2654
2643
|
annotations: AnnotationsSchema$1.optional(),
|
|
2655
2644
|
_meta: optional(looseObject({}))
|
|
2656
2645
|
});
|
|
@@ -2660,9 +2649,9 @@ function build$1() {
|
|
|
2660
2649
|
const ResourceTemplateSchema$1 = object({
|
|
2661
2650
|
...BaseMetadataSchema$1.shape,
|
|
2662
2651
|
...IconsSchema$1.shape,
|
|
2663
|
-
uriTemplate: string
|
|
2664
|
-
description: optional(string
|
|
2665
|
-
mimeType: optional(string
|
|
2652
|
+
uriTemplate: string(),
|
|
2653
|
+
description: optional(string()),
|
|
2654
|
+
mimeType: optional(string()),
|
|
2666
2655
|
annotations: AnnotationsSchema$1.optional(),
|
|
2667
2656
|
_meta: optional(looseObject({}))
|
|
2668
2657
|
});
|
|
@@ -2682,7 +2671,7 @@ function build$1() {
|
|
|
2682
2671
|
* The server's response to a {@linkcode ListResourceTemplatesRequest | resources/templates/list} request from the client.
|
|
2683
2672
|
*/
|
|
2684
2673
|
const ListResourceTemplatesResultSchema$1 = PaginatedResultSchema$1.extend({ resourceTemplates: array(ResourceTemplateSchema$1) });
|
|
2685
|
-
const ResourceRequestParamsSchema$1 = BaseRequestParamsSchema$1.extend({ uri: string
|
|
2674
|
+
const ResourceRequestParamsSchema$1 = BaseRequestParamsSchema$1.extend({ uri: string() });
|
|
2686
2675
|
/**
|
|
2687
2676
|
* Parameters for a {@linkcode ReadResourceRequest | resources/read} request.
|
|
2688
2677
|
*/
|
|
@@ -2724,7 +2713,7 @@ function build$1() {
|
|
|
2724
2713
|
/**
|
|
2725
2714
|
* Parameters for a {@linkcode ResourceUpdatedNotification | notifications/resources/updated} notification.
|
|
2726
2715
|
*/
|
|
2727
|
-
const ResourceUpdatedNotificationParamsSchema$1 = NotificationsParamsSchema$1.extend({ uri: string
|
|
2716
|
+
const ResourceUpdatedNotificationParamsSchema$1 = NotificationsParamsSchema$1.extend({ uri: string() });
|
|
2728
2717
|
/**
|
|
2729
2718
|
* A notification from the server to the client, informing it that a resource has changed and may need to be read again. This should only be sent if the client previously sent a {@linkcode SubscribeRequest | resources/subscribe} request.
|
|
2730
2719
|
*/
|
|
@@ -2736,9 +2725,9 @@ function build$1() {
|
|
|
2736
2725
|
* Describes an argument that a prompt can accept.
|
|
2737
2726
|
*/
|
|
2738
2727
|
const PromptArgumentSchema$1 = object({
|
|
2739
|
-
name: string
|
|
2740
|
-
description: optional(string
|
|
2741
|
-
required: optional(boolean
|
|
2728
|
+
name: string(),
|
|
2729
|
+
description: optional(string()),
|
|
2730
|
+
required: optional(boolean())
|
|
2742
2731
|
});
|
|
2743
2732
|
/**
|
|
2744
2733
|
* A prompt or prompt template that the server offers.
|
|
@@ -2746,7 +2735,7 @@ function build$1() {
|
|
|
2746
2735
|
const PromptSchema$1 = object({
|
|
2747
2736
|
...BaseMetadataSchema$1.shape,
|
|
2748
2737
|
...IconsSchema$1.shape,
|
|
2749
|
-
description: optional(string
|
|
2738
|
+
description: optional(string()),
|
|
2750
2739
|
arguments: optional(array(PromptArgumentSchema$1)),
|
|
2751
2740
|
_meta: optional(looseObject({}))
|
|
2752
2741
|
});
|
|
@@ -2762,8 +2751,8 @@ function build$1() {
|
|
|
2762
2751
|
* Parameters for a {@linkcode GetPromptRequest | prompts/get} request.
|
|
2763
2752
|
*/
|
|
2764
2753
|
const GetPromptRequestParamsSchema$1 = BaseRequestParamsSchema$1.extend({
|
|
2765
|
-
name: string
|
|
2766
|
-
arguments: record$
|
|
2754
|
+
name: string(),
|
|
2755
|
+
arguments: record$2(string(), string()).optional()
|
|
2767
2756
|
});
|
|
2768
2757
|
/**
|
|
2769
2758
|
* Used by the client to get a prompt provided by the server.
|
|
@@ -2777,9 +2766,9 @@ function build$1() {
|
|
|
2777
2766
|
*/
|
|
2778
2767
|
const TextContentSchema$1 = object({
|
|
2779
2768
|
type: literal("text"),
|
|
2780
|
-
text: string
|
|
2769
|
+
text: string(),
|
|
2781
2770
|
annotations: AnnotationsSchema$1.optional(),
|
|
2782
|
-
_meta: record$
|
|
2771
|
+
_meta: record$2(string(), unknown()).optional()
|
|
2783
2772
|
});
|
|
2784
2773
|
/**
|
|
2785
2774
|
* An image provided to or from an LLM.
|
|
@@ -2787,9 +2776,9 @@ function build$1() {
|
|
|
2787
2776
|
const ImageContentSchema$1 = object({
|
|
2788
2777
|
type: literal("image"),
|
|
2789
2778
|
data: Base64Schema,
|
|
2790
|
-
mimeType: string
|
|
2779
|
+
mimeType: string(),
|
|
2791
2780
|
annotations: AnnotationsSchema$1.optional(),
|
|
2792
|
-
_meta: record$
|
|
2781
|
+
_meta: record$2(string(), unknown()).optional()
|
|
2793
2782
|
});
|
|
2794
2783
|
/**
|
|
2795
2784
|
* Audio content provided to or from an LLM.
|
|
@@ -2797,9 +2786,9 @@ function build$1() {
|
|
|
2797
2786
|
const AudioContentSchema$1 = object({
|
|
2798
2787
|
type: literal("audio"),
|
|
2799
2788
|
data: Base64Schema,
|
|
2800
|
-
mimeType: string
|
|
2789
|
+
mimeType: string(),
|
|
2801
2790
|
annotations: AnnotationsSchema$1.optional(),
|
|
2802
|
-
_meta: record$
|
|
2791
|
+
_meta: record$2(string(), unknown()).optional()
|
|
2803
2792
|
});
|
|
2804
2793
|
/**
|
|
2805
2794
|
* A tool call request from an assistant (LLM).
|
|
@@ -2811,10 +2800,10 @@ function build$1() {
|
|
|
2811
2800
|
*/
|
|
2812
2801
|
const ToolUseContentSchema$1 = object({
|
|
2813
2802
|
type: literal("tool_use"),
|
|
2814
|
-
name: string
|
|
2815
|
-
id: string
|
|
2816
|
-
input: record$
|
|
2817
|
-
_meta: record$
|
|
2803
|
+
name: string(),
|
|
2804
|
+
id: string(),
|
|
2805
|
+
input: record$2(string(), unknown()),
|
|
2806
|
+
_meta: record$2(string(), unknown()).optional()
|
|
2818
2807
|
});
|
|
2819
2808
|
/**
|
|
2820
2809
|
* The contents of a resource, embedded into a prompt or tool call result.
|
|
@@ -2823,7 +2812,7 @@ function build$1() {
|
|
|
2823
2812
|
type: literal("resource"),
|
|
2824
2813
|
resource: union([TextResourceContentsSchema$1, BlobResourceContentsSchema$1]),
|
|
2825
2814
|
annotations: AnnotationsSchema$1.optional(),
|
|
2826
|
-
_meta: record$
|
|
2815
|
+
_meta: record$2(string(), unknown()).optional()
|
|
2827
2816
|
});
|
|
2828
2817
|
/**
|
|
2829
2818
|
* A resource that the server is capable of reading, included in a prompt or tool call result.
|
|
@@ -2852,7 +2841,7 @@ function build$1() {
|
|
|
2852
2841
|
* The server's response to a {@linkcode GetPromptRequest | prompts/get} request from the client.
|
|
2853
2842
|
*/
|
|
2854
2843
|
const GetPromptResultSchema$1 = ResultSchema$1.extend({
|
|
2855
|
-
description: string
|
|
2844
|
+
description: string().optional(),
|
|
2856
2845
|
messages: array(PromptMessageSchema$1)
|
|
2857
2846
|
});
|
|
2858
2847
|
/**
|
|
@@ -2873,11 +2862,11 @@ function build$1() {
|
|
|
2873
2862
|
* received from untrusted servers.
|
|
2874
2863
|
*/
|
|
2875
2864
|
const ToolAnnotationsSchema$1 = object({
|
|
2876
|
-
title: string
|
|
2877
|
-
readOnlyHint: boolean
|
|
2878
|
-
destructiveHint: boolean
|
|
2879
|
-
idempotentHint: boolean
|
|
2880
|
-
openWorldHint: boolean
|
|
2865
|
+
title: string().optional(),
|
|
2866
|
+
readOnlyHint: boolean().optional(),
|
|
2867
|
+
destructiveHint: boolean().optional(),
|
|
2868
|
+
idempotentHint: boolean().optional(),
|
|
2869
|
+
openWorldHint: boolean().optional()
|
|
2881
2870
|
});
|
|
2882
2871
|
/**
|
|
2883
2872
|
* Execution-related properties for a tool.
|
|
@@ -2893,20 +2882,20 @@ function build$1() {
|
|
|
2893
2882
|
const ToolSchema$1 = object({
|
|
2894
2883
|
...BaseMetadataSchema$1.shape,
|
|
2895
2884
|
...IconsSchema$1.shape,
|
|
2896
|
-
description: string
|
|
2885
|
+
description: string().optional(),
|
|
2897
2886
|
inputSchema: object({
|
|
2898
2887
|
type: literal("object"),
|
|
2899
|
-
properties: record$
|
|
2900
|
-
required: array(string
|
|
2888
|
+
properties: record$2(string(), JSONValueSchema$1).optional(),
|
|
2889
|
+
required: array(string()).optional()
|
|
2901
2890
|
}).catchall(unknown()),
|
|
2902
2891
|
outputSchema: object({
|
|
2903
2892
|
type: literal("object"),
|
|
2904
|
-
properties: record$
|
|
2905
|
-
required: array(string
|
|
2893
|
+
properties: record$2(string(), JSONValueSchema$1).optional(),
|
|
2894
|
+
required: array(string()).optional()
|
|
2906
2895
|
}).catchall(unknown()).optional(),
|
|
2907
2896
|
annotations: ToolAnnotationsSchema$1.optional(),
|
|
2908
2897
|
execution: ToolExecutionSchema$1.optional(),
|
|
2909
|
-
_meta: record$
|
|
2898
|
+
_meta: record$2(string(), unknown()).optional()
|
|
2910
2899
|
});
|
|
2911
2900
|
/**
|
|
2912
2901
|
* Sent from the client to request a list of tools the server has.
|
|
@@ -2921,15 +2910,15 @@ function build$1() {
|
|
|
2921
2910
|
*/
|
|
2922
2911
|
const CallToolResultSchema$1 = ResultSchema$1.extend({
|
|
2923
2912
|
content: array(ContentBlockSchema$1),
|
|
2924
|
-
structuredContent: record$
|
|
2925
|
-
isError: boolean
|
|
2913
|
+
structuredContent: record$2(string(), unknown()).optional(),
|
|
2914
|
+
isError: boolean().optional()
|
|
2926
2915
|
});
|
|
2927
2916
|
/**
|
|
2928
2917
|
* Parameters for a `tools/call` request.
|
|
2929
2918
|
*/
|
|
2930
2919
|
const CallToolRequestParamsSchema$1 = TaskAugmentedRequestParamsSchema$1.extend({
|
|
2931
|
-
name: string
|
|
2932
|
-
arguments: record$
|
|
2920
|
+
name: string(),
|
|
2921
|
+
arguments: record$2(string(), unknown()).optional()
|
|
2933
2922
|
});
|
|
2934
2923
|
/**
|
|
2935
2924
|
* Used by the client to invoke a tool provided by the server.
|
|
@@ -2990,7 +2979,7 @@ function build$1() {
|
|
|
2990
2979
|
*/
|
|
2991
2980
|
const LoggingMessageNotificationParamsSchema$1 = NotificationsParamsSchema$1.extend({
|
|
2992
2981
|
level: LoggingLevelSchema$1,
|
|
2993
|
-
logger: string
|
|
2982
|
+
logger: string().optional(),
|
|
2994
2983
|
data: unknown()
|
|
2995
2984
|
});
|
|
2996
2985
|
/**
|
|
@@ -3011,7 +3000,7 @@ function build$1() {
|
|
|
3011
3000
|
* in the specification for at least twelve months. Migrate to calling LLM
|
|
3012
3001
|
* provider APIs directly.
|
|
3013
3002
|
*/
|
|
3014
|
-
const ModelHintSchema$1 = object({ name: string
|
|
3003
|
+
const ModelHintSchema$1 = object({ name: string().optional() });
|
|
3015
3004
|
/**
|
|
3016
3005
|
* The server's preferences for model selection, requested of the client during sampling.
|
|
3017
3006
|
*
|
|
@@ -3021,9 +3010,9 @@ function build$1() {
|
|
|
3021
3010
|
*/
|
|
3022
3011
|
const ModelPreferencesSchema$1 = object({
|
|
3023
3012
|
hints: array(ModelHintSchema$1).optional(),
|
|
3024
|
-
costPriority: number
|
|
3025
|
-
speedPriority: number
|
|
3026
|
-
intelligencePriority: number
|
|
3013
|
+
costPriority: number().min(0).max(1).optional(),
|
|
3014
|
+
speedPriority: number().min(0).max(1).optional(),
|
|
3015
|
+
intelligencePriority: number().min(0).max(1).optional()
|
|
3027
3016
|
});
|
|
3028
3017
|
/**
|
|
3029
3018
|
* Controls tool usage behavior in sampling requests.
|
|
@@ -3047,11 +3036,11 @@ function build$1() {
|
|
|
3047
3036
|
*/
|
|
3048
3037
|
const ToolResultContentSchema$1 = object({
|
|
3049
3038
|
type: literal("tool_result"),
|
|
3050
|
-
toolUseId: string
|
|
3039
|
+
toolUseId: string().describe("The unique identifier for the corresponding tool call."),
|
|
3051
3040
|
content: array(ContentBlockSchema$1),
|
|
3052
3041
|
structuredContent: object({}).loose().optional(),
|
|
3053
|
-
isError: boolean
|
|
3054
|
-
_meta: record$
|
|
3042
|
+
isError: boolean().optional(),
|
|
3043
|
+
_meta: record$2(string(), unknown()).optional()
|
|
3055
3044
|
});
|
|
3056
3045
|
/**
|
|
3057
3046
|
* Basic content types for sampling responses (without tool use).
|
|
@@ -3091,7 +3080,7 @@ function build$1() {
|
|
|
3091
3080
|
const SamplingMessageSchema$1 = object({
|
|
3092
3081
|
role: RoleSchema$1,
|
|
3093
3082
|
content: union([SamplingMessageContentBlockSchema$1, array(SamplingMessageContentBlockSchema$1)]),
|
|
3094
|
-
_meta: record$
|
|
3083
|
+
_meta: record$2(string(), unknown()).optional()
|
|
3095
3084
|
});
|
|
3096
3085
|
/**
|
|
3097
3086
|
* Parameters for a `sampling/createMessage` request.
|
|
@@ -3103,15 +3092,15 @@ function build$1() {
|
|
|
3103
3092
|
const CreateMessageRequestParamsSchema$1 = TaskAugmentedRequestParamsSchema$1.extend({
|
|
3104
3093
|
messages: array(SamplingMessageSchema$1),
|
|
3105
3094
|
modelPreferences: ModelPreferencesSchema$1.optional(),
|
|
3106
|
-
systemPrompt: string
|
|
3095
|
+
systemPrompt: string().optional(),
|
|
3107
3096
|
includeContext: _enum([
|
|
3108
3097
|
"none",
|
|
3109
3098
|
"thisServer",
|
|
3110
3099
|
"allServers"
|
|
3111
3100
|
]).optional(),
|
|
3112
|
-
temperature: number
|
|
3113
|
-
maxTokens: number
|
|
3114
|
-
stopSequences: array(string
|
|
3101
|
+
temperature: number().optional(),
|
|
3102
|
+
maxTokens: number().int(),
|
|
3103
|
+
stopSequences: array(string()).optional(),
|
|
3115
3104
|
metadata: JSONObjectSchema$1.optional(),
|
|
3116
3105
|
tools: array(ToolSchema$1).optional(),
|
|
3117
3106
|
toolChoice: ToolChoiceSchema$1.optional()
|
|
@@ -3137,12 +3126,12 @@ function build$1() {
|
|
|
3137
3126
|
* provider APIs directly.
|
|
3138
3127
|
*/
|
|
3139
3128
|
const CreateMessageResultSchema$1 = ResultSchema$1.extend({
|
|
3140
|
-
model: string
|
|
3129
|
+
model: string(),
|
|
3141
3130
|
stopReason: optional(_enum([
|
|
3142
3131
|
"endTurn",
|
|
3143
3132
|
"stopSequence",
|
|
3144
3133
|
"maxTokens"
|
|
3145
|
-
]).or(string
|
|
3134
|
+
]).or(string())),
|
|
3146
3135
|
role: RoleSchema$1,
|
|
3147
3136
|
content: SamplingContentSchema$1
|
|
3148
3137
|
});
|
|
@@ -3155,13 +3144,13 @@ function build$1() {
|
|
|
3155
3144
|
* provider APIs directly.
|
|
3156
3145
|
*/
|
|
3157
3146
|
const CreateMessageResultWithToolsSchema$1 = ResultSchema$1.extend({
|
|
3158
|
-
model: string
|
|
3147
|
+
model: string(),
|
|
3159
3148
|
stopReason: optional(_enum([
|
|
3160
3149
|
"endTurn",
|
|
3161
3150
|
"stopSequence",
|
|
3162
3151
|
"maxTokens",
|
|
3163
3152
|
"toolUse"
|
|
3164
|
-
]).or(string
|
|
3153
|
+
]).or(string())),
|
|
3165
3154
|
role: RoleSchema$1,
|
|
3166
3155
|
content: union([SamplingMessageContentBlockSchema$1, array(SamplingMessageContentBlockSchema$1)])
|
|
3167
3156
|
});
|
|
@@ -3170,60 +3159,60 @@ function build$1() {
|
|
|
3170
3159
|
*/
|
|
3171
3160
|
const BooleanSchemaSchema$1 = object({
|
|
3172
3161
|
type: literal("boolean"),
|
|
3173
|
-
title: string
|
|
3174
|
-
description: string
|
|
3175
|
-
default: boolean
|
|
3162
|
+
title: string().optional(),
|
|
3163
|
+
description: string().optional(),
|
|
3164
|
+
default: boolean().optional()
|
|
3176
3165
|
});
|
|
3177
3166
|
/**
|
|
3178
3167
|
* Primitive schema definition for string fields.
|
|
3179
3168
|
*/
|
|
3180
3169
|
const StringSchemaSchema$1 = object({
|
|
3181
3170
|
type: literal("string"),
|
|
3182
|
-
title: string
|
|
3183
|
-
description: string
|
|
3184
|
-
minLength: number
|
|
3185
|
-
maxLength: number
|
|
3171
|
+
title: string().optional(),
|
|
3172
|
+
description: string().optional(),
|
|
3173
|
+
minLength: number().optional(),
|
|
3174
|
+
maxLength: number().optional(),
|
|
3186
3175
|
format: _enum([
|
|
3187
3176
|
"email",
|
|
3188
3177
|
"uri",
|
|
3189
3178
|
"date",
|
|
3190
3179
|
"date-time"
|
|
3191
3180
|
]).optional(),
|
|
3192
|
-
default: string
|
|
3181
|
+
default: string().optional()
|
|
3193
3182
|
});
|
|
3194
3183
|
/**
|
|
3195
3184
|
* Primitive schema definition for number fields.
|
|
3196
3185
|
*/
|
|
3197
3186
|
const NumberSchemaSchema$1 = object({
|
|
3198
3187
|
type: _enum(["number", "integer"]),
|
|
3199
|
-
title: string
|
|
3200
|
-
description: string
|
|
3201
|
-
minimum: number
|
|
3202
|
-
maximum: number
|
|
3203
|
-
default: number
|
|
3188
|
+
title: string().optional(),
|
|
3189
|
+
description: string().optional(),
|
|
3190
|
+
minimum: number().optional(),
|
|
3191
|
+
maximum: number().optional(),
|
|
3192
|
+
default: number().optional()
|
|
3204
3193
|
});
|
|
3205
3194
|
/**
|
|
3206
3195
|
* Schema for single-selection enumeration without display titles for options.
|
|
3207
3196
|
*/
|
|
3208
3197
|
const UntitledSingleSelectEnumSchemaSchema$1 = object({
|
|
3209
3198
|
type: literal("string"),
|
|
3210
|
-
title: string
|
|
3211
|
-
description: string
|
|
3212
|
-
enum: array(string
|
|
3213
|
-
default: string
|
|
3199
|
+
title: string().optional(),
|
|
3200
|
+
description: string().optional(),
|
|
3201
|
+
enum: array(string()),
|
|
3202
|
+
default: string().optional()
|
|
3214
3203
|
});
|
|
3215
3204
|
/**
|
|
3216
3205
|
* Schema for single-selection enumeration with display titles for each option.
|
|
3217
3206
|
*/
|
|
3218
3207
|
const TitledSingleSelectEnumSchemaSchema$1 = object({
|
|
3219
3208
|
type: literal("string"),
|
|
3220
|
-
title: string
|
|
3221
|
-
description: string
|
|
3209
|
+
title: string().optional(),
|
|
3210
|
+
description: string().optional(),
|
|
3222
3211
|
oneOf: array(object({
|
|
3223
|
-
const: string
|
|
3224
|
-
title: string
|
|
3212
|
+
const: string(),
|
|
3213
|
+
title: string()
|
|
3225
3214
|
})),
|
|
3226
|
-
default: string
|
|
3215
|
+
default: string().optional()
|
|
3227
3216
|
});
|
|
3228
3217
|
/**
|
|
3229
3218
|
* Use {@linkcode TitledSingleSelectEnumSchema} instead.
|
|
@@ -3231,11 +3220,11 @@ function build$1() {
|
|
|
3231
3220
|
*/
|
|
3232
3221
|
const LegacyTitledEnumSchemaSchema$1 = object({
|
|
3233
3222
|
type: literal("string"),
|
|
3234
|
-
title: string
|
|
3235
|
-
description: string
|
|
3236
|
-
enum: array(string
|
|
3237
|
-
enumNames: array(string
|
|
3238
|
-
default: string
|
|
3223
|
+
title: string().optional(),
|
|
3224
|
+
description: string().optional(),
|
|
3225
|
+
enum: array(string()),
|
|
3226
|
+
enumNames: array(string()).optional(),
|
|
3227
|
+
default: string().optional()
|
|
3239
3228
|
});
|
|
3240
3229
|
const SingleSelectEnumSchemaSchema$1 = union([UntitledSingleSelectEnumSchemaSchema$1, TitledSingleSelectEnumSchemaSchema$1]);
|
|
3241
3230
|
/**
|
|
@@ -3243,30 +3232,30 @@ function build$1() {
|
|
|
3243
3232
|
*/
|
|
3244
3233
|
const UntitledMultiSelectEnumSchemaSchema$1 = object({
|
|
3245
3234
|
type: literal("array"),
|
|
3246
|
-
title: string
|
|
3247
|
-
description: string
|
|
3248
|
-
minItems: number
|
|
3249
|
-
maxItems: number
|
|
3235
|
+
title: string().optional(),
|
|
3236
|
+
description: string().optional(),
|
|
3237
|
+
minItems: number().optional(),
|
|
3238
|
+
maxItems: number().optional(),
|
|
3250
3239
|
items: object({
|
|
3251
3240
|
type: literal("string"),
|
|
3252
|
-
enum: array(string
|
|
3241
|
+
enum: array(string())
|
|
3253
3242
|
}),
|
|
3254
|
-
default: array(string
|
|
3243
|
+
default: array(string()).optional()
|
|
3255
3244
|
});
|
|
3256
3245
|
/**
|
|
3257
3246
|
* Schema for multiple-selection enumeration with display titles for each option.
|
|
3258
3247
|
*/
|
|
3259
3248
|
const TitledMultiSelectEnumSchemaSchema$1 = object({
|
|
3260
3249
|
type: literal("array"),
|
|
3261
|
-
title: string
|
|
3262
|
-
description: string
|
|
3263
|
-
minItems: number
|
|
3264
|
-
maxItems: number
|
|
3250
|
+
title: string().optional(),
|
|
3251
|
+
description: string().optional(),
|
|
3252
|
+
minItems: number().optional(),
|
|
3253
|
+
maxItems: number().optional(),
|
|
3265
3254
|
items: object({ anyOf: array(object({
|
|
3266
|
-
const: string
|
|
3267
|
-
title: string
|
|
3255
|
+
const: string(),
|
|
3256
|
+
title: string()
|
|
3268
3257
|
})) }),
|
|
3269
|
-
default: array(string
|
|
3258
|
+
default: array(string()).optional()
|
|
3270
3259
|
});
|
|
3271
3260
|
/**
|
|
3272
3261
|
* Combined schema for multiple-selection enumeration
|
|
@@ -3294,11 +3283,11 @@ function build$1() {
|
|
|
3294
3283
|
*/
|
|
3295
3284
|
const ElicitRequestFormParamsSchema$1 = TaskAugmentedRequestParamsSchema$1.extend({
|
|
3296
3285
|
mode: literal("form").optional(),
|
|
3297
|
-
message: string
|
|
3286
|
+
message: string(),
|
|
3298
3287
|
requestedSchema: object({
|
|
3299
3288
|
type: literal("object"),
|
|
3300
|
-
properties: record$
|
|
3301
|
-
required: array(string
|
|
3289
|
+
properties: record$2(string(), PrimitiveSchemaDefinitionSchema$1),
|
|
3290
|
+
required: array(string()).optional()
|
|
3302
3291
|
}).catchall(unknown())
|
|
3303
3292
|
});
|
|
3304
3293
|
/**
|
|
@@ -3306,9 +3295,9 @@ function build$1() {
|
|
|
3306
3295
|
*/
|
|
3307
3296
|
const ElicitRequestURLParamsSchema$1 = TaskAugmentedRequestParamsSchema$1.extend({
|
|
3308
3297
|
mode: literal("url"),
|
|
3309
|
-
message: string
|
|
3310
|
-
elicitationId: string
|
|
3311
|
-
url: string
|
|
3298
|
+
message: string(),
|
|
3299
|
+
elicitationId: string(),
|
|
3300
|
+
url: string().url()
|
|
3312
3301
|
});
|
|
3313
3302
|
/**
|
|
3314
3303
|
* The parameters for a request to elicit additional information from the user via the client.
|
|
@@ -3328,7 +3317,7 @@ function build$1() {
|
|
|
3328
3317
|
*
|
|
3329
3318
|
* @category notifications/elicitation/complete
|
|
3330
3319
|
*/
|
|
3331
|
-
const ElicitationCompleteNotificationParamsSchema$1 = NotificationsParamsSchema$1.extend({ elicitationId: string
|
|
3320
|
+
const ElicitationCompleteNotificationParamsSchema$1 = NotificationsParamsSchema$1.extend({ elicitationId: string() });
|
|
3332
3321
|
/**
|
|
3333
3322
|
* A notification from the server to the client, informing it of a completion of an out-of-band elicitation request.
|
|
3334
3323
|
*
|
|
@@ -3347,11 +3336,11 @@ function build$1() {
|
|
|
3347
3336
|
"decline",
|
|
3348
3337
|
"cancel"
|
|
3349
3338
|
]),
|
|
3350
|
-
content: preprocess((val) => val === null ? void 0 : val, record$
|
|
3351
|
-
string
|
|
3352
|
-
number
|
|
3353
|
-
boolean
|
|
3354
|
-
array(string
|
|
3339
|
+
content: preprocess((val) => val === null ? void 0 : val, record$2(string(), union([
|
|
3340
|
+
string(),
|
|
3341
|
+
number(),
|
|
3342
|
+
boolean(),
|
|
3343
|
+
array(string())
|
|
3355
3344
|
])).optional())
|
|
3356
3345
|
});
|
|
3357
3346
|
/**
|
|
@@ -3359,14 +3348,14 @@ function build$1() {
|
|
|
3359
3348
|
*/
|
|
3360
3349
|
const ResourceTemplateReferenceSchema$1 = object({
|
|
3361
3350
|
type: literal("ref/resource"),
|
|
3362
|
-
uri: string
|
|
3351
|
+
uri: string()
|
|
3363
3352
|
});
|
|
3364
3353
|
/**
|
|
3365
3354
|
* Identifies a prompt.
|
|
3366
3355
|
*/
|
|
3367
3356
|
const PromptReferenceSchema$1 = object({
|
|
3368
3357
|
type: literal("ref/prompt"),
|
|
3369
|
-
name: string
|
|
3358
|
+
name: string()
|
|
3370
3359
|
});
|
|
3371
3360
|
/**
|
|
3372
3361
|
* Parameters for a {@linkcode CompleteRequest | completion/complete} request.
|
|
@@ -3374,10 +3363,10 @@ function build$1() {
|
|
|
3374
3363
|
const CompleteRequestParamsSchema$1 = BaseRequestParamsSchema$1.extend({
|
|
3375
3364
|
ref: union([PromptReferenceSchema$1, ResourceTemplateReferenceSchema$1]),
|
|
3376
3365
|
argument: object({
|
|
3377
|
-
name: string
|
|
3378
|
-
value: string
|
|
3366
|
+
name: string(),
|
|
3367
|
+
value: string()
|
|
3379
3368
|
}),
|
|
3380
|
-
context: object({ arguments: record$
|
|
3369
|
+
context: object({ arguments: record$2(string(), string()).optional() }).optional()
|
|
3381
3370
|
});
|
|
3382
3371
|
/**
|
|
3383
3372
|
* A request from the client to the server, to ask for completion options.
|
|
@@ -3390,9 +3379,9 @@ function build$1() {
|
|
|
3390
3379
|
* The server's response to a {@linkcode CompleteRequest | completion/complete} request
|
|
3391
3380
|
*/
|
|
3392
3381
|
const CompleteResultSchema$1 = ResultSchema$1.extend({ completion: looseObject({
|
|
3393
|
-
values: array(string
|
|
3394
|
-
total: optional(number
|
|
3395
|
-
hasMore: optional(boolean
|
|
3382
|
+
values: array(string()).max(100),
|
|
3383
|
+
total: optional(number().int()),
|
|
3384
|
+
hasMore: optional(boolean())
|
|
3396
3385
|
}) });
|
|
3397
3386
|
/**
|
|
3398
3387
|
* Represents a root directory or file that the server can operate on.
|
|
@@ -3402,9 +3391,9 @@ function build$1() {
|
|
|
3402
3391
|
* tool parameters, resource URIs, or configuration.
|
|
3403
3392
|
*/
|
|
3404
3393
|
const RootSchema$1 = object({
|
|
3405
|
-
uri: string
|
|
3406
|
-
name: string
|
|
3407
|
-
_meta: record$
|
|
3394
|
+
uri: string().startsWith("file://"),
|
|
3395
|
+
name: string().optional(),
|
|
3396
|
+
_meta: record$2(string(), unknown()).optional()
|
|
3408
3397
|
});
|
|
3409
3398
|
/**
|
|
3410
3399
|
* Sent from the server to request a list of root URIs from the client.
|
|
@@ -3442,8 +3431,8 @@ function build$1() {
|
|
|
3442
3431
|
* @deprecated 2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only.
|
|
3443
3432
|
*/
|
|
3444
3433
|
const TaskCreationParamsSchema$1 = looseObject({
|
|
3445
|
-
ttl: number
|
|
3446
|
-
pollInterval: number
|
|
3434
|
+
ttl: number().optional(),
|
|
3435
|
+
pollInterval: number().optional()
|
|
3447
3436
|
});
|
|
3448
3437
|
/**
|
|
3449
3438
|
* The status of a task.
|
|
@@ -3463,13 +3452,13 @@ function build$1() {
|
|
|
3463
3452
|
* @deprecated 2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only.
|
|
3464
3453
|
*/
|
|
3465
3454
|
const TaskSchema$1 = object({
|
|
3466
|
-
taskId: string
|
|
3455
|
+
taskId: string(),
|
|
3467
3456
|
status: TaskStatusSchema$1,
|
|
3468
|
-
ttl: union([number
|
|
3469
|
-
createdAt: string
|
|
3470
|
-
lastUpdatedAt: string
|
|
3471
|
-
pollInterval: optional(number
|
|
3472
|
-
statusMessage: optional(string
|
|
3457
|
+
ttl: union([number(), _null()]),
|
|
3458
|
+
createdAt: string(),
|
|
3459
|
+
lastUpdatedAt: string(),
|
|
3460
|
+
pollInterval: optional(number()),
|
|
3461
|
+
statusMessage: optional(string())
|
|
3473
3462
|
});
|
|
3474
3463
|
/**
|
|
3475
3464
|
* Result returned when a task is created, containing the task data wrapped in a `task` field.
|
|
@@ -3499,7 +3488,7 @@ function build$1() {
|
|
|
3499
3488
|
*/
|
|
3500
3489
|
const GetTaskRequestSchema$1 = RequestSchema$1.extend({
|
|
3501
3490
|
method: literal("tasks/get"),
|
|
3502
|
-
params: BaseRequestParamsSchema$1.extend({ taskId: string
|
|
3491
|
+
params: BaseRequestParamsSchema$1.extend({ taskId: string() })
|
|
3503
3492
|
});
|
|
3504
3493
|
/**
|
|
3505
3494
|
* The response to a {@linkcode GetTaskRequest | tasks/get} request.
|
|
@@ -3514,7 +3503,7 @@ function build$1() {
|
|
|
3514
3503
|
*/
|
|
3515
3504
|
const GetTaskPayloadRequestSchema$1 = RequestSchema$1.extend({
|
|
3516
3505
|
method: literal("tasks/result"),
|
|
3517
|
-
params: BaseRequestParamsSchema$1.extend({ taskId: string
|
|
3506
|
+
params: BaseRequestParamsSchema$1.extend({ taskId: string() })
|
|
3518
3507
|
});
|
|
3519
3508
|
/**
|
|
3520
3509
|
* The response to a `tasks/result` request.
|
|
@@ -3544,7 +3533,7 @@ function build$1() {
|
|
|
3544
3533
|
*/
|
|
3545
3534
|
const CancelTaskRequestSchema$1 = RequestSchema$1.extend({
|
|
3546
3535
|
method: literal("tasks/cancel"),
|
|
3547
|
-
params: BaseRequestParamsSchema$1.extend({ taskId: string
|
|
3536
|
+
params: BaseRequestParamsSchema$1.extend({ taskId: string() })
|
|
3548
3537
|
});
|
|
3549
3538
|
return {
|
|
3550
3539
|
JSONValueSchema: JSONValueSchema$1,
|
|
@@ -4164,26 +4153,26 @@ const rev2025Codec = {
|
|
|
4164
4153
|
*/
|
|
4165
4154
|
function build() {
|
|
4166
4155
|
const JSONValueSchema$1 = lazy(() => union([
|
|
4167
|
-
string
|
|
4168
|
-
number
|
|
4169
|
-
boolean
|
|
4156
|
+
string(),
|
|
4157
|
+
number(),
|
|
4158
|
+
boolean(),
|
|
4170
4159
|
_null(),
|
|
4171
|
-
record$
|
|
4160
|
+
record$2(string(), JSONValueSchema$1),
|
|
4172
4161
|
array(JSONValueSchema$1)
|
|
4173
4162
|
]));
|
|
4174
|
-
const JSONObjectSchema$1 = record$
|
|
4163
|
+
const JSONObjectSchema$1 = record$2(string(), JSONValueSchema$1);
|
|
4175
4164
|
/**
|
|
4176
4165
|
* A progress token, used to associate progress notifications with the original request.
|
|
4177
4166
|
*/
|
|
4178
|
-
const ProgressTokenSchema$1 = union([string
|
|
4167
|
+
const ProgressTokenSchema$1 = union([string(), number().int()]);
|
|
4179
4168
|
/**
|
|
4180
4169
|
* An opaque token used to represent a cursor for pagination.
|
|
4181
4170
|
*/
|
|
4182
|
-
const CursorSchema$1 = string
|
|
4171
|
+
const CursorSchema$1 = string();
|
|
4183
4172
|
/**
|
|
4184
4173
|
* A uniquely identifying ID for a request in JSON-RPC.
|
|
4185
4174
|
*/
|
|
4186
|
-
const RequestIdSchema$1 = union([string
|
|
4175
|
+
const RequestIdSchema$1 = union([string(), number().int()]);
|
|
4187
4176
|
/**
|
|
4188
4177
|
* The sender or recipient of messages and data in a conversation.
|
|
4189
4178
|
*/
|
|
@@ -4206,7 +4195,7 @@ function build() {
|
|
|
4206
4195
|
* robust for very large inputs than the default regex-based check. It avoids
|
|
4207
4196
|
* stack overflows by using the native `atob` function for validation.
|
|
4208
4197
|
*/
|
|
4209
|
-
const Base64Schema = string
|
|
4198
|
+
const Base64Schema = string().refine((val) => {
|
|
4210
4199
|
try {
|
|
4211
4200
|
atob(val);
|
|
4212
4201
|
return true;
|
|
@@ -4215,9 +4204,9 @@ function build() {
|
|
|
4215
4204
|
}
|
|
4216
4205
|
}, { message: "Invalid Base64 string" });
|
|
4217
4206
|
/** @deprecated 2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only. */
|
|
4218
|
-
const TaskMetadataSchema$1 = object({ ttl: number
|
|
4207
|
+
const TaskMetadataSchema$1 = object({ ttl: number().optional() });
|
|
4219
4208
|
/** @deprecated 2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only. */
|
|
4220
|
-
const RelatedTaskMetadataSchema$1 = object({ taskId: string
|
|
4209
|
+
const RelatedTaskMetadataSchema$1 = object({ taskId: string() });
|
|
4221
4210
|
const RequestMetaSchema$1 = looseObject({
|
|
4222
4211
|
progressToken: ProgressTokenSchema$1.optional(),
|
|
4223
4212
|
"io.modelcontextprotocol/related-task": RelatedTaskMetadataSchema$1.optional()
|
|
@@ -4227,28 +4216,28 @@ function build() {
|
|
|
4227
4216
|
const TaskAugmentedRequestParamsSchema$1 = BaseRequestParamsSchema$1.extend({ task: TaskMetadataSchema$1.optional() });
|
|
4228
4217
|
const NotificationsParamsSchema$1 = object({ _meta: RequestMetaSchema$1.optional() });
|
|
4229
4218
|
const NotificationSchema$1 = object({
|
|
4230
|
-
method: string
|
|
4219
|
+
method: string(),
|
|
4231
4220
|
params: NotificationsParamsSchema$1.loose().optional()
|
|
4232
4221
|
});
|
|
4233
4222
|
const IconSchema$1 = object({
|
|
4234
|
-
src: string
|
|
4235
|
-
mimeType: string
|
|
4236
|
-
sizes: array(string
|
|
4223
|
+
src: string(),
|
|
4224
|
+
mimeType: string().optional(),
|
|
4225
|
+
sizes: array(string()).optional(),
|
|
4237
4226
|
theme: _enum(["light", "dark"]).optional()
|
|
4238
4227
|
});
|
|
4239
4228
|
const IconsSchema$1 = object({ icons: array(IconSchema$1).optional() });
|
|
4240
4229
|
const BaseMetadataSchema$1 = object({
|
|
4241
|
-
name: string
|
|
4242
|
-
title: string
|
|
4230
|
+
name: string(),
|
|
4231
|
+
title: string().optional()
|
|
4243
4232
|
});
|
|
4244
4233
|
const ImplementationSchema$1 = BaseMetadataSchema$1.extend({
|
|
4245
4234
|
...BaseMetadataSchema$1.shape,
|
|
4246
4235
|
...IconsSchema$1.shape,
|
|
4247
|
-
version: string
|
|
4248
|
-
websiteUrl: string
|
|
4249
|
-
description: string
|
|
4236
|
+
version: string(),
|
|
4237
|
+
websiteUrl: string().optional(),
|
|
4238
|
+
description: string().optional()
|
|
4250
4239
|
});
|
|
4251
|
-
const FormElicitationCapabilitySchema = intersection(object({ applyDefaults: boolean
|
|
4240
|
+
const FormElicitationCapabilitySchema = intersection(object({ applyDefaults: boolean().optional() }), JSONObjectSchema$1);
|
|
4252
4241
|
const ElicitationCapabilitySchema = preprocess((value) => {
|
|
4253
4242
|
if (value && typeof value === "object" && !Array.isArray(value) && Object.keys(value).length === 0) return { form: {} };
|
|
4254
4243
|
return value;
|
|
@@ -4272,33 +4261,33 @@ function build() {
|
|
|
4272
4261
|
requests: looseObject({ tools: looseObject({ call: JSONObjectSchema$1.optional() }).optional() }).optional()
|
|
4273
4262
|
});
|
|
4274
4263
|
const ClientCapabilitiesSchema$1 = object({
|
|
4275
|
-
experimental: record$
|
|
4264
|
+
experimental: record$2(string(), JSONObjectSchema$1).optional(),
|
|
4276
4265
|
sampling: object({
|
|
4277
4266
|
context: JSONObjectSchema$1.optional(),
|
|
4278
4267
|
tools: JSONObjectSchema$1.optional()
|
|
4279
4268
|
}).optional(),
|
|
4280
4269
|
elicitation: ElicitationCapabilitySchema.optional(),
|
|
4281
|
-
roots: object({ listChanged: boolean
|
|
4270
|
+
roots: object({ listChanged: boolean().optional() }).optional(),
|
|
4282
4271
|
tasks: ClientTasksCapabilitySchema$1.optional(),
|
|
4283
|
-
extensions: record$
|
|
4272
|
+
extensions: record$2(string(), JSONObjectSchema$1).optional()
|
|
4284
4273
|
});
|
|
4285
4274
|
const ServerCapabilitiesSchema$1 = object({
|
|
4286
|
-
experimental: record$
|
|
4275
|
+
experimental: record$2(string(), JSONObjectSchema$1).optional(),
|
|
4287
4276
|
logging: JSONObjectSchema$1.optional(),
|
|
4288
4277
|
completions: JSONObjectSchema$1.optional(),
|
|
4289
|
-
prompts: object({ listChanged: boolean
|
|
4278
|
+
prompts: object({ listChanged: boolean().optional() }).optional(),
|
|
4290
4279
|
resources: object({
|
|
4291
|
-
subscribe: boolean
|
|
4292
|
-
listChanged: boolean
|
|
4280
|
+
subscribe: boolean().optional(),
|
|
4281
|
+
listChanged: boolean().optional()
|
|
4293
4282
|
}).optional(),
|
|
4294
|
-
tools: object({ listChanged: boolean
|
|
4283
|
+
tools: object({ listChanged: boolean().optional() }).optional(),
|
|
4295
4284
|
tasks: ServerTasksCapabilitySchema$1.optional(),
|
|
4296
|
-
extensions: record$
|
|
4285
|
+
extensions: record$2(string(), JSONObjectSchema$1).optional()
|
|
4297
4286
|
});
|
|
4298
4287
|
const ProgressSchema$1 = object({
|
|
4299
|
-
progress: number
|
|
4300
|
-
total: optional(number
|
|
4301
|
-
message: optional(string
|
|
4288
|
+
progress: number(),
|
|
4289
|
+
total: optional(number()),
|
|
4290
|
+
message: optional(string())
|
|
4302
4291
|
});
|
|
4303
4292
|
const ProgressNotificationParamsSchema$1 = object({
|
|
4304
4293
|
...NotificationsParamsSchema$1.shape,
|
|
@@ -4311,7 +4300,7 @@ function build() {
|
|
|
4311
4300
|
});
|
|
4312
4301
|
const LoggingMessageNotificationParamsSchema$1 = NotificationsParamsSchema$1.extend({
|
|
4313
4302
|
level: LoggingLevelSchema$1,
|
|
4314
|
-
logger: string
|
|
4303
|
+
logger: string().optional(),
|
|
4315
4304
|
data: unknown()
|
|
4316
4305
|
});
|
|
4317
4306
|
const LoggingMessageNotificationSchema$1 = NotificationSchema$1.extend({
|
|
@@ -4319,33 +4308,33 @@ function build() {
|
|
|
4319
4308
|
params: LoggingMessageNotificationParamsSchema$1
|
|
4320
4309
|
});
|
|
4321
4310
|
const ResourceContentsSchema$1 = object({
|
|
4322
|
-
uri: string
|
|
4323
|
-
mimeType: optional(string
|
|
4324
|
-
_meta: record$
|
|
4311
|
+
uri: string(),
|
|
4312
|
+
mimeType: optional(string()),
|
|
4313
|
+
_meta: record$2(string(), unknown()).optional()
|
|
4325
4314
|
});
|
|
4326
|
-
const TextResourceContentsSchema$1 = ResourceContentsSchema$1.extend({ text: string
|
|
4315
|
+
const TextResourceContentsSchema$1 = ResourceContentsSchema$1.extend({ text: string() });
|
|
4327
4316
|
const BlobResourceContentsSchema$1 = ResourceContentsSchema$1.extend({ blob: Base64Schema });
|
|
4328
4317
|
const AnnotationsSchema$1 = object({
|
|
4329
4318
|
audience: array(RoleSchema$1).optional(),
|
|
4330
|
-
priority: number
|
|
4319
|
+
priority: number().min(0).max(1).optional(),
|
|
4331
4320
|
lastModified: datetime({ offset: true }).optional()
|
|
4332
4321
|
});
|
|
4333
4322
|
const ResourceSchema$1 = object({
|
|
4334
4323
|
...BaseMetadataSchema$1.shape,
|
|
4335
4324
|
...IconsSchema$1.shape,
|
|
4336
|
-
uri: string
|
|
4337
|
-
description: optional(string
|
|
4338
|
-
mimeType: optional(string
|
|
4339
|
-
size: optional(number
|
|
4325
|
+
uri: string(),
|
|
4326
|
+
description: optional(string()),
|
|
4327
|
+
mimeType: optional(string()),
|
|
4328
|
+
size: optional(number()),
|
|
4340
4329
|
annotations: AnnotationsSchema$1.optional(),
|
|
4341
4330
|
_meta: optional(looseObject({}))
|
|
4342
4331
|
});
|
|
4343
4332
|
const ResourceTemplateSchema$1 = object({
|
|
4344
4333
|
...BaseMetadataSchema$1.shape,
|
|
4345
4334
|
...IconsSchema$1.shape,
|
|
4346
|
-
uriTemplate: string
|
|
4347
|
-
description: optional(string
|
|
4348
|
-
mimeType: optional(string
|
|
4335
|
+
uriTemplate: string(),
|
|
4336
|
+
description: optional(string()),
|
|
4337
|
+
mimeType: optional(string()),
|
|
4349
4338
|
annotations: AnnotationsSchema$1.optional(),
|
|
4350
4339
|
_meta: optional(looseObject({}))
|
|
4351
4340
|
});
|
|
@@ -4353,20 +4342,20 @@ function build() {
|
|
|
4353
4342
|
method: literal("notifications/resources/list_changed"),
|
|
4354
4343
|
params: NotificationsParamsSchema$1.optional()
|
|
4355
4344
|
});
|
|
4356
|
-
const ResourceUpdatedNotificationParamsSchema$1 = NotificationsParamsSchema$1.extend({ uri: string
|
|
4345
|
+
const ResourceUpdatedNotificationParamsSchema$1 = NotificationsParamsSchema$1.extend({ uri: string() });
|
|
4357
4346
|
const ResourceUpdatedNotificationSchema$1 = NotificationSchema$1.extend({
|
|
4358
4347
|
method: literal("notifications/resources/updated"),
|
|
4359
4348
|
params: ResourceUpdatedNotificationParamsSchema$1
|
|
4360
4349
|
});
|
|
4361
4350
|
const PromptArgumentSchema$1 = object({
|
|
4362
|
-
name: string
|
|
4363
|
-
description: optional(string
|
|
4364
|
-
required: optional(boolean
|
|
4351
|
+
name: string(),
|
|
4352
|
+
description: optional(string()),
|
|
4353
|
+
required: optional(boolean())
|
|
4365
4354
|
});
|
|
4366
4355
|
const PromptSchema$1 = object({
|
|
4367
4356
|
...BaseMetadataSchema$1.shape,
|
|
4368
4357
|
...IconsSchema$1.shape,
|
|
4369
|
-
description: optional(string
|
|
4358
|
+
description: optional(string()),
|
|
4370
4359
|
arguments: optional(array(PromptArgumentSchema$1)),
|
|
4371
4360
|
_meta: optional(looseObject({}))
|
|
4372
4361
|
});
|
|
@@ -4376,36 +4365,36 @@ function build() {
|
|
|
4376
4365
|
});
|
|
4377
4366
|
const TextContentSchema$1 = object({
|
|
4378
4367
|
type: literal("text"),
|
|
4379
|
-
text: string
|
|
4368
|
+
text: string(),
|
|
4380
4369
|
annotations: AnnotationsSchema$1.optional(),
|
|
4381
|
-
_meta: record$
|
|
4370
|
+
_meta: record$2(string(), unknown()).optional()
|
|
4382
4371
|
});
|
|
4383
4372
|
const ImageContentSchema$1 = object({
|
|
4384
4373
|
type: literal("image"),
|
|
4385
4374
|
data: Base64Schema,
|
|
4386
|
-
mimeType: string
|
|
4375
|
+
mimeType: string(),
|
|
4387
4376
|
annotations: AnnotationsSchema$1.optional(),
|
|
4388
|
-
_meta: record$
|
|
4377
|
+
_meta: record$2(string(), unknown()).optional()
|
|
4389
4378
|
});
|
|
4390
4379
|
const AudioContentSchema$1 = object({
|
|
4391
4380
|
type: literal("audio"),
|
|
4392
4381
|
data: Base64Schema,
|
|
4393
|
-
mimeType: string
|
|
4382
|
+
mimeType: string(),
|
|
4394
4383
|
annotations: AnnotationsSchema$1.optional(),
|
|
4395
|
-
_meta: record$
|
|
4384
|
+
_meta: record$2(string(), unknown()).optional()
|
|
4396
4385
|
});
|
|
4397
4386
|
const ToolUseContentSchema$1 = object({
|
|
4398
4387
|
type: literal("tool_use"),
|
|
4399
|
-
name: string
|
|
4400
|
-
id: string
|
|
4401
|
-
input: record$
|
|
4402
|
-
_meta: record$
|
|
4388
|
+
name: string(),
|
|
4389
|
+
id: string(),
|
|
4390
|
+
input: record$2(string(), unknown()),
|
|
4391
|
+
_meta: record$2(string(), unknown()).optional()
|
|
4403
4392
|
});
|
|
4404
4393
|
const EmbeddedResourceSchema$1 = object({
|
|
4405
4394
|
type: literal("resource"),
|
|
4406
4395
|
resource: union([TextResourceContentsSchema$1, BlobResourceContentsSchema$1]),
|
|
4407
4396
|
annotations: AnnotationsSchema$1.optional(),
|
|
4408
|
-
_meta: record$
|
|
4397
|
+
_meta: record$2(string(), unknown()).optional()
|
|
4409
4398
|
});
|
|
4410
4399
|
const ResourceLinkSchema$1 = ResourceSchema$1.extend({ type: literal("resource_link") });
|
|
4411
4400
|
const ContentBlockSchema$1 = union([
|
|
@@ -4420,22 +4409,22 @@ function build() {
|
|
|
4420
4409
|
content: ContentBlockSchema$1
|
|
4421
4410
|
});
|
|
4422
4411
|
const ToolAnnotationsSchema$1 = object({
|
|
4423
|
-
title: string
|
|
4424
|
-
readOnlyHint: boolean
|
|
4425
|
-
destructiveHint: boolean
|
|
4426
|
-
idempotentHint: boolean
|
|
4427
|
-
openWorldHint: boolean
|
|
4412
|
+
title: string().optional(),
|
|
4413
|
+
readOnlyHint: boolean().optional(),
|
|
4414
|
+
destructiveHint: boolean().optional(),
|
|
4415
|
+
idempotentHint: boolean().optional(),
|
|
4416
|
+
openWorldHint: boolean().optional()
|
|
4428
4417
|
});
|
|
4429
4418
|
const ToolListChangedNotificationSchema$1 = NotificationSchema$1.extend({
|
|
4430
4419
|
method: literal("notifications/tools/list_changed"),
|
|
4431
4420
|
params: NotificationsParamsSchema$1.optional()
|
|
4432
4421
|
});
|
|
4433
|
-
const ModelHintSchema$1 = object({ name: string
|
|
4422
|
+
const ModelHintSchema$1 = object({ name: string().optional() });
|
|
4434
4423
|
const ModelPreferencesSchema$1 = object({
|
|
4435
4424
|
hints: array(ModelHintSchema$1).optional(),
|
|
4436
|
-
costPriority: number
|
|
4437
|
-
speedPriority: number
|
|
4438
|
-
intelligencePriority: number
|
|
4425
|
+
costPriority: number().min(0).max(1).optional(),
|
|
4426
|
+
speedPriority: number().min(0).max(1).optional(),
|
|
4427
|
+
intelligencePriority: number().min(0).max(1).optional()
|
|
4439
4428
|
});
|
|
4440
4429
|
const ToolChoiceSchema$1 = object({ mode: _enum([
|
|
4441
4430
|
"auto",
|
|
@@ -4444,81 +4433,81 @@ function build() {
|
|
|
4444
4433
|
]).optional() });
|
|
4445
4434
|
const BooleanSchemaSchema$1 = object({
|
|
4446
4435
|
type: literal("boolean"),
|
|
4447
|
-
title: string
|
|
4448
|
-
description: string
|
|
4449
|
-
default: boolean
|
|
4436
|
+
title: string().optional(),
|
|
4437
|
+
description: string().optional(),
|
|
4438
|
+
default: boolean().optional()
|
|
4450
4439
|
});
|
|
4451
4440
|
const StringSchemaSchema$1 = object({
|
|
4452
4441
|
type: literal("string"),
|
|
4453
|
-
title: string
|
|
4454
|
-
description: string
|
|
4455
|
-
minLength: number
|
|
4456
|
-
maxLength: number
|
|
4442
|
+
title: string().optional(),
|
|
4443
|
+
description: string().optional(),
|
|
4444
|
+
minLength: number().optional(),
|
|
4445
|
+
maxLength: number().optional(),
|
|
4457
4446
|
format: _enum([
|
|
4458
4447
|
"email",
|
|
4459
4448
|
"uri",
|
|
4460
4449
|
"date",
|
|
4461
4450
|
"date-time"
|
|
4462
4451
|
]).optional(),
|
|
4463
|
-
default: string
|
|
4452
|
+
default: string().optional()
|
|
4464
4453
|
});
|
|
4465
4454
|
const NumberSchemaSchema$1 = object({
|
|
4466
4455
|
type: _enum(["number", "integer"]),
|
|
4467
|
-
title: string
|
|
4468
|
-
description: string
|
|
4469
|
-
minimum: number
|
|
4470
|
-
maximum: number
|
|
4471
|
-
default: number
|
|
4456
|
+
title: string().optional(),
|
|
4457
|
+
description: string().optional(),
|
|
4458
|
+
minimum: number().optional(),
|
|
4459
|
+
maximum: number().optional(),
|
|
4460
|
+
default: number().optional()
|
|
4472
4461
|
});
|
|
4473
4462
|
const UntitledSingleSelectEnumSchemaSchema$1 = object({
|
|
4474
4463
|
type: literal("string"),
|
|
4475
|
-
title: string
|
|
4476
|
-
description: string
|
|
4477
|
-
enum: array(string
|
|
4478
|
-
default: string
|
|
4464
|
+
title: string().optional(),
|
|
4465
|
+
description: string().optional(),
|
|
4466
|
+
enum: array(string()),
|
|
4467
|
+
default: string().optional()
|
|
4479
4468
|
});
|
|
4480
4469
|
const TitledSingleSelectEnumSchemaSchema$1 = object({
|
|
4481
4470
|
type: literal("string"),
|
|
4482
|
-
title: string
|
|
4483
|
-
description: string
|
|
4471
|
+
title: string().optional(),
|
|
4472
|
+
description: string().optional(),
|
|
4484
4473
|
oneOf: array(object({
|
|
4485
|
-
const: string
|
|
4486
|
-
title: string
|
|
4474
|
+
const: string(),
|
|
4475
|
+
title: string()
|
|
4487
4476
|
})),
|
|
4488
|
-
default: string
|
|
4477
|
+
default: string().optional()
|
|
4489
4478
|
});
|
|
4490
4479
|
const LegacyTitledEnumSchemaSchema$1 = object({
|
|
4491
4480
|
type: literal("string"),
|
|
4492
|
-
title: string
|
|
4493
|
-
description: string
|
|
4494
|
-
enum: array(string
|
|
4495
|
-
enumNames: array(string
|
|
4496
|
-
default: string
|
|
4481
|
+
title: string().optional(),
|
|
4482
|
+
description: string().optional(),
|
|
4483
|
+
enum: array(string()),
|
|
4484
|
+
enumNames: array(string()).optional(),
|
|
4485
|
+
default: string().optional()
|
|
4497
4486
|
});
|
|
4498
4487
|
const SingleSelectEnumSchemaSchema$1 = union([UntitledSingleSelectEnumSchemaSchema$1, TitledSingleSelectEnumSchemaSchema$1]);
|
|
4499
4488
|
const UntitledMultiSelectEnumSchemaSchema$1 = object({
|
|
4500
4489
|
type: literal("array"),
|
|
4501
|
-
title: string
|
|
4502
|
-
description: string
|
|
4503
|
-
minItems: number
|
|
4504
|
-
maxItems: number
|
|
4490
|
+
title: string().optional(),
|
|
4491
|
+
description: string().optional(),
|
|
4492
|
+
minItems: number().optional(),
|
|
4493
|
+
maxItems: number().optional(),
|
|
4505
4494
|
items: object({
|
|
4506
4495
|
type: literal("string"),
|
|
4507
|
-
enum: array(string
|
|
4496
|
+
enum: array(string())
|
|
4508
4497
|
}),
|
|
4509
|
-
default: array(string
|
|
4498
|
+
default: array(string()).optional()
|
|
4510
4499
|
});
|
|
4511
4500
|
const TitledMultiSelectEnumSchemaSchema$1 = object({
|
|
4512
4501
|
type: literal("array"),
|
|
4513
|
-
title: string
|
|
4514
|
-
description: string
|
|
4515
|
-
minItems: number
|
|
4516
|
-
maxItems: number
|
|
4502
|
+
title: string().optional(),
|
|
4503
|
+
description: string().optional(),
|
|
4504
|
+
minItems: number().optional(),
|
|
4505
|
+
maxItems: number().optional(),
|
|
4517
4506
|
items: object({ anyOf: array(object({
|
|
4518
|
-
const: string
|
|
4519
|
-
title: string
|
|
4507
|
+
const: string(),
|
|
4508
|
+
title: string()
|
|
4520
4509
|
})) }),
|
|
4521
|
-
default: array(string
|
|
4510
|
+
default: array(string()).optional()
|
|
4522
4511
|
});
|
|
4523
4512
|
const MultiSelectEnumSchemaSchema$1 = union([UntitledMultiSelectEnumSchemaSchema$1, TitledMultiSelectEnumSchemaSchema$1]);
|
|
4524
4513
|
const EnumSchemaSchema$1 = union([
|
|
@@ -4534,25 +4523,25 @@ function build() {
|
|
|
4534
4523
|
]);
|
|
4535
4524
|
const ElicitRequestFormParamsSchema$1 = TaskAugmentedRequestParamsSchema$1.extend({
|
|
4536
4525
|
mode: literal("form").optional(),
|
|
4537
|
-
message: string
|
|
4526
|
+
message: string(),
|
|
4538
4527
|
requestedSchema: object({
|
|
4539
4528
|
type: literal("object"),
|
|
4540
|
-
properties: record$
|
|
4541
|
-
required: array(string
|
|
4529
|
+
properties: record$2(string(), PrimitiveSchemaDefinitionSchema$1),
|
|
4530
|
+
required: array(string()).optional()
|
|
4542
4531
|
}).catchall(unknown())
|
|
4543
4532
|
});
|
|
4544
4533
|
const ResourceTemplateReferenceSchema$1 = object({
|
|
4545
4534
|
type: literal("ref/resource"),
|
|
4546
|
-
uri: string
|
|
4535
|
+
uri: string()
|
|
4547
4536
|
});
|
|
4548
4537
|
const PromptReferenceSchema$1 = object({
|
|
4549
4538
|
type: literal("ref/prompt"),
|
|
4550
|
-
name: string
|
|
4539
|
+
name: string()
|
|
4551
4540
|
});
|
|
4552
4541
|
const RootSchema$1 = object({
|
|
4553
|
-
uri: string
|
|
4554
|
-
name: string
|
|
4555
|
-
_meta: record$
|
|
4542
|
+
uri: string().startsWith("file://"),
|
|
4543
|
+
name: string().optional(),
|
|
4544
|
+
_meta: record$2(string(), unknown()).optional()
|
|
4556
4545
|
});
|
|
4557
4546
|
const sharedClientCapabilityShape = ClientCapabilitiesSchema$1.shape;
|
|
4558
4547
|
const ClientCapabilities2026Schema = object({
|
|
@@ -4585,7 +4574,7 @@ function build() {
|
|
|
4585
4574
|
*/
|
|
4586
4575
|
const RequestMetaEnvelopeSchema = looseObject({
|
|
4587
4576
|
progressToken: ProgressTokenSchema$1.optional(),
|
|
4588
|
-
[PROTOCOL_VERSION_META_KEY]: string
|
|
4577
|
+
[PROTOCOL_VERSION_META_KEY]: string(),
|
|
4589
4578
|
[CLIENT_INFO_META_KEY]: ImplementationSchema$1.optional(),
|
|
4590
4579
|
[CLIENT_CAPABILITIES_META_KEY]: ClientCapabilities2026Schema,
|
|
4591
4580
|
[LOG_LEVEL_META_KEY]: LoggingLevelSchema$1.optional()
|
|
@@ -4594,23 +4583,23 @@ function build() {
|
|
|
4594
4583
|
const ToolSchema$1 = object({
|
|
4595
4584
|
...BaseMetadataSchema$1.shape,
|
|
4596
4585
|
...IconsSchema$1.shape,
|
|
4597
|
-
description: string
|
|
4586
|
+
description: string().optional(),
|
|
4598
4587
|
inputSchema: looseObject({
|
|
4599
|
-
$schema: string
|
|
4588
|
+
$schema: string().optional(),
|
|
4600
4589
|
type: literal("object")
|
|
4601
4590
|
}),
|
|
4602
|
-
outputSchema: looseObject({ $schema: string
|
|
4591
|
+
outputSchema: looseObject({ $schema: string().optional() }).optional(),
|
|
4603
4592
|
annotations: ToolAnnotationsSchema$1.optional(),
|
|
4604
|
-
_meta: record$
|
|
4593
|
+
_meta: record$2(string(), unknown()).optional()
|
|
4605
4594
|
});
|
|
4606
4595
|
/** 2026-era ToolResultContent (anchor-exact: `structuredContent?: unknown`). */
|
|
4607
4596
|
const ToolResultContentSchema$1 = object({
|
|
4608
4597
|
type: literal("tool_result"),
|
|
4609
|
-
toolUseId: string
|
|
4598
|
+
toolUseId: string(),
|
|
4610
4599
|
content: array(ContentBlockSchema$1),
|
|
4611
4600
|
structuredContent: unknown().optional(),
|
|
4612
|
-
isError: boolean
|
|
4613
|
-
_meta: record$
|
|
4601
|
+
isError: boolean().optional(),
|
|
4602
|
+
_meta: record$2(string(), unknown()).optional()
|
|
4614
4603
|
});
|
|
4615
4604
|
/** 2026-era sampling content union (composes the forked tool-result shape). */
|
|
4616
4605
|
const SamplingMessageContentBlockSchema$1 = union([
|
|
@@ -4624,10 +4613,10 @@ function build() {
|
|
|
4624
4613
|
const SamplingMessageSchema$1 = object({
|
|
4625
4614
|
role: RoleSchema$1,
|
|
4626
4615
|
content: union([SamplingMessageContentBlockSchema$1, array(SamplingMessageContentBlockSchema$1)]),
|
|
4627
|
-
_meta: record$
|
|
4616
|
+
_meta: record$2(string(), unknown()).optional()
|
|
4628
4617
|
});
|
|
4629
4618
|
/** Open union per the anchor: 'complete' | 'input_required' | string. */
|
|
4630
|
-
const ResultTypeSchema = string
|
|
4619
|
+
const ResultTypeSchema = string();
|
|
4631
4620
|
/**
|
|
4632
4621
|
* Result `_meta` (anchor `ResultMetaObject`, added by spec PR #3002):
|
|
4633
4622
|
* loose, with the serverInfo key typed when present; the outbound stamp
|
|
@@ -4647,71 +4636,71 @@ function build() {
|
|
|
4647
4636
|
const CallToolResultSchema$1 = wireResult({
|
|
4648
4637
|
content: array(ContentBlockSchema$1),
|
|
4649
4638
|
structuredContent: unknown().optional(),
|
|
4650
|
-
isError: boolean
|
|
4639
|
+
isError: boolean().optional()
|
|
4651
4640
|
});
|
|
4652
4641
|
const ListToolsResultSchema$1 = wireResult({
|
|
4653
|
-
ttlMs: number
|
|
4642
|
+
ttlMs: number().int().min(0),
|
|
4654
4643
|
cacheScope: _enum(["public", "private"]),
|
|
4655
4644
|
tools: array(ToolSchema$1),
|
|
4656
4645
|
nextCursor: CursorSchema$1.optional()
|
|
4657
4646
|
});
|
|
4658
4647
|
const ListPromptsResultSchema$1 = wireResult({
|
|
4659
|
-
ttlMs: number
|
|
4648
|
+
ttlMs: number().int().min(0),
|
|
4660
4649
|
cacheScope: _enum(["public", "private"]),
|
|
4661
4650
|
prompts: array(PromptSchema$1),
|
|
4662
4651
|
nextCursor: CursorSchema$1.optional()
|
|
4663
4652
|
});
|
|
4664
4653
|
const GetPromptResultSchema$1 = wireResult({
|
|
4665
|
-
description: string
|
|
4654
|
+
description: string().optional(),
|
|
4666
4655
|
messages: array(PromptMessageSchema$1)
|
|
4667
4656
|
});
|
|
4668
4657
|
const ListResourcesResultSchema$1 = wireResult({
|
|
4669
|
-
ttlMs: number
|
|
4658
|
+
ttlMs: number().int().min(0),
|
|
4670
4659
|
cacheScope: _enum(["public", "private"]),
|
|
4671
4660
|
resources: array(ResourceSchema$1),
|
|
4672
4661
|
nextCursor: CursorSchema$1.optional()
|
|
4673
4662
|
});
|
|
4674
4663
|
const ListResourceTemplatesResultSchema$1 = wireResult({
|
|
4675
|
-
ttlMs: number
|
|
4664
|
+
ttlMs: number().int().min(0),
|
|
4676
4665
|
cacheScope: _enum(["public", "private"]),
|
|
4677
4666
|
resourceTemplates: array(ResourceTemplateSchema$1),
|
|
4678
4667
|
nextCursor: CursorSchema$1.optional()
|
|
4679
4668
|
});
|
|
4680
4669
|
const ReadResourceResultSchema$1 = wireResult({
|
|
4681
|
-
ttlMs: number
|
|
4670
|
+
ttlMs: number().int().min(0),
|
|
4682
4671
|
cacheScope: _enum(["public", "private"]),
|
|
4683
4672
|
contents: array(union([TextResourceContentsSchema$1, BlobResourceContentsSchema$1]))
|
|
4684
4673
|
});
|
|
4685
4674
|
const CompleteResultSchema$1 = wireResult({ completion: object({
|
|
4686
|
-
values: array(string
|
|
4687
|
-
total: number
|
|
4688
|
-
hasMore: boolean
|
|
4675
|
+
values: array(string()).max(100),
|
|
4676
|
+
total: number().int().optional(),
|
|
4677
|
+
hasMore: boolean().optional()
|
|
4689
4678
|
}).loose() });
|
|
4690
4679
|
/** CacheableResult (SEP-2549): ttlMs and cacheScope REQUIRED per the anchor. */
|
|
4691
4680
|
const CacheableResultSchema = wireResult({
|
|
4692
|
-
ttlMs: number
|
|
4681
|
+
ttlMs: number().int().min(0),
|
|
4693
4682
|
cacheScope: _enum(["public", "private"])
|
|
4694
4683
|
});
|
|
4695
4684
|
const DiscoverResultSchema$1 = wireResult({
|
|
4696
|
-
ttlMs: number
|
|
4685
|
+
ttlMs: number().int().min(0).catch(0),
|
|
4697
4686
|
cacheScope: _enum(["public", "private"]).catch("private"),
|
|
4698
|
-
supportedVersions: array(string
|
|
4687
|
+
supportedVersions: array(string()),
|
|
4699
4688
|
capabilities: ServerCapabilities2026Schema,
|
|
4700
|
-
instructions: string
|
|
4689
|
+
instructions: string().optional()
|
|
4701
4690
|
});
|
|
4702
4691
|
/** 2026-era CreateMessageRequestParams (anchor-exact: forked SamplingMessage/Tool, no task augmentation). */
|
|
4703
4692
|
const CreateMessageRequestParamsSchema$1 = object({
|
|
4704
4693
|
messages: array(SamplingMessageSchema$1),
|
|
4705
4694
|
modelPreferences: ModelPreferencesSchema$1.optional(),
|
|
4706
|
-
systemPrompt: string
|
|
4695
|
+
systemPrompt: string().optional(),
|
|
4707
4696
|
includeContext: _enum([
|
|
4708
4697
|
"none",
|
|
4709
4698
|
"thisServer",
|
|
4710
4699
|
"allServers"
|
|
4711
4700
|
]).optional(),
|
|
4712
|
-
temperature: number
|
|
4713
|
-
maxTokens: number
|
|
4714
|
-
stopSequences: array(string
|
|
4701
|
+
temperature: number().optional(),
|
|
4702
|
+
maxTokens: number().int(),
|
|
4703
|
+
stopSequences: array(string()).optional(),
|
|
4715
4704
|
metadata: JSONObjectSchema$1.optional(),
|
|
4716
4705
|
tools: array(ToolSchema$1).optional(),
|
|
4717
4706
|
toolChoice: ToolChoiceSchema$1.optional()
|
|
@@ -4728,13 +4717,13 @@ function build() {
|
|
|
4728
4717
|
*/
|
|
4729
4718
|
const ListRootsRequestSchema$1 = object({
|
|
4730
4719
|
method: literal("roots/list"),
|
|
4731
|
-
params: object({ _meta: record$
|
|
4720
|
+
params: object({ _meta: record$2(string(), unknown()).optional() }).optional()
|
|
4732
4721
|
});
|
|
4733
4722
|
/** 2026-era embedded sampling response (anchor-exact: extends the forked SamplingMessage). */
|
|
4734
4723
|
const CreateMessageResultSchema$1 = object({
|
|
4735
4724
|
...SamplingMessageSchema$1.shape,
|
|
4736
|
-
model: string
|
|
4737
|
-
stopReason: string
|
|
4725
|
+
model: string(),
|
|
4726
|
+
stopReason: string().optional()
|
|
4738
4727
|
});
|
|
4739
4728
|
/** 2026-era embedded roots listing response (anchor-exact: bare `roots` array). */
|
|
4740
4729
|
const ListRootsResultSchema$1 = object({ roots: array(RootSchema$1) });
|
|
@@ -4745,11 +4734,11 @@ function build() {
|
|
|
4745
4734
|
"decline",
|
|
4746
4735
|
"cancel"
|
|
4747
4736
|
]),
|
|
4748
|
-
content: record$
|
|
4749
|
-
string
|
|
4750
|
-
number
|
|
4751
|
-
boolean
|
|
4752
|
-
array(string
|
|
4737
|
+
content: record$2(string(), union([
|
|
4738
|
+
string(),
|
|
4739
|
+
number(),
|
|
4740
|
+
boolean(),
|
|
4741
|
+
array(string())
|
|
4753
4742
|
])).optional()
|
|
4754
4743
|
});
|
|
4755
4744
|
/**
|
|
@@ -4760,8 +4749,8 @@ function build() {
|
|
|
4760
4749
|
*/
|
|
4761
4750
|
const ElicitRequestURLParamsSchema$1 = object({
|
|
4762
4751
|
mode: literal("url"),
|
|
4763
|
-
message: string
|
|
4764
|
-
url: string
|
|
4752
|
+
message: string(),
|
|
4753
|
+
url: string().url()
|
|
4765
4754
|
});
|
|
4766
4755
|
/** 2026-era elicitation params (form mode is revision-identical; URL mode is the fork above). */
|
|
4767
4756
|
const ElicitRequestParamsSchema$1 = union([ElicitRequestFormParamsSchema$1, ElicitRequestURLParamsSchema$1]);
|
|
@@ -4783,9 +4772,9 @@ function build() {
|
|
|
4783
4772
|
ElicitResultSchema$1
|
|
4784
4773
|
]);
|
|
4785
4774
|
/** Map of embedded input requests, keyed by server-assigned identifiers. */
|
|
4786
|
-
const InputRequestsSchema = record$
|
|
4775
|
+
const InputRequestsSchema = record$2(string(), InputRequestSchema);
|
|
4787
4776
|
/** Map of embedded input responses, keyed by the corresponding request identifiers. */
|
|
4788
|
-
const InputResponsesSchema = record$
|
|
4777
|
+
const InputResponsesSchema = record$2(string(), InputResponseSchema);
|
|
4789
4778
|
/**
|
|
4790
4779
|
* The wire InputRequiredResult: `resultType: 'input_required'` plus at least
|
|
4791
4780
|
* one of `inputRequests` / `requestState` (the at-least-one rule is enforced
|
|
@@ -4793,12 +4782,12 @@ function build() {
|
|
|
4793
4782
|
*/
|
|
4794
4783
|
const InputRequiredResultSchema = wireResult({
|
|
4795
4784
|
inputRequests: InputRequestsSchema.optional(),
|
|
4796
|
-
requestState: string
|
|
4785
|
+
requestState: string().optional()
|
|
4797
4786
|
});
|
|
4798
4787
|
/** The retry-channel members carried by client-initiated requests on this revision. */
|
|
4799
4788
|
const retryParamsShape = {
|
|
4800
4789
|
inputResponses: InputResponsesSchema.optional(),
|
|
4801
|
-
requestState: string
|
|
4790
|
+
requestState: string().optional()
|
|
4802
4791
|
};
|
|
4803
4792
|
/** Anchor InputResponseRequestParams: the retry channel on top of the required request `_meta` envelope. */
|
|
4804
4793
|
const InputResponseRequestParamsSchema = object({
|
|
@@ -4826,8 +4815,8 @@ function build() {
|
|
|
4826
4815
|
});
|
|
4827
4816
|
}
|
|
4828
4817
|
const callToolParamsShape = {
|
|
4829
|
-
name: string
|
|
4830
|
-
arguments: record$
|
|
4818
|
+
name: string(),
|
|
4819
|
+
arguments: record$2(string(), unknown()).optional(),
|
|
4831
4820
|
...retryParamsShape
|
|
4832
4821
|
};
|
|
4833
4822
|
const paginatedParamsShape = { cursor: CursorSchema$1.optional() };
|
|
@@ -4835,32 +4824,32 @@ function build() {
|
|
|
4835
4824
|
const ListToolsRequestSchema$1 = wireRequest("tools/list", paginatedParamsShape);
|
|
4836
4825
|
const ListPromptsRequestSchema$1 = wireRequest("prompts/list", paginatedParamsShape);
|
|
4837
4826
|
const GetPromptRequestSchema$1 = wireRequest("prompts/get", {
|
|
4838
|
-
name: string
|
|
4839
|
-
arguments: record$
|
|
4827
|
+
name: string(),
|
|
4828
|
+
arguments: record$2(string(), string()).optional(),
|
|
4840
4829
|
...retryParamsShape
|
|
4841
4830
|
});
|
|
4842
4831
|
const ListResourcesRequestSchema$1 = wireRequest("resources/list", paginatedParamsShape);
|
|
4843
4832
|
const ListResourceTemplatesRequestSchema$1 = wireRequest("resources/templates/list", paginatedParamsShape);
|
|
4844
4833
|
const ReadResourceRequestSchema$1 = wireRequest("resources/read", {
|
|
4845
|
-
uri: string
|
|
4834
|
+
uri: string(),
|
|
4846
4835
|
...retryParamsShape
|
|
4847
4836
|
});
|
|
4848
4837
|
const completeParamsShape = {
|
|
4849
4838
|
ref: union([PromptReferenceSchema$1, ResourceTemplateReferenceSchema$1]),
|
|
4850
4839
|
argument: object({
|
|
4851
|
-
name: string
|
|
4852
|
-
value: string
|
|
4840
|
+
name: string(),
|
|
4841
|
+
value: string()
|
|
4853
4842
|
}),
|
|
4854
|
-
context: object({ arguments: record$
|
|
4843
|
+
context: object({ arguments: record$2(string(), string()).optional() }).optional()
|
|
4855
4844
|
};
|
|
4856
4845
|
const CompleteRequestSchema$1 = wireRequest("completion/complete", completeParamsShape);
|
|
4857
4846
|
const DiscoverRequestSchema$1 = wireRequest("server/discover", {});
|
|
4858
4847
|
/** Anchor SubscriptionFilter (2026-only). */
|
|
4859
4848
|
const SubscriptionFilterSchema$1 = object({
|
|
4860
|
-
toolsListChanged: boolean
|
|
4861
|
-
promptsListChanged: boolean
|
|
4862
|
-
resourcesListChanged: boolean
|
|
4863
|
-
resourceSubscriptions: array(string
|
|
4849
|
+
toolsListChanged: boolean().optional(),
|
|
4850
|
+
promptsListChanged: boolean().optional(),
|
|
4851
|
+
resourcesListChanged: boolean().optional(),
|
|
4852
|
+
resourceSubscriptions: array(string()).optional()
|
|
4864
4853
|
});
|
|
4865
4854
|
const subscriptionsListenParamsShape = { notifications: SubscriptionFilterSchema$1 };
|
|
4866
4855
|
const SubscriptionsListenRequestSchema$1 = wireRequest("subscriptions/listen", subscriptionsListenParamsShape);
|
|
@@ -4885,13 +4874,13 @@ function build() {
|
|
|
4885
4874
|
"tools/call": dispatchRequest("tools/call", callToolParamsShape),
|
|
4886
4875
|
"tools/list": dispatchRequest("tools/list", paginatedParamsShape),
|
|
4887
4876
|
"prompts/get": dispatchRequest("prompts/get", {
|
|
4888
|
-
name: string
|
|
4889
|
-
arguments: record$
|
|
4877
|
+
name: string(),
|
|
4878
|
+
arguments: record$2(string(), string()).optional()
|
|
4890
4879
|
}),
|
|
4891
4880
|
"prompts/list": dispatchRequest("prompts/list", paginatedParamsShape),
|
|
4892
4881
|
"resources/list": dispatchRequest("resources/list", paginatedParamsShape),
|
|
4893
4882
|
"resources/templates/list": dispatchRequest("resources/templates/list", paginatedParamsShape),
|
|
4894
|
-
"resources/read": dispatchRequest("resources/read", { uri: string
|
|
4883
|
+
"resources/read": dispatchRequest("resources/read", { uri: string() }),
|
|
4895
4884
|
"completion/complete": dispatchRequest("completion/complete", completeParamsShape),
|
|
4896
4885
|
"server/discover": dispatchRequest("server/discover", {}),
|
|
4897
4886
|
"subscriptions/listen": dispatchRequest("subscriptions/listen", subscriptionsListenParamsShape)
|
|
@@ -4908,52 +4897,52 @@ function build() {
|
|
|
4908
4897
|
"tools/call": liftedResult({
|
|
4909
4898
|
content: array(ContentBlockSchema$1),
|
|
4910
4899
|
structuredContent: unknown().optional(),
|
|
4911
|
-
isError: boolean
|
|
4900
|
+
isError: boolean().optional()
|
|
4912
4901
|
}),
|
|
4913
4902
|
"tools/list": liftedResult({
|
|
4914
|
-
ttlMs: number
|
|
4903
|
+
ttlMs: number().int().min(0),
|
|
4915
4904
|
cacheScope: _enum(["public", "private"]),
|
|
4916
4905
|
tools: array(ToolSchema$1),
|
|
4917
4906
|
nextCursor: CursorSchema$1.optional()
|
|
4918
4907
|
}),
|
|
4919
4908
|
"prompts/get": liftedResult({
|
|
4920
|
-
description: string
|
|
4909
|
+
description: string().optional(),
|
|
4921
4910
|
messages: array(PromptMessageSchema$1)
|
|
4922
4911
|
}),
|
|
4923
4912
|
"prompts/list": liftedResult({
|
|
4924
|
-
ttlMs: number
|
|
4913
|
+
ttlMs: number().int().min(0),
|
|
4925
4914
|
cacheScope: _enum(["public", "private"]),
|
|
4926
4915
|
prompts: array(PromptSchema$1),
|
|
4927
4916
|
nextCursor: CursorSchema$1.optional()
|
|
4928
4917
|
}),
|
|
4929
4918
|
"resources/list": liftedResult({
|
|
4930
|
-
ttlMs: number
|
|
4919
|
+
ttlMs: number().int().min(0),
|
|
4931
4920
|
cacheScope: _enum(["public", "private"]),
|
|
4932
4921
|
resources: array(ResourceSchema$1),
|
|
4933
4922
|
nextCursor: CursorSchema$1.optional()
|
|
4934
4923
|
}),
|
|
4935
4924
|
"resources/templates/list": liftedResult({
|
|
4936
|
-
ttlMs: number
|
|
4925
|
+
ttlMs: number().int().min(0),
|
|
4937
4926
|
cacheScope: _enum(["public", "private"]),
|
|
4938
4927
|
resourceTemplates: array(ResourceTemplateSchema$1),
|
|
4939
4928
|
nextCursor: CursorSchema$1.optional()
|
|
4940
4929
|
}),
|
|
4941
4930
|
"resources/read": liftedResult({
|
|
4942
|
-
ttlMs: number
|
|
4931
|
+
ttlMs: number().int().min(0),
|
|
4943
4932
|
cacheScope: _enum(["public", "private"]),
|
|
4944
4933
|
contents: array(union([TextResourceContentsSchema$1, BlobResourceContentsSchema$1]))
|
|
4945
4934
|
}),
|
|
4946
4935
|
"completion/complete": liftedResult({ completion: object({
|
|
4947
|
-
values: array(string
|
|
4948
|
-
total: number
|
|
4949
|
-
hasMore: boolean
|
|
4936
|
+
values: array(string()).max(100),
|
|
4937
|
+
total: number().int().optional(),
|
|
4938
|
+
hasMore: boolean().optional()
|
|
4950
4939
|
}).loose() }),
|
|
4951
4940
|
"server/discover": liftedResult({
|
|
4952
|
-
ttlMs: number
|
|
4941
|
+
ttlMs: number().int().min(0).catch(0),
|
|
4953
4942
|
cacheScope: _enum(["public", "private"]).catch("private"),
|
|
4954
|
-
supportedVersions: array(string
|
|
4943
|
+
supportedVersions: array(string()),
|
|
4955
4944
|
capabilities: ServerCapabilities2026Schema,
|
|
4956
|
-
instructions: string
|
|
4945
|
+
instructions: string().optional()
|
|
4957
4946
|
}),
|
|
4958
4947
|
"subscriptions/listen": liftedResult({})
|
|
4959
4948
|
};
|
|
@@ -4982,7 +4971,7 @@ function build() {
|
|
|
4982
4971
|
const CancelledNotificationParamsSchema$1 = object({
|
|
4983
4972
|
_meta: NotificationMetaSchema.optional(),
|
|
4984
4973
|
requestId: RequestIdSchema$1,
|
|
4985
|
-
reason: string
|
|
4974
|
+
reason: string().optional()
|
|
4986
4975
|
});
|
|
4987
4976
|
/** 2026-era `notifications/cancelled` (see the params fork above). */
|
|
4988
4977
|
const CancelledNotificationSchema$1 = object({
|
|
@@ -5001,7 +4990,7 @@ function build() {
|
|
|
5001
4990
|
};
|
|
5002
4991
|
const wireResultResponse = (result) => object({
|
|
5003
4992
|
jsonrpc: literal("2.0"),
|
|
5004
|
-
id: union([string
|
|
4993
|
+
id: union([string(), number().int()]),
|
|
5005
4994
|
result
|
|
5006
4995
|
}).strict();
|
|
5007
4996
|
return {
|
|
@@ -9281,15 +9270,15 @@ var CfWorkerJsonSchemaValidator = class {
|
|
|
9281
9270
|
preloadSchemas();
|
|
9282
9271
|
//#endregion
|
|
9283
9272
|
//#region ../../../node_modules/.pnpm/pkce-challenge@5.0.1/node_modules/pkce-challenge/dist/index.browser.js
|
|
9284
|
-
let crypto$
|
|
9285
|
-
crypto$
|
|
9273
|
+
let crypto$2;
|
|
9274
|
+
crypto$2 = globalThis.crypto;
|
|
9286
9275
|
/**
|
|
9287
9276
|
* Creates an array of length `size` of random bytes
|
|
9288
9277
|
* @param size
|
|
9289
9278
|
* @returns Array of random ints (0 to 255)
|
|
9290
9279
|
*/
|
|
9291
9280
|
async function getRandomValues(size) {
|
|
9292
|
-
return (await crypto$
|
|
9281
|
+
return (await crypto$2).getRandomValues(new Uint8Array(size));
|
|
9293
9282
|
}
|
|
9294
9283
|
/** Generate cryptographically strong random string
|
|
9295
9284
|
* @param size The desired length of the string
|
|
@@ -9317,7 +9306,7 @@ async function generateVerifier(length) {
|
|
|
9317
9306
|
* @returns The base64 url encoded code challenge
|
|
9318
9307
|
*/
|
|
9319
9308
|
async function generateChallenge(code_verifier) {
|
|
9320
|
-
const buffer = await (await crypto$
|
|
9309
|
+
const buffer = await (await crypto$2).subtle.digest("SHA-256", new TextEncoder().encode(code_verifier));
|
|
9321
9310
|
return btoa(String.fromCharCode(...new Uint8Array(buffer))).replace(/\//g, "_").replace(/\+/g, "-").replace(/=/g, "");
|
|
9322
9311
|
}
|
|
9323
9312
|
/** Generate a PKCE challenge pair
|
|
@@ -14150,6 +14139,104 @@ var StreamableHTTPClientTransport = class {
|
|
|
14150
14139
|
}
|
|
14151
14140
|
};
|
|
14152
14141
|
//#endregion
|
|
14142
|
+
//#region ../../default/po-mcp/src/services/mcpApproval/index.ts
|
|
14143
|
+
const ARGUMENTS_PREVIEW_LIMIT = 2e3;
|
|
14144
|
+
/**
|
|
14145
|
+
* The MCP spec defaults: a tool is read-only only when it says so, and a tool that is not read-only
|
|
14146
|
+
* is destructive unless it says it is not. Most third-party tools send no annotations at all.
|
|
14147
|
+
*/
|
|
14148
|
+
function isDestructiveMcpTool(annotations) {
|
|
14149
|
+
return annotations?.readOnlyHint !== true && annotations?.destructiveHint !== false;
|
|
14150
|
+
}
|
|
14151
|
+
function grantKey(piName, parameters) {
|
|
14152
|
+
return `${piName}\u0000${JSON.stringify(parameters ?? {})}`;
|
|
14153
|
+
}
|
|
14154
|
+
function createMcpApprovalState(options) {
|
|
14155
|
+
let session = false;
|
|
14156
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
14157
|
+
const grants = /* @__PURE__ */ new Map();
|
|
14158
|
+
const release = (key) => {
|
|
14159
|
+
const count = grants.get(key) ?? 0;
|
|
14160
|
+
if (count <= 1) grants.delete(key);
|
|
14161
|
+
else grants.set(key, count - 1);
|
|
14162
|
+
};
|
|
14163
|
+
return {
|
|
14164
|
+
autoApproved: () => session || options.hostAutoApprove(),
|
|
14165
|
+
sessionAutoApprove: () => session,
|
|
14166
|
+
hostAutoApprove: () => options.hostAutoApprove(),
|
|
14167
|
+
setSessionAutoApprove(enabled) {
|
|
14168
|
+
if (session === enabled) return;
|
|
14169
|
+
session = enabled;
|
|
14170
|
+
for (const listener of listeners) listener();
|
|
14171
|
+
},
|
|
14172
|
+
onChange(listener) {
|
|
14173
|
+
listeners.add(listener);
|
|
14174
|
+
const stopHost = options.onHostChange?.(listener);
|
|
14175
|
+
return () => {
|
|
14176
|
+
listeners.delete(listener);
|
|
14177
|
+
stopHost?.();
|
|
14178
|
+
};
|
|
14179
|
+
},
|
|
14180
|
+
grant(piName, parameters) {
|
|
14181
|
+
const key = grantKey(piName, parameters);
|
|
14182
|
+
grants.set(key, (grants.get(key) ?? 0) + 1);
|
|
14183
|
+
let released = false;
|
|
14184
|
+
return () => {
|
|
14185
|
+
if (released) return;
|
|
14186
|
+
released = true;
|
|
14187
|
+
release(key);
|
|
14188
|
+
};
|
|
14189
|
+
},
|
|
14190
|
+
consume(piName, parameters) {
|
|
14191
|
+
const key = grantKey(piName, parameters);
|
|
14192
|
+
if (!grants.has(key)) return false;
|
|
14193
|
+
release(key);
|
|
14194
|
+
return true;
|
|
14195
|
+
}
|
|
14196
|
+
};
|
|
14197
|
+
}
|
|
14198
|
+
function argumentsPreview(parameters) {
|
|
14199
|
+
let text;
|
|
14200
|
+
try {
|
|
14201
|
+
text = JSON.stringify(parameters ?? {});
|
|
14202
|
+
} catch {
|
|
14203
|
+
text = "(arguments could not be shown)";
|
|
14204
|
+
}
|
|
14205
|
+
return text.length > ARGUMENTS_PREVIEW_LIMIT ? `${text.slice(0, 1999)}…` : text;
|
|
14206
|
+
}
|
|
14207
|
+
/** The person-facing card for one MCP tool call. */
|
|
14208
|
+
function describeMcpToolCall(tool, parameters) {
|
|
14209
|
+
return {
|
|
14210
|
+
title: `${tool.serverName}: ${tool.toolName}`,
|
|
14211
|
+
summary: tool.description ?? `Run ${tool.toolName} on the ${tool.serverName} MCP server.`,
|
|
14212
|
+
details: [
|
|
14213
|
+
{
|
|
14214
|
+
label: "Server",
|
|
14215
|
+
value: tool.serverName
|
|
14216
|
+
},
|
|
14217
|
+
{
|
|
14218
|
+
label: "Tool",
|
|
14219
|
+
value: tool.toolName
|
|
14220
|
+
},
|
|
14221
|
+
{
|
|
14222
|
+
label: "Arguments",
|
|
14223
|
+
value: argumentsPreview(parameters)
|
|
14224
|
+
}
|
|
14225
|
+
]
|
|
14226
|
+
};
|
|
14227
|
+
}
|
|
14228
|
+
/**
|
|
14229
|
+
* Approval for one destructive MCP tool. Declared whatever the toggles say, so a call queued before
|
|
14230
|
+
* auto-approve flipped still replays; `applies` reads the toggles and any App grant per call.
|
|
14231
|
+
*/
|
|
14232
|
+
function mcpToolApproval(tool, state) {
|
|
14233
|
+
return {
|
|
14234
|
+
requirement: "ask",
|
|
14235
|
+
applies: (parameters) => !state.autoApproved() && !state.consume(tool.piName, parameters),
|
|
14236
|
+
describe: (parameters) => describeMcpToolCall(tool, parameters)
|
|
14237
|
+
};
|
|
14238
|
+
}
|
|
14239
|
+
//#endregion
|
|
14153
14240
|
//#region ../../default/po-mcp/src/services/mcpCatalog/index.ts
|
|
14154
14241
|
function metadataRecord(value) {
|
|
14155
14242
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
@@ -14191,6 +14278,9 @@ function mcpToolExecutionMetadata(tool) {
|
|
|
14191
14278
|
}
|
|
14192
14279
|
};
|
|
14193
14280
|
}
|
|
14281
|
+
function isAppVisibleMcpTool(tool) {
|
|
14282
|
+
return normalizeMcpAppMetadata(tool._meta).appVisible;
|
|
14283
|
+
}
|
|
14194
14284
|
/**
|
|
14195
14285
|
* Pi's tool name for a downstream tool.
|
|
14196
14286
|
*
|
|
@@ -14207,13 +14297,13 @@ function toPiToolName(serverName, toolName) {
|
|
|
14207
14297
|
/** ChatGPT Apps metadata naming the top-level arguments that carry a file. */
|
|
14208
14298
|
const FILE_PARAMS_META_KEY = "openai/fileParams";
|
|
14209
14299
|
const MAX_FILE_PARAMS = 16;
|
|
14210
|
-
function record(value) {
|
|
14300
|
+
function record$1(value) {
|
|
14211
14301
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
14212
14302
|
}
|
|
14213
14303
|
/** Declared file parameters that the input schema really has at its top level. */
|
|
14214
14304
|
function fileParamNames(tool) {
|
|
14215
14305
|
const declared = tool._meta?.[FILE_PARAMS_META_KEY];
|
|
14216
|
-
const properties = record(tool.inputSchema.properties);
|
|
14306
|
+
const properties = record$1(tool.inputSchema.properties);
|
|
14217
14307
|
if (!Array.isArray(declared) || properties === void 0) return [];
|
|
14218
14308
|
const names = declared.filter((name) => typeof name === "string" && Object.hasOwn(properties, name));
|
|
14219
14309
|
return [...new Set(names)].slice(0, MAX_FILE_PARAMS);
|
|
@@ -14226,9 +14316,9 @@ function modelInputSchema(tool) {
|
|
|
14226
14316
|
};
|
|
14227
14317
|
const names = fileParamNames(tool);
|
|
14228
14318
|
if (names.length === 0) return tool.inputSchema;
|
|
14229
|
-
const properties = { ...record(tool.inputSchema.properties) };
|
|
14319
|
+
const properties = { ...record$1(tool.inputSchema.properties) };
|
|
14230
14320
|
for (const name of names) {
|
|
14231
|
-
const description = record(properties[name])?.description;
|
|
14321
|
+
const description = record$1(properties[name])?.description;
|
|
14232
14322
|
properties[name] = {
|
|
14233
14323
|
type: "object",
|
|
14234
14324
|
description: `${typeof description === "string" ? description : "A file."} Pass {"path": "<file in the working directory, or the path from an Attached file note>"}.`,
|
|
@@ -14243,10 +14333,224 @@ function modelInputSchema(tool) {
|
|
|
14243
14333
|
};
|
|
14244
14334
|
}
|
|
14245
14335
|
//#endregion
|
|
14336
|
+
//#region ../../default/po-mcp/src/services/mcpScope/index.edge.ts
|
|
14337
|
+
/** Edge build of `mcpScope`: same names, no filesystem, so a repository is keyed by its path as given. */
|
|
14338
|
+
const USER_MCP_SCOPE = "user";
|
|
14339
|
+
//#endregion
|
|
14340
|
+
//#region ../../default/po-mcp/src/services/mcpSecrets/index.ts
|
|
14341
|
+
/**
|
|
14342
|
+
* `${vault:NAME}` secrets for MCP server headers and environment.
|
|
14343
|
+
*
|
|
14344
|
+
* Each secret is stored per credential scope (user, repository, plugin) and bound to where it may
|
|
14345
|
+
* go: a URL origin, or a command with its exact arguments. A secret read for any other destination
|
|
14346
|
+
* counts as missing, so editing a server's URL or command never sends an old secret somewhere new.
|
|
14347
|
+
*/
|
|
14348
|
+
const MCP_SECRET_NAMESPACE = "mcp.secret";
|
|
14349
|
+
const SECRET_NAME = /^[A-Za-z0-9._-]{1,64}$/u;
|
|
14350
|
+
const SLUG_INVALID = /[^A-Za-z0-9._-]/gu;
|
|
14351
|
+
const MAX_SECRET_VALUE = 4096;
|
|
14352
|
+
const MAX_SECRET_FIELDS = 64;
|
|
14353
|
+
const VAULT_REF_MARKER$1 = "${vault:";
|
|
14354
|
+
/** `${scope}/${name}`: one secret per name per scope. */
|
|
14355
|
+
function mcpSecretVaultKey(scope, name) {
|
|
14356
|
+
return `${scope}/${name}`;
|
|
14357
|
+
}
|
|
14358
|
+
/** The reference written into configuration in place of a secret value. */
|
|
14359
|
+
function vaultReference(name) {
|
|
14360
|
+
return `\${vault:${name}}`;
|
|
14361
|
+
}
|
|
14362
|
+
/** True for a name a `${vault:NAME}` reference accepts. */
|
|
14363
|
+
function isSecretName(value) {
|
|
14364
|
+
return typeof value === "string" && SECRET_NAME.test(value);
|
|
14365
|
+
}
|
|
14366
|
+
/** A secret value the vault keeps: one line, at most 4 KiB. */
|
|
14367
|
+
function isSecretValue(value) {
|
|
14368
|
+
return typeof value === "string" && value.length > 0 && value.length <= MAX_SECRET_VALUE && !/[\r\n\0]/u.test(value) && !value.includes(VAULT_REF_MARKER$1);
|
|
14369
|
+
}
|
|
14370
|
+
/** The sha256 of `JSON.stringify([command, args])`, so a changed argument list reads as a new destination. */
|
|
14371
|
+
function argsDigest(command, args) {
|
|
14372
|
+
return createHash("sha256").update(JSON.stringify([command, args])).digest("hex");
|
|
14373
|
+
}
|
|
14374
|
+
/** Where a connection is about to send a secret, or undefined when the target names no destination. */
|
|
14375
|
+
function secretBindingOf(target) {
|
|
14376
|
+
if (target.origin !== void 0) return { origin: target.origin };
|
|
14377
|
+
if (target.command !== void 0) return {
|
|
14378
|
+
command: target.command,
|
|
14379
|
+
argsDigest: argsDigest(target.command, target.args ?? [])
|
|
14380
|
+
};
|
|
14381
|
+
}
|
|
14382
|
+
function sameBinding(left, right) {
|
|
14383
|
+
if ("origin" in left || "origin" in right) return "origin" in left && "origin" in right && left.origin === right.origin;
|
|
14384
|
+
return left.command === right.command && left.argsDigest === right.argsDigest;
|
|
14385
|
+
}
|
|
14386
|
+
function readStoredSecret(value) {
|
|
14387
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
14388
|
+
const { value: secret, boundTo } = value;
|
|
14389
|
+
if (typeof secret !== "string" || typeof boundTo !== "object" || boundTo === null || Array.isArray(boundTo)) return void 0;
|
|
14390
|
+
if (typeof boundTo.origin === "string") return {
|
|
14391
|
+
value: secret,
|
|
14392
|
+
boundTo: { origin: boundTo.origin }
|
|
14393
|
+
};
|
|
14394
|
+
if (typeof boundTo.command === "string" && typeof boundTo.argsDigest === "string") return {
|
|
14395
|
+
value: secret,
|
|
14396
|
+
boundTo: {
|
|
14397
|
+
command: boundTo.command,
|
|
14398
|
+
argsDigest: boundTo.argsDigest
|
|
14399
|
+
}
|
|
14400
|
+
};
|
|
14401
|
+
}
|
|
14402
|
+
function toMiss(target) {
|
|
14403
|
+
const { signal: _signal, ...miss } = target;
|
|
14404
|
+
return {
|
|
14405
|
+
...miss,
|
|
14406
|
+
...miss.args ? { args: [...miss.args] } : {}
|
|
14407
|
+
};
|
|
14408
|
+
}
|
|
14409
|
+
/**
|
|
14410
|
+
* The proxy's `resolveSecret` callback over the vault.
|
|
14411
|
+
*
|
|
14412
|
+
* A server with no scope (session-only servers) or a host with no vault resolves nothing and
|
|
14413
|
+
* records nothing, since there is nowhere to supply the secret. A vault failure propagates, which
|
|
14414
|
+
* the proxy turns into its one generic connection error.
|
|
14415
|
+
*/
|
|
14416
|
+
function createSecretResolver(options) {
|
|
14417
|
+
return async (target) => {
|
|
14418
|
+
const scope = options.scopeOf(target.serverName);
|
|
14419
|
+
const vault = options.vault();
|
|
14420
|
+
const expected = secretBindingOf(target);
|
|
14421
|
+
if (scope === void 0 || !vault || !expected || !isSecretName(target.name)) return void 0;
|
|
14422
|
+
const stored = readStoredSecret((await vault.get(MCP_SECRET_NAMESPACE, mcpSecretVaultKey(scope, target.name)))?.value);
|
|
14423
|
+
if (!stored || !sameBinding(stored.boundTo, expected)) {
|
|
14424
|
+
options.onMissing?.(toMiss(target));
|
|
14425
|
+
return;
|
|
14426
|
+
}
|
|
14427
|
+
return stored.value;
|
|
14428
|
+
};
|
|
14429
|
+
}
|
|
14430
|
+
/** Writes one secret, last write wins. */
|
|
14431
|
+
async function storeSecret(vault, scope, write) {
|
|
14432
|
+
const value = {
|
|
14433
|
+
value: write.value,
|
|
14434
|
+
boundTo: write.boundTo
|
|
14435
|
+
};
|
|
14436
|
+
await vault.put(MCP_SECRET_NAMESPACE, mcpSecretVaultKey(scope, write.name), {
|
|
14437
|
+
...value,
|
|
14438
|
+
boundTo: { ...value.boundTo }
|
|
14439
|
+
});
|
|
14440
|
+
}
|
|
14441
|
+
/**
|
|
14442
|
+
* Writes every secret of one add-server request and returns how to undo them.
|
|
14443
|
+
*
|
|
14444
|
+
* A name that already held a secret is restored on undo rather than deleted, so a failed add never
|
|
14445
|
+
* erases a secret another server still references. A failed write undoes the earlier ones before
|
|
14446
|
+
* rethrowing.
|
|
14447
|
+
*/
|
|
14448
|
+
async function writeSecrets(vault, scope, writes) {
|
|
14449
|
+
const undo = [];
|
|
14450
|
+
const rollback = async () => {
|
|
14451
|
+
for (const step of undo.reverse()) await step().catch(() => void 0);
|
|
14452
|
+
};
|
|
14453
|
+
try {
|
|
14454
|
+
for (const write of writes) {
|
|
14455
|
+
const key = mcpSecretVaultKey(scope, write.name);
|
|
14456
|
+
const previous = await vault.get(MCP_SECRET_NAMESPACE, key);
|
|
14457
|
+
await storeSecret(vault, scope, write);
|
|
14458
|
+
undo.push(() => previous ? vault.put(MCP_SECRET_NAMESPACE, key, previous.value).then(() => void 0) : vault.delete(MCP_SECRET_NAMESPACE, key));
|
|
14459
|
+
}
|
|
14460
|
+
} catch (error) {
|
|
14461
|
+
await rollback();
|
|
14462
|
+
throw error;
|
|
14463
|
+
}
|
|
14464
|
+
return rollback;
|
|
14465
|
+
}
|
|
14466
|
+
function refuse$1(error) {
|
|
14467
|
+
return {
|
|
14468
|
+
ok: false,
|
|
14469
|
+
status: 400,
|
|
14470
|
+
error
|
|
14471
|
+
};
|
|
14472
|
+
}
|
|
14473
|
+
function isCredentialOrigin(url) {
|
|
14474
|
+
return url.protocol === "https:" || url.protocol === "http:" && [
|
|
14475
|
+
"localhost",
|
|
14476
|
+
"127.0.0.1",
|
|
14477
|
+
"[::1]"
|
|
14478
|
+
].includes(url.hostname);
|
|
14479
|
+
}
|
|
14480
|
+
/**
|
|
14481
|
+
* Moves the named header or env values of an add-server request into vault writes, leaving
|
|
14482
|
+
* `${vault:<server>-<field>}` in the entry. Every field is untrusted input.
|
|
14483
|
+
*/
|
|
14484
|
+
function prepareSecretAddition(addition, secretFields) {
|
|
14485
|
+
if (secretFields === void 0) return {
|
|
14486
|
+
ok: true,
|
|
14487
|
+
value: {
|
|
14488
|
+
addition,
|
|
14489
|
+
secrets: []
|
|
14490
|
+
}
|
|
14491
|
+
};
|
|
14492
|
+
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.");
|
|
14493
|
+
if (secretFields.length === 0) return {
|
|
14494
|
+
ok: true,
|
|
14495
|
+
value: {
|
|
14496
|
+
addition,
|
|
14497
|
+
secrets: []
|
|
14498
|
+
}
|
|
14499
|
+
};
|
|
14500
|
+
const { entry } = addition;
|
|
14501
|
+
let boundTo;
|
|
14502
|
+
let values;
|
|
14503
|
+
if ("command" in entry) {
|
|
14504
|
+
boundTo = {
|
|
14505
|
+
command: entry.command,
|
|
14506
|
+
argsDigest: argsDigest(entry.command, entry.args)
|
|
14507
|
+
};
|
|
14508
|
+
values = { ...entry.env };
|
|
14509
|
+
} else {
|
|
14510
|
+
const url = new URL(entry.url);
|
|
14511
|
+
if (!isCredentialOrigin(url) || url.username || url.password) return refuse$1("A secret is only sent over https, or over plain http to this machine.");
|
|
14512
|
+
boundTo = { origin: url.origin };
|
|
14513
|
+
values = { ...entry.headers };
|
|
14514
|
+
}
|
|
14515
|
+
const secrets = [];
|
|
14516
|
+
for (const field of secretFields) {
|
|
14517
|
+
const value = Object.hasOwn(values, field) ? values[field] : void 0;
|
|
14518
|
+
if (!isSecretValue(value)) return refuse$1("Each secret field needs a value you entered.");
|
|
14519
|
+
const name = `${addition.name}-${field.replace(SLUG_INVALID, "_")}`;
|
|
14520
|
+
if (!isSecretName(name)) return refuse$1("Shorten the server or field name so the secret name fits in 64 characters.");
|
|
14521
|
+
if (secrets.some((secret) => secret.name === name)) return refuse$1("Two secret fields map to the same vault name.");
|
|
14522
|
+
secrets.push({
|
|
14523
|
+
name,
|
|
14524
|
+
value,
|
|
14525
|
+
boundTo
|
|
14526
|
+
});
|
|
14527
|
+
values[field] = vaultReference(name);
|
|
14528
|
+
}
|
|
14529
|
+
const next = "command" in entry ? {
|
|
14530
|
+
command: entry.command,
|
|
14531
|
+
args: [...entry.args],
|
|
14532
|
+
env: values
|
|
14533
|
+
} : {
|
|
14534
|
+
type: "http",
|
|
14535
|
+
url: entry.url,
|
|
14536
|
+
headers: values
|
|
14537
|
+
};
|
|
14538
|
+
return {
|
|
14539
|
+
ok: true,
|
|
14540
|
+
value: {
|
|
14541
|
+
addition: {
|
|
14542
|
+
name: addition.name,
|
|
14543
|
+
entry: next
|
|
14544
|
+
},
|
|
14545
|
+
secrets
|
|
14546
|
+
}
|
|
14547
|
+
};
|
|
14548
|
+
}
|
|
14549
|
+
//#endregion
|
|
14246
14550
|
//#region ../../default/po-mcp/src/services/remoteMcp/index.ts
|
|
14247
14551
|
const PO_MCP_REMOTE_SERVERS_SERVICE = "po/mcp-remote-servers";
|
|
14248
|
-
/** Bound by the host at the
|
|
14249
|
-
const PO_MCP_REMOTE_SERVERS_CONTRACT = defineServiceContract(PO_MCP_REMOTE_SERVERS_SERVICE, { scope: "
|
|
14552
|
+
/** Bound by the host at the host level, so every session it opens inherits it. */
|
|
14553
|
+
const PO_MCP_REMOTE_SERVERS_CONTRACT = defineServiceContract(PO_MCP_REMOTE_SERVERS_SERVICE, { scope: "host" });
|
|
14250
14554
|
/** Largest single MCP response accepted from a remote server. */
|
|
14251
14555
|
const REMOTE_MCP_MAX_BYTES = 4194304;
|
|
14252
14556
|
/** Deadline for one MCP request, including its body. */
|
|
@@ -14256,6 +14560,10 @@ const CLIENT_INFO = {
|
|
|
14256
14560
|
name: "po-cloud",
|
|
14257
14561
|
version: "1.0.0"
|
|
14258
14562
|
};
|
|
14563
|
+
/** The one failure for any unresolved reference, as the Node proxy reports it: never a name or a value. */
|
|
14564
|
+
const REMOTE_MCP_SECRET_ERROR = "MCP secret reference could not be resolved.";
|
|
14565
|
+
const VAULT_REF = /\$\{vault:([A-Za-z0-9._-]{1,64})\}/gu;
|
|
14566
|
+
const VAULT_REF_MARKER = "${vault:";
|
|
14259
14567
|
function readPoMcpRemoteServers(context) {
|
|
14260
14568
|
return context.get(PO_MCP_REMOTE_SERVERS_SERVICE);
|
|
14261
14569
|
}
|
|
@@ -14282,6 +14590,10 @@ function toResult(result) {
|
|
|
14282
14590
|
function message(error) {
|
|
14283
14591
|
return (error instanceof Error ? error.message : String(error)).slice(0, 300);
|
|
14284
14592
|
}
|
|
14593
|
+
/** A 401 or 403 means the stored header no longer works; retrying with the same one cannot help. */
|
|
14594
|
+
function isUnauthorized(error) {
|
|
14595
|
+
return error instanceof UnauthorizedError || error instanceof SdkHttpError && (error.status === 401 || error.status === 403);
|
|
14596
|
+
}
|
|
14285
14597
|
async function listTools(client, server, signal) {
|
|
14286
14598
|
const tools = [];
|
|
14287
14599
|
let cursor;
|
|
@@ -14307,10 +14619,51 @@ async function listTools(client, server, signal) {
|
|
|
14307
14619
|
return tools;
|
|
14308
14620
|
}
|
|
14309
14621
|
/**
|
|
14622
|
+
* The server's headers with every `${vault:NAME}` replaced from the vault's `mcp.secret` entries.
|
|
14623
|
+
*
|
|
14624
|
+
* Host-configured servers are the edge's only configuration layer, so they read the user scope with the Node
|
|
14625
|
+
* session's key scheme and origin binding. A malformed reference, a miss, a missing vault or any vault failure
|
|
14626
|
+
* (`unavailable` included) throws the one generic error, as the Node proxy does, so that server alone fails.
|
|
14627
|
+
*/
|
|
14628
|
+
async function resolveRemoteMcpHeaders(server, vault, signal) {
|
|
14629
|
+
const headers = { ...server.headers };
|
|
14630
|
+
const resolveSecret = createSecretResolver({
|
|
14631
|
+
vault,
|
|
14632
|
+
scopeOf: () => USER_MCP_SCOPE
|
|
14633
|
+
});
|
|
14634
|
+
const origin = new URL(server.url).origin;
|
|
14635
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
14636
|
+
if (!value.includes(VAULT_REF_MARKER)) continue;
|
|
14637
|
+
if (value.replace(VAULT_REF, "").includes(VAULT_REF_MARKER)) throw new Error(REMOTE_MCP_SECRET_ERROR);
|
|
14638
|
+
const secrets = /* @__PURE__ */ new Map();
|
|
14639
|
+
for (const [, name] of value.matchAll(VAULT_REF)) {
|
|
14640
|
+
if (secrets.has(name)) continue;
|
|
14641
|
+
let secret;
|
|
14642
|
+
try {
|
|
14643
|
+
secret = await resolveSecret({
|
|
14644
|
+
serverName: server.name,
|
|
14645
|
+
field: "header",
|
|
14646
|
+
key,
|
|
14647
|
+
name,
|
|
14648
|
+
transport: "http",
|
|
14649
|
+
origin
|
|
14650
|
+
});
|
|
14651
|
+
} catch {
|
|
14652
|
+
secret = void 0;
|
|
14653
|
+
}
|
|
14654
|
+
signal?.throwIfAborted();
|
|
14655
|
+
if (secret === void 0) throw new Error(REMOTE_MCP_SECRET_ERROR);
|
|
14656
|
+
secrets.set(name, secret);
|
|
14657
|
+
}
|
|
14658
|
+
headers[key] = value.replace(VAULT_REF, (_match, name) => secrets.get(name));
|
|
14659
|
+
}
|
|
14660
|
+
return headers;
|
|
14661
|
+
}
|
|
14662
|
+
/**
|
|
14310
14663
|
* Connects every server the host hands over, once. A server that the policy refuses or that fails to
|
|
14311
14664
|
* answer is reported in `failures` and contributes no tools; the others still connect.
|
|
14312
14665
|
*/
|
|
14313
|
-
async function connectRemoteMcpServers(service, signal) {
|
|
14666
|
+
async function connectRemoteMcpServers(service, signal, approval, vault = () => void 0) {
|
|
14314
14667
|
const policy = {
|
|
14315
14668
|
protocols: REMOTE_MCP_PROTOCOLS,
|
|
14316
14669
|
blockedHosts: service.blockedHosts
|
|
@@ -14324,6 +14677,20 @@ async function connectRemoteMcpServers(service, signal) {
|
|
|
14324
14677
|
const servers = await service.load(signal);
|
|
14325
14678
|
const failures = [];
|
|
14326
14679
|
const clients = [];
|
|
14680
|
+
let disposed = false;
|
|
14681
|
+
let revision = 0;
|
|
14682
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
14683
|
+
const lost = /* @__PURE__ */ new Set();
|
|
14684
|
+
const lose = (name, reason) => {
|
|
14685
|
+
if (disposed || lost.has(name)) return;
|
|
14686
|
+
lost.add(name);
|
|
14687
|
+
revision++;
|
|
14688
|
+
failures.push({
|
|
14689
|
+
name,
|
|
14690
|
+
message: reason
|
|
14691
|
+
});
|
|
14692
|
+
for (const listener of listeners) listener();
|
|
14693
|
+
};
|
|
14327
14694
|
const entries = (await Promise.all(servers.map(async (server) => {
|
|
14328
14695
|
const refusal = outboundHostRefusal(server.url, policy);
|
|
14329
14696
|
if (refusal) {
|
|
@@ -14334,17 +14701,19 @@ async function connectRemoteMcpServers(service, signal) {
|
|
|
14334
14701
|
return [];
|
|
14335
14702
|
}
|
|
14336
14703
|
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
14704
|
try {
|
|
14705
|
+
const transport = new StreamableHTTPClientTransport(new URL(server.url), {
|
|
14706
|
+
fetch: fetcher,
|
|
14707
|
+
requestInit: { headers: await resolveRemoteMcpHeaders(server, vault, signal) }
|
|
14708
|
+
});
|
|
14342
14709
|
await client.connect(transport, {
|
|
14343
14710
|
signal,
|
|
14344
14711
|
timeout: REMOTE_MCP_TIMEOUT_MS
|
|
14345
14712
|
});
|
|
14346
14713
|
clients.push(client);
|
|
14347
|
-
|
|
14714
|
+
const tools = await listTools(client, server.name, signal);
|
|
14715
|
+
client.onclose = () => lose(server.name, "The connection closed.");
|
|
14716
|
+
return tools.map((tool) => ({
|
|
14348
14717
|
tool,
|
|
14349
14718
|
client
|
|
14350
14719
|
}));
|
|
@@ -14357,8 +14726,6 @@ async function connectRemoteMcpServers(service, signal) {
|
|
|
14357
14726
|
return [];
|
|
14358
14727
|
}
|
|
14359
14728
|
}))).flat();
|
|
14360
|
-
let disposed = false;
|
|
14361
|
-
const listeners = /* @__PURE__ */ new Set();
|
|
14362
14729
|
const projected = entries.map(({ tool, client }) => {
|
|
14363
14730
|
const parameters = modelInputSchema(tool);
|
|
14364
14731
|
return {
|
|
@@ -14366,6 +14733,7 @@ async function connectRemoteMcpServers(service, signal) {
|
|
|
14366
14733
|
label: `${tool.serverName}: ${tool.toolName}`,
|
|
14367
14734
|
description: tool.description ?? `${tool.toolName} on the ${tool.serverName} MCP server.`,
|
|
14368
14735
|
...tool.annotations === void 0 ? {} : { annotations: tool.annotations },
|
|
14736
|
+
...approval !== void 0 && isDestructiveMcpTool(tool.annotations) ? { approval: mcpToolApproval(tool, approval) } : {},
|
|
14369
14737
|
...tool._meta === void 0 ? {} : { _meta: mcpToolExecutionMetadata(tool) },
|
|
14370
14738
|
...tool.outputSchema === void 0 ? {} : { outputSchema: tool.outputSchema },
|
|
14371
14739
|
parameters,
|
|
@@ -14374,21 +14742,33 @@ async function connectRemoteMcpServers(service, signal) {
|
|
|
14374
14742
|
callSignal?.throwIfAborted();
|
|
14375
14743
|
const args = input === void 0 ? {} : input;
|
|
14376
14744
|
if (!Check(parameters, args)) throw new Error(`Invalid arguments for MCP tool ${tool.piName}.`);
|
|
14377
|
-
|
|
14378
|
-
|
|
14379
|
-
|
|
14380
|
-
|
|
14381
|
-
|
|
14382
|
-
|
|
14383
|
-
|
|
14745
|
+
let result;
|
|
14746
|
+
try {
|
|
14747
|
+
result = await client.callTool({
|
|
14748
|
+
name: tool.toolName,
|
|
14749
|
+
arguments: args
|
|
14750
|
+
}, {
|
|
14751
|
+
...callSignal ? { signal: callSignal } : {},
|
|
14752
|
+
timeout: REMOTE_MCP_TIMEOUT_MS
|
|
14753
|
+
});
|
|
14754
|
+
} catch (error) {
|
|
14755
|
+
if (isUnauthorized(error)) lose(tool.serverName, "The server no longer accepts its credentials.");
|
|
14756
|
+
throw error;
|
|
14757
|
+
}
|
|
14758
|
+
return toResult(result);
|
|
14384
14759
|
}
|
|
14385
14760
|
};
|
|
14386
14761
|
});
|
|
14387
|
-
const
|
|
14388
|
-
const
|
|
14762
|
+
const live = () => disposed ? [] : entries.filter(({ tool }) => !lost.has(tool.serverName));
|
|
14763
|
+
const snapshot = () => live().map(({ tool }) => tool);
|
|
14764
|
+
const project = () => {
|
|
14765
|
+
const names = new Set(live().map(({ tool }) => tool.piName));
|
|
14766
|
+
return projected.filter((tool) => names.has(tool.name));
|
|
14767
|
+
};
|
|
14389
14768
|
const sessionTools = Object.freeze({
|
|
14390
14769
|
generation: `remote:${crypto.randomUUID()}`,
|
|
14391
|
-
|
|
14770
|
+
approval,
|
|
14771
|
+
runtimeRevision: () => revision,
|
|
14392
14772
|
readAppResource: async () => {
|
|
14393
14773
|
throw new Error("MCP Apps are not available on this host.");
|
|
14394
14774
|
},
|
|
@@ -14428,4 +14808,498 @@ async function connectRemoteMcpServers(service, signal) {
|
|
|
14428
14808
|
};
|
|
14429
14809
|
}
|
|
14430
14810
|
//#endregion
|
|
14431
|
-
|
|
14811
|
+
//#region ../../default/po-mcp/src/services/mcpHostSettings/index.ts
|
|
14812
|
+
/** Beside `mcp.json` in Po's home, kept separate so MCP clients that read `mcp.json` never see it. */
|
|
14813
|
+
const MCP_SETTINGS_FILE = "mcp-settings.json";
|
|
14814
|
+
const AUTO_APPROVE_KEY = "autoApproveDestructiveTools";
|
|
14815
|
+
function record(value) {
|
|
14816
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
14817
|
+
}
|
|
14818
|
+
/** The file's object, or an empty one when it is missing. A malformed file is refused rather than overwritten. */
|
|
14819
|
+
async function readDocument(fs, filePath) {
|
|
14820
|
+
const text = await readTextIfExists(fs, filePath, BACKGROUND_CONTEXT);
|
|
14821
|
+
if (text === void 0) return {};
|
|
14822
|
+
let parsed;
|
|
14823
|
+
try {
|
|
14824
|
+
parsed = JSON.parse(text);
|
|
14825
|
+
} catch (error) {
|
|
14826
|
+
throw new Error(`${MCP_SETTINGS_FILE} is not valid JSON.`, { cause: error });
|
|
14827
|
+
}
|
|
14828
|
+
const document = record(parsed);
|
|
14829
|
+
if (!document) throw new Error(`${MCP_SETTINGS_FILE} must hold a JSON object.`);
|
|
14830
|
+
return document;
|
|
14831
|
+
}
|
|
14832
|
+
function createMcpHostSettings(getFs) {
|
|
14833
|
+
let autoApprove = false;
|
|
14834
|
+
let loaded;
|
|
14835
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
14836
|
+
const removalListeners = /* @__PURE__ */ new Set();
|
|
14837
|
+
const requireFs = () => {
|
|
14838
|
+
const fs = getFs();
|
|
14839
|
+
if (!fs) throw new Error("MCP settings need the host filesystem.");
|
|
14840
|
+
return fs;
|
|
14841
|
+
};
|
|
14842
|
+
const set = (enabled) => {
|
|
14843
|
+
if (autoApprove === enabled) return;
|
|
14844
|
+
autoApprove = enabled;
|
|
14845
|
+
for (const listener of listeners) listener();
|
|
14846
|
+
};
|
|
14847
|
+
return {
|
|
14848
|
+
autoApprove: () => autoApprove,
|
|
14849
|
+
load(filePath) {
|
|
14850
|
+
if (loaded?.path === filePath) return loaded.read;
|
|
14851
|
+
const read = (async () => {
|
|
14852
|
+
const document = await readDocument(requireFs(), filePath);
|
|
14853
|
+
set(document[AUTO_APPROVE_KEY] === true);
|
|
14854
|
+
return autoApprove;
|
|
14855
|
+
})();
|
|
14856
|
+
loaded = {
|
|
14857
|
+
path: filePath,
|
|
14858
|
+
read
|
|
14859
|
+
};
|
|
14860
|
+
read.catch(() => {
|
|
14861
|
+
if (loaded?.read === read) loaded = void 0;
|
|
14862
|
+
});
|
|
14863
|
+
return read;
|
|
14864
|
+
},
|
|
14865
|
+
async setAutoApprove(filePath, enabled) {
|
|
14866
|
+
const fs = requireFs();
|
|
14867
|
+
const document = await readDocument(fs, filePath);
|
|
14868
|
+
await writeFileAtomic(fs, filePath, `${JSON.stringify({
|
|
14869
|
+
...document,
|
|
14870
|
+
[AUTO_APPROVE_KEY]: enabled
|
|
14871
|
+
}, null, 2)}\n`, BACKGROUND_CONTEXT);
|
|
14872
|
+
loaded = {
|
|
14873
|
+
path: filePath,
|
|
14874
|
+
read: Promise.resolve(enabled)
|
|
14875
|
+
};
|
|
14876
|
+
set(enabled);
|
|
14877
|
+
},
|
|
14878
|
+
onChange(listener) {
|
|
14879
|
+
listeners.add(listener);
|
|
14880
|
+
return () => {
|
|
14881
|
+
listeners.delete(listener);
|
|
14882
|
+
};
|
|
14883
|
+
},
|
|
14884
|
+
serverRemoved(removal) {
|
|
14885
|
+
for (const listener of removalListeners) listener(removal);
|
|
14886
|
+
},
|
|
14887
|
+
onServerRemoved(listener) {
|
|
14888
|
+
removalListeners.add(listener);
|
|
14889
|
+
return () => {
|
|
14890
|
+
removalListeners.delete(listener);
|
|
14891
|
+
};
|
|
14892
|
+
}
|
|
14893
|
+
};
|
|
14894
|
+
}
|
|
14895
|
+
//#endregion
|
|
14896
|
+
//#region ../../default/po-mcp/src/constants/mcp.ts
|
|
14897
|
+
const SERVER_COMMAND_DESCRIPTION = "Show MCP configuration or begin an authorization request.";
|
|
14898
|
+
/** Matched by the hub API, which answers 503. */
|
|
14899
|
+
const VAULT_UNAVAILABLE = "Po's vault is unavailable, so MCP sign-ins cannot be saved.";
|
|
14900
|
+
const MCP_APP_CLIENT_CAPABILITIES = { extensions: { "io.modelcontextprotocol/ui": { mimeTypes: ["text/html;profile=mcp-app", "text/html+skybridge"] } } };
|
|
14901
|
+
new RegExp(`${String.fromCharCode(27)}\\[[0-?]*[ -/]*[@-~]`, "gu");
|
|
14902
|
+
/** Session route for one reachable tool's description and schema. */
|
|
14903
|
+
const MCP_SESSION_TOOL_API_PATH = "/tool";
|
|
14904
|
+
const MCP_SESSION_TOOL_SERVER_QUERY = "server";
|
|
14905
|
+
const MCP_SESSION_TOOL_NAME_QUERY = "tool";
|
|
14906
|
+
/** Session route that stores a `${vault:NAME}` secret the session reported missing. */
|
|
14907
|
+
const MCP_SESSION_SECRETS_API_PATH = "/secrets";
|
|
14908
|
+
/** Hub API paths for repository-scoped MCP management. */
|
|
14909
|
+
const MCP_REPOSITORY_API_PATH = "/repository";
|
|
14910
|
+
const MCP_DISCOVERY_API_PATH = "/repository/discover";
|
|
14911
|
+
const MCP_AUTHORIZATION_API_PATH = "/repository/authorize";
|
|
14912
|
+
/** Stores one key a configured server asks for, without a session. */
|
|
14913
|
+
const MCP_REPOSITORY_SECRETS_API_PATH = "/repository/secrets";
|
|
14914
|
+
/** The repository every route is asked about, and the flow segment the two flow routes carry. */
|
|
14915
|
+
const MCP_REPOSITORY_ID_QUERY = "repositoryId";
|
|
14916
|
+
const MCP_FLOW_ID_PARAM = "flowId";
|
|
14917
|
+
/** Adds one server to the repository's `.mcp.json` or to the person's own config. */
|
|
14918
|
+
const MCP_SERVERS_API_PATH = "/servers";
|
|
14919
|
+
/** Lists the servers in the person's own config. */
|
|
14920
|
+
const MCP_HOST_SERVERS_API_PATH = "/servers/host";
|
|
14921
|
+
/** Reads and saves Po-wide MCP preferences. */
|
|
14922
|
+
const MCP_SETTINGS_API_PATH = "/settings";
|
|
14923
|
+
/** The scope as the wire carries it. */
|
|
14924
|
+
function mcpScopeToWire(scope) {
|
|
14925
|
+
return scope;
|
|
14926
|
+
}
|
|
14927
|
+
//#endregion
|
|
14928
|
+
//#region ../../default/po-mcp/src/types/apiRoutes.ts
|
|
14929
|
+
/** One authorization flow, addressed by id below the flow collection. */
|
|
14930
|
+
const AUTHORIZATION_FLOW_PATH = `${MCP_AUTHORIZATION_API_PATH}/:${MCP_FLOW_ID_PARAM}`;
|
|
14931
|
+
/**
|
|
14932
|
+
* This package's routes, as data.
|
|
14933
|
+
*
|
|
14934
|
+
* No scope and no base path. The build reads both off
|
|
14935
|
+
* `src/extensions/(backend)/api/mcp/`, so the mount is stated once, by the
|
|
14936
|
+
* folder that creates it. The sub-paths come from `webMcp`, which already owned
|
|
14937
|
+
* them, so this table names where a route sits and nothing else.
|
|
14938
|
+
*
|
|
14939
|
+
* This is the one file the hub handler and the settings panel both read, so a
|
|
14940
|
+
* path cannot move on one side alone. The handler matches on these strings
|
|
14941
|
+
* rather than parsing its own copies of them.
|
|
14942
|
+
*
|
|
14943
|
+
* `:flowId` is the client's parameter syntax; the handler reads the segment off
|
|
14944
|
+
* the same path, so the two cannot disagree about where the id sits.
|
|
14945
|
+
*/
|
|
14946
|
+
const routes = {
|
|
14947
|
+
catalog: {
|
|
14948
|
+
method: "GET",
|
|
14949
|
+
path: MCP_REPOSITORY_API_PATH,
|
|
14950
|
+
query: [MCP_REPOSITORY_ID_QUERY],
|
|
14951
|
+
response: void 0
|
|
14952
|
+
},
|
|
14953
|
+
discover: {
|
|
14954
|
+
method: "POST",
|
|
14955
|
+
path: MCP_DISCOVERY_API_PATH,
|
|
14956
|
+
response: void 0
|
|
14957
|
+
},
|
|
14958
|
+
authorize: {
|
|
14959
|
+
method: "POST",
|
|
14960
|
+
path: MCP_AUTHORIZATION_API_PATH,
|
|
14961
|
+
response: void 0
|
|
14962
|
+
},
|
|
14963
|
+
/** Stores one key a configured server asks for, bound to its destination. Owner-only; never echoed. */
|
|
14964
|
+
repositorySecret: {
|
|
14965
|
+
method: "POST",
|
|
14966
|
+
path: MCP_REPOSITORY_SECRETS_API_PATH,
|
|
14967
|
+
response: void 0
|
|
14968
|
+
},
|
|
14969
|
+
readAuthorization: {
|
|
14970
|
+
method: "GET",
|
|
14971
|
+
path: AUTHORIZATION_FLOW_PATH,
|
|
14972
|
+
query: [MCP_REPOSITORY_ID_QUERY],
|
|
14973
|
+
response: void 0
|
|
14974
|
+
},
|
|
14975
|
+
/** The same path as `readAuthorization`; the method is the whole of the difference. */
|
|
14976
|
+
cancelAuthorization: {
|
|
14977
|
+
method: "DELETE",
|
|
14978
|
+
path: AUTHORIZATION_FLOW_PATH,
|
|
14979
|
+
query: [MCP_REPOSITORY_ID_QUERY],
|
|
14980
|
+
response: void 0
|
|
14981
|
+
},
|
|
14982
|
+
/** Adds one server to the repository's `.mcp.json` or the person's own config, by the body's scope. */
|
|
14983
|
+
addServer: {
|
|
14984
|
+
method: "POST",
|
|
14985
|
+
path: MCP_SERVERS_API_PATH,
|
|
14986
|
+
response: void 0
|
|
14987
|
+
},
|
|
14988
|
+
editServer: {
|
|
14989
|
+
method: "PATCH",
|
|
14990
|
+
path: MCP_SERVERS_API_PATH,
|
|
14991
|
+
response: void 0
|
|
14992
|
+
},
|
|
14993
|
+
removeServer: {
|
|
14994
|
+
method: "DELETE",
|
|
14995
|
+
path: MCP_SERVERS_API_PATH,
|
|
14996
|
+
response: void 0
|
|
14997
|
+
},
|
|
14998
|
+
hostServers: {
|
|
14999
|
+
method: "GET",
|
|
15000
|
+
path: MCP_HOST_SERVERS_API_PATH,
|
|
15001
|
+
response: void 0
|
|
15002
|
+
},
|
|
15003
|
+
readSettings: {
|
|
15004
|
+
method: "GET",
|
|
15005
|
+
path: MCP_SETTINGS_API_PATH,
|
|
15006
|
+
response: void 0
|
|
15007
|
+
},
|
|
15008
|
+
/** The same path as `readSettings`; saves the body and answers with what was saved. */
|
|
15009
|
+
saveSettings: {
|
|
15010
|
+
method: "PUT",
|
|
15011
|
+
path: MCP_SETTINGS_API_PATH,
|
|
15012
|
+
response: void 0
|
|
15013
|
+
},
|
|
15014
|
+
/** Session scope: one available tool's registered name, description and schema. */
|
|
15015
|
+
sessionTool: {
|
|
15016
|
+
method: "GET",
|
|
15017
|
+
path: MCP_SESSION_TOOL_API_PATH,
|
|
15018
|
+
query: [MCP_SESSION_TOOL_SERVER_QUERY, MCP_SESSION_TOOL_NAME_QUERY],
|
|
15019
|
+
response: void 0
|
|
15020
|
+
},
|
|
15021
|
+
/** Session scope: stores a secret the session reported missing. Owner-only; the value is never echoed. */
|
|
15022
|
+
sessionSecret: {
|
|
15023
|
+
method: "POST",
|
|
15024
|
+
path: MCP_SESSION_SECRETS_API_PATH,
|
|
15025
|
+
response: void 0
|
|
15026
|
+
}
|
|
15027
|
+
};
|
|
15028
|
+
//#endregion
|
|
15029
|
+
//#region ../../default/po-mcp/src/services/mcpHubApi/http.ts
|
|
15030
|
+
/**
|
|
15031
|
+
* What the Node hub API and the edge host API share: JSON bodies and answers, the person's own config
|
|
15032
|
+
* paths, and the approval settings route. None of it touches a filesystem or a process, so both hosts run it.
|
|
15033
|
+
*/
|
|
15034
|
+
const JSON_HEADERS = { "content-type": "application/json" };
|
|
15035
|
+
const MAX_BODY_BYTES = 8192;
|
|
15036
|
+
const MAX_SERVER_NAME = 160;
|
|
15037
|
+
function json(body, status = 200) {
|
|
15038
|
+
return new Response(JSON.stringify(body), {
|
|
15039
|
+
status,
|
|
15040
|
+
headers: JSON_HEADERS
|
|
15041
|
+
});
|
|
15042
|
+
}
|
|
15043
|
+
function isRecord$1(value) {
|
|
15044
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
15045
|
+
}
|
|
15046
|
+
async function bodyOf(request) {
|
|
15047
|
+
const text = await request.text();
|
|
15048
|
+
if (text.length > MAX_BODY_BYTES) return void 0;
|
|
15049
|
+
try {
|
|
15050
|
+
const parsed = JSON.parse(text);
|
|
15051
|
+
return isRecord$1(parsed) ? parsed : void 0;
|
|
15052
|
+
} catch {
|
|
15053
|
+
return;
|
|
15054
|
+
}
|
|
15055
|
+
}
|
|
15056
|
+
/** Only host and repository are writable scopes. */
|
|
15057
|
+
function mcpScopeFromWire(value) {
|
|
15058
|
+
return value === "host" || value === "repository" ? value : void 0;
|
|
15059
|
+
}
|
|
15060
|
+
function serverNameOf(value) {
|
|
15061
|
+
return typeof value === "string" && value.length > 0 && value.length <= MAX_SERVER_NAME && !Array.from(value).some((character) => character.charCodeAt(0) <= 31) ? value : void 0;
|
|
15062
|
+
}
|
|
15063
|
+
/**
|
|
15064
|
+
* The person's own MCP files under Po's home: their servers and their Po-wide preferences. The hub API writes
|
|
15065
|
+
* them and the saved-state reader reads them, so both take the paths from here. Undefined when the host gave no home.
|
|
15066
|
+
*/
|
|
15067
|
+
function userMcpFilePaths(homeDirectory, environment = {}) {
|
|
15068
|
+
if (!homeDirectory) return void 0;
|
|
15069
|
+
const poHome = poHomeDirectory(homeDirectory, environment);
|
|
15070
|
+
return {
|
|
15071
|
+
config: join(poHome, PO_USER_MCP_CONFIG_FILE),
|
|
15072
|
+
settings: join(poHome, MCP_SETTINGS_FILE)
|
|
15073
|
+
};
|
|
15074
|
+
}
|
|
15075
|
+
/** `<po home>/mcp.json` for the person this hub runs as, or undefined when the host gave no home. */
|
|
15076
|
+
function userConfigPath(context) {
|
|
15077
|
+
return userMcpFilePaths(context.homeDirectory, context.environment)?.config;
|
|
15078
|
+
}
|
|
15079
|
+
function settingsPath(context) {
|
|
15080
|
+
return userMcpFilePaths(context.homeDirectory, context.environment)?.settings;
|
|
15081
|
+
}
|
|
15082
|
+
/** A missing vault, or a VaultError the store raised (matched by code, never by class). */
|
|
15083
|
+
function isVaultUnavailable(error) {
|
|
15084
|
+
if (typeof error === "object" && error !== null && "code" in error && error.code === "unavailable") return true;
|
|
15085
|
+
return error instanceof Error && error.message === "Po's vault is unavailable, so MCP sign-ins cannot be saved.";
|
|
15086
|
+
}
|
|
15087
|
+
/** Reads or saves the approval setting. A file that cannot be read or written is a 500, never an `off` answer. */
|
|
15088
|
+
async function handleSettings(settings, request, context) {
|
|
15089
|
+
const filePath = settingsPath(context);
|
|
15090
|
+
if (!filePath) return json({ error: "Po couldn't find your home directory on this hub." }, 503);
|
|
15091
|
+
try {
|
|
15092
|
+
if (request.method === routes.saveSettings.method) {
|
|
15093
|
+
const body = await bodyOf(request);
|
|
15094
|
+
if (!body || Object.keys(body).length !== 1 || typeof body.autoApproveDestructiveTools !== "boolean") return json({ error: "Send { \"autoApproveDestructiveTools\": true | false }." }, 400);
|
|
15095
|
+
await settings.setAutoApprove(filePath, body.autoApproveDestructiveTools);
|
|
15096
|
+
} else await settings.load(filePath);
|
|
15097
|
+
return json({ autoApproveDestructiveTools: settings.autoApprove() });
|
|
15098
|
+
} catch (error) {
|
|
15099
|
+
return json({ error: `Po couldn't use ${MCP_SETTINGS_FILE}: ${error instanceof Error ? error.message : String(error)}` }, 500);
|
|
15100
|
+
}
|
|
15101
|
+
}
|
|
15102
|
+
/** Every name a client may give the wrapper entry. */
|
|
15103
|
+
const PROXY_SERVER_ALIASES = /* @__PURE__ */ new Set(["mcp-proxy", "agiflow-proxy"]);
|
|
15104
|
+
/** Whether a server name is the proxy wrapper, which Po strips on load instead of connecting. */
|
|
15105
|
+
function isProxyWrapper(name) {
|
|
15106
|
+
return PROXY_SERVER_ALIASES.has(name);
|
|
15107
|
+
}
|
|
15108
|
+
//#endregion
|
|
15109
|
+
//#region ../../default/po-mcp/src/services/mcpServerConfig/index.ts
|
|
15110
|
+
const NAME = /^[A-Za-z0-9_-]{1,64}$/u;
|
|
15111
|
+
const HEADER_NAME = /^[A-Za-z0-9!#$%&'*+.^_`|~-]{1,128}$/u;
|
|
15112
|
+
const ENV_NAME = /^[A-Za-z_][A-Za-z0-9_]{0,127}$/u;
|
|
15113
|
+
const MAX_URL = 2048;
|
|
15114
|
+
const MAX_COMMAND = 1024;
|
|
15115
|
+
const MAX_VALUE = 4096;
|
|
15116
|
+
const MAX_ARGS = 64;
|
|
15117
|
+
const MAX_PAIRS = 64;
|
|
15118
|
+
function isRecord(value) {
|
|
15119
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
15120
|
+
}
|
|
15121
|
+
function refuse(error, status = 400) {
|
|
15122
|
+
return {
|
|
15123
|
+
ok: false,
|
|
15124
|
+
status,
|
|
15125
|
+
error
|
|
15126
|
+
};
|
|
15127
|
+
}
|
|
15128
|
+
function hasControl(value) {
|
|
15129
|
+
return Array.from(value).some((character) => character.charCodeAt(0) <= 31 || character.charCodeAt(0) === 127);
|
|
15130
|
+
}
|
|
15131
|
+
/** Header values and environment values may hold anything but a line break or NUL. */
|
|
15132
|
+
function isPlainValue(value) {
|
|
15133
|
+
return typeof value === "string" && value.length <= MAX_VALUE && !/[\r\n\0]/u.test(value);
|
|
15134
|
+
}
|
|
15135
|
+
function stringPairs(value, keyPattern) {
|
|
15136
|
+
if (value === void 0) return void 0;
|
|
15137
|
+
if (!isRecord(value)) return null;
|
|
15138
|
+
const entries = Object.entries(value);
|
|
15139
|
+
if (entries.length > MAX_PAIRS) return null;
|
|
15140
|
+
for (const [key, item] of entries) if (!keyPattern.test(key) || !isPlainValue(item)) return null;
|
|
15141
|
+
return entries.length > 0 ? Object.fromEntries(entries) : void 0;
|
|
15142
|
+
}
|
|
15143
|
+
function remoteEntry(value) {
|
|
15144
|
+
const url = value.url;
|
|
15145
|
+
if (typeof url !== "string" || url.length > MAX_URL) return refuse("Enter an http or https address.");
|
|
15146
|
+
let protocol;
|
|
15147
|
+
try {
|
|
15148
|
+
protocol = new URL(url).protocol;
|
|
15149
|
+
} catch {
|
|
15150
|
+
return refuse("Enter an http or https address.");
|
|
15151
|
+
}
|
|
15152
|
+
if (protocol !== "https:" && protocol !== "http:") return refuse("Enter an http or https address.");
|
|
15153
|
+
const headers = stringPairs(value.headers, HEADER_NAME);
|
|
15154
|
+
if (headers === null) return refuse("Each header needs a plain name and a one-line value.");
|
|
15155
|
+
return {
|
|
15156
|
+
ok: true,
|
|
15157
|
+
value: {
|
|
15158
|
+
type: "http",
|
|
15159
|
+
url,
|
|
15160
|
+
...headers ? { headers } : {}
|
|
15161
|
+
}
|
|
15162
|
+
};
|
|
15163
|
+
}
|
|
15164
|
+
function localEntry(value, trusted) {
|
|
15165
|
+
const command = typeof value.command === "string" ? value.command.trim() : "";
|
|
15166
|
+
if (command === "" || command.length > MAX_COMMAND || hasControl(command)) return refuse("Enter the command to run.");
|
|
15167
|
+
const args = value.args ?? [];
|
|
15168
|
+
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.");
|
|
15169
|
+
const env = stringPairs(value.env, ENV_NAME);
|
|
15170
|
+
if (env === null) return refuse("Each environment variable needs a NAME and a one-line value.");
|
|
15171
|
+
if (!trusted) return refuse("Confirm that you trust this command before adding it.");
|
|
15172
|
+
return {
|
|
15173
|
+
ok: true,
|
|
15174
|
+
value: {
|
|
15175
|
+
command,
|
|
15176
|
+
args,
|
|
15177
|
+
...env ? { env } : {}
|
|
15178
|
+
}
|
|
15179
|
+
};
|
|
15180
|
+
}
|
|
15181
|
+
/** Checks a server name and entry from the settings UI. Every field is untrusted input. */
|
|
15182
|
+
function parseMcpServerAddition(name, entry, trusted) {
|
|
15183
|
+
if (typeof name !== "string" || !NAME.test(name)) return refuse("Use letters, numbers, dashes or underscores.");
|
|
15184
|
+
if (isProxyWrapper(name)) return refuse(`${name} is reserved for Po's MCP proxy. Choose another name.`);
|
|
15185
|
+
if (!isRecord(entry)) return refuse("Enter a server URL or a command.");
|
|
15186
|
+
const parsed = "command" in entry ? localEntry(entry, trusted === true) : remoteEntry(entry);
|
|
15187
|
+
return parsed.ok ? {
|
|
15188
|
+
ok: true,
|
|
15189
|
+
value: {
|
|
15190
|
+
name,
|
|
15191
|
+
entry: parsed.value
|
|
15192
|
+
}
|
|
15193
|
+
} : parsed;
|
|
15194
|
+
}
|
|
15195
|
+
/**
|
|
15196
|
+
* The document with one server added, every other key kept as it was.
|
|
15197
|
+
* Refuses rather than replaces: a name that exists already stays as the person wrote it.
|
|
15198
|
+
*/
|
|
15199
|
+
function addMcpServer(document, addition, fileLabel) {
|
|
15200
|
+
const config = document === void 0 ? {} : document;
|
|
15201
|
+
if (!isRecord(config)) return refuse(`${fileLabel} isn't a JSON object, so Po left it alone.`, 409);
|
|
15202
|
+
const servers = config.mcpServers ?? {};
|
|
15203
|
+
if (!isRecord(servers)) return refuse(`mcpServers in ${fileLabel} isn't an object, so Po left it alone.`, 409);
|
|
15204
|
+
if (Object.hasOwn(servers, addition.name)) return refuse(`A server named ${addition.name} already exists in ${fileLabel}.`, 409);
|
|
15205
|
+
return {
|
|
15206
|
+
ok: true,
|
|
15207
|
+
value: {
|
|
15208
|
+
...config,
|
|
15209
|
+
mcpServers: {
|
|
15210
|
+
...servers,
|
|
15211
|
+
[addition.name]: addition.entry
|
|
15212
|
+
}
|
|
15213
|
+
}
|
|
15214
|
+
};
|
|
15215
|
+
}
|
|
15216
|
+
/** The servers a config document names, without their headers or environment. */
|
|
15217
|
+
function listMcpServers(document) {
|
|
15218
|
+
const servers = isRecord(document) && isRecord(document.mcpServers) ? document.mcpServers : {};
|
|
15219
|
+
return Object.entries(servers).filter(([name]) => !isProxyWrapper(name)).map(([name, definition]) => {
|
|
15220
|
+
const record = isRecord(definition) ? definition : {};
|
|
15221
|
+
return typeof record.command === "string" ? {
|
|
15222
|
+
name,
|
|
15223
|
+
kind: "local",
|
|
15224
|
+
target: record.command
|
|
15225
|
+
} : {
|
|
15226
|
+
name,
|
|
15227
|
+
kind: "remote",
|
|
15228
|
+
target: safeMcpTarget(record.url)
|
|
15229
|
+
};
|
|
15230
|
+
}).sort((left, right) => left.name.localeCompare(right.name));
|
|
15231
|
+
}
|
|
15232
|
+
/**
|
|
15233
|
+
* The servers a config document names, each with what the person may do to it. A definition that is not an
|
|
15234
|
+
* object is listed but read-only, and an edit that would move a remote server to a new URL is not offered.
|
|
15235
|
+
*/
|
|
15236
|
+
function listManagedMcpServers(document) {
|
|
15237
|
+
const servers = isRecord(document) && isRecord(document.mcpServers) ? document.mcpServers : {};
|
|
15238
|
+
return listMcpServers(document).map((server) => {
|
|
15239
|
+
const definition = servers[server.name];
|
|
15240
|
+
const writable = isRecord(definition);
|
|
15241
|
+
return {
|
|
15242
|
+
...server,
|
|
15243
|
+
management: {
|
|
15244
|
+
owner: writable ? "host" : "read-only",
|
|
15245
|
+
target: server.target,
|
|
15246
|
+
kind: server.kind,
|
|
15247
|
+
canEdit: writable && (server.kind === "local" || server.target === definition.url),
|
|
15248
|
+
canRemove: writable,
|
|
15249
|
+
...writable ? { revision: mcpServerRevision(definition) } : {}
|
|
15250
|
+
}
|
|
15251
|
+
};
|
|
15252
|
+
});
|
|
15253
|
+
}
|
|
15254
|
+
/** Opaque optimistic concurrency identity, including fields never returned to the browser. */
|
|
15255
|
+
function mcpServerRevision(entry) {
|
|
15256
|
+
return createHash("sha256").update(JSON.stringify(entry) ?? "undefined").digest("hex");
|
|
15257
|
+
}
|
|
15258
|
+
/** Changes only one existing entry. Credentials and unknown saved fields stay in place. */
|
|
15259
|
+
function mutateMcpServer(document, name, revision, addition, preserveArgs = false) {
|
|
15260
|
+
if (isProxyWrapper(name) || !isRecord(document) || !isRecord(document.mcpServers)) return refuse("That saved server is not writable. Refresh settings.", 409);
|
|
15261
|
+
const servers = document.mcpServers;
|
|
15262
|
+
if (!Object.hasOwn(servers, name) || !isRecord(servers[name]) || mcpServerRevision(servers[name]) !== revision) return refuse("That saved server changed. Refresh settings before trying again.", 409);
|
|
15263
|
+
const old = servers[name];
|
|
15264
|
+
const next = { ...servers };
|
|
15265
|
+
if (addition) {
|
|
15266
|
+
const entry = addition.entry;
|
|
15267
|
+
if (addition.name !== name) return refuse("A saved server name cannot be changed.");
|
|
15268
|
+
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);
|
|
15269
|
+
const pairs = "command" in entry ? "env" : "headers";
|
|
15270
|
+
const values = entry[pairs];
|
|
15271
|
+
next[name] = {
|
|
15272
|
+
...old,
|
|
15273
|
+
...entry,
|
|
15274
|
+
..."command" in entry && preserveArgs && Array.isArray(old.args) ? { args: old.args } : {},
|
|
15275
|
+
...isRecord(old[pairs]) || isRecord(values) ? { [pairs]: {
|
|
15276
|
+
...isRecord(old[pairs]) ? old[pairs] : {},
|
|
15277
|
+
...isRecord(values) ? values : {}
|
|
15278
|
+
} } : {}
|
|
15279
|
+
};
|
|
15280
|
+
} else delete next[name];
|
|
15281
|
+
return {
|
|
15282
|
+
ok: true,
|
|
15283
|
+
value: {
|
|
15284
|
+
...document,
|
|
15285
|
+
mcpServers: next
|
|
15286
|
+
}
|
|
15287
|
+
};
|
|
15288
|
+
}
|
|
15289
|
+
/** URLs can embed credentials. A read projection never returns userinfo, query or fragment. */
|
|
15290
|
+
function safeMcpTarget(value) {
|
|
15291
|
+
if (typeof value !== "string") return "";
|
|
15292
|
+
try {
|
|
15293
|
+
const url = new URL(value);
|
|
15294
|
+
if (url.username === "" && url.password === "" && url.search === "" && url.hash === "") return value;
|
|
15295
|
+
url.username = "";
|
|
15296
|
+
url.password = "";
|
|
15297
|
+
url.search = "";
|
|
15298
|
+
url.hash = "";
|
|
15299
|
+
return url.toString();
|
|
15300
|
+
} catch {
|
|
15301
|
+
return "";
|
|
15302
|
+
}
|
|
15303
|
+
}
|
|
15304
|
+
//#endregion
|
|
15305
|
+
export { CallToolResultSchema as $, PromptReferenceSchema as $n, TextContentSchema as $r, JSONRPCNotificationSchema as $t, isSecretValue as A, OAuthClientInformationSchema as An, ServerRequestSchema as Ar, EmbeddedResourceSchema as At, mcpToolApproval as B, PROTOCOL_VERSION_META_KEY as Bn, SubscriptionsAcknowledgedNotificationParamsSchema as Br, IconSchema as Bt, PO_MCP_REMOTE_SERVERS_CONTRACT as C, ModelHintSchema as Cn, SUBSCRIPTION_ID_META_KEY as Cr, ElicitRequestFormParamsSchema as Ct, connectRemoteMcpServers as D, NotificationsParamsSchema as Dn, SamplingMessageSchema as Dr, ElicitResultSchema as Dt, REMOTE_MCP_TIMEOUT_MS as E, NotificationSchema as En, SamplingMessageContentBlockSchema as Er, ElicitRequestURLParamsSchema as Et, isAppVisibleMcpTool as F, OAuthProtectedResourceMetadataSchema as Fn, SingleSelectEnumSchemaSchema as Fr, GetPromptResultSchema as Ft, BaseMetadataSchema as G, PrimitiveSchemaDefinitionSchema as Gn, SubscriptionsListenResultSchema as Gr, InitializeRequestParamsSchema as Gt, StreamableHTTPClientTransport as H, PaginatedRequestSchema as Hn, SubscriptionsListenRequestParamsSchema as Hr, IdJagTokenExchangeResponseSchema as Ht, isModelVisibleMcpTool as I, OAuthTokenRevocationRequestSchema as In, StringSchemaSchema as Ir, GetTaskPayloadRequestSchema as It, BooleanSchemaSchema as J, ProgressSchema as Jn, TaskMetadataSchema as Jr, InitializedNotificationSchema as Jt, BaseRequestParamsSchema as K, ProgressNotificationParamsSchema as Kn, TaskAugmentedRequestParamsSchema as Kr, InitializeRequestSchema as Kt, normalizeMcpAppMetadata as L, OAuthTokensSchema as Ln, SubscribeRequestParamsSchema as Lr, GetTaskPayloadResultSchema as Lt, writeSecrets as M, OAuthClientRegistrationErrorSchema as Mn, ServerTasksCapabilitySchema as Mr, EnumSchemaSchema as Mt, USER_MCP_SCOPE as N, OAuthErrorResponseSchema as Nn, SetLevelRequestParamsSchema as Nr, GetPromptRequestParamsSchema as Nt, isUnauthorized as O, NumberSchemaSchema as On, ServerCapabilitiesSchema as Or, ElicitationCompleteNotificationParamsSchema as Ot, modelInputSchema as P, OAuthMetadataSchema as Pn, SetLevelRequestSchema as Pr, GetPromptRequestSchema as Pt, CallToolRequestSchema as Q, PromptMessageSchema as Qn, TaskStatusSchema as Qr, JSONRPCMessageSchema as Qt, createMcpApprovalState as R, OpenIdProviderDiscoveryMetadataSchema as Rn, SubscribeRequestSchema as Rr, GetTaskRequestSchema as Rt, createMcpHostSettings as S, LoggingMessageNotificationSchema as Sn, SERVER_INFO_META_KEY as Sr, DiscoverResultSchema as St, REMOTE_MCP_MAX_BYTES as T, MultiSelectEnumSchemaSchema as Tn, SamplingContentSchema as Tr, ElicitRequestSchema as Tt, AnnotationsSchema as U, PaginatedResultSchema as Un, SubscriptionsListenRequestSchema as Ur, ImageContentSchema as Ut, Client as V, PaginatedRequestParamsSchema as Vn, SubscriptionsAcknowledgedNotificationSchema as Vr, IconsSchema as Vt, AudioContentSchema as W, PingRequestSchema as Wn, SubscriptionsListenResultMetaSchema as Wr, ImplementationSchema as Wt, CLIENT_INFO_META_KEY as X, PromptArgumentSchema as Xn, TaskStatusNotificationParamsSchema as Xr, JSONObjectSchema as Xt, CLIENT_CAPABILITIES_META_KEY as Y, ProgressTokenSchema as Yn, TaskSchema as Yr, JSONArraySchema as Yt, CallToolRequestParamsSchema as Z, PromptListChangedNotificationSchema as Zn, TaskStatusNotificationSchema as Zr, JSONRPCErrorResponseSchema as Zt, MCP_FLOW_ID_PARAM as _, ownZone as _i, ListTasksResultSchema as _n, ResultMetaObjectSchema as _r, CreateMessageResultWithToolsSchema as _t, parseMcpServerAddition as a, ToolExecutionSchema as ai, LOG_LEVEL_META_KEY as an, RequestIdSchema as ar, ClientNotificationSchema as at, SERVER_COMMAND_DESCRIPTION as b, LoggingLevelSchema as bn, RootSchema as br, DEFAULT_NEGOTIATED_PROTOCOL_VERSION as bt, handleSettings as c, ToolSchema as ci, ListPromptsRequestSchema as cn, ResourceContentsSchema as cr, ClientTasksCapabilitySchema as ct, json as d, UnsubscribeRequestSchema as di, ListResourceTemplatesResultSchema as dn, ResourceRequestParamsSchema as dr, CompleteRequestSchema as dt, TextResourceContentsSchema as ei, JSONRPCRequestSchema as en, PromptSchema as er, CancelTaskRequestSchema as et, mcpScopeFromWire as f, UntitledMultiSelectEnumSchemaSchema as fi, ListResourcesRequestSchema as fn, ResourceSchema as fr, CompleteResultSchema as ft, routes as g, outboundHostRefusal as gi, ListTasksRequestSchema as gn, ResourceUpdatedNotificationSchema as gr, CreateMessageResultSchema as gt, userMcpFilePaths as h, guardedFetch as hi, ListRootsResultSchema as hn, ResourceUpdatedNotificationParamsSchema as hr, CreateMessageRequestSchema as ht, mutateMcpServer as i, ToolChoiceSchema as ii, LATEST_PROTOCOL_VERSION as in, RelatedTaskMetadataSchema as ir, ClientCapabilitiesSchema as it, prepareSecretAddition as j, OAuthClientMetadataSchema as jn, ServerResultSchema as jr, EmptyResultSchema as jt, readPoMcpRemoteServers as k, OAuthClientInformationFullSchema as kn, ServerNotificationSchema as kr, ElicitationCompleteNotificationSchema as kt, isRecord$1 as l, ToolUseContentSchema as li, ListPromptsResultSchema as ln, ResourceLinkSchema as lr, CompatibilityCallToolResultSchema as lt, userConfigPath as m, OutboundRefusedError as mi, ListRootsRequestSchema as mn, ResourceTemplateSchema as mr, CreateMessageRequestParamsSchema as mt, listManagedMcpServers as n, TitledSingleSelectEnumSchemaSchema as ni, JSONRPCResultResponseSchema as nn, ReadResourceRequestSchema as nr, CancelledNotificationParamsSchema as nt, isProxyWrapper as o, ToolListChangedNotificationSchema as oi, LegacyTitledEnumSchemaSchema as on, RequestMetaSchema as or, ClientRequestSchema as ot, serverNameOf as p, UntitledSingleSelectEnumSchemaSchema as pi, ListResourcesResultSchema as pn, ResourceTemplateReferenceSchema as pr, ContentBlockSchema as pt, BlobResourceContentsSchema as q, ProgressNotificationSchema as qn, TaskCreationParamsSchema as qr, InitializeResultSchema as qt, mcpServerRevision as r, ToolAnnotationsSchema as ri, JSONValueSchema as rn, ReadResourceResultSchema as rr, CancelledNotificationSchema as rt, bodyOf as s, ToolResultContentSchema as si, ListChangedOptionsBaseSchema as sn, RequestSchema as sr, ClientResultSchema as st, addMcpServer as t, TitledMultiSelectEnumSchemaSchema as ti, JSONRPCResponseSchema as tn, ReadResourceRequestParamsSchema as tr, CancelTaskResultSchema as tt, isVaultUnavailable as u, UnsubscribeRequestParamsSchema as ui, ListResourceTemplatesRequestSchema as un, ResourceListChangedNotificationSchema as ur, CompleteRequestParamsSchema as ut, mcpScopeToWire as v, ListToolsRequestSchema as vn, ResultSchema as vr, CreateTaskResultSchema as vt, PO_MCP_REMOTE_SERVERS_SERVICE as w, ModelPreferencesSchema as wn, SUPPORTED_PROTOCOL_VERSIONS as wr, ElicitRequestParamsSchema as wt, VAULT_UNAVAILABLE as x, LoggingMessageNotificationParamsSchema as xn, RootsListChangedNotificationSchema as xr, DiscoverRequestSchema as xt, MCP_APP_CLIENT_CAPABILITIES as y, ListToolsResultSchema as yn, RoleSchema as yr, CursorSchema as yt, isDestructiveMcpTool as z, OpenIdProviderMetadataSchema as zn, SubscriptionFilterSchema as zr, GetTaskResultSchema as zt };
|