very-happy-cli 0.2.191 → 0.2.193

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-CCy_9AfR.mjs → AcpBackend-B4PwjqHt.mjs} +3 -3
  2. package/dist/{AcpBackend-DgrIc1vH.cjs → AcpBackend-DtJCgftG.cjs} +3 -3
  3. package/dist/{AcpSessionManager-CQnxx7gD.mjs → AcpSessionManager-BzKWgkdP.mjs} +2 -2
  4. package/dist/{AcpSessionManager-DVOzCD3P.cjs → AcpSessionManager-D4qshX_H.cjs} +2 -2
  5. package/dist/{BasePermissionHandler-C9Ag7yvs.cjs → BasePermissionHandler-5iG-cvA2.cjs} +1 -1
  6. package/dist/{BasePermissionHandler-DYLN6Ec9.mjs → BasePermissionHandler-DV6UM6e9.mjs} +1 -1
  7. package/dist/account-Dco_nGT4.mjs +297 -0
  8. package/dist/account-DvpA60oU.cjs +302 -0
  9. package/dist/accountService-Cd7bnkfd.mjs +916 -0
  10. package/dist/accountService-CuUSJDhP.cjs +921 -0
  11. package/dist/{acpSessionResume-TvP_4Zq2.cjs → acpSessionResume-Bk9mjXZ9.cjs} +1 -1
  12. package/dist/{acpSessionResume-Bi7pA1n_.mjs → acpSessionResume-TQwN9ZZE.mjs} +1 -1
  13. package/dist/{agentHome-DGv105SR.mjs → agentHome-Bep8semY.mjs} +4 -4
  14. package/dist/{agentHome-DNUKJWOY.cjs → agentHome-c2dlgcw1.cjs} +4 -4
  15. package/dist/{api-BBxZ7y2z.cjs → api-CBE_a88I.cjs} +10 -10
  16. package/dist/{api-jfeMRg5R.mjs → api-DUfunY3x.mjs} +10 -10
  17. package/dist/{apiMachine-DqyjKBZG.cjs → apiMachine-BqtG0IWm.cjs} +83 -27
  18. package/dist/{apiMachine-DRJ7y-BB.mjs → apiMachine-CU_bw5nV.mjs} +78 -22
  19. package/dist/{attachmentContent-BO2njyza.cjs → attachmentContent-B3AzuYqk.cjs} +2 -2
  20. package/dist/{attachmentContent-Dm_RIs5L.mjs → attachmentContent-KNIZxwlu.mjs} +2 -2
  21. package/dist/{auth-BYDtjVNb.mjs → auth-CZ7pKS-j.mjs} +8 -8
  22. package/dist/{auth-DnxoVkkf.cjs → auth-DCjxpI6Z.cjs} +5 -5
  23. package/dist/{auth-DLR3ksCF.cjs → auth-SJ_dPw7H.cjs} +8 -8
  24. package/dist/{auth-DC6rg8lJ.mjs → auth-jN5dNqTO.mjs} +5 -5
  25. package/dist/{auto-CwO0u8hB.cjs → auto-B_59RYH1.cjs} +23 -21
  26. package/dist/{auto-D5Jhukq1.mjs → auto-DC0Sq-qB.mjs} +23 -21
  27. package/dist/{bootstrap-rLaL3kTa.mjs → bootstrap-B3gMpU9e.mjs} +2 -2
  28. package/dist/{bootstrap-sly4qPPY.cjs → bootstrap-CoJu9VnB.cjs} +2 -2
  29. package/dist/{browser-CHpVgyni.mjs → browser-LHW2hBH8.mjs} +1 -1
  30. package/dist/{browser-BTgZ9d4i.cjs → browser-v1pdPP1E.cjs} +1 -1
  31. package/dist/claudeAccountEnv-BL1pR_37.mjs +133 -0
  32. package/dist/claudeAccountEnv-CEX_EMZr.cjs +138 -0
  33. package/dist/{claudeLocal-Bgb5GGsq.mjs → claudeLocal-BZUgA5G2.mjs} +5 -5
  34. package/dist/{claudeLocal-1vuTFcL8.cjs → claudeLocal-BrzM2RBI.cjs} +5 -5
  35. package/dist/{claudeLocalLauncher-T7EfT68h.mjs → claudeLocalLauncher-A0AQyHFi.mjs} +10 -10
  36. package/dist/{claudeLocalLauncher-DOsL6HFY.cjs → claudeLocalLauncher-XAMpXUM7.cjs} +10 -10
  37. package/dist/{claudeSessionFork-Cko4SaVi.cjs → claudeSessionFork-Mhn2fYe_.cjs} +1 -1
  38. package/dist/{claudeSessionFork-CPvi6yDX.mjs → claudeSessionFork-_GwIlmMB.mjs} +1 -1
  39. package/dist/{client-BXD66ZF5.mjs → client-7RnI9J0W.mjs} +2 -2
  40. package/dist/{client-Bi20Ka0h.mjs → client-Bde4QVIn.mjs} +4 -2
  41. package/dist/{client-C5-C0t2a.cjs → client-CJr8Pjwm.cjs} +4 -2
  42. package/dist/{client-BscskEBk.cjs → client-D2GWkd-T.cjs} +2 -2
  43. package/dist/{client-C-OdTbrU.cjs → client-DLlnmAPL.cjs} +4 -4
  44. package/dist/{client-Bh1aUPh-.mjs → client-DwbhrX6D.mjs} +4 -4
  45. package/dist/codex/happyMcpStdioBridge.cjs +16 -16
  46. package/dist/codex/happyMcpStdioBridge.mjs +16 -16
  47. package/dist/codexAccount-BDQjRbtI.cjs +1028 -0
  48. package/dist/codexAccount-NOX5pmQf.mjs +1015 -0
  49. package/dist/{codexAppServerClient-DXhAf6i-.mjs → codexAppServerClient-B3QJV6Ey.mjs} +18 -7
  50. package/dist/{codexAppServerClient-DKXeikEe.cjs → codexAppServerClient-DWEsZUC4.cjs} +18 -7
  51. package/dist/{codexCommand-DvbbpYBS.cjs → codexCommand-Bg8AmxVm.cjs} +195 -63
  52. package/dist/{codexCommand-CIaOiiOj.mjs → codexCommand-D1xlj4sT.mjs} +196 -64
  53. package/dist/{codexTermination-BszWfyk5.cjs → codexTermination-ByX9GcEJ.cjs} +1 -1
  54. package/dist/{codexTermination-BcQdEDaw.mjs → codexTermination-CaWAVQjZ.mjs} +1 -1
  55. package/dist/{config-Di3Cf6js.cjs → config-B2GGbiTv.cjs} +3 -3
  56. package/dist/{config-OCEcVVK1.mjs → config-C2XYEwXz.mjs} +3 -3
  57. package/dist/{configuration-DfPBa-9d.cjs → configuration-BBK0rmmj.cjs} +1 -1
  58. package/dist/{configuration-ECqXu34R.mjs → configuration-ThKBP_zY.mjs} +1 -1
  59. package/dist/{connect-BTfAUhk8.mjs → connect-BirnCl9q.mjs} +13 -13
  60. package/dist/{connect-BPQRuOw5.cjs → connect-C3tZs_NC.cjs} +13 -13
  61. package/dist/{context-CfgTFpCB.mjs → context-C0EFLnOg.mjs} +1 -1
  62. package/dist/{context-Co7hUaW-.cjs → context-wDp0aZBK.cjs} +1 -1
  63. package/dist/{controlClient-ClI7A0qE.mjs → controlClient-Ckl8N1MS.mjs} +14 -5
  64. package/dist/{controlClient-C13_pSKG.cjs → controlClient-DwWTns3A.cjs} +15 -4
  65. package/dist/{createSessionMetadata-Cf78KHtt.cjs → createSessionMetadata-DqZ6h02H.cjs} +2 -2
  66. package/dist/{createSessionMetadata-B0eT_Kfj.mjs → createSessionMetadata-vug4Cv8z.mjs} +2 -2
  67. package/dist/daemonAccounts-CpGDY_4k.cjs +54 -0
  68. package/dist/daemonAccounts-DwPwKxvv.mjs +30 -0
  69. package/dist/{defaultPermissionMode-oqTupStc.cjs → defaultPermissionMode-BakXiqRr.cjs} +1 -1
  70. package/dist/{defaultPermissionMode-m6z2QVyP.mjs → defaultPermissionMode-DF5AfeBb.mjs} +1 -1
  71. package/dist/{deterministicJson-BtSwbsok.mjs → deterministicJson-BzX94gi3.mjs} +13 -13
  72. package/dist/{deterministicJson-CpFFgUL_.cjs → deterministicJson-t33SsuRC.cjs} +13 -13
  73. package/dist/{doctor-BEU0_1Xv.cjs → doctor-B9ug1LZb.cjs} +7 -7
  74. package/dist/{doctor-lsxmAK4o.mjs → doctor-C1zyOSXw.mjs} +7 -7
  75. package/dist/{downloadTarget-BXqXhNF7.mjs → downloadTarget-Baslc6jW.mjs} +6 -6
  76. package/dist/{downloadTarget-CikzJv1h.cjs → downloadTarget-T1id2Gh6.cjs} +6 -6
  77. package/dist/{ensureDaemonRunning-B_9WAlbU.mjs → ensureDaemonRunning-C6ERYK-O.mjs} +5 -5
  78. package/dist/{ensureDaemonRunning-BUuH-pbE.cjs → ensureDaemonRunning-CoAg11Zi.cjs} +5 -5
  79. package/dist/{handleResumeCommand-BK9XKH_l.mjs → handleResumeCommand-CrlqDuz7.mjs} +5 -5
  80. package/dist/{handleResumeCommand-Dj7oi2KO.cjs → handleResumeCommand-DPi-sPm7.cjs} +5 -5
  81. package/dist/{index-D3c7CLot.cjs → index-B1swQJUS.cjs} +4 -4
  82. package/dist/{index-CmZusg8Q.cjs → index-B2dJA8VG.cjs} +3 -3
  83. package/dist/{index-CLUHaPU8.cjs → index-BUFrKZeQ.cjs} +205 -5
  84. package/dist/{index-BjZnpGWX.mjs → index-BbdV2mzy.mjs} +3 -3
  85. package/dist/{index-BdOJOZ6J.mjs → index-BcSPg3c5.mjs} +4 -4
  86. package/dist/{index-CauRYQKr.cjs → index-Bkslzin5.cjs} +44 -40
  87. package/dist/{index-DuK9XYbZ.mjs → index-Cn73rdtQ.mjs} +4 -4
  88. package/dist/{index-Bq8NKSCF.mjs → index-D1YnIih6.mjs} +195 -6
  89. package/dist/{index-Cxso1rg4.mjs → index-fZO4nF6e.mjs} +45 -41
  90. package/dist/{index-Dg2NAF_-.cjs → index-rocrvOYG.cjs} +4 -4
  91. package/dist/index.cjs +2 -2
  92. package/dist/index.mjs +2 -2
  93. package/dist/{install-DXllkuy0.cjs → install-CArXjPfW.cjs} +3 -3
  94. package/dist/{install-DTIveLOS.mjs → install-CChhyV2G.mjs} +3 -3
  95. package/dist/lib.cjs +12 -12
  96. package/dist/lib.d.cts +354 -0
  97. package/dist/lib.d.mts +354 -0
  98. package/dist/lib.mjs +12 -12
  99. package/dist/{lidState-CD81ryTy.mjs → lidState-B6yYKjNK.mjs} +1 -1
  100. package/dist/{lidState-C9_DoF9i.cjs → lidState-B_v6qgfE.cjs} +1 -1
  101. package/dist/{localHappyAgentAuth-Cg-m1lwm.mjs → localHappyAgentAuth-KRlg_aI0.mjs} +1 -1
  102. package/dist/{localHappyAgentAuth-CCjUvOfi.cjs → localHappyAgentAuth-jJH0n67S.cjs} +1 -1
  103. package/dist/{logger-Ct2zvaq0.cjs → logger-CX3x2eI4.cjs} +2 -2
  104. package/dist/{logger-GcbI0eg2.mjs → logger-JV7-4Q_6.mjs} +2 -2
  105. package/dist/{machineMetadata-CXRmFNOV.mjs → machineMetadata-D5-SW9kv.mjs} +3 -3
  106. package/dist/{machineMetadata-DDCVWb_x.cjs → machineMetadata-DhZuM0iB.cjs} +3 -3
  107. package/dist/{main-BHC-WIcM.cjs → main-1x1HGQEy.cjs} +92 -48
  108. package/dist/{main-omGr_ONk.mjs → main-CFOdXbPD.mjs} +92 -48
  109. package/dist/{mcp-xUzii0m8.cjs → mcp-BnKBSEh7.cjs} +18 -15
  110. package/dist/{mcp-D5hxmRAq.mjs → mcp-R6lMcFLO.mjs} +18 -15
  111. package/dist/{mirrorProtocol-Lcx20Oby.mjs → mirrorProtocol-CD4ntuZJ.mjs} +3 -3
  112. package/dist/{mirrorProtocol-Dfl8Ahyf.cjs → mirrorProtocol-DO-KtvAL.cjs} +3 -3
  113. package/dist/{package-BsUHyqWe.mjs → package-Bw3H6VLn.mjs} +7 -7
  114. package/dist/{package-9n7wd2dT.cjs → package-uzlvxa5S.cjs} +7 -7
  115. package/dist/{panels-CpEKWWbI.mjs → panels-BamhZCoZ.mjs} +5 -5
  116. package/dist/{panels-BfknEmt7.cjs → panels-C46FxjmH.cjs} +5 -5
  117. package/dist/{peerTools-CElYh-5u.cjs → peerTools-D-VNNFw-.cjs} +5 -5
  118. package/dist/{peerTools-CwCe6tmJ.mjs → peerTools-WtRgTSqG.mjs} +5 -5
  119. package/dist/{persistence-Cpw4yJs8.mjs → persistence-Cg4sfjQV.mjs} +2 -2
  120. package/dist/{persistence-A2NeERZJ.cjs → persistence-CsmAgN-C.cjs} +2 -2
  121. package/dist/{piRunnerArgs-Bqmu16He.mjs → piRunnerArgs-BbaAQvb4.mjs} +2 -2
  122. package/dist/{piRunnerArgs-BnFU0K73.cjs → piRunnerArgs-vnFygygF.cjs} +1 -1
  123. package/dist/{piRuntime-Cgn1b0OX.mjs → piRuntime-Bid7TBf5.mjs} +1 -1
  124. package/dist/{piRuntime-DpS9TAIs.cjs → piRuntime-C2uj5Ucx.cjs} +1 -1
  125. package/dist/{piTerminal-rmve-VlI.cjs → piTerminal-Ckpjfoqa.cjs} +20 -17
  126. package/dist/{piTerminal-BGdps8f3.mjs → piTerminal-CqxgrI13.mjs} +20 -17
  127. package/dist/{pushNotifications-23YSd-0l.cjs → pushNotifications-BCg7YAiu.cjs} +5 -3
  128. package/dist/{pushNotifications-XAM8__Pg.mjs → pushNotifications-BbE-qV9I.mjs} +5 -3
  129. package/dist/{query-SZcYnJoW.mjs → query-Bfr9O_62.mjs} +1 -1
  130. package/dist/{query-u2GX-I0C.cjs → query-vQ-HG394.cjs} +1 -1
  131. package/dist/{rateLimitReporter-CaTzBe3x.cjs → rateLimitReporter-BZ8x0-6-.cjs} +3 -3
  132. package/dist/{rateLimitReporter-COUkf446.mjs → rateLimitReporter-CAz7VMw4.mjs} +3 -3
  133. package/dist/{rateLimitWindows-B2Kx6L0S.cjs → rateLimitWindows-BZl6GMwQ.cjs} +1 -1
  134. package/dist/{rateLimitWindows-j_qQk0KY.mjs → rateLimitWindows-CRARnKaI.mjs} +1 -1
  135. package/dist/reconnectEnv-B31lY4nR.cjs +27 -0
  136. package/dist/reconnectEnv-DeSvHl3q.mjs +24 -0
  137. package/dist/{registerCommonHandlers-D1MiSfcB.cjs → registerCommonHandlers-CZGmrPbT.cjs} +2 -2
  138. package/dist/{registerCommonHandlers-DRRfinzK.mjs → registerCommonHandlers-Cj3Nl9y-.mjs} +2 -2
  139. package/dist/{registerKillSessionHandler-Cpug_r5C.mjs → registerKillSessionHandler-Bg9t45Ub.mjs} +6 -6
  140. package/dist/{registerKillSessionHandler-hvCsEn7b.cjs → registerKillSessionHandler-C3EDnW4F.cjs} +6 -6
  141. package/dist/{remoteSessionClient-BdnJ_n8C.mjs → remoteSessionClient--0vfA7I5.mjs} +5 -5
  142. package/dist/{remoteSessionClient-6ymeMVa4.cjs → remoteSessionClient-CcSP24Zq.cjs} +5 -5
  143. package/dist/{reportProgressTool-XgQBzxoD.mjs → reportProgressTool-DVru7jc_.mjs} +3 -3
  144. package/dist/{reportProgressTool-tzQLCLIw.cjs → reportProgressTool-Ddg1yVq2.cjs} +3 -3
  145. package/dist/{run-DYL_wuj7.cjs → run-BTrIT_jU.cjs} +347 -856
  146. package/dist/{run-Bt0AklUU.mjs → run-HtvH6BLi.mjs} +346 -855
  147. package/dist/{runClaude-C3rii_S6.mjs → runClaude-DsHTk5Bu.mjs} +62 -44
  148. package/dist/{runClaude-CBEpYO4S.cjs → runClaude-ipjwAHPI.cjs} +62 -44
  149. package/dist/{runClaudeDeps-CYuozSC6.cjs → runClaudeDeps-BKpwL6ln.cjs} +51 -42
  150. package/dist/{runClaudeDeps-DlVfMG4F.mjs → runClaudeDeps-BV3vpeyY.mjs} +56 -47
  151. package/dist/{runGemini-CEI3b90u.cjs → runGemini-B-G0_7Ab.cjs} +33 -33
  152. package/dist/{runGemini-DkYhRk9S.mjs → runGemini-DhjK6_Fp.mjs} +33 -33
  153. package/dist/{runOpenClaw-DpprWCoz.mjs → runOpenClaw-B6lawk8n.mjs} +18 -18
  154. package/dist/{runOpenClaw-BgjD6E4d.cjs → runOpenClaw-BHIo8tkn.cjs} +18 -18
  155. package/dist/{sandbox-XCDUbH72.cjs → sandbox-BAsO0ILe.cjs} +4 -4
  156. package/dist/{sandbox-DJ7A7lsy.mjs → sandbox-CKb7pCXg.mjs} +4 -4
  157. package/dist/selfCheck-CZ-t1Xzq.mjs +88 -0
  158. package/dist/{selfCheck-BYUDB1Uq.cjs → selfCheck-D4VvVZNi.cjs} +39 -37
  159. package/dist/{send-CASDBCyJ.cjs → send-Cz5m39QR.cjs} +8 -8
  160. package/dist/{send-Ba63huxv.mjs → send-D8ipLKMY.mjs} +8 -8
  161. package/dist/{server-w3W0toNd.mjs → server-CjvgT3N9.mjs} +4 -4
  162. package/dist/{server-cZoV9XRt.cjs → server-CySyJKPH.cjs} +6 -6
  163. package/dist/{sessionLock-G2PMqvsh.mjs → sessionLock-B73fhgQN.mjs} +10 -4
  164. package/dist/{sessionLock-BmLA2S8K.cjs → sessionLock-DdDCuNUs.cjs} +10 -3
  165. package/dist/{sessionOps-DPw5k8vV.mjs → sessionOps-C65Iej_C.mjs} +50 -8
  166. package/dist/{sessionOps-DXlTmS7J.cjs → sessionOps-XSEjIqNq.cjs} +50 -8
  167. package/dist/sessionProvider-CLVNkfji.mjs +110 -0
  168. package/dist/sessionProvider-Dgsty8z_.cjs +115 -0
  169. package/dist/{sessionScanner-AHjnicxi.cjs → sessionScanner-D8IVXMMH.cjs} +3 -3
  170. package/dist/{sessionScanner-BCXpdZJN.mjs → sessionScanner-MW1P9Pm9.mjs} +3 -3
  171. package/dist/{sessions-BiBXOBx0.cjs → sessions-BKz7gZqg.cjs} +10 -10
  172. package/dist/{sessions-Clk8MR5Y.mjs → sessions-Dtk_agUL.mjs} +10 -10
  173. package/dist/{setupOfflineReconnection-DI-QZGYz.mjs → setupOfflineReconnection-Bvdy-2xd.mjs} +2 -2
  174. package/dist/{setupOfflineReconnection-BKLfOd-i.cjs → setupOfflineReconnection-DxMiW7OV.cjs} +2 -2
  175. package/dist/{spawn-D5omsx1Q.cjs → spawn-DiPkJcrQ.cjs} +36 -17
  176. package/dist/{spawn-4tsp1uhh.mjs → spawn-Dm4xsZBX.mjs} +36 -17
  177. package/dist/{spawnAgents-CtkkIFHd.cjs → spawnAgents-B9olJ8xn.cjs} +1 -1
  178. package/dist/{spawnAgents-CjoU6ZOS.mjs → spawnAgents-I29H9nO8.mjs} +1 -1
  179. package/dist/{spawnHappyCLI-CF_gLi92.cjs → spawnHappyCLI-BYGOUda1.cjs} +1 -1
  180. package/dist/{spawnHappyCLI-CIA9Sc_5.mjs → spawnHappyCLI-CnMwzjWX.mjs} +1 -1
  181. package/dist/{startFileWatcher-9Stpxe7p.cjs → startFileWatcher-D14W6gn-.cjs} +1 -1
  182. package/dist/{startFileWatcher-CDO6fb2m.mjs → startFileWatcher-DePAY1T5.mjs} +1 -1
  183. package/dist/{startupSessionCreate-BtR4iYEC.mjs → startupSessionCreate-DoK0IvJG.mjs} +3 -3
  184. package/dist/{startupSessionCreate-CcF7rGGB.cjs → startupSessionCreate-rBHd4tc1.cjs} +3 -3
  185. package/dist/store-CkNa6oj4.cjs +326 -0
  186. package/dist/store-Vej_738f.mjs +305 -0
  187. package/dist/{streamRelay-BhI6jqF-.cjs → streamRelay-C0G1HOOd.cjs} +1 -1
  188. package/dist/{streamRelay-DMwOMTKf.mjs → streamRelay-C5U-C4GS.mjs} +1 -1
  189. package/dist/{sync-C0PRuTMj.mjs → sync-BP6vnxVP.mjs} +1 -1
  190. package/dist/{sync-Ba8N6xba.cjs → sync-WYBwkJvG.cjs} +1 -1
  191. package/dist/{systemPrompt-DV5IReD4.cjs → systemPrompt-BkQlCk5_.cjs} +2 -2
  192. package/dist/{systemPrompt-D0q8eyjy.mjs → systemPrompt-aRqBmkpw.mjs} +2 -2
  193. package/dist/{teams-BO3_arwM.mjs → teams-CGmC4ygu.mjs} +7 -7
  194. package/dist/{teams-z3Gp-KlV.cjs → teams-phbpwAGD.cjs} +7 -7
  195. package/dist/{template-B_5l6pkc.cjs → template-B9pLEP8v.cjs} +2 -2
  196. package/dist/{template-DLR_0hfj.mjs → template-CL9EvQLQ.mjs} +2 -2
  197. package/dist/{time-Cy0a-7YX.cjs → time-BTLcO8jp.cjs} +1 -1
  198. package/dist/{time-D0jvDRhn.mjs → time-Cw0liIqB.mjs} +1 -1
  199. package/dist/{titleGenerator-RGHWP2YL.cjs → titleGenerator-Y1_7ceJC.cjs} +17 -13
  200. package/dist/{titleGenerator-AGQsXskb.mjs → titleGenerator-h6TmFe-c.mjs} +16 -12
  201. package/dist/{todo-CzIDPLFy.cjs → todo-BxiPiCvB.cjs} +6 -6
  202. package/dist/{todo-BZ954vsz.mjs → todo-OKcTC_VC.mjs} +6 -6
  203. package/dist/{tools-Bei5i03L.mjs → tools-BR-drXZ8.mjs} +3 -2
  204. package/dist/{tools-B1x1j6tz.cjs → tools-CcebYtLj.cjs} +3 -2
  205. package/dist/{uninstall-C3cnIvz1.cjs → uninstall-CnDeCC-M.cjs} +3 -3
  206. package/dist/{uninstall-B4T_e3Mr.mjs → uninstall-D3stWKD2.mjs} +3 -3
  207. package/dist/wrapperAccount-BkufO_9g.mjs +107 -0
  208. package/dist/wrapperAccount-D2A4DuZy.cjs +113 -0
  209. package/package.json +7 -7
  210. package/dist/providerBinding-B-Qbx9W2.cjs +0 -140
  211. package/dist/providerBinding-CYubGg-Z.mjs +0 -132
  212. package/dist/selfCheck-C-rNljKV.mjs +0 -86
  213. package/dist/sessionProvider-DUn91LhJ.mjs +0 -109
  214. package/dist/sessionProvider-Dg691XQ4.cjs +0 -114
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var configuration = require('./configuration-DfPBa-9d.cjs');
4
- var api = require('./api-BBxZ7y2z.cjs');
3
+ var configuration = require('./configuration-BBK0rmmj.cjs');
4
+ var api = require('./api-CBE_a88I.cjs');
5
5
 
6
6
  function createOfflineSessionStub(sessionTag) {
7
7
  return {
@@ -1,21 +1,21 @@
1
1
  'use strict';
2
2
 
3
- var spawnAgents = require('./spawnAgents-CtkkIFHd.cjs');
4
- var client = require('./client-C5-C0t2a.cjs');
3
+ var spawnAgents = require('./spawnAgents-B9olJ8xn.cjs');
4
+ var client = require('./client-CJr8Pjwm.cjs');
5
5
  var chalk = require('chalk');
6
6
  var node_fs = require('node:fs');
7
7
  var path$1 = require('node:path');
8
- var controlClient = require('./controlClient-C13_pSKG.cjs');
9
- var persistence = require('./persistence-A2NeERZJ.cjs');
10
- var index = require('./index-CLUHaPU8.cjs');
11
- var configuration = require('./configuration-DfPBa-9d.cjs');
8
+ var controlClient = require('./controlClient-DwWTns3A.cjs');
9
+ var persistence = require('./persistence-CsmAgN-C.cjs');
10
+ var index = require('./index-BUFrKZeQ.cjs');
11
+ var configuration = require('./configuration-BBK0rmmj.cjs');
12
12
  var path = require('./path-B7zW-WwE.cjs');
13
- var claudeSessionFork = require('./claudeSessionFork-Cko4SaVi.cjs');
14
- var codexAppServerClient = require('./codexAppServerClient-DKXeikEe.cjs');
13
+ var claudeSessionFork = require('./claudeSessionFork-Mhn2fYe_.cjs');
14
+ var codexAppServerClient = require('./codexAppServerClient-DWEsZUC4.cjs');
15
15
  var codexThreadFork = require('./codexThreadFork-5kwoKjMu.cjs');
16
- var sessionOps = require('./sessionOps-DXlTmS7J.cjs');
17
- var createSessionMetadata = require('./createSessionMetadata-Cf78KHtt.cjs');
18
- var logger = require('./logger-Ct2zvaq0.cjs');
16
+ var sessionOps = require('./sessionOps-XSEjIqNq.cjs');
17
+ var createSessionMetadata = require('./createSessionMetadata-DqZ6h02H.cjs');
18
+ var logger = require('./logger-CX3x2eI4.cjs');
19
19
  var forkBackfill = require('./forkBackfill-8eLDeS73.cjs');
20
20
  require('node:fs/promises');
21
21
  require('zod');
@@ -24,17 +24,17 @@ require('node:crypto');
24
24
  require('tweetnacl');
25
25
  require('@paralleldrive/cuid2');
26
26
  require('node:os');
27
- require('./package-9n7wd2dT.cjs');
27
+ require('./package-uzlvxa5S.cjs');
28
28
  require('node:readline');
29
29
  require('node:child_process');
30
30
  require('cross-spawn');
31
31
  require('./contentLogMetadata-ZSFk_NjQ.cjs');
32
32
  require('./manager-HrEj442o.cjs');
33
33
  require('@anthropic-ai/sandbox-runtime');
34
- require('./rateLimitWindows-B2Kx6L0S.cjs');
34
+ require('./rateLimitWindows-BZl6GMwQ.cjs');
35
35
  require('./processTree-CMHWlVse.cjs');
36
36
  require('axios');
37
- require('./time-Cy0a-7YX.cjs');
37
+ require('./time-BTLcO8jp.cjs');
38
38
  require('./specialCommands-J3JFOq0J.cjs');
39
39
  require('socket.io-client');
40
40
  require('./backgroundTaskActivity-CBvUdj39.cjs');
@@ -157,6 +157,10 @@ function parseSpawnArgs(args) {
157
157
  const value = args[++i];
158
158
  if (value === void 0 || value.trim().length === 0) throw new Error("--model requires a value");
159
159
  options.model = value;
160
+ } else if (arg === "--account") {
161
+ const value = args[++i];
162
+ if (value === void 0 || !/^[a-z0-9][a-z0-9-]{0,47}$/.test(value)) throw new Error('--account requires an account id (see `very-happy account list`) or "machine"');
163
+ options.account = value;
160
164
  } else if (arg === "--fork") {
161
165
  const value = args[++i];
162
166
  if (value === void 0) throw new Error("--fork requires a session id");
@@ -192,8 +196,8 @@ ${chalk.bold("very-happy spawn")} - Spawn a remote session via the local daemon
192
196
  ${chalk.bold("Usage:")}
193
197
  very-happy spawn --dir <path> [--prompt <text> | --prompt-file <file>]
194
198
  [--spawned-by <name>] [--permission-mode <mode>]
195
- [--agent <name>] [--model <id>] [--env KEY=VALUE]...
196
- [--project <id> | --no-project] [--json]
199
+ [--agent <name>] [--model <id>] [--account <id>]
200
+ [--env KEY=VALUE]... [--project <id> | --no-project] [--json]
197
201
  very-happy spawn --fork <sessionId> [--prompt \u2026] [--permission-mode <mode>]
198
202
  [--model <id>] [--spawned-by <name>] [--project <id>]
199
203
  [--json]
@@ -220,6 +224,10 @@ ${chalk.bold("Options:")}
220
224
  machine runs (claude: newest Opus; codex: newest
221
225
  sol its Codex lists; gemini: newest pro), else the
222
226
  machine default. 'default' = the machine default.
227
+ --account <id> Claude / Codex account on this machine (\`very-happy account
228
+ list\`); 'machine' = the machine's own login.
229
+ Default = the machine's default account, if set. A
230
+ missing or expired account fails the spawn.
223
231
  --fork <sessionId> Fork an existing session of THIS machine (same as the
224
232
  web's fork): copies its conversation and continues
225
233
  it in a new session, in the same directory and with
@@ -371,6 +379,16 @@ async function handleSpawnCommand(args) {
371
379
  process.exit(1);
372
380
  }
373
381
  }
382
+ let accountChoice = options.account ? options.account === "machine" ? null : options.account : void 0;
383
+ if (accountChoice === void 0 && options.project && !forkSource) {
384
+ try {
385
+ const defaults = await client.sharedProjectsClient().defaults(options.project);
386
+ const machineId = (await persistence.readSettings()).machineId;
387
+ if (machineId) accountChoice = index.resolveLaunchAgentProfile({ project: defaults.agentProfiles, agent: agent ?? "claude", machineId }).agentProfileId;
388
+ } catch (error) {
389
+ console.error(chalk.dim(`(project ${options.project}: defaults unavailable \u2014 using the machine default account: ${error instanceof Error ? error.message : String(error)})`));
390
+ }
391
+ }
374
392
  logger.logger.debug(`[SPAWN CMD] Spawning session in ${directory}${forkSource ? ` (fork of ${forkSource.parentSessionId})` : ""}`);
375
393
  const result = await controlClient.spawnDaemonSession(directory, void 0, {
376
394
  spawnedBy: options.spawnedBy,
@@ -382,7 +400,8 @@ async function handleSpawnCommand(args) {
382
400
  // through, an old wrapper ignores it).
383
401
  environmentVariables: spawnEnvironmentVariables(options.env, prompt !== void 0),
384
402
  ...resumeIds,
385
- ...forkSource ? { parentSessionId: forkSource.parentSessionId } : {}
403
+ ...forkSource ? { parentSessionId: forkSource.parentSessionId } : {},
404
+ ...accountChoice !== void 0 ? { agentProfileId: accountChoice } : {}
386
405
  });
387
406
  if (result?.error || !result?.success || !result?.sessionId) {
388
407
  const message = result?.error || "Daemon returned no session ID";
@@ -1,19 +1,19 @@
1
- import { r as resolveSpawnPermissionMode, c as chooseProject, j as joinProject, a as resolveFirstMessageMeta, w as waitsForModelCatalog, s as sanitizeSpawnPermissionMode, A as ALLOWED_SPAWN_PERMISSION_MODES, S as SPAWN_AGENTS } from './spawnAgents-CjoU6ZOS.mjs';
2
- import { s as sharedProjectsClient } from './client-Bi20Ka0h.mjs';
1
+ import { r as resolveSpawnPermissionMode, c as chooseProject, j as joinProject, a as resolveFirstMessageMeta, w as waitsForModelCatalog, s as sanitizeSpawnPermissionMode, A as ALLOWED_SPAWN_PERMISSION_MODES, S as SPAWN_AGENTS } from './spawnAgents-I29H9nO8.mjs';
2
+ import { s as sharedProjectsClient } from './client-Bde4QVIn.mjs';
3
3
  import chalk from 'chalk';
4
4
  import { readFileSync, statSync } from 'node:fs';
5
5
  import { resolve } from 'node:path';
6
- import { b as checkIfDaemonRunningAndCleanupStaleState, g as spawnDaemonSession, f as stopDaemonSession } from './controlClient-ClI7A0qE.mjs';
7
- import { c as readPersistedSessions } from './persistence-Cpw4yJs8.mjs';
8
- import { q as parseLatestModelTable } from './index-Bq8NKSCF.mjs';
9
- import { c as configuration } from './configuration-ECqXu34R.mjs';
6
+ import { b as checkIfDaemonRunningAndCleanupStaleState, f as spawnDaemonSession, h as stopDaemonSession } from './controlClient-Ckl8N1MS.mjs';
7
+ import { c as readPersistedSessions, r as readSettings } from './persistence-Cg4sfjQV.mjs';
8
+ import { u as parseLatestModelTable, v as resolveLaunchAgentProfile } from './index-D1YnIih6.mjs';
9
+ import { c as configuration } from './configuration-ThKBP_zY.mjs';
10
10
  import { g as getProjectPath } from './path-D2wdaNSk.mjs';
11
- import { f as forkSession, F as ForkSourceMissingError } from './claudeSessionFork-CPvi6yDX.mjs';
12
- import { C as CodexAppServerClient } from './codexAppServerClient-DXhAf6i-.mjs';
11
+ import { f as forkSession, F as ForkSourceMissingError } from './claudeSessionFork-_GwIlmMB.mjs';
12
+ import { C as CodexAppServerClient } from './codexAppServerClient-B3QJV6Ey.mjs';
13
13
  import { f as forkCodexThread } from './codexThreadFork-DobPd19R.mjs';
14
- import { e as sendUserMessage, f as readSessionMetadata, g as waitForSessionKey, s as sessionWebUrl } from './sessionOps-DPw5k8vV.mjs';
15
- import { i as isValidSpawnOrigin } from './createSessionMetadata-B0eT_Kfj.mjs';
16
- import { l as logger } from './logger-GcbI0eg2.mjs';
14
+ import { e as sendUserMessage, f as readSessionMetadata, g as waitForSessionKey, s as sessionWebUrl } from './sessionOps-C65Iej_C.mjs';
15
+ import { i as isValidSpawnOrigin } from './createSessionMetadata-vug4Cv8z.mjs';
16
+ import { l as logger } from './logger-JV7-4Q_6.mjs';
17
17
  import { w as waitForForkBackfill } from './forkBackfill-DYIjlN1Z.mjs';
18
18
  import 'node:fs/promises';
19
19
  import 'zod';
@@ -22,17 +22,17 @@ import 'node:crypto';
22
22
  import 'tweetnacl';
23
23
  import '@paralleldrive/cuid2';
24
24
  import 'node:os';
25
- import './package-BsUHyqWe.mjs';
25
+ import './package-Bw3H6VLn.mjs';
26
26
  import 'node:readline';
27
27
  import 'node:child_process';
28
28
  import 'cross-spawn';
29
29
  import './contentLogMetadata-BlWI0egu.mjs';
30
30
  import './manager-BEsI4qt3.mjs';
31
31
  import '@anthropic-ai/sandbox-runtime';
32
- import './rateLimitWindows-j_qQk0KY.mjs';
32
+ import './rateLimitWindows-CRARnKaI.mjs';
33
33
  import './processTree-CP5IvQ2Z.mjs';
34
34
  import 'axios';
35
- import './time-D0jvDRhn.mjs';
35
+ import './time-Cw0liIqB.mjs';
36
36
  import './specialCommands-MXUN0wfI.mjs';
37
37
  import 'socket.io-client';
38
38
  import './backgroundTaskActivity-8PdPxrvy.mjs';
@@ -155,6 +155,10 @@ function parseSpawnArgs(args) {
155
155
  const value = args[++i];
156
156
  if (value === void 0 || value.trim().length === 0) throw new Error("--model requires a value");
157
157
  options.model = value;
158
+ } else if (arg === "--account") {
159
+ const value = args[++i];
160
+ if (value === void 0 || !/^[a-z0-9][a-z0-9-]{0,47}$/.test(value)) throw new Error('--account requires an account id (see `very-happy account list`) or "machine"');
161
+ options.account = value;
158
162
  } else if (arg === "--fork") {
159
163
  const value = args[++i];
160
164
  if (value === void 0) throw new Error("--fork requires a session id");
@@ -190,8 +194,8 @@ ${chalk.bold("very-happy spawn")} - Spawn a remote session via the local daemon
190
194
  ${chalk.bold("Usage:")}
191
195
  very-happy spawn --dir <path> [--prompt <text> | --prompt-file <file>]
192
196
  [--spawned-by <name>] [--permission-mode <mode>]
193
- [--agent <name>] [--model <id>] [--env KEY=VALUE]...
194
- [--project <id> | --no-project] [--json]
197
+ [--agent <name>] [--model <id>] [--account <id>]
198
+ [--env KEY=VALUE]... [--project <id> | --no-project] [--json]
195
199
  very-happy spawn --fork <sessionId> [--prompt \u2026] [--permission-mode <mode>]
196
200
  [--model <id>] [--spawned-by <name>] [--project <id>]
197
201
  [--json]
@@ -218,6 +222,10 @@ ${chalk.bold("Options:")}
218
222
  machine runs (claude: newest Opus; codex: newest
219
223
  sol its Codex lists; gemini: newest pro), else the
220
224
  machine default. 'default' = the machine default.
225
+ --account <id> Claude / Codex account on this machine (\`very-happy account
226
+ list\`); 'machine' = the machine's own login.
227
+ Default = the machine's default account, if set. A
228
+ missing or expired account fails the spawn.
221
229
  --fork <sessionId> Fork an existing session of THIS machine (same as the
222
230
  web's fork): copies its conversation and continues
223
231
  it in a new session, in the same directory and with
@@ -369,6 +377,16 @@ async function handleSpawnCommand(args) {
369
377
  process.exit(1);
370
378
  }
371
379
  }
380
+ let accountChoice = options.account ? options.account === "machine" ? null : options.account : void 0;
381
+ if (accountChoice === void 0 && options.project && !forkSource) {
382
+ try {
383
+ const defaults = await sharedProjectsClient().defaults(options.project);
384
+ const machineId = (await readSettings()).machineId;
385
+ if (machineId) accountChoice = resolveLaunchAgentProfile({ project: defaults.agentProfiles, agent: agent ?? "claude", machineId }).agentProfileId;
386
+ } catch (error) {
387
+ console.error(chalk.dim(`(project ${options.project}: defaults unavailable \u2014 using the machine default account: ${error instanceof Error ? error.message : String(error)})`));
388
+ }
389
+ }
372
390
  logger.debug(`[SPAWN CMD] Spawning session in ${directory}${forkSource ? ` (fork of ${forkSource.parentSessionId})` : ""}`);
373
391
  const result = await spawnDaemonSession(directory, void 0, {
374
392
  spawnedBy: options.spawnedBy,
@@ -380,7 +398,8 @@ async function handleSpawnCommand(args) {
380
398
  // through, an old wrapper ignores it).
381
399
  environmentVariables: spawnEnvironmentVariables(options.env, prompt !== void 0),
382
400
  ...resumeIds,
383
- ...forkSource ? { parentSessionId: forkSource.parentSessionId } : {}
401
+ ...forkSource ? { parentSessionId: forkSource.parentSessionId } : {},
402
+ ...accountChoice !== void 0 ? { agentProfileId: accountChoice } : {}
384
403
  });
385
404
  if (result?.error || !result?.success || !result?.sessionId) {
386
405
  const message = result?.error || "Daemon returned no session ID";
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-CLUHaPU8.cjs');
3
+ var index = require('./index-BUFrKZeQ.cjs');
4
4
 
5
5
  function chooseProject(opts) {
6
6
  if (opts.project) return { kind: "explicit", projectId: opts.project };
@@ -1,4 +1,4 @@
1
- import { u as getAgentCodeDefaults, v as isLatestModelMode, w as resolveLatestModel, L as LATEST_MODEL_MODE, E as EFFORT_INTENT_AUTO, x as normalizeAgentKey } from './index-Bq8NKSCF.mjs';
1
+ import { L as getAgentCodeDefaults, M as isLatestModelMode, N as resolveLatestModel, O as LATEST_MODEL_MODE, Q as EFFORT_INTENT_AUTO, T as normalizeAgentKey } from './index-D1YnIih6.mjs';
2
2
 
3
3
  function chooseProject(opts) {
4
4
  if (opts.project) return { kind: "explicit", projectId: opts.project };
@@ -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-Ct2zvaq0.cjs');
6
+ var logger = require('./logger-CX3x2eI4.cjs');
7
7
  var node_fs = require('node:fs');
8
8
 
9
9
  let cachedRuntime = null;
@@ -1,7 +1,7 @@
1
1
  import { spawn } from 'cross-spawn';
2
2
  import { join } from 'node:path';
3
3
  import { p as projectPath } from './projectPath-BTBIMB57.mjs';
4
- import { l as logger } from './logger-GcbI0eg2.mjs';
4
+ import { l as logger } from './logger-JV7-4Q_6.mjs';
5
5
  import { existsSync } from 'node:fs';
6
6
 
7
7
  let cachedRuntime = null;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var logger = require('./logger-Ct2zvaq0.cjs');
3
+ var logger = require('./logger-CX3x2eI4.cjs');
4
4
  var fs = require('fs/promises');
5
5
 
6
6
  function startFileWatcher(file, onFileChange, options = {}) {
@@ -1,4 +1,4 @@
1
- import { l as logger } from './logger-GcbI0eg2.mjs';
1
+ import { l as logger } from './logger-JV7-4Q_6.mjs';
2
2
  import { watch } from 'fs/promises';
3
3
 
4
4
  function startFileWatcher(file, onFileChange, options = {}) {
@@ -1,6 +1,6 @@
1
- import { l as logger } from './logger-GcbI0eg2.mjs';
2
- import { e as evaluateWrapperIdle, j as isQuiescent, k as HIBERNATION_UNSUPPORTED_BACKOFF_MS } from './persistence-Cpw4yJs8.mjs';
3
- import { c as connectionState } from './api-jfeMRg5R.mjs';
1
+ import { l as logger } from './logger-JV7-4Q_6.mjs';
2
+ import { e as evaluateWrapperIdle, j as isQuiescent, k as HIBERNATION_UNSUPPORTED_BACKOFF_MS } from './persistence-Cg4sfjQV.mjs';
3
+ import { c as connectionState } from './api-DUfunY3x.mjs';
4
4
 
5
5
  const PRESENCE_SETTLE_MS = 6e3;
6
6
  async function commitHibernation(deps) {
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var logger = require('./logger-Ct2zvaq0.cjs');
4
- var persistence = require('./persistence-A2NeERZJ.cjs');
5
- var api = require('./api-BBxZ7y2z.cjs');
3
+ var logger = require('./logger-CX3x2eI4.cjs');
4
+ var persistence = require('./persistence-CsmAgN-C.cjs');
5
+ var api = require('./api-CBE_a88I.cjs');
6
6
 
7
7
  const PRESENCE_SETTLE_MS = 6e3;
8
8
  async function commitHibernation(deps) {
@@ -0,0 +1,326 @@
1
+ 'use strict';
2
+
3
+ var node_fs = require('node:fs');
4
+ var os = require('node:os');
5
+ var path = require('node:path');
6
+ var index = require('./index-BUFrKZeQ.cjs');
7
+
8
+ function providersPath(happyHomeDir) {
9
+ return path.join(happyHomeDir, "providers.json");
10
+ }
11
+ function sessionProvidersPath(happyHomeDir) {
12
+ return path.join(happyHomeDir, "session-providers.json");
13
+ }
14
+ function parseProvidersFile(raw) {
15
+ const profiles = {};
16
+ const src = raw && typeof raw === "object" ? raw.profiles : void 0;
17
+ if (src && typeof src === "object") {
18
+ for (const [id, p] of Object.entries(src)) {
19
+ if (!p || typeof p !== "object") continue;
20
+ const { name, baseUrl, apiKeyFile, models } = p;
21
+ if (typeof baseUrl !== "string" || !/^https?:\/\//.test(baseUrl) || typeof apiKeyFile !== "string" || !apiKeyFile) continue;
22
+ const ids = [];
23
+ const contextWindows = {};
24
+ for (const m of Array.isArray(models) ? models : []) {
25
+ if (typeof m === "string") ids.push(m);
26
+ else if (m && typeof m === "object" && typeof m.id === "string") {
27
+ const { id: modelId, contextWindow } = m;
28
+ ids.push(modelId);
29
+ if (typeof contextWindow === "number" && Number.isInteger(contextWindow) && contextWindow > 0) contextWindows[modelId] = contextWindow;
30
+ }
31
+ }
32
+ profiles[id] = {
33
+ ...typeof name === "string" ? { name } : {},
34
+ baseUrl: baseUrl.replace(/\/+$/, ""),
35
+ apiKeyFile,
36
+ ...Array.isArray(models) ? { models: ids } : {},
37
+ ...Object.keys(contextWindows).length > 0 ? { contextWindows } : {}
38
+ };
39
+ }
40
+ }
41
+ return { profiles };
42
+ }
43
+ function parseSessionProvidersFile(raw) {
44
+ const out = {};
45
+ if (!raw || typeof raw !== "object") return out;
46
+ for (const [sessionId, b] of Object.entries(raw)) {
47
+ if (!b || typeof b !== "object") continue;
48
+ const { profile, model } = b;
49
+ if (typeof profile === "string" && profile && typeof model === "string" && model) out[sessionId] = { profile, model };
50
+ }
51
+ return out;
52
+ }
53
+
54
+ const KIND_AGENT = {
55
+ "claude-subscription": "claude",
56
+ "claude-api": "claude",
57
+ "codex-chatgpt": "codex",
58
+ "codex-provider": "codex"
59
+ };
60
+ function isApiKind(kind) {
61
+ return kind === "claude-api" || kind === "codex-provider";
62
+ }
63
+ const SPAWN_ACCOUNT_ENV = "VH_AGENT_PROFILE_ID";
64
+ const SUBSCRIPTION_TOKEN_TTL_MS = 365 * 24 * 60 * 60 * 1e3;
65
+ const ACCOUNT_ID_PATTERN = /^[a-z0-9][a-z0-9-]{0,47}$/;
66
+ function accountsPath(home) {
67
+ return path.join(home, "accounts.json");
68
+ }
69
+ function accountSecretPath(home, id) {
70
+ if (!ACCOUNT_ID_PATTERN.test(id)) throw new Error(`invalid account id "${id}"`);
71
+ return path.join(home, "accounts", id, "secret");
72
+ }
73
+ function accountCodexHomePath(home, id) {
74
+ if (!ACCOUNT_ID_PATTERN.test(id)) throw new Error(`invalid account id "${id}"`);
75
+ return path.join(home, "accounts", id, "codex-home");
76
+ }
77
+ function sessionAccountsPath(home) {
78
+ return path.join(home, "session-accounts.json");
79
+ }
80
+ function expandHome(path$1, home = os.homedir()) {
81
+ return path$1 === "~" ? home : path$1.startsWith("~/") ? path.join(home, path$1.slice(2)) : path$1;
82
+ }
83
+ function readJson(path) {
84
+ if (!node_fs.existsSync(path)) return void 0;
85
+ try {
86
+ return JSON.parse(node_fs.readFileSync(path, "utf8"));
87
+ } catch {
88
+ return void 0;
89
+ }
90
+ }
91
+ function writeJson0600(path$1, value) {
92
+ node_fs.mkdirSync(path.dirname(path$1), { recursive: true });
93
+ const tmp = `${path$1}.${process.pid}.${Date.now()}.tmp`;
94
+ node_fs.writeFileSync(tmp, JSON.stringify(value, null, 2) + "\n", { mode: 384 });
95
+ node_fs.chmodSync(tmp, 384);
96
+ node_fs.renameSync(tmp, path$1);
97
+ }
98
+ function parseKey(raw) {
99
+ if (!raw || typeof raw !== "object") return void 0;
100
+ const k = raw;
101
+ if (k.source === "file" && typeof k.path === "string" && k.path) return { source: "file", path: k.path };
102
+ if (k.source === "env" && typeof k.name === "string" && /^[A-Za-z_][A-Za-z0-9_]*$/.test(k.name)) return { source: "env", name: k.name };
103
+ if (k.source === "stored") return { source: "stored" };
104
+ return void 0;
105
+ }
106
+ function parseAccountsFile(raw) {
107
+ const out = { version: 2, accounts: {}, defaults: {} };
108
+ if (!raw || typeof raw !== "object") return out;
109
+ const src = raw.accounts;
110
+ if (src && typeof src === "object") {
111
+ for (const [id, value] of Object.entries(src)) {
112
+ if (!ACCOUNT_ID_PATTERN.test(id) || !value || typeof value !== "object") continue;
113
+ const a = value;
114
+ const kind = a.kind;
115
+ if (typeof a.kind !== "string" || !(a.kind in KIND_AGENT) || a.agent !== KIND_AGENT[kind]) continue;
116
+ const label = typeof a.label === "string" && a.label.trim() ? a.label.trim() : id;
117
+ const rec = { label, agent: KIND_AGENT[kind], kind, createdAt: typeof a.createdAt === "number" ? a.createdAt : 0 };
118
+ const baseUrl = typeof a.baseUrl === "string" && /^https?:\/\//.test(a.baseUrl) ? a.baseUrl.replace(/\/+$/, "") : void 0;
119
+ if (kind === "codex-provider") {
120
+ const provider = typeof a.provider === "string" && /^[A-Za-z0-9_-]{1,64}$/.test(a.provider) ? a.provider : void 0;
121
+ if (!provider && !baseUrl) continue;
122
+ if (provider) rec.provider = provider;
123
+ if (a.wireApi === "responses" || a.wireApi === "chat") rec.wireApi = a.wireApi;
124
+ }
125
+ if (kind === "codex-chatgpt") {
126
+ if (typeof a.email === "string" && a.email) rec.email = a.email;
127
+ if (typeof a.planType === "string" && a.planType) rec.planType = a.planType;
128
+ }
129
+ if (isApiKind(kind)) {
130
+ if (kind === "claude-api" && !baseUrl) continue;
131
+ const key = parseKey(a.key);
132
+ if (!key) continue;
133
+ if (baseUrl) rec.baseUrl = baseUrl;
134
+ rec.key = key;
135
+ if (Array.isArray(a.models)) rec.models = a.models.filter((m) => typeof m === "string" && m.length > 0);
136
+ if (a.contextWindows && typeof a.contextWindows === "object") {
137
+ const cw = {};
138
+ for (const [m, n] of Object.entries(a.contextWindows)) {
139
+ if (typeof n === "number" && Number.isInteger(n) && n > 0) cw[m] = n;
140
+ }
141
+ if (Object.keys(cw).length > 0) rec.contextWindows = cw;
142
+ }
143
+ }
144
+ if (typeof a.expiresAt === "number") rec.expiresAt = a.expiresAt;
145
+ if (a.check && typeof a.check === "object") {
146
+ const c = a.check;
147
+ if (typeof c.status === "string" && typeof c.at === "number") {
148
+ rec.check = { status: c.status, at: c.at, ...typeof c.detail === "string" ? { detail: c.detail } : {} };
149
+ }
150
+ }
151
+ out.accounts[id] = rec;
152
+ }
153
+ }
154
+ const defaults = raw.defaults;
155
+ if (defaults && typeof defaults === "object") {
156
+ for (const [agent, id] of Object.entries(defaults)) {
157
+ if (typeof id === "string" && id) out.defaults[agent] = id;
158
+ }
159
+ }
160
+ return out;
161
+ }
162
+ function legacyAccountsFromProviders(raw) {
163
+ const out = {};
164
+ for (const [id, p] of Object.entries(parseProvidersFile(raw).profiles)) {
165
+ if (!ACCOUNT_ID_PATTERN.test(id)) continue;
166
+ out[id] = {
167
+ label: p.name ?? id,
168
+ agent: "claude",
169
+ kind: "claude-api",
170
+ createdAt: 0,
171
+ baseUrl: p.baseUrl,
172
+ key: { source: "file", path: p.apiKeyFile },
173
+ ...p.models ? { models: p.models } : {},
174
+ ...p.contextWindows ? { contextWindows: p.contextWindows } : {},
175
+ legacy: true
176
+ };
177
+ }
178
+ return out;
179
+ }
180
+ function mergeAccounts(v2, legacy) {
181
+ return { ...v2, accounts: { ...legacy, ...v2.accounts } };
182
+ }
183
+ function readAccountsFileV2(home) {
184
+ return parseAccountsFile(readJson(accountsPath(home)));
185
+ }
186
+ function readAccounts(home) {
187
+ return mergeAccounts(readAccountsFileV2(home), legacyAccountsFromProviders(readJson(providersPath(home))));
188
+ }
189
+ function writeAccountsFile(home, file) {
190
+ const accounts = {};
191
+ for (const [id, a] of Object.entries(file.accounts)) if (!a.legacy) accounts[id] = a;
192
+ writeJson0600(accountsPath(home), { version: 2, accounts, defaults: file.defaults });
193
+ }
194
+ function mergeSessionBindings(v2Raw, v1Raw) {
195
+ const out = {};
196
+ for (const [sessionId, b] of Object.entries(parseSessionProvidersFile(v1Raw))) out[sessionId] = { account: b.profile, model: b.model };
197
+ if (v2Raw && typeof v2Raw === "object") {
198
+ for (const [sessionId, b] of Object.entries(v2Raw)) {
199
+ if (!b || typeof b !== "object") continue;
200
+ const { account, model } = b;
201
+ if (account !== null && (typeof account !== "string" || !account)) continue;
202
+ out[sessionId] = { account, ...typeof model === "string" && model ? { model } : {} };
203
+ }
204
+ }
205
+ return out;
206
+ }
207
+ function readSessionBindings(home) {
208
+ return mergeSessionBindings(readJson(sessionAccountsPath(home)), readJson(sessionProvidersPath(home)));
209
+ }
210
+ function readSessionBindingV2(home, sessionId) {
211
+ const raw = readJson(sessionAccountsPath(home));
212
+ const entry = raw && typeof raw === "object" ? raw[sessionId] : void 0;
213
+ return entry && typeof entry === "object" ? entry : void 0;
214
+ }
215
+ function writeSessionBinding(home, sessionId, binding) {
216
+ const raw = readJson(sessionAccountsPath(home));
217
+ const current = raw && typeof raw === "object" ? { ...raw } : {};
218
+ if (binding === void 0) delete current[sessionId];
219
+ else current[sessionId] = binding;
220
+ writeJson0600(sessionAccountsPath(home), current);
221
+ }
222
+ function sessionsBoundTo(bindings, accountId) {
223
+ return Object.entries(bindings).filter(([, b]) => b.account === accountId).map(([id]) => id);
224
+ }
225
+ function writeAccountSecret(home, id, secret) {
226
+ const path$1 = accountSecretPath(home, id);
227
+ node_fs.mkdirSync(path.dirname(path$1), { recursive: true, mode: 448 });
228
+ node_fs.chmodSync(path.dirname(path$1), 448);
229
+ const tmp = `${path$1}.${process.pid}.tmp`;
230
+ node_fs.writeFileSync(tmp, secret.trim() + "\n", { mode: 384 });
231
+ node_fs.chmodSync(tmp, 384);
232
+ node_fs.renameSync(tmp, path$1);
233
+ }
234
+ function removeAccountSecret(home, id) {
235
+ node_fs.rmSync(path.dirname(accountSecretPath(home, id)), { recursive: true, force: true });
236
+ }
237
+ const KIND_ID_BASE = {
238
+ "claude-subscription": "claude-sub",
239
+ "claude-api": "claude-api",
240
+ "codex-chatgpt": "chatgpt",
241
+ "codex-provider": "codex-api"
242
+ };
243
+ function newAccountId(label, kind, taken) {
244
+ const used = new Set(taken);
245
+ const ascii = /^[\x20-\x7e]*$/.test(label);
246
+ const slug = ascii ? label.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40) : "";
247
+ const base = slug && /^[a-z0-9]/.test(slug) ? slug : KIND_ID_BASE[kind];
248
+ if (!used.has(base)) return base;
249
+ for (let n = 2; ; n++) if (!used.has(`${base}-${n}`)) return `${base}-${n}`;
250
+ }
251
+ function secretPresent(home, id, a, probe) {
252
+ if (a.kind === "codex-chatgpt") return probe.fileReadable(path.join(accountCodexHomePath(home, id), "auth.json"));
253
+ if (a.kind === "claude-subscription" || a.key?.source === "stored") return probe.fileReadable(accountSecretPath(home, id));
254
+ if (a.key?.source === "file") return probe.fileReadable(expandHome(a.key.path));
255
+ if (a.key?.source === "env") return !!probe.env[a.key.name]?.trim();
256
+ return false;
257
+ }
258
+ function accountStatus(home, id, a, probe, now) {
259
+ if (!secretPresent(home, id, a, probe)) return { status: "missing-secret" };
260
+ if (a.expiresAt !== void 0 && a.expiresAt <= now) return { status: "expired" };
261
+ if (a.check) return { status: a.check.status, ...a.check.detail ? { detail: a.check.detail } : {} };
262
+ return { status: "unverified" };
263
+ }
264
+ function summarizeAccount(home, id, a, probe, now) {
265
+ const { status, detail } = accountStatus(home, id, a, probe, now);
266
+ const keySource = a.kind === "claude-subscription" || a.kind === "codex-chatgpt" ? "stored" : a.key?.source;
267
+ const keyRef = a.key?.source === "file" ? a.key.path : a.key?.source === "env" ? a.key.name : void 0;
268
+ return {
269
+ id,
270
+ label: a.label,
271
+ agent: a.agent,
272
+ kind: a.kind,
273
+ status,
274
+ ...detail ? { statusDetail: detail } : {},
275
+ ...a.check ? { checkedAt: a.check.at } : {},
276
+ ...a.createdAt ? { createdAt: a.createdAt } : {},
277
+ ...a.expiresAt !== void 0 ? { expiresAt: a.expiresAt } : {},
278
+ ...a.baseUrl ? { baseUrl: a.baseUrl } : {},
279
+ ...a.models ? { models: a.models } : {},
280
+ ...keySource ? { keySource } : {},
281
+ ...keyRef ? { keyRef } : {},
282
+ ...a.legacy ? { legacy: true } : {},
283
+ ...a.provider ? { provider: a.provider } : {},
284
+ ...a.email ? { email: a.email } : {},
285
+ ...a.planType ? { planType: a.planType } : {}
286
+ };
287
+ }
288
+ function defaultSecretProbe(env = process.env) {
289
+ return {
290
+ fileReadable: (path) => {
291
+ try {
292
+ return node_fs.readFileSync(path, "utf8").trim().length > 0;
293
+ } catch {
294
+ return false;
295
+ }
296
+ },
297
+ env
298
+ };
299
+ }
300
+ function buildAgentProfilesState(home, file, probe, now, daemonPid) {
301
+ 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));
302
+ const defaults = {};
303
+ for (const [agent, id] of Object.entries(file.defaults)) if (file.accounts[id]) defaults[agent] = id;
304
+ return { daemonPid, updatedAt: now, accounts, defaults, kinds: [...index.AGENT_PROFILE_KINDS] };
305
+ }
306
+
307
+ exports.SPAWN_ACCOUNT_ENV = SPAWN_ACCOUNT_ENV;
308
+ exports.SUBSCRIPTION_TOKEN_TTL_MS = SUBSCRIPTION_TOKEN_TTL_MS;
309
+ exports.accountCodexHomePath = accountCodexHomePath;
310
+ exports.accountSecretPath = accountSecretPath;
311
+ exports.accountsPath = accountsPath;
312
+ exports.buildAgentProfilesState = buildAgentProfilesState;
313
+ exports.defaultSecretProbe = defaultSecretProbe;
314
+ exports.expandHome = expandHome;
315
+ exports.newAccountId = newAccountId;
316
+ exports.providersPath = providersPath;
317
+ exports.readAccounts = readAccounts;
318
+ exports.readAccountsFileV2 = readAccountsFileV2;
319
+ exports.readSessionBindingV2 = readSessionBindingV2;
320
+ exports.readSessionBindings = readSessionBindings;
321
+ exports.removeAccountSecret = removeAccountSecret;
322
+ exports.sessionsBoundTo = sessionsBoundTo;
323
+ exports.summarizeAccount = summarizeAccount;
324
+ exports.writeAccountSecret = writeAccountSecret;
325
+ exports.writeAccountsFile = writeAccountsFile;
326
+ exports.writeSessionBinding = writeSessionBinding;