tenjin-cli 0.1.0-alpha.33 → 0.1.0-alpha.35

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 (495) hide show
  1. package/NOTICE.md +110 -0
  2. package/README.md +87 -81
  3. package/dist/{_esm-BIN7VY2L.js → _esm-2KST7HQ7.js} +7 -7
  4. package/dist/alive-5TV22PNF.js +51 -0
  5. package/dist/auth-XI7BJFLW.js +47 -0
  6. package/dist/{auto-update-Y24UL56V.js → auto-update-7L24KDWA.js} +4 -5
  7. package/dist/balance-DFHC6XEU.js +71 -0
  8. package/dist/{ccip-DHDFKTQV.js → ccip-HOW3DZYF.js} +4 -4
  9. package/dist/chunk-24XKUN2S.js +202 -0
  10. package/dist/chunk-24XKUN2S.js.map +1 -0
  11. package/dist/chunk-2L7TDGLV.js +56 -0
  12. package/dist/chunk-2L7TDGLV.js.map +1 -0
  13. package/dist/{chunk-C2Q76BVM.js → chunk-2U7H35IP.js} +29 -7
  14. package/dist/chunk-2U7H35IP.js.map +1 -0
  15. package/dist/chunk-2W4DQQUU.js +176 -0
  16. package/dist/chunk-2W4DQQUU.js.map +1 -0
  17. package/dist/{chunk-LRW6S53P.js → chunk-34SAECKZ.js} +35 -11
  18. package/dist/chunk-34SAECKZ.js.map +1 -0
  19. package/dist/{chunk-2I4QTOLB.js → chunk-3MZ7DYRO.js} +1 -1
  20. package/dist/chunk-3MZ7DYRO.js.map +1 -0
  21. package/dist/{chunk-RVPYTUP4.js → chunk-3Y2EHT4F.js} +13 -9
  22. package/dist/chunk-3Y2EHT4F.js.map +1 -0
  23. package/dist/chunk-3Y6BHIN6.js +169 -0
  24. package/dist/chunk-3Y6BHIN6.js.map +1 -0
  25. package/dist/{chunk-4K7TQHNP.js → chunk-3YPL6T3P.js} +17 -33
  26. package/dist/chunk-3YPL6T3P.js.map +1 -0
  27. package/dist/{chunk-E7SW44LM.js → chunk-44MVIRZH.js} +121 -6
  28. package/dist/chunk-44MVIRZH.js.map +1 -0
  29. package/dist/chunk-45MMSBHA.js +321 -0
  30. package/dist/chunk-45MMSBHA.js.map +1 -0
  31. package/dist/{chunk-3FMZGI7I.js → chunk-4CE6TMI5.js} +1 -1
  32. package/dist/chunk-4CE6TMI5.js.map +1 -0
  33. package/dist/{chunk-QXP3Z3JN.js → chunk-4MBCJFY4.js} +35 -3
  34. package/dist/chunk-4MBCJFY4.js.map +1 -0
  35. package/dist/chunk-4TPL54KW.js +227 -0
  36. package/dist/chunk-4TPL54KW.js.map +1 -0
  37. package/dist/chunk-54ELBTKE.js +1615 -0
  38. package/dist/chunk-54ELBTKE.js.map +1 -0
  39. package/dist/{chunk-NDGZDTSJ.js → chunk-5F4OB5B3.js} +115 -57
  40. package/dist/chunk-5F4OB5B3.js.map +1 -0
  41. package/dist/chunk-5HN4KVQU.js +3348 -0
  42. package/dist/chunk-5HN4KVQU.js.map +1 -0
  43. package/dist/{chunk-ZDZERB6L.js → chunk-5J4E5GYI.js} +572 -407
  44. package/dist/chunk-5J4E5GYI.js.map +1 -0
  45. package/dist/{chunk-ZNNXRNFD.js → chunk-5N4GGUBN.js} +48 -6
  46. package/dist/chunk-5N4GGUBN.js.map +1 -0
  47. package/dist/chunk-5USBZ2MU.js +58 -0
  48. package/dist/chunk-5USBZ2MU.js.map +1 -0
  49. package/dist/chunk-64WOMNYR.js +183 -0
  50. package/dist/chunk-64WOMNYR.js.map +1 -0
  51. package/dist/{chunk-ILNIZ5I2.js → chunk-65RS4LQS.js} +1825 -1715
  52. package/dist/chunk-65RS4LQS.js.map +1 -0
  53. package/dist/{chunk-IE7P2BZE.js → chunk-6QMDUDF2.js} +3 -3
  54. package/dist/{chunk-IADZOXKN.js → chunk-7SLOTLO7.js} +19 -697
  55. package/dist/chunk-7SLOTLO7.js.map +1 -0
  56. package/dist/{chunk-WFSPCCVW.js → chunk-7V25UAQO.js} +99 -99
  57. package/dist/{chunk-WFSPCCVW.js.map → chunk-7V25UAQO.js.map} +1 -1
  58. package/dist/chunk-BGA4DO5M.js +719 -0
  59. package/dist/chunk-BGA4DO5M.js.map +1 -0
  60. package/dist/chunk-BVP7YK2J.js +706 -0
  61. package/dist/chunk-BVP7YK2J.js.map +1 -0
  62. package/dist/chunk-C265QIMJ.js +83 -0
  63. package/dist/chunk-C265QIMJ.js.map +1 -0
  64. package/dist/{chunk-XQJXNMSB.js → chunk-CRG54LEB.js} +1 -1
  65. package/dist/chunk-CRG54LEB.js.map +1 -0
  66. package/dist/{chunk-KG3D7FIF.js → chunk-CZJOMUBP.js} +2 -2
  67. package/dist/{chunk-36RVGZNY.js → chunk-D6M3ZK66.js} +22 -39
  68. package/dist/chunk-D6M3ZK66.js.map +1 -0
  69. package/dist/{chunk-3UCIG4TG.js → chunk-DI4QAGRZ.js} +1 -11
  70. package/dist/chunk-DI4QAGRZ.js.map +1 -0
  71. package/dist/{chunk-JKKAIPTU.js → chunk-DIH2G3YG.js} +47 -10
  72. package/dist/chunk-DIH2G3YG.js.map +1 -0
  73. package/dist/chunk-DJ36BM62.js +78 -0
  74. package/dist/chunk-DJ36BM62.js.map +1 -0
  75. package/dist/chunk-DTEWAVNE.js +114 -0
  76. package/dist/chunk-DTEWAVNE.js.map +1 -0
  77. package/dist/chunk-F2KJAJ7T.js +13 -0
  78. package/dist/chunk-F2KJAJ7T.js.map +1 -0
  79. package/dist/{chunk-BF4XHEQK.js → chunk-F3QPGYOY.js} +6 -6
  80. package/dist/chunk-F3QPGYOY.js.map +1 -0
  81. package/dist/{chunk-3GNJXKIT.js → chunk-F43CV6UC.js} +2 -2
  82. package/dist/{chunk-J57UC3DD.js → chunk-FKVJKLPI.js} +3 -3
  83. package/dist/{chunk-V2LQLN5H.js → chunk-FYFHH7V5.js} +59 -8
  84. package/dist/{chunk-V2LQLN5H.js.map → chunk-FYFHH7V5.js.map} +1 -1
  85. package/dist/chunk-GAJC4BQZ.js +1096 -0
  86. package/dist/chunk-GAJC4BQZ.js.map +1 -0
  87. package/dist/{chunk-DOQGNFHM.js → chunk-GH5UKMZD.js} +2 -12
  88. package/dist/{chunk-DOQGNFHM.js.map → chunk-GH5UKMZD.js.map} +1 -1
  89. package/dist/{chunk-WYXUQGOL.js → chunk-HAZAN4UM.js} +7 -6
  90. package/dist/chunk-HAZAN4UM.js.map +1 -0
  91. package/dist/chunk-HI5XQOX2.js +393 -0
  92. package/dist/chunk-HI5XQOX2.js.map +1 -0
  93. package/dist/chunk-HKGUKAQW.js +488 -0
  94. package/dist/chunk-HKGUKAQW.js.map +1 -0
  95. package/dist/{chunk-SO3XRZPX.js → chunk-HPRVFJPM.js} +6 -6
  96. package/dist/{chunk-L6JEXB3E.js → chunk-HQR4BWKX.js} +3 -131
  97. package/dist/chunk-HQR4BWKX.js.map +1 -0
  98. package/dist/chunk-HZKANST2.js +177 -0
  99. package/dist/chunk-HZKANST2.js.map +1 -0
  100. package/dist/{chunk-UUGOUOVT.js → chunk-I557SAOM.js} +8 -2
  101. package/dist/chunk-I557SAOM.js.map +1 -0
  102. package/dist/{chunk-TC2WZLSC.js → chunk-IGLWLH73.js} +8 -7
  103. package/dist/chunk-IGLWLH73.js.map +1 -0
  104. package/dist/chunk-ILWCKCOI.js +58 -0
  105. package/dist/chunk-ILWCKCOI.js.map +1 -0
  106. package/dist/{chunk-2GP3HRYK.js → chunk-INSIW65E.js} +182 -182
  107. package/dist/{chunk-MPZUYCAP.js → chunk-IULCDMVG.js} +12 -1
  108. package/dist/chunk-IULCDMVG.js.map +1 -0
  109. package/dist/{chunk-INTFHMU4.js → chunk-IVNSUAVC.js} +25 -26
  110. package/dist/chunk-IVNSUAVC.js.map +1 -0
  111. package/dist/chunk-JDQZCREI.js +87 -0
  112. package/dist/chunk-JDQZCREI.js.map +1 -0
  113. package/dist/chunk-JHFFUVON.js +1050 -0
  114. package/dist/chunk-JHFFUVON.js.map +1 -0
  115. package/dist/{chunk-RL5UUDT4.js → chunk-JNUKLSMZ.js} +3 -3
  116. package/dist/chunk-JTILUN4W.js +2933 -0
  117. package/dist/chunk-JTILUN4W.js.map +1 -0
  118. package/dist/{chunk-OJNTCYQQ.js → chunk-JTX3BUDK.js} +37 -53
  119. package/dist/chunk-JTX3BUDK.js.map +1 -0
  120. package/dist/{chunk-X5ZBP3IY.js → chunk-JUUBBBY5.js} +2 -2
  121. package/dist/chunk-JUUBBBY5.js.map +1 -0
  122. package/dist/chunk-JWAK7JQB.js +15 -0
  123. package/dist/chunk-JWAK7JQB.js.map +1 -0
  124. package/dist/{chunk-UXZONNEQ.js → chunk-K5KNGC4I.js} +34 -31
  125. package/dist/chunk-K5KNGC4I.js.map +1 -0
  126. package/dist/chunk-KAQ4Q3TO.js +135 -0
  127. package/dist/chunk-KAQ4Q3TO.js.map +1 -0
  128. package/dist/chunk-KFVJYLVL.js +125 -0
  129. package/dist/chunk-KFVJYLVL.js.map +1 -0
  130. package/dist/chunk-KGUE5AVX.js +69 -0
  131. package/dist/chunk-KGUE5AVX.js.map +1 -0
  132. package/dist/{chunk-FVIGCDSV.js → chunk-KLDMLWXT.js} +11 -85
  133. package/dist/chunk-KLDMLWXT.js.map +1 -0
  134. package/dist/chunk-KNKDMTHU.js +453 -0
  135. package/dist/chunk-KNKDMTHU.js.map +1 -0
  136. package/dist/chunk-LDA6TAYQ.js +95 -0
  137. package/dist/chunk-LDA6TAYQ.js.map +1 -0
  138. package/dist/chunk-LWSSIZOY.js +347 -0
  139. package/dist/chunk-LWSSIZOY.js.map +1 -0
  140. package/dist/{chunk-ZURZHELF.js → chunk-MAHNZA6C.js} +158 -41
  141. package/dist/chunk-MAHNZA6C.js.map +1 -0
  142. package/dist/chunk-MEWZCIA6.js +220 -0
  143. package/dist/chunk-MEWZCIA6.js.map +1 -0
  144. package/dist/{chunk-2SNUOHAT.js → chunk-MEZJ3I63.js} +49 -1
  145. package/dist/chunk-MEZJ3I63.js.map +1 -0
  146. package/dist/chunk-MJDO4EXD.js +353 -0
  147. package/dist/chunk-MJDO4EXD.js.map +1 -0
  148. package/dist/chunk-NJA6NT3A.js +6595 -0
  149. package/dist/chunk-NJA6NT3A.js.map +1 -0
  150. package/dist/{chunk-LHHMV4GU.js → chunk-NVSKJPRC.js} +1 -1
  151. package/dist/{chunk-LHHMV4GU.js.map → chunk-NVSKJPRC.js.map} +1 -1
  152. package/dist/{chunk-4YOZGGTZ.js → chunk-OC7K2DVZ.js} +5 -5
  153. package/dist/chunk-OC7K2DVZ.js.map +1 -0
  154. package/dist/chunk-ODRPASFP.js +2078 -0
  155. package/dist/chunk-ODRPASFP.js.map +1 -0
  156. package/dist/chunk-OJJFANO6.js +133 -0
  157. package/dist/chunk-OJJFANO6.js.map +1 -0
  158. package/dist/{chunk-JNJWBTU2.js → chunk-OQWPRFAC.js} +332 -882
  159. package/dist/chunk-OQWPRFAC.js.map +1 -0
  160. package/dist/chunk-P4I7BFNJ.js +11 -0
  161. package/dist/chunk-P4I7BFNJ.js.map +1 -0
  162. package/dist/{chunk-SNNSAGMT.js → chunk-P6YQWIT2.js} +4058 -4039
  163. package/dist/chunk-P6YQWIT2.js.map +1 -0
  164. package/dist/{chunk-JRGFKVAZ.js → chunk-PETQ5WEA.js} +2 -2
  165. package/dist/{chunk-HMWYAUA6.js → chunk-Q6RSJCXB.js} +29 -69
  166. package/dist/chunk-Q6RSJCXB.js.map +1 -0
  167. package/dist/{chunk-U3IKUGRP.js → chunk-QKEUKBRK.js} +17 -23
  168. package/dist/chunk-QKEUKBRK.js.map +1 -0
  169. package/dist/{chunk-2RWB7RKE.js → chunk-QKYUCITR.js} +174 -5814
  170. package/dist/chunk-QKYUCITR.js.map +1 -0
  171. package/dist/chunk-QQDPRTLP.js +127 -0
  172. package/dist/chunk-QQDPRTLP.js.map +1 -0
  173. package/dist/chunk-QQYCYAKI.js +79 -0
  174. package/dist/chunk-QQYCYAKI.js.map +1 -0
  175. package/dist/chunk-R4KDH477.js +1064 -0
  176. package/dist/chunk-R4KDH477.js.map +1 -0
  177. package/dist/chunk-R5TR2DIK.js +119 -0
  178. package/dist/chunk-R5TR2DIK.js.map +1 -0
  179. package/dist/chunk-R62PKTAG.js +66 -0
  180. package/dist/chunk-R62PKTAG.js.map +1 -0
  181. package/dist/{chunk-BFDQ4WNW.js → chunk-RFZA7PSM.js} +4 -5
  182. package/dist/chunk-RFZA7PSM.js.map +1 -0
  183. package/dist/chunk-RGCPELQN.js +219 -0
  184. package/dist/chunk-RGCPELQN.js.map +1 -0
  185. package/dist/chunk-RGVCOG2S.js +910 -0
  186. package/dist/chunk-RGVCOG2S.js.map +1 -0
  187. package/dist/chunk-SOLNJ3AZ.js +209 -0
  188. package/dist/chunk-SOLNJ3AZ.js.map +1 -0
  189. package/dist/chunk-TFT2X7SH.js +77 -0
  190. package/dist/chunk-TFT2X7SH.js.map +1 -0
  191. package/dist/chunk-TUCKEEXE.js +2 -0
  192. package/dist/chunk-TVWCLUBI.js +293 -0
  193. package/dist/chunk-TVWCLUBI.js.map +1 -0
  194. package/dist/chunk-U4TRWSVE.js +78 -0
  195. package/dist/chunk-U4TRWSVE.js.map +1 -0
  196. package/dist/chunk-UIB33QQP.js +379 -0
  197. package/dist/chunk-UIB33QQP.js.map +1 -0
  198. package/dist/chunk-V6GIVALQ.js +1889 -0
  199. package/dist/chunk-V6GIVALQ.js.map +1 -0
  200. package/dist/chunk-VHXCPXUS.js +366 -0
  201. package/dist/chunk-VHXCPXUS.js.map +1 -0
  202. package/dist/{chunk-HGZEPQUT.js → chunk-VU6GMWF6.js} +17 -8
  203. package/dist/chunk-VU6GMWF6.js.map +1 -0
  204. package/dist/chunk-VWZYE3NC.js +8415 -0
  205. package/dist/chunk-VWZYE3NC.js.map +1 -0
  206. package/dist/{chunk-AGMVASXZ.js → chunk-W2GXIARJ.js} +88 -11
  207. package/dist/chunk-W2GXIARJ.js.map +1 -0
  208. package/dist/chunk-W4G3K3V7.js +288 -0
  209. package/dist/chunk-W4G3K3V7.js.map +1 -0
  210. package/dist/chunk-W74LJ5OT.js +588 -0
  211. package/dist/chunk-W74LJ5OT.js.map +1 -0
  212. package/dist/chunk-W7ELYLYK.js +233 -0
  213. package/dist/chunk-W7ELYLYK.js.map +1 -0
  214. package/dist/{chunk-BPMWXTFX.js → chunk-WFZX352D.js} +7 -7
  215. package/dist/chunk-WXA3WTPF.js +20 -0
  216. package/dist/chunk-WXA3WTPF.js.map +1 -0
  217. package/dist/chunk-XRGFH7FI.js +454 -0
  218. package/dist/chunk-XRGFH7FI.js.map +1 -0
  219. package/dist/chunk-XSCGUO2U.js +330 -0
  220. package/dist/chunk-XSCGUO2U.js.map +1 -0
  221. package/dist/chunk-XWROSMI5.js +1039 -0
  222. package/dist/chunk-XWROSMI5.js.map +1 -0
  223. package/dist/chunk-Y2EXZ47H.js +40 -0
  224. package/dist/chunk-Y2EXZ47H.js.map +1 -0
  225. package/dist/chunk-YJGEVBKZ.js +47 -0
  226. package/dist/chunk-YJGEVBKZ.js.map +1 -0
  227. package/dist/{chunk-6CMM6YCB.js → chunk-YWWMISDY.js} +2 -2
  228. package/dist/{chunk-WXA2BWTE.js → chunk-ZCT5DJ3G.js} +2 -48
  229. package/dist/chunk-ZCT5DJ3G.js.map +1 -0
  230. package/dist/chunk-ZEYA2WWX.js +982 -0
  231. package/dist/chunk-ZEYA2WWX.js.map +1 -0
  232. package/dist/chunk-ZRC7Z5X3.js +82 -0
  233. package/dist/chunk-ZRC7Z5X3.js.map +1 -0
  234. package/dist/{chunk-3AIHRXKO.js → chunk-ZS7JIUJ3.js} +12 -10
  235. package/dist/chunk-ZS7JIUJ3.js.map +1 -0
  236. package/dist/{clack-EZ7TDWQU.js → clack-Q4RNC5VE.js} +2 -6
  237. package/dist/{claude-cli-2YKABJJZ.js → claude-cli-GIIHOBGT.js} +4 -2
  238. package/dist/claude-install-BAUSJMW3.js +64 -0
  239. package/dist/{cli-E36SPKBW.js → cli-QY4KKA3D.js} +632 -150
  240. package/dist/cli-QY4KKA3D.js.map +1 -0
  241. package/dist/client-3YQKORVK.js +710 -0
  242. package/dist/client-3YQKORVK.js.map +1 -0
  243. package/dist/{codex-event-ZO2GEFE6.js → codex-event-EUTCAOTQ.js} +3 -5
  244. package/dist/{codex-host-KECJVTA2.js → codex-host-ZON3S6HU.js} +7 -7
  245. package/dist/{codex-install-HQZDGFXW.js → codex-install-HZV2DOAB.js} +242 -88
  246. package/dist/codex-install-HZV2DOAB.js.map +1 -0
  247. package/dist/config-QZOBMTEL.js +57 -0
  248. package/dist/config-names-Z5NZD5R2.js +224 -0
  249. package/dist/config-names-Z5NZD5R2.js.map +1 -0
  250. package/dist/config-rules-YOYHS6YL.js +55 -0
  251. package/dist/config-subagents-WQV2ZAD5.js +362 -0
  252. package/dist/config-subagents-WQV2ZAD5.js.map +1 -0
  253. package/dist/connect-YDWTYU4B.js +1020 -0
  254. package/dist/connect-YDWTYU4B.js.map +1 -0
  255. package/dist/core-0a66n3e7-TTP554XV.js +127 -0
  256. package/dist/core-0a66n3e7-TTP554XV.js.map +1 -0
  257. package/dist/core-0bmnpbz2-C2JIRVZO.js +10790 -0
  258. package/dist/core-0bmnpbz2-C2JIRVZO.js.map +1 -0
  259. package/dist/core-9je8ee1j-74DGHWPV.js +30 -0
  260. package/dist/core-9je8ee1j-74DGHWPV.js.map +1 -0
  261. package/dist/core-wadgcjfh-TSZFQZGH.js +666 -0
  262. package/dist/core-wadgcjfh-TSZFQZGH.js.map +1 -0
  263. package/dist/core-zg882d22-LKV5DZYW.js +37 -0
  264. package/dist/core-zg882d22-LKV5DZYW.js.map +1 -0
  265. package/dist/decision-QSKHOGCO.js +145 -0
  266. package/dist/{doctor-I6XQEKWD.js → doctor-ZWJXRD75.js} +162 -148
  267. package/dist/doctor-ZWJXRD75.js.map +1 -0
  268. package/dist/{env-proxy-R6ZMLQTT.js → env-proxy-XLSLHBKQ.js} +2 -2
  269. package/dist/{ethersCompat-Df4a6QIZ-X6YZWAML.js → ethersCompat-Df4a6QIZ-K3DMHR6Y.js} +5 -5
  270. package/dist/explicit-ME2NRADQ.js +371 -0
  271. package/dist/explicit-ME2NRADQ.js.map +1 -0
  272. package/dist/flush-stdio-NYIJ3QXT.js +18 -0
  273. package/dist/fund-VF7TLDJH.js +722 -0
  274. package/dist/fund-VF7TLDJH.js.map +1 -0
  275. package/dist/hook-command-VZ27MGWO.js +49 -0
  276. package/dist/hosts/claude/.claude-plugin/marketplace.json +2 -2
  277. package/dist/hosts/claude/tenjin/.claude-plugin/plugin.json +2 -2
  278. package/dist/hosts/claude/tenjin/hooks/hook-data.ts +152 -0
  279. package/dist/hosts/claude/tenjin/hooks/hooks.json +7 -0
  280. package/dist/hosts/claude/tenjin/hooks/model-viewer.tsx +2987 -0
  281. package/dist/hosts/claude/tenjin/hooks/register.tsx +527 -56
  282. package/dist/hosts/claude/tenjin/skills/tenjin-pay/SKILL.md +14 -4
  283. package/dist/hosts/claude/tenjin/types/index.d.ts +144 -1
  284. package/dist/{hosts-DVQJ32QC.js → hosts-3EMTVM4H.js} +7 -6
  285. package/dist/index.js +18 -15
  286. package/dist/index.js.map +1 -1
  287. package/dist/install-ZA7L2UF3.js +115 -0
  288. package/dist/install-funding-JDGYTF72.js +30 -0
  289. package/dist/install-identity-FFAYEFLX.js +30 -0
  290. package/dist/{install-wallet-5M4OTYLX.js → install-wallet-2SFOVE3Q.js} +68 -53
  291. package/dist/install-wallet-2SFOVE3Q.js.map +1 -0
  292. package/dist/mcp-36S6MK3C.js +67642 -0
  293. package/dist/mcp-36S6MK3C.js.map +1 -0
  294. package/dist/new-install-5L4GY3LN.js +51 -0
  295. package/dist/{package-IJFGMWEV.js → package-BONDXSV3.js} +2 -2
  296. package/dist/{passphrase-IFTDS3CU.js → passphrase-T4ULBN4M.js} +16 -12
  297. package/dist/{paths-XCSAKISU.js → paths-O2KDWZ76.js} +18 -28
  298. package/dist/pay-CMV5KL74.js +74 -0
  299. package/dist/{payments-HFPPWHTV.js → payments-Z6UBZL4Z.js} +36 -26
  300. package/dist/payments-Z6UBZL4Z.js.map +1 -0
  301. package/dist/reclaim-subagent-credit-ABSF67SJ.js +105 -0
  302. package/dist/reclaim-subagent-credit-ABSF67SJ.js.map +1 -0
  303. package/dist/{redact-D7ASVWKL.js → redact-LOTHE5TS.js} +2 -8
  304. package/dist/redact-LOTHE5TS.js.map +1 -0
  305. package/dist/routing-quote-AHLAREXR.js +40 -0
  306. package/dist/routing-quote-AHLAREXR.js.map +1 -0
  307. package/dist/run-JH7ELYAM.js +88 -0
  308. package/dist/run-JH7ELYAM.js.map +1 -0
  309. package/dist/runtime-2GX4ALJP.js +410 -0
  310. package/dist/runtime-2GX4ALJP.js.map +1 -0
  311. package/dist/runtime-activate-IDQ2NCSP.js +39 -0
  312. package/dist/runtime-activate-IDQ2NCSP.js.map +1 -0
  313. package/dist/{runtime-fetch-ZSSSK72Y.js → runtime-fetch-6LOBHBEN.js} +4 -4
  314. package/dist/runtime-fetch-6LOBHBEN.js.map +1 -0
  315. package/dist/runtime-launchers-YAPKCBHV.js +31 -0
  316. package/dist/runtime-launchers-YAPKCBHV.js.map +1 -0
  317. package/dist/{runtime-layout-WIDILZ6K.js → runtime-layout-QHZQJV7C.js} +5 -4
  318. package/dist/runtime-layout-QHZQJV7C.js.map +1 -0
  319. package/dist/runtime-place-4POL4KK4.js +37 -0
  320. package/dist/runtime-place-4POL4KK4.js.map +1 -0
  321. package/dist/runtime-provenance-MNJGVBV2.js +12 -0
  322. package/dist/runtime-provenance-MNJGVBV2.js.map +1 -0
  323. package/dist/{secp256k1-ZZZT2CAX.js → secp256k1-N5P2GVGF.js} +3 -3
  324. package/dist/secp256k1-N5P2GVGF.js.map +1 -0
  325. package/dist/{send-GCVEAQKL.js → send-ELXFKEKY.js} +35 -32
  326. package/dist/send-ELXFKEKY.js.map +1 -0
  327. package/dist/status-FXUFWJDM.js +404 -0
  328. package/dist/status-FXUFWJDM.js.map +1 -0
  329. package/dist/{status-line-OPCXDHL2.js → status-line-IH5JBWBC.js} +51 -43
  330. package/dist/status-line-IH5JBWBC.js.map +1 -0
  331. package/dist/streamableHttp-CP2ZQBIK.js +768 -0
  332. package/dist/streamableHttp-CP2ZQBIK.js.map +1 -0
  333. package/dist/{uninstall-BAWRBXXQ.js → uninstall-LJZUKM4D.js} +76 -76
  334. package/dist/uninstall-LJZUKM4D.js.map +1 -0
  335. package/dist/update-EUIX72IX.js +68 -0
  336. package/dist/update-EUIX72IX.js.map +1 -0
  337. package/dist/usage-EKDC7LUC.js +180 -0
  338. package/dist/usage-EKDC7LUC.js.map +1 -0
  339. package/dist/{usdc-VG4CIOUK.js → usdc-YIHK2OMC.js} +8 -12
  340. package/dist/usdc-YIHK2OMC.js.map +1 -0
  341. package/dist/{viemAdapter-By13KInL-DOFTEIJV.js → viemAdapter-By13KInL-PRLSIESK.js} +5 -5
  342. package/dist/viemAdapter-By13KInL-PRLSIESK.js.map +1 -0
  343. package/dist/wallet-HSW757W6.js +80 -0
  344. package/dist/wallet-HSW757W6.js.map +1 -0
  345. package/dist/wallet-kdf-worker.mjs +1433 -818
  346. package/docs/agent-permissions.md +88 -155
  347. package/docs/router-reference.md +236 -0
  348. package/docs/safety-model.md +31 -33
  349. package/docs/subagents-internals.md +97 -0
  350. package/docs/subagents.md +348 -0
  351. package/docs/troubleshooting.md +10 -6
  352. package/package.json +12 -8
  353. package/scripts/installers/install.sh +7 -1
  354. package/dist/alive-GSOWKUOY.js +0 -38
  355. package/dist/chunk-2I4QTOLB.js.map +0 -1
  356. package/dist/chunk-2M2VPI2E.js +0 -560
  357. package/dist/chunk-2M2VPI2E.js.map +0 -1
  358. package/dist/chunk-2RWB7RKE.js.map +0 -1
  359. package/dist/chunk-2SNUOHAT.js.map +0 -1
  360. package/dist/chunk-3623BLPV.js +0 -184
  361. package/dist/chunk-3623BLPV.js.map +0 -1
  362. package/dist/chunk-36RVGZNY.js.map +0 -1
  363. package/dist/chunk-3AIHRXKO.js.map +0 -1
  364. package/dist/chunk-3FMZGI7I.js.map +0 -1
  365. package/dist/chunk-3UCIG4TG.js.map +0 -1
  366. package/dist/chunk-4K7TQHNP.js.map +0 -1
  367. package/dist/chunk-4LMUQMBH.js +0 -29
  368. package/dist/chunk-4LMUQMBH.js.map +0 -1
  369. package/dist/chunk-4USCZ2NI.js +0 -228
  370. package/dist/chunk-4USCZ2NI.js.map +0 -1
  371. package/dist/chunk-4YOZGGTZ.js.map +0 -1
  372. package/dist/chunk-62KNUYWD.js +0 -111
  373. package/dist/chunk-62KNUYWD.js.map +0 -1
  374. package/dist/chunk-A5GKIG5O.js +0 -2037
  375. package/dist/chunk-A5GKIG5O.js.map +0 -1
  376. package/dist/chunk-AGMVASXZ.js.map +0 -1
  377. package/dist/chunk-BF4XHEQK.js.map +0 -1
  378. package/dist/chunk-BFDQ4WNW.js.map +0 -1
  379. package/dist/chunk-C2Q76BVM.js.map +0 -1
  380. package/dist/chunk-CEXSOI5R.js +0 -808
  381. package/dist/chunk-CEXSOI5R.js.map +0 -1
  382. package/dist/chunk-E7SW44LM.js.map +0 -1
  383. package/dist/chunk-EDJWHDDL.js +0 -33
  384. package/dist/chunk-EDJWHDDL.js.map +0 -1
  385. package/dist/chunk-FVIGCDSV.js.map +0 -1
  386. package/dist/chunk-GTTUCOPD.js +0 -105
  387. package/dist/chunk-GTTUCOPD.js.map +0 -1
  388. package/dist/chunk-HDPUXS3Z.js +0 -122
  389. package/dist/chunk-HDPUXS3Z.js.map +0 -1
  390. package/dist/chunk-HGGWCP7W.js +0 -120
  391. package/dist/chunk-HGGWCP7W.js.map +0 -1
  392. package/dist/chunk-HGZEPQUT.js.map +0 -1
  393. package/dist/chunk-HMWYAUA6.js.map +0 -1
  394. package/dist/chunk-IADZOXKN.js.map +0 -1
  395. package/dist/chunk-ILNIZ5I2.js.map +0 -1
  396. package/dist/chunk-INTFHMU4.js.map +0 -1
  397. package/dist/chunk-JKKAIPTU.js.map +0 -1
  398. package/dist/chunk-JNJWBTU2.js.map +0 -1
  399. package/dist/chunk-KM7RY2ZS.js +0 -246
  400. package/dist/chunk-KM7RY2ZS.js.map +0 -1
  401. package/dist/chunk-KOGZDMHO.js +0 -21
  402. package/dist/chunk-KOGZDMHO.js.map +0 -1
  403. package/dist/chunk-L6JEXB3E.js.map +0 -1
  404. package/dist/chunk-LRW6S53P.js.map +0 -1
  405. package/dist/chunk-LXAYUOXI.js +0 -511
  406. package/dist/chunk-LXAYUOXI.js.map +0 -1
  407. package/dist/chunk-MEFB5KHA.js +0 -59
  408. package/dist/chunk-MEFB5KHA.js.map +0 -1
  409. package/dist/chunk-MPZUYCAP.js.map +0 -1
  410. package/dist/chunk-NDGZDTSJ.js.map +0 -1
  411. package/dist/chunk-OJNTCYQQ.js.map +0 -1
  412. package/dist/chunk-P3LFTKE7.js +0 -58
  413. package/dist/chunk-P3LFTKE7.js.map +0 -1
  414. package/dist/chunk-QXP3Z3JN.js.map +0 -1
  415. package/dist/chunk-RVPYTUP4.js.map +0 -1
  416. package/dist/chunk-SNNSAGMT.js.map +0 -1
  417. package/dist/chunk-TC2WZLSC.js.map +0 -1
  418. package/dist/chunk-TKPF35W6.js +0 -29
  419. package/dist/chunk-TKPF35W6.js.map +0 -1
  420. package/dist/chunk-U3IKUGRP.js.map +0 -1
  421. package/dist/chunk-UUGOUOVT.js.map +0 -1
  422. package/dist/chunk-UXZONNEQ.js.map +0 -1
  423. package/dist/chunk-WXA2BWTE.js.map +0 -1
  424. package/dist/chunk-WYXUQGOL.js.map +0 -1
  425. package/dist/chunk-X5ZBP3IY.js.map +0 -1
  426. package/dist/chunk-XKESD27X.js +0 -10
  427. package/dist/chunk-XKESD27X.js.map +0 -1
  428. package/dist/chunk-XQJXNMSB.js.map +0 -1
  429. package/dist/chunk-Y527D4TV.js +0 -56
  430. package/dist/chunk-Y527D4TV.js.map +0 -1
  431. package/dist/chunk-ZDZERB6L.js.map +0 -1
  432. package/dist/chunk-ZNNXRNFD.js.map +0 -1
  433. package/dist/chunk-ZURZHELF.js.map +0 -1
  434. package/dist/cli-E36SPKBW.js.map +0 -1
  435. package/dist/codex-install-HQZDGFXW.js.map +0 -1
  436. package/dist/config-HY2E4GGW.js +0 -55
  437. package/dist/doctor-I6XQEKWD.js.map +0 -1
  438. package/dist/fund-2QRO7OJL.js +0 -378
  439. package/dist/fund-2QRO7OJL.js.map +0 -1
  440. package/dist/hook-command-2UBCSZG6.js +0 -43
  441. package/dist/install-ILUX5C4A.js +0 -107
  442. package/dist/install-identity-TZKGY6LQ.js +0 -31
  443. package/dist/install-wallet-5M4OTYLX.js.map +0 -1
  444. package/dist/mcp-LE4DUS22.js +0 -14127
  445. package/dist/mcp-LE4DUS22.js.map +0 -1
  446. package/dist/pay-WCG3IH4R.js +0 -55
  447. package/dist/payments-HFPPWHTV.js.map +0 -1
  448. package/dist/plugin-registration-PZFI5GZW.js +0 -68
  449. package/dist/runtime-UZOKSUZX.js +0 -1321
  450. package/dist/runtime-UZOKSUZX.js.map +0 -1
  451. package/dist/send-GCVEAQKL.js.map +0 -1
  452. package/dist/status-HCVAOCN7.js +0 -150
  453. package/dist/status-HCVAOCN7.js.map +0 -1
  454. package/dist/status-line-OPCXDHL2.js.map +0 -1
  455. package/dist/uninstall-BAWRBXXQ.js.map +0 -1
  456. package/dist/update-CACXLQLR.js +0 -56
  457. package/dist/wallet-QL4UUXEZ.js +0 -55
  458. /package/dist/{_esm-BIN7VY2L.js.map → _esm-2KST7HQ7.js.map} +0 -0
  459. /package/dist/{alive-GSOWKUOY.js.map → alive-5TV22PNF.js.map} +0 -0
  460. /package/dist/{auto-update-Y24UL56V.js.map → auth-XI7BJFLW.js.map} +0 -0
  461. /package/dist/{ccip-DHDFKTQV.js.map → auto-update-7L24KDWA.js.map} +0 -0
  462. /package/dist/{clack-EZ7TDWQU.js.map → balance-DFHC6XEU.js.map} +0 -0
  463. /package/dist/{claude-cli-2YKABJJZ.js.map → ccip-HOW3DZYF.js.map} +0 -0
  464. /package/dist/{chunk-IE7P2BZE.js.map → chunk-6QMDUDF2.js.map} +0 -0
  465. /package/dist/{chunk-KG3D7FIF.js.map → chunk-CZJOMUBP.js.map} +0 -0
  466. /package/dist/{chunk-3GNJXKIT.js.map → chunk-F43CV6UC.js.map} +0 -0
  467. /package/dist/{chunk-J57UC3DD.js.map → chunk-FKVJKLPI.js.map} +0 -0
  468. /package/dist/{chunk-SO3XRZPX.js.map → chunk-HPRVFJPM.js.map} +0 -0
  469. /package/dist/{chunk-2GP3HRYK.js.map → chunk-INSIW65E.js.map} +0 -0
  470. /package/dist/{chunk-RL5UUDT4.js.map → chunk-JNUKLSMZ.js.map} +0 -0
  471. /package/dist/{chunk-JRGFKVAZ.js.map → chunk-PETQ5WEA.js.map} +0 -0
  472. /package/dist/{codex-event-ZO2GEFE6.js.map → chunk-TUCKEEXE.js.map} +0 -0
  473. /package/dist/{chunk-BPMWXTFX.js.map → chunk-WFZX352D.js.map} +0 -0
  474. /package/dist/{chunk-6CMM6YCB.js.map → chunk-YWWMISDY.js.map} +0 -0
  475. /package/dist/{codex-host-KECJVTA2.js.map → clack-Q4RNC5VE.js.map} +0 -0
  476. /package/dist/{config-HY2E4GGW.js.map → claude-cli-GIIHOBGT.js.map} +0 -0
  477. /package/dist/{env-proxy-R6ZMLQTT.js.map → claude-install-BAUSJMW3.js.map} +0 -0
  478. /package/dist/{ethersCompat-Df4a6QIZ-X6YZWAML.js.map → codex-event-EUTCAOTQ.js.map} +0 -0
  479. /package/dist/{hook-command-2UBCSZG6.js.map → codex-host-ZON3S6HU.js.map} +0 -0
  480. /package/dist/{hosts-DVQJ32QC.js.map → config-QZOBMTEL.js.map} +0 -0
  481. /package/dist/{install-ILUX5C4A.js.map → config-rules-YOYHS6YL.js.map} +0 -0
  482. /package/dist/{install-identity-TZKGY6LQ.js.map → decision-QSKHOGCO.js.map} +0 -0
  483. /package/dist/{package-IJFGMWEV.js.map → env-proxy-XLSLHBKQ.js.map} +0 -0
  484. /package/dist/{passphrase-IFTDS3CU.js.map → ethersCompat-Df4a6QIZ-K3DMHR6Y.js.map} +0 -0
  485. /package/dist/{paths-XCSAKISU.js.map → flush-stdio-NYIJ3QXT.js.map} +0 -0
  486. /package/dist/{pay-WCG3IH4R.js.map → hook-command-VZ27MGWO.js.map} +0 -0
  487. /package/dist/{plugin-registration-PZFI5GZW.js.map → hosts-3EMTVM4H.js.map} +0 -0
  488. /package/dist/{redact-D7ASVWKL.js.map → install-ZA7L2UF3.js.map} +0 -0
  489. /package/dist/{runtime-fetch-ZSSSK72Y.js.map → install-funding-JDGYTF72.js.map} +0 -0
  490. /package/dist/{runtime-layout-WIDILZ6K.js.map → install-identity-FFAYEFLX.js.map} +0 -0
  491. /package/dist/{secp256k1-ZZZT2CAX.js.map → new-install-5L4GY3LN.js.map} +0 -0
  492. /package/dist/{update-CACXLQLR.js.map → package-BONDXSV3.js.map} +0 -0
  493. /package/dist/{usdc-VG4CIOUK.js.map → passphrase-T4ULBN4M.js.map} +0 -0
  494. /package/dist/{viemAdapter-By13KInL-DOFTEIJV.js.map → paths-O2KDWZ76.js.map} +0 -0
  495. /package/dist/{wallet-QL4UUXEZ.js.map → pay-CMV5KL74.js.map} +0 -0
@@ -0,0 +1,135 @@
1
+ import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
+ import {
3
+ packageRootOf
4
+ } from "./chunk-MJDO4EXD.js";
5
+ import {
6
+ LAUNCHER_MARKER,
7
+ renderLauncherCmd,
8
+ renderLauncherSh
9
+ } from "./chunk-34SAECKZ.js";
10
+ import {
11
+ writeFileAtomic
12
+ } from "./chunk-7WEQQJLG.js";
13
+ import {
14
+ launcherDir
15
+ } from "./chunk-JTX3BUDK.js";
16
+
17
+ // src/lib/runtime-launchers.ts
18
+ import { lstat, readFile, realpath, rm } from "node:fs/promises";
19
+ import { basename, dirname, join, posix, win32 } from "node:path";
20
+ var launcherNames = (platform) => platform === "win32" ? ["tenjin", "tenjin.cmd"] : ["tenjin"];
21
+ function pathLine(env, _home, platform) {
22
+ if (platform === "win32") {
23
+ return `[Environment]::SetEnvironmentVariable('Path', "$env:USERPROFILE\\.local\\bin;" + [Environment]::GetEnvironmentVariable('Path','User'), 'User')`;
24
+ }
25
+ const add = `echo 'export PATH="$HOME/.local/bin:$PATH"' >>`;
26
+ const shell = basename(env.SHELL ?? "");
27
+ if (shell === "zsh") return `${add} ~/.zshrc`;
28
+ if (shell === "bash") return `${add} ${platform === "darwin" ? "~/.bash_profile" : "~/.bashrc"}`;
29
+ if (shell === "fish") return "fish_add_path ~/.local/bin";
30
+ return 'export PATH="$HOME/.local/bin:$PATH"';
31
+ }
32
+ function onPath(dir, env, platform) {
33
+ const p = platform === "win32" ? win32 : posix;
34
+ const raw = (platform === "win32" ? env.Path ?? env.PATH : env.PATH) ?? "";
35
+ const norm = (value) => {
36
+ const full = p.resolve(value).replace(/[\\/]+$/, "");
37
+ return platform === "win32" ? full.toLowerCase() : full;
38
+ };
39
+ const want = norm(dir);
40
+ return raw.split(p.delimiter).filter((entry) => entry.length > 0).some((entry) => norm(entry) === want);
41
+ }
42
+ async function npmsOwn(path, isLink, body) {
43
+ if (isLink) {
44
+ try {
45
+ return packageRootOf(dirname(await realpath(path))) !== null;
46
+ } catch {
47
+ return false;
48
+ }
49
+ }
50
+ return body !== null && /node_modules[\\/]tenjin-cli[\\/]/.test(body);
51
+ }
52
+ async function inspectLauncher(path) {
53
+ let link;
54
+ try {
55
+ link = await lstat(path);
56
+ } catch {
57
+ return { state: "absent", body: null };
58
+ }
59
+ const body = await readFile(path, "utf8").catch(() => null);
60
+ if (await npmsOwn(path, link.isSymbolicLink(), body)) return { state: "npm", body };
61
+ if (!link.isSymbolicLink() && body !== null && body.includes(LAUNCHER_MARKER)) {
62
+ return { state: "ours", body };
63
+ }
64
+ return { state: "foreign", body };
65
+ }
66
+ async function writeLaunchers(home, launch, o) {
67
+ const platform = o.platform ?? launch.platform ?? process.platform;
68
+ const dir = launcherDir(home);
69
+ const paths = launcherNames(platform).map((name) => join(dir, name));
70
+ const found = onPath(dir, o.env, platform);
71
+ const where = { onPath: found, ...found ? {} : { pathLine: pathLine(o.env, home, platform) } };
72
+ let bodies;
73
+ try {
74
+ const full = { ...launch, platform, home: launch.home ?? home };
75
+ bodies = [renderLauncherSh(full), ...platform === "win32" ? [renderLauncherCmd(full)] : []];
76
+ } catch (err) {
77
+ return {
78
+ paths,
79
+ state: "failed",
80
+ ...where,
81
+ reason: err instanceof Error ? err.message : String(err)
82
+ };
83
+ }
84
+ const existing = await Promise.all(paths.map(inspectLauncher));
85
+ const foreign = paths.filter((_, i) => existing[i].state === "foreign");
86
+ if (foreign.length > 0) {
87
+ return { paths, state: "foreign", ...where, reason: `${foreign.join(", ")} is not Tenjin's` };
88
+ }
89
+ if (existing.some((f) => f.state === "npm")) return { paths, state: "npm", ...where };
90
+ if (existing.every((f, i) => f.body === bodies[i])) return { paths, state: "current", ...where };
91
+ try {
92
+ for (const [i, path] of paths.entries()) {
93
+ if (existing[i].body !== bodies[i]) {
94
+ await writeFileAtomic(path, bodies[i], { mode: 493, dirMode: 493 });
95
+ }
96
+ }
97
+ } catch (err) {
98
+ return {
99
+ paths,
100
+ state: "failed",
101
+ ...where,
102
+ reason: err instanceof Error ? err.message : String(err)
103
+ };
104
+ }
105
+ return { paths, state: "written", ...where };
106
+ }
107
+ async function removeLaunchers(home, platform = process.platform) {
108
+ const removed = [];
109
+ const left = [];
110
+ for (const name of ["tenjin", "tenjin.cmd"]) {
111
+ const path = join(launcherDir(home), name);
112
+ const found = await inspectLauncher(path);
113
+ if (found.state === "absent") continue;
114
+ if (found.state !== "ours") {
115
+ if (name === "tenjin" || platform === "win32") left.push(path);
116
+ continue;
117
+ }
118
+ try {
119
+ await rm(path, { force: true });
120
+ removed.push(path);
121
+ } catch {
122
+ left.push(path);
123
+ }
124
+ }
125
+ return { removed, left };
126
+ }
127
+
128
+ export {
129
+ launcherNames,
130
+ pathLine,
131
+ inspectLauncher,
132
+ writeLaunchers,
133
+ removeLaunchers
134
+ };
135
+ //# sourceMappingURL=chunk-KAQ4Q3TO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/runtime-launchers.ts"],"sourcesContent":["import { lstat, readFile, realpath, rm } from 'node:fs/promises';\nimport { basename, dirname, join, posix, win32 } from 'node:path';\nimport {\n LAUNCHER_MARKER,\n renderLauncherCmd,\n renderLauncherSh,\n type RuntimeLaunch,\n} from '../router/plugin-files';\nimport { writeFileAtomic } from './atomic-json';\nimport { launcherDir } from './paths';\nimport { packageRootOf } from './runtime-place';\n\n// ---------------------------------------------------------------------------\n// Launchers\n// ---------------------------------------------------------------------------\n\nexport interface LauncherResult {\n paths: string[];\n /**\n * `written` or `current` (ours, now right), `foreign` (a file that is not\n * ours, left as it is), `npm` (npm's own link with prefix `~/.local`, left),\n * `failed` (not written), `skipped` (no launcher for this run).\n */\n state: 'written' | 'current' | 'foreign' | 'npm' | 'failed' | 'skipped';\n /** Is the launcher folder on this environment's PATH? */\n onPath: boolean;\n /** The line that puts it there, when it is not. */\n pathLine?: string;\n reason?: string;\n}\n\nexport const launcherNames = (platform: NodeJS.Platform): string[] =>\n platform === 'win32' ? ['tenjin', 'tenjin.cmd'] : ['tenjin'];\n\n/** The line that adds `~/.local/bin` to PATH for the shell this environment runs. Install prints it; it never edits a shell file. */\nexport function pathLine(env: NodeJS.ProcessEnv, _home: string, platform: NodeJS.Platform): string {\n if (platform === 'win32') {\n return `[Environment]::SetEnvironmentVariable('Path', \"$env:USERPROFILE\\\\.local\\\\bin;\" + [Environment]::GetEnvironmentVariable('Path','User'), 'User')`;\n }\n const add = `echo 'export PATH=\"$HOME/.local/bin:$PATH\"' >>`;\n const shell = basename(env.SHELL ?? '');\n if (shell === 'zsh') return `${add} ~/.zshrc`;\n if (shell === 'bash') return `${add} ${platform === 'darwin' ? '~/.bash_profile' : '~/.bashrc'}`;\n if (shell === 'fish') return 'fish_add_path ~/.local/bin';\n return 'export PATH=\"$HOME/.local/bin:$PATH\"';\n}\n\nfunction onPath(dir: string, env: NodeJS.ProcessEnv, platform: NodeJS.Platform): boolean {\n const p = platform === 'win32' ? win32 : posix;\n const raw = (platform === 'win32' ? (env.Path ?? env.PATH) : env.PATH) ?? '';\n const norm = (value: string) => {\n const full = p.resolve(value).replace(/[\\\\/]+$/, '');\n return platform === 'win32' ? full.toLowerCase() : full;\n };\n const want = norm(dir);\n return raw\n .split(p.delimiter)\n .filter((entry) => entry.length > 0)\n .some((entry) => norm(entry) === want);\n}\n\n/** npm's own `tenjin` (npm prefix `~/.local`): a link into a tenjin-cli package, or its shim naming one. */\nasync function npmsOwn(path: string, isLink: boolean, body: string | null): Promise<boolean> {\n if (isLink) {\n try {\n return packageRootOf(dirname(await realpath(path))) !== null;\n } catch {\n return false;\n }\n }\n return body !== null && /node_modules[\\\\/]tenjin-cli[\\\\/]/.test(body);\n}\n\ntype LauncherFile = { state: 'absent' | 'ours' | 'npm' | 'foreign'; body: string | null };\n\nexport async function inspectLauncher(path: string): Promise<LauncherFile> {\n let link;\n try {\n link = await lstat(path);\n } catch {\n return { state: 'absent', body: null };\n }\n const body = await readFile(path, 'utf8').catch(() => null);\n if (await npmsOwn(path, link.isSymbolicLink(), body)) return { state: 'npm', body };\n if (!link.isSymbolicLink() && body !== null && body.includes(LAUNCHER_MARKER)) {\n return { state: 'ours', body };\n }\n return { state: 'foreign', body };\n}\n\n/**\n * The `tenjin` launcher in `~/.local/bin` (and `tenjin.cmd` on Windows), written\n * atomically at 0o755, so a terminal finds Tenjin with no npm folder and no\n * `node` on PATH. Only a file carrying {@link LAUNCHER_MARKER} is replaced.\n * Never throws; a failed write is `failed`, and the runtime works without it.\n */\nexport async function writeLaunchers(\n home: string,\n launch: RuntimeLaunch,\n o: { env: NodeJS.ProcessEnv; platform?: NodeJS.Platform },\n): Promise<LauncherResult> {\n const platform = o.platform ?? launch.platform ?? process.platform;\n const dir = launcherDir(home);\n const paths = launcherNames(platform).map((name) => join(dir, name));\n const found = onPath(dir, o.env, platform);\n const where = { onPath: found, ...(found ? {} : { pathLine: pathLine(o.env, home, platform) }) };\n let bodies: string[];\n try {\n const full = { ...launch, platform, home: launch.home ?? home };\n bodies = [renderLauncherSh(full), ...(platform === 'win32' ? [renderLauncherCmd(full)] : [])];\n } catch (err) {\n return {\n paths,\n state: 'failed',\n ...where,\n reason: err instanceof Error ? err.message : String(err),\n };\n }\n const existing = await Promise.all(paths.map(inspectLauncher));\n const foreign = paths.filter((_, i) => existing[i]!.state === 'foreign');\n if (foreign.length > 0) {\n return { paths, state: 'foreign', ...where, reason: `${foreign.join(', ')} is not Tenjin's` };\n }\n if (existing.some((f) => f.state === 'npm')) return { paths, state: 'npm', ...where };\n if (existing.every((f, i) => f.body === bodies[i])) return { paths, state: 'current', ...where };\n try {\n for (const [i, path] of paths.entries()) {\n if (existing[i]!.body !== bodies[i]) {\n await writeFileAtomic(path, bodies[i]!, { mode: 0o755, dirMode: 0o755 });\n }\n }\n } catch (err) {\n return {\n paths,\n state: 'failed',\n ...where,\n reason: err instanceof Error ? err.message : String(err),\n };\n }\n return { paths, state: 'written', ...where };\n}\n\n/** Remove the launchers this CLI wrote; anything without the marker is left and named. */\nexport async function removeLaunchers(\n home: string,\n platform: NodeJS.Platform = process.platform,\n): Promise<{ removed: string[]; left: string[] }> {\n const removed: string[] = [];\n const left: string[] = [];\n for (const name of ['tenjin', 'tenjin.cmd']) {\n const path = join(launcherDir(home), name);\n const found = await inspectLauncher(path);\n if (found.state === 'absent') continue;\n if (found.state !== 'ours') {\n if (name === 'tenjin' || platform === 'win32') left.push(path);\n continue;\n }\n try {\n await rm(path, { force: true });\n removed.push(path);\n } catch {\n left.push(path);\n }\n }\n return { removed, left };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAS,OAAO,UAAU,UAAU,UAAU;AAC9C,SAAS,UAAU,SAAS,MAAM,OAAO,aAAa;AA8B/C,IAAM,gBAAgB,CAAC,aAC5B,aAAa,UAAU,CAAC,UAAU,YAAY,IAAI,CAAC,QAAQ;AAGtD,SAAS,SAAS,KAAwB,OAAe,UAAmC;AACjG,MAAI,aAAa,SAAS;AACxB,WAAO;AAAA,EACT;AACA,QAAM,MAAM;AACZ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,GAAG,MAAM;AACpF,MAAI,SAAS,MAAM,CAAC,GAAG,MAAM,EAAE,SAAS,OAAO,CAAC,CAAC,EAAG,QAAO,EAAE,OAAO,OAAO,WAAW,GAAG,MAAM;AAC/F,MAAI;AACF,eAAW,CAAC,GAAG,IAAI,KAAK,MAAM,QAAQ,GAAG;AACvC,UAAI,SAAS,CAAC,EAAG,SAAS,OAAO,CAAC,GAAG;AACnC,cAAM,gBAAgB,MAAM,OAAO,CAAC,GAAI,EAAE,MAAM,KAAO,SAAS,IAAM,CAAC;AAAA,MACzE;AAAA,IACF;AAAA,EACF,SAAS,KAAK;AACZ,WAAO;AAAA,MACL;AAAA,MACA,OAAO;AAAA,MACP,GAAG;AAAA,MACH,QAAQ,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAAA,IACzD;AAAA,EACF;AACA,SAAO,EAAE,OAAO,OAAO,WAAW,GAAG,MAAM;AAC7C;AAGA,eAAsB,gBACpB,MACA,WAA4B,QAAQ,UACY;AAChD,QAAM,UAAoB,CAAC;AAC3B,QAAM,OAAiB,CAAC;AACxB,aAAW,QAAQ,CAAC,UAAU,YAAY,GAAG;AAC3C,UAAM,OAAO,KAAK,YAAY,IAAI,GAAG,IAAI;AACzC,UAAM,QAAQ,MAAM,gBAAgB,IAAI;AACxC,QAAI,MAAM,UAAU,SAAU;AAC9B,QAAI,MAAM,UAAU,QAAQ;AAC1B,UAAI,SAAS,YAAY,aAAa,QAAS,MAAK,KAAK,IAAI;AAC7D;AAAA,IACF;AACA,QAAI;AACF,YAAM,GAAG,MAAM,EAAE,OAAO,KAAK,CAAC;AAC9B,cAAQ,KAAK,IAAI;AAAA,IACnB,QAAQ;AACN,WAAK,KAAK,IAAI;AAAA,IAChB;AAAA,EACF;AACA,SAAO,EAAE,SAAS,KAAK;AACzB;","names":[]}
@@ -0,0 +1,125 @@
1
+ import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
+ import {
3
+ isRecord
4
+ } from "./chunk-P4I7BFNJ.js";
5
+
6
+ // src/router/codex-wire.ts
7
+ var NATIVE_TO_EVENT = {
8
+ UserPromptSubmit: "prompt",
9
+ PreToolUse: "tool.before",
10
+ PostToolUse: "tool.after"
11
+ };
12
+ var AGENT_ID_RE = /^[A-Za-z0-9_-]{1,128}$/;
13
+ function str(v) {
14
+ return typeof v === "string" ? v : void 0;
15
+ }
16
+ var HTTP_URL_RE = /^https?:\/\//i;
17
+ var plainSearch = (v) => isRecord(v) && Object.keys(v).every((key) => key === "q") && typeof v.q === "string" && v.q.trim().length > 0;
18
+ var urlOpen = (v) => isRecord(v) && typeof v.ref_id === "string" && HTTP_URL_RE.test(v.ref_id.trim());
19
+ function splitWebrun(input) {
20
+ const searches = Array.isArray(input.search_query) ? input.search_query : [];
21
+ const opens = Array.isArray(input.open) ? input.open : [];
22
+ const s = searches.findIndex(plainSearch);
23
+ const o = s === -1 ? opens.findIndex((v) => urlOpen(v) && Object.keys(v).every((k) => k === "ref_id")) : -1;
24
+ if (s === -1 && o === -1) return null;
25
+ const key = s !== -1 ? "search_query" : "open";
26
+ const index = s !== -1 ? s : o;
27
+ const entry = s !== -1 ? { tool: "WebSearch", query: searches[s].q } : { tool: "WebFetch", url: opens[o].ref_id.trim() };
28
+ const rest = { ...input };
29
+ const left = (s !== -1 ? searches : opens).filter((_, i) => i !== index);
30
+ if (left.length === 0) delete rest[key];
31
+ else rest[key] = left;
32
+ const others = [
33
+ ...searches.flatMap(
34
+ (v, i) => key === "search_query" && i === index ? [] : isRecord(v) && typeof v.q === "string" && v.q.trim().length > 0 ? [{ tool: "WebSearch", query: v.q }] : []
35
+ ),
36
+ ...opens.flatMap(
37
+ (v, i) => key === "open" && i === index || !urlOpen(v) ? [] : [{ tool: "WebFetch", url: v.ref_id.trim() }]
38
+ )
39
+ ];
40
+ const operations = Object.keys(rest).filter((k) => k !== "response_length");
41
+ return { entry, rest: operations.length === 0 ? null : rest, targets: [entry, ...others] };
42
+ }
43
+ function decode(raw) {
44
+ if (!isRecord(raw)) return null;
45
+ const native = str(raw.hook_event_name);
46
+ if (native === void 0 || !Object.hasOwn(NATIVE_TO_EVENT, native)) return null;
47
+ const event = NATIVE_TO_EVENT[native];
48
+ const session = str(raw.session_id);
49
+ if (session === void 0 || session.length === 0) return null;
50
+ const input = { event, session, cwd: str(raw.cwd) ?? "" };
51
+ if (raw.agent_id !== void 0 && raw.agent_id !== null) {
52
+ const id = raw.agent_id;
53
+ if (typeof id !== "string" || !AGENT_ID_RE.test(id)) return null;
54
+ input.agent = id;
55
+ }
56
+ const prompt = str(raw.prompt);
57
+ if (prompt !== void 0) input.prompt = prompt;
58
+ const path = str(raw.transcript_path);
59
+ if (path !== void 0) input.transcriptPath = path;
60
+ if (event === "tool.before" || event === "tool.after") {
61
+ const tool = { name: str(raw.tool_name) ?? "" };
62
+ const callId = str(raw.tool_use_id);
63
+ if (callId !== void 0) tool.callId = callId;
64
+ if (event === "tool.after") {
65
+ const blocks = Array.isArray(raw.tool_response) ? raw.tool_response : void 0;
66
+ const text = str(raw.tool_response) ?? (blocks?.every((b) => isRecord(b) && b.type === "input_text" && typeof b.text === "string") ? blocks.map((b) => String(b.text)).join("\n") : void 0);
67
+ if (text !== void 0) tool.result = { text };
68
+ }
69
+ input.tool = tool;
70
+ }
71
+ return input;
72
+ }
73
+
74
+ // src/router/codex-event.ts
75
+ function codexRouterEvent(raw) {
76
+ const input = decode(raw);
77
+ if (input === null || input.agent !== void 0 || input.session.length > 200) return null;
78
+ const common = {
79
+ sessionId: input.session,
80
+ ...input.cwd ? { cwd: input.cwd } : {},
81
+ ...input.transcriptPath !== void 0 ? { transcriptPath: input.transcriptPath } : {}
82
+ };
83
+ if (input.event === "prompt" && input.prompt !== void 0)
84
+ return { kind: "prompt", ...common, prompt: input.prompt };
85
+ const tool = input.tool;
86
+ const toolInput = raw.tool_input;
87
+ if (tool?.name !== "webrun" || toolInput === null || typeof toolInput !== "object") return null;
88
+ const split = splitWebrun(toolInput);
89
+ if (split === null) return null;
90
+ const call = {
91
+ ...common,
92
+ tool: split.entry.tool,
93
+ pending: split.entry,
94
+ ...split.rest !== null ? { rest: split.rest } : {},
95
+ targets: split.targets,
96
+ ...tool.callId !== void 0 ? { toolUseId: tool.callId } : {}
97
+ };
98
+ if (input.event === "tool.before") return { kind: "native", ...call };
99
+ if (input.event !== "tool.after") return null;
100
+ const text = tool.result?.text;
101
+ return {
102
+ kind: "shortfall",
103
+ ...call,
104
+ eventName: "PostToolUse",
105
+ nativeOutcome: text === "" ? { error: "Web search returned no results" } : null,
106
+ savedPdf: null
107
+ };
108
+ }
109
+ function codexSession(sessionId) {
110
+ return `codex:${sessionId}`;
111
+ }
112
+ function codexResponse(response) {
113
+ if (response === null || typeof response !== "object") return null;
114
+ const { hookSpecificOutput: output, systemMessage } = response;
115
+ const message = typeof systemMessage === "string" ? { systemMessage } : {};
116
+ if (output === void 0) return Object.keys(message).length > 0 ? message : null;
117
+ return { hookSpecificOutput: output, ...message };
118
+ }
119
+
120
+ export {
121
+ codexRouterEvent,
122
+ codexSession,
123
+ codexResponse
124
+ };
125
+ //# sourceMappingURL=chunk-KFVJYLVL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/router/codex-wire.ts","../src/router/codex-event.ts"],"sourcesContent":["import { isRecord } from '../lib/guards';\n\n/**\n * Codex CLI's hook payloads, as the router reads them. Every mapping here is\n * backed by a payload the installed `codex-cli 0.153.4` sent\n * (`fixtures/harness/codex/README.md`, captured 2026-09-08); the schema source\n * is openai/codex at `rust-v0.153.4`.\n *\n * The router's legs read the root session's prompt and the web tool\n * (`webrun`), so that is what is decoded: the prompt, the tool call before and\n * after it runs, and who they belong to. Every other event drops. The web tool\n * is read through {@link splitWebrun}.\n */\n\nconst NATIVE_TO_EVENT = {\n UserPromptSubmit: 'prompt',\n PreToolUse: 'tool.before',\n PostToolUse: 'tool.after',\n} as const;\n\nexport type CodexEvent = (typeof NATIVE_TO_EVENT)[keyof typeof NATIVE_TO_EVENT];\n\n/**\n * A child's id as Codex names it (the child's own thread id). One that fails\n * this is a child this build cannot name, so its fire drops rather than being\n * filed under the lead.\n */\nexport const AGENT_ID_RE = /^[A-Za-z0-9_-]{1,128}$/;\n\nexport interface CodexTool {\n name: string;\n callId?: string;\n /** The output text, on `tool.after`; Codex sends no exit status with it. */\n result?: { text: string };\n}\n\nexport interface CodexHookInput {\n event: CodexEvent;\n /** The root session, on every event of a run, inside children too. */\n session: string;\n /** The child the fire came from; absent for the lead. */\n agent?: string;\n cwd: string;\n prompt?: string;\n transcriptPath?: string;\n tool?: CodexTool;\n}\n\nfunction str(v: unknown): string | undefined {\n return typeof v === 'string' ? v : undefined;\n}\n\n/** One search or one page open, as the router weighs it. */\nexport type WebrunEntry = { tool: 'WebSearch'; query: string } | { tool: 'WebFetch'; url: string };\n\n/**\n * A `webrun` call as the router reads it: the one entry it weighs, the exact\n * rest of the call, and every search and URL in it.\n */\nexport interface WebrunSplit {\n entry: WebrunEntry;\n /** The input without the entry, filters and all; null when no operation remains. */\n rest: Record<string, unknown> | null;\n /** Every search and URL in the call, the entry first. */\n targets: WebrunEntry[];\n}\n\nconst HTTP_URL_RE = /^https?:\\/\\//i;\n\nconst plainSearch = (v: unknown): v is { q: string } =>\n isRecord(v) &&\n Object.keys(v).every((key) => key === 'q') &&\n typeof v.q === 'string' &&\n v.q.trim().length > 0;\n\nconst urlOpen = (v: unknown): v is { ref_id: string } =>\n isRecord(v) && typeof v.ref_id === 'string' && HTTP_URL_RE.test(v.ref_id.trim());\n\n/**\n * Pure. The entry is the first search that is only `q`, else the first open of\n * an http(s) URL with no `lineno`; null when the call holds neither. The rest\n * is the input minus that one entry, so entry plus rest is the whole call.\n */\nexport function splitWebrun(input: Record<string, unknown>): WebrunSplit | null {\n const searches = Array.isArray(input.search_query) ? (input.search_query as unknown[]) : [];\n const opens = Array.isArray(input.open) ? (input.open as unknown[]) : [];\n const s = searches.findIndex(plainSearch);\n const o =\n s === -1\n ? opens.findIndex((v) => urlOpen(v) && Object.keys(v as object).every((k) => k === 'ref_id'))\n : -1;\n if (s === -1 && o === -1) return null;\n const key = s !== -1 ? 'search_query' : 'open';\n const index = s !== -1 ? s : o;\n const entry: WebrunEntry =\n s !== -1\n ? { tool: 'WebSearch', query: (searches[s] as { q: string }).q }\n : { tool: 'WebFetch', url: (opens[o] as { ref_id: string }).ref_id.trim() };\n const rest: Record<string, unknown> = { ...input };\n const left = (s !== -1 ? searches : opens).filter((_, i) => i !== index);\n if (left.length === 0) delete rest[key];\n else rest[key] = left;\n const others: WebrunEntry[] = [\n ...searches.flatMap((v, i): WebrunEntry[] =>\n key === 'search_query' && i === index\n ? []\n : isRecord(v) && typeof v.q === 'string' && v.q.trim().length > 0\n ? [{ tool: 'WebSearch', query: v.q }]\n : [],\n ),\n ...opens.flatMap((v, i): WebrunEntry[] =>\n (key === 'open' && i === index) || !urlOpen(v)\n ? []\n : [{ tool: 'WebFetch', url: v.ref_id.trim() }],\n ),\n ];\n const operations = Object.keys(rest).filter((k) => k !== 'response_length');\n return { entry, rest: operations.length === 0 ? null : rest, targets: [entry, ...others] };\n}\n\n/**\n * Pure. Returns null for an event the router does not read, a missing session,\n * or an `agent_id` that is present but fails {@link AGENT_ID_RE}.\n */\nexport function decode(raw: unknown): CodexHookInput | null {\n if (!isRecord(raw)) return null;\n const native = str(raw.hook_event_name);\n if (native === undefined || !Object.hasOwn(NATIVE_TO_EVENT, native)) return null;\n const event = NATIVE_TO_EVENT[native as keyof typeof NATIVE_TO_EVENT];\n const session = str(raw.session_id);\n if (session === undefined || session.length === 0) return null;\n\n const input: CodexHookInput = { event, session, cwd: str(raw.cwd) ?? '' };\n if (raw.agent_id !== undefined && raw.agent_id !== null) {\n const id = raw.agent_id;\n if (typeof id !== 'string' || !AGENT_ID_RE.test(id)) return null;\n input.agent = id;\n }\n const prompt = str(raw.prompt);\n if (prompt !== undefined) input.prompt = prompt;\n const path = str(raw.transcript_path);\n if (path !== undefined) input.transcriptPath = path;\n\n if (event === 'tool.before' || event === 'tool.after') {\n const tool: CodexTool = { name: str(raw.tool_name) ?? '' };\n const callId = str(raw.tool_use_id);\n if (callId !== undefined) tool.callId = callId;\n if (event === 'tool.after') {\n // The response is the output text and nothing else: a string, or a list\n // of `input_text` blocks. Any other shape is no result.\n const blocks = Array.isArray(raw.tool_response) ? raw.tool_response : undefined;\n const text =\n str(raw.tool_response) ??\n (blocks?.every((b) => isRecord(b) && b.type === 'input_text' && typeof b.text === 'string')\n ? blocks.map((b) => String((b as Record<string, unknown>).text)).join('\\n')\n : undefined);\n if (text !== undefined) tool.result = { text };\n }\n input.tool = tool;\n }\n return input;\n}\n","import { decode, splitWebrun } from './codex-wire';\nimport type { HookEvent } from './hooks';\n\n/**\n * A Codex hook event as the router's arms read it: the root session's prompt,\n * and any `webrun` call holding a plain search or a URL open, read as that one\n * entry ({@link splitWebrun}) with the rest of the call beside it. A child's\n * task is ciphertext. Everything else is null. Codex has no\n * PostToolUseFailure and returns one text for the whole call, so the\n * after-call arm reads a shortfall only from an empty result.\n */\nexport function codexRouterEvent(raw: unknown): HookEvent | null {\n const input = decode(raw);\n if (input === null || input.agent !== undefined || input.session.length > 200) return null;\n const common = {\n sessionId: input.session,\n ...(input.cwd ? { cwd: input.cwd } : {}),\n ...(input.transcriptPath !== undefined ? { transcriptPath: input.transcriptPath } : {}),\n };\n if (input.event === 'prompt' && input.prompt !== undefined)\n return { kind: 'prompt', ...common, prompt: input.prompt };\n const tool = input.tool;\n const toolInput = (raw as { tool_input?: unknown }).tool_input;\n if (tool?.name !== 'webrun' || toolInput === null || typeof toolInput !== 'object') return null;\n const split = splitWebrun(toolInput as Record<string, unknown>);\n if (split === null) return null;\n const call = {\n ...common,\n tool: split.entry.tool,\n pending: split.entry,\n ...(split.rest !== null ? { rest: split.rest } : {}),\n targets: split.targets,\n ...(tool.callId !== undefined ? { toolUseId: tool.callId } : {}),\n };\n if (input.event === 'tool.before') return { kind: 'native', ...call };\n if (input.event !== 'tool.after') return null;\n const text = tool.result?.text;\n return {\n kind: 'shortfall',\n ...call,\n eventName: 'PostToolUse',\n nativeOutcome: text === '' ? { error: 'Web search returned no results' } : null,\n savedPdf: null,\n };\n}\n\n/** Where a Codex session's local state lives, never shared with Claude's. */\nexport function codexSession(sessionId: string): string {\n return `codex:${sessionId}`;\n}\n\n/**\n * A Claude-shaped answer as Codex takes it: `hookSpecificOutput` as it is (a\n * deny, or a line after the call in `additionalContext`, such as a free\n * lookup noted on a search), and `systemMessage`, the line for the user (an\n * unpaid routing fee, a deposit): Codex takes it on every event and shows it\n * as a warning (openai/codex `hooks/src/events/*.rs`, CLI 0.157.1). Nothing\n * else survives, because Codex refuses an answer carrying a field it does not\n * know.\n */\nexport function codexResponse(response: unknown): unknown {\n if (response === null || typeof response !== 'object') return null;\n const { hookSpecificOutput: output, systemMessage } = response as {\n hookSpecificOutput?: Record<string, unknown>;\n systemMessage?: unknown;\n };\n const message = typeof systemMessage === 'string' ? { systemMessage } : {};\n if (output === undefined) return Object.keys(message).length > 0 ? message : null;\n return { hookSpecificOutput: output, ...message };\n}\n"],"mappings":";;;;;;AAcA,IAAM,kBAAkB;AAAA,EACtB,kBAAkB;AAAA,EAClB,YAAY;AAAA,EACZ,aAAa;AACf;AASO,IAAM,cAAc;AAqB3B,SAAS,IAAI,GAAgC;AAC3C,SAAO,OAAO,MAAM,WAAW,IAAI;AACrC;AAiBA,IAAM,cAAc;AAEpB,IAAM,cAAc,CAAC,MACnB,SAAS,CAAC,KACV,OAAO,KAAK,CAAC,EAAE,MAAM,CAAC,QAAQ,QAAQ,GAAG,KACzC,OAAO,EAAE,MAAM,YACf,EAAE,EAAE,KAAK,EAAE,SAAS;AAEtB,IAAM,UAAU,CAAC,MACf,SAAS,CAAC,KAAK,OAAO,EAAE,WAAW,YAAY,YAAY,KAAK,EAAE,OAAO,KAAK,CAAC;AAO1E,SAAS,YAAY,OAAoD;AAC9E,QAAM,WAAW,MAAM,QAAQ,MAAM,YAAY,IAAK,MAAM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AG;AAAA,IACH,WAAW;AAAA,IACX,eAAe,SAAS,KAAK,EAAE,OAAO,iCAAiC,IAAI;AAAA,IAC3E,UAAU;AAAA,EACZ;AACF;AAGO,SAAS,aAAa,WAA2B;AACtD,SAAO,SAAS,SAAS;AAC3B;AAWO,SAAS,cAAc,UAA4B;AACxD,MAAI,aAAa,QAAQ,OAAO,aAAa,SAAU,QAAO;AAC9D,QAAM,EAAE,oBAAoB,QAAQ,cAAc,IAAI;AAItD,QAAM,UAAU,OAAO,kBAAkB,WAAW,EAAE,cAAc,IAAI,CAAC;AACzE,MAAI,WAAW,OAAW,QAAO,OAAO,KAAK,OAAO,EAAE,SAAS,IAAI,UAAU;AAC7E,SAAO,EAAE,oBAAoB,QAAQ,GAAG,QAAQ;AAClD;","names":[]}
@@ -0,0 +1,69 @@
1
+ import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
+ import {
3
+ usd
4
+ } from "./chunk-HZKANST2.js";
5
+ import {
6
+ toMoney
7
+ } from "./chunk-MEZJ3I63.js";
8
+ import {
9
+ DEFAULT_MAX_AUTO_SPEND,
10
+ DEFAULT_SESSION_BUDGET
11
+ } from "./chunk-UIB33QQP.js";
12
+
13
+ // src/router/spend-question.ts
14
+ var ROUTER_DEFAULTS = {
15
+ maxAutoSpend: DEFAULT_MAX_AUTO_SPEND,
16
+ sessionBudget: DEFAULT_SESSION_BUDGET
17
+ };
18
+ function shownLimits(config) {
19
+ return {
20
+ maxAutoSpend: config.maxAutoSpend ?? ROUTER_DEFAULTS.maxAutoSpend,
21
+ sessionBudget: config.sessionBudget ?? ROUTER_DEFAULTS.sessionBudget
22
+ };
23
+ }
24
+ function limitsLine(policy) {
25
+ const daily = policy.sessionBudgetAtomic === null ? "no daily limit" : `$${usd(policy.sessionBudgetAtomic)} a day`;
26
+ return `$${usd(policy.maxAutoSpendAtomic)} a call \xB7 ${daily}`;
27
+ }
28
+ function limitsUsd(limits) {
29
+ return {
30
+ maxAutoSpend: toMoney(limits.maxAutoSpend).usd,
31
+ sessionBudget: limits.sessionBudget === "none" ? "none" : toMoney(limits.sessionBudget).usd
32
+ };
33
+ }
34
+ var ROUTING_FEE_TERMS = "Tenjin charges 15% of the estimated tool cost for paid recommendations. Tool use is billed separately. Routing top-ups count toward your limits.";
35
+ var FEE_APPROVAL = "Either choice approves this.";
36
+ var DEFAULTS_USD = limitsUsd(ROUTER_DEFAULTS);
37
+ var SPEND_QUESTION = "How much can your agent spend from its balance?";
38
+ var DEFAULTS_LABEL = `Up to $${DEFAULTS_USD.maxAutoSpend} a call and $${DEFAULTS_USD.sessionBudget} a day`;
39
+ function spendChoiceQuestion() {
40
+ return `${SPEND_QUESTION} ${ROUTING_FEE_TERMS} ${FEE_APPROVAL}`;
41
+ }
42
+ function spendOptions(install) {
43
+ return [
44
+ { id: "default", label: DEFAULTS_LABEL, recommended: true, command: `${install} --yes` },
45
+ {
46
+ id: "custom",
47
+ label: "Set my own limits",
48
+ recommended: false,
49
+ ask: [
50
+ "Daily budget shared across chats, in USD, or none for no limit",
51
+ "Ordinary-tool per-call limit in USD. DeepSeek inference uses its separate job ceiling. Zero blocks positive automatic payments."
52
+ ],
53
+ command: `${install} --max-auto-spend <usd> --session-budget <usd|none>`
54
+ }
55
+ ];
56
+ }
57
+
58
+ export {
59
+ ROUTER_DEFAULTS,
60
+ shownLimits,
61
+ limitsLine,
62
+ ROUTING_FEE_TERMS,
63
+ FEE_APPROVAL,
64
+ SPEND_QUESTION,
65
+ DEFAULTS_LABEL,
66
+ spendChoiceQuestion,
67
+ spendOptions
68
+ };
69
+ //# sourceMappingURL=chunk-KGUE5AVX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/router/spend-question.ts"],"sourcesContent":["import { DEFAULT_MAX_AUTO_SPEND, DEFAULT_SESSION_BUDGET } from '../lib/config';\nimport { toMoney } from '../lib/money';\nimport { usd } from './fee';\n\n/**\n * THE SPEND QUESTION, ONE TEXT FOR EVERY PLACE THAT ASKS IT: how much the\n * agent may spend, the defaults or your own limits. The selector in a terminal and the question an install\n * that could not ask hands to its agent show the same words, so the agent puts\n * to the person exactly what the selector would have. The defaults hold\n * whether or not anyone answers.\n */\n\n/** The automatic router defaults, in atomic USDC: $1 a call, $5 a day. */\nexport const ROUTER_DEFAULTS = {\n maxAutoSpend: DEFAULT_MAX_AUTO_SPEND,\n sessionBudget: DEFAULT_SESSION_BUDGET,\n} as const;\n\n/** The automatic limits install writes, in atomic USDC; `sessionBudget` may be `none`. */\nexport interface RouterLimits {\n maxAutoSpend: string;\n sessionBudget: string;\n}\n\n/** The file's own value where it names one, else the default. */\nexport function shownLimits(config: {\n maxAutoSpend?: string | undefined;\n sessionBudget?: string | undefined;\n}): RouterLimits {\n return {\n maxAutoSpend: config.maxAutoSpend ?? ROUTER_DEFAULTS.maxAutoSpend,\n sessionBudget: config.sessionBudget ?? ROUTER_DEFAULTS.sessionBudget,\n };\n}\n\n/** `$1.00 a call · $5.00 a day`: the limits a policy holds, as a person reads them. */\nexport function limitsLine(policy: {\n maxAutoSpendAtomic: bigint;\n sessionBudgetAtomic: bigint | null;\n}): string {\n const daily =\n policy.sessionBudgetAtomic === null\n ? 'no daily limit'\n : `$${usd(policy.sessionBudgetAtomic)} a day`;\n return `$${usd(policy.maxAutoSpendAtomic)} a call · ${daily}`;\n}\n\n/** The limits in USD. */\nexport function limitsUsd(limits: RouterLimits): { maxAutoSpend: string; sessionBudget: string } {\n return {\n maxAutoSpend: toMoney(limits.maxAutoSpend).usd,\n sessionBudget: limits.sessionBudget === 'none' ? 'none' : toMoney(limits.sessionBudget).usd,\n };\n}\n\n/** The fee terms approved with either spending-limit choice. */\nexport const ROUTING_FEE_TERMS =\n 'Tenjin charges 15% of the estimated tool cost for paid recommendations. Tool use is billed separately. Routing top-ups count toward your limits.';\n\n/** The selector's own line: either answer approves the fee. */\nexport const FEE_APPROVAL = 'Either choice approves this.';\n\nconst DEFAULTS_USD = limitsUsd(ROUTER_DEFAULTS);\n\n/** The question, for the agent to put to the person as written. */\nexport const SPEND_QUESTION = 'How much can your agent spend from its balance?';\n\n/** The recommended answer: the defaults, as amounts. */\nexport const DEFAULTS_LABEL = `Up to $${DEFAULTS_USD.maxAutoSpend} a call and $${DEFAULTS_USD.sessionBudget} a day`;\n\n/** The question with the fee terms either answer approves. */\nexport function spendChoiceQuestion(): string {\n return `${SPEND_QUESTION} ${ROUTING_FEE_TERMS} ${FEE_APPROVAL}`;\n}\n\n/** One answer to {@link spendChoiceQuestion}, and the one command that applies it. */\nexport interface SpendOption {\n id: 'default' | 'custom';\n label: string;\n recommended: boolean;\n /** What to ask the person after they pick this option, before running `command`. */\n ask?: string[];\n /** The command the agent runs alone for this answer. */\n command: string;\n}\n\n/**\n * The two answers, each applied by the agent with one command and never by\n * the person: `install` is the install that was run (its `--project` and\n * `--no-wallet` kept), so the answer leaves every other choice as it was.\n */\nexport function spendOptions(install: string): SpendOption[] {\n return [\n { id: 'default', label: DEFAULTS_LABEL, recommended: true, command: `${install} --yes` },\n {\n id: 'custom',\n label: 'Set my own limits',\n recommended: false,\n ask: [\n 'Daily budget shared across chats, in USD, or none for no limit',\n 'Ordinary-tool per-call limit in USD. DeepSeek inference uses its separate job ceiling. Zero blocks positive automatic payments.',\n ],\n command: `${install} --max-auto-spend <usd> --session-budget <usd|none>`,\n },\n ];\n}\n"],"mappings":";;;;;;;;;;;;;AAaO,IAAM,kBAAkB;AAAA,EAC7B,cAAc;AAAA,EACd,eAAe;AACjB;AASO,SAAS,YAAY,QAGX;AACf,SAAO;AAAA,IACL,cAAc,OAAO,gBAAgB,gBAAgB;AAAA,IACrD,eAAe,OAAO,iBAAiB,gBAAgB;AAAA,EACzD;AACF;AAGO,SAAS,WAAW,QAGhB;AACT,QAAM,QACJ,OAAO,wBAAwB,OAC3B,mBACA,IAAI,IAAI,OAAO,mBAAmB,CAAC;AACzC,SAAO,IAAI,IAAI,OAAO,kBAAkB,CAAC,gBAAa,KAAK;AAC7D;AAGO,SAAS,UAAU,QAAuE;AAC/F,SAAO;AAAA,IACL,cAAc,QAAQ,OAAO,YAAY,EAAE;AAAA,IAC3C,eAAe,OAAO,kBAAkB,SAAS,SAAS,QAAQ,OAAO,aAAa,EAAE;AAAA,EAC1F;AACF;AAGO,IAAM,oBACX;AAGK,IAAM,eAAe;AAE5B,IAAM,eAAe,UAAU,eAAe;AAGvC,IAAM,iBAAiB;AAGvB,IAAM,iBAAiB,UAAU,aAAa,YAAY,gBAAgB,aAAa,aAAa;AAGpG,SAAS,sBAA8B;AAC5C,SAAO,GAAG,cAAc,IAAI,iBAAiB,IAAI,YAAY;AAC/D;AAkBO,SAAS,aAAa,SAAgC;AAC3D,SAAO;AAAA,IACL,EAAE,IAAI,WAAW,OAAO,gBAAgB,aAAa,MAAM,SAAS,GAAG,OAAO,SAAS;AAAA,IACvF;AAAA,MACE,IAAI;AAAA,MACJ,OAAO;AAAA,MACP,aAAa;AAAA,MACb,KAAK;AAAA,QACH;AAAA,QACA;AAAA,MACF;AAAA,MACA,SAAS,GAAG,OAAO;AAAA,IACrB;AAAA,EACF;AACF;","names":[]}
@@ -1,10 +1,10 @@
1
1
  import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
2
  import {
3
3
  external_exports
4
- } from "./chunk-SNNSAGMT.js";
4
+ } from "./chunk-P6YQWIT2.js";
5
5
  import {
6
6
  CliError
7
- } from "./chunk-3UCIG4TG.js";
7
+ } from "./chunk-DI4QAGRZ.js";
8
8
 
9
9
  // src/lib/output.ts
10
10
  import { WriteStream } from "node:tty";
@@ -26,34 +26,18 @@ var ErrorCodeSchema = external_exports.enum([
26
26
  "REFUSED",
27
27
  "NETWORK_ERROR",
28
28
  "INTERNAL",
29
- "NOT_IMPLEMENTED",
30
- // B2 (search/inspect/buy/outcome): a policy refusal (exit 3) has its own code
31
- // so an agent can distinguish a spend-cap block from a generic REFUSED; a
32
- // payment that failed after approval (exit 4) is PAYMENT_FAILED; the read
33
- // route's own coded failures (402 preview parse, 409 gate) surface as these.
29
+ // A policy refusal (exit 3) has its own code so an agent can distinguish a
30
+ // spend-cap block from a generic REFUSED; a payment that failed after
31
+ // approval (exit 4) is PAYMENT_FAILED.
34
32
  "POLICY_REFUSED",
35
33
  "PAYMENT_FAILED",
36
34
  "RESOURCE_NOT_FOUND",
37
- "SEARCH_NOT_FOUND",
38
- // A 429 from the anonymous search/outcome/read limits; error.details carries
39
- // retryAfterSeconds so a looping agent can back off instead of hammering.
35
+ // A 429 from a rate-limited endpoint; error.details carries retryAfterSeconds
36
+ // so a looping agent can back off instead of hammering.
40
37
  "RATE_LIMITED",
41
- // B3 (publish): a publish that needs the human's yes (exit 3) — soft scan
42
- // findings, or `review` mode always. NEEDS_CONFIRMATION clears with --yes;
43
- // PUBLISH_BLOCKED is a hard-block finding (a live secret) that no mode or --yes
44
- // ever clears. PUBLISH_FAILED (exit 4) is a write that failed AFTER approval,
45
- // mirroring PAYMENT_FAILED's post-decision failure class.
46
- "NEEDS_CONFIRMATION",
47
- "PUBLISH_BLOCKED",
48
- "PUBLISH_FAILED",
49
38
  // A send that reverted or produced no receipt AFTER the human approved it and
50
39
  // it was broadcast (exit 4), same post-decision class as PAYMENT_FAILED.
51
40
  "SEND_FAILED",
52
- // `tenjin delete`: the soft-delete failed AFTER the human confirmed it (exit
53
- // 4). Its own code rather than PUBLISH_FAILED because the two say opposite
54
- // things about what is now live, and an agent reporting the outcome to a user
55
- // must not read "the piece is still up" as "the piece went up".
56
- "DELETE_FAILED",
57
41
  // `tenjin update`: the npm install it spawned exited nonzero or never started.
58
42
  // Exit 1, not the post-decision class: nothing is half-written that the
59
43
  // operator must reconcile, and the old build keeps running.
@@ -68,44 +52,10 @@ var ErrorCodeSchema = external_exports.enum([
68
52
  // raising `--max-http-header-size` on the process that runs the CLI.
69
53
  "CHALLENGE_TOO_LARGE"
70
54
  ]);
71
- var MoneySchema = external_exports.object({
72
- atomic: external_exports.string(),
73
- usd: external_exports.string()
74
- });
75
- var OutputErrorSchema = external_exports.object({
76
- code: ErrorCodeSchema,
77
- message: external_exports.string(),
78
- fix: external_exports.string().optional(),
79
- details: external_exports.unknown().optional()
80
- });
81
- var UpdateAvailableSchema = external_exports.object({
82
- current: external_exports.string(),
83
- latest: external_exports.string()
84
- });
85
- var SuccessEnvelopeSchema = external_exports.object({
86
- schemaVersion: external_exports.literal(SCHEMA_VERSION),
87
- command: external_exports.string(),
88
- ok: external_exports.literal(true),
89
- data: external_exports.unknown(),
90
- /** Present only when a newer version is known and update.mode is not `off`. */
91
- updateAvailable: UpdateAvailableSchema.optional()
92
- });
93
- var FailureEnvelopeSchema = external_exports.object({
94
- schemaVersion: external_exports.literal(SCHEMA_VERSION),
95
- command: external_exports.string(),
96
- ok: external_exports.literal(false),
97
- error: OutputErrorSchema,
98
- updateAvailable: UpdateAvailableSchema.optional()
99
- });
100
- var OutputEnvelopeSchema = external_exports.discriminatedUnion("ok", [
101
- SuccessEnvelopeSchema,
102
- FailureEnvelopeSchema
103
- ]);
104
55
 
105
56
  // src/lib/output.ts
106
57
  function defaultIo() {
107
58
  return {
108
- stdin: { stream: process.stdin, isTTY: Boolean(process.stdin.isTTY) },
109
59
  stdout: process.stdout,
110
60
  stderr: process.stderr,
111
61
  isTTY: Boolean(process.stdout.isTTY)
@@ -140,7 +90,7 @@ function emitSuccess(io, command, data, humanLines = [], opts = {}) {
140
90
  writeLines(io.stdout, humanLines);
141
91
  return;
142
92
  }
143
- writeJson(io.stdout, buildSuccessEnvelope(command, data, opts.updateAvailable));
93
+ writeJson(io.stdout, buildSuccessEnvelope(command, data, opts.updateAvailable), opts.compactJson);
144
94
  }
145
95
  function emitFailure(io, command, err, opts = {}) {
146
96
  const cliErr = normalizeError(err);
@@ -149,7 +99,6 @@ function emitFailure(io, command, err, opts = {}) {
149
99
  if (cliErr.fix !== void 0) {
150
100
  lines.push(paint(io, "dim", `fix: ${sanitizeForTerminal(cliErr.fix)}`));
151
101
  }
152
- lines.push(...findingLines(io, cliErr.details));
153
102
  writeLines(io.stdout, lines);
154
103
  return cliErr;
155
104
  }
@@ -183,31 +132,8 @@ function normalizeError(err) {
183
132
  function humanMode(io, opts) {
184
133
  return io.isTTY && opts.json !== true;
185
134
  }
186
- function findingLines(io, details) {
187
- if (typeof details !== "object" || details === null || !("findings" in details)) return [];
188
- const { findings } = details;
189
- if (!Array.isArray(findings) || findings.length === 0) return [];
190
- const rendered = [];
191
- for (const f of findings) {
192
- if (typeof f !== "object" || f === null) continue;
193
- const { check, line, excerpt, source, severity } = f;
194
- if (typeof check !== "string" || typeof line !== "number" || typeof excerpt !== "string") {
195
- continue;
196
- }
197
- const from = source === "server" ? " [server]" : source === "both" ? " [local+server]" : "";
198
- const tier = typeof severity === "string" && severity.length > 0 ? `${severity}, ` : "";
199
- rendered.push(
200
- paint(
201
- io,
202
- "dim",
203
- ` ${sanitizeForTerminal(check)}${from} (${sanitizeForTerminal(tier)}line ${line}): ${sanitizeForTerminal(excerpt)}`
204
- )
205
- );
206
- }
207
- return rendered;
208
- }
209
- function writeJson(stream, value) {
210
- stream.write(`${JSON.stringify(value, null, 2)}
135
+ function writeJson(stream, value, compact = false) {
136
+ stream.write(`${JSON.stringify(value, null, compact ? void 0 : 2)}
211
137
  `);
212
138
  }
213
139
  function writeLines(stream, lines) {
@@ -236,4 +162,4 @@ export {
236
162
  style,
237
163
  paint
238
164
  };
239
- //# sourceMappingURL=chunk-FVIGCDSV.js.map
165
+ //# sourceMappingURL=chunk-KLDMLWXT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/output.ts","../src/schemas.ts"],"sourcesContent":["import { WriteStream } from 'node:tty';\nimport { styleText } from 'node:util';\nimport { CliError } from './errors';\nimport { SCHEMA_VERSION } from '../schemas';\nimport type { UpdateAvailable } from '../schemas';\nimport type { FailureEnvelope, OutputError, SuccessEnvelope } from '../schemas';\n\n/**\n * Injected streams and TTY facts, so tests drive the CLI in-process with memory\n * buffers. `isTTY` describes stdout; `--json` is a separate flag, so `--json`\n * on a TTY still yields pure machine output.\n */\nexport interface Io {\n stdout: NodeJS.WritableStream;\n stderr: NodeJS.WritableStream;\n isTTY: boolean;\n}\n\nexport function defaultIo(): Io {\n return {\n stdout: process.stdout,\n stderr: process.stderr,\n isTTY: Boolean(process.stdout.isTTY),\n };\n}\n\nexport interface EmitOptions {\n /** The global --json flag. When true, the JSON envelope is emitted even at a TTY. */\n json?: boolean;\n /** Keep a complete agent handoff on one line, including through `tail`. */\n compactJson?: boolean;\n /**\n * \"A newer tenjin-cli exists\", from the daily check's cache. Rides the\n * envelope so an agent learns it; a human at a TTY gets a stderr line.\n */\n updateAvailable?: UpdateAvailable | null;\n}\n\n/**\n * The pure envelope builders, shared by the CLI's emit functions and the MCP\n * adapter so both surfaces produce the same wire object.\n */\nexport function buildSuccessEnvelope(\n command: string,\n data: unknown,\n updateAvailable?: UpdateAvailable | null,\n): SuccessEnvelope {\n return {\n schemaVersion: SCHEMA_VERSION,\n command,\n ok: true,\n data,\n ...(updateAvailable != null ? { updateAvailable: updateAvailable } : {}),\n };\n}\n\nexport function buildFailureEnvelope(\n command: string,\n err: CliError,\n updateAvailable?: UpdateAvailable | null,\n): FailureEnvelope {\n const error: OutputError = {\n code: err.code,\n message: err.message,\n ...(err.fix !== undefined ? { fix: err.fix } : {}),\n ...(err.details !== undefined ? { details: err.details } : {}),\n };\n return {\n schemaVersion: SCHEMA_VERSION,\n command,\n ok: false,\n error,\n ...(updateAvailable != null ? { updateAvailable: updateAvailable } : {}),\n };\n}\n\n/**\n * Output contract (human-first): at a TTY without `--json`, print ONLY the human\n * rendering to stdout, no JSON envelope. With `--json`, or when stdout is not a\n * TTY (a pipe, an agent), print exactly one JSON envelope to stdout and nothing\n * else. Exit codes are identical on both paths; only the stdout shape differs.\n */\nexport function emitSuccess(\n io: Io,\n command: string,\n data: unknown,\n humanLines: string[] = [],\n opts: EmitOptions = {},\n): void {\n if (humanMode(io, opts)) {\n writeLines(io.stdout, humanLines);\n return;\n }\n writeJson(io.stdout, buildSuccessEnvelope(command, data, opts.updateAvailable), opts.compactJson);\n}\n\n/**\n * The failure half of the same contract: a red error line and a `fix` line in\n * human mode, otherwise one failure envelope. Returns the normalized CliError so\n * the caller reads its `exitCode`.\n */\nexport function emitFailure(\n io: Io,\n command: string,\n err: unknown,\n opts: EmitOptions = {},\n): CliError {\n const cliErr = normalizeError(err);\n if (humanMode(io, opts)) {\n // Error messages can embed server-sourced text (api error passthrough) and\n // never carry intentional ANSI, so sanitize before painting.\n const lines = [paint(io, 'red', `error: ${sanitizeForTerminal(cliErr.message)}`)];\n if (cliErr.fix !== undefined) {\n lines.push(paint(io, 'dim', `fix: ${sanitizeForTerminal(cliErr.fix)}`));\n }\n // `details` is machine-only: a human sees the message and the fix.\n writeLines(io.stdout, lines);\n return cliErr;\n }\n writeJson(io.stdout, buildFailureEnvelope(command, cliErr, opts.updateAvailable));\n return cliErr;\n}\n\n/**\n * One dim advisory line on stderr, human mode only, for facts that belong to no\n * command's result (an unreadable spend ledger, a newer release). Sanitized\n * here because what these lines quote is not the command's own prose.\n */\nexport function emitNotice(io: Io, text: string, opts: EmitOptions = {}): void {\n if (!humanMode(io, opts)) return;\n io.stderr.write(`${paint(io, 'dim', sanitizeForTerminal(text))}\\n`);\n}\n\n/**\n * The same dim stderr line on every surface, with no TTY or `--json` gate. Only\n * for what a piped run must not miss: a write to the operator's own files, or\n * `fund`'s checkout link, which expires before the stdout envelope is written.\n * Everything else belongs in {@link emitNotice}. stdout is untouched.\n */\nexport function emitWriteNotice(io: Io, text: string): void {\n io.stderr.write(`${paint(io, 'dim', sanitizeForTerminal(text))}\\n`);\n}\n\n/**\n * Every escape sequence a terminal writes: CSI (colour, cursor), OSC (including\n * the OSC-8 hyperlinks pnpm wraps package names in, ended by BEL or ST),\n * charset selection, and a stray ESC with a single final byte.\n *\n * Safe to reuse despite the `g` flag only through `String.replace`, which\n * resets `lastIndex`. Do not `test()` or `exec()` it.\n */\nexport const ANSI_ESCAPE_RE =\n // eslint-disable-next-line no-control-regex\n /\\x1b(?:\\[[0-9;?]*[ -/]*[@-~]|\\][^\\x07\\x1b]*(?:\\x07|\\x1b\\\\)|[@-Z\\\\-_])/g;\n\n/**\n * Strip ANSI escapes, C0/C1 controls, Unicode bidi formatting, and invisible\n * tag/BOM characters from a string headed for a terminal. Commands apply it to\n * every server-sourced string in human lines or the pay confirm prompt, since a\n * hostile server could otherwise overwrite or reorder the price a human is\n * confirming, or hide a payload in characters that draw as nothing. Not applied\n * to whole lines because trusted callers (doctor) paint their own colors.\n * JSON stdout keeps the server's bytes on purpose: a machine reading\n * codepoints is not fooled by rendering order the way a human is.\n */\nexport function sanitizeForTerminal(text: string): string {\n return (\n text\n // CSI/OSC/charset escape sequences first, then any stray ESC and the rest\n // of C0 (except \\t) plus DEL and the C1 range.\n .replace(ANSI_ESCAPE_RE, '')\n // eslint-disable-next-line no-control-regex\n .replace(/[\\x00-\\x08\\x0a-\\x1f\\x7f-\\x9f]/g, '')\n // The UAX#9 directional formatting set: the marks (LRM/RLM/ALM), the\n // embeddings and overrides (U+202A-U+202E), and the isolates\n // (U+2066-U+2069), so a human reads the bytes in order. Not all of Cf:\n // U+200D (ZWJ) joins legitimate emoji sequences.\n .replace(/[\\u061c\\u200e\\u200f\\u202a-\\u202e\\u2066-\\u2069]/g, '')\n // The Unicode tag block (U+E0000-U+E007F) and the BOM/ZWNBSP: tag\n // characters render as nothing, so a payload in them is invisible.\n // The three RGI subdivision flags survive byte-identical; any other tag\n // sequence draws as a bare black flag with the payload hidden behind it.\n // U+200B (ZWSP, CJK line breaks) and U+200C (ZWNJ, required in Persian)\n // stay, like ZWJ above.\n .replace(\n /(\\u{1F3F4}\\u{E0067}\\u{E0062}(?:\\u{E0065}\\u{E006E}\\u{E0067}|\\u{E0073}\\u{E0063}\\u{E0074}|\\u{E0077}\\u{E006C}\\u{E0073})\\u{E007F})|[\\u{E0000}-\\u{E007F}\\u{FEFF}]/gu,\n (_match, rgiFlag: string | undefined) => rgiFlag ?? '',\n )\n );\n}\n\n/** CliError passes through; every other thrown value becomes an INTERNAL CliError. */\nexport function normalizeError(err: unknown): CliError {\n if (err instanceof CliError) return err;\n if (err instanceof Error) return new CliError('INTERNAL', err.message, { cause: err });\n return new CliError('INTERNAL', 'Unexpected error', { details: err });\n}\n\n/** True in human-first mode: a TTY without --json. Otherwise the JSON envelope wins. */\nfunction humanMode(io: Io, opts: EmitOptions): boolean {\n return io.isTTY && opts.json !== true;\n}\n\nfunction writeJson(stream: NodeJS.WritableStream, value: unknown, compact = false): void {\n stream.write(`${JSON.stringify(value, null, compact ? undefined : 2)}\\n`);\n}\n\nfunction writeLines(stream: NodeJS.WritableStream, lines: string[]): void {\n if (lines.length > 0) stream.write(`${lines.join('\\n')}\\n`);\n}\n\nexport type StyleFormat = Parameters<typeof styleText>[0];\n\n/**\n * Does `stream` take ANSI color? Node's own rule (`shouldColorize`): FORCE_COLOR\n * wins when set, otherwise a TTY whose color depth is above 2 (which reads\n * NO_COLOR, NODE_DISABLE_COLORS and TERM). Decided here because styleText only\n * checks the stream from Node 22.13 and colors unconditionally before it.\n */\nexport function colorCapable(stream: unknown, env: NodeJS.ProcessEnv = process.env): boolean {\n const force = env.FORCE_COLOR;\n if (force !== undefined) return ['', '1', 'true', '2', '3'].includes(force);\n return stream instanceof WriteStream && stream.isTTY && stream.getColorDepth(env) > 2;\n}\n\n/** `text` in `format` when `stream` takes color, else plain. */\nexport function style(format: StyleFormat, text: string, stream: unknown = process.stdout): string {\n return colorCapable(stream) ? styleText(format, text, { validateStream: false }) : text;\n}\n\n/** Color a human line for stdout. A test or redirected sink is no TTY, so it comes out plain. */\nexport function paint(io: Io, format: StyleFormat, text: string): string {\n return style(format, text, io.stdout);\n}\n","import { z } from 'zod';\n\n/**\n * Bumped only on a breaking change to any stdout envelope shape. Agents pin on\n * this: a consumer that sees an unexpected value should refuse to parse rather\n * than guess. Every envelope carries it, success or failure.\n */\nexport const SCHEMA_VERSION = 1;\n\n/**\n * The closed set of machine error codes. `error.code` in a failure envelope is\n * always one of these; agents branch on it, humans read `message`/`fix`. The\n * exit-code mapping lives in lib/errors.ts (this enum is the single source of\n * the code names both sides agree on).\n */\nexport const ErrorCodeSchema = z.enum([\n 'NODE_UNSUPPORTED',\n 'USAGE',\n 'CONFIG_INVALID',\n 'WALLET_EXISTS',\n 'WALLET_MISSING',\n 'WALLET_INVALID_KEY',\n 'PROVIDER_ERROR',\n 'RPC_ERROR',\n 'API_UNREACHABLE',\n 'CONTRACT_MISMATCH',\n 'REFUSED',\n 'NETWORK_ERROR',\n 'INTERNAL',\n // A policy refusal (exit 3) has its own code so an agent can distinguish a\n // spend-cap block from a generic REFUSED; a payment that failed after\n // approval (exit 4) is PAYMENT_FAILED.\n 'POLICY_REFUSED',\n 'PAYMENT_FAILED',\n 'RESOURCE_NOT_FOUND',\n // A 429 from a rate-limited endpoint; error.details carries retryAfterSeconds\n // so a looping agent can back off instead of hammering.\n 'RATE_LIMITED',\n // A send that reverted or produced no receipt AFTER the human approved it and\n // it was broadcast (exit 4), same post-decision class as PAYMENT_FAILED.\n 'SEND_FAILED',\n // `tenjin update`: the npm install it spawned exited nonzero or never started.\n // Exit 1, not the post-decision class: nothing is half-written that the\n // operator must reconcile, and the old build keeps running.\n 'UPDATE_FAILED',\n // `tenjin pay` Bazaar lane: the live 402 does not match what a configured\n // registry publicly advertises for this resource (understood-but-refused, 3);\n // nothing was signed and nothing was spent.\n 'REGISTRY_MISMATCH',\n // The seller's 402 challenge exceeds this process's response-header limit, so\n // its terms could never be read (understood-but-refused, 3). Nothing was\n // signed and nothing was sent; a retry changes nothing without an operator\n // raising `--max-http-header-size` on the process that runs the CLI.\n 'CHALLENGE_TOO_LARGE',\n]);\nexport type ErrorCode = z.infer<typeof ErrorCodeSchema>;\n\n/**\n * All money in machine output is dual-form: `atomic` is the 6-decimal USDC base\n * unit as a decimal string (never a JS number — precision), `usd` is the same\n * value formatted as decimal dollars. Emit both so agents compute on `atomic`\n * and humans read `usd` without either side re-deriving the other.\n */\nexport interface Money {\n atomic: string;\n usd: string;\n}\n\nexport interface OutputError {\n code: ErrorCode;\n message: string;\n fix?: string;\n details?: unknown;\n}\n\n/**\n * \"A newer tenjin-cli exists\", carried on the envelope so an AGENT learns it.\n *\n * The daily check's other surface is one dim stderr line, which only a human at\n * a terminal ever sees; on the machines that run this CLI most, nobody does.\n * This field is how the agent driving the command finds out it can run\n * `tenjin update` itself. Read from the check's cache, never fetched here: the\n * envelope must not wait on a network call it did not need.\n */\nexport interface UpdateAvailable {\n current: string;\n latest: string;\n}\n\nexport interface SuccessEnvelope {\n schemaVersion: typeof SCHEMA_VERSION;\n command: string;\n ok: true;\n data: unknown;\n /** Present only when a newer version is known and update.mode is not `off`. */\n updateAvailable?: UpdateAvailable;\n}\n\nexport interface FailureEnvelope {\n schemaVersion: typeof SCHEMA_VERSION;\n command: string;\n ok: false;\n error: OutputError;\n updateAvailable?: UpdateAvailable;\n}\n\n/** The one thing every invocation prints to stdout, discriminated on `ok`. */\nexport type OutputEnvelope = SuccessEnvelope | FailureEnvelope;\n"],"mappings":";;;;;;;;;AAAA,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;;;ACMnB,IAAM,iBAAiB;AAQvB,IAAM,kBAAkB,iBAAE,KAAK;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA;AAAA;AAAA,EAIA;AAAA,EACA;AAAA,EACA;AAAA;AAAA;AAAA,EAGA;AAAA;AAAA;AAAA,EAGA;AAAA;AAAA;AAAA;AAAA,EAIA;AAAA;AAAA;AAAA;AAAA,EAIA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA;AACF,CAAC;;;ADpCM,SAAS,YAAgB;AAC9B,SAAO;AAAA,IACL,QAAQ,QAAQ;AAAA,IAChB,QAAQ,QA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