@agimon-ai/po-cloudflare 0.0.2-alpha.74 → 0.0.2-alpha.76
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{approval-DXPV7Vm5.js → approval-BlHIxC2J.js} +18 -5
- package/dist/{approvalPrompt-CBaxjb_g.js → approvalPrompt-w2k884MA.js} +25 -3
- package/dist/{approvalSession-C9bg7tPo.js → approvalSession-UtzXVEB4.js} +6 -4
- package/dist/assets/assets/{CodeEditorView-CfrVwzvL.js → CodeEditorView-CaFk98Ji.js} +2 -2
- package/dist/assets/assets/{abnfDiagram-WEYOIA3C-B80H4Cm4.js → abnfDiagram-WEYOIA3C-gzdpxFaJ.js} +2 -2
- package/dist/assets/assets/{architecture-WOLXFQ4H-Dr4hXaql.js → architecture-WOLXFQ4H-TugrtWoO.js} +1 -1
- package/dist/assets/assets/{architectureDiagram-ZHVYKT53-DWyt7oXu.js → architectureDiagram-ZHVYKT53-Xy_pnmaH.js} +2 -2
- package/dist/assets/assets/{blockDiagram-RJAE7QA3-OxNTLdmi.js → blockDiagram-RJAE7QA3-pH1-jWYL.js} +2 -2
- package/dist/assets/assets/{c4Diagram-XDPPPE54-B4YtcH0s.js → c4Diagram-XDPPPE54-CWmWk7y2.js} +2 -2
- package/dist/assets/assets/channel-CJxh7kPr.js +2 -0
- package/dist/assets/assets/{chunk-2E7WHVMD-CD6FFMOX.js → chunk-2E7WHVMD-C2O60zos.js} +2 -2
- package/dist/assets/assets/{chunk-4EMNKR2T-CEIoX5oo.js → chunk-4EMNKR2T-CEHzGYY0.js} +2 -2
- package/dist/assets/assets/{chunk-55XCU76K-CD3t0IJi.js → chunk-55XCU76K-CjyzuqJm.js} +2 -2
- package/dist/assets/assets/{chunk-7S6XSTFO-Cyt75UCF.js → chunk-7S6XSTFO-Db8_vjDs.js} +2 -2
- package/dist/assets/assets/{chunk-AQDTSKZB-DRtqYBj9.js → chunk-AQDTSKZB-92c_fipW.js} +2 -2
- package/dist/assets/assets/{chunk-DSNLSHJZ-C8Fx2F8s.js → chunk-DSNLSHJZ-DFGW_rzV.js} +2 -2
- package/dist/assets/assets/{chunk-HAGFOTED-wOLWRRnd.js → chunk-HAGFOTED-Cpx79XgA.js} +2 -2
- package/dist/assets/assets/{chunk-HNE4Q36P-CurJg4Hf.js → chunk-HNE4Q36P-cz6K5cWs.js} +2 -2
- package/dist/assets/assets/{chunk-NQOKRVIF-Dzcc5nOG.js → chunk-NQOKRVIF-Bhj8Cnrq.js} +2 -2
- package/dist/assets/assets/{chunk-UHW7PFBP-B_ULFf2h.js → chunk-UHW7PFBP-DugRZU3d.js} +2 -2
- package/dist/assets/assets/{chunk-VQ5W62QI-DH0VY4_p.js → chunk-VQ5W62QI-CFXU98Td.js} +2 -2
- package/dist/assets/assets/{chunk-WQQL4CDK-DNxfLyXM.js → chunk-WQQL4CDK-BDYjxxgH.js} +2 -2
- package/dist/assets/assets/chunk-XXDRQBXY-B7vCmBOn.js +2 -0
- package/dist/assets/assets/{chunk-YZO67HFG-COuMUh9U.js → chunk-YZO67HFG-Bw3Zv3ms.js} +2 -2
- package/dist/assets/assets/{chunk-ZAUX2LTX-BJrCnubF.js → chunk-ZAUX2LTX-reWd5PI6.js} +2 -2
- package/dist/assets/assets/{chunk-ZCHMQSOR-D1lFKPtk.js → chunk-ZCHMQSOR-RCmNKJ0K.js} +2 -2
- package/dist/assets/assets/{classDiagram-v2-4MYWR3UA-DfZIbyVL.js → classDiagram-v2-4MYWR3UA-DOBOI7kO.js} +2 -2
- package/dist/assets/assets/{cose-bilkent-JH36ORCC-CpGhv9_S.js → cose-bilkent-JH36ORCC-Dnga9ThU.js} +2 -2
- package/dist/assets/assets/{cynefin-EF2NZ3EQ-Cxdc6nQl.js → cynefin-EF2NZ3EQ-mbxppeTd.js} +1 -1
- package/dist/assets/assets/{cynefinDiagram-WF24UDRP-qoj0w3lp.js → cynefinDiagram-WF24UDRP-D5uSCW7P.js} +2 -2
- package/dist/assets/assets/{dagre-NK4GIZVX-DL6QbNDS.js → dagre-NK4GIZVX-D3Utujwv.js} +2 -2
- package/dist/assets/assets/{diagram-CBK3MWTC-CJB3jq1_.js → diagram-CBK3MWTC-Bg8QfzPb.js} +2 -2
- package/dist/assets/assets/{diagram-I5XIIV2D-4cPOxCxF.js → diagram-I5XIIV2D-NjETU96V.js} +2 -2
- package/dist/assets/assets/{diagram-ODIL2UCW-BG3-jAxE.js → diagram-ODIL2UCW-BRY10xxY.js} +2 -2
- package/dist/assets/assets/{diagram-PFBEJUXE-Bx8dFaXj.js → diagram-PFBEJUXE-CO5Nfc2a.js} +2 -2
- package/dist/assets/assets/{diagram-RJA3I4VV-CUUHND91.js → diagram-RJA3I4VV-jxuLnXXk.js} +2 -2
- package/dist/assets/assets/{diagram-TYUNFSNR-BDMoN-kr.js → diagram-TYUNFSNR-B-dUsynt.js} +2 -2
- package/dist/assets/assets/{dist-5AxNm-uy.js → dist-9C1WeAys.js} +2 -2
- package/dist/assets/assets/{dist-BjI0b36Z.js → dist-BMmgMuDM.js} +2 -2
- package/dist/assets/assets/{dist-9_Rmyj2I.js → dist-Bsp48Zck.js} +2 -2
- package/dist/assets/assets/{dist-BE3CLKv4.js → dist-C8son2cz.js} +2 -2
- package/dist/assets/assets/{dist-CjCWP21A.js → dist-CUuM0eUM.js} +2 -2
- package/dist/assets/assets/{dist-BfNCu-7x.js → dist-CXebcDwS.js} +2 -2
- package/dist/assets/assets/{dist-Ccxb9U1G.js → dist-DtWJqHVb.js} +2 -2
- package/dist/assets/assets/{dist-CM7b5P9a.js → dist-JCg255PN.js} +2 -2
- package/dist/assets/assets/{dist-DSTAktnR.js → dist-lOIB9DJk.js} +2 -2
- package/dist/assets/assets/{ebnfDiagram-V4P3TTPT-BivOMXZb.js → ebnfDiagram-V4P3TTPT-KNVNlIfc.js} +2 -2
- package/dist/assets/assets/{elk-QONTBCTQ-CrJ1Qpy_.js → elk-QONTBCTQ-DsX7hxD1.js} +2 -2
- package/dist/assets/assets/{erDiagram-KYQIGQAA-w9Bqp4sV.js → erDiagram-KYQIGQAA-pjQN44eX.js} +2 -2
- package/dist/assets/assets/{eventmodeling-K75KTNOO-CBjFM3kV.js → eventmodeling-K75KTNOO-BCKz9w4V.js} +1 -1
- package/dist/assets/assets/flowDiagram-IUGLLWBU-BU7xmb8h.js +1 -0
- package/dist/assets/assets/{ganttDiagram-R7GPNTJY-CsWtGaqD.js → ganttDiagram-R7GPNTJY-CeuiGYpW.js} +2 -2
- package/dist/assets/assets/{gitGraph-VSP46ZUC-DsBSV9_h.js → gitGraph-VSP46ZUC-BsN0Vwsr.js} +1 -1
- package/dist/assets/assets/{gitGraphDiagram-PDYL7XHY-D5GxuYHW.js → gitGraphDiagram-PDYL7XHY-ZIMBu3bo.js} +2 -2
- package/dist/assets/assets/{index-DWDYnZsq.js → index-fYkh5qQp.js} +86 -86
- package/dist/assets/assets/{info-OHQRW6UA-C7x5dSJu.js → info-OHQRW6UA-CJmrVYr6.js} +1 -1
- package/dist/assets/assets/{infoDiagram-MVDRKAX5-CwpI-uAa.js → infoDiagram-MVDRKAX5-BsAIEQmU.js} +2 -2
- package/dist/assets/assets/{ishikawaDiagram-HPEHV2GE-DAa7J5G6.js → ishikawaDiagram-HPEHV2GE-BX_86A9r.js} +2 -2
- package/dist/assets/assets/{journeyDiagram-BOSHW7O7-BmiZnxE_.js → journeyDiagram-BOSHW7O7-DVGI0WoP.js} +2 -2
- package/dist/assets/assets/{kanban-definition-FNSA4HC5-DUR_mA3L.js → kanban-definition-FNSA4HC5-4RLBwWbL.js} +2 -2
- package/dist/assets/assets/{line-DHY49wSg.js → line-BL8hbik-.js} +2 -2
- package/dist/assets/assets/{linear-pTo-a9xT.js → linear-BWVrkBYc.js} +2 -2
- package/dist/assets/assets/{mermaid-parser.core-DMg3hN3T.js → mermaid-parser.core-CMk5l3Wp.js} +4 -4
- package/dist/assets/assets/{mermaid.core-DKtPCltA.js → mermaid.core-DZuf73R_.js} +5 -5
- package/dist/assets/assets/{mindmap-definition-6OY57UG3-DwTkFbnV.js → mindmap-definition-6OY57UG3-CPuk1tgo.js} +2 -2
- package/dist/assets/assets/{packet-JDAUHWVQ-Tu9TrQ1x.js → packet-JDAUHWVQ-pVue6YBL.js} +1 -1
- package/dist/assets/assets/{pegDiagram-ECIUJNBX-B7My4tsz.js → pegDiagram-ECIUJNBX-B8Ly6ehm.js} +2 -2
- package/dist/assets/assets/{pie-XZMESJXO-QPQm5Gdx.js → pie-XZMESJXO-DXAHc3bX.js} +1 -1
- package/dist/assets/assets/{pieDiagram-GNMPY74T-Bv-zAD_z.js → pieDiagram-GNMPY74T-9nVo6xZM.js} +2 -2
- package/dist/assets/assets/{quadrantDiagram-D57K4MC3-HTjoGQPd.js → quadrantDiagram-D57K4MC3-DbBqshQw.js} +2 -2
- package/dist/assets/assets/{radar-ABXABTNO-LDBlEoFo.js → radar-ABXABTNO-CKPxbvS6.js} +1 -1
- package/dist/assets/assets/{railroad-I3PHUGI6-Dy3_ymgZ.js → railroad-I3PHUGI6-CULlMjWr.js} +1 -1
- package/dist/assets/assets/{railroad-abnf-LNEFI6M7-QLVvYs6e.js → railroad-abnf-LNEFI6M7-BRjXoZsa.js} +1 -1
- package/dist/assets/assets/{railroad-ebnf-DWYD2UWJ-CFRlv9a8.js → railroad-ebnf-DWYD2UWJ-CD_uPeUF.js} +1 -1
- package/dist/assets/assets/{railroad-peg-JR7BVNR7-BOlq3d9c.js → railroad-peg-JR7BVNR7-Cv-b3SRa.js} +1 -1
- package/dist/assets/assets/{railroadDiagram-Y72NRBL7-Chg32HoU.js → railroadDiagram-Y72NRBL7-DJ77wAhA.js} +2 -2
- package/dist/assets/assets/{requirementDiagram-EQYSW5RA-VenIs_eg.js → requirementDiagram-EQYSW5RA-R7PFvkp-.js} +2 -2
- package/dist/assets/assets/{sankeyDiagram-SY24JHO5-BdByqMKF.js → sankeyDiagram-SY24JHO5-DR2gLc8z.js} +2 -2
- package/dist/assets/assets/{sequenceDiagram-BLEHNHQU-D3Do4GJE.js → sequenceDiagram-BLEHNHQU-TwEQL0yK.js} +2 -2
- package/dist/assets/assets/{src-DmfN-DA-.js → src-Cv8dmcJt.js} +2 -2
- package/dist/assets/assets/{stateDiagram-v2-A6IESKWZ-CZkRbPlf.js → stateDiagram-v2-A6IESKWZ-ShloXczl.js} +2 -2
- package/dist/assets/assets/{swimlanes-B3ENRKFQ-DRTdF9AF.js → swimlanes-B3ENRKFQ-D17E07lx.js} +2 -2
- package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-i6-zDqZm.js +9 -0
- package/dist/assets/assets/{timeline-definition-JXYKGLGB-BVcuws_M.js → timeline-definition-JXYKGLGB-BEvN2l_s.js} +2 -2
- package/dist/assets/assets/{treeView-D4JQ5SDB-BLtOJGqO.js → treeView-D4JQ5SDB-B0QcYOKz.js} +1 -1
- package/dist/assets/assets/{treemap-SAJKECNS-Dn3BWJ4v.js → treemap-SAJKECNS-CIGIJniE.js} +1 -1
- package/dist/assets/assets/{usecaseDiagram-WPOLBNNX-CBExIKDY.js → usecaseDiagram-WPOLBNNX-DbS-GLv8.js} +2 -2
- package/dist/assets/assets/{vennDiagram-Q3Y3IDCW-C6FIx2L4.js → vennDiagram-Q3Y3IDCW-CEkmUNoT.js} +2 -2
- package/dist/assets/assets/{wardley-7MLQ67FV-Cjj2xSBp.js → wardley-7MLQ67FV-D9b-h7oE.js} +1 -1
- package/dist/assets/assets/{wardleyDiagram-IVAIDKWA-sQPCBCFK.js → wardleyDiagram-IVAIDKWA-BoWIYn_M.js} +2 -2
- package/dist/assets/assets/{webpack-DDCA0aDL.js → webpack-rEg3nylj.js} +2 -2
- package/dist/assets/assets/{xychartDiagram-4URNHDU4-bZ4rifSw.js → xychartDiagram-4URNHDU4-xJdWE_nx.js} +2 -2
- package/dist/assets/bundle-asset-policy.json +1 -1
- package/dist/assets/index.html +1 -1
- package/dist/assets/plugins/chunks/po-web-runtime-CQ9hLtG-.js +1 -0
- package/dist/assets/plugins/compositions.json +1 -1
- package/dist/assets/plugins/slots/approval.09e72f36-B4Y8Wjzl.js +2 -0
- package/dist/assets/plugins/slots/artifacts.50b639bb-5Kf50LM1.js +1 -0
- package/dist/assets/plugins/slots/author.ea449ace-BUAjd0RY.js +93 -0
- package/dist/assets/plugins/slots/{autocompact.ec8f713f-CDZpN7I7.js → autocompact.6f428144-DUwf4L4s.js} +1 -1
- package/dist/assets/plugins/slots/{backdrop-bamboo.1a4d85e9-qbifuMc6.js → backdrop-bamboo.6e4c928d-CT9PXrny.js} +1 -1
- package/dist/assets/plugins/slots/browse.fa1f1a50-ClrBioNv.js +1 -0
- package/dist/assets/plugins/slots/builtin-tools.75108f21-DmtavYBT.js +7 -0
- package/dist/assets/plugins/slots/calendar.d8b70190-DmudDrcG.js +2 -0
- package/dist/assets/plugins/slots/codemode.c58fb583-BkVR1X2Y.js +11 -0
- package/dist/assets/plugins/slots/domain.753f9f92-Bv-dlY79.js +1 -0
- package/dist/assets/plugins/slots/edit.804fec90-mJXCIk4G.js +7 -0
- package/dist/assets/plugins/slots/files.66ffc636-CCRW8t1-.js +2 -0
- package/dist/assets/plugins/slots/goal.45dffa01-q_Zh5QxW.js +1 -0
- package/dist/assets/plugins/slots/grep.98262cff-CTDwtVaK.js +1 -0
- package/dist/assets/plugins/slots/help.5fbd20f7-BBw7NYJI.js +3 -0
- package/dist/assets/plugins/slots/{log.07fd59a4-BRPa3cVs.js → log.cb964209-BLY7IzD1.js} +4 -4
- package/dist/assets/plugins/slots/mcp.82cc1ff5-5yoTabz8.js +55 -0
- package/dist/assets/plugins/slots/plan.3852ba52-DmdaEVVw.js +3 -0
- package/dist/assets/plugins/slots/profile.ab16dcec-DOw3MhWl.js +1 -0
- package/dist/assets/plugins/slots/prompts.ae48c07a-DQVmTxFZ.js +38 -0
- package/dist/assets/plugins/slots/read.4560591a-Bun0fKn1.js +1 -0
- package/dist/assets/plugins/slots/runner.6e494d59-BDtBIqmQ.js +9 -0
- package/dist/assets/plugins/slots/scaffold.d87a6ee0-DZOiNwOS.js +1 -0
- package/dist/assets/plugins/slots/session-mcp.2be84084-DQpF2DkA.js +2 -0
- package/dist/assets/plugins/slots/sessions.6f47cb4c-y61JDvak.js +1 -0
- package/dist/assets/plugins/slots/skill.62a0a1b3-C-mkriRv.js +4 -0
- package/dist/assets/plugins/slots/{space.056e8bbc-fbLHc-DX.js → space.65a27e5a-Cr1HSI_z.js} +1 -1
- package/dist/assets/plugins/slots/subagents.8bb9992c-CrpR1Jhi.js +7 -0
- package/dist/assets/plugins/slots/template-advanced.59f3f98a-CSuMHJ9x.js +1 -0
- package/dist/assets/plugins/slots/template-desktop.0f0b8491-C2ZheI0_.js +7 -0
- package/dist/assets/plugins/slots/template-elegant.0e3b0acf-Cq5Y_6VL.js +1 -0
- package/dist/assets/plugins/slots/vault.3cbfcdc3-ZKO66wy8.js +1 -0
- package/dist/assets/plugins/slots/voice.a952113d-CsdoPA4G.js +1 -0
- package/dist/assets/plugins/slots/{web-search.f6292793-NVh9fdvE.js → web-search.65013836-C7W5RyLj.js} +1 -1
- package/dist/assets/plugins/slots/workflows.cbc5c5c0-BLNlHcfa.js +16 -0
- package/dist/assets/pwa/sw.js +5 -5
- package/dist/{calendarSetup-CI3AACVo.js → calendarSetup-Do-hM0Li.js} +1 -1
- package/dist/{exports-CBp_9dVk.js → exports-t_BpzyPr.js} +1 -1
- package/dist/{index.edge-kJrIbDzE.js → index.edge-BRaAhap2.js} +1 -1
- package/dist/{profileSources-D1rymC97.js → profileSources-DIlA86Qk.js} +1 -1
- package/dist/{server-BcPD_6a2.js → server-2xgrdxY_.js} +2 -2
- package/dist/{server-B51reaJ9.js → server-7-DnO2Ww.js} +5 -4
- package/dist/{server-DebdjWjz.js → server-B3U0W7zD.js} +1 -1
- package/dist/{server-B3jB3q_h.js → server-BJssIIpm.js} +1 -1
- package/dist/{server-NKqdiQ5G.js → server-BLcw1z6S.js} +1 -1
- package/dist/{server-Byk0FT6E.js → server-BPS6xFya.js} +1 -1
- package/dist/{server-DLDK_aeG.js → server-BSpJMYLb.js} +2 -2
- package/dist/{server-BsjwqF7J.js → server-BUBijhBb.js} +2 -2
- package/dist/{server-CUGzeCH4.js → server-BUgDdcRW.js} +1 -1
- package/dist/{server-EYARWKpG.js → server-BeAYfrzJ.js} +1 -1
- package/dist/{server-DEKg8AVN.js → server-BlbuM_IJ.js} +2 -2
- package/dist/{server-_vSe9bTM.js → server-BqvkcVLn.js} +1 -1
- package/dist/{server-Dosi6o2W.js → server-CKQwNrO8.js} +4 -4
- package/dist/{server-B20agHjD.js → server-CLRgSPVY.js} +1 -1
- package/dist/{server-DYKXGQVY.js → server-CMov-S5-.js} +1 -1
- package/dist/{server-BsEMLlTz.js → server-CaFzaibK.js} +1 -1
- package/dist/{server-wQHKuB2m.js → server-CcKKktvn.js} +1 -1
- package/dist/{server-dBNqYUdX.js → server-D6-_DT9g.js} +1 -1
- package/dist/{server-vZL2icDV.js → server-DAFM6HnJ.js} +2 -2
- package/dist/{server-DI6YhDI5.js → server-DMbdJzSQ.js} +2 -2
- package/dist/{server-C-HBjWRo.js → server-DNpneoqA.js} +1 -1
- package/dist/{server-hJ4tYEt4.js → server-DPG7BH6w.js} +5 -5
- package/dist/{server-CpbBJ9ZU.js → server-DeFqeFTs.js} +1 -1
- package/dist/{server-BD_tbxwG.js → server-Dl3sng3O.js} +2 -2
- package/dist/{server-CqDWkfdL.js → server-Dnvp2U6V.js} +3 -3
- package/dist/{server-CQmb0lYL.js → server-HIbQWBba.js} +36 -17
- package/dist/{server-CAipGCpQ.js → server-OzzJbeaS.js} +2 -2
- package/dist/{server-DmqO6gBs.js → server-fYfb0gN8.js} +16 -8
- package/dist/{sessionConfig-UMlgu98q.js → sessionConfig-BYow7MOB.js} +1 -1
- package/dist/{web-B2sdV-F2.js → web-CLiZJpHK.js} +1 -1
- package/dist/worker.js +208 -130
- package/package.json +49 -49
- package/dist/assets/assets/channel-bXj00dGj.js +0 -2
- package/dist/assets/assets/chunk-XXDRQBXY-B2bMWgN9.js +0 -2
- package/dist/assets/assets/flowDiagram-IUGLLWBU-C6Fnfgm0.js +0 -1
- package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-BYr_4JUb.js +0 -9
- package/dist/assets/plugins/chunks/po-web-runtime-D8FIos2q.js +0 -1
- package/dist/assets/plugins/slots/approval.3e4ea6e4-DxS_uibk.js +0 -2
- package/dist/assets/plugins/slots/artifacts.84980c32-Cp37TAkd.js +0 -1
- package/dist/assets/plugins/slots/author.8eca1a3d-Ds9Y-tjN.js +0 -93
- package/dist/assets/plugins/slots/browse.61a8907a-CVYvo1M5.js +0 -1
- package/dist/assets/plugins/slots/builtin-tools.16ef5e25-Cq1ljoL-.js +0 -7
- package/dist/assets/plugins/slots/calendar.d337fc49-BBjpOs1v.js +0 -2
- package/dist/assets/plugins/slots/codemode.5f359b9c-DOR6OR7R.js +0 -11
- package/dist/assets/plugins/slots/domain.832848c8-CJrXxig9.js +0 -1
- package/dist/assets/plugins/slots/edit.7c802139-BFF7_xN9.js +0 -7
- package/dist/assets/plugins/slots/files.364f16c9-CzOlZrRm.js +0 -2
- package/dist/assets/plugins/slots/goal.a97b169d-BtQBp3sw.js +0 -1
- package/dist/assets/plugins/slots/grep.d8bf9f57-9bUDfjyT.js +0 -1
- package/dist/assets/plugins/slots/help.5c78c071-B4-y6gYK.js +0 -3
- package/dist/assets/plugins/slots/mcp.ea8b6aa2-CFtzPkPC.js +0 -55
- package/dist/assets/plugins/slots/plan.7b30f8d8-CH59Ff49.js +0 -3
- package/dist/assets/plugins/slots/profile.63bc3ae6-0e9fWWyE.js +0 -1
- package/dist/assets/plugins/slots/prompts.9d9b47cc-BTqYnBX5.js +0 -38
- package/dist/assets/plugins/slots/read.926c024f-C7fMXDEH.js +0 -1
- package/dist/assets/plugins/slots/runner.5393fa6c-CqrpqhW9.js +0 -9
- package/dist/assets/plugins/slots/scaffold.686222eb-9qY5gkYW.js +0 -1
- package/dist/assets/plugins/slots/session-mcp.8eb68fc9-Cf0cqopp.js +0 -2
- package/dist/assets/plugins/slots/sessions.8e378a3b-B1_eqPJQ.js +0 -1
- package/dist/assets/plugins/slots/skill.56c1cc07-D-SKX8iw.js +0 -4
- package/dist/assets/plugins/slots/subagents.31fc045b-Cm_YMEnn.js +0 -7
- package/dist/assets/plugins/slots/template-advanced.9e8350fe-L0WOM4JT.js +0 -1
- package/dist/assets/plugins/slots/template-desktop.69a46f62-By9BZlaL.js +0 -7
- package/dist/assets/plugins/slots/template-elegant.381f6acb-El05x7HK.js +0 -1
- package/dist/assets/plugins/slots/vault.587549ba-DpU_65Wy.js +0 -1
- package/dist/assets/plugins/slots/voice.9c687181-CvcuL__m.js +0 -1
- package/dist/assets/plugins/slots/workflows.8a13baad-OLKSY9PE.js +0 -16
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import{$n as e,$r as t,At as n,Bi as r,Br as i,Bt as a,Di as o,Ft as s,Ga as c,Gi as l,Ha as u,Hr as d,Ht as f,Ia as p,Ir as m,It as h,Jr as g,Ki as _,Kt as v,La as y,Li as b,Lt as x,Mi as S,Na as C,Pt as w,Qa as ee,Ri as te,Rt as T,Sa as ne,Si as re,Ur as E,Ut as D,Wa as ie,Wi as ae,Xi as oe,Xn as se,Yi as ce,Zi as le,Zn as ue,_i as de,_n as fe,_r as pe,an as O,ar as me,ea as he,fr as ge,gn as _e,gr as ve,hn as ye,hr as be,ia as xe,ka as Se,kt as Ce,la as we,mn as Te,mr as Ee,na as De,nr as Oe,oa as ke,oi as Ae,or as je,pr as k,qi as Me,qt as A,ra as Ne,ri as Pe,rn as Fe,tn as Ie,tr as Le,ur as Re,vr as ze,yr as Be,zr as Ve}from"../chunks/po-web-runtime-D8FIos2q.js";import{A as He,C as j,D as Ue,E as We,O as Ge,S as M,T as Ke,_ as N,a as qe,b as Je,c as P,d as Ye,f as Xe,g as Ze,h as F,i as I,j as Qe,k as $e,l as L,m as R,n as et,o as z,p as tt,r as nt,s as rt,t as it,u as at,v as B,w as V,x as H,y as U}from"../chunks/schemas-DVQ8BvvP.js";var ot=/^(localhost|127(\.\d{1,3}){3}|\[::1\])$/u;function st(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function ct(e,t){if(e===void 0)return[];if(!Array.isArray(e)||e.length>64)throw Error(`Invalid widget CSP domains`);return e.map(e=>{if(typeof e!=`string`||e.length>2048)throw Error(`Invalid widget CSP domain`);let n=new URL(e),r=n.hostname.replace(/^%2a\./iu,`*.`),i=r.startsWith(`*.`),a=new URL(t),o=ot.test(n.hostname),s=o?ot.test(a.hostname)&&n.port===a.port:r===a.hostname||i&&a.hostname.endsWith(r.slice(1));if(!(o?[`http:`,`https:`,`ws:`,`wss:`]:[`https:`,`wss:`]).includes(n.protocol)||n.username||n.password||n.pathname!==`/`||n.search||n.hash||s||n.hostname.startsWith(`0.`)||/[\s;'"<>]/u.test(e))throw Error(`Unsafe widget CSP domain`);return`${n.protocol}//${r}${n.port?`:${n.port}`:``}`})}function lt(e,t){let n=st(e),r=st(n?.ui);if(n?.ui!==void 0&&r===void 0)throw Error(`Invalid widget UI metadata`);let i=r!==void 0&&`csp`in r,a=i?r.csp:n?.[`openai/widgetCSP`],o=a===void 0?{}:st(a);if(o===void 0)throw Error(`Invalid widget CSP`);let s=ct(o[i?`resourceDomains`:`resource_domains`],t).join(` `),c=ct(o[i?`connectDomains`:`connect_domains`],t).join(` `),l=ct(o[i?`frameDomains`:`frame_domains`],t).join(` `);return[`default-src 'none'`,`script-src 'unsafe-inline' ${s}`,`style-src 'unsafe-inline' ${s}`,`img-src data: blob: ${s}`,`font-src data: ${s}`,`media-src blob: ${s}`,`connect-src ${c||`'none'`}`,`frame-src ${l||`'none'`}`,`child-src ${l||`'none'`}`,`worker-src 'none'`,`object-src 'none'`,`base-uri 'none'`,`form-action 'none'`].join(`; `)}function ut(e){return e.replaceAll(`&`,`&`).replaceAll(`"`,`"`).replaceAll(`<`,`<`)}function dt(e){let t=e,n=t?.channel===`po.openai`?t.globals?.theme:t?.jsonrpc===`2.0`&&t.method===`ui/notifications/host-context-changed`?t.params?.theme:void 0;return n===`light`||n===`dark`?n:void 0}function ft(e,t){let n=document.documentElement,r=t,i=!1,a=()=>{!n.classList.contains(`light`)&&!n.classList.contains(`dark`)&&n.classList.add(r),n.getAttribute(`data-theme`)===null&&n.setAttribute(`data-theme`,r)},o=()=>{n.classList.remove(`light`,`dark`),n.classList.add(r);let e=n.getAttribute(`data-theme`);(e===null||e===`light`||e===`dark`)&&n.setAttribute(`data-theme`,r),n.style.colorScheme=r};window.addEventListener(`message`,t=>{let n=t.source===parent?e(t.data):void 0;n!==void 0&&(r=n,i=!0,document.readyState!==`loading`&&o())}),document.readyState===`loading`?document.addEventListener(`readystatechange`,()=>{document.readyState===`interactive`&&(i?o():a())}):a()}function pt(e){let t=!1,n=t=>{let n=e(t);n!==void 0&&(document.documentElement.style.colorScheme=n)};window.addEventListener(`message`,e=>{if(e.source!==parent||t||e.ports.length!==1)return;let r=e.data;if(typeof r?.html!=`string`||typeof r.policy!=`string`)return;t=!0;let i=e.ports[0],a=document.createElement(`iframe`);a.title=`MCP App content`,a.setAttribute(`sandbox`,`allow-scripts`),r.policy.includes(`frame-src 'none'`)&&a.setAttribute(`csp`,r.policy),a.setAttribute(`allow`,`camera 'none'; microphone 'none'; geolocation 'none'; clipboard-read 'none'; clipboard-write 'none'`),a.style.cssText=`width:100%;height:100%;border:0;display:block`;let o=!1,s=!1,c=()=>{s||(s=!0,a.remove(),i.postMessage({type:`revoked`}),i.close())};a.addEventListener(`load`,()=>{o&&c(),o=!0});let l=Date.now(),u=0;window.addEventListener(`message`,e=>{if(s||e.source!==a.contentWindow)return;try{let t=JSON.stringify(e.data);if(t===void 0||new TextEncoder().encode(t).byteLength>65536)return c();let n=Date.now();if(n-l>=1e3&&(l=n,u=0),++u>128)return c()}catch{return c()}let t=e.data?.channel===`po.openai`;r.protocol===`mcp`&&!t?parent.postMessage(e.data,`*`):i.postMessage({type:`legacy`,data:e.data})}),i.onmessage=e=>{s||(n(e.data),a.contentWindow?.postMessage(e.data,`*`))},window.addEventListener(`message`,e=>{if(!s&&e.source===parent&&r.protocol===`mcp`){let t=e.data;if(t?.jsonrpc!==`2.0`)return;n(t),a.contentWindow?.postMessage(t,`*`)}}),i.start(),a.srcdoc=r.html,document.body.append(a),i.postMessage({type:`ready`})})}function mt(e,t=`light`){return`<!doctype html><html style="color-scheme:${t}"><meta http-equiv="Content-Security-Policy" content="${ut(e.replace(/\b(frame|child)-src ([^;]*)/gu,(e,t,n)=>n===`'none'`?`${t}-src about:`:`${t}-src about: ${n}`))}"><style>html,body{margin:0;height:100%;overflow:hidden}</style><script>(${pt.toString()})(${dt.toString()})<\/script>`}function ht(e,t,n=``,r=`light`){let i=`<script>(${ft.toString()})(${dt.toString()}, ${JSON.stringify(r)})<\/script>`;return`<!doctype html><meta http-equiv="Content-Security-Policy" content="${ut(t)}"><meta name="color-scheme" content="${r}">${i}${n}${e}`}function gt(e){return`csp`in(`createElement`in e?e.createElement(`iframe`):e)}function _t(e){let t=`po.openai`,n=new Map,r=0,i=e,a=e=>{i={...i,...e},window.dispatchEvent(new CustomEvent(`openai:set_globals`,{detail:{globals:e}}))},o=(e,i)=>{if(n.size>=32)return Promise.reject(Error(`Too many pending widget requests`));let a=++r;return new Promise((r,o)=>{let s=window.setTimeout(()=>{n.delete(a),o(Error(`Widget request timed out`))},6e4);n.set(a,{resolve:r,reject:o,timer:s}),parent.postMessage({channel:t,id:a,method:e,input:i},`*`)})};Object.defineProperty(window,"openai",{value:Object.freeze({get toolInput(){return i.toolInput},get toolOutput(){return i.toolOutput},get toolResponseMetadata(){return i.toolResponseMetadata},get widgetState(){return i.widgetState},get theme(){return i.theme},get locale(){return i.locale},get displayMode(){return i.displayMode},get maxHeight(){return i.maxHeight},get safeArea(){return i.safeArea},get userAgent(){return i.userAgent},callTool:(e,t={})=>o(`callTool`,{name:e,arguments:t}),setWidgetState:e=>(a({widgetState:e}),o(`setState`,{state:e})),sendFollowUpMessage:e=>o(`followUp`,e),requestDisplayMode:()=>Promise.resolve({mode:`inline`}),openExternal:e=>o(`openLink`,{url:e.href}),requestClose:()=>o(`close`,{}),notifyIntrinsicHeight:e=>o(`height`,{height:e})}),configurable:!1,writable:!1}),window.addEventListener(`message`,e=>{if(e.source!==parent)return;let r=e.data;if(r?.channel!==t||(r.globals!==void 0&&a(r.globals),r.id===void 0))return;let i=n.get(r.id);i!==void 0&&(n.delete(r.id),clearTimeout(i.timer),typeof r.error==`string`?i.reject(Error(r.error)):i.resolve(r.result))}),parent.postMessage({channel:t,method:`initialized`,input:{}},`*`),document.addEventListener(`DOMContentLoaded`,()=>{a(i);let e=new ResizeObserver(()=>{let e=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight);parent.postMessage({channel:t,method:`height`,input:{height:e}},`*`)});e.observe(document.body),window.addEventListener(`pagehide`,()=>e.disconnect(),{once:!0})},{once:!0})}function vt(e){let t=JSON.stringify(e).replaceAll(`<`,`\\u003c`).replaceAll(`\u2028`,`\\u2028`).replaceAll(`\u2029`,`\\u2029`);return`<script>(${_t.toString()})(${t})<\/script>`}var yt=Object.defineProperty,bt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),xt=(e,t)=>{let n={};for(var r in e)yt(n,r,{get:e[r],enumerable:!0});return t&&yt(n,Symbol.toStringTag,{value:`Module`}),n},St=new Set([`https://json-schema.org/draft/2019-09/schema`,`http://json-schema.org/draft/2019-09/schema`]);function Ct(e){return typeof e==`string`&&St.has(e.replace(/#$/,``))}var wt={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`},Tt;Tt||={};function Et(e){return He(et,e)}function Dt(e){return $e(it,e)}function Ot(e){return Ge(nt,e)}var kt=[`2025-11-25`,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],At=`io.modelcontextprotocol/related-task`,jt=`io.modelcontextprotocol/protocolVersion`,Mt=`io.modelcontextprotocol/clientInfo`,Nt=`io.modelcontextprotocol/serverInfo`,Pt=`io.modelcontextprotocol/clientCapabilities`,Ft=`io.modelcontextprotocol/subscriptionId`,It=`io.modelcontextprotocol/logLevel`,W=tt(()=>j([M(),N(),L(),qe(),H(M(),W),P(W)])),G=H(M(),W),Lt=P(W),Rt=j([M(),N().int()]),zt=M(),Bt=B({ttl:N().optional()}),Vt=B({taskId:M()}),Ht=F({progressToken:Rt.optional(),[At]:Vt.optional()}),K=B({_meta:Ht.optional()}),Ut=K.extend({task:Bt.optional()}),q=B({method:M(),params:K.loose().optional()}),J=B({_meta:Ht.optional()}),Wt=B({method:M(),params:J.loose().optional()}),Gt=F({get[Nt](){return an.optional().catch(void 0)}}),Y=F({_meta:Gt.optional()}),Kt=j([M(),N().int()]),qt=B({jsonrpc:R(`2.0`),id:Kt,...q.shape}).strict(),Jt=B({jsonrpc:R(`2.0`),...Wt.shape}).strict(),Yt=B({jsonrpc:R(`2.0`),id:Kt,result:Y}).strict(),Xt=B({jsonrpc:R(`2.0`),id:Kt.optional(),error:B({code:N().int(),message:M(),data:V().optional()})}).strict(),Zt=j([qt,Jt,Yt,Xt]),Qt=j([Yt,Xt]),$t=Y.strict(),en=J.extend({requestId:Kt.optional(),reason:M().optional()}),tn=Wt.extend({method:R(`notifications/cancelled`),params:en}),nn=B({src:M(),mimeType:M().optional(),sizes:P(M()).optional(),theme:I([`light`,`dark`]).optional()}),rn=B({icons:P(nn).optional()}),X=B({name:M(),title:M().optional()}),an=X.extend({...X.shape,...rn.shape,version:M(),websiteUrl:M().optional(),description:M().optional()}),on=Xe(B({applyDefaults:L().optional()}),G),sn=Je(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Xe(B({form:on.optional(),url:G.optional()}),G.optional())),cn=F({list:G.optional(),cancel:G.optional(),requests:F({sampling:F({createMessage:G.optional()}).optional(),elicitation:F({create:G.optional()}).optional()}).optional()}),ln=F({list:G.optional(),cancel:G.optional(),requests:F({tools:F({call:G.optional()}).optional()}).optional()}),un=B({experimental:H(M(),G).optional(),sampling:B({context:G.optional(),tools:G.optional()}).optional(),elicitation:sn.optional(),roots:B({listChanged:L().optional()}).optional(),tasks:cn.optional(),extensions:H(M(),G).optional()}),dn=K.extend({protocolVersion:M(),capabilities:un,clientInfo:an}),fn=q.extend({method:R(`initialize`),params:dn}),pn=B({experimental:H(M(),G).optional(),logging:G.optional(),completions:G.optional(),prompts:B({listChanged:L().optional()}).optional(),resources:B({subscribe:L().optional(),listChanged:L().optional()}).optional(),tools:B({listChanged:L().optional()}).optional(),tasks:ln.optional(),extensions:H(M(),G).optional()}),mn=Y.extend({protocolVersion:M(),capabilities:pn,serverInfo:an,instructions:M().optional()}),hn=Wt.extend({method:R(`notifications/initialized`),params:J.optional()}),gn=q.extend({method:R(`server/discover`),params:K.optional()}),_n=Y.extend({supportedVersions:P(M()),capabilities:pn,instructions:M().optional()}),vn=q.extend({method:R(`ping`),params:K.optional()}),yn=B({progress:N(),total:U(N()),message:U(M())}),bn=B({...J.shape,...yn.shape,progressToken:Rt}),xn=Wt.extend({method:R(`notifications/progress`),params:bn}),Sn=K.extend({cursor:zt.optional()}),Cn=q.extend({params:Sn.optional()}),wn=Y.extend({nextCursor:zt.optional()}),Tn=B({uri:M(),mimeType:U(M()),_meta:H(M(),V()).optional()}),En=Tn.extend({text:M()}),Dn=M().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),On=Tn.extend({blob:Dn}),kn=I([`user`,`assistant`]),An=B({audience:P(kn).optional(),priority:N().min(0).max(1).optional(),lastModified:Et({offset:!0}).optional()}),jn=B({...X.shape,...rn.shape,uri:M(),description:U(M()),mimeType:U(M()),size:U(N()),annotations:An.optional(),_meta:U(F({}))}),Mn=B({...X.shape,...rn.shape,uriTemplate:M(),description:U(M()),mimeType:U(M()),annotations:An.optional(),_meta:U(F({}))}),Nn=Cn.extend({method:R(`resources/list`)}),Pn=wn.extend({resources:P(jn)}),Fn=Cn.extend({method:R(`resources/templates/list`)}),In=wn.extend({resourceTemplates:P(Mn)}),Ln=K.extend({uri:M()}),Rn=Ln,zn=q.extend({method:R(`resources/read`),params:Rn}),Bn=Y.extend({contents:P(j([En,On]))}),Vn=Wt.extend({method:R(`notifications/resources/list_changed`),params:J.optional()}),Hn=Ln,Un=q.extend({method:R(`resources/subscribe`),params:Hn}),Wn=Ln,Gn=q.extend({method:R(`resources/unsubscribe`),params:Wn}),Kn=B({toolsListChanged:L().optional(),promptsListChanged:L().optional(),resourcesListChanged:L().optional(),resourceSubscriptions:P(M()).optional()}),qn=K.extend({notifications:Kn}),Jn=q.extend({method:R(`subscriptions/listen`),params:qn}),Yn=J.extend({notifications:Kn}),Xn=Wt.extend({method:R(`notifications/subscriptions/acknowledged`),params:Yn}),Zn=Gt.extend({[Ft]:Kt}),Qn=Y.extend({_meta:Zn}),$n=J.extend({uri:M()}),er=Wt.extend({method:R(`notifications/resources/updated`),params:$n}),tr=B({name:M(),description:U(M()),required:U(L())}),nr=B({...X.shape,...rn.shape,description:U(M()),arguments:U(P(tr)),_meta:U(F({}))}),rr=Cn.extend({method:R(`prompts/list`)}),ir=wn.extend({prompts:P(nr)}),ar=K.extend({name:M(),arguments:H(M(),M()).optional()}),or=q.extend({method:R(`prompts/get`),params:ar}),sr=B({type:R(`text`),text:M(),annotations:An.optional(),_meta:H(M(),V()).optional()}),cr=B({type:R(`image`),data:Dn,mimeType:M(),annotations:An.optional(),_meta:H(M(),V()).optional()}),lr=B({type:R(`audio`),data:Dn,mimeType:M(),annotations:An.optional(),_meta:H(M(),V()).optional()}),ur=B({type:R(`tool_use`),name:M(),id:M(),input:H(M(),V()),_meta:H(M(),V()).optional()}),dr=B({type:R(`resource`),resource:j([En,On]),annotations:An.optional(),_meta:H(M(),V()).optional()}),fr=jn.extend({type:R(`resource_link`)}),pr=j([sr,cr,lr,fr,dr]),mr=B({role:kn,content:pr}),hr=Y.extend({description:M().optional(),messages:P(mr)}),gr=Wt.extend({method:R(`notifications/prompts/list_changed`),params:J.optional()}),_r=B({title:M().optional(),readOnlyHint:L().optional(),destructiveHint:L().optional(),idempotentHint:L().optional(),openWorldHint:L().optional()}),vr=B({taskSupport:I([`required`,`optional`,`forbidden`]).optional()}),yr=B({...X.shape,...rn.shape,description:M().optional(),inputSchema:B({type:R(`object`),properties:H(M(),W).optional(),required:P(M()).optional()}).catchall(V()),outputSchema:F({$schema:M().optional()}).optional(),annotations:_r.optional(),execution:vr.optional(),_meta:H(M(),V()).optional()}),br=Cn.extend({method:R(`tools/list`)}),xr=wn.extend({tools:P(yr)}),Sr=Y.extend({content:P(pr).default([]),structuredContent:V().optional(),isError:L().optional()}),Cr=Sr.or(Y.extend({toolResult:V()})),wr=Ut.extend({name:M(),arguments:H(M(),V()).optional()}),Tr=q.extend({method:R(`tools/call`),params:wr}),Er=Wt.extend({method:R(`notifications/tools/list_changed`),params:J.optional()}),Dr=B({autoRefresh:L().default(!0),debounceMs:N().int().nonnegative().default(300)}),Or=I([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),kr=K.extend({level:Or}),Ar=q.extend({method:R(`logging/setLevel`),params:kr}),jr=J.extend({level:Or,logger:M().optional(),data:V()}),Mr=Wt.extend({method:R(`notifications/message`),params:jr}),Nr=B({name:M().optional()}),Pr=B({hints:P(Nr).optional(),costPriority:N().min(0).max(1).optional(),speedPriority:N().min(0).max(1).optional(),intelligencePriority:N().min(0).max(1).optional()}),Fr=B({mode:I([`auto`,`required`,`none`]).optional()}),Ir=B({type:R(`tool_result`),toolUseId:M().describe(`The unique identifier for the corresponding tool call.`),content:P(pr),structuredContent:V().optional(),isError:L().optional(),_meta:H(M(),V()).optional()}),Lr=at(`type`,[sr,cr,lr]),Rr=at(`type`,[sr,cr,lr,ur,Ir]),zr=B({role:kn,content:j([Rr,P(Rr)]),_meta:H(M(),V()).optional()}),Br=Ut.extend({messages:P(zr),modelPreferences:Pr.optional(),systemPrompt:M().optional(),includeContext:I([`none`,`thisServer`,`allServers`]).optional(),temperature:N().optional(),maxTokens:N().int(),stopSequences:P(M()).optional(),metadata:G.optional(),tools:P(yr).optional(),toolChoice:Fr.optional()}),Vr=q.extend({method:R(`sampling/createMessage`),params:Br}),Hr=Y.extend({model:M(),stopReason:U(I([`endTurn`,`stopSequence`,`maxTokens`]).or(M())),role:kn,content:Lr}),Ur=Y.extend({model:M(),stopReason:U(I([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(M())),role:kn,content:j([Rr,P(Rr)])}),Wr=B({type:R(`boolean`),title:M().optional(),description:M().optional(),default:L().optional()}),Gr=B({type:R(`string`),title:M().optional(),description:M().optional(),minLength:N().optional(),maxLength:N().optional(),format:I([`email`,`uri`,`date`,`date-time`]).optional(),default:M().optional()}),Kr=B({type:I([`number`,`integer`]),title:M().optional(),description:M().optional(),minimum:N().optional(),maximum:N().optional(),default:N().optional()}),qr=B({type:R(`string`),title:M().optional(),description:M().optional(),enum:P(M()),default:M().optional()}),Jr=B({type:R(`string`),title:M().optional(),description:M().optional(),oneOf:P(B({const:M(),title:M()})),default:M().optional()}),Yr=B({type:R(`string`),title:M().optional(),description:M().optional(),enum:P(M()),enumNames:P(M()).optional(),default:M().optional()}),Xr=j([qr,Jr]),Zr=B({type:R(`array`),title:M().optional(),description:M().optional(),minItems:N().optional(),maxItems:N().optional(),items:B({type:R(`string`),enum:P(M())}),default:P(M()).optional()}),Qr=B({type:R(`array`),title:M().optional(),description:M().optional(),minItems:N().optional(),maxItems:N().optional(),items:B({anyOf:P(B({const:M(),title:M()}))}),default:P(M()).optional()}),$r=j([Zr,Qr]),ei=j([Yr,Xr,$r]),ti=j([ei,Wr,Gr,Kr]),ni=Ut.extend({mode:R(`form`).optional(),message:M(),requestedSchema:B({type:R(`object`),properties:H(M(),ti),required:P(M()).optional()}).catchall(V())}),ri=Ut.extend({mode:R(`url`),message:M(),elicitationId:M(),url:M().url()}),ii=j([ni,ri]),ai=q.extend({method:R(`elicitation/create`),params:ii}),oi=J.extend({elicitationId:M()}),si=Wt.extend({method:R(`notifications/elicitation/complete`),params:oi}),ci=Y.extend({action:I([`accept`,`decline`,`cancel`]),content:Je(e=>e===null?void 0:e,H(M(),j([M(),N(),L(),P(M())])).optional())}),li=B({type:R(`ref/resource`),uri:M()}),ui=B({type:R(`ref/prompt`),name:M()}),di=K.extend({ref:j([ui,li]),argument:B({name:M(),value:M()}),context:B({arguments:H(M(),M()).optional()}).optional()}),fi=q.extend({method:R(`completion/complete`),params:di}),pi=Y.extend({completion:F({values:P(M()).max(100),total:U(N().int()),hasMore:U(L())})}),mi=B({uri:M().startsWith(`file://`),name:M().optional(),_meta:H(M(),V()).optional()}),hi=q.extend({method:R(`roots/list`),params:K.optional()}),gi=Y.extend({roots:P(mi)}),_i=Wt.extend({method:R(`notifications/roots/list_changed`),params:J.optional()}),vi=F({ttl:N().optional(),pollInterval:N().optional()}),yi=I([`working`,`input_required`,`completed`,`failed`,`cancelled`]),bi=B({taskId:M(),status:yi,ttl:j([N(),qe()]),createdAt:M(),lastUpdatedAt:M(),pollInterval:U(N()),statusMessage:U(M())}),xi=Y.extend({task:bi}),Si=J.merge(bi),Ci=Wt.extend({method:R(`notifications/tasks/status`),params:Si}),wi=q.extend({method:R(`tasks/get`),params:K.extend({taskId:M()})}),Ti=Y.merge(bi),Ei=q.extend({method:R(`tasks/result`),params:K.extend({taskId:M()})}),Di=Y.loose(),Oi=Cn.extend({method:R(`tasks/list`)}),ki=wn.extend({tasks:P(bi)}),Ai=q.extend({method:R(`tasks/cancel`),params:K.extend({taskId:M()})}),ji=Y.merge(bi),Mi=j([vn,fn,gn,fi,Ar,or,rr,Nn,Fn,zn,Un,Gn,Jn,Tr,br]),Ni=j([tn,xn,hn,_i]),Pi=j([$t,Hr,Ur,ci,gi]),Fi=j([vn,Vr,ai,hi]),Ii=j([tn,xn,Mr,er,Vn,Er,gr,Xn,si]),Li=j([$t,mn,_n,pi,hr,ir,Pn,In,Bn,Sr,xr,Qn]),Z=Ke().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:wt.custom,message:`URL must be parseable`,fatal:!0}),Qe}).refine(e=>{let t=new URL(e);return t.protocol!==`javascript:`&&t.protocol!==`data:`&&t.protocol!==`vbscript:`},{message:`URL cannot use javascript:, data:, or vbscript: scheme`}),Ri=F({resource:M().url(),authorization_servers:P(Z).optional(),jwks_uri:M().url().optional(),scopes_supported:P(M()).optional(),bearer_methods_supported:P(M()).optional(),resource_signing_alg_values_supported:P(M()).optional(),resource_name:M().optional(),resource_documentation:M().optional(),resource_policy_uri:M().url().optional(),resource_tos_uri:M().url().optional(),tls_client_certificate_bound_access_tokens:L().optional(),authorization_details_types_supported:P(M()).optional(),dpop_signing_alg_values_supported:P(M()).optional(),dpop_bound_access_tokens_required:L().optional()}),zi=F({issuer:M(),authorization_endpoint:Z,token_endpoint:Z,registration_endpoint:Z.optional(),scopes_supported:P(M()).optional(),response_types_supported:P(M()),response_modes_supported:P(M()).optional(),grant_types_supported:P(M()).optional(),token_endpoint_auth_methods_supported:P(M()).optional(),token_endpoint_auth_signing_alg_values_supported:P(M()).optional(),service_documentation:Z.optional(),revocation_endpoint:Z.optional(),revocation_endpoint_auth_methods_supported:P(M()).optional(),revocation_endpoint_auth_signing_alg_values_supported:P(M()).optional(),introspection_endpoint:M().optional(),introspection_endpoint_auth_methods_supported:P(M()).optional(),introspection_endpoint_auth_signing_alg_values_supported:P(M()).optional(),code_challenge_methods_supported:P(M()).optional(),client_id_metadata_document_supported:L().optional(),authorization_response_iss_parameter_supported:L().optional().catch(void 0),dpop_signing_alg_values_supported:P(M()).optional()}),Bi=F({issuer:M(),authorization_endpoint:Z,token_endpoint:Z,userinfo_endpoint:Z.optional(),jwks_uri:Z,registration_endpoint:Z.optional(),scopes_supported:P(M()).optional(),response_types_supported:P(M()),response_modes_supported:P(M()).optional(),grant_types_supported:P(M()).optional(),acr_values_supported:P(M()).optional(),subject_types_supported:P(M()),id_token_signing_alg_values_supported:P(M()),id_token_encryption_alg_values_supported:P(M()).optional(),id_token_encryption_enc_values_supported:P(M()).optional(),userinfo_signing_alg_values_supported:P(M()).optional(),userinfo_encryption_alg_values_supported:P(M()).optional(),userinfo_encryption_enc_values_supported:P(M()).optional(),request_object_signing_alg_values_supported:P(M()).optional(),request_object_encryption_alg_values_supported:P(M()).optional(),request_object_encryption_enc_values_supported:P(M()).optional(),token_endpoint_auth_methods_supported:P(M()).optional(),token_endpoint_auth_signing_alg_values_supported:P(M()).optional(),display_values_supported:P(M()).optional(),claim_types_supported:P(M()).optional(),claims_supported:P(M()).optional(),service_documentation:M().optional(),claims_locales_supported:P(M()).optional(),ui_locales_supported:P(M()).optional(),claims_parameter_supported:L().optional(),request_parameter_supported:L().optional(),request_uri_parameter_supported:L().optional(),require_request_uri_registration:L().optional(),op_policy_uri:Z.optional(),op_tos_uri:Z.optional(),client_id_metadata_document_supported:L().optional(),authorization_response_iss_parameter_supported:L().optional().catch(void 0)}),Vi=B({...Bi.shape,...zi.pick({code_challenge_methods_supported:!0}).shape}),Hi=B({access_token:M(),id_token:M().optional(),token_type:M(),expires_in:Ot().optional(),scope:M().optional(),refresh_token:M().optional(),issuer:M().optional().catch(void 0)}).strip(),Ui=B({issued_token_type:R(`urn:ietf:params:oauth:token-type:id-jag`),access_token:M(),token_type:M().optional(),expires_in:N().optional(),scope:M().optional()}).strip(),Wi=B({error:M(),error_description:M().optional(),error_uri:M().optional()}),Gi=Z.optional().or(R(``).transform(()=>void 0)),Ki=B({redirect_uris:P(Z),token_endpoint_auth_method:M().optional(),grant_types:P(M()).optional(),response_types:P(M()).optional(),application_type:M().optional(),client_name:M().optional(),client_uri:Z.optional(),logo_uri:Gi,scope:M().optional(),contacts:P(M()).optional(),tos_uri:Gi,policy_uri:M().optional(),jwks_uri:Z.optional(),jwks:rt().optional(),software_id:M().optional(),software_version:M().optional(),software_statement:M().optional()}).strip(),qi=B({client_id:M(),client_secret:M().optional(),client_id_issued_at:N().optional(),client_secret_expires_at:N().optional(),issuer:M().optional().catch(void 0)}).strip(),Ji=Ki.merge(qi),Yi=B({error:M(),error_description:M().optional()}).strip(),Xi=B({token:M(),token_type_hint:M().optional()}).strip(),Zi=Symbol.for(`mcp.sdk.errorBrands`);function Qi(e,t){let n=new Set,r=t;for(;typeof r==`function`;){let e=r.mcpBrand;Object.prototype.hasOwnProperty.call(r,`mcpBrand`)&&typeof e==`string`&&n.add(e),r=Object.getPrototypeOf(r)}n.size!==0&&Object.defineProperty(e,Zi,{value:n,enumerable:!1,configurable:!0})}function $i(e,t){try{if(typeof t==`object`&&t&&Object.prototype.hasOwnProperty.call(e,`mcpBrand`)&&typeof e.mcpBrand==`string`&&Object.prototype.hasOwnProperty.call(t,Zi)){let n=t[Zi];if(n&&typeof n.has==`function`&&n.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}(class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthError`})}static[Symbol.hasInstance](e){return $i(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return $i(this,e)}constructor(e,t,n){super(t),this.code=e,this.errorUri=n,this.name=`OAuthError`,Qi(this,new.target)}toResponseObject(){let e={error:this.code,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}});var ea=function(e){return e.NotConnected=`NOT_CONNECTED`,e.AlreadyConnected=`ALREADY_CONNECTED`,e.NotInitialized=`NOT_INITIALIZED`,e.CapabilityNotSupported=`CAPABILITY_NOT_SUPPORTED`,e.RequestTimeout=`REQUEST_TIMEOUT`,e.ConnectionClosed=`CONNECTION_CLOSED`,e.SendFailed=`SEND_FAILED`,e.InvalidResult=`INVALID_RESULT`,e.UnsupportedResultType=`UNSUPPORTED_RESULT_TYPE`,e.InputRequiredRoundsExceeded=`INPUT_REQUIRED_ROUNDS_EXCEEDED`,e.ListPaginationExceeded=`LIST_PAGINATION_EXCEEDED`,e.MethodNotSupportedByProtocolVersion=`METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION`,e.EraNegotiationFailed=`ERA_NEGOTIATION_FAILED`,e.ClientHttpNotImplemented=`CLIENT_HTTP_NOT_IMPLEMENTED`,e.ClientHttpAuthentication=`CLIENT_HTTP_AUTHENTICATION`,e.ClientHttpForbidden=`CLIENT_HTTP_FORBIDDEN`,e.ClientHttpUnexpectedContent=`CLIENT_HTTP_UNEXPECTED_CONTENT`,e.ClientHttpFailedToOpenStream=`CLIENT_HTTP_FAILED_TO_OPEN_STREAM`,e.ClientHttpFailedToTerminateSession=`CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION`,e}({}),Q=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkError`})}static[Symbol.hasInstance](e){return $i(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return $i(this,e)}constructor(e,t,n,r){super(t,r),this.code=e,this.data=n,this.name=`SdkError`,Qi(this,new.target)}};(class extends Q{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkHttpError`})}constructor(e,t,n,r){super(e,t,n,r),this.name=`SdkHttpError`}get status(){return this.data.status}get statusText(){return this.data.statusText}});var ta=`2026-07-28`;function na(e){return e>=ta}function ra(e){let t=e.structuredContent;return t===void 0||typeof t==`object`&&t&&!Array.isArray(t)||(e.content?.some(e=>e.type===`text`)??!1)?e:{...e,content:[...e.content??[],{type:`text`,text:JSON.stringify(t)}]}}var ia=[`task`,`inputRequests`,`requestState`];function aa(e){return typeof e!=`object`||!e||Array.isArray(e)||e.content!==void 0||ia.some(t=>t in e)?e:{...e,content:[]}}function oa(){let e=tt(()=>j([M(),N(),L(),qe(),H(M(),e),P(e)])),t=H(M(),e),n=j([M(),N().int()]),r=M(),i=B({ttl:N().optional()}),a=B({taskId:M()}),o=F({progressToken:n.optional(),"io.modelcontextprotocol/related-task":a.optional()}),s=B({_meta:o.optional()}),c=s.extend({task:i.optional()}),l=B({method:M(),params:s.loose().optional()}),u=B({_meta:o.optional()}),d=B({method:M(),params:u.loose().optional()}),f=F({_meta:o.optional()}),p=j([M(),N().int()]),m=f.strict(),h=u.extend({requestId:p.optional(),reason:M().optional()}),g=d.extend({method:R(`notifications/cancelled`),params:h}),_=B({src:M(),mimeType:M().optional(),sizes:P(M()).optional(),theme:I([`light`,`dark`]).optional()}),v=B({icons:P(_).optional()}),y=B({name:M(),title:M().optional()}),b=y.extend({...y.shape,...v.shape,version:M(),websiteUrl:M().optional(),description:M().optional()}),x=Xe(B({applyDefaults:L().optional()}),t),S=Je(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Xe(B({form:x.optional(),url:t.optional()}),t.optional())),C=F({list:t.optional(),cancel:t.optional(),requests:F({sampling:F({createMessage:t.optional()}).optional(),elicitation:F({create:t.optional()}).optional()}).optional()}),w=F({list:t.optional(),cancel:t.optional(),requests:F({tools:F({call:t.optional()}).optional()}).optional()}),ee=B({experimental:H(M(),t).optional(),sampling:B({context:t.optional(),tools:t.optional()}).optional(),elicitation:S.optional(),roots:B({listChanged:L().optional()}).optional(),tasks:C.optional(),extensions:H(M(),t).optional()}),te=s.extend({protocolVersion:M(),capabilities:ee,clientInfo:b}),T=l.extend({method:R(`initialize`),params:te}),ne=B({experimental:H(M(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:B({listChanged:L().optional()}).optional(),resources:B({subscribe:L().optional(),listChanged:L().optional()}).optional(),tools:B({listChanged:L().optional()}).optional(),tasks:w.optional(),extensions:H(M(),t).optional()}),re=f.extend({protocolVersion:M(),capabilities:ne,serverInfo:b,instructions:M().optional()}),E=d.extend({method:R(`notifications/initialized`),params:u.optional()}),D=l.extend({method:R(`ping`),params:s.optional()}),ie=B({progress:N(),total:U(N()),message:U(M())}),ae=B({...u.shape,...ie.shape,progressToken:n}),oe=d.extend({method:R(`notifications/progress`),params:ae}),se=s.extend({cursor:r.optional()}),ce=l.extend({params:se.optional()}),le=f.extend({nextCursor:r.optional()}),ue=B({uri:M(),mimeType:U(M()),_meta:H(M(),V()).optional()}),de=ue.extend({text:M()}),fe=M().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),pe=ue.extend({blob:fe}),O=I([`user`,`assistant`]),me=B({audience:P(O).optional(),priority:N().min(0).max(1).optional(),lastModified:Et({offset:!0}).optional()}),he=B({...y.shape,...v.shape,uri:M(),description:U(M()),mimeType:U(M()),size:U(N()),annotations:me.optional(),_meta:U(F({}))}),ge=B({...y.shape,...v.shape,uriTemplate:M(),description:U(M()),mimeType:U(M()),annotations:me.optional(),_meta:U(F({}))}),_e=ce.extend({method:R(`resources/list`)}),ve=le.extend({resources:P(he)}),ye=ce.extend({method:R(`resources/templates/list`)}),be=le.extend({resourceTemplates:P(ge)}),xe=s.extend({uri:M()}),Se=xe,Ce=l.extend({method:R(`resources/read`),params:Se}),we=f.extend({contents:P(j([de,pe]))}),Te=d.extend({method:R(`notifications/resources/list_changed`),params:u.optional()}),Ee=xe,De=l.extend({method:R(`resources/subscribe`),params:Ee}),Oe=xe,ke=l.extend({method:R(`resources/unsubscribe`),params:Oe}),Ae=u.extend({uri:M()}),je=d.extend({method:R(`notifications/resources/updated`),params:Ae}),k=B({name:M(),description:U(M()),required:U(L())}),Me=B({...y.shape,...v.shape,description:U(M()),arguments:U(P(k)),_meta:U(F({}))}),A=ce.extend({method:R(`prompts/list`)}),Ne=le.extend({prompts:P(Me)}),Pe=s.extend({name:M(),arguments:H(M(),M()).optional()}),Fe=l.extend({method:R(`prompts/get`),params:Pe}),Ie=B({type:R(`text`),text:M(),annotations:me.optional(),_meta:H(M(),V()).optional()}),Le=B({type:R(`image`),data:fe,mimeType:M(),annotations:me.optional(),_meta:H(M(),V()).optional()}),Re=B({type:R(`audio`),data:fe,mimeType:M(),annotations:me.optional(),_meta:H(M(),V()).optional()}),ze=B({type:R(`tool_use`),name:M(),id:M(),input:H(M(),V()),_meta:H(M(),V()).optional()}),Be=B({type:R(`resource`),resource:j([de,pe]),annotations:me.optional(),_meta:H(M(),V()).optional()}),Ve=he.extend({type:R(`resource_link`)}),He=j([Ie,Le,Re,Ve,Be]),Ue=B({role:O,content:He}),We=f.extend({description:M().optional(),messages:P(Ue)}),Ge=d.extend({method:R(`notifications/prompts/list_changed`),params:u.optional()}),Ke=B({title:M().optional(),readOnlyHint:L().optional(),destructiveHint:L().optional(),idempotentHint:L().optional(),openWorldHint:L().optional()}),Ye=B({taskSupport:I([`required`,`optional`,`forbidden`]).optional()}),Ze=B({...y.shape,...v.shape,description:M().optional(),inputSchema:B({type:R(`object`),properties:H(M(),e).optional(),required:P(M()).optional()}).catchall(V()),outputSchema:B({type:R(`object`),properties:H(M(),e).optional(),required:P(M()).optional()}).catchall(V()).optional(),annotations:Ke.optional(),execution:Ye.optional(),_meta:H(M(),V()).optional()}),Qe=ce.extend({method:R(`tools/list`)}),$e=le.extend({tools:P(Ze)}),et=f.extend({content:P(He),structuredContent:H(M(),V()).optional(),isError:L().optional()}),z=c.extend({name:M(),arguments:H(M(),V()).optional()}),nt=l.extend({method:R(`tools/call`),params:z}),rt=d.extend({method:R(`notifications/tools/list_changed`),params:u.optional()}),it=I([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),ot=s.extend({level:it}),st=l.extend({method:R(`logging/setLevel`),params:ot}),ct=u.extend({level:it,logger:M().optional(),data:V()}),lt=d.extend({method:R(`notifications/message`),params:ct}),ut=B({name:M().optional()}),dt=B({hints:P(ut).optional(),costPriority:N().min(0).max(1).optional(),speedPriority:N().min(0).max(1).optional(),intelligencePriority:N().min(0).max(1).optional()}),ft=B({mode:I([`auto`,`required`,`none`]).optional()}),pt=B({type:R(`tool_result`),toolUseId:M().describe(`The unique identifier for the corresponding tool call.`),content:P(He),structuredContent:B({}).loose().optional(),isError:L().optional(),_meta:H(M(),V()).optional()}),mt=at(`type`,[Ie,Le,Re]),ht=at(`type`,[Ie,Le,Re,ze,pt]),gt=B({role:O,content:j([ht,P(ht)]),_meta:H(M(),V()).optional()}),_t=c.extend({messages:P(gt),modelPreferences:dt.optional(),systemPrompt:M().optional(),includeContext:I([`none`,`thisServer`,`allServers`]).optional(),temperature:N().optional(),maxTokens:N().int(),stopSequences:P(M()).optional(),metadata:t.optional(),tools:P(Ze).optional(),toolChoice:ft.optional()}),vt=l.extend({method:R(`sampling/createMessage`),params:_t}),yt=f.extend({model:M(),stopReason:U(I([`endTurn`,`stopSequence`,`maxTokens`]).or(M())),role:O,content:mt}),bt=f.extend({model:M(),stopReason:U(I([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(M())),role:O,content:j([ht,P(ht)])}),xt=B({type:R(`boolean`),title:M().optional(),description:M().optional(),default:L().optional()}),St=B({type:R(`string`),title:M().optional(),description:M().optional(),minLength:N().optional(),maxLength:N().optional(),format:I([`email`,`uri`,`date`,`date-time`]).optional(),default:M().optional()}),Ct=B({type:I([`number`,`integer`]),title:M().optional(),description:M().optional(),minimum:N().optional(),maximum:N().optional(),default:N().optional()}),wt=B({type:R(`string`),title:M().optional(),description:M().optional(),enum:P(M()),default:M().optional()}),Tt=B({type:R(`string`),title:M().optional(),description:M().optional(),oneOf:P(B({const:M(),title:M()})),default:M().optional()}),Dt=B({type:R(`string`),title:M().optional(),description:M().optional(),enum:P(M()),enumNames:P(M()).optional(),default:M().optional()}),Ot=j([wt,Tt]),kt=B({type:R(`array`),title:M().optional(),description:M().optional(),minItems:N().optional(),maxItems:N().optional(),items:B({type:R(`string`),enum:P(M())}),default:P(M()).optional()}),At=B({type:R(`array`),title:M().optional(),description:M().optional(),minItems:N().optional(),maxItems:N().optional(),items:B({anyOf:P(B({const:M(),title:M()}))}),default:P(M()).optional()}),jt=j([kt,At]),Mt=j([Dt,Ot,jt]),Nt=j([Mt,xt,St,Ct]),Pt=c.extend({mode:R(`form`).optional(),message:M(),requestedSchema:B({type:R(`object`),properties:H(M(),Nt),required:P(M()).optional()}).catchall(V())}),Ft=c.extend({mode:R(`url`),message:M(),elicitationId:M(),url:M().url()}),It=j([Pt,Ft]),W=l.extend({method:R(`elicitation/create`),params:It}),G=u.extend({elicitationId:M()}),Lt=d.extend({method:R(`notifications/elicitation/complete`),params:G}),Rt=f.extend({action:I([`accept`,`decline`,`cancel`]),content:Je(e=>e===null?void 0:e,H(M(),j([M(),N(),L(),P(M())])).optional())}),zt=B({type:R(`ref/resource`),uri:M()}),Bt=B({type:R(`ref/prompt`),name:M()}),Vt=s.extend({ref:j([Bt,zt]),argument:B({name:M(),value:M()}),context:B({arguments:H(M(),M()).optional()}).optional()}),Ht=l.extend({method:R(`completion/complete`),params:Vt}),K=f.extend({completion:F({values:P(M()).max(100),total:U(N().int()),hasMore:U(L())})}),Ut=B({uri:M().startsWith(`file://`),name:M().optional(),_meta:H(M(),V()).optional()}),q=l.extend({method:R(`roots/list`),params:s.optional()}),J=f.extend({roots:P(Ut)}),Wt=d.extend({method:R(`notifications/roots/list_changed`),params:u.optional()}),Gt=F({ttl:N().optional(),pollInterval:N().optional()}),Y=I([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Kt=B({taskId:M(),status:Y,ttl:j([N(),qe()]),createdAt:M(),lastUpdatedAt:M(),pollInterval:U(N()),statusMessage:U(M())}),qt=f.extend({task:Kt}),Jt=u.merge(Kt),Yt=d.extend({method:R(`notifications/tasks/status`),params:Jt}),Xt=l.extend({method:R(`tasks/get`),params:s.extend({taskId:M()})}),Zt=f.merge(Kt),Qt=l.extend({method:R(`tasks/result`),params:s.extend({taskId:M()})}),$t=f.loose(),en=ce.extend({method:R(`tasks/list`)}),tn=le.extend({tasks:P(Kt)}),nn=l.extend({method:R(`tasks/cancel`),params:s.extend({taskId:M()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,TaskMetadataSchema:i,RelatedTaskMetadataSchema:a,RequestMetaSchema:o,BaseRequestParamsSchema:s,TaskAugmentedRequestParamsSchema:c,RequestSchema:l,NotificationsParamsSchema:u,NotificationSchema:d,ResultSchema:f,RequestIdSchema:p,EmptyResultSchema:m,CancelledNotificationParamsSchema:h,CancelledNotificationSchema:g,IconSchema:_,IconsSchema:v,BaseMetadataSchema:y,ImplementationSchema:b,ClientTasksCapabilitySchema:C,ServerTasksCapabilitySchema:w,ClientCapabilitiesSchema:ee,InitializeRequestParamsSchema:te,InitializeRequestSchema:T,ServerCapabilitiesSchema:ne,InitializeResultSchema:re,InitializedNotificationSchema:E,PingRequestSchema:D,ProgressSchema:ie,ProgressNotificationParamsSchema:ae,ProgressNotificationSchema:oe,PaginatedRequestParamsSchema:se,PaginatedRequestSchema:ce,PaginatedResultSchema:le,ResourceContentsSchema:ue,TextResourceContentsSchema:de,BlobResourceContentsSchema:pe,RoleSchema:O,AnnotationsSchema:me,ResourceSchema:he,ResourceTemplateSchema:ge,ListResourcesRequestSchema:_e,ListResourcesResultSchema:ve,ListResourceTemplatesRequestSchema:ye,ListResourceTemplatesResultSchema:be,ResourceRequestParamsSchema:xe,ReadResourceRequestParamsSchema:Se,ReadResourceRequestSchema:Ce,ReadResourceResultSchema:we,ResourceListChangedNotificationSchema:Te,SubscribeRequestParamsSchema:Ee,SubscribeRequestSchema:De,UnsubscribeRequestParamsSchema:Oe,UnsubscribeRequestSchema:ke,ResourceUpdatedNotificationParamsSchema:Ae,ResourceUpdatedNotificationSchema:je,PromptArgumentSchema:k,PromptSchema:Me,ListPromptsRequestSchema:A,ListPromptsResultSchema:Ne,GetPromptRequestParamsSchema:Pe,GetPromptRequestSchema:Fe,TextContentSchema:Ie,ImageContentSchema:Le,AudioContentSchema:Re,ToolUseContentSchema:ze,EmbeddedResourceSchema:Be,ResourceLinkSchema:Ve,ContentBlockSchema:He,PromptMessageSchema:Ue,GetPromptResultSchema:We,PromptListChangedNotificationSchema:Ge,ToolAnnotationsSchema:Ke,ToolExecutionSchema:Ye,ToolSchema:Ze,ListToolsRequestSchema:Qe,ListToolsResultSchema:$e,CallToolResultSchema:et,CallToolRequestParamsSchema:z,CallToolRequestSchema:nt,ToolListChangedNotificationSchema:rt,LoggingLevelSchema:it,SetLevelRequestParamsSchema:ot,SetLevelRequestSchema:st,LoggingMessageNotificationParamsSchema:ct,LoggingMessageNotificationSchema:lt,ModelHintSchema:ut,ModelPreferencesSchema:dt,ToolChoiceSchema:ft,ToolResultContentSchema:pt,SamplingContentSchema:mt,SamplingMessageContentBlockSchema:ht,SamplingMessageSchema:gt,CreateMessageRequestParamsSchema:_t,CreateMessageRequestSchema:vt,CreateMessageResultSchema:yt,CreateMessageResultWithToolsSchema:bt,BooleanSchemaSchema:xt,StringSchemaSchema:St,NumberSchemaSchema:Ct,UntitledSingleSelectEnumSchemaSchema:wt,TitledSingleSelectEnumSchemaSchema:Tt,LegacyTitledEnumSchemaSchema:Dt,SingleSelectEnumSchemaSchema:Ot,UntitledMultiSelectEnumSchemaSchema:kt,TitledMultiSelectEnumSchemaSchema:At,MultiSelectEnumSchemaSchema:jt,EnumSchemaSchema:Mt,PrimitiveSchemaDefinitionSchema:Nt,ElicitRequestFormParamsSchema:Pt,ElicitRequestURLParamsSchema:Ft,ElicitRequestParamsSchema:It,ElicitRequestSchema:W,ElicitationCompleteNotificationParamsSchema:G,ElicitationCompleteNotificationSchema:Lt,ElicitResultSchema:Rt,ResourceTemplateReferenceSchema:zt,PromptReferenceSchema:Bt,CompleteRequestParamsSchema:Vt,CompleteRequestSchema:Ht,CompleteResultSchema:K,RootSchema:Ut,ListRootsRequestSchema:q,ListRootsResultSchema:J,RootsListChangedNotificationSchema:Wt,TaskCreationParamsSchema:Gt,TaskStatusSchema:Y,TaskSchema:Kt,CreateTaskResultSchema:qt,TaskStatusNotificationParamsSchema:Jt,TaskStatusNotificationSchema:Yt,GetTaskRequestSchema:Xt,GetTaskResultSchema:Zt,GetTaskPayloadRequestSchema:Qt,GetTaskPayloadResultSchema:$t,ListTasksRequestSchema:en,ListTasksResultSchema:tn,CancelTaskRequestSchema:nn,CancelTaskResultSchema:f.merge(Kt),ClientRequestSchema:j([D,T,Ht,st,Fe,A,_e,ye,Ce,De,ke,nt,Qe,Xt,Qt,en,nn]),ClientNotificationSchema:j([g,oe,E,Wt,Yt]),ClientResultSchema:j([m,yt,bt,Rt,J,Zt,tn,qt]),ServerRequestSchema:j([D,vt,W,q,Xt,Qt,en,nn]),ServerNotificationSchema:j([g,oe,lt,je,Te,rt,Ge,Yt,Lt]),ServerResultSchema:j([m,re,K,We,Ne,ve,be,we,et,$e,Zt,tn,qt]),CallToolResultWireSchema:V().superRefine((e,t)=>{if(typeof e==`object`&&e&&!Array.isArray(e)&&e.content===void 0){for(let n of ia)if(n in e){t.addIssue({code:`custom`,message:`content is required when the body carries '${n}' — another result family cannot default into an empty tools/call success`});return}}}).transform(aa).pipe(et)}}var sa;function ca(){return sa??=oa()}function la(e){return e.type!==`object`}var ua=new Set([`const`,`enum`,`default`,`examples`]),da=new Set([`properties`,`patternProperties`,`$defs`,`definitions`,`dependentSchemas`,`dependencies`]);function fa(e){return e!==void 0&&!(typeof e==`string`&&e.startsWith(`#`))}function pa(e){let t=typeof e.$schema==`string`?e.$schema:void 0;if(fa(e.$id))return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:e},required:[`result`]};let n=Ct(e.$schema)&&e.$recursiveAnchor!==!0,r=(e,t)=>{if(Array.isArray(e))return e.map(e=>r(e,!1));if(typeof e!=`object`||!e||!t&&fa(e.$id))return e;let i={},a=!1;for(let[o,s]of Object.entries(e))t?i[o]=r(s,!1):(o===`$ref`||o===`$dynamicRef`)&&typeof s==`string`?i[o]=s===`#`?`#/properties/result`:s.startsWith(`#/`)?`#/properties/result${s.slice(1)}`:s:o===`$recursiveRef`&&s===`#`&&n?a=!0:i[o]=ua.has(o)?s:da.has(o)?r(s,!0):r(s,!1);return a&&(`$ref`in i?i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:`#/properties/result`}]:i.$ref=`#/properties/result`),i};return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:r(e,!1)},required:[`result`]}}var ma={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},ha={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},ga={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},_a;function va(){if(_a)return _a;let e=ca();return _a={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},_a}function ya(e){return Object.prototype.hasOwnProperty.call(ma,e)}function ba(e){return Object.prototype.hasOwnProperty.call(ha,e)}function xa(e){return Object.prototype.hasOwnProperty.call(ga,e)}function Sa(e){return xa(e)?va().resultSchemas[e]:void 0}function Ca(e){return ya(e)?va().requestSchemas[e]:void 0}function wa(e){return ba(e)?va().notificationSchemas[e]:void 0}Object.keys(ma),Object.keys(ha);function Ta(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ea(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var Da={ok:!1,reason:`not-in-era`};function Oa(e){return Ta(e)&&Ta(e.outputSchema)&&la(e.outputSchema)}function ka(e){return e}var Aa={era:`2025-11-25`,hasRequestMethod:ya,hasNotificationMethod:ba,validateRequest:(e,t)=>Ea(Ca(e),t),validateResult:(e,t)=>Ea(Sa(e),t),validateNotification:(e,t)=>Ea(wa(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Da,validateInputResponse:()=>Da,samplingResultVariant:((e,t)=>{let n=ca();return Ea(e?n.CreateMessageResultWithToolsSchema:n.CreateMessageResultSchema,t)}),outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let n=ra(e),r=n.structuredContent;if(r===void 0)return n;let i=typeof r!=`object`||!r||Array.isArray(r),a=t!==void 0&&la(t);return!i&&!a?n:{...n,structuredContent:{result:r}}},decodeResult(e,t){if(Ta(t)&&`resultType`in t){let e={...t};return delete e.resultType,{kind:`complete`,result:ka(e)}}return{kind:`complete`,result:ka(t)}},encodeResult(e,t){if(e!==`tools/list`)return t;let n=t.tools;return!Array.isArray(n)||!n.some(e=>Oa(e))?t:{...t,tools:n.map(e=>Oa(e)?{...e,outputSchema:pa(e.outputSchema)}:e)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>void 0};function ja(){let e=tt(()=>j([M(),N(),L(),qe(),H(M(),e),P(e)])),t=H(M(),e),n=j([M(),N().int()]),r=M(),i=j([M(),N().int()]),a=I([`user`,`assistant`]),o=I([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),s=M().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),c=B({ttl:N().optional()}),l=B({taskId:M()}),u=F({progressToken:n.optional(),"io.modelcontextprotocol/related-task":l.optional()}),d=B({_meta:u.optional()}),f=d.extend({task:c.optional()}),p=B({_meta:u.optional()}),m=B({method:M(),params:p.loose().optional()}),h=B({src:M(),mimeType:M().optional(),sizes:P(M()).optional(),theme:I([`light`,`dark`]).optional()}),g=B({icons:P(h).optional()}),_=B({name:M(),title:M().optional()}),v=_.extend({..._.shape,...g.shape,version:M(),websiteUrl:M().optional(),description:M().optional()}),y=Xe(B({applyDefaults:L().optional()}),t),b=Je(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Xe(B({form:y.optional(),url:t.optional()}),t.optional())),x=F({list:t.optional(),cancel:t.optional(),requests:F({sampling:F({createMessage:t.optional()}).optional(),elicitation:F({create:t.optional()}).optional()}).optional()}),S=F({list:t.optional(),cancel:t.optional(),requests:F({tools:F({call:t.optional()}).optional()}).optional()}),C=B({experimental:H(M(),t).optional(),sampling:B({context:t.optional(),tools:t.optional()}).optional(),elicitation:b.optional(),roots:B({listChanged:L().optional()}).optional(),tasks:x.optional(),extensions:H(M(),t).optional()}),w=B({experimental:H(M(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:B({listChanged:L().optional()}).optional(),resources:B({subscribe:L().optional(),listChanged:L().optional()}).optional(),tools:B({listChanged:L().optional()}).optional(),tasks:S.optional(),extensions:H(M(),t).optional()}),ee=B({progress:N(),total:U(N()),message:U(M())}),te=B({...p.shape,...ee.shape,progressToken:n}),T=m.extend({method:R(`notifications/progress`),params:te}),ne=p.extend({level:o,logger:M().optional(),data:V()}),re=m.extend({method:R(`notifications/message`),params:ne}),E=B({uri:M(),mimeType:U(M()),_meta:H(M(),V()).optional()}),D=E.extend({text:M()}),ie=E.extend({blob:s}),ae=B({audience:P(a).optional(),priority:N().min(0).max(1).optional(),lastModified:Et({offset:!0}).optional()}),oe=B({..._.shape,...g.shape,uri:M(),description:U(M()),mimeType:U(M()),size:U(N()),annotations:ae.optional(),_meta:U(F({}))}),se=B({..._.shape,...g.shape,uriTemplate:M(),description:U(M()),mimeType:U(M()),annotations:ae.optional(),_meta:U(F({}))}),ce=m.extend({method:R(`notifications/resources/list_changed`),params:p.optional()}),le=p.extend({uri:M()}),ue=m.extend({method:R(`notifications/resources/updated`),params:le}),de=B({name:M(),description:U(M()),required:U(L())}),fe=B({..._.shape,...g.shape,description:U(M()),arguments:U(P(de)),_meta:U(F({}))}),pe=m.extend({method:R(`notifications/prompts/list_changed`),params:p.optional()}),O=B({type:R(`text`),text:M(),annotations:ae.optional(),_meta:H(M(),V()).optional()}),me=B({type:R(`image`),data:s,mimeType:M(),annotations:ae.optional(),_meta:H(M(),V()).optional()}),he=B({type:R(`audio`),data:s,mimeType:M(),annotations:ae.optional(),_meta:H(M(),V()).optional()}),ge=B({type:R(`tool_use`),name:M(),id:M(),input:H(M(),V()),_meta:H(M(),V()).optional()}),_e=B({type:R(`resource`),resource:j([D,ie]),annotations:ae.optional(),_meta:H(M(),V()).optional()}),ve=oe.extend({type:R(`resource_link`)}),ye=j([O,me,he,ve,_e]),be=B({role:a,content:ye}),xe=B({title:M().optional(),readOnlyHint:L().optional(),destructiveHint:L().optional(),idempotentHint:L().optional(),openWorldHint:L().optional()}),Se=m.extend({method:R(`notifications/tools/list_changed`),params:p.optional()}),Ce=B({name:M().optional()}),we=B({hints:P(Ce).optional(),costPriority:N().min(0).max(1).optional(),speedPriority:N().min(0).max(1).optional(),intelligencePriority:N().min(0).max(1).optional()}),Te=B({mode:I([`auto`,`required`,`none`]).optional()}),Ee=B({type:R(`boolean`),title:M().optional(),description:M().optional(),default:L().optional()}),De=B({type:R(`string`),title:M().optional(),description:M().optional(),minLength:N().optional(),maxLength:N().optional(),format:I([`email`,`uri`,`date`,`date-time`]).optional(),default:M().optional()}),Oe=B({type:I([`number`,`integer`]),title:M().optional(),description:M().optional(),minimum:N().optional(),maximum:N().optional(),default:N().optional()}),ke=B({type:R(`string`),title:M().optional(),description:M().optional(),enum:P(M()),default:M().optional()}),Ae=B({type:R(`string`),title:M().optional(),description:M().optional(),oneOf:P(B({const:M(),title:M()})),default:M().optional()}),je=B({type:R(`string`),title:M().optional(),description:M().optional(),enum:P(M()),enumNames:P(M()).optional(),default:M().optional()}),k=j([ke,Ae]),Me=B({type:R(`array`),title:M().optional(),description:M().optional(),minItems:N().optional(),maxItems:N().optional(),items:B({type:R(`string`),enum:P(M())}),default:P(M()).optional()}),A=B({type:R(`array`),title:M().optional(),description:M().optional(),minItems:N().optional(),maxItems:N().optional(),items:B({anyOf:P(B({const:M(),title:M()}))}),default:P(M()).optional()}),Ne=j([Me,A]),Pe=j([je,k,Ne]),Fe=j([Pe,Ee,De,Oe]),Ie=f.extend({mode:R(`form`).optional(),message:M(),requestedSchema:B({type:R(`object`),properties:H(M(),Fe),required:P(M()).optional()}).catchall(V())}),Le=B({type:R(`ref/resource`),uri:M()}),Re=B({type:R(`ref/prompt`),name:M()}),ze=B({uri:M().startsWith(`file://`),name:M().optional(),_meta:H(M(),V()).optional()}),Be=C.shape,Ve=B({experimental:Be.experimental,sampling:Be.sampling,elicitation:Be.elicitation,roots:Be.roots,extensions:Be.extensions}),He=w.shape,Ue=B({experimental:He.experimental,logging:He.logging,completions:He.completions,prompts:He.prompts,resources:He.resources,tools:He.tools,extensions:He.extensions}),We=F({progressToken:n.optional(),[jt]:M(),[Mt]:v.optional(),[Pt]:Ve,[It]:o.optional()}),Ge=B({..._.shape,...g.shape,description:M().optional(),inputSchema:F({$schema:M().optional(),type:R(`object`)}),outputSchema:F({$schema:M().optional()}).optional(),annotations:xe.optional(),_meta:H(M(),V()).optional()}),Ke=B({type:R(`tool_result`),toolUseId:M(),content:P(ye),structuredContent:V().optional(),isError:L().optional(),_meta:H(M(),V()).optional()}),Ye=j([O,me,he,ge,Ke]),Ze=B({role:a,content:j([Ye,P(Ye)]),_meta:H(M(),V()).optional()}),Qe=M(),$e=F({[Nt]:v.optional().catch(void 0)}),et=$e.optional();function z(e){return F({_meta:et,resultType:Qe.default(`complete`),...e})}let nt=z({}),rt=z({nextCursor:r.optional()}),it=z({content:P(ye),structuredContent:V().optional(),isError:L().optional()}),at=z({ttlMs:N().int().min(0),cacheScope:I([`public`,`private`]),tools:P(Ge),nextCursor:r.optional()}),ot=z({ttlMs:N().int().min(0),cacheScope:I([`public`,`private`]),prompts:P(fe),nextCursor:r.optional()}),st=z({description:M().optional(),messages:P(be)}),ct=z({ttlMs:N().int().min(0),cacheScope:I([`public`,`private`]),resources:P(oe),nextCursor:r.optional()}),lt=z({ttlMs:N().int().min(0),cacheScope:I([`public`,`private`]),resourceTemplates:P(se),nextCursor:r.optional()}),ut=z({ttlMs:N().int().min(0),cacheScope:I([`public`,`private`]),contents:P(j([D,ie]))}),dt=z({completion:B({values:P(M()).max(100),total:N().int().optional(),hasMore:L().optional()}).loose()}),ft=z({ttlMs:N().int().min(0),cacheScope:I([`public`,`private`])}),pt=z({ttlMs:N().int().min(0).catch(0),cacheScope:I([`public`,`private`]).catch(`private`),supportedVersions:P(M()),capabilities:Ue,instructions:M().optional()}),mt=B({messages:P(Ze),modelPreferences:we.optional(),systemPrompt:M().optional(),includeContext:I([`none`,`thisServer`,`allServers`]).optional(),temperature:N().optional(),maxTokens:N().int(),stopSequences:P(M()).optional(),metadata:t.optional(),tools:P(Ge).optional(),toolChoice:Te.optional()}),ht=B({method:R(`sampling/createMessage`),params:mt}),gt=B({method:R(`roots/list`),params:B({_meta:H(M(),V()).optional()}).optional()}),_t=B({...Ze.shape,model:M(),stopReason:M().optional()}),vt=B({roots:P(ze)}),yt=B({action:I([`accept`,`decline`,`cancel`]),content:H(M(),j([M(),N(),L(),P(M())])).optional()}),bt=B({mode:R(`url`),message:M(),url:M().url()}),xt=j([Ie,bt]),St=B({method:R(`elicitation/create`),params:xt}),Ct=j([ht,gt,St]),wt=j([_t,vt,yt]),Tt=H(M(),Ct),Dt=H(M(),wt),Ot=z({inputRequests:Tt.optional(),requestState:M().optional()}),kt={inputResponses:Dt.optional(),requestState:M().optional()},At=B({_meta:We,...kt}),Ft=F({progressToken:n.optional()});function W(e,t){return B({method:R(e),params:B({_meta:We,...t})})}function G(e,t){return B({method:R(e),params:B({_meta:Ft.optional(),...t}).optional()})}let Lt={name:M(),arguments:H(M(),V()).optional(),...kt},Rt={cursor:r.optional()},zt=W(`tools/call`,Lt),Bt=W(`tools/list`,Rt),Vt=W(`prompts/list`,Rt),Ht=W(`prompts/get`,{name:M(),arguments:H(M(),M()).optional(),...kt}),K=W(`resources/list`,Rt),Ut=W(`resources/templates/list`,Rt),q=W(`resources/read`,{uri:M(),...kt}),J={ref:j([Re,Le]),argument:B({name:M(),value:M()}),context:B({arguments:H(M(),M()).optional()}).optional()},Wt=W(`completion/complete`,J),Gt=W(`server/discover`,{}),Y=B({toolsListChanged:L().optional(),promptsListChanged:L().optional(),resourcesListChanged:L().optional(),resourceSubscriptions:P(M()).optional()}),Kt={notifications:Y},qt=W(`subscriptions/listen`,Kt),Jt=$e.extend({"io.modelcontextprotocol/subscriptionId":i}),Yt=F({_meta:Jt,resultType:Qe.default(`complete`)}),Xt={"tools/call":G(`tools/call`,Lt),"tools/list":G(`tools/list`,Rt),"prompts/get":G(`prompts/get`,{name:M(),arguments:H(M(),M()).optional()}),"prompts/list":G(`prompts/list`,Rt),"resources/list":G(`resources/list`,Rt),"resources/templates/list":G(`resources/templates/list`,Rt),"resources/read":G(`resources/read`,{uri:M()}),"completion/complete":G(`completion/complete`,J),"server/discover":G(`server/discover`,{}),"subscriptions/listen":G(`subscriptions/listen`,Kt)};function Zt(e){return F({_meta:et,...e})}let Qt={"tools/call":Zt({content:P(ye),structuredContent:V().optional(),isError:L().optional()}),"tools/list":Zt({ttlMs:N().int().min(0),cacheScope:I([`public`,`private`]),tools:P(Ge),nextCursor:r.optional()}),"prompts/get":Zt({description:M().optional(),messages:P(be)}),"prompts/list":Zt({ttlMs:N().int().min(0),cacheScope:I([`public`,`private`]),prompts:P(fe),nextCursor:r.optional()}),"resources/list":Zt({ttlMs:N().int().min(0),cacheScope:I([`public`,`private`]),resources:P(oe),nextCursor:r.optional()}),"resources/templates/list":Zt({ttlMs:N().int().min(0),cacheScope:I([`public`,`private`]),resourceTemplates:P(se),nextCursor:r.optional()}),"resources/read":Zt({ttlMs:N().int().min(0),cacheScope:I([`public`,`private`]),contents:P(j([D,ie]))}),"completion/complete":Zt({completion:B({values:P(M()).max(100),total:N().int().optional(),hasMore:L().optional()}).loose()}),"server/discover":Zt({ttlMs:N().int().min(0).catch(0),cacheScope:I([`public`,`private`]).catch(`private`),supportedVersions:P(M()),capabilities:Ue,instructions:M().optional()}),"subscriptions/listen":Zt({})},$t=F({"io.modelcontextprotocol/subscriptionId":i.optional()}),en=B({method:R(`notifications/subscriptions/acknowledged`),params:B({_meta:$t.optional(),notifications:Y})}),tn=B({_meta:$t.optional(),requestId:i,reason:M().optional()}),nn=B({method:R(`notifications/cancelled`),params:tn}),rn={"notifications/cancelled":nn,"notifications/progress":T,"notifications/message":re,"notifications/resources/updated":ue,"notifications/resources/list_changed":ce,"notifications/tools/list_changed":Se,"notifications/prompts/list_changed":pe,"notifications/subscriptions/acknowledged":en},X=e=>B({jsonrpc:R(`2.0`),id:j([M(),N().int()]),result:e}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,RequestIdSchema:i,RoleSchema:a,LoggingLevelSchema:o,TaskMetadataSchema:c,RelatedTaskMetadataSchema:l,RequestMetaSchema:u,BaseRequestParamsSchema:d,TaskAugmentedRequestParamsSchema:f,NotificationsParamsSchema:p,NotificationSchema:m,IconSchema:h,IconsSchema:g,BaseMetadataSchema:_,ImplementationSchema:v,ClientTasksCapabilitySchema:x,ServerTasksCapabilitySchema:S,ClientCapabilitiesSchema:C,ServerCapabilitiesSchema:w,ProgressSchema:ee,ProgressNotificationParamsSchema:te,ProgressNotificationSchema:T,LoggingMessageNotificationParamsSchema:ne,LoggingMessageNotificationSchema:re,ResourceContentsSchema:E,TextResourceContentsSchema:D,BlobResourceContentsSchema:ie,AnnotationsSchema:ae,ResourceSchema:oe,ResourceTemplateSchema:se,ResourceListChangedNotificationSchema:ce,ResourceUpdatedNotificationParamsSchema:le,ResourceUpdatedNotificationSchema:ue,PromptArgumentSchema:de,PromptSchema:fe,PromptListChangedNotificationSchema:pe,TextContentSchema:O,ImageContentSchema:me,AudioContentSchema:he,ToolUseContentSchema:ge,EmbeddedResourceSchema:_e,ResourceLinkSchema:ve,ContentBlockSchema:ye,PromptMessageSchema:be,ToolAnnotationsSchema:xe,ToolListChangedNotificationSchema:Se,ModelHintSchema:Ce,ModelPreferencesSchema:we,ToolChoiceSchema:Te,BooleanSchemaSchema:Ee,StringSchemaSchema:De,NumberSchemaSchema:Oe,UntitledSingleSelectEnumSchemaSchema:ke,TitledSingleSelectEnumSchemaSchema:Ae,LegacyTitledEnumSchemaSchema:je,SingleSelectEnumSchemaSchema:k,UntitledMultiSelectEnumSchemaSchema:Me,TitledMultiSelectEnumSchemaSchema:A,MultiSelectEnumSchemaSchema:Ne,EnumSchemaSchema:Pe,PrimitiveSchemaDefinitionSchema:Fe,ElicitRequestFormParamsSchema:Ie,ResourceTemplateReferenceSchema:Le,PromptReferenceSchema:Re,RootSchema:ze,ClientCapabilities2026Schema:Ve,ServerCapabilities2026Schema:Ue,RequestMetaEnvelopeSchema:We,ToolSchema:Ge,ToolResultContentSchema:Ke,SamplingMessageContentBlockSchema:Ye,SamplingMessageSchema:Ze,ResultTypeSchema:Qe,ResultMetaSchema:$e,ResultSchema:nt,PaginatedResultSchema:rt,CallToolResultSchema:it,ListToolsResultSchema:at,ListPromptsResultSchema:ot,GetPromptResultSchema:st,ListResourcesResultSchema:ct,ListResourceTemplatesResultSchema:lt,ReadResourceResultSchema:ut,CompleteResultSchema:dt,CacheableResultSchema:ft,DiscoverResultSchema:pt,CreateMessageRequestParamsSchema:mt,CreateMessageRequestSchema:ht,ListRootsRequestSchema:gt,CreateMessageResultSchema:_t,ListRootsResultSchema:vt,ElicitResultSchema:yt,ElicitRequestURLParamsSchema:bt,ElicitRequestParamsSchema:xt,ElicitRequestSchema:St,InputRequestSchema:Ct,InputResponseSchema:wt,InputRequestsSchema:Tt,InputResponsesSchema:Dt,InputRequiredResultSchema:Ot,InputResponseRequestParamsSchema:At,CallToolRequestSchema:zt,ListToolsRequestSchema:Bt,ListPromptsRequestSchema:Vt,GetPromptRequestSchema:Ht,ListResourcesRequestSchema:K,ListResourceTemplatesRequestSchema:Ut,ReadResourceRequestSchema:q,CompleteRequestSchema:Wt,DiscoverRequestSchema:Gt,SubscriptionFilterSchema:Y,SubscriptionsListenRequestSchema:qt,SubscriptionsListenResultMetaSchema:Jt,SubscriptionsListenResultSchema:Yt,dispatchRequestSchemas:Xt,dispatchResultSchemas:Qt,NotificationMetaSchema:$t,SubscriptionsAcknowledgedNotificationSchema:en,CancelledNotificationParamsSchema:tn,CancelledNotificationSchema:nn,notificationSchemas2026:rn,JSONRPCResultResponseSchema:X(nt),CallToolResultResponseSchema:X(j([it,Ot])),ListToolsResultResponseSchema:X(at),ListPromptsResultResponseSchema:X(ot),GetPromptResultResponseSchema:X(j([st,Ot])),ListResourcesResultResponseSchema:X(ct),ListResourceTemplatesResultResponseSchema:X(lt),ReadResourceResultResponseSchema:X(j([ut,Ot])),CompleteResultResponseSchema:X(dt),DiscoverResultResponseSchema:X(pt),SubscriptionsListenResultResponseSchema:X(Yt)}}var Ma;function Na(){return Ma??=ja()}var Pa=[`tools/list`,`prompts/list`,`resources/list`,`resources/templates/list`,`resources/read`,`server/discover`];function Fa(e){return Pa.includes(e)}var Ia=Symbol(`modelcontextprotocol.resultCacheHintFallback`);function La(e){return e[Ia]}function Ra(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function za(e){return e===`public`||e===`private`}var $=function(e){return e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`,e[e.ResourceNotFound=-32002]=`ResourceNotFound`,e[e.MissingRequiredClientCapability=-32021]=`MissingRequiredClientCapability`,e[e.UnsupportedProtocolVersion=-32022]=`UnsupportedProtocolVersion`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`,e}({}),Ba=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ProtocolError`})}static[Symbol.hasInstance](e){return $i(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return $i(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`ProtocolError`,Qi(this,new.target)}static fromError(t,n,r){if(t===$.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new Ha(e.elicitations,n)}if(t===$.UnsupportedProtocolVersion&&r){let e=r;if(Array.isArray(e.supported)&&typeof e.requested==`string`)return new Ua({supported:e.supported,requested:e.requested},n)}if(t===$.InvalidParams||t===$.ResourceNotFound){let e=r;if(typeof e?.uri==`string`&&(t===$.ResourceNotFound||Object.keys(e).length===1))return new Va(e.uri,n)}if(t===$.MissingRequiredClientCapability&&r){let e=r;if(e.requiredCapabilities!==null&&typeof e.requiredCapabilities==`object`&&!Array.isArray(e.requiredCapabilities))return new Wa({requiredCapabilities:e.requiredCapabilities},n)}return new e(t,n,r)}},Va=class extends Ba{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ResourceNotFoundError`})}constructor(e,t=`Resource not found: ${e}`){super($.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},Ha=class extends Ba{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UrlElicitationRequiredError`})}constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super($.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},Ua=class extends Ba{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnsupportedProtocolVersionError`})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super($.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},Wa=class extends Ba{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.MissingRequiredClientCapabilityError`})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(`, `)}`){super($.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},Ga=0,Ka=`private`,qa=[`tools/call`,`prompts/get`,`resources/read`];function Ja(e,t){let n=t.resultType;if(n===void 0)return{...t,resultType:`complete`};if(n===`complete`||qa.includes(e))return t;throw new Ba($.InternalError,`Handler for ${e} returned resultType '${String(n)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function Ya(e,t){let n=La(t);if(t.resultType!==`complete`||!Fa(e))return n===void 0?t:eo(t);let r=t,i=Ra(r.ttlMs)?r.ttlMs:Qa(n),a=za(r.cacheScope)?r.cacheScope:$a(n),o={...r,ttlMs:i,cacheScope:a};return delete o[Ia],o}function Xa(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Za(e,t){if(t===void 0)return e;let n=e._meta;return n===void 0?{...e,_meta:{[Nt]:t}}:!Xa(n)||n[`io.modelcontextprotocol/serverInfo`]!==void 0?e:{...e,_meta:{...n,[Nt]:t}}}function Qa(e){return e!==void 0&&Ra(e.ttlMs)?e.ttlMs:Ga}function $a(e){return e!==void 0&&za(e.cacheScope)?e.cacheScope:Ka}function eo(e){let t={...e};return delete t[Ia],t}var to=[`elicitation/create`,`sampling/createMessage`,`roots/list`],no;function ro(){if(no)return no;let e=Na();return no={request:{"elicitation/create":B({method:R(`elicitation/create`),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":B({method:R(`sampling/createMessage`),params:e.CreateMessageRequestParamsSchema}),"roots/list":B({method:R(`roots/list`),params:F({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},no}function io(e){return to.includes(e)}function ao(e){return io(e)?ro().request[e]:void 0}function oo(e){return io(e)?ro().response[e]:void 0}var so={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},co={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function lo(e){return Object.prototype.hasOwnProperty.call(so,e)}function uo(e){return Object.prototype.hasOwnProperty.call(co,e)}function fo(e){return Object.prototype.hasOwnProperty.call(so,e)}function po(e){return lo(e)?Na().dispatchRequestSchemas[e]:void 0}function mo(e){return fo(e)?Na().dispatchResultSchemas[e]:void 0}function ho(e){return uo(e)?Na().notificationSchemas2026[e]:void 0}Object.keys(so),Object.keys(co);function go(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function _o(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var vo={ok:!1,reason:`not-in-era`},yo=[jt,Pt];function bo(e,t){let n=t,r=!1,i=()=>(r||=(n={...n},!0),n),a=t.tools;e===`tools/list`&&Array.isArray(a)&&a.some(e=>go(e)&&`execution`in e)&&(i().tools=a.map(e=>{if(!go(e)||!(`execution`in e))return e;let t={...e};return delete t.execution,t}));let o=t.capabilities;if(go(o)&&`tasks`in o){let e={...o};delete e.tasks,i().capabilities=e}return n}var xo={era:`2026-07-28`,hasRequestMethod:lo,hasNotificationMethod:uo,hasInputRequestMethod:e=>ao(e)!==void 0,validateRequest:(e,t)=>_o(po(e),t),validateResult:(e,t)=>_o(mo(e),t),validateNotification:(e,t)=>_o(ho(e),t),validateInputRequest:(e,t)=>_o(ao(e),t),validateInputResponse:(e,t)=>_o(oo(e),t),samplingResultVariant:()=>vo,outboundEnvelope(e){return{[jt]:e.protocolVersion,[Mt]:e.clientInfo,[Pt]:e.clientCapabilities,...e.logLevel!==void 0&&{"io.modelcontextprotocol/logLevel":e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of yo)n in e||t.push({key:n,problem:`missing`});let n=Na().RequestMetaEnvelopeSchema.safeParse(e);if(!n.success)for(let e of n.error.issues){let n=e.path.map(String),r=n.length>0?n.join(`.`):`_meta`;n.length===1&&t.some(e=>e.key===r&&e.problem===`missing`)||t.push({key:r,problem:e.message})}return t},projectCallToolResult:e=>ra(e),inputRequestSchema:ao,decodeResult(e,t){if(!go(t))return{kind:`invalid`,error:new Q(ea.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let n=t.resultType;if(n===void 0)return{kind:`invalid`,error:new Q(ea.InvalidResult,`Invalid result for ${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:`missing-resultType`})};if(typeof n!=`string`)return{kind:`invalid`,error:new Q(ea.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:n})};if(n===`input_required`){let n=t.inputRequests,r=go(n)?n:{},i=t.requestState,a=t._meta===void 0?void 0:Na().ResultMetaSchema.safeParse(t._meta),o=a?.success?a.data:void 0;return Object.keys(r).length===0&&typeof i!=`string`?{kind:`invalid`,error:new Q(ea.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:`input-required-missing-both`})}:{kind:`input_required`,inputRequests:r,...typeof i==`string`&&{requestState:i},...o!==void 0&&{_meta:o}}}if(n!==`complete`)return{kind:`invalid`,error:new Q(ea.UnsupportedResultType,`Unsupported result type '${n}' for ${e}`,{resultType:n,method:e})};let r=Co(),i=Object.hasOwn(r,e)?r[e]:void 0;if(i!==void 0){let n=i.safeParse(t);if(!n.success)return{kind:`invalid`,error:new Q(ea.InvalidResult,`Invalid result for ${e}: ${n.error}`,{method:e})}}let a={...t};return delete a.resultType,{kind:`complete`,result:a}},encodeResult(e,t,n){return Za(Ya(e,Ja(e,bo(e,t))),n)},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return`Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)`;let t=Na().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(e=>e.message).join(`; `)}`}},So;function Co(){if(So)return So;let e=Na();return So={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},So}var wo=`2026-07-28`;function To(e){return e!==void 0&&na(e)?xo:Aa}function Eo(e){return e.revision===void 0?e.era===`modern`?xo.era:Aa.era:To(e.revision).era}function Do(e){return Ao.some(t=>t.hasRequestMethod(e))}function Oo(e){return Ao.some(t=>t.hasNotificationMethod(e))}function ko(e){return e===`tasks/get`||e===`tasks/cancel`}var Ao=[Aa,xo],jo=xt({AnnotationsSchema:()=>An,AudioContentSchema:()=>lr,BaseMetadataSchema:()=>X,BaseRequestParamsSchema:()=>K,BlobResourceContentsSchema:()=>On,BooleanSchemaSchema:()=>Wr,CallToolRequestParamsSchema:()=>wr,CallToolRequestSchema:()=>Tr,CallToolResultSchema:()=>Sr,CancelTaskRequestSchema:()=>Ai,CancelTaskResultSchema:()=>ji,CancelledNotificationParamsSchema:()=>en,CancelledNotificationSchema:()=>tn,ClientCapabilitiesSchema:()=>un,ClientNotificationSchema:()=>Ni,ClientRequestSchema:()=>Mi,ClientResultSchema:()=>Pi,ClientTasksCapabilitySchema:()=>cn,CompatibilityCallToolResultSchema:()=>Cr,CompleteRequestParamsSchema:()=>di,CompleteRequestSchema:()=>fi,CompleteResultSchema:()=>pi,ContentBlockSchema:()=>pr,CreateMessageRequestParamsSchema:()=>Br,CreateMessageRequestSchema:()=>Vr,CreateMessageResultSchema:()=>Hr,CreateMessageResultWithToolsSchema:()=>Ur,CreateTaskResultSchema:()=>xi,CursorSchema:()=>zt,DiscoverRequestSchema:()=>gn,DiscoverResultSchema:()=>_n,ElicitRequestFormParamsSchema:()=>ni,ElicitRequestParamsSchema:()=>ii,ElicitRequestSchema:()=>ai,ElicitRequestURLParamsSchema:()=>ri,ElicitResultSchema:()=>ci,ElicitationCompleteNotificationParamsSchema:()=>oi,ElicitationCompleteNotificationSchema:()=>si,EmbeddedResourceSchema:()=>dr,EmptyResultSchema:()=>$t,EnumSchemaSchema:()=>ei,GetPromptRequestParamsSchema:()=>ar,GetPromptRequestSchema:()=>or,GetPromptResultSchema:()=>hr,GetTaskPayloadRequestSchema:()=>Ei,GetTaskPayloadResultSchema:()=>Di,GetTaskRequestSchema:()=>wi,GetTaskResultSchema:()=>Ti,IconSchema:()=>nn,IconsSchema:()=>rn,ImageContentSchema:()=>cr,ImplementationSchema:()=>an,InitializeRequestParamsSchema:()=>dn,InitializeRequestSchema:()=>fn,InitializeResultSchema:()=>mn,InitializedNotificationSchema:()=>hn,JSONArraySchema:()=>Lt,JSONObjectSchema:()=>G,JSONRPCErrorResponseSchema:()=>Xt,JSONRPCMessageSchema:()=>Zt,JSONRPCNotificationSchema:()=>Jt,JSONRPCRequestSchema:()=>qt,JSONRPCResponseSchema:()=>Qt,JSONRPCResultResponseSchema:()=>Yt,JSONValueSchema:()=>W,LegacyTitledEnumSchemaSchema:()=>Yr,ListChangedOptionsBaseSchema:()=>Dr,ListPromptsRequestSchema:()=>rr,ListPromptsResultSchema:()=>ir,ListResourceTemplatesRequestSchema:()=>Fn,ListResourceTemplatesResultSchema:()=>In,ListResourcesRequestSchema:()=>Nn,ListResourcesResultSchema:()=>Pn,ListRootsRequestSchema:()=>hi,ListRootsResultSchema:()=>gi,ListTasksRequestSchema:()=>Oi,ListTasksResultSchema:()=>ki,ListToolsRequestSchema:()=>br,ListToolsResultSchema:()=>xr,LoggingLevelSchema:()=>Or,LoggingMessageNotificationParamsSchema:()=>jr,LoggingMessageNotificationSchema:()=>Mr,ModelHintSchema:()=>Nr,ModelPreferencesSchema:()=>Pr,MultiSelectEnumSchemaSchema:()=>$r,NotificationSchema:()=>Wt,NotificationsParamsSchema:()=>J,NumberSchemaSchema:()=>Kr,PaginatedRequestParamsSchema:()=>Sn,PaginatedRequestSchema:()=>Cn,PaginatedResultSchema:()=>wn,PingRequestSchema:()=>vn,PrimitiveSchemaDefinitionSchema:()=>ti,ProgressNotificationParamsSchema:()=>bn,ProgressNotificationSchema:()=>xn,ProgressSchema:()=>yn,ProgressTokenSchema:()=>Rt,PromptArgumentSchema:()=>tr,PromptListChangedNotificationSchema:()=>gr,PromptMessageSchema:()=>mr,PromptReferenceSchema:()=>ui,PromptSchema:()=>nr,ReadResourceRequestParamsSchema:()=>Rn,ReadResourceRequestSchema:()=>zn,ReadResourceResultSchema:()=>Bn,RelatedTaskMetadataSchema:()=>Vt,RequestIdSchema:()=>Kt,RequestMetaSchema:()=>Ht,RequestSchema:()=>q,ResourceContentsSchema:()=>Tn,ResourceLinkSchema:()=>fr,ResourceListChangedNotificationSchema:()=>Vn,ResourceRequestParamsSchema:()=>Ln,ResourceSchema:()=>jn,ResourceTemplateReferenceSchema:()=>li,ResourceTemplateSchema:()=>Mn,ResourceUpdatedNotificationParamsSchema:()=>$n,ResourceUpdatedNotificationSchema:()=>er,ResultMetaObjectSchema:()=>Gt,ResultSchema:()=>Y,RoleSchema:()=>kn,RootSchema:()=>mi,RootsListChangedNotificationSchema:()=>_i,SamplingContentSchema:()=>Lr,SamplingMessageContentBlockSchema:()=>Rr,SamplingMessageSchema:()=>zr,ServerCapabilitiesSchema:()=>pn,ServerNotificationSchema:()=>Ii,ServerRequestSchema:()=>Fi,ServerResultSchema:()=>Li,ServerTasksCapabilitySchema:()=>ln,SetLevelRequestParamsSchema:()=>kr,SetLevelRequestSchema:()=>Ar,SingleSelectEnumSchemaSchema:()=>Xr,StringSchemaSchema:()=>Gr,SubscribeRequestParamsSchema:()=>Hn,SubscribeRequestSchema:()=>Un,SubscriptionFilterSchema:()=>Kn,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Yn,SubscriptionsAcknowledgedNotificationSchema:()=>Xn,SubscriptionsListenRequestParamsSchema:()=>qn,SubscriptionsListenRequestSchema:()=>Jn,SubscriptionsListenResultMetaSchema:()=>Zn,SubscriptionsListenResultSchema:()=>Qn,TaskAugmentedRequestParamsSchema:()=>Ut,TaskCreationParamsSchema:()=>vi,TaskMetadataSchema:()=>Bt,TaskSchema:()=>bi,TaskStatusNotificationParamsSchema:()=>Si,TaskStatusNotificationSchema:()=>Ci,TaskStatusSchema:()=>yi,TextContentSchema:()=>sr,TextResourceContentsSchema:()=>En,TitledMultiSelectEnumSchemaSchema:()=>Qr,TitledSingleSelectEnumSchemaSchema:()=>Jr,ToolAnnotationsSchema:()=>_r,ToolChoiceSchema:()=>Fr,ToolExecutionSchema:()=>vr,ToolListChangedNotificationSchema:()=>Er,ToolResultContentSchema:()=>Ir,ToolSchema:()=>yr,ToolUseContentSchema:()=>ur,UnsubscribeRequestParamsSchema:()=>Wn,UnsubscribeRequestSchema:()=>Gn,UntitledMultiSelectEnumSchemaSchema:()=>Zr,UntitledSingleSelectEnumSchemaSchema:()=>qr}),Mo=e=>qt.safeParse(e).success,No=e=>Jt.safeParse(e).success,Po=e=>Yt.safeParse(e).success,Fo=e=>Xt.safeParse(e).success;$.InvalidRequest,$.UnsupportedProtocolVersion,$.InvalidParams,$.MethodNotFound,$.InvalidParams,$.MissingRequiredClientCapability,$.ParseError,$.InvalidRequest,$.MethodNotFound,$.UnsupportedProtocolVersion,$.MissingRequiredClientCapability;function Io(e,t){return We(e,t)}function Lo(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function Ro(e){if(e==null)return!1;let t=typeof e;return t!==`object`&&t!==`function`||!(`~standard`in e)?!1:typeof e[`~standard`]?.validate==`function`}var zo=!1,Bo=`draft-2020-12`;function Vo(e,t=`input`){let n=e[`~standard`],r;if(n.jsonSchema)r=n.jsonSchema[t]({target:Bo});else if(n.vendor===`zod`){if(!(`_zod`in e))throw Error(`Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().`);zo||(zo=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),r=Ue(e,{target:Bo,io:t})}else throw Error(`Schema library "${n.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t===`output`)return r.type===void 0&&Ho(r)?{type:`object`,...r}:r;if(r.type!==void 0&&r.type!==`object`)throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(r.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:`object`,...r}}function Ho(e){if(`properties`in e||`patternProperties`in e||`additionalProperties`in e||`required`in e)return!0;for(let t of[`oneOf`,`anyOf`,`allOf`]){let n=e[t];if(Array.isArray(n)&&n.length>0)return n.every(e=>typeof e==`object`&&!!e&&(e.type===`object`||Ho(e)))}return!1}function Uo(e){return e.path?.length?`${e.path.map(e=>String(typeof e==`object`?e.key:e)).join(`.`)}: ${e.message}`:e.message}async function Wo(e,t){let n=await e[`~standard`].validate(t);return n.issues&&n.issues.length>0?{success:!1,error:n.issues.map(e=>Uo(e)).join(`, `)}:{success:!0,data:n.value}}function Go(e){let t=Ue(e,{target:Bo,io:`input`});return typeof t.pattern==`string`?t.pattern:void 0}var Ko=/\\\.\\d\{(\d+)\}/;function qo(e){let t=Ko.exec(e),n=[void 0,-1,0];return t&&n.push(Number(t[1])),[!1,!0].flatMap(e=>[!1,!0].flatMap(t=>n.map(n=>Et({local:e,offset:t,precision:n}))))}function Jo(e,t){let n;switch(e){case`email`:n=[Ye()];break;case`uri`:n=[Ke()];break;case`date`:n=[Dt()];break;case`date-time`:n=qo(t)}return new Set(n.map(e=>Go(e)).filter(e=>e!==void 0))}function Yo(e,t,n){return n!==`zod`||Jo(e,t).has(t)}function Xo(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Zo(e){try{return Vo(e,`input`)}catch(e){let t=e instanceof Error?e.message:String(e);throw new Ba($.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}var Qo=new Set([`$comment`,`deprecated`,`description`,`examples`,`readOnly`,`title`,`writeOnly`]);function $o(e){return Qo.has(e)||e.startsWith(`x-`)}var es=new Set([`$schema`,...Object.keys(ni.shape.requestedSchema.shape)]),ts={string:Lo([Gr,qr,Jr,Yr]),number:Lo([Kr]),integer:Lo([Kr]),boolean:Lo([Wr]),array:Lo([Zr,Qr])},ns=new Set(Gr.shape.format.unwrap().options);function rs(e,t,n,r){if(!Xo(e))return e;let i=typeof e.type==`string`&&Object.hasOwn(ts,e.type)?ts[e.type]:void 0;if(i===void 0)return e;let a={};for(let[o,s]of Object.entries(e))i.has(o)||$o(o)?a[o]=s:o===`pattern`&&e.type===`string`&&typeof e.format==`string`?ns.has(e.format)?(typeof s!=`string`||!Yo(e.format,s,n))&&r.push(`${t}.${o}`):a[o]=s:r.push(`${t}.${o}`);return a}function is(e,t){let n={},r=[];for(let[i,a]of Object.entries(e))i===`properties`&&Xo(a)?n[i]=Object.fromEntries(Object.entries(a).map(([e,n])=>[e,rs(n,`properties.${e}`,t,r)])):es.has(i)?n[i]=a:$o(i)||r.push(i);if(r.length>0)throw new Ba($.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(`, `)}`);return n}function as(e,t){if(!Xo(e.properties))return t;let n=Object.entries(e.properties).filter(([,e])=>!Io(ti,e).success).map(([e])=>`properties.${e}`);return n.length>0?n.join(`, `):t}function os(e,t,n=``){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((e,r)=>os(e,t[r],`${n}[${r}]`)):!Xo(e)||!Xo(t)?[]:Object.entries(e).flatMap(([e,r])=>{let i=n?`${n}.${e}`:e;return Object.prototype.hasOwnProperty.call(t,e)?os(r,t[e],i):$o(e)?[]:[i]})}function ss(e){if(!Ro(e.requestedSchema))return{...e,mode:`form`,requestedSchema:e.requestedSchema};let t=e.requestedSchema[`~standard`].vendor,n=is(Zo(e.requestedSchema),t),r=Io(ni.shape.requestedSchema,n);if(!r.success)throw new Ba($.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${as(n,r.error.message)}`);let i=os(n,r.data);if(i.length>0)throw new Ba($.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${i.join(`, `)}`);let a=(r.data.required??[]).filter(e=>!Object.prototype.hasOwnProperty.call(r.data.properties,e));if(a.length>0)throw new Ba($.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${a.join(`, `)}`);return{...e,mode:`form`,requestedSchema:r.data}}function cs(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,n=typeof e.requestState==`string`;if(!t&&!n)throw TypeError(`inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)`);return{resultType:`input_required`,...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}Object.assign(cs,{elicit(e){try{return{method:`elicitation/create`,params:ss(e)}}catch(e){throw e instanceof Ba?TypeError(e.message,{cause:e}):e}},elicitUrl(e){return{method:`elicitation/create`,params:{...e,mode:`url`}}},createMessage(e){return{method:`sampling/createMessage`,params:e}},listRoots(){return{method:`roots/list`}}});var ls=`AnnotationsSchema.AudioContentSchema.BaseMetadataSchema.BlobResourceContentsSchema.BooleanSchemaSchema.CallToolRequestSchema.CallToolRequestParamsSchema.CallToolResultSchema.CancelledNotificationSchema.CancelledNotificationParamsSchema.CancelTaskRequestSchema.CancelTaskResultSchema.ClientCapabilitiesSchema.ClientNotificationSchema.ClientRequestSchema.ClientResultSchema.CompatibilityCallToolResultSchema.CompleteRequestSchema.CompleteRequestParamsSchema.CompleteResultSchema.ContentBlockSchema.CreateMessageRequestSchema.CreateMessageRequestParamsSchema.CreateMessageResultSchema.CreateMessageResultWithToolsSchema.CreateTaskResultSchema.CursorSchema.DiscoverRequestSchema.DiscoverResultSchema.ElicitationCompleteNotificationSchema.ElicitationCompleteNotificationParamsSchema.ElicitRequestSchema.ElicitRequestFormParamsSchema.ElicitRequestParamsSchema.ElicitRequestURLParamsSchema.ElicitResultSchema.EmbeddedResourceSchema.EmptyResultSchema.EnumSchemaSchema.GetPromptRequestSchema.GetPromptRequestParamsSchema.GetPromptResultSchema.GetTaskPayloadRequestSchema.GetTaskPayloadResultSchema.GetTaskRequestSchema.GetTaskResultSchema.IconSchema.IconsSchema.ImageContentSchema.ImplementationSchema.InitializedNotificationSchema.InitializeRequestSchema.InitializeRequestParamsSchema.InitializeResultSchema.JSONArraySchema.JSONObjectSchema.JSONRPCErrorResponseSchema.JSONRPCMessageSchema.JSONRPCNotificationSchema.JSONRPCRequestSchema.JSONRPCResponseSchema.JSONRPCResultResponseSchema.JSONValueSchema.LegacyTitledEnumSchemaSchema.ListPromptsRequestSchema.ListPromptsResultSchema.ListResourcesRequestSchema.ListResourcesResultSchema.ListResourceTemplatesRequestSchema.ListResourceTemplatesResultSchema.ListRootsRequestSchema.ListRootsResultSchema.ListTasksRequestSchema.ListTasksResultSchema.ListToolsRequestSchema.ListToolsResultSchema.LoggingLevelSchema.LoggingMessageNotificationSchema.LoggingMessageNotificationParamsSchema.ModelHintSchema.ModelPreferencesSchema.MultiSelectEnumSchemaSchema.NotificationSchema.NumberSchemaSchema.PaginatedRequestSchema.PaginatedRequestParamsSchema.PaginatedResultSchema.PingRequestSchema.PrimitiveSchemaDefinitionSchema.ProgressSchema.ProgressNotificationSchema.ProgressNotificationParamsSchema.ProgressTokenSchema.PromptSchema.PromptArgumentSchema.PromptListChangedNotificationSchema.PromptMessageSchema.PromptReferenceSchema.ReadResourceRequestSchema.ReadResourceRequestParamsSchema.ReadResourceResultSchema.RelatedTaskMetadataSchema.RequestSchema.RequestIdSchema.RequestMetaSchema.ResourceSchema.ResourceContentsSchema.ResourceLinkSchema.ResourceListChangedNotificationSchema.ResourceRequestParamsSchema.ResourceTemplateSchema.ResourceTemplateReferenceSchema.ResourceUpdatedNotificationSchema.ResourceUpdatedNotificationParamsSchema.ResultMetaObjectSchema.ResultSchema.RoleSchema.RootSchema.RootsListChangedNotificationSchema.SamplingContentSchema.SamplingMessageSchema.SamplingMessageContentBlockSchema.ServerCapabilitiesSchema.ServerNotificationSchema.ServerRequestSchema.ServerResultSchema.SetLevelRequestSchema.SetLevelRequestParamsSchema.SingleSelectEnumSchemaSchema.StringSchemaSchema.SubscribeRequestSchema.SubscribeRequestParamsSchema.SubscriptionFilterSchema.SubscriptionsAcknowledgedNotificationSchema.SubscriptionsAcknowledgedNotificationParamsSchema.SubscriptionsListenRequestSchema.SubscriptionsListenRequestParamsSchema.SubscriptionsListenResultSchema.SubscriptionsListenResultMetaSchema.TaskAugmentedRequestParamsSchema.TaskCreationParamsSchema.TaskMetadataSchema.TaskSchema.TaskStatusSchema.TaskStatusNotificationSchema.TaskStatusNotificationParamsSchema.TextContentSchema.TextResourceContentsSchema.TitledMultiSelectEnumSchemaSchema.TitledSingleSelectEnumSchemaSchema.ToolSchema.ToolAnnotationsSchema.ToolChoiceSchema.ToolExecutionSchema.ToolListChangedNotificationSchema.ToolResultContentSchema.ToolUseContentSchema.UnsubscribeRequestSchema.UnsubscribeRequestParamsSchema.UntitledMultiSelectEnumSchemaSchema.UntitledSingleSelectEnumSchemaSchema`.split(`.`),us={IdJagTokenExchangeResponseSchema:Ui,OAuthClientInformationFullSchema:Ji,OAuthClientInformationSchema:qi,OAuthClientMetadataSchema:Ki,OAuthClientRegistrationErrorSchema:Yi,OAuthErrorResponseSchema:Wi,OAuthMetadataSchema:zi,OAuthProtectedResourceMetadataSchema:Ri,OAuthTokenRevocationRequestSchema:Xi,OAuthTokensSchema:Hi,OpenIdProviderDiscoveryMetadataSchema:Vi,OpenIdProviderMetadataSchema:Bi},ds={},fs={};function ps(e,t){let n=e.slice(0,-6);ds[n]=t,fs[n]=e=>t.safeParse(e).success}for(let e of ls)ps(e,jo[e]);for(let[e,t]of Object.entries(us))ps(e,t);Object.freeze(ds),Object.freeze(fs);function ms(e){switch(e){case`initialize`:case`notifications/initialized`:return To(void 0);case`server/discover`:return To(wo);default:return}}var hs=[jt,Mt,Pt,It],gs=[`inputResponses`,`requestState`];function _s(e,t){let n=e.params;if(!Ss(n))return{message:e,lifted:{}};let r=n._meta,i=Ss(r)?hs.filter(e=>e in r):[],a=t===`request`?gs.filter(e=>e in n):[];if(i.length===0&&a.length===0)return{message:e,lifted:{}};let o={},s={...n};if(i.length>0&&Ss(r)){let e={},t={...r};for(let n of i)e[n]=r[n],delete t[n];o.envelope=e,Object.keys(t).length>0?s._meta=t:delete s._meta}for(let e of a)e===`inputResponses`&&(o.inputResponses=s[e]),e===`requestState`&&(o.requestState=s[e]),delete s[e];return{message:{...e,params:s},lifted:o}}function vs(e,t){let n=e.validateResult(t,void 0);if(n.ok||n.reason!==`not-in-era`)return{"~standard":{version:1,vendor:`mcp-wire-codec`,validate(n){let r=e.validateResult(t,n);return r.ok?{value:r.value}:{issues:[{message:r.reason===`invalid`?r.message:`not-in-era: ${t}`}]}}}}}function ys(e){return()=>e}var bs=ys(void 0),xs=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??kt,this.setNotificationHandler(`notifications/cancelled`,e=>{this._oncancel(e)}),this.setNotificationHandler(`notifications/progress`,e=>{this._onprogress(e)}),this.setRequestHandler(`ping`,e=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let n=e.params??{};return{...e,params:{...n,_meta:{...t,...n._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new Q(ea.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){e.params.requestId!==void 0&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,n,r,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let n=Date.now()-t.startTime;if(t.maxTotalTimeout&&n>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new Q(ea.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:n});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let n=this.transport?.onerror;this._transport.onerror=e=>{n?.(e),this._onerror(e)};let r=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{r?.(e,t),Po(e)||Fo(e)?this._onresponse(e):Mo(e)?this._onrequest(e,t):No(e)?this._onnotification(e,t):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let e of this._timeoutInfo.values())clearTimeout(e.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let n=new Q(ea.ConnectionClosed,`Connection closed`);this._transport=void 0;try{this.onclose?.()}finally{for(let t of e.values())t(n);for(let e of t.values())e.abort(n)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:n}=_s(e,`notification`),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`)return;if(t?.classification!==void 0){let e=Eo(t.classification);if(e!==r.era){this._onerror(Error(`Era mismatch on inbound notification '${n.method}': classified as ${e} but this instance serves ${r.era}`));return}}if(Oo(n.method)&&!r.hasNotificationMethod(n.method))return;let i=this._notificationHandlers.get(n.method),a=this.fallbackNotificationHandler;(i!==void 0||a!==void 0)&&Promise.resolve().then(()=>i===void 0?a(n):i(n,r)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let{message:n,lifted:r}=_s(e,`request`),i=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`){this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let a=this._transport,o=(e,t,r)=>{let i={jsonrpc:`2.0`,id:n.id,error:{code:e,message:t,...r!==void 0&&{data:r}}};a?.send(i).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)))};if(t?.classification!==void 0){let e=Eo(t.classification);if(e!==i.era){this._onerror(Error(`Era mismatch on inbound request '${n.method}': classified as ${e} but this instance serves ${i.era}`));let r=t.classification.revision??e;o($.UnsupportedProtocolVersion,`Unsupported protocol version: ${r}`,{supported:this._supportedProtocolVersions,requested:r});return}}if(Do(n.method)&&!i.hasRequestMethod(n.method)&&!(ko(n.method)&&this._customSchemaRequestMethods.has(n.method))){o($.MethodNotFound,`Method not found`);return}let s=this._requestHandlers.get(n.method)??this.fallbackRequestHandler;if(s===void 0){o($.MethodNotFound,`Method not found`);return}let c=i.checkInboundEnvelope(r);if(c!==void 0){o($.InvalidParams,c);return}let l=(e,t)=>this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,{...t,relatedRequestId:n.id}),u=(e,t,r)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(e.method),e,t,{...r,relatedRequestId:n.id}),d=new AbortController;this._requestHandlerAbortControllers.set(n.id,d);let f=r.inputResponses===void 0?void 0:ws(r.inputResponses),p={sessionId:a?.sessionId,mcpReq:{id:n.id,method:n.method,_meta:n.params?._meta,...r.envelope!==void 0&&{envelope:r.envelope},...f!==void 0&&{inputResponses:f.accepted},...f!==void 0&&f.droppedKeys.length>0&&{droppedInputResponseKeys:f.droppedKeys},requestState:r.requestState===void 0?bs:ys(r.requestState),signal:d.signal,send:((e,t,n)=>{let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),Ro(t))return u(e,t,n);let i=vs(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return u(e,i,t)}),notify:l},http:t?.authInfo?{authInfo:t.authInfo}:void 0},m=this.buildContext(p,t);Promise.resolve().then(()=>s(n,m)).then(async e=>{if(d.signal.aborted)return;let t;try{t=i.encodeResult(n.method,e,this._outboundServerInfo())}catch(e){this._onerror(Error(`Failed to encode result for ${n.method}: ${e}`)),o($.InternalError,`Internal error`);return}let r={result:t,jsonrpc:`2.0`,id:n.id};await a?.send(r)},async e=>{if(d.signal.aborted)return;let t=Number.isSafeInteger(e.code)?e.code:$.InternalError,r={jsonrpc:`2.0`,id:n.id,error:{code:i.encodeErrorCode(t),message:e.message??`Internal error`,...e.data!==void 0&&{data:e.data}}};await a?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(n.id)===d&&this._requestHandlerAbortControllers.delete(n.id)})}_onprogress(e){let{progressToken:t,...n}=e.params,r=Number(t),i=this._progressHandlers.get(r);if(!i){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&a&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(e){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),a(e);return}i(n)}_onresponse(e){let t=Number(e.id),n=this._responseHandlers.get(t);n===void 0?this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`)):(this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),Po(e)?n(e):n(Ba.fromError(e.error.code,e.error.message,e.error.data)))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,n){let r=this._resolveOutboundCodec(e.method);if(Ro(t))return ko(e.method)||this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n);this._assertOutboundRequestInEra(r,e.method);let i=vs(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(r,e,i,t)}_negotiatedWireCodec(){return To(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=ms(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(Do(t)&&!e.hasRequestMethod(t))throw new Q(ea.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,n){let r=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n)}_requestWithSchemaViaCodec(e,t,n,r){let{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s}=r??{},c=Date.now(),l,u;return new Promise((d,f)=>{let p=e=>{f(e)};if(!this._transport){p(Error(`Not connected`));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(e){p(e);return}if(r?.signal?.aborted){let e=r.signal.reason;throw e instanceof Q?e:new Q(ea.RequestTimeout,String(e))}let m=e.era===`2026-07-28`&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,h=this._requestMessageId++;u=h;let g={...t,jsonrpc:`2.0`,id:h};r?.onprogress&&(this._progressHandlers.set(h,r.onprogress),g.params={...t.params,_meta:{...t.params?._meta,progressToken:h}});let _=this._envelopeOutbound(g),v=!1,y=e=>{v||(this._progressHandlers.delete(h),m===void 0?t.method!==`initialize`&&this._transport?.send(this._envelopeOutbound({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:h,reason:String(e)}}),{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))):m.abort(),f(e instanceof Q?e:new Q(ea.RequestTimeout,String(e))))};this._responseHandlers.set(h,i=>{if(r?.signal?.aborted)return;if(v=!0,i instanceof Error)return f(i);let a;try{a=e.decodeResult(t.method,i.result)}catch(e){return f(e instanceof Error?e:Error(String(e)))}if(a.kind===`invalid`)return f(a.error);if(a.kind===`input_required`){if(r?.allowInputRequired===!0)return d(Ts(a));let i={codec:e,request:t,resultSchema:n,options:r,flowStartedAt:c,retry:(r,i)=>this._requestWithSchemaViaCodec(e,r===void 0?{method:t.method}:{method:t.method,params:r},n,i)};return d(this._resolveNonCompleteResult(a,i))}let o=a.result;Wo(n,o).then(e=>{e.success?d(e.data):f(new Q(ea.InvalidResult,`Invalid result for ${t.method}: ${e.error}`))},f)}),l=()=>y(r?.signal?.reason),r?.signal?.addEventListener(`abort`,l,{once:!0});let b=r?.timeout??6e4;this._setupTimeout(h,b,r?.maxTotalTimeout,()=>y(new Q(ea.RequestTimeout,`Request timed out`,{timeout:b})),r?.resetTimeoutOnProgress??!1),this._transport.send(_,{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s,requestSignal:m?.signal}).catch(e=>{this._progressHandlers.delete(h),f(e)})}).finally(()=>{l&&r?.signal?.removeEventListener(`abort`,l),u!==void 0&&(this._responseHandlers.delete(u),this._cleanupTimeout(u))})}async notification(e,t){return await this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,n){if(!this._transport)throw new Q(ea.NotConnected,`Not connected`);if(Oo(t.method)&&!e.hasNotificationMethod(t.method))throw new Q(ea.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let r=this._envelopeOutbound({jsonrpc:`2.0`,...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&n?.relatedRequestId===void 0){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method),this._transport&&this._transport?.send(r,n).catch(e=>this._onerror(e))})}else await this._transport.send(r,n)}setRequestHandler(e,t,n){this.assertRequestHandlerCapability(e);let r;if(typeof t==`function`){if(!Do(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);r=(n,r)=>{let i=this._negotiatedWireCodec(),a=i.validateRequest(e,n);if(!a.ok&&a.reason===`not-in-era`&&(a=i.validateInputRequest(e,n)),!a.ok)throw a.reason===`not-in-era`?new Ba($.InternalError,`No wire schema for ${e} in the resolved era`):Error(a.message);return Promise.resolve(t(a.value,r))}}else if(n)r=async(r,i)=>{let a=await Wo(t.params,{...r.params});if(!a.success)throw new Ba($.InvalidParams,`Invalid params for ${e}: ${a.error}`);return n(a.data,i)};else throw TypeError(`setRequestHandler: handler is required`);typeof t==`function`?this._customSchemaRequestMethods.delete(e):this._customSchemaRequestMethods.add(e),this._requestHandlers.set(e,this._wrapHandler(e,r))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e),this._customSchemaRequestMethods.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,n){if(typeof t==`function`){if(!Oo(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(n,r)=>{let i=r.validateNotification(e,n);if(!i.ok)throw i.reason===`not-in-era`?new Ba($.InternalError,`No wire schema for ${e} in the resolved era`):Error(i.message);return Promise.resolve(t(i.value))})}else{if(!n)throw TypeError(`setNotificationHandler: handler is required`);this._notificationHandlers.set(e,async r=>{let i=await Wo(t.params,{...r.params});if(!i.success)throw new Ba($.InvalidParams,`Invalid params for notification ${e}: ${i.error}`);await n(i.data,r)})}}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Ss(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Cs(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ws(e){let t={},n=[];if(!Cs(e))return{accepted:t,droppedKeys:n};for(let[r,i]of Object.entries(e))!Cs(i)||`method`in i||`result`in i?n.push(r):t[r]=i;return{accepted:t,droppedKeys:n}}function Ts(e){return{resultType:`input_required`,inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}bt((e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,n=/\\([\u000b\u0020-\u00ff])/g,r=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=i;function i(e){if(!e)throw TypeError(`argument string is required`);var i=typeof e==`object`?a(e):e;if(typeof i!=`string`)throw TypeError(`argument string is required to be a string`);var s=i.indexOf(`;`),c=s===-1?i.trim():i.slice(0,s).trim();if(!r.test(c))throw TypeError(`invalid media type`);var l=new o(c.toLowerCase());if(s!==-1){var u,d,f;for(t.lastIndex=s;d=t.exec(i);){if(d.index!==s)throw TypeError(`invalid parameter format`);s+=d[0].length,u=d[1].toLowerCase(),f=d[2],f.charCodeAt(0)===34&&(f=f.slice(1,-1),f.indexOf(`\\`)!==-1&&(f=f.replace(n,`$1`))),l.parameters[u]=f}if(s!==i.length)throw TypeError(`invalid parameter format`)}return l}function a(e){var t;if(typeof e.getHeader==`function`?t=e.getHeader(`content-type`):typeof e.headers==`object`&&(t=e.headers&&e.headers[`content-type`]),typeof t!=`string`)throw TypeError(`content-type header is missing from object`);return t}function o(e){this.parameters=Object.create(null),this.type=e}}))(),typeof self<`u`&&self.location&&self.location.origin!==`null`?new URL(self.location.origin+self.location.pathname+location.search):new URL(`https://github.com/cfworker`);var Es=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Ds=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,Os=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,ks=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,As=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,js=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Ms=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Ns=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Ps=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,Fs=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,Is=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i;function Ls(e){return e.test.bind(e)}Rs.bind(void 0,!1),Ls(Os),Ls(ks),Ls(As),Ls(Ds),Ls(Fs),Ls(Is),Ls(js),Ls(Ms),Ls(Ns),Ls(Ps);function Rs(e,t){let n=t.match(Es);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=!!n[5];return(r<=23&&i<=59&&a<=59||r==23&&i==59&&a==60)&&(!e||o)}globalThis.crypto;var zs=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthClientFlowError`})}static[Symbol.hasInstance](e){return $i(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return $i(this,e)}constructor(e){super(e),this.name=new.target.name,Qi(this,new.target)}};(class extends zs{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.IssuerMismatchError`})}kind;expected;received;constructor(e,t,n){super(`Issuer mismatch in ${e===`metadata`?`authorization server metadata (RFC 8414 §3.3)`:`authorization response (RFC 9207)`}: expected ${JSON.stringify(t)}, received ${JSON.stringify(n)}`),this.kind=e,this.expected=t,this.received=n}}),class extends zs{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.RegistrationRejectedError`})}status;body;submittedMetadata;constructor(e){super(`Dynamic Client Registration rejected (HTTP ${e.status}): ${e.body}`),this.status=e.status,this.body=e.body,this.submittedMetadata=e.submittedMetadata}},class extends zs{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.InsecureTokenEndpointError`})}tokenEndpoint;constructor(e){super(`Refusing to send credentials to non-https token endpoint '${e}'. OAuth token requests MUST use TLS (localhost / *.localhost / 127.0.0.1 / ::1 are exempt).`),this.tokenEndpoint=e}},class extends zs{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.AuthorizationServerMismatchError`})}constructor(e,t){super(`Authorization server mismatch: credentials are bound to ${JSON.stringify(e)} but this call resolved ${JSON.stringify(t)}; refusing to present them to a different authorization server`),this.recordedIssuer=e,this.currentIssuer=t}},class extends zs{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.InsufficientScopeError`})}requiredScope;resourceMetadataUrl;errorDescription;constructor(e){super(`Insufficient scope${e.requiredScope?`: required "${e.requiredScope}"`:``}`),this.requiredScope=e.requiredScope,this.resourceMetadataUrl=e.resourceMetadataUrl,this.errorDescription=e.errorDescription}},class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnauthorizedError`})}static[Symbol.hasInstance](e){return $i(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return $i(this,e)}constructor(e){super(e??`Unauthorized`),this.name=`UnauthorizedError`,Qi(this,new.target)}},class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SseError`})}static[Symbol.hasInstance](e){return $i(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return $i(this,e)}constructor(e,t,n){super(`SSE error: ${t}`),this.code=e,this.event=n,Qi(this,new.target)}};var Bs=class{_eventSlots=new Map;setHandler(e,t){let n=this._ensureEventSlot(e);n.onHandler&&t&&console.warn(`[MCP Apps] on${String(e)} handler replaced. Use addEventListener("${String(e)}", …) to add multiple listeners without replacing.`),n.onHandler=t}getHandler(e){return this._eventSlots.get(e)?.onHandler}addEventListener(e,t){this._ensureEventSlot(e).listeners.push(t)}removeEventListener(e,t){let n=this._eventSlots.get(e);if(!n)return;let r=n.listeners.indexOf(t);r!==-1&&n.listeners.splice(r,1)}dispatch(e,t){let n=this._eventSlots.get(e);if(n){n.onHandler?.(t);for(let e of[...n.listeners])e(t)}}_ensureEventSlot(e){let t=this._eventSlots.get(e);return t||(t={listeners:[]},this._eventSlots.set(e,t)),t}},Vs=class{_methods=new Set;claim(e,t){if(this._methods.has(e))throw Error(`Handler for "${e}" already registered (via ${t}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);this._methods.add(e)}replace(e){this._methods.add(e)}release(e){this._methods.delete(e)}has(e){return this._methods.has(e)}},Hs=new Set;function Us(e,t){let[n,r]=t,i=n?.shape;if(typeof i?.method?.value!=`string`)return;let a=i.method.value,o=e===`request`?`setRequestHandler`:`setNotificationHandler`;Hs.has(o)||(Hs.add(o),console.warn(`[ext-apps] ${o}(Schema, handler) is deprecated; use ${o}("${a}", { params: Schema.shape.params }, handler).`));let s=r;return[a,{params:i.params},e===`request`?(e,t)=>s({method:a,params:e},Ws(t)):e=>s({method:a,params:e})]}function Ws(e){return{signal:e.mcpReq.signal,requestId:e.mcpReq.id,sessionId:e.sessionId,_meta:e.mcpReq._meta,sendRequest:e.mcpReq.send,sendNotification:e.mcpReq.notify,authInfo:e.http?.authInfo}}var Gs=`2026-01-26`,Ks=j([R(`light`),R(`dark`)]).describe(`Color theme preference for the host environment.`),qs=j([R(`inline`),R(`fullscreen`),R(`pip`)]).describe(`Display mode for UI presentation.`),Js=j([R(`--color-background-primary`),R(`--color-background-secondary`),R(`--color-background-tertiary`),R(`--color-background-inverse`),R(`--color-background-ghost`),R(`--color-background-info`),R(`--color-background-danger`),R(`--color-background-success`),R(`--color-background-warning`),R(`--color-background-disabled`),R(`--color-text-primary`),R(`--color-text-secondary`),R(`--color-text-tertiary`),R(`--color-text-inverse`),R(`--color-text-ghost`),R(`--color-text-info`),R(`--color-text-danger`),R(`--color-text-success`),R(`--color-text-warning`),R(`--color-text-disabled`),R(`--color-border-primary`),R(`--color-border-secondary`),R(`--color-border-tertiary`),R(`--color-border-inverse`),R(`--color-border-ghost`),R(`--color-border-info`),R(`--color-border-danger`),R(`--color-border-success`),R(`--color-border-warning`),R(`--color-border-disabled`),R(`--color-ring-primary`),R(`--color-ring-secondary`),R(`--color-ring-inverse`),R(`--color-ring-info`),R(`--color-ring-danger`),R(`--color-ring-success`),R(`--color-ring-warning`),R(`--font-sans`),R(`--font-mono`),R(`--font-weight-normal`),R(`--font-weight-medium`),R(`--font-weight-semibold`),R(`--font-weight-bold`),R(`--font-text-xs-size`),R(`--font-text-sm-size`),R(`--font-text-md-size`),R(`--font-text-lg-size`),R(`--font-heading-xs-size`),R(`--font-heading-sm-size`),R(`--font-heading-md-size`),R(`--font-heading-lg-size`),R(`--font-heading-xl-size`),R(`--font-heading-2xl-size`),R(`--font-heading-3xl-size`),R(`--font-text-xs-line-height`),R(`--font-text-sm-line-height`),R(`--font-text-md-line-height`),R(`--font-text-lg-line-height`),R(`--font-heading-xs-line-height`),R(`--font-heading-sm-line-height`),R(`--font-heading-md-line-height`),R(`--font-heading-lg-line-height`),R(`--font-heading-xl-line-height`),R(`--font-heading-2xl-line-height`),R(`--font-heading-3xl-line-height`),R(`--border-radius-xs`),R(`--border-radius-sm`),R(`--border-radius-md`),R(`--border-radius-lg`),R(`--border-radius-xl`),R(`--border-radius-full`),R(`--border-width-regular`),R(`--shadow-hairline`),R(`--shadow-sm`),R(`--shadow-md`),R(`--shadow-lg`)]).describe(`CSS variable keys available to MCP apps for theming.`),Ys=H(Js.describe(`Style variables for theming MCP apps.
|
|
2
|
-
|
|
3
|
-
Individual style keys are optional - hosts may provide any subset of these values.
|
|
4
|
-
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
5
|
-
|
|
6
|
-
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
7
|
-
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),j([M(),z()]).describe(`Style variables for theming MCP apps.
|
|
8
|
-
|
|
9
|
-
Individual style keys are optional - hosts may provide any subset of these values.
|
|
10
|
-
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
11
|
-
|
|
12
|
-
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
13
|
-
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`)).describe(`Style variables for theming MCP apps.
|
|
14
|
-
|
|
15
|
-
Individual style keys are optional - hosts may provide any subset of these values.
|
|
16
|
-
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
17
|
-
|
|
18
|
-
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
19
|
-
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),Xs=B({method:R(`ui/open-link`),params:B({url:M().describe(`URL to open in the host's browser`)})}),Zs=B({isError:L().optional().describe(`True if the host failed to open the URL (e.g., due to security policy).`)}).passthrough(),Qs=B({isError:L().optional().describe(`True if the download failed (e.g., user cancelled or host denied).`)}).passthrough(),$s=B({isError:L().optional().describe(`True if the host rejected or failed to deliver the message.`)}).passthrough(),ec=B({method:R(`ui/notifications/sandbox-proxy-ready`),params:B({})}),tc=B({connectDomains:P(M()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
|
|
20
|
-
|
|
21
|
-
- Maps to CSP \`connect-src\` directive
|
|
22
|
-
- Empty or omitted → no network connections (secure default)`),resourceDomains:P(M()).optional().describe("Origins for static resources (images, scripts, stylesheets, fonts, media).\n\n- Maps to CSP `img-src`, `script-src`, `style-src`, `font-src`, `media-src` directives\n- Wildcard subdomains supported: `https://*.example.com`\n- Empty or omitted → no network resources (secure default)"),frameDomains:P(M()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted → no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:P(M()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted → only same origin allowed (`base-uri 'self'`)")}),nc=B({camera:B({}).optional().describe(`Request camera access.
|
|
23
|
-
|
|
24
|
-
Maps to Permission Policy \`camera\` feature.`),microphone:B({}).optional().describe(`Request microphone access.
|
|
25
|
-
|
|
26
|
-
Maps to Permission Policy \`microphone\` feature.`),geolocation:B({}).optional().describe(`Request geolocation access.
|
|
27
|
-
|
|
28
|
-
Maps to Permission Policy \`geolocation\` feature.`),clipboardWrite:B({}).optional().describe(`Request clipboard write access.
|
|
29
|
-
|
|
30
|
-
Maps to Permission Policy \`clipboard-write\` feature.`)}),rc=B({method:R(`ui/notifications/size-changed`),params:B({width:N().optional().describe(`New width in pixels.`),height:N().optional().describe(`New height in pixels.`)})});B({method:R(`ui/notifications/tool-input`),params:B({arguments:H(M(),V().describe(`Complete tool call arguments as key-value pairs.`)).optional().describe(`Complete tool call arguments as key-value pairs.`)})}),B({method:R(`ui/notifications/tool-input-partial`),params:B({arguments:H(M(),V().describe(`Partial tool call arguments (incomplete, may change).`)).optional().describe(`Partial tool call arguments (incomplete, may change).`)})}),B({method:R(`ui/notifications/tool-cancelled`),params:B({reason:M().optional().describe(`Optional reason for the cancellation (e.g., "user action", "timeout").`)})});var ic=B({fonts:M().optional()}),ac=B({variables:Ys.optional().describe(`CSS variables for theming the app.`),css:ic.optional().describe(`CSS blocks that apps can inject.`)});B({method:R(`ui/resource-teardown`),params:B({})});var oc=H(M(),V()),sc=B({text:B({}).optional().describe(`Host supports text content blocks.`),image:B({}).optional().describe(`Host supports image content blocks.`),audio:B({}).optional().describe(`Host supports audio content blocks.`),resource:B({}).optional().describe(`Host supports resource content blocks.`),resourceLink:B({}).optional().describe(`Host supports resource link content blocks.`),structuredContent:B({}).optional().describe(`Host supports structured content.`)}),cc=B({method:R(`ui/notifications/request-teardown`),params:B({}).optional()}),lc=B({experimental:H(M(),H(M(),rt()).describe(`Experimental features keyed by identifier.`)).optional().describe(`Experimental features keyed by identifier.`),openLinks:B({}).optional().describe(`Host supports opening external URLs.`),downloadFile:B({}).optional().describe(`Host supports file downloads via ui/download-file.`),serverTools:B({listChanged:L().optional().describe(`Host supports tools/list_changed notifications.`)}).optional().describe(`Host can proxy tool calls to the MCP server.`),serverResources:B({listChanged:L().optional().describe(`Host supports resources/list_changed notifications.`)}).optional().describe(`Host can proxy resource reads to the MCP server.`),logging:B({}).optional().describe(`Host accepts log messages.`),sandbox:B({permissions:nc.optional().describe(`Permissions granted by the host (camera, microphone, geolocation).`),csp:tc.optional().describe(`CSP domains approved by the host.`)}).optional().describe(`Sandbox configuration applied by the host.`),updateModelContext:sc.optional().describe(`Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns.`),message:sc.optional().describe(`Host supports receiving content messages (ui/message) from the view.`),sampling:B({tools:B({}).optional().describe("Host supports tool use via `tools` and `toolChoice` parameters.")}).optional().describe("Host supports LLM sampling (sampling/createMessage) from the view.\nMirrors the MCP `ClientCapabilities.sampling` shape so hosts can pass it through.")}),uc=B({experimental:H(M(),H(M(),rt()).describe(`Experimental features keyed by identifier.`)).optional().describe(`Experimental features keyed by identifier.`),tools:B({listChanged:L().optional().describe(`App supports tools/list_changed notifications.`)}).optional().describe(`App exposes MCP-style tools that the host can call.`),availableDisplayModes:P(qs).optional().describe(`Display modes the app supports.`)}),dc=B({method:R(`ui/notifications/initialized`),params:B({}).optional()});B({csp:tc.optional().describe(`Content Security Policy configuration for UI resources.`),permissions:nc.optional().describe(`Sandbox permissions requested by the UI resource.`),domain:M().optional().describe(`Dedicated origin for view sandbox.
|
|
31
|
-
|
|
32
|
-
Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
|
|
33
|
-
|
|
34
|
-
**Host-dependent:** The format and validation rules for this field are determined by each host. Servers MUST consult host-specific documentation for the expected domain format. Common patterns include:
|
|
35
|
-
- Hash-based subdomains (e.g., \`{hash}.claudemcpcontent.com\`)
|
|
36
|
-
- URL-derived subdomains (e.g., \`www-example-com.oaiusercontent.com\`)
|
|
37
|
-
|
|
38
|
-
If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:L().optional().describe(`Visual boundary preference - true if view prefers a visible border.
|
|
39
|
-
|
|
40
|
-
Boolean requesting whether a visible border and background is provided by the host. Specifying an explicit value for this is recommended because hosts' defaults may vary.
|
|
41
|
-
|
|
42
|
-
- \`true\`: request visible border + background
|
|
43
|
-
- \`false\`: request no visible border + background
|
|
44
|
-
- omitted: host decides border`)});var fc=B({method:R(`ui/request-display-mode`),params:B({mode:qs.describe(`The display mode being requested.`)})}),pc=B({mode:qs.describe(`The display mode that was actually set. May differ from requested if not supported.`)}).passthrough(),mc=j([R(`model`),R(`app`)]).describe(`Tool visibility scope - who can access the tool.`);B({resourceUri:M().optional(),visibility:P(mc).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
45
|
-
- "model": Tool visible to and callable by the agent
|
|
46
|
-
- "app": Tool callable by the app from this server only`),csp:Ze().optional(),permissions:Ze().optional()}),B({mimeTypes:P(M()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')});var hc=B({method:R(`ui/download-file`),params:B({contents:P(j([dr,fr])).describe(`Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.`)})}),gc=B({method:R(`ui/message`),params:B({role:R(`user`).describe(`Message role, currently only "user" is supported.`),content:P(pr).describe(`Message content blocks (text, image, etc.).`)})});B({method:R(`ui/notifications/sandbox-resource-ready`),params:B({html:M().describe(`HTML content to load into the inner iframe.`),sandbox:M().optional().describe(`Optional override for the inner iframe's sandbox attribute.`),csp:tc.optional().describe(`CSP configuration from resource metadata.`),permissions:nc.optional().describe(`Sandbox permissions from resource metadata.`)})}),B({method:R(`ui/notifications/tool-result`),params:Sr.describe(`Standard MCP tool execution result.`)});var _c=B({toolInfo:B({id:Kt.optional().describe(`JSON-RPC id of the tools/call request.`),tool:yr.describe(`Tool definition including name, inputSchema, etc.`)}).optional().describe(`Metadata of the tool call that instantiated this App.`),theme:Ks.optional().describe(`Current color theme preference.`),styles:ac.optional().describe(`Style configuration for theming the app.`),displayMode:qs.optional().describe(`How the UI is currently displayed.`),availableDisplayModes:P(qs).optional().describe(`Display modes the host supports.`),containerDimensions:j([B({height:N().describe(`Fixed container height in pixels.`)}),B({maxHeight:j([N(),z()]).optional().describe(`Maximum container height in pixels.`)})]).and(j([B({width:N().describe(`Fixed container width in pixels.`)}),B({maxWidth:j([N(),z()]).optional().describe(`Maximum container width in pixels.`)})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
47
|
-
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:M().optional().describe(`User's language and region preference in BCP 47 format.`),timeZone:M().optional().describe(`User's timezone in IANA format.`),userAgent:M().optional().describe(`Host application identifier.`),platform:j([R(`web`),R(`desktop`),R(`mobile`)]).optional().describe(`Platform type for responsive design decisions.`),deviceCapabilities:B({touch:L().optional().describe(`Whether the device supports touch input.`),hover:L().optional().describe(`Whether the device supports hover interactions.`)}).optional().describe(`Device input capabilities.`),safeAreaInsets:B({top:N().describe(`Top safe area inset in pixels.`),right:N().describe(`Right safe area inset in pixels.`),bottom:N().describe(`Bottom safe area inset in pixels.`),left:N().describe(`Left safe area inset in pixels.`)}).optional().describe(`Mobile safe area boundaries in pixels.`)}).passthrough();B({method:R(`ui/notifications/host-context-changed`),params:_c.describe(`Partial context update containing only changed fields.`)});var vc=B({method:R(`ui/update-model-context`),params:B({content:P(pr).optional().describe(`Context content blocks (text, image, etc.).`),structuredContent:H(M(),V().describe(`Structured content for machine-readable context data.`)).optional().describe(`Structured content for machine-readable context data.`)})}),yc=B({method:R(`ui/initialize`),params:B({appInfo:an.describe(`App identification (name and version).`),appCapabilities:uc.describe(`Features and capabilities this app provides.`),protocolVersion:M().describe(`Protocol version this app supports.`)})}),bc=B({protocolVersion:M().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:an.describe(`Host application identification and version.`),hostCapabilities:lc.describe(`Features and capabilities provided by the host.`),hostContext:_c.describe(`Rich context about the host environment.`)}).passthrough(),xc=class{eventTarget;eventSource;messageListener;constructor(e=window.parent,t){this.eventTarget=e,this.eventSource=t,this.messageListener=e=>{if(t&&e.source!==this.eventSource){console.debug(`Ignoring message from unknown source`,e);return}let n=Zt.safeParse(e.data);n.success?(console.debug(`Parsed message`,n.data),this.onmessage?.(n.data)):e.data?.jsonrpc===`2.0`?(console.error(`Failed to parse message`,n.error.message,e),this.onerror?.(Error(`Invalid JSON-RPC message received: `+n.error.message))):console.debug(`Ignoring non-JSON-RPC message`,n.error.message,e)}}async start(){window.addEventListener(`message`,this.messageListener)}async send(e,t){e.method!==`ui/notifications/tool-input-partial`&&console.debug(`Sending message`,e),this.eventTarget.postMessage(e,`*`)}async close(){window.removeEventListener(`message`,this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion},Sc=[Gs],Cc=class extends xs{_client;_hostInfo;_hostCapabilities;_appCapabilities;_hostContext={};_appInfo;_initializedReceived=!1;_registeredEvents=new Set;_events=new Bs;_methods=new Vs;setRequestHandler=(...e)=>{let[t,...n]=Us(`request`,e)??e;this._methods.claim(t,`setRequestHandler`),super.setRequestHandler.call(this,t,...n)};setNotificationHandler=(...e)=>{let[t,...n]=Us(`notification`,e)??e;this._methods.claim(t,`setNotificationHandler`),super.setNotificationHandler.call(this,t,...n)};removeRequestHandler=e=>{this._methods.release(e),super.removeRequestHandler(e)};removeNotificationHandler=e=>{this._methods.release(e),super.removeNotificationHandler(e)};replaceRequestHandler=(e,...t)=>{this._methods.replace(e),super.setRequestHandler.call(this,e,...t)};_wrapHandler(e,t){let n=super._wrapHandler(e,t);return e===`ui/initialize`||e===`ping`?n:async(t,r)=>(this._initializedReceived||console.warn(`[ext-apps] AppBridge received '${e}' before ui/notifications/initialized. The View is calling host methods before completing the handshake; it should await app.connect() first.`),n(t,r))}eventSchemas={sizechange:rc,sandboxready:ec,initialized:dc,requestteardown:cc,loggingmessage:Mr};setEventHandler(e,t){this._ensureEventSlot(e),this._events.setHandler(e,t)}getEventHandler(e){return this._events.getHandler(e)}addEventListener(e,t){this._ensureEventSlot(e),this._events.addEventListener(e,t)}removeEventListener(e,t){this._events.removeEventListener(e,t)}_ensureEventSlot(e){if(this._registeredEvents.has(e))return;let t=this.eventSchemas[e];if(!t)throw Error(`Unknown event: ${String(e)}`);let n=t=>{e===`initialized`&&(this._initializedReceived=!0),this._events.dispatch(e,t)};e===`loggingmessage`?this.setNotificationHandler(`notifications/message`,e=>{n(e.params)}):this.setNotificationHandler(t.shape.method.value,{params:t.shape.params},e=>n(e)),this._registeredEvents.add(e)}warnIfRequestHandlerReplaced(e,t,n){t&&n&&console.warn(`[MCP Apps] ${e} handler replaced. Previous handler will no longer be called.`)}constructor(e,t,n,r){super(r),this._client=e,this._hostInfo=t,this._hostCapabilities=n,this._methods.replace(`notifications/cancelled`),this._methods.replace(`notifications/progress`),this._ensureEventSlot(`initialized`),this._hostContext=r?.hostContext||{},this.replaceRequestHandler(`ui/initialize`,{params:yc.shape.params,result:bc},e=>this._onAppsInitialize(e)),this.replaceRequestHandler(`ping`,(e,t)=>(this.onping?.(e.params,t),{})),this.replaceRequestHandler(`ui/request-display-mode`,{params:fc.shape.params,result:pc},()=>({mode:this._hostContext.displayMode??`inline`}))}buildContext(e){return e}assertCapabilityForMethod(e){}assertRequestHandlerCapability(e){}assertNotificationCapability(e){}getAppCapabilities(){return this._appCapabilities}getAppVersion(){return this._appInfo}onping;get onsizechange(){return this.getEventHandler(`sizechange`)}set onsizechange(e){this.setEventHandler(`sizechange`,e)}get onsandboxready(){return this.getEventHandler(`sandboxready`)}set onsandboxready(e){this.setEventHandler(`sandboxready`,e)}get oninitialized(){return this.getEventHandler(`initialized`)}set oninitialized(e){this.setEventHandler(`initialized`,e)}_onmessage;get onmessage(){return this._onmessage}set onmessage(e){this.warnIfRequestHandlerReplaced(`onmessage`,this._onmessage,e),this._onmessage=e,this.replaceRequestHandler(`ui/message`,{params:gc.shape.params,result:$s},async(e,t)=>{if(!this._onmessage)throw Error(`No onmessage handler set`);return this._onmessage(e,t)})}_onopenlink;get onopenlink(){return this._onopenlink}set onopenlink(e){this.warnIfRequestHandlerReplaced(`onopenlink`,this._onopenlink,e),this._onopenlink=e,this.replaceRequestHandler(`ui/open-link`,{params:Xs.shape.params,result:Zs},async(e,t)=>{if(!this._onopenlink)throw Error(`No onopenlink handler set`);return this._onopenlink(e,t)})}_ondownloadfile;get ondownloadfile(){return this._ondownloadfile}set ondownloadfile(e){this.warnIfRequestHandlerReplaced(`ondownloadfile`,this._ondownloadfile,e),this._ondownloadfile=e,this.replaceRequestHandler(`ui/download-file`,{params:hc.shape.params,result:Qs},async(e,t)=>{if(!this._ondownloadfile)throw Error(`No ondownloadfile handler set`);return this._ondownloadfile(e,t)})}get onrequestteardown(){return this.getEventHandler(`requestteardown`)}set onrequestteardown(e){this.setEventHandler(`requestteardown`,e)}_onrequestdisplaymode;get onrequestdisplaymode(){return this._onrequestdisplaymode}set onrequestdisplaymode(e){this.warnIfRequestHandlerReplaced(`onrequestdisplaymode`,this._onrequestdisplaymode,e),this._onrequestdisplaymode=e,this.replaceRequestHandler(`ui/request-display-mode`,{params:fc.shape.params,result:pc},async(e,t)=>{if(!this._onrequestdisplaymode)throw Error(`No onrequestdisplaymode handler set`);return this._onrequestdisplaymode(e,t)})}get onloggingmessage(){return this.getEventHandler(`loggingmessage`)}set onloggingmessage(e){this.setEventHandler(`loggingmessage`,e)}_onupdatemodelcontext;get onupdatemodelcontext(){return this._onupdatemodelcontext}set onupdatemodelcontext(e){this.warnIfRequestHandlerReplaced(`onupdatemodelcontext`,this._onupdatemodelcontext,e),this._onupdatemodelcontext=e,this.replaceRequestHandler(`ui/update-model-context`,{params:vc.shape.params,result:$t},async(e,t)=>{if(!this._onupdatemodelcontext)throw Error(`No onupdatemodelcontext handler set`);return this._onupdatemodelcontext(e,t)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced(`oncalltool`,this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler(`tools/call`,async(e,t)=>{if(!this._oncalltool)throw Error(`No oncalltool handler set`);return this._oncalltool(e.params,t)})}_oncreatesamplingmessage;get oncreatesamplingmessage(){return this._oncreatesamplingmessage}set oncreatesamplingmessage(e){this.warnIfRequestHandlerReplaced(`oncreatesamplingmessage`,this._oncreatesamplingmessage,e),this._oncreatesamplingmessage=e,this.replaceRequestHandler(`sampling/createMessage`,async(e,t)=>{if(!this._oncreatesamplingmessage)throw Error(`No oncreatesamplingmessage handler set`);return this._oncreatesamplingmessage(e.params,t)})}sendToolListChanged(e={}){return this.notification({method:`notifications/tools/list_changed`,params:e})}_onlistresources;get onlistresources(){return this._onlistresources}set onlistresources(e){this.warnIfRequestHandlerReplaced(`onlistresources`,this._onlistresources,e),this._onlistresources=e,this.replaceRequestHandler(`resources/list`,async(e,t)=>{if(!this._onlistresources)throw Error(`No onlistresources handler set`);return this._onlistresources(e.params,t)})}_onlistresourcetemplates;get onlistresourcetemplates(){return this._onlistresourcetemplates}set onlistresourcetemplates(e){this.warnIfRequestHandlerReplaced(`onlistresourcetemplates`,this._onlistresourcetemplates,e),this._onlistresourcetemplates=e,this.replaceRequestHandler(`resources/templates/list`,async(e,t)=>{if(!this._onlistresourcetemplates)throw Error(`No onlistresourcetemplates handler set`);return this._onlistresourcetemplates(e.params,t)})}_onreadresource;get onreadresource(){return this._onreadresource}set onreadresource(e){this.warnIfRequestHandlerReplaced(`onreadresource`,this._onreadresource,e),this._onreadresource=e,this.replaceRequestHandler(`resources/read`,async(e,t)=>{if(!this._onreadresource)throw Error(`No onreadresource handler set`);return this._onreadresource(e.params,t)})}sendResourceListChanged(e={}){return this.notification({method:`notifications/resources/list_changed`,params:e})}_onlistprompts;get onlistprompts(){return this._onlistprompts}set onlistprompts(e){this.warnIfRequestHandlerReplaced(`onlistprompts`,this._onlistprompts,e),this._onlistprompts=e,this.replaceRequestHandler(`prompts/list`,async(e,t)=>{if(!this._onlistprompts)throw Error(`No onlistprompts handler set`);return this._onlistprompts(e.params,t)})}sendPromptListChanged(e={}){return this.notification({method:`notifications/prompts/list_changed`,params:e})}getCapabilities(){return this._hostCapabilities}async _onAppsInitialize(e){let t=e.protocolVersion;return this._appInfo!==void 0&&console.warn(`[ext-apps] AppBridge received a second ui/initialize. The View may be double-mounting (e.g. React StrictMode in dev) without closing the previous App instance. Responding normally; the latest appInfo/appCapabilities replace the previous values.`),this._appCapabilities=e.appCapabilities,this._appInfo=e.appInfo,{protocolVersion:Sc.includes(t)?t:Gs,hostCapabilities:this.getCapabilities(),hostInfo:this._hostInfo,hostContext:this._hostContext}}setHostContext(e){let t={},n=!1;for(let r of Object.keys(e)){let i=this._hostContext[r],a=e[r];wc(i,a)||(t[r]=a,n=!0)}n&&(this._hostContext=e,this.sendHostContextChange(t))}sendHostContextChange(e){return this.notification({method:`ui/notifications/host-context-changed`,params:e})}sendToolInput(e){return this.notification({method:`ui/notifications/tool-input`,params:e})}sendToolInputPartial(e){return this.notification({method:`ui/notifications/tool-input-partial`,params:e})}sendToolResult(e){return this.notification({method:`ui/notifications/tool-result`,params:e})}sendToolCancelled(e){return this.notification({method:`ui/notifications/tool-cancelled`,params:e})}sendSandboxResourceReady(e){return this.notification({method:`ui/notifications/sandbox-resource-ready`,params:e})}teardownResource(e,t){return this.request({method:`ui/resource-teardown`,params:e},oc,t)}sendResourceTeardown=this.teardownResource;callTool(e,t){return this.request({method:`tools/call`,params:e},t)}listTools(e,t){return this.request({method:`tools/list`,params:e},t)}async connect(e){if(this.transport)throw Error(`AppBridge is already connected. Call close() before connecting again.`);if(this._initializedReceived=!1,this._client){let e=this._client.getServerCapabilities();if(!e)throw Error(`Client server capabilities not available`);e.tools&&(this.oncalltool=async(e,t)=>this._client.request({method:`tools/call`,params:e},{signal:t.mcpReq.signal}),e.tools.listChanged&&this._client.setNotificationHandler(`notifications/tools/list_changed`,e=>this.sendToolListChanged(e.params))),e.resources&&(this.onlistresources=async(e,t)=>this._client.request({method:`resources/list`,params:e},{signal:t.mcpReq.signal}),this.onlistresourcetemplates=async(e,t)=>this._client.request({method:`resources/templates/list`,params:e},{signal:t.mcpReq.signal}),this.onreadresource=async(e,t)=>this._client.request({method:`resources/read`,params:e},{signal:t.mcpReq.signal}),e.resources.listChanged&&this._client.setNotificationHandler(`notifications/resources/list_changed`,e=>this.sendResourceListChanged(e.params))),e.prompts&&(this.onlistprompts=async(e,t)=>this._client.request({method:`prompts/list`,params:e},{signal:t.mcpReq.signal}),e.prompts.listChanged&&this._client.setNotificationHandler(`notifications/prompts/list_changed`,e=>this.sendPromptListChanged(e.params)))}return super.connect(e)}};function wc(e,t){return JSON.stringify(e)===JSON.stringify(t)}var Tc=1200,Ec=`po.openai`;function Dc(e){return e instanceof Error?e.message:`The MCP App could not complete this request`}function Oc(e){if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`Invalid App request`);return e}function kc(e,t){if(e.contentWindow===null)throw Error(`MCP App frame is not mounted`);let{data:n}=t,r=!0,i,a=new MessageChannel,o=(e,n)=>r?t.request(e,n):Promise.reject(Error(`MCP App is closed`)),s=e=>{typeof e==`number`&&Number.isFinite(e)&&t.resize(Math.min(Tc,Math.max(80,Math.ceil(e))))},c=n=>{r&&(t.fail(Dc(n)),r=!1,e.srcdoc=``,l().catch(e=>{t.fail(`${Dc(n)}. Closing the App lease failed: ${Dc(e)}`)}))},l=()=>t.request(`close`,{}),u=setTimeout(()=>c(Error(`MCP App initialization timed out`)),15e3),d=()=>{r&&(clearTimeout(u),t.ready())},f=async(e,t)=>{if(n.readOnly)throw Error(`Enable interactions in the conversation before calling tools`);if(typeof e!=`string`)throw Error(`Invalid App tool name`);return await o(`callTool`,{name:e,arguments:Oc(t??{})})},p=async e=>(await o(`setState`,{state:e}),t.saveState(e),{}),m=async e=>{if(n.readOnly)throw Error(`Enable interactions in the conversation before sending a follow-up`);if(typeof e!=`string`)throw Error(`Invalid App follow-up`);return await o(`followUp`,{prompt:e}),{}},h=async()=>(await o(`close`,{}),t.close(),{}),g=t.theme,_=g,v={toolInput:n.args,toolOutput:n.result.structuredContent??null,toolResponseMetadata:n.result._meta??{},widgetState:t.savedState,theme:g,locale:t.locale,displayMode:`inline`,maxHeight:Tc,safeArea:{insets:{top:0,right:0,bottom:0,left:0}},userAgent:{device:{type:t.device},capabilities:{hover:t.hover??!1,touch:t.touch??!1}}};try{let o=lt(n.resourceMeta,t.hostOrigin);n.protocol===`mcp`&&(i=new Cc(null,{name:`Po`,version:`1`},{...n.readOnly?{}:{serverTools:{},message:{text:{}}},openLinks:{}},{hostContext:{theme:g,locale:t.locale,displayMode:`inline`,availableDisplayModes:[`inline`],toolInfo:{id:t.toolCallId,tool:n.tool}}}),i.oncalltool=({name:e,arguments:t})=>f(e,t),i.onmessage=async({content:e})=>{if(e.some(e=>e.type!==`text`))throw Error(`Only text follow-ups are supported`);return m(e.map(e=>e.type===`text`?e.text:``).join(`
|
|
48
|
-
`))},i.onopenlink=({url:e})=>t.openLink(e),i.onsizechange=({height:e})=>s(e),i.onrequestdisplaymode=async()=>({mode:`inline`}),i.onrequestteardown=()=>{h().catch(c)},i.oninitialized=()=>{(async()=>{await i.sendToolInput({arguments:n.args}),await i.sendToolResult(n.result),d()})().catch(c)},i.connect(new xc(e.contentWindow,e.contentWindow)).catch(c)),a.port1.onmessage=e=>{if(!r)return;let i=e.data;if(i?.type===`revoked`){c(Error(`MCP App navigation was blocked; reopen it to continue`));return}if(i?.type!==`legacy`)return;let o=i.data;o?.channel===Ec&&(async()=>{let e=Oc(o.input??{});switch(o.method){case`initialized`:{d();let e=_;return e!==g&&a.port1.postMessage({channel:Ec,globals:{theme:e}}),{}}case`height`:return s(e.height),{};case`callTool`:return f(e.name,e.arguments);case`setState`:return p(e.state);case`followUp`:return m(e.prompt);case`openLink`:return t.openLink(e.url);case`close`:return h();default:throw Error(`Unsupported ChatGPT widget method`)}})().then(e=>{if(!r||o.id===void 0)return;let t=o.method===`callTool`&&n.protocol===`openai`?e:void 0;a.port1.postMessage({channel:Ec,id:o.id,result:e,...t===void 0?{}:{globals:{toolOutput:t.structuredContent??null,toolResponseMetadata:t._meta??{}}}})},e=>{r&&o.id!==void 0&&a.port1.postMessage({channel:Ec,id:o.id,error:Dc(e)})})},a.port1.start();let l=()=>{e.contentWindow?.postMessage({html:ht(n.html,o,vt(v),g),policy:o,protocol:n.protocol},`*`,[a.port2])};return e.addEventListener(`load`,l,{once:!0}),e.srcdoc=mt(o,g),{setTheme:e=>{_=e,i?.setHostContext({theme:e}),a.port1.postMessage({channel:Ec,globals:{theme:e}})},dispose:()=>{r=!1,clearTimeout(u),e.removeEventListener(`load`,l),a.port1.close(),a.port2.close(),i!==void 0&&i.close().catch(e=>t.fail(Dc(e))),e.srcdoc=``}}}catch(e){return c(e),{setTheme:()=>{},dispose:()=>{clearTimeout(u),a.port1.close(),a.port2.close()}}}}var Ac=`po-mcp-session-approval`;function jc(e){if(e===void 0||e.trim()===``)return;let t;try{t=JSON.parse(e)}catch{return}if(typeof t!=`object`||!t||Array.isArray(t))return;let n=t,r=Object.keys(n).sort();if(r.length===2&&r[0]===`host`&&r[1]===`session`&&typeof n.host==`boolean`&&typeof n.session==`boolean`)return{host:n.host,session:n.session}}var Mc=RegExp(`\x1B\\[[0-?]*[ -/]*[@-~]`,`gu`),Nc=128,Pc=8192,Fc=512,Ic=256,Lc=64,Rc=/^[A-Za-z0-9._-]{1,64}$/u,zc=[`not-connected`,`connecting`,`connected`,`degraded`,`needs-auth`,`failed`,`closed`,`disabled`];function Bc(e){return zc.some(t=>t===e)}var Vc=`/tool`,Hc=`server`,Uc=`tool`,Wc=`/secrets`;function Gc(e){if(e!==void 0&&e.trim()!==``)try{let t=JSON.parse(e.replace(Mc,``));if(!Array.isArray(t)||t.length===0||t.length>Nc)return;let n=new Set;for(let e of t){if(!$c(e)||n.has(e.name))return;n.add(e.name)}return t}catch{return}}function Kc(e){for(let t of e){let e=t.codePointAt(0);if(e!==void 0&&(e<32||e>=127&&e<=159))return!0}return!1}function qc(e){if(typeof e!=`string`||e.length>Pc||Kc(e))return!1;try{let t=new URL(e);return(t.protocol===`http:`||t.protocol===`https:`)&&t.username===``&&t.password===``}catch{return!1}}function Jc(e){return typeof e==`string`&&e.trim()!==``&&e.length<=Ic&&!Kc(e)}function Yc(e){return typeof e==`string`&&Rc.test(e)}function Xc(e){return typeof e==`number`&&Number.isInteger(e)&&e>=0}function Zc(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return Object.keys(t).every(e=>e===`name`||e===`piName`||e===`tokens`)&&Jc(t.name)&&(!(`piName`in t)||Jc(t.piName))&&(!(`tokens`in t)||Xc(t.tokens))}function Qc(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return Object.keys(t).every(e=>[`owner`,`canEdit`,`canRemove`,`revision`,`target`,`kind`].includes(e))&&[`host`,`repository`,`read-only`].includes(String(t.owner))&&typeof t.canEdit==`boolean`&&typeof t.canRemove==`boolean`&&(!(`revision`in t)||typeof t.revision==`string`&&/^[a-f0-9]{64}$/u.test(t.revision))&&(!(`target`in t)||typeof t.target==`string`&&t.target.length<=2048&&!Kc(t.target))&&(!(`kind`in t)||t.kind===`local`||t.kind===`remote`)&&(!(t.canEdit||t.canRemove)||t.owner!==`read-only`&&typeof t.revision==`string`)}function $c(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return Object.keys(t).every(e=>e===`management`||e===`name`||e===`state`||e===`authorizationUrl`||e===`tools`||e===`missingSecrets`||e===`oauthEligible`||e===`oauthAuthorized`)&&(!(`management`in t)||Qc(t.management))&&(!(`oauthEligible`in t)||typeof t.oauthEligible==`boolean`)&&(!(`oauthAuthorized`in t)||typeof t.oauthAuthorized==`boolean`)&&(!(`missingSecrets`in t)||Array.isArray(t.missingSecrets)&&t.missingSecrets.length<=Lc&&t.missingSecrets.every(Yc))&&(!(`authorizationUrl`in t)||qc(t.authorizationUrl))&&(!(`tools`in t)||Array.isArray(t.tools)&&t.tools.length<=Fc&&t.tools.every(Zc))&&typeof t.name==`string`&&t.name.trim()!==``&&!Kc(t.name)&&Bc(t.state)}var el=`/repository`,tl=`/repository/discover`,nl=`/repository/authorize`,rl=`/repository/secrets`,il=`repositoryId`,al=`flowId`,ol=`/servers`,sl=`/servers/host`,cl=`/settings`;function ll(e){return e}var ul=`${nl}/:${al}`,dl={catalog:{method:`GET`,path:el,query:[il],response:void 0},discover:{method:`POST`,path:tl,response:void 0},authorize:{method:`POST`,path:nl,response:void 0},repositorySecret:{method:`POST`,path:rl,response:void 0},readAuthorization:{method:`GET`,path:ul,query:[il],response:void 0},cancelAuthorization:{method:`DELETE`,path:ul,query:[il],response:void 0},addServer:{method:`POST`,path:ol,response:void 0},editServer:{method:`PATCH`,path:ol,response:void 0},removeServer:{method:`DELETE`,path:ol,response:void 0},hostServers:{method:`GET`,path:sl,response:void 0},readSettings:{method:`GET`,path:cl,response:void 0},saveSettings:{method:`PUT`,path:cl,response:void 0},sessionTool:{method:`GET`,path:Vc,query:[Hc,Uc],response:void 0},sessionSecret:{method:`POST`,path:Wc,response:void 0}},fl=ne(dl,{scopes:[`host`,`workspace`,`session`],basePath:`mcp`,transport:(e,t)=>n.fetch(e,t),sessionAddress:ee}),pl=ne(dl,{scopes:[`session`],basePath:`mcp-session`,transport:(e,t)=>n.fetch(e,t),sessionAddress:ee}),ml={"content-type":`application/json`};function hl(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function gl(e,t){let n;try{n=await e.json()}catch{n=void 0}return e.ok?{value:n}:{error:hl(n)&&typeof n.error==`string`?n.error:t}}async function _l(e,t){let n=fl.workspace(t).catalog;return await gl(await e(n.url({query:{[il]:t}})),`The synced MCP catalog could not be read.`)}async function vl(e,t){let n=fl.workspace(t).discover;return await gl(await e(n.url(),{method:n.spec.method,headers:ml,body:JSON.stringify({repositoryId:t})}),`MCP discovery could not be completed.`)}async function yl(e,t,n){let r=fl.workspace(t).authorize;return await gl(await e(r.url(),{method:r.spec.method,headers:ml,body:JSON.stringify({repositoryId:t,serverName:n})}),`MCP authorization could not be started.`)}async function bl(e,t,n){let r=fl.workspace(t).readAuthorization;return await gl(await e(r.url({params:{[al]:n},query:{[il]:t}})),`The authorization state could not be read.`)}async function xl(e,t,n){let r=fl.workspace(t).cancelAuthorization;return await gl(await e(r.url({params:{[al]:n},query:{[il]:t}}),{method:r.spec.method}),`The authorization flow could not be cancelled.`)}async function Sl(e,t){let n=t.scope===`repository`&&t.repositoryId?fl.workspace(t.repositoryId).addServer:fl.host.addServer;return await gl(await e(n.url(),{method:n.spec.method,headers:ml,body:JSON.stringify({...t,scope:ll(t.scope)})}),`The server could not be added.`)}async function Cl(e,t,n){let r=n.repositoryId?fl.workspace(n.repositoryId):fl.host,i=t===`edit`?r.editServer:r.removeServer;return await gl(await e(i.url(),{method:i.spec.method,headers:ml,body:JSON.stringify({...n,scope:ll(n.scope)})}),`The saved definition could not be changed.`)}async function wl(e){let t=fl.host.hostServers;return await gl(await e(t.url()),`Your MCP servers could not be read.`)}async function Tl(e){let t=fl.host.readSettings;return await gl(await e(t.url()),`Your MCP settings could not be read.`)}async function El(e,t){let n=fl.host.saveSettings;return await gl(await e(n.url(),{method:n.spec.method,headers:ml,body:JSON.stringify(t)}),`Your MCP settings could not be saved.`)}var Dl={kind:`repository`},Ol=`repository`,kl=`plugin:`;function Al(e){switch(e.kind){case`repository`:return`Workspace (.mcp.json)`;case`host`:return`Your personal config (~/.po/mcp.json)`;case`plugin`:return`Plugin ${e.pluginName} (.mcp.json)`;case`upstream`:return`Upstream (mcp-config.yaml)`}}function jl(e){if(!e?.source)return;let t=Al(e.source);return e.owner===`read-only`?e.readOnlyReason?`${t}, read-only: ${e.readOnlyReason}`:`${t}, read-only.`:`${t}.`}function Ml(e){return[Dl,...(e??[]).filter(e=>e.kind===`plugin`)]}function Nl(e){return e.kind===`repository`?`This workspace (.mcp.json)`:`Plugin ${e.pluginName} (.mcp.json)`}function Pl(e){return e.kind===`repository`?Ol:`${kl}${e.pluginId}`}function Fl(e,t){return e.find(e=>Pl(e)===t)}function Il(e){return e.owner===`plugin`&&e.source?.kind===`plugin`?{kind:`plugin`,pluginId:e.source.pluginId}:void 0}var Ll=/^[A-Za-z0-9_-]+$/,Rl=/key|token|secret/i;function zl(e){return e.toLowerCase()===`authorization`||Rl.test(e)}function Bl(e){return e.kind===`repository`?Vl.repository:`Sessions that load the ${e.pluginName} plugin can use it after you add it. It's saved to that plugin's .mcp.json in this repository.`}var Vl={repository:`Sessions in this repository can use it after you add it. It's saved to .mcp.json in this repository.`,host:`Sessions in every repository can use it after you add it. It's saved to your personal config, ~/.po/mcp.json.`};function Hl(e,t){let n=e.split(`
|
|
49
|
-
`).map(e=>e.trim()).filter(Boolean).map(e=>{let n=e.indexOf(t);return n>0?[e.slice(0,n).trim(),e.slice(n+1).trim()]:[e,``]});return n.length>0?Object.fromEntries(n):void 0}function Ul(e){try{let t=new URL(e).protocol;return t===`https:`||t===`http:`}catch{return!1}}function Wl({open:n,onOpenChange:a,onCloseAutoFocus:c,scope:u,targets:f,existingNames:p,onSubmit:m,pending:v=!1,error:y,defaultValues:S={}}){let C=u===`repository`?Ml(f):[],[w,ee]=A(S.target??Pl({kind:`repository`})),T=Fl(C,w)??C[0],ne=T?.kind===`plugin`?{kind:`plugin`,pluginId:T.pluginId}:void 0,[D,ie]=A(S.kind??`remote`),[de,fe]=A(S.name??``),[pe,me]=A(S.url??``),[he,ge]=A(S.headers??``),[_e,ve]=A(S.command??``),[ye,be]=A(S.args??``),[xe,Se]=A(S.env??``),[Ce,we]=A(S.trusted??!1),[Te,Ee]=A(S.vault??{}),De=e=>Te[e]??zl(e),ke=e=>Object.entries(e??{}).filter(([e,t])=>t!==``&&De(e)).map(([e])=>e),Ae=de.trim(),je=Ae===``?void 0:Ll.test(Ae)?p.includes(Ae)?`A server named ${Ae} already exists here.`:void 0:`Use letters, numbers, dashes or underscores.`,k=pe.trim()!==``&&!Ul(pe.trim())?`Enter an http or https address.`:void 0,Ne=Ae!==``&&je===void 0&&(D===`remote`?pe.trim()!==``&&k===void 0:_e.trim()!==``&&Ce),Pe=()=>{if(Ne&&!v){if(D===`remote`){let e=Hl(he,`:`);m({name:Ae,entry:{type:`http`,url:pe.trim(),...e?{headers:e}:{}},trusted:!1,secretFields:ke(e),...ne?{target:ne}:{}})}else{let e=Hl(xe,`=`);m({name:Ae,entry:{command:_e.trim(),args:ye.split(`
|
|
50
|
-
`).map(e=>e.trim()).filter(Boolean),...e?{env:e}:{}},trusted:Ce,secretFields:ke(e),...ne?{target:ne}:{}})}}};return h(ae,{open:n,onOpenChange:a,children:x(_,{"data-testid":`mcp-add-server-dialog`,onCloseAutoFocus:c,children:[h(oe,{className:`items-start px-4 py-4 sm:px-5`,dismissible:!0,children:x(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[h(le,{children:`Add an MCP server`}),h(Me,{children:T?Bl(T):Vl[u]})]})}),x(`form`,{onSubmit:e=>{e.preventDefault(),Pe()},children:[x(l,{className:`gap-4 px-4 py-4 sm:px-5 sm:py-5`,children:[C.length>1?x(`div`,{className:`flex flex-col gap-1.5`,children:[h(O,{htmlFor:`mcp-add-target`,children:`Save to`}),x(se,{value:T?Pl(T):w,onValueChange:ee,children:[h(Le,{id:`mcp-add-target`,"data-testid":`mcp-add-target`,children:h(Oe,{})}),h(ue,{children:C.map(t=>h(e,{value:Pl(t),children:Nl(t)},Pl(t)))})]})]}):null,h(i,{value:D,onValueChange:e=>ie(e===`local`?`local`:`remote`),children:x(d,{"aria-label":`Server kind`,children:[h(E,{value:`remote`,children:`Remote (URL)`}),h(E,{value:`local`,children:`Local command`})]})}),x(`div`,{className:`flex flex-col gap-1.5`,children:[h(O,{htmlFor:`mcp-add-name`,children:`Name`}),h(Ie,{id:`mcp-add-name`,className:`font-mono`,value:de,placeholder:`linear`,"aria-invalid":je!==void 0,"aria-describedby":`mcp-add-name-hint`,onChange:e=>fe(e.target.value)}),h(`p`,{id:`mcp-add-name-hint`,className:`text-sm ${je?`text-po-red`:`text-po-dim`}`,children:je??(Ae?`Tools appear as ${Ae.replace(/[^A-Za-z0-9]/g,`_`)}_tool_name.`:`Tools appear with this name in front.`)})]}),D===`remote`?x(s,{children:[x(`div`,{className:`flex flex-col gap-1.5`,children:[h(O,{htmlFor:`mcp-add-url`,children:`Server URL`}),h(Ie,{id:`mcp-add-url`,type:`url`,className:`font-mono`,value:pe,placeholder:`https://mcp.example.com/mcp`,"aria-invalid":k!==void 0,onChange:e=>me(e.target.value)}),k?h(`p`,{className:`text-sm text-po-red`,children:k}):null]}),x(b,{className:`flex flex-col gap-1.5`,defaultOpen:he!==``,children:[h(r,{asChild:!0,children:x(t,{type:`button`,variant:`ghost`,size:`sm`,className:`group self-start gap-1.5`,children:[h(o,{className:`size-3 transition-transform group-data-[state=open]:rotate-90`}),`Headers (optional)`]})}),x(te,{className:`flex flex-col gap-1.5`,children:[h(g,{"aria-label":`Headers`,className:`font-mono`,rows:3,value:he,placeholder:`Authorization: Bearer ...`,onChange:e=>ge(e.target.value)}),h(`p`,{className:`text-sm text-po-dim`,children:`One header per line, as Name: value.`}),h(Gl,{serverName:Ae,fields:Object.keys(Hl(he,`:`)??{}),keepsInVault:De,onChange:(e,t)=>Ee(n=>({...n,[e]:t}))})]})]}),h(`p`,{className:`text-sm text-po-dim`,children:`If the server uses sign-in, you can authorize it right after adding.`})]}):x(s,{children:[x(`div`,{className:`flex flex-col gap-1.5`,children:[h(O,{htmlFor:`mcp-add-command`,children:`Command`}),h(Ie,{id:`mcp-add-command`,className:`font-mono`,value:_e,placeholder:`npx`,onChange:e=>ve(e.target.value)})]}),x(`div`,{className:`flex flex-col gap-1.5`,children:[h(O,{htmlFor:`mcp-add-args`,children:`Arguments`}),h(g,{id:`mcp-add-args`,className:`font-mono`,rows:3,value:ye,placeholder:`-y
|
|
51
|
-
@modelcontextprotocol/server-filesystem
|
|
52
|
-
.`,onChange:e=>be(e.target.value)}),h(`p`,{className:`text-sm text-po-dim`,children:`One argument per line, so paths with spaces stay whole.`})]}),x(b,{className:`flex flex-col gap-1.5`,defaultOpen:xe!==``,children:[h(r,{asChild:!0,children:x(t,{type:`button`,variant:`ghost`,size:`sm`,className:`group self-start gap-1.5`,children:[h(o,{className:`size-3 transition-transform group-data-[state=open]:rotate-90`}),`Environment variables (optional)`]})}),x(te,{className:`flex flex-col gap-1.5`,children:[h(g,{"aria-label":`Environment variables`,className:`font-mono`,rows:3,value:xe,placeholder:`API_KEY=...`,onChange:e=>Se(e.target.value)}),h(`p`,{className:`text-sm text-po-dim`,children:`One variable per line, as KEY=value.`}),h(Gl,{serverName:Ae,fields:Object.keys(Hl(xe,`=`)??{}),keepsInVault:De,onChange:(e,t)=>Ee(n=>({...n,[e]:t}))})]})]}),x(`div`,{className:`flex flex-col gap-2 rounded-md border border-po-edge-magenta bg-po-tint-magenta px-3 py-3`,children:[h(`p`,{className:`text-base font-semibold text-po-hi`,children:`This runs on your machine`}),h(`p`,{className:`text-sm leading-relaxed text-po-dim`,children:`Po starts this command with your user's permissions whenever a session uses it. Only add commands you trust.`}),x(`div`,{className:`flex items-center gap-2`,children:[h(re,{id:`mcp-add-trust`,checked:Ce,onCheckedChange:e=>we(e===!0)}),h(O,{htmlFor:`mcp-add-trust`,children:`I trust this command`})]})]})]}),y?h(`p`,{role:`alert`,className:`text-sm text-po-red`,children:y}):null]}),x(ce,{className:`border-t border-po-border-soft px-4 py-3 sm:px-5`,children:[h(t,{type:`button`,variant:`ghost`,size:`md`,onClick:()=>a(!1),children:`Cancel`}),h(t,{type:`submit`,variant:`primary`,size:`md`,disabled:!Ne||v,children:v?`Adding...`:`Add server`})]})]})]})})}function Gl({serverName:e,fields:t,keepsInVault:n,onChange:r}){if(t.length===0)return null;let i=(t.find(n)??t[0]??``).replace(/[^A-Za-z0-9._-]/g,`_`),a=`\${vault:${e||`server`}-${i}}`;return x(`div`,{className:`flex flex-col gap-1.5`,children:[h(`ul`,{"aria-label":`Keep in vault`,className:`flex flex-col divide-y divide-po-border-soft rounded-md border border-po-border-soft`,children:t.map((e,t)=>{let i=`mcp-add-vault-${t}`;return x(`li`,{className:`flex min-w-0 items-center gap-2 px-3 py-1.5`,children:[h(`span`,{className:`min-w-0 flex-1 truncate font-mono text-sm text-po-text`,children:e}),h(re,{id:i,checked:n(e),onCheckedChange:t=>r(e,t===!0)}),h(O,{htmlFor:i,children:`Keep in vault`})]},e)})}),x(`p`,{className:`text-sm text-po-dim`,children:[`Kept values stay in Po's vault on this machine. The config only gets a reference, such as`,` `,h(`span`,{className:`font-mono`,children:a}),`.`]})]})}function Kl({scope:e,repositoryId:n,targets:r,existingNames:i,requestWithStepUp:a,disabled:o=!1,onAdded:c,renderTrigger:l,onCloseAutoFocus:u}){let d=v(null),[f,p]=A(!1),[m,g]=A(!1),[_,y]=A(),b=()=>{o||(y(void 0),p(!0))};return x(s,{children:[l?l(b):h(t,{ref:d,variant:`outline`,size:`sm`,disabled:o,"data-testid":`mcp-add-server`,onClick:b,children:`Add server`}),f?h(Wl,{open:!0,onOpenChange:e=>{m||p(e)},onCloseAutoFocus:u??(e=>{e.preventDefault(),d.current?.focus()}),scope:e,targets:r,existingNames:i,pending:m,error:_,onSubmit:({name:t,entry:r,trusted:i,secretFields:o,target:s})=>{g(!0),y(void 0),Sl(a,{scope:e,...n?{repositoryId:n}:{},...e===`repository`&&s?{target:s}:{},name:t,entry:r,trusted:i,...o.length>0?{secretFields:o}:{}}).then(e=>{g(!1),`error`in e?y(e.error):(p(!1),c(t))})}}):null]})}function ql({action:e,name:n,management:r,pending:i,error:a,onClose:o,onCloseAutoFocus:c,onSubmit:u}){let d=D(),[f,p]=A(``),[m,v]=A(!1),[y,b]=A(),S=r.kind===`local`;return h(ae,{open:!0,onOpenChange:e=>{!e&&!i&&o()},children:x(_,{onCloseAutoFocus:c,children:[h(oe,{children:x(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[x(le,{children:[e===`edit`?`Edit`:`Remove`,` `,n]}),h(Me,{children:e===`edit`?`Update headers or environment only. Existing values are retained unless overwritten. Values cannot be deleted here. Saved OAuth credentials are retained.`:`Remove this saved definition? Live connections and credentials are retained. A lower-priority definition may appear. This does not reconnect any session.`})]})}),x(l,{className:`space-y-4`,children:[x(`p`,{className:`break-all text-sm text-po-dim`,children:[r.source?Al(r.source):r.owner,` ·`,` `,S?`Local command`:`Remote`,` · `,r.target]}),e===`edit`?x(s,{children:[h(`p`,{className:`text-sm text-po-dim`,children:`Name, endpoint, transport, command and arguments are fixed. Updates are saved directly in the configuration file, not the vault. Existing values are not shown. Do not enter redacted placeholders or vault references.`}),x(`div`,{className:`space-y-2`,children:[x(O,{htmlFor:d,children:[S?`Environment updates`:`Header updates`,` (one NAME=value per line)`]}),h(g,{id:d,className:`min-h-24 w-full`,value:f,disabled:i,onChange:e=>p(e.target.value),autoComplete:`off`})]}),S?x(O,{className:`flex items-center gap-2`,children:[h(re,{checked:m,disabled:i,onCheckedChange:e=>v(e===!0)}),`I trust this command to run with my permissions.`]}):null]}):null,a||y?h(`p`,{role:`alert`,className:`text-sm text-po-red`,children:a??y}):null]}),x(ce,{className:`border-t border-po-border-soft px-4 py-3`,children:[h(t,{variant:`ghost`,disabled:i,onClick:o,children:`Cancel`}),h(t,{variant:e===`remove`?`danger`:`primary`,loading:i,disabled:i||e===`edit`&&(!f.trim()||S&&!m),onClick:()=>{let e=[];for(let t of f.split(`
|
|
53
|
-
`).filter(e=>e.trim())){let n=t.indexOf(`=`);if(n<1||!t.slice(0,n).trim()||t.includes("${vault:")){b(`Use NAME=value on each line. Vault references cannot be edited here.`);return}e.push([t.slice(0,n).trim(),t.slice(n+1)])}b(void 0),u(Object.fromEntries(e),m)},children:e===`edit`?`Save updates`:`Remove saved definition`})]})]})})}function Jl({name:e,management:n,repositoryId:r,requestWithStepUp:i,disabled:a,onChanged:o,onAuthorize:c,authorizeDisabled:l}){let u=v(null),[d,f]=A(),[p,m]=A(),[g,_]=A(!1),[y,b]=A(),S=n&&n.owner!==`read-only`&&n.revision,C=!!(S&&n.canEdit&&n.target&&n.kind),w=!!(S&&n.canRemove);return x(s,{children:[x(he,{children:[h(ke,{asChild:!0,children:h(t,{ref:u,variant:`ghost`,size:`icon`,"aria-label":`Actions for ${e}`,disabled:a||g,children:h(Fe,{"aria-hidden":!0,className:`size-4`})})}),x(De,{align:`end`,children:[c?h(Ne,{disabled:a||l,onSelect:c,children:`Authorize`}):null,h(Ne,{disabled:!C,onSelect:()=>{b(void 0),C&&n&&(m({...n,name:e,repositoryId:r}),f(`edit`))},children:`Edit`}),h(xe,{}),h(Ne,{disabled:!w,onSelect:()=>{b(void 0),w&&n&&(m({...n,name:e,repositoryId:r}),f(`remove`))},children:`Remove`})]})]}),d&&p?h(ql,{action:d,name:p.name,management:p,pending:g,error:y,onClose:()=>f(void 0),onCloseAutoFocus:e=>{e.preventDefault(),u.current?.focus()},onSubmit:async(t,n)=>{if(p.name!==e||p.repositoryId!==r)b(`The selected repository or server changed. Close this dialog and try again.`);else if(!(g||!p.revision||p.owner===`read-only`||(d===`edit`?!C:!w))){_(!0),b(void 0);try{let a=Il(p),s=await Cl(i,d,{scope:p.owner===`host`?`host`:`repository`,repositoryId:r,...a?{target:a}:{},name:e,revision:p.revision,...d===`edit`?{trusted:n,entry:p.kind===`local`?{command:p.target,env:t}:{type:`http`,url:p.target,headers:t}}:{}});if(`error`in s){b(s.error);return}f(void 0);let c=s.value;o(`${d===`remove`?`Saved definition removed.`:`Saved definition updated.`} Live connections and credentials retained.${c.syncRequired?` Run po sync, then refresh.`:``} ${c.shadowedDefinition===`present`?`A lower-priority definition is now visible.`:c.shadowedDefinition===`possible`?`A lower-priority definition may appear.`:`No lower-priority definition was reported.`}`,d===`remove`)}catch(e){b(e instanceof Error?e.message:`The saved definition could not be changed.`)}finally{_(!1)}}}}):null]})}var Yl=`mcp-auto-approve`,Xl=`mcp-auto-approve-help`;function Zl({checked:e,busy:n,error:r,onCheckedChange:i,onRetry:a}){return x(ve,{"data-testid":`mcp-approval-settings`,children:[h(ze,{children:h(Be,{children:`Approval`})}),h(pe,{children:`Po asks before running an MCP tool that could change your data. Tools a server marks read-only always run straight away.`}),h(je,{children:x(ge,{changed:e,children:[x(Ee,{children:[h(be,{children:h(`label`,{htmlFor:Yl,children:`Run tools that change data without asking`})}),h(k,{id:Xl,children:e?`On for every session, including ones already open. Turn it off to be asked again.`:`Applies to every session at once. Subagents and background work never ask.`}),r?h(k,{role:`alert`,className:`text-po-red`,children:r}):null]}),r&&a?h(t,{variant:`outline`,size:`sm`,onClick:a,children:`Try again`}):null,h(m,{id:Yl,"data-testid":`mcp-auto-approve-switch`,"aria-describedby":Xl,checked:e,disabled:n,"aria-busy":n||void 0,onCheckedChange:i})]})})]})}function Ql({request:e,requestWithStepUp:t}){let[n,r]=A({status:`loading`}),i=a(async()=>{let t=await Tl(e);r(`error`in t?{status:`load-failed`}:{status:`ready`,checked:t.value.autoApproveDestructiveTools})},[e]);f(()=>{i()},[i]);let o=a(async(e,n)=>{r({status:`ready`,checked:e,saving:!0});let i=await El(t,{autoApproveDestructiveTools:e});r(`error`in i?{status:`ready`,checked:n,failedTarget:e}:{status:`ready`,checked:i.value.autoApproveDestructiveTools})},[t]);if(n.status!==`ready`)return h(Zl,{checked:!1,busy:!0,error:n.status===`load-failed`?`Po couldn't read this setting just now.`:void 0,onRetry:()=>void i()});let{checked:s,saving:c,failedTarget:l}=n;return h(Zl,{checked:s,busy:c,error:l===void 0?void 0:l?`Po couldn't save this just now, so sessions still ask first.`:`Po couldn't save this just now, so sessions still run these tools without asking.`,onCheckedChange:e=>void o(e,s),onRetry:l===void 0?void 0:()=>void o(l,s)})}function $l({request:e,requestWithStepUp:n}){let r=v(null),[i,o]=A(),[s,c]=A({status:`loading`}),l=a(async()=>{let t=await wl(e);c(`error`in t?{status:`error`,error:t.error}:{status:`ready`,servers:t.value.servers})},[e]);f(()=>{l()},[l]);let u=s.status===`ready`?s.servers:[];return x(ve,{ref:r,tabIndex:-1,"data-testid":`mcp-host-settings`,children:[x(ze,{children:[h(Be,{children:`Servers`}),h(me,{children:h(Kl,{scope:`host`,existingNames:u.map(e=>e.name),requestWithStepUp:n,disabled:s.status===`loading`,onAdded:()=>void l()})})]}),i?h(`output`,{className:`text-sm text-po-dim`,children:i}):null,h(je,{asChild:!0,children:h(`ul`,{children:s.status===`error`?h(ge,{asChild:!0,role:`alert`,children:x(`li`,{children:[x(Ee,{children:[h(be,{children:`Po couldn't read your servers just now`}),h(k,{children:s.error})]}),h(t,{variant:`outline`,size:`sm`,onClick:()=>void l(),children:`Try again`})]})}):u.length===0?h(ge,{asChild:!0,children:h(`li`,{children:x(Ee,{children:[h(be,{children:s.status===`loading`?`Reading your servers`:`No servers yet`}),h(k,{children:s.status===`loading`?`This takes a moment.`:`Servers you add here are available in every repository.`})]})})}):u.map(e=>h(ge,{asChild:!0,children:x(`li`,{"data-testid":`mcp-host-server-${e.name}`,children:[x(Ee,{children:[h(be,{className:`font-mono first-letter:normal-case`,children:e.name}),x(k,{className:`truncate`,children:[e.kind===`remote`?`Remote`:`Local command`,` · `,e.target]})]}),h(Jl,{name:e.name,management:e.management,requestWithStepUp:n,onChanged:(e,t)=>{o(e),l().then(()=>{t&&r.current?.focus()})}})]})},e.name))})})]})}function eu(e){return x(`div`,{className:`flex flex-col gap-8`,children:[h(Ql,{...e}),h($l,{...e})]})}var tu=y({label:`MCP servers`,detail:`Your own MCP servers, available in every repository. A repository server with the same name wins.`,icon:Ae,component:eu}),nu=new Ce({repositoryId:void 0,catalog:void 0,authorization:void 0,busy:void 0,error:void 0});function ru(e){nu.state.repositoryId!==e&&nu.setState(()=>({repositoryId:e,catalog:void 0,authorization:void 0,busy:void 0,error:void 0}))}function iu(e,t){nu.state.repositoryId===e&&nu.setState(t)}async function au(e,t){ru(t),nu.setState(e=>({...e,busy:`loading`,error:void 0}));try{let n=await _l(e,t);iu(t,e=>`error`in n?{...e,busy:void 0,error:n.error}:{...e,busy:void 0,catalog:n.value,error:void 0})}catch{iu(t,e=>({...e,busy:void 0,error:`The cockpit hub is unreachable.`}))}}async function ou(e,t){ru(t),nu.setState(e=>({...e,busy:`discovering`,error:void 0}));try{let n=await vl(e,t);iu(t,e=>`error`in n?{...e,busy:void 0,error:n.error}:{...e,busy:void 0,catalog:n.value,error:void 0})}catch{iu(t,e=>({...e,busy:void 0,error:`The cockpit hub is unreachable.`}))}}async function su(e,t,n){ru(t),nu.setState(e=>({...e,busy:`authorizing`,error:void 0}));try{let r=await yl(e,t,n);iu(t,e=>`error`in r?{...e,busy:void 0,error:r.error}:{...e,busy:void 0,authorization:r.value,error:void 0})}catch{iu(t,e=>({...e,busy:void 0,error:`The cockpit hub is unreachable.`}))}}function cu(e,t,n,r){let i=!1,a,o=async()=>{if(!i)try{let s=await bl(e,t,n);if(i)return;if(`error`in s){iu(t,e=>({...e,error:s.error}));return}if(iu(t,e=>({...e,authorization:s.value,error:void 0})),s.value.status===`completed`){r();return}if([`failed`,`cancelled`,`expired`].includes(s.value.status))return;a=setTimeout(()=>void o(),1e3)}catch{iu(t,e=>({...e,error:`The authorization status could not be refreshed.`}))}};return o(),()=>{i=!0,a&&clearTimeout(a)}}async function lu(e,t,n){nu.setState(e=>({...e,busy:`cancelling`,error:void 0}));try{let r=await xl(e,t,n);iu(t,e=>`error`in r?{...e,busy:void 0,error:r.error}:{...e,busy:void 0,authorization:r.value,error:void 0})}catch{iu(t,e=>({...e,busy:void 0,error:`The cockpit hub is unreachable.`}))}}var uu=new Set([`completed`,`failed`,`cancelled`,`expired`]),du={"never-synced":`this repository has never been synced`,"configuration-changed":`the configuration changed since the last sync`,"cockpit-bundle-missing":`the cockpit bundle is missing`,"package-apis-missing":`package APIs are missing`},fu={"not-connected":`Not connected`,connecting:`Connecting`,connected:`Connected`,degraded:`Degraded`,"needs-auth":`Needs sign-in`,failed:`Failed`,closed:`Closed`},pu={starting:`Starting sign-in.`,waiting:`Waiting for you to finish signing in.`,completed:`Signed in.`,failed:`Sign-in didn't finish.`,cancelled:`Sign-in was cancelled.`,expired:`Sign-in expired before it finished.`};function mu(e){return`${e.map(e=>du[e]??e).join(`, `)||`the last sync is out of date`}. Run po sync, then refresh.`}function hu({server:e,busy:n,canAct:r,confirming:i,onAuthorize:a,repositoryId:s,requestWithStepUp:c,onChanged:l,onConfirm:u,onCancel:d}){let f=e.tools.length,p=jl(e.management);return h(ge,{asChild:!0,className:`items-start`,children:x(`li`,{"data-testid":`mcp-server-${e.name}`,children:[x(Ee,{children:[h(be,{className:`font-mono first-letter:normal-case`,children:e.name}),x(k,{children:[fu[e.state],`. `,e.credentialPresent?`Credential saved.`:`No credential saved.`]}),p===void 0?null:h(k,{"data-testid":`mcp-server-source-${e.name}`,children:p}),e.error===void 0?null:h(k,{className:`text-po-red`,children:e.error})]}),i?null:h(Jl,{name:e.name,management:e.management,repositoryId:s,requestWithStepUp:c,disabled:n,onChanged:l,onAuthorize:a,authorizeDisabled:!r}),i?x(`div`,{className:`flex basis-full flex-wrap items-center gap-x-4 gap-y-2 rounded-md bg-po-bg px-4 py-3`,children:[x(`span`,{className:`min-w-0 flex-1 text-base leading-relaxed text-po-text`,children:[`Start a short OAuth sign-in for `,e.name,`? A passkey may be required.`]}),x(me,{children:[h(t,{variant:`primary`,size:`sm`,disabled:n,onClick:u,children:`Continue`}),h(t,{variant:`ghost`,size:`sm`,onClick:d,children:`Cancel`})]})]}):null,x(`details`,{className:`group basis-full`,children:[x(`summary`,{className:`flex w-fit cursor-pointer list-none items-center gap-1 text-base font-medium text-po-text hover:text-po-hi [&::-webkit-details-marker]:hidden`,children:[h(o,{"aria-hidden":!0,className:`size-3.5 transition-transform group-open:rotate-90`}),f===1?`1 tool`:`${String(f)} tools`,`, `,e.source]}),h(`ul`,{className:`mt-3 flex flex-col gap-1.5 border-l border-po-border-soft pl-4`,children:f===0?h(`li`,{className:`text-sm text-po-dim`,children:`Run discovery to see what this server offers.`}):e.tools.map(e=>x(`li`,{className:`flex min-w-0 items-baseline gap-3 text-base`,children:[h(`code`,{title:e.piName,className:`min-w-0 shrink-0 truncate font-mono text-po-hi`,children:e.piName}),h(`span`,{className:`min-w-0 truncate text-po-dim`,children:e.description??``})]},e.piName))})]})]})})}function gu({repository:e,request:n,requestWithStepUp:r}){let i=w(nu),[a,o]=A(),s=v(null),[c,l]=A(!1),[u,d]=A(),p=e?.id;f(()=>{l(!1),d(void 0),o(void 0),p&&au(n,p)},[p,n]);let m=i.repositoryId===p?i.authorization:void 0,g=m?.id,_=m?.status;if(f(()=>{if(p&&g!==void 0&&!(_!==void 0&&uu.has(_)))return cu(n,p,g,()=>{au(n,p)})},[g,_,p,n]),!e)return h(je,{"data-testid":`mcp-repository-settings`,children:h(ge,{children:x(Ee,{children:[h(be,{children:`No repository picked`}),h(k,{children:`Pick a repository above to see its MCP servers.`})]})})});let y=i.repositoryId===e.id?i.catalog:void 0,b=i.repositoryId===e.id?i.busy:void 0,S=i.repositoryId===e.id?i.error:void 0,C=y?.sync.fresh===!0,ee=y?.servers??[],te=y?.droppedServers??[];return x(`div`,{className:`flex min-w-0 flex-col gap-10`,"data-testid":`mcp-repository-settings`,children:[x(ve,{children:[h(ze,{children:h(Be,{children:`Catalog`})}),x(je,{children:[x(ge,{children:[x(Ee,{children:[h(be,{children:C?`Up to date`:y?`Needs a sync`:`Reading the catalog`}),h(k,{children:C?`Po reads the cached catalog on this machine. Discovery contacts each configured server.`:y?mu(y.sync.reasons):`Reading what the last sync recorded.`})]}),h(Kl,{scope:`repository`,repositoryId:e.id,targets:y?.targets,existingNames:ee.map(e=>e.name),requestWithStepUp:r,disabled:b!==void 0,onAdded:()=>void au(n,e.id),onCloseAutoFocus:e=>{e.preventDefault(),s.current?.focus()},renderTrigger:r=>x(he,{children:[h(ke,{asChild:!0,children:h(t,{ref:s,variant:`ghost`,size:`icon`,"aria-label":`Catalog actions`,title:`Catalog actions`,disabled:b!==void 0,children:h(Fe,{"aria-hidden":!0,className:`size-4`})})}),x(De,{align:`end`,children:[h(Ne,{disabled:b!==void 0,onSelect:()=>void au(n,e.id),children:`Refresh`}),h(Ne,{disabled:b!==void 0||!C||c,onSelect:()=>l(!0),children:`Discover servers`}),h(Ne,{disabled:b!==void 0,onSelect:r,children:`Add server`})]})]})})]}),c?x(ge,{children:[x(Ee,{children:[h(be,{children:`Discover servers now?`}),h(k,{children:`Discovery starts the configured processes and contacts remote MCP servers.`})]}),x(me,{children:[h(t,{variant:`primary`,size:`sm`,disabled:b!==void 0,onClick:()=>{l(!1),ou(r,e.id)},children:`Discover`}),h(t,{variant:`ghost`,size:`sm`,onClick:()=>l(!1),children:`Cancel`})]})]}):null,S===void 0?null:x(ge,{role:`alert`,children:[x(Ee,{children:[h(be,{children:`Po couldn't finish that just now`}),h(k,{children:S})]}),h(t,{variant:`outline`,size:`sm`,disabled:b!==void 0,onClick:()=>void au(n,e.id),children:`Try again`})]})]})]}),m?x(ve,{children:[h(ze,{children:h(Be,{children:`Sign-in`})}),h(je,{children:x(ge,{children:[x(Ee,{children:[h(be,{className:`font-mono first-letter:normal-case`,children:m.serverName}),h(k,{children:pu[m.status]}),m.error?h(k,{className:`text-po-red`,children:m.error}):null]}),x(me,{children:[m.authorizationUrl?h(t,{variant:`primary`,size:`sm`,asChild:!0,children:x(`a`,{href:m.authorizationUrl,target:`_blank`,rel:`noreferrer noopener`,children:[`Open sign-in page`,h(we,{"aria-hidden":!0,className:`size-3.5`})]})}):null,uu.has(m.status)?null:h(t,{variant:`ghost`,size:`sm`,loading:b===`cancelling`,disabled:b!==void 0,onClick:()=>void lu(r,e.id,m.id),children:`Cancel`})]})]})})]}):null,x(ve,{children:[a?h(`output`,{className:`text-sm text-po-dim`,children:a}):null,x(ze,{children:[h(Be,{children:`Servers`}),ee.length===0?null:h(`span`,{className:`text-sm text-po-dim`,children:ee.length===1?`1 server`:`${String(ee.length)} servers`})]}),h(je,{asChild:!0,children:h(`ul`,{children:ee.length===0?h(ge,{asChild:!0,children:h(`li`,{children:x(Ee,{children:[h(be,{children:b===`loading`?`Reading the catalog`:`No servers yet`}),h(k,{children:b===`loading`?`This takes a moment.`:`None are enabled in this repository's last sync.`})]})})}):ee.map(t=>h(hu,{server:t,repositoryId:e.id,requestWithStepUp:r,onChanged:(t,r)=>{o(t),au(n,e.id).then(()=>{r&&s.current?.focus()})},busy:b!==void 0,canAct:C,confirming:u===t.name,onAuthorize:()=>d(t.name),onConfirm:()=>{d(void 0),su(r,e.id,t.name)},onCancel:()=>d(void 0)},t.name))})}),te.length===0?null:h(Re,{children:`Left out by policy: ${te.join(`, `)}.`}),y?.diagnostics.map(e=>h(Re,{className:`text-po-red`,children:e},e))]})]})}var _u=C({label:`MCP servers`,detail:`The MCP servers this repository's sessions can use, what each one offers, and where to sign in.`,order:100,component:gu});function vu(e,t,n){e(t,{type:`prompt`,message:`/mcp auth ${n}`})}function yu(e,t,n){e(t,{type:`prompt`,message:`/mcp disconnect ${n}`})}function bu(e,t,n){e(t,{type:`prompt`,message:`/mcp unauthorize ${n}`})}function xu(e,t,n){e(t,{type:`prompt`,message:`/mcp approve ${n?`on`:`off`}`})}async function Su(e,t){let n=await pl.session(e).sessionSecret({body:t});return n.ok?{ok:!0}:n.status===0?{ok:!1,error:`The session is unreachable.`}:{ok:!1,error:n.error===``?`Po could not save that secret.`:n.error}}function Cu({server:e,name:n,disabled:r=!1,pending:i=!1,error:a,onSubmit:o}){let[s,c]=A(``),l=`mcp-secret-${e}-${n}`,u=`${l}-hint`;return x(`form`,{"data-testid":`context-mcp-secret-${e}-${n}`,className:`flex flex-col gap-1.5 rounded-md border border-po-edge-magenta bg-po-tint-magenta px-2.5 py-2`,onSubmit:e=>{e.preventDefault(),!(s===``||r||i)&&(o(s),c(``))},children:[x(`label`,{htmlFor:l,className:`text-sm text-po-text`,children:[h(`span`,{className:`font-semibold text-po-magenta`,children:`Needs secret`}),` `,h(`span`,{className:`font-mono text-po-hi`,children:n})]}),x(`div`,{className:`flex min-w-0 items-center gap-2`,children:[h(Ie,{id:l,type:`password`,size:`xs`,autoComplete:`off`,spellCheck:!1,className:`min-w-0 flex-1`,value:s,placeholder:`Paste the value`,"aria-describedby":u,"aria-invalid":a!==void 0,disabled:r||i,onChange:e=>c(e.target.value)}),h(t,{type:`submit`,variant:`outline`,size:`xs`,disabled:s===``||r||i,children:i?`saving...`:`save`})]}),h(`p`,{id:u,className:`text-sm ${a?`text-po-red`:`text-po-dim`}`,children:a??`Po keeps it in the vault, never shows it again, and reconnects ${e}.`})]})}var wu=`mcp-session-auto-approve`,Tu=`mcp-session-auto-approve-help`;function Eu({status:e,disabled:t,onCheckedChange:n}){return h(`section`,{"data-testid":`context-mcp-approval`,className:`flex flex-col gap-2 border-b border-po-border px-3 py-3`,children:x(`div`,{className:`flex min-w-0 items-start gap-3 px-1`,children:[x(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[h(`label`,{htmlFor:wu,className:`text-sm font-semibold text-po-hi`,children:`Run tools that change data without asking`}),h(`p`,{id:Tu,className:`text-sm leading-relaxed text-po-dim`,children:e.host?`On for every session in MCP settings. Turn it off there to be asked again.`:e.session?`This session only. It stays on when the session restarts.`:`Po asks before each one, here and on Home. Read-only tools run straight away.`})]}),h(m,{id:wu,"data-testid":`context-mcp-approval-switch`,"aria-describedby":Tu,checked:e.host||e.session,disabled:t||e.host,onCheckedChange:n})]})})}async function Du(e,t,n){let r=await pl.session(e).sessionTool({query:{[Hc]:t,[Uc]:n}});return r.ok?{ok:!0,detail:r.data}:r.status===0?{ok:!1,error:`The session is unreachable.`}:{ok:!1,error:r.error===``?`The session answered ${r.status}.`:r.error}}function Ou(e){return`${e.sessionId}\u0000${e.server}\u0000${e.tool}`}function ku({target:e,onClose:t}){let[n,r]=A(null);f(()=>{if(e===null)return;let t=!0,n=Ou(e);return Du(e.sessionId,e.server,e.tool).then(e=>{t&&r(e.ok?{key:n,detail:e.detail}:{key:n,error:e.error})}),()=>{t=!1}},[e]);let i=e!==null&&n?.key===Ou(e)?n:null,a=i?.detail;return h(ae,{open:e!==null,onOpenChange:e=>{e||t()},children:x(_,{"data-testid":`mcp-tool-detail-dialog`,children:[h(oe,{className:`items-start px-4 py-4 sm:px-5`,children:x(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[h(le,{className:`break-words leading-snug`,children:a?.piName??e?.piName??(e===null?``:`${e.server} · ${e.tool}`)}),x(Me,{children:[e===null?``:`${e.server} / ${e.tool}. `,e?.inContext===!1?`Not in the model context. `:``,a===void 0?`Description and complete input schema.`:`Estimated schema cost: ~${a.tokens.toLocaleString()} tokens.`]})]})}),x(l,{className:`flex flex-col gap-3 px-4 py-4 sm:px-5 sm:py-5`,children:[i===null?h(`output`,{className:`text-sm text-po-dim`,children:`Loading the tool...`}):null,i?.error===void 0?null:h(`output`,{className:`text-sm text-po-dim`,children:i.error}),a===void 0?null:x(s,{children:[x(`section`,{className:`flex flex-col gap-1`,children:[h(`p`,{className:`text-sm font-semibold text-po-dim`,children:`description`}),h(`p`,{className:`whitespace-pre-wrap text-base text-po-text`,children:a.description??`No description.`})]}),a.warnings?.length?h(`section`,{"aria-label":`Tool warnings`,className:`flex flex-col gap-1 text-base text-po-yellow`,children:a.warnings.map(e=>x(`p`,{children:[e.source,` `,e.path,`: `,e.message]},`${e.source}:${e.path}:${e.message}`))}):null,x(`section`,{className:`flex min-h-0 flex-col gap-1`,children:[h(`p`,{className:`text-sm font-semibold text-po-dim`,children:`input schema`}),h(`pre`,{"data-testid":`mcp-tool-detail-schema`,className:`max-h-96 overflow-auto rounded border border-po-border-soft p-2 font-mono text-sm text-po-text`,children:JSON.stringify(a.inputSchema,null,2)})]})]})]})]})})}function Au(e,t,n){return`${e}\u0000${t}\u0000${n}`}function ju(e){return e===null?`-`:`~${e.toLocaleString()}`}function Mu({sessionId:e,statuses:n,sendSessionFrame:r,contextInventory:i=[]}){let a=Gc(n[`po-mcp-session-auth`])??[],o=jc(n[Ac]),[c,u]=A(null),[d,p]=A(null),m=v(null),[g,y]=A(``),[b,S]=A(!1),[C,w]=A(null),[ee,te]=A({}),T=v(null),ne=v(void 0),re=c?.sessionId===e?c:null,E=a.find(e=>e.name===re?.name),D=E?.authorizationUrl,ie=d?.sessionId===e?a.find(e=>e.name===d.name):void 0,se=()=>{T.current?.close(),T.current=null};f(()=>{let e=T.current;re&&D&&e&&!e.closed&&(e.location.replace(D),T.current=null)},[re,D]),f(()=>()=>{T.current?.close(),T.current=null},[e]),f(()=>{let e=E?.state;e!==ne.current&&(ne.current=e,(e===`failed`||e===`closed`||e===`connected`)&&(T.current?.close(),T.current=null))},[E?.state]);let ue=t=>{if(e===null)return;let n=a.find(e=>e.name===t);if(ne.current=n?.state,!n||n.state===`disabled`||!(n.oauthEligible||n.state===`needs-auth`||n.authorizationUrl))return;se(),u({sessionId:e,name:t}),y(``);let i=window.open(`about:blank`,`_blank`);S(i===null),i&&(i.opener=null,n?.authorizationUrl?i.location.replace(n.authorizationUrl):(i.document.title=`MCP authorization`,i.document.body.textContent=`Preparing authorization. Return to Po for progress or manual sign-in.`,T.current=i)),!n?.authorizationUrl&&n?.state!==`connecting`&&vu(r,e,t)},fe=(t,n,r)=>{if(e===null)return;let i=Au(e,t,n);te(e=>({...e,[i]:{pending:!0}})),Su(e,{server:t,name:n,value:r}).then(e=>{te(t=>({...t,[i]:e.ok?{pending:!1}:{pending:!1,error:e.error}}))})},pe=async()=>{if(D)try{await navigator.clipboard.writeText(D),y(`Link copied.`)}catch{y(`Clipboard unavailable. Select the link above and copy it manually.`)}};return x(s,{children:[a.length===0?null:x(`section`,{"data-testid":`context-mcp-auth`,className:`flex flex-col gap-2 border-b border-po-border px-3 py-3`,children:[x(`div`,{className:`flex flex-col gap-0.5`,children:[h(`p`,{className:`text-sm font-semibold text-po-dim`,children:`MCP servers`}),h(`p`,{className:`text-sm leading-relaxed text-po-dim`,children:`Open sign-in in a new tab, or copy the link from the authorization dialog.`})]}),h(`ul`,{"aria-label":`MCP servers`,className:`flex flex-col gap-2`,children:a.map(n=>{let a=i.filter(e=>e.source===`mcp`&&e.owner===n.name),o=n.tools??[],s=n.missingSecrets??[],c=s.length>0&&n.state!==`connected`;return x(`li`,{className:`flex min-w-0 flex-col gap-1 px-1 py-0.5`,children:[x(`div`,{className:`flex min-w-0 items-center gap-2`,children:[h(`span`,{className:`min-w-0 flex-1 truncate text-base font-semibold text-po-hi`,children:n.name}),c?h(`span`,{className:`text-sm font-semibold text-po-magenta`,children:`needs secret`}):h(`span`,{className:`text-sm font-semibold text-po-dim`,children:n.state.replace(/-/g,` `)}),n.oauthAuthorized===!0&&n.state===`connected`?x(`span`,{className:`flex items-center gap-1 text-sm text-po-green`,children:[h(de,{"aria-hidden":!0,className:`size-4`}),` Authorized`]}):null,!c&&n.state===`needs-auth`?h(t,{variant:`subtle`,size:`xs`,"aria-label":`Authorize ${n.name}`,disabled:e===null,onFocus:e=>{m.current=e.currentTarget},onClick:()=>ue(n.name),children:`Authorize`}):null,c?null:x(he,{children:[h(ke,{asChild:!0,children:h(t,{variant:`ghost`,size:`icon`,"aria-label":`Actions for ${n.name}`,disabled:e===null||n.state===`disabled`,onPointerDownCapture:e=>{m.current=e.currentTarget},onFocus:e=>{m.current=e.currentTarget},children:h(Fe,{"aria-hidden":!0,className:`size-4`})})}),x(De,{align:`end`,children:[n.oauthEligible||n.state===`needs-auth`||n.authorizationUrl?h(Ne,{onSelect:()=>ue(n.name),children:n.oauthAuthorized?`Reauthorize`:`Authorize`}):null,n.oauthEligible&&n.oauthAuthorized?h(Ne,{onSelect:()=>{e!==null&&p({sessionId:e,name:n.name})},children:`Unauthorize`}):null,n.state===`connected`?h(Ne,{onSelect:()=>{e!==null&&yu(r,e,n.name)},children:`Disconnect`}):null,!(n.oauthEligible||n.state===`needs-auth`||n.authorizationUrl)&&n.state!==`connected`?h(Ne,{disabled:!0,children:`Authorization unavailable`}):null]})]})]}),(c?s:[]).map(t=>{let r=e===null?void 0:ee[Au(e,n.name,t)];return h(Cu,{server:n.name,name:t,disabled:e===null,pending:r?.pending??!1,...r?.error?{error:r.error}:{},onSubmit:e=>fe(n.name,t,e)},t)}),a.length>0?h(`ul`,{"aria-label":`${n.name} tools and skills`,className:`flex flex-col`,children:a.map(r=>{let i=o.find(e=>e.piName===r.name);return x(`li`,{"data-active":r.active,className:`flex min-w-0 items-center gap-2 py-px pl-3`,children:[h(`abbr`,{title:r.itemKind,className:`w-3 shrink-0 text-2xs font-semibold no-underline ${r.active?`text-po-violet`:`text-po-dim`}`,children:r.itemKind===`skill`?`S`:`T`}),r.itemKind===`tool`?h(t,{variant:`ghost`,size:`card`,"aria-label":`Open schema for ${r.name}`,"data-testid":`context-mcp-tool-${r.name}`,disabled:e===null||i===void 0,onClick:()=>{e!==null&&i!==void 0&&w({sessionId:e,server:n.name,tool:i.name,piName:i.piName,inContext:r.active})},className:`min-w-0 flex-1 truncate rounded-none py-0 text-left text-base ${r.active?`text-po-hi`:`text-po-dim`}`,children:r.name}):h(`span`,{className:`min-w-0 flex-1 truncate text-base text-po-dim`,children:r.name}),h(`span`,{className:`w-14 shrink-0 text-right text-sm ${r.active?`text-po-text`:`text-po-dim`}`,children:r.active?ju(r.tokens):`(${ju(r.tokens)})`})]},`${r.itemKind}:${r.name}`)})}):o.length>0?x(`div`,{className:`flex flex-col`,children:[h(`p`,{className:`pl-3 text-sm text-po-dim`,children:`${o.length} available ${o.length===1?`tool`:`tools`}, not in context`}),h(`ul`,{"aria-label":`${n.name} reachable tools`,className:`flex flex-col`,children:o.map(r=>h(`li`,{className:`flex min-w-0`,children:x(t,{variant:`ghost`,size:`card`,"data-testid":`context-mcp-reachable-${n.name}-${r.name}`,title:`open the tool's description and schema`,disabled:e===null,onClick:()=>{e!==null&&w({sessionId:e,server:n.name,tool:r.name,piName:r.piName,inContext:!1})},className:`min-w-0 flex-1 flex-row items-center gap-2 rounded-none py-px pr-0 pl-3`,children:[h(`abbr`,{title:`tool`,className:`w-3 shrink-0 text-2xs font-semibold text-po-violet no-underline`,children:`T`}),h(`span`,{className:`min-w-0 flex-1 truncate text-left text-base text-po-text`,children:r.piName??r.name}),h(`span`,{title:`what the schema would cost if added to context directly`,className:`w-14 shrink-0 text-right text-sm text-po-dim`,children:r.tokens===void 0?`(-)`:`(~${r.tokens.toLocaleString()})`})]})},r.name))})]}):c?null:h(`p`,{className:`pl-3 text-sm text-po-dim`,children:`no tools or skills reported`})]},n.name)})})]}),a.length===0||o===void 0?null:h(Eu,{status:o,disabled:e===null,onCheckedChange:t=>{e!==null&&xu(r,e,t)}}),h(ku,{target:C,onClose:()=>w(null)}),h(ae,{open:ie!==void 0,onOpenChange:e=>{e||p(null)},children:x(_,{onCloseAutoFocus:e=>{e.preventDefault(),m.current?.focus()},children:[h(oe,{dismissible:!0,children:x(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[x(le,{children:[`Unauthorize `,d?.name,`?`]}),h(Me,{children:`Disconnect this session and clear the saved authorization. The server stays configured.`})]})}),h(l,{children:h(`p`,{className:`text-base leading-relaxed text-po-dim`,children:`The saved credential is shared. Other sessions stay connected, but may need to sign in again when they reconnect. This does not revoke access at the provider.`})}),x(ce,{className:`border-t border-po-border-soft px-4 py-3`,children:[h(t,{variant:`ghost`,onClick:()=>p(null),children:`Cancel`}),h(t,{variant:`danger`,disabled:!ie?.oauthEligible,onClick:()=>{d&&ie?.oauthEligible&&d.sessionId===e&&(bu(r,d.sessionId,d.name),p(null))},children:`Unauthorize`})]})]})}),h(ae,{open:re!==null,onOpenChange:e=>{e||(se(),u(null))},children:x(_,{"data-testid":`mcp-authorization-dialog`,onInteractOutside:e=>e.preventDefault(),onCloseAutoFocus:e=>{e.preventDefault(),m.current?.focus()},children:[h(oe,{className:`items-start px-4 py-4 sm:px-5`,children:x(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[x(le,{className:`break-words leading-snug`,children:[E?.oauthAuthorized?`Authorized`:`Authorize`,` `,re?.name]}),h(Me,{className:`max-w-2xl`,children:E?.oauthAuthorized?`You can now use this server in Po.`:`Finish signing in in the provider tab Po opened. If it did not open, use the link below.`})]})}),x(l,{className:`px-4 py-4 sm:px-5 sm:py-5`,children:[h(`output`,{className:`text-sm text-po-dim`,children:E?.oauthAuthorized?`Authorization complete.`:E?.state===`connected`?`Connected. OAuth authorization has not been confirmed.`:E?.state===`closed`?`Disconnected from this session.`:D?`Waiting for you to complete authorization.`:E?.state===`failed`?`Connection failed. Retry authorization; details are in the session transcript.`:E?`Preparing the authorization link...`:`This server is no longer available in the session.`}),b?h(`p`,{className:`text-sm text-po-dim`,children:`The browser blocked the new tab. Open the link below when it is ready.`}):null,D?x(`div`,{className:`flex flex-col gap-2`,children:[h(Ie,{"aria-label":`OAuth authorization URL`,readOnly:!0,value:D,onFocus:e=>e.currentTarget.select()}),h(`a`,{href:D,target:`_blank`,rel:`noopener noreferrer`,className:`text-base font-medium text-po-blue underline underline-offset-2`,children:`open authorization page`}),h(t,{variant:`outline`,size:`xs`,onClick:()=>void pe(),children:`copy link`})]}):null,g?h(`output`,{className:`text-sm text-po-dim`,children:g}):null]}),x(ce,{className:`flex-wrap justify-end border-t border-po-border-soft px-4 py-3 sm:px-5`,children:[E?.state===`connected`&&re?h(t,{variant:`outline`,size:`md`,onClick:()=>{se(),y(``),S(!1),yu(r,re.sessionId,re.name)},children:`disconnect`}):null,(E?.state===`failed`||E?.state===`closed`)&&E.oauthEligible&&re?h(t,{size:`md`,onClick:()=>ue(re.name),children:E.state===`failed`?`retry authorization`:`reauthorize`}):null,h(t,{variant:`ghost`,size:`md`,onClick:()=>{se(),u(null)},children:`close`})]})]})})]})}var Nu=Se({component:Mu}),Pu=p({runtime:null});function Fu(e){let t=e.mount;if(t?.scope!==`session`)throw Error(`MCP Apps require a session runtime mount`);return Pu.update(t.sessionId,()=>({runtime:e})),()=>{Pu.select(Pu.store.state,t.sessionId).runtime===e&&Pu.drop(t.sessionId)}}var Iu=320;function Lu(){let e=document.documentElement.style.colorScheme;return e===`light`||e===`dark`?e:window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}function Ru(e){return e instanceof Error?e.message:`The MCP App could not complete this request`}function zu(e,t,n,r){return e.invokeServerMethod({mount:{scope:`session`,sessionId:t},service:`mcp.apps`,method:n,input:r})}async function Bu(e){if(typeof e!=`string`)throw Error(`Invalid external link`);let t=new URL(e);if(t.protocol!==`https:`||t.username||t.password)throw Error(`Only HTTPS external links are supported`);if(!window.confirm(`Open this external link?\n${t.href}`))throw Error(`Opening the link was declined`);let n=window.open(t.href,`_blank`,`noopener,noreferrer`);return n!==null&&(n.opener=null),{}}function Vu({runtime:e,sessionId:t,toolCallId:n,data:r,savedState:i,saveState:a,onClose:o}){let s=v(null),[c,l]=A(Iu),[u,d]=A(null),[p,m]=A(!1),[g]=A(()=>i);return f(()=>{let i=s.current;if(i===null||i.contentWindow===null)return;let c=kc(i,{data:r,toolCallId:n,savedState:g,request:(n,i)=>zu(e,t,n,{...i,leaseId:r.leaseId}),openLink:Bu,theme:Lu(),locale:navigator.language,device:window.matchMedia(`(pointer: coarse)`).matches?`mobile`:`desktop`,hover:window.matchMedia(`(hover: hover)`).matches,touch:navigator.maxTouchPoints>0,hostOrigin:location.origin,resize:l,ready:()=>m(!0),fail:d,close:o,saveState:a}),u=new MutationObserver(()=>c.setTheme(Lu()));return u.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`,`data-theme`,`style`]}),()=>{u.disconnect(),c.dispose()}},[e,t,n,r,g,a,o]),x(`div`,{className:`overflow-hidden rounded border border-po-border-soft`,"data-testid":`mcp-inline-app`,children:[u===null?null:h(`p`,{role:`alert`,className:`p-3 text-po-dim`,children:u}),!p&&u===null?h(`output`,{className:`p-3 text-po-faint`,children:`Loading MCP App…`}):null,h(`iframe`,{ref:s,title:`${r.tool.name} MCP App`,sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,allow:`camera 'none'; microphone 'none'; geolocation 'none'; clipboard-read 'none'; clipboard-write 'none'`,className:u===null?`block w-full border-0`:`hidden`,style:{height:c}})]})}function Hu({sessionId:e,toolCallId:t}){let n=w(Pu.store,t=>Pu.select(t,e).runtime),[r,i]=A(null),[o,s]=A(null),[c,l]=A(!1),[u,d]=A(null),[p,m]=A(!1),[g,_]=A(null),v=a(e=>_(e),[]),y=a(()=>m(!0),[]);return f(()=>{if(n===null||e===null||!gt(document))return;let r=!0,a;return zu(n,e,`open`,{toolCallId:t}).then(t=>{let o=t;if(a=o.leaseId,!r)return zu(n,e,`close`,{leaseId:a});_(o.state),i(o)}).catch(e=>{r&&s(Ru(e))}),()=>{r=!1,a!==void 0&&zu(n,e,`close`,{leaseId:a}).catch(e=>s(Ru(e)))}},[n,e,t]),p?h(`p`,{className:`text-po-faint`,children:`MCP App closed. Expand the card to view the tool result.`}):gt(document)?o===null?n===null||e===null?h(`p`,{className:`text-po-faint`,children:`The interactive MCP App is unavailable in this view. Expand the card to view the tool result.`}):r===null?h(`output`,{className:`text-po-faint`,children:`Loading MCP App…`}):x(`div`,{className:`flex w-full flex-col gap-2`,children:[x(`div`,{className:`flex items-center justify-between gap-2 text-po-faint`,children:[h(`span`,{children:r.readOnly?`Read-only MCP App`:`MCP App interactions enabled`}),r.readOnly?h(`button`,{type:`button`,disabled:c,onClick:()=>{l(!0),d(null),zu(n,e,`activate`,{leaseId:r.leaseId}).then(()=>{i({...r,readOnly:!1})}).catch(e=>d(Ru(e))).finally(()=>l(!1))},className:`rounded border border-po-border-soft px-2 py-1 text-po-blue disabled:opacity-50`,children:c?`Enabling…`:`Enable interactions`}):null]}),u===null?null:h(`p`,{role:`alert`,className:`text-po-dim`,children:u}),h(Vu,{runtime:n,sessionId:e,toolCallId:t,data:r,savedState:g,saveState:v,onClose:y},`${r.leaseId}-${String(r.readOnly)}`)]}):x(`p`,{role:`alert`,className:`text-po-dim`,children:[`MCP App unavailable: `,o]}):h(`p`,{className:`text-po-faint`,children:`This browser cannot securely display MCP Apps. Expand the card to view the tool result.`})}var Uu=ie(e=>{let t=Fu(e),n=e.mount?.scope===`session`?e.mount.sessionId:null,r=e.registerMcpAppRenderer?.(({key:e,toolCallId:t})=>T(Hu,{key:e,sessionId:n,toolCallId:t}));return()=>{r?.(),t()}}),Wu=`po-mcp`,Gu=`,`,Ku=`_`,qu=3,Ju=12;function Yu(e){let t=e[Wu];return t===void 0?[]:t.split(Gu).map(e=>e.trim()).filter(e=>e.length>0)}function Xu(e,t){let n=null;for(let r of Yu(t)){let t=`${r}${Ku}`;e.startsWith(t)&&e.length!==t.length&&(n===null||r.length>n.server.length)&&(n={server:r,tool:e.slice(t.length)})}return n}function Zu(e){if(typeof e!=`object`||!e)return null;let t=e;return typeof t.server!=`string`||typeof t.tool!=`string`?null:{server:t.server,tool:t.tool}}function Qu(e){return typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):e===null?`null`:Array.isArray(e)?`[${e.length}]`:`{…}`}function $u(e){let t=Object.entries(e),n=t.slice(0,qu).map(([e,t])=>`${e}=${Qu(t)}`);return t.length>n.length&&n.push(`+${t.length-n.length}`),n.join(` · `)}function ed(e){let t=e.output.split(`
|
|
54
|
-
`);for(;t.length>0&&t.at(-1)?.trim()===``;)t.pop();let n=e.expanded?t:t.slice(0,Ju);return e.isPartial?{lines:n,status:{glyph:`◐`,tone:`running`,text:`running`}}:e.isError?{lines:n,status:{glyph:`✗`,tone:`error`,text:`failed`}}:!e.expanded&&t.length>n.length?{lines:n,status:{glyph:`…`,tone:`hint`,text:`${t.length-n.length} more line(s)`}}:n.length===0?{lines:n,status:{glyph:`✓`,tone:`ok`,text:`done`}}:{lines:n,status:null}}function td(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var nd=512;function rd(e,t){let n=td(e)?e.appInvocation:void 0;return typeof n==`string`&&n.length>0&&n.length<=nd?n:t}function id(e){if(!td(e))return null;let t=t=>typeof e[t]==`string`?e[t]:void 0;switch(e.type){case`audio`:{let e=t(`data`),n=t(`mimeType`);return e!==void 0&&n!==void 0?{type:`audio`,data:e,mimeType:n}:null}case`resource_link`:{let e=t(`uri`),n=t(`name`);if(e===void 0||n===void 0)return null;let r=t(`title`),i=t(`description`),a=t(`mimeType`);return{type:`resource_link`,uri:e,name:n,...r===void 0?{}:{title:r},...i===void 0?{}:{description:i},...a===void 0?{}:{mimeType:a}}}case`resource`:{let e=t(`uri`);if(e===void 0)return null;let n=t(`mimeType`),r=t(`text`),i=t(`blob`);return{type:`resource`,uri:e,...n===void 0?{}:{mimeType:n},...r===void 0?{}:{text:r},...i===void 0?{}:{blob:i}}}case`structured`:return td(e.value)?{type:`structured`,value:e.value}:null;default:return null}}function ad(e){return!td(e)||!Array.isArray(e.blocks)?[]:e.blocks.flatMap(e=>{let t=id(e);return t===null?[]:[t]})}function od(e){return e.flatMap(e=>!td(e)||e.type!==`image`?[]:typeof e.data==`string`&&typeof e.mimeType==`string`?[{data:e.data,mimeType:e.mimeType}]:[])}var sd={running:`running`,ok:`ok`,error:`error`,hint:`neutral`};function cd(e){let t=e.indexOf(`_`);return t<=0?{server:e,tool:``}:{server:e.slice(0,t),tool:e.slice(t+1)}}function ld({block:e}){switch(e.type){case`resource_link`:return h(`a`,{href:e.uri,target:`_blank`,rel:`noreferrer`,"data-testid":`tool-result-mcp-link`,className:`truncate text-po-blue hover:underline`,title:e.description??e.uri,children:e.title??e.name});case`resource`:return e.text===void 0?x(`span`,{"data-testid":`tool-result-mcp-resource`,className:`truncate text-po-dim`,children:[`binary `,e.mimeType??`resource`,` · `,e.uri]}):h(Ve,{"data-testid":`tool-result-mcp-resource`,className:`text-po-dim`,text:e.text});case`structured`:return h(Ve,{"data-testid":`tool-result-mcp-structured`,className:`text-po-dim`,grammar:`json`,text:JSON.stringify(e.value,null,2)});case`audio`:return x(`span`,{"data-testid":`tool-result-mcp-audio`,className:`text-po-dim`,children:[`audio · `,e.mimeType]})}}function ud({sessionId:e,toolCallId:t,toolName:n,args:r,result:i,output:a,running:o,isError:c,statuses:l,suppressOutputs:u,renderMcpApp:d}){let f=Zu(i?.details)??Xu(n,l)??cd(n),p=$u(r),m=od(i?.content??[]),g=ad(i?.details),_=i?.details,v=!o&&typeof _==`object`&&_&&`app`in _?_.app:void 0,y=typeof v==`object`&&!!v&&`version`in v&&v.version===1&&`resourceUri`in v&&typeof v.resourceUri==`string`,b=rd(_,t),C=Object.keys(r).length>0,w=ed({output:a,expanded:!0,isPartial:o,isError:c}),ee=w.status?.tone===`hint`,te=w.lines.length>0||w.status!==null||m.length>0||g.length>0;return h(Te,{tone:S({running:o,isError:c}),expandable:C||te,children:({expanded:t})=>x(s,{children:[h(_e,{title:`mcp`,children:x(`span`,{"data-testid":`tool-call-mcp`,className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[h(`span`,{className:`shrink-0 text-po-dim`,children:f.server}),h(`span`,{className:`shrink-0 text-po-faint`,children:`/`}),h(`span`,{className:`shrink-0 text-po-blue`,children:f.tool}),p?x(`span`,{className:`min-w-0 flex-1 truncate text-po-dim`,children:[`· `,p]}):null]})}),y&&!u?h(ye,{children:d?d({key:`${e}:${b}`,toolCallId:b}):h(Hu,{sessionId:e,toolCallId:b},`${e}:${b}`)}):null,t&&C?x(ye,{"data-testid":`tool-input-mcp`,className:`flex flex-col gap-1`,children:[h(`span`,{className:`text-sm text-po-dim`,children:`Input`}),h(Ve,{className:`text-po-dim`,grammar:`json`,text:JSON.stringify(r,null,2)})]}):null,t&&te?x(ye,{"data-testid":`tool-result-mcp`,"data-mcp-server":f.server,className:`flex flex-col gap-1`,children:[C?h(`span`,{className:`text-sm text-po-dim`,children:`Output`}):null,w.lines.length>0?h(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-po-dim`,children:w.lines.join(`
|
|
55
|
-
`)}):null,!u&&m.map((e,t)=>h(Pe,{"data-testid":`tool-result-mcp-image`,src:`data:${e.mimeType};base64,${e.data}`,alt:`${f.tool} result ${String(t+1)}`,className:`max-h-60 max-w-full rounded border border-po-border-soft`},`${String(t)}-${e.mimeType}`)),!u&&g.map((e,t)=>h(ld,{block:e},`${String(t)}-${e.type}`)),w.status?h(fe,{"data-testid":`tool-result-mcp-status`,tone:sd[w.status.tone],glyph:w.status.glyph,expands:ee,children:w.status.text}):null]}):null]})})}function dd(e){let{result:t,running:n,toolCallId:r,toolName:i,sessionId:a,renderMcpApp:o}=e,s=t?.details,c=!n&&typeof s==`object`&&s&&`app`in s?s.app:void 0,l=[];if(typeof c==`object`&&c&&`version`in c&&c.version===1&&`resourceUri`in c&&typeof c.resourceUri==`string`){let e=rd(s,r);l.push({id:`app`,title:`${i} MCP App`,content:o?o({key:`${a}:${e}`,toolCallId:e}):h(Hu,{sessionId:a,toolCallId:e},`${a}:${e}`)})}for(let[e,n]of(t?.content??[]).entries()){if(typeof n!=`object`||!n||!(`type`in n)||n.type!==`image`)continue;let t=od([n])[0];l.push({id:`image:${String(e)}`,title:`${i} image ${String(e+1)}`,content:t?h(Pe,{src:`data:${t.mimeType};base64,${t.data}`,alt:`${i} result`}):null})}return ad(s).forEach((e,t)=>l.push({id:`block:${String(t)}`,title:`${i} ${e.type}`,content:h(ld,{block:e})})),l}var fd=u({tools:[],matches:(e,t,n)=>Zu(n)!==null||Xu(e,t)!==null,message:ud,outputs:dd}),pd=(e,t)=>t===void 0?void 0:{...e,...t},md=c({id:`mcp`,packageName:`@agimon-ai/po-mcp`,host:{get settingsPanels(){return[pd({id:`mcp-servers`},tu)]}},workspace:{get repositorySettingsPanel(){return _u}},session:{get fills(){return[pd({slot:`context`,id:`mcp-auth`},Nu)]},get start(){return Uu},get toolRenderers(){return[pd({tools:[`mcp`]},fd)]}}});export{md as webPlugin};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{$r as e,At as t,Bi as n,Ca as r,Cn as i,Di as a,Ft as o,Ga as s,Gr as c,Ha as l,Ht as u,Ii as d,It as f,Kt as p,Li as m,Lt as h,Ma as g,Mi as _,Qa as v,Ra as y,Ri as b,Sa as x,Ti as S,Yn as C,gn as w,hn as T,ja as ee,ka as te,mn as ne,nn as re,on as ie,qt as E,un as ae,vi as oe,vn as se,wi as ce}from"../chunks/po-web-runtime-D8FIos2q.js";var D=`planning`,O=[`modes`,D],k=`main`,A=`subagents`,j=`inherit the session model`,M=`inherit`,N=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`],P={id:D,label:`planning`,detail:`the models plan mode switches to, and where written plans land`,order:30,fields:[{id:`main.model`,label:`main model`,keyPath:[...O,k,`model`],placeholder:j,detail:`model the main agent switches to while plan mode is on.`,models:!0},{id:`main.thinking`,label:`main thinking`,keyPath:[...O,k,`thinking`],placeholder:M,detail:`thinking level appended to the main model while planning.`,options:N},{id:`subagents.model`,label:`subagent model`,keyPath:[...O,A,`model`],placeholder:j,detail:`model forced onto delegated planning subagents.`,models:!0},{id:`subagents.thinking`,label:`subagent thinking`,keyPath:[...O,A,`thinking`],placeholder:M,detail:`thinking level appended to the subagent model.`,options:N},{id:`plansdirectory`,label:`plans directory`,keyPath:[...O,`plansDirectory`],placeholder:`~/.po/plans`,detail:`absolute, repo-relative, or under ~. written plans land here.`}].map(e=>({id:e.id,label:e.label,kind:e.models===!0||e.options!==void 0?`select`:`text`,keyPath:e.keyPath,detail:e.detail,placeholder:e.placeholder,...e.models===!0?{optionsFrom:`models`}:{},...e.options===void 0?{}:{options:e.options.map(e=>({value:e,label:e}))}}))},le=y({...P,icon:c}),ue=y({...P,icon:c}),F=`po-plan-document`,I=[{label:`Exit plan mode and start implementation`,value:`exit`},{label:`Continue planning`,value:`continue`}].map(e=>e.label),de=` · `,fe=/\[[0-9;]*m/gu;function pe(e){if(e===void 0)return;let t=e.replace(fe,``).trim();if(t===``)return;let n=t.lastIndexOf(de);return n===-1?{title:t,stamp:``}:{title:t.slice(0,n).trim(),stamp:t.slice(n+3).trim()}}var me=r({name:`plan`,keys:`p e`,statusKey:F,marksBackgroundWork:!1,order:25}),L=x({current:{method:`GET`,path:`/current`,response:void 0},save:{method:`PUT`,path:`/content`,response:void 0}},{scopes:[`session`],basePath:`plans`,transport:(e,n)=>t.fetch(e,n),sessionAddress:v}),he=`The session is unreachable.`,ge=`This session has not written a plan yet.`;function R(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function z(e){return e.status===0?he:e.error===``?`The session answered ${String(e.status)}.`:e.error}async function B(e){let t=await L.session(e).current();return t.status===404?{ok:!1,error:t.ok||t.error===``?ge:t.error}:t.ok?R(t.data)?{ok:!0,detail:t.data}:{ok:!1,error:`The session answered with no plan.`}:{ok:!1,error:z(t)}}async function _e(e,t,n){let r=await L.session(e).save({body:{expectedHash:t,content:n}});if(r.status===409){let e=r.ok?void 0:r.data,t=R(e)&&typeof e.hash==`string`?e.hash:void 0;return{ok:!1,stale:!0,error:r.ok?`The plan changed since it was opened.`:z(r),...t===void 0?{}:{hash:t}}}return r.ok?{ok:!0,hash:R(r.data)&&typeof r.data.hash==`string`?r.data.hash:``}:{ok:!1,stale:!1,error:z(r)}}var V=`plan-document`,H=`saved`;function ve({sessionId:t,statuses:n,closeTransientTab:r}){let[i,a]=E(void 0),[s,c]=E(void 0),[l,p]=E(!1),[m,g]=E(`preview`),[_,v]=E(void 0),[y,b]=E(!1),[x,S]=E(void 0),C=n[`po-plan-document`]??``;u(()=>{if(t===null)return;let e=!1;return p(!0),B(t).then(t=>{e||(p(!1),t.ok?(a(t.detail),c(void 0),v(void 0),S(void 0)):(a(void 0),c(t.error)))}),()=>{e=!0}},[t,C]);let w=_??i?.content??``,T=async()=>{if(t===null||i===void 0||_===void 0)return;b(!0);let e=await _e(t,i.hash,_);if(b(!1),e.ok){S(H),v(void 0);let e=await B(t);e.ok?a(e.detail):c(e.error)}else S(e.error)};return h(`div`,{"data-testid":`plan-panel`,className:`flex min-h-0 flex-1 flex-col`,children:[h(`header`,{className:`flex shrink-0 items-center gap-2 border-b border-po-border px-4 py-2`,children:[f(`span`,{"data-testid":`plan-title`,className:`min-w-0 flex-1 truncate text-lg font-semibold text-po-hi`,children:i?.title??`plan`}),f(`nav`,{className:`flex shrink-0 items-center gap-1`,children:[`preview`,`source`].map(t=>f(e,{variant:m===t?`outline`:`ghost`,size:`xs`,"data-testid":`plan-view-${t}`,onClick:()=>g(t),children:t},t))}),f(e,{variant:`ghost`,size:`xs`,"data-testid":`plan-close`,onClick:()=>r(V),className:`shrink-0`,children:`close`})]}),l&&i===void 0?f(`p`,{"data-testid":`plan-loading`,className:`px-4 py-3 text-sm text-po-dim`,children:`reading this session's plan…`}):null,s===void 0?null:f(`p`,{"data-testid":`plan-error`,className:`px-4 py-3 text-sm text-po-red`,children:s}),f(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:i===void 0?null:i.unavailable?f(`p`,{"data-testid":`plan-unavailable`,className:`px-4 py-3 text-sm text-po-dim`,children:i.reason??`this plan cannot be shown`}):m===`preview`?f(`div`,{"data-testid":`plan-preview`,className:`flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-4 text-base text-po-text`,children:f(ae,{text:w})}):h(o,{children:[f(d,{"data-testid":`plan-source`,value:w,path:i.path,onChange:v,className:`min-h-0 flex-1`}),h(`div`,{className:`flex shrink-0 items-center gap-2 border-t border-po-border px-3 py-2`,children:[f(e,{variant:`outline`,size:`xs`,"data-testid":`plan-save`,loading:y,disabled:_===void 0||y,onClick:()=>void T(),children:`save to disk`}),_===void 0?null:f(e,{variant:`ghost`,size:`xs`,"data-testid":`plan-revert`,onClick:()=>v(void 0),children:`discard edits`}),x===void 0?null:f(`span`,{"data-testid":`plan-save-note`,className:x===H?`text-sm text-po-green`:`text-sm text-po-red`,children:x})]})]})}),i===void 0?null:f(`footer`,{"data-testid":`plan-source-path`,className:`shrink-0 truncate border-t border-po-border px-4 py-1.5`,children:f(`span`,{className:`font-mono text-sm text-po-dim`,children:i.path})})]})}function U(){return{id:V,label:`plan`,panel:ve}}function ye({sessionId:t,statuses:n,openTransientTab:r}){let i=pe(n[F]);return i===void 0?f(`p`,{"data-testid":`activity-summary-plan`,className:`px-1 text-sm text-po-dim`,children:`no plan written yet`}):h(`div`,{"data-testid":`activity-plan`,className:`flex flex-col gap-0.5`,children:[f(e,{variant:`ghost`,size:`card`,"data-testid":`activity-plan-open`,title:`open ${i.title}`,disabled:t===null,onClick:()=>{t!==null&&r(U())},className:`min-w-0 gap-0.5 rounded-md px-1 py-1 hover:bg-po-panel`,children:h(`span`,{className:`flex w-full min-w-0 items-center gap-1.5`,children:[f(`span`,{"data-testid":`activity-plan-title`,className:`min-w-0 flex-1 truncate text-left text-base font-semibold text-po-hi`,children:i.title}),i.stamp===``?null:f(`span`,{"data-testid":`activity-plan-stamp`,className:`shrink-0 text-sm tabular-nums text-po-dim`,children:i.stamp})]})}),f(`p`,{className:`px-1 text-sm leading-relaxed text-po-dim`,children:`open to read or edit; the agent reads what you save.`})]})}var be=te({slot:`activity.plan`,id:`plan`,component:ye}),xe=ee({id:`plan.toggle`,path:[{key:`p`,label:`plan`,detail:`read-only planning modes`},{key:`e`,label:`toggle`,detail:`enter or leave read-only planning`}],command:`mode plan`}),Se=g({name:`plan`,icon:ie,keys:`p e`,statusKey:`plan-mode`,order:20});function Ce({dialog:t,answer:r,cancel:o,defaultExpanded:s=!0}){let[c,l]=E(s),[d,g]=E(0),_=p(null);return u(()=>_.current?.querySelector(`[role="listbox"]`)?.focus(),[t.id]),h(m,{ref:_,open:c,onOpenChange:l,role:`group`,"aria-label":`Plan review`,"data-testid":`plan-review-prompt`,className:`flex min-w-0 flex-col overflow-hidden`,onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),o())},children:[f(n,{asChild:!0,children:h(e,{variant:`ghost`,"aria-label":c?`Collapse plan review`:`Expand plan review`,className:`h-11 w-full justify-between rounded-none px-3.5`,children:[f(C,{children:`plan review`}),c?null:f(`span`,{className:`ml-auto text-sm font-normal text-po-dim`,children:`Awaiting decision`}),f(c?S:a,{size:16})]})}),h(b,{children:[h(`div`,{className:`flex flex-col gap-1 px-3.5 pb-2`,children:[f(`p`,{className:`text-base font-semibold leading-relaxed text-po-hi`,children:t.title}),f(`p`,{className:`text-sm leading-relaxed text-po-dim`,children:`Review the plan in the conversation before choosing what happens next.`})]}),f(i,{options:t.options,cursor:d,onCursorChange:g,onSelect:r,onFocus:e=>{let t=Array.from(e.currentTarget.children).indexOf(e.target);t!==-1&&g(t)},tabIndex:-1,onKeyDown:e=>{oe(e,{options:t.options,cursor:d,onCursorChange:g,onSelect:r})},testIdPrefix:`plan-review-option`,className:`max-h-48 px-3.5 pb-3 outline-none`}),h(`div`,{className:`flex items-center gap-2 border-t border-po-border-soft px-3.5 py-2`,children:[h(`span`,{className:`text-sm text-po-dim`,children:[ce(t.options.length),` · `,f(re,{children:`esc`}),` cancels`]}),f(e,{variant:`outline`,size:`sm`,"data-testid":`plan-review-cancel`,className:`ml-auto`,onClick:o,children:`cancel`})]})]})]})}var we=[`record_debug_evidence`,`run_fable_plan`,`write_plan`,`complete_plan`];function Te(e){return e.method===`select`&&e.title===`Plan complete. What would you like to do?`&&e.options.length===I.length&&I.every((t,n)=>e.options[n]===t)}var Ee=12,De=72,W=[[`logs`,`log`],[`correlatedTraceEvidence`,`trace`],[`processOutput`,`process output`],[`browserConsoleEvidence`,`console entry`],[`correlationIds`,`correlation id`],[`timestamps`,`timestamp`],[`verifiedFacts`,`verified fact`],[`hypotheses`,`hypothesis`],[`unavailableEvidence`,`unavailable item`]],Oe=[[`goal`,`goal`],[`constraints`,`constraint`],[`decisions`,`decision`],[`verifiedFindings`,`verified finding`],[`inferredFindings`,`inferred finding`],[`unresolvedQuestions`,`open question`]];function G(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function K(e){let t=``;for(let n of e){let e=n.codePointAt(0)??0;t+=e<=31||e===127?` `:n}return t.replace(/\s+/gu,` `).trim()}function q(e,t){let n=e?.[t];return typeof n==`string`&&K(n)||void 0}function ke(e,t){let n=e?.[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0}function Ae(e,t){let n=e[t];return Array.isArray(n)?n.length:0}function J(e,t){return e===1?t:t.endsWith(`y`)?`${t.slice(0,-1)}ies`:`${t}s`}function je(e){if(e)return e.length>De?`${e.slice(0,69)}…`:e}function Y(e,t){return t.flatMap(([t,n])=>{let r=Ae(e,t);return r>0?[`${r} ${J(r,n)}`]:[]})}function X(e,t,n={}){return{text:e,tone:t,...n}}function Z(e){return e?e.content.flatMap(e=>{let t=G(e);return t?.type===`text`&&typeof t.text==`string`?[t.text]:[]}).join(`
|
|
2
|
-
`):``}function Me(e,t){let n=e.split(`
|
|
3
|
-
`).map(e=>e.trimEnd()).filter(e=>e.length>0),r=t?n:n.slice(0,Ee),i=r.map(e=>X(e,`text`));return n.length>r.length&&i.push(X(`… ${n.length-r.length} more lines`,`dim`)),i}function Ne(e,t){if(e===`record_debug_evidence`){let e=je(q(t,`issue`));return{action:`record evidence`,...e?{detail:e}:{},metadata:Y(t,W)}}if(e===`run_fable_plan`){let e=Y(t,Oe);return q(t,`currentPlan`)&&e.push(`with current plan`),{action:`fable draft`,metadata:e}}if(e===`write_plan`)return{action:`save plan`,metadata:[]};let n=q(t,`decision`);return{action:n?`decide ${n}`:`request approval`,metadata:[]}}function Pe(e,t,n){let r=[G(t?.details)?.recorded===!0?X(`✓ evidence recorded as planning context`,`success`):X(`○ ${K(Z(t))||`not recorded`}`,`muted`)];if(!n.expanded)return r;for(let[t,n]of[[`issue`,`issue`],[`expectedBehavior`,`expected`],[`reproductionAttempt`,`reproduction`],[`actualBehavior`,`actual`]]){let i=q(e,t);i&&r.push(X(`${n} ${i}`,`text`,{label:n}))}for(let[t,n]of W){let i=e[t],a=Array.isArray(i)?i.filter(e=>typeof e==`string`):[];a.length!==0&&(r.push(X(J(a.length,n),`hi`,{bold:!0})),r.push(...a.map(e=>X(K(e),`text`,{indent:!0}))))}return r}function Fe(e,t){let n=G(e?.details),r=Z(e);if(n?.started!==!0){let e=q(n,`errorCode`);return[X(`○ ${K(r)||`fable planning did not start`}${e?` · ${e}`:``}`,`muted`)]}let i=q(n,`status`)??`unknown`,a=typeof n?.draft==`string`?n.draft:void 0,o=q(n,`errorCode`);if(!a)return[X(`✗ fable planning ${i}${o?` · ${o}`:``}`,`error`)];let s=i===`completed`;return[X(`${s?`✓`:`!`} fable draft · ${i}${o?` · ${o}`:``}`,s?`success`:`warning`,{bold:!0}),...Me(a,t.expanded)]}function Ie(e,t){let n=G(e?.details),r=q(n,`path`);if(t.isPartial)return[X(`◐ ${q(n,`phase`)??`checking`}${r?` ${r}`:``}`,`warning`)];let i=ke(n,`durationMs`);if(n?.written===!0)return[X(`✓ wrote ${r??`the plan`}${i===void 0?``:` · ${i}ms`}`,`success`)];let a=[X(`○ ${K(Z(e))||`plan not written`}`,`muted`)];return r&&a.push(X(`path ${r}`,`dim`)),a}function Le(e){let t=K(Z(e));return G(e?.details)?.exited===!0?[X(`✓ plan mode exited${t?` · ${t}`:``}`,`success`)]:[X(`○ staying in plan mode${t?` · ${t}`:``}`,`muted`)]}function Re(e){return K(Z(e))}function Q(e,t,n,r){return r.isError?[X(`✗ ${Re(n)||`${e} failed`}`,`error`)]:e===`record_debug_evidence`?Pe(t,n,r):e===`run_fable_plan`?r.isPartial?[X(`◐ drafting with the local Fable broker`,`warning`)]:Fe(n,r):e===`write_plan`?Ie(n,r):r.isPartial?[X(`◐ waiting for the review decision`,`warning`)]:Le(n)}function ze({toolName:e,args:t,result:n,running:r,isError:i}){let a=Ne(e,t),s=Q(e,t,n,{expanded:!1,isError:i,isPartial:r}),c=Q(e,t,n,{expanded:!0,isError:i,isPartial:r});return f(ne,{tone:_({running:r,isError:i}),expandable:c.length>s.length,children:({expanded:t})=>h(o,{children:[f(w,{title:a.action,children:f(`span`,{"data-testid":`tool-call-${e}`,title:[a.detail,...a.metadata].filter(Boolean).join(` · `)||void 0,className:`min-w-0 flex-1 truncate text-po-dim`,children:[a.detail,...a.metadata].filter(Boolean).join(` · `)})}),(t?c:s).length>0?f(T,{"data-testid":`tool-result-${e}`,children:f(se,{lines:t?c:s})}):null]})})}var Be=l({tools:[...we],message:ze,prompt:{claims:Te,component:Ce}}),$=(e,t)=>t===void 0?void 0:{...e,...t},Ve=s({id:`plan`,packageName:`@agimon-ai/po-plan`,host:{get settingsSections(){return[$({id:`plan`},le)]}},workspace:{get settingsSections(){return[$({id:`plan`},ue)]}},session:{get activityGroups(){return[$({name:`plan`},me)]},get fills(){return[$({slot:`activity.plan`,id:`plan`},be)]},get leaderBindings(){return[$({id:`plan.toggle`},xe)]},get modes(){return[$({name:`plan`},Se)]},get toolRenderers(){return[$({tools:[`plan`]},Be)]}}});export{Ve as webPlugin};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Ga as e,Pa as t}from"../chunks/po-web-runtime-D8FIos2q.js";var n=t({name:`profile`,command:`profile`,statusKey:`po-profile`,emptyLabel:`None`,order:10}),r=(e,t)=>t===void 0?void 0:{...e,...t},i=e({id:`profile`,packageName:`@agimon-ai/po-profile`,session:{get selectionAxes(){return[r({name:`profile`},n)]}}});export{i as webPlugin};
|