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,972 +0,0 @@
1
- import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
- import {
3
- runWalletCreate
4
- } from "./chunk-NIKXHWOL.js";
5
- import "./chunk-MJZZTKCC.js";
6
- import "./chunk-7FK2UN2T.js";
7
- import {
8
- describeWallet,
9
- resolveWalletProvider
10
- } from "./chunk-CPCX67TI.js";
11
- import "./chunk-M2O56UK7.js";
12
- import "./chunk-UHTVXQ2O.js";
13
- import {
14
- collectDoctorChecks,
15
- isNoWalletCheck
16
- } from "./chunk-R7RSCBI7.js";
17
- import "./chunk-HRGBS2PA.js";
18
- import "./chunk-EDZSNPE5.js";
19
- import "./chunk-5QQTYWEU.js";
20
- import {
21
- walletFileExists
22
- } from "./chunk-GHLVXVZD.js";
23
- import {
24
- removeMarkerLines
25
- } from "./chunk-B63XPWQ4.js";
26
- import {
27
- placeOptionalSkill
28
- } from "./chunk-DHJD77OW.js";
29
- import {
30
- installSkill
31
- } from "./chunk-QZ6ROAJU.js";
32
- import {
33
- sanitizeForTerminal
34
- } from "./chunk-OLWTRUTS.js";
35
- import {
36
- confirmChoice,
37
- intro,
38
- outro,
39
- persistAgentDispatchHookMode,
40
- persistBazaarPay,
41
- persistInstallHarness,
42
- persistPublishMode,
43
- persistWebSearchHookMode,
44
- selectOne
45
- } from "./chunk-H3SOOJ2I.js";
46
- import {
47
- PERMISSIONS_DOC_URL,
48
- recommendedPermissions
49
- } from "./chunk-4CQIDQOT.js";
50
- import "./chunk-VYOJOX4Z.js";
51
- import "./chunk-EFWZPUTC.js";
52
- import {
53
- CONFIG_DEFAULTS,
54
- PublishModeSchema,
55
- WebSearchModeSchema,
56
- loadRawConfig,
57
- parsePublishModeFlag,
58
- parseWebSearchHookModeFlag
59
- } from "./chunk-U6VPKMGC.js";
60
- import "./chunk-UO22YNY4.js";
61
- import {
62
- FREE_VERB_RULES,
63
- MODE_GATED_RULES,
64
- hooksSkipped,
65
- hooksUndo,
66
- inspectFreeVerbRules,
67
- permissionsSkipped,
68
- planFreeVerbAllowlist,
69
- resolveHermesHome,
70
- resolveHermesHomeLenient,
71
- retractModeGatedRules,
72
- rulesForPublishMode,
73
- wireFreeVerbAllowlist,
74
- wireHermesIntegration,
75
- wireSearchHooks
76
- } from "./chunk-OKYSNAS3.js";
77
- import "./chunk-A5DKHMUN.js";
78
- import "./chunk-3GL2Z5QK.js";
79
- import "./chunk-JBIKAAT3.js";
80
- import {
81
- CLI_SKILL_NAMES,
82
- HARNESS_TARGETS,
83
- HOSTED_SKILL_NAME,
84
- OPTIONAL_PAY_SKILL,
85
- PRODUCTION_HOST,
86
- SKILL_NAMES,
87
- harnessDetectedBy,
88
- harnessTargetDir,
89
- isModelInvocationDisabled,
90
- onPath,
91
- readSkillFile,
92
- resolveSkillsSource
93
- } from "./chunk-2MYQN7HM.js";
94
- import {
95
- ownsAnyLock,
96
- releaseOwnedLocks
97
- } from "./chunk-ZOBNS7CX.js";
98
- import {
99
- CliError,
100
- external_exports,
101
- hasCode,
102
- walletPath
103
- } from "./chunk-ZFJJ3EXC.js";
104
- import "./chunk-W6R3HAAG.js";
105
- import "./chunk-U5S527PP.js";
106
- import "./chunk-47PP7TAG.js";
107
- import "./chunk-XJN5WUKL.js";
108
- import "./chunk-RBJPAZFI.js";
109
- import "./chunk-KYQVEKP5.js";
110
- import "./chunk-ZXTAQYNA.js";
111
-
112
- // src/commands/install.ts
113
- import { existsSync } from "fs";
114
- import { readFile } from "fs/promises";
115
- import { fileURLToPath } from "url";
116
- import { dirname, isAbsolute, join } from "path";
117
- import { homedir } from "os";
118
- import { styleText } from "util";
119
- import { Stream } from "stream";
120
- var HARNESSES = HARNESS_TARGETS;
121
- var InstallInputSchema = external_exports.object({
122
- harness: external_exports.array(external_exports.string()).optional(),
123
- dryRun: external_exports.boolean().optional(),
124
- publishMode: external_exports.string().optional(),
125
- noWallet: external_exports.boolean().optional(),
126
- /**
127
- * ACCEPTED AND IGNORED. `install` writes no CLAUDE.md/AGENTS.md line any more —
128
- * a skill's own frontmatter description is the trigger surface the harness reads
129
- * at session start, so the line only duplicated it. Both spellings still parse so
130
- * a script or a released doc that passes one does not fail; neither does anything.
131
- */
132
- claudeMd: external_exports.boolean().optional(),
133
- /**
134
- * Tri-state. `true` (`--allow-free-verbs`) wires the free-verb
135
- * allowlist without asking, which is now also what an unanswered non-interactive
136
- * run does, so the flag is kept for compatibility and as an explicit statement of
137
- * intent. `false` (`--no-allow-free-verbs`) is the opt-out and is the only way to
138
- * get a run that writes no permission rule. `undefined` asks when it can, and
139
- * writes when it cannot ask.
140
- */
141
- allowFreeVerbs: external_exports.boolean().optional(),
142
- /** The harness search-hook behavior to install (`--search-hooks auto|remind|off`). */
143
- searchHooks: external_exports.string().optional(),
144
- /**
145
- * `--no-hooks`: register no hooks THIS RUN, changing nothing persistent. It is
146
- * deliberately not the same as `--search-hooks off`, which is a durable
147
- * statement about behavior and writes `hooks.webSearch: off` (and
148
- * `hooks.agentDispatch: off`) to config.
149
- */
150
- noHooks: external_exports.boolean().optional()
151
- });
152
- function walletFix(reason) {
153
- switch (reason) {
154
- case "no-passphrase-store":
155
- return "No OS credential store is available to hold the wallet passphrase. Set TENJIN_WALLET_PASSPHRASE and re-run `tenjin install`, or run `tenjin wallet create` in a terminal to enter one.";
156
- case "create-failed":
157
- return "Fix the reported problem, then run `tenjin wallet create`.";
158
- case "dry-run":
159
- case "flag":
160
- return "Create one with `tenjin wallet create`.";
161
- }
162
- }
163
- var CODEX_NETWORK_RULE = "[sandbox_workspace_write]\nnetwork_access = true";
164
- async function runInstall(input, ctx, deps = {}) {
165
- return withInterruptGuard((markPhase) => installBody(input, ctx, deps, markPhase));
166
- }
167
- async function withInterruptGuard(fn) {
168
- let phase;
169
- const onSignal = (signal) => {
170
- const wasWriting = ownsAnyLock() || phase === "writing-skills";
171
- releaseOwnedLocks();
172
- if (process.stdin.isTTY) process.stdin.setRawMode?.(false);
173
- if (process.stdout.isTTY) process.stdout.write("\x1B[?25h");
174
- process.stderr.write(
175
- wasWriting ? `
176
- Interrupted mid-write. Some files may be half-written; re-run \`tenjin install\` to finish.
177
- ` : phase === "wired" ? `
178
- Interrupted after the skills were written; later setup steps may not have finished. Re-run \`tenjin install\` to finish.
179
- ` : "\nInterrupted before anything was written; nothing changed.\n"
180
- );
181
- process.exit(signal === "SIGINT" ? 130 : 143);
182
- };
183
- process.on("SIGINT", onSignal);
184
- process.on("SIGTERM", onSignal);
185
- try {
186
- return await fn((p) => {
187
- phase = p;
188
- });
189
- } finally {
190
- process.off("SIGINT", onSignal);
191
- process.off("SIGTERM", onSignal);
192
- }
193
- }
194
- async function installBody(input, ctx, deps, markPhase) {
195
- const parsed = InstallInputSchema.safeParse(input);
196
- if (!parsed.success) {
197
- throw new CliError("USAGE", "Invalid install options", {
198
- fix: "Run `tenjin install --help`.",
199
- details: parsed.error.issues
200
- });
201
- }
202
- const dryRun = parsed.data.dryRun === true;
203
- const noWallet = parsed.data.noWallet === true;
204
- const noHooks = parsed.data.noHooks === true;
205
- const allowFreeVerbs = parsed.data.allowFreeVerbs;
206
- const publishModeFlag = parsed.data.publishMode !== void 0 ? parseModeFlag(parsed.data.publishMode) : void 0;
207
- const searchHooksFlag = parsed.data.searchHooks !== void 0 ? parseWebSearchHookModeFlag(parsed.data.searchHooks, "--search-hooks") : void 0;
208
- const env = deps.env ?? process.env;
209
- const home = deps.homeDir ?? homedir();
210
- if (!isAbsolute(home)) {
211
- throw new CliError(
212
- "INTERNAL",
213
- "The home directory did not resolve to an absolute path, so nothing was installed.",
214
- {
215
- fix: "Set HOME to your home directory (`export HOME=...`), then re-run `tenjin install`."
216
- }
217
- );
218
- }
219
- const which = deps.which ?? ((bin) => onPath(bin, env));
220
- const targetsHermes = parsed.data.harness?.includes("hermes") === true;
221
- const hermesTarget = targetsHermes ? { home: resolveHermesHome(home, env), warning: void 0 } : resolveHermesHomeLenient(home, env);
222
- const hermesHome = hermesTarget.home;
223
- const humanOutput = ctx.flags.json === true ? false : deps.isInteractive ?? ctx.io.isTTY;
224
- const canPrompt = humanOutput && (deps.isInteractive ?? Boolean(process.stdin.isTTY));
225
- const skillsSource = deps.skillsSourceDir ?? resolveSkillsSource(fileURLToPath(new URL(".", import.meta.url)));
226
- await assertSkillsSource(skillsSource);
227
- const plans = resolvePlans(parsed.data.harness, home, hermesHome, which);
228
- const explicitHarness = parsed.data.harness !== void 0 && parsed.data.harness.length > 0;
229
- const harnesses = [];
230
- const rawConfig = await loadRawConfig(ctx.dataDir);
231
- if (!dryRun) markPhase("writing-skills");
232
- for (const plan of plans) {
233
- harnesses.push(await applyPlan(plan, skillsSource, dryRun));
234
- }
235
- await assertSkillsLanded(plans, dryRun);
236
- if (!dryRun) markPhase("wired");
237
- if (explicitHarness && !dryRun) {
238
- await underDataDir(
239
- ctx.dataDir,
240
- () => persistInstallHarness(
241
- ctx.dataDir,
242
- plans.map((p) => p.harness)
243
- )
244
- );
245
- }
246
- const pointerCleanup = dryRun ? [] : await removeMarkerLines(home);
247
- if (canPrompt) await (deps.intro ?? intro)("tenjin install");
248
- const publishMode = await underDataDir(
249
- ctx.dataDir,
250
- () => resolvePublishMode(publishModeFlag, ctx, deps, dryRun, canPrompt)
251
- );
252
- const permissions = await resolvePermissions({
253
- plans,
254
- home,
255
- deps,
256
- flag: allowFreeVerbs,
257
- dryRun,
258
- canPrompt,
259
- publishMode: publishMode.value
260
- });
261
- const hooks = await underDataDir(
262
- ctx.dataDir,
263
- () => resolveHooks({ plans, home, ctx, deps, flag: searchHooksFlag, noHooks, dryRun, canPrompt })
264
- );
265
- const hermesResult = harnesses.find((result) => result.harness === "hermes");
266
- if (hermesResult !== void 0) {
267
- const tenjinCommand = deps.tenjinCommand ?? process.argv[1];
268
- const nodeCommand = deps.nodeCommand ?? process.execPath;
269
- if (tenjinCommand === void 0 || !isAbsolute(tenjinCommand) || !isAbsolute(nodeCommand)) {
270
- throw new CliError(
271
- "INTERNAL",
272
- "Hermes integration requires absolute Tenjin and Node executable paths.",
273
- { fix: "Run `tenjin install --harness hermes` through the installed Tenjin CLI." }
274
- );
275
- }
276
- hermesResult.hermes = await wireHermesIntegration({
277
- hermesHome,
278
- dataDir: ctx.dataDir,
279
- tenjinCommand,
280
- nodeCommand,
281
- dryRun,
282
- // Activation consent: the operator named Hermes on the command line.
283
- explicit: explicitHarness && targetsHermes,
284
- // Write consent, read off the SAME hooks decision that gates Claude's
285
- // settings.json, because `--no-hooks` promises "writes no config" in the
286
- // README and that promise cannot hold on only one of the two harnesses.
287
- hooks: { enabled: hermesHooksEnabled(hooks), fix: hooks.fix, mode: hooks.mode }
288
- });
289
- for (const part of [
290
- hermesResult.hermes.mcp,
291
- hermesResult.hermes.plugin,
292
- hermesResult.hermes.activation
293
- ]) {
294
- if (part.warning !== void 0) hermesResult.warnings.push(part.warning);
295
- }
296
- if (hermesTarget.warning !== void 0) hermesResult.warnings.push(hermesTarget.warning);
297
- }
298
- const wallet = await underDataDir(
299
- ctx.dataDir,
300
- () => resolveWallet(ctx, deps, walletSkip(dryRun, noWallet), canPrompt)
301
- );
302
- const bazaarPay = await underDataDir(
303
- ctx.dataDir,
304
- () => resolveBazaarPay(ctx, deps, dryRun, canPrompt, rawConfig.bazaarPay)
305
- );
306
- if (!dryRun) {
307
- for (const plan of plans) {
308
- try {
309
- await placeOptionalSkill(
310
- OPTIONAL_PAY_SKILL,
311
- plan.skillsDir,
312
- skillsSource,
313
- bazaarPay.enabled
314
- );
315
- } catch {
316
- }
317
- }
318
- }
319
- const doctorDeps = { ...deps.doctorDeps ?? {} };
320
- doctorDeps.homeDir ??= home;
321
- doctorDeps.which ??= which;
322
- const collect = deps.collectChecks ?? ((c) => collectDoctorChecks(c, doctorDeps));
323
- const doctor = await collect(ctx);
324
- if (canPrompt) await (deps.outro ?? outro)("Setup complete.");
325
- const data = {
326
- dryRun,
327
- skillsSource,
328
- harnesses,
329
- // One-time cleanup, reported because it edits a file the operator owns. Older
330
- // versions wrote a pointer line into CLAUDE.md/AGENTS.md; nothing writes one
331
- // now, so an install that finds one removes it and says which file it touched.
332
- pointerCleanup,
333
- doctor: { status: doctor.failure !== void 0 ? "fail" : "pass", checks: doctor.checks },
334
- publishMode,
335
- bazaarPay,
336
- // Shipped with the install rather than left for the operator to discover after
337
- // their first auto-mode denial (#33). Static constants, no config key: see
338
- // lib/permissions.ts for why this is deliberately not operator-editable state.
339
- // `wired` is the outcome of THIS run's settings.json write; the three
340
- // recommendation tiers beside it are unchanged, so a machine consumer that
341
- // read `alwaysSafe` / `optIn` / `neverAllowlisted` before still does.
342
- permissions: { ...recommendedPermissions(publishMode.value), wired: permissions },
343
- hooks,
344
- wallet
345
- };
346
- if (!humanOutput) return { data };
347
- const humanLines = buildWalkthrough(ctx.io, {
348
- pointerCleanup,
349
- dryRun,
350
- dataDir: ctx.dataDir,
351
- harnesses,
352
- publishMode,
353
- permissions,
354
- hooks,
355
- wallet,
356
- doctor
357
- });
358
- return { data, humanLines };
359
- }
360
- function walletSkip(dryRun, noWallet) {
361
- if (dryRun) return "dry-run";
362
- if (noWallet) return "flag";
363
- return void 0;
364
- }
365
- async function underDataDir(dataDir, fn) {
366
- try {
367
- return await fn();
368
- } catch (err) {
369
- if (!hasCode(err, "EACCES") && !hasCode(err, "EPERM")) throw err;
370
- throw new CliError("INTERNAL", `Could not use the Tenjin data directory ${dataDir}.`, {
371
- fix: `Permission denied. Check that you can write to it (\`ls -ld ${dataDir}\`), then re-run \`tenjin install\`.`,
372
- cause: err
373
- });
374
- }
375
- }
376
- var EXAMPLE_QUESTION = "what actually changed in <library> v3's public API";
377
- function buildWalkthrough(io, s) {
378
- const lines = [];
379
- if (s.dryRun) {
380
- lines.push(paint(io, "yellow", "Dry run: nothing was written."));
381
- lines.push("");
382
- }
383
- lines.push(...summaryLines(io, s));
384
- const notices = noticeLines(io, s);
385
- if (notices.length > 0) lines.push("", ...notices);
386
- return lines;
387
- }
388
- function noticeLines(io, s) {
389
- const lines = [];
390
- for (const h of s.harnesses) {
391
- if (h.hostedArrivedFirst) {
392
- lines.push(
393
- paint(
394
- io,
395
- "dim",
396
- `The hosted ${HOSTED_SKILL_NAME} skill was already in ${h.skillsDir}: kept as the zero-install fallback, and the CLI skills now take precedence.`
397
- )
398
- );
399
- }
400
- if (h.codexNetworkRule !== void 0) {
401
- lines.push(paint(io, "dim", "Codex blocks network by default; add to ~/.codex/config.toml:"));
402
- for (const rl of h.codexNetworkRule.split("\n")) lines.push(paint(io, "dim", ` ${rl}`));
403
- }
404
- for (const w of h.warnings) lines.push(paint(io, "yellow", `! ${w}`));
405
- }
406
- if (s.pointerCleanup.length > 0) {
407
- lines.push(
408
- `Removed the old Tenjin pointer line from ${s.pointerCleanup.join(" and ")}; the skills carry their own triggers now.`
409
- );
410
- }
411
- const stale = s.permissions.removed.filter((r) => !MODE_GATED_RULES.includes(r));
412
- if (stale.length > 0) {
413
- lines.push(
414
- `Removed ${stale.length} permission rule(s) an older tenjin left in ${s.permissions.path ?? "your settings"} for commands that no longer exist.`
415
- );
416
- }
417
- if (s.permissions.planned !== true && s.permissions.added.length > 0) {
418
- lines.push(paint(io, "dim", `Undo anytime: remove those lines from ${s.permissions.path}.`));
419
- }
420
- if (s.hooks.added.length > 0 || s.hooks.updated.length > 0) {
421
- lines.push(paint(io, "dim", hooksDisclosure(s.hooks)));
422
- lines.push(
423
- paint(io, "dim", hooksUndo(s.hooks.path ?? "~/.claude/settings.json", s.hooks.scriptsDir))
424
- );
425
- lines.push(
426
- `${paint(io, "bold", "Restart Claude Code")} to load them; hooks are read once at session start.`
427
- );
428
- }
429
- if (s.hooks.warning !== void 0) {
430
- lines.push(paint(io, "yellow", `! ${sanitizeForTerminal(s.hooks.warning)}`));
431
- }
432
- for (const line of walletDisclosure(s.wallet, s.dataDir)) lines.push(paint(io, "dim", line));
433
- if (s.wallet.warning !== void 0) {
434
- lines.push(paint(io, "yellow", `! ${sanitizeForTerminal(s.wallet.warning)}`));
435
- }
436
- if (s.permissions.warning !== void 0) {
437
- lines.push(paint(io, "yellow", `! ${sanitizeForTerminal(s.permissions.warning)}`));
438
- }
439
- lines.push(...doctorNotices(io, s.doctor, s.wallet));
440
- return lines;
441
- }
442
- function summaryLines(io, s) {
443
- return [
444
- ...s.harnesses.map((h) => skillsLine(io, h, s.dryRun)),
445
- publishingLine(io, s.publishMode.value, s.permissions),
446
- permissionsLine(io, s.permissions),
447
- hooksLine(io, s.hooks),
448
- walletLine(io, s.wallet),
449
- `${paint(io, "bold", "Next:")} tenjin search "${EXAMPLE_QUESTION}"`
450
- ];
451
- }
452
- function hooksDisclosure(h) {
453
- const shared = "A Stop hook reminds you locally when a MISS you searched for is still unpublished, and a SessionStart hook prints one paragraph on when to search first; neither makes a network call.";
454
- if (h.mode === "remind") {
455
- return `The WebSearch and dispatch hooks print a one-line reminder that Tenjin may have an answer; they send nothing off-machine. ${shared}`;
456
- }
457
- return `Before a web search or a subagent dispatch, the hooks ask ${PRODUCTION_HOST} the same question (free and anonymous, ~2s budget, 5s harness kill) and mention a tested answer if one exists; the query text, or at most 400 characters of the subagent prompt, leaves the machine. They can never block or change the tool call. ${shared}`;
458
- }
459
- function hooksLine(io, h) {
460
- const label = paint(io, "bold", "Search hooks:");
461
- const wrote = h.added.length + h.updated.length;
462
- if (wrote > 0) {
463
- return `${paint(io, "green", "\u2713")} ${label} ${h.mode} mode, ${wrote} hook event(s) registered in ${h.path}. Change: tenjin config set hooks.webSearch <auto|remind|off> (or hooks.agentDispatch)`;
464
- }
465
- if (h.skipped === void 0) {
466
- return `${paint(io, "green", "\u2713")} ${label} ${h.mode} mode, already registered in ${h.path}`;
467
- }
468
- if (h.skipped === "harness-not-claude") {
469
- return `${paint(io, "dim", "-")} ${label} not wired (Claude Code only).`;
470
- }
471
- if (h.skipped === "native-harness") {
472
- return `${paint(io, "green", "\u2713")} ${label} ${h.mode} mode through the native Hermes plugin. Change: tenjin config set hooks.webSearch <auto|remind|off> (or hooks.agentDispatch)`;
473
- }
474
- if (h.skipped === "dry-run") {
475
- return `${paint(io, "dim", "-")} ${label} unchanged (dry run).`;
476
- }
477
- if (h.skipped === "mode-off") {
478
- return `${paint(io, "dim", "-")} ${label} off (hooks.webSearch). Turn them on: tenjin config set hooks.webSearch auto, then tenjin install`;
479
- }
480
- if (h.skipped === "declined") {
481
- return `${paint(io, "dim", "-")} ${label} not registered this run; nothing was configured. Register them: tenjin install`;
482
- }
483
- if (h.skipped === "changed-since-read") {
484
- return `${paint(io, "yellow", "!")} ${label} ${h.path} changed while it was being updated, so nothing was written. Re-run: tenjin install`;
485
- }
486
- return `${paint(io, "yellow", "!")} ${label} ${h.path} was left untouched. Fix it, then: tenjin install`;
487
- }
488
- function harnessLabel(h) {
489
- return h === "claude" ? "Claude Code" : h === "codex" ? "Codex" : h === "hermes" ? "Hermes" : "Agent Skills";
490
- }
491
- function skillsLine(io, h, dryRun) {
492
- const changed = h.skills.some((s) => s.status !== "up-to-date");
493
- const verb = dryRun ? "would install" : changed ? "installed" : "up to date";
494
- const head = `${harnessLabel(h.harness)}: ${h.skills.length} skills ${verb}`;
495
- return `${paint(io, "green", "\u2713")} ${paint(io, "bold", head)} in ${h.skillsDir}. ${skillRoster(h)}.`;
496
- }
497
- function publishingLine(io, mode, wired) {
498
- const undo = wired.modeGrant === void 0 ? "" : ` ${paint(io, "dim", wired.planned === true ? "Would turn off:" : "Turn off:")} tenjin config set publish.mode review`;
499
- return `${paint(io, "green", "\u2713")} ${paint(io, "bold", `Publishing: ${mode}`)}. ${modeBlurb(mode)}${undo}`;
500
- }
501
- function permissionsLine(io, p) {
502
- const label = paint(io, "bold", "Permissions:");
503
- const allowed = p.added.length + p.alreadyPresent.length;
504
- const retracted = p.removed.filter((r) => MODE_GATED_RULES.includes(r));
505
- const gaveBack = retracted.length === 0 ? "" : p.planned === true ? ` A real run would remove ${retracted.length} rule(s) for publish and edit from ${p.path ?? "your settings"}.` : ` Publishing is back to asking first, so ${retracted.length} rule(s) for publish and edit were removed from ${p.path ?? "your settings"}.`;
506
- const unchanged = retracted.length === 0 || p.planned === true ? "unchanged" : "otherwise unchanged";
507
- if (p.planned === true && p.added.length > 0) {
508
- return `${paint(io, "dim", "-")} ${label} would allow ${allowed} tenjin commands in ${p.path}. Details: ${PERMISSIONS_DOC_URL}`;
509
- }
510
- if (p.added.length > 0) {
511
- return `${paint(io, "green", "\u2713")} ${label} ${allowed} tenjin commands allowed in ${p.path}.${gaveBack} Details: ${PERMISSIONS_DOC_URL}`;
512
- }
513
- if (p.skipped === void 0) {
514
- return `${paint(io, "green", "\u2713")} ${label} the ${FREE_VERB_RULES.length} free tenjin commands were already allowed in ${p.path}.${gaveBack}`;
515
- }
516
- if (p.skipped === "harness-not-claude") {
517
- return `${paint(io, "dim", "-")} ${label} not wired for this harness (Claude Code only).${gaveBack} The lines your harness needs: ${PERMISSIONS_DOC_URL}`;
518
- }
519
- if (p.skipped === "dry-run") {
520
- return `${paint(io, "dim", "-")} ${label} ${unchanged} (dry run); the ${FREE_VERB_RULES.length} rules a real run needs are already there.${gaveBack}`;
521
- }
522
- if (p.skipped === "declined" || p.skipped === "not-requested") {
523
- return `${paint(io, "dim", "-")} ${label} ${unchanged}.${gaveBack} Allow the ${FREE_VERB_RULES.length} free tenjin commands with: tenjin install --allow-free-verbs`;
524
- }
525
- if (p.skipped === "changed-since-read") {
526
- return `${paint(io, "yellow", "!")} ${label} ${p.path} changed while it was being updated, so nothing was written.${gaveBack} Re-run: tenjin install`;
527
- }
528
- return `${paint(io, "yellow", "!")} ${label} ${p.path} was left untouched.${gaveBack} Fix it, then: tenjin install --allow-free-verbs`;
529
- }
530
- function walletLine(io, w) {
531
- const label = paint(io, "bold", "Wallet:");
532
- if (w.status === "existing") {
533
- return `${paint(io, "green", "\u2713")} ${label} ${w.address} (existing). Check funds with: tenjin wallet balance`;
534
- }
535
- if (w.status === "created") {
536
- return `${paint(io, "green", "\u2713")} ${label} ${w.address}, holding $0. Fund it with a few dollars of USDC on Base, then: tenjin wallet balance`;
537
- }
538
- if (w.status === "skipped") {
539
- const icon = w.reason === "no-passphrase-store" || w.reason === "create-failed" ? "!" : "-";
540
- const color = icon === "!" ? "yellow" : "dim";
541
- return `${paint(io, color, icon)} ${label} none (${w.reason}). ${w.fix}`;
542
- }
543
- return `${paint(io, "dim", "-")} ${label} none. Create one later with: tenjin wallet create`;
544
- }
545
- function walletDisclosure(w, dataDir) {
546
- if (w.status !== "created") return [];
547
- return [
548
- `A wallet was created at ${walletPath(dataDir)}: the key is encrypted at rest (keystore v3, scrypt, mode 0600) and never leaves this machine.`,
549
- "It holds $0. Funding it is a human step: run `tenjin fund` (card checkout via Coinbase, opened in your browser), or send USDC on Base to that address."
550
- ];
551
- }
552
- function skillRoster(h) {
553
- const cli = h.skills.filter((s) => s.cli).map((s) => s.name);
554
- const hosted = h.skills.filter((s) => !s.cli).map((s) => s.name);
555
- const parts = [];
556
- if (cli.length > 0) parts.push(`${cli.join(", ")} (CLI)`);
557
- if (hosted.length > 0) parts.push(`${hosted.join(", ")} (hosted, zero-install fallback)`);
558
- return parts.join("; ");
559
- }
560
- function modeBlurb(v) {
561
- return v === "auto" ? "Your agent publishes and updates pieces on its own, under your identity." : v === "review" ? "Your agent asks you in chat before every publish." : "Your agent publishes on its own, under your identity, and only a hard block stops it.";
562
- }
563
- async function resolveWallet(ctx, deps, skipReason, canPrompt) {
564
- const exists = await (deps.walletExists ?? walletFileExists)(ctx.dataDir);
565
- if (exists) {
566
- return {
567
- status: "existing",
568
- address: await (deps.walletAddress ?? existingWalletAddress)(ctx)
569
- };
570
- }
571
- if (skipReason !== void 0) {
572
- return { status: "skipped", reason: skipReason, fix: walletFix(skipReason) };
573
- }
574
- if (canPrompt) {
575
- const confirm = deps.confirmWallet ?? defaultConfirm;
576
- if (!await confirm(WALLET_QUESTION)) return { status: "declined" };
577
- }
578
- try {
579
- const create = deps.createWallet ?? ((c) => defaultCreateWallet(c, deps.walletPassphrase, deps.env));
580
- return { status: "created", address: await create(ctx) };
581
- } catch (err) {
582
- const reason = isNoPassphraseError(err) ? "no-passphrase-store" : "create-failed";
583
- return {
584
- status: "skipped",
585
- reason,
586
- fix: walletFix(reason),
587
- ...reason === "create-failed" ? { warning: `The wallet could not be created: ${errorText(err)}` } : {}
588
- };
589
- }
590
- }
591
- function isNoPassphraseError(err) {
592
- return err instanceof CliError && err.code === "USAGE" && err.message.includes("No wallet passphrase is available");
593
- }
594
- function errorText(err) {
595
- return err instanceof Error ? err.message : String(err);
596
- }
597
- async function existingWalletAddress(ctx) {
598
- return (await describeWallet(resolveWalletProvider(ctx))).address;
599
- }
600
- async function defaultCreateWallet(ctx, passphrase, env) {
601
- const result = await runWalletCreate(ctx, {
602
- ...passphrase !== void 0 ? { passphrase } : {},
603
- ...env !== void 0 ? { env } : {}
604
- });
605
- return result.data.address;
606
- }
607
- function defaultConfirm(label) {
608
- return confirmChoice(label, true);
609
- }
610
- var BAZAAR_QUESTION = "Enable the Bazaar pay lane? x402 lets this wallet pay HTTP endpoints that answer with a priced 402, and the Bazaar (https://docs.cdp.coinbase.com/x402/bazaar) is the public catalog of them. When on, `tenjin pay` may pay Bazaar-listed non-Tenjin endpoints under your spend policy. More: https://x402.org";
611
- async function resolveBazaarPay(ctx, deps, dryRun, canPrompt, existing) {
612
- if (existing !== void 0) return { enabled: existing, status: "kept" };
613
- if (dryRun || !canPrompt) return { enabled: false, status: "not-asked" };
614
- const confirm = deps.confirmBazaarPay ?? ((label) => confirmChoice(label, false));
615
- const yes = await confirm(BAZAAR_QUESTION);
616
- await persistBazaarPay(ctx.dataDir, yes);
617
- return { enabled: yes, status: yes ? "enabled" : "declined" };
618
- }
619
- function summaryAlreadySaysNoWallet(wallet) {
620
- return wallet.status === "declined" || wallet.status === "skipped";
621
- }
622
- function doctorNotices(io, doctor, wallet) {
623
- const problems = doctor.checks.filter(
624
- (c) => c.status !== "ok" && !(summaryAlreadySaysNoWallet(wallet) && isNoWalletCheck(c))
625
- );
626
- if (problems.length === 0) return [];
627
- const lines = [paint(io, "yellow", "Some checks need attention:")];
628
- for (const c of problems) {
629
- const icon = c.status === "fail" ? paint(io, "red", "\u2717") : paint(io, "yellow", "!");
630
- lines.push(` ${icon} ${c.name}: ${sanitizeForTerminal(c.detail)}`);
631
- if (c.fix !== void 0) {
632
- lines.push(paint(io, "dim", ` fix: ${sanitizeForTerminal(c.fix)}`));
633
- }
634
- }
635
- return lines;
636
- }
637
- var DEFAULT_MODE = CONFIG_DEFAULTS.publish.mode;
638
- var RECOMMENDED_MODE = "auto";
639
- var PUBLISH_MODE_CHOICES = [
640
- {
641
- value: "auto",
642
- label: "Auto (recommended)",
643
- hint: "your agent publishes and updates pieces on its own, under your identity"
644
- },
645
- { value: "review", label: "Ask me in chat first" },
646
- { value: "full-auto", label: "Fully unattended", hint: "only a hard block stops it" }
647
- ];
648
- var PUBLISH_MODE_QUESTION = "When your agent has something worth publishing:";
649
- async function resolvePublishMode(flag, ctx, deps, dryRun, interactive) {
650
- if (flag !== void 0) {
651
- if (!dryRun) await persistPublishMode(ctx.dataDir, flag);
652
- return { value: flag, source: "flag" };
653
- }
654
- const config = await loadRawConfig(ctx.dataDir);
655
- if (config.publish?.mode !== void 0) {
656
- return { value: config.publish.mode, source: "existing" };
657
- }
658
- if (dryRun) return { value: DEFAULT_MODE, source: "default-skipped" };
659
- if (!interactive) {
660
- await persistPublishMode(ctx.dataDir, RECOMMENDED_MODE);
661
- return { value: RECOMMENDED_MODE, source: "headless-default" };
662
- }
663
- const answer = await (deps.promptPublishMode ?? defaultPromptPublishMode)();
664
- if (answer === null) return { value: DEFAULT_MODE, source: "default-skipped" };
665
- const parsed = PublishModeSchema.safeParse(answer);
666
- if (!parsed.success) return { value: DEFAULT_MODE, source: "default-skipped" };
667
- await persistPublishMode(ctx.dataDir, parsed.data);
668
- return { value: parsed.data, source: "prompt" };
669
- }
670
- function defaultPromptPublishMode() {
671
- return selectOne({
672
- message: PUBLISH_MODE_QUESTION,
673
- choices: PUBLISH_MODE_CHOICES.map((c) => ({ ...c })),
674
- initialValue: "auto"
675
- });
676
- }
677
- function parseModeFlag(value) {
678
- return parsePublishModeFlag(value, "--publish-mode");
679
- }
680
- function permissionsQuestionHead(mode) {
681
- const count = rulesForPublishMode(mode).length;
682
- return `Let your agent use tenjin without permission popups? Adds ${count} command rules to ~/.claude/settings.json.`;
683
- }
684
- var PERMISSIONS_QUESTION = `${permissionsQuestionHead("review")} None of them can spend your money. Details: ${PERMISSIONS_DOC_URL}`;
685
- function permissionsQuestion(mode) {
686
- if (mode === "review") return PERMISSIONS_QUESTION;
687
- return `${permissionsQuestionHead(mode)} None of them can spend your money, and on publish.mode ${mode} your agent will publish under your identity on its own. Details: ${PERMISSIONS_DOC_URL}`;
688
- }
689
- var WALLET_QUESTION = "Create a wallet now?";
690
- async function resolvePermissions(args) {
691
- const { plans, home, deps, flag, dryRun, canPrompt, publishMode } = args;
692
- if (dryRun) return (deps.planPermissions ?? planFreeVerbAllowlist)(home, publishMode);
693
- let retractedRules = [];
694
- let retractedFrom;
695
- if (publishMode === "review") {
696
- const retracted = await (deps.retractModeGated ?? retractModeGatedRules)(home);
697
- if (retracted.skipped !== void 0) return retracted;
698
- retractedRules = retracted.removed;
699
- retractedFrom = retracted.path;
700
- }
701
- const withRetraction = (result) => retractedRules.length === 0 ? result : {
702
- ...result,
703
- removed: [...retractedRules, ...result.removed],
704
- // A non-Claude skip carries no `path`, deliberately: naming a Claude
705
- // file to a Codex-only operator points them at a file that is nothing
706
- // to do with their harness. Once we have RETRACTED from that file, the
707
- // reverse is true, and the operator needs to know which file changed.
708
- ...result.path === void 0 ? { path: retractedFrom } : {}
709
- };
710
- const hasClaude = plans.some((p) => p.harness === "claude");
711
- if (!hasClaude) {
712
- return withRetraction(
713
- permissionsSkipped(plans[0]?.harness ?? "shared", home, "harness-not-claude")
714
- );
715
- }
716
- if (flag === false) return withRetraction(permissionsSkipped("claude", home, "declined"));
717
- const probe = await (deps.inspectPermissions ?? inspectFreeVerbRules)(home, publishMode);
718
- if (probe.satisfied !== void 0) return withRetraction(probe.satisfied);
719
- if (probe.pending !== null && probe.pending.length === 0) {
720
- return withRetraction(await wireFreeVerbAllowlist(home, publishMode));
721
- }
722
- if (flag === true || !canPrompt) {
723
- return withRetraction(await wireFreeVerbAllowlist(home, publishMode));
724
- }
725
- const confirm = deps.confirmPermissions ?? defaultConfirm;
726
- if (!await confirm(permissionsQuestion(publishMode))) {
727
- return withRetraction(permissionsSkipped("claude", home, "declined"));
728
- }
729
- return withRetraction(await wireFreeVerbAllowlist(home, publishMode));
730
- }
731
- var SEARCH_HOOKS_QUESTION = "Let Tenjin ride along with your web searches?";
732
- var SEARCH_HOOKS_CHOICES = [
733
- {
734
- value: "auto",
735
- label: "Yes, check Tenjin first (recommended)",
736
- hint: `before a WebSearch or a subagent dispatch, ask ${PRODUCTION_HOST} the same question (free, anonymous, 2s budget) and mention a tested answer; the query or the first 400 chars of the prompt leaves the machine`
737
- },
738
- {
739
- value: "remind",
740
- label: "Just remind me",
741
- hint: "a one-line reminder, nothing sent off-machine"
742
- },
743
- { value: "off", label: "No hooks", hint: "nothing is registered" }
744
- ];
745
- async function resolveHooks(args) {
746
- const { plans, home, ctx, deps, flag, noHooks, dryRun, canPrompt } = args;
747
- const dataDir = ctx.dataDir;
748
- const rawHooks = (await loadRawConfig(dataDir)).hooks;
749
- const stored = rawHooks?.webSearch ?? rawHooks?.searchMode;
750
- const storedWebSearch = rawHooks?.webSearch ?? rawHooks?.searchMode;
751
- const storedAgentDispatchRaw = rawHooks?.agentDispatch ?? (rawHooks?.dispatchMode === "inherit" ? storedWebSearch : rawHooks?.dispatchMode);
752
- const storedAgentDispatch = storedAgentDispatchRaw ?? (rawHooks?.searchMode !== void 0 ? storedWebSearch : void 0);
753
- const storedWebSearchEff = storedWebSearch ?? DEFAULT_HOOK_MODE;
754
- const storedAgentDispatchEff = storedAgentDispatch ?? storedWebSearch ?? DEFAULT_HOOK_MODE;
755
- const hasClaude = plans.some((p) => p.harness === "claude");
756
- const hasHermes = plans.some((p) => p.harness === "hermes");
757
- if (!hasClaude && !hasHermes) {
758
- const harness = plans[0]?.harness ?? "shared";
759
- return hooksSkipped(
760
- harness,
761
- home,
762
- dataDir,
763
- flag ?? stored ?? DEFAULT_HOOK_MODE,
764
- "harness-not-claude"
765
- );
766
- }
767
- if (noHooks) {
768
- return hooksSkipped(
769
- hasHermes ? "hermes" : "claude",
770
- home,
771
- dataDir,
772
- stored ?? DEFAULT_HOOK_MODE,
773
- "declined"
774
- );
775
- }
776
- const mode = await chooseHookMode(flag, stored, deps, dryRun, canPrompt);
777
- if (mode === null) {
778
- return hooksSkipped(
779
- hasHermes ? "hermes" : "claude",
780
- home,
781
- dataDir,
782
- stored ?? DEFAULT_HOOK_MODE,
783
- "declined"
784
- );
785
- }
786
- const resultHarness = hasHermes && !hasClaude ? "hermes" : "claude";
787
- if (dryRun) return hooksSkipped(resultHarness, home, dataDir, mode, "dry-run");
788
- const isExplicitChoice = flag !== void 0 || canPrompt && !dryRun;
789
- const hasAnyHookKey = rawHooks?.webSearch !== void 0 || rawHooks?.agentDispatch !== void 0 || rawHooks?.searchMode !== void 0 || rawHooks?.dispatchMode !== void 0;
790
- const needsSync = isExplicitChoice ? rawHooks?.webSearch === void 0 || rawHooks?.agentDispatch === void 0 || mode !== storedWebSearchEff || mode !== storedAgentDispatchEff : !hasAnyHookKey;
791
- if (needsSync) {
792
- await persistWebSearchHookMode(dataDir, mode);
793
- await persistAgentDispatchHookMode(dataDir, mode);
794
- }
795
- if (mode === "off") return hooksSkipped(resultHarness, home, dataDir, mode, "mode-off");
796
- if (!hasClaude) return hooksSkipped("hermes", home, dataDir, mode, "native-harness");
797
- return wireSearchHooks({ homeDir: home, dataDir, mode });
798
- }
799
- function hermesHooksEnabled(hooks) {
800
- return hooks.skipped !== "declined" && hooks.skipped !== "mode-off" && hooks.skipped !== "harness-not-claude";
801
- }
802
- var DEFAULT_HOOK_MODE = CONFIG_DEFAULTS.hooks.webSearch;
803
- async function chooseHookMode(flag, stored, deps, dryRun, canPrompt) {
804
- if (flag !== void 0) return flag;
805
- if (dryRun || !canPrompt) return stored ?? DEFAULT_HOOK_MODE;
806
- const answer = await (deps.promptSearchHooks ?? defaultPromptSearchHooks)();
807
- if (answer === null) return null;
808
- const parsed = WebSearchModeSchema.safeParse(answer);
809
- return parsed.success ? parsed.data : null;
810
- }
811
- function defaultPromptSearchHooks() {
812
- return selectOne({
813
- message: SEARCH_HOOKS_QUESTION,
814
- choices: SEARCH_HOOKS_CHOICES.map((c) => ({ ...c })),
815
- initialValue: "auto"
816
- });
817
- }
818
- function resolvePlans(override, home, hermesHome, which) {
819
- if (override !== void 0 && override.length > 0) {
820
- const plans2 = override.map(
821
- (v) => planFor(validateHarness(v), ["override"], true, home, hermesHome)
822
- );
823
- return dedupeBySkillsDir(plans2);
824
- }
825
- const plans = [];
826
- const claudeBy = harnessDetectedBy(home, "claude", which, hermesHome);
827
- const codexBy = harnessDetectedBy(home, "codex", which, hermesHome);
828
- const hermesBy = harnessDetectedBy(home, "hermes", which, hermesHome);
829
- if (claudeBy.length > 0) plans.push(planFor("claude", claudeBy, true, home, hermesHome));
830
- if (codexBy.length > 0) plans.push(planFor("codex", codexBy, true, home, hermesHome));
831
- if (hermesBy.length > 0) plans.push(planFor("hermes", hermesBy, true, home, hermesHome));
832
- if (plans.length === 0) {
833
- plans.push(planFor("shared", ["fallback"], false, home, hermesHome));
834
- }
835
- return dedupeBySkillsDir(plans);
836
- }
837
- function planFor(harness, detectedBy, detected, home, hermesHome) {
838
- const skillsDir = harnessTargetDir(home, harness, hermesHome);
839
- return {
840
- harness,
841
- detected,
842
- detectedBy,
843
- skillsDir,
844
- wiresAgentsMd: harness !== "claude" && harness !== "hermes",
845
- home
846
- };
847
- }
848
- function dedupeBySkillsDir(plans) {
849
- const seen = /* @__PURE__ */ new Set();
850
- const out = [];
851
- for (const p of plans) {
852
- if (seen.has(p.skillsDir)) continue;
853
- seen.add(p.skillsDir);
854
- out.push(p);
855
- }
856
- return out;
857
- }
858
- function validateHarness(value) {
859
- if (HARNESSES.includes(value)) return value;
860
- throw new CliError("USAGE", `Unknown harness "${value}"`, {
861
- fix: `--harness must be one of: ${HARNESSES.join(", ")}.`
862
- });
863
- }
864
- async function applyPlan(plan, skillsSource, dryRun) {
865
- const skills = [];
866
- const warnings = [];
867
- for (const name of SKILL_NAMES) {
868
- const { status, warning, preexisting } = await installSkill(
869
- join(skillsSource, name),
870
- join(plan.skillsDir, name),
871
- dryRun,
872
- name
873
- );
874
- skills.push({
875
- name,
876
- status,
877
- preexisting,
878
- cli: CLI_SKILL_NAMES.includes(name),
879
- modelInvocable: await landedInvocable(plan.skillsDir, skillsSource, name, dryRun)
880
- });
881
- if (warning !== void 0) warnings.push(warning);
882
- }
883
- const hostedPreexisting = skills.some((s) => s.name === HOSTED_SKILL_NAME && s.preexisting);
884
- const hostedArrivedFirst = hostedPreexisting && !skills.some((s) => s.cli && s.preexisting);
885
- const result = {
886
- harness: plan.harness,
887
- detected: plan.detected,
888
- detectedBy: plan.detectedBy,
889
- skillsDir: plan.skillsDir,
890
- skills,
891
- hostedPreexisting,
892
- hostedArrivedFirst,
893
- notes: notesFor(plan, hostedArrivedFirst),
894
- warnings
895
- };
896
- if (plan.wiresAgentsMd) result.codexNetworkRule = CODEX_NETWORK_RULE;
897
- return result;
898
- }
899
- function notesFor(plan, hostedArrivedFirst) {
900
- const notes = plan.harness === "claude" ? [
901
- "Installed at the user level (~/.claude/skills). A Claude Code plugin will later make this automatic."
902
- ] : [
903
- "Copied into the shared Agent Skills location (~/.agents/skills). Codex and any Agent-Skills-compatible harness read it there."
904
- ];
905
- if (hostedArrivedFirst) {
906
- notes.push(
907
- `The hosted ${HOSTED_SKILL_NAME} skill was already here; the skill stays as the zero-install fallback (its file is replaced by this package's mirror) and the CLI skills (${CLI_SKILL_NAMES.join(", ")}) take precedence while the CLI is installed.`
908
- );
909
- }
910
- return notes;
911
- }
912
- async function landedInvocable(skillsDir, skillsSource, name, dryRun) {
913
- const read = await readSkillFile(join(dryRun ? skillsSource : skillsDir, name, "SKILL.md"));
914
- if (read.kind !== "ok") return false;
915
- return !isModelInvocationDisabled(read.bytes.toString("utf8"));
916
- }
917
- async function assertSkillsLanded(plans, dryRun) {
918
- if (dryRun) return;
919
- const missing = [];
920
- for (const plan of plans) {
921
- for (const name of SKILL_NAMES) {
922
- if (!existsSync(join(plan.skillsDir, name, "SKILL.md"))) {
923
- missing.push(join(plan.skillsDir, name));
924
- }
925
- }
926
- }
927
- if (missing.length === 0) return;
928
- throw new CliError("INTERNAL", `Skills were not written: ${missing.join(", ")}`, {
929
- // Safe to point at permissions because nothing removes a landed file any more:
930
- // each shipped file arrives by its own atomic rename. When this was a
931
- // rm-then-write it also fired on a lost race, and sent people to chmod a
932
- // directory that was fine.
933
- fix: `Check that you can write to the skills directory (\`ls -ld ${dirname(missing[0] ?? "")}\`), then re-run \`tenjin install\`.`
934
- });
935
- }
936
- function paint(io, format, text) {
937
- if (io.stdout instanceof Stream) return styleText(format, text, { stream: io.stdout });
938
- return styleText(format, text);
939
- }
940
- async function assertSkillsSource(dir) {
941
- for (const name of SKILL_NAMES) {
942
- if (!existsSync(join(dir, name, "SKILL.md"))) {
943
- throw new CliError("INTERNAL", `Packaged skill "${name}" is missing under ${dir}`, {
944
- fix: "Reinstall tenjin-cli; the published package must ship every skill under skills/."
945
- });
946
- }
947
- }
948
- for (const name of CLI_SKILL_NAMES) {
949
- const text = await readFile(join(dir, name, "SKILL.md"), "utf8");
950
- if (isModelInvocationDisabled(text)) {
951
- throw new CliError(
952
- "INTERNAL",
953
- `Packaged skill "${name}" carries disable-model-invocation: true, so no harness would surface it`,
954
- {
955
- fix: "Reinstall tenjin-cli; the published CLI skills must be model-invocable."
956
- }
957
- );
958
- }
959
- }
960
- }
961
- export {
962
- BAZAAR_QUESTION,
963
- PERMISSIONS_QUESTION,
964
- PUBLISH_MODE_CHOICES,
965
- PUBLISH_MODE_QUESTION,
966
- SEARCH_HOOKS_CHOICES,
967
- SEARCH_HOOKS_QUESTION,
968
- WALLET_QUESTION,
969
- permissionsQuestion,
970
- runInstall
971
- };
972
- //# sourceMappingURL=install-GNK2W3PI.js.map