very-happy-cli 0.2.192 → 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 (208) hide show
  1. package/dist/{AcpBackend-CGHTDJd9.mjs → AcpBackend-B4PwjqHt.mjs} +3 -3
  2. package/dist/{AcpBackend-BQO4ShOy.cjs → AcpBackend-DtJCgftG.cjs} +3 -3
  3. package/dist/{AcpSessionManager-G0xD6Jbq.mjs → AcpSessionManager-BzKWgkdP.mjs} +2 -2
  4. package/dist/{AcpSessionManager-LlUMmcpB.cjs → AcpSessionManager-D4qshX_H.cjs} +2 -2
  5. package/dist/{BasePermissionHandler-N6Ip3tFt.cjs → BasePermissionHandler-5iG-cvA2.cjs} +1 -1
  6. package/dist/{BasePermissionHandler-BmTIg376.mjs → BasePermissionHandler-DV6UM6e9.mjs} +1 -1
  7. package/dist/{account-CCVT-HO_.mjs → account-Dco_nGT4.mjs} +84 -27
  8. package/dist/{account-DtaouikP.cjs → account-DvpA60oU.cjs} +84 -27
  9. package/dist/{accountService-Dd9uqde2.mjs → accountService-Cd7bnkfd.mjs} +369 -19
  10. package/dist/{accountService-Bddy0zwL.cjs → accountService-CuUSJDhP.cjs} +369 -19
  11. package/dist/{acpSessionResume-BnHDk5eD.cjs → acpSessionResume-Bk9mjXZ9.cjs} +1 -1
  12. package/dist/{acpSessionResume-BWEUxNtC.mjs → acpSessionResume-TQwN9ZZE.mjs} +1 -1
  13. package/dist/{agentHome-B0VnjkZW.mjs → agentHome-Bep8semY.mjs} +4 -4
  14. package/dist/{agentHome-CqQ29YY7.cjs → agentHome-c2dlgcw1.cjs} +4 -4
  15. package/dist/{api-hMDsC6Wg.cjs → api-CBE_a88I.cjs} +10 -10
  16. package/dist/{api-_LeBScjg.mjs → api-DUfunY3x.mjs} +10 -10
  17. package/dist/{apiMachine-CqW2m6Zr.cjs → apiMachine-BqtG0IWm.cjs} +19 -18
  18. package/dist/{apiMachine-CgRldeJ6.mjs → apiMachine-CU_bw5nV.mjs} +19 -18
  19. package/dist/{attachmentContent-BEeT2J5n.cjs → attachmentContent-B3AzuYqk.cjs} +2 -2
  20. package/dist/{attachmentContent-CyptLIfq.mjs → attachmentContent-KNIZxwlu.mjs} +2 -2
  21. package/dist/{auth-CFQikywl.mjs → auth-CZ7pKS-j.mjs} +8 -8
  22. package/dist/{auth-C9NvNHhL.cjs → auth-DCjxpI6Z.cjs} +5 -5
  23. package/dist/{auth-CA1OClsW.cjs → auth-SJ_dPw7H.cjs} +8 -8
  24. package/dist/{auth-DL8_J9vu.mjs → auth-jN5dNqTO.mjs} +5 -5
  25. package/dist/{auto-uQOxlxLp.cjs → auto-B_59RYH1.cjs} +23 -21
  26. package/dist/{auto-CKI05w1D.mjs → auto-DC0Sq-qB.mjs} +23 -21
  27. package/dist/{bootstrap-DaZ0Np7X.mjs → bootstrap-B3gMpU9e.mjs} +2 -2
  28. package/dist/{bootstrap-DsZGc69k.cjs → bootstrap-CoJu9VnB.cjs} +2 -2
  29. package/dist/{browser-BUIaSHK2.mjs → browser-LHW2hBH8.mjs} +1 -1
  30. package/dist/{browser-Ft0ASDm7.cjs → browser-v1pdPP1E.cjs} +1 -1
  31. package/dist/{claudeAccountEnv-ON24i0qv.mjs → claudeAccountEnv-BL1pR_37.mjs} +2 -1
  32. package/dist/{claudeAccountEnv-BOBpJ3k8.cjs → claudeAccountEnv-CEX_EMZr.cjs} +2 -1
  33. package/dist/{claudeLocal-B1ZVtryl.mjs → claudeLocal-BZUgA5G2.mjs} +5 -5
  34. package/dist/{claudeLocal-BMf9t4Fa.cjs → claudeLocal-BrzM2RBI.cjs} +5 -5
  35. package/dist/{claudeLocalLauncher-Bp8bqF4y.mjs → claudeLocalLauncher-A0AQyHFi.mjs} +10 -10
  36. package/dist/{claudeLocalLauncher-C8TeJcfF.cjs → claudeLocalLauncher-XAMpXUM7.cjs} +10 -10
  37. package/dist/{claudeSessionFork-YiktY55n.cjs → claudeSessionFork-Mhn2fYe_.cjs} +1 -1
  38. package/dist/{claudeSessionFork-8AA47z8Y.mjs → claudeSessionFork-_GwIlmMB.mjs} +1 -1
  39. package/dist/{client-Cxlp_D4I.mjs → client-7RnI9J0W.mjs} +2 -2
  40. package/dist/{client-Bm4oKvW7.mjs → client-Bde4QVIn.mjs} +4 -2
  41. package/dist/{client-D8XROyZc.cjs → client-CJr8Pjwm.cjs} +4 -2
  42. package/dist/{client-Crh8_cNx.cjs → client-D2GWkd-T.cjs} +2 -2
  43. package/dist/{client-CFHZfh9x.cjs → client-DLlnmAPL.cjs} +4 -4
  44. package/dist/{client-BmPaBnDK.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-BWJbLCQn.mjs → codexAppServerClient-B3QJV6Ey.mjs} +18 -7
  50. package/dist/{codexAppServerClient-q8GHQhyC.cjs → codexAppServerClient-DWEsZUC4.cjs} +18 -7
  51. package/dist/{codexCommand-BgpGg-Zy.cjs → codexCommand-Bg8AmxVm.cjs} +187 -57
  52. package/dist/{codexCommand-BfXfRQr4.mjs → codexCommand-D1xlj4sT.mjs} +188 -58
  53. package/dist/{codexTermination-CVUF0X75.cjs → codexTermination-ByX9GcEJ.cjs} +1 -1
  54. package/dist/{codexTermination-s9fd1gkA.mjs → codexTermination-CaWAVQjZ.mjs} +1 -1
  55. package/dist/{config-BAjyTyYp.cjs → config-B2GGbiTv.cjs} +3 -3
  56. package/dist/{config-BF8XgLyc.mjs → config-C2XYEwXz.mjs} +3 -3
  57. package/dist/{configuration-CXEVKAyF.cjs → configuration-BBK0rmmj.cjs} +1 -1
  58. package/dist/{configuration-IhRiLDVe.mjs → configuration-ThKBP_zY.mjs} +1 -1
  59. package/dist/{connect-LZh1gr08.mjs → connect-BirnCl9q.mjs} +13 -13
  60. package/dist/{connect-rCS56arw.cjs → connect-C3tZs_NC.cjs} +13 -13
  61. package/dist/{context-DO6F5YwH.mjs → context-C0EFLnOg.mjs} +1 -1
  62. package/dist/{context-3_S_mWz9.cjs → context-wDp0aZBK.cjs} +1 -1
  63. package/dist/{controlClient-8ILulwjc.mjs → controlClient-Ckl8N1MS.mjs} +3 -3
  64. package/dist/{controlClient-j7p5p3_7.cjs → controlClient-DwWTns3A.cjs} +3 -3
  65. package/dist/{createSessionMetadata-DwdD_uVo.cjs → createSessionMetadata-DqZ6h02H.cjs} +2 -2
  66. package/dist/{createSessionMetadata-oyaTZm1b.mjs → createSessionMetadata-vug4Cv8z.mjs} +2 -2
  67. package/dist/{daemonAccounts-BCjDgoNt.cjs → daemonAccounts-CpGDY_4k.cjs} +4 -1
  68. package/dist/{daemonAccounts-BJgt6IJe.mjs → daemonAccounts-DwPwKxvv.mjs} +5 -2
  69. package/dist/{defaultPermissionMode-BFShzF55.cjs → defaultPermissionMode-BakXiqRr.cjs} +1 -1
  70. package/dist/{defaultPermissionMode-Lt3PUCwY.mjs → defaultPermissionMode-DF5AfeBb.mjs} +1 -1
  71. package/dist/{deterministicJson-Dfp-7wUZ.mjs → deterministicJson-BzX94gi3.mjs} +13 -13
  72. package/dist/{deterministicJson-DUN0v3St.cjs → deterministicJson-t33SsuRC.cjs} +13 -13
  73. package/dist/{doctor-FgUYTbAT.cjs → doctor-B9ug1LZb.cjs} +7 -7
  74. package/dist/{doctor-B_UwMcVT.mjs → doctor-C1zyOSXw.mjs} +7 -7
  75. package/dist/{downloadTarget-C0d6jRx-.mjs → downloadTarget-Baslc6jW.mjs} +6 -6
  76. package/dist/{downloadTarget-BrrQEDxg.cjs → downloadTarget-T1id2Gh6.cjs} +6 -6
  77. package/dist/{ensureDaemonRunning-KUMFfIil.mjs → ensureDaemonRunning-C6ERYK-O.mjs} +5 -5
  78. package/dist/{ensureDaemonRunning-Cq4FYI5Q.cjs → ensureDaemonRunning-CoAg11Zi.cjs} +5 -5
  79. package/dist/{handleResumeCommand-BGhVo3QH.mjs → handleResumeCommand-CrlqDuz7.mjs} +5 -5
  80. package/dist/{handleResumeCommand-Cl9GIL5F.cjs → handleResumeCommand-DPi-sPm7.cjs} +5 -5
  81. package/dist/{index-CZaLMmPC.cjs → index-B1swQJUS.cjs} +4 -4
  82. package/dist/{index-CQ_hLLCj.cjs → index-B2dJA8VG.cjs} +3 -3
  83. package/dist/{index-BzAYnYct.cjs → index-BUFrKZeQ.cjs} +198 -108
  84. package/dist/{index-JQDyJ3Li.mjs → index-BbdV2mzy.mjs} +3 -3
  85. package/dist/{index-BjXjMhGY.mjs → index-BcSPg3c5.mjs} +4 -4
  86. package/dist/{index-D8ODb0_U.cjs → index-Bkslzin5.cjs} +42 -42
  87. package/dist/{index-v5EmjT8l.mjs → index-Cn73rdtQ.mjs} +4 -4
  88. package/dist/{index-DYD3GM1m.mjs → index-D1YnIih6.mjs} +195 -109
  89. package/dist/{index-Ca1Tt96A.mjs → index-fZO4nF6e.mjs} +43 -43
  90. package/dist/{index-CRipkiqo.cjs → index-rocrvOYG.cjs} +4 -4
  91. package/dist/index.cjs +2 -2
  92. package/dist/index.mjs +2 -2
  93. package/dist/{install-ClUA9tbC.cjs → install-CArXjPfW.cjs} +3 -3
  94. package/dist/{install-D6EHRtAN.mjs → install-CChhyV2G.mjs} +3 -3
  95. package/dist/lib.cjs +12 -12
  96. package/dist/lib.d.cts +97 -25
  97. package/dist/lib.d.mts +97 -25
  98. package/dist/lib.mjs +12 -12
  99. package/dist/{lidState-CZOXXdzv.mjs → lidState-B6yYKjNK.mjs} +1 -1
  100. package/dist/{lidState-DqoN7zH4.cjs → lidState-B_v6qgfE.cjs} +1 -1
  101. package/dist/{localHappyAgentAuth-YHxDZ4x4.mjs → localHappyAgentAuth-KRlg_aI0.mjs} +1 -1
  102. package/dist/{localHappyAgentAuth-BnGCpHRX.cjs → localHappyAgentAuth-jJH0n67S.cjs} +1 -1
  103. package/dist/{logger-8su64lqR.cjs → logger-CX3x2eI4.cjs} +2 -2
  104. package/dist/{logger-Fd_rNvgd.mjs → logger-JV7-4Q_6.mjs} +2 -2
  105. package/dist/{machineMetadata-1HIIC7Bc.mjs → machineMetadata-D5-SW9kv.mjs} +3 -3
  106. package/dist/{machineMetadata-DYXt3p6u.cjs → machineMetadata-DhZuM0iB.cjs} +3 -3
  107. package/dist/{main-C_GrcYkn.cjs → main-1x1HGQEy.cjs} +47 -47
  108. package/dist/{main-BI6GIzUL.mjs → main-CFOdXbPD.mjs} +47 -47
  109. package/dist/{mcp-BycIv9oQ.cjs → mcp-BnKBSEh7.cjs} +18 -18
  110. package/dist/{mcp-XGoxywno.mjs → mcp-R6lMcFLO.mjs} +18 -18
  111. package/dist/{mirrorProtocol-DXT3rv7T.mjs → mirrorProtocol-CD4ntuZJ.mjs} +3 -3
  112. package/dist/{mirrorProtocol-DVnB8EO8.cjs → mirrorProtocol-DO-KtvAL.cjs} +3 -3
  113. package/dist/{package-6KkRAops.mjs → package-Bw3H6VLn.mjs} +7 -7
  114. package/dist/{package-iuLlSiSF.cjs → package-uzlvxa5S.cjs} +7 -7
  115. package/dist/{panels-B5Di2zb2.mjs → panels-BamhZCoZ.mjs} +5 -5
  116. package/dist/{panels-0C89q0Tu.cjs → panels-C46FxjmH.cjs} +5 -5
  117. package/dist/{peerTools-CANTX_mG.cjs → peerTools-D-VNNFw-.cjs} +5 -5
  118. package/dist/{peerTools-CKJ-IDM4.mjs → peerTools-WtRgTSqG.mjs} +5 -5
  119. package/dist/{persistence-DWcHe035.mjs → persistence-Cg4sfjQV.mjs} +2 -2
  120. package/dist/{persistence-B4ttN-fR.cjs → persistence-CsmAgN-C.cjs} +2 -2
  121. package/dist/{piRunnerArgs-Bl5GpBoN.mjs → piRunnerArgs-BbaAQvb4.mjs} +1 -1
  122. package/dist/{piRunnerArgs-BOkfxyak.cjs → piRunnerArgs-vnFygygF.cjs} +1 -1
  123. package/dist/{piRuntime-BhwxzdQf.mjs → piRuntime-Bid7TBf5.mjs} +1 -1
  124. package/dist/{piRuntime-DzrIiZU8.cjs → piRuntime-C2uj5Ucx.cjs} +1 -1
  125. package/dist/{piTerminal-BdS7ol7v.cjs → piTerminal-Ckpjfoqa.cjs} +20 -20
  126. package/dist/{piTerminal-DnA2CbGr.mjs → piTerminal-CqxgrI13.mjs} +20 -20
  127. package/dist/{pushNotifications-BqFoLye2.cjs → pushNotifications-BCg7YAiu.cjs} +3 -3
  128. package/dist/{pushNotifications-DkQ0yvFs.mjs → pushNotifications-BbE-qV9I.mjs} +3 -3
  129. package/dist/{query-BRJYSkb1.mjs → query-Bfr9O_62.mjs} +1 -1
  130. package/dist/{query-BQ4br3yn.cjs → query-vQ-HG394.cjs} +1 -1
  131. package/dist/{rateLimitReporter-DK5SQuCc.cjs → rateLimitReporter-BZ8x0-6-.cjs} +3 -3
  132. package/dist/{rateLimitReporter-BRbYkmuP.mjs → rateLimitReporter-CAz7VMw4.mjs} +3 -3
  133. package/dist/{rateLimitWindows-DBfiuYeg.cjs → rateLimitWindows-BZl6GMwQ.cjs} +1 -1
  134. package/dist/{rateLimitWindows-Da5AR-4u.mjs → rateLimitWindows-CRARnKaI.mjs} +1 -1
  135. package/dist/{registerCommonHandlers-m6pxxf2J.cjs → registerCommonHandlers-CZGmrPbT.cjs} +2 -2
  136. package/dist/{registerCommonHandlers-yQ7Ru-l0.mjs → registerCommonHandlers-Cj3Nl9y-.mjs} +2 -2
  137. package/dist/{registerKillSessionHandler-BDNpi7YO.mjs → registerKillSessionHandler-Bg9t45Ub.mjs} +6 -6
  138. package/dist/{registerKillSessionHandler-BAOIa_Fs.cjs → registerKillSessionHandler-C3EDnW4F.cjs} +6 -6
  139. package/dist/{remoteSessionClient-CZ7aaNgj.mjs → remoteSessionClient--0vfA7I5.mjs} +5 -5
  140. package/dist/{remoteSessionClient-iJMXRN_D.cjs → remoteSessionClient-CcSP24Zq.cjs} +5 -5
  141. package/dist/{reportProgressTool-DfQhPu0s.mjs → reportProgressTool-DVru7jc_.mjs} +3 -3
  142. package/dist/{reportProgressTool-DpFs7pSe.cjs → reportProgressTool-Ddg1yVq2.cjs} +3 -3
  143. package/dist/{run-p-xp1_HY.cjs → run-BTrIT_jU.cjs} +178 -847
  144. package/dist/{run-CwN28mcj.mjs → run-HtvH6BLi.mjs} +176 -845
  145. package/dist/{runClaude-DRKtAGTm.mjs → runClaude-DsHTk5Bu.mjs} +25 -25
  146. package/dist/{runClaude-D6U1Z575.cjs → runClaude-ipjwAHPI.cjs} +25 -25
  147. package/dist/{runClaudeDeps-Dkofokgb.cjs → runClaudeDeps-BKpwL6ln.cjs} +41 -41
  148. package/dist/{runClaudeDeps-BheVcIlD.mjs → runClaudeDeps-BV3vpeyY.mjs} +46 -46
  149. package/dist/{runGemini-C8q3YCc0.cjs → runGemini-B-G0_7Ab.cjs} +33 -33
  150. package/dist/{runGemini-owbvhFbi.mjs → runGemini-DhjK6_Fp.mjs} +33 -33
  151. package/dist/{runOpenClaw-Dky3-mjO.mjs → runOpenClaw-B6lawk8n.mjs} +18 -18
  152. package/dist/{runOpenClaw-DGeN66-t.cjs → runOpenClaw-BHIo8tkn.cjs} +18 -18
  153. package/dist/{sandbox-D2CPyoCA.cjs → sandbox-BAsO0ILe.cjs} +4 -4
  154. package/dist/{sandbox-sq_wy9Gl.mjs → sandbox-CKb7pCXg.mjs} +4 -4
  155. package/dist/selfCheck-CZ-t1Xzq.mjs +88 -0
  156. package/dist/{selfCheck-BgLvQKSt.cjs → selfCheck-D4VvVZNi.cjs} +39 -39
  157. package/dist/{send-Cd10YhXh.cjs → send-Cz5m39QR.cjs} +8 -8
  158. package/dist/{send-K9vg-8t-.mjs → send-D8ipLKMY.mjs} +8 -8
  159. package/dist/{server-De4W1zuK.mjs → server-CjvgT3N9.mjs} +4 -4
  160. package/dist/{server-DRrV64r0.cjs → server-CySyJKPH.cjs} +6 -6
  161. package/dist/{sessionLock-Dl6i7IgA.mjs → sessionLock-B73fhgQN.mjs} +3 -3
  162. package/dist/{sessionLock-BDtSzzKS.cjs → sessionLock-DdDCuNUs.cjs} +3 -3
  163. package/dist/{sessionOps-gU88-W9F.mjs → sessionOps-C65Iej_C.mjs} +50 -8
  164. package/dist/{sessionOps-DvnEH4PL.cjs → sessionOps-XSEjIqNq.cjs} +50 -8
  165. package/dist/{sessionProvider-CKcIo7KO.mjs → sessionProvider-CLVNkfji.mjs} +11 -9
  166. package/dist/{sessionProvider-CbSZeZrl.cjs → sessionProvider-Dgsty8z_.cjs} +11 -9
  167. package/dist/{sessionScanner-7RtcCeyD.cjs → sessionScanner-D8IVXMMH.cjs} +3 -3
  168. package/dist/{sessionScanner-DR32uSby.mjs → sessionScanner-MW1P9Pm9.mjs} +3 -3
  169. package/dist/{sessions-BvuMjgvJ.cjs → sessions-BKz7gZqg.cjs} +10 -10
  170. package/dist/{sessions-DTt2Eguk.mjs → sessions-Dtk_agUL.mjs} +10 -10
  171. package/dist/{setupOfflineReconnection-BGnvhRfb.mjs → setupOfflineReconnection-Bvdy-2xd.mjs} +2 -2
  172. package/dist/{setupOfflineReconnection-DduOsw6p.cjs → setupOfflineReconnection-DxMiW7OV.cjs} +2 -2
  173. package/dist/{spawn-DMB6rRPA.cjs → spawn-DiPkJcrQ.cjs} +26 -16
  174. package/dist/{spawn-CL3cUc7b.mjs → spawn-Dm4xsZBX.mjs} +26 -16
  175. package/dist/{spawnAgents-CClb7buD.cjs → spawnAgents-B9olJ8xn.cjs} +1 -1
  176. package/dist/{spawnAgents-CRMfOJhh.mjs → spawnAgents-I29H9nO8.mjs} +1 -1
  177. package/dist/{spawnHappyCLI-DJdhX_Qx.cjs → spawnHappyCLI-BYGOUda1.cjs} +1 -1
  178. package/dist/{spawnHappyCLI-Cj_6IICe.mjs → spawnHappyCLI-CnMwzjWX.mjs} +1 -1
  179. package/dist/{startFileWatcher-LnOmVW6H.cjs → startFileWatcher-D14W6gn-.cjs} +1 -1
  180. package/dist/{startFileWatcher-DikVa8kg.mjs → startFileWatcher-DePAY1T5.mjs} +1 -1
  181. package/dist/{startupSessionCreate-CDdaLaMq.mjs → startupSessionCreate-DoK0IvJG.mjs} +3 -3
  182. package/dist/{startupSessionCreate-B3ND-917.cjs → startupSessionCreate-rBHd4tc1.cjs} +3 -3
  183. package/dist/{store-DV__wCvP.cjs → store-CkNa6oj4.cjs} +46 -9
  184. package/dist/{store--XN-7MS0.mjs → store-Vej_738f.mjs} +46 -10
  185. package/dist/{streamRelay-DFdOaLOn.cjs → streamRelay-C0G1HOOd.cjs} +1 -1
  186. package/dist/{streamRelay-sABnxEXq.mjs → streamRelay-C5U-C4GS.mjs} +1 -1
  187. package/dist/{sync-JoEZKRo8.mjs → sync-BP6vnxVP.mjs} +1 -1
  188. package/dist/{sync-_2lsZ1U2.cjs → sync-WYBwkJvG.cjs} +1 -1
  189. package/dist/{systemPrompt-CJEvNCuW.cjs → systemPrompt-BkQlCk5_.cjs} +2 -2
  190. package/dist/{systemPrompt-Zq4HyrZ5.mjs → systemPrompt-aRqBmkpw.mjs} +2 -2
  191. package/dist/{teams-qz4LqKJ2.mjs → teams-CGmC4ygu.mjs} +7 -7
  192. package/dist/{teams-BNZafnrT.cjs → teams-phbpwAGD.cjs} +7 -7
  193. package/dist/{template-LgvBbOna.cjs → template-B9pLEP8v.cjs} +2 -2
  194. package/dist/{template-CJ8BWSsc.mjs → template-CL9EvQLQ.mjs} +2 -2
  195. package/dist/{time-CaUlWSNJ.cjs → time-BTLcO8jp.cjs} +1 -1
  196. package/dist/{time-bzmet4s5.mjs → time-Cw0liIqB.mjs} +1 -1
  197. package/dist/{titleGenerator-BuIIu_JP.cjs → titleGenerator-Y1_7ceJC.cjs} +3 -3
  198. package/dist/{titleGenerator-CbTtJ_1D.mjs → titleGenerator-h6TmFe-c.mjs} +2 -2
  199. package/dist/{todo-CQ_BTf9C.cjs → todo-BxiPiCvB.cjs} +6 -6
  200. package/dist/{todo-DIrVF_Ak.mjs → todo-OKcTC_VC.mjs} +6 -6
  201. package/dist/{tools-cLOjBvPn.mjs → tools-BR-drXZ8.mjs} +3 -2
  202. package/dist/{tools-BnmmFZji.cjs → tools-CcebYtLj.cjs} +3 -2
  203. package/dist/{uninstall-uEEGKB84.cjs → uninstall-CnDeCC-M.cjs} +3 -3
  204. package/dist/{uninstall-C5OuW6dE.mjs → uninstall-D3stWKD2.mjs} +3 -3
  205. package/dist/{wrapperAccount-DXlD3bsO.mjs → wrapperAccount-BkufO_9g.mjs} +5 -4
  206. package/dist/{wrapperAccount-DzoGqS2b.cjs → wrapperAccount-D2A4DuZy.cjs} +6 -3
  207. package/package.json +7 -7
  208. package/dist/selfCheck-vkfrgQ7X.mjs +0 -88
@@ -3,10 +3,12 @@
3
3
  var node_crypto = require('node:crypto');
4
4
  var node_fs = require('node:fs');
5
5
  var path = require('node:path');
6
- var index = require('./index-BzAYnYct.cjs');
6
+ var index = require('./index-BUFrKZeQ.cjs');
7
7
  var node_child_process = require('node:child_process');
8
- var claudeAccountEnv = require('./claudeAccountEnv-BOBpJ3k8.cjs');
9
- var store = require('./store-DV__wCvP.cjs');
8
+ var claudeAccountEnv = require('./claudeAccountEnv-CEX_EMZr.cjs');
9
+ var codexAccount = require('./codexAccount-BDQjRbtI.cjs');
10
+ var node_readline = require('node:readline');
11
+ var store = require('./store-CkNa6oj4.cjs');
10
12
 
11
13
  const CHECK_TIMEOUT_MS = 2e4;
12
14
  const DEFAULT_CHECK_MODEL = "claude-haiku-4-5";
@@ -28,7 +30,7 @@ function lastLine(text) {
28
30
  return text.trim().split("\n").filter(Boolean).pop() ?? "";
29
31
  }
30
32
  function sanitizeDetail(text) {
31
- return text.replace(/sk-ant-[A-Za-z0-9_-]+/g, "sk-ant-\u2026").replace(/\s+/g, " ").trim().slice(0, 200);
33
+ return text.replace(/sk-ant-[A-Za-z0-9_-]+/g, "sk-ant-\u2026").replace(/\b(sk|rk)-[A-Za-z0-9_-]{16,}/g, "$1-\u2026").replace(/\s+/g, " ").trim().slice(0, 200);
32
34
  }
33
35
  async function checkApiAccount(record, key, now = Date.now) {
34
36
  const controller = new AbortController();
@@ -92,7 +94,7 @@ async function checkSubscriptionAccount(token, scratchDir, now = Date.now) {
92
94
  const LOGIN_CODE_TIMEOUT_MS = 10 * 6e4;
93
95
  const LOGIN_URL_TIMEOUT_MS = 2e4;
94
96
  const LOGIN_EXCHANGE_TIMEOUT_MS = 6e4;
95
- const LOGIN_RETAIN_MS = 10 * 6e4;
97
+ const LOGIN_RETAIN_MS$1 = 10 * 6e4;
96
98
  function stripAnsi(text) {
97
99
  return text.replace(/\x1b\][^\x07\x1b]*(\x07|\x1b\\)/g, "").replace(/\x1b\[[0-9;?<>=]*[ -/]*[@-~]/g, " ").replace(/\x1b[()][A-Za-z0-9]/g, "").replace(/\x1b[=>78]/g, "");
98
100
  }
@@ -235,11 +237,244 @@ class SetupTokenLoginManager {
235
237
  }
236
238
  entry.output = "";
237
239
  const loginId_ = loginId;
238
- const t = setTimeout(() => this.logins.delete(loginId_), LOGIN_RETAIN_MS);
240
+ const t = setTimeout(() => this.logins.delete(loginId_), LOGIN_RETAIN_MS$1);
239
241
  t.unref?.();
240
242
  }
241
243
  }
242
244
 
245
+ const DEVICE_LOGIN_TIMEOUT_MS = 15 * 6e4;
246
+ const DEVICE_LOGIN_START_TIMEOUT_MS = 2e4;
247
+ const LOGIN_RETAIN_MS = 10 * 6e4;
248
+ const END_AFTER_CLOSE_MS = 5e3;
249
+ function codexLoginEnv(base, codexHome) {
250
+ const env = {};
251
+ for (const [k, v] of Object.entries(base)) if (typeof v === "string") env[k] = v;
252
+ for (const key of codexAccount.CODEX_ALWAYS_STRIPPED_ENV_KEYS) delete env[key];
253
+ env.CODEX_HOME = codexHome;
254
+ env.RUST_LOG = "warn";
255
+ return env;
256
+ }
257
+ const spawnCodexRpc = (codexHome, env) => {
258
+ const child = node_child_process.spawn("codex", ["app-server", "--listen", "stdio://"], { env, cwd: codexHome, stdio: ["pipe", "pipe", "ignore"], windowsHide: true });
259
+ const pending = /* @__PURE__ */ new Map();
260
+ const listeners = [];
261
+ let nextId = 1;
262
+ node_readline.createInterface({ input: child.stdout }).on("line", (line) => {
263
+ let msg;
264
+ try {
265
+ msg = JSON.parse(line);
266
+ } catch {
267
+ return;
268
+ }
269
+ if (msg.id != null && pending.has(msg.id)) {
270
+ const p = pending.get(msg.id);
271
+ pending.delete(msg.id);
272
+ if (msg.error) p.reject(new Error(msg.error.message ?? "codex app-server error"));
273
+ else p.resolve(msg.result);
274
+ } else if (msg.method && msg.id == null) {
275
+ for (const cb of listeners) cb(msg.method, msg.params);
276
+ }
277
+ });
278
+ const send = (obj) => child.stdin?.writable && child.stdin.write(JSON.stringify(obj) + "\n");
279
+ const request = (method, params, timeoutMs = 15e3) => new Promise((resolve, reject) => {
280
+ const id = nextId++;
281
+ const timer = setTimeout(() => {
282
+ pending.delete(id);
283
+ reject(new Error(`${method} timed out`));
284
+ }, timeoutMs);
285
+ pending.set(id, { resolve: (v) => {
286
+ clearTimeout(timer);
287
+ resolve(v);
288
+ }, reject: (e) => {
289
+ clearTimeout(timer);
290
+ reject(e);
291
+ } });
292
+ send({ jsonrpc: "2.0", id, method, params });
293
+ });
294
+ child.on("error", () => {
295
+ });
296
+ const initialized = request("initialize", { clientInfo: { name: "very-happy-accounts", version: "1" } }).then(() => send({ jsonrpc: "2.0", method: "initialized" }));
297
+ return {
298
+ request: async (method, params, timeoutMs) => {
299
+ await initialized;
300
+ return request(method, params, timeoutMs);
301
+ },
302
+ onNotification: (cb) => {
303
+ listeners.push(cb);
304
+ },
305
+ onExit: (cb) => {
306
+ child.on("exit", (code) => cb(code));
307
+ },
308
+ close: () => {
309
+ child.kill();
310
+ }
311
+ };
312
+ };
313
+ class CodexDeviceLoginManager {
314
+ constructor(deps) {
315
+ this.deps = deps;
316
+ this.now = deps.now ?? Date.now;
317
+ }
318
+ logins = /* @__PURE__ */ new Map();
319
+ now;
320
+ activeLoginId() {
321
+ for (const [id, e] of this.logins) if (e.status.state === "starting" || e.status.state === "waiting-code") return id;
322
+ return null;
323
+ }
324
+ has(loginId) {
325
+ return this.logins.has(loginId);
326
+ }
327
+ async start(codexHome) {
328
+ const busy = this.activeLoginId();
329
+ if (busy) throw Object.assign(new Error("another Codex sign-in is in progress"), { code: "login-busy", loginId: busy });
330
+ const loginId = this.deps.newId();
331
+ const entry = { status: { loginId, state: "starting", flow: "device-code" }, rpc: null, timers: [] };
332
+ this.logins.set(loginId, entry);
333
+ let rpc;
334
+ try {
335
+ rpc = this.deps.spawnRpc(codexHome, codexLoginEnv(this.deps.env, codexHome));
336
+ } catch (error) {
337
+ this.finish(entry, "failed", `could not start codex: ${error instanceof Error ? error.message : String(error)}`);
338
+ return { ...entry.status };
339
+ }
340
+ entry.rpc = rpc;
341
+ rpc.onExit(() => {
342
+ entry.rpc = null;
343
+ if (entry.status.state === "starting" || entry.status.state === "waiting-code") this.finish(entry, "failed", "codex app-server exited");
344
+ });
345
+ rpc.onNotification((method, params) => {
346
+ if (method !== "account/login/completed") return;
347
+ if (entry.status.state !== "starting" && entry.status.state !== "waiting-code") return;
348
+ if (params?.loginId && entry.codexLoginId && params.loginId !== entry.codexLoginId) return;
349
+ if (params?.success) void this.complete(entry);
350
+ else this.finish(entry, "failed", sanitizeDetail(String(params?.error ?? "sign-in failed")));
351
+ });
352
+ try {
353
+ const result = await rpc.request("account/login/start", { type: "chatgptDeviceCode" }, DEVICE_LOGIN_START_TIMEOUT_MS);
354
+ if (typeof result?.verificationUrl !== "string" || typeof result?.userCode !== "string") throw new Error("codex returned no device code");
355
+ entry.codexLoginId = typeof result.loginId === "string" ? result.loginId : void 0;
356
+ if (entry.status.state === "starting") {
357
+ entry.status = { ...entry.status, state: "waiting-code", url: result.verificationUrl, userCode: result.userCode, expiresAt: this.now() + DEVICE_LOGIN_TIMEOUT_MS };
358
+ entry.timers.push(setTimeout(() => {
359
+ if (entry.status.state === "waiting-code") this.finish(entry, "expired");
360
+ }, DEVICE_LOGIN_TIMEOUT_MS));
361
+ }
362
+ } catch (error) {
363
+ this.finish(entry, "failed", sanitizeDetail(error instanceof Error ? error.message : String(error)));
364
+ }
365
+ return { ...entry.status };
366
+ }
367
+ async complete(entry) {
368
+ if (entry.status.state !== "waiting-code" && entry.status.state !== "starting") return;
369
+ let account = {};
370
+ try {
371
+ const read = await entry.rpc?.request("account/read", { refreshToken: false });
372
+ const a = read?.account;
373
+ if (a?.type === "chatgpt") account = { ...a.email ? { email: String(a.email) } : {}, ...a.planType ? { planType: String(a.planType) } : {} };
374
+ } catch {
375
+ }
376
+ try {
377
+ const summary = await this.deps.onSuccess(entry.status.loginId, account);
378
+ entry.status = { ...entry.status, account: summary };
379
+ this.finish(entry, "succeeded");
380
+ } catch (error) {
381
+ this.finish(entry, "failed", error instanceof Error ? error.message : String(error));
382
+ }
383
+ }
384
+ status(loginId) {
385
+ return { ...this.get(loginId).status };
386
+ }
387
+ cancel(loginId) {
388
+ const entry = this.get(loginId);
389
+ if (entry.status.state === "starting" || entry.status.state === "waiting-code") {
390
+ if (entry.codexLoginId) void entry.rpc?.request("account/login/cancel", { loginId: entry.codexLoginId }, 5e3).catch(() => {
391
+ });
392
+ this.finish(entry, "canceled");
393
+ }
394
+ return { ...entry.status };
395
+ }
396
+ dispose() {
397
+ for (const entry of this.logins.values()) {
398
+ if (entry.status.state === "starting" || entry.status.state === "waiting-code") this.finish(entry, "canceled");
399
+ for (const t of entry.timers) clearTimeout(t);
400
+ }
401
+ this.logins.clear();
402
+ for (const end of [...this.pendingEnds]) end(true);
403
+ }
404
+ /** finish() → onEnd still waiting for its app-server to exit; dispose() runs them at once. */
405
+ pendingEnds = /* @__PURE__ */ new Set();
406
+ settleWaiters = [];
407
+ /** Resolves once every finished login's onEnd has run (a CLI exiting right after Ctrl-C waits for the cleanup). */
408
+ settle() {
409
+ if (this.pendingEnds.size === 0) return Promise.resolve();
410
+ return new Promise((resolve) => this.settleWaiters.push(resolve));
411
+ }
412
+ get(loginId) {
413
+ const entry = this.logins.get(loginId);
414
+ if (!entry) throw Object.assign(new Error(`no login "${loginId}"`), { code: "login-not-found" });
415
+ return entry;
416
+ }
417
+ finish(entry, state, error) {
418
+ entry.status = { ...entry.status, state, ...error ? { error } : {} };
419
+ for (const t2 of entry.timers) clearTimeout(t2);
420
+ entry.timers = [];
421
+ const rpc = entry.rpc;
422
+ entry.rpc = null;
423
+ const loginId = entry.status.loginId;
424
+ if (!rpc) this.deps.onEnd?.(loginId, state);
425
+ else {
426
+ let ended = false;
427
+ const end = (closeNow) => {
428
+ if (ended) return;
429
+ ended = true;
430
+ this.pendingEnds.delete(end);
431
+ if (closeNow) rpc.close();
432
+ this.deps.onEnd?.(loginId, state);
433
+ if (this.pendingEnds.size === 0) for (const resolve of this.settleWaiters.splice(0)) resolve();
434
+ };
435
+ this.pendingEnds.add(end);
436
+ rpc.onExit(() => end());
437
+ setTimeout(() => rpc.close(), state === "canceled" ? 500 : 0).unref?.();
438
+ setTimeout(() => end(), END_AFTER_CLOSE_MS).unref?.();
439
+ }
440
+ const t = setTimeout(() => this.logins.delete(entry.status.loginId), LOGIN_RETAIN_MS);
441
+ t.unref?.();
442
+ }
443
+ }
444
+ function classifyChatgptRead(read, now) {
445
+ const account = read?.account;
446
+ if (account && account.type === "chatgpt") return { status: "ok", at: now };
447
+ return { status: "expired", at: now, detail: "not signed in" };
448
+ }
449
+ async function checkCodexChatgptAccount(codexHome, env, spawnRpc = spawnCodexRpc, now = Date.now) {
450
+ let rpc = null;
451
+ try {
452
+ rpc = spawnRpc(codexHome, codexLoginEnv(env, codexHome));
453
+ const read = await rpc.request("account/read", { refreshToken: true }, CHECK_TIMEOUT_MS);
454
+ return classifyChatgptRead(read, now());
455
+ } catch (error) {
456
+ const message = error instanceof Error ? error.message : String(error);
457
+ if (/refresh token|401|unauthori[sz]ed|sign in again|log in again/i.test(message)) return { status: "expired", at: now(), detail: sanitizeDetail(message) };
458
+ return { status: "unverified", at: now(), detail: sanitizeDetail(message) };
459
+ } finally {
460
+ rpc?.close();
461
+ }
462
+ }
463
+ async function checkCodexProviderAccount(baseUrl, key, headers = {}, now = Date.now) {
464
+ const controller = new AbortController();
465
+ const timer = setTimeout(() => controller.abort(), CHECK_TIMEOUT_MS);
466
+ try {
467
+ const res = await fetch(`${baseUrl.replace(/\/+$/, "")}/models`, { signal: controller.signal, headers: { ...headers, authorization: `Bearer ${key}` } });
468
+ const body = res.ok ? "" : (await res.text().catch(() => "")).slice(0, 300);
469
+ return classifyHttpCheck("codex-provider", res.status, body, now());
470
+ } catch (error) {
471
+ return { status: "unverified", at: now(), detail: sanitizeDetail(error instanceof Error ? error.message : String(error)) };
472
+ } finally {
473
+ clearTimeout(timer);
474
+ }
475
+ }
476
+
477
+ const ACCOUNT_AGENTS = ["claude", "codex"];
243
478
  class AccountError extends Error {
244
479
  constructor(code, message, sessions) {
245
480
  super(message);
@@ -271,10 +506,14 @@ class AccountService {
271
506
  env;
272
507
  now;
273
508
  logins = null;
509
+ codexLogins = null;
274
510
  /** loginId → account to (re)write when its token arrives. */
275
511
  loginTargets = /* @__PURE__ */ new Map();
276
512
  state() {
277
- return store.buildAgentProfilesState(this.home, store.readAccounts(this.home), store.defaultSecretProbe(this.env), this.now(), this.deps.daemonPid ?? process.pid);
513
+ const state = store.buildAgentProfilesState(this.home, store.readAccounts(this.home), store.defaultSecretProbe(this.env), this.now(), this.deps.daemonPid ?? process.pid);
514
+ const codexProviders = codexAccount.readCodexProviders(this.env).map((p) => ({ id: p.id, ...p.name ? { name: p.name } : {}, ...p.baseUrl ? { baseUrl: p.baseUrl } : {}, ...p.envKey ? { envKey: p.envKey } : {} }));
515
+ const withFeatures = { ...state, features: [index.AGENT_PROFILE_FEATURE_LAUNCH] };
516
+ return codexProviders.length > 0 ? { ...withFeatures, codexProviders } : withFeatures;
278
517
  }
279
518
  summary(id) {
280
519
  const record = store.readAccounts(this.home).accounts[id];
@@ -301,8 +540,11 @@ class AccountService {
301
540
  const parsed = index.AgentProfileAddRequestSchema.safeParse(params);
302
541
  if (!parsed.success) throw new AccountError("invalid-params", parsed.error.issues[0]?.message ?? "invalid params");
303
542
  const req = parsed.data;
543
+ if (req.agent === "codex" && req.provider && !codexAccount.readCodexProviders(this.env).some((p) => p.id === req.provider)) {
544
+ throw new AccountError("not-found", `no [model_providers.${req.provider}] in the machine's Codex config.toml`);
545
+ }
304
546
  const file = store.readAccountsFileV2(this.home);
305
- const id = store.newAccountId(req.label, "claude-api", Object.keys(store.readAccounts(this.home).accounts));
547
+ const id = store.newAccountId(req.label, req.kind, Object.keys(store.readAccounts(this.home).accounts));
306
548
  const models = [];
307
549
  const contextWindows = {};
308
550
  for (const m of req.models ?? []) {
@@ -314,10 +556,12 @@ class AccountService {
314
556
  }
315
557
  const record = {
316
558
  label: req.label,
317
- agent: "claude",
318
- kind: "claude-api",
559
+ agent: req.agent,
560
+ kind: req.kind,
319
561
  createdAt: this.now(),
320
- baseUrl: req.baseUrl.replace(/\/+$/, ""),
562
+ ...req.baseUrl ? { baseUrl: req.baseUrl.replace(/\/+$/, "") } : {},
563
+ ...req.agent === "codex" && req.provider ? { provider: req.provider } : {},
564
+ ...req.agent === "codex" && req.wireApi ? { wireApi: req.wireApi } : {},
321
565
  key: req.key.source === "paste" ? { source: "stored" } : req.key.source === "file" ? { source: "file", path: req.key.path } : { source: "env", name: req.key.name },
322
566
  ...models.length > 0 ? { models } : {},
323
567
  ...Object.keys(contextWindows).length > 0 ? { contextWindows } : {}
@@ -375,7 +619,7 @@ class AccountService {
375
619
  return outcome.notRunning ? "skipped" : "failed";
376
620
  }
377
621
  setDefault(agent, accountId) {
378
- if (agent !== "claude") throw new AccountError("invalid-params", 'agent must be "claude"');
622
+ if (!ACCOUNT_AGENTS.includes(agent)) throw new AccountError("invalid-params", 'agent must be "claude" or "codex"');
379
623
  if (accountId !== null && typeof accountId !== "string") throw new AccountError("invalid-params", "accountId must be a string or null");
380
624
  if (typeof accountId === "string") {
381
625
  const record = store.readAccounts(this.home).accounts[accountId];
@@ -404,9 +648,17 @@ class AccountService {
404
648
  if (typeof accountId !== "string") throw new AccountError("invalid-params", "accountId is required");
405
649
  const record = store.readAccounts(this.home).accounts[accountId];
406
650
  if (!record) throw new AccountError("not-found", `no account "${accountId}"`);
407
- const secret = this.readSecretFor(accountId, record);
408
- if (!secret) return this.summary(accountId);
409
- const check = this.deps.check ? await this.deps.check(record, secret) : record.kind === "claude-subscription" ? await checkSubscriptionAccount(secret, path.join(this.home, "tmp", "account-check"), this.now) : await checkApiAccount(record, secret, this.now);
651
+ let check;
652
+ if (record.kind === "codex-chatgpt") {
653
+ if (this.summary(accountId).status === "missing-secret") return this.summary(accountId);
654
+ const codexHome = store.accountCodexHomePath(this.home, accountId);
655
+ codexAccount.syncCodexOverlay(codexHome, codexAccount.baseCodexHome(this.env), this.now());
656
+ check = this.deps.check ? await this.deps.check(record, "") : await checkCodexChatgptAccount(codexHome, this.env, this.deps.spawnCodexRpc ?? spawnCodexRpc, this.now);
657
+ } else {
658
+ const secret = this.readSecretFor(accountId, record);
659
+ if (!secret) return this.summary(accountId);
660
+ check = this.deps.check ? await this.deps.check(record, secret) : record.kind === "claude-subscription" ? await checkSubscriptionAccount(secret, path.join(this.home, "tmp", "account-check"), this.now) : record.kind === "codex-provider" ? await this.checkCodexProvider(record, secret) : await checkApiAccount(record, secret, this.now);
661
+ }
410
662
  if (!record.legacy) {
411
663
  const file = store.readAccountsFileV2(this.home);
412
664
  if (file.accounts[accountId]) {
@@ -418,6 +670,17 @@ class AccountService {
418
670
  }
419
671
  return { ...this.summary(accountId), status: check.status, checkedAt: check.at, ...check.detail ? { statusDetail: check.detail } : {} };
420
672
  }
673
+ async checkCodexProvider(record, secret) {
674
+ const base = record.provider ? codexAccount.readCodexProviders(this.env).find((p) => p.id === record.provider) : void 0;
675
+ const baseUrl = record.baseUrl ?? base?.baseUrl;
676
+ if (!baseUrl) return { status: "unverified", at: this.now(), detail: `provider "${record.provider}" is not in the machine's Codex config.toml` };
677
+ const headers = {};
678
+ const raw = base?.table.http_headers;
679
+ if (raw && typeof raw === "object") {
680
+ for (const [k, v] of Object.entries(raw)) if (typeof v === "string") headers[k] = v;
681
+ }
682
+ return checkCodexProviderAccount(baseUrl, secret, headers, this.now);
683
+ }
421
684
  // ---- remote login (claude setup-token) -------------------------------------
422
685
  loginManager() {
423
686
  if (this.logins) return this.logins;
@@ -459,6 +722,7 @@ class AccountService {
459
722
  async loginStart(params) {
460
723
  const parsed = index.AgentProfileLoginStartRequestSchema.safeParse(params);
461
724
  if (!parsed.success) throw new AccountError("invalid-params", parsed.error.issues[0]?.message ?? "invalid params");
725
+ if (parsed.data.agent === "codex") return this.codexLoginStart(parsed.data.accountId, parsed.data.label);
462
726
  const { accountId, label } = parsed.data;
463
727
  if (accountId) {
464
728
  const record = store.readAccounts(this.home).accounts[accountId];
@@ -474,10 +738,84 @@ class AccountService {
474
738
  throw new AccountError(code, error instanceof Error ? error.message : String(error));
475
739
  }
476
740
  this.loginTargets.set(status.loginId, { accountId, label });
741
+ return { ...status, flow: "paste-code" };
742
+ }
743
+ // ---- remote login (Codex ChatGPT device code) — B-850b ----------------------
744
+ codexLoginManager() {
745
+ if (this.codexLogins) return this.codexLogins;
746
+ this.codexLogins = new CodexDeviceLoginManager({
747
+ spawnRpc: this.deps.spawnCodexRpc ?? spawnCodexRpc,
748
+ env: this.env,
749
+ newId: () => node_crypto.randomUUID(),
750
+ now: this.now,
751
+ onSuccess: async (loginId, info) => {
752
+ const target = this.codexLoginTargets.get(loginId);
753
+ this.codexLoginTargets.delete(loginId);
754
+ if (!target) throw new AccountError("internal", "sign-in target lost");
755
+ return this.storeChatgptAccount(target, info);
756
+ },
757
+ onEnd: (loginId, state) => {
758
+ const target = this.codexLoginTargets.get(loginId);
759
+ if (state === "succeeded" || !target) return;
760
+ this.codexLoginTargets.delete(loginId);
761
+ if (target.isNew) store.removeAccountSecret(this.home, target.accountId);
762
+ }
763
+ });
764
+ return this.codexLogins;
765
+ }
766
+ /** loginId → the account a Codex sign-in writes. */
767
+ codexLoginTargets = /* @__PURE__ */ new Map();
768
+ async codexLoginStart(accountId, label) {
769
+ const accounts = store.readAccounts(this.home).accounts;
770
+ let target;
771
+ if (accountId) {
772
+ const record = accounts[accountId];
773
+ if (!record || record.kind !== "codex-chatgpt") throw new AccountError("not-found", `no ChatGPT account "${accountId}"`);
774
+ target = { accountId, isNew: false };
775
+ } else {
776
+ const taken = [...Object.keys(accounts), ...[...this.codexLoginTargets.values()].map((t) => t.accountId)];
777
+ target = { accountId: store.newAccountId(label ?? "", "codex-chatgpt", taken), ...label ? { label } : {}, isNew: true };
778
+ }
779
+ const manager = this.codexLoginManager();
780
+ const busy = manager.activeLoginId();
781
+ if (busy) throw new AccountError("login-busy", "another Codex sign-in is in progress");
782
+ const codexHome = store.accountCodexHomePath(this.home, target.accountId);
783
+ codexAccount.syncCodexOverlay(codexHome, codexAccount.baseCodexHome(this.env), this.now());
784
+ const status = await manager.start(codexHome);
785
+ if (status.state === "failed" || status.state === "canceled" || status.state === "expired") {
786
+ if (target.isNew) store.removeAccountSecret(this.home, target.accountId);
787
+ return status;
788
+ }
789
+ this.codexLoginTargets.set(status.loginId, target);
477
790
  return status;
478
791
  }
479
- loginOp(fn) {
792
+ /** A finished ChatGPT sign-in → the account record (new) or its refreshed status (re-login). */
793
+ storeChatgptAccount(target, info) {
794
+ const file = store.readAccountsFileV2(this.home);
795
+ const now = this.now();
796
+ const existing = file.accounts[target.accountId];
797
+ if (existing && existing.kind === "codex-chatgpt") {
798
+ existing.check = { status: "ok", at: now };
799
+ if (info.email) existing.email = info.email;
800
+ if (info.planType) existing.planType = info.planType;
801
+ } else {
802
+ file.accounts[target.accountId] = {
803
+ label: target.label?.trim() || info.email || "ChatGPT",
804
+ agent: "codex",
805
+ kind: "codex-chatgpt",
806
+ createdAt: now,
807
+ check: { status: "ok", at: now },
808
+ ...info.email ? { email: info.email } : {},
809
+ ...info.planType ? { planType: info.planType } : {}
810
+ };
811
+ }
812
+ store.writeAccountsFile(this.home, file);
813
+ this.changed();
814
+ return this.summary(target.accountId);
815
+ }
816
+ loginOp(fn, loginId, codex) {
480
817
  try {
818
+ if (codex && typeof loginId === "string" && this.codexLogins?.has(loginId)) return codex(this.codexLogins);
481
819
  return fn(this.loginManager());
482
820
  } catch (error) {
483
821
  const code = error.code ?? "internal";
@@ -487,20 +825,26 @@ class AccountService {
487
825
  loginSubmit(params) {
488
826
  const parsed = index.AgentProfileLoginSubmitRequestSchema.safeParse(params);
489
827
  if (!parsed.success) throw new AccountError("invalid-params", "loginId and code are required");
828
+ if (this.codexLogins?.has(parsed.data.loginId)) throw new AccountError("invalid-params", "a Codex device-code sign-in has nothing to submit: enter the code on the sign-in page");
490
829
  return this.loginOp((m) => m.submit(parsed.data.loginId, parsed.data.code));
491
830
  }
492
831
  loginStatus(loginId) {
493
832
  if (typeof loginId !== "string") throw new AccountError("invalid-params", "loginId is required");
494
- return this.loginOp((m) => m.status(loginId));
833
+ return this.loginOp((m) => m.status(loginId), loginId, (m) => m.status(loginId));
495
834
  }
496
835
  loginCancel(loginId) {
497
836
  if (typeof loginId !== "string") throw new AccountError("invalid-params", "loginId is required");
498
- const status = this.loginOp((m) => m.cancel(loginId));
837
+ const status = this.loginOp((m) => m.cancel(loginId), loginId, (m) => m.cancel(loginId));
499
838
  this.loginTargets.delete(loginId);
500
839
  return status;
501
840
  }
502
841
  dispose() {
503
842
  this.logins?.dispose();
843
+ this.codexLogins?.dispose();
844
+ }
845
+ /** B-850d2: waits until finished Codex sign-ins are cleaned up (their app-server gone, a canceled new account's overlay removed). */
846
+ settleLogins() {
847
+ return this.codexLogins?.settle() ?? Promise.resolve();
504
848
  }
505
849
  // ---- sessions --------------------------------------------------------------
506
850
  /** Validates and writes a session binding (no restart). */
@@ -508,8 +852,10 @@ class AccountService {
508
852
  if (accountId !== null) {
509
853
  const record = store.readAccounts(this.home).accounts[accountId];
510
854
  if (!record) throw new AccountError("not-found", `no account "${accountId}"`);
855
+ const agent = this.deps.sessionAgent?.(sessionId);
856
+ if (agent && agent !== record.agent) throw new AccountError("invalid-params", `"${accountId}" is a ${record.agent} account; this session runs ${agent}`);
511
857
  if (model !== void 0) {
512
- if (record.kind !== "claude-api") throw new AccountError("invalid-params", "model applies to API accounts only");
858
+ if (record.kind === "claude-subscription") throw new AccountError("invalid-params", "model applies to API and Codex accounts only");
513
859
  if (record.models && record.models.length > 0 && !record.models.includes(model)) {
514
860
  throw new AccountError("invalid-params", `model "${model}" is not in ${accountId}'s models (${record.models.join(", ")})`);
515
861
  }
@@ -541,6 +887,10 @@ class AccountService {
541
887
  if (outcome.notRunning) return { bound: true, restart: "skipped", error: outcome.error };
542
888
  return { bound: true, restart: "failed", error: outcome.error };
543
889
  }
890
+ /** B-850d: the account a session is bound to (null = machine login, also when unbound). */
891
+ sessionAccount(sessionId) {
892
+ return store.readSessionBindings(this.home)[sessionId]?.account ?? null;
893
+ }
544
894
  /**
545
895
  * Spawn-time choice → the account a NEW session starts on.
546
896
  * undefined → the machine default for this agent (none = machine login)
@@ -2,7 +2,7 @@
2
2
 
3
3
  var node_fs = require('node:fs');
4
4
  var path = require('node:path');
5
- var configuration = require('./configuration-CXEVKAyF.cjs');
5
+ var configuration = require('./configuration-BBK0rmmj.cjs');
6
6
 
7
7
  const SESSION_MODE_DIR = "session-modes";
8
8
  const ACP_PERMISSION_MODES = ["default", "acceptEdits", "plan", "bypassPermissions"];
@@ -1,6 +1,6 @@
1
1
  import { mkdirSync, renameSync, existsSync, unlinkSync } from 'node:fs';
2
2
  import { join } from 'node:path';
3
- import { w as writePrivateFileSync, c as configuration } from './configuration-IhRiLDVe.mjs';
3
+ import { w as writePrivateFileSync, c as configuration } from './configuration-ThKBP_zY.mjs';
4
4
 
5
5
  const SESSION_MODE_DIR = "session-modes";
6
6
  const ACP_PERMISSION_MODES = ["default", "acceptEdits", "plan", "bypassPermissions"];
@@ -1,13 +1,13 @@
1
1
  import chalk from 'chalk';
2
2
  import { homedir } from 'node:os';
3
- import { r as readSettings, u as updateSettings } from './persistence-DWcHe035.mjs';
3
+ import { r as readSettings, u as updateSettings } from './persistence-Cg4sfjQV.mjs';
4
4
  import 'node:fs';
5
- import './logger-Fd_rNvgd.mjs';
5
+ import './logger-JV7-4Q_6.mjs';
6
6
  import { d as describeAgentHome, p as probeLoginShellEnv, r as resolveAgentHomes, e as expandHomePath, A as AGENT_HOME_ENV_NAMES } from './loginShellEnv-Dw8M7tkI.mjs';
7
7
  import 'node:fs/promises';
8
- import './configuration-IhRiLDVe.mjs';
8
+ import './configuration-ThKBP_zY.mjs';
9
9
  import 'node:path';
10
- import './package-6KkRAops.mjs';
10
+ import './package-Bw3H6VLn.mjs';
11
11
  import 'zod';
12
12
  import './authRelay-DhQhkBvX.mjs';
13
13
  import 'node:crypto';
@@ -2,14 +2,14 @@
2
2
 
3
3
  var chalk = require('chalk');
4
4
  var os = require('node:os');
5
- var persistence = require('./persistence-B4ttN-fR.cjs');
5
+ var persistence = require('./persistence-CsmAgN-C.cjs');
6
6
  require('node:fs');
7
- require('./logger-8su64lqR.cjs');
7
+ require('./logger-CX3x2eI4.cjs');
8
8
  var loginShellEnv = require('./loginShellEnv-BkuYtExZ.cjs');
9
9
  require('node:fs/promises');
10
- require('./configuration-CXEVKAyF.cjs');
10
+ require('./configuration-BBK0rmmj.cjs');
11
11
  require('node:path');
12
- require('./package-iuLlSiSF.cjs');
12
+ require('./package-uzlvxa5S.cjs');
13
13
  require('zod');
14
14
  require('./authRelay-Dy1qU9td.cjs');
15
15
  require('node:crypto');
@@ -1,22 +1,22 @@
1
1
  'use strict';
2
2
 
3
3
  var axios = require('axios');
4
- var logger = require('./logger-8su64lqR.cjs');
5
- var lidState = require('./lidState-DqoN7zH4.cjs');
4
+ var logger = require('./logger-CX3x2eI4.cjs');
5
+ var lidState = require('./lidState-B_v6qgfE.cjs');
6
6
  var node_events = require('node:events');
7
7
  var socket_ioClient = require('socket.io-client');
8
- var pushNotifications = require('./pushNotifications-BqFoLye2.cjs');
8
+ var pushNotifications = require('./pushNotifications-BCg7YAiu.cjs');
9
9
  var authRelay = require('./authRelay-Dy1qU9td.cjs');
10
10
  var limits = require('./limits-C-a7gr04.cjs');
11
- var time = require('./time-CaUlWSNJ.cjs');
12
- var configuration = require('./configuration-CXEVKAyF.cjs');
11
+ var time = require('./time-BTLcO8jp.cjs');
12
+ var configuration = require('./configuration-BBK0rmmj.cjs');
13
13
  var node_crypto = require('node:crypto');
14
- var index = require('./index-BzAYnYct.cjs');
15
- var registerCommonHandlers = require('./registerCommonHandlers-m6pxxf2J.cjs');
14
+ var index = require('./index-BUFrKZeQ.cjs');
15
+ var registerCommonHandlers = require('./registerCommonHandlers-CZGmrPbT.cjs');
16
16
  var cuid2 = require('@paralleldrive/cuid2');
17
- var sync = require('./sync-_2lsZ1U2.cjs');
17
+ var sync = require('./sync-WYBwkJvG.cjs');
18
18
  var backgroundTaskActivity = require('./backgroundTaskActivity-CBvUdj39.cjs');
19
- var controlClient = require('./controlClient-j7p5p3_7.cjs');
19
+ var controlClient = require('./controlClient-DwWTns3A.cjs');
20
20
  var chalk = require('chalk');
21
21
 
22
22
  async function hmac_sha512(key, data) {
@@ -3075,7 +3075,7 @@ class ApiClient {
3075
3075
  return new ApiSessionClient(this.credential.token, session, opts);
3076
3076
  }
3077
3077
  async machineSyncClient(machine) {
3078
- const { ApiMachineClient } = await Promise.resolve().then(function () { return require('./apiMachine-CqW2m6Zr.cjs'); });
3078
+ const { ApiMachineClient } = await Promise.resolve().then(function () { return require('./apiMachine-BqtG0IWm.cjs'); });
3079
3079
  return new ApiMachineClient(this.credential.token, machine);
3080
3080
  }
3081
3081
  push() {
@@ -1,20 +1,20 @@
1
1
  import axios from 'axios';
2
- import { l as logger, r as redactLogValue } from './logger-Fd_rNvgd.mjs';
3
- import { R as RpcHandlerManager, a as answerSocketRequest, c as connectGuarded, s as socketConnectGuard, d as describeSocketAckDrop, b as safeAck, i as isRateQuotaCode, p as pauseForRateQuota, e as shouldReconnect } from './lidState-CZOXXdzv.mjs';
2
+ import { l as logger, r as redactLogValue } from './logger-JV7-4Q_6.mjs';
3
+ import { R as RpcHandlerManager, a as answerSocketRequest, c as connectGuarded, s as socketConnectGuard, d as describeSocketAckDrop, b as safeAck, i as isRateQuotaCode, p as pauseForRateQuota, e as shouldReconnect } from './lidState-B6yYKjNK.mjs';
4
4
  import { EventEmitter } from 'node:events';
5
5
  import { io } from 'socket.io-client';
6
- import { A as AsyncLock, a as MAX_CHAT_ATTACHMENT_ENCRYPTED_BYTES, U as UserMessageSchema, F as FileEventMessageSchema, P as PushNotificationClient } from './pushNotifications-DkQ0yvFs.mjs';
6
+ import { A as AsyncLock, a as MAX_CHAT_ATTACHMENT_ENCRYPTED_BYTES, U as UserMessageSchema, F as FileEventMessageSchema, P as PushNotificationClient } from './pushNotifications-BbE-qV9I.mjs';
7
7
  import { h as decrypt, d as decodeBase64, i as decryptBlob, e as encodeBase64, g as encrypt, l as libsodiumEncryptForPublicKey, j as libsodiumPublicKeyFromSecretKey, k as getRandomBytes } from './authRelay-DhQhkBvX.mjs';
8
8
  import { p as prepareClipboardText, d as prepareClipboardHistoryText } from './limits-DIo7rEBR.mjs';
9
- import { b as backoff, d as delay, e as exponentialBackoffDelay } from './time-bzmet4s5.mjs';
10
- import { c as configuration } from './configuration-IhRiLDVe.mjs';
9
+ import { b as backoff, d as delay, e as exponentialBackoffDelay } from './time-Cw0liIqB.mjs';
10
+ import { c as configuration } from './configuration-ThKBP_zY.mjs';
11
11
  import { createHmac, randomUUID } from 'node:crypto';
12
- import { k as createEnvelope, s as streamKeyOf, a0 as ReleaseDrainNoticeSchema, a1 as RelayAssignmentResponseSchema } from './index-DYD3GM1m.mjs';
13
- import { r as registerCommonHandlers } from './registerCommonHandlers-yQ7Ru-l0.mjs';
12
+ import { k as createEnvelope, s as streamKeyOf, a3 as ReleaseDrainNoticeSchema, a4 as RelayAssignmentResponseSchema } from './index-D1YnIih6.mjs';
13
+ import { r as registerCommonHandlers } from './registerCommonHandlers-Cj3Nl9y-.mjs';
14
14
  import { createId } from '@paralleldrive/cuid2';
15
- import { I as InvalidateSync } from './sync-JoEZKRo8.mjs';
15
+ import { I as InvalidateSync } from './sync-BP6vnxVP.mjs';
16
16
  import { B as BackgroundTaskReporter } from './backgroundTaskActivity-8PdPxrvy.mjs';
17
- import { q as notifyDaemonTurnEvent, t as notifyDaemonBackgroundTasks } from './controlClient-8ILulwjc.mjs';
17
+ import { q as notifyDaemonTurnEvent, t as notifyDaemonBackgroundTasks } from './controlClient-Ckl8N1MS.mjs';
18
18
  import chalk from 'chalk';
19
19
 
20
20
  async function hmac_sha512(key, data) {
@@ -3073,7 +3073,7 @@ class ApiClient {
3073
3073
  return new ApiSessionClient(this.credential.token, session, opts);
3074
3074
  }
3075
3075
  async machineSyncClient(machine) {
3076
- const { ApiMachineClient } = await import('./apiMachine-CgRldeJ6.mjs');
3076
+ const { ApiMachineClient } = await import('./apiMachine-CU_bw5nV.mjs');
3077
3077
  return new ApiMachineClient(this.credential.token, machine);
3078
3078
  }
3079
3079
  push() {