tenjin-cli 0.1.0-alpha.15 → 0.1.0-alpha.16

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 (267) hide show
  1. package/NOTICE.md +54 -7
  2. package/README.md +41 -310
  3. package/dist/{_esm-N4KAVXQR.js → _esm-CE7KNONL.js} +9 -10
  4. package/dist/{ccip-ZGGWQN4X.js → ccip-7RMRLAGV.js} +4 -4
  5. package/dist/{ccip-RPPPKTJR.js → ccip-NLCSCHKI.js} +5 -5
  6. package/dist/chunk-25TJPVBF.js +353 -0
  7. package/dist/chunk-25TJPVBF.js.map +1 -0
  8. package/dist/chunk-2BKS2FVE.js +93 -0
  9. package/dist/chunk-2BKS2FVE.js.map +1 -0
  10. package/dist/chunk-2QYORQBF.js +55 -0
  11. package/dist/chunk-2QYORQBF.js.map +1 -0
  12. package/dist/{chunk-NIKXHWOL.js → chunk-2U5ZVEV3.js} +16 -16
  13. package/dist/chunk-2U5ZVEV3.js.map +1 -0
  14. package/dist/{chunk-HPJGOLTN.js → chunk-3AJS6LLN.js} +13 -8
  15. package/dist/chunk-3AJS6LLN.js.map +1 -0
  16. package/dist/{chunk-KINZ23CV.js → chunk-3AUDA53C.js} +4740 -23
  17. package/dist/chunk-3AUDA53C.js.map +1 -0
  18. package/dist/{chunk-MJZZTKCC.js → chunk-56MOAIP5.js} +5 -10
  19. package/dist/chunk-56MOAIP5.js.map +1 -0
  20. package/dist/{chunk-U5S527PP.js → chunk-5IEP5EGE.js} +3 -3
  21. package/dist/chunk-5X4SZ5BF.js +227 -0
  22. package/dist/chunk-5X4SZ5BF.js.map +1 -0
  23. package/dist/chunk-7WEQQJLG.js +68 -0
  24. package/dist/chunk-7WEQQJLG.js.map +1 -0
  25. package/dist/{chunk-7FK2UN2T.js → chunk-AWQPGIR6.js} +65 -67
  26. package/dist/{chunk-7FK2UN2T.js.map → chunk-AWQPGIR6.js.map} +1 -1
  27. package/dist/{chunk-ZFJJ3EXC.js → chunk-BBVUVBUO.js} +516 -185
  28. package/dist/chunk-BBVUVBUO.js.map +1 -0
  29. package/dist/{chunk-JBIKAAT3.js → chunk-BFFM2WFK.js} +8 -8
  30. package/dist/chunk-BFFM2WFK.js.map +1 -0
  31. package/dist/{chunk-KYQVEKP5.js → chunk-BPMWXTFX.js} +8 -8
  32. package/dist/chunk-DMZZLPZN.js +205 -0
  33. package/dist/chunk-DMZZLPZN.js.map +1 -0
  34. package/dist/{chunk-47PP7TAG.js → chunk-EGELTSPU.js} +1356 -1356
  35. package/dist/chunk-EGELTSPU.js.map +1 -0
  36. package/dist/chunk-GULLJQXA.js +698 -0
  37. package/dist/chunk-GULLJQXA.js.map +1 -0
  38. package/dist/{chunk-S5RYMCV6.js → chunk-HPWO4O6S.js} +3 -3
  39. package/dist/chunk-HVRC33OL.js +174 -0
  40. package/dist/chunk-HVRC33OL.js.map +1 -0
  41. package/dist/{chunk-W6R3HAAG.js → chunk-JRGFKVAZ.js} +2 -2
  42. package/dist/{chunk-XJN5WUKL.js → chunk-KG3D7FIF.js} +2 -2
  43. package/dist/chunk-L3PVMIYQ.js +10328 -0
  44. package/dist/chunk-L3PVMIYQ.js.map +1 -0
  45. package/dist/{chunk-QW2Q2KAH.js → chunk-LHHMV4GU.js} +2 -2
  46. package/dist/{chunk-ZOBNS7CX.js → chunk-MEFB5KHA.js} +4 -18
  47. package/dist/chunk-MEFB5KHA.js.map +1 -0
  48. package/dist/{chunk-M2O56UK7.js → chunk-N35E6CM2.js} +293 -163
  49. package/dist/chunk-N35E6CM2.js.map +1 -0
  50. package/dist/chunk-OCBHUHWB.js +69 -0
  51. package/dist/chunk-OCBHUHWB.js.map +1 -0
  52. package/dist/chunk-OIM4HLN6.js +1405 -0
  53. package/dist/chunk-OIM4HLN6.js.map +1 -0
  54. package/dist/{chunk-VYOJOX4Z.js → chunk-OJLYNM4Z.js} +54 -33
  55. package/dist/chunk-OJLYNM4Z.js.map +1 -0
  56. package/dist/{chunk-POJRB2AE.js → chunk-POUWHWID.js} +2 -2
  57. package/dist/chunk-PZEN5PHN.js +285 -0
  58. package/dist/chunk-PZEN5PHN.js.map +1 -0
  59. package/dist/chunk-SKAHDQH7.js +1785 -0
  60. package/dist/chunk-SKAHDQH7.js.map +1 -0
  61. package/dist/{chunk-KZAAWQNP.js → chunk-TTNESUPQ.js} +3 -3
  62. package/dist/chunk-U5DXNFJC.js +137 -0
  63. package/dist/chunk-U5DXNFJC.js.map +1 -0
  64. package/dist/chunk-USS336NF.js +165 -0
  65. package/dist/chunk-USS336NF.js.map +1 -0
  66. package/dist/{chunk-UO22YNY4.js → chunk-WH7OWT6G.js} +49 -1
  67. package/dist/chunk-WH7OWT6G.js.map +1 -0
  68. package/dist/chunk-WXC57XGG.js +29 -0
  69. package/dist/chunk-WXC57XGG.js.map +1 -0
  70. package/dist/{chunk-YLYINX2H.js → chunk-XZKD7DIF.js} +3 -3
  71. package/dist/{chunk-CPCX67TI.js → chunk-YEETV6IW.js} +1079 -1039
  72. package/dist/chunk-YEETV6IW.js.map +1 -0
  73. package/dist/{chunk-OLWTRUTS.js → chunk-YJHHCWM3.js} +35 -16
  74. package/dist/chunk-YJHHCWM3.js.map +1 -0
  75. package/dist/{cli-KKRKBU5T.js → cli-M3XCSOU6.js} +289 -374
  76. package/dist/cli-M3XCSOU6.js.map +1 -0
  77. package/dist/config-MXOX7XDR.js +41 -0
  78. package/dist/{dist-U4M6QCKE.js → dist-3LOO6M4U.js} +10 -10
  79. package/dist/doctor-LU4YIZWM.js +349 -0
  80. package/dist/doctor-LU4YIZWM.js.map +1 -0
  81. package/dist/{ethersCompat-Df4a6QIZ-WHYKB6HA.js → ethersCompat-Df4a6QIZ-THAVUGIJ.js} +5 -5
  82. package/dist/{chunk-KAJZHIQ4.js → fund-A54P2QFK.js} +80 -24
  83. package/dist/fund-A54P2QFK.js.map +1 -0
  84. package/dist/hook-command-U6KWPEDQ.js +377 -0
  85. package/dist/hook-command-U6KWPEDQ.js.map +1 -0
  86. package/dist/index.js +8 -3
  87. package/dist/index.js.map +1 -1
  88. package/dist/install-XUM2XSHW.js +53 -0
  89. package/dist/install-wallet-QIOFORTX.js +105 -0
  90. package/dist/install-wallet-QIOFORTX.js.map +1 -0
  91. package/dist/{run-XYTQ5TWQ.js → mcp-HJC2PLRV.js} +3727 -10670
  92. package/dist/mcp-HJC2PLRV.js.map +1 -0
  93. package/dist/paths-P2N4JTDZ.js +49 -0
  94. package/dist/pay-SBXZEPEP.js +37 -0
  95. package/dist/redact-46ZHF2NH.js +17 -0
  96. package/dist/{secp256k1-XRPVBC6V.js → secp256k1-ZZZT2CAX.js} +3 -3
  97. package/dist/{send-G746D7PQ.js → send-ASD2ZXJD.js} +28 -29
  98. package/dist/send-ASD2ZXJD.js.map +1 -0
  99. package/dist/{chunk-QZ6ROAJU.js → skill-placement-NFVHY6A3.js} +157 -11
  100. package/dist/skill-placement-NFVHY6A3.js.map +1 -0
  101. package/dist/status-T2SDB57A.js +63 -0
  102. package/dist/status-T2SDB57A.js.map +1 -0
  103. package/dist/status-line-CGPUSDMC.js +71 -0
  104. package/dist/status-line-CGPUSDMC.js.map +1 -0
  105. package/dist/status-line-wiring-BYPHTYZE.js +30 -0
  106. package/dist/tenjin-daemon.mjs +20060 -0
  107. package/dist/tenjin-shim.mjs +251 -0
  108. package/dist/tenjin-vitest-reporter.mjs +49 -0
  109. package/dist/uninstall-FKYZHAM3.js +144 -0
  110. package/dist/uninstall-FKYZHAM3.js.map +1 -0
  111. package/dist/{update-R76LHOZW.js → update-ANJ2AOTN.js} +133 -16
  112. package/dist/update-ANJ2AOTN.js.map +1 -0
  113. package/dist/{viemAdapter-By13KInL-TUQJBMHM.js → viemAdapter-By13KInL-X2VY6CY3.js} +5 -5
  114. package/dist/wallet-PWAHVKWW.js +31 -0
  115. package/dist/wallet-kdf-worker.mjs +980 -0
  116. package/docs/agent-permissions.md +65 -354
  117. package/docs/safety-model.md +16 -6
  118. package/package.json +8 -7
  119. package/LICENSE +0 -21
  120. package/dist/buy-VIRNSYGN.js +0 -47
  121. package/dist/chunk-2MYQN7HM.js +0 -247
  122. package/dist/chunk-2MYQN7HM.js.map +0 -1
  123. package/dist/chunk-2RF2GIJQ.js +0 -1188
  124. package/dist/chunk-2RF2GIJQ.js.map +0 -1
  125. package/dist/chunk-3GL2Z5QK.js +0 -57
  126. package/dist/chunk-3GL2Z5QK.js.map +0 -1
  127. package/dist/chunk-47PP7TAG.js.map +0 -1
  128. package/dist/chunk-4CQIDQOT.js +0 -167
  129. package/dist/chunk-4CQIDQOT.js.map +0 -1
  130. package/dist/chunk-4KG27W2S.js +0 -614
  131. package/dist/chunk-4KG27W2S.js.map +0 -1
  132. package/dist/chunk-5QQTYWEU.js +0 -199
  133. package/dist/chunk-5QQTYWEU.js.map +0 -1
  134. package/dist/chunk-65DTCCJ7.js +0 -21
  135. package/dist/chunk-65DTCCJ7.js.map +0 -1
  136. package/dist/chunk-A5DKHMUN.js +0 -173
  137. package/dist/chunk-A5DKHMUN.js.map +0 -1
  138. package/dist/chunk-B63XPWQ4.js +0 -246
  139. package/dist/chunk-B63XPWQ4.js.map +0 -1
  140. package/dist/chunk-CAR6FHK6.js +0 -105
  141. package/dist/chunk-CAR6FHK6.js.map +0 -1
  142. package/dist/chunk-CPCX67TI.js.map +0 -1
  143. package/dist/chunk-CQBVCYI2.js +0 -162
  144. package/dist/chunk-CQBVCYI2.js.map +0 -1
  145. package/dist/chunk-DBU5CXBV.js +0 -4731
  146. package/dist/chunk-DBU5CXBV.js.map +0 -1
  147. package/dist/chunk-DHJD77OW.js +0 -81
  148. package/dist/chunk-DHJD77OW.js.map +0 -1
  149. package/dist/chunk-EDZSNPE5.js +0 -35
  150. package/dist/chunk-EDZSNPE5.js.map +0 -1
  151. package/dist/chunk-EFWZPUTC.js +0 -65
  152. package/dist/chunk-EFWZPUTC.js.map +0 -1
  153. package/dist/chunk-EPFL6CTE.js +0 -448
  154. package/dist/chunk-EPFL6CTE.js.map +0 -1
  155. package/dist/chunk-GHLVXVZD.js +0 -142
  156. package/dist/chunk-GHLVXVZD.js.map +0 -1
  157. package/dist/chunk-H3SOOJ2I.js +0 -580
  158. package/dist/chunk-H3SOOJ2I.js.map +0 -1
  159. package/dist/chunk-HPJGOLTN.js.map +0 -1
  160. package/dist/chunk-HRGBS2PA.js +0 -203
  161. package/dist/chunk-HRGBS2PA.js.map +0 -1
  162. package/dist/chunk-ITUXPJIS.js +0 -314
  163. package/dist/chunk-ITUXPJIS.js.map +0 -1
  164. package/dist/chunk-JBIKAAT3.js.map +0 -1
  165. package/dist/chunk-KAJZHIQ4.js.map +0 -1
  166. package/dist/chunk-KINZ23CV.js.map +0 -1
  167. package/dist/chunk-LRYV3SK7.js +0 -235
  168. package/dist/chunk-LRYV3SK7.js.map +0 -1
  169. package/dist/chunk-M2O56UK7.js.map +0 -1
  170. package/dist/chunk-MJZZTKCC.js.map +0 -1
  171. package/dist/chunk-NIKXHWOL.js.map +0 -1
  172. package/dist/chunk-OKDRDT74.js +0 -209
  173. package/dist/chunk-OKDRDT74.js.map +0 -1
  174. package/dist/chunk-OKYSNAS3.js +0 -2144
  175. package/dist/chunk-OKYSNAS3.js.map +0 -1
  176. package/dist/chunk-OLWTRUTS.js.map +0 -1
  177. package/dist/chunk-QQ6ELLSA.js +0 -143
  178. package/dist/chunk-QQ6ELLSA.js.map +0 -1
  179. package/dist/chunk-QZ6ROAJU.js.map +0 -1
  180. package/dist/chunk-R7RSCBI7.js +0 -794
  181. package/dist/chunk-R7RSCBI7.js.map +0 -1
  182. package/dist/chunk-SGK2B724.js +0 -67
  183. package/dist/chunk-SGK2B724.js.map +0 -1
  184. package/dist/chunk-U6VPKMGC.js +0 -390
  185. package/dist/chunk-U6VPKMGC.js.map +0 -1
  186. package/dist/chunk-UHTVXQ2O.js +0 -140
  187. package/dist/chunk-UHTVXQ2O.js.map +0 -1
  188. package/dist/chunk-UO22YNY4.js.map +0 -1
  189. package/dist/chunk-US456VUI.js +0 -149
  190. package/dist/chunk-US456VUI.js.map +0 -1
  191. package/dist/chunk-V44J2MXV.js +0 -400
  192. package/dist/chunk-V44J2MXV.js.map +0 -1
  193. package/dist/chunk-VJQKL3YH.js +0 -216
  194. package/dist/chunk-VJQKL3YH.js.map +0 -1
  195. package/dist/chunk-VJSQSLBM.js +0 -1442
  196. package/dist/chunk-VJSQSLBM.js.map +0 -1
  197. package/dist/chunk-VYOJOX4Z.js.map +0 -1
  198. package/dist/chunk-WY2K35OL.js +0 -269
  199. package/dist/chunk-WY2K35OL.js.map +0 -1
  200. package/dist/chunk-ZFJJ3EXC.js.map +0 -1
  201. package/dist/chunk-ZOBNS7CX.js.map +0 -1
  202. package/dist/cli-KKRKBU5T.js.map +0 -1
  203. package/dist/config-JMRUNYE6.js +0 -37
  204. package/dist/discover-B5HF6SHM.js +0 -102
  205. package/dist/discover-B5HF6SHM.js.map +0 -1
  206. package/dist/doctor-ZBG7X66D.js +0 -32
  207. package/dist/edit-PZJIILQE.js +0 -40
  208. package/dist/fund-EUDH5KPA.js +0 -40
  209. package/dist/inspect-QC6WEQPN.js +0 -37
  210. package/dist/install-GNK2W3PI.js +0 -972
  211. package/dist/install-GNK2W3PI.js.map +0 -1
  212. package/dist/outcome-KSGWZHUS.js +0 -24
  213. package/dist/pay-BC4UICPA.js +0 -361
  214. package/dist/pay-BC4UICPA.js.map +0 -1
  215. package/dist/publish-LXWFDIKF.js +0 -42
  216. package/dist/read-JMNUQ56P.js +0 -160
  217. package/dist/read-JMNUQ56P.js.map +0 -1
  218. package/dist/run-XYTQ5TWQ.js.map +0 -1
  219. package/dist/search-TSQAB45E.js +0 -25
  220. package/dist/secp256k1-XRPVBC6V.js.map +0 -1
  221. package/dist/send-G746D7PQ.js.map +0 -1
  222. package/dist/session-JBKWMJ24.js +0 -89
  223. package/dist/session-JBKWMJ24.js.map +0 -1
  224. package/dist/skill-heal-WKD67SLJ.js +0 -92
  225. package/dist/skill-heal-WKD67SLJ.js.map +0 -1
  226. package/dist/skill-placement-RIU4AMC2.js +0 -20
  227. package/dist/skill-placement-RIU4AMC2.js.map +0 -1
  228. package/dist/uninstall-5E263VTS.js +0 -73
  229. package/dist/uninstall-5E263VTS.js.map +0 -1
  230. package/dist/update-R76LHOZW.js.map +0 -1
  231. package/dist/usdc-4VCDHFWX.js +0 -38
  232. package/dist/usdc-4VCDHFWX.js.map +0 -1
  233. package/dist/viemAdapter-By13KInL-TUQJBMHM.js.map +0 -1
  234. package/dist/wallet-TQ7D5EQ7.js +0 -41
  235. package/dist/wallet-TQ7D5EQ7.js.map +0 -1
  236. package/dist/wallet-ZAVXWLWP.js +0 -32
  237. package/dist/wallet-ZAVXWLWP.js.map +0 -1
  238. package/docs/command-reference.md +0 -303
  239. package/skills/tenjin/SKILL.md +0 -373
  240. package/skills/tenjin-pay/SKILL.md +0 -76
  241. package/skills/tenjin-publish/SKILL.md +0 -227
  242. package/skills/tenjin-publish/references/maintain.md +0 -39
  243. package/skills/tenjin-search/SKILL.md +0 -154
  244. package/skills/tenjin-search/references/permissions.md +0 -112
  245. /package/dist/{_esm-N4KAVXQR.js.map → _esm-CE7KNONL.js.map} +0 -0
  246. /package/dist/{buy-VIRNSYGN.js.map → ccip-7RMRLAGV.js.map} +0 -0
  247. /package/dist/{ccip-RPPPKTJR.js.map → ccip-NLCSCHKI.js.map} +0 -0
  248. /package/dist/{chunk-U5S527PP.js.map → chunk-5IEP5EGE.js.map} +0 -0
  249. /package/dist/{chunk-KYQVEKP5.js.map → chunk-BPMWXTFX.js.map} +0 -0
  250. /package/dist/{chunk-S5RYMCV6.js.map → chunk-HPWO4O6S.js.map} +0 -0
  251. /package/dist/{chunk-W6R3HAAG.js.map → chunk-JRGFKVAZ.js.map} +0 -0
  252. /package/dist/{chunk-XJN5WUKL.js.map → chunk-KG3D7FIF.js.map} +0 -0
  253. /package/dist/{chunk-QW2Q2KAH.js.map → chunk-LHHMV4GU.js.map} +0 -0
  254. /package/dist/{chunk-POJRB2AE.js.map → chunk-POUWHWID.js.map} +0 -0
  255. /package/dist/{chunk-KZAAWQNP.js.map → chunk-TTNESUPQ.js.map} +0 -0
  256. /package/dist/{chunk-YLYINX2H.js.map → chunk-XZKD7DIF.js.map} +0 -0
  257. /package/dist/{ccip-ZGGWQN4X.js.map → config-MXOX7XDR.js.map} +0 -0
  258. /package/dist/{dist-U4M6QCKE.js.map → dist-3LOO6M4U.js.map} +0 -0
  259. /package/dist/{config-JMRUNYE6.js.map → ethersCompat-Df4a6QIZ-THAVUGIJ.js.map} +0 -0
  260. /package/dist/{doctor-ZBG7X66D.js.map → install-XUM2XSHW.js.map} +0 -0
  261. /package/dist/{edit-PZJIILQE.js.map → paths-P2N4JTDZ.js.map} +0 -0
  262. /package/dist/{ethersCompat-Df4a6QIZ-WHYKB6HA.js.map → pay-SBXZEPEP.js.map} +0 -0
  263. /package/dist/{fund-EUDH5KPA.js.map → redact-46ZHF2NH.js.map} +0 -0
  264. /package/dist/{inspect-QC6WEQPN.js.map → secp256k1-ZZZT2CAX.js.map} +0 -0
  265. /package/dist/{outcome-KSGWZHUS.js.map → status-line-wiring-BYPHTYZE.js.map} +0 -0
  266. /package/dist/{publish-LXWFDIKF.js.map → viemAdapter-By13KInL-X2VY6CY3.js.map} +0 -0
  267. /package/dist/{search-TSQAB45E.js.map → wallet-PWAHVKWW.js.map} +0 -0
@@ -0,0 +1,41 @@
1
+ import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
+ import {
3
+ ROUTER_DEFAULTS,
4
+ persistBazaarPay,
5
+ persistGrantDeclined,
6
+ persistHookArm,
7
+ persistInstallHarness,
8
+ persistPublishMode,
9
+ persistRouterDefaults,
10
+ persistRouterProject,
11
+ runConfigGet,
12
+ runConfigList,
13
+ runConfigSet
14
+ } from "./chunk-GULLJQXA.js";
15
+ import "./chunk-WXC57XGG.js";
16
+ import "./chunk-2QYORQBF.js";
17
+ import "./chunk-MEFB5KHA.js";
18
+ import "./chunk-U5DXNFJC.js";
19
+ import "./chunk-OJLYNM4Z.js";
20
+ import "./chunk-WH7OWT6G.js";
21
+ import "./chunk-BBVUVBUO.js";
22
+ import "./chunk-SKAHDQH7.js";
23
+ import "./chunk-BFFM2WFK.js";
24
+ import "./chunk-OCBHUHWB.js";
25
+ import "./chunk-2BKS2FVE.js";
26
+ import "./chunk-7WEQQJLG.js";
27
+ import "./chunk-ZXTAQYNA.js";
28
+ export {
29
+ ROUTER_DEFAULTS,
30
+ persistBazaarPay,
31
+ persistGrantDeclined,
32
+ persistHookArm,
33
+ persistInstallHarness,
34
+ persistPublishMode,
35
+ persistRouterDefaults,
36
+ persistRouterProject,
37
+ runConfigGet,
38
+ runConfigList,
39
+ runConfigSet
40
+ };
41
+ //# sourceMappingURL=config-MXOX7XDR.js.map
@@ -61,10 +61,10 @@ var require_src = __commonJS({
61
61
  });
62
62
 
63
63
  // node_modules/.pnpm/@clack+core@1.4.3/node_modules/@clack/core/dist/index.mjs
64
- import { styleText } from "util";
65
- import { stdout, stdin } from "process";
66
- import * as l from "readline";
67
- import l__default from "readline";
64
+ import { styleText } from "node:util";
65
+ import { stdout, stdin } from "node:process";
66
+ import * as l from "node:readline";
67
+ import l__default from "node:readline";
68
68
 
69
69
  // node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
70
70
  var getCodePointsLength = /* @__PURE__ */ (() => {
@@ -404,7 +404,7 @@ function wrapAnsi(string, columns, options) {
404
404
 
405
405
  // node_modules/.pnpm/@clack+core@1.4.3/node_modules/@clack/core/dist/index.mjs
406
406
  var import_sisteransi = __toESM(require_src(), 1);
407
- import { ReadStream } from "tty";
407
+ import { ReadStream } from "node:tty";
408
408
  function findCursor(s, o2, l2) {
409
409
  if (!l2.some((r2) => !r2.disabled))
410
410
  return s;
@@ -1367,11 +1367,11 @@ var n2 = class extends V {
1367
1367
  };
1368
1368
 
1369
1369
  // node_modules/.pnpm/@clack+prompts@1.7.0/node_modules/@clack/prompts/dist/index.mjs
1370
- import { styleText as styleText2, stripVTControlCharacters } from "util";
1371
- import process$1 from "process";
1370
+ import { styleText as styleText2, stripVTControlCharacters } from "node:util";
1371
+ import process$1 from "node:process";
1372
1372
  var import_sisteransi2 = __toESM(require_src(), 1);
1373
- import { existsSync, lstatSync, readdirSync } from "fs";
1374
- import { dirname, join } from "path";
1373
+ import { existsSync, lstatSync, readdirSync } from "node:fs";
1374
+ import { dirname, join } from "node:path";
1375
1375
  function isUnicodeSupported() {
1376
1376
  if (process$1.platform !== "win32") {
1377
1377
  return process$1.env.TERM !== "linux";
@@ -2839,4 +2839,4 @@ export {
2839
2839
  unicodeOr,
2840
2840
  updateSettings
2841
2841
  };
2842
- //# sourceMappingURL=dist-U4M6QCKE.js.map
2842
+ //# sourceMappingURL=dist-3LOO6M4U.js.map
@@ -0,0 +1,349 @@
1
+ import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
+ import {
3
+ ROUTER_PATH
4
+ } from "./chunk-USS336NF.js";
5
+ import {
6
+ httpRequest
7
+ } from "./chunk-5X4SZ5BF.js";
8
+ import {
9
+ describeWallet,
10
+ resolveWalletProvider,
11
+ walletFileExists
12
+ } from "./chunk-YEETV6IW.js";
13
+ import "./chunk-DMZZLPZN.js";
14
+ import "./chunk-N35E6CM2.js";
15
+ import "./chunk-JRGFKVAZ.js";
16
+ import "./chunk-EGELTSPU.js";
17
+ import "./chunk-KG3D7FIF.js";
18
+ import "./chunk-RBJPAZFI.js";
19
+ import "./chunk-BPMWXTFX.js";
20
+ import {
21
+ ALLOW_RULE,
22
+ MCP_SERVER_NAME,
23
+ mcpAddCommand,
24
+ mcpScope,
25
+ readMcpEntry,
26
+ routerSettingsPath
27
+ } from "./chunk-25TJPVBF.js";
28
+ import "./chunk-YJHHCWM3.js";
29
+ import "./chunk-GULLJQXA.js";
30
+ import "./chunk-WXC57XGG.js";
31
+ import "./chunk-2QYORQBF.js";
32
+ import "./chunk-MEFB5KHA.js";
33
+ import {
34
+ onPath
35
+ } from "./chunk-U5DXNFJC.js";
36
+ import {
37
+ resolveContextSettings
38
+ } from "./chunk-OJLYNM4Z.js";
39
+ import {
40
+ toMoney
41
+ } from "./chunk-WH7OWT6G.js";
42
+ import {
43
+ PRODUCTION_ORIGIN
44
+ } from "./chunk-BBVUVBUO.js";
45
+ import {
46
+ STATUS_LINE_COMMAND,
47
+ inspectStatusLine
48
+ } from "./chunk-HVRC33OL.js";
49
+ import {
50
+ inspectHooksFile,
51
+ ownsHookEntry
52
+ } from "./chunk-SKAHDQH7.js";
53
+ import "./chunk-BFFM2WFK.js";
54
+ import {
55
+ CliError
56
+ } from "./chunk-OCBHUHWB.js";
57
+ import "./chunk-2BKS2FVE.js";
58
+ import "./chunk-7WEQQJLG.js";
59
+ import "./chunk-ZXTAQYNA.js";
60
+
61
+ // src/router/doctor.ts
62
+ import { execFile } from "node:child_process";
63
+ import { homedir } from "node:os";
64
+ import { promisify } from "node:util";
65
+ var exec = promisify(execFile);
66
+ var NODE_FLOOR = 24;
67
+ async function runRouterDoctor(ctx, deps = {}) {
68
+ const env = deps.env ?? process.env;
69
+ const settings = await resolveContextSettings(ctx);
70
+ const settingsPath = routerSettingsPath({
71
+ ...deps.project === true ? { project: true } : {},
72
+ ...deps.homeDir !== void 0 ? { homeDir: deps.homeDir } : {},
73
+ ...deps.cwd !== void 0 ? { cwd: deps.cwd } : {}
74
+ });
75
+ const checks = [nodeCheck(deps.nodeVersion ?? process.version)];
76
+ checks.push(await hooksCheck(settingsPath, ctx.dataDir));
77
+ checks.push(await statusLineCheck(settingsPath));
78
+ checks.push(
79
+ await mcpCheck(
80
+ deps,
81
+ env,
82
+ deps.project === true,
83
+ deps.cwd ?? process.cwd(),
84
+ deps.homeDir ?? homedir()
85
+ )
86
+ );
87
+ checks.push(spendCheck(settings.policy.maxAutoSpendAtomic, settings.policy.sessionBudgetAtomic));
88
+ checks.push(...await walletCheck(ctx));
89
+ checks.push(await routerCheck(settings.baseUrl, ctx.flags.timeout, deps.fetchImpl));
90
+ const failure = checks.find((c) => c.status === "fail" && c.required);
91
+ const data = { checks, dataDir: ctx.dataDir, baseUrl: settings.baseUrl, settingsPath };
92
+ if (failure !== void 0) {
93
+ throw new CliError("REFUSED", failure.detail, {
94
+ ...failure.fix !== void 0 ? { fix: failure.fix } : {},
95
+ details: data
96
+ });
97
+ }
98
+ const bad = checks.filter((c) => c.status !== "ok").length;
99
+ return {
100
+ data,
101
+ humanLines: [
102
+ ...checks.map(
103
+ (c) => `${c.status === "ok" ? "ok " : c.status === "warn" ? "warn" : "fail"} ${c.name}: ${c.detail}`
104
+ ),
105
+ bad === 0 ? `${checks.length} checks, all pass.` : `${checks.length} checks, ${bad} to look at.`
106
+ ]
107
+ };
108
+ }
109
+ function nodeCheck(version) {
110
+ const major = Number(/^v(\d+)/.exec(version)?.[1] ?? "0");
111
+ return major >= NODE_FLOOR ? { name: "node", status: "ok", required: true, detail: version } : {
112
+ name: "node",
113
+ status: "fail",
114
+ required: true,
115
+ detail: `${version} is below the Node ${NODE_FLOOR} floor.`,
116
+ fix: `Install Node ${NODE_FLOOR} or newer, then re-run \`tenjin doctor\`.`
117
+ };
118
+ }
119
+ async function statusLineCheck(path) {
120
+ const found = await inspectStatusLine(path);
121
+ const name = "status line";
122
+ if (found.warning !== void 0) {
123
+ return { name, status: "warn", required: false, detail: found.warning };
124
+ }
125
+ switch (found.state) {
126
+ case "ours":
127
+ return { name, status: "ok", required: false, detail: `\`${STATUS_LINE_COMMAND}\`` };
128
+ case "composed":
129
+ return {
130
+ name,
131
+ status: "ok",
132
+ required: false,
133
+ detail: "yours, with the x402 footer appended"
134
+ };
135
+ case "foreign":
136
+ return {
137
+ name,
138
+ status: "warn",
139
+ required: false,
140
+ detail: "yours is registered and was left alone, so there is no live x402 footer",
141
+ fix: "Run `tenjin install --status-line compose` to show both."
142
+ };
143
+ default:
144
+ return {
145
+ name,
146
+ status: "warn",
147
+ required: false,
148
+ detail: "not registered, so lookups run without the live footer",
149
+ fix: "Run `tenjin install` to register it."
150
+ };
151
+ }
152
+ }
153
+ async function hooksCheck(path, dataDir) {
154
+ const found = await inspectHooksFile(path);
155
+ if ("refusal" in found) {
156
+ return {
157
+ name: "hooks",
158
+ status: "fail",
159
+ required: true,
160
+ detail: found.refusal.message,
161
+ fix: "Fix the reported file, then run `tenjin install`."
162
+ };
163
+ }
164
+ const events = Object.entries(found.hooks).filter(([, list]) => list.some((entry) => ownsHookEntry(entry, dataDir))).map(([event]) => event);
165
+ const allow = allowRules(found.settings);
166
+ if (events.length === 0) {
167
+ return {
168
+ name: "hooks",
169
+ status: "fail",
170
+ required: true,
171
+ detail: `no Tenjin hook entries in ${path}`,
172
+ fix: "Run `tenjin install`, then restart Claude Code."
173
+ };
174
+ }
175
+ if (!allow.includes(ALLOW_RULE)) {
176
+ return {
177
+ name: "hooks",
178
+ status: "warn",
179
+ required: false,
180
+ detail: `${events.join(" and ")} registered, but ${ALLOW_RULE} is not allowed, so every lookup asks`,
181
+ fix: "Run `tenjin install` to write the permission rule."
182
+ };
183
+ }
184
+ return {
185
+ name: "hooks",
186
+ status: "ok",
187
+ required: true,
188
+ detail: `${events.join(" and ")} registered, ${ALLOW_RULE} allowed`
189
+ };
190
+ }
191
+ function allowRules(settings) {
192
+ const permissions = settings.permissions;
193
+ if (permissions === null || typeof permissions !== "object" || Array.isArray(permissions)) {
194
+ return [];
195
+ }
196
+ const allow = permissions.allow;
197
+ return Array.isArray(allow) ? allow.filter((r) => typeof r === "string") : [];
198
+ }
199
+ async function mcpCheck(deps, env, project, cwd, home) {
200
+ const scope = mcpScope(project);
201
+ const add = mcpAddCommand(project);
202
+ const where = scope === "project" ? "this project's .mcp.json" : "~/.claude.json";
203
+ const { found, state } = await (deps.readMcpEntry ?? readMcpEntry)(scope, cwd, home);
204
+ if (state === "ok") {
205
+ return {
206
+ name: "mcp",
207
+ status: "ok",
208
+ required: true,
209
+ detail: `${MCP_SERVER_NAME} registered (${scope} scope), running \`tenjin mcp\``
210
+ };
211
+ }
212
+ if (state === "wrong-command") {
213
+ return {
214
+ name: "mcp",
215
+ status: "fail",
216
+ required: true,
217
+ detail: `${MCP_SERVER_NAME} registered but not \`tenjin mcp\`: the entry in ${where} launches something else, so the request tool is not there`,
218
+ fix: `Remove it and re-run \`tenjin install\`${project ? " --project" : ""}, or: ${add}`
219
+ };
220
+ }
221
+ if (state === "unreadable") {
222
+ return {
223
+ name: "mcp",
224
+ status: "fail",
225
+ required: true,
226
+ detail: `${where} could not be read, so whether ${MCP_SERVER_NAME} is registered is unknown`,
227
+ fix: `Fix the JSON in ${where}, then re-run \`tenjin install\`${project ? " --project" : ""}.`
228
+ };
229
+ }
230
+ if (scope === "user") {
231
+ const which = deps.which ?? ((bin) => onPath(bin, env));
232
+ if (which("claude")) {
233
+ const seen = await (deps.readMcp ?? claudeHasServer)({ scope, cwd }).catch(() => false);
234
+ if (seen) {
235
+ return {
236
+ name: "mcp",
237
+ status: "warn",
238
+ required: false,
239
+ detail: `${MCP_SERVER_NAME} is registered somewhere this check cannot read, so what it launches was not verified`,
240
+ fix: `Re-run \`tenjin install\` to write a registration this build can check, or: ${add}`
241
+ };
242
+ }
243
+ }
244
+ }
245
+ return {
246
+ name: "mcp",
247
+ status: "fail",
248
+ required: true,
249
+ detail: found ? `${MCP_SERVER_NAME} is not in ${where}, so there is no request tool` : `${where} does not exist, so ${MCP_SERVER_NAME} is not registered`,
250
+ fix: `Run \`tenjin install\`${project ? " --project" : ""}, or: ${add}`
251
+ };
252
+ }
253
+ async function claudeHasServer(opts) {
254
+ const { stdout } = await exec("claude", ["mcp", "get", MCP_SERVER_NAME], {
255
+ timeout: 15e3,
256
+ cwd: opts.cwd
257
+ });
258
+ return stdout.includes(MCP_SERVER_NAME) && !/no mcp server/i.test(stdout);
259
+ }
260
+ function spendCheck(maxAutoSpendAtomic, sessionBudgetAtomic) {
261
+ if (maxAutoSpendAtomic === 0n) {
262
+ return {
263
+ name: "spend",
264
+ status: "fail",
265
+ required: true,
266
+ detail: "maxAutoSpend is 0, so every lookup needs approval and none can pay",
267
+ fix: "Run `tenjin install`, or `tenjin config set maxAutoSpend 0.10`."
268
+ };
269
+ }
270
+ const budget = sessionBudgetAtomic === 0n ? "no daily ceiling" : `${toMoney(sessionBudgetAtomic.toString()).usd} USD a day`;
271
+ return {
272
+ name: "spend",
273
+ status: sessionBudgetAtomic === 0n ? "warn" : "ok",
274
+ required: false,
275
+ detail: `at most ${toMoney(maxAutoSpendAtomic.toString()).usd} USD a call, ${budget}`,
276
+ ...sessionBudgetAtomic === 0n ? { fix: "Set one with `tenjin config set sessionBudget 1.00`." } : {}
277
+ };
278
+ }
279
+ async function walletCheck(ctx) {
280
+ if (!await walletFileExists(ctx.dataDir)) {
281
+ return [
282
+ {
283
+ name: "wallet",
284
+ status: "fail",
285
+ required: true,
286
+ detail: "no wallet on this machine, so nothing can pay",
287
+ fix: "Run `tenjin wallet create`, then `tenjin wallet fund`."
288
+ }
289
+ ];
290
+ }
291
+ try {
292
+ const described = await describeWallet(resolveWalletProvider(ctx));
293
+ return [{ name: "wallet", status: "ok", required: true, detail: described.address }];
294
+ } catch (err) {
295
+ return [
296
+ {
297
+ name: "wallet",
298
+ status: "fail",
299
+ required: true,
300
+ detail: err instanceof CliError ? err.message : String(err),
301
+ ...err instanceof CliError && err.fix !== void 0 ? { fix: err.fix } : {}
302
+ }
303
+ ];
304
+ }
305
+ }
306
+ async function routerCheck(baseUrl, timeoutMs, fetchImpl) {
307
+ const url = new URL(ROUTER_PATH, baseUrl).toString();
308
+ const probe = await httpRequest(url, {
309
+ method: "POST",
310
+ timeoutMs,
311
+ blockRedirects: true,
312
+ jsonBody: {},
313
+ ...fetchImpl !== void 0 ? { fetchImpl } : {}
314
+ });
315
+ const fail = (detail, fix) => ({
316
+ name: "router",
317
+ status: "fail",
318
+ required: true,
319
+ detail,
320
+ fix
321
+ });
322
+ const checkBase = "Check that the configured base URL names the Tenjin router (`tenjin config get baseUrl`), then try again later.";
323
+ if (!probe.ok) {
324
+ return fail(`the router at ${url} is unreachable or erroring (${probe.message})`, checkBase);
325
+ }
326
+ if (probe.status === 200 || probe.status === 400 || probe.status === 429) {
327
+ return { name: "router", status: "ok", required: true, detail: `${url} is live` };
328
+ }
329
+ if (probe.status === 404) {
330
+ return fail(`the router is not enabled at ${url}`, checkBase);
331
+ }
332
+ if (probe.status === 401 || probe.status === 403) {
333
+ return fail(
334
+ `${url} is not a Tenjin router (it asked for credentials)`,
335
+ `Set the router URL with \`tenjin config set baseUrl ${PRODUCTION_ORIGIN}\`.`
336
+ );
337
+ }
338
+ if (probe.status >= 500) {
339
+ return fail(`the router at ${url} is unreachable or erroring (${probe.status})`, checkBase);
340
+ }
341
+ return fail(
342
+ `${url} answered ${probe.status}, which a Tenjin router does not`,
343
+ "Check that the configured base URL names a Tenjin deployment (`tenjin config get baseUrl`)."
344
+ );
345
+ }
346
+ export {
347
+ runRouterDoctor
348
+ };
349
+ //# sourceMappingURL=doctor-LU4YIZWM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/router/doctor.ts"],"sourcesContent":["import { execFile } from 'node:child_process';\nimport { homedir } from 'node:os';\nimport { promisify } from 'node:util';\nimport { CliError } from '../lib/errors';\nimport { inspectHooksFile, ownsHookEntry } from '../lib/harness-hooks';\nimport { httpRequest } from '../lib/http';\nimport { toMoney } from '../lib/money';\nimport { PRODUCTION_ORIGIN } from '../lib/production-origin';\nimport { resolveContextSettings } from '../lib/settings';\nimport { onPath } from '../lib/skill-wiring';\nimport { describeWallet, resolveWalletProvider } from '../lib/wallet';\nimport { walletFileExists } from '../lib/wallet/store';\nimport type { CommandContext, CommandResult } from '../context';\nimport { ROUTER_PATH } from './decision';\nimport {\n ALLOW_RULE,\n MCP_SERVER_NAME,\n mcpAddCommand,\n mcpScope,\n readMcpEntry,\n routerSettingsPath,\n type McpEntryState,\n} from './install';\nimport { inspectStatusLine, STATUS_LINE_COMMAND } from './status-line-wiring';\n\n/**\n * `tenjin doctor` for the router product: the six things that decide whether a\n * lookup can happen at all.\n *\n * THE SHELF'S DOCTOR IS NOT THIS ONE. It checks a loop daemon, a skills tree\n * and a marketplace contract, and prescribes `tenjin daemon start`, a command\n * this release does not register: on a router install every one of those lines\n * was a failure about a product that is not installed. That doctor stays with\n * the product it belongs to (`src/commands/doctor.ts`, unregistered), and this\n * one reports the router's own wiring.\n */\n\nconst exec = promisify(execFile);\n\nexport interface RouterCheck {\n name: string;\n status: 'ok' | 'warn' | 'fail';\n required: boolean;\n detail: string;\n fix?: string;\n}\n\nexport interface RouterDoctorDeps {\n homeDir?: string;\n cwd?: string;\n /** Look at this project's `.claude/settings.json`, as `--project` installed it. */\n project?: boolean;\n env?: NodeJS.ProcessEnv;\n which?: (bin: string) => boolean;\n fetchImpl?: typeof fetch;\n /** The harness's own read-back, for a user-scope registration this build\n * cannot find on disk; tests inject it so nothing is spawned. */\n readMcp?: (opts: { scope: 'user' | 'project'; cwd: string }) => Promise<boolean>;\n /** Reads the registration entry from the file the scope writes. */\n readMcpEntry?: (\n scope: 'user' | 'project',\n cwd: string,\n home: string,\n ) => Promise<{ found: boolean; state: McpEntryState }>;\n /** Node's own version, for the floor check. */\n nodeVersion?: string;\n}\n\nconst NODE_FLOOR = 24;\n\nexport async function runRouterDoctor(\n ctx: CommandContext,\n deps: RouterDoctorDeps = {},\n): Promise<CommandResult> {\n const env = deps.env ?? process.env;\n const settings = await resolveContextSettings(ctx);\n // The SAME resolution `install` and `uninstall` use. Reading the home file\n // only made a correctly wired `--project` install, which the README tells\n // people to do, fail a required check and exit 3.\n const settingsPath = routerSettingsPath({\n ...(deps.project === true ? { project: true } : {}),\n ...(deps.homeDir !== undefined ? { homeDir: deps.homeDir } : {}),\n ...(deps.cwd !== undefined ? { cwd: deps.cwd } : {}),\n });\n const checks: RouterCheck[] = [nodeCheck(deps.nodeVersion ?? process.version)];\n checks.push(await hooksCheck(settingsPath, ctx.dataDir));\n checks.push(await statusLineCheck(settingsPath));\n checks.push(\n await mcpCheck(\n deps,\n env,\n deps.project === true,\n deps.cwd ?? process.cwd(),\n deps.homeDir ?? homedir(),\n ),\n );\n checks.push(spendCheck(settings.policy.maxAutoSpendAtomic, settings.policy.sessionBudgetAtomic));\n checks.push(...(await walletCheck(ctx)));\n checks.push(await routerCheck(settings.baseUrl, ctx.flags.timeout, deps.fetchImpl));\n\n const failure = checks.find((c) => c.status === 'fail' && c.required);\n const data = { checks, dataDir: ctx.dataDir, baseUrl: settings.baseUrl, settingsPath };\n if (failure !== undefined) {\n // REFUSED, the exit-3 class: a machine this command found unready is\n // understood and refused, not a runtime failure of the command itself.\n throw new CliError('REFUSED', failure.detail, {\n ...(failure.fix !== undefined ? { fix: failure.fix } : {}),\n details: data,\n });\n }\n const bad = checks.filter((c) => c.status !== 'ok').length;\n return {\n data,\n humanLines: [\n ...checks.map(\n (c) =>\n `${c.status === 'ok' ? 'ok ' : c.status === 'warn' ? 'warn' : 'fail'} ${c.name}: ${c.detail}`,\n ),\n bad === 0\n ? `${checks.length} checks, all pass.`\n : `${checks.length} checks, ${bad} to look at.`,\n ],\n };\n}\n\nfunction nodeCheck(version: string): RouterCheck {\n const major = Number(/^v(\\d+)/.exec(version)?.[1] ?? '0');\n return major >= NODE_FLOOR\n ? { name: 'node', status: 'ok', required: true, detail: version }\n : {\n name: 'node',\n status: 'fail',\n required: true,\n detail: `${version} is below the Node ${NODE_FLOOR} floor.`,\n fix: `Install Node ${NODE_FLOOR} or newer, then re-run \\`tenjin doctor\\`.`,\n };\n}\n\n/**\n * The live footer, which is the one check here that is never required: a lookup\n * runs exactly the same without it. It reports what is in the file, including a\n * status line of the user's that this CLI deliberately did not touch.\n */\nasync function statusLineCheck(path: string): Promise<RouterCheck> {\n const found = await inspectStatusLine(path);\n const name = 'status line';\n if (found.warning !== undefined) {\n return { name, status: 'warn', required: false, detail: found.warning };\n }\n switch (found.state) {\n case 'ours':\n return { name, status: 'ok', required: false, detail: `\\`${STATUS_LINE_COMMAND}\\`` };\n case 'composed':\n return {\n name,\n status: 'ok',\n required: false,\n detail: 'yours, with the x402 footer appended',\n };\n case 'foreign':\n return {\n name,\n status: 'warn',\n required: false,\n detail: 'yours is registered and was left alone, so there is no live x402 footer',\n fix: 'Run `tenjin install --status-line compose` to show both.',\n };\n default:\n return {\n name,\n status: 'warn',\n required: false,\n detail: 'not registered, so lookups run without the live footer',\n fix: 'Run `tenjin install` to register it.',\n };\n }\n}\n\nasync function hooksCheck(path: string, dataDir: string): Promise<RouterCheck> {\n const found = await inspectHooksFile(path);\n if ('refusal' in found) {\n return {\n name: 'hooks',\n status: 'fail',\n required: true,\n detail: found.refusal.message,\n fix: 'Fix the reported file, then run `tenjin install`.',\n };\n }\n const events = Object.entries(found.hooks)\n .filter(([, list]) => list.some((entry) => ownsHookEntry(entry, dataDir)))\n .map(([event]) => event);\n const allow = allowRules(found.settings);\n if (events.length === 0) {\n return {\n name: 'hooks',\n status: 'fail',\n required: true,\n detail: `no Tenjin hook entries in ${path}`,\n fix: 'Run `tenjin install`, then restart Claude Code.',\n };\n }\n if (!allow.includes(ALLOW_RULE)) {\n return {\n name: 'hooks',\n status: 'warn',\n required: false,\n detail: `${events.join(' and ')} registered, but ${ALLOW_RULE} is not allowed, so every lookup asks`,\n fix: 'Run `tenjin install` to write the permission rule.',\n };\n }\n return {\n name: 'hooks',\n status: 'ok',\n required: true,\n detail: `${events.join(' and ')} registered, ${ALLOW_RULE} allowed`,\n };\n}\n\nfunction allowRules(settings: Record<string, unknown>): string[] {\n const permissions = settings.permissions;\n if (permissions === null || typeof permissions !== 'object' || Array.isArray(permissions)) {\n return [];\n }\n const allow = (permissions as { allow?: unknown }).allow;\n return Array.isArray(allow) ? allow.filter((r): r is string => typeof r === 'string') : [];\n}\n\nasync function mcpCheck(\n deps: RouterDoctorDeps,\n env: NodeJS.ProcessEnv,\n project: boolean,\n cwd: string,\n home: string,\n): Promise<RouterCheck> {\n const scope = mcpScope(project);\n const add = mcpAddCommand(project);\n const where = scope === 'project' ? \"this project's .mcp.json\" : '~/.claude.json';\n const { found, state } = await (deps.readMcpEntry ?? readMcpEntry)(scope, cwd, home);\n\n if (state === 'ok') {\n return {\n name: 'mcp',\n status: 'ok',\n required: true,\n detail: `${MCP_SERVER_NAME} registered (${scope} scope), running \\`tenjin mcp\\``,\n };\n }\n if (state === 'wrong-command') {\n return {\n name: 'mcp',\n status: 'fail',\n required: true,\n detail: `${MCP_SERVER_NAME} registered but not \\`tenjin mcp\\`: the entry in ${where} launches something else, so the request tool is not there`,\n fix: `Remove it and re-run \\`tenjin install\\`${project ? ' --project' : ''}, or: ${add}`,\n };\n }\n // A file that is there and unreadable is not an absence: \"run install\" would\n // be the wrong instruction, since `install` refuses to write over it too.\n if (state === 'unreadable') {\n return {\n name: 'mcp',\n status: 'fail',\n required: true,\n detail: `${where} could not be read, so whether ${MCP_SERVER_NAME} is registered is unknown`,\n fix: `Fix the JSON in ${where}, then re-run \\`tenjin install\\`${project ? ' --project' : ''}.`,\n };\n }\n // Absent. On USER scope the file may simply not be where this build looks,\n // so the harness's own answer is worth asking before calling it missing.\n if (scope === 'user') {\n const which = deps.which ?? ((bin: string) => onPath(bin, env));\n if (which('claude')) {\n const seen = await (deps.readMcp ?? claudeHasServer)({ scope, cwd }).catch(() => false);\n if (seen) {\n return {\n name: 'mcp',\n status: 'warn',\n required: false,\n detail: `${MCP_SERVER_NAME} is registered somewhere this check cannot read, so what it launches was not verified`,\n fix: `Re-run \\`tenjin install\\` to write a registration this build can check, or: ${add}`,\n };\n }\n }\n }\n return {\n name: 'mcp',\n status: 'fail',\n required: true,\n detail: found\n ? `${MCP_SERVER_NAME} is not in ${where}, so there is no request tool`\n : `${where} does not exist, so ${MCP_SERVER_NAME} is not registered`,\n fix: `Run \\`tenjin install\\`${project ? ' --project' : ''}, or: ${add}`,\n };\n}\n\n/** The harness's own answer, for a user-scope registration this build cannot\n * find on disk. It resolves across scopes, which is why it is a last resort\n * and only ever downgrades the verdict to a warn. */\nasync function claudeHasServer(opts: { scope: 'user' | 'project'; cwd: string }): Promise<boolean> {\n const { stdout } = await exec('claude', ['mcp', 'get', MCP_SERVER_NAME], {\n timeout: 15_000,\n cwd: opts.cwd,\n });\n return stdout.includes(MCP_SERVER_NAME) && !/no mcp server/i.test(stdout);\n}\n\nfunction spendCheck(maxAutoSpendAtomic: bigint, sessionBudgetAtomic: bigint): RouterCheck {\n if (maxAutoSpendAtomic === 0n) {\n return {\n name: 'spend',\n status: 'fail',\n required: true,\n detail: 'maxAutoSpend is 0, so every lookup needs approval and none can pay',\n fix: 'Run `tenjin install`, or `tenjin config set maxAutoSpend 0.10`.',\n };\n }\n const budget =\n sessionBudgetAtomic === 0n\n ? 'no daily ceiling'\n : `${toMoney(sessionBudgetAtomic.toString()).usd} USD a day`;\n return {\n name: 'spend',\n status: sessionBudgetAtomic === 0n ? 'warn' : 'ok',\n required: false,\n detail: `at most ${toMoney(maxAutoSpendAtomic.toString()).usd} USD a call, ${budget}`,\n ...(sessionBudgetAtomic === 0n\n ? { fix: 'Set one with `tenjin config set sessionBudget 1.00`.' }\n : {}),\n };\n}\n\nasync function walletCheck(ctx: CommandContext): Promise<RouterCheck[]> {\n if (!(await walletFileExists(ctx.dataDir))) {\n return [\n {\n name: 'wallet',\n status: 'fail',\n required: true,\n detail: 'no wallet on this machine, so nothing can pay',\n fix: 'Run `tenjin wallet create`, then `tenjin wallet fund`.',\n },\n ];\n }\n try {\n const described = await describeWallet(resolveWalletProvider(ctx));\n return [{ name: 'wallet', status: 'ok', required: true, detail: described.address }];\n } catch (err) {\n return [\n {\n name: 'wallet',\n status: 'fail',\n required: true,\n detail: err instanceof CliError ? err.message : String(err),\n ...(err instanceof CliError && err.fix !== undefined ? { fix: err.fix } : {}),\n },\n ];\n }\n}\n\n/**\n * One cheap request to the free decision route with an empty body. It checks\n * the route is reachable and enabled, not that it routes: a 400 is the route\n * refusing that body, and a 404 is the route switched off. Nothing is signed\n * and no Jev request is spent.\n */\nasync function routerCheck(\n baseUrl: string,\n timeoutMs: number,\n fetchImpl: typeof fetch | undefined,\n): Promise<RouterCheck> {\n const url = new URL(ROUTER_PATH, baseUrl).toString();\n const probe = await httpRequest(url, {\n method: 'POST',\n timeoutMs,\n blockRedirects: true,\n jsonBody: {},\n ...(fetchImpl !== undefined ? { fetchImpl } : {}),\n });\n const fail = (detail: string, fix: string): RouterCheck => ({\n name: 'router',\n status: 'fail',\n required: true,\n detail,\n fix,\n });\n const checkBase =\n 'Check that the configured base URL names the Tenjin router (`tenjin config get baseUrl`), then try again later.';\n if (!probe.ok) {\n return fail(`the router at ${url} is unreachable or erroring (${probe.message})`, checkBase);\n }\n // 429 is the route's own rate limit: proof the router is there.\n if (probe.status === 200 || probe.status === 400 || probe.status === 429) {\n return { name: 'router', status: 'ok', required: true, detail: `${url} is live` };\n }\n if (probe.status === 404) {\n return fail(`the router is not enabled at ${url}`, checkBase);\n }\n if (probe.status === 401 || probe.status === 403) {\n return fail(\n `${url} is not a Tenjin router (it asked for credentials)`,\n `Set the router URL with \\`tenjin config set baseUrl ${PRODUCTION_ORIGIN}\\`.`,\n );\n }\n if (probe.status >= 500) {\n return fail(`the router at ${url} is unreachable or erroring (${probe.status})`, checkBase);\n }\n return fail(\n `${url} answered ${probe.status}, which a Tenjin router does not`,\n 'Check that the configured base URL names a Tenjin deployment (`tenjin config get baseUrl`).',\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAmC1B,IAAM,OAAO,UAAU,QAAQ;AA+B/B,IAAM,aAAa;AAEnB,eAAsB,gBACpB,KACA,OAAyB,CAAC,GACF;AACxB,QAAM,MAAM,KAAK,OAAO,QAAQ;AAChC,QAAM,WAAW,MAAM,uBAAuB,GAAG;AAIjD,QAAM,eAAe,mBAAmB;AAAA,IACtC,GAAI,KAAK,YAAY,OAAO,EAAE,SAAS,KAAK,IAAI,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AAK;AACvB,WAAO,KAAK,iBAAiB,GAAG,gCAAgC,MAAM,MAAM,KAAK,SAAS;AAAA,EAC5F;AACA,SAAO;AAAA,IACL,GAAG,GAAG,aAAa,MAAM,MAAM;AAAA,IAC/B;AAAA,EACF;AACF;","names":[]}
@@ -4,10 +4,10 @@ import {
4
4
  c,
5
5
  f,
6
6
  s
7
- } from "./chunk-POJRB2AE.js";
8
- import "./chunk-YLYINX2H.js";
9
- import "./chunk-XJN5WUKL.js";
10
- import "./chunk-KYQVEKP5.js";
7
+ } from "./chunk-POUWHWID.js";
8
+ import "./chunk-XZKD7DIF.js";
9
+ import "./chunk-KG3D7FIF.js";
10
+ import "./chunk-BPMWXTFX.js";
11
11
  import "./chunk-ZXTAQYNA.js";
12
12
  export {
13
13
  s as i,
@@ -15,4 +15,4 @@ export {
15
15
  a as r,
16
16
  f as t
17
17
  };
18
- //# sourceMappingURL=ethersCompat-Df4a6QIZ-WHYKB6HA.js.map
18
+ //# sourceMappingURL=ethersCompat-Df4a6QIZ-THAVUGIJ.js.map
@@ -1,46 +1,103 @@
1
1
  import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
- import {
3
- SESSION_CHAIN_ID
4
- } from "./chunk-QQ6ELLSA.js";
5
2
  import {
6
3
  SIWX_HEADER,
7
4
  buildSiwxHeader
8
- } from "./chunk-KINZ23CV.js";
5
+ } from "./chunk-3AUDA53C.js";
6
+ import {
7
+ fetchFailureToCliError,
8
+ httpRequest
9
+ } from "./chunk-5X4SZ5BF.js";
10
+ import "./chunk-TTNESUPQ.js";
11
+ import "./chunk-HPWO4O6S.js";
12
+ import "./chunk-POUWHWID.js";
13
+ import "./chunk-XZKD7DIF.js";
9
14
  import {
10
15
  getUsdcBalance
11
- } from "./chunk-MJZZTKCC.js";
16
+ } from "./chunk-56MOAIP5.js";
12
17
  import {
13
18
  describeWallet,
14
19
  resolveWalletProvider
15
- } from "./chunk-CPCX67TI.js";
20
+ } from "./chunk-YEETV6IW.js";
21
+ import "./chunk-DMZZLPZN.js";
22
+ import "./chunk-AWQPGIR6.js";
23
+ import "./chunk-N35E6CM2.js";
24
+ import "./chunk-JRGFKVAZ.js";
25
+ import "./chunk-5IEP5EGE.js";
16
26
  import {
17
- fetchFailureToCliError,
18
- httpRequest
19
- } from "./chunk-5QQTYWEU.js";
27
+ getAddress,
28
+ isAddress
29
+ } from "./chunk-EGELTSPU.js";
30
+ import "./chunk-KG3D7FIF.js";
31
+ import "./chunk-RBJPAZFI.js";
32
+ import "./chunk-BPMWXTFX.js";
20
33
  import {
21
34
  emitNotice,
22
35
  emitWriteNotice
23
- } from "./chunk-OLWTRUTS.js";
36
+ } from "./chunk-YJHHCWM3.js";
37
+ import "./chunk-MEFB5KHA.js";
24
38
  import {
25
39
  toMoney
26
- } from "./chunk-EFWZPUTC.js";
40
+ } from "./chunk-WH7OWT6G.js";
27
41
  import {
42
+ PRODUCTION_ORIGIN,
43
+ external_exports,
28
44
  loadRawConfig,
29
45
  resolveSettings
30
- } from "./chunk-U6VPKMGC.js";
31
- import {
32
- PRODUCTION_ORIGIN
33
- } from "./chunk-2MYQN7HM.js";
46
+ } from "./chunk-BBVUVBUO.js";
47
+ import "./chunk-BFFM2WFK.js";
34
48
  import {
35
49
  CliError
36
- } from "./chunk-ZFJJ3EXC.js";
37
- import {
38
- getAddress,
39
- isAddress
40
- } from "./chunk-47PP7TAG.js";
50
+ } from "./chunk-OCBHUHWB.js";
51
+ import "./chunk-2BKS2FVE.js";
52
+ import "./chunk-7WEQQJLG.js";
53
+ import "./chunk-ZXTAQYNA.js";
54
+
55
+ // src/lib/session-key.ts
56
+ import { webcrypto as webcrypto2 } from "node:crypto";
57
+
58
+ // src/lib/session-present.ts
59
+ import { createHash, randomBytes, webcrypto } from "node:crypto";
60
+ var P256JwkSchema = external_exports.object({
61
+ kty: external_exports.literal("EC"),
62
+ crv: external_exports.literal("P-256"),
63
+ d: external_exports.string().min(1),
64
+ x: external_exports.string().min(1),
65
+ y: external_exports.string().min(1)
66
+ }).passthrough();
67
+ var SessionFileSchema = external_exports.object({
68
+ /** Lowercased wallet address this delegation is bound to. */
69
+ address: external_exports.string(),
70
+ /**
71
+ * The `scheme://host[:port]` this delegation was minted against.
72
+ *
73
+ * Load-bearing, not bookkeeping. The delegation is a wallet-derived credential
74
+ * and `--base-url` rides every leaf command, including the always-safe `read`.
75
+ * Without this field one auto-allowed `tenjin read <url> --base-url <attacker>`
76
+ * hands the credential to a host the agent chose, with the origin guard
77
+ * satisfied because the same flag set both sides of it. Binding the file to its
78
+ * origin closes that however the base URL arrived — flag, environment, or a
79
+ * rewritten config. It also makes a stale file after a prod/localhost/preview
80
+ * switch fail closed rather than present a delegation that cannot verify.
81
+ */
82
+ origin: external_exports.string(),
83
+ /** The constant base64 SIWX `Tenjin-Session-Delegation` header value. */
84
+ delegation: external_exports.string(),
85
+ /** Delegation expiry (ISO 8601); a request is never signed at/after this. */
86
+ exp: external_exports.string(),
87
+ scope: external_exports.string(),
88
+ /** base64url raw 65-byte uncompressed P-256 point (0x04||X||Y). */
89
+ publicKeyRaw: external_exports.string(),
90
+ privateKeyJwk: P256JwkSchema
91
+ });
92
+ var subtle = webcrypto.subtle;
93
+
94
+ // src/lib/session-key.ts
95
+ var SESSION_CHAIN_ID = "eip155:8453";
96
+ var SESSION_TTL_MS = 24 * 60 * 60 * 1e3;
97
+ var subtle2 = webcrypto2.subtle;
41
98
 
42
99
  // src/lib/open-url.ts
43
- import { execFile } from "child_process";
100
+ import { execFile } from "node:child_process";
44
101
  var OPEN_TIMEOUT_MS = 5e3;
45
102
  function openerFor(platform) {
46
103
  if (platform === "darwin") return { cmd: "open", args: [] };
@@ -152,7 +209,7 @@ function parsePreset(raw) {
152
209
  const n = Number(raw);
153
210
  if (!Number.isFinite(n) || n <= 0 || n > MAX_PRESET_USD) {
154
211
  throw new CliError("USAGE", `Amount must be a positive USD number up to ${MAX_PRESET_USD}.`, {
155
- fix: "Example: tenjin fund 5"
212
+ fix: "Example: tenjin wallet fund 5"
156
213
  });
157
214
  }
158
215
  return n;
@@ -233,8 +290,7 @@ async function pollForFunds(ctx, desc, rpcUrl, startBalance, opts) {
233
290
  }
234
291
  return void 0;
235
292
  }
236
-
237
293
  export {
238
294
  runFund
239
295
  };
240
- //# sourceMappingURL=chunk-KAJZHIQ4.js.map
296
+ //# sourceMappingURL=fund-A54P2QFK.js.map