very-happy-cli 0.2.166 → 0.2.167
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-20VHOXwb.cjs → AcpBackend-D1IKJGz_.cjs} +3 -3
- package/dist/{AcpBackend-tRWk7yi7.mjs → AcpBackend-kFZlee5E.mjs} +3 -3
- package/dist/{BasePermissionHandler-COKc4pmt.cjs → BasePermissionHandler-DHxYAK5L.cjs} +1 -1
- package/dist/{BasePermissionHandler-CDCLIrZJ.mjs → BasePermissionHandler-DS0kRTNI.mjs} +1 -1
- package/dist/{BaseReasoningProcessor-BDVKvooR.mjs → BaseReasoningProcessor-BRtCCt7q.mjs} +1 -1
- package/dist/{BaseReasoningProcessor-DAGQdkNp.cjs → BaseReasoningProcessor-CsjVdt_H.cjs} +1 -1
- package/dist/{agentHome-2IbIjKCa.mjs → agentHome-Ct-VXFeG.mjs} +4 -4
- package/dist/{agentHome-KVWj6nCl.cjs → agentHome-DeAWzhSe.cjs} +4 -4
- package/dist/{api-DnNL5fLw.cjs → api-BZYLRDM9.cjs} +88 -10
- package/dist/{api-Cmz3XS4P.mjs → api-CReZazeT.mjs} +88 -10
- package/dist/{apiMachine-DeoQ8QbZ.cjs → apiMachine-BgMxGPsR.cjs} +50 -15
- package/dist/{apiMachine-B6ySCFe0.mjs → apiMachine-CWndf1Vn.mjs} +50 -15
- package/dist/{attachmentContent-DPWxHgX4.cjs → attachmentContent-HcJqFQW8.cjs} +2 -2
- package/dist/{attachmentContent-CTXapi-_.mjs → attachmentContent-j875mwU7.mjs} +2 -2
- package/dist/{attachmentLimits-BfgKV5iE.cjs → attachmentLimits-BEYEEBm8.cjs} +13 -1
- package/dist/{attachmentLimits-C1PCCM79.mjs → attachmentLimits-CxG3T18E.mjs} +13 -1
- package/dist/{auth-BMaBjRAj.mjs → auth-BIHuc7vY.mjs} +10 -10
- package/dist/{auth-pzWIFdOD.mjs → auth-CFS9Lfgv.mjs} +5 -5
- package/dist/{auth-D4-eQz85.cjs → auth-Myr2Q42x.cjs} +10 -10
- package/dist/{auth-ietHtvwu.cjs → auth-VzWpbo5P.cjs} +5 -5
- package/dist/{auto-DOWTQDPa.cjs → auto-Bf6Dr7_o.cjs} +14 -14
- package/dist/{auto-DL75Dx3I.mjs → auto-Df9-zmuN.mjs} +14 -14
- package/dist/{bootstrap-XE8A7Ut2.mjs → bootstrap-BSOxYpaP.mjs} +2 -2
- package/dist/{bootstrap-BpXIc2wn.cjs → bootstrap-Dj8WBiR2.cjs} +2 -2
- package/dist/{browser-DDFi1T8C.mjs → browser-BCFIHOvo.mjs} +1 -1
- package/dist/{browser-CcG8GLRV.cjs → browser-BoCV40yC.cjs} +1 -1
- package/dist/{claudeLocal-DXBXwIOG.cjs → claudeLocal-CGsq7Kul.cjs} +5 -5
- package/dist/{claudeLocal-DmM5Oyhv.mjs → claudeLocal-D5-eA9SC.mjs} +5 -5
- package/dist/{claudeLocalLauncher-Cs4eUC3P.mjs → claudeLocalLauncher-C9Cc438l.mjs} +10 -10
- package/dist/{claudeLocalLauncher-C41Y6Kp4.cjs → claudeLocalLauncher-Cf9QeYDT.cjs} +10 -10
- package/dist/{claudeSessionFork-Cs0I3eGI.cjs → claudeSessionFork-Byd8zD1U.cjs} +1 -1
- package/dist/{claudeSessionFork-BdLnc2Hv.mjs → claudeSessionFork-CMzAva8G.mjs} +1 -1
- package/dist/{client-JISJx2f-.cjs → client-BKnKRLSt.cjs} +3 -3
- package/dist/{client-GjTnsq6F.mjs → client-C7FYMer0.mjs} +2 -2
- package/dist/{client-DJ0kX_8M.cjs → client-D0T5-6Ds.cjs} +2 -2
- package/dist/{client-CbK33y_s.mjs → client-Dsfy_SAb.mjs} +3 -3
- package/dist/codex/happyMcpStdioBridge.cjs +14 -14
- package/dist/codex/happyMcpStdioBridge.mjs +14 -14
- package/dist/{codexAppServerClient-CldXEojt.mjs → codexAppServerClient-Dd_4TxHv.mjs} +4 -4
- package/dist/{codexAppServerClient-BTjn2ZCZ.cjs → codexAppServerClient-TiW9OBk4.cjs} +4 -4
- package/dist/{codexCommand-DjMU-Ijf.mjs → codexCommand-BZSr4MKI.mjs} +137 -56
- package/dist/{codexCommand-BpD0N1F7.cjs → codexCommand-Bxryqh90.cjs} +137 -56
- package/dist/{config-DjSJKatx.mjs → config-C_Pj7yxV.mjs} +3 -3
- package/dist/{config-DuLL0Ppe.cjs → config-DXPash-r.cjs} +3 -3
- package/dist/{configuration-B0cb3xA3.cjs → configuration-C3piBtxY.cjs} +1 -1
- package/dist/{configuration-D2v3puap.mjs → configuration-WspKd2C2.mjs} +2 -2
- package/dist/{connect-B7JWEzyg.cjs → connect-BN-IBElA.cjs} +13 -13
- package/dist/{connect-CnNNyM9I.mjs → connect-DGPZs5px.mjs} +13 -13
- package/dist/{context-DjfqLWzE.mjs → context-Cr6a3NTg.mjs} +1 -1
- package/dist/{context-BFUpYT39.cjs → context-Jrq4-eCZ.cjs} +1 -1
- package/dist/{controlClient-CmnHGcyl.cjs → controlClient-BI6Fw3fQ.cjs} +18 -3
- package/dist/{controlClient-BMUJfUeF.mjs → controlClient-DTheOlvC.mjs} +18 -4
- package/dist/{createSessionMetadata-DU0bCg2m.mjs → createSessionMetadata-BEZ4DIDA.mjs} +57 -5
- package/dist/{createSessionMetadata-DbfRBhRu.cjs → createSessionMetadata-zQSz3hgk.cjs} +56 -3
- package/dist/defaultPermissionMode-Cif_RHGb.mjs +191 -0
- package/dist/defaultPermissionMode-DNKNzk7l.cjs +197 -0
- package/dist/{deterministicJson-D-WPUrZb.mjs → deterministicJson-BMMifViN.mjs} +8 -8
- package/dist/{deterministicJson-Dp3TVyap.cjs → deterministicJson-C7O2ulKY.cjs} +8 -8
- package/dist/{doctor-CkJmdPbi.cjs → doctor-BykBaMTr.cjs} +6 -6
- package/dist/{doctor-BlXXyQ1L.mjs → doctor-D1KKyPzB.mjs} +6 -6
- package/dist/{downloadTarget-CiQqRIc-.cjs → downloadTarget-CWTb2-EM.cjs} +6 -6
- package/dist/{downloadTarget-DjSwMHun.mjs → downloadTarget-Cp48jrIP.mjs} +6 -6
- package/dist/{ensureDaemonRunning-CAQag1zE.mjs → ensureDaemonRunning-Ba5fYoxb.mjs} +5 -5
- package/dist/{ensureDaemonRunning-C_aIOhgG.cjs → ensureDaemonRunning-CCxX7MoP.cjs} +5 -5
- package/dist/{handleResumeCommand-Ci7wacT-.mjs → handleResumeCommand-BTUGlNjB.mjs} +5 -5
- package/dist/{handleResumeCommand-6KzBGDnl.cjs → handleResumeCommand-yPdDQHqz.cjs} +5 -5
- package/dist/{index-CaFCAlX8.cjs → index-BjhKqDa0.cjs} +3 -3
- package/dist/{index-HQsigW_J.mjs → index-C3_83bqS.mjs} +3 -3
- package/dist/{index-WGCT6SSV.mjs → index-CE2GgPbr.mjs} +34 -34
- package/dist/{index-DQplgo0W.mjs → index-D8m8Ripb.mjs} +4 -4
- package/dist/{index-DBmNwMX9.cjs → index-DifM62wX.cjs} +33 -33
- package/dist/{index-DEKIgZUo.cjs → index-PNMQPKhz.cjs} +4 -4
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/{install-oJUvsFu9.mjs → install-C0-QFn9s.mjs} +3 -3
- package/dist/{install-CejEiRGW.cjs → install-CqZVeze8.cjs} +3 -3
- package/dist/lib.cjs +11 -11
- package/dist/lib.d.cts +61 -0
- package/dist/lib.d.mts +61 -0
- package/dist/lib.mjs +11 -11
- package/dist/{lidState-BfximpjX.mjs → lidState-B2ZxdREe.mjs} +1 -1
- package/dist/{lidState-D8BmnJV1.cjs → lidState-Bc2K9H9l.cjs} +1 -1
- package/dist/{localHappyAgentAuth-Ct1aXwqd.mjs → localHappyAgentAuth-B5XPEMwk.mjs} +1 -1
- package/dist/{localHappyAgentAuth-d7B6S_o7.cjs → localHappyAgentAuth-T5GOvRha.cjs} +1 -1
- package/dist/{logger-JTcJU-uL.cjs → logger-B_MWPbZz.cjs} +2 -2
- package/dist/{logger-BpQcwNnt.mjs → logger-CbBv3q_b.mjs} +2 -2
- package/dist/{machineMetadata-BBg_Njw3.cjs → machineMetadata-BafS4JY8.cjs} +4 -3
- package/dist/{machineMetadata-CBdxABeI.mjs → machineMetadata-DHg238U4.mjs} +4 -3
- package/dist/{main-C16fOGgn.cjs → main-DNrA0qBy.cjs} +45 -45
- package/dist/{main-B5b1gA3K.mjs → main-DXAK0n7x.mjs} +45 -45
- package/dist/{manager-BQ4flvQZ.mjs → manager-BEsI4qt3.mjs} +9 -3
- package/dist/{manager-Cly8xVIR.cjs → manager-HrEj442o.cjs} +8 -2
- package/dist/{mcp-BnNiBBax.cjs → mcp-AvPOhDXy.cjs} +14 -14
- package/dist/{mcp-DGNWgVdv.mjs → mcp-BotAjCdD.mjs} +14 -14
- package/dist/mirrorProtocol-BdcN6QlN.cjs +1270 -0
- package/dist/mirrorProtocol-BwHm8odn.mjs +1247 -0
- package/dist/{package-C1XvUQFy.cjs → package-C9ZP9bpX.cjs} +7 -7
- package/dist/{package-BqwrPxL0.mjs → package-DU1DxhH9.mjs} +7 -7
- package/dist/{peerTools-DPvbcs8V.cjs → peerTools-Dkbu7gag.cjs} +4 -4
- package/dist/{peerTools-CeCe-3lk.mjs → peerTools-os2DVjA0.mjs} +4 -4
- package/dist/{persistence-2Xp_o6x6.cjs → persistence-BYGl0QYw.cjs} +147 -25
- package/dist/{persistence-B9LmhAE2.mjs → persistence-ON0zpHfb.mjs} +123 -12
- package/dist/{piRunnerArgs-7FaTyNOq.mjs → piRunnerArgs-CYsnT9sV.mjs} +1 -1
- package/dist/{piRunnerArgs-DI29dDNo.cjs → piRunnerArgs-DpbvstUX.cjs} +1 -1
- package/dist/{piRuntime-R8XVChxK.cjs → piRuntime-CDnILlCd.cjs} +1 -1
- package/dist/{piRuntime-0qEK5AqE.mjs → piRuntime-CmEid-wu.mjs} +1 -1
- package/dist/{piTerminal-zcQKc8Sp.mjs → piTerminal-0eNlXSlL.mjs} +16 -16
- package/dist/{piTerminal-Ccj0KNPr.cjs → piTerminal-B57TgMON.cjs} +16 -16
- package/dist/{rateLimitWindows-C2Jk3Ih7.cjs → rateLimitWindows-CusGIqlq.cjs} +1 -1
- package/dist/{rateLimitWindows-Dhfhbtqu.mjs → rateLimitWindows-vZ9Bo7aT.mjs} +1 -1
- package/dist/{registerCommonHandlers-DdfGsFbM.mjs → registerCommonHandlers-B0PVff2U.mjs} +2 -2
- package/dist/{registerCommonHandlers-Aha_KfM3.cjs → registerCommonHandlers-DVYB3iVn.cjs} +2 -2
- package/dist/{registerKillSessionHandler-DboQlGcH.mjs → registerKillSessionHandler-BJMHJHXe.mjs} +14 -9
- package/dist/{registerKillSessionHandler-CjitOpUA.cjs → registerKillSessionHandler-BwXGKtg_.cjs} +14 -9
- package/dist/{remoteSessionClient-B2DtWuNP.mjs → remoteSessionClient-BzPXSC21.mjs} +5 -5
- package/dist/{remoteSessionClient-BwI8rpQw.cjs → remoteSessionClient-PyUAIhwK.cjs} +5 -5
- package/dist/{reportProgressTool-DnAD8wOa.mjs → reportProgressTool-BvB13EwC.mjs} +1 -1
- package/dist/{reportProgressTool-B-Rcy0s3.cjs → reportProgressTool-D4KB_4cP.cjs} +1 -1
- package/dist/{run-Bh66Xs40.cjs → run-BC8jzq_h.cjs} +323 -37
- package/dist/{run-DPEwJpQR.mjs → run-O2M8LsWf.mjs} +322 -36
- package/dist/{runClaude-C-lJdAKD.cjs → runClaude-C7jPa8VP.cjs} +87 -25
- package/dist/{runClaude-DLr_nBzw.mjs → runClaude-DGkr5E7s.mjs} +87 -25
- package/dist/{runClaudeDeps-vWWLod7J.cjs → runClaudeDeps-5kzncqME.cjs} +100 -31
- package/dist/{runClaudeDeps-C7JV7nXG.mjs → runClaudeDeps-CX_TxS78.mjs} +105 -36
- package/dist/{runGemini-o-CUSayc.cjs → runGemini-BfYA4Uqc.cjs} +32 -32
- package/dist/{runGemini-tH6sLw-G.mjs → runGemini-CwmGBH3L.mjs} +32 -32
- package/dist/{runOpenClaw-C5DZvVhn.mjs → runOpenClaw-BYAPYFyL.mjs} +16 -16
- package/dist/{runOpenClaw-D24f35l0.cjs → runOpenClaw-C72jut7v.cjs} +16 -16
- package/dist/{sandbox-TJZJ6ngw.cjs → sandbox-Bqkp8IT7.cjs} +4 -4
- package/dist/{sandbox-BaL1aslA.mjs → sandbox-DlVnK1Vi.mjs} +4 -4
- package/dist/{selfCheck-Dugi0Nk_.cjs → selfCheck-B4lLZplk.cjs} +34 -34
- package/dist/selfCheck-DYTGBdIO.mjs +84 -0
- package/dist/{send-DDcJ3ayi.mjs → send-B5bWW9Tl.mjs} +8 -8
- package/dist/{send-CkWOSYmU.cjs → send-BCwS6n_s.cjs} +8 -8
- package/dist/{server-CUjRvQSd.mjs → server-CEJfRQfj.mjs} +4 -4
- package/dist/{server-7qFQ8J2u.cjs → server-CFWZehnC.cjs} +6 -6
- package/dist/{sessionLock-DqVyHFAQ.mjs → sessionLock-AwOYsKT7.mjs} +12 -4
- package/dist/{sessionLock-DfhNICyS.cjs → sessionLock-LBWNjpHf.cjs} +12 -3
- package/dist/{sessionModeFile-CIznKD7O.cjs → sessionModeFile-CyPuZRIU.cjs} +1 -1
- package/dist/{sessionModeFile-M4OpiyrF.mjs → sessionModeFile-fvFn1JVG.mjs} +1 -1
- package/dist/{sessionOps-BnaEaOKs.mjs → sessionOps-DZRH4-hV.mjs} +4 -4
- package/dist/{sessionOps-DOyy4gkY.cjs → sessionOps-DzbZI3Eq.cjs} +4 -4
- package/dist/{sessionScanner-CcuOn9uU.mjs → sessionScanner-Q_Ei2flB.mjs} +3 -3
- package/dist/{sessionScanner-Cu1yKlj4.cjs → sessionScanner-i-cgwFVw.cjs} +3 -3
- package/dist/{sessions-C9O91rL1.mjs → sessions-DAmjMAZN.mjs} +9 -9
- package/dist/{sessions-BQgk5Kw8.cjs → sessions-DYK5hD4T.cjs} +9 -9
- package/dist/{setupOfflineReconnection-Byy8aeKT.mjs → setupOfflineReconnection-BfDBxNdo.mjs} +2 -2
- package/dist/{setupOfflineReconnection-DFmQ8s6I.cjs → setupOfflineReconnection-C2LO3hSP.cjs} +2 -2
- package/dist/{spawn-EZ2yrtWd.mjs → spawn-BmjG5j5Y.mjs} +13 -13
- package/dist/{spawn-BS7LPmSm.cjs → spawn-GK_sXE8h.cjs} +13 -13
- package/dist/{spawnHappyCLI-BAa49m0q.mjs → spawnHappyCLI-B2h0P4b5.mjs} +1 -1
- package/dist/{spawnHappyCLI-DyaldIe5.cjs → spawnHappyCLI-J4iEhfyZ.cjs} +1 -1
- package/dist/{specialCommands-CCWtwIGZ.mjs → specialCommands-DisVxagO.mjs} +3 -3
- package/dist/{specialCommands-DouFaJ_0.cjs → specialCommands-DmJMKspE.cjs} +3 -3
- package/dist/{startFileWatcher-Dfs4whzr.mjs → startFileWatcher-CeK1k5gt.mjs} +1 -1
- package/dist/{startFileWatcher-DQbbypJv.cjs → startFileWatcher-xKo8AoYl.cjs} +1 -1
- package/dist/{sync-x_lI_3j_.cjs → sync-Bvc-vh6C.cjs} +1 -1
- package/dist/{sync-BLpH13Kb.mjs → sync-CCwYpJMS.mjs} +1 -1
- package/dist/{systemPrompt-BanyDihy.mjs → systemPrompt-BNIkP3tR.mjs} +1 -1
- package/dist/{systemPrompt-4erwILTB.cjs → systemPrompt-DwOddbuG.cjs} +1 -1
- package/dist/{teams-D6BOT3lR.mjs → teams-DRrLBcys.mjs} +6 -6
- package/dist/{teams-DzetlGWC.cjs → teams-GHMCRZOw.cjs} +6 -6
- package/dist/{time-T0YmeOhS.cjs → time-BXvtjhe9.cjs} +1 -1
- package/dist/{time-CfDKj6Bx.mjs → time-PG5Dfwdv.mjs} +1 -1
- package/dist/{titleGenerator-CoMxqKfP.cjs → titleGenerator-B07bZA0V.cjs} +2 -2
- package/dist/{titleGenerator-ChImQ4q-.mjs → titleGenerator-CIzfpfZW.mjs} +1 -1
- package/dist/{todo-CZZebKZg.cjs → todo-B0aeoNu3.cjs} +5 -5
- package/dist/{todo-SVtYxGON.mjs → todo-CfL7SBFc.mjs} +5 -5
- package/dist/{tools-3X2z3YDe.mjs → tools-D91mq5Ib.mjs} +1 -1
- package/dist/{tools-IJ0TAcJs.cjs → tools-DJIANHSh.cjs} +1 -1
- package/dist/{uninstall-CypD-kr1.mjs → uninstall-5xz3Xvhf.mjs} +3 -3
- package/dist/{uninstall-CqqCWj7w.cjs → uninstall-AtzOfdrj.cjs} +3 -3
- package/package.json +7 -7
- package/dist/defaultPermissionMode-BnxJPVHT.mjs +0 -4
- package/dist/defaultPermissionMode-CxmTXUQR.cjs +0 -7
- package/dist/mirrorProtocol-BEGk2--0.cjs +0 -266
- package/dist/mirrorProtocol-h5WHpdhh.mjs +0 -248
- package/dist/selfCheck-DPi4lqme.mjs +0 -84
|
@@ -1,59 +1,59 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var os = require('node:os');
|
|
4
|
-
var sessionLock = require('./sessionLock-
|
|
4
|
+
var sessionLock = require('./sessionLock-LBWNjpHf.cjs');
|
|
5
|
+
var persistence = require('./persistence-BYGl0QYw.cjs');
|
|
6
|
+
var defaultPermissionMode = require('./defaultPermissionMode-DNKNzk7l.cjs');
|
|
5
7
|
var node_crypto = require('node:crypto');
|
|
6
|
-
var api = require('./api-
|
|
7
|
-
var logger = require('./logger-
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var createSessionMetadata = require('./createSessionMetadata-DbfRBhRu.cjs');
|
|
8
|
+
var api = require('./api-BZYLRDM9.cjs');
|
|
9
|
+
var logger = require('./logger-B_MWPbZz.cjs');
|
|
10
|
+
var createSessionMetadata = require('./createSessionMetadata-zQSz3hgk.cjs');
|
|
11
|
+
var _package = require('./package-C9ZP9bpX.cjs');
|
|
11
12
|
var index = require('./index-C9hI8a10.cjs');
|
|
12
13
|
var forkBackfill = require('./forkBackfill-8eLDeS73.cjs');
|
|
13
|
-
var configuration = require('./configuration-
|
|
14
|
-
var controlClient = require('./controlClient-
|
|
15
|
-
var machineMetadata = require('./machineMetadata-
|
|
14
|
+
var configuration = require('./configuration-C3piBtxY.cjs');
|
|
15
|
+
var controlClient = require('./controlClient-BI6Fw3fQ.cjs');
|
|
16
|
+
var machineMetadata = require('./machineMetadata-BafS4JY8.cjs');
|
|
16
17
|
var projectPath = require('./projectPath-ChLhdOyt.cjs');
|
|
17
18
|
var path = require('node:path');
|
|
18
19
|
var permissionMode = require('./permissionMode-CrV-XuMs.cjs');
|
|
19
20
|
var authRelay = require('./authRelay-BdYkC1Po.cjs');
|
|
20
21
|
var promises = require('node:fs/promises');
|
|
21
|
-
var
|
|
22
|
-
var attachmentContent = require('./attachmentContent-DPWxHgX4.cjs');
|
|
22
|
+
var attachmentContent = require('./attachmentContent-HcJqFQW8.cjs');
|
|
23
23
|
var transcriptCursor = require('./transcriptCursor-DcXGLeSc.cjs');
|
|
24
24
|
var startupPlan = require('./startupPlan-BLMbfQIH.cjs');
|
|
25
25
|
require('node:fs');
|
|
26
|
+
require('zod');
|
|
26
27
|
require('axios');
|
|
27
|
-
require('./lidState-
|
|
28
|
+
require('./lidState-Bc2K9H9l.cjs');
|
|
28
29
|
require('os');
|
|
29
30
|
require('child_process');
|
|
30
31
|
require('node:events');
|
|
31
32
|
require('socket.io-client');
|
|
32
|
-
require('./attachmentLimits-
|
|
33
|
-
require('zod');
|
|
33
|
+
require('./attachmentLimits-BEYEEBm8.cjs');
|
|
34
34
|
require('./limits-C-a7gr04.cjs');
|
|
35
|
-
require('./time-
|
|
36
|
-
require('./registerCommonHandlers-
|
|
35
|
+
require('./time-BXvtjhe9.cjs');
|
|
36
|
+
require('./registerCommonHandlers-DVYB3iVn.cjs');
|
|
37
37
|
require('util');
|
|
38
38
|
require('fs/promises');
|
|
39
39
|
require('crypto');
|
|
40
40
|
require('path');
|
|
41
41
|
require('cross-spawn');
|
|
42
42
|
require('@paralleldrive/cuid2');
|
|
43
|
-
require('./sync-
|
|
43
|
+
require('./sync-Bvc-vh6C.cjs');
|
|
44
44
|
require('./backgroundTaskActivity-CBvUdj39.cjs');
|
|
45
45
|
require('./contentLogMetadata-ZSFk_NjQ.cjs');
|
|
46
46
|
require('chalk');
|
|
47
47
|
require('node:util');
|
|
48
48
|
require('./detectCLI-DR9ZaN6B.cjs');
|
|
49
49
|
require('fs');
|
|
50
|
-
require('./localHappyAgentAuth-
|
|
50
|
+
require('./localHappyAgentAuth-T5GOvRha.cjs');
|
|
51
51
|
require('tweetnacl');
|
|
52
52
|
require('url');
|
|
53
53
|
|
|
54
54
|
const DEFAULT_CLAUDE_MODEL = void 0;
|
|
55
55
|
const DEFAULT_CLAUDE_EFFORT = void 0;
|
|
56
|
-
const importRunClaudeDeps = () => Promise.resolve().then(function () { return require('./runClaudeDeps-
|
|
56
|
+
const importRunClaudeDeps = () => Promise.resolve().then(function () { return require('./runClaudeDeps-5kzncqME.cjs'); });
|
|
57
57
|
async function runClaude(credentials, options = {}) {
|
|
58
58
|
logger.logger.debug(`[CLAUDE] ===== CLAUDE MODE STARTING =====`);
|
|
59
59
|
logger.logger.debug(`[CLAUDE] This is the Claude agent, NOT Gemini`);
|
|
@@ -67,7 +67,7 @@ async function runClaude(credentials, options = {}) {
|
|
|
67
67
|
const isAssistantVariant = process.env.HAPPY_SESSION_VARIANT === "assistant";
|
|
68
68
|
if (isAssistantVariant) {
|
|
69
69
|
try {
|
|
70
|
-
const { bootstrapAssistantHome } = await Promise.resolve().then(function () { return require('./bootstrap-
|
|
70
|
+
const { bootstrapAssistantHome } = await Promise.resolve().then(function () { return require('./bootstrap-Dj8WBiR2.cjs'); });
|
|
71
71
|
await bootstrapAssistantHome();
|
|
72
72
|
} catch (error) {
|
|
73
73
|
logger.logger.debug("[START] Assistant home bootstrap failed:", error);
|
|
@@ -142,7 +142,7 @@ async function runClaude(credentials, options = {}) {
|
|
|
142
142
|
// a brand-new session cannot pick a PDF until after sending once.
|
|
143
143
|
attachmentKinds: [...attachmentContent.CLAUDE_ATTACHMENT_KINDS],
|
|
144
144
|
queueCancellation: true,
|
|
145
|
-
capabilities: ["claude-steer-v1", "claude-live-permission-v1", "claude-live-permission-v2", "claude-btw-v1", "claude-runtime-controls-v1", "claude-opus-5-5-v1", index.PROMPT_QUEUE_CAPABILITY, forkBackfill.FORK_BACKFILL_CAPABILITY],
|
|
145
|
+
capabilities: ["claude-steer-v1", "claude-live-permission-v1", "claude-live-permission-v2", "claude-btw-v1", "claude-runtime-controls-v1", "claude-opus-5-5-v1", index.PROMPT_QUEUE_CAPABILITY, forkBackfill.FORK_BACKFILL_CAPABILITY, persistence.HIBERNATION_CAPABILITY],
|
|
146
146
|
// Effective mode this process enforces. Kept current by
|
|
147
147
|
// publishPermissionMode below; the web renders it instead of guessing.
|
|
148
148
|
permissionMode: permissionMode.mapToClaudeMode(initialPermissionMode ?? "default"),
|
|
@@ -159,7 +159,9 @@ async function runClaude(credentials, options = {}) {
|
|
|
159
159
|
// itself — that one is the variant above and never joins the lists at
|
|
160
160
|
// all. (Shared helper: the other flavors get the same tag via
|
|
161
161
|
// createSessionMetadata.)
|
|
162
|
-
...originTags ? { tags: originTags } : {}
|
|
162
|
+
...originTags ? { tags: originTags } : {},
|
|
163
|
+
// B-586: linked git worktree → branch shown in the session list.
|
|
164
|
+
...createSessionMetadata.sessionWorktreeMetadata(workingDirectory)
|
|
163
165
|
};
|
|
164
166
|
const reconnectSessionId = process.env.HAPPY_RECONNECT_SESSION_ID;
|
|
165
167
|
const reconnectKeyBase64 = process.env.HAPPY_RECONNECT_ENCRYPTION_KEY;
|
|
@@ -185,7 +187,7 @@ async function runClaude(credentials, options = {}) {
|
|
|
185
187
|
}
|
|
186
188
|
if (!response) {
|
|
187
189
|
let offlineSessionId = null;
|
|
188
|
-
const { claudeLocal } = await Promise.resolve().then(function () { return require('./claudeLocal-
|
|
190
|
+
const { claudeLocal } = await Promise.resolve().then(function () { return require('./claudeLocal-CGsq7Kul.cjs'); });
|
|
189
191
|
const { createSessionScanner: createSessionScanner2 } = await loadDeps();
|
|
190
192
|
const reconnection = api.startOfflineReconnection({
|
|
191
193
|
serverUrl: configuration.configuration.serverUrl,
|
|
@@ -232,12 +234,17 @@ async function runClaude(credentials, options = {}) {
|
|
|
232
234
|
throw new Error(`Failed to reactivate archived session ${response.id}`);
|
|
233
235
|
}
|
|
234
236
|
let reconnectSeeded = false;
|
|
237
|
+
let wakingFromHibernation = false;
|
|
235
238
|
if (reconnectSessionId) {
|
|
236
239
|
const snapshot = await api$1.getSession(response.id, response.encryptionKey, response.encryptionVariant);
|
|
237
240
|
if (snapshot.ok) {
|
|
238
241
|
response = sessionLock.applyServerSnapshot(response, snapshot.session);
|
|
239
242
|
reconnectSeeded = true;
|
|
240
243
|
logger.logger.debug(`[START] Reconnect seeded from server: seq=${snapshot.session.seq} metadataVersion=${snapshot.session.metadataVersion}`);
|
|
244
|
+
const wake = sessionLock.applyHibernationReplay(response);
|
|
245
|
+
response = wake.response;
|
|
246
|
+
wakingFromHibernation = wake.replaying;
|
|
247
|
+
if (wake.replaying) logger.logger.debug(`[START] Waking from hibernation: replaying records after seq=${response.seq}`);
|
|
241
248
|
} else {
|
|
242
249
|
response = sessionLock.withoutServerSnapshot(response);
|
|
243
250
|
logger.logger.debug(`[START] Reconnect without server snapshot (${snapshot.reason}); skipping existing messages`);
|
|
@@ -329,7 +336,7 @@ async function runClaude(credentials, options = {}) {
|
|
|
329
336
|
if (reconnectSessionId) {
|
|
330
337
|
session.suppressNextArchiveSignal();
|
|
331
338
|
if (!reconnectSeeded) session.skipExistingMessages();
|
|
332
|
-
void session.cancelUndeliveredQueuedInputs();
|
|
339
|
+
if (!wakingFromHibernation) void session.cancelUndeliveredQueuedInputs();
|
|
333
340
|
session.updateMetadata((meta) => ({
|
|
334
341
|
...sessionLock.mergeReconnectMetadata(meta, metadata, Date.now()),
|
|
335
342
|
queueCancellation: true,
|
|
@@ -781,12 +788,14 @@ async function runClaude(credentials, options = {}) {
|
|
|
781
788
|
});
|
|
782
789
|
});
|
|
783
790
|
const exitGate = new SessionExitGate();
|
|
791
|
+
let hibernationProbe = null;
|
|
784
792
|
const cleanup = async (opts = { archive: true }) => {
|
|
785
|
-
const intent = exitGate.claim(exitIntentFromArchiveFlag(opts.archive));
|
|
793
|
+
const intent = opts.hibernation ? "hibernate" : exitGate.claim(exitIntentFromArchiveFlag(opts.archive));
|
|
786
794
|
if (intent === null) {
|
|
787
795
|
logger.logger.debug(`[START] Termination (archive=${opts.archive ?? true}) ignored: cleanup already running as ${exitGate.current}`);
|
|
788
796
|
return;
|
|
789
797
|
}
|
|
798
|
+
hibernationProbe?.stop();
|
|
790
799
|
logger.logger.debug(`[START] Received termination signal, cleaning up (archive=${intent === "archive"})...`);
|
|
791
800
|
promptQueueDrain.close();
|
|
792
801
|
cleanupPrewarm();
|
|
@@ -795,6 +804,7 @@ async function runClaude(credentials, options = {}) {
|
|
|
795
804
|
currentSession?.cleanup();
|
|
796
805
|
await settleSessionOnExit(session.sessionId, intent, {
|
|
797
806
|
updateMetadata: (handler) => session.updateMetadata(handler),
|
|
807
|
+
updateMetadataAndWait: (handler) => session.updateMetadataAndWait(handler),
|
|
798
808
|
sendSessionDeath: () => session.sendSessionDeath(),
|
|
799
809
|
archiveSession: (id) => api$1.archiveSession(id),
|
|
800
810
|
deactivateSession: (id) => api$1.deactivateSession(id),
|
|
@@ -837,6 +847,58 @@ async function runClaude(credentials, options = {}) {
|
|
|
837
847
|
void cleanup({ archive: true });
|
|
838
848
|
});
|
|
839
849
|
registerKillSessionHandler(session.rpcHandlerManager, () => cleanup({ archive: true }), session);
|
|
850
|
+
let keepAwakeLatch = false;
|
|
851
|
+
const hibernationSnapshot = () => {
|
|
852
|
+
const agentState = session.getAgentState();
|
|
853
|
+
const current = currentSession;
|
|
854
|
+
const meta = session.getMetadata();
|
|
855
|
+
return {
|
|
856
|
+
flavor: "claude",
|
|
857
|
+
resumable: typeof meta?.claudeSessionId === "string" && meta.claudeSessionId.length > 0,
|
|
858
|
+
uiSession: options.startedBy === "daemon" && options.startingMode === "remote" && agentState?.controlledByUser !== true,
|
|
859
|
+
...isAssistantVariant ? { variant: "assistant" } : {},
|
|
860
|
+
...process.env.HAPPY_SPAWNED_BY ? { spawnedBy: process.env.HAPPY_SPAWNED_BY } : {},
|
|
861
|
+
...meta?.tags ? { tags: meta.tags } : {},
|
|
862
|
+
keepAwake: keepAwakeLatch = persistence.latchKeepAwake(meta?.keepAwake, keepAwakeLatch),
|
|
863
|
+
...typeof meta?.keepAwake === "boolean" ? { keepAwakeSetting: meta.keepAwake } : {},
|
|
864
|
+
thinking: current?.thinking === true,
|
|
865
|
+
queuedInputs: messageQueue.size() + (session.promptQueueHasPending() ? 1 : 0),
|
|
866
|
+
waitingForInput: messageQueue.isWaiting(),
|
|
867
|
+
pendingRequests: Object.keys(agentState?.requests ?? {}).length,
|
|
868
|
+
backgroundTasks: current?.backgroundTasks.length ?? 0,
|
|
869
|
+
scheduledWakeups: current?.scheduledWakeups.pending() ?? 0,
|
|
870
|
+
lastActivityAt: session.lastActivityAt,
|
|
871
|
+
...exitGate.current && exitGate.current !== "hibernate" ? { exiting: true } : {}
|
|
872
|
+
};
|
|
873
|
+
};
|
|
874
|
+
if (options.startedBy === "daemon" && options.startingMode === "remote" && !isAssistantVariant) {
|
|
875
|
+
hibernationProbe = new defaultPermissionMode.HibernationProbe({
|
|
876
|
+
checkMs: persistence.resolveCheckMs(),
|
|
877
|
+
snapshot: hibernationSnapshot,
|
|
878
|
+
ask: (report) => controlClient.checkDaemonHibernation({ sessionId: session.sessionId, pid: process.pid, report }),
|
|
879
|
+
commit: (idleMs) => defaultPermissionMode.commitHibernation({
|
|
880
|
+
client: session,
|
|
881
|
+
claimExit: () => exitGate.claim("hibernate") !== null,
|
|
882
|
+
exitRequested: () => exitGate.exitRequested,
|
|
883
|
+
markCommitted: () => exitGate.commitHibernate(),
|
|
884
|
+
// Review P1-1: an archive / kill / SIGTERM deferred during the
|
|
885
|
+
// commit window runs now instead of being lost.
|
|
886
|
+
releaseExit: () => {
|
|
887
|
+
const deferred = exitGate.release("hibernate");
|
|
888
|
+
if (deferred) void cleanup({ archive: deferred === "archive" });
|
|
889
|
+
},
|
|
890
|
+
recheck: () => persistence.evaluateWrapperIdle(hibernationSnapshot(), idleMs, Date.now()),
|
|
891
|
+
idleMs,
|
|
892
|
+
finish: (stamp) => cleanup({ archive: false, hibernation: stamp })
|
|
893
|
+
}),
|
|
894
|
+
// Review P3-3: the daemon still holds keep-awake but an old web
|
|
895
|
+
// stripped the field — put it back so every web shows it checked.
|
|
896
|
+
onKeepAwakeLatched: () => {
|
|
897
|
+
if (session.getMetadata()?.keepAwake === void 0) session.updateMetadata((m) => m.keepAwake === void 0 ? { ...m, keepAwake: true } : m);
|
|
898
|
+
}
|
|
899
|
+
});
|
|
900
|
+
hibernationProbe.start();
|
|
901
|
+
}
|
|
840
902
|
const exitCode = await loop({
|
|
841
903
|
path: workingDirectory,
|
|
842
904
|
model: options.model,
|
|
@@ -1,57 +1,57 @@
|
|
|
1
1
|
import os from 'node:os';
|
|
2
|
-
import { c as claimSessionOrExit, a as applyServerSnapshot, w as withoutServerSnapshot, m as mergeReconnectMetadata } from './sessionLock-
|
|
2
|
+
import { c as claimSessionOrExit, a as applyServerSnapshot, b as applyHibernationReplay, w as withoutServerSnapshot, m as mergeReconnectMetadata } from './sessionLock-AwOYsKT7.mjs';
|
|
3
|
+
import { r as readSettings, H as HIBERNATION_CAPABILITY, a as resolveCheckMs, l as latchKeepAwake, e as evaluateWrapperIdle } from './persistence-ON0zpHfb.mjs';
|
|
4
|
+
import { D as DEFAULT_CLAUDE_PERMISSION_MODE, H as HibernationProbe, c as commitHibernation } from './defaultPermissionMode-Cif_RHGb.mjs';
|
|
3
5
|
import { randomUUID } from 'node:crypto';
|
|
4
|
-
import { c as connectionState, A as ApiClient, s as startOfflineReconnection } from './api-
|
|
5
|
-
import { l as logger } from './logger-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { s as spawnOriginTags } from './createSessionMetadata-DU0bCg2m.mjs';
|
|
6
|
+
import { c as connectionState, A as ApiClient, s as startOfflineReconnection } from './api-CReZazeT.mjs';
|
|
7
|
+
import { l as logger } from './logger-CbBv3q_b.mjs';
|
|
8
|
+
import { s as spawnOriginTags, a as sessionWorktreeMetadata } from './createSessionMetadata-BEZ4DIDA.mjs';
|
|
9
|
+
import { p as packageJson } from './package-DU1DxhH9.mjs';
|
|
9
10
|
import { P as PROMPT_QUEUE_CAPABILITY } from './index-B0HEEYGh.mjs';
|
|
10
11
|
import { F as FORK_BACKFILL_CAPABILITY, p as publishForkBackfillWhenCommitted } from './forkBackfill-DYIjlN1Z.mjs';
|
|
11
|
-
import { c as configuration } from './configuration-
|
|
12
|
-
import { n as notifyDaemonSessionStarted } from './controlClient-
|
|
13
|
-
import { g as getInitialMachineMetadata } from './machineMetadata-
|
|
12
|
+
import { c as configuration } from './configuration-WspKd2C2.mjs';
|
|
13
|
+
import { n as notifyDaemonSessionStarted, c as checkDaemonHibernation } from './controlClient-DTheOlvC.mjs';
|
|
14
|
+
import { g as getInitialMachineMetadata } from './machineMetadata-DHg238U4.mjs';
|
|
14
15
|
import { p as projectPath } from './projectPath-BTBIMB57.mjs';
|
|
15
16
|
import { resolve, join } from 'node:path';
|
|
16
17
|
import { a as applySandboxPermissionPolicy, r as resolveInitialClaudePermissionMode, m as mapToClaudeMode, b as reconcilePublishedPermissionMode } from './permissionMode-CH4FoZfU.mjs';
|
|
17
18
|
import { d as decodeBase64, e as encodeBase64 } from './authRelay-DSAvg1uv.mjs';
|
|
18
19
|
import { readFile } from 'node:fs/promises';
|
|
19
|
-
import {
|
|
20
|
-
import { C as CLAUDE_ATTACHMENT_KINDS, s as stripAttachmentManifest } from './attachmentContent-CTXapi-_.mjs';
|
|
20
|
+
import { C as CLAUDE_ATTACHMENT_KINDS, s as stripAttachmentManifest } from './attachmentContent-j875mwU7.mjs';
|
|
21
21
|
import { T as TranscriptPathHints } from './transcriptCursor-B7T_gkQ0.mjs';
|
|
22
22
|
import { p as planClaudeStartup } from './startupPlan-DFMyNgAs.mjs';
|
|
23
23
|
import 'node:fs';
|
|
24
|
+
import 'zod';
|
|
24
25
|
import 'axios';
|
|
25
|
-
import './lidState-
|
|
26
|
+
import './lidState-B2ZxdREe.mjs';
|
|
26
27
|
import 'os';
|
|
27
28
|
import 'child_process';
|
|
28
29
|
import 'node:events';
|
|
29
30
|
import 'socket.io-client';
|
|
30
|
-
import './attachmentLimits-
|
|
31
|
-
import 'zod';
|
|
31
|
+
import './attachmentLimits-CxG3T18E.mjs';
|
|
32
32
|
import './limits-DIo7rEBR.mjs';
|
|
33
|
-
import './time-
|
|
34
|
-
import './registerCommonHandlers-
|
|
33
|
+
import './time-PG5Dfwdv.mjs';
|
|
34
|
+
import './registerCommonHandlers-B0PVff2U.mjs';
|
|
35
35
|
import 'util';
|
|
36
36
|
import 'fs/promises';
|
|
37
37
|
import 'crypto';
|
|
38
38
|
import 'path';
|
|
39
39
|
import 'cross-spawn';
|
|
40
40
|
import '@paralleldrive/cuid2';
|
|
41
|
-
import './sync-
|
|
41
|
+
import './sync-CCwYpJMS.mjs';
|
|
42
42
|
import './backgroundTaskActivity-8PdPxrvy.mjs';
|
|
43
43
|
import './contentLogMetadata-BlWI0egu.mjs';
|
|
44
44
|
import 'chalk';
|
|
45
45
|
import 'node:util';
|
|
46
46
|
import './detectCLI-CSGMlV51.mjs';
|
|
47
47
|
import 'fs';
|
|
48
|
-
import './localHappyAgentAuth-
|
|
48
|
+
import './localHappyAgentAuth-B5XPEMwk.mjs';
|
|
49
49
|
import 'tweetnacl';
|
|
50
50
|
import 'url';
|
|
51
51
|
|
|
52
52
|
const DEFAULT_CLAUDE_MODEL = void 0;
|
|
53
53
|
const DEFAULT_CLAUDE_EFFORT = void 0;
|
|
54
|
-
const importRunClaudeDeps = () => import('./runClaudeDeps-
|
|
54
|
+
const importRunClaudeDeps = () => import('./runClaudeDeps-CX_TxS78.mjs');
|
|
55
55
|
async function runClaude(credentials, options = {}) {
|
|
56
56
|
logger.debug(`[CLAUDE] ===== CLAUDE MODE STARTING =====`);
|
|
57
57
|
logger.debug(`[CLAUDE] This is the Claude agent, NOT Gemini`);
|
|
@@ -65,7 +65,7 @@ async function runClaude(credentials, options = {}) {
|
|
|
65
65
|
const isAssistantVariant = process.env.HAPPY_SESSION_VARIANT === "assistant";
|
|
66
66
|
if (isAssistantVariant) {
|
|
67
67
|
try {
|
|
68
|
-
const { bootstrapAssistantHome } = await import('./bootstrap-
|
|
68
|
+
const { bootstrapAssistantHome } = await import('./bootstrap-BSOxYpaP.mjs');
|
|
69
69
|
await bootstrapAssistantHome();
|
|
70
70
|
} catch (error) {
|
|
71
71
|
logger.debug("[START] Assistant home bootstrap failed:", error);
|
|
@@ -140,7 +140,7 @@ async function runClaude(credentials, options = {}) {
|
|
|
140
140
|
// a brand-new session cannot pick a PDF until after sending once.
|
|
141
141
|
attachmentKinds: [...CLAUDE_ATTACHMENT_KINDS],
|
|
142
142
|
queueCancellation: true,
|
|
143
|
-
capabilities: ["claude-steer-v1", "claude-live-permission-v1", "claude-live-permission-v2", "claude-btw-v1", "claude-runtime-controls-v1", "claude-opus-5-5-v1", PROMPT_QUEUE_CAPABILITY, FORK_BACKFILL_CAPABILITY],
|
|
143
|
+
capabilities: ["claude-steer-v1", "claude-live-permission-v1", "claude-live-permission-v2", "claude-btw-v1", "claude-runtime-controls-v1", "claude-opus-5-5-v1", PROMPT_QUEUE_CAPABILITY, FORK_BACKFILL_CAPABILITY, HIBERNATION_CAPABILITY],
|
|
144
144
|
// Effective mode this process enforces. Kept current by
|
|
145
145
|
// publishPermissionMode below; the web renders it instead of guessing.
|
|
146
146
|
permissionMode: mapToClaudeMode(initialPermissionMode ?? "default"),
|
|
@@ -157,7 +157,9 @@ async function runClaude(credentials, options = {}) {
|
|
|
157
157
|
// itself — that one is the variant above and never joins the lists at
|
|
158
158
|
// all. (Shared helper: the other flavors get the same tag via
|
|
159
159
|
// createSessionMetadata.)
|
|
160
|
-
...originTags ? { tags: originTags } : {}
|
|
160
|
+
...originTags ? { tags: originTags } : {},
|
|
161
|
+
// B-586: linked git worktree → branch shown in the session list.
|
|
162
|
+
...sessionWorktreeMetadata(workingDirectory)
|
|
161
163
|
};
|
|
162
164
|
const reconnectSessionId = process.env.HAPPY_RECONNECT_SESSION_ID;
|
|
163
165
|
const reconnectKeyBase64 = process.env.HAPPY_RECONNECT_ENCRYPTION_KEY;
|
|
@@ -183,7 +185,7 @@ async function runClaude(credentials, options = {}) {
|
|
|
183
185
|
}
|
|
184
186
|
if (!response) {
|
|
185
187
|
let offlineSessionId = null;
|
|
186
|
-
const { claudeLocal } = await import('./claudeLocal-
|
|
188
|
+
const { claudeLocal } = await import('./claudeLocal-D5-eA9SC.mjs');
|
|
187
189
|
const { createSessionScanner: createSessionScanner2 } = await loadDeps();
|
|
188
190
|
const reconnection = startOfflineReconnection({
|
|
189
191
|
serverUrl: configuration.serverUrl,
|
|
@@ -230,12 +232,17 @@ async function runClaude(credentials, options = {}) {
|
|
|
230
232
|
throw new Error(`Failed to reactivate archived session ${response.id}`);
|
|
231
233
|
}
|
|
232
234
|
let reconnectSeeded = false;
|
|
235
|
+
let wakingFromHibernation = false;
|
|
233
236
|
if (reconnectSessionId) {
|
|
234
237
|
const snapshot = await api.getSession(response.id, response.encryptionKey, response.encryptionVariant);
|
|
235
238
|
if (snapshot.ok) {
|
|
236
239
|
response = applyServerSnapshot(response, snapshot.session);
|
|
237
240
|
reconnectSeeded = true;
|
|
238
241
|
logger.debug(`[START] Reconnect seeded from server: seq=${snapshot.session.seq} metadataVersion=${snapshot.session.metadataVersion}`);
|
|
242
|
+
const wake = applyHibernationReplay(response);
|
|
243
|
+
response = wake.response;
|
|
244
|
+
wakingFromHibernation = wake.replaying;
|
|
245
|
+
if (wake.replaying) logger.debug(`[START] Waking from hibernation: replaying records after seq=${response.seq}`);
|
|
239
246
|
} else {
|
|
240
247
|
response = withoutServerSnapshot(response);
|
|
241
248
|
logger.debug(`[START] Reconnect without server snapshot (${snapshot.reason}); skipping existing messages`);
|
|
@@ -327,7 +334,7 @@ async function runClaude(credentials, options = {}) {
|
|
|
327
334
|
if (reconnectSessionId) {
|
|
328
335
|
session.suppressNextArchiveSignal();
|
|
329
336
|
if (!reconnectSeeded) session.skipExistingMessages();
|
|
330
|
-
void session.cancelUndeliveredQueuedInputs();
|
|
337
|
+
if (!wakingFromHibernation) void session.cancelUndeliveredQueuedInputs();
|
|
331
338
|
session.updateMetadata((meta) => ({
|
|
332
339
|
...mergeReconnectMetadata(meta, metadata, Date.now()),
|
|
333
340
|
queueCancellation: true,
|
|
@@ -779,12 +786,14 @@ async function runClaude(credentials, options = {}) {
|
|
|
779
786
|
});
|
|
780
787
|
});
|
|
781
788
|
const exitGate = new SessionExitGate();
|
|
789
|
+
let hibernationProbe = null;
|
|
782
790
|
const cleanup = async (opts = { archive: true }) => {
|
|
783
|
-
const intent = exitGate.claim(exitIntentFromArchiveFlag(opts.archive));
|
|
791
|
+
const intent = opts.hibernation ? "hibernate" : exitGate.claim(exitIntentFromArchiveFlag(opts.archive));
|
|
784
792
|
if (intent === null) {
|
|
785
793
|
logger.debug(`[START] Termination (archive=${opts.archive ?? true}) ignored: cleanup already running as ${exitGate.current}`);
|
|
786
794
|
return;
|
|
787
795
|
}
|
|
796
|
+
hibernationProbe?.stop();
|
|
788
797
|
logger.debug(`[START] Received termination signal, cleaning up (archive=${intent === "archive"})...`);
|
|
789
798
|
promptQueueDrain.close();
|
|
790
799
|
cleanupPrewarm();
|
|
@@ -793,6 +802,7 @@ async function runClaude(credentials, options = {}) {
|
|
|
793
802
|
currentSession?.cleanup();
|
|
794
803
|
await settleSessionOnExit(session.sessionId, intent, {
|
|
795
804
|
updateMetadata: (handler) => session.updateMetadata(handler),
|
|
805
|
+
updateMetadataAndWait: (handler) => session.updateMetadataAndWait(handler),
|
|
796
806
|
sendSessionDeath: () => session.sendSessionDeath(),
|
|
797
807
|
archiveSession: (id) => api.archiveSession(id),
|
|
798
808
|
deactivateSession: (id) => api.deactivateSession(id),
|
|
@@ -835,6 +845,58 @@ async function runClaude(credentials, options = {}) {
|
|
|
835
845
|
void cleanup({ archive: true });
|
|
836
846
|
});
|
|
837
847
|
registerKillSessionHandler(session.rpcHandlerManager, () => cleanup({ archive: true }), session);
|
|
848
|
+
let keepAwakeLatch = false;
|
|
849
|
+
const hibernationSnapshot = () => {
|
|
850
|
+
const agentState = session.getAgentState();
|
|
851
|
+
const current = currentSession;
|
|
852
|
+
const meta = session.getMetadata();
|
|
853
|
+
return {
|
|
854
|
+
flavor: "claude",
|
|
855
|
+
resumable: typeof meta?.claudeSessionId === "string" && meta.claudeSessionId.length > 0,
|
|
856
|
+
uiSession: options.startedBy === "daemon" && options.startingMode === "remote" && agentState?.controlledByUser !== true,
|
|
857
|
+
...isAssistantVariant ? { variant: "assistant" } : {},
|
|
858
|
+
...process.env.HAPPY_SPAWNED_BY ? { spawnedBy: process.env.HAPPY_SPAWNED_BY } : {},
|
|
859
|
+
...meta?.tags ? { tags: meta.tags } : {},
|
|
860
|
+
keepAwake: keepAwakeLatch = latchKeepAwake(meta?.keepAwake, keepAwakeLatch),
|
|
861
|
+
...typeof meta?.keepAwake === "boolean" ? { keepAwakeSetting: meta.keepAwake } : {},
|
|
862
|
+
thinking: current?.thinking === true,
|
|
863
|
+
queuedInputs: messageQueue.size() + (session.promptQueueHasPending() ? 1 : 0),
|
|
864
|
+
waitingForInput: messageQueue.isWaiting(),
|
|
865
|
+
pendingRequests: Object.keys(agentState?.requests ?? {}).length,
|
|
866
|
+
backgroundTasks: current?.backgroundTasks.length ?? 0,
|
|
867
|
+
scheduledWakeups: current?.scheduledWakeups.pending() ?? 0,
|
|
868
|
+
lastActivityAt: session.lastActivityAt,
|
|
869
|
+
...exitGate.current && exitGate.current !== "hibernate" ? { exiting: true } : {}
|
|
870
|
+
};
|
|
871
|
+
};
|
|
872
|
+
if (options.startedBy === "daemon" && options.startingMode === "remote" && !isAssistantVariant) {
|
|
873
|
+
hibernationProbe = new HibernationProbe({
|
|
874
|
+
checkMs: resolveCheckMs(),
|
|
875
|
+
snapshot: hibernationSnapshot,
|
|
876
|
+
ask: (report) => checkDaemonHibernation({ sessionId: session.sessionId, pid: process.pid, report }),
|
|
877
|
+
commit: (idleMs) => commitHibernation({
|
|
878
|
+
client: session,
|
|
879
|
+
claimExit: () => exitGate.claim("hibernate") !== null,
|
|
880
|
+
exitRequested: () => exitGate.exitRequested,
|
|
881
|
+
markCommitted: () => exitGate.commitHibernate(),
|
|
882
|
+
// Review P1-1: an archive / kill / SIGTERM deferred during the
|
|
883
|
+
// commit window runs now instead of being lost.
|
|
884
|
+
releaseExit: () => {
|
|
885
|
+
const deferred = exitGate.release("hibernate");
|
|
886
|
+
if (deferred) void cleanup({ archive: deferred === "archive" });
|
|
887
|
+
},
|
|
888
|
+
recheck: () => evaluateWrapperIdle(hibernationSnapshot(), idleMs, Date.now()),
|
|
889
|
+
idleMs,
|
|
890
|
+
finish: (stamp) => cleanup({ archive: false, hibernation: stamp })
|
|
891
|
+
}),
|
|
892
|
+
// Review P3-3: the daemon still holds keep-awake but an old web
|
|
893
|
+
// stripped the field — put it back so every web shows it checked.
|
|
894
|
+
onKeepAwakeLatched: () => {
|
|
895
|
+
if (session.getMetadata()?.keepAwake === void 0) session.updateMetadata((m) => m.keepAwake === void 0 ? { ...m, keepAwake: true } : m);
|
|
896
|
+
}
|
|
897
|
+
});
|
|
898
|
+
hibernationProbe.start();
|
|
899
|
+
}
|
|
838
900
|
const exitCode = await loop({
|
|
839
901
|
path: workingDirectory,
|
|
840
902
|
model: options.model,
|