cli-remote-agent 1.0.13 → 1.0.14
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 +47 -15
- 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/cli.js
CHANGED
|
@@ -527,6 +527,36 @@ var init_single_instance = __esm({
|
|
|
527
527
|
}
|
|
528
528
|
});
|
|
529
529
|
|
|
530
|
+
// src/keep-awake.ts
|
|
531
|
+
function keepAwake() {
|
|
532
|
+
if (process.platform !== "darwin") return;
|
|
533
|
+
if (process.env.CRC_ALLOW_SLEEP === "1") return;
|
|
534
|
+
try {
|
|
535
|
+
const child = (0, import_child_process2.spawn)("caffeinate", ["-i", "-w", String(process.pid)], {
|
|
536
|
+
detached: true,
|
|
537
|
+
stdio: "ignore"
|
|
538
|
+
});
|
|
539
|
+
child.on("error", (err) => {
|
|
540
|
+
logger.warn(
|
|
541
|
+
{ error: err.message },
|
|
542
|
+
"Could not start caffeinate \u2014 the Mac may idle-sleep and drop the connection"
|
|
543
|
+
);
|
|
544
|
+
});
|
|
545
|
+
child.unref();
|
|
546
|
+
logger.info("Preventing idle sleep while the agent runs (caffeinate -i)");
|
|
547
|
+
} catch (err) {
|
|
548
|
+
logger.warn({ error: err?.message }, "Could not prevent idle sleep");
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
var import_child_process2;
|
|
552
|
+
var init_keep_awake = __esm({
|
|
553
|
+
"src/keep-awake.ts"() {
|
|
554
|
+
"use strict";
|
|
555
|
+
import_child_process2 = require("child_process");
|
|
556
|
+
init_logger();
|
|
557
|
+
}
|
|
558
|
+
});
|
|
559
|
+
|
|
530
560
|
// src/claude-live.ts
|
|
531
561
|
function isAlive(pid) {
|
|
532
562
|
try {
|
|
@@ -591,16 +621,16 @@ async function findClaudeSessionForPtyPid(ptyPid) {
|
|
|
591
621
|
}
|
|
592
622
|
return null;
|
|
593
623
|
}
|
|
594
|
-
var import_fs6, import_path5, import_os2,
|
|
624
|
+
var import_fs6, import_path5, import_os2, import_child_process3, import_util, execFileAsync, LIVE_SESSIONS_DIR;
|
|
595
625
|
var init_claude_live = __esm({
|
|
596
626
|
"src/claude-live.ts"() {
|
|
597
627
|
"use strict";
|
|
598
628
|
import_fs6 = __toESM(require("fs"));
|
|
599
629
|
import_path5 = __toESM(require("path"));
|
|
600
630
|
import_os2 = __toESM(require("os"));
|
|
601
|
-
|
|
631
|
+
import_child_process3 = require("child_process");
|
|
602
632
|
import_util = require("util");
|
|
603
|
-
execFileAsync = (0, import_util.promisify)(
|
|
633
|
+
execFileAsync = (0, import_util.promisify)(import_child_process3.execFile);
|
|
604
634
|
LIVE_SESSIONS_DIR = import_path5.default.join(import_os2.default.homedir(), ".claude", "sessions");
|
|
605
635
|
}
|
|
606
636
|
});
|
|
@@ -741,16 +771,16 @@ function buildTmuxLaunch(name, launch) {
|
|
|
741
771
|
if (trimmed) args.push(trimmed);
|
|
742
772
|
return { file: tmuxBin, args };
|
|
743
773
|
}
|
|
744
|
-
var
|
|
774
|
+
var import_child_process4, import_util2, import_fs7, import_path6, execFileAsync2, IS_WIN, cachedTmuxPath;
|
|
745
775
|
var init_tmux = __esm({
|
|
746
776
|
"src/tmux.ts"() {
|
|
747
777
|
"use strict";
|
|
748
|
-
|
|
778
|
+
import_child_process4 = require("child_process");
|
|
749
779
|
import_util2 = require("util");
|
|
750
780
|
import_fs7 = __toESM(require("fs"));
|
|
751
781
|
import_path6 = __toESM(require("path"));
|
|
752
782
|
init_claude_live();
|
|
753
|
-
execFileAsync2 = (0, import_util2.promisify)(
|
|
783
|
+
execFileAsync2 = (0, import_util2.promisify)(import_child_process4.execFile);
|
|
754
784
|
IS_WIN = process.platform === "win32";
|
|
755
785
|
}
|
|
756
786
|
});
|
|
@@ -760,7 +790,7 @@ function detectShell(preference) {
|
|
|
760
790
|
if (preference !== "auto") return preference;
|
|
761
791
|
if (process.platform === "win32") {
|
|
762
792
|
try {
|
|
763
|
-
(0,
|
|
793
|
+
(0, import_child_process5.execSync)("where pwsh", { stdio: "ignore" });
|
|
764
794
|
return "pwsh.exe";
|
|
765
795
|
} catch {
|
|
766
796
|
return "powershell.exe";
|
|
@@ -768,11 +798,11 @@ function detectShell(preference) {
|
|
|
768
798
|
}
|
|
769
799
|
return process.env.SHELL || "/bin/bash";
|
|
770
800
|
}
|
|
771
|
-
var
|
|
801
|
+
var import_child_process5;
|
|
772
802
|
var init_shell = __esm({
|
|
773
803
|
"src/shell.ts"() {
|
|
774
804
|
"use strict";
|
|
775
|
-
|
|
805
|
+
import_child_process5 = require("child_process");
|
|
776
806
|
}
|
|
777
807
|
});
|
|
778
808
|
|
|
@@ -1060,7 +1090,7 @@ function getCpuUsage() {
|
|
|
1060
1090
|
function getRootPaths() {
|
|
1061
1091
|
if (process.platform === "win32") {
|
|
1062
1092
|
try {
|
|
1063
|
-
const output = (0,
|
|
1093
|
+
const output = (0, import_child_process6.execSync)("wmic logicaldisk get name", { encoding: "utf-8" });
|
|
1064
1094
|
return output.split("\n").map((l) => l.trim()).filter((l) => /^[A-Z]:$/.test(l)).map((l) => l + "\\");
|
|
1065
1095
|
} catch {
|
|
1066
1096
|
return ["C:\\"];
|
|
@@ -1085,13 +1115,13 @@ function buildHeartbeat(homeDir) {
|
|
|
1085
1115
|
capabilities: { terminal: true, fileTransfer: false }
|
|
1086
1116
|
};
|
|
1087
1117
|
}
|
|
1088
|
-
var import_os4, import_path8,
|
|
1118
|
+
var import_os4, import_path8, import_child_process6, prevCpu;
|
|
1089
1119
|
var init_heartbeat = __esm({
|
|
1090
1120
|
"src/heartbeat.ts"() {
|
|
1091
1121
|
"use strict";
|
|
1092
1122
|
import_os4 = __toESM(require("os"));
|
|
1093
1123
|
import_path8 = __toESM(require("path"));
|
|
1094
|
-
|
|
1124
|
+
import_child_process6 = require("child_process");
|
|
1095
1125
|
init_terminal_manager();
|
|
1096
1126
|
prevCpu = null;
|
|
1097
1127
|
}
|
|
@@ -1517,17 +1547,17 @@ async function disconnectVpn(configs, profileId) {
|
|
|
1517
1547
|
}
|
|
1518
1548
|
return profiles;
|
|
1519
1549
|
}
|
|
1520
|
-
var
|
|
1550
|
+
var import_child_process7, import_util3, import_fs10, import_path10, import_os6, execAsync, isWindows, VPN_DIR;
|
|
1521
1551
|
var init_vpn_manager = __esm({
|
|
1522
1552
|
"src/vpn-manager.ts"() {
|
|
1523
1553
|
"use strict";
|
|
1524
|
-
|
|
1554
|
+
import_child_process7 = require("child_process");
|
|
1525
1555
|
import_util3 = require("util");
|
|
1526
1556
|
import_fs10 = __toESM(require("fs"));
|
|
1527
1557
|
import_path10 = __toESM(require("path"));
|
|
1528
1558
|
import_os6 = __toESM(require("os"));
|
|
1529
1559
|
init_logger();
|
|
1530
|
-
execAsync = (0, import_util3.promisify)(
|
|
1560
|
+
execAsync = (0, import_util3.promisify)(import_child_process7.exec);
|
|
1531
1561
|
isWindows = process.platform === "win32";
|
|
1532
1562
|
VPN_DIR = import_path10.default.join(import_os6.default.homedir(), ".crc-agent", "vpn");
|
|
1533
1563
|
}
|
|
@@ -1870,6 +1900,7 @@ var init_index = __esm({
|
|
|
1870
1900
|
init_local_control();
|
|
1871
1901
|
init_pty_helper_fix();
|
|
1872
1902
|
init_single_instance();
|
|
1903
|
+
init_keep_awake();
|
|
1873
1904
|
init_tmux();
|
|
1874
1905
|
init_heartbeat();
|
|
1875
1906
|
init_file_explorer();
|
|
@@ -1892,6 +1923,7 @@ var init_index = __esm({
|
|
|
1892
1923
|
process.exit(1);
|
|
1893
1924
|
}
|
|
1894
1925
|
ensurePtyHelperExecutable();
|
|
1926
|
+
keepAwake();
|
|
1895
1927
|
process.on("unhandledRejection", (reason) => {
|
|
1896
1928
|
logger.error({ reason }, "Unhandled promise rejection (agent kept alive)");
|
|
1897
1929
|
});
|