codeam-cli 2.61.99 → 2.62.1
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/CHANGELOG.md +16 -0
- package/dist/index.js +313 -221
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3271,7 +3271,7 @@ var { getConfig, ensurePluginId, addSession, removeSession, setActiveSession, ge
|
|
|
3271
3271
|
|
|
3272
3272
|
// src/commands/pair-auto.ts
|
|
3273
3273
|
var fs63 = __toESM(require("fs"));
|
|
3274
|
-
var
|
|
3274
|
+
var os52 = __toESM(require("os"));
|
|
3275
3275
|
var path67 = __toESM(require("path"));
|
|
3276
3276
|
var import_crypto4 = require("crypto");
|
|
3277
3277
|
|
|
@@ -8022,7 +8022,7 @@ function readAnonId() {
|
|
|
8022
8022
|
}
|
|
8023
8023
|
function superProperties() {
|
|
8024
8024
|
return {
|
|
8025
|
-
cliVersion: true ? "2.
|
|
8025
|
+
cliVersion: true ? "2.62.1" : "0.0.0-dev",
|
|
8026
8026
|
nodeVersion: process.version,
|
|
8027
8027
|
platform: process.platform,
|
|
8028
8028
|
arch: process.arch,
|
|
@@ -8203,7 +8203,7 @@ var os4 = __toESM(require("os"));
|
|
|
8203
8203
|
// package.json
|
|
8204
8204
|
var package_default = {
|
|
8205
8205
|
name: "codeam-cli",
|
|
8206
|
-
version: "2.
|
|
8206
|
+
version: "2.62.1",
|
|
8207
8207
|
description: "Workflow-continuity bridge for AI coding agents. Wrap Claude Code or Codex in a PTY and supervise, approve, and redirect the session from any device \u2014 async. The terminal companion for CodeAgent Mobile.",
|
|
8208
8208
|
type: "commonjs",
|
|
8209
8209
|
main: "dist/index.js",
|
|
@@ -8861,12 +8861,14 @@ function computePollDelay({ baseMs, failures }) {
|
|
|
8861
8861
|
|
|
8862
8862
|
// src/services/headroom/proxy-supervisor.ts
|
|
8863
8863
|
var fs7 = __toESM(require("fs"));
|
|
8864
|
-
var
|
|
8864
|
+
var os7 = __toESM(require("os"));
|
|
8865
8865
|
var path6 = __toESM(require("path"));
|
|
8866
|
+
var net = __toESM(require("net"));
|
|
8866
8867
|
|
|
8867
8868
|
// src/services/headroom/proxy-process.ts
|
|
8868
8869
|
var import_child_process2 = require("child_process");
|
|
8869
8870
|
var fs6 = __toESM(require("fs"));
|
|
8871
|
+
var os6 = __toESM(require("os"));
|
|
8870
8872
|
var path5 = __toESM(require("path"));
|
|
8871
8873
|
|
|
8872
8874
|
// src/services/headroom/budget-args.ts
|
|
@@ -8947,6 +8949,27 @@ function pkillFallback() {
|
|
|
8947
8949
|
} catch {
|
|
8948
8950
|
}
|
|
8949
8951
|
}
|
|
8952
|
+
function findRunningProxyPid() {
|
|
8953
|
+
let entries;
|
|
8954
|
+
try {
|
|
8955
|
+
entries = fs5.readdirSync("/proc");
|
|
8956
|
+
} catch {
|
|
8957
|
+
return null;
|
|
8958
|
+
}
|
|
8959
|
+
for (const name of entries) {
|
|
8960
|
+
if (!/^\d+$/.test(name)) continue;
|
|
8961
|
+
const pid = Number(name);
|
|
8962
|
+
if (pid === process.pid) continue;
|
|
8963
|
+
if (pidLooksLikeProxy(pid)) return pid;
|
|
8964
|
+
}
|
|
8965
|
+
return null;
|
|
8966
|
+
}
|
|
8967
|
+
function adoptRunningProxy() {
|
|
8968
|
+
const pid = findRunningProxyPid();
|
|
8969
|
+
if (pid === null) return null;
|
|
8970
|
+
writeHeadroomProxyPidfile(pid);
|
|
8971
|
+
return pid;
|
|
8972
|
+
}
|
|
8950
8973
|
function killHeadroomProxy() {
|
|
8951
8974
|
const pid = readHeadroomProxyPidfile();
|
|
8952
8975
|
if (pid !== null && isPidAlive(pid)) {
|
|
@@ -8966,6 +8989,14 @@ function killHeadroomProxy() {
|
|
|
8966
8989
|
} catch {
|
|
8967
8990
|
}
|
|
8968
8991
|
}
|
|
8992
|
+
const found = findRunningProxyPid();
|
|
8993
|
+
if (found !== null) {
|
|
8994
|
+
try {
|
|
8995
|
+
process.kill(found, "SIGTERM");
|
|
8996
|
+
return;
|
|
8997
|
+
} catch {
|
|
8998
|
+
}
|
|
8999
|
+
}
|
|
8969
9000
|
pkillFallback();
|
|
8970
9001
|
}
|
|
8971
9002
|
|
|
@@ -9000,6 +9031,23 @@ function refreshSpawnLock() {
|
|
|
9000
9031
|
} catch {
|
|
9001
9032
|
}
|
|
9002
9033
|
}
|
|
9034
|
+
function headroomProxyLogPath() {
|
|
9035
|
+
return path5.join(os6.homedir(), ".codeam", "headroom-proxy.log");
|
|
9036
|
+
}
|
|
9037
|
+
var PROXY_LOG_MAX_BYTES = 2 * 1024 * 1024;
|
|
9038
|
+
function openProxyLogFd() {
|
|
9039
|
+
try {
|
|
9040
|
+
const p2 = headroomProxyLogPath();
|
|
9041
|
+
fs6.mkdirSync(path5.dirname(p2), { recursive: true, mode: 448 });
|
|
9042
|
+
try {
|
|
9043
|
+
if (fs6.statSync(p2).size > PROXY_LOG_MAX_BYTES) fs6.truncateSync(p2, 0);
|
|
9044
|
+
} catch {
|
|
9045
|
+
}
|
|
9046
|
+
return fs6.openSync(p2, "a", 384);
|
|
9047
|
+
} catch {
|
|
9048
|
+
return null;
|
|
9049
|
+
}
|
|
9050
|
+
}
|
|
9003
9051
|
function spawnHeadroomProxy(logging, opts = {}) {
|
|
9004
9052
|
try {
|
|
9005
9053
|
const nowMs = Date.now();
|
|
@@ -9013,15 +9061,22 @@ function spawnHeadroomProxy(logging, opts = {}) {
|
|
|
9013
9061
|
...process.env,
|
|
9014
9062
|
HEADROOM_KOMPRESS_BACKEND: "onnx_cpu"
|
|
9015
9063
|
};
|
|
9064
|
+
const logFd = openProxyLogFd();
|
|
9016
9065
|
const proxy = (0, import_child_process2.spawn)(
|
|
9017
9066
|
"headroom",
|
|
9018
9067
|
["proxy", "--port", "8787", ...buildBudgetProxyArgs(proxyEnv)],
|
|
9019
9068
|
{
|
|
9020
|
-
stdio: "ignore",
|
|
9069
|
+
stdio: logFd === null ? "ignore" : ["ignore", logFd, logFd],
|
|
9021
9070
|
detached: true,
|
|
9022
9071
|
env: proxyEnv
|
|
9023
9072
|
}
|
|
9024
9073
|
);
|
|
9074
|
+
if (logFd !== null) {
|
|
9075
|
+
try {
|
|
9076
|
+
fs6.closeSync(logFd);
|
|
9077
|
+
} catch {
|
|
9078
|
+
}
|
|
9079
|
+
}
|
|
9025
9080
|
proxy.once("error", (e) => {
|
|
9026
9081
|
log.warn(logging.tag, logging.spawnErrorMsg(e.message));
|
|
9027
9082
|
});
|
|
@@ -9034,6 +9089,7 @@ function spawnHeadroomProxy(logging, opts = {}) {
|
|
|
9034
9089
|
|
|
9035
9090
|
// src/services/headroom/proxy-supervisor.ts
|
|
9036
9091
|
var PROXY_STARTUP_GRACE_MS = 45e3;
|
|
9092
|
+
var PRE_TURN_READY_TIMEOUT_MS = 15e4;
|
|
9037
9093
|
async function ensureHeadroomProxy(deps) {
|
|
9038
9094
|
if (!deps.isConfigured()) return "skip";
|
|
9039
9095
|
let alive = false;
|
|
@@ -9046,6 +9102,11 @@ async function ensureHeadroomProxy(deps) {
|
|
|
9046
9102
|
if (deps.proxyProcessAlive()) return "starting";
|
|
9047
9103
|
const ageMs = deps.proxyStartupAgeMs();
|
|
9048
9104
|
if (ageMs !== null && ageMs < PROXY_STARTUP_GRACE_MS) return "starting";
|
|
9105
|
+
const adopted = deps.adoptRunningProxy?.() ?? null;
|
|
9106
|
+
if (adopted !== null) {
|
|
9107
|
+
log.info("headroom-supervisor", `adopted an already-running proxy (pid ${adopted})`);
|
|
9108
|
+
return "starting";
|
|
9109
|
+
}
|
|
9049
9110
|
log.warn("headroom-supervisor", "proxy :8787 is confirmed down \u2014 respawning");
|
|
9050
9111
|
(deps.spawnProxyForce ?? deps.spawnProxy)();
|
|
9051
9112
|
return "respawned";
|
|
@@ -9060,18 +9121,32 @@ async function ensureHeadroomProxyReady(deps, opts = {}) {
|
|
|
9060
9121
|
(deps.spawnProxyForce ?? deps.spawnProxy)();
|
|
9061
9122
|
const sleep5 = opts.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
|
|
9062
9123
|
const pollMs = opts.pollMs ?? 1500;
|
|
9063
|
-
const maxPolls = Math.max(1, Math.ceil((opts.timeoutMs ??
|
|
9124
|
+
const maxPolls = Math.max(1, Math.ceil((opts.timeoutMs ?? PRE_TURN_READY_TIMEOUT_MS) / pollMs));
|
|
9064
9125
|
for (let i = 0; i < maxPolls; i += 1) {
|
|
9065
9126
|
await sleep5(pollMs);
|
|
9127
|
+
const elapsed = (i + 1) * pollMs / 1e3;
|
|
9066
9128
|
if (await deps.probeAlive().catch(() => false)) {
|
|
9067
|
-
log.info("headroom-supervisor", `proxy :8787 ready after ~${
|
|
9129
|
+
log.info("headroom-supervisor", `proxy :8787 ready after ~${elapsed}s`);
|
|
9130
|
+
return true;
|
|
9131
|
+
}
|
|
9132
|
+
if (await (deps.probePortOpen?.() ?? Promise.resolve(false)).catch(() => false)) {
|
|
9133
|
+
log.info(
|
|
9134
|
+
"headroom-supervisor",
|
|
9135
|
+
`proxy :8787 accepting connections after ~${elapsed}s (still warming \u2014 turn is safe to send)`
|
|
9136
|
+
);
|
|
9068
9137
|
return true;
|
|
9069
9138
|
}
|
|
9070
9139
|
}
|
|
9071
9140
|
log.warn("headroom-supervisor", "proxy :8787 still not ready after respawn wait \u2014 proceeding anyway");
|
|
9072
9141
|
return false;
|
|
9073
9142
|
}
|
|
9074
|
-
function isHeadroomConfiguredReal(homeDir2 =
|
|
9143
|
+
function isHeadroomConfiguredReal(homeDir2 = os7.homedir()) {
|
|
9144
|
+
const ownConfig = path6.join(homeDir2, ".codeam", "headroom-config.json");
|
|
9145
|
+
try {
|
|
9146
|
+
const j2 = JSON.parse(fs7.readFileSync(ownConfig, "utf8"));
|
|
9147
|
+
if (j2.enabled === true) return true;
|
|
9148
|
+
} catch {
|
|
9149
|
+
}
|
|
9075
9150
|
if (process.env.HEADROOM_ENABLED === "1") return true;
|
|
9076
9151
|
const csEnv = path6.join(homeDir2, ".codeam", "codespace-env.json");
|
|
9077
9152
|
try {
|
|
@@ -9081,7 +9156,8 @@ function isHeadroomConfiguredReal(homeDir2 = os6.homedir()) {
|
|
|
9081
9156
|
}
|
|
9082
9157
|
const settings = path6.join(homeDir2, ".claude", "settings.json");
|
|
9083
9158
|
try {
|
|
9084
|
-
|
|
9159
|
+
const raw = fs7.readFileSync(settings, "utf8");
|
|
9160
|
+
if (raw.includes("127.0.0.1:8787") || raw.includes("headroom init hook")) return true;
|
|
9085
9161
|
} catch {
|
|
9086
9162
|
}
|
|
9087
9163
|
return false;
|
|
@@ -9100,6 +9176,20 @@ async function probeProxyAliveReal() {
|
|
|
9100
9176
|
clearTimeout(timer);
|
|
9101
9177
|
}
|
|
9102
9178
|
}
|
|
9179
|
+
async function probeProxyPortOpenReal() {
|
|
9180
|
+
return new Promise((resolve9) => {
|
|
9181
|
+
const socket = net.connect({ host: "127.0.0.1", port: 8787 });
|
|
9182
|
+
const done = (ok) => {
|
|
9183
|
+
socket.removeAllListeners();
|
|
9184
|
+
socket.destroy();
|
|
9185
|
+
resolve9(ok);
|
|
9186
|
+
};
|
|
9187
|
+
socket.setTimeout(2e3);
|
|
9188
|
+
socket.once("connect", () => done(true));
|
|
9189
|
+
socket.once("timeout", () => done(false));
|
|
9190
|
+
socket.once("error", () => done(false));
|
|
9191
|
+
});
|
|
9192
|
+
}
|
|
9103
9193
|
function spawnProxyReal() {
|
|
9104
9194
|
spawnHeadroomProxy({
|
|
9105
9195
|
tag: "headroom-supervisor",
|
|
@@ -9111,8 +9201,10 @@ function makeRealProxySupervisorDeps() {
|
|
|
9111
9201
|
return {
|
|
9112
9202
|
isConfigured: () => isHeadroomConfiguredReal(),
|
|
9113
9203
|
probeAlive: probeProxyAliveReal,
|
|
9204
|
+
probePortOpen: probeProxyPortOpenReal,
|
|
9114
9205
|
proxyProcessAlive: () => isHeadroomProxyProcessAlive(),
|
|
9115
9206
|
proxyStartupAgeMs: () => headroomProxyPidfileAgeMs(Date.now()),
|
|
9207
|
+
adoptRunningProxy: () => adoptRunningProxy(),
|
|
9116
9208
|
spawnProxy: spawnProxyReal,
|
|
9117
9209
|
spawnProxyForce: () => {
|
|
9118
9210
|
killHeadroomProxy();
|
|
@@ -9520,7 +9612,7 @@ var CommandRelayService = class _CommandRelayService {
|
|
|
9520
9612
|
// fresh + clear the "CLI update available" banner after a self-update
|
|
9521
9613
|
// (a codespace that reinstalls @latest reconnects via heartbeat, not
|
|
9522
9614
|
// pair/reconnect). Older backends ignore the extra field.
|
|
9523
|
-
..."2.
|
|
9615
|
+
..."2.62.1" ? { ideVersion: "2.62.1" } : {}
|
|
9524
9616
|
}).then(() => log.trace("relay", `heartbeat ok online=${online}`)).catch((err) => log.trace("relay", `heartbeat failed online=${online}`, err));
|
|
9525
9617
|
}
|
|
9526
9618
|
/**
|
|
@@ -9587,7 +9679,7 @@ var CommandRelayService = class _CommandRelayService {
|
|
|
9587
9679
|
// src/services/file-watcher.service.ts
|
|
9588
9680
|
var import_child_process3 = require("child_process");
|
|
9589
9681
|
var fs8 = __toESM(require("fs"));
|
|
9590
|
-
var
|
|
9682
|
+
var os8 = __toESM(require("os"));
|
|
9591
9683
|
var path7 = __toESM(require("path"));
|
|
9592
9684
|
var import_ignore = __toESM(require("ignore"));
|
|
9593
9685
|
|
|
@@ -9747,10 +9839,10 @@ var WINDOWS_LEGACY_JUNCTIONS = [
|
|
|
9747
9839
|
/[\\/]Start Menu([\\/]|$)/i,
|
|
9748
9840
|
/[\\/]Templates([\\/]|$)/i
|
|
9749
9841
|
];
|
|
9750
|
-
function isUnsafeWindowsWatchRoot(dir,
|
|
9842
|
+
function isUnsafeWindowsWatchRoot(dir, homedir52) {
|
|
9751
9843
|
const norm = (p2) => p2.replace(/\//g, "\\").replace(/\\+$/, "").toLowerCase();
|
|
9752
9844
|
const cwd = norm(dir);
|
|
9753
|
-
const home = norm(
|
|
9845
|
+
const home = norm(homedir52);
|
|
9754
9846
|
if (cwd === home) return true;
|
|
9755
9847
|
if (/^[a-z]:$/.test(cwd)) return true;
|
|
9756
9848
|
const sysRoots = [
|
|
@@ -9849,7 +9941,7 @@ var FileWatcherService = class {
|
|
|
9849
9941
|
throw new Error("FileWatcherService has already been stopped \u2014 re-instantiate to restart.");
|
|
9850
9942
|
}
|
|
9851
9943
|
const isWin = process.platform === "win32";
|
|
9852
|
-
if (isWin && isUnsafeWindowsWatchRoot(this.opts.workingDir,
|
|
9944
|
+
if (isWin && isUnsafeWindowsWatchRoot(this.opts.workingDir, os8.homedir())) {
|
|
9853
9945
|
log.warn(
|
|
9854
9946
|
"fileWatcher",
|
|
9855
9947
|
`refusing to watch ${this.opts.workingDir} \u2014 looks like a Windows user-profile or system path. Run codeam from your project folder to enable file change emission.`
|
|
@@ -10895,7 +10987,7 @@ function closeAllTerminals() {
|
|
|
10895
10987
|
|
|
10896
10988
|
// src/commands/start/handlers.ts
|
|
10897
10989
|
var fs62 = __toESM(require("fs"));
|
|
10898
|
-
var
|
|
10990
|
+
var os51 = __toESM(require("os"));
|
|
10899
10991
|
var path66 = __toESM(require("path"));
|
|
10900
10992
|
var import_crypto3 = require("crypto");
|
|
10901
10993
|
var import_child_process24 = require("child_process");
|
|
@@ -13690,7 +13782,7 @@ function subscribeToPairCompletion(pluginId, onPaired, onTimeout, pollSecret) {
|
|
|
13690
13782
|
onPaired(info);
|
|
13691
13783
|
};
|
|
13692
13784
|
dispatchers.add(dispatch);
|
|
13693
|
-
const
|
|
13785
|
+
const connect2 = () => {
|
|
13694
13786
|
if (stopped) return;
|
|
13695
13787
|
const url2 = new URL(`${API_BASE5}/api/commands/pending/stream`);
|
|
13696
13788
|
url2.searchParams.set("pluginId", pluginId);
|
|
@@ -13716,7 +13808,7 @@ function subscribeToPairCompletion(pluginId, onPaired, onTimeout, pollSecret) {
|
|
|
13716
13808
|
`sse status=${res.statusCode}; will reconnect in 1s`
|
|
13717
13809
|
);
|
|
13718
13810
|
res.resume();
|
|
13719
|
-
setTimeout(
|
|
13811
|
+
setTimeout(connect2, 1e3);
|
|
13720
13812
|
return;
|
|
13721
13813
|
}
|
|
13722
13814
|
let buf = "";
|
|
@@ -13731,23 +13823,23 @@ function subscribeToPairCompletion(pluginId, onPaired, onTimeout, pollSecret) {
|
|
|
13731
13823
|
}
|
|
13732
13824
|
});
|
|
13733
13825
|
res.on("end", () => {
|
|
13734
|
-
if (!stopped) setTimeout(
|
|
13826
|
+
if (!stopped) setTimeout(connect2, 250);
|
|
13735
13827
|
});
|
|
13736
13828
|
res.on("error", () => {
|
|
13737
|
-
if (!stopped) setTimeout(
|
|
13829
|
+
if (!stopped) setTimeout(connect2, 1e3);
|
|
13738
13830
|
});
|
|
13739
13831
|
}
|
|
13740
13832
|
);
|
|
13741
13833
|
req.on("error", () => {
|
|
13742
|
-
if (!stopped) setTimeout(
|
|
13834
|
+
if (!stopped) setTimeout(connect2, 1e3);
|
|
13743
13835
|
});
|
|
13744
13836
|
req.on("timeout", () => {
|
|
13745
13837
|
req?.destroy();
|
|
13746
|
-
if (!stopped) setTimeout(
|
|
13838
|
+
if (!stopped) setTimeout(connect2, 250);
|
|
13747
13839
|
});
|
|
13748
13840
|
req.end();
|
|
13749
13841
|
};
|
|
13750
|
-
|
|
13842
|
+
connect2();
|
|
13751
13843
|
timeoutTimer = setTimeout(() => {
|
|
13752
13844
|
stop();
|
|
13753
13845
|
onTimeout();
|
|
@@ -13785,7 +13877,7 @@ function parseFrame(frame, dispatch) {
|
|
|
13785
13877
|
|
|
13786
13878
|
// src/os/posix.ts
|
|
13787
13879
|
var fs13 = __toESM(require("fs"));
|
|
13788
|
-
var
|
|
13880
|
+
var os10 = __toESM(require("os"));
|
|
13789
13881
|
var path14 = __toESM(require("path"));
|
|
13790
13882
|
var import_node_crypto2 = require("crypto");
|
|
13791
13883
|
|
|
@@ -13810,7 +13902,7 @@ function findInPathFor(name, opts) {
|
|
|
13810
13902
|
// src/services/pty/unix.strategy.ts
|
|
13811
13903
|
var import_child_process7 = require("child_process");
|
|
13812
13904
|
var fs12 = __toESM(require("fs"));
|
|
13813
|
-
var
|
|
13905
|
+
var os9 = __toESM(require("os"));
|
|
13814
13906
|
var path13 = __toESM(require("path"));
|
|
13815
13907
|
|
|
13816
13908
|
// src/services/pty/types.ts
|
|
@@ -13893,7 +13985,7 @@ var UnixPtyStrategy = class {
|
|
|
13893
13985
|
}
|
|
13894
13986
|
const cols = process.stdout.columns || 220;
|
|
13895
13987
|
const rows = process.stdout.rows || 50;
|
|
13896
|
-
this.helperPath = path13.join(
|
|
13988
|
+
this.helperPath = path13.join(os9.tmpdir(), "codeam-pty-helper.py");
|
|
13897
13989
|
fs12.writeFileSync(this.helperPath, PYTHON_PTY_HELPER, { mode: 420 });
|
|
13898
13990
|
this.proc = (0, import_child_process7.spawn)(python, [this.helperPath, cmd, ...args2], {
|
|
13899
13991
|
stdio: ["pipe", "pipe", "inherit"],
|
|
@@ -14031,11 +14123,11 @@ var UnixPtyStrategy = class {
|
|
|
14031
14123
|
// src/os/posix.ts
|
|
14032
14124
|
var PosixOsStrategy = class {
|
|
14033
14125
|
homeDir() {
|
|
14034
|
-
return
|
|
14126
|
+
return os10.homedir();
|
|
14035
14127
|
}
|
|
14036
14128
|
scratchPath(prefix) {
|
|
14037
14129
|
const tag = `${process.pid}-${(0, import_node_crypto2.randomBytes)(4).toString("hex")}`;
|
|
14038
|
-
return path14.join(
|
|
14130
|
+
return path14.join(os10.tmpdir(), `${prefix}-${tag}`);
|
|
14039
14131
|
}
|
|
14040
14132
|
devNull() {
|
|
14041
14133
|
return "/dev/null";
|
|
@@ -14090,7 +14182,7 @@ var LinuxOsStrategy = class extends PosixOsStrategy {
|
|
|
14090
14182
|
|
|
14091
14183
|
// src/os/win32.ts
|
|
14092
14184
|
var fs14 = __toESM(require("fs"));
|
|
14093
|
-
var
|
|
14185
|
+
var os11 = __toESM(require("os"));
|
|
14094
14186
|
var path16 = __toESM(require("path"));
|
|
14095
14187
|
var import_node_crypto3 = require("crypto");
|
|
14096
14188
|
|
|
@@ -14283,11 +14375,11 @@ var WINDOWS_EXEC_EXTS = [".exe", ".cmd", ".bat", ".ps1"];
|
|
|
14283
14375
|
var Win32OsStrategy = class {
|
|
14284
14376
|
id = "win32";
|
|
14285
14377
|
homeDir() {
|
|
14286
|
-
return
|
|
14378
|
+
return os11.homedir();
|
|
14287
14379
|
}
|
|
14288
14380
|
scratchPath(prefix) {
|
|
14289
14381
|
const tag = `${process.pid}-${(0, import_node_crypto3.randomBytes)(4).toString("hex")}`;
|
|
14290
|
-
return path16.join(
|
|
14382
|
+
return path16.join(os11.tmpdir(), `${prefix}-${tag}`);
|
|
14291
14383
|
}
|
|
14292
14384
|
devNull() {
|
|
14293
14385
|
return "NUL";
|
|
@@ -14406,18 +14498,18 @@ function buildForPlatform(platform3) {
|
|
|
14406
14498
|
var import_node_crypto4 = require("crypto");
|
|
14407
14499
|
|
|
14408
14500
|
// src/agents/claude/resolver.ts
|
|
14409
|
-
function buildClaudeLaunch(extraArgs = [],
|
|
14410
|
-
const found =
|
|
14501
|
+
function buildClaudeLaunch(extraArgs = [], os64 = createOsStrategy()) {
|
|
14502
|
+
const found = os64.findInPath("claude") ?? os64.findInPath("claude-code");
|
|
14411
14503
|
if (!found) return null;
|
|
14412
|
-
return
|
|
14504
|
+
return os64.buildLaunch(found, extraArgs);
|
|
14413
14505
|
}
|
|
14414
14506
|
|
|
14415
14507
|
// src/agents/claude/installer.ts
|
|
14416
14508
|
var import_child_process9 = require("child_process");
|
|
14417
14509
|
var path17 = __toESM(require("path"));
|
|
14418
|
-
var
|
|
14510
|
+
var os12 = __toESM(require("os"));
|
|
14419
14511
|
function probeInstallDirs() {
|
|
14420
|
-
const home =
|
|
14512
|
+
const home = os12.homedir();
|
|
14421
14513
|
if (process.platform === "win32") {
|
|
14422
14514
|
return [
|
|
14423
14515
|
path17.join(home, ".claude", "local"),
|
|
@@ -14499,7 +14591,7 @@ var import_node_child_process3 = require("child_process");
|
|
|
14499
14591
|
// src/agents/claude/local-token.ts
|
|
14500
14592
|
var import_node_child_process2 = require("child_process");
|
|
14501
14593
|
var fs15 = __toESM(require("fs"));
|
|
14502
|
-
var
|
|
14594
|
+
var os13 = __toESM(require("os"));
|
|
14503
14595
|
var path18 = __toESM(require("path"));
|
|
14504
14596
|
var import_node_util3 = require("util");
|
|
14505
14597
|
var execFileP2 = (0, import_node_util3.promisify)(import_node_child_process2.execFile);
|
|
@@ -14510,7 +14602,7 @@ var KEYCHAIN_SERVICE_NAMES = [
|
|
|
14510
14602
|
"Anthropic Claude"
|
|
14511
14603
|
];
|
|
14512
14604
|
function claudeCredentialsPaths() {
|
|
14513
|
-
const home =
|
|
14605
|
+
const home = os13.homedir();
|
|
14514
14606
|
return [
|
|
14515
14607
|
path18.join(home, ".claude", ".credentials.json"),
|
|
14516
14608
|
path18.join(home, ".config", "claude", ".credentials.json")
|
|
@@ -14545,7 +14637,7 @@ async function extractLocalClaudeToken() {
|
|
|
14545
14637
|
}
|
|
14546
14638
|
function readClaudeAgentState() {
|
|
14547
14639
|
const STATE_MAX_BYTES = 256 * 1024;
|
|
14548
|
-
const candidate = path18.join(
|
|
14640
|
+
const candidate = path18.join(os13.homedir(), ".claude.json");
|
|
14549
14641
|
try {
|
|
14550
14642
|
if (!fs15.existsSync(candidate)) return void 0;
|
|
14551
14643
|
const buf = fs15.readFileSync(candidate);
|
|
@@ -14636,7 +14728,7 @@ function claudeLoginLauncher() {
|
|
|
14636
14728
|
|
|
14637
14729
|
// src/agents/claude/quota.ts
|
|
14638
14730
|
var fs16 = __toESM(require("fs"));
|
|
14639
|
-
var
|
|
14731
|
+
var os14 = __toESM(require("os"));
|
|
14640
14732
|
var path19 = __toESM(require("path"));
|
|
14641
14733
|
var import_child_process10 = require("child_process");
|
|
14642
14734
|
var HELPER_SCRIPT = `import os,pty,sys,select,signal,struct,fcntl,termios,errno
|
|
@@ -14700,7 +14792,7 @@ async function fetchClaudeQuota() {
|
|
|
14700
14792
|
resolve9(null);
|
|
14701
14793
|
return;
|
|
14702
14794
|
}
|
|
14703
|
-
const helperPath = path19.join(
|
|
14795
|
+
const helperPath = path19.join(os14.tmpdir(), "codeam-quota-helper.py");
|
|
14704
14796
|
fs16.writeFileSync(helperPath, HELPER_SCRIPT, { mode: 420 });
|
|
14705
14797
|
const python = findInPath("python3") ?? findInPath("python");
|
|
14706
14798
|
if (!python) {
|
|
@@ -14814,12 +14906,12 @@ async function spawnAndCapture(cmd, args2, opts = {}) {
|
|
|
14814
14906
|
// src/agents/claude/history.ts
|
|
14815
14907
|
var fs17 = __toESM(require("fs"));
|
|
14816
14908
|
var path20 = __toESM(require("path"));
|
|
14817
|
-
var
|
|
14909
|
+
var os15 = __toESM(require("os"));
|
|
14818
14910
|
function encodeCwd(cwd) {
|
|
14819
14911
|
return cwd.replace(/[\\/:_]/g, "-");
|
|
14820
14912
|
}
|
|
14821
14913
|
function resolveHistoryDir(cwd, projectsRoot) {
|
|
14822
|
-
const root = projectsRoot ?? path20.join(
|
|
14914
|
+
const root = projectsRoot ?? path20.join(os15.homedir(), ".claude", "projects");
|
|
14823
14915
|
const primary = path20.join(root, encodeCwd(cwd));
|
|
14824
14916
|
if (fs17.existsSync(primary)) return primary;
|
|
14825
14917
|
try {
|
|
@@ -14999,8 +15091,8 @@ var ClaudeRuntimeStrategy = class {
|
|
|
14999
15091
|
meta = getAgent("claude");
|
|
15000
15092
|
mode = "interactive";
|
|
15001
15093
|
os;
|
|
15002
|
-
constructor(
|
|
15003
|
-
this.os =
|
|
15094
|
+
constructor(os64) {
|
|
15095
|
+
this.os = os64;
|
|
15004
15096
|
}
|
|
15005
15097
|
/**
|
|
15006
15098
|
* Claude Code's react-ink TUI enables bracketed-paste mode at
|
|
@@ -15136,23 +15228,23 @@ var ClaudeRuntimeStrategy = class {
|
|
|
15136
15228
|
|
|
15137
15229
|
// src/agents/claude/deploy.ts
|
|
15138
15230
|
var fs19 = __toESM(require("fs"));
|
|
15139
|
-
var
|
|
15231
|
+
var os17 = __toESM(require("os"));
|
|
15140
15232
|
var path22 = __toESM(require("path"));
|
|
15141
15233
|
|
|
15142
15234
|
// src/agents/claude/credentials.ts
|
|
15143
15235
|
var import_child_process12 = require("child_process");
|
|
15144
15236
|
var fs18 = __toESM(require("fs"));
|
|
15145
|
-
var
|
|
15237
|
+
var os16 = __toESM(require("os"));
|
|
15146
15238
|
var path21 = __toESM(require("path"));
|
|
15147
15239
|
var import_util2 = require("util");
|
|
15148
15240
|
var execFileP3 = (0, import_util2.promisify)(import_child_process12.execFile);
|
|
15149
15241
|
async function detectLocalClaudeCredentials() {
|
|
15150
|
-
const localClaudeDir = path21.join(
|
|
15242
|
+
const localClaudeDir = path21.join(os16.homedir(), ".claude");
|
|
15151
15243
|
const flat = path21.join(localClaudeDir, ".credentials.json");
|
|
15152
15244
|
if (fs18.existsSync(flat)) {
|
|
15153
15245
|
return { source: "flat-file", description: "~/.claude/.credentials.json" };
|
|
15154
15246
|
}
|
|
15155
|
-
if (
|
|
15247
|
+
if (os16.platform() === "darwin") {
|
|
15156
15248
|
try {
|
|
15157
15249
|
await execFileP3(
|
|
15158
15250
|
"security",
|
|
@@ -15167,7 +15259,7 @@ async function detectLocalClaudeCredentials() {
|
|
|
15167
15259
|
return { source: "none", description: "" };
|
|
15168
15260
|
}
|
|
15169
15261
|
async function bridgeClaudeCredentials(provider, workspaceId) {
|
|
15170
|
-
const localClaudeDir = path21.join(
|
|
15262
|
+
const localClaudeDir = path21.join(os16.homedir(), ".claude");
|
|
15171
15263
|
const fileBased = path21.join(localClaudeDir, ".credentials.json");
|
|
15172
15264
|
if (fs18.existsSync(fileBased)) {
|
|
15173
15265
|
return { source: "flat-file", description: "~/.claude/.credentials.json" };
|
|
@@ -15261,7 +15353,7 @@ var ClaudeDeployStrategy = class {
|
|
|
15261
15353
|
process.exit(1);
|
|
15262
15354
|
}
|
|
15263
15355
|
claudeStep.stop("\u2713 Claude CLI installed");
|
|
15264
|
-
const localClaudeDir = path22.join(
|
|
15356
|
+
const localClaudeDir = path22.join(os17.homedir(), ".claude");
|
|
15265
15357
|
const haveLocalClaude = fs19.existsSync(localClaudeDir) && fs19.statSync(localClaudeDir).isDirectory();
|
|
15266
15358
|
if (haveLocalClaude) {
|
|
15267
15359
|
const copyStep = fe();
|
|
@@ -15316,7 +15408,7 @@ var ClaudeDeployStrategy = class {
|
|
|
15316
15408
|
}
|
|
15317
15409
|
}
|
|
15318
15410
|
if (opts.bridged !== "none") {
|
|
15319
|
-
const localClaudeJson = path22.join(
|
|
15411
|
+
const localClaudeJson = path22.join(os17.homedir(), ".claude.json");
|
|
15320
15412
|
if (fs19.existsSync(localClaudeJson)) {
|
|
15321
15413
|
try {
|
|
15322
15414
|
const contents = fs19.readFileSync(localClaudeJson);
|
|
@@ -15713,10 +15805,10 @@ var import_node_child_process4 = require("child_process");
|
|
|
15713
15805
|
|
|
15714
15806
|
// src/agents/codex/local-token.ts
|
|
15715
15807
|
var fs21 = __toESM(require("fs"));
|
|
15716
|
-
var
|
|
15808
|
+
var os19 = __toESM(require("os"));
|
|
15717
15809
|
var path24 = __toESM(require("path"));
|
|
15718
15810
|
function codexCredentialsPath() {
|
|
15719
|
-
return path24.join(
|
|
15811
|
+
return path24.join(os19.homedir(), ".codex", "auth.json");
|
|
15720
15812
|
}
|
|
15721
15813
|
async function extractLocalCodexToken() {
|
|
15722
15814
|
const file = codexCredentialsPath();
|
|
@@ -15780,8 +15872,8 @@ function codexCredentialLocator() {
|
|
|
15780
15872
|
function codexLoginLauncher() {
|
|
15781
15873
|
return {
|
|
15782
15874
|
async ensureInstalled() {
|
|
15783
|
-
const
|
|
15784
|
-
return
|
|
15875
|
+
const os64 = createOsStrategy();
|
|
15876
|
+
return os64.findInPath("codex") !== null;
|
|
15785
15877
|
},
|
|
15786
15878
|
launch() {
|
|
15787
15879
|
return (0, import_node_child_process4.spawn)("codex", ["login"], { stdio: "inherit" });
|
|
@@ -15804,8 +15896,8 @@ var CodexRuntimeStrategy = class {
|
|
|
15804
15896
|
meta = getAgent("codex");
|
|
15805
15897
|
mode = "interactive";
|
|
15806
15898
|
os;
|
|
15807
|
-
constructor(
|
|
15808
|
-
this.os =
|
|
15899
|
+
constructor(os64) {
|
|
15900
|
+
this.os = os64;
|
|
15809
15901
|
}
|
|
15810
15902
|
async prepareLaunch() {
|
|
15811
15903
|
let binary = this.os.findInPath("codex");
|
|
@@ -15914,12 +16006,12 @@ var CodexRuntimeStrategy = class {
|
|
|
15914
16006
|
});
|
|
15915
16007
|
}
|
|
15916
16008
|
};
|
|
15917
|
-
function resolveNpm(
|
|
15918
|
-
return
|
|
16009
|
+
function resolveNpm(os64) {
|
|
16010
|
+
return os64.id === "win32" ? "npm.cmd" : "npm";
|
|
15919
16011
|
}
|
|
15920
|
-
async function installCodexViaNpm(
|
|
16012
|
+
async function installCodexViaNpm(os64) {
|
|
15921
16013
|
return new Promise((resolve9, reject) => {
|
|
15922
|
-
const proc = (0, import_node_child_process5.spawn)(resolveNpm(
|
|
16014
|
+
const proc = (0, import_node_child_process5.spawn)(resolveNpm(os64), ["install", "-g", "@openai/codex"], {
|
|
15923
16015
|
stdio: "inherit"
|
|
15924
16016
|
});
|
|
15925
16017
|
proc.on("close", (code) => {
|
|
@@ -15936,16 +16028,16 @@ async function installCodexViaNpm(os63) {
|
|
|
15936
16028
|
});
|
|
15937
16029
|
});
|
|
15938
16030
|
}
|
|
15939
|
-
function augmentNpmGlobalBin(
|
|
16031
|
+
function augmentNpmGlobalBin(os64) {
|
|
15940
16032
|
try {
|
|
15941
|
-
const result = (0, import_node_child_process5.spawnSync)(resolveNpm(
|
|
16033
|
+
const result = (0, import_node_child_process5.spawnSync)(resolveNpm(os64), ["prefix", "-g"], {
|
|
15942
16034
|
stdio: ["ignore", "pipe", "ignore"]
|
|
15943
16035
|
});
|
|
15944
16036
|
if (result.status !== 0) return;
|
|
15945
16037
|
const prefix = result.stdout.toString().trim();
|
|
15946
16038
|
if (!prefix) return;
|
|
15947
|
-
const binDir =
|
|
15948
|
-
|
|
16039
|
+
const binDir = os64.id === "win32" ? prefix : path25.join(prefix, "bin");
|
|
16040
|
+
os64.augmentPath([binDir]);
|
|
15949
16041
|
} catch {
|
|
15950
16042
|
}
|
|
15951
16043
|
}
|
|
@@ -16029,9 +16121,9 @@ var import_node_child_process8 = require("child_process");
|
|
|
16029
16121
|
// src/agents/coderabbit/installer.ts
|
|
16030
16122
|
var import_node_child_process6 = require("child_process");
|
|
16031
16123
|
var INSTALL_URL = "https://cli.coderabbit.ai/install.sh";
|
|
16032
|
-
async function ensureCoderabbitInstalled(
|
|
16033
|
-
if (
|
|
16034
|
-
if (
|
|
16124
|
+
async function ensureCoderabbitInstalled(os64) {
|
|
16125
|
+
if (os64.findInPath("coderabbit")) return true;
|
|
16126
|
+
if (os64.id === "win32") {
|
|
16035
16127
|
console.error(
|
|
16036
16128
|
"\n \u2717 CodeRabbit on Windows requires WSL.\n Install the CLI inside your WSL distribution\n (curl -fsSL https://cli.coderabbit.ai/install.sh | sh)\n then re-run `codeam link coderabbit` from WSL.\n"
|
|
16037
16129
|
);
|
|
@@ -16064,14 +16156,14 @@ async function ensureCoderabbitInstalled(os63) {
|
|
|
16064
16156
|
proc.on("error", () => finish(false));
|
|
16065
16157
|
});
|
|
16066
16158
|
if (!ok) return false;
|
|
16067
|
-
|
|
16068
|
-
return
|
|
16159
|
+
os64.augmentPath([`${os64.homeDir()}/.local/bin`, "/opt/homebrew/bin"]);
|
|
16160
|
+
return os64.findInPath("coderabbit") !== null;
|
|
16069
16161
|
}
|
|
16070
16162
|
|
|
16071
16163
|
// src/agents/coderabbit/link.ts
|
|
16072
16164
|
var import_node_child_process7 = require("child_process");
|
|
16073
16165
|
var fs23 = __toESM(require("fs"));
|
|
16074
|
-
var
|
|
16166
|
+
var os21 = __toESM(require("os"));
|
|
16075
16167
|
var path27 = __toESM(require("path"));
|
|
16076
16168
|
|
|
16077
16169
|
// src/agents/strategy.ts
|
|
@@ -16081,7 +16173,7 @@ function validateNonEmptyCredential(token) {
|
|
|
16081
16173
|
|
|
16082
16174
|
// src/agents/coderabbit/link.ts
|
|
16083
16175
|
function authPath() {
|
|
16084
|
-
return path27.join(
|
|
16176
|
+
return path27.join(os21.homedir(), ".coderabbit", "auth.json");
|
|
16085
16177
|
}
|
|
16086
16178
|
async function extractLocalCoderabbitToken() {
|
|
16087
16179
|
const file = authPath();
|
|
@@ -16100,10 +16192,10 @@ function coderabbitCredentialLocator() {
|
|
|
16100
16192
|
validate: validateNonEmptyCredential
|
|
16101
16193
|
};
|
|
16102
16194
|
}
|
|
16103
|
-
function coderabbitLoginLauncher(
|
|
16195
|
+
function coderabbitLoginLauncher(os64) {
|
|
16104
16196
|
return {
|
|
16105
16197
|
async ensureInstalled() {
|
|
16106
|
-
return ensureCoderabbitInstalled(
|
|
16198
|
+
return ensureCoderabbitInstalled(os64);
|
|
16107
16199
|
},
|
|
16108
16200
|
launch() {
|
|
16109
16201
|
return (0, import_node_child_process7.spawn)("coderabbit", ["auth", "login"], { stdio: "inherit" });
|
|
@@ -16323,8 +16415,8 @@ var CoderabbitRuntimeStrategy = class {
|
|
|
16323
16415
|
meta = getAgent("coderabbit");
|
|
16324
16416
|
mode = "batch";
|
|
16325
16417
|
os;
|
|
16326
|
-
constructor(
|
|
16327
|
-
this.os =
|
|
16418
|
+
constructor(os64) {
|
|
16419
|
+
this.os = os64;
|
|
16328
16420
|
}
|
|
16329
16421
|
getDefaultArgs() {
|
|
16330
16422
|
return ["review", "--agent"];
|
|
@@ -16427,11 +16519,11 @@ CodeRabbit review timed out after ${Math.round(
|
|
|
16427
16519
|
|
|
16428
16520
|
// src/agents/cursor/history.ts
|
|
16429
16521
|
var fs24 = __toESM(require("fs"));
|
|
16430
|
-
var
|
|
16522
|
+
var os22 = __toESM(require("os"));
|
|
16431
16523
|
var path28 = __toESM(require("path"));
|
|
16432
16524
|
var import_node_crypto5 = require("crypto");
|
|
16433
|
-
var HISTORY_ROOT = path28.join(
|
|
16434
|
-
var CURSOR_HOME = path28.join(
|
|
16525
|
+
var HISTORY_ROOT = path28.join(os22.homedir(), ".cursor", "projects");
|
|
16526
|
+
var CURSOR_HOME = path28.join(os22.homedir(), ".cursor");
|
|
16435
16527
|
var STORE_FILES = ["store.db", "store.db-wal", "store.db-shm"];
|
|
16436
16528
|
function acpSessionDir(sessionId) {
|
|
16437
16529
|
return path28.join(CURSOR_HOME, "acp-sessions", sessionId);
|
|
@@ -16568,10 +16660,10 @@ var import_node_child_process9 = require("child_process");
|
|
|
16568
16660
|
|
|
16569
16661
|
// src/agents/cursor/local-token.ts
|
|
16570
16662
|
var fs25 = __toESM(require("fs"));
|
|
16571
|
-
var
|
|
16663
|
+
var os23 = __toESM(require("os"));
|
|
16572
16664
|
var path29 = __toESM(require("path"));
|
|
16573
16665
|
function cursorCredentialsPath() {
|
|
16574
|
-
return path29.join(
|
|
16666
|
+
return path29.join(os23.homedir(), ".cursor", "auth.json");
|
|
16575
16667
|
}
|
|
16576
16668
|
async function extractLocalCursorToken() {
|
|
16577
16669
|
const file = cursorCredentialsPath();
|
|
@@ -16595,10 +16687,10 @@ function cursorCredentialLocator() {
|
|
|
16595
16687
|
validate: validateNonEmptyCredential
|
|
16596
16688
|
};
|
|
16597
16689
|
}
|
|
16598
|
-
function cursorLoginLauncher(
|
|
16690
|
+
function cursorLoginLauncher(os64) {
|
|
16599
16691
|
return {
|
|
16600
16692
|
async ensureInstalled() {
|
|
16601
|
-
if (
|
|
16693
|
+
if (os64.findInPath("cursor-agent")) return true;
|
|
16602
16694
|
console.error(
|
|
16603
16695
|
"\n \u2717 cursor-agent binary not on PATH.\n Install Cursor (https://cursor.com/) and ensure the CLI\n plugin is enabled, then re-run `codeam link cursor`.\n"
|
|
16604
16696
|
);
|
|
@@ -16662,8 +16754,8 @@ var CursorRuntimeStrategy = class {
|
|
|
16662
16754
|
meta = getAgent("cursor");
|
|
16663
16755
|
mode = "interactive";
|
|
16664
16756
|
os;
|
|
16665
|
-
constructor(
|
|
16666
|
-
this.os =
|
|
16757
|
+
constructor(os64) {
|
|
16758
|
+
this.os = os64;
|
|
16667
16759
|
}
|
|
16668
16760
|
async prepareLaunch() {
|
|
16669
16761
|
const binary = this.os.findInPath("cursor-agent");
|
|
@@ -16838,9 +16930,9 @@ var import_node_child_process11 = require("child_process");
|
|
|
16838
16930
|
|
|
16839
16931
|
// src/agents/aider/local-token.ts
|
|
16840
16932
|
var fs27 = __toESM(require("fs"));
|
|
16841
|
-
var
|
|
16933
|
+
var os24 = __toESM(require("os"));
|
|
16842
16934
|
var path31 = __toESM(require("path"));
|
|
16843
|
-
var AIDER_CONF_FILE = path31.join(
|
|
16935
|
+
var AIDER_CONF_FILE = path31.join(os24.homedir(), ".aider.conf.yml");
|
|
16844
16936
|
var API_KEY_ENV_VARS = [
|
|
16845
16937
|
"ANTHROPIC_API_KEY",
|
|
16846
16938
|
"OPENAI_API_KEY",
|
|
@@ -16879,10 +16971,10 @@ function aiderCredentialLocator() {
|
|
|
16879
16971
|
validate: validateNonEmptyCredential
|
|
16880
16972
|
};
|
|
16881
16973
|
}
|
|
16882
|
-
function aiderLoginLauncher(
|
|
16974
|
+
function aiderLoginLauncher(os64) {
|
|
16883
16975
|
return {
|
|
16884
16976
|
async ensureInstalled() {
|
|
16885
|
-
if (
|
|
16977
|
+
if (os64.findInPath("aider")) return true;
|
|
16886
16978
|
console.error(
|
|
16887
16979
|
"\n \u2717 aider binary not on PATH.\n Install Aider:\n pip install aider-chat\n then re-run `codeam link aider`.\n"
|
|
16888
16980
|
);
|
|
@@ -16892,7 +16984,7 @@ function aiderLoginLauncher(os63) {
|
|
|
16892
16984
|
console.error(
|
|
16893
16985
|
"\n Aider has no interactive login flow.\n Set ANTHROPIC_API_KEY or OPENAI_API_KEY in your shell,\n or re-run `codeam link aider --api-key=<your-key>`.\n"
|
|
16894
16986
|
);
|
|
16895
|
-
return (0, import_node_child_process11.spawn)(
|
|
16987
|
+
return (0, import_node_child_process11.spawn)(os64.id === "win32" ? "cmd.exe" : "sh", os64.id === "win32" ? ["/c", "exit", "0"] : ["-c", "exit 0"], {
|
|
16896
16988
|
stdio: "ignore"
|
|
16897
16989
|
});
|
|
16898
16990
|
}
|
|
@@ -16964,8 +17056,8 @@ var AiderRuntimeStrategy = class {
|
|
|
16964
17056
|
meta = getAgent("aider");
|
|
16965
17057
|
mode = "interactive";
|
|
16966
17058
|
os;
|
|
16967
|
-
constructor(
|
|
16968
|
-
this.os =
|
|
17059
|
+
constructor(os64) {
|
|
17060
|
+
this.os = os64;
|
|
16969
17061
|
}
|
|
16970
17062
|
async prepareLaunch() {
|
|
16971
17063
|
const binary = this.os.findInPath("aider");
|
|
@@ -17040,10 +17132,10 @@ var import_node_child_process12 = require("child_process");
|
|
|
17040
17132
|
|
|
17041
17133
|
// src/agents/gemini/local-token.ts
|
|
17042
17134
|
var fs28 = __toESM(require("fs"));
|
|
17043
|
-
var
|
|
17135
|
+
var os25 = __toESM(require("os"));
|
|
17044
17136
|
var path32 = __toESM(require("path"));
|
|
17045
17137
|
function geminiCredentialsPath() {
|
|
17046
|
-
return path32.join(
|
|
17138
|
+
return path32.join(os25.homedir(), ".gemini", "oauth_creds.json");
|
|
17047
17139
|
}
|
|
17048
17140
|
function geminiCredentialsPaths() {
|
|
17049
17141
|
return [geminiCredentialsPath()];
|
|
@@ -17097,8 +17189,8 @@ function geminiCredentialLocator() {
|
|
|
17097
17189
|
function geminiLoginLauncher() {
|
|
17098
17190
|
return {
|
|
17099
17191
|
async ensureInstalled() {
|
|
17100
|
-
const
|
|
17101
|
-
return
|
|
17192
|
+
const os64 = createOsStrategy();
|
|
17193
|
+
return os64.findInPath("gemini") !== null;
|
|
17102
17194
|
},
|
|
17103
17195
|
launch() {
|
|
17104
17196
|
return (0, import_node_child_process12.spawn)("gemini", ["auth", "login"], { stdio: "inherit" });
|
|
@@ -17108,9 +17200,9 @@ function geminiLoginLauncher() {
|
|
|
17108
17200
|
|
|
17109
17201
|
// src/agents/gemini/history.ts
|
|
17110
17202
|
var fs29 = __toESM(require("fs"));
|
|
17111
|
-
var
|
|
17203
|
+
var os26 = __toESM(require("os"));
|
|
17112
17204
|
var path33 = __toESM(require("path"));
|
|
17113
|
-
var GEMINI_ROOT = path33.join(
|
|
17205
|
+
var GEMINI_ROOT = path33.join(os26.homedir(), ".gemini");
|
|
17114
17206
|
function projectNameForCwd(cwd, root) {
|
|
17115
17207
|
try {
|
|
17116
17208
|
const parsed = JSON.parse(
|
|
@@ -17288,8 +17380,8 @@ var GeminiRuntimeStrategy = class {
|
|
|
17288
17380
|
meta = getAgent("gemini");
|
|
17289
17381
|
mode = "interactive";
|
|
17290
17382
|
os;
|
|
17291
|
-
constructor(
|
|
17292
|
-
this.os =
|
|
17383
|
+
constructor(os64) {
|
|
17384
|
+
this.os = os64;
|
|
17293
17385
|
}
|
|
17294
17386
|
async prepareLaunch() {
|
|
17295
17387
|
const binary = this.os.findInPath("gemini");
|
|
@@ -17403,11 +17495,11 @@ var import_node_path4 = require("path");
|
|
|
17403
17495
|
|
|
17404
17496
|
// src/agents/kimi/history.ts
|
|
17405
17497
|
var fs30 = __toESM(require("fs"));
|
|
17406
|
-
var
|
|
17498
|
+
var os27 = __toESM(require("os"));
|
|
17407
17499
|
var path34 = __toESM(require("path"));
|
|
17408
17500
|
var import_node_crypto7 = require("crypto");
|
|
17409
17501
|
function kimiHome() {
|
|
17410
|
-
return process.env.KIMI_CODE_HOME || path34.join(
|
|
17502
|
+
return process.env.KIMI_CODE_HOME || path34.join(os27.homedir(), ".kimi-code");
|
|
17411
17503
|
}
|
|
17412
17504
|
function workDirKey(cwd) {
|
|
17413
17505
|
const hash = (0, import_node_crypto7.createHash)("sha256").update(cwd).digest("hex").slice(0, 12);
|
|
@@ -17580,8 +17672,8 @@ var KimiRuntimeStrategy = class {
|
|
|
17580
17672
|
meta = getAgent("kimi");
|
|
17581
17673
|
mode = "interactive";
|
|
17582
17674
|
os;
|
|
17583
|
-
constructor(
|
|
17584
|
-
this.os =
|
|
17675
|
+
constructor(os64) {
|
|
17676
|
+
this.os = os64;
|
|
17585
17677
|
}
|
|
17586
17678
|
async prepareLaunch() {
|
|
17587
17679
|
const binary = this.os.findInPath("kimi");
|
|
@@ -17723,8 +17815,8 @@ var OpencodeRuntimeStrategy = class {
|
|
|
17723
17815
|
meta = getAgent("opencode");
|
|
17724
17816
|
mode = "interactive";
|
|
17725
17817
|
os;
|
|
17726
|
-
constructor(
|
|
17727
|
-
this.os =
|
|
17818
|
+
constructor(os64) {
|
|
17819
|
+
this.os = os64;
|
|
17728
17820
|
}
|
|
17729
17821
|
async prepareLaunch() {
|
|
17730
17822
|
const binary = this.os.findInPath("opencode");
|
|
@@ -17808,20 +17900,20 @@ var OpencodeRuntimeStrategy = class {
|
|
|
17808
17900
|
|
|
17809
17901
|
// src/agents/registry.ts
|
|
17810
17902
|
var runtimeBuilders = {
|
|
17811
|
-
claude: (
|
|
17812
|
-
codex: (
|
|
17813
|
-
coderabbit: (
|
|
17814
|
-
cursor: (
|
|
17815
|
-
aider: (
|
|
17816
|
-
gemini: (
|
|
17817
|
-
kimi: (
|
|
17818
|
-
opencode: (
|
|
17903
|
+
claude: (os64) => new ClaudeRuntimeStrategy(os64),
|
|
17904
|
+
codex: (os64) => new CodexRuntimeStrategy(os64),
|
|
17905
|
+
coderabbit: (os64) => new CoderabbitRuntimeStrategy(os64),
|
|
17906
|
+
cursor: (os64) => new CursorRuntimeStrategy(os64),
|
|
17907
|
+
aider: (os64) => new AiderRuntimeStrategy(os64),
|
|
17908
|
+
gemini: (os64) => new GeminiRuntimeStrategy(os64),
|
|
17909
|
+
kimi: (os64) => new KimiRuntimeStrategy(os64),
|
|
17910
|
+
opencode: (os64) => new OpencodeRuntimeStrategy(os64)
|
|
17819
17911
|
};
|
|
17820
17912
|
var deployBuilders = {
|
|
17821
17913
|
claude: () => new ClaudeDeployStrategy(),
|
|
17822
17914
|
codex: () => new CodexDeployStrategy()
|
|
17823
17915
|
};
|
|
17824
|
-
function createAgentStrategy(agent,
|
|
17916
|
+
function createAgentStrategy(agent, os64 = createOsStrategy()) {
|
|
17825
17917
|
if (!AGENT_REGISTRY[agent]?.enabled) {
|
|
17826
17918
|
throw new Error(
|
|
17827
17919
|
`Agent "${agent}" is not supported in this codeam-cli version. Upgrade with 'npm i -g codeam-cli@latest'.`
|
|
@@ -17831,10 +17923,10 @@ function createAgentStrategy(agent, os63 = createOsStrategy()) {
|
|
|
17831
17923
|
if (!build) {
|
|
17832
17924
|
throw new Error(`No runtime strategy registered for agent "${agent}"`);
|
|
17833
17925
|
}
|
|
17834
|
-
return build(
|
|
17926
|
+
return build(os64);
|
|
17835
17927
|
}
|
|
17836
|
-
function createInteractiveAgentStrategy(agent,
|
|
17837
|
-
const s = createAgentStrategy(agent,
|
|
17928
|
+
function createInteractiveAgentStrategy(agent, os64 = createOsStrategy()) {
|
|
17929
|
+
const s = createAgentStrategy(agent, os64);
|
|
17838
17930
|
if (s.mode !== "interactive") {
|
|
17839
17931
|
throw new Error(
|
|
17840
17932
|
`Agent "${agent}" is a batch agent; use createAgentStrategy + .runOneShot for one-shot reviews.`
|
|
@@ -18242,7 +18334,7 @@ var path37 = __toESM(require("path"));
|
|
|
18242
18334
|
// src/agents/coderabbit/oauth.ts
|
|
18243
18335
|
var import_node_child_process15 = require("child_process");
|
|
18244
18336
|
var fs32 = __toESM(require("fs"));
|
|
18245
|
-
var
|
|
18337
|
+
var os28 = __toESM(require("os"));
|
|
18246
18338
|
var path36 = __toESM(require("path"));
|
|
18247
18339
|
function parseCoderabbitAuthEvent(line) {
|
|
18248
18340
|
const l = line.replace(/\x1b\[[0-9;?]*[A-Za-z]/g, "").trim();
|
|
@@ -18292,7 +18384,7 @@ function resolvePython() {
|
|
|
18292
18384
|
function spawnCoderabbitLoginProc(cmd, args2) {
|
|
18293
18385
|
const python = resolvePython();
|
|
18294
18386
|
if (python) {
|
|
18295
|
-
const helper = path36.join(
|
|
18387
|
+
const helper = path36.join(os28.tmpdir(), "codeam-cr-pty.py");
|
|
18296
18388
|
fs32.writeFileSync(helper, PYTHON_PTY_HELPER, { mode: 420 });
|
|
18297
18389
|
return (0, import_node_child_process15.spawn)(python, [helper, cmd, ...args2], {
|
|
18298
18390
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -18404,7 +18496,7 @@ function runCoderabbitOAuthLogin(deps) {
|
|
|
18404
18496
|
});
|
|
18405
18497
|
}
|
|
18406
18498
|
function coderabbitDir(home) {
|
|
18407
|
-
return path36.join(home ??
|
|
18499
|
+
return path36.join(home ?? os28.homedir(), ".coderabbit");
|
|
18408
18500
|
}
|
|
18409
18501
|
var NON_CREDENTIAL = /* @__PURE__ */ new Set(["doctor.json", "machine-id"]);
|
|
18410
18502
|
function snapshotCredentialDir(home) {
|
|
@@ -18531,26 +18623,26 @@ function restoreCoderabbitOauthBlob(value) {
|
|
|
18531
18623
|
(0, import_node_fs5.writeFileSync)(path37.join(dir, file), contents, { mode: 384 });
|
|
18532
18624
|
}
|
|
18533
18625
|
async function configureCoderabbit(input, deps = {}) {
|
|
18534
|
-
const
|
|
18626
|
+
const os64 = deps.os ?? createOsStrategy();
|
|
18535
18627
|
const ensureInstalled = deps.ensureInstalled ?? ensureCoderabbitInstalled;
|
|
18536
18628
|
const isLoggedIn = deps.isLoggedIn ?? defaultIsLoggedIn;
|
|
18537
18629
|
const runOAuth = deps.runOAuthLogin ?? runCoderabbitOAuthLogin;
|
|
18538
18630
|
const snapshot = deps.snapshotDir ?? (() => snapshotCredentialDir());
|
|
18539
18631
|
const capture2 = deps.captureCredential ?? ((b) => diffCapturedCredential(b));
|
|
18540
18632
|
const loginWithApiKey = deps.loginWithApiKey ?? defaultLoginWithApiKey;
|
|
18541
|
-
const home =
|
|
18542
|
-
|
|
18543
|
-
|
|
18633
|
+
const home = os64.homeDir();
|
|
18634
|
+
os64.augmentPath(
|
|
18635
|
+
os64.id === "win32" ? [
|
|
18544
18636
|
path37.join(home, ".local", "bin"),
|
|
18545
18637
|
path37.join(process.env.APPDATA ?? path37.join(home, "AppData", "Roaming"), "npm"),
|
|
18546
18638
|
path37.join(home, "scoop", "shims")
|
|
18547
18639
|
] : [path37.join(home, ".local", "bin"), "/opt/homebrew/bin", "/usr/local/bin"]
|
|
18548
18640
|
);
|
|
18549
|
-
const installed2 =
|
|
18641
|
+
const installed2 = os64.findInPath("coderabbit") !== null;
|
|
18550
18642
|
const base = () => ({
|
|
18551
18643
|
action: input.action,
|
|
18552
18644
|
supported: true,
|
|
18553
|
-
installed:
|
|
18645
|
+
installed: os64.findInPath("coderabbit") !== null,
|
|
18554
18646
|
loggedIn: false
|
|
18555
18647
|
});
|
|
18556
18648
|
if (input.action === "status") {
|
|
@@ -18564,7 +18656,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
18564
18656
|
const key = (input.apiKey ?? "").trim();
|
|
18565
18657
|
if (!key) return { ...res2, error: "No API key provided" };
|
|
18566
18658
|
if (!res2.installed) {
|
|
18567
|
-
const ok = await ensureInstalled(
|
|
18659
|
+
const ok = await ensureInstalled(os64);
|
|
18568
18660
|
res2.installed = ok;
|
|
18569
18661
|
if (!ok) return { ...res2, error: "CodeRabbit CLI could not be installed" };
|
|
18570
18662
|
}
|
|
@@ -18588,7 +18680,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
18588
18680
|
}
|
|
18589
18681
|
if (!res2.installed) {
|
|
18590
18682
|
deps.onEvent?.({ kind: "installing" });
|
|
18591
|
-
const ok = await ensureInstalled(
|
|
18683
|
+
const ok = await ensureInstalled(os64);
|
|
18592
18684
|
res2.installed = ok;
|
|
18593
18685
|
if (!ok) return { ...res2, error: "CodeRabbit CLI could not be installed" };
|
|
18594
18686
|
}
|
|
@@ -18618,7 +18710,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
18618
18710
|
const res2 = base();
|
|
18619
18711
|
if (!installed2) {
|
|
18620
18712
|
deps.onEvent?.({ kind: "installing" });
|
|
18621
|
-
const ok = await ensureInstalled(
|
|
18713
|
+
const ok = await ensureInstalled(os64);
|
|
18622
18714
|
res2.installed = ok;
|
|
18623
18715
|
if (!ok) return { ...res2, error: "CodeRabbit CLI could not be installed" };
|
|
18624
18716
|
}
|
|
@@ -18658,7 +18750,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
18658
18750
|
}
|
|
18659
18751
|
const res = base();
|
|
18660
18752
|
if (!res.installed) {
|
|
18661
|
-
const ok = await ensureInstalled(
|
|
18753
|
+
const ok = await ensureInstalled(os64);
|
|
18662
18754
|
res.installed = ok;
|
|
18663
18755
|
if (!ok) return { ...res, error: "CodeRabbit CLI is not installed" };
|
|
18664
18756
|
}
|
|
@@ -18842,7 +18934,7 @@ function defaultRunGh(args2) {
|
|
|
18842
18934
|
|
|
18843
18935
|
// src/commands/host-agent.ts
|
|
18844
18936
|
var import_node_child_process25 = require("child_process");
|
|
18845
|
-
var
|
|
18937
|
+
var os40 = __toESM(require("os"));
|
|
18846
18938
|
var fs45 = __toESM(require("fs"));
|
|
18847
18939
|
var path48 = __toESM(require("path"));
|
|
18848
18940
|
|
|
@@ -18991,13 +19083,13 @@ function describeReason(reason) {
|
|
|
18991
19083
|
|
|
18992
19084
|
// src/commands/host/host-client.ts
|
|
18993
19085
|
var fs36 = __toESM(require("fs"));
|
|
18994
|
-
var
|
|
19086
|
+
var os32 = __toESM(require("os"));
|
|
18995
19087
|
var path40 = __toESM(require("path"));
|
|
18996
19088
|
var import_node_crypto9 = require("crypto");
|
|
18997
19089
|
function sampleCpuTimes() {
|
|
18998
19090
|
let idle = 0;
|
|
18999
19091
|
let total = 0;
|
|
19000
|
-
for (const cpu of
|
|
19092
|
+
for (const cpu of os32.cpus()) {
|
|
19001
19093
|
const t2 = cpu.times;
|
|
19002
19094
|
idle += t2.idle;
|
|
19003
19095
|
total += t2.user + t2.nice + t2.sys + t2.idle + t2.irq;
|
|
@@ -19016,8 +19108,8 @@ var MetricsCollector = class {
|
|
|
19016
19108
|
const prev = this.prevCpu;
|
|
19017
19109
|
this.prevCpu = current2;
|
|
19018
19110
|
if (!prev) {
|
|
19019
|
-
const cores =
|
|
19020
|
-
const proxy =
|
|
19111
|
+
const cores = os32.cpus().length || 1;
|
|
19112
|
+
const proxy = os32.loadavg()[0] / cores * 100;
|
|
19021
19113
|
return Math.min(100, Math.max(0, Math.round(proxy)));
|
|
19022
19114
|
}
|
|
19023
19115
|
const idleDelta = current2.idle - prev.idle;
|
|
@@ -19030,8 +19122,8 @@ var MetricsCollector = class {
|
|
|
19030
19122
|
collect() {
|
|
19031
19123
|
return {
|
|
19032
19124
|
cpuPct: this.cpuPct(),
|
|
19033
|
-
ramUsedMb: Math.round((
|
|
19034
|
-
ramTotalMb: Math.round(
|
|
19125
|
+
ramUsedMb: Math.round((os32.totalmem() - os32.freemem()) / 1048576),
|
|
19126
|
+
ramTotalMb: Math.round(os32.totalmem() / 1048576),
|
|
19035
19127
|
latencyMs: this.lastLatencyMs
|
|
19036
19128
|
};
|
|
19037
19129
|
}
|
|
@@ -19040,13 +19132,13 @@ function apiBase() {
|
|
|
19040
19132
|
return process.env.CODEAM_API_URL ?? resolveApiBaseUrl();
|
|
19041
19133
|
}
|
|
19042
19134
|
function hostIdentityPath() {
|
|
19043
|
-
return path40.join(
|
|
19135
|
+
return path40.join(os32.homedir(), ".codeam", "host-agent.json");
|
|
19044
19136
|
}
|
|
19045
19137
|
function collectOsInfo() {
|
|
19046
19138
|
return {
|
|
19047
|
-
distro:
|
|
19048
|
-
arch:
|
|
19049
|
-
kernel:
|
|
19139
|
+
distro: os32.platform(),
|
|
19140
|
+
arch: os32.arch(),
|
|
19141
|
+
kernel: os32.release(),
|
|
19050
19142
|
nodeVersion: process.versions.node
|
|
19051
19143
|
};
|
|
19052
19144
|
}
|
|
@@ -19141,7 +19233,7 @@ async function postJson(pathname, body) {
|
|
|
19141
19233
|
function resolveHostLabel(label) {
|
|
19142
19234
|
const explicit = label?.trim();
|
|
19143
19235
|
const envLabel = process.env.CODEAM_HOST_LABEL?.trim();
|
|
19144
|
-
const resolved = explicit || envLabel ||
|
|
19236
|
+
const resolved = explicit || envLabel || os32.hostname();
|
|
19145
19237
|
return resolved.slice(0, 80);
|
|
19146
19238
|
}
|
|
19147
19239
|
async function redeemEnrollToken(token, label) {
|
|
@@ -19253,7 +19345,7 @@ async function reportDeployProgress(auth, deployId, step, message, sessionId) {
|
|
|
19253
19345
|
|
|
19254
19346
|
// src/commands/host/workspace.ts
|
|
19255
19347
|
var fs37 = __toESM(require("fs"));
|
|
19256
|
-
var
|
|
19348
|
+
var os33 = __toESM(require("os"));
|
|
19257
19349
|
var path41 = __toESM(require("path"));
|
|
19258
19350
|
var import_node_child_process19 = require("child_process");
|
|
19259
19351
|
var import_node_util4 = require("util");
|
|
@@ -19262,7 +19354,7 @@ function isAbsolutePathTarget(target) {
|
|
|
19262
19354
|
return path41.isAbsolute(target);
|
|
19263
19355
|
}
|
|
19264
19356
|
function selfHostedWorkspaceRoot() {
|
|
19265
|
-
return path41.join(
|
|
19357
|
+
return path41.join(os33.homedir(), ".codeam", "self-hosted");
|
|
19266
19358
|
}
|
|
19267
19359
|
function nonInteractiveGitEnv() {
|
|
19268
19360
|
return {
|
|
@@ -19402,7 +19494,7 @@ async function prepareWorkspace(repoOrPath, deployId, cloneToken, provider = "gi
|
|
|
19402
19494
|
|
|
19403
19495
|
// src/commands/host/agent-provisioning.ts
|
|
19404
19496
|
var fs38 = __toESM(require("fs"));
|
|
19405
|
-
var
|
|
19497
|
+
var os34 = __toESM(require("os"));
|
|
19406
19498
|
var path42 = __toESM(require("path"));
|
|
19407
19499
|
var PUBLIC_TO_INTERNAL_AGENT = {
|
|
19408
19500
|
claude_code: "claude",
|
|
@@ -19587,7 +19679,7 @@ var UnsupportedAgentError = class extends Error {
|
|
|
19587
19679
|
this.agentId = agentId;
|
|
19588
19680
|
}
|
|
19589
19681
|
};
|
|
19590
|
-
function provisionAgentCredentials(publicAgentId, auth, homeDir2 =
|
|
19682
|
+
function provisionAgentCredentials(publicAgentId, auth, homeDir2 = os34.homedir()) {
|
|
19591
19683
|
const internal = toInternalAgentId(publicAgentId);
|
|
19592
19684
|
if (!internal) throw new UnsupportedAgentError(publicAgentId);
|
|
19593
19685
|
const provisioner = PROVISIONERS[internal];
|
|
@@ -19598,10 +19690,10 @@ function provisionAgentCredentials(publicAgentId, auth, homeDir2 = os33.homedir(
|
|
|
19598
19690
|
// src/commands/host/git-tooling.ts
|
|
19599
19691
|
var import_node_child_process20 = require("child_process");
|
|
19600
19692
|
var fs39 = __toESM(require("fs"));
|
|
19601
|
-
var
|
|
19693
|
+
var os35 = __toESM(require("os"));
|
|
19602
19694
|
var path43 = __toESM(require("path"));
|
|
19603
19695
|
function codeamBinDir() {
|
|
19604
|
-
return process.env.CODEAM_BIN_DIR ?? path43.join(
|
|
19696
|
+
return process.env.CODEAM_BIN_DIR ?? path43.join(os35.homedir(), ".codeam", "bin");
|
|
19605
19697
|
}
|
|
19606
19698
|
var FALLBACK_GH_VERSION = "2.62.0";
|
|
19607
19699
|
var RELEASE_API = "https://api.github.com/repos/cli/cli/releases/latest";
|
|
@@ -19656,7 +19748,7 @@ async function ensureGhCli(runner, token, deps = {}) {
|
|
|
19656
19748
|
const version3 = await resolveVersionFn(token);
|
|
19657
19749
|
const asset = `gh_${version3}_${osToken}_${arch2}`;
|
|
19658
19750
|
const url2 = `https://github.com/cli/cli/releases/download/v${version3}/${asset}.${ext}`;
|
|
19659
|
-
const tmpRoot = fs39.mkdtempSync(path43.join(
|
|
19751
|
+
const tmpRoot = fs39.mkdtempSync(path43.join(os35.tmpdir(), "codeam-gh-"));
|
|
19660
19752
|
const archive = path43.join(tmpRoot, `${asset}.${ext}`);
|
|
19661
19753
|
if (!await downloadFn(url2, archive)) {
|
|
19662
19754
|
log.warn("host-agent", "gh download failed \u2014 skipping (git pull/push still work via the credential helper)");
|
|
@@ -19736,7 +19828,7 @@ async function ensureGlabCli(runner, deps = {}) {
|
|
|
19736
19828
|
const version3 = await resolveLatestGlabVersion();
|
|
19737
19829
|
const asset = `glab_${version3}_${osToken}_${arch2}`;
|
|
19738
19830
|
const url2 = `https://gitlab.com/gitlab-org/cli/-/releases/v${version3}/downloads/${asset}.${ext}`;
|
|
19739
|
-
const tmpRoot = fs39.mkdtempSync(path43.join(
|
|
19831
|
+
const tmpRoot = fs39.mkdtempSync(path43.join(os35.tmpdir(), "codeam-glab-"));
|
|
19740
19832
|
const archive = path43.join(tmpRoot, `${asset}.${ext}`);
|
|
19741
19833
|
if (!await downloadFn(url2, archive)) {
|
|
19742
19834
|
log.warn("host-agent", "glab download failed \u2014 skipping (git push/pull still work)");
|
|
@@ -20251,14 +20343,14 @@ async function ensureModernPython(runner) {
|
|
|
20251
20343
|
// src/commands/host/headroom-bootstrap.ts
|
|
20252
20344
|
var fs41 = __toESM(require("fs"));
|
|
20253
20345
|
var path45 = __toESM(require("path"));
|
|
20254
|
-
var
|
|
20346
|
+
var os37 = __toESM(require("os"));
|
|
20255
20347
|
|
|
20256
20348
|
// src/commands/host/headroom-config.ts
|
|
20257
20349
|
var fs40 = __toESM(require("fs"));
|
|
20258
|
-
var
|
|
20350
|
+
var os36 = __toESM(require("os"));
|
|
20259
20351
|
var path44 = __toESM(require("path"));
|
|
20260
20352
|
function headroomConfigPath() {
|
|
20261
|
-
return path44.join(
|
|
20353
|
+
return path44.join(os36.homedir(), ".codeam", "headroom-config.json");
|
|
20262
20354
|
}
|
|
20263
20355
|
function persistHeadroomConfig(config) {
|
|
20264
20356
|
try {
|
|
@@ -20276,7 +20368,7 @@ function persistHeadroomConfig(config) {
|
|
|
20276
20368
|
}
|
|
20277
20369
|
}
|
|
20278
20370
|
function agentSettingsPath(kind) {
|
|
20279
|
-
const home =
|
|
20371
|
+
const home = os36.homedir();
|
|
20280
20372
|
if (kind === "claude") return path44.join(home, ".claude", "settings.json");
|
|
20281
20373
|
if (kind === "codex") return path44.join(home, ".codex", "auth.json");
|
|
20282
20374
|
if (kind === "copilot") return path44.join(home, ".config", "github-copilot", "hosts.json");
|
|
@@ -20287,7 +20379,7 @@ function backupAgentHeadroomConfig(kind) {
|
|
|
20287
20379
|
if (!src) return;
|
|
20288
20380
|
try {
|
|
20289
20381
|
if (!fs40.existsSync(src)) return;
|
|
20290
|
-
const dest = path44.join(
|
|
20382
|
+
const dest = path44.join(os36.homedir(), ".codeam", `headroom-backup-${kind}.json`);
|
|
20291
20383
|
fs40.mkdirSync(path44.dirname(dest), { recursive: true, mode: 448 });
|
|
20292
20384
|
fs40.copyFileSync(src, dest);
|
|
20293
20385
|
fs40.chmodSync(dest, 384);
|
|
@@ -20302,7 +20394,7 @@ function backupAgentHeadroomConfig(kind) {
|
|
|
20302
20394
|
function restoreAgentHeadroomConfig(kind) {
|
|
20303
20395
|
const dest = agentSettingsPath(kind);
|
|
20304
20396
|
if (!dest) return false;
|
|
20305
|
-
const src = path44.join(
|
|
20397
|
+
const src = path44.join(os36.homedir(), ".codeam", `headroom-backup-${kind}.json`);
|
|
20306
20398
|
if (!fs40.existsSync(src)) return false;
|
|
20307
20399
|
try {
|
|
20308
20400
|
fs40.mkdirSync(path44.dirname(dest), { recursive: true, mode: 448 });
|
|
@@ -20394,7 +20486,7 @@ async function getFreeDiskBytes(dir) {
|
|
|
20394
20486
|
}
|
|
20395
20487
|
function headroomModelsCached() {
|
|
20396
20488
|
const hubDir = process.env.HUGGINGFACE_HUB_CACHE || path45.join(
|
|
20397
|
-
process.env.HF_HOME || path45.join(
|
|
20489
|
+
process.env.HF_HOME || path45.join(os37.homedir(), ".cache", "huggingface"),
|
|
20398
20490
|
"hub"
|
|
20399
20491
|
);
|
|
20400
20492
|
return HEADROOM_MODELS.every(
|
|
@@ -20505,10 +20597,10 @@ async function setupHeadroomForSelfHosted(agent, runner = defaultHeadroomRunner,
|
|
|
20505
20597
|
|
|
20506
20598
|
// src/commands/host/house-proxy-config.ts
|
|
20507
20599
|
var fs42 = __toESM(require("fs"));
|
|
20508
|
-
var
|
|
20600
|
+
var os38 = __toESM(require("os"));
|
|
20509
20601
|
var path46 = __toESM(require("path"));
|
|
20510
20602
|
function houseProxyConfigPath() {
|
|
20511
|
-
return path46.join(
|
|
20603
|
+
return path46.join(os38.homedir(), ".codeam", "house-proxy.json");
|
|
20512
20604
|
}
|
|
20513
20605
|
function persistHouseProxyConfig(config) {
|
|
20514
20606
|
try {
|
|
@@ -20567,7 +20659,7 @@ var import_node_child_process23 = require("child_process");
|
|
|
20567
20659
|
|
|
20568
20660
|
// src/lib/updateNotifier.ts
|
|
20569
20661
|
var fs43 = __toESM(require("fs"));
|
|
20570
|
-
var
|
|
20662
|
+
var os39 = __toESM(require("os"));
|
|
20571
20663
|
var path47 = __toESM(require("path"));
|
|
20572
20664
|
var https6 = __toESM(require("https"));
|
|
20573
20665
|
var import_node_child_process22 = require("child_process");
|
|
@@ -20577,7 +20669,7 @@ var REGISTRY_URL = `https://registry.npmjs.org/${PKG_NAME}/latest`;
|
|
|
20577
20669
|
var TTL_MS = 24 * 60 * 60 * 1e3;
|
|
20578
20670
|
var REQUEST_TIMEOUT_MS = 1500;
|
|
20579
20671
|
function cachePath() {
|
|
20580
|
-
const dir = path47.join(
|
|
20672
|
+
const dir = path47.join(os39.homedir(), ".codeam");
|
|
20581
20673
|
return path47.join(dir, "update-check.json");
|
|
20582
20674
|
}
|
|
20583
20675
|
function readCache() {
|
|
@@ -20723,7 +20815,7 @@ async function autoUpgradeBeforeCriticalCommand() {
|
|
|
20723
20815
|
if (process.env.NODE_ENV === "test") return;
|
|
20724
20816
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
20725
20817
|
if (process.env.CI) return;
|
|
20726
|
-
const current2 = true ? "2.
|
|
20818
|
+
const current2 = true ? "2.62.1" : null;
|
|
20727
20819
|
if (!current2) return;
|
|
20728
20820
|
const cache = readCache();
|
|
20729
20821
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
|
@@ -20740,7 +20832,7 @@ function checkForUpdates() {
|
|
|
20740
20832
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
20741
20833
|
if (process.env.CI) return;
|
|
20742
20834
|
if (!process.stdout.isTTY) return;
|
|
20743
|
-
const current2 = true ? "2.
|
|
20835
|
+
const current2 = true ? "2.62.1" : null;
|
|
20744
20836
|
if (!current2) return;
|
|
20745
20837
|
const cache = readCache();
|
|
20746
20838
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
|
@@ -20760,7 +20852,7 @@ var SELF_UPDATE_INTERVAL_MS = 60 * 60 * 1e3;
|
|
|
20760
20852
|
var SELF_UPDATE_VIEW_TIMEOUT_MS = 3e4;
|
|
20761
20853
|
var SELF_UPDATE_INSTALL_TIMEOUT_MS = 18e4;
|
|
20762
20854
|
function currentCliVersion() {
|
|
20763
|
-
return true ? "2.
|
|
20855
|
+
return true ? "2.62.1" : null;
|
|
20764
20856
|
}
|
|
20765
20857
|
function runCmd(cmd, args2, timeoutMs) {
|
|
20766
20858
|
return new Promise((resolve9) => {
|
|
@@ -21492,7 +21584,7 @@ var HostAgentSupervisor = class {
|
|
|
21492
21584
|
const relay = this.relay;
|
|
21493
21585
|
if (!relay) return;
|
|
21494
21586
|
const raw = cmd.payload?.path;
|
|
21495
|
-
const target = typeof raw === "string" && raw.trim() ? path48.resolve(raw.trim()) :
|
|
21587
|
+
const target = typeof raw === "string" && raw.trim() ? path48.resolve(raw.trim()) : os40.homedir();
|
|
21496
21588
|
try {
|
|
21497
21589
|
const dirents = await fs45.promises.readdir(target, { withFileTypes: true });
|
|
21498
21590
|
const entries = dirents.filter((d3) => !d3.name.startsWith(".")).map((d3) => ({ name: d3.name, isDir: d3.isDirectory() })).sort(
|
|
@@ -21732,7 +21824,7 @@ var HostAgentSupervisor = class {
|
|
|
21732
21824
|
CODEAM_AUTO_TOKEN: payload.autoPairToken
|
|
21733
21825
|
};
|
|
21734
21826
|
const houseConfigDir = path48.join(
|
|
21735
|
-
|
|
21827
|
+
os40.homedir(),
|
|
21736
21828
|
".codeam",
|
|
21737
21829
|
"house-claude",
|
|
21738
21830
|
payload.deployId
|
|
@@ -21764,7 +21856,7 @@ var HostAgentSupervisor = class {
|
|
|
21764
21856
|
report("installing", "installing agent CLI");
|
|
21765
21857
|
await this.runAgentInstall(payload.agentInstallScript);
|
|
21766
21858
|
}
|
|
21767
|
-
const home = process.env.HOME ||
|
|
21859
|
+
const home = process.env.HOME || os40.homedir();
|
|
21768
21860
|
childEnv.PATH = `${home}/.local/bin:${process.env.PATH ?? ""}`;
|
|
21769
21861
|
if (payload.cloneToken) {
|
|
21770
21862
|
try {
|
|
@@ -21798,7 +21890,7 @@ var HostAgentSupervisor = class {
|
|
|
21798
21890
|
}
|
|
21799
21891
|
if (payload.headroomEnabled && payload.headroomAgent && payload.headroomSavingsIngestUrl && isHeadroomSupportedAgent(payload.headroomAgent)) {
|
|
21800
21892
|
report("headroom", "setting up Headroom proxy");
|
|
21801
|
-
const freeBytes = await this.getFreeDisk(
|
|
21893
|
+
const freeBytes = await this.getFreeDisk(os40.homedir());
|
|
21802
21894
|
const alreadyInstalled = this.isHeadroomInstalled();
|
|
21803
21895
|
if (!alreadyInstalled && freeBytes !== null && freeBytes < HEADROOM_MIN_FREE_DISK_BYTES) {
|
|
21804
21896
|
const freeGb = (freeBytes / 1e9).toFixed(1);
|
|
@@ -21857,7 +21949,7 @@ var HostAgentSupervisor = class {
|
|
|
21857
21949
|
);
|
|
21858
21950
|
if (!payload.suppressOnboardingWelcome) {
|
|
21859
21951
|
try {
|
|
21860
|
-
const cfgDir = childEnv.CLAUDE_CONFIG_DIR || path48.join(
|
|
21952
|
+
const cfgDir = childEnv.CLAUDE_CONFIG_DIR || path48.join(os40.homedir(), ".claude");
|
|
21861
21953
|
const projectDir = path48.join(cfgDir, "projects", encodeCwd(cwd));
|
|
21862
21954
|
const hasPriorConversation = fs45.existsSync(projectDir) && fs45.readdirSync(projectDir).some((f) => f.endsWith(".jsonl"));
|
|
21863
21955
|
if (hasPriorConversation) {
|
|
@@ -22007,7 +22099,7 @@ var HostAgentSupervisor = class {
|
|
|
22007
22099
|
*/
|
|
22008
22100
|
runAgentInstall(script) {
|
|
22009
22101
|
return new Promise((resolve9) => {
|
|
22010
|
-
const home = process.env.HOME ||
|
|
22102
|
+
const home = process.env.HOME || os40.homedir();
|
|
22011
22103
|
const child = (0, import_node_child_process25.spawn)("sh", ["-c", script], {
|
|
22012
22104
|
env: { ...process.env, HOME: home },
|
|
22013
22105
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -22096,7 +22188,7 @@ var HostAgentSupervisor = class {
|
|
|
22096
22188
|
}
|
|
22097
22189
|
const dirs = [
|
|
22098
22190
|
path48.join(selfHostedWorkspaceRoot(), deployId),
|
|
22099
|
-
path48.join(
|
|
22191
|
+
path48.join(os40.homedir(), ".codeam", "house-claude", deployId)
|
|
22100
22192
|
];
|
|
22101
22193
|
for (const dir of dirs) {
|
|
22102
22194
|
try {
|
|
@@ -22238,7 +22330,7 @@ async function configureHeadroom(action, ctx, deps) {
|
|
|
22238
22330
|
|
|
22239
22331
|
// src/services/headroom/budget-relaunch.ts
|
|
22240
22332
|
var fs46 = __toESM(require("fs"));
|
|
22241
|
-
var
|
|
22333
|
+
var os41 = __toESM(require("os"));
|
|
22242
22334
|
var path49 = __toESM(require("path"));
|
|
22243
22335
|
var import_child_process13 = require("child_process");
|
|
22244
22336
|
function amendDeploymentManifestBudget(manifest, budget) {
|
|
@@ -22350,7 +22442,7 @@ function spawnProxyReal2(_budget) {
|
|
|
22350
22442
|
);
|
|
22351
22443
|
}
|
|
22352
22444
|
function makeRealApplyBudgetDeps() {
|
|
22353
|
-
const homeDir2 =
|
|
22445
|
+
const homeDir2 = os41.homedir();
|
|
22354
22446
|
return {
|
|
22355
22447
|
findDeployments: () => findHeadroomDeployments(homeDir2, {
|
|
22356
22448
|
readDir: (dir) => fs46.readdirSync(dir),
|
|
@@ -22489,12 +22581,12 @@ async function readUsageReport(deps = {}) {
|
|
|
22489
22581
|
// src/agents/acp/guardrail-config.ts
|
|
22490
22582
|
var fs47 = __toESM(require("fs"));
|
|
22491
22583
|
var path50 = __toESM(require("path"));
|
|
22492
|
-
var
|
|
22584
|
+
var os42 = __toESM(require("os"));
|
|
22493
22585
|
var current = null;
|
|
22494
|
-
function guardrailConfigPath(homeDir2 =
|
|
22586
|
+
function guardrailConfigPath(homeDir2 = os42.homedir()) {
|
|
22495
22587
|
return path50.join(homeDir2, ".codeam", "guardrails.json");
|
|
22496
22588
|
}
|
|
22497
|
-
function loadGuardrailPolicy(homeDir2 =
|
|
22589
|
+
function loadGuardrailPolicy(homeDir2 = os42.homedir()) {
|
|
22498
22590
|
try {
|
|
22499
22591
|
current = normalizeGuardrailPolicy(JSON.parse(fs47.readFileSync(guardrailConfigPath(homeDir2), "utf8")));
|
|
22500
22592
|
} catch {
|
|
@@ -22502,10 +22594,10 @@ function loadGuardrailPolicy(homeDir2 = os41.homedir()) {
|
|
|
22502
22594
|
}
|
|
22503
22595
|
return current;
|
|
22504
22596
|
}
|
|
22505
|
-
function getGuardrailPolicy(homeDir2 =
|
|
22597
|
+
function getGuardrailPolicy(homeDir2 = os42.homedir()) {
|
|
22506
22598
|
return current ?? loadGuardrailPolicy(homeDir2);
|
|
22507
22599
|
}
|
|
22508
|
-
function setGuardrailPolicy(raw, homeDir2 =
|
|
22600
|
+
function setGuardrailPolicy(raw, homeDir2 = os42.homedir()) {
|
|
22509
22601
|
const next = normalizeGuardrailPolicy(raw);
|
|
22510
22602
|
current = next;
|
|
22511
22603
|
try {
|
|
@@ -22519,11 +22611,11 @@ function setGuardrailPolicy(raw, homeDir2 = os41.homedir()) {
|
|
|
22519
22611
|
|
|
22520
22612
|
// src/services/preview/port-registry.ts
|
|
22521
22613
|
var fs48 = __toESM(require("fs"));
|
|
22522
|
-
var
|
|
22614
|
+
var os43 = __toESM(require("os"));
|
|
22523
22615
|
var path51 = __toESM(require("path"));
|
|
22524
22616
|
var import_child_process14 = require("child_process");
|
|
22525
22617
|
function registryPath() {
|
|
22526
|
-
return path51.join(
|
|
22618
|
+
return path51.join(os43.homedir(), ".codeam", "preview-ports.json");
|
|
22527
22619
|
}
|
|
22528
22620
|
function readRegistry() {
|
|
22529
22621
|
try {
|
|
@@ -23102,10 +23194,10 @@ function parseExpoUrl(stdout) {
|
|
|
23102
23194
|
}
|
|
23103
23195
|
|
|
23104
23196
|
// src/services/preview/port-ready.ts
|
|
23105
|
-
var
|
|
23197
|
+
var net2 = __toESM(require("net"));
|
|
23106
23198
|
function isPortListening(port, host2 = "127.0.0.1") {
|
|
23107
23199
|
return new Promise((resolve9) => {
|
|
23108
|
-
const socket = new
|
|
23200
|
+
const socket = new net2.Socket();
|
|
23109
23201
|
const done = (result) => {
|
|
23110
23202
|
socket.removeAllListeners();
|
|
23111
23203
|
socket.destroy();
|
|
@@ -24067,7 +24159,7 @@ async function establishTunnel(ctx, dev) {
|
|
|
24067
24159
|
// src/beads/bd-adapter.ts
|
|
24068
24160
|
var import_child_process20 = require("child_process");
|
|
24069
24161
|
var fs57 = __toESM(require("fs"));
|
|
24070
|
-
var
|
|
24162
|
+
var os45 = __toESM(require("os"));
|
|
24071
24163
|
var path60 = __toESM(require("path"));
|
|
24072
24164
|
var BD_PACKAGE = "@beads/bd";
|
|
24073
24165
|
function resolveBundledBdBinary() {
|
|
@@ -24185,7 +24277,7 @@ var BdAdapter = class {
|
|
|
24185
24277
|
const env = { ...process.env };
|
|
24186
24278
|
if (!env.HOME) {
|
|
24187
24279
|
try {
|
|
24188
|
-
const home =
|
|
24280
|
+
const home = os45.homedir();
|
|
24189
24281
|
if (home) env.HOME = home;
|
|
24190
24282
|
} catch {
|
|
24191
24283
|
}
|
|
@@ -24278,7 +24370,7 @@ function coerceIssue(row, projectKey) {
|
|
|
24278
24370
|
// src/beads/provisioner.ts
|
|
24279
24371
|
var import_child_process23 = require("child_process");
|
|
24280
24372
|
var fs59 = __toESM(require("fs"));
|
|
24281
|
-
var
|
|
24373
|
+
var os47 = __toESM(require("os"));
|
|
24282
24374
|
var path62 = __toESM(require("path"));
|
|
24283
24375
|
|
|
24284
24376
|
// src/beads/install-bd.ts
|
|
@@ -24345,7 +24437,7 @@ async function installBd(platform3 = process.platform) {
|
|
|
24345
24437
|
// src/beads/install-dolt.ts
|
|
24346
24438
|
var import_child_process22 = require("child_process");
|
|
24347
24439
|
var fs58 = __toESM(require("fs"));
|
|
24348
|
-
var
|
|
24440
|
+
var os46 = __toESM(require("os"));
|
|
24349
24441
|
var path61 = __toESM(require("path"));
|
|
24350
24442
|
var DOLT_INSTALL_SH_URL = "https://github.com/dolthub/dolt/releases/latest/download/install.sh";
|
|
24351
24443
|
var DOLT_MSI_URL = "https://github.com/dolthub/dolt/releases/latest/download/dolt-windows-amd64.msi";
|
|
@@ -24386,11 +24478,11 @@ function resolveDoltInstallStrategy(platform3) {
|
|
|
24386
24478
|
}
|
|
24387
24479
|
var DOLT_RELEASE_BASE = "https://github.com/dolthub/dolt/releases/latest/download";
|
|
24388
24480
|
function doltPlatformTuple(platform3, arch2) {
|
|
24389
|
-
const
|
|
24481
|
+
const os64 = platform3 === "win32" ? "windows" : platform3 === "darwin" ? "darwin" : "linux";
|
|
24390
24482
|
const a = arch2 === "x64" ? "amd64" : arch2 === "arm64" ? "arm64" : null;
|
|
24391
24483
|
if (!a) return null;
|
|
24392
|
-
if (
|
|
24393
|
-
return `${
|
|
24484
|
+
if (os64 === "windows" && a !== "amd64") return null;
|
|
24485
|
+
return `${os64}-${a}`;
|
|
24394
24486
|
}
|
|
24395
24487
|
function resolveDoltTarballStrategy(targetDir, platform3, arch2) {
|
|
24396
24488
|
const tuple = doltPlatformTuple(platform3, arch2);
|
|
@@ -24435,7 +24527,7 @@ async function installDoltToDir(targetDir, platform3 = process.platform, arch2 =
|
|
|
24435
24527
|
return result;
|
|
24436
24528
|
}
|
|
24437
24529
|
var _doltPathSeam = {
|
|
24438
|
-
homedir: () =>
|
|
24530
|
+
homedir: () => os46.homedir(),
|
|
24439
24531
|
getPath: () => process.env.PATH ?? "",
|
|
24440
24532
|
setPath: (p2) => {
|
|
24441
24533
|
process.env.PATH = p2;
|
|
@@ -24646,7 +24738,7 @@ var _provisionSeam = {
|
|
|
24646
24738
|
};
|
|
24647
24739
|
var _linkSeam = {
|
|
24648
24740
|
platform: () => process.platform,
|
|
24649
|
-
homedir: () =>
|
|
24741
|
+
homedir: () => os47.homedir(),
|
|
24650
24742
|
isWritableDir: (dir) => {
|
|
24651
24743
|
try {
|
|
24652
24744
|
fs59.accessSync(dir, fs59.constants.W_OK);
|
|
@@ -25441,7 +25533,7 @@ function cleanupAttachmentTempFiles() {
|
|
|
25441
25533
|
function saveFilesTemp(files) {
|
|
25442
25534
|
return files.filter(({ base64 }) => base64 && base64.length > 0).map(({ filename, base64 }) => {
|
|
25443
25535
|
const safeName = filename.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 80);
|
|
25444
|
-
const tmpPath = path66.join(
|
|
25536
|
+
const tmpPath = path66.join(os51.tmpdir(), `codeam-${(0, import_crypto3.randomUUID)()}-${safeName}`);
|
|
25445
25537
|
fs62.writeFileSync(tmpPath, Buffer.from(base64, "base64"));
|
|
25446
25538
|
pendingAttachmentFiles.add(tmpPath);
|
|
25447
25539
|
return tmpPath;
|
|
@@ -26036,7 +26128,7 @@ var vcsAgentReviewH = async (ctx, cmd, parsed) => {
|
|
|
26036
26128
|
});
|
|
26037
26129
|
const token = ctx.pluginAuthToken;
|
|
26038
26130
|
void (async () => {
|
|
26039
|
-
const
|
|
26131
|
+
const os64 = createOsStrategy();
|
|
26040
26132
|
try {
|
|
26041
26133
|
const report = await reviewPullRequest(
|
|
26042
26134
|
{
|
|
@@ -26045,7 +26137,7 @@ var vcsAgentReviewH = async (ctx, cmd, parsed) => {
|
|
|
26045
26137
|
baseBranch: parsed.baseBranch
|
|
26046
26138
|
},
|
|
26047
26139
|
{
|
|
26048
|
-
runReview: (input) => new CoderabbitRuntimeStrategy(
|
|
26140
|
+
runReview: (input) => new CoderabbitRuntimeStrategy(os64).runOneShot(input),
|
|
26049
26141
|
runGh: (args2) => defaultRunGh(args2),
|
|
26050
26142
|
postReport: async (r) => {
|
|
26051
26143
|
if (!token) return;
|
|
@@ -26258,13 +26350,13 @@ function resolveGlobalNodeModulesDir(opts) {
|
|
|
26258
26350
|
var STALE_STAGING_AGE_MS = CLI_UPDATE_INSTALL_TIMEOUT_MS;
|
|
26259
26351
|
function sweepStaleCliStagingDirs(nodeModulesDir, now = Date.now(), deps) {
|
|
26260
26352
|
if (!nodeModulesDir) return 0;
|
|
26261
|
-
const
|
|
26353
|
+
const readdirSync15 = deps?.readdirSync ?? fs62.readdirSync;
|
|
26262
26354
|
const statSync17 = deps?.statSync ?? fs62.statSync;
|
|
26263
26355
|
const rmSync9 = deps?.rmSync ?? fs62.rmSync;
|
|
26264
26356
|
let removed = 0;
|
|
26265
26357
|
let entries;
|
|
26266
26358
|
try {
|
|
26267
|
-
entries =
|
|
26359
|
+
entries = readdirSync15(nodeModulesDir);
|
|
26268
26360
|
} catch {
|
|
26269
26361
|
return 0;
|
|
26270
26362
|
}
|
|
@@ -27181,7 +27273,7 @@ async function claimOnce(token, pluginId, pluginSecretHash) {
|
|
|
27181
27273
|
pluginId,
|
|
27182
27274
|
ideName: "codeam-cli (codespace)",
|
|
27183
27275
|
ideVersion: process.env.npm_package_version ?? "unknown",
|
|
27184
|
-
hostname:
|
|
27276
|
+
hostname: os52.hostname(),
|
|
27185
27277
|
codespaceName: process.env.CODESPACE_NAME ?? "",
|
|
27186
27278
|
// Current git branch of the codespace's working directory, so the
|
|
27187
27279
|
// backend can populate `PairedSession.branch` for the codespace pair.
|
|
@@ -27242,7 +27334,7 @@ async function claim(token, pluginId, pluginSecretHash) {
|
|
|
27242
27334
|
}
|
|
27243
27335
|
}
|
|
27244
27336
|
function pairAutoLockPath() {
|
|
27245
|
-
return path67.join(
|
|
27337
|
+
return path67.join(os52.homedir(), ".codeam", "pair-auto.lock");
|
|
27246
27338
|
}
|
|
27247
27339
|
function isLivePairAuto(pid) {
|
|
27248
27340
|
if (!Number.isInteger(pid) || pid <= 0 || pid === process.pid) return false;
|
|
@@ -27262,7 +27354,7 @@ function isLiveCodeam(pid) {
|
|
|
27262
27354
|
}
|
|
27263
27355
|
function daemonLockPath(sessionId) {
|
|
27264
27356
|
const safe = sessionId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
27265
|
-
return path67.join(
|
|
27357
|
+
return path67.join(os52.homedir(), ".codeam", `daemon-${safe}.lock`);
|
|
27266
27358
|
}
|
|
27267
27359
|
function acquireDaemonLock(sessionId) {
|
|
27268
27360
|
const lockPath = daemonLockPath(sessionId);
|
|
@@ -28213,7 +28305,7 @@ var import_node_crypto11 = require("crypto");
|
|
|
28213
28305
|
// src/services/history.service.ts
|
|
28214
28306
|
var fs65 = __toESM(require("fs"));
|
|
28215
28307
|
var path70 = __toESM(require("path"));
|
|
28216
|
-
var
|
|
28308
|
+
var os54 = __toESM(require("os"));
|
|
28217
28309
|
var https7 = __toESM(require("https"));
|
|
28218
28310
|
var http6 = __toESM(require("http"));
|
|
28219
28311
|
var import_zod2 = require("zod");
|
|
@@ -28381,7 +28473,7 @@ var HistoryService = class _HistoryService {
|
|
|
28381
28473
|
return this._quotaPercent === null || Date.now() - this._quotaFetchedAt > ttlMs;
|
|
28382
28474
|
}
|
|
28383
28475
|
get projectDir() {
|
|
28384
|
-
return this.runtime.resolveHistoryDir(this.cwd) ?? path70.join(
|
|
28476
|
+
return this.runtime.resolveHistoryDir(this.cwd) ?? path70.join(os54.homedir(), ".claude", "projects", encodeCwd(this.cwd));
|
|
28385
28477
|
}
|
|
28386
28478
|
/** Set the current Claude conversation ID (extracted from /cost command or session start) */
|
|
28387
28479
|
setCurrentConversationId(id) {
|
|
@@ -28809,7 +28901,7 @@ var HistoryService = class _HistoryService {
|
|
|
28809
28901
|
var import_node_child_process29 = require("child_process");
|
|
28810
28902
|
var fs66 = __toESM(require("fs/promises"));
|
|
28811
28903
|
var fsSync = __toESM(require("fs"));
|
|
28812
|
-
var
|
|
28904
|
+
var os56 = __toESM(require("os"));
|
|
28813
28905
|
var path72 = __toESM(require("path"));
|
|
28814
28906
|
var import_node_stream = require("stream");
|
|
28815
28907
|
|
|
@@ -32837,7 +32929,7 @@ function createIdleTimeout(idleMs, makeError, activeIdleMs = idleMs) {
|
|
|
32837
32929
|
|
|
32838
32930
|
// src/agents/acp/internal-paths.ts
|
|
32839
32931
|
var path71 = __toESM(require("path"));
|
|
32840
|
-
var
|
|
32932
|
+
var os55 = __toESM(require("os"));
|
|
32841
32933
|
var INTERNAL_TOKENS = [".codeam", "house-claude"];
|
|
32842
32934
|
var SELF_HOSTED_WORKSPACE_RE = /\.codeam[/\\]self-hosted/gi;
|
|
32843
32935
|
function textReferencesInternal(text) {
|
|
@@ -32845,7 +32937,7 @@ function textReferencesInternal(text) {
|
|
|
32845
32937
|
const scrubbed = text.replace(SELF_HOSTED_WORKSPACE_RE, " ");
|
|
32846
32938
|
return INTERNAL_TOKENS.some((t2) => scrubbed.includes(t2));
|
|
32847
32939
|
}
|
|
32848
|
-
function pathIsInternal(p2, homeDir2 =
|
|
32940
|
+
function pathIsInternal(p2, homeDir2 = os55.homedir()) {
|
|
32849
32941
|
if (!p2) return false;
|
|
32850
32942
|
const abs = path71.resolve(p2);
|
|
32851
32943
|
const home = path71.resolve(homeDir2);
|
|
@@ -33893,7 +33985,7 @@ function applyLineRange(content, line, limit) {
|
|
|
33893
33985
|
return { content: lines.slice(start2, end).join("\n") };
|
|
33894
33986
|
}
|
|
33895
33987
|
function knownAgentBinaryDirs() {
|
|
33896
|
-
const home =
|
|
33988
|
+
const home = os56.homedir();
|
|
33897
33989
|
const out2 = [];
|
|
33898
33990
|
out2.push("/tmp/codeam-node20/bin");
|
|
33899
33991
|
for (const root of [
|
|
@@ -34420,10 +34512,10 @@ function commonPrefixLength(a, b) {
|
|
|
34420
34512
|
// src/agents/acp/onboarding.ts
|
|
34421
34513
|
var import_child_process27 = require("child_process");
|
|
34422
34514
|
var fs67 = __toESM(require("fs"));
|
|
34423
|
-
var
|
|
34515
|
+
var os57 = __toESM(require("os"));
|
|
34424
34516
|
var path73 = __toESM(require("path"));
|
|
34425
34517
|
var _onboardingSeam = {
|
|
34426
|
-
markerPath: (sessionId) => path73.join(
|
|
34518
|
+
markerPath: (sessionId) => path73.join(os57.homedir(), ".codeam", "welcomed", `${sessionId}.done`),
|
|
34427
34519
|
exists: (p2) => fs67.existsSync(p2),
|
|
34428
34520
|
write: (p2) => {
|
|
34429
34521
|
fs67.mkdirSync(path73.dirname(p2), { recursive: true });
|
|
@@ -36297,8 +36389,8 @@ function buildAcpPromptBlocks(payload) {
|
|
|
36297
36389
|
// src/agents/agent-standard.ts
|
|
36298
36390
|
var fs74 = __toESM(require("fs"));
|
|
36299
36391
|
var path80 = __toESM(require("path"));
|
|
36300
|
-
var
|
|
36301
|
-
function ensureAgentStandard(homeDir2 =
|
|
36392
|
+
var os58 = __toESM(require("os"));
|
|
36393
|
+
function ensureAgentStandard(homeDir2 = os58.homedir()) {
|
|
36302
36394
|
try {
|
|
36303
36395
|
const file = path80.join(homeDir2, ".claude", "CLAUDE.md");
|
|
36304
36396
|
let existing = "";
|
|
@@ -36319,7 +36411,7 @@ ${AGENT_STANDARD_BLOCK}
|
|
|
36319
36411
|
}
|
|
36320
36412
|
var _agentStandardSeam = {
|
|
36321
36413
|
isLocalSession: () => isLocalSession(),
|
|
36322
|
-
markerPath: (sessionId) => path80.join(
|
|
36414
|
+
markerPath: (sessionId) => path80.join(os58.homedir(), ".codeam", "agent-standard", `${sessionId}.done`),
|
|
36323
36415
|
exists: (p2) => fs74.existsSync(p2),
|
|
36324
36416
|
write: (p2) => {
|
|
36325
36417
|
fs74.mkdirSync(path80.dirname(p2), { recursive: true });
|
|
@@ -38994,7 +39086,7 @@ function startClaudeCredentialSync(opts) {
|
|
|
38994
39086
|
// src/beads/workflow-hint.ts
|
|
38995
39087
|
var fs75 = __toESM(require("fs"));
|
|
38996
39088
|
var path81 = __toESM(require("path"));
|
|
38997
|
-
var
|
|
39089
|
+
var os59 = __toESM(require("os"));
|
|
38998
39090
|
var BEADS_HINT_MARKER = "<!-- codeam:beads-workflow -->";
|
|
38999
39091
|
var BEADS_HINT = `${BEADS_HINT_MARKER}
|
|
39000
39092
|
# Beads (bd) \u2014 task tracking + persistent memory (ALWAYS use it)
|
|
@@ -39008,7 +39100,7 @@ This environment uses **bd (beads)** for issue/task tracking and persistent memo
|
|
|
39008
39100
|
- \`bd ready\` (available work) \xB7 \`bd show <id>\` \xB7 \`bd update <id> --claim\` \xB7 \`bd close <id>\`.
|
|
39009
39101
|
- Use \`bd remember "..."\` for persistent knowledge \u2014 do NOT use MEMORY.md files.
|
|
39010
39102
|
${BEADS_HINT_MARKER}`;
|
|
39011
|
-
function ensureBeadsWorkflowHint(homeDir2 =
|
|
39103
|
+
function ensureBeadsWorkflowHint(homeDir2 = os59.homedir()) {
|
|
39012
39104
|
try {
|
|
39013
39105
|
const file = path81.join(homeDir2, ".claude", "CLAUDE.md");
|
|
39014
39106
|
let existing = "";
|
|
@@ -39761,12 +39853,12 @@ function keepDeviceAwake(deps = {}) {
|
|
|
39761
39853
|
|
|
39762
39854
|
// src/agents/claude/onboarding.ts
|
|
39763
39855
|
var fs77 = __toESM(require("fs"));
|
|
39764
|
-
var
|
|
39856
|
+
var os61 = __toESM(require("os"));
|
|
39765
39857
|
var path82 = __toESM(require("path"));
|
|
39766
39858
|
var ONBOARDING_VERSION_SENTINEL = "9999.0.0";
|
|
39767
39859
|
function ensureClaudeOnboarded(cwd) {
|
|
39768
39860
|
try {
|
|
39769
|
-
const file = path82.join(
|
|
39861
|
+
const file = path82.join(os61.homedir(), ".claude.json");
|
|
39770
39862
|
let config = {};
|
|
39771
39863
|
try {
|
|
39772
39864
|
config = JSON.parse(fs77.readFileSync(file, "utf8"));
|
|
@@ -42675,9 +42767,9 @@ function checkSessions() {
|
|
|
42675
42767
|
}
|
|
42676
42768
|
}
|
|
42677
42769
|
function checkAgentBinaries() {
|
|
42678
|
-
const
|
|
42770
|
+
const os64 = createOsStrategy();
|
|
42679
42771
|
return getEnabledAgents().map((meta) => {
|
|
42680
|
-
const found =
|
|
42772
|
+
const found = os64.findInPath(meta.binaryName);
|
|
42681
42773
|
return {
|
|
42682
42774
|
id: `agent-${meta.id}`,
|
|
42683
42775
|
label: `Agent binary: ${meta.displayName} (${meta.binaryName})`,
|
|
@@ -42741,7 +42833,7 @@ function checkChokidar() {
|
|
|
42741
42833
|
}
|
|
42742
42834
|
async function doctor(args2 = []) {
|
|
42743
42835
|
const json = args2.includes("--json");
|
|
42744
|
-
const cliVersion = true ? "2.
|
|
42836
|
+
const cliVersion = true ? "2.62.1" : "0.0.0-dev";
|
|
42745
42837
|
const apiBase2 = resolveApiBaseUrl();
|
|
42746
42838
|
const diagnosticId = (0, import_node_crypto13.randomUUID)();
|
|
42747
42839
|
log.info("doctor", `run id=${diagnosticId} cli=${cliVersion}`);
|
|
@@ -43132,7 +43224,7 @@ async function mcpRun(args2) {
|
|
|
43132
43224
|
// src/commands/version.ts
|
|
43133
43225
|
var import_picocolors15 = __toESM(require("picocolors"));
|
|
43134
43226
|
function version2() {
|
|
43135
|
-
const v = true ? "2.
|
|
43227
|
+
const v = true ? "2.62.1" : "unknown";
|
|
43136
43228
|
console.log(`${import_picocolors15.default.bold("codeam-cli")} ${import_picocolors15.default.cyan(v)}`);
|
|
43137
43229
|
}
|
|
43138
43230
|
|
|
@@ -43281,10 +43373,10 @@ var EXIT_CODE_NAMES = {
|
|
|
43281
43373
|
};
|
|
43282
43374
|
|
|
43283
43375
|
// src/index.ts
|
|
43284
|
-
var
|
|
43376
|
+
var os63 = __toESM(require("os"));
|
|
43285
43377
|
if (!process.env.HOME) {
|
|
43286
43378
|
try {
|
|
43287
|
-
const home =
|
|
43379
|
+
const home = os63.homedir();
|
|
43288
43380
|
if (home) process.env.HOME = home;
|
|
43289
43381
|
} catch {
|
|
43290
43382
|
}
|