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
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lib/wallet-unlock.ts"],"sourcesContent":["import { CliError } from './errors';\n\n/**\n * WHY A WALLET COULD NOT SIGN, AS ONE VOCABULARY. The wallet layer throws with\n * it, the routing payer skips with it, the hooks gate and word notices with it,\n * and doctor renders it, so every surface names the same cause the same way.\n *\n * HOOK-SAFE ON PURPOSE: it imports `./errors` and nothing else. `tenjin hook`,\n * `alive` and the status line read these reasons, and their chunk graph must\n * stay free of `src/lib/wallet/`, viem, ox and the x402 SDK\n * (`src/router/dist-chunks.test.ts`). That is why the reasons live here and not\n * beside the wallet code that produces them.\n *\n * Six reasons are DEFINITE (this wallet cannot sign until a person fixes\n * something) and two are not (`keychain_locked`, `unlock_timeout`: the store or\n * the clock did not answer, which says nothing about the wallet). Only a\n * definite reason may withhold an offer or skip a routing attempt.\n */\nexport type UnlockReason =\n | 'no_wallet'\n | 'wallet_corrupt'\n | 'env_key_invalid'\n | 'passphrase_missing'\n | 'passphrase_wrong'\n | 'env_passphrase_wrong'\n | 'keychain_locked'\n | 'unlock_timeout';\n\nconst UNLOCK_REASONS: ReadonlySet<string> = new Set<UnlockReason>([\n 'no_wallet',\n 'wallet_corrupt',\n 'env_key_invalid',\n 'passphrase_missing',\n 'passphrase_wrong',\n 'env_passphrase_wrong',\n 'keychain_locked',\n 'unlock_timeout',\n]);\n\n/** A store that keeps a wallet's passphrase across sessions: the platform's own\n * credential store, or the 0600 file where there is none. */\nexport type DurableStore = 'keychain' | 'secret-service' | 'dpapi' | 'file';\n\n/** Where a passphrase came from, for messages; 'legacy' = the pre-per-wallet shared slot. */\nexport type PassphraseLabel = 'env' | DurableStore | 'legacy' | 'prompt';\n\nconst PASSPHRASE_LABELS: ReadonlySet<string> = new Set<PassphraseLabel>([\n 'env',\n 'keychain',\n 'secret-service',\n 'dpapi',\n 'file',\n 'legacy',\n 'prompt',\n]);\n\n/**\n * What actually produced a signature, as doctor, install and the router report\n * it. Defined here rather than in `src/router/eligibility.ts` (which re-exports\n * it) because `src/lib/wallet/provider.ts` needs it too, and lib must not\n * import router.\n */\nexport type SigningSource = 'key-env' | 'passphrase-env' | DurableStore | 'legacy';\n\n/** The cause a wallet throw site attaches as `CliError.details.unlock`. */\nexport interface UnlockDetails {\n reason: UnlockReason;\n source?: PassphraseLabel;\n}\n\n/** Every reason except the two that say the store or the clock did not answer. */\nexport const DEFINITE_UNLOCK: ReadonlySet<UnlockReason> = new Set<UnlockReason>([\n 'no_wallet',\n 'wallet_corrupt',\n 'env_key_invalid',\n 'passphrase_missing',\n 'passphrase_wrong',\n 'env_passphrase_wrong',\n]);\n\n/** Said once when TENJIN_WALLET_PASSPHRASE did not open the wallet and a saved\n * passphrase did: the wallet works, the variable is the thing to remove. */\nexport const ENV_PASSPHRASE_WRONG = 'TENJIN_WALLET_PASSPHRASE is set but wrong; remove it.';\n\n/**\n * Carried by every person-facing string that names `tenjin wallet repair` (B1,\n * decision 15). A passphrase never goes on a command line or into chat: repair\n * asks for it at a hidden prompt, and this clause tells the person so before an\n * agent can suggest otherwise.\n */\nexport const REPAIR_CLAUSE =\n '(it asks for the passphrase in your terminal; never paste it into chat)';\n\n/** The person's fix for a wallet whose saved passphrase is gone or wrong. */\nexport const REPAIR_IN_TERMINAL =\n `Run \\`tenjin wallet repair\\` yourself ${REPAIR_CLAUSE}.` as const;\n\n/**\n * The only fix for a keychain that exists but did not answer (S3). It never\n * points at the plaintext file or at another passphrase: a locked keychain is\n * unlocked, not routed around.\n */\nexport const KEYCHAIN_LOCKED_FIX =\n 'Unlock your keychain (or log in to the desktop session) and retry.';\n\n/**\n * A failed FILE-store write at create or repair (decision 6). Never used for an\n * OS store: there is no keychain to unlock when the file could not be written.\n */\nexport function FILE_STORE_FAILED_FIX(path: string): string {\n // The file's own folder (`TENJIN_DATA_DIR` moves it), cut by hand: this module imports nothing.\n const dir = path.replace(/[/\\\\][^/\\\\]*$/, '') || '/';\n return `Tenjin could not save the passphrase to ${path}; check that ${dir} is writable.`;\n}\n\n/** Shown once when create or repair has waited on the keychain for a second at a terminal. */\nexport const KEYCHAIN_WAIT_LINE = 'Waiting for the keychain…';\n\n/** Why a passphrase went to the 0600 file: no OS store answered the probe as present (S4). */\nexport function NO_KEYRING_LINE(path: string): string {\n return `No keyring reachable from this session; passphrase saved to ${path} (readable only by you).`;\n}\n\n/**\n * THE one TENJIN_WALLET_KEY expression (S12): a 0x-prefixed 32-byte hex private\n * key, case-insensitive. Moved here from `src/lib/wallet/store.ts` unchanged, and\n * store.ts re-exports it, so the wallet layer's `loadCredential` and the\n * hook-safe `wallet-facts.ts` test exactly the same thing. Do not tighten it in\n * one place only: a key one accepts and the other rejects is a wallet doctor\n * calls fine and the hooks call broken.\n */\nexport const PRIVATE_KEY_RE = /^0x[0-9a-f]{64}$/i;\n\n/** `{ unlock: { reason, source } }`, the value every wallet throw site passes as CliError `details`. */\nexport function unlockDetails(\n reason: UnlockReason,\n source?: PassphraseLabel,\n): { unlock: UnlockDetails } {\n return { unlock: source === undefined ? { reason } : { reason, source } };\n}\n\n/** Whether `value` is a well-formed `details.unlock`: a known reason, and a known source if any. */\nfunction isUnlockDetails(value: unknown): value is UnlockDetails {\n if (typeof value !== 'object' || value === null) return false;\n const { reason, source } = value as { reason?: unknown; source?: unknown };\n if (typeof reason !== 'string' || !UNLOCK_REASONS.has(reason)) return false;\n return source === undefined || (typeof source === 'string' && PASSPHRASE_LABELS.has(source));\n}\n\n/** `details.unlock` of a CliError that carries a valid one, else undefined. */\nfunction detailsOf(err: unknown): UnlockDetails | undefined {\n if (!(err instanceof CliError)) return undefined;\n const unlock = (err.details as { unlock?: unknown } | null | undefined)?.unlock;\n return isUnlockDetails(unlock) ? unlock : undefined;\n}\n\n/**\n * WHAT AN UNLOCK FAILURE MEANS, for gating and wording. In order:\n * `details.unlock` when the thrower classified it; `WALLET_MISSING` is\n * `no_wallet`; an AbortError or TimeoutError is `unlock_timeout`. ANY other\n * error, an undetailed CliError included, is `wallet_locked`, which is never\n * definite: nobody said why, so nothing may be withheld on its account.\n *\n * It never matches on message text. A message is wording, free to change; a\n * reason that hung on it would turn a copy edit into a gating change.\n */\nexport function classifyUnlockError(err: unknown): {\n reason: UnlockReason | 'wallet_locked';\n definite: boolean;\n source?: PassphraseLabel;\n} {\n const unlock = detailsOf(err);\n if (unlock !== undefined) {\n return {\n reason: unlock.reason,\n definite: DEFINITE_UNLOCK.has(unlock.reason),\n ...(unlock.source !== undefined ? { source: unlock.source } : {}),\n };\n }\n if (err instanceof CliError && err.code === 'WALLET_MISSING') {\n return { reason: 'no_wallet', definite: true };\n }\n const name = (err as { name?: unknown } | null | undefined)?.name;\n // By name, not class: a DOMException from AbortSignal.timeout and a\n // hand-made Error named AbortError mean the same thing here.\n if (name === 'AbortError' || name === 'TimeoutError') {\n return { reason: 'unlock_timeout', definite: false };\n }\n return { reason: 'wallet_locked', definite: false };\n}\n\n/**\n * `details.unlock.reason` when `err` is a CliError carrying a valid\n * `details.unlock`; null for anything else (an undetailed WALLET_MISSING, an\n * AbortError, any other CliError or value).\n *\n * THE ONLY GATE for swapping a fix to its model-facing `agentFix` (B1). Not\n * {@link classifyUnlockError}: its `wallet_locked` fallback covers EVERY\n * undetailed error, a `REGISTRY_MISMATCH` or an HTTP failure included, and\n * swapping on it would replace those errors' own fixes with wallet advice.\n */\nexport function unlockReasonOf(err: unknown): UnlockReason | null {\n return detailsOf(err)?.reason ?? null;\n}\n"],"mappings":";;;;;;AA4BA,IAAM,iBAAsC,oBAAI,IAAkB;AAAA,EAChE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AASD,IAAM,oBAAyC,oBAAI,IAAqB;AAAA,EACtE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAiBM,IAAM,kBAA6C,oBAAI,IAAkB;AAAA,EAC9E;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAIM,IAAM,uBAAuB;AAQ7B,IAAM,gBACX;AAGK,IAAM,qBACX,yCAAyC,aAAa;AAOjD,IAAM,sBACX;AAMK,SAAS,sBAAsB,MAAsB;AAE1D,QAAM,MAAM,KAAK,QAAQ,iBAAiB,EAAE,KAAK;AACjD,SAAO,2CAA2C,IAAI,gBAAgB,GAAG;AAC3E;AAGO,IAAM,qBAAqB;AAG3B,SAAS,gBAAgB,MAAsB;AACpD,SAAO,+DAA+D,IAAI;AAC5E;AAUO,IAAM,iBAAiB;AAGvB,SAAS,cACd,QACA,QAC2B;AAC3B,SAAO,EAAE,QAAQ,WAAW,SAAY,EAAE,OAAO,IAAI,EAAE,QAAQ,OAAO,EAAE;AAC1E;AAGA,SAAS,gBAAgB,OAAwC;AAC/D,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,EAAE,QAAQ,OAAO,IAAI;AAC3B,MAAI,OAAO,WAAW,YAAY,CAAC,eAAe,IAAI,MAAM,EAAG,QAAO;AACtE,SAAO,WAAW,UAAc,OAAO,WAAW,YAAY,kBAAkB,IAAI,MAAM;AAC5F;AAGA,SAAS,UAAU,KAAyC;AAC1D,MAAI,EAAE,eAAe,UAAW,QAAO;AACvC,QAAM,SAAU,IAAI,SAAqD;AACzE,SAAO,gBAAgB,MAAM,IAAI,SAAS;AAC5C;AAYO,SAAS,oBAAoB,KAIlC;AACA,QAAM,SAAS,UAAU,GAAG;AAC5B,MAAI,WAAW,QAAW;AACxB,WAAO;AAAA,MACL,QAAQ,OAAO;AAAA,MACf,UAAU,gBAAgB,IAAI,OAAO,MAAM;AAAA,MAC3C,GAAI,OAAO,WAAW,SAAY,EAAE,QAAQ,OAAO,OAAO,IAAI,CAAC;AAAA,IACjE;AAAA,EACF;AACA,MAAI,eAAe,YAAY,IAAI,SAAS,kBAAkB;AAC5D,WAAO,EAAE,QAAQ,aAAa,UAAU,KAAK;AAAA,EAC/C;AACA,QAAM,OAAQ,KAA+C;AAG7D,MAAI,SAAS,gBAAgB,SAAS,gBAAgB;AACpD,WAAO,EAAE,QAAQ,kBAAkB,UAAU,MAAM;AAAA,EACrD;AACA,SAAO,EAAE,QAAQ,iBAAiB,UAAU,MAAM;AACpD;AAYO,SAAS,eAAe,KAAmC;AAChE,SAAO,UAAU,GAAG,GAAG,UAAU;AACnC;","names":[]}
@@ -1,10 +0,0 @@
1
- import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
-
3
- // src/lib/grade.ts
4
- var ENDED_AFTER_MS = 30 * 6e4;
5
- var AGENT_ID_RE = /^[A-Za-z0-9_-]{1,128}$/;
6
-
7
- export {
8
- AGENT_ID_RE
9
- };
10
- //# sourceMappingURL=chunk-XKESD27X.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lib/grade.ts"],"sourcesContent":["import { CliError } from './errors';\n\n/**\n * Did the agent USE what a hook arm showed it? The transcript is the only place\n * that answer exists.\n *\n * The arms record what they delivered (`fires`/`legs`), and the shelf records\n * what it served, but neither can see what happened next: the finding lands as\n * additional context in the agent's turn, and from there it is either acted on\n * or it is not. Nobody reports that, so without this the loop has no measure of\n * its own precision.\n *\n * WHAT COUNTS AS EVIDENCE, and why it is only ever a TOOL INPUT. An agent that\n * says \"as the Tenjin note suggests\" in prose has said nothing checkable — the\n * words are cheap, the sentence is generated beside a hundred others, and prose\n * agreeing with an injection is exactly what an injection makes likely whether\n * or not it helped. A tool call is a decision the agent spent something on. So\n * this reads two kinds of row and no others: the `hook_additional_context`\n * attachment that carries the injection (the anchor), and every later\n * `tool_use` block's input, serialized whole so a command, an edit's new text\n * and a written file all read the same way.\n *\n * THREE VERDICTS FOR \"USED\", TWO WEAK. Explicit `tenjin read|inspect <id>`, or\n * the injected url appearing in a tool input, is the agent following the\n * pointer: that is `read`, and it counts anywhere later in the session,\n * because a piece bought twenty tool calls after it was shown is still a piece\n * the injection sold. A backtick span copied out of the injected text is much\n * weaker — it may be a command the agent would have run anyway — so it counts\n * only inside {@link SPAN_WINDOW} tool calls of the anchor, needs at least two\n * words, and is reported to the shelf as `partially_used` rather than `used`.\n * `likely` is weaker again: a command head or file basename named anywhere in\n * the note's prose, with no backticks at all, matched the same way and ranked\n * below `span` — see {@link likelyTokens}.\n *\n * A SPAN OR A LIKELY TOKEN IS EXCLUDED WHEN THE SESSION ALREADY USED IT BEFORE\n * THE INJECTION (tenjin-agent#254a). Boilerplate a machine writes into every\n * subagent work order — `CI=true pnpm format:check` and the like — will always\n * reappear in the next tool call whether or not the injection ran, so a match\n * that cannot see behind the anchor cannot tell \"copied because shown\" from\n * \"was going to type this anyway\". `judge()` is handed the {@link SPAN_WINDOW}\n * tool calls BEFORE the anchor as well as after, and a candidate already\n * present there earns no credit — matched at a token boundary, not by plain\n * substring, so a longer pre-injection token cannot erase credit for a\n * shorter genuine one. This applies to `span` and `likely` only: `read` is a\n * command naming this specific piece, which nothing pre-injection could have\n * done by coincidence.\n *\n * NOTHING IS NOT REJECTION UNTIL THE SESSION IS OVER. A row whose session is\n * still running has simply not been answered yet, and grading it `rejected`\n * would post a verdict the next tool call could contradict. So \"nothing matched\"\n * becomes `rejected` only once the session has ended — `sessions.ended_at`, or a\n * transcript nothing has written to for {@link ENDED_AFTER_MS}.\n *\n * RELAYED ROWS ANCHOR ON THE FIRST TOOL CALL. The subagent arm hands its finding\n * to a child at SubagentStart, and that text reaches no transcript at all: the\n * child is given it as its opening context, and neither the parent's file nor\n * the child's records a `hook_additional_context` row for it. So there is no\n * anchor to find, and there does not need to be — the pointer preceded every\n * call the child ever made, which makes the child's FIRST tool call evidence\n * rather than the row after the anchor. {@link gradeRelayed} judges from there,\n * inclusively, while {@link gradeInjection} keeps its exclusive `anchor + 1`.\n *\n * A relayed row also has no injected text on disk to take spans from — the arm\n * renders a title, a price and possibly a fetched body, and stores none of it —\n * so its span evidence comes from the piece's TITLE alone, which is usually no\n * spans at all. Relayed findings are therefore judged almost entirely on the\n * strong evidence (an explicit read, or the url), which is the right way round.\n * Storing the injected text is a second schema change and is not this one.\n *\n * The functions here are pure over parsed rows, except the two that touch the\n * filesystem at the bottom; the command in commands/grade.ts owns the store.\n */\n\n/** How many tool calls after the anchor a copied span may still be evidence. */\nexport const SPAN_WINDOW = 10;\n\n/** A transcript nothing has appended to for this long belongs to a session that\n * is over, whether or not a Stop hook ever stamped `ended_at` (a crashed or\n * killed harness never does). */\nexport const ENDED_AFTER_MS = 30 * 60_000;\n\n/** How many tool inputs `--explain` shows for a rejected row, and how much of\n * each: enough to see what the agent did instead, not a transcript dump. */\nconst EVIDENCE_ROWS = 3;\nconst EVIDENCE_CHARS = 200;\n\n/** A session id is used as a filename, so it is checked like one. */\nconst SESSION_ID_RE = /^[A-Za-z0-9-]{1,80}$/;\n\n/**\n * An agent id becomes a filename too (`agent-<id>.jsonl`), so it gets the same\n * treatment as a session id.\n *\n * THE ONLY DEFINITION, and every other reader takes it from here rather than\n * restating it: `prelude` interpolates it into the rendered scripts, where\n * `identityOf` and the capture ask's flag splice both read that one declaration,\n * and `publish --agent` tests against this constant directly. The splice and\n * `--agent` used to share a wider `shell-safe` copy admitting `.` and `:` on the\n * reasoning that only shell metacharacters matter in a command line: `:` is the\n * separator `agentKey` joins on, so an id carrying one keys a child's rows into\n * another child's range, and an id one reader accepts and another refuses is a\n * row that can never be graded or reported.\n */\nexport const AGENT_ID_RE = /^[A-Za-z0-9_-]{1,128}$/;\n\n/** The only two row kinds that decide anything; see the module note. */\nexport interface TranscriptRow {\n /** 1-based line number in the JSONL, for `--explain`. */\n line: number;\n kind: 'context' | 'tool_use';\n text: string;\n}\n\nexport interface GradeTarget {\n resourceId: string | null;\n url: string | null;\n title: string | null;\n}\n\nexport type Verdict =\n | { outcome: 'used'; by: 'read' | 'span' | 'likely'; evidence: string }\n | { outcome: 'rejected'; by: 'none'; evidence: string[] }\n | { outcome: 'unobserved'; by: 'none' }\n /** Still open: the session may yet answer, so nothing is written. */\n | { outcome: null; evidence: string[] };\n\n/**\n * The transcript, reduced to the rows that can decide a verdict.\n *\n * A malformed line is skipped rather than failing the parse: a transcript being\n * appended to while this runs can end mid-line, and one truncated row is not a\n * reason to refuse to grade a session.\n *\n * `isCompactSummary` rows are dropped. A compaction REPLAYS earlier tool calls\n * into a summary the assistant then carries, so counting them would let one\n * injection be \"used\" by the echo of a call that happened before it was shown.\n */\nexport function parseTranscript(jsonl: string): TranscriptRow[] {\n const rows: TranscriptRow[] = [];\n const lines = jsonl.split('\\n');\n for (let i = 0; i < lines.length; i += 1) {\n const raw = lines[i];\n if (raw === undefined || raw.length === 0) continue;\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch {\n continue;\n }\n if (!isRecord(parsed)) continue;\n const line = i + 1;\n const attachment = parsed.attachment;\n if (isRecord(attachment) && attachment.type === 'hook_additional_context') {\n rows.push({ line, kind: 'context', text: contextText(attachment.content) });\n continue;\n }\n if (parsed.type !== 'assistant' || parsed.isCompactSummary === true) continue;\n const message = parsed.message;\n if (!isRecord(message) || !Array.isArray(message.content)) continue;\n for (const block of message.content) {\n if (!isRecord(block) || block.type !== 'tool_use') continue;\n rows.push({ line, kind: 'tool_use', text: JSON.stringify(block.input ?? null) });\n }\n }\n return rows;\n}\n\n/**\n * Where the injection landed, as an index into `rows`, or -1.\n *\n * THE FIRST MATCH, not the nearest one after the row's timestamp. The\n * `injections_shown_once` index makes one injected row per (session,\n * resourceId), so there is only ever one context row naming a given piece, and\n * matching it by content beats matching it by clock: the hook's `at` and the\n * transcript's line order are written by different processes.\n *\n * Id, then url, then title, weakest last: a title is display text that could\n * appear in an unrelated context row, so it is what is tried when the piece has\n * nothing more specific to be found by.\n */\nexport function findAnchor(rows: TranscriptRow[], target: GradeTarget): number {\n for (const needle of [target.resourceId, target.url, target.title]) {\n if (needle === null || needle.length === 0) continue;\n const at = rows.findIndex((row) => row.kind === 'context' && row.text.includes(needle));\n if (at !== -1) return at;\n }\n return -1;\n}\n\n/**\n * The backtick spans in the injected text worth looking for later: at least two\n * whitespace-separated words, deduped.\n *\n * TWO WORDS IS THE FLOOR because one is noise. A note names `pnpm`, `useEffect`\n * or a filename, the agent types the same token in the next command, and a\n * one-word rule calls that reuse — on a machine where the agent was going to\n * type it anyway. Two words is a phrase somebody copied.\n */\nexport function backtickSpans(text: string): string[] {\n const spans = new Set<string>();\n for (const match of text.matchAll(/`([^`\\n]+)`/g)) {\n const span = (match[1] ?? '').trim();\n if (span.split(/\\s+/).filter((w) => w.length > 0).length >= 2) spans.add(span);\n }\n return [...spans];\n}\n\n/** A candidate token has to carry its own punctuation to qualify — see\n * {@link likelyTokens}. */\nconst LIKELY_TOKEN_RE = /\\b[A-Za-z][A-Za-z0-9]*(?:[:_./-][A-Za-z0-9]+)+\\b/g;\nconst LIKELY_MIN_CHARS = 4;\n/** Compounds common enough in ordinary prose to look like a command or a path\n * but never are one. Not a promise of completeness — the punctuation\n * requirement in {@link LIKELY_TOKEN_RE} is what does most of the work; this\n * catches the handful of hyphenated English words that would otherwise slip\n * through it. */\nconst LIKELY_GENERIC = new Set([\n 're-run',\n 're-runs',\n 're-ran',\n 're-executes',\n 're-executed',\n 'up-to-date',\n 'well-known',\n 'self-contained',\n 'read-only',\n 'long-lived',\n 'built-in',\n 'one-word',\n 'two-word',\n 'so-called',\n 'case-by-case',\n 'pre-commit',\n 'post-commit',\n 'e.g',\n 'i.e',\n // The injection's OWN scaffolding, not anything a seller wrote: PUBLIC_OPENER,\n // CLOSING_LINE and the body fence itself (`--- tenjin-body <nonce> ---`) from\n // hooks/prose.ts land in every full-form injection, so without these three\n // `likelyTokens(fullForm(...))` always nets its own boilerplate as a\n // candidate.\n 'third-party',\n 're-verifying',\n 'tenjin-body',\n]);\n\n/**\n * Command heads and file basenames named anywhere in `text`, with no backticks\n * at all — the weaker, single-token net {@link judge} tries below `span` for a\n * note that describes a command in prose instead of quoting it\n * (tenjin-agent#254b: \"gh run rerun\" named only in a title, \"pnpm check\" named\n * only as English words, each with a tool call that actually followed it).\n *\n * CONSERVATIVE ON PURPOSE. A bare English word (\"run\", \"check\", or \"pnpm\" on\n * its own) is exactly what the two-word floor on {@link backtickSpans} already\n * excludes as noise the agent was going to type anyway; a single-token net\n * that took bare words would reopen that hole wider than the floor closes it.\n * So a candidate must carry its own internal structure — a colon, dot, slash,\n * underscore or hyphen joining two word-shaped halves, the way a subcommand\n * (`db:generate`), a filename (`ci.yml`), or a path segment does — which a\n * plain English word essentially never does, and it must be at least\n * {@link LIKELY_MIN_CHARS} long.\n *\n * BACKTICK CONTENT IS STRIPPED FIRST, so a span already tried (and ranked\n * above this) is never re-offered as weaker evidence for the same text.\n *\n * THE PIECE'S OWN ID AND URL ARE EXCLUDED. Those already have a dedicated,\n * stronger `read` verdict; re-crediting them here would rank a followed\n * pointer BELOW a copied identifier instead of above it.\n */\nexport function likelyTokens(text: string, target: GradeTarget): string[] {\n const stripped = text.replace(/`[^`\\n]+`/g, ' ');\n const tokens = new Set<string>();\n for (const match of stripped.matchAll(LIKELY_TOKEN_RE)) {\n const token = match[0];\n if (token.length < LIKELY_MIN_CHARS) continue;\n if (LIKELY_GENERIC.has(token.toLowerCase())) continue;\n // A FRAGMENT counts as the id or the url, not just an exact match: a uuid\n // is all hyphens and hex, so the token regex can walk in from the middle\n // of one (`bbbb-cccc-dddd-...`) and still name nothing but the piece the\n // `read` tier already owns.\n if (target.resourceId !== null && target.resourceId.includes(token)) continue;\n if (target.url !== null && target.url.length > 0 && target.url.includes(token)) continue;\n tokens.add(token);\n }\n return [...tokens];\n}\n\n/**\n * The verdict for one injection, given its transcript and its anchor.\n *\n * Read beats span: both may be present, and \"the agent went and read the piece\"\n * is the stronger claim, so it is the one reported.\n */\nexport function gradeInjection(\n rows: TranscriptRow[],\n anchor: number,\n target: GradeTarget,\n opts: { ended: boolean },\n): Verdict {\n if (anchor < 0 || anchor >= rows.length) return { outcome: 'unobserved', by: 'none' };\n // EXCLUSIVE: the anchor row IS the injection, so the calls that can answer for\n // it are the ones after it. The ones BEFORE it are what a span or a likely\n // token has to clear to earn credit — see the module note on #254a. Bounded\n // to the same SPAN_WINDOW as `after`: a session's first call from an hour\n // before the injection is not \"standing boilerplate\" any more than a session's\n // fiftieth call after it is still \"the injection in view\" — both are the same\n // claim, made symmetrically.\n const before = rows\n .slice(0, anchor)\n .filter((row) => row.kind === 'tool_use')\n .slice(-SPAN_WINDOW);\n const after = rows.slice(anchor + 1).filter((row) => row.kind === 'tool_use');\n const text = rows[anchor]?.text ?? '';\n return judge(after, before, backtickSpans(text), likelyTokens(text, target), target, opts.ended);\n}\n\n/**\n * Where a relayed finding's evidence starts: the first `tool_use` row, or -1.\n *\n * The caller reports it as the anchor line under `--explain`, so a verdict on a\n * child still names the row it was read from.\n */\nexport function firstToolCall(rows: TranscriptRow[]): number {\n return rows.findIndex((row) => row.kind === 'tool_use');\n}\n\n/**\n * The verdict for a finding RELAYED to a subagent, given that child's own\n * transcript.\n *\n * INCLUSIVE OF THE FIRST CALL, and with no anchor at all — see the module note.\n * A child that made no tool calls has done nothing that could be evidence, so it\n * is `rejected` once it is over and open while it runs, exactly as an\n * unanswered main-session row is.\n */\nexport function gradeRelayed(\n rows: TranscriptRow[],\n target: GradeTarget,\n opts: { ended: boolean },\n): Verdict {\n const calls = rows.filter((row) => row.kind === 'tool_use');\n // The title is the only injected text this row left on disk; usually it holds\n // no two-word backtick span at all, and that is the documented limit of what\n // a relayed row can be judged `span` or `likely` on. No pre-injection\n // exclusion here: the pointer preceded the child's first call, so there is no\n // \"before\" inside this transcript for anything to have leaked from.\n const title = target.title ?? '';\n return judge(calls, [], backtickSpans(title), likelyTokens(title, target), target, opts.ended);\n}\n\n/**\n * The evidence rules themselves, over whichever tool calls the caller decided\n * are eligible. Shared byte-for-byte by both verdict functions, so a relayed row\n * and a main-session row can never drift into being judged by different rules.\n *\n * Read beats span beats likely: each may be present alongside a weaker one, and\n * the strongest claim actually supported is the one reported.\n *\n * `before` is up to {@link SPAN_WINDOW} tool calls that happened in this same\n * session BEFORE the injection (empty for a relayed row, which has none). A\n * span or a likely token already present there is boilerplate the session was\n * going to write anyway, so it earns no credit here — tenjin-agent#254a.\n */\nfunction judge(\n after: TranscriptRow[],\n before: TranscriptRow[],\n spans: string[],\n likely: string[],\n target: GradeTarget,\n ended: boolean,\n): Verdict {\n const readRe = target.resourceId === null ? null : readCommandRe(target.resourceId);\n for (const row of after) {\n if (readRe !== null && readRe.test(row.text)) {\n return { outcome: 'used', by: 'read', evidence: cap(row.text) };\n }\n if (target.url !== null && target.url.length > 0 && row.text.includes(target.url)) {\n return { outcome: 'used', by: 'read', evidence: cap(row.text) };\n }\n }\n // A TOKEN BOUNDARY MATCH, not a substring, ON BOTH SIDES: `db:generate` is a\n // plain substring of `db:generate-types`, so a pre-injection call to the\n // latter must not erase credit for a genuine post-injection call to the\n // former (the `before` side) — but by the same logic, a post-injection call\n // to `db:generate-types` must not be credited as a hit for a note that only\n // ever named `db:generate` (the `after` side): that is the identical\n // boilerplate #254a exists to exclude, just spelled with the shorter token\n // as the candidate instead of the longer one. Plain `includes` on one side\n // and a boundary match on the other opens exactly that gap — fixed by\n // sharing one boundary test both directions (tenjin-agent#276 review round\n // 2, major). The class in the lookaround is exactly {@link\n // LIKELY_TOKEN_RE}'s own — a colon, dot, slash, underscore or hyphen still\n // extends a token, so this only rules out landing inside a longer one, not\n // a real reappearance next to punctuation.\n const atBoundary = (haystack: string, candidate: string): boolean =>\n new RegExp(`(?<![A-Za-z0-9:_./-])${escapeRe(candidate)}(?![A-Za-z0-9:_./-])`).test(haystack);\n const seenBefore = (candidate: string): boolean =>\n before.some((row) => atBoundary(row.text, candidate));\n for (const row of after.slice(0, SPAN_WINDOW)) {\n const hit = spans.find((span) => !seenBefore(span) && atBoundary(row.text, span));\n // Capped like every other evidence string here: the span is copied out of\n // injected text, which came off a shelf, and `--explain` prints it.\n if (hit !== undefined) return { outcome: 'used', by: 'span', evidence: cap(hit) };\n }\n for (const row of after.slice(0, SPAN_WINDOW)) {\n const hit = likely.find((token) => !seenBefore(token) && atBoundary(row.text, token));\n if (hit !== undefined) return { outcome: 'used', by: 'likely', evidence: cap(hit) };\n }\n const evidence = after.slice(0, EVIDENCE_ROWS).map(cap);\n return ended ? { outcome: 'rejected', by: 'none', evidence } : { outcome: null, evidence };\n}\n\n/** `7d`, `24h`, `30m` as milliseconds. Anything else is a usage error rather\n * than a silent default, so a typo cannot quietly widen or narrow a sweep. */\nexport function parseSince(text: string): number {\n const match = /^(\\d+)([dhm])$/.exec(text.trim());\n const value = match === null ? 0 : Number(match[1]);\n if (match === null || value <= 0) {\n throw new CliError('USAGE', `Invalid --since window: ${JSON.stringify(text)}`, {\n fix: 'Pass a window like 7d, 24h or 30m.',\n });\n }\n const unit = { d: 24 * 60 * 60_000, h: 60 * 60_000, m: 60_000 }[match[2] as 'd' | 'h' | 'm'];\n return value * unit;\n}\n\n/**\n * Where a session's transcript is, or WHY there is none.\n *\n * `absent` is a FACT ABOUT THE SESSION: the projects directory was listed and\n * holds no file for it. `unreadable` is a fact about this machine right now —\n * no projects directory, a home that is not mounted, a permissions change\n * mid-run — and says nothing about the session at all.\n */\nexport type TranscriptLookup =\n { kind: 'found'; path: string } | { kind: 'absent' } | { kind: 'unreadable'; reason: string };\n\n/**\n * The transcript for a session, or for one subagent of it, or why it was not\n * found.\n *\n * BY READDIR, not by mangling the cwd into a directory name. Claude Code names\n * the project directory from the working directory with a substitution this CLI\n * would have to reimplement and keep in step (and which a worktree, a symlinked\n * home or a renamed checkout each break differently); the session id is a uuid\n * and is unique across them, so one listing finds it wherever it landed.\n *\n * WITH AN AGENT ID IT IS A DIFFERENT FILE, not a different search: a subagent\n * writes to `<session>/subagents/agent-<id>.jsonl` beside the parent's\n * `<session>.jsonl`, under the same project directory. The child's tool calls\n * appear in NO parent file, so a row stamped with an agent id is answered only\n * here.\n *\n * THE TWO NEGATIVE ANSWERS ARE NOT THE SAME ANSWER, and collapsing them to\n * `null` is how a transient fault becomes permanent: the caller turns \"no\n * transcript\" into `unobserved`, `unobserved` is a verdict, and a verdict is\n * never re-graded. One run under a home directory that could not be read would\n * have closed every open row on the machine as never-seen, with no way back.\n */\nexport async function findTranscript(\n homeDir: string,\n sessionId: string,\n agentId: string | null = null,\n): Promise<TranscriptLookup> {\n // An id that cannot be a filename names no transcript in any project\n // directory, now or ever: that is absence, and it is permanent.\n if (!SESSION_ID_RE.test(sessionId)) return { kind: 'absent' };\n if (agentId !== null && !AGENT_ID_RE.test(agentId)) return { kind: 'absent' };\n const { readdir, stat } = await import('node:fs/promises');\n const { join } = await import('node:path');\n const projects = join(homeDir, '.claude', 'projects');\n let dirs: string[];\n try {\n dirs = (await readdir(projects, { withFileTypes: true }))\n .filter((e) => e.isDirectory())\n .map((e) => e.name);\n } catch (err) {\n // A missing projects directory included: a machine where the harness has\n // never run, or has not run yet, has not told us anything about this row.\n return { kind: 'unreadable', reason: errorReason(err) };\n }\n let blocked: string | null = null;\n for (const dir of dirs) {\n const path =\n agentId === null\n ? join(projects, dir, `${sessionId}.jsonl`)\n : join(projects, dir, sessionId, 'subagents', `agent-${agentId}.jsonl`);\n try {\n if ((await stat(path)).isFile()) return { kind: 'found', path };\n } catch (err) {\n // ENOENT is the ordinary answer — the session is simply not in THIS\n // project directory, and on the child path its `<session>/` directory may\n // not exist at all (ENOENT, or ENOTDIR where a plain file sits where the\n // directory would be). Anything else is a directory that could be hiding\n // it, so the sweep can no longer claim the file is absent.\n const code = errorCode(err);\n if (code !== 'ENOENT' && code !== 'ENOTDIR') blocked ??= errorReason(err);\n }\n }\n return blocked === null ? { kind: 'absent' } : { kind: 'unreadable', reason: blocked };\n}\n\n/** Has nothing been appended to this transcript for {@link ENDED_AFTER_MS}? The\n * half of \"the session is over\" that survives a harness which never stopped\n * cleanly and so never stamped `ended_at`. Unreadable reads as NOT idle: an\n * unknown must never manufacture a `rejected`. */\nexport async function transcriptIdle(path: string, nowMs: number): Promise<boolean> {\n try {\n const { stat } = await import('node:fs/promises');\n return nowMs - (await stat(path)).mtimeMs > ENDED_AFTER_MS;\n } catch {\n return false;\n }\n}\n\n/** An errno if the platform gave one, else the message: short enough to print\n * on the one `--explain` line that says why a row was left alone. Exported so\n * the caller's own read of the file it was handed reports failures in the same\n * words this one does. */\nexport function errorReason(err: unknown): string {\n const code = errorCode(err);\n if (code !== null) return code;\n return cap(err instanceof Error ? err.message : 'unknown error');\n}\n\nfunction errorCode(err: unknown): string | null {\n return isRecord(err) && typeof err.code === 'string' ? err.code : null;\n}\n\nfunction readCommandRe(resourceId: string): RegExp {\n return new RegExp(`tenjin\\\\s+(?:read|inspect)\\\\s+${escapeRe(resourceId)}`);\n}\n\nfunction escapeRe(text: string): string {\n return text.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\nfunction cap(row: TranscriptRow | string): string {\n const text = typeof row === 'string' ? row : row.text;\n return text.length > EVIDENCE_CHARS ? `${text.slice(0, EVIDENCE_CHARS)}…` : text;\n}\n\n/**\n * The injected text, whatever shape the attachment carried it in: a bare string,\n * an array of strings, or an array of `{ type: 'text', text }` blocks. All three\n * appear, and the anchor match only needs the words.\n */\nfunction contextText(content: unknown): string {\n if (typeof content === 'string') return content;\n if (!Array.isArray(content)) return '';\n const parts: string[] = [];\n for (const item of content) {\n if (typeof item === 'string') parts.push(item);\n else if (isRecord(item) && typeof item.text === 'string') parts.push(item.text);\n }\n return parts.join('\\n');\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n"],"mappings":";;;AA+EO,IAAM,iBAAiB,KAAK;AAwB5B,IAAM,cAAc;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lib/production-origin.ts"],"sourcesContent":["/**\n * The one place the production Tenjin origin is written down. Every shipped\n * default, fallback, identity string, and piece of operator copy that names the\n * live site derives from here; `production-origin.test.ts` keeps it that way.\n *\n * This is NOT the base URL a command talks to. Ordinary requests resolve\n * `baseUrl` through config/flag/env precedence (`CONFIG_DEFAULTS.baseUrl` merely\n * starts from this value); `fund` alone pins production with no override surface\n * at all (owner decision, 2026-08-12) because its mint signs with the wallet key.\n * `fund.test.ts` and `client-meta.test.ts` each hold their own written-out copy,\n * so flipping this line alone reds the suite instead of moving the money path.\n */\nexport const PRODUCTION_ORIGIN = 'https://tenjin.sh';\n\n/**\n * The bare host, for prose and messages that name the site rather than link to\n * it. Derived, not written twice: a flip cannot leave the two disagreeing.\n */\nexport const PRODUCTION_HOST = new URL(PRODUCTION_ORIGIN).host;\n\n/**\n * Every origin the ONE production deployment answers on, as `URL.origin` spells\n * it. Membership means a request to any of them reaches the same server,\n * publishers, prices, and SIWX domain acceptance. It exists because the server\n * builds candidate URLs from its own `NEXT_PUBLIC_APP_URL`, not the request\n * host, so the moment tenjin#402 flips that global a CLI on the other origin\n * sees every candidate as off-origin (tenjin#738).\n *\n * Membership is NOT trust and NOT an allowlist of places the CLI may pay, but it\n * IS the widest set a wallet-signed credential can reach, so widening it is a\n * security change. Removal runbook: docs/safety-model.md.\n */\nconst KNOWN_DEPLOYMENT_ORIGINS: ReadonlySet<string> = new Set([\n PRODUCTION_ORIGIN,\n 'https://tenjin.blog',\n]);\n\n/**\n * Do these two origins name the same deployment? Exact match, or two members of\n * the set. BOTH sides must be members, so a self-hosted or preview base gains no\n * alias and keeps today's strict compare, and a differing scheme or port is a\n * different origin that aliases to nothing. Takes `URL.origin` strings; anything\n * else is not a member and falls through to the exact compare.\n */\nexport function isSameDeployment(a: string, b: string): boolean {\n if (a === b) return true;\n return KNOWN_DEPLOYMENT_ORIGINS.has(a) && KNOWN_DEPLOYMENT_ORIGINS.has(b);\n}\n\n/** The set as a plain array, for the generated hook script that cannot import. */\nexport function knownDeploymentOrigins(): string[] {\n return [...KNOWN_DEPLOYMENT_ORIGINS];\n}\n"],"mappings":";;;AAYO,IAAM,oBAAoB;AAM1B,IAAM,kBAAkB,IAAI,IAAI,iBAAiB,EAAE;AAc1D,IAAM,2BAAgD,oBAAI,IAAI;AAAA,EAC5D;AAAA,EACA;AACF,CAAC;AASM,SAAS,iBAAiB,GAAW,GAAoB;AAC9D,MAAI,MAAM,EAAG,QAAO;AACpB,SAAO,yBAAyB,IAAI,CAAC,KAAK,yBAAyB,IAAI,CAAC;AAC1E;AAGO,SAAS,yBAAmC;AACjD,SAAO,CAAC,GAAG,wBAAwB;AACrC;","names":[]}
@@ -1,56 +0,0 @@
1
- import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
- import {
3
- CliError
4
- } from "./chunk-3UCIG4TG.js";
5
-
6
- // src/lib/ids.ts
7
- var ATOMIC_RE = /^\d{1,39}$/;
8
-
9
- // src/lib/money.ts
10
- var USDC_DECIMALS = 6;
11
- function parseUsdToAtomic(input) {
12
- const trimmed = input.trim();
13
- if (!/^\d+(\.\d+)?$/.test(trimmed)) {
14
- throw new CliError("USAGE", `Invalid USD amount: ${JSON.stringify(input)}`, {
15
- fix: "Pass a non-negative decimal like 0.25 or 5."
16
- });
17
- }
18
- const [whole, frac = ""] = trimmed.split(".");
19
- if (frac.length > USDC_DECIMALS) {
20
- throw new CliError(
21
- "USAGE",
22
- `USD amount ${JSON.stringify(input)} has more than 6 decimal places`,
23
- {
24
- fix: "USDC supports at most 6 decimal places (micro-dollars)."
25
- }
26
- );
27
- }
28
- const atomic = BigInt(`${whole}${frac.padEnd(USDC_DECIMALS, "0")}`);
29
- return atomic.toString();
30
- }
31
- function atomicToUsd(atomic) {
32
- const trimmed = atomic.trim();
33
- if (!/^\d+$/.test(trimmed)) {
34
- throw new CliError("INTERNAL", `Malformed atomic amount: ${JSON.stringify(atomic)}`);
35
- }
36
- const value = BigInt(trimmed);
37
- const base = 10n ** BigInt(USDC_DECIMALS);
38
- const whole = value / base;
39
- const frac = (value % base).toString().padStart(USDC_DECIMALS, "0").replace(/0+$/, "");
40
- return frac.length > 0 ? `${whole}.${frac}` : whole.toString();
41
- }
42
- function toMoney(atomic) {
43
- return { atomic, usd: atomicToUsd(atomic) };
44
- }
45
- function formatUsdDisplay(atomic) {
46
- const [whole, frac = ""] = atomicToUsd(atomic).split(".");
47
- return `${whole}.${frac.padEnd(2, "0")}`;
48
- }
49
-
50
- export {
51
- ATOMIC_RE,
52
- parseUsdToAtomic,
53
- toMoney,
54
- formatUsdDisplay
55
- };
56
- //# sourceMappingURL=chunk-Y527D4TV.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lib/ids.ts","../src/lib/money.ts"],"sourcesContent":["/**\n * The shared identity patterns for server-controlled values that become file\n * paths, URL segments, or terminal output. One definition so a future change\n * (e.g. accepting uppercase ids) cannot be applied in one command and missed in\n * another. SLUG_RE must match the server's slugify charset (lib/posts.ts:\n * lowercase a-z0-9 groups joined by single hyphens, no leading/trailing hyphen).\n */\nexport const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\nexport const SLUG_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;\n/** A non-negative atomic USDC integer string (6-decimal base units). */\nexport const ATOMIC_RE = /^\\d{1,39}$/;\n","import { CliError } from './errors';\nimport { ATOMIC_RE } from './ids';\nimport type { Money } from '../schemas';\n\n/** USDC is a 6-decimal token; one dollar is 1_000_000 atomic units. */\nconst USDC_DECIMALS = 6;\n\n/**\n * Decimal USD at the CLI edge -> atomic USDC string (O1). Accepts \"0\", \"0.25\",\n * \"5\"; rejects negatives, non-numeric input, and more than 6 decimal places as\n * USAGE so a fat-fingered amount fails loudly instead of truncating money.\n * String math throughout — a float would lose precision at the 6th decimal.\n */\nexport function parseUsdToAtomic(input: string): string {\n const trimmed = input.trim();\n if (!/^\\d+(\\.\\d+)?$/.test(trimmed)) {\n throw new CliError('USAGE', `Invalid USD amount: ${JSON.stringify(input)}`, {\n fix: 'Pass a non-negative decimal like 0.25 or 5.',\n });\n }\n const [whole, frac = ''] = trimmed.split('.');\n if (frac.length > USDC_DECIMALS) {\n throw new CliError(\n 'USAGE',\n `USD amount ${JSON.stringify(input)} has more than 6 decimal places`,\n {\n fix: 'USDC supports at most 6 decimal places (micro-dollars).',\n },\n );\n }\n const atomic = BigInt(`${whole}${frac.padEnd(USDC_DECIMALS, '0')}`);\n return atomic.toString();\n}\n\n/**\n * Atomic USDC string -> decimal USD string, trailing zeros trimmed (\"250000\" ->\n * \"0.25\", \"5000000\" -> \"5\", \"0\" -> \"0\"). Throws INTERNAL on a malformed atomic\n * value: atomic strings come from validated config or on-chain reads, so a bad\n * one is a bug, not user input.\n */\nexport function atomicToUsd(atomic: string): string {\n const trimmed = atomic.trim();\n if (!/^\\d+$/.test(trimmed)) {\n throw new CliError('INTERNAL', `Malformed atomic amount: ${JSON.stringify(atomic)}`);\n }\n const value = BigInt(trimmed);\n const base = 10n ** BigInt(USDC_DECIMALS);\n const whole = value / base;\n const frac = (value % base).toString().padStart(USDC_DECIMALS, '0').replace(/0+$/, '');\n return frac.length > 0 ? `${whole}.${frac}` : whole.toString();\n}\n\n/**\n * Whether an atomic price would actually cost something: true paid, false free,\n * null when the string is not an atomic amount at all and so cannot answer.\n *\n * A Tenjin piece may be priced at zero and is then delivered by `read` with no\n * payment, so \"there is a price field\" and \"there is a purchase to make\" are\n * different questions. The third state is not decoration: only the wire schema\n * enforces ATOMIC_RE, and the local search store types `price` as a bare string,\n * so a hand-edited or half-written entry can hold \"-1\" or \"0.1\". Those must not\n * read as \"free\", or corrupt local data would start refusing honest reports.\n * Never throws, which is why the check is a regex and not a BigInt compare.\n *\n * Matched against the RAW string, with no trimming. The contract carries the\n * canonical form and nothing else, so \" 0 \" did not come off the wire; padding is\n * evidence the value was edited, and normalizing it away would launder a corrupt\n * entry into a confident \"free\" and hand back the false refusal this avoids.\n */\nexport function isPaidPrice(atomic: string): boolean | null {\n if (!ATOMIC_RE.test(atomic)) return null;\n return /[1-9]/.test(atomic);\n}\n\n/** Dual-form money object for machine output. */\nexport function toMoney(atomic: string): Money {\n return { atomic, usd: atomicToUsd(atomic) };\n}\n\n/**\n * Canonical USD for human COPY (a price a person reads): always at least two\n * decimals (\"0.10\", \"5.00\"), keeping any finer precision below a cent\n * (\"0.000001\"). Distinct from `atomicToUsd`, which trims to the shortest exact\n * form for machine output; use this only where a dollar amount is shown to a human.\n */\nexport function formatUsdDisplay(atomic: string): string {\n const [whole, frac = ''] = atomicToUsd(atomic).split('.');\n return `${whole}.${frac.padEnd(2, '0')}`;\n}\n"],"mappings":";;;;;;AAUO,IAAM,YAAY;;;ACLzB,IAAM,gBAAgB;AAQf,SAAS,iBAAiB,OAAuB;AACtD,QAAM,UAAU,MAAM,KAAK;AAC3B,MAAI,CAAC,gBAAgB,KAAK,OAAO,GAAG;AAClC,UAAM,IAAI,SAAS,SAAS,uBAAuB,KAAK,UAAU,KAAK,CAAC,IAAI;AAAA,MAC1E,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AACA,QAAM,CAAC,OAAO,OAAO,EAAE,IAAI,QAAQ,MAAM,GAAG;AAC5C,MAAI,KAAK,SAAS,eAAe;AAC/B,UAAM,IAAI;AAAA,MACR;AAAA,MACA,cAAc,KAAK,UAAU,KAAK,CAAC;AAAA,MACnC;AAAA,QACE,KAAK;AAAA,MACP;AAAA,IACF;AAAA,EACF;AACA,QAAM,SAAS,OAAO,GAAG,KAAK,GAAG,KAAK,OAAO,eAAe,GAAG,CAAC,EAAE;AAClE,SAAO,OAAO,SAAS;AACzB;AAQO,SAAS,YAAY,QAAwB;AAClD,QAAM,UAAU,OAAO,KAAK;AAC5B,MAAI,CAAC,QAAQ,KAAK,OAAO,GAAG;AAC1B,UAAM,IAAI,SAAS,YAAY,4BAA4B,KAAK,UAAU,MAAM,CAAC,EAAE;AAAA,EACrF;AACA,QAAM,QAAQ,OAAO,OAAO;AAC5B,QAAM,OAAO,OAAO,OAAO,aAAa;AACxC,QAAM,QAAQ,QAAQ;AACtB,QAAM,QAAQ,QAAQ,MAAM,SAAS,EAAE,SAAS,eAAe,GAAG,EAAE,QAAQ,OAAO,EAAE;AACrF,SAAO,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI,IAAI,KAAK,MAAM,SAAS;AAC/D;AAyBO,SAAS,QAAQ,QAAuB;AAC7C,SAAO,EAAE,QAAQ,KAAK,YAAY,MAAM,EAAE;AAC5C;AAQO,SAAS,iBAAiB,QAAwB;AACvD,QAAM,CAAC,OAAO,OAAO,EAAE,IAAI,YAAY,MAAM,EAAE,MAAM,GAAG;AACxD,SAAO,GAAG,KAAK,IAAI,KAAK,OAAO,GAAG,GAAG,CAAC;AACxC;","names":[]}