very-happy-cli 0.2.158 → 0.2.160
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-DIDRig5G.cjs → AcpBackend-Bm2rdke8.cjs} +78 -76
- package/dist/{AcpBackend-vDVLHuYJ.mjs → AcpBackend-mzv8Dhba.mjs} +4 -2
- package/dist/{AcpSessionManager-C44U99CC.cjs → AcpSessionManager-BAY1Pggx.cjs} +9 -9
- package/dist/{AcpSessionManager-CmRjfhn3.mjs → AcpSessionManager-CoMWFVw3.mjs} +1 -1
- package/dist/BasePermissionHandler-CFHAxumV.cjs +157 -0
- package/dist/BasePermissionHandler-m3WVholL.mjs +155 -0
- package/dist/BaseReasoningProcessor-BFa9_rZA.cjs +200 -0
- package/dist/BaseReasoningProcessor-CYrKBXGm.mjs +198 -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-Dw8Jx_CJ.cjs → agentHome-CboCeKWq.cjs} +14 -28
- package/dist/{agentHome-CyLmGH5L.mjs → agentHome-Dj1C43aJ.mjs} +8 -22
- package/dist/api-CLMUr-SX.mjs +3339 -0
- package/dist/api-CgundNNX.cjs +3346 -0
- package/dist/{types-DIBF4U0Y.mjs → apiMachine-B9dLW_p5.mjs} +9116 -16015
- package/dist/{types-DnrPeN80.cjs → apiMachine-Bn8482VM.cjs} +9104 -16057
- package/dist/assistantTools-BTqPnlFl.cjs +380 -0
- package/dist/assistantTools-D6tuc6o4.mjs +376 -0
- package/dist/attachmentContent-DpiTJZb4.cjs +88 -0
- package/dist/attachmentContent-_kxRznNf.mjs +82 -0
- package/dist/attachmentLimits-CzVrqgLR.cjs +354 -0
- package/dist/attachmentLimits-yba1uHFO.mjs +348 -0
- package/dist/auth-BDOVh5h5.cjs +220 -0
- package/dist/auth-Cwutmdsa.mjs +225 -0
- package/dist/auth-PYHZQNPp.mjs +218 -0
- package/dist/auth-ba4WMYrN.cjs +227 -0
- package/dist/authRelay-BdYkC1Po.cjs +156 -0
- package/dist/authRelay-DSAvg1uv.mjs +143 -0
- package/dist/{auto-DZbNcTXx.cjs → auto-BOX_fgmR.cjs} +70 -79
- package/dist/{auto-BlMZPwOk.mjs → auto-BXu14yP_.mjs} +27 -36
- package/dist/backgroundTaskActivity-8PdPxrvy.mjs +149 -0
- package/dist/backgroundTaskActivity-CBvUdj39.cjs +157 -0
- package/dist/bootstrap-B5G1TijC.cjs +116 -0
- package/dist/bootstrap-hxXPCFMx.mjs +112 -0
- package/dist/browser-Y6Bl8L_O.cjs +22 -0
- package/dist/browser-jh2P0UVZ.mjs +20 -0
- package/dist/claudeCliPath-BqkaH2oR.mjs +8 -0
- package/dist/claudeCliPath-U4HHmV4r.cjs +10 -0
- package/dist/claudeLocal-BaY4fZKi.mjs +339 -0
- package/dist/claudeLocal-CRGG4Pea.cjs +343 -0
- package/dist/claudeLocalLauncher-D4T7MTqd.mjs +152 -0
- package/dist/claudeLocalLauncher-DyEbVzUN.cjs +154 -0
- package/dist/cliUpdate-DsKXPFYp.cjs +120 -0
- package/dist/cliUpdate-Y34VGe9Y.mjs +112 -0
- package/dist/client-3Ac-O4pw.cjs +104 -0
- package/dist/client-BPNbmtvO.cjs +119 -0
- package/dist/client-CeGKqqcJ.mjs +100 -0
- package/dist/client-ClR0K8zX.mjs +112 -0
- package/dist/codex/happyMcpStdioBridge.cjs +33 -14
- package/dist/codex/happyMcpStdioBridge.mjs +26 -7
- package/dist/codexAppServerClient-I3teiV-N.mjs +1088 -0
- package/dist/codexAppServerClient-q2FjnRcK.cjs +1090 -0
- package/dist/codexCommand-4zcccIoq.cjs +2088 -0
- package/dist/codexCommand-Cc9gcbdX.mjs +2086 -0
- package/dist/codexThreadFork-BH9IZPqD.cjs +350 -0
- package/dist/codexThreadFork-slzAseLx.mjs +338 -0
- package/dist/{config-BtPArqRH.mjs → config-CTx_jb-C.mjs} +7 -40
- package/dist/{config-DG84bjwF.cjs → config-Ci9Kpgwa.cjs} +26 -59
- package/dist/configuration-BSYpcPwE.cjs +181 -0
- package/dist/configuration-RfeNjFmd.mjs +170 -0
- package/dist/connect-BpOdzNbE.mjs +682 -0
- package/dist/connect-C2CiOUFs.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-DsDr6E2t.cjs +69 -0
- package/dist/context-H0Bcb9S_.mjs +65 -0
- package/dist/controlClient-BGbDcgWS.mjs +260 -0
- package/dist/controlClient-Bcwv3D21.cjs +279 -0
- package/dist/createSessionMetadata-BJxEnM-o.cjs +58 -0
- package/dist/createSessionMetadata-CVVkGjxV.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-C5CYTVpm.cjs +507 -0
- package/dist/deterministicJson-CzkFJWw1.mjs +502 -0
- package/dist/doctor-BPkYWSuq.mjs +75 -0
- package/dist/doctor-D2YJ-Yn2.cjs +395 -0
- package/dist/doctor-DOvByjbk.mjs +391 -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-BCwNrMyv.cjs +64 -0
- package/dist/ensureDaemonRunning-Dqa2pOjY.mjs +61 -0
- package/dist/handleResumeCommand-BvXYf5El.mjs +240 -0
- package/dist/handleResumeCommand-C2cKchpX.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-DPCsWlWK.cjs → index-B6pAdvJx.cjs} +131 -91
- package/dist/index-Bu5Zi_a9.cjs +182 -0
- package/dist/index-D3kI0hDR.cjs +107 -0
- package/dist/index-DA7yINuk.cjs +994 -0
- package/dist/index-DDeHXrIX.cjs +71 -0
- package/dist/index-DKLU_fD0.mjs +158 -0
- package/dist/{index-ZChGsuB7.mjs → index-DMZqWwsP.mjs} +79 -39
- package/dist/index-DVkMGPyS.mjs +68 -0
- package/dist/index-qdS1friN.mjs +949 -0
- package/dist/index.cjs +5 -46
- package/dist/index.mjs +5 -46
- package/dist/{install-DarS_Wco.mjs → install-BO_W7VhL.mjs} +37 -37
- package/dist/install-BgoC2e_2.cjs +88 -0
- package/dist/install-CFY3tYtJ.mjs +86 -0
- package/dist/{install-wKQGgXvN.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-DcQfee_O.cjs → installTerminalHooks-BQZbvxsZ.cjs} +5 -40
- package/dist/{installTerminalHooks-CpNbRFPz.mjs → installTerminalHooks-By7gBMEF.mjs} +3 -38
- package/dist/lib.cjs +28 -19
- package/dist/lib.d.cts +126 -2
- package/dist/lib.d.mts +126 -2
- package/dist/lib.mjs +23 -14
- package/dist/lidState-BeDfxxEX.cjs +305 -0
- package/dist/lidState-CeEt442o.mjs +297 -0
- package/dist/limits-C-a7gr04.cjs +43 -0
- package/dist/limits-DIo7rEBR.mjs +36 -0
- package/dist/localHappyAgentAuth-C-HQyiv6.mjs +82 -0
- package/dist/localHappyAgentAuth-D6rFhaoc.cjs +86 -0
- package/dist/logger-6HYUEXNk.mjs +271 -0
- package/dist/logger-CS0mw3fa.cjs +275 -0
- package/dist/loginShellEnv-BkuYtExZ.cjs +182 -0
- package/dist/loginShellEnv-Dw8M7tkI.mjs +167 -0
- package/dist/machineMetadata-DyDbODYd.cjs +41 -0
- package/dist/machineMetadata-oOzBfDfs.mjs +38 -0
- package/dist/main-BkxJP6JQ.cjs +941 -0
- package/dist/main-BwNIAI1A.mjs +939 -0
- package/dist/manager-BQ4flvQZ.mjs +101 -0
- package/dist/manager-Cly8xVIR.cjs +105 -0
- package/dist/{mcp-BN6bKIGb.mjs → mcp-B1A4I3TK.mjs} +27 -33
- package/dist/{mcp-DGdeUUDJ.cjs → mcp-Hszd7qpS.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-BhaKlnxz.mjs +171 -0
- package/dist/package-BwMrPwqH.cjs +173 -0
- package/dist/path-B7zW-WwE.cjs +18 -0
- package/dist/path-D2wdaNSk.mjs +15 -0
- package/dist/peerTools-BTqw97Gb.mjs +272 -0
- package/dist/peerTools-BvKtHXj8.cjs +283 -0
- package/dist/permissionMode-Cr5JCbB7.mjs +80 -0
- package/dist/permissionMode-CrV-XuMs.cjs +87 -0
- package/dist/persistence-HGW_ZVs9.mjs +372 -0
- package/dist/persistence-yKTH3-5X.cjs +414 -0
- package/dist/piExtension.mjs +2 -1
- package/dist/piRunnerArgs-BNloJCCg.cjs +66 -0
- package/dist/piRunnerArgs-BuX1UFWy.mjs +59 -0
- package/dist/{piRuntime-bkw2NAZU.mjs → piRuntime-CSGkwCKQ.mjs} +2 -2
- package/dist/{piRuntime-3qtbKujX.cjs → piRuntime-C_H7MJCM.cjs} +4 -4
- package/dist/{piTerminal-DilKwM7B.mjs → piTerminal-C8a1OrNQ.mjs} +32 -35
- package/dist/{piTerminal-BYxp3LMr.cjs → piTerminal-DNCZ6yTM.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-Ccvsz7Ou.mjs +536 -0
- package/dist/registerCommonHandlers-DskirN-_.cjs +538 -0
- package/dist/registerKillSessionHandler-DZeLXWcB.cjs +361 -0
- package/dist/registerKillSessionHandler-GYvHdipX.mjs +358 -0
- package/dist/remoteSessionClient-B0LraSB9.cjs +634 -0
- package/dist/remoteSessionClient-CYnXRynE.mjs +612 -0
- package/dist/resources-BdFBQi8r.mjs +117 -0
- package/dist/resources-JDPugcDq.cjs +120 -0
- package/dist/run-CJzxoHVh.cjs +5762 -0
- package/dist/run-D3ifupU3.mjs +5739 -0
- package/dist/runClaude-Ba01qT-u.mjs +848 -0
- package/dist/runClaude-Da3RirzE.cjs +850 -0
- package/dist/runClaudeDeps-DOt79DjU.mjs +3624 -0
- package/dist/runClaudeDeps-DOzEBMls.cjs +3649 -0
- package/dist/{runGemini-Cjii069p.mjs → runGemini-BGeTz57m.mjs} +58 -31
- package/dist/{runGemini-28O2sqyI.cjs → runGemini-DSr9LIxL.cjs} +202 -175
- package/dist/{runOpenClaw-CiMZad-H.cjs → runOpenClaw-B1mTxN35.cjs} +64 -65
- package/dist/{runOpenClaw-jaLr7KF1.mjs → runOpenClaw-CogSedIc.mjs} +31 -32
- package/dist/sandbox-CG7IyDTU.cjs +187 -0
- package/dist/sandbox-DTe6d54R.mjs +180 -0
- package/dist/selfCheck-C9mVrQwf.mjs +84 -0
- package/dist/selfCheck-Dc-mNSLb.cjs +87 -0
- package/dist/{send-D5ejHPXG.cjs → send-B7J_eaG3.cjs} +16 -9
- package/dist/{send-C9mOtChi.mjs → send-CBXJKc6O.mjs} +12 -5
- package/dist/server-CZTP_iOn.cjs +407 -0
- package/dist/server-DcVBv04l.mjs +404 -0
- package/dist/sessionLock-Bys1PNSo.cjs +205 -0
- package/dist/sessionLock-D-EG2CfG.mjs +197 -0
- package/dist/sessionModeFile-DMl3dw3r.mjs +32 -0
- package/dist/sessionModeFile-RSm0NQkH.cjs +36 -0
- package/dist/sessionOps-Dn8z85h_.cjs +783 -0
- package/dist/sessionOps-SuHW8Dfe.mjs +760 -0
- package/dist/sessionScanner-BOrGjMXL.cjs +209 -0
- package/dist/sessionScanner-CX3onqXh.mjs +206 -0
- package/dist/{sessions-W6771g3X.mjs → sessions-BEG_HTSi.mjs} +17 -8
- package/dist/{sessions-BNMPQoLE.cjs → sessions-D74aJbhL.cjs} +37 -28
- package/dist/setupOfflineReconnection-ByElY60m.cjs +74 -0
- package/dist/setupOfflineReconnection-DpvWTt69.mjs +72 -0
- package/dist/smallFastModel-BLNgMrwR.mjs +18 -0
- package/dist/smallFastModel-D_uxGMo3.cjs +21 -0
- package/dist/{spawn-D0QVhzRb.mjs → spawn-B7yro0b2.mjs} +26 -38
- package/dist/{spawn-Ddtom1cb.cjs → spawn-DgR0RKRs.cjs} +52 -64
- package/dist/spawnAgents-BGQiEF-w.cjs +52 -0
- package/dist/spawnAgents-DZzZ9jMI.mjs +45 -0
- package/dist/spawnHappyCLI-B2H5s4B_.mjs +64 -0
- package/dist/spawnHappyCLI-DBhwZT7O.cjs +66 -0
- package/dist/specialCommands-BSqhYg5X.mjs +52 -0
- package/dist/specialCommands-DSsTeRej.cjs +54 -0
- package/dist/startFileWatcher-B4VsLgjD.cjs +71 -0
- package/dist/startFileWatcher-DErVWZE4.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-C8gyQFMc.mjs +69 -0
- package/dist/sync-DccIKZ5_.cjs +71 -0
- package/dist/systemPrompt-BwTPWfMu.cjs +97 -0
- package/dist/systemPrompt-DX521JJz.mjs +94 -0
- package/dist/{teams-CqSwtw2O.mjs → teams-C32F1hqd.mjs} +9 -40
- package/dist/{teams-BZ1tayg_.cjs → teams-Dl8g8kTI.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-D0XyHOid.mjs +38 -0
- package/dist/time-DCuTyook.cjs +42 -0
- package/dist/titleGenerator-CQ8CoGhg.mjs +166 -0
- package/dist/titleGenerator-ChzMJsyg.cjs +172 -0
- package/dist/tmuxSocket-B8Yx20sT.mjs +19 -0
- package/dist/tmuxSocket-D-Xt6Vn-.cjs +24 -0
- package/dist/{todo-BYMg0fR0.cjs → todo-BvUOTa8G.cjs} +15 -12
- package/dist/{todo-BbusB1zM.mjs → todo-CZ6cFrrn.mjs} +11 -8
- package/dist/tools-BZtHF_qQ.mjs +177 -0
- package/dist/tools-Be3AoAwu.cjs +63 -0
- package/dist/tools-DQj0AeLk.cjs +180 -0
- package/dist/tools-DkluDcG4.mjs +60 -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-BkLzaJ6I.mjs +47 -0
- package/dist/uninstall-x-TUtf5H.cjs +49 -0
- package/package.json +7 -7
- package/dist/agentGuidance-CrR9l62U.mjs +0 -2145
- package/dist/agentGuidance-DwOWbX55.cjs +0 -2217
- package/dist/index-BG932eCh.cjs +0 -19655
- package/dist/index-CVCt3kSt.mjs +0 -19591
- package/dist/index-D5ScEErM.cjs +0 -58
- package/dist/index-DgO0FHOx.mjs +0 -52
- package/dist/limits-D2uN090G.mjs +0 -2528
- package/dist/limits-kqFqhfsh.cjs +0 -2652
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _package = require('./package-BwMrPwqH.cjs');
|
|
4
|
+
var module$1 = require('node:module');
|
|
5
|
+
var node_fs = require('node:fs');
|
|
6
|
+
var promises = require('node:fs/promises');
|
|
7
|
+
var os = require('node:os');
|
|
8
|
+
var path = require('node:path');
|
|
9
|
+
|
|
10
|
+
function isStandaloneVersionRequest(args) {
|
|
11
|
+
return args.length === 1 && args[0] === "--version";
|
|
12
|
+
}
|
|
13
|
+
const SELF_CHECK_FLAG = "--self-check";
|
|
14
|
+
function isSelfCheckRequest(args) {
|
|
15
|
+
return args.length === 1 && args[0] === SELF_CHECK_FLAG;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function happyHomeDirFromEnv(env, home = os.homedir()) {
|
|
19
|
+
return env.HAPPY_HOME_DIR ? env.HAPPY_HOME_DIR.replace(/^~/, home) : path.join(home, ".happy");
|
|
20
|
+
}
|
|
21
|
+
function compileCacheRoot(happyHomeDir) {
|
|
22
|
+
return path.join(happyHomeDir, "cache", "compile");
|
|
23
|
+
}
|
|
24
|
+
function compileCacheDir(happyHomeDir, cliVersion) {
|
|
25
|
+
return path.join(compileCacheRoot(happyHomeDir), cliVersion.replace(/[^\w.+-]/g, "_"));
|
|
26
|
+
}
|
|
27
|
+
function enableCompileCacheIfPossible(cliVersion, env = process.env) {
|
|
28
|
+
try {
|
|
29
|
+
const enable = module$1.enableCompileCache;
|
|
30
|
+
if (typeof enable !== "function") return;
|
|
31
|
+
const happyHome = happyHomeDirFromEnv(env);
|
|
32
|
+
if (!node_fs.existsSync(happyHome)) return;
|
|
33
|
+
enable(compileCacheDir(happyHome, cliVersion));
|
|
34
|
+
} catch {
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async function pruneStaleCompileCaches(happyHomeDir, cliVersion) {
|
|
38
|
+
const root = compileCacheRoot(happyHomeDir);
|
|
39
|
+
const keep = compileCacheDir(happyHomeDir, cliVersion);
|
|
40
|
+
const removed = [];
|
|
41
|
+
let entries;
|
|
42
|
+
try {
|
|
43
|
+
entries = await promises.readdir(root);
|
|
44
|
+
} catch {
|
|
45
|
+
return removed;
|
|
46
|
+
}
|
|
47
|
+
for (const name of entries) {
|
|
48
|
+
const dir = path.join(root, name);
|
|
49
|
+
if (dir === keep) continue;
|
|
50
|
+
try {
|
|
51
|
+
await promises.rm(dir, { recursive: true, force: true });
|
|
52
|
+
removed.push(name);
|
|
53
|
+
} catch {
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return removed;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async function run(args) {
|
|
60
|
+
enableCompileCacheIfPossible(_package.packageJson.version);
|
|
61
|
+
if (isStandaloneVersionRequest(args) || isSelfCheckRequest(args)) {
|
|
62
|
+
const { selfCheckMain } = await Promise.resolve().then(function () { return require('./selfCheck-Dc-mNSLb.cjs'); });
|
|
63
|
+
process.exit(await selfCheckMain({ verbose: isSelfCheckRequest(args) }));
|
|
64
|
+
}
|
|
65
|
+
const { main } = await Promise.resolve().then(function () { return require('./main-BkxJP6JQ.cjs'); });
|
|
66
|
+
await main();
|
|
67
|
+
}
|
|
68
|
+
void run(process.argv.slice(2));
|
|
69
|
+
|
|
70
|
+
exports.isStandaloneVersionRequest = isStandaloneVersionRequest;
|
|
71
|
+
exports.pruneStaleCompileCaches = pruneStaleCompileCaches;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { statSync, readdirSync } from 'node:fs';
|
|
2
|
+
import { homedir } from 'node:os';
|
|
3
|
+
import { l as logger } from './logger-6HYUEXNk.mjs';
|
|
4
|
+
import { readSettings } from './persistence-HGW_ZVs9.mjs';
|
|
5
|
+
import { d as describeAgentHome, C as CLAUDE_CONFIG_DIR_ENV, a as CODEX_HOME_ENV, f as findClaudeConversation, b as agentHomeCandidates, c as findCodexThread, r as resolveAgentHomes, A as AGENT_HOME_ENV_NAMES, g as agentHomeEnv, p as probeLoginShellEnv } from './loginShellEnv-Dw8M7tkI.mjs';
|
|
6
|
+
export { h as claudeConversationPath, i as claudeProjectDirName, j as codexRolloutFileMatches, e as expandHomePath } from './loginShellEnv-Dw8M7tkI.mjs';
|
|
7
|
+
import 'chalk';
|
|
8
|
+
import 'node:util';
|
|
9
|
+
import './configuration-RfeNjFmd.mjs';
|
|
10
|
+
import 'node:path';
|
|
11
|
+
import './package-BhaKlnxz.mjs';
|
|
12
|
+
import 'node:fs/promises';
|
|
13
|
+
import 'zod';
|
|
14
|
+
import './authRelay-DSAvg1uv.mjs';
|
|
15
|
+
import 'node:crypto';
|
|
16
|
+
import 'tweetnacl';
|
|
17
|
+
import 'node:child_process';
|
|
18
|
+
|
|
19
|
+
const AGENT_HOME_CACHE_MS = 6e4;
|
|
20
|
+
const AGENT_HOME_FAILURE_CACHE_MS = 5 * 6e4;
|
|
21
|
+
const AGENT_HOME_MAX_STALE_MS = 10 * 6e4;
|
|
22
|
+
function decideShellProbe(entry, now, allowStale) {
|
|
23
|
+
if (!entry) return "await-probe";
|
|
24
|
+
const age = now - entry.probedAt;
|
|
25
|
+
if (age < entry.ttlMs) return "use-cached";
|
|
26
|
+
if (allowStale && age < AGENT_HOME_MAX_STALE_MS) return "use-stale-and-revalidate";
|
|
27
|
+
return "await-probe";
|
|
28
|
+
}
|
|
29
|
+
let shellProbe = null;
|
|
30
|
+
let shellProbeInFlight = null;
|
|
31
|
+
let last = null;
|
|
32
|
+
let originalDaemonEnv = null;
|
|
33
|
+
function snapshotDaemonEnv() {
|
|
34
|
+
if (!originalDaemonEnv) {
|
|
35
|
+
originalDaemonEnv = {};
|
|
36
|
+
for (const name of AGENT_HOME_ENV_NAMES) originalDaemonEnv[name] = process.env[name];
|
|
37
|
+
}
|
|
38
|
+
return originalDaemonEnv;
|
|
39
|
+
}
|
|
40
|
+
function probeShell(now) {
|
|
41
|
+
if (!shellProbeInFlight) {
|
|
42
|
+
const run = probeLoginShellEnv(AGENT_HOME_ENV_NAMES).then((env) => {
|
|
43
|
+
const entry = { env, probedAt: now, ttlMs: env ? AGENT_HOME_CACHE_MS : AGENT_HOME_FAILURE_CACHE_MS };
|
|
44
|
+
shellProbe = entry;
|
|
45
|
+
return entry;
|
|
46
|
+
});
|
|
47
|
+
shellProbeInFlight = run;
|
|
48
|
+
void run.finally(() => {
|
|
49
|
+
if (shellProbeInFlight === run) shellProbeInFlight = null;
|
|
50
|
+
}).catch(() => {
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return shellProbeInFlight;
|
|
54
|
+
}
|
|
55
|
+
async function loginShellEnvFor(now, allowStale) {
|
|
56
|
+
const decision = decideShellProbe(shellProbe, now, allowStale);
|
|
57
|
+
if (decision === "await-probe") return (await probeShell(now)).env;
|
|
58
|
+
if (decision === "use-stale-and-revalidate") {
|
|
59
|
+
probeShell(now).catch((error) => logger.debug("[AGENT HOME] background login-shell probe failed", error));
|
|
60
|
+
}
|
|
61
|
+
return shellProbe.env;
|
|
62
|
+
}
|
|
63
|
+
async function refreshAgentHomes(now = Date.now(), opts = {}) {
|
|
64
|
+
let input;
|
|
65
|
+
let homes;
|
|
66
|
+
try {
|
|
67
|
+
const loginShellEnv = await loginShellEnvFor(now, opts.allowStale === true);
|
|
68
|
+
const settings = await readSettings();
|
|
69
|
+
input = {
|
|
70
|
+
settings: { claudeConfigDir: settings.claudeConfigDir, codexHome: settings.codexHome },
|
|
71
|
+
daemonEnv: snapshotDaemonEnv(),
|
|
72
|
+
loginShellEnv,
|
|
73
|
+
homeDir: homedir()
|
|
74
|
+
};
|
|
75
|
+
homes = resolveAgentHomes(input);
|
|
76
|
+
} catch (error) {
|
|
77
|
+
logger.debug("[AGENT HOME] resolve failed, falling back", error);
|
|
78
|
+
if (last) return last.homes;
|
|
79
|
+
return resolveAgentHomes({ settings: {}, daemonEnv: snapshotDaemonEnv(), loginShellEnv: null, homeDir: homedir() });
|
|
80
|
+
}
|
|
81
|
+
const previous = last?.homes;
|
|
82
|
+
last = { input, homes };
|
|
83
|
+
applyAgentHomesToProcessEnv(homes);
|
|
84
|
+
if (!previous || previous.claudeConfigDir.path !== homes.claudeConfigDir.path || previous.codexHome.path !== homes.codexHome.path) {
|
|
85
|
+
logger.debug(`[AGENT HOME] Claude config dir: ${describeAgentHome(homes.claudeConfigDir)}; Codex home: ${describeAgentHome(homes.codexHome)}`);
|
|
86
|
+
}
|
|
87
|
+
return homes;
|
|
88
|
+
}
|
|
89
|
+
function currentAgentHomes() {
|
|
90
|
+
return last?.homes ?? null;
|
|
91
|
+
}
|
|
92
|
+
function resetAgentHomesCache() {
|
|
93
|
+
shellProbe = null;
|
|
94
|
+
shellProbeInFlight = null;
|
|
95
|
+
last = null;
|
|
96
|
+
originalDaemonEnv = null;
|
|
97
|
+
}
|
|
98
|
+
function applyAgentHomesToProcessEnv(homes) {
|
|
99
|
+
const overlay = agentHomeEnv(homes);
|
|
100
|
+
for (const name of AGENT_HOME_ENV_NAMES) {
|
|
101
|
+
const next = overlay[name];
|
|
102
|
+
if (next === void 0) {
|
|
103
|
+
const original = snapshotDaemonEnv()[name];
|
|
104
|
+
if (original === void 0) delete process.env[name];
|
|
105
|
+
else process.env[name] = original;
|
|
106
|
+
} else if (process.env[name] !== next) {
|
|
107
|
+
process.env[name] = next;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function listDirSafe(path) {
|
|
112
|
+
try {
|
|
113
|
+
return readdirSync(path);
|
|
114
|
+
} catch {
|
|
115
|
+
return [];
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function fileSizeSafe(path) {
|
|
119
|
+
try {
|
|
120
|
+
const st = statSync(path);
|
|
121
|
+
return st.isFile() ? st.size : null;
|
|
122
|
+
} catch {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function locateClaudeConversation(workingDirectory, claudeSessionId) {
|
|
127
|
+
const entry = last;
|
|
128
|
+
if (!entry) {
|
|
129
|
+
const input = { settings: {}, daemonEnv: process.env, loginShellEnv: null, homeDir: homedir() };
|
|
130
|
+
return findClaudeConversation(claudeSessionId, workingDirectory, agentHomeCandidates("claude", input), fileSizeSafe);
|
|
131
|
+
}
|
|
132
|
+
return findClaudeConversation(claudeSessionId, workingDirectory, agentHomeCandidates("claude", entry.input, entry.homes), fileSizeSafe);
|
|
133
|
+
}
|
|
134
|
+
function locateCodexThread(codexThreadId) {
|
|
135
|
+
const entry = last;
|
|
136
|
+
const input = entry?.input ?? { settings: {}, daemonEnv: process.env, loginShellEnv: null, homeDir: homedir() };
|
|
137
|
+
return findCodexThread(codexThreadId, agentHomeCandidates("codex", input, entry?.homes), listDirSafe);
|
|
138
|
+
}
|
|
139
|
+
function agentHomeSpawnEnv(input) {
|
|
140
|
+
const env = {};
|
|
141
|
+
if (input.claudeSessionId) {
|
|
142
|
+
const hit = locateClaudeConversation(input.workingDirectory, input.claudeSessionId);
|
|
143
|
+
if (hit && !hit.resolved) {
|
|
144
|
+
env[CLAUDE_CONFIG_DIR_ENV] = hit.home;
|
|
145
|
+
logger.debug(`[AGENT HOME] Claude conversation ${input.claudeSessionId} found under ${hit.home}; overriding ${CLAUDE_CONFIG_DIR_ENV} for this spawn`);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (input.codexThreadId) {
|
|
149
|
+
const hit = locateCodexThread(input.codexThreadId);
|
|
150
|
+
if (hit && !hit.resolved) {
|
|
151
|
+
env[CODEX_HOME_ENV] = hit.home;
|
|
152
|
+
logger.debug(`[AGENT HOME] Codex thread ${input.codexThreadId} found under ${hit.home}; overriding ${CODEX_HOME_ENV} for this spawn`);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return env;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export { AGENT_HOME_CACHE_MS, AGENT_HOME_ENV_NAMES, AGENT_HOME_FAILURE_CACHE_MS, AGENT_HOME_MAX_STALE_MS, CLAUDE_CONFIG_DIR_ENV, CODEX_HOME_ENV, agentHomeCandidates, agentHomeEnv, agentHomeSpawnEnv, currentAgentHomes, decideShellProbe, describeAgentHome, findClaudeConversation, findCodexThread, locateClaudeConversation, locateCodexThread, probeLoginShellEnv, refreshAgentHomes, resetAgentHomesCache, resolveAgentHomes };
|
|
@@ -1,56 +1,86 @@
|
|
|
1
|
-
import { D as DefaultTransport, A as AcpBackend } from './AcpBackend-
|
|
2
|
-
export { a as DEFAULT_IDLE_TIMEOUT_MS, b as DEFAULT_TOOL_CALL_TIMEOUT_MS, e as extractErrorDetail, f as formatDuration, c as formatDurationMinutes, h as handleAgentMessageChunk, d as handleAgentThoughtChunk, g as handleLegacyMessageChunk, i as handlePlanUpdate, j as handleThinkingUpdate, k as handleToolCall, l as handleToolCallUpdate, p as parseArgsFromContent } from './AcpBackend-
|
|
3
|
-
import {
|
|
4
|
-
import { A as AcpSessionManager } from './AcpSessionManager-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { D as DefaultTransport, A as AcpBackend } from './AcpBackend-mzv8Dhba.mjs';
|
|
2
|
+
export { a as DEFAULT_IDLE_TIMEOUT_MS, b as DEFAULT_TOOL_CALL_TIMEOUT_MS, e as extractErrorDetail, f as formatDuration, c as formatDurationMinutes, h as handleAgentMessageChunk, d as handleAgentThoughtChunk, g as handleLegacyMessageChunk, i as handlePlanUpdate, j as handleThinkingUpdate, k as handleToolCall, l as handleToolCallUpdate, p as parseArgsFromContent } from './AcpBackend-mzv8Dhba.mjs';
|
|
3
|
+
import { l as logger } from './logger-6HYUEXNk.mjs';
|
|
4
|
+
import { A as AcpSessionManager } from './AcpSessionManager-CoMWFVw3.mjs';
|
|
5
|
+
import { l as BUILTIN_TODO_DISCOVERY, P as PROMPT_QUEUE_CAPABILITY } from './index-qdS1friN.mjs';
|
|
6
|
+
import { r as registerAgentAttachmentDownloads } from './agentAttachments-M_B5qEF2.mjs';
|
|
7
|
+
import { c as configuration } from './configuration-RfeNjFmd.mjs';
|
|
8
|
+
import { C as CLAUDE_ATTACHMENT_KINDS, a as stageClaudeAttachments, b as appendStagedAttachmentsToPrompt } from './attachmentContent-_kxRznNf.mjs';
|
|
9
|
+
import { p as preparePiTeamsRuntime } from './piRuntime-CSGkwCKQ.mjs';
|
|
7
10
|
import { randomUUID } from 'node:crypto';
|
|
8
11
|
import { join } from 'node:path';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
12
|
+
import { c as connectionState, A as ApiClient } from './api-CLMUr-SX.mjs';
|
|
13
|
+
import { M as MessageQueue2, r as registerKillSessionHandler } from './registerKillSessionHandler-GYvHdipX.mjs';
|
|
14
|
+
import { h as hashObject, s as startHappyServer } from './deterministicJson-CzkFJWw1.mjs';
|
|
15
|
+
import { readSettings } from './persistence-HGW_ZVs9.mjs';
|
|
16
|
+
import { g as getInitialMachineMetadata } from './machineMetadata-oOzBfDfs.mjs';
|
|
17
|
+
import { c as createSessionMetadata } from './createSessionMetadata-CVVkGjxV.mjs';
|
|
18
|
+
import { s as setupOfflineReconnection } from './setupOfflineReconnection-DpvWTt69.mjs';
|
|
19
|
+
import { n as notifyDaemonSessionStarted, g as reportSessionEditToDaemon } from './controlClient-BGbDcgWS.mjs';
|
|
20
|
+
import { e as encodeBase64 } from './authRelay-DSAvg1uv.mjs';
|
|
21
|
+
import { S as StreamRelay } from './streamRelay-FPVbHpbM.mjs';
|
|
22
|
+
import { p as projectPath } from './projectPath-BTBIMB57.mjs';
|
|
23
|
+
import { B as BasePermissionHandler } from './BasePermissionHandler-m3WVholL.mjs';
|
|
24
|
+
import { T as TitleGenerator } from './titleGenerator-CQ8CoGhg.mjs';
|
|
25
|
+
import { w as writeSessionModeFile, n as normalizeAcpPermissionMode, r as removeSessionModeFile } from './sessionModeFile-DMl3dw3r.mjs';
|
|
26
|
+
import { E as EditReportThrottle, e as extractAcpEditPaths } from './editPaths-BVfS_FFL.mjs';
|
|
11
27
|
import 'node:child_process';
|
|
12
28
|
import '@agentclientprotocol/sdk';
|
|
13
|
-
import '
|
|
14
|
-
import '
|
|
15
|
-
import '
|
|
16
|
-
import 'node:fs';
|
|
17
|
-
import 'tweetnacl';
|
|
29
|
+
import './time-D0XyHOid.mjs';
|
|
30
|
+
import './contentLogMetadata-BlWI0egu.mjs';
|
|
31
|
+
import './package-BhaKlnxz.mjs';
|
|
18
32
|
import 'chalk';
|
|
19
33
|
import 'node:util';
|
|
34
|
+
import 'node:fs';
|
|
35
|
+
import '@paralleldrive/cuid2';
|
|
36
|
+
import 'zod';
|
|
20
37
|
import 'node:os';
|
|
21
|
-
import '
|
|
22
|
-
import '
|
|
23
|
-
import './
|
|
38
|
+
import 'node:fs/promises';
|
|
39
|
+
import './attachmentLimits-yba1uHFO.mjs';
|
|
40
|
+
import './resources-BdFBQi8r.mjs';
|
|
24
41
|
import 'axios';
|
|
25
|
-
import 'socket.io-client';
|
|
26
|
-
import 'fs/promises';
|
|
27
|
-
import 'ink';
|
|
28
|
-
import 'react';
|
|
29
|
-
import '@anthropic-ai/claude-agent-sdk';
|
|
30
42
|
import 'node:events';
|
|
43
|
+
import 'socket.io-client';
|
|
44
|
+
import './limits-DIo7rEBR.mjs';
|
|
45
|
+
import './lidState-CeEt442o.mjs';
|
|
31
46
|
import 'os';
|
|
32
47
|
import 'child_process';
|
|
33
|
-
import '
|
|
34
|
-
import '
|
|
35
|
-
import '
|
|
36
|
-
import 'expo-server-sdk';
|
|
48
|
+
import './registerCommonHandlers-Ccvsz7Ou.mjs';
|
|
49
|
+
import 'util';
|
|
50
|
+
import 'fs/promises';
|
|
37
51
|
import 'crypto';
|
|
38
|
-
import '
|
|
39
|
-
import '
|
|
40
|
-
import '
|
|
41
|
-
import '
|
|
42
|
-
import '
|
|
43
|
-
import '
|
|
52
|
+
import 'path';
|
|
53
|
+
import 'cross-spawn';
|
|
54
|
+
import './sync-C8gyQFMc.mjs';
|
|
55
|
+
import './backgroundTaskActivity-8PdPxrvy.mjs';
|
|
56
|
+
import 'tweetnacl';
|
|
57
|
+
import './types-CkqAACXx.mjs';
|
|
58
|
+
import './client-CeGKqqcJ.mjs';
|
|
59
|
+
import './context-H0Bcb9S_.mjs';
|
|
60
|
+
import './sessionOps-SuHW8Dfe.mjs';
|
|
61
|
+
import './tools-DkluDcG4.mjs';
|
|
62
|
+
import './tools-BZtHF_qQ.mjs';
|
|
63
|
+
import './client-ClR0K8zX.mjs';
|
|
64
|
+
import './peerTools-BTqw97Gb.mjs';
|
|
65
|
+
import './ids-DU6sLx4C.mjs';
|
|
66
|
+
import './remoteSessionClient-CYnXRynE.mjs';
|
|
44
67
|
import '@modelcontextprotocol/sdk/server/mcp.js';
|
|
45
68
|
import 'node:http';
|
|
46
69
|
import '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
47
|
-
import '
|
|
48
|
-
import '
|
|
49
|
-
import '
|
|
50
|
-
import '
|
|
51
|
-
import '
|
|
52
|
-
import '
|
|
70
|
+
import './assistantTools-D6tuc6o4.mjs';
|
|
71
|
+
import './terminals-Dlg0x3nY.mjs';
|
|
72
|
+
import './terminalTitleSuggest-CeKsX_V6.mjs';
|
|
73
|
+
import './tmuxSocket-B8Yx20sT.mjs';
|
|
74
|
+
import './bootstrap-hxXPCFMx.mjs';
|
|
75
|
+
import './agentGuidance-CQuNlNx8.mjs';
|
|
76
|
+
import './trimIdent-BAjmv_TG.mjs';
|
|
77
|
+
import './previewPath-CXN4Vag0.mjs';
|
|
78
|
+
import './detectCLI-CSGMlV51.mjs';
|
|
79
|
+
import 'fs';
|
|
80
|
+
import './localHappyAgentAuth-C-HQyiv6.mjs';
|
|
53
81
|
import 'url';
|
|
82
|
+
import 'node:module';
|
|
83
|
+
import './oneShotPrompts-DT4p6RNd.mjs';
|
|
54
84
|
|
|
55
85
|
function createAcpBackend(options) {
|
|
56
86
|
const backendOptions = {
|
|
@@ -596,14 +626,15 @@ async function runAcp(opts) {
|
|
|
596
626
|
}
|
|
597
627
|
await api.getOrCreateMachine({
|
|
598
628
|
machineId: settings.machineId,
|
|
599
|
-
metadata:
|
|
629
|
+
metadata: getInitialMachineMetadata()
|
|
600
630
|
});
|
|
601
631
|
const { state, metadata } = createSessionMetadata({
|
|
602
632
|
flavor: resolveSessionFlavor(opts.agentName),
|
|
603
633
|
...process.env.VH_TEAM_OPERATION_ID ? { teamOperationId: process.env.VH_TEAM_OPERATION_ID } : {},
|
|
604
634
|
machineId: settings.machineId,
|
|
605
635
|
startedBy: opts.startedBy,
|
|
606
|
-
sandbox: settings.sandboxConfig
|
|
636
|
+
sandbox: settings.sandboxConfig,
|
|
637
|
+
capabilities: [PROMPT_QUEUE_CAPABILITY]
|
|
607
638
|
});
|
|
608
639
|
metadata.attachmentKinds = [];
|
|
609
640
|
const response = await api.getOrCreateSession({ tag: sessionTag, metadata, state });
|
|
@@ -623,6 +654,7 @@ async function runAcp(opts) {
|
|
|
623
654
|
if (permissionHandler) {
|
|
624
655
|
permissionHandler.updateSession(newSession);
|
|
625
656
|
}
|
|
657
|
+
attachPromptQueueDrain(newSession);
|
|
626
658
|
}
|
|
627
659
|
});
|
|
628
660
|
session = initialSession;
|
|
@@ -647,6 +679,13 @@ async function runAcp(opts) {
|
|
|
647
679
|
});
|
|
648
680
|
const sessionManager = new AcpSessionManager(streamingEnabled ? { stream: streamRelay } : {});
|
|
649
681
|
const messageQueue = new MessageQueue2((mode) => hashObject(mode));
|
|
682
|
+
function attachPromptQueueDrain(client) {
|
|
683
|
+
const drain = client.attachPromptQueueDrain({
|
|
684
|
+
isIdle: () => messageQueue.size() === 0 && messageQueue.isWaiting()
|
|
685
|
+
});
|
|
686
|
+
messageQueue.setOnWait(() => drain.onIdle());
|
|
687
|
+
}
|
|
688
|
+
attachPromptQueueDrain(session);
|
|
650
689
|
let currentPermissionMode;
|
|
651
690
|
let currentModel;
|
|
652
691
|
let modeSelector = null;
|
|
@@ -1226,6 +1265,7 @@ ${BUILTIN_TODO_DISCOVERY}`;
|
|
|
1226
1265
|
logger.debug(`[${opts.agentName}] Failed to stop Happy MCP server:`, error);
|
|
1227
1266
|
}
|
|
1228
1267
|
try {
|
|
1268
|
+
session.closePromptQueueDrain();
|
|
1229
1269
|
session.updateMetadata((currentMetadata) => ({
|
|
1230
1270
|
...currentMetadata,
|
|
1231
1271
|
lifecycleState: "archived",
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { p as packageJson } from './package-BhaKlnxz.mjs';
|
|
2
|
+
import module$1 from 'node:module';
|
|
3
|
+
import { existsSync } from 'node:fs';
|
|
4
|
+
import { readdir, rm } from 'node:fs/promises';
|
|
5
|
+
import { homedir } from 'node:os';
|
|
6
|
+
import { join } from 'node:path';
|
|
7
|
+
|
|
8
|
+
function isStandaloneVersionRequest(args) {
|
|
9
|
+
return args.length === 1 && args[0] === "--version";
|
|
10
|
+
}
|
|
11
|
+
const SELF_CHECK_FLAG = "--self-check";
|
|
12
|
+
function isSelfCheckRequest(args) {
|
|
13
|
+
return args.length === 1 && args[0] === SELF_CHECK_FLAG;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function happyHomeDirFromEnv(env, home = homedir()) {
|
|
17
|
+
return env.HAPPY_HOME_DIR ? env.HAPPY_HOME_DIR.replace(/^~/, home) : join(home, ".happy");
|
|
18
|
+
}
|
|
19
|
+
function compileCacheRoot(happyHomeDir) {
|
|
20
|
+
return join(happyHomeDir, "cache", "compile");
|
|
21
|
+
}
|
|
22
|
+
function compileCacheDir(happyHomeDir, cliVersion) {
|
|
23
|
+
return join(compileCacheRoot(happyHomeDir), cliVersion.replace(/[^\w.+-]/g, "_"));
|
|
24
|
+
}
|
|
25
|
+
function enableCompileCacheIfPossible(cliVersion, env = process.env) {
|
|
26
|
+
try {
|
|
27
|
+
const enable = module$1.enableCompileCache;
|
|
28
|
+
if (typeof enable !== "function") return;
|
|
29
|
+
const happyHome = happyHomeDirFromEnv(env);
|
|
30
|
+
if (!existsSync(happyHome)) return;
|
|
31
|
+
enable(compileCacheDir(happyHome, cliVersion));
|
|
32
|
+
} catch {
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
async function pruneStaleCompileCaches(happyHomeDir, cliVersion) {
|
|
36
|
+
const root = compileCacheRoot(happyHomeDir);
|
|
37
|
+
const keep = compileCacheDir(happyHomeDir, cliVersion);
|
|
38
|
+
const removed = [];
|
|
39
|
+
let entries;
|
|
40
|
+
try {
|
|
41
|
+
entries = await readdir(root);
|
|
42
|
+
} catch {
|
|
43
|
+
return removed;
|
|
44
|
+
}
|
|
45
|
+
for (const name of entries) {
|
|
46
|
+
const dir = join(root, name);
|
|
47
|
+
if (dir === keep) continue;
|
|
48
|
+
try {
|
|
49
|
+
await rm(dir, { recursive: true, force: true });
|
|
50
|
+
removed.push(name);
|
|
51
|
+
} catch {
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return removed;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async function run(args) {
|
|
58
|
+
enableCompileCacheIfPossible(packageJson.version);
|
|
59
|
+
if (isStandaloneVersionRequest(args) || isSelfCheckRequest(args)) {
|
|
60
|
+
const { selfCheckMain } = await import('./selfCheck-C9mVrQwf.mjs');
|
|
61
|
+
process.exit(await selfCheckMain({ verbose: isSelfCheckRequest(args) }));
|
|
62
|
+
}
|
|
63
|
+
const { main } = await import('./main-BwNIAI1A.mjs');
|
|
64
|
+
await main();
|
|
65
|
+
}
|
|
66
|
+
void run(process.argv.slice(2));
|
|
67
|
+
|
|
68
|
+
export { isStandaloneVersionRequest as i, pruneStaleCompileCaches as p };
|