very-happy-cli 0.2.165 → 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/README.md +1 -1
- package/dist/{AcpBackend-DCfNt9bD.cjs → AcpBackend-D1IKJGz_.cjs} +3 -3
- package/dist/{AcpBackend-C11FnVw5.mjs → AcpBackend-kFZlee5E.mjs} +3 -3
- package/dist/{AcpSessionManager-BQnDJvct.mjs → AcpSessionManager-B7FIrsys.mjs} +1 -1
- package/dist/{AcpSessionManager-9yN2iH4b.cjs → AcpSessionManager-Zf00QnlL.cjs} +1 -1
- package/dist/{BasePermissionHandler-BwQHxl6M.cjs → BasePermissionHandler-DHxYAK5L.cjs} +1 -1
- package/dist/{BasePermissionHandler-CwJ48yiB.mjs → BasePermissionHandler-DS0kRTNI.mjs} +1 -1
- package/dist/{BaseReasoningProcessor-ClF2g1qz.mjs → BaseReasoningProcessor-BRtCCt7q.mjs} +1 -1
- package/dist/{BaseReasoningProcessor-81lf_M8G.cjs → BaseReasoningProcessor-CsjVdt_H.cjs} +1 -1
- package/dist/{agentGuidance-CQuNlNx8.mjs → agentGuidance-BDYt2Qy2.mjs} +4 -2
- package/dist/{agentGuidance-B5NATuFa.cjs → agentGuidance-BtBx2xxE.cjs} +4 -1
- package/dist/{agentHome-DvR176E5.mjs → agentHome-Ct-VXFeG.mjs} +4 -4
- package/dist/{agentHome-D3Nn82kI.cjs → agentHome-DeAWzhSe.cjs} +4 -4
- package/dist/{api-AzdzTKFs.cjs → api-BZYLRDM9.cjs} +93 -13
- package/dist/{api-DTVPUE7g.mjs → api-CReZazeT.mjs} +93 -13
- package/dist/{apiMachine-B_cJldfa.cjs → apiMachine-BgMxGPsR.cjs} +2173 -66
- package/dist/{apiMachine-BQ-b4Lu3.mjs → apiMachine-CWndf1Vn.mjs} +2176 -69
- package/dist/{attachmentContent-muDCe4Gy.cjs → attachmentContent-HcJqFQW8.cjs} +2 -2
- package/dist/{attachmentContent-dzIs-wis.mjs → attachmentContent-j875mwU7.mjs} +2 -2
- package/dist/{attachmentLimits-eJZ4ZBjF.cjs → attachmentLimits-BEYEEBm8.cjs} +40 -2
- package/dist/{attachmentLimits-B8nzhw-i.mjs → attachmentLimits-CxG3T18E.mjs} +40 -2
- package/dist/{auth-Jtmvh1w4.mjs → auth-BIHuc7vY.mjs} +10 -10
- package/dist/{auth-BY5ujhGn.mjs → auth-CFS9Lfgv.mjs} +5 -5
- package/dist/{auth-DtP-B4gf.cjs → auth-Myr2Q42x.cjs} +10 -10
- package/dist/{auth-CfLd3phE.cjs → auth-VzWpbo5P.cjs} +5 -5
- package/dist/{auto-ClNnbSoF.cjs → auto-Bf6Dr7_o.cjs} +85 -21
- package/dist/{auto-DjWfR1UB.mjs → auto-Df9-zmuN.mjs} +84 -22
- package/dist/{bootstrap-D_ExGrY2.mjs → bootstrap-BSOxYpaP.mjs} +2 -2
- package/dist/{bootstrap-B1dMZA-u.cjs → bootstrap-Dj8WBiR2.cjs} +2 -2
- package/dist/{browser-mwzpOmcw.mjs → browser-BCFIHOvo.mjs} +1 -1
- package/dist/{browser-_gV7tcPs.cjs → browser-BoCV40yC.cjs} +1 -1
- package/dist/{claudeLocal-G5UmJ81F.cjs → claudeLocal-CGsq7Kul.cjs} +7 -7
- package/dist/{claudeLocal-BeHToEK5.mjs → claudeLocal-D5-eA9SC.mjs} +7 -7
- package/dist/{claudeLocalLauncher-Cq6bqAT4.mjs → claudeLocalLauncher-C9Cc438l.mjs} +15 -12
- package/dist/{claudeLocalLauncher-B4y2BsmO.cjs → claudeLocalLauncher-Cf9QeYDT.cjs} +15 -12
- package/dist/{claudeSessionFork-CDJq_b9r.cjs → claudeSessionFork-Byd8zD1U.cjs} +1 -1
- package/dist/{claudeSessionFork-CokUhS4r.mjs → claudeSessionFork-CMzAva8G.mjs} +1 -1
- package/dist/{client-Do7cGPEq.cjs → client-BKnKRLSt.cjs} +3 -3
- package/dist/{client-CJZKBZCE.mjs → client-C7FYMer0.mjs} +2 -2
- package/dist/{client-uN9d6Git.cjs → client-D0T5-6Ds.cjs} +2 -2
- package/dist/{client-BwaWdlCm.mjs → client-Dsfy_SAb.mjs} +3 -3
- package/dist/codex/happyMcpStdioBridge.cjs +23 -18
- package/dist/codex/happyMcpStdioBridge.mjs +22 -17
- package/dist/{codexAppServerClient-B0QaMQsC.mjs → codexAppServerClient-Dd_4TxHv.mjs} +48 -4
- package/dist/{codexAppServerClient-BuSdeUxT.cjs → codexAppServerClient-TiW9OBk4.cjs} +47 -3
- package/dist/{codexCommand-C3gdjMAw.mjs → codexCommand-BZSr4MKI.mjs} +170 -69
- package/dist/{codexCommand-YdYmykAR.cjs → codexCommand-Bxryqh90.cjs} +170 -69
- package/dist/{config-CGCIFRCN.mjs → config-C_Pj7yxV.mjs} +3 -3
- package/dist/{config-ChoHFnfO.cjs → config-DXPash-r.cjs} +3 -3
- package/dist/{configuration-BE61XNsg.cjs → configuration-C3piBtxY.cjs} +1 -1
- package/dist/{configuration-L1qcGTFM.mjs → configuration-WspKd2C2.mjs} +2 -2
- package/dist/{connect-D5IKfcfd.cjs → connect-BN-IBElA.cjs} +14 -14
- package/dist/{connect-CFD0Em6a.mjs → connect-DGPZs5px.mjs} +14 -14
- package/dist/{context-DaCCB4cm.mjs → context-Cr6a3NTg.mjs} +1 -1
- package/dist/{context-3WVw8qPz.cjs → context-Jrq4-eCZ.cjs} +1 -1
- package/dist/{controlClient-RWTlQA4_.cjs → controlClient-BI6Fw3fQ.cjs} +28 -5
- package/dist/{controlClient-Ci7HTMII.mjs → controlClient-DTheOlvC.mjs} +27 -6
- package/dist/{createSessionMetadata-CWR-AB2A.mjs → createSessionMetadata-BEZ4DIDA.mjs} +57 -5
- package/dist/{createSessionMetadata-CPGTztXP.cjs → createSessionMetadata-zQSz3hgk.cjs} +56 -3
- package/dist/defaultPermissionMode-Cif_RHGb.mjs +191 -0
- package/dist/defaultPermissionMode-DNKNzk7l.cjs +197 -0
- package/dist/{deterministicJson-BBwG-Ase.mjs → deterministicJson-BMMifViN.mjs} +36 -52
- package/dist/{deterministicJson-C4Jo2RWy.cjs → deterministicJson-C7O2ulKY.cjs} +41 -59
- package/dist/{doctor-ZOQLE5AH.cjs → doctor-BykBaMTr.cjs} +6 -6
- package/dist/{doctor-CAC6qY9Z.mjs → doctor-D1KKyPzB.mjs} +6 -6
- package/dist/{assistantTools-BsrG3PD-.cjs → downloadTarget-CWTb2-EM.cjs} +44 -6
- package/dist/{assistantTools-DPGga5lM.mjs → downloadTarget-Cp48jrIP.mjs} +45 -8
- package/dist/{ensureDaemonRunning-b1pvEFcS.mjs → ensureDaemonRunning-Ba5fYoxb.mjs} +5 -5
- package/dist/{ensureDaemonRunning-mIgX2vnc.cjs → ensureDaemonRunning-CCxX7MoP.cjs} +5 -5
- package/dist/{handleResumeCommand-CTGbZkCL.mjs → handleResumeCommand-BTUGlNjB.mjs} +5 -5
- package/dist/{handleResumeCommand-DGNhbv-3.cjs → handleResumeCommand-yPdDQHqz.cjs} +5 -5
- package/dist/{index-vVWpCoTr.mjs → index-B0HEEYGh.mjs} +22 -5
- package/dist/{index-BzIxE0Eu.cjs → index-BjhKqDa0.cjs} +3 -3
- package/dist/{index-BgzjPv07.mjs → index-C3_83bqS.mjs} +3 -3
- package/dist/{index-DqlyNgt4.cjs → index-C9hI8a10.cjs} +26 -4
- package/dist/{index-DjtBengz.mjs → index-CE2GgPbr.mjs} +40 -39
- package/dist/{index-Diu6HdWH.mjs → index-D8m8Ripb.mjs} +4 -4
- package/dist/{index-DrSPR59N.cjs → index-DifM62wX.cjs} +39 -38
- package/dist/{index-DIodyAqF.cjs → index-PNMQPKhz.cjs} +4 -4
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/{install-BO_W7VhL.mjs → install-BdvKiOQw.mjs} +2 -0
- package/dist/{install-Cp_aB-NQ.mjs → install-C0-QFn9s.mjs} +3 -3
- package/dist/{install-Cs5qAPrB.cjs → install-Cf6AFSWC.cjs} +2 -0
- package/dist/{install-DrUQk2DJ.cjs → install-CqZVeze8.cjs} +3 -3
- package/dist/lib.cjs +12 -12
- package/dist/lib.d.cts +116 -2
- package/dist/lib.d.mts +116 -2
- package/dist/lib.mjs +12 -12
- package/dist/{lidState-BLHLmhwd.mjs → lidState-B2ZxdREe.mjs} +1 -1
- package/dist/{lidState-z9ekRpZu.cjs → lidState-Bc2K9H9l.cjs} +1 -1
- package/dist/{localHappyAgentAuth-BWvmc_Hg.mjs → localHappyAgentAuth-B5XPEMwk.mjs} +1 -1
- package/dist/{localHappyAgentAuth-BCx0y1qW.cjs → localHappyAgentAuth-T5GOvRha.cjs} +1 -1
- package/dist/{logger-D0hkk7Vo.cjs → logger-B_MWPbZz.cjs} +2 -2
- package/dist/{logger-CknSVkIe.mjs → logger-CbBv3q_b.mjs} +2 -2
- package/dist/{machineMetadata-BDCYOXQg.cjs → machineMetadata-BafS4JY8.cjs} +4 -3
- package/dist/{machineMetadata-Cj1DoFot.mjs → machineMetadata-DHg238U4.mjs} +4 -3
- package/dist/{main-COAPGIso.cjs → main-DNrA0qBy.cjs} +45 -45
- package/dist/{main-CKUfkVG_.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-BILnw4si.cjs → mcp-AvPOhDXy.cjs} +24 -19
- package/dist/{mcp-DeYUfpo8.mjs → mcp-BotAjCdD.mjs} +23 -18
- package/dist/mirrorProtocol-BdcN6QlN.cjs +1270 -0
- package/dist/mirrorProtocol-BwHm8odn.mjs +1247 -0
- package/dist/{package-UkmvSFsg.cjs → package-C9ZP9bpX.cjs} +7 -7
- package/dist/{package-VIUXrYZ1.mjs → package-DU1DxhH9.mjs} +7 -7
- package/dist/{peerTools-CttfOxti.cjs → peerTools-Dkbu7gag.cjs} +4 -4
- package/dist/{peerTools-SWITnkqz.mjs → peerTools-os2DVjA0.mjs} +4 -4
- package/dist/{persistence-C6ztVW1W.cjs → persistence-BYGl0QYw.cjs} +147 -25
- package/dist/{persistence-DujtUH94.mjs → persistence-ON0zpHfb.mjs} +123 -12
- package/dist/{piRunnerArgs-BVJHIjlk.mjs → piRunnerArgs-CYsnT9sV.mjs} +1 -1
- package/dist/{piRunnerArgs-tBQg6xDw.cjs → piRunnerArgs-DpbvstUX.cjs} +1 -1
- package/dist/{piRuntime-DZzjF9It.cjs → piRuntime-CDnILlCd.cjs} +1 -1
- package/dist/{piRuntime-DKFA8u8t.mjs → piRuntime-CmEid-wu.mjs} +1 -1
- package/dist/{piTerminal-BTSaFlpV.mjs → piTerminal-0eNlXSlL.mjs} +17 -17
- package/dist/{piTerminal-t5pQHCPT.cjs → piTerminal-B57TgMON.cjs} +17 -17
- package/dist/precheckCompat-CWOi5c9L.cjs +29 -0
- package/dist/precheckCompat-DeEbilbr.mjs +26 -0
- package/dist/rateLimitWindows-CusGIqlq.cjs +258 -0
- package/dist/rateLimitWindows-vZ9Bo7aT.mjs +248 -0
- package/dist/{registerCommonHandlers-BR0J4g64.mjs → registerCommonHandlers-B0PVff2U.mjs} +2 -2
- package/dist/{registerCommonHandlers--8ds2auE.cjs → registerCommonHandlers-DVYB3iVn.cjs} +2 -2
- package/dist/{registerKillSessionHandler-Czz0tdki.mjs → registerKillSessionHandler-BJMHJHXe.mjs} +15 -10
- package/dist/{registerKillSessionHandler-CI23l8aJ.cjs → registerKillSessionHandler-BwXGKtg_.cjs} +15 -10
- package/dist/{remoteSessionClient-DCAUHgPz.mjs → remoteSessionClient-BzPXSC21.mjs} +5 -5
- package/dist/{remoteSessionClient-BAkIwM2S.cjs → remoteSessionClient-PyUAIhwK.cjs} +5 -5
- package/dist/{tools-BVRoGcQH.mjs → reportProgressTool-BvB13EwC.mjs} +67 -10
- package/dist/{tools-mWqsE6ji.cjs → reportProgressTool-D4KB_4cP.cjs} +73 -9
- package/dist/{run-CkKujjn8.cjs → run-BC8jzq_h.cjs} +558 -122
- package/dist/{run-B75qm2I6.mjs → run-O2M8LsWf.mjs} +556 -120
- package/dist/{runClaude-B1T9DLLi.cjs → runClaude-C7jPa8VP.cjs} +93 -26
- package/dist/{runClaude-aBfBweec.mjs → runClaude-DGkr5E7s.mjs} +93 -26
- package/dist/{runClaudeDeps-BGjNGfuZ.cjs → runClaudeDeps-5kzncqME.cjs} +113 -35
- package/dist/{runClaudeDeps-BOrPP4J1.mjs → runClaudeDeps-CX_TxS78.mjs} +116 -37
- package/dist/{runGemini-BuAA_OQb.cjs → runGemini-BfYA4Uqc.cjs} +43 -36
- package/dist/{runGemini-a-V7JE-J.mjs → runGemini-CwmGBH3L.mjs} +43 -36
- package/dist/{runOpenClaw-DUSwXg1A.mjs → runOpenClaw-BYAPYFyL.mjs} +18 -18
- package/dist/{runOpenClaw-BBVffIh9.cjs → runOpenClaw-C72jut7v.cjs} +18 -18
- package/dist/{sandbox-Fd2G5yaq.cjs → sandbox-Bqkp8IT7.cjs} +4 -4
- package/dist/{sandbox-Brb_5wzc.mjs → sandbox-DlVnK1Vi.mjs} +4 -4
- package/dist/{selfCheck-NuJKMInJ.cjs → selfCheck-B4lLZplk.cjs} +34 -34
- package/dist/selfCheck-DYTGBdIO.mjs +84 -0
- package/dist/{send-DEQJiq_x.mjs → send-B5bWW9Tl.mjs} +8 -8
- package/dist/{send-4dgHKC3u.cjs → send-BCwS6n_s.cjs} +8 -8
- package/dist/{server-C6AlUFkw.mjs → server-CEJfRQfj.mjs} +4 -4
- package/dist/{server-DWGcDmHG.cjs → server-CFWZehnC.cjs} +6 -6
- package/dist/{sessionLock-Dm8QyGo4.mjs → sessionLock-AwOYsKT7.mjs} +12 -4
- package/dist/{sessionLock-B1GgaO1q.cjs → sessionLock-LBWNjpHf.cjs} +12 -3
- package/dist/{sessionModeFile-BvOEJ4Fl.cjs → sessionModeFile-CyPuZRIU.cjs} +1 -1
- package/dist/{sessionModeFile-CuNAWCKL.mjs → sessionModeFile-fvFn1JVG.mjs} +1 -1
- package/dist/{sessionOps-DG5MMEp_.mjs → sessionOps-DZRH4-hV.mjs} +4 -4
- package/dist/{sessionOps-JP64uJmc.cjs → sessionOps-DzbZI3Eq.cjs} +4 -4
- package/dist/{sessionScanner-DqSk5Ol_.mjs → sessionScanner-Q_Ei2flB.mjs} +75 -19
- package/dist/{sessionScanner-BBPEgJ5S.cjs → sessionScanner-i-cgwFVw.cjs} +75 -19
- package/dist/{sessions-4isbBAWi.mjs → sessions-DAmjMAZN.mjs} +9 -9
- package/dist/{sessions-DgJuw_i0.cjs → sessions-DYK5hD4T.cjs} +9 -9
- package/dist/{setupOfflineReconnection-_MoZtsro.mjs → setupOfflineReconnection-BfDBxNdo.mjs} +2 -2
- package/dist/{setupOfflineReconnection-CKJKVIUS.cjs → setupOfflineReconnection-C2LO3hSP.cjs} +2 -2
- package/dist/{spawn-BTOG4tTm.mjs → spawn-BmjG5j5Y.mjs} +15 -14
- package/dist/{spawn-CshERWbY.cjs → spawn-GK_sXE8h.cjs} +15 -14
- package/dist/{spawnAgents-Czi2VDzj.mjs → spawnAgents-HDaE3C0-.mjs} +1 -1
- package/dist/{spawnAgents-McixdtV1.cjs → spawnAgents-vglexX9N.cjs} +1 -1
- package/dist/{spawnHappyCLI-Dc4xYm8P.mjs → spawnHappyCLI-B2h0P4b5.mjs} +1 -1
- package/dist/{spawnHappyCLI-Dd5_8Vex.cjs → spawnHappyCLI-J4iEhfyZ.cjs} +1 -1
- package/dist/specialCommands-DisVxagO.mjs +93 -0
- package/dist/specialCommands-DmJMKspE.cjs +96 -0
- package/dist/{startFileWatcher-B0VlG-Fn.mjs → startFileWatcher-CeK1k5gt.mjs} +1 -1
- package/dist/{startFileWatcher-1LedLBY-.cjs → startFileWatcher-xKo8AoYl.cjs} +1 -1
- package/dist/{streamRelay-C0AffuX6.cjs → streamRelay-Ce9sgcOV.cjs} +1 -1
- package/dist/{streamRelay-BzMEEvJU.mjs → streamRelay-Iogsh51a.mjs} +1 -1
- package/dist/{sync-DwUUGGFz.cjs → sync-Bvc-vh6C.cjs} +1 -1
- package/dist/{sync-Dfm6K2te.mjs → sync-CCwYpJMS.mjs} +1 -1
- package/dist/{systemPrompt-D41Zw1a3.mjs → systemPrompt-BNIkP3tR.mjs} +3 -3
- package/dist/{systemPrompt-CB1Ls0AE.cjs → systemPrompt-DwOddbuG.cjs} +3 -3
- package/dist/{teams-D8Ly3i6u.mjs → teams-DRrLBcys.mjs} +7 -7
- package/dist/{teams-NWv2ji16.cjs → teams-GHMCRZOw.cjs} +7 -7
- package/dist/{time-BbzJ7PJQ.cjs → time-BXvtjhe9.cjs} +1 -1
- package/dist/{time-v1Y_qEJp.mjs → time-PG5Dfwdv.mjs} +1 -1
- package/dist/{titleGenerator-cH6IkPRi.cjs → titleGenerator-B07bZA0V.cjs} +2 -2
- package/dist/{titleGenerator-BhoblAQY.mjs → titleGenerator-CIzfpfZW.mjs} +1 -1
- package/dist/{todo-D1hgWV6d.cjs → todo-B0aeoNu3.cjs} +6 -6
- package/dist/{todo-CuNct-fw.mjs → todo-CfL7SBFc.mjs} +6 -6
- package/dist/{tools-jof0Bu54.mjs → tools-D91mq5Ib.mjs} +1 -1
- package/dist/{tools-c2fb0CF5.cjs → tools-DJIANHSh.cjs} +1 -1
- package/dist/transcriptCursor-B7T_gkQ0.mjs +102 -0
- package/dist/transcriptCursor-DcXGLeSc.cjs +106 -0
- package/dist/{uninstall-BB7WYYAk.mjs → uninstall-5xz3Xvhf.mjs} +3 -3
- package/dist/{uninstall-VPH5GfrA.cjs → uninstall-AtzOfdrj.cjs} +3 -3
- package/package.json +7 -7
- package/scripts/terminal_status_forwarder.cjs +89 -0
- package/dist/defaultPermissionMode-BnxJPVHT.mjs +0 -4
- package/dist/defaultPermissionMode-CxmTXUQR.cjs +0 -7
- package/dist/mirrorProtocol-BNLtoWjO.mjs +0 -170
- package/dist/mirrorProtocol-BUtmg1ws.cjs +0 -186
- package/dist/selfCheck-BgwJ3NGS.mjs +0 -84
- package/dist/specialCommands-BSqhYg5X.mjs +0 -52
- package/dist/specialCommands-DSsTeRej.cjs +0 -54
|
@@ -1,94 +1,96 @@
|
|
|
1
|
-
import { a as authAndSetupMachineIfNeeded } from './auth-
|
|
2
|
-
import {
|
|
1
|
+
import { a as authAndSetupMachineIfNeeded } from './auth-CFS9Lfgv.mjs';
|
|
2
|
+
import { c as createEnvelope, o as BUILTIN_TODO_DISCOVERY, P as PROMPT_QUEUE_CAPABILITY } from './index-B0HEEYGh.mjs';
|
|
3
3
|
import { p as publishForkBackfillWhenCommitted, F as FORK_BACKFILL_CAPABILITY } from './forkBackfill-DYIjlN1Z.mjs';
|
|
4
4
|
import { randomUUID } from 'node:crypto';
|
|
5
5
|
import { createId } from '@paralleldrive/cuid2';
|
|
6
6
|
import { r as registerAgentAttachmentDownloads } from './agentAttachments-M_B5qEF2.mjs';
|
|
7
|
-
import { C as CLAUDE_ATTACHMENT_KINDS, a as stageClaudeAttachments, b as appendStagedAttachmentsToPrompt } from './attachmentContent-
|
|
7
|
+
import { C as CLAUDE_ATTACHMENT_KINDS, a as stageClaudeAttachments, b as appendStagedAttachmentsToPrompt } from './attachmentContent-j875mwU7.mjs';
|
|
8
8
|
import { useStdout, useInput, Box, Text, render } from 'ink';
|
|
9
|
-
import { c as claimSessionOrExit, a as applyServerSnapshot, w as withoutServerSnapshot, m as mergeReconnectMetadata } from './sessionLock-
|
|
9
|
+
import { c as claimSessionOrExit, a as applyServerSnapshot, b as applyHibernationReplay, w as withoutServerSnapshot, m as mergeReconnectMetadata } from './sessionLock-AwOYsKT7.mjs';
|
|
10
10
|
import React, { useState, useRef, useEffect, useCallback } from 'react';
|
|
11
|
-
import { c as connectionState, A as ApiClient } from './api-
|
|
12
|
-
import { C as CodexAppServerClient } from './codexAppServerClient-
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { B as
|
|
11
|
+
import { c as connectionState, A as ApiClient } from './api-CReZazeT.mjs';
|
|
12
|
+
import { C as CodexAppServerClient } from './codexAppServerClient-Dd_4TxHv.mjs';
|
|
13
|
+
import { p as parseSpecialCommand, w as wrapperRateLimitReporter } from './specialCommands-DisVxagO.mjs';
|
|
14
|
+
import { l as logger } from './logger-CbBv3q_b.mjs';
|
|
15
|
+
import { B as BasePermissionHandler } from './BasePermissionHandler-DS0kRTNI.mjs';
|
|
16
|
+
import { B as BaseReasoningProcessor } from './BaseReasoningProcessor-BRtCCt7q.mjs';
|
|
16
17
|
import { execSync } from 'node:child_process';
|
|
17
|
-
import { readSettings } from './persistence-
|
|
18
|
-
import { g as getInitialMachineMetadata } from './machineMetadata-
|
|
19
|
-
import { c as configuration } from './configuration-
|
|
20
|
-
import { M as MessageQueue2, r as registerKillSessionHandler } from './registerKillSessionHandler-
|
|
18
|
+
import { r as readSettings, l as latchKeepAwake, e as evaluateWrapperIdle, a as resolveCheckMs, H as HIBERNATION_CAPABILITY } from './persistence-ON0zpHfb.mjs';
|
|
19
|
+
import { g as getInitialMachineMetadata } from './machineMetadata-DHg238U4.mjs';
|
|
20
|
+
import { c as configuration } from './configuration-WspKd2C2.mjs';
|
|
21
|
+
import { M as MessageQueue2, r as registerKillSessionHandler } from './registerKillSessionHandler-BJMHJHXe.mjs';
|
|
21
22
|
import { p as projectPath } from './projectPath-BTBIMB57.mjs';
|
|
22
23
|
import { join } from 'node:path';
|
|
23
|
-
import { c as createSessionMetadata } from './createSessionMetadata-
|
|
24
|
-
import { h as hashObject, s as startHappyServer } from './deterministicJson-
|
|
24
|
+
import { c as createSessionMetadata } from './createSessionMetadata-BEZ4DIDA.mjs';
|
|
25
|
+
import { h as hashObject, s as startHappyServer } from './deterministicJson-BMMifViN.mjs';
|
|
25
26
|
import { M as MessageBuffer } from './messageBuffer-BWlGgR3A.mjs';
|
|
26
|
-
import { n as notifyDaemonSessionStarted,
|
|
27
|
+
import { n as notifyDaemonSessionStarted, j as reportSessionEditToDaemon, c as checkDaemonHibernation } from './controlClient-DTheOlvC.mjs';
|
|
28
|
+
import { a as HibernationExitLatch, H as HibernationProbe, c as commitHibernation, b as DEFAULT_CODEX_PERMISSION_MODE } from './defaultPermissionMode-Cif_RHGb.mjs';
|
|
27
29
|
import { d as decodeBase64, e as encodeBase64 } from './authRelay-DSAvg1uv.mjs';
|
|
28
|
-
import { s as setupOfflineReconnection } from './setupOfflineReconnection-
|
|
30
|
+
import { s as setupOfflineReconnection } from './setupOfflineReconnection-BfDBxNdo.mjs';
|
|
29
31
|
import { t as trimIdent } from './trimIdent-BAjmv_TG.mjs';
|
|
30
|
-
import { p as parseSpecialCommand } from './specialCommands-BSqhYg5X.mjs';
|
|
31
32
|
import { C as CHANGE_TITLE_INSTRUCTION } from './constants-BC4St0xd.mjs';
|
|
32
|
-
import { a as DEFAULT_CODEX_PERMISSION_MODE } from './defaultPermissionMode-BnxJPVHT.mjs';
|
|
33
33
|
import { E as EditReportThrottle, a as extractCodexPatchPaths } from './editPaths-BVfS_FFL.mjs';
|
|
34
|
-
import { a as extractNoSandboxFlag, e as ensureDaemonRunning } from './ensureDaemonRunning-
|
|
34
|
+
import { a as extractNoSandboxFlag, e as ensureDaemonRunning } from './ensureDaemonRunning-Ba5fYoxb.mjs';
|
|
35
35
|
import 'tweetnacl';
|
|
36
36
|
import 'axios';
|
|
37
|
-
import './time-
|
|
38
|
-
import './browser-
|
|
37
|
+
import './time-PG5Dfwdv.mjs';
|
|
38
|
+
import './browser-BCFIHOvo.mjs';
|
|
39
39
|
import 'open';
|
|
40
40
|
import 'zod';
|
|
41
41
|
import 'node:fs/promises';
|
|
42
|
-
import './attachmentLimits-
|
|
42
|
+
import './attachmentLimits-CxG3T18E.mjs';
|
|
43
43
|
import 'node:fs';
|
|
44
|
-
import './lidState-
|
|
44
|
+
import './lidState-B2ZxdREe.mjs';
|
|
45
45
|
import 'os';
|
|
46
46
|
import 'child_process';
|
|
47
47
|
import 'node:events';
|
|
48
48
|
import 'socket.io-client';
|
|
49
49
|
import './limits-DIo7rEBR.mjs';
|
|
50
|
-
import './registerCommonHandlers-
|
|
50
|
+
import './registerCommonHandlers-B0PVff2U.mjs';
|
|
51
51
|
import 'util';
|
|
52
52
|
import 'fs/promises';
|
|
53
53
|
import 'crypto';
|
|
54
54
|
import 'path';
|
|
55
55
|
import 'cross-spawn';
|
|
56
|
-
import './sync-
|
|
56
|
+
import './sync-CCwYpJMS.mjs';
|
|
57
57
|
import './backgroundTaskActivity-8PdPxrvy.mjs';
|
|
58
58
|
import './contentLogMetadata-BlWI0egu.mjs';
|
|
59
59
|
import 'chalk';
|
|
60
60
|
import 'node:readline';
|
|
61
|
-
import './manager-
|
|
61
|
+
import './manager-BEsI4qt3.mjs';
|
|
62
62
|
import '@anthropic-ai/sandbox-runtime';
|
|
63
63
|
import 'node:os';
|
|
64
|
-
import './package-
|
|
64
|
+
import './package-DU1DxhH9.mjs';
|
|
65
|
+
import './rateLimitWindows-vZ9Bo7aT.mjs';
|
|
65
66
|
import 'node:util';
|
|
66
67
|
import './detectCLI-CSGMlV51.mjs';
|
|
67
68
|
import 'fs';
|
|
68
|
-
import './localHappyAgentAuth-
|
|
69
|
+
import './localHappyAgentAuth-B5XPEMwk.mjs';
|
|
69
70
|
import './types-CkqAACXx.mjs';
|
|
70
71
|
import 'url';
|
|
71
|
-
import './client-
|
|
72
|
-
import './context-
|
|
73
|
-
import './sessionOps-
|
|
72
|
+
import './client-Dsfy_SAb.mjs';
|
|
73
|
+
import './context-Cr6a3NTg.mjs';
|
|
74
|
+
import './sessionOps-DZRH4-hV.mjs';
|
|
74
75
|
import './resources-BdFBQi8r.mjs';
|
|
75
|
-
import './tools-
|
|
76
|
-
import './
|
|
77
|
-
import './client-
|
|
78
|
-
import './
|
|
76
|
+
import './tools-D91mq5Ib.mjs';
|
|
77
|
+
import './reportProgressTool-BvB13EwC.mjs';
|
|
78
|
+
import './client-C7FYMer0.mjs';
|
|
79
|
+
import './precheckCompat-DeEbilbr.mjs';
|
|
80
|
+
import './agentGuidance-BDYt2Qy2.mjs';
|
|
81
|
+
import './peerTools-os2DVjA0.mjs';
|
|
79
82
|
import './ids-DU6sLx4C.mjs';
|
|
80
|
-
import './remoteSessionClient-
|
|
83
|
+
import './remoteSessionClient-BzPXSC21.mjs';
|
|
81
84
|
import '@modelcontextprotocol/sdk/server/mcp.js';
|
|
82
85
|
import 'node:http';
|
|
83
86
|
import '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
84
|
-
import './
|
|
87
|
+
import './downloadTarget-Cp48jrIP.mjs';
|
|
85
88
|
import './terminals-Dlg0x3nY.mjs';
|
|
86
89
|
import './terminalTitleSuggest-CeKsX_V6.mjs';
|
|
87
90
|
import './tmuxSocket-B8Yx20sT.mjs';
|
|
88
|
-
import './bootstrap-
|
|
89
|
-
import './agentGuidance-CQuNlNx8.mjs';
|
|
91
|
+
import './bootstrap-BSOxYpaP.mjs';
|
|
90
92
|
import './previewPath-CXN4Vag0.mjs';
|
|
91
|
-
import './spawnHappyCLI-
|
|
93
|
+
import './spawnHappyCLI-B2h0P4b5.mjs';
|
|
92
94
|
import './doctorReadiness-C208SMN9.mjs';
|
|
93
95
|
|
|
94
96
|
function getStartedSubagents(state) {
|
|
@@ -650,20 +652,29 @@ async function readChildThread(client, childId) {
|
|
|
650
652
|
return { envelopes: mapCodexThreadToSessionEnvelopes(thread) };
|
|
651
653
|
}
|
|
652
654
|
|
|
655
|
+
const HAPPY_MCP_SERVER_NAME = "happy";
|
|
653
656
|
class CodexPermissionHandler extends BasePermissionHandler {
|
|
654
657
|
// Exact tool names that should always be auto-approved. Include the bare
|
|
655
658
|
// form (used by Codex elicitation messages like `tool "change_title"`)
|
|
656
|
-
// and the MCP-qualified form for defense in depth.
|
|
659
|
+
// and the MCP-qualified form for defense in depth. A BARE name (and an ID
|
|
660
|
+
// prefix) only counts when the request comes from our own server: any
|
|
661
|
+
// other MCP server may expose a tool with the same name.
|
|
662
|
+
// B-556: report_progress only writes this session's own board line (same
|
|
663
|
+
// trust as change_title); an approval prompt per report would park the
|
|
664
|
+
// session in "waiting for you" at every milestone.
|
|
657
665
|
static ALWAYS_AUTO_APPROVE_NAMES = /* @__PURE__ */ new Set([
|
|
658
666
|
"change_title",
|
|
659
|
-
"mcp__happy__change_title"
|
|
667
|
+
"mcp__happy__change_title",
|
|
668
|
+
"report_progress",
|
|
669
|
+
"mcp__happy__report_progress"
|
|
660
670
|
]);
|
|
661
671
|
// Tool-call IDs that should auto-approve when they exactly match one of
|
|
662
672
|
// these values or start with `<name>-` (e.g. `change_title-1765385846663`).
|
|
663
673
|
// Substring matching was a bypass vector — any tool whose ID happened to
|
|
664
674
|
// contain `change_title` as a substring would be silently approved.
|
|
665
675
|
static ALWAYS_AUTO_APPROVE_ID_PREFIXES = [
|
|
666
|
-
"change_title"
|
|
676
|
+
"change_title",
|
|
677
|
+
"report_progress"
|
|
667
678
|
];
|
|
668
679
|
constructor(session) {
|
|
669
680
|
super(session);
|
|
@@ -671,7 +682,11 @@ class CodexPermissionHandler extends BasePermissionHandler {
|
|
|
671
682
|
getLogPrefix() {
|
|
672
683
|
return "[Codex]";
|
|
673
684
|
}
|
|
674
|
-
shouldAutoApprove(toolName, toolCallId) {
|
|
685
|
+
shouldAutoApprove(toolName, toolCallId, serverName) {
|
|
686
|
+
if (toolName.startsWith(`mcp__${HAPPY_MCP_SERVER_NAME}__`)) {
|
|
687
|
+
return CodexPermissionHandler.ALWAYS_AUTO_APPROVE_NAMES.has(toolName);
|
|
688
|
+
}
|
|
689
|
+
if (serverName !== HAPPY_MCP_SERVER_NAME) return false;
|
|
675
690
|
if (CodexPermissionHandler.ALWAYS_AUTO_APPROVE_NAMES.has(toolName)) {
|
|
676
691
|
return true;
|
|
677
692
|
}
|
|
@@ -687,10 +702,11 @@ class CodexPermissionHandler extends BasePermissionHandler {
|
|
|
687
702
|
* @param toolCallId - The unique ID of the tool call
|
|
688
703
|
* @param toolName - The name of the tool being called
|
|
689
704
|
* @param input - The input parameters for the tool
|
|
705
|
+
* @param serverName - MCP server of an elicitation (`mcpServer/elicitation/request`); undefined for exec/patch
|
|
690
706
|
* @returns Promise resolving to permission result
|
|
691
707
|
*/
|
|
692
|
-
async handleToolCall(toolCallId, toolName, input) {
|
|
693
|
-
if (this.shouldAutoApprove(toolName, toolCallId)) {
|
|
708
|
+
async handleToolCall(toolCallId, toolName, input, serverName) {
|
|
709
|
+
if (this.shouldAutoApprove(toolName, toolCallId, serverName)) {
|
|
694
710
|
logger.debug(`${this.getLogPrefix()} Auto-approving tool ${toolName} (${toolCallId})`);
|
|
695
711
|
this.session.updateAgentState((currentState) => ({
|
|
696
712
|
...currentState,
|
|
@@ -913,6 +929,29 @@ const CodexDisplay = ({ messageBuffer, logPath, onExit }) => {
|
|
|
913
929
|
));
|
|
914
930
|
};
|
|
915
931
|
|
|
932
|
+
async function settleCodexSession(session, intent, deactivate, log = () => {
|
|
933
|
+
}) {
|
|
934
|
+
if (intent === "archive") {
|
|
935
|
+
session.updateMetadata((currentMetadata) => ({
|
|
936
|
+
...currentMetadata,
|
|
937
|
+
lifecycleState: "archived",
|
|
938
|
+
lifecycleStateSince: Date.now(),
|
|
939
|
+
archivedBy: "cli",
|
|
940
|
+
archiveReason: "User terminated"
|
|
941
|
+
}));
|
|
942
|
+
}
|
|
943
|
+
session.sendSessionDeath();
|
|
944
|
+
await session.flush();
|
|
945
|
+
if (intent === "offline") {
|
|
946
|
+
try {
|
|
947
|
+
await deactivate(session.sessionId);
|
|
948
|
+
} catch (error) {
|
|
949
|
+
log("[Codex] deactivate on signal failed", error);
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
await session.close();
|
|
953
|
+
}
|
|
954
|
+
|
|
916
955
|
function resolveCodexExecutionPolicy(permissionMode, sandboxManagedByHappy) {
|
|
917
956
|
if (sandboxManagedByHappy) {
|
|
918
957
|
return {
|
|
@@ -1277,7 +1316,7 @@ async function runCodex(opts) {
|
|
|
1277
1316
|
dangerouslySkipPermissions: initialPermissionMode === "yolo" || initialPermissionMode === "bypassPermissions",
|
|
1278
1317
|
...forkedFromSessionId ? { parentSessionId: forkedFromSessionId } : {},
|
|
1279
1318
|
...forkedFromMessageId ? { forkedFromMessageId } : {},
|
|
1280
|
-
capabilities: [PROMPT_QUEUE_CAPABILITY, FORK_BACKFILL_CAPABILITY]
|
|
1319
|
+
capabilities: [PROMPT_QUEUE_CAPABILITY, FORK_BACKFILL_CAPABILITY, HIBERNATION_CAPABILITY]
|
|
1281
1320
|
});
|
|
1282
1321
|
metadata.attachmentKinds = [...CLAUDE_ATTACHMENT_KINDS];
|
|
1283
1322
|
const importCodexThreadId = process.env[IMPORT_CODEX_THREAD_ENV];
|
|
@@ -1315,12 +1354,16 @@ async function runCodex(opts) {
|
|
|
1315
1354
|
throw new Error(`Failed to reactivate archived session ${response.id}`);
|
|
1316
1355
|
}
|
|
1317
1356
|
let reconnectSeeded = false;
|
|
1357
|
+
let wakingFromHibernation = false;
|
|
1318
1358
|
if (reconnectSessionId && response) {
|
|
1319
1359
|
const snapshot = await api.getSession(response.id, response.encryptionKey, response.encryptionVariant);
|
|
1320
1360
|
if (snapshot.ok) {
|
|
1321
1361
|
response = applyServerSnapshot(response, snapshot.session);
|
|
1322
1362
|
reconnectSeeded = true;
|
|
1323
1363
|
logger.debug(`[START] Reconnect seeded from server: seq=${snapshot.session.seq} metadataVersion=${snapshot.session.metadataVersion}`);
|
|
1364
|
+
const wake = applyHibernationReplay(response);
|
|
1365
|
+
response = wake.response;
|
|
1366
|
+
wakingFromHibernation = wake.replaying;
|
|
1324
1367
|
} else {
|
|
1325
1368
|
response = withoutServerSnapshot(response);
|
|
1326
1369
|
logger.debug(`[START] Reconnect without server snapshot (${snapshot.reason}); skipping existing messages`);
|
|
@@ -1351,7 +1394,7 @@ async function runCodex(opts) {
|
|
|
1351
1394
|
if (reconnectSessionId) {
|
|
1352
1395
|
session.suppressNextArchiveSignal();
|
|
1353
1396
|
if (!reconnectSeeded) session.skipExistingMessages();
|
|
1354
|
-
void session.cancelUndeliveredQueuedInputs();
|
|
1397
|
+
if (!wakingFromHibernation) void session.cancelUndeliveredQueuedInputs();
|
|
1355
1398
|
session.updateMetadata((meta) => mergeReconnectMetadata(meta, metadata, Date.now()));
|
|
1356
1399
|
}
|
|
1357
1400
|
if (response) {
|
|
@@ -1515,7 +1558,10 @@ async function runCodex(opts) {
|
|
|
1515
1558
|
}
|
|
1516
1559
|
let abortController = new AbortController();
|
|
1517
1560
|
let shouldExit = false;
|
|
1518
|
-
|
|
1561
|
+
const hibernationExit = new HibernationExitLatch((a, b) => a === "archive" && b !== "archive");
|
|
1562
|
+
let hibernationStamp = null;
|
|
1563
|
+
let hibernationProbe = null;
|
|
1564
|
+
async function handleAbort(source) {
|
|
1519
1565
|
if (abortInProgress) {
|
|
1520
1566
|
await abortInProgress;
|
|
1521
1567
|
return;
|
|
@@ -1531,6 +1577,9 @@ async function runCodex(opts) {
|
|
|
1531
1577
|
gracePeriodMs: 3e3,
|
|
1532
1578
|
forceRestartOnTimeout: true
|
|
1533
1579
|
});
|
|
1580
|
+
if (source === "user" && abortResult.hadActiveTurn && abortResult.aborted) {
|
|
1581
|
+
session.sendSessionEvent({ type: "message", message: "Aborted by user" });
|
|
1582
|
+
}
|
|
1534
1583
|
if (abortResult.forcedRestart) {
|
|
1535
1584
|
logger.warn("[Codex] Forced app-server restart after interrupt timeout");
|
|
1536
1585
|
session.sendSessionEvent({
|
|
@@ -1554,23 +1603,16 @@ async function runCodex(opts) {
|
|
|
1554
1603
|
await abortInProgress;
|
|
1555
1604
|
abortInProgress = null;
|
|
1556
1605
|
}
|
|
1557
|
-
const handleKillSession = async () => {
|
|
1606
|
+
const handleKillSession = async (intent = "archive") => {
|
|
1607
|
+
if (hibernationExit.intercept(intent)) {
|
|
1608
|
+
logger.debug(`[Codex] ${intent} exit deferred: hibernation in progress`);
|
|
1609
|
+
return;
|
|
1610
|
+
}
|
|
1558
1611
|
logger.debug("[Codex] Kill session requested - terminating process");
|
|
1559
|
-
await handleAbort();
|
|
1612
|
+
await handleAbort("kill");
|
|
1560
1613
|
logger.debug("[Codex] Abort completed, proceeding with termination");
|
|
1561
1614
|
try {
|
|
1562
|
-
if (session)
|
|
1563
|
-
session.updateMetadata((currentMetadata) => ({
|
|
1564
|
-
...currentMetadata,
|
|
1565
|
-
lifecycleState: "archived",
|
|
1566
|
-
lifecycleStateSince: Date.now(),
|
|
1567
|
-
archivedBy: "cli",
|
|
1568
|
-
archiveReason: "User terminated"
|
|
1569
|
-
}));
|
|
1570
|
-
session.sendSessionDeath();
|
|
1571
|
-
await session.flush();
|
|
1572
|
-
await session.close();
|
|
1573
|
-
}
|
|
1615
|
+
if (session) await settleCodexSession(session, intent, (id) => api.deactivateSession(id), (m, e) => logger.debug(m, safeCodexErrorMetadata(e)));
|
|
1574
1616
|
try {
|
|
1575
1617
|
await client.disconnect();
|
|
1576
1618
|
} catch (e) {
|
|
@@ -1591,8 +1633,8 @@ async function runCodex(opts) {
|
|
|
1591
1633
|
return { error: error instanceof Error ? error.message : "Child read failed" };
|
|
1592
1634
|
}
|
|
1593
1635
|
});
|
|
1594
|
-
session.rpcHandlerManager.registerHandler("abort", handleAbort);
|
|
1595
|
-
const disposeTermination = registerKillSessionHandler(session.rpcHandlerManager, handleKillSession, session, { processSignals: true });
|
|
1636
|
+
session.rpcHandlerManager.registerHandler("abort", () => handleAbort("user"));
|
|
1637
|
+
const disposeTermination = registerKillSessionHandler(session.rpcHandlerManager, () => handleKillSession("archive"), session, { processSignals: true, onSignal: () => handleKillSession("offline") });
|
|
1596
1638
|
const messageBuffer = new MessageBuffer();
|
|
1597
1639
|
const hasTTY = process.stdout.isTTY && process.stdin.isTTY;
|
|
1598
1640
|
let inkInstance = null;
|
|
@@ -1604,7 +1646,7 @@ async function runCodex(opts) {
|
|
|
1604
1646
|
onExit: async () => {
|
|
1605
1647
|
logger.debug("[codex]: Exiting agent via Ctrl-C");
|
|
1606
1648
|
shouldExit = true;
|
|
1607
|
-
await handleAbort();
|
|
1649
|
+
await handleAbort("exit");
|
|
1608
1650
|
}
|
|
1609
1651
|
}), {
|
|
1610
1652
|
exitOnCtrlC: false,
|
|
@@ -1653,7 +1695,7 @@ async function runCodex(opts) {
|
|
|
1653
1695
|
const toolName = params.type === "exec" ? "CodexBash" : params.type === "patch" ? "CodexPatch" : params.toolName ?? "McpTool";
|
|
1654
1696
|
const input = params.type === "exec" ? { command: params.command, cwd: params.cwd } : params.type === "patch" ? { changes: params.fileChanges } : params.input ?? {};
|
|
1655
1697
|
try {
|
|
1656
|
-
const result = await permissionHandler.handleToolCall(params.callId, toolName, input);
|
|
1698
|
+
const result = await permissionHandler.handleToolCall(params.callId, toolName, input, params.type === "mcp" ? params.serverName : void 0);
|
|
1657
1699
|
logger.debug("[Codex] Permission request resolved");
|
|
1658
1700
|
return result.decision;
|
|
1659
1701
|
} catch (error) {
|
|
@@ -1662,6 +1704,7 @@ async function runCodex(opts) {
|
|
|
1662
1704
|
}
|
|
1663
1705
|
});
|
|
1664
1706
|
const editThrottle = new EditReportThrottle();
|
|
1707
|
+
client.setRateLimitHandler((snapshot) => wrapperRateLimitReporter().observeCodex(snapshot));
|
|
1665
1708
|
client.setEventHandler((msg) => {
|
|
1666
1709
|
if (msg.type === "token_count") {
|
|
1667
1710
|
session.sendAgentUsageSnapshot("codex", msg);
|
|
@@ -1766,7 +1809,7 @@ async function runCodex(opts) {
|
|
|
1766
1809
|
const happyServer = await startHappyServer(session);
|
|
1767
1810
|
const bridgeEntrypoint = join(projectPath(), "bin", "very-happy-mcp.mjs");
|
|
1768
1811
|
const mcpServers = {
|
|
1769
|
-
|
|
1812
|
+
[HAPPY_MCP_SERVER_NAME]: {
|
|
1770
1813
|
command: process.execPath,
|
|
1771
1814
|
args: ["--no-warnings", "--no-deprecation", bridgeEntrypoint, "--url", happyServer.url]
|
|
1772
1815
|
}
|
|
@@ -1843,6 +1886,54 @@ async function runCodex(opts) {
|
|
|
1843
1886
|
}
|
|
1844
1887
|
}
|
|
1845
1888
|
let pending = null;
|
|
1889
|
+
if (opts.startedBy === "daemon" && !hasTTY && process.env.HAPPY_SESSION_VARIANT !== "assistant") {
|
|
1890
|
+
let keepAwakeLatch = false;
|
|
1891
|
+
const hibernationSnapshot = () => {
|
|
1892
|
+
const meta = session.getMetadata();
|
|
1893
|
+
return {
|
|
1894
|
+
flavor: "codex",
|
|
1895
|
+
resumable: typeof meta?.codexThreadId === "string" && meta.codexThreadId.length > 0,
|
|
1896
|
+
uiSession: true,
|
|
1897
|
+
...process.env.HAPPY_SPAWNED_BY ? { spawnedBy: process.env.HAPPY_SPAWNED_BY } : {},
|
|
1898
|
+
...meta?.tags ? { tags: meta.tags } : {},
|
|
1899
|
+
keepAwake: keepAwakeLatch = latchKeepAwake(meta?.keepAwake, keepAwakeLatch),
|
|
1900
|
+
...typeof meta?.keepAwake === "boolean" ? { keepAwakeSetting: meta.keepAwake } : {},
|
|
1901
|
+
thinking: thinking || turnActive,
|
|
1902
|
+
queuedInputs: messageQueue.size() + (session.promptQueueHasPending() ? 1 : 0),
|
|
1903
|
+
waitingForInput: messageQueue.isWaiting(),
|
|
1904
|
+
pendingRequests: Object.keys(session.getAgentState()?.requests ?? {}).length,
|
|
1905
|
+
backgroundTasks: codexActiveSubagents.size,
|
|
1906
|
+
lastActivityAt: session.lastActivityAt,
|
|
1907
|
+
...shouldExit && !hibernationExit.hibernating ? { exiting: true } : {}
|
|
1908
|
+
};
|
|
1909
|
+
};
|
|
1910
|
+
hibernationProbe = new HibernationProbe({
|
|
1911
|
+
onKeepAwakeLatched: () => {
|
|
1912
|
+
if (session.getMetadata()?.keepAwake === void 0) session.updateMetadata((m) => m.keepAwake === void 0 ? { ...m, keepAwake: true } : m);
|
|
1913
|
+
},
|
|
1914
|
+
checkMs: resolveCheckMs(),
|
|
1915
|
+
snapshot: hibernationSnapshot,
|
|
1916
|
+
ask: (report) => checkDaemonHibernation({ sessionId: session.sessionId, pid: process.pid, report }),
|
|
1917
|
+
commit: (idleMs) => commitHibernation({
|
|
1918
|
+
client: session,
|
|
1919
|
+
claimExit: () => !shouldExit && hibernationExit.begin(),
|
|
1920
|
+
exitRequested: () => hibernationExit.exitRequested,
|
|
1921
|
+
markCommitted: () => hibernationExit.commit(),
|
|
1922
|
+
releaseExit: () => {
|
|
1923
|
+
const deferred = hibernationExit.release();
|
|
1924
|
+
if (deferred) void handleKillSession(deferred);
|
|
1925
|
+
},
|
|
1926
|
+
recheck: () => evaluateWrapperIdle(hibernationSnapshot(), idleMs, Date.now()),
|
|
1927
|
+
idleMs,
|
|
1928
|
+
finish: async (stamp) => {
|
|
1929
|
+
hibernationStamp = stamp;
|
|
1930
|
+
shouldExit = true;
|
|
1931
|
+
abortController.abort();
|
|
1932
|
+
}
|
|
1933
|
+
})
|
|
1934
|
+
});
|
|
1935
|
+
hibernationProbe.start();
|
|
1936
|
+
}
|
|
1846
1937
|
idleRelease.arm();
|
|
1847
1938
|
while (!shouldExit) {
|
|
1848
1939
|
logActiveHandles("loop-top");
|
|
@@ -1979,6 +2070,7 @@ async function runCodex(opts) {
|
|
|
1979
2070
|
}
|
|
1980
2071
|
} finally {
|
|
1981
2072
|
disposeTermination?.();
|
|
2073
|
+
hibernationProbe?.stop();
|
|
1982
2074
|
session.closePromptQueueDrain();
|
|
1983
2075
|
logger.debug("[codex]: Final cleanup start");
|
|
1984
2076
|
logActiveHandles("cleanup-start");
|
|
@@ -2027,6 +2119,15 @@ async function runCodex(opts) {
|
|
|
2027
2119
|
messageBuffer.clear();
|
|
2028
2120
|
logActiveHandles("cleanup-end");
|
|
2029
2121
|
logger.debug("[codex]: Final cleanup completed");
|
|
2122
|
+
if (hibernationExit.hibernating && hibernationStamp) {
|
|
2123
|
+
try {
|
|
2124
|
+
await api.deactivateSession(session.sessionId);
|
|
2125
|
+
} catch (error) {
|
|
2126
|
+
logger.debug("[codex]: deactivate after hibernation failed", safeCodexErrorMetadata(error));
|
|
2127
|
+
}
|
|
2128
|
+
logger.debug("[codex]: hibernated; exiting");
|
|
2129
|
+
process.exit(0);
|
|
2130
|
+
}
|
|
2030
2131
|
}
|
|
2031
2132
|
}
|
|
2032
2133
|
|