very-happy-cli 0.2.190 → 0.2.192

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 (214) hide show
  1. package/dist/{AcpBackend-dkRv9QHm.cjs → AcpBackend-BQO4ShOy.cjs} +3 -3
  2. package/dist/{AcpBackend-Dd1h-Rgt.mjs → AcpBackend-CGHTDJd9.mjs} +3 -3
  3. package/dist/{AcpSessionManager-QBZ-CIf7.mjs → AcpSessionManager-G0xD6Jbq.mjs} +2 -2
  4. package/dist/{AcpSessionManager-AqWAqahm.cjs → AcpSessionManager-LlUMmcpB.cjs} +2 -2
  5. package/dist/{BasePermissionHandler-CLp1ge-4.mjs → BasePermissionHandler-BmTIg376.mjs} +1 -1
  6. package/dist/{BasePermissionHandler-CpSugp7Z.cjs → BasePermissionHandler-N6Ip3tFt.cjs} +1 -1
  7. package/dist/account-CCVT-HO_.mjs +240 -0
  8. package/dist/account-DtaouikP.cjs +245 -0
  9. package/dist/accountService-Bddy0zwL.cjs +571 -0
  10. package/dist/accountService-Dd9uqde2.mjs +566 -0
  11. package/dist/{acpSessionResume-CcpDuIO5.mjs → acpSessionResume-BWEUxNtC.mjs} +1 -1
  12. package/dist/{acpSessionResume-CZao6QEd.cjs → acpSessionResume-BnHDk5eD.cjs} +1 -1
  13. package/dist/{agentHome-BJGRA2Kx.mjs → agentHome-B0VnjkZW.mjs} +4 -4
  14. package/dist/{agentHome-fIUqT-pn.cjs → agentHome-CqQ29YY7.cjs} +4 -4
  15. package/dist/{api-Dw8gFsQi.mjs → api-_LeBScjg.mjs} +10 -10
  16. package/dist/{api-CXL6jp-p.cjs → api-hMDsC6Wg.cjs} +10 -10
  17. package/dist/{apiMachine-BBNEtjf7.mjs → apiMachine-CgRldeJ6.mjs} +76 -21
  18. package/dist/{apiMachine-C6UqHoPF.cjs → apiMachine-CqW2m6Zr.cjs} +81 -26
  19. package/dist/{attachmentContent-NmVfKp-B.cjs → attachmentContent-BEeT2J5n.cjs} +2 -2
  20. package/dist/{attachmentContent-CC4yIrSm.mjs → attachmentContent-CyptLIfq.mjs} +2 -2
  21. package/dist/{auth-Bb_SL2os.cjs → auth-C9NvNHhL.cjs} +5 -5
  22. package/dist/{auth-DKa4MsAi.cjs → auth-CA1OClsW.cjs} +8 -8
  23. package/dist/{auth-Bh6SUoGi.mjs → auth-CFQikywl.mjs} +8 -8
  24. package/dist/{auth-Bj0psrD2.mjs → auth-DL8_J9vu.mjs} +5 -5
  25. package/dist/{auto-DK7pbCnV.mjs → auto-CKI05w1D.mjs} +17 -17
  26. package/dist/{auto-C9Qohh0P.cjs → auto-uQOxlxLp.cjs} +17 -17
  27. package/dist/{bootstrap-Ct9Nb4sv.mjs → bootstrap-DaZ0Np7X.mjs} +2 -2
  28. package/dist/{bootstrap-DBJB0y-H.cjs → bootstrap-DsZGc69k.cjs} +2 -2
  29. package/dist/{browser-BGxDRhHy.mjs → browser-BUIaSHK2.mjs} +1 -1
  30. package/dist/{browser-CLJWcodR.cjs → browser-Ft0ASDm7.cjs} +1 -1
  31. package/dist/claudeAccountEnv-BOBpJ3k8.cjs +137 -0
  32. package/dist/claudeAccountEnv-ON24i0qv.mjs +132 -0
  33. package/dist/{claudeLocal-Ux31hZyC.mjs → claudeLocal-B1ZVtryl.mjs} +5 -5
  34. package/dist/{claudeLocal-B6YDYlnY.cjs → claudeLocal-BMf9t4Fa.cjs} +5 -5
  35. package/dist/{claudeLocalLauncher-D06QijMw.mjs → claudeLocalLauncher-Bp8bqF4y.mjs} +10 -10
  36. package/dist/{claudeLocalLauncher-DFvmF8rC.cjs → claudeLocalLauncher-C8TeJcfF.cjs} +10 -10
  37. package/dist/{claudeSessionFork-D2GI7P59.mjs → claudeSessionFork-8AA47z8Y.mjs} +1 -1
  38. package/dist/{claudeSessionFork-DTLZ2rek.cjs → claudeSessionFork-YiktY55n.cjs} +1 -1
  39. package/dist/{client-CnGNYidN.mjs → client-Bm4oKvW7.mjs} +2 -2
  40. package/dist/{client-CtL0Vtww.mjs → client-BmPaBnDK.mjs} +4 -4
  41. package/dist/{client-CARZ_lNS.cjs → client-CFHZfh9x.cjs} +4 -4
  42. package/dist/{client-Bffkrs5p.cjs → client-Crh8_cNx.cjs} +2 -2
  43. package/dist/{client-DZkBUoh9.mjs → client-Cxlp_D4I.mjs} +2 -2
  44. package/dist/{client-CMKGrnmT.cjs → client-D8XROyZc.cjs} +2 -2
  45. package/dist/codex/happyMcpStdioBridge.cjs +16 -16
  46. package/dist/codex/happyMcpStdioBridge.mjs +16 -16
  47. package/dist/{codexAppServerClient-CLc5nhLT.mjs → codexAppServerClient-BWJbLCQn.mjs} +3 -3
  48. package/dist/{codexAppServerClient-CpT9F6EM.cjs → codexAppServerClient-q8GHQhyC.cjs} +3 -3
  49. package/dist/{codexCommand-Dliq3EBv.mjs → codexCommand-BfXfRQr4.mjs} +121 -61
  50. package/dist/{codexCommand-39kH99SJ.cjs → codexCommand-BgpGg-Zy.cjs} +121 -61
  51. package/dist/{codexTermination-ByW7tRjr.cjs → codexTermination-CVUF0X75.cjs} +1 -1
  52. package/dist/{codexTermination-ORIw0gpU.mjs → codexTermination-s9fd1gkA.mjs} +1 -1
  53. package/dist/{config-CeIzCsfj.cjs → config-BAjyTyYp.cjs} +3 -3
  54. package/dist/{config-CxSsGO1Z.mjs → config-BF8XgLyc.mjs} +3 -3
  55. package/dist/{configuration-Dt5lKW3P.cjs → configuration-CXEVKAyF.cjs} +1 -1
  56. package/dist/{configuration-Dechcvd-.mjs → configuration-IhRiLDVe.mjs} +1 -1
  57. package/dist/{connect-UwQHvCpR.mjs → connect-LZh1gr08.mjs} +13 -13
  58. package/dist/{connect-NPDzIVC6.cjs → connect-rCS56arw.cjs} +13 -13
  59. package/dist/{context-BdZssgF0.cjs → context-3_S_mWz9.cjs} +1 -1
  60. package/dist/{context-C9JbJoNe.mjs → context-DO6F5YwH.mjs} +1 -1
  61. package/dist/{controlClient-D7NGfmtq.mjs → controlClient-8ILulwjc.mjs} +14 -5
  62. package/dist/{controlClient-BRk65BRO.cjs → controlClient-j7p5p3_7.cjs} +15 -4
  63. package/dist/{createSessionMetadata-B_HZCDj_.cjs → createSessionMetadata-DwdD_uVo.cjs} +2 -2
  64. package/dist/{createSessionMetadata-DyhFKAby.mjs → createSessionMetadata-oyaTZm1b.mjs} +2 -2
  65. package/dist/daemonAccounts-BCjDgoNt.cjs +51 -0
  66. package/dist/daemonAccounts-BJgt6IJe.mjs +27 -0
  67. package/dist/defaultPermissionMode-BFShzF55.cjs +49 -0
  68. package/dist/defaultPermissionMode-Lt3PUCwY.mjs +43 -0
  69. package/dist/{deterministicJson-BEygolBQ.cjs → deterministicJson-DUN0v3St.cjs} +13 -13
  70. package/dist/{deterministicJson-DNmMVhFu.mjs → deterministicJson-Dfp-7wUZ.mjs} +13 -13
  71. package/dist/{doctor-BdBi7TFZ.mjs → doctor-B_UwMcVT.mjs} +7 -7
  72. package/dist/{doctor-B9lW1WlG.cjs → doctor-FgUYTbAT.cjs} +7 -7
  73. package/dist/{downloadTarget-DS0zT2AU.cjs → downloadTarget-BrrQEDxg.cjs} +6 -6
  74. package/dist/{downloadTarget-CGojGjaN.mjs → downloadTarget-C0d6jRx-.mjs} +6 -6
  75. package/dist/{ensureDaemonRunning-Bibp6vhe.cjs → ensureDaemonRunning-Cq4FYI5Q.cjs} +5 -5
  76. package/dist/{ensureDaemonRunning-BOdbryDM.mjs → ensureDaemonRunning-KUMFfIil.mjs} +5 -5
  77. package/dist/{handleResumeCommand-CgLzBYne.mjs → handleResumeCommand-BGhVo3QH.mjs} +5 -5
  78. package/dist/{handleResumeCommand-DXOuWr4p.cjs → handleResumeCommand-Cl9GIL5F.cjs} +5 -5
  79. package/dist/{index-Db0HIC-k.mjs → index-BjXjMhGY.mjs} +4 -4
  80. package/dist/{index-BOe6dKnL.cjs → index-BzAYnYct.cjs} +186 -0
  81. package/dist/{index-CwRW11hT.cjs → index-CQ_hLLCj.cjs} +3 -3
  82. package/dist/{index-DXSIi6j_.cjs → index-CRipkiqo.cjs} +4 -4
  83. package/dist/{index-Bs5FD8JF.cjs → index-CZaLMmPC.cjs} +4 -4
  84. package/dist/{index-CBHfkQNY.mjs → index-Ca1Tt96A.mjs} +45 -41
  85. package/dist/{index-f8oDidjV.cjs → index-D8ODb0_U.cjs} +44 -40
  86. package/dist/{index-DmqsRnV7.mjs → index-DYD3GM1m.mjs} +168 -1
  87. package/dist/{index-rNTX33in.mjs → index-JQDyJ3Li.mjs} +3 -3
  88. package/dist/{index-DUByZsKe.mjs → index-v5EmjT8l.mjs} +4 -4
  89. package/dist/index.cjs +2 -2
  90. package/dist/index.mjs +2 -2
  91. package/dist/{install-CXIL_FYx.cjs → install-ClUA9tbC.cjs} +3 -3
  92. package/dist/{install-DfPrEWGG.mjs → install-D6EHRtAN.mjs} +3 -3
  93. package/dist/lib.cjs +12 -12
  94. package/dist/lib.d.cts +292 -0
  95. package/dist/lib.d.mts +292 -0
  96. package/dist/lib.mjs +12 -12
  97. package/dist/{lidState-D0DF20oG.mjs → lidState-CZOXXdzv.mjs} +1 -1
  98. package/dist/{lidState-q_XFYg33.cjs → lidState-DqoN7zH4.cjs} +1 -1
  99. package/dist/{localHappyAgentAuth-CKNW-MXw.cjs → localHappyAgentAuth-BnGCpHRX.cjs} +1 -1
  100. package/dist/{localHappyAgentAuth-BBhM4Qk1.mjs → localHappyAgentAuth-YHxDZ4x4.mjs} +1 -1
  101. package/dist/{logger-BBRTTVsQ.cjs → logger-8su64lqR.cjs} +2 -2
  102. package/dist/{logger-CL7pin9b.mjs → logger-Fd_rNvgd.mjs} +2 -2
  103. package/dist/{machineMetadata-DP06qdBk.mjs → machineMetadata-1HIIC7Bc.mjs} +3 -3
  104. package/dist/{machineMetadata-DnFNlrVK.cjs → machineMetadata-DYXt3p6u.cjs} +3 -3
  105. package/dist/{main-DO7nRvhf.mjs → main-BI6GIzUL.mjs} +92 -48
  106. package/dist/{main-DLOXykOR.cjs → main-C_GrcYkn.cjs} +92 -48
  107. package/dist/{mcp-Du0MgR7e.cjs → mcp-BycIv9oQ.cjs} +18 -15
  108. package/dist/{mcp-C-4sPTae.mjs → mcp-XGoxywno.mjs} +18 -15
  109. package/dist/{mirrorProtocol-GuWMxLkh.cjs → mirrorProtocol-DVnB8EO8.cjs} +3 -3
  110. package/dist/{mirrorProtocol-dkq2ZENA.mjs → mirrorProtocol-DXT3rv7T.mjs} +3 -3
  111. package/dist/{package-C6uiXULx.mjs → package-6KkRAops.mjs} +7 -7
  112. package/dist/{package-DrY090nZ.cjs → package-iuLlSiSF.cjs} +7 -7
  113. package/dist/{panels-4DRBKHZP.cjs → panels-0C89q0Tu.cjs} +5 -5
  114. package/dist/{panels-DXYdJA6n.mjs → panels-B5Di2zb2.mjs} +5 -5
  115. package/dist/{peerTools-5ZM4spcZ.cjs → peerTools-CANTX_mG.cjs} +5 -5
  116. package/dist/{peerTools-dY1aJez4.mjs → peerTools-CKJ-IDM4.mjs} +5 -5
  117. package/dist/{persistence-Bl5S3TLB.cjs → persistence-B4ttN-fR.cjs} +2 -2
  118. package/dist/{persistence-Dogj7JIp.mjs → persistence-DWcHe035.mjs} +2 -2
  119. package/dist/{piRunnerArgs-C3jZ1M6b.cjs → piRunnerArgs-BOkfxyak.cjs} +1 -1
  120. package/dist/{piRunnerArgs-D8nN_Iit.mjs → piRunnerArgs-Bl5GpBoN.mjs} +2 -2
  121. package/dist/{piRuntime-BoeMsAXK.mjs → piRuntime-BhwxzdQf.mjs} +1 -1
  122. package/dist/{piRuntime-Bd9-eq6M.cjs → piRuntime-DzrIiZU8.cjs} +1 -1
  123. package/dist/{piTerminal-C3j1ca3x.cjs → piTerminal-BdS7ol7v.cjs} +20 -17
  124. package/dist/{piTerminal-GEPkIGD4.mjs → piTerminal-DnA2CbGr.mjs} +20 -17
  125. package/dist/{pushNotifications-CfspRcl-.cjs → pushNotifications-BqFoLye2.cjs} +12 -3
  126. package/dist/{pushNotifications-dUceOIni.mjs → pushNotifications-DkQ0yvFs.mjs} +12 -3
  127. package/dist/{query-DjsVgG3E.cjs → query-BQ4br3yn.cjs} +1 -1
  128. package/dist/{query-iYH-tm7L.mjs → query-BRJYSkb1.mjs} +1 -1
  129. package/dist/{rateLimitReporter-jeVi-fym.mjs → rateLimitReporter-BRbYkmuP.mjs} +3 -3
  130. package/dist/{rateLimitReporter-DUu2KydZ.cjs → rateLimitReporter-DK5SQuCc.cjs} +3 -3
  131. package/dist/{rateLimitWindows-Bx3ROBP5.cjs → rateLimitWindows-DBfiuYeg.cjs} +1 -1
  132. package/dist/{rateLimitWindows-CEn0DXaX.mjs → rateLimitWindows-Da5AR-4u.mjs} +1 -1
  133. package/dist/reconnectEnv-B31lY4nR.cjs +27 -0
  134. package/dist/reconnectEnv-DeSvHl3q.mjs +24 -0
  135. package/dist/{registerCommonHandlers-Beun-cQv.cjs → registerCommonHandlers-m6pxxf2J.cjs} +2 -2
  136. package/dist/{registerCommonHandlers-DWZ7mfdt.mjs → registerCommonHandlers-yQ7Ru-l0.mjs} +2 -2
  137. package/dist/{registerKillSessionHandler-CA1FFr_F.cjs → registerKillSessionHandler-BAOIa_Fs.cjs} +6 -6
  138. package/dist/{registerKillSessionHandler-CzgklwLG.mjs → registerKillSessionHandler-BDNpi7YO.mjs} +6 -6
  139. package/dist/{remoteSessionClient-BiC2KDew.mjs → remoteSessionClient-CZ7aaNgj.mjs} +5 -5
  140. package/dist/{remoteSessionClient-DGFI__5Z.cjs → remoteSessionClient-iJMXRN_D.cjs} +5 -5
  141. package/dist/{reportProgressTool-CgPy6n_7.mjs → reportProgressTool-DfQhPu0s.mjs} +3 -3
  142. package/dist/{reportProgressTool-CvPGov1F.cjs → reportProgressTool-DpFs7pSe.cjs} +3 -3
  143. package/dist/{run-B_gFgJVB.mjs → run-CwN28mcj.mjs} +215 -52
  144. package/dist/{run-rPqQwDi_.cjs → run-p-xp1_HY.cjs} +214 -51
  145. package/dist/{runClaude-DM8gm8iu.cjs → runClaude-D6U1Z575.cjs} +83 -48
  146. package/dist/{runClaude-CykqeXK7.mjs → runClaude-DRKtAGTm.mjs} +83 -48
  147. package/dist/{runClaudeDeps-D2phXGut.mjs → runClaudeDeps-BheVcIlD.mjs} +147 -69
  148. package/dist/{runClaudeDeps-DGAomimZ.cjs → runClaudeDeps-Dkofokgb.cjs} +142 -64
  149. package/dist/{runGemini-CXTeSOZp.cjs → runGemini-C8q3YCc0.cjs} +33 -33
  150. package/dist/{runGemini-CtWCVkj5.mjs → runGemini-owbvhFbi.mjs} +33 -33
  151. package/dist/{runOpenClaw-CH_9_RyZ.cjs → runOpenClaw-DGeN66-t.cjs} +18 -18
  152. package/dist/{runOpenClaw-BBdjlViJ.mjs → runOpenClaw-Dky3-mjO.mjs} +18 -18
  153. package/dist/{sandbox-Bb5IMun3.cjs → sandbox-D2CPyoCA.cjs} +4 -4
  154. package/dist/{sandbox-DGmXZ6Zz.mjs → sandbox-sq_wy9Gl.mjs} +4 -4
  155. package/dist/{selfCheck-CccwNTTK.cjs → selfCheck-BgLvQKSt.cjs} +39 -37
  156. package/dist/selfCheck-vkfrgQ7X.mjs +88 -0
  157. package/dist/{send-BpiXPkDo.cjs → send-Cd10YhXh.cjs} +8 -8
  158. package/dist/{send-B6rHg8GT.mjs → send-K9vg-8t-.mjs} +8 -8
  159. package/dist/{server-DHUzjApC.cjs → server-DRrV64r0.cjs} +6 -6
  160. package/dist/{server-BkdAyHhC.mjs → server-De4W1zuK.mjs} +4 -4
  161. package/dist/{sessionLock-BFBReiKq.cjs → sessionLock-BDtSzzKS.cjs} +10 -3
  162. package/dist/{sessionLock-Ca_bIo50.mjs → sessionLock-Dl6i7IgA.mjs} +10 -4
  163. package/dist/{sessionOps-DeWVqpe4.cjs → sessionOps-DvnEH4PL.cjs} +6 -4
  164. package/dist/{sessionOps-CA2kpm66.mjs → sessionOps-gU88-W9F.mjs} +6 -4
  165. package/dist/sessionProvider-CKcIo7KO.mjs +108 -0
  166. package/dist/sessionProvider-CbSZeZrl.cjs +113 -0
  167. package/dist/{sessionScanner-CGzsN8V6.cjs → sessionScanner-7RtcCeyD.cjs} +3 -3
  168. package/dist/{sessionScanner-DDDud5re.mjs → sessionScanner-DR32uSby.mjs} +3 -3
  169. package/dist/{sessions-CKJPWFgu.cjs → sessions-BvuMjgvJ.cjs} +10 -10
  170. package/dist/{sessions-B4d50sCI.mjs → sessions-DTt2Eguk.mjs} +10 -10
  171. package/dist/{setupOfflineReconnection-CyPNgyCe.mjs → setupOfflineReconnection-BGnvhRfb.mjs} +2 -2
  172. package/dist/{setupOfflineReconnection-DPXRo_zf.cjs → setupOfflineReconnection-DduOsw6p.cjs} +2 -2
  173. package/dist/{spawn-CrYN_OOT.mjs → spawn-CL3cUc7b.mjs} +26 -17
  174. package/dist/{spawn-CgSJzzWS.cjs → spawn-DMB6rRPA.cjs} +26 -17
  175. package/dist/{spawnAgents-C1-4m7aN.cjs → spawnAgents-CClb7buD.cjs} +8 -2
  176. package/dist/{spawnAgents-DWCDYCQ1.mjs → spawnAgents-CRMfOJhh.mjs} +8 -2
  177. package/dist/{spawnHappyCLI-DjbkiSH1.mjs → spawnHappyCLI-Cj_6IICe.mjs} +1 -1
  178. package/dist/{spawnHappyCLI-CTy3p6V_.cjs → spawnHappyCLI-DJdhX_Qx.cjs} +1 -1
  179. package/dist/{startFileWatcher-Dedtu1vq.mjs → startFileWatcher-DikVa8kg.mjs} +1 -1
  180. package/dist/{startFileWatcher-BQs0cJA-.cjs → startFileWatcher-LnOmVW6H.cjs} +1 -1
  181. package/dist/{startupSessionCreate-Dxy3X4DG.cjs → startupSessionCreate-B3ND-917.cjs} +3 -3
  182. package/dist/{startupSessionCreate-BKFU4v_h.mjs → startupSessionCreate-CDdaLaMq.mjs} +3 -3
  183. package/dist/store--XN-7MS0.mjs +269 -0
  184. package/dist/store-DV__wCvP.cjs +289 -0
  185. package/dist/{streamRelay-D9a4cBEa.cjs → streamRelay-DFdOaLOn.cjs} +1 -1
  186. package/dist/{streamRelay-P9e7Sohm.mjs → streamRelay-sABnxEXq.mjs} +1 -1
  187. package/dist/{sync-eZkXnsW_.mjs → sync-JoEZKRo8.mjs} +1 -1
  188. package/dist/{sync-DtWB7RzA.cjs → sync-_2lsZ1U2.cjs} +1 -1
  189. package/dist/{systemPrompt-2XOpZ1j6.cjs → systemPrompt-CJEvNCuW.cjs} +2 -2
  190. package/dist/{systemPrompt-Bn6g6aCH.mjs → systemPrompt-Zq4HyrZ5.mjs} +2 -2
  191. package/dist/{teams-ecFay4Gn.cjs → teams-BNZafnrT.cjs} +7 -7
  192. package/dist/{teams-nadkqrbW.mjs → teams-qz4LqKJ2.mjs} +7 -7
  193. package/dist/{template-BiTD-jI9.mjs → template-CJ8BWSsc.mjs} +1 -1
  194. package/dist/{template-17HATY_Y.cjs → template-LgvBbOna.cjs} +1 -1
  195. package/dist/{time-gPD_EmA-.cjs → time-CaUlWSNJ.cjs} +1 -1
  196. package/dist/{time-CN3TuSVG.mjs → time-bzmet4s5.mjs} +1 -1
  197. package/dist/{titleGenerator-lT5ldPuN.cjs → titleGenerator-BuIIu_JP.cjs} +17 -13
  198. package/dist/{titleGenerator-DgzTQdn2.mjs → titleGenerator-CbTtJ_1D.mjs} +16 -12
  199. package/dist/{todo-B1VeMk5A.cjs → todo-CQ_BTf9C.cjs} +6 -6
  200. package/dist/{todo-BIxd7l2Q.mjs → todo-DIrVF_Ak.mjs} +6 -6
  201. package/dist/{tools-DvqbLsCF.cjs → tools-BnmmFZji.cjs} +1 -1
  202. package/dist/{tools-zXJpxiG_.mjs → tools-cLOjBvPn.mjs} +1 -1
  203. package/dist/{uninstall-9htK6mb7.mjs → uninstall-C5OuW6dE.mjs} +3 -3
  204. package/dist/{uninstall-CvIOpwB5.cjs → uninstall-uEEGKB84.cjs} +3 -3
  205. package/dist/wrapperAccount-DXlD3bsO.mjs +106 -0
  206. package/dist/wrapperAccount-DzoGqS2b.cjs +110 -0
  207. package/package.json +7 -7
  208. package/dist/defaultPermissionMode-BnxJPVHT.mjs +0 -4
  209. package/dist/defaultPermissionMode-CxmTXUQR.cjs +0 -7
  210. package/dist/providerBinding-B-Qbx9W2.cjs +0 -140
  211. package/dist/providerBinding-CYubGg-Z.mjs +0 -132
  212. package/dist/selfCheck-BfK945YQ.mjs +0 -86
  213. package/dist/sessionProvider-VFbtUmMR.cjs +0 -114
  214. package/dist/sessionProvider-g18IiK74.mjs +0 -109
@@ -3,7 +3,7 @@
3
3
  var spawn = require('cross-spawn');
4
4
  var path = require('node:path');
5
5
  var projectPath = require('./projectPath-C3ioB4Bu.cjs');
6
- var logger = require('./logger-BBRTTVsQ.cjs');
6
+ var logger = require('./logger-8su64lqR.cjs');
7
7
  var node_fs = require('node:fs');
8
8
 
9
9
  let cachedRuntime = null;
@@ -1,4 +1,4 @@
1
- import { l as logger } from './logger-CL7pin9b.mjs';
1
+ import { l as logger } from './logger-Fd_rNvgd.mjs';
2
2
  import { watch } from 'fs/promises';
3
3
 
4
4
  function startFileWatcher(file, onFileChange, options = {}) {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var logger = require('./logger-BBRTTVsQ.cjs');
3
+ var logger = require('./logger-8su64lqR.cjs');
4
4
  var fs = require('fs/promises');
5
5
 
6
6
  function startFileWatcher(file, onFileChange, options = {}) {
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var logger = require('./logger-BBRTTVsQ.cjs');
4
- var persistence = require('./persistence-Bl5S3TLB.cjs');
5
- var api = require('./api-CXL6jp-p.cjs');
3
+ var logger = require('./logger-8su64lqR.cjs');
4
+ var persistence = require('./persistence-B4ttN-fR.cjs');
5
+ var api = require('./api-hMDsC6Wg.cjs');
6
6
 
7
7
  const PRESENCE_SETTLE_MS = 6e3;
8
8
  async function commitHibernation(deps) {
@@ -1,6 +1,6 @@
1
- import { l as logger } from './logger-CL7pin9b.mjs';
2
- import { e as evaluateWrapperIdle, j as isQuiescent, k as HIBERNATION_UNSUPPORTED_BACKOFF_MS } from './persistence-Dogj7JIp.mjs';
3
- import { c as connectionState } from './api-Dw8gFsQi.mjs';
1
+ import { l as logger } from './logger-Fd_rNvgd.mjs';
2
+ import { e as evaluateWrapperIdle, j as isQuiescent, k as HIBERNATION_UNSUPPORTED_BACKOFF_MS } from './persistence-DWcHe035.mjs';
3
+ import { c as connectionState } from './api-_LeBScjg.mjs';
4
4
 
5
5
  const PRESENCE_SETTLE_MS = 6e3;
6
6
  async function commitHibernation(deps) {
@@ -0,0 +1,269 @@
1
+ import { readFileSync, existsSync, mkdirSync, chmodSync, writeFileSync, renameSync, rmSync } from 'node:fs';
2
+ import { homedir } from 'node:os';
3
+ import { join, dirname } from 'node:path';
4
+
5
+ function providersPath(happyHomeDir) {
6
+ return join(happyHomeDir, "providers.json");
7
+ }
8
+ function sessionProvidersPath(happyHomeDir) {
9
+ return join(happyHomeDir, "session-providers.json");
10
+ }
11
+ function parseProvidersFile(raw) {
12
+ const profiles = {};
13
+ const src = raw && typeof raw === "object" ? raw.profiles : void 0;
14
+ if (src && typeof src === "object") {
15
+ for (const [id, p] of Object.entries(src)) {
16
+ if (!p || typeof p !== "object") continue;
17
+ const { name, baseUrl, apiKeyFile, models } = p;
18
+ if (typeof baseUrl !== "string" || !/^https?:\/\//.test(baseUrl) || typeof apiKeyFile !== "string" || !apiKeyFile) continue;
19
+ const ids = [];
20
+ const contextWindows = {};
21
+ for (const m of Array.isArray(models) ? models : []) {
22
+ if (typeof m === "string") ids.push(m);
23
+ else if (m && typeof m === "object" && typeof m.id === "string") {
24
+ const { id: modelId, contextWindow } = m;
25
+ ids.push(modelId);
26
+ if (typeof contextWindow === "number" && Number.isInteger(contextWindow) && contextWindow > 0) contextWindows[modelId] = contextWindow;
27
+ }
28
+ }
29
+ profiles[id] = {
30
+ ...typeof name === "string" ? { name } : {},
31
+ baseUrl: baseUrl.replace(/\/+$/, ""),
32
+ apiKeyFile,
33
+ ...Array.isArray(models) ? { models: ids } : {},
34
+ ...Object.keys(contextWindows).length > 0 ? { contextWindows } : {}
35
+ };
36
+ }
37
+ }
38
+ return { profiles };
39
+ }
40
+ function parseSessionProvidersFile(raw) {
41
+ const out = {};
42
+ if (!raw || typeof raw !== "object") return out;
43
+ for (const [sessionId, b] of Object.entries(raw)) {
44
+ if (!b || typeof b !== "object") continue;
45
+ const { profile, model } = b;
46
+ if (typeof profile === "string" && profile && typeof model === "string" && model) out[sessionId] = { profile, model };
47
+ }
48
+ return out;
49
+ }
50
+
51
+ const SPAWN_ACCOUNT_ENV = "VH_AGENT_PROFILE_ID";
52
+ const SUBSCRIPTION_TOKEN_TTL_MS = 365 * 24 * 60 * 60 * 1e3;
53
+ const ACCOUNT_ID_PATTERN = /^[a-z0-9][a-z0-9-]{0,47}$/;
54
+ function accountsPath(home) {
55
+ return join(home, "accounts.json");
56
+ }
57
+ function accountSecretPath(home, id) {
58
+ if (!ACCOUNT_ID_PATTERN.test(id)) throw new Error(`invalid account id "${id}"`);
59
+ return join(home, "accounts", id, "secret");
60
+ }
61
+ function sessionAccountsPath(home) {
62
+ return join(home, "session-accounts.json");
63
+ }
64
+ function expandHome(path, home = homedir()) {
65
+ return path === "~" ? home : path.startsWith("~/") ? join(home, path.slice(2)) : path;
66
+ }
67
+ function readJson(path) {
68
+ if (!existsSync(path)) return void 0;
69
+ try {
70
+ return JSON.parse(readFileSync(path, "utf8"));
71
+ } catch {
72
+ return void 0;
73
+ }
74
+ }
75
+ function writeJson0600(path, value) {
76
+ mkdirSync(dirname(path), { recursive: true });
77
+ const tmp = `${path}.${process.pid}.${Date.now()}.tmp`;
78
+ writeFileSync(tmp, JSON.stringify(value, null, 2) + "\n", { mode: 384 });
79
+ chmodSync(tmp, 384);
80
+ renameSync(tmp, path);
81
+ }
82
+ function parseKey(raw) {
83
+ if (!raw || typeof raw !== "object") return void 0;
84
+ const k = raw;
85
+ if (k.source === "file" && typeof k.path === "string" && k.path) return { source: "file", path: k.path };
86
+ if (k.source === "env" && typeof k.name === "string" && /^[A-Za-z_][A-Za-z0-9_]*$/.test(k.name)) return { source: "env", name: k.name };
87
+ if (k.source === "stored") return { source: "stored" };
88
+ return void 0;
89
+ }
90
+ function parseAccountsFile(raw) {
91
+ const out = { version: 2, accounts: {}, defaults: {} };
92
+ if (!raw || typeof raw !== "object") return out;
93
+ const src = raw.accounts;
94
+ if (src && typeof src === "object") {
95
+ for (const [id, value] of Object.entries(src)) {
96
+ if (!ACCOUNT_ID_PATTERN.test(id) || !value || typeof value !== "object") continue;
97
+ const a = value;
98
+ if (a.agent !== "claude" || a.kind !== "claude-subscription" && a.kind !== "claude-api") continue;
99
+ const label = typeof a.label === "string" && a.label.trim() ? a.label.trim() : id;
100
+ const rec = { label, agent: "claude", kind: a.kind, createdAt: typeof a.createdAt === "number" ? a.createdAt : 0 };
101
+ if (a.kind === "claude-api") {
102
+ if (typeof a.baseUrl !== "string" || !/^https?:\/\//.test(a.baseUrl)) continue;
103
+ const key = parseKey(a.key);
104
+ if (!key) continue;
105
+ rec.baseUrl = a.baseUrl.replace(/\/+$/, "");
106
+ rec.key = key;
107
+ if (Array.isArray(a.models)) rec.models = a.models.filter((m) => typeof m === "string" && m.length > 0);
108
+ if (a.contextWindows && typeof a.contextWindows === "object") {
109
+ const cw = {};
110
+ for (const [m, n] of Object.entries(a.contextWindows)) {
111
+ if (typeof n === "number" && Number.isInteger(n) && n > 0) cw[m] = n;
112
+ }
113
+ if (Object.keys(cw).length > 0) rec.contextWindows = cw;
114
+ }
115
+ }
116
+ if (typeof a.expiresAt === "number") rec.expiresAt = a.expiresAt;
117
+ if (a.check && typeof a.check === "object") {
118
+ const c = a.check;
119
+ if (typeof c.status === "string" && typeof c.at === "number") {
120
+ rec.check = { status: c.status, at: c.at, ...typeof c.detail === "string" ? { detail: c.detail } : {} };
121
+ }
122
+ }
123
+ out.accounts[id] = rec;
124
+ }
125
+ }
126
+ const defaults = raw.defaults;
127
+ if (defaults && typeof defaults === "object") {
128
+ for (const [agent, id] of Object.entries(defaults)) {
129
+ if (typeof id === "string" && id) out.defaults[agent] = id;
130
+ }
131
+ }
132
+ return out;
133
+ }
134
+ function legacyAccountsFromProviders(raw) {
135
+ const out = {};
136
+ for (const [id, p] of Object.entries(parseProvidersFile(raw).profiles)) {
137
+ if (!ACCOUNT_ID_PATTERN.test(id)) continue;
138
+ out[id] = {
139
+ label: p.name ?? id,
140
+ agent: "claude",
141
+ kind: "claude-api",
142
+ createdAt: 0,
143
+ baseUrl: p.baseUrl,
144
+ key: { source: "file", path: p.apiKeyFile },
145
+ ...p.models ? { models: p.models } : {},
146
+ ...p.contextWindows ? { contextWindows: p.contextWindows } : {},
147
+ legacy: true
148
+ };
149
+ }
150
+ return out;
151
+ }
152
+ function mergeAccounts(v2, legacy) {
153
+ return { ...v2, accounts: { ...legacy, ...v2.accounts } };
154
+ }
155
+ function readAccountsFileV2(home) {
156
+ return parseAccountsFile(readJson(accountsPath(home)));
157
+ }
158
+ function readAccounts(home) {
159
+ return mergeAccounts(readAccountsFileV2(home), legacyAccountsFromProviders(readJson(providersPath(home))));
160
+ }
161
+ function writeAccountsFile(home, file) {
162
+ const accounts = {};
163
+ for (const [id, a] of Object.entries(file.accounts)) if (!a.legacy) accounts[id] = a;
164
+ writeJson0600(accountsPath(home), { version: 2, accounts, defaults: file.defaults });
165
+ }
166
+ function mergeSessionBindings(v2Raw, v1Raw) {
167
+ const out = {};
168
+ for (const [sessionId, b] of Object.entries(parseSessionProvidersFile(v1Raw))) out[sessionId] = { account: b.profile, model: b.model };
169
+ if (v2Raw && typeof v2Raw === "object") {
170
+ for (const [sessionId, b] of Object.entries(v2Raw)) {
171
+ if (!b || typeof b !== "object") continue;
172
+ const { account, model } = b;
173
+ if (account !== null && (typeof account !== "string" || !account)) continue;
174
+ out[sessionId] = { account, ...typeof model === "string" && model ? { model } : {} };
175
+ }
176
+ }
177
+ return out;
178
+ }
179
+ function readSessionBindings(home) {
180
+ return mergeSessionBindings(readJson(sessionAccountsPath(home)), readJson(sessionProvidersPath(home)));
181
+ }
182
+ function readSessionBindingV2(home, sessionId) {
183
+ const raw = readJson(sessionAccountsPath(home));
184
+ const entry = raw && typeof raw === "object" ? raw[sessionId] : void 0;
185
+ return entry && typeof entry === "object" ? entry : void 0;
186
+ }
187
+ function writeSessionBinding(home, sessionId, binding) {
188
+ const raw = readJson(sessionAccountsPath(home));
189
+ const current = raw && typeof raw === "object" ? { ...raw } : {};
190
+ if (binding === void 0) delete current[sessionId];
191
+ else current[sessionId] = binding;
192
+ writeJson0600(sessionAccountsPath(home), current);
193
+ }
194
+ function sessionsBoundTo(bindings, accountId) {
195
+ return Object.entries(bindings).filter(([, b]) => b.account === accountId).map(([id]) => id);
196
+ }
197
+ function writeAccountSecret(home, id, secret) {
198
+ const path = accountSecretPath(home, id);
199
+ mkdirSync(dirname(path), { recursive: true, mode: 448 });
200
+ chmodSync(dirname(path), 448);
201
+ const tmp = `${path}.${process.pid}.tmp`;
202
+ writeFileSync(tmp, secret.trim() + "\n", { mode: 384 });
203
+ chmodSync(tmp, 384);
204
+ renameSync(tmp, path);
205
+ }
206
+ function removeAccountSecret(home, id) {
207
+ rmSync(dirname(accountSecretPath(home, id)), { recursive: true, force: true });
208
+ }
209
+ function newAccountId(label, kind, taken) {
210
+ const used = new Set(taken);
211
+ const ascii = /^[\x20-\x7e]*$/.test(label);
212
+ const slug = ascii ? label.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40) : "";
213
+ const base = slug && /^[a-z0-9]/.test(slug) ? slug : kind === "claude-subscription" ? "claude-sub" : "claude-api";
214
+ if (!used.has(base)) return base;
215
+ for (let n = 2; ; n++) if (!used.has(`${base}-${n}`)) return `${base}-${n}`;
216
+ }
217
+ function secretPresent(home, id, a, probe) {
218
+ if (a.kind === "claude-subscription" || a.key?.source === "stored") return probe.fileReadable(accountSecretPath(home, id));
219
+ if (a.key?.source === "file") return probe.fileReadable(expandHome(a.key.path));
220
+ if (a.key?.source === "env") return !!probe.env[a.key.name]?.trim();
221
+ return false;
222
+ }
223
+ function accountStatus(home, id, a, probe, now) {
224
+ if (!secretPresent(home, id, a, probe)) return { status: "missing-secret" };
225
+ if (a.expiresAt !== void 0 && a.expiresAt <= now) return { status: "expired" };
226
+ if (a.check) return { status: a.check.status, ...a.check.detail ? { detail: a.check.detail } : {} };
227
+ return { status: "unverified" };
228
+ }
229
+ function summarizeAccount(home, id, a, probe, now) {
230
+ const { status, detail } = accountStatus(home, id, a, probe, now);
231
+ const keySource = a.kind === "claude-subscription" ? "stored" : a.key?.source;
232
+ const keyRef = a.key?.source === "file" ? a.key.path : a.key?.source === "env" ? a.key.name : void 0;
233
+ return {
234
+ id,
235
+ label: a.label,
236
+ agent: a.agent,
237
+ kind: a.kind,
238
+ status,
239
+ ...detail ? { statusDetail: detail } : {},
240
+ ...a.check ? { checkedAt: a.check.at } : {},
241
+ ...a.createdAt ? { createdAt: a.createdAt } : {},
242
+ ...a.expiresAt !== void 0 ? { expiresAt: a.expiresAt } : {},
243
+ ...a.baseUrl ? { baseUrl: a.baseUrl } : {},
244
+ ...a.models ? { models: a.models } : {},
245
+ ...keySource ? { keySource } : {},
246
+ ...keyRef ? { keyRef } : {},
247
+ ...a.legacy ? { legacy: true } : {}
248
+ };
249
+ }
250
+ function defaultSecretProbe(env = process.env) {
251
+ return {
252
+ fileReadable: (path) => {
253
+ try {
254
+ return readFileSync(path, "utf8").trim().length > 0;
255
+ } catch {
256
+ return false;
257
+ }
258
+ },
259
+ env
260
+ };
261
+ }
262
+ function buildAgentProfilesState(home, file, probe, now, daemonPid) {
263
+ const accounts = Object.entries(file.accounts).map(([id, a]) => summarizeAccount(home, id, a, probe, now)).sort((x, y) => (x.createdAt ?? 0) - (y.createdAt ?? 0) || x.id.localeCompare(y.id));
264
+ const defaults = {};
265
+ for (const [agent, id] of Object.entries(file.defaults)) if (file.accounts[id]) defaults[agent] = id;
266
+ return { daemonPid, updatedAt: now, accounts, defaults };
267
+ }
268
+
269
+ export { SPAWN_ACCOUNT_ENV as S, readAccounts as a, accountSecretPath as b, readAccountsFileV2 as c, defaultSecretProbe as d, expandHome as e, writeAccountsFile as f, accountsPath as g, buildAgentProfilesState as h, writeAccountSecret as i, sessionsBoundTo as j, removeAccountSecret as k, SUBSCRIPTION_TOKEN_TTL_MS as l, readSessionBindingV2 as m, newAccountId as n, providersPath as p, readSessionBindings as r, summarizeAccount as s, writeSessionBinding as w };
@@ -0,0 +1,289 @@
1
+ 'use strict';
2
+
3
+ var node_fs = require('node:fs');
4
+ var os = require('node:os');
5
+ var path = require('node:path');
6
+
7
+ function providersPath(happyHomeDir) {
8
+ return path.join(happyHomeDir, "providers.json");
9
+ }
10
+ function sessionProvidersPath(happyHomeDir) {
11
+ return path.join(happyHomeDir, "session-providers.json");
12
+ }
13
+ function parseProvidersFile(raw) {
14
+ const profiles = {};
15
+ const src = raw && typeof raw === "object" ? raw.profiles : void 0;
16
+ if (src && typeof src === "object") {
17
+ for (const [id, p] of Object.entries(src)) {
18
+ if (!p || typeof p !== "object") continue;
19
+ const { name, baseUrl, apiKeyFile, models } = p;
20
+ if (typeof baseUrl !== "string" || !/^https?:\/\//.test(baseUrl) || typeof apiKeyFile !== "string" || !apiKeyFile) continue;
21
+ const ids = [];
22
+ const contextWindows = {};
23
+ for (const m of Array.isArray(models) ? models : []) {
24
+ if (typeof m === "string") ids.push(m);
25
+ else if (m && typeof m === "object" && typeof m.id === "string") {
26
+ const { id: modelId, contextWindow } = m;
27
+ ids.push(modelId);
28
+ if (typeof contextWindow === "number" && Number.isInteger(contextWindow) && contextWindow > 0) contextWindows[modelId] = contextWindow;
29
+ }
30
+ }
31
+ profiles[id] = {
32
+ ...typeof name === "string" ? { name } : {},
33
+ baseUrl: baseUrl.replace(/\/+$/, ""),
34
+ apiKeyFile,
35
+ ...Array.isArray(models) ? { models: ids } : {},
36
+ ...Object.keys(contextWindows).length > 0 ? { contextWindows } : {}
37
+ };
38
+ }
39
+ }
40
+ return { profiles };
41
+ }
42
+ function parseSessionProvidersFile(raw) {
43
+ const out = {};
44
+ if (!raw || typeof raw !== "object") return out;
45
+ for (const [sessionId, b] of Object.entries(raw)) {
46
+ if (!b || typeof b !== "object") continue;
47
+ const { profile, model } = b;
48
+ if (typeof profile === "string" && profile && typeof model === "string" && model) out[sessionId] = { profile, model };
49
+ }
50
+ return out;
51
+ }
52
+
53
+ const SPAWN_ACCOUNT_ENV = "VH_AGENT_PROFILE_ID";
54
+ const SUBSCRIPTION_TOKEN_TTL_MS = 365 * 24 * 60 * 60 * 1e3;
55
+ const ACCOUNT_ID_PATTERN = /^[a-z0-9][a-z0-9-]{0,47}$/;
56
+ function accountsPath(home) {
57
+ return path.join(home, "accounts.json");
58
+ }
59
+ function accountSecretPath(home, id) {
60
+ if (!ACCOUNT_ID_PATTERN.test(id)) throw new Error(`invalid account id "${id}"`);
61
+ return path.join(home, "accounts", id, "secret");
62
+ }
63
+ function sessionAccountsPath(home) {
64
+ return path.join(home, "session-accounts.json");
65
+ }
66
+ function expandHome(path$1, home = os.homedir()) {
67
+ return path$1 === "~" ? home : path$1.startsWith("~/") ? path.join(home, path$1.slice(2)) : path$1;
68
+ }
69
+ function readJson(path) {
70
+ if (!node_fs.existsSync(path)) return void 0;
71
+ try {
72
+ return JSON.parse(node_fs.readFileSync(path, "utf8"));
73
+ } catch {
74
+ return void 0;
75
+ }
76
+ }
77
+ function writeJson0600(path$1, value) {
78
+ node_fs.mkdirSync(path.dirname(path$1), { recursive: true });
79
+ const tmp = `${path$1}.${process.pid}.${Date.now()}.tmp`;
80
+ node_fs.writeFileSync(tmp, JSON.stringify(value, null, 2) + "\n", { mode: 384 });
81
+ node_fs.chmodSync(tmp, 384);
82
+ node_fs.renameSync(tmp, path$1);
83
+ }
84
+ function parseKey(raw) {
85
+ if (!raw || typeof raw !== "object") return void 0;
86
+ const k = raw;
87
+ if (k.source === "file" && typeof k.path === "string" && k.path) return { source: "file", path: k.path };
88
+ if (k.source === "env" && typeof k.name === "string" && /^[A-Za-z_][A-Za-z0-9_]*$/.test(k.name)) return { source: "env", name: k.name };
89
+ if (k.source === "stored") return { source: "stored" };
90
+ return void 0;
91
+ }
92
+ function parseAccountsFile(raw) {
93
+ const out = { version: 2, accounts: {}, defaults: {} };
94
+ if (!raw || typeof raw !== "object") return out;
95
+ const src = raw.accounts;
96
+ if (src && typeof src === "object") {
97
+ for (const [id, value] of Object.entries(src)) {
98
+ if (!ACCOUNT_ID_PATTERN.test(id) || !value || typeof value !== "object") continue;
99
+ const a = value;
100
+ if (a.agent !== "claude" || a.kind !== "claude-subscription" && a.kind !== "claude-api") continue;
101
+ const label = typeof a.label === "string" && a.label.trim() ? a.label.trim() : id;
102
+ const rec = { label, agent: "claude", kind: a.kind, createdAt: typeof a.createdAt === "number" ? a.createdAt : 0 };
103
+ if (a.kind === "claude-api") {
104
+ if (typeof a.baseUrl !== "string" || !/^https?:\/\//.test(a.baseUrl)) continue;
105
+ const key = parseKey(a.key);
106
+ if (!key) continue;
107
+ rec.baseUrl = a.baseUrl.replace(/\/+$/, "");
108
+ rec.key = key;
109
+ if (Array.isArray(a.models)) rec.models = a.models.filter((m) => typeof m === "string" && m.length > 0);
110
+ if (a.contextWindows && typeof a.contextWindows === "object") {
111
+ const cw = {};
112
+ for (const [m, n] of Object.entries(a.contextWindows)) {
113
+ if (typeof n === "number" && Number.isInteger(n) && n > 0) cw[m] = n;
114
+ }
115
+ if (Object.keys(cw).length > 0) rec.contextWindows = cw;
116
+ }
117
+ }
118
+ if (typeof a.expiresAt === "number") rec.expiresAt = a.expiresAt;
119
+ if (a.check && typeof a.check === "object") {
120
+ const c = a.check;
121
+ if (typeof c.status === "string" && typeof c.at === "number") {
122
+ rec.check = { status: c.status, at: c.at, ...typeof c.detail === "string" ? { detail: c.detail } : {} };
123
+ }
124
+ }
125
+ out.accounts[id] = rec;
126
+ }
127
+ }
128
+ const defaults = raw.defaults;
129
+ if (defaults && typeof defaults === "object") {
130
+ for (const [agent, id] of Object.entries(defaults)) {
131
+ if (typeof id === "string" && id) out.defaults[agent] = id;
132
+ }
133
+ }
134
+ return out;
135
+ }
136
+ function legacyAccountsFromProviders(raw) {
137
+ const out = {};
138
+ for (const [id, p] of Object.entries(parseProvidersFile(raw).profiles)) {
139
+ if (!ACCOUNT_ID_PATTERN.test(id)) continue;
140
+ out[id] = {
141
+ label: p.name ?? id,
142
+ agent: "claude",
143
+ kind: "claude-api",
144
+ createdAt: 0,
145
+ baseUrl: p.baseUrl,
146
+ key: { source: "file", path: p.apiKeyFile },
147
+ ...p.models ? { models: p.models } : {},
148
+ ...p.contextWindows ? { contextWindows: p.contextWindows } : {},
149
+ legacy: true
150
+ };
151
+ }
152
+ return out;
153
+ }
154
+ function mergeAccounts(v2, legacy) {
155
+ return { ...v2, accounts: { ...legacy, ...v2.accounts } };
156
+ }
157
+ function readAccountsFileV2(home) {
158
+ return parseAccountsFile(readJson(accountsPath(home)));
159
+ }
160
+ function readAccounts(home) {
161
+ return mergeAccounts(readAccountsFileV2(home), legacyAccountsFromProviders(readJson(providersPath(home))));
162
+ }
163
+ function writeAccountsFile(home, file) {
164
+ const accounts = {};
165
+ for (const [id, a] of Object.entries(file.accounts)) if (!a.legacy) accounts[id] = a;
166
+ writeJson0600(accountsPath(home), { version: 2, accounts, defaults: file.defaults });
167
+ }
168
+ function mergeSessionBindings(v2Raw, v1Raw) {
169
+ const out = {};
170
+ for (const [sessionId, b] of Object.entries(parseSessionProvidersFile(v1Raw))) out[sessionId] = { account: b.profile, model: b.model };
171
+ if (v2Raw && typeof v2Raw === "object") {
172
+ for (const [sessionId, b] of Object.entries(v2Raw)) {
173
+ if (!b || typeof b !== "object") continue;
174
+ const { account, model } = b;
175
+ if (account !== null && (typeof account !== "string" || !account)) continue;
176
+ out[sessionId] = { account, ...typeof model === "string" && model ? { model } : {} };
177
+ }
178
+ }
179
+ return out;
180
+ }
181
+ function readSessionBindings(home) {
182
+ return mergeSessionBindings(readJson(sessionAccountsPath(home)), readJson(sessionProvidersPath(home)));
183
+ }
184
+ function readSessionBindingV2(home, sessionId) {
185
+ const raw = readJson(sessionAccountsPath(home));
186
+ const entry = raw && typeof raw === "object" ? raw[sessionId] : void 0;
187
+ return entry && typeof entry === "object" ? entry : void 0;
188
+ }
189
+ function writeSessionBinding(home, sessionId, binding) {
190
+ const raw = readJson(sessionAccountsPath(home));
191
+ const current = raw && typeof raw === "object" ? { ...raw } : {};
192
+ if (binding === void 0) delete current[sessionId];
193
+ else current[sessionId] = binding;
194
+ writeJson0600(sessionAccountsPath(home), current);
195
+ }
196
+ function sessionsBoundTo(bindings, accountId) {
197
+ return Object.entries(bindings).filter(([, b]) => b.account === accountId).map(([id]) => id);
198
+ }
199
+ function writeAccountSecret(home, id, secret) {
200
+ const path$1 = accountSecretPath(home, id);
201
+ node_fs.mkdirSync(path.dirname(path$1), { recursive: true, mode: 448 });
202
+ node_fs.chmodSync(path.dirname(path$1), 448);
203
+ const tmp = `${path$1}.${process.pid}.tmp`;
204
+ node_fs.writeFileSync(tmp, secret.trim() + "\n", { mode: 384 });
205
+ node_fs.chmodSync(tmp, 384);
206
+ node_fs.renameSync(tmp, path$1);
207
+ }
208
+ function removeAccountSecret(home, id) {
209
+ node_fs.rmSync(path.dirname(accountSecretPath(home, id)), { recursive: true, force: true });
210
+ }
211
+ function newAccountId(label, kind, taken) {
212
+ const used = new Set(taken);
213
+ const ascii = /^[\x20-\x7e]*$/.test(label);
214
+ const slug = ascii ? label.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40) : "";
215
+ const base = slug && /^[a-z0-9]/.test(slug) ? slug : kind === "claude-subscription" ? "claude-sub" : "claude-api";
216
+ if (!used.has(base)) return base;
217
+ for (let n = 2; ; n++) if (!used.has(`${base}-${n}`)) return `${base}-${n}`;
218
+ }
219
+ function secretPresent(home, id, a, probe) {
220
+ if (a.kind === "claude-subscription" || a.key?.source === "stored") return probe.fileReadable(accountSecretPath(home, id));
221
+ if (a.key?.source === "file") return probe.fileReadable(expandHome(a.key.path));
222
+ if (a.key?.source === "env") return !!probe.env[a.key.name]?.trim();
223
+ return false;
224
+ }
225
+ function accountStatus(home, id, a, probe, now) {
226
+ if (!secretPresent(home, id, a, probe)) return { status: "missing-secret" };
227
+ if (a.expiresAt !== void 0 && a.expiresAt <= now) return { status: "expired" };
228
+ if (a.check) return { status: a.check.status, ...a.check.detail ? { detail: a.check.detail } : {} };
229
+ return { status: "unverified" };
230
+ }
231
+ function summarizeAccount(home, id, a, probe, now) {
232
+ const { status, detail } = accountStatus(home, id, a, probe, now);
233
+ const keySource = a.kind === "claude-subscription" ? "stored" : a.key?.source;
234
+ const keyRef = a.key?.source === "file" ? a.key.path : a.key?.source === "env" ? a.key.name : void 0;
235
+ return {
236
+ id,
237
+ label: a.label,
238
+ agent: a.agent,
239
+ kind: a.kind,
240
+ status,
241
+ ...detail ? { statusDetail: detail } : {},
242
+ ...a.check ? { checkedAt: a.check.at } : {},
243
+ ...a.createdAt ? { createdAt: a.createdAt } : {},
244
+ ...a.expiresAt !== void 0 ? { expiresAt: a.expiresAt } : {},
245
+ ...a.baseUrl ? { baseUrl: a.baseUrl } : {},
246
+ ...a.models ? { models: a.models } : {},
247
+ ...keySource ? { keySource } : {},
248
+ ...keyRef ? { keyRef } : {},
249
+ ...a.legacy ? { legacy: true } : {}
250
+ };
251
+ }
252
+ function defaultSecretProbe(env = process.env) {
253
+ return {
254
+ fileReadable: (path) => {
255
+ try {
256
+ return node_fs.readFileSync(path, "utf8").trim().length > 0;
257
+ } catch {
258
+ return false;
259
+ }
260
+ },
261
+ env
262
+ };
263
+ }
264
+ function buildAgentProfilesState(home, file, probe, now, daemonPid) {
265
+ const accounts = Object.entries(file.accounts).map(([id, a]) => summarizeAccount(home, id, a, probe, now)).sort((x, y) => (x.createdAt ?? 0) - (y.createdAt ?? 0) || x.id.localeCompare(y.id));
266
+ const defaults = {};
267
+ for (const [agent, id] of Object.entries(file.defaults)) if (file.accounts[id]) defaults[agent] = id;
268
+ return { daemonPid, updatedAt: now, accounts, defaults };
269
+ }
270
+
271
+ exports.SPAWN_ACCOUNT_ENV = SPAWN_ACCOUNT_ENV;
272
+ exports.SUBSCRIPTION_TOKEN_TTL_MS = SUBSCRIPTION_TOKEN_TTL_MS;
273
+ exports.accountSecretPath = accountSecretPath;
274
+ exports.accountsPath = accountsPath;
275
+ exports.buildAgentProfilesState = buildAgentProfilesState;
276
+ exports.defaultSecretProbe = defaultSecretProbe;
277
+ exports.expandHome = expandHome;
278
+ exports.newAccountId = newAccountId;
279
+ exports.providersPath = providersPath;
280
+ exports.readAccounts = readAccounts;
281
+ exports.readAccountsFileV2 = readAccountsFileV2;
282
+ exports.readSessionBindingV2 = readSessionBindingV2;
283
+ exports.readSessionBindings = readSessionBindings;
284
+ exports.removeAccountSecret = removeAccountSecret;
285
+ exports.sessionsBoundTo = sessionsBoundTo;
286
+ exports.summarizeAccount = summarizeAccount;
287
+ exports.writeAccountSecret = writeAccountSecret;
288
+ exports.writeAccountsFile = writeAccountsFile;
289
+ exports.writeSessionBinding = writeSessionBinding;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-BOe6dKnL.cjs');
3
+ var index = require('./index-BzAYnYct.cjs');
4
4
 
5
5
  const STREAM_FLUSH_MS = 80;
6
6
  const PROGRESS_FLUSH_MS = 250;
@@ -1,4 +1,4 @@
1
- import { S as STREAM_DELTA_MAX_CHARS } from './index-DmqsRnV7.mjs';
1
+ import { S as STREAM_DELTA_MAX_CHARS } from './index-DYD3GM1m.mjs';
2
2
 
3
3
  const STREAM_FLUSH_MS = 80;
4
4
  const PROGRESS_FLUSH_MS = 250;
@@ -1,4 +1,4 @@
1
- import { b as backoff } from './time-CN3TuSVG.mjs';
1
+ import { b as backoff } from './time-bzmet4s5.mjs';
2
2
 
3
3
  class InvalidateSync {
4
4
  _invalidated = false;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var time = require('./time-gPD_EmA-.cjs');
3
+ var time = require('./time-CaUlWSNJ.cjs');
4
4
 
5
5
  class InvalidateSync {
6
6
  _invalidated = false;
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var logger = require('./logger-BBRTTVsQ.cjs');
3
+ var logger = require('./logger-8su64lqR.cjs');
4
4
  var node_fs = require('node:fs');
5
5
  var path$1 = require('node:path');
6
6
  var path = require('./path-B7zW-WwE.cjs');
7
- var index = require('./index-BOe6dKnL.cjs');
7
+ var index = require('./index-BzAYnYct.cjs');
8
8
  var trimIdent = require('./trimIdent-4gvk9Wk6.cjs');
9
9
  var os = require('node:os');
10
10
  var agentGuidance = require('./agentGuidance-BtBx2xxE.cjs');
@@ -1,8 +1,8 @@
1
- import { l as logger } from './logger-CL7pin9b.mjs';
1
+ import { l as logger } from './logger-Fd_rNvgd.mjs';
2
2
  import { existsSync, readFileSync } from 'node:fs';
3
3
  import { join } from 'node:path';
4
4
  import { g as getProjectPath } from './path-D2wdaNSk.mjs';
5
- import { j as BUILTIN_TODO_DISCOVERY } from './index-DmqsRnV7.mjs';
5
+ import { y as BUILTIN_TODO_DISCOVERY } from './index-DYD3GM1m.mjs';
6
6
  import { t as trimIdent } from './trimIdent-BAjmv_TG.mjs';
7
7
  import { homedir } from 'node:os';
8
8
  import { A as AGENT_GUIDANCE } from './agentGuidance-BDYt2Qy2.mjs';