tenjin-cli 0.1.0-alpha.34 → 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 (332) hide show
  1. package/NOTICE.md +30 -0
  2. package/README.md +20 -18
  3. package/dist/{_esm-MMYV66AX.js → _esm-2KST7HQ7.js} +4 -4
  4. package/dist/{alive-VOIL5W3I.js → alive-5TV22PNF.js} +13 -13
  5. package/dist/{auth-UHD3QFX4.js → auth-XI7BJFLW.js} +4 -4
  6. package/dist/balance-DFHC6XEU.js +71 -0
  7. package/dist/{ccip-CS7K5QRQ.js → ccip-HOW3DZYF.js} +3 -3
  8. package/dist/{chunk-RJ5HRPAZ.js → chunk-24XKUN2S.js} +68 -10
  9. package/dist/chunk-24XKUN2S.js.map +1 -0
  10. package/dist/chunk-2L7TDGLV.js +56 -0
  11. package/dist/chunk-2L7TDGLV.js.map +1 -0
  12. package/dist/{chunk-PZHBPGDE.js → chunk-34SAECKZ.js} +34 -10
  13. package/dist/chunk-34SAECKZ.js.map +1 -0
  14. package/dist/{chunk-EQZ2CCWC.js → chunk-3Y2EHT4F.js} +5 -2
  15. package/dist/chunk-3Y2EHT4F.js.map +1 -0
  16. package/dist/{chunk-FSYH7J75.js → chunk-3Y6BHIN6.js} +3 -3
  17. package/dist/{chunk-FZZWTDWP.js → chunk-3YPL6T3P.js} +6 -6
  18. package/dist/{chunk-JEZMWJEF.js → chunk-44MVIRZH.js} +4 -4
  19. package/dist/{chunk-27FIHFXF.js → chunk-45MMSBHA.js} +5 -5
  20. package/dist/{chunk-QXP3Z3JN.js → chunk-4MBCJFY4.js} +35 -3
  21. package/dist/chunk-4MBCJFY4.js.map +1 -0
  22. package/dist/chunk-4TPL54KW.js +227 -0
  23. package/dist/chunk-4TPL54KW.js.map +1 -0
  24. package/dist/{chunk-7JB6SYJX.js → chunk-54ELBTKE.js} +2 -2
  25. package/dist/{chunk-6J64MQFD.js → chunk-5F4OB5B3.js} +21 -15
  26. package/dist/chunk-5F4OB5B3.js.map +1 -0
  27. package/dist/{chunk-PYVQ74D5.js → chunk-5HN4KVQU.js} +189 -117
  28. package/dist/chunk-5HN4KVQU.js.map +1 -0
  29. package/dist/{chunk-VFKPIIV2.js → chunk-5J4E5GYI.js} +35 -32
  30. package/dist/chunk-5J4E5GYI.js.map +1 -0
  31. package/dist/chunk-5USBZ2MU.js +58 -0
  32. package/dist/chunk-5USBZ2MU.js.map +1 -0
  33. package/dist/chunk-64WOMNYR.js +183 -0
  34. package/dist/chunk-64WOMNYR.js.map +1 -0
  35. package/dist/{chunk-APWELUI7.js → chunk-65RS4LQS.js} +57 -43
  36. package/dist/chunk-65RS4LQS.js.map +1 -0
  37. package/dist/{chunk-HWZO6HYZ.js → chunk-6QMDUDF2.js} +3 -3
  38. package/dist/{chunk-FNBGRKS6.js → chunk-7V25UAQO.js} +2 -2
  39. package/dist/chunk-BGA4DO5M.js +719 -0
  40. package/dist/chunk-BGA4DO5M.js.map +1 -0
  41. package/dist/chunk-BVP7YK2J.js +706 -0
  42. package/dist/chunk-BVP7YK2J.js.map +1 -0
  43. package/dist/chunk-C265QIMJ.js +83 -0
  44. package/dist/chunk-C265QIMJ.js.map +1 -0
  45. package/dist/{chunk-MXN2ZEUB.js → chunk-D6M3ZK66.js} +2 -2
  46. package/dist/chunk-D6M3ZK66.js.map +1 -0
  47. package/dist/chunk-DJ36BM62.js +78 -0
  48. package/dist/chunk-DJ36BM62.js.map +1 -0
  49. package/dist/{chunk-JOKPBYXP.js → chunk-DTEWAVNE.js} +2 -2
  50. package/dist/chunk-F2KJAJ7T.js +13 -0
  51. package/dist/chunk-F2KJAJ7T.js.map +1 -0
  52. package/dist/{chunk-KAILF7QA.js → chunk-F43CV6UC.js} +2 -2
  53. package/dist/{chunk-ACO7ZCR2.js → chunk-FKVJKLPI.js} +2 -2
  54. package/dist/{chunk-43HLS2HM.js → chunk-FYFHH7V5.js} +54 -3
  55. package/dist/{chunk-43HLS2HM.js.map → chunk-FYFHH7V5.js.map} +1 -1
  56. package/dist/{chunk-2F5JUAHZ.js → chunk-GAJC4BQZ.js} +3 -3
  57. package/dist/{chunk-L7N73ZAW.js → chunk-HAZAN4UM.js} +2 -2
  58. package/dist/{chunk-6QJZA6EX.js → chunk-HI5XQOX2.js} +2 -2
  59. package/dist/{chunk-BOENA6XR.js → chunk-HKGUKAQW.js} +6 -6
  60. package/dist/{chunk-LJSCGIYH.js → chunk-HPRVFJPM.js} +2 -2
  61. package/dist/{chunk-OO6FIBL7.js → chunk-HZKANST2.js} +3 -6
  62. package/dist/chunk-HZKANST2.js.map +1 -0
  63. package/dist/{chunk-UVDJ5SSQ.js → chunk-I557SAOM.js} +8 -2
  64. package/dist/chunk-I557SAOM.js.map +1 -0
  65. package/dist/{chunk-SDUOJRSV.js → chunk-IGLWLH73.js} +3 -3
  66. package/dist/{chunk-3AKH7ODX.js → chunk-INSIW65E.js} +5 -5
  67. package/dist/{chunk-PNHNXUSL.js → chunk-IULCDMVG.js} +12 -1
  68. package/dist/chunk-IULCDMVG.js.map +1 -0
  69. package/dist/{chunk-JF4T4HCQ.js → chunk-IVNSUAVC.js} +10 -5
  70. package/dist/chunk-IVNSUAVC.js.map +1 -0
  71. package/dist/chunk-JDQZCREI.js +87 -0
  72. package/dist/chunk-JDQZCREI.js.map +1 -0
  73. package/dist/{chunk-2P3NJTHE.js → chunk-JHFFUVON.js} +23 -23
  74. package/dist/{chunk-7JVARP5R.js → chunk-JTILUN4W.js} +55 -29
  75. package/dist/{chunk-7JVARP5R.js.map → chunk-JTILUN4W.js.map} +1 -1
  76. package/dist/{chunk-2TO5F6CT.js → chunk-K5KNGC4I.js} +8 -8
  77. package/dist/{chunk-HUWTFKEM.js → chunk-KAQ4Q3TO.js} +3 -3
  78. package/dist/{chunk-E6VP6MQM.js → chunk-KGUE5AVX.js} +4 -4
  79. package/dist/chunk-KGUE5AVX.js.map +1 -0
  80. package/dist/{chunk-GS5RZF7U.js → chunk-KLDMLWXT.js} +2 -2
  81. package/dist/{chunk-HN2EN6P4.js → chunk-KNKDMTHU.js} +5 -5
  82. package/dist/chunk-LDA6TAYQ.js +95 -0
  83. package/dist/chunk-LDA6TAYQ.js.map +1 -0
  84. package/dist/chunk-LWSSIZOY.js +347 -0
  85. package/dist/chunk-LWSSIZOY.js.map +1 -0
  86. package/dist/{chunk-5VWQSCDO.js → chunk-MAHNZA6C.js} +89 -9
  87. package/dist/chunk-MAHNZA6C.js.map +1 -0
  88. package/dist/{chunk-46HAB26L.js → chunk-MEWZCIA6.js} +56 -9
  89. package/dist/chunk-MEWZCIA6.js.map +1 -0
  90. package/dist/{chunk-R2KMLONN.js → chunk-MJDO4EXD.js} +4 -4
  91. package/dist/{chunk-IHVUE3XF.js → chunk-NJA6NT3A.js} +3 -3
  92. package/dist/{chunk-TSIID2LV.js → chunk-ODRPASFP.js} +375 -1166
  93. package/dist/chunk-ODRPASFP.js.map +1 -0
  94. package/dist/{chunk-S3JKF3IK.js → chunk-OJJFANO6.js} +3 -3
  95. package/dist/{chunk-56SOPRM2.js → chunk-OQWPRFAC.js} +344 -4
  96. package/dist/chunk-OQWPRFAC.js.map +1 -0
  97. package/dist/{chunk-QEZZDIQT.js → chunk-P6YQWIT2.js} +4053 -4039
  98. package/dist/chunk-P6YQWIT2.js.map +1 -0
  99. package/dist/{chunk-GGGEGMWC.js → chunk-Q6RSJCXB.js} +9 -9
  100. package/dist/{chunk-OTIUEUIS.js → chunk-QKEUKBRK.js} +7 -7
  101. package/dist/{chunk-X52BVGCJ.js → chunk-QQDPRTLP.js} +5 -5
  102. package/dist/chunk-QQYCYAKI.js +79 -0
  103. package/dist/chunk-QQYCYAKI.js.map +1 -0
  104. package/dist/chunk-R4KDH477.js +1064 -0
  105. package/dist/chunk-R4KDH477.js.map +1 -0
  106. package/dist/{chunk-6AQSUBNR.js → chunk-RGCPELQN.js} +2 -2
  107. package/dist/{chunk-AXODGQ23.js → chunk-RGVCOG2S.js} +9 -2
  108. package/dist/{chunk-AXODGQ23.js.map → chunk-RGVCOG2S.js.map} +1 -1
  109. package/dist/chunk-SOLNJ3AZ.js +209 -0
  110. package/dist/chunk-SOLNJ3AZ.js.map +1 -0
  111. package/dist/{chunk-LQ33RLHL.js → chunk-TFT2X7SH.js} +3 -3
  112. package/dist/chunk-TVWCLUBI.js +293 -0
  113. package/dist/chunk-TVWCLUBI.js.map +1 -0
  114. package/dist/{chunk-VH7JMLTG.js → chunk-UIB33QQP.js} +25 -16
  115. package/dist/chunk-UIB33QQP.js.map +1 -0
  116. package/dist/chunk-V6GIVALQ.js +1889 -0
  117. package/dist/chunk-V6GIVALQ.js.map +1 -0
  118. package/dist/{chunk-IVHGQNIN.js → chunk-VHXCPXUS.js} +8 -8
  119. package/dist/{chunk-7DW7GAM6.js → chunk-VU6GMWF6.js} +2 -2
  120. package/dist/chunk-VWZYE3NC.js +8415 -0
  121. package/dist/chunk-VWZYE3NC.js.map +1 -0
  122. package/dist/{chunk-3X4GOMXT.js → chunk-W2GXIARJ.js} +12 -7
  123. package/dist/chunk-W2GXIARJ.js.map +1 -0
  124. package/dist/chunk-W4G3K3V7.js +288 -0
  125. package/dist/chunk-W4G3K3V7.js.map +1 -0
  126. package/dist/{chunk-FHXTEVO7.js → chunk-W74LJ5OT.js} +21 -28
  127. package/dist/chunk-W74LJ5OT.js.map +1 -0
  128. package/dist/{chunk-FOEPH67T.js → chunk-W7ELYLYK.js} +1 -74
  129. package/dist/chunk-W7ELYLYK.js.map +1 -0
  130. package/dist/{chunk-YU3DLVSQ.js → chunk-XSCGUO2U.js} +5 -5
  131. package/dist/{chunk-EPCIJLLU.js → chunk-XWROSMI5.js} +9 -9
  132. package/dist/{chunk-HMT6L65V.js → chunk-YJGEVBKZ.js} +4 -4
  133. package/dist/{chunk-7U3P4PB7.js → chunk-ZEYA2WWX.js} +4 -4
  134. package/dist/chunk-ZEYA2WWX.js.map +1 -0
  135. package/dist/chunk-ZRC7Z5X3.js +82 -0
  136. package/dist/chunk-ZRC7Z5X3.js.map +1 -0
  137. package/dist/{chunk-I47ARU5G.js → chunk-ZS7JIUJ3.js} +2 -2
  138. package/dist/{claude-cli-2YKABJJZ.js → claude-cli-GIIHOBGT.js} +4 -2
  139. package/dist/claude-install-BAUSJMW3.js +64 -0
  140. package/dist/{cli-BFDKEX53.js → cli-QY4KKA3D.js} +116 -49
  141. package/dist/cli-QY4KKA3D.js.map +1 -0
  142. package/dist/{client-XMWEKXX7.js → client-3YQKORVK.js} +4 -4
  143. package/dist/{codex-host-B6NAUWL6.js → codex-host-ZON3S6HU.js} +5 -5
  144. package/dist/{codex-install-GTGO5FYN.js → codex-install-HZV2DOAB.js} +62 -47
  145. package/dist/codex-install-HZV2DOAB.js.map +1 -0
  146. package/dist/{config-THJANIU5.js → config-QZOBMTEL.js} +18 -18
  147. package/dist/{config-names-JU54HYWY.js → config-names-Z5NZD5R2.js} +18 -18
  148. package/dist/{config-rules-VNU23RL4.js → config-rules-YOYHS6YL.js} +19 -19
  149. package/dist/config-subagents-WQV2ZAD5.js +362 -0
  150. package/dist/config-subagents-WQV2ZAD5.js.map +1 -0
  151. package/dist/{connect-HPWS7U63.js → connect-YDWTYU4B.js} +28 -27
  152. package/dist/{connect-HPWS7U63.js.map → connect-YDWTYU4B.js.map} +1 -1
  153. package/dist/core-0a66n3e7-TTP554XV.js +127 -0
  154. package/dist/core-0a66n3e7-TTP554XV.js.map +1 -0
  155. package/dist/core-0bmnpbz2-C2JIRVZO.js +10790 -0
  156. package/dist/core-0bmnpbz2-C2JIRVZO.js.map +1 -0
  157. package/dist/core-9je8ee1j-74DGHWPV.js +30 -0
  158. package/dist/core-9je8ee1j-74DGHWPV.js.map +1 -0
  159. package/dist/core-wadgcjfh-TSZFQZGH.js +666 -0
  160. package/dist/core-wadgcjfh-TSZFQZGH.js.map +1 -0
  161. package/dist/core-zg882d22-LKV5DZYW.js +37 -0
  162. package/dist/core-zg882d22-LKV5DZYW.js.map +1 -0
  163. package/dist/{decision-JIIHDTOF.js → decision-QSKHOGCO.js} +6 -6
  164. package/dist/{doctor-4MMHBRDU.js → doctor-ZWJXRD75.js} +67 -66
  165. package/dist/doctor-ZWJXRD75.js.map +1 -0
  166. package/dist/{explicit-AGENAX6E.js → explicit-ME2NRADQ.js} +45 -42
  167. package/dist/{explicit-AGENAX6E.js.map → explicit-ME2NRADQ.js.map} +1 -1
  168. package/dist/flush-stdio-NYIJ3QXT.js +18 -0
  169. package/dist/{fund-MLXUH24Q.js → fund-VF7TLDJH.js} +110 -34
  170. package/dist/fund-VF7TLDJH.js.map +1 -0
  171. package/dist/{hook-command-UB7FOEUL.js → hook-command-VZ27MGWO.js} +21 -20
  172. package/dist/hosts/claude/.claude-plugin/marketplace.json +2 -2
  173. package/dist/hosts/claude/tenjin/.claude-plugin/plugin.json +2 -2
  174. package/dist/hosts/claude/tenjin/hooks/hook-data.ts +152 -0
  175. package/dist/hosts/claude/tenjin/hooks/hooks.json +7 -0
  176. package/dist/hosts/claude/tenjin/hooks/model-viewer.tsx +2987 -0
  177. package/dist/hosts/claude/tenjin/hooks/register.tsx +265 -30
  178. package/dist/hosts/claude/tenjin/skills/tenjin-pay/SKILL.md +14 -4
  179. package/dist/hosts/claude/tenjin/types/index.d.ts +133 -0
  180. package/dist/{hosts-WNQKYKP2.js → hosts-3EMTVM4H.js} +5 -3
  181. package/dist/index.js +16 -13
  182. package/dist/index.js.map +1 -1
  183. package/dist/{install-Q5SHHEDH.js → install-ZA7L2UF3.js} +34 -30
  184. package/dist/{install-funding-EGSW2KEP.js → install-funding-JDGYTF72.js} +9 -13
  185. package/dist/{install-identity-OID43B4D.js → install-identity-FFAYEFLX.js} +8 -8
  186. package/dist/{install-wallet-TZFWY5GK.js → install-wallet-2SFOVE3Q.js} +48 -33
  187. package/dist/{install-wallet-TZFWY5GK.js.map → install-wallet-2SFOVE3Q.js.map} +1 -1
  188. package/dist/mcp-36S6MK3C.js +67642 -0
  189. package/dist/mcp-36S6MK3C.js.map +1 -0
  190. package/dist/new-install-5L4GY3LN.js +51 -0
  191. package/dist/{package-NRHU7HBR.js → package-BONDXSV3.js} +2 -2
  192. package/dist/{passphrase-3JEVW5XG.js → passphrase-T4ULBN4M.js} +4 -4
  193. package/dist/{pay-I47AIUQR.js → pay-CMV5KL74.js} +37 -30
  194. package/dist/{payments-A5FNI5GN.js → payments-Z6UBZL4Z.js} +10 -10
  195. package/dist/reclaim-subagent-credit-ABSF67SJ.js +105 -0
  196. package/dist/reclaim-subagent-credit-ABSF67SJ.js.map +1 -0
  197. package/dist/{routing-quote-QQW2I5MH.js → routing-quote-AHLAREXR.js} +16 -18
  198. package/dist/{run-4SHEOBIU.js → run-JH7ELYAM.js} +41 -38
  199. package/dist/{runtime-BABJMHY7.js → runtime-2GX4ALJP.js} +12 -12
  200. package/dist/{runtime-activate-N6VLQI2C.js → runtime-activate-IDQ2NCSP.js} +9 -9
  201. package/dist/{runtime-launchers-GMAUICRW.js → runtime-launchers-YAPKCBHV.js} +7 -7
  202. package/dist/{runtime-place-DOEWFTF3.js → runtime-place-4POL4KK4.js} +3 -3
  203. package/dist/{send-ECXS6JEO.js → send-ELXFKEKY.js} +17 -17
  204. package/dist/{status-AHE5HSR7.js → status-FXUFWJDM.js} +89 -36
  205. package/dist/status-FXUFWJDM.js.map +1 -0
  206. package/dist/{status-line-63XFJAXR.js → status-line-IH5JBWBC.js} +11 -11
  207. package/dist/{streamableHttp-Z3YF6LTQ.js → streamableHttp-CP2ZQBIK.js} +4 -4
  208. package/dist/{uninstall-YGQPRCVY.js → uninstall-LJZUKM4D.js} +42 -38
  209. package/dist/{uninstall-YGQPRCVY.js.map → uninstall-LJZUKM4D.js.map} +1 -1
  210. package/dist/{update-GTLMLFA3.js → update-EUIX72IX.js} +34 -30
  211. package/dist/{usage-FCWP2CHO.js → usage-EKDC7LUC.js} +13 -13
  212. package/dist/{usdc-25RNBYYR.js → usdc-YIHK2OMC.js} +5 -5
  213. package/dist/{viemAdapter-By13KInL-3CG63XDX.js → viemAdapter-By13KInL-PRLSIESK.js} +2 -2
  214. package/dist/viemAdapter-By13KInL-PRLSIESK.js.map +1 -0
  215. package/dist/wallet-HSW757W6.js +80 -0
  216. package/dist/wallet-HSW757W6.js.map +1 -0
  217. package/docs/agent-permissions.md +19 -11
  218. package/docs/router-reference.md +21 -12
  219. package/docs/safety-model.md +4 -2
  220. package/docs/subagents-internals.md +97 -0
  221. package/docs/subagents.md +348 -0
  222. package/package.json +4 -1
  223. package/dist/balance-RQW5T5FB.js +0 -55
  224. package/dist/chunk-3X4GOMXT.js.map +0 -1
  225. package/dist/chunk-46HAB26L.js.map +0 -1
  226. package/dist/chunk-56SOPRM2.js.map +0 -1
  227. package/dist/chunk-5VWQSCDO.js.map +0 -1
  228. package/dist/chunk-6J64MQFD.js.map +0 -1
  229. package/dist/chunk-7U3P4PB7.js.map +0 -1
  230. package/dist/chunk-APWELUI7.js.map +0 -1
  231. package/dist/chunk-E6VP6MQM.js.map +0 -1
  232. package/dist/chunk-EQZ2CCWC.js.map +0 -1
  233. package/dist/chunk-FHXTEVO7.js.map +0 -1
  234. package/dist/chunk-FOEPH67T.js.map +0 -1
  235. package/dist/chunk-IVXPIIZJ.js +0 -91
  236. package/dist/chunk-IVXPIIZJ.js.map +0 -1
  237. package/dist/chunk-JF4T4HCQ.js.map +0 -1
  238. package/dist/chunk-LPQNZKSG.js +0 -269
  239. package/dist/chunk-LPQNZKSG.js.map +0 -1
  240. package/dist/chunk-MXN2ZEUB.js.map +0 -1
  241. package/dist/chunk-OO6FIBL7.js.map +0 -1
  242. package/dist/chunk-PNHNXUSL.js.map +0 -1
  243. package/dist/chunk-PYVQ74D5.js.map +0 -1
  244. package/dist/chunk-PZHBPGDE.js.map +0 -1
  245. package/dist/chunk-QEZZDIQT.js.map +0 -1
  246. package/dist/chunk-QXP3Z3JN.js.map +0 -1
  247. package/dist/chunk-RJ5HRPAZ.js.map +0 -1
  248. package/dist/chunk-TSIID2LV.js.map +0 -1
  249. package/dist/chunk-UVDJ5SSQ.js.map +0 -1
  250. package/dist/chunk-VFKPIIV2.js.map +0 -1
  251. package/dist/chunk-VH7JMLTG.js.map +0 -1
  252. package/dist/claude-install-7CVYQ73E.js +0 -60
  253. package/dist/cli-BFDKEX53.js.map +0 -1
  254. package/dist/codex-install-GTGO5FYN.js.map +0 -1
  255. package/dist/doctor-4MMHBRDU.js.map +0 -1
  256. package/dist/fund-MLXUH24Q.js.map +0 -1
  257. package/dist/mcp-CC3H7LFO.js +0 -3655
  258. package/dist/mcp-CC3H7LFO.js.map +0 -1
  259. package/dist/status-AHE5HSR7.js.map +0 -1
  260. package/dist/wallet-CJGEHP2Q.js +0 -64
  261. /package/dist/{_esm-MMYV66AX.js.map → _esm-2KST7HQ7.js.map} +0 -0
  262. /package/dist/{alive-VOIL5W3I.js.map → alive-5TV22PNF.js.map} +0 -0
  263. /package/dist/{auth-UHD3QFX4.js.map → auth-XI7BJFLW.js.map} +0 -0
  264. /package/dist/{balance-RQW5T5FB.js.map → balance-DFHC6XEU.js.map} +0 -0
  265. /package/dist/{ccip-CS7K5QRQ.js.map → ccip-HOW3DZYF.js.map} +0 -0
  266. /package/dist/{chunk-FSYH7J75.js.map → chunk-3Y6BHIN6.js.map} +0 -0
  267. /package/dist/{chunk-FZZWTDWP.js.map → chunk-3YPL6T3P.js.map} +0 -0
  268. /package/dist/{chunk-JEZMWJEF.js.map → chunk-44MVIRZH.js.map} +0 -0
  269. /package/dist/{chunk-27FIHFXF.js.map → chunk-45MMSBHA.js.map} +0 -0
  270. /package/dist/{chunk-7JB6SYJX.js.map → chunk-54ELBTKE.js.map} +0 -0
  271. /package/dist/{chunk-HWZO6HYZ.js.map → chunk-6QMDUDF2.js.map} +0 -0
  272. /package/dist/{chunk-FNBGRKS6.js.map → chunk-7V25UAQO.js.map} +0 -0
  273. /package/dist/{chunk-JOKPBYXP.js.map → chunk-DTEWAVNE.js.map} +0 -0
  274. /package/dist/{chunk-KAILF7QA.js.map → chunk-F43CV6UC.js.map} +0 -0
  275. /package/dist/{chunk-ACO7ZCR2.js.map → chunk-FKVJKLPI.js.map} +0 -0
  276. /package/dist/{chunk-2F5JUAHZ.js.map → chunk-GAJC4BQZ.js.map} +0 -0
  277. /package/dist/{chunk-L7N73ZAW.js.map → chunk-HAZAN4UM.js.map} +0 -0
  278. /package/dist/{chunk-6QJZA6EX.js.map → chunk-HI5XQOX2.js.map} +0 -0
  279. /package/dist/{chunk-BOENA6XR.js.map → chunk-HKGUKAQW.js.map} +0 -0
  280. /package/dist/{chunk-LJSCGIYH.js.map → chunk-HPRVFJPM.js.map} +0 -0
  281. /package/dist/{chunk-SDUOJRSV.js.map → chunk-IGLWLH73.js.map} +0 -0
  282. /package/dist/{chunk-3AKH7ODX.js.map → chunk-INSIW65E.js.map} +0 -0
  283. /package/dist/{chunk-2P3NJTHE.js.map → chunk-JHFFUVON.js.map} +0 -0
  284. /package/dist/{chunk-2TO5F6CT.js.map → chunk-K5KNGC4I.js.map} +0 -0
  285. /package/dist/{chunk-HUWTFKEM.js.map → chunk-KAQ4Q3TO.js.map} +0 -0
  286. /package/dist/{chunk-GS5RZF7U.js.map → chunk-KLDMLWXT.js.map} +0 -0
  287. /package/dist/{chunk-HN2EN6P4.js.map → chunk-KNKDMTHU.js.map} +0 -0
  288. /package/dist/{chunk-R2KMLONN.js.map → chunk-MJDO4EXD.js.map} +0 -0
  289. /package/dist/{chunk-IHVUE3XF.js.map → chunk-NJA6NT3A.js.map} +0 -0
  290. /package/dist/{chunk-S3JKF3IK.js.map → chunk-OJJFANO6.js.map} +0 -0
  291. /package/dist/{chunk-GGGEGMWC.js.map → chunk-Q6RSJCXB.js.map} +0 -0
  292. /package/dist/{chunk-OTIUEUIS.js.map → chunk-QKEUKBRK.js.map} +0 -0
  293. /package/dist/{chunk-X52BVGCJ.js.map → chunk-QQDPRTLP.js.map} +0 -0
  294. /package/dist/{chunk-6AQSUBNR.js.map → chunk-RGCPELQN.js.map} +0 -0
  295. /package/dist/{chunk-LQ33RLHL.js.map → chunk-TFT2X7SH.js.map} +0 -0
  296. /package/dist/{chunk-IVHGQNIN.js.map → chunk-VHXCPXUS.js.map} +0 -0
  297. /package/dist/{chunk-7DW7GAM6.js.map → chunk-VU6GMWF6.js.map} +0 -0
  298. /package/dist/{chunk-YU3DLVSQ.js.map → chunk-XSCGUO2U.js.map} +0 -0
  299. /package/dist/{chunk-EPCIJLLU.js.map → chunk-XWROSMI5.js.map} +0 -0
  300. /package/dist/{chunk-HMT6L65V.js.map → chunk-YJGEVBKZ.js.map} +0 -0
  301. /package/dist/{chunk-I47ARU5G.js.map → chunk-ZS7JIUJ3.js.map} +0 -0
  302. /package/dist/{claude-cli-2YKABJJZ.js.map → claude-cli-GIIHOBGT.js.map} +0 -0
  303. /package/dist/{claude-install-7CVYQ73E.js.map → claude-install-BAUSJMW3.js.map} +0 -0
  304. /package/dist/{client-XMWEKXX7.js.map → client-3YQKORVK.js.map} +0 -0
  305. /package/dist/{codex-host-B6NAUWL6.js.map → codex-host-ZON3S6HU.js.map} +0 -0
  306. /package/dist/{config-THJANIU5.js.map → config-QZOBMTEL.js.map} +0 -0
  307. /package/dist/{config-names-JU54HYWY.js.map → config-names-Z5NZD5R2.js.map} +0 -0
  308. /package/dist/{config-rules-VNU23RL4.js.map → config-rules-YOYHS6YL.js.map} +0 -0
  309. /package/dist/{decision-JIIHDTOF.js.map → decision-QSKHOGCO.js.map} +0 -0
  310. /package/dist/{hook-command-UB7FOEUL.js.map → flush-stdio-NYIJ3QXT.js.map} +0 -0
  311. /package/dist/{hosts-WNQKYKP2.js.map → hook-command-VZ27MGWO.js.map} +0 -0
  312. /package/dist/{install-Q5SHHEDH.js.map → hosts-3EMTVM4H.js.map} +0 -0
  313. /package/dist/{install-funding-EGSW2KEP.js.map → install-ZA7L2UF3.js.map} +0 -0
  314. /package/dist/{install-identity-OID43B4D.js.map → install-funding-JDGYTF72.js.map} +0 -0
  315. /package/dist/{package-NRHU7HBR.js.map → install-identity-FFAYEFLX.js.map} +0 -0
  316. /package/dist/{passphrase-3JEVW5XG.js.map → new-install-5L4GY3LN.js.map} +0 -0
  317. /package/dist/{pay-I47AIUQR.js.map → package-BONDXSV3.js.map} +0 -0
  318. /package/dist/{routing-quote-QQW2I5MH.js.map → passphrase-T4ULBN4M.js.map} +0 -0
  319. /package/dist/{run-4SHEOBIU.js.map → pay-CMV5KL74.js.map} +0 -0
  320. /package/dist/{payments-A5FNI5GN.js.map → payments-Z6UBZL4Z.js.map} +0 -0
  321. /package/dist/{runtime-activate-N6VLQI2C.js.map → routing-quote-AHLAREXR.js.map} +0 -0
  322. /package/dist/{runtime-launchers-GMAUICRW.js.map → run-JH7ELYAM.js.map} +0 -0
  323. /package/dist/{runtime-BABJMHY7.js.map → runtime-2GX4ALJP.js.map} +0 -0
  324. /package/dist/{runtime-place-DOEWFTF3.js.map → runtime-activate-IDQ2NCSP.js.map} +0 -0
  325. /package/dist/{update-GTLMLFA3.js.map → runtime-launchers-YAPKCBHV.js.map} +0 -0
  326. /package/dist/{usdc-25RNBYYR.js.map → runtime-place-4POL4KK4.js.map} +0 -0
  327. /package/dist/{send-ECXS6JEO.js.map → send-ELXFKEKY.js.map} +0 -0
  328. /package/dist/{status-line-63XFJAXR.js.map → status-line-IH5JBWBC.js.map} +0 -0
  329. /package/dist/{streamableHttp-Z3YF6LTQ.js.map → streamableHttp-CP2ZQBIK.js.map} +0 -0
  330. /package/dist/{viemAdapter-By13KInL-3CG63XDX.js.map → update-EUIX72IX.js.map} +0 -0
  331. /package/dist/{usage-FCWP2CHO.js.map → usage-EKDC7LUC.js.map} +0 -0
  332. /package/dist/{wallet-CJGEHP2Q.js.map → usdc-YIHK2OMC.js.map} +0 -0
@@ -1,6 +1,27 @@
1
1
  import type { EngineInterface, Register, ToolCallResult } from 'claude-code';
2
+ import {
3
+ asRecord,
4
+ HELD_NOT_STARTED,
5
+ HELD_WITH_OFFER,
6
+ keepDelegatedHint,
7
+ parseJson,
8
+ readJson,
9
+ tenjinDataDir,
10
+ textOf,
11
+ } from './hook-data';
2
12
 
3
13
  import type { TenjinHeld, TenjinRow } from '../types';
14
+ import {
15
+ keptNative,
16
+ modelStep,
17
+ raisedByThisPlugin,
18
+ registerModelViewer,
19
+ rememberModelOffer,
20
+ watchContinuation,
21
+ sessionLives,
22
+ translateViewerContinuation,
23
+ VIEWER_TYPE,
24
+ } from './model-viewer';
4
25
 
5
26
  /**
6
27
  * THE TENJIN MOD: one line per paid lookup, drawn from documented props only.
@@ -91,7 +112,159 @@ type Shape = {
91
112
  };
92
113
  type Elements = ReturnType<Dollar['ui']['resolve']>;
93
114
 
115
+ /**
116
+ * A DEEPSEEK WORKER GETS THE HOOK EVENTS A NATIVE SUBAGENT GETS. A native subagent fires
117
+ * no `SessionStart` when it starts or resumes and no `UserPromptSubmit` for its prompts,
118
+ * so in a worker's process those two events end here, above the person's settings hooks
119
+ * and the plugins' command hooks: none of them runs, and no context they add reaches the
120
+ * worker. A compaction's `SessionStart` still runs, as it does in a native subagent, and
121
+ * so does every other event (`PreToolUse`, `PostToolUse`, `PermissionRequest`, `Stop`
122
+ * and the rest), untouched. Managed settings hooks sit above every mod and still run.
123
+ * Where the worker flag cannot be read, the event runs as before.
124
+ */
125
+ async function inWorker($: Dollar): Promise<boolean> {
126
+ return (await $.env.get('TENJIN_MODEL_WORKER').catch(() => undefined)) === '1';
127
+ }
128
+
94
129
  export const register: Register = (on) => {
130
+ on('classic.PreToolUse', async ($, e, next) => {
131
+ const input: Json = { ...e };
132
+ delete input.tool;
133
+ delete input.tool_use_id;
134
+ return keepDelegatedHint($, e.tool, input, await next(e));
135
+ });
136
+ on('classic.SessionStart', async ($, e, next) =>
137
+ (e.source === 'startup' || e.source === 'resume') && (await inWorker($)) ? {} : next(e),
138
+ );
139
+ on('classic.UserPromptSubmit', async ($, e, next) => ((await inWorker($)) ? {} : next(e)));
140
+ registerModelViewer(on);
141
+ on('tool.describe', { tool: ['Agent', 'Task'] }, async ($, e, next) => {
142
+ const data = await tenjinDataDir($);
143
+ const router = data ? asRecord((await readJson($, `${data}/config.json`))?.router) : undefined;
144
+ if (router?.subagents !== true) return next(e);
145
+ return {
146
+ description: `${e.description}\n\nCopy complete assignments verbatim, including the final line, literal commands and output format. Add only missing known context. Preserve all binding details, actors and scope; never truncate. Add no model/routing advice. Compare the full assignment with the source before calling.`,
147
+ };
148
+ });
149
+ on('tool.call', { tool: ['Agent', 'Task', 'SendMessage'] }, async ($, e, next) => {
150
+ // THE PLUGIN'S OWN AGENT IS NOT THE PARENT'S CALL. The host raises this mod's start of
151
+ // the worker's viewer agent as an Agent call too (seen live: a no-offer record,
152
+ // `input_filter:run_in_background`, at the second of every accept). It is never
153
+ // judged, offered or recorded: told by who raised it, and by its type.
154
+ if (raisedByThisPlugin(next.origin) || (e as Json).subagent_type === VIEWER_TYPE)
155
+ return next(e);
156
+ const { tool_use_id, ...raw } = e;
157
+ delete (raw as Json).tool;
158
+ // A NATIVE SUBAGENT'S CALL IS JUDGED AS THE MAIN LOOP'S, at any depth. The host
159
+ // adds the id of the loop that made a call to its event; that is no field of the
160
+ // call, so it leaves the input and goes as `agent`, the loop that gets the offer.
161
+ delete (raw as Json).agentId;
162
+ const translated = await translateViewerContinuation($, e.tool, raw);
163
+ const input = translated.input;
164
+ const owned = translated.owned || ownedContinuationAddress(input, e.tool);
165
+ const unavailable = () =>
166
+ heldAnswer(
167
+ e.tool,
168
+ 'Tenjin continuation is unavailable. No continuation started. Do not retry this owned handle through native tools.',
169
+ );
170
+ if (translated.unavailable) return unavailable();
171
+ if (e.tool === 'SendMessage' && !owned) return next(e);
172
+ try {
173
+ const data = await tenjinDataDir($);
174
+ const router = data
175
+ ? asRecord((await readJson($, `${data}/config.json`))?.router)
176
+ : undefined;
177
+ if (router?.subagents !== true || (await $.env.get('TENJIN_MODEL_WORKER')) === '1')
178
+ return owned ? unavailable() : next(e);
179
+ // A held call is never rewritten: the parent keeps it native by sending it
180
+ // again unchanged, and that repeat runs here as it was reviewed. The model
181
+ // request that made it tells that repeat from a second call of one response.
182
+ const step = modelStep(e.agentId);
183
+ const agent = e.agentId === undefined ? undefined : await callerOf($, e.agentId);
184
+ const response = await $.tool.call({
185
+ tool: 'mcp__plugin_tenjin_router__subagent',
186
+ capture: {
187
+ session_id: await $.session.id(),
188
+ tool_use_id,
189
+ input,
190
+ tool: e.tool,
191
+ ...(step !== undefined ? { step } : {}),
192
+ ...(agent !== undefined ? { agent } : {}),
193
+ },
194
+ });
195
+ const text = textOf(response.result) ?? response.text;
196
+ const offer = asRecord(parseJson(text));
197
+ if (offer?.action === 'native') await keptNative($, offer.settled);
198
+ // A MESSAGE THE WORKER TOOK is answered as a native send is: the call ran and succeeded.
199
+ // `delivered`: to a worker that runs, at its next turn. `continued`: a finished worker,
200
+ // resumed by the message, whose result arrives by itself as a background agent's does.
201
+ if (
202
+ e.tool === 'SendMessage' &&
203
+ (offer?.action === 'delivered' || offer?.action === 'continued') &&
204
+ typeof offer.message === 'string' &&
205
+ offer.message.trim().length > 0 &&
206
+ offer.message.length <= 2000
207
+ ) {
208
+ if (
209
+ offer.action === 'continued' &&
210
+ typeof offer.offer_id === 'string' &&
211
+ /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(
212
+ offer.offer_id,
213
+ )
214
+ ) {
215
+ const offerId = offer.offer_id;
216
+ await rememberModelOffer($, offerId, { ...input, run_in_background: true }).catch(
217
+ () => undefined,
218
+ );
219
+ // THE FOLLOW-UP IS AN ACCEPTED JOB, so it has what one has: its agent-list entry with
220
+ // the activity and the stop control, tied to the calling agent, and its result handed
221
+ // over once it ends. The accept hook does not see it, so it is set up here.
222
+ await watchContinuation($, offerId, e.agentId).catch(() => undefined);
223
+ }
224
+ return { result: { success: true, message: offer.message } };
225
+ }
226
+ if (
227
+ offer?.action === 'refused' &&
228
+ offer.started === false &&
229
+ typeof offer.reason === 'string' &&
230
+ offer.reason.trim().length > 0 &&
231
+ offer.reason.length <= 4000 &&
232
+ typeof offer.instruction === 'string' &&
233
+ offer.instruction.trim().length > 0 &&
234
+ offer.instruction.length <= 4000
235
+ )
236
+ return heldAnswer(
237
+ e.tool,
238
+ JSON.stringify({
239
+ action: 'refused',
240
+ started: false,
241
+ reason: offer.reason,
242
+ instruction: offer.instruction,
243
+ }),
244
+ );
245
+ if (
246
+ offer?.action === 'offer' &&
247
+ offer.started === false &&
248
+ typeof offer.offer_id === 'string' &&
249
+ /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(
250
+ offer.offer_id,
251
+ )
252
+ ) {
253
+ await rememberModelOffer($, offer.offer_id, input).catch(() => undefined);
254
+ // The handoff marks a follow-up to an owned worker, whichever tool carried it.
255
+ const continuation = offer.continuation === true || e.tool === 'SendMessage';
256
+ return heldAnswer(e.tool, text ?? JSON.stringify(offer), {
257
+ offer: offer.offer_id,
258
+ context: heldOfferContext(offer, continuation),
259
+ continuation,
260
+ });
261
+ }
262
+ } catch {
263
+ /* An owned handle must never reach a native executor, including on local failure. */
264
+ }
265
+ return owned ? unavailable() : next(e);
266
+ });
267
+
95
268
  on('tool.call', { tool: REQUEST_TOOL }, async ($, e, next) => {
96
269
  // The swap's own `decide` call is drawn on the native call's row.
97
270
  if (e.decide !== undefined) return next(e);
@@ -169,6 +342,7 @@ export const register: Register = (on) => {
169
342
 
170
343
  // The CLI's prompt hook keeps the record before this existing turn surface.
171
344
  on('turn.start', async ($, e, next) => {
345
+ sessionLives();
172
346
  if (e.agentId === undefined) {
173
347
  const now = await $.clock.now();
174
348
  const previous = (await $.state.get(LAST_TURN_START)).value;
@@ -808,17 +982,6 @@ function envelopeOf(text: string | undefined): Json | undefined {
808
982
  return undefined;
809
983
  }
810
984
 
811
- /** A stored result's text: a string, or MCP content blocks bare or in `content`. */
812
- function textOf(output: unknown): string | undefined {
813
- if (typeof output === 'string') return output;
814
- const blocks = Array.isArray(output) ? output : asRecord(output)?.content;
815
- if (!Array.isArray(blocks)) return undefined;
816
- return blocks
817
- .map((block) => asRecord(block)?.text)
818
- .filter((text) => typeof text === 'string')
819
- .join('');
820
- }
821
-
822
985
  /** USDC has 6 decimals; whole cents keep two. */
823
986
  function usd(atomic: bigint): string {
824
987
  const fraction = (atomic % 1_000_000n).toString().padStart(6, '0').replace(/0+$/, '');
@@ -829,34 +992,106 @@ function atomicOf(value: unknown): string | undefined {
829
992
  return typeof value === 'string' && /^\d{1,30}$/.test(value) ? value : undefined;
830
993
  }
831
994
 
832
- async function tenjinDataDir($: Dollar): Promise<string | null> {
833
- const override = await $.env.get('TENJIN_DATA_DIR');
834
- if (override !== undefined && override.length > 0) return override;
835
- const home = (await $.env.get('HOME')) ?? (await $.env.get('USERPROFILE'));
836
- return home !== undefined && home.length > 0 ? `${home}/.tenjin` : null;
995
+ /** Reserve address fields only; backend validation owns identity and follow-up semantics. */
996
+ function ownedContinuationAddress(input: Json, tool: string): boolean {
997
+ const addresses = tool === 'SendMessage' ? [input.to, input.recipient] : [input.resume];
998
+ return addresses
999
+ .flatMap((value) => (Array.isArray(value) ? value : [value]))
1000
+ .some((value) => typeof value === 'string' && /^tenjin-(worker|offer)-/i.test(value.trim()));
837
1001
  }
838
1002
 
839
- async function readJson($: Dollar, path: string): Promise<Json | null> {
1003
+ /**
1004
+ * THE NATIVE SUBAGENT THAT MADE A CALL, as the host lists it: its id, the type it runs
1005
+ * as, the types of the agents above it (nearest first, '' for one no longer listed)
1006
+ * and the folder it works in. The CLI judges from these whether it can accept an offer
1007
+ * and whether a worker would run as its native child would. One the host does not list
1008
+ * goes by its id alone, and the CLI keeps its call native.
1009
+ */
1010
+ async function callerOf($: Dollar, agentId: string): Promise<Json> {
840
1011
  try {
841
- return asRecord(parseJson(await $.fs.read(path))) ?? null;
1012
+ const agents = await $.agent.list();
1013
+ const own = agents.find((agent) => agent.id === agentId);
1014
+ if (!own) return { id: agentId };
1015
+ const parents: string[] = [];
1016
+ let above = own.parentId;
1017
+ while (above !== undefined) {
1018
+ const parent = parents.length < 16 ? agents.find((agent) => agent.id === above) : undefined;
1019
+ parents.push(parent?.type ?? '');
1020
+ above = parent?.parentId;
1021
+ }
1022
+ return { id: agentId, type: own.type, parents, cwd: own.cwd };
842
1023
  } catch {
843
- return null;
1024
+ return { id: agentId };
844
1025
  }
845
1026
  }
846
1027
 
847
- function parseJson(text: unknown): unknown {
848
- if (typeof text !== 'string') return undefined;
849
- try {
850
- return JSON.parse(text) as unknown;
851
- } catch {
852
- return undefined;
853
- }
1028
+ /**
1029
+ * A held call's answer. An Agent or Task call is refused, with the offer as the refusal's
1030
+ * text (`hook-data.ts` says why): the first line for a person, then what the parent is to
1031
+ * do with it, then what the hook would have added as context (a refusal carries none),
1032
+ * then the offer itself. A refusal reads as an error to a model, so the text says first
1033
+ * that nothing failed and names the only two moves; a parent that took a held call for a
1034
+ * failure once switched to another tool. THAT THE CALL WAS HELD AND DID NOT RUN IS SAID
1035
+ * HERE ONLY: the context line and the offer's instruction do not say it again.
1036
+ */
1037
+ function heldAnswer(
1038
+ tool: string,
1039
+ offerText: string,
1040
+ held?: { offer: string; context: string[] | undefined; continuation?: boolean },
1041
+ ) {
1042
+ // Native SendMessage refusals return this data shape; an offer is not a delivered message.
1043
+ if (tool === 'SendMessage')
1044
+ return {
1045
+ result: {
1046
+ success: false,
1047
+ // The statement of what happened comes first: the host shows a held call as a refusal.
1048
+ message: held
1049
+ ? `Not delivered yet: the follow-up to the DeepSeek worker is held until you run it with subagent({offer_id}) or cancel it. ${offerText}`
1050
+ : offerText,
1051
+ },
1052
+ ...(held?.context ? { context: held.context } : {}),
1053
+ };
1054
+ if (!held) return { deny: `${HELD_NOT_STARTED}.\n${offerText}` };
1055
+ return {
1056
+ deny: [
1057
+ `${HELD_WITH_OFFER} (offer ${held.offer}). It has not run.`,
1058
+ // A FOLLOW-UP TO A TENJIN WORKER HAS NO NATIVE FORM: its handle never reaches a native
1059
+ // tool, so the same call sent again is held again, as a new offer in place of this one.
1060
+ held.continuation
1061
+ ? `This is not a failure, and there is nothing to recover or work around: the Tenjin plugin holds this follow-up to a DeepSeek worker until you choose. Your two moves are to run it with subagent({offer_id}), or to cancel it with subagent({cancel: offer_id}). Sending this same ${tool} call again does not run it: a Tenjin worker handle never runs natively, and the repeat is held again. Do not switch to another tool or do the work yourself because of this message.`
1062
+ : `This is not a failure, and there is nothing to recover or work around: the Tenjin plugin holds this ${tool} call until you choose. Your two moves are to accept the offer with subagent({offer_id}), or to send this same ${tool} call again unchanged, which runs it natively. Do not switch to another tool or do the work yourself because of this message.`,
1063
+ ...(held.context ?? []),
1064
+ offerText,
1065
+ ].join('\n'),
1066
+ };
854
1067
  }
855
1068
 
856
- function asRecord(value: unknown): Json | undefined {
857
- return value !== null && typeof value === 'object' && !Array.isArray(value)
858
- ? (value as Json)
859
- : undefined;
1069
+ function heldOfferContext(offer: Json, continuation = false): string[] | undefined {
1070
+ const consent = asRecord(offer.consent);
1071
+ if (
1072
+ consent?.version !== 2 ||
1073
+ typeof consent.repository !== 'string' ||
1074
+ !consent.repository.trim() ||
1075
+ typeof consent.routerOrigin !== 'string' ||
1076
+ !/^https?:\/\/\S+$/.test(consent.routerOrigin) ||
1077
+ !Array.isArray(consent.recipients) ||
1078
+ consent.recipients.length !== 3 ||
1079
+ consent.recipients[0] !== 'Tenjin' ||
1080
+ consent.recipients[1] !== 'DeepSeek' ||
1081
+ consent.recipients[2] !== 'Exa' ||
1082
+ typeof offer.capAtomic !== 'string' ||
1083
+ !/^[1-9][0-9]*$/.test(offer.capAtomic) ||
1084
+ typeof offer.parentPolicy !== 'string' ||
1085
+ !offer.parentPolicy.trim()
1086
+ )
1087
+ return undefined;
1088
+ // This field is constructed by the local handoff, after its consent check.
1089
+ // Never promote the router's reason or other model/provider text into context.
1090
+ return [
1091
+ continuation
1092
+ ? "This local Tenjin hook held the continuation; no continuation started. The user has installed Tenjin and turned DeepSeek subagents on. Run it with the subagent tool and this offer_id, or cancel it with that id. Its suitability is not judged again; the binding model, privacy and planning restrictions in the offer's parentPolicy still apply to its text. It reuses the worker's history and the original job's budget, with no routing fee."
1093
+ : "The user has installed Tenjin and turned DeepSeek subagents on. The offer's parentPolicy is local Tenjin guidance: apply it with the full assignment, the repository/configuration risk rules and the binding model/privacy restrictions.",
1094
+ ];
860
1095
  }
861
1096
 
862
1097
  async function sha256Hex(text: string): Promise<string> {
@@ -36,6 +36,11 @@ cannot pay the endpoint. A 2xx on the probe is delivered free. Read the quote
36
36
  before the first call to an endpoint, and again when the body or the headers
37
37
  change: some endpoints price by request shape.
38
38
 
39
+ `signIn: true` with no `accepts` means the endpoint, such as a paid run's
40
+ status URL, asks the wallet that paid it to sign in. `tenjin pay <url> --json`
41
+ (a GET, with no `--max-price` or `--yes`) signs in and pays nothing. It
42
+ refuses with exit 3 when this wallet has not paid that host.
43
+
39
44
  ## Pay
40
45
 
41
46
  ```bash
@@ -59,10 +64,15 @@ tenjin pay <url> --json --max-price <usd> [-X <method>] [-d '<json-body>'] [-H '
59
64
  - Every paid call pays. There is no cache and no dedupe: a loop pays on every
60
65
  turn. Batch work needs the user's consent for the whole batch and its total.
61
66
  - A paid 2xx returns `amountPaid`, `payTo`, `settlementTxHash` when the
62
- seller reported one, and the body. A 4xx or 5xx AFTER payment is exit 4
63
- (`PAYMENT_FAILED`): the signed authorization already left, so do not retry
64
- blindly. Read the provider's error in `details.body`, fix the request, and
65
- quote again.
67
+ seller reported one, and the body. A file (an image, a sound, a PDF) is saved
68
+ instead, and `savedTo` is its path; `saveError` says why when Downloads could
69
+ not take it. If no folder could, `bodyBase64` holds the bytes.
70
+ - A 4xx or 5xx AFTER payment is exit 4 (`PAYMENT_FAILED`): the signed
71
+ authorization already left, so do not retry blindly. Read `details.body` and
72
+ `details.paymentError` (the seller's reason), fix the request, and quote
73
+ again. When `details.settlement` is `"settled"`, say it was charged. When
74
+ only `details.reportedTxHash` is set, say the seller reports a charge the
75
+ chain does not show yet. In both cases, do not ask for funds.
66
76
 
67
77
  ## Refusals are answers
68
78
 
@@ -34,6 +34,132 @@ export type TenjinHeld = {
34
34
  price?: string;
35
35
  };
36
36
 
37
+ /** Bounded, redacted display data only; the worker controller owns execution/history/accounting. */
38
+ export type TenjinModelActivity = {
39
+ version: 1;
40
+ offerId: string;
41
+ workerHandle: string;
42
+ generation: string;
43
+ /** The agent type the worker runs as: `general-purpose`, `Explore` or a custom agent's name. */
44
+ nativeProfile: string;
45
+ sequence: number;
46
+ state: 'starting' | 'running' | 'completed' | 'cancelled' | 'unknown';
47
+ /** False when the worker's Claude Code never started. */
48
+ started?: boolean;
49
+ droppedRows: number;
50
+ rows: {
51
+ id: string;
52
+ sequence: number;
53
+ kind: 'text' | 'tool' | 'status' | 'compaction';
54
+ state: string;
55
+ name?: string;
56
+ text?: string;
57
+ inputSummary?: string;
58
+ /** A shell call's command, with the job's replacements already applied by the CLI. */
59
+ command?: string;
60
+ outputPreview?: string;
61
+ elapsedSeconds?: number;
62
+ /** Which worker reply the row belongs to: the viewer writes each reply as one step. */
63
+ message?: string;
64
+ /** A file read's line count, as Claude Code reported it to the worker. */
65
+ lines?: number;
66
+ /** A web call's URL or query, with the job's replacements already applied by the CLI. */
67
+ target?: string;
68
+ /** The router tool that served the call (`Exa search`), as the router's rows name it. */
69
+ via?: string;
70
+ /** A web call's own figures from Claude Code's record: never its content. */
71
+ figures?: {
72
+ bytes?: number;
73
+ code?: number;
74
+ codeText?: string;
75
+ durationMs?: number;
76
+ searchCount?: number;
77
+ durationSeconds?: number;
78
+ };
79
+ }[];
80
+ /** Tool calls the worker made, as a native subagent row counts them. */
81
+ toolUses?: number;
82
+ /** The latest worker turn's tokens, as a native subagent row counts them. */
83
+ tokens?: number;
84
+ /** While running, what has settled so far; once ended, the final accounting. */
85
+ spend?: { reservedAtomic: string; actualAtomic: string; uncertain: string[] };
86
+ };
87
+
88
+ /**
89
+ * An offer's own row draws only while the offer is open. Accepted, kept native
90
+ * by the repeated call, cancelled or expired, the task has one row: the
91
+ * worker's, or the native call's.
92
+ */
93
+ export type TenjinModelOffer = {
94
+ /** When the offer was made, on the plugin's clock. */
95
+ at: number;
96
+ state: 'offered' | 'native' | 'cancelled';
97
+ /** The held call asked to run in the background (`run_in_background`): its worker does. */
98
+ background?: true;
99
+ /** A background worker's result was handed to the parent, once. */
100
+ delivered?: true;
101
+ };
102
+
103
+ /** One accept call's live row, kept by its offer id while the worker runs. Display only. */
104
+ export type TenjinModelWorker = {
105
+ offerId: string;
106
+ /** The held Agent call's description, cleaned. */
107
+ title: string;
108
+ /** When the accept call started, on the plugin's clock. */
109
+ startedAt: number;
110
+ /** Absent only for a row settled after a resume from a job that kept no time. */
111
+ elapsedMs?: number;
112
+ state: TenjinModelActivity['state'];
113
+ toolUses?: number;
114
+ tokens?: number;
115
+ /** Settled so far, in atomic USDC; never a quote. */
116
+ spentAtomic?: string;
117
+ /** The worker's latest step, as a native row names it: `Read(src/a.ts)`. */
118
+ current?: string;
119
+ /**
120
+ * How the worker ended, once it has: from the accept call's answer or, for a
121
+ * call the host moved to the background, from the CLI. The row's end line
122
+ * reads this, never the absence of an answer.
123
+ */
124
+ ended?: 'completed' | 'cancelled' | 'unknown' | 'not_started';
125
+ /** Who or what ended a worker that did not complete: the CLI's fixed code. */
126
+ endedBy?: string;
127
+ /** The final spend still has an unsettled part. */
128
+ unresolved?: boolean;
129
+ /** Image and document blocks the job sent as text; the worker did not see them. */
130
+ omittedBlocks?: number;
131
+ };
132
+
133
+ export type TenjinModelViewerRecord = {
134
+ offerId: string;
135
+ ordinal: number;
136
+ /** The held Agent call's description, cleaned, for the live row. */
137
+ title?: string;
138
+ description: string;
139
+ /** As `TenjinModelActivity.nativeProfile`. */
140
+ profile: string;
141
+ active: boolean;
142
+ nativeId?: string;
143
+ parentId?: string;
144
+ turnId?: string;
145
+ workerHandle?: string;
146
+ generation?: string;
147
+ activity?: TenjinModelActivity;
148
+ inspectionUnavailable?: boolean;
149
+ };
150
+
151
+ export type TenjinModelViewerState = {
152
+ version: 1;
153
+ parentSessionId: string;
154
+ cwd: string;
155
+ serial: number;
156
+ records: TenjinModelViewerRecord[];
157
+ /** Type guards only, never offer/execution authority. */
158
+ knownIds: string[];
159
+ /** Active viewers from a prior cwd. These bindings authorize only cancellation. */
160
+ priorStops?: Pick<TenjinModelViewerRecord, 'offerId' | 'nativeId' | 'turnId'>[];
161
+ };
162
+
37
163
  declare module 'claude-code' {
38
164
  interface PluginState {
39
165
  tenjin: {
@@ -47,6 +173,13 @@ declare module 'claude-code' {
47
173
  prompts: StateFamily<string>;
48
174
  /** Start time of the latest root turn, used to reject an older offer. */
49
175
  lastTurnStart: number;
176
+ modelViewers: TenjinModelViewerState;
177
+ /** By offer id: an accept call's live row while its worker runs. */
178
+ modelWorkers: StateFamily<TenjinModelWorker>;
179
+ /** By offer id: the held call's own prompt, shown as its viewer's first message. */
180
+ modelAssignments: StateFamily<string>;
181
+ /** By offer id: when the offer was made and how it was settled, for its row. */
182
+ modelOffers: StateFamily<TenjinModelOffer>;
50
183
  };
51
184
  }
52
185
  }
@@ -2,6 +2,7 @@ import { createRequire as __tenjinCreateRequire } from 'node:module'; const requ
2
2
  import {
3
3
  HOSTS_FILE,
4
4
  checkEach,
5
+ claudeHostSetUp,
5
6
  claudePluginPresent,
6
7
  detectHosts,
7
8
  forgetInstalledHost,
@@ -13,8 +14,8 @@ import {
13
14
  runEach,
14
15
  uninstallEach,
15
16
  withNote
16
- } from "./chunk-JF4T4HCQ.js";
17
- import "./chunk-PNHNXUSL.js";
17
+ } from "./chunk-IVNSUAVC.js";
18
+ import "./chunk-IULCDMVG.js";
18
19
  import "./chunk-WXA3WTPF.js";
19
20
  import "./chunk-7WEQQJLG.js";
20
21
  import "./chunk-DI4QAGRZ.js";
@@ -22,6 +23,7 @@ import "./chunk-ZXTAQYNA.js";
22
23
  export {
23
24
  HOSTS_FILE,
24
25
  checkEach,
26
+ claudeHostSetUp,
25
27
  claudePluginPresent,
26
28
  detectHosts,
27
29
  forgetInstalledHost,
@@ -34,4 +36,4 @@ export {
34
36
  uninstallEach,
35
37
  withNote
36
38
  };
37
- //# sourceMappingURL=hosts-WNQKYKP2.js.map
39
+ //# sourceMappingURL=hosts-3EMTVM4H.js.map
package/dist/index.js CHANGED
@@ -25,7 +25,7 @@ var verb = process.argv[2];
25
25
  if (verb !== "status-line" && verb !== "hook" && verb !== "mcp" && process.env.TENJIN_HANDOFF !== "1") {
26
26
  const [{ handoffTarget }, { default: pkg }] = await Promise.all([
27
27
  import("./runtime-layout-QHZQJV7C.js"),
28
- import("./package-NRHU7HBR.js")
28
+ import("./package-BONDXSV3.js")
29
29
  ]);
30
30
  const target = handoffTarget(import.meta.url, pkg.version, process.env);
31
31
  if (target !== null) {
@@ -38,17 +38,17 @@ if (verb !== "status-line" && verb !== "hook" && verb !== "mcp" && process.env.T
38
38
  }
39
39
  }
40
40
  if (process.argv.length === 3 && process.argv[2] === "status-line") {
41
- const { statusLineMain } = await import("./status-line-63XFJAXR.js");
41
+ const { statusLineMain } = await import("./status-line-IH5JBWBC.js");
42
42
  await statusLineMain();
43
43
  process.exit(0);
44
44
  }
45
45
  if (process.argv.length === 4 && process.argv[2] === "hook" && process.argv[3] === "alive") {
46
- const { dataDir: dataDir2 } = await import("./paths-O2KDWZ76.js");
47
- const dir = dataDir2(process.env);
46
+ const { dataDir } = await import("./paths-O2KDWZ76.js");
47
+ const dir = dataDir(process.env);
48
48
  try {
49
49
  const [{ aliveMain }, { default: pkg }] = await Promise.all([
50
- import("./alive-VOIL5W3I.js"),
51
- import("./package-NRHU7HBR.js")
50
+ import("./alive-5TV22PNF.js"),
51
+ import("./package-BONDXSV3.js")
52
52
  ]);
53
53
  await aliveMain({ dataDir: dir, version: pkg.version });
54
54
  } finally {
@@ -56,11 +56,14 @@ if (process.argv.length === 4 && process.argv[2] === "hook" && process.argv[3] =
56
56
  }
57
57
  process.exit(0);
58
58
  }
59
- var { useEnvProxy } = await import("./env-proxy-XLSLHBKQ.js");
60
- useEnvProxy(process.env);
61
- var { main } = await import("./cli-BFDKEX53.js");
62
- var { enableCliIdentity } = await import("./install-identity-OID43B4D.js");
63
- var { dataDir } = await import("./paths-O2KDWZ76.js");
64
- enableCliIdentity(dataDir(process.env));
65
- process.exit(await main(process.argv.slice(2)));
59
+ var { exitAfter } = await import("./flush-stdio-NYIJ3QXT.js");
60
+ await exitAfter(async () => {
61
+ const { useEnvProxy } = await import("./env-proxy-XLSLHBKQ.js");
62
+ useEnvProxy(process.env);
63
+ const { main } = await import("./cli-QY4KKA3D.js");
64
+ const { enableCliIdentity } = await import("./install-identity-FFAYEFLX.js");
65
+ const { dataDir } = await import("./paths-O2KDWZ76.js");
66
+ enableCliIdentity(dataDir(process.env));
67
+ return main(process.argv.slice(2));
68
+ });
66
69
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n// Bin entry. The Node version guard runs BEFORE importing anything else — no\n// static imports above it — so an out-of-support runtime gets one JSON error\n// envelope plus a human stderr line instead of a syntax/parse crash from a\n// lazily-loaded module written in newer syntax. Kept in conservative syntax.\nconst MIN_NODE_MAJOR = 22;\n\nconst nodeMajor = Number.parseInt(process.versions.node.split('.')[0] ?? '', 10);\n\nif (Number.isNaN(nodeMajor) || nodeMajor < MIN_NODE_MAJOR) {\n const envelope = {\n schemaVersion: 1,\n command: 'preflight',\n ok: false,\n error: {\n code: 'NODE_UNSUPPORTED',\n message: `Tenjin CLI requires Node ${MIN_NODE_MAJOR} or newer (found ${process.versions.node}).`,\n fix: `Install Node ${MIN_NODE_MAJOR} or newer`,\n },\n };\n process.stdout.write(`${JSON.stringify(envelope, null, 2)}\\n`);\n process.stderr.write(`error: Node ${MIN_NODE_MAJOR}+ required, found ${process.versions.node}\\n`);\n process.exit(1);\n}\n\n// A STALE COPY HANDS OFF TO TENJIN'S RUNTIME. npm's global bin folder can come\n// before `~/.local/bin` on PATH, so a `tenjin` typed in a terminal may be an\n// npm copy older than the runtime the plugin runs; it must not answer for it.\n// When the runtime's current version is strictly newer, this build runs that\n// one instead, `install` included, so an old copy never sets up anything older\n// than what is already running. The status line, the hooks and `tenjin mcp` pay\n// nothing for this check; any failure falls through and this build runs.\nconst verb = process.argv[2];\nif (\n verb !== 'status-line' &&\n verb !== 'hook' &&\n verb !== 'mcp' &&\n process.env.TENJIN_HANDOFF !== '1'\n) {\n const [{ handoffTarget }, { default: pkg }] = await Promise.all([\n import('./lib/runtime-layout'),\n import('../package.json'),\n ]);\n const target = handoffTarget(import.meta.url, pkg.version, process.env);\n if (target !== null) {\n const { spawnSync } = await import('node:child_process');\n const run = spawnSync(target.node, [target.entry, ...process.argv.slice(2)], {\n stdio: 'inherit',\n env: { ...process.env, TENJIN_HANDOFF: '1' },\n });\n if (run.error === undefined) process.exit(run.status ?? 1);\n }\n}\n\n// THE STATUS LINE NEVER LOADS THE CLI. Claude Code runs it once a second for as\n// long as a session is open, and commander, zod and the command tree are parse\n// cost it has no use for. Only the bare invocation is diverted; `--help` and\n// every flag fall through to the command tree, which registers it like any verb.\nif (process.argv.length === 3 && process.argv[2] === 'status-line') {\n const { statusLineMain } = await import('./router/status-line');\n await statusLineMain();\n process.exit(0);\n}\n\n// THE PLUGIN'S SessionStart LEG NEVER LOADS THE CLI EITHER. It runs before\n// every session starts, writes two small files, prints one JSON line when the\n// wallet file or its saved passphrase file is unusable, and otherwise reads the\n// balance at most once a day, bounded at 2 s, to say when it is low; so it\n// takes the same shortcut, and sets up the env proxy itself, for that read\n// only. A flag falls through to the command tree. Once its answer\n// is out, it starts the daily background update, detached (lib/auto-update):\n// after the answer, so the session waits on nothing new, and in a `finally`,\n// so a leg that throws, or a module that will not load, still starts the\n// update that may replace the build at fault. Starting it never throws and\n// never waits.\nif (process.argv.length === 4 && process.argv[2] === 'hook' && process.argv[3] === 'alive') {\n const { dataDir } = await import('./lib/paths');\n const dir = dataDir(process.env);\n try {\n const [{ aliveMain }, { default: pkg }] = await Promise.all([\n import('./router/alive'),\n import('../package.json'),\n ]);\n await aliveMain({ dataDir: dir, version: pkg.version });\n } finally {\n (await import('./lib/auto-update')).maybeAutoUpdate({ dataDir: dir, env: process.env });\n }\n process.exit(0);\n}\n\n// After the status line, which sends no request, and the alive leg, which sets\n// it up for its one read: every other process from this bin (the CLI, the\n// other hooks, `tenjin mcp`) honours HTTPS_PROXY and NO_PROXY.\nconst { useEnvProxy } = await import('./lib/env-proxy');\nuseEnvProxy(process.env);\n\nconst { main } = await import('./cli');\n// Here and not in `main`, so an in-process test of the command tree sends no\n// telemetry and mints no install id; see lib/install-identity.\nconst { enableCliIdentity } = await import('./lib/install-identity');\nconst { dataDir } = await import('./lib/paths');\nenableCliIdentity(dataDir(process.env));\nprocess.exit(await main(process.argv.slice(2)));\n\n// Marks this file a module so top-level await is legal; emits nothing.\nexport {};\n"],"mappings":";;;;AAKA,IAAM,iBAAiB;AAEvB,IAAM,YAAY,OAAO,SAAS,QAAQ,SAAS,KAAK,MAAM,GAAG,EAAE,CAAC,KAAK,IAAI,EAAE;AAE/E,IAAI,OAAO,MAAM,SAAS,KAAK,YAAY,gBAAgB;AACzD,QAAM,WAAW;AAAA,IACf,eAAe;AAAA,IACf,SAAS;AAAA,IACT,IAAI;AAAA,IACJ,OAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS,4BAA4B,cAAc,oBAAoB,QAAQ,SAAS,IAAI;AAAA,MAC5F,KAAK,gBAAgB,cAAc;AAAA,IACrC;AAAA,EACF;AACA,UAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,UAAU,MAAM,CAAC,CAAC;AAAA,CAAI;AAC7D,UAAQ,OAAO,MAAM,eAAe,cAAc,qBAAqB,QAAQ,SAAS,IAAI;AAAA,CAAI;AAChG,UAAQ,KAAK,CAAC;AAChB;AASA,IAAM,OAAO,QAAQ,KAAK,CAAC;AAC3B,IACE,SAAS,iBACT,SAAS,UACT,SAAS,SACT,QAAQ,IAAI,mBAAmB,KAC/B;AACA,QAAM,CAAC,EAAE,cAAc,GAAG,EAAE,SAAS,IAAI,CAAC,IAAI,MAAM,QAAQ,IAAI;AAAA,IAC9D,OAAO,8BAAsB;AAAA,IAC7B,OAAO,uBAAiB;AAAA,EAC1B,CAAC;AACD,QAAM,SAAS,cAAc,YAAY,KAAK,IAAI,SAAS,QAAQ,GAAG;AACtE,MAAI,WAAW,MAAM;AACnB,UAAM,EAAE,UAAU,IAAI,MAAM,OAAO,oBAAoB;AACvD,UAAM,MAAM,UAAU,OAAO,MAAM,CAAC,OAAO,OAAO,GAAG,QAAQ,KAAK,MAAM,CAAC,CAAC,GAAG;AAAA,MAC3E,OAAO;AAAA,MACP,KAAK,EAAE,GAAG,QAAQ,KAAK,gBAAgB,IAAI;AAAA,IAC7C,CAAC;AACD,QAAI,IAAI,UAAU,OAAW,SAAQ,KAAK,IAAI,UAAU,CAAC;AAAA,EAC3D;AACF;AAMA,IAAI,QAAQ,KAAK,WAAW,KAAK,QAAQ,KAAK,CAAC,MAAM,eAAe;AAClE,QAAM,EAAE,eAAe,IAAI,MAAM,OAAO,2BAAsB;AAC9D,QAAM,eAAe;AACrB,UAAQ,KAAK,CAAC;AAChB;AAaA,IAAI,QAAQ,KAAK,WAAW,KAAK,QAAQ,KAAK,CAAC,MAAM,UAAU,QAAQ,KAAK,CAAC,MAAM,SAAS;AAC1F,QAAM,EAAE,SAAAA,SAAQ,IAAI,MAAM,OAAO,qBAAa;AAC9C,QAAM,MAAMA,SAAQ,QAAQ,GAAG;AAC/B,MAAI;AACF,UAAM,CAAC,EAAE,UAAU,GAAG,EAAE,SAAS,IAAI,CAAC,IAAI,MAAM,QAAQ,IAAI;AAAA,MAC1D,OAAO,qBAAgB;AAAA,MACvB,OAAO,uBAAiB;AAAA,IAC1B,CAAC;AACD,UAAM,UAAU,EAAE,SAAS,KAAK,SAAS,IAAI,QAAQ,CAAC;AAAA,EACxD,UAAE;AACA,KAAC,MAAM,OAAO,2BAAmB,GAAG,gBAAgB,EAAE,SAAS,KAAK,KAAK,QAAQ,IAAI,CAAC;AAAA,EACxF;AACA,UAAQ,KAAK,CAAC;AAChB;AAKA,IAAM,EAAE,YAAY,IAAI,MAAM,OAAO,yBAAiB;AACtD,YAAY,QAAQ,GAAG;AAEvB,IAAM,EAAE,KAAK,IAAI,MAAM,OAAO,mBAAO;AAGrC,IAAM,EAAE,kBAAkB,IAAI,MAAM,OAAO,gCAAwB;AACnE,IAAM,EAAE,QAAQ,IAAI,MAAM,OAAO,qBAAa;AAC9C,kBAAkB,QAAQ,QAAQ,GAAG,CAAC;AACtC,QAAQ,KAAK,MAAM,KAAK,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC;","names":["dataDir"]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n// Bin entry. The Node version guard runs BEFORE importing anything else — no\n// static imports above it — so an out-of-support runtime gets one JSON error\n// envelope plus a human stderr line instead of a syntax/parse crash from a\n// lazily-loaded module written in newer syntax. Kept in conservative syntax.\nconst MIN_NODE_MAJOR = 22;\n\nconst nodeMajor = Number.parseInt(process.versions.node.split('.')[0] ?? '', 10);\n\nif (Number.isNaN(nodeMajor) || nodeMajor < MIN_NODE_MAJOR) {\n const envelope = {\n schemaVersion: 1,\n command: 'preflight',\n ok: false,\n error: {\n code: 'NODE_UNSUPPORTED',\n message: `Tenjin CLI requires Node ${MIN_NODE_MAJOR} or newer (found ${process.versions.node}).`,\n fix: `Install Node ${MIN_NODE_MAJOR} or newer`,\n },\n };\n process.stdout.write(`${JSON.stringify(envelope, null, 2)}\\n`);\n process.stderr.write(`error: Node ${MIN_NODE_MAJOR}+ required, found ${process.versions.node}\\n`);\n process.exit(1);\n}\n\n// A STALE COPY HANDS OFF TO TENJIN'S RUNTIME. npm's global bin folder can come\n// before `~/.local/bin` on PATH, so a `tenjin` typed in a terminal may be an\n// npm copy older than the runtime the plugin runs; it must not answer for it.\n// When the runtime's current version is strictly newer, this build runs that\n// one instead, `install` included, so an old copy never sets up anything older\n// than what is already running. The status line, the hooks and `tenjin mcp` pay\n// nothing for this check; any failure falls through and this build runs.\nconst verb = process.argv[2];\nif (\n verb !== 'status-line' &&\n verb !== 'hook' &&\n verb !== 'mcp' &&\n process.env.TENJIN_HANDOFF !== '1'\n) {\n const [{ handoffTarget }, { default: pkg }] = await Promise.all([\n import('./lib/runtime-layout'),\n import('../package.json'),\n ]);\n const target = handoffTarget(import.meta.url, pkg.version, process.env);\n if (target !== null) {\n const { spawnSync } = await import('node:child_process');\n const run = spawnSync(target.node, [target.entry, ...process.argv.slice(2)], {\n stdio: 'inherit',\n env: { ...process.env, TENJIN_HANDOFF: '1' },\n });\n if (run.error === undefined) process.exit(run.status ?? 1);\n }\n}\n\n// THE STATUS LINE NEVER LOADS THE CLI. Claude Code runs it once a second for as\n// long as a session is open, and commander, zod and the command tree are parse\n// cost it has no use for. Only the bare invocation is diverted; `--help` and\n// every flag fall through to the command tree, which registers it like any verb.\nif (process.argv.length === 3 && process.argv[2] === 'status-line') {\n const { statusLineMain } = await import('./router/status-line');\n await statusLineMain();\n process.exit(0);\n}\n\n// THE PLUGIN'S SessionStart LEG NEVER LOADS THE CLI EITHER. It runs before\n// every session starts, writes two small files, prints one JSON line when the\n// wallet file or its saved passphrase file is unusable, and otherwise reads the\n// balance at most once a day, bounded at 2 s, to say when it is low; so it\n// takes the same shortcut, and sets up the env proxy itself, for that read\n// only. A flag falls through to the command tree. Once its answer\n// is out, it starts the daily background update, detached (lib/auto-update):\n// after the answer, so the session waits on nothing new, and in a `finally`,\n// so a leg that throws, or a module that will not load, still starts the\n// update that may replace the build at fault. Starting it never throws and\n// never waits.\nif (process.argv.length === 4 && process.argv[2] === 'hook' && process.argv[3] === 'alive') {\n const { dataDir } = await import('./lib/paths');\n const dir = dataDir(process.env);\n try {\n const [{ aliveMain }, { default: pkg }] = await Promise.all([\n import('./router/alive'),\n import('../package.json'),\n ]);\n await aliveMain({ dataDir: dir, version: pkg.version });\n } finally {\n (await import('./lib/auto-update')).maybeAutoUpdate({ dataDir: dir, env: process.env });\n }\n process.exit(0);\n}\n\n// Stdio's errors are taken before the command writes anything, so a reader\n// that already went away (EPIPE) never turns its exit code into a crash, and\n// a write error Node reports any other way (a full disk) exits nonzero, said\n// on stderr. Output queued on a pipe drains before the exit, since an exit\n// before stdout drains cuts a large body off (lib/flush-stdio). A short write\n// Node reports as a success is not seen here.\nconst { exitAfter } = await import('./lib/flush-stdio');\nawait exitAfter(async () => {\n // After the status line, which sends no request, and the alive leg, which\n // sets it up for its one read: every other process from this bin (the CLI,\n // the other hooks, `tenjin mcp`) honours HTTPS_PROXY and NO_PROXY.\n const { useEnvProxy } = await import('./lib/env-proxy');\n useEnvProxy(process.env);\n\n const { main } = await import('./cli');\n // Here and not in `main`, so an in-process test of the command tree sends no\n // telemetry and mints no install id; see lib/install-identity.\n const { enableCliIdentity } = await import('./lib/install-identity');\n const { dataDir } = await import('./lib/paths');\n enableCliIdentity(dataDir(process.env));\n return main(process.argv.slice(2));\n});\n\n// Marks this file a module so top-level await is legal; emits nothing.\nexport {};\n"],"mappings":";;;;AAKA,IAAM,iBAAiB;AAEvB,IAAM,YAAY,OAAO,SAAS,QAAQ,SAAS,KAAK,MAAM,GAAG,EAAE,CAAC,KAAK,IAAI,EAAE;AAE/E,IAAI,OAAO,MAAM,SAAS,KAAK,YAAY,gBAAgB;AACzD,QAAM,WAAW;AAAA,IACf,eAAe;AAAA,IACf,SAAS;AAAA,IACT,IAAI;AAAA,IACJ,OAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS,4BAA4B,cAAc,oBAAoB,QAAQ,SAAS,IAAI;AAAA,MAC5F,KAAK,gBAAgB,cAAc;AAAA,IACrC;AAAA,EACF;AACA,UAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,UAAU,MAAM,CAAC,CAAC;AAAA,CAAI;AAC7D,UAAQ,OAAO,MAAM,eAAe,cAAc,qBAAqB,QAAQ,SAAS,IAAI;AAAA,CAAI;AAChG,UAAQ,KAAK,CAAC;AAChB;AASA,IAAM,OAAO,QAAQ,KAAK,CAAC;AAC3B,IACE,SAAS,iBACT,SAAS,UACT,SAAS,SACT,QAAQ,IAAI,mBAAmB,KAC/B;AACA,QAAM,CAAC,EAAE,cAAc,GAAG,EAAE,SAAS,IAAI,CAAC,IAAI,MAAM,QAAQ,IAAI;AAAA,IAC9D,OAAO,8BAAsB;AAAA,IAC7B,OAAO,uBAAiB;AAAA,EAC1B,CAAC;AACD,QAAM,SAAS,cAAc,YAAY,KAAK,IAAI,SAAS,QAAQ,GAAG;AACtE,MAAI,WAAW,MAAM;AACnB,UAAM,EAAE,UAAU,IAAI,MAAM,OAAO,oBAAoB;AACvD,UAAM,MAAM,UAAU,OAAO,MAAM,CAAC,OAAO,OAAO,GAAG,QAAQ,KAAK,MAAM,CAAC,CAAC,GAAG;AAAA,MAC3E,OAAO;AAAA,MACP,KAAK,EAAE,GAAG,QAAQ,KAAK,gBAAgB,IAAI;AAAA,IAC7C,CAAC;AACD,QAAI,IAAI,UAAU,OAAW,SAAQ,KAAK,IAAI,UAAU,CAAC;AAAA,EAC3D;AACF;AAMA,IAAI,QAAQ,KAAK,WAAW,KAAK,QAAQ,KAAK,CAAC,MAAM,eAAe;AAClE,QAAM,EAAE,eAAe,IAAI,MAAM,OAAO,2BAAsB;AAC9D,QAAM,eAAe;AACrB,UAAQ,KAAK,CAAC;AAChB;AAaA,IAAI,QAAQ,KAAK,WAAW,KAAK,QAAQ,KAAK,CAAC,MAAM,UAAU,QAAQ,KAAK,CAAC,MAAM,SAAS;AAC1F,QAAM,EAAE,QAAQ,IAAI,MAAM,OAAO,qBAAa;AAC9C,QAAM,MAAM,QAAQ,QAAQ,GAAG;AAC/B,MAAI;AACF,UAAM,CAAC,EAAE,UAAU,GAAG,EAAE,SAAS,IAAI,CAAC,IAAI,MAAM,QAAQ,IAAI;AAAA,MAC1D,OAAO,qBAAgB;AAAA,MACvB,OAAO,uBAAiB;AAAA,IAC1B,CAAC;AACD,UAAM,UAAU,EAAE,SAAS,KAAK,SAAS,IAAI,QAAQ,CAAC;AAAA,EACxD,UAAE;AACA,KAAC,MAAM,OAAO,2BAAmB,GAAG,gBAAgB,EAAE,SAAS,KAAK,KAAK,QAAQ,IAAI,CAAC;AAAA,EACxF;AACA,UAAQ,KAAK,CAAC;AAChB;AAQA,IAAM,EAAE,UAAU,IAAI,MAAM,OAAO,2BAAmB;AACtD,MAAM,UAAU,YAAY;AAI1B,QAAM,EAAE,YAAY,IAAI,MAAM,OAAO,yBAAiB;AACtD,cAAY,QAAQ,GAAG;AAEvB,QAAM,EAAE,KAAK,IAAI,MAAM,OAAO,mBAAO;AAGrC,QAAM,EAAE,kBAAkB,IAAI,MAAM,OAAO,gCAAwB;AACnE,QAAM,EAAE,QAAQ,IAAI,MAAM,OAAO,qBAAa;AAC9C,oBAAkB,QAAQ,QAAQ,GAAG,CAAC;AACtC,SAAO,KAAK,QAAQ,KAAK,MAAM,CAAC,CAAC;AACnC,CAAC;","names":[]}