tenjin-cli 0.1.0-alpha.30 → 0.1.0-alpha.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +65 -116
- package/dist/{_esm-CE7KNONL.js → _esm-RLLC72MS.js} +127 -131
- package/dist/alive-MROUMFH3.js +38 -0
- package/dist/auto-update-OPWMRZLS.js +22 -0
- package/dist/{ccip-7RMRLAGV.js → ccip-DHDFKTQV.js} +2 -2
- package/dist/chunk-2GNOFONN.js +560 -0
- package/dist/chunk-2GNOFONN.js.map +1 -0
- package/dist/{chunk-TTNESUPQ.js → chunk-2GP3HRYK.js} +2120 -193
- package/dist/chunk-2GP3HRYK.js.map +1 -0
- package/dist/chunk-3623BLPV.js +184 -0
- package/dist/chunk-3623BLPV.js.map +1 -0
- package/dist/chunk-3AIHRXKO.js +72 -0
- package/dist/chunk-3AIHRXKO.js.map +1 -0
- package/dist/chunk-3DIL66VX.js +120 -0
- package/dist/chunk-3DIL66VX.js.map +1 -0
- package/dist/{chunk-S4SAZ7OD.js → chunk-3FMZGI7I.js} +12 -2
- package/dist/{chunk-S4SAZ7OD.js.map → chunk-3FMZGI7I.js.map} +1 -1
- package/dist/chunk-3UCIG4TG.js +65 -0
- package/dist/chunk-3UCIG4TG.js.map +1 -0
- package/dist/{chunk-LFZJM56J.js → chunk-445VQTVM.js} +3 -3
- package/dist/{chunk-A36LQPHV.js → chunk-4LMUQMBH.js} +1 -1
- package/dist/{chunk-A36LQPHV.js.map → chunk-4LMUQMBH.js.map} +1 -1
- package/dist/{chunk-RAULEAZ6.js → chunk-4USCZ2NI.js} +3 -3
- package/dist/chunk-62KNUYWD.js +111 -0
- package/dist/chunk-62KNUYWD.js.map +1 -0
- package/dist/{chunk-POUWHWID.js → chunk-6CMM6YCB.js} +3 -3
- package/dist/{chunk-POUWHWID.js.map → chunk-6CMM6YCB.js.map} +1 -1
- package/dist/chunk-7WEQQJLG.js +68 -0
- package/dist/chunk-7WEQQJLG.js.map +1 -0
- package/dist/{chunk-3O2BQIF6.js → chunk-AD226HDR.js} +344 -534
- package/dist/chunk-AD226HDR.js.map +1 -0
- package/dist/chunk-ADV4LDTB.js +106 -0
- package/dist/chunk-ADV4LDTB.js.map +1 -0
- package/dist/{chunk-AWFUPKTM.js → chunk-AV5NZMYO.js} +15 -7
- package/dist/{chunk-AWFUPKTM.js.map → chunk-AV5NZMYO.js.map} +1 -1
- package/dist/chunk-B7EM4GGF.js +198 -0
- package/dist/chunk-B7EM4GGF.js.map +1 -0
- package/dist/chunk-BFDQ4WNW.js +119 -0
- package/dist/chunk-BFDQ4WNW.js.map +1 -0
- package/dist/{chunk-OSYTBCUC.js → chunk-BI673VEJ.js} +531 -503
- package/dist/chunk-BI673VEJ.js.map +1 -0
- package/dist/chunk-CEXSOI5R.js +808 -0
- package/dist/chunk-CEXSOI5R.js.map +1 -0
- package/dist/{chunk-OK2TDZQU.js → chunk-CISYM4EO.js} +9 -7
- package/dist/chunk-CISYM4EO.js.map +1 -0
- package/dist/{chunk-VFMQTSXG.js → chunk-D3ZURCG7.js} +3 -3
- package/dist/chunk-D5TOQSO4.js +474 -0
- package/dist/chunk-D5TOQSO4.js.map +1 -0
- package/dist/{chunk-P7LABKCW.js → chunk-DOQGNFHM.js} +33 -2
- package/dist/{chunk-P7LABKCW.js.map → chunk-DOQGNFHM.js.map} +1 -1
- package/dist/{chunk-QUVVWYJW.js → chunk-DRDUIZIA.js} +11 -9
- package/dist/{chunk-QUVVWYJW.js.map → chunk-DRDUIZIA.js.map} +1 -1
- package/dist/{chunk-O2FRQ2L2.js → chunk-DW4YTVR3.js} +5 -65
- package/dist/chunk-DW4YTVR3.js.map +1 -0
- package/dist/chunk-E7LGOMH6.js +449 -0
- package/dist/chunk-E7LGOMH6.js.map +1 -0
- package/dist/chunk-E7SW44LM.js +138 -0
- package/dist/chunk-E7SW44LM.js.map +1 -0
- package/dist/chunk-EDJWHDDL.js +33 -0
- package/dist/chunk-EDJWHDDL.js.map +1 -0
- package/dist/chunk-F3ED5WTR.js +13 -0
- package/dist/chunk-F3ED5WTR.js.map +1 -0
- package/dist/chunk-G75OPGAK.js +111 -0
- package/dist/chunk-G75OPGAK.js.map +1 -0
- package/dist/{chunk-YFQOA5AU.js → chunk-GAKUQHKA.js} +13 -17
- package/dist/{chunk-YFQOA5AU.js.map → chunk-GAKUQHKA.js.map} +1 -1
- package/dist/{chunk-PAYV4XUA.js → chunk-HDPUXS3Z.js} +20 -49
- package/dist/chunk-HDPUXS3Z.js.map +1 -0
- package/dist/{chunk-ORWL5BSN.js → chunk-HGZEPQUT.js} +2 -2
- package/dist/{chunk-HPWO4O6S.js → chunk-HREHWL32.js} +4 -4
- package/dist/{chunk-HPWO4O6S.js.map → chunk-HREHWL32.js.map} +1 -1
- package/dist/{chunk-VZGAONSJ.js → chunk-I5TDIUKM.js} +16 -35
- package/dist/chunk-I5TDIUKM.js.map +1 -0
- package/dist/{chunk-7QKHZQKW.js → chunk-IADZOXKN.js} +39 -6
- package/dist/chunk-IADZOXKN.js.map +1 -0
- package/dist/{chunk-U6YQ6FRI.js → chunk-IDTRSAHE.js} +32 -12
- package/dist/chunk-IDTRSAHE.js.map +1 -0
- package/dist/{chunk-SPAVAYSW.js → chunk-JEVQ5LKO.js} +7 -5
- package/dist/{chunk-SPAVAYSW.js.map → chunk-JEVQ5LKO.js.map} +1 -1
- package/dist/{chunk-EBVIKMCH.js → chunk-JKKAIPTU.js} +2 -2
- package/dist/chunk-JNJWBTU2.js +3497 -0
- package/dist/chunk-JNJWBTU2.js.map +1 -0
- package/dist/{chunk-TTBKWWTV.js → chunk-JRZBBPO6.js} +390 -146
- package/dist/chunk-JRZBBPO6.js.map +1 -0
- package/dist/{chunk-WVUSXNIE.js → chunk-MPZUYCAP.js} +9 -2
- package/dist/{chunk-WVUSXNIE.js.map → chunk-MPZUYCAP.js.map} +1 -1
- package/dist/{chunk-SJLTEINJ.js → chunk-OJNTCYQQ.js} +17 -1
- package/dist/chunk-OJNTCYQQ.js.map +1 -0
- package/dist/{chunk-IOODYAXL.js → chunk-OTWLERSW.js} +25 -6
- package/dist/chunk-OTWLERSW.js.map +1 -0
- package/dist/{chunk-AWQPGIR6.js → chunk-PJNENX2A.js} +1535 -422
- package/dist/chunk-PJNENX2A.js.map +1 -0
- package/dist/{chunk-KHE6L6TD.js → chunk-PKHI276N.js} +97 -11
- package/dist/chunk-PKHI276N.js.map +1 -0
- package/dist/{chunk-YHKXNYTB.js → chunk-QF3LSMGS.js} +2 -2
- package/dist/chunk-QXP3Z3JN.js +131 -0
- package/dist/chunk-QXP3Z3JN.js.map +1 -0
- package/dist/{chunk-XZKD7DIF.js → chunk-RL5UUDT4.js} +3 -3
- package/dist/{chunk-XZKD7DIF.js.map → chunk-RL5UUDT4.js.map} +1 -1
- package/dist/chunk-SFASB5FL.js +69 -0
- package/dist/chunk-SFASB5FL.js.map +1 -0
- package/dist/{chunk-WO5BJNIB.js → chunk-SNNSAGMT.js} +7273 -2741
- package/dist/chunk-SNNSAGMT.js.map +1 -0
- package/dist/{chunk-NZIP4PA2.js → chunk-SO3XRZPX.js} +3 -3
- package/dist/chunk-SYOS5CAC.js +176 -0
- package/dist/chunk-SYOS5CAC.js.map +1 -0
- package/dist/chunk-TAW4UFFF.js +293 -0
- package/dist/chunk-TAW4UFFF.js.map +1 -0
- package/dist/chunk-TF5HCP33.js +271 -0
- package/dist/chunk-TF5HCP33.js.map +1 -0
- package/dist/{chunk-AKWGE6JQ.js → chunk-UUGOUOVT.js} +37 -2
- package/dist/chunk-UUGOUOVT.js.map +1 -0
- package/dist/{chunk-AEG2PXBP.js → chunk-V2LQLN5H.js} +7 -7
- package/dist/{chunk-KYFZTGMC.js → chunk-VJUVFZ2D.js} +5 -3
- package/dist/{chunk-KYFZTGMC.js.map → chunk-VJUVFZ2D.js.map} +1 -1
- package/dist/{chunk-JMM6YE7J.js → chunk-VOZA6O7K.js} +708 -709
- package/dist/chunk-VOZA6O7K.js.map +1 -0
- package/dist/{chunk-5LJCEMFD.js → chunk-VUGQTZ2L.js} +209 -77
- package/dist/chunk-VUGQTZ2L.js.map +1 -0
- package/dist/chunk-WOM257PW.js +393 -0
- package/dist/chunk-WOM257PW.js.map +1 -0
- package/dist/chunk-WYXUQGOL.js +191 -0
- package/dist/chunk-WYXUQGOL.js.map +1 -0
- package/dist/chunk-X5ZBP3IY.js +97 -0
- package/dist/chunk-X5ZBP3IY.js.map +1 -0
- package/dist/chunk-XQJXNMSB.js +23 -0
- package/dist/chunk-XQJXNMSB.js.map +1 -0
- package/dist/chunk-Y527D4TV.js +56 -0
- package/dist/chunk-Y527D4TV.js.map +1 -0
- package/dist/{chunk-VUFAK2LW.js → chunk-YUY4SAGM.js} +17 -2
- package/dist/chunk-YUY4SAGM.js.map +1 -0
- package/dist/clack-EZ7TDWQU.js +19 -0
- package/dist/claude-cli-2YKABJJZ.js +31 -0
- package/dist/{cli-O5SN7ZJ4.js → cli-FB4LOA5A.js} +221 -68
- package/dist/{cli-O5SN7ZJ4.js.map → cli-FB4LOA5A.js.map} +1 -1
- package/dist/codex-event-TYVES3UX.js +16 -0
- package/dist/codex-host-WW4H2SKT.js +29 -0
- package/dist/codex-install-2C623HPW.js +393 -0
- package/dist/codex-install-2C623HPW.js.map +1 -0
- package/dist/{config-OJQI27LT.js → config-HOVJFEKD.js} +25 -15
- package/dist/doctor-NKU4V5OV.js +1312 -0
- package/dist/doctor-NKU4V5OV.js.map +1 -0
- package/dist/{env-proxy-XL4P73MZ.js → env-proxy-R6ZMLQTT.js} +6 -2
- package/dist/{ethersCompat-Df4a6QIZ-THAVUGIJ.js → ethersCompat-Df4a6QIZ-X6YZWAML.js} +3 -3
- package/dist/{fund-WEV6DMTD.js → fund-WEBHTZGN.js} +38 -30
- package/dist/{fund-WEV6DMTD.js.map → fund-WEBHTZGN.js.map} +1 -1
- package/dist/hook-command-ZA2PNKS6.js +44 -0
- package/dist/hosts/claude/.claude-plugin/marketplace.json +2 -2
- package/dist/hosts/claude/tenjin/.claude-plugin/plugin.json +3 -2
- package/dist/hosts/claude/tenjin/hooks/hooks.json +4 -1
- package/dist/hosts/claude/tenjin/hooks/register.tsx +589 -0
- package/dist/hosts/claude/tenjin/skills/tenjin-pay/SKILL.md +82 -0
- package/dist/hosts/claude/tenjin/types/index.d.ts +41 -0
- package/dist/hosts/codex/.agents/plugins/marketplace.json +20 -0
- package/dist/hosts/codex/tenjin/.codex-plugin/plugin.json +16 -0
- package/dist/hosts/codex/tenjin/.mcp.json +15 -0
- package/dist/hosts/codex/tenjin/hooks/hooks.json +98 -0
- package/dist/hosts-AV5MHBAU.js +38 -0
- package/dist/index.js +28 -8
- package/dist/index.js.map +1 -1
- package/dist/install-PT4EZS4R.js +100 -0
- package/dist/{install-identity-WHPNMNMQ.js → install-identity-5A4OE6YC.js} +13 -8
- package/dist/install-wallet-SAAPKB73.js +281 -0
- package/dist/install-wallet-SAAPKB73.js.map +1 -0
- package/dist/{mcp-QML7ZMPH.js → mcp-HAWKCTPQ.js} +909 -208
- package/dist/mcp-HAWKCTPQ.js.map +1 -0
- package/dist/{mine.wasm-6PIT3DK6.js → mine.wasm-QFAHIFPY.js} +2 -2
- package/dist/{mine.wasm-6PIT3DK6.js.map → mine.wasm-QFAHIFPY.js.map} +1 -1
- package/dist/{package-LGKYOEPV.js → package-SR2WB6MK.js} +4 -2
- package/dist/passphrase-IFTDS3CU.js +44 -0
- package/dist/{paths-POPTXJO6.js → paths-XCSAKISU.js} +10 -2
- package/dist/pay-OXC3WKYV.js +55 -0
- package/dist/pay-OXC3WKYV.js.map +1 -0
- package/dist/{payments-C44QUFXU.js → payments-3KHMP2MG.js} +18 -13
- package/dist/{payments-C44QUFXU.js.map → payments-3KHMP2MG.js.map} +1 -1
- package/dist/plugin-registration-N3GRIZVM.js +67 -0
- package/dist/plugin-registration-N3GRIZVM.js.map +1 -0
- package/dist/{redact-6W23GGJC.js → redact-D7ASVWKL.js} +2 -2
- package/dist/redact-D7ASVWKL.js.map +1 -0
- package/dist/runtime-UVNUA3AS.js +1203 -0
- package/dist/runtime-UVNUA3AS.js.map +1 -0
- package/dist/runtime-fetch-EKFRNR6Z.js +20 -0
- package/dist/runtime-fetch-EKFRNR6Z.js.map +1 -0
- package/dist/runtime-layout-BDWZG2TQ.js +25 -0
- package/dist/runtime-layout-BDWZG2TQ.js.map +1 -0
- package/dist/{send-KVJX4XIR.js → send-HMKJLT34.js} +26 -18
- package/dist/{send-KVJX4XIR.js.map → send-HMKJLT34.js.map} +1 -1
- package/dist/{status-S7C3WMSH.js → status-RWXIIWYS.js} +57 -22
- package/dist/status-RWXIIWYS.js.map +1 -0
- package/dist/{status-line-YR2T5HC4.js → status-line-77XYZP7E.js} +13 -8
- package/dist/{status-line-YR2T5HC4.js.map → status-line-77XYZP7E.js.map} +1 -1
- package/dist/uninstall-D5G67UJH.js +480 -0
- package/dist/uninstall-D5G67UJH.js.map +1 -0
- package/dist/update-LRNOEGSB.js +53 -0
- package/dist/update-LRNOEGSB.js.map +1 -0
- package/dist/{usdc-JK4RRFFQ.js → usdc-D6X7EIQ2.js} +7 -8
- package/dist/usdc-D6X7EIQ2.js.map +1 -0
- package/dist/{viemAdapter-By13KInL-X2VY6CY3.js → viemAdapter-By13KInL-RL742ETX.js} +3 -3
- package/dist/viemAdapter-By13KInL-RL742ETX.js.map +1 -0
- package/dist/wallet-XFYC27BR.js +55 -0
- package/dist/wallet-XFYC27BR.js.map +1 -0
- package/dist/wallet-kdf-worker.mjs +8 -8
- package/docs/agent-permissions.md +56 -22
- package/docs/safety-model.md +1 -1
- package/docs/troubleshooting.md +72 -1
- package/package.json +14 -1
- package/dist/alive-3J3CHOQP.js +0 -21
- package/dist/ccip-NLCSCHKI.js +0 -19
- package/dist/chunk-3O2BQIF6.js.map +0 -1
- package/dist/chunk-5IEP5EGE.js +0 -5332
- package/dist/chunk-5IEP5EGE.js.map +0 -1
- package/dist/chunk-5LJCEMFD.js.map +0 -1
- package/dist/chunk-6W5GYG3W.js +0 -128
- package/dist/chunk-6W5GYG3W.js.map +0 -1
- package/dist/chunk-7EKYXMUO.js +0 -7536
- package/dist/chunk-7EKYXMUO.js.map +0 -1
- package/dist/chunk-7QKHZQKW.js.map +0 -1
- package/dist/chunk-AKWGE6JQ.js.map +0 -1
- package/dist/chunk-AWQPGIR6.js.map +0 -1
- package/dist/chunk-EGELTSPU.js +0 -2865
- package/dist/chunk-EGELTSPU.js.map +0 -1
- package/dist/chunk-EL56RW2J.js +0 -7611
- package/dist/chunk-EL56RW2J.js.map +0 -1
- package/dist/chunk-HE2MS4QO.js +0 -256
- package/dist/chunk-HE2MS4QO.js.map +0 -1
- package/dist/chunk-IOODYAXL.js.map +0 -1
- package/dist/chunk-JMM6YE7J.js.map +0 -1
- package/dist/chunk-KHE6L6TD.js.map +0 -1
- package/dist/chunk-N35E6CM2.js +0 -1185
- package/dist/chunk-N35E6CM2.js.map +0 -1
- package/dist/chunk-O2FRQ2L2.js.map +0 -1
- package/dist/chunk-OK2TDZQU.js.map +0 -1
- package/dist/chunk-OSYTBCUC.js.map +0 -1
- package/dist/chunk-PAYV4XUA.js.map +0 -1
- package/dist/chunk-SJLTEINJ.js.map +0 -1
- package/dist/chunk-TTBKWWTV.js.map +0 -1
- package/dist/chunk-TTNESUPQ.js.map +0 -1
- package/dist/chunk-U6YQ6FRI.js.map +0 -1
- package/dist/chunk-VUFAK2LW.js.map +0 -1
- package/dist/chunk-VZGAONSJ.js.map +0 -1
- package/dist/chunk-WO5BJNIB.js.map +0 -1
- package/dist/doctor-IQQJHGGM.js +0 -590
- package/dist/doctor-IQQJHGGM.js.map +0 -1
- package/dist/hook-command-D2P3ILRV.js +0 -32
- package/dist/install-TUCRF32I.js +0 -60
- package/dist/install-wallet-MA27FTQ5.js +0 -113
- package/dist/install-wallet-MA27FTQ5.js.map +0 -1
- package/dist/mcp-QML7ZMPH.js.map +0 -1
- package/dist/pay-2C2UBBXJ.js +0 -51
- package/dist/status-S7C3WMSH.js.map +0 -1
- package/dist/uninstall-HY6LKIIT.js +0 -149
- package/dist/uninstall-HY6LKIIT.js.map +0 -1
- package/dist/update-OJV22LR3.js +0 -36
- package/dist/wallet-PD2IMZDU.js +0 -39
- /package/dist/{_esm-CE7KNONL.js.map → _esm-RLLC72MS.js.map} +0 -0
- /package/dist/{alive-3J3CHOQP.js.map → alive-MROUMFH3.js.map} +0 -0
- /package/dist/{ccip-7RMRLAGV.js.map → auto-update-OPWMRZLS.js.map} +0 -0
- /package/dist/{ccip-NLCSCHKI.js.map → ccip-DHDFKTQV.js.map} +0 -0
- /package/dist/{chunk-LFZJM56J.js.map → chunk-445VQTVM.js.map} +0 -0
- /package/dist/{chunk-RAULEAZ6.js.map → chunk-4USCZ2NI.js.map} +0 -0
- /package/dist/{chunk-VFMQTSXG.js.map → chunk-D3ZURCG7.js.map} +0 -0
- /package/dist/{chunk-ORWL5BSN.js.map → chunk-HGZEPQUT.js.map} +0 -0
- /package/dist/{chunk-EBVIKMCH.js.map → chunk-JKKAIPTU.js.map} +0 -0
- /package/dist/{chunk-YHKXNYTB.js.map → chunk-QF3LSMGS.js.map} +0 -0
- /package/dist/{chunk-NZIP4PA2.js.map → chunk-SO3XRZPX.js.map} +0 -0
- /package/dist/{chunk-AEG2PXBP.js.map → chunk-V2LQLN5H.js.map} +0 -0
- /package/dist/{config-OJQI27LT.js.map → clack-EZ7TDWQU.js.map} +0 -0
- /package/dist/{env-proxy-XL4P73MZ.js.map → claude-cli-2YKABJJZ.js.map} +0 -0
- /package/dist/{ethersCompat-Df4a6QIZ-THAVUGIJ.js.map → codex-event-TYVES3UX.js.map} +0 -0
- /package/dist/{hook-command-D2P3ILRV.js.map → codex-host-WW4H2SKT.js.map} +0 -0
- /package/dist/{install-TUCRF32I.js.map → config-HOVJFEKD.js.map} +0 -0
- /package/dist/{install-identity-WHPNMNMQ.js.map → env-proxy-R6ZMLQTT.js.map} +0 -0
- /package/dist/{package-LGKYOEPV.js.map → ethersCompat-Df4a6QIZ-X6YZWAML.js.map} +0 -0
- /package/dist/{paths-POPTXJO6.js.map → hook-command-ZA2PNKS6.js.map} +0 -0
- /package/dist/{pay-2C2UBBXJ.js.map → hosts-AV5MHBAU.js.map} +0 -0
- /package/dist/{redact-6W23GGJC.js.map → install-PT4EZS4R.js.map} +0 -0
- /package/dist/{update-OJV22LR3.js.map → install-identity-5A4OE6YC.js.map} +0 -0
- /package/dist/{usdc-JK4RRFFQ.js.map → package-SR2WB6MK.js.map} +0 -0
- /package/dist/{viemAdapter-By13KInL-X2VY6CY3.js.map → passphrase-IFTDS3CU.js.map} +0 -0
- /package/dist/{wallet-PD2IMZDU.js.map → paths-XCSAKISU.js.map} +0 -0
package/dist/doctor-IQQJHGGM.js
DELETED
|
@@ -1,590 +0,0 @@
|
|
|
1
|
-
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
agentsWithoutRequestTool,
|
|
4
|
-
clearRouterMemo,
|
|
5
|
-
readRouterMemo
|
|
6
|
-
} from "./chunk-RAULEAZ6.js";
|
|
7
|
-
import {
|
|
8
|
-
channelCredit
|
|
9
|
-
} from "./chunk-VFMQTSXG.js";
|
|
10
|
-
import "./chunk-YHKXNYTB.js";
|
|
11
|
-
import "./chunk-LFZJM56J.js";
|
|
12
|
-
import "./chunk-EL56RW2J.js";
|
|
13
|
-
import {
|
|
14
|
-
describeWallet,
|
|
15
|
-
resolveWalletProvider,
|
|
16
|
-
walletFileExists
|
|
17
|
-
} from "./chunk-OSYTBCUC.js";
|
|
18
|
-
import "./chunk-AEG2PXBP.js";
|
|
19
|
-
import {
|
|
20
|
-
readSpendSummary,
|
|
21
|
-
spentOf
|
|
22
|
-
} from "./chunk-NZIP4PA2.js";
|
|
23
|
-
import "./chunk-TTNESUPQ.js";
|
|
24
|
-
import {
|
|
25
|
-
CLAUDE_CODE_FLOOR,
|
|
26
|
-
claudeConfigDir,
|
|
27
|
-
findClaudeBinary,
|
|
28
|
-
folderState,
|
|
29
|
-
inspectLegacyInstall,
|
|
30
|
-
loadStep,
|
|
31
|
-
pluginProof,
|
|
32
|
-
probeRouter,
|
|
33
|
-
projectInstallHere,
|
|
34
|
-
readClaudeCode,
|
|
35
|
-
readMcpServers,
|
|
36
|
-
readPluginListing,
|
|
37
|
-
runClaude,
|
|
38
|
-
settingsInstallPaths
|
|
39
|
-
} from "./chunk-JMM6YE7J.js";
|
|
40
|
-
import {
|
|
41
|
-
isNewer
|
|
42
|
-
} from "./chunk-VZGAONSJ.js";
|
|
43
|
-
import "./chunk-KOGZDMHO.js";
|
|
44
|
-
import "./chunk-KHE6L6TD.js";
|
|
45
|
-
import "./chunk-3O2BQIF6.js";
|
|
46
|
-
import "./chunk-A36LQPHV.js";
|
|
47
|
-
import "./chunk-XKESD27X.js";
|
|
48
|
-
import "./chunk-AKWGE6JQ.js";
|
|
49
|
-
import {
|
|
50
|
-
PLUGIN_ID,
|
|
51
|
-
PLUGIN_SERVER,
|
|
52
|
-
REQUEST_TOOL
|
|
53
|
-
} from "./chunk-WVUSXNIE.js";
|
|
54
|
-
import "./chunk-P7LABKCW.js";
|
|
55
|
-
import {
|
|
56
|
-
CHANNEL_DEPOSIT_ATOMIC,
|
|
57
|
-
ROUTING_FEE_ATOMIC,
|
|
58
|
-
SUGGESTED_FUND_USD,
|
|
59
|
-
feeRefusal,
|
|
60
|
-
refusedWhy,
|
|
61
|
-
unpaid,
|
|
62
|
-
usd
|
|
63
|
-
} from "./chunk-PAYV4XUA.js";
|
|
64
|
-
import "./chunk-MEFB5KHA.js";
|
|
65
|
-
import "./chunk-KYFZTGMC.js";
|
|
66
|
-
import {
|
|
67
|
-
evaluateSpendPolicy
|
|
68
|
-
} from "./chunk-2SNUOHAT.js";
|
|
69
|
-
import "./chunk-N35E6CM2.js";
|
|
70
|
-
import "./chunk-JRGFKVAZ.js";
|
|
71
|
-
import "./chunk-EGELTSPU.js";
|
|
72
|
-
import "./chunk-KG3D7FIF.js";
|
|
73
|
-
import "./chunk-RBJPAZFI.js";
|
|
74
|
-
import "./chunk-BPMWXTFX.js";
|
|
75
|
-
import {
|
|
76
|
-
routerSettings
|
|
77
|
-
} from "./chunk-SPAVAYSW.js";
|
|
78
|
-
import {
|
|
79
|
-
readAliveStamp
|
|
80
|
-
} from "./chunk-6W5GYG3W.js";
|
|
81
|
-
import "./chunk-S4SAZ7OD.js";
|
|
82
|
-
import "./chunk-IOODYAXL.js";
|
|
83
|
-
import "./chunk-2I4QTOLB.js";
|
|
84
|
-
import {
|
|
85
|
-
resolveContextSettings
|
|
86
|
-
} from "./chunk-AWFUPKTM.js";
|
|
87
|
-
import {
|
|
88
|
-
CliError,
|
|
89
|
-
toMoney
|
|
90
|
-
} from "./chunk-WO5BJNIB.js";
|
|
91
|
-
import {
|
|
92
|
-
readUsdcBalance
|
|
93
|
-
} from "./chunk-O2FRQ2L2.js";
|
|
94
|
-
import "./chunk-SJLTEINJ.js";
|
|
95
|
-
import {
|
|
96
|
-
package_default
|
|
97
|
-
} from "./chunk-VUFAK2LW.js";
|
|
98
|
-
import "./chunk-ZXTAQYNA.js";
|
|
99
|
-
|
|
100
|
-
// src/router/doctor.ts
|
|
101
|
-
import { readFile } from "node:fs/promises";
|
|
102
|
-
import { homedir } from "node:os";
|
|
103
|
-
import { join } from "node:path";
|
|
104
|
-
var NODE_FLOOR = 22;
|
|
105
|
-
var STAMP_FIX = "Start a new Claude Code session and run `tenjin doctor` again: `/reload-plugins` does not run the plugin's `SessionStart`, so only a new session writes the stamp. If it still warns, run `node --version` in that session's shell: Claude Code starts the plugin with the Node on its own PATH, and it must be 22 or newer. Restart Claude Code after installing or updating Node.";
|
|
106
|
-
async function runRouterDoctor(ctx, deps = {}) {
|
|
107
|
-
const env = deps.env ?? process.env;
|
|
108
|
-
const home = deps.homeDir ?? homedir();
|
|
109
|
-
const cwd = deps.cwd ?? process.cwd();
|
|
110
|
-
const project = deps.project ?? await projectInstallHere(cwd, home, env);
|
|
111
|
-
const router = await routerSettings(
|
|
112
|
-
{ cwd, dataDir: ctx.dataDir },
|
|
113
|
-
deps.homeDir !== void 0 ? { homeDir: deps.homeDir } : {}
|
|
114
|
-
).catch((err) => err instanceof Error ? err : new Error(String(err)));
|
|
115
|
-
const settings = await resolveContextSettings(ctx);
|
|
116
|
-
const claude = await readClaudeCode(env, cwd, deps.findClaude ?? findClaudeBinary);
|
|
117
|
-
const scope = project ? "local" : "user";
|
|
118
|
-
const paths = settingsInstallPaths(project, env, home, cwd);
|
|
119
|
-
const legacy = await inspectLegacyInstall(paths.settingsPath, paths.mcpFile);
|
|
120
|
-
const checks = [nodeCheck(deps.nodeVersion ?? process.version)];
|
|
121
|
-
checks.push(claudeCodeCheck(claude));
|
|
122
|
-
const plugin = await pluginCheck(claude, { scope, env, home, cwd, dataDir: ctx.dataDir, legacy });
|
|
123
|
-
checks.push(plugin.check);
|
|
124
|
-
if (plugin.registered && claude.binary !== null) {
|
|
125
|
-
checks.push(await serverCheck(claude.binary, env, cwd));
|
|
126
|
-
}
|
|
127
|
-
if (legacy.present || legacy.unreadable !== void 0) {
|
|
128
|
-
checks.push(await migrationCheck(legacy, claude, ctx.dataDir, env, cwd));
|
|
129
|
-
}
|
|
130
|
-
checks.push(routingCheck(router));
|
|
131
|
-
checks.push((await readMcpServers(deps, { settingsInstallPending: legacy.present })).check);
|
|
132
|
-
checks.push(spendCheck(settings.policy.maxAutoSpendAtomic, settings.policy.sessionBudgetAtomic));
|
|
133
|
-
checks.push(experimentalCheck(settings.experimentalBazaar));
|
|
134
|
-
checks.push(await routingFeeCheck(ctx, settings, deps.fetchImpl));
|
|
135
|
-
checks.push(...await walletCheck(ctx));
|
|
136
|
-
const now = deps.now?.() ?? Date.now();
|
|
137
|
-
const probe = await probeRouter(settings.baseUrl, {
|
|
138
|
-
timeoutMs: ctx.flags.timeout,
|
|
139
|
-
env,
|
|
140
|
-
...deps.fetchImpl !== void 0 ? { fetchImpl: deps.fetchImpl } : {}
|
|
141
|
-
});
|
|
142
|
-
if (probe.status === "ok") {
|
|
143
|
-
await clearRouterMemo(ctx.dataDir, "unreachable", settings.baseUrl);
|
|
144
|
-
checks.push(probe);
|
|
145
|
-
} else {
|
|
146
|
-
checks.push(
|
|
147
|
-
withBackoff(
|
|
148
|
-
probe,
|
|
149
|
-
await readRouterMemo(ctx.dataDir, "unreachable", settings.baseUrl, now),
|
|
150
|
-
now
|
|
151
|
-
)
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
const agents = await subagentsCheck(cwd, home);
|
|
155
|
-
if (agents !== null) checks.push(agents);
|
|
156
|
-
const failure = checks.find((c) => c.status === "fail" && c.required);
|
|
157
|
-
const data = {
|
|
158
|
-
checks,
|
|
159
|
-
dataDir: ctx.dataDir,
|
|
160
|
-
baseUrl: settings.baseUrl,
|
|
161
|
-
scope,
|
|
162
|
-
settingsPath: paths.settingsPath
|
|
163
|
-
};
|
|
164
|
-
if (failure !== void 0) {
|
|
165
|
-
throw new CliError("REFUSED", failure.detail, {
|
|
166
|
-
...failure.fix !== void 0 ? { fix: failure.fix } : {},
|
|
167
|
-
details: data
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
return { data, humanLines: doctorLines(checks) };
|
|
171
|
-
}
|
|
172
|
-
function doctorLines(checks) {
|
|
173
|
-
const bad = checks.filter((c) => c.status !== "ok").length;
|
|
174
|
-
return [
|
|
175
|
-
...checks.flatMap((c) => [
|
|
176
|
-
`${c.status === "ok" ? "ok " : c.status === "warn" ? "warn" : "fail"} ${c.name}: ${c.detail}`,
|
|
177
|
-
...c.status !== "ok" && c.fix !== void 0 ? [` fix: ${c.fix}`] : []
|
|
178
|
-
]),
|
|
179
|
-
bad === 0 ? `${checks.length} checks, all pass.` : `${checks.length} checks, ${bad} to look at.`
|
|
180
|
-
];
|
|
181
|
-
}
|
|
182
|
-
function withBackoff(check, memo, now) {
|
|
183
|
-
if (memo === null) return check;
|
|
184
|
-
const left = Math.max(1, Math.ceil((memo.until - now) / 1e3));
|
|
185
|
-
return {
|
|
186
|
-
...check,
|
|
187
|
-
status: check.status === "ok" ? "warn" : check.status,
|
|
188
|
-
detail: `${check.detail}; routing calls skip the router for ${left}s more, after one did not reach it`
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
async function subagentsCheck(cwd, homeDir) {
|
|
192
|
-
const excluded = await agentsWithoutRequestTool({ cwd, homeDir }, REQUEST_TOOL);
|
|
193
|
-
if (excluded.length === 0) return null;
|
|
194
|
-
return {
|
|
195
|
-
name: "subagents",
|
|
196
|
-
status: "ok",
|
|
197
|
-
required: false,
|
|
198
|
-
detail: `${excluded.join(", ")} ${excluded.length === 1 ? "is" : "are"} offered no paid lookups: add ${REQUEST_TOOL} to tools: to allow paid lookups there`
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
function nodeCheck(version) {
|
|
202
|
-
const major = Number(/^v(\d+)/.exec(version)?.[1] ?? "0");
|
|
203
|
-
return major >= NODE_FLOOR ? { name: "node", status: "ok", required: true, detail: version } : {
|
|
204
|
-
name: "node",
|
|
205
|
-
status: "fail",
|
|
206
|
-
required: true,
|
|
207
|
-
detail: `${version} is below the Node ${NODE_FLOOR} floor.`,
|
|
208
|
-
fix: `Install Node ${NODE_FLOOR} or newer, then re-run \`tenjin doctor\`.`
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
function claudeCodeCheck(claude) {
|
|
212
|
-
const name = "claude code";
|
|
213
|
-
if (claude.binary === null) {
|
|
214
|
-
return {
|
|
215
|
-
name,
|
|
216
|
-
status: "warn",
|
|
217
|
-
required: false,
|
|
218
|
-
detail: "no claude binary on PATH or in CLAUDE_CODE_EXECPATH, so the plugin was checked from its folder only",
|
|
219
|
-
fix: "Run `tenjin doctor` from a Claude Code session, where CLAUDE_CODE_EXECPATH names the binary."
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
if (claude.version === null) {
|
|
223
|
-
return {
|
|
224
|
-
name,
|
|
225
|
-
status: "warn",
|
|
226
|
-
required: false,
|
|
227
|
-
detail: `${claude.binary.path} did not report a version`
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
if (!claude.meetsFloor) {
|
|
231
|
-
return {
|
|
232
|
-
name,
|
|
233
|
-
status: "fail",
|
|
234
|
-
required: true,
|
|
235
|
-
detail: `Claude Code ${claude.version} is older than ${CLAUDE_CODE_FLOOR}, which the Tenjin plugin needs`,
|
|
236
|
-
...claude.fix !== void 0 ? { fix: claude.fix } : {}
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
return {
|
|
240
|
-
name,
|
|
241
|
-
status: "ok",
|
|
242
|
-
required: true,
|
|
243
|
-
detail: `${claude.version}${claude.binary.source === "execpath" ? " (from CLAUDE_CODE_EXECPATH)" : ""}`
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
|
-
async function pluginCheck(claude, c) {
|
|
247
|
-
const name = "plugin";
|
|
248
|
-
const missing = (detail) => ({
|
|
249
|
-
registered: false,
|
|
250
|
-
check: c.legacy.present ? {
|
|
251
|
-
name,
|
|
252
|
-
status: "warn",
|
|
253
|
-
required: false,
|
|
254
|
-
detail: `${detail}; the settings install of an earlier release still routes here`,
|
|
255
|
-
fix: claude.meetsFloor ? `Run \`tenjin install${c.scope === "local" ? " --project" : ""}\` to move this machine to the plugin.` : `Run \`claude update\`, then \`tenjin install${c.scope === "local" ? " --project" : ""}\` to move this machine to the plugin.`
|
|
256
|
-
} : {
|
|
257
|
-
name,
|
|
258
|
-
status: "fail",
|
|
259
|
-
required: true,
|
|
260
|
-
detail,
|
|
261
|
-
fix: `Run \`tenjin install${c.scope === "local" ? " --project" : ""}\`.`
|
|
262
|
-
}
|
|
263
|
-
});
|
|
264
|
-
if (claude.binary !== null) {
|
|
265
|
-
const listing = await readPluginListing(claude.binary, c.env, c.cwd);
|
|
266
|
-
if (!listing.read) {
|
|
267
|
-
return {
|
|
268
|
-
registered: false,
|
|
269
|
-
check: {
|
|
270
|
-
name,
|
|
271
|
-
status: "warn",
|
|
272
|
-
required: false,
|
|
273
|
-
detail: "Claude Code's plugin list could not be read, so the plugin was not checked",
|
|
274
|
-
fix: "Run `tenjin doctor` again in a moment."
|
|
275
|
-
}
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
if (listing.id === null) return missing(`${PLUGIN_ID} is not installed in Claude Code`);
|
|
279
|
-
if (!listing.enabled) {
|
|
280
|
-
return {
|
|
281
|
-
registered: false,
|
|
282
|
-
check: {
|
|
283
|
-
name,
|
|
284
|
-
status: "fail",
|
|
285
|
-
required: true,
|
|
286
|
-
detail: `${listing.id} is installed but disabled, so no lookup is routed`,
|
|
287
|
-
fix: `Run \`claude plugin enable ${listing.id}\`, then ${loadStep(c.legacy.present)}.`
|
|
288
|
-
}
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
if (listing.version !== package_default.version) {
|
|
292
|
-
return {
|
|
293
|
-
registered: true,
|
|
294
|
-
check: {
|
|
295
|
-
name,
|
|
296
|
-
status: "warn",
|
|
297
|
-
required: false,
|
|
298
|
-
detail: `${listing.id} is enabled at ${listing.version ?? "an unknown version"}, and this CLI is ${package_default.version}`,
|
|
299
|
-
fix: "Run `tenjin install --refresh` to register this version."
|
|
300
|
-
}
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
const stamp = await readAliveStamp(c.dataDir);
|
|
304
|
-
if (stamp === null || isNewer(package_default.version, stamp.version)) {
|
|
305
|
-
return {
|
|
306
|
-
registered: true,
|
|
307
|
-
check: {
|
|
308
|
-
name,
|
|
309
|
-
status: "warn",
|
|
310
|
-
required: false,
|
|
311
|
-
detail: `${listing.id} ${package_default.version} is enabled, and no session has started it at this version${stamp !== null ? ` (last ${stamp.version}, at ${stamp.at})` : ""}`,
|
|
312
|
-
fix: STAMP_FIX
|
|
313
|
-
}
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
return {
|
|
317
|
-
registered: true,
|
|
318
|
-
check: { name, status: "ok", required: true, detail: `${listing.id} ${package_default.version} enabled` }
|
|
319
|
-
};
|
|
320
|
-
}
|
|
321
|
-
const folder = await folderState(c.scope, c.env, c.home, c.cwd);
|
|
322
|
-
if (folder.state === "foreign") {
|
|
323
|
-
return {
|
|
324
|
-
registered: false,
|
|
325
|
-
check: {
|
|
326
|
-
name,
|
|
327
|
-
status: "fail",
|
|
328
|
-
required: true,
|
|
329
|
-
detail: `${folder.path} is there and is not a folder this CLI wrote, so the plugin cannot be written`,
|
|
330
|
-
fix: `Move ${folder.path} aside, then run \`tenjin install\` again.`
|
|
331
|
-
}
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
if (folder.state === "ours") {
|
|
335
|
-
const stamp = await readAliveStamp(c.dataDir);
|
|
336
|
-
return {
|
|
337
|
-
registered: true,
|
|
338
|
-
check: stamp === null ? {
|
|
339
|
-
name,
|
|
340
|
-
status: "warn",
|
|
341
|
-
required: false,
|
|
342
|
-
detail: `the plugin folder is at ${folder.path} and has not loaded in a session yet`,
|
|
343
|
-
fix: `To load it, ${loadStep(c.legacy.present)}.`
|
|
344
|
-
} : {
|
|
345
|
-
name,
|
|
346
|
-
status: "ok",
|
|
347
|
-
required: true,
|
|
348
|
-
detail: `the plugin folder at ${folder.path} loaded, last at ${stamp.at}`
|
|
349
|
-
}
|
|
350
|
-
};
|
|
351
|
-
}
|
|
352
|
-
if (await listedInClaudeFiles(c.env, c.home)) {
|
|
353
|
-
return {
|
|
354
|
-
registered: true,
|
|
355
|
-
check: {
|
|
356
|
-
name,
|
|
357
|
-
status: "warn",
|
|
358
|
-
required: false,
|
|
359
|
-
detail: `${PLUGIN_ID} is registered, and there is no claude binary here to check it`,
|
|
360
|
-
fix: "Run `tenjin doctor` from a Claude Code session to check it."
|
|
361
|
-
}
|
|
362
|
-
};
|
|
363
|
-
}
|
|
364
|
-
return missing(`${PLUGIN_ID} is not registered`);
|
|
365
|
-
}
|
|
366
|
-
async function listedInClaudeFiles(env, home) {
|
|
367
|
-
try {
|
|
368
|
-
const raw = await readFile(
|
|
369
|
-
join(claudeConfigDir(env, home), "plugins", "installed_plugins.json"),
|
|
370
|
-
"utf8"
|
|
371
|
-
);
|
|
372
|
-
const plugins = JSON.parse(raw).plugins;
|
|
373
|
-
return plugins !== null && typeof plugins === "object" && PLUGIN_ID in plugins;
|
|
374
|
-
} catch {
|
|
375
|
-
return false;
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
async function serverCheck(binary, env, cwd) {
|
|
379
|
-
const name = "router server";
|
|
380
|
-
const run = await runClaude(binary, ["mcp", "get", PLUGIN_SERVER], {
|
|
381
|
-
env,
|
|
382
|
-
cwd,
|
|
383
|
-
timeoutMs: 45e3
|
|
384
|
-
});
|
|
385
|
-
const status = /Status:\s*(.+)/.exec(run.stdout)?.[1]?.trim();
|
|
386
|
-
if (run.code === 0 && status !== void 0 && /connected/i.test(status) && !/fail/i.test(status)) {
|
|
387
|
-
return { name, status: "ok", required: true, detail: `${PLUGIN_SERVER} connected` };
|
|
388
|
-
}
|
|
389
|
-
return {
|
|
390
|
-
name,
|
|
391
|
-
status: "fail",
|
|
392
|
-
required: true,
|
|
393
|
-
detail: `${PLUGIN_SERVER} did not connect${status !== void 0 ? `: ${status.slice(0, 200)}` : ""}`,
|
|
394
|
-
fix: "Restart Claude Code (quit it from the tray) or sign out and in: the plugin starts the CLI with `node` from the PATH Claude Code started with, so a Claude Code opened before Node was installed cannot find it."
|
|
395
|
-
};
|
|
396
|
-
}
|
|
397
|
-
async function migrationCheck(legacy, claude, dataDir, env, cwd) {
|
|
398
|
-
const name = "settings install";
|
|
399
|
-
if (legacy.unreadable !== void 0) {
|
|
400
|
-
return { name, status: "warn", required: false, detail: legacy.unreadable };
|
|
401
|
-
}
|
|
402
|
-
const parts = [
|
|
403
|
-
...legacy.events.length > 0 ? [`hook entries (${legacy.events.join(", ")})`] : [],
|
|
404
|
-
...legacy.allowRule || legacy.denyRule ? ["permission rules"] : [],
|
|
405
|
-
...legacy.statusLine === "ours" || legacy.statusLine === "composed" ? ["a status line"] : [],
|
|
406
|
-
...legacy.mcp === "ok" ? ["the x402 MCP server"] : []
|
|
407
|
-
];
|
|
408
|
-
const found = `${parts.join(", ")} from an earlier release in ${legacy.settingsPath}`;
|
|
409
|
-
const lookalikes = legacy.lookalikes.length > 0 ? `; not Tenjin's and left alone: ${legacy.lookalikes.join(", ")}` : "";
|
|
410
|
-
const proof = await pluginProof(claude, dataDir, env, cwd);
|
|
411
|
-
return proof.proven ? {
|
|
412
|
-
name,
|
|
413
|
-
status: "warn",
|
|
414
|
-
required: false,
|
|
415
|
-
detail: `${found}, ready to remove: the plugin has loaded here${lookalikes}`,
|
|
416
|
-
fix: "Run `tenjin install --refresh` to remove it."
|
|
417
|
-
} : {
|
|
418
|
-
name,
|
|
419
|
-
status: "warn",
|
|
420
|
-
required: false,
|
|
421
|
-
detail: `${found}, kept until the plugin loads: ${proof.reason}${lookalikes}`,
|
|
422
|
-
fix: claude.meetsFloor ? `To load the plugin, ${loadStep(true)}; the next \`tenjin install\` or \`tenjin update\` then removes the old entries.` : "Run `claude update`, then `tenjin install`: until then the old entries keep routing."
|
|
423
|
-
};
|
|
424
|
-
}
|
|
425
|
-
function routingCheck(router) {
|
|
426
|
-
const name = "routing";
|
|
427
|
-
if (router instanceof Error) {
|
|
428
|
-
return {
|
|
429
|
-
name,
|
|
430
|
-
status: "warn",
|
|
431
|
-
required: false,
|
|
432
|
-
detail: `the router is off here: ${router.message}`,
|
|
433
|
-
fix: "Fix or delete that file."
|
|
434
|
-
};
|
|
435
|
-
}
|
|
436
|
-
if (!router.enabled.value) {
|
|
437
|
-
const file = router.enabled.path ?? "the config";
|
|
438
|
-
return {
|
|
439
|
-
name,
|
|
440
|
-
status: "warn",
|
|
441
|
-
required: false,
|
|
442
|
-
detail: `router.enabled is false in ${file}, so nothing is routed from this directory`,
|
|
443
|
-
fix: router.enabled.source === "file" ? "Run `tenjin config set router.enabled true` to route again." : `Remove router.enabled from ${file} to route here again.`
|
|
444
|
-
};
|
|
445
|
-
}
|
|
446
|
-
return { name, status: "ok", required: false, detail: "on" };
|
|
447
|
-
}
|
|
448
|
-
async function routingFeeCheck(ctx, settings, fetchImpl) {
|
|
449
|
-
let host;
|
|
450
|
-
try {
|
|
451
|
-
host = new URL(settings.baseUrl).host;
|
|
452
|
-
} catch {
|
|
453
|
-
return {
|
|
454
|
-
name: "routing fee",
|
|
455
|
-
status: "warn",
|
|
456
|
-
required: false,
|
|
457
|
-
detail: "not checked, because the base URL is not a URL"
|
|
458
|
-
};
|
|
459
|
-
}
|
|
460
|
-
const why = await routingFeeBlock({
|
|
461
|
-
dataDir: ctx.dataDir,
|
|
462
|
-
policy: settings.policy,
|
|
463
|
-
rpcUrl: settings.rpcUrl,
|
|
464
|
-
host,
|
|
465
|
-
timeoutMs: ctx.flags.timeout,
|
|
466
|
-
provider: await walletFileExists(ctx.dataDir) ? resolveWalletProvider(ctx) : null,
|
|
467
|
-
...fetchImpl !== void 0 ? { fetchImpl } : {}
|
|
468
|
-
}).catch(() => null);
|
|
469
|
-
return routingFeeRow(why, host);
|
|
470
|
-
}
|
|
471
|
-
function routingFeeRow(why, host) {
|
|
472
|
-
const u = why === null ? null : unpaid(why);
|
|
473
|
-
if (why === null || u === null) {
|
|
474
|
-
return {
|
|
475
|
-
name: "routing fee",
|
|
476
|
-
status: "ok",
|
|
477
|
-
required: false,
|
|
478
|
-
detail: `$${usd(ROUTING_FEE_ATOMIC)} a call, paid from channel deposits of up to $${usd(CHANNEL_DEPOSIT_ATOMIC)} that count against the spend limits`
|
|
479
|
-
};
|
|
480
|
-
}
|
|
481
|
-
const fixes = {
|
|
482
|
-
no_wallet: `Run \`tenjin wallet create\`, then \`tenjin wallet fund ${SUGGESTED_FUND_USD}\`.`,
|
|
483
|
-
limit_below_deposit: `Raise it with \`tenjin config set maxAutoSpend ${usd(CHANNEL_DEPOSIT_ATOMIC)}\`.`,
|
|
484
|
-
budget_reached: "Room comes back as the rolling day passes, or raise it with `tenjin config set sessionBudget <usd>`.",
|
|
485
|
-
not_allowlisted: `Add ${host} to allowlistCreators, or clear the allowlist.`
|
|
486
|
-
};
|
|
487
|
-
return {
|
|
488
|
-
name: "routing fee",
|
|
489
|
-
status: "warn",
|
|
490
|
-
required: false,
|
|
491
|
-
detail: `${u.reason}, so routing calls take the free path`,
|
|
492
|
-
fix: fixes[why] ?? u.fix
|
|
493
|
-
};
|
|
494
|
-
}
|
|
495
|
-
async function routingFeeBlock(input) {
|
|
496
|
-
const { provider, policy } = input;
|
|
497
|
-
const refused = feeRefusal(policy, input.host);
|
|
498
|
-
if (refused !== null) return refused;
|
|
499
|
-
if (provider === null) return "no_wallet";
|
|
500
|
-
const verified = await provider.verify?.().catch(() => null);
|
|
501
|
-
if (verified !== void 0 && verified !== null && verified.status !== "verified") {
|
|
502
|
-
return "wallet_locked";
|
|
503
|
-
}
|
|
504
|
-
const ledger = await readSpendSummary(input.dataDir);
|
|
505
|
-
const spent = ledger === null ? 0n : spentOf(ledger);
|
|
506
|
-
const { address } = await describeWallet(provider);
|
|
507
|
-
if (await channelCredit(input.dataDir, address) >= ROUTING_FEE_ATOMIC) return null;
|
|
508
|
-
const evaluation = evaluateSpendPolicy(policy, {
|
|
509
|
-
mode: "automatic",
|
|
510
|
-
amountAtomic: CHANNEL_DEPOSIT_ATOMIC,
|
|
511
|
-
creator: input.host,
|
|
512
|
-
sessionSpentAtomic: spent
|
|
513
|
-
});
|
|
514
|
-
if (evaluation.decision !== "allow") return refusedWhy(evaluation.reason);
|
|
515
|
-
const balance = await readUsdcBalance(address, input.rpcUrl, {
|
|
516
|
-
timeoutMs: input.timeoutMs,
|
|
517
|
-
...input.fetchImpl !== void 0 ? { fetchImpl: input.fetchImpl } : {}
|
|
518
|
-
});
|
|
519
|
-
return balance !== null && balance < CHANNEL_DEPOSIT_ATOMIC ? "wallet_low" : null;
|
|
520
|
-
}
|
|
521
|
-
function experimentalCheck(bazaar) {
|
|
522
|
-
return {
|
|
523
|
-
name: "experimental",
|
|
524
|
-
status: "ok",
|
|
525
|
-
required: false,
|
|
526
|
-
detail: bazaar ? "list: on; bazaar: on (experimental): the router may also suggest unreviewed sellers from the open x402 Bazaar" : "list: on; bazaar: off (experimental): `tenjin config set experimental.bazaar on` to add the open x402 Bazaar"
|
|
527
|
-
};
|
|
528
|
-
}
|
|
529
|
-
function spendCheck(maxAutoSpendAtomic, sessionBudgetAtomic) {
|
|
530
|
-
if (sessionBudgetAtomic === 0n) {
|
|
531
|
-
return {
|
|
532
|
-
name: "spend",
|
|
533
|
-
status: "fail",
|
|
534
|
-
required: true,
|
|
535
|
-
detail: "The daily limit is 0, so positive payments are refused even with --yes.",
|
|
536
|
-
fix: "Choose a daily limit with `tenjin config set sessionBudget <usd|none>`."
|
|
537
|
-
};
|
|
538
|
-
}
|
|
539
|
-
if (maxAutoSpendAtomic === 0n) {
|
|
540
|
-
return {
|
|
541
|
-
name: "spend",
|
|
542
|
-
status: "fail",
|
|
543
|
-
required: true,
|
|
544
|
-
detail: "maxAutoSpend is 0, so every lookup needs approval and none can pay",
|
|
545
|
-
fix: `Raise it with \`tenjin config set maxAutoSpend ${usd(CHANNEL_DEPOSIT_ATOMIC)}\`.`
|
|
546
|
-
};
|
|
547
|
-
}
|
|
548
|
-
const budget = sessionBudgetAtomic === null ? "no daily ceiling" : `${toMoney(sessionBudgetAtomic.toString()).usd} USD a day`;
|
|
549
|
-
return {
|
|
550
|
-
name: "spend",
|
|
551
|
-
status: sessionBudgetAtomic === null ? "warn" : "ok",
|
|
552
|
-
required: false,
|
|
553
|
-
detail: `automatic approval up to ${toMoney(maxAutoSpendAtomic.toString()).usd} USD a call, ${budget}`,
|
|
554
|
-
...sessionBudgetAtomic === null ? { fix: "Set one with `tenjin config set sessionBudget 1.00`." } : {}
|
|
555
|
-
};
|
|
556
|
-
}
|
|
557
|
-
async function walletCheck(ctx) {
|
|
558
|
-
if (!await walletFileExists(ctx.dataDir)) {
|
|
559
|
-
return [
|
|
560
|
-
{
|
|
561
|
-
name: "wallet",
|
|
562
|
-
status: "fail",
|
|
563
|
-
required: true,
|
|
564
|
-
detail: "no wallet on this machine, so nothing can pay",
|
|
565
|
-
fix: `Run \`tenjin wallet create\`, then \`tenjin wallet fund ${SUGGESTED_FUND_USD}\`.`
|
|
566
|
-
}
|
|
567
|
-
];
|
|
568
|
-
}
|
|
569
|
-
try {
|
|
570
|
-
const described = await describeWallet(resolveWalletProvider(ctx));
|
|
571
|
-
return [{ name: "wallet", status: "ok", required: true, detail: described.address }];
|
|
572
|
-
} catch (err) {
|
|
573
|
-
return [
|
|
574
|
-
{
|
|
575
|
-
name: "wallet",
|
|
576
|
-
status: "fail",
|
|
577
|
-
required: true,
|
|
578
|
-
detail: err instanceof CliError ? err.message : String(err),
|
|
579
|
-
...err instanceof CliError && err.fix !== void 0 ? { fix: err.fix } : {}
|
|
580
|
-
}
|
|
581
|
-
];
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
export {
|
|
585
|
-
doctorLines,
|
|
586
|
-
routingFeeBlock,
|
|
587
|
-
routingFeeRow,
|
|
588
|
-
runRouterDoctor
|
|
589
|
-
};
|
|
590
|
-
//# sourceMappingURL=doctor-IQQJHGGM.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/router/doctor.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { homedir } from 'node:os';\nimport { join } from 'node:path';\nimport pkg from '../../package.json';\nimport { CliError } from '../lib/errors';\nimport { toMoney } from '../lib/money';\nimport { evaluateSpendPolicy, type SpendPolicy } from '../lib/policy';\nimport { resolveContextSettings, type ResolvedSettings } from '../lib/settings';\nimport { spentOf } from '../lib/spend-ledger';\nimport { isNewer } from '../lib/update-check';\nimport { readUsdcBalance } from '../lib/usdc-balance';\nimport { describeWallet, resolveWalletProvider, type WalletProvider } from '../lib/wallet';\nimport { readSpendSummary } from '../lib/wallet/spend';\nimport { walletFileExists } from '../lib/wallet/store';\nimport type { CommandContext, CommandResult } from '../context';\nimport { agentsWithoutRequestTool } from './agent-tools';\nimport { readAliveStamp } from './alive';\nimport {\n CLAUDE_CODE_FLOOR,\n claudeConfigDir,\n findClaudeBinary,\n readClaudeCode,\n runClaude,\n type ClaudeBinary,\n type ClaudeCodeState,\n} from './claude-cli';\nimport {\n CHANNEL_DEPOSIT_ATOMIC,\n feeRefusal,\n refusedWhy,\n ROUTING_FEE_ATOMIC,\n SUGGESTED_FUND_USD,\n unpaid,\n usd,\n} from './fee';\nimport { channelCredit } from './channel-credit';\nimport { loadStep, pluginProof, projectInstallHere, settingsInstallPaths } from './install';\nimport { inspectLegacyInstall, type LegacyInstall } from './legacy-install';\nimport { routerSettings, type RouterSettings } from './settings';\nimport { PLUGIN_ID, PLUGIN_SERVER, REQUEST_TOOL } from './names';\nimport { folderState, readPluginListing, type PluginScope } from './plugin-registration';\nimport { probeRouter, type RouterCheck } from './reachability';\nimport { readMcpServers, type InstalledAt, type ListMcpProcesses } from './mcp-processes';\nimport { clearRouterMemo, readRouterMemo, type RouterMemo } from './router-memo';\n\n/**\n * `tenjin doctor` for the router product: the things that decide whether a\n * lookup can happen at all, read and never written.\n *\n * THE PLUGIN IS ASKED ABOUT THROUGH CLAUDE CODE ITSELF: `claude --version`\n * against the floor, `claude plugin list --json` for the plugin and its\n * version, and `claude mcp get` for its `router` server. With no binary, the\n * plugin folder and the `alive` stamp stand in. A settings install of an\n * earlier release is reported with its migration state; doctor never migrates.\n *\n * EVERY FIX IS A STEP THE AGENT TAKES IN THE SESSION: a command it runs, or a\n * slash command the person types there. None sends anyone out of Claude Code.\n *\n * THE SHELF'S DOCTOR IS NOT THIS ONE. It stays with the product it belongs to\n * (`src/commands/doctor.ts`, unregistered), and this one reports the router's\n * own wiring.\n */\n\nexport type { RouterCheck };\n\nexport interface RouterDoctorDeps {\n homeDir?: string;\n cwd?: string;\n /** Check the project install, as `install --project` registered it. Absent,\n * a project install in `cwd` is found ({@link projectInstallHere}). */\n project?: boolean;\n env?: NodeJS.ProcessEnv;\n /** Finds the `claude` binary; tests inject one. */\n findClaude?: (env: NodeJS.ProcessEnv) => ClaudeBinary | null;\n fetchImpl?: typeof fetch;\n /** Node's own version, for the floor check. */\n nodeVersion?: string;\n /** This user's running `tenjin mcp` processes; tests inject them. */\n listMcpProcesses?: ListMcpProcesses;\n /** When this build was installed; tests inject it. */\n installedAt?: InstalledAt;\n now?: () => number;\n}\n\nconst NODE_FLOOR = 22;\n/** The stamp row's fix: a new session first, since a reload never stamps, then the Node it runs. */\nconst STAMP_FIX =\n \"Start a new Claude Code session and run `tenjin doctor` again: `/reload-plugins` does not run the plugin's `SessionStart`, so only a new session writes the stamp. If it still warns, run `node --version` in that session's shell: Claude Code starts the plugin with the Node on its own PATH, and it must be 22 or newer. Restart Claude Code after installing or updating Node.\";\n\nexport async function runRouterDoctor(\n ctx: CommandContext,\n deps: RouterDoctorDeps = {},\n): Promise<CommandResult> {\n const env = deps.env ?? process.env;\n const home = deps.homeDir ?? homedir();\n const cwd = deps.cwd ?? process.cwd();\n // WITHOUT THE FLAG, THE INSTALL THIS DIRECTORY HOLDS: a project install\n // found here is the one a session here runs, so it is the one checked.\n const project = deps.project ?? (await projectInstallHere(cwd, home, env));\n // From the directory doctor runs in, which is the one a session there would use.\n const router = await routerSettings(\n { cwd, dataDir: ctx.dataDir },\n deps.homeDir !== undefined ? { homeDir: deps.homeDir } : {},\n ).catch((err: unknown) => (err instanceof Error ? err : new Error(String(err))));\n const settings = await resolveContextSettings(ctx);\n const claude = await readClaudeCode(env, cwd, deps.findClaude ?? findClaudeBinary);\n const scope: PluginScope = project ? 'local' : 'user';\n const paths = settingsInstallPaths(project, env, home, cwd);\n const legacy = await inspectLegacyInstall(paths.settingsPath, paths.mcpFile);\n\n const checks: RouterCheck[] = [nodeCheck(deps.nodeVersion ?? process.version)];\n checks.push(claudeCodeCheck(claude));\n const plugin = await pluginCheck(claude, { scope, env, home, cwd, dataDir: ctx.dataDir, legacy });\n checks.push(plugin.check);\n if (plugin.registered && claude.binary !== null) {\n checks.push(await serverCheck(claude.binary, env, cwd));\n }\n if (legacy.present || legacy.unreadable !== undefined) {\n checks.push(await migrationCheck(legacy, claude, ctx.dataDir, env, cwd));\n }\n checks.push(routingCheck(router));\n checks.push((await readMcpServers(deps, { settingsInstallPending: legacy.present })).check);\n checks.push(spendCheck(settings.policy.maxAutoSpendAtomic, settings.policy.sessionBudgetAtomic));\n checks.push(experimentalCheck(settings.experimentalBazaar));\n checks.push(await routingFeeCheck(ctx, settings, deps.fetchImpl));\n checks.push(...(await walletCheck(ctx)));\n const now = deps.now?.() ?? Date.now();\n const probe = await probeRouter(settings.baseUrl, {\n timeoutMs: ctx.flags.timeout,\n env,\n ...(deps.fetchImpl !== undefined ? { fetchImpl: deps.fetchImpl } : {}),\n });\n // A probe the router answered ends the routing legs' backoff at once.\n if (probe.status === 'ok') {\n await clearRouterMemo(ctx.dataDir, 'unreachable', settings.baseUrl);\n checks.push(probe);\n } else {\n checks.push(\n withBackoff(\n probe,\n await readRouterMemo(ctx.dataDir, 'unreachable', settings.baseUrl, now),\n now,\n ),\n );\n }\n const agents = await subagentsCheck(cwd, home);\n if (agents !== null) checks.push(agents);\n\n const failure = checks.find((c) => c.status === 'fail' && c.required);\n const data = {\n checks,\n dataDir: ctx.dataDir,\n baseUrl: settings.baseUrl,\n scope,\n settingsPath: paths.settingsPath,\n };\n if (failure !== undefined) {\n // REFUSED, the exit-3 class: a machine this command found unready is\n // understood and refused, not a runtime failure of the command itself.\n throw new CliError('REFUSED', failure.detail, {\n ...(failure.fix !== undefined ? { fix: failure.fix } : {}),\n details: data,\n });\n }\n return { data, humanLines: doctorLines(checks) };\n}\n\n/** The human report: one line a check, and under each row to look at, its\n * fix, as `--json` carries it. */\nexport function doctorLines(checks: RouterCheck[]): string[] {\n const bad = checks.filter((c) => c.status !== 'ok').length;\n return [\n ...checks.flatMap((c) => [\n `${c.status === 'ok' ? 'ok ' : c.status === 'warn' ? 'warn' : 'fail'} ${c.name}: ${c.detail}`,\n ...(c.status !== 'ok' && c.fix !== undefined ? [` fix: ${c.fix}`] : []),\n ]),\n bad === 0\n ? `${checks.length} checks, all pass.`\n : `${checks.length} checks, ${bad} to look at.`,\n ];\n}\n\n/**\n * The routing legs' backoff, named on a router line whose probe failed too.\n * It ends by itself after its minute, or when a probe here reaches the router.\n */\nfunction withBackoff(check: RouterCheck, memo: RouterMemo | null, now: number): RouterCheck {\n if (memo === null) return check;\n const left = Math.max(1, Math.ceil((memo.until - now) / 1000));\n return {\n ...check,\n status: check.status === 'ok' ? 'warn' : check.status,\n detail: `${check.detail}; routing calls skip the router for ${left}s more, after one did not reach it`,\n };\n}\n\n/**\n * INFORMATIONAL, NEVER A FAILURE. A custom agent whose `tools:` leave the\n * request tool out is a choice its author may have meant, so this names those\n * agents and the one line that would change it, and counts as passing. It is\n * absent when there is nothing to name. The files are only read.\n */\nasync function subagentsCheck(cwd: string, homeDir: string): Promise<RouterCheck | null> {\n const excluded = await agentsWithoutRequestTool({ cwd, homeDir }, REQUEST_TOOL);\n if (excluded.length === 0) return null;\n return {\n name: 'subagents',\n status: 'ok',\n required: false,\n detail: `${excluded.join(', ')} ${excluded.length === 1 ? 'is' : 'are'} offered no paid lookups: add ${REQUEST_TOOL} to tools: to allow paid lookups there`,\n };\n}\n\nfunction nodeCheck(version: string): RouterCheck {\n const major = Number(/^v(\\d+)/.exec(version)?.[1] ?? '0');\n return major >= NODE_FLOOR\n ? { name: 'node', status: 'ok', required: true, detail: version }\n : {\n name: 'node',\n status: 'fail',\n required: true,\n detail: `${version} is below the Node ${NODE_FLOOR} floor.`,\n fix: `Install Node ${NODE_FLOOR} or newer, then re-run \\`tenjin doctor\\`.`,\n };\n}\n\n/** Claude Code's version against the plugin's floor. */\nfunction claudeCodeCheck(claude: ClaudeCodeState): RouterCheck {\n const name = 'claude code';\n if (claude.binary === null) {\n return {\n name,\n status: 'warn',\n required: false,\n detail:\n 'no claude binary on PATH or in CLAUDE_CODE_EXECPATH, so the plugin was checked from its folder only',\n fix: 'Run `tenjin doctor` from a Claude Code session, where CLAUDE_CODE_EXECPATH names the binary.',\n };\n }\n if (claude.version === null) {\n return {\n name,\n status: 'warn',\n required: false,\n detail: `${claude.binary.path} did not report a version`,\n };\n }\n if (!claude.meetsFloor) {\n return {\n name,\n status: 'fail',\n required: true,\n detail: `Claude Code ${claude.version} is older than ${CLAUDE_CODE_FLOOR}, which the Tenjin plugin needs`,\n ...(claude.fix !== undefined ? { fix: claude.fix } : {}),\n };\n }\n return {\n name,\n status: 'ok',\n required: true,\n detail: `${claude.version}${claude.binary.source === 'execpath' ? ' (from CLAUDE_CODE_EXECPATH)' : ''}`,\n };\n}\n\ninterface PluginContext {\n scope: PluginScope;\n env: NodeJS.ProcessEnv;\n home: string;\n cwd: string;\n dataDir: string;\n legacy: LegacyInstall;\n}\n\n/**\n * The plugin: listed and enabled at this CLI's version and stamped by a\n * session at it, or, with no binary to ask, its folder and the `alive` stamp. A machine that still routes through a\n * settings install of an earlier release warns rather than fails.\n */\nasync function pluginCheck(\n claude: ClaudeCodeState,\n c: PluginContext,\n): Promise<{ check: RouterCheck; registered: boolean }> {\n const name = 'plugin';\n const missing = (detail: string): { check: RouterCheck; registered: boolean } => ({\n registered: false,\n check: c.legacy.present\n ? {\n name,\n status: 'warn',\n required: false,\n detail: `${detail}; the settings install of an earlier release still routes here`,\n fix: claude.meetsFloor\n ? `Run \\`tenjin install${c.scope === 'local' ? ' --project' : ''}\\` to move this machine to the plugin.`\n : `Run \\`claude update\\`, then \\`tenjin install${c.scope === 'local' ? ' --project' : ''}\\` to move this machine to the plugin.`,\n }\n : {\n name,\n status: 'fail',\n required: true,\n detail,\n fix: `Run \\`tenjin install${c.scope === 'local' ? ' --project' : ''}\\`.`,\n },\n });\n if (claude.binary !== null) {\n const listing = await readPluginListing(claude.binary, c.env, c.cwd);\n if (!listing.read) {\n return {\n registered: false,\n check: {\n name,\n status: 'warn',\n required: false,\n detail: \"Claude Code's plugin list could not be read, so the plugin was not checked\",\n fix: 'Run `tenjin doctor` again in a moment.',\n },\n };\n }\n if (listing.id === null) return missing(`${PLUGIN_ID} is not installed in Claude Code`);\n if (!listing.enabled) {\n return {\n registered: false,\n check: {\n name,\n status: 'fail',\n required: true,\n detail: `${listing.id} is installed but disabled, so no lookup is routed`,\n fix: `Run \\`claude plugin enable ${listing.id}\\`, then ${loadStep(c.legacy.present)}.`,\n },\n };\n }\n if (listing.version !== pkg.version) {\n return {\n registered: true,\n check: {\n name,\n status: 'warn',\n required: false,\n detail: `${listing.id} is enabled at ${listing.version ?? 'an unknown version'}, and this CLI is ${pkg.version}`,\n fix: 'Run `tenjin install --refresh` to register this version.',\n },\n };\n }\n // Claude Code's own environment shows only in the `alive` stamp, which the\n // plugin's SessionStart leg writes from a real session: doctor's PATH may\n // find a Node that Claude Code's does not.\n const stamp = await readAliveStamp(c.dataDir);\n if (stamp === null || isNewer(pkg.version, stamp.version)) {\n return {\n registered: true,\n check: {\n name,\n status: 'warn',\n required: false,\n detail: `${listing.id} ${pkg.version} is enabled, and no session has started it at this version${stamp !== null ? ` (last ${stamp.version}, at ${stamp.at})` : ''}`,\n fix: STAMP_FIX,\n },\n };\n }\n return {\n registered: true,\n check: { name, status: 'ok', required: true, detail: `${listing.id} ${pkg.version} enabled` },\n };\n }\n const folder = await folderState(c.scope, c.env, c.home, c.cwd);\n if (folder.state === 'foreign') {\n return {\n registered: false,\n check: {\n name,\n status: 'fail',\n required: true,\n detail: `${folder.path} is there and is not a folder this CLI wrote, so the plugin cannot be written`,\n fix: `Move ${folder.path} aside, then run \\`tenjin install\\` again.`,\n },\n };\n }\n if (folder.state === 'ours') {\n const stamp = await readAliveStamp(c.dataDir);\n return {\n registered: true,\n check:\n stamp === null\n ? {\n name,\n status: 'warn',\n required: false,\n detail: `the plugin folder is at ${folder.path} and has not loaded in a session yet`,\n fix: `To load it, ${loadStep(c.legacy.present)}.`,\n }\n : {\n name,\n status: 'ok',\n required: true,\n detail: `the plugin folder at ${folder.path} loaded, last at ${stamp.at}`,\n },\n };\n }\n if (await listedInClaudeFiles(c.env, c.home)) {\n return {\n registered: true,\n check: {\n name,\n status: 'warn',\n required: false,\n detail: `${PLUGIN_ID} is registered, and there is no claude binary here to check it`,\n fix: 'Run `tenjin doctor` from a Claude Code session to check it.',\n },\n };\n }\n return missing(`${PLUGIN_ID} is not registered`);\n}\n\n/** Claude Code's own record, read when no binary can be asked. */\nasync function listedInClaudeFiles(env: NodeJS.ProcessEnv, home: string): Promise<boolean> {\n try {\n const raw = await readFile(\n join(claudeConfigDir(env, home), 'plugins', 'installed_plugins.json'),\n 'utf8',\n );\n const plugins = (JSON.parse(raw) as { plugins?: unknown }).plugins;\n return plugins !== null && typeof plugins === 'object' && PLUGIN_ID in plugins;\n } catch {\n return false;\n }\n}\n\n/**\n * The plugin's `router` server, through `claude mcp get`, which starts it the\n * way a session would and reports whether it answered. `claude mcp get` runs\n * with doctor's own environment, so it starts `node` from doctor's PATH, not\n * the PATH a running Claude Code started with: a connected server here does\n * not prove a session can start it. The `plugin` row's `alive` stamp is the\n * proof from a real session.\n */\nasync function serverCheck(\n binary: ClaudeBinary,\n env: NodeJS.ProcessEnv,\n cwd: string,\n): Promise<RouterCheck> {\n const name = 'router server';\n const run = await runClaude(binary, ['mcp', 'get', PLUGIN_SERVER], {\n env,\n cwd,\n timeoutMs: 45_000,\n });\n const status = /Status:\\s*(.+)/.exec(run.stdout)?.[1]?.trim();\n if (\n run.code === 0 &&\n status !== undefined &&\n /connected/i.test(status) &&\n !/fail/i.test(status)\n ) {\n return { name, status: 'ok', required: true, detail: `${PLUGIN_SERVER} connected` };\n }\n return {\n name,\n status: 'fail',\n required: true,\n detail: `${PLUGIN_SERVER} did not connect${status !== undefined ? `: ${status.slice(0, 200)}` : ''}`,\n fix: 'Restart Claude Code (quit it from the tray) or sign out and in: the plugin starts the CLI with `node` from the PATH Claude Code started with, so a Claude Code opened before Node was installed cannot find it.',\n };\n}\n\n/**\n * A settings install of an earlier release: what is left, and whether the\n * next `tenjin install` or `tenjin update` removes it. Never a failure, and\n * never written here.\n */\nasync function migrationCheck(\n legacy: LegacyInstall,\n claude: ClaudeCodeState,\n dataDir: string,\n env: NodeJS.ProcessEnv,\n cwd: string,\n): Promise<RouterCheck> {\n const name = 'settings install';\n if (legacy.unreadable !== undefined) {\n return { name, status: 'warn', required: false, detail: legacy.unreadable };\n }\n const parts = [\n ...(legacy.events.length > 0 ? [`hook entries (${legacy.events.join(', ')})`] : []),\n ...(legacy.allowRule || legacy.denyRule ? ['permission rules'] : []),\n ...(legacy.statusLine === 'ours' || legacy.statusLine === 'composed' ? ['a status line'] : []),\n ...(legacy.mcp === 'ok' ? ['the x402 MCP server'] : []),\n ];\n const found = `${parts.join(', ')} from an earlier release in ${legacy.settingsPath}`;\n const lookalikes =\n legacy.lookalikes.length > 0\n ? `; not Tenjin's and left alone: ${legacy.lookalikes.join(', ')}`\n : '';\n const proof = await pluginProof(claude, dataDir, env, cwd);\n return proof.proven\n ? {\n name,\n status: 'warn',\n required: false,\n detail: `${found}, ready to remove: the plugin has loaded here${lookalikes}`,\n fix: 'Run `tenjin install --refresh` to remove it.',\n }\n : {\n name,\n status: 'warn',\n required: false,\n detail: `${found}, kept until the plugin loads: ${proof.reason}${lookalikes}`,\n fix: claude.meetsFloor\n ? `To load the plugin, ${loadStep(true)}; the next \\`tenjin install\\` or \\`tenjin update\\` then removes the old entries.`\n : 'Run `claude update`, then `tenjin install`: until then the old entries keep routing.',\n };\n}\n\n/**\n * WIRED BUT SWITCHED OFF is a choice, not a fault, so it warns and names the\n * file that made it.\n */\nfunction routingCheck(router: RouterSettings | Error): RouterCheck {\n const name = 'routing';\n if (router instanceof Error) {\n return {\n name,\n status: 'warn',\n required: false,\n detail: `the router is off here: ${router.message}`,\n fix: 'Fix or delete that file.',\n };\n }\n if (!router.enabled.value) {\n const file = router.enabled.path ?? 'the config';\n return {\n name,\n status: 'warn',\n required: false,\n detail: `router.enabled is false in ${file}, so nothing is routed from this directory`,\n fix:\n router.enabled.source === 'file'\n ? 'Run `tenjin config set router.enabled true` to route again.'\n : `Remove router.enabled from ${file} to route here again.`,\n };\n }\n return { name, status: 'ok', required: false, detail: 'on' };\n}\n\n/**\n * THE ROUTING FEE, AS THE NEXT PAID CALL WOULD MEET IT: the reasons the session\n * notice gives (`unpaid`), worked out here from the wallet, the spend limits,\n * the ledger and the channel the SDK keeps. Never a failure: a call the fee\n * cannot pay takes the free path. A payment that failed in a session leaves\n * nothing to read here; these are the causes this can check.\n */\nasync function routingFeeCheck(\n ctx: CommandContext,\n settings: ResolvedSettings,\n fetchImpl: typeof fetch | undefined,\n): Promise<RouterCheck> {\n let host: string;\n try {\n host = new URL(settings.baseUrl).host;\n } catch {\n // The router check below names the bad base URL and its fix.\n return {\n name: 'routing fee',\n status: 'warn',\n required: false,\n detail: 'not checked, because the base URL is not a URL',\n };\n }\n const why = await routingFeeBlock({\n dataDir: ctx.dataDir,\n policy: settings.policy,\n rpcUrl: settings.rpcUrl,\n host,\n timeoutMs: ctx.flags.timeout,\n provider: (await walletFileExists(ctx.dataDir)) ? resolveWalletProvider(ctx) : null,\n ...(fetchImpl !== undefined ? { fetchImpl } : {}),\n }).catch(() => null);\n return routingFeeRow(why, host);\n}\n\n/** The routing-fee row for what {@link routingFeeBlock} found. */\nexport function routingFeeRow(why: string | null, host: string): RouterCheck {\n const u = why === null ? null : unpaid(why);\n if (why === null || u === null) {\n return {\n name: 'routing fee',\n status: 'ok',\n required: false,\n detail: `$${usd(ROUTING_FEE_ATOMIC)} a call, paid from channel deposits of up to $${usd(CHANNEL_DEPOSIT_ATOMIC)} that count against the spend limits`,\n };\n }\n const fixes: Record<string, string> = {\n no_wallet: `Run \\`tenjin wallet create\\`, then \\`tenjin wallet fund ${SUGGESTED_FUND_USD}\\`.`,\n limit_below_deposit: `Raise it with \\`tenjin config set maxAutoSpend ${usd(CHANNEL_DEPOSIT_ATOMIC)}\\`.`,\n budget_reached:\n 'Room comes back as the rolling day passes, or raise it with `tenjin config set sessionBudget <usd>`.',\n not_allowlisted: `Add ${host} to allowlistCreators, or clear the allowlist.`,\n };\n return {\n name: 'routing fee',\n status: 'warn',\n required: false,\n detail: `${u.reason}, so routing calls take the free path`,\n fix: fixes[why] ?? u.fix,\n };\n}\n\n/** What {@link routingFeeBlock} reads; `provider` is null with no wallet. */\nexport interface RoutingFeeInput {\n dataDir: string;\n policy: SpendPolicy;\n rpcUrl: string;\n /** The router's host, the creator a deposit pays. */\n host: string;\n timeoutMs: number;\n provider: WalletProvider | null;\n fetchImpl?: typeof fetch;\n}\n\n/** Why the next deposit would be refused, or null when the fee can be paid. */\nexport async function routingFeeBlock(input: RoutingFeeInput): Promise<string | null> {\n const { provider, policy } = input;\n // The fee's per-payment checks first, before the wallet, as the payer runs\n // them on every call: a channel with credit pays nothing they refuse, and a\n // limit below the deposit is the fix to name, not the passphrase.\n const refused = feeRefusal(policy, input.host);\n if (refused !== null) return refused;\n if (provider === null) return 'no_wallet';\n const verified = await provider.verify?.().catch(() => null);\n if (verified !== undefined && verified !== null && verified.status !== 'verified') {\n return 'wallet_locked';\n }\n const ledger = await readSpendSummary(input.dataDir);\n const spent = ledger === null ? 0n : spentOf(ledger);\n const { address } = await describeWallet(provider);\n if ((await channelCredit(input.dataDir, address)) >= ROUTING_FEE_ATOMIC) return null;\n // The deposit is always the full $0.25 and meets the whole policy, as the\n // payer's: a per-call limit below it refuses it, mapped the payer's way.\n const evaluation = evaluateSpendPolicy(policy, {\n mode: 'automatic',\n amountAtomic: CHANNEL_DEPOSIT_ATOMIC,\n creator: input.host,\n sessionSpentAtomic: spent,\n });\n if (evaluation.decision !== 'allow') return refusedWhy(evaluation.reason);\n const balance = await readUsdcBalance(address, input.rpcUrl, {\n timeoutMs: input.timeoutMs,\n ...(input.fetchImpl !== undefined ? { fetchImpl: input.fetchImpl } : {}),\n });\n return balance !== null && balance < CHANNEL_DEPOSIT_ATOMIC ? 'wallet_low' : null;\n}\n\n/** INFORMATIONAL: which experiment is on, in one line. Either state passes. */\nfunction experimentalCheck(bazaar: boolean): RouterCheck {\n return {\n name: 'experimental',\n status: 'ok',\n required: false,\n detail: bazaar\n ? 'list: on; bazaar: on (experimental): the router may also suggest unreviewed sellers from the open x402 Bazaar'\n : 'list: on; bazaar: off (experimental): `tenjin config set experimental.bazaar on` to add the open x402 Bazaar',\n };\n}\n\n/**\n * The two limits: the daily budget is the control, the per-call ceiling the\n * runaway guard. A per-call limit an earlier release left below $0.25 shows\n * on the routing-fee row, which names the deposit it refuses.\n */\nfunction spendCheck(maxAutoSpendAtomic: bigint, sessionBudgetAtomic: bigint | null): RouterCheck {\n if (sessionBudgetAtomic === 0n) {\n return {\n name: 'spend',\n status: 'fail',\n required: true,\n detail: 'The daily limit is 0, so positive payments are refused even with --yes.',\n fix: 'Choose a daily limit with `tenjin config set sessionBudget <usd|none>`.',\n };\n }\n if (maxAutoSpendAtomic === 0n) {\n return {\n name: 'spend',\n status: 'fail',\n required: true,\n detail: 'maxAutoSpend is 0, so every lookup needs approval and none can pay',\n fix: `Raise it with \\`tenjin config set maxAutoSpend ${usd(CHANNEL_DEPOSIT_ATOMIC)}\\`.`,\n };\n }\n const budget =\n sessionBudgetAtomic === null\n ? 'no daily ceiling'\n : `${toMoney(sessionBudgetAtomic.toString()).usd} USD a day`;\n return {\n name: 'spend',\n status: sessionBudgetAtomic === null ? 'warn' : 'ok',\n required: false,\n detail: `automatic approval up to ${toMoney(maxAutoSpendAtomic.toString()).usd} USD a call, ${budget}`,\n ...(sessionBudgetAtomic === null\n ? { fix: 'Set one with `tenjin config set sessionBudget 1.00`.' }\n : {}),\n };\n}\n\nasync function walletCheck(ctx: CommandContext): Promise<RouterCheck[]> {\n if (!(await walletFileExists(ctx.dataDir))) {\n return [\n {\n name: 'wallet',\n status: 'fail',\n required: true,\n detail: 'no wallet on this machine, so nothing can pay',\n fix: `Run \\`tenjin wallet create\\`, then \\`tenjin wallet fund ${SUGGESTED_FUND_USD}\\`.`,\n },\n ];\n }\n try {\n const described = await describeWallet(resolveWalletProvider(ctx));\n return [{ name: 'wallet', status: 'ok', required: true, detail: described.address }];\n } catch (err) {\n return [\n {\n name: 'wallet',\n status: 'fail',\n required: true,\n detail: err instanceof CliError ? err.message : String(err),\n ...(err instanceof CliError && err.fix !== undefined ? { fix: err.fix } : {}),\n },\n ];\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,YAAY;AAkFrB,IAAM,aAAa;AAEnB,IAAM,YACJ;AAEF,eAAsB,gBACpB,KACA,OAAyB,CAAC,GACF;AACxB,QAAM,MAAM,KAAK,OAAO,QAAQ;AAChC,QAAM,OAAO,KAAK,WAAW,QAAQ;AACrC,QAAM,MAAM,KAAK,OAAO,QAAQ,IAAI;AAGpC,QAAM,UAAU,KAAK,WAAY,MAAM,mBAAmB,KAAK,MAAM,GAAG;AAExE,QAAM,SAAS,MAAM;AAAA,IACnB,EAAE,KAAK,SAAS,IAAI,QAAQ;AAAA,IAC5B,KAAK,YAAY,SAAY,EAAE,SAAS,KAAK,QAAQ,IAAI,CAAC;AAAA,EAC5D,EAAE,MAAM,CAAC,QAAkB,eAAe,QAAQ,MAAM,IAAI,MAAM,OAAO,GAAG,CAAC,CAAE;AAC/E,QAAM,WAAW,MAAM,uBAAuB,GAAG;AACjD,QAAM,SAAS,MAAM,eAAe,KAAK,KAAK,KAAK,cAAc,gBAAgB;AACjF,QAAM,QAAqB,UAAU,UAAU;AAC/C,QAAM,QAAQ,qBAAqB,SAAS,KAAK,MAAM,GAAG;AAC1D,QAAM,SAAS,MAAM,qBAAqB,MAAM,cAAc,MAAM,OAAO;AAE3E,QAAM,SAAwB,CAAC,UAAU,KAAK,eAAe,QAAQ,OAAO,CAAC;AAC7E,SAAO,KAAK,gBAAgB,MAAM,CAAC;AACnC,QAAM,SAAS,MAAM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