very-happy-cli 0.2.189 → 0.2.190
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-fj16v_cf.mjs → AcpBackend-Dd1h-Rgt.mjs} +3 -3
- package/dist/{AcpBackend-DRPJ2g9G.cjs → AcpBackend-dkRv9QHm.cjs} +3 -3
- package/dist/{AcpSessionManager-DM-KKg6v.cjs → AcpSessionManager-AqWAqahm.cjs} +1 -1
- package/dist/{AcpSessionManager-BZPmUDL5.mjs → AcpSessionManager-QBZ-CIf7.mjs} +2 -2
- package/dist/{BasePermissionHandler-CVtH-snr.mjs → BasePermissionHandler-CLp1ge-4.mjs} +1 -1
- package/dist/{BasePermissionHandler-DjM16uJz.cjs → BasePermissionHandler-CpSugp7Z.cjs} +1 -1
- package/dist/{acpSessionResume-2BTMsB7_.cjs → acpSessionResume-CZao6QEd.cjs} +1 -1
- package/dist/{acpSessionResume-Dxl1LRAT.mjs → acpSessionResume-CcpDuIO5.mjs} +1 -1
- package/dist/{agentHome-CHctmMzZ.mjs → agentHome-BJGRA2Kx.mjs} +4 -4
- package/dist/{agentHome-W17n1gnH.cjs → agentHome-fIUqT-pn.cjs} +4 -4
- package/dist/{api-BDuuyys8.cjs → api-CXL6jp-p.cjs} +18 -9
- package/dist/{api-B0yN68XH.mjs → api-Dw8gFsQi.mjs} +19 -10
- package/dist/{apiMachine-mc9CsKuS.mjs → apiMachine-BBNEtjf7.mjs} +56 -15
- package/dist/{apiMachine-iddD-F19.cjs → apiMachine-C6UqHoPF.cjs} +55 -14
- package/dist/{attachmentContent-CcIdMfAx.mjs → attachmentContent-CC4yIrSm.mjs} +2 -2
- package/dist/{attachmentContent-Cc5b7TPr.cjs → attachmentContent-NmVfKp-B.cjs} +2 -2
- package/dist/{auth-DQKSpaEf.cjs → auth-Bb_SL2os.cjs} +5 -5
- package/dist/{auth-DNAgkUkB.mjs → auth-Bh6SUoGi.mjs} +8 -8
- package/dist/{auth-CyrVvWHF.mjs → auth-Bj0psrD2.mjs} +5 -5
- package/dist/{auth-B7tVmyfX.cjs → auth-DKa4MsAi.cjs} +8 -8
- package/dist/{auto-CetlumDo.cjs → auto-C9Qohh0P.cjs} +15 -15
- package/dist/{auto-BklCipw1.mjs → auto-DK7pbCnV.mjs} +18 -18
- package/dist/{bootstrap-DfXwkUQb.mjs → bootstrap-Ct9Nb4sv.mjs} +2 -2
- package/dist/{bootstrap-CDY-Vz8q.cjs → bootstrap-DBJB0y-H.cjs} +2 -2
- package/dist/{browser-vb0k1zfI.mjs → browser-BGxDRhHy.mjs} +1 -1
- package/dist/{browser-D1yzC0Tu.cjs → browser-CLJWcodR.cjs} +1 -1
- package/dist/{claudeLocal-2dJIiTIq.cjs → claudeLocal-B6YDYlnY.cjs} +4 -4
- package/dist/{claudeLocal-Bid_rC_v.mjs → claudeLocal-Ux31hZyC.mjs} +5 -5
- package/dist/{claudeLocalLauncher-5pzpETxd.mjs → claudeLocalLauncher-D06QijMw.mjs} +10 -10
- package/dist/{claudeLocalLauncher-Jm5oQX5Z.cjs → claudeLocalLauncher-DFvmF8rC.cjs} +9 -9
- package/dist/{claudeSessionFork-DzecSBO4.mjs → claudeSessionFork-D2GI7P59.mjs} +1 -1
- package/dist/{claudeSessionFork-DsbcuDEJ.cjs → claudeSessionFork-DTLZ2rek.cjs} +1 -1
- package/dist/{client-D0aYWt53.cjs → client-Bffkrs5p.cjs} +2 -2
- package/dist/{client-BNmFaRXZ.cjs → client-CARZ_lNS.cjs} +3 -3
- package/dist/{client-DIfxYk7B.cjs → client-CMKGrnmT.cjs} +2 -2
- package/dist/{client-B161HwAk.mjs → client-CnGNYidN.mjs} +2 -2
- package/dist/{client-C9Ecbtko.mjs → client-CtL0Vtww.mjs} +4 -4
- package/dist/{client-CvjjadIE.mjs → client-DZkBUoh9.mjs} +2 -2
- package/dist/codex/happyMcpStdioBridge.cjs +15 -15
- package/dist/codex/happyMcpStdioBridge.mjs +16 -16
- package/dist/{codexAppServerClient-BlVmpjR-.mjs → codexAppServerClient-CLc5nhLT.mjs} +13 -6
- package/dist/{codexAppServerClient-CO9f4Jr8.cjs → codexAppServerClient-CpT9F6EM.cjs} +13 -6
- package/dist/{codexCommand-BfoRP6E9.cjs → codexCommand-39kH99SJ.cjs} +72 -48
- package/dist/{codexCommand-CAMR4g5o.mjs → codexCommand-Dliq3EBv.mjs} +69 -45
- package/dist/{codexTermination-IrLZQzKC.cjs → codexTermination-ByW7tRjr.cjs} +1 -1
- package/dist/{codexTermination-BvGlN02_.mjs → codexTermination-ORIw0gpU.mjs} +1 -1
- package/dist/{codexThreadFork-DNekT4nQ.cjs → codexThreadFork-5kwoKjMu.cjs} +11 -17
- package/dist/{codexThreadFork-R76RU5H0.mjs → codexThreadFork-DobPd19R.mjs} +11 -17
- package/dist/{config-BGFqQGvh.cjs → config-CeIzCsfj.cjs} +3 -3
- package/dist/{config-CtMgGPvf.mjs → config-CxSsGO1Z.mjs} +3 -3
- package/dist/{configuration-1FabKklB.mjs → configuration-Dechcvd-.mjs} +1 -1
- package/dist/{configuration-C0ctLGW2.cjs → configuration-Dt5lKW3P.cjs} +1 -1
- package/dist/{connect-DSw-2f52.cjs → connect-NPDzIVC6.cjs} +12 -12
- package/dist/{connect-0lSugpjf.mjs → connect-UwQHvCpR.mjs} +13 -13
- package/dist/{context-D-hEk5pC.cjs → context-BdZssgF0.cjs} +1 -1
- package/dist/{context-BgxbXWKS.mjs → context-C9JbJoNe.mjs} +1 -1
- package/dist/{controlClient-F7hAEEy2.cjs → controlClient-BRk65BRO.cjs} +3 -3
- package/dist/{controlClient-DwNnNAUx.mjs → controlClient-D7NGfmtq.mjs} +3 -3
- package/dist/{createSessionMetadata-DezS33OM.cjs → createSessionMetadata-B_HZCDj_.cjs} +2 -2
- package/dist/{createSessionMetadata-CG6Klinp.mjs → createSessionMetadata-DyhFKAby.mjs} +2 -2
- package/dist/defaultPermissionMode-BnxJPVHT.mjs +4 -0
- package/dist/defaultPermissionMode-CxmTXUQR.cjs +7 -0
- package/dist/{deterministicJson-D0LU_XbO.cjs → deterministicJson-BEygolBQ.cjs} +12 -12
- package/dist/{deterministicJson-BMwgK21e.mjs → deterministicJson-DNmMVhFu.mjs} +13 -13
- package/dist/{doctor-wVNvRarN.cjs → doctor-B9lW1WlG.cjs} +7 -7
- package/dist/{doctor-D16hySse.mjs → doctor-BdBi7TFZ.mjs} +7 -7
- package/dist/{downloadTarget-C6tqaXGm.mjs → downloadTarget-CGojGjaN.mjs} +6 -6
- package/dist/{downloadTarget-aNcCxVRL.cjs → downloadTarget-DS0zT2AU.cjs} +6 -6
- package/dist/{ensureDaemonRunning-DZq8bvsp.mjs → ensureDaemonRunning-BOdbryDM.mjs} +5 -5
- package/dist/{ensureDaemonRunning-CIghxgDR.cjs → ensureDaemonRunning-Bibp6vhe.cjs} +5 -5
- package/dist/exitAfterFlush-AbKNZM0N.mjs +23 -0
- package/dist/exitAfterFlush-DIT_sIxR.cjs +25 -0
- package/dist/{handleResumeCommand-BNnD7EuD.mjs → handleResumeCommand-CgLzBYne.mjs} +5 -5
- package/dist/{handleResumeCommand-CMUTygsm.cjs → handleResumeCommand-DXOuWr4p.cjs} +5 -5
- package/dist/{agentAttachments-Dbw8iMCZ.cjs → heldInput-BOtqFO2r.cjs} +27 -0
- package/dist/heldInput-C69lA2dH.mjs +44 -0
- package/dist/{index-De02DNu5.cjs → index-Bs5FD8JF.cjs} +4 -4
- package/dist/{index-BuiG8hmg.mjs → index-CBHfkQNY.mjs} +133 -54
- package/dist/{index-4TpmBb2Q.cjs → index-CwRW11hT.cjs} +3 -3
- package/dist/{index-Df0bc_et.mjs → index-DUByZsKe.mjs} +4 -4
- package/dist/{index-B81qV_F_.cjs → index-DXSIi6j_.cjs} +4 -4
- package/dist/{index-BCQr-5Ei.mjs → index-Db0HIC-k.mjs} +4 -4
- package/dist/{index-WKyN-bNy.mjs → index-DmqsRnV7.mjs} +1 -1
- package/dist/{index-CnzsOD19.cjs → index-f8oDidjV.cjs} +131 -52
- package/dist/{index-CKd20r1W.mjs → index-rNTX33in.mjs} +3 -3
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/{install-DNbIEJUk.cjs → install-CXIL_FYx.cjs} +3 -3
- package/dist/{install-23ehAdTD.mjs → install-DfPrEWGG.mjs} +3 -3
- package/dist/lib.cjs +11 -11
- package/dist/lib.d.cts +53 -1
- package/dist/lib.d.mts +53 -1
- package/dist/lib.mjs +12 -12
- package/dist/{lidState-q5Its2Hm.mjs → lidState-D0DF20oG.mjs} +1 -1
- package/dist/{lidState-B4dHJCeS.cjs → lidState-q_XFYg33.cjs} +1 -1
- package/dist/{localHappyAgentAuth-C_G5u5lY.mjs → localHappyAgentAuth-BBhM4Qk1.mjs} +1 -1
- package/dist/{localHappyAgentAuth-CG2nPD_H.cjs → localHappyAgentAuth-CKNW-MXw.cjs} +1 -1
- package/dist/{logger-BP1SW7Cs.cjs → logger-BBRTTVsQ.cjs} +2 -2
- package/dist/{logger-DOKH3Zbh.mjs → logger-CL7pin9b.mjs} +2 -2
- package/dist/{machineMetadata-D-5qeIqd.mjs → machineMetadata-DP06qdBk.mjs} +3 -3
- package/dist/{machineMetadata-BKX3ov9g.cjs → machineMetadata-DnFNlrVK.cjs} +3 -3
- package/dist/{main-ndpVIaSG.cjs → main-DLOXykOR.cjs} +49 -48
- package/dist/{main-DODz8DQE.mjs → main-DO7nRvhf.mjs} +49 -48
- package/dist/{mcp-BBwbSODp.mjs → mcp-C-4sPTae.mjs} +15 -15
- package/dist/{mcp-Bc4U4exu.cjs → mcp-Du0MgR7e.cjs} +14 -14
- package/dist/{mirrorProtocol-CiA3hO2y.cjs → mirrorProtocol-GuWMxLkh.cjs} +2 -2
- package/dist/{mirrorProtocol-D2vTWteS.mjs → mirrorProtocol-dkq2ZENA.mjs} +3 -3
- package/dist/{package-DTcaIhjW.mjs → package-C6uiXULx.mjs} +7 -7
- package/dist/{package-CYDdLA6R.cjs → package-DrY090nZ.cjs} +7 -7
- package/dist/{panels-C2xZ8rqU.cjs → panels-4DRBKHZP.cjs} +5 -5
- package/dist/{panels-DCaLxlSL.mjs → panels-DXYdJA6n.mjs} +5 -5
- package/dist/{peerTools-B4315xjX.cjs → peerTools-5ZM4spcZ.cjs} +5 -5
- package/dist/{peerTools-BtrUnSwz.mjs → peerTools-dY1aJez4.mjs} +5 -5
- package/dist/{persistence-CrzC7yr_.cjs → persistence-Bl5S3TLB.cjs} +6 -2
- package/dist/{persistence-0INrP3aB.mjs → persistence-Dogj7JIp.mjs} +6 -3
- package/dist/{piRunnerArgs-BtzW_kfh.cjs → piRunnerArgs-C3jZ1M6b.cjs} +1 -1
- package/dist/{piRunnerArgs-DRuxMlX1.mjs → piRunnerArgs-D8nN_Iit.mjs} +1 -1
- package/dist/{piRuntime-DEbPE_kW.cjs → piRuntime-Bd9-eq6M.cjs} +1 -1
- package/dist/{piRuntime-BMAFpIBV.mjs → piRuntime-BoeMsAXK.mjs} +1 -1
- package/dist/{piTerminal-MtxDtBE2.cjs → piTerminal-C3j1ca3x.cjs} +16 -16
- package/dist/{piTerminal-DQXV8_we.mjs → piTerminal-GEPkIGD4.mjs} +17 -17
- package/dist/{pushNotifications-CalIS9sq.cjs → pushNotifications-CfspRcl-.cjs} +20 -2
- package/dist/{pushNotifications-Cq1s8YVK.mjs → pushNotifications-dUceOIni.mjs} +21 -3
- package/dist/{query-CE2XDhhw.cjs → query-DjsVgG3E.cjs} +1 -1
- package/dist/{query-BYiPBHPC.mjs → query-iYH-tm7L.mjs} +1 -1
- package/dist/{rateLimitReporter-BKmoOZQi.cjs → rateLimitReporter-DUu2KydZ.cjs} +3 -3
- package/dist/{rateLimitReporter-DR5LXuiQ.mjs → rateLimitReporter-jeVi-fym.mjs} +3 -3
- package/dist/{rateLimitWindows-Cs56YJCH.cjs → rateLimitWindows-Bx3ROBP5.cjs} +1 -1
- package/dist/{rateLimitWindows-5vIuNjko.mjs → rateLimitWindows-CEn0DXaX.mjs} +1 -1
- package/dist/{registerCommonHandlers-DZPozYxc.cjs → registerCommonHandlers-Beun-cQv.cjs} +2 -2
- package/dist/{registerCommonHandlers-DWkTysjD.mjs → registerCommonHandlers-DWZ7mfdt.mjs} +2 -2
- package/dist/{registerKillSessionHandler-DhCjrs44.cjs → registerKillSessionHandler-CA1FFr_F.cjs} +15 -5
- package/dist/{registerKillSessionHandler-CSCTRIbI.mjs → registerKillSessionHandler-CzgklwLG.mjs} +16 -6
- package/dist/{remoteSessionClient-Vfj_5g2-.mjs → remoteSessionClient-BiC2KDew.mjs} +5 -5
- package/dist/{remoteSessionClient-Dq8XTLQP.cjs → remoteSessionClient-DGFI__5Z.cjs} +5 -5
- package/dist/{reportProgressTool-B7zmX7NJ.mjs → reportProgressTool-CgPy6n_7.mjs} +3 -3
- package/dist/{reportProgressTool-DznxPKES.cjs → reportProgressTool-CvPGov1F.cjs} +2 -2
- package/dist/{run-DSfNcR62.mjs → run-B_gFgJVB.mjs} +392 -42
- package/dist/{run-Ca8BiNCp.cjs → run-rPqQwDi_.cjs} +389 -39
- package/dist/{runClaude-hoepv-0X.mjs → runClaude-CykqeXK7.mjs} +26 -23
- package/dist/{runClaude-ClQQcgoO.cjs → runClaude-DM8gm8iu.cjs} +27 -24
- package/dist/{runClaudeDeps-D_v8t2SK.mjs → runClaudeDeps-D2phXGut.mjs} +101 -44
- package/dist/{runClaudeDeps-ck5_GYlP.cjs → runClaudeDeps-DGAomimZ.cjs} +94 -37
- package/dist/{runGemini-Cj0XsMiM.cjs → runGemini-CXTeSOZp.cjs} +32 -32
- package/dist/{runGemini-CTr2-cYG.mjs → runGemini-CtWCVkj5.mjs} +33 -33
- package/dist/{runOpenClaw-CdDMntiV.mjs → runOpenClaw-BBdjlViJ.mjs} +18 -18
- package/dist/{runOpenClaw-BoN1e3lP.cjs → runOpenClaw-CH_9_RyZ.cjs} +17 -17
- package/dist/{sandbox-BY2h19gc.cjs → sandbox-Bb5IMun3.cjs} +4 -4
- package/dist/{sandbox-DcaWB-Ou.mjs → sandbox-DGmXZ6Zz.mjs} +4 -4
- package/dist/selfCheck-BfK945YQ.mjs +86 -0
- package/dist/{selfCheck-DFS_GUaQ.cjs → selfCheck-CccwNTTK.cjs} +37 -37
- package/dist/{send-UBTHHNvZ.mjs → send-B6rHg8GT.mjs} +8 -8
- package/dist/{send-BMsUYU6g.cjs → send-BpiXPkDo.cjs} +8 -8
- package/dist/{server-Dt3mCtfQ.mjs → server-BkdAyHhC.mjs} +4 -4
- package/dist/{server-YrHMHNz1.cjs → server-DHUzjApC.cjs} +6 -6
- package/dist/{sessionLock-DSqiP2lH.cjs → sessionLock-BFBReiKq.cjs} +134 -3
- package/dist/{sessionLock-tEFvFXLD.mjs → sessionLock-Ca_bIo50.mjs} +121 -4
- package/dist/{sessionOps-CljctDs5.mjs → sessionOps-CA2kpm66.mjs} +13 -5
- package/dist/{sessionOps-BzeOKIEF.cjs → sessionOps-DeWVqpe4.cjs} +13 -4
- package/dist/{sessionProvider-ORgzmkXy.cjs → sessionProvider-VFbtUmMR.cjs} +5 -5
- package/dist/{sessionProvider-BnUFSJXM.mjs → sessionProvider-g18IiK74.mjs} +5 -5
- package/dist/{sessionScanner-Cr6PJ3PT.cjs → sessionScanner-CGzsN8V6.cjs} +3 -3
- package/dist/{sessionScanner-DZUlkdF6.mjs → sessionScanner-DDDud5re.mjs} +3 -3
- package/dist/{sessions-15cag-su.mjs → sessions-B4d50sCI.mjs} +35 -26
- package/dist/{sessions-aIo_HjmY.cjs → sessions-CKJPWFgu.cjs} +36 -25
- package/dist/{setupOfflineReconnection-B7I8R2Ex.mjs → setupOfflineReconnection-CyPNgyCe.mjs} +2 -2
- package/dist/{setupOfflineReconnection-tV0Q1dgR.cjs → setupOfflineReconnection-DPXRo_zf.cjs} +2 -2
- package/dist/{spawn-VG-HjJiR.cjs → spawn-CgSJzzWS.cjs} +13 -13
- package/dist/{spawn-ByrQgruJ.mjs → spawn-CrYN_OOT.mjs} +15 -15
- package/dist/{spawnAgents-Bh1RPShN.mjs → spawnAgents-DWCDYCQ1.mjs} +1 -1
- package/dist/{spawnHappyCLI-CxiR2Qoy.cjs → spawnHappyCLI-CTy3p6V_.cjs} +1 -1
- package/dist/{spawnHappyCLI-CEsXwz5V.mjs → spawnHappyCLI-DjbkiSH1.mjs} +1 -1
- package/dist/{startFileWatcher-C-XCZ5t2.cjs → startFileWatcher-BQs0cJA-.cjs} +1 -1
- package/dist/{startFileWatcher-DkEeeAtL.mjs → startFileWatcher-Dedtu1vq.mjs} +1 -1
- package/dist/{defaultPermissionMode-e2bIIJG4.mjs → startupSessionCreate-BKFU4v_h.mjs} +25 -6
- package/dist/{defaultPermissionMode-5EvgRq38.cjs → startupSessionCreate-Dxy3X4DG.cjs} +25 -7
- package/dist/{streamRelay-CqBynIon.mjs → streamRelay-P9e7Sohm.mjs} +1 -1
- package/dist/{sync-CoChLEIg.cjs → sync-DtWB7RzA.cjs} +1 -1
- package/dist/{sync-BvDMkKAN.mjs → sync-eZkXnsW_.mjs} +1 -1
- package/dist/{systemPrompt-Dy_Rf-0Z.cjs → systemPrompt-2XOpZ1j6.cjs} +1 -1
- package/dist/{systemPrompt-CgDaPigN.mjs → systemPrompt-Bn6g6aCH.mjs} +2 -2
- package/dist/{teams-DPvfLAk8.cjs → teams-ecFay4Gn.cjs} +6 -6
- package/dist/{teams-BC4_e5hR.mjs → teams-nadkqrbW.mjs} +7 -7
- package/dist/{template-CEK8MEjo.mjs → template-BiTD-jI9.mjs} +1 -1
- package/dist/{time-CUK37wiV.mjs → time-CN3TuSVG.mjs} +1 -1
- package/dist/{time-XwEZxKGc.cjs → time-gPD_EmA-.cjs} +1 -1
- package/dist/{titleGenerator-DWRVdqMU.mjs → titleGenerator-DgzTQdn2.mjs} +1 -1
- package/dist/{titleGenerator-DVX0NZUn.cjs → titleGenerator-lT5ldPuN.cjs} +2 -2
- package/dist/{todo-CKGrSrRE.cjs → todo-B1VeMk5A.cjs} +5 -5
- package/dist/{todo-BNMGXneA.mjs → todo-BIxd7l2Q.mjs} +6 -6
- package/dist/{tools-CjMafO_D.cjs → tools-DvqbLsCF.cjs} +1 -1
- package/dist/{tools-CCIEAVbB.mjs → tools-zXJpxiG_.mjs} +1 -1
- package/dist/{uninstall-CJvJ7gjr.mjs → uninstall-9htK6mb7.mjs} +3 -3
- package/dist/{uninstall-BdFbTXnL.cjs → uninstall-CvIOpwB5.cjs} +3 -3
- package/package.json +7 -7
- package/dist/agentAttachments-M_B5qEF2.mjs +0 -18
- package/dist/selfCheck-BQ_H2Sns.mjs +0 -86
- package/dist/startupSessionCreate-CYc8mra-.cjs +0 -26
- package/dist/startupSessionCreate-npXe2TdN.mjs +0 -24
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as hibernationReplaySeq } from './persistence-Dogj7JIp.mjs';
|
|
2
|
+
import { c as compareExactVersions } from './cliUpdate-Y34VGe9Y.mjs';
|
|
2
3
|
import { existsSync, readFileSync, unlinkSync, mkdirSync, renameSync } from 'node:fs';
|
|
3
4
|
import { join } from 'node:path';
|
|
4
|
-
import { c as configuration, w as writePrivateFileSync } from './configuration-
|
|
5
|
-
import { l as logger } from './logger-
|
|
5
|
+
import { c as configuration, w as writePrivateFileSync } from './configuration-Dechcvd-.mjs';
|
|
6
|
+
import { l as logger } from './logger-CL7pin9b.mjs';
|
|
6
7
|
import { s as snapshotTree, k as killSurvivors } from './processTreeSnapshot-CuLJDNC-.mjs';
|
|
7
8
|
|
|
8
9
|
const PROCESS_IDENTITY_FIELDS = [
|
|
@@ -81,6 +82,122 @@ function applyReconnectReplay(response) {
|
|
|
81
82
|
return { response: { ...response, seq: cursor.seq }, replay: { source: "offline-exit", seq: cursor.seq } };
|
|
82
83
|
}
|
|
83
84
|
|
|
85
|
+
const AUTO_RESTART_CAPABILITY = "auto-restart-v1";
|
|
86
|
+
const AUTO_RESTART_QUIET_MS = 10 * 60 * 1e3;
|
|
87
|
+
const AUTO_RESTART_RECHECK_CAP_MS = 10 * 60 * 1e3;
|
|
88
|
+
function resolveQuietMs(env = process.env) {
|
|
89
|
+
const raw = env.HAPPY_AUTO_RESTART_QUIET_MS;
|
|
90
|
+
if (raw !== void 0 && raw.trim() !== "") {
|
|
91
|
+
const value = Number(raw);
|
|
92
|
+
if (Number.isFinite(value) && value >= 0) return Math.round(value);
|
|
93
|
+
}
|
|
94
|
+
return AUTO_RESTART_QUIET_MS;
|
|
95
|
+
}
|
|
96
|
+
const AUTO_RESTART_MAX_CONCURRENT = 1;
|
|
97
|
+
const AUTO_RESTART_MIN_GAP_MS = 15e3;
|
|
98
|
+
const AUTO_RESTART_MAX_ATTEMPTS = 2;
|
|
99
|
+
const AUTO_RESTART_BACKOFF_MS = 10 * 60 * 1e3;
|
|
100
|
+
const AUTO_RESTART_MIN_CHECK_MS = 15e3;
|
|
101
|
+
const AUTO_RESTART_FLAVORS = ["claude", "codex", "acp"];
|
|
102
|
+
function wrapperStaleness(input) {
|
|
103
|
+
const wrapper = input.wrapperVersion?.trim();
|
|
104
|
+
if (wrapper) {
|
|
105
|
+
const cmp = compareExactVersions(wrapper, input.daemonVersion);
|
|
106
|
+
if (cmp !== null && cmp < 0) return { kind: "cli", from: wrapper, target: input.daemonVersion };
|
|
107
|
+
}
|
|
108
|
+
const running = input.agentVersion?.trim();
|
|
109
|
+
const installed = input.installedAgentVersion?.trim();
|
|
110
|
+
if (running && installed) {
|
|
111
|
+
const cmp = compareExactVersions(running, installed);
|
|
112
|
+
if (cmp !== null && cmp < 0) return { kind: "agent", from: running, target: installed };
|
|
113
|
+
}
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
function decideAutoRestart(input) {
|
|
117
|
+
const { report } = input;
|
|
118
|
+
if (!input.enabled) return { ok: false, reason: "disabled" };
|
|
119
|
+
if (!input.staleness) return { ok: false, reason: "not-stale" };
|
|
120
|
+
if (!input.trackedLive) return { ok: false, reason: "not-tracked" };
|
|
121
|
+
if (report.exiting) return { ok: false, reason: "exiting" };
|
|
122
|
+
if (!report.uiSession) return { ok: false, reason: "local-terminal" };
|
|
123
|
+
if (report.variant) return { ok: false, reason: "assistant" };
|
|
124
|
+
if (!AUTO_RESTART_FLAVORS.includes(report.flavor)) return { ok: false, reason: "unsupported-flavor" };
|
|
125
|
+
if (!input.resumable) return { ok: false, reason: "not-resumable" };
|
|
126
|
+
if (report.thinking || input.turnActive) return { ok: false, reason: "turn-active" };
|
|
127
|
+
if (report.pendingRequests > 0) return { ok: false, reason: "pending-request" };
|
|
128
|
+
if (report.queuedInputs > 0 || !report.waitingForInput) return { ok: false, reason: "queued-input" };
|
|
129
|
+
if (report.backgroundTasks > 0 || input.backgroundTasks > 0) return { ok: false, reason: "background-tasks" };
|
|
130
|
+
if ((report.scheduledWakeups ?? 0) > 0) return { ok: false, reason: "scheduled-wakeup" };
|
|
131
|
+
if (!(input.now - report.lastActivityAt >= (input.quietMs ?? AUTO_RESTART_QUIET_MS))) return { ok: false, reason: "recent-activity" };
|
|
132
|
+
if (input.automationRunning) return { ok: false, reason: "automation-running" };
|
|
133
|
+
const attempt = input.attempt && input.attempt.target === input.staleness.target ? input.attempt : null;
|
|
134
|
+
if (attempt && attempt.attempts >= AUTO_RESTART_MAX_ATTEMPTS) return { ok: false, reason: "gave-up" };
|
|
135
|
+
if (attempt && input.now < attempt.notBefore) return { ok: false, reason: "backoff" };
|
|
136
|
+
if (input.inFlight >= AUTO_RESTART_MAX_CONCURRENT) return { ok: false, reason: "machine-busy" };
|
|
137
|
+
if (input.lastStartedAt !== null && input.now - input.lastStartedAt < AUTO_RESTART_MIN_GAP_MS) return { ok: false, reason: "machine-busy" };
|
|
138
|
+
return { ok: true };
|
|
139
|
+
}
|
|
140
|
+
function autoRestartNextCheck(verdict, input, jitter = 0) {
|
|
141
|
+
if (verdict.ok) return null;
|
|
142
|
+
switch (verdict.reason) {
|
|
143
|
+
case "recent-activity":
|
|
144
|
+
return Math.max(AUTO_RESTART_MIN_CHECK_MS, input.report.lastActivityAt + (input.quietMs ?? AUTO_RESTART_QUIET_MS) - input.now);
|
|
145
|
+
case "machine-busy":
|
|
146
|
+
return AUTO_RESTART_MIN_GAP_MS + Math.round(Math.min(Math.max(jitter, 0), 0.999) * 2 * AUTO_RESTART_MIN_GAP_MS);
|
|
147
|
+
case "backoff":
|
|
148
|
+
return Math.max(AUTO_RESTART_MIN_CHECK_MS, (input.attempt?.notBefore ?? input.now) - input.now);
|
|
149
|
+
default:
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function recordAttempt(previous, target, ok, now, error) {
|
|
154
|
+
if (ok) return null;
|
|
155
|
+
const attempts = (previous && previous.target === target ? previous.attempts : 0) + 1;
|
|
156
|
+
return { target, attempts, notBefore: now + AUTO_RESTART_BACKOFF_MS * attempts, ...error ? { lastError: error } : {} };
|
|
157
|
+
}
|
|
158
|
+
const MANUAL_REASONS = /* @__PURE__ */ new Set(["local-terminal", "assistant", "unsupported-flavor", "not-resumable"]);
|
|
159
|
+
function statusFromVerdict(verdict, previous, staleness, now, attempt) {
|
|
160
|
+
if (verdict.ok) return null;
|
|
161
|
+
if (verdict.reason === "disabled" || verdict.reason === "not-stale" || verdict.reason === "not-tracked") return null;
|
|
162
|
+
const since = previous && previous.target === staleness.target ? previous.since : now;
|
|
163
|
+
if (verdict.reason === "gave-up") {
|
|
164
|
+
return { state: "failed", reason: attempt?.lastError ?? "gave-up", since, target: staleness.target };
|
|
165
|
+
}
|
|
166
|
+
return {
|
|
167
|
+
state: MANUAL_REASONS.has(verdict.reason) ? "manual" : "waiting",
|
|
168
|
+
reason: verdict.reason,
|
|
169
|
+
since,
|
|
170
|
+
target: staleness.target
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
function wrapperReportsIdle(input) {
|
|
174
|
+
const caps = input.capabilities ?? [];
|
|
175
|
+
if (input.variant) return false;
|
|
176
|
+
if (caps.includes(AUTO_RESTART_CAPABILITY)) return true;
|
|
177
|
+
if (!caps.includes("agent-hibernation-v1")) return false;
|
|
178
|
+
if (input.flavor !== "claude" && input.flavor !== "codex") return false;
|
|
179
|
+
if (input.spawnedBy && input.spawnedBy.trim()) return false;
|
|
180
|
+
return !(input.tags ?? []).some((tag) => tag === "teams" || tag === "automation" || tag === "assistant");
|
|
181
|
+
}
|
|
182
|
+
const AUTO_UPDATED_EVENT_KIND = "session-auto-updated";
|
|
183
|
+
const AUTO_RESTARTED_ENV = "HAPPY_AUTO_RESTARTED";
|
|
184
|
+
function encodeAutoRestarted(kind, target) {
|
|
185
|
+
return `${kind}:${target}`;
|
|
186
|
+
}
|
|
187
|
+
function decodeAutoRestarted(raw) {
|
|
188
|
+
const match = /^(cli|agent):(\S{1,64})$/.exec(raw?.trim() ?? "");
|
|
189
|
+
return match ? { kind: match[1], target: match[2] } : null;
|
|
190
|
+
}
|
|
191
|
+
function autoUpdatedEventText(kind, version, agentName = "Codex") {
|
|
192
|
+
return kind === "agent" ? `Updated ${agentName} to ${version} (session restarted in place, history kept)` : `Updated to Very Happy ${version} (session restarted in place, history kept)`;
|
|
193
|
+
}
|
|
194
|
+
function takeAutoRestartedEvent(env, agentName) {
|
|
195
|
+
const decoded = decodeAutoRestarted(env[AUTO_RESTARTED_ENV]);
|
|
196
|
+
delete env[AUTO_RESTARTED_ENV];
|
|
197
|
+
if (!decoded) return null;
|
|
198
|
+
return { type: "message", kind: AUTO_UPDATED_EVENT_KIND, message: autoUpdatedEventText(decoded.kind, decoded.target, agentName) };
|
|
199
|
+
}
|
|
200
|
+
|
|
84
201
|
const runtime = {
|
|
85
202
|
signal: (pid, signal) => process.kill(pid, signal),
|
|
86
203
|
isAlive: (pid) => {
|
|
@@ -233,4 +350,4 @@ async function claimSessionOrExit(happySessionId, options) {
|
|
|
233
350
|
process.on("exit", () => releaseSessionLock(happySessionId));
|
|
234
351
|
}
|
|
235
352
|
|
|
236
|
-
export { applyServerSnapshot as a, applyReconnectReplay as b, claimSessionOrExit as c,
|
|
353
|
+
export { AUTO_RESTART_CAPABILITY as A, applyServerSnapshot as a, applyReconnectReplay as b, claimSessionOrExit as c, wrapperReportsIdle as d, exitCursorStamp as e, decideAutoRestart as f, autoRestartNextCheck as g, wrapperStaleness as h, AUTO_RESTART_MAX_ATTEMPTS as i, AUTO_RESTART_MIN_GAP_MS as j, readSessionLock as k, terminateProcess as l, mergeReconnectMetadata as m, terminateProcessTree as n, AUTO_RESTARTED_ENV as o, processIdentityFields as p, encodeAutoRestarted as q, recordAttempt as r, statusFromVerdict as s, takeAutoRestartedEvent as t, resolveQuietMs as u, AUTO_RESTART_RECHECK_CAP_MS as v, withoutServerSnapshot as w };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
-
import { c as configuration } from './configuration-
|
|
2
|
+
import { c as configuration } from './configuration-Dechcvd-.mjs';
|
|
3
3
|
import { e as encodeBase64, g as encrypt, d as decodeBase64, h as decrypt } from './authRelay-DhQhkBvX.mjs';
|
|
4
|
-
import { l as listDaemonSessions, f as stopDaemonSession } from './controlClient-
|
|
5
|
-
import { b as readCredentialsForConfiguredRelay, c as readPersistedSessions } from './persistence-
|
|
4
|
+
import { l as listDaemonSessions, f as stopDaemonSession } from './controlClient-D7NGfmtq.mjs';
|
|
5
|
+
import { b as readCredentialsForConfiguredRelay, c as readPersistedSessions } from './persistence-Dogj7JIp.mjs';
|
|
6
6
|
import { randomUUID } from 'node:crypto';
|
|
7
|
-
import { d as delay } from './time-
|
|
7
|
+
import { d as delay } from './time-CN3TuSVG.mjs';
|
|
8
8
|
import { c as compactCommandText, p as parseClear } from './specialCommands-MXUN0wfI.mjs';
|
|
9
9
|
import { io } from 'socket.io-client';
|
|
10
10
|
import { b as backgroundTasksReport } from './backgroundTaskActivity-8PdPxrvy.mjs';
|
|
@@ -541,6 +541,12 @@ function sessionLiveness(live, sessionId) {
|
|
|
541
541
|
const child = live.find((entry) => entry.happySessionId === sessionId);
|
|
542
542
|
return child ? livenessOf(child) : { live: false };
|
|
543
543
|
}
|
|
544
|
+
function lineageOf(meta) {
|
|
545
|
+
return {
|
|
546
|
+
...typeof meta?.parentSessionId === "string" && meta.parentSessionId ? { parentSessionId: meta.parentSessionId } : {},
|
|
547
|
+
...typeof meta?.forkedFromMessageId === "string" && meta.forkedFromMessageId ? { forkedFromMessageId: meta.forkedFromMessageId } : {}
|
|
548
|
+
};
|
|
549
|
+
}
|
|
544
550
|
function toSummary(id, persisted, extra) {
|
|
545
551
|
const meta = persisted?.metadata;
|
|
546
552
|
return {
|
|
@@ -553,6 +559,7 @@ function toSummary(id, persisted, extra) {
|
|
|
553
559
|
...meta?.flavor ? { flavor: meta.flavor } : {},
|
|
554
560
|
...meta?.tags?.length ? { tags: [...meta.tags] } : {},
|
|
555
561
|
...meta?.variant ? { variant: meta.variant } : {},
|
|
562
|
+
...lineageOf(meta),
|
|
556
563
|
url: sessionWebUrl(id),
|
|
557
564
|
...persisted?.savedAt !== void 0 ? { savedAt: persisted.savedAt } : {}
|
|
558
565
|
};
|
|
@@ -598,6 +605,7 @@ function summarizeAccountSession(row, persisted, liveIds, now) {
|
|
|
598
605
|
...meta.flavor ? { flavor: meta.flavor } : {},
|
|
599
606
|
...meta.tags?.length ? { tags: [...meta.tags] } : {},
|
|
600
607
|
...meta.variant ? { variant: meta.variant } : {},
|
|
608
|
+
...lineageOf(meta),
|
|
601
609
|
...meta.machineId ? { machineId: meta.machineId } : {},
|
|
602
610
|
...persisted.savedAt !== void 0 ? { savedAt: persisted.savedAt } : {},
|
|
603
611
|
pending,
|
|
@@ -785,4 +793,4 @@ async function unarchiveSession(sessionId) {
|
|
|
785
793
|
);
|
|
786
794
|
}
|
|
787
795
|
|
|
788
|
-
export { DEFAULT_RECENT_LIMIT as D, MAX_READ_LIMIT as M, TurnWaitTimeoutError as T, listSessions as a, stopSession as b, resolvePermissionRequest as c, archiveSession as d, sendUserMessage as e, readSessionMetadata as f, waitForSessionKey as g, sessionLiveness as h, readSessionState as i,
|
|
796
|
+
export { DEFAULT_RECENT_LIMIT as D, MAX_READ_LIMIT as M, TurnWaitTimeoutError as T, listSessions as a, stopSession as b, resolvePermissionRequest as c, archiveSession as d, sendUserMessage as e, readSessionMetadata as f, waitForSessionKey as g, sessionLiveness as h, readSessionState as i, lineageOf as j, analyzeLatestTurn as k, listAccountSessions as l, readSessionLog as m, TURN_WINDOW as n, openUserScopedSocket as o, userPromptText as p, readSessionTranscript as r, sessionWebUrl as s, unarchiveSession as u, waitForTurnEnd as w };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var axios = require('axios');
|
|
4
|
-
var configuration = require('./configuration-
|
|
4
|
+
var configuration = require('./configuration-Dt5lKW3P.cjs');
|
|
5
5
|
var authRelay = require('./authRelay-Dy1qU9td.cjs');
|
|
6
|
-
var controlClient = require('./controlClient-
|
|
7
|
-
var persistence = require('./persistence-
|
|
6
|
+
var controlClient = require('./controlClient-BRk65BRO.cjs');
|
|
7
|
+
var persistence = require('./persistence-Bl5S3TLB.cjs');
|
|
8
8
|
var node_crypto = require('node:crypto');
|
|
9
|
-
var time = require('./time-
|
|
9
|
+
var time = require('./time-gPD_EmA-.cjs');
|
|
10
10
|
var specialCommands = require('./specialCommands-J3JFOq0J.cjs');
|
|
11
11
|
var socket_ioClient = require('socket.io-client');
|
|
12
12
|
var backgroundTaskActivity = require('./backgroundTaskActivity-CBvUdj39.cjs');
|
|
@@ -543,6 +543,12 @@ function sessionLiveness(live, sessionId) {
|
|
|
543
543
|
const child = live.find((entry) => entry.happySessionId === sessionId);
|
|
544
544
|
return child ? livenessOf(child) : { live: false };
|
|
545
545
|
}
|
|
546
|
+
function lineageOf(meta) {
|
|
547
|
+
return {
|
|
548
|
+
...typeof meta?.parentSessionId === "string" && meta.parentSessionId ? { parentSessionId: meta.parentSessionId } : {},
|
|
549
|
+
...typeof meta?.forkedFromMessageId === "string" && meta.forkedFromMessageId ? { forkedFromMessageId: meta.forkedFromMessageId } : {}
|
|
550
|
+
};
|
|
551
|
+
}
|
|
546
552
|
function toSummary(id, persisted, extra) {
|
|
547
553
|
const meta = persisted?.metadata;
|
|
548
554
|
return {
|
|
@@ -555,6 +561,7 @@ function toSummary(id, persisted, extra) {
|
|
|
555
561
|
...meta?.flavor ? { flavor: meta.flavor } : {},
|
|
556
562
|
...meta?.tags?.length ? { tags: [...meta.tags] } : {},
|
|
557
563
|
...meta?.variant ? { variant: meta.variant } : {},
|
|
564
|
+
...lineageOf(meta),
|
|
558
565
|
url: sessionWebUrl(id),
|
|
559
566
|
...persisted?.savedAt !== void 0 ? { savedAt: persisted.savedAt } : {}
|
|
560
567
|
};
|
|
@@ -600,6 +607,7 @@ function summarizeAccountSession(row, persisted, liveIds, now) {
|
|
|
600
607
|
...meta.flavor ? { flavor: meta.flavor } : {},
|
|
601
608
|
...meta.tags?.length ? { tags: [...meta.tags] } : {},
|
|
602
609
|
...meta.variant ? { variant: meta.variant } : {},
|
|
610
|
+
...lineageOf(meta),
|
|
603
611
|
...meta.machineId ? { machineId: meta.machineId } : {},
|
|
604
612
|
...persisted.savedAt !== void 0 ? { savedAt: persisted.savedAt } : {},
|
|
605
613
|
pending,
|
|
@@ -793,6 +801,7 @@ exports.TURN_WINDOW = TURN_WINDOW;
|
|
|
793
801
|
exports.TurnWaitTimeoutError = TurnWaitTimeoutError;
|
|
794
802
|
exports.analyzeLatestTurn = analyzeLatestTurn;
|
|
795
803
|
exports.archiveSession = archiveSession;
|
|
804
|
+
exports.lineageOf = lineageOf;
|
|
796
805
|
exports.listAccountSessions = listAccountSessions;
|
|
797
806
|
exports.listSessions = listSessions;
|
|
798
807
|
exports.openUserScopedSocket = openUserScopedSocket;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chalk = require('chalk');
|
|
4
|
-
var configuration = require('./configuration-
|
|
5
|
-
var controlClient = require('./controlClient-
|
|
4
|
+
var configuration = require('./configuration-Dt5lKW3P.cjs');
|
|
5
|
+
var controlClient = require('./controlClient-BRk65BRO.cjs');
|
|
6
6
|
var providerBinding = require('./providerBinding-B-Qbx9W2.cjs');
|
|
7
7
|
require('node:fs');
|
|
8
8
|
require('node:os');
|
|
9
9
|
require('node:path');
|
|
10
|
-
require('./package-
|
|
10
|
+
require('./package-DrY090nZ.cjs');
|
|
11
11
|
require('node:fs/promises');
|
|
12
|
-
require('./logger-
|
|
12
|
+
require('./logger-BBRTTVsQ.cjs');
|
|
13
13
|
require('node:util');
|
|
14
|
-
require('./persistence-
|
|
14
|
+
require('./persistence-Bl5S3TLB.cjs');
|
|
15
15
|
require('zod');
|
|
16
16
|
require('./authRelay-Dy1qU9td.cjs');
|
|
17
17
|
require('node:crypto');
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
-
import { c as configuration } from './configuration-
|
|
3
|
-
import { r as restartDaemonSession } from './controlClient-
|
|
2
|
+
import { c as configuration } from './configuration-Dechcvd-.mjs';
|
|
3
|
+
import { r as restartDaemonSession } from './controlClient-D7NGfmtq.mjs';
|
|
4
4
|
import { r as readSessionProviders, b as readProviders, w as writeSessionProviders, u as updateBindings, s as sessionProvidersPath } from './providerBinding-CYubGg-Z.mjs';
|
|
5
5
|
import 'node:fs';
|
|
6
6
|
import 'node:os';
|
|
7
7
|
import 'node:path';
|
|
8
|
-
import './package-
|
|
8
|
+
import './package-C6uiXULx.mjs';
|
|
9
9
|
import 'node:fs/promises';
|
|
10
|
-
import './logger-
|
|
10
|
+
import './logger-CL7pin9b.mjs';
|
|
11
11
|
import 'node:util';
|
|
12
|
-
import './persistence-
|
|
12
|
+
import './persistence-Dogj7JIp.mjs';
|
|
13
13
|
import 'zod';
|
|
14
14
|
import './authRelay-DhQhkBvX.mjs';
|
|
15
15
|
import 'node:crypto';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var sync = require('./sync-
|
|
3
|
+
var sync = require('./sync-DtWB7RzA.cjs');
|
|
4
4
|
var types = require('./types-CRS-srZK.cjs');
|
|
5
5
|
var path$1 = require('node:path');
|
|
6
6
|
var node_fs = require('node:fs');
|
|
7
7
|
var transcriptCursor = require('./transcriptCursor-DcXGLeSc.cjs');
|
|
8
|
-
var logger = require('./logger-
|
|
9
|
-
var startFileWatcher = require('./startFileWatcher-
|
|
8
|
+
var logger = require('./logger-BBRTTVsQ.cjs');
|
|
9
|
+
var startFileWatcher = require('./startFileWatcher-BQs0cJA-.cjs');
|
|
10
10
|
var path = require('./path-B7zW-WwE.cjs');
|
|
11
11
|
|
|
12
12
|
class Future {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { I as InvalidateSync } from './sync-
|
|
1
|
+
import { I as InvalidateSync } from './sync-eZkXnsW_.mjs';
|
|
2
2
|
import { R as RawJSONLinesSchema } from './types-CkqAACXx.mjs';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import { statSync } from 'node:fs';
|
|
5
5
|
import { r as readTranscriptIncrement, i as isValidTranscriptHint } from './transcriptCursor-B7T_gkQ0.mjs';
|
|
6
|
-
import { l as logger } from './logger-
|
|
7
|
-
import { s as startFileWatcher } from './startFileWatcher-
|
|
6
|
+
import { l as logger } from './logger-CL7pin9b.mjs';
|
|
7
|
+
import { s as startFileWatcher } from './startFileWatcher-Dedtu1vq.mjs';
|
|
8
8
|
import { g as getProjectPath } from './path-D2wdaNSk.mjs';
|
|
9
9
|
|
|
10
10
|
class Future {
|
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
-
import {
|
|
2
|
+
import { e as exitAfterFlush } from './exitAfterFlush-AbKNZM0N.mjs';
|
|
3
|
+
import { D as DEFAULT_RECENT_LIMIT, M as MAX_READ_LIMIT, l as listAccountSessions, a as listSessions, w as waitForTurnEnd, T as TurnWaitTimeoutError, r as readSessionTranscript, b as stopSession, c as resolvePermissionRequest, d as archiveSession } from './sessionOps-CA2kpm66.mjs';
|
|
3
4
|
import { i as isValidSessionId } from './ids-DU6sLx4C.mjs';
|
|
4
|
-
import { c as cliPeerSelf, e as executeSessionPeerTool, l as listPeerSessions, s as sendPeerMessage
|
|
5
|
-
import { c as readPersistedSessions } from './persistence-
|
|
5
|
+
import { P as PEER_SCOPES, c as cliPeerSelf, e as executeSessionPeerTool, l as listPeerSessions, s as sendPeerMessage } from './peerTools-dY1aJez4.mjs';
|
|
6
|
+
import { c as readPersistedSessions } from './persistence-Dogj7JIp.mjs';
|
|
6
7
|
import { resolve } from 'node:path';
|
|
7
|
-
import { f as fillForeignAccountRows, l as listRemoteSessions, a as listRemotePeers, w as waitForRemoteTurnEnd, r as readRemoteTranscript } from './remoteSessionClient-
|
|
8
|
+
import { f as fillForeignAccountRows, l as listRemoteSessions, a as listRemotePeers, w as waitForRemoteTurnEnd, r as readRemoteTranscript } from './remoteSessionClient-BiC2KDew.mjs';
|
|
8
9
|
import 'axios';
|
|
9
|
-
import './configuration-
|
|
10
|
+
import './configuration-Dechcvd-.mjs';
|
|
10
11
|
import 'node:fs';
|
|
11
12
|
import 'node:os';
|
|
12
|
-
import './package-
|
|
13
|
+
import './package-C6uiXULx.mjs';
|
|
13
14
|
import 'node:fs/promises';
|
|
14
15
|
import './authRelay-DhQhkBvX.mjs';
|
|
15
16
|
import 'node:crypto';
|
|
16
17
|
import 'tweetnacl';
|
|
17
|
-
import './controlClient-
|
|
18
|
-
import './logger-
|
|
18
|
+
import './controlClient-D7NGfmtq.mjs';
|
|
19
|
+
import './logger-CL7pin9b.mjs';
|
|
19
20
|
import 'node:util';
|
|
20
|
-
import './time-
|
|
21
|
+
import './time-CN3TuSVG.mjs';
|
|
21
22
|
import './specialCommands-MXUN0wfI.mjs';
|
|
22
23
|
import 'socket.io-client';
|
|
23
24
|
import './backgroundTaskActivity-8PdPxrvy.mjs';
|
|
24
25
|
import 'zod';
|
|
25
|
-
import './client-
|
|
26
|
+
import './client-CnGNYidN.mjs';
|
|
26
27
|
|
|
27
28
|
const MACHINE_ID_RE = /^[a-zA-Z0-9_-]{1,128}$/;
|
|
28
29
|
const ACTIONS = ["list", "read", "stop", "archive", "approve", "deny", "peers", "message"];
|
|
@@ -185,6 +186,9 @@ ${chalk.bold("Actions:")}
|
|
|
185
186
|
async sub-agents / backgrounded commands still running after
|
|
186
187
|
the turn ended \u2014 such a session is NOT idle (absent = the
|
|
187
188
|
daemon or CLI is too old to report it).
|
|
189
|
+
A forked session shows \`parent=<id>\` (\`parentSessionId\`,
|
|
190
|
+
plus \`forkedFromMessageId\` for a fork from a message, in
|
|
191
|
+
--json) in list, list --all and read.
|
|
188
192
|
stop SIGTERM the session's process via the local daemon.
|
|
189
193
|
archive Mark the session inactive server-side (it stays resumable).
|
|
190
194
|
approve Answer a pending permission request \`requestId\` with approve \u2014
|
|
@@ -280,6 +284,7 @@ function formatAccountSummaryLine(summary) {
|
|
|
280
284
|
if (summary.flavor) parts.push(`agent=${summary.flavor}`);
|
|
281
285
|
if (summary.tags?.length) parts.push(`tags=${summary.tags.join(",")}`);
|
|
282
286
|
if (summary.variant) parts.push(`variant=${summary.variant}`);
|
|
287
|
+
if (summary.parentSessionId) parts.push(`parent=${summary.parentSessionId}`);
|
|
283
288
|
if (summary.machineId) parts.push(`machine=${summary.machineId}`);
|
|
284
289
|
if (summary.cwd) parts.push(`cwd=${summary.cwd}`);
|
|
285
290
|
if (summary.backgroundTasks && summary.backgroundTasks.count > 0) parts.push(formatBackgroundTasks(summary.backgroundTasks));
|
|
@@ -306,6 +311,7 @@ function formatSummaryLine(summary) {
|
|
|
306
311
|
if (summary.flavor) parts.push(`agent=${summary.flavor}`);
|
|
307
312
|
if (summary.tags?.length) parts.push(`tags=${summary.tags.join(",")}`);
|
|
308
313
|
if (summary.variant) parts.push(`variant=${summary.variant}`);
|
|
314
|
+
if (summary.parentSessionId) parts.push(`parent=${summary.parentSessionId}`);
|
|
309
315
|
if (summary.cwd) parts.push(`cwd=${summary.cwd}`);
|
|
310
316
|
if (summary.pid !== void 0) parts.push(`pid=${summary.pid}`);
|
|
311
317
|
if (summary.backgroundTasks && summary.backgroundTasks.count > 0) parts.push(formatBackgroundTasks(summary.backgroundTasks));
|
|
@@ -313,17 +319,20 @@ function formatSummaryLine(summary) {
|
|
|
313
319
|
return parts.join(" ");
|
|
314
320
|
}
|
|
315
321
|
async function handleSessionsCommand(args) {
|
|
322
|
+
return exitAfterFlush(await runSessionsCommand(args));
|
|
323
|
+
}
|
|
324
|
+
async function runSessionsCommand(args) {
|
|
316
325
|
let options;
|
|
317
326
|
try {
|
|
318
327
|
options = parseSessionsArgs(args);
|
|
319
328
|
} catch (error) {
|
|
320
329
|
console.error(chalk.red("Error:"), error instanceof Error ? error.message : String(error));
|
|
321
330
|
console.error(`Run ${chalk.cyan("very-happy sessions --help")} for usage.`);
|
|
322
|
-
|
|
331
|
+
return 1;
|
|
323
332
|
}
|
|
324
333
|
if (options.action === "help") {
|
|
325
334
|
console.log(SESSIONS_HELP);
|
|
326
|
-
|
|
335
|
+
return 0;
|
|
327
336
|
}
|
|
328
337
|
try {
|
|
329
338
|
if (options.action === "list" && options.all) {
|
|
@@ -354,7 +363,7 @@ async function handleSessionsCommand(args) {
|
|
|
354
363
|
console.log(chalk.dim(`${foreign} session(s) belong to a machine that is not reachable right now${why}.`));
|
|
355
364
|
}
|
|
356
365
|
}
|
|
357
|
-
|
|
366
|
+
return 0;
|
|
358
367
|
}
|
|
359
368
|
if (options.action === "list" && options.machine) {
|
|
360
369
|
const listing = await listRemoteSessions(options.machine, { tag: options.tag, limit: options.limit });
|
|
@@ -367,7 +376,7 @@ async function handleSessionsCommand(args) {
|
|
|
367
376
|
console.log(chalk.dim(`machine ${listing.host} (${listing.machineId})`));
|
|
368
377
|
for (const summary of sessions) console.log(formatSummaryLine(summary));
|
|
369
378
|
}
|
|
370
|
-
|
|
379
|
+
return 0;
|
|
371
380
|
}
|
|
372
381
|
if (options.action === "list") {
|
|
373
382
|
const sessions = await listSessions({ tag: options.tag, recentLimit: options.limit });
|
|
@@ -378,7 +387,7 @@ async function handleSessionsCommand(args) {
|
|
|
378
387
|
} else {
|
|
379
388
|
for (const summary of sessions) console.log(formatSummaryLine(summary));
|
|
380
389
|
}
|
|
381
|
-
|
|
390
|
+
return 0;
|
|
382
391
|
}
|
|
383
392
|
if (options.action === "peers" || options.action === "message") {
|
|
384
393
|
const cwd = options.cwd ? resolve(options.cwd) : process.cwd();
|
|
@@ -391,7 +400,7 @@ async function handleSessionsCommand(args) {
|
|
|
391
400
|
else if (!listing.project) console.log(`Not in a project (${self.sessionId}).`);
|
|
392
401
|
else if (listing.peers.length === 0) console.log(`No other sessions in project "${listing.project.name}".`);
|
|
393
402
|
else for (const peer of listing.peers) console.log([peer.sessionId, `[${peer.state ?? "?"}]`, peer.title ? `title="${peer.title}"` : "", peer.agent ? `agent=${peer.agent}` : "", peer.machine ? `machine=${peer.machine}` : "", peer.doing ? `doing="${peer.doing}"` : "", peer.url].filter(Boolean).join(" "));
|
|
394
|
-
|
|
403
|
+
return 0;
|
|
395
404
|
}
|
|
396
405
|
if (options.action === "peers") {
|
|
397
406
|
const scope = options.scope === "project" ? void 0 : options.scope;
|
|
@@ -412,7 +421,7 @@ async function handleSessionsCommand(args) {
|
|
|
412
421
|
for (const edit of peer.edits) console.log(chalk.dim(` ${edit.tool} ${edit.path} (${Math.round((Date.now() - edit.at) / 6e4)}m ago)`));
|
|
413
422
|
}
|
|
414
423
|
}
|
|
415
|
-
|
|
424
|
+
return 0;
|
|
416
425
|
}
|
|
417
426
|
const target = options.sessionId;
|
|
418
427
|
try {
|
|
@@ -423,7 +432,7 @@ ${result.url}`);
|
|
|
423
432
|
else if (result.status === "offline-stored") console.log(`Message ${result.messageId} ${result.note ?? "stored"} (${target} is not running; same project)
|
|
424
433
|
${result.url}`);
|
|
425
434
|
else console.error(chalk.yellow("Not delivered:"), result.error ?? `session is ${result.status}`, result.stored ? "(stored server-side, unread)" : "");
|
|
426
|
-
|
|
435
|
+
return peerMessageExitCode(result);
|
|
427
436
|
} catch (error) {
|
|
428
437
|
if (options.json) console.log(JSON.stringify({ delivered: false, to: target, error: error instanceof Error ? error.message : String(error) }));
|
|
429
438
|
throw error;
|
|
@@ -474,18 +483,18 @@ ${result.url}`);
|
|
|
474
483
|
const turn = result.turn;
|
|
475
484
|
console.log(chalk.dim(`--- latest turn: ${turn.ended ? `ended (${turn.status ?? "unknown"})` : "running"}${turn.error ? ` \u2014 ${turn.error}` : ""} ---`));
|
|
476
485
|
}
|
|
477
|
-
|
|
486
|
+
return timedOut ? 2 : 0;
|
|
478
487
|
}
|
|
479
488
|
if (options.action === "stop") {
|
|
480
489
|
const stopped = await stopSession(sessionId);
|
|
481
490
|
if (!stopped) {
|
|
482
491
|
if (options.json) console.log(JSON.stringify({ sessionId, stopped: false }));
|
|
483
492
|
console.error(chalk.red("Error:"), `Session ${sessionId} is not among the daemon's running sessions.`);
|
|
484
|
-
|
|
493
|
+
return 1;
|
|
485
494
|
}
|
|
486
495
|
if (options.json) console.log(JSON.stringify({ sessionId, stopped: true }));
|
|
487
496
|
else console.log(`Stopped ${sessionId}`);
|
|
488
|
-
|
|
497
|
+
return 0;
|
|
489
498
|
}
|
|
490
499
|
if (options.action === "approve" || options.action === "deny") {
|
|
491
500
|
const requestId = options.requestId;
|
|
@@ -507,7 +516,7 @@ ${result.url}`);
|
|
|
507
516
|
if (options.json) console.log(JSON.stringify(result));
|
|
508
517
|
const hint = result.outcome.status === "rate-limited" ? ` \u2014 the request is still pending; re-run in ~${Math.ceil(result.outcome.retryAfterMs / 1e3)}s` : "";
|
|
509
518
|
console.error(chalk.red("Error:"), `${options.action} of ${requestId} on ${sessionId} was not delivered (${result.outcome.status}): ${result.outcome.message}${hint}`);
|
|
510
|
-
|
|
519
|
+
return 1;
|
|
511
520
|
}
|
|
512
521
|
if (options.json) {
|
|
513
522
|
console.log(JSON.stringify(result));
|
|
@@ -515,16 +524,16 @@ ${result.url}`);
|
|
|
515
524
|
const verb = options.action === "approve" ? "Approved" : "Denied";
|
|
516
525
|
console.log(`${verb} ${requestId} on ${sessionId} (${result.payload.decision})${result.settled ? "" : " \u2014 wrapper acknowledged, but the request was still listed as pending when we stopped waiting"}`);
|
|
517
526
|
}
|
|
518
|
-
|
|
527
|
+
return 0;
|
|
519
528
|
}
|
|
520
529
|
await archiveSession(sessionId);
|
|
521
530
|
if (options.json) console.log(JSON.stringify({ sessionId, archived: true }));
|
|
522
531
|
else console.log(`Archived ${sessionId}`);
|
|
523
|
-
|
|
532
|
+
return 0;
|
|
524
533
|
} catch (error) {
|
|
525
534
|
console.error(chalk.red("Error:"), error instanceof Error ? error.message : String(error));
|
|
526
|
-
|
|
535
|
+
return 1;
|
|
527
536
|
}
|
|
528
537
|
}
|
|
529
538
|
|
|
530
|
-
export { SESSIONS_HELP, handleSessionsCommand, parseSessionsArgs, peerMessageExitCode, permissionFailureRecord };
|
|
539
|
+
export { SESSIONS_HELP, formatAccountSummaryLine, formatSummaryLine, handleSessionsCommand, parseSessionsArgs, peerMessageExitCode, permissionFailureRecord };
|