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
@@ -2,25 +2,28 @@ 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-3AJS6LLN.js";
6
6
  import {
7
7
  defaultIo,
8
8
  emitFailure,
9
9
  emitSuccess
10
- } from "./chunk-OLWTRUTS.js";
10
+ } from "./chunk-YJHHCWM3.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-BBVUVBUO.js";
15
17
  import {
16
18
  package_default
17
- } from "./chunk-JBIKAAT3.js";
18
- import "./chunk-2MYQN7HM.js";
19
+ } from "./chunk-BFFM2WFK.js";
19
20
  import {
20
- CliError,
21
- dataDir,
22
- external_exports
23
- } from "./chunk-ZFJJ3EXC.js";
21
+ CliError
22
+ } from "./chunk-OCBHUHWB.js";
23
+ import {
24
+ dataDir
25
+ } from "./chunk-2BKS2FVE.js";
26
+ import "./chunk-7WEQQJLG.js";
24
27
  import {
25
28
  __commonJS,
26
29
  __require,
@@ -1194,11 +1197,11 @@ var require_suggestSimilar = __commonJS({
1194
1197
  var require_command = __commonJS({
1195
1198
  "node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/command.js"(exports) {
1196
1199
  "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");
1200
+ var EventEmitter = __require("node:events").EventEmitter;
1201
+ var childProcess = __require("node:child_process");
1202
+ var path = __require("node:path");
1203
+ var fs = __require("node:fs");
1204
+ var process2 = __require("node:process");
1202
1205
  var { Argument: Argument2, humanReadableArgName } = require_argument();
1203
1206
  var { CommanderError: CommanderError2 } = require_error();
1204
1207
  var { Help: Help2, stripColor } = require_help();
@@ -3477,188 +3480,157 @@ var {
3477
3480
  Help
3478
3481
  } = import_index.default;
3479
3482
 
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() {
3483
+ // src/cli/registration.ts
3484
+ var SETUP = "Setup:";
3485
+ var WALLET = "Wallet:";
3486
+ var INTEGRATION = "Integration:";
3487
+
3488
+ // src/cli/core.ts
3489
+ function registerCore(reg) {
3490
+ const { runCommand, leaf: leaf2, addGlobalFlags: addGlobalFlags2 } = reg;
3491
+ leaf2(SETUP, "install", "set up Tenjin for Claude Code and create a wallet").description(
3492
+ "Set up Claude Code to use Tenjin: two hook entries, the `x402` MCP server and its permission rule, spend limits for each lookup, and a wallet if this machine has none."
3493
+ ).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(
3494
+ "--status-line <mode>",
3495
+ "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"
3496
+ ).addHelpText(
3497
+ "after",
3498
+ `
3499
+ Examples:
3500
+ $ tenjin install
3501
+ $ tenjin install --project
3502
+
3503
+ Learn more:
3504
+ What the router may spend, and what leaves this machine:
3505
+ ${PERMISSIONS_DOC_URL}
3506
+ `
3507
+ ).action(async function() {
3567
3508
  await runCommand("install", this, async (ctx) => {
3568
3509
  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(
3510
+ const { runRouterInstall } = await import("./install-XUM2XSHW.js");
3511
+ const { statusLineMode } = await import("./status-line-wiring-BYPHTYZE.js");
3512
+ return runRouterInstall(
3573
3513
  {
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 } : {}
3514
+ ...o.project === true ? { project: true } : {},
3515
+ ...o.refresh === true ? { refresh: true } : {},
3516
+ ...o.statusLine !== void 0 ? { statusLine: statusLineMode(String(o.statusLine)) } : {},
3517
+ ...o.wallet === false ? { noWallet: true } : {}
3582
3518
  },
3583
3519
  ctx
3584
3520
  );
3585
3521
  });
3586
3522
  });
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() {
3523
+ leaf2(SETUP, "uninstall", "remove what install wrote; the wallet is kept").description(
3524
+ "Remove the hook entries, the permission rule and the MCP registration `tenjin install` wrote. Your wallet, spend ledger and config are kept."
3525
+ ).option("--project", "remove from this project's .claude/settings.json").action(async function() {
3590
3526
  await runCommand("uninstall", this, async (ctx) => {
3591
- const { runUninstall } = await import("./uninstall-5E263VTS.js");
3592
- return runUninstall(ctx);
3527
+ const o = this.opts();
3528
+ const { runRouterUninstall } = await import("./uninstall-FKYZHAM3.js");
3529
+ return runRouterUninstall({ ...o.project === true ? { project: true } : {} }, ctx);
3593
3530
  });
3594
3531
  });
3595
- addGlobalFlags(program2.command("doctor")).description("Check the local environment and Tenjin API reachability").action(async function() {
3532
+ leaf2(SETUP, "doctor", "check this machine can run a lookup").description(
3533
+ "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."
3534
+ ).option("--project", "check this project's .claude/settings.json, as --project installed it").addHelpText(
3535
+ "after",
3536
+ `
3537
+ Examples:
3538
+ $ tenjin doctor
3539
+ $ tenjin doctor --project
3540
+ $ tenjin doctor --json
3541
+ `
3542
+ ).action(async function() {
3596
3543
  await runCommand("doctor", this, async (ctx) => {
3597
- const { runDoctor } = await import("./doctor-ZBG7X66D.js");
3598
- return runDoctor(ctx);
3544
+ const { runRouterDoctor } = await import("./doctor-LU4YIZWM.js");
3545
+ return runRouterDoctor(ctx, this.opts().project === true ? { project: true } : {});
3599
3546
  });
3600
3547
  });
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() {
3548
+ leaf2(SETUP, "update", "update tenjin-cli to the newest published version").description(
3549
+ "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."
3550
+ ).option("--check", "report whether a newer version exists without installing it").action(async function() {
3602
3551
  await runCommand("update", this, async (ctx) => {
3603
- const { runUpdate } = await import("./update-R76LHOZW.js");
3552
+ const { runUpdate } = await import("./update-ANJ2AOTN.js");
3604
3553
  return runUpdate({ check: this.opts().check === true }, ctx);
3605
3554
  });
3606
3555
  });
3607
- const config = addGlobalFlags(program2.command("config")).description(
3608
- "Show or change CLI configuration"
3556
+ const config = leaf2(SETUP, "config", "read and set config values").description(
3557
+ "Print every effective config value, or read and write one. Values are stored in config.json under your Tenjin data dir (~/.tenjin by default)."
3558
+ );
3559
+ config.addHelpText(
3560
+ "after",
3561
+ `
3562
+ Examples:
3563
+ $ tenjin config
3564
+ $ tenjin config set publish.mode review
3565
+ $ tenjin config set maxAutoSpend 0.25
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-MXOX7XDR.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-MXOX7XDR.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
+ ).action(async function(key, value) {
3623
3585
  await runCommand("config.set", this, async (ctx) => {
3624
- const { runConfigSet } = await import("./config-JMRUNYE6.js");
3586
+ const { runConfigSet } = await import("./config-MXOX7XDR.js");
3625
3587
  return runConfigSet({ key, value }, ctx);
3626
3588
  });
3627
3589
  });
3628
- const wallet = addGlobalFlags(
3629
- program2.command("wallet").description("Manage the local x402 payment wallet")
3590
+ const wallet = leaf2(
3591
+ WALLET,
3592
+ "wallet",
3593
+ "create, show, fund and send from the local wallet"
3594
+ ).description(
3595
+ "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
3596
  );
3631
- addGlobalFlags(wallet.command("create")).description("Create a new local wallet (refuses if one exists; see --replace)").option(
3597
+ addGlobalFlags2(wallet.command("create")).summary("create a new local wallet").description(
3598
+ "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."
3599
+ ).option(
3632
3600
  "--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"
3601
+ "archive the existing wallet beside the new one, passphrase preserved, then create a new active wallet"
3634
3602
  ).action(async function() {
3635
3603
  await runCommand("wallet.create", this, async (ctx) => {
3636
3604
  const o = this.opts();
3637
- const { runWalletCreate } = await import("./wallet-ZAVXWLWP.js");
3605
+ const { runWalletCreate } = await import("./wallet-PWAHVKWW.js");
3638
3606
  return runWalletCreate(ctx, o.replace === true ? { replace: true } : {});
3639
3607
  });
3640
3608
  });
3641
- addGlobalFlags(wallet.command("show")).description("Show the wallet address and key source (never the key)").action(async function() {
3609
+ addGlobalFlags2(wallet.command("show")).summary("show the wallet address and key source").description(
3610
+ "Print the active wallet address and where its key comes from. The private key is never printed, by any flag."
3611
+ ).action(async function() {
3642
3612
  await runCommand("wallet.show", this, async (ctx) => {
3643
- const { runWalletShow } = await import("./wallet-ZAVXWLWP.js");
3613
+ const { runWalletShow } = await import("./wallet-PWAHVKWW.js");
3644
3614
  return runWalletShow(ctx);
3645
3615
  });
3646
3616
  });
3647
- addGlobalFlags(wallet.command("balance")).description("Show the wallet USDC balance on Base").action(async function() {
3617
+ addGlobalFlags2(wallet.command("balance")).summary("show the wallet USDC balance on Base").description(
3618
+ "Read the wallet USDC balance on Base. It is a chain read: no key is unlocked and nothing is spent."
3619
+ ).action(async function() {
3648
3620
  await runCommand("wallet.balance", this, async (ctx) => {
3649
- const { runWalletBalance } = await import("./wallet-ZAVXWLWP.js");
3621
+ const { runWalletBalance } = await import("./wallet-PWAHVKWW.js");
3650
3622
  return runWalletBalance(ctx);
3651
3623
  });
3652
3624
  });
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"
3625
+ addGlobalFlags2(wallet.command("fund [amountUsd]")).summary("card-fund this wallet through Coinbase Onramp").description(
3626
+ "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
3627
  ).option("--no-open", "print the checkout link without opening a browser").option(
3656
3628
  "--no-wait",
3657
3629
  "return once the link is issued instead of polling the balance (already the default when not at a TTY)"
3658
3630
  ).action(async function(amountUsd) {
3659
- await runCommand("fund", this, async (ctx) => {
3631
+ await runCommand("wallet.fund", this, async (ctx) => {
3660
3632
  const o = this.opts();
3661
- const { runFund } = await import("./fund-EUDH5KPA.js");
3633
+ const { runFund } = await import("./fund-A54P2QFK.js");
3662
3634
  return runFund(ctx, {
3663
3635
  ...amountUsd !== void 0 ? { amountUsd } : {},
3664
3636
  ...o.open === false ? { open: false } : {},
@@ -3666,80 +3638,34 @@ function buildProgram(io, setExit) {
3666
3638
  });
3667
3639
  });
3668
3640
  });
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) => {
3641
+ addGlobalFlags2(wallet.command("send <amount> <token> <to>")).summary("move funds out of the wallet (escape hatch)").description(
3642
+ "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."
3643
+ ).option("--yes", "skip the interactive confirm (required to send when not at a TTY)").addHelpText(
3644
+ "after",
3645
+ `
3646
+ Examples:
3647
+ $ tenjin wallet send 5 USDC 0x1234abcd...
3648
+ `
3649
+ ).action(async function(amount, token, to) {
3650
+ await runCommand("wallet.send", this, async (ctx) => {
3673
3651
  const o = this.opts();
3674
- const { runSend } = await import("./send-G746D7PQ.js");
3652
+ const { runSend } = await import("./send-ASD2ZXJD.js");
3675
3653
  return runSend({ amount, token, to, ...o.yes === true ? { yes: true } : {} }, ctx);
3676
3654
  });
3677
3655
  });
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) {
3656
+ leaf2(WALLET, "pay <url>", "pay any x402 endpoint under your spend policy").description(
3657
+ "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."
3658
+ ).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(
3659
+ "after",
3660
+ `
3661
+ Examples:
3662
+ $ tenjin pay https://api.example.com/quote --max-price 0.05
3663
+ $ tenjin pay https://api.example.com/quote -d '{"symbol":"ETH"}' --yes
3664
+ `
3665
+ ).action(async function(url) {
3740
3666
  await runCommand("pay", this, async (ctx) => {
3741
3667
  const o = this.opts();
3742
- const { runPay } = await import("./pay-BC4UICPA.js");
3668
+ const { runPay } = await import("./pay-SBXZEPEP.js");
3743
3669
  return runPay(
3744
3670
  {
3745
3671
  url,
@@ -3753,176 +3679,163 @@ function buildProgram(io, setExit) {
3753
3679
  );
3754
3680
  });
3755
3681
  });
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);
3762
- });
3763
- });
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
- );
3682
+ }
3683
+
3684
+ // src/cli/router.ts
3685
+ function registerRouter(reg) {
3686
+ const { io, runCommand, leaf: leaf2, addGlobalFlags: addGlobalFlags2, buildContext: buildContext2 } = reg;
3687
+ const hook = leaf2(INTEGRATION, "hook", "run one harness hook handler (called by Claude Code)").description(
3688
+ "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."
3689
+ ).helpCommand(false);
3690
+ for (const [name, summary] of [
3691
+ ["prompt", "UserPromptSubmit: build the session packet and ask the free gate"],
3692
+ ["native", "PreToolUse on WebSearch|WebFetch: allow the call, or redirect it"]
3693
+ ]) {
3694
+ addGlobalFlags2(hook.command(name)).summary(summary).action(async function() {
3695
+ const ctx = buildContext2(this);
3696
+ const { runHookCommand } = await import("./hook-command-U6KWPEDQ.js");
3697
+ await runHookCommand(name, io, {
3698
+ dataDir: ctx.dataDir,
3699
+ ...ctx.flags.baseUrl !== void 0 ? { baseUrl: ctx.flags.baseUrl } : {}
3700
+ });
3783
3701
  });
3702
+ }
3703
+ leaf2(INTEGRATION, "mcp", "run the local stdio MCP server").description(
3704
+ "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."
3705
+ ).action(async function() {
3706
+ const ctx = buildContext2(this);
3707
+ const { runRouterMcpServer } = await import("./mcp-HJC2PLRV.js");
3708
+ await runRouterMcpServer({ dataDir: ctx.dataDir, flags: ctx.flags });
3784
3709
  });
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
- });
3710
+ leaf2(INTEGRATION, "status-line", "the live footer, for Claude Code's status line").description(
3711
+ "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."
3712
+ ).action(async function() {
3713
+ const ctx = buildContext2(this);
3714
+ const { runStatusLine } = await import("./status-line-CGPUSDMC.js");
3715
+ await runStatusLine(io, { dataDir: ctx.dataDir });
3823
3716
  });
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
- );
3717
+ leaf2(SETUP, "status", "what this machine has spent, and what is still open").description(
3718
+ "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."
3719
+ ).action(async function() {
3720
+ await runCommand("status", this, async (ctx) => {
3721
+ const { runRouterStatus } = await import("./status-T2SDB57A.js");
3722
+ return runRouterStatus(ctx);
3881
3723
  });
3882
3724
  });
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
- );
3725
+ }
3726
+
3727
+ // src/cli.ts
3728
+ var GlobalOptsSchema = external_exports.object({
3729
+ json: external_exports.boolean().default(false),
3730
+ baseUrl: external_exports.url().optional(),
3731
+ timeout: external_exports.coerce.number().int().positive().default(1e4)
3732
+ });
3733
+ var GLOBAL_FLAGS = [
3734
+ ["--json", "emit one machine JSON envelope on stdout instead of the human rendering"],
3735
+ ["--base-url <url>", "Tenjin API base URL"],
3736
+ ["--timeout <ms>", "request timeout in milliseconds", "10000"]
3737
+ ];
3738
+ function addGlobalFlags(cmd) {
3739
+ for (const [flags, help] of GLOBAL_FLAGS) cmd.addOption(new Option(flags, help).hideHelp());
3740
+ return cmd;
3741
+ }
3742
+ function leaf(program2, group, nameAndArgs, summary) {
3743
+ return addGlobalFlags(
3744
+ program2.command(nameAndArgs).helpGroup(group).summary(summary).helpCommand(false).helpOption("-h, --help", "show this help")
3745
+ );
3746
+ }
3747
+ function rootHelpCommand() {
3748
+ 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);
3749
+ }
3750
+ function buildContext(cmd, io) {
3751
+ const parsed = GlobalOptsSchema.safeParse(cmd.optsWithGlobals());
3752
+ if (!parsed.success) {
3753
+ throw new CliError("USAGE", "Invalid global option", {
3754
+ fix: "Run `tenjin --help` for usage.",
3755
+ details: parsed.error.issues
3909
3756
  });
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;
3757
+ }
3758
+ const flags = {
3759
+ json: parsed.data.json,
3760
+ timeout: parsed.data.timeout,
3761
+ baseUrl: parsed.data.baseUrl
3762
+ };
3763
+ return { flags, dataDir: dataDir(process.env), io };
3917
3764
  }
3918
- function collect(value, previous) {
3919
- return [...previous, value];
3765
+ var PRODUCTS = [registerCore, registerRouter];
3766
+ function buildProgram(io, setExit, products = PRODUCTS) {
3767
+ const program2 = new Command();
3768
+ const runCommand = async (command, cmd, run) => {
3769
+ const json = cmd.optsWithGlobals().json === true;
3770
+ const refreshRun = command === "install" && cmd.optsWithGlobals().refresh === true;
3771
+ const updateAvailable = command === "update" ? null : await readUpdateSignal(dataDir(process.env));
3772
+ try {
3773
+ const ctx = buildContext(cmd, io);
3774
+ const result = await run(ctx);
3775
+ emitSuccess(ctx.io, command, result.data, result.humanLines, {
3776
+ json: ctx.flags.json,
3777
+ updateAvailable
3778
+ });
3779
+ } catch (err) {
3780
+ setExit(emitFailure(io, command, err, { json, updateAvailable }).exitCode);
3781
+ }
3782
+ if (command !== "update" && !refreshRun) {
3783
+ await maybeUpdate({ dir: dataDir(process.env), io, json });
3784
+ }
3785
+ };
3786
+ program2.name("tenjin").description(
3787
+ "x402 router for coding agents: one paid decision per lookup, a local wallet that pays each provider per call in USDC on Base."
3788
+ ).optionsGroup("Global options:").addHelpCommand(rootHelpCommand()).configureOutput({
3789
+ // --help / --version print here (stdout). Nothing else uses writeOut, so
3790
+ // stdout stays a single JSON object for every real command.
3791
+ writeOut: (str) => io.stdout.write(str),
3792
+ // Commander's usage/help text is human decoration: TTY only, never under
3793
+ // --json. This gates on the root's --json (the scope available when a parse
3794
+ // error fires before any subcommand runs); the machine contract for the same
3795
+ // failure goes to stdout via handleParseError, so the two never collide.
3796
+ writeErr: (str) => {
3797
+ if (io.isTTY && program2.opts().json !== true) io.stderr.write(str);
3798
+ }
3799
+ }).exitOverride();
3800
+ for (const [flags, help, fallback] of GLOBAL_FLAGS) {
3801
+ const option = new Option(flags, help);
3802
+ program2.addOption(fallback === void 0 ? option : option.default(fallback));
3803
+ }
3804
+ program2.version(package_default.version, "-V, --version", "output the version number").helpOption("-h, --help", "show this help");
3805
+ const registration = {
3806
+ program: program2,
3807
+ io,
3808
+ runCommand,
3809
+ leaf: (group, nameAndArgs, summary) => leaf(program2, group, nameAndArgs, summary),
3810
+ addGlobalFlags,
3811
+ buildContext: (cmd) => buildContext(cmd, io)
3812
+ };
3813
+ for (const register of products) register(registration);
3814
+ program2.addHelpText(
3815
+ "after",
3816
+ `
3817
+ Examples:
3818
+ $ tenjin install
3819
+ $ tenjin wallet fund
3820
+ $ tenjin status
3821
+
3822
+ Learn more:
3823
+ Run \`tenjin <command> --help\` for one command.
3824
+ Permissions: ${PERMISSIONS_DOC_URL}
3825
+ Issues: ${package_default.bugs}
3826
+ `
3827
+ );
3828
+ return program2;
3920
3829
  }
3921
- async function main(argv, io = defaultIo()) {
3830
+ async function main(argv, io = defaultIo(), products = PRODUCTS) {
3922
3831
  let exitCode = 0;
3923
- const program2 = buildProgram(io, (code) => {
3924
- exitCode = code;
3925
- });
3832
+ const program2 = buildProgram(
3833
+ io,
3834
+ (code) => {
3835
+ exitCode = code;
3836
+ },
3837
+ products
3838
+ );
3926
3839
  try {
3927
3840
  await program2.parseAsync(argv, { from: "user" });
3928
3841
  } catch (err) {
@@ -3937,6 +3850,7 @@ function handleParseError(err, io, program2) {
3937
3850
  if (err.code === "commander.version" || err.code === "commander.helpDisplayed") {
3938
3851
  return 0;
3939
3852
  }
3853
+ if (err.code === "commander.help" && err.exitCode === 0) return 0;
3940
3854
  if (!humanFirst) {
3941
3855
  const message = err.code === "commander.help" ? "No command specified" : err.message.replace(/^error:\s*/i, "");
3942
3856
  const usageErr = new CliError("USAGE", message, {
@@ -3949,7 +3863,8 @@ function handleParseError(err, io, program2) {
3949
3863
  return emitFailure(io, "tenjin", err, { json }).exitCode;
3950
3864
  }
3951
3865
  export {
3866
+ PRODUCTS,
3952
3867
  buildProgram,
3953
3868
  main
3954
3869
  };
3955
- //# sourceMappingURL=cli-KKRKBU5T.js.map
3870
+ //# sourceMappingURL=cli-M3XCSOU6.js.map