cli-remote-agent 1.0.13 → 1.0.15
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/cli.js +65 -18
- package/dist/cli.js.map +1 -1
- package/dist/index.js +34 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -336,8 +336,31 @@ function acquireSingleInstanceLock() {
|
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
+
// src/keep-awake.ts
|
|
340
|
+
var import_child_process2 = require("child_process");
|
|
341
|
+
function keepAwake() {
|
|
342
|
+
if (process.platform !== "darwin") return;
|
|
343
|
+
if (process.env.CRC_ALLOW_SLEEP === "1") return;
|
|
344
|
+
try {
|
|
345
|
+
const child = (0, import_child_process2.spawn)("caffeinate", ["-i", "-w", String(process.pid)], {
|
|
346
|
+
detached: true,
|
|
347
|
+
stdio: "ignore"
|
|
348
|
+
});
|
|
349
|
+
child.on("error", (err) => {
|
|
350
|
+
logger.warn(
|
|
351
|
+
{ error: err.message },
|
|
352
|
+
"Could not start caffeinate \u2014 the Mac may idle-sleep and drop the connection"
|
|
353
|
+
);
|
|
354
|
+
});
|
|
355
|
+
child.unref();
|
|
356
|
+
logger.info("Preventing idle sleep while the agent runs (caffeinate -i)");
|
|
357
|
+
} catch (err) {
|
|
358
|
+
logger.warn({ error: err?.message }, "Could not prevent idle sleep");
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
339
362
|
// src/tmux.ts
|
|
340
|
-
var
|
|
363
|
+
var import_child_process4 = require("child_process");
|
|
341
364
|
var import_util2 = require("util");
|
|
342
365
|
var import_fs6 = __toESM(require("fs"));
|
|
343
366
|
var import_path6 = __toESM(require("path"));
|
|
@@ -346,9 +369,9 @@ var import_path6 = __toESM(require("path"));
|
|
|
346
369
|
var import_fs5 = __toESM(require("fs"));
|
|
347
370
|
var import_path5 = __toESM(require("path"));
|
|
348
371
|
var import_os2 = __toESM(require("os"));
|
|
349
|
-
var
|
|
372
|
+
var import_child_process3 = require("child_process");
|
|
350
373
|
var import_util = require("util");
|
|
351
|
-
var execFileAsync = (0, import_util.promisify)(
|
|
374
|
+
var execFileAsync = (0, import_util.promisify)(import_child_process3.execFile);
|
|
352
375
|
var LIVE_SESSIONS_DIR = import_path5.default.join(import_os2.default.homedir(), ".claude", "sessions");
|
|
353
376
|
function isAlive(pid) {
|
|
354
377
|
try {
|
|
@@ -415,7 +438,7 @@ async function findClaudeSessionForPtyPid(ptyPid) {
|
|
|
415
438
|
}
|
|
416
439
|
|
|
417
440
|
// src/tmux.ts
|
|
418
|
-
var execFileAsync2 = (0, import_util2.promisify)(
|
|
441
|
+
var execFileAsync2 = (0, import_util2.promisify)(import_child_process4.execFile);
|
|
419
442
|
var IS_WIN = process.platform === "win32";
|
|
420
443
|
var cachedTmuxPath;
|
|
421
444
|
function resolveTmuxPath() {
|
|
@@ -557,7 +580,7 @@ function buildTmuxLaunch(name, launch) {
|
|
|
557
580
|
// src/heartbeat.ts
|
|
558
581
|
var import_os4 = __toESM(require("os"));
|
|
559
582
|
var import_path8 = __toESM(require("path"));
|
|
560
|
-
var
|
|
583
|
+
var import_child_process6 = require("child_process");
|
|
561
584
|
|
|
562
585
|
// src/pty-session.ts
|
|
563
586
|
var pty = __toESM(require("node-pty"));
|
|
@@ -566,12 +589,12 @@ var import_path7 = require("path");
|
|
|
566
589
|
var import_os3 = require("os");
|
|
567
590
|
|
|
568
591
|
// src/shell.ts
|
|
569
|
-
var
|
|
592
|
+
var import_child_process5 = require("child_process");
|
|
570
593
|
function detectShell(preference) {
|
|
571
594
|
if (preference !== "auto") return preference;
|
|
572
595
|
if (process.platform === "win32") {
|
|
573
596
|
try {
|
|
574
|
-
(0,
|
|
597
|
+
(0, import_child_process5.execSync)("where pwsh", { stdio: "ignore" });
|
|
575
598
|
return "pwsh.exe";
|
|
576
599
|
} catch {
|
|
577
600
|
return "powershell.exe";
|
|
@@ -845,7 +868,7 @@ function getCpuUsage() {
|
|
|
845
868
|
function getRootPaths() {
|
|
846
869
|
if (process.platform === "win32") {
|
|
847
870
|
try {
|
|
848
|
-
const output = (0,
|
|
871
|
+
const output = (0, import_child_process6.execSync)("wmic logicaldisk get name", { encoding: "utf-8" });
|
|
849
872
|
return output.split("\n").map((l) => l.trim()).filter((l) => /^[A-Z]:$/.test(l)).map((l) => l + "\\");
|
|
850
873
|
} catch {
|
|
851
874
|
return ["C:\\"];
|
|
@@ -966,12 +989,12 @@ async function downloadFile(filePath, serverUrl, secret, agentId) {
|
|
|
966
989
|
}
|
|
967
990
|
|
|
968
991
|
// src/vpn-manager.ts
|
|
969
|
-
var
|
|
992
|
+
var import_child_process7 = require("child_process");
|
|
970
993
|
var import_util3 = require("util");
|
|
971
994
|
var import_fs9 = __toESM(require("fs"));
|
|
972
995
|
var import_path10 = __toESM(require("path"));
|
|
973
996
|
var import_os6 = __toESM(require("os"));
|
|
974
|
-
var execAsync = (0, import_util3.promisify)(
|
|
997
|
+
var execAsync = (0, import_util3.promisify)(import_child_process7.exec);
|
|
975
998
|
var isWindows = process.platform === "win32";
|
|
976
999
|
var VPN_DIR = import_path10.default.join(import_os6.default.homedir(), ".crc-agent", "vpn");
|
|
977
1000
|
function shq(value) {
|
|
@@ -1611,6 +1634,7 @@ if (!lock.ok) {
|
|
|
1611
1634
|
process.exit(1);
|
|
1612
1635
|
}
|
|
1613
1636
|
ensurePtyHelperExecutable();
|
|
1637
|
+
keepAwake();
|
|
1614
1638
|
process.on("unhandledRejection", (reason) => {
|
|
1615
1639
|
logger.error({ reason }, "Unhandled promise rejection (agent kept alive)");
|
|
1616
1640
|
});
|