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,25 +1,26 @@
1
- import { i as isClaudeSessionId, g as extractCompleteLines, h as decideBackfill, j as parseTerminalHookPayload, k as decideMirrorBinding, M as MIRROR_BACKFILL_LINES_DEFAULT, m as mirrorLineKey, n as mirrorLocalId, o as initializeOwnedWorktree, e as summarizeSpawnSessionForLog, q as startAgentVersionChecks, W as WORKTREE_CAPABILITY_VERSION, t as currentWorktreeService } from './mirrorProtocol-Lcx20Oby.mjs';
1
+ import { i as isClaudeSessionId, g as extractCompleteLines, h as decideBackfill, j as parseTerminalHookPayload, k as decideMirrorBinding, M as MIRROR_BACKFILL_LINES_DEFAULT, m as mirrorLineKey, n as mirrorLocalId, o as initializeOwnedWorktree, e as summarizeSpawnSessionForLog, q as startAgentVersionChecks, W as WORKTREE_CAPABILITY_VERSION, t as currentWorktreeService } from './mirrorProtocol-CD4ntuZJ.mjs';
2
2
  import { F as FS_MKDIR_CAPABILITY_VERSION } from './fsMkdir-DumgLTzR.mjs';
3
- import { P as PI_ADAPTER_INSTALL_HINT, s as sanitizeSpawnModel } from './piRunnerArgs-Bqmu16He.mjs';
3
+ import { P as PI_ADAPTER_INSTALL_HINT, s as sanitizeSpawnModel } from './piRunnerArgs-BbaAQvb4.mjs';
4
4
  import fs from 'fs/promises';
5
5
  import os from 'os';
6
6
  import * as tmp from 'tmp';
7
7
  import axios from 'axios';
8
- import { readFileSync, openSync, fsyncSync, closeSync, renameSync, existsSync, readdirSync, statSync, unlinkSync, realpathSync, promises, constants as constants$1, writeFileSync, mkdirSync, accessSync, readSync, rmdirSync } from 'node:fs';
8
+ import { readFileSync, openSync, fsyncSync, closeSync, renameSync, existsSync, readdirSync, statSync, unlinkSync, readSync, writeSync, ftruncateSync, utimesSync, realpathSync, promises, constants as constants$1, writeFileSync, mkdirSync, accessSync, rmdirSync } from 'node:fs';
9
9
  import { join, isAbsolute, resolve, dirname, sep, basename, relative } from 'node:path';
10
- import { f as ensurePrivateDirectorySync, w as writePrivateFileSync, c as configuration } from './configuration-ECqXu34R.mjs';
11
- import { T as TurnActivityTracker, A as ApiClient } from './api-jfeMRg5R.mjs';
12
- import { S as SPAWN_AGENTS, i as isSpawnAgent, s as sanitizeSpawnPermissionMode, r as resolveSpawnPermissionMode, a as resolveFirstMessageMeta, j as joinProject } from './spawnAgents-CjoU6ZOS.mjs';
13
- import { l as logger } from './logger-GcbI0eg2.mjs';
14
- import { p as pruneStaleCompileCaches } from './index-BjZnpGWX.mjs';
15
- import { a as authAndSetupMachineIfNeeded } from './auth-DC6rg8lJ.mjs';
10
+ import { f as ensurePrivateDirectorySync, w as writePrivateFileSync, c as configuration } from './configuration-ThKBP_zY.mjs';
11
+ import { T as TurnActivityTracker, A as ApiClient } from './api-DUfunY3x.mjs';
12
+ import { S as SPAWN_AGENTS, i as isSpawnAgent, s as sanitizeSpawnPermissionMode, r as resolveSpawnPermissionMode, a as resolveFirstMessageMeta, j as joinProject } from './spawnAgents-I29H9nO8.mjs';
13
+ import { l as logger } from './logger-JV7-4Q_6.mjs';
14
+ import { p as pruneStaleCompileCaches } from './index-BbdV2mzy.mjs';
15
+ import { a as authAndSetupMachineIfNeeded } from './auth-jN5dNqTO.mjs';
16
16
  import { spawn, execSync } from 'child_process';
17
- import { p as packageJson } from './package-BsUHyqWe.mjs';
18
- import { a as globalPrefixForPackage, N as NPM_SAFE_ARG, g as getEnvironmentInfo } from './doctor-lsxmAK4o.mjs';
19
- import { s as spawnHappyCLI } from './spawnHappyCLI-CIA9Sc_5.mjs';
20
- import { c as readPersistedSessions, r as readSettings, l as latchKeepAwake, s as reportSignature, t as decideDaemonHibernation, v as nextCheckDelay, x as persistSession, d as readDaemonState, y as acquireDaemonLock, a as resolveCheckMs, z as resolveIdleMs, A as deletePersistedSessions, B as writeDaemonState, C as writeSettings, D as settingIdleMs, u as updateSettings, E as rewriteCredentialsForRelay, g as readCredentials, F as releaseDaemonLock } from './persistence-Cpw4yJs8.mjs';
21
- import { i as isDaemonRunningCurrentlyInstalledHappyVersion, s as stopDaemon, u as cleanupDaemonState } from './controlClient-ClI7A0qE.mjs';
22
- import { e as sendUserMessage, f as readSessionMetadata, r as readSessionTranscript, l as listAccountSessions, a as listSessions, M as MAX_READ_LIMIT, s as sessionWebUrl, j as lineageOf, g as waitForSessionKey, d as archiveSession, k as analyzeLatestTurn, m as readSessionLog, n as TURN_WINDOW, p as userPromptText } from './sessionOps-DPw5k8vV.mjs';
17
+ import { p as packageJson } from './package-Bw3H6VLn.mjs';
18
+ import { a as globalPrefixForPackage, N as NPM_SAFE_ARG, g as getEnvironmentInfo } from './doctor-C1zyOSXw.mjs';
19
+ import { s as spawnHappyCLI } from './spawnHappyCLI-CnMwzjWX.mjs';
20
+ import { c as readPersistedSessions, r as readSettings, l as latchKeepAwake, s as reportSignature, t as decideDaemonHibernation, v as nextCheckDelay, x as persistSession, d as readDaemonState, y as acquireDaemonLock, a as resolveCheckMs, z as resolveIdleMs, A as deletePersistedSessions, B as writeDaemonState, C as writeSettings, D as settingIdleMs, u as updateSettings, E as rewriteCredentialsForRelay, g as readCredentials, F as releaseDaemonLock } from './persistence-Cg4sfjQV.mjs';
21
+ import { i as isDaemonRunningCurrentlyInstalledHappyVersion, s as stopDaemon, w as cleanupDaemonState } from './controlClient-Ckl8N1MS.mjs';
22
+ import { e as sendUserMessage, f as readSessionMetadata, r as readSessionTranscript, l as listAccountSessions, a as listSessions, M as MAX_READ_LIMIT, s as sessionWebUrl, j as lineageOf, g as waitForSessionKey, d as archiveSession, k as analyzeLatestTurn, m as readSessionLog, n as TURN_WINDOW, p as userPromptText } from './sessionOps-C65Iej_C.mjs';
23
+ import { E as AgentProfilesStateSchema, a9 as ServerMigrateNoticeSchema, aa as isHarnessInstallId, ab as agentProfileUnavailableReason, ac as MODEL_INTENT_CONFIG, j as AUTOMATION_SUMMARY_MAX_CHARS, ad as AUTOMATION_PRECHECK_OUTPUT_MAX_CHARS, ae as AUTOMATION_PRECHECK_DEFAULT_TIMEOUT_MS, d as AUTOMATION_PRECHECK_MAX_TIMEOUT_MS, af as AUTOMATION_CLAIM_MAX_RUNS, ag as AUTOMATION_DAEMON_CAPABILITY_PRECHECK, ah as AUTOMATION_DEFAULT_LEASE_MS, i as isAutomationRunTerminal, v as resolveLaunchAgentProfile, ai as HARNESS_INSTALL_CAPABILITY_VERSION } from './index-D1YnIih6.mjs';
23
24
  import fastify from 'fastify';
24
25
  import { z } from 'zod';
25
26
  import { validatorCompiler, serializerCompiler } from 'fastify-type-provider-zod';
@@ -27,64 +28,70 @@ import { d as decodeBase64, s as sameRelay, e as encodeBase64, h as decrypt } fr
27
28
  import { randomBytes, createHash, timingSafeEqual, randomUUID } from 'node:crypto';
28
29
  import { c as checkPreviewPath } from './previewPath-CXN4Vag0.mjs';
29
30
  import { a as BACKGROUND_TASKS_MAX, d as BACKGROUND_TASK_DESCRIPTION_MAX, e as BackgroundTaskTracker } from './backgroundTaskActivity-8PdPxrvy.mjs';
30
- import { b as sanitizeRateLimitReport } from './rateLimitWindows-j_qQk0KY.mjs';
31
- import { f as formatEditConflictNotice, b as SESSION_PEER_SENT_FROM, s as sendPeerMessage, l as listPeerSessions, C as CLI_PEER_SENDER_ID } from './peerTools-CwCe6tmJ.mjs';
31
+ import { b as sanitizeRateLimitReport } from './rateLimitWindows-CRARnKaI.mjs';
32
+ import { f as formatEditConflictNotice, b as SESSION_PEER_SENT_FROM, s as sendPeerMessage, l as listPeerSessions, C as CLI_PEER_SENDER_ID } from './peerTools-WtRgTSqG.mjs';
32
33
  import os$1, { hostname, homedir, tmpdir } from 'node:os';
33
- import { c as RemoteCallBudget, e as REMOTE_WRITE_CALLS_PER_MINUTE, d as deliverToSession, g as guardRemoteSessionOpsRequest, h as remoteError, i as REMOTE_OP_DEADLINE_MS, j as formatRemoteAuditLine, k as REMOTE_SEND_COMMIT_DEADLINE_MS, m as REMOTE_RESUME_WAIT_MS, n as capRemoteTranscript, o as capRemoteText, p as REMOTE_ANSWER_MAX_BYTES, q as REMOTE_TITLE_MAX_BYTES } from './remoteSessionClient-BdnJ_n8C.mjs';
34
- import { assistantHome, bootstrapAssistantHome } from './bootstrap-rLaL3kTa.mjs';
35
- import { refreshAgentHomes, locateClaudeConversation, agentHomeSpawnEnv } from './index-DuK9XYbZ.mjs';
34
+ import { c as RemoteCallBudget, e as REMOTE_WRITE_CALLS_PER_MINUTE, d as deliverToSession, g as guardRemoteSessionOpsRequest, h as remoteError, i as REMOTE_OP_DEADLINE_MS, j as formatRemoteAuditLine, k as REMOTE_SEND_COMMIT_DEADLINE_MS, m as REMOTE_RESUME_WAIT_MS, n as capRemoteTranscript, o as capRemoteText, p as REMOTE_ANSWER_MAX_BYTES, q as REMOTE_TITLE_MAX_BYTES } from './remoteSessionClient--0vfA7I5.mjs';
35
+ import { assistantHome, bootstrapAssistantHome } from './bootstrap-B3gMpU9e.mjs';
36
+ import { refreshAgentHomes, locateClaudeConversation, agentHomeSpawnEnv } from './index-Cn73rdtQ.mjs';
36
37
  import require$$0, { existsSync as existsSync$1, statSync as statSync$1, mkdtempSync, rmSync } from 'fs';
37
38
  import require$$1, { join as join$1 } from 'path';
38
39
  import { spawn as spawn$1, execFile, spawnSync } from 'node:child_process';
39
40
  import { p as projectPath } from './projectPath-BTBIMB57.mjs';
40
41
  import { d as daemonEndpointsMatch, r as resolveClaudeCredentialReadiness } from './doctorReadiness-C208SMN9.mjs';
41
- import { o as ownerRetryPending, c as consumeOwnerRetry, s as spawnGate, a as afterStartupFailure, b as startupFailureMessage, T as TEAM_SPAWN_MAX_ATTEMPTS, d as TEAM_CLEANUP_RETRY_MS, g as getInitialMachineMetadata, e as getStartupCliAvailability, f as TEAM_RETRY_CAPABILITY_VERSION, w as withRunningCliFacts } from './machineMetadata-CXRmFNOV.mjs';
42
+ import { o as ownerRetryPending, c as consumeOwnerRetry, s as spawnGate, a as afterStartupFailure, b as startupFailureMessage, T as TEAM_SPAWN_MAX_ATTEMPTS, d as TEAM_CLEANUP_RETRY_MS, g as getInitialMachineMetadata, e as getStartupCliAvailability, f as TEAM_RETRY_CAPABILITY_VERSION, w as withRunningCliFacts } from './machineMetadata-D5-SW9kv.mjs';
42
43
  import { M as ModelConfigError, B as BackupStore, r as readConfigFile, s as sha256, a as atomicWriteFile } from './fileStore-5qpetZS0.mjs';
43
44
  import { c as collectSecretValues, a as parseJsonObject, b as childObject, s as setOrDelete, d as changedPaths, e as stringifyLike, f as fail, n as normalizeModelList, g as normalizeModelId, h as normalizeSecret, i as normalizeBaseUrl, u as uniq, j as baseUrlWarnings, m as maskSecret, k as getPath$1, l as normalizeProviderId, o as piAdapter, r as redactText } from './pi-CqyoZMjI.mjs';
45
+ import { p as parse } from './codexAccount-NOX5pmQf.mjs';
44
46
  import require$$3 from 'crypto';
45
47
  import { c as commandOnPath } from './detectCLI-CSGMlV51.mjs';
46
- import { buildResumeLaunch } from './handleResumeCommand-BK9XKH_l.mjs';
48
+ import { buildResumeLaunch } from './handleResumeCommand-CrlqDuz7.mjs';
47
49
  import { n as normalizeWebPanels } from './webPanels-B2_C2-3g.mjs';
48
- import { $ as ServerMigrateNoticeSchema, a0 as isHarnessInstallId, a1 as MODEL_INTENT_CONFIG, f as AUTOMATION_SUMMARY_MAX_CHARS, a2 as AUTOMATION_PRECHECK_OUTPUT_MAX_CHARS, a3 as AUTOMATION_PRECHECK_DEFAULT_TIMEOUT_MS, c as AUTOMATION_PRECHECK_MAX_TIMEOUT_MS, a4 as AUTOMATION_CLAIM_MAX_RUNS, a5 as AUTOMATION_DAEMON_CAPABILITY_PRECHECK, a6 as AUTOMATION_DEFAULT_LEASE_MS, i as isAutomationRunTerminal, a7 as HARNESS_INSTALL_CAPABILITY_VERSION } from './index-Bq8NKSCF.mjs';
49
50
  import { access, symlink, readFile, rm, unlink, readlink, lstat, constants, rename, mkdir, copyFile, readdir, stat, open } from 'node:fs/promises';
50
51
  import { p as parseExactVersion, c as compareExactVersions, f as fetchCliUpdateState, r as resolveCliUpdateCheckInterval, D as DEFAULT_CLI_UPDATE_CHECK_INTERVAL_MS } from './cliUpdate-Y34VGe9Y.mjs';
51
- import { P as ProjectsUnsupportedError, c as createProjectsClient } from './client-Bi20Ka0h.mjs';
52
- import { d as wrapperReportsIdle, f as decideAutoRestart, s as statusFromVerdict, g as autoRestartNextCheck, h as wrapperStaleness, r as recordAttempt, i as AUTO_RESTART_MAX_ATTEMPTS, j as AUTO_RESTART_MIN_GAP_MS, p as processIdentityFields, k as readSessionLock, l as terminateProcess, n as terminateProcessTree, o as AUTO_RESTARTED_ENV, q as encodeAutoRestarted, u as resolveQuietMs, v as AUTO_RESTART_RECHECK_CAP_MS } from './sessionLock-G2PMqvsh.mjs';
53
- import { c as createAutomationsClient, i as isAutomationsUnavailable, d as AutomationsRequestError } from './client-BXD66ZF5.mjs';
52
+ import { P as ProjectsUnsupportedError, c as createProjectsClient } from './client-Bde4QVIn.mjs';
53
+ import { d as wrapperReportsIdle, f as decideAutoRestart, s as statusFromVerdict, g as autoRestartNextCheck, h as wrapperStaleness, r as recordAttempt, i as AUTO_RESTART_MAX_ATTEMPTS, j as AUTO_RESTART_MIN_GAP_MS, p as processIdentityFields, k as readSessionLock, l as terminateProcess, n as terminateProcessTree, o as AUTO_RESTARTED_ENV, q as encodeAutoRestarted, u as pendingUpgradeVersion, v as resolveQuietMs, x as AUTO_RESTART_RECHECK_CAP_MS } from './sessionLock-B73fhgQN.mjs';
54
+ import { c as createAutomationsClient, i as isAutomationsUnavailable, d as AutomationsRequestError } from './client-7RnI9J0W.mjs';
54
55
  import { w as withKeychainOffPath, a as keychainIdentityFor, i as interpretSecurityRead, s as securityReadArgs, b as securityDeleteArgs, c as keychainOffShimDir, d as interpretCredentialsFile, C as CREDENTIALS_REJECTED_DETAIL, e as buildClaudeAuthState, f as claudeAuthStateChanged, r as resolveSdkClaudeBinary, g as classifyAuthStatus, h as diagnoseStores, p as parseLaunchctlPid, H as HAPPY_DAEMON_LAUNCHD_LABEL, j as classifyLineage, l as probeLaunchdJob, m as detectDaemonSupervisor, n as daemonLineage, o as probeSystemdKillMode, q as wrappersSurviveHandover, t as handoverWaitsForSessions } from './daemonSupervisor-BxohggqN.mjs';
56
+ import { A as AccountService } from './accountService-Cd7bnkfd.mjs';
57
+ import { spawnSetupTokenPty, watchAccountFiles } from './daemonAccounts-DwPwKxvv.mjs';
55
58
  import { g as getProjectPath } from './path-D2wdaNSk.mjs';
56
59
  import { b as extractClaudeEditPaths } from './editPaths-BVfS_FFL.mjs';
57
- import { s as startFileWatcher } from './startFileWatcher-CDO6fb2m.mjs';
58
- import { I as InvalidateSync } from './sync-C0PRuTMj.mjs';
60
+ import { s as startFileWatcher } from './startFileWatcher-DePAY1T5.mjs';
61
+ import { I as InvalidateSync } from './sync-BP6vnxVP.mjs';
59
62
  import { R as RawJSONLinesSchema } from './types-CkqAACXx.mjs';
60
63
  import { t as tmuxArgs, a as scrubTmuxClientEnv, s as shellescape } from './tmuxSocket-B8Yx20sT.mjs';
61
64
  import { findAllHappyProcesses } from './doctor-BPkYWSuq.mjs';
62
65
  import { T as TEAM_SKILL, a as TEAM_LEAD_PLAYBOOK, b as TEAM_MEMBER_RULES } from './resources-CLP_MpK4.mjs';
63
66
  import { promisify } from 'node:util';
64
- import { b as clipText, r as renderAction, c as clipAutomationReport, e as renderTemplate } from './template-DLR_0hfj.mjs';
67
+ import { b as clipText, r as renderAction, c as clipAutomationReport, e as renderTemplate } from './template-CL9EvQLQ.mjs';
65
68
  import { d as describeAgentHome } from './loginShellEnv-Dw8M7tkI.mjs';
66
- import './acpSessionResume-Bi7pA1n_.mjs';
67
- import './lidState-CD81ryTy.mjs';
69
+ import { S as SPAWN_ACCOUNT_ENV } from './store-Vej_738f.mjs';
70
+ import './acpSessionResume-TQwN9ZZE.mjs';
71
+ import './lidState-B6yYKjNK.mjs';
68
72
  import 'node:events';
69
73
  import 'socket.io-client';
70
- import './pushNotifications-XAM8__Pg.mjs';
74
+ import './pushNotifications-BbE-qV9I.mjs';
71
75
  import './contentLogMetadata-BlWI0egu.mjs';
72
76
  import './limits-DIo7rEBR.mjs';
73
- import './time-D0jvDRhn.mjs';
74
- import './registerCommonHandlers-DRRfinzK.mjs';
77
+ import './time-Cw0liIqB.mjs';
78
+ import './registerCommonHandlers-Cj3Nl9y-.mjs';
75
79
  import 'util';
76
80
  import 'cross-spawn';
77
81
  import '@paralleldrive/cuid2';
78
82
  import 'chalk';
79
83
  import 'node:module';
80
84
  import 'tweetnacl';
81
- import './browser-CHpVgyni.mjs';
85
+ import './browser-LHW2hBH8.mjs';
82
86
  import 'open';
83
87
  import './specialCommands-MXUN0wfI.mjs';
84
88
  import './ids-DU6sLx4C.mjs';
85
89
  import 'url';
86
- import './localHappyAgentAuth-Cg-m1lwm.mjs';
90
+ import './localHappyAgentAuth-KRlg_aI0.mjs';
87
91
  import './processTreeSnapshot-CuLJDNC-.mjs';
92
+ import './claudeAccountEnv-BL1pR_37.mjs';
93
+ import 'node:readline';
94
+ import 'node-pty';
88
95
  import 'ps-list';
89
96
 
90
97
  async function resolveRelaunchMetadata(snapshot, fetchServer) {
@@ -180,8 +187,34 @@ async function teamRelaunchEnv(input) {
180
187
  const DEFAULT_LOG_PRUNE_POLICY = {
181
188
  maxAgeMs: 14 * 24 * 60 * 6e4,
182
189
  maxTotalBytes: 200 * 1024 * 1024,
183
- keepRecentCount: 10
190
+ keepRecentCount: 10,
191
+ keepDaemonLogs: 3,
192
+ maxDaemonLogBytes: 64 * 1024 * 1024
184
193
  };
194
+ const DAEMON_LOG_SUFFIX = "-daemon.log";
195
+ function planDaemonLogRetention(files, policy = DEFAULT_LOG_PRUNE_POLICY, protectedPaths = /* @__PURE__ */ new Set()) {
196
+ const keep = /* @__PURE__ */ new Set();
197
+ let trim = null;
198
+ const count = policy.keepDaemonLogs ?? 0;
199
+ let budget = policy.maxDaemonLogBytes ?? 0;
200
+ if (count <= 0 || budget <= 0) return { keep, trim };
201
+ const daemonLogs = files.filter((f) => f.path.endsWith(DAEMON_LOG_SUFFIX) && !protectedPaths.has(f.path)).sort((a, b) => b.mtimeMs - a.mtimeMs);
202
+ for (const f of daemonLogs) {
203
+ if (keep.size >= count || budget <= 0) break;
204
+ if (keep.size === 0) {
205
+ keep.add(f.path);
206
+ if (f.size > budget) {
207
+ trim = { path: f.path, keepBytes: budget };
208
+ budget = 0;
209
+ } else budget -= f.size;
210
+ continue;
211
+ }
212
+ if (f.size > budget) break;
213
+ keep.add(f.path);
214
+ budget -= f.size;
215
+ }
216
+ return { keep, trim };
217
+ }
185
218
  function planLogPrune(files, now, policy = DEFAULT_LOG_PRUNE_POLICY, protectedPaths = /* @__PURE__ */ new Set()) {
186
219
  const sorted = [...files].sort((a, b) => b.mtimeMs - a.mtimeMs);
187
220
  const doomed = /* @__PURE__ */ new Set();
@@ -210,7 +243,9 @@ function pruneLogsDir(logsDir, protectedPaths = /* @__PURE__ */ new Set(), polic
210
243
  } catch {
211
244
  return 0;
212
245
  }
213
- const doomed = planLogPrune(files, Date.now(), policy, protectedPaths);
246
+ const daemonLogs = planDaemonLogRetention(files, policy, protectedPaths);
247
+ if (daemonLogs.trim) trimToTail(daemonLogs.trim.path, daemonLogs.trim.keepBytes);
248
+ const doomed = planLogPrune(files.filter((f) => !daemonLogs.keep.has(f.path)), Date.now(), policy, protectedPaths);
214
249
  let deleted = 0;
215
250
  for (const p of doomed) {
216
251
  try {
@@ -221,6 +256,36 @@ function pruneLogsDir(logsDir, protectedPaths = /* @__PURE__ */ new Set(), polic
221
256
  }
222
257
  return deleted;
223
258
  }
259
+ function trimToTail(path, keepBytes) {
260
+ let fd = null;
261
+ try {
262
+ const st = statSync(path);
263
+ if (st.size <= keepBytes) return;
264
+ const marker = Buffer.from(`[log trimmed to its last ${keepBytes} bytes by the daemon log retention]
265
+ `);
266
+ const tailBytes = Math.max(0, keepBytes - marker.length);
267
+ fd = openSync(path, "r+");
268
+ const tail = Buffer.alloc(tailBytes);
269
+ let read = 0;
270
+ while (read < tailBytes) {
271
+ const n = readSync(fd, tail, read, tailBytes - read, st.size - tailBytes + read);
272
+ if (n <= 0) break;
273
+ read += n;
274
+ }
275
+ writeSync(fd, marker, 0, marker.length, 0);
276
+ writeSync(fd, tail, 0, read, marker.length);
277
+ ftruncateSync(fd, marker.length + read);
278
+ closeSync(fd);
279
+ fd = null;
280
+ utimesSync(path, st.atime, st.mtime);
281
+ } catch {
282
+ } finally {
283
+ if (fd !== null) try {
284
+ closeSync(fd);
285
+ } catch {
286
+ }
287
+ }
288
+ }
224
289
 
225
290
  function createSpawnTimer(clock = Date.now) {
226
291
  const requestAt = clock();
@@ -506,6 +571,7 @@ function sanitizeResumeModel(value) {
506
571
  }
507
572
 
508
573
  const DEFAULT_MAX_RESTARTS = 3;
574
+ const DEFAULT_MAX_ACCOUNT_RESTARTS = 50;
509
575
  function decideRestart(priorAttempts, max = DEFAULT_MAX_RESTARTS) {
510
576
  if (priorAttempts >= max) {
511
577
  return {
@@ -562,6 +628,19 @@ const BackgroundTaskInfoSchema = z.object({
562
628
  description: z.string().max(BACKGROUND_TASK_DESCRIPTION_MAX + 1),
563
629
  startedAt: z.number()
564
630
  });
631
+ const AutoRestartStatusSchema = z.object({
632
+ state: z.string(),
633
+ reason: z.string().optional(),
634
+ since: z.number(),
635
+ target: z.string(),
636
+ offline: z.boolean().optional(),
637
+ retryAt: z.number().optional()
638
+ });
639
+ const DaemonListInfoSchema = z.object({
640
+ version: z.string(),
641
+ upgradePending: z.string().nullable(),
642
+ autoRestartEnabled: z.boolean()
643
+ });
565
644
  const BackgroundTasksReportSchema = z.object({
566
645
  count: z.number().int().nonnegative(),
567
646
  tasks: z.array(BackgroundTaskInfoSchema),
@@ -590,8 +669,11 @@ function startDaemonControlServer({
590
669
  onSessionEdit,
591
670
  listPeers,
592
671
  isTurnActive,
672
+ getAutoRestartStatus,
673
+ getDaemonInfo,
593
674
  onRateLimits,
594
- onHibernateCheck
675
+ onHibernateCheck,
676
+ getAgentProfiles
595
677
  }) {
596
678
  return new Promise((resolve) => {
597
679
  const app = fastify({
@@ -697,6 +779,16 @@ function startDaemonControlServer({
697
779
  }
698
780
  });
699
781
  }
782
+ typed.post("/agent-profiles", {
783
+ schema: { response: { 200: AgentProfilesStateSchema, 503: z.object({ error: z.string() }) } }
784
+ }, async (_request, reply) => {
785
+ const state = getAgentProfiles?.() ?? null;
786
+ if (!state) {
787
+ reply.code(503);
788
+ return { error: "accounts are not available in this daemon yet" };
789
+ }
790
+ return state;
791
+ });
700
792
  typed.post("/list", {
701
793
  schema: {
702
794
  response: {
@@ -707,8 +799,12 @@ function startDaemonControlServer({
707
799
  pid: z.number(),
708
800
  turnActive: z.boolean(),
709
801
  // B-507: in-flight background tasks per the wrapper's last report (lease-expired = count 0).
710
- backgroundTasks: BackgroundTasksReportSchema.optional()
711
- }))
802
+ backgroundTasks: BackgroundTasksReportSchema.optional(),
803
+ // B-856: the wrapper's own CLI version and its auto-restart status (null = nothing pending).
804
+ cliVersion: z.string().optional(),
805
+ autoRestart: AutoRestartStatusSchema.nullable().optional()
806
+ })),
807
+ daemon: DaemonListInfoSchema.optional()
712
808
  })
713
809
  }
714
810
  }
@@ -721,8 +817,11 @@ function startDaemonControlServer({
721
817
  happySessionId: child.happySessionId,
722
818
  pid: child.pid,
723
819
  turnActive: isTurnActive ? isTurnActive(child.happySessionId) : false,
724
- ...getBackgroundTasks ? { backgroundTasks: getBackgroundTasks(child.happySessionId) } : {}
725
- }))
820
+ ...getBackgroundTasks ? { backgroundTasks: getBackgroundTasks(child.happySessionId) } : {},
821
+ ...child.happySessionMetadataFromLocalWebhook?.version ? { cliVersion: child.happySessionMetadataFromLocalWebhook.version } : {},
822
+ ...getAutoRestartStatus ? { autoRestart: getAutoRestartStatus(child.happySessionId) ?? null } : {}
823
+ })),
824
+ ...getDaemonInfo ? { daemon: getDaemonInfo() } : {}
726
825
  };
727
826
  });
728
827
  typed.post("/stop-session", {
@@ -765,7 +864,9 @@ function startDaemonControlServer({
765
864
  // sends over the machine RPC. Old CLIs never send them.
766
865
  resumeClaudeSessionId: z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i).optional(),
767
866
  resumeCodexThreadId: z.string().min(1).max(200).optional(),
768
- parentSessionId: z.string().min(1).max(200).optional()
867
+ parentSessionId: z.string().min(1).max(200).optional(),
868
+ // B-850a: `very-happy spawn --account` (null = machine login; absent = machine default).
869
+ agentProfileId: z.string().min(1).max(64).nullable().optional()
769
870
  }),
770
871
  response: {
771
872
  200: z.object({
@@ -790,13 +891,13 @@ function startDaemonControlServer({
790
891
  }
791
892
  }
792
893
  }, async (request, reply) => {
793
- const { directory, sessionId, agent, environmentVariables, variant, forceNew, permissionMode, spawnedBy, resumeClaudeSessionId, resumeCodexThreadId, parentSessionId } = request.body;
894
+ const { directory, sessionId, agent, environmentVariables, variant, forceNew, permissionMode, spawnedBy, resumeClaudeSessionId, resumeCodexThreadId, parentSessionId, agentProfileId } = request.body;
794
895
  if (!directory && variant !== "assistant") {
795
896
  reply.code(500);
796
897
  return { success: false, error: "directory is required" };
797
898
  }
798
899
  logger.debug(`[CONTROL SERVER] Spawn session request: dir=${directory}, sessionId=${sessionId || "new"}, agent=${agent || "default"}, variant=${variant || "none"}, forceNew=${forceNew === true}, spawnedBy=${spawnedBy || "unset"}`);
799
- const result = await spawnSession({ directory, sessionId, agent, environmentVariables, variant, forceNew, permissionMode, spawnedBy, resumeClaudeSessionId, resumeCodexThreadId, parentSessionId });
900
+ const result = await spawnSession({ directory, sessionId, agent, environmentVariables, variant, forceNew, permissionMode, spawnedBy, resumeClaudeSessionId, resumeCodexThreadId, parentSessionId, ...agentProfileId !== void 0 ? { agentProfileId } : {} });
800
901
  const resumed = Boolean(resumeClaudeSessionId || resumeCodexThreadId);
801
902
  switch (result.type) {
802
903
  case "success":
@@ -887,7 +988,7 @@ function startDaemonControlServer({
887
988
  return { success: false, error: "daemon is still starting up" };
888
989
  }
889
990
  logger.debug(`[CONTROL SERVER] Restart session request: ${sessionId}`);
890
- const result = await restartSession(sessionId, { keepPublishedPermissionMode: true });
991
+ const result = await restartSession(sessionId, { keepPublishedPermissionMode: true, account: true });
891
992
  switch (result.type) {
892
993
  case "success":
893
994
  return { success: true, sessionId: result.sessionId };
@@ -2468,806 +2569,6 @@ const claudeAdapter = {
2468
2569
  }
2469
2570
  };
2470
2571
 
2471
- /*!
2472
- * Copyright (c) Squirrel Chat et al., All rights reserved.
2473
- * SPDX-License-Identifier: BSD-3-Clause
2474
- *
2475
- * Redistribution and use in source and binary forms, with or without
2476
- * modification, are permitted provided that the following conditions are met:
2477
- *
2478
- * 1. Redistributions of source code must retain the above copyright notice, this
2479
- * list of conditions and the following disclaimer.
2480
- * 2. Redistributions in binary form must reproduce the above copyright notice,
2481
- * this list of conditions and the following disclaimer in the
2482
- * documentation and/or other materials provided with the distribution.
2483
- * 3. Neither the name of the copyright holder nor the names of its contributors
2484
- * may be used to endorse or promote products derived from this software without
2485
- * specific prior written permission.
2486
- *
2487
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
2488
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2489
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
2490
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
2491
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2492
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2493
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2494
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2495
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2496
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2497
- */
2498
- function getLineColFromPtr(string, ptr) {
2499
- let lines = string.slice(0, ptr).split(/\r?\n/);
2500
- return [lines.length, lines.pop().length + 1];
2501
- }
2502
- function makeCodeBlock(string, line, column) {
2503
- let lines = string.split(/\r?\n/);
2504
- let codeblock = "";
2505
- let numberLen = (Math.log10(line + 1) | 0) + 1;
2506
- for (let i = line - 1; i <= line + 1; i++) {
2507
- let l = lines[i - 1];
2508
- if (!l)
2509
- continue;
2510
- codeblock += i.toString().padEnd(numberLen, " ");
2511
- codeblock += ": ";
2512
- codeblock += l;
2513
- codeblock += "\n";
2514
- if (i === line) {
2515
- codeblock += " ".repeat(numberLen + column + 2);
2516
- codeblock += "^\n";
2517
- }
2518
- }
2519
- return codeblock;
2520
- }
2521
- class TomlError extends Error {
2522
- line;
2523
- column;
2524
- codeblock;
2525
- constructor(message, options) {
2526
- const [line, column] = getLineColFromPtr(options.toml, options.ptr);
2527
- const codeblock = makeCodeBlock(options.toml, line, column);
2528
- super(`Invalid TOML document: ${message}
2529
-
2530
- ${codeblock}`, options);
2531
- this.line = line;
2532
- this.column = column;
2533
- this.codeblock = codeblock;
2534
- }
2535
- /** @internal */
2536
- static x(message, ctx, ptr) {
2537
- throw new TomlError(message, { toml: ctx.s, ptr: ptr ?? ctx.p });
2538
- }
2539
- }
2540
-
2541
- function parseString(ctx) {
2542
- let startPtr = ctx.p;
2543
- let c = ctx.s.charCodeAt(ctx.p++);
2544
- let first = c;
2545
- let isLiteral = c === 39;
2546
- let isMultiline = c === ctx.s.charCodeAt(ctx.p) && c === ctx.s.charCodeAt(ctx.p + 1);
2547
- if (isMultiline) {
2548
- if ((c = ctx.s.charCodeAt(ctx.p += 2)) === 10)
2549
- ctx.p++;
2550
- else if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)
2551
- ctx.p += 2;
2552
- }
2553
- let parsed = "";
2554
- let sliceStart = ctx.p;
2555
- let state = 0;
2556
- for (; ctx.p < ctx.s.length; ctx.p++) {
2557
- c = ctx.s.charCodeAt(ctx.p);
2558
- if (isMultiline && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) {
2559
- state = state && 3;
2560
- } else if (c < 32 && c !== 9 || c === 127) {
2561
- TomlError.x("control characters are not allowed in strings", ctx);
2562
- } else if ((!state || state === 3) && c === first && (!isMultiline || ctx.s.charCodeAt(ctx.p + 1) === first && ctx.s.charCodeAt(ctx.p + 2) === first)) {
2563
- if (isMultiline) {
2564
- if (ctx.s.charCodeAt(ctx.p + 3) === first)
2565
- ctx.p++;
2566
- if (ctx.s.charCodeAt(ctx.p + 3) === first)
2567
- ctx.p++;
2568
- }
2569
- if (!state) {
2570
- let s = ctx.s.slice(sliceStart, ctx.p);
2571
- parsed = parsed ? parsed + s : s;
2572
- }
2573
- ctx.p += isMultiline ? 3 : 1;
2574
- return parsed;
2575
- } else if (!state) {
2576
- if (!isLiteral && c === 92) {
2577
- parsed += ctx.s.slice(sliceStart, sliceStart = ctx.p);
2578
- state = 1;
2579
- }
2580
- } else if (state === 1) {
2581
- if (c === 120 || c === 117 || c === 85) {
2582
- let errPtr = ctx.p++ - 1;
2583
- let value = 0;
2584
- let len = c === 120 ? 2 : c === 117 ? 4 : 8;
2585
- for (let j = 0; j < len; j++, ctx.p++) {
2586
- let hex = ctx.s.charCodeAt(ctx.p);
2587
- let digit = (
2588
- /* 0-9 */
2589
- hex >= 48 && hex <= 57 ? hex - 48 : (
2590
- /* A-F */
2591
- hex >= 65 && hex <= 70 ? hex - 65 + 10 : (
2592
- /* a-f */
2593
- hex >= 97 && hex <= 102 ? hex - 97 + 10 : -1
2594
- )
2595
- )
2596
- );
2597
- if (digit < 0)
2598
- TomlError.x("invalid non-hex character in unicode escape", ctx);
2599
- value = value << 4 | digit;
2600
- }
2601
- if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) {
2602
- TomlError.x("invalid unicode escape", ctx, errPtr);
2603
- }
2604
- parsed += String.fromCodePoint(value);
2605
- sliceStart = ctx.p--;
2606
- state = 0;
2607
- } else if (isMultiline && (c === 32 || c === 9)) {
2608
- state = 2;
2609
- } else {
2610
- if (c === 98)
2611
- parsed += "\b";
2612
- else if (c === 116)
2613
- parsed += " ";
2614
- else if (c === 110)
2615
- parsed += "\n";
2616
- else if (c === 102)
2617
- parsed += "\f";
2618
- else if (c === 114)
2619
- parsed += "\r";
2620
- else if (c === 101)
2621
- parsed += "\x1B";
2622
- else if (c === 34)
2623
- parsed += '"';
2624
- else if (c === 92)
2625
- parsed += "\\";
2626
- else
2627
- TomlError.x("unrecognised escape sequence", ctx);
2628
- sliceStart = ctx.p + 1;
2629
- state = 0;
2630
- }
2631
- } else if (c !== 32 && c !== 9) {
2632
- if (state === 2)
2633
- TomlError.x("invalid escape: only line-ending whitespace may be escaped", ctx, sliceStart);
2634
- state = !isLiteral && c === 92 ? 1 : 0;
2635
- sliceStart = ctx.p;
2636
- }
2637
- }
2638
- TomlError.x("unfinished string", ctx, startPtr);
2639
- }
2640
-
2641
- /*!
2642
- * Copyright (c) Squirrel Chat et al., All rights reserved.
2643
- * SPDX-License-Identifier: BSD-3-Clause
2644
- *
2645
- * Redistribution and use in source and binary forms, with or without
2646
- * modification, are permitted provided that the following conditions are met:
2647
- *
2648
- * 1. Redistributions of source code must retain the above copyright notice, this
2649
- * list of conditions and the following disclaimer.
2650
- * 2. Redistributions in binary form must reproduce the above copyright notice,
2651
- * this list of conditions and the following disclaimer in the
2652
- * documentation and/or other materials provided with the distribution.
2653
- * 3. Neither the name of the copyright holder nor the names of its contributors
2654
- * may be used to endorse or promote products derived from this software without
2655
- * specific prior written permission.
2656
- *
2657
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
2658
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2659
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
2660
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
2661
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2662
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2663
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2664
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2665
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2666
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2667
- */
2668
- let DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[Tt ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|z|[-+]\d{2}:\d{2})?$/i;
2669
- class TomlDate extends Date {
2670
- #hasDate = false;
2671
- #hasTime = false;
2672
- #offset = null;
2673
- constructor(date, fasttype, unsafeDelim) {
2674
- let hasDate = true;
2675
- let hasTime = true;
2676
- let offset = "Z";
2677
- let c;
2678
- if (typeof date === "string") {
2679
- if (fasttype)
2680
- prep: {
2681
- if (fasttype < 3) {
2682
- if (+date.slice(11, 13) > 23) {
2683
- date = "";
2684
- break prep;
2685
- }
2686
- if (fasttype === 2) {
2687
- offset = null;
2688
- date += "Z";
2689
- } else if ((c = date.charCodeAt(date.length - 1)) !== 90 && c !== 122) {
2690
- offset = date.slice(date.length - 6);
2691
- }
2692
- if (unsafeDelim)
2693
- date = date.slice(0, 10) + "T" + date.slice(11);
2694
- } else if (fasttype === 4) {
2695
- date = +date.slice(0, 2) > 23 ? "" : `0000-01-01T${date}Z`;
2696
- }
2697
- hasDate = fasttype !== 4;
2698
- hasTime = fasttype !== 3;
2699
- }
2700
- else {
2701
- let match = date.match(DATE_TIME_RE);
2702
- if (match) {
2703
- if (!match[1]) {
2704
- hasDate = false;
2705
- date = `0000-01-01T${date}`;
2706
- }
2707
- hasTime = !!match[2];
2708
- hasTime && date[10] === " " && (date = date.replace(" ", "T"));
2709
- if (match[2] && +match[2] > 23) {
2710
- date = "";
2711
- } else {
2712
- offset = match[3] || null;
2713
- if (!offset && hasTime)
2714
- date += "Z";
2715
- }
2716
- } else {
2717
- date = "";
2718
- }
2719
- }
2720
- }
2721
- super(date);
2722
- if (!isNaN(this.getTime())) {
2723
- this.#hasDate = hasDate;
2724
- this.#hasTime = hasTime;
2725
- this.#offset = offset;
2726
- }
2727
- }
2728
- isDateTime() {
2729
- return this.#hasDate && this.#hasTime;
2730
- }
2731
- isLocal() {
2732
- return !this.#hasDate || !this.#hasTime || !this.#offset;
2733
- }
2734
- isDate() {
2735
- return this.#hasDate && !this.#hasTime;
2736
- }
2737
- isTime() {
2738
- return this.#hasTime && !this.#hasDate;
2739
- }
2740
- isValid() {
2741
- return this.#hasDate || this.#hasTime;
2742
- }
2743
- toISOString() {
2744
- let iso = super.toISOString();
2745
- if (this.isDate())
2746
- return iso.slice(0, 10);
2747
- if (this.isTime())
2748
- return iso.slice(11, 23);
2749
- if (this.#offset === null)
2750
- return iso.slice(0, -1);
2751
- if (this.#offset === "Z" || this.#offset === "z")
2752
- return iso;
2753
- let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
2754
- offset = this.#offset[0] === "-" ? offset : -offset;
2755
- let offsetDate = new Date(this.getTime() - offset * 6e4);
2756
- return offsetDate.toISOString().slice(0, -1) + this.#offset;
2757
- }
2758
- static wrapAsOffsetDateTime(jsDate, offset = "Z") {
2759
- let date = new TomlDate(jsDate);
2760
- date.#offset = offset;
2761
- return date;
2762
- }
2763
- static wrapAsLocalDateTime(jsDate) {
2764
- let date = new TomlDate(jsDate);
2765
- date.#offset = null;
2766
- return date;
2767
- }
2768
- static wrapAsLocalDate(jsDate) {
2769
- let date = new TomlDate(jsDate);
2770
- date.#hasTime = false;
2771
- date.#offset = null;
2772
- return date;
2773
- }
2774
- static wrapAsLocalTime(jsDate) {
2775
- let date = new TomlDate(jsDate);
2776
- date.#hasDate = false;
2777
- date.#offset = null;
2778
- return date;
2779
- }
2780
- }
2781
-
2782
- function isDigit(char, base = 10) {
2783
- return base === 16 ? char > 47 && char < 58 || char > 64 && char < 71 || char > 96 && char < 103 : char > 47 && char < 48 + base;
2784
- }
2785
- function isEndOfValue(char, delim) {
2786
- return char === 32 || char === 9 || char === 10 || char === 13 || // Structure end or next value delimiter
2787
- delim && (char === delim || char === 44) || // Comment
2788
- char === 35;
2789
- }
2790
- function extractValue(ctx, end) {
2791
- let errPtr = ctx.p;
2792
- let c = ctx.s.charCodeAt(ctx.p);
2793
- if (c === 91 || c === 123) {
2794
- ctx.d-- || TomlError.x("document contains excessively nested structures. aborting.", ctx);
2795
- let value = c === 91 ? parseArray(ctx) : parseInlineTable(ctx);
2796
- ctx.d++;
2797
- return value;
2798
- }
2799
- if (c === 34 || c === 39) {
2800
- return parseString(ctx);
2801
- }
2802
- if (c === 116) {
2803
- if (ctx.s.charCodeAt(++ctx.p) !== 114 || ctx.s.charCodeAt(++ctx.p) !== 117 || ctx.s.charCodeAt(++ctx.p) !== 101)
2804
- TomlError.x("invalid value", ctx, errPtr);
2805
- return ctx.p++, true;
2806
- }
2807
- if (c === 102) {
2808
- if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 108 || ctx.s.charCodeAt(++ctx.p) !== 115 || ctx.s.charCodeAt(++ctx.p) !== 101)
2809
- TomlError.x("invalid value", ctx, errPtr);
2810
- return ctx.p++, false;
2811
- }
2812
- if (c === 43 || c === 45) {
2813
- return parseNumber(ctx, ctx.p, ctx.s.charCodeAt(++ctx.p), 44 - c, end);
2814
- }
2815
- if (ctx.s.charCodeAt(ctx.p + 4) === 45 && ctx.s.charCodeAt(ctx.p + 7) === 45) {
2816
- return parseDate(ctx, c, end);
2817
- }
2818
- if (ctx.s.charCodeAt(ctx.p + 2) === 58) {
2819
- return parseTime(ctx, c, end);
2820
- }
2821
- return parseNumber(ctx, ctx.p, c, 0, end);
2822
- }
2823
- function parseNumber(ctx, startPtr, startChr, sign, endChr) {
2824
- let c = startChr;
2825
- let state = 0;
2826
- let hasUnderscores = false;
2827
- if (c === 105) {
2828
- if (ctx.s.charCodeAt(++ctx.p) !== 110 || ctx.s.charCodeAt(++ctx.p) !== 102)
2829
- TomlError.x("invalid value", ctx, startPtr);
2830
- return ctx.p++, (sign || 1) / 0;
2831
- }
2832
- if (c === 110) {
2833
- if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 110)
2834
- TomlError.x("invalid value", ctx, startPtr);
2835
- return ctx.p++, NaN;
2836
- }
2837
- if (c === 48) {
2838
- if (++ctx.p >= ctx.s.length || isEndOfValue(c = ctx.s.charCodeAt(ctx.p), endChr))
2839
- return ctx.bi === true ? 0n : 0;
2840
- if (!sign) {
2841
- if (c === 120)
2842
- return parseIntegerBaseN(ctx, startPtr, 16, endChr);
2843
- else if (c === 98)
2844
- return parseIntegerBaseN(ctx, startPtr, 2, endChr);
2845
- else if (c === 111)
2846
- return parseIntegerBaseN(ctx, startPtr, 8, endChr);
2847
- }
2848
- if (c === 46)
2849
- state = 2;
2850
- else if (c === 101 || c === 69)
2851
- state = 4;
2852
- else
2853
- TomlError.x("illegal leading zero", ctx, startPtr);
2854
- } else if (!isDigit(c))
2855
- TomlError.x("invalid value", ctx, startPtr);
2856
- while (++ctx.p < ctx.s.length && (c = ctx.s.charCodeAt(ctx.p), !isEndOfValue(c, endChr))) {
2857
- if (!state)
2858
- state = 1;
2859
- if (c === 95) {
2860
- if (!(state & 1))
2861
- TomlError.x("illegal underscore", ctx);
2862
- state += 11;
2863
- hasUnderscores = true;
2864
- } else if (state === 1 && c === 46)
2865
- state = 2;
2866
- else if ((state === 1 || state === 3) && (c === 101 || c === 69))
2867
- state = 4;
2868
- else if (state === 4 && (c === 43 || c === 45)) ; else if (!isDigit(c))
2869
- TomlError.x(`illegal character in numeric literal`, ctx);
2870
- else if (state > 9)
2871
- state -= 11;
2872
- else if (!(state & 1))
2873
- state++;
2874
- }
2875
- if (!state) {
2876
- let val = (startChr - 48) * (sign || 1);
2877
- return ctx.bi === true ? BigInt(val) : val;
2878
- }
2879
- if (!(state & 1))
2880
- TomlError.x("unfinished numeric value", ctx, startPtr);
2881
- let str = ctx.s.slice(startPtr, ctx.p);
2882
- if (hasUnderscores)
2883
- str = str.replaceAll("_", "");
2884
- return state > 1 ? parseFloat(str) : parseInteger(ctx, str, 10, startPtr);
2885
- }
2886
- function parseIntegerBaseN(ctx, startPtr, base, endChr) {
2887
- let c, underscore = 1;
2888
- while (++ctx.p < ctx.s.length && (c = ctx.s.charCodeAt(ctx.p), !isEndOfValue(c, endChr))) {
2889
- if (c === 95) {
2890
- if (underscore & 1)
2891
- TomlError.x("illegal underscore", ctx);
2892
- underscore = 3;
2893
- } else if (!isDigit(c, base))
2894
- TomlError.x(`illegal character in numeric literal`, ctx);
2895
- else if (underscore & 1)
2896
- underscore--;
2897
- }
2898
- if (underscore & 1)
2899
- TomlError.x("unfinished numeric value", ctx);
2900
- let str = ctx.s.slice(startPtr + 2, ctx.p);
2901
- if (underscore)
2902
- str = str.replaceAll("_", "");
2903
- return parseInteger(ctx, str, base, startPtr);
2904
- }
2905
- function parseInteger(ctx, str, base, startPtr) {
2906
- if (ctx.bi !== true)
2907
- int: {
2908
- let val = parseInt(str, base);
2909
- if (!Number.isSafeInteger(val)) {
2910
- if (ctx.bi)
2911
- break int;
2912
- TomlError.x("integer value cannot be represented losslessly", ctx, startPtr);
2913
- }
2914
- return val;
2915
- }
2916
- return base === 10 ? BigInt(str) : BigInt((base === 2 ? "0b" : base === 8 ? "0o" : "0x") + str);
2917
- }
2918
- function parseDate(ctx, c, endChr) {
2919
- let startPtr = ctx.p++, unsafeSeparator;
2920
- if (!isDigit(c) || !isDigit(ctx.s.charCodeAt(ctx.p++)) || !isDigit(ctx.s.charCodeAt(ctx.p++)) || !isDigit(ctx.s.charCodeAt(ctx.p++))) {
2921
- return parseNumber(ctx, ctx.p = startPtr, c, 0, endChr);
2922
- }
2923
- ctx.p += 5;
2924
- if (!isDigit(ctx.s.charCodeAt(ctx.p++)))
2925
- TomlError.x("invalid date-time: date part is malformed", ctx, startPtr);
2926
- if (ctx.p >= ctx.s.length || ((c = ctx.s.charCodeAt(ctx.p)) !== 32 || (unsafeSeparator = true, !isDigit(ctx.s.charCodeAt(ctx.p + 1)))) && c !== 84 && c !== 116) {
2927
- let t2 = ctx.s.slice(startPtr, ctx.p);
2928
- return readDate(ctx, t2, 3, false, startPtr);
2929
- }
2930
- if (ctx.s.charCodeAt(ctx.p += 3) !== 58)
2931
- TomlError.x("invalid date-time: time part is malformed", ctx, startPtr);
2932
- if (ctx.s.charCodeAt(ctx.p += 3) === 58)
2933
- ctx.p += 3;
2934
- if (ctx.s.charCodeAt(ctx.p) === 46)
2935
- while (isDigit(ctx.s.charCodeAt(++ctx.p)))
2936
- ;
2937
- if (c = ctx.s.charCodeAt(ctx.p)) {
2938
- if (c === 90 || c === 122) {
2939
- let t2 = ctx.s.slice(startPtr, ++ctx.p);
2940
- return readDate(ctx, t2, 1, unsafeSeparator, startPtr, "[+00:00]");
2941
- }
2942
- if (c === 43 || c === 45) {
2943
- let t2 = ctx.s.slice(startPtr, ctx.p += 6);
2944
- return readDate(ctx, t2, 1, unsafeSeparator, startPtr, !ctx.ld && "[" + ctx.s.slice(ctx.p - 6, ctx.p) + "]");
2945
- }
2946
- }
2947
- let t = ctx.s.slice(startPtr, ctx.p);
2948
- return readDate(ctx, t, 2, unsafeSeparator, startPtr);
2949
- }
2950
- function parseTime(ctx, c, endChr) {
2951
- let start = ctx.p;
2952
- if (!isDigit(c) || !isDigit(ctx.s.charCodeAt(++ctx.p))) {
2953
- return parseNumber(ctx, --ctx.p, c, 0, endChr);
2954
- }
2955
- if (ctx.s.charCodeAt(ctx.p += 4) === 58)
2956
- ctx.p += 3;
2957
- if (ctx.s.charCodeAt(ctx.p) === 46)
2958
- while (isDigit(ctx.s.charCodeAt(++ctx.p)))
2959
- ;
2960
- let t = ctx.s.slice(start, ctx.p);
2961
- return readDate(ctx, t, 4, false, start);
2962
- }
2963
- function readDate(ctx, str, type, unsafeDelim, errPtr, temporalSuffix) {
2964
- if (ctx.ld) {
2965
- let date = new TomlDate(str, type, unsafeDelim);
2966
- if (!date.isValid())
2967
- TomlError.x("invalid date", ctx, errPtr);
2968
- return date;
2969
- }
2970
- try {
2971
- if (temporalSuffix)
2972
- str += temporalSuffix;
2973
- switch (type) {
2974
- case 1:
2975
- return Temporal.ZonedDateTime.from(str);
2976
- case 2:
2977
- return Temporal.PlainDateTime.from(str);
2978
- case 3:
2979
- return Temporal.PlainDate.from(str);
2980
- case 4:
2981
- return Temporal.PlainTime.from(str);
2982
- }
2983
- } catch (e) {
2984
- TomlError.x(e instanceof Error ? e.message : "" + e, ctx, errPtr);
2985
- }
2986
- }
2987
-
2988
- function skipComment(ctx) {
2989
- for (; ctx.p < ctx.s.length; ctx.p++) {
2990
- let c = ctx.s.charCodeAt(ctx.p);
2991
- if (c === 10)
2992
- break;
2993
- if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
2994
- ctx.p++;
2995
- break;
2996
- }
2997
- if (c < 32 && c !== 9 || c === 127) {
2998
- TomlError.x("control characters are not allowed in comments", ctx);
2999
- }
3000
- }
3001
- }
3002
- function skipVoid(ctx, banNewLines, banComments) {
3003
- let c;
3004
- while (ctx.p < ctx.s.length) {
3005
- while (ctx.p < ctx.s.length && ((c = ctx.s.charCodeAt(ctx.p)) === 32 || c === 9 || !banNewLines && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)))
3006
- ctx.p++;
3007
- if (banComments || c !== 35)
3008
- break;
3009
- skipComment(ctx);
3010
- }
3011
- }
3012
-
3013
- function parseKey(ctx, end = 61) {
3014
- let startPtr;
3015
- let state = 0;
3016
- let parsed = [];
3017
- let sliceStart;
3018
- let c = ctx.s.charCodeAt(startPtr = ctx.p);
3019
- do {
3020
- if (c === end) {
3021
- if (!state)
3022
- TomlError.x("unexpected end of key", ctx);
3023
- if (state === 1)
3024
- parsed.push(ctx.s.slice(sliceStart, ctx.p));
3025
- return ctx.p++, parsed;
3026
- } else if (c === 46) {
3027
- if (!state)
3028
- TomlError.x("illegal empty bare key", ctx);
3029
- if (state === 1)
3030
- parsed.push(ctx.s.slice(sliceStart, ctx.p));
3031
- state = 0;
3032
- } else if (!state && (c === 34 || c === 39)) {
3033
- if (c === ctx.s.charCodeAt(ctx.p + 1) && c === ctx.s.charCodeAt(ctx.p + 2))
3034
- TomlError.x("illegal quoted key: multiline strings are not allowed", ctx);
3035
- parsed.push(parseString(ctx));
3036
- state = 2;
3037
- ctx.p--;
3038
- } else if (c === 32 || c === 9) {
3039
- if (state === 1) {
3040
- parsed.push(ctx.s.slice(sliceStart, ctx.p));
3041
- state = 2;
3042
- }
3043
- } else if (state === 2 || c < 48 && c !== 45 || c > 57 && c < 65 || c > 90 && c < 97 && c !== 95 || c > 122) {
3044
- TomlError.x("illegal character in key", ctx);
3045
- } else if (!state) {
3046
- state = 1;
3047
- sliceStart = ctx.p;
3048
- }
3049
- } while (c = ctx.s.charCodeAt(++ctx.p));
3050
- TomlError.x("incomplete key-value: cannot find end of key", ctx, startPtr);
3051
- }
3052
- function parseInlineTable(ctx) {
3053
- let startPtr = ctx.p++;
3054
- let res = /* @__PURE__ */ Object.create(null);
3055
- let seen = /* @__PURE__ */ new Set();
3056
- let c;
3057
- while (ctx.p < ctx.s.length) {
3058
- skipVoid(ctx);
3059
- if ((c = ctx.s.charCodeAt(ctx.p)) === 125) {
3060
- ctx.p++;
3061
- return res;
3062
- }
3063
- let k;
3064
- let t = res;
3065
- let hasOwn = false;
3066
- let errPtr = ctx.p;
3067
- let key = parseKey(ctx);
3068
- for (let i = 0; i < key.length; i++) {
3069
- if (i)
3070
- t = hasOwn ? t[k] : t[k] = /* @__PURE__ */ Object.create(null);
3071
- k = key[i];
3072
- if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== "object" || seen.has(t[k]))) {
3073
- TomlError.x("trying to redefine an already defined value", ctx, errPtr);
3074
- }
3075
- let unsafe = k === "__proto__";
3076
- if (ctx.uk && (unsafe || k === "constructor")) {
3077
- t = ctx.uk !== 1 && TomlError.x("document contains an unsafe property", ctx, errPtr);
3078
- break;
3079
- }
3080
- if (!hasOwn && unsafe) {
3081
- Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
3082
- }
3083
- }
3084
- if (hasOwn) {
3085
- TomlError.x("trying to redefine an already defined value", ctx, errPtr);
3086
- }
3087
- skipVoid(ctx, true, true);
3088
- let value = extractValue(
3089
- ctx,
3090
- 125
3091
- /* } */
3092
- );
3093
- if (t && typeof (t[k] = value) === "object")
3094
- seen.add(value);
3095
- skipVoid(ctx);
3096
- if ((c = ctx.s.charCodeAt(ctx.p++)) === 125) {
3097
- return res;
3098
- }
3099
- if (c !== 44)
3100
- TomlError.x("expected comma or end of structure", ctx, ctx.p - 1);
3101
- }
3102
- TomlError.x("unfinished table", ctx, startPtr);
3103
- }
3104
- function parseArray(ctx) {
3105
- let startPtr = ctx.p++;
3106
- let res = [];
3107
- let c;
3108
- while (ctx.p < ctx.s.length) {
3109
- skipVoid(ctx);
3110
- if ((c = ctx.s.charCodeAt(ctx.p)) === 93) {
3111
- ctx.p++;
3112
- return res;
3113
- }
3114
- res.push(extractValue(
3115
- ctx,
3116
- 93
3117
- /* ] */
3118
- ));
3119
- skipVoid(ctx);
3120
- if ((c = ctx.s.charCodeAt(ctx.p++)) === 93) {
3121
- return res;
3122
- }
3123
- if (c !== 44)
3124
- TomlError.x("expected comma or end of structure", ctx, ctx.p - 1);
3125
- }
3126
- TomlError.x("unfinished array", ctx, startPtr);
3127
- }
3128
-
3129
- function peekTable(ctx, key, table, meta, type) {
3130
- let t = table;
3131
- let m = meta;
3132
- let k;
3133
- let hasOwn = false;
3134
- let state;
3135
- for (let i = 0; i < key.length; i++) {
3136
- if (i) {
3137
- t = hasOwn ? t[k] : t[k] = /* @__PURE__ */ Object.create(null);
3138
- m = (state = m[k]).c;
3139
- if (type === 0 && (state.t === 1 || state.t === 2)) {
3140
- return null;
3141
- }
3142
- if (state.t === 2) {
3143
- let l = t.length - 1;
3144
- t = t[l];
3145
- m = m[l].c;
3146
- }
3147
- }
3148
- k = key[i];
3149
- if ((hasOwn = Object.hasOwn(t, k)) && m[k]?.t === 0 && m[k]?.d) {
3150
- return null;
3151
- }
3152
- if (!hasOwn) {
3153
- let unsafe = k === "__proto__";
3154
- if (ctx.uk && (unsafe || k === "constructor"))
3155
- return false;
3156
- if (unsafe) {
3157
- Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
3158
- Object.defineProperty(m, k, { enumerable: true, configurable: true, writable: true });
3159
- }
3160
- m[k] = {
3161
- t: i < key.length - 1 && type === 2 ? 3 : type,
3162
- d: false,
3163
- i: 0,
3164
- c: /* @__PURE__ */ Object.create(null)
3165
- };
3166
- }
3167
- }
3168
- state = m[k];
3169
- if (state.t !== type && !(type === 1 && state.t === 3)) {
3170
- return null;
3171
- }
3172
- if (type === 2) {
3173
- if (!state.d) {
3174
- state.d = true;
3175
- t[k] = [];
3176
- }
3177
- t[k].push(t = /* @__PURE__ */ Object.create(null));
3178
- state.c[state.i++] = state = { t: 1, d: false, i: 0, c: /* @__PURE__ */ Object.create(null) };
3179
- }
3180
- if (state.d) {
3181
- return null;
3182
- }
3183
- state.d = true;
3184
- if (type === 1) {
3185
- t = hasOwn ? t[k] : t[k] = /* @__PURE__ */ Object.create(null);
3186
- } else if (type === 0 && hasOwn) {
3187
- return null;
3188
- }
3189
- return [k, t, state.c];
3190
- }
3191
- function validateTablePeek(ctx, peek, ptr) {
3192
- if (peek === null || ctx.uk === 2)
3193
- TomlError.x(peek === null ? "trying to redefine an already defined table or value" : "document contains an unsafe property", ctx, ptr);
3194
- }
3195
- function parse(toml, options = {}) {
3196
- let ctx = {
3197
- s: toml,
3198
- p: 0,
3199
- d: options.maxDepth ?? 1e3,
3200
- bi: options.integersAsBigInt ?? false,
3201
- ld: options.useLegacyDate ?? true,
3202
- uk: options.unsafeKeyBehaviour === "throw" ? 2 : options.unsafeKeyBehaviour === "drop" ? 1 : 0
3203
- };
3204
- let res = /* @__PURE__ */ Object.create(null);
3205
- let meta = /* @__PURE__ */ Object.create(null);
3206
- let tmp;
3207
- let skipping = false;
3208
- let tbl = res;
3209
- let m = meta;
3210
- if (toml.charCodeAt(0) === 65279)
3211
- ctx.p++;
3212
- skipVoid(ctx);
3213
- while (ctx.p < toml.length) {
3214
- if (toml.charCodeAt(ctx.p) === 91) {
3215
- let isTableArray = toml.charCodeAt(++ctx.p) === 91;
3216
- tmp = ctx.p += +isTableArray;
3217
- skipping = false;
3218
- let k = parseKey(
3219
- ctx,
3220
- 93
3221
- /* ] */
3222
- );
3223
- if (isTableArray) {
3224
- if (toml.charCodeAt(ctx.p) !== 93) {
3225
- TomlError.x("expected end of table array declaration", ctx);
3226
- }
3227
- ctx.p++;
3228
- }
3229
- let p = peekTable(
3230
- ctx,
3231
- k,
3232
- res,
3233
- meta,
3234
- isTableArray ? 2 : 1
3235
- /* Type.EXPLICIT */
3236
- );
3237
- if (!p) {
3238
- validateTablePeek(ctx, p, tmp);
3239
- skipping = true;
3240
- } else {
3241
- m = p[2];
3242
- tbl = p[1];
3243
- }
3244
- } else {
3245
- tmp = ctx.p;
3246
- let k = parseKey(ctx);
3247
- let p = peekTable(
3248
- ctx,
3249
- k,
3250
- tbl,
3251
- m,
3252
- 0
3253
- /* Type.DOTTED */
3254
- );
3255
- if (!p && !skipping)
3256
- validateTablePeek(ctx, p, tmp);
3257
- skipVoid(ctx, true, true);
3258
- let v = extractValue(ctx, void 0);
3259
- if (p && !skipping)
3260
- p[1][p[0]] = v;
3261
- }
3262
- skipVoid(ctx, true);
3263
- if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && (tmp !== 13 || toml.charCodeAt(ctx.p + 1) !== 10)) {
3264
- TomlError.x("each key-value declaration must be followed by an end-of-line", ctx);
3265
- }
3266
- skipVoid(ctx);
3267
- }
3268
- return res;
3269
- }
3270
-
3271
2572
  const BARE_KEY = /^[A-Za-z0-9_-]+$/;
3272
2573
  function formatTomlKey(key) {
3273
2574
  return BARE_KEY.test(key) ? key : JSON.stringify(key);
@@ -5334,6 +4635,12 @@ function createAutoRestart(deps) {
5334
4635
  setStatus(sessionId, { state: "waiting", reason: "turn-active", since, target: staleness.target });
5335
4636
  return;
5336
4637
  }
4638
+ const pending = deps.upgradePending?.() ?? null;
4639
+ if (pending) {
4640
+ deps.log?.(`[auto-restart] ${sessionId} left to the next daemon: upgrade to ${pending} pending`);
4641
+ setStatus(sessionId, { state: "waiting", reason: "upgrade-pending", since, target: staleness.target });
4642
+ return;
4643
+ }
5337
4644
  let result;
5338
4645
  try {
5339
4646
  result = await deps.restart(sessionId, staleness);
@@ -5423,6 +4730,7 @@ function createAutoRestart(deps) {
5423
4730
  automationRunning: deps.automationRunning(request.sessionId),
5424
4731
  resumable: false,
5425
4732
  attempt,
4733
+ upgradePending: deps.upgradePending?.() ?? null,
5426
4734
  inFlight,
5427
4735
  lastStartedAt
5428
4736
  };
@@ -5439,6 +4747,7 @@ function createAutoRestart(deps) {
5439
4747
  automationRunning: deps.automationRunning(request.sessionId),
5440
4748
  resumable,
5441
4749
  attempt: attempts.get(request.sessionId) ?? null,
4750
+ upgradePending: deps.upgradePending?.() ?? null,
5442
4751
  inFlight,
5443
4752
  lastStartedAt
5444
4753
  };
@@ -5780,6 +5089,28 @@ class ClaudeAuthService {
5780
5089
  }
5781
5090
  }
5782
5091
 
5092
+ function forkSpawnAccount(requested, parentSessionId, parentAccount) {
5093
+ if (requested !== void 0) return requested;
5094
+ if (!parentSessionId) return void 0;
5095
+ return parentAccount(parentSessionId);
5096
+ }
5097
+ const REASON_TEXT = {
5098
+ "missing": "does not exist on this machine",
5099
+ "missing-secret": "has no key / token on this machine",
5100
+ "expired": "sign-in has expired",
5101
+ "invalid": "key was rejected",
5102
+ "agent-mismatch": "is for a different agent"
5103
+ };
5104
+ function accountUnavailableError(error, scope) {
5105
+ const reason = agentProfileUnavailableReason(error);
5106
+ if (!reason) return null;
5107
+ const detail = error.replace(/^agent-profile-unavailable:[a-z-]+:?\s*/, "");
5108
+ return `Account unavailable (${reason}): ${detail ? `${detail} \u2014 ` : ""}${accountUnavailableHint(reason, scope)}`;
5109
+ }
5110
+ function accountUnavailableHint(reason, scope) {
5111
+ return `${REASON_TEXT[reason] ?? reason}. Not run on the machine login. Fix: sign in again (Settings \u2192 Models & accounts, or \`very-happy account login\` / \`very-happy account test\`), or choose another account for this ${scope}.`;
5112
+ }
5113
+
5783
5114
  const INTERNAL_CLAUDE_EVENT_TYPES = /* @__PURE__ */ new Set(["file-history-snapshot", "change", "queue-operation"]);
5784
5115
  function parseLines(lines) {
5785
5116
  const out = [];
@@ -6600,6 +5931,27 @@ async function removeTeamWorktree(resource) {
6600
5931
  function teamInitialModelMeta(model) {
6601
5932
  return model ? { model, modelIntent: model } : { modelIntent: MODEL_INTENT_CONFIG };
6602
5933
  }
5934
+ function teamOperationAccount(op) {
5935
+ if (op.agentProfile === void 0) return void 0;
5936
+ return op.agentProfile === null ? null : op.agentProfile.id;
5937
+ }
5938
+ function teamAccountRefusal(resolve, op) {
5939
+ const agent = op.assistant === "claude" || op.assistant === "codex" ? op.assistant : null;
5940
+ const requested = teamOperationAccount(op);
5941
+ if (!resolve) return null;
5942
+ if (!agent) return typeof requested === "string" ? `agent-profile-unavailable:agent-mismatch: accounts are not supported for ${op.assistant} yet` : null;
5943
+ try {
5944
+ resolve(agent, requested);
5945
+ return null;
5946
+ } catch (error) {
5947
+ const message = error instanceof Error ? error.message : String(error);
5948
+ return agentProfileUnavailableReason(message) ? teamAccountError(message) : null;
5949
+ }
5950
+ }
5951
+ function teamAccountError(raw) {
5952
+ const reason = agentProfileUnavailableReason(raw);
5953
+ return `${raw}${reason ? ` \u2014 ${accountUnavailableHint(reason, "team member")}` : ""}`.slice(0, 1e3);
5954
+ }
6603
5955
  function refusalCode(error) {
6604
5956
  const code = axios.isAxiosError(error) ? error.response?.data?.error : void 0;
6605
5957
  return typeof code === "string" && /^[a-z_]{1,64}$/.test(code) ? ` (${code})` : "";
@@ -6620,6 +5972,14 @@ function createTeamWorker(deps) {
6620
5972
  await action(op.teamId, `complete-${op.id}`, { type: "complete-operation", operationId: op.id, machineId: deps.machineId, claimId: receipt.claimId, ...receipt.sessionId ? { sessionId: receipt.sessionId } : {}, ...op.type === "spawn" && receipt.directory ? { workingDirectory: receipt.directory } : {} });
6621
5973
  writeReceipt$1(home, { ...receipt, phase: "completed" });
6622
5974
  }
5975
+ async function refuseForAccount(op, receipt, error) {
5976
+ const { retryAt: _retryAt, sessionId: _sessionId, ...rest } = receipt;
5977
+ const next = { ...rest, phase: "prepared", spawnFailures: (receipt.spawnFailures ?? 0) + 1 };
5978
+ writeReceipt$1(home, next);
5979
+ await action(op.teamId, `account-refused-${op.id}-${receipt.retryConsumed ?? 0}`, { type: "fail-operation", operationId: op.id, machineId: deps.machineId, claimId: receipt.claimId, error }).catch(() => {
5980
+ });
5981
+ deps.log(`Teams operation ${op.id} refused: account unavailable`);
5982
+ }
6623
5983
  async function execute(op) {
6624
5984
  let receipt = readReceipt(home, op.id);
6625
5985
  let credential;
@@ -6659,6 +6019,11 @@ function createTeamWorker(deps) {
6659
6019
  return;
6660
6020
  }
6661
6021
  if (!op.directory) throw new Error("No repository selected for worker");
6022
+ const refusal = teamAccountRefusal(deps.resolveAccount, op);
6023
+ if (refusal) {
6024
+ await refuseForAccount(op, receipt, refusal);
6025
+ return;
6026
+ }
6662
6027
  let resource;
6663
6028
  try {
6664
6029
  const repository = await resolveTeamRepository(home, op.directory, (id) => {
@@ -6685,7 +6050,12 @@ function createTeamWorker(deps) {
6685
6050
  writePrivateFileSync(scopeFile, JSON.stringify({ serverUrl: server, scopeToken: credential.token, teamId: op.teamId, botId: op.botId, taskId: op.taskId, attemptId: op.attemptId }));
6686
6051
  receipt = { ...receipt, ...resource, scopeFile, phase: "spawning" };
6687
6052
  writeReceipt$1(home, receipt);
6688
- const spawned = await deps.spawn({ directory: resource.directory, agent: op.assistant === "pi-acp" ? "pi" : op.assistant, permissionMode: op.permissionMode === "bypassPermissions" ? "bypassPermissions" : "default", spawnedBy: "teams", environmentVariables: { VH_TEAM_SCOPE_FILE: scopeFile, VH_TEAM_OPERATION_ID: op.id } });
6053
+ const account = teamOperationAccount(op);
6054
+ const spawned = await deps.spawn({ directory: resource.directory, agent: op.assistant === "pi-acp" ? "pi" : op.assistant, permissionMode: op.permissionMode === "bypassPermissions" ? "bypassPermissions" : "default", spawnedBy: "teams", environmentVariables: { VH_TEAM_SCOPE_FILE: scopeFile, VH_TEAM_OPERATION_ID: op.id }, ...account !== void 0 ? { agentProfileId: account } : {} });
6055
+ if (spawned.type === "error" && agentProfileUnavailableReason(spawned.errorMessage)) {
6056
+ await refuseForAccount(op, receipt, teamAccountError(spawned.errorMessage));
6057
+ return;
6058
+ }
6689
6059
  if (spawned.type === "error" && spawned.startupExit?.exited) {
6690
6060
  const now = Date.now();
6691
6061
  receipt = afterStartupFailure(receipt, now);
@@ -7132,6 +6502,30 @@ const AUTOMATION_LOG_READ_MS = 3e4;
7132
6502
  const AUTOMATION_UNAVAILABLE_LOG_MS = 10 * 6e4;
7133
6503
  const AUTOMATION_MAX_CONCURRENT = AUTOMATION_CLAIM_MAX_RUNS;
7134
6504
  const AUTOMATION_SPAWNED_BY = "automation";
6505
+ const AUTOMATION_ACCOUNT_UNAVAILABLE = "account_unavailable";
6506
+ const AUTOMATION_ACCOUNT_HISTORY_REJECTED = "account_history_rejected";
6507
+ function turnFailureReason(turn) {
6508
+ if (turn.refusal === "agent-profile-unavailable") return AUTOMATION_ACCOUNT_UNAVAILABLE;
6509
+ if (turn.refusal === "agent-profile-history-rejected") return AUTOMATION_ACCOUNT_HISTORY_REJECTED;
6510
+ return `turn_${turn.status}`;
6511
+ }
6512
+ async function alignStickyAccount(accounts, agent, sessionId, requested) {
6513
+ const current = accounts.sessionAccount(sessionId);
6514
+ let target;
6515
+ try {
6516
+ target = accounts.resolve(agent, requested !== void 0 ? requested : current);
6517
+ } catch (error) {
6518
+ const message = error instanceof Error ? error.message : String(error);
6519
+ return { error: accountUnavailableError(message, "automation") ?? message, reason: AUTOMATION_ACCOUNT_UNAVAILABLE };
6520
+ }
6521
+ if (target === current) return null;
6522
+ try {
6523
+ await accounts.rebind(sessionId, target);
6524
+ } catch (error) {
6525
+ return { error: `Could not move the sticky session to the run's account: ${error instanceof Error ? error.message : String(error)}`, reason: "send_failed" };
6526
+ }
6527
+ return null;
6528
+ }
7135
6529
  function automationPromptHeader(name, runId) {
7136
6530
  return `[Very Happy automation "${name}" run ${runId}; finish with automation_report (runId ${runId}) or \`very-happy auto report --run ${runId}\`]`;
7137
6531
  }
@@ -7295,6 +6689,7 @@ function createAutomationRunner(deps) {
7295
6689
  function wakeThenSend(claimed, sessionId, text, stickyKey) {
7296
6690
  const { run, automation } = claimed;
7297
6691
  const item = track(claimed, "send", sessionId);
6692
+ if (stickyKey) item.stickyKey = stickyKey;
7298
6693
  item.waking = true;
7299
6694
  gating++;
7300
6695
  void (async () => {
@@ -7379,8 +6774,17 @@ ${action.prompt}`, { localId: `automation-${run.id}` });
7379
6774
  }
7380
6775
  const permissionMode = resolveSpawnPermissionMode(agent, action.permissionMode ?? void 0);
7381
6776
  const stickyKey = action.sticky ? renderTemplate(action.sticky.key, context) : void 0;
6777
+ const requestedAccount = resolveLaunchAgentProfile({ explicit: action.agentProfile, project: claimed.projectAgentProfiles, agent, machineId: deps.machineId }).agentProfileId;
6778
+ const accountAgent = agent === "claude" || agent === "codex" ? agent : null;
7382
6779
  if (stickyKey) {
7383
6780
  const bound = claimed.stickies.find((sticky) => sticky.key === stickyKey);
6781
+ if (bound && (wakeable(bound.sessionId) || deps.live(bound.sessionId)) && deps.accounts && accountAgent) {
6782
+ const problem = await alignStickyAccount(deps.accounts, accountAgent, bound.sessionId, requestedAccount);
6783
+ if (problem) {
6784
+ await failNow(claimed, "send", problem.error, problem.reason, bound.sessionId);
6785
+ return;
6786
+ }
6787
+ }
7384
6788
  if (bound && wakeable(bound.sessionId)) {
7385
6789
  wakeThenSend(claimed, bound.sessionId, `${header}
7386
6790
  ${action.prompt}`, stickyKey);
@@ -7395,7 +6799,9 @@ ${action.prompt}`, { localId: `automation-${run.id}` });
7395
6799
  await failNow(claimed, "send", `Sticky session delivery failed: ${error instanceof Error ? error.message : String(error)}`, "send_failed", bound.sessionId);
7396
6800
  return;
7397
6801
  }
7398
- await reportRunning(track(claimed, "send", bound.sessionId), bound.sessionId, stickyKey);
6802
+ const item2 = track(claimed, "send", bound.sessionId);
6803
+ item2.stickyKey = stickyKey;
6804
+ await reportRunning(item2, bound.sessionId, stickyKey);
7399
6805
  return;
7400
6806
  }
7401
6807
  if (bound) await client.deleteSticky(automation.id, stickyKey).catch(() => deps.log(`Automation ${automation.name}: stale sticky ${stickyKey} not cleared`));
@@ -7414,8 +6820,13 @@ ${action.prompt}`, { localId: `automation-${run.id}` });
7414
6820
  }
7415
6821
  }
7416
6822
  persist({ runId: run.id, automationId: automation.id, kind: "spawn", phase: "starting", claimId: run.claimId, stickyKey, ...action.worktree ? { directory } : {} });
7417
- const spawned = await deps.spawn({ directory, agent, permissionMode, spawnedBy: AUTOMATION_SPAWNED_BY, environmentVariables: stickyKey ? { ...env, VH_AUTOMATION_STICKY: "1" } : env });
6823
+ const spawned = await deps.spawn({ directory, agent, permissionMode, spawnedBy: AUTOMATION_SPAWNED_BY, environmentVariables: stickyKey ? { ...env, VH_AUTOMATION_STICKY: "1" } : env, ...requestedAccount !== void 0 ? { agentProfileId: requestedAccount } : {} });
7418
6824
  if (spawned.type !== "success") {
6825
+ const accountError = spawned.type === "error" ? accountUnavailableError(spawned.errorMessage, "automation") : null;
6826
+ if (accountError) {
6827
+ await failNow(claimed, "spawn", accountError, AUTOMATION_ACCOUNT_UNAVAILABLE);
6828
+ return;
6829
+ }
7419
6830
  await failNow(claimed, "spawn", spawned.type === "error" ? spawned.errorMessage : "Directory approval required", "spawn_failed");
7420
6831
  return;
7421
6832
  }
@@ -7464,7 +6875,11 @@ ${action.prompt}`, { localId: `automation-${run.id}`, ...meta });
7464
6875
  continue;
7465
6876
  }
7466
6877
  item.waitingOnBackground = false;
7467
- if (turn.status === "failed" || turn.status === "cancelled") await finish(item, { claimId: item.claimId, status: "failed", sessionId, error: turn.error ?? `Turn ${turn.status}`, needsAttention: true, attentionReason: `turn_${turn.status}` });
6878
+ const reason = turn.status === "failed" || turn.status === "cancelled" ? turnFailureReason(turn) : null;
6879
+ if (reason === AUTOMATION_ACCOUNT_HISTORY_REJECTED && item.stickyKey) {
6880
+ await client.deleteSticky(item.automationId, item.stickyKey).catch(() => deps.log(`Automation run ${item.runId}: sticky ${item.stickyKey} not cleared`));
6881
+ }
6882
+ if (reason) await finish(item, { claimId: item.claimId, status: "failed", sessionId, error: turn.error ?? `Turn ${turn.status}`, needsAttention: true, attentionReason: reason });
7468
6883
  else await finish(item, { claimId: item.claimId, status: "done", sessionId, summary: clipText(turn.answer, AUTOMATION_SUMMARY_MAX_CHARS) });
7469
6884
  }
7470
6885
  }
@@ -7656,6 +7071,7 @@ async function startDaemon() {
7656
7071
  const initialMachineMetadata = getInitialMachineMetadata();
7657
7072
  const startupCliAvailability = getStartupCliAvailability();
7658
7073
  let claudeAuthServiceRef = null;
7074
+ let accountServiceRef = null;
7659
7075
  let cliUpdateStateRef = null;
7660
7076
  let lastHandoverHold = null;
7661
7077
  let claudeCredentialStoreSetting = (await readSettings()).claudeCredentialStore === "file" ? "file" : "auto";
@@ -7784,6 +7200,7 @@ async function startDaemon() {
7784
7200
  const sessionIdToFinishedSession = /* @__PURE__ */ new Map();
7785
7201
  let teamWorker;
7786
7202
  let autoRestart;
7203
+ let bundleReplacedSeen = false;
7787
7204
  let automationRunner;
7788
7205
  let projectPresence;
7789
7206
  const persisted = readPersistedSessions();
@@ -8079,8 +7496,22 @@ async function startDaemon() {
8079
7496
  if (options.spawnedBy) {
8080
7497
  extraEnv.HAPPY_SPAWNED_BY = options.spawnedBy;
8081
7498
  }
7499
+ let spawnAccountId = null;
7500
+ delete extraEnv[SPAWN_ACCOUNT_ENV];
7501
+ const accountAgent = (options.agent ?? "claude") === "claude" ? "claude" : options.agent === "codex" ? "codex" : null;
7502
+ if (accountAgent && accountServiceRef) {
7503
+ try {
7504
+ const requested = forkSpawnAccount(options.agentProfileId, options.parentSessionId, (id) => accountServiceRef.sessionAccount(id));
7505
+ spawnAccountId = accountServiceRef.resolveSpawnAccount(accountAgent, requested);
7506
+ } catch (error) {
7507
+ return { type: "error", errorMessage: error instanceof Error ? error.message : String(error) };
7508
+ }
7509
+ if (spawnAccountId) extraEnv[SPAWN_ACCOUNT_ENV] = spawnAccountId;
7510
+ } else if (options.agentProfileId) {
7511
+ return { type: "error", errorMessage: `agent-profile-unavailable:agent-mismatch: accounts are not supported for ${options.agent} yet` };
7512
+ }
8082
7513
  const claudeAuthStatus = claudeAuthServiceRef?.current()?.status;
8083
- if ((options.agent ?? "claude") === "claude" && claudeAuthStatus) {
7514
+ if ((options.agent ?? "claude") === "claude" && claudeAuthStatus && !spawnAccountId) {
8084
7515
  extraEnv.HAPPY_CLAUDE_AUTH_STATUS = claudeAuthStatus;
8085
7516
  }
8086
7517
  logger.debug(`[DAEMON RUN] Environment variable keys (before expansion) (${Object.keys(extraEnv).length}): ${Object.keys(extraEnv).join(", ")}`);
@@ -8524,6 +7955,7 @@ async function startDaemon() {
8524
7955
  }
8525
7956
  };
8526
7957
  const restartCounts = /* @__PURE__ */ new Map();
7958
+ const accountRestartCounts = /* @__PURE__ */ new Map();
8527
7959
  const autoRestartExits = /* @__PURE__ */ new Set();
8528
7960
  const stopSessionAndWait = async (happySessionId, timeoutMs = 8e3) => {
8529
7961
  const targets = /* @__PURE__ */ new Set();
@@ -8573,8 +8005,9 @@ async function startDaemon() {
8573
8005
  };
8574
8006
  const restartSessionImpl = async (happySessionId, options) => {
8575
8007
  try {
8576
- const prior = restartCounts.get(happySessionId) ?? 0;
8577
- const decision = options?.auto ? { allowed: true } : decideRestart(prior, DEFAULT_MAX_RESTARTS);
8008
+ const counts = options?.account ? accountRestartCounts : restartCounts;
8009
+ const prior = counts.get(happySessionId) ?? 0;
8010
+ const decision = options?.auto ? { allowed: true } : decideRestart(prior, options?.account ? DEFAULT_MAX_ACCOUNT_RESTARTS : DEFAULT_MAX_RESTARTS);
8578
8011
  if (!decision.allowed) {
8579
8012
  return { type: "error", errorMessage: `restart:${decision.reason}` };
8580
8013
  }
@@ -8625,7 +8058,7 @@ async function startDaemon() {
8625
8058
  if (model) args.push("--model", model);
8626
8059
  const permissionMode = sanitizeSpawnPermissionMode(options?.permissionMode ?? (options?.keepPublishedPermissionMode ? publishedRelaunchPermissionMode(metadata) : void 0));
8627
8060
  if (permissionMode) args.push("--permission-mode", permissionMode);
8628
- if (!options?.auto) restartCounts.set(happySessionId, recordRestartAttempt(prior));
8061
+ if (!options?.auto) counts.set(happySessionId, recordRestartAttempt(prior));
8629
8062
  const teamEnv = await teamRelaunchEnvFor(happySessionId, metadata);
8630
8063
  const result = await spawnTrackedHappyProcess({
8631
8064
  args,
@@ -8791,6 +8224,11 @@ async function startDaemon() {
8791
8224
  startedBy: metadata?.startedBy ?? null
8792
8225
  };
8793
8226
  };
8227
+ const upgradePending = () => pendingUpgradeVersion({
8228
+ daemonVersion: packageJson.version,
8229
+ autoUpdate: cliUpdateStateRef?.autoUpdate,
8230
+ bundleReplaced: bundleReplacedSeen
8231
+ });
8794
8232
  const autoRestartScheduler = createAutoRestart({
8795
8233
  enabled: () => autoRestartSetting,
8796
8234
  quietMs: resolveQuietMs(),
@@ -8845,6 +8283,7 @@ async function startDaemon() {
8845
8283
  if (!row || typeof row.active !== "boolean") return null;
8846
8284
  return { active: row.active, archived: row.archivedAt != null };
8847
8285
  },
8286
+ upgradePending,
8848
8287
  publish: (sessions) => {
8849
8288
  void apiMachineRef?.setAutoRestartSessions(sessions);
8850
8289
  },
@@ -8864,6 +8303,8 @@ async function startDaemon() {
8864
8303
  // B-501: `very-happy send --resume`
8865
8304
  restartSession,
8866
8305
  // B-794: `very-happy session provider`
8306
+ getAgentProfiles: () => accountServiceRef?.state() ?? null,
8307
+ // B-850a: `very-happy account list`
8867
8308
  requestShutdown: () => requestShutdown("happy-cli"),
8868
8309
  onHappySessionWebhook,
8869
8310
  onSessionStateEvent,
@@ -8891,6 +8332,9 @@ async function startDaemon() {
8891
8332
  // B-505: `daemon list` shows which sessions have a turn in flight, so an
8892
8333
  // operator can check the WHOLE machine before a supervised restart.
8893
8334
  isTurnActive: (sessionId) => turnActivity.activeSessions().includes(sessionId),
8335
+ // B-856: the auto-restart classification, readable locally (it is encrypted on the server).
8336
+ getAutoRestartStatus: (sessionId) => autoRestartScheduler.statuses()[sessionId],
8337
+ getDaemonInfo: () => ({ version: packageJson.version, upgradePending: upgradePending(), autoRestartEnabled: autoRestartSetting }),
8894
8338
  pushClipboard: (text, terminalId) => {
8895
8339
  if (!apiMachineRef) {
8896
8340
  return { delivered: false, truncated: false, totalBytes: 0, error: "daemon is still starting up" };
@@ -9045,6 +8489,36 @@ async function startDaemon() {
9045
8489
  return autoRestartSetting;
9046
8490
  });
9047
8491
  setTimeout(() => autoRestartScheduler.sweep(), 5e3).unref?.();
8492
+ const accountService = new AccountService({
8493
+ home: configuration.happyHomeDir,
8494
+ env: process.env,
8495
+ daemonPid: process.pid,
8496
+ spawnPty: (env) => spawnSetupTokenPty(os.homedir(), env),
8497
+ restartSession: async (sessionId) => {
8498
+ const result = await restartSession(sessionId, { keepPublishedPermissionMode: true, account: true });
8499
+ if (result.type === "success") return { ok: true };
8500
+ const error = result.type === "error" ? result.errorMessage : "unexpected restart result";
8501
+ const stillRunning = [...pidToTrackedSession.values()].some((s) => s.happySessionId === sessionId && isPidAlive(s.pid));
8502
+ return { ok: false, notRunning: error.startsWith("restart-precheck:not-tracked"), stillRunning, error };
8503
+ },
8504
+ onChanged: () => {
8505
+ void apiMachine.publishAgentProfiles();
8506
+ },
8507
+ // B-850b: a Codex account never binds to a Claude session and vice versa.
8508
+ sessionAgent: (sessionId) => {
8509
+ for (const tracked of pidToTrackedSession.values()) {
8510
+ if (tracked.happySessionId !== sessionId) continue;
8511
+ const flavor = tracked.happySessionMetadataFromLocalWebhook?.flavor ?? "claude";
8512
+ return flavor === "codex" ? "codex" : flavor === "claude" ? "claude" : flavor;
8513
+ }
8514
+ return void 0;
8515
+ }
8516
+ });
8517
+ accountServiceRef = accountService;
8518
+ apiMachine.setAgentProfileService(accountService);
8519
+ const stopAccountWatch = watchAccountFiles(configuration.happyHomeDir, () => {
8520
+ void apiMachine.publishAgentProfiles();
8521
+ });
9048
8522
  const webPanelsSync = startWebPanelsSync({
9049
8523
  statMtime: async () => (await fs.stat(configuration.settingsFile).catch(() => null))?.mtimeMs ?? null,
9050
8524
  readRaw: async () => (await readSettings()).webPanels,
@@ -9179,6 +8653,7 @@ async function startDaemon() {
9179
8653
  try {
9180
8654
  const currentMtimeMs = statSync$1(bundlePath).mtimeMs;
9181
8655
  bundleReplaced = currentMtimeMs !== initialBundleMtimeMs;
8656
+ if (bundleReplaced) bundleReplacedSeen = true;
9182
8657
  } catch {
9183
8658
  }
9184
8659
  }
@@ -9205,6 +8680,8 @@ async function startDaemon() {
9205
8680
  policyAnnouncements.stop();
9206
8681
  stopAgentVersionChecks();
9207
8682
  claudeAuthService.stop();
8683
+ stopAccountWatch();
8684
+ accountService.dispose();
9208
8685
  apiMachine.shutdown();
9209
8686
  await stopControlServer();
9210
8687
  await cleanupDaemonState();
@@ -9257,6 +8734,7 @@ async function startDaemon() {
9257
8734
  if (remaining.some(isPidAlive)) throw new Error("Worker still running; cleanup retained");
9258
8735
  },
9259
8736
  live: (id) => [...pidToTrackedSession.values()].some((s) => s.happySessionId === id && isPidAlive(s.pid)),
8737
+ ...accountServiceRef ? { resolveAccount: (agent, requested) => accountServiceRef.resolveSpawnAccount(agent, requested) } : {},
9260
8738
  log: (message) => logger.debug(`[DAEMON RUN] ${message}`)
9261
8739
  });
9262
8740
  automationRunner = createAutomationRunner({
@@ -9278,6 +8756,17 @@ async function startDaemon() {
9278
8756
  return waitForSessionLive(id, (sid) => [...pidToTrackedSession.values()].some((s) => s.happySessionId === sid && isPidAlive(s.pid)));
9279
8757
  },
9280
8758
  joinProject: (sessionId, projectId) => joinProject(projectsClient, sessionId, { kind: "explicit", projectId }, { via: "automation" }),
8759
+ // B-850d: sticky sessions follow the run's account; unusable → refused.
8760
+ ...accountServiceRef ? {
8761
+ accounts: {
8762
+ sessionAccount: (id) => accountServiceRef.sessionAccount(id),
8763
+ resolve: (agent, requested) => accountServiceRef.resolveSpawnAccount(agent, requested),
8764
+ rebind: async (sessionId, accountId) => {
8765
+ const result = await accountServiceRef.bind({ sessionId, accountId });
8766
+ if (result.restart === "failed") throw new Error(result.error ?? "restart failed");
8767
+ }
8768
+ }
8769
+ } : {},
9281
8770
  log: (message) => logger.debug(`[DAEMON RUN] ${message}`)
9282
8771
  });
9283
8772
  projectPresence = createProjectPresenceReporter({
@@ -9336,6 +8825,8 @@ async function startDaemon() {
9336
8825
  } catch (error) {
9337
8826
  logger.debug("[DAEMON RUN] Mirror shutdown failed:", error);
9338
8827
  }
8828
+ stopAccountWatch();
8829
+ accountService.dispose();
9339
8830
  apiMachine.shutdown();
9340
8831
  await stopControlServer();
9341
8832
  await cleanupDaemonState();