tenjin-cli 0.1.0-alpha.30 → 0.1.0-alpha.32

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 (280) hide show
  1. package/README.md +65 -116
  2. package/dist/{_esm-CE7KNONL.js → _esm-RLLC72MS.js} +127 -131
  3. package/dist/alive-MROUMFH3.js +38 -0
  4. package/dist/auto-update-OPWMRZLS.js +22 -0
  5. package/dist/{ccip-7RMRLAGV.js → ccip-DHDFKTQV.js} +2 -2
  6. package/dist/chunk-2GNOFONN.js +560 -0
  7. package/dist/chunk-2GNOFONN.js.map +1 -0
  8. package/dist/{chunk-TTNESUPQ.js → chunk-2GP3HRYK.js} +2120 -193
  9. package/dist/chunk-2GP3HRYK.js.map +1 -0
  10. package/dist/chunk-3623BLPV.js +184 -0
  11. package/dist/chunk-3623BLPV.js.map +1 -0
  12. package/dist/chunk-3AIHRXKO.js +72 -0
  13. package/dist/chunk-3AIHRXKO.js.map +1 -0
  14. package/dist/chunk-3DIL66VX.js +120 -0
  15. package/dist/chunk-3DIL66VX.js.map +1 -0
  16. package/dist/{chunk-S4SAZ7OD.js → chunk-3FMZGI7I.js} +12 -2
  17. package/dist/{chunk-S4SAZ7OD.js.map → chunk-3FMZGI7I.js.map} +1 -1
  18. package/dist/chunk-3UCIG4TG.js +65 -0
  19. package/dist/chunk-3UCIG4TG.js.map +1 -0
  20. package/dist/{chunk-LFZJM56J.js → chunk-445VQTVM.js} +3 -3
  21. package/dist/{chunk-A36LQPHV.js → chunk-4LMUQMBH.js} +1 -1
  22. package/dist/{chunk-A36LQPHV.js.map → chunk-4LMUQMBH.js.map} +1 -1
  23. package/dist/{chunk-RAULEAZ6.js → chunk-4USCZ2NI.js} +3 -3
  24. package/dist/chunk-62KNUYWD.js +111 -0
  25. package/dist/chunk-62KNUYWD.js.map +1 -0
  26. package/dist/{chunk-POUWHWID.js → chunk-6CMM6YCB.js} +3 -3
  27. package/dist/{chunk-POUWHWID.js.map → chunk-6CMM6YCB.js.map} +1 -1
  28. package/dist/chunk-7WEQQJLG.js +68 -0
  29. package/dist/chunk-7WEQQJLG.js.map +1 -0
  30. package/dist/{chunk-3O2BQIF6.js → chunk-AD226HDR.js} +344 -534
  31. package/dist/chunk-AD226HDR.js.map +1 -0
  32. package/dist/chunk-ADV4LDTB.js +106 -0
  33. package/dist/chunk-ADV4LDTB.js.map +1 -0
  34. package/dist/{chunk-AWFUPKTM.js → chunk-AV5NZMYO.js} +15 -7
  35. package/dist/{chunk-AWFUPKTM.js.map → chunk-AV5NZMYO.js.map} +1 -1
  36. package/dist/chunk-B7EM4GGF.js +198 -0
  37. package/dist/chunk-B7EM4GGF.js.map +1 -0
  38. package/dist/chunk-BFDQ4WNW.js +119 -0
  39. package/dist/chunk-BFDQ4WNW.js.map +1 -0
  40. package/dist/{chunk-OSYTBCUC.js → chunk-BI673VEJ.js} +531 -503
  41. package/dist/chunk-BI673VEJ.js.map +1 -0
  42. package/dist/chunk-CEXSOI5R.js +808 -0
  43. package/dist/chunk-CEXSOI5R.js.map +1 -0
  44. package/dist/{chunk-OK2TDZQU.js → chunk-CISYM4EO.js} +9 -7
  45. package/dist/chunk-CISYM4EO.js.map +1 -0
  46. package/dist/{chunk-VFMQTSXG.js → chunk-D3ZURCG7.js} +3 -3
  47. package/dist/chunk-D5TOQSO4.js +474 -0
  48. package/dist/chunk-D5TOQSO4.js.map +1 -0
  49. package/dist/{chunk-P7LABKCW.js → chunk-DOQGNFHM.js} +33 -2
  50. package/dist/{chunk-P7LABKCW.js.map → chunk-DOQGNFHM.js.map} +1 -1
  51. package/dist/{chunk-QUVVWYJW.js → chunk-DRDUIZIA.js} +11 -9
  52. package/dist/{chunk-QUVVWYJW.js.map → chunk-DRDUIZIA.js.map} +1 -1
  53. package/dist/{chunk-O2FRQ2L2.js → chunk-DW4YTVR3.js} +5 -65
  54. package/dist/chunk-DW4YTVR3.js.map +1 -0
  55. package/dist/chunk-E7LGOMH6.js +449 -0
  56. package/dist/chunk-E7LGOMH6.js.map +1 -0
  57. package/dist/chunk-E7SW44LM.js +138 -0
  58. package/dist/chunk-E7SW44LM.js.map +1 -0
  59. package/dist/chunk-EDJWHDDL.js +33 -0
  60. package/dist/chunk-EDJWHDDL.js.map +1 -0
  61. package/dist/chunk-F3ED5WTR.js +13 -0
  62. package/dist/chunk-F3ED5WTR.js.map +1 -0
  63. package/dist/chunk-G75OPGAK.js +111 -0
  64. package/dist/chunk-G75OPGAK.js.map +1 -0
  65. package/dist/{chunk-YFQOA5AU.js → chunk-GAKUQHKA.js} +13 -17
  66. package/dist/{chunk-YFQOA5AU.js.map → chunk-GAKUQHKA.js.map} +1 -1
  67. package/dist/{chunk-PAYV4XUA.js → chunk-HDPUXS3Z.js} +20 -49
  68. package/dist/chunk-HDPUXS3Z.js.map +1 -0
  69. package/dist/{chunk-ORWL5BSN.js → chunk-HGZEPQUT.js} +2 -2
  70. package/dist/{chunk-HPWO4O6S.js → chunk-HREHWL32.js} +4 -4
  71. package/dist/{chunk-HPWO4O6S.js.map → chunk-HREHWL32.js.map} +1 -1
  72. package/dist/{chunk-VZGAONSJ.js → chunk-I5TDIUKM.js} +16 -35
  73. package/dist/chunk-I5TDIUKM.js.map +1 -0
  74. package/dist/{chunk-7QKHZQKW.js → chunk-IADZOXKN.js} +39 -6
  75. package/dist/chunk-IADZOXKN.js.map +1 -0
  76. package/dist/{chunk-U6YQ6FRI.js → chunk-IDTRSAHE.js} +32 -12
  77. package/dist/chunk-IDTRSAHE.js.map +1 -0
  78. package/dist/{chunk-SPAVAYSW.js → chunk-JEVQ5LKO.js} +7 -5
  79. package/dist/{chunk-SPAVAYSW.js.map → chunk-JEVQ5LKO.js.map} +1 -1
  80. package/dist/{chunk-EBVIKMCH.js → chunk-JKKAIPTU.js} +2 -2
  81. package/dist/chunk-JNJWBTU2.js +3497 -0
  82. package/dist/chunk-JNJWBTU2.js.map +1 -0
  83. package/dist/{chunk-TTBKWWTV.js → chunk-JRZBBPO6.js} +390 -146
  84. package/dist/chunk-JRZBBPO6.js.map +1 -0
  85. package/dist/{chunk-WVUSXNIE.js → chunk-MPZUYCAP.js} +9 -2
  86. package/dist/{chunk-WVUSXNIE.js.map → chunk-MPZUYCAP.js.map} +1 -1
  87. package/dist/{chunk-SJLTEINJ.js → chunk-OJNTCYQQ.js} +17 -1
  88. package/dist/chunk-OJNTCYQQ.js.map +1 -0
  89. package/dist/{chunk-IOODYAXL.js → chunk-OTWLERSW.js} +25 -6
  90. package/dist/chunk-OTWLERSW.js.map +1 -0
  91. package/dist/{chunk-AWQPGIR6.js → chunk-PJNENX2A.js} +1535 -422
  92. package/dist/chunk-PJNENX2A.js.map +1 -0
  93. package/dist/{chunk-KHE6L6TD.js → chunk-PKHI276N.js} +97 -11
  94. package/dist/chunk-PKHI276N.js.map +1 -0
  95. package/dist/{chunk-YHKXNYTB.js → chunk-QF3LSMGS.js} +2 -2
  96. package/dist/chunk-QXP3Z3JN.js +131 -0
  97. package/dist/chunk-QXP3Z3JN.js.map +1 -0
  98. package/dist/{chunk-XZKD7DIF.js → chunk-RL5UUDT4.js} +3 -3
  99. package/dist/{chunk-XZKD7DIF.js.map → chunk-RL5UUDT4.js.map} +1 -1
  100. package/dist/chunk-SFASB5FL.js +69 -0
  101. package/dist/chunk-SFASB5FL.js.map +1 -0
  102. package/dist/{chunk-WO5BJNIB.js → chunk-SNNSAGMT.js} +7273 -2741
  103. package/dist/chunk-SNNSAGMT.js.map +1 -0
  104. package/dist/{chunk-NZIP4PA2.js → chunk-SO3XRZPX.js} +3 -3
  105. package/dist/chunk-SYOS5CAC.js +176 -0
  106. package/dist/chunk-SYOS5CAC.js.map +1 -0
  107. package/dist/chunk-TAW4UFFF.js +293 -0
  108. package/dist/chunk-TAW4UFFF.js.map +1 -0
  109. package/dist/chunk-TF5HCP33.js +271 -0
  110. package/dist/chunk-TF5HCP33.js.map +1 -0
  111. package/dist/{chunk-AKWGE6JQ.js → chunk-UUGOUOVT.js} +37 -2
  112. package/dist/chunk-UUGOUOVT.js.map +1 -0
  113. package/dist/{chunk-AEG2PXBP.js → chunk-V2LQLN5H.js} +7 -7
  114. package/dist/{chunk-KYFZTGMC.js → chunk-VJUVFZ2D.js} +5 -3
  115. package/dist/{chunk-KYFZTGMC.js.map → chunk-VJUVFZ2D.js.map} +1 -1
  116. package/dist/{chunk-JMM6YE7J.js → chunk-VOZA6O7K.js} +708 -709
  117. package/dist/chunk-VOZA6O7K.js.map +1 -0
  118. package/dist/{chunk-5LJCEMFD.js → chunk-VUGQTZ2L.js} +209 -77
  119. package/dist/chunk-VUGQTZ2L.js.map +1 -0
  120. package/dist/chunk-WOM257PW.js +393 -0
  121. package/dist/chunk-WOM257PW.js.map +1 -0
  122. package/dist/chunk-WYXUQGOL.js +191 -0
  123. package/dist/chunk-WYXUQGOL.js.map +1 -0
  124. package/dist/chunk-X5ZBP3IY.js +97 -0
  125. package/dist/chunk-X5ZBP3IY.js.map +1 -0
  126. package/dist/chunk-XQJXNMSB.js +23 -0
  127. package/dist/chunk-XQJXNMSB.js.map +1 -0
  128. package/dist/chunk-Y527D4TV.js +56 -0
  129. package/dist/chunk-Y527D4TV.js.map +1 -0
  130. package/dist/{chunk-VUFAK2LW.js → chunk-YUY4SAGM.js} +17 -2
  131. package/dist/chunk-YUY4SAGM.js.map +1 -0
  132. package/dist/clack-EZ7TDWQU.js +19 -0
  133. package/dist/claude-cli-2YKABJJZ.js +31 -0
  134. package/dist/{cli-O5SN7ZJ4.js → cli-FB4LOA5A.js} +221 -68
  135. package/dist/{cli-O5SN7ZJ4.js.map → cli-FB4LOA5A.js.map} +1 -1
  136. package/dist/codex-event-TYVES3UX.js +16 -0
  137. package/dist/codex-host-WW4H2SKT.js +29 -0
  138. package/dist/codex-install-2C623HPW.js +393 -0
  139. package/dist/codex-install-2C623HPW.js.map +1 -0
  140. package/dist/{config-OJQI27LT.js → config-HOVJFEKD.js} +25 -15
  141. package/dist/doctor-NKU4V5OV.js +1312 -0
  142. package/dist/doctor-NKU4V5OV.js.map +1 -0
  143. package/dist/{env-proxy-XL4P73MZ.js → env-proxy-R6ZMLQTT.js} +6 -2
  144. package/dist/{ethersCompat-Df4a6QIZ-THAVUGIJ.js → ethersCompat-Df4a6QIZ-X6YZWAML.js} +3 -3
  145. package/dist/{fund-WEV6DMTD.js → fund-WEBHTZGN.js} +38 -30
  146. package/dist/{fund-WEV6DMTD.js.map → fund-WEBHTZGN.js.map} +1 -1
  147. package/dist/hook-command-ZA2PNKS6.js +44 -0
  148. package/dist/hosts/claude/.claude-plugin/marketplace.json +2 -2
  149. package/dist/hosts/claude/tenjin/.claude-plugin/plugin.json +3 -2
  150. package/dist/hosts/claude/tenjin/hooks/hooks.json +4 -1
  151. package/dist/hosts/claude/tenjin/hooks/register.tsx +589 -0
  152. package/dist/hosts/claude/tenjin/skills/tenjin-pay/SKILL.md +82 -0
  153. package/dist/hosts/claude/tenjin/types/index.d.ts +41 -0
  154. package/dist/hosts/codex/.agents/plugins/marketplace.json +20 -0
  155. package/dist/hosts/codex/tenjin/.codex-plugin/plugin.json +16 -0
  156. package/dist/hosts/codex/tenjin/.mcp.json +15 -0
  157. package/dist/hosts/codex/tenjin/hooks/hooks.json +98 -0
  158. package/dist/hosts-AV5MHBAU.js +38 -0
  159. package/dist/index.js +28 -8
  160. package/dist/index.js.map +1 -1
  161. package/dist/install-PT4EZS4R.js +100 -0
  162. package/dist/{install-identity-WHPNMNMQ.js → install-identity-5A4OE6YC.js} +13 -8
  163. package/dist/install-wallet-SAAPKB73.js +281 -0
  164. package/dist/install-wallet-SAAPKB73.js.map +1 -0
  165. package/dist/{mcp-QML7ZMPH.js → mcp-HAWKCTPQ.js} +909 -208
  166. package/dist/mcp-HAWKCTPQ.js.map +1 -0
  167. package/dist/{mine.wasm-6PIT3DK6.js → mine.wasm-QFAHIFPY.js} +2 -2
  168. package/dist/{mine.wasm-6PIT3DK6.js.map → mine.wasm-QFAHIFPY.js.map} +1 -1
  169. package/dist/{package-LGKYOEPV.js → package-SR2WB6MK.js} +4 -2
  170. package/dist/passphrase-IFTDS3CU.js +44 -0
  171. package/dist/{paths-POPTXJO6.js → paths-XCSAKISU.js} +10 -2
  172. package/dist/pay-OXC3WKYV.js +55 -0
  173. package/dist/pay-OXC3WKYV.js.map +1 -0
  174. package/dist/{payments-C44QUFXU.js → payments-3KHMP2MG.js} +18 -13
  175. package/dist/{payments-C44QUFXU.js.map → payments-3KHMP2MG.js.map} +1 -1
  176. package/dist/plugin-registration-N3GRIZVM.js +67 -0
  177. package/dist/plugin-registration-N3GRIZVM.js.map +1 -0
  178. package/dist/{redact-6W23GGJC.js → redact-D7ASVWKL.js} +2 -2
  179. package/dist/redact-D7ASVWKL.js.map +1 -0
  180. package/dist/runtime-UVNUA3AS.js +1203 -0
  181. package/dist/runtime-UVNUA3AS.js.map +1 -0
  182. package/dist/runtime-fetch-EKFRNR6Z.js +20 -0
  183. package/dist/runtime-fetch-EKFRNR6Z.js.map +1 -0
  184. package/dist/runtime-layout-BDWZG2TQ.js +25 -0
  185. package/dist/runtime-layout-BDWZG2TQ.js.map +1 -0
  186. package/dist/{send-KVJX4XIR.js → send-HMKJLT34.js} +26 -18
  187. package/dist/{send-KVJX4XIR.js.map → send-HMKJLT34.js.map} +1 -1
  188. package/dist/{status-S7C3WMSH.js → status-RWXIIWYS.js} +57 -22
  189. package/dist/status-RWXIIWYS.js.map +1 -0
  190. package/dist/{status-line-YR2T5HC4.js → status-line-77XYZP7E.js} +13 -8
  191. package/dist/{status-line-YR2T5HC4.js.map → status-line-77XYZP7E.js.map} +1 -1
  192. package/dist/uninstall-D5G67UJH.js +480 -0
  193. package/dist/uninstall-D5G67UJH.js.map +1 -0
  194. package/dist/update-LRNOEGSB.js +53 -0
  195. package/dist/update-LRNOEGSB.js.map +1 -0
  196. package/dist/{usdc-JK4RRFFQ.js → usdc-D6X7EIQ2.js} +7 -8
  197. package/dist/usdc-D6X7EIQ2.js.map +1 -0
  198. package/dist/{viemAdapter-By13KInL-X2VY6CY3.js → viemAdapter-By13KInL-RL742ETX.js} +3 -3
  199. package/dist/viemAdapter-By13KInL-RL742ETX.js.map +1 -0
  200. package/dist/wallet-XFYC27BR.js +55 -0
  201. package/dist/wallet-XFYC27BR.js.map +1 -0
  202. package/dist/wallet-kdf-worker.mjs +8 -8
  203. package/docs/agent-permissions.md +56 -22
  204. package/docs/safety-model.md +1 -1
  205. package/docs/troubleshooting.md +72 -1
  206. package/package.json +14 -1
  207. package/dist/alive-3J3CHOQP.js +0 -21
  208. package/dist/ccip-NLCSCHKI.js +0 -19
  209. package/dist/chunk-3O2BQIF6.js.map +0 -1
  210. package/dist/chunk-5IEP5EGE.js +0 -5332
  211. package/dist/chunk-5IEP5EGE.js.map +0 -1
  212. package/dist/chunk-5LJCEMFD.js.map +0 -1
  213. package/dist/chunk-6W5GYG3W.js +0 -128
  214. package/dist/chunk-6W5GYG3W.js.map +0 -1
  215. package/dist/chunk-7EKYXMUO.js +0 -7536
  216. package/dist/chunk-7EKYXMUO.js.map +0 -1
  217. package/dist/chunk-7QKHZQKW.js.map +0 -1
  218. package/dist/chunk-AKWGE6JQ.js.map +0 -1
  219. package/dist/chunk-AWQPGIR6.js.map +0 -1
  220. package/dist/chunk-EGELTSPU.js +0 -2865
  221. package/dist/chunk-EGELTSPU.js.map +0 -1
  222. package/dist/chunk-EL56RW2J.js +0 -7611
  223. package/dist/chunk-EL56RW2J.js.map +0 -1
  224. package/dist/chunk-HE2MS4QO.js +0 -256
  225. package/dist/chunk-HE2MS4QO.js.map +0 -1
  226. package/dist/chunk-IOODYAXL.js.map +0 -1
  227. package/dist/chunk-JMM6YE7J.js.map +0 -1
  228. package/dist/chunk-KHE6L6TD.js.map +0 -1
  229. package/dist/chunk-N35E6CM2.js +0 -1185
  230. package/dist/chunk-N35E6CM2.js.map +0 -1
  231. package/dist/chunk-O2FRQ2L2.js.map +0 -1
  232. package/dist/chunk-OK2TDZQU.js.map +0 -1
  233. package/dist/chunk-OSYTBCUC.js.map +0 -1
  234. package/dist/chunk-PAYV4XUA.js.map +0 -1
  235. package/dist/chunk-SJLTEINJ.js.map +0 -1
  236. package/dist/chunk-TTBKWWTV.js.map +0 -1
  237. package/dist/chunk-TTNESUPQ.js.map +0 -1
  238. package/dist/chunk-U6YQ6FRI.js.map +0 -1
  239. package/dist/chunk-VUFAK2LW.js.map +0 -1
  240. package/dist/chunk-VZGAONSJ.js.map +0 -1
  241. package/dist/chunk-WO5BJNIB.js.map +0 -1
  242. package/dist/doctor-IQQJHGGM.js +0 -590
  243. package/dist/doctor-IQQJHGGM.js.map +0 -1
  244. package/dist/hook-command-D2P3ILRV.js +0 -32
  245. package/dist/install-TUCRF32I.js +0 -60
  246. package/dist/install-wallet-MA27FTQ5.js +0 -113
  247. package/dist/install-wallet-MA27FTQ5.js.map +0 -1
  248. package/dist/mcp-QML7ZMPH.js.map +0 -1
  249. package/dist/pay-2C2UBBXJ.js +0 -51
  250. package/dist/status-S7C3WMSH.js.map +0 -1
  251. package/dist/uninstall-HY6LKIIT.js +0 -149
  252. package/dist/uninstall-HY6LKIIT.js.map +0 -1
  253. package/dist/update-OJV22LR3.js +0 -36
  254. package/dist/wallet-PD2IMZDU.js +0 -39
  255. /package/dist/{_esm-CE7KNONL.js.map → _esm-RLLC72MS.js.map} +0 -0
  256. /package/dist/{alive-3J3CHOQP.js.map → alive-MROUMFH3.js.map} +0 -0
  257. /package/dist/{ccip-7RMRLAGV.js.map → auto-update-OPWMRZLS.js.map} +0 -0
  258. /package/dist/{ccip-NLCSCHKI.js.map → ccip-DHDFKTQV.js.map} +0 -0
  259. /package/dist/{chunk-LFZJM56J.js.map → chunk-445VQTVM.js.map} +0 -0
  260. /package/dist/{chunk-RAULEAZ6.js.map → chunk-4USCZ2NI.js.map} +0 -0
  261. /package/dist/{chunk-VFMQTSXG.js.map → chunk-D3ZURCG7.js.map} +0 -0
  262. /package/dist/{chunk-ORWL5BSN.js.map → chunk-HGZEPQUT.js.map} +0 -0
  263. /package/dist/{chunk-EBVIKMCH.js.map → chunk-JKKAIPTU.js.map} +0 -0
  264. /package/dist/{chunk-YHKXNYTB.js.map → chunk-QF3LSMGS.js.map} +0 -0
  265. /package/dist/{chunk-NZIP4PA2.js.map → chunk-SO3XRZPX.js.map} +0 -0
  266. /package/dist/{chunk-AEG2PXBP.js.map → chunk-V2LQLN5H.js.map} +0 -0
  267. /package/dist/{config-OJQI27LT.js.map → clack-EZ7TDWQU.js.map} +0 -0
  268. /package/dist/{env-proxy-XL4P73MZ.js.map → claude-cli-2YKABJJZ.js.map} +0 -0
  269. /package/dist/{ethersCompat-Df4a6QIZ-THAVUGIJ.js.map → codex-event-TYVES3UX.js.map} +0 -0
  270. /package/dist/{hook-command-D2P3ILRV.js.map → codex-host-WW4H2SKT.js.map} +0 -0
  271. /package/dist/{install-TUCRF32I.js.map → config-HOVJFEKD.js.map} +0 -0
  272. /package/dist/{install-identity-WHPNMNMQ.js.map → env-proxy-R6ZMLQTT.js.map} +0 -0
  273. /package/dist/{package-LGKYOEPV.js.map → ethersCompat-Df4a6QIZ-X6YZWAML.js.map} +0 -0
  274. /package/dist/{paths-POPTXJO6.js.map → hook-command-ZA2PNKS6.js.map} +0 -0
  275. /package/dist/{pay-2C2UBBXJ.js.map → hosts-AV5MHBAU.js.map} +0 -0
  276. /package/dist/{redact-6W23GGJC.js.map → install-PT4EZS4R.js.map} +0 -0
  277. /package/dist/{update-OJV22LR3.js.map → install-identity-5A4OE6YC.js.map} +0 -0
  278. /package/dist/{usdc-JK4RRFFQ.js.map → package-SR2WB6MK.js.map} +0 -0
  279. /package/dist/{viemAdapter-By13KInL-X2VY6CY3.js.map → passphrase-IFTDS3CU.js.map} +0 -0
  280. /package/dist/{wallet-PD2IMZDU.js.map → paths-XCSAKISU.js.map} +0 -0
@@ -1,516 +1,119 @@
1
1
  import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
2
  import {
3
3
  modeGatedPointer
4
- } from "./chunk-A36LQPHV.js";
4
+ } from "./chunk-4LMUQMBH.js";
5
+ import {
6
+ CONTEXT_MAX,
7
+ HARNESS_MS,
8
+ PATCH_TOOL,
9
+ SHELL_TOOL,
10
+ decode,
11
+ encode,
12
+ hasErrorMarker
13
+ } from "./chunk-3623BLPV.js";
5
14
  import {
6
15
  AGENT_ID_RE
7
16
  } from "./chunk-XKESD27X.js";
8
17
  import {
9
- HOOK_TOOL
10
- } from "./chunk-AKWGE6JQ.js";
11
- import {
12
- LEGACY_MCP_SERVER_NAME
13
- } from "./chunk-WVUSXNIE.js";
14
- import {
15
- confirmChoice
16
- } from "./chunk-P7LABKCW.js";
18
+ style
19
+ } from "./chunk-VJUVFZ2D.js";
17
20
  import {
18
21
  CHANNEL_DEPOSIT_ATOMIC,
19
22
  ROUTING_FEE_ATOMIC,
20
23
  usd
21
- } from "./chunk-PAYV4XUA.js";
24
+ } from "./chunk-HDPUXS3Z.js";
25
+ import {
26
+ withAppServer
27
+ } from "./chunk-E7SW44LM.js";
28
+ import {
29
+ codexHome
30
+ } from "./chunk-F3ED5WTR.js";
31
+ import {
32
+ confirmChoice
33
+ } from "./chunk-DOQGNFHM.js";
22
34
  import {
23
35
  LockTimeoutError,
24
36
  withFileLock
25
37
  } from "./chunk-MEFB5KHA.js";
26
38
  import {
27
- style
28
- } from "./chunk-KYFZTGMC.js";
39
+ HOOK_TOOL
40
+ } from "./chunk-UUGOUOVT.js";
41
+ import {
42
+ LEGACY_MCP_SERVER_NAME
43
+ } from "./chunk-MPZUYCAP.js";
29
44
  import {
30
45
  projectRouterPath,
31
46
  readProjectRouterFile,
32
47
  routerSettings
33
- } from "./chunk-SPAVAYSW.js";
34
- import {
35
- hasCode
36
- } from "./chunk-2I4QTOLB.js";
48
+ } from "./chunk-JEVQ5LKO.js";
37
49
  import {
38
50
  isTeamShelfOrigin,
39
- loadProjectConfig
40
- } from "./chunk-AWFUPKTM.js";
41
- import {
42
- CONFIG_KEYS,
43
- CliError,
44
- DEFAULT_MAX_AUTO_SPEND,
45
- DEFAULT_SESSION_BUDGET,
46
- EXPERIMENTAL_CONFIG_KEYS,
47
- HARNESSES,
48
- HOOKS_CONFIG_KEYS,
49
- LOOP_CONFIG_KEYS,
50
- MAX_AUTO_SPEND_FLOOR_ATOMIC,
51
- MAX_AUTO_SPEND_FLOOR_WHY,
52
- PRODUCTION_ORIGIN,
53
- PUBLISH_CONFIG_KEYS,
54
- PublishModeSchema,
55
- RETIRED_PAYMENT_GUIDANCE,
56
- ROUTER_CONFIG_KEYS,
57
- ROUTER_CONTEXTS,
58
- RawConfigSchema,
59
- SEND_MAX_UNSET,
60
- TEAM_CONFIG_KEYS,
61
- UPDATE_CONFIG_KEYS,
62
- isSameDeployment,
63
- loadRawConfig,
64
- parseAckServerWarnings,
65
- parseLoopValue,
66
- parsePublicFallbackFlag,
67
- parseUpdateModeFlag,
68
- parseUsdToAtomic,
69
- resolveSettings,
70
- retiredPaymentKeys,
71
- toMoney
72
- } from "./chunk-WO5BJNIB.js";
73
- import {
74
- writeFileAtomic
75
- } from "./chunk-O2FRQ2L2.js";
76
- import {
77
- configPath,
78
- hooksDir
79
- } from "./chunk-SJLTEINJ.js";
80
-
81
- // src/commands/config.ts
82
- import { mkdir as mkdir2 } from "node:fs/promises";
83
- import { homedir } from "node:os";
84
- import { dirname as dirname3 } from "node:path";
85
-
86
- // src/lib/harness-permissions.ts
87
- import { chmod, lstat, mkdir, readFile, realpath, stat as stat2 } from "node:fs/promises";
88
- import { dirname, join as join4 } from "node:path";
89
-
90
- // src/lib/codex-rules.ts
91
- import { execFile } from "node:child_process";
92
- import { rm, stat } from "node:fs/promises";
93
- import { join as join3 } from "node:path";
94
-
95
- // src/adapters/codex.ts
96
- import { join as join2 } from "node:path";
97
-
98
- // src/hooks/constants.ts
99
- var HARNESS_MS = 5e3;
100
- var MAX_BODY_BYTES = 4 * 1024 * 1024;
101
- var LOG_TRUNCATE_BYTES = 5 * 1024 * 1024;
102
- var CONTEXT_MAX = 1e4;
103
-
104
- // src/lib/codex-trust.ts
105
- import { spawn } from "node:child_process";
106
- import { join } from "node:path";
107
- function codexConfigPath(home, env = process.env) {
108
- return join(codexHome(home, env), "config.toml");
109
- }
110
- function isRecord(v) {
111
- return typeof v === "object" && v !== null && !Array.isArray(v);
112
- }
113
- function foldTrust(rows, keys) {
114
- const wanted = new Set(keys);
115
- const mine = rows.filter((r) => typeof r.key === "string" && wanted.has(r.key));
116
- if (mine.length === 0) return "untrusted";
117
- const status = (r) => typeof r.trustStatus === "string" ? r.trustStatus : "unknown";
118
- if (mine.some((r) => r.enabled === false)) return "disabled";
119
- if (mine.some((r) => status(r) === "modified")) return "modified";
120
- const good = mine.filter((r) => status(r) === "trusted" || status(r) === "managed");
121
- if (good.length === 0) return "untrusted";
122
- if (good.length < keys.length) return "partial";
123
- return "trusted";
124
- }
125
- var PROBE_MS = 8e3;
126
- async function withAppServer(home, env, timeoutMs, fn) {
127
- let child;
128
- try {
129
- child = spawn("codex", ["app-server"], {
130
- env: { ...env, CODEX_HOME: codexHome(home, env) },
131
- stdio: ["pipe", "pipe", "ignore"]
132
- });
133
- } catch {
134
- return null;
135
- }
136
- let dead = false;
137
- const pending = /* @__PURE__ */ new Map();
138
- const fail = () => {
139
- dead = true;
140
- for (const resolve2 of pending.values()) resolve2(void 0);
141
- pending.clear();
142
- };
143
- child.on("error", fail);
144
- child.on("exit", fail);
145
- let buffered = "";
146
- child.stdout?.setEncoding("utf8");
147
- child.stdout?.on("data", (chunk) => {
148
- buffered += chunk;
149
- let cut = buffered.indexOf("\n");
150
- while (cut !== -1) {
151
- const line = buffered.slice(0, cut);
152
- buffered = buffered.slice(cut + 1);
153
- cut = buffered.indexOf("\n");
154
- let msg;
155
- try {
156
- msg = JSON.parse(line);
157
- } catch {
158
- continue;
159
- }
160
- if (!isRecord(msg) || typeof msg.id !== "number") continue;
161
- const waiting = pending.get(msg.id);
162
- if (waiting === void 0) continue;
163
- pending.delete(msg.id);
164
- waiting(msg.error !== void 0 ? void 0 : msg.result);
165
- }
166
- });
167
- let nextId = 1;
168
- const send = (payload) => {
169
- try {
170
- child.stdin?.write(`${JSON.stringify(payload)}
171
- `);
172
- return true;
173
- } catch {
174
- return false;
175
- }
176
- };
177
- const request = async (method, params) => {
178
- if (dead) return void 0;
179
- const id = ++nextId;
180
- return await new Promise((resolve2) => {
181
- const timer = setTimeout(() => {
182
- pending.delete(id);
183
- resolve2(void 0);
184
- }, timeoutMs);
185
- pending.set(id, (value) => {
186
- clearTimeout(timer);
187
- resolve2(value);
188
- });
189
- if (!send({ jsonrpc: "2.0", id, method, params })) {
190
- pending.delete(id);
191
- clearTimeout(timer);
192
- resolve2(void 0);
193
- }
194
- });
195
- };
196
- try {
197
- send({
198
- jsonrpc: "2.0",
199
- id: 1,
200
- method: "initialize",
201
- params: { clientInfo: { name: "tenjin", title: "tenjin", version: "1" } }
202
- });
203
- send({ jsonrpc: "2.0", method: "initialized", params: {} });
204
- return await fn(request);
205
- } catch {
206
- return null;
207
- } finally {
208
- try {
209
- child.stdin?.end();
210
- } catch {
211
- }
212
- child.kill("SIGTERM");
213
- }
214
- }
215
- async function listHooksViaAppServer(home, env, timeoutMs) {
216
- return await withAppServer(home, env, timeoutMs, async (request) => {
217
- const result = await request("hooks/list", { cwds: [] });
218
- return result === void 0 ? null : rowsOf(result);
219
- });
220
- }
221
- function rowsOf(result) {
222
- if (!isRecord(result) || !Array.isArray(result.data)) return [];
223
- const out = [];
224
- for (const group of result.data) {
225
- if (!isRecord(group) || !Array.isArray(group.hooks)) continue;
226
- for (const hook of group.hooks) if (isRecord(hook)) out.push(hook);
227
- }
228
- return out;
229
- }
230
- async function trustCodexHooks(home, keys, ownedBy, opts = {}) {
231
- const env = opts.env ?? process.env;
232
- const timeoutMs = opts.timeoutMs ?? PROBE_MS;
233
- if (keys.length === 0) return { ok: true, trusted: [] };
234
- const run = async (request) => {
235
- const before = await request("hooks/list", { cwds: [] });
236
- if (before === void 0) {
237
- return {
238
- ok: false,
239
- trusted: [],
240
- failedAt: "list",
241
- reason: "hooks/list did not answer"
242
- };
243
- }
244
- const wanted = new Set(keys);
245
- const mine = rowsOf(before).filter(
246
- (r) => typeof r.key === "string" && wanted.has(r.key) && ownedBy(r)
247
- );
248
- if (mine.length !== keys.length) {
249
- return {
250
- ok: false,
251
- trusted: [],
252
- failedAt: "list",
253
- reason: `Codex listed ${mine.length} of the ${keys.length} entries this install wrote`
254
- };
255
- }
256
- const value = {};
257
- for (const row of mine) {
258
- const hash = typeof row.currentHash === "string" ? row.currentHash : null;
259
- if (hash === null) {
260
- return {
261
- ok: false,
262
- trusted: [],
263
- failedAt: "list",
264
- reason: "Codex reported an entry with no currentHash"
265
- };
266
- }
267
- value[row.key] = { trusted_hash: hash, enabled: true };
268
- }
269
- const wrote = await request("config/batchWrite", {
270
- edits: [{ keyPath: "hooks.state", value, mergeStrategy: "upsert" }],
271
- reloadUserConfig: true
272
- });
273
- if (wrote === void 0) {
274
- return {
275
- ok: false,
276
- trusted: [],
277
- failedAt: "write",
278
- reason: "config/batchWrite was refused"
279
- };
280
- }
281
- const after = await request("hooks/list", { cwds: [] });
282
- if (after === void 0) {
283
- return {
284
- ok: false,
285
- trusted: [],
286
- failedAt: "verify",
287
- reason: "the verifying hooks/list did not answer"
288
- };
289
- }
290
- const confirmed = rowsOf(after).filter(
291
- (r) => typeof r.key === "string" && wanted.has(r.key) && ownedBy(r) && r.enabled !== false && (r.trustStatus === "trusted" || r.trustStatus === "managed") && r.currentHash === value[r.key]?.trusted_hash
292
- );
293
- if (confirmed.length !== keys.length) {
294
- return {
295
- ok: false,
296
- trusted: confirmed.map((r) => r.key),
297
- failedAt: "verify",
298
- reason: `Codex confirmed ${confirmed.length} of ${keys.length} entries as trusted after the write`
299
- };
300
- }
301
- return { ok: true, trusted: confirmed.map((r) => r.key) };
302
- };
303
- const outcome = opts.connect !== void 0 ? await run(opts.connect) : await withAppServer(home, env, timeoutMs, run);
304
- return outcome ?? {
305
- ok: false,
306
- trusted: [],
307
- failedAt: "list",
308
- reason: "the codex app server could not be reached"
309
- };
310
- }
311
- async function readCodexTrust(home, keys, opts = {}) {
312
- const env = opts.env ?? process.env;
313
- const configPath2 = codexConfigPath(home, env);
314
- const base = { configPath: configPath2, trusted: 0, expected: keys.length };
315
- if (keys.length === 0) return { ...base, state: "unknown", source: "none" };
316
- const list = await (opts.listHooks ?? ((h, e) => listHooksViaAppServer(h, e, opts.timeoutMs ?? PROBE_MS)))(home, env);
317
- if (list !== null) {
318
- const state = foldTrust(list, keys);
319
- const wanted = new Set(keys);
320
- const trusted = list.filter(
321
- (r) => typeof r.key === "string" && wanted.has(r.key) && (r.trustStatus === "trusted" || r.trustStatus === "managed")
322
- ).length;
323
- return { ...base, trusted, state, source: "app-server" };
324
- }
325
- return { ...base, state: "unknown", source: "none" };
326
- }
327
-
328
- // src/adapters/error-markers.ts
329
- var ERROR_MARKERS = [
330
- // Test-runner verdicts. Uppercase only, and a whole word.
331
- /\bFAIL\b/,
332
- /AssertionError/,
333
- /\b[1-9]\d* (?:failed|failing|errors?)\b/i,
334
- // `Error:`, `TypeError:`, `ReferenceError:`, `ModuleNotFoundError:` — the
335
- // JS and Python convention of naming the class before the colon — and the
336
- // lowercase `error:` that rustc, gcc, clang, esbuild and git open a
337
- // diagnostic line with. Line-start only: "an error: occurred" mid-sentence
338
- // is prose.
339
- /^[ \t]*(?:\w*Error|error):/m,
340
- /Traceback \(most recent call last\)/,
341
- /ModuleNotFoundError|ImportError:/,
342
- /Cannot find module/i,
343
- // A code the shell or a runner states outright. Never zero.
344
- /exit code [1-9]\d*/i,
345
- // libuv/POSIX codes: unambiguous, and the common real failures.
346
- /\b(?:ENOENT|EADDRINUSE|ECONNREFUSED|EACCES|EPERM)\b/,
347
- // Toolchain-specific prefixes: npm, pnpm, tsc, cargo, go, git.
348
- /^[ \t]*npm ERR!/m,
349
- /ERR_PNPM_/,
350
- /error TS\d+:/,
351
- /^[ \t]*error\[E\d+\]/m,
352
- /^[ \t]*panic:/m,
353
- /^[ \t]*fatal:/m,
354
- /Unhandled(?:PromiseRejection|Rejection)/,
355
- /segmentation fault/i
356
- ];
357
- function hasErrorMarker(text) {
358
- return ERROR_MARKERS.some((re) => re.test(text));
359
- }
360
-
361
- // src/adapters/codex.ts
362
- var NATIVE_TO_EVENT = {
363
- SessionStart: "session.start",
364
- UserPromptSubmit: "prompt",
365
- PreToolUse: "tool.before",
366
- PostToolUse: "tool.after",
367
- SubagentStart: "agent.start",
368
- SubagentStop: "agent.stop",
369
- Stop: "turn.end"
370
- };
371
- var SHELL_TOOL = "Bash";
372
- var PATCH_TOOL = "apply_patch";
373
- var BLOCK_EVENTS = /* @__PURE__ */ new Set(["turn.end", "agent.stop"]);
374
- function isRecord2(v) {
375
- return typeof v === "object" && v !== null && !Array.isArray(v);
376
- }
377
- function str(v) {
378
- return typeof v === "string" ? v : void 0;
379
- }
380
- var PATCH_PATH_RE = /^\*\*\* (?:Add File|Update File|Delete File|Move to): (.+)$/;
381
- function patchPaths(patch) {
382
- const out = [];
383
- for (const line of patch.split("\n")) {
384
- const m = PATCH_PATH_RE.exec(line.trimEnd());
385
- const path = m?.[1]?.trim();
386
- if (path !== void 0 && path.length > 0 && !out.includes(path)) out.push(path);
387
- }
388
- return out;
389
- }
390
- function canonicalTool(name, input) {
391
- if (name === SHELL_TOOL) return { name, kind: "shell", command: str(input.command) ?? "" };
392
- if (name === PATCH_TOOL)
393
- return { name, kind: "edit", paths: patchPaths(str(input.command) ?? "") };
394
- return { name, kind: "other" };
395
- }
396
- function decode(raw) {
397
- if (!isRecord2(raw)) return null;
398
- const native = str(raw.hook_event_name);
399
- if (native === void 0) return null;
400
- const event = NATIVE_TO_EVENT[native];
401
- if (event === void 0) return null;
402
- const session = str(raw.session_id);
403
- if (session === void 0 || session.length === 0) return null;
404
- const input = {
405
- harness: "codex",
406
- event,
407
- native: { event: native },
408
- session,
409
- cwd: str(raw.cwd) ?? "",
410
- raw
411
- };
412
- if (raw.agent_id !== void 0 && raw.agent_id !== null) {
413
- const id = raw.agent_id;
414
- if (typeof id !== "string" || !AGENT_ID_RE.test(id)) return null;
415
- input.agent = id;
416
- }
417
- const turn = str(raw.turn_id);
418
- if (turn !== void 0) input.turn = turn;
419
- const prompt = str(raw.prompt);
420
- if (prompt !== void 0) input.prompt = prompt;
421
- const agentType = str(raw.agent_type);
422
- if (agentType !== void 0) input.agentType = agentType;
423
- const lastMessage = str(raw.last_assistant_message);
424
- if (lastMessage !== void 0) input.lastMessage = lastMessage;
425
- if (typeof raw.stop_hook_active === "boolean") input.stopFuse = raw.stop_hook_active;
426
- const source = str(raw.source);
427
- if (source !== void 0) input.source = source;
428
- const path = str(raw.transcript_path);
429
- const agentPath = str(raw.agent_transcript_path);
430
- if (path !== void 0 || agentPath !== void 0) {
431
- input.transcript = {};
432
- if (path !== void 0) input.transcript.path = path;
433
- if (agentPath !== void 0) input.transcript.agentPath = agentPath;
434
- }
435
- if (event === "tool.before" || event === "tool.after") {
436
- const name = str(raw.tool_name) ?? "";
437
- const tool = canonicalTool(name, isRecord2(raw.tool_input) ? raw.tool_input : {});
438
- const callId = str(raw.tool_use_id);
439
- if (callId !== void 0) tool.callId = callId;
440
- if (event === "tool.after") {
441
- const text = str(raw.tool_response);
442
- if (text !== void 0) tool.result = { text };
443
- if (tool.kind === "shell" && text !== void 0 && hasErrorMarker(text)) tool.ok = false;
444
- }
445
- input.tool = tool;
446
- }
447
- return input;
448
- }
449
- function encode(emit, input) {
450
- if (emit === null || emit.context === void 0 || emit.context.length === 0) return null;
451
- const text = emit.context.slice(0, CONTEXT_MAX);
452
- if (BLOCK_EVENTS.has(input.event)) return { decision: "block", reason: text };
453
- return { hookSpecificOutput: { hookEventName: input.native.event, additionalContext: text } };
454
- }
455
- function codexHome(home, env = process.env) {
456
- const override = env.CODEX_HOME;
457
- return override !== void 0 && override.length > 0 ? override : join2(home, ".codex");
458
- }
459
- function commandHandler(shimPath, timeoutSeconds) {
460
- return {
461
- type: "command",
462
- command: `node ${JSON.stringify(shimPath)} --harness codex`,
463
- timeout: timeoutSeconds
464
- };
465
- }
466
- var registrar = {
467
- configPath(home, env) {
468
- return join2(codexHome(home, env), "hooks.json");
469
- },
470
- /**
471
- * Seven `command` entries, every one through the shim: a Codex handler
472
- * carries no URL or token, so the daemon is ensured on each fire and the
473
- * entry holds nothing worth protecting. The matchers are the two hooked
474
- * tool names the arms read; a child's fires arrive through the same entries.
475
- */
476
- plan({ shimPath, timeoutSeconds }) {
477
- const command = [commandHandler(shimPath, timeoutSeconds)];
478
- return [
479
- { event: "SessionStart", hooks: command },
480
- { event: "UserPromptSubmit", hooks: command },
481
- { event: "PreToolUse", matcher: `${SHELL_TOOL}|${PATCH_TOOL}`, hooks: command },
482
- { event: "PostToolUse", matcher: SHELL_TOOL, hooks: command },
483
- { event: "SubagentStart", hooks: command },
484
- { event: "SubagentStop", hooks: command },
485
- { event: "Stop", hooks: command }
486
- ];
487
- },
488
- /**
489
- * Codex reads hooks once, at session start. `install` now trusts the entries
490
- * it writes through Codex's own supported path (lib/codex-trust.ts), so the
491
- * `/hooks` walkthrough this used to carry is gone; what is left is the one
492
- * fact no installer can change, which is that the session already open still
493
- * has the hook set it started with (tenjin-agent#343).
494
- */
495
- activation() {
496
- return ["Start a new Codex session: hooks are read at session start."];
497
- },
498
- grant: {
499
- path: codexRulesPath,
500
- inspect: inspectCodexGrant,
501
- write: wireCodexGrant,
502
- remove: removeCodexGrant
503
- },
504
- trust: {
505
- ensure: trustCodexHooks,
506
- read: readCodexTrust
507
- }
508
- };
509
- var codexAdapter = { id: "codex", decode, encode, registrar };
51
+ loadProjectConfig
52
+ } from "./chunk-AV5NZMYO.js";
53
+ import {
54
+ parseUsdToAtomic,
55
+ toMoney
56
+ } from "./chunk-Y527D4TV.js";
57
+ import {
58
+ hasCode
59
+ } from "./chunk-2I4QTOLB.js";
60
+ import {
61
+ CONFIG_KEYS,
62
+ DEFAULT_MAX_AUTO_SPEND,
63
+ DEFAULT_SESSION_BUDGET,
64
+ EXPERIMENTAL_CONFIG_KEYS,
65
+ HARNESSES,
66
+ HOOKS_CONFIG_KEYS,
67
+ LOOP_CONFIG_KEYS,
68
+ MAX_AUTO_SPEND_FLOOR_ATOMIC,
69
+ MAX_AUTO_SPEND_FLOOR_WHY,
70
+ PUBLISH_CONFIG_KEYS,
71
+ PublishModeSchema,
72
+ RETIRED_PAYMENT_GUIDANCE,
73
+ ROUTER_CONFIG_KEYS,
74
+ ROUTER_CONTEXTS,
75
+ RawConfigSchema,
76
+ SEND_MAX_UNSET,
77
+ TEAM_CONFIG_KEYS,
78
+ UPDATE_CONFIG_KEYS,
79
+ loadRawConfig,
80
+ parseAckServerWarnings,
81
+ parseLoopValue,
82
+ parsePublicFallbackFlag,
83
+ parseUpdateModeFlag,
84
+ resolveSettings,
85
+ retiredPaymentKeys
86
+ } from "./chunk-2GNOFONN.js";
87
+ import {
88
+ PRODUCTION_ORIGIN,
89
+ isSameDeployment
90
+ } from "./chunk-XQJXNMSB.js";
91
+ import {
92
+ writeFileAtomic
93
+ } from "./chunk-7WEQQJLG.js";
94
+ import {
95
+ CliError
96
+ } from "./chunk-3UCIG4TG.js";
97
+ import {
98
+ configPath,
99
+ hooksDir
100
+ } from "./chunk-OJNTCYQQ.js";
101
+
102
+ // src/commands/config.ts
103
+ import { mkdir as mkdir2 } from "node:fs/promises";
104
+ import { homedir } from "node:os";
105
+ import { dirname as dirname3 } from "node:path";
106
+
107
+ // src/lib/harness-permissions.ts
108
+ import { chmod, lstat, mkdir, readFile, realpath, stat as stat2 } from "node:fs/promises";
109
+ import { dirname, join as join2 } from "node:path";
510
110
 
511
111
  // src/lib/codex-rules.ts
112
+ import { execFile } from "node:child_process";
113
+ import { rm, stat } from "node:fs/promises";
114
+ import { join } from "node:path";
512
115
  function codexRulesPath(home, env = process.env) {
513
- return join3(codexHome(home, env), "rules", "tenjin.rules");
116
+ return join(codexHome(home, env), "rules", "tenjin.rules");
514
117
  }
515
118
  function prefixTokens(rule) {
516
119
  const m = /^Bash\(tenjin ((?:[a-z][a-z-]* )*[a-z][a-z-]*):\*\)$/.exec(rule);
@@ -569,7 +172,7 @@ async function removeCodexGrant(home, env = process.env) {
569
172
 
570
173
  // src/lib/harness-permissions.ts
571
174
  function claudeSettingsPath(homeDir) {
572
- return join4(homeDir, ".claude", "settings.json");
175
+ return join2(homeDir, ".claude", "settings.json");
573
176
  }
574
177
  async function inspectClaudeGrant(homeDir, mode) {
575
178
  const found = await inspectAllowlist(homeDir, mode);
@@ -948,10 +551,10 @@ async function inspectAllowlistAt(declaredPath, rules, list = "allow") {
948
551
  // src/lib/skill-wiring.ts
949
552
  import { existsSync, statSync } from "node:fs";
950
553
  import { constants, open } from "node:fs/promises";
951
- import { delimiter, join as join6 } from "node:path";
554
+ import { delimiter, join as join4 } from "node:path";
952
555
 
953
556
  // src/lib/skills-source.ts
954
- import { dirname as dirname2, join as join5 } from "node:path";
557
+ import { dirname as dirname2, join as join3 } from "node:path";
955
558
  var SKILL_NAMES = ["tenjin-search", "tenjin-publish", "tenjin"];
956
559
  var RETIRED_SKILL_NAMES = ["tenjin-pay"];
957
560
  var PACKAGED_SKILL_NAMES = [...SKILL_NAMES];
@@ -961,7 +564,7 @@ var SHIPPED_SKILL_FILES = {
961
564
  tenjin: ["SKILL.md"],
962
565
  "tenjin-pay": ["SKILL.md"]
963
566
  };
964
- var SENTINEL = join5("tenjin", "SKILL.md");
567
+ var SENTINEL = join3("tenjin", "SKILL.md");
965
568
 
966
569
  // src/lib/skill-wiring.ts
967
570
  var CLI_SKILL_NAMES = [
@@ -969,19 +572,19 @@ var CLI_SKILL_NAMES = [
969
572
  "tenjin-publish"
970
573
  ];
971
574
  function skillsDirsFor(home) {
972
- return [join6(home, ".claude", "skills"), join6(home, ".agents", "skills")];
575
+ return [join4(home, ".claude", "skills"), join4(home, ".agents", "skills")];
973
576
  }
974
577
  function harnessTargetDir(home, harness) {
975
- if (harness === "claude") return join6(home, ".claude", "skills");
976
- return join6(home, ".agents", "skills");
578
+ if (harness === "claude") return join4(home, ".claude", "skills");
579
+ return join4(home, ".agents", "skills");
977
580
  }
978
581
  function harnessFlagFor(home, dir) {
979
- if (dir === join6(home, ".claude", "skills")) return "claude";
582
+ if (dir === join4(home, ".claude", "skills")) return "claude";
980
583
  return "codex";
981
584
  }
982
585
  function harnessDetectedBy(home, harness, which) {
983
586
  const reasons = [];
984
- if (existsSync(join6(home, `.${harness}`))) reasons.push("home-dir");
587
+ if (existsSync(join4(home, `.${harness}`))) reasons.push("home-dir");
985
588
  if (which(harness)) reasons.push("binary");
986
589
  return reasons;
987
590
  }
@@ -1008,7 +611,7 @@ function onPath(bin, env) {
1008
611
  for (const part of raw.split(delimiter)) {
1009
612
  if (part.length === 0) continue;
1010
613
  for (const ext of exts) {
1011
- if (isFile(join6(part, bin + ext))) return true;
614
+ if (isFile(join4(part, bin + ext))) return true;
1012
615
  }
1013
616
  }
1014
617
  return false;
@@ -1056,7 +659,7 @@ function extractFrontmatter(text) {
1056
659
  }
1057
660
 
1058
661
  // src/adapters/claude.ts
1059
- var NATIVE_TO_EVENT2 = {
662
+ var NATIVE_TO_EVENT = {
1060
663
  SessionStart: "session.start",
1061
664
  UserPromptSubmit: "prompt",
1062
665
  PreToolUse: "tool.before",
@@ -1078,73 +681,73 @@ function matcherOf(re) {
1078
681
  return re.source.replace(/^\^\(?/, "").replace(/\)?\$$/, "");
1079
682
  }
1080
683
  var SESSION_START_MATCHER = "startup|clear|compact";
1081
- function isRecord3(v) {
684
+ function isRecord(v) {
1082
685
  return typeof v === "object" && v !== null && !Array.isArray(v);
1083
686
  }
1084
- function str2(v) {
687
+ function str(v) {
1085
688
  return typeof v === "string" ? v : void 0;
1086
689
  }
1087
690
  function toolKind(name) {
1088
691
  for (const kind of Object.keys(TOOLS)) if (TOOLS[kind].test(name)) return kind;
1089
692
  return "other";
1090
693
  }
1091
- function canonicalTool2(name, input) {
694
+ function canonicalTool(name, input) {
1092
695
  const kind = toolKind(name);
1093
696
  switch (kind) {
1094
697
  case "shell":
1095
- return { name, kind, command: str2(input.command) ?? "" };
698
+ return { name, kind, command: str(input.command) ?? "" };
1096
699
  case "edit":
1097
700
  case "read": {
1098
- const path = str2(input.file_path);
701
+ const path = str(input.file_path);
1099
702
  return { name, kind, paths: path === void 0 ? [] : [path] };
1100
703
  }
1101
704
  case "dispatch": {
1102
- const description = str2(input.description);
705
+ const description = str(input.description);
1103
706
  return {
1104
707
  name,
1105
708
  kind,
1106
- task: str2(input.prompt) ?? "",
709
+ task: str(input.prompt) ?? "",
1107
710
  ...description !== void 0 ? { description } : {}
1108
711
  };
1109
712
  }
1110
713
  case "web":
1111
- return { name, kind, query: str2(input.query) ?? "" };
714
+ return { name, kind, query: str(input.query) ?? "" };
1112
715
  case "fetch":
1113
- return { name, kind, url: str2(input.url) ?? "", prompt: str2(input.prompt) ?? "" };
716
+ return { name, kind, url: str(input.url) ?? "", prompt: str(input.prompt) ?? "" };
1114
717
  default:
1115
718
  return { name, kind };
1116
719
  }
1117
720
  }
1118
721
  function toolResult(v) {
1119
722
  if (typeof v === "string") return { text: v };
1120
- if (!isRecord3(v)) return void 0;
723
+ if (!isRecord(v)) return void 0;
1121
724
  const out = {};
1122
- const stdout = str2(v.stdout);
1123
- const stderr = str2(v.stderr);
1124
- const error = str2(v.error);
725
+ const stdout = str(v.stdout);
726
+ const stderr = str(v.stderr);
727
+ const error = str(v.error);
1125
728
  if (stdout !== void 0) out.stdout = stdout;
1126
729
  if (stderr !== void 0) out.stderr = stderr;
1127
730
  if (error !== void 0) out.error = error;
1128
731
  if (stdout === void 0 && stderr === void 0 && error === void 0) {
1129
- const text = str2(v.text) ?? str2(v.content) ?? str2(v.result);
732
+ const text = str(v.text) ?? str(v.content) ?? str(v.result);
1130
733
  if (text !== void 0) out.text = text;
1131
734
  }
1132
735
  return out;
1133
736
  }
1134
737
  function decode2(raw) {
1135
- if (!isRecord3(raw)) return null;
1136
- const native = str2(raw.hook_event_name);
738
+ if (!isRecord(raw)) return null;
739
+ const native = str(raw.hook_event_name);
1137
740
  if (native === void 0) return null;
1138
- const event = NATIVE_TO_EVENT2[native];
741
+ const event = NATIVE_TO_EVENT[native];
1139
742
  if (event === void 0) return null;
1140
- const session = str2(raw.session_id);
743
+ const session = str(raw.session_id);
1141
744
  if (session === void 0 || session.length === 0) return null;
1142
745
  const input = {
1143
746
  harness: "claude",
1144
747
  event,
1145
748
  native: { event: native },
1146
749
  session,
1147
- cwd: str2(raw.cwd) ?? "",
750
+ cwd: str(raw.cwd) ?? "",
1148
751
  raw
1149
752
  };
1150
753
  if (raw.agent_id !== void 0 && raw.agent_id !== null) {
@@ -1152,28 +755,28 @@ function decode2(raw) {
1152
755
  if (typeof id !== "string" || !AGENT_ID_RE.test(id)) return null;
1153
756
  input.agent = id;
1154
757
  }
1155
- const turn = str2(raw.prompt_id);
758
+ const turn = str(raw.prompt_id);
1156
759
  if (turn !== void 0) input.turn = turn;
1157
- const prompt = str2(raw.prompt);
760
+ const prompt = str(raw.prompt);
1158
761
  if (prompt !== void 0) input.prompt = prompt;
1159
- const agentType = str2(raw.agent_type);
762
+ const agentType = str(raw.agent_type);
1160
763
  if (agentType !== void 0) input.agentType = agentType;
1161
- const lastMessage = str2(raw.last_assistant_message);
764
+ const lastMessage = str(raw.last_assistant_message);
1162
765
  if (lastMessage !== void 0) input.lastMessage = lastMessage;
1163
766
  if (typeof raw.stop_hook_active === "boolean") input.stopFuse = raw.stop_hook_active;
1164
- const source = str2(raw.source);
767
+ const source = str(raw.source);
1165
768
  if (source !== void 0) input.source = source;
1166
- const path = str2(raw.transcript_path);
1167
- const agentPath = str2(raw.agent_transcript_path);
769
+ const path = str(raw.transcript_path);
770
+ const agentPath = str(raw.agent_transcript_path);
1168
771
  if (path !== void 0 || agentPath !== void 0) {
1169
772
  input.transcript = {};
1170
773
  if (path !== void 0) input.transcript.path = path;
1171
774
  if (agentPath !== void 0) input.transcript.agentPath = agentPath;
1172
775
  }
1173
776
  if (event === "tool.before" || event === "tool.after") {
1174
- const name = str2(raw.tool_name) ?? "";
1175
- const tool = canonicalTool2(name, isRecord3(raw.tool_input) ? raw.tool_input : {});
1176
- const callId = str2(raw.tool_use_id);
777
+ const name = str(raw.tool_name) ?? "";
778
+ const tool = canonicalTool(name, isRecord(raw.tool_input) ? raw.tool_input : {});
779
+ const callId = str(raw.tool_use_id);
1177
780
  if (callId !== void 0) tool.callId = callId;
1178
781
  if (event === "tool.after") {
1179
782
  if (native === "PostToolUseFailure") {
@@ -1211,14 +814,14 @@ function httpHandler(url, token, timeoutSeconds) {
1211
814
  timeout: timeoutSeconds
1212
815
  };
1213
816
  }
1214
- function commandHandler2(shimPath, timeoutSeconds) {
817
+ function commandHandler(shimPath, timeoutSeconds) {
1215
818
  return {
1216
819
  type: "command",
1217
820
  command: `node ${JSON.stringify(shimPath)} --harness claude`,
1218
821
  timeout: timeoutSeconds
1219
822
  };
1220
823
  }
1221
- var registrar2 = {
824
+ var registrar = {
1222
825
  configPath(home) {
1223
826
  return claudeSettingsPath(home);
1224
827
  },
@@ -1229,7 +832,7 @@ var registrar2 = {
1229
832
  */
1230
833
  plan({ url, token, shimPath, timeoutSeconds }) {
1231
834
  const http = [httpHandler(url, token, timeoutSeconds)];
1232
- const command = [commandHandler2(shimPath, timeoutSeconds)];
835
+ const command = [commandHandler(shimPath, timeoutSeconds)];
1233
836
  return [
1234
837
  { event: "SessionStart", matcher: SESSION_START_MATCHER, hooks: command },
1235
838
  { event: "UserPromptSubmit", hooks: command },
@@ -1261,7 +864,211 @@ var registrar2 = {
1261
864
  write: wireFreeVerbAllowlist
1262
865
  }
1263
866
  };
1264
- var claudeAdapter = { id: "claude", decode: decode2, encode: encode2, registrar: registrar2 };
867
+ var claudeAdapter = { id: "claude", decode: decode2, encode: encode2, registrar };
868
+
869
+ // src/adapters/codex.ts
870
+ import { join as join6 } from "node:path";
871
+
872
+ // src/lib/codex-trust.ts
873
+ import { join as join5 } from "node:path";
874
+ var EVENT_LABEL = {
875
+ PreToolUse: "pre_tool_use",
876
+ PermissionRequest: "permission_request",
877
+ PostToolUse: "post_tool_use",
878
+ PreCompact: "pre_compact",
879
+ PostCompact: "post_compact",
880
+ SessionStart: "session_start",
881
+ SessionEnd: "session_end",
882
+ UserPromptSubmit: "user_prompt_submit",
883
+ SubagentStart: "subagent_start",
884
+ SubagentStop: "subagent_stop",
885
+ Stop: "stop",
886
+ Interrupt: "interrupt"
887
+ };
888
+ function codexConfigPath(home, env = process.env) {
889
+ return join5(codexHome(home, env), "config.toml");
890
+ }
891
+ function isRecord2(v) {
892
+ return typeof v === "object" && v !== null && !Array.isArray(v);
893
+ }
894
+ function foldTrust(rows, keys) {
895
+ const wanted = new Set(keys);
896
+ const mine = rows.filter((r) => typeof r.key === "string" && wanted.has(r.key));
897
+ if (mine.length === 0) return "untrusted";
898
+ const status = (r) => typeof r.trustStatus === "string" ? r.trustStatus : "unknown";
899
+ if (mine.some((r) => r.enabled === false)) return "disabled";
900
+ if (mine.some((r) => status(r) === "modified")) return "modified";
901
+ const good = mine.filter((r) => status(r) === "trusted" || status(r) === "managed");
902
+ if (good.length === 0) return "untrusted";
903
+ if (good.length < keys.length) return "partial";
904
+ return "trusted";
905
+ }
906
+ var PROBE_MS = 8e3;
907
+ async function listHooksViaAppServer(home, env, timeoutMs) {
908
+ return await withAppServer(home, env, timeoutMs, async (request) => {
909
+ const result = await request("hooks/list", { cwds: [] });
910
+ return result === void 0 ? null : rowsOf(result);
911
+ });
912
+ }
913
+ function rowsOf(result) {
914
+ if (!isRecord2(result) || !Array.isArray(result.data)) return [];
915
+ const out = [];
916
+ for (const group of result.data) {
917
+ if (!isRecord2(group) || !Array.isArray(group.hooks)) continue;
918
+ for (const hook of group.hooks) if (isRecord2(hook)) out.push(hook);
919
+ }
920
+ return out;
921
+ }
922
+ async function trustCodexHooks(home, keys, ownedBy, opts = {}) {
923
+ const env = opts.env ?? process.env;
924
+ const timeoutMs = opts.timeoutMs ?? PROBE_MS;
925
+ if (keys.length === 0) return { ok: true, trusted: [] };
926
+ const run = async (request) => {
927
+ const before = await request("hooks/list", { cwds: [] });
928
+ if (before === void 0) {
929
+ return {
930
+ ok: false,
931
+ trusted: [],
932
+ failedAt: "list",
933
+ reason: "hooks/list did not answer"
934
+ };
935
+ }
936
+ const wanted = new Set(keys);
937
+ const mine = rowsOf(before).filter(
938
+ (r) => typeof r.key === "string" && wanted.has(r.key) && ownedBy(r)
939
+ );
940
+ if (mine.length !== keys.length) {
941
+ return {
942
+ ok: false,
943
+ trusted: [],
944
+ failedAt: "list",
945
+ reason: `Codex listed ${mine.length} of the ${keys.length} entries this install wrote`
946
+ };
947
+ }
948
+ const value = {};
949
+ for (const row of mine) {
950
+ const hash = typeof row.currentHash === "string" ? row.currentHash : null;
951
+ if (hash === null) {
952
+ return {
953
+ ok: false,
954
+ trusted: [],
955
+ failedAt: "list",
956
+ reason: "Codex reported an entry with no currentHash"
957
+ };
958
+ }
959
+ value[row.key] = { trusted_hash: hash, enabled: true };
960
+ }
961
+ const wrote = await request("config/batchWrite", {
962
+ edits: [{ keyPath: "hooks.state", value, mergeStrategy: "upsert" }],
963
+ reloadUserConfig: true
964
+ });
965
+ if (wrote === void 0) {
966
+ return {
967
+ ok: false,
968
+ trusted: [],
969
+ failedAt: "write",
970
+ reason: "config/batchWrite was refused"
971
+ };
972
+ }
973
+ const after = await request("hooks/list", { cwds: [] });
974
+ if (after === void 0) {
975
+ return {
976
+ ok: false,
977
+ trusted: [],
978
+ failedAt: "verify",
979
+ reason: "the verifying hooks/list did not answer"
980
+ };
981
+ }
982
+ const confirmed = rowsOf(after).filter(
983
+ (r) => typeof r.key === "string" && wanted.has(r.key) && ownedBy(r) && r.enabled !== false && (r.trustStatus === "trusted" || r.trustStatus === "managed") && r.currentHash === value[r.key]?.trusted_hash
984
+ );
985
+ if (confirmed.length !== keys.length) {
986
+ return {
987
+ ok: false,
988
+ trusted: confirmed.map((r) => r.key),
989
+ failedAt: "verify",
990
+ reason: `Codex confirmed ${confirmed.length} of ${keys.length} entries as trusted after the write`
991
+ };
992
+ }
993
+ return { ok: true, trusted: confirmed.map((r) => r.key) };
994
+ };
995
+ const outcome = opts.connect !== void 0 ? await run(opts.connect) : await withAppServer(home, env, timeoutMs, run);
996
+ return outcome ?? {
997
+ ok: false,
998
+ trusted: [],
999
+ failedAt: "list",
1000
+ reason: "the codex app server could not be reached"
1001
+ };
1002
+ }
1003
+ async function readCodexTrust(home, keys, opts = {}) {
1004
+ const env = opts.env ?? process.env;
1005
+ const configPath2 = codexConfigPath(home, env);
1006
+ const base = { configPath: configPath2, trusted: 0, expected: keys.length };
1007
+ if (keys.length === 0) return { ...base, state: "unknown", source: "none" };
1008
+ const list = await (opts.listHooks ?? ((h, e) => listHooksViaAppServer(h, e, opts.timeoutMs ?? PROBE_MS)))(home, env);
1009
+ if (list !== null) {
1010
+ const state = foldTrust(list, keys);
1011
+ const wanted = new Set(keys);
1012
+ const trusted = list.filter(
1013
+ (r) => typeof r.key === "string" && wanted.has(r.key) && (r.trustStatus === "trusted" || r.trustStatus === "managed")
1014
+ ).length;
1015
+ return { ...base, trusted, state, source: "app-server" };
1016
+ }
1017
+ return { ...base, state: "unknown", source: "none" };
1018
+ }
1019
+
1020
+ // src/adapters/codex.ts
1021
+ function commandHandler2(shimPath, timeoutSeconds) {
1022
+ return {
1023
+ type: "command",
1024
+ command: `node ${JSON.stringify(shimPath)} --harness codex`,
1025
+ timeout: timeoutSeconds
1026
+ };
1027
+ }
1028
+ var registrar2 = {
1029
+ configPath(home, env) {
1030
+ return join6(codexHome(home, env), "hooks.json");
1031
+ },
1032
+ /**
1033
+ * Seven `command` entries, every one through the shim: a Codex handler
1034
+ * carries no URL or token, so the daemon is ensured on each fire and the
1035
+ * entry holds nothing worth protecting. The matchers are the two hooked
1036
+ * tool names the arms read; a child's fires arrive through the same entries.
1037
+ */
1038
+ plan({ shimPath, timeoutSeconds }) {
1039
+ const command = [commandHandler2(shimPath, timeoutSeconds)];
1040
+ return [
1041
+ { event: "SessionStart", hooks: command },
1042
+ { event: "UserPromptSubmit", hooks: command },
1043
+ { event: "PreToolUse", matcher: `${SHELL_TOOL}|${PATCH_TOOL}`, hooks: command },
1044
+ { event: "PostToolUse", matcher: SHELL_TOOL, hooks: command },
1045
+ { event: "SubagentStart", hooks: command },
1046
+ { event: "SubagentStop", hooks: command },
1047
+ { event: "Stop", hooks: command }
1048
+ ];
1049
+ },
1050
+ /**
1051
+ * Codex reads hooks once, at session start. `install` now trusts the entries
1052
+ * it writes through Codex's own supported path (lib/codex-trust.ts), so the
1053
+ * `/hooks` walkthrough this used to carry is gone; what is left is the one
1054
+ * fact no installer can change, which is that the session already open still
1055
+ * has the hook set it started with (tenjin-agent#343).
1056
+ */
1057
+ activation() {
1058
+ return ["Start a new Codex session: hooks are read at session start."];
1059
+ },
1060
+ grant: {
1061
+ path: codexRulesPath,
1062
+ inspect: inspectCodexGrant,
1063
+ write: wireCodexGrant,
1064
+ remove: removeCodexGrant
1065
+ },
1066
+ trust: {
1067
+ ensure: trustCodexHooks,
1068
+ read: readCodexTrust
1069
+ }
1070
+ };
1071
+ var codexAdapter = { id: "codex", decode, encode, registrar: registrar2 };
1265
1072
 
1266
1073
  // src/adapters/registry.ts
1267
1074
  var ADAPTERS = {
@@ -1504,7 +1311,7 @@ var KEY_DESCRIPTIONS = {
1504
1311
  "hooks.failure": "answer a failing command with the fix this machine or a shelf already has",
1505
1312
  "hooks.publish": "the turn-end ask to publish what this turn settled, spoken to you and to each subagent at its own end",
1506
1313
  "hooks.primer": "one-paragraph search-first primer at session start",
1507
- "update.mode": "nudge=report a newer version (stderr line, JSON envelope, hook output), off=neither report nor ask npm",
1314
+ "update.mode": "auto=update in the background where Tenjin's runtime is set up (else as nudge), nudge=report a newer version (stderr line, JSON envelope, hook output), off=neither report nor ask npm",
1508
1315
  "loop.human_wait_ms": "ms a hook fire may take when a human is waiting on it (prompt, Stop, SessionStart)",
1509
1316
  "loop.tool_wait_ms": "ms a hook fire may take when a tool call is waiting on it",
1510
1317
  "loop.idle_exit_min": "minutes without a hook fire before the loop daemon exits",
@@ -2205,6 +2012,9 @@ export {
2205
2012
  skillsDirsFor,
2206
2013
  readSkillFile,
2207
2014
  skillFrontmatterName,
2015
+ EVENT_LABEL,
2016
+ rowsOf,
2017
+ trustCodexHooks,
2208
2018
  inspectHooksFile,
2209
2019
  ROUTER_DEFAULTS,
2210
2020
  shownLimits,
@@ -2224,4 +2034,4 @@ export {
2224
2034
  persistInstallHarness,
2225
2035
  persistGrantDeclined
2226
2036
  };
2227
- //# sourceMappingURL=chunk-3O2BQIF6.js.map
2037
+ //# sourceMappingURL=chunk-AD226HDR.js.map