tenjin-cli 0.1.0-alpha.3 → 0.1.0-alpha.31

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.
Files changed (284) hide show
  1. package/NOTICE.md +54 -7
  2. package/README.md +100 -266
  3. package/dist/{_esm-FEASBWRP.js → _esm-MEXZI5DL.js} +9 -10
  4. package/dist/alive-J64H46HI.js +31 -0
  5. package/dist/{ccip-NQXCEK2U.js → ccip-7RMRLAGV.js} +4 -4
  6. package/dist/{ccip-XR5NE5QK.js → ccip-NLCSCHKI.js} +5 -5
  7. package/dist/chunk-27EPWVOY.js +108 -0
  8. package/dist/chunk-27EPWVOY.js.map +1 -0
  9. package/dist/chunk-2SNUOHAT.js +75 -0
  10. package/dist/chunk-2SNUOHAT.js.map +1 -0
  11. package/dist/{chunk-Z6MFJV5Z.js → chunk-2XLC3AEX.js} +857 -504
  12. package/dist/chunk-2XLC3AEX.js.map +1 -0
  13. package/dist/chunk-3623BLPV.js +184 -0
  14. package/dist/chunk-3623BLPV.js.map +1 -0
  15. package/dist/chunk-3UCIG4TG.js +65 -0
  16. package/dist/chunk-3UCIG4TG.js.map +1 -0
  17. package/dist/chunk-4ZZO6ULA.js +151 -0
  18. package/dist/chunk-4ZZO6ULA.js.map +1 -0
  19. package/dist/chunk-5C32RLTA.js +115 -0
  20. package/dist/chunk-5C32RLTA.js.map +1 -0
  21. package/dist/{chunk-ZMHYXMO6.js → chunk-5IEP5EGE.js} +3 -3
  22. package/dist/chunk-5K5W4S66.js +105 -0
  23. package/dist/chunk-5K5W4S66.js.map +1 -0
  24. package/dist/chunk-5MARFNSB.js +2018 -0
  25. package/dist/chunk-5MARFNSB.js.map +1 -0
  26. package/dist/{chunk-CYOF7ROH.js → chunk-6E5R45ZO.js} +3 -3
  27. package/dist/chunk-77TCKDEC.js +1987 -0
  28. package/dist/chunk-77TCKDEC.js.map +1 -0
  29. package/dist/chunk-7EKYXMUO.js +7536 -0
  30. package/dist/chunk-7EKYXMUO.js.map +1 -0
  31. package/dist/chunk-7Q5FDF65.js +159 -0
  32. package/dist/chunk-7Q5FDF65.js.map +1 -0
  33. package/dist/chunk-7QKHZQKW.js +1680 -0
  34. package/dist/chunk-7QKHZQKW.js.map +1 -0
  35. package/dist/{chunk-MUBUQVC3.js → chunk-7WEQQJLG.js} +6 -5
  36. package/dist/{chunk-MUBUQVC3.js.map → chunk-7WEQQJLG.js.map} +1 -1
  37. package/dist/chunk-7WU4OPLP.js +244 -0
  38. package/dist/chunk-7WU4OPLP.js.map +1 -0
  39. package/dist/chunk-7ZRL2LBQ.js +192 -0
  40. package/dist/chunk-7ZRL2LBQ.js.map +1 -0
  41. package/dist/chunk-A36LQPHV.js +29 -0
  42. package/dist/chunk-A36LQPHV.js.map +1 -0
  43. package/dist/chunk-AGZ7PJKY.js +326 -0
  44. package/dist/chunk-AGZ7PJKY.js.map +1 -0
  45. package/dist/chunk-AKWGE6JQ.js +49 -0
  46. package/dist/chunk-AKWGE6JQ.js.map +1 -0
  47. package/dist/chunk-B7HUUJOK.js +29 -0
  48. package/dist/chunk-B7HUUJOK.js.map +1 -0
  49. package/dist/{chunk-S3IGX57D.js → chunk-BL3332HQ.js} +290 -7361
  50. package/dist/chunk-BL3332HQ.js.map +1 -0
  51. package/dist/{chunk-5CLSD5YN.js → chunk-BPMWXTFX.js} +2 -2
  52. package/dist/chunk-D65GNPS3.js +12708 -0
  53. package/dist/chunk-D65GNPS3.js.map +1 -0
  54. package/dist/chunk-DOQGNFHM.js +121 -0
  55. package/dist/chunk-DOQGNFHM.js.map +1 -0
  56. package/dist/{chunk-YALGASEU.js → chunk-EGELTSPU.js} +2 -2
  57. package/dist/chunk-FW75G2W4.js +406 -0
  58. package/dist/chunk-FW75G2W4.js.map +1 -0
  59. package/dist/chunk-GA7JETVM.js +150 -0
  60. package/dist/chunk-GA7JETVM.js.map +1 -0
  61. package/dist/chunk-I3EQFHCD.js +175 -0
  62. package/dist/chunk-I3EQFHCD.js.map +1 -0
  63. package/dist/chunk-JKKAIPTU.js +108 -0
  64. package/dist/chunk-JKKAIPTU.js.map +1 -0
  65. package/dist/{chunk-QVX5MWJZ.js → chunk-JRGFKVAZ.js} +2 -2
  66. package/dist/{chunk-NCE5NSN6.js → chunk-K3I7C2MO.js} +142 -12
  67. package/dist/chunk-K3I7C2MO.js.map +1 -0
  68. package/dist/chunk-K72RURN3.js +239 -0
  69. package/dist/chunk-K72RURN3.js.map +1 -0
  70. package/dist/{chunk-HIVZG55D.js → chunk-KG3D7FIF.js} +2 -2
  71. package/dist/chunk-KOGZDMHO.js +21 -0
  72. package/dist/chunk-KOGZDMHO.js.map +1 -0
  73. package/dist/chunk-KXQ4UIP7.js +228 -0
  74. package/dist/chunk-KXQ4UIP7.js.map +1 -0
  75. package/dist/chunk-KXVP2VKA.js +194 -0
  76. package/dist/chunk-KXVP2VKA.js.map +1 -0
  77. package/dist/chunk-LEFIX6RS.js +100 -0
  78. package/dist/chunk-LEFIX6RS.js.map +1 -0
  79. package/dist/chunk-LHHMV4GU.js +27 -0
  80. package/dist/chunk-LHHMV4GU.js.map +1 -0
  81. package/dist/{chunk-YBMMV4Y4.js → chunk-MEFB5KHA.js} +13 -5
  82. package/dist/chunk-MEFB5KHA.js.map +1 -0
  83. package/dist/chunk-MNXS2U45.js +1768 -0
  84. package/dist/chunk-MNXS2U45.js.map +1 -0
  85. package/dist/{chunk-UGX7YPX2.js → chunk-NEFNKLBE.js} +9 -11
  86. package/dist/{chunk-UGX7YPX2.js.map → chunk-NEFNKLBE.js.map} +1 -1
  87. package/dist/chunk-OHRR5OYM.js +63 -0
  88. package/dist/chunk-OHRR5OYM.js.map +1 -0
  89. package/dist/chunk-ORWL5BSN.js +269 -0
  90. package/dist/chunk-ORWL5BSN.js.map +1 -0
  91. package/dist/chunk-P4NH7OUK.js +398 -0
  92. package/dist/chunk-P4NH7OUK.js.map +1 -0
  93. package/dist/{chunk-ZABPQJ3M.js → chunk-POUWHWID.js} +2 -2
  94. package/dist/chunk-QSCPK4F5.js +145 -0
  95. package/dist/chunk-QSCPK4F5.js.map +1 -0
  96. package/dist/chunk-QXP3Z3JN.js +131 -0
  97. package/dist/chunk-QXP3Z3JN.js.map +1 -0
  98. package/dist/{chunk-XJIW7USF.js → chunk-R5LCN54M.js} +118 -9
  99. package/dist/chunk-R5LCN54M.js.map +1 -0
  100. package/dist/chunk-S4SAZ7OD.js +30 -0
  101. package/dist/chunk-S4SAZ7OD.js.map +1 -0
  102. package/dist/chunk-SJLTEINJ.js +117 -0
  103. package/dist/chunk-SJLTEINJ.js.map +1 -0
  104. package/dist/{chunk-RRN3YTK7.js → chunk-TTNESUPQ.js} +3 -3
  105. package/dist/chunk-UKY4CHNC.js +498 -0
  106. package/dist/chunk-UKY4CHNC.js.map +1 -0
  107. package/dist/chunk-UQUOVWBG.js +114 -0
  108. package/dist/chunk-UQUOVWBG.js.map +1 -0
  109. package/dist/chunk-V6BSF6OC.js +260 -0
  110. package/dist/chunk-V6BSF6OC.js.map +1 -0
  111. package/dist/chunk-WJXLQXJY.js +43 -0
  112. package/dist/chunk-WJXLQXJY.js.map +1 -0
  113. package/dist/chunk-WK7F3B2E.js +114 -0
  114. package/dist/chunk-WK7F3B2E.js.map +1 -0
  115. package/dist/chunk-XKESD27X.js +10 -0
  116. package/dist/chunk-XKESD27X.js.map +1 -0
  117. package/dist/chunk-XQJXNMSB.js +23 -0
  118. package/dist/chunk-XQJXNMSB.js.map +1 -0
  119. package/dist/{chunk-HSDCI7OV.js → chunk-XZKD7DIF.js} +3 -3
  120. package/dist/chunk-Y527D4TV.js +56 -0
  121. package/dist/chunk-Y527D4TV.js.map +1 -0
  122. package/dist/chunk-YFPY4ONH.js +127 -0
  123. package/dist/chunk-YFPY4ONH.js.map +1 -0
  124. package/dist/{chunk-OYMYCW7J.js → chunk-YVFXE7RR.js} +606 -97
  125. package/dist/chunk-YVFXE7RR.js.map +1 -0
  126. package/dist/clack-EZ7TDWQU.js +19 -0
  127. package/dist/claude-cli-2YKABJJZ.js +31 -0
  128. package/dist/{cli-SBXI5AMS.js → cli-D5OE3URZ.js} +458 -218
  129. package/dist/cli-D5OE3URZ.js.map +1 -0
  130. package/dist/codex-event-PPNVRRDH.js +16 -0
  131. package/dist/codex-host-2RJOJW2B.js +28 -0
  132. package/dist/codex-install-UUZ6QMBQ.js +221 -0
  133. package/dist/codex-install-UUZ6QMBQ.js.map +1 -0
  134. package/dist/config-ZD4OB2DO.js +51 -0
  135. package/dist/dist-3LOO6M4U.js +2842 -0
  136. package/dist/dist-3LOO6M4U.js.map +1 -0
  137. package/dist/doctor-KBR34Q4B.js +601 -0
  138. package/dist/doctor-KBR34Q4B.js.map +1 -0
  139. package/dist/env-proxy-XL4P73MZ.js +15 -0
  140. package/dist/{ethersCompat-Df4a6QIZ-3YZIAXDK.js → ethersCompat-Df4a6QIZ-THAVUGIJ.js} +5 -5
  141. package/dist/ethersCompat-Df4a6QIZ-THAVUGIJ.js.map +1 -0
  142. package/dist/fund-5ITKQGYF.js +372 -0
  143. package/dist/fund-5ITKQGYF.js.map +1 -0
  144. package/dist/hook-command-4TYCHHRL.js +39 -0
  145. package/dist/hook-command-4TYCHHRL.js.map +1 -0
  146. package/dist/hosts/claude/.claude-plugin/marketplace.json +19 -0
  147. package/dist/hosts/claude/tenjin/.claude-plugin/plugin.json +15 -0
  148. package/dist/hosts/claude/tenjin/.mcp.json +12 -0
  149. package/dist/hosts/claude/tenjin/hooks/hooks.json +224 -0
  150. package/dist/hosts/claude/tenjin/hooks/register.tsx +589 -0
  151. package/dist/hosts/claude/tenjin/types/index.d.ts +41 -0
  152. package/dist/hosts/codex/.agents/plugins/marketplace.json +20 -0
  153. package/dist/hosts/codex/tenjin/.codex-plugin/plugin.json +16 -0
  154. package/dist/hosts/codex/tenjin/.mcp.json +12 -0
  155. package/dist/hosts/codex/tenjin/hooks/hooks.json +52 -0
  156. package/dist/hosts-FWZOV26H.js +216 -0
  157. package/dist/hosts-FWZOV26H.js.map +1 -0
  158. package/dist/index.js +21 -2
  159. package/dist/index.js.map +1 -1
  160. package/dist/install-XWGE4Q7L.js +77 -0
  161. package/dist/install-XWGE4Q7L.js.map +1 -0
  162. package/dist/install-identity-K7EJIQFP.js +30 -0
  163. package/dist/install-identity-K7EJIQFP.js.map +1 -0
  164. package/dist/install-wallet-XQ6XFZV4.js +117 -0
  165. package/dist/install-wallet-XQ6XFZV4.js.map +1 -0
  166. package/dist/mcp-3LIJSSJB.js +13553 -0
  167. package/dist/mcp-3LIJSSJB.js.map +1 -0
  168. package/dist/package-ZKQFDWLE.js +37 -0
  169. package/dist/package-ZKQFDWLE.js.map +1 -0
  170. package/dist/paths-POPTXJO6.js +61 -0
  171. package/dist/paths-POPTXJO6.js.map +1 -0
  172. package/dist/pay-WHBERZ3W.js +55 -0
  173. package/dist/pay-WHBERZ3W.js.map +1 -0
  174. package/dist/payments-KVICEKD2.js +110 -0
  175. package/dist/payments-KVICEKD2.js.map +1 -0
  176. package/dist/plugin-registration-5TIA564H.js +54 -0
  177. package/dist/plugin-registration-5TIA564H.js.map +1 -0
  178. package/dist/redact-6W23GGJC.js +15 -0
  179. package/dist/redact-6W23GGJC.js.map +1 -0
  180. package/dist/{secp256k1-N3ZHU7LB.js → secp256k1-ZZZT2CAX.js} +3 -3
  181. package/dist/secp256k1-ZZZT2CAX.js.map +1 -0
  182. package/dist/send-7G7Y7DLN.js +228 -0
  183. package/dist/send-7G7Y7DLN.js.map +1 -0
  184. package/dist/status-OF7RH5HM.js +120 -0
  185. package/dist/status-OF7RH5HM.js.map +1 -0
  186. package/dist/status-line-XOUE6MPL.js +90 -0
  187. package/dist/status-line-XOUE6MPL.js.map +1 -0
  188. package/dist/uninstall-JXUAFNDB.js +158 -0
  189. package/dist/uninstall-JXUAFNDB.js.map +1 -0
  190. package/dist/update-ZKUERSO2.js +44 -0
  191. package/dist/update-ZKUERSO2.js.map +1 -0
  192. package/dist/usdc-OGOGEHV2.js +40 -0
  193. package/dist/usdc-OGOGEHV2.js.map +1 -0
  194. package/dist/{viemAdapter-By13KInL-ZZE6UV4Y.js → viemAdapter-By13KInL-S3DA7DFW.js} +5 -5
  195. package/dist/viemAdapter-By13KInL-S3DA7DFW.js.map +1 -0
  196. package/dist/wallet-2HA6W4R4.js +43 -0
  197. package/dist/wallet-2HA6W4R4.js.map +1 -0
  198. package/dist/wallet-kdf-worker.mjs +980 -0
  199. package/docs/agent-permissions.md +196 -0
  200. package/docs/safety-model.md +59 -0
  201. package/docs/troubleshooting.md +13 -0
  202. package/package.json +28 -19
  203. package/LICENSE +0 -21
  204. package/dist/buy-EE6SEXP6.js +0 -1598
  205. package/dist/buy-EE6SEXP6.js.map +0 -1
  206. package/dist/candidate-ERMSYYQZ.js +0 -127
  207. package/dist/candidate-ERMSYYQZ.js.map +0 -1
  208. package/dist/chunk-3OV7E5G5.js +0 -18
  209. package/dist/chunk-3OV7E5G5.js.map +0 -1
  210. package/dist/chunk-4ONXEEQL.js +0 -152
  211. package/dist/chunk-4ONXEEQL.js.map +0 -1
  212. package/dist/chunk-662MSGZB.js +0 -286
  213. package/dist/chunk-662MSGZB.js.map +0 -1
  214. package/dist/chunk-7KUW4MJD.js +0 -59
  215. package/dist/chunk-7KUW4MJD.js.map +0 -1
  216. package/dist/chunk-AWPAWHNX.js +0 -333
  217. package/dist/chunk-AWPAWHNX.js.map +0 -1
  218. package/dist/chunk-DXTQ3CSI.js +0 -171
  219. package/dist/chunk-DXTQ3CSI.js.map +0 -1
  220. package/dist/chunk-ESPNTPQ2.js +0 -207
  221. package/dist/chunk-ESPNTPQ2.js.map +0 -1
  222. package/dist/chunk-FJPLRISB.js +0 -79
  223. package/dist/chunk-FJPLRISB.js.map +0 -1
  224. package/dist/chunk-GO75V3NZ.js +0 -160
  225. package/dist/chunk-GO75V3NZ.js.map +0 -1
  226. package/dist/chunk-JPHG2JW3.js +0 -96
  227. package/dist/chunk-JPHG2JW3.js.map +0 -1
  228. package/dist/chunk-NCE5NSN6.js.map +0 -1
  229. package/dist/chunk-OYMYCW7J.js.map +0 -1
  230. package/dist/chunk-RY4XKNV3.js +0 -140
  231. package/dist/chunk-RY4XKNV3.js.map +0 -1
  232. package/dist/chunk-S3IGX57D.js.map +0 -1
  233. package/dist/chunk-TLCMMYLY.js +0 -126
  234. package/dist/chunk-TLCMMYLY.js.map +0 -1
  235. package/dist/chunk-UO22YNY4.js +0 -69
  236. package/dist/chunk-UO22YNY4.js.map +0 -1
  237. package/dist/chunk-XHC6FCGZ.js +0 -261
  238. package/dist/chunk-XHC6FCGZ.js.map +0 -1
  239. package/dist/chunk-XJIW7USF.js.map +0 -1
  240. package/dist/chunk-YBMMV4Y4.js.map +0 -1
  241. package/dist/chunk-YN5SHIXQ.js +0 -126
  242. package/dist/chunk-YN5SHIXQ.js.map +0 -1
  243. package/dist/chunk-Z52RA3NC.js +0 -137
  244. package/dist/chunk-Z52RA3NC.js.map +0 -1
  245. package/dist/chunk-Z6MFJV5Z.js.map +0 -1
  246. package/dist/cli-SBXI5AMS.js.map +0 -1
  247. package/dist/config-VELDKLHY.js +0 -21
  248. package/dist/doctor-T3KWNNP2.js +0 -20
  249. package/dist/inspect-LMKOXE4Y.js +0 -96
  250. package/dist/inspect-LMKOXE4Y.js.map +0 -1
  251. package/dist/install-LEX3ENQ6.js +0 -387
  252. package/dist/install-LEX3ENQ6.js.map +0 -1
  253. package/dist/lookup-ZPN2Q67N.js +0 -129
  254. package/dist/lookup-ZPN2Q67N.js.map +0 -1
  255. package/dist/outcome-N7TAK6WR.js +0 -66
  256. package/dist/outcome-N7TAK6WR.js.map +0 -1
  257. package/dist/publish-BKBQQAW4.js +0 -1478
  258. package/dist/publish-BKBQQAW4.js.map +0 -1
  259. package/dist/usdc-JIAJW4SV.js +0 -22
  260. package/dist/wallet-CWEMYVIH.js +0 -179
  261. package/dist/wallet-CWEMYVIH.js.map +0 -1
  262. package/dist/wallet-PA54CRBL.js +0 -30
  263. package/skills/tenjin/SKILL.md +0 -199
  264. package/skills/tenjin-publish/SKILL.md +0 -111
  265. package/skills/tenjin-search/SKILL.md +0 -133
  266. /package/dist/{_esm-FEASBWRP.js.map → _esm-MEXZI5DL.js.map} +0 -0
  267. /package/dist/{ccip-NQXCEK2U.js.map → alive-J64H46HI.js.map} +0 -0
  268. /package/dist/{ccip-XR5NE5QK.js.map → ccip-7RMRLAGV.js.map} +0 -0
  269. /package/dist/{config-VELDKLHY.js.map → ccip-NLCSCHKI.js.map} +0 -0
  270. /package/dist/{chunk-ZMHYXMO6.js.map → chunk-5IEP5EGE.js.map} +0 -0
  271. /package/dist/{chunk-CYOF7ROH.js.map → chunk-6E5R45ZO.js.map} +0 -0
  272. /package/dist/{chunk-5CLSD5YN.js.map → chunk-BPMWXTFX.js.map} +0 -0
  273. /package/dist/{chunk-YALGASEU.js.map → chunk-EGELTSPU.js.map} +0 -0
  274. /package/dist/{chunk-QVX5MWJZ.js.map → chunk-JRGFKVAZ.js.map} +0 -0
  275. /package/dist/{chunk-HIVZG55D.js.map → chunk-KG3D7FIF.js.map} +0 -0
  276. /package/dist/{chunk-ZABPQJ3M.js.map → chunk-POUWHWID.js.map} +0 -0
  277. /package/dist/{chunk-RRN3YTK7.js.map → chunk-TTNESUPQ.js.map} +0 -0
  278. /package/dist/{chunk-HSDCI7OV.js.map → chunk-XZKD7DIF.js.map} +0 -0
  279. /package/dist/{doctor-T3KWNNP2.js.map → clack-EZ7TDWQU.js.map} +0 -0
  280. /package/dist/{ethersCompat-Df4a6QIZ-3YZIAXDK.js.map → claude-cli-2YKABJJZ.js.map} +0 -0
  281. /package/dist/{secp256k1-N3ZHU7LB.js.map → codex-event-PPNVRRDH.js.map} +0 -0
  282. /package/dist/{usdc-JIAJW4SV.js.map → codex-host-2RJOJW2B.js.map} +0 -0
  283. /package/dist/{viemAdapter-By13KInL-ZZE6UV4Y.js.map → config-ZD4OB2DO.js.map} +0 -0
  284. /package/dist/{wallet-PA54CRBL.js.map → env-proxy-XL4P73MZ.js.map} +0 -0
@@ -0,0 +1,601 @@
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-KXQ4UIP7.js";
7
+ import {
8
+ channelCredit
9
+ } from "./chunk-B7HUUJOK.js";
10
+ import "./chunk-5K5W4S66.js";
11
+ import "./chunk-7Q5FDF65.js";
12
+ import "./chunk-BL3332HQ.js";
13
+ import {
14
+ describeWallet,
15
+ resolveWalletProvider,
16
+ walletFileExists
17
+ } from "./chunk-2XLC3AEX.js";
18
+ import "./chunk-7ZRL2LBQ.js";
19
+ import {
20
+ readSpendSummary,
21
+ spentOf
22
+ } from "./chunk-WK7F3B2E.js";
23
+ import "./chunk-K3I7C2MO.js";
24
+ import "./chunk-EGELTSPU.js";
25
+ import "./chunk-JRGFKVAZ.js";
26
+ import "./chunk-TTNESUPQ.js";
27
+ import "./chunk-KG3D7FIF.js";
28
+ import "./chunk-RBJPAZFI.js";
29
+ import "./chunk-BPMWXTFX.js";
30
+ import {
31
+ folderState,
32
+ inspectLegacyInstall,
33
+ loadStep,
34
+ pluginProof,
35
+ probeRouter,
36
+ projectInstallHere,
37
+ readMcpServers,
38
+ readPluginListing,
39
+ settingsInstallPaths
40
+ } from "./chunk-77TCKDEC.js";
41
+ import "./chunk-UKY4CHNC.js";
42
+ import {
43
+ isNewer
44
+ } from "./chunk-KXVP2VKA.js";
45
+ import "./chunk-GA7JETVM.js";
46
+ import "./chunk-KOGZDMHO.js";
47
+ import {
48
+ CLAUDE_CODE_FLOOR,
49
+ claudeConfigDir,
50
+ findClaudeBinary,
51
+ readClaudeCode,
52
+ runClaude
53
+ } from "./chunk-QXP3Z3JN.js";
54
+ import "./chunk-5MARFNSB.js";
55
+ import "./chunk-3623BLPV.js";
56
+ import "./chunk-A36LQPHV.js";
57
+ import "./chunk-QSCPK4F5.js";
58
+ import "./chunk-AKWGE6JQ.js";
59
+ import {
60
+ PLUGIN_ID,
61
+ PLUGIN_SERVER,
62
+ REQUEST_TOOL
63
+ } from "./chunk-WJXLQXJY.js";
64
+ import "./chunk-XKESD27X.js";
65
+ import {
66
+ CHANNEL_DEPOSIT_ATOMIC,
67
+ ROUTING_FEE_ATOMIC,
68
+ SUGGESTED_FUND_USD,
69
+ feeRefusal,
70
+ refusedWhy,
71
+ unpaid,
72
+ usd
73
+ } from "./chunk-4ZZO6ULA.js";
74
+ import "./chunk-MEFB5KHA.js";
75
+ import {
76
+ evaluateSpendPolicy
77
+ } from "./chunk-2SNUOHAT.js";
78
+ import "./chunk-K72RURN3.js";
79
+ import "./chunk-DOQGNFHM.js";
80
+ import {
81
+ routerSettings
82
+ } from "./chunk-YFPY4ONH.js";
83
+ import {
84
+ readAliveStamp
85
+ } from "./chunk-I3EQFHCD.js";
86
+ import "./chunk-S4SAZ7OD.js";
87
+ import "./chunk-AGZ7PJKY.js";
88
+ import "./chunk-2I4QTOLB.js";
89
+ import {
90
+ resolveContextSettings
91
+ } from "./chunk-7WU4OPLP.js";
92
+ import {
93
+ toMoney
94
+ } from "./chunk-Y527D4TV.js";
95
+ import "./chunk-YVFXE7RR.js";
96
+ import "./chunk-XQJXNMSB.js";
97
+ import {
98
+ CliError
99
+ } from "./chunk-3UCIG4TG.js";
100
+ import {
101
+ readUsdcBalance
102
+ } from "./chunk-27EPWVOY.js";
103
+ import "./chunk-7WEQQJLG.js";
104
+ import "./chunk-SJLTEINJ.js";
105
+ import {
106
+ package_default
107
+ } from "./chunk-5C32RLTA.js";
108
+ import "./chunk-ZXTAQYNA.js";
109
+
110
+ // src/router/doctor.ts
111
+ import { readFile } from "node:fs/promises";
112
+ import { homedir } from "node:os";
113
+ import { join } from "node:path";
114
+ var NODE_FLOOR = 22;
115
+ 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.";
116
+ async function runRouterDoctor(ctx, deps = {}) {
117
+ const env = deps.env ?? process.env;
118
+ const home = deps.homeDir ?? homedir();
119
+ const cwd = deps.cwd ?? process.cwd();
120
+ const project = deps.project ?? await projectInstallHere(cwd, home, env);
121
+ const router = await routerSettings(
122
+ { cwd, dataDir: ctx.dataDir },
123
+ deps.homeDir !== void 0 ? { homeDir: deps.homeDir } : {}
124
+ ).catch((err) => err instanceof Error ? err : new Error(String(err)));
125
+ const settings = await resolveContextSettings(ctx);
126
+ const claude = await readClaudeCode(env, cwd, deps.findClaude ?? findClaudeBinary);
127
+ const scope = project ? "local" : "user";
128
+ const paths = settingsInstallPaths(project, env, home, cwd);
129
+ const legacy = await inspectLegacyInstall(paths.settingsPath, paths.mcpFile);
130
+ const checks = [nodeCheck(deps.nodeVersion ?? process.version)];
131
+ checks.push(claudeCodeCheck(claude));
132
+ const plugin = await pluginCheck(claude, { scope, env, home, cwd, dataDir: ctx.dataDir, legacy });
133
+ checks.push(plugin.check);
134
+ if (plugin.registered && claude.binary !== null) {
135
+ checks.push(await serverCheck(claude.binary, env, cwd));
136
+ }
137
+ if (legacy.present || legacy.unreadable !== void 0) {
138
+ checks.push(await migrationCheck(legacy, claude, ctx.dataDir, env, cwd));
139
+ }
140
+ checks.push(routingCheck(router));
141
+ checks.push((await readMcpServers(deps, { settingsInstallPending: legacy.present })).check);
142
+ checks.push(spendCheck(settings.policy.maxAutoSpendAtomic, settings.policy.sessionBudgetAtomic));
143
+ checks.push(experimentalCheck(settings.experimentalBazaar));
144
+ checks.push(await routingFeeCheck(ctx, settings, deps.fetchImpl));
145
+ checks.push(...await walletCheck(ctx));
146
+ const now = deps.now?.() ?? Date.now();
147
+ const probe = await probeRouter(settings.baseUrl, {
148
+ timeoutMs: ctx.flags.timeout,
149
+ env,
150
+ ...deps.fetchImpl !== void 0 ? { fetchImpl: deps.fetchImpl } : {}
151
+ });
152
+ if (probe.status === "ok") {
153
+ await clearRouterMemo(ctx.dataDir, "unreachable", settings.baseUrl);
154
+ checks.push(probe);
155
+ } else {
156
+ checks.push(
157
+ withBackoff(
158
+ probe,
159
+ await readRouterMemo(ctx.dataDir, "unreachable", settings.baseUrl, now),
160
+ now
161
+ )
162
+ );
163
+ }
164
+ const agents = await subagentsCheck(cwd, home);
165
+ if (agents !== null) checks.push(agents);
166
+ const failure = checks.find((c) => c.status === "fail" && c.required);
167
+ const data = {
168
+ checks,
169
+ dataDir: ctx.dataDir,
170
+ baseUrl: settings.baseUrl,
171
+ scope,
172
+ settingsPath: paths.settingsPath
173
+ };
174
+ if (failure !== void 0) {
175
+ throw new CliError("REFUSED", failure.detail, {
176
+ ...failure.fix !== void 0 ? { fix: failure.fix } : {},
177
+ details: data
178
+ });
179
+ }
180
+ return { data, humanLines: doctorLines(checks) };
181
+ }
182
+ function doctorLines(checks) {
183
+ const bad = checks.filter((c) => c.status !== "ok").length;
184
+ return [
185
+ ...checks.flatMap((c) => [
186
+ `${c.status === "ok" ? "ok " : c.status === "warn" ? "warn" : "fail"} ${c.name}: ${c.detail}`,
187
+ ...c.status !== "ok" && c.fix !== void 0 ? [` fix: ${c.fix}`] : []
188
+ ]),
189
+ bad === 0 ? `${checks.length} checks, all pass.` : `${checks.length} checks, ${bad} to look at.`
190
+ ];
191
+ }
192
+ function withBackoff(check, memo, now) {
193
+ if (memo === null) return check;
194
+ const left = Math.max(1, Math.ceil((memo.until - now) / 1e3));
195
+ return {
196
+ ...check,
197
+ status: check.status === "ok" ? "warn" : check.status,
198
+ detail: `${check.detail}; routing calls skip the router for ${left}s more, after one did not reach it`
199
+ };
200
+ }
201
+ async function subagentsCheck(cwd, homeDir) {
202
+ const excluded = await agentsWithoutRequestTool({ cwd, homeDir }, REQUEST_TOOL);
203
+ if (excluded.length === 0) return null;
204
+ return {
205
+ name: "subagents",
206
+ status: "ok",
207
+ required: false,
208
+ detail: `${excluded.join(", ")} ${excluded.length === 1 ? "is" : "are"} offered no paid lookups: add ${REQUEST_TOOL} to tools: to allow paid lookups there`
209
+ };
210
+ }
211
+ function nodeCheck(version) {
212
+ const major = Number(/^v(\d+)/.exec(version)?.[1] ?? "0");
213
+ return major >= NODE_FLOOR ? { name: "node", status: "ok", required: true, detail: version } : {
214
+ name: "node",
215
+ status: "fail",
216
+ required: true,
217
+ detail: `${version} is below the Node ${NODE_FLOOR} floor.`,
218
+ fix: `Install Node ${NODE_FLOOR} or newer, then re-run \`tenjin doctor\`.`
219
+ };
220
+ }
221
+ function claudeCodeCheck(claude) {
222
+ const name = "claude code";
223
+ if (claude.binary === null) {
224
+ return {
225
+ name,
226
+ status: "warn",
227
+ required: false,
228
+ detail: "no claude binary on PATH or in CLAUDE_CODE_EXECPATH, so the plugin was checked from its folder only",
229
+ fix: "Run `tenjin doctor` from a Claude Code session, where CLAUDE_CODE_EXECPATH names the binary."
230
+ };
231
+ }
232
+ if (claude.version === null) {
233
+ return {
234
+ name,
235
+ status: "warn",
236
+ required: false,
237
+ detail: `${claude.binary.path} did not report a version`
238
+ };
239
+ }
240
+ if (!claude.meetsFloor) {
241
+ return {
242
+ name,
243
+ status: "fail",
244
+ required: true,
245
+ detail: `Claude Code ${claude.version} is older than ${CLAUDE_CODE_FLOOR}, which the Tenjin plugin needs`,
246
+ ...claude.fix !== void 0 ? { fix: claude.fix } : {}
247
+ };
248
+ }
249
+ return {
250
+ name,
251
+ status: "ok",
252
+ required: true,
253
+ detail: `${claude.version}${claude.binary.source === "execpath" ? " (from CLAUDE_CODE_EXECPATH)" : ""}`
254
+ };
255
+ }
256
+ async function pluginCheck(claude, c) {
257
+ const name = "plugin";
258
+ const missing = (detail) => ({
259
+ registered: false,
260
+ check: c.legacy.present ? {
261
+ name,
262
+ status: "warn",
263
+ required: false,
264
+ detail: `${detail}; the settings install of an earlier release still routes here`,
265
+ 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.`
266
+ } : {
267
+ name,
268
+ status: "fail",
269
+ required: true,
270
+ detail,
271
+ fix: `Run \`tenjin install${c.scope === "local" ? " --project" : ""}\`.`
272
+ }
273
+ });
274
+ if (claude.binary !== null) {
275
+ const listing = await readPluginListing(claude.binary, c.env, c.cwd);
276
+ if (!listing.read) {
277
+ return {
278
+ registered: false,
279
+ check: {
280
+ name,
281
+ status: "warn",
282
+ required: false,
283
+ detail: "Claude Code's plugin list could not be read, so the plugin was not checked",
284
+ fix: "Run `tenjin doctor` again in a moment."
285
+ }
286
+ };
287
+ }
288
+ if (listing.id === null) return missing(`${PLUGIN_ID} is not installed in Claude Code`);
289
+ if (!listing.enabled) {
290
+ return {
291
+ registered: false,
292
+ check: {
293
+ name,
294
+ status: "fail",
295
+ required: true,
296
+ detail: `${listing.id} is installed but disabled, so no lookup is routed`,
297
+ fix: `Run \`claude plugin enable ${listing.id}\`, then ${loadStep(c.legacy.present)}.`
298
+ }
299
+ };
300
+ }
301
+ if (listing.version !== package_default.version) {
302
+ return {
303
+ registered: true,
304
+ check: {
305
+ name,
306
+ status: "warn",
307
+ required: false,
308
+ detail: `${listing.id} is enabled at ${listing.version ?? "an unknown version"}, and this CLI is ${package_default.version}`,
309
+ fix: "Run `tenjin install --refresh` to register this version."
310
+ }
311
+ };
312
+ }
313
+ const stamp = await readAliveStamp(c.dataDir);
314
+ if (stamp === null || isNewer(package_default.version, stamp.version)) {
315
+ return {
316
+ registered: true,
317
+ check: {
318
+ name,
319
+ status: "warn",
320
+ required: false,
321
+ 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})` : ""}`,
322
+ fix: STAMP_FIX
323
+ }
324
+ };
325
+ }
326
+ return {
327
+ registered: true,
328
+ check: { name, status: "ok", required: true, detail: `${listing.id} ${package_default.version} enabled` }
329
+ };
330
+ }
331
+ const folder = await folderState(c.scope, c.env, c.home, c.cwd);
332
+ if (folder.state === "foreign") {
333
+ return {
334
+ registered: false,
335
+ check: {
336
+ name,
337
+ status: "fail",
338
+ required: true,
339
+ detail: `${folder.path} is there and is not a folder this CLI wrote, so the plugin cannot be written`,
340
+ fix: `Move ${folder.path} aside, then run \`tenjin install\` again.`
341
+ }
342
+ };
343
+ }
344
+ if (folder.state === "ours") {
345
+ const stamp = await readAliveStamp(c.dataDir);
346
+ return {
347
+ registered: true,
348
+ check: stamp === null ? {
349
+ name,
350
+ status: "warn",
351
+ required: false,
352
+ detail: `the plugin folder is at ${folder.path} and has not loaded in a session yet`,
353
+ fix: `To load it, ${loadStep(c.legacy.present)}.`
354
+ } : {
355
+ name,
356
+ status: "ok",
357
+ required: true,
358
+ detail: `the plugin folder at ${folder.path} loaded, last at ${stamp.at}`
359
+ }
360
+ };
361
+ }
362
+ if (await listedInClaudeFiles(c.env, c.home)) {
363
+ return {
364
+ registered: true,
365
+ check: {
366
+ name,
367
+ status: "warn",
368
+ required: false,
369
+ detail: `${PLUGIN_ID} is registered, and there is no claude binary here to check it`,
370
+ fix: "Run `tenjin doctor` from a Claude Code session to check it."
371
+ }
372
+ };
373
+ }
374
+ return missing(`${PLUGIN_ID} is not registered`);
375
+ }
376
+ async function listedInClaudeFiles(env, home) {
377
+ try {
378
+ const raw = await readFile(
379
+ join(claudeConfigDir(env, home), "plugins", "installed_plugins.json"),
380
+ "utf8"
381
+ );
382
+ const plugins = JSON.parse(raw).plugins;
383
+ return plugins !== null && typeof plugins === "object" && PLUGIN_ID in plugins;
384
+ } catch {
385
+ return false;
386
+ }
387
+ }
388
+ async function serverCheck(binary, env, cwd) {
389
+ const name = "router server";
390
+ const run = await runClaude(binary, ["mcp", "get", PLUGIN_SERVER], {
391
+ env,
392
+ cwd,
393
+ timeoutMs: 45e3
394
+ });
395
+ const status = /Status:\s*(.+)/.exec(run.stdout)?.[1]?.trim();
396
+ if (run.code === 0 && status !== void 0 && /connected/i.test(status) && !/fail/i.test(status)) {
397
+ return { name, status: "ok", required: true, detail: `${PLUGIN_SERVER} connected` };
398
+ }
399
+ return {
400
+ name,
401
+ status: "fail",
402
+ required: true,
403
+ detail: `${PLUGIN_SERVER} did not connect${status !== void 0 ? `: ${status.slice(0, 200)}` : ""}`,
404
+ 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."
405
+ };
406
+ }
407
+ async function migrationCheck(legacy, claude, dataDir, env, cwd) {
408
+ const name = "settings install";
409
+ if (legacy.unreadable !== void 0) {
410
+ return { name, status: "warn", required: false, detail: legacy.unreadable };
411
+ }
412
+ const parts = [
413
+ ...legacy.events.length > 0 ? [`hook entries (${legacy.events.join(", ")})`] : [],
414
+ ...legacy.allowRule || legacy.denyRule ? ["permission rules"] : [],
415
+ ...legacy.statusLine === "ours" || legacy.statusLine === "composed" ? ["a status line"] : [],
416
+ ...legacy.mcp === "ok" ? ["the x402 MCP server"] : []
417
+ ];
418
+ const found = `${parts.join(", ")} from an earlier release in ${legacy.settingsPath}`;
419
+ const lookalikes = legacy.lookalikes.length > 0 ? `; not Tenjin's and left alone: ${legacy.lookalikes.join(", ")}` : "";
420
+ const proof = await pluginProof(claude, dataDir, env, cwd);
421
+ return proof.proven ? {
422
+ name,
423
+ status: "warn",
424
+ required: false,
425
+ detail: `${found}, ready to remove: the plugin has loaded here${lookalikes}`,
426
+ fix: "Run `tenjin install --refresh` to remove it."
427
+ } : {
428
+ name,
429
+ status: "warn",
430
+ required: false,
431
+ detail: `${found}, kept until the plugin loads: ${proof.reason}${lookalikes}`,
432
+ 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."
433
+ };
434
+ }
435
+ function routingCheck(router) {
436
+ const name = "routing";
437
+ if (router instanceof Error) {
438
+ return {
439
+ name,
440
+ status: "warn",
441
+ required: false,
442
+ detail: `the router is off here: ${router.message}`,
443
+ fix: "Fix or delete that file."
444
+ };
445
+ }
446
+ if (!router.enabled.value) {
447
+ const file = router.enabled.path ?? "the config";
448
+ return {
449
+ name,
450
+ status: "warn",
451
+ required: false,
452
+ detail: `router.enabled is false in ${file}, so nothing is routed from this directory`,
453
+ fix: router.enabled.source === "file" ? "Run `tenjin config set router.enabled true` to route again." : `Remove router.enabled from ${file} to route here again.`
454
+ };
455
+ }
456
+ return { name, status: "ok", required: false, detail: "on" };
457
+ }
458
+ async function routingFeeCheck(ctx, settings, fetchImpl) {
459
+ let host;
460
+ try {
461
+ host = new URL(settings.baseUrl).host;
462
+ } catch {
463
+ return {
464
+ name: "routing fee",
465
+ status: "warn",
466
+ required: false,
467
+ detail: "not checked, because the base URL is not a URL"
468
+ };
469
+ }
470
+ const why = await routingFeeBlock({
471
+ dataDir: ctx.dataDir,
472
+ policy: settings.policy,
473
+ rpcUrl: settings.rpcUrl,
474
+ host,
475
+ timeoutMs: ctx.flags.timeout,
476
+ provider: await walletFileExists(ctx.dataDir) ? resolveWalletProvider(ctx) : null,
477
+ ...fetchImpl !== void 0 ? { fetchImpl } : {}
478
+ }).catch(() => null);
479
+ return routingFeeRow(why, host);
480
+ }
481
+ function routingFeeRow(why, host) {
482
+ const u = why === null ? null : unpaid(why);
483
+ if (why === null || u === null) {
484
+ return {
485
+ name: "routing fee",
486
+ status: "ok",
487
+ required: false,
488
+ detail: `$${usd(ROUTING_FEE_ATOMIC)} a call, paid from channel deposits of up to $${usd(CHANNEL_DEPOSIT_ATOMIC)} that count against the spend limits`
489
+ };
490
+ }
491
+ const fixes = {
492
+ no_wallet: `Run \`tenjin wallet create\`, then \`tenjin wallet fund ${SUGGESTED_FUND_USD}\`.`,
493
+ limit_below_deposit: `Raise it with \`tenjin config set maxAutoSpend ${usd(CHANNEL_DEPOSIT_ATOMIC)}\`.`,
494
+ budget_reached: "Room comes back as the rolling day passes, or raise it with `tenjin config set sessionBudget <usd>`.",
495
+ not_allowlisted: `Add ${host} to allowlistCreators, or clear the allowlist.`
496
+ };
497
+ return {
498
+ name: "routing fee",
499
+ status: "warn",
500
+ required: false,
501
+ detail: `${u.reason}, so routing calls take the free path`,
502
+ fix: fixes[why] ?? u.fix
503
+ };
504
+ }
505
+ async function routingFeeBlock(input) {
506
+ const { provider, policy } = input;
507
+ const refused = feeRefusal(policy, input.host);
508
+ if (refused !== null) return refused;
509
+ if (provider === null) return "no_wallet";
510
+ const verified = await provider.verify?.().catch(() => null);
511
+ if (verified !== void 0 && verified !== null && verified.status !== "verified") {
512
+ return "wallet_locked";
513
+ }
514
+ const ledger = await readSpendSummary(input.dataDir);
515
+ const spent = ledger === null ? 0n : spentOf(ledger);
516
+ const { address } = await describeWallet(provider);
517
+ if (await channelCredit(input.dataDir, address) >= ROUTING_FEE_ATOMIC) return null;
518
+ const evaluation = evaluateSpendPolicy(policy, {
519
+ mode: "automatic",
520
+ amountAtomic: CHANNEL_DEPOSIT_ATOMIC,
521
+ creator: input.host,
522
+ sessionSpentAtomic: spent
523
+ });
524
+ if (evaluation.decision !== "allow") return refusedWhy(evaluation.reason);
525
+ const balance = await readUsdcBalance(address, input.rpcUrl, {
526
+ timeoutMs: input.timeoutMs,
527
+ ...input.fetchImpl !== void 0 ? { fetchImpl: input.fetchImpl } : {}
528
+ });
529
+ return balance !== null && balance < CHANNEL_DEPOSIT_ATOMIC ? "wallet_low" : null;
530
+ }
531
+ function experimentalCheck(bazaar) {
532
+ return {
533
+ name: "experimental",
534
+ status: "ok",
535
+ required: false,
536
+ 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"
537
+ };
538
+ }
539
+ function spendCheck(maxAutoSpendAtomic, sessionBudgetAtomic) {
540
+ if (sessionBudgetAtomic === 0n) {
541
+ return {
542
+ name: "spend",
543
+ status: "fail",
544
+ required: true,
545
+ detail: "The daily limit is 0, so positive payments are refused even with --yes.",
546
+ fix: "Choose a daily limit with `tenjin config set sessionBudget <usd|none>`."
547
+ };
548
+ }
549
+ if (maxAutoSpendAtomic === 0n) {
550
+ return {
551
+ name: "spend",
552
+ status: "fail",
553
+ required: true,
554
+ detail: "maxAutoSpend is 0, so every lookup needs approval and none can pay",
555
+ fix: `Raise it with \`tenjin config set maxAutoSpend ${usd(CHANNEL_DEPOSIT_ATOMIC)}\`.`
556
+ };
557
+ }
558
+ const budget = sessionBudgetAtomic === null ? "no daily ceiling" : `${toMoney(sessionBudgetAtomic.toString()).usd} USD a day`;
559
+ return {
560
+ name: "spend",
561
+ status: sessionBudgetAtomic === null ? "warn" : "ok",
562
+ required: false,
563
+ detail: `automatic approval up to ${toMoney(maxAutoSpendAtomic.toString()).usd} USD a call, ${budget}`,
564
+ ...sessionBudgetAtomic === null ? { fix: "Set one with `tenjin config set sessionBudget 1.00`." } : {}
565
+ };
566
+ }
567
+ async function walletCheck(ctx) {
568
+ if (!await walletFileExists(ctx.dataDir)) {
569
+ return [
570
+ {
571
+ name: "wallet",
572
+ status: "fail",
573
+ required: true,
574
+ detail: "no wallet on this machine, so nothing can pay",
575
+ fix: `Run \`tenjin wallet create\`, then \`tenjin wallet fund ${SUGGESTED_FUND_USD}\`.`
576
+ }
577
+ ];
578
+ }
579
+ try {
580
+ const described = await describeWallet(resolveWalletProvider(ctx));
581
+ return [{ name: "wallet", status: "ok", required: true, detail: described.address }];
582
+ } catch (err) {
583
+ return [
584
+ {
585
+ name: "wallet",
586
+ status: "fail",
587
+ required: true,
588
+ detail: err instanceof CliError ? err.message : String(err),
589
+ ...err instanceof CliError && err.fix !== void 0 ? { fix: err.fix } : {}
590
+ }
591
+ ];
592
+ }
593
+ }
594
+ export {
595
+ doctorLines,
596
+ listedInClaudeFiles,
597
+ routingFeeBlock,
598
+ routingFeeRow,
599
+ runRouterDoctor
600
+ };
601
+ //# sourceMappingURL=doctor-KBR34Q4B.js.map