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
|
@@ -0,0 +1,1312 @@
|
|
|
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-4USCZ2NI.js";
|
|
7
|
+
import {
|
|
8
|
+
canPayRouting,
|
|
9
|
+
canSign,
|
|
10
|
+
isDefiniteBlock,
|
|
11
|
+
signFromVerification
|
|
12
|
+
} from "./chunk-62KNUYWD.js";
|
|
13
|
+
import {
|
|
14
|
+
liveObservations,
|
|
15
|
+
readObservations,
|
|
16
|
+
servedObservations
|
|
17
|
+
} from "./chunk-WYXUQGOL.js";
|
|
18
|
+
import {
|
|
19
|
+
channelCredit
|
|
20
|
+
} from "./chunk-D3ZURCG7.js";
|
|
21
|
+
import "./chunk-QF3LSMGS.js";
|
|
22
|
+
import "./chunk-445VQTVM.js";
|
|
23
|
+
import {
|
|
24
|
+
createLocalProvider,
|
|
25
|
+
describeWallet,
|
|
26
|
+
walletFileExists
|
|
27
|
+
} from "./chunk-BI673VEJ.js";
|
|
28
|
+
import "./chunk-V2LQLN5H.js";
|
|
29
|
+
import {
|
|
30
|
+
readSpendSummary,
|
|
31
|
+
spentOf
|
|
32
|
+
} from "./chunk-SO3XRZPX.js";
|
|
33
|
+
import {
|
|
34
|
+
NEW_SESSION_STEP,
|
|
35
|
+
folderState,
|
|
36
|
+
inspectLegacyInstall,
|
|
37
|
+
pluginProof,
|
|
38
|
+
probeRouter,
|
|
39
|
+
projectInstallHere,
|
|
40
|
+
readPluginListing,
|
|
41
|
+
settingsInstallPaths
|
|
42
|
+
} from "./chunk-VOZA6O7K.js";
|
|
43
|
+
import "./chunk-I5TDIUKM.js";
|
|
44
|
+
import "./chunk-KOGZDMHO.js";
|
|
45
|
+
import "./chunk-PKHI276N.js";
|
|
46
|
+
import {
|
|
47
|
+
RECONNECT_FIX,
|
|
48
|
+
mcpServersState,
|
|
49
|
+
readProcessSnapshot
|
|
50
|
+
} from "./chunk-B7EM4GGF.js";
|
|
51
|
+
import "./chunk-AD226HDR.js";
|
|
52
|
+
import "./chunk-4LMUQMBH.js";
|
|
53
|
+
import "./chunk-3623BLPV.js";
|
|
54
|
+
import "./chunk-XKESD27X.js";
|
|
55
|
+
import "./chunk-VJUVFZ2D.js";
|
|
56
|
+
import {
|
|
57
|
+
CHANNEL_DEPOSIT_ATOMIC,
|
|
58
|
+
ROUTING_FEE_ATOMIC,
|
|
59
|
+
SUGGESTED_FUND_USD,
|
|
60
|
+
feeRefusal,
|
|
61
|
+
refusedWhy,
|
|
62
|
+
unpaid,
|
|
63
|
+
usd
|
|
64
|
+
} from "./chunk-HDPUXS3Z.js";
|
|
65
|
+
import {
|
|
66
|
+
evaluateSpendPolicy
|
|
67
|
+
} from "./chunk-2SNUOHAT.js";
|
|
68
|
+
import "./chunk-E7SW44LM.js";
|
|
69
|
+
import "./chunk-F3ED5WTR.js";
|
|
70
|
+
import "./chunk-DOQGNFHM.js";
|
|
71
|
+
import "./chunk-TAW4UFFF.js";
|
|
72
|
+
import {
|
|
73
|
+
LAUNCHER_MARKER,
|
|
74
|
+
PLUGIN_DIR,
|
|
75
|
+
RUNTIME_MISSING_FIX
|
|
76
|
+
} from "./chunk-E7LGOMH6.js";
|
|
77
|
+
import "./chunk-MEFB5KHA.js";
|
|
78
|
+
import "./chunk-UUGOUOVT.js";
|
|
79
|
+
import {
|
|
80
|
+
MARKETPLACE_NAME,
|
|
81
|
+
MCP_SERVER_NAME,
|
|
82
|
+
PLUGIN_ID,
|
|
83
|
+
PLUGIN_SERVER,
|
|
84
|
+
REQUEST_TOOL
|
|
85
|
+
} from "./chunk-MPZUYCAP.js";
|
|
86
|
+
import "./chunk-3FMZGI7I.js";
|
|
87
|
+
import "./chunk-OTWLERSW.js";
|
|
88
|
+
import {
|
|
89
|
+
describeStoreLocation
|
|
90
|
+
} from "./chunk-CEXSOI5R.js";
|
|
91
|
+
import {
|
|
92
|
+
CLAUDE_CODE_FLOOR,
|
|
93
|
+
claudeConfigDir,
|
|
94
|
+
findClaudeBinary,
|
|
95
|
+
jsonList,
|
|
96
|
+
readClaudeCode,
|
|
97
|
+
runClaude
|
|
98
|
+
} from "./chunk-QXP3Z3JN.js";
|
|
99
|
+
import "./chunk-PJNENX2A.js";
|
|
100
|
+
import "./chunk-JRGFKVAZ.js";
|
|
101
|
+
import "./chunk-2GP3HRYK.js";
|
|
102
|
+
import "./chunk-KG3D7FIF.js";
|
|
103
|
+
import "./chunk-RBJPAZFI.js";
|
|
104
|
+
import "./chunk-BPMWXTFX.js";
|
|
105
|
+
import {
|
|
106
|
+
package_default
|
|
107
|
+
} from "./chunk-YUY4SAGM.js";
|
|
108
|
+
import {
|
|
109
|
+
routerSettings
|
|
110
|
+
} from "./chunk-JEVQ5LKO.js";
|
|
111
|
+
import {
|
|
112
|
+
resolveContextSettings
|
|
113
|
+
} from "./chunk-AV5NZMYO.js";
|
|
114
|
+
import {
|
|
115
|
+
toMoney
|
|
116
|
+
} from "./chunk-Y527D4TV.js";
|
|
117
|
+
import {
|
|
118
|
+
readAliveStamp,
|
|
119
|
+
readWalletFacts
|
|
120
|
+
} from "./chunk-WOM257PW.js";
|
|
121
|
+
import {
|
|
122
|
+
NO_SESSION_CHECKED,
|
|
123
|
+
UNKNOWN_DETAIL,
|
|
124
|
+
WALLET_REASONS
|
|
125
|
+
} from "./chunk-BFDQ4WNW.js";
|
|
126
|
+
import "./chunk-3AIHRXKO.js";
|
|
127
|
+
import {
|
|
128
|
+
KEYCHAIN_LOCKED_FIX,
|
|
129
|
+
REPAIR_CLAUSE
|
|
130
|
+
} from "./chunk-X5ZBP3IY.js";
|
|
131
|
+
import {
|
|
132
|
+
hasCode
|
|
133
|
+
} from "./chunk-2I4QTOLB.js";
|
|
134
|
+
import "./chunk-2GNOFONN.js";
|
|
135
|
+
import {
|
|
136
|
+
readUsdcBalance
|
|
137
|
+
} from "./chunk-DW4YTVR3.js";
|
|
138
|
+
import "./chunk-XQJXNMSB.js";
|
|
139
|
+
import "./chunk-SNNSAGMT.js";
|
|
140
|
+
import "./chunk-7WEQQJLG.js";
|
|
141
|
+
import {
|
|
142
|
+
CliError
|
|
143
|
+
} from "./chunk-3UCIG4TG.js";
|
|
144
|
+
import {
|
|
145
|
+
autoUpdateLine
|
|
146
|
+
} from "./chunk-ADV4LDTB.js";
|
|
147
|
+
import {
|
|
148
|
+
readRuntimeState,
|
|
149
|
+
runtimeBuild
|
|
150
|
+
} from "./chunk-G75OPGAK.js";
|
|
151
|
+
import {
|
|
152
|
+
isNewer
|
|
153
|
+
} from "./chunk-EDJWHDDL.js";
|
|
154
|
+
import {
|
|
155
|
+
defaultDataDir,
|
|
156
|
+
launcherDir,
|
|
157
|
+
runtimeDir
|
|
158
|
+
} from "./chunk-OJNTCYQQ.js";
|
|
159
|
+
import "./chunk-ZXTAQYNA.js";
|
|
160
|
+
|
|
161
|
+
// src/router/doctor.ts
|
|
162
|
+
import { execFile } from "node:child_process";
|
|
163
|
+
import { readFile, realpath, stat } from "node:fs/promises";
|
|
164
|
+
import { homedir } from "node:os";
|
|
165
|
+
import { dirname, join, posix, resolve, sep, win32 } from "node:path";
|
|
166
|
+
|
|
167
|
+
// src/router/eligibility-check.ts
|
|
168
|
+
function unknownSign(reason) {
|
|
169
|
+
return { status: "unknown", reason, detail: UNKNOWN_DETAIL[reason] };
|
|
170
|
+
}
|
|
171
|
+
async function defaultReadSpent(dataDir) {
|
|
172
|
+
const ledger = await readSpendSummary(dataDir);
|
|
173
|
+
return ledger === null ? 0n : spentOf(ledger);
|
|
174
|
+
}
|
|
175
|
+
async function checkEligibility(input) {
|
|
176
|
+
let facts = null;
|
|
177
|
+
try {
|
|
178
|
+
facts = await readWalletFacts(input.dataDir, input.env);
|
|
179
|
+
return await check(input, facts);
|
|
180
|
+
} catch {
|
|
181
|
+
const failed = unknownSign("check_failed");
|
|
182
|
+
return {
|
|
183
|
+
address: facts?.address ?? null,
|
|
184
|
+
source: null,
|
|
185
|
+
canSign: failed,
|
|
186
|
+
canPayRouting: failed,
|
|
187
|
+
savedSign: null,
|
|
188
|
+
balanceAtomic: null,
|
|
189
|
+
creditAtomic: null,
|
|
190
|
+
describeError: null
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
async function check(input, facts) {
|
|
195
|
+
const { provider } = input;
|
|
196
|
+
let address = facts.address;
|
|
197
|
+
let describeError = null;
|
|
198
|
+
if (provider !== null) {
|
|
199
|
+
try {
|
|
200
|
+
address = (await describeWallet(provider)).address;
|
|
201
|
+
} catch (err) {
|
|
202
|
+
describeError = err;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
const { sign, savedSign } = await signing(input, facts, describeError);
|
|
206
|
+
const source = sign.status === "ready" ? sign.source ?? null : null;
|
|
207
|
+
const [spent, creditAtomic, balanceAtomic] = await Promise.all([
|
|
208
|
+
(input.readSpent ?? defaultReadSpent)(input.dataDir).catch(() => null),
|
|
209
|
+
address === null ? Promise.resolve(null) : (input.readCredit ?? channelCredit)(input.dataDir, address).catch(() => null),
|
|
210
|
+
address === null ? Promise.resolve(null) : (input.readBalance ?? readUsdcBalance)(address, input.rpcUrl, {
|
|
211
|
+
timeoutMs: input.timeoutMs,
|
|
212
|
+
...input.fetchImpl !== void 0 ? { fetchImpl: input.fetchImpl } : {}
|
|
213
|
+
}).catch(() => null)
|
|
214
|
+
]);
|
|
215
|
+
const deposit = evaluateSpendPolicy(input.policy, {
|
|
216
|
+
mode: "automatic",
|
|
217
|
+
amountAtomic: CHANNEL_DEPOSIT_ATOMIC,
|
|
218
|
+
creator: input.host,
|
|
219
|
+
sessionSpentAtomic: spent ?? 0n
|
|
220
|
+
});
|
|
221
|
+
const routing = canPayRouting({
|
|
222
|
+
feeRefusal: feeRefusal(input.policy, input.host),
|
|
223
|
+
sign,
|
|
224
|
+
creditAtomic,
|
|
225
|
+
depositRefusal: deposit.decision === "allow" ? null : refusedWhy(deposit.reason),
|
|
226
|
+
balanceAtomic
|
|
227
|
+
});
|
|
228
|
+
return {
|
|
229
|
+
address,
|
|
230
|
+
source,
|
|
231
|
+
...sign.status === "ready" && sign.warning !== void 0 ? { warning: sign.warning } : {},
|
|
232
|
+
canSign: sign,
|
|
233
|
+
canPayRouting: routing,
|
|
234
|
+
savedSign,
|
|
235
|
+
balanceAtomic,
|
|
236
|
+
creditAtomic,
|
|
237
|
+
describeError
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
async function signing(input, facts, describeError) {
|
|
241
|
+
const { provider } = input;
|
|
242
|
+
if (facts.envKey === "malformed") {
|
|
243
|
+
return {
|
|
244
|
+
sign: canSign({ envKey: "malformed", walletFile: facts.walletFile }),
|
|
245
|
+
savedSign: null
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
if (provider === null) {
|
|
249
|
+
return { sign: canSign({ envKey: "absent", walletFile: "absent" }), savedSign: null };
|
|
250
|
+
}
|
|
251
|
+
if (describeError !== null) return { sign: unknownSign("check_failed"), savedSign: null };
|
|
252
|
+
let savedSign = null;
|
|
253
|
+
if (facts.envPassphraseSet && facts.envKey !== "valid" && input.verifySaved !== void 0) {
|
|
254
|
+
savedSign = await input.verifySaved().then((v) => signFromVerification(v)).catch(() => unknownSign("check_failed"));
|
|
255
|
+
}
|
|
256
|
+
let full;
|
|
257
|
+
if (provider.verify === void 0) {
|
|
258
|
+
full = unknownSign("not_checked");
|
|
259
|
+
} else {
|
|
260
|
+
full = await provider.verify().then((v) => signFromVerification(v)).catch(() => unknownSign("check_failed"));
|
|
261
|
+
}
|
|
262
|
+
let sign = full;
|
|
263
|
+
if (full.status === "ready") {
|
|
264
|
+
const source = facts.envKey === "valid" ? "key-env" : savedSign?.status === "ready" ? savedSign.source : full.source;
|
|
265
|
+
sign = {
|
|
266
|
+
status: "ready",
|
|
267
|
+
...source !== void 0 ? { source } : {},
|
|
268
|
+
...full.warning !== void 0 ? { warning: full.warning } : {}
|
|
269
|
+
};
|
|
270
|
+
} else if (facts.envPassphraseSet && full.status === "blocked" && full.reason === "passphrase_missing") {
|
|
271
|
+
sign = unknownSign("not_checked");
|
|
272
|
+
}
|
|
273
|
+
return { sign, savedSign };
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// src/router/doctor.ts
|
|
277
|
+
var NODE_FLOOR = 22;
|
|
278
|
+
var moveToRuntime = (layout) => layout === "path" ? " Or run `tenjin install` to move Tenjin to its own runtime." : "";
|
|
279
|
+
function stampFix(layout) {
|
|
280
|
+
const first = "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.";
|
|
281
|
+
return layout !== "runtime" ? `${first} 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. After installing or updating Node, quit Claude Code fully, then start a new session.${moveToRuntime(layout)}` : first;
|
|
282
|
+
}
|
|
283
|
+
async function runRouterDoctor(ctx, deps = {}) {
|
|
284
|
+
const env = deps.env ?? process.env;
|
|
285
|
+
const home = deps.homeDir ?? homedir();
|
|
286
|
+
const cwd = deps.cwd ?? process.cwd();
|
|
287
|
+
const project = deps.project ?? await projectInstallHere(cwd, home, env);
|
|
288
|
+
const router = await routerSettings(
|
|
289
|
+
{ cwd, dataDir: ctx.dataDir },
|
|
290
|
+
deps.homeDir !== void 0 ? { homeDir: deps.homeDir } : {}
|
|
291
|
+
).catch((err) => err instanceof Error ? err : new Error(String(err)));
|
|
292
|
+
const settings = await resolveContextSettings(ctx);
|
|
293
|
+
const claude = await readClaudeCode(env, cwd, deps.findClaude ?? findClaudeBinary);
|
|
294
|
+
const scope = project ? "local" : "user";
|
|
295
|
+
const paths = settingsInstallPaths(project, env, home, cwd);
|
|
296
|
+
const legacy = await inspectLegacyInstall(paths.settingsPath, paths.mcpFile);
|
|
297
|
+
const [{ snapshot, installed }, observations] = await Promise.all([
|
|
298
|
+
readProcessSnapshot(deps),
|
|
299
|
+
(deps.readObservations ?? readObservations)(ctx.dataDir).catch(() => [])
|
|
300
|
+
]);
|
|
301
|
+
const live = servedObservations(
|
|
302
|
+
liveObservations(observations, snapshot?.routers ?? null, deps.isAlive)
|
|
303
|
+
);
|
|
304
|
+
const runtime = resolve(ctx.dataDir) === resolve(defaultDataDir(home));
|
|
305
|
+
const root = runtimeDir(ctx.dataDir);
|
|
306
|
+
const state = runtime ? readRuntimeState(root) : null;
|
|
307
|
+
const launch = await (deps.readLaunch ?? ((binary) => readPluginLaunch(binary, { env, home, cwd, scope })))(claude.binary).catch(() => null);
|
|
308
|
+
const unpinned = runtime ? await (deps.unpinnedPlatform ?? thisPlatformUnpinned)() : null;
|
|
309
|
+
const fromPath = launch === null ? state === null : launch.command === null ? !await pluginGone(launch, root) : launch.command === "node";
|
|
310
|
+
const layout = !fromPath ? "runtime" : runtime && unpinned === null ? "path" : "path-only";
|
|
311
|
+
const checks = [nodeCheck(deps.nodeVersion ?? process.version)];
|
|
312
|
+
checks.push(claudeCodeCheck(claude));
|
|
313
|
+
const plugin = await pluginCheck(claude, {
|
|
314
|
+
scope,
|
|
315
|
+
env,
|
|
316
|
+
home,
|
|
317
|
+
cwd,
|
|
318
|
+
dataDir: ctx.dataDir,
|
|
319
|
+
legacy,
|
|
320
|
+
installed,
|
|
321
|
+
snapshot,
|
|
322
|
+
live,
|
|
323
|
+
layout
|
|
324
|
+
});
|
|
325
|
+
checks.push(plugin.check);
|
|
326
|
+
if (plugin.registered && runtime) {
|
|
327
|
+
const onPath = state !== null ? await (deps.pathTenjin ?? (() => findPathTenjin(env)))() : null;
|
|
328
|
+
checks.push(
|
|
329
|
+
await runtimeCheck({ launch, state, root, home, env, project, onPath, unpinned, deps })
|
|
330
|
+
);
|
|
331
|
+
const old = pathTenjinCheck(onPath, home);
|
|
332
|
+
if (old !== null) checks.push(old);
|
|
333
|
+
}
|
|
334
|
+
if (plugin.registered && claude.binary !== null) {
|
|
335
|
+
checks.push(await serverCheck(claude.binary, env, cwd, layout));
|
|
336
|
+
}
|
|
337
|
+
if (legacy.present || legacy.unreadable !== void 0) {
|
|
338
|
+
checks.push(await migrationCheck(legacy, claude, ctx.dataDir, env, cwd));
|
|
339
|
+
}
|
|
340
|
+
checks.push(routingCheck(router));
|
|
341
|
+
checks.push(
|
|
342
|
+
mcpServersState(snapshot?.routers ?? null, installed, package_default.version, RECONNECT_FIX).check
|
|
343
|
+
);
|
|
344
|
+
checks.push(spendCheck(settings.policy.maxAutoSpendAtomic, settings.policy.sessionBudgetAtomic));
|
|
345
|
+
checks.push(experimentalCheck(settings.experimentalBazaar));
|
|
346
|
+
let host;
|
|
347
|
+
try {
|
|
348
|
+
host = new URL(settings.baseUrl).host;
|
|
349
|
+
} catch {
|
|
350
|
+
host = null;
|
|
351
|
+
}
|
|
352
|
+
const e = await shellEligibility(ctx, deps, env, {
|
|
353
|
+
policy: settings.policy,
|
|
354
|
+
rpcUrl: settings.rpcUrl,
|
|
355
|
+
host: host ?? ""
|
|
356
|
+
});
|
|
357
|
+
checks.push(host === null ? UNPARSED_BASE_URL_ROW : routingFeeRow(e, host));
|
|
358
|
+
checks.push(walletRow(e, ctx.dataDir));
|
|
359
|
+
checks.push(sessionRow(e, live, package_default.version));
|
|
360
|
+
const now = deps.now?.() ?? Date.now();
|
|
361
|
+
const probe = await probeRouter(settings.baseUrl, {
|
|
362
|
+
timeoutMs: ctx.flags.timeout,
|
|
363
|
+
env,
|
|
364
|
+
...deps.fetchImpl !== void 0 ? { fetchImpl: deps.fetchImpl } : {}
|
|
365
|
+
});
|
|
366
|
+
if (probe.status === "ok") {
|
|
367
|
+
await clearRouterMemo(ctx.dataDir, "unreachable", settings.baseUrl);
|
|
368
|
+
checks.push(probe);
|
|
369
|
+
} else {
|
|
370
|
+
checks.push(
|
|
371
|
+
withBackoff(
|
|
372
|
+
probe,
|
|
373
|
+
await readRouterMemo(ctx.dataDir, "unreachable", settings.baseUrl, now),
|
|
374
|
+
now
|
|
375
|
+
)
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
const agents = await subagentsCheck(cwd, home);
|
|
379
|
+
if (agents !== null) checks.push(agents);
|
|
380
|
+
const failure = checks.find((c) => c.status === "fail" && c.required);
|
|
381
|
+
const data = {
|
|
382
|
+
checks,
|
|
383
|
+
dataDir: ctx.dataDir,
|
|
384
|
+
baseUrl: settings.baseUrl,
|
|
385
|
+
scope,
|
|
386
|
+
settingsPath: paths.settingsPath,
|
|
387
|
+
session: { observed: live },
|
|
388
|
+
eligibility: {
|
|
389
|
+
canSign: e.canSign,
|
|
390
|
+
canPayRouting: e.canPayRouting,
|
|
391
|
+
savedSign: e.savedSign,
|
|
392
|
+
balanceAtomic: e.balanceAtomic?.toString() ?? null,
|
|
393
|
+
creditAtomic: e.creditAtomic?.toString() ?? null
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
if (failure !== void 0) {
|
|
397
|
+
throw new CliError("REFUSED", failure.detail, {
|
|
398
|
+
...failure.fix !== void 0 ? { fix: failure.fix } : {},
|
|
399
|
+
details: data
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
const lines = doctorLines(checks);
|
|
403
|
+
const auto = state !== null ? autoUpdateLine(root) : null;
|
|
404
|
+
if (auto !== null) lines.splice(lines.length - 1, 0, auto);
|
|
405
|
+
return { data, humanLines: lines };
|
|
406
|
+
}
|
|
407
|
+
var UNPARSED_BASE_URL_ROW = {
|
|
408
|
+
name: "routing fee",
|
|
409
|
+
status: "warn",
|
|
410
|
+
required: false,
|
|
411
|
+
detail: "not checked, because the base URL is not a URL",
|
|
412
|
+
checked: false
|
|
413
|
+
};
|
|
414
|
+
function withoutEnvPassphrase(env) {
|
|
415
|
+
const rest = { ...env };
|
|
416
|
+
delete rest.TENJIN_WALLET_PASSPHRASE;
|
|
417
|
+
return rest;
|
|
418
|
+
}
|
|
419
|
+
function walletProviderFor(ctx, env, overrides) {
|
|
420
|
+
return createLocalProvider({
|
|
421
|
+
dir: ctx.dataDir,
|
|
422
|
+
env,
|
|
423
|
+
passphrase: { ...overrides, isTTY: ctx.io.isTTY ? void 0 : false }
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
async function shellEligibility(ctx, deps, env, s) {
|
|
427
|
+
try {
|
|
428
|
+
const keySet = (env.TENJIN_WALLET_KEY ?? "").trim().length > 0;
|
|
429
|
+
const provider = keySet || await walletFileExists(ctx.dataDir) ? walletProviderFor(ctx, env, deps.walletPassphrase) : null;
|
|
430
|
+
const passphraseSet = (env.TENJIN_WALLET_PASSPHRASE ?? "").length > 0;
|
|
431
|
+
return await (deps.eligibility ?? checkEligibility)({
|
|
432
|
+
dataDir: ctx.dataDir,
|
|
433
|
+
env,
|
|
434
|
+
policy: s.policy,
|
|
435
|
+
rpcUrl: s.rpcUrl,
|
|
436
|
+
host: s.host,
|
|
437
|
+
timeoutMs: ctx.flags.timeout,
|
|
438
|
+
provider,
|
|
439
|
+
...provider !== null && passphraseSet ? {
|
|
440
|
+
verifySaved: () => walletProviderFor(ctx, withoutEnvPassphrase(env), deps.walletPassphrase).verify?.() ?? Promise.resolve(void 0)
|
|
441
|
+
} : {},
|
|
442
|
+
...deps.fetchImpl !== void 0 ? { fetchImpl: deps.fetchImpl } : {}
|
|
443
|
+
});
|
|
444
|
+
} catch {
|
|
445
|
+
const failed = {
|
|
446
|
+
status: "unknown",
|
|
447
|
+
reason: "check_failed",
|
|
448
|
+
detail: UNKNOWN_DETAIL["check_failed"]
|
|
449
|
+
};
|
|
450
|
+
return {
|
|
451
|
+
address: null,
|
|
452
|
+
source: null,
|
|
453
|
+
canSign: failed,
|
|
454
|
+
canPayRouting: failed,
|
|
455
|
+
savedSign: null,
|
|
456
|
+
balanceAtomic: null,
|
|
457
|
+
creditAtomic: null,
|
|
458
|
+
describeError: null
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
function doctorLines(checks) {
|
|
463
|
+
const act = checks.filter((c) => c.status !== "ok" && c.checked !== false).length;
|
|
464
|
+
const unchecked = checks.filter((c) => c.checked === false).length;
|
|
465
|
+
const allPass = checks.every((c) => c.status === "ok");
|
|
466
|
+
return [
|
|
467
|
+
...checks.flatMap((c) => [
|
|
468
|
+
`${c.status === "ok" ? "ok " : c.status === "warn" ? "warn" : "fail"} ${c.name}: ${c.detail}`,
|
|
469
|
+
...c.status !== "ok" && c.fix !== void 0 ? [` fix: ${c.fix}`] : []
|
|
470
|
+
]),
|
|
471
|
+
allPass ? `${checks.length} checks, all pass.` : `${checks.length} checks, ${act} to act on${unchecked > 0 ? `, ${unchecked} not checked` : ""}.`
|
|
472
|
+
];
|
|
473
|
+
}
|
|
474
|
+
function withBackoff(check2, memo, now) {
|
|
475
|
+
if (memo === null) return check2;
|
|
476
|
+
const left = Math.max(1, Math.ceil((memo.until - now) / 1e3));
|
|
477
|
+
return {
|
|
478
|
+
...check2,
|
|
479
|
+
status: check2.status === "ok" ? "warn" : check2.status,
|
|
480
|
+
detail: `${check2.detail}; routing calls skip the router for ${left}s more, after one did not reach it`
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
async function subagentsCheck(cwd, homeDir) {
|
|
484
|
+
const excluded = await agentsWithoutRequestTool({ cwd, homeDir }, REQUEST_TOOL);
|
|
485
|
+
if (excluded.length === 0) return null;
|
|
486
|
+
return {
|
|
487
|
+
name: "subagents",
|
|
488
|
+
status: "ok",
|
|
489
|
+
required: false,
|
|
490
|
+
detail: `${excluded.join(", ")} ${excluded.length === 1 ? "is" : "are"} offered no paid lookups: add ${REQUEST_TOOL} to tools: to allow paid lookups there`
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
function nodeCheck(version) {
|
|
494
|
+
const major = Number(/^v(\d+)/.exec(version)?.[1] ?? "0");
|
|
495
|
+
return major >= NODE_FLOOR ? { name: "node", status: "ok", required: true, detail: version } : {
|
|
496
|
+
name: "node",
|
|
497
|
+
status: "fail",
|
|
498
|
+
required: true,
|
|
499
|
+
detail: `${version} is below the Node ${NODE_FLOOR} floor.`,
|
|
500
|
+
fix: `Install Node ${NODE_FLOOR} or newer, then re-run \`tenjin doctor\`.`
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
function claudeCodeCheck(claude) {
|
|
504
|
+
const name = "claude code";
|
|
505
|
+
if (claude.binary === null) {
|
|
506
|
+
return {
|
|
507
|
+
name,
|
|
508
|
+
status: "warn",
|
|
509
|
+
required: false,
|
|
510
|
+
detail: "no claude binary on PATH or in CLAUDE_CODE_EXECPATH, so the plugin was checked from its folder only",
|
|
511
|
+
fix: "Run `tenjin doctor` from a Claude Code session, where CLAUDE_CODE_EXECPATH names the binary."
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
if (claude.version === null) {
|
|
515
|
+
return {
|
|
516
|
+
name,
|
|
517
|
+
status: "warn",
|
|
518
|
+
required: false,
|
|
519
|
+
detail: `${claude.binary.path} did not report a version`
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
if (!claude.meetsFloor) {
|
|
523
|
+
return {
|
|
524
|
+
name,
|
|
525
|
+
status: "fail",
|
|
526
|
+
required: true,
|
|
527
|
+
detail: `Claude Code ${claude.version} is older than ${CLAUDE_CODE_FLOOR}, which the Tenjin plugin needs`,
|
|
528
|
+
...claude.fix !== void 0 ? { fix: claude.fix } : {}
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
return {
|
|
532
|
+
name,
|
|
533
|
+
status: "ok",
|
|
534
|
+
required: true,
|
|
535
|
+
detail: `${claude.version}${claude.binary.source === "execpath" ? " (from CLAUDE_CODE_EXECPATH)" : ""}`
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
function didNotStartFix(layout) {
|
|
539
|
+
return layout !== "runtime" ? `Claude Code starts the plugin with the \`node\` on its own PATH, which must be 22 or newer: run \`node --version\` in the shell it starts from, then quit Claude Code fully and start a new session.${moveToRuntime(layout)}` : `Start a new Claude Code session; if Tenjin still does not start, run \`${RUNTIME_MISSING_FIX}\`.`;
|
|
540
|
+
}
|
|
541
|
+
function pluginStart(i) {
|
|
542
|
+
const since = (startedAt) => i.installed !== null && startedAt !== null && startedAt >= i.installed;
|
|
543
|
+
if (i.stamp !== null && !isNewer(i.version, i.stamp.version)) return "proven";
|
|
544
|
+
if (servedObservations(i.live).some((o) => o.cliVersion === i.version)) return "proven";
|
|
545
|
+
if (i.snapshot?.routers.some(
|
|
546
|
+
(r) => r.kind === "plugin" && r.underClaude !== false && since(r.startedAt)
|
|
547
|
+
) === true) {
|
|
548
|
+
return "proven";
|
|
549
|
+
}
|
|
550
|
+
if (i.snapshot === null && i.stamp === null) return "unknown";
|
|
551
|
+
if (i.snapshot?.claude.some((c) => since(c.startedAt)) === true) return "did-not-start";
|
|
552
|
+
return "pending";
|
|
553
|
+
}
|
|
554
|
+
async function sameDirAsAny(paths, dir) {
|
|
555
|
+
const real = (p) => realpath(p).catch(() => p);
|
|
556
|
+
const here = await real(dir);
|
|
557
|
+
for (const path of paths) if (await real(path) === here) return true;
|
|
558
|
+
return false;
|
|
559
|
+
}
|
|
560
|
+
async function pluginCheck(claude, c) {
|
|
561
|
+
const name = "plugin";
|
|
562
|
+
const missing = (detail) => ({
|
|
563
|
+
registered: false,
|
|
564
|
+
check: c.legacy.present ? {
|
|
565
|
+
name,
|
|
566
|
+
status: "warn",
|
|
567
|
+
required: false,
|
|
568
|
+
detail: `${detail}; the settings install of an earlier release still routes here`,
|
|
569
|
+
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.`
|
|
570
|
+
} : {
|
|
571
|
+
name,
|
|
572
|
+
status: "fail",
|
|
573
|
+
required: true,
|
|
574
|
+
detail,
|
|
575
|
+
fix: `Run \`tenjin install${c.scope === "local" ? " --project" : ""}\`.`
|
|
576
|
+
}
|
|
577
|
+
});
|
|
578
|
+
if (claude.binary !== null) {
|
|
579
|
+
const listing = await readPluginListing(claude.binary, c.env, c.cwd);
|
|
580
|
+
if (!listing.read) {
|
|
581
|
+
return {
|
|
582
|
+
registered: false,
|
|
583
|
+
check: {
|
|
584
|
+
name,
|
|
585
|
+
status: "warn",
|
|
586
|
+
required: false,
|
|
587
|
+
detail: "Claude Code's plugin list could not be read, so the plugin was not checked",
|
|
588
|
+
fix: "Run `tenjin doctor` again in a moment."
|
|
589
|
+
}
|
|
590
|
+
};
|
|
591
|
+
}
|
|
592
|
+
if (listing.id === null) return missing(`${PLUGIN_ID} is not installed in Claude Code`);
|
|
593
|
+
if (!listing.enabled) {
|
|
594
|
+
if (listing.projects.length > 0 && !await sameDirAsAny(listing.projects, c.cwd)) {
|
|
595
|
+
return {
|
|
596
|
+
registered: false,
|
|
597
|
+
check: {
|
|
598
|
+
name,
|
|
599
|
+
status: "fail",
|
|
600
|
+
required: true,
|
|
601
|
+
detail: `${listing.id} is installed for ${listing.projects.join(", ")} only, so nothing is routed from ${c.cwd}`,
|
|
602
|
+
fix: `To check that install, run \`tenjin doctor\` from ${listing.projects[0]}.`
|
|
603
|
+
}
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
return {
|
|
607
|
+
registered: false,
|
|
608
|
+
check: {
|
|
609
|
+
name,
|
|
610
|
+
status: "fail",
|
|
611
|
+
required: true,
|
|
612
|
+
detail: `${listing.id} is installed but disabled, so no lookup is routed`,
|
|
613
|
+
fix: `Run \`claude plugin enable ${listing.id} --scope ${listing.scope ?? "user"}\`, then ${NEW_SESSION_STEP}.`
|
|
614
|
+
}
|
|
615
|
+
};
|
|
616
|
+
}
|
|
617
|
+
if (listing.version !== package_default.version) {
|
|
618
|
+
return {
|
|
619
|
+
registered: true,
|
|
620
|
+
check: {
|
|
621
|
+
name,
|
|
622
|
+
status: "warn",
|
|
623
|
+
required: false,
|
|
624
|
+
detail: `${listing.id} is enabled at ${listing.version ?? "an unknown version"}, and this CLI is ${package_default.version}`,
|
|
625
|
+
fix: "Run `tenjin install --refresh` to register this version."
|
|
626
|
+
}
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
const stamp = await readAliveStamp(c.dataDir);
|
|
630
|
+
const start = pluginStart({
|
|
631
|
+
version: package_default.version,
|
|
632
|
+
stamp,
|
|
633
|
+
installed: c.installed,
|
|
634
|
+
snapshot: c.snapshot,
|
|
635
|
+
live: c.live
|
|
636
|
+
});
|
|
637
|
+
const at = `${listing.id} ${package_default.version}`;
|
|
638
|
+
const last = stamp !== null ? ` (last ${stamp.version}, at ${stamp.at})` : "";
|
|
639
|
+
return {
|
|
640
|
+
registered: true,
|
|
641
|
+
check: start === "proven" ? {
|
|
642
|
+
name,
|
|
643
|
+
status: "ok",
|
|
644
|
+
required: true,
|
|
645
|
+
detail: `${at} enabled, and a session has started it`
|
|
646
|
+
} : start === "pending" ? {
|
|
647
|
+
name,
|
|
648
|
+
status: "ok",
|
|
649
|
+
required: true,
|
|
650
|
+
detail: `${at} enabled; the next Claude Code session starts it`
|
|
651
|
+
} : start === "unknown" ? {
|
|
652
|
+
name,
|
|
653
|
+
status: "warn",
|
|
654
|
+
required: false,
|
|
655
|
+
checked: false,
|
|
656
|
+
detail: `${at} is enabled; whether a session has started it at this version could not be checked${last}`,
|
|
657
|
+
fix: stampFix(c.layout)
|
|
658
|
+
} : {
|
|
659
|
+
name,
|
|
660
|
+
status: "warn",
|
|
661
|
+
required: false,
|
|
662
|
+
detail: `${at} is enabled, and the Claude Code started since this install has not started it${last}`,
|
|
663
|
+
fix: didNotStartFix(c.layout)
|
|
664
|
+
}
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
const folder = await folderState(c.scope, c.env, c.home, c.cwd);
|
|
668
|
+
if (folder.state === "foreign") {
|
|
669
|
+
return {
|
|
670
|
+
registered: false,
|
|
671
|
+
check: {
|
|
672
|
+
name,
|
|
673
|
+
status: "fail",
|
|
674
|
+
required: true,
|
|
675
|
+
detail: `${folder.path} is there and is not a folder this CLI wrote, so the plugin cannot be written`,
|
|
676
|
+
fix: `Move ${folder.path} aside, then run \`tenjin install\` again.`
|
|
677
|
+
}
|
|
678
|
+
};
|
|
679
|
+
}
|
|
680
|
+
if (folder.state === "ours") {
|
|
681
|
+
const stamp = await readAliveStamp(c.dataDir);
|
|
682
|
+
const start = pluginStart({
|
|
683
|
+
version: package_default.version,
|
|
684
|
+
stamp,
|
|
685
|
+
installed: c.installed,
|
|
686
|
+
snapshot: c.snapshot,
|
|
687
|
+
live: c.live
|
|
688
|
+
});
|
|
689
|
+
return {
|
|
690
|
+
registered: true,
|
|
691
|
+
check: start === "proven" ? {
|
|
692
|
+
name,
|
|
693
|
+
status: "ok",
|
|
694
|
+
required: true,
|
|
695
|
+
detail: stamp !== null ? `the plugin folder at ${folder.path} loaded, last at ${stamp.at}` : `the plugin folder at ${folder.path} is loaded, and a session has started it`
|
|
696
|
+
} : start === "pending" ? {
|
|
697
|
+
name,
|
|
698
|
+
status: "ok",
|
|
699
|
+
required: true,
|
|
700
|
+
detail: `the plugin folder is at ${folder.path}; the next Claude Code session starts it`
|
|
701
|
+
} : start === "unknown" ? {
|
|
702
|
+
name,
|
|
703
|
+
status: "warn",
|
|
704
|
+
required: false,
|
|
705
|
+
checked: false,
|
|
706
|
+
detail: `the plugin folder is at ${folder.path}; whether a session has loaded it could not be checked`,
|
|
707
|
+
fix: `To load it, ${NEW_SESSION_STEP}.`
|
|
708
|
+
} : {
|
|
709
|
+
name,
|
|
710
|
+
status: "warn",
|
|
711
|
+
required: false,
|
|
712
|
+
detail: `the plugin folder is at ${folder.path}, and the Claude Code started since this install has not loaded it`,
|
|
713
|
+
fix: didNotStartFix(c.layout)
|
|
714
|
+
}
|
|
715
|
+
};
|
|
716
|
+
}
|
|
717
|
+
if (await listedInClaudeFiles(c.env, c.home)) {
|
|
718
|
+
return {
|
|
719
|
+
registered: true,
|
|
720
|
+
check: {
|
|
721
|
+
name,
|
|
722
|
+
status: "warn",
|
|
723
|
+
required: false,
|
|
724
|
+
detail: `${PLUGIN_ID} is registered, and there is no claude binary here to check it`,
|
|
725
|
+
fix: "Run `tenjin doctor` from a Claude Code session to check it."
|
|
726
|
+
}
|
|
727
|
+
};
|
|
728
|
+
}
|
|
729
|
+
return missing(`${PLUGIN_ID} is not registered`);
|
|
730
|
+
}
|
|
731
|
+
async function listedInClaudeFiles(env, home) {
|
|
732
|
+
try {
|
|
733
|
+
const raw = await readFile(
|
|
734
|
+
join(claudeConfigDir(env, home), "plugins", "installed_plugins.json"),
|
|
735
|
+
"utf8"
|
|
736
|
+
);
|
|
737
|
+
const plugins = JSON.parse(raw).plugins;
|
|
738
|
+
return plugins !== null && typeof plugins === "object" && PLUGIN_ID in plugins;
|
|
739
|
+
} catch {
|
|
740
|
+
return false;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
async function serverCheck(binary, env, cwd, layout) {
|
|
744
|
+
const name = "router server";
|
|
745
|
+
const run = await runClaude(binary, ["mcp", "get", PLUGIN_SERVER], {
|
|
746
|
+
env,
|
|
747
|
+
cwd,
|
|
748
|
+
timeoutMs: 45e3
|
|
749
|
+
});
|
|
750
|
+
const status = /Status:\s*(.+)/.exec(run.stdout)?.[1]?.trim();
|
|
751
|
+
if (run.code === 0 && status !== void 0 && /connected/i.test(status) && !/fail/i.test(status)) {
|
|
752
|
+
return { name, status: "ok", required: true, detail: `${PLUGIN_SERVER} connected` };
|
|
753
|
+
}
|
|
754
|
+
return {
|
|
755
|
+
name,
|
|
756
|
+
status: "fail",
|
|
757
|
+
required: true,
|
|
758
|
+
detail: `${PLUGIN_SERVER} did not connect${status !== void 0 ? `: ${status.slice(0, 200)}` : ""}`,
|
|
759
|
+
fix: layout !== "runtime" ? `Quit Claude Code fully (from the tray, or sign out and in), then start a new session: 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.${moveToRuntime(layout)}` : didNotStartFix(layout)
|
|
760
|
+
};
|
|
761
|
+
}
|
|
762
|
+
async function readPluginLaunch(binary, c) {
|
|
763
|
+
let found = null;
|
|
764
|
+
if (binary !== null) {
|
|
765
|
+
const out = await runClaude(binary, ["plugin", "marketplace", "list", "--json"], {
|
|
766
|
+
env: c.env,
|
|
767
|
+
cwd: c.cwd
|
|
768
|
+
});
|
|
769
|
+
const row = (out.code === 0 ? jsonList(out.stdout) : null)?.find(
|
|
770
|
+
(m) => m.name === MARKETPLACE_NAME
|
|
771
|
+
);
|
|
772
|
+
if (typeof row?.path === "string") {
|
|
773
|
+
found = { path: row.path, source: "marketplace", plugin: join(row.path, PLUGIN_DIR) };
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
if (found === null) {
|
|
777
|
+
const folder = await folderState(c.scope, c.env, c.home, c.cwd);
|
|
778
|
+
if (folder.state === "ours")
|
|
779
|
+
found = { path: folder.path, source: "folder", plugin: folder.path };
|
|
780
|
+
}
|
|
781
|
+
if (found === null) return null;
|
|
782
|
+
let missing = false;
|
|
783
|
+
const mcp = await readFile(join(found.plugin, ".mcp.json"), "utf8").then((text) => JSON.parse(text)).catch((err) => {
|
|
784
|
+
missing = hasCode(err, "ENOENT") || hasCode(err, "ENOTDIR");
|
|
785
|
+
return null;
|
|
786
|
+
});
|
|
787
|
+
const none = {
|
|
788
|
+
path: found.path,
|
|
789
|
+
source: found.source,
|
|
790
|
+
command: null,
|
|
791
|
+
entry: null,
|
|
792
|
+
...missing ? { missing: true } : {}
|
|
793
|
+
};
|
|
794
|
+
const server = mcp?.mcpServers?.[MCP_SERVER_NAME];
|
|
795
|
+
if (typeof server?.command !== "string") return none;
|
|
796
|
+
const first = Array.isArray(server.args) ? server.args[0] : void 0;
|
|
797
|
+
const entry = typeof first === "string" ? resolve(first.split("${CLAUDE_PLUGIN_ROOT}").join(found.plugin)) : null;
|
|
798
|
+
return { path: found.path, source: found.source, command: server.command, entry };
|
|
799
|
+
}
|
|
800
|
+
function runVersion(command, entry) {
|
|
801
|
+
return new Promise((done) => {
|
|
802
|
+
execFile(
|
|
803
|
+
command,
|
|
804
|
+
[entry, "--version"],
|
|
805
|
+
{ shell: false, timeout: 15e3, windowsHide: true },
|
|
806
|
+
(err, stdout, stderr) => {
|
|
807
|
+
const failure = err;
|
|
808
|
+
done({
|
|
809
|
+
code: failure === null ? 0 : typeof failure.code === "number" ? failure.code : null,
|
|
810
|
+
stdout: String(stdout),
|
|
811
|
+
stderr: String(stderr),
|
|
812
|
+
timedOut: failure?.killed === true
|
|
813
|
+
});
|
|
814
|
+
}
|
|
815
|
+
);
|
|
816
|
+
});
|
|
817
|
+
}
|
|
818
|
+
async function thisPlatformUnpinned() {
|
|
819
|
+
const { runningGlibc, unpinnedPlatform } = await import("./runtime-fetch-EKFRNR6Z.js");
|
|
820
|
+
const platform = process.platform;
|
|
821
|
+
return unpinnedPlatform(platform, process.arch, platform === "linux" ? runningGlibc() : null);
|
|
822
|
+
}
|
|
823
|
+
async function inRuntimeFolder(launch, root) {
|
|
824
|
+
return launch.source === "marketplace" && samePath(launch.path, join(root, "claude"));
|
|
825
|
+
}
|
|
826
|
+
async function pluginGone(launch, root) {
|
|
827
|
+
return launch.command === null && (launch.missing === true || await inRuntimeFolder(launch, root));
|
|
828
|
+
}
|
|
829
|
+
var exists = async (path) => await stat(path).catch(() => null) !== null;
|
|
830
|
+
var samePath = async (a, b) => await realpath(a).catch(() => resolve(a)) === await realpath(b).catch(() => resolve(b));
|
|
831
|
+
function tilde(path, home) {
|
|
832
|
+
return path === home || path.startsWith(`${home}${sep}`) ? `~${path.slice(home.length)}` : path;
|
|
833
|
+
}
|
|
834
|
+
async function runtimeCheck(i) {
|
|
835
|
+
const name = "runtime";
|
|
836
|
+
const flag = i.project ? " --project" : "";
|
|
837
|
+
const t = (p) => tilde(p, i.home);
|
|
838
|
+
const failFix = `Run \`${RUNTIME_MISSING_FIX}${flag}\`, then start a new Claude Code session.`;
|
|
839
|
+
const { launch } = i;
|
|
840
|
+
const unread = {
|
|
841
|
+
name,
|
|
842
|
+
status: "warn",
|
|
843
|
+
required: false,
|
|
844
|
+
checked: false,
|
|
845
|
+
detail: "where Claude Code starts Tenjin from could not be read from the plugin's .mcp.json"
|
|
846
|
+
};
|
|
847
|
+
if (launch === null) return unread;
|
|
848
|
+
if (await pluginGone(launch, i.root)) {
|
|
849
|
+
return {
|
|
850
|
+
name,
|
|
851
|
+
status: "fail",
|
|
852
|
+
required: true,
|
|
853
|
+
detail: `Claude Code loads Tenjin from ${t(launch.path)}, which no longer holds its plugin, so the router cannot start`,
|
|
854
|
+
fix: failFix
|
|
855
|
+
};
|
|
856
|
+
}
|
|
857
|
+
if (i.state !== null && launch.source === "marketplace" && !await samePath(launch.path, join(i.root, "claude"))) {
|
|
858
|
+
return {
|
|
859
|
+
name,
|
|
860
|
+
status: "warn",
|
|
861
|
+
required: false,
|
|
862
|
+
detail: `Claude Code loads Tenjin from ${t(launch.path)}, not Tenjin's runtime: an older tenjin-cli build registered it there`,
|
|
863
|
+
fix: `Run \`tenjin install${flag}\`, then start a new Claude Code session.`
|
|
864
|
+
};
|
|
865
|
+
}
|
|
866
|
+
if (launch.command === null) return unread;
|
|
867
|
+
if (launch.command === "node" && i.unpinned !== null) {
|
|
868
|
+
const from2 = launch.entry !== null ? ` at ${t(dirname(launch.entry))}` : "";
|
|
869
|
+
return {
|
|
870
|
+
name,
|
|
871
|
+
status: "warn",
|
|
872
|
+
required: false,
|
|
873
|
+
detail: `Tenjin pins no Node for this platform (${i.unpinned}), so it keeps running from npm's copy${from2} on the \`node\` on Claude Code's PATH, by design`,
|
|
874
|
+
fix: `Nothing to move. Keep Node 22 or newer on the PATH Claude Code starts with; after changing Node versions, reinstall with that Node's \`npm i -g tenjin-cli\`, then run \`tenjin install${flag}\`.`
|
|
875
|
+
};
|
|
876
|
+
}
|
|
877
|
+
if (launch.command === "node") {
|
|
878
|
+
const from2 = launch.entry !== null ? `, from ${t(dirname(launch.entry))}` : "";
|
|
879
|
+
return {
|
|
880
|
+
name,
|
|
881
|
+
status: "warn",
|
|
882
|
+
required: false,
|
|
883
|
+
detail: `Claude Code starts Tenjin with the \`node\` on its PATH${from2}, so a Node upgrade or \`npm rm -g tenjin-cli\` stops it`,
|
|
884
|
+
fix: `Run \`tenjin install${flag}\` to move it to Tenjin's own runtime.`
|
|
885
|
+
};
|
|
886
|
+
}
|
|
887
|
+
const missing = [launch.command, ...launch.entry !== null ? [launch.entry] : []];
|
|
888
|
+
const gone = [];
|
|
889
|
+
for (const p of missing) if (!await exists(p)) gone.push(t(p));
|
|
890
|
+
if (launch.entry === null || gone.length > 0) {
|
|
891
|
+
return {
|
|
892
|
+
name,
|
|
893
|
+
status: "fail",
|
|
894
|
+
required: true,
|
|
895
|
+
detail: launch.entry === null ? `Claude Code starts Tenjin with ${t(launch.command)} and no entry script, so the router cannot start` : `Claude Code starts Tenjin with ${gone.join(" and ")}, which ${gone.length === 1 ? "is" : "are"} not there, so the router cannot start`,
|
|
896
|
+
fix: failFix
|
|
897
|
+
};
|
|
898
|
+
}
|
|
899
|
+
const shown = `${t(launch.command)} ${t(launch.entry)} --version`;
|
|
900
|
+
const run = await (i.deps.runVersion ?? runVersion)(launch.command, launch.entry);
|
|
901
|
+
if (run.timedOut) {
|
|
902
|
+
return {
|
|
903
|
+
name,
|
|
904
|
+
status: "warn",
|
|
905
|
+
required: false,
|
|
906
|
+
checked: false,
|
|
907
|
+
detail: `\`${shown}\` did not answer within 15 s`
|
|
908
|
+
};
|
|
909
|
+
}
|
|
910
|
+
if (run.code !== 0) {
|
|
911
|
+
const said = (run.stderr || run.stdout).trim().slice(0, 200);
|
|
912
|
+
return {
|
|
913
|
+
name,
|
|
914
|
+
status: "fail",
|
|
915
|
+
required: true,
|
|
916
|
+
detail: `\`${shown}\` exited ${run.code ?? "without a code"}${said.length > 0 ? `: ${said}` : ""}, so the router cannot start`,
|
|
917
|
+
fix: failFix
|
|
918
|
+
};
|
|
919
|
+
}
|
|
920
|
+
const nodeVersion = /[\\/]node[\\/](\d+\.\d+\.\d+)[\\/]/.exec(launch.command)?.[1] ?? i.state?.current.node ?? "unknown";
|
|
921
|
+
const from = runtimeBuild(dirname(launch.entry))?.root ?? i.root;
|
|
922
|
+
const detail = `Claude Code starts tenjin ${run.stdout.trim()} on Node ${nodeVersion} from ${t(from)}`;
|
|
923
|
+
const platform = process.platform;
|
|
924
|
+
const launcher = join(launcherDir(i.home), platform === "win32" ? "tenjin.cmd" : "tenjin");
|
|
925
|
+
if (!await exists(launcher)) {
|
|
926
|
+
return {
|
|
927
|
+
name,
|
|
928
|
+
status: "warn",
|
|
929
|
+
required: false,
|
|
930
|
+
detail: `${detail}; ${t(launcher)} is missing, so a terminal does not find Tenjin's \`tenjin\``,
|
|
931
|
+
fix: `Run \`tenjin install${flag}\` to write it.`
|
|
932
|
+
};
|
|
933
|
+
}
|
|
934
|
+
if (i.onPath === null && !launcherOnPath(launcherDir(i.home), i.env, platform)) {
|
|
935
|
+
const { pathLine } = await import("./runtime-UVNUA3AS.js");
|
|
936
|
+
return {
|
|
937
|
+
name,
|
|
938
|
+
status: "warn",
|
|
939
|
+
required: false,
|
|
940
|
+
detail: `${detail}; ${t(launcherDir(i.home))} is not on your PATH, so a terminal does not find \`tenjin\` there`,
|
|
941
|
+
fix: pathLine(i.env, i.home, platform)
|
|
942
|
+
};
|
|
943
|
+
}
|
|
944
|
+
return {
|
|
945
|
+
name,
|
|
946
|
+
status: "ok",
|
|
947
|
+
required: true,
|
|
948
|
+
detail: `${detail}; tenjin on PATH: ${t(i.onPath?.path ?? launcher)}`
|
|
949
|
+
};
|
|
950
|
+
}
|
|
951
|
+
function launcherOnPath(dir, env, platform) {
|
|
952
|
+
const p = platform === "win32" ? win32 : posix;
|
|
953
|
+
const norm = (value) => {
|
|
954
|
+
const full = p.resolve(value).replace(/[\\/]+$/, "");
|
|
955
|
+
return platform === "win32" ? full.toLowerCase() : full;
|
|
956
|
+
};
|
|
957
|
+
const raw = (platform === "win32" ? env.Path ?? env.PATH : env.PATH) ?? "";
|
|
958
|
+
return raw.split(p.delimiter).filter((entry) => entry.length > 0).some((entry) => norm(entry) === norm(dir));
|
|
959
|
+
}
|
|
960
|
+
async function findPathTenjin(env, platform = process.platform) {
|
|
961
|
+
const raw = (platform === "win32" ? env.Path ?? env.PATH : env.PATH) ?? "";
|
|
962
|
+
const delimiter = platform === "win32" ? win32.delimiter : posix.delimiter;
|
|
963
|
+
const name = platform === "win32" ? "tenjin.cmd" : "tenjin";
|
|
964
|
+
for (const dir of raw.split(delimiter).filter((d) => d.length > 0)) {
|
|
965
|
+
const path = join(dir, name);
|
|
966
|
+
if ((await stat(path).catch(() => null))?.isFile() !== true) continue;
|
|
967
|
+
const body = await readFile(path, "utf8").catch(() => "");
|
|
968
|
+
if (body.includes(LAUNCHER_MARKER))
|
|
969
|
+
return { path, marked: true, version: null, handsOff: true };
|
|
970
|
+
let root;
|
|
971
|
+
if (platform === "win32") root = join(dir, "node_modules", "tenjin-cli");
|
|
972
|
+
else {
|
|
973
|
+
const { packageRootOf } = await import("./runtime-UVNUA3AS.js");
|
|
974
|
+
root = packageRootOf(dirname(await realpath(path).catch(() => path)));
|
|
975
|
+
}
|
|
976
|
+
const unknown = { path, marked: false, version: null, handsOff: false, unknown: true };
|
|
977
|
+
if (root === null) return unknown;
|
|
978
|
+
const manifest = await readFile(join(root, "package.json"), "utf8").then((t) => JSON.parse(t)).catch(() => null);
|
|
979
|
+
if (manifest?.name !== "tenjin-cli") return unknown;
|
|
980
|
+
return {
|
|
981
|
+
path,
|
|
982
|
+
marked: false,
|
|
983
|
+
version: typeof manifest.version === "string" ? manifest.version : null,
|
|
984
|
+
handsOff: manifest.tenjinRuntime !== void 0
|
|
985
|
+
};
|
|
986
|
+
}
|
|
987
|
+
return null;
|
|
988
|
+
}
|
|
989
|
+
function pathTenjinCheck(found, home) {
|
|
990
|
+
if (found === null || found.marked || found.handsOff || found.unknown === true) return null;
|
|
991
|
+
return {
|
|
992
|
+
name: "tenjin on PATH",
|
|
993
|
+
status: "warn",
|
|
994
|
+
required: false,
|
|
995
|
+
detail: `\`tenjin\` in a terminal runs tenjin-cli ${found.version ?? "(unknown version)"} at ${tilde(found.path, home)}, an older build that does not hand off to Tenjin's runtime`,
|
|
996
|
+
fix: "Remove it with `npm uninstall -g tenjin-cli` using the Node that installed it, or upgrade it with `npm i -g tenjin-cli@latest`."
|
|
997
|
+
};
|
|
998
|
+
}
|
|
999
|
+
async function migrationCheck(legacy, claude, dataDir, env, cwd) {
|
|
1000
|
+
const name = "settings install";
|
|
1001
|
+
if (legacy.unreadable !== void 0) {
|
|
1002
|
+
return { name, status: "warn", required: false, detail: legacy.unreadable };
|
|
1003
|
+
}
|
|
1004
|
+
const parts = [
|
|
1005
|
+
...legacy.events.length > 0 ? [`hook entries (${legacy.events.join(", ")})`] : [],
|
|
1006
|
+
...legacy.allowRule || legacy.denyRule ? ["permission rules"] : [],
|
|
1007
|
+
...legacy.statusLine === "ours" || legacy.statusLine === "composed" ? ["a status line"] : [],
|
|
1008
|
+
...legacy.mcp === "ok" ? ["the x402 MCP server"] : []
|
|
1009
|
+
];
|
|
1010
|
+
const found = `${parts.join(", ")} from an earlier release in ${legacy.settingsPath}`;
|
|
1011
|
+
const lookalikes = legacy.lookalikes.length > 0 ? `; not Tenjin's and left alone: ${legacy.lookalikes.join(", ")}` : "";
|
|
1012
|
+
const proof = await pluginProof(claude, dataDir, env, cwd);
|
|
1013
|
+
return proof.proven ? {
|
|
1014
|
+
name,
|
|
1015
|
+
status: "warn",
|
|
1016
|
+
required: false,
|
|
1017
|
+
detail: `${found}, ready to remove: the plugin has loaded here${lookalikes}`,
|
|
1018
|
+
fix: "Run `tenjin install --refresh` to remove it."
|
|
1019
|
+
} : {
|
|
1020
|
+
name,
|
|
1021
|
+
status: "warn",
|
|
1022
|
+
required: false,
|
|
1023
|
+
detail: `${found}, kept until the plugin loads: ${proof.reason}${lookalikes}`,
|
|
1024
|
+
fix: claude.meetsFloor ? `To load the plugin, ${NEW_SESSION_STEP}; 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."
|
|
1025
|
+
};
|
|
1026
|
+
}
|
|
1027
|
+
function routingCheck(router) {
|
|
1028
|
+
const name = "routing";
|
|
1029
|
+
if (router instanceof Error) {
|
|
1030
|
+
return {
|
|
1031
|
+
name,
|
|
1032
|
+
status: "warn",
|
|
1033
|
+
required: false,
|
|
1034
|
+
detail: `the router is off here: ${router.message}`,
|
|
1035
|
+
fix: "Fix or delete that file."
|
|
1036
|
+
};
|
|
1037
|
+
}
|
|
1038
|
+
if (!router.enabled.value) {
|
|
1039
|
+
const file = router.enabled.path ?? "the config";
|
|
1040
|
+
return {
|
|
1041
|
+
name,
|
|
1042
|
+
status: "warn",
|
|
1043
|
+
required: false,
|
|
1044
|
+
detail: `router.enabled is false in ${file}, so nothing is routed from this directory`,
|
|
1045
|
+
fix: router.enabled.source === "file" ? "Run `tenjin config set router.enabled true` to route again." : `Remove router.enabled from ${file} to route here again.`
|
|
1046
|
+
};
|
|
1047
|
+
}
|
|
1048
|
+
return { name, status: "ok", required: false, detail: "on" };
|
|
1049
|
+
}
|
|
1050
|
+
var UNLOCK_WHY = /* @__PURE__ */ new Set([
|
|
1051
|
+
"wallet_corrupt",
|
|
1052
|
+
"env_key_invalid",
|
|
1053
|
+
"passphrase_missing",
|
|
1054
|
+
"passphrase_wrong",
|
|
1055
|
+
"env_passphrase_wrong",
|
|
1056
|
+
"keychain_locked",
|
|
1057
|
+
"wallet_locked"
|
|
1058
|
+
]);
|
|
1059
|
+
function routingFeeRow(e, host) {
|
|
1060
|
+
const name = "routing fee";
|
|
1061
|
+
const v = e.canPayRouting;
|
|
1062
|
+
if (v.status === "unknown") {
|
|
1063
|
+
return {
|
|
1064
|
+
name,
|
|
1065
|
+
status: "warn",
|
|
1066
|
+
required: false,
|
|
1067
|
+
checked: false,
|
|
1068
|
+
detail: `could not check: ${v.detail}`
|
|
1069
|
+
};
|
|
1070
|
+
}
|
|
1071
|
+
if (v.status === "ready") {
|
|
1072
|
+
return {
|
|
1073
|
+
name,
|
|
1074
|
+
status: "ok",
|
|
1075
|
+
required: false,
|
|
1076
|
+
detail: `$${usd(ROUTING_FEE_ATOMIC)} a call, paid from channel deposits of up to $${usd(CHANNEL_DEPOSIT_ATOMIC)} that count against the spend limits`
|
|
1077
|
+
};
|
|
1078
|
+
}
|
|
1079
|
+
const why = v.reason;
|
|
1080
|
+
if (UNLOCK_WHY.has(why)) {
|
|
1081
|
+
return {
|
|
1082
|
+
name,
|
|
1083
|
+
status: "warn",
|
|
1084
|
+
required: false,
|
|
1085
|
+
detail: `${WALLET_REASONS[why].reason}, so Tenjin is not routing calls`,
|
|
1086
|
+
fix: v.fix
|
|
1087
|
+
};
|
|
1088
|
+
}
|
|
1089
|
+
const u = unpaid(why);
|
|
1090
|
+
const fixes = {
|
|
1091
|
+
no_wallet: `Run \`tenjin wallet create\`, then \`tenjin wallet fund ${SUGGESTED_FUND_USD}\`.`,
|
|
1092
|
+
limit_below_deposit: `Raise it with \`tenjin config set maxAutoSpend ${usd(CHANNEL_DEPOSIT_ATOMIC)}\`.`,
|
|
1093
|
+
budget_reached: "Room comes back as the rolling day passes, or raise it with `tenjin config set sessionBudget <usd>`.",
|
|
1094
|
+
not_allowlisted: `Add ${host} to allowlistCreators, or clear the allowlist.`
|
|
1095
|
+
};
|
|
1096
|
+
return {
|
|
1097
|
+
name,
|
|
1098
|
+
status: "warn",
|
|
1099
|
+
required: false,
|
|
1100
|
+
detail: `${u?.reason ?? v.detail}, so Tenjin is not routing calls`,
|
|
1101
|
+
fix: fixes[why] ?? u?.fix ?? v.fix
|
|
1102
|
+
};
|
|
1103
|
+
}
|
|
1104
|
+
function experimentalCheck(bazaar) {
|
|
1105
|
+
return {
|
|
1106
|
+
name: "experimental",
|
|
1107
|
+
status: "ok",
|
|
1108
|
+
required: false,
|
|
1109
|
+
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"
|
|
1110
|
+
};
|
|
1111
|
+
}
|
|
1112
|
+
function spendCheck(maxAutoSpendAtomic, sessionBudgetAtomic) {
|
|
1113
|
+
if (sessionBudgetAtomic === 0n) {
|
|
1114
|
+
return {
|
|
1115
|
+
name: "spend",
|
|
1116
|
+
status: "fail",
|
|
1117
|
+
required: true,
|
|
1118
|
+
detail: "The daily limit is 0, so positive payments are refused even with --yes.",
|
|
1119
|
+
fix: "Choose a daily limit with `tenjin config set sessionBudget <usd|none>`."
|
|
1120
|
+
};
|
|
1121
|
+
}
|
|
1122
|
+
if (maxAutoSpendAtomic === 0n) {
|
|
1123
|
+
return {
|
|
1124
|
+
name: "spend",
|
|
1125
|
+
status: "fail",
|
|
1126
|
+
required: true,
|
|
1127
|
+
detail: "maxAutoSpend is 0, so every lookup needs approval and none can pay",
|
|
1128
|
+
fix: `Raise it with \`tenjin config set maxAutoSpend ${usd(CHANNEL_DEPOSIT_ATOMIC)}\`.`
|
|
1129
|
+
};
|
|
1130
|
+
}
|
|
1131
|
+
const budget = sessionBudgetAtomic === null ? "no daily ceiling" : `${toMoney(sessionBudgetAtomic.toString()).usd} USD a day`;
|
|
1132
|
+
return {
|
|
1133
|
+
name: "spend",
|
|
1134
|
+
status: sessionBudgetAtomic === null ? "warn" : "ok",
|
|
1135
|
+
required: false,
|
|
1136
|
+
detail: `automatic approval up to ${toMoney(maxAutoSpendAtomic.toString()).usd} USD a call, ${budget}`,
|
|
1137
|
+
...sessionBudgetAtomic === null ? { fix: "Set one with `tenjin config set sessionBudget 1.00`." } : {}
|
|
1138
|
+
};
|
|
1139
|
+
}
|
|
1140
|
+
function signedFrom(source, address, dataDir) {
|
|
1141
|
+
switch (source) {
|
|
1142
|
+
case "keychain":
|
|
1143
|
+
return "macOS keychain";
|
|
1144
|
+
case "secret-service":
|
|
1145
|
+
return "Linux keyring";
|
|
1146
|
+
case "dpapi":
|
|
1147
|
+
return "DPAPI file";
|
|
1148
|
+
case "file":
|
|
1149
|
+
return `passphrase file ${describeStoreLocation("file", address.toLowerCase(), dataDir)}`;
|
|
1150
|
+
case "key-env":
|
|
1151
|
+
return "TENJIN_WALLET_KEY in this shell";
|
|
1152
|
+
case "passphrase-env":
|
|
1153
|
+
return "TENJIN_WALLET_PASSPHRASE in this shell";
|
|
1154
|
+
case "legacy":
|
|
1155
|
+
return "legacy keychain entry";
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
var WARN_UNLOCK = /* @__PURE__ */ new Set([
|
|
1159
|
+
"passphrase_missing",
|
|
1160
|
+
"passphrase_wrong",
|
|
1161
|
+
"env_passphrase_wrong",
|
|
1162
|
+
"wallet_corrupt"
|
|
1163
|
+
]);
|
|
1164
|
+
function walletRow(e, dataDir) {
|
|
1165
|
+
const name = "wallet";
|
|
1166
|
+
const sign = e.canSign;
|
|
1167
|
+
if (e.describeError !== null && e.describeError !== void 0) {
|
|
1168
|
+
const err = e.describeError;
|
|
1169
|
+
return {
|
|
1170
|
+
name,
|
|
1171
|
+
status: "fail",
|
|
1172
|
+
required: true,
|
|
1173
|
+
detail: err instanceof CliError ? err.message : String(err),
|
|
1174
|
+
...err instanceof CliError && err.fix !== void 0 ? { fix: err.fix } : {}
|
|
1175
|
+
};
|
|
1176
|
+
}
|
|
1177
|
+
if (sign.status === "blocked" && sign.reason === "no_wallet") {
|
|
1178
|
+
return {
|
|
1179
|
+
name,
|
|
1180
|
+
status: "fail",
|
|
1181
|
+
required: true,
|
|
1182
|
+
detail: "no wallet on this machine, so nothing can pay",
|
|
1183
|
+
fix: `Run \`tenjin wallet create\`, then \`tenjin wallet fund ${SUGGESTED_FUND_USD}\`.`
|
|
1184
|
+
};
|
|
1185
|
+
}
|
|
1186
|
+
if (sign.status === "blocked" && sign.reason === "env_key_invalid") {
|
|
1187
|
+
return { name, status: "fail", required: true, detail: sign.detail, fix: sign.fix };
|
|
1188
|
+
}
|
|
1189
|
+
const address = e.address ?? "the wallet";
|
|
1190
|
+
if (sign.status === "ready") {
|
|
1191
|
+
if (sign.warning !== void 0) {
|
|
1192
|
+
return {
|
|
1193
|
+
name,
|
|
1194
|
+
status: "warn",
|
|
1195
|
+
required: false,
|
|
1196
|
+
detail: `${address} unlocks with the saved passphrase; TENJIN_WALLET_PASSPHRASE is set but wrong`,
|
|
1197
|
+
fix: "Remove it from this shell and your shell profile: `unset TENJIN_WALLET_PASSPHRASE`."
|
|
1198
|
+
};
|
|
1199
|
+
}
|
|
1200
|
+
return {
|
|
1201
|
+
name,
|
|
1202
|
+
status: "ok",
|
|
1203
|
+
required: true,
|
|
1204
|
+
detail: sign.source !== void 0 ? `${address} unlocks without a prompt (${signedFrom(sign.source, address, dataDir)})` : `${address} unlocks without a prompt`
|
|
1205
|
+
};
|
|
1206
|
+
}
|
|
1207
|
+
if (sign.status === "blocked") {
|
|
1208
|
+
const fix = WARN_UNLOCK.has(sign.reason) ? WALLET_REASONS[sign.reason].fix : sign.fix;
|
|
1209
|
+
return {
|
|
1210
|
+
name,
|
|
1211
|
+
status: "warn",
|
|
1212
|
+
required: false,
|
|
1213
|
+
detail: `${address} cannot be unlocked: ${sign.detail}`,
|
|
1214
|
+
fix
|
|
1215
|
+
};
|
|
1216
|
+
}
|
|
1217
|
+
return {
|
|
1218
|
+
name,
|
|
1219
|
+
status: "warn",
|
|
1220
|
+
required: false,
|
|
1221
|
+
checked: false,
|
|
1222
|
+
detail: `could not check whether ${address} unlocks: ${sign.detail}`,
|
|
1223
|
+
...sign.reason === "keychain_locked" ? { fix: KEYCHAIN_LOCKED_FIX } : {}
|
|
1224
|
+
};
|
|
1225
|
+
}
|
|
1226
|
+
var SAVE_FOR_EVERY_SESSION_FIX = `Run \`tenjin wallet repair\` yourself to save the passphrase where every Claude Code can read it ${REPAIR_CLAUSE}.`;
|
|
1227
|
+
function clock(ms) {
|
|
1228
|
+
return new Date(ms).toTimeString().slice(0, 5);
|
|
1229
|
+
}
|
|
1230
|
+
function sessionRow(shell, live, version = package_default.version) {
|
|
1231
|
+
const name = "claude session";
|
|
1232
|
+
const served = [...servedObservations(live)].sort(
|
|
1233
|
+
(a, b) => Number(b.cliVersion === version) - Number(a.cliVersion === version) || b.startedAt - a.startedAt
|
|
1234
|
+
);
|
|
1235
|
+
if (served.length === 0) {
|
|
1236
|
+
const shellReady = shell.canSign.status === "ready" && shell.canPayRouting.status === "ready";
|
|
1237
|
+
const detail = shellReady ? NO_SESSION_CHECKED : "no running Claude session checked";
|
|
1238
|
+
if (shell.source === "passphrase-env" && shell.savedSign !== null && isDefiniteBlock(shell.savedSign)) {
|
|
1239
|
+
return {
|
|
1240
|
+
name,
|
|
1241
|
+
status: "warn",
|
|
1242
|
+
required: false,
|
|
1243
|
+
detail: `${detail}, and a Claude Code started without TENJIN_WALLET_PASSPHRASE cannot unlock the wallet`,
|
|
1244
|
+
fix: SAVE_FOR_EVERY_SESSION_FIX
|
|
1245
|
+
};
|
|
1246
|
+
}
|
|
1247
|
+
return {
|
|
1248
|
+
name,
|
|
1249
|
+
status: "warn",
|
|
1250
|
+
required: false,
|
|
1251
|
+
checked: false,
|
|
1252
|
+
detail,
|
|
1253
|
+
...shell.source === "key-env" ? { fix: "Start Claude Code from a shell that sets TENJIN_WALLET_KEY." } : {}
|
|
1254
|
+
};
|
|
1255
|
+
}
|
|
1256
|
+
const blocked = served.find((o2) => o2.sign.status === "blocked");
|
|
1257
|
+
if (blocked !== void 0) {
|
|
1258
|
+
const reason = blocked.sign.reason ?? "";
|
|
1259
|
+
const wallet = Object.prototype.hasOwnProperty.call(WALLET_REASONS, reason) ? WALLET_REASONS[reason] : void 0;
|
|
1260
|
+
const detail = blocked.sign.detail ?? wallet?.reason ?? reason;
|
|
1261
|
+
const fix = wallet?.fix ?? blocked.sign.fix;
|
|
1262
|
+
return {
|
|
1263
|
+
name,
|
|
1264
|
+
status: "warn",
|
|
1265
|
+
required: false,
|
|
1266
|
+
detail: `the router Claude Code started (pid ${blocked.pid}) cannot unlock the wallet: ${detail}`,
|
|
1267
|
+
...fix !== void 0 ? { fix } : {}
|
|
1268
|
+
};
|
|
1269
|
+
}
|
|
1270
|
+
const here = shell.address?.toLowerCase() ?? null;
|
|
1271
|
+
const other = served.find(
|
|
1272
|
+
(o2) => o2.address !== null && here !== null && o2.address.toLowerCase() !== here
|
|
1273
|
+
);
|
|
1274
|
+
if (other !== void 0) {
|
|
1275
|
+
return {
|
|
1276
|
+
name,
|
|
1277
|
+
status: "warn",
|
|
1278
|
+
required: false,
|
|
1279
|
+
detail: `Claude Code's router uses ${other.address}, this shell ${shell.address}`
|
|
1280
|
+
};
|
|
1281
|
+
}
|
|
1282
|
+
const waiting = served.find((o2) => o2.sign.status !== "ready");
|
|
1283
|
+
if (waiting !== void 0) {
|
|
1284
|
+
const why = waiting.sign.status === "pending" ? "it has not tried to unlock yet" : waiting.sign.detail ?? UNKNOWN_DETAIL[waiting.sign.reason ?? ""] ?? UNKNOWN_DETAIL["check_failed"];
|
|
1285
|
+
return {
|
|
1286
|
+
name,
|
|
1287
|
+
status: "warn",
|
|
1288
|
+
required: false,
|
|
1289
|
+
checked: false,
|
|
1290
|
+
detail: `could not check whether the router Claude Code started (pid ${waiting.pid}) unlocks the wallet: ${why}`
|
|
1291
|
+
};
|
|
1292
|
+
}
|
|
1293
|
+
const o = served[0];
|
|
1294
|
+
return {
|
|
1295
|
+
name,
|
|
1296
|
+
status: "ok",
|
|
1297
|
+
required: false,
|
|
1298
|
+
detail: `the router Claude Code started (pid ${o.pid}, since ${clock(o.startedAt)}, v${o.cliVersion}) unlocked ${o.address ?? shell.address ?? "the wallet"}`
|
|
1299
|
+
};
|
|
1300
|
+
}
|
|
1301
|
+
export {
|
|
1302
|
+
doctorLines,
|
|
1303
|
+
findPathTenjin,
|
|
1304
|
+
listedInClaudeFiles,
|
|
1305
|
+
pluginStart,
|
|
1306
|
+
readPluginLaunch,
|
|
1307
|
+
routingFeeRow,
|
|
1308
|
+
runRouterDoctor,
|
|
1309
|
+
sessionRow,
|
|
1310
|
+
walletRow
|
|
1311
|
+
};
|
|
1312
|
+
//# sourceMappingURL=doctor-NKU4V5OV.js.map
|