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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (495) hide show
  1. package/NOTICE.md +110 -0
  2. package/README.md +87 -81
  3. package/dist/{_esm-BIN7VY2L.js → _esm-2KST7HQ7.js} +7 -7
  4. package/dist/alive-5TV22PNF.js +51 -0
  5. package/dist/auth-XI7BJFLW.js +47 -0
  6. package/dist/{auto-update-Y24UL56V.js → auto-update-7L24KDWA.js} +4 -5
  7. package/dist/balance-DFHC6XEU.js +71 -0
  8. package/dist/{ccip-DHDFKTQV.js → ccip-HOW3DZYF.js} +4 -4
  9. package/dist/chunk-24XKUN2S.js +202 -0
  10. package/dist/chunk-24XKUN2S.js.map +1 -0
  11. package/dist/chunk-2L7TDGLV.js +56 -0
  12. package/dist/chunk-2L7TDGLV.js.map +1 -0
  13. package/dist/{chunk-C2Q76BVM.js → chunk-2U7H35IP.js} +29 -7
  14. package/dist/chunk-2U7H35IP.js.map +1 -0
  15. package/dist/chunk-2W4DQQUU.js +176 -0
  16. package/dist/chunk-2W4DQQUU.js.map +1 -0
  17. package/dist/{chunk-LRW6S53P.js → chunk-34SAECKZ.js} +35 -11
  18. package/dist/chunk-34SAECKZ.js.map +1 -0
  19. package/dist/{chunk-2I4QTOLB.js → chunk-3MZ7DYRO.js} +1 -1
  20. package/dist/chunk-3MZ7DYRO.js.map +1 -0
  21. package/dist/{chunk-RVPYTUP4.js → chunk-3Y2EHT4F.js} +13 -9
  22. package/dist/chunk-3Y2EHT4F.js.map +1 -0
  23. package/dist/chunk-3Y6BHIN6.js +169 -0
  24. package/dist/chunk-3Y6BHIN6.js.map +1 -0
  25. package/dist/{chunk-4K7TQHNP.js → chunk-3YPL6T3P.js} +17 -33
  26. package/dist/chunk-3YPL6T3P.js.map +1 -0
  27. package/dist/{chunk-E7SW44LM.js → chunk-44MVIRZH.js} +121 -6
  28. package/dist/chunk-44MVIRZH.js.map +1 -0
  29. package/dist/chunk-45MMSBHA.js +321 -0
  30. package/dist/chunk-45MMSBHA.js.map +1 -0
  31. package/dist/{chunk-3FMZGI7I.js → chunk-4CE6TMI5.js} +1 -1
  32. package/dist/chunk-4CE6TMI5.js.map +1 -0
  33. package/dist/{chunk-QXP3Z3JN.js → chunk-4MBCJFY4.js} +35 -3
  34. package/dist/chunk-4MBCJFY4.js.map +1 -0
  35. package/dist/chunk-4TPL54KW.js +227 -0
  36. package/dist/chunk-4TPL54KW.js.map +1 -0
  37. package/dist/chunk-54ELBTKE.js +1615 -0
  38. package/dist/chunk-54ELBTKE.js.map +1 -0
  39. package/dist/{chunk-NDGZDTSJ.js → chunk-5F4OB5B3.js} +115 -57
  40. package/dist/chunk-5F4OB5B3.js.map +1 -0
  41. package/dist/chunk-5HN4KVQU.js +3348 -0
  42. package/dist/chunk-5HN4KVQU.js.map +1 -0
  43. package/dist/{chunk-ZDZERB6L.js → chunk-5J4E5GYI.js} +572 -407
  44. package/dist/chunk-5J4E5GYI.js.map +1 -0
  45. package/dist/{chunk-ZNNXRNFD.js → chunk-5N4GGUBN.js} +48 -6
  46. package/dist/chunk-5N4GGUBN.js.map +1 -0
  47. package/dist/chunk-5USBZ2MU.js +58 -0
  48. package/dist/chunk-5USBZ2MU.js.map +1 -0
  49. package/dist/chunk-64WOMNYR.js +183 -0
  50. package/dist/chunk-64WOMNYR.js.map +1 -0
  51. package/dist/{chunk-ILNIZ5I2.js → chunk-65RS4LQS.js} +1825 -1715
  52. package/dist/chunk-65RS4LQS.js.map +1 -0
  53. package/dist/{chunk-IE7P2BZE.js → chunk-6QMDUDF2.js} +3 -3
  54. package/dist/{chunk-IADZOXKN.js → chunk-7SLOTLO7.js} +19 -697
  55. package/dist/chunk-7SLOTLO7.js.map +1 -0
  56. package/dist/{chunk-WFSPCCVW.js → chunk-7V25UAQO.js} +99 -99
  57. package/dist/{chunk-WFSPCCVW.js.map → chunk-7V25UAQO.js.map} +1 -1
  58. package/dist/chunk-BGA4DO5M.js +719 -0
  59. package/dist/chunk-BGA4DO5M.js.map +1 -0
  60. package/dist/chunk-BVP7YK2J.js +706 -0
  61. package/dist/chunk-BVP7YK2J.js.map +1 -0
  62. package/dist/chunk-C265QIMJ.js +83 -0
  63. package/dist/chunk-C265QIMJ.js.map +1 -0
  64. package/dist/{chunk-XQJXNMSB.js → chunk-CRG54LEB.js} +1 -1
  65. package/dist/chunk-CRG54LEB.js.map +1 -0
  66. package/dist/{chunk-KG3D7FIF.js → chunk-CZJOMUBP.js} +2 -2
  67. package/dist/{chunk-36RVGZNY.js → chunk-D6M3ZK66.js} +22 -39
  68. package/dist/chunk-D6M3ZK66.js.map +1 -0
  69. package/dist/{chunk-3UCIG4TG.js → chunk-DI4QAGRZ.js} +1 -11
  70. package/dist/chunk-DI4QAGRZ.js.map +1 -0
  71. package/dist/{chunk-JKKAIPTU.js → chunk-DIH2G3YG.js} +47 -10
  72. package/dist/chunk-DIH2G3YG.js.map +1 -0
  73. package/dist/chunk-DJ36BM62.js +78 -0
  74. package/dist/chunk-DJ36BM62.js.map +1 -0
  75. package/dist/chunk-DTEWAVNE.js +114 -0
  76. package/dist/chunk-DTEWAVNE.js.map +1 -0
  77. package/dist/chunk-F2KJAJ7T.js +13 -0
  78. package/dist/chunk-F2KJAJ7T.js.map +1 -0
  79. package/dist/{chunk-BF4XHEQK.js → chunk-F3QPGYOY.js} +6 -6
  80. package/dist/chunk-F3QPGYOY.js.map +1 -0
  81. package/dist/{chunk-3GNJXKIT.js → chunk-F43CV6UC.js} +2 -2
  82. package/dist/{chunk-J57UC3DD.js → chunk-FKVJKLPI.js} +3 -3
  83. package/dist/{chunk-V2LQLN5H.js → chunk-FYFHH7V5.js} +59 -8
  84. package/dist/{chunk-V2LQLN5H.js.map → chunk-FYFHH7V5.js.map} +1 -1
  85. package/dist/chunk-GAJC4BQZ.js +1096 -0
  86. package/dist/chunk-GAJC4BQZ.js.map +1 -0
  87. package/dist/{chunk-DOQGNFHM.js → chunk-GH5UKMZD.js} +2 -12
  88. package/dist/{chunk-DOQGNFHM.js.map → chunk-GH5UKMZD.js.map} +1 -1
  89. package/dist/{chunk-WYXUQGOL.js → chunk-HAZAN4UM.js} +7 -6
  90. package/dist/chunk-HAZAN4UM.js.map +1 -0
  91. package/dist/chunk-HI5XQOX2.js +393 -0
  92. package/dist/chunk-HI5XQOX2.js.map +1 -0
  93. package/dist/chunk-HKGUKAQW.js +488 -0
  94. package/dist/chunk-HKGUKAQW.js.map +1 -0
  95. package/dist/{chunk-SO3XRZPX.js → chunk-HPRVFJPM.js} +6 -6
  96. package/dist/{chunk-L6JEXB3E.js → chunk-HQR4BWKX.js} +3 -131
  97. package/dist/chunk-HQR4BWKX.js.map +1 -0
  98. package/dist/chunk-HZKANST2.js +177 -0
  99. package/dist/chunk-HZKANST2.js.map +1 -0
  100. package/dist/{chunk-UUGOUOVT.js → chunk-I557SAOM.js} +8 -2
  101. package/dist/chunk-I557SAOM.js.map +1 -0
  102. package/dist/{chunk-TC2WZLSC.js → chunk-IGLWLH73.js} +8 -7
  103. package/dist/chunk-IGLWLH73.js.map +1 -0
  104. package/dist/chunk-ILWCKCOI.js +58 -0
  105. package/dist/chunk-ILWCKCOI.js.map +1 -0
  106. package/dist/{chunk-2GP3HRYK.js → chunk-INSIW65E.js} +182 -182
  107. package/dist/{chunk-MPZUYCAP.js → chunk-IULCDMVG.js} +12 -1
  108. package/dist/chunk-IULCDMVG.js.map +1 -0
  109. package/dist/{chunk-INTFHMU4.js → chunk-IVNSUAVC.js} +25 -26
  110. package/dist/chunk-IVNSUAVC.js.map +1 -0
  111. package/dist/chunk-JDQZCREI.js +87 -0
  112. package/dist/chunk-JDQZCREI.js.map +1 -0
  113. package/dist/chunk-JHFFUVON.js +1050 -0
  114. package/dist/chunk-JHFFUVON.js.map +1 -0
  115. package/dist/{chunk-RL5UUDT4.js → chunk-JNUKLSMZ.js} +3 -3
  116. package/dist/chunk-JTILUN4W.js +2933 -0
  117. package/dist/chunk-JTILUN4W.js.map +1 -0
  118. package/dist/{chunk-OJNTCYQQ.js → chunk-JTX3BUDK.js} +37 -53
  119. package/dist/chunk-JTX3BUDK.js.map +1 -0
  120. package/dist/{chunk-X5ZBP3IY.js → chunk-JUUBBBY5.js} +2 -2
  121. package/dist/chunk-JUUBBBY5.js.map +1 -0
  122. package/dist/chunk-JWAK7JQB.js +15 -0
  123. package/dist/chunk-JWAK7JQB.js.map +1 -0
  124. package/dist/{chunk-UXZONNEQ.js → chunk-K5KNGC4I.js} +34 -31
  125. package/dist/chunk-K5KNGC4I.js.map +1 -0
  126. package/dist/chunk-KAQ4Q3TO.js +135 -0
  127. package/dist/chunk-KAQ4Q3TO.js.map +1 -0
  128. package/dist/chunk-KFVJYLVL.js +125 -0
  129. package/dist/chunk-KFVJYLVL.js.map +1 -0
  130. package/dist/chunk-KGUE5AVX.js +69 -0
  131. package/dist/chunk-KGUE5AVX.js.map +1 -0
  132. package/dist/{chunk-FVIGCDSV.js → chunk-KLDMLWXT.js} +11 -85
  133. package/dist/chunk-KLDMLWXT.js.map +1 -0
  134. package/dist/chunk-KNKDMTHU.js +453 -0
  135. package/dist/chunk-KNKDMTHU.js.map +1 -0
  136. package/dist/chunk-LDA6TAYQ.js +95 -0
  137. package/dist/chunk-LDA6TAYQ.js.map +1 -0
  138. package/dist/chunk-LWSSIZOY.js +347 -0
  139. package/dist/chunk-LWSSIZOY.js.map +1 -0
  140. package/dist/{chunk-ZURZHELF.js → chunk-MAHNZA6C.js} +158 -41
  141. package/dist/chunk-MAHNZA6C.js.map +1 -0
  142. package/dist/chunk-MEWZCIA6.js +220 -0
  143. package/dist/chunk-MEWZCIA6.js.map +1 -0
  144. package/dist/{chunk-2SNUOHAT.js → chunk-MEZJ3I63.js} +49 -1
  145. package/dist/chunk-MEZJ3I63.js.map +1 -0
  146. package/dist/chunk-MJDO4EXD.js +353 -0
  147. package/dist/chunk-MJDO4EXD.js.map +1 -0
  148. package/dist/chunk-NJA6NT3A.js +6595 -0
  149. package/dist/chunk-NJA6NT3A.js.map +1 -0
  150. package/dist/{chunk-LHHMV4GU.js → chunk-NVSKJPRC.js} +1 -1
  151. package/dist/{chunk-LHHMV4GU.js.map → chunk-NVSKJPRC.js.map} +1 -1
  152. package/dist/{chunk-4YOZGGTZ.js → chunk-OC7K2DVZ.js} +5 -5
  153. package/dist/chunk-OC7K2DVZ.js.map +1 -0
  154. package/dist/chunk-ODRPASFP.js +2078 -0
  155. package/dist/chunk-ODRPASFP.js.map +1 -0
  156. package/dist/chunk-OJJFANO6.js +133 -0
  157. package/dist/chunk-OJJFANO6.js.map +1 -0
  158. package/dist/{chunk-JNJWBTU2.js → chunk-OQWPRFAC.js} +332 -882
  159. package/dist/chunk-OQWPRFAC.js.map +1 -0
  160. package/dist/chunk-P4I7BFNJ.js +11 -0
  161. package/dist/chunk-P4I7BFNJ.js.map +1 -0
  162. package/dist/{chunk-SNNSAGMT.js → chunk-P6YQWIT2.js} +4058 -4039
  163. package/dist/chunk-P6YQWIT2.js.map +1 -0
  164. package/dist/{chunk-JRGFKVAZ.js → chunk-PETQ5WEA.js} +2 -2
  165. package/dist/{chunk-HMWYAUA6.js → chunk-Q6RSJCXB.js} +29 -69
  166. package/dist/chunk-Q6RSJCXB.js.map +1 -0
  167. package/dist/{chunk-U3IKUGRP.js → chunk-QKEUKBRK.js} +17 -23
  168. package/dist/chunk-QKEUKBRK.js.map +1 -0
  169. package/dist/{chunk-2RWB7RKE.js → chunk-QKYUCITR.js} +174 -5814
  170. package/dist/chunk-QKYUCITR.js.map +1 -0
  171. package/dist/chunk-QQDPRTLP.js +127 -0
  172. package/dist/chunk-QQDPRTLP.js.map +1 -0
  173. package/dist/chunk-QQYCYAKI.js +79 -0
  174. package/dist/chunk-QQYCYAKI.js.map +1 -0
  175. package/dist/chunk-R4KDH477.js +1064 -0
  176. package/dist/chunk-R4KDH477.js.map +1 -0
  177. package/dist/chunk-R5TR2DIK.js +119 -0
  178. package/dist/chunk-R5TR2DIK.js.map +1 -0
  179. package/dist/chunk-R62PKTAG.js +66 -0
  180. package/dist/chunk-R62PKTAG.js.map +1 -0
  181. package/dist/{chunk-BFDQ4WNW.js → chunk-RFZA7PSM.js} +4 -5
  182. package/dist/chunk-RFZA7PSM.js.map +1 -0
  183. package/dist/chunk-RGCPELQN.js +219 -0
  184. package/dist/chunk-RGCPELQN.js.map +1 -0
  185. package/dist/chunk-RGVCOG2S.js +910 -0
  186. package/dist/chunk-RGVCOG2S.js.map +1 -0
  187. package/dist/chunk-SOLNJ3AZ.js +209 -0
  188. package/dist/chunk-SOLNJ3AZ.js.map +1 -0
  189. package/dist/chunk-TFT2X7SH.js +77 -0
  190. package/dist/chunk-TFT2X7SH.js.map +1 -0
  191. package/dist/chunk-TUCKEEXE.js +2 -0
  192. package/dist/chunk-TVWCLUBI.js +293 -0
  193. package/dist/chunk-TVWCLUBI.js.map +1 -0
  194. package/dist/chunk-U4TRWSVE.js +78 -0
  195. package/dist/chunk-U4TRWSVE.js.map +1 -0
  196. package/dist/chunk-UIB33QQP.js +379 -0
  197. package/dist/chunk-UIB33QQP.js.map +1 -0
  198. package/dist/chunk-V6GIVALQ.js +1889 -0
  199. package/dist/chunk-V6GIVALQ.js.map +1 -0
  200. package/dist/chunk-VHXCPXUS.js +366 -0
  201. package/dist/chunk-VHXCPXUS.js.map +1 -0
  202. package/dist/{chunk-HGZEPQUT.js → chunk-VU6GMWF6.js} +17 -8
  203. package/dist/chunk-VU6GMWF6.js.map +1 -0
  204. package/dist/chunk-VWZYE3NC.js +8415 -0
  205. package/dist/chunk-VWZYE3NC.js.map +1 -0
  206. package/dist/{chunk-AGMVASXZ.js → chunk-W2GXIARJ.js} +88 -11
  207. package/dist/chunk-W2GXIARJ.js.map +1 -0
  208. package/dist/chunk-W4G3K3V7.js +288 -0
  209. package/dist/chunk-W4G3K3V7.js.map +1 -0
  210. package/dist/chunk-W74LJ5OT.js +588 -0
  211. package/dist/chunk-W74LJ5OT.js.map +1 -0
  212. package/dist/chunk-W7ELYLYK.js +233 -0
  213. package/dist/chunk-W7ELYLYK.js.map +1 -0
  214. package/dist/{chunk-BPMWXTFX.js → chunk-WFZX352D.js} +7 -7
  215. package/dist/chunk-WXA3WTPF.js +20 -0
  216. package/dist/chunk-WXA3WTPF.js.map +1 -0
  217. package/dist/chunk-XRGFH7FI.js +454 -0
  218. package/dist/chunk-XRGFH7FI.js.map +1 -0
  219. package/dist/chunk-XSCGUO2U.js +330 -0
  220. package/dist/chunk-XSCGUO2U.js.map +1 -0
  221. package/dist/chunk-XWROSMI5.js +1039 -0
  222. package/dist/chunk-XWROSMI5.js.map +1 -0
  223. package/dist/chunk-Y2EXZ47H.js +40 -0
  224. package/dist/chunk-Y2EXZ47H.js.map +1 -0
  225. package/dist/chunk-YJGEVBKZ.js +47 -0
  226. package/dist/chunk-YJGEVBKZ.js.map +1 -0
  227. package/dist/{chunk-6CMM6YCB.js → chunk-YWWMISDY.js} +2 -2
  228. package/dist/{chunk-WXA2BWTE.js → chunk-ZCT5DJ3G.js} +2 -48
  229. package/dist/chunk-ZCT5DJ3G.js.map +1 -0
  230. package/dist/chunk-ZEYA2WWX.js +982 -0
  231. package/dist/chunk-ZEYA2WWX.js.map +1 -0
  232. package/dist/chunk-ZRC7Z5X3.js +82 -0
  233. package/dist/chunk-ZRC7Z5X3.js.map +1 -0
  234. package/dist/{chunk-3AIHRXKO.js → chunk-ZS7JIUJ3.js} +12 -10
  235. package/dist/chunk-ZS7JIUJ3.js.map +1 -0
  236. package/dist/{clack-EZ7TDWQU.js → clack-Q4RNC5VE.js} +2 -6
  237. package/dist/{claude-cli-2YKABJJZ.js → claude-cli-GIIHOBGT.js} +4 -2
  238. package/dist/claude-install-BAUSJMW3.js +64 -0
  239. package/dist/{cli-E36SPKBW.js → cli-QY4KKA3D.js} +632 -150
  240. package/dist/cli-QY4KKA3D.js.map +1 -0
  241. package/dist/client-3YQKORVK.js +710 -0
  242. package/dist/client-3YQKORVK.js.map +1 -0
  243. package/dist/{codex-event-ZO2GEFE6.js → codex-event-EUTCAOTQ.js} +3 -5
  244. package/dist/{codex-host-KECJVTA2.js → codex-host-ZON3S6HU.js} +7 -7
  245. package/dist/{codex-install-HQZDGFXW.js → codex-install-HZV2DOAB.js} +242 -88
  246. package/dist/codex-install-HZV2DOAB.js.map +1 -0
  247. package/dist/config-QZOBMTEL.js +57 -0
  248. package/dist/config-names-Z5NZD5R2.js +224 -0
  249. package/dist/config-names-Z5NZD5R2.js.map +1 -0
  250. package/dist/config-rules-YOYHS6YL.js +55 -0
  251. package/dist/config-subagents-WQV2ZAD5.js +362 -0
  252. package/dist/config-subagents-WQV2ZAD5.js.map +1 -0
  253. package/dist/connect-YDWTYU4B.js +1020 -0
  254. package/dist/connect-YDWTYU4B.js.map +1 -0
  255. package/dist/core-0a66n3e7-TTP554XV.js +127 -0
  256. package/dist/core-0a66n3e7-TTP554XV.js.map +1 -0
  257. package/dist/core-0bmnpbz2-C2JIRVZO.js +10790 -0
  258. package/dist/core-0bmnpbz2-C2JIRVZO.js.map +1 -0
  259. package/dist/core-9je8ee1j-74DGHWPV.js +30 -0
  260. package/dist/core-9je8ee1j-74DGHWPV.js.map +1 -0
  261. package/dist/core-wadgcjfh-TSZFQZGH.js +666 -0
  262. package/dist/core-wadgcjfh-TSZFQZGH.js.map +1 -0
  263. package/dist/core-zg882d22-LKV5DZYW.js +37 -0
  264. package/dist/core-zg882d22-LKV5DZYW.js.map +1 -0
  265. package/dist/decision-QSKHOGCO.js +145 -0
  266. package/dist/{doctor-I6XQEKWD.js → doctor-ZWJXRD75.js} +162 -148
  267. package/dist/doctor-ZWJXRD75.js.map +1 -0
  268. package/dist/{env-proxy-R6ZMLQTT.js → env-proxy-XLSLHBKQ.js} +2 -2
  269. package/dist/{ethersCompat-Df4a6QIZ-X6YZWAML.js → ethersCompat-Df4a6QIZ-K3DMHR6Y.js} +5 -5
  270. package/dist/explicit-ME2NRADQ.js +371 -0
  271. package/dist/explicit-ME2NRADQ.js.map +1 -0
  272. package/dist/flush-stdio-NYIJ3QXT.js +18 -0
  273. package/dist/fund-VF7TLDJH.js +722 -0
  274. package/dist/fund-VF7TLDJH.js.map +1 -0
  275. package/dist/hook-command-VZ27MGWO.js +49 -0
  276. package/dist/hosts/claude/.claude-plugin/marketplace.json +2 -2
  277. package/dist/hosts/claude/tenjin/.claude-plugin/plugin.json +2 -2
  278. package/dist/hosts/claude/tenjin/hooks/hook-data.ts +152 -0
  279. package/dist/hosts/claude/tenjin/hooks/hooks.json +7 -0
  280. package/dist/hosts/claude/tenjin/hooks/model-viewer.tsx +2987 -0
  281. package/dist/hosts/claude/tenjin/hooks/register.tsx +527 -56
  282. package/dist/hosts/claude/tenjin/skills/tenjin-pay/SKILL.md +14 -4
  283. package/dist/hosts/claude/tenjin/types/index.d.ts +144 -1
  284. package/dist/{hosts-DVQJ32QC.js → hosts-3EMTVM4H.js} +7 -6
  285. package/dist/index.js +18 -15
  286. package/dist/index.js.map +1 -1
  287. package/dist/install-ZA7L2UF3.js +115 -0
  288. package/dist/install-funding-JDGYTF72.js +30 -0
  289. package/dist/install-identity-FFAYEFLX.js +30 -0
  290. package/dist/{install-wallet-5M4OTYLX.js → install-wallet-2SFOVE3Q.js} +68 -53
  291. package/dist/install-wallet-2SFOVE3Q.js.map +1 -0
  292. package/dist/mcp-36S6MK3C.js +67642 -0
  293. package/dist/mcp-36S6MK3C.js.map +1 -0
  294. package/dist/new-install-5L4GY3LN.js +51 -0
  295. package/dist/{package-IJFGMWEV.js → package-BONDXSV3.js} +2 -2
  296. package/dist/{passphrase-IFTDS3CU.js → passphrase-T4ULBN4M.js} +16 -12
  297. package/dist/{paths-XCSAKISU.js → paths-O2KDWZ76.js} +18 -28
  298. package/dist/pay-CMV5KL74.js +74 -0
  299. package/dist/{payments-HFPPWHTV.js → payments-Z6UBZL4Z.js} +36 -26
  300. package/dist/payments-Z6UBZL4Z.js.map +1 -0
  301. package/dist/reclaim-subagent-credit-ABSF67SJ.js +105 -0
  302. package/dist/reclaim-subagent-credit-ABSF67SJ.js.map +1 -0
  303. package/dist/{redact-D7ASVWKL.js → redact-LOTHE5TS.js} +2 -8
  304. package/dist/redact-LOTHE5TS.js.map +1 -0
  305. package/dist/routing-quote-AHLAREXR.js +40 -0
  306. package/dist/routing-quote-AHLAREXR.js.map +1 -0
  307. package/dist/run-JH7ELYAM.js +88 -0
  308. package/dist/run-JH7ELYAM.js.map +1 -0
  309. package/dist/runtime-2GX4ALJP.js +410 -0
  310. package/dist/runtime-2GX4ALJP.js.map +1 -0
  311. package/dist/runtime-activate-IDQ2NCSP.js +39 -0
  312. package/dist/runtime-activate-IDQ2NCSP.js.map +1 -0
  313. package/dist/{runtime-fetch-ZSSSK72Y.js → runtime-fetch-6LOBHBEN.js} +4 -4
  314. package/dist/runtime-fetch-6LOBHBEN.js.map +1 -0
  315. package/dist/runtime-launchers-YAPKCBHV.js +31 -0
  316. package/dist/runtime-launchers-YAPKCBHV.js.map +1 -0
  317. package/dist/{runtime-layout-WIDILZ6K.js → runtime-layout-QHZQJV7C.js} +5 -4
  318. package/dist/runtime-layout-QHZQJV7C.js.map +1 -0
  319. package/dist/runtime-place-4POL4KK4.js +37 -0
  320. package/dist/runtime-place-4POL4KK4.js.map +1 -0
  321. package/dist/runtime-provenance-MNJGVBV2.js +12 -0
  322. package/dist/runtime-provenance-MNJGVBV2.js.map +1 -0
  323. package/dist/{secp256k1-ZZZT2CAX.js → secp256k1-N5P2GVGF.js} +3 -3
  324. package/dist/secp256k1-N5P2GVGF.js.map +1 -0
  325. package/dist/{send-GCVEAQKL.js → send-ELXFKEKY.js} +35 -32
  326. package/dist/send-ELXFKEKY.js.map +1 -0
  327. package/dist/status-FXUFWJDM.js +404 -0
  328. package/dist/status-FXUFWJDM.js.map +1 -0
  329. package/dist/{status-line-OPCXDHL2.js → status-line-IH5JBWBC.js} +51 -43
  330. package/dist/status-line-IH5JBWBC.js.map +1 -0
  331. package/dist/streamableHttp-CP2ZQBIK.js +768 -0
  332. package/dist/streamableHttp-CP2ZQBIK.js.map +1 -0
  333. package/dist/{uninstall-BAWRBXXQ.js → uninstall-LJZUKM4D.js} +76 -76
  334. package/dist/uninstall-LJZUKM4D.js.map +1 -0
  335. package/dist/update-EUIX72IX.js +68 -0
  336. package/dist/update-EUIX72IX.js.map +1 -0
  337. package/dist/usage-EKDC7LUC.js +180 -0
  338. package/dist/usage-EKDC7LUC.js.map +1 -0
  339. package/dist/{usdc-VG4CIOUK.js → usdc-YIHK2OMC.js} +8 -12
  340. package/dist/usdc-YIHK2OMC.js.map +1 -0
  341. package/dist/{viemAdapter-By13KInL-DOFTEIJV.js → viemAdapter-By13KInL-PRLSIESK.js} +5 -5
  342. package/dist/viemAdapter-By13KInL-PRLSIESK.js.map +1 -0
  343. package/dist/wallet-HSW757W6.js +80 -0
  344. package/dist/wallet-HSW757W6.js.map +1 -0
  345. package/dist/wallet-kdf-worker.mjs +1433 -818
  346. package/docs/agent-permissions.md +88 -155
  347. package/docs/router-reference.md +236 -0
  348. package/docs/safety-model.md +31 -33
  349. package/docs/subagents-internals.md +97 -0
  350. package/docs/subagents.md +348 -0
  351. package/docs/troubleshooting.md +10 -6
  352. package/package.json +12 -8
  353. package/scripts/installers/install.sh +7 -1
  354. package/dist/alive-GSOWKUOY.js +0 -38
  355. package/dist/chunk-2I4QTOLB.js.map +0 -1
  356. package/dist/chunk-2M2VPI2E.js +0 -560
  357. package/dist/chunk-2M2VPI2E.js.map +0 -1
  358. package/dist/chunk-2RWB7RKE.js.map +0 -1
  359. package/dist/chunk-2SNUOHAT.js.map +0 -1
  360. package/dist/chunk-3623BLPV.js +0 -184
  361. package/dist/chunk-3623BLPV.js.map +0 -1
  362. package/dist/chunk-36RVGZNY.js.map +0 -1
  363. package/dist/chunk-3AIHRXKO.js.map +0 -1
  364. package/dist/chunk-3FMZGI7I.js.map +0 -1
  365. package/dist/chunk-3UCIG4TG.js.map +0 -1
  366. package/dist/chunk-4K7TQHNP.js.map +0 -1
  367. package/dist/chunk-4LMUQMBH.js +0 -29
  368. package/dist/chunk-4LMUQMBH.js.map +0 -1
  369. package/dist/chunk-4USCZ2NI.js +0 -228
  370. package/dist/chunk-4USCZ2NI.js.map +0 -1
  371. package/dist/chunk-4YOZGGTZ.js.map +0 -1
  372. package/dist/chunk-62KNUYWD.js +0 -111
  373. package/dist/chunk-62KNUYWD.js.map +0 -1
  374. package/dist/chunk-A5GKIG5O.js +0 -2037
  375. package/dist/chunk-A5GKIG5O.js.map +0 -1
  376. package/dist/chunk-AGMVASXZ.js.map +0 -1
  377. package/dist/chunk-BF4XHEQK.js.map +0 -1
  378. package/dist/chunk-BFDQ4WNW.js.map +0 -1
  379. package/dist/chunk-C2Q76BVM.js.map +0 -1
  380. package/dist/chunk-CEXSOI5R.js +0 -808
  381. package/dist/chunk-CEXSOI5R.js.map +0 -1
  382. package/dist/chunk-E7SW44LM.js.map +0 -1
  383. package/dist/chunk-EDJWHDDL.js +0 -33
  384. package/dist/chunk-EDJWHDDL.js.map +0 -1
  385. package/dist/chunk-FVIGCDSV.js.map +0 -1
  386. package/dist/chunk-GTTUCOPD.js +0 -105
  387. package/dist/chunk-GTTUCOPD.js.map +0 -1
  388. package/dist/chunk-HDPUXS3Z.js +0 -122
  389. package/dist/chunk-HDPUXS3Z.js.map +0 -1
  390. package/dist/chunk-HGGWCP7W.js +0 -120
  391. package/dist/chunk-HGGWCP7W.js.map +0 -1
  392. package/dist/chunk-HGZEPQUT.js.map +0 -1
  393. package/dist/chunk-HMWYAUA6.js.map +0 -1
  394. package/dist/chunk-IADZOXKN.js.map +0 -1
  395. package/dist/chunk-ILNIZ5I2.js.map +0 -1
  396. package/dist/chunk-INTFHMU4.js.map +0 -1
  397. package/dist/chunk-JKKAIPTU.js.map +0 -1
  398. package/dist/chunk-JNJWBTU2.js.map +0 -1
  399. package/dist/chunk-KM7RY2ZS.js +0 -246
  400. package/dist/chunk-KM7RY2ZS.js.map +0 -1
  401. package/dist/chunk-KOGZDMHO.js +0 -21
  402. package/dist/chunk-KOGZDMHO.js.map +0 -1
  403. package/dist/chunk-L6JEXB3E.js.map +0 -1
  404. package/dist/chunk-LRW6S53P.js.map +0 -1
  405. package/dist/chunk-LXAYUOXI.js +0 -511
  406. package/dist/chunk-LXAYUOXI.js.map +0 -1
  407. package/dist/chunk-MEFB5KHA.js +0 -59
  408. package/dist/chunk-MEFB5KHA.js.map +0 -1
  409. package/dist/chunk-MPZUYCAP.js.map +0 -1
  410. package/dist/chunk-NDGZDTSJ.js.map +0 -1
  411. package/dist/chunk-OJNTCYQQ.js.map +0 -1
  412. package/dist/chunk-P3LFTKE7.js +0 -58
  413. package/dist/chunk-P3LFTKE7.js.map +0 -1
  414. package/dist/chunk-QXP3Z3JN.js.map +0 -1
  415. package/dist/chunk-RVPYTUP4.js.map +0 -1
  416. package/dist/chunk-SNNSAGMT.js.map +0 -1
  417. package/dist/chunk-TC2WZLSC.js.map +0 -1
  418. package/dist/chunk-TKPF35W6.js +0 -29
  419. package/dist/chunk-TKPF35W6.js.map +0 -1
  420. package/dist/chunk-U3IKUGRP.js.map +0 -1
  421. package/dist/chunk-UUGOUOVT.js.map +0 -1
  422. package/dist/chunk-UXZONNEQ.js.map +0 -1
  423. package/dist/chunk-WXA2BWTE.js.map +0 -1
  424. package/dist/chunk-WYXUQGOL.js.map +0 -1
  425. package/dist/chunk-X5ZBP3IY.js.map +0 -1
  426. package/dist/chunk-XKESD27X.js +0 -10
  427. package/dist/chunk-XKESD27X.js.map +0 -1
  428. package/dist/chunk-XQJXNMSB.js.map +0 -1
  429. package/dist/chunk-Y527D4TV.js +0 -56
  430. package/dist/chunk-Y527D4TV.js.map +0 -1
  431. package/dist/chunk-ZDZERB6L.js.map +0 -1
  432. package/dist/chunk-ZNNXRNFD.js.map +0 -1
  433. package/dist/chunk-ZURZHELF.js.map +0 -1
  434. package/dist/cli-E36SPKBW.js.map +0 -1
  435. package/dist/codex-install-HQZDGFXW.js.map +0 -1
  436. package/dist/config-HY2E4GGW.js +0 -55
  437. package/dist/doctor-I6XQEKWD.js.map +0 -1
  438. package/dist/fund-2QRO7OJL.js +0 -378
  439. package/dist/fund-2QRO7OJL.js.map +0 -1
  440. package/dist/hook-command-2UBCSZG6.js +0 -43
  441. package/dist/install-ILUX5C4A.js +0 -107
  442. package/dist/install-identity-TZKGY6LQ.js +0 -31
  443. package/dist/install-wallet-5M4OTYLX.js.map +0 -1
  444. package/dist/mcp-LE4DUS22.js +0 -14127
  445. package/dist/mcp-LE4DUS22.js.map +0 -1
  446. package/dist/pay-WCG3IH4R.js +0 -55
  447. package/dist/payments-HFPPWHTV.js.map +0 -1
  448. package/dist/plugin-registration-PZFI5GZW.js +0 -68
  449. package/dist/runtime-UZOKSUZX.js +0 -1321
  450. package/dist/runtime-UZOKSUZX.js.map +0 -1
  451. package/dist/send-GCVEAQKL.js.map +0 -1
  452. package/dist/status-HCVAOCN7.js +0 -150
  453. package/dist/status-HCVAOCN7.js.map +0 -1
  454. package/dist/status-line-OPCXDHL2.js.map +0 -1
  455. package/dist/uninstall-BAWRBXXQ.js.map +0 -1
  456. package/dist/update-CACXLQLR.js +0 -56
  457. package/dist/wallet-QL4UUXEZ.js +0 -55
  458. /package/dist/{_esm-BIN7VY2L.js.map → _esm-2KST7HQ7.js.map} +0 -0
  459. /package/dist/{alive-GSOWKUOY.js.map → alive-5TV22PNF.js.map} +0 -0
  460. /package/dist/{auto-update-Y24UL56V.js.map → auth-XI7BJFLW.js.map} +0 -0
  461. /package/dist/{ccip-DHDFKTQV.js.map → auto-update-7L24KDWA.js.map} +0 -0
  462. /package/dist/{clack-EZ7TDWQU.js.map → balance-DFHC6XEU.js.map} +0 -0
  463. /package/dist/{claude-cli-2YKABJJZ.js.map → ccip-HOW3DZYF.js.map} +0 -0
  464. /package/dist/{chunk-IE7P2BZE.js.map → chunk-6QMDUDF2.js.map} +0 -0
  465. /package/dist/{chunk-KG3D7FIF.js.map → chunk-CZJOMUBP.js.map} +0 -0
  466. /package/dist/{chunk-3GNJXKIT.js.map → chunk-F43CV6UC.js.map} +0 -0
  467. /package/dist/{chunk-J57UC3DD.js.map → chunk-FKVJKLPI.js.map} +0 -0
  468. /package/dist/{chunk-SO3XRZPX.js.map → chunk-HPRVFJPM.js.map} +0 -0
  469. /package/dist/{chunk-2GP3HRYK.js.map → chunk-INSIW65E.js.map} +0 -0
  470. /package/dist/{chunk-RL5UUDT4.js.map → chunk-JNUKLSMZ.js.map} +0 -0
  471. /package/dist/{chunk-JRGFKVAZ.js.map → chunk-PETQ5WEA.js.map} +0 -0
  472. /package/dist/{codex-event-ZO2GEFE6.js.map → chunk-TUCKEEXE.js.map} +0 -0
  473. /package/dist/{chunk-BPMWXTFX.js.map → chunk-WFZX352D.js.map} +0 -0
  474. /package/dist/{chunk-6CMM6YCB.js.map → chunk-YWWMISDY.js.map} +0 -0
  475. /package/dist/{codex-host-KECJVTA2.js.map → clack-Q4RNC5VE.js.map} +0 -0
  476. /package/dist/{config-HY2E4GGW.js.map → claude-cli-GIIHOBGT.js.map} +0 -0
  477. /package/dist/{env-proxy-R6ZMLQTT.js.map → claude-install-BAUSJMW3.js.map} +0 -0
  478. /package/dist/{ethersCompat-Df4a6QIZ-X6YZWAML.js.map → codex-event-EUTCAOTQ.js.map} +0 -0
  479. /package/dist/{hook-command-2UBCSZG6.js.map → codex-host-ZON3S6HU.js.map} +0 -0
  480. /package/dist/{hosts-DVQJ32QC.js.map → config-QZOBMTEL.js.map} +0 -0
  481. /package/dist/{install-ILUX5C4A.js.map → config-rules-YOYHS6YL.js.map} +0 -0
  482. /package/dist/{install-identity-TZKGY6LQ.js.map → decision-QSKHOGCO.js.map} +0 -0
  483. /package/dist/{package-IJFGMWEV.js.map → env-proxy-XLSLHBKQ.js.map} +0 -0
  484. /package/dist/{passphrase-IFTDS3CU.js.map → ethersCompat-Df4a6QIZ-K3DMHR6Y.js.map} +0 -0
  485. /package/dist/{paths-XCSAKISU.js.map → flush-stdio-NYIJ3QXT.js.map} +0 -0
  486. /package/dist/{pay-WCG3IH4R.js.map → hook-command-VZ27MGWO.js.map} +0 -0
  487. /package/dist/{plugin-registration-PZFI5GZW.js.map → hosts-3EMTVM4H.js.map} +0 -0
  488. /package/dist/{redact-D7ASVWKL.js.map → install-ZA7L2UF3.js.map} +0 -0
  489. /package/dist/{runtime-fetch-ZSSSK72Y.js.map → install-funding-JDGYTF72.js.map} +0 -0
  490. /package/dist/{runtime-layout-WIDILZ6K.js.map → install-identity-FFAYEFLX.js.map} +0 -0
  491. /package/dist/{secp256k1-ZZZT2CAX.js.map → new-install-5L4GY3LN.js.map} +0 -0
  492. /package/dist/{update-CACXLQLR.js.map → package-BONDXSV3.js.map} +0 -0
  493. /package/dist/{usdc-VG4CIOUK.js.map → passphrase-T4ULBN4M.js.map} +0 -0
  494. /package/dist/{viemAdapter-By13KInL-DOFTEIJV.js.map → paths-O2KDWZ76.js.map} +0 -0
  495. /package/dist/{wallet-QL4UUXEZ.js.map → pay-CMV5KL74.js.map} +0 -0
@@ -0,0 +1,722 @@
1
+ import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
+ import {
3
+ openInBrowser
4
+ } from "./chunk-U4TRWSVE.js";
5
+ import {
6
+ underAgentHarness
7
+ } from "./chunk-WXA3WTPF.js";
8
+ import {
9
+ addressQrLines,
10
+ textQrLines
11
+ } from "./chunk-VU6GMWF6.js";
12
+ import {
13
+ liveLine
14
+ } from "./chunk-DJ36BM62.js";
15
+ import {
16
+ LINK_LIFETIME_MS,
17
+ STATUS_GRACE_MS,
18
+ dollars,
19
+ forgetLink,
20
+ inFlight,
21
+ readLinkStatus,
22
+ recallLink,
23
+ rememberLink,
24
+ tokenExpiry,
25
+ tokenOf,
26
+ watchFunding
27
+ } from "./chunk-W7ELYLYK.js";
28
+ import {
29
+ SIWX_CHAIN_ID,
30
+ SIWX_HEADER,
31
+ buildSiwxHeader
32
+ } from "./chunk-OQWPRFAC.js";
33
+ import {
34
+ describeWallet,
35
+ resolveWalletProvider
36
+ } from "./chunk-K5KNGC4I.js";
37
+ import "./chunk-FYFHH7V5.js";
38
+ import "./chunk-HPRVFJPM.js";
39
+ import "./chunk-RGVCOG2S.js";
40
+ import "./chunk-FKVJKLPI.js";
41
+ import "./chunk-YWWMISDY.js";
42
+ import "./chunk-JNUKLSMZ.js";
43
+ import "./chunk-HI5XQOX2.js";
44
+ import "./chunk-XRGFH7FI.js";
45
+ import {
46
+ getUsdcBalance
47
+ } from "./chunk-IGLWLH73.js";
48
+ import "./chunk-7V25UAQO.js";
49
+ import "./chunk-PETQ5WEA.js";
50
+ import {
51
+ getAddress,
52
+ isAddress
53
+ } from "./chunk-INSIW65E.js";
54
+ import "./chunk-CZJOMUBP.js";
55
+ import "./chunk-RBJPAZFI.js";
56
+ import "./chunk-WFZX352D.js";
57
+ import "./chunk-ZS7JIUJ3.js";
58
+ import "./chunk-JWAK7JQB.js";
59
+ import "./chunk-2W4DQQUU.js";
60
+ import {
61
+ emitWriteNotice,
62
+ paint,
63
+ style
64
+ } from "./chunk-KLDMLWXT.js";
65
+ import {
66
+ SUGGESTED_FUND_USD
67
+ } from "./chunk-HZKANST2.js";
68
+ import {
69
+ toMoney
70
+ } from "./chunk-MEZJ3I63.js";
71
+ import "./chunk-RFZA7PSM.js";
72
+ import "./chunk-JUUBBBY5.js";
73
+ import {
74
+ loadRawConfig,
75
+ resolveSettings
76
+ } from "./chunk-UIB33QQP.js";
77
+ import "./chunk-7WEQQJLG.js";
78
+ import "./chunk-ZCT5DJ3G.js";
79
+ import "./chunk-3MZ7DYRO.js";
80
+ import "./chunk-JTX3BUDK.js";
81
+ import "./chunk-ZEYA2WWX.js";
82
+ import "./chunk-DIH2G3YG.js";
83
+ import {
84
+ fetchFailureToCliError,
85
+ httpRequest
86
+ } from "./chunk-D6M3ZK66.js";
87
+ import "./chunk-RGCPELQN.js";
88
+ import {
89
+ PRODUCTION_ORIGIN
90
+ } from "./chunk-CRG54LEB.js";
91
+ import "./chunk-TUCKEEXE.js";
92
+ import "./chunk-P6YQWIT2.js";
93
+ import {
94
+ CliError
95
+ } from "./chunk-DI4QAGRZ.js";
96
+ import "./chunk-3Y2EHT4F.js";
97
+ import "./chunk-ZXTAQYNA.js";
98
+
99
+ // src/lib/device-name.ts
100
+ import { execFile } from "node:child_process";
101
+ import { hostname } from "node:os";
102
+ var GENERATED_HOSTNAME = [
103
+ /^(desktop|laptop|win)-[a-z0-9]{5,}$/i,
104
+ // Windows' default names
105
+ /^ip-\d{1,3}-\d{1,3}-\d{1,3}-\d{1,3}\b/i,
106
+ // AWS
107
+ /^[0-9a-f]{12}([0-9a-f]{52})?$/i,
108
+ // a Docker container id
109
+ /^codespaces-[0-9a-z]+$/i,
110
+ // GitHub Codespaces
111
+ /^(localhost|\d{1,3}(\.\d{1,3}){3})(\.localdomain)?$/i
112
+ ];
113
+ var MAX_DEVICE_NAME = 64;
114
+ var SCUTIL = "/usr/sbin/scutil";
115
+ var SCUTIL_TIMEOUT_MS = 1e3;
116
+ async function deviceName(deps = {}) {
117
+ try {
118
+ const platform = deps.platform ?? process.platform;
119
+ const fromMac = platform === "darwin" ? await (deps.computerName ?? macComputerName)() : null;
120
+ const named = clean(fromMac ?? "");
121
+ if (named !== void 0) return named;
122
+ const host = clean((deps.hostname ?? hostname)());
123
+ return host !== void 0 && GENERATED_HOSTNAME.some((re) => re.test(host)) ? void 0 : host;
124
+ } catch {
125
+ return void 0;
126
+ }
127
+ }
128
+ function clean(raw) {
129
+ const printable = raw.replace(/[\x00-\x1f\x7f-\x9f\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069\ufeff]/g, "").trim().replace(/\.local$/i, "").trim();
130
+ const capped = [...printable].slice(0, MAX_DEVICE_NAME).join("").trim();
131
+ return capped.length > 0 ? capped : void 0;
132
+ }
133
+ function macComputerName() {
134
+ return new Promise((resolve) => {
135
+ execFile(
136
+ SCUTIL,
137
+ ["--get", "ComputerName"],
138
+ { timeout: SCUTIL_TIMEOUT_MS, windowsHide: true },
139
+ (err, stdout) => resolve(err === null ? String(stdout) : null)
140
+ );
141
+ });
142
+ }
143
+
144
+ // src/lib/machine-id.ts
145
+ import { execFile as execFile2 } from "node:child_process";
146
+ import { createHash } from "node:crypto";
147
+ import { readFile } from "node:fs/promises";
148
+ import { win32 } from "node:path";
149
+ var HASH_PREFIX = "tenjin-promo-machine-v1:";
150
+ var READ_TIMEOUT_MS = 1500;
151
+ var IOREG = "/usr/sbin/ioreg";
152
+ var LINUX_ID_FILES = ["/etc/machine-id", "/var/lib/dbus/machine-id"];
153
+ var PLAUSIBLE_ID = /^[0-9a-f-]{16,64}$/;
154
+ async function machineHash(deps = {}) {
155
+ try {
156
+ const raw = await rawMachineId(deps);
157
+ if (raw === void 0) return void 0;
158
+ return createHash("sha256").update(`${HASH_PREFIX}${raw}`).digest("hex");
159
+ } catch {
160
+ return void 0;
161
+ }
162
+ }
163
+ async function rawMachineId(deps) {
164
+ const platform = deps.platform ?? process.platform;
165
+ if (platform === "darwin") {
166
+ const out = await run(deps, IOREG, ["-rd1", "-c", "IOPlatformExpertDevice"]);
167
+ return plausible(/"IOPlatformUUID"\s*=\s*"([^"]+)"/.exec(out ?? "")?.[1]);
168
+ }
169
+ if (platform === "linux") {
170
+ const read = deps.readFileImpl ?? ((path) => readFile(path, "utf8"));
171
+ for (const path of LINUX_ID_FILES) {
172
+ const id = plausible(await read(path).catch(() => void 0));
173
+ if (id !== void 0) return id;
174
+ }
175
+ return void 0;
176
+ }
177
+ if (platform === "win32") {
178
+ const root = (deps.env ?? process.env).SystemRoot ?? "C:\\Windows";
179
+ const out = await run(deps, win32.join(root, "System32", "reg.exe"), [
180
+ "query",
181
+ "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography",
182
+ "/v",
183
+ "MachineGuid",
184
+ "/reg:64"
185
+ ]);
186
+ return plausible(/^\s*MachineGuid\s+REG_SZ\s+(\S+)\s*$/im.exec(out ?? "")?.[1]);
187
+ }
188
+ return void 0;
189
+ }
190
+ function plausible(raw) {
191
+ const id = raw?.trim().toLowerCase();
192
+ if (id === void 0 || !PLAUSIBLE_ID.test(id)) return void 0;
193
+ return /[1-9a-f]/.test(id) ? id : void 0;
194
+ }
195
+ function run(deps, cmd, args) {
196
+ const exec = deps.execFileImpl ?? execFile2;
197
+ return new Promise((resolve) => {
198
+ try {
199
+ exec(
200
+ cmd,
201
+ args,
202
+ { timeout: READ_TIMEOUT_MS, windowsHide: true, encoding: "utf8" },
203
+ (err, stdout) => resolve(err === null ? String(stdout) : void 0)
204
+ );
205
+ } catch {
206
+ resolve(void 0);
207
+ }
208
+ });
209
+ }
210
+
211
+ // src/commands/fund.ts
212
+ var COINBASE_CHECKOUT_HOST = "pay.coinbase.com";
213
+ var HOSTED_LIFETIME_MS = 5 * 6e4;
214
+ var FUND_ORIGIN = PRODUCTION_ORIGIN;
215
+ var ALLOWED_CHECKOUT_HOSTS = [
216
+ new URL(FUND_ORIGIN).host,
217
+ COINBASE_CHECKOUT_HOST
218
+ ];
219
+ var MAX_PRESET_USD = 1e5;
220
+ var NEED_LABEL_MAX = 60;
221
+ var NEED_PRICE_MAX_USD = 100;
222
+ var BASELINE_TIMEOUT_MS = 4e3;
223
+ var DUPLICATE_WINDOW_MS = 15 * 6e4;
224
+ var USDC_WAIT_MS = 15 * 6e4;
225
+ async function runFund(ctx, opts = {}) {
226
+ const preset = parsePreset(opts.amountUsd);
227
+ const need = parseNeed(opts.forLabel, opts.priceUsd);
228
+ const env = opts.env ?? process.env;
229
+ const now = opts.now ?? Date.now;
230
+ const human = ctx.io.isTTY && !ctx.flags.json;
231
+ const provider = resolveWalletProvider(ctx, opts);
232
+ const desc = await describeWallet(provider);
233
+ const address = checksummed(desc.address);
234
+ const config = await loadRawConfig(ctx.dataDir);
235
+ const settings = resolveSettings({ config, flags: {}, env: process.env });
236
+ const rpcUrl = settings.rpcUrl.value;
237
+ const readBalance = () => balanceOrUndefined(address, rpcUrl);
238
+ const shouldWait = opts.wait ?? ctx.io.isTTY;
239
+ const live = opts.live ?? liveLine(ctx.io.stderr);
240
+ const err = ctx.io.stderr;
241
+ const say = (line = "") => err.write(`${line}
242
+ `);
243
+ const dim = (text) => style("dim", text, err);
244
+ if (opts.usdc === true) {
245
+ return fundByUsdc(ctx, { address, readBalance, human, shouldWait, live, say, dim, opts });
246
+ }
247
+ const startBalance = await withTimeout(readBalance(), BASELINE_TIMEOUT_MS);
248
+ if (human && opts.header !== false) {
249
+ say();
250
+ say(` ${style("bold", "Add funds to Tenjin", err)}`);
251
+ say();
252
+ if (startBalance !== void 0) say(` Balance ${dollars(startBalance)}`);
253
+ }
254
+ const prior = await recallLink(ctx.dataDir, address, now());
255
+ const onItsWay = prior !== null && now() - prior.issuedAt < DUPLICATE_WINDOW_MS ? await paymentOnItsWay(prior, startBalance, opts.fetchImpl) : void 0;
256
+ const source = opts.source ?? (underAgentHarness(env) ? "agent" : "terminal");
257
+ let signer;
258
+ const mint = async () => {
259
+ signer ??= await provider.getSigner();
260
+ const [deviceName2, machineHash2] = await Promise.all([
261
+ (opts.deviceName ?? deviceName)().catch(() => void 0),
262
+ (opts.machineHash ?? machineHash)().catch(() => void 0)
263
+ ]);
264
+ const url = await mintLink(ctx, signer, address, {
265
+ ...preset !== void 0 ? { presetAmount: preset } : {},
266
+ ...need !== void 0 ? { need } : {},
267
+ source,
268
+ deviceName: deviceName2,
269
+ machineHash: machineHash2,
270
+ ...opts.fetchImpl !== void 0 ? { fetchImpl: opts.fetchImpl } : {}
271
+ });
272
+ const token = tokenOf(url);
273
+ const hosted = new URL(url).host === COINBASE_CHECKOUT_HOST;
274
+ const issuedAt = now();
275
+ const expiresAt = (token !== void 0 ? tokenExpiry(token) : void 0) ?? issuedAt + (hosted ? HOSTED_LIFETIME_MS : LINK_LIFETIME_MS);
276
+ await rememberLink(ctx.dataDir, {
277
+ version: 1,
278
+ address: address.toLowerCase(),
279
+ url,
280
+ ...token !== void 0 ? { token } : {},
281
+ issuedAt,
282
+ expiresAt,
283
+ ...startBalance !== void 0 ? { startBalanceAtomic: startBalance.toString() } : {}
284
+ });
285
+ return { url, ...token !== void 0 ? { token } : {}, expiresAt, hosted };
286
+ };
287
+ let link = onItsWay !== void 0 ? {
288
+ // On its way means it had a token, so it is a Tenjin link with a url.
289
+ url: prior.url,
290
+ ...prior.token !== void 0 ? { token: prior.token } : {},
291
+ expiresAt: prior.expiresAt,
292
+ hosted: false
293
+ } : await mint();
294
+ if (!human) {
295
+ emitWriteNotice(
296
+ ctx.io,
297
+ `${onItsWay !== void 0 ? "Payment on its way, from" : "Checkout"}: ${link.url}`
298
+ );
299
+ emitWriteNotice(
300
+ ctx.io,
301
+ link.hosted ? "The link is single-use, expires in ~5 minutes, and only works in a browser on this machine (it is bound to this network)." : "The link expires in about 10 minutes."
302
+ );
303
+ }
304
+ const willOpen = onItsWay === void 0 && opts.open !== false && (ctx.io.isTTY || underAgentHarness(env));
305
+ const show = async (issued) => {
306
+ const browser = browserAvailable(env, opts.platform ?? process.platform);
307
+ const opened2 = willOpen && browser ? await (opts.openUrl ?? openInBrowser)(issued.url) : false;
308
+ if (!human) return opened2;
309
+ if (onItsWay !== void 0) {
310
+ say();
311
+ say(" A payment is already on its way.");
312
+ say(` ${dim(issued.url)}`);
313
+ } else if (opened2) {
314
+ say(" Checkout opened in your browser");
315
+ say(` ${dim(issued.url)}`);
316
+ } else if (!willOpen) {
317
+ say(" Checkout open this link to pay:");
318
+ say(` ${issued.url}`);
319
+ } else {
320
+ const qr = opts.qr !== false ? textQrLines(issued.url, err) : [];
321
+ say();
322
+ if (qr.length > 0) {
323
+ say(
324
+ browser ? " Couldn't open a browser. Scan to pay on your phone:" : " No browser on this machine. Scan to pay on your phone:"
325
+ );
326
+ for (const line of qr) say(` ${line}`);
327
+ say(` or open ${issued.url}`);
328
+ } else {
329
+ say(
330
+ browser ? " Couldn't open a browser. Open this link to pay:" : " No browser on this machine. Open this link to pay:"
331
+ );
332
+ say(` ${issued.url}`);
333
+ }
334
+ }
335
+ say();
336
+ return opened2;
337
+ };
338
+ let opened = await show(link);
339
+ let pollStatus = "skipped";
340
+ let end;
341
+ if (shouldWait && startBalance === void 0) pollStatus = "unavailable";
342
+ if (shouldWait && startBalance !== void 0) {
343
+ const stopInterrupt = human ? onInterrupt(live, say, opts.onStopLines) : () => void 0;
344
+ try {
345
+ for (; ; ) {
346
+ end = await watchFunding({
347
+ startBalance,
348
+ readBalance,
349
+ ...link.token !== void 0 ? { token: link.token } : {},
350
+ expiresAt: link.expiresAt,
351
+ deadline: opts.pollTimeoutMs !== void 0 ? now() + opts.pollTimeoutMs : link.expiresAt + STATUS_GRACE_MS,
352
+ view: "checkout",
353
+ ...human ? { live } : {},
354
+ ...opts.fetchImpl !== void 0 ? { fetchImpl: opts.fetchImpl } : {},
355
+ ...opts.sleep !== void 0 ? { sleep: opts.sleep } : {},
356
+ ...opts.pollIntervalMs !== void 0 ? { intervalMs: opts.pollIntervalMs } : {},
357
+ now
358
+ });
359
+ if (end.kind !== "expired" || !human) break;
360
+ live.warn(
361
+ end.statusKnown ? "The checkout link expired. Nothing was charged." : "The checkout link expired."
362
+ );
363
+ if (!end.statusKnown) say(" If you paid, it still lands; `tenjin balance` shows it.");
364
+ const ask = opts.readKey ?? (process.stdin.isTTY ? readKey : void 0);
365
+ if (ask === void 0) break;
366
+ say(` ${style("bold", "r", err)} new link ${style("bold", "q", err)} stop`);
367
+ const key = await ask(["r", "q"]);
368
+ if (key !== "r") break;
369
+ say();
370
+ link = await mint();
371
+ opened = await show(link);
372
+ }
373
+ } finally {
374
+ stopInterrupt();
375
+ live.stop();
376
+ }
377
+ pollStatus = end.kind === "arrived" ? "arrived" : "timed-out";
378
+ }
379
+ const arrived = end?.kind === "arrived" ? end : void 0;
380
+ if (arrived !== void 0) await forgetLink(ctx.dataDir);
381
+ const status = end?.status ?? onItsWay;
382
+ const balanceAtomic = arrived?.balance ?? startBalance;
383
+ const amount = preset !== void 0 ? String(preset) : SUGGESTED_FUND_USD;
384
+ return {
385
+ data: {
386
+ address,
387
+ checkoutUrl: link.url,
388
+ opened,
389
+ ...preset !== void 0 ? { presetAmount: preset } : {},
390
+ funded: arrived !== void 0,
391
+ pollStatus,
392
+ ...status !== void 0 ? { status: status.state } : {},
393
+ ...onItsWay !== void 0 ? { paymentInFlight: true } : {},
394
+ // The link expired and this round's status read said no payment is on it.
395
+ ...end?.kind === "expired" && end.statusKnown ? { nothingCharged: true } : {},
396
+ source,
397
+ ...need !== void 0 ? { need } : {},
398
+ nextStep: arrived !== void 0 ? "Funds confirmed. Continue the original task; funding does not require another restart." : agentNextStep({
399
+ opened,
400
+ amount,
401
+ inFlight: onItsWay !== void 0,
402
+ ...need ? { need } : {}
403
+ }),
404
+ ...balanceAtomic !== void 0 ? { balance: toMoney(balanceAtomic.toString()) } : {},
405
+ ...arrived !== void 0 ? { added: toMoney(arrived.added.toString()) } : {}
406
+ },
407
+ humanLines: humanEnding(ctx.io, pollStatus, end, arrived?.balance)
408
+ };
409
+ }
410
+ function humanEnding(io, pollStatus, end, balance) {
411
+ if (pollStatus === "arrived" && balance !== void 0) {
412
+ return [
413
+ "",
414
+ ` Balance ${paint(io, "bold", dollars(balance))}`,
415
+ " You can close the browser tab."
416
+ ];
417
+ }
418
+ if (pollStatus === "unavailable") {
419
+ return [
420
+ " Couldn't read your balance to watch for the payment. The link still works,",
421
+ " and `tenjin balance` shows the payment once it lands."
422
+ ];
423
+ }
424
+ if (pollStatus === "skipped") {
425
+ return [" `tenjin balance --wait` tells you when the payment lands."];
426
+ }
427
+ if (end?.kind === "expired") {
428
+ return ["", " Run `tenjin fund` for a fresh link when you are ready."];
429
+ }
430
+ return [
431
+ "",
432
+ " The payment hasn't reached your balance yet. It still can:",
433
+ " `tenjin balance --wait` watches for it."
434
+ ];
435
+ }
436
+ function agentNextStep(o) {
437
+ const wait = "run `tenjin balance --wait` in the background, with the same Tenjin executable and shell as this command (in Claude Code, as a background Bash command, so you are woken when it exits), and continue the task when it exits: exit 0 means the funds arrived, and its output says how much. If it exits without funds, say once that nothing arrived and nothing went wrong, and continue without paid tools.";
438
+ if (o.inFlight) {
439
+ return `A payment for this machine is already on its way, so no second checkout was opened; do not open another. Tell the person in one sentence, then ${wait} Never ask the person to type "done" or to tell you when the money arrives.`;
440
+ }
441
+ const what = o.need !== void 0 ? `what the money is for (${o.need.label}, $${o.need.priceUsd} a call)` : "what the money is for (the paid tool you wanted and its price, if there is one)";
442
+ const where = o.opened ? `that checkout is open in their browser with $${o.amount} filled in` : `that checkout is ready with $${o.amount} filled in, and show checkoutUrl as a clickable link`;
443
+ return `Tell the person in one or two sentences ${what} and ${where}. Then ${wait} Never ask the person to type "done" or to tell you when they have paid. Ask about adding funds at most once per session: if they decline, carry on without paid tools and do not offer again. Do not open another checkout unless they ask for a new link.`;
444
+ }
445
+ async function fundByUsdc(ctx, c) {
446
+ const { address, human, say, dim, opts } = c;
447
+ const now = opts.now ?? Date.now;
448
+ const warning = "Only USDC, only on the Base network. Anything else can't be recovered.";
449
+ const check = `starts ${address.slice(0, 6)} \xB7 ends ${address.slice(-4)}`;
450
+ const startBalance = c.shouldWait ? await c.readBalance() : await withTimeout(c.readBalance(), BASELINE_TIMEOUT_MS);
451
+ if (startBalance !== void 0) {
452
+ const prior = await recallLink(ctx.dataDir, address, now());
453
+ if (prior?.token === void 0) {
454
+ const issuedAt = now();
455
+ await rememberLink(ctx.dataDir, {
456
+ version: 1,
457
+ address: address.toLowerCase(),
458
+ issuedAt,
459
+ expiresAt: issuedAt + USDC_WAIT_MS,
460
+ startBalanceAtomic: startBalance.toString()
461
+ });
462
+ } else if (prior.startBalanceAtomic === void 0 || startBalance < BigInt(prior.startBalanceAtomic)) {
463
+ await rememberLink(ctx.dataDir, { ...prior, startBalanceAtomic: startBalance.toString() });
464
+ }
465
+ }
466
+ if (human) {
467
+ const err = ctx.io.stderr;
468
+ say();
469
+ say(` ${style("bold", "Send USDC to add funds", ctx.io.stderr)}`);
470
+ say();
471
+ say(` ${style("yellow", warning, err)}`);
472
+ say();
473
+ say(` ${style("bold", address, err)}`);
474
+ say(` ${dim(check)}`);
475
+ const qr = opts.qr !== false ? addressQrLines(address, err) : [];
476
+ if (qr.length > 0) {
477
+ say();
478
+ for (const line of qr) say(` ${line}`);
479
+ }
480
+ say();
481
+ } else {
482
+ emitWriteNotice(ctx.io, `Send USDC to ${address} (${check}).`);
483
+ emitWriteNotice(ctx.io, warning);
484
+ }
485
+ let end;
486
+ let pollStatus = c.shouldWait ? "unavailable" : "skipped";
487
+ if (c.shouldWait && startBalance !== void 0) {
488
+ const stopInterrupt = human ? onInterrupt(c.live, say, opts.onStopLines) : () => void 0;
489
+ try {
490
+ end = await watchFunding({
491
+ startBalance,
492
+ readBalance: c.readBalance,
493
+ deadline: now() + (opts.pollTimeoutMs ?? USDC_WAIT_MS),
494
+ view: "usdc",
495
+ ...human ? { live: c.live } : {},
496
+ ...opts.sleep !== void 0 ? { sleep: opts.sleep } : {},
497
+ ...opts.pollIntervalMs !== void 0 ? { intervalMs: opts.pollIntervalMs } : {},
498
+ now
499
+ });
500
+ } finally {
501
+ stopInterrupt();
502
+ c.live.stop();
503
+ }
504
+ pollStatus = end.kind === "arrived" ? "arrived" : "timed-out";
505
+ }
506
+ const arrived = end?.kind === "arrived" ? end : void 0;
507
+ if (arrived !== void 0) await forgetLink(ctx.dataDir);
508
+ const balanceAtomic = arrived?.balance ?? startBalance;
509
+ return {
510
+ data: {
511
+ address,
512
+ usdc: true,
513
+ funded: arrived !== void 0,
514
+ pollStatus,
515
+ nextStep: arrived !== void 0 ? "Funds confirmed. Continue the original task; funding does not require another restart." : `Give the person the address exactly as printed, with the rule "${warning}" Then run \`tenjin balance --wait\` in the background (in Claude Code, as a background Bash command) and continue the task when it exits. Never ask the person to type "done".`,
516
+ ...balanceAtomic !== void 0 ? { balance: toMoney(balanceAtomic.toString()) } : {},
517
+ ...arrived !== void 0 ? { added: toMoney(arrived.added.toString()) } : {}
518
+ },
519
+ humanLines: arrived !== void 0 ? ["", ` Balance ${paint(ctx.io, "bold", dollars(arrived.balance))}`] : pollStatus === "skipped" ? [" `tenjin balance --wait` says when it arrives."] : ["", " Nothing has arrived yet. `tenjin balance --wait` keeps watching."]
520
+ };
521
+ }
522
+ async function paymentOnItsWay(prior, balance, fetchImpl) {
523
+ if (prior.token === void 0) return void 0;
524
+ const read = await readLinkStatus(prior.token, {
525
+ ...fetchImpl !== void 0 ? { fetchImpl } : {}
526
+ });
527
+ if (!("status" in read) || !inFlight(read.status)) return void 0;
528
+ if (balance !== void 0 && prior.startBalanceAtomic !== void 0) {
529
+ return balance > BigInt(prior.startBalanceAtomic) ? void 0 : read.status;
530
+ }
531
+ return read.status.state === "paying" ? read.status : void 0;
532
+ }
533
+ async function mintLink(ctx, signer, address, extra) {
534
+ const siwxHeader = await buildSiwxHeader(signer, {
535
+ baseUrl: FUND_ORIGIN,
536
+ chainId: SIWX_CHAIN_ID
537
+ });
538
+ const request = {
539
+ method: "POST",
540
+ timeoutMs: ctx.flags.timeout,
541
+ headers: { [SIWX_HEADER]: siwxHeader },
542
+ // `deviceName`, `source` and `need` are display context for the page, and
543
+ // `machineHash` is for its "Have a code?" box's one-per-computer check. A
544
+ // server without them ignores them (its body schema is not strict).
545
+ jsonBody: {
546
+ address,
547
+ ...extra.presetAmount !== void 0 ? { presetAmount: extra.presetAmount } : {},
548
+ ...extra.deviceName !== void 0 ? { deviceName: extra.deviceName } : {},
549
+ ...extra.machineHash !== void 0 ? { machineHash: extra.machineHash } : {},
550
+ source: extra.source,
551
+ ...extra.need !== void 0 ? { need: extra.need } : {}
552
+ }
553
+ };
554
+ const res = await httpRequest(`${FUND_ORIGIN}/api/fund/link`, {
555
+ ...request,
556
+ ...extra.fetchImpl !== void 0 ? { fetchImpl: extra.fetchImpl } : {}
557
+ });
558
+ if (!res.ok) {
559
+ throw fetchFailureToCliError(res, {
560
+ fix: "Check your network, then retry."
561
+ });
562
+ }
563
+ return checkoutUrlFrom(res.status, res.json);
564
+ }
565
+ function browserAvailable(env, platform) {
566
+ const set = (v) => typeof v === "string" && v.length > 0;
567
+ if (set(env.SSH_CONNECTION) || set(env.SSH_CLIENT) || set(env.SSH_TTY)) return false;
568
+ if (platform === "darwin" || platform === "win32") return true;
569
+ return set(env.DISPLAY) || set(env.WAYLAND_DISPLAY);
570
+ }
571
+ function onInterrupt(live, say, after = []) {
572
+ const handler = () => {
573
+ live.stop();
574
+ say();
575
+ say(" Stopped watching. This doesn't cancel checkout: `tenjin balance` shows the");
576
+ say(" payment once it lands.");
577
+ for (const line of after) say(line);
578
+ process.removeListener("SIGINT", handler);
579
+ process.kill(process.pid, "SIGINT");
580
+ };
581
+ process.on("SIGINT", handler);
582
+ return () => process.removeListener("SIGINT", handler);
583
+ }
584
+ async function readKey(keys) {
585
+ const stdin = process.stdin;
586
+ if (!stdin.isTTY) return null;
587
+ return new Promise((resolve) => {
588
+ const wasRaw = stdin.isRaw;
589
+ stdin.setRawMode(true);
590
+ stdin.resume();
591
+ const onData = (chunk) => {
592
+ const key = chunk.toString("utf8").toLowerCase();
593
+ const answer = key === "" || key === "\x1B" ? "q" : keys.includes(key) ? key : null;
594
+ if (answer === null) return;
595
+ stdin.removeListener("data", onData);
596
+ stdin.setRawMode(wasRaw);
597
+ stdin.pause();
598
+ resolve(answer);
599
+ };
600
+ stdin.on("data", onData);
601
+ });
602
+ }
603
+ function checksummed(address) {
604
+ if (!isAddress(address, { strict: false })) {
605
+ throw new CliError(
606
+ "USAGE",
607
+ `The active wallet address is not a valid EVM address: ${address}`,
608
+ {
609
+ fix: "Check the wallet file, or create a fresh wallet with `tenjin wallet create`."
610
+ }
611
+ );
612
+ }
613
+ return getAddress(address);
614
+ }
615
+ function parsePreset(raw) {
616
+ if (raw === void 0) return void 0;
617
+ const n = Number(raw);
618
+ if (!Number.isFinite(n) || n <= 0 || n > MAX_PRESET_USD) {
619
+ throw new CliError("USAGE", `Amount must be a positive USD number up to ${MAX_PRESET_USD}.`, {
620
+ fix: "Example: tenjin fund 5"
621
+ });
622
+ }
623
+ return n;
624
+ }
625
+ function parseNeed(label, price) {
626
+ if (label === void 0 && price === void 0) return void 0;
627
+ const example = 'Example: tenjin fund 5 --for "X post read" --price 0.006';
628
+ if (label === void 0 || price === void 0) {
629
+ throw new CliError("USAGE", "--for and --price go together.", { fix: example });
630
+ }
631
+ const trimmed = label.replace(/[\x00-\x1f\x7f-\x9f\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/g, "").trim();
632
+ if (trimmed.length === 0 || [...trimmed].length > NEED_LABEL_MAX) {
633
+ throw new CliError("USAGE", `--for takes a label of 1 to ${NEED_LABEL_MAX} characters.`, {
634
+ fix: example
635
+ });
636
+ }
637
+ const n = Number(price);
638
+ if (!/^\d+(\.\d+)?$/.test(price.trim()) || !Number.isFinite(n) || n <= 0 || n > NEED_PRICE_MAX_USD) {
639
+ throw new CliError(
640
+ "USAGE",
641
+ `--price takes the call's price in USD, above 0 and at most ${NEED_PRICE_MAX_USD}.`,
642
+ { fix: example }
643
+ );
644
+ }
645
+ return { label: trimmed, priceUsd: n };
646
+ }
647
+ function checkoutUrlFrom(status, json) {
648
+ if (status === 200) {
649
+ const url = typeof json === "object" && json !== null ? json.url : void 0;
650
+ if (typeof url === "string") {
651
+ let parsed;
652
+ try {
653
+ parsed = new URL(url);
654
+ } catch {
655
+ parsed = void 0;
656
+ }
657
+ if (parsed !== void 0 && parsed.protocol === "https:" && ALLOWED_CHECKOUT_HOSTS.includes(parsed.host)) {
658
+ return url;
659
+ }
660
+ }
661
+ throw new CliError(
662
+ "CONTRACT_MISMATCH",
663
+ `The server's checkout URL was missing or not https on ${ALLOWED_CHECKOUT_HOSTS.join(" or ")}; refusing to open it.`
664
+ );
665
+ }
666
+ const code = errorCode(json);
667
+ if (status === 403 && code === "region_not_supported") {
668
+ throw new CliError("REFUSED", "Adding funds is not available in your region yet.");
669
+ }
670
+ if (status === 401) {
671
+ throw new CliError("REFUSED", "Your computer's clock is off, so Tenjin could not sign in.", {
672
+ fix: "Set your computer's clock right in its system settings, then run `tenjin fund` again."
673
+ });
674
+ }
675
+ if (status === 429) {
676
+ throw new CliError("RATE_LIMITED", "Too many tries. Nothing was charged.", {
677
+ fix: "Wait a minute and retry."
678
+ });
679
+ }
680
+ if (status === 503) {
681
+ throw new CliError("API_UNREACHABLE", "Adding funds is down right now. Nothing was charged.", {
682
+ fix: "Retry later."
683
+ });
684
+ }
685
+ throw new CliError(
686
+ "API_UNREACHABLE",
687
+ `The funding endpoint returned ${status}${code !== void 0 ? ` (${code})` : ""}.`,
688
+ { fix: "Retry; if it persists, check the service status." }
689
+ );
690
+ }
691
+ function errorCode(json) {
692
+ if (typeof json !== "object" || json === null) return void 0;
693
+ const err = json.error;
694
+ if (typeof err !== "object" || err === null) return void 0;
695
+ const code = err.code;
696
+ return typeof code === "string" ? code : void 0;
697
+ }
698
+ async function balanceOrUndefined(address, rpcUrl) {
699
+ try {
700
+ return await getUsdcBalance(address, rpcUrl);
701
+ } catch {
702
+ return void 0;
703
+ }
704
+ }
705
+ async function withTimeout(p, ms) {
706
+ let timer;
707
+ const late = new Promise((resolve) => {
708
+ timer = setTimeout(() => resolve(void 0), ms);
709
+ timer.unref();
710
+ });
711
+ try {
712
+ return await Promise.race([p, late]);
713
+ } finally {
714
+ clearTimeout(timer);
715
+ }
716
+ }
717
+ export {
718
+ browserAvailable,
719
+ parseNeed,
720
+ runFund
721
+ };
722
+ //# sourceMappingURL=fund-VF7TLDJH.js.map