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
@@ -1,580 +0,0 @@
1
- import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
- import {
3
- modeGatedPointer
4
- } from "./chunk-4CQIDQOT.js";
5
- import {
6
- loadProjectConfig
7
- } from "./chunk-VYOJOX4Z.js";
8
- import {
9
- parseUsdToAtomic,
10
- toMoney
11
- } from "./chunk-EFWZPUTC.js";
12
- import {
13
- CONFIG_KEYS,
14
- HOOKS_CONFIG_KEYS,
15
- LEGACY_HOOKS_CONFIG_KEYS,
16
- PUBLISH_CONFIG_KEYS,
17
- PublishModeSchema,
18
- RawConfigSchema,
19
- SEND_MAX_UNSET,
20
- UPDATE_CONFIG_KEYS,
21
- loadRawConfig,
22
- parseAgentDispatchHookModeFlag,
23
- parseSessionPrimerFlag,
24
- parseStopNagFlag,
25
- parseUpdateModeFlag,
26
- parseWebSearchHookModeFlag,
27
- resolveSettings
28
- } from "./chunk-U6VPKMGC.js";
29
- import {
30
- MODE_GATED_RULES,
31
- inspectFreeVerbRules,
32
- resolveHermesHomeLenient,
33
- retractModeGatedRules,
34
- stopHookIsCurrent,
35
- wireFreeVerbAllowlist
36
- } from "./chunk-OKYSNAS3.js";
37
- import {
38
- PRODUCTION_ORIGIN,
39
- detectHarnesses,
40
- harnessInPlay,
41
- harnessTargetDir,
42
- onPath
43
- } from "./chunk-2MYQN7HM.js";
44
- import {
45
- LockTimeoutError,
46
- withFileLock
47
- } from "./chunk-ZOBNS7CX.js";
48
- import {
49
- CliError,
50
- configPath,
51
- writeFileAtomic
52
- } from "./chunk-ZFJJ3EXC.js";
53
-
54
- // src/commands/config.ts
55
- import { mkdir } from "fs/promises";
56
- import { homedir } from "os";
57
- import { styleText } from "util";
58
-
59
- // src/lib/clack.ts
60
- var SHOW_CURSOR = "\x1B[?25h";
61
- function withInputEnd(streams, onEnd, run) {
62
- const controller = new AbortController();
63
- let settleEnd;
64
- const ended = new Promise((resolve) => {
65
- settleEnd = () => {
66
- streams.output.write(SHOW_CURSOR);
67
- resolve(onEnd);
68
- };
69
- });
70
- const end = () => {
71
- controller.abort();
72
- settleEnd?.();
73
- };
74
- const onKeypress = (_text, key) => {
75
- if (key?.ctrl === true && key.name === "d") end();
76
- };
77
- streams.input.on("keypress", onKeypress);
78
- if (streams.input.readableEnded) {
79
- queueMicrotask(end);
80
- } else {
81
- streams.input.once("end", end);
82
- streams.input.once("close", end);
83
- }
84
- return Promise.race([run(controller.signal), ended]).finally(() => {
85
- streams.input.off("keypress", onKeypress);
86
- streams.input.off("end", end);
87
- streams.input.off("close", end);
88
- });
89
- }
90
- function resolveStreams(streams) {
91
- return { input: streams.input ?? process.stdin, output: streams.output ?? process.stderr };
92
- }
93
- async function selectOne(opts) {
94
- const { select, isCancel } = await import("./dist-U4M6QCKE.js");
95
- const streams = resolveStreams(opts.streams ?? {});
96
- return withInputEnd(streams, null, async (signal) => {
97
- const answer = await select({
98
- message: opts.message,
99
- options: opts.choices.map((c) => ({
100
- value: c.value,
101
- label: c.label,
102
- ...c.hint !== void 0 ? { hint: c.hint } : {}
103
- })),
104
- initialValue: opts.initialValue,
105
- input: streams.input,
106
- output: streams.output,
107
- signal
108
- });
109
- return isCancel(answer) ? null : answer;
110
- });
111
- }
112
- async function confirmChoice(message, initialValue = true, streams = {}) {
113
- const { confirm, isCancel } = await import("./dist-U4M6QCKE.js");
114
- const resolved = resolveStreams(streams);
115
- return withInputEnd(resolved, false, async (signal) => {
116
- const answer = await confirm({
117
- message,
118
- initialValue,
119
- input: resolved.input,
120
- output: resolved.output,
121
- signal
122
- });
123
- return isCancel(answer) ? false : answer;
124
- });
125
- }
126
- async function intro(message) {
127
- const clack = await import("./dist-U4M6QCKE.js");
128
- clack.intro(message, { output: process.stderr });
129
- }
130
- async function outro(message) {
131
- const clack = await import("./dist-U4M6QCKE.js");
132
- clack.outro(message, { output: process.stderr });
133
- }
134
-
135
- // src/commands/config.ts
136
- var CONFIRM_ABOVE = "above:";
137
- var KEY_WIDTH = Math.max(
138
- ...[...CONFIG_KEYS, ...PUBLISH_CONFIG_KEYS, ...HOOKS_CONFIG_KEYS, ...UPDATE_CONFIG_KEYS].map(
139
- (key) => key.length
140
- )
141
- );
142
- var KEY_DESCRIPTIONS = {
143
- maxAutoSpend: "auto-approve a read up to this amount",
144
- sessionBudget: "cap on total auto-spend per session",
145
- confirm: "when to ask before paying",
146
- sendMaxAmount: "hard cap per tenjin send; unset = send refuses until set, 0 disables send, none = uncapped; never bypassed by --yes",
147
- allowlistCreators: "only auto-pay these creators (empty = any)",
148
- baseUrl: "Tenjin API base URL",
149
- rpcUrl: "Base RPC endpoint for balance reads",
150
- evalCohort: "opt in to the search evaluation cohort",
151
- bazaarPay: "let `tenjin pay` spend at registry-listed non-Tenjin endpoints",
152
- bazaarRegistries: "x402 discovery registries for `discover` and the pay lane",
153
- "publish.mode": "review=always ask, auto=ask on findings, full-auto=only hard blocks stop it",
154
- "publish.defaultPrice": "price used when none is given",
155
- "hooks.webSearch": "harness WebSearch hook (before WebSearch): auto=ask Tenjin first, remind=static reminder, off=inert",
156
- "hooks.agentDispatch": "harness subagent-dispatch hook (before Agent/Task \u2014 most sensitive payload): auto=ask Tenjin first, remind=static reminder, off=inert",
157
- "hooks.stopNag": "end-of-turn reminder about searches nothing answered yet: on=both arms, deliberate-only=drop the batched web-search arm, off=neither",
158
- "hooks.sessionPrimer": "one-paragraph search-first primer at session start: on=print it, off=print nothing",
159
- "update.mode": "nudge=report a newer version (stderr line, JSON envelope, hook output), off=neither report nor ask npm"
160
- };
161
- function isPublishKey(key) {
162
- return PUBLISH_CONFIG_KEYS.includes(key);
163
- }
164
- function isHooksKey(key) {
165
- return HOOKS_CONFIG_KEYS.includes(key);
166
- }
167
- function isLegacyHooksKey(key) {
168
- return LEGACY_HOOKS_CONFIG_KEYS.includes(key);
169
- }
170
- function normalizeHooksKey(key) {
171
- if (HOOKS_CONFIG_KEYS.includes(key)) return key;
172
- if (key === "hooks.searchMode") return "hooks.webSearch";
173
- if (key === "hooks.dispatchMode") return "hooks.agentDispatch";
174
- return null;
175
- }
176
- function isUpdateKey(key) {
177
- return UPDATE_CONFIG_KEYS.includes(key);
178
- }
179
- async function runConfigList(ctx) {
180
- const settings = await resolveFromContext(ctx);
181
- const data = {};
182
- const humanLines = [];
183
- for (const key of CONFIG_KEYS) {
184
- const entry = renderSetting(key, settings[key].value, settings[key].source);
185
- data[key] = entry;
186
- humanLines.push(describedLine(key, entry));
187
- }
188
- for (const key of PUBLISH_CONFIG_KEYS) {
189
- const entry = renderPublishSetting(key, settings);
190
- data[key] = entry;
191
- humanLines.push(describedLine(key, entry, downgradeNote(key, settings)));
192
- }
193
- for (const key of HOOKS_CONFIG_KEYS) {
194
- const entry = renderHooksSetting(key, settings);
195
- data[key] = entry;
196
- humanLines.push(describedLine(key, entry));
197
- }
198
- for (const key of UPDATE_CONFIG_KEYS) {
199
- const entry = {
200
- value: settings.updateMode.value,
201
- source: settings.updateMode.source
202
- };
203
- data[key] = entry;
204
- humanLines.push(describedLine(key, entry));
205
- }
206
- return { data, humanLines };
207
- }
208
- async function runConfigGet({ key }, ctx) {
209
- if (isPublishKey(key)) {
210
- const settings2 = await resolveFromContext(ctx);
211
- const entry2 = renderPublishSetting(key, settings2);
212
- return {
213
- data: { key, ...entry2 },
214
- humanLines: [withNote(formatLine(key, entry2), downgradeNote(key, settings2))]
215
- };
216
- }
217
- const normalized = normalizeHooksKey(key);
218
- if (normalized !== null) {
219
- const entry2 = renderHooksSetting(normalized, await resolveFromContext(ctx));
220
- return { data: { key, ...entry2 }, humanLines: [formatLine(key, entry2)] };
221
- }
222
- if (isUpdateKey(key)) {
223
- const { updateMode } = await resolveFromContext(ctx);
224
- const entry2 = { value: updateMode.value, source: updateMode.source };
225
- return { data: { key, ...entry2 }, humanLines: [formatLine(key, entry2)] };
226
- }
227
- const configKey = assertKey(key);
228
- const settings = await resolveFromContext(ctx);
229
- const entry = renderSetting(configKey, settings[configKey].value, settings[configKey].source);
230
- return { data: { key: configKey, ...entry }, humanLines: [formatLine(configKey, entry)] };
231
- }
232
- async function runConfigSet({ key, value }, ctx, deps = {}) {
233
- if (isPublishKey(key)) return setPublishKey(key, value, ctx, deps);
234
- if (isHooksKey(key) || isLegacyHooksKey(key)) {
235
- const normalized = normalizeHooksKey(key);
236
- return setHooksKey(normalized, value, ctx, deps);
237
- }
238
- if (isUpdateKey(key)) return setUpdateKey(key, value, ctx);
239
- const configKey = assertKey(key);
240
- const stored = parseValue(configKey, value);
241
- await persist(ctx.dataDir, (existing) => ({ ...existing, [configKey]: stored }));
242
- if (configKey === "bazaarPay") {
243
- try {
244
- const { syncBazaarSkill } = await import("./skill-placement-RIU4AMC2.js");
245
- await syncBazaarSkill(stored === true, deps.placeSkill ?? { io: ctx.io });
246
- } catch {
247
- }
248
- }
249
- const entry = renderSetting(configKey, stored, "file");
250
- return { data: { key: configKey, ...entry }, humanLines: [formatLine(configKey, entry)] };
251
- }
252
- async function setPublishKey(key, value, ctx, deps) {
253
- const entry = key === "publish.mode" ? { value: parsePublishMode(value), source: "file" } : { value: toMoney(parseUsdToAtomic(value)), source: "file" };
254
- const subkey = key === "publish.mode" ? "mode" : "defaultPrice";
255
- const stored = key === "publish.mode" ? entry.value : entry.value.atomic;
256
- await persist(ctx.dataDir, (existing) => ({
257
- ...existing,
258
- publish: { ...existing.publish, [subkey]: stored }
259
- }));
260
- const humanLines = [formatLine(key, entry)];
261
- if (key !== "publish.mode") return { data: { key, ...entry }, humanLines };
262
- const allowlist = await syncPublishRule(entry.value, ctx, deps);
263
- return {
264
- data: { key, ...entry, allowlist },
265
- humanLines: [...humanLines, ...allowlistLines(allowlist)]
266
- };
267
- }
268
- function publishRuleQuestion(mode, pending) {
269
- const gated = new Set(MODE_GATED_RULES);
270
- const others = pending.filter((rule) => !gated.has(rule)).length;
271
- const also = others > 0 ? ` Also adds the ${others} free-verb rule(s) \`tenjin install\` writes.` : "";
272
- return `publish.mode ${mode} is unattended only if your harness allowlist carries ${MODE_GATED_RULES.join(" and ")}. Add them to ~/.claude/settings.json now?${also}`;
273
- }
274
- async function syncPublishRule(mode, ctx, deps) {
275
- const home = deps.homeDir ?? homedir();
276
- const nothing = { added: [], removed: [] };
277
- const write = async () => {
278
- const result = await (deps.wireAllowlist ?? wireFreeVerbAllowlist)(home, mode);
279
- if (result.skipped !== void 0) {
280
- return {
281
- added: [],
282
- removed: [],
283
- skipped: "unwritable",
284
- ...result.fix !== void 0 ? { pointer: result.fix } : {}
285
- };
286
- }
287
- return { added: result.added, removed: result.removed };
288
- };
289
- const isClaude = deps.harnessIsClaude ?? await claudeInPlay(home, ctx, deps);
290
- if (!isClaude) {
291
- return { ...nothing, skipped: "not-claude" };
292
- }
293
- const probe = await (deps.inspectAllowlist ?? inspectFreeVerbRules)(home, mode);
294
- const gated = new Set(MODE_GATED_RULES);
295
- const missing = (probe.pending ?? []).filter((r) => gated.has(r));
296
- const pointer = modeGatedPointer(mode, missing) ?? void 0;
297
- if (mode === "review") {
298
- const retracted = await (deps.retractModeGated ?? retractModeGatedRules)(home);
299
- if (retracted.skipped !== void 0) {
300
- return {
301
- ...nothing,
302
- skipped: "unwritable",
303
- ...retracted.fix !== void 0 ? { pointer: retracted.fix } : {}
304
- };
305
- }
306
- return { added: [], removed: retracted.removed };
307
- }
308
- if (probe.satisfied !== void 0) return nothing;
309
- const canPrompt = ctx.flags.json === true ? false : deps.isInteractive ?? Boolean(process.stdin.isTTY);
310
- if (!canPrompt) return { ...nothing, skipped: "no-tty", ...pointer ? { pointer } : {} };
311
- const confirm = deps.confirmRule ?? ((label) => confirmChoice(label, true));
312
- if (!await confirm(publishRuleQuestion(mode, probe.pending ?? []))) {
313
- return { ...nothing, skipped: "declined", ...pointer ? { pointer } : {} };
314
- }
315
- return write();
316
- }
317
- async function claudeInPlay(home, ctx, deps) {
318
- const env = deps.env ?? process.env;
319
- const which = deps.which ?? ((bin) => onPath(bin, env));
320
- const requested = await loadRawConfig(ctx.dataDir).then((c) => c.install?.harness ?? []).catch(() => []);
321
- const hermesHome = resolveHermesHomeLenient(home, env).home;
322
- return harnessInPlay(
323
- home,
324
- harnessTargetDir(home, "claude", hermesHome),
325
- detectHarnesses(home, which, hermesHome),
326
- requested,
327
- hermesHome
328
- );
329
- }
330
- function allowlistLines(sync) {
331
- const lines = [];
332
- if (sync.added.length > 0) {
333
- lines.push(`Added ${sync.added.length} harness rule(s) to your allowlist.`);
334
- }
335
- if (sync.removed.length > 0) {
336
- lines.push(`Removed ${sync.removed.join(", ")} from your allowlist.`);
337
- }
338
- if (sync.pointer !== void 0) lines.push(sync.pointer);
339
- return lines;
340
- }
341
- async function setHooksKey(key, value, ctx, deps) {
342
- const subkey = key === "hooks.webSearch" ? "webSearch" : key === "hooks.agentDispatch" ? "agentDispatch" : key === "hooks.stopNag" ? "stopNag" : "sessionPrimer";
343
- const parsed = key === "hooks.webSearch" ? parseWebSearchHookModeFlag(value, key) : key === "hooks.agentDispatch" ? parseAgentDispatchHookModeFlag(value, key) : key === "hooks.stopNag" ? parseStopNagFlag(value, key) : parseSessionPrimerFlag(value, key);
344
- await persist(ctx.dataDir, (existing) => ({
345
- ...existing,
346
- hooks: { ...existing.hooks, [subkey]: parsed }
347
- }));
348
- const entry = { value: parsed, source: "file" };
349
- const current = await (deps.stopHookIsCurrent ?? stopHookIsCurrent)(ctx.dataDir);
350
- const stale = parsed === "deliberate-only" && !current ? `The installed Stop hook predates ${JSON.stringify(parsed)} and will keep treating it as "on". Run \`tenjin install\` to update it.` : void 0;
351
- return {
352
- data: { key, ...entry, ...stale !== void 0 ? { hookScriptStale: true } : {} },
353
- humanLines: [formatLine(key, entry), ...stale !== void 0 ? [stale] : []]
354
- };
355
- }
356
- async function setUpdateKey(key, value, ctx) {
357
- const parsed = parseUpdateModeFlag(value, key);
358
- await persist(ctx.dataDir, (existing) => ({
359
- ...existing,
360
- update: { ...existing.update, mode: parsed }
361
- }));
362
- const entry = { value: parsed, source: "file" };
363
- return { data: { key, ...entry }, humanLines: [formatLine(key, entry)] };
364
- }
365
- function parsePublishMode(value) {
366
- const parsed = PublishModeSchema.safeParse(value);
367
- if (parsed.success) return parsed.data;
368
- throw new CliError("USAGE", `Invalid publish mode: ${JSON.stringify(value)}`, {
369
- fix: 'Use "review", "auto", or "full-auto".'
370
- });
371
- }
372
- async function persistPublishMode(dir, mode) {
373
- await persist(dir, (existing) => ({
374
- ...existing,
375
- publish: { ...existing.publish, mode }
376
- }));
377
- }
378
- async function persistBazaarPay(dir, enabled) {
379
- await persist(dir, (existing) => ({ ...existing, bazaarPay: enabled }));
380
- }
381
- async function persistWebSearchHookMode(dir, mode) {
382
- await persist(dir, (existing) => ({
383
- ...existing,
384
- hooks: { ...existing.hooks, webSearch: mode }
385
- }));
386
- }
387
- async function persistAgentDispatchHookMode(dir, mode) {
388
- await persist(dir, (existing) => ({
389
- ...existing,
390
- hooks: { ...existing.hooks, agentDispatch: mode }
391
- }));
392
- }
393
- async function persistSearchHookMode(dir, mode) {
394
- return persistWebSearchHookMode(dir, mode);
395
- }
396
- async function persistInstallHarness(dir, harness) {
397
- await persist(dir, (existing) => ({
398
- ...existing,
399
- install: { ...existing.install, harness: [...harness] }
400
- }));
401
- }
402
- async function resolveFromContext(ctx) {
403
- const config = await loadRawConfig(ctx.dataDir);
404
- const project = await loadProjectConfig(process.cwd());
405
- return resolveSettings({
406
- config,
407
- flags: { baseUrl: ctx.flags.baseUrl },
408
- env: process.env,
409
- project: project?.layer
410
- });
411
- }
412
- function assertKey(key) {
413
- if (CONFIG_KEYS.includes(key)) return key;
414
- throw new CliError("USAGE", `Unknown config key: ${JSON.stringify(key)}`, {
415
- fix: `Valid keys: ${[...CONFIG_KEYS, ...PUBLISH_CONFIG_KEYS, ...HOOKS_CONFIG_KEYS].join(", ")}.`
416
- });
417
- }
418
- function renderSetting(key, stored, source) {
419
- return { ...renderValue(key, stored), source };
420
- }
421
- function renderPublishSetting(key, settings) {
422
- if (key === "publish.mode") {
423
- return { value: settings.publishMode.value, source: settings.publishMode.source };
424
- }
425
- return {
426
- value: toMoney(settings.publishDefaultPrice.value),
427
- source: settings.publishDefaultPrice.source
428
- };
429
- }
430
- function renderHooksSetting(key, settings) {
431
- const resolved = key === "hooks.webSearch" ? settings.hooksWebSearch : key === "hooks.agentDispatch" ? settings.hooksAgentDispatch : key === "hooks.stopNag" ? settings.hooksStopNag : settings.hooksSessionPrimer;
432
- return { value: resolved.value, source: resolved.source };
433
- }
434
- function renderValue(key, stored) {
435
- if (Array.isArray(stored) || typeof stored === "boolean") return { value: stored };
436
- if (key === "maxAutoSpend" || key === "sessionBudget") return { value: toMoney(stored) };
437
- if (key === "sendMaxAmount") {
438
- return { value: stored === "none" || stored === SEND_MAX_UNSET ? stored : toMoney(stored) };
439
- }
440
- if (key === "confirm" && stored.startsWith(CONFIRM_ABOVE)) {
441
- return { value: stored, threshold: toMoney(stored.slice(CONFIRM_ABOVE.length)) };
442
- }
443
- return { value: stored };
444
- }
445
- function parseValue(key, value) {
446
- switch (key) {
447
- case "maxAutoSpend":
448
- case "sessionBudget":
449
- return parseUsdToAtomic(value);
450
- // throws USAGE on a bad amount
451
- case "sendMaxAmount":
452
- return value === "none" ? "none" : parseUsdToAtomic(value);
453
- case "confirm":
454
- return parseConfirm(value);
455
- case "allowlistCreators":
456
- return parseAllowlist(value);
457
- case "baseUrl":
458
- case "rpcUrl":
459
- return parseHttpUrl(value);
460
- case "evalCohort":
461
- case "bazaarPay":
462
- return parseBoolean(value);
463
- case "bazaarRegistries":
464
- return parseRegistryList(value);
465
- }
466
- }
467
- function parseRegistryList(value) {
468
- return value.split(",").map((entry) => entry.trim()).filter((entry) => entry.length > 0).map((entry) => parseHttpUrl(entry));
469
- }
470
- function parseBoolean(value) {
471
- if (value === "true" || value === "on") return true;
472
- if (value === "false" || value === "off") return false;
473
- throw new CliError("USAGE", `Invalid boolean value: ${JSON.stringify(value)}`, {
474
- fix: 'Use "on" or "off" (or "true"/"false").'
475
- });
476
- }
477
- function parseConfirm(value) {
478
- if (value === "always") return "always";
479
- if (value.startsWith(CONFIRM_ABOVE)) {
480
- return `${CONFIRM_ABOVE}${parseUsdToAtomic(value.slice(CONFIRM_ABOVE.length))}`;
481
- }
482
- throw new CliError("USAGE", `Invalid confirm value: ${JSON.stringify(value)}`, {
483
- fix: 'Use "always" or "above:<usd>", e.g. above:0.25.'
484
- });
485
- }
486
- function parseAllowlist(value) {
487
- const entries = value.split(",").map((entry) => entry.trim()).filter((entry) => entry.length > 0);
488
- for (const entry of entries) {
489
- if (/\s/.test(entry)) {
490
- throw new CliError("USAGE", `Invalid creator entry: ${JSON.stringify(entry)}`, {
491
- fix: "Creator entries cannot contain spaces; separate multiple with commas."
492
- });
493
- }
494
- }
495
- return entries;
496
- }
497
- function parseHttpUrl(value) {
498
- let url;
499
- try {
500
- url = new URL(value);
501
- } catch {
502
- throw new CliError("USAGE", `Invalid URL: ${JSON.stringify(value)}`, {
503
- fix: `Pass an absolute http(s) URL like ${PRODUCTION_ORIGIN}.`
504
- });
505
- }
506
- if (url.protocol !== "http:" && url.protocol !== "https:") {
507
- throw new CliError("USAGE", `URL must be http or https: ${JSON.stringify(value)}`, {
508
- fix: `Pass an absolute http(s) URL like ${PRODUCTION_ORIGIN}.`
509
- });
510
- }
511
- return value;
512
- }
513
- async function persist(dir, merge) {
514
- await mkdir(dir, { recursive: true, mode: 448 });
515
- const lockPath = `${configPath(dir)}.lock`;
516
- try {
517
- await withFileLock(lockPath, async () => {
518
- const existing = await loadRawConfig(dir);
519
- const merged = merge(existing);
520
- const validated = RawConfigSchema.parse(merged);
521
- await writeFileAtomic(configPath(dir), `${JSON.stringify(validated, null, 2)}
522
- `, {
523
- mode: 420,
524
- dirMode: 448
525
- });
526
- });
527
- } catch (err) {
528
- if (err instanceof LockTimeoutError) {
529
- throw new CliError("INTERNAL", err.message, {
530
- fix: `If no other tenjin process is running, remove ${lockPath} and retry.`,
531
- cause: err
532
- });
533
- }
534
- throw err;
535
- }
536
- }
537
- function formatLine(key, entry) {
538
- const label = key.padEnd(KEY_WIDTH);
539
- return ` ${label} ${displayValue(entry)} ${styleText("dim", `(${entry.source})`)}`;
540
- }
541
- function describedLine(key, entry, note) {
542
- const description = KEY_DESCRIPTIONS[key];
543
- let line = formatLine(key, entry);
544
- if (description !== void 0) line += ` ${styleText("dim", `- ${description}`)}`;
545
- return withNote(line, note);
546
- }
547
- function withNote(line, note) {
548
- return note !== void 0 ? `${line} ${styleText("dim", `(${note})`)}` : line;
549
- }
550
- function downgradeNote(key, settings) {
551
- if (key !== "publish.mode" || settings.publishMode.downgradedWarning === void 0) {
552
- return void 0;
553
- }
554
- return "downgraded from full-auto: committed .tenjin.json (gitignore it to opt in)";
555
- }
556
- function displayValue(entry) {
557
- const { value } = entry;
558
- if (Array.isArray(value)) return value.length > 0 ? value.join(", ") : "(empty)";
559
- if (typeof value === "boolean") return value ? "true" : "false";
560
- if (typeof value === "object") return `${value.usd} USD`;
561
- if (entry.threshold !== void 0) return `above ${entry.threshold.usd} USD`;
562
- return value;
563
- }
564
-
565
- export {
566
- selectOne,
567
- confirmChoice,
568
- intro,
569
- outro,
570
- runConfigList,
571
- runConfigGet,
572
- runConfigSet,
573
- persistPublishMode,
574
- persistBazaarPay,
575
- persistWebSearchHookMode,
576
- persistAgentDispatchHookMode,
577
- persistSearchHookMode,
578
- persistInstallHarness
579
- };
580
- //# sourceMappingURL=chunk-H3SOOJ2I.js.map