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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (332) hide show
  1. package/NOTICE.md +30 -0
  2. package/README.md +20 -18
  3. package/dist/{_esm-MMYV66AX.js → _esm-2KST7HQ7.js} +4 -4
  4. package/dist/{alive-VOIL5W3I.js → alive-5TV22PNF.js} +13 -13
  5. package/dist/{auth-UHD3QFX4.js → auth-XI7BJFLW.js} +4 -4
  6. package/dist/balance-DFHC6XEU.js +71 -0
  7. package/dist/{ccip-CS7K5QRQ.js → ccip-HOW3DZYF.js} +3 -3
  8. package/dist/{chunk-RJ5HRPAZ.js → chunk-24XKUN2S.js} +68 -10
  9. package/dist/chunk-24XKUN2S.js.map +1 -0
  10. package/dist/chunk-2L7TDGLV.js +56 -0
  11. package/dist/chunk-2L7TDGLV.js.map +1 -0
  12. package/dist/{chunk-PZHBPGDE.js → chunk-34SAECKZ.js} +34 -10
  13. package/dist/chunk-34SAECKZ.js.map +1 -0
  14. package/dist/{chunk-EQZ2CCWC.js → chunk-3Y2EHT4F.js} +5 -2
  15. package/dist/chunk-3Y2EHT4F.js.map +1 -0
  16. package/dist/{chunk-FSYH7J75.js → chunk-3Y6BHIN6.js} +3 -3
  17. package/dist/{chunk-FZZWTDWP.js → chunk-3YPL6T3P.js} +6 -6
  18. package/dist/{chunk-JEZMWJEF.js → chunk-44MVIRZH.js} +4 -4
  19. package/dist/{chunk-27FIHFXF.js → chunk-45MMSBHA.js} +5 -5
  20. package/dist/{chunk-QXP3Z3JN.js → chunk-4MBCJFY4.js} +35 -3
  21. package/dist/chunk-4MBCJFY4.js.map +1 -0
  22. package/dist/chunk-4TPL54KW.js +227 -0
  23. package/dist/chunk-4TPL54KW.js.map +1 -0
  24. package/dist/{chunk-7JB6SYJX.js → chunk-54ELBTKE.js} +2 -2
  25. package/dist/{chunk-6J64MQFD.js → chunk-5F4OB5B3.js} +21 -15
  26. package/dist/chunk-5F4OB5B3.js.map +1 -0
  27. package/dist/{chunk-PYVQ74D5.js → chunk-5HN4KVQU.js} +189 -117
  28. package/dist/chunk-5HN4KVQU.js.map +1 -0
  29. package/dist/{chunk-VFKPIIV2.js → chunk-5J4E5GYI.js} +35 -32
  30. package/dist/chunk-5J4E5GYI.js.map +1 -0
  31. package/dist/chunk-5USBZ2MU.js +58 -0
  32. package/dist/chunk-5USBZ2MU.js.map +1 -0
  33. package/dist/chunk-64WOMNYR.js +183 -0
  34. package/dist/chunk-64WOMNYR.js.map +1 -0
  35. package/dist/{chunk-APWELUI7.js → chunk-65RS4LQS.js} +57 -43
  36. package/dist/chunk-65RS4LQS.js.map +1 -0
  37. package/dist/{chunk-HWZO6HYZ.js → chunk-6QMDUDF2.js} +3 -3
  38. package/dist/{chunk-FNBGRKS6.js → chunk-7V25UAQO.js} +2 -2
  39. package/dist/chunk-BGA4DO5M.js +719 -0
  40. package/dist/chunk-BGA4DO5M.js.map +1 -0
  41. package/dist/chunk-BVP7YK2J.js +706 -0
  42. package/dist/chunk-BVP7YK2J.js.map +1 -0
  43. package/dist/chunk-C265QIMJ.js +83 -0
  44. package/dist/chunk-C265QIMJ.js.map +1 -0
  45. package/dist/{chunk-MXN2ZEUB.js → chunk-D6M3ZK66.js} +2 -2
  46. package/dist/chunk-D6M3ZK66.js.map +1 -0
  47. package/dist/chunk-DJ36BM62.js +78 -0
  48. package/dist/chunk-DJ36BM62.js.map +1 -0
  49. package/dist/{chunk-JOKPBYXP.js → chunk-DTEWAVNE.js} +2 -2
  50. package/dist/chunk-F2KJAJ7T.js +13 -0
  51. package/dist/chunk-F2KJAJ7T.js.map +1 -0
  52. package/dist/{chunk-KAILF7QA.js → chunk-F43CV6UC.js} +2 -2
  53. package/dist/{chunk-ACO7ZCR2.js → chunk-FKVJKLPI.js} +2 -2
  54. package/dist/{chunk-43HLS2HM.js → chunk-FYFHH7V5.js} +54 -3
  55. package/dist/{chunk-43HLS2HM.js.map → chunk-FYFHH7V5.js.map} +1 -1
  56. package/dist/{chunk-2F5JUAHZ.js → chunk-GAJC4BQZ.js} +3 -3
  57. package/dist/{chunk-L7N73ZAW.js → chunk-HAZAN4UM.js} +2 -2
  58. package/dist/{chunk-6QJZA6EX.js → chunk-HI5XQOX2.js} +2 -2
  59. package/dist/{chunk-BOENA6XR.js → chunk-HKGUKAQW.js} +6 -6
  60. package/dist/{chunk-LJSCGIYH.js → chunk-HPRVFJPM.js} +2 -2
  61. package/dist/{chunk-OO6FIBL7.js → chunk-HZKANST2.js} +3 -6
  62. package/dist/chunk-HZKANST2.js.map +1 -0
  63. package/dist/{chunk-UVDJ5SSQ.js → chunk-I557SAOM.js} +8 -2
  64. package/dist/chunk-I557SAOM.js.map +1 -0
  65. package/dist/{chunk-SDUOJRSV.js → chunk-IGLWLH73.js} +3 -3
  66. package/dist/{chunk-3AKH7ODX.js → chunk-INSIW65E.js} +5 -5
  67. package/dist/{chunk-PNHNXUSL.js → chunk-IULCDMVG.js} +12 -1
  68. package/dist/chunk-IULCDMVG.js.map +1 -0
  69. package/dist/{chunk-JF4T4HCQ.js → chunk-IVNSUAVC.js} +10 -5
  70. package/dist/chunk-IVNSUAVC.js.map +1 -0
  71. package/dist/chunk-JDQZCREI.js +87 -0
  72. package/dist/chunk-JDQZCREI.js.map +1 -0
  73. package/dist/{chunk-2P3NJTHE.js → chunk-JHFFUVON.js} +23 -23
  74. package/dist/{chunk-7JVARP5R.js → chunk-JTILUN4W.js} +55 -29
  75. package/dist/{chunk-7JVARP5R.js.map → chunk-JTILUN4W.js.map} +1 -1
  76. package/dist/{chunk-2TO5F6CT.js → chunk-K5KNGC4I.js} +8 -8
  77. package/dist/{chunk-HUWTFKEM.js → chunk-KAQ4Q3TO.js} +3 -3
  78. package/dist/{chunk-E6VP6MQM.js → chunk-KGUE5AVX.js} +4 -4
  79. package/dist/chunk-KGUE5AVX.js.map +1 -0
  80. package/dist/{chunk-GS5RZF7U.js → chunk-KLDMLWXT.js} +2 -2
  81. package/dist/{chunk-HN2EN6P4.js → chunk-KNKDMTHU.js} +5 -5
  82. package/dist/chunk-LDA6TAYQ.js +95 -0
  83. package/dist/chunk-LDA6TAYQ.js.map +1 -0
  84. package/dist/chunk-LWSSIZOY.js +347 -0
  85. package/dist/chunk-LWSSIZOY.js.map +1 -0
  86. package/dist/{chunk-5VWQSCDO.js → chunk-MAHNZA6C.js} +89 -9
  87. package/dist/chunk-MAHNZA6C.js.map +1 -0
  88. package/dist/{chunk-46HAB26L.js → chunk-MEWZCIA6.js} +56 -9
  89. package/dist/chunk-MEWZCIA6.js.map +1 -0
  90. package/dist/{chunk-R2KMLONN.js → chunk-MJDO4EXD.js} +4 -4
  91. package/dist/{chunk-IHVUE3XF.js → chunk-NJA6NT3A.js} +3 -3
  92. package/dist/{chunk-TSIID2LV.js → chunk-ODRPASFP.js} +375 -1166
  93. package/dist/chunk-ODRPASFP.js.map +1 -0
  94. package/dist/{chunk-S3JKF3IK.js → chunk-OJJFANO6.js} +3 -3
  95. package/dist/{chunk-56SOPRM2.js → chunk-OQWPRFAC.js} +344 -4
  96. package/dist/chunk-OQWPRFAC.js.map +1 -0
  97. package/dist/{chunk-QEZZDIQT.js → chunk-P6YQWIT2.js} +4053 -4039
  98. package/dist/chunk-P6YQWIT2.js.map +1 -0
  99. package/dist/{chunk-GGGEGMWC.js → chunk-Q6RSJCXB.js} +9 -9
  100. package/dist/{chunk-OTIUEUIS.js → chunk-QKEUKBRK.js} +7 -7
  101. package/dist/{chunk-X52BVGCJ.js → chunk-QQDPRTLP.js} +5 -5
  102. package/dist/chunk-QQYCYAKI.js +79 -0
  103. package/dist/chunk-QQYCYAKI.js.map +1 -0
  104. package/dist/chunk-R4KDH477.js +1064 -0
  105. package/dist/chunk-R4KDH477.js.map +1 -0
  106. package/dist/{chunk-6AQSUBNR.js → chunk-RGCPELQN.js} +2 -2
  107. package/dist/{chunk-AXODGQ23.js → chunk-RGVCOG2S.js} +9 -2
  108. package/dist/{chunk-AXODGQ23.js.map → chunk-RGVCOG2S.js.map} +1 -1
  109. package/dist/chunk-SOLNJ3AZ.js +209 -0
  110. package/dist/chunk-SOLNJ3AZ.js.map +1 -0
  111. package/dist/{chunk-LQ33RLHL.js → chunk-TFT2X7SH.js} +3 -3
  112. package/dist/chunk-TVWCLUBI.js +293 -0
  113. package/dist/chunk-TVWCLUBI.js.map +1 -0
  114. package/dist/{chunk-VH7JMLTG.js → chunk-UIB33QQP.js} +25 -16
  115. package/dist/chunk-UIB33QQP.js.map +1 -0
  116. package/dist/chunk-V6GIVALQ.js +1889 -0
  117. package/dist/chunk-V6GIVALQ.js.map +1 -0
  118. package/dist/{chunk-IVHGQNIN.js → chunk-VHXCPXUS.js} +8 -8
  119. package/dist/{chunk-7DW7GAM6.js → chunk-VU6GMWF6.js} +2 -2
  120. package/dist/chunk-VWZYE3NC.js +8415 -0
  121. package/dist/chunk-VWZYE3NC.js.map +1 -0
  122. package/dist/{chunk-3X4GOMXT.js → chunk-W2GXIARJ.js} +12 -7
  123. package/dist/chunk-W2GXIARJ.js.map +1 -0
  124. package/dist/chunk-W4G3K3V7.js +288 -0
  125. package/dist/chunk-W4G3K3V7.js.map +1 -0
  126. package/dist/{chunk-FHXTEVO7.js → chunk-W74LJ5OT.js} +21 -28
  127. package/dist/chunk-W74LJ5OT.js.map +1 -0
  128. package/dist/{chunk-FOEPH67T.js → chunk-W7ELYLYK.js} +1 -74
  129. package/dist/chunk-W7ELYLYK.js.map +1 -0
  130. package/dist/{chunk-YU3DLVSQ.js → chunk-XSCGUO2U.js} +5 -5
  131. package/dist/{chunk-EPCIJLLU.js → chunk-XWROSMI5.js} +9 -9
  132. package/dist/{chunk-HMT6L65V.js → chunk-YJGEVBKZ.js} +4 -4
  133. package/dist/{chunk-7U3P4PB7.js → chunk-ZEYA2WWX.js} +4 -4
  134. package/dist/chunk-ZEYA2WWX.js.map +1 -0
  135. package/dist/chunk-ZRC7Z5X3.js +82 -0
  136. package/dist/chunk-ZRC7Z5X3.js.map +1 -0
  137. package/dist/{chunk-I47ARU5G.js → chunk-ZS7JIUJ3.js} +2 -2
  138. package/dist/{claude-cli-2YKABJJZ.js → claude-cli-GIIHOBGT.js} +4 -2
  139. package/dist/claude-install-BAUSJMW3.js +64 -0
  140. package/dist/{cli-BFDKEX53.js → cli-QY4KKA3D.js} +116 -49
  141. package/dist/cli-QY4KKA3D.js.map +1 -0
  142. package/dist/{client-XMWEKXX7.js → client-3YQKORVK.js} +4 -4
  143. package/dist/{codex-host-B6NAUWL6.js → codex-host-ZON3S6HU.js} +5 -5
  144. package/dist/{codex-install-GTGO5FYN.js → codex-install-HZV2DOAB.js} +62 -47
  145. package/dist/codex-install-HZV2DOAB.js.map +1 -0
  146. package/dist/{config-THJANIU5.js → config-QZOBMTEL.js} +18 -18
  147. package/dist/{config-names-JU54HYWY.js → config-names-Z5NZD5R2.js} +18 -18
  148. package/dist/{config-rules-VNU23RL4.js → config-rules-YOYHS6YL.js} +19 -19
  149. package/dist/config-subagents-WQV2ZAD5.js +362 -0
  150. package/dist/config-subagents-WQV2ZAD5.js.map +1 -0
  151. package/dist/{connect-HPWS7U63.js → connect-YDWTYU4B.js} +28 -27
  152. package/dist/{connect-HPWS7U63.js.map → connect-YDWTYU4B.js.map} +1 -1
  153. package/dist/core-0a66n3e7-TTP554XV.js +127 -0
  154. package/dist/core-0a66n3e7-TTP554XV.js.map +1 -0
  155. package/dist/core-0bmnpbz2-C2JIRVZO.js +10790 -0
  156. package/dist/core-0bmnpbz2-C2JIRVZO.js.map +1 -0
  157. package/dist/core-9je8ee1j-74DGHWPV.js +30 -0
  158. package/dist/core-9je8ee1j-74DGHWPV.js.map +1 -0
  159. package/dist/core-wadgcjfh-TSZFQZGH.js +666 -0
  160. package/dist/core-wadgcjfh-TSZFQZGH.js.map +1 -0
  161. package/dist/core-zg882d22-LKV5DZYW.js +37 -0
  162. package/dist/core-zg882d22-LKV5DZYW.js.map +1 -0
  163. package/dist/{decision-JIIHDTOF.js → decision-QSKHOGCO.js} +6 -6
  164. package/dist/{doctor-4MMHBRDU.js → doctor-ZWJXRD75.js} +67 -66
  165. package/dist/doctor-ZWJXRD75.js.map +1 -0
  166. package/dist/{explicit-AGENAX6E.js → explicit-ME2NRADQ.js} +45 -42
  167. package/dist/{explicit-AGENAX6E.js.map → explicit-ME2NRADQ.js.map} +1 -1
  168. package/dist/flush-stdio-NYIJ3QXT.js +18 -0
  169. package/dist/{fund-MLXUH24Q.js → fund-VF7TLDJH.js} +110 -34
  170. package/dist/fund-VF7TLDJH.js.map +1 -0
  171. package/dist/{hook-command-UB7FOEUL.js → hook-command-VZ27MGWO.js} +21 -20
  172. package/dist/hosts/claude/.claude-plugin/marketplace.json +2 -2
  173. package/dist/hosts/claude/tenjin/.claude-plugin/plugin.json +2 -2
  174. package/dist/hosts/claude/tenjin/hooks/hook-data.ts +152 -0
  175. package/dist/hosts/claude/tenjin/hooks/hooks.json +7 -0
  176. package/dist/hosts/claude/tenjin/hooks/model-viewer.tsx +2987 -0
  177. package/dist/hosts/claude/tenjin/hooks/register.tsx +265 -30
  178. package/dist/hosts/claude/tenjin/skills/tenjin-pay/SKILL.md +14 -4
  179. package/dist/hosts/claude/tenjin/types/index.d.ts +133 -0
  180. package/dist/{hosts-WNQKYKP2.js → hosts-3EMTVM4H.js} +5 -3
  181. package/dist/index.js +16 -13
  182. package/dist/index.js.map +1 -1
  183. package/dist/{install-Q5SHHEDH.js → install-ZA7L2UF3.js} +34 -30
  184. package/dist/{install-funding-EGSW2KEP.js → install-funding-JDGYTF72.js} +9 -13
  185. package/dist/{install-identity-OID43B4D.js → install-identity-FFAYEFLX.js} +8 -8
  186. package/dist/{install-wallet-TZFWY5GK.js → install-wallet-2SFOVE3Q.js} +48 -33
  187. package/dist/{install-wallet-TZFWY5GK.js.map → install-wallet-2SFOVE3Q.js.map} +1 -1
  188. package/dist/mcp-36S6MK3C.js +67642 -0
  189. package/dist/mcp-36S6MK3C.js.map +1 -0
  190. package/dist/new-install-5L4GY3LN.js +51 -0
  191. package/dist/{package-NRHU7HBR.js → package-BONDXSV3.js} +2 -2
  192. package/dist/{passphrase-3JEVW5XG.js → passphrase-T4ULBN4M.js} +4 -4
  193. package/dist/{pay-I47AIUQR.js → pay-CMV5KL74.js} +37 -30
  194. package/dist/{payments-A5FNI5GN.js → payments-Z6UBZL4Z.js} +10 -10
  195. package/dist/reclaim-subagent-credit-ABSF67SJ.js +105 -0
  196. package/dist/reclaim-subagent-credit-ABSF67SJ.js.map +1 -0
  197. package/dist/{routing-quote-QQW2I5MH.js → routing-quote-AHLAREXR.js} +16 -18
  198. package/dist/{run-4SHEOBIU.js → run-JH7ELYAM.js} +41 -38
  199. package/dist/{runtime-BABJMHY7.js → runtime-2GX4ALJP.js} +12 -12
  200. package/dist/{runtime-activate-N6VLQI2C.js → runtime-activate-IDQ2NCSP.js} +9 -9
  201. package/dist/{runtime-launchers-GMAUICRW.js → runtime-launchers-YAPKCBHV.js} +7 -7
  202. package/dist/{runtime-place-DOEWFTF3.js → runtime-place-4POL4KK4.js} +3 -3
  203. package/dist/{send-ECXS6JEO.js → send-ELXFKEKY.js} +17 -17
  204. package/dist/{status-AHE5HSR7.js → status-FXUFWJDM.js} +89 -36
  205. package/dist/status-FXUFWJDM.js.map +1 -0
  206. package/dist/{status-line-63XFJAXR.js → status-line-IH5JBWBC.js} +11 -11
  207. package/dist/{streamableHttp-Z3YF6LTQ.js → streamableHttp-CP2ZQBIK.js} +4 -4
  208. package/dist/{uninstall-YGQPRCVY.js → uninstall-LJZUKM4D.js} +42 -38
  209. package/dist/{uninstall-YGQPRCVY.js.map → uninstall-LJZUKM4D.js.map} +1 -1
  210. package/dist/{update-GTLMLFA3.js → update-EUIX72IX.js} +34 -30
  211. package/dist/{usage-FCWP2CHO.js → usage-EKDC7LUC.js} +13 -13
  212. package/dist/{usdc-25RNBYYR.js → usdc-YIHK2OMC.js} +5 -5
  213. package/dist/{viemAdapter-By13KInL-3CG63XDX.js → viemAdapter-By13KInL-PRLSIESK.js} +2 -2
  214. package/dist/viemAdapter-By13KInL-PRLSIESK.js.map +1 -0
  215. package/dist/wallet-HSW757W6.js +80 -0
  216. package/dist/wallet-HSW757W6.js.map +1 -0
  217. package/docs/agent-permissions.md +19 -11
  218. package/docs/router-reference.md +21 -12
  219. package/docs/safety-model.md +4 -2
  220. package/docs/subagents-internals.md +97 -0
  221. package/docs/subagents.md +348 -0
  222. package/package.json +4 -1
  223. package/dist/balance-RQW5T5FB.js +0 -55
  224. package/dist/chunk-3X4GOMXT.js.map +0 -1
  225. package/dist/chunk-46HAB26L.js.map +0 -1
  226. package/dist/chunk-56SOPRM2.js.map +0 -1
  227. package/dist/chunk-5VWQSCDO.js.map +0 -1
  228. package/dist/chunk-6J64MQFD.js.map +0 -1
  229. package/dist/chunk-7U3P4PB7.js.map +0 -1
  230. package/dist/chunk-APWELUI7.js.map +0 -1
  231. package/dist/chunk-E6VP6MQM.js.map +0 -1
  232. package/dist/chunk-EQZ2CCWC.js.map +0 -1
  233. package/dist/chunk-FHXTEVO7.js.map +0 -1
  234. package/dist/chunk-FOEPH67T.js.map +0 -1
  235. package/dist/chunk-IVXPIIZJ.js +0 -91
  236. package/dist/chunk-IVXPIIZJ.js.map +0 -1
  237. package/dist/chunk-JF4T4HCQ.js.map +0 -1
  238. package/dist/chunk-LPQNZKSG.js +0 -269
  239. package/dist/chunk-LPQNZKSG.js.map +0 -1
  240. package/dist/chunk-MXN2ZEUB.js.map +0 -1
  241. package/dist/chunk-OO6FIBL7.js.map +0 -1
  242. package/dist/chunk-PNHNXUSL.js.map +0 -1
  243. package/dist/chunk-PYVQ74D5.js.map +0 -1
  244. package/dist/chunk-PZHBPGDE.js.map +0 -1
  245. package/dist/chunk-QEZZDIQT.js.map +0 -1
  246. package/dist/chunk-QXP3Z3JN.js.map +0 -1
  247. package/dist/chunk-RJ5HRPAZ.js.map +0 -1
  248. package/dist/chunk-TSIID2LV.js.map +0 -1
  249. package/dist/chunk-UVDJ5SSQ.js.map +0 -1
  250. package/dist/chunk-VFKPIIV2.js.map +0 -1
  251. package/dist/chunk-VH7JMLTG.js.map +0 -1
  252. package/dist/claude-install-7CVYQ73E.js +0 -60
  253. package/dist/cli-BFDKEX53.js.map +0 -1
  254. package/dist/codex-install-GTGO5FYN.js.map +0 -1
  255. package/dist/doctor-4MMHBRDU.js.map +0 -1
  256. package/dist/fund-MLXUH24Q.js.map +0 -1
  257. package/dist/mcp-CC3H7LFO.js +0 -3655
  258. package/dist/mcp-CC3H7LFO.js.map +0 -1
  259. package/dist/status-AHE5HSR7.js.map +0 -1
  260. package/dist/wallet-CJGEHP2Q.js +0 -64
  261. /package/dist/{_esm-MMYV66AX.js.map → _esm-2KST7HQ7.js.map} +0 -0
  262. /package/dist/{alive-VOIL5W3I.js.map → alive-5TV22PNF.js.map} +0 -0
  263. /package/dist/{auth-UHD3QFX4.js.map → auth-XI7BJFLW.js.map} +0 -0
  264. /package/dist/{balance-RQW5T5FB.js.map → balance-DFHC6XEU.js.map} +0 -0
  265. /package/dist/{ccip-CS7K5QRQ.js.map → ccip-HOW3DZYF.js.map} +0 -0
  266. /package/dist/{chunk-FSYH7J75.js.map → chunk-3Y6BHIN6.js.map} +0 -0
  267. /package/dist/{chunk-FZZWTDWP.js.map → chunk-3YPL6T3P.js.map} +0 -0
  268. /package/dist/{chunk-JEZMWJEF.js.map → chunk-44MVIRZH.js.map} +0 -0
  269. /package/dist/{chunk-27FIHFXF.js.map → chunk-45MMSBHA.js.map} +0 -0
  270. /package/dist/{chunk-7JB6SYJX.js.map → chunk-54ELBTKE.js.map} +0 -0
  271. /package/dist/{chunk-HWZO6HYZ.js.map → chunk-6QMDUDF2.js.map} +0 -0
  272. /package/dist/{chunk-FNBGRKS6.js.map → chunk-7V25UAQO.js.map} +0 -0
  273. /package/dist/{chunk-JOKPBYXP.js.map → chunk-DTEWAVNE.js.map} +0 -0
  274. /package/dist/{chunk-KAILF7QA.js.map → chunk-F43CV6UC.js.map} +0 -0
  275. /package/dist/{chunk-ACO7ZCR2.js.map → chunk-FKVJKLPI.js.map} +0 -0
  276. /package/dist/{chunk-2F5JUAHZ.js.map → chunk-GAJC4BQZ.js.map} +0 -0
  277. /package/dist/{chunk-L7N73ZAW.js.map → chunk-HAZAN4UM.js.map} +0 -0
  278. /package/dist/{chunk-6QJZA6EX.js.map → chunk-HI5XQOX2.js.map} +0 -0
  279. /package/dist/{chunk-BOENA6XR.js.map → chunk-HKGUKAQW.js.map} +0 -0
  280. /package/dist/{chunk-LJSCGIYH.js.map → chunk-HPRVFJPM.js.map} +0 -0
  281. /package/dist/{chunk-SDUOJRSV.js.map → chunk-IGLWLH73.js.map} +0 -0
  282. /package/dist/{chunk-3AKH7ODX.js.map → chunk-INSIW65E.js.map} +0 -0
  283. /package/dist/{chunk-2P3NJTHE.js.map → chunk-JHFFUVON.js.map} +0 -0
  284. /package/dist/{chunk-2TO5F6CT.js.map → chunk-K5KNGC4I.js.map} +0 -0
  285. /package/dist/{chunk-HUWTFKEM.js.map → chunk-KAQ4Q3TO.js.map} +0 -0
  286. /package/dist/{chunk-GS5RZF7U.js.map → chunk-KLDMLWXT.js.map} +0 -0
  287. /package/dist/{chunk-HN2EN6P4.js.map → chunk-KNKDMTHU.js.map} +0 -0
  288. /package/dist/{chunk-R2KMLONN.js.map → chunk-MJDO4EXD.js.map} +0 -0
  289. /package/dist/{chunk-IHVUE3XF.js.map → chunk-NJA6NT3A.js.map} +0 -0
  290. /package/dist/{chunk-S3JKF3IK.js.map → chunk-OJJFANO6.js.map} +0 -0
  291. /package/dist/{chunk-GGGEGMWC.js.map → chunk-Q6RSJCXB.js.map} +0 -0
  292. /package/dist/{chunk-OTIUEUIS.js.map → chunk-QKEUKBRK.js.map} +0 -0
  293. /package/dist/{chunk-X52BVGCJ.js.map → chunk-QQDPRTLP.js.map} +0 -0
  294. /package/dist/{chunk-6AQSUBNR.js.map → chunk-RGCPELQN.js.map} +0 -0
  295. /package/dist/{chunk-LQ33RLHL.js.map → chunk-TFT2X7SH.js.map} +0 -0
  296. /package/dist/{chunk-IVHGQNIN.js.map → chunk-VHXCPXUS.js.map} +0 -0
  297. /package/dist/{chunk-7DW7GAM6.js.map → chunk-VU6GMWF6.js.map} +0 -0
  298. /package/dist/{chunk-YU3DLVSQ.js.map → chunk-XSCGUO2U.js.map} +0 -0
  299. /package/dist/{chunk-EPCIJLLU.js.map → chunk-XWROSMI5.js.map} +0 -0
  300. /package/dist/{chunk-HMT6L65V.js.map → chunk-YJGEVBKZ.js.map} +0 -0
  301. /package/dist/{chunk-I47ARU5G.js.map → chunk-ZS7JIUJ3.js.map} +0 -0
  302. /package/dist/{claude-cli-2YKABJJZ.js.map → claude-cli-GIIHOBGT.js.map} +0 -0
  303. /package/dist/{claude-install-7CVYQ73E.js.map → claude-install-BAUSJMW3.js.map} +0 -0
  304. /package/dist/{client-XMWEKXX7.js.map → client-3YQKORVK.js.map} +0 -0
  305. /package/dist/{codex-host-B6NAUWL6.js.map → codex-host-ZON3S6HU.js.map} +0 -0
  306. /package/dist/{config-THJANIU5.js.map → config-QZOBMTEL.js.map} +0 -0
  307. /package/dist/{config-names-JU54HYWY.js.map → config-names-Z5NZD5R2.js.map} +0 -0
  308. /package/dist/{config-rules-VNU23RL4.js.map → config-rules-YOYHS6YL.js.map} +0 -0
  309. /package/dist/{decision-JIIHDTOF.js.map → decision-QSKHOGCO.js.map} +0 -0
  310. /package/dist/{hook-command-UB7FOEUL.js.map → flush-stdio-NYIJ3QXT.js.map} +0 -0
  311. /package/dist/{hosts-WNQKYKP2.js.map → hook-command-VZ27MGWO.js.map} +0 -0
  312. /package/dist/{install-Q5SHHEDH.js.map → hosts-3EMTVM4H.js.map} +0 -0
  313. /package/dist/{install-funding-EGSW2KEP.js.map → install-ZA7L2UF3.js.map} +0 -0
  314. /package/dist/{install-identity-OID43B4D.js.map → install-funding-JDGYTF72.js.map} +0 -0
  315. /package/dist/{package-NRHU7HBR.js.map → install-identity-FFAYEFLX.js.map} +0 -0
  316. /package/dist/{passphrase-3JEVW5XG.js.map → new-install-5L4GY3LN.js.map} +0 -0
  317. /package/dist/{pay-I47AIUQR.js.map → package-BONDXSV3.js.map} +0 -0
  318. /package/dist/{routing-quote-QQW2I5MH.js.map → passphrase-T4ULBN4M.js.map} +0 -0
  319. /package/dist/{run-4SHEOBIU.js.map → pay-CMV5KL74.js.map} +0 -0
  320. /package/dist/{payments-A5FNI5GN.js.map → payments-Z6UBZL4Z.js.map} +0 -0
  321. /package/dist/{runtime-activate-N6VLQI2C.js.map → routing-quote-AHLAREXR.js.map} +0 -0
  322. /package/dist/{runtime-launchers-GMAUICRW.js.map → run-JH7ELYAM.js.map} +0 -0
  323. /package/dist/{runtime-BABJMHY7.js.map → runtime-2GX4ALJP.js.map} +0 -0
  324. /package/dist/{runtime-place-DOEWFTF3.js.map → runtime-activate-IDQ2NCSP.js.map} +0 -0
  325. /package/dist/{update-GTLMLFA3.js.map → runtime-launchers-YAPKCBHV.js.map} +0 -0
  326. /package/dist/{usdc-25RNBYYR.js.map → runtime-place-4POL4KK4.js.map} +0 -0
  327. /package/dist/{send-ECXS6JEO.js.map → send-ELXFKEKY.js.map} +0 -0
  328. /package/dist/{status-line-63XFJAXR.js.map → status-line-IH5JBWBC.js.map} +0 -0
  329. /package/dist/{streamableHttp-Z3YF6LTQ.js.map → streamableHttp-CP2ZQBIK.js.map} +0 -0
  330. /package/dist/{viemAdapter-By13KInL-3CG63XDX.js.map → update-EUIX72IX.js.map} +0 -0
  331. /package/dist/{usage-FCWP2CHO.js.map → usage-EKDC7LUC.js.map} +0 -0
  332. /package/dist/{wallet-CJGEHP2Q.js.map → usdc-YIHK2OMC.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
2
  import {
3
3
  createLocalSpendAuthorizer
4
- } from "./chunk-43HLS2HM.js";
4
+ } from "./chunk-FYFHH7V5.js";
5
5
  import {
6
6
  STORE_TIMEOUTS,
7
7
  describeStoreLocation,
@@ -12,7 +12,7 @@ import {
12
12
  toStoreOutcome,
13
13
  unstorableWhy,
14
14
  walletStoreAccount
15
- } from "./chunk-6QJZA6EX.js";
15
+ } from "./chunk-HI5XQOX2.js";
16
16
  import {
17
17
  storeNoun
18
18
  } from "./chunk-XRGFH7FI.js";
@@ -24,7 +24,7 @@ import {
24
24
  publicKeyToAddress,
25
25
  serializeSignature,
26
26
  serializeTransaction
27
- } from "./chunk-FNBGRKS6.js";
27
+ } from "./chunk-7V25UAQO.js";
28
28
  import {
29
29
  hmac,
30
30
  secp256k1,
@@ -44,7 +44,7 @@ import {
44
44
  slice2 as slice,
45
45
  toHex,
46
46
  toHex2
47
- } from "./chunk-3AKH7ODX.js";
47
+ } from "./chunk-INSIW65E.js";
48
48
  import {
49
49
  ahash,
50
50
  anumber,
@@ -60,13 +60,13 @@ import {
60
60
  import {
61
61
  readPassphraseRecord,
62
62
  writePassphraseRecord
63
- } from "./chunk-I47ARU5G.js";
63
+ } from "./chunk-ZS7JIUJ3.js";
64
64
  import {
65
65
  ADDRESS_RE
66
66
  } from "./chunk-JWAK7JQB.js";
67
67
  import {
68
68
  emitNotice
69
- } from "./chunk-GS5RZF7U.js";
69
+ } from "./chunk-KLDMLWXT.js";
70
70
  import {
71
71
  ENV_PASSPHRASE_WRONG,
72
72
  FILE_STORE_FAILED_FIX,
@@ -92,7 +92,7 @@ import {
92
92
  } from "./chunk-JTX3BUDK.js";
93
93
  import {
94
94
  external_exports
95
- } from "./chunk-QEZZDIQT.js";
95
+ } from "./chunk-P6YQWIT2.js";
96
96
  import {
97
97
  CliError
98
98
  } from "./chunk-DI4QAGRZ.js";
@@ -1709,4 +1709,4 @@ export {
1709
1709
  @noble/ciphers/esm/utils.js:
1710
1710
  (*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) *)
1711
1711
  */
1712
- //# sourceMappingURL=chunk-2TO5F6CT.js.map
1712
+ //# sourceMappingURL=chunk-K5KNGC4I.js.map
@@ -1,12 +1,12 @@
1
1
  import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
2
  import {
3
3
  packageRootOf
4
- } from "./chunk-R2KMLONN.js";
4
+ } from "./chunk-MJDO4EXD.js";
5
5
  import {
6
6
  LAUNCHER_MARKER,
7
7
  renderLauncherCmd,
8
8
  renderLauncherSh
9
- } from "./chunk-PZHBPGDE.js";
9
+ } from "./chunk-34SAECKZ.js";
10
10
  import {
11
11
  writeFileAtomic
12
12
  } from "./chunk-7WEQQJLG.js";
@@ -132,4 +132,4 @@ export {
132
132
  writeLaunchers,
133
133
  removeLaunchers
134
134
  };
135
- //# sourceMappingURL=chunk-HUWTFKEM.js.map
135
+ //# sourceMappingURL=chunk-KAQ4Q3TO.js.map
@@ -1,14 +1,14 @@
1
1
  import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
2
  import {
3
3
  usd
4
- } from "./chunk-OO6FIBL7.js";
4
+ } from "./chunk-HZKANST2.js";
5
5
  import {
6
6
  toMoney
7
7
  } from "./chunk-MEZJ3I63.js";
8
8
  import {
9
9
  DEFAULT_MAX_AUTO_SPEND,
10
10
  DEFAULT_SESSION_BUDGET
11
- } from "./chunk-VH7JMLTG.js";
11
+ } from "./chunk-UIB33QQP.js";
12
12
 
13
13
  // src/router/spend-question.ts
14
14
  var ROUTER_DEFAULTS = {
@@ -48,7 +48,7 @@ function spendOptions(install) {
48
48
  recommended: false,
49
49
  ask: [
50
50
  "Daily budget shared across chats, in USD, or none for no limit",
51
- "The most it may pay for one call, in USD, at least 0.25"
51
+ "Ordinary-tool per-call limit in USD. DeepSeek inference uses its separate job ceiling. Zero blocks positive automatic payments."
52
52
  ],
53
53
  command: `${install} --max-auto-spend <usd> --session-budget <usd|none>`
54
54
  }
@@ -66,4 +66,4 @@ export {
66
66
  spendChoiceQuestion,
67
67
  spendOptions
68
68
  };
69
- //# sourceMappingURL=chunk-E6VP6MQM.js.map
69
+ //# sourceMappingURL=chunk-KGUE5AVX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/router/spend-question.ts"],"sourcesContent":["import { DEFAULT_MAX_AUTO_SPEND, DEFAULT_SESSION_BUDGET } from '../lib/config';\nimport { toMoney } from '../lib/money';\nimport { usd } from './fee';\n\n/**\n * THE SPEND QUESTION, ONE TEXT FOR EVERY PLACE THAT ASKS IT: how much the\n * agent may spend, the defaults or your own limits. The selector in a terminal and the question an install\n * that could not ask hands to its agent show the same words, so the agent puts\n * to the person exactly what the selector would have. The defaults hold\n * whether or not anyone answers.\n */\n\n/** The automatic router defaults, in atomic USDC: $1 a call, $5 a day. */\nexport const ROUTER_DEFAULTS = {\n maxAutoSpend: DEFAULT_MAX_AUTO_SPEND,\n sessionBudget: DEFAULT_SESSION_BUDGET,\n} as const;\n\n/** The automatic limits install writes, in atomic USDC; `sessionBudget` may be `none`. */\nexport interface RouterLimits {\n maxAutoSpend: string;\n sessionBudget: string;\n}\n\n/** The file's own value where it names one, else the default. */\nexport function shownLimits(config: {\n maxAutoSpend?: string | undefined;\n sessionBudget?: string | undefined;\n}): RouterLimits {\n return {\n maxAutoSpend: config.maxAutoSpend ?? ROUTER_DEFAULTS.maxAutoSpend,\n sessionBudget: config.sessionBudget ?? ROUTER_DEFAULTS.sessionBudget,\n };\n}\n\n/** `$1.00 a call · $5.00 a day`: the limits a policy holds, as a person reads them. */\nexport function limitsLine(policy: {\n maxAutoSpendAtomic: bigint;\n sessionBudgetAtomic: bigint | null;\n}): string {\n const daily =\n policy.sessionBudgetAtomic === null\n ? 'no daily limit'\n : `$${usd(policy.sessionBudgetAtomic)} a day`;\n return `$${usd(policy.maxAutoSpendAtomic)} a call · ${daily}`;\n}\n\n/** The limits in USD. */\nexport function limitsUsd(limits: RouterLimits): { maxAutoSpend: string; sessionBudget: string } {\n return {\n maxAutoSpend: toMoney(limits.maxAutoSpend).usd,\n sessionBudget: limits.sessionBudget === 'none' ? 'none' : toMoney(limits.sessionBudget).usd,\n };\n}\n\n/** The fee terms approved with either spending-limit choice. */\nexport const ROUTING_FEE_TERMS =\n 'Tenjin charges 15% of the estimated tool cost for paid recommendations. Tool use is billed separately. Routing top-ups count toward your limits.';\n\n/** The selector's own line: either answer approves the fee. */\nexport const FEE_APPROVAL = 'Either choice approves this.';\n\nconst DEFAULTS_USD = limitsUsd(ROUTER_DEFAULTS);\n\n/** The question, for the agent to put to the person as written. */\nexport const SPEND_QUESTION = 'How much can your agent spend from its balance?';\n\n/** The recommended answer: the defaults, as amounts. */\nexport const DEFAULTS_LABEL = `Up to $${DEFAULTS_USD.maxAutoSpend} a call and $${DEFAULTS_USD.sessionBudget} a day`;\n\n/** The question with the fee terms either answer approves. */\nexport function spendChoiceQuestion(): string {\n return `${SPEND_QUESTION} ${ROUTING_FEE_TERMS} ${FEE_APPROVAL}`;\n}\n\n/** One answer to {@link spendChoiceQuestion}, and the one command that applies it. */\nexport interface SpendOption {\n id: 'default' | 'custom';\n label: string;\n recommended: boolean;\n /** What to ask the person after they pick this option, before running `command`. */\n ask?: string[];\n /** The command the agent runs alone for this answer. */\n command: string;\n}\n\n/**\n * The two answers, each applied by the agent with one command and never by\n * the person: `install` is the install that was run (its `--project` and\n * `--no-wallet` kept), so the answer leaves every other choice as it was.\n */\nexport function spendOptions(install: string): SpendOption[] {\n return [\n { id: 'default', label: DEFAULTS_LABEL, recommended: true, command: `${install} --yes` },\n {\n id: 'custom',\n label: 'Set my own limits',\n recommended: false,\n ask: [\n 'Daily budget shared across chats, in USD, or none for no limit',\n 'Ordinary-tool per-call limit in USD. DeepSeek inference uses its separate job ceiling. Zero blocks positive automatic payments.',\n ],\n command: `${install} --max-auto-spend <usd> --session-budget <usd|none>`,\n },\n ];\n}\n"],"mappings":";;;;;;;;;;;;;AAaO,IAAM,kBAAkB;AAAA,EAC7B,cAAc;AAAA,EACd,eAAe;AACjB;AASO,SAAS,YAAY,QAGX;AACf,SAAO;AAAA,IACL,cAAc,OAAO,gBAAgB,gBAAgB;AAAA,IACrD,eAAe,OAAO,iBAAiB,gBAAgB;AAAA,EACzD;AACF;AAGO,SAAS,WAAW,QAGhB;AACT,QAAM,QACJ,OAAO,wBAAwB,OAC3B,mBACA,IAAI,IAAI,OAAO,mBAAmB,CAAC;AACzC,SAAO,IAAI,IAAI,OAAO,kBAAkB,CAAC,gBAAa,KAAK;AAC7D;AAGO,SAAS,UAAU,QAAuE;AAC/F,SAAO;AAAA,IACL,cAAc,QAAQ,OAAO,YAAY,EAAE;AAAA,IAC3C,eAAe,OAAO,kBAAkB,SAAS,SAAS,QAAQ,OAAO,aAAa,EAAE;AAAA,EAC1F;AACF;AAGO,IAAM,oBACX;AAGK,IAAM,eAAe;AAE5B,IAAM,eAAe,UAAU,eAAe;AAGvC,IAAM,iBAAiB;AAGvB,IAAM,iBAAiB,UAAU,aAAa,YAAY,gBAAgB,aAAa,aAAa;AAGpG,SAAS,sBAA8B;AAC5C,SAAO,GAAG,cAAc,IAAI,iBAAiB,IAAI,YAAY;AAC/D;AAkBO,SAAS,aAAa,SAAgC;AAC3D,SAAO;AAAA,IACL,EAAE,IAAI,WAAW,OAAO,gBAAgB,aAAa,MAAM,SAAS,GAAG,OAAO,SAAS;AAAA,IACvF;AAAA,MACE,IAAI;AAAA,MACJ,OAAO;AAAA,MACP,aAAa;AAAA,MACb,KAAK;AAAA,QACH;AAAA,QACA;AAAA,MACF;AAAA,MACA,SAAS,GAAG,OAAO;AAAA,IACrB;AAAA,EACF;AACF;","names":[]}
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
2
  import {
3
3
  external_exports
4
- } from "./chunk-QEZZDIQT.js";
4
+ } from "./chunk-P6YQWIT2.js";
5
5
  import {
6
6
  CliError
7
7
  } from "./chunk-DI4QAGRZ.js";
@@ -162,4 +162,4 @@ export {
162
162
  style,
163
163
  paint
164
164
  };
165
- //# sourceMappingURL=chunk-GS5RZF7U.js.map
165
+ //# sourceMappingURL=chunk-KLDMLWXT.js.map
@@ -5,20 +5,20 @@ import {
5
5
  servicesNaming,
6
6
  speedTasks,
7
7
  tasksOf
8
- } from "./chunk-FSYH7J75.js";
8
+ } from "./chunk-3Y6BHIN6.js";
9
9
  import {
10
10
  pidAlive,
11
11
  readObservations
12
- } from "./chunk-L7N73ZAW.js";
12
+ } from "./chunk-HAZAN4UM.js";
13
13
  import {
14
14
  formatUsdDisplay
15
15
  } from "./chunk-MEZJ3I63.js";
16
16
  import {
17
17
  SETTING_SCOPES
18
- } from "./chunk-VH7JMLTG.js";
18
+ } from "./chunk-UIB33QQP.js";
19
19
  import {
20
20
  BUILT_IN_SOURCE
21
- } from "./chunk-6AQSUBNR.js";
21
+ } from "./chunk-RGCPELQN.js";
22
22
 
23
23
  // src/commands/config-readback.ts
24
24
  var SAVED_HERE = "Saved on this machine; not synced.";
@@ -450,4 +450,4 @@ export {
450
450
  POLICY_INVALID_TEXT,
451
451
  settingsReadback
452
452
  };
453
- //# sourceMappingURL=chunk-HN2EN6P4.js.map
453
+ //# sourceMappingURL=chunk-KNKDMTHU.js.map
@@ -0,0 +1,95 @@
1
+ import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
+ import {
3
+ routerSettings
4
+ } from "./chunk-W2GXIARJ.js";
5
+ import {
6
+ loadRawConfig,
7
+ resolveSettings
8
+ } from "./chunk-UIB33QQP.js";
9
+ import {
10
+ external_exports
11
+ } from "./chunk-P6YQWIT2.js";
12
+
13
+ // src/router/model-settings.ts
14
+ import { realpathSync } from "node:fs";
15
+ import { realpath } from "node:fs/promises";
16
+ import { isAbsolute, sep } from "node:path";
17
+ var RECIPIENTS = ["Tenjin", "DeepSeek", "Exa"];
18
+ var modelConsentSchema = external_exports.object({
19
+ version: external_exports.literal(2),
20
+ routerOrigin: external_exports.url(),
21
+ instructions: external_exports.literal("applicable"),
22
+ /** A worker reads the person's global Claude Code folder, session transcripts included. */
23
+ reads: external_exports.literal("claude-home"),
24
+ recipients: external_exports.tuple([external_exports.literal("Tenjin"), external_exports.literal("DeepSeek"), external_exports.literal("Exa")]),
25
+ /** The limited scope: only sessions inside these directories, whose workers get all of them. */
26
+ repositories: external_exports.array(external_exports.string()).min(1).optional(),
27
+ /** A ceiling named with `--max-job`. Absent, a job's cap is the per-call spend limit. */
28
+ maxJobAtomic: external_exports.string().regex(/^\d+$/).optional()
29
+ });
30
+ function perCallLimitAtomic(config) {
31
+ return BigInt(resolveSettings({ config, flags: {}, env: process.env }).maxAutoSpend.value);
32
+ }
33
+ function jobCapAtomic(named, perCall) {
34
+ return named !== void 0 && BigInt(named) < perCall ? BigInt(named) : perCall;
35
+ }
36
+ function namedDirectories(consent, routerOrigin) {
37
+ const parsed = modelConsentSchema.safeParse(consent);
38
+ if (!parsed.success || parsed.data.repositories === void 0) return null;
39
+ if (routerOrigin !== void 0 && parsed.data.routerOrigin !== routerOrigin) return null;
40
+ return parsed.data.repositories.flatMap((path) => {
41
+ if (!isAbsolute(path)) return [];
42
+ try {
43
+ return [realpathSync(path)];
44
+ } catch {
45
+ return [];
46
+ }
47
+ });
48
+ }
49
+ function modelConsent(options) {
50
+ return modelConsentSchema.parse({
51
+ version: 2,
52
+ instructions: "applicable",
53
+ reads: "claude-home",
54
+ recipients: [...RECIPIENTS],
55
+ routerOrigin: options.routerOrigin,
56
+ ...options.repositories?.length ? { repositories: [...new Set(options.repositories)] } : {},
57
+ ...options.maxJobAtomic === void 0 ? {} : { maxJobAtomic: options.maxJobAtomic }
58
+ });
59
+ }
60
+ function disclosureCovers(repositories, path) {
61
+ return repositories.some(
62
+ (root) => path === root || path.startsWith(root.endsWith(sep) ? root : `${root}${sep}`)
63
+ );
64
+ }
65
+ async function modelSettings(dataDir, cwd) {
66
+ const config = await loadRawConfig(dataDir);
67
+ const settings = await routerSettings({ cwd, dataDir, config });
68
+ const block = config.router;
69
+ const parsed = modelConsentSchema.safeParse(block?.subagentConsent);
70
+ if (!settings.enabled.value || !settings.subagents.value || block?.subagents !== true || !parsed.success)
71
+ return null;
72
+ const root = await realpath(cwd).catch(() => null);
73
+ if (!root) return null;
74
+ const named = namedDirectories(parsed.data);
75
+ if (named && !disclosureCovers(named, root)) return null;
76
+ return {
77
+ version: parsed.data.version,
78
+ scope: named ? "repositories" : "native-workspace",
79
+ root,
80
+ repositories: named ?? [root],
81
+ maxJobAtomic: jobCapAtomic(parsed.data.maxJobAtomic, perCallLimitAtomic(config)),
82
+ routerOrigin: parsed.data.routerOrigin,
83
+ context: settings.context.value
84
+ };
85
+ }
86
+
87
+ export {
88
+ modelConsentSchema,
89
+ perCallLimitAtomic,
90
+ namedDirectories,
91
+ modelConsent,
92
+ disclosureCovers,
93
+ modelSettings
94
+ };
95
+ //# sourceMappingURL=chunk-LDA6TAYQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/router/model-settings.ts"],"sourcesContent":["import { realpathSync } from 'node:fs';\nimport { realpath } from 'node:fs/promises';\nimport { isAbsolute, sep } from 'node:path';\nimport { z } from 'zod';\nimport { loadRawConfig, resolveSettings, type PartialConfig } from '../lib/config';\nimport { routerSettings } from './settings';\n\n/**\n * Who receives a worker's data: Tenjin and DeepSeek its requests, Exa its web search\n * queries and the address of a page its WebFetch could not fetch.\n */\nconst RECIPIENTS = ['Tenjin', 'DeepSeek', 'Exa'] as const;\n/**\n * THE ONE CONSENT RECORD, written by the fresh-setup answer and by\n * `tenjin config subagents on` alike. ITS SCOPE IS ONE OF TWO, told by `repositories`.\n * Absent, the consent covers the native workspace of every session and grants no\n * directory by itself. Present, the consent is limited to the directories the person\n * named with `--repository` and nothing else: a session outside them gets no offer. A\n * record never moves from the limited scope to the wide one but by the person's own\n * `on` with no `--repository`.\n */\nexport const modelConsentSchema = z.object({\n version: z.literal(2),\n routerOrigin: z.url(),\n instructions: z.literal('applicable'),\n /** A worker reads the person's global Claude Code folder, session transcripts included. */\n reads: z.literal('claude-home'),\n recipients: z.tuple([z.literal('Tenjin'), z.literal('DeepSeek'), z.literal('Exa')]),\n /** The limited scope: only sessions inside these directories, whose workers get all of them. */\n repositories: z.array(z.string()).min(1).optional(),\n /** A ceiling named with `--max-job`. Absent, a job's cap is the per-call spend limit. */\n maxJobAtomic: z.string().regex(/^\\d+$/).optional(),\n});\nexport type ModelConsent = z.infer<typeof modelConsentSchema>;\n\n/** The person's per-call spend limit, the same one the tool router applies to one paid call. */\nexport function perCallLimitAtomic(config: PartialConfig): bigint {\n return BigInt(resolveSettings({ config, flags: {}, env: process.env }).maxAutoSpend.value);\n}\n\n/**\n * A JOB'S CAP: from the person's side a job is one call, so it is their per-call spend\n * limit, read fresh. A ceiling the person named with `--max-job` lowers it and never\n * raises it. A lower limit lowers the next offer and a running job's remaining cap at once.\n */\nfunction jobCapAtomic(named: string | undefined, perCall: bigint): bigint {\n return named !== undefined && BigInt(named) < perCall ? BigInt(named) : perCall;\n}\n\n/**\n * The directories a saved consent names for `routerOrigin` that still resolve, as their\n * real paths. Null where it names none: a wide consent, another router's, or no consent.\n */\nexport function namedDirectories(consent: unknown, routerOrigin?: string): string[] | null {\n const parsed = modelConsentSchema.safeParse(consent);\n if (!parsed.success || parsed.data.repositories === undefined) return null;\n if (routerOrigin !== undefined && parsed.data.routerOrigin !== routerOrigin) return null;\n return parsed.data.repositories.flatMap((path) => {\n if (!isAbsolute(path)) return [];\n try {\n return [realpathSync(path)];\n } catch {\n return [];\n }\n });\n}\n\n/**\n * The record a turn-on writes. With `repositories` it is limited to them; without, it\n * covers every session's workspace. The ceiling is this turn-on's own, so one without\n * `--max-job` follows the per-call limit again.\n */\nexport function modelConsent(options: {\n routerOrigin: string;\n /** Real paths: the limited scope. */\n repositories?: readonly string[];\n maxJobAtomic?: string;\n}): ModelConsent {\n return modelConsentSchema.parse({\n version: 2,\n instructions: 'applicable',\n reads: 'claude-home',\n recipients: [...RECIPIENTS],\n routerOrigin: options.routerOrigin,\n ...(options.repositories?.length ? { repositories: [...new Set(options.repositories)] } : {}),\n ...(options.maxJobAtomic === undefined ? {} : { maxJobAtomic: options.maxJobAtomic }),\n });\n}\n\n/** A named directory covers its descendants, never its parent or a sibling prefix. */\nexport function disclosureCovers(repositories: readonly string[], path: string): boolean {\n return repositories.some(\n (root) => path === root || path.startsWith(root.endsWith(sep) ? root : `${root}${sep}`),\n );\n}\n/** Separate inference consent: legacy native-tier/effort settings grant nothing. */\nexport async function modelSettings(dataDir: string, cwd: string) {\n const config = await loadRawConfig(dataDir);\n const settings = await routerSettings({ cwd, dataDir, config });\n const block = config.router as Record<string, unknown> | undefined;\n const parsed = modelConsentSchema.safeParse(block?.subagentConsent);\n if (\n !settings.enabled.value ||\n !settings.subagents.value ||\n block?.subagents !== true ||\n !parsed.success\n )\n return null;\n const root = await realpath(cwd).catch(() => null);\n if (!root) return null;\n // A limited consent whose directories are all gone covers nothing: never the wide scope.\n const named = namedDirectories(parsed.data);\n if (named && !disclosureCovers(named, root)) return null;\n return {\n version: parsed.data.version,\n scope: named ? ('repositories' as const) : ('native-workspace' as const),\n root,\n repositories: named ?? [root],\n maxJobAtomic: jobCapAtomic(parsed.data.maxJobAtomic, perCallLimitAtomic(config)),\n routerOrigin: parsed.data.routerOrigin,\n context: settings.context.value,\n };\n}\nexport type ModelSettings = NonNullable<Awaited<ReturnType<typeof modelSettings>>>;\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAS,oBAAoB;AAC7B,SAAS,gBAAgB;AACzB,SAAS,YAAY,WAAW;AAShC,IAAM,aAAa,CAAC,UAAU,YAAY,KAAK;AAUxC,IAAM,qBAAqB,iBAAE,OAAO;AAAA,EACzC,SAAS,iBAAE,QAAQ,CAAC;AAAA,EACpB,cAAc,iBAAE,IAAI;AAAA,EACpB,cAAc,iBAAE,QAAQ,YAAY;AAAA;AAAA,EAEpC,OAAO,iBAAE,QAAQ,aAAa;AAAA,EAC9B,YAAY,iBAAE,MAAM,CAAC,iBAAE,QAAQ,QAAQ,GAAG,iBAAE,QAAQ,UAAU,GAAG,iBAAE,QAAQ,KAAK,CAAC,CAAC;AAAA;AAAA,EAElF,cAAc,iBAAE,MAAM,iBAAE,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE,SAAS;AAAA;AAAA,EAElD,cAAc,iBAAE,OAAO,EAAE,MAAM,OAAO,EAAE,SAAS;AACnD,CAAC;AAIM,SAAS,mBAAmB,QAA+B;AAChE,SAAO,OAAO,gBAAgB,EAAE,QAAQ,OAAO,CAAC,GAAG,KAAK,QAAQ,IAAI,CAAC,EAAE,aAAa,KAAK;AAC3F;AAOA,SAAS,aAAa,OAA2B,SAAyB;AACxE,SAAO,UAAU,UAAa,OAAO,KAAK,IAAI,UAAU,OAAO,KAAK,IAAI;AAC1E;AAMO,SAAS,iBAAiB,SAAkB,cAAwC;AACzF,QAAM,SAAS,mBAAmB,UAAU,OAAO;AACnD,MAAI,CAAC,OAAO,WAAW,OAAO,KAAK,iBAAiB,OAAW,QAAO;AACtE,MAAI,iBAAiB,UAAa,OAAO,KAAK,iBAAiB,aAAc,QAAO;AACpF,SAAO,OAAO,KAAK,aAAa,QAAQ,CAAC,SAAS;AAChD,QAAI,CAAC,WAAW,IAAI,EAAG,QAAO,CAAC;AAC/B,QAAI;AACF,aAAO,CAAC,aAAa,IAAI,CAAC;AAAA,IAC5B,QAAQ;AACN,aAAO,CAAC;AAAA,IACV;AAAA,EACF,CAAC;AACH;AAOO,SAAS,aAAa,SAKZ;AACf,SAAO,mBAAmB,MAAM;AAAA,IAC9B,SAAS;AAAA,IACT,cAAc;AAAA,IACd,OAAO;AAAA,IACP,YAAY,CAAC,GAAG,UAAU;AAAA,IAC1B,cAAc,QAAQ;AAAA,IACtB,GAAI,QAAQ,cAAc,SAAS,EAAE,cAAc,CAAC,GAAG,IAAI,IAAI,QAAQ,YAAY,CAAC,EAAE,IAAI,CAAC;AAAA,IAC3F,GAAI,QAAQ,iBAAiB,SAAY,CAAC,IAAI,EAAE,cAAc,QAAQ,aAAa;AAAA,EACrF,CAAC;AACH;AAGO,SAAS,iBAAiB,cAAiC,MAAuB;AACvF,SAAO,aAAa;AAAA,IAClB,CAAC,SAAS,SAAS,QAAQ,KAAK,WAAW,KAAK,SAAS,GAAG,IAAI,OAAO,GAAG,IAAI,GAAG,GAAG,EAAE;AAAA,EACxF;AACF;AAEA,eAAsB,cAAc,SAAiB,KAAa;AAChE,QAAM,SAAS,MAAM,cAAc,OAAO;AAC1C,QAAM,WAAW,MAAM,eAAe,EAAE,KAAK,SAAS,OAAO,CAAC;AAC9D,QAAM,QAAQ,OAAO;AACrB,QAAM,SAAS,mBAAmB,UAAU,OAAO,eAAe;AAClE,MACE,CAAC,SAAS,QAAQ,SAClB,CAAC,SAAS,UAAU,SACpB,OAAO,cAAc,QACrB,CAAC,OAAO;AAER,WAAO;AACT,QAAM,OAAO,MAAM,SAAS,GAAG,EAAE,MAAM,MAAM,IAAI;AACjD,MAAI,CAAC,KAAM,QAAO;AAElB,QAAM,QAAQ,iBAAiB,OAAO,IAAI;AAC1C,MAAI,SAAS,CAAC,iBAAiB,OAAO,IAAI,EAAG,QAAO;AACpD,SAAO;AAAA,IACL,SAAS,OAAO,KAAK;AAAA,IACrB,OAAO,QAAS,iBAA4B;AAAA,IAC5C;AAAA,IACA,cAAc,SAAS,CAAC,IAAI;AAAA,IAC5B,cAAc,aAAa,OAAO,KAAK,cAAc,mBAAmB,MAAM,CAAC;AAAA,IAC/E,cAAc,OAAO,KAAK;AAAA,IAC1B,SAAS,SAAS,QAAQ;AAAA,EAC5B;AACF;","names":[]}
@@ -0,0 +1,347 @@
1
+ import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
+ import {
3
+ LEGACY_MCP_SERVER_NAME,
4
+ LEGACY_REQUEST_TOOL,
5
+ requestToolName
6
+ } from "./chunk-IULCDMVG.js";
7
+
8
+ // src/router/agent-tools.ts
9
+ import { opendir, readFile, realpath, stat } from "node:fs/promises";
10
+ import { basename, dirname, join, resolve } from "node:path";
11
+ var MCP_INHERITING_BUILTINS = /* @__PURE__ */ new Set([
12
+ "general-purpose",
13
+ "Explore",
14
+ "Plan"
15
+ ]);
16
+ var MAX_AGENT_FILE_BYTES = 256 * 1024;
17
+ var MAX_AGENT_ENTRIES = 200;
18
+ var TYPE_RE = /^[A-Za-z0-9_.:-]{1,200}$/;
19
+ var MANAGED_AGENTS = join(
20
+ process.platform === "darwin" ? "/Library/Application Support/ClaudeCode" : process.platform === "win32" ? "C:\\Program Files\\ClaudeCode" : "/etc/claude-code",
21
+ ".claude",
22
+ "agents"
23
+ );
24
+ var UncertainAgentDefinition = class extends Error {
25
+ constructor(reason) {
26
+ super("Claude Code agent definition could not be established");
27
+ this.reason = reason;
28
+ }
29
+ reason;
30
+ };
31
+ async function requestToolAccess(agentType, lookup, tool = requestToolName()) {
32
+ if (agentType === void 0 || !TYPE_RE.test(agentType)) return "unknown";
33
+ try {
34
+ const text = await findDefinition(agentType, lookup);
35
+ if (text !== null) return accessOf(text, tool);
36
+ return MCP_INHERITING_BUILTINS.has(agentType) ? "allowed" : "unknown";
37
+ } catch {
38
+ return "unknown";
39
+ }
40
+ }
41
+ function accessOf(definition, tool = requestToolName()) {
42
+ const frontmatter = frontmatterOf(definition);
43
+ const read = frontmatter === null ? null : readFrontmatter(frontmatter, ANY_AGENT);
44
+ if (read === null || "unmatched" in read) return "unknown";
45
+ if (read.disallowedTools?.some((entry) => namesRequestTool(entry, tool) || namesLegacyTool(entry)))
46
+ return "excluded";
47
+ if (read.tools === void 0) return "allowed";
48
+ return read.tools.some((entry) => namesRequestTool(entry, tool)) ? "allowed" : "excluded";
49
+ }
50
+ function namesRequestTool(entry, tool) {
51
+ const server = tool.lastIndexOf("__");
52
+ if (entry === tool || server > 0 && entry === tool.slice(0, server)) return true;
53
+ return entry.endsWith("*") && tool.startsWith(entry.slice(0, -1));
54
+ }
55
+ function namesLegacyTool(entry) {
56
+ return namesRequestTool(entry, LEGACY_REQUEST_TOOL) || entry === `mcp__${LEGACY_MCP_SERVER_NAME}`;
57
+ }
58
+ async function agentsWithoutRequestTool(lookup, tool = requestToolName()) {
59
+ const found = [];
60
+ const seen = /* @__PURE__ */ new Set();
61
+ for (const directory of agentDirs(lookup)) {
62
+ for (const { name: type, text } of await definitionsIn(directory).catch(() => [])) {
63
+ if (seen.has(type)) continue;
64
+ seen.add(type);
65
+ if (accessOf(text, tool) === "excluded") found.push(type);
66
+ }
67
+ }
68
+ return found.sort();
69
+ }
70
+ var WORKER_MATCHED_KEYS = /* @__PURE__ */ new Set([
71
+ "name",
72
+ "description",
73
+ "tools",
74
+ "disallowedTools",
75
+ "color",
76
+ "effort"
77
+ ]);
78
+ var TOOL_ENTRY = /^[A-Za-z_][\w*.:-]*(\([^()]*\))?$/;
79
+ var WORKER_AGENT = {
80
+ key: (key, value) => key === "model" ? ["", "inherit"].includes(value) : WORKER_MATCHED_KEYS.has(key),
81
+ entry: (entry) => TOOL_ENTRY.test(entry) && !entry.includes(","),
82
+ // All tools to some readers, none to others.
83
+ emptyList: false
84
+ };
85
+ var ANY_AGENT = {
86
+ key: () => true,
87
+ entry: (entry) => entry === "*" || TOOL_ENTRY.test(entry),
88
+ emptyList: true
89
+ };
90
+ function scalar(raw) {
91
+ const value = raw.trim();
92
+ if (!/\s#/.test(` ${value}`)) return unquote(value);
93
+ return /['"]/.test(value) ? null : value.replace(/(^|\s+)#.*$/, "");
94
+ }
95
+ function entriesOf(value) {
96
+ return (value.match(/(?:[^,(]|\([^()]*\))+/g) ?? []).map((part) => unquote(part.trim())).filter((part) => part.length > 0);
97
+ }
98
+ function readFrontmatter(frontmatter, rules = WORKER_AGENT) {
99
+ const read = {};
100
+ const seen = /* @__PURE__ */ new Set();
101
+ let under;
102
+ for (const line of frontmatter) {
103
+ if (line.trim() === "" || line.trimStart().startsWith("#")) continue;
104
+ if (/^(\s|-\s)/.test(line)) {
105
+ if (!under) return { unmatched: "frontmatter" };
106
+ if (!under.list) continue;
107
+ const entry = scalar(/^\s*-\s+(.+)$/.exec(line)?.[1] ?? "");
108
+ if (!entry || !rules.entry(entry)) return { unmatched: "frontmatter" };
109
+ read[under.key].push(entry);
110
+ continue;
111
+ }
112
+ const field = /^([A-Za-z][\w-]*)\s*:(.*)$/.exec(line);
113
+ if (field === null) return { unmatched: "frontmatter" };
114
+ const [, key, raw] = field;
115
+ if (seen.has(key)) return { unmatched: "frontmatter" };
116
+ seen.add(key);
117
+ const list = key === "tools" || key === "disallowedTools";
118
+ const value = scalar(raw);
119
+ if (value === null) {
120
+ if (list || key === "name" || !rules.key(key, raw.trim()))
121
+ return { unmatched: "frontmatter" };
122
+ under = { key, list: false };
123
+ continue;
124
+ }
125
+ if (!rules.key(key, value)) return { unmatched: key };
126
+ under = list && value !== "" ? void 0 : { key, list };
127
+ if (key === "name" && value) read.name = value;
128
+ if (!list) continue;
129
+ const bracketed = value.startsWith("[");
130
+ if (bracketed && !value.endsWith("]")) return { unmatched: "frontmatter" };
131
+ const entries = entriesOf(bracketed ? value.slice(1, -1) : value);
132
+ if (entries.some((entry) => !rules.entry(entry))) return { unmatched: "frontmatter" };
133
+ read[key] = entries;
134
+ }
135
+ if (!rules.emptyList && [read.tools, read.disallowedTools].some((list) => list?.length === 0))
136
+ return { unmatched: "frontmatter" };
137
+ return read;
138
+ }
139
+ var WORKER_BUILTIN_AGENTS = /* @__PURE__ */ new Set(["general-purpose", "Explore"]);
140
+ async function setsOwnMode(agentType, lookup) {
141
+ if (!TYPE_RE.test(agentType)) return true;
142
+ try {
143
+ const text = await findDefinition(agentType, lookup);
144
+ if (text === null) return !WORKER_BUILTIN_AGENTS.has(agentType);
145
+ const frontmatter = frontmatterOf(text);
146
+ return frontmatter === null || frontmatter.some((line) => /^\s*['"]?permissionMode['"]?\s*:/.test(line));
147
+ } catch {
148
+ return true;
149
+ }
150
+ }
151
+ var isCustomAgentType = (agentType) => TYPE_RE.test(agentType) && !agentType.includes(":") && !WORKER_BUILTIN_AGENTS.has(agentType);
152
+ async function workerAgent(agentType, lookup) {
153
+ if (!isCustomAgentType(agentType)) return { unmatched: "subagent_type" };
154
+ const native = { ...lookup, cwd: lookup.cwd ?? lookup.root };
155
+ let definition;
156
+ try {
157
+ definition = await localDefinition(agentType, native);
158
+ } catch (error) {
159
+ return {
160
+ unmatched: error instanceof UncertainAgentDefinition ? error.reason : "definition:unavailable"
161
+ };
162
+ }
163
+ const allowed = [join(resolve(lookup.root), ".claude", "agents"), userAgentDir(native)];
164
+ if (!definition || !allowed.includes(definition.directory)) return { unmatched: "subagent_type" };
165
+ const { text } = definition;
166
+ const frontmatter = frontmatterOf(text);
167
+ if (frontmatter === null) return { unmatched: "subagent_type" };
168
+ const read = readFrontmatter(frontmatter);
169
+ if ("unmatched" in read) return { unmatched: `definition:${read.unmatched}` };
170
+ const lines = text.split(/\r?\n/);
171
+ const open = lines.findIndex((line) => line.trim() === "---");
172
+ const prompt = lines.slice(lines.findIndex((line, i) => i > open && line.trim() === "---") + 1).join("\n").trim();
173
+ if (!prompt) return { unmatched: "definition:prompt" };
174
+ const { tools, disallowedTools } = read;
175
+ return {
176
+ agent: {
177
+ description: agentType,
178
+ prompt,
179
+ ...tools ? { tools } : {},
180
+ ...disallowedTools ? { disallowedTools } : {}
181
+ }
182
+ };
183
+ }
184
+ async function findDefinition(agentType, lookup) {
185
+ const colon = agentType.indexOf(":");
186
+ if (colon < 0) return (await localDefinition(agentType, lookup))?.text ?? null;
187
+ if (colon > 0) {
188
+ const plugin = agentType.slice(0, colon);
189
+ const agent = agentType.slice(colon + 1);
190
+ for (const root of await pluginRoots(plugin, lookup.homeDir)) {
191
+ const text = await pluginDefinitionIn(join(root, "agents"), agent);
192
+ if (text !== null) return text;
193
+ }
194
+ }
195
+ return null;
196
+ }
197
+ function userAgentDir(lookup) {
198
+ return join(
199
+ resolve(lookup.cwd || ".", process.env.CLAUDE_CONFIG_DIR ?? join(lookup.homeDir, ".claude")),
200
+ "agents"
201
+ );
202
+ }
203
+ function agentDirs(lookup) {
204
+ const dirs = [];
205
+ if (lookup.cwd !== void 0 && lookup.cwd.length > 0) {
206
+ let current = resolve(lookup.cwd);
207
+ for (; ; ) {
208
+ dirs.push(join(current, ".claude", "agents"));
209
+ const parent = dirname(current);
210
+ if (parent === current) break;
211
+ current = parent;
212
+ }
213
+ }
214
+ const user = userAgentDir(lookup);
215
+ return [...dirs.filter((d) => d !== user), user];
216
+ }
217
+ async function localDefinition(agentType, lookup) {
218
+ const user = userAgentDir(lookup);
219
+ const directories = agentDirs(lookup).filter((directory) => directory !== user);
220
+ const extra = [
221
+ ...new Set(
222
+ (lookup.additionalDirectories ?? []).map(
223
+ (dir) => resolve(lookup.cwd || ".", dir, ".claude", "agents")
224
+ )
225
+ )
226
+ ].filter((directory) => directory !== user && !directories.includes(directory));
227
+ let project;
228
+ for (const directory of [MANAGED_AGENTS, ...directories, ...extra, user]) {
229
+ if (project && directory === user) break;
230
+ if (project && directories.includes(directory)) continue;
231
+ const matches = (await definitionsIn(directory)).filter(
232
+ (candidate) => candidate.name === agentType
233
+ );
234
+ if (matches.length > 1 || project && matches.length > 0)
235
+ throw new UncertainAgentDefinition("definition:ambiguous");
236
+ if (!matches[0]) continue;
237
+ project = { directory, text: matches[0].text };
238
+ if (directory === MANAGED_AGENTS) break;
239
+ }
240
+ return project;
241
+ }
242
+ async function pluginDefinitionIn(directory, agentType) {
243
+ const direct = await readBounded(join(directory, `${agentType}.md`));
244
+ if (direct !== null && (nameOf(direct) ?? agentType) === agentType) return direct;
245
+ return (await definitionsIn(directory).catch(() => [])).find((def) => def.name === agentType)?.text ?? null;
246
+ }
247
+ async function definitionsIn(directory) {
248
+ let opened;
249
+ try {
250
+ const canonical = await realpath(directory);
251
+ const base = await realpath(dirname(dirname(directory)));
252
+ if (canonical !== join(base, basename(dirname(directory)), "agents"))
253
+ throw new UncertainAgentDefinition("definition:unavailable");
254
+ opened = await opendir(directory);
255
+ } catch (error) {
256
+ if (error.code === "ENOENT") return [];
257
+ throw error;
258
+ }
259
+ const out = [];
260
+ let entries = 0;
261
+ async function walk(current) {
262
+ for await (const file of current) {
263
+ if (++entries > MAX_AGENT_ENTRIES || file.isSymbolicLink())
264
+ throw new UncertainAgentDefinition("definition:unavailable");
265
+ const path = join(current.path, file.name);
266
+ if (file.isDirectory()) await walk(await opendir(path));
267
+ else if (file.isFile() && file.name.endsWith(".md")) {
268
+ if ((await stat(path)).size > MAX_AGENT_FILE_BYTES)
269
+ throw new UncertainAgentDefinition("definition:unavailable");
270
+ const text = await readFile(path, "utf8");
271
+ const name = lookupNameOf(text);
272
+ if (name) out.push({ name, text });
273
+ }
274
+ }
275
+ }
276
+ await walk(opened);
277
+ return out;
278
+ }
279
+ function lookupNameOf(text) {
280
+ const lines = frontmatterOf(text);
281
+ if (!lines) return void 0;
282
+ let name;
283
+ let fieldSeen = false;
284
+ for (const line of lines) {
285
+ if (!line.trim() || line.trimStart().startsWith("#")) continue;
286
+ if (fieldSeen && /^(\s|-\s)/.test(line)) continue;
287
+ const field = /^(?:([A-Za-z][\w-]*)|'([A-Za-z][\w-]*)'|"([A-Za-z][\w-]*)")\s*:(.*)$/.exec(line);
288
+ if (!field) throw new UncertainAgentDefinition("definition:frontmatter");
289
+ fieldSeen = true;
290
+ if ((field[1] ?? field[2] ?? field[3]) !== "name") continue;
291
+ const value = scalar(field[4]);
292
+ if (name !== void 0 || value === null || !TYPE_RE.test(value))
293
+ throw new UncertainAgentDefinition("definition:frontmatter");
294
+ name = value;
295
+ }
296
+ return name;
297
+ }
298
+ async function pluginRoots(plugin, homeDir) {
299
+ const raw = await readBounded(join(homeDir, ".claude", "plugins", "installed_plugins.json"));
300
+ if (raw === null) return [];
301
+ const parsed = JSON.parse(raw);
302
+ const roots = [];
303
+ for (const [key, entries] of Object.entries(parsed.plugins ?? {})) {
304
+ if (key.split("@")[0] !== plugin || !Array.isArray(entries)) continue;
305
+ for (const entry of entries) {
306
+ const path = entry.installPath;
307
+ if (typeof path === "string" && path.length > 0) roots.push(path);
308
+ }
309
+ }
310
+ return roots;
311
+ }
312
+ async function readBounded(path) {
313
+ try {
314
+ const text = await readFile(path, "utf8");
315
+ return text.length > MAX_AGENT_FILE_BYTES ? null : text;
316
+ } catch {
317
+ return null;
318
+ }
319
+ }
320
+ function frontmatterOf(text) {
321
+ const lines = text.replace(/^\uFEFF/, "").split(/\r?\n/);
322
+ const open = lines.findIndex((l) => l.trim().length > 0);
323
+ if (open === -1 || lines[open]?.trim() !== "---") return null;
324
+ const end = lines.findIndex((l, i) => i > open && l.trim() === "---");
325
+ return end === -1 ? null : lines.slice(open + 1, end);
326
+ }
327
+ function nameOf(text) {
328
+ const line = frontmatterOf(text)?.map((l) => /^(?:name|'name'|"name")\s*:(.*)$/.exec(l)?.[1]).find((value2) => value2 !== void 0);
329
+ if (line === void 0) return null;
330
+ const value = scalar(line) ?? unquote(line.replace(/\s+#.*$/, "").trim());
331
+ return value.length > 0 ? value : null;
332
+ }
333
+ function unquote(value) {
334
+ const quoted = /^(['"])(.*)\1$/.exec(value);
335
+ return quoted === null ? value : quoted[2];
336
+ }
337
+
338
+ export {
339
+ requestToolAccess,
340
+ agentsWithoutRequestTool,
341
+ WORKER_BUILTIN_AGENTS,
342
+ setsOwnMode,
343
+ isCustomAgentType,
344
+ workerAgent,
345
+ findDefinition
346
+ };
347
+ //# sourceMappingURL=chunk-LWSSIZOY.js.map