very-happy-cli 0.2.159 → 0.2.161
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-VsfkZiVF.mjs → AcpBackend-6U6pQgx1.mjs} +4 -2
- package/dist/{AcpBackend-DUYFlyfN.cjs → AcpBackend-Ba98QDif.cjs} +78 -76
- package/dist/{AcpSessionManager-Bdv8LWXh.cjs → AcpSessionManager-BAY1Pggx.cjs} +9 -9
- package/dist/{AcpSessionManager-rYtVb0kN.mjs → AcpSessionManager-CoMWFVw3.mjs} +1 -1
- package/dist/BasePermissionHandler-2R0uH2CI.cjs +157 -0
- package/dist/BasePermissionHandler-BvvhBTja.mjs +155 -0
- package/dist/BaseReasoningProcessor-DyhO1uoU.mjs +198 -0
- package/dist/BaseReasoningProcessor-fsVNmCEF.cjs +200 -0
- package/dist/RemoteModeDisplay-D-HewyXg.mjs +150 -0
- package/dist/RemoteModeDisplay-NC1gPHtj.cjs +153 -0
- package/dist/agentAttachments-Dbw8iMCZ.cjs +20 -0
- package/dist/agentAttachments-M_B5qEF2.mjs +18 -0
- package/dist/agentGuidance-B5NATuFa.cjs +28 -0
- package/dist/agentGuidance-CQuNlNx8.mjs +20 -0
- package/dist/{agentHome-CvsJyeQB.mjs → agentHome-Ck1i1TQB.mjs} +8 -22
- package/dist/{agentHome-CHh4lmjM.cjs → agentHome-DvNnGphb.cjs} +14 -28
- package/dist/api-B2vLMS-z.cjs +3346 -0
- package/dist/api-SffjRQ1b.mjs +3339 -0
- package/dist/{types-Dh-s4Lqs.mjs → apiMachine-BpW9t8MO.mjs} +9116 -16205
- package/dist/{types-BbvK1Tr_.cjs → apiMachine-gFA54X7y.cjs} +9104 -16247
- package/dist/assistantTools-BfA0R3_m.cjs +380 -0
- package/dist/assistantTools-CgiTbnWb.mjs +376 -0
- package/dist/attachmentContent-CSGxr71v.mjs +82 -0
- package/dist/attachmentContent-DMMZzevR.cjs +88 -0
- package/dist/attachmentLimits-CzVrqgLR.cjs +354 -0
- package/dist/attachmentLimits-yba1uHFO.mjs +348 -0
- package/dist/auth-Bt4ceBBy.cjs +227 -0
- package/dist/auth-CYHjQ8oQ.mjs +225 -0
- package/dist/auth-DdyVZSo6.mjs +218 -0
- package/dist/auth-x4CEoysH.cjs +220 -0
- package/dist/authRelay-BdYkC1Po.cjs +156 -0
- package/dist/authRelay-DSAvg1uv.mjs +143 -0
- package/dist/{auto-DKmEls8Z.cjs → auto-BDXDUnjB.cjs} +70 -79
- package/dist/{auto-nb8GhRRy.mjs → auto-CXLlRi3a.mjs} +27 -36
- package/dist/backgroundTaskActivity-8PdPxrvy.mjs +149 -0
- package/dist/backgroundTaskActivity-CBvUdj39.cjs +157 -0
- package/dist/bootstrap-BNQq05jR.mjs +112 -0
- package/dist/bootstrap-CkgIq8N3.cjs +116 -0
- package/dist/browser-9pyhQr1R.mjs +20 -0
- package/dist/browser-BDOlKWYe.cjs +22 -0
- package/dist/claudeCliPath-BqkaH2oR.mjs +8 -0
- package/dist/claudeCliPath-U4HHmV4r.cjs +10 -0
- package/dist/claudeLocal-BDuGFnjJ.cjs +343 -0
- package/dist/claudeLocal-CQa8qnwq.mjs +339 -0
- package/dist/claudeLocalLauncher-Bd5I2-j6.cjs +154 -0
- package/dist/claudeLocalLauncher-CDqQI9ak.mjs +152 -0
- package/dist/cliUpdate-DsKXPFYp.cjs +120 -0
- package/dist/cliUpdate-Y34VGe9Y.mjs +112 -0
- package/dist/client-Brn-UwVk.mjs +100 -0
- package/dist/client-CXb1VJui.mjs +112 -0
- package/dist/client-C_axwRry.cjs +104 -0
- package/dist/client-DOBWJL3u.cjs +119 -0
- package/dist/codex/happyMcpStdioBridge.cjs +33 -14
- package/dist/codex/happyMcpStdioBridge.mjs +26 -7
- package/dist/codexAppServerClient-ZzhUTWPo.cjs +1090 -0
- package/dist/codexAppServerClient-oeQKD6Qf.mjs +1088 -0
- package/dist/codexCommand-C7H0NpBe.cjs +2088 -0
- package/dist/codexCommand-CJ82bl3l.mjs +2086 -0
- package/dist/codexThreadFork-BCaEMBiM.mjs +338 -0
- package/dist/codexThreadFork-BZqF-9bX.cjs +350 -0
- package/dist/{config-ClLtM6F3.mjs → config-BglnktIo.mjs} +7 -40
- package/dist/{config-DLx-vW3I.cjs → config-CYpL1Ahd.cjs} +26 -59
- package/dist/configuration-DoWFJUPm.mjs +170 -0
- package/dist/configuration-v9f8LM9T.cjs +181 -0
- package/dist/connect-hgcNjyAB.mjs +682 -0
- package/dist/connect-yEvjdRvx.cjs +684 -0
- package/dist/constants-BC4St0xd.mjs +11 -0
- package/dist/constants-VJ0N6WuG.cjs +17 -0
- package/dist/contentLogMetadata-BlWI0egu.mjs +51 -0
- package/dist/contentLogMetadata-ZSFk_NjQ.cjs +54 -0
- package/dist/context-B45vMtSZ.cjs +69 -0
- package/dist/context-C9GHPLEm.mjs +65 -0
- package/dist/controlClient-DjoKTtgK.mjs +260 -0
- package/dist/controlClient-fEHE85bH.cjs +279 -0
- package/dist/createSessionMetadata-BRLB9CNO.cjs +58 -0
- package/dist/createSessionMetadata-mIeehclp.mjs +54 -0
- package/dist/defaultPermissionMode-BnxJPVHT.mjs +4 -0
- package/dist/defaultPermissionMode-CxmTXUQR.cjs +7 -0
- package/dist/detectCLI-CSGMlV51.mjs +58 -0
- package/dist/detectCLI-DR9ZaN6B.cjs +61 -0
- package/dist/deterministicJson-DKDP_mM-.cjs +507 -0
- package/dist/deterministicJson-p835AdAU.mjs +502 -0
- package/dist/doctor-BPkYWSuq.mjs +75 -0
- package/dist/doctor-BeUuQXFs.mjs +391 -0
- package/dist/doctor-hVNnSZJn.cjs +395 -0
- package/dist/doctor-u46qYYKX.cjs +79 -0
- package/dist/doctorReadiness-BCZGcN0a.cjs +151 -0
- package/dist/doctorReadiness-C208SMN9.mjs +142 -0
- package/dist/editPaths-BVfS_FFL.mjs +68 -0
- package/dist/editPaths-Bqp4OFPw.cjs +73 -0
- package/dist/ensureDaemonRunning-CO7d1gOC.mjs +61 -0
- package/dist/ensureDaemonRunning-Dg9aZfjs.cjs +64 -0
- package/dist/handleResumeCommand-BiTPK0qd.mjs +240 -0
- package/dist/handleResumeCommand-DnVmy7a3.cjs +245 -0
- package/dist/ids-B6ZC0HGt.cjs +13 -0
- package/dist/ids-DU6sLx4C.mjs +10 -0
- package/dist/index-B6UGRQ7h.mjs +102 -0
- package/dist/{index-2mCaeKyf.mjs → index-CAFwetLk.mjs} +68 -38
- package/dist/index-Cqx-Raq6.mjs +68 -0
- package/dist/index-D3kI0hDR.cjs +107 -0
- package/dist/index-DA7yINuk.cjs +994 -0
- package/dist/{index-BEOMECtE.cjs → index-LIn6nCcq.cjs} +121 -91
- package/dist/index-Pf2cV9cn.cjs +182 -0
- package/dist/index-SPGPenK5.mjs +158 -0
- package/dist/index-gNTWtSKN.cjs +71 -0
- package/dist/index-qdS1friN.mjs +949 -0
- package/dist/index.cjs +5 -46
- package/dist/index.mjs +5 -46
- package/dist/{install-BPhJppvd.mjs → install-BO_W7VhL.mjs} +37 -37
- package/dist/install-Bu85vlHD.cjs +88 -0
- package/dist/install-ClUUl3yp.mjs +86 -0
- package/dist/{install-BOHrUaFM.cjs → install-Cs5qAPrB.cjs} +38 -38
- package/dist/{installPiTools-DuZ6jZvX.cjs → installPiTools-BKnXjrVu.cjs} +2 -3
- package/dist/{installPiTools-Cj7yU9Fc.mjs → installPiTools-B_CdM5_2.mjs} +1 -2
- package/dist/{installTerminalHooks-Cou3WUf3.cjs → installTerminalHooks-BQZbvxsZ.cjs} +5 -40
- package/dist/{installTerminalHooks-WeznjkuC.mjs → installTerminalHooks-By7gBMEF.mjs} +3 -38
- package/dist/lib.cjs +28 -19
- package/dist/lib.d.cts +12 -2
- package/dist/lib.d.mts +12 -2
- package/dist/lib.mjs +23 -14
- package/dist/lidState-C2dI0FAN.mjs +297 -0
- package/dist/lidState-KHHu1015.cjs +305 -0
- package/dist/limits-C-a7gr04.cjs +43 -0
- package/dist/limits-DIo7rEBR.mjs +36 -0
- package/dist/localHappyAgentAuth-BXiHPXdC.cjs +86 -0
- package/dist/localHappyAgentAuth-DCsetiyG.mjs +82 -0
- package/dist/logger-Bc8-u1w0.cjs +275 -0
- package/dist/logger-fXoNzNuB.mjs +271 -0
- package/dist/loginShellEnv-BkuYtExZ.cjs +182 -0
- package/dist/loginShellEnv-Dw8M7tkI.mjs +167 -0
- package/dist/machineMetadata-BHjehxJY.mjs +38 -0
- package/dist/machineMetadata-BibDMFVx.cjs +41 -0
- package/dist/main-BktM4A1K.mjs +939 -0
- package/dist/main-CLaX-t-b.cjs +941 -0
- package/dist/manager-BQ4flvQZ.mjs +101 -0
- package/dist/manager-Cly8xVIR.cjs +105 -0
- package/dist/{mcp-Dy3f_K0h.mjs → mcp-CeUd9KDr.mjs} +27 -33
- package/dist/{mcp-CPYbtsYG.cjs → mcp-GBfE70nk.cjs} +42 -48
- package/dist/messageBuffer-BWlGgR3A.mjs +71 -0
- package/dist/messageBuffer-fJMH6uY8.cjs +73 -0
- package/dist/mirrorProtocol-BNLtoWjO.mjs +170 -0
- package/dist/mirrorProtocol-BUtmg1ws.cjs +186 -0
- package/dist/oneShotPrompts-CL0dip9C.cjs +16 -0
- package/dist/oneShotPrompts-DT4p6RNd.mjs +12 -0
- package/dist/package-Cl5BEP5x.cjs +173 -0
- package/dist/package-uOg9SCKi.mjs +171 -0
- package/dist/path-B7zW-WwE.cjs +18 -0
- package/dist/path-D2wdaNSk.mjs +15 -0
- package/dist/peerTools-CIeiy9wn.cjs +283 -0
- package/dist/peerTools-Dz3_7Bkk.mjs +272 -0
- package/dist/permissionMode-CH4FoZfU.mjs +80 -0
- package/dist/permissionMode-CrV-XuMs.cjs +87 -0
- package/dist/persistence-CBNMzSa8.cjs +414 -0
- package/dist/persistence-oET5n61f.mjs +372 -0
- package/dist/piExtension.mjs +2 -1
- package/dist/piRunnerArgs-Bf7RUF__.cjs +66 -0
- package/dist/piRunnerArgs-Dk1ncwHF.mjs +59 -0
- package/dist/{piRuntime-NtF0YqjH.cjs → piRuntime-B_6TE9Eb.cjs} +4 -4
- package/dist/{piRuntime-kLZNpAAl.mjs → piRuntime-BwRdhK_N.mjs} +2 -2
- package/dist/{piTerminal-B0fEOV_2.mjs → piTerminal-Bap3R8Re.mjs} +32 -35
- package/dist/{piTerminal-9J0GAKzb.cjs → piTerminal-CagmEoez.cjs} +32 -35
- package/dist/previewPath-B0rBdhy1.cjs +83 -0
- package/dist/previewPath-CXN4Vag0.mjs +81 -0
- package/dist/projectPath-BTBIMB57.mjs +10 -0
- package/dist/projectPath-ChLhdOyt.cjs +13 -0
- package/dist/registerCommonHandlers-BjSV2Skz.cjs +538 -0
- package/dist/registerCommonHandlers-CrgvJsOy.mjs +536 -0
- package/dist/registerKillSessionHandler-6TC2S3lf.cjs +366 -0
- package/dist/registerKillSessionHandler-Cbc8Rgtd.mjs +363 -0
- package/dist/remoteSessionClient-BNx78NLb.cjs +634 -0
- package/dist/remoteSessionClient-CO7qOjR0.mjs +612 -0
- package/dist/resources-BdFBQi8r.mjs +117 -0
- package/dist/resources-JDPugcDq.cjs +120 -0
- package/dist/run-2l5vSt2h.mjs +5743 -0
- package/dist/run-D5xAEWSB.cjs +5766 -0
- package/dist/runClaude-BX6ixjtW.cjs +894 -0
- package/dist/runClaude-BgN6xo05.mjs +892 -0
- package/dist/runClaudeDeps-Bp20MScE.cjs +4168 -0
- package/dist/runClaudeDeps-COBBhD9o.mjs +4129 -0
- package/dist/{runGemini-F-mqx3_K.cjs → runGemini-CSMPkt0p.cjs} +202 -175
- package/dist/{runGemini-DV6Ouadt.mjs → runGemini-Cc2jq-uh.mjs} +58 -31
- package/dist/{runOpenClaw-D7MlPS5n.mjs → runOpenClaw-CIlCwdW2.mjs} +31 -32
- package/dist/{runOpenClaw-Qqo9j63M.cjs → runOpenClaw-YBwua4Rf.cjs} +64 -65
- package/dist/sandbox-C4gXLP1p.cjs +187 -0
- package/dist/sandbox-CNkwOtHI.mjs +180 -0
- package/dist/selfCheck-CU8xSDsl.cjs +87 -0
- package/dist/selfCheck-hJ6PCh7v.mjs +84 -0
- package/dist/{send-CLhYXNgy.mjs → send-CGHcKZ-w.mjs} +12 -5
- package/dist/{send-4qJTCAYW.cjs → send-DY9Nr-x4.cjs} +16 -9
- package/dist/server-II51Mimf.cjs +407 -0
- package/dist/server-m2b5pamZ.mjs +404 -0
- package/dist/sessionLock-7ePAYDOg.cjs +205 -0
- package/dist/sessionLock-Cw6FmbMv.mjs +197 -0
- package/dist/sessionModeFile-BVCV5f7E.cjs +36 -0
- package/dist/sessionModeFile-CDmDyRkD.mjs +32 -0
- package/dist/sessionOps-C_f1wKOr.mjs +760 -0
- package/dist/sessionOps-DJdExmBy.cjs +783 -0
- package/dist/sessionScanner-CaAHLyNV.mjs +206 -0
- package/dist/sessionScanner-D1goKdd3.cjs +209 -0
- package/dist/{sessions-Bh1pyddi.cjs → sessions-DGs6ALNo.cjs} +37 -28
- package/dist/{sessions-CzIH2rGp.mjs → sessions-DnvmWUel.mjs} +17 -8
- package/dist/setupOfflineReconnection-CVViqZft.mjs +72 -0
- package/dist/setupOfflineReconnection-R7XuR_sj.cjs +74 -0
- package/dist/smallFastModel-BLNgMrwR.mjs +18 -0
- package/dist/smallFastModel-D_uxGMo3.cjs +21 -0
- package/dist/{spawn-CmFOSVdW.cjs → spawn-CXTH7qg1.cjs} +61 -65
- package/dist/{spawn-CPIWlPOM.mjs → spawn-DNYSvFtC.mjs} +35 -40
- package/dist/spawnAgents-BGQiEF-w.cjs +52 -0
- package/dist/spawnAgents-DZzZ9jMI.mjs +45 -0
- package/dist/spawnHappyCLI-BhYj84rv.cjs +66 -0
- package/dist/spawnHappyCLI-cqWQbwsb.mjs +64 -0
- package/dist/specialCommands-BSqhYg5X.mjs +52 -0
- package/dist/specialCommands-DSsTeRej.cjs +54 -0
- package/dist/startFileWatcher-CKKx-8ZO.cjs +71 -0
- package/dist/startFileWatcher-CdegMbJj.mjs +69 -0
- package/dist/startupPlan-BLMbfQIH.cjs +12 -0
- package/dist/startupPlan-DFMyNgAs.mjs +10 -0
- package/dist/streamRelay-BiKw59Cc.cjs +233 -0
- package/dist/streamRelay-FPVbHpbM.mjs +231 -0
- package/dist/sync-CVk4QERO.cjs +71 -0
- package/dist/sync-CxD-w_40.mjs +69 -0
- package/dist/systemPrompt-BygJcmbi.cjs +97 -0
- package/dist/systemPrompt-DmtypUc7.mjs +94 -0
- package/dist/{teams-CEahj4cm.mjs → teams-BOC6nIPL.mjs} +9 -40
- package/dist/{teams-CB1R9-Z9.cjs → teams-BsvpOBfn.cjs} +14 -45
- package/dist/template-BaHAmH2K.cjs +129 -0
- package/dist/template-CiOPa2rd.mjs +121 -0
- package/dist/{terminalTitleSuggest-DKgX3osW.mjs → terminalTitleSuggest-CeKsX_V6.mjs} +1 -9
- package/dist/{terminalTitleSuggest-Dji8I0Jy.cjs → terminalTitleSuggest-DhvRFX3H.cjs} +0 -10
- package/dist/terminals-B_bfC9c2.cjs +250 -0
- package/dist/terminals-Dlg0x3nY.mjs +235 -0
- package/dist/time-BZNdNiIV.mjs +38 -0
- package/dist/time-CNRE4ChD.cjs +42 -0
- package/dist/titleGenerator-CFRhU-xq.cjs +172 -0
- package/dist/titleGenerator-ox6ptCsp.mjs +166 -0
- package/dist/tmuxSocket-B8Yx20sT.mjs +19 -0
- package/dist/tmuxSocket-D-Xt6Vn-.cjs +24 -0
- package/dist/{todo-DqyRI4wP.cjs → todo-B-KB7oAB.cjs} +15 -12
- package/dist/{todo-Cknp5D4U.mjs → todo-C5KBVbUw.mjs} +11 -8
- package/dist/tools-BZabNIid.mjs +177 -0
- package/dist/tools-BmQQUATY.mjs +60 -0
- package/dist/tools-CsSovyNp.cjs +180 -0
- package/dist/tools-lMDra4Pv.cjs +63 -0
- package/dist/trimIdent-4gvk9Wk6.cjs +22 -0
- package/dist/trimIdent-BAjmv_TG.mjs +20 -0
- package/dist/types-CRS-srZK.cjs +66 -0
- package/dist/types-CkqAACXx.mjs +64 -0
- package/dist/uninstall-B1WLtC1d.mjs +47 -0
- package/dist/uninstall-fvA5aWpU.cjs +49 -0
- package/package.json +7 -7
- package/scripts/session_hook_forwarder.cjs +9 -2
- package/dist/agentGuidance-BRDN1NoZ.cjs +0 -2217
- package/dist/agentGuidance-KgvYuF3R.mjs +0 -2145
- package/dist/index-BF6WfgV5.mjs +0 -19624
- package/dist/index-C-JazrMB.mjs +0 -52
- package/dist/index-blDSadUR.cjs +0 -58
- package/dist/index-rH3DrQ5B.cjs +0 -19688
- package/dist/limits-BH5CV5vR.cjs +0 -2683
- package/dist/limits-CjRj8IX5.mjs +0 -2558
|
@@ -4,52 +4,43 @@ var chalk = require('chalk');
|
|
|
4
4
|
var os = require('node:os');
|
|
5
5
|
var node_fs = require('node:fs');
|
|
6
6
|
var path = require('node:path');
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
7
|
+
var index = require('./index-DA7yINuk.cjs');
|
|
8
|
+
var configuration = require('./configuration-v9f8LM9T.cjs');
|
|
9
|
+
var client = require('./client-DOBWJL3u.cjs');
|
|
10
|
+
var template = require('./template-BaHAmH2K.cjs');
|
|
11
|
+
var install = require('./install-Cs5qAPrB.cjs');
|
|
12
|
+
var sessionOps = require('./sessionOps-DJdExmBy.cjs');
|
|
13
|
+
var spawn = require('./spawn-CXTH7qg1.cjs');
|
|
14
|
+
var spawnAgents = require('./spawnAgents-BGQiEF-w.cjs');
|
|
15
|
+
var time = require('./time-CNRE4ChD.cjs');
|
|
12
16
|
require('zod');
|
|
13
17
|
require('@paralleldrive/cuid2');
|
|
18
|
+
require('./package-Cl5BEP5x.cjs');
|
|
14
19
|
require('node:fs/promises');
|
|
20
|
+
require('./persistence-CBNMzSa8.cjs');
|
|
21
|
+
require('./authRelay-BdYkC1Po.cjs');
|
|
15
22
|
require('node:crypto');
|
|
16
23
|
require('tweetnacl');
|
|
24
|
+
require('./logger-Bc8-u1w0.cjs');
|
|
17
25
|
require('node:util');
|
|
26
|
+
require('./resources-JDPugcDq.cjs');
|
|
18
27
|
require('axios');
|
|
28
|
+
require('./controlClient-fEHE85bH.cjs');
|
|
19
29
|
require('socket.io-client');
|
|
20
|
-
require('./
|
|
21
|
-
require('
|
|
22
|
-
require('
|
|
23
|
-
require('util');
|
|
24
|
-
require('fs/promises');
|
|
25
|
-
require('crypto');
|
|
26
|
-
require('path');
|
|
27
|
-
require('cross-spawn');
|
|
28
|
-
require('./terminalTitleSuggest-Dji8I0Jy.cjs');
|
|
29
|
-
require('url');
|
|
30
|
-
require('os');
|
|
31
|
-
require('node:child_process');
|
|
32
|
-
require('node-pty');
|
|
33
|
-
require('fs');
|
|
30
|
+
require('./backgroundTaskActivity-CBvUdj39.cjs');
|
|
31
|
+
require('./path-B7zW-WwE.cjs');
|
|
32
|
+
require('./codexThreadFork-BZqF-9bX.cjs');
|
|
34
33
|
require('node:readline');
|
|
34
|
+
require('./codexAppServerClient-ZzhUTWPo.cjs');
|
|
35
|
+
require('node:child_process');
|
|
36
|
+
require('cross-spawn');
|
|
37
|
+
require('./contentLogMetadata-ZSFk_NjQ.cjs');
|
|
38
|
+
require('./manager-Cly8xVIR.cjs');
|
|
35
39
|
require('@anthropic-ai/sandbox-runtime');
|
|
36
|
-
require('
|
|
37
|
-
require('
|
|
38
|
-
require('
|
|
39
|
-
require('
|
|
40
|
-
require('ps-list');
|
|
41
|
-
require('tmp');
|
|
42
|
-
require('open');
|
|
43
|
-
require('fastify');
|
|
44
|
-
require('fastify-type-provider-zod');
|
|
45
|
-
require('node:module');
|
|
46
|
-
require('@modelcontextprotocol/sdk/server/mcp.js');
|
|
47
|
-
require('node:http');
|
|
48
|
-
require('@modelcontextprotocol/sdk/server/streamableHttp.js');
|
|
49
|
-
require('http');
|
|
50
|
-
require('inquirer');
|
|
51
|
-
require('node:url');
|
|
52
|
-
require('node:readline/promises');
|
|
40
|
+
require('./createSessionMetadata-BRLB9CNO.cjs');
|
|
41
|
+
require('./projectPath-ChLhdOyt.cjs');
|
|
42
|
+
require('path');
|
|
43
|
+
require('url');
|
|
53
44
|
|
|
54
45
|
const AUTO_ACTIONS = ["list", "show", "create", "edit", "pause", "resume", "rm", "run", "fire", "runs", "cancel", "ack", "report", "skill", "install", "uninstall", "help"];
|
|
55
46
|
const VALUE_FLAGS = ["--name", "--rename", "--description", "--machine", "--cron", "--tz", "--every", "--at", "--spawn-dir", "--prompt", "--prompt-file", "--agent", "--model", "--permission-mode", "--sticky-key", "--send-session", "--cwd", "--env", "--timeout", "--concurrency", "--max-runtime", "--payload", "--payload-json", "--payload-file", "--dedupe-key", "--status", "--limit", "--run", "--summary", "--error", "--attention", "--host", "--home"];
|
|
@@ -125,7 +116,7 @@ function actionFromCommand(command, current) {
|
|
|
125
116
|
if (prompt === void 0 && spawnOnly.length === 0 && scriptOnly.length === 0) return void 0;
|
|
126
117
|
if (current.kind === "script") {
|
|
127
118
|
if (prompt !== void 0 || spawnOnly.length) throw new Error(`${current.kind} actions do not take ${[...prompt !== void 0 ? ["--prompt"] : [], ...spawnOnly].join(", ")}`);
|
|
128
|
-
return { ...current, ...flags["--cwd"] !== void 0 ? { cwd: flags["--cwd"] } : {}, ...flags["--timeout"] !== void 0 ? { timeoutMs:
|
|
119
|
+
return { ...current, ...flags["--cwd"] !== void 0 ? { cwd: flags["--cwd"] } : {}, ...flags["--timeout"] !== void 0 ? { timeoutMs: template.parseDuration(flags["--timeout"]) } : {}, ...command.env.length ? { env: Object.fromEntries(command.env.map(spawn.parseEnvAssignment)) } : {} };
|
|
129
120
|
}
|
|
130
121
|
if (scriptOnly.length) throw new Error(`${current.kind} actions do not take ${scriptOnly.join(", ")}`);
|
|
131
122
|
if (current.kind === "send") {
|
|
@@ -137,7 +128,7 @@ function actionFromCommand(command, current) {
|
|
|
137
128
|
if (bools.has("--script")) {
|
|
138
129
|
if (command.argv.length === 0) throw new Error("--script needs the command after --, e.g. --script -- /usr/bin/env python3 job.py");
|
|
139
130
|
if (prompt !== void 0 || spawnOnly.length) throw new Error(`script actions do not take ${[...prompt !== void 0 ? ["--prompt"] : [], ...spawnOnly].join(", ")}`);
|
|
140
|
-
return { kind: "script", command: command.argv, ...flags["--cwd"] !== void 0 ? { cwd: flags["--cwd"] } : {}, ...flags["--timeout"] !== void 0 ? { timeoutMs:
|
|
131
|
+
return { kind: "script", command: command.argv, ...flags["--cwd"] !== void 0 ? { cwd: flags["--cwd"] } : {}, ...flags["--timeout"] !== void 0 ? { timeoutMs: template.parseDuration(flags["--timeout"]) } : {}, ...command.env.length ? { env: Object.fromEntries(command.env.map(spawn.parseEnvAssignment)) } : {} };
|
|
141
132
|
}
|
|
142
133
|
if (scriptOnly.length) throw new Error(`${flags["--send-session"] !== void 0 ? "send" : "spawn"} actions do not take ${scriptOnly.join(", ")}`);
|
|
143
134
|
if (prompt === void 0) throw new Error("--prompt or --prompt-file is required");
|
|
@@ -150,8 +141,8 @@ function actionFromCommand(command, current) {
|
|
|
150
141
|
}
|
|
151
142
|
function spawnDetails(command) {
|
|
152
143
|
const { flags, bools } = command;
|
|
153
|
-
if (flags["--agent"] !== void 0 && !
|
|
154
|
-
if (flags["--permission-mode"] !== void 0 &&
|
|
144
|
+
if (flags["--agent"] !== void 0 && !spawnAgents.SPAWN_AGENTS.includes(flags["--agent"])) throw new Error(`--agent must be one of: ${spawnAgents.SPAWN_AGENTS.join(", ")}`);
|
|
145
|
+
if (flags["--permission-mode"] !== void 0 && spawnAgents.sanitizeSpawnPermissionMode(flags["--permission-mode"]) === null) throw new Error(`--permission-mode must be one of: ${spawnAgents.ALLOWED_SPAWN_PERMISSION_MODES.join(", ")}`);
|
|
155
146
|
return {
|
|
156
147
|
...flags["--agent"] !== void 0 ? { agent: flags["--agent"] } : {},
|
|
157
148
|
...flags["--model"] !== void 0 ? { model: flags["--model"] } : {},
|
|
@@ -211,8 +202,8 @@ function fmtTime(value) {
|
|
|
211
202
|
function printAutomation(a) {
|
|
212
203
|
console.log(`${chalk.bold(a.name)} ${a.status === "paused" ? chalk.yellow("paused") : chalk.green("active")} v${a.version} ${chalk.dim(a.id)}`);
|
|
213
204
|
if (a.description) console.log(` ${a.description}`);
|
|
214
|
-
console.log(` trigger: ${
|
|
215
|
-
console.log(` action: ${
|
|
205
|
+
console.log(` trigger: ${template.describeTrigger(a.trigger)} next: ${fmtTime(a.nextRunAt)}`);
|
|
206
|
+
console.log(` action: ${template.describeAction(a.action)}`);
|
|
216
207
|
console.log(` machine: ${a.machineId} concurrency: ${a.concurrency} max runtime: ${Math.round(a.maxRuntimeMs / 6e4)}m`);
|
|
217
208
|
console.log(` last run: ${fmtTime(a.lastRunAt)} ${a.lastRunStatus ?? ""}`);
|
|
218
209
|
}
|
|
@@ -222,7 +213,7 @@ function runLine(run) {
|
|
|
222
213
|
}
|
|
223
214
|
function printRun(run) {
|
|
224
215
|
console.log(runLine(run));
|
|
225
|
-
if (run.sessionId) console.log(` session: ${
|
|
216
|
+
if (run.sessionId) console.log(` session: ${sessionOps.sessionWebUrl(run.sessionId)}`);
|
|
226
217
|
if (run.stickyKey) console.log(` sticky: ${run.stickyKey}`);
|
|
227
218
|
if (run.error) console.log(` error: ${run.error}`);
|
|
228
219
|
if (run.summary) console.log(` summary: ${run.summary.split("\n").join("\n ")}`);
|
|
@@ -232,9 +223,9 @@ async function waitForRun(client, runId, timeoutMs) {
|
|
|
232
223
|
const deadline = Date.now() + timeoutMs;
|
|
233
224
|
while (true) {
|
|
234
225
|
const run = await client.getRun(runId);
|
|
235
|
-
if (
|
|
226
|
+
if (index.isAutomationRunTerminal(run.status)) return run;
|
|
236
227
|
if (Date.now() + 3e3 > deadline) return null;
|
|
237
|
-
await
|
|
228
|
+
await time.delay(3e3);
|
|
238
229
|
}
|
|
239
230
|
}
|
|
240
231
|
async function handleAutoCommand(args) {
|
|
@@ -268,9 +259,9 @@ async function handleAutoCommand(args) {
|
|
|
268
259
|
if (needsRunId.includes(command.action) && !command.target && !(command.action === "ack" && command.bools.has("--all"))) throw new Error(`${command.action} needs a run id (or ack --all)`);
|
|
269
260
|
if (command.action === "create" && !command.flags["--name"]) throw new Error("create needs --name <name>");
|
|
270
261
|
for (const name of [command.flags["--name"], command.flags["--rename"], needsName.includes(command.action) ? command.target : void 0]) {
|
|
271
|
-
if (name !== void 0 && !
|
|
262
|
+
if (name !== void 0 && !index.AUTOMATION_NAME_PATTERN.test(name)) throw new Error(`Invalid automation name "${name}": use [a-z0-9][a-z0-9-_.]{0,63}`);
|
|
272
263
|
}
|
|
273
|
-
const { client, machineId } = await
|
|
264
|
+
const { client: client$1, machineId } = await client.authenticatedAutomationsClient();
|
|
274
265
|
const machine = (requested) => {
|
|
275
266
|
if (requested && requested !== "this") return requested;
|
|
276
267
|
if (!machineId) throw new Error("This machine is not registered with Very Happy; pass --machine <id>");
|
|
@@ -279,21 +270,21 @@ async function handleAutoCommand(args) {
|
|
|
279
270
|
try {
|
|
280
271
|
switch (command.action) {
|
|
281
272
|
case "list": {
|
|
282
|
-
const automations = await client.list(command.bools.has("--all-machines") ? void 0 : machine(command.flags["--machine"]));
|
|
273
|
+
const automations = await client$1.list(command.bools.has("--all-machines") ? void 0 : machine(command.flags["--machine"]));
|
|
283
274
|
if (json) {
|
|
284
|
-
console.log(JSON.stringify({ serverUrl:
|
|
275
|
+
console.log(JSON.stringify({ serverUrl: configuration.configuration.serverUrl, automations }));
|
|
285
276
|
return;
|
|
286
277
|
}
|
|
287
278
|
if (automations.length === 0) {
|
|
288
279
|
console.log("No automations" + (command.bools.has("--all-machines") ? "." : " on this machine (try --all-machines)."));
|
|
289
280
|
return;
|
|
290
281
|
}
|
|
291
|
-
for (const a of automations) console.log(`${(a.status === "paused" ? chalk.yellow("paused") : chalk.green("active")).padEnd(6)} ${a.name.padEnd(24)} ${
|
|
282
|
+
for (const a of automations) console.log(`${(a.status === "paused" ? chalk.yellow("paused") : chalk.green("active")).padEnd(6)} ${a.name.padEnd(24)} ${template.describeTrigger(a.trigger).padEnd(32)} next ${fmtTime(a.nextRunAt)} ${template.describeAction(a.action)}`);
|
|
292
283
|
return;
|
|
293
284
|
}
|
|
294
285
|
case "show": {
|
|
295
|
-
const automation = await client.getByName(command.target);
|
|
296
|
-
const runs = await client.runs({ automationId: automation.id, limit: 5 });
|
|
286
|
+
const automation = await client$1.getByName(command.target);
|
|
287
|
+
const runs = await client$1.runs({ automationId: automation.id, limit: 5 });
|
|
297
288
|
if (json) {
|
|
298
289
|
console.log(JSON.stringify({ automation, runs }));
|
|
299
290
|
return;
|
|
@@ -306,7 +297,7 @@ async function handleAutoCommand(args) {
|
|
|
306
297
|
return;
|
|
307
298
|
}
|
|
308
299
|
case "create": {
|
|
309
|
-
const trigger =
|
|
300
|
+
const trigger = template.triggerFromFlags({ cron: command.flags["--cron"], tz: command.flags["--tz"], every: command.flags["--every"], at: command.flags["--at"], manual: command.bools.has("--manual") });
|
|
310
301
|
if (!trigger) throw new Error("Give a trigger: --cron <expr> --tz <zone>, --every <dur>, --at <iso>, or --manual");
|
|
311
302
|
const action = actionFromCommand(command);
|
|
312
303
|
if (!action) throw new Error("Give an action: --spawn-dir <dir>, --send-session <id>, or --script -- <argv\u2026>");
|
|
@@ -317,10 +308,10 @@ async function handleAutoCommand(args) {
|
|
|
317
308
|
action,
|
|
318
309
|
...command.flags["--description"] !== void 0 ? { description: command.flags["--description"] } : {},
|
|
319
310
|
...command.flags["--concurrency"] !== void 0 ? { concurrency: concurrency(command.flags["--concurrency"]) } : {},
|
|
320
|
-
...command.flags["--max-runtime"] !== void 0 ? { maxRuntimeMs:
|
|
311
|
+
...command.flags["--max-runtime"] !== void 0 ? { maxRuntimeMs: template.parseDuration(command.flags["--max-runtime"]) } : {},
|
|
321
312
|
...command.bools.has("--paused") ? { status: "paused" } : {}
|
|
322
313
|
};
|
|
323
|
-
const automation = await client.create(input);
|
|
314
|
+
const automation = await client$1.create(input);
|
|
324
315
|
if (json) {
|
|
325
316
|
console.log(JSON.stringify({ automation }));
|
|
326
317
|
return;
|
|
@@ -330,8 +321,8 @@ async function handleAutoCommand(args) {
|
|
|
330
321
|
return;
|
|
331
322
|
}
|
|
332
323
|
case "edit": {
|
|
333
|
-
const current = await client.getByName(command.target);
|
|
334
|
-
const trigger =
|
|
324
|
+
const current = await client$1.getByName(command.target);
|
|
325
|
+
const trigger = template.triggerFromFlags({ cron: command.flags["--cron"], tz: command.flags["--tz"], every: command.flags["--every"], at: command.flags["--at"], manual: command.bools.has("--manual") });
|
|
335
326
|
const action = actionFromCommand(command, current.action);
|
|
336
327
|
const input = {
|
|
337
328
|
version: current.version,
|
|
@@ -341,10 +332,10 @@ async function handleAutoCommand(args) {
|
|
|
341
332
|
...trigger ? { trigger } : {},
|
|
342
333
|
...action ? { action } : {},
|
|
343
334
|
...command.flags["--concurrency"] !== void 0 ? { concurrency: concurrency(command.flags["--concurrency"]) } : {},
|
|
344
|
-
...command.flags["--max-runtime"] !== void 0 ? { maxRuntimeMs:
|
|
335
|
+
...command.flags["--max-runtime"] !== void 0 ? { maxRuntimeMs: template.parseDuration(command.flags["--max-runtime"]) } : {}
|
|
345
336
|
};
|
|
346
337
|
if (Object.keys(input).length === 1) throw new Error("Nothing to change");
|
|
347
|
-
const automation = await client.update(current.id, input);
|
|
338
|
+
const automation = await client$1.update(current.id, input);
|
|
348
339
|
if (json) {
|
|
349
340
|
console.log(JSON.stringify({ automation }));
|
|
350
341
|
return;
|
|
@@ -355,8 +346,8 @@ async function handleAutoCommand(args) {
|
|
|
355
346
|
}
|
|
356
347
|
case "pause":
|
|
357
348
|
case "resume": {
|
|
358
|
-
const current = await client.getByName(command.target);
|
|
359
|
-
const automation = command.action === "pause" ? await client.pause(current.id) : await client.resume(current.id);
|
|
349
|
+
const current = await client$1.getByName(command.target);
|
|
350
|
+
const automation = command.action === "pause" ? await client$1.pause(current.id) : await client$1.resume(current.id);
|
|
360
351
|
if (json) {
|
|
361
352
|
console.log(JSON.stringify({ automation }));
|
|
362
353
|
return;
|
|
@@ -365,8 +356,8 @@ async function handleAutoCommand(args) {
|
|
|
365
356
|
return;
|
|
366
357
|
}
|
|
367
358
|
case "rm": {
|
|
368
|
-
const current = await client.getByName(command.target);
|
|
369
|
-
await client.remove(current.id);
|
|
359
|
+
const current = await client$1.getByName(command.target);
|
|
360
|
+
await client$1.remove(current.id);
|
|
370
361
|
if (json) {
|
|
371
362
|
console.log(JSON.stringify({ deleted: true, id: current.id, name: current.name }));
|
|
372
363
|
return;
|
|
@@ -380,19 +371,19 @@ async function handleAutoCommand(args) {
|
|
|
380
371
|
let run;
|
|
381
372
|
let deduplicated = false;
|
|
382
373
|
if (command.action === "fire") {
|
|
383
|
-
const fired = await client.fire(command.target, { ...payload !== void 0 ? { payload } : {}, ...command.flags["--dedupe-key"] !== void 0 ? { dedupeKey: command.flags["--dedupe-key"] } : {} });
|
|
374
|
+
const fired = await client$1.fire(command.target, { ...payload !== void 0 ? { payload } : {}, ...command.flags["--dedupe-key"] !== void 0 ? { dedupeKey: command.flags["--dedupe-key"] } : {} });
|
|
384
375
|
run = fired.run;
|
|
385
376
|
deduplicated = fired.deduplicated;
|
|
386
377
|
} else {
|
|
387
378
|
if (command.flags["--dedupe-key"] !== void 0) throw new Error("--dedupe-key only applies to fire");
|
|
388
|
-
run = await client.run((await client.getByName(command.target)).id, payload !== void 0 ? { payload } : {});
|
|
379
|
+
run = await client$1.run((await client$1.getByName(command.target)).id, payload !== void 0 ? { payload } : {});
|
|
389
380
|
}
|
|
390
381
|
if (!json) {
|
|
391
382
|
console.log(`${deduplicated ? "Existing run" : "Run"} ${run.id}: ${run.status}`);
|
|
392
383
|
}
|
|
393
|
-
if (command.bools.has("--wait") && !
|
|
394
|
-
const timeoutMs = command.flags["--timeout"] !== void 0 ?
|
|
395
|
-
const final = await waitForRun(client, run.id, timeoutMs);
|
|
384
|
+
if (command.bools.has("--wait") && !index.isAutomationRunTerminal(run.status)) {
|
|
385
|
+
const timeoutMs = command.flags["--timeout"] !== void 0 ? template.parseDuration(command.flags["--timeout"]) : 6e5;
|
|
386
|
+
const final = await waitForRun(client$1, run.id, timeoutMs);
|
|
396
387
|
if (!final) {
|
|
397
388
|
if (json) console.log(JSON.stringify({ run, deduplicated, timedOut: true }));
|
|
398
389
|
else console.error(chalk.yellow(`Run ${run.id} did not finish within ${Math.round(timeoutMs / 1e3)}s (it may still complete).`));
|
|
@@ -403,21 +394,21 @@ async function handleAutoCommand(args) {
|
|
|
403
394
|
}
|
|
404
395
|
if (json) {
|
|
405
396
|
console.log(JSON.stringify({ run, deduplicated }));
|
|
406
|
-
} else if (command.bools.has("--wait") ||
|
|
407
|
-
else if (run.sessionId) console.log(` session: ${
|
|
408
|
-
if (
|
|
397
|
+
} else if (command.bools.has("--wait") || index.isAutomationRunTerminal(run.status)) printRun(run);
|
|
398
|
+
else if (run.sessionId) console.log(` session: ${sessionOps.sessionWebUrl(run.sessionId)}`);
|
|
399
|
+
if (index.isAutomationRunTerminal(run.status) && run.status !== "done") process.exitCode = 3;
|
|
409
400
|
return;
|
|
410
401
|
}
|
|
411
402
|
case "runs": {
|
|
412
403
|
if (command.target) {
|
|
413
|
-
const run = await client.getRun(command.target);
|
|
404
|
+
const run = await client$1.getRun(command.target);
|
|
414
405
|
if (json) console.log(JSON.stringify({ run }));
|
|
415
406
|
else printRun(run);
|
|
416
407
|
return;
|
|
417
408
|
}
|
|
418
409
|
const limit = command.flags["--limit"] !== void 0 ? Number(command.flags["--limit"]) : void 0;
|
|
419
410
|
if (limit !== void 0 && !(Number.isInteger(limit) && limit > 0)) throw new Error("--limit must be a positive integer");
|
|
420
|
-
const runs = await client.runs({ name: command.flags["--name"], status: command.flags["--status"], attention: command.bools.has("--attention"), limit });
|
|
411
|
+
const runs = await client$1.runs({ name: command.flags["--name"], status: command.flags["--status"], attention: command.bools.has("--attention"), limit });
|
|
421
412
|
if (json) {
|
|
422
413
|
console.log(JSON.stringify({ runs }));
|
|
423
414
|
return;
|
|
@@ -433,20 +424,20 @@ async function handleAutoCommand(args) {
|
|
|
433
424
|
case "ack": {
|
|
434
425
|
if (command.action === "ack" && command.bools.has("--all")) {
|
|
435
426
|
if (command.target) throw new Error("ack --all takes no run id (use --name to limit to one automation)");
|
|
436
|
-
const flagged = await client.runs({ name: command.flags["--name"], attention: true, limit: 200 });
|
|
427
|
+
const flagged = await client$1.runs({ name: command.flags["--name"], attention: true, limit: 200 });
|
|
437
428
|
const runs = [];
|
|
438
|
-
for (const run2 of flagged) runs.push(await client.ack(run2.id, "owner"));
|
|
429
|
+
for (const run2 of flagged) runs.push(await client$1.ack(run2.id, "owner"));
|
|
439
430
|
if (json) console.log(JSON.stringify({ acked: runs.length, runs }));
|
|
440
431
|
else console.log(runs.length === 0 ? "Nothing needs your decision." : `Acknowledged ${runs.length} run(s).`);
|
|
441
432
|
return;
|
|
442
433
|
}
|
|
443
|
-
const run = command.action === "cancel" ? await client.cancel(command.target) : await client.ack(command.target, "owner");
|
|
434
|
+
const run = command.action === "cancel" ? await client$1.cancel(command.target) : await client$1.ack(command.target, "owner");
|
|
444
435
|
if (json) console.log(JSON.stringify({ run }));
|
|
445
436
|
else printRun(run);
|
|
446
437
|
return;
|
|
447
438
|
}
|
|
448
439
|
case "report": {
|
|
449
|
-
const runId = command.flags["--run"] ??
|
|
440
|
+
const runId = command.flags["--run"] ?? client.automationRunIdFromEnv();
|
|
450
441
|
if (!runId) throw new Error("--run <id> is required outside an automation-started session (VH_AUTOMATION_RUN_ID is not set)");
|
|
451
442
|
const status = command.flags["--status"];
|
|
452
443
|
if (status !== "done" && status !== "failed") throw new Error("--status must be done or failed");
|
|
@@ -456,7 +447,7 @@ async function handleAutoCommand(args) {
|
|
|
456
447
|
...command.flags["--error"] !== void 0 ? { error: command.flags["--error"] } : {},
|
|
457
448
|
...command.flags["--attention"] !== void 0 ? { needsAttention: true, attentionReason: command.flags["--attention"] } : {}
|
|
458
449
|
};
|
|
459
|
-
const run = await client.report(runId, report);
|
|
450
|
+
const run = await client$1.report(runId, report);
|
|
460
451
|
if (json) console.log(JSON.stringify({ run }));
|
|
461
452
|
else printRun(run);
|
|
462
453
|
return;
|
|
@@ -465,7 +456,7 @@ async function handleAutoCommand(args) {
|
|
|
465
456
|
throw new Error(`Unhandled auto command: ${command.action}`);
|
|
466
457
|
}
|
|
467
458
|
} catch (error) {
|
|
468
|
-
if (
|
|
459
|
+
if (client.isAutomationsUnavailable(error)) throw new Error(client.AUTOMATIONS_UNAVAILABLE_MESSAGE);
|
|
469
460
|
throw error;
|
|
470
461
|
}
|
|
471
462
|
}
|
|
@@ -2,52 +2,43 @@ import chalk from 'chalk';
|
|
|
2
2
|
import { homedir } from 'node:os';
|
|
3
3
|
import { readFileSync } from 'node:fs';
|
|
4
4
|
import { resolve } from 'node:path';
|
|
5
|
-
import { A as AUTOMATION_NAME_PATTERN,
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
5
|
+
import { A as AUTOMATION_NAME_PATTERN, i as isAutomationRunTerminal } from './index-qdS1friN.mjs';
|
|
6
|
+
import { c as configuration } from './configuration-DoWFJUPm.mjs';
|
|
7
|
+
import { a as authenticatedAutomationsClient, b as automationRunIdFromEnv, i as isAutomationsUnavailable, A as AUTOMATIONS_UNAVAILABLE_MESSAGE } from './client-CXb1VJui.mjs';
|
|
8
|
+
import { p as parseDuration, t as triggerFromFlags, d as describeTrigger, a as describeAction } from './template-CiOPa2rd.mjs';
|
|
9
|
+
import { A as AUTOMATION_SKILL, i as installAutomationSkill } from './install-BO_W7VhL.mjs';
|
|
10
|
+
import { s as sessionWebUrl } from './sessionOps-C_f1wKOr.mjs';
|
|
11
|
+
import { parseEnvAssignment } from './spawn-DNYSvFtC.mjs';
|
|
12
|
+
import { S as SPAWN_AGENTS, s as sanitizeSpawnPermissionMode, A as ALLOWED_SPAWN_PERMISSION_MODES } from './spawnAgents-DZzZ9jMI.mjs';
|
|
13
|
+
import { d as delay } from './time-BZNdNiIV.mjs';
|
|
10
14
|
import 'zod';
|
|
11
15
|
import '@paralleldrive/cuid2';
|
|
16
|
+
import './package-uOg9SCKi.mjs';
|
|
12
17
|
import 'node:fs/promises';
|
|
18
|
+
import './persistence-oET5n61f.mjs';
|
|
19
|
+
import './authRelay-DSAvg1uv.mjs';
|
|
13
20
|
import 'node:crypto';
|
|
14
21
|
import 'tweetnacl';
|
|
22
|
+
import './logger-fXoNzNuB.mjs';
|
|
15
23
|
import 'node:util';
|
|
24
|
+
import './resources-BdFBQi8r.mjs';
|
|
16
25
|
import 'axios';
|
|
26
|
+
import './controlClient-DjoKTtgK.mjs';
|
|
17
27
|
import 'socket.io-client';
|
|
18
|
-
import './
|
|
19
|
-
import '
|
|
20
|
-
import '
|
|
21
|
-
import 'util';
|
|
22
|
-
import 'fs/promises';
|
|
23
|
-
import 'crypto';
|
|
24
|
-
import 'path';
|
|
25
|
-
import 'cross-spawn';
|
|
26
|
-
import './terminalTitleSuggest-DKgX3osW.mjs';
|
|
27
|
-
import 'url';
|
|
28
|
-
import 'os';
|
|
29
|
-
import 'node:child_process';
|
|
30
|
-
import 'node-pty';
|
|
31
|
-
import 'fs';
|
|
28
|
+
import './backgroundTaskActivity-8PdPxrvy.mjs';
|
|
29
|
+
import './path-D2wdaNSk.mjs';
|
|
30
|
+
import './codexThreadFork-BCaEMBiM.mjs';
|
|
32
31
|
import 'node:readline';
|
|
32
|
+
import './codexAppServerClient-oeQKD6Qf.mjs';
|
|
33
|
+
import 'node:child_process';
|
|
34
|
+
import 'cross-spawn';
|
|
35
|
+
import './contentLogMetadata-BlWI0egu.mjs';
|
|
36
|
+
import './manager-BQ4flvQZ.mjs';
|
|
33
37
|
import '@anthropic-ai/sandbox-runtime';
|
|
34
|
-
import '
|
|
35
|
-
import '
|
|
36
|
-
import '
|
|
37
|
-
import '
|
|
38
|
-
import 'ps-list';
|
|
39
|
-
import 'tmp';
|
|
40
|
-
import 'open';
|
|
41
|
-
import 'fastify';
|
|
42
|
-
import 'fastify-type-provider-zod';
|
|
43
|
-
import 'node:module';
|
|
44
|
-
import '@modelcontextprotocol/sdk/server/mcp.js';
|
|
45
|
-
import 'node:http';
|
|
46
|
-
import '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
47
|
-
import 'http';
|
|
48
|
-
import 'inquirer';
|
|
49
|
-
import 'node:url';
|
|
50
|
-
import 'node:readline/promises';
|
|
38
|
+
import './createSessionMetadata-mIeehclp.mjs';
|
|
39
|
+
import './projectPath-BTBIMB57.mjs';
|
|
40
|
+
import 'path';
|
|
41
|
+
import 'url';
|
|
51
42
|
|
|
52
43
|
const AUTO_ACTIONS = ["list", "show", "create", "edit", "pause", "resume", "rm", "run", "fire", "runs", "cancel", "ack", "report", "skill", "install", "uninstall", "help"];
|
|
53
44
|
const VALUE_FLAGS = ["--name", "--rename", "--description", "--machine", "--cron", "--tz", "--every", "--at", "--spawn-dir", "--prompt", "--prompt-file", "--agent", "--model", "--permission-mode", "--sticky-key", "--send-session", "--cwd", "--env", "--timeout", "--concurrency", "--max-runtime", "--payload", "--payload-json", "--payload-file", "--dedupe-key", "--status", "--limit", "--run", "--summary", "--error", "--attention", "--host", "--home"];
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
const BACKGROUND_TASKS_MAX = 50;
|
|
2
|
+
const BACKGROUND_TASK_DESCRIPTION_MAX = 200;
|
|
3
|
+
const text = (value) => typeof value === "string" && value.length > 0 && !value.includes("\0") ? value : null;
|
|
4
|
+
const clip = (value) => value.length <= BACKGROUND_TASK_DESCRIPTION_MAX ? value : `${value.slice(0, BACKGROUND_TASK_DESCRIPTION_MAX - 1)}\u2026`;
|
|
5
|
+
const SETTLED_STATUSES = /* @__PURE__ */ new Set(["completed", "failed", "killed"]);
|
|
6
|
+
function sameBackgroundTasks(a, b) {
|
|
7
|
+
if (a.length !== b.length) return false;
|
|
8
|
+
const byId = new Map(a.map((task) => [task.id, task]));
|
|
9
|
+
for (const task of b) {
|
|
10
|
+
const other = byId.get(task.id);
|
|
11
|
+
if (!other || other.description !== task.description || other.type !== task.type) return false;
|
|
12
|
+
}
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
function createBackgroundTaskTracker() {
|
|
16
|
+
const background = /* @__PURE__ */ new Map();
|
|
17
|
+
const known = /* @__PURE__ */ new Map();
|
|
18
|
+
const add = (id, now, meta) => {
|
|
19
|
+
const existing = background.get(id);
|
|
20
|
+
const seen = known.get(id);
|
|
21
|
+
background.set(id, {
|
|
22
|
+
id,
|
|
23
|
+
type: meta?.type ?? existing?.type ?? seen?.type ?? "unknown",
|
|
24
|
+
description: clip(meta?.description ?? existing?.description ?? seen?.description ?? ""),
|
|
25
|
+
startedAt: existing?.startedAt ?? now
|
|
26
|
+
});
|
|
27
|
+
if (background.size > BACKGROUND_TASKS_MAX) background.delete(background.keys().next().value);
|
|
28
|
+
};
|
|
29
|
+
function observe(message, now = Date.now()) {
|
|
30
|
+
const m = message;
|
|
31
|
+
if (m.type === "system") {
|
|
32
|
+
if (m.subtype === "background_tasks_changed" && Array.isArray(m.tasks)) {
|
|
33
|
+
const next = /* @__PURE__ */ new Set();
|
|
34
|
+
for (const task of m.tasks) {
|
|
35
|
+
const id2 = text(task?.task_id);
|
|
36
|
+
if (!id2 || task.ambient === true) continue;
|
|
37
|
+
next.add(id2);
|
|
38
|
+
add(id2, now, { type: text(task.task_type) ?? void 0, description: text(task.description) ?? void 0 });
|
|
39
|
+
}
|
|
40
|
+
for (const id2 of [...background.keys()]) if (!next.has(id2)) background.delete(id2);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const id = text(m.task_id);
|
|
44
|
+
if (!id) return;
|
|
45
|
+
if (m.subtype === "task_started") {
|
|
46
|
+
if (m.ambient === true || m.skip_transcript === true) return;
|
|
47
|
+
const meta = { id, type: text(m.task_type) ?? "unknown", description: clip(text(m.description) ?? ""), toolUseId: text(m.tool_use_id) };
|
|
48
|
+
known.set(id, meta);
|
|
49
|
+
if (known.size > BACKGROUND_TASKS_MAX * 4) known.delete(known.keys().next().value);
|
|
50
|
+
if (m.is_backgrounded === true) add(id, now, meta);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (m.subtype === "task_updated" && m.patch && typeof m.patch === "object") {
|
|
54
|
+
if (SETTLED_STATUSES.has(String(m.patch.status))) {
|
|
55
|
+
background.delete(id);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (m.patch.is_backgrounded === true) add(id, now, { description: text(m.patch.description) ?? void 0 });
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (m.subtype === "task_notification") {
|
|
62
|
+
background.delete(id);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (m.type === "user" && m.tool_use_result && typeof m.tool_use_result === "object" && m.tool_use_result.status === "async_launched" && Array.isArray(m.message?.content)) {
|
|
68
|
+
for (const block of m.message.content) {
|
|
69
|
+
const toolUseId = block?.type === "tool_result" ? text(block.tool_use_id) : null;
|
|
70
|
+
if (!toolUseId) continue;
|
|
71
|
+
for (const seen of known.values()) if (seen.toolUseId === toolUseId) add(seen.id, now, seen);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function reset() {
|
|
76
|
+
background.clear();
|
|
77
|
+
known.clear();
|
|
78
|
+
}
|
|
79
|
+
function list() {
|
|
80
|
+
return [...background.values()].sort((a, b) => a.startedAt - b.startedAt).map((task) => ({ ...task }));
|
|
81
|
+
}
|
|
82
|
+
return { observe, reset, list };
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const BACKGROUND_TASKS_LEASE_MS = 6e4;
|
|
86
|
+
const BACKGROUND_TASKS_TTL_MS = 15e4;
|
|
87
|
+
const EMPTY_BACKGROUND_TASKS = Object.freeze({ count: 0, tasks: [] });
|
|
88
|
+
function backgroundTasksReport(stored, now, options = {}) {
|
|
89
|
+
const tasks = Array.isArray(stored?.tasks) ? stored.tasks.filter((task) => task && typeof task.id === "string") : [];
|
|
90
|
+
const reportedAt = typeof stored?.updatedAt === "number" ? stored.updatedAt : void 0;
|
|
91
|
+
if (tasks.length === 0) return reportedAt === void 0 ? { ...EMPTY_BACKGROUND_TASKS, tasks: [] } : { count: 0, tasks: [], reportedAt };
|
|
92
|
+
const fresh = options.active !== false && reportedAt !== void 0 && now - reportedAt <= (options.ttlMs ?? BACKGROUND_TASKS_TTL_MS);
|
|
93
|
+
if (!fresh) return { count: 0, tasks: [], ...reportedAt !== void 0 ? { reportedAt } : {}, stale: true };
|
|
94
|
+
return { count: tasks.length, tasks: tasks.map((task) => ({ ...task })), reportedAt };
|
|
95
|
+
}
|
|
96
|
+
class BackgroundTaskReporter {
|
|
97
|
+
constructor(publish, leaseMs = BACKGROUND_TASKS_LEASE_MS) {
|
|
98
|
+
this.publish = publish;
|
|
99
|
+
this.leaseMs = leaseMs;
|
|
100
|
+
}
|
|
101
|
+
last = [];
|
|
102
|
+
lastPublishedAt = 0;
|
|
103
|
+
/** Called on every keepAlive tick with the current set; publishes only on an edge or a due renewal. */
|
|
104
|
+
observe(tasks, now = Date.now()) {
|
|
105
|
+
const changed = !sameBackgroundTasks(this.last, tasks);
|
|
106
|
+
const due = tasks.length > 0 && now - this.lastPublishedAt >= this.leaseMs;
|
|
107
|
+
if (!changed && !due) return false;
|
|
108
|
+
this.last = tasks.map((task) => ({ ...task }));
|
|
109
|
+
this.lastPublishedAt = now;
|
|
110
|
+
this.publish(this.last, now);
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
current() {
|
|
114
|
+
return this.last;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
class BackgroundTaskTracker {
|
|
118
|
+
constructor(ttlMs = BACKGROUND_TASKS_TTL_MS) {
|
|
119
|
+
this.ttlMs = ttlMs;
|
|
120
|
+
}
|
|
121
|
+
sets = /* @__PURE__ */ new Map();
|
|
122
|
+
apply(sessionId, tasks, now = Date.now()) {
|
|
123
|
+
if (tasks.length === 0) this.sets.delete(sessionId);
|
|
124
|
+
else this.sets.set(sessionId, { at: now, tasks: tasks.map((task) => ({ ...task })) });
|
|
125
|
+
}
|
|
126
|
+
/** The wrapper is gone: whatever it reported no longer holds. */
|
|
127
|
+
forget(sessionId) {
|
|
128
|
+
this.sets.delete(sessionId);
|
|
129
|
+
}
|
|
130
|
+
report(sessionId, now = Date.now()) {
|
|
131
|
+
const entry = this.sets.get(sessionId);
|
|
132
|
+
if (!entry) return { ...EMPTY_BACKGROUND_TASKS, tasks: [] };
|
|
133
|
+
const out = backgroundTasksReport({ updatedAt: entry.at, tasks: entry.tasks }, now, { ttlMs: this.ttlMs });
|
|
134
|
+
if (out.stale) this.sets.delete(sessionId);
|
|
135
|
+
return out;
|
|
136
|
+
}
|
|
137
|
+
count(sessionId, now = Date.now()) {
|
|
138
|
+
return this.report(sessionId, now).count;
|
|
139
|
+
}
|
|
140
|
+
/** Sessions whose published set is still inside the TTL. */
|
|
141
|
+
activeSessions(now = Date.now()) {
|
|
142
|
+
return [...this.sets.keys()].filter((id) => this.count(id, now) > 0);
|
|
143
|
+
}
|
|
144
|
+
hasAny(now = Date.now()) {
|
|
145
|
+
return this.activeSessions(now).length > 0;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export { BackgroundTaskReporter as B, BACKGROUND_TASKS_MAX as a, backgroundTasksReport as b, createBackgroundTaskTracker as c, BACKGROUND_TASK_DESCRIPTION_MAX as d, BackgroundTaskTracker as e, sameBackgroundTasks as s };
|