tenjin-cli 0.1.0-alpha.33 → 0.1.0-alpha.35
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/NOTICE.md +110 -0
- package/README.md +87 -81
- package/dist/{_esm-BIN7VY2L.js → _esm-2KST7HQ7.js} +7 -7
- package/dist/alive-5TV22PNF.js +51 -0
- package/dist/auth-XI7BJFLW.js +47 -0
- package/dist/{auto-update-Y24UL56V.js → auto-update-7L24KDWA.js} +4 -5
- package/dist/balance-DFHC6XEU.js +71 -0
- package/dist/{ccip-DHDFKTQV.js → ccip-HOW3DZYF.js} +4 -4
- package/dist/chunk-24XKUN2S.js +202 -0
- package/dist/chunk-24XKUN2S.js.map +1 -0
- package/dist/chunk-2L7TDGLV.js +56 -0
- package/dist/chunk-2L7TDGLV.js.map +1 -0
- package/dist/{chunk-C2Q76BVM.js → chunk-2U7H35IP.js} +29 -7
- package/dist/chunk-2U7H35IP.js.map +1 -0
- package/dist/chunk-2W4DQQUU.js +176 -0
- package/dist/chunk-2W4DQQUU.js.map +1 -0
- package/dist/{chunk-LRW6S53P.js → chunk-34SAECKZ.js} +35 -11
- package/dist/chunk-34SAECKZ.js.map +1 -0
- package/dist/{chunk-2I4QTOLB.js → chunk-3MZ7DYRO.js} +1 -1
- package/dist/chunk-3MZ7DYRO.js.map +1 -0
- package/dist/{chunk-RVPYTUP4.js → chunk-3Y2EHT4F.js} +13 -9
- package/dist/chunk-3Y2EHT4F.js.map +1 -0
- package/dist/chunk-3Y6BHIN6.js +169 -0
- package/dist/chunk-3Y6BHIN6.js.map +1 -0
- package/dist/{chunk-4K7TQHNP.js → chunk-3YPL6T3P.js} +17 -33
- package/dist/chunk-3YPL6T3P.js.map +1 -0
- package/dist/{chunk-E7SW44LM.js → chunk-44MVIRZH.js} +121 -6
- package/dist/chunk-44MVIRZH.js.map +1 -0
- package/dist/chunk-45MMSBHA.js +321 -0
- package/dist/chunk-45MMSBHA.js.map +1 -0
- package/dist/{chunk-3FMZGI7I.js → chunk-4CE6TMI5.js} +1 -1
- package/dist/chunk-4CE6TMI5.js.map +1 -0
- package/dist/{chunk-QXP3Z3JN.js → chunk-4MBCJFY4.js} +35 -3
- package/dist/chunk-4MBCJFY4.js.map +1 -0
- package/dist/chunk-4TPL54KW.js +227 -0
- package/dist/chunk-4TPL54KW.js.map +1 -0
- package/dist/chunk-54ELBTKE.js +1615 -0
- package/dist/chunk-54ELBTKE.js.map +1 -0
- package/dist/{chunk-NDGZDTSJ.js → chunk-5F4OB5B3.js} +115 -57
- package/dist/chunk-5F4OB5B3.js.map +1 -0
- package/dist/chunk-5HN4KVQU.js +3348 -0
- package/dist/chunk-5HN4KVQU.js.map +1 -0
- package/dist/{chunk-ZDZERB6L.js → chunk-5J4E5GYI.js} +572 -407
- package/dist/chunk-5J4E5GYI.js.map +1 -0
- package/dist/{chunk-ZNNXRNFD.js → chunk-5N4GGUBN.js} +48 -6
- package/dist/chunk-5N4GGUBN.js.map +1 -0
- package/dist/chunk-5USBZ2MU.js +58 -0
- package/dist/chunk-5USBZ2MU.js.map +1 -0
- package/dist/chunk-64WOMNYR.js +183 -0
- package/dist/chunk-64WOMNYR.js.map +1 -0
- package/dist/{chunk-ILNIZ5I2.js → chunk-65RS4LQS.js} +1825 -1715
- package/dist/chunk-65RS4LQS.js.map +1 -0
- package/dist/{chunk-IE7P2BZE.js → chunk-6QMDUDF2.js} +3 -3
- package/dist/{chunk-IADZOXKN.js → chunk-7SLOTLO7.js} +19 -697
- package/dist/chunk-7SLOTLO7.js.map +1 -0
- package/dist/{chunk-WFSPCCVW.js → chunk-7V25UAQO.js} +99 -99
- package/dist/{chunk-WFSPCCVW.js.map → chunk-7V25UAQO.js.map} +1 -1
- package/dist/chunk-BGA4DO5M.js +719 -0
- package/dist/chunk-BGA4DO5M.js.map +1 -0
- package/dist/chunk-BVP7YK2J.js +706 -0
- package/dist/chunk-BVP7YK2J.js.map +1 -0
- package/dist/chunk-C265QIMJ.js +83 -0
- package/dist/chunk-C265QIMJ.js.map +1 -0
- package/dist/{chunk-XQJXNMSB.js → chunk-CRG54LEB.js} +1 -1
- package/dist/chunk-CRG54LEB.js.map +1 -0
- package/dist/{chunk-KG3D7FIF.js → chunk-CZJOMUBP.js} +2 -2
- package/dist/{chunk-36RVGZNY.js → chunk-D6M3ZK66.js} +22 -39
- package/dist/chunk-D6M3ZK66.js.map +1 -0
- package/dist/{chunk-3UCIG4TG.js → chunk-DI4QAGRZ.js} +1 -11
- package/dist/chunk-DI4QAGRZ.js.map +1 -0
- package/dist/{chunk-JKKAIPTU.js → chunk-DIH2G3YG.js} +47 -10
- package/dist/chunk-DIH2G3YG.js.map +1 -0
- package/dist/chunk-DJ36BM62.js +78 -0
- package/dist/chunk-DJ36BM62.js.map +1 -0
- package/dist/chunk-DTEWAVNE.js +114 -0
- package/dist/chunk-DTEWAVNE.js.map +1 -0
- package/dist/chunk-F2KJAJ7T.js +13 -0
- package/dist/chunk-F2KJAJ7T.js.map +1 -0
- package/dist/{chunk-BF4XHEQK.js → chunk-F3QPGYOY.js} +6 -6
- package/dist/chunk-F3QPGYOY.js.map +1 -0
- package/dist/{chunk-3GNJXKIT.js → chunk-F43CV6UC.js} +2 -2
- package/dist/{chunk-J57UC3DD.js → chunk-FKVJKLPI.js} +3 -3
- package/dist/{chunk-V2LQLN5H.js → chunk-FYFHH7V5.js} +59 -8
- package/dist/{chunk-V2LQLN5H.js.map → chunk-FYFHH7V5.js.map} +1 -1
- package/dist/chunk-GAJC4BQZ.js +1096 -0
- package/dist/chunk-GAJC4BQZ.js.map +1 -0
- package/dist/{chunk-DOQGNFHM.js → chunk-GH5UKMZD.js} +2 -12
- package/dist/{chunk-DOQGNFHM.js.map → chunk-GH5UKMZD.js.map} +1 -1
- package/dist/{chunk-WYXUQGOL.js → chunk-HAZAN4UM.js} +7 -6
- package/dist/chunk-HAZAN4UM.js.map +1 -0
- package/dist/chunk-HI5XQOX2.js +393 -0
- package/dist/chunk-HI5XQOX2.js.map +1 -0
- package/dist/chunk-HKGUKAQW.js +488 -0
- package/dist/chunk-HKGUKAQW.js.map +1 -0
- package/dist/{chunk-SO3XRZPX.js → chunk-HPRVFJPM.js} +6 -6
- package/dist/{chunk-L6JEXB3E.js → chunk-HQR4BWKX.js} +3 -131
- package/dist/chunk-HQR4BWKX.js.map +1 -0
- package/dist/chunk-HZKANST2.js +177 -0
- package/dist/chunk-HZKANST2.js.map +1 -0
- package/dist/{chunk-UUGOUOVT.js → chunk-I557SAOM.js} +8 -2
- package/dist/chunk-I557SAOM.js.map +1 -0
- package/dist/{chunk-TC2WZLSC.js → chunk-IGLWLH73.js} +8 -7
- package/dist/chunk-IGLWLH73.js.map +1 -0
- package/dist/chunk-ILWCKCOI.js +58 -0
- package/dist/chunk-ILWCKCOI.js.map +1 -0
- package/dist/{chunk-2GP3HRYK.js → chunk-INSIW65E.js} +182 -182
- package/dist/{chunk-MPZUYCAP.js → chunk-IULCDMVG.js} +12 -1
- package/dist/chunk-IULCDMVG.js.map +1 -0
- package/dist/{chunk-INTFHMU4.js → chunk-IVNSUAVC.js} +25 -26
- package/dist/chunk-IVNSUAVC.js.map +1 -0
- package/dist/chunk-JDQZCREI.js +87 -0
- package/dist/chunk-JDQZCREI.js.map +1 -0
- package/dist/chunk-JHFFUVON.js +1050 -0
- package/dist/chunk-JHFFUVON.js.map +1 -0
- package/dist/{chunk-RL5UUDT4.js → chunk-JNUKLSMZ.js} +3 -3
- package/dist/chunk-JTILUN4W.js +2933 -0
- package/dist/chunk-JTILUN4W.js.map +1 -0
- package/dist/{chunk-OJNTCYQQ.js → chunk-JTX3BUDK.js} +37 -53
- package/dist/chunk-JTX3BUDK.js.map +1 -0
- package/dist/{chunk-X5ZBP3IY.js → chunk-JUUBBBY5.js} +2 -2
- package/dist/chunk-JUUBBBY5.js.map +1 -0
- package/dist/chunk-JWAK7JQB.js +15 -0
- package/dist/chunk-JWAK7JQB.js.map +1 -0
- package/dist/{chunk-UXZONNEQ.js → chunk-K5KNGC4I.js} +34 -31
- package/dist/chunk-K5KNGC4I.js.map +1 -0
- package/dist/chunk-KAQ4Q3TO.js +135 -0
- package/dist/chunk-KAQ4Q3TO.js.map +1 -0
- package/dist/chunk-KFVJYLVL.js +125 -0
- package/dist/chunk-KFVJYLVL.js.map +1 -0
- package/dist/chunk-KGUE5AVX.js +69 -0
- package/dist/chunk-KGUE5AVX.js.map +1 -0
- package/dist/{chunk-FVIGCDSV.js → chunk-KLDMLWXT.js} +11 -85
- package/dist/chunk-KLDMLWXT.js.map +1 -0
- package/dist/chunk-KNKDMTHU.js +453 -0
- package/dist/chunk-KNKDMTHU.js.map +1 -0
- package/dist/chunk-LDA6TAYQ.js +95 -0
- package/dist/chunk-LDA6TAYQ.js.map +1 -0
- package/dist/chunk-LWSSIZOY.js +347 -0
- package/dist/chunk-LWSSIZOY.js.map +1 -0
- package/dist/{chunk-ZURZHELF.js → chunk-MAHNZA6C.js} +158 -41
- package/dist/chunk-MAHNZA6C.js.map +1 -0
- package/dist/chunk-MEWZCIA6.js +220 -0
- package/dist/chunk-MEWZCIA6.js.map +1 -0
- package/dist/{chunk-2SNUOHAT.js → chunk-MEZJ3I63.js} +49 -1
- package/dist/chunk-MEZJ3I63.js.map +1 -0
- package/dist/chunk-MJDO4EXD.js +353 -0
- package/dist/chunk-MJDO4EXD.js.map +1 -0
- package/dist/chunk-NJA6NT3A.js +6595 -0
- package/dist/chunk-NJA6NT3A.js.map +1 -0
- package/dist/{chunk-LHHMV4GU.js → chunk-NVSKJPRC.js} +1 -1
- package/dist/{chunk-LHHMV4GU.js.map → chunk-NVSKJPRC.js.map} +1 -1
- package/dist/{chunk-4YOZGGTZ.js → chunk-OC7K2DVZ.js} +5 -5
- package/dist/chunk-OC7K2DVZ.js.map +1 -0
- package/dist/chunk-ODRPASFP.js +2078 -0
- package/dist/chunk-ODRPASFP.js.map +1 -0
- package/dist/chunk-OJJFANO6.js +133 -0
- package/dist/chunk-OJJFANO6.js.map +1 -0
- package/dist/{chunk-JNJWBTU2.js → chunk-OQWPRFAC.js} +332 -882
- package/dist/chunk-OQWPRFAC.js.map +1 -0
- package/dist/chunk-P4I7BFNJ.js +11 -0
- package/dist/chunk-P4I7BFNJ.js.map +1 -0
- package/dist/{chunk-SNNSAGMT.js → chunk-P6YQWIT2.js} +4058 -4039
- package/dist/chunk-P6YQWIT2.js.map +1 -0
- package/dist/{chunk-JRGFKVAZ.js → chunk-PETQ5WEA.js} +2 -2
- package/dist/{chunk-HMWYAUA6.js → chunk-Q6RSJCXB.js} +29 -69
- package/dist/chunk-Q6RSJCXB.js.map +1 -0
- package/dist/{chunk-U3IKUGRP.js → chunk-QKEUKBRK.js} +17 -23
- package/dist/chunk-QKEUKBRK.js.map +1 -0
- package/dist/{chunk-2RWB7RKE.js → chunk-QKYUCITR.js} +174 -5814
- package/dist/chunk-QKYUCITR.js.map +1 -0
- package/dist/chunk-QQDPRTLP.js +127 -0
- package/dist/chunk-QQDPRTLP.js.map +1 -0
- package/dist/chunk-QQYCYAKI.js +79 -0
- package/dist/chunk-QQYCYAKI.js.map +1 -0
- package/dist/chunk-R4KDH477.js +1064 -0
- package/dist/chunk-R4KDH477.js.map +1 -0
- package/dist/chunk-R5TR2DIK.js +119 -0
- package/dist/chunk-R5TR2DIK.js.map +1 -0
- package/dist/chunk-R62PKTAG.js +66 -0
- package/dist/chunk-R62PKTAG.js.map +1 -0
- package/dist/{chunk-BFDQ4WNW.js → chunk-RFZA7PSM.js} +4 -5
- package/dist/chunk-RFZA7PSM.js.map +1 -0
- package/dist/chunk-RGCPELQN.js +219 -0
- package/dist/chunk-RGCPELQN.js.map +1 -0
- package/dist/chunk-RGVCOG2S.js +910 -0
- package/dist/chunk-RGVCOG2S.js.map +1 -0
- package/dist/chunk-SOLNJ3AZ.js +209 -0
- package/dist/chunk-SOLNJ3AZ.js.map +1 -0
- package/dist/chunk-TFT2X7SH.js +77 -0
- package/dist/chunk-TFT2X7SH.js.map +1 -0
- package/dist/chunk-TUCKEEXE.js +2 -0
- package/dist/chunk-TVWCLUBI.js +293 -0
- package/dist/chunk-TVWCLUBI.js.map +1 -0
- package/dist/chunk-U4TRWSVE.js +78 -0
- package/dist/chunk-U4TRWSVE.js.map +1 -0
- package/dist/chunk-UIB33QQP.js +379 -0
- package/dist/chunk-UIB33QQP.js.map +1 -0
- package/dist/chunk-V6GIVALQ.js +1889 -0
- package/dist/chunk-V6GIVALQ.js.map +1 -0
- package/dist/chunk-VHXCPXUS.js +366 -0
- package/dist/chunk-VHXCPXUS.js.map +1 -0
- package/dist/{chunk-HGZEPQUT.js → chunk-VU6GMWF6.js} +17 -8
- package/dist/chunk-VU6GMWF6.js.map +1 -0
- package/dist/chunk-VWZYE3NC.js +8415 -0
- package/dist/chunk-VWZYE3NC.js.map +1 -0
- package/dist/{chunk-AGMVASXZ.js → chunk-W2GXIARJ.js} +88 -11
- package/dist/chunk-W2GXIARJ.js.map +1 -0
- package/dist/chunk-W4G3K3V7.js +288 -0
- package/dist/chunk-W4G3K3V7.js.map +1 -0
- package/dist/chunk-W74LJ5OT.js +588 -0
- package/dist/chunk-W74LJ5OT.js.map +1 -0
- package/dist/chunk-W7ELYLYK.js +233 -0
- package/dist/chunk-W7ELYLYK.js.map +1 -0
- package/dist/{chunk-BPMWXTFX.js → chunk-WFZX352D.js} +7 -7
- package/dist/chunk-WXA3WTPF.js +20 -0
- package/dist/chunk-WXA3WTPF.js.map +1 -0
- package/dist/chunk-XRGFH7FI.js +454 -0
- package/dist/chunk-XRGFH7FI.js.map +1 -0
- package/dist/chunk-XSCGUO2U.js +330 -0
- package/dist/chunk-XSCGUO2U.js.map +1 -0
- package/dist/chunk-XWROSMI5.js +1039 -0
- package/dist/chunk-XWROSMI5.js.map +1 -0
- package/dist/chunk-Y2EXZ47H.js +40 -0
- package/dist/chunk-Y2EXZ47H.js.map +1 -0
- package/dist/chunk-YJGEVBKZ.js +47 -0
- package/dist/chunk-YJGEVBKZ.js.map +1 -0
- package/dist/{chunk-6CMM6YCB.js → chunk-YWWMISDY.js} +2 -2
- package/dist/{chunk-WXA2BWTE.js → chunk-ZCT5DJ3G.js} +2 -48
- package/dist/chunk-ZCT5DJ3G.js.map +1 -0
- package/dist/chunk-ZEYA2WWX.js +982 -0
- package/dist/chunk-ZEYA2WWX.js.map +1 -0
- package/dist/chunk-ZRC7Z5X3.js +82 -0
- package/dist/chunk-ZRC7Z5X3.js.map +1 -0
- package/dist/{chunk-3AIHRXKO.js → chunk-ZS7JIUJ3.js} +12 -10
- package/dist/chunk-ZS7JIUJ3.js.map +1 -0
- package/dist/{clack-EZ7TDWQU.js → clack-Q4RNC5VE.js} +2 -6
- package/dist/{claude-cli-2YKABJJZ.js → claude-cli-GIIHOBGT.js} +4 -2
- package/dist/claude-install-BAUSJMW3.js +64 -0
- package/dist/{cli-E36SPKBW.js → cli-QY4KKA3D.js} +632 -150
- package/dist/cli-QY4KKA3D.js.map +1 -0
- package/dist/client-3YQKORVK.js +710 -0
- package/dist/client-3YQKORVK.js.map +1 -0
- package/dist/{codex-event-ZO2GEFE6.js → codex-event-EUTCAOTQ.js} +3 -5
- package/dist/{codex-host-KECJVTA2.js → codex-host-ZON3S6HU.js} +7 -7
- package/dist/{codex-install-HQZDGFXW.js → codex-install-HZV2DOAB.js} +242 -88
- package/dist/codex-install-HZV2DOAB.js.map +1 -0
- package/dist/config-QZOBMTEL.js +57 -0
- package/dist/config-names-Z5NZD5R2.js +224 -0
- package/dist/config-names-Z5NZD5R2.js.map +1 -0
- package/dist/config-rules-YOYHS6YL.js +55 -0
- package/dist/config-subagents-WQV2ZAD5.js +362 -0
- package/dist/config-subagents-WQV2ZAD5.js.map +1 -0
- package/dist/connect-YDWTYU4B.js +1020 -0
- package/dist/connect-YDWTYU4B.js.map +1 -0
- package/dist/core-0a66n3e7-TTP554XV.js +127 -0
- package/dist/core-0a66n3e7-TTP554XV.js.map +1 -0
- package/dist/core-0bmnpbz2-C2JIRVZO.js +10790 -0
- package/dist/core-0bmnpbz2-C2JIRVZO.js.map +1 -0
- package/dist/core-9je8ee1j-74DGHWPV.js +30 -0
- package/dist/core-9je8ee1j-74DGHWPV.js.map +1 -0
- package/dist/core-wadgcjfh-TSZFQZGH.js +666 -0
- package/dist/core-wadgcjfh-TSZFQZGH.js.map +1 -0
- package/dist/core-zg882d22-LKV5DZYW.js +37 -0
- package/dist/core-zg882d22-LKV5DZYW.js.map +1 -0
- package/dist/decision-QSKHOGCO.js +145 -0
- package/dist/{doctor-I6XQEKWD.js → doctor-ZWJXRD75.js} +162 -148
- package/dist/doctor-ZWJXRD75.js.map +1 -0
- package/dist/{env-proxy-R6ZMLQTT.js → env-proxy-XLSLHBKQ.js} +2 -2
- package/dist/{ethersCompat-Df4a6QIZ-X6YZWAML.js → ethersCompat-Df4a6QIZ-K3DMHR6Y.js} +5 -5
- package/dist/explicit-ME2NRADQ.js +371 -0
- package/dist/explicit-ME2NRADQ.js.map +1 -0
- package/dist/flush-stdio-NYIJ3QXT.js +18 -0
- package/dist/fund-VF7TLDJH.js +722 -0
- package/dist/fund-VF7TLDJH.js.map +1 -0
- package/dist/hook-command-VZ27MGWO.js +49 -0
- package/dist/hosts/claude/.claude-plugin/marketplace.json +2 -2
- package/dist/hosts/claude/tenjin/.claude-plugin/plugin.json +2 -2
- package/dist/hosts/claude/tenjin/hooks/hook-data.ts +152 -0
- package/dist/hosts/claude/tenjin/hooks/hooks.json +7 -0
- package/dist/hosts/claude/tenjin/hooks/model-viewer.tsx +2987 -0
- package/dist/hosts/claude/tenjin/hooks/register.tsx +527 -56
- package/dist/hosts/claude/tenjin/skills/tenjin-pay/SKILL.md +14 -4
- package/dist/hosts/claude/tenjin/types/index.d.ts +144 -1
- package/dist/{hosts-DVQJ32QC.js → hosts-3EMTVM4H.js} +7 -6
- package/dist/index.js +18 -15
- package/dist/index.js.map +1 -1
- package/dist/install-ZA7L2UF3.js +115 -0
- package/dist/install-funding-JDGYTF72.js +30 -0
- package/dist/install-identity-FFAYEFLX.js +30 -0
- package/dist/{install-wallet-5M4OTYLX.js → install-wallet-2SFOVE3Q.js} +68 -53
- package/dist/install-wallet-2SFOVE3Q.js.map +1 -0
- package/dist/mcp-36S6MK3C.js +67642 -0
- package/dist/mcp-36S6MK3C.js.map +1 -0
- package/dist/new-install-5L4GY3LN.js +51 -0
- package/dist/{package-IJFGMWEV.js → package-BONDXSV3.js} +2 -2
- package/dist/{passphrase-IFTDS3CU.js → passphrase-T4ULBN4M.js} +16 -12
- package/dist/{paths-XCSAKISU.js → paths-O2KDWZ76.js} +18 -28
- package/dist/pay-CMV5KL74.js +74 -0
- package/dist/{payments-HFPPWHTV.js → payments-Z6UBZL4Z.js} +36 -26
- package/dist/payments-Z6UBZL4Z.js.map +1 -0
- package/dist/reclaim-subagent-credit-ABSF67SJ.js +105 -0
- package/dist/reclaim-subagent-credit-ABSF67SJ.js.map +1 -0
- package/dist/{redact-D7ASVWKL.js → redact-LOTHE5TS.js} +2 -8
- package/dist/redact-LOTHE5TS.js.map +1 -0
- package/dist/routing-quote-AHLAREXR.js +40 -0
- package/dist/routing-quote-AHLAREXR.js.map +1 -0
- package/dist/run-JH7ELYAM.js +88 -0
- package/dist/run-JH7ELYAM.js.map +1 -0
- package/dist/runtime-2GX4ALJP.js +410 -0
- package/dist/runtime-2GX4ALJP.js.map +1 -0
- package/dist/runtime-activate-IDQ2NCSP.js +39 -0
- package/dist/runtime-activate-IDQ2NCSP.js.map +1 -0
- package/dist/{runtime-fetch-ZSSSK72Y.js → runtime-fetch-6LOBHBEN.js} +4 -4
- package/dist/runtime-fetch-6LOBHBEN.js.map +1 -0
- package/dist/runtime-launchers-YAPKCBHV.js +31 -0
- package/dist/runtime-launchers-YAPKCBHV.js.map +1 -0
- package/dist/{runtime-layout-WIDILZ6K.js → runtime-layout-QHZQJV7C.js} +5 -4
- package/dist/runtime-layout-QHZQJV7C.js.map +1 -0
- package/dist/runtime-place-4POL4KK4.js +37 -0
- package/dist/runtime-place-4POL4KK4.js.map +1 -0
- package/dist/runtime-provenance-MNJGVBV2.js +12 -0
- package/dist/runtime-provenance-MNJGVBV2.js.map +1 -0
- package/dist/{secp256k1-ZZZT2CAX.js → secp256k1-N5P2GVGF.js} +3 -3
- package/dist/secp256k1-N5P2GVGF.js.map +1 -0
- package/dist/{send-GCVEAQKL.js → send-ELXFKEKY.js} +35 -32
- package/dist/send-ELXFKEKY.js.map +1 -0
- package/dist/status-FXUFWJDM.js +404 -0
- package/dist/status-FXUFWJDM.js.map +1 -0
- package/dist/{status-line-OPCXDHL2.js → status-line-IH5JBWBC.js} +51 -43
- package/dist/status-line-IH5JBWBC.js.map +1 -0
- package/dist/streamableHttp-CP2ZQBIK.js +768 -0
- package/dist/streamableHttp-CP2ZQBIK.js.map +1 -0
- package/dist/{uninstall-BAWRBXXQ.js → uninstall-LJZUKM4D.js} +76 -76
- package/dist/uninstall-LJZUKM4D.js.map +1 -0
- package/dist/update-EUIX72IX.js +68 -0
- package/dist/update-EUIX72IX.js.map +1 -0
- package/dist/usage-EKDC7LUC.js +180 -0
- package/dist/usage-EKDC7LUC.js.map +1 -0
- package/dist/{usdc-VG4CIOUK.js → usdc-YIHK2OMC.js} +8 -12
- package/dist/usdc-YIHK2OMC.js.map +1 -0
- package/dist/{viemAdapter-By13KInL-DOFTEIJV.js → viemAdapter-By13KInL-PRLSIESK.js} +5 -5
- package/dist/viemAdapter-By13KInL-PRLSIESK.js.map +1 -0
- package/dist/wallet-HSW757W6.js +80 -0
- package/dist/wallet-HSW757W6.js.map +1 -0
- package/dist/wallet-kdf-worker.mjs +1433 -818
- package/docs/agent-permissions.md +88 -155
- package/docs/router-reference.md +236 -0
- package/docs/safety-model.md +31 -33
- package/docs/subagents-internals.md +97 -0
- package/docs/subagents.md +348 -0
- package/docs/troubleshooting.md +10 -6
- package/package.json +12 -8
- package/scripts/installers/install.sh +7 -1
- package/dist/alive-GSOWKUOY.js +0 -38
- package/dist/chunk-2I4QTOLB.js.map +0 -1
- package/dist/chunk-2M2VPI2E.js +0 -560
- package/dist/chunk-2M2VPI2E.js.map +0 -1
- package/dist/chunk-2RWB7RKE.js.map +0 -1
- package/dist/chunk-2SNUOHAT.js.map +0 -1
- package/dist/chunk-3623BLPV.js +0 -184
- package/dist/chunk-3623BLPV.js.map +0 -1
- package/dist/chunk-36RVGZNY.js.map +0 -1
- package/dist/chunk-3AIHRXKO.js.map +0 -1
- package/dist/chunk-3FMZGI7I.js.map +0 -1
- package/dist/chunk-3UCIG4TG.js.map +0 -1
- package/dist/chunk-4K7TQHNP.js.map +0 -1
- package/dist/chunk-4LMUQMBH.js +0 -29
- package/dist/chunk-4LMUQMBH.js.map +0 -1
- package/dist/chunk-4USCZ2NI.js +0 -228
- package/dist/chunk-4USCZ2NI.js.map +0 -1
- package/dist/chunk-4YOZGGTZ.js.map +0 -1
- package/dist/chunk-62KNUYWD.js +0 -111
- package/dist/chunk-62KNUYWD.js.map +0 -1
- package/dist/chunk-A5GKIG5O.js +0 -2037
- package/dist/chunk-A5GKIG5O.js.map +0 -1
- package/dist/chunk-AGMVASXZ.js.map +0 -1
- package/dist/chunk-BF4XHEQK.js.map +0 -1
- package/dist/chunk-BFDQ4WNW.js.map +0 -1
- package/dist/chunk-C2Q76BVM.js.map +0 -1
- package/dist/chunk-CEXSOI5R.js +0 -808
- package/dist/chunk-CEXSOI5R.js.map +0 -1
- package/dist/chunk-E7SW44LM.js.map +0 -1
- package/dist/chunk-EDJWHDDL.js +0 -33
- package/dist/chunk-EDJWHDDL.js.map +0 -1
- package/dist/chunk-FVIGCDSV.js.map +0 -1
- package/dist/chunk-GTTUCOPD.js +0 -105
- package/dist/chunk-GTTUCOPD.js.map +0 -1
- package/dist/chunk-HDPUXS3Z.js +0 -122
- package/dist/chunk-HDPUXS3Z.js.map +0 -1
- package/dist/chunk-HGGWCP7W.js +0 -120
- package/dist/chunk-HGGWCP7W.js.map +0 -1
- package/dist/chunk-HGZEPQUT.js.map +0 -1
- package/dist/chunk-HMWYAUA6.js.map +0 -1
- package/dist/chunk-IADZOXKN.js.map +0 -1
- package/dist/chunk-ILNIZ5I2.js.map +0 -1
- package/dist/chunk-INTFHMU4.js.map +0 -1
- package/dist/chunk-JKKAIPTU.js.map +0 -1
- package/dist/chunk-JNJWBTU2.js.map +0 -1
- package/dist/chunk-KM7RY2ZS.js +0 -246
- package/dist/chunk-KM7RY2ZS.js.map +0 -1
- package/dist/chunk-KOGZDMHO.js +0 -21
- package/dist/chunk-KOGZDMHO.js.map +0 -1
- package/dist/chunk-L6JEXB3E.js.map +0 -1
- package/dist/chunk-LRW6S53P.js.map +0 -1
- package/dist/chunk-LXAYUOXI.js +0 -511
- package/dist/chunk-LXAYUOXI.js.map +0 -1
- package/dist/chunk-MEFB5KHA.js +0 -59
- package/dist/chunk-MEFB5KHA.js.map +0 -1
- package/dist/chunk-MPZUYCAP.js.map +0 -1
- package/dist/chunk-NDGZDTSJ.js.map +0 -1
- package/dist/chunk-OJNTCYQQ.js.map +0 -1
- package/dist/chunk-P3LFTKE7.js +0 -58
- package/dist/chunk-P3LFTKE7.js.map +0 -1
- package/dist/chunk-QXP3Z3JN.js.map +0 -1
- package/dist/chunk-RVPYTUP4.js.map +0 -1
- package/dist/chunk-SNNSAGMT.js.map +0 -1
- package/dist/chunk-TC2WZLSC.js.map +0 -1
- package/dist/chunk-TKPF35W6.js +0 -29
- package/dist/chunk-TKPF35W6.js.map +0 -1
- package/dist/chunk-U3IKUGRP.js.map +0 -1
- package/dist/chunk-UUGOUOVT.js.map +0 -1
- package/dist/chunk-UXZONNEQ.js.map +0 -1
- package/dist/chunk-WXA2BWTE.js.map +0 -1
- package/dist/chunk-WYXUQGOL.js.map +0 -1
- package/dist/chunk-X5ZBP3IY.js.map +0 -1
- package/dist/chunk-XKESD27X.js +0 -10
- package/dist/chunk-XKESD27X.js.map +0 -1
- package/dist/chunk-XQJXNMSB.js.map +0 -1
- package/dist/chunk-Y527D4TV.js +0 -56
- package/dist/chunk-Y527D4TV.js.map +0 -1
- package/dist/chunk-ZDZERB6L.js.map +0 -1
- package/dist/chunk-ZNNXRNFD.js.map +0 -1
- package/dist/chunk-ZURZHELF.js.map +0 -1
- package/dist/cli-E36SPKBW.js.map +0 -1
- package/dist/codex-install-HQZDGFXW.js.map +0 -1
- package/dist/config-HY2E4GGW.js +0 -55
- package/dist/doctor-I6XQEKWD.js.map +0 -1
- package/dist/fund-2QRO7OJL.js +0 -378
- package/dist/fund-2QRO7OJL.js.map +0 -1
- package/dist/hook-command-2UBCSZG6.js +0 -43
- package/dist/install-ILUX5C4A.js +0 -107
- package/dist/install-identity-TZKGY6LQ.js +0 -31
- package/dist/install-wallet-5M4OTYLX.js.map +0 -1
- package/dist/mcp-LE4DUS22.js +0 -14127
- package/dist/mcp-LE4DUS22.js.map +0 -1
- package/dist/pay-WCG3IH4R.js +0 -55
- package/dist/payments-HFPPWHTV.js.map +0 -1
- package/dist/plugin-registration-PZFI5GZW.js +0 -68
- package/dist/runtime-UZOKSUZX.js +0 -1321
- package/dist/runtime-UZOKSUZX.js.map +0 -1
- package/dist/send-GCVEAQKL.js.map +0 -1
- package/dist/status-HCVAOCN7.js +0 -150
- package/dist/status-HCVAOCN7.js.map +0 -1
- package/dist/status-line-OPCXDHL2.js.map +0 -1
- package/dist/uninstall-BAWRBXXQ.js.map +0 -1
- package/dist/update-CACXLQLR.js +0 -56
- package/dist/wallet-QL4UUXEZ.js +0 -55
- /package/dist/{_esm-BIN7VY2L.js.map → _esm-2KST7HQ7.js.map} +0 -0
- /package/dist/{alive-GSOWKUOY.js.map → alive-5TV22PNF.js.map} +0 -0
- /package/dist/{auto-update-Y24UL56V.js.map → auth-XI7BJFLW.js.map} +0 -0
- /package/dist/{ccip-DHDFKTQV.js.map → auto-update-7L24KDWA.js.map} +0 -0
- /package/dist/{clack-EZ7TDWQU.js.map → balance-DFHC6XEU.js.map} +0 -0
- /package/dist/{claude-cli-2YKABJJZ.js.map → ccip-HOW3DZYF.js.map} +0 -0
- /package/dist/{chunk-IE7P2BZE.js.map → chunk-6QMDUDF2.js.map} +0 -0
- /package/dist/{chunk-KG3D7FIF.js.map → chunk-CZJOMUBP.js.map} +0 -0
- /package/dist/{chunk-3GNJXKIT.js.map → chunk-F43CV6UC.js.map} +0 -0
- /package/dist/{chunk-J57UC3DD.js.map → chunk-FKVJKLPI.js.map} +0 -0
- /package/dist/{chunk-SO3XRZPX.js.map → chunk-HPRVFJPM.js.map} +0 -0
- /package/dist/{chunk-2GP3HRYK.js.map → chunk-INSIW65E.js.map} +0 -0
- /package/dist/{chunk-RL5UUDT4.js.map → chunk-JNUKLSMZ.js.map} +0 -0
- /package/dist/{chunk-JRGFKVAZ.js.map → chunk-PETQ5WEA.js.map} +0 -0
- /package/dist/{codex-event-ZO2GEFE6.js.map → chunk-TUCKEEXE.js.map} +0 -0
- /package/dist/{chunk-BPMWXTFX.js.map → chunk-WFZX352D.js.map} +0 -0
- /package/dist/{chunk-6CMM6YCB.js.map → chunk-YWWMISDY.js.map} +0 -0
- /package/dist/{codex-host-KECJVTA2.js.map → clack-Q4RNC5VE.js.map} +0 -0
- /package/dist/{config-HY2E4GGW.js.map → claude-cli-GIIHOBGT.js.map} +0 -0
- /package/dist/{env-proxy-R6ZMLQTT.js.map → claude-install-BAUSJMW3.js.map} +0 -0
- /package/dist/{ethersCompat-Df4a6QIZ-X6YZWAML.js.map → codex-event-EUTCAOTQ.js.map} +0 -0
- /package/dist/{hook-command-2UBCSZG6.js.map → codex-host-ZON3S6HU.js.map} +0 -0
- /package/dist/{hosts-DVQJ32QC.js.map → config-QZOBMTEL.js.map} +0 -0
- /package/dist/{install-ILUX5C4A.js.map → config-rules-YOYHS6YL.js.map} +0 -0
- /package/dist/{install-identity-TZKGY6LQ.js.map → decision-QSKHOGCO.js.map} +0 -0
- /package/dist/{package-IJFGMWEV.js.map → env-proxy-XLSLHBKQ.js.map} +0 -0
- /package/dist/{passphrase-IFTDS3CU.js.map → ethersCompat-Df4a6QIZ-K3DMHR6Y.js.map} +0 -0
- /package/dist/{paths-XCSAKISU.js.map → flush-stdio-NYIJ3QXT.js.map} +0 -0
- /package/dist/{pay-WCG3IH4R.js.map → hook-command-VZ27MGWO.js.map} +0 -0
- /package/dist/{plugin-registration-PZFI5GZW.js.map → hosts-3EMTVM4H.js.map} +0 -0
- /package/dist/{redact-D7ASVWKL.js.map → install-ZA7L2UF3.js.map} +0 -0
- /package/dist/{runtime-fetch-ZSSSK72Y.js.map → install-funding-JDGYTF72.js.map} +0 -0
- /package/dist/{runtime-layout-WIDILZ6K.js.map → install-identity-FFAYEFLX.js.map} +0 -0
- /package/dist/{secp256k1-ZZZT2CAX.js.map → new-install-5L4GY3LN.js.map} +0 -0
- /package/dist/{update-CACXLQLR.js.map → package-BONDXSV3.js.map} +0 -0
- /package/dist/{usdc-VG4CIOUK.js.map → passphrase-T4ULBN4M.js.map} +0 -0
- /package/dist/{viemAdapter-By13KInL-DOFTEIJV.js.map → paths-O2KDWZ76.js.map} +0 -0
- /package/dist/{wallet-QL4UUXEZ.js.map → pay-CMV5KL74.js.map} +0 -0
|
@@ -0,0 +1,768 @@
|
|
|
1
|
+
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
UnauthorizedError,
|
|
4
|
+
auth,
|
|
5
|
+
createFetchWithInit,
|
|
6
|
+
extractWWWAuthenticateParams,
|
|
7
|
+
fetchLeavingRedirects,
|
|
8
|
+
fetchWithinOrigin,
|
|
9
|
+
followWithinOrigin,
|
|
10
|
+
normalizeHeaders,
|
|
11
|
+
unfollowedRedirect
|
|
12
|
+
} from "./chunk-GAJC4BQZ.js";
|
|
13
|
+
import {
|
|
14
|
+
JSONRPCMessageSchema,
|
|
15
|
+
isInitializedNotification,
|
|
16
|
+
isJSONRPCRequest,
|
|
17
|
+
isJSONRPCResultResponse
|
|
18
|
+
} from "./chunk-54ELBTKE.js";
|
|
19
|
+
import "./chunk-P6YQWIT2.js";
|
|
20
|
+
import {
|
|
21
|
+
__commonJS,
|
|
22
|
+
__toESM
|
|
23
|
+
} from "./chunk-ZXTAQYNA.js";
|
|
24
|
+
|
|
25
|
+
// node_modules/.pnpm/content-type@1.0.5/node_modules/content-type/index.js
|
|
26
|
+
var require_content_type = __commonJS({
|
|
27
|
+
"node_modules/.pnpm/content-type@1.0.5/node_modules/content-type/index.js"(exports) {
|
|
28
|
+
"use strict";
|
|
29
|
+
var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g;
|
|
30
|
+
var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/;
|
|
31
|
+
var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
32
|
+
var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g;
|
|
33
|
+
var QUOTE_REGEXP = /([\\"])/g;
|
|
34
|
+
var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
35
|
+
exports.format = format;
|
|
36
|
+
exports.parse = parse;
|
|
37
|
+
function format(obj) {
|
|
38
|
+
if (!obj || typeof obj !== "object") {
|
|
39
|
+
throw new TypeError("argument obj is required");
|
|
40
|
+
}
|
|
41
|
+
var parameters = obj.parameters;
|
|
42
|
+
var type = obj.type;
|
|
43
|
+
if (!type || !TYPE_REGEXP.test(type)) {
|
|
44
|
+
throw new TypeError("invalid type");
|
|
45
|
+
}
|
|
46
|
+
var string = type;
|
|
47
|
+
if (parameters && typeof parameters === "object") {
|
|
48
|
+
var param;
|
|
49
|
+
var params = Object.keys(parameters).sort();
|
|
50
|
+
for (var i = 0; i < params.length; i++) {
|
|
51
|
+
param = params[i];
|
|
52
|
+
if (!TOKEN_REGEXP.test(param)) {
|
|
53
|
+
throw new TypeError("invalid parameter name");
|
|
54
|
+
}
|
|
55
|
+
string += "; " + param + "=" + qstring(parameters[param]);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return string;
|
|
59
|
+
}
|
|
60
|
+
function parse(string) {
|
|
61
|
+
if (!string) {
|
|
62
|
+
throw new TypeError("argument string is required");
|
|
63
|
+
}
|
|
64
|
+
var header = typeof string === "object" ? getcontenttype(string) : string;
|
|
65
|
+
if (typeof header !== "string") {
|
|
66
|
+
throw new TypeError("argument string is required to be a string");
|
|
67
|
+
}
|
|
68
|
+
var index = header.indexOf(";");
|
|
69
|
+
var type = index !== -1 ? header.slice(0, index).trim() : header.trim();
|
|
70
|
+
if (!TYPE_REGEXP.test(type)) {
|
|
71
|
+
throw new TypeError("invalid media type");
|
|
72
|
+
}
|
|
73
|
+
var obj = new ContentType(type.toLowerCase());
|
|
74
|
+
if (index !== -1) {
|
|
75
|
+
var key;
|
|
76
|
+
var match;
|
|
77
|
+
var value;
|
|
78
|
+
PARAM_REGEXP.lastIndex = index;
|
|
79
|
+
while (match = PARAM_REGEXP.exec(header)) {
|
|
80
|
+
if (match.index !== index) {
|
|
81
|
+
throw new TypeError("invalid parameter format");
|
|
82
|
+
}
|
|
83
|
+
index += match[0].length;
|
|
84
|
+
key = match[1].toLowerCase();
|
|
85
|
+
value = match[2];
|
|
86
|
+
if (value.charCodeAt(0) === 34) {
|
|
87
|
+
value = value.slice(1, -1);
|
|
88
|
+
if (value.indexOf("\\") !== -1) {
|
|
89
|
+
value = value.replace(QESC_REGEXP, "$1");
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
obj.parameters[key] = value;
|
|
93
|
+
}
|
|
94
|
+
if (index !== header.length) {
|
|
95
|
+
throw new TypeError("invalid parameter format");
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return obj;
|
|
99
|
+
}
|
|
100
|
+
function getcontenttype(obj) {
|
|
101
|
+
var header;
|
|
102
|
+
if (typeof obj.getHeader === "function") {
|
|
103
|
+
header = obj.getHeader("content-type");
|
|
104
|
+
} else if (typeof obj.headers === "object") {
|
|
105
|
+
header = obj.headers && obj.headers["content-type"];
|
|
106
|
+
}
|
|
107
|
+
if (typeof header !== "string") {
|
|
108
|
+
throw new TypeError("content-type header is missing from object");
|
|
109
|
+
}
|
|
110
|
+
return header;
|
|
111
|
+
}
|
|
112
|
+
function qstring(val) {
|
|
113
|
+
var str = String(val);
|
|
114
|
+
if (TOKEN_REGEXP.test(str)) {
|
|
115
|
+
return str;
|
|
116
|
+
}
|
|
117
|
+
if (str.length > 0 && !TEXT_REGEXP.test(str)) {
|
|
118
|
+
throw new TypeError("invalid parameter value");
|
|
119
|
+
}
|
|
120
|
+
return '"' + str.replace(QUOTE_REGEXP, "\\$1") + '"';
|
|
121
|
+
}
|
|
122
|
+
function ContentType(type) {
|
|
123
|
+
this.parameters = /* @__PURE__ */ Object.create(null);
|
|
124
|
+
this.type = type;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
// node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.js
|
|
130
|
+
var import_content_type = __toESM(require_content_type(), 1);
|
|
131
|
+
function mediaTypeEssence(header) {
|
|
132
|
+
if (!header) {
|
|
133
|
+
return void 0;
|
|
134
|
+
}
|
|
135
|
+
try {
|
|
136
|
+
return import_content_type.default.parse(header).type;
|
|
137
|
+
} catch {
|
|
138
|
+
const essence = (header.split(";", 1)[0] ?? "").trim().toLowerCase();
|
|
139
|
+
if (essence === "" || header.slice(essence.length).includes(",")) {
|
|
140
|
+
return void 0;
|
|
141
|
+
}
|
|
142
|
+
return essence;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// node_modules/.pnpm/eventsource-parser@3.1.1/node_modules/eventsource-parser/dist/index.js
|
|
147
|
+
var ParseError = class extends Error {
|
|
148
|
+
constructor(message, options) {
|
|
149
|
+
super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
var LF = 10;
|
|
153
|
+
var CR = 13;
|
|
154
|
+
var SPACE = 32;
|
|
155
|
+
function noop(_arg) {
|
|
156
|
+
}
|
|
157
|
+
function createParser(config) {
|
|
158
|
+
if (typeof config == "function")
|
|
159
|
+
throw new TypeError(
|
|
160
|
+
"`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?"
|
|
161
|
+
);
|
|
162
|
+
const { onEvent = noop, onError = noop, onRetry = noop, onComment, maxBufferSize } = config, pendingFragments = [];
|
|
163
|
+
let pendingFragmentsLength = 0, isFirstChunk = true, id, data = "", dataLines = 0, eventType, terminated = false;
|
|
164
|
+
function feed(chunk) {
|
|
165
|
+
if (terminated)
|
|
166
|
+
throw new Error(
|
|
167
|
+
"Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing."
|
|
168
|
+
);
|
|
169
|
+
if (isFirstChunk && (isFirstChunk = false, chunk.charCodeAt(0) === 239 && chunk.charCodeAt(1) === 187 && chunk.charCodeAt(2) === 191 && (chunk = chunk.slice(3))), pendingFragments.length === 0) {
|
|
170
|
+
const trailing2 = processLines(chunk);
|
|
171
|
+
trailing2 !== "" && (pendingFragments.push(trailing2), pendingFragmentsLength = trailing2.length), checkBufferSize();
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
if (chunk.indexOf(`
|
|
175
|
+
`) === -1 && chunk.indexOf("\r") === -1) {
|
|
176
|
+
pendingFragments.push(chunk), pendingFragmentsLength += chunk.length, checkBufferSize();
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
pendingFragments.push(chunk);
|
|
180
|
+
const input = pendingFragments.join("");
|
|
181
|
+
pendingFragments.length = 0, pendingFragmentsLength = 0;
|
|
182
|
+
const trailing = processLines(input);
|
|
183
|
+
trailing !== "" && (pendingFragments.push(trailing), pendingFragmentsLength = trailing.length), checkBufferSize();
|
|
184
|
+
}
|
|
185
|
+
function checkBufferSize() {
|
|
186
|
+
maxBufferSize !== void 0 && (pendingFragmentsLength + data.length <= maxBufferSize || (terminated = true, pendingFragments.length = 0, pendingFragmentsLength = 0, id = void 0, data = "", dataLines = 0, eventType = void 0, onError(
|
|
187
|
+
new ParseError(`Buffered data exceeded max buffer size of ${maxBufferSize} characters`, {
|
|
188
|
+
type: "max-buffer-size-exceeded"
|
|
189
|
+
})
|
|
190
|
+
)));
|
|
191
|
+
}
|
|
192
|
+
function processLines(chunk) {
|
|
193
|
+
let searchIndex = 0;
|
|
194
|
+
if (chunk.indexOf("\r") === -1) {
|
|
195
|
+
let lfIndex = chunk.indexOf(`
|
|
196
|
+
`, searchIndex);
|
|
197
|
+
for (; lfIndex !== -1; ) {
|
|
198
|
+
if (searchIndex === lfIndex) {
|
|
199
|
+
dataLines > 0 && onEvent({ id, event: eventType, data }), id = void 0, data = "", dataLines = 0, eventType = void 0, searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
|
|
200
|
+
`, searchIndex);
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
const firstCharCode = chunk.charCodeAt(searchIndex);
|
|
204
|
+
if (isDataPrefix(chunk, searchIndex, firstCharCode)) {
|
|
205
|
+
const valueStart = chunk.charCodeAt(searchIndex + 5) === SPACE ? searchIndex + 6 : searchIndex + 5, value = chunk.slice(valueStart, lfIndex);
|
|
206
|
+
if (dataLines === 0 && chunk.charCodeAt(lfIndex + 1) === LF) {
|
|
207
|
+
onEvent({ id, event: eventType, data: value }), id = void 0, data = "", eventType = void 0, searchIndex = lfIndex + 2, lfIndex = chunk.indexOf(`
|
|
208
|
+
`, searchIndex);
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
data = dataLines === 0 ? value : `${data}
|
|
212
|
+
${value}`, dataLines++;
|
|
213
|
+
} else isEventPrefix(chunk, searchIndex, firstCharCode) ? eventType = chunk.slice(
|
|
214
|
+
chunk.charCodeAt(searchIndex + 6) === SPACE ? searchIndex + 7 : searchIndex + 6,
|
|
215
|
+
lfIndex
|
|
216
|
+
) || void 0 : parseLine(chunk, searchIndex, lfIndex);
|
|
217
|
+
searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
|
|
218
|
+
`, searchIndex);
|
|
219
|
+
}
|
|
220
|
+
return chunk.slice(searchIndex);
|
|
221
|
+
}
|
|
222
|
+
for (; searchIndex < chunk.length; ) {
|
|
223
|
+
const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
|
|
224
|
+
`, searchIndex);
|
|
225
|
+
let lineEnd = -1;
|
|
226
|
+
if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = crIndex < lfIndex ? crIndex : lfIndex : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1)
|
|
227
|
+
break;
|
|
228
|
+
parseLine(chunk, searchIndex, lineEnd), searchIndex = lineEnd + 1, chunk.charCodeAt(searchIndex - 1) === CR && chunk.charCodeAt(searchIndex) === LF && searchIndex++;
|
|
229
|
+
}
|
|
230
|
+
return chunk.slice(searchIndex);
|
|
231
|
+
}
|
|
232
|
+
function parseLine(chunk, start, end) {
|
|
233
|
+
if (start === end) {
|
|
234
|
+
dispatchEvent();
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
const firstCharCode = chunk.charCodeAt(start);
|
|
238
|
+
if (isDataPrefix(chunk, start, firstCharCode)) {
|
|
239
|
+
const valueStart = chunk.charCodeAt(start + 5) === SPACE ? start + 6 : start + 5, value2 = chunk.slice(valueStart, end);
|
|
240
|
+
data = dataLines === 0 ? value2 : `${data}
|
|
241
|
+
${value2}`, dataLines++;
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
if (isEventPrefix(chunk, start, firstCharCode)) {
|
|
245
|
+
eventType = chunk.slice(chunk.charCodeAt(start + 6) === SPACE ? start + 7 : start + 6, end) || void 0;
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
if (firstCharCode === 105 && chunk.charCodeAt(start + 1) === 100 && chunk.charCodeAt(start + 2) === 58) {
|
|
249
|
+
const value2 = chunk.slice(chunk.charCodeAt(start + 3) === SPACE ? start + 4 : start + 3, end);
|
|
250
|
+
value2.includes("\0") || (id = value2);
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
if (firstCharCode === 58) {
|
|
254
|
+
if (onComment) {
|
|
255
|
+
const line2 = chunk.slice(start, end);
|
|
256
|
+
onComment(line2.slice(chunk.charCodeAt(start + 1) === SPACE ? 2 : 1));
|
|
257
|
+
}
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
const line = chunk.slice(start, end), fieldSeparatorIndex = line.indexOf(":");
|
|
261
|
+
if (fieldSeparatorIndex === -1) {
|
|
262
|
+
processField(line, "", line);
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
const field = line.slice(0, fieldSeparatorIndex), offset = line.charCodeAt(fieldSeparatorIndex + 1) === SPACE ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
|
|
266
|
+
processField(field, value, line);
|
|
267
|
+
}
|
|
268
|
+
function processField(field, value, line) {
|
|
269
|
+
switch (field) {
|
|
270
|
+
case "event":
|
|
271
|
+
eventType = value || void 0;
|
|
272
|
+
break;
|
|
273
|
+
case "data":
|
|
274
|
+
data = dataLines === 0 ? value : `${data}
|
|
275
|
+
${value}`, dataLines++;
|
|
276
|
+
break;
|
|
277
|
+
case "id":
|
|
278
|
+
value.includes("\0") || (id = value);
|
|
279
|
+
break;
|
|
280
|
+
case "retry":
|
|
281
|
+
/^\d+$/.test(value) ? onRetry(parseInt(value, 10)) : onError(
|
|
282
|
+
new ParseError(`Invalid \`retry\` value: "${value}"`, {
|
|
283
|
+
type: "invalid-retry",
|
|
284
|
+
value,
|
|
285
|
+
line
|
|
286
|
+
})
|
|
287
|
+
);
|
|
288
|
+
break;
|
|
289
|
+
default:
|
|
290
|
+
onError(
|
|
291
|
+
new ParseError(
|
|
292
|
+
`Unknown field "${field.length > 20 ? `${field.slice(0, 20)}\u2026` : field}"`,
|
|
293
|
+
{ type: "unknown-field", field, value, line }
|
|
294
|
+
)
|
|
295
|
+
);
|
|
296
|
+
break;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
function dispatchEvent() {
|
|
300
|
+
dataLines > 0 && onEvent({
|
|
301
|
+
id,
|
|
302
|
+
event: eventType,
|
|
303
|
+
data
|
|
304
|
+
}), id = void 0, data = "", dataLines = 0, eventType = void 0;
|
|
305
|
+
}
|
|
306
|
+
function reset(options = {}) {
|
|
307
|
+
if (options.consume && pendingFragments.length > 0) {
|
|
308
|
+
const incompleteLine = pendingFragments.join("");
|
|
309
|
+
parseLine(incompleteLine, 0, incompleteLine.length);
|
|
310
|
+
}
|
|
311
|
+
isFirstChunk = true, id = void 0, data = "", dataLines = 0, eventType = void 0, pendingFragments.length = 0, pendingFragmentsLength = 0, terminated = false;
|
|
312
|
+
}
|
|
313
|
+
return { feed, reset };
|
|
314
|
+
}
|
|
315
|
+
function isDataPrefix(chunk, i, firstCharCode) {
|
|
316
|
+
return firstCharCode === 100 && chunk.charCodeAt(i + 1) === 97 && chunk.charCodeAt(i + 2) === 116 && chunk.charCodeAt(i + 3) === 97 && chunk.charCodeAt(i + 4) === 58;
|
|
317
|
+
}
|
|
318
|
+
function isEventPrefix(chunk, i, firstCharCode) {
|
|
319
|
+
return firstCharCode === 101 && chunk.charCodeAt(i + 1) === 118 && chunk.charCodeAt(i + 2) === 101 && chunk.charCodeAt(i + 3) === 110 && chunk.charCodeAt(i + 4) === 116 && chunk.charCodeAt(i + 5) === 58;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// node_modules/.pnpm/eventsource-parser@3.1.1/node_modules/eventsource-parser/dist/stream.js
|
|
323
|
+
var EventSourceParserStream = class extends TransformStream {
|
|
324
|
+
constructor({ onError, onRetry, onComment, maxBufferSize } = {}) {
|
|
325
|
+
let parser;
|
|
326
|
+
super({
|
|
327
|
+
start(controller) {
|
|
328
|
+
parser = createParser({
|
|
329
|
+
onEvent: (event) => {
|
|
330
|
+
controller.enqueue(event);
|
|
331
|
+
},
|
|
332
|
+
onError(error) {
|
|
333
|
+
typeof onError == "function" && onError(error), (onError === "terminate" || error.type === "max-buffer-size-exceeded") && controller.error(error);
|
|
334
|
+
},
|
|
335
|
+
onRetry,
|
|
336
|
+
onComment,
|
|
337
|
+
maxBufferSize
|
|
338
|
+
});
|
|
339
|
+
},
|
|
340
|
+
transform(chunk) {
|
|
341
|
+
parser.feed(chunk);
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
// node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.0_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js
|
|
348
|
+
var DEFAULT_STREAMABLE_HTTP_RECONNECTION_OPTIONS = {
|
|
349
|
+
initialReconnectionDelay: 1e3,
|
|
350
|
+
maxReconnectionDelay: 3e4,
|
|
351
|
+
reconnectionDelayGrowFactor: 1.5,
|
|
352
|
+
maxRetries: 2
|
|
353
|
+
};
|
|
354
|
+
var StreamableHTTPError = class extends Error {
|
|
355
|
+
constructor(code, message) {
|
|
356
|
+
super(`Streamable HTTP error: ${message}`);
|
|
357
|
+
this.code = code;
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
var StreamableHTTPClientTransport = class {
|
|
361
|
+
constructor(url, opts) {
|
|
362
|
+
this._hasCompletedAuthFlow = false;
|
|
363
|
+
this._url = url;
|
|
364
|
+
this._resourceMetadataUrl = void 0;
|
|
365
|
+
this._scope = void 0;
|
|
366
|
+
this._requestInit = opts?.requestInit;
|
|
367
|
+
this._authProvider = opts?.authProvider;
|
|
368
|
+
this._fetch = opts?.fetch;
|
|
369
|
+
this._fetchWithInit = createFetchWithInit(opts?.fetch, opts?.requestInit);
|
|
370
|
+
this._followRedirects = opts?.redirectPolicy === "follow";
|
|
371
|
+
if (this._followRedirects) {
|
|
372
|
+
this._fetch = fetchLeavingRedirects(this._fetch);
|
|
373
|
+
this._fetchWithInit = fetchLeavingRedirects(this._fetchWithInit);
|
|
374
|
+
}
|
|
375
|
+
this._sessionId = opts?.sessionId;
|
|
376
|
+
this._reconnectionOptions = opts?.reconnectionOptions ?? DEFAULT_STREAMABLE_HTTP_RECONNECTION_OPTIONS;
|
|
377
|
+
}
|
|
378
|
+
/** Error text for a redirect `response` that was not followed, or `undefined` for any other response. */
|
|
379
|
+
_unfollowedRedirect(response, url) {
|
|
380
|
+
const text = unfollowedRedirect(response, url);
|
|
381
|
+
return text && !this._followRedirects ? `${text} (redirectPolicy: 'same-origin')` : text;
|
|
382
|
+
}
|
|
383
|
+
async _authThenStart() {
|
|
384
|
+
if (!this._authProvider) {
|
|
385
|
+
throw new UnauthorizedError("No auth provider");
|
|
386
|
+
}
|
|
387
|
+
let result;
|
|
388
|
+
try {
|
|
389
|
+
result = await auth(this._authProvider, {
|
|
390
|
+
serverUrl: this._url,
|
|
391
|
+
resourceMetadataUrl: this._resourceMetadataUrl,
|
|
392
|
+
scope: this._scope,
|
|
393
|
+
fetchFn: this._fetchWithInit
|
|
394
|
+
});
|
|
395
|
+
} catch (error) {
|
|
396
|
+
this.onerror?.(error);
|
|
397
|
+
throw error;
|
|
398
|
+
}
|
|
399
|
+
if (result !== "AUTHORIZED") {
|
|
400
|
+
throw new UnauthorizedError();
|
|
401
|
+
}
|
|
402
|
+
return await this._startOrAuthSse({ resumptionToken: void 0 });
|
|
403
|
+
}
|
|
404
|
+
async _commonHeaders() {
|
|
405
|
+
const headers = {};
|
|
406
|
+
if (this._authProvider) {
|
|
407
|
+
const tokens = await this._authProvider.tokens();
|
|
408
|
+
if (tokens) {
|
|
409
|
+
headers["Authorization"] = `Bearer ${tokens.access_token}`;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
if (this._sessionId) {
|
|
413
|
+
headers["mcp-session-id"] = this._sessionId;
|
|
414
|
+
}
|
|
415
|
+
if (this._protocolVersion) {
|
|
416
|
+
headers["mcp-protocol-version"] = this._protocolVersion;
|
|
417
|
+
}
|
|
418
|
+
const extraHeaders = normalizeHeaders(this._requestInit?.headers);
|
|
419
|
+
return new Headers({
|
|
420
|
+
...headers,
|
|
421
|
+
...extraHeaders
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
async _startOrAuthSse(options) {
|
|
425
|
+
const { resumptionToken } = options;
|
|
426
|
+
try {
|
|
427
|
+
const headers = await this._commonHeaders();
|
|
428
|
+
headers.set("Accept", "text/event-stream");
|
|
429
|
+
if (resumptionToken) {
|
|
430
|
+
headers.set("last-event-id", resumptionToken);
|
|
431
|
+
}
|
|
432
|
+
const fetchFn = this._fetch ?? fetch;
|
|
433
|
+
const init = { method: "GET", headers, signal: this._abortController?.signal };
|
|
434
|
+
let response = await fetchFn(this._url, this._followRedirects ? init : { ...init, redirect: "manual" });
|
|
435
|
+
const followed = this._followRedirects ? void 0 : followWithinOrigin(fetchFn, this._url, init, response);
|
|
436
|
+
if (followed) {
|
|
437
|
+
response = await followed;
|
|
438
|
+
}
|
|
439
|
+
if (!response.ok) {
|
|
440
|
+
await response.body?.cancel();
|
|
441
|
+
if (response.status === 401 && this._authProvider) {
|
|
442
|
+
return await this._authThenStart();
|
|
443
|
+
}
|
|
444
|
+
if (response.status === 405) {
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
throw new StreamableHTTPError(response.status, `Failed to open SSE stream: ${this._unfollowedRedirect(response, this._url) ?? response.statusText}`);
|
|
448
|
+
}
|
|
449
|
+
this._handleSseStream(response.body, options, true);
|
|
450
|
+
} catch (error) {
|
|
451
|
+
this.onerror?.(error);
|
|
452
|
+
throw error;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Calculates the next reconnection delay using backoff algorithm
|
|
457
|
+
*
|
|
458
|
+
* @param attempt Current reconnection attempt count for the specific stream
|
|
459
|
+
* @returns Time to wait in milliseconds before next reconnection attempt
|
|
460
|
+
*/
|
|
461
|
+
_getNextReconnectionDelay(attempt) {
|
|
462
|
+
if (this._serverRetryMs !== void 0) {
|
|
463
|
+
return this._serverRetryMs;
|
|
464
|
+
}
|
|
465
|
+
const initialDelay = this._reconnectionOptions.initialReconnectionDelay;
|
|
466
|
+
const growFactor = this._reconnectionOptions.reconnectionDelayGrowFactor;
|
|
467
|
+
const maxDelay = this._reconnectionOptions.maxReconnectionDelay;
|
|
468
|
+
return Math.min(initialDelay * Math.pow(growFactor, attempt), maxDelay);
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Schedule a reconnection attempt using server-provided retry interval or backoff
|
|
472
|
+
*
|
|
473
|
+
* @param lastEventId The ID of the last received event for resumability
|
|
474
|
+
* @param attemptCount Current reconnection attempt count for this specific stream
|
|
475
|
+
*/
|
|
476
|
+
_scheduleReconnection(options, attemptCount = 0) {
|
|
477
|
+
const maxRetries = this._reconnectionOptions.maxRetries;
|
|
478
|
+
if (attemptCount >= maxRetries) {
|
|
479
|
+
this.onerror?.(new Error(`Maximum reconnection attempts (${maxRetries}) exceeded.`));
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
const delay = this._getNextReconnectionDelay(attemptCount);
|
|
483
|
+
this._reconnectionTimeout = setTimeout(() => {
|
|
484
|
+
this._startOrAuthSse(options).catch((error) => {
|
|
485
|
+
this.onerror?.(new Error(`Failed to reconnect SSE stream: ${error instanceof Error ? error.message : String(error)}`));
|
|
486
|
+
this._scheduleReconnection(options, attemptCount + 1);
|
|
487
|
+
});
|
|
488
|
+
}, delay);
|
|
489
|
+
}
|
|
490
|
+
_handleSseStream(stream, options, isReconnectable) {
|
|
491
|
+
if (!stream) {
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
const { onresumptiontoken, replayMessageId } = options;
|
|
495
|
+
let lastEventId;
|
|
496
|
+
let hasPrimingEvent = false;
|
|
497
|
+
let receivedResponse = false;
|
|
498
|
+
const processStream = async () => {
|
|
499
|
+
try {
|
|
500
|
+
const reader = stream.pipeThrough(new TextDecoderStream()).pipeThrough(new EventSourceParserStream({
|
|
501
|
+
onRetry: (retryMs) => {
|
|
502
|
+
this._serverRetryMs = retryMs;
|
|
503
|
+
}
|
|
504
|
+
})).getReader();
|
|
505
|
+
while (true) {
|
|
506
|
+
const { value: event, done } = await reader.read();
|
|
507
|
+
if (done) {
|
|
508
|
+
break;
|
|
509
|
+
}
|
|
510
|
+
if (event.id) {
|
|
511
|
+
lastEventId = event.id;
|
|
512
|
+
hasPrimingEvent = true;
|
|
513
|
+
onresumptiontoken?.(event.id);
|
|
514
|
+
}
|
|
515
|
+
if (!event.data) {
|
|
516
|
+
continue;
|
|
517
|
+
}
|
|
518
|
+
if (!event.event || event.event === "message") {
|
|
519
|
+
try {
|
|
520
|
+
const message = JSONRPCMessageSchema.parse(JSON.parse(event.data));
|
|
521
|
+
if (isJSONRPCResultResponse(message)) {
|
|
522
|
+
receivedResponse = true;
|
|
523
|
+
if (replayMessageId !== void 0) {
|
|
524
|
+
message.id = replayMessageId;
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
this.onmessage?.(message);
|
|
528
|
+
} catch (error) {
|
|
529
|
+
this.onerror?.(error);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
const canResume = isReconnectable || hasPrimingEvent;
|
|
534
|
+
const needsReconnect = canResume && !receivedResponse;
|
|
535
|
+
if (needsReconnect && this._abortController && !this._abortController.signal.aborted) {
|
|
536
|
+
this._scheduleReconnection({
|
|
537
|
+
resumptionToken: lastEventId,
|
|
538
|
+
onresumptiontoken,
|
|
539
|
+
replayMessageId
|
|
540
|
+
}, 0);
|
|
541
|
+
}
|
|
542
|
+
} catch (error) {
|
|
543
|
+
this.onerror?.(new Error(`SSE stream disconnected: ${error}`));
|
|
544
|
+
const canResume = isReconnectable || hasPrimingEvent;
|
|
545
|
+
const needsReconnect = canResume && !receivedResponse;
|
|
546
|
+
if (needsReconnect && this._abortController && !this._abortController.signal.aborted) {
|
|
547
|
+
try {
|
|
548
|
+
this._scheduleReconnection({
|
|
549
|
+
resumptionToken: lastEventId,
|
|
550
|
+
onresumptiontoken,
|
|
551
|
+
replayMessageId
|
|
552
|
+
}, 0);
|
|
553
|
+
} catch (error2) {
|
|
554
|
+
this.onerror?.(new Error(`Failed to reconnect: ${error2 instanceof Error ? error2.message : String(error2)}`));
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
};
|
|
559
|
+
processStream();
|
|
560
|
+
}
|
|
561
|
+
async start() {
|
|
562
|
+
if (this._abortController) {
|
|
563
|
+
throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");
|
|
564
|
+
}
|
|
565
|
+
this._abortController = new AbortController();
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Call this method after the user has finished authorizing via their user agent and is redirected back to the MCP client application. This will exchange the authorization code for an access token, enabling the next connection attempt to successfully auth.
|
|
569
|
+
*/
|
|
570
|
+
async finishAuth(authorizationCode) {
|
|
571
|
+
if (!this._authProvider) {
|
|
572
|
+
throw new UnauthorizedError("No auth provider");
|
|
573
|
+
}
|
|
574
|
+
const result = await auth(this._authProvider, {
|
|
575
|
+
serverUrl: this._url,
|
|
576
|
+
authorizationCode,
|
|
577
|
+
resourceMetadataUrl: this._resourceMetadataUrl,
|
|
578
|
+
scope: this._scope,
|
|
579
|
+
fetchFn: this._fetchWithInit
|
|
580
|
+
});
|
|
581
|
+
if (result !== "AUTHORIZED") {
|
|
582
|
+
throw new UnauthorizedError("Failed to authorize");
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
async close() {
|
|
586
|
+
if (this._reconnectionTimeout) {
|
|
587
|
+
clearTimeout(this._reconnectionTimeout);
|
|
588
|
+
this._reconnectionTimeout = void 0;
|
|
589
|
+
}
|
|
590
|
+
this._abortController?.abort();
|
|
591
|
+
this.onclose?.();
|
|
592
|
+
}
|
|
593
|
+
async send(message, options) {
|
|
594
|
+
try {
|
|
595
|
+
const { resumptionToken, onresumptiontoken } = options || {};
|
|
596
|
+
if (resumptionToken) {
|
|
597
|
+
this._startOrAuthSse({ resumptionToken, replayMessageId: isJSONRPCRequest(message) ? message.id : void 0 }).catch((err) => this.onerror?.(err));
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
const headers = await this._commonHeaders();
|
|
601
|
+
headers.set("content-type", "application/json");
|
|
602
|
+
headers.set("accept", "application/json, text/event-stream");
|
|
603
|
+
const init = {
|
|
604
|
+
...this._requestInit,
|
|
605
|
+
method: "POST",
|
|
606
|
+
headers,
|
|
607
|
+
body: JSON.stringify(message),
|
|
608
|
+
signal: this._abortController?.signal
|
|
609
|
+
};
|
|
610
|
+
const response = await fetchWithinOrigin(this._fetch ?? fetch)(this._url, init);
|
|
611
|
+
const sessionId = response.headers.get("mcp-session-id");
|
|
612
|
+
if (sessionId) {
|
|
613
|
+
this._sessionId = sessionId;
|
|
614
|
+
}
|
|
615
|
+
if (!response.ok) {
|
|
616
|
+
const text = await response.text().catch(() => null);
|
|
617
|
+
if (response.status === 401 && this._authProvider) {
|
|
618
|
+
if (this._hasCompletedAuthFlow) {
|
|
619
|
+
throw new StreamableHTTPError(401, "Server returned 401 after successful authentication");
|
|
620
|
+
}
|
|
621
|
+
const { resourceMetadataUrl, scope } = extractWWWAuthenticateParams(response);
|
|
622
|
+
this._resourceMetadataUrl = resourceMetadataUrl;
|
|
623
|
+
this._scope = scope;
|
|
624
|
+
const result = await auth(this._authProvider, {
|
|
625
|
+
serverUrl: this._url,
|
|
626
|
+
resourceMetadataUrl: this._resourceMetadataUrl,
|
|
627
|
+
scope: this._scope,
|
|
628
|
+
fetchFn: this._fetchWithInit
|
|
629
|
+
});
|
|
630
|
+
if (result !== "AUTHORIZED") {
|
|
631
|
+
throw new UnauthorizedError();
|
|
632
|
+
}
|
|
633
|
+
this._hasCompletedAuthFlow = true;
|
|
634
|
+
return this.send(message);
|
|
635
|
+
}
|
|
636
|
+
if (response.status === 403 && this._authProvider) {
|
|
637
|
+
const { resourceMetadataUrl, scope, error } = extractWWWAuthenticateParams(response);
|
|
638
|
+
if (error === "insufficient_scope") {
|
|
639
|
+
const wwwAuthHeader = response.headers.get("WWW-Authenticate");
|
|
640
|
+
if (this._lastUpscopingHeader === wwwAuthHeader) {
|
|
641
|
+
throw new StreamableHTTPError(403, "Server returned 403 after trying upscoping");
|
|
642
|
+
}
|
|
643
|
+
if (scope) {
|
|
644
|
+
this._scope = scope;
|
|
645
|
+
}
|
|
646
|
+
if (resourceMetadataUrl) {
|
|
647
|
+
this._resourceMetadataUrl = resourceMetadataUrl;
|
|
648
|
+
}
|
|
649
|
+
this._lastUpscopingHeader = wwwAuthHeader ?? void 0;
|
|
650
|
+
const result = await auth(this._authProvider, {
|
|
651
|
+
serverUrl: this._url,
|
|
652
|
+
resourceMetadataUrl: this._resourceMetadataUrl,
|
|
653
|
+
scope: this._scope,
|
|
654
|
+
fetchFn: this._fetch
|
|
655
|
+
});
|
|
656
|
+
if (result !== "AUTHORIZED") {
|
|
657
|
+
throw new UnauthorizedError();
|
|
658
|
+
}
|
|
659
|
+
return this.send(message);
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
throw new StreamableHTTPError(response.status, `Error POSTing to endpoint: ${this._unfollowedRedirect(response, this._url) ?? text}`);
|
|
663
|
+
}
|
|
664
|
+
this._hasCompletedAuthFlow = false;
|
|
665
|
+
this._lastUpscopingHeader = void 0;
|
|
666
|
+
if (response.status === 202) {
|
|
667
|
+
await response.body?.cancel();
|
|
668
|
+
if (isInitializedNotification(message)) {
|
|
669
|
+
this._startOrAuthSse({ resumptionToken: void 0 }).catch((err) => this.onerror?.(err));
|
|
670
|
+
}
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
673
|
+
const messages = Array.isArray(message) ? message : [message];
|
|
674
|
+
const hasRequests = messages.filter((msg) => "method" in msg && "id" in msg && msg.id !== void 0).length > 0;
|
|
675
|
+
const contentType2 = response.headers.get("content-type");
|
|
676
|
+
const responseMediaType = mediaTypeEssence(contentType2);
|
|
677
|
+
if (hasRequests) {
|
|
678
|
+
if (responseMediaType === "text/event-stream") {
|
|
679
|
+
this._handleSseStream(response.body, { onresumptiontoken }, false);
|
|
680
|
+
} else if (responseMediaType === "application/json") {
|
|
681
|
+
const data = await response.json();
|
|
682
|
+
const responseMessages = Array.isArray(data) ? data.map((msg) => JSONRPCMessageSchema.parse(msg)) : [JSONRPCMessageSchema.parse(data)];
|
|
683
|
+
for (const msg of responseMessages) {
|
|
684
|
+
this.onmessage?.(msg);
|
|
685
|
+
}
|
|
686
|
+
} else {
|
|
687
|
+
await response.body?.cancel();
|
|
688
|
+
throw new StreamableHTTPError(-1, `Unexpected content type: ${contentType2}`);
|
|
689
|
+
}
|
|
690
|
+
} else {
|
|
691
|
+
await response.body?.cancel();
|
|
692
|
+
}
|
|
693
|
+
} catch (error) {
|
|
694
|
+
this.onerror?.(error);
|
|
695
|
+
throw error;
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
get sessionId() {
|
|
699
|
+
return this._sessionId;
|
|
700
|
+
}
|
|
701
|
+
/**
|
|
702
|
+
* Terminates the current session by sending a DELETE request to the server.
|
|
703
|
+
*
|
|
704
|
+
* Clients that no longer need a particular session
|
|
705
|
+
* (e.g., because the user is leaving the client application) SHOULD send an
|
|
706
|
+
* HTTP DELETE to the MCP endpoint with the Mcp-Session-Id header to explicitly
|
|
707
|
+
* terminate the session.
|
|
708
|
+
*
|
|
709
|
+
* The server MAY respond with HTTP 405 Method Not Allowed, indicating that
|
|
710
|
+
* the server does not allow clients to terminate sessions.
|
|
711
|
+
*/
|
|
712
|
+
async terminateSession() {
|
|
713
|
+
if (!this._sessionId) {
|
|
714
|
+
return;
|
|
715
|
+
}
|
|
716
|
+
try {
|
|
717
|
+
const headers = await this._commonHeaders();
|
|
718
|
+
const init = {
|
|
719
|
+
...this._requestInit,
|
|
720
|
+
method: "DELETE",
|
|
721
|
+
headers,
|
|
722
|
+
signal: this._abortController?.signal
|
|
723
|
+
};
|
|
724
|
+
const response = await fetchWithinOrigin(this._fetch ?? fetch)(this._url, init);
|
|
725
|
+
await response.body?.cancel();
|
|
726
|
+
if (!response.ok && response.status !== 405) {
|
|
727
|
+
throw new StreamableHTTPError(response.status, `Failed to terminate session: ${this._unfollowedRedirect(response, this._url) ?? response.statusText}`);
|
|
728
|
+
}
|
|
729
|
+
this._sessionId = void 0;
|
|
730
|
+
} catch (error) {
|
|
731
|
+
this.onerror?.(error);
|
|
732
|
+
throw error;
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
setProtocolVersion(version) {
|
|
736
|
+
this._protocolVersion = version;
|
|
737
|
+
}
|
|
738
|
+
get protocolVersion() {
|
|
739
|
+
return this._protocolVersion;
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* Resume an SSE stream from a previous event ID.
|
|
743
|
+
* Opens a GET SSE connection with Last-Event-ID header to replay missed events.
|
|
744
|
+
*
|
|
745
|
+
* @param lastEventId The event ID to resume from
|
|
746
|
+
* @param options Optional callback to receive new resumption tokens
|
|
747
|
+
*/
|
|
748
|
+
async resumeStream(lastEventId, options) {
|
|
749
|
+
await this._startOrAuthSse({
|
|
750
|
+
resumptionToken: lastEventId,
|
|
751
|
+
onresumptiontoken: options?.onresumptiontoken
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
};
|
|
755
|
+
export {
|
|
756
|
+
StreamableHTTPClientTransport,
|
|
757
|
+
StreamableHTTPError
|
|
758
|
+
};
|
|
759
|
+
/*! Bundled license information:
|
|
760
|
+
|
|
761
|
+
content-type/index.js:
|
|
762
|
+
(*!
|
|
763
|
+
* content-type
|
|
764
|
+
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
765
|
+
* MIT Licensed
|
|
766
|
+
*)
|
|
767
|
+
*/
|
|
768
|
+
//# sourceMappingURL=streamableHttp-CP2ZQBIK.js.map
|