very-happy-cli 0.2.190 → 0.2.192
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AcpBackend-dkRv9QHm.cjs → AcpBackend-BQO4ShOy.cjs} +3 -3
- package/dist/{AcpBackend-Dd1h-Rgt.mjs → AcpBackend-CGHTDJd9.mjs} +3 -3
- package/dist/{AcpSessionManager-QBZ-CIf7.mjs → AcpSessionManager-G0xD6Jbq.mjs} +2 -2
- package/dist/{AcpSessionManager-AqWAqahm.cjs → AcpSessionManager-LlUMmcpB.cjs} +2 -2
- package/dist/{BasePermissionHandler-CLp1ge-4.mjs → BasePermissionHandler-BmTIg376.mjs} +1 -1
- package/dist/{BasePermissionHandler-CpSugp7Z.cjs → BasePermissionHandler-N6Ip3tFt.cjs} +1 -1
- package/dist/account-CCVT-HO_.mjs +240 -0
- package/dist/account-DtaouikP.cjs +245 -0
- package/dist/accountService-Bddy0zwL.cjs +571 -0
- package/dist/accountService-Dd9uqde2.mjs +566 -0
- package/dist/{acpSessionResume-CcpDuIO5.mjs → acpSessionResume-BWEUxNtC.mjs} +1 -1
- package/dist/{acpSessionResume-CZao6QEd.cjs → acpSessionResume-BnHDk5eD.cjs} +1 -1
- package/dist/{agentHome-BJGRA2Kx.mjs → agentHome-B0VnjkZW.mjs} +4 -4
- package/dist/{agentHome-fIUqT-pn.cjs → agentHome-CqQ29YY7.cjs} +4 -4
- package/dist/{api-Dw8gFsQi.mjs → api-_LeBScjg.mjs} +10 -10
- package/dist/{api-CXL6jp-p.cjs → api-hMDsC6Wg.cjs} +10 -10
- package/dist/{apiMachine-BBNEtjf7.mjs → apiMachine-CgRldeJ6.mjs} +76 -21
- package/dist/{apiMachine-C6UqHoPF.cjs → apiMachine-CqW2m6Zr.cjs} +81 -26
- package/dist/{attachmentContent-NmVfKp-B.cjs → attachmentContent-BEeT2J5n.cjs} +2 -2
- package/dist/{attachmentContent-CC4yIrSm.mjs → attachmentContent-CyptLIfq.mjs} +2 -2
- package/dist/{auth-Bb_SL2os.cjs → auth-C9NvNHhL.cjs} +5 -5
- package/dist/{auth-DKa4MsAi.cjs → auth-CA1OClsW.cjs} +8 -8
- package/dist/{auth-Bh6SUoGi.mjs → auth-CFQikywl.mjs} +8 -8
- package/dist/{auth-Bj0psrD2.mjs → auth-DL8_J9vu.mjs} +5 -5
- package/dist/{auto-DK7pbCnV.mjs → auto-CKI05w1D.mjs} +17 -17
- package/dist/{auto-C9Qohh0P.cjs → auto-uQOxlxLp.cjs} +17 -17
- package/dist/{bootstrap-Ct9Nb4sv.mjs → bootstrap-DaZ0Np7X.mjs} +2 -2
- package/dist/{bootstrap-DBJB0y-H.cjs → bootstrap-DsZGc69k.cjs} +2 -2
- package/dist/{browser-BGxDRhHy.mjs → browser-BUIaSHK2.mjs} +1 -1
- package/dist/{browser-CLJWcodR.cjs → browser-Ft0ASDm7.cjs} +1 -1
- package/dist/claudeAccountEnv-BOBpJ3k8.cjs +137 -0
- package/dist/claudeAccountEnv-ON24i0qv.mjs +132 -0
- package/dist/{claudeLocal-Ux31hZyC.mjs → claudeLocal-B1ZVtryl.mjs} +5 -5
- package/dist/{claudeLocal-B6YDYlnY.cjs → claudeLocal-BMf9t4Fa.cjs} +5 -5
- package/dist/{claudeLocalLauncher-D06QijMw.mjs → claudeLocalLauncher-Bp8bqF4y.mjs} +10 -10
- package/dist/{claudeLocalLauncher-DFvmF8rC.cjs → claudeLocalLauncher-C8TeJcfF.cjs} +10 -10
- package/dist/{claudeSessionFork-D2GI7P59.mjs → claudeSessionFork-8AA47z8Y.mjs} +1 -1
- package/dist/{claudeSessionFork-DTLZ2rek.cjs → claudeSessionFork-YiktY55n.cjs} +1 -1
- package/dist/{client-CnGNYidN.mjs → client-Bm4oKvW7.mjs} +2 -2
- package/dist/{client-CtL0Vtww.mjs → client-BmPaBnDK.mjs} +4 -4
- package/dist/{client-CARZ_lNS.cjs → client-CFHZfh9x.cjs} +4 -4
- package/dist/{client-Bffkrs5p.cjs → client-Crh8_cNx.cjs} +2 -2
- package/dist/{client-DZkBUoh9.mjs → client-Cxlp_D4I.mjs} +2 -2
- package/dist/{client-CMKGrnmT.cjs → client-D8XROyZc.cjs} +2 -2
- package/dist/codex/happyMcpStdioBridge.cjs +16 -16
- package/dist/codex/happyMcpStdioBridge.mjs +16 -16
- package/dist/{codexAppServerClient-CLc5nhLT.mjs → codexAppServerClient-BWJbLCQn.mjs} +3 -3
- package/dist/{codexAppServerClient-CpT9F6EM.cjs → codexAppServerClient-q8GHQhyC.cjs} +3 -3
- package/dist/{codexCommand-Dliq3EBv.mjs → codexCommand-BfXfRQr4.mjs} +121 -61
- package/dist/{codexCommand-39kH99SJ.cjs → codexCommand-BgpGg-Zy.cjs} +121 -61
- package/dist/{codexTermination-ByW7tRjr.cjs → codexTermination-CVUF0X75.cjs} +1 -1
- package/dist/{codexTermination-ORIw0gpU.mjs → codexTermination-s9fd1gkA.mjs} +1 -1
- package/dist/{config-CeIzCsfj.cjs → config-BAjyTyYp.cjs} +3 -3
- package/dist/{config-CxSsGO1Z.mjs → config-BF8XgLyc.mjs} +3 -3
- package/dist/{configuration-Dt5lKW3P.cjs → configuration-CXEVKAyF.cjs} +1 -1
- package/dist/{configuration-Dechcvd-.mjs → configuration-IhRiLDVe.mjs} +1 -1
- package/dist/{connect-UwQHvCpR.mjs → connect-LZh1gr08.mjs} +13 -13
- package/dist/{connect-NPDzIVC6.cjs → connect-rCS56arw.cjs} +13 -13
- package/dist/{context-BdZssgF0.cjs → context-3_S_mWz9.cjs} +1 -1
- package/dist/{context-C9JbJoNe.mjs → context-DO6F5YwH.mjs} +1 -1
- package/dist/{controlClient-D7NGfmtq.mjs → controlClient-8ILulwjc.mjs} +14 -5
- package/dist/{controlClient-BRk65BRO.cjs → controlClient-j7p5p3_7.cjs} +15 -4
- package/dist/{createSessionMetadata-B_HZCDj_.cjs → createSessionMetadata-DwdD_uVo.cjs} +2 -2
- package/dist/{createSessionMetadata-DyhFKAby.mjs → createSessionMetadata-oyaTZm1b.mjs} +2 -2
- package/dist/daemonAccounts-BCjDgoNt.cjs +51 -0
- package/dist/daemonAccounts-BJgt6IJe.mjs +27 -0
- package/dist/defaultPermissionMode-BFShzF55.cjs +49 -0
- package/dist/defaultPermissionMode-Lt3PUCwY.mjs +43 -0
- package/dist/{deterministicJson-BEygolBQ.cjs → deterministicJson-DUN0v3St.cjs} +13 -13
- package/dist/{deterministicJson-DNmMVhFu.mjs → deterministicJson-Dfp-7wUZ.mjs} +13 -13
- package/dist/{doctor-BdBi7TFZ.mjs → doctor-B_UwMcVT.mjs} +7 -7
- package/dist/{doctor-B9lW1WlG.cjs → doctor-FgUYTbAT.cjs} +7 -7
- package/dist/{downloadTarget-DS0zT2AU.cjs → downloadTarget-BrrQEDxg.cjs} +6 -6
- package/dist/{downloadTarget-CGojGjaN.mjs → downloadTarget-C0d6jRx-.mjs} +6 -6
- package/dist/{ensureDaemonRunning-Bibp6vhe.cjs → ensureDaemonRunning-Cq4FYI5Q.cjs} +5 -5
- package/dist/{ensureDaemonRunning-BOdbryDM.mjs → ensureDaemonRunning-KUMFfIil.mjs} +5 -5
- package/dist/{handleResumeCommand-CgLzBYne.mjs → handleResumeCommand-BGhVo3QH.mjs} +5 -5
- package/dist/{handleResumeCommand-DXOuWr4p.cjs → handleResumeCommand-Cl9GIL5F.cjs} +5 -5
- package/dist/{index-Db0HIC-k.mjs → index-BjXjMhGY.mjs} +4 -4
- package/dist/{index-BOe6dKnL.cjs → index-BzAYnYct.cjs} +186 -0
- package/dist/{index-CwRW11hT.cjs → index-CQ_hLLCj.cjs} +3 -3
- package/dist/{index-DXSIi6j_.cjs → index-CRipkiqo.cjs} +4 -4
- package/dist/{index-Bs5FD8JF.cjs → index-CZaLMmPC.cjs} +4 -4
- package/dist/{index-CBHfkQNY.mjs → index-Ca1Tt96A.mjs} +45 -41
- package/dist/{index-f8oDidjV.cjs → index-D8ODb0_U.cjs} +44 -40
- package/dist/{index-DmqsRnV7.mjs → index-DYD3GM1m.mjs} +168 -1
- package/dist/{index-rNTX33in.mjs → index-JQDyJ3Li.mjs} +3 -3
- package/dist/{index-DUByZsKe.mjs → index-v5EmjT8l.mjs} +4 -4
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/{install-CXIL_FYx.cjs → install-ClUA9tbC.cjs} +3 -3
- package/dist/{install-DfPrEWGG.mjs → install-D6EHRtAN.mjs} +3 -3
- package/dist/lib.cjs +12 -12
- package/dist/lib.d.cts +292 -0
- package/dist/lib.d.mts +292 -0
- package/dist/lib.mjs +12 -12
- package/dist/{lidState-D0DF20oG.mjs → lidState-CZOXXdzv.mjs} +1 -1
- package/dist/{lidState-q_XFYg33.cjs → lidState-DqoN7zH4.cjs} +1 -1
- package/dist/{localHappyAgentAuth-CKNW-MXw.cjs → localHappyAgentAuth-BnGCpHRX.cjs} +1 -1
- package/dist/{localHappyAgentAuth-BBhM4Qk1.mjs → localHappyAgentAuth-YHxDZ4x4.mjs} +1 -1
- package/dist/{logger-BBRTTVsQ.cjs → logger-8su64lqR.cjs} +2 -2
- package/dist/{logger-CL7pin9b.mjs → logger-Fd_rNvgd.mjs} +2 -2
- package/dist/{machineMetadata-DP06qdBk.mjs → machineMetadata-1HIIC7Bc.mjs} +3 -3
- package/dist/{machineMetadata-DnFNlrVK.cjs → machineMetadata-DYXt3p6u.cjs} +3 -3
- package/dist/{main-DO7nRvhf.mjs → main-BI6GIzUL.mjs} +92 -48
- package/dist/{main-DLOXykOR.cjs → main-C_GrcYkn.cjs} +92 -48
- package/dist/{mcp-Du0MgR7e.cjs → mcp-BycIv9oQ.cjs} +18 -15
- package/dist/{mcp-C-4sPTae.mjs → mcp-XGoxywno.mjs} +18 -15
- package/dist/{mirrorProtocol-GuWMxLkh.cjs → mirrorProtocol-DVnB8EO8.cjs} +3 -3
- package/dist/{mirrorProtocol-dkq2ZENA.mjs → mirrorProtocol-DXT3rv7T.mjs} +3 -3
- package/dist/{package-C6uiXULx.mjs → package-6KkRAops.mjs} +7 -7
- package/dist/{package-DrY090nZ.cjs → package-iuLlSiSF.cjs} +7 -7
- package/dist/{panels-4DRBKHZP.cjs → panels-0C89q0Tu.cjs} +5 -5
- package/dist/{panels-DXYdJA6n.mjs → panels-B5Di2zb2.mjs} +5 -5
- package/dist/{peerTools-5ZM4spcZ.cjs → peerTools-CANTX_mG.cjs} +5 -5
- package/dist/{peerTools-dY1aJez4.mjs → peerTools-CKJ-IDM4.mjs} +5 -5
- package/dist/{persistence-Bl5S3TLB.cjs → persistence-B4ttN-fR.cjs} +2 -2
- package/dist/{persistence-Dogj7JIp.mjs → persistence-DWcHe035.mjs} +2 -2
- package/dist/{piRunnerArgs-C3jZ1M6b.cjs → piRunnerArgs-BOkfxyak.cjs} +1 -1
- package/dist/{piRunnerArgs-D8nN_Iit.mjs → piRunnerArgs-Bl5GpBoN.mjs} +2 -2
- package/dist/{piRuntime-BoeMsAXK.mjs → piRuntime-BhwxzdQf.mjs} +1 -1
- package/dist/{piRuntime-Bd9-eq6M.cjs → piRuntime-DzrIiZU8.cjs} +1 -1
- package/dist/{piTerminal-C3j1ca3x.cjs → piTerminal-BdS7ol7v.cjs} +20 -17
- package/dist/{piTerminal-GEPkIGD4.mjs → piTerminal-DnA2CbGr.mjs} +20 -17
- package/dist/{pushNotifications-CfspRcl-.cjs → pushNotifications-BqFoLye2.cjs} +12 -3
- package/dist/{pushNotifications-dUceOIni.mjs → pushNotifications-DkQ0yvFs.mjs} +12 -3
- package/dist/{query-DjsVgG3E.cjs → query-BQ4br3yn.cjs} +1 -1
- package/dist/{query-iYH-tm7L.mjs → query-BRJYSkb1.mjs} +1 -1
- package/dist/{rateLimitReporter-jeVi-fym.mjs → rateLimitReporter-BRbYkmuP.mjs} +3 -3
- package/dist/{rateLimitReporter-DUu2KydZ.cjs → rateLimitReporter-DK5SQuCc.cjs} +3 -3
- package/dist/{rateLimitWindows-Bx3ROBP5.cjs → rateLimitWindows-DBfiuYeg.cjs} +1 -1
- package/dist/{rateLimitWindows-CEn0DXaX.mjs → rateLimitWindows-Da5AR-4u.mjs} +1 -1
- package/dist/reconnectEnv-B31lY4nR.cjs +27 -0
- package/dist/reconnectEnv-DeSvHl3q.mjs +24 -0
- package/dist/{registerCommonHandlers-Beun-cQv.cjs → registerCommonHandlers-m6pxxf2J.cjs} +2 -2
- package/dist/{registerCommonHandlers-DWZ7mfdt.mjs → registerCommonHandlers-yQ7Ru-l0.mjs} +2 -2
- package/dist/{registerKillSessionHandler-CA1FFr_F.cjs → registerKillSessionHandler-BAOIa_Fs.cjs} +6 -6
- package/dist/{registerKillSessionHandler-CzgklwLG.mjs → registerKillSessionHandler-BDNpi7YO.mjs} +6 -6
- package/dist/{remoteSessionClient-BiC2KDew.mjs → remoteSessionClient-CZ7aaNgj.mjs} +5 -5
- package/dist/{remoteSessionClient-DGFI__5Z.cjs → remoteSessionClient-iJMXRN_D.cjs} +5 -5
- package/dist/{reportProgressTool-CgPy6n_7.mjs → reportProgressTool-DfQhPu0s.mjs} +3 -3
- package/dist/{reportProgressTool-CvPGov1F.cjs → reportProgressTool-DpFs7pSe.cjs} +3 -3
- package/dist/{run-B_gFgJVB.mjs → run-CwN28mcj.mjs} +215 -52
- package/dist/{run-rPqQwDi_.cjs → run-p-xp1_HY.cjs} +214 -51
- package/dist/{runClaude-DM8gm8iu.cjs → runClaude-D6U1Z575.cjs} +83 -48
- package/dist/{runClaude-CykqeXK7.mjs → runClaude-DRKtAGTm.mjs} +83 -48
- package/dist/{runClaudeDeps-D2phXGut.mjs → runClaudeDeps-BheVcIlD.mjs} +147 -69
- package/dist/{runClaudeDeps-DGAomimZ.cjs → runClaudeDeps-Dkofokgb.cjs} +142 -64
- package/dist/{runGemini-CXTeSOZp.cjs → runGemini-C8q3YCc0.cjs} +33 -33
- package/dist/{runGemini-CtWCVkj5.mjs → runGemini-owbvhFbi.mjs} +33 -33
- package/dist/{runOpenClaw-CH_9_RyZ.cjs → runOpenClaw-DGeN66-t.cjs} +18 -18
- package/dist/{runOpenClaw-BBdjlViJ.mjs → runOpenClaw-Dky3-mjO.mjs} +18 -18
- package/dist/{sandbox-Bb5IMun3.cjs → sandbox-D2CPyoCA.cjs} +4 -4
- package/dist/{sandbox-DGmXZ6Zz.mjs → sandbox-sq_wy9Gl.mjs} +4 -4
- package/dist/{selfCheck-CccwNTTK.cjs → selfCheck-BgLvQKSt.cjs} +39 -37
- package/dist/selfCheck-vkfrgQ7X.mjs +88 -0
- package/dist/{send-BpiXPkDo.cjs → send-Cd10YhXh.cjs} +8 -8
- package/dist/{send-B6rHg8GT.mjs → send-K9vg-8t-.mjs} +8 -8
- package/dist/{server-DHUzjApC.cjs → server-DRrV64r0.cjs} +6 -6
- package/dist/{server-BkdAyHhC.mjs → server-De4W1zuK.mjs} +4 -4
- package/dist/{sessionLock-BFBReiKq.cjs → sessionLock-BDtSzzKS.cjs} +10 -3
- package/dist/{sessionLock-Ca_bIo50.mjs → sessionLock-Dl6i7IgA.mjs} +10 -4
- package/dist/{sessionOps-DeWVqpe4.cjs → sessionOps-DvnEH4PL.cjs} +6 -4
- package/dist/{sessionOps-CA2kpm66.mjs → sessionOps-gU88-W9F.mjs} +6 -4
- package/dist/sessionProvider-CKcIo7KO.mjs +108 -0
- package/dist/sessionProvider-CbSZeZrl.cjs +113 -0
- package/dist/{sessionScanner-CGzsN8V6.cjs → sessionScanner-7RtcCeyD.cjs} +3 -3
- package/dist/{sessionScanner-DDDud5re.mjs → sessionScanner-DR32uSby.mjs} +3 -3
- package/dist/{sessions-CKJPWFgu.cjs → sessions-BvuMjgvJ.cjs} +10 -10
- package/dist/{sessions-B4d50sCI.mjs → sessions-DTt2Eguk.mjs} +10 -10
- package/dist/{setupOfflineReconnection-CyPNgyCe.mjs → setupOfflineReconnection-BGnvhRfb.mjs} +2 -2
- package/dist/{setupOfflineReconnection-DPXRo_zf.cjs → setupOfflineReconnection-DduOsw6p.cjs} +2 -2
- package/dist/{spawn-CrYN_OOT.mjs → spawn-CL3cUc7b.mjs} +26 -17
- package/dist/{spawn-CgSJzzWS.cjs → spawn-DMB6rRPA.cjs} +26 -17
- package/dist/{spawnAgents-C1-4m7aN.cjs → spawnAgents-CClb7buD.cjs} +8 -2
- package/dist/{spawnAgents-DWCDYCQ1.mjs → spawnAgents-CRMfOJhh.mjs} +8 -2
- package/dist/{spawnHappyCLI-DjbkiSH1.mjs → spawnHappyCLI-Cj_6IICe.mjs} +1 -1
- package/dist/{spawnHappyCLI-CTy3p6V_.cjs → spawnHappyCLI-DJdhX_Qx.cjs} +1 -1
- package/dist/{startFileWatcher-Dedtu1vq.mjs → startFileWatcher-DikVa8kg.mjs} +1 -1
- package/dist/{startFileWatcher-BQs0cJA-.cjs → startFileWatcher-LnOmVW6H.cjs} +1 -1
- package/dist/{startupSessionCreate-Dxy3X4DG.cjs → startupSessionCreate-B3ND-917.cjs} +3 -3
- package/dist/{startupSessionCreate-BKFU4v_h.mjs → startupSessionCreate-CDdaLaMq.mjs} +3 -3
- package/dist/store--XN-7MS0.mjs +269 -0
- package/dist/store-DV__wCvP.cjs +289 -0
- package/dist/{streamRelay-D9a4cBEa.cjs → streamRelay-DFdOaLOn.cjs} +1 -1
- package/dist/{streamRelay-P9e7Sohm.mjs → streamRelay-sABnxEXq.mjs} +1 -1
- package/dist/{sync-eZkXnsW_.mjs → sync-JoEZKRo8.mjs} +1 -1
- package/dist/{sync-DtWB7RzA.cjs → sync-_2lsZ1U2.cjs} +1 -1
- package/dist/{systemPrompt-2XOpZ1j6.cjs → systemPrompt-CJEvNCuW.cjs} +2 -2
- package/dist/{systemPrompt-Bn6g6aCH.mjs → systemPrompt-Zq4HyrZ5.mjs} +2 -2
- package/dist/{teams-ecFay4Gn.cjs → teams-BNZafnrT.cjs} +7 -7
- package/dist/{teams-nadkqrbW.mjs → teams-qz4LqKJ2.mjs} +7 -7
- package/dist/{template-BiTD-jI9.mjs → template-CJ8BWSsc.mjs} +1 -1
- package/dist/{template-17HATY_Y.cjs → template-LgvBbOna.cjs} +1 -1
- package/dist/{time-gPD_EmA-.cjs → time-CaUlWSNJ.cjs} +1 -1
- package/dist/{time-CN3TuSVG.mjs → time-bzmet4s5.mjs} +1 -1
- package/dist/{titleGenerator-lT5ldPuN.cjs → titleGenerator-BuIIu_JP.cjs} +17 -13
- package/dist/{titleGenerator-DgzTQdn2.mjs → titleGenerator-CbTtJ_1D.mjs} +16 -12
- package/dist/{todo-B1VeMk5A.cjs → todo-CQ_BTf9C.cjs} +6 -6
- package/dist/{todo-BIxd7l2Q.mjs → todo-DIrVF_Ak.mjs} +6 -6
- package/dist/{tools-DvqbLsCF.cjs → tools-BnmmFZji.cjs} +1 -1
- package/dist/{tools-zXJpxiG_.mjs → tools-cLOjBvPn.mjs} +1 -1
- package/dist/{uninstall-9htK6mb7.mjs → uninstall-C5OuW6dE.mjs} +3 -3
- package/dist/{uninstall-CvIOpwB5.cjs → uninstall-uEEGKB84.cjs} +3 -3
- package/dist/wrapperAccount-DXlD3bsO.mjs +106 -0
- package/dist/wrapperAccount-DzoGqS2b.cjs +110 -0
- package/package.json +7 -7
- package/dist/defaultPermissionMode-BnxJPVHT.mjs +0 -4
- package/dist/defaultPermissionMode-CxmTXUQR.cjs +0 -7
- package/dist/providerBinding-B-Qbx9W2.cjs +0 -140
- package/dist/providerBinding-CYubGg-Z.mjs +0 -132
- package/dist/selfCheck-BfK945YQ.mjs +0 -86
- package/dist/sessionProvider-VFbtUmMR.cjs +0 -114
- package/dist/sessionProvider-g18IiK74.mjs +0 -109
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
import { a as authenticatedAutomationsClient, b as automationRunIdFromEnv } from './client-
|
|
2
|
+
import { z as AutomationNameSchema, h as AUTOMATION_ATTENTION_REASON_MAX_CHARS, j as AUTOMATION_SUMMARY_MAX_CHARS, e as AutomationPrecheckSchema, D as AutomationConcurrencySchema, E as AutomationActionSchema, F as AutomationTriggerSchema } from './index-DYD3GM1m.mjs';
|
|
3
|
+
import { a as authenticatedAutomationsClient, b as automationRunIdFromEnv } from './client-Cxlp_D4I.mjs';
|
|
4
4
|
import { u as updateAutomationChecked, c as createAutomationChecked } from './precheckCompat-DeEbilbr.mjs';
|
|
5
|
-
import { P as ProjectsUnsupportedError, a as ProjectRequestError, s as sharedProjectsClient } from './client-
|
|
5
|
+
import { P as ProjectsUnsupportedError, a as ProjectRequestError, s as sharedProjectsClient } from './client-Bm4oKvW7.mjs';
|
|
6
6
|
import { f as formatContextForTool } from './prompt-QHuFx9j6.mjs';
|
|
7
7
|
import { R as REPORT_PROGRESS_TOOL_NAME, d as REPORT_PROGRESS_TOOL_TITLE, e as REPORT_PROGRESS_TOOL_DESCRIPTION } from './agentGuidance-BDYt2Qy2.mjs';
|
|
8
8
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var z = require('zod');
|
|
4
|
-
var index = require('./index-
|
|
5
|
-
var client = require('./client-
|
|
4
|
+
var index = require('./index-BzAYnYct.cjs');
|
|
5
|
+
var client = require('./client-Crh8_cNx.cjs');
|
|
6
6
|
var precheckCompat = require('./precheckCompat-CWOi5c9L.cjs');
|
|
7
|
-
var client$1 = require('./client-
|
|
7
|
+
var client$1 = require('./client-D8XROyZc.cjs');
|
|
8
8
|
var prompt = require('./prompt-Bof2aQkI.cjs');
|
|
9
9
|
var agentGuidance = require('./agentGuidance-BtBx2xxE.cjs');
|
|
10
10
|
|
|
@@ -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-
|
|
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-DXT3rv7T.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-
|
|
3
|
+
import { P as PI_ADAPTER_INSTALL_HINT, s as sanitizeSpawnModel } from './piRunnerArgs-Bl5GpBoN.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,
|
|
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-
|
|
11
|
-
import { T as TurnActivityTracker, A as ApiClient } from './api-
|
|
12
|
-
import { S as SPAWN_AGENTS, i as isSpawnAgent, s as sanitizeSpawnPermissionMode, r as resolveSpawnPermissionMode, a as resolveFirstMessageMeta, j as joinProject } from './spawnAgents-
|
|
13
|
-
import { l as logger } from './logger-
|
|
14
|
-
import { p as pruneStaleCompileCaches } from './index-
|
|
15
|
-
import { a as authAndSetupMachineIfNeeded } from './auth-
|
|
10
|
+
import { f as ensurePrivateDirectorySync, w as writePrivateFileSync, c as configuration } from './configuration-IhRiLDVe.mjs';
|
|
11
|
+
import { T as TurnActivityTracker, A as ApiClient } from './api-_LeBScjg.mjs';
|
|
12
|
+
import { S as SPAWN_AGENTS, i as isSpawnAgent, s as sanitizeSpawnPermissionMode, r as resolveSpawnPermissionMode, a as resolveFirstMessageMeta, j as joinProject } from './spawnAgents-CRMfOJhh.mjs';
|
|
13
|
+
import { l as logger } from './logger-Fd_rNvgd.mjs';
|
|
14
|
+
import { p as pruneStaleCompileCaches } from './index-JQDyJ3Li.mjs';
|
|
15
|
+
import { a as authAndSetupMachineIfNeeded } from './auth-DL8_J9vu.mjs';
|
|
16
16
|
import { spawn, execSync } from 'child_process';
|
|
17
|
-
import { p as packageJson } from './package-
|
|
18
|
-
import { a as globalPrefixForPackage, N as NPM_SAFE_ARG, g as getEnvironmentInfo } from './doctor-
|
|
19
|
-
import { s as spawnHappyCLI } from './spawnHappyCLI-
|
|
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-
|
|
21
|
-
import { i as isDaemonRunningCurrentlyInstalledHappyVersion, s as stopDaemon,
|
|
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-
|
|
17
|
+
import { p as packageJson } from './package-6KkRAops.mjs';
|
|
18
|
+
import { a as globalPrefixForPackage, N as NPM_SAFE_ARG, g as getEnvironmentInfo } from './doctor-B_UwMcVT.mjs';
|
|
19
|
+
import { s as spawnHappyCLI } from './spawnHappyCLI-Cj_6IICe.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-DWcHe035.mjs';
|
|
21
|
+
import { i as isDaemonRunningCurrentlyInstalledHappyVersion, s as stopDaemon, w as cleanupDaemonState } from './controlClient-8ILulwjc.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-gU88-W9F.mjs';
|
|
23
|
+
import { G as AgentProfilesStateSchema, a6 as ServerMigrateNoticeSchema, a7 as isHarnessInstallId, a8 as MODEL_INTENT_CONFIG, j as AUTOMATION_SUMMARY_MAX_CHARS, a9 as AUTOMATION_PRECHECK_OUTPUT_MAX_CHARS, aa as AUTOMATION_PRECHECK_DEFAULT_TIMEOUT_MS, d as AUTOMATION_PRECHECK_MAX_TIMEOUT_MS, ab as AUTOMATION_CLAIM_MAX_RUNS, ac as AUTOMATION_DAEMON_CAPABILITY_PRECHECK, ad as AUTOMATION_DEFAULT_LEASE_MS, i as isAutomationRunTerminal, ae as HARNESS_INSTALL_CAPABILITY_VERSION } from './index-DYD3GM1m.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,68 @@ 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-
|
|
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-
|
|
31
|
+
import { b as sanitizeRateLimitReport } from './rateLimitWindows-Da5AR-4u.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-CKJ-IDM4.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-
|
|
34
|
-
import { assistantHome, bootstrapAssistantHome } from './bootstrap-
|
|
35
|
-
import { refreshAgentHomes, locateClaudeConversation, agentHomeSpawnEnv } from './index-
|
|
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-CZ7aaNgj.mjs';
|
|
35
|
+
import { assistantHome, bootstrapAssistantHome } from './bootstrap-DaZ0Np7X.mjs';
|
|
36
|
+
import { refreshAgentHomes, locateClaudeConversation, agentHomeSpawnEnv } from './index-v5EmjT8l.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-
|
|
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-1HIIC7Bc.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';
|
|
44
45
|
import require$$3 from 'crypto';
|
|
45
46
|
import { c as commandOnPath } from './detectCLI-CSGMlV51.mjs';
|
|
46
|
-
import { buildResumeLaunch } from './handleResumeCommand-
|
|
47
|
+
import { buildResumeLaunch } from './handleResumeCommand-BGhVo3QH.mjs';
|
|
47
48
|
import { n as normalizeWebPanels } from './webPanels-B2_C2-3g.mjs';
|
|
48
|
-
import { M as ServerMigrateNoticeSchema, N as isHarnessInstallId, e as AUTOMATION_SUMMARY_MAX_CHARS, Q as AUTOMATION_PRECHECK_OUTPUT_MAX_CHARS, T as AUTOMATION_PRECHECK_DEFAULT_TIMEOUT_MS, b as AUTOMATION_PRECHECK_MAX_TIMEOUT_MS, U as AUTOMATION_CLAIM_MAX_RUNS, V as AUTOMATION_DAEMON_CAPABILITY_PRECHECK, W as AUTOMATION_DEFAULT_LEASE_MS, i as isAutomationRunTerminal, X as HARNESS_INSTALL_CAPABILITY_VERSION } from './index-DmqsRnV7.mjs';
|
|
49
49
|
import { access, symlink, readFile, rm, unlink, readlink, lstat, constants, rename, mkdir, copyFile, readdir, stat, open } from 'node:fs/promises';
|
|
50
50
|
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-
|
|
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
|
|
53
|
-
import { c as createAutomationsClient, i as isAutomationsUnavailable, d as AutomationsRequestError } from './client-
|
|
51
|
+
import { P as ProjectsUnsupportedError, c as createProjectsClient } from './client-Bm4oKvW7.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 pendingUpgradeVersion, v as resolveQuietMs, x as AUTO_RESTART_RECHECK_CAP_MS } from './sessionLock-Dl6i7IgA.mjs';
|
|
53
|
+
import { c as createAutomationsClient, i as isAutomationsUnavailable, d as AutomationsRequestError } from './client-Cxlp_D4I.mjs';
|
|
54
54
|
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';
|
|
55
|
+
import { A as AccountService } from './accountService-Dd9uqde2.mjs';
|
|
56
|
+
import { spawnSetupTokenPty, watchAccountFiles } from './daemonAccounts-BJgt6IJe.mjs';
|
|
55
57
|
import { g as getProjectPath } from './path-D2wdaNSk.mjs';
|
|
56
58
|
import { b as extractClaudeEditPaths } from './editPaths-BVfS_FFL.mjs';
|
|
57
|
-
import { s as startFileWatcher } from './startFileWatcher-
|
|
58
|
-
import { I as InvalidateSync } from './sync-
|
|
59
|
+
import { s as startFileWatcher } from './startFileWatcher-DikVa8kg.mjs';
|
|
60
|
+
import { I as InvalidateSync } from './sync-JoEZKRo8.mjs';
|
|
59
61
|
import { R as RawJSONLinesSchema } from './types-CkqAACXx.mjs';
|
|
60
62
|
import { t as tmuxArgs, a as scrubTmuxClientEnv, s as shellescape } from './tmuxSocket-B8Yx20sT.mjs';
|
|
61
63
|
import { findAllHappyProcesses } from './doctor-BPkYWSuq.mjs';
|
|
62
64
|
import { T as TEAM_SKILL, a as TEAM_LEAD_PLAYBOOK, b as TEAM_MEMBER_RULES } from './resources-CLP_MpK4.mjs';
|
|
63
65
|
import { promisify } from 'node:util';
|
|
64
|
-
import { b as clipText, r as renderAction, c as clipAutomationReport, e as renderTemplate } from './template-
|
|
66
|
+
import { b as clipText, r as renderAction, c as clipAutomationReport, e as renderTemplate } from './template-CJ8BWSsc.mjs';
|
|
65
67
|
import { d as describeAgentHome } from './loginShellEnv-Dw8M7tkI.mjs';
|
|
66
|
-
import './
|
|
67
|
-
import './
|
|
68
|
+
import { S as SPAWN_ACCOUNT_ENV } from './store--XN-7MS0.mjs';
|
|
69
|
+
import './acpSessionResume-BWEUxNtC.mjs';
|
|
70
|
+
import './lidState-CZOXXdzv.mjs';
|
|
68
71
|
import 'node:events';
|
|
69
72
|
import 'socket.io-client';
|
|
70
|
-
import './pushNotifications-
|
|
73
|
+
import './pushNotifications-DkQ0yvFs.mjs';
|
|
71
74
|
import './contentLogMetadata-BlWI0egu.mjs';
|
|
72
75
|
import './limits-DIo7rEBR.mjs';
|
|
73
|
-
import './time-
|
|
74
|
-
import './registerCommonHandlers-
|
|
76
|
+
import './time-bzmet4s5.mjs';
|
|
77
|
+
import './registerCommonHandlers-yQ7Ru-l0.mjs';
|
|
75
78
|
import 'util';
|
|
76
79
|
import 'cross-spawn';
|
|
77
80
|
import '@paralleldrive/cuid2';
|
|
78
81
|
import 'chalk';
|
|
79
82
|
import 'node:module';
|
|
80
83
|
import 'tweetnacl';
|
|
81
|
-
import './browser-
|
|
84
|
+
import './browser-BUIaSHK2.mjs';
|
|
82
85
|
import 'open';
|
|
83
86
|
import './specialCommands-MXUN0wfI.mjs';
|
|
84
87
|
import './ids-DU6sLx4C.mjs';
|
|
85
88
|
import 'url';
|
|
86
|
-
import './localHappyAgentAuth-
|
|
89
|
+
import './localHappyAgentAuth-YHxDZ4x4.mjs';
|
|
87
90
|
import './processTreeSnapshot-CuLJDNC-.mjs';
|
|
91
|
+
import './claudeAccountEnv-ON24i0qv.mjs';
|
|
92
|
+
import 'node-pty';
|
|
88
93
|
import 'ps-list';
|
|
89
94
|
|
|
90
95
|
async function resolveRelaunchMetadata(snapshot, fetchServer) {
|
|
@@ -180,8 +185,34 @@ async function teamRelaunchEnv(input) {
|
|
|
180
185
|
const DEFAULT_LOG_PRUNE_POLICY = {
|
|
181
186
|
maxAgeMs: 14 * 24 * 60 * 6e4,
|
|
182
187
|
maxTotalBytes: 200 * 1024 * 1024,
|
|
183
|
-
keepRecentCount: 10
|
|
188
|
+
keepRecentCount: 10,
|
|
189
|
+
keepDaemonLogs: 3,
|
|
190
|
+
maxDaemonLogBytes: 64 * 1024 * 1024
|
|
184
191
|
};
|
|
192
|
+
const DAEMON_LOG_SUFFIX = "-daemon.log";
|
|
193
|
+
function planDaemonLogRetention(files, policy = DEFAULT_LOG_PRUNE_POLICY, protectedPaths = /* @__PURE__ */ new Set()) {
|
|
194
|
+
const keep = /* @__PURE__ */ new Set();
|
|
195
|
+
let trim = null;
|
|
196
|
+
const count = policy.keepDaemonLogs ?? 0;
|
|
197
|
+
let budget = policy.maxDaemonLogBytes ?? 0;
|
|
198
|
+
if (count <= 0 || budget <= 0) return { keep, trim };
|
|
199
|
+
const daemonLogs = files.filter((f) => f.path.endsWith(DAEMON_LOG_SUFFIX) && !protectedPaths.has(f.path)).sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
200
|
+
for (const f of daemonLogs) {
|
|
201
|
+
if (keep.size >= count || budget <= 0) break;
|
|
202
|
+
if (keep.size === 0) {
|
|
203
|
+
keep.add(f.path);
|
|
204
|
+
if (f.size > budget) {
|
|
205
|
+
trim = { path: f.path, keepBytes: budget };
|
|
206
|
+
budget = 0;
|
|
207
|
+
} else budget -= f.size;
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
if (f.size > budget) break;
|
|
211
|
+
keep.add(f.path);
|
|
212
|
+
budget -= f.size;
|
|
213
|
+
}
|
|
214
|
+
return { keep, trim };
|
|
215
|
+
}
|
|
185
216
|
function planLogPrune(files, now, policy = DEFAULT_LOG_PRUNE_POLICY, protectedPaths = /* @__PURE__ */ new Set()) {
|
|
186
217
|
const sorted = [...files].sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
187
218
|
const doomed = /* @__PURE__ */ new Set();
|
|
@@ -210,7 +241,9 @@ function pruneLogsDir(logsDir, protectedPaths = /* @__PURE__ */ new Set(), polic
|
|
|
210
241
|
} catch {
|
|
211
242
|
return 0;
|
|
212
243
|
}
|
|
213
|
-
const
|
|
244
|
+
const daemonLogs = planDaemonLogRetention(files, policy, protectedPaths);
|
|
245
|
+
if (daemonLogs.trim) trimToTail(daemonLogs.trim.path, daemonLogs.trim.keepBytes);
|
|
246
|
+
const doomed = planLogPrune(files.filter((f) => !daemonLogs.keep.has(f.path)), Date.now(), policy, protectedPaths);
|
|
214
247
|
let deleted = 0;
|
|
215
248
|
for (const p of doomed) {
|
|
216
249
|
try {
|
|
@@ -221,6 +254,36 @@ function pruneLogsDir(logsDir, protectedPaths = /* @__PURE__ */ new Set(), polic
|
|
|
221
254
|
}
|
|
222
255
|
return deleted;
|
|
223
256
|
}
|
|
257
|
+
function trimToTail(path, keepBytes) {
|
|
258
|
+
let fd = null;
|
|
259
|
+
try {
|
|
260
|
+
const st = statSync(path);
|
|
261
|
+
if (st.size <= keepBytes) return;
|
|
262
|
+
const marker = Buffer.from(`[log trimmed to its last ${keepBytes} bytes by the daemon log retention]
|
|
263
|
+
`);
|
|
264
|
+
const tailBytes = Math.max(0, keepBytes - marker.length);
|
|
265
|
+
fd = openSync(path, "r+");
|
|
266
|
+
const tail = Buffer.alloc(tailBytes);
|
|
267
|
+
let read = 0;
|
|
268
|
+
while (read < tailBytes) {
|
|
269
|
+
const n = readSync(fd, tail, read, tailBytes - read, st.size - tailBytes + read);
|
|
270
|
+
if (n <= 0) break;
|
|
271
|
+
read += n;
|
|
272
|
+
}
|
|
273
|
+
writeSync(fd, marker, 0, marker.length, 0);
|
|
274
|
+
writeSync(fd, tail, 0, read, marker.length);
|
|
275
|
+
ftruncateSync(fd, marker.length + read);
|
|
276
|
+
closeSync(fd);
|
|
277
|
+
fd = null;
|
|
278
|
+
utimesSync(path, st.atime, st.mtime);
|
|
279
|
+
} catch {
|
|
280
|
+
} finally {
|
|
281
|
+
if (fd !== null) try {
|
|
282
|
+
closeSync(fd);
|
|
283
|
+
} catch {
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
224
287
|
|
|
225
288
|
function createSpawnTimer(clock = Date.now) {
|
|
226
289
|
const requestAt = clock();
|
|
@@ -506,6 +569,7 @@ function sanitizeResumeModel(value) {
|
|
|
506
569
|
}
|
|
507
570
|
|
|
508
571
|
const DEFAULT_MAX_RESTARTS = 3;
|
|
572
|
+
const DEFAULT_MAX_ACCOUNT_RESTARTS = 50;
|
|
509
573
|
function decideRestart(priorAttempts, max = DEFAULT_MAX_RESTARTS) {
|
|
510
574
|
if (priorAttempts >= max) {
|
|
511
575
|
return {
|
|
@@ -562,6 +626,19 @@ const BackgroundTaskInfoSchema = z.object({
|
|
|
562
626
|
description: z.string().max(BACKGROUND_TASK_DESCRIPTION_MAX + 1),
|
|
563
627
|
startedAt: z.number()
|
|
564
628
|
});
|
|
629
|
+
const AutoRestartStatusSchema = z.object({
|
|
630
|
+
state: z.string(),
|
|
631
|
+
reason: z.string().optional(),
|
|
632
|
+
since: z.number(),
|
|
633
|
+
target: z.string(),
|
|
634
|
+
offline: z.boolean().optional(),
|
|
635
|
+
retryAt: z.number().optional()
|
|
636
|
+
});
|
|
637
|
+
const DaemonListInfoSchema = z.object({
|
|
638
|
+
version: z.string(),
|
|
639
|
+
upgradePending: z.string().nullable(),
|
|
640
|
+
autoRestartEnabled: z.boolean()
|
|
641
|
+
});
|
|
565
642
|
const BackgroundTasksReportSchema = z.object({
|
|
566
643
|
count: z.number().int().nonnegative(),
|
|
567
644
|
tasks: z.array(BackgroundTaskInfoSchema),
|
|
@@ -590,8 +667,11 @@ function startDaemonControlServer({
|
|
|
590
667
|
onSessionEdit,
|
|
591
668
|
listPeers,
|
|
592
669
|
isTurnActive,
|
|
670
|
+
getAutoRestartStatus,
|
|
671
|
+
getDaemonInfo,
|
|
593
672
|
onRateLimits,
|
|
594
|
-
onHibernateCheck
|
|
673
|
+
onHibernateCheck,
|
|
674
|
+
getAgentProfiles
|
|
595
675
|
}) {
|
|
596
676
|
return new Promise((resolve) => {
|
|
597
677
|
const app = fastify({
|
|
@@ -697,6 +777,16 @@ function startDaemonControlServer({
|
|
|
697
777
|
}
|
|
698
778
|
});
|
|
699
779
|
}
|
|
780
|
+
typed.post("/agent-profiles", {
|
|
781
|
+
schema: { response: { 200: AgentProfilesStateSchema, 503: z.object({ error: z.string() }) } }
|
|
782
|
+
}, async (_request, reply) => {
|
|
783
|
+
const state = getAgentProfiles?.() ?? null;
|
|
784
|
+
if (!state) {
|
|
785
|
+
reply.code(503);
|
|
786
|
+
return { error: "accounts are not available in this daemon yet" };
|
|
787
|
+
}
|
|
788
|
+
return state;
|
|
789
|
+
});
|
|
700
790
|
typed.post("/list", {
|
|
701
791
|
schema: {
|
|
702
792
|
response: {
|
|
@@ -707,8 +797,12 @@ function startDaemonControlServer({
|
|
|
707
797
|
pid: z.number(),
|
|
708
798
|
turnActive: z.boolean(),
|
|
709
799
|
// B-507: in-flight background tasks per the wrapper's last report (lease-expired = count 0).
|
|
710
|
-
backgroundTasks: BackgroundTasksReportSchema.optional()
|
|
711
|
-
|
|
800
|
+
backgroundTasks: BackgroundTasksReportSchema.optional(),
|
|
801
|
+
// B-856: the wrapper's own CLI version and its auto-restart status (null = nothing pending).
|
|
802
|
+
cliVersion: z.string().optional(),
|
|
803
|
+
autoRestart: AutoRestartStatusSchema.nullable().optional()
|
|
804
|
+
})),
|
|
805
|
+
daemon: DaemonListInfoSchema.optional()
|
|
712
806
|
})
|
|
713
807
|
}
|
|
714
808
|
}
|
|
@@ -721,8 +815,11 @@ function startDaemonControlServer({
|
|
|
721
815
|
happySessionId: child.happySessionId,
|
|
722
816
|
pid: child.pid,
|
|
723
817
|
turnActive: isTurnActive ? isTurnActive(child.happySessionId) : false,
|
|
724
|
-
...getBackgroundTasks ? { backgroundTasks: getBackgroundTasks(child.happySessionId) } : {}
|
|
725
|
-
|
|
818
|
+
...getBackgroundTasks ? { backgroundTasks: getBackgroundTasks(child.happySessionId) } : {},
|
|
819
|
+
...child.happySessionMetadataFromLocalWebhook?.version ? { cliVersion: child.happySessionMetadataFromLocalWebhook.version } : {},
|
|
820
|
+
...getAutoRestartStatus ? { autoRestart: getAutoRestartStatus(child.happySessionId) ?? null } : {}
|
|
821
|
+
})),
|
|
822
|
+
...getDaemonInfo ? { daemon: getDaemonInfo() } : {}
|
|
726
823
|
};
|
|
727
824
|
});
|
|
728
825
|
typed.post("/stop-session", {
|
|
@@ -765,7 +862,9 @@ function startDaemonControlServer({
|
|
|
765
862
|
// sends over the machine RPC. Old CLIs never send them.
|
|
766
863
|
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
864
|
resumeCodexThreadId: z.string().min(1).max(200).optional(),
|
|
768
|
-
parentSessionId: z.string().min(1).max(200).optional()
|
|
865
|
+
parentSessionId: z.string().min(1).max(200).optional(),
|
|
866
|
+
// B-850a: `very-happy spawn --account` (null = machine login; absent = machine default).
|
|
867
|
+
agentProfileId: z.string().min(1).max(64).nullable().optional()
|
|
769
868
|
}),
|
|
770
869
|
response: {
|
|
771
870
|
200: z.object({
|
|
@@ -790,13 +889,13 @@ function startDaemonControlServer({
|
|
|
790
889
|
}
|
|
791
890
|
}
|
|
792
891
|
}, async (request, reply) => {
|
|
793
|
-
const { directory, sessionId, agent, environmentVariables, variant, forceNew, permissionMode, spawnedBy, resumeClaudeSessionId, resumeCodexThreadId, parentSessionId } = request.body;
|
|
892
|
+
const { directory, sessionId, agent, environmentVariables, variant, forceNew, permissionMode, spawnedBy, resumeClaudeSessionId, resumeCodexThreadId, parentSessionId, agentProfileId } = request.body;
|
|
794
893
|
if (!directory && variant !== "assistant") {
|
|
795
894
|
reply.code(500);
|
|
796
895
|
return { success: false, error: "directory is required" };
|
|
797
896
|
}
|
|
798
897
|
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 });
|
|
898
|
+
const result = await spawnSession({ directory, sessionId, agent, environmentVariables, variant, forceNew, permissionMode, spawnedBy, resumeClaudeSessionId, resumeCodexThreadId, parentSessionId, ...agentProfileId !== void 0 ? { agentProfileId } : {} });
|
|
800
899
|
const resumed = Boolean(resumeClaudeSessionId || resumeCodexThreadId);
|
|
801
900
|
switch (result.type) {
|
|
802
901
|
case "success":
|
|
@@ -887,7 +986,7 @@ function startDaemonControlServer({
|
|
|
887
986
|
return { success: false, error: "daemon is still starting up" };
|
|
888
987
|
}
|
|
889
988
|
logger.debug(`[CONTROL SERVER] Restart session request: ${sessionId}`);
|
|
890
|
-
const result = await restartSession(sessionId, { keepPublishedPermissionMode: true });
|
|
989
|
+
const result = await restartSession(sessionId, { keepPublishedPermissionMode: true, account: true });
|
|
891
990
|
switch (result.type) {
|
|
892
991
|
case "success":
|
|
893
992
|
return { success: true, sessionId: result.sessionId };
|
|
@@ -5334,6 +5433,12 @@ function createAutoRestart(deps) {
|
|
|
5334
5433
|
setStatus(sessionId, { state: "waiting", reason: "turn-active", since, target: staleness.target });
|
|
5335
5434
|
return;
|
|
5336
5435
|
}
|
|
5436
|
+
const pending = deps.upgradePending?.() ?? null;
|
|
5437
|
+
if (pending) {
|
|
5438
|
+
deps.log?.(`[auto-restart] ${sessionId} left to the next daemon: upgrade to ${pending} pending`);
|
|
5439
|
+
setStatus(sessionId, { state: "waiting", reason: "upgrade-pending", since, target: staleness.target });
|
|
5440
|
+
return;
|
|
5441
|
+
}
|
|
5337
5442
|
let result;
|
|
5338
5443
|
try {
|
|
5339
5444
|
result = await deps.restart(sessionId, staleness);
|
|
@@ -5423,6 +5528,7 @@ function createAutoRestart(deps) {
|
|
|
5423
5528
|
automationRunning: deps.automationRunning(request.sessionId),
|
|
5424
5529
|
resumable: false,
|
|
5425
5530
|
attempt,
|
|
5531
|
+
upgradePending: deps.upgradePending?.() ?? null,
|
|
5426
5532
|
inFlight,
|
|
5427
5533
|
lastStartedAt
|
|
5428
5534
|
};
|
|
@@ -5439,6 +5545,7 @@ function createAutoRestart(deps) {
|
|
|
5439
5545
|
automationRunning: deps.automationRunning(request.sessionId),
|
|
5440
5546
|
resumable,
|
|
5441
5547
|
attempt: attempts.get(request.sessionId) ?? null,
|
|
5548
|
+
upgradePending: deps.upgradePending?.() ?? null,
|
|
5442
5549
|
inFlight,
|
|
5443
5550
|
lastStartedAt
|
|
5444
5551
|
};
|
|
@@ -6597,6 +6704,9 @@ async function removeTeamWorktree(resource) {
|
|
|
6597
6704
|
if (ownBranch) await git(repository, ["branch", "-D", branch]);
|
|
6598
6705
|
}
|
|
6599
6706
|
|
|
6707
|
+
function teamInitialModelMeta(model) {
|
|
6708
|
+
return model ? { model, modelIntent: model } : { modelIntent: MODEL_INTENT_CONFIG };
|
|
6709
|
+
}
|
|
6600
6710
|
function refusalCode(error) {
|
|
6601
6711
|
const code = axios.isAxiosError(error) ? error.response?.data?.error : void 0;
|
|
6602
6712
|
return typeof code === "string" && /^[a-z_]{1,64}$/.test(code) ? ` (${code})` : "";
|
|
@@ -6713,7 +6823,7 @@ function createTeamWorker(deps) {
|
|
|
6713
6823
|
return;
|
|
6714
6824
|
}
|
|
6715
6825
|
const key = await waitForSessionKey(receipt.sessionId, 1e4);
|
|
6716
|
-
await sendUserMessage(receipt.sessionId, key, teamInitialPrompt(op.prompt, bot?.root === true, receipt.directory), "teams", { localId: `teams-initial-${op.id}`, sentFrom: "team", ...op.model
|
|
6826
|
+
await sendUserMessage(receipt.sessionId, key, teamInitialPrompt(op.prompt, bot?.root === true, receipt.directory), "teams", { localId: `teams-initial-${op.id}`, sentFrom: "team", ...teamInitialModelMeta(op.model) });
|
|
6717
6827
|
receipt = { ...receipt, phase: "delivered" };
|
|
6718
6828
|
writeReceipt$1(home, receipt);
|
|
6719
6829
|
}
|
|
@@ -7653,6 +7763,7 @@ async function startDaemon() {
|
|
|
7653
7763
|
const initialMachineMetadata = getInitialMachineMetadata();
|
|
7654
7764
|
const startupCliAvailability = getStartupCliAvailability();
|
|
7655
7765
|
let claudeAuthServiceRef = null;
|
|
7766
|
+
let accountServiceRef = null;
|
|
7656
7767
|
let cliUpdateStateRef = null;
|
|
7657
7768
|
let lastHandoverHold = null;
|
|
7658
7769
|
let claudeCredentialStoreSetting = (await readSettings()).claudeCredentialStore === "file" ? "file" : "auto";
|
|
@@ -7781,6 +7892,7 @@ async function startDaemon() {
|
|
|
7781
7892
|
const sessionIdToFinishedSession = /* @__PURE__ */ new Map();
|
|
7782
7893
|
let teamWorker;
|
|
7783
7894
|
let autoRestart;
|
|
7895
|
+
let bundleReplacedSeen = false;
|
|
7784
7896
|
let automationRunner;
|
|
7785
7897
|
let projectPresence;
|
|
7786
7898
|
const persisted = readPersistedSessions();
|
|
@@ -8076,8 +8188,20 @@ async function startDaemon() {
|
|
|
8076
8188
|
if (options.spawnedBy) {
|
|
8077
8189
|
extraEnv.HAPPY_SPAWNED_BY = options.spawnedBy;
|
|
8078
8190
|
}
|
|
8191
|
+
let spawnAccountId = null;
|
|
8192
|
+
delete extraEnv[SPAWN_ACCOUNT_ENV];
|
|
8193
|
+
if ((options.agent ?? "claude") === "claude" && accountServiceRef) {
|
|
8194
|
+
try {
|
|
8195
|
+
spawnAccountId = accountServiceRef.resolveSpawnAccount("claude", options.agentProfileId);
|
|
8196
|
+
} catch (error) {
|
|
8197
|
+
return { type: "error", errorMessage: error instanceof Error ? error.message : String(error) };
|
|
8198
|
+
}
|
|
8199
|
+
if (spawnAccountId) extraEnv[SPAWN_ACCOUNT_ENV] = spawnAccountId;
|
|
8200
|
+
} else if (options.agentProfileId) {
|
|
8201
|
+
return { type: "error", errorMessage: `agent-profile-unavailable:agent-mismatch: accounts are not supported for ${options.agent} yet` };
|
|
8202
|
+
}
|
|
8079
8203
|
const claudeAuthStatus = claudeAuthServiceRef?.current()?.status;
|
|
8080
|
-
if ((options.agent ?? "claude") === "claude" && claudeAuthStatus) {
|
|
8204
|
+
if ((options.agent ?? "claude") === "claude" && claudeAuthStatus && !spawnAccountId) {
|
|
8081
8205
|
extraEnv.HAPPY_CLAUDE_AUTH_STATUS = claudeAuthStatus;
|
|
8082
8206
|
}
|
|
8083
8207
|
logger.debug(`[DAEMON RUN] Environment variable keys (before expansion) (${Object.keys(extraEnv).length}): ${Object.keys(extraEnv).join(", ")}`);
|
|
@@ -8521,6 +8645,7 @@ async function startDaemon() {
|
|
|
8521
8645
|
}
|
|
8522
8646
|
};
|
|
8523
8647
|
const restartCounts = /* @__PURE__ */ new Map();
|
|
8648
|
+
const accountRestartCounts = /* @__PURE__ */ new Map();
|
|
8524
8649
|
const autoRestartExits = /* @__PURE__ */ new Set();
|
|
8525
8650
|
const stopSessionAndWait = async (happySessionId, timeoutMs = 8e3) => {
|
|
8526
8651
|
const targets = /* @__PURE__ */ new Set();
|
|
@@ -8570,8 +8695,9 @@ async function startDaemon() {
|
|
|
8570
8695
|
};
|
|
8571
8696
|
const restartSessionImpl = async (happySessionId, options) => {
|
|
8572
8697
|
try {
|
|
8573
|
-
const
|
|
8574
|
-
const
|
|
8698
|
+
const counts = options?.account ? accountRestartCounts : restartCounts;
|
|
8699
|
+
const prior = counts.get(happySessionId) ?? 0;
|
|
8700
|
+
const decision = options?.auto ? { allowed: true } : decideRestart(prior, options?.account ? DEFAULT_MAX_ACCOUNT_RESTARTS : DEFAULT_MAX_RESTARTS);
|
|
8575
8701
|
if (!decision.allowed) {
|
|
8576
8702
|
return { type: "error", errorMessage: `restart:${decision.reason}` };
|
|
8577
8703
|
}
|
|
@@ -8622,7 +8748,7 @@ async function startDaemon() {
|
|
|
8622
8748
|
if (model) args.push("--model", model);
|
|
8623
8749
|
const permissionMode = sanitizeSpawnPermissionMode(options?.permissionMode ?? (options?.keepPublishedPermissionMode ? publishedRelaunchPermissionMode(metadata) : void 0));
|
|
8624
8750
|
if (permissionMode) args.push("--permission-mode", permissionMode);
|
|
8625
|
-
if (!options?.auto)
|
|
8751
|
+
if (!options?.auto) counts.set(happySessionId, recordRestartAttempt(prior));
|
|
8626
8752
|
const teamEnv = await teamRelaunchEnvFor(happySessionId, metadata);
|
|
8627
8753
|
const result = await spawnTrackedHappyProcess({
|
|
8628
8754
|
args,
|
|
@@ -8788,6 +8914,11 @@ async function startDaemon() {
|
|
|
8788
8914
|
startedBy: metadata?.startedBy ?? null
|
|
8789
8915
|
};
|
|
8790
8916
|
};
|
|
8917
|
+
const upgradePending = () => pendingUpgradeVersion({
|
|
8918
|
+
daemonVersion: packageJson.version,
|
|
8919
|
+
autoUpdate: cliUpdateStateRef?.autoUpdate,
|
|
8920
|
+
bundleReplaced: bundleReplacedSeen
|
|
8921
|
+
});
|
|
8791
8922
|
const autoRestartScheduler = createAutoRestart({
|
|
8792
8923
|
enabled: () => autoRestartSetting,
|
|
8793
8924
|
quietMs: resolveQuietMs(),
|
|
@@ -8842,6 +8973,7 @@ async function startDaemon() {
|
|
|
8842
8973
|
if (!row || typeof row.active !== "boolean") return null;
|
|
8843
8974
|
return { active: row.active, archived: row.archivedAt != null };
|
|
8844
8975
|
},
|
|
8976
|
+
upgradePending,
|
|
8845
8977
|
publish: (sessions) => {
|
|
8846
8978
|
void apiMachineRef?.setAutoRestartSessions(sessions);
|
|
8847
8979
|
},
|
|
@@ -8861,6 +8993,8 @@ async function startDaemon() {
|
|
|
8861
8993
|
// B-501: `very-happy send --resume`
|
|
8862
8994
|
restartSession,
|
|
8863
8995
|
// B-794: `very-happy session provider`
|
|
8996
|
+
getAgentProfiles: () => accountServiceRef?.state() ?? null,
|
|
8997
|
+
// B-850a: `very-happy account list`
|
|
8864
8998
|
requestShutdown: () => requestShutdown("happy-cli"),
|
|
8865
8999
|
onHappySessionWebhook,
|
|
8866
9000
|
onSessionStateEvent,
|
|
@@ -8888,6 +9022,9 @@ async function startDaemon() {
|
|
|
8888
9022
|
// B-505: `daemon list` shows which sessions have a turn in flight, so an
|
|
8889
9023
|
// operator can check the WHOLE machine before a supervised restart.
|
|
8890
9024
|
isTurnActive: (sessionId) => turnActivity.activeSessions().includes(sessionId),
|
|
9025
|
+
// B-856: the auto-restart classification, readable locally (it is encrypted on the server).
|
|
9026
|
+
getAutoRestartStatus: (sessionId) => autoRestartScheduler.statuses()[sessionId],
|
|
9027
|
+
getDaemonInfo: () => ({ version: packageJson.version, upgradePending: upgradePending(), autoRestartEnabled: autoRestartSetting }),
|
|
8891
9028
|
pushClipboard: (text, terminalId) => {
|
|
8892
9029
|
if (!apiMachineRef) {
|
|
8893
9030
|
return { delivered: false, truncated: false, totalBytes: 0, error: "daemon is still starting up" };
|
|
@@ -9042,6 +9179,27 @@ async function startDaemon() {
|
|
|
9042
9179
|
return autoRestartSetting;
|
|
9043
9180
|
});
|
|
9044
9181
|
setTimeout(() => autoRestartScheduler.sweep(), 5e3).unref?.();
|
|
9182
|
+
const accountService = new AccountService({
|
|
9183
|
+
home: configuration.happyHomeDir,
|
|
9184
|
+
env: process.env,
|
|
9185
|
+
daemonPid: process.pid,
|
|
9186
|
+
spawnPty: (env) => spawnSetupTokenPty(os.homedir(), env),
|
|
9187
|
+
restartSession: async (sessionId) => {
|
|
9188
|
+
const result = await restartSession(sessionId, { keepPublishedPermissionMode: true, account: true });
|
|
9189
|
+
if (result.type === "success") return { ok: true };
|
|
9190
|
+
const error = result.type === "error" ? result.errorMessage : "unexpected restart result";
|
|
9191
|
+
const stillRunning = [...pidToTrackedSession.values()].some((s) => s.happySessionId === sessionId && isPidAlive(s.pid));
|
|
9192
|
+
return { ok: false, notRunning: error.startsWith("restart-precheck:not-tracked"), stillRunning, error };
|
|
9193
|
+
},
|
|
9194
|
+
onChanged: () => {
|
|
9195
|
+
void apiMachine.publishAgentProfiles();
|
|
9196
|
+
}
|
|
9197
|
+
});
|
|
9198
|
+
accountServiceRef = accountService;
|
|
9199
|
+
apiMachine.setAgentProfileService(accountService);
|
|
9200
|
+
const stopAccountWatch = watchAccountFiles(configuration.happyHomeDir, () => {
|
|
9201
|
+
void apiMachine.publishAgentProfiles();
|
|
9202
|
+
});
|
|
9045
9203
|
const webPanelsSync = startWebPanelsSync({
|
|
9046
9204
|
statMtime: async () => (await fs.stat(configuration.settingsFile).catch(() => null))?.mtimeMs ?? null,
|
|
9047
9205
|
readRaw: async () => (await readSettings()).webPanels,
|
|
@@ -9176,6 +9334,7 @@ async function startDaemon() {
|
|
|
9176
9334
|
try {
|
|
9177
9335
|
const currentMtimeMs = statSync$1(bundlePath).mtimeMs;
|
|
9178
9336
|
bundleReplaced = currentMtimeMs !== initialBundleMtimeMs;
|
|
9337
|
+
if (bundleReplaced) bundleReplacedSeen = true;
|
|
9179
9338
|
} catch {
|
|
9180
9339
|
}
|
|
9181
9340
|
}
|
|
@@ -9202,6 +9361,8 @@ async function startDaemon() {
|
|
|
9202
9361
|
policyAnnouncements.stop();
|
|
9203
9362
|
stopAgentVersionChecks();
|
|
9204
9363
|
claudeAuthService.stop();
|
|
9364
|
+
stopAccountWatch();
|
|
9365
|
+
accountService.dispose();
|
|
9205
9366
|
apiMachine.shutdown();
|
|
9206
9367
|
await stopControlServer();
|
|
9207
9368
|
await cleanupDaemonState();
|
|
@@ -9333,6 +9494,8 @@ async function startDaemon() {
|
|
|
9333
9494
|
} catch (error) {
|
|
9334
9495
|
logger.debug("[DAEMON RUN] Mirror shutdown failed:", error);
|
|
9335
9496
|
}
|
|
9497
|
+
stopAccountWatch();
|
|
9498
|
+
accountService.dispose();
|
|
9336
9499
|
apiMachine.shutdown();
|
|
9337
9500
|
await stopControlServer();
|
|
9338
9501
|
await cleanupDaemonState();
|