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

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 (278) hide show
  1. package/NOTICE.md +54 -7
  2. package/README.md +43 -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-2BKS2FVE.js +93 -0
  7. package/dist/chunk-2BKS2FVE.js.map +1 -0
  8. package/dist/chunk-2G2WLVHB.js +102 -0
  9. package/dist/chunk-2G2WLVHB.js.map +1 -0
  10. package/dist/chunk-2I4QTOLB.js +11 -0
  11. package/dist/chunk-2I4QTOLB.js.map +1 -0
  12. package/dist/chunk-2JGT3KDW.js +172 -0
  13. package/dist/chunk-2JGT3KDW.js.map +1 -0
  14. package/dist/chunk-2QYORQBF.js +55 -0
  15. package/dist/chunk-2QYORQBF.js.map +1 -0
  16. package/dist/chunk-35M3VITA.js +102 -0
  17. package/dist/chunk-35M3VITA.js.map +1 -0
  18. package/dist/{chunk-KINZ23CV.js → chunk-3AUDA53C.js} +4740 -23
  19. package/dist/chunk-3AUDA53C.js.map +1 -0
  20. package/dist/{chunk-MJZZTKCC.js → chunk-56MOAIP5.js} +5 -10
  21. package/dist/chunk-56MOAIP5.js.map +1 -0
  22. package/dist/{chunk-U5S527PP.js → chunk-5IEP5EGE.js} +3 -3
  23. package/dist/chunk-5QHHRMRA.js +227 -0
  24. package/dist/chunk-5QHHRMRA.js.map +1 -0
  25. package/dist/{chunk-JBIKAAT3.js → chunk-5UDD5VSY.js} +8 -8
  26. package/dist/chunk-5UDD5VSY.js.map +1 -0
  27. package/dist/chunk-7QKHZQKW.js +1680 -0
  28. package/dist/chunk-7QKHZQKW.js.map +1 -0
  29. package/dist/{chunk-ZFJJ3EXC.js → chunk-AR7U7BRG.js} +550 -182
  30. package/dist/chunk-AR7U7BRG.js.map +1 -0
  31. package/dist/chunk-AUKDYPPX.js +130 -0
  32. package/dist/chunk-AUKDYPPX.js.map +1 -0
  33. package/dist/{chunk-7FK2UN2T.js → chunk-AWQPGIR6.js} +65 -67
  34. package/dist/{chunk-7FK2UN2T.js.map → chunk-AWQPGIR6.js.map} +1 -1
  35. package/dist/{chunk-KYQVEKP5.js → chunk-BPMWXTFX.js} +8 -8
  36. package/dist/{chunk-47PP7TAG.js → chunk-EGELTSPU.js} +1356 -1356
  37. package/dist/chunk-EGELTSPU.js.map +1 -0
  38. package/dist/{chunk-S5RYMCV6.js → chunk-HPWO4O6S.js} +3 -3
  39. package/dist/chunk-J5INH7WB.js +299 -0
  40. package/dist/chunk-J5INH7WB.js.map +1 -0
  41. package/dist/chunk-JLEF5WHM.js +132 -0
  42. package/dist/chunk-JLEF5WHM.js.map +1 -0
  43. package/dist/{chunk-W6R3HAAG.js → chunk-JRGFKVAZ.js} +2 -2
  44. package/dist/{chunk-XJN5WUKL.js → chunk-KG3D7FIF.js} +2 -2
  45. package/dist/chunk-KK4YGYTV.js +808 -0
  46. package/dist/chunk-KK4YGYTV.js.map +1 -0
  47. package/dist/{chunk-CPCX67TI.js → chunk-KUBEYXSO.js} +1076 -1038
  48. package/dist/chunk-KUBEYXSO.js.map +1 -0
  49. package/dist/{chunk-QW2Q2KAH.js → chunk-LHHMV4GU.js} +2 -2
  50. package/dist/{chunk-NIKXHWOL.js → chunk-LJ4DMVFI.js} +16 -16
  51. package/dist/chunk-LJ4DMVFI.js.map +1 -0
  52. package/dist/{chunk-ZOBNS7CX.js → chunk-MEFB5KHA.js} +4 -18
  53. package/dist/chunk-MEFB5KHA.js.map +1 -0
  54. package/dist/{chunk-HPJGOLTN.js → chunk-MRGADYDD.js} +13 -8
  55. package/dist/chunk-MRGADYDD.js.map +1 -0
  56. package/dist/{chunk-M2O56UK7.js → chunk-N35E6CM2.js} +293 -163
  57. package/dist/chunk-N35E6CM2.js.map +1 -0
  58. package/dist/chunk-O4ZNKFRU.js +366 -0
  59. package/dist/chunk-O4ZNKFRU.js.map +1 -0
  60. package/dist/chunk-PDA2BVFY.js +244 -0
  61. package/dist/chunk-PDA2BVFY.js.map +1 -0
  62. package/dist/{chunk-POJRB2AE.js → chunk-POUWHWID.js} +2 -2
  63. package/dist/chunk-QDD2RN7G.js +10238 -0
  64. package/dist/chunk-QDD2RN7G.js.map +1 -0
  65. package/dist/chunk-S2NRVRPF.js +171 -0
  66. package/dist/chunk-S2NRVRPF.js.map +1 -0
  67. package/dist/chunk-TGLKKLQG.js +11 -0
  68. package/dist/chunk-TGLKKLQG.js.map +1 -0
  69. package/dist/chunk-TP4D47BY.js +127 -0
  70. package/dist/chunk-TP4D47BY.js.map +1 -0
  71. package/dist/{chunk-KZAAWQNP.js → chunk-TTNESUPQ.js} +3 -3
  72. package/dist/{chunk-UO22YNY4.js → chunk-U2DZISAH.js} +43 -1
  73. package/dist/chunk-U2DZISAH.js.map +1 -0
  74. package/dist/chunk-WGQVJM56.js +165 -0
  75. package/dist/chunk-WGQVJM56.js.map +1 -0
  76. package/dist/{chunk-OLWTRUTS.js → chunk-WLMJE3GJ.js} +35 -16
  77. package/dist/chunk-WLMJE3GJ.js.map +1 -0
  78. package/dist/chunk-WS4JA6TC.js +137 -0
  79. package/dist/chunk-WS4JA6TC.js.map +1 -0
  80. package/dist/chunk-WXC57XGG.js +29 -0
  81. package/dist/chunk-WXC57XGG.js.map +1 -0
  82. package/dist/{chunk-YLYINX2H.js → chunk-XZKD7DIF.js} +3 -3
  83. package/dist/chunk-XZOEUYMX.js +1784 -0
  84. package/dist/chunk-XZOEUYMX.js.map +1 -0
  85. package/dist/{cli-KKRKBU5T.js → cli-VHYYYYXM.js} +303 -374
  86. package/dist/cli-VHYYYYXM.js.map +1 -0
  87. package/dist/config-5ADBAAXU.js +42 -0
  88. package/dist/{dist-U4M6QCKE.js → dist-3LOO6M4U.js} +10 -10
  89. package/dist/doctor-Q35VQW3S.js +436 -0
  90. package/dist/doctor-Q35VQW3S.js.map +1 -0
  91. package/dist/{ethersCompat-Df4a6QIZ-WHYKB6HA.js → ethersCompat-Df4a6QIZ-THAVUGIJ.js} +5 -5
  92. package/dist/{chunk-KAJZHIQ4.js → fund-GDDPL2BB.js} +81 -24
  93. package/dist/fund-GDDPL2BB.js.map +1 -0
  94. package/dist/hook-command-PBERPRE3.js +763 -0
  95. package/dist/hook-command-PBERPRE3.js.map +1 -0
  96. package/dist/index.js +8 -3
  97. package/dist/index.js.map +1 -1
  98. package/dist/install-OKDKGUXM.js +60 -0
  99. package/dist/install-wallet-SI4LZ73K.js +106 -0
  100. package/dist/install-wallet-SI4LZ73K.js.map +1 -0
  101. package/dist/{run-XYTQ5TWQ.js → mcp-XX3WRQEZ.js} +3766 -10677
  102. package/dist/mcp-XX3WRQEZ.js.map +1 -0
  103. package/dist/paths-P2N4JTDZ.js +49 -0
  104. package/dist/pay-3SYKHKWJ.js +39 -0
  105. package/dist/redact-6W23GGJC.js +15 -0
  106. package/dist/{secp256k1-XRPVBC6V.js → secp256k1-ZZZT2CAX.js} +3 -3
  107. package/dist/{send-G746D7PQ.js → send-LQRKTEJT.js} +29 -29
  108. package/dist/send-LQRKTEJT.js.map +1 -0
  109. package/dist/{chunk-QZ6ROAJU.js → skill-placement-JMDPSKE6.js} +155 -10
  110. package/dist/skill-placement-JMDPSKE6.js.map +1 -0
  111. package/dist/status-FFC6FO72.js +64 -0
  112. package/dist/status-FFC6FO72.js.map +1 -0
  113. package/dist/status-line-SAXSU6CR.js +87 -0
  114. package/dist/status-line-SAXSU6CR.js.map +1 -0
  115. package/dist/status-line-wiring-L2WYIYBM.js +29 -0
  116. package/dist/tenjin-daemon.mjs +20421 -0
  117. package/dist/tenjin-shim.mjs +251 -0
  118. package/dist/tenjin-vitest-reporter.mjs +49 -0
  119. package/dist/uninstall-OACH27UV.js +147 -0
  120. package/dist/uninstall-OACH27UV.js.map +1 -0
  121. package/dist/{update-R76LHOZW.js → update-4W6EKLGZ.js} +132 -16
  122. package/dist/update-4W6EKLGZ.js.map +1 -0
  123. package/dist/{viemAdapter-By13KInL-TUQJBMHM.js → viemAdapter-By13KInL-X2VY6CY3.js} +5 -5
  124. package/dist/wallet-BMEXRR3P.js +32 -0
  125. package/dist/wallet-kdf-worker.mjs +980 -0
  126. package/docs/agent-permissions.md +71 -352
  127. package/docs/safety-model.md +16 -6
  128. package/package.json +8 -7
  129. package/LICENSE +0 -21
  130. package/dist/buy-VIRNSYGN.js +0 -47
  131. package/dist/chunk-2MYQN7HM.js +0 -247
  132. package/dist/chunk-2MYQN7HM.js.map +0 -1
  133. package/dist/chunk-2RF2GIJQ.js +0 -1188
  134. package/dist/chunk-2RF2GIJQ.js.map +0 -1
  135. package/dist/chunk-3GL2Z5QK.js +0 -57
  136. package/dist/chunk-3GL2Z5QK.js.map +0 -1
  137. package/dist/chunk-47PP7TAG.js.map +0 -1
  138. package/dist/chunk-4CQIDQOT.js +0 -167
  139. package/dist/chunk-4CQIDQOT.js.map +0 -1
  140. package/dist/chunk-4KG27W2S.js +0 -614
  141. package/dist/chunk-4KG27W2S.js.map +0 -1
  142. package/dist/chunk-5QQTYWEU.js +0 -199
  143. package/dist/chunk-5QQTYWEU.js.map +0 -1
  144. package/dist/chunk-65DTCCJ7.js +0 -21
  145. package/dist/chunk-65DTCCJ7.js.map +0 -1
  146. package/dist/chunk-A5DKHMUN.js +0 -173
  147. package/dist/chunk-A5DKHMUN.js.map +0 -1
  148. package/dist/chunk-B63XPWQ4.js +0 -246
  149. package/dist/chunk-B63XPWQ4.js.map +0 -1
  150. package/dist/chunk-CAR6FHK6.js +0 -105
  151. package/dist/chunk-CAR6FHK6.js.map +0 -1
  152. package/dist/chunk-CPCX67TI.js.map +0 -1
  153. package/dist/chunk-CQBVCYI2.js +0 -162
  154. package/dist/chunk-CQBVCYI2.js.map +0 -1
  155. package/dist/chunk-DBU5CXBV.js +0 -4731
  156. package/dist/chunk-DBU5CXBV.js.map +0 -1
  157. package/dist/chunk-DHJD77OW.js +0 -81
  158. package/dist/chunk-DHJD77OW.js.map +0 -1
  159. package/dist/chunk-EDZSNPE5.js +0 -35
  160. package/dist/chunk-EDZSNPE5.js.map +0 -1
  161. package/dist/chunk-EFWZPUTC.js +0 -65
  162. package/dist/chunk-EFWZPUTC.js.map +0 -1
  163. package/dist/chunk-EPFL6CTE.js +0 -448
  164. package/dist/chunk-EPFL6CTE.js.map +0 -1
  165. package/dist/chunk-GHLVXVZD.js +0 -142
  166. package/dist/chunk-GHLVXVZD.js.map +0 -1
  167. package/dist/chunk-H3SOOJ2I.js +0 -580
  168. package/dist/chunk-H3SOOJ2I.js.map +0 -1
  169. package/dist/chunk-HPJGOLTN.js.map +0 -1
  170. package/dist/chunk-HRGBS2PA.js +0 -203
  171. package/dist/chunk-HRGBS2PA.js.map +0 -1
  172. package/dist/chunk-ITUXPJIS.js +0 -314
  173. package/dist/chunk-ITUXPJIS.js.map +0 -1
  174. package/dist/chunk-JBIKAAT3.js.map +0 -1
  175. package/dist/chunk-KAJZHIQ4.js.map +0 -1
  176. package/dist/chunk-KINZ23CV.js.map +0 -1
  177. package/dist/chunk-LRYV3SK7.js +0 -235
  178. package/dist/chunk-LRYV3SK7.js.map +0 -1
  179. package/dist/chunk-M2O56UK7.js.map +0 -1
  180. package/dist/chunk-MJZZTKCC.js.map +0 -1
  181. package/dist/chunk-NIKXHWOL.js.map +0 -1
  182. package/dist/chunk-OKDRDT74.js +0 -209
  183. package/dist/chunk-OKDRDT74.js.map +0 -1
  184. package/dist/chunk-OKYSNAS3.js +0 -2144
  185. package/dist/chunk-OKYSNAS3.js.map +0 -1
  186. package/dist/chunk-OLWTRUTS.js.map +0 -1
  187. package/dist/chunk-QQ6ELLSA.js +0 -143
  188. package/dist/chunk-QQ6ELLSA.js.map +0 -1
  189. package/dist/chunk-QZ6ROAJU.js.map +0 -1
  190. package/dist/chunk-R7RSCBI7.js +0 -794
  191. package/dist/chunk-R7RSCBI7.js.map +0 -1
  192. package/dist/chunk-SGK2B724.js +0 -67
  193. package/dist/chunk-SGK2B724.js.map +0 -1
  194. package/dist/chunk-U6VPKMGC.js +0 -390
  195. package/dist/chunk-U6VPKMGC.js.map +0 -1
  196. package/dist/chunk-UHTVXQ2O.js +0 -140
  197. package/dist/chunk-UHTVXQ2O.js.map +0 -1
  198. package/dist/chunk-UO22YNY4.js.map +0 -1
  199. package/dist/chunk-US456VUI.js +0 -149
  200. package/dist/chunk-US456VUI.js.map +0 -1
  201. package/dist/chunk-V44J2MXV.js +0 -400
  202. package/dist/chunk-V44J2MXV.js.map +0 -1
  203. package/dist/chunk-VJQKL3YH.js +0 -216
  204. package/dist/chunk-VJQKL3YH.js.map +0 -1
  205. package/dist/chunk-VJSQSLBM.js +0 -1442
  206. package/dist/chunk-VJSQSLBM.js.map +0 -1
  207. package/dist/chunk-VYOJOX4Z.js +0 -165
  208. package/dist/chunk-VYOJOX4Z.js.map +0 -1
  209. package/dist/chunk-WY2K35OL.js +0 -269
  210. package/dist/chunk-WY2K35OL.js.map +0 -1
  211. package/dist/chunk-ZFJJ3EXC.js.map +0 -1
  212. package/dist/chunk-ZOBNS7CX.js.map +0 -1
  213. package/dist/cli-KKRKBU5T.js.map +0 -1
  214. package/dist/config-JMRUNYE6.js +0 -37
  215. package/dist/discover-B5HF6SHM.js +0 -102
  216. package/dist/discover-B5HF6SHM.js.map +0 -1
  217. package/dist/doctor-ZBG7X66D.js +0 -32
  218. package/dist/edit-PZJIILQE.js +0 -40
  219. package/dist/fund-EUDH5KPA.js +0 -40
  220. package/dist/inspect-QC6WEQPN.js +0 -37
  221. package/dist/install-GNK2W3PI.js +0 -972
  222. package/dist/install-GNK2W3PI.js.map +0 -1
  223. package/dist/outcome-KSGWZHUS.js +0 -24
  224. package/dist/pay-BC4UICPA.js +0 -361
  225. package/dist/pay-BC4UICPA.js.map +0 -1
  226. package/dist/publish-LXWFDIKF.js +0 -42
  227. package/dist/read-JMNUQ56P.js +0 -160
  228. package/dist/read-JMNUQ56P.js.map +0 -1
  229. package/dist/run-XYTQ5TWQ.js.map +0 -1
  230. package/dist/search-TSQAB45E.js +0 -25
  231. package/dist/secp256k1-XRPVBC6V.js.map +0 -1
  232. package/dist/send-G746D7PQ.js.map +0 -1
  233. package/dist/session-JBKWMJ24.js +0 -89
  234. package/dist/session-JBKWMJ24.js.map +0 -1
  235. package/dist/skill-heal-WKD67SLJ.js +0 -92
  236. package/dist/skill-heal-WKD67SLJ.js.map +0 -1
  237. package/dist/skill-placement-RIU4AMC2.js +0 -20
  238. package/dist/skill-placement-RIU4AMC2.js.map +0 -1
  239. package/dist/uninstall-5E263VTS.js +0 -73
  240. package/dist/uninstall-5E263VTS.js.map +0 -1
  241. package/dist/update-R76LHOZW.js.map +0 -1
  242. package/dist/usdc-4VCDHFWX.js +0 -38
  243. package/dist/usdc-4VCDHFWX.js.map +0 -1
  244. package/dist/viemAdapter-By13KInL-TUQJBMHM.js.map +0 -1
  245. package/dist/wallet-TQ7D5EQ7.js +0 -41
  246. package/dist/wallet-TQ7D5EQ7.js.map +0 -1
  247. package/dist/wallet-ZAVXWLWP.js +0 -32
  248. package/dist/wallet-ZAVXWLWP.js.map +0 -1
  249. package/docs/command-reference.md +0 -303
  250. package/skills/tenjin/SKILL.md +0 -373
  251. package/skills/tenjin-pay/SKILL.md +0 -76
  252. package/skills/tenjin-publish/SKILL.md +0 -227
  253. package/skills/tenjin-publish/references/maintain.md +0 -39
  254. package/skills/tenjin-search/SKILL.md +0 -154
  255. package/skills/tenjin-search/references/permissions.md +0 -112
  256. /package/dist/{_esm-N4KAVXQR.js.map → _esm-CE7KNONL.js.map} +0 -0
  257. /package/dist/{buy-VIRNSYGN.js.map → ccip-7RMRLAGV.js.map} +0 -0
  258. /package/dist/{ccip-RPPPKTJR.js.map → ccip-NLCSCHKI.js.map} +0 -0
  259. /package/dist/{chunk-U5S527PP.js.map → chunk-5IEP5EGE.js.map} +0 -0
  260. /package/dist/{chunk-KYQVEKP5.js.map → chunk-BPMWXTFX.js.map} +0 -0
  261. /package/dist/{chunk-S5RYMCV6.js.map → chunk-HPWO4O6S.js.map} +0 -0
  262. /package/dist/{chunk-W6R3HAAG.js.map → chunk-JRGFKVAZ.js.map} +0 -0
  263. /package/dist/{chunk-XJN5WUKL.js.map → chunk-KG3D7FIF.js.map} +0 -0
  264. /package/dist/{chunk-QW2Q2KAH.js.map → chunk-LHHMV4GU.js.map} +0 -0
  265. /package/dist/{chunk-POJRB2AE.js.map → chunk-POUWHWID.js.map} +0 -0
  266. /package/dist/{chunk-KZAAWQNP.js.map → chunk-TTNESUPQ.js.map} +0 -0
  267. /package/dist/{chunk-YLYINX2H.js.map → chunk-XZKD7DIF.js.map} +0 -0
  268. /package/dist/{ccip-ZGGWQN4X.js.map → config-5ADBAAXU.js.map} +0 -0
  269. /package/dist/{dist-U4M6QCKE.js.map → dist-3LOO6M4U.js.map} +0 -0
  270. /package/dist/{config-JMRUNYE6.js.map → ethersCompat-Df4a6QIZ-THAVUGIJ.js.map} +0 -0
  271. /package/dist/{doctor-ZBG7X66D.js.map → install-OKDKGUXM.js.map} +0 -0
  272. /package/dist/{edit-PZJIILQE.js.map → paths-P2N4JTDZ.js.map} +0 -0
  273. /package/dist/{ethersCompat-Df4a6QIZ-WHYKB6HA.js.map → pay-3SYKHKWJ.js.map} +0 -0
  274. /package/dist/{fund-EUDH5KPA.js.map → redact-6W23GGJC.js.map} +0 -0
  275. /package/dist/{inspect-QC6WEQPN.js.map → secp256k1-ZZZT2CAX.js.map} +0 -0
  276. /package/dist/{outcome-KSGWZHUS.js.map → status-line-wiring-L2WYIYBM.js.map} +0 -0
  277. /package/dist/{publish-LXWFDIKF.js.map → viemAdapter-By13KInL-X2VY6CY3.js.map} +0 -0
  278. /package/dist/{search-TSQAB45E.js.map → wallet-BMEXRR3P.js.map} +0 -0
@@ -2,25 +2,27 @@ import { createRequire as __tenjinCreateRequire } from 'node:module'; const requ
2
2
  import {
3
3
  maybeUpdate,
4
4
  readUpdateSignal
5
- } from "./chunk-HPJGOLTN.js";
5
+ } from "./chunk-MRGADYDD.js";
6
6
  import {
7
7
  defaultIo,
8
8
  emitFailure,
9
9
  emitSuccess
10
- } from "./chunk-OLWTRUTS.js";
10
+ } from "./chunk-WLMJE3GJ.js";
11
11
  import {
12
12
  PERMISSIONS_DOC_URL
13
- } from "./chunk-4CQIDQOT.js";
14
- import "./chunk-U6VPKMGC.js";
13
+ } from "./chunk-WXC57XGG.js";
14
+ import {
15
+ external_exports
16
+ } from "./chunk-AR7U7BRG.js";
15
17
  import {
16
18
  package_default
17
- } from "./chunk-JBIKAAT3.js";
18
- import "./chunk-2MYQN7HM.js";
19
+ } from "./chunk-5UDD5VSY.js";
19
20
  import {
20
- CliError,
21
- dataDir,
22
- external_exports
23
- } from "./chunk-ZFJJ3EXC.js";
21
+ CliError
22
+ } from "./chunk-JLEF5WHM.js";
23
+ import {
24
+ dataDir
25
+ } from "./chunk-2BKS2FVE.js";
24
26
  import {
25
27
  __commonJS,
26
28
  __require,
@@ -1194,11 +1196,11 @@ var require_suggestSimilar = __commonJS({
1194
1196
  var require_command = __commonJS({
1195
1197
  "node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/command.js"(exports) {
1196
1198
  "use strict";
1197
- var EventEmitter = __require("events").EventEmitter;
1198
- var childProcess = __require("child_process");
1199
- var path = __require("path");
1200
- var fs = __require("fs");
1201
- var process2 = __require("process");
1199
+ var EventEmitter = __require("node:events").EventEmitter;
1200
+ var childProcess = __require("node:child_process");
1201
+ var path = __require("node:path");
1202
+ var fs = __require("node:fs");
1203
+ var process2 = __require("node:process");
1202
1204
  var { Argument: Argument2, humanReadableArgName } = require_argument();
1203
1205
  var { CommanderError: CommanderError2 } = require_error();
1204
1206
  var { Help: Help2, stripColor } = require_help();
@@ -3477,188 +3479,165 @@ var {
3477
3479
  Help
3478
3480
  } = import_index.default;
3479
3481
 
3480
- // src/cli.ts
3481
- var GlobalOptsSchema = external_exports.object({
3482
- json: external_exports.boolean().default(false),
3483
- baseUrl: external_exports.url().optional(),
3484
- timeout: external_exports.coerce.number().int().positive().default(1e4)
3485
- });
3486
- function addGlobalFlags(cmd) {
3487
- return cmd.option("--json", "emit machine JSON only (suppress human stderr rendering)").option("--base-url <url>", "Tenjin API base URL").option("--timeout <ms>", "request timeout in milliseconds");
3488
- }
3489
- function buildContext(cmd, io) {
3490
- const parsed = GlobalOptsSchema.safeParse(cmd.optsWithGlobals());
3491
- if (!parsed.success) {
3492
- throw new CliError("USAGE", "Invalid global option", {
3493
- fix: "Run `tenjin --help` for usage.",
3494
- details: parsed.error.issues
3495
- });
3496
- }
3497
- const flags = {
3498
- json: parsed.data.json,
3499
- timeout: parsed.data.timeout,
3500
- baseUrl: parsed.data.baseUrl
3501
- };
3502
- return { flags, dataDir: dataDir(process.env), io };
3503
- }
3504
- function buildProgram(io, setExit) {
3505
- const program2 = new Command();
3506
- const runCommand = async (command, cmd, run) => {
3507
- const json = cmd.optsWithGlobals().json === true;
3508
- const updateAvailable = command === "update" ? null : await readUpdateSignal(dataDir(process.env));
3509
- try {
3510
- const ctx = buildContext(cmd, io);
3511
- const result = await run(ctx);
3512
- emitSuccess(ctx.io, command, result.data, result.humanLines, {
3513
- json: ctx.flags.json,
3514
- updateAvailable
3515
- });
3516
- } catch (err) {
3517
- setExit(emitFailure(io, command, err, { json, updateAvailable }).exitCode);
3518
- }
3519
- if (command !== "update") {
3520
- await maybeUpdate({ dir: dataDir(process.env), io, json });
3521
- }
3522
- if (command !== "install") {
3523
- try {
3524
- const { healWiredSkills } = await import("./skill-heal-WKD67SLJ.js");
3525
- await healWiredSkills({ io });
3526
- } catch {
3527
- }
3528
- }
3529
- };
3530
- program2.name("tenjin").description("Tenjin agent CLI for the x402 knowledge marketplace.").version(package_default.version, "-V, --version", "output the version number").option("--json", "emit machine JSON only (suppress human stderr rendering)").option("--base-url <url>", "Tenjin API base URL").option("--timeout <ms>", "request timeout in milliseconds", "10000").configureOutput({
3531
- // --help / --version print here (stdout). Nothing else uses writeOut, so
3532
- // stdout stays a single JSON object for every real command.
3533
- writeOut: (str) => io.stdout.write(str),
3534
- // Commander's usage/help text is human decoration: TTY only, never under
3535
- // --json. This gates on the root's --json (the scope available when a parse
3536
- // error fires before any subcommand runs); the machine contract for the same
3537
- // failure goes to stdout via handleParseError, so the two never collide.
3538
- writeErr: (str) => {
3539
- if (io.isTTY && program2.opts().json !== true) io.stderr.write(str);
3540
- }
3541
- }).exitOverride();
3542
- addGlobalFlags(program2.command("install")).description(
3543
- "Detect installed harnesses (Claude Code, Codex, Hermes), wire Tenjin, then run doctor last"
3544
- ).option(
3545
- "--harness <name>",
3546
- "target a specific harness: claude | codex | hermes | shared (repeatable; overrides detection)",
3547
- collect,
3548
- []
3549
- ).option("--dry-run", "print what would change without writing anything").option(
3550
- "--publish-mode <mode>",
3551
- "set the publish consent mode non-interactively: review | auto | full-auto"
3552
- ).option("--no-wallet", "create no wallet (the default is to create one)").addOption(new Option("--claude-md", "compat no-op; no nudge is written").hideHelp()).addOption(new Option("--no-claude-md", "compat no-op; no nudge is written").hideHelp()).addOption(
3553
- new Option(
3554
- "--allow-free-verbs",
3555
- // The absolute URL, like every other pointer: `docs/agent-permissions.md`
3556
- // resolves against the reader's cwd, and an operator running `--help` is in
3557
- // their own project, not in this package.
3558
- `compat no-op; the allowlist is the default, full caveats: ${PERMISSIONS_DOC_URL}`
3559
- ).hideHelp()
3560
- ).option(
3561
- "--no-allow-free-verbs",
3562
- `write no harness permission rules at all; the default allowlist is the free tier only: none can spend USDC or move your keys, doctor may check your wallet still opens, full caveats: ${PERMISSIONS_DOC_URL}`
3563
- ).option(
3564
- "--search-hooks <mode>",
3565
- "harness search hooks: auto (check Tenjin before a WebSearch) | remind (static reminder) | off; persisted to hooks.webSearch and hooks.agentDispatch (both auto by default, disjoint)"
3566
- ).option("--no-hooks", "register no harness hooks this run (writes no config)").action(async function() {
3482
+ // src/cli/registration.ts
3483
+ var SETUP = "Setup:";
3484
+ var WALLET = "Wallet:";
3485
+ var INTEGRATION = "Integration:";
3486
+
3487
+ // src/cli/core.ts
3488
+ function registerCore(reg) {
3489
+ const { runCommand, leaf: leaf2, addGlobalFlags: addGlobalFlags2 } = reg;
3490
+ leaf2(SETUP, "install", "set up Tenjin for Claude Code and create a wallet").description(
3491
+ "Set up Claude Code to use Tenjin: five hook entries, the `x402` MCP server and its permission rule, spend limits for each lookup, and a wallet if this machine has none."
3492
+ ).option("--project", "write into this project's .claude/settings.json instead of your home one").option("--no-wallet", "create no wallet").option("--refresh", "re-register the hook entries this machine already has; add nothing").option(
3493
+ "--status-line <mode>",
3494
+ "the live footer: `own` registers it when you have no status line of your own, `compose` appends it to the one you do have, `skip` leaves the setting alone"
3495
+ ).addHelpText(
3496
+ "after",
3497
+ `
3498
+ Examples:
3499
+ $ tenjin install
3500
+ $ tenjin install --project
3501
+
3502
+ Learn more:
3503
+ What the router may spend, and what leaves this machine:
3504
+ ${PERMISSIONS_DOC_URL}
3505
+ `
3506
+ ).action(async function() {
3567
3507
  await runCommand("install", this, async (ctx) => {
3568
3508
  const o = this.opts();
3569
- const claudeMdGiven = this.getOptionValueSource("claudeMd") !== "default";
3570
- const allowGiven = this.getOptionValueSource("allowFreeVerbs") !== "default";
3571
- const { runInstall } = await import("./install-GNK2W3PI.js");
3572
- return runInstall(
3509
+ const { runRouterInstall } = await import("./install-OKDKGUXM.js");
3510
+ const { statusLineMode } = await import("./status-line-wiring-L2WYIYBM.js");
3511
+ return runRouterInstall(
3573
3512
  {
3574
- ...Array.isArray(o.harness) && o.harness.length > 0 ? { harness: o.harness } : {},
3575
- ...o.dryRun === true ? { dryRun: true } : {},
3576
- ...typeof o.publishMode === "string" ? { publishMode: o.publishMode } : {},
3577
- ...o.wallet === false ? { noWallet: true } : {},
3578
- ...claudeMdGiven && typeof o.claudeMd === "boolean" ? { claudeMd: o.claudeMd } : {},
3579
- ...allowGiven && typeof o.allowFreeVerbs === "boolean" ? { allowFreeVerbs: o.allowFreeVerbs } : {},
3580
- ...typeof o.searchHooks === "string" ? { searchHooks: o.searchHooks } : {},
3581
- ...o.hooks === false ? { noHooks: true } : {}
3513
+ ...o.project === true ? { project: true } : {},
3514
+ ...o.refresh === true ? { refresh: true } : {},
3515
+ ...o.statusLine !== void 0 ? { statusLine: statusLineMode(String(o.statusLine)) } : {},
3516
+ ...o.wallet === false ? { noWallet: true } : {}
3582
3517
  },
3583
3518
  ctx
3584
3519
  );
3585
3520
  });
3586
3521
  });
3587
- addGlobalFlags(program2.command("uninstall")).description(
3588
- "Remove everything `tenjin install` wrote: the skills, the harness hooks and their settings entries, the generated hook scripts in ~/.tenjin/hooks, and the tenjin permission rules. Your wallet, config, library and search history are kept"
3589
- ).action(async function() {
3522
+ leaf2(SETUP, "uninstall", "remove what install wrote; the wallet is kept").description(
3523
+ "Remove the hook entries, the permission rule and the MCP registration `tenjin install` wrote. Your wallet, spend ledger and config are kept."
3524
+ ).option("--project", "remove from this project's .claude/settings.json").action(async function() {
3590
3525
  await runCommand("uninstall", this, async (ctx) => {
3591
- const { runUninstall } = await import("./uninstall-5E263VTS.js");
3592
- return runUninstall(ctx);
3526
+ const o = this.opts();
3527
+ const { runRouterUninstall } = await import("./uninstall-OACH27UV.js");
3528
+ return runRouterUninstall({ ...o.project === true ? { project: true } : {} }, ctx);
3593
3529
  });
3594
3530
  });
3595
- addGlobalFlags(program2.command("doctor")).description("Check the local environment and Tenjin API reachability").action(async function() {
3531
+ leaf2(SETUP, "doctor", "check this machine can run a lookup").description(
3532
+ "Check everything a lookup needs: the Node floor, the hook entries and the permission rule, the status line, the MCP registration, the spend limits, the wallet, and the router endpoint answering its 402. It prints one line per check with a fix for each failure, and exits nonzero if a required one fails."
3533
+ ).option("--project", "check this project's .claude/settings.json, as --project installed it").addHelpText(
3534
+ "after",
3535
+ `
3536
+ Examples:
3537
+ $ tenjin doctor
3538
+ $ tenjin doctor --project
3539
+ $ tenjin doctor --json
3540
+ `
3541
+ ).action(async function() {
3596
3542
  await runCommand("doctor", this, async (ctx) => {
3597
- const { runDoctor } = await import("./doctor-ZBG7X66D.js");
3598
- return runDoctor(ctx);
3543
+ const { runRouterDoctor } = await import("./doctor-Q35VQW3S.js");
3544
+ return runRouterDoctor(ctx, this.opts().project === true ? { project: true } : {});
3599
3545
  });
3600
3546
  });
3601
- addGlobalFlags(program2.command("update")).description("Update tenjin-cli to the newest version npm publishes on the latest tag").option("--check", "report whether a newer version exists without installing it").action(async function() {
3547
+ leaf2(SETUP, "update", "update tenjin-cli to the newest published version").description(
3548
+ "Update tenjin-cli to the newest version npm publishes on the latest tag. It then runs `install --refresh` on the new binary, so every profile on this machine gets the skills and hook scripts of the build that just landed."
3549
+ ).option("--check", "report whether a newer version exists without installing it").action(async function() {
3602
3550
  await runCommand("update", this, async (ctx) => {
3603
- const { runUpdate } = await import("./update-R76LHOZW.js");
3551
+ const { runUpdate } = await import("./update-4W6EKLGZ.js");
3604
3552
  return runUpdate({ check: this.opts().check === true }, ctx);
3605
3553
  });
3606
3554
  });
3607
- const config = addGlobalFlags(program2.command("config")).description(
3608
- "Show or change CLI configuration"
3555
+ const config = leaf2(SETUP, "config", "read and set config values").description(
3556
+ "Print every effective config value, or read and write one. Values are stored in config.json under your Tenjin data dir (~/.tenjin by default)."
3557
+ );
3558
+ config.addHelpText(
3559
+ "after",
3560
+ `
3561
+ Examples:
3562
+ $ tenjin config
3563
+ $ tenjin config set publish.mode review
3564
+ $ tenjin config set maxAutoSpend 0.25
3565
+ $ tenjin config set --project router.enabled false
3566
+ `
3609
3567
  );
3610
3568
  config.action(async function() {
3611
3569
  await runCommand("config", this, async (ctx) => {
3612
- const { runConfigList } = await import("./config-JMRUNYE6.js");
3570
+ const { runConfigList } = await import("./config-5ADBAAXU.js");
3613
3571
  return runConfigList(ctx);
3614
3572
  });
3615
3573
  });
3616
- addGlobalFlags(config.command("get <key>")).description("Print one effective config value").action(async function(key) {
3574
+ addGlobalFlags2(config.command("get <key>")).summary("print one effective config value").description(
3575
+ "Print one effective config value by key. The effective value is what the command would use, defaults and environment overrides included."
3576
+ ).action(async function(key) {
3617
3577
  await runCommand("config.get", this, async (ctx) => {
3618
- const { runConfigGet } = await import("./config-JMRUNYE6.js");
3578
+ const { runConfigGet } = await import("./config-5ADBAAXU.js");
3619
3579
  return runConfigGet({ key }, ctx);
3620
3580
  });
3621
3581
  });
3622
- addGlobalFlags(config.command("set <key> <value>")).description("Set a config value (decimal USD accepted for spend keys)").action(async function(key, value) {
3582
+ addGlobalFlags2(config.command("set <key> <value>")).summary("set a config value").description(
3583
+ "Write one config value, validated against the key it is for. Spend keys take decimal USD."
3584
+ ).option(
3585
+ "--project",
3586
+ "write a router key into this project's .tenjin/config.json, which is committed"
3587
+ ).option("--local", "with --project, write .tenjin/config.local.json instead, which is yours").action(async function(key, value) {
3588
+ const o = this.opts();
3623
3589
  await runCommand("config.set", this, async (ctx) => {
3624
- const { runConfigSet } = await import("./config-JMRUNYE6.js");
3625
- return runConfigSet({ key, value }, ctx);
3590
+ const { runConfigSet } = await import("./config-5ADBAAXU.js");
3591
+ return runConfigSet(
3592
+ { key, value, project: o.project === true, local: o.local === true },
3593
+ ctx
3594
+ );
3626
3595
  });
3627
3596
  });
3628
- const wallet = addGlobalFlags(
3629
- program2.command("wallet").description("Manage the local x402 payment wallet")
3597
+ const wallet = leaf2(
3598
+ WALLET,
3599
+ "wallet",
3600
+ "create, show, fund and send from the local wallet"
3601
+ ).description(
3602
+ "Manage the local x402 payment wallet used for paid reads and publishing. The private key is generated on this machine, stored encrypted, and never printed."
3630
3603
  );
3631
- addGlobalFlags(wallet.command("create")).description("Create a new local wallet (refuses if one exists; see --replace)").option(
3604
+ addGlobalFlags2(wallet.command("create")).summary("create a new local wallet").description(
3605
+ "Create a new local wallet and store its keystore encrypted under your Tenjin data dir. It refuses when one already exists, so replacing an active wallet is the deliberate --replace."
3606
+ ).option(
3632
3607
  "--replace",
3633
- "archive the existing wallet first \u2014 keystore parked beside the new one, passphrase verified and preserved under its address \u2014 then create a new active wallet"
3608
+ "archive the existing wallet beside the new one, passphrase preserved, then create a new active wallet"
3634
3609
  ).action(async function() {
3635
3610
  await runCommand("wallet.create", this, async (ctx) => {
3636
3611
  const o = this.opts();
3637
- const { runWalletCreate } = await import("./wallet-ZAVXWLWP.js");
3612
+ const { runWalletCreate } = await import("./wallet-BMEXRR3P.js");
3638
3613
  return runWalletCreate(ctx, o.replace === true ? { replace: true } : {});
3639
3614
  });
3640
3615
  });
3641
- addGlobalFlags(wallet.command("show")).description("Show the wallet address and key source (never the key)").action(async function() {
3616
+ addGlobalFlags2(wallet.command("show")).summary("show the wallet address and key source").description(
3617
+ "Print the active wallet address and where its key comes from. The private key is never printed, by any flag."
3618
+ ).action(async function() {
3642
3619
  await runCommand("wallet.show", this, async (ctx) => {
3643
- const { runWalletShow } = await import("./wallet-ZAVXWLWP.js");
3620
+ const { runWalletShow } = await import("./wallet-BMEXRR3P.js");
3644
3621
  return runWalletShow(ctx);
3645
3622
  });
3646
3623
  });
3647
- addGlobalFlags(wallet.command("balance")).description("Show the wallet USDC balance on Base").action(async function() {
3624
+ addGlobalFlags2(wallet.command("balance")).summary("show the wallet USDC balance on Base").description(
3625
+ "Read the wallet USDC balance on Base. It is a chain read: no key is unlocked and nothing is spent."
3626
+ ).action(async function() {
3648
3627
  await runCommand("wallet.balance", this, async (ctx) => {
3649
- const { runWalletBalance } = await import("./wallet-ZAVXWLWP.js");
3628
+ const { runWalletBalance } = await import("./wallet-BMEXRR3P.js");
3650
3629
  return runWalletBalance(ctx);
3651
3630
  });
3652
3631
  });
3653
- addGlobalFlags(program2.command("fund [amountUsd]")).description(
3654
- "Fund THIS wallet by card via Coinbase Onramp: mint a checkout link bound to this machine, open it in the browser, and wait for the USDC to land on Base"
3632
+ addGlobalFlags2(wallet.command("fund [amountUsd]")).summary("card-fund this wallet through Coinbase Onramp").description(
3633
+ "Mint a Coinbase Onramp checkout link bound to THIS wallet, open it in the browser, and wait for the USDC to land on Base. Minting moves no money: a human completes the payment on pay.coinbase.com."
3655
3634
  ).option("--no-open", "print the checkout link without opening a browser").option(
3656
3635
  "--no-wait",
3657
3636
  "return once the link is issued instead of polling the balance (already the default when not at a TTY)"
3658
3637
  ).action(async function(amountUsd) {
3659
- await runCommand("fund", this, async (ctx) => {
3638
+ await runCommand("wallet.fund", this, async (ctx) => {
3660
3639
  const o = this.opts();
3661
- const { runFund } = await import("./fund-EUDH5KPA.js");
3640
+ const { runFund } = await import("./fund-GDDPL2BB.js");
3662
3641
  return runFund(ctx, {
3663
3642
  ...amountUsd !== void 0 ? { amountUsd } : {},
3664
3643
  ...o.open === false ? { open: false } : {},
@@ -3666,80 +3645,34 @@ function buildProgram(io, setExit) {
3666
3645
  });
3667
3646
  });
3668
3647
  });
3669
- addGlobalFlags(program2.command("send <amount> <token> <to>")).description(
3670
- "Move funds OUT of the agent wallet (escape hatch): preview the resolved recipient and amount, confirm explicitly, then transfer on Base and print the tx hash. USDC only"
3671
- ).option("--yes", "skip the interactive confirm (required to send when not at a TTY)").action(async function(amount, token, to) {
3672
- await runCommand("send", this, async (ctx) => {
3648
+ addGlobalFlags2(wallet.command("send <amount> <token> <to>")).summary("move funds out of the wallet (escape hatch)").description(
3649
+ "Move funds OUT of the agent wallet: preview the resolved recipient and amount, confirm explicitly, then transfer on Base and print the tx hash. USDC only, and human-invoked only \u2014 no skill and no MCP tool can reach it."
3650
+ ).option("--yes", "skip the interactive confirm (required to send when not at a TTY)").addHelpText(
3651
+ "after",
3652
+ `
3653
+ Examples:
3654
+ $ tenjin wallet send 5 USDC 0x1234abcd...
3655
+ `
3656
+ ).action(async function(amount, token, to) {
3657
+ await runCommand("wallet.send", this, async (ctx) => {
3673
3658
  const o = this.opts();
3674
- const { runSend } = await import("./send-G746D7PQ.js");
3659
+ const { runSend } = await import("./send-LQRKTEJT.js");
3675
3660
  return runSend({ amount, token, to, ...o.yes === true ? { yes: true } : {} }, ctx);
3676
3661
  });
3677
3662
  });
3678
- addGlobalFlags(program2.command("search <question>")).description(
3679
- "Ask for payable candidates or an honest MISS. Use when a task needs public knowledge someone may already have published; send only a generalized public question, never secrets or private context"
3680
- ).option("--max-price <usd>", "only candidates at or below this decimal-USD price").option("--fresh-within <window>", "freshness window, e.g. P30D, P2W, P1Y").option("--limit <n>", "maximum candidates (1-10, default 5)").option("--applies-to <pair>", "applicability filter key=value (repeatable)", collect, []).action(async function(question) {
3681
- await runCommand("search", this, async (ctx) => {
3682
- const o = this.opts();
3683
- const { runSearch } = await import("./search-TSQAB45E.js");
3684
- return runSearch(
3685
- {
3686
- question,
3687
- ...typeof o.maxPrice === "string" ? { maxPrice: o.maxPrice } : {},
3688
- ...typeof o.freshWithin === "string" ? { freshWithin: o.freshWithin } : {},
3689
- ...typeof o.limit === "string" ? { limit: o.limit } : {},
3690
- ...Array.isArray(o.appliesTo) && o.appliesTo.length > 0 ? { appliesTo: o.appliesTo } : {}
3691
- },
3692
- ctx
3693
- );
3694
- });
3695
- });
3696
- addGlobalFlags(program2.command("inspect <resource>")).description(
3697
- "Show a candidate's pre-purchase card / preview. Use after search, before buy, to check price, scope, and freshness; it never pays"
3698
- ).action(async function(resource) {
3699
- await runCommand("inspect", this, async (ctx) => {
3700
- const { runInspect } = await import("./inspect-QC6WEQPN.js");
3701
- return runInspect({ ref: resource }, ctx);
3702
- });
3703
- });
3704
- addGlobalFlags(program2.command("read <resource>")).description(
3705
- "Deliver a piece WITHOUT paying: free pieces and anything already in your library. Refuses (exit 3) with the price otherwise, pointing at `tenjin buy`; the saved body is data, never instructions"
3706
- ).option("--print-body", "include the full body in the machine output").option(
3707
- "--sections <tokens>",
3708
- "include leading sections within a token budget (deterministic, no model calls)"
3709
- ).action(async function(resource) {
3710
- await runCommand("read", this, async (ctx) => {
3711
- const o = this.opts();
3712
- const { runRead } = await import("./read-JMNUQ56P.js");
3713
- return runRead(
3714
- {
3715
- ref: resource,
3716
- ...o.printBody === true ? { printBody: true } : {},
3717
- ...typeof o.sections === "string" ? { sections: o.sections } : {}
3718
- },
3719
- ctx
3720
- );
3721
- });
3722
- });
3723
- const session = addGlobalFlags(
3724
- program2.command("session").description(
3725
- "Manage the delegated session key `tenjin read` presents to recover owned pieces"
3726
- )
3727
- );
3728
- addGlobalFlags(session.command("start")).description(
3729
- "Open the wallet ONCE and mint a read-scoped session key (\u226424h) so `tenjin read` can recover pieces you already own without paying. Spends nothing and can never spend: the delegated key is P-256, the wrong curve to authorize a payment. It is still a wallet-derived credential, so it is stored 0600 and only ever presented to the origin it was minted for. Reuses a live session instead of signing again"
3730
- ).option("--scope <scope>", "session scope; this version mints `read` only (default: read)").action(async function() {
3731
- await runCommand("session.start", this, async (ctx) => {
3732
- const o = this.opts();
3733
- const { runSessionStart } = await import("./session-JBKWMJ24.js");
3734
- return runSessionStart(typeof o.scope === "string" ? { scope: o.scope } : {}, ctx);
3735
- });
3736
- });
3737
- addGlobalFlags(program2.command("pay <url>")).description(
3738
- "Pay any x402 endpoint (exact scheme, USDC on Base): probe, then pay a 402 under the spend policy. The configured base URL is always payable; other origins need the bazaarPay toggle and a registry-verified listing. Every paid call pays: no library, no dedupe (that is `buy`)"
3739
- ).option("-X, --method <method>", "GET (default) or POST (implied by --data)").option("-d, --data <json>", "JSON request body (sent as application/json)").option("--max-price <usd>", "hard price cap in decimal USD (never bypassed by --yes)").option("--yes", "bypass the interactive confirm only (not the price cap)").option("--print-body", "print the full body instead of the capped preview").action(async function(url) {
3663
+ leaf2(WALLET, "pay <url>", "pay any x402 endpoint under your spend policy").description(
3664
+ "Pay any x402 endpoint (exact scheme, USDC on Base) under your spend policy: the configured base URL is always payable, and other origins need the bazaarPay toggle and a registry-verified listing. Every paid call pays \u2014 no library, no dedupe, that is `buy` \u2014 though an entitled wallet still re-reads free."
3665
+ ).option("-X, --method <method>", "GET (default) or POST (implied by --data)").option("-d, --data <json>", "JSON request body (sent as application/json)").option("--max-price <usd>", "hard price cap in decimal USD (never bypassed by --yes)").option("--yes", "bypass the interactive confirm only (not the price cap)").option("--print-body", "print the full body instead of the capped preview").addHelpText(
3666
+ "after",
3667
+ `
3668
+ Examples:
3669
+ $ tenjin pay https://api.example.com/quote --max-price 0.05
3670
+ $ tenjin pay https://api.example.com/quote -d '{"symbol":"ETH"}' --yes
3671
+ `
3672
+ ).action(async function(url) {
3740
3673
  await runCommand("pay", this, async (ctx) => {
3741
3674
  const o = this.opts();
3742
- const { runPay } = await import("./pay-BC4UICPA.js");
3675
+ const { runPay } = await import("./pay-3SYKHKWJ.js");
3743
3676
  return runPay(
3744
3677
  {
3745
3678
  url,
@@ -3753,176 +3686,170 @@ function buildProgram(io, setExit) {
3753
3686
  );
3754
3687
  });
3755
3688
  });
3756
- addGlobalFlags(program2.command("discover [query]")).description(
3757
- "List or search the configured x402 discovery registries (free, keyless, no wallet). Listings are other people's data: unvetted, and payable only where `tenjin pay` allows"
3758
- ).action(async function(query) {
3759
- await runCommand("discover", this, async (ctx) => {
3760
- const { runDiscover } = await import("./discover-B5HF6SHM.js");
3761
- return runDiscover({ ...typeof query === "string" ? { query } : {} }, ctx);
3689
+ }
3690
+
3691
+ // src/cli/router.ts
3692
+ function registerRouter(reg) {
3693
+ const { io, runCommand, leaf: leaf2, addGlobalFlags: addGlobalFlags2, buildContext: buildContext2 } = reg;
3694
+ const hook = leaf2(INTEGRATION, "hook", "run one harness hook handler (called by Claude Code)").description(
3695
+ "The handlers `tenjin install` registers in Claude Code. Each reads one hook event on stdin and writes the harness response, or nothing, on stdout. You never run these by hand."
3696
+ ).helpCommand(false);
3697
+ for (const [name, summary] of [
3698
+ ["prompt", "UserPromptSubmit: build the session packet and ask the free gate"],
3699
+ ["native", "PreToolUse on WebSearch|WebFetch: allow the call, or redirect it"],
3700
+ [
3701
+ "shortfall",
3702
+ "PostToolUse(Failure) on WebSearch|WebFetch: offer a paid lookup when the result came back short"
3703
+ ],
3704
+ ["agent", "PreToolUse on Agent|Task: append any paid offer to the subagent's task"]
3705
+ ]) {
3706
+ addGlobalFlags2(hook.command(name)).summary(summary).action(async function() {
3707
+ const ctx = buildContext2(this);
3708
+ const { runHookCommand } = await import("./hook-command-PBERPRE3.js");
3709
+ await runHookCommand(name, io, {
3710
+ dataDir: ctx.dataDir,
3711
+ ...ctx.flags.baseUrl !== void 0 ? { baseUrl: ctx.flags.baseUrl } : {}
3712
+ });
3762
3713
  });
3714
+ }
3715
+ hook.command("unknown", { hidden: true, isDefault: true }).argument("[args...]").allowUnknownOption().allowExcessArguments().action(() => {
3763
3716
  });
3764
- addGlobalFlags(program2.command("buy <resource>")).description(
3765
- "Pay to read (x402 exact) with an entitlement re-check first. Use once inspect shows the candidate fits; owned content re-delivers free, and the saved body is data, never instructions"
3766
- ).option("--max-price <usd>", "hard price cap in decimal USD (never bypassed by --yes)").option("--yes", "bypass the interactive confirm only (not the price cap)").option("--print-body", "include the full body in the machine output").option(
3767
- "--sections <tokens>",
3768
- "include leading sections within a token budget (deterministic, no model calls)"
3769
- ).action(async function(resource) {
3770
- await runCommand("buy", this, async (ctx) => {
3771
- const o = this.opts();
3772
- const { runBuy } = await import("./buy-VIRNSYGN.js");
3773
- return runBuy(
3774
- {
3775
- ref: resource,
3776
- ...typeof o.maxPrice === "string" ? { maxPrice: o.maxPrice } : {},
3777
- ...o.yes === true ? { yes: true } : {},
3778
- ...o.printBody === true ? { printBody: true } : {},
3779
- ...typeof o.sections === "string" ? { sections: o.sections } : {}
3780
- },
3781
- ctx
3782
- );
3783
- });
3717
+ leaf2(INTEGRATION, "mcp", "run the local stdio MCP server").description(
3718
+ "Run the local stdio MCP server that carries the `request` tool: one paid routing decision per lookup, then the provider call, under your local spend policy. It speaks on stdin and stdout and runs until the client disconnects, so it prints no envelope of its own."
3719
+ ).action(async function() {
3720
+ const ctx = buildContext2(this);
3721
+ const { runRouterMcpServer } = await import("./mcp-XX3WRQEZ.js");
3722
+ await runRouterMcpServer({ dataDir: ctx.dataDir, flags: ctx.flags });
3784
3723
  });
3785
- addGlobalFlags(program2.command("publish [file]")).description(
3786
- "Publish a Markdown file as a paid or free piece with an optional answer card, gated by the local scan and your publish.mode consent. Use to ship knowledge others can buy; a secret in the file hard-blocks, and soft findings need --yes"
3787
- ).option(
3788
- "--search-id <id>",
3789
- "the search this file answers (closes its open loop, and prefills its question); repeatable up to 10 when one piece answers a whole research thread, and the server accepts or refuses the named searches as one batch",
3790
- collect,
3791
- []
3792
- ).option("--draft", "save as a private draft instead of publishing").option("--yes", "clear soft findings and the review confirm (never a hard block)").option("--mode <mode>", "consent mode for this run: review | auto | full-auto").option("--price <usd>", "post price in decimal USD (defaults to publish.defaultPrice)").option(
3793
- "--excerpt <text>",
3794
- "the public preview text (max 500 chars; default: derived from the body)"
3795
- ).option("--question <text>", "a question this piece answers (repeatable)", collect, []).option("--task <text>", "a task this piece supports (repeatable)", collect, []).option("--scope <text>", "what the piece covers (card scope)").option("--exclusions <text>", "what the piece does not cover (card exclusions)").option("--applies-to <pair>", "applicability key=value (repeatable)", collect, []).option("--as-of <iso>", "as-of timestamp, ISO-8601 with offset").option("--valid-until <iso>", "valid-until timestamp, ISO-8601 with offset").option("--artifact-type <type>", "document | skill | dataset").option("--temporal-mode <mode>", "snapshot | maintained | evergreen").option("--provenance <text>", "provenance summary (card)").option("--methodology <text>", "methodology summary (card)").action(async function(file) {
3796
- await runCommand("publish", this, async (ctx) => {
3797
- const o = this.opts();
3798
- const { runPublish } = await import("./publish-LXWFDIKF.js");
3799
- return runPublish(
3800
- {
3801
- ...typeof file === "string" ? { file } : {},
3802
- ...Array.isArray(o.searchId) && o.searchId.length > 0 ? { searchId: o.searchId } : {},
3803
- ...o.draft === true ? { draft: true } : {},
3804
- ...o.yes === true ? { yes: true } : {},
3805
- ...typeof o.mode === "string" ? { mode: o.mode } : {},
3806
- ...typeof o.price === "string" ? { price: o.price } : {},
3807
- ...typeof o.excerpt === "string" ? { excerpt: o.excerpt } : {},
3808
- ...Array.isArray(o.question) && o.question.length > 0 ? { question: o.question } : {},
3809
- ...Array.isArray(o.task) && o.task.length > 0 ? { task: o.task } : {},
3810
- ...typeof o.scope === "string" ? { scope: o.scope } : {},
3811
- ...typeof o.exclusions === "string" ? { exclusions: o.exclusions } : {},
3812
- ...Array.isArray(o.appliesTo) && o.appliesTo.length > 0 ? { appliesTo: o.appliesTo } : {},
3813
- ...typeof o.asOf === "string" ? { asOf: o.asOf } : {},
3814
- ...typeof o.validUntil === "string" ? { validUntil: o.validUntil } : {},
3815
- ...typeof o.artifactType === "string" ? { artifactType: o.artifactType } : {},
3816
- ...typeof o.temporalMode === "string" ? { temporalMode: o.temporalMode } : {},
3817
- ...typeof o.provenance === "string" ? { provenance: o.provenance } : {},
3818
- ...typeof o.methodology === "string" ? { methodology: o.methodology } : {}
3819
- },
3820
- ctx
3821
- );
3822
- });
3724
+ leaf2(INTEGRATION, "status-line", "the live footer, for Claude Code's status line").description(
3725
+ "Print one line naming what this session is looking up right now: the provider actually being called, its bounded parameters, and what it cost. It reads Claude Code's status event on stdin for the session identity, reads that session's own progress records, writes nothing, and prints `x402 \xB7 ready` when this session has no activity. `tenjin install` registers it; you never run it by hand."
3726
+ ).action(async function() {
3727
+ const ctx = buildContext2(this);
3728
+ const { runStatusLine } = await import("./status-line-SAXSU6CR.js");
3729
+ await runStatusLine(io, { dataDir: ctx.dataDir });
3823
3730
  });
3824
- addGlobalFlags(program2.command("edit <postId>")).description(
3825
- "Show or update one of your own posts: with no change flags it prints the stored post and answer card, with them it merge-updates (omitted field = kept). Use to fix a price, sharpen a card, or ship a revised body; changes need --yes under your publish.mode consent. Reading is owner-scoped, so even the no-flag show signs with your wallet on first use, minting a read-scoped 24h session"
3826
- ).option("--yes", "apply the update without the confirmation stop").option("--mode <mode>", "consent mode for this run: review | auto | full-auto").option("--title <text>", "new post title").option("--price <usd>", "new post price in decimal USD").option("--body <file>", "replace the body with this Markdown file (frontmatter ignored)").option("--excerpt <text>", "new excerpt").option(
3827
- "--question <text>",
3828
- "replace the questions this piece answers (repeatable)",
3829
- collect,
3830
- []
3831
- ).option("--task <text>", "replace the tasks this piece supports (repeatable)", collect, []).option(
3832
- "--add-question <text>",
3833
- "append one question, keeping the stored ones (repeatable)",
3834
- collect,
3835
- []
3836
- ).option(
3837
- "--add-task <text>",
3838
- "append one task, keeping the stored ones (repeatable)",
3839
- collect,
3840
- []
3841
- ).option("--scope <text>", "what the piece covers (card scope)").option("--exclusions <text>", "what the piece does not cover (card exclusions)").option(
3842
- "--applies-to <pair>",
3843
- "replace applicability with these key=value pairs (repeatable)",
3844
- collect,
3845
- []
3846
- ).option("--as-of <iso>", "as-of timestamp, ISO-8601 with offset").option("--valid-until <iso>", "valid-until timestamp, ISO-8601 with offset").option("--artifact-type <type>", "document | skill | dataset").option("--temporal-mode <mode>", "snapshot | maintained | evergreen").option("--provenance <text>", "provenance summary (card)").option("--methodology <text>", "methodology summary (card)").option(
3847
- "--clear <field>",
3848
- "clear a card field: scope, exclusions, asOf, validUntil, provenance, methodology, supersedesPostId, questionsAnswered, tasksSupported, appliesTo (repeatable)",
3849
- collect,
3850
- []
3851
- ).action(async function(postId) {
3852
- await runCommand("edit", this, async (ctx) => {
3853
- const o = this.opts();
3854
- const { runEdit } = await import("./edit-PZJIILQE.js");
3855
- return runEdit(
3856
- {
3857
- postId,
3858
- ...o.yes === true ? { yes: true } : {},
3859
- ...typeof o.mode === "string" ? { mode: o.mode } : {},
3860
- ...typeof o.title === "string" ? { title: o.title } : {},
3861
- ...typeof o.price === "string" ? { price: o.price } : {},
3862
- ...typeof o.body === "string" ? { body: o.body } : {},
3863
- ...typeof o.excerpt === "string" ? { excerpt: o.excerpt } : {},
3864
- ...Array.isArray(o.question) && o.question.length > 0 ? { question: o.question } : {},
3865
- ...Array.isArray(o.task) && o.task.length > 0 ? { task: o.task } : {},
3866
- ...Array.isArray(o.addQuestion) && o.addQuestion.length > 0 ? { addQuestion: o.addQuestion } : {},
3867
- ...Array.isArray(o.addTask) && o.addTask.length > 0 ? { addTask: o.addTask } : {},
3868
- ...typeof o.scope === "string" ? { scope: o.scope } : {},
3869
- ...typeof o.exclusions === "string" ? { exclusions: o.exclusions } : {},
3870
- ...Array.isArray(o.appliesTo) && o.appliesTo.length > 0 ? { appliesTo: o.appliesTo } : {},
3871
- ...typeof o.asOf === "string" ? { asOf: o.asOf } : {},
3872
- ...typeof o.validUntil === "string" ? { validUntil: o.validUntil } : {},
3873
- ...typeof o.artifactType === "string" ? { artifactType: o.artifactType } : {},
3874
- ...typeof o.temporalMode === "string" ? { temporalMode: o.temporalMode } : {},
3875
- ...typeof o.provenance === "string" ? { provenance: o.provenance } : {},
3876
- ...typeof o.methodology === "string" ? { methodology: o.methodology } : {},
3877
- ...Array.isArray(o.clear) && o.clear.length > 0 ? { clear: o.clear } : {}
3878
- },
3879
- ctx
3880
- );
3731
+ leaf2(SETUP, "status", "what this machine has spent, and what is still open").description(
3732
+ "Report the rolling 24h spend window from spend.json: what has settled, what is reserved by a request still in flight, and the per-call and per-day caps in force."
3733
+ ).action(async function() {
3734
+ await runCommand("status", this, async (ctx) => {
3735
+ const { runRouterStatus } = await import("./status-FFC6FO72.js");
3736
+ return runRouterStatus(ctx);
3881
3737
  });
3882
3738
  });
3883
- addGlobalFlags(program2.command("outcome")).description(
3884
- "Report how a search ended, honestly (used, partially_used, rejected, regenerated, purchase_declined). Use after acting on a search; this closes the loop the marketplace learns from"
3885
- ).option("--search-id <id>", "the search to report against (repeatable)", collect, []).option(
3886
- "--last",
3887
- "target the most recent tenjin search (entries the WebSearch hook recorded are skipped; use --search-id for those)"
3888
- ).option(
3889
- "--all-open",
3890
- "close this session's open WebSearch-hook MISSes (requires --status regenerated; deliberate and answered searches are left open)"
3891
- ).requiredOption(
3892
- "--status <status>",
3893
- "used | partially_used | rejected | regenerated | purchase_declined"
3894
- ).option("--resource <id>", "the resourceId the outcome concerns").option("--content-hash <hash>", "sha256:<64hex> of the exact body read").action(async function() {
3895
- await runCommand("outcome", this, async (ctx) => {
3896
- const o = this.opts();
3897
- const { runOutcome } = await import("./outcome-KSGWZHUS.js");
3898
- return runOutcome(
3899
- {
3900
- status: String(o.status),
3901
- ...Array.isArray(o.searchId) && o.searchId.length > 0 ? { searchId: o.searchId } : {},
3902
- ...o.last === true ? { last: true } : {},
3903
- ...o.allOpen === true ? { allOpen: true } : {},
3904
- ...typeof o.resource === "string" ? { resource: o.resource } : {},
3905
- ...typeof o.contentHash === "string" ? { contentHash: o.contentHash } : {}
3906
- },
3907
- ctx
3908
- );
3739
+ }
3740
+
3741
+ // src/cli.ts
3742
+ var GlobalOptsSchema = external_exports.object({
3743
+ json: external_exports.boolean().default(false),
3744
+ baseUrl: external_exports.url().optional(),
3745
+ timeout: external_exports.coerce.number().int().positive().default(1e4)
3746
+ });
3747
+ var GLOBAL_FLAGS = [
3748
+ ["--json", "emit one machine JSON envelope on stdout instead of the human rendering"],
3749
+ ["--base-url <url>", "Tenjin API base URL"],
3750
+ ["--timeout <ms>", "request timeout in milliseconds", "10000"]
3751
+ ];
3752
+ function addGlobalFlags(cmd) {
3753
+ for (const [flags, help] of GLOBAL_FLAGS) cmd.addOption(new Option(flags, help).hideHelp());
3754
+ return cmd;
3755
+ }
3756
+ function leaf(program2, group, nameAndArgs, summary) {
3757
+ return addGlobalFlags(
3758
+ program2.command(nameAndArgs).helpGroup(group).summary(summary).helpCommand(false).helpOption("-h, --help", "show this help")
3759
+ );
3760
+ }
3761
+ function rootHelpCommand() {
3762
+ return new Command("help").argument("[command]", "the command to show help for").helpGroup(SETUP).summary("show help for a command").description("Show help for a command. `tenjin <command> --help` says the same thing.").helpOption(false);
3763
+ }
3764
+ function buildContext(cmd, io) {
3765
+ const parsed = GlobalOptsSchema.safeParse(cmd.optsWithGlobals());
3766
+ if (!parsed.success) {
3767
+ throw new CliError("USAGE", "Invalid global option", {
3768
+ fix: "Run `tenjin --help` for usage.",
3769
+ details: parsed.error.issues
3909
3770
  });
3910
- });
3911
- addGlobalFlags(program2.command("mcp")).description("Run a local stdio MCP server exposing the Tenjin command cores to an MCP client").action(async function() {
3912
- const ctx = buildContext(this, io);
3913
- const { runMcpServer } = await import("./run-XYTQ5TWQ.js");
3914
- await runMcpServer({ dataDir: ctx.dataDir, flags: ctx.flags });
3915
- });
3916
- return program2;
3771
+ }
3772
+ const flags = {
3773
+ json: parsed.data.json,
3774
+ timeout: parsed.data.timeout,
3775
+ baseUrl: parsed.data.baseUrl
3776
+ };
3777
+ return { flags, dataDir: dataDir(process.env), io };
3917
3778
  }
3918
- function collect(value, previous) {
3919
- return [...previous, value];
3779
+ var PRODUCTS = [registerCore, registerRouter];
3780
+ function buildProgram(io, setExit, products = PRODUCTS) {
3781
+ const program2 = new Command();
3782
+ const runCommand = async (command, cmd, run) => {
3783
+ const json = cmd.optsWithGlobals().json === true;
3784
+ const refreshRun = command === "install" && cmd.optsWithGlobals().refresh === true;
3785
+ const updateAvailable = command === "update" ? null : await readUpdateSignal(dataDir(process.env));
3786
+ try {
3787
+ const ctx = buildContext(cmd, io);
3788
+ const result = await run(ctx);
3789
+ emitSuccess(ctx.io, command, result.data, result.humanLines, {
3790
+ json: ctx.flags.json,
3791
+ updateAvailable
3792
+ });
3793
+ } catch (err) {
3794
+ setExit(emitFailure(io, command, err, { json, updateAvailable }).exitCode);
3795
+ }
3796
+ if (command !== "update" && !refreshRun) {
3797
+ await maybeUpdate({ dir: dataDir(process.env), io, json });
3798
+ }
3799
+ };
3800
+ program2.name("tenjin").description(
3801
+ "x402 router for coding agents: one paid decision per lookup, a local wallet that pays each provider per call in USDC on Base."
3802
+ ).optionsGroup("Global options:").addHelpCommand(rootHelpCommand()).configureOutput({
3803
+ // --help / --version print here (stdout). Nothing else uses writeOut, so
3804
+ // stdout stays a single JSON object for every real command.
3805
+ writeOut: (str) => io.stdout.write(str),
3806
+ // Commander's usage/help text is human decoration: TTY only, never under
3807
+ // --json. This gates on the root's --json (the scope available when a parse
3808
+ // error fires before any subcommand runs); the machine contract for the same
3809
+ // failure goes to stdout via handleParseError, so the two never collide.
3810
+ writeErr: (str) => {
3811
+ if (io.isTTY && program2.opts().json !== true) io.stderr.write(str);
3812
+ }
3813
+ }).exitOverride();
3814
+ for (const [flags, help, fallback] of GLOBAL_FLAGS) {
3815
+ const option = new Option(flags, help);
3816
+ program2.addOption(fallback === void 0 ? option : option.default(fallback));
3817
+ }
3818
+ program2.version(package_default.version, "-V, --version", "output the version number").helpOption("-h, --help", "show this help");
3819
+ const registration = {
3820
+ program: program2,
3821
+ io,
3822
+ runCommand,
3823
+ leaf: (group, nameAndArgs, summary) => leaf(program2, group, nameAndArgs, summary),
3824
+ addGlobalFlags,
3825
+ buildContext: (cmd) => buildContext(cmd, io)
3826
+ };
3827
+ for (const register of products) register(registration);
3828
+ program2.addHelpText(
3829
+ "after",
3830
+ `
3831
+ Examples:
3832
+ $ tenjin install
3833
+ $ tenjin wallet fund
3834
+ $ tenjin status
3835
+
3836
+ Learn more:
3837
+ Run \`tenjin <command> --help\` for one command.
3838
+ Permissions: ${PERMISSIONS_DOC_URL}
3839
+ Issues: ${package_default.bugs}
3840
+ `
3841
+ );
3842
+ return program2;
3920
3843
  }
3921
- async function main(argv, io = defaultIo()) {
3844
+ async function main(argv, io = defaultIo(), products = PRODUCTS) {
3922
3845
  let exitCode = 0;
3923
- const program2 = buildProgram(io, (code) => {
3924
- exitCode = code;
3925
- });
3846
+ const program2 = buildProgram(
3847
+ io,
3848
+ (code) => {
3849
+ exitCode = code;
3850
+ },
3851
+ products
3852
+ );
3926
3853
  try {
3927
3854
  await program2.parseAsync(argv, { from: "user" });
3928
3855
  } catch (err) {
@@ -3937,6 +3864,7 @@ function handleParseError(err, io, program2) {
3937
3864
  if (err.code === "commander.version" || err.code === "commander.helpDisplayed") {
3938
3865
  return 0;
3939
3866
  }
3867
+ if (err.code === "commander.help" && err.exitCode === 0) return 0;
3940
3868
  if (!humanFirst) {
3941
3869
  const message = err.code === "commander.help" ? "No command specified" : err.message.replace(/^error:\s*/i, "");
3942
3870
  const usageErr = new CliError("USAGE", message, {
@@ -3949,7 +3877,8 @@ function handleParseError(err, io, program2) {
3949
3877
  return emitFailure(io, "tenjin", err, { json }).exitCode;
3950
3878
  }
3951
3879
  export {
3880
+ PRODUCTS,
3952
3881
  buildProgram,
3953
3882
  main
3954
3883
  };
3955
- //# sourceMappingURL=cli-KKRKBU5T.js.map
3884
+ //# sourceMappingURL=cli-VHYYYYXM.js.map