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,454 @@
1
+ import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
+ import {
3
+ writeFileAtomic,
4
+ writeFileAtomicExclusive
5
+ } from "./chunk-7WEQQJLG.js";
6
+ import {
7
+ hasCode
8
+ } from "./chunk-3MZ7DYRO.js";
9
+ import {
10
+ CliError
11
+ } from "./chunk-DI4QAGRZ.js";
12
+
13
+ // src/lib/os-store.ts
14
+ import { execFile } from "node:child_process";
15
+ import { readFile, stat, unlink } from "node:fs/promises";
16
+ var KEYCHAIN_SERVICE = "tenjin-cli";
17
+ var BASE64URL_RE = /^[A-Za-z0-9_-]+$/;
18
+ var PRINTABLE_ASCII_RE = /^[\x20-\x7e]+$/;
19
+ var StoreExecError = class extends Error {
20
+ code;
21
+ signal;
22
+ killed;
23
+ enoent;
24
+ constructor(file, fields = {}) {
25
+ const code = fields.code ?? null;
26
+ const signal = fields.signal ?? null;
27
+ super(`${file} failed (${code ?? signal ?? "no exit code"})`);
28
+ this.name = "StoreExecError";
29
+ this.code = code;
30
+ this.signal = signal;
31
+ this.killed = fields.killed ?? false;
32
+ this.enoent = fields.enoent ?? code === "ENOENT";
33
+ Object.defineProperty(this, "stderr", {
34
+ value: fields.stderr ?? "",
35
+ enumerable: false,
36
+ writable: false
37
+ });
38
+ }
39
+ };
40
+ function defaultExecFor() {
41
+ return (file, args, stdin, opts) => new Promise((resolve, reject) => {
42
+ const child = execFile(
43
+ file,
44
+ args,
45
+ {
46
+ encoding: "utf8",
47
+ killSignal: "SIGKILL",
48
+ // 0 would mean "no timeout" to Node; a spent deadline is still a deadline.
49
+ ...opts?.timeoutMs !== void 0 ? { timeout: Math.max(1, opts.timeoutMs) } : {}
50
+ },
51
+ (err, stdout, stderr) => {
52
+ if (err) reject(toStoreExecError(file, err, stderr));
53
+ else resolve({ stdout, stderr });
54
+ }
55
+ );
56
+ if (stdin !== void 0) {
57
+ child.stdin?.on("error", () => void 0);
58
+ child.stdin?.end(stdin);
59
+ }
60
+ });
61
+ }
62
+ function toStoreExecError(file, err, stderr) {
63
+ const e = err;
64
+ const code = typeof e.code === "number" || typeof e.code === "string" ? e.code : null;
65
+ return new StoreExecError(file, {
66
+ code,
67
+ signal: typeof e.signal === "string" ? e.signal : null,
68
+ killed: e.killed === true,
69
+ enoent: code === "ENOENT",
70
+ stderr: typeof stderr === "string" ? stderr : ""
71
+ });
72
+ }
73
+ function storeNoun(store) {
74
+ switch (store) {
75
+ case "keychain":
76
+ return "macOS keychain";
77
+ case "secret-service":
78
+ return "Linux keyring";
79
+ case "dpapi":
80
+ return "Windows DPAPI store";
81
+ case "file":
82
+ return "passphrase file";
83
+ }
84
+ }
85
+ function classifyStoreFailure(store, err) {
86
+ if (store === "file") {
87
+ if (hasCode(err, "ENOENT")) return { kind: "miss" };
88
+ const code = err?.code;
89
+ const errno = typeof code === "string" && /^E[A-Z]+$/.test(code) ? ` (${code})` : "";
90
+ return { kind: "locked", detail: `the passphrase file could not be read${errno}` };
91
+ }
92
+ if (!(err instanceof StoreExecError)) {
93
+ return {
94
+ kind: "locked",
95
+ detail: `the ${storeNoun(store)} failed for a reason Tenjin could not classify`
96
+ };
97
+ }
98
+ if (err.killed || err.signal !== null) {
99
+ return {
100
+ kind: "locked",
101
+ detail: `the ${storeNoun(store)} did not answer (killed by ${err.signal ?? "SIGKILL"})`
102
+ };
103
+ }
104
+ switch (store) {
105
+ case "keychain":
106
+ if (err.enoent) return { kind: "absent", detail: "the `security` tool is not installed" };
107
+ if (err.code === 44) return { kind: "miss" };
108
+ if (/default keychain could not be found/i.test(err.stderr)) {
109
+ return { kind: "absent", detail: "there is no default keychain" };
110
+ }
111
+ if (/User interaction is not allowed/.test(err.stderr)) {
112
+ return { kind: "locked", detail: "the keychain refused (user interaction is not allowed)" };
113
+ }
114
+ return { kind: "locked", detail: `security exited ${String(err.code)}` };
115
+ case "secret-service":
116
+ if (err.enoent) return { kind: "absent", detail: "secret-tool is not installed" };
117
+ if (/Cannot autolaunch D-Bus|org\.freedesktop\.secrets was not provided|Could not connect/.test(
118
+ err.stderr
119
+ )) {
120
+ return { kind: "absent", detail: "no Secret Service is reachable from this session" };
121
+ }
122
+ if (err.code === 1 && err.stderr.trim() === "") return { kind: "miss" };
123
+ return { kind: "locked", detail: `secret-tool exited ${String(err.code)}` };
124
+ case "dpapi":
125
+ if (err.enoent) return { kind: "absent", detail: "powershell.exe is not available" };
126
+ return {
127
+ kind: "locked",
128
+ detail: `the DPAPI unprotect failed (powershell.exe exited ${String(err.code)})`
129
+ };
130
+ }
131
+ }
132
+ function osStoreFor(slot, deps) {
133
+ switch (deps.platform ?? process.platform) {
134
+ case "darwin":
135
+ return keychainStore(slot, deps);
136
+ case "win32":
137
+ return dpapiStore(slot, deps);
138
+ case "linux":
139
+ return secretServiceStore(slot, deps);
140
+ default:
141
+ return null;
142
+ }
143
+ }
144
+ function osStoreByName(slot, deps, name) {
145
+ switch (name) {
146
+ case "keychain":
147
+ return keychainStore(slot, deps);
148
+ case "secret-service":
149
+ return secretServiceStore(slot, deps);
150
+ case "dpapi":
151
+ return dpapiStore(slot, deps);
152
+ case "file":
153
+ return fileStore(slot);
154
+ }
155
+ }
156
+ var PROBE_ACCOUNT = "0x0000000000000000000000000000000000000000";
157
+ function keychainStore(slot, deps) {
158
+ const exec = deps.exec ?? defaultExecFor();
159
+ return {
160
+ source: "keychain",
161
+ async read(account, o) {
162
+ try {
163
+ const { stdout } = await exec(
164
+ "security",
165
+ ["find-generic-password", "-s", KEYCHAIN_SERVICE, "-a", account, "-w"],
166
+ void 0,
167
+ callOpts(o)
168
+ );
169
+ const value = oneNewlineStripped(stdout);
170
+ return value.length > 0 ? { kind: "hit", value } : { kind: "miss" };
171
+ } catch (err) {
172
+ return classifyStoreFailure("keychain", err);
173
+ }
174
+ },
175
+ // The one backend that interpolates into a command line. base64url values
176
+ // keep today's exact `-w '<value>'` line; any other printable-ASCII value is
177
+ // sent as hex, so no character of it is ever syntax. Escaping is NOT a safe
178
+ // alternative (backslash bites even inside single quotes there).
179
+ storable: (value) => PRINTABLE_ASCII_RE.test(value),
180
+ async store(account, value, o) {
181
+ if (!slot.accountRe.test(account) || !PRINTABLE_ASCII_RE.test(value)) {
182
+ throw new CliError("INTERNAL", "Refusing to send this value to the keychain writer.");
183
+ }
184
+ const secret = BASE64URL_RE.test(value) ? `-w '${value}'` : `-X ${Buffer.from(value, "utf8").toString("hex")}`;
185
+ const update = o?.update === true ? " -U" : "";
186
+ const command = `add-generic-password -s ${KEYCHAIN_SERVICE} -a ${account} ${secret}${update}
187
+ `;
188
+ await exec("security", ["-i"], command, callOpts(o));
189
+ },
190
+ async remove(account, o) {
191
+ try {
192
+ await exec(
193
+ "security",
194
+ ["delete-generic-password", "-s", KEYCHAIN_SERVICE, "-a", account],
195
+ void 0,
196
+ callOpts(o)
197
+ );
198
+ return true;
199
+ } catch {
200
+ return false;
201
+ }
202
+ },
203
+ async probe(o) {
204
+ try {
205
+ await exec("security", ["default-keychain"], void 0, callOpts(o));
206
+ return { probe: "available" };
207
+ } catch (err) {
208
+ const failure = classifyStoreFailure("keychain", err);
209
+ if (failure.kind === "absent") return { probe: "absent", detail: failure.detail };
210
+ return {
211
+ probe: "uncertain",
212
+ ..."detail" in failure ? { detail: failure.detail } : {}
213
+ };
214
+ }
215
+ }
216
+ };
217
+ }
218
+ var DPAPI_PROTECT_SCRIPT = [
219
+ "Add-Type -AssemblyName System.Security;",
220
+ "$in = [Console]::In.ReadToEnd();",
221
+ "$bytes = [System.Text.Encoding]::UTF8.GetBytes($in);",
222
+ "$prot = [System.Security.Cryptography.ProtectedData]::Protect($bytes, $null, 'CurrentUser');",
223
+ "[Console]::Out.Write([Convert]::ToBase64String($prot));"
224
+ ].join(" ");
225
+ var DPAPI_UNPROTECT_SCRIPT = [
226
+ "Add-Type -AssemblyName System.Security;",
227
+ "$in = [Console]::In.ReadToEnd();",
228
+ "$blob = [Convert]::FromBase64String($in.Trim());",
229
+ "$plain = [System.Security.Cryptography.ProtectedData]::Unprotect($blob, $null, 'CurrentUser');",
230
+ "[Console]::Out.Write([System.Text.Encoding]::UTF8.GetString($plain));"
231
+ ].join(" ");
232
+ function powershellArgs(script) {
233
+ return ["-NoProfile", "-NonInteractive", "-Command", script];
234
+ }
235
+ function dpapiStore(slot, deps) {
236
+ const exec = deps.exec ?? defaultExecFor();
237
+ return {
238
+ source: "dpapi",
239
+ async read(account, o) {
240
+ let blob;
241
+ try {
242
+ blob = await readFile(slot.blobPath(account), "utf8");
243
+ } catch (err) {
244
+ if (hasCode(err, "ENOENT")) return { kind: "miss" };
245
+ return { kind: "locked", detail: "the DPAPI passphrase file could not be read" };
246
+ }
247
+ try {
248
+ const { stdout } = await exec(
249
+ "powershell.exe",
250
+ powershellArgs(DPAPI_UNPROTECT_SCRIPT),
251
+ blob,
252
+ callOpts(o)
253
+ );
254
+ const value = stdout.replace(/\r?\n$/, "");
255
+ return value.length > 0 ? { kind: "hit", value } : { kind: "miss" };
256
+ } catch (err) {
257
+ return classifyStoreFailure("dpapi", err);
258
+ }
259
+ },
260
+ storable: readsBackFromStdout,
261
+ async store(account, secret, o) {
262
+ const { stdout } = await exec(
263
+ "powershell.exe",
264
+ powershellArgs(DPAPI_PROTECT_SCRIPT),
265
+ secret,
266
+ callOpts(o)
267
+ );
268
+ const blob = stdout.replace(/\r?\n$/, "").trim();
269
+ if (blob.length === 0) throw new StoreExecError("powershell.exe", { code: 0 });
270
+ await writeFileAtomic(slot.blobPath(account), blob, { mode: 384 });
271
+ },
272
+ async remove(account) {
273
+ try {
274
+ await unlink(slot.blobPath(account));
275
+ return true;
276
+ } catch {
277
+ return false;
278
+ }
279
+ },
280
+ async probe(o) {
281
+ try {
282
+ await exec(
283
+ "powershell.exe",
284
+ ["-NoProfile", "-NonInteractive", "-Command", "$null"],
285
+ void 0,
286
+ callOpts(o)
287
+ );
288
+ return { probe: "available" };
289
+ } catch (err) {
290
+ const failure = classifyStoreFailure("dpapi", err);
291
+ if (failure.kind === "absent") return { probe: "absent", detail: failure.detail };
292
+ return { probe: "available" };
293
+ }
294
+ }
295
+ };
296
+ }
297
+ function secretServiceStore(slot, deps) {
298
+ const exec = deps.exec ?? defaultExecFor();
299
+ const read = async (account, o) => {
300
+ try {
301
+ const { stdout } = await exec(
302
+ "secret-tool",
303
+ ["lookup", "service", KEYCHAIN_SERVICE, "account", account],
304
+ void 0,
305
+ callOpts(o)
306
+ );
307
+ const value = oneNewlineStripped(stdout);
308
+ return value.length > 0 ? { kind: "hit", value } : { kind: "miss" };
309
+ } catch (err) {
310
+ return classifyStoreFailure("secret-service", err);
311
+ }
312
+ };
313
+ return {
314
+ source: "secret-service",
315
+ read,
316
+ storable: readsBackFromStdout,
317
+ async store(account, secret, o) {
318
+ await exec(
319
+ "secret-tool",
320
+ [
321
+ "store",
322
+ `--label=${slot.label(account)}`,
323
+ "service",
324
+ KEYCHAIN_SERVICE,
325
+ "account",
326
+ account
327
+ ],
328
+ secret,
329
+ callOpts(o)
330
+ );
331
+ },
332
+ async remove(account, o) {
333
+ try {
334
+ await exec(
335
+ "secret-tool",
336
+ ["clear", "service", KEYCHAIN_SERVICE, "account", account],
337
+ void 0,
338
+ callOpts(o)
339
+ );
340
+ return true;
341
+ } catch {
342
+ return false;
343
+ }
344
+ },
345
+ async probe(o) {
346
+ const got = await read(PROBE_ACCOUNT, o);
347
+ if (got.kind === "hit" || got.kind === "miss") return { probe: "available" };
348
+ if (got.kind === "absent") return { probe: "absent", detail: got.detail };
349
+ return { probe: "uncertain", detail: got.detail };
350
+ }
351
+ };
352
+ }
353
+ function fileStore(slot) {
354
+ return {
355
+ source: "file",
356
+ async read(account) {
357
+ try {
358
+ const value = oneLfStripped(await readFile(slot.filePath(account), "utf8"));
359
+ return value.length > 0 ? { kind: "hit", value } : { kind: "miss" };
360
+ } catch (err) {
361
+ return classifyStoreFailure("file", err);
362
+ }
363
+ },
364
+ // The read strips one trailing LF, so a value ending in one never reads back.
365
+ storable: (value) => !value.endsWith("\n"),
366
+ async store(account, value, o) {
367
+ const path = slot.filePath(account);
368
+ const mode = { mode: 384, dirMode: 448 };
369
+ if (o?.update === true) return writeFileAtomic(path, value, mode);
370
+ try {
371
+ await writeFileAtomicExclusive(path, value, mode);
372
+ } catch (err) {
373
+ if (!hasCode(err, "EEXIST") || (await stat(path).catch(() => null))?.size !== 0) throw err;
374
+ await writeFileAtomic(path, value, mode);
375
+ }
376
+ },
377
+ async remove(account) {
378
+ try {
379
+ await unlink(slot.filePath(account));
380
+ return true;
381
+ } catch {
382
+ return false;
383
+ }
384
+ },
385
+ probe: async () => ({ probe: "available" })
386
+ };
387
+ }
388
+ function callOpts(o) {
389
+ return o?.timeoutMs !== void 0 ? { timeoutMs: o.timeoutMs } : void 0;
390
+ }
391
+ function readsBackFromStdout(value) {
392
+ return !/[\r\n]$/.test(value);
393
+ }
394
+ function oneNewlineStripped(stdout) {
395
+ return stdout.replace(/\r?\n$/, "");
396
+ }
397
+ function oneLfStripped(text) {
398
+ return text.endsWith("\n") ? text.slice(0, -1) : text;
399
+ }
400
+ var CTRL_C = 3;
401
+ var CTRL_D = 4;
402
+ var BACKSPACE = 127;
403
+ var BACKSPACE_ALT = 8;
404
+ function hiddenPrompt(cancelled) {
405
+ return (label) => new Promise((resolve, reject) => {
406
+ const stdin = process.stdin;
407
+ const stderr = process.stderr;
408
+ const wasRaw = stdin.isRaw;
409
+ let value = "";
410
+ const cleanup = () => {
411
+ stdin.setRawMode?.(wasRaw ?? false);
412
+ stdin.pause();
413
+ stdin.removeListener("data", onData);
414
+ };
415
+ const onData = (chunk) => {
416
+ for (const ch of chunk.toString("utf8")) {
417
+ const code = ch.charCodeAt(0);
418
+ if (ch === "\n" || ch === "\r" || code === CTRL_D) {
419
+ cleanup();
420
+ stderr.write("\n");
421
+ resolve(value);
422
+ return;
423
+ }
424
+ if (code === CTRL_C) {
425
+ cleanup();
426
+ stderr.write("\n");
427
+ reject(cancelled());
428
+ return;
429
+ }
430
+ if (code === BACKSPACE || code === BACKSPACE_ALT) {
431
+ value = value.slice(0, -1);
432
+ } else {
433
+ value += ch;
434
+ }
435
+ }
436
+ };
437
+ stderr.write(label);
438
+ stdin.setRawMode?.(true);
439
+ stdin.resume();
440
+ stdin.on("data", onData);
441
+ });
442
+ }
443
+
444
+ export {
445
+ KEYCHAIN_SERVICE,
446
+ StoreExecError,
447
+ defaultExecFor,
448
+ storeNoun,
449
+ classifyStoreFailure,
450
+ osStoreFor,
451
+ osStoreByName,
452
+ hiddenPrompt
453
+ };
454
+ //# sourceMappingURL=chunk-XRGFH7FI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/os-store.ts"],"sourcesContent":["import { execFile } from 'node:child_process';\nimport { readFile, stat, unlink } from 'node:fs/promises';\nimport { CliError } from './errors';\nimport { hasCode } from './errno';\nimport { writeFileAtomic, writeFileAtomicExclusive } from './atomic-json';\nimport type { DurableStore } from './wallet-unlock';\n\nexport type { DurableStore } from './wallet-unlock';\n\n/**\n * THE OS CREDENTIAL STORES: the macOS keychain, Windows DPAPI, the desktop-Linux\n * Secret Service, and the announced 0600 plaintext file where none exists. Each\n * backend keeps one secret per ACCOUNT under the service `tenjin-cli`, and where\n * an account's secret lives on disk (the DPAPI blob, the plain file) and what\n * account names its writer accepts are the caller's {@link SecretSlot}: the\n * wallet passphrase is one slot, a connected account's vault key another.\n *\n * A secret never appears in any argv (which the OS process table can show):\n * reads come back on stdout, and writes pipe the secret over the child's stdin.\n * A failed store CLI never carries its stdout anywhere (for a read, that IS the\n * secret): it rejects with a {@link StoreExecError} holding only the exit code,\n * the signal and the stderr {@link classifyStoreFailure} reads, and every detail\n * built from it names only those.\n */\n\nexport const KEYCHAIN_SERVICE = 'tenjin-cli';\n\n/**\n * base64url alphabet — what generated secrets use. These go to the keychain as\n * the exact `-w '<value>'` line (no quote/backslash/space/newline can appear\n * inside the single quotes), so an existing reader of that shape sees no change.\n */\nconst BASE64URL_RE = /^[A-Za-z0-9_-]+$/;\n\n/**\n * Printable ASCII: what the keychain writer stores at all. Anything outside the\n * base64url alphabet goes as `-X <utf8 hex>`, which carries only `[0-9a-f]` on\n * the piped `security -i` line, so nothing in the value can be read as syntax.\n * Non-printable bytes are refused, not encoded: `security -w` prints a value\n * with them back as hex, which would not read back byte-identical.\n */\nconst PRINTABLE_ASCII_RE = /^[\\x20-\\x7e]+$/;\n\n/**\n * Runs a command with an argv array (execFile semantics — never shell-interpolated).\n * When `stdin` is provided it is written to the child's stdin and the stream is\n * closed; this is how a secret reaches `security -i`, PowerShell, and\n * `secret-tool` WITHOUT ever appearing in an argv the process table can expose.\n *\n * `opts.timeoutMs` absent means the child is never killed: every signing read\n * passes none (B3), so an OS unlock dialog the person may be answering stays up.\n * Rejects only with a {@link StoreExecError} (S2).\n */\nexport type ExecFn = (\n file: string,\n args: string[],\n stdin?: string,\n opts?: { timeoutMs?: number },\n) => Promise<{ stdout: string; stderr: string }>;\n\n/**\n * THE ONLY REJECTION OF {@link defaultExecFor} (S2). A fresh error built from the\n * Node one, never the Node one itself: Node's message and its `stdout` field can\n * carry the child's output, and for a store read that output is the secret.\n * There is no `stdout` field here, ever. `stderr` is kept only so\n * {@link classifyStoreFailure} can tell \"no such keychain\" from \"locked\"; it is\n * non-enumerable so a `JSON.stringify` or a log of this error cannot carry it,\n * and nothing copies it into a message, detail, warning or file.\n */\nexport class StoreExecError extends Error {\n readonly code: number | string | null;\n readonly signal: string | null;\n readonly killed: boolean;\n readonly enoent: boolean;\n declare readonly stderr: string;\n\n constructor(\n file: string,\n fields: {\n code?: number | string | null;\n signal?: string | null;\n killed?: boolean;\n enoent?: boolean;\n stderr?: string;\n } = {},\n ) {\n const code = fields.code ?? null;\n const signal = fields.signal ?? null;\n super(`${file} failed (${code ?? signal ?? 'no exit code'})`);\n this.name = 'StoreExecError';\n this.code = code;\n this.signal = signal;\n this.killed = fields.killed ?? false;\n this.enoent = fields.enoent ?? code === 'ENOENT';\n Object.defineProperty(this, 'stderr', {\n value: fields.stderr ?? '',\n enumerable: false,\n writable: false,\n });\n }\n}\n\n/** One store read, classified. `detail` never carries the store's output (S2). */\nexport type StoreRead =\n | { kind: 'hit'; value: string }\n | { kind: 'miss' }\n | { kind: 'absent'; detail: string }\n | { kind: 'locked'; detail: string };\n\n/** Whether the platform store can answer at all: before create or repair picks a target. */\nexport type StoreProbe = 'available' | 'absent' | 'uncertain';\n\n/** Per-call deadline for every store method (decision 7). Absent = never killed. The file store ignores it. */\nexport interface StoreCallOptions {\n timeoutMs?: number;\n}\n\n/**\n * A durable secret store, keyed by ACCOUNT. Reads never throw: they classify. A\n * write throws the StoreExecError (or the fs error, for the file store) so a\n * caller can tell a killed write, which may have committed, from a definite\n * failure.\n */\nexport interface OsStore {\n /** The source label reported when this store serves the secret. */\n source: DurableStore;\n read(account: string, o?: StoreCallOptions): Promise<StoreRead>;\n store(account: string, value: string, o?: StoreCallOptions & { update?: boolean }): Promise<void>;\n remove(account: string, o?: StoreCallOptions): Promise<boolean>;\n probe(o?: StoreCallOptions): Promise<{ probe: StoreProbe; detail?: string }>;\n /**\n * When present, a cheap pre-check for values this backend's writer refuses on\n * principle (the keychain's printable-ASCII gate), or that its read would not\n * give back byte for byte (a trailing line break the read strips) — so\n * callers can tell \"this secret's characters\" apart from \"the store write\n * failed\", and nothing is written that reads back as another secret.\n */\n storable?(value: string): boolean;\n}\n\n/**\n * WHERE ONE KIND OF SECRET LIVES, beside the keychain and keyring entries every\n * slot shares the service of: the accounts the keychain writer accepts (checked\n * before an account reaches the piped `security -i` line), the Secret Service\n * item's label, and the DPAPI blob and plain file for an account.\n */\nexport interface SecretSlot {\n accountRe: RegExp;\n label(account: string): string;\n blobPath(account: string): string;\n filePath(account: string): string;\n}\n\n/** The two seams every backend takes: the platform and the store-CLI exec. */\nexport interface OsStoreDeps {\n /** Defaults to `process.platform`; selects the OS store (or none). */\n platform?: NodeJS.Platform;\n /** The store-CLI exec seam; defaults to a real execFile with stdin support. */\n exec?: ExecFn;\n}\n\n/**\n * The real executor. Each call applies its own `opts.timeoutMs` when given, and\n * kills with SIGKILL: a store CLI that ignored SIGTERM would otherwise outlive\n * the deadline it was given.\n *\n * WHY A WRITE MAY BE KILLED NOW. A killed write used to be a correctness hazard:\n * create treated \"the write did not return\" as \"the write did not stick\" and fell\n * through to a different, prompted passphrase while the committed value won\n * every later decrypt. That fall-through is gone. One secret per address is\n * chosen before any write, and every write is followed by a read-back\n * (storeDurablyDetailed), so a killed write that did commit reads back as stored, and\n * one that did not reads back as missing. The worst a kill leaves is an orphan\n * keychain entry for an address whose create was then abandoned, which no\n * wallet will ever read.\n *\n * WHY READS STAY UNBOUNDED, except in verify. Killing a read closes an OS unlock\n * dialog the person may be answering. The router bounds its WAIT with the call\n * budget instead (routing-payer.ts), and the read keeps running so a later call\n * gets its answer. Only doctor's and install's verify, which run unattended and\n * must finish, pass a read deadline.\n */\nexport function defaultExecFor(): ExecFn {\n return (file, args, stdin, opts) =>\n new Promise((resolve, reject) => {\n const child = execFile(\n file,\n args,\n {\n encoding: 'utf8',\n killSignal: 'SIGKILL',\n // 0 would mean \"no timeout\" to Node; a spent deadline is still a deadline.\n ...(opts?.timeoutMs !== undefined ? { timeout: Math.max(1, opts.timeoutMs) } : {}),\n },\n (err, stdout, stderr) => {\n if (err) reject(toStoreExecError(file, err, stderr));\n else resolve({ stdout, stderr });\n },\n );\n if (stdin !== undefined) {\n // A child that exits before draining stdin closes the pipe; swallow the\n // resulting EPIPE so the exec callback surfaces the real exit error instead.\n child.stdin?.on('error', () => undefined);\n child.stdin?.end(stdin);\n }\n });\n}\n\n/** The scrubbed copy of a Node exec error: no message, no stdout (S2). */\nfunction toStoreExecError(file: string, err: unknown, stderr: unknown): StoreExecError {\n const e = err as { code?: unknown; signal?: unknown; killed?: unknown };\n const code = typeof e.code === 'number' || typeof e.code === 'string' ? e.code : null;\n return new StoreExecError(file, {\n code,\n signal: typeof e.signal === 'string' ? e.signal : null,\n killed: e.killed === true,\n enoent: code === 'ENOENT',\n stderr: typeof stderr === 'string' ? stderr : '',\n });\n}\n\n/** What a store is called in a sentence: \"the <noun> did not answer\". */\nexport function storeNoun(store: DurableStore): string {\n switch (store) {\n case 'keychain':\n return 'macOS keychain';\n case 'secret-service':\n return 'Linux keyring';\n case 'dpapi':\n return 'Windows DPAPI store';\n case 'file':\n return 'passphrase file';\n }\n}\n\n/**\n * WHY A STORE OPERATION FAILED, in a form that can gate (section 2.5). Anything\n * unclear is `locked`, which is unknown and never a block (Q5): only a store\n * that provably is not there is `absent`, and only the store's own \"no such\n * entry\" is a `miss`.\n *\n * `stderr` is read here to pick the kind and then dropped. Every detail is\n * built only from the kind, the exit code and the signal (S2), never from the\n * child's output or the error's message. A thrown value that is not a\n * StoreExecError (a test fake, a bug) is `locked` with a fixed detail and its\n * message is not read. The file store's fs errors are classified by errno code.\n */\nexport function classifyStoreFailure(\n store: DurableStore,\n err: unknown,\n): Exclude<StoreRead, { kind: 'hit' }> {\n if (store === 'file') {\n if (hasCode(err, 'ENOENT')) return { kind: 'miss' };\n const code = (err as { code?: unknown } | null)?.code;\n const errno = typeof code === 'string' && /^E[A-Z]+$/.test(code) ? ` (${code})` : '';\n return { kind: 'locked', detail: `the passphrase file could not be read${errno}` };\n }\n if (!(err instanceof StoreExecError)) {\n return {\n kind: 'locked',\n detail: `the ${storeNoun(store)} failed for a reason Tenjin could not classify`,\n };\n }\n if (err.killed || err.signal !== null) {\n return {\n kind: 'locked',\n detail: `the ${storeNoun(store)} did not answer (killed by ${err.signal ?? 'SIGKILL'})`,\n };\n }\n switch (store) {\n case 'keychain':\n if (err.enoent) return { kind: 'absent', detail: 'the `security` tool is not installed' };\n if (err.code === 44) return { kind: 'miss' };\n if (/default keychain could not be found/i.test(err.stderr)) {\n return { kind: 'absent', detail: 'there is no default keychain' };\n }\n if (/User interaction is not allowed/.test(err.stderr)) {\n return { kind: 'locked', detail: 'the keychain refused (user interaction is not allowed)' };\n }\n return { kind: 'locked', detail: `security exited ${String(err.code)}` };\n case 'secret-service':\n if (err.enoent) return { kind: 'absent', detail: 'secret-tool is not installed' };\n if (\n /Cannot autolaunch D-Bus|org\\.freedesktop\\.secrets was not provided|Could not connect/.test(\n err.stderr,\n )\n ) {\n return { kind: 'absent', detail: 'no Secret Service is reachable from this session' };\n }\n if (err.code === 1 && err.stderr.trim() === '') return { kind: 'miss' };\n return { kind: 'locked', detail: `secret-tool exited ${String(err.code)}` };\n case 'dpapi':\n if (err.enoent) return { kind: 'absent', detail: 'powershell.exe is not available' };\n return {\n kind: 'locked',\n detail: `the DPAPI unprotect failed (powershell.exe exited ${String(err.code)})`,\n };\n }\n}\n\n/** The durable store for this platform, or null where no built-in one exists. */\nexport function osStoreFor(slot: SecretSlot, deps: OsStoreDeps): OsStore | null {\n switch (deps.platform ?? process.platform) {\n case 'darwin':\n return keychainStore(slot, deps);\n case 'win32':\n return dpapiStore(slot, deps);\n case 'linux':\n return secretServiceStore(slot, deps);\n default:\n return null;\n }\n}\n\n/** Any store by name, the file store included: what a record or a chosen target names. */\nexport function osStoreByName(slot: SecretSlot, deps: OsStoreDeps, name: DurableStore): OsStore {\n switch (name) {\n case 'keychain':\n return keychainStore(slot, deps);\n case 'secret-service':\n return secretServiceStore(slot, deps);\n case 'dpapi':\n return dpapiStore(slot, deps);\n case 'file':\n return fileStore(slot);\n }\n}\n\n/**\n * The account the Secret Service probe looks up: the zero address, which no\n * wallet can own. A hit or a miss both prove a keyring answered.\n */\nconst PROBE_ACCOUNT = '0x0000000000000000000000000000000000000000';\n\n/**\n * macOS login keychain via the OS `security` tool — the same mechanism the GitHub\n * CLI uses. Reads use `-w`, so the secret comes back on stdout, never in argv.\n * Writes pipe an `add-generic-password` command to `security -i` over stdin so the\n * secret never appears in any argv either.\n */\nfunction keychainStore(slot: SecretSlot, deps: OsStoreDeps): OsStore {\n const exec = deps.exec ?? defaultExecFor();\n return {\n source: 'keychain',\n async read(account, o) {\n try {\n const { stdout } = await exec(\n 'security',\n ['find-generic-password', '-s', KEYCHAIN_SERVICE, '-a', account, '-w'],\n undefined,\n callOpts(o),\n );\n const value = oneNewlineStripped(stdout);\n return value.length > 0 ? { kind: 'hit', value } : { kind: 'miss' };\n } catch (err) {\n return classifyStoreFailure('keychain', err);\n }\n },\n // The one backend that interpolates into a command line. base64url values\n // keep today's exact `-w '<value>'` line; any other printable-ASCII value is\n // sent as hex, so no character of it is ever syntax. Escaping is NOT a safe\n // alternative (backslash bites even inside single quotes there).\n storable: (value) => PRINTABLE_ASCII_RE.test(value),\n async store(account, value, o) {\n if (!slot.accountRe.test(account) || !PRINTABLE_ASCII_RE.test(value)) {\n throw new CliError('INTERNAL', 'Refusing to send this value to the keychain writer.');\n }\n const secret = BASE64URL_RE.test(value)\n ? `-w '${value}'`\n : `-X ${Buffer.from(value, 'utf8').toString('hex')}`;\n // No `-U` unless the caller proved the existing entry wrong (repair): a\n // plain add fails on a duplicate instead of overwriting it.\n const update = o?.update === true ? ' -U' : '';\n const command = `add-generic-password -s ${KEYCHAIN_SERVICE} -a ${account} ${secret}${update}\\n`;\n await exec('security', ['-i'], command, callOpts(o));\n },\n async remove(account, o) {\n try {\n // No secret transits here; plain argv is fine (and visible is harmless).\n await exec(\n 'security',\n ['delete-generic-password', '-s', KEYCHAIN_SERVICE, '-a', account],\n undefined,\n callOpts(o),\n );\n return true;\n } catch {\n return false;\n }\n },\n async probe(o) {\n try {\n await exec('security', ['default-keychain'], undefined, callOpts(o));\n return { probe: 'available' };\n } catch (err) {\n const failure = classifyStoreFailure('keychain', err);\n if (failure.kind === 'absent') return { probe: 'absent', detail: failure.detail };\n return {\n probe: 'uncertain',\n ...('detail' in failure ? { detail: failure.detail } : {}),\n };\n }\n },\n };\n}\n\n// PowerShell scripts run via built-in Windows PowerShell 5.1 (zero dependency).\n// Each reads its input from stdin and writes its output to stdout, so the\n// secret and the blob transit ONLY stdin/stdout, never argv. The stored blob\n// is DPAPI-protected for the CurrentUser scope: it decrypts only as this user on\n// this machine, which is the protection class we want; it is NOT the secret in\n// plaintext.\nconst DPAPI_PROTECT_SCRIPT = [\n 'Add-Type -AssemblyName System.Security;',\n '$in = [Console]::In.ReadToEnd();',\n '$bytes = [System.Text.Encoding]::UTF8.GetBytes($in);',\n \"$prot = [System.Security.Cryptography.ProtectedData]::Protect($bytes, $null, 'CurrentUser');\",\n '[Console]::Out.Write([Convert]::ToBase64String($prot));',\n].join(' ');\nconst DPAPI_UNPROTECT_SCRIPT = [\n 'Add-Type -AssemblyName System.Security;',\n '$in = [Console]::In.ReadToEnd();',\n '$blob = [Convert]::FromBase64String($in.Trim());',\n \"$plain = [System.Security.Cryptography.ProtectedData]::Unprotect($blob, $null, 'CurrentUser');\",\n '[Console]::Out.Write([System.Text.Encoding]::UTF8.GetString($plain));',\n].join(' ');\n\nfunction powershellArgs(script: string): string[] {\n return ['-NoProfile', '-NonInteractive', '-Command', script];\n}\n\n/**\n * Windows DPAPI-protected files, via preinstalled PowerShell 5.1 (zero\n * dependency), one blob per account at the slot's `blobPath`. store(): protect\n * the secret through DPAPI (CurrentUser) and write the base64 blob. read(): a\n * missing file is a miss; otherwise the blob is unprotected back to the\n * secret, and a failed unprotect is `locked` (unknown), never a miss.\n */\nfunction dpapiStore(slot: SecretSlot, deps: OsStoreDeps): OsStore {\n const exec = deps.exec ?? defaultExecFor();\n return {\n source: 'dpapi',\n async read(account, o) {\n let blob: string;\n try {\n blob = await readFile(slot.blobPath(account), 'utf8');\n } catch (err) {\n if (hasCode(err, 'ENOENT')) return { kind: 'miss' }; // No blob yet: a miss, not an error.\n return { kind: 'locked', detail: 'the DPAPI passphrase file could not be read' };\n }\n try {\n const { stdout } = await exec(\n 'powershell.exe',\n powershellArgs(DPAPI_UNPROTECT_SCRIPT),\n blob,\n callOpts(o),\n );\n const value = stdout.replace(/\\r?\\n$/, '');\n return value.length > 0 ? { kind: 'hit', value } : { kind: 'miss' };\n } catch (err) {\n return classifyStoreFailure('dpapi', err);\n }\n },\n storable: readsBackFromStdout,\n async store(account, secret, o) {\n const { stdout } = await exec(\n 'powershell.exe',\n powershellArgs(DPAPI_PROTECT_SCRIPT),\n secret,\n callOpts(o),\n );\n const blob = stdout.replace(/\\r?\\n$/, '').trim();\n if (blob.length === 0) throw new StoreExecError('powershell.exe', { code: 0 });\n // DPAPI CurrentUser encryption is the real protection here; `mode` is inert\n // on win32 (writeFileAtomic drops it there) and only bites when a POSIX host\n // exercises this store in tests. The blob is ciphertext, not the secret.\n await writeFileAtomic(slot.blobPath(account), blob, { mode: 0o600 });\n },\n async remove(account) {\n try {\n await unlink(slot.blobPath(account));\n return true;\n } catch {\n return false;\n }\n },\n async probe(o) {\n try {\n await exec(\n 'powershell.exe',\n ['-NoProfile', '-NonInteractive', '-Command', '$null'],\n undefined,\n callOpts(o),\n );\n return { probe: 'available' };\n } catch (err) {\n // DPAPI has no lock state: the only thing a probe can learn is whether\n // powershell.exe exists. A slow cold start killed at the probe bound, or\n // any other answer, still means it does, so it is never `uncertain`\n // (which would refuse create and repair with an unlock fix that cannot\n // apply). A write that then fails is reported by the write itself.\n const failure = classifyStoreFailure('dpapi', err);\n if (failure.kind === 'absent') return { probe: 'absent', detail: failure.detail };\n return { probe: 'available' };\n }\n },\n };\n}\n\n/**\n * Desktop-Linux Secret Service via `secret-tool` (libsecret-tools). `secret-tool`\n * reads the secret from stdin when stdin is not a TTY, so the secret never\n * appears in argv. Headless Linux, WSL and CI usually have no Secret Service at\n * all: an absent `secret-tool` (ENOENT) or no D-Bus is `absent`, which is what\n * sends create to the 0600 file. A keyring that is there but does not answer is\n * `locked`, which is not.\n */\nfunction secretServiceStore(slot: SecretSlot, deps: OsStoreDeps): OsStore {\n const exec = deps.exec ?? defaultExecFor();\n const read: OsStore['read'] = async (account, o) => {\n try {\n const { stdout } = await exec(\n 'secret-tool',\n ['lookup', 'service', KEYCHAIN_SERVICE, 'account', account],\n undefined,\n callOpts(o),\n );\n const value = oneNewlineStripped(stdout);\n return value.length > 0 ? { kind: 'hit', value } : { kind: 'miss' };\n } catch (err) {\n return classifyStoreFailure('secret-service', err);\n }\n };\n return {\n source: 'secret-service',\n read,\n storable: readsBackFromStdout,\n async store(account, secret, o) {\n // secret-tool store replaces an existing item itself; `update` adds nothing here.\n await exec(\n 'secret-tool',\n [\n 'store',\n `--label=${slot.label(account)}`,\n 'service',\n KEYCHAIN_SERVICE,\n 'account',\n account,\n ],\n secret,\n callOpts(o),\n );\n },\n async remove(account, o) {\n try {\n await exec(\n 'secret-tool',\n ['clear', 'service', KEYCHAIN_SERVICE, 'account', account],\n undefined,\n callOpts(o),\n );\n return true;\n } catch {\n return false;\n }\n },\n async probe(o) {\n const got = await read(PROBE_ACCOUNT, o);\n if (got.kind === 'hit' || got.kind === 'miss') return { probe: 'available' };\n if (got.kind === 'absent') return { probe: 'absent', detail: got.detail };\n return { probe: 'uncertain', detail: got.detail };\n },\n };\n}\n\n/**\n * The plaintext FILE store: the slot's `filePath`, the secret at 0600 in a\n * 0700 dir, no trailing newline. Used only where no OS store exists or with\n * `--insecure-storage`. A first write is NO-CLOBBER, like the wallet file; only\n * repair, after proving the old value wrong, replaces one (`update`). fs calls\n * are not killed, so the per-call deadline is accepted and ignored. A read\n * strips exactly one trailing `\\n` (someone may have written it with `echo`)\n * and nothing else: a secret ending in other whitespace round-trips, and one\n * ending in `\\n` is refused before any write (`storable`), so a failed save\n * never leaves a file that reads back as a different secret.\n */\nfunction fileStore(slot: SecretSlot): OsStore {\n return {\n source: 'file',\n async read(account) {\n try {\n const value = oneLfStripped(await readFile(slot.filePath(account), 'utf8'));\n return value.length > 0 ? { kind: 'hit', value } : { kind: 'miss' };\n } catch (err) {\n return classifyStoreFailure('file', err);\n }\n },\n // The read strips one trailing LF, so a value ending in one never reads back.\n storable: (value) => !value.endsWith('\\n'),\n async store(account, value, o) {\n const path = slot.filePath(account);\n const mode = { mode: 0o600, dirMode: 0o700 };\n if (o?.update === true) return writeFileAtomic(path, value, mode);\n try {\n await writeFileAtomicExclusive(path, value, mode);\n } catch (err) {\n // AN EMPTY FILE HOLDS NO SECRET. On Windows the exclusive write opens the\n // target itself before writing, so a crash in between leaves it empty;\n // it reads as a miss, and without this every later save (repair\n // included) would hit EEXIST forever. Replacing it loses nothing.\n if (!hasCode(err, 'EEXIST') || (await stat(path).catch(() => null))?.size !== 0) throw err;\n await writeFileAtomic(path, value, mode);\n }\n },\n async remove(account) {\n try {\n await unlink(slot.filePath(account));\n return true;\n } catch {\n return false;\n }\n },\n probe: async () => ({ probe: 'available' }),\n };\n}\n\n/** The per-call exec options for a store call: the deadline when one was given, else none. */\nfunction callOpts(o: StoreCallOptions | undefined): { timeoutMs?: number } | undefined {\n return o?.timeoutMs !== undefined ? { timeoutMs: o.timeoutMs } : undefined;\n}\n\n/**\n * Whether a value survives a read that strips one trailing newline (LF or\n * CRLF) from the store CLI's stdout: one that ends in CR or LF does not.\n */\nfunction readsBackFromStdout(value: string): boolean {\n return !/[\\r\\n]$/.test(value);\n}\n\n/** A store payload with exactly one optional trailing newline (LF or CRLF) stripped. */\nfunction oneNewlineStripped(stdout: string): string {\n return stdout.replace(/\\r?\\n$/, '');\n}\n\n/** File contents with exactly one trailing LF stripped. */\nfunction oneLfStripped(text: string): string {\n return text.endsWith('\\n') ? text.slice(0, -1) : text;\n}\n\n/** Reads one line of hidden input, writing `label` to stderr (never stdout). */\nexport type PromptFn = (label: string) => Promise<string>;\n\n// Control bytes handled by the raw-mode reader, named to avoid literal control\n// characters in the source.\nconst CTRL_C = 0x03;\nconst CTRL_D = 0x04;\nconst BACKSPACE = 0x7f;\nconst BACKSPACE_ALT = 0x08;\n\n/**\n * A reader of one line of input that never echoes it. The prompt label goes to\n * stderr so stdout stays the single JSON envelope; typed characters are\n * consumed in raw mode and never printed. Ctrl-C rejects with `cancelled()`,\n * which names what was being entered. Only ever called on a real TTY (callers\n * gate it), so setRawMode is present; tests inject their own prompt and never\n * reach this.\n */\nexport function hiddenPrompt(cancelled: () => CliError): PromptFn {\n return (label) =>\n new Promise((resolve, reject) => {\n const stdin = process.stdin;\n const stderr = process.stderr;\n const wasRaw = stdin.isRaw;\n let value = '';\n\n const cleanup = (): void => {\n stdin.setRawMode?.(wasRaw ?? false);\n stdin.pause();\n stdin.removeListener('data', onData);\n };\n const onData = (chunk: Buffer | string): void => {\n for (const ch of chunk.toString('utf8')) {\n const code = ch.charCodeAt(0);\n if (ch === '\\n' || ch === '\\r' || code === CTRL_D) {\n // Enter or Ctrl-D: submit what we have.\n cleanup();\n stderr.write('\\n');\n resolve(value);\n return;\n }\n if (code === CTRL_C) {\n cleanup();\n stderr.write('\\n');\n reject(cancelled());\n return;\n }\n if (code === BACKSPACE || code === BACKSPACE_ALT) {\n value = value.slice(0, -1);\n } else {\n value += ch;\n }\n }\n };\n\n stderr.write(label);\n stdin.setRawMode?.(true);\n stdin.resume();\n stdin.on('data', onData);\n });\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAS,gBAAgB;AACzB,SAAS,UAAU,MAAM,cAAc;AAwBhC,IAAM,mBAAmB;AAOhC,IAAM,eAAe;AASrB,IAAM,qBAAqB;AA4BpB,I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