very-happy-cli 0.2.201 → 0.2.202
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-CMFlng3C.cjs → AcpBackend-BRcPXur6.cjs} +3 -3
- package/dist/{AcpBackend-BNinFMHZ.mjs → AcpBackend-Z51picBa.mjs} +3 -3
- package/dist/{AcpSessionManager-Dg6gKavf.mjs → AcpSessionManager-BCGqL1Em.mjs} +1 -1
- package/dist/{AcpSessionManager-CPgoICjp.cjs → AcpSessionManager-BckOYH3I.cjs} +1 -1
- package/dist/{BasePermissionHandler-c-NaRa_E.cjs → BasePermissionHandler-BYIY3kxs.cjs} +1 -1
- package/dist/{BasePermissionHandler-DwcfWUjr.mjs → BasePermissionHandler-BhJjr-wB.mjs} +1 -1
- package/dist/{account-pzgzyIXW.mjs → account-B-HTHZKw.mjs} +5 -5
- package/dist/{account-D23SGj7p.cjs → account-B0Wu7rJR.cjs} +5 -5
- package/dist/{acpSessionResume-urFpnGsk.mjs → acpSessionResume-BKjQRT4V.mjs} +1 -1
- package/dist/{acpSessionResume-DklOhwir.cjs → acpSessionResume-C8Kd8eK6.cjs} +1 -1
- package/dist/{agentHome-DyrLqr8b.mjs → agentHome-BXiCouR4.mjs} +4 -4
- package/dist/{agentHome-BTwMaYw1.cjs → agentHome-DnxSf1ox.cjs} +4 -4
- package/dist/{api-KVVs-GkM.cjs → api-B-FB-s4z.cjs} +9 -9
- package/dist/{api-1CD4oRSW.mjs → api-Cu1OFHDM.mjs} +9 -9
- package/dist/{apiMachine-1sd5IVIB.cjs → apiMachine-DCWgI1l_.cjs} +23 -13
- package/dist/{apiMachine-BDVE6MOn.mjs → apiMachine-DYGPILVb.mjs} +23 -13
- package/dist/{attachmentContent-CeF54XeO.mjs → attachmentContent-Dq8P5ODq.mjs} +2 -2
- package/dist/{attachmentContent-f3BbOKqz.cjs → attachmentContent-dXwHB_3C.cjs} +2 -2
- package/dist/{auth-eielZ6Sc.cjs → auth-BVNBE4B1.cjs} +8 -8
- package/dist/{auth-WCd2S1zA.mjs → auth-CgdE-j7z.mjs} +5 -5
- package/dist/{auth-CV2H-smf.mjs → auth-D11uvx2P.mjs} +8 -8
- package/dist/{auth-CXCX-iJ-.cjs → auth-DpIHm7Lb.cjs} +5 -5
- package/dist/{auto-49cRCADN.cjs → auto-Ba2b-il4.cjs} +14 -14
- package/dist/{auto-BsCE_UHT.mjs → auto-WdjHKP9R.mjs} +14 -14
- package/dist/{bootstrap-D_1MskAl.mjs → bootstrap-BTYJf2w8.mjs} +2 -2
- package/dist/{bootstrap-N1PY4ypX.cjs → bootstrap-CsZO_jkL.cjs} +2 -2
- package/dist/{browser-B0SEB6r3.cjs → browser-DgufCq1K.cjs} +1 -1
- package/dist/{browser-DL3QIQLS.mjs → browser-Dx3UOVPP.mjs} +1 -1
- package/dist/{claudeLocal-Ix69XJ1t.cjs → claudeLocal-Q0FgzhTu.cjs} +4 -4
- package/dist/{claudeLocal-DRMWkdCC.mjs → claudeLocal-ylDKcvX0.mjs} +4 -4
- package/dist/{claudeLocalLauncher-D4tU6R5n.mjs → claudeLocalLauncher-CtybsaR8.mjs} +9 -9
- package/dist/{claudeLocalLauncher-rDojqNoa.cjs → claudeLocalLauncher-D2rZvuaW.cjs} +9 -9
- package/dist/{claudeSessionFork-C_X08LFh.cjs → claudeSessionFork-BrstQPE4.cjs} +1 -1
- package/dist/{claudeSessionFork-H0ZVQALg.mjs → claudeSessionFork-DRLxmv9j.mjs} +1 -1
- package/dist/{client-BoymtYLP.cjs → client-CNWx72ZT.cjs} +2 -2
- package/dist/{client-DGqnrSg4.cjs → client-Ch4Azlny.cjs} +3 -3
- package/dist/{client-CMUlpYcy.mjs → client-Cj7D61by.mjs} +2 -2
- package/dist/{client-4YWjreN3.mjs → client-D0oBXuEe.mjs} +2 -2
- package/dist/{client-CK-jvgM1.mjs → client-DJsXNJWO.mjs} +3 -3
- package/dist/{client-BgInTvr6.mjs → client-DfT_CRwl.mjs} +2 -2
- package/dist/{client-P1VkI76z.cjs → client-Dq7jaxb2.cjs} +2 -2
- package/dist/{client-DI8Rxsbw.cjs → client-xV99weGP.cjs} +2 -2
- package/dist/codex/happyMcpStdioBridge.cjs +17 -17
- package/dist/codex/happyMcpStdioBridge.mjs +17 -17
- package/dist/{codexAppServerClient-BnMR-DRn.cjs → codexAppServerClient-BwBPZonh.cjs} +3 -3
- package/dist/{codexAppServerClient-aDrsSyjS.mjs → codexAppServerClient-DtdCZ7_b.mjs} +3 -3
- package/dist/{codexCommand-C3oEEpOa.cjs → codexCommand-CsY9YFiG.cjs} +42 -42
- package/dist/{codexCommand-BCpJzf3q.mjs → codexCommand-D92AQCLU.mjs} +42 -42
- package/dist/{codexTermination-DXhw5Pzi.cjs → codexTermination-BbXG2oFT.cjs} +1 -1
- package/dist/{codexTermination-B5haG5wJ.mjs → codexTermination-rhIxjRMJ.mjs} +1 -1
- package/dist/{config-D9wjo4oa.mjs → config-BnN1yFyi.mjs} +3 -3
- package/dist/{config-CdGiZZKy.cjs → config-Zhkmfb3O.cjs} +3 -3
- package/dist/{configuration-DhEqAYzz.mjs → configuration-CQaLZMa-.mjs} +1 -1
- package/dist/{configuration-LWFmTxty.cjs → configuration-DZUnfWp2.cjs} +1 -1
- package/dist/{connect-BZLD0aVm.cjs → connect-BToTf3Gy.cjs} +12 -12
- package/dist/{connect-CY_EMXQs.mjs → connect-DY5QLfbI.mjs} +12 -12
- package/dist/{context-BbZ18lX0.cjs → context-BHydzPZw.cjs} +1 -1
- package/dist/{context-UzqWaA7f.mjs → context-ByTvtMXZ.mjs} +1 -1
- package/dist/{controlClient-TVMpETsR.cjs → controlClient-Bfwe0Xpt.cjs} +3 -3
- package/dist/{controlClient-PaIiDxM6.mjs → controlClient-Cqhd8ynk.mjs} +3 -3
- package/dist/{createSessionMetadata-hGZeo_nR.cjs → createSessionMetadata-D_qa01wq.cjs} +2 -2
- package/dist/{createSessionMetadata-BWb81WZg.mjs → createSessionMetadata-tmhDzhJZ.mjs} +2 -2
- package/dist/{deterministicJson-BpDDS7c9.cjs → deterministicJson-CbUdClvO.cjs} +13 -13
- package/dist/{deterministicJson-Cg3z7uUX.mjs → deterministicJson-DRL1Gs_c.mjs} +13 -13
- package/dist/{doctor-DOzji0f7.cjs → doctor-DHCmWcwR.cjs} +7 -7
- package/dist/{doctor-BanQ3jQg.mjs → doctor-Wu0yZ80l.mjs} +7 -7
- package/dist/{downloadTarget-BhIAhyEV.cjs → downloadTarget-BoJrjpEe.cjs} +6 -6
- package/dist/{downloadTarget-BCSXmPRE.mjs → downloadTarget-G72yKQcM.mjs} +6 -6
- package/dist/{ensureDaemonRunning-BZGBE838.mjs → ensureDaemonRunning-BKGybp3s.mjs} +5 -5
- package/dist/{ensureDaemonRunning-DMOCzvQP.cjs → ensureDaemonRunning-CnkyGd9x.cjs} +5 -5
- package/dist/{format-BxGkJUki.mjs → format-BSx-Nv2p.mjs} +1 -1
- package/dist/{format-CgiY6uup.cjs → format-DePME4uu.cjs} +1 -1
- package/dist/{handleResumeCommand-BRV-9h0o.mjs → handleResumeCommand-DrJdhjLD.mjs} +5 -5
- package/dist/{handleResumeCommand-ChnR-12l.cjs → handleResumeCommand-uKzhaOVC.cjs} +5 -5
- package/dist/{index-B7HlUXOX.cjs → index-BKXqaux4.cjs} +4 -4
- package/dist/{index-C_Y9426m.mjs → index-BcYJJV-f.mjs} +3 -3
- package/dist/{index-DuOthh8V.cjs → index-Bi7Lmykl.cjs} +39 -39
- package/dist/{index-Do1r62PF.mjs → index-C-eSUhXW.mjs} +4 -4
- package/dist/{index-DnEgpRo4.cjs → index-CoBaGAA4.cjs} +3 -3
- package/dist/{index-D5abHQNL.mjs → index-CowtCbZ_.mjs} +40 -40
- package/dist/{index-BuOzDU17.cjs → index-DDOCSeEj.cjs} +4 -4
- package/dist/{index-HJFzeG0B.mjs → index-fNsf-8K-.mjs} +4 -4
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/{install-BurTXawL.mjs → install-0TkucJrC.mjs} +3 -3
- package/dist/{install-CUAUG3u4.cjs → install-Ddc8TlWE.cjs} +3 -3
- package/dist/{issue-feEUrjV0.cjs → issue-CIfzJuaS.cjs} +7 -7
- package/dist/{issue-DpMsnOFm.mjs → issue-CML2xa46.mjs} +7 -7
- package/dist/lib.cjs +11 -11
- package/dist/lib.d.cts +3 -0
- package/dist/lib.d.mts +3 -0
- package/dist/lib.mjs +11 -11
- package/dist/{localHappyAgentAuth-kg2RFvOy.mjs → localHappyAgentAuth-BUX4E1ug.mjs} +1 -1
- package/dist/{localHappyAgentAuth-DxlQgaer.cjs → localHappyAgentAuth-WLqXQbc6.cjs} +1 -1
- package/dist/{logger-CFrzcRHD.mjs → logger-BEVIGYKL.mjs} +2 -2
- package/dist/{logger-Hyhy2boA.cjs → logger-Dhc0l3xH.cjs} +2 -2
- package/dist/{machineMetadata-DiStbYik.mjs → machineMetadata-BQdp_ihk.mjs} +3 -3
- package/dist/{machineMetadata-BLymhM03.cjs → machineMetadata-ixKckJ7k.cjs} +3 -3
- package/dist/{main-7G17Noc3.cjs → main-BNBYOcQb.cjs} +48 -48
- package/dist/{main-D1rk-68I.mjs → main-BzQSe4Zu.mjs} +48 -48
- package/dist/{mcp-C0DMPeTt.mjs → mcp-BueI4Bel.mjs} +14 -14
- package/dist/{mcp-DUeAS-D6.cjs → mcp-BwskAxOK.cjs} +14 -14
- package/dist/{mirrorProtocol-dRyartIG.mjs → mirrorProtocol-5aFYsCCe.mjs} +2 -2
- package/dist/{mirrorProtocol-YUoEuIYO.cjs → mirrorProtocol-DGMmhArw.cjs} +2 -2
- package/dist/{package-06cGlmeD.cjs → package-CAmlKYcH.cjs} +7 -7
- package/dist/{package-DxE8PttX.mjs → package-aOUtHYRZ.mjs} +7 -7
- package/dist/{panels-BUqmsRE0.mjs → panels-BeVMgmRW.mjs} +5 -5
- package/dist/{panels-D0GHfIJC.cjs → panels-By2IDfXv.cjs} +5 -5
- package/dist/{peerTools-BiFpxXdf.mjs → peerTools-BkRgJomj.mjs} +5 -5
- package/dist/{peerTools-CTCyRdg2.cjs → peerTools-dgllF1wT.cjs} +5 -5
- package/dist/{persistence-_W9tE-bW.cjs → persistence-05BAS4Ou.cjs} +12 -2
- package/dist/{persistence-CF7oV1oH.mjs → persistence-EuUaQKL7.mjs} +12 -3
- package/dist/{piRunnerArgs-Cfc-F-FJ.mjs → piRunnerArgs-CygWrAwY.mjs} +1 -1
- package/dist/{piRunnerArgs-T2cAiaGW.cjs → piRunnerArgs-DkjCRPYn.cjs} +1 -1
- package/dist/{piRuntime-CzYkZrYV.mjs → piRuntime-LRW_t6ME.mjs} +1 -1
- package/dist/{piRuntime-BzECTca4.cjs → piRuntime-zY2jIQod.cjs} +1 -1
- package/dist/{piTerminal-WF--dHaC.cjs → piTerminal-BfZshXGh.cjs} +16 -16
- package/dist/{piTerminal-0tOAYsFm.mjs → piTerminal-BhlPA1HR.mjs} +16 -16
- package/dist/{pushNotifications-CxX10K6n.mjs → pushNotifications-B7Ga8Zyf.mjs} +2 -2
- package/dist/{pushNotifications-DdzTbrA3.cjs → pushNotifications-DaVlLe7N.cjs} +2 -2
- package/dist/{query-Bkh7d52V.mjs → query-BQLtwpr9.mjs} +1 -1
- package/dist/{query-Cwx4pv91.cjs → query-CX0Of89i.cjs} +1 -1
- package/dist/{rateLimitWindows-DjJjgjt4.cjs → rateLimitWindows-CpSOlXBt.cjs} +1 -1
- package/dist/{rateLimitWindows-DdUMUEoy.mjs → rateLimitWindows-hv2zLYid.mjs} +1 -1
- package/dist/{reconnectGate-DeDhtQJW.cjs → reconnectGate-B_aJrehH.cjs} +1 -1
- package/dist/{reconnectGate-uTLj82tS.mjs → reconnectGate-DO_ZQmJE.mjs} +1 -1
- package/dist/{registerCommonHandlers-BYrmi-A4.mjs → registerCommonHandlers-BEpK4WD2.mjs} +2 -2
- package/dist/{registerCommonHandlers-BrEtSwNk.cjs → registerCommonHandlers-em2elV3l.cjs} +2 -2
- package/dist/{registerKillSessionHandler-Cuzq6ecP.mjs → registerKillSessionHandler-D-dDzI2n.mjs} +5 -5
- package/dist/{registerKillSessionHandler-Bp3g11wW.cjs → registerKillSessionHandler-D4ZQvsH2.cjs} +5 -5
- package/dist/{registerSideQuestionHandler-ChIbHl_g.cjs → registerSideQuestionHandler-BIOLUe2U.cjs} +4 -4
- package/dist/{registerSideQuestionHandler-BmEWWaZW.mjs → registerSideQuestionHandler-okUy9Q_-.mjs} +4 -4
- package/dist/{remoteSessionClient-DoxfnpnK.cjs → remoteSessionClient-BLWFXMBo.cjs} +5 -5
- package/dist/{remoteSessionClient-Dj2rV8Az.mjs → remoteSessionClient-CzjLyL9c.mjs} +5 -5
- package/dist/{reportProgressTool-qo0QIFNd.mjs → reportProgressTool-CNi0Vqqm.mjs} +4 -4
- package/dist/{reportProgressTool-DvZhaEiN.cjs → reportProgressTool-DcNBXBw8.cjs} +4 -4
- package/dist/{run-mHeOSOEt.mjs → run-D59Gb4SQ.mjs} +196 -45
- package/dist/{run-BqlWdDTL.cjs → run-bzlz4DI1.cjs} +196 -45
- package/dist/{runClaude-Z4BVFEdC.mjs → runClaude-DZtdmcXK.mjs} +20 -20
- package/dist/{runClaude-MjIrNrxT.cjs → runClaude-kVp1PKab.cjs} +20 -20
- package/dist/{runClaudeDeps-tPqwAl_m.cjs → runClaudeDeps-BHv9FkVz.cjs} +37 -37
- package/dist/{runClaudeDeps-8RXtu0Zc.mjs → runClaudeDeps-D83tR1KP.mjs} +43 -43
- package/dist/{runGemini-DG3jIxWv.mjs → runGemini-DLc_bL4E.mjs} +34 -34
- package/dist/{runGemini-uc-fViXY.cjs → runGemini-W-0t7skM.cjs} +34 -34
- package/dist/{runOpenClaw-DZtoCmSG.cjs → runOpenClaw-BsqbOw8R.cjs} +17 -17
- package/dist/{runOpenClaw-C4676Sdl.mjs → runOpenClaw-mm-hKxMC.mjs} +17 -17
- package/dist/{sandbox-r29ys6I4.mjs → sandbox-DXbKl-Os.mjs} +4 -4
- package/dist/{sandbox-DS7uZ71y.cjs → sandbox-DrWJss7J.cjs} +4 -4
- package/dist/selfCheck-B1XdrEbN.mjs +89 -0
- package/dist/{selfCheck-CSZ-wx1W.cjs → selfCheck-CVXucSXR.cjs} +39 -39
- package/dist/{send-BGApHm-z.mjs → send-Cdda78Iw.mjs} +8 -8
- package/dist/{send-CrmLy9lW.cjs → send-D7pRBaht.cjs} +8 -8
- package/dist/{server-CjwXsTKP.cjs → server-BI6defPs.cjs} +6 -6
- package/dist/{server-hutEAAn1.mjs → server-CNilQcJK.mjs} +4 -4
- package/dist/{sessionLock-unMOEniJ.cjs → sessionLock-Bjsy90aM.cjs} +3 -3
- package/dist/{sessionLock-Dj9_lShU.mjs → sessionLock-CVjlaRSL.mjs} +3 -3
- package/dist/{sessionOps-BmhqmPPd.mjs → sessionOps-CV5RUpwG.mjs} +4 -4
- package/dist/{sessionOps-SxZr9veq.cjs → sessionOps-CvmOHwGP.cjs} +4 -4
- package/dist/{sessionProvider-DLlqS4y6.cjs → sessionProvider-4sWr0Myr.cjs} +5 -5
- package/dist/{sessionProvider-CPlvR0nT.mjs → sessionProvider-BmO4ahnt.mjs} +5 -5
- package/dist/{sessionScanner-DvVZpLHG.mjs → sessionScanner-34Q0vTR3.mjs} +3 -3
- package/dist/{sessionScanner-B7nZ1i40.cjs → sessionScanner-DZBiEOyb.cjs} +3 -3
- package/dist/{sessions-BIYm43CM.mjs → sessions-Cl435KQT.mjs} +10 -10
- package/dist/{sessions-CQQW7u6X.cjs → sessions-DjAXZWTX.cjs} +10 -10
- package/dist/{setupOfflineReconnection-BELrtMGG.mjs → setupOfflineReconnection-BC5FJTkc.mjs} +2 -2
- package/dist/{setupOfflineReconnection-D7WJTAi_.cjs → setupOfflineReconnection-zebrb6U_.cjs} +2 -2
- package/dist/{spawn-CuWcPkkN.cjs → spawn-C8cJK9-m.cjs} +12 -12
- package/dist/{spawn-DnPu7h2o.mjs → spawn-DqWdgMt_.mjs} +12 -12
- package/dist/{spawnHappyCLI-D6OcgFDR.mjs → spawnHappyCLI-BckHSjR0.mjs} +1 -1
- package/dist/{spawnHappyCLI-CI7Ax4mF.cjs → spawnHappyCLI-CeWgULMt.cjs} +1 -1
- package/dist/{startFileWatcher-BiWGhlGW.mjs → startFileWatcher-BXiBlfVr.mjs} +1 -1
- package/dist/{startFileWatcher-DBW14aP2.cjs → startFileWatcher-CXZYt0y9.cjs} +1 -1
- package/dist/{startupSessionCreate-DFl54ozj.cjs → startupSessionCreate-CycB-kwu.cjs} +3 -3
- package/dist/{startupSessionCreate-DbBpGQo9.mjs → startupSessionCreate-D8hODW7I.mjs} +3 -3
- package/dist/{sync-CcBrziWp.mjs → sync-BfM5OKSS.mjs} +1 -1
- package/dist/{sync-C764ZzE6.cjs → sync-CyUWevwD.cjs} +1 -1
- package/dist/{systemPrompt-Xy3Dfj1l.cjs → systemPrompt-BUZQDf4k.cjs} +1 -1
- package/dist/{systemPrompt-9i7bQypR.mjs → systemPrompt-Tu_2ixE3.mjs} +1 -1
- package/dist/{teams-BAWOVbdF.mjs → teams-Cpdqvfe3.mjs} +6 -6
- package/dist/{teams-VlmzLDSs.cjs → teams-KjHee0Vg.cjs} +6 -6
- package/dist/{time-DJF2csbV.mjs → time-BQWf06hA.mjs} +1 -1
- package/dist/{time-CDBZWYDb.cjs → time-CbOTVtAt.cjs} +1 -1
- package/dist/{titleGenerator-BYP3fNFo.cjs → titleGenerator-CpiQkf_r.cjs} +2 -2
- package/dist/{titleGenerator-DR9evHBh.mjs → titleGenerator-DYnqd0oI.mjs} +1 -1
- package/dist/{todo-BkFvwx_z.cjs → todo-Cp6bRp62.cjs} +7 -7
- package/dist/{todo-DDDQdB-G.mjs → todo-DVrsXyKn.mjs} +7 -7
- package/dist/{tools-BjiRW_Rg.cjs → tools-BFQm7xny.cjs} +1 -1
- package/dist/{tools-CDktvjWL.mjs → tools-XGAJepvT.mjs} +1 -1
- package/dist/{uninstall-BcMGkwJ0.mjs → uninstall-C2LF0vtR.mjs} +3 -3
- package/dist/{uninstall-D5INt3TC.cjs → uninstall-Cyqq90JW.cjs} +3 -3
- package/package.json +7 -7
- package/dist/selfCheck-BmT9ihpR.mjs +0 -89
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as isClaudeSessionId, h as extractCompleteLines, j as decideBackfill, k as parseTerminalHookPayload, m as decideMirrorBinding, M as MIRROR_BACKFILL_LINES_DEFAULT, n as mirrorLineKey, o as mirrorLocalId, q as initializeOwnedWorktree, f as summarizeSpawnSessionForLog, t as startAgentVersionChecks, W as WORKTREE_CAPABILITY_VERSION, u as currentWorktreeService } from './mirrorProtocol-
|
|
1
|
+
import { i as isClaudeSessionId, h as extractCompleteLines, j as decideBackfill, k as parseTerminalHookPayload, m as decideMirrorBinding, M as MIRROR_BACKFILL_LINES_DEFAULT, n as mirrorLineKey, o as mirrorLocalId, q as initializeOwnedWorktree, f as summarizeSpawnSessionForLog, t as startAgentVersionChecks, W as WORKTREE_CAPABILITY_VERSION, u as currentWorktreeService } from './mirrorProtocol-5aFYsCCe.mjs';
|
|
2
2
|
import { F as FS_MKDIR_CAPABILITY_VERSION } from './fsMkdir-DumgLTzR.mjs';
|
|
3
|
-
import { P as PI_ADAPTER_INSTALL_HINT, s as sanitizeSpawnModel } from './piRunnerArgs-
|
|
3
|
+
import { P as PI_ADAPTER_INSTALL_HINT, s as sanitizeSpawnModel } from './piRunnerArgs-CygWrAwY.mjs';
|
|
4
4
|
import fs from 'fs/promises';
|
|
5
5
|
import os from 'os';
|
|
6
6
|
import * as tmp from 'tmp';
|
|
@@ -8,19 +8,19 @@ import axios from 'axios';
|
|
|
8
8
|
import { a as issueRelaunchEnv } from './sessionMetadata-C1eoAi89.mjs';
|
|
9
9
|
import { readFileSync, openSync, fsyncSync, closeSync, renameSync, existsSync, readdirSync, statSync, unlinkSync, readSync, writeSync, ftruncateSync, utimesSync, realpathSync, promises, constants as constants$1, writeFileSync, mkdirSync, accessSync, rmdirSync } from 'node:fs';
|
|
10
10
|
import { join, isAbsolute, resolve, dirname, sep, basename, relative } from 'node:path';
|
|
11
|
-
import { f as ensurePrivateDirectorySync, w as writePrivateFileSync, c as configuration } from './configuration-
|
|
12
|
-
import { T as TurnActivityTracker, A as ApiClient } from './api-
|
|
11
|
+
import { f as ensurePrivateDirectorySync, w as writePrivateFileSync, c as configuration } from './configuration-CQaLZMa-.mjs';
|
|
12
|
+
import { T as TurnActivityTracker, A as ApiClient } from './api-Cu1OFHDM.mjs';
|
|
13
13
|
import { S as SPAWN_AGENTS, i as isSpawnAgent, s as sanitizeSpawnPermissionMode, r as resolveSpawnPermissionMode, a as resolveFirstMessageMeta, j as joinProject } from './spawnAgents-BclZYkov.mjs';
|
|
14
|
-
import { l as logger } from './logger-
|
|
15
|
-
import { p as pruneStaleCompileCaches } from './index-
|
|
16
|
-
import { a as authAndSetupMachineIfNeeded } from './auth-
|
|
14
|
+
import { l as logger } from './logger-BEVIGYKL.mjs';
|
|
15
|
+
import { p as pruneStaleCompileCaches } from './index-BcYJJV-f.mjs';
|
|
16
|
+
import { a as authAndSetupMachineIfNeeded } from './auth-CgdE-j7z.mjs';
|
|
17
17
|
import { spawn, execSync } from 'child_process';
|
|
18
|
-
import { p as packageJson } from './package-
|
|
19
|
-
import { a as globalPrefixForPackage, N as NPM_SAFE_ARG, g as getEnvironmentInfo } from './doctor-
|
|
20
|
-
import { s as spawnHappyCLI } from './spawnHappyCLI-
|
|
21
|
-
import { c as readPersistedSessions, r as readSettings, l as latchKeepAwake, s as reportSignature, t as decideDaemonHibernation, v as nextCheckDelay, x as persistSession, d as readDaemonState, y as acquireDaemonLock, a as resolveCheckMs, z as resolveIdleMs, A as deletePersistedSessions, B as writeDaemonState, C as writeSettings, D as settingIdleMs, u as updateSettings, E as rewriteCredentialsForRelay, g as readCredentials,
|
|
22
|
-
import { i as isDaemonRunningCurrentlyInstalledHappyVersion, s as stopDaemon, w as cleanupDaemonState } from './controlClient-
|
|
23
|
-
import { e as sendUserMessage, f as readSessionMetadata, r as readSessionTranscript, l as listAccountSessions, a as listSessions, M as MAX_READ_LIMIT, s as sessionWebUrl, n as lineageOf, g as waitForSessionKey, d as archiveSession, h as analyzeLatestTurn, i as readSessionLog, j as TURN_WINDOW, p as userPromptText } from './sessionOps-
|
|
18
|
+
import { p as packageJson } from './package-aOUtHYRZ.mjs';
|
|
19
|
+
import { a as globalPrefixForPackage, N as NPM_SAFE_ARG, g as getEnvironmentInfo } from './doctor-Wu0yZ80l.mjs';
|
|
20
|
+
import { s as spawnHappyCLI } from './spawnHappyCLI-BckHSjR0.mjs';
|
|
21
|
+
import { c as readPersistedSessions, r as readSettings, l as latchKeepAwake, s as reportSignature, t as decideDaemonHibernation, v as nextCheckDelay, x as persistSession, d as readDaemonState, y as acquireDaemonLock, a as resolveCheckMs, z as resolveIdleMs, A as deletePersistedSessions, B as writeDaemonState, C as writeSettings, D as settingIdleMs, u as updateSettings, E as readDaemonStatePidSync, F as rewriteCredentialsForRelay, g as readCredentials, G as releaseDaemonLock } from './persistence-EuUaQKL7.mjs';
|
|
22
|
+
import { i as isDaemonRunningCurrentlyInstalledHappyVersion, s as stopDaemon, w as cleanupDaemonState } from './controlClient-Cqhd8ynk.mjs';
|
|
23
|
+
import { e as sendUserMessage, f as readSessionMetadata, r as readSessionTranscript, l as listAccountSessions, a as listSessions, M as MAX_READ_LIMIT, s as sessionWebUrl, n as lineageOf, g as waitForSessionKey, d as archiveSession, h as analyzeLatestTurn, i as readSessionLog, j as TURN_WINDOW, p as userPromptText } from './sessionOps-CV5RUpwG.mjs';
|
|
24
24
|
import { a2 as AgentProfilesStateSchema, an as ServerMigrateNoticeSchema, ao as isHarnessInstallId, ap as agentProfileUnavailableReason, aq as MODEL_INTENT_CONFIG, q as AUTOMATION_SUMMARY_MAX_CHARS, ar as AUTOMATION_PRECHECK_OUTPUT_MAX_CHARS, as as AUTOMATION_PRECHECK_DEFAULT_TIMEOUT_MS, d as AUTOMATION_PRECHECK_MAX_TIMEOUT_MS, at as AUTOMATION_CLAIM_MAX_RUNS, au as AUTOMATION_DAEMON_CAPABILITY_PRECHECK, av as AUTOMATION_DEFAULT_LEASE_MS, i as isAutomationRunTerminal, D as resolveLaunchAgentProfile, aw as ISSUE_SENT_FROM, ax as ISSUE_DISPATCH_LOCAL_ID_PREFIX, f as ISSUE_ASSIGNABLE_AGENTS, ay as HARNESS_INSTALL_CAPABILITY_VERSION } from './index-CiRMvS73.mjs';
|
|
25
25
|
import fastify from 'fastify';
|
|
26
26
|
import { z } from 'zod';
|
|
@@ -29,37 +29,37 @@ import { d as decodeBase64, s as sameRelay, e as encodeBase64, h as decrypt } fr
|
|
|
29
29
|
import { randomBytes, createHash, timingSafeEqual, randomUUID } from 'node:crypto';
|
|
30
30
|
import { c as checkPreviewPath } from './previewPath-CXN4Vag0.mjs';
|
|
31
31
|
import { a as BACKGROUND_TASKS_MAX, d as BACKGROUND_TASK_DESCRIPTION_MAX, e as BackgroundTaskTracker } from './backgroundTaskActivity-8PdPxrvy.mjs';
|
|
32
|
-
import { b as sanitizeRateLimitReport } from './rateLimitWindows-
|
|
33
|
-
import { f as formatEditConflictNotice, b as SESSION_PEER_SENT_FROM, s as sendPeerMessage, l as listPeerSessions, C as CLI_PEER_SENDER_ID } from './peerTools-
|
|
32
|
+
import { b as sanitizeRateLimitReport } from './rateLimitWindows-hv2zLYid.mjs';
|
|
33
|
+
import { f as formatEditConflictNotice, b as SESSION_PEER_SENT_FROM, s as sendPeerMessage, l as listPeerSessions, C as CLI_PEER_SENDER_ID } from './peerTools-BkRgJomj.mjs';
|
|
34
34
|
import os$1, { hostname, homedir, tmpdir } from 'node:os';
|
|
35
|
-
import { c as RemoteCallBudget, e as REMOTE_WRITE_CALLS_PER_MINUTE, d as deliverToSession, g as guardRemoteSessionOpsRequest, h as remoteError, i as REMOTE_OP_DEADLINE_MS, j as formatRemoteAuditLine, k as REMOTE_SEND_COMMIT_DEADLINE_MS, m as REMOTE_RESUME_WAIT_MS, n as capRemoteTranscript, o as capRemoteText, p as REMOTE_ANSWER_MAX_BYTES, q as REMOTE_TITLE_MAX_BYTES } from './remoteSessionClient-
|
|
36
|
-
import { assistantHome, bootstrapAssistantHome } from './bootstrap-
|
|
37
|
-
import { refreshAgentHomes, locateClaudeConversation, agentHomeSpawnEnv } from './index-
|
|
35
|
+
import { c as RemoteCallBudget, e as REMOTE_WRITE_CALLS_PER_MINUTE, d as deliverToSession, g as guardRemoteSessionOpsRequest, h as remoteError, i as REMOTE_OP_DEADLINE_MS, j as formatRemoteAuditLine, k as REMOTE_SEND_COMMIT_DEADLINE_MS, m as REMOTE_RESUME_WAIT_MS, n as capRemoteTranscript, o as capRemoteText, p as REMOTE_ANSWER_MAX_BYTES, q as REMOTE_TITLE_MAX_BYTES } from './remoteSessionClient-CzjLyL9c.mjs';
|
|
36
|
+
import { assistantHome, bootstrapAssistantHome } from './bootstrap-BTYJf2w8.mjs';
|
|
37
|
+
import { refreshAgentHomes, locateClaudeConversation, agentHomeSpawnEnv } from './index-fNsf-8K-.mjs';
|
|
38
38
|
import require$$0, { existsSync as existsSync$1, statSync as statSync$1, mkdtempSync, rmSync } from 'fs';
|
|
39
39
|
import require$$1, { join as join$1 } from 'path';
|
|
40
40
|
import { spawn as spawn$1, execFile, spawnSync } from 'node:child_process';
|
|
41
41
|
import { p as projectPath } from './projectPath-BTBIMB57.mjs';
|
|
42
42
|
import { d as daemonEndpointsMatch, r as resolveClaudeCredentialReadiness } from './doctorReadiness-C208SMN9.mjs';
|
|
43
|
-
import { o as ownerRetryPending, c as consumeOwnerRetry, s as spawnGate, a as afterStartupFailure, b as startupFailureMessage, T as TEAM_SPAWN_MAX_ATTEMPTS, d as TEAM_CLEANUP_RETRY_MS, g as getInitialMachineMetadata, e as getStartupCliAvailability, f as TEAM_RETRY_CAPABILITY_VERSION, w as withRunningCliFacts } from './machineMetadata-
|
|
43
|
+
import { o as ownerRetryPending, c as consumeOwnerRetry, s as spawnGate, a as afterStartupFailure, b as startupFailureMessage, T as TEAM_SPAWN_MAX_ATTEMPTS, d as TEAM_CLEANUP_RETRY_MS, g as getInitialMachineMetadata, e as getStartupCliAvailability, f as TEAM_RETRY_CAPABILITY_VERSION, w as withRunningCliFacts } from './machineMetadata-BQdp_ihk.mjs';
|
|
44
44
|
import { M as ModelConfigError, B as BackupStore, r as readConfigFile, s as sha256, a as atomicWriteFile } from './fileStore-5qpetZS0.mjs';
|
|
45
45
|
import { c as collectSecretValues, a as parseJsonObject, b as childObject, s as setOrDelete, d as changedPaths, e as stringifyLike, f as fail, n as normalizeModelList, g as normalizeModelId, h as normalizeSecret, i as normalizeBaseUrl, u as uniq, j as baseUrlWarnings, m as maskSecret, k as getPath$1, l as normalizeProviderId, o as piAdapter, r as redactText } from './pi-CqyoZMjI.mjs';
|
|
46
46
|
import { p as parse } from './codexAccount-CieIQLOX.mjs';
|
|
47
47
|
import require$$3 from 'crypto';
|
|
48
48
|
import { c as commandOnPath } from './detectCLI-CSGMlV51.mjs';
|
|
49
|
-
import { buildResumeLaunch } from './handleResumeCommand-
|
|
49
|
+
import { buildResumeLaunch } from './handleResumeCommand-DrJdhjLD.mjs';
|
|
50
50
|
import { n as normalizeWebPanels } from './webPanels-B2_C2-3g.mjs';
|
|
51
51
|
import { access, symlink, readFile, rm, unlink, readlink, lstat, constants, rename, mkdir, copyFile, readdir, stat, open } from 'node:fs/promises';
|
|
52
52
|
import { p as parseExactVersion, c as compareExactVersions, f as fetchCliUpdateState, r as resolveCliUpdateCheckInterval, D as DEFAULT_CLI_UPDATE_CHECK_INTERVAL_MS } from './cliUpdate-Y34VGe9Y.mjs';
|
|
53
|
-
import { P as ProjectsUnsupportedError, c as createProjectsClient } from './client-
|
|
54
|
-
import { d as wrapperReportsIdle, f as decideAutoRestart, s as statusFromVerdict, g as autoRestartNextCheck, h as wrapperStaleness, r as recordAttempt, i as AUTO_RESTART_MAX_ATTEMPTS, j as AUTO_RESTART_MIN_GAP_MS, p as processIdentityFields, k as readSessionLock, l as AUTO_RESTARTED_ENV, n as encodeAutoRestarted, o as pendingUpgradeVersion, q as resolveQuietMs, u as AUTO_RESTART_RECHECK_CAP_MS } from './sessionLock-
|
|
55
|
-
import { c as createAutomationsClient, i as isAutomationsUnavailable, d as AutomationsRequestError } from './client-
|
|
53
|
+
import { P as ProjectsUnsupportedError, c as createProjectsClient } from './client-DfT_CRwl.mjs';
|
|
54
|
+
import { d as wrapperReportsIdle, f as decideAutoRestart, s as statusFromVerdict, g as autoRestartNextCheck, h as wrapperStaleness, r as recordAttempt, i as AUTO_RESTART_MAX_ATTEMPTS, j as AUTO_RESTART_MIN_GAP_MS, p as processIdentityFields, k as readSessionLock, l as AUTO_RESTARTED_ENV, n as encodeAutoRestarted, o as pendingUpgradeVersion, q as resolveQuietMs, u as AUTO_RESTART_RECHECK_CAP_MS } from './sessionLock-CVjlaRSL.mjs';
|
|
55
|
+
import { c as createAutomationsClient, i as isAutomationsUnavailable, d as AutomationsRequestError } from './client-D0oBXuEe.mjs';
|
|
56
56
|
import { w as withKeychainOffPath, a as keychainIdentityFor, i as interpretSecurityRead, s as securityReadArgs, b as securityDeleteArgs, c as keychainOffShimDir, d as interpretCredentialsFile, C as CREDENTIALS_REJECTED_DETAIL, e as buildClaudeAuthState, f as claudeAuthStateChanged, r as resolveSdkClaudeBinary, g as classifyAuthStatus, h as diagnoseStores, p as parseLaunchctlPid, H as HAPPY_DAEMON_LAUNCHD_LABEL, j as classifyLineage, l as probeLaunchdJob, m as detectDaemonSupervisor, n as daemonLineage, o as probeSystemdKillMode, q as wrappersSurviveHandover, t as handoverWaitsForSessions } from './daemonSupervisor-BxohggqN.mjs';
|
|
57
57
|
import { A as AccountService } from './accountService-DEpIq6CF.mjs';
|
|
58
58
|
import { spawnSetupTokenPty, watchAccountFiles } from './daemonAccounts-D5shoCLt.mjs';
|
|
59
59
|
import { g as getProjectPath } from './path-D2wdaNSk.mjs';
|
|
60
60
|
import { b as extractClaudeEditPaths } from './editPaths-BVfS_FFL.mjs';
|
|
61
|
-
import { s as startFileWatcher } from './startFileWatcher-
|
|
62
|
-
import { I as InvalidateSync } from './sync-
|
|
61
|
+
import { s as startFileWatcher } from './startFileWatcher-BXiBlfVr.mjs';
|
|
62
|
+
import { I as InvalidateSync } from './sync-BfM5OKSS.mjs';
|
|
63
63
|
import { R as RawJSONLinesSchema } from './types-CkqAACXx.mjs';
|
|
64
64
|
import { t as tmuxArgs, a as scrubTmuxClientEnv, s as shellescape } from './tmuxSocket-BmZyixRM.mjs';
|
|
65
65
|
import { i as isProcessAlive, t as terminateProcessTree } from './processTermination-ChJG5SLW.mjs';
|
|
@@ -67,30 +67,30 @@ import { findAllHappyProcesses } from './doctor-GN5mPOn5.mjs';
|
|
|
67
67
|
import { T as TEAM_SKILL, a as TEAM_LEAD_PLAYBOOK, b as TEAM_MEMBER_RULES } from './resources-CLP_MpK4.mjs';
|
|
68
68
|
import { promisify } from 'node:util';
|
|
69
69
|
import { b as clipText, r as renderAction, c as clipAutomationReport, e as renderTemplate } from './template-CtRLg2PG.mjs';
|
|
70
|
-
import { I as IssuesUnsupportedError, a as IssueRequestError, c as createIssuesClient } from './client-
|
|
70
|
+
import { I as IssuesUnsupportedError, a as IssueRequestError, c as createIssuesClient } from './client-Cj7D61by.mjs';
|
|
71
71
|
import { d as describeAgentHome } from './loginShellEnv-Dw8M7tkI.mjs';
|
|
72
72
|
import { S as SPAWN_ACCOUNT_ENV } from './store-DWmjM4Ex.mjs';
|
|
73
|
-
import './acpSessionResume-
|
|
74
|
-
import './pushNotifications-
|
|
73
|
+
import './acpSessionResume-BKjQRT4V.mjs';
|
|
74
|
+
import './pushNotifications-B7Ga8Zyf.mjs';
|
|
75
75
|
import './contentLogMetadata-BlWI0egu.mjs';
|
|
76
|
-
import './reconnectGate-
|
|
76
|
+
import './reconnectGate-DO_ZQmJE.mjs';
|
|
77
77
|
import 'node:events';
|
|
78
78
|
import 'socket.io-client';
|
|
79
79
|
import './limits-DIo7rEBR.mjs';
|
|
80
|
-
import './time-
|
|
81
|
-
import './registerCommonHandlers-
|
|
80
|
+
import './time-BQWf06hA.mjs';
|
|
81
|
+
import './registerCommonHandlers-BEpK4WD2.mjs';
|
|
82
82
|
import 'util';
|
|
83
83
|
import 'cross-spawn';
|
|
84
84
|
import '@paralleldrive/cuid2';
|
|
85
85
|
import 'chalk';
|
|
86
86
|
import 'node:module';
|
|
87
87
|
import 'tweetnacl';
|
|
88
|
-
import './browser-
|
|
88
|
+
import './browser-Dx3UOVPP.mjs';
|
|
89
89
|
import 'open';
|
|
90
90
|
import './specialCommands-MXUN0wfI.mjs';
|
|
91
91
|
import './ids-DU6sLx4C.mjs';
|
|
92
92
|
import 'url';
|
|
93
|
-
import './localHappyAgentAuth-
|
|
93
|
+
import './localHappyAgentAuth-BUX4E1ug.mjs';
|
|
94
94
|
import './claudeAccountEnv-DowsOlDB.mjs';
|
|
95
95
|
import 'node:readline';
|
|
96
96
|
import 'node-pty';
|
|
@@ -3894,8 +3894,9 @@ function createUpdateController(deps) {
|
|
|
3894
3894
|
outcome = { state, version, detail, at: now(), ...manualVersion ? { source: "manual" } : {} };
|
|
3895
3895
|
deps.publish(snapshot());
|
|
3896
3896
|
}
|
|
3897
|
+
const superseded = () => !!deps.owned && !deps.owned();
|
|
3897
3898
|
async function evaluate() {
|
|
3898
|
-
if (!policy || running) return;
|
|
3899
|
+
if (!policy || running || superseded()) return;
|
|
3899
3900
|
const target = manualVersion ?? policy.autoUpdateVersion ?? null;
|
|
3900
3901
|
if (outcome?.version === target && ["failed", "installed", "manual_required"].includes(outcome.state)) {
|
|
3901
3902
|
const fingerprint = JSON.stringify([policy.checkedAt, outcome.state, outcome.version, outcome.detail, manualVersion, autoUpdateEnabled]);
|
|
@@ -3987,19 +3988,23 @@ function createUpdateController(deps) {
|
|
|
3987
3988
|
}
|
|
3988
3989
|
}
|
|
3989
3990
|
async function refresh() {
|
|
3990
|
-
if (
|
|
3991
|
+
if (superseded()) return "superseded";
|
|
3992
|
+
if (blocked) return "blocked";
|
|
3993
|
+
if (operation) return "busy";
|
|
3991
3994
|
operation = "refresh";
|
|
3992
3995
|
try {
|
|
3993
3996
|
const next = await deps.policy();
|
|
3994
|
-
if (!next) return;
|
|
3997
|
+
if (!next) return "unavailable";
|
|
3995
3998
|
if (manualVersion && !validManualTarget(next, manualVersion)) manualVersion = null;
|
|
3996
3999
|
policy = next;
|
|
3997
4000
|
await evaluate();
|
|
4001
|
+
return policyStale() ? "stale" : "ok";
|
|
3998
4002
|
} finally {
|
|
3999
4003
|
operation = null;
|
|
4000
4004
|
}
|
|
4001
4005
|
}
|
|
4002
4006
|
async function retry(version) {
|
|
4007
|
+
if (superseded()) return { error: "daemon_superseded" };
|
|
4003
4008
|
if (operation || blocked) return { error: blocked ? "manual_recovery_required" : "update_in_progress" };
|
|
4004
4009
|
if (typeof version !== "string" || outcome?.state !== "failed" || outcome.version !== version) {
|
|
4005
4010
|
return { error: "no_matching_failed_update" };
|
|
@@ -4024,6 +4029,7 @@ function createUpdateController(deps) {
|
|
|
4024
4029
|
}
|
|
4025
4030
|
}
|
|
4026
4031
|
async function request(version) {
|
|
4032
|
+
if (superseded()) return { error: "daemon_superseded" };
|
|
4027
4033
|
if (operation || blocked) return { error: blocked ? "manual_recovery_required" : "update_in_progress" };
|
|
4028
4034
|
operation = "request";
|
|
4029
4035
|
try {
|
|
@@ -4067,7 +4073,8 @@ function createUpdateController(deps) {
|
|
|
4067
4073
|
handoverHold = { reason, at: now() };
|
|
4068
4074
|
publish("failed", manualVersion ?? policy?.autoUpdateVersion ?? null, "handover_preflight_failed");
|
|
4069
4075
|
}
|
|
4070
|
-
|
|
4076
|
+
const policyStale = () => !policy || now() - policy.checkedAt > 65 * 6e4;
|
|
4077
|
+
return { refresh, retry, request, tick, withHandover, holdHandover, policyStale, isRunning: () => running, currentTarget: () => policy?.autoUpdateVersion ?? null };
|
|
4071
4078
|
}
|
|
4072
4079
|
|
|
4073
4080
|
const defaults = {
|
|
@@ -4276,6 +4283,132 @@ function createPolicyAnnouncementHandler(deps) {
|
|
|
4276
4283
|
};
|
|
4277
4284
|
}
|
|
4278
4285
|
|
|
4286
|
+
const POLICY_REFRESH_MIN_INTERVAL_MS = 5 * 6e4;
|
|
4287
|
+
const POLICY_REFRESH_RETRY_MS = 3e4;
|
|
4288
|
+
const POLICY_REFRESH_MAX_BACKOFF_MS = 30 * 6e4;
|
|
4289
|
+
const WAKE_GAP_SLACK_MS = 2 * 6e4;
|
|
4290
|
+
function createPolicyRefreshTrigger(deps) {
|
|
4291
|
+
const now = deps.now ?? Date.now;
|
|
4292
|
+
const minIntervalMs = deps.minIntervalMs ?? POLICY_REFRESH_MIN_INTERVAL_MS;
|
|
4293
|
+
const retryMs = deps.retryMs ?? POLICY_REFRESH_RETRY_MS;
|
|
4294
|
+
const maxBackoffMs = deps.maxBackoffMs ?? POLICY_REFRESH_MAX_BACKOFF_MS;
|
|
4295
|
+
const setTimer = deps.setTimer ?? ((fn, ms) => {
|
|
4296
|
+
const t = setTimeout(fn, ms);
|
|
4297
|
+
t.unref?.();
|
|
4298
|
+
return t;
|
|
4299
|
+
});
|
|
4300
|
+
const clearTimer = deps.clearTimer ?? ((handle) => clearTimeout(handle));
|
|
4301
|
+
const log = (message, level) => deps.log?.(message, level);
|
|
4302
|
+
let lastSuccessAt = null;
|
|
4303
|
+
let lastAttemptAt = null;
|
|
4304
|
+
let lastBypassAt = null;
|
|
4305
|
+
let failures = 0;
|
|
4306
|
+
let inFlight = false;
|
|
4307
|
+
let timer = null;
|
|
4308
|
+
let stopped = false;
|
|
4309
|
+
const backoff = (n) => n <= 0 ? retryMs : Math.min(retryMs * 2 ** (n - 1), maxBackoffMs);
|
|
4310
|
+
function earliestRun(reason) {
|
|
4311
|
+
const windowEnd = lastSuccessAt === null ? 0 : lastSuccessAt + minIntervalMs;
|
|
4312
|
+
const retryAt = lastAttemptAt === null ? 0 : lastAttemptAt + backoff(failures);
|
|
4313
|
+
if (retryAt <= Math.max(windowEnd, now())) return { at: windowEnd, bypass: false };
|
|
4314
|
+
const mayBypass = (reason === "connect" || reason === "wake") && (lastBypassAt === null || now() - lastBypassAt >= minIntervalMs);
|
|
4315
|
+
return mayBypass ? { at: windowEnd, bypass: true } : { at: retryAt, bypass: false };
|
|
4316
|
+
}
|
|
4317
|
+
function defer(ms) {
|
|
4318
|
+
if (timer !== null) return;
|
|
4319
|
+
timer = setTimer(() => {
|
|
4320
|
+
timer = null;
|
|
4321
|
+
request("scheduled");
|
|
4322
|
+
}, Math.max(0, ms));
|
|
4323
|
+
}
|
|
4324
|
+
function run(reason) {
|
|
4325
|
+
inFlight = true;
|
|
4326
|
+
lastAttemptAt = now();
|
|
4327
|
+
log(`CLI update policy refresh (${reason})`, failures === 0 ? "warn" : "debug");
|
|
4328
|
+
void deps.refresh().catch(() => "unavailable").then((result) => {
|
|
4329
|
+
inFlight = false;
|
|
4330
|
+
if (result === "superseded") {
|
|
4331
|
+
stop();
|
|
4332
|
+
return;
|
|
4333
|
+
}
|
|
4334
|
+
if (result === "ok") {
|
|
4335
|
+
if (failures > 0) log(`CLI update policy refresh recovered after ${failures} failed attempt(s)`, "warn");
|
|
4336
|
+
lastSuccessAt = now();
|
|
4337
|
+
failures = 0;
|
|
4338
|
+
return;
|
|
4339
|
+
}
|
|
4340
|
+
if (result === "busy") lastAttemptAt = now();
|
|
4341
|
+
else {
|
|
4342
|
+
if (result === "stale") lastSuccessAt = now();
|
|
4343
|
+
failures += 1;
|
|
4344
|
+
const stepUp = failures === 1 || backoff(failures) > backoff(failures - 1);
|
|
4345
|
+
const next = result === "blocked" ? "waiting for the next connect / wake / hourly check" : `next try in ${Math.round(backoff(failures) / 1e3)}s`;
|
|
4346
|
+
log(`CLI update policy refresh (${reason}) read no fresh policy (${result}, ${failures} in a row); ${next}`, stepUp ? "warn" : "debug");
|
|
4347
|
+
}
|
|
4348
|
+
if (stopped || result === "blocked") return;
|
|
4349
|
+
defer(earliestRun("scheduled").at - now());
|
|
4350
|
+
});
|
|
4351
|
+
}
|
|
4352
|
+
function request(reason) {
|
|
4353
|
+
if (stopped) return "stopped";
|
|
4354
|
+
if (inFlight) return "in-flight";
|
|
4355
|
+
const { at, bypass } = earliestRun(reason);
|
|
4356
|
+
const wait = at - now();
|
|
4357
|
+
if (wait > 0) {
|
|
4358
|
+
defer(wait);
|
|
4359
|
+
return "deferred";
|
|
4360
|
+
}
|
|
4361
|
+
if (bypass) lastBypassAt = now();
|
|
4362
|
+
if (timer !== null) {
|
|
4363
|
+
clearTimer(timer);
|
|
4364
|
+
timer = null;
|
|
4365
|
+
}
|
|
4366
|
+
run(reason);
|
|
4367
|
+
return "run";
|
|
4368
|
+
}
|
|
4369
|
+
function stop() {
|
|
4370
|
+
stopped = true;
|
|
4371
|
+
if (timer !== null) clearTimer(timer);
|
|
4372
|
+
timer = null;
|
|
4373
|
+
}
|
|
4374
|
+
return {
|
|
4375
|
+
request,
|
|
4376
|
+
/** Any other refresh (startup, hourly, announcement) that read a policy restarts the window (and a fresh one ends the backoff); one that found us superseded stops it. */
|
|
4377
|
+
noteRefreshed(result) {
|
|
4378
|
+
if (result === "ok" || result === "stale") lastSuccessAt = now();
|
|
4379
|
+
if (result === "ok") failures = 0;
|
|
4380
|
+
else if (result === "superseded") stop();
|
|
4381
|
+
},
|
|
4382
|
+
stop
|
|
4383
|
+
};
|
|
4384
|
+
}
|
|
4385
|
+
function createWakeDetector(intervalMs, now = Date.now, slackMs = WAKE_GAP_SLACK_MS) {
|
|
4386
|
+
let last = null;
|
|
4387
|
+
return {
|
|
4388
|
+
/** Call once per heartbeat; true when the process was just suspended. */
|
|
4389
|
+
beat() {
|
|
4390
|
+
const at = now();
|
|
4391
|
+
const woke = last !== null && at - last > intervalMs + slackMs;
|
|
4392
|
+
last = at;
|
|
4393
|
+
return woke;
|
|
4394
|
+
}
|
|
4395
|
+
};
|
|
4396
|
+
}
|
|
4397
|
+
|
|
4398
|
+
function createDaemonOwnership(deps) {
|
|
4399
|
+
let superseded = false;
|
|
4400
|
+
return {
|
|
4401
|
+
owns() {
|
|
4402
|
+
if (superseded) return false;
|
|
4403
|
+
const ownerPid = deps.statePid();
|
|
4404
|
+
if (ownerPid === null || ownerPid === deps.pid) return true;
|
|
4405
|
+
superseded = true;
|
|
4406
|
+
deps.onSuperseded(ownerPid);
|
|
4407
|
+
return false;
|
|
4408
|
+
}
|
|
4409
|
+
};
|
|
4410
|
+
}
|
|
4411
|
+
|
|
4279
4412
|
const HARNESS_INSTALL_CATALOG = Object.freeze({
|
|
4280
4413
|
claude: Object.freeze({ packages: [{ name: "@anthropic-ai/claude-code", spec: "latest" }], commands: ["claude"], minNode: "22.0.0", scripts: true }),
|
|
4281
4414
|
codex: Object.freeze({ packages: [{ name: "@openai/codex", spec: "latest" }], commands: ["codex"], minNode: "16.0.0", scripts: false }),
|
|
@@ -8898,6 +9031,14 @@ async function startDaemon() {
|
|
|
8898
9031
|
host: initialMachineMetadata.host
|
|
8899
9032
|
})).then(() => logger.debug(`[DAEMON RUN] claimed the machine record for host ${initialMachineMetadata.host}`)).catch((error) => logger.debug("[DAEMON RUN] could not refresh the recorded host:", error));
|
|
8900
9033
|
}
|
|
9034
|
+
const daemonOwnership = createDaemonOwnership({
|
|
9035
|
+
pid: process.pid,
|
|
9036
|
+
statePid: readDaemonStatePidSync,
|
|
9037
|
+
onSuperseded: (ownerPid) => {
|
|
9038
|
+
logger.debug(`[DAEMON RUN] Somehow a different daemon (pid ${ownerPid}) was started without killing us. We should kill ourselves.`);
|
|
9039
|
+
requestShutdown("exception", "A different daemon was started without killing us. We should kill ourselves.");
|
|
9040
|
+
}
|
|
9041
|
+
});
|
|
8901
9042
|
let lastUpdateLog = "";
|
|
8902
9043
|
let harnessInstaller = null;
|
|
8903
9044
|
let handoverInFlight = false;
|
|
@@ -8920,7 +9061,9 @@ async function startDaemon() {
|
|
|
8920
9061
|
installFenced: () => !!harnessInstaller?.isRunning(),
|
|
8921
9062
|
busyGraceMs: resolveBusyInstallGrace(process.env.HAPPY_CLI_UPDATE_BUSY_GRACE_MS),
|
|
8922
9063
|
lastInstall: lastInstallStore(configuration.happyHomeDir),
|
|
9064
|
+
owned: daemonOwnership.owns,
|
|
8923
9065
|
publish: (state) => {
|
|
9066
|
+
if (!daemonOwnership.owns()) return;
|
|
8924
9067
|
cliUpdateStateRef = state;
|
|
8925
9068
|
fileState = { ...fileState, cliUpdate: state };
|
|
8926
9069
|
writeDaemonState(fileState);
|
|
@@ -8957,10 +9100,17 @@ async function startDaemon() {
|
|
|
8957
9100
|
relayMoveInFlight = null;
|
|
8958
9101
|
});
|
|
8959
9102
|
});
|
|
8960
|
-
const
|
|
9103
|
+
const policyRefresh = createPolicyRefreshTrigger({
|
|
9104
|
+
refresh: () => updateController.refresh(),
|
|
9105
|
+
log: (message, level) => level === "warn" ? logger.warn(`[DAEMON RUN] ${message}`) : logger.debug(`[DAEMON RUN] ${message}`)
|
|
9106
|
+
});
|
|
9107
|
+
const refreshCliUpdate = () => updateController.refresh().then(policyRefresh.noteRefreshed).catch((error) => {
|
|
8961
9108
|
logger.debug("[DAEMON RUN] CLI update policy check failed:", error);
|
|
8962
9109
|
});
|
|
8963
|
-
|
|
9110
|
+
apiMachine.setControlConnectedHandler(() => {
|
|
9111
|
+
policyRefresh.request("connect");
|
|
9112
|
+
});
|
|
9113
|
+
policyRefresh.request("startup");
|
|
8964
9114
|
const cliUpdateIntervalMs = resolveCliUpdateCheckInterval(process.env.HAPPY_CLI_UPDATE_CHECK_INTERVAL);
|
|
8965
9115
|
if (process.env.HAPPY_CLI_UPDATE_CHECK_INTERVAL && cliUpdateIntervalMs === DEFAULT_CLI_UPDATE_CHECK_INTERVAL_MS && process.env.HAPPY_CLI_UPDATE_CHECK_INTERVAL.trim() !== String(DEFAULT_CLI_UPDATE_CHECK_INTERVAL_MS)) {
|
|
8966
9116
|
logger.warn(`[DAEMON RUN] Ignoring invalid HAPPY_CLI_UPDATE_CHECK_INTERVAL; using ${DEFAULT_CLI_UPDATE_CHECK_INTERVAL_MS}ms`);
|
|
@@ -8997,6 +9147,7 @@ async function startDaemon() {
|
|
|
8997
9147
|
});
|
|
8998
9148
|
apiMachine.setHarnessInstallHandler((params) => harnessInstaller.request(params));
|
|
8999
9149
|
const heartbeatIntervalMs = parseInt(process.env.HAPPY_DAEMON_HEARTBEAT_INTERVAL || "60000");
|
|
9150
|
+
const wakeDetector = createWakeDetector(heartbeatIntervalMs);
|
|
9000
9151
|
const restartOnStaleVersionAndHeartbeat = setInterval(serialTask(async () => {
|
|
9001
9152
|
try {
|
|
9002
9153
|
if (process.env.DEBUG) {
|
|
@@ -9008,6 +9159,7 @@ async function startDaemon() {
|
|
|
9008
9159
|
onChildExited(pid);
|
|
9009
9160
|
}
|
|
9010
9161
|
}
|
|
9162
|
+
if (!daemonOwnership.owns()) return;
|
|
9011
9163
|
await updateController.tick();
|
|
9012
9164
|
await updateController.withHandover(async () => {
|
|
9013
9165
|
handoverInFlight = true;
|
|
@@ -9044,6 +9196,7 @@ async function startDaemon() {
|
|
|
9044
9196
|
clearInterval(restartOnStaleVersionAndHeartbeat);
|
|
9045
9197
|
clearInterval(cliUpdateInterval);
|
|
9046
9198
|
policyAnnouncements.stop();
|
|
9199
|
+
policyRefresh.stop();
|
|
9047
9200
|
stopAgentVersionChecks();
|
|
9048
9201
|
claudeAuthService.stop();
|
|
9049
9202
|
stopAccountWatch();
|
|
@@ -9071,12 +9224,9 @@ async function startDaemon() {
|
|
|
9071
9224
|
handoverInFlight = false;
|
|
9072
9225
|
}
|
|
9073
9226
|
});
|
|
9074
|
-
|
|
9075
|
-
|
|
9076
|
-
|
|
9077
|
-
requestShutdown("exception", "A different daemon was started without killing us. We should kill ourselves.");
|
|
9078
|
-
return;
|
|
9079
|
-
}
|
|
9227
|
+
if (!daemonOwnership.owns()) return;
|
|
9228
|
+
const woke = wakeDetector.beat();
|
|
9229
|
+
if (woke || updateController.policyStale()) policyRefresh.request(woke ? "wake" : "stale");
|
|
9080
9230
|
try {
|
|
9081
9231
|
fileState = withDaemonHeartbeat(fileState, (/* @__PURE__ */ new Date()).toLocaleString());
|
|
9082
9232
|
writeDaemonState(fileState);
|
|
@@ -9188,6 +9338,7 @@ async function startDaemon() {
|
|
|
9188
9338
|
clearInterval(cliUpdateInterval);
|
|
9189
9339
|
clearInterval(autoRestartSweep);
|
|
9190
9340
|
policyAnnouncements.stop();
|
|
9341
|
+
policyRefresh.stop();
|
|
9191
9342
|
stopAgentVersionChecks();
|
|
9192
9343
|
await apiMachine.updateDaemonState((state) => ({
|
|
9193
9344
|
...state,
|