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
@@ -0,0 +1,348 @@
1
+ # DeepSeek subagents
2
+
3
+ - **What it is.** Tenjin can offer DeepSeek V4.1 Flash, a cheap model, for an eligible Claude Code subagent job. Claude keeps its own model and accepts or declines each offer. DeepSeek subagents are off by default.
4
+ - **Who sees what.** Before each offer, Tenjin and TypeSafe get the task and recent conversation. When Claude accepts, Tenjin and DeepSeek get the task, its instructions and the worker's tool results, including what the worker reads in `~/.claude`. A web search runs inside the DeepSeek call; a page its WebFetch could not fetch goes to Exa.
5
+ - **Cost.** A job costs up to your per-call limit ($1 by default), or a lower ceiling you name, within your daily budget. Routing costs one fee for each offer, also when Claude declines it: the amount the router quotes when it is asked ($0.0081, 15% of an expected job spend of $0.054), never more than $0.25. It is paid before any offer exists, inside your per-call limit and the job's ceiling.
6
+ - **On.** `tenjin config subagents on`, or **Turn on** in fresh setup.
7
+ - **Off.** `tenjin config subagents off`. No new job starts; cancel a running worker to stop it.
8
+
9
+ Ordinary implementation and scoped review can qualify; planning stays native. Repository instructions and model or privacy restrictions still apply. Nothing a worker reads or prints is masked: env files, secrets in a known token shape and credential command output go to Tenjin and DeepSeek as written. Before an offer, the task and parent context sent for routing are masked for known secrets, which is not a guarantee. See also the [privacy policy](https://tenjin.sh/privacy).
10
+
11
+ ## What is sent
12
+
13
+ - **The model.** DeepSeek V4.1 Flash 1017 runs these jobs today. It receives a job only after the parent accepts its offer: the accepted assignment, the instructions that apply to it and the job's tool results, through Tenjin.
14
+ - **Tenjin** receives each subagent assignment with bounded parent context before the offer, together with TypeSafe, which judges the routing, and after acceptance everything DeepSeek receives.
15
+ - **Web searches and page reads.** A worker's search query, and what DeepSeek finds for it, stay in the model call to DeepSeek. The address of a public page its WebFetch could not fetch goes to Exa, and the page Exa returns reaches DeepSeek as a tool result.
16
+ - **Your `~/.claude` folder.** On Linux and macOS a worker loads your global Claude Code configuration and can read your session transcripts, prompt history and settings files there. What it reads can reach Tenjin and DeepSeek.
17
+
18
+ [Data and permissions](#data-and-permissions) has the full account, and [Charges and limits](#charges-and-limits) the fees and the per-job cap.
19
+
20
+ ## Setup and controls
21
+
22
+ ### Turn on and off
23
+
24
+ ```sh
25
+ tenjin config subagents
26
+ tenjin config subagents off
27
+ tenjin config subagents on
28
+ tenjin config subagents on --max-job 0.50
29
+ tenjin config subagents on --repository /path/to/workspace /path/to/another
30
+ ```
31
+
32
+ - **Fresh setup** asks whether to use a cheap model for eligible subagent jobs, in three lines that end with a link to this page. **Keep off** is the default. **Turn on** covers each session's qualified native workspace and then prints the scope, the cap and the short terms once.
33
+ - **A scripted install** passes `tenjin install --yes --subagents on` to opt in or `--subagents off` to save off. The flag saves an answer wherever none is saved yet, on a fresh profile or an existing one. Running it again changes nothing: once an answer is saved, the `tenjin config subagents` commands change it, and the install receipt says so when the flag asked for something else.
34
+ - **Existing users** keep their settings, including off choices. Updating, refreshing or adding another host does not turn DeepSeek subagents on. Only an explicit on does: the question, the `--subagents on` flag or `tenjin config subagents on`.
35
+ - **`tenjin config subagents`** with no mode prints whether DeepSeek subagents are on, the scope and the cap in force. `tenjin status` has a `Subagents` row that says on or off and the scope.
36
+ - **`tenjin config subagents off`** stops new jobs. Cancel a running worker to stop it (see [Cancel](#cancel)).
37
+ - **A project** can turn DeepSeek subagents off for itself. It cannot grant consent or raise your money limits.
38
+
39
+ The parent still accepts or declines each offer.
40
+
41
+ ### The two consent scopes
42
+
43
+ There is one consent record, with one of two scopes. The command you run chooses the scope.
44
+
45
+ - **Every workspace.** `tenjin config subagents on` writes the same consent the setup question writes: it covers each session's qualified native workspace, in any directory. Its scope row reads `Every workspace`. Opening another repository uses that session's own workspace; the folder where installation ran supplies no directory grant.
46
+ - **Only the directories you name.** `tenjin config subagents on --repository <path>...` limits the consent to those directories and nothing else. A named directory includes its subfolders, so a nested repository or a linked worktree under it is covered. A session outside them gets no offer: not in the parent of a named directory, not in a sibling whose name starts the same, and not through a link under a named directory that points outside it, since real paths are compared. Its scope row reads `~/work and its subfolders`. Repeat the command for another directory to keep both, or name a containing workspace.
47
+
48
+ A saved consent never gets wider without your own command:
49
+
50
+ - A consent that names directories stays limited to them through updates.
51
+ - Only an `on` with no `--repository` widens it, and its scope row says so: `Every workspace (was ~/work only)`.
52
+ - An `on --repository` over a consent for every workspace narrows it, and its scope row says `(was every workspace)`.
53
+ - On native Windows only the limited scope is allowed (see [Linux and Windows](#linux-and-windows)).
54
+
55
+ Both scopes record the configured router origin and the recipients (Tenjin, DeepSeek and Exa). Each `on` prints the same short terms with a link to this page; `tenjin config subagents on --json` carries the full terms in `disclosure`. Each job freezes its qualified scope and rechecks it before tools, inference and continuation.
56
+
57
+ Local GitHub origin names for the offer's directories and their direct child repositories accompany each offer so the parent can match GitHub tasks to paths. Names grant no filesystem permission or additional disclosure scope, and are read fresh at each offer.
58
+
59
+ ### The cap for a job
60
+
61
+ - A job's routing, inference, searches and page reads together cost up to the cap.
62
+ - With no `--max-job`, the cap is your per-call spend limit as it stands at each offer ($1 unless you chose another). A changed limit changes the next offer, up or down, and lowers a running job's remaining cap at once.
63
+ - `--max-job <USD>` names a lower ceiling. The cap is then the smaller of that ceiling and the limit, and a higher limit never lifts a ceiling you named. Each `on` sets the ceiling from its own flags, so running it without `--max-job` drops a ceiling named earlier.
64
+ - Your daily budget applies on top.
65
+ - Where the cap is not above $0.083866, the reserve of one 65,536-token call with no body, no job is offered. The cap must also leave room for the routing fee above that ($0.0081 an offer), so a cap just above $0.083866 gets no offer either, and the router is asked before that is known. `tenjin config subagents why` says so, and `tenjin config subagents on` refuses to turn DeepSeek subagents on under such a limit and names the command that raises it.
66
+ - A call held at one cap whose cap is lowered before its offer is made stays native.
67
+
68
+ ### Linux and Windows
69
+
70
+ On Linux, DeepSeek workers use Claude Code’s native shell sandbox. Install the sandbox dependencies for your distribution and check that Claude Code reports a working sandbox. See the [Claude Code sandbox documentation](https://code.claude.com/docs/en/sandboxing) for Linux and WSL2 requirements.
71
+
72
+ On native Windows a worker has no shell sandbox:
73
+
74
+ - It uses the native Claude shell tools under a dedicated standard local Windows account. Git Bash and PowerShell have the access Windows grants to that account, including network access and files outside the selected repository.
75
+ - Setup requires a separate opt-in that names the workspace with `--repository`. The limited scope is the only one native Windows allows, since the worker's account has access only to what you gave it. A bare `on` with the Windows worker flags is refused and says so.
76
+ - Keep the controller’s Tenjin data and sign-in credentials in its private profile. Only share workspaces and Claude configuration that you are comfortable exposing through the worker’s tool results.
77
+ - Native tools and shell commands use the shared Claude profile and the account’s own Git and CLI credentials. Windows ACLs govern reads and writes by shell commands. Tenjin rechecks the worker grant. It masks nothing else in what the worker forwards. A Windows job has no GitHub setup, so it always removes GitHub token shapes, and your wallet key and passphrase are removed by value, as on every other platform.
78
+
79
+ [Windows setup instructions](../scripts/windows-worker/README.md)
80
+
81
+ ## Data and permissions
82
+
83
+ ### What goes where, and when
84
+
85
+ - **Before an offer.** The assignment and bounded parent context go to Tenjin and TypeSafe. A routing request is at most 16 KB: Tenjin gives up parent context to fit it, the oldest message first, and never cuts the assignment, so a call whose assignment alone is larger stays native.
86
+ - **While the offer is open.** Claude Code can prepare a local worker. The worker gets its assignment only when the parent accepts. Declining or cancelling the offer, letting it expire, or ending the parent session stops that process.
87
+ - **After acceptance.** Applicable instructions, assignments and tool results reach DeepSeek through Tenjin. A worker's search query and its results run inside the model call to DeepSeek; the address of a public page its WebFetch could not fetch reaches Exa (see [Web searches and page reads](#web-searches-and-page-reads)).
88
+ - **Env files are not masked.** A worker reads them as a normal subagent of the session does, and what it reads can reach Tenjin and DeepSeek as written.
89
+ - **Credential commands are not refused.** `security`, `git credential`, `git-credential-*`, `gh auth token` and its relatives go to the permission mode and, in auto mode, the classifier, as a native subagent's do; what they print reaches Tenjin and DeepSeek as written. Secrets in a known token shape are not masked in what a worker forwards.
90
+ - **What is still protected.** The job's own bridge and GitHub tokens are removed by value, and so are your wallet key and passphrase (`TENJIN_WALLET_KEY` and `TENJIN_WALLET_PASSPHRASE`) wherever the worker reads them: its environment (a command can read its parent's), your Claude settings `env` blocks, a file or a command's output. A worker whose GitHub setup failed also removes text shaped like a GitHub token, so a continued transcript does not resend an earlier job's. The routing packet before an offer (the task and up to six parent messages) is masked for known secrets, not guaranteed. The sandbox and the file tools keep the Tenjin data folder, the wallet, the keychain and other jobs' temp, GitHub and settings folders closed to it. A limited consent keeps its repository boundary: no offer and no worker for work outside the named directories, and reads and writes stay inside the granted working directories. Sensitive prose is not guaranteed anonymous.
91
+ - **Limit of the limited scope.** A command a worker runs inherits the environment of its session, as a native subagent's does, so a variable exported in your shell can be printed and sent to Tenjin and DeepSeek even when the directory you named holds nothing secret.
92
+ - **Retention.** Server replay content expires after 24 hours. Financial and continuation authorization records persist.
93
+
94
+ ### Permissions
95
+
96
+ - **Mode.** The worker keeps the permission mode the parent had when the offer was accepted, for the whole job. A later prompt, mode switch or `cd` in the parent does not stop it. A plan-mode parent keeps work native.
97
+ - **Default mode.** The worker asks you, with Allow once, Allow for this job or Deny. That dialog waits for your answer for as long as the job may run, as a native permission prompt waits; a session that has closed answers no.
98
+ - **Auto mode.** The worker's own classifier judges each call that needs a decision. A call that would still need a person is refused at once with its reason, in words about that one call, so the worker never waits on you and does not give the tool up.
99
+ - **Bypass mode.** Under a bypass-permissions parent the worker runs in bypass mode inside the same sandbox and read limits and never asks you.
100
+ - **Only your choice allows a call.** Nothing the parent writes to a worker, in its assignment or a follow-up, is a permission or changes the worker's mode, rules or sandbox. Tenjin sets up no hook that could answer the dialog for you.
101
+ - **The sandbox.** Every worker command runs in the sandbox. Outside your consented directories it refuses, at the read itself, a read in your home folder, other users' folders and mounted volumes (such as `/Users`, `/home`, `/Volumes` and `/mnt`), apart from your read exceptions and the files [Env files](#env-files) lists under reads outside the working directories, and in other Tenjin jobs' temp and GitHub folders. Elsewhere, such as `/tmp`, the system temp folder under `/var/folders`, `/opt`, `/usr`, `/etc` and `/Library`, a command reads what your user can, as a native subagent's sandboxed command does. A command that names such a path is refused before it runs; one that reaches it through a script, a link or a name it builds is not. On Linux and macOS, shell confinement must be enforceable: managed-only read-path policies, disabled or excluded sandbox commands, and startup paths containing `*`, `?`, `[` or `]` keep work native. On Windows, the offer requires the separate native shell grant and compatible Claude settings.
102
+ - **`cd <dir> && ...` in auto mode.** A second check reads a command's text before it runs, and asks about a command whose paths it cannot work out, such as `cd <worktree> && git status --short | head -20 && git diff main...HEAD --stat`. In auto mode that ask is refused like any other, because answering it yes would run the whole command, whatever else it holds, without the classifier's verdict. The refusal tells the worker to run the `cd` as its own call or to use `git -C <path>`, and that form is judged and runs. A command that names a path outside your consented directories stays refused, and so does an ask about one part of a compound command, which can stand for one of your own ask rules. In bypass mode that one ask is answered yes, since bypass mode judges no call and the sandbox still refuses a read in your home folder and the other places named above.
103
+ - **Pushes and merges.** Pushes, force pushes, branch deletions, merges and every other action go through that mode's own permission flow, exactly as a native subagent's do.
104
+ - **The keychain is closed.** The sandbox and the file tools deny the macOS keychain folder (`~/Library/Keychains`) and the Linux keyring files and D-Bus sockets, so `security` and `secret-tool` find no item there, your Tenjin passphrase and vault keys and your GitHub login included. A Windows worker has no sandbox and no `security` command; the Windows credential files are closed by the worker account's ACLs, not by a file-tool rule.
105
+ - **Other credential commands are not refused.** git's credential helpers (`git credential`, `git-credential-*`) and a GitHub token printed by `gh auth token` go to the accepted mode and, in auto mode, the classifier, as for a native subagent; the worker's own `gh` and git hold only the job's token.
106
+ - **Working directories.** Under the every-workspace scope, consent follows the host's qualified current directories and access exceptions. Under the limited scope, every named directory is a working directory, so a session in one repository of a named workspace reaches its sibling repositories; their linked git worktrees inside the named directories are added at job start through the worker's settings (not as `--add-dir` flags, which would load each worktree's skills, agents and commands, as a native subagent does not), so the worker can commit in them. A native additional directory outside the named directories is denied to the worker and listed in the offer, and the offer still stands; native read or write exceptions outside them keep work native.
107
+ - **What stays in place.** The worker retains native settings, rules, hooks, MCPs, CLIs and tool permissions in its workspace, including uncommitted changes. Global auto-memory is disabled for this worker. Your parent's endpoint, saved login and Remote Control stay in place. Scope is checked before assignment, tool use and inference. Unsupported authority or host-controlled authentication keeps work native. A provider refusal at worker startup can follow an already-paid routing fee.
108
+
109
+ ### The worker as a native subagent
110
+
111
+ - **Agent type.** The worker runs as the native agent the parent asked for: `general-purpose`, `Explore` or a custom agent whose definition qualifies (see [Custom agents](#custom-agents)), with the prompt and tools Claude Code gives a native subagent of that type. To read that prompt, Tenjin starts the same Claude Code for a moment, with no hooks or MCP servers and no model call leaving your machine. The prompt carries the note Claude Code gives its own subagents: messages from the agent that launched it direct its work and are never your consent or approval.
112
+ - **Context.** As a native subagent of its type does, the worker gets the repository's git status unless it runs as `Explore`, and tool search as your session has it: MCP tools and the less used built-in tools load when the worker asks for them.
113
+ - **Hooks.** Your hooks and the plugins' hooks run in the worker as they run in a native subagent.
114
+ - **`Explore`.** An `Explore` worker starts without your CLAUDE.md and rules files, global, project and local, as a native `Explore` subagent does. One in a folder below the working directory still reaches it when it reads a file there.
115
+ - **No questions, no subagents.** As a native subagent, it has no tool for asking you questions in any mode. A worker that needs something from you ends with its report, and the parent continues it. A worker starts no subagent, native or DeepSeek, and none of its calls is held or offered.
116
+ - **No Tenjin tools.** Unlike a native subagent, it has none of Tenjin's own tools (`request`, `approve`, `subagent`). What a worker pays for is its model calls, searches and page reads, which count in its job's budget, and a Tenjin lookup of its own would not.
117
+ - **Thinking.** The worker thinks on every turn, at high effort, as the DeepSeek harness does. Neither your own Claude Code settings nor a managed policy turns that off for a worker: `MAX_THINKING_TOKENS=0`, `CLAUDE_CODE_DISABLE_THINKING` and `alwaysThinkingEnabled: false` are set aside for it, also when a managed policy sets them, and a turn that still arrives without thinking is sent with thinking on. The auto-mode classifier's own short requests carry no thinking, as Claude Code sends them.
118
+ - **Images and PDFs.** Unlike a native subagent, the worker cannot see an image or a PDF: Tenjin's router takes text only. An image or document block, in the assignment or in what a tool returns, goes to the model as one line of text that says it was omitted, and the worker works on. The result to the parent counts them (`omitted.blocks`, each block once) and says to run the job natively if it needed that content, and the worker's row says how many; with none omitted, neither appears.
119
+ - **Live replies.** Every worker turn is streamed, so the worker's text, thinking and tool calls appear as the model produces them, as a native subagent's do.
120
+ - **Stopping early.** A worker that stops early returns its last text and recent activity to the parent.
121
+
122
+ ### Your `~/.claude` folder
123
+
124
+ On Linux and macOS:
125
+
126
+ - **Loaded as instructions.** The worker loads your global Claude Code configuration as a native session does, so your personal `~/.claude/CLAUDE.md` is in its instructions, unless it runs as `Explore`. Claude Code itself loads the skills, plugins, agents, commands and rules under `~/.claude` into the worker, as it does for a native subagent, so their text is part of what the worker works with.
127
+ - **Readable by the worker's file tools and commands, never writable.** Every session transcript and project memory under `~/.claude/projects`, your prompt history `~/.claude/history.jsonl`, and your `~/.claude/settings.json` and `settings.local.json`.
128
+ - **Other files there.** A skill's or a plugin's own files included, they are outside the worker's working directories, and its file tools and commands read them only as far as Claude Code's own rules for its folders allow.
129
+ - **Where it goes.** What the worker loads or reads there, other projects' sessions and memory included, can reach Tenjin and DeepSeek.
130
+ - **Transcripts and history are not scanned.** A secret pasted or printed in an earlier session is sent as written.
131
+ - **Closed.** The credentials file, settings backups, session state such as `debug` and `file-history`, `tenjin-loops` outside your consented directories, a skill's files where its folder links outside `~/.claude`, and `~/.claude.json`.
132
+
133
+ In the working directories:
134
+
135
+ - A repository's tracked `.claude/settings.json`, its own or a nested one, is readable as a native subagent reads it.
136
+ - The worker's file tools never write one, and its commands cannot write the working directory's own. A merge or checkout that must rewrite that file fails at that write, as a native sandboxed command does before it asks to run unsandboxed, which a worker cannot.
137
+ - Every repository's `.claude/settings.local.json` and `.mcp.json` stay closed, and so does a project settings file outside the working directories.
138
+
139
+ Temp files:
140
+
141
+ - Each job has its own temp folder under `/tmp`, which only your user can open and which is removed when the job ends. It is `$TMPDIR` in the worker's commands, its file tools can read and write it by path, and the worker is told to use it instead of `/tmp`.
142
+ - Other workers' commands cannot read it, nor the job's GitHub folder or settings file in the system temp folder, which hold its gh caches and its tokens. On Linux a folder made after a command started stays open to that command until it ends. A native session or subagent of your user can read them.
143
+ - Worker commands cannot read or write the temp files of other Claude Code sessions under `/tmp/claude-<uid>`.
144
+
145
+ ### Env files
146
+
147
+ - **Reads.** The worker and its commands read `.env` and other `.env*` files inside its working directories (the consented directories and their linked worktrees) as a native subagent does, so tests and scripts that load `.env.local` work.
148
+ - **Reads outside the working directories.** On Linux and macOS the worker's file tools read nothing outside them but your read exceptions and the files in [Your `~/.claude` folder](#your-claude-folder). Its commands also read what the sandbox leaves open (see [Permissions](#permissions)): `/tmp`, the system temp folder, `/opt`, `/usr`, `/etc`, `/Library` and a link into them, your git config files, and the `~/.claude` folders Claude Code opens to commands, as a native subagent's commands do.
149
+ - **Writes.** Editing or writing one follows the native rules of the accepted mode: default mode asks, Accept edits allows, auto mode's classifier judges, and `.envrc` always asks.
150
+
151
+ ### GitHub access
152
+
153
+ On Linux and macOS:
154
+
155
+ - **A per-job token.** GitHub access never comes from your GitHub config files, and the keychain is closed to the worker. Tenjin's own process reads a token with `gh auth token` and gives it to that worker's `gh` and git over HTTPS only, with a per-job gh config and a git config holding just your name, email and a GitHub credential helper. No token is put on the worker's command line.
156
+ - **A narrower token.** Set `TENJIN_WORKER_GITHUB_TOKEN`, or `TENJIN_WORKER_GITHUB_TOKEN_FILE` naming a file that holds it, where Claude Code starts. A named token that cannot be read gives workers no GitHub token rather than your login. With either variable set, the session's own `GH_TOKEN`, `GITHUB_TOKEN`, `GH_ENTERPRISE_TOKEN` and `GITHUB_ENTERPRISE_TOKEN` are cleared in the worker's environment, so only the named token is there. The job's GitHub settings also outrank a GitHub token in your Claude Code settings `env`.
157
+ - **Fine-grained token permissions.** Metadata read, Contents read and write, Pull requests read and write, Issues read and write, Commit statuses read and Actions read, plus Workflows read and write only if a worker may change `.github/workflows/`.
158
+ - **Masking.** Tenjin replaces the token's value in everything it forwards to Tenjin and DeepSeek, in the worker's result and in its activity rows. A command can still print or send it to an allowed host, so prefer the narrower token.
159
+
160
+ ### Network
161
+
162
+ - The sandbox preapproves GitHub, GitHub’s content and Actions log hosts, the npm registry and nodejs.org, subject to Claude Code’s settings.
163
+ - For other hosts, default mode prompts, auto mode can allow the host for the command, and bypass mode can allow it without a prompt.
164
+ - A strict sandbox allowlist blocks hosts outside it. [Claude Code network settings](https://code.claude.com/docs/en/settings-reference#sandboxnetworkstrictallowlist)
165
+ - On macOS the worker's sandbox may also reach the system certificate trust service, which `gh` needs to check TLS certificates.
166
+
167
+ ## Accept, cancel and continue
168
+
169
+ ### An offer for each call
170
+
171
+ - The parent calls its native subagent tool normally. Each call is judged by itself: several calls in one response, and calls made while other offers are open or other workers run, each get their own offer, in any turn, whether a prompt or a task notification started it.
172
+ - No count limit applies beyond each job's ceiling and your daily budget. Every offer carries the full parent policy and starts no worker.
173
+ - A native subagent's own Agent (or legacy Task) call, at any depth of native agents, is judged and offered as the main conversation's is, with the session's context followed by that subagent's own conversation. That subagent accepts the offer or keeps it native. Its call stays native when the subagent's tools leave out `subagent`, when it or an agent above it may run in a permission mode of its own, or when it works in a folder of its own such as a worktree, since a worker runs in the session's mode and workspace.
174
+ - A DeepSeek worker's own calls get no offer.
175
+ - One exception: where no prompt was typed since Tenjin's process started (a resumed session woken by a notification), the first subagent call runs natively.
176
+ - Saved consent covers its stated disclosure and inference scope; binding restrictions, repository risk judgment and normal tool asks still apply.
177
+
178
+ ### Accept
179
+
180
+ - Accept one offer with `subagent({offer_id})`. To start several workers together, accept the chosen offers with one `subagent({offer_ids: [id1, id2]})` call. Each offer keeps its own permissions, budget and cancellation, and the call returns one result per offer in the order requested.
181
+ - An offer is accepted by its id in any turn of the session that received it, until it expires 15 minutes after it was made. Another session gets nothing for that id.
182
+ - Each worker run pays on its own inference channel, so its model calls wait for no other worker.
183
+ - Accepting the same offer again never starts a second worker and adds no charge. While its worker runs, the repeat is refused. After the worker ended, a repeat in any later turn of the same session returns the stored result: the completed result, or for a stopped worker how it ended, its last text and recent steps, the next step, and the spend as it then stands. That read is local and free.
184
+
185
+ ### Keep an offer native
186
+
187
+ - The parent sends the same Agent (or legacy Task) call again unchanged. In every permission mode it then runs natively, as sent, with no second routing fee; Tenjin never rewrites it.
188
+ - Key order, whitespace around a field's text, and a field at its default (`false`, `null`, or `subagent_type: "general-purpose"`) are not changes. Any other change makes a new call, which may be offered again.
189
+ - The repeat counts once per offer, in the same session and workspace and from the same agent, until the offer expires 15 minutes after it was made; when its worker was accepted and then stopped or never started, for 15 minutes after that. After it, the offer can no longer be accepted.
190
+ - When several open offers hold identical calls, one repeat keeps one of them native, the oldest first, and the others stay open. A second identical call in the same model response is not a repeat: it was written before the first offer was read, so it gets its own offer.
191
+
192
+ ### Cancel
193
+
194
+ - Cancel an offer or active worker with `subagent({cancel: offer_id})`, at any time, or interrupt the host.
195
+ - Turning DeepSeek subagents off prevents new paid requests; cancel to drain active work.
196
+ - Stopping the DeepSeek agent from Claude Code's agent list cancels its worker, as stopping a native subagent does. Leaving or closing its view, or Claude Code ending its turn, does not.
197
+
198
+ ### When a worker stops by itself
199
+
200
+ - A worker stops when its session ends or its Tenjin process restarts, as a native subagent does. No worker runs on after the session closes.
201
+ - `/clear` closes the session too: the Tenjin plugin cancels each background worker whose result it had not handed over, and the job's record says the session ended it (`session_ended`). The session that follows in the same Claude Code gets offers.
202
+ - When you resume the same session, a finished worker's result can still be read, and the worker continued by its handle. A worker that was still running when the session ended is reported as stopped, with the reason `interrupted`, and cannot be continued; send the work again if you still need it.
203
+ - Before reloading or removing Tenjin, wait for the parent's Tenjin call to finish or confirm cancellation, and for its native activity agent to stop. A stop acknowledgement alone does not confirm both have drained. Removing or reloading the mod while the viewer is active can let Claude call its own model outside the DeepSeek worker budget.
204
+
205
+ ### Background jobs
206
+
207
+ - A background Agent call (`run_in_background`) is offered as a foreground call is.
208
+ - When the parent accepts it, the worker runs in the background, as a native background agent does: the accept call returns at once with `status: "started"`, the parent's turn goes on, and the worker's row reads `Backgrounded agent (↓ to manage)` until it ends, then its end line.
209
+ - **How the result arrives.** When the worker ends, the Tenjin plugin hands its result to the parent as one message, which starts a turn when the session is idle and waits for the running turn otherwise. Its first line says how the worker ended (`finished`, or `did not complete:` and the cause, such as `The parent cancelled it with subagent({cancel}).`), and that it is not a new task. Its row reads `› Message from @DeepSeek (ctrl+o to expand)`. That message is the job's stored result, the same one a foreground accept returns, with its status, counts, spend and worker handle.
210
+ - The job's budget, consent checks, causes of ending and cancel are those of a foreground job. The parent session's end stops the worker. Sending the original call again unchanged keeps it native, in the background as written.
211
+ - A batch accept can mix foreground and background offers: it returns when its foreground workers end, and names each background worker as started. A background worker that ended meanwhile has its message sent once the batch call has returned.
212
+ - If the session was resumed or the plugin reloaded before the message came, accepting the offer again returns the stored result.
213
+ - Calls that set `resume`, `name`, `team_name` or `isolation` stay native.
214
+ - Claude Code moves a foreground worker that runs longer than two minutes to a background task: the worker runs on, its row stays live, and the parent receives its result with the task's notification, `› Message from @DeepSeek (ctrl+o to expand)`.
215
+
216
+ ### Custom agents
217
+
218
+ A call for a custom agent type can be offered when all of these hold:
219
+
220
+ - You or the project wrote its definition: a file in the job root's own `.claude/agents` or in your `~/.claude/agents`.
221
+ - It pins no model (`model: inherit` pins none).
222
+ - It sets only `name`, `description`, `tools`, `disallowedTools`, `color` and `effort`.
223
+
224
+ The worker then runs as that agent: the definition's prompt, as Claude Code gives it to a native subagent, in place of the general one, and its tools. Its effort stays high whatever the definition says.
225
+
226
+ These run natively:
227
+
228
+ - A definition that pins a model, or sets a permission mode, isolation, background running, memory, hooks, MCP servers or skills.
229
+ - Every agent a plugin provides (such as `codex:codex-rescue`), whatever its definition says, every built-in type other than `general-purpose` and `Explore`, and a definition in a folder above the job's root: their prompts are not yours or the project's to send to DeepSeek.
230
+ - A definition whose frontmatter Tenjin cannot read exactly as Claude Code does (a quoted key such as `'tools': [Read]`, a bracketed list over several lines, a repeated key, an empty tool list), so a tool limit is never lost on the way to a worker.
231
+ - A call that names its agent (`name`), resumes another agent or asks for isolation: a named call starts a teammate and returns at once, which the accept call cannot do.
232
+
233
+ ### Why a call got no offer
234
+
235
+ `tenjin config subagents why` lists why recent subagent calls got no offer, newest first: the local time, the tool (with `from a subagent` when a native subagent made the call) and the reason in plain words, such as `The session was in plan mode`. `--json` adds the session id and the reason code, such as `input_filter:name`, `permission_mode:plan`, `caller_unqualified:tools`, `over_size_limit` with the byte count, `job_cap_too_low`, `job_cap_lowered`, `server_declined` with the router's code, or `kept_native`. The record holds no assignment text, is kept for 7 days in a file only your user can read, and is sent nowhere. It is written only while DeepSeek subagents are on.
236
+
237
+ ### Write to a running worker
238
+
239
+ - An offer names the worker's address, `tenjin-worker-…`, before it is accepted, and an accepted background job says it again. While the worker runs, `SendMessage` to that address reaches it at its next turn, as a message to a native subagent does, and it answers as a native send does. Several messages arrive in order.
240
+ - A message sent this way goes to DeepSeek at once, with no held offer to cancel, so the parent applies your restrictions (model, privacy, disclosure, paid inference) to its text before it sends it.
241
+ - It is the same job: no new offer, no routing fee and no new question, and the job's ceiling and your limits hold at each payment as before. Only the session that accepted the worker can write to it.
242
+ - A message sent after the worker has reported is not delivered and the parent is told so; it sends it again once the result has arrived.
243
+
244
+ ### Continue a finished worker
245
+
246
+ - Completed Claude workers return a `tenjin-worker-…` handle. The same parent can continue with native `SendMessage`, or compatible `Agent.resume`. A worker handle is never sent to native tools.
247
+ - In the session that accepted the worker, a follow-up is one call: the worker continues at once in the background, as a native subagent resumed by a message does, and its result arrives by itself. The same consent, directory scope and permission mode checks run as for an accept.
248
+ - Where Tenjin did not accept the worker itself (a resumed session, a reloaded plugin), each full follow-up is held until the parent runs it with one `subagent({offer_id})` call or stops it with `subagent({cancel: offer_id})`. The parent does not judge again whether the worker suits it, as a native follow-up resumes its subagent with no confirmation. A job whose ceiling is used up refuses the follow-up.
249
+ - Because the text goes to DeepSeek, what binds an assignment still binds a follow-up: your own instructions that restrict the worker's model, privacy, disclosure or paid inference, and planning, which stays native. The parent applies them before it sends a follow-up (a one-call follow-up or a message to a running worker goes at once, with no held offer to cancel) and cancels a held one that would break one.
250
+ - A follow-up pays no routing fee, and its inference is charged to what is left of the original job's ceiling.
251
+ - It reopens the same history, for up to 7 days after the worker's last run, including after the same session is resumed. Current instructions and permissions refresh. Continuations retain the full worker history.
252
+ - Missing history or accounting, uncertain state, changed directory scope or revoked disclosure refuses continuation. Native retention may remove history; no idle worker service is maintained.
253
+
254
+ ## What you see in Claude Code
255
+
256
+ ### A held call and its offer
257
+
258
+ - An individual offer appears on its held Agent row, with the native name struck through and `Tenjin offered DeepSeek` with its cap after it, as a held web search shows the tool Tenjin offered.
259
+ - When the parent accepts the offer, the worker's `DeepSeek(<description>)` row replaces that row in place, and the accept call adds no row of its own.
260
+ - The compact row disappears once the offer is kept native by repeating the call or expired. A cancelled offer nobody accepted keeps its row, which then ends `· cancelled`. A `subagent({cancel})` call draws no row and no result of its own: a cancelled worker's row says `Cancelled by the parent (…)`.
261
+ - Tenjin answers a held Agent call as a refusal whose text carries the offer, so Claude Code shows the native call as not run and never as finished. The parent reads there that nothing failed and that its two moves are to accept the offer or to send the same call again unchanged.
262
+ - Ctrl+O shows the held call with its offer, and the worker's row and result at the accept call.
263
+
264
+ ### Two or more Agent calls in one response
265
+
266
+ - Claude Code draws them as its own summary block, which a plugin cannot redraw or remove, so those calls have no row to replace. For held calls that block counts none of them as finished.
267
+ - Tenjin writes no line of its own into the transcript for that group. While its held calls wait for the parent's answer, one line above the prompt reads `Tenjin offered DeepSeek for 2 Agent calls`. It goes away at the parent's first answer to any of them (an accept, the call sent again, or a cancel) and when the turn ends, and a resumed session shows none.
268
+ - After that the block's `Not run` stands for a held call, an accepted one has its DeepSeek row after the summary, and one kept native by sending the call again has its own native row. Two or more accepted workers draw one DeepSeek agent group with an entry and live status for each worker.
269
+
270
+ ### A running worker
271
+
272
+ - Each worker shows its progress from the moment of accept: `starting` and the time waited until its Claude Code has started, then its tool uses, tokens, time and the spend settled so far, with its latest step under it. Above the prompt, one status line gives the model, the worker's state, its tool uses and tokens, and the spend settled so far, then the final accounted spend once it ends.
273
+ - The parent does not check on a running worker: its result arrives by itself.
274
+ - On supported Claude Code versions, use the native Down-arrow agent selector and Enter to open the running DeepSeek agent. Its row in the agent list reads `DeepSeek` and the task's description. Its transcript is written as the worker goes, as a native subagent's is: the worker's own text, then its calls drawn by Claude Code as its own, and at the end the worker's answer and a `Done (…)` line with its counts.
275
+ - A shell call's command is shown on your machine only and is not added to what is forwarded to Tenjin or DeepSeek, nor to a stopped worker's handback.
276
+
277
+ ### How a worker's row ends
278
+
279
+ - `Done (…)`, like a native subagent's, when it completed.
280
+ - When it did not complete, the line says who or what ended it: `Stopped by you (…)`, `Cancelled by the parent (…)`, `Interrupted (…)` when Claude Code ended the call that ran it, `Session ended (…)`, `Budget reached (…)`, `Model call failed (…)`, `Model call timed out (…)` or `Payment refused (…)` when a model call through Tenjin returned no result, `DeepSeek unavailable (…)` when DeepSeek could not take the request, `DeepSeek refused (…)` when DeepSeek refused to answer it, `Stopped (…)` for anything else, and `Not started (…)` when it never started.
281
+ - While no read can say how the job ended, its row keeps following it and shows no end line: a job has no time limit, so an unanswered row is never read as an end. The result still returns to the parent.
282
+ - The worker's result to the parent carries the same cause as a fixed code (`endedBy`) with a sentence in plain words, and `status: "stopped"`, or `"unknown"` only when nothing said why. A failed model call also carries the router's HTTP status, the router's own error code (such as `invalid_model_request`) or the payer's code (such as `payment_failed`) when one is known, and the worker's last text.
283
+ - `subagent` reports completion, elapsed time, tool uses, tokens, accounted spend and unresolved reservations.
284
+
285
+ ### What is kept on your machine
286
+
287
+ - **The worker's transcript** is a local record in Claude Code's own session files, as a native subagent's transcript is, as written: Tenjin does not rewrite it, so it can hold what a command printed, a token included. What leaves is not that file: a continuation removes the job's tokens by value, and any GitHub-token-shaped text when its GitHub setup failed, before it sends anything on. Of a call's output it holds only short lines, never a file's content.
288
+ - **Each handback**, so a later accept in the same session can return it: a completed worker's result, and a stopped worker's last text and up to 24 recent steps, with the same replacements already made, in files only your user can read. Tenjin's data folder keeps no live worker activity after a job.
289
+ - **A diagnostic record** beside each job: the worker's tools and MCP servers, its root and commit, its request settings, retries, times and token counts, and how it ended. These are names, times, counts and codes only. For a job that did not complete it also holds the error: the job's end code, and the class name, code and first 300 characters of the message of the error and its causes, with secret-shaped values masked: this is Tenjin's own diagnostic file, not what the worker forwards. It is readable by your user alone and is sent nowhere.
290
+ - Tenjin removes its own local job, conversation, budget, handback and diagnostic records 7 days after their last write, except the files of a job that is still running.
291
+
292
+ ## Charges and limits
293
+
294
+ ### The routing fee
295
+
296
+ - A valid offered job incurs one routing fee, also when the offer is declined. The router states it on its 402 ($0.0081, 15% of an expected job spend of $0.054) and Tenjin pays it before any offer exists, only when it is at most $0.25 and fits inside your per-call limit and what the job cap leaves after one minimum model call; otherwise nothing is paid and the call stays native. The offer shows the fee that was paid.
297
+ - Several calls in a turn mean several offers and several routing fees, one each. Your daily budget and spend limits apply to every fee, and each job keeps its own ceiling.
298
+ - A fee your limits refuse buys no offer, and that call runs natively. A call the router judges should stay native pays no fee.
299
+ - Sending an offered call again unchanged to keep it native adds no second fee. A follow-up to a finished worker is not a new offer and pays no routing fee.
300
+
301
+ ### Inference
302
+
303
+ - Inference uses reported tokens plus the 5% proxy fee.
304
+ - Quotes reserve the requested output allowance and a conservative input bound; final usage can be lower. Provider overruns remain Tenjin's exposure and cannot increase the accepted quote.
305
+ - **Output cap.** A worker's turn asks for the output cap its router's offer names, up to 256,000 tokens, the DeepSeek harness's cap. Thinking counts as output, so it adds output tokens to a job's cost.
306
+ - **What a call reserves.** A quote reserves the output a call asks for. At the current peak tariff plus 5%, a 256,000-token call reserves about $0.324 plus $0.105 per decimal MB of request body (the router counts one input token for each 3 bytes) through about 3.13 MB, then caps near $0.653 at the model's input-context limit; a 65,536-token call reserves about $0.084 plus the same, capped near $0.413. For a 130 KiB request that is $0.337829 against $0.097845. These are reservation estimates, not actual charges or a guaranteed run.
307
+ - **Near the ceiling.** When what is left of a job's ceiling cannot reserve the offered cap, the call asks for the largest cap that still fits, never under 8,192 (the router takes any cap from 1), so a higher cap does not end a job sooner. A job is stopped for budget only when what is left cannot reserve the call's input plus 8,192 output tokens, and a call never reserves more than what is left. Under that, the rule below applies.
308
+ - **The floor.** An 8,192-token call, the least a call steps down to, reserves at least $0.011613 before system, tools and history input. Jobs are offered only under a ceiling above the reserve of one 65,536-token call, $0.083866, and configuration refuses a ceiling not above that, since the routing fee is paid inside the cap, from the room the cap leaves; this necessary floor does not guarantee a larger prompt fits.
309
+ - A continuing job must retain enough unspent ceiling, after actual spend and unresolved reservations, for each next call's full quote. Inference is refused if its quote exceeds the remaining ceiling; a routing fee may already be paid.
310
+ - A job's cap is your per-call spend limit or a lower ceiling you named, so no inference deposit passes the per-call limit. The daily budget and creator allowlist still apply, and a per-call limit of zero stops jobs as it stops every automatic payment.
311
+ - Other connected services retain their own permissions and billing. A worker cannot call Tenjin's paid-tool router or purchase tool itself; its page reads are the only tool calls Tenjin pays for on its behalf.
312
+
313
+ ### Web searches and page reads
314
+
315
+ - **Search.** A worker's native WebSearch asks its model for a server-side search. Tenjin sends that request to DeepSeek as one model call with DeepSeek's own search tool, up to 5 searches a request, so DeepSeek runs the search inside the call. There is no search charge of its own: the call costs its tokens, the search results included, plus the router's 5% fee, and it counts as a model call in the job's ceiling, spend and end line. The tokens a search adds can be more than those of a small turn.
316
+ - **A refused search.** A request that carries a tool field the router's strict schema refuses, such as `allowed_domains`, `blocked_domains` or `user_location`, is refused before the model call with nothing paid. Dropping the filter would return pages from blocked domains, so the search is refused instead. The worker's WebSearch then returns a plain error, `Web search is not available to this worker right now`, and the job continues.
317
+ - **Page reads.** WebFetch stays native: Claude Code fetches the page on your machine. Only when that fetch fails on the network, with an HTTP error status, or on an empty page does Tenjin read the page through Exa page read, $0.001 with no routing fee, paid from your Tenjin wallet within your per-call limit and daily budget and counted in the job's ceiling like a model call, and hand the page's text to the worker beside the failed result, up to 60,000 characters. A page on this machine or a private network, and an address that holds a replaced secret value, is never sent to Exa.
318
+ - **Your rules.** Your `tenjin config block` and `only` rules apply to the Exa page read as they apply to what Tenjin picks on its own. One that leaves Exa out, such as a block of Exa, of Tenjin's own tools or of the task or category the page read serves, or an `only` rule that names none of them, reads no page and pays nothing. A preference never forbids a service, so it changes nothing here. A search is a model call and is not routed by the tool router, so these rules do not change it.
319
+ - **Any other request** the worker's Claude Code makes that Tenjin cannot send fails alone, as an API error for that one request, with nothing sent or paid. That includes a request offering more than 256 tools, the most one request to Tenjin's router may carry; the error names the count.
320
+
321
+ ### Deposits and refunds
322
+
323
+ - Tenjin refills inference credit as needed, normally depositing up to $0.25 at a time. If one quote requires more than $0.25 in additional credit, Tenjin deposits only the amount that quote needs within the job and daily limits. Smaller deposits leave more USDC available for other workers.
324
+ - Each fresh deposit counts against the existing automatic spend limits as it is sent.
325
+ - Each Claude worker run opens its own inference channel when it first needs to pay. When the worker finishes, stops or fails, Tenjin closes that channel and returns its unused USDC to the funding wallet. If the refund is still pending, Tenjin retries it during the session and when a Claude session starts.
326
+ - `tenjin balance` shows pending and confirmed refunds recorded on this installation. A refund still pending at a router you configured earlier is listed with that router's address, and is retried only while that router is the configured one.
327
+ - When the router's receipt and the chain confirm a refund, its amount comes off the daily budget's count again, so the budget counts what the run cost and not its deposit. A pending refund stays counted. A refund gives back no more than that run's own deposits still count, and nothing once the budget's 24-hour window has rolled. A job's own ceiling counts its calls, not its deposits, so a refund changes nothing there.
328
+
329
+ ### Uncertain calls, retries and the call rate
330
+
331
+ - **Uncertain calls.** Uncertain signed requests keep their full reservation until reconciled; recovery does not buy a replacement. Reconciling is a free read of Tenjin's own record of each such call, made while the job has no run going: before a follow-up is offered, and when a stopped worker's handback is read again. A call Tenjin finished is counted at its actual cost. A call that failed or was cancelled with nothing charged is released, so it no longer lowers what the job can still spend. Any other answer, or none, keeps the full reservation. Timeout or interruption is not proof of settlement.
332
+ - **Retries.** A call the router confirms cost nothing is tried again, as the DeepSeek harness does: up to 5 more times after the first try, waiting 0.5 s doubling to 10 s with some jitter, or as long as the router's `Retry-After` asks. An uncertain or charged call is never tried again, nor a request refused as malformed. A reply the router cut, because DeepSeek sent nothing for the router's idle limit or the call passed its deadline, is tried again only when Tenjin's record of that call proves that nothing was charged: its voucher cancelled and a charge of zero. With any other record, or none, it stays uncertain and the job ends. When the tries run out the job ends with that call's cause.
333
+ - **The call rate.** Tenjin keeps your wallet inside the router's call rate, counted across every session on the machine, so a call of many busy workers waits for room before it is sent. A signed request the router still refuses for rate stays uncertain and is never tried again.
334
+
335
+ ### Time limits
336
+
337
+ - Jobs have no time limit and no turn limit, as a native subagent and the DeepSeek harness have none: a job ends when it completes, reaches its dollar cap or your daily budget, you or the parent cancel it, its session ends or you run `/clear`, or its worker fails.
338
+ - Native compaction remains enabled, given the window where the DeepSeek harness triggers it at its defaults: `min(0.8 * 1,048,576, 1,048,576 - reply cap - 65,536)`, which is 838,860 at a 65,536 reply cap and 727,040 at 256,000. Claude Code treats that value as a window and takes 33,000 tokens off it (a reserve of up to 20,000 for the summary plus 13,000 of headroom), so compaction fires about 33,000 tokens earlier: near 805,860 and 694,040.
339
+ - One model call waits for the router's answer a minute longer than the router lets a call run, so Tenjin never gives up on a call the router is still serving: the call duration the router's offer names plus a minute. The HTTP client's own waits for headers and body are at least that long.
340
+ - A worker has no separate start-up window, as a native subagent has none: its Claude Code takes the time the machine needs to start, with no limit. Cancel or interrupt a start that takes too long.
341
+
342
+ ## Hosts
343
+
344
+ Claude Code is primary and requires a qualified installed version with observed Manual, Accept edits, Auto, `dontAsk` or bypass-permissions mode. In auto mode the worker's native classifier runs on Flash. Plan mode, a bypass mode that settings disable, and unavailable modes stay native.
345
+
346
+ DeepSeek subagents run on Claude Code only. Codex and other agents keep running their own subagents natively, with no offer and no routing fee, and Tenjin's tool routing there is unchanged.
347
+
348
+ Contributors: how the worker is built is in [DeepSeek subagents: internals](./subagents-internals.md).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tenjin-cli",
3
- "version": "0.1.0-alpha.34",
3
+ "version": "0.1.0-alpha.35",
4
4
  "type": "module",
5
5
  "description": "The tool router for coding agents. Tenjin picks the right tool when your agent needs one, and one wallet pays for every call.",
6
6
  "repository": {
@@ -51,6 +51,8 @@
51
51
  "NOTICE.md"
52
52
  ],
53
53
  "devDependencies": {
54
+ "@anthropic-ai/claude-agent-sdk": "0.3.325",
55
+ "@anthropic-ai/sdk": "0.137.0",
54
56
  "@changesets/cli": "^3.0.3",
55
57
  "@clack/prompts": "^1.7.0",
56
58
  "@eslint/js": "^10",
@@ -72,6 +74,7 @@
72
74
  "tsup": "^8.5.0",
73
75
  "typescript": "^6",
74
76
  "typescript-eslint": "^8",
77
+ "undici": "7.28.0",
75
78
  "viem": "^2.53.1",
76
79
  "vitest": "^4.1.9",
77
80
  "zod": "^4.6.6"
@@ -1,55 +0,0 @@
1
- import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
- import {
3
- BALANCE_READ_MS,
4
- DEFAULT_WAIT_MS,
5
- balanceReader,
6
- lowBalance,
7
- runBalance
8
- } from "./chunk-46HAB26L.js";
9
- import "./chunk-RJ5HRPAZ.js";
10
- import "./chunk-FOEPH67T.js";
11
- import "./chunk-2TO5F6CT.js";
12
- import "./chunk-43HLS2HM.js";
13
- import "./chunk-LJSCGIYH.js";
14
- import "./chunk-6QJZA6EX.js";
15
- import "./chunk-XRGFH7FI.js";
16
- import "./chunk-HWZO6HYZ.js";
17
- import "./chunk-FNBGRKS6.js";
18
- import "./chunk-PETQ5WEA.js";
19
- import "./chunk-3AKH7ODX.js";
20
- import "./chunk-RBJPAZFI.js";
21
- import "./chunk-CZJOMUBP.js";
22
- import "./chunk-WFZX352D.js";
23
- import "./chunk-I47ARU5G.js";
24
- import "./chunk-JWAK7JQB.js";
25
- import "./chunk-E6VP6MQM.js";
26
- import "./chunk-2W4DQQUU.js";
27
- import "./chunk-GS5RZF7U.js";
28
- import "./chunk-OO6FIBL7.js";
29
- import "./chunk-MEZJ3I63.js";
30
- import "./chunk-RFZA7PSM.js";
31
- import "./chunk-JUUBBBY5.js";
32
- import "./chunk-JOKPBYXP.js";
33
- import "./chunk-7WEQQJLG.js";
34
- import "./chunk-VH7JMLTG.js";
35
- import "./chunk-3MZ7DYRO.js";
36
- import "./chunk-ZCT5DJ3G.js";
37
- import "./chunk-JTX3BUDK.js";
38
- import "./chunk-7U3P4PB7.js";
39
- import "./chunk-DIH2G3YG.js";
40
- import "./chunk-MXN2ZEUB.js";
41
- import "./chunk-6AQSUBNR.js";
42
- import "./chunk-CRG54LEB.js";
43
- import "./chunk-TUCKEEXE.js";
44
- import "./chunk-QEZZDIQT.js";
45
- import "./chunk-DI4QAGRZ.js";
46
- import "./chunk-EQZ2CCWC.js";
47
- import "./chunk-ZXTAQYNA.js";
48
- export {
49
- BALANCE_READ_MS,
50
- DEFAULT_WAIT_MS,
51
- balanceReader,
52
- lowBalance,
53
- runBalance
54
- };
55
- //# sourceMappingURL=balance-RQW5T5FB.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/router/accounts/presence.ts","../src/router/settings.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { readFile } from 'node:fs/promises';\nimport { sourceVaultPath } from '../../lib/paths';\nimport type { AccountCall } from '../decision';\nimport { isAccountId } from './ids';\n\n/**\n * WHICH SAVED ACCOUNTS ARE CONNECTED ON THIS MACHINE: a descriptor in\n * `router.sources` AND a vault here. Safe in a hook: one stat per saved\n * account (at most 16), no OS-store read, no decrypt and no network.\n *\n * A descriptor alone is a setting, which can travel with the rest of the\n * file; the vault is this machine's sign-in. Only both together make an\n * account eligible, so a copied config never names an account this machine\n * cannot call. An expired sign-in stays connected: the router still picks the\n * account, and the call itself refuses and offers Tenjin's own tool.\n */\nexport function connectedSourceIds(dataDir: string, descriptorIds: readonly string[]): string[] {\n return descriptorIds.filter((id) => isAccountId(id) && existsSync(sourceVaultPath(id, dataDir)));\n}\n\n/** Every tool a call makes: the call, its poll and its follow-up. */\nexport function toolsOf(call: AccountCall): string[] {\n return [call.tool, call.next?.poll?.tool, call.next?.tool].filter(\n (tool): tool is string => tool !== undefined,\n );\n}\n\n/**\n * WHETHER A SERVICE ON A CONNECTED ACCOUNT CANNOT RUN HERE: the connect-time\n * check found this account lacks a tool its call makes (a higher plan, say),\n * or there is no sign-in here whose header can be read. Either way it is left\n * out of what is offered, rather than leading its task and failing when\n * called. The vault's plaintext header alone: no key, no OS store, no\n * network, so a hook may ask.\n */\nexport async function accountLacks(\n dataDir: string,\n spec: { source: string; mcp: AccountCall },\n): Promise<boolean> {\n if (!isAccountId(spec.source)) return true;\n try {\n const file = JSON.parse(await readFile(sourceVaultPath(spec.source, dataDir), 'utf8')) as {\n header?: { id?: unknown; missingTools?: unknown };\n };\n const missing = file.header?.missingTools;\n if (file.header?.id !== spec.source || !Array.isArray(missing)) return true;\n return toolsOf(spec.mcp).some((tool) => missing.includes(tool));\n } catch {\n return true;\n }\n}\n","import { readFile } from 'node:fs/promises';\nimport { homedir } from 'node:os';\nimport { join, resolve } from 'node:path';\nimport {\n CONFIG_DEFAULTS,\n loadRawConfig,\n parseRouterLayer,\n readPersonalRouter,\n type PartialConfig,\n type PersonalRouter,\n type RouterContext,\n type RouterLayer,\n} from '../lib/config';\nimport { CliError } from '../lib/errors';\nimport { configPath } from '../lib/paths';\nimport { connectedSourceIds } from './accounts/presence';\nimport { savedAccountOf, type SavedAccount } from './accounts/saved';\nimport { BUILT_IN_SOURCE, hasRules, wireSettings, type WireSettings } from './settings-wire';\nimport {\n findAllProjectFiles,\n findNearestProjectFiles,\n mainWorktreeOf,\n ownedCandidates,\n projectRoot,\n type ProjectWalkDeps,\n} from '../lib/settings';\n\n/**\n * THE ONE READER OF THE ROUTER'S OWN KEYS, `router.enabled`,\n * `router.context` and `router.improve`. Both hooks, the `request` tool, doctor, the status line and\n * `tenjin config` call {@link routerSettings} first, and nothing reads a router\n * key any other way.\n *\n * THE LAYERS: the default, `~/.tenjin/config.json`, then EVERY\n * `.tenjin/config.json` and `config.local.json` from the working directory up\n * to the git root, and in a linked git worktree the main checkout's pair too.\n * No environment variable.\n *\n * EVERY LAYER IS A FLOOR. `enabled` is false when any layer says false, and\n * `context` is `turn` when any layer says turn; a key a file leaves out\n * inherits, and a looser value is not read. So a file a cloned repository\n * carries cannot undo `tenjin config set router.enabled false` on this\n * machine, a package in a monorepo cannot undo its root, and a\n * `config.local.json` a repository commits anyway cannot undo the committed\n * one. Both keys fail toward less data sent, and no project file has a spend\n * key to loosen. The source reported is the nearest layer at the value.\n *\n * ONE PARSER. The global block is the one `loadRawConfig` already validated,\n * and a project file goes through `parseRouterLayer` from the same schema.\n *\n * `improve` IS THE GLOBAL FILE'S ALONE. It is the person's own consent for the\n * router to keep the masked text of the turns it sees, so no project layer is\n * read for it: a repository cannot opt anyone in, and turning it off is the\n * one switch in `~/.tenjin/config.json`.\n *\n * SO ARE THE PERSONAL SETTINGS (plan 36): the routing rules (`router.policy`)\n * and automatic use with its provider scope (`router.nativeReplacement`,\n * `router.nativeReplacementProviders`). A project file cannot add a rule or\n * turn automatic use on, so a cloned repository never changes what Tenjin\n * may use or run on this machine. They are reread on every call, never\n * cached, so a change from another process applies to the next call without\n * restarting `tenjin mcp`.\n */\n\n/** The committed project file and the personal one beside it. */\nexport const PROJECT_ROUTER_FILE = join('.tenjin', 'config.json');\nexport const LOCAL_ROUTER_FILE = join('.tenjin', 'config.local.json');\n\nexport type RouterSource = 'default' | 'file' | 'project' | 'local';\n\nexport interface RouterSetting<T> {\n value: T;\n source: RouterSource;\n /** The file that set it; absent for the default. */\n path?: string;\n}\n\n/** The saved routing rules: none, readable, or not readable by this build. */\nexport type PolicySetting = PersonalRouter['policy'];\n\n/** Automatic use: off unless the global file says `when-routed`. An absent\n * provider scope means every eligible provider; a `problem` says why the\n * saved value could not be read, and the mode then reads off. */\nexport type ReplacementSetting = PersonalRouter['nativeReplacement'];\n\n/**\n * WHAT EVERY ROUTING CALL SENDS: the `settings` field with its hash, and\n * whether it carries any rule. `invalid` is fail-closed: rules this build\n * cannot read are never guessed, so nothing routes or runs until they are\n * fixed (`tenjin config` shows the problem, `reset --all` clears it).\n */\nexport type WireState =\n | { status: 'ok'; settings: WireSettings; hasRules: boolean }\n | { status: 'invalid'; problem: string };\n\n/** The accounts saved in `router.sources` (plan 37), and which of them this\n * machine holds a sign-in for. A descriptor alone connects nothing. */\nexport interface AccountsSetting {\n saved: SavedAccount[];\n connected: string[];\n}\n\n/** The personal settings, from the global file alone. */\nexport interface PersonalSettings {\n policy: PolicySetting;\n nativeReplacement: ReplacementSetting;\n wire: WireState;\n accounts: AccountsSetting;\n}\n\nexport interface RouterSettings extends PersonalSettings {\n enabled: RouterSetting<boolean>;\n context: RouterSetting<RouterContext>;\n /** \"Help improve routing\": the global file's, or the default, off. */\n improve: RouterSetting<boolean>;\n}\n\n/**\n * The personal settings from the global file's router block. The sources are\n * Tenjin's own and, with `dataDir`, every account connected on this machine\n * that the router has jobs for (`accounts/presence.ts`): a saved descriptor\n * with a vault here. The hash covers them, so connecting or disconnecting an\n * account refuses every offer decided before it. A saved list this build\n * cannot read names no account.\n */\nexport function personalSettings(router: unknown, dataDir?: string): PersonalSettings {\n const personal = readPersonalRouter(router);\n const { policy, nativeReplacement } = personal;\n const listed = personal.sources.status === 'ok' ? personal.sources.saved : [];\n const saved = listed.flatMap((entry) => savedAccountOf(entry) ?? []);\n const accounts: AccountsSetting = {\n saved,\n connected:\n dataDir !== undefined\n ? connectedSourceIds(\n dataDir,\n saved.map(({ id }) => id),\n )\n : [],\n };\n if (policy.status === 'invalid') {\n return {\n policy,\n nativeReplacement,\n wire: { status: 'invalid', problem: policy.problem },\n accounts,\n };\n }\n const rules = policy.status === 'ok' ? policy.saved : undefined;\n // NAMED TO THE ROUTER: a saved account that is connected here and mapped,\n // in the order saved. One connected by its address alone never is: its id\n // comes from a private host name, and the router has nothing for it.\n const routed = saved\n .filter((account) => account.mapped === true && accounts.connected.includes(account.id))\n .map(({ id }) => id);\n const settings = wireSettings(rules, nativeReplacement, [BUILT_IN_SOURCE, ...routed]);\n return {\n policy,\n nativeReplacement,\n wire: { status: 'ok', settings, hasRules: hasRules(settings.policy) },\n accounts,\n };\n}\n\n/** {@link personalSettings} straight from the global file in `dataDir`: what\n * the check before every call compares an offer against. */\nexport async function personalSettingsAt(dataDir: string): Promise<PersonalSettings> {\n return personalSettings((await loadRawConfig(dataDir)).router, dataDir);\n}\n\nexport interface RouterSettingsInput {\n /** The directory the harness is working in. */\n cwd: string;\n /** The data dir whose `config.json` is the global layer. */\n dataDir: string;\n /** That file, when the caller has already loaded it; read here otherwise. */\n config?: PartialConfig;\n}\n\nexport async function routerSettings(\n input: RouterSettingsInput,\n deps: ProjectWalkDeps = {},\n): Promise<RouterSettings> {\n const globalPath = configPath(input.dataDir);\n const global = (input.config ?? (await loadRawConfig(input.dataDir))).router;\n let enabled: RouterSetting<boolean> = {\n value: CONFIG_DEFAULTS.router.enabled,\n source: 'default',\n };\n let context: RouterSetting<RouterContext> = {\n value: CONFIG_DEFAULTS.router.context,\n source: 'default',\n };\n if (global?.enabled !== undefined) {\n enabled = { value: global.enabled, source: 'file', path: globalPath };\n }\n if (global?.context !== undefined) {\n context = { value: global.context, source: 'file', path: globalPath };\n }\n const improve: RouterSetting<boolean> =\n global?.improve !== undefined\n ? { value: global.improve, source: 'file', path: globalPath }\n : { value: CONFIG_DEFAULTS.router.improve, source: 'default' };\n\n for (const { source, path, layer } of await projectLayers(input, deps)) {\n // Every layer is a floor: a value looser than the one so far is not read.\n if (layer.enabled !== undefined && (layer.enabled === false || enabled.value)) {\n enabled = { value: layer.enabled, source, path };\n }\n if (layer.context !== undefined && (layer.context === 'turn' || context.value === 'session')) {\n context = { value: layer.context, source, path };\n }\n }\n return { enabled, context, improve, ...personalSettings(global, input.dataDir) };\n}\n\nconst ROUTER_FILES = [PROJECT_ROUTER_FILE, LOCAL_ROUTER_FILE];\n\n/**\n * Every project layer, outermost first so the nearest one at a value is the\n * one reported: the main checkout's pair when this is a linked worktree, then\n * each directory from the git root down to `cwd`, its project file before its\n * personal one.\n */\nasync function projectLayers(\n input: RouterSettingsInput,\n deps: ProjectWalkDeps,\n): Promise<{ source: 'project' | 'local'; path: string; layer: RouterLayer }[]> {\n const { levels, gitRoot } = await findAllProjectFiles(input.cwd, ROUTER_FILES, {\n ...deps,\n // $HOME/.tenjin is the global scope, not a project.\n homeIsProject: false,\n });\n const main = gitRoot === null ? null : await mainWorktreeOf(gitRoot, deps.homeDir);\n const outer =\n main === null ? [] : [{ dir: main, found: await ownedCandidates(main, ROUTER_FILES, deps) }];\n const layers = [];\n for (const { dir, found } of [...outer, ...levels.reverse()]) {\n // A data dir kept inside a project is the global file, already read.\n if (resolve(dir, '.tenjin') === resolve(input.dataDir)) continue;\n for (const path of found) {\n const file = await readProjectRouterFile(path);\n if (file === null) continue;\n layers.push({\n source: path === join(dir, LOCAL_ROUTER_FILE) ? ('local' as const) : ('project' as const),\n path,\n layer: file.layer,\n });\n }\n }\n return layers;\n}\n\nconst ABSENT = new Set(['ENOENT', 'ENOTDIR']);\n\n/**\n * One project file: its whole JSON, for a writer that keeps sibling keys, and\n * its router layer through the one parser. Null when there is no file.\n */\nexport async function readProjectRouterFile(\n path: string,\n): Promise<{ json: Record<string, unknown>; layer: RouterLayer } | null> {\n let raw: string;\n try {\n raw = await readFile(path, 'utf8');\n } catch (err) {\n if (ABSENT.has(String((err as { code?: unknown }).code))) return null;\n throw invalid(path, 'could not be read', err);\n }\n let json: unknown;\n try {\n json = JSON.parse(raw);\n } catch (err) {\n throw invalid(path, 'is not valid JSON', err);\n }\n const layer = parseRouterLayer(json, path);\n return { json: json as Record<string, unknown>, layer };\n}\n\n/**\n * Where `tenjin config set --project [--local]` writes from `cwd`: beside the\n * layer {@link routerSettings} already reads there, else at the git root, else\n * in `cwd`. Never in $HOME, whose `.tenjin/config.json` is the global file.\n */\nexport async function projectRouterPath(\n input: { cwd: string; local: boolean },\n deps: ProjectWalkDeps = {},\n): Promise<string> {\n const home = deps.homeDir ?? homedir();\n const hit = await findNearestProjectFiles(input.cwd, [PROJECT_ROUTER_FILE, LOCAL_ROUTER_FILE], {\n ...deps,\n warn: () => undefined,\n homeIsProject: false,\n });\n const dir = hit?.dir ?? (await projectRoot(input.cwd, home));\n if (dir === home) {\n throw new CliError(\n 'USAGE',\n 'Your home directory is not a project: its .tenjin is the global config.',\n {\n fix: 'Run it from inside the project, or drop --project to set it for this machine.',\n },\n );\n }\n return join(dir, input.local ? LOCAL_ROUTER_FILE : PROJECT_ROUTER_FILE);\n}\n\nfunction invalid(path: string, what: string, cause?: unknown): CliError {\n return new CliError('CONFIG_INVALID', `Config at ${path} ${what}`, {\n fix: `Fix ${path}, or delete it.`,\n ...(cause !== undefined ? { cause } : {}),\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB;AAgBlB,SAAS,mBAAmB,SAAiB,eAA4C;AAC9F,SAAO,cAAc,OAAO,CAAC,OAAO,YAAY,EAAE,KAAK,WAAW,gBAAgB,IAAI,OAAO,CAAC,CAAC;AACjG;AAGO,SAAS,QAAQ,MAA6B;AACnD,SAAO,CAAC,KAAK,MAAM,KAAK,MAAM,MAAM,MAAM,KAAK,MAAM,IAAI,EAAE;AAAA,IACzD,CAAC,SAAyB,SAAS;AAAA,EACrC;AACF;AAUA,eAAsB,aACpB,SACA,MACkB;AAClB,MAAI,CAAC,YAAY,KAAK,MAAM,EAAG,QAAO;AACtC,MAAI;AACF,UAAM,OAAO,KAAK,MAAM,MAAM,SAAS,gBAAgB,KAAK,QAAQ,OAAO,GAAG,MAAM,CAAC;AAGrF,UAAM,UAAU,KAAK,QAAQ;AAC7B,QAAI,KAAK,QAAQ,OAAO,KAAK,UAAU,CAAC,MAAM,QAAQ,OAAO,EAAG,QAAO;AACvE,WAAO,QAAQ,KAAK,GAAG,EAAE,KAAK,CAAC,SAAS,QAAQ,SAAS,IAAI,CAAC;AAAA,EAChE,QAAQ;AACN,WAAO;AAAA,EACT;AACF;;;ACnDA,SAAS,YAAAA,iBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,MAAM,eAAe;AA+DvB,IAAM,sBAAsB,KAAK,WAAW,aAAa;AACzD,IAAM,oBAAoB,KAAK,WAAW,mBAAmB;AA2D7D,SAAS,iBAAiB,QAAiB,SAAoC;AACpF,QAAM,WAAW,mBAAmB,MAAM;AAC1C,QAAM,EAAE,QAA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MACA;AAAA,MACA;AAAA,QACE,KAAK;AAAA,MACP;AAAA,IACF;AAAA,EACF;AACA,SAAO,KAAK,KAAK,MAAM,QAAQ,oBAAoB,mBAAmB;AACxE;AAEA,SAAS,QAAQ,MAAc,MAAc,OAA2B;AACtE,SAAO,IAAI,SAAS,kBAAkB,aAAa,IAAI,IAAI,IAAI,IAAI;AAAA,IACjE,KAAK,OAAO,IAAI;AAAA,IAChB,GAAI,UAAU,SAAY,EAAE,MAAM,IAAI,CAAC;AAAA,EACzC,CAAC;AACH;","names":["readFile","readFile"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/commands/balance.ts"],"sourcesContent":["import { CliError } from '../lib/errors';\nimport { liveLine, type LiveLine } from '../lib/live-line';\nimport { toMoney } from '../lib/money';\nimport { paint } from '../lib/output';\nimport { resolveContextSettings } from '../lib/settings';\nimport { readUsdcBalanceWithFallback } from '../lib/usdc-balance';\nimport {\n describeWallet,\n resolveWalletProvider,\n type ResolveWalletProviderOptions,\n} from '../lib/wallet';\nimport type { SpendPolicy } from '../lib/policy';\nimport { channelCredit, routingSpent } from '../router/channel-credit';\nimport { FUND_COMMAND_LINE, LEGACY_ROUTING_QUOTE_ATOMIC } from '../router/fee';\nimport { limitsLine } from '../router/spend-question';\nimport { dollars, forgetLink, recallLink, watchFunding } from './fund-watch';\nimport type { CommandContext, CommandResult } from '../context';\n\n/**\n * `tenjin balance` (and `tenjin wallet balance`): the balance in dollars, the\n * limits that apply to it, and a word only when it needs attention. A chain\n * read: no key is unlocked and nothing is spent.\n *\n * `--wait` reads it, then watches until it rises: what an agent runs in the\n * background after opening checkout, so it wakes when the money lands. A link\n * `tenjin fund` issued recently is followed by its payment status too, and an\n * arrival that already happened before the wait started still counts.\n */\n\n/** How long `--wait` waits by default. */\nexport const DEFAULT_WAIT_MS = 15 * 60_000;\n/** Labels line up at this width: `Balance `, `Limits `. */\nconst LABEL_WIDTH = 10;\n\nexport interface BalanceOptions extends ResolveWalletProviderOptions {\n wait?: boolean;\n /** `--timeout` with `--wait`, in ms. */\n waitMs?: number;\n fetchImpl?: typeof fetch;\n now?: () => number;\n sleep?: (ms: number) => Promise<void>;\n intervalMs?: number;\n live?: LiveLine;\n}\n\n/** A balance is low below the per-call limit: the next automatic call may not\n * fit. `tenjin balance` and `tenjin status` both say so by this rule. */\nexport function lowBalance(\n atomic: bigint,\n policy: Pick<SpendPolicy, 'maxAutoSpendAtomic'>,\n): boolean {\n return atomic < policy.maxAutoSpendAtomic;\n}\n\n/** How long one balance read may take, across the RPCs it may ask. */\nexport const BALANCE_READ_MS = 5_000;\n\n/**\n * THE BALANCE, READ THE ONE WAY: this wallet's address and the USDC it holds\n * on Base. `tenjin balance` and `tenjin status` both read it here, so the two\n * never disagree. It reads the configured RPC and, only when that is the\n * default one, retries the public Base RPCs a lookup falls back to\n * (`readUsdcBalanceWithFallback`); an RPC the user set is the only one asked.\n * Throws `RPC_ERROR` on a read none of them answered.\n */\nexport async function balanceReader(\n ctx: CommandContext,\n opts: ResolveWalletProviderOptions & { rpcFetchImpl?: typeof fetch } = {},\n): Promise<{ address: `0x${string}`; read: () => Promise<bigint> }> {\n const provider = resolveWalletProvider(ctx, opts);\n const desc = await describeWallet(provider);\n const { rpcUrl } = await resolveContextSettings(ctx);\n const read = async (): Promise<bigint> => {\n const atomic = await readUsdcBalanceWithFallback(desc.address, rpcUrl, {\n timeoutMs: BALANCE_READ_MS,\n ...(opts.rpcFetchImpl !== undefined ? { fetchImpl: opts.rpcFetchImpl } : {}),\n });\n if (atomic !== null) return atomic;\n throw new CliError('RPC_ERROR', `Could not read the USDC balance from ${rpcUrl}.`, {\n fix: 'Check your network, or set a working RPC with `tenjin config set rpcUrl <url>`.',\n });\n };\n return { address: desc.address, read };\n}\n\nexport async function runBalance(\n ctx: CommandContext,\n opts: BalanceOptions = {},\n): Promise<CommandResult> {\n const { address, read } = await balanceReader(ctx, opts);\n const settings = await resolveContextSettings(ctx);\n\n if (opts.wait === true) return waitForFunds(ctx, address, read, opts);\n\n const atomic = await read();\n\n const balance = toMoney(atomic.toString());\n // The routing balance is a local estimate, separate from on-chain funds.\n const creditAtomic = await channelCredit(ctx.dataDir, address).catch(() => 0n);\n const credit = toMoney(creditAtomic.toString());\n // What routing has cost: the deposits sent less that credit, also local.\n const spentAtomic = await routingSpent(ctx.dataDir, address).catch(() => 0n);\n const spent = toMoney(spentAtomic.toString());\n const policy = settings.policy;\n const low = lowBalance(atomic, policy);\n const label = (text: string) => ` ${text.padEnd(LABEL_WIDTH)}`;\n return {\n data: {\n address,\n balance,\n routingCredit: credit,\n routingSpent: spent,\n limits: limitsData(policy),\n low,\n },\n humanLines: [\n `${label('Balance')}${paint(ctx.io, 'bold', dollars(atomic))}${low ? ` ${paint(ctx.io, 'yellow', 'low')}` : ''}`,\n `${label('Limits')}${limitsLine(policy)}`,\n ...(creditAtomic > 0n\n ? [`${label('Set aside')}about ${dollars(creditAtomic)} for routing`]\n : []),\n ...(spentAtomic > 0n ? [`${label('Spent')}about ${dollars(spentAtomic)} on routing`] : []),\n ...(atomic === 0n && creditAtomic < LEGACY_ROUTING_QUOTE_ATOMIC\n ? ['', ` ${FUND_COMMAND_LINE}`]\n : []),\n ],\n };\n}\n\nfunction limitsData(policy: SpendPolicy): { maxAutoSpend: string; sessionBudget: string } {\n return {\n maxAutoSpend: toMoney(policy.maxAutoSpendAtomic.toString()).usd,\n sessionBudget:\n policy.sessionBudgetAtomic === null\n ? 'none'\n : toMoney(policy.sessionBudgetAtomic.toString()).usd,\n };\n}\n\nasync function waitForFunds(\n ctx: CommandContext,\n address: string,\n read: () => Promise<bigint>,\n opts: BalanceOptions,\n): Promise<CommandResult> {\n const now = opts.now ?? Date.now;\n const waitMs = opts.waitMs ?? DEFAULT_WAIT_MS;\n const deadline = now() + waitMs;\n const human = ctx.io.isTTY && !ctx.flags.json;\n const live = opts.live ?? liveLine(ctx.io.stderr);\n const sleep = opts.sleep ?? ((ms: number) => new Promise<void>((r) => setTimeout(r, ms)));\n const soft = () => read().catch(() => undefined);\n\n // The baseline must be a real read: a wait measured from a guess could\n // report money that was already there, or miss money that is.\n let start = await soft();\n while (start === undefined) {\n if (now() >= deadline) await read();\n await sleep(opts.intervalMs ?? 2_000);\n start = await soft();\n }\n\n // The link `tenjin fund` issued, followed by its status when it has one (a\n // hosted link does not). Money that landed after that link was issued and\n // before this wait began is an arrival too.\n const link = await recallLink(ctx.dataDir, address, now());\n const linkStart =\n link?.startBalanceAtomic !== undefined ? BigInt(link.startBalanceAtomic) : undefined;\n const from = linkStart !== undefined && linkStart < start ? linkStart : start;\n\n const end =\n from < start\n ? { kind: 'arrived' as const, balance: start, added: start - from }\n : await watchFunding({\n startBalance: from,\n readBalance: soft,\n ...(link?.token !== undefined ? { token: link.token } : {}),\n deadline,\n view: 'funds',\n ...(human ? { live } : {}),\n ...(opts.fetchImpl !== undefined ? { fetchImpl: opts.fetchImpl } : {}),\n ...(opts.sleep !== undefined ? { sleep: opts.sleep } : {}),\n ...(opts.intervalMs !== undefined ? { intervalMs: opts.intervalMs } : {}),\n now,\n });\n live.stop();\n\n if (end.kind !== 'arrived') {\n throw new CliError(\n 'RESOURCE_NOT_FOUND',\n `No funds arrived in ${duration(waitMs)}. Nothing went wrong: a payment still on its way lands in your balance on its own.`,\n {\n fix: 'Run `tenjin balance` to check again later, or `tenjin fund` to add funds.',\n details: {\n arrived: false,\n balance: toMoney(start.toString()),\n ...('status' in end && end.status !== undefined ? { status: end.status.state } : {}),\n },\n },\n );\n }\n if (link !== null) await forgetLink(ctx.dataDir);\n const creditAtomic = await channelCredit(ctx.dataDir, address).catch(() => 0n);\n const line = `+${dollars(end.added)} · balance ${dollars(end.balance)}`;\n return {\n data: {\n address,\n arrived: true,\n added: toMoney(end.added.toString()),\n balance: toMoney(end.balance.toString()),\n routingCredit: toMoney(creditAtomic.toString()),\n summary: line,\n },\n humanLines: [human ? ` ${line}` : line],\n };\n}\n\n/** `15 minutes`, `90 seconds`, `1 hour`. */\nfunction duration(ms: number): string {\n const plural = (n: number, unit: string) => `${n} ${unit}${n === 1 ? '' : 's'}`;\n if (ms % 3_600_000 === 0) return plural(ms / 3_600_000, 'hour');\n if (ms % 60_000 === 0) return plural(ms / 60_000, 'minute');\n return plural(Math.round(ms / 1000), 'second');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BO,IAAM,kBAAkB,KAAK;AAEpC,IAAM,cAAc;AAeb,SAAS,WACd,QACA,QACS;AACT,SAAO,SAAS,OAAO;AACzB;AAGO,IAAM,kBAAkB;AAU/B,eAAsB,cACpB,KACA,OAAuE,CAAC,GACN;AAClE,QAAM,WAAW,sBAAsB,KAAK,IAAI;AAChD,QAAM,OAAO,MAAM,eAAe,QAAQ;AAC1C,QAAM,EAAE,OAAO,IAAI,MAAM,uBAAuB,GAAG;AACnD,QAAM,OAAO,YAA6B;AACxC,UAAM,SAAS,MAAM,4BAA4B,KAAK,SAAS,QAAQ;AAAA,MACrE,WAAW;AAAA,MACX,GAAI,KAAK,iBAAiB,SAAY,EAAE,WAAW,KAAK,aAAa,IAAI,CAAC;AAAA,IAC5E,CAAC;AACD,QAAI,WAAW,KAAM,QAAO;AAC5B,UAAM,IAAI,SAAS,aAAa,wCAAwC,MAAM,KAAK;AAAA,MACjF,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AACA,SAAO,EAAE,SAAS,KAAK,SAAS,KAAK;AACvC;AAEA,eAAsB,WACpB,KACA,OAAuB,CAAC,GACA;AACxB,QAAM,EAAE,SAAS,KAAK,IAAI,MAAM,cAAc,KAAK,IAAI;AACvD,QAAM,WAAW,MAAM,uBAAuB,GAAG;AAEjD,MAAI,KAAK,SAAS,KAAM,QAAO,aAAa,KAAK,SAAS,MAAM,IAAI;AAEpE,QAAM,SAAS,MAAM,KAAK;AAE1B,QAAM,UAAU,QAAQ,OAAO,SAAS,CAAC;AAEzC,QAAM,eAAe,MAAM,cAAc,IAAI,SAAS,OAAO,EAAE,MAAM,MAAM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