very-happy-cli 0.2.178 → 0.2.180
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-DCQXHRzT.mjs → AcpBackend-B8Zi30Zh.mjs} +135 -16
- package/dist/{AcpBackend-CDkAQXYf.cjs → AcpBackend-DfRDtMcG.cjs} +135 -16
- package/dist/{AcpSessionManager-DckmUZza.cjs → AcpSessionManager-CASKOnOj.cjs} +38 -4
- package/dist/{AcpSessionManager-BXrQcqwC.mjs → AcpSessionManager-i8Rab0xT.mjs} +38 -4
- package/dist/{BasePermissionHandler-BVlrEhIi.mjs → BasePermissionHandler-26fKbRCm.mjs} +5 -2
- package/dist/{BasePermissionHandler-DyLmKKtO.cjs → BasePermissionHandler-BlM_tfej.cjs} +5 -2
- package/dist/acpSessionResume-B9l54P-X.mjs +67 -0
- package/dist/acpSessionResume-CR5pmgVo.cjs +74 -0
- package/dist/{agentHome-CEp9RMyK.cjs → agentHome-C7Sb7-Tz.cjs} +4 -4
- package/dist/{agentHome-C1xi37as.mjs → agentHome-CmGy0NWv.mjs} +4 -4
- package/dist/{api-JANhFdZV.cjs → api-DM7b1OKj.cjs} +38 -262
- package/dist/{api-Dib0dmqC.mjs → api-Hov8p7CA.mjs} +32 -256
- package/dist/{apiMachine-DNTJidYH.mjs → apiMachine-CwGEhQDT.mjs} +62 -15
- package/dist/{apiMachine-QhK-sKcr.cjs → apiMachine-DkGRj-Ai.cjs} +64 -17
- package/dist/{attachmentContent-bpQTBJ0y.cjs → attachmentContent-CEm13_gF.cjs} +4 -4
- package/dist/{attachmentContent-DkkdpSSJ.mjs → attachmentContent-CIn4iPEk.mjs} +2 -2
- package/dist/{auth-BRjd2esb.mjs → auth-BG1DY0gj.mjs} +5 -5
- package/dist/{auth-DgIV0Cvt.cjs → auth-CBXnm-Mj.cjs} +5 -5
- package/dist/{auth-omWDtgR8.cjs → auth-Dawj7pP5.cjs} +8 -8
- package/dist/{auth-DNct7VUi.mjs → auth-rggxMpEE.mjs} +8 -8
- package/dist/{auto-DKGFOJBo.mjs → auto-CXXLXGeL.mjs} +19 -18
- package/dist/{auto-CI16FZmX.cjs → auto-CbYOfoPS.cjs} +19 -18
- package/dist/{backgroundTaskActivity-BVwJBl02.mjs → backgroundTaskActivity-8PdPxrvy.mjs} +1 -1
- package/dist/{bootstrap-DCQ87Aan.cjs → bootstrap-DoA7okld.cjs} +2 -2
- package/dist/{bootstrap-BUagGC_-.mjs → bootstrap-Dt5I1SOl.mjs} +2 -2
- package/dist/{browser-Dj_DYQEh.mjs → browser-DUNetFT4.mjs} +1 -1
- package/dist/{browser-CSKhc0Bl.cjs → browser-DZ6qRtfH.cjs} +1 -1
- package/dist/{claudeCliPath-U4HHmV4r.cjs → claudeCliPath-GaP3UUz1.cjs} +1 -1
- package/dist/{claudeLocal-CdIVnOZp.cjs → claudeLocal--DNyMOSv.cjs} +8 -7
- package/dist/{claudeLocal-CCCvAeMd.mjs → claudeLocal-OHWQigCl.mjs} +6 -5
- package/dist/{claudeLocalLauncher-BmrpaRYJ.mjs → claudeLocalLauncher-BStvfa7M.mjs} +11 -10
- package/dist/{claudeLocalLauncher-21-xh5gc.cjs → claudeLocalLauncher-BhvPbcyH.cjs} +13 -12
- package/dist/{claudeSessionFork-kYCP1IJB.cjs → claudeSessionFork-Be16vzGc.cjs} +1 -1
- package/dist/{claudeSessionFork-DvxMKAmY.mjs → claudeSessionFork-GAVWhiKG.mjs} +1 -1
- package/dist/{client-C4zKGjiJ.cjs → client-BWjaHKtj.cjs} +2 -2
- package/dist/client-Ca5Pcgy_.mjs +71 -0
- package/dist/{client-CnlkkrZO.mjs → client-CnB7kRCT.mjs} +2 -2
- package/dist/{client-BTX9hsbr.mjs → client-D4uPb1uu.mjs} +3 -3
- package/dist/client-DJplzPjD.cjs +76 -0
- package/dist/{client-Dnza1hgN.cjs → client-D_loZ9IK.cjs} +3 -3
- package/dist/codex/happyMcpStdioBridge.cjs +24 -15
- package/dist/codex/happyMcpStdioBridge.mjs +25 -16
- package/dist/{codexAppServerClient-DvkpQgyv.mjs → codexAppServerClient-CO4G6OS4.mjs} +3 -3
- package/dist/{codexAppServerClient-CRlBWGn3.cjs → codexAppServerClient-PE-12AsW.cjs} +3 -3
- package/dist/{codexCommand-DzxIWXIT.cjs → codexCommand-BNoD1t1C.cjs} +127 -116
- package/dist/{codexCommand-BxjogBzU.mjs → codexCommand-B_xUH79E.mjs} +77 -66
- package/dist/{codexTermination-C28FzlLb.cjs → codexTermination-BmBbizFK.cjs} +7 -2
- package/dist/{codexTermination-ySDNMEhd.mjs → codexTermination-Dx48ma6e.mjs} +7 -2
- package/dist/{config-BFB5uJ4t.cjs → config-CtwEUxUP.cjs} +26 -26
- package/dist/{config-DwfEpFr3.mjs → config-DSu0Blos.mjs} +3 -3
- package/dist/{configuration-4TGMrjul.cjs → configuration-CYO-kPOS.cjs} +1 -1
- package/dist/{configuration-DVrb61aY.mjs → configuration-PxzEJumr.mjs} +1 -1
- package/dist/{connect-C7FPY0PI.mjs → connect-BQrg3TB6.mjs} +15 -15
- package/dist/{connect-QH2VJGBG.cjs → connect-Dq7wndzR.cjs} +28 -28
- package/dist/{context-JoKu0V54.cjs → context-6TP-iz_c.cjs} +1 -1
- package/dist/{context-B3XPVJlj.mjs → context-CJGRRGWW.mjs} +1 -1
- package/dist/{controlClient-BTaZlbC6.cjs → controlClient-Bqv5v5OM.cjs} +3 -3
- package/dist/{controlClient-BYKyGyxj.mjs → controlClient-DoeYovwP.mjs} +4 -4
- package/dist/{createSessionMetadata-8Fuj2-IV.mjs → createSessionMetadata-DDIChCx8.mjs} +2 -2
- package/dist/{createSessionMetadata-B2NynaWZ.cjs → createSessionMetadata-xz767pcG.cjs} +3 -3
- package/dist/{defaultPermissionMode-BEWCqJU-.cjs → defaultPermissionMode-PkZGsQDk.cjs} +2 -2
- package/dist/{defaultPermissionMode-B8kJG9uI.mjs → defaultPermissionMode-i5KzdK09.mjs} +2 -2
- package/dist/{detectCLI-DR9ZaN6B.cjs → detectCLI-BuYR_Qxe.cjs} +4 -4
- package/dist/{deterministicJson-C5ZwZ7hu.mjs → deterministicJson-CTEJDqtS.mjs} +217 -12
- package/dist/{deterministicJson-BjNQsAjO.cjs → deterministicJson-xqA6DaOm.cjs} +222 -16
- package/dist/{doctor-BshRnjLi.cjs → doctor-BrgSlfXn.cjs} +9 -9
- package/dist/{doctor-0BiGwJXk.mjs → doctor-IctjVh9T.mjs} +8 -8
- package/dist/{doctorReadiness-BCZGcN0a.cjs → doctorReadiness-Dl6yRQCy.cjs} +1 -1
- package/dist/{downloadTarget-BN5vZt3K.cjs → downloadTarget-CEb9che-.cjs} +6 -6
- package/dist/{downloadTarget-DJPwAZlu.mjs → downloadTarget-jbOz1egC.mjs} +6 -6
- package/dist/{ensureDaemonRunning-C5QfToCe.cjs → ensureDaemonRunning-D-HyjGIX.cjs} +6 -6
- package/dist/{ensureDaemonRunning-CSmb_mqt.mjs → ensureDaemonRunning-b1e8LCSM.mjs} +5 -5
- package/dist/{handleResumeCommand-BwnUZmbo.cjs → handleResumeCommand-BvWVuRwH.cjs} +23 -7
- package/dist/{handleResumeCommand-CgjpsdDe.mjs → handleResumeCommand-DpaZvm2c.mjs} +22 -6
- package/dist/{index-piJPsTsm.cjs → index-B2p2Mut7.cjs} +259 -53
- package/dist/{index-BehVbAsA.mjs → index-BUNnpGFF.mjs} +256 -50
- package/dist/{index-Bvldtdny.mjs → index-Bsvbgh9e.mjs} +4 -4
- package/dist/{index-BYOZ_8WZ.cjs → index-C64Ufj4D.cjs} +4 -4
- package/dist/{index-Clqlu17M.mjs → index-C6Vn5Eac.mjs} +155 -34
- package/dist/index-CMf5VbzG.mjs +18 -0
- package/dist/index-DmTlDRSL.cjs +24 -0
- package/dist/{index-_l1Sdmbi.cjs → index-Dv0Q48P3.cjs} +156 -33
- package/dist/{index-BRClDe07.cjs → index-F2UejqYs.cjs} +3 -3
- package/dist/{index-BYgfern_.mjs → index-wCbtF4BK.mjs} +3 -3
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/{install-BdvKiOQw.mjs → install-BX3lv3NO.mjs} +1 -1
- package/dist/{install-Cf6AFSWC.cjs → install-BXvf2E3o.cjs} +1 -1
- package/dist/{install-TO4taKW7.cjs → install-C0ANcEAW.cjs} +7 -7
- package/dist/{install-fYWHrPcC.mjs → install-CdzSV7qO.mjs} +3 -3
- package/dist/{installPiTools-BKnXjrVu.cjs → installPiTools-CL_axh_6.cjs} +1 -1
- package/dist/{installTerminalHooks-BQZbvxsZ.cjs → installTerminalHooks-BETLKAtd.cjs} +3 -3
- package/dist/lib.cjs +14 -14
- package/dist/lib.d.cts +239 -2
- package/dist/lib.d.mts +239 -2
- package/dist/lib.mjs +14 -14
- package/dist/{lidState-BeOwj6eW.cjs → lidState-DWGnm2H4.cjs} +1 -1
- package/dist/{lidState-DNMlIhX0.mjs → lidState-bBrmaQd2.mjs} +1 -1
- package/dist/{localHappyAgentAuth-Br-mgogg.cjs → localHappyAgentAuth-DZHQnIW9.cjs} +1 -1
- package/dist/{localHappyAgentAuth-BezKSFDi.mjs → localHappyAgentAuth-Dn1jYDpt.mjs} +1 -1
- package/dist/{logger--vAVtXB_.mjs → logger-BUngm5Xg.mjs} +2 -2
- package/dist/{logger-DXTWlPzP.cjs → logger-CphW5nUE.cjs} +2 -2
- package/dist/machineMetadata-BQm9YTcI.cjs +79 -0
- package/dist/machineMetadata-BXN_bKU3.mjs +68 -0
- package/dist/{main-DoMFJ2Cl.cjs → main-B2UV51nK.cjs} +112 -132
- package/dist/{main-CshDb5-1.mjs → main-DGkdYfEq.mjs} +106 -126
- package/dist/{mcp-pNc1EbQf.cjs → mcp-BFvAEIRz.cjs} +15 -15
- package/dist/{mcp-DKT_lrvQ.mjs → mcp-CbTtbs0f.mjs} +15 -15
- package/dist/{mirrorProtocol-6IFGPpjJ.mjs → mirrorProtocol-BR4luBC0.mjs} +148 -7
- package/dist/{mirrorProtocol-qKflWTX_.cjs → mirrorProtocol-HKPivs5o.cjs} +150 -4
- package/dist/{package-B7B03ejW.mjs → package-7Ld1YMhh.mjs} +8 -7
- package/dist/{package-DY4zTbKS.cjs → package-KhLqBDX9.cjs} +8 -7
- package/dist/panels-C7IVqpJk.mjs +137 -0
- package/dist/panels-Njf6GelF.cjs +142 -0
- package/dist/{peerTools-3R9RUARX.mjs → peerTools-BOlDRyhi.mjs} +60 -10
- package/dist/{peerTools-iy3_6Yc5.cjs → peerTools-DQNlrcqM.cjs} +60 -9
- package/dist/{persistence-BfX72dne.cjs → persistence-9BMYspxG.cjs} +2 -2
- package/dist/{persistence-DTk4sNpd.mjs → persistence-BFUOHW5h.mjs} +3 -3
- package/dist/{piRunnerArgs-CRQVR9o-.cjs → piRunnerArgs-DGaq6VYM.cjs} +8 -2
- package/dist/{piRunnerArgs-AT8QJY7x.mjs → piRunnerArgs-H2pgpA5z.mjs} +7 -1
- package/dist/{piRuntime-BHRT5MKO.cjs → piRuntime-CT5xv_3h.cjs} +2 -2
- package/dist/{piRuntime-E44qTVQ4.mjs → piRuntime-CdN0JAsa.mjs} +2 -2
- package/dist/{piTerminal-hI4WFdWm.cjs → piTerminal-0FBtXTHK.cjs} +18 -18
- package/dist/{piTerminal-De8nbciM.mjs → piTerminal-C4m9YXAV.mjs} +18 -18
- package/dist/processTreeSnapshot-CuLJDNC-.mjs +101 -0
- package/dist/processTreeSnapshot-mDbnuojn.cjs +105 -0
- package/dist/projectPath-C3ioB4Bu.cjs +13 -0
- package/dist/prompt-BOouDaTM.mjs +99 -0
- package/dist/prompt-lgF9IE82.cjs +105 -0
- package/dist/{attachmentLimits-UyFn8fkQ.mjs → pushNotifications-DCiBEVeC.mjs} +307 -3
- package/dist/{attachmentLimits-SqeAHrVC.cjs → pushNotifications-DI92havG.cjs} +308 -2
- package/dist/{index-DFPT4HOO.cjs → query-BETKBrnz.cjs} +25 -5
- package/dist/{index-CEjJnq05.mjs → query-ywZbQUzR.mjs} +26 -3
- package/dist/{rateLimitWindows-XrJiiBpU.mjs → rateLimitWindows-BkfuUB1a.mjs} +1 -1
- package/dist/{rateLimitWindows-Czb7_7cK.cjs → rateLimitWindows-YRIYVdo4.cjs} +1 -1
- package/dist/{registerCommonHandlers-C0_fyBQ0.cjs → registerCommonHandlers-C7a_dUWs.cjs} +30 -30
- package/dist/{registerCommonHandlers-CvIedVRf.mjs → registerCommonHandlers-CTkCvjxt.mjs} +2 -2
- package/dist/{registerKillSessionHandler-DYl7l4Ts.cjs → registerKillSessionHandler-CIsvBrVe.cjs} +6 -6
- package/dist/{registerKillSessionHandler-gwJ5lTf0.mjs → registerKillSessionHandler-CaqqRYq6.mjs} +6 -6
- package/dist/{remoteSessionClient-BRTIOX5b.cjs → remoteSessionClient-D843fkzL.cjs} +5 -5
- package/dist/{remoteSessionClient-DRb2Jr5s.mjs → remoteSessionClient-PP-mOKmw.mjs} +5 -5
- package/dist/{reportProgressTool-B9nCzbkL.cjs → reportProgressTool-14AXr959.cjs} +84 -2
- package/dist/{reportProgressTool-D5tEoXMW.mjs → reportProgressTool-ZOCNjWHr.mjs} +82 -3
- package/dist/{resources-JDPugcDq.cjs → resources-CvIlkzpP.cjs} +30 -0
- package/dist/{resources-BdFBQi8r.mjs → resources-y9jfyO-_.mjs} +30 -0
- package/dist/{run-CKe_WeLW.cjs → run-CAOCYYfT.cjs} +2806 -110
- package/dist/{run-BQ_FGaOL.mjs → run-Dajw2E5j.mjs} +2787 -91
- package/dist/{runClaude-zrrNcQC_.mjs → runClaude-C6oxWYbp.mjs} +49 -47
- package/dist/{runClaude-MHI5IKM-.cjs → runClaude-CRRKt-tm.cjs} +50 -48
- package/dist/{runClaudeDeps-RRw-Nusc.cjs → runClaudeDeps-B1ysqTvx.cjs} +310 -237
- package/dist/{runClaudeDeps-CVBCokOS.mjs → runClaudeDeps-BcZ68cX3.mjs} +297 -226
- package/dist/{runGemini-kipag2ag.mjs → runGemini-D7yKc4wD.mjs} +61 -55
- package/dist/{runGemini-D7Lg9yCr.cjs → runGemini-DtKFXqf-.cjs} +89 -83
- package/dist/{runOpenClaw-C_lRY3Do.mjs → runOpenClaw-C8ilyLP9.mjs} +19 -19
- package/dist/{runOpenClaw-DCcQ0L2N.cjs → runOpenClaw-Cq29mryb.cjs} +20 -20
- package/dist/{sandbox-BSyXFVFp.mjs → sandbox-CbCutma4.mjs} +4 -4
- package/dist/{sandbox-dMwPTmjm.cjs → sandbox-gIj-EuF4.cjs} +4 -4
- package/dist/{selfCheck-DkzDDUsE.cjs → selfCheck-BTGBVthv.cjs} +39 -38
- package/dist/selfCheck-Smt-5Xiq.mjs +85 -0
- package/dist/{send-dxC0miIA.cjs → send-CZf5lLw_.cjs} +8 -8
- package/dist/{send-C-k9nsd3.mjs → send-YZRMQvMJ.mjs} +9 -9
- package/dist/{server-DxoTYNlw.mjs → server-BqwXRzFZ.mjs} +4 -4
- package/dist/{server-B-W6P7Qr.cjs → server-CknFq6xG.cjs} +6 -6
- package/dist/sessionExitLifecycle-CzkLIgNZ.mjs +142 -0
- package/dist/sessionExitLifecycle-DFltxXU8.cjs +148 -0
- package/dist/{sessionLock-DWX6BbiU.cjs → sessionLock-DRZUcKHT.cjs} +38 -5
- package/dist/{sessionLock-DBdtZGOL.mjs → sessionLock-nBXdJxJm.mjs} +36 -5
- package/dist/{sessionOps-BAnr7n8t.cjs → sessionOps-BrGiU9-s.cjs} +10 -5
- package/dist/{sessionOps-BVoXe12O.mjs → sessionOps-C58iDeD5.mjs} +11 -6
- package/dist/{sessionScanner-BtxoeluY.mjs → sessionScanner-Bm57LEXe.mjs} +3 -3
- package/dist/{sessionScanner-CDOYsEUD.cjs → sessionScanner-CaO8bLaG.cjs} +3 -3
- package/dist/{sessions-C3sZJkzI.mjs → sessions-BXyBHo8n.mjs} +40 -18
- package/dist/{sessions-hAitoN-m.cjs → sessions-uzqPCc37.cjs} +39 -16
- package/dist/{setupOfflineReconnection-_eD4cuUT.mjs → setupOfflineReconnection-1Qlek3wl.mjs} +2 -2
- package/dist/{setupOfflineReconnection-C2EeYTFH.cjs → setupOfflineReconnection-DvvVX3TB.cjs} +2 -2
- package/dist/{spawn-Bc9v7pIf.cjs → spawn-DBkodJEO.cjs} +49 -18
- package/dist/{spawn-qNrB2CD_.mjs → spawn-vn93PhYL.mjs} +49 -18
- package/dist/spawnAgents-CgPMWexP.mjs +79 -0
- package/dist/{spawnAgents-BVEaz35W.cjs → spawnAgents-DLNMlhWJ.cjs} +37 -1
- package/dist/{spawnHappyCLI-C2stUioM.mjs → spawnHappyCLI-BjFZc_7V.mjs} +1 -1
- package/dist/{spawnHappyCLI-fzUagkKV.cjs → spawnHappyCLI-DnUZv0X2.cjs} +2 -2
- package/dist/{specialCommands-BJ-nqY4s.cjs → specialCommands-BRufxlqe.cjs} +3 -3
- package/dist/{specialCommands-C6W-rVyh.mjs → specialCommands-D3ND9bdg.mjs} +3 -3
- package/dist/{startFileWatcher-Bqlqjt93.cjs → startFileWatcher-D9cYzZOq.cjs} +1 -1
- package/dist/{startFileWatcher-CR09Snmz.mjs → startFileWatcher-DXJ7yB5v.mjs} +1 -1
- package/dist/startupSessionCreate-kdr3m1uX.cjs +26 -0
- package/dist/startupSessionCreate-uZ6BM0ty.mjs +24 -0
- package/dist/{streamRelay-CJoMk_d2.mjs → streamRelay-DnMCMMfV.mjs} +1 -1
- package/dist/{streamRelay-9kBPpbvU.cjs → streamRelay-Dy6amlzx.cjs} +1 -1
- package/dist/{sync-Dhmtk66S.cjs → sync-Bn-idAoy.cjs} +1 -1
- package/dist/{sync-DbW07iQS.mjs → sync-BvVhDO40.mjs} +1 -1
- package/dist/{systemPrompt-CQcuUmVp.mjs → systemPrompt-CIZcJuJF.mjs} +4 -3
- package/dist/{systemPrompt-3PYi3EUY.cjs → systemPrompt-DlyEk35T.cjs} +4 -3
- package/dist/{teams-DpxLcUU_.cjs → teams-BLeRpDxv.cjs} +8 -8
- package/dist/{teams-CwF4Z2fA.mjs → teams-DLY3B5yi.mjs} +8 -8
- package/dist/{time-A6zR3Iy6.cjs → time-Cjv0zxQO.cjs} +1 -1
- package/dist/{time-BuGWTVP6.mjs → time-D3ETL7Jb.mjs} +1 -1
- package/dist/{titleGenerator-D26gvNaS.cjs → titleGenerator-Cgp5ihFb.cjs} +10 -9
- package/dist/{titleGenerator-BGEzNWC9.mjs → titleGenerator-Uzbd4utr.mjs} +9 -8
- package/dist/{todo-DrZc76H5.mjs → todo-C9Ga-oEM.mjs} +6 -6
- package/dist/{todo-73g3NCIO.cjs → todo-pOMcEECE.cjs} +6 -6
- package/dist/{tools-CxJp4T1T.cjs → tools-BL7Byl_x.cjs} +1 -1
- package/dist/{tools-BtsrQnNS.mjs → tools-Cho7iIWf.mjs} +1 -1
- package/dist/{uninstall-DWNYvewQ.cjs → uninstall-CbayEVoV.cjs} +6 -6
- package/dist/{uninstall-DOb2mTwV.mjs → uninstall-CvZHVY9C.mjs} +3 -3
- package/dist/webPanels-B2_C2-3g.mjs +49 -0
- package/dist/webPanels-FCgFKvVe.cjs +53 -0
- package/package.json +8 -7
- package/dist/machineMetadata-B1H9gNbN.mjs +0 -39
- package/dist/machineMetadata-DcUupMje.cjs +0 -42
- package/dist/messageBuffer-BWlGgR3A.mjs +0 -71
- package/dist/messageBuffer-fJMH6uY8.cjs +0 -73
- package/dist/projectPath-ChLhdOyt.cjs +0 -13
- package/dist/selfCheck-CF7XGJPb.mjs +0 -84
- package/dist/sessionModeFile-ByLbXTbg.mjs +0 -32
- package/dist/sessionModeFile-CLLdidiJ.cjs +0 -36
- package/dist/spawnAgents-Bw6j4tqz.mjs +0 -45
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
class MessageBuffer {
|
|
4
|
+
messages = [];
|
|
5
|
+
listeners = [];
|
|
6
|
+
nextId = 1;
|
|
7
|
+
addMessage(content, type = "assistant") {
|
|
8
|
+
const message = {
|
|
9
|
+
id: `msg-${this.nextId++}`,
|
|
10
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
11
|
+
content,
|
|
12
|
+
type
|
|
13
|
+
};
|
|
14
|
+
this.messages.push(message);
|
|
15
|
+
this.notifyListeners();
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Update the last message of a specific type by appending content to it
|
|
19
|
+
* Useful for streaming responses where deltas should accumulate in one message
|
|
20
|
+
*/
|
|
21
|
+
updateLastMessage(contentDelta, type = "assistant") {
|
|
22
|
+
for (let i = this.messages.length - 1; i >= 0; i--) {
|
|
23
|
+
if (this.messages[i].type === type) {
|
|
24
|
+
const oldMessage = this.messages[i];
|
|
25
|
+
const updatedMessage = {
|
|
26
|
+
...oldMessage,
|
|
27
|
+
content: oldMessage.content + contentDelta
|
|
28
|
+
};
|
|
29
|
+
this.messages[i] = updatedMessage;
|
|
30
|
+
this.notifyListeners();
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
this.addMessage(contentDelta, type);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Remove the last message of a specific type
|
|
38
|
+
* Useful for removing placeholder messages like "Thinking..." when actual response starts
|
|
39
|
+
*/
|
|
40
|
+
removeLastMessage(type) {
|
|
41
|
+
for (let i = this.messages.length - 1; i >= 0; i--) {
|
|
42
|
+
if (this.messages[i].type === type) {
|
|
43
|
+
this.messages.splice(i, 1);
|
|
44
|
+
this.notifyListeners();
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
getMessages() {
|
|
51
|
+
return [...this.messages];
|
|
52
|
+
}
|
|
53
|
+
clear() {
|
|
54
|
+
this.messages = [];
|
|
55
|
+
this.nextId = 1;
|
|
56
|
+
this.notifyListeners();
|
|
57
|
+
}
|
|
58
|
+
onUpdate(listener) {
|
|
59
|
+
this.listeners.push(listener);
|
|
60
|
+
return () => {
|
|
61
|
+
const index = this.listeners.indexOf(listener);
|
|
62
|
+
if (index > -1) {
|
|
63
|
+
this.listeners.splice(index, 1);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
notifyListeners() {
|
|
68
|
+
const messages = this.getMessages();
|
|
69
|
+
this.listeners.forEach((listener) => listener(messages));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const OFFLINE_EXIT_STAMP_TIMEOUT_MS = 3e3;
|
|
74
|
+
async function settleSessionOnExit(sessionId, intent, deps) {
|
|
75
|
+
if (intent === "archive") {
|
|
76
|
+
deps.updateMetadata((currentMetadata) => ({
|
|
77
|
+
...currentMetadata,
|
|
78
|
+
lifecycleState: "archived",
|
|
79
|
+
lifecycleStateSince: Date.now(),
|
|
80
|
+
archivedBy: "cli",
|
|
81
|
+
archiveReason: "User terminated"
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
if (intent === "hibernate" && deps.hibernation) {
|
|
85
|
+
const stamp = deps.hibernation;
|
|
86
|
+
const handler = (currentMetadata) => ({ ...currentMetadata, hibernation: stamp });
|
|
87
|
+
const landed = deps.updateMetadataAndWait ? await deps.updateMetadataAndWait(handler) : (deps.updateMetadata(handler), false);
|
|
88
|
+
if (!landed) deps.log?.("[START] hibernation stamp not confirmed before going offline");
|
|
89
|
+
}
|
|
90
|
+
if (intent === "offline" && deps.exitCursor && deps.updateMetadataAndWait) {
|
|
91
|
+
const stamp = deps.exitCursor;
|
|
92
|
+
const landed = await deps.updateMetadataAndWait((currentMetadata) => ({ ...currentMetadata, exitCursor: stamp }), OFFLINE_EXIT_STAMP_TIMEOUT_MS);
|
|
93
|
+
if (!landed) deps.log?.("[START] offline exit cursor not confirmed before going offline");
|
|
94
|
+
}
|
|
95
|
+
deps.sendSessionDeath();
|
|
96
|
+
try {
|
|
97
|
+
if (intent === "archive") await deps.archiveSession(sessionId);
|
|
98
|
+
else await deps.deactivateSession(sessionId);
|
|
99
|
+
} catch (error) {
|
|
100
|
+
deps.log?.(`[START] ${intent === "archive" ? "archiveSession" : "deactivateSession"} during cleanup failed:`, error);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
class SessionExitGate {
|
|
104
|
+
decided = null;
|
|
105
|
+
hibernateCommitted = false;
|
|
106
|
+
deferred = null;
|
|
107
|
+
/** Returns the intent to act on, or null when cleanup already started. */
|
|
108
|
+
claim(intent) {
|
|
109
|
+
if (this.decided === "hibernate" && !this.hibernateCommitted && intent !== "hibernate") {
|
|
110
|
+
if (this.deferred !== "archive") this.deferred = intent;
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
if (this.decided !== null) return null;
|
|
114
|
+
this.decided = intent;
|
|
115
|
+
return intent;
|
|
116
|
+
}
|
|
117
|
+
get current() {
|
|
118
|
+
return this.decided;
|
|
119
|
+
}
|
|
120
|
+
/** B-587: an exit was requested while the hibernation was deciding. */
|
|
121
|
+
get exitRequested() {
|
|
122
|
+
return this.deferred !== null;
|
|
123
|
+
}
|
|
124
|
+
/** B-587: the hibernation passed its last check — no more deferral. */
|
|
125
|
+
commitHibernate() {
|
|
126
|
+
if (this.decided === "hibernate") this.hibernateCommitted = true;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* B-587: a hibernation that aborted hands the exit back. Returns the exit
|
|
130
|
+
* deferred meanwhile (the caller must run it now), or null.
|
|
131
|
+
*/
|
|
132
|
+
release(intent) {
|
|
133
|
+
if (this.decided !== intent || intent === "hibernate" && this.hibernateCommitted) return null;
|
|
134
|
+
this.decided = null;
|
|
135
|
+
const deferred = this.deferred;
|
|
136
|
+
this.deferred = null;
|
|
137
|
+
return deferred;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
function exitIntentFromArchiveFlag(archive) {
|
|
141
|
+
return archive ?? true ? "archive" : "offline";
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
exports.MessageBuffer = MessageBuffer;
|
|
145
|
+
exports.OFFLINE_EXIT_STAMP_TIMEOUT_MS = OFFLINE_EXIT_STAMP_TIMEOUT_MS;
|
|
146
|
+
exports.SessionExitGate = SessionExitGate;
|
|
147
|
+
exports.exitIntentFromArchiveFlag = exitIntentFromArchiveFlag;
|
|
148
|
+
exports.settleSessionOnExit = settleSessionOnExit;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var persistence = require('./persistence-
|
|
3
|
+
var persistence = require('./persistence-9BMYspxG.cjs');
|
|
4
4
|
var node_fs = require('node:fs');
|
|
5
5
|
var path = require('node:path');
|
|
6
|
-
var configuration = require('./configuration-
|
|
7
|
-
var logger = require('./logger-
|
|
6
|
+
var configuration = require('./configuration-CYO-kPOS.cjs');
|
|
7
|
+
var logger = require('./logger-CphW5nUE.cjs');
|
|
8
|
+
var processTreeSnapshot = require('./processTreeSnapshot-mDbnuojn.cjs');
|
|
8
9
|
|
|
9
10
|
const PROCESS_IDENTITY_FIELDS = [
|
|
10
11
|
"hostPid",
|
|
@@ -41,7 +42,9 @@ function mergeReconnectMetadata(server, local, now) {
|
|
|
41
42
|
archivedBy: void 0,
|
|
42
43
|
archiveReason: void 0,
|
|
43
44
|
// B-587: awake again — the hibernation stamp no longer describes us.
|
|
44
|
-
hibernation: void 0
|
|
45
|
+
hibernation: void 0,
|
|
46
|
+
// B-679: likewise the previous wrapper's offline-exit cursor.
|
|
47
|
+
exitCursor: void 0
|
|
45
48
|
};
|
|
46
49
|
}
|
|
47
50
|
function applyServerSnapshot(response, snapshot) {
|
|
@@ -62,6 +65,23 @@ function applyHibernationReplay(response) {
|
|
|
62
65
|
if (replaySeq === null) return { response, replaying: false };
|
|
63
66
|
return { response: { ...response, seq: replaySeq }, replaying: true };
|
|
64
67
|
}
|
|
68
|
+
function readExitCursor(metadata) {
|
|
69
|
+
const raw = metadata?.exitCursor;
|
|
70
|
+
if (!raw || typeof raw !== "object") return null;
|
|
71
|
+
const { at, seq } = raw;
|
|
72
|
+
if (typeof at !== "number" || typeof seq !== "number" || !Number.isInteger(seq) || seq < 0) return null;
|
|
73
|
+
return { at, seq, v: 1 };
|
|
74
|
+
}
|
|
75
|
+
function exitCursorStamp(seq, now) {
|
|
76
|
+
return { at: now, seq, v: 1 };
|
|
77
|
+
}
|
|
78
|
+
function applyReconnectReplay(response) {
|
|
79
|
+
const wake = applyHibernationReplay(response);
|
|
80
|
+
if (wake.replaying) return { response: wake.response, replay: { source: "hibernation", seq: wake.response.seq } };
|
|
81
|
+
const cursor = readExitCursor(response.metadata);
|
|
82
|
+
if (!cursor || cursor.seq >= response.seq) return { response, replay: null };
|
|
83
|
+
return { response: { ...response, seq: cursor.seq }, replay: { source: "offline-exit", seq: cursor.seq } };
|
|
84
|
+
}
|
|
65
85
|
|
|
66
86
|
const runtime = {
|
|
67
87
|
signal: (pid, signal) => process.kill(pid, signal),
|
|
@@ -100,6 +120,17 @@ function terminateProcess(pid, onSettled, impl = runtime, graceMs = 2e3) {
|
|
|
100
120
|
}, graceMs);
|
|
101
121
|
return true;
|
|
102
122
|
}
|
|
123
|
+
function terminateProcessTree(pid, onSettled, deps = {}) {
|
|
124
|
+
const snapshot = (deps.snapshot ?? ((root) => processTreeSnapshot.snapshotTree(root)))(pid);
|
|
125
|
+
const reap = deps.reap ?? ((entries) => processTreeSnapshot.killSurvivors(entries));
|
|
126
|
+
return (deps.terminate ?? terminateProcess)(pid, (stopped) => {
|
|
127
|
+
try {
|
|
128
|
+
reap(snapshot);
|
|
129
|
+
} catch {
|
|
130
|
+
}
|
|
131
|
+
onSettled(stopped);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
103
134
|
|
|
104
135
|
const SESSION_LOCK_DIR = "session-locks";
|
|
105
136
|
const defaultRuntime = () => ({
|
|
@@ -204,11 +235,13 @@ async function claimSessionOrExit(happySessionId, options) {
|
|
|
204
235
|
process.on("exit", () => releaseSessionLock(happySessionId));
|
|
205
236
|
}
|
|
206
237
|
|
|
207
|
-
exports.
|
|
238
|
+
exports.applyReconnectReplay = applyReconnectReplay;
|
|
208
239
|
exports.applyServerSnapshot = applyServerSnapshot;
|
|
209
240
|
exports.claimSessionOrExit = claimSessionOrExit;
|
|
241
|
+
exports.exitCursorStamp = exitCursorStamp;
|
|
210
242
|
exports.mergeReconnectMetadata = mergeReconnectMetadata;
|
|
211
243
|
exports.processIdentityFields = processIdentityFields;
|
|
212
244
|
exports.readSessionLock = readSessionLock;
|
|
213
245
|
exports.terminateProcess = terminateProcess;
|
|
246
|
+
exports.terminateProcessTree = terminateProcessTree;
|
|
214
247
|
exports.withoutServerSnapshot = withoutServerSnapshot;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as hibernationReplaySeq } from './persistence-BFUOHW5h.mjs';
|
|
2
2
|
import { existsSync, readFileSync, unlinkSync, mkdirSync, renameSync } from 'node:fs';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
|
-
import { c as configuration, w as writePrivateFileSync } from './configuration-
|
|
5
|
-
import { l as logger } from './logger
|
|
4
|
+
import { c as configuration, w as writePrivateFileSync } from './configuration-PxzEJumr.mjs';
|
|
5
|
+
import { l as logger } from './logger-BUngm5Xg.mjs';
|
|
6
|
+
import { s as snapshotTree, k as killSurvivors } from './processTreeSnapshot-CuLJDNC-.mjs';
|
|
6
7
|
|
|
7
8
|
const PROCESS_IDENTITY_FIELDS = [
|
|
8
9
|
"hostPid",
|
|
@@ -39,7 +40,9 @@ function mergeReconnectMetadata(server, local, now) {
|
|
|
39
40
|
archivedBy: void 0,
|
|
40
41
|
archiveReason: void 0,
|
|
41
42
|
// B-587: awake again — the hibernation stamp no longer describes us.
|
|
42
|
-
hibernation: void 0
|
|
43
|
+
hibernation: void 0,
|
|
44
|
+
// B-679: likewise the previous wrapper's offline-exit cursor.
|
|
45
|
+
exitCursor: void 0
|
|
43
46
|
};
|
|
44
47
|
}
|
|
45
48
|
function applyServerSnapshot(response, snapshot) {
|
|
@@ -60,6 +63,23 @@ function applyHibernationReplay(response) {
|
|
|
60
63
|
if (replaySeq === null) return { response, replaying: false };
|
|
61
64
|
return { response: { ...response, seq: replaySeq }, replaying: true };
|
|
62
65
|
}
|
|
66
|
+
function readExitCursor(metadata) {
|
|
67
|
+
const raw = metadata?.exitCursor;
|
|
68
|
+
if (!raw || typeof raw !== "object") return null;
|
|
69
|
+
const { at, seq } = raw;
|
|
70
|
+
if (typeof at !== "number" || typeof seq !== "number" || !Number.isInteger(seq) || seq < 0) return null;
|
|
71
|
+
return { at, seq, v: 1 };
|
|
72
|
+
}
|
|
73
|
+
function exitCursorStamp(seq, now) {
|
|
74
|
+
return { at: now, seq, v: 1 };
|
|
75
|
+
}
|
|
76
|
+
function applyReconnectReplay(response) {
|
|
77
|
+
const wake = applyHibernationReplay(response);
|
|
78
|
+
if (wake.replaying) return { response: wake.response, replay: { source: "hibernation", seq: wake.response.seq } };
|
|
79
|
+
const cursor = readExitCursor(response.metadata);
|
|
80
|
+
if (!cursor || cursor.seq >= response.seq) return { response, replay: null };
|
|
81
|
+
return { response: { ...response, seq: cursor.seq }, replay: { source: "offline-exit", seq: cursor.seq } };
|
|
82
|
+
}
|
|
63
83
|
|
|
64
84
|
const runtime = {
|
|
65
85
|
signal: (pid, signal) => process.kill(pid, signal),
|
|
@@ -98,6 +118,17 @@ function terminateProcess(pid, onSettled, impl = runtime, graceMs = 2e3) {
|
|
|
98
118
|
}, graceMs);
|
|
99
119
|
return true;
|
|
100
120
|
}
|
|
121
|
+
function terminateProcessTree(pid, onSettled, deps = {}) {
|
|
122
|
+
const snapshot = (deps.snapshot ?? ((root) => snapshotTree(root)))(pid);
|
|
123
|
+
const reap = deps.reap ?? ((entries) => killSurvivors(entries));
|
|
124
|
+
return (deps.terminate ?? terminateProcess)(pid, (stopped) => {
|
|
125
|
+
try {
|
|
126
|
+
reap(snapshot);
|
|
127
|
+
} catch {
|
|
128
|
+
}
|
|
129
|
+
onSettled(stopped);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
101
132
|
|
|
102
133
|
const SESSION_LOCK_DIR = "session-locks";
|
|
103
134
|
const defaultRuntime = () => ({
|
|
@@ -202,4 +233,4 @@ async function claimSessionOrExit(happySessionId, options) {
|
|
|
202
233
|
process.on("exit", () => releaseSessionLock(happySessionId));
|
|
203
234
|
}
|
|
204
235
|
|
|
205
|
-
export { applyServerSnapshot as a,
|
|
236
|
+
export { applyServerSnapshot as a, applyReconnectReplay as b, claimSessionOrExit as c, terminateProcessTree as d, exitCursorStamp as e, mergeReconnectMetadata as m, processIdentityFields as p, readSessionLock as r, terminateProcess as t, withoutServerSnapshot 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-CYO-kPOS.cjs');
|
|
5
5
|
var authRelay = require('./authRelay-Dy1qU9td.cjs');
|
|
6
|
-
var controlClient = require('./controlClient-
|
|
7
|
-
var persistence = require('./persistence-
|
|
6
|
+
var controlClient = require('./controlClient-Bqv5v5OM.cjs');
|
|
7
|
+
var persistence = require('./persistence-9BMYspxG.cjs');
|
|
8
8
|
var node_crypto = require('node:crypto');
|
|
9
|
-
var time = require('./time-
|
|
9
|
+
var time = require('./time-Cjv0zxQO.cjs');
|
|
10
10
|
var socket_ioClient = require('socket.io-client');
|
|
11
11
|
var backgroundTaskActivity = require('./backgroundTaskActivity-CBvUdj39.cjs');
|
|
12
12
|
|
|
@@ -195,6 +195,10 @@ function agentPiece(body) {
|
|
|
195
195
|
}
|
|
196
196
|
return null;
|
|
197
197
|
}
|
|
198
|
+
function isSteerPrompt(body) {
|
|
199
|
+
const b = asRecord(body);
|
|
200
|
+
return !!b && asRecord(b.meta)?.delivery === "steer";
|
|
201
|
+
}
|
|
198
202
|
function userPromptText(body) {
|
|
199
203
|
return isUserPrompt(body) ? body.content.text : null;
|
|
200
204
|
}
|
|
@@ -214,6 +218,7 @@ function analyzeLatestTurn(entries, options = {}) {
|
|
|
214
218
|
let lastMarker = null;
|
|
215
219
|
let startedAfterPrompt = false;
|
|
216
220
|
const emitsStarts = entries.some((entry) => sessionEnvelope(entry.body)?.ev?.t === "turn-start");
|
|
221
|
+
const steerAnchor = userIndex >= 0 && isSteerPrompt(entries[userIndex].body);
|
|
217
222
|
for (let i = userIndex + 1; i < entries.length; i++) {
|
|
218
223
|
const body = entries[i].body;
|
|
219
224
|
if (options.anchor && isUserPrompt(body)) {
|
|
@@ -232,7 +237,7 @@ function analyzeLatestTurn(entries, options = {}) {
|
|
|
232
237
|
}
|
|
233
238
|
if (env?.ev?.t === "turn-end") {
|
|
234
239
|
lastMarker = "end";
|
|
235
|
-
if (userIndex >= 0 && emitsStarts && !startedAfterPrompt) continue;
|
|
240
|
+
if (userIndex >= 0 && emitsStarts && !startedAfterPrompt && !steerAnchor) continue;
|
|
236
241
|
ended = true;
|
|
237
242
|
status = typeof env.ev.status === "string" ? env.ev.status : null;
|
|
238
243
|
error = typeof env.ev.error === "string" ? env.ev.error : null;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
-
import { c as configuration } from './configuration-
|
|
2
|
+
import { c as configuration } from './configuration-PxzEJumr.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,
|
|
5
|
-
import {
|
|
4
|
+
import { l as listDaemonSessions, f as stopDaemonSession } from './controlClient-DoeYovwP.mjs';
|
|
5
|
+
import { b as readCredentialsForConfiguredRelay, c as readPersistedSessions } from './persistence-BFUOHW5h.mjs';
|
|
6
6
|
import { randomUUID } from 'node:crypto';
|
|
7
|
-
import { d as delay } from './time-
|
|
7
|
+
import { d as delay } from './time-D3ETL7Jb.mjs';
|
|
8
8
|
import { io } from 'socket.io-client';
|
|
9
|
-
import { b as backgroundTasksReport } from './backgroundTaskActivity-
|
|
9
|
+
import { b as backgroundTasksReport } from './backgroundTaskActivity-8PdPxrvy.mjs';
|
|
10
10
|
|
|
11
11
|
function sessionWebUrl(sessionId) {
|
|
12
12
|
return `${configuration.webappUrl.replace(/\/+$/, "")}/session/${sessionId}`;
|
|
@@ -193,6 +193,10 @@ function agentPiece(body) {
|
|
|
193
193
|
}
|
|
194
194
|
return null;
|
|
195
195
|
}
|
|
196
|
+
function isSteerPrompt(body) {
|
|
197
|
+
const b = asRecord(body);
|
|
198
|
+
return !!b && asRecord(b.meta)?.delivery === "steer";
|
|
199
|
+
}
|
|
196
200
|
function userPromptText(body) {
|
|
197
201
|
return isUserPrompt(body) ? body.content.text : null;
|
|
198
202
|
}
|
|
@@ -212,6 +216,7 @@ function analyzeLatestTurn(entries, options = {}) {
|
|
|
212
216
|
let lastMarker = null;
|
|
213
217
|
let startedAfterPrompt = false;
|
|
214
218
|
const emitsStarts = entries.some((entry) => sessionEnvelope(entry.body)?.ev?.t === "turn-start");
|
|
219
|
+
const steerAnchor = userIndex >= 0 && isSteerPrompt(entries[userIndex].body);
|
|
215
220
|
for (let i = userIndex + 1; i < entries.length; i++) {
|
|
216
221
|
const body = entries[i].body;
|
|
217
222
|
if (options.anchor && isUserPrompt(body)) {
|
|
@@ -230,7 +235,7 @@ function analyzeLatestTurn(entries, options = {}) {
|
|
|
230
235
|
}
|
|
231
236
|
if (env?.ev?.t === "turn-end") {
|
|
232
237
|
lastMarker = "end";
|
|
233
|
-
if (userIndex >= 0 && emitsStarts && !startedAfterPrompt) continue;
|
|
238
|
+
if (userIndex >= 0 && emitsStarts && !startedAfterPrompt && !steerAnchor) continue;
|
|
234
239
|
ended = true;
|
|
235
240
|
status = typeof env.ev.status === "string" ? env.ev.status : null;
|
|
236
241
|
error = typeof env.ev.error === "string" ? env.ev.error : null;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { I as InvalidateSync } from './sync-
|
|
1
|
+
import { I as InvalidateSync } from './sync-BvVhDO40.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-BUngm5Xg.mjs';
|
|
7
|
+
import { s as startFileWatcher } from './startFileWatcher-DXJ7yB5v.mjs';
|
|
8
8
|
import { g as getProjectPath } from './path-D2wdaNSk.mjs';
|
|
9
9
|
|
|
10
10
|
class Future {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var sync = require('./sync-
|
|
3
|
+
var sync = require('./sync-Bn-idAoy.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-CphW5nUE.cjs');
|
|
9
|
+
var startFileWatcher = require('./startFileWatcher-D9cYzZOq.cjs');
|
|
10
10
|
var path = require('./path-B7zW-WwE.cjs');
|
|
11
11
|
|
|
12
12
|
class Future {
|
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
-
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-
|
|
2
|
+
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-C58iDeD5.mjs';
|
|
3
3
|
import { i as isValidSessionId } from './ids-DU6sLx4C.mjs';
|
|
4
|
-
import { c as cliPeerSelf, l as listPeerSessions, s as sendPeerMessage, P as PEER_SCOPES } from './peerTools-
|
|
5
|
-
import {
|
|
4
|
+
import { c as cliPeerSelf, e as executeSessionPeerTool, l as listPeerSessions, s as sendPeerMessage, P as PEER_SCOPES } from './peerTools-BOlDRyhi.mjs';
|
|
5
|
+
import { c as readPersistedSessions } from './persistence-BFUOHW5h.mjs';
|
|
6
6
|
import { resolve } from 'node:path';
|
|
7
|
-
import { f as fillForeignAccountRows, l as listRemoteSessions, a as listRemotePeers, w as waitForRemoteTurnEnd, r as readRemoteTranscript } from './remoteSessionClient-
|
|
7
|
+
import { f as fillForeignAccountRows, l as listRemoteSessions, a as listRemotePeers, w as waitForRemoteTurnEnd, r as readRemoteTranscript } from './remoteSessionClient-PP-mOKmw.mjs';
|
|
8
8
|
import 'axios';
|
|
9
|
-
import './configuration-
|
|
9
|
+
import './configuration-PxzEJumr.mjs';
|
|
10
10
|
import 'node:fs';
|
|
11
11
|
import 'node:os';
|
|
12
|
-
import './package-
|
|
12
|
+
import './package-7Ld1YMhh.mjs';
|
|
13
13
|
import 'node:fs/promises';
|
|
14
14
|
import './authRelay-DhQhkBvX.mjs';
|
|
15
15
|
import 'node:crypto';
|
|
16
16
|
import 'tweetnacl';
|
|
17
|
-
import './controlClient-
|
|
18
|
-
import './logger
|
|
17
|
+
import './controlClient-DoeYovwP.mjs';
|
|
18
|
+
import './logger-BUngm5Xg.mjs';
|
|
19
19
|
import 'node:util';
|
|
20
|
-
import './time-
|
|
20
|
+
import './time-D3ETL7Jb.mjs';
|
|
21
21
|
import 'socket.io-client';
|
|
22
|
-
import './backgroundTaskActivity-
|
|
22
|
+
import './backgroundTaskActivity-8PdPxrvy.mjs';
|
|
23
23
|
import 'zod';
|
|
24
|
+
import './client-Ca5Pcgy_.mjs';
|
|
24
25
|
|
|
25
26
|
const MACHINE_ID_RE = /^[a-zA-Z0-9_-]{1,128}$/;
|
|
26
27
|
const ACTIONS = ["list", "read", "stop", "archive", "approve", "deny", "peers", "message"];
|
|
@@ -65,7 +66,7 @@ function parseSessionsArgs(args) {
|
|
|
65
66
|
} else if (arg === "--scope") {
|
|
66
67
|
const value = args[++i];
|
|
67
68
|
if (value === void 0) throw new Error("--scope requires a value");
|
|
68
|
-
if (!PEER_SCOPES.includes(value)) throw new Error(`--scope must be one of ${PEER_SCOPES.join(", ")}`);
|
|
69
|
+
if (value !== "project" && !PEER_SCOPES.includes(value)) throw new Error(`--scope must be one of ${[...PEER_SCOPES, "project"].join(", ")}`);
|
|
69
70
|
options.scope = value;
|
|
70
71
|
} else if (arg === "--cwd") {
|
|
71
72
|
const value = args[++i];
|
|
@@ -162,7 +163,7 @@ ${chalk.bold("Usage:")}
|
|
|
162
163
|
very-happy sessions archive <id> [--json]
|
|
163
164
|
very-happy sessions approve <id> <requestId> [--for-session] [--json]
|
|
164
165
|
very-happy sessions deny <id> <requestId> [--reason <text>] [--json]
|
|
165
|
-
very-happy sessions peers [--scope repo|cwd|machine] [--cwd <dir>] [--machine <id>] [--json]
|
|
166
|
+
very-happy sessions peers [--scope repo|cwd|machine|project] [--cwd <dir>] [--machine <id>] [--json]
|
|
166
167
|
very-happy sessions message <id> <text> [--reply-to <msgId>] [--machine <id>] [--json]
|
|
167
168
|
|
|
168
169
|
${chalk.bold("Actions:")}
|
|
@@ -200,7 +201,10 @@ ${chalk.bold("Actions:")}
|
|
|
200
201
|
managed session's shell, else this CLI) and tells the peer how to
|
|
201
202
|
reply. A session another machine spawned is delivered through
|
|
202
203
|
that machine's daemon, with this host named in the header.
|
|
203
|
-
Refused for sessions that are not running, or terminal mirrors
|
|
204
|
+
Refused for sessions that are not running, or terminal mirrors \u2014
|
|
205
|
+
except a session in the same project as the sender: there the
|
|
206
|
+
message is kept server-side and read on its next turn
|
|
207
|
+
(\`status: offline-stored\`, exit 0).
|
|
204
208
|
\`delivered\` follows \`very-happy send\`: true only when a
|
|
205
209
|
wrapper was attached before and after the POST (\`stored\` = it
|
|
206
210
|
is on the server anyway).
|
|
@@ -225,7 +229,9 @@ ${chalk.bold("Options:")}
|
|
|
225
229
|
--timeout <s> read --wait only: give up after <s> seconds (default 600).
|
|
226
230
|
--for-session approve only: approved_for_session instead of approved.
|
|
227
231
|
--reason <text> deny only: reason forwarded to the wrapper.
|
|
228
|
-
--scope <s> peers only: repo (default) | cwd | machine
|
|
232
|
+
--scope <s> peers only: repo (default) | cwd | machine | project
|
|
233
|
+
(project = the other sessions of the calling session's
|
|
234
|
+
Very Happy project on any machine).
|
|
229
235
|
--cwd <dir> peers only: directory the scope is computed from
|
|
230
236
|
(default: the process cwd, or HAPPY_SESSION_ID's cwd).
|
|
231
237
|
--reply-to <id> message only: the peer message id being answered.
|
|
@@ -249,7 +255,8 @@ ${chalk.bold("Exit codes:")}
|
|
|
249
255
|
2 read --wait: the turn had not ended when --timeout ran out (the
|
|
250
256
|
partial state is still printed)
|
|
251
257
|
0 success (approve/deny: the wrapper acknowledged the verdict; check
|
|
252
|
-
\`settled\` in --json to see whether the request has left the pending set
|
|
258
|
+
\`settled\` in --json to see whether the request has left the pending set;
|
|
259
|
+
message: delivered, or kept for a same-project session's next turn)
|
|
253
260
|
1 bad arguments, unknown session, no machine of the account holds it (or
|
|
254
261
|
its machine is offline / too old), request not pending, session not
|
|
255
262
|
online, or the operation failed (including \`stop\` on a session the
|
|
@@ -282,6 +289,9 @@ function formatAccountSummaryLine(summary) {
|
|
|
282
289
|
parts.push(summary.url);
|
|
283
290
|
return parts.join(" ");
|
|
284
291
|
}
|
|
292
|
+
function peerMessageExitCode(result) {
|
|
293
|
+
return result.delivered || result.status === "offline-stored" ? 0 : 1;
|
|
294
|
+
}
|
|
285
295
|
function permissionFailureRecord(sessionId, requestId, error) {
|
|
286
296
|
return { sessionId, requestId, error: error instanceof Error ? error.message : String(error) };
|
|
287
297
|
}
|
|
@@ -373,8 +383,18 @@ async function handleSessionsCommand(args) {
|
|
|
373
383
|
const cwd = options.cwd ? resolve(options.cwd) : process.cwd();
|
|
374
384
|
const persisted = readPersistedSessions();
|
|
375
385
|
const context = { self: () => cliPeerSelf(process.env, cwd, persisted), readPersisted: () => persisted };
|
|
386
|
+
if (options.action === "peers" && options.scope === "project") {
|
|
387
|
+
const self = cliPeerSelf(process.env, cwd, persisted);
|
|
388
|
+
const listing = await executeSessionPeerTool("session_peers", { scope: "project" }, context);
|
|
389
|
+
if (options.json) console.log(JSON.stringify(listing));
|
|
390
|
+
else if (!listing.project) console.log(`Not in a project (${self.sessionId}).`);
|
|
391
|
+
else if (listing.peers.length === 0) console.log(`No other sessions in project "${listing.project.name}".`);
|
|
392
|
+
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(" "));
|
|
393
|
+
process.exit(0);
|
|
394
|
+
}
|
|
376
395
|
if (options.action === "peers") {
|
|
377
|
-
const
|
|
396
|
+
const scope = options.scope === "project" ? void 0 : options.scope;
|
|
397
|
+
const listing = options.machine ? await listRemotePeers(options.machine, { ...scope ? { scope } : {}, ...options.cwd ? { cwd: options.cwd } : {} }) : await listPeerSessions(context, scope ?? "repo");
|
|
378
398
|
if (options.json) {
|
|
379
399
|
console.log(JSON.stringify(listing));
|
|
380
400
|
} else if (listing.peers.length === 0) {
|
|
@@ -398,9 +418,11 @@ async function handleSessionsCommand(args) {
|
|
|
398
418
|
const result = await sendPeerMessage(context, { to: target, body: options.text, replyTo: options.replyTo, ...options.machine ? { machineId: options.machine } : {} });
|
|
399
419
|
if (options.json) console.log(JSON.stringify(result));
|
|
400
420
|
else if (result.delivered) console.log(`Message ${result.messageId} delivered to ${target}${result.machine ? ` on ${result.machine.host}` : ""}
|
|
421
|
+
${result.url}`);
|
|
422
|
+
else if (result.status === "offline-stored") console.log(`Message ${result.messageId} ${result.note ?? "stored"} (${target} is not running; same project)
|
|
401
423
|
${result.url}`);
|
|
402
424
|
else console.error(chalk.yellow("Not delivered:"), result.error ?? `session is ${result.status}`, result.stored ? "(stored server-side, unread)" : "");
|
|
403
|
-
process.exit(result
|
|
425
|
+
process.exit(peerMessageExitCode(result));
|
|
404
426
|
} catch (error) {
|
|
405
427
|
if (options.json) console.log(JSON.stringify({ delivered: false, to: target, error: error instanceof Error ? error.message : String(error) }));
|
|
406
428
|
throw error;
|
|
@@ -504,4 +526,4 @@ ${result.url}`);
|
|
|
504
526
|
}
|
|
505
527
|
}
|
|
506
528
|
|
|
507
|
-
export { SESSIONS_HELP, handleSessionsCommand, parseSessionsArgs, permissionFailureRecord };
|
|
529
|
+
export { SESSIONS_HELP, handleSessionsCommand, parseSessionsArgs, peerMessageExitCode, permissionFailureRecord };
|