codeam-cli 2.61.98 → 2.62.0
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 +20 -0
- package/dist/index.js +445 -235
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2790,6 +2790,7 @@ function resolveApiBaseUrl() {
|
|
|
2790
2790
|
}
|
|
2791
2791
|
|
|
2792
2792
|
// ../../packages/shared/src/headroom/manifest.ts
|
|
2793
|
+
var HEADROOM_PROXY_PORT = 8787;
|
|
2793
2794
|
var HEADROOM_PIP_COMPANIONS = [
|
|
2794
2795
|
"fastapi",
|
|
2795
2796
|
"uvicorn",
|
|
@@ -3270,7 +3271,7 @@ var { getConfig, ensurePluginId, addSession, removeSession, setActiveSession, ge
|
|
|
3270
3271
|
|
|
3271
3272
|
// src/commands/pair-auto.ts
|
|
3272
3273
|
var fs63 = __toESM(require("fs"));
|
|
3273
|
-
var
|
|
3274
|
+
var os52 = __toESM(require("os"));
|
|
3274
3275
|
var path67 = __toESM(require("path"));
|
|
3275
3276
|
var import_crypto4 = require("crypto");
|
|
3276
3277
|
|
|
@@ -3635,31 +3636,31 @@ var BucketedRateLimiter = class {
|
|
|
3635
3636
|
this._refillRate = clampToRange(options.refillRate, 0, this._bucketSize, options._logger);
|
|
3636
3637
|
this._refillInterval = clampToRange(options.refillInterval, 0, ONE_DAY_IN_MS, options._logger);
|
|
3637
3638
|
}
|
|
3638
|
-
_applyRefill(
|
|
3639
|
-
const elapsedMs = now -
|
|
3639
|
+
_applyRefill(bucket2, now) {
|
|
3640
|
+
const elapsedMs = now - bucket2.lastAccess;
|
|
3640
3641
|
const refillIntervals = Math.floor(elapsedMs / this._refillInterval);
|
|
3641
3642
|
if (refillIntervals > 0) {
|
|
3642
3643
|
const tokensToAdd = refillIntervals * this._refillRate;
|
|
3643
|
-
|
|
3644
|
-
|
|
3644
|
+
bucket2.tokens = Math.min(bucket2.tokens + tokensToAdd, this._bucketSize);
|
|
3645
|
+
bucket2.lastAccess = bucket2.lastAccess + refillIntervals * this._refillInterval;
|
|
3645
3646
|
}
|
|
3646
3647
|
}
|
|
3647
3648
|
consumeRateLimit(key) {
|
|
3648
3649
|
const now = Date.now();
|
|
3649
3650
|
const keyStr = String(key);
|
|
3650
|
-
let
|
|
3651
|
-
if (
|
|
3651
|
+
let bucket2 = this._buckets[keyStr];
|
|
3652
|
+
if (bucket2) this._applyRefill(bucket2, now);
|
|
3652
3653
|
else {
|
|
3653
|
-
|
|
3654
|
+
bucket2 = {
|
|
3654
3655
|
tokens: this._bucketSize,
|
|
3655
3656
|
lastAccess: now
|
|
3656
3657
|
};
|
|
3657
|
-
this._buckets[keyStr] =
|
|
3658
|
+
this._buckets[keyStr] = bucket2;
|
|
3658
3659
|
}
|
|
3659
|
-
if (0 ===
|
|
3660
|
-
|
|
3661
|
-
if (0 ===
|
|
3662
|
-
return 0 ===
|
|
3660
|
+
if (0 === bucket2.tokens) return true;
|
|
3661
|
+
bucket2.tokens--;
|
|
3662
|
+
if (0 === bucket2.tokens) this._onBucketRateLimited?.(key);
|
|
3663
|
+
return 0 === bucket2.tokens;
|
|
3663
3664
|
}
|
|
3664
3665
|
stop() {
|
|
3665
3666
|
this._buckets = {};
|
|
@@ -8021,7 +8022,7 @@ function readAnonId() {
|
|
|
8021
8022
|
}
|
|
8022
8023
|
function superProperties() {
|
|
8023
8024
|
return {
|
|
8024
|
-
cliVersion: true ? "2.
|
|
8025
|
+
cliVersion: true ? "2.62.0" : "0.0.0-dev",
|
|
8025
8026
|
nodeVersion: process.version,
|
|
8026
8027
|
platform: process.platform,
|
|
8027
8028
|
arch: process.arch,
|
|
@@ -8202,7 +8203,7 @@ var os4 = __toESM(require("os"));
|
|
|
8202
8203
|
// package.json
|
|
8203
8204
|
var package_default = {
|
|
8204
8205
|
name: "codeam-cli",
|
|
8205
|
-
version: "2.
|
|
8206
|
+
version: "2.62.0",
|
|
8206
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.",
|
|
8207
8208
|
type: "commonjs",
|
|
8208
8209
|
main: "dist/index.js",
|
|
@@ -8860,12 +8861,13 @@ function computePollDelay({ baseMs, failures }) {
|
|
|
8860
8861
|
|
|
8861
8862
|
// src/services/headroom/proxy-supervisor.ts
|
|
8862
8863
|
var fs7 = __toESM(require("fs"));
|
|
8863
|
-
var
|
|
8864
|
+
var os7 = __toESM(require("os"));
|
|
8864
8865
|
var path6 = __toESM(require("path"));
|
|
8865
8866
|
|
|
8866
8867
|
// src/services/headroom/proxy-process.ts
|
|
8867
8868
|
var import_child_process2 = require("child_process");
|
|
8868
8869
|
var fs6 = __toESM(require("fs"));
|
|
8870
|
+
var os6 = __toESM(require("os"));
|
|
8869
8871
|
var path5 = __toESM(require("path"));
|
|
8870
8872
|
|
|
8871
8873
|
// src/services/headroom/budget-args.ts
|
|
@@ -8946,6 +8948,27 @@ function pkillFallback() {
|
|
|
8946
8948
|
} catch {
|
|
8947
8949
|
}
|
|
8948
8950
|
}
|
|
8951
|
+
function findRunningProxyPid() {
|
|
8952
|
+
let entries;
|
|
8953
|
+
try {
|
|
8954
|
+
entries = fs5.readdirSync("/proc");
|
|
8955
|
+
} catch {
|
|
8956
|
+
return null;
|
|
8957
|
+
}
|
|
8958
|
+
for (const name of entries) {
|
|
8959
|
+
if (!/^\d+$/.test(name)) continue;
|
|
8960
|
+
const pid = Number(name);
|
|
8961
|
+
if (pid === process.pid) continue;
|
|
8962
|
+
if (pidLooksLikeProxy(pid)) return pid;
|
|
8963
|
+
}
|
|
8964
|
+
return null;
|
|
8965
|
+
}
|
|
8966
|
+
function adoptRunningProxy() {
|
|
8967
|
+
const pid = findRunningProxyPid();
|
|
8968
|
+
if (pid === null) return null;
|
|
8969
|
+
writeHeadroomProxyPidfile(pid);
|
|
8970
|
+
return pid;
|
|
8971
|
+
}
|
|
8949
8972
|
function killHeadroomProxy() {
|
|
8950
8973
|
const pid = readHeadroomProxyPidfile();
|
|
8951
8974
|
if (pid !== null && isPidAlive(pid)) {
|
|
@@ -8965,6 +8988,14 @@ function killHeadroomProxy() {
|
|
|
8965
8988
|
} catch {
|
|
8966
8989
|
}
|
|
8967
8990
|
}
|
|
8991
|
+
const found = findRunningProxyPid();
|
|
8992
|
+
if (found !== null) {
|
|
8993
|
+
try {
|
|
8994
|
+
process.kill(found, "SIGTERM");
|
|
8995
|
+
return;
|
|
8996
|
+
} catch {
|
|
8997
|
+
}
|
|
8998
|
+
}
|
|
8968
8999
|
pkillFallback();
|
|
8969
9000
|
}
|
|
8970
9001
|
|
|
@@ -8999,6 +9030,23 @@ function refreshSpawnLock() {
|
|
|
8999
9030
|
} catch {
|
|
9000
9031
|
}
|
|
9001
9032
|
}
|
|
9033
|
+
function headroomProxyLogPath() {
|
|
9034
|
+
return path5.join(os6.homedir(), ".codeam", "headroom-proxy.log");
|
|
9035
|
+
}
|
|
9036
|
+
var PROXY_LOG_MAX_BYTES = 2 * 1024 * 1024;
|
|
9037
|
+
function openProxyLogFd() {
|
|
9038
|
+
try {
|
|
9039
|
+
const p2 = headroomProxyLogPath();
|
|
9040
|
+
fs6.mkdirSync(path5.dirname(p2), { recursive: true, mode: 448 });
|
|
9041
|
+
try {
|
|
9042
|
+
if (fs6.statSync(p2).size > PROXY_LOG_MAX_BYTES) fs6.truncateSync(p2, 0);
|
|
9043
|
+
} catch {
|
|
9044
|
+
}
|
|
9045
|
+
return fs6.openSync(p2, "a", 384);
|
|
9046
|
+
} catch {
|
|
9047
|
+
return null;
|
|
9048
|
+
}
|
|
9049
|
+
}
|
|
9002
9050
|
function spawnHeadroomProxy(logging, opts = {}) {
|
|
9003
9051
|
try {
|
|
9004
9052
|
const nowMs = Date.now();
|
|
@@ -9012,15 +9060,22 @@ function spawnHeadroomProxy(logging, opts = {}) {
|
|
|
9012
9060
|
...process.env,
|
|
9013
9061
|
HEADROOM_KOMPRESS_BACKEND: "onnx_cpu"
|
|
9014
9062
|
};
|
|
9063
|
+
const logFd = openProxyLogFd();
|
|
9015
9064
|
const proxy = (0, import_child_process2.spawn)(
|
|
9016
9065
|
"headroom",
|
|
9017
9066
|
["proxy", "--port", "8787", ...buildBudgetProxyArgs(proxyEnv)],
|
|
9018
9067
|
{
|
|
9019
|
-
stdio: "ignore",
|
|
9068
|
+
stdio: logFd === null ? "ignore" : ["ignore", logFd, logFd],
|
|
9020
9069
|
detached: true,
|
|
9021
9070
|
env: proxyEnv
|
|
9022
9071
|
}
|
|
9023
9072
|
);
|
|
9073
|
+
if (logFd !== null) {
|
|
9074
|
+
try {
|
|
9075
|
+
fs6.closeSync(logFd);
|
|
9076
|
+
} catch {
|
|
9077
|
+
}
|
|
9078
|
+
}
|
|
9024
9079
|
proxy.once("error", (e) => {
|
|
9025
9080
|
log.warn(logging.tag, logging.spawnErrorMsg(e.message));
|
|
9026
9081
|
});
|
|
@@ -9045,6 +9100,11 @@ async function ensureHeadroomProxy(deps) {
|
|
|
9045
9100
|
if (deps.proxyProcessAlive()) return "starting";
|
|
9046
9101
|
const ageMs = deps.proxyStartupAgeMs();
|
|
9047
9102
|
if (ageMs !== null && ageMs < PROXY_STARTUP_GRACE_MS) return "starting";
|
|
9103
|
+
const adopted = deps.adoptRunningProxy?.() ?? null;
|
|
9104
|
+
if (adopted !== null) {
|
|
9105
|
+
log.info("headroom-supervisor", `adopted an already-running proxy (pid ${adopted})`);
|
|
9106
|
+
return "starting";
|
|
9107
|
+
}
|
|
9048
9108
|
log.warn("headroom-supervisor", "proxy :8787 is confirmed down \u2014 respawning");
|
|
9049
9109
|
(deps.spawnProxyForce ?? deps.spawnProxy)();
|
|
9050
9110
|
return "respawned";
|
|
@@ -9070,7 +9130,13 @@ async function ensureHeadroomProxyReady(deps, opts = {}) {
|
|
|
9070
9130
|
log.warn("headroom-supervisor", "proxy :8787 still not ready after respawn wait \u2014 proceeding anyway");
|
|
9071
9131
|
return false;
|
|
9072
9132
|
}
|
|
9073
|
-
function isHeadroomConfiguredReal(homeDir2 =
|
|
9133
|
+
function isHeadroomConfiguredReal(homeDir2 = os7.homedir()) {
|
|
9134
|
+
const ownConfig = path6.join(homeDir2, ".codeam", "headroom-config.json");
|
|
9135
|
+
try {
|
|
9136
|
+
const j2 = JSON.parse(fs7.readFileSync(ownConfig, "utf8"));
|
|
9137
|
+
if (j2.enabled === true) return true;
|
|
9138
|
+
} catch {
|
|
9139
|
+
}
|
|
9074
9140
|
if (process.env.HEADROOM_ENABLED === "1") return true;
|
|
9075
9141
|
const csEnv = path6.join(homeDir2, ".codeam", "codespace-env.json");
|
|
9076
9142
|
try {
|
|
@@ -9080,7 +9146,8 @@ function isHeadroomConfiguredReal(homeDir2 = os6.homedir()) {
|
|
|
9080
9146
|
}
|
|
9081
9147
|
const settings = path6.join(homeDir2, ".claude", "settings.json");
|
|
9082
9148
|
try {
|
|
9083
|
-
|
|
9149
|
+
const raw = fs7.readFileSync(settings, "utf8");
|
|
9150
|
+
if (raw.includes("127.0.0.1:8787") || raw.includes("headroom init hook")) return true;
|
|
9084
9151
|
} catch {
|
|
9085
9152
|
}
|
|
9086
9153
|
return false;
|
|
@@ -9112,6 +9179,7 @@ function makeRealProxySupervisorDeps() {
|
|
|
9112
9179
|
probeAlive: probeProxyAliveReal,
|
|
9113
9180
|
proxyProcessAlive: () => isHeadroomProxyProcessAlive(),
|
|
9114
9181
|
proxyStartupAgeMs: () => headroomProxyPidfileAgeMs(Date.now()),
|
|
9182
|
+
adoptRunningProxy: () => adoptRunningProxy(),
|
|
9115
9183
|
spawnProxy: spawnProxyReal,
|
|
9116
9184
|
spawnProxyForce: () => {
|
|
9117
9185
|
killHeadroomProxy();
|
|
@@ -9519,7 +9587,7 @@ var CommandRelayService = class _CommandRelayService {
|
|
|
9519
9587
|
// fresh + clear the "CLI update available" banner after a self-update
|
|
9520
9588
|
// (a codespace that reinstalls @latest reconnects via heartbeat, not
|
|
9521
9589
|
// pair/reconnect). Older backends ignore the extra field.
|
|
9522
|
-
..."2.
|
|
9590
|
+
..."2.62.0" ? { ideVersion: "2.62.0" } : {}
|
|
9523
9591
|
}).then(() => log.trace("relay", `heartbeat ok online=${online}`)).catch((err) => log.trace("relay", `heartbeat failed online=${online}`, err));
|
|
9524
9592
|
}
|
|
9525
9593
|
/**
|
|
@@ -9586,7 +9654,7 @@ var CommandRelayService = class _CommandRelayService {
|
|
|
9586
9654
|
// src/services/file-watcher.service.ts
|
|
9587
9655
|
var import_child_process3 = require("child_process");
|
|
9588
9656
|
var fs8 = __toESM(require("fs"));
|
|
9589
|
-
var
|
|
9657
|
+
var os8 = __toESM(require("os"));
|
|
9590
9658
|
var path7 = __toESM(require("path"));
|
|
9591
9659
|
var import_ignore = __toESM(require("ignore"));
|
|
9592
9660
|
|
|
@@ -9746,10 +9814,10 @@ var WINDOWS_LEGACY_JUNCTIONS = [
|
|
|
9746
9814
|
/[\\/]Start Menu([\\/]|$)/i,
|
|
9747
9815
|
/[\\/]Templates([\\/]|$)/i
|
|
9748
9816
|
];
|
|
9749
|
-
function isUnsafeWindowsWatchRoot(dir,
|
|
9817
|
+
function isUnsafeWindowsWatchRoot(dir, homedir52) {
|
|
9750
9818
|
const norm = (p2) => p2.replace(/\//g, "\\").replace(/\\+$/, "").toLowerCase();
|
|
9751
9819
|
const cwd = norm(dir);
|
|
9752
|
-
const home = norm(
|
|
9820
|
+
const home = norm(homedir52);
|
|
9753
9821
|
if (cwd === home) return true;
|
|
9754
9822
|
if (/^[a-z]:$/.test(cwd)) return true;
|
|
9755
9823
|
const sysRoots = [
|
|
@@ -9848,7 +9916,7 @@ var FileWatcherService = class {
|
|
|
9848
9916
|
throw new Error("FileWatcherService has already been stopped \u2014 re-instantiate to restart.");
|
|
9849
9917
|
}
|
|
9850
9918
|
const isWin = process.platform === "win32";
|
|
9851
|
-
if (isWin && isUnsafeWindowsWatchRoot(this.opts.workingDir,
|
|
9919
|
+
if (isWin && isUnsafeWindowsWatchRoot(this.opts.workingDir, os8.homedir())) {
|
|
9852
9920
|
log.warn(
|
|
9853
9921
|
"fileWatcher",
|
|
9854
9922
|
`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.`
|
|
@@ -10894,7 +10962,7 @@ function closeAllTerminals() {
|
|
|
10894
10962
|
|
|
10895
10963
|
// src/commands/start/handlers.ts
|
|
10896
10964
|
var fs62 = __toESM(require("fs"));
|
|
10897
|
-
var
|
|
10965
|
+
var os51 = __toESM(require("os"));
|
|
10898
10966
|
var path66 = __toESM(require("path"));
|
|
10899
10967
|
var import_crypto3 = require("crypto");
|
|
10900
10968
|
var import_child_process24 = require("child_process");
|
|
@@ -13784,7 +13852,7 @@ function parseFrame(frame, dispatch) {
|
|
|
13784
13852
|
|
|
13785
13853
|
// src/os/posix.ts
|
|
13786
13854
|
var fs13 = __toESM(require("fs"));
|
|
13787
|
-
var
|
|
13855
|
+
var os10 = __toESM(require("os"));
|
|
13788
13856
|
var path14 = __toESM(require("path"));
|
|
13789
13857
|
var import_node_crypto2 = require("crypto");
|
|
13790
13858
|
|
|
@@ -13809,7 +13877,7 @@ function findInPathFor(name, opts) {
|
|
|
13809
13877
|
// src/services/pty/unix.strategy.ts
|
|
13810
13878
|
var import_child_process7 = require("child_process");
|
|
13811
13879
|
var fs12 = __toESM(require("fs"));
|
|
13812
|
-
var
|
|
13880
|
+
var os9 = __toESM(require("os"));
|
|
13813
13881
|
var path13 = __toESM(require("path"));
|
|
13814
13882
|
|
|
13815
13883
|
// src/services/pty/types.ts
|
|
@@ -13892,7 +13960,7 @@ var UnixPtyStrategy = class {
|
|
|
13892
13960
|
}
|
|
13893
13961
|
const cols = process.stdout.columns || 220;
|
|
13894
13962
|
const rows = process.stdout.rows || 50;
|
|
13895
|
-
this.helperPath = path13.join(
|
|
13963
|
+
this.helperPath = path13.join(os9.tmpdir(), "codeam-pty-helper.py");
|
|
13896
13964
|
fs12.writeFileSync(this.helperPath, PYTHON_PTY_HELPER, { mode: 420 });
|
|
13897
13965
|
this.proc = (0, import_child_process7.spawn)(python, [this.helperPath, cmd, ...args2], {
|
|
13898
13966
|
stdio: ["pipe", "pipe", "inherit"],
|
|
@@ -14030,11 +14098,11 @@ var UnixPtyStrategy = class {
|
|
|
14030
14098
|
// src/os/posix.ts
|
|
14031
14099
|
var PosixOsStrategy = class {
|
|
14032
14100
|
homeDir() {
|
|
14033
|
-
return
|
|
14101
|
+
return os10.homedir();
|
|
14034
14102
|
}
|
|
14035
14103
|
scratchPath(prefix) {
|
|
14036
14104
|
const tag = `${process.pid}-${(0, import_node_crypto2.randomBytes)(4).toString("hex")}`;
|
|
14037
|
-
return path14.join(
|
|
14105
|
+
return path14.join(os10.tmpdir(), `${prefix}-${tag}`);
|
|
14038
14106
|
}
|
|
14039
14107
|
devNull() {
|
|
14040
14108
|
return "/dev/null";
|
|
@@ -14089,7 +14157,7 @@ var LinuxOsStrategy = class extends PosixOsStrategy {
|
|
|
14089
14157
|
|
|
14090
14158
|
// src/os/win32.ts
|
|
14091
14159
|
var fs14 = __toESM(require("fs"));
|
|
14092
|
-
var
|
|
14160
|
+
var os11 = __toESM(require("os"));
|
|
14093
14161
|
var path16 = __toESM(require("path"));
|
|
14094
14162
|
var import_node_crypto3 = require("crypto");
|
|
14095
14163
|
|
|
@@ -14282,11 +14350,11 @@ var WINDOWS_EXEC_EXTS = [".exe", ".cmd", ".bat", ".ps1"];
|
|
|
14282
14350
|
var Win32OsStrategy = class {
|
|
14283
14351
|
id = "win32";
|
|
14284
14352
|
homeDir() {
|
|
14285
|
-
return
|
|
14353
|
+
return os11.homedir();
|
|
14286
14354
|
}
|
|
14287
14355
|
scratchPath(prefix) {
|
|
14288
14356
|
const tag = `${process.pid}-${(0, import_node_crypto3.randomBytes)(4).toString("hex")}`;
|
|
14289
|
-
return path16.join(
|
|
14357
|
+
return path16.join(os11.tmpdir(), `${prefix}-${tag}`);
|
|
14290
14358
|
}
|
|
14291
14359
|
devNull() {
|
|
14292
14360
|
return "NUL";
|
|
@@ -14405,18 +14473,18 @@ function buildForPlatform(platform3) {
|
|
|
14405
14473
|
var import_node_crypto4 = require("crypto");
|
|
14406
14474
|
|
|
14407
14475
|
// src/agents/claude/resolver.ts
|
|
14408
|
-
function buildClaudeLaunch(extraArgs = [],
|
|
14409
|
-
const found =
|
|
14476
|
+
function buildClaudeLaunch(extraArgs = [], os64 = createOsStrategy()) {
|
|
14477
|
+
const found = os64.findInPath("claude") ?? os64.findInPath("claude-code");
|
|
14410
14478
|
if (!found) return null;
|
|
14411
|
-
return
|
|
14479
|
+
return os64.buildLaunch(found, extraArgs);
|
|
14412
14480
|
}
|
|
14413
14481
|
|
|
14414
14482
|
// src/agents/claude/installer.ts
|
|
14415
14483
|
var import_child_process9 = require("child_process");
|
|
14416
14484
|
var path17 = __toESM(require("path"));
|
|
14417
|
-
var
|
|
14485
|
+
var os12 = __toESM(require("os"));
|
|
14418
14486
|
function probeInstallDirs() {
|
|
14419
|
-
const home =
|
|
14487
|
+
const home = os12.homedir();
|
|
14420
14488
|
if (process.platform === "win32") {
|
|
14421
14489
|
return [
|
|
14422
14490
|
path17.join(home, ".claude", "local"),
|
|
@@ -14498,7 +14566,7 @@ var import_node_child_process3 = require("child_process");
|
|
|
14498
14566
|
// src/agents/claude/local-token.ts
|
|
14499
14567
|
var import_node_child_process2 = require("child_process");
|
|
14500
14568
|
var fs15 = __toESM(require("fs"));
|
|
14501
|
-
var
|
|
14569
|
+
var os13 = __toESM(require("os"));
|
|
14502
14570
|
var path18 = __toESM(require("path"));
|
|
14503
14571
|
var import_node_util3 = require("util");
|
|
14504
14572
|
var execFileP2 = (0, import_node_util3.promisify)(import_node_child_process2.execFile);
|
|
@@ -14509,7 +14577,7 @@ var KEYCHAIN_SERVICE_NAMES = [
|
|
|
14509
14577
|
"Anthropic Claude"
|
|
14510
14578
|
];
|
|
14511
14579
|
function claudeCredentialsPaths() {
|
|
14512
|
-
const home =
|
|
14580
|
+
const home = os13.homedir();
|
|
14513
14581
|
return [
|
|
14514
14582
|
path18.join(home, ".claude", ".credentials.json"),
|
|
14515
14583
|
path18.join(home, ".config", "claude", ".credentials.json")
|
|
@@ -14544,7 +14612,7 @@ async function extractLocalClaudeToken() {
|
|
|
14544
14612
|
}
|
|
14545
14613
|
function readClaudeAgentState() {
|
|
14546
14614
|
const STATE_MAX_BYTES = 256 * 1024;
|
|
14547
|
-
const candidate = path18.join(
|
|
14615
|
+
const candidate = path18.join(os13.homedir(), ".claude.json");
|
|
14548
14616
|
try {
|
|
14549
14617
|
if (!fs15.existsSync(candidate)) return void 0;
|
|
14550
14618
|
const buf = fs15.readFileSync(candidate);
|
|
@@ -14635,7 +14703,7 @@ function claudeLoginLauncher() {
|
|
|
14635
14703
|
|
|
14636
14704
|
// src/agents/claude/quota.ts
|
|
14637
14705
|
var fs16 = __toESM(require("fs"));
|
|
14638
|
-
var
|
|
14706
|
+
var os14 = __toESM(require("os"));
|
|
14639
14707
|
var path19 = __toESM(require("path"));
|
|
14640
14708
|
var import_child_process10 = require("child_process");
|
|
14641
14709
|
var HELPER_SCRIPT = `import os,pty,sys,select,signal,struct,fcntl,termios,errno
|
|
@@ -14699,7 +14767,7 @@ async function fetchClaudeQuota() {
|
|
|
14699
14767
|
resolve9(null);
|
|
14700
14768
|
return;
|
|
14701
14769
|
}
|
|
14702
|
-
const helperPath = path19.join(
|
|
14770
|
+
const helperPath = path19.join(os14.tmpdir(), "codeam-quota-helper.py");
|
|
14703
14771
|
fs16.writeFileSync(helperPath, HELPER_SCRIPT, { mode: 420 });
|
|
14704
14772
|
const python = findInPath("python3") ?? findInPath("python");
|
|
14705
14773
|
if (!python) {
|
|
@@ -14813,12 +14881,12 @@ async function spawnAndCapture(cmd, args2, opts = {}) {
|
|
|
14813
14881
|
// src/agents/claude/history.ts
|
|
14814
14882
|
var fs17 = __toESM(require("fs"));
|
|
14815
14883
|
var path20 = __toESM(require("path"));
|
|
14816
|
-
var
|
|
14884
|
+
var os15 = __toESM(require("os"));
|
|
14817
14885
|
function encodeCwd(cwd) {
|
|
14818
14886
|
return cwd.replace(/[\\/:_]/g, "-");
|
|
14819
14887
|
}
|
|
14820
14888
|
function resolveHistoryDir(cwd, projectsRoot) {
|
|
14821
|
-
const root = projectsRoot ?? path20.join(
|
|
14889
|
+
const root = projectsRoot ?? path20.join(os15.homedir(), ".claude", "projects");
|
|
14822
14890
|
const primary = path20.join(root, encodeCwd(cwd));
|
|
14823
14891
|
if (fs17.existsSync(primary)) return primary;
|
|
14824
14892
|
try {
|
|
@@ -14998,8 +15066,8 @@ var ClaudeRuntimeStrategy = class {
|
|
|
14998
15066
|
meta = getAgent("claude");
|
|
14999
15067
|
mode = "interactive";
|
|
15000
15068
|
os;
|
|
15001
|
-
constructor(
|
|
15002
|
-
this.os =
|
|
15069
|
+
constructor(os64) {
|
|
15070
|
+
this.os = os64;
|
|
15003
15071
|
}
|
|
15004
15072
|
/**
|
|
15005
15073
|
* Claude Code's react-ink TUI enables bracketed-paste mode at
|
|
@@ -15135,23 +15203,23 @@ var ClaudeRuntimeStrategy = class {
|
|
|
15135
15203
|
|
|
15136
15204
|
// src/agents/claude/deploy.ts
|
|
15137
15205
|
var fs19 = __toESM(require("fs"));
|
|
15138
|
-
var
|
|
15206
|
+
var os17 = __toESM(require("os"));
|
|
15139
15207
|
var path22 = __toESM(require("path"));
|
|
15140
15208
|
|
|
15141
15209
|
// src/agents/claude/credentials.ts
|
|
15142
15210
|
var import_child_process12 = require("child_process");
|
|
15143
15211
|
var fs18 = __toESM(require("fs"));
|
|
15144
|
-
var
|
|
15212
|
+
var os16 = __toESM(require("os"));
|
|
15145
15213
|
var path21 = __toESM(require("path"));
|
|
15146
15214
|
var import_util2 = require("util");
|
|
15147
15215
|
var execFileP3 = (0, import_util2.promisify)(import_child_process12.execFile);
|
|
15148
15216
|
async function detectLocalClaudeCredentials() {
|
|
15149
|
-
const localClaudeDir = path21.join(
|
|
15217
|
+
const localClaudeDir = path21.join(os16.homedir(), ".claude");
|
|
15150
15218
|
const flat = path21.join(localClaudeDir, ".credentials.json");
|
|
15151
15219
|
if (fs18.existsSync(flat)) {
|
|
15152
15220
|
return { source: "flat-file", description: "~/.claude/.credentials.json" };
|
|
15153
15221
|
}
|
|
15154
|
-
if (
|
|
15222
|
+
if (os16.platform() === "darwin") {
|
|
15155
15223
|
try {
|
|
15156
15224
|
await execFileP3(
|
|
15157
15225
|
"security",
|
|
@@ -15166,7 +15234,7 @@ async function detectLocalClaudeCredentials() {
|
|
|
15166
15234
|
return { source: "none", description: "" };
|
|
15167
15235
|
}
|
|
15168
15236
|
async function bridgeClaudeCredentials(provider, workspaceId) {
|
|
15169
|
-
const localClaudeDir = path21.join(
|
|
15237
|
+
const localClaudeDir = path21.join(os16.homedir(), ".claude");
|
|
15170
15238
|
const fileBased = path21.join(localClaudeDir, ".credentials.json");
|
|
15171
15239
|
if (fs18.existsSync(fileBased)) {
|
|
15172
15240
|
return { source: "flat-file", description: "~/.claude/.credentials.json" };
|
|
@@ -15260,7 +15328,7 @@ var ClaudeDeployStrategy = class {
|
|
|
15260
15328
|
process.exit(1);
|
|
15261
15329
|
}
|
|
15262
15330
|
claudeStep.stop("\u2713 Claude CLI installed");
|
|
15263
|
-
const localClaudeDir = path22.join(
|
|
15331
|
+
const localClaudeDir = path22.join(os17.homedir(), ".claude");
|
|
15264
15332
|
const haveLocalClaude = fs19.existsSync(localClaudeDir) && fs19.statSync(localClaudeDir).isDirectory();
|
|
15265
15333
|
if (haveLocalClaude) {
|
|
15266
15334
|
const copyStep = fe();
|
|
@@ -15315,7 +15383,7 @@ var ClaudeDeployStrategy = class {
|
|
|
15315
15383
|
}
|
|
15316
15384
|
}
|
|
15317
15385
|
if (opts.bridged !== "none") {
|
|
15318
|
-
const localClaudeJson = path22.join(
|
|
15386
|
+
const localClaudeJson = path22.join(os17.homedir(), ".claude.json");
|
|
15319
15387
|
if (fs19.existsSync(localClaudeJson)) {
|
|
15320
15388
|
try {
|
|
15321
15389
|
const contents = fs19.readFileSync(localClaudeJson);
|
|
@@ -15712,10 +15780,10 @@ var import_node_child_process4 = require("child_process");
|
|
|
15712
15780
|
|
|
15713
15781
|
// src/agents/codex/local-token.ts
|
|
15714
15782
|
var fs21 = __toESM(require("fs"));
|
|
15715
|
-
var
|
|
15783
|
+
var os19 = __toESM(require("os"));
|
|
15716
15784
|
var path24 = __toESM(require("path"));
|
|
15717
15785
|
function codexCredentialsPath() {
|
|
15718
|
-
return path24.join(
|
|
15786
|
+
return path24.join(os19.homedir(), ".codex", "auth.json");
|
|
15719
15787
|
}
|
|
15720
15788
|
async function extractLocalCodexToken() {
|
|
15721
15789
|
const file = codexCredentialsPath();
|
|
@@ -15779,8 +15847,8 @@ function codexCredentialLocator() {
|
|
|
15779
15847
|
function codexLoginLauncher() {
|
|
15780
15848
|
return {
|
|
15781
15849
|
async ensureInstalled() {
|
|
15782
|
-
const
|
|
15783
|
-
return
|
|
15850
|
+
const os64 = createOsStrategy();
|
|
15851
|
+
return os64.findInPath("codex") !== null;
|
|
15784
15852
|
},
|
|
15785
15853
|
launch() {
|
|
15786
15854
|
return (0, import_node_child_process4.spawn)("codex", ["login"], { stdio: "inherit" });
|
|
@@ -15803,8 +15871,8 @@ var CodexRuntimeStrategy = class {
|
|
|
15803
15871
|
meta = getAgent("codex");
|
|
15804
15872
|
mode = "interactive";
|
|
15805
15873
|
os;
|
|
15806
|
-
constructor(
|
|
15807
|
-
this.os =
|
|
15874
|
+
constructor(os64) {
|
|
15875
|
+
this.os = os64;
|
|
15808
15876
|
}
|
|
15809
15877
|
async prepareLaunch() {
|
|
15810
15878
|
let binary = this.os.findInPath("codex");
|
|
@@ -15913,12 +15981,12 @@ var CodexRuntimeStrategy = class {
|
|
|
15913
15981
|
});
|
|
15914
15982
|
}
|
|
15915
15983
|
};
|
|
15916
|
-
function resolveNpm(
|
|
15917
|
-
return
|
|
15984
|
+
function resolveNpm(os64) {
|
|
15985
|
+
return os64.id === "win32" ? "npm.cmd" : "npm";
|
|
15918
15986
|
}
|
|
15919
|
-
async function installCodexViaNpm(
|
|
15987
|
+
async function installCodexViaNpm(os64) {
|
|
15920
15988
|
return new Promise((resolve9, reject) => {
|
|
15921
|
-
const proc = (0, import_node_child_process5.spawn)(resolveNpm(
|
|
15989
|
+
const proc = (0, import_node_child_process5.spawn)(resolveNpm(os64), ["install", "-g", "@openai/codex"], {
|
|
15922
15990
|
stdio: "inherit"
|
|
15923
15991
|
});
|
|
15924
15992
|
proc.on("close", (code) => {
|
|
@@ -15935,16 +16003,16 @@ async function installCodexViaNpm(os63) {
|
|
|
15935
16003
|
});
|
|
15936
16004
|
});
|
|
15937
16005
|
}
|
|
15938
|
-
function augmentNpmGlobalBin(
|
|
16006
|
+
function augmentNpmGlobalBin(os64) {
|
|
15939
16007
|
try {
|
|
15940
|
-
const result = (0, import_node_child_process5.spawnSync)(resolveNpm(
|
|
16008
|
+
const result = (0, import_node_child_process5.spawnSync)(resolveNpm(os64), ["prefix", "-g"], {
|
|
15941
16009
|
stdio: ["ignore", "pipe", "ignore"]
|
|
15942
16010
|
});
|
|
15943
16011
|
if (result.status !== 0) return;
|
|
15944
16012
|
const prefix = result.stdout.toString().trim();
|
|
15945
16013
|
if (!prefix) return;
|
|
15946
|
-
const binDir =
|
|
15947
|
-
|
|
16014
|
+
const binDir = os64.id === "win32" ? prefix : path25.join(prefix, "bin");
|
|
16015
|
+
os64.augmentPath([binDir]);
|
|
15948
16016
|
} catch {
|
|
15949
16017
|
}
|
|
15950
16018
|
}
|
|
@@ -16028,9 +16096,9 @@ var import_node_child_process8 = require("child_process");
|
|
|
16028
16096
|
// src/agents/coderabbit/installer.ts
|
|
16029
16097
|
var import_node_child_process6 = require("child_process");
|
|
16030
16098
|
var INSTALL_URL = "https://cli.coderabbit.ai/install.sh";
|
|
16031
|
-
async function ensureCoderabbitInstalled(
|
|
16032
|
-
if (
|
|
16033
|
-
if (
|
|
16099
|
+
async function ensureCoderabbitInstalled(os64) {
|
|
16100
|
+
if (os64.findInPath("coderabbit")) return true;
|
|
16101
|
+
if (os64.id === "win32") {
|
|
16034
16102
|
console.error(
|
|
16035
16103
|
"\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"
|
|
16036
16104
|
);
|
|
@@ -16063,14 +16131,14 @@ async function ensureCoderabbitInstalled(os63) {
|
|
|
16063
16131
|
proc.on("error", () => finish(false));
|
|
16064
16132
|
});
|
|
16065
16133
|
if (!ok) return false;
|
|
16066
|
-
|
|
16067
|
-
return
|
|
16134
|
+
os64.augmentPath([`${os64.homeDir()}/.local/bin`, "/opt/homebrew/bin"]);
|
|
16135
|
+
return os64.findInPath("coderabbit") !== null;
|
|
16068
16136
|
}
|
|
16069
16137
|
|
|
16070
16138
|
// src/agents/coderabbit/link.ts
|
|
16071
16139
|
var import_node_child_process7 = require("child_process");
|
|
16072
16140
|
var fs23 = __toESM(require("fs"));
|
|
16073
|
-
var
|
|
16141
|
+
var os21 = __toESM(require("os"));
|
|
16074
16142
|
var path27 = __toESM(require("path"));
|
|
16075
16143
|
|
|
16076
16144
|
// src/agents/strategy.ts
|
|
@@ -16080,7 +16148,7 @@ function validateNonEmptyCredential(token) {
|
|
|
16080
16148
|
|
|
16081
16149
|
// src/agents/coderabbit/link.ts
|
|
16082
16150
|
function authPath() {
|
|
16083
|
-
return path27.join(
|
|
16151
|
+
return path27.join(os21.homedir(), ".coderabbit", "auth.json");
|
|
16084
16152
|
}
|
|
16085
16153
|
async function extractLocalCoderabbitToken() {
|
|
16086
16154
|
const file = authPath();
|
|
@@ -16099,10 +16167,10 @@ function coderabbitCredentialLocator() {
|
|
|
16099
16167
|
validate: validateNonEmptyCredential
|
|
16100
16168
|
};
|
|
16101
16169
|
}
|
|
16102
|
-
function coderabbitLoginLauncher(
|
|
16170
|
+
function coderabbitLoginLauncher(os64) {
|
|
16103
16171
|
return {
|
|
16104
16172
|
async ensureInstalled() {
|
|
16105
|
-
return ensureCoderabbitInstalled(
|
|
16173
|
+
return ensureCoderabbitInstalled(os64);
|
|
16106
16174
|
},
|
|
16107
16175
|
launch() {
|
|
16108
16176
|
return (0, import_node_child_process7.spawn)("coderabbit", ["auth", "login"], { stdio: "inherit" });
|
|
@@ -16195,9 +16263,9 @@ function findingsFrom(value) {
|
|
|
16195
16263
|
}
|
|
16196
16264
|
const grouped = flat && !Array.isArray(flat) ? flat : root;
|
|
16197
16265
|
for (const sev of ["critical", "warning", "warn", "error", "info", "note"]) {
|
|
16198
|
-
const
|
|
16199
|
-
if (Array.isArray(
|
|
16200
|
-
for (const f of
|
|
16266
|
+
const bucket2 = grouped[sev];
|
|
16267
|
+
if (Array.isArray(bucket2)) {
|
|
16268
|
+
for (const f of bucket2) {
|
|
16201
16269
|
const h = toHunk(f, sev);
|
|
16202
16270
|
if (h) out2.push(h);
|
|
16203
16271
|
}
|
|
@@ -16322,8 +16390,8 @@ var CoderabbitRuntimeStrategy = class {
|
|
|
16322
16390
|
meta = getAgent("coderabbit");
|
|
16323
16391
|
mode = "batch";
|
|
16324
16392
|
os;
|
|
16325
|
-
constructor(
|
|
16326
|
-
this.os =
|
|
16393
|
+
constructor(os64) {
|
|
16394
|
+
this.os = os64;
|
|
16327
16395
|
}
|
|
16328
16396
|
getDefaultArgs() {
|
|
16329
16397
|
return ["review", "--agent"];
|
|
@@ -16426,11 +16494,11 @@ CodeRabbit review timed out after ${Math.round(
|
|
|
16426
16494
|
|
|
16427
16495
|
// src/agents/cursor/history.ts
|
|
16428
16496
|
var fs24 = __toESM(require("fs"));
|
|
16429
|
-
var
|
|
16497
|
+
var os22 = __toESM(require("os"));
|
|
16430
16498
|
var path28 = __toESM(require("path"));
|
|
16431
16499
|
var import_node_crypto5 = require("crypto");
|
|
16432
|
-
var HISTORY_ROOT = path28.join(
|
|
16433
|
-
var CURSOR_HOME = path28.join(
|
|
16500
|
+
var HISTORY_ROOT = path28.join(os22.homedir(), ".cursor", "projects");
|
|
16501
|
+
var CURSOR_HOME = path28.join(os22.homedir(), ".cursor");
|
|
16434
16502
|
var STORE_FILES = ["store.db", "store.db-wal", "store.db-shm"];
|
|
16435
16503
|
function acpSessionDir(sessionId) {
|
|
16436
16504
|
return path28.join(CURSOR_HOME, "acp-sessions", sessionId);
|
|
@@ -16567,10 +16635,10 @@ var import_node_child_process9 = require("child_process");
|
|
|
16567
16635
|
|
|
16568
16636
|
// src/agents/cursor/local-token.ts
|
|
16569
16637
|
var fs25 = __toESM(require("fs"));
|
|
16570
|
-
var
|
|
16638
|
+
var os23 = __toESM(require("os"));
|
|
16571
16639
|
var path29 = __toESM(require("path"));
|
|
16572
16640
|
function cursorCredentialsPath() {
|
|
16573
|
-
return path29.join(
|
|
16641
|
+
return path29.join(os23.homedir(), ".cursor", "auth.json");
|
|
16574
16642
|
}
|
|
16575
16643
|
async function extractLocalCursorToken() {
|
|
16576
16644
|
const file = cursorCredentialsPath();
|
|
@@ -16594,10 +16662,10 @@ function cursorCredentialLocator() {
|
|
|
16594
16662
|
validate: validateNonEmptyCredential
|
|
16595
16663
|
};
|
|
16596
16664
|
}
|
|
16597
|
-
function cursorLoginLauncher(
|
|
16665
|
+
function cursorLoginLauncher(os64) {
|
|
16598
16666
|
return {
|
|
16599
16667
|
async ensureInstalled() {
|
|
16600
|
-
if (
|
|
16668
|
+
if (os64.findInPath("cursor-agent")) return true;
|
|
16601
16669
|
console.error(
|
|
16602
16670
|
"\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"
|
|
16603
16671
|
);
|
|
@@ -16661,8 +16729,8 @@ var CursorRuntimeStrategy = class {
|
|
|
16661
16729
|
meta = getAgent("cursor");
|
|
16662
16730
|
mode = "interactive";
|
|
16663
16731
|
os;
|
|
16664
|
-
constructor(
|
|
16665
|
-
this.os =
|
|
16732
|
+
constructor(os64) {
|
|
16733
|
+
this.os = os64;
|
|
16666
16734
|
}
|
|
16667
16735
|
async prepareLaunch() {
|
|
16668
16736
|
const binary = this.os.findInPath("cursor-agent");
|
|
@@ -16837,9 +16905,9 @@ var import_node_child_process11 = require("child_process");
|
|
|
16837
16905
|
|
|
16838
16906
|
// src/agents/aider/local-token.ts
|
|
16839
16907
|
var fs27 = __toESM(require("fs"));
|
|
16840
|
-
var
|
|
16908
|
+
var os24 = __toESM(require("os"));
|
|
16841
16909
|
var path31 = __toESM(require("path"));
|
|
16842
|
-
var AIDER_CONF_FILE = path31.join(
|
|
16910
|
+
var AIDER_CONF_FILE = path31.join(os24.homedir(), ".aider.conf.yml");
|
|
16843
16911
|
var API_KEY_ENV_VARS = [
|
|
16844
16912
|
"ANTHROPIC_API_KEY",
|
|
16845
16913
|
"OPENAI_API_KEY",
|
|
@@ -16878,10 +16946,10 @@ function aiderCredentialLocator() {
|
|
|
16878
16946
|
validate: validateNonEmptyCredential
|
|
16879
16947
|
};
|
|
16880
16948
|
}
|
|
16881
|
-
function aiderLoginLauncher(
|
|
16949
|
+
function aiderLoginLauncher(os64) {
|
|
16882
16950
|
return {
|
|
16883
16951
|
async ensureInstalled() {
|
|
16884
|
-
if (
|
|
16952
|
+
if (os64.findInPath("aider")) return true;
|
|
16885
16953
|
console.error(
|
|
16886
16954
|
"\n \u2717 aider binary not on PATH.\n Install Aider:\n pip install aider-chat\n then re-run `codeam link aider`.\n"
|
|
16887
16955
|
);
|
|
@@ -16891,7 +16959,7 @@ function aiderLoginLauncher(os63) {
|
|
|
16891
16959
|
console.error(
|
|
16892
16960
|
"\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"
|
|
16893
16961
|
);
|
|
16894
|
-
return (0, import_node_child_process11.spawn)(
|
|
16962
|
+
return (0, import_node_child_process11.spawn)(os64.id === "win32" ? "cmd.exe" : "sh", os64.id === "win32" ? ["/c", "exit", "0"] : ["-c", "exit 0"], {
|
|
16895
16963
|
stdio: "ignore"
|
|
16896
16964
|
});
|
|
16897
16965
|
}
|
|
@@ -16963,8 +17031,8 @@ var AiderRuntimeStrategy = class {
|
|
|
16963
17031
|
meta = getAgent("aider");
|
|
16964
17032
|
mode = "interactive";
|
|
16965
17033
|
os;
|
|
16966
|
-
constructor(
|
|
16967
|
-
this.os =
|
|
17034
|
+
constructor(os64) {
|
|
17035
|
+
this.os = os64;
|
|
16968
17036
|
}
|
|
16969
17037
|
async prepareLaunch() {
|
|
16970
17038
|
const binary = this.os.findInPath("aider");
|
|
@@ -17039,10 +17107,10 @@ var import_node_child_process12 = require("child_process");
|
|
|
17039
17107
|
|
|
17040
17108
|
// src/agents/gemini/local-token.ts
|
|
17041
17109
|
var fs28 = __toESM(require("fs"));
|
|
17042
|
-
var
|
|
17110
|
+
var os25 = __toESM(require("os"));
|
|
17043
17111
|
var path32 = __toESM(require("path"));
|
|
17044
17112
|
function geminiCredentialsPath() {
|
|
17045
|
-
return path32.join(
|
|
17113
|
+
return path32.join(os25.homedir(), ".gemini", "oauth_creds.json");
|
|
17046
17114
|
}
|
|
17047
17115
|
function geminiCredentialsPaths() {
|
|
17048
17116
|
return [geminiCredentialsPath()];
|
|
@@ -17096,8 +17164,8 @@ function geminiCredentialLocator() {
|
|
|
17096
17164
|
function geminiLoginLauncher() {
|
|
17097
17165
|
return {
|
|
17098
17166
|
async ensureInstalled() {
|
|
17099
|
-
const
|
|
17100
|
-
return
|
|
17167
|
+
const os64 = createOsStrategy();
|
|
17168
|
+
return os64.findInPath("gemini") !== null;
|
|
17101
17169
|
},
|
|
17102
17170
|
launch() {
|
|
17103
17171
|
return (0, import_node_child_process12.spawn)("gemini", ["auth", "login"], { stdio: "inherit" });
|
|
@@ -17107,9 +17175,9 @@ function geminiLoginLauncher() {
|
|
|
17107
17175
|
|
|
17108
17176
|
// src/agents/gemini/history.ts
|
|
17109
17177
|
var fs29 = __toESM(require("fs"));
|
|
17110
|
-
var
|
|
17178
|
+
var os26 = __toESM(require("os"));
|
|
17111
17179
|
var path33 = __toESM(require("path"));
|
|
17112
|
-
var GEMINI_ROOT = path33.join(
|
|
17180
|
+
var GEMINI_ROOT = path33.join(os26.homedir(), ".gemini");
|
|
17113
17181
|
function projectNameForCwd(cwd, root) {
|
|
17114
17182
|
try {
|
|
17115
17183
|
const parsed = JSON.parse(
|
|
@@ -17287,8 +17355,8 @@ var GeminiRuntimeStrategy = class {
|
|
|
17287
17355
|
meta = getAgent("gemini");
|
|
17288
17356
|
mode = "interactive";
|
|
17289
17357
|
os;
|
|
17290
|
-
constructor(
|
|
17291
|
-
this.os =
|
|
17358
|
+
constructor(os64) {
|
|
17359
|
+
this.os = os64;
|
|
17292
17360
|
}
|
|
17293
17361
|
async prepareLaunch() {
|
|
17294
17362
|
const binary = this.os.findInPath("gemini");
|
|
@@ -17402,11 +17470,11 @@ var import_node_path4 = require("path");
|
|
|
17402
17470
|
|
|
17403
17471
|
// src/agents/kimi/history.ts
|
|
17404
17472
|
var fs30 = __toESM(require("fs"));
|
|
17405
|
-
var
|
|
17473
|
+
var os27 = __toESM(require("os"));
|
|
17406
17474
|
var path34 = __toESM(require("path"));
|
|
17407
17475
|
var import_node_crypto7 = require("crypto");
|
|
17408
17476
|
function kimiHome() {
|
|
17409
|
-
return process.env.KIMI_CODE_HOME || path34.join(
|
|
17477
|
+
return process.env.KIMI_CODE_HOME || path34.join(os27.homedir(), ".kimi-code");
|
|
17410
17478
|
}
|
|
17411
17479
|
function workDirKey(cwd) {
|
|
17412
17480
|
const hash = (0, import_node_crypto7.createHash)("sha256").update(cwd).digest("hex").slice(0, 12);
|
|
@@ -17427,8 +17495,8 @@ function resolveHistoryFile5(cwd, sessionId) {
|
|
|
17427
17495
|
const p2 = path34.join(fromIndex, WIRE_REL);
|
|
17428
17496
|
if (fs30.existsSync(p2)) return p2;
|
|
17429
17497
|
}
|
|
17430
|
-
const
|
|
17431
|
-
const computed = path34.join(
|
|
17498
|
+
const bucket2 = path34.join(kimiHome(), "sessions", workDirKey(cwd));
|
|
17499
|
+
const computed = path34.join(bucket2, sessionId, WIRE_REL);
|
|
17432
17500
|
if (fs30.existsSync(computed)) return computed;
|
|
17433
17501
|
const scanned = scanBucketsForSession(sessionId);
|
|
17434
17502
|
if (scanned) return scanned;
|
|
@@ -17467,20 +17535,20 @@ function scanBucketsForSession(sessionId) {
|
|
|
17467
17535
|
return null;
|
|
17468
17536
|
}
|
|
17469
17537
|
async function discoverSessionId2(cwd, opts) {
|
|
17470
|
-
const
|
|
17538
|
+
const bucket2 = path34.join(kimiHome(), "sessions", workDirKey(cwd));
|
|
17471
17539
|
const floor = opts.sinceMs - 2e3;
|
|
17472
17540
|
const deadline = Date.now() + (opts.timeoutMs ?? 15e3);
|
|
17473
17541
|
for (; ; ) {
|
|
17474
|
-
const id = newestSessionSince(
|
|
17542
|
+
const id = newestSessionSince(bucket2, floor);
|
|
17475
17543
|
if (id) return id;
|
|
17476
17544
|
if (Date.now() >= deadline) return null;
|
|
17477
17545
|
await sleep3(250);
|
|
17478
17546
|
}
|
|
17479
17547
|
}
|
|
17480
|
-
function newestSessionSince(
|
|
17548
|
+
function newestSessionSince(bucket2, floorMs) {
|
|
17481
17549
|
let entries;
|
|
17482
17550
|
try {
|
|
17483
|
-
entries = fs30.readdirSync(
|
|
17551
|
+
entries = fs30.readdirSync(bucket2, { withFileTypes: true });
|
|
17484
17552
|
} catch {
|
|
17485
17553
|
return null;
|
|
17486
17554
|
}
|
|
@@ -17490,7 +17558,7 @@ function newestSessionSince(bucket, floorMs) {
|
|
|
17490
17558
|
if (!e.isDirectory() || !e.name.startsWith("session_")) continue;
|
|
17491
17559
|
let mtime;
|
|
17492
17560
|
try {
|
|
17493
|
-
mtime = fs30.statSync(path34.join(
|
|
17561
|
+
mtime = fs30.statSync(path34.join(bucket2, e.name)).mtimeMs;
|
|
17494
17562
|
} catch {
|
|
17495
17563
|
continue;
|
|
17496
17564
|
}
|
|
@@ -17579,8 +17647,8 @@ var KimiRuntimeStrategy = class {
|
|
|
17579
17647
|
meta = getAgent("kimi");
|
|
17580
17648
|
mode = "interactive";
|
|
17581
17649
|
os;
|
|
17582
|
-
constructor(
|
|
17583
|
-
this.os =
|
|
17650
|
+
constructor(os64) {
|
|
17651
|
+
this.os = os64;
|
|
17584
17652
|
}
|
|
17585
17653
|
async prepareLaunch() {
|
|
17586
17654
|
const binary = this.os.findInPath("kimi");
|
|
@@ -17722,8 +17790,8 @@ var OpencodeRuntimeStrategy = class {
|
|
|
17722
17790
|
meta = getAgent("opencode");
|
|
17723
17791
|
mode = "interactive";
|
|
17724
17792
|
os;
|
|
17725
|
-
constructor(
|
|
17726
|
-
this.os =
|
|
17793
|
+
constructor(os64) {
|
|
17794
|
+
this.os = os64;
|
|
17727
17795
|
}
|
|
17728
17796
|
async prepareLaunch() {
|
|
17729
17797
|
const binary = this.os.findInPath("opencode");
|
|
@@ -17807,20 +17875,20 @@ var OpencodeRuntimeStrategy = class {
|
|
|
17807
17875
|
|
|
17808
17876
|
// src/agents/registry.ts
|
|
17809
17877
|
var runtimeBuilders = {
|
|
17810
|
-
claude: (
|
|
17811
|
-
codex: (
|
|
17812
|
-
coderabbit: (
|
|
17813
|
-
cursor: (
|
|
17814
|
-
aider: (
|
|
17815
|
-
gemini: (
|
|
17816
|
-
kimi: (
|
|
17817
|
-
opencode: (
|
|
17878
|
+
claude: (os64) => new ClaudeRuntimeStrategy(os64),
|
|
17879
|
+
codex: (os64) => new CodexRuntimeStrategy(os64),
|
|
17880
|
+
coderabbit: (os64) => new CoderabbitRuntimeStrategy(os64),
|
|
17881
|
+
cursor: (os64) => new CursorRuntimeStrategy(os64),
|
|
17882
|
+
aider: (os64) => new AiderRuntimeStrategy(os64),
|
|
17883
|
+
gemini: (os64) => new GeminiRuntimeStrategy(os64),
|
|
17884
|
+
kimi: (os64) => new KimiRuntimeStrategy(os64),
|
|
17885
|
+
opencode: (os64) => new OpencodeRuntimeStrategy(os64)
|
|
17818
17886
|
};
|
|
17819
17887
|
var deployBuilders = {
|
|
17820
17888
|
claude: () => new ClaudeDeployStrategy(),
|
|
17821
17889
|
codex: () => new CodexDeployStrategy()
|
|
17822
17890
|
};
|
|
17823
|
-
function createAgentStrategy(agent,
|
|
17891
|
+
function createAgentStrategy(agent, os64 = createOsStrategy()) {
|
|
17824
17892
|
if (!AGENT_REGISTRY[agent]?.enabled) {
|
|
17825
17893
|
throw new Error(
|
|
17826
17894
|
`Agent "${agent}" is not supported in this codeam-cli version. Upgrade with 'npm i -g codeam-cli@latest'.`
|
|
@@ -17830,10 +17898,10 @@ function createAgentStrategy(agent, os63 = createOsStrategy()) {
|
|
|
17830
17898
|
if (!build) {
|
|
17831
17899
|
throw new Error(`No runtime strategy registered for agent "${agent}"`);
|
|
17832
17900
|
}
|
|
17833
|
-
return build(
|
|
17901
|
+
return build(os64);
|
|
17834
17902
|
}
|
|
17835
|
-
function createInteractiveAgentStrategy(agent,
|
|
17836
|
-
const s = createAgentStrategy(agent,
|
|
17903
|
+
function createInteractiveAgentStrategy(agent, os64 = createOsStrategy()) {
|
|
17904
|
+
const s = createAgentStrategy(agent, os64);
|
|
17837
17905
|
if (s.mode !== "interactive") {
|
|
17838
17906
|
throw new Error(
|
|
17839
17907
|
`Agent "${agent}" is a batch agent; use createAgentStrategy + .runOneShot for one-shot reviews.`
|
|
@@ -18241,7 +18309,7 @@ var path37 = __toESM(require("path"));
|
|
|
18241
18309
|
// src/agents/coderabbit/oauth.ts
|
|
18242
18310
|
var import_node_child_process15 = require("child_process");
|
|
18243
18311
|
var fs32 = __toESM(require("fs"));
|
|
18244
|
-
var
|
|
18312
|
+
var os28 = __toESM(require("os"));
|
|
18245
18313
|
var path36 = __toESM(require("path"));
|
|
18246
18314
|
function parseCoderabbitAuthEvent(line) {
|
|
18247
18315
|
const l = line.replace(/\x1b\[[0-9;?]*[A-Za-z]/g, "").trim();
|
|
@@ -18291,7 +18359,7 @@ function resolvePython() {
|
|
|
18291
18359
|
function spawnCoderabbitLoginProc(cmd, args2) {
|
|
18292
18360
|
const python = resolvePython();
|
|
18293
18361
|
if (python) {
|
|
18294
|
-
const helper = path36.join(
|
|
18362
|
+
const helper = path36.join(os28.tmpdir(), "codeam-cr-pty.py");
|
|
18295
18363
|
fs32.writeFileSync(helper, PYTHON_PTY_HELPER, { mode: 420 });
|
|
18296
18364
|
return (0, import_node_child_process15.spawn)(python, [helper, cmd, ...args2], {
|
|
18297
18365
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -18403,7 +18471,7 @@ function runCoderabbitOAuthLogin(deps) {
|
|
|
18403
18471
|
});
|
|
18404
18472
|
}
|
|
18405
18473
|
function coderabbitDir(home) {
|
|
18406
|
-
return path36.join(home ??
|
|
18474
|
+
return path36.join(home ?? os28.homedir(), ".coderabbit");
|
|
18407
18475
|
}
|
|
18408
18476
|
var NON_CREDENTIAL = /* @__PURE__ */ new Set(["doctor.json", "machine-id"]);
|
|
18409
18477
|
function snapshotCredentialDir(home) {
|
|
@@ -18530,26 +18598,26 @@ function restoreCoderabbitOauthBlob(value) {
|
|
|
18530
18598
|
(0, import_node_fs5.writeFileSync)(path37.join(dir, file), contents, { mode: 384 });
|
|
18531
18599
|
}
|
|
18532
18600
|
async function configureCoderabbit(input, deps = {}) {
|
|
18533
|
-
const
|
|
18601
|
+
const os64 = deps.os ?? createOsStrategy();
|
|
18534
18602
|
const ensureInstalled = deps.ensureInstalled ?? ensureCoderabbitInstalled;
|
|
18535
18603
|
const isLoggedIn = deps.isLoggedIn ?? defaultIsLoggedIn;
|
|
18536
18604
|
const runOAuth = deps.runOAuthLogin ?? runCoderabbitOAuthLogin;
|
|
18537
18605
|
const snapshot = deps.snapshotDir ?? (() => snapshotCredentialDir());
|
|
18538
18606
|
const capture2 = deps.captureCredential ?? ((b) => diffCapturedCredential(b));
|
|
18539
18607
|
const loginWithApiKey = deps.loginWithApiKey ?? defaultLoginWithApiKey;
|
|
18540
|
-
const home =
|
|
18541
|
-
|
|
18542
|
-
|
|
18608
|
+
const home = os64.homeDir();
|
|
18609
|
+
os64.augmentPath(
|
|
18610
|
+
os64.id === "win32" ? [
|
|
18543
18611
|
path37.join(home, ".local", "bin"),
|
|
18544
18612
|
path37.join(process.env.APPDATA ?? path37.join(home, "AppData", "Roaming"), "npm"),
|
|
18545
18613
|
path37.join(home, "scoop", "shims")
|
|
18546
18614
|
] : [path37.join(home, ".local", "bin"), "/opt/homebrew/bin", "/usr/local/bin"]
|
|
18547
18615
|
);
|
|
18548
|
-
const installed2 =
|
|
18616
|
+
const installed2 = os64.findInPath("coderabbit") !== null;
|
|
18549
18617
|
const base = () => ({
|
|
18550
18618
|
action: input.action,
|
|
18551
18619
|
supported: true,
|
|
18552
|
-
installed:
|
|
18620
|
+
installed: os64.findInPath("coderabbit") !== null,
|
|
18553
18621
|
loggedIn: false
|
|
18554
18622
|
});
|
|
18555
18623
|
if (input.action === "status") {
|
|
@@ -18563,7 +18631,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
18563
18631
|
const key = (input.apiKey ?? "").trim();
|
|
18564
18632
|
if (!key) return { ...res2, error: "No API key provided" };
|
|
18565
18633
|
if (!res2.installed) {
|
|
18566
|
-
const ok = await ensureInstalled(
|
|
18634
|
+
const ok = await ensureInstalled(os64);
|
|
18567
18635
|
res2.installed = ok;
|
|
18568
18636
|
if (!ok) return { ...res2, error: "CodeRabbit CLI could not be installed" };
|
|
18569
18637
|
}
|
|
@@ -18587,7 +18655,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
18587
18655
|
}
|
|
18588
18656
|
if (!res2.installed) {
|
|
18589
18657
|
deps.onEvent?.({ kind: "installing" });
|
|
18590
|
-
const ok = await ensureInstalled(
|
|
18658
|
+
const ok = await ensureInstalled(os64);
|
|
18591
18659
|
res2.installed = ok;
|
|
18592
18660
|
if (!ok) return { ...res2, error: "CodeRabbit CLI could not be installed" };
|
|
18593
18661
|
}
|
|
@@ -18617,7 +18685,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
18617
18685
|
const res2 = base();
|
|
18618
18686
|
if (!installed2) {
|
|
18619
18687
|
deps.onEvent?.({ kind: "installing" });
|
|
18620
|
-
const ok = await ensureInstalled(
|
|
18688
|
+
const ok = await ensureInstalled(os64);
|
|
18621
18689
|
res2.installed = ok;
|
|
18622
18690
|
if (!ok) return { ...res2, error: "CodeRabbit CLI could not be installed" };
|
|
18623
18691
|
}
|
|
@@ -18657,7 +18725,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
18657
18725
|
}
|
|
18658
18726
|
const res = base();
|
|
18659
18727
|
if (!res.installed) {
|
|
18660
|
-
const ok = await ensureInstalled(
|
|
18728
|
+
const ok = await ensureInstalled(os64);
|
|
18661
18729
|
res.installed = ok;
|
|
18662
18730
|
if (!ok) return { ...res, error: "CodeRabbit CLI is not installed" };
|
|
18663
18731
|
}
|
|
@@ -18841,7 +18909,7 @@ function defaultRunGh(args2) {
|
|
|
18841
18909
|
|
|
18842
18910
|
// src/commands/host-agent.ts
|
|
18843
18911
|
var import_node_child_process25 = require("child_process");
|
|
18844
|
-
var
|
|
18912
|
+
var os40 = __toESM(require("os"));
|
|
18845
18913
|
var fs45 = __toESM(require("fs"));
|
|
18846
18914
|
var path48 = __toESM(require("path"));
|
|
18847
18915
|
|
|
@@ -18990,13 +19058,13 @@ function describeReason(reason) {
|
|
|
18990
19058
|
|
|
18991
19059
|
// src/commands/host/host-client.ts
|
|
18992
19060
|
var fs36 = __toESM(require("fs"));
|
|
18993
|
-
var
|
|
19061
|
+
var os32 = __toESM(require("os"));
|
|
18994
19062
|
var path40 = __toESM(require("path"));
|
|
18995
19063
|
var import_node_crypto9 = require("crypto");
|
|
18996
19064
|
function sampleCpuTimes() {
|
|
18997
19065
|
let idle = 0;
|
|
18998
19066
|
let total = 0;
|
|
18999
|
-
for (const cpu of
|
|
19067
|
+
for (const cpu of os32.cpus()) {
|
|
19000
19068
|
const t2 = cpu.times;
|
|
19001
19069
|
idle += t2.idle;
|
|
19002
19070
|
total += t2.user + t2.nice + t2.sys + t2.idle + t2.irq;
|
|
@@ -19015,8 +19083,8 @@ var MetricsCollector = class {
|
|
|
19015
19083
|
const prev = this.prevCpu;
|
|
19016
19084
|
this.prevCpu = current2;
|
|
19017
19085
|
if (!prev) {
|
|
19018
|
-
const cores =
|
|
19019
|
-
const proxy =
|
|
19086
|
+
const cores = os32.cpus().length || 1;
|
|
19087
|
+
const proxy = os32.loadavg()[0] / cores * 100;
|
|
19020
19088
|
return Math.min(100, Math.max(0, Math.round(proxy)));
|
|
19021
19089
|
}
|
|
19022
19090
|
const idleDelta = current2.idle - prev.idle;
|
|
@@ -19029,8 +19097,8 @@ var MetricsCollector = class {
|
|
|
19029
19097
|
collect() {
|
|
19030
19098
|
return {
|
|
19031
19099
|
cpuPct: this.cpuPct(),
|
|
19032
|
-
ramUsedMb: Math.round((
|
|
19033
|
-
ramTotalMb: Math.round(
|
|
19100
|
+
ramUsedMb: Math.round((os32.totalmem() - os32.freemem()) / 1048576),
|
|
19101
|
+
ramTotalMb: Math.round(os32.totalmem() / 1048576),
|
|
19034
19102
|
latencyMs: this.lastLatencyMs
|
|
19035
19103
|
};
|
|
19036
19104
|
}
|
|
@@ -19039,13 +19107,13 @@ function apiBase() {
|
|
|
19039
19107
|
return process.env.CODEAM_API_URL ?? resolveApiBaseUrl();
|
|
19040
19108
|
}
|
|
19041
19109
|
function hostIdentityPath() {
|
|
19042
|
-
return path40.join(
|
|
19110
|
+
return path40.join(os32.homedir(), ".codeam", "host-agent.json");
|
|
19043
19111
|
}
|
|
19044
19112
|
function collectOsInfo() {
|
|
19045
19113
|
return {
|
|
19046
|
-
distro:
|
|
19047
|
-
arch:
|
|
19048
|
-
kernel:
|
|
19114
|
+
distro: os32.platform(),
|
|
19115
|
+
arch: os32.arch(),
|
|
19116
|
+
kernel: os32.release(),
|
|
19049
19117
|
nodeVersion: process.versions.node
|
|
19050
19118
|
};
|
|
19051
19119
|
}
|
|
@@ -19140,7 +19208,7 @@ async function postJson(pathname, body) {
|
|
|
19140
19208
|
function resolveHostLabel(label) {
|
|
19141
19209
|
const explicit = label?.trim();
|
|
19142
19210
|
const envLabel = process.env.CODEAM_HOST_LABEL?.trim();
|
|
19143
|
-
const resolved = explicit || envLabel ||
|
|
19211
|
+
const resolved = explicit || envLabel || os32.hostname();
|
|
19144
19212
|
return resolved.slice(0, 80);
|
|
19145
19213
|
}
|
|
19146
19214
|
async function redeemEnrollToken(token, label) {
|
|
@@ -19252,7 +19320,7 @@ async function reportDeployProgress(auth, deployId, step, message, sessionId) {
|
|
|
19252
19320
|
|
|
19253
19321
|
// src/commands/host/workspace.ts
|
|
19254
19322
|
var fs37 = __toESM(require("fs"));
|
|
19255
|
-
var
|
|
19323
|
+
var os33 = __toESM(require("os"));
|
|
19256
19324
|
var path41 = __toESM(require("path"));
|
|
19257
19325
|
var import_node_child_process19 = require("child_process");
|
|
19258
19326
|
var import_node_util4 = require("util");
|
|
@@ -19261,7 +19329,7 @@ function isAbsolutePathTarget(target) {
|
|
|
19261
19329
|
return path41.isAbsolute(target);
|
|
19262
19330
|
}
|
|
19263
19331
|
function selfHostedWorkspaceRoot() {
|
|
19264
|
-
return path41.join(
|
|
19332
|
+
return path41.join(os33.homedir(), ".codeam", "self-hosted");
|
|
19265
19333
|
}
|
|
19266
19334
|
function nonInteractiveGitEnv() {
|
|
19267
19335
|
return {
|
|
@@ -19401,7 +19469,7 @@ async function prepareWorkspace(repoOrPath, deployId, cloneToken, provider = "gi
|
|
|
19401
19469
|
|
|
19402
19470
|
// src/commands/host/agent-provisioning.ts
|
|
19403
19471
|
var fs38 = __toESM(require("fs"));
|
|
19404
|
-
var
|
|
19472
|
+
var os34 = __toESM(require("os"));
|
|
19405
19473
|
var path42 = __toESM(require("path"));
|
|
19406
19474
|
var PUBLIC_TO_INTERNAL_AGENT = {
|
|
19407
19475
|
claude_code: "claude",
|
|
@@ -19586,7 +19654,7 @@ var UnsupportedAgentError = class extends Error {
|
|
|
19586
19654
|
this.agentId = agentId;
|
|
19587
19655
|
}
|
|
19588
19656
|
};
|
|
19589
|
-
function provisionAgentCredentials(publicAgentId, auth, homeDir2 =
|
|
19657
|
+
function provisionAgentCredentials(publicAgentId, auth, homeDir2 = os34.homedir()) {
|
|
19590
19658
|
const internal = toInternalAgentId(publicAgentId);
|
|
19591
19659
|
if (!internal) throw new UnsupportedAgentError(publicAgentId);
|
|
19592
19660
|
const provisioner = PROVISIONERS[internal];
|
|
@@ -19597,10 +19665,10 @@ function provisionAgentCredentials(publicAgentId, auth, homeDir2 = os33.homedir(
|
|
|
19597
19665
|
// src/commands/host/git-tooling.ts
|
|
19598
19666
|
var import_node_child_process20 = require("child_process");
|
|
19599
19667
|
var fs39 = __toESM(require("fs"));
|
|
19600
|
-
var
|
|
19668
|
+
var os35 = __toESM(require("os"));
|
|
19601
19669
|
var path43 = __toESM(require("path"));
|
|
19602
19670
|
function codeamBinDir() {
|
|
19603
|
-
return process.env.CODEAM_BIN_DIR ?? path43.join(
|
|
19671
|
+
return process.env.CODEAM_BIN_DIR ?? path43.join(os35.homedir(), ".codeam", "bin");
|
|
19604
19672
|
}
|
|
19605
19673
|
var FALLBACK_GH_VERSION = "2.62.0";
|
|
19606
19674
|
var RELEASE_API = "https://api.github.com/repos/cli/cli/releases/latest";
|
|
@@ -19655,7 +19723,7 @@ async function ensureGhCli(runner, token, deps = {}) {
|
|
|
19655
19723
|
const version3 = await resolveVersionFn(token);
|
|
19656
19724
|
const asset = `gh_${version3}_${osToken}_${arch2}`;
|
|
19657
19725
|
const url2 = `https://github.com/cli/cli/releases/download/v${version3}/${asset}.${ext}`;
|
|
19658
|
-
const tmpRoot = fs39.mkdtempSync(path43.join(
|
|
19726
|
+
const tmpRoot = fs39.mkdtempSync(path43.join(os35.tmpdir(), "codeam-gh-"));
|
|
19659
19727
|
const archive = path43.join(tmpRoot, `${asset}.${ext}`);
|
|
19660
19728
|
if (!await downloadFn(url2, archive)) {
|
|
19661
19729
|
log.warn("host-agent", "gh download failed \u2014 skipping (git pull/push still work via the credential helper)");
|
|
@@ -19735,7 +19803,7 @@ async function ensureGlabCli(runner, deps = {}) {
|
|
|
19735
19803
|
const version3 = await resolveLatestGlabVersion();
|
|
19736
19804
|
const asset = `glab_${version3}_${osToken}_${arch2}`;
|
|
19737
19805
|
const url2 = `https://gitlab.com/gitlab-org/cli/-/releases/v${version3}/downloads/${asset}.${ext}`;
|
|
19738
|
-
const tmpRoot = fs39.mkdtempSync(path43.join(
|
|
19806
|
+
const tmpRoot = fs39.mkdtempSync(path43.join(os35.tmpdir(), "codeam-glab-"));
|
|
19739
19807
|
const archive = path43.join(tmpRoot, `${asset}.${ext}`);
|
|
19740
19808
|
if (!await downloadFn(url2, archive)) {
|
|
19741
19809
|
log.warn("host-agent", "glab download failed \u2014 skipping (git push/pull still work)");
|
|
@@ -19862,10 +19930,10 @@ var ZERO = {
|
|
|
19862
19930
|
compressionPct: 0
|
|
19863
19931
|
};
|
|
19864
19932
|
function read(stats, inputPricePerMillion) {
|
|
19865
|
-
const
|
|
19933
|
+
const totals2 = stats.agent_usage?.totals;
|
|
19866
19934
|
const compression = stats.summary?.compression;
|
|
19867
|
-
const rawTokensEst =
|
|
19868
|
-
const sentTokensEst =
|
|
19935
|
+
const rawTokensEst = totals2?.before_tokens ?? compression?.total_tokens_before_with_cli_filtering ?? 0;
|
|
19936
|
+
const sentTokensEst = totals2?.after_tokens ?? rawTokensEst - (compression?.total_tokens_removed ?? 0);
|
|
19869
19937
|
const compressionTokens = compression?.total_tokens_saved_with_cli_filtering ?? compression?.total_tokens_removed ?? Math.max(0, rawTokensEst - sentTokensEst);
|
|
19870
19938
|
const compressionSavingsUsd = stats.summary?.cost?.breakdown?.compression_savings_usd ?? Math.max(0, compressionTokens) / 1e6 * inputPricePerMillion;
|
|
19871
19939
|
return {
|
|
@@ -20250,14 +20318,14 @@ async function ensureModernPython(runner) {
|
|
|
20250
20318
|
// src/commands/host/headroom-bootstrap.ts
|
|
20251
20319
|
var fs41 = __toESM(require("fs"));
|
|
20252
20320
|
var path45 = __toESM(require("path"));
|
|
20253
|
-
var
|
|
20321
|
+
var os37 = __toESM(require("os"));
|
|
20254
20322
|
|
|
20255
20323
|
// src/commands/host/headroom-config.ts
|
|
20256
20324
|
var fs40 = __toESM(require("fs"));
|
|
20257
|
-
var
|
|
20325
|
+
var os36 = __toESM(require("os"));
|
|
20258
20326
|
var path44 = __toESM(require("path"));
|
|
20259
20327
|
function headroomConfigPath() {
|
|
20260
|
-
return path44.join(
|
|
20328
|
+
return path44.join(os36.homedir(), ".codeam", "headroom-config.json");
|
|
20261
20329
|
}
|
|
20262
20330
|
function persistHeadroomConfig(config) {
|
|
20263
20331
|
try {
|
|
@@ -20275,7 +20343,7 @@ function persistHeadroomConfig(config) {
|
|
|
20275
20343
|
}
|
|
20276
20344
|
}
|
|
20277
20345
|
function agentSettingsPath(kind) {
|
|
20278
|
-
const home =
|
|
20346
|
+
const home = os36.homedir();
|
|
20279
20347
|
if (kind === "claude") return path44.join(home, ".claude", "settings.json");
|
|
20280
20348
|
if (kind === "codex") return path44.join(home, ".codex", "auth.json");
|
|
20281
20349
|
if (kind === "copilot") return path44.join(home, ".config", "github-copilot", "hosts.json");
|
|
@@ -20286,7 +20354,7 @@ function backupAgentHeadroomConfig(kind) {
|
|
|
20286
20354
|
if (!src) return;
|
|
20287
20355
|
try {
|
|
20288
20356
|
if (!fs40.existsSync(src)) return;
|
|
20289
|
-
const dest = path44.join(
|
|
20357
|
+
const dest = path44.join(os36.homedir(), ".codeam", `headroom-backup-${kind}.json`);
|
|
20290
20358
|
fs40.mkdirSync(path44.dirname(dest), { recursive: true, mode: 448 });
|
|
20291
20359
|
fs40.copyFileSync(src, dest);
|
|
20292
20360
|
fs40.chmodSync(dest, 384);
|
|
@@ -20301,7 +20369,7 @@ function backupAgentHeadroomConfig(kind) {
|
|
|
20301
20369
|
function restoreAgentHeadroomConfig(kind) {
|
|
20302
20370
|
const dest = agentSettingsPath(kind);
|
|
20303
20371
|
if (!dest) return false;
|
|
20304
|
-
const src = path44.join(
|
|
20372
|
+
const src = path44.join(os36.homedir(), ".codeam", `headroom-backup-${kind}.json`);
|
|
20305
20373
|
if (!fs40.existsSync(src)) return false;
|
|
20306
20374
|
try {
|
|
20307
20375
|
fs40.mkdirSync(path44.dirname(dest), { recursive: true, mode: 448 });
|
|
@@ -20393,7 +20461,7 @@ async function getFreeDiskBytes(dir) {
|
|
|
20393
20461
|
}
|
|
20394
20462
|
function headroomModelsCached() {
|
|
20395
20463
|
const hubDir = process.env.HUGGINGFACE_HUB_CACHE || path45.join(
|
|
20396
|
-
process.env.HF_HOME || path45.join(
|
|
20464
|
+
process.env.HF_HOME || path45.join(os37.homedir(), ".cache", "huggingface"),
|
|
20397
20465
|
"hub"
|
|
20398
20466
|
);
|
|
20399
20467
|
return HEADROOM_MODELS.every(
|
|
@@ -20504,10 +20572,10 @@ async function setupHeadroomForSelfHosted(agent, runner = defaultHeadroomRunner,
|
|
|
20504
20572
|
|
|
20505
20573
|
// src/commands/host/house-proxy-config.ts
|
|
20506
20574
|
var fs42 = __toESM(require("fs"));
|
|
20507
|
-
var
|
|
20575
|
+
var os38 = __toESM(require("os"));
|
|
20508
20576
|
var path46 = __toESM(require("path"));
|
|
20509
20577
|
function houseProxyConfigPath() {
|
|
20510
|
-
return path46.join(
|
|
20578
|
+
return path46.join(os38.homedir(), ".codeam", "house-proxy.json");
|
|
20511
20579
|
}
|
|
20512
20580
|
function persistHouseProxyConfig(config) {
|
|
20513
20581
|
try {
|
|
@@ -20566,7 +20634,7 @@ var import_node_child_process23 = require("child_process");
|
|
|
20566
20634
|
|
|
20567
20635
|
// src/lib/updateNotifier.ts
|
|
20568
20636
|
var fs43 = __toESM(require("fs"));
|
|
20569
|
-
var
|
|
20637
|
+
var os39 = __toESM(require("os"));
|
|
20570
20638
|
var path47 = __toESM(require("path"));
|
|
20571
20639
|
var https6 = __toESM(require("https"));
|
|
20572
20640
|
var import_node_child_process22 = require("child_process");
|
|
@@ -20576,7 +20644,7 @@ var REGISTRY_URL = `https://registry.npmjs.org/${PKG_NAME}/latest`;
|
|
|
20576
20644
|
var TTL_MS = 24 * 60 * 60 * 1e3;
|
|
20577
20645
|
var REQUEST_TIMEOUT_MS = 1500;
|
|
20578
20646
|
function cachePath() {
|
|
20579
|
-
const dir = path47.join(
|
|
20647
|
+
const dir = path47.join(os39.homedir(), ".codeam");
|
|
20580
20648
|
return path47.join(dir, "update-check.json");
|
|
20581
20649
|
}
|
|
20582
20650
|
function readCache() {
|
|
@@ -20722,7 +20790,7 @@ async function autoUpgradeBeforeCriticalCommand() {
|
|
|
20722
20790
|
if (process.env.NODE_ENV === "test") return;
|
|
20723
20791
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
20724
20792
|
if (process.env.CI) return;
|
|
20725
|
-
const current2 = true ? "2.
|
|
20793
|
+
const current2 = true ? "2.62.0" : null;
|
|
20726
20794
|
if (!current2) return;
|
|
20727
20795
|
const cache = readCache();
|
|
20728
20796
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
|
@@ -20739,7 +20807,7 @@ function checkForUpdates() {
|
|
|
20739
20807
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
20740
20808
|
if (process.env.CI) return;
|
|
20741
20809
|
if (!process.stdout.isTTY) return;
|
|
20742
|
-
const current2 = true ? "2.
|
|
20810
|
+
const current2 = true ? "2.62.0" : null;
|
|
20743
20811
|
if (!current2) return;
|
|
20744
20812
|
const cache = readCache();
|
|
20745
20813
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
|
@@ -20759,7 +20827,7 @@ var SELF_UPDATE_INTERVAL_MS = 60 * 60 * 1e3;
|
|
|
20759
20827
|
var SELF_UPDATE_VIEW_TIMEOUT_MS = 3e4;
|
|
20760
20828
|
var SELF_UPDATE_INSTALL_TIMEOUT_MS = 18e4;
|
|
20761
20829
|
function currentCliVersion() {
|
|
20762
|
-
return true ? "2.
|
|
20830
|
+
return true ? "2.62.0" : null;
|
|
20763
20831
|
}
|
|
20764
20832
|
function runCmd(cmd, args2, timeoutMs) {
|
|
20765
20833
|
return new Promise((resolve9) => {
|
|
@@ -21491,7 +21559,7 @@ var HostAgentSupervisor = class {
|
|
|
21491
21559
|
const relay = this.relay;
|
|
21492
21560
|
if (!relay) return;
|
|
21493
21561
|
const raw = cmd.payload?.path;
|
|
21494
|
-
const target = typeof raw === "string" && raw.trim() ? path48.resolve(raw.trim()) :
|
|
21562
|
+
const target = typeof raw === "string" && raw.trim() ? path48.resolve(raw.trim()) : os40.homedir();
|
|
21495
21563
|
try {
|
|
21496
21564
|
const dirents = await fs45.promises.readdir(target, { withFileTypes: true });
|
|
21497
21565
|
const entries = dirents.filter((d3) => !d3.name.startsWith(".")).map((d3) => ({ name: d3.name, isDir: d3.isDirectory() })).sort(
|
|
@@ -21731,7 +21799,7 @@ var HostAgentSupervisor = class {
|
|
|
21731
21799
|
CODEAM_AUTO_TOKEN: payload.autoPairToken
|
|
21732
21800
|
};
|
|
21733
21801
|
const houseConfigDir = path48.join(
|
|
21734
|
-
|
|
21802
|
+
os40.homedir(),
|
|
21735
21803
|
".codeam",
|
|
21736
21804
|
"house-claude",
|
|
21737
21805
|
payload.deployId
|
|
@@ -21763,7 +21831,7 @@ var HostAgentSupervisor = class {
|
|
|
21763
21831
|
report("installing", "installing agent CLI");
|
|
21764
21832
|
await this.runAgentInstall(payload.agentInstallScript);
|
|
21765
21833
|
}
|
|
21766
|
-
const home = process.env.HOME ||
|
|
21834
|
+
const home = process.env.HOME || os40.homedir();
|
|
21767
21835
|
childEnv.PATH = `${home}/.local/bin:${process.env.PATH ?? ""}`;
|
|
21768
21836
|
if (payload.cloneToken) {
|
|
21769
21837
|
try {
|
|
@@ -21797,7 +21865,7 @@ var HostAgentSupervisor = class {
|
|
|
21797
21865
|
}
|
|
21798
21866
|
if (payload.headroomEnabled && payload.headroomAgent && payload.headroomSavingsIngestUrl && isHeadroomSupportedAgent(payload.headroomAgent)) {
|
|
21799
21867
|
report("headroom", "setting up Headroom proxy");
|
|
21800
|
-
const freeBytes = await this.getFreeDisk(
|
|
21868
|
+
const freeBytes = await this.getFreeDisk(os40.homedir());
|
|
21801
21869
|
const alreadyInstalled = this.isHeadroomInstalled();
|
|
21802
21870
|
if (!alreadyInstalled && freeBytes !== null && freeBytes < HEADROOM_MIN_FREE_DISK_BYTES) {
|
|
21803
21871
|
const freeGb = (freeBytes / 1e9).toFixed(1);
|
|
@@ -21856,7 +21924,7 @@ var HostAgentSupervisor = class {
|
|
|
21856
21924
|
);
|
|
21857
21925
|
if (!payload.suppressOnboardingWelcome) {
|
|
21858
21926
|
try {
|
|
21859
|
-
const cfgDir = childEnv.CLAUDE_CONFIG_DIR || path48.join(
|
|
21927
|
+
const cfgDir = childEnv.CLAUDE_CONFIG_DIR || path48.join(os40.homedir(), ".claude");
|
|
21860
21928
|
const projectDir = path48.join(cfgDir, "projects", encodeCwd(cwd));
|
|
21861
21929
|
const hasPriorConversation = fs45.existsSync(projectDir) && fs45.readdirSync(projectDir).some((f) => f.endsWith(".jsonl"));
|
|
21862
21930
|
if (hasPriorConversation) {
|
|
@@ -22006,7 +22074,7 @@ var HostAgentSupervisor = class {
|
|
|
22006
22074
|
*/
|
|
22007
22075
|
runAgentInstall(script) {
|
|
22008
22076
|
return new Promise((resolve9) => {
|
|
22009
|
-
const home = process.env.HOME ||
|
|
22077
|
+
const home = process.env.HOME || os40.homedir();
|
|
22010
22078
|
const child = (0, import_node_child_process25.spawn)("sh", ["-c", script], {
|
|
22011
22079
|
env: { ...process.env, HOME: home },
|
|
22012
22080
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -22095,7 +22163,7 @@ var HostAgentSupervisor = class {
|
|
|
22095
22163
|
}
|
|
22096
22164
|
const dirs = [
|
|
22097
22165
|
path48.join(selfHostedWorkspaceRoot(), deployId),
|
|
22098
|
-
path48.join(
|
|
22166
|
+
path48.join(os40.homedir(), ".codeam", "house-claude", deployId)
|
|
22099
22167
|
];
|
|
22100
22168
|
for (const dir of dirs) {
|
|
22101
22169
|
try {
|
|
@@ -22237,7 +22305,7 @@ async function configureHeadroom(action, ctx, deps) {
|
|
|
22237
22305
|
|
|
22238
22306
|
// src/services/headroom/budget-relaunch.ts
|
|
22239
22307
|
var fs46 = __toESM(require("fs"));
|
|
22240
|
-
var
|
|
22308
|
+
var os41 = __toESM(require("os"));
|
|
22241
22309
|
var path49 = __toESM(require("path"));
|
|
22242
22310
|
var import_child_process13 = require("child_process");
|
|
22243
22311
|
function amendDeploymentManifestBudget(manifest, budget) {
|
|
@@ -22349,7 +22417,7 @@ function spawnProxyReal2(_budget) {
|
|
|
22349
22417
|
);
|
|
22350
22418
|
}
|
|
22351
22419
|
function makeRealApplyBudgetDeps() {
|
|
22352
|
-
const homeDir2 =
|
|
22420
|
+
const homeDir2 = os41.homedir();
|
|
22353
22421
|
return {
|
|
22354
22422
|
findDeployments: () => findHeadroomDeployments(homeDir2, {
|
|
22355
22423
|
readDir: (dir) => fs46.readdirSync(dir),
|
|
@@ -22362,15 +22430,138 @@ function makeRealApplyBudgetDeps() {
|
|
|
22362
22430
|
};
|
|
22363
22431
|
}
|
|
22364
22432
|
|
|
22433
|
+
// src/services/headroom/usage-report.ts
|
|
22434
|
+
var HOURLY_CAP = 48;
|
|
22435
|
+
var SERIES_CAP = {
|
|
22436
|
+
hourly: HOURLY_CAP,
|
|
22437
|
+
daily: 90,
|
|
22438
|
+
weekly: 52,
|
|
22439
|
+
monthly: 24
|
|
22440
|
+
};
|
|
22441
|
+
var REQUEST_TIMEOUT_MS2 = 5e3;
|
|
22442
|
+
async function fetchWithTimeout2(url2) {
|
|
22443
|
+
const controller = new AbortController();
|
|
22444
|
+
const timer = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS2);
|
|
22445
|
+
try {
|
|
22446
|
+
return await fetch(url2, { signal: controller.signal });
|
|
22447
|
+
} finally {
|
|
22448
|
+
clearTimeout(timer);
|
|
22449
|
+
}
|
|
22450
|
+
}
|
|
22451
|
+
function num(v) {
|
|
22452
|
+
return typeof v === "number" && Number.isFinite(v) ? v : 0;
|
|
22453
|
+
}
|
|
22454
|
+
function totals(raw) {
|
|
22455
|
+
const o = raw ?? {};
|
|
22456
|
+
return {
|
|
22457
|
+
requests: num(o.requests),
|
|
22458
|
+
tokens_saved: num(o.tokens_saved),
|
|
22459
|
+
compression_savings_usd: num(o.compression_savings_usd),
|
|
22460
|
+
total_input_tokens: num(o.total_input_tokens),
|
|
22461
|
+
total_input_cost_usd: num(o.total_input_cost_usd)
|
|
22462
|
+
};
|
|
22463
|
+
}
|
|
22464
|
+
function slices(raw) {
|
|
22465
|
+
const out2 = {};
|
|
22466
|
+
if (typeof raw !== "object" || raw === null) return out2;
|
|
22467
|
+
for (const [key, value] of Object.entries(raw)) {
|
|
22468
|
+
const v = value ?? {};
|
|
22469
|
+
out2[key] = {
|
|
22470
|
+
tokens_saved: num(v.tokens_saved),
|
|
22471
|
+
compression_savings_usd_delta: num(v.compression_savings_usd_delta),
|
|
22472
|
+
total_input_tokens_delta: num(v.total_input_tokens_delta),
|
|
22473
|
+
total_input_cost_usd_delta: num(v.total_input_cost_usd_delta)
|
|
22474
|
+
};
|
|
22475
|
+
}
|
|
22476
|
+
return out2;
|
|
22477
|
+
}
|
|
22478
|
+
function bucket(raw) {
|
|
22479
|
+
if (typeof raw !== "object" || raw === null) return null;
|
|
22480
|
+
const o = raw;
|
|
22481
|
+
if (typeof o.timestamp !== "string") return null;
|
|
22482
|
+
return {
|
|
22483
|
+
timestamp: o.timestamp,
|
|
22484
|
+
tokens_saved: num(o.tokens_saved),
|
|
22485
|
+
compression_savings_usd_delta: num(o.compression_savings_usd_delta),
|
|
22486
|
+
total_tokens_saved: num(o.total_tokens_saved),
|
|
22487
|
+
compression_savings_usd: num(o.compression_savings_usd),
|
|
22488
|
+
total_input_tokens_delta: num(o.total_input_tokens_delta),
|
|
22489
|
+
total_input_tokens: num(o.total_input_tokens),
|
|
22490
|
+
total_input_cost_usd_delta: num(o.total_input_cost_usd_delta),
|
|
22491
|
+
total_input_cost_usd: num(o.total_input_cost_usd),
|
|
22492
|
+
by_provider: slices(o.by_provider),
|
|
22493
|
+
by_model: slices(o.by_model)
|
|
22494
|
+
};
|
|
22495
|
+
}
|
|
22496
|
+
function toUsageReport(raw, proxyVersion) {
|
|
22497
|
+
const root = raw ?? {};
|
|
22498
|
+
const rawSeries = root.series ?? {};
|
|
22499
|
+
const series = {};
|
|
22500
|
+
for (const key of Object.keys(SERIES_CAP)) {
|
|
22501
|
+
const arr = rawSeries[key];
|
|
22502
|
+
if (!Array.isArray(arr)) continue;
|
|
22503
|
+
const kept = arr.slice(-SERIES_CAP[key]).map(bucket).filter((b) => b !== null);
|
|
22504
|
+
if (kept.length > 0) series[key] = kept;
|
|
22505
|
+
}
|
|
22506
|
+
const displaySession = root.display_session ?? null;
|
|
22507
|
+
const retention = root.retention ?? null;
|
|
22508
|
+
const report = {
|
|
22509
|
+
schemaVersion: num(root.schema_version),
|
|
22510
|
+
generatedAt: typeof root.generated_at === "string" ? root.generated_at : (/* @__PURE__ */ new Date()).toISOString(),
|
|
22511
|
+
lifetime: totals(root.lifetime),
|
|
22512
|
+
series
|
|
22513
|
+
};
|
|
22514
|
+
if (proxyVersion) report.proxyVersion = proxyVersion;
|
|
22515
|
+
if (displaySession) {
|
|
22516
|
+
report.currentSession = {
|
|
22517
|
+
...totals(displaySession),
|
|
22518
|
+
savings_percent: num(displaySession.savings_percent),
|
|
22519
|
+
started_at: typeof displaySession.started_at === "string" ? displaySession.started_at : null,
|
|
22520
|
+
last_activity_at: typeof displaySession.last_activity_at === "string" ? displaySession.last_activity_at : null
|
|
22521
|
+
};
|
|
22522
|
+
}
|
|
22523
|
+
if (retention) {
|
|
22524
|
+
report.retention = {
|
|
22525
|
+
max_history_points: num(retention.max_history_points),
|
|
22526
|
+
max_history_age_days: num(retention.max_history_age_days)
|
|
22527
|
+
};
|
|
22528
|
+
}
|
|
22529
|
+
return report;
|
|
22530
|
+
}
|
|
22531
|
+
async function defaultFetchJson(url2) {
|
|
22532
|
+
const res = await fetchWithTimeout2(url2);
|
|
22533
|
+
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
22534
|
+
return await res.json();
|
|
22535
|
+
}
|
|
22536
|
+
async function readUsageReport(deps = {}) {
|
|
22537
|
+
const port = deps.port ?? HEADROOM_PROXY_PORT;
|
|
22538
|
+
const base = `http://127.0.0.1:${port}`;
|
|
22539
|
+
const get2 = deps.fetchJson ?? ((path89) => defaultFetchJson(`${base}${path89}`));
|
|
22540
|
+
let history;
|
|
22541
|
+
try {
|
|
22542
|
+
history = await get2("/stats-history");
|
|
22543
|
+
} catch (err) {
|
|
22544
|
+
log.info("headroomUsage", `stats-history unavailable: ${err.message}`);
|
|
22545
|
+
return null;
|
|
22546
|
+
}
|
|
22547
|
+
let proxyVersion;
|
|
22548
|
+
try {
|
|
22549
|
+
const health = await get2("/health");
|
|
22550
|
+
if (health && typeof health.version === "string") proxyVersion = health.version;
|
|
22551
|
+
} catch {
|
|
22552
|
+
}
|
|
22553
|
+
return toUsageReport(history, proxyVersion);
|
|
22554
|
+
}
|
|
22555
|
+
|
|
22365
22556
|
// src/agents/acp/guardrail-config.ts
|
|
22366
22557
|
var fs47 = __toESM(require("fs"));
|
|
22367
22558
|
var path50 = __toESM(require("path"));
|
|
22368
|
-
var
|
|
22559
|
+
var os42 = __toESM(require("os"));
|
|
22369
22560
|
var current = null;
|
|
22370
|
-
function guardrailConfigPath(homeDir2 =
|
|
22561
|
+
function guardrailConfigPath(homeDir2 = os42.homedir()) {
|
|
22371
22562
|
return path50.join(homeDir2, ".codeam", "guardrails.json");
|
|
22372
22563
|
}
|
|
22373
|
-
function loadGuardrailPolicy(homeDir2 =
|
|
22564
|
+
function loadGuardrailPolicy(homeDir2 = os42.homedir()) {
|
|
22374
22565
|
try {
|
|
22375
22566
|
current = normalizeGuardrailPolicy(JSON.parse(fs47.readFileSync(guardrailConfigPath(homeDir2), "utf8")));
|
|
22376
22567
|
} catch {
|
|
@@ -22378,10 +22569,10 @@ function loadGuardrailPolicy(homeDir2 = os41.homedir()) {
|
|
|
22378
22569
|
}
|
|
22379
22570
|
return current;
|
|
22380
22571
|
}
|
|
22381
|
-
function getGuardrailPolicy(homeDir2 =
|
|
22572
|
+
function getGuardrailPolicy(homeDir2 = os42.homedir()) {
|
|
22382
22573
|
return current ?? loadGuardrailPolicy(homeDir2);
|
|
22383
22574
|
}
|
|
22384
|
-
function setGuardrailPolicy(raw, homeDir2 =
|
|
22575
|
+
function setGuardrailPolicy(raw, homeDir2 = os42.homedir()) {
|
|
22385
22576
|
const next = normalizeGuardrailPolicy(raw);
|
|
22386
22577
|
current = next;
|
|
22387
22578
|
try {
|
|
@@ -22395,11 +22586,11 @@ function setGuardrailPolicy(raw, homeDir2 = os41.homedir()) {
|
|
|
22395
22586
|
|
|
22396
22587
|
// src/services/preview/port-registry.ts
|
|
22397
22588
|
var fs48 = __toESM(require("fs"));
|
|
22398
|
-
var
|
|
22589
|
+
var os43 = __toESM(require("os"));
|
|
22399
22590
|
var path51 = __toESM(require("path"));
|
|
22400
22591
|
var import_child_process14 = require("child_process");
|
|
22401
22592
|
function registryPath() {
|
|
22402
|
-
return path51.join(
|
|
22593
|
+
return path51.join(os43.homedir(), ".codeam", "preview-ports.json");
|
|
22403
22594
|
}
|
|
22404
22595
|
function readRegistry() {
|
|
22405
22596
|
try {
|
|
@@ -23943,7 +24134,7 @@ async function establishTunnel(ctx, dev) {
|
|
|
23943
24134
|
// src/beads/bd-adapter.ts
|
|
23944
24135
|
var import_child_process20 = require("child_process");
|
|
23945
24136
|
var fs57 = __toESM(require("fs"));
|
|
23946
|
-
var
|
|
24137
|
+
var os45 = __toESM(require("os"));
|
|
23947
24138
|
var path60 = __toESM(require("path"));
|
|
23948
24139
|
var BD_PACKAGE = "@beads/bd";
|
|
23949
24140
|
function resolveBundledBdBinary() {
|
|
@@ -24061,7 +24252,7 @@ var BdAdapter = class {
|
|
|
24061
24252
|
const env = { ...process.env };
|
|
24062
24253
|
if (!env.HOME) {
|
|
24063
24254
|
try {
|
|
24064
|
-
const home =
|
|
24255
|
+
const home = os45.homedir();
|
|
24065
24256
|
if (home) env.HOME = home;
|
|
24066
24257
|
} catch {
|
|
24067
24258
|
}
|
|
@@ -24154,7 +24345,7 @@ function coerceIssue(row, projectKey) {
|
|
|
24154
24345
|
// src/beads/provisioner.ts
|
|
24155
24346
|
var import_child_process23 = require("child_process");
|
|
24156
24347
|
var fs59 = __toESM(require("fs"));
|
|
24157
|
-
var
|
|
24348
|
+
var os47 = __toESM(require("os"));
|
|
24158
24349
|
var path62 = __toESM(require("path"));
|
|
24159
24350
|
|
|
24160
24351
|
// src/beads/install-bd.ts
|
|
@@ -24221,7 +24412,7 @@ async function installBd(platform3 = process.platform) {
|
|
|
24221
24412
|
// src/beads/install-dolt.ts
|
|
24222
24413
|
var import_child_process22 = require("child_process");
|
|
24223
24414
|
var fs58 = __toESM(require("fs"));
|
|
24224
|
-
var
|
|
24415
|
+
var os46 = __toESM(require("os"));
|
|
24225
24416
|
var path61 = __toESM(require("path"));
|
|
24226
24417
|
var DOLT_INSTALL_SH_URL = "https://github.com/dolthub/dolt/releases/latest/download/install.sh";
|
|
24227
24418
|
var DOLT_MSI_URL = "https://github.com/dolthub/dolt/releases/latest/download/dolt-windows-amd64.msi";
|
|
@@ -24262,11 +24453,11 @@ function resolveDoltInstallStrategy(platform3) {
|
|
|
24262
24453
|
}
|
|
24263
24454
|
var DOLT_RELEASE_BASE = "https://github.com/dolthub/dolt/releases/latest/download";
|
|
24264
24455
|
function doltPlatformTuple(platform3, arch2) {
|
|
24265
|
-
const
|
|
24456
|
+
const os64 = platform3 === "win32" ? "windows" : platform3 === "darwin" ? "darwin" : "linux";
|
|
24266
24457
|
const a = arch2 === "x64" ? "amd64" : arch2 === "arm64" ? "arm64" : null;
|
|
24267
24458
|
if (!a) return null;
|
|
24268
|
-
if (
|
|
24269
|
-
return `${
|
|
24459
|
+
if (os64 === "windows" && a !== "amd64") return null;
|
|
24460
|
+
return `${os64}-${a}`;
|
|
24270
24461
|
}
|
|
24271
24462
|
function resolveDoltTarballStrategy(targetDir, platform3, arch2) {
|
|
24272
24463
|
const tuple = doltPlatformTuple(platform3, arch2);
|
|
@@ -24311,7 +24502,7 @@ async function installDoltToDir(targetDir, platform3 = process.platform, arch2 =
|
|
|
24311
24502
|
return result;
|
|
24312
24503
|
}
|
|
24313
24504
|
var _doltPathSeam = {
|
|
24314
|
-
homedir: () =>
|
|
24505
|
+
homedir: () => os46.homedir(),
|
|
24315
24506
|
getPath: () => process.env.PATH ?? "",
|
|
24316
24507
|
setPath: (p2) => {
|
|
24317
24508
|
process.env.PATH = p2;
|
|
@@ -24522,7 +24713,7 @@ var _provisionSeam = {
|
|
|
24522
24713
|
};
|
|
24523
24714
|
var _linkSeam = {
|
|
24524
24715
|
platform: () => process.platform,
|
|
24525
|
-
homedir: () =>
|
|
24716
|
+
homedir: () => os47.homedir(),
|
|
24526
24717
|
isWritableDir: (dir) => {
|
|
24527
24718
|
try {
|
|
24528
24719
|
fs59.accessSync(dir, fs59.constants.W_OK);
|
|
@@ -25317,7 +25508,7 @@ function cleanupAttachmentTempFiles() {
|
|
|
25317
25508
|
function saveFilesTemp(files) {
|
|
25318
25509
|
return files.filter(({ base64 }) => base64 && base64.length > 0).map(({ filename, base64 }) => {
|
|
25319
25510
|
const safeName = filename.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 80);
|
|
25320
|
-
const tmpPath = path66.join(
|
|
25511
|
+
const tmpPath = path66.join(os51.tmpdir(), `codeam-${(0, import_crypto3.randomUUID)()}-${safeName}`);
|
|
25321
25512
|
fs62.writeFileSync(tmpPath, Buffer.from(base64, "base64"));
|
|
25322
25513
|
pendingAttachmentFiles.add(tmpPath);
|
|
25323
25514
|
return tmpPath;
|
|
@@ -25912,7 +26103,7 @@ var vcsAgentReviewH = async (ctx, cmd, parsed) => {
|
|
|
25912
26103
|
});
|
|
25913
26104
|
const token = ctx.pluginAuthToken;
|
|
25914
26105
|
void (async () => {
|
|
25915
|
-
const
|
|
26106
|
+
const os64 = createOsStrategy();
|
|
25916
26107
|
try {
|
|
25917
26108
|
const report = await reviewPullRequest(
|
|
25918
26109
|
{
|
|
@@ -25921,7 +26112,7 @@ var vcsAgentReviewH = async (ctx, cmd, parsed) => {
|
|
|
25921
26112
|
baseBranch: parsed.baseBranch
|
|
25922
26113
|
},
|
|
25923
26114
|
{
|
|
25924
|
-
runReview: (input) => new CoderabbitRuntimeStrategy(
|
|
26115
|
+
runReview: (input) => new CoderabbitRuntimeStrategy(os64).runOneShot(input),
|
|
25925
26116
|
runGh: (args2) => defaultRunGh(args2),
|
|
25926
26117
|
postReport: async (r) => {
|
|
25927
26118
|
if (!token) return;
|
|
@@ -25943,6 +26134,24 @@ var vcsAgentReviewH = async (ctx, cmd, parsed) => {
|
|
|
25943
26134
|
}
|
|
25944
26135
|
})();
|
|
25945
26136
|
};
|
|
26137
|
+
var headroomUsageH = async (ctx, cmd) => {
|
|
26138
|
+
try {
|
|
26139
|
+
const report = await readUsageReport();
|
|
26140
|
+
if (!report) {
|
|
26141
|
+
await ctx.relay.sendResult(cmd.id, "completed", {
|
|
26142
|
+
available: false,
|
|
26143
|
+
error: "Headroom is not running in this session."
|
|
26144
|
+
});
|
|
26145
|
+
return;
|
|
26146
|
+
}
|
|
26147
|
+
await ctx.relay.sendResult(cmd.id, "completed", { available: true, report });
|
|
26148
|
+
} catch (err) {
|
|
26149
|
+
await ctx.relay.sendResult(cmd.id, "completed", {
|
|
26150
|
+
available: false,
|
|
26151
|
+
error: err.message
|
|
26152
|
+
});
|
|
26153
|
+
}
|
|
26154
|
+
};
|
|
25946
26155
|
var headroomBudgetH = async (ctx, cmd) => {
|
|
25947
26156
|
const payload = cmd.payload;
|
|
25948
26157
|
let rawAgentId = ctx.agentId || (typeof payload.agentId === "string" ? payload.agentId : "");
|
|
@@ -26116,13 +26325,13 @@ function resolveGlobalNodeModulesDir(opts) {
|
|
|
26116
26325
|
var STALE_STAGING_AGE_MS = CLI_UPDATE_INSTALL_TIMEOUT_MS;
|
|
26117
26326
|
function sweepStaleCliStagingDirs(nodeModulesDir, now = Date.now(), deps) {
|
|
26118
26327
|
if (!nodeModulesDir) return 0;
|
|
26119
|
-
const
|
|
26328
|
+
const readdirSync15 = deps?.readdirSync ?? fs62.readdirSync;
|
|
26120
26329
|
const statSync17 = deps?.statSync ?? fs62.statSync;
|
|
26121
26330
|
const rmSync9 = deps?.rmSync ?? fs62.rmSync;
|
|
26122
26331
|
let removed = 0;
|
|
26123
26332
|
let entries;
|
|
26124
26333
|
try {
|
|
26125
|
-
entries =
|
|
26334
|
+
entries = readdirSync15(nodeModulesDir);
|
|
26126
26335
|
} catch {
|
|
26127
26336
|
return 0;
|
|
26128
26337
|
}
|
|
@@ -26731,6 +26940,7 @@ var handlers = {
|
|
|
26731
26940
|
take_control: takeControlH,
|
|
26732
26941
|
handback: handbackH,
|
|
26733
26942
|
headroom_configure: headroomConfigureH,
|
|
26943
|
+
headroom_usage: headroomUsageH,
|
|
26734
26944
|
coderabbit_configure: coderabbitConfigureH,
|
|
26735
26945
|
vcs_agent_review: vcsAgentReviewH,
|
|
26736
26946
|
headroom_budget: headroomBudgetH,
|
|
@@ -27038,7 +27248,7 @@ async function claimOnce(token, pluginId, pluginSecretHash) {
|
|
|
27038
27248
|
pluginId,
|
|
27039
27249
|
ideName: "codeam-cli (codespace)",
|
|
27040
27250
|
ideVersion: process.env.npm_package_version ?? "unknown",
|
|
27041
|
-
hostname:
|
|
27251
|
+
hostname: os52.hostname(),
|
|
27042
27252
|
codespaceName: process.env.CODESPACE_NAME ?? "",
|
|
27043
27253
|
// Current git branch of the codespace's working directory, so the
|
|
27044
27254
|
// backend can populate `PairedSession.branch` for the codespace pair.
|
|
@@ -27099,7 +27309,7 @@ async function claim(token, pluginId, pluginSecretHash) {
|
|
|
27099
27309
|
}
|
|
27100
27310
|
}
|
|
27101
27311
|
function pairAutoLockPath() {
|
|
27102
|
-
return path67.join(
|
|
27312
|
+
return path67.join(os52.homedir(), ".codeam", "pair-auto.lock");
|
|
27103
27313
|
}
|
|
27104
27314
|
function isLivePairAuto(pid) {
|
|
27105
27315
|
if (!Number.isInteger(pid) || pid <= 0 || pid === process.pid) return false;
|
|
@@ -27119,7 +27329,7 @@ function isLiveCodeam(pid) {
|
|
|
27119
27329
|
}
|
|
27120
27330
|
function daemonLockPath(sessionId) {
|
|
27121
27331
|
const safe = sessionId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
27122
|
-
return path67.join(
|
|
27332
|
+
return path67.join(os52.homedir(), ".codeam", `daemon-${safe}.lock`);
|
|
27123
27333
|
}
|
|
27124
27334
|
function acquireDaemonLock(sessionId) {
|
|
27125
27335
|
const lockPath = daemonLockPath(sessionId);
|
|
@@ -28070,7 +28280,7 @@ var import_node_crypto11 = require("crypto");
|
|
|
28070
28280
|
// src/services/history.service.ts
|
|
28071
28281
|
var fs65 = __toESM(require("fs"));
|
|
28072
28282
|
var path70 = __toESM(require("path"));
|
|
28073
|
-
var
|
|
28283
|
+
var os54 = __toESM(require("os"));
|
|
28074
28284
|
var https7 = __toESM(require("https"));
|
|
28075
28285
|
var http6 = __toESM(require("http"));
|
|
28076
28286
|
var import_zod2 = require("zod");
|
|
@@ -28238,7 +28448,7 @@ var HistoryService = class _HistoryService {
|
|
|
28238
28448
|
return this._quotaPercent === null || Date.now() - this._quotaFetchedAt > ttlMs;
|
|
28239
28449
|
}
|
|
28240
28450
|
get projectDir() {
|
|
28241
|
-
return this.runtime.resolveHistoryDir(this.cwd) ?? path70.join(
|
|
28451
|
+
return this.runtime.resolveHistoryDir(this.cwd) ?? path70.join(os54.homedir(), ".claude", "projects", encodeCwd(this.cwd));
|
|
28242
28452
|
}
|
|
28243
28453
|
/** Set the current Claude conversation ID (extracted from /cost command or session start) */
|
|
28244
28454
|
setCurrentConversationId(id) {
|
|
@@ -28666,7 +28876,7 @@ var HistoryService = class _HistoryService {
|
|
|
28666
28876
|
var import_node_child_process29 = require("child_process");
|
|
28667
28877
|
var fs66 = __toESM(require("fs/promises"));
|
|
28668
28878
|
var fsSync = __toESM(require("fs"));
|
|
28669
|
-
var
|
|
28879
|
+
var os56 = __toESM(require("os"));
|
|
28670
28880
|
var path72 = __toESM(require("path"));
|
|
28671
28881
|
var import_node_stream = require("stream");
|
|
28672
28882
|
|
|
@@ -32694,7 +32904,7 @@ function createIdleTimeout(idleMs, makeError, activeIdleMs = idleMs) {
|
|
|
32694
32904
|
|
|
32695
32905
|
// src/agents/acp/internal-paths.ts
|
|
32696
32906
|
var path71 = __toESM(require("path"));
|
|
32697
|
-
var
|
|
32907
|
+
var os55 = __toESM(require("os"));
|
|
32698
32908
|
var INTERNAL_TOKENS = [".codeam", "house-claude"];
|
|
32699
32909
|
var SELF_HOSTED_WORKSPACE_RE = /\.codeam[/\\]self-hosted/gi;
|
|
32700
32910
|
function textReferencesInternal(text) {
|
|
@@ -32702,7 +32912,7 @@ function textReferencesInternal(text) {
|
|
|
32702
32912
|
const scrubbed = text.replace(SELF_HOSTED_WORKSPACE_RE, " ");
|
|
32703
32913
|
return INTERNAL_TOKENS.some((t2) => scrubbed.includes(t2));
|
|
32704
32914
|
}
|
|
32705
|
-
function pathIsInternal(p2, homeDir2 =
|
|
32915
|
+
function pathIsInternal(p2, homeDir2 = os55.homedir()) {
|
|
32706
32916
|
if (!p2) return false;
|
|
32707
32917
|
const abs = path71.resolve(p2);
|
|
32708
32918
|
const home = path71.resolve(homeDir2);
|
|
@@ -33750,7 +33960,7 @@ function applyLineRange(content, line, limit) {
|
|
|
33750
33960
|
return { content: lines.slice(start2, end).join("\n") };
|
|
33751
33961
|
}
|
|
33752
33962
|
function knownAgentBinaryDirs() {
|
|
33753
|
-
const home =
|
|
33963
|
+
const home = os56.homedir();
|
|
33754
33964
|
const out2 = [];
|
|
33755
33965
|
out2.push("/tmp/codeam-node20/bin");
|
|
33756
33966
|
for (const root of [
|
|
@@ -34277,10 +34487,10 @@ function commonPrefixLength(a, b) {
|
|
|
34277
34487
|
// src/agents/acp/onboarding.ts
|
|
34278
34488
|
var import_child_process27 = require("child_process");
|
|
34279
34489
|
var fs67 = __toESM(require("fs"));
|
|
34280
|
-
var
|
|
34490
|
+
var os57 = __toESM(require("os"));
|
|
34281
34491
|
var path73 = __toESM(require("path"));
|
|
34282
34492
|
var _onboardingSeam = {
|
|
34283
|
-
markerPath: (sessionId) => path73.join(
|
|
34493
|
+
markerPath: (sessionId) => path73.join(os57.homedir(), ".codeam", "welcomed", `${sessionId}.done`),
|
|
34284
34494
|
exists: (p2) => fs67.existsSync(p2),
|
|
34285
34495
|
write: (p2) => {
|
|
34286
34496
|
fs67.mkdirSync(path73.dirname(p2), { recursive: true });
|
|
@@ -36154,8 +36364,8 @@ function buildAcpPromptBlocks(payload) {
|
|
|
36154
36364
|
// src/agents/agent-standard.ts
|
|
36155
36365
|
var fs74 = __toESM(require("fs"));
|
|
36156
36366
|
var path80 = __toESM(require("path"));
|
|
36157
|
-
var
|
|
36158
|
-
function ensureAgentStandard(homeDir2 =
|
|
36367
|
+
var os58 = __toESM(require("os"));
|
|
36368
|
+
function ensureAgentStandard(homeDir2 = os58.homedir()) {
|
|
36159
36369
|
try {
|
|
36160
36370
|
const file = path80.join(homeDir2, ".claude", "CLAUDE.md");
|
|
36161
36371
|
let existing = "";
|
|
@@ -36176,7 +36386,7 @@ ${AGENT_STANDARD_BLOCK}
|
|
|
36176
36386
|
}
|
|
36177
36387
|
var _agentStandardSeam = {
|
|
36178
36388
|
isLocalSession: () => isLocalSession(),
|
|
36179
|
-
markerPath: (sessionId) => path80.join(
|
|
36389
|
+
markerPath: (sessionId) => path80.join(os58.homedir(), ".codeam", "agent-standard", `${sessionId}.done`),
|
|
36180
36390
|
exists: (p2) => fs74.existsSync(p2),
|
|
36181
36391
|
write: (p2) => {
|
|
36182
36392
|
fs74.mkdirSync(path80.dirname(p2), { recursive: true });
|
|
@@ -38851,7 +39061,7 @@ function startClaudeCredentialSync(opts) {
|
|
|
38851
39061
|
// src/beads/workflow-hint.ts
|
|
38852
39062
|
var fs75 = __toESM(require("fs"));
|
|
38853
39063
|
var path81 = __toESM(require("path"));
|
|
38854
|
-
var
|
|
39064
|
+
var os59 = __toESM(require("os"));
|
|
38855
39065
|
var BEADS_HINT_MARKER = "<!-- codeam:beads-workflow -->";
|
|
38856
39066
|
var BEADS_HINT = `${BEADS_HINT_MARKER}
|
|
38857
39067
|
# Beads (bd) \u2014 task tracking + persistent memory (ALWAYS use it)
|
|
@@ -38865,7 +39075,7 @@ This environment uses **bd (beads)** for issue/task tracking and persistent memo
|
|
|
38865
39075
|
- \`bd ready\` (available work) \xB7 \`bd show <id>\` \xB7 \`bd update <id> --claim\` \xB7 \`bd close <id>\`.
|
|
38866
39076
|
- Use \`bd remember "..."\` for persistent knowledge \u2014 do NOT use MEMORY.md files.
|
|
38867
39077
|
${BEADS_HINT_MARKER}`;
|
|
38868
|
-
function ensureBeadsWorkflowHint(homeDir2 =
|
|
39078
|
+
function ensureBeadsWorkflowHint(homeDir2 = os59.homedir()) {
|
|
38869
39079
|
try {
|
|
38870
39080
|
const file = path81.join(homeDir2, ".claude", "CLAUDE.md");
|
|
38871
39081
|
let existing = "";
|
|
@@ -39618,12 +39828,12 @@ function keepDeviceAwake(deps = {}) {
|
|
|
39618
39828
|
|
|
39619
39829
|
// src/agents/claude/onboarding.ts
|
|
39620
39830
|
var fs77 = __toESM(require("fs"));
|
|
39621
|
-
var
|
|
39831
|
+
var os61 = __toESM(require("os"));
|
|
39622
39832
|
var path82 = __toESM(require("path"));
|
|
39623
39833
|
var ONBOARDING_VERSION_SENTINEL = "9999.0.0";
|
|
39624
39834
|
function ensureClaudeOnboarded(cwd) {
|
|
39625
39835
|
try {
|
|
39626
|
-
const file = path82.join(
|
|
39836
|
+
const file = path82.join(os61.homedir(), ".claude.json");
|
|
39627
39837
|
let config = {};
|
|
39628
39838
|
try {
|
|
39629
39839
|
config = JSON.parse(fs77.readFileSync(file, "utf8"));
|
|
@@ -42532,9 +42742,9 @@ function checkSessions() {
|
|
|
42532
42742
|
}
|
|
42533
42743
|
}
|
|
42534
42744
|
function checkAgentBinaries() {
|
|
42535
|
-
const
|
|
42745
|
+
const os64 = createOsStrategy();
|
|
42536
42746
|
return getEnabledAgents().map((meta) => {
|
|
42537
|
-
const found =
|
|
42747
|
+
const found = os64.findInPath(meta.binaryName);
|
|
42538
42748
|
return {
|
|
42539
42749
|
id: `agent-${meta.id}`,
|
|
42540
42750
|
label: `Agent binary: ${meta.displayName} (${meta.binaryName})`,
|
|
@@ -42598,7 +42808,7 @@ function checkChokidar() {
|
|
|
42598
42808
|
}
|
|
42599
42809
|
async function doctor(args2 = []) {
|
|
42600
42810
|
const json = args2.includes("--json");
|
|
42601
|
-
const cliVersion = true ? "2.
|
|
42811
|
+
const cliVersion = true ? "2.62.0" : "0.0.0-dev";
|
|
42602
42812
|
const apiBase2 = resolveApiBaseUrl();
|
|
42603
42813
|
const diagnosticId = (0, import_node_crypto13.randomUUID)();
|
|
42604
42814
|
log.info("doctor", `run id=${diagnosticId} cli=${cliVersion}`);
|
|
@@ -42989,7 +43199,7 @@ async function mcpRun(args2) {
|
|
|
42989
43199
|
// src/commands/version.ts
|
|
42990
43200
|
var import_picocolors15 = __toESM(require("picocolors"));
|
|
42991
43201
|
function version2() {
|
|
42992
|
-
const v = true ? "2.
|
|
43202
|
+
const v = true ? "2.62.0" : "unknown";
|
|
42993
43203
|
console.log(`${import_picocolors15.default.bold("codeam-cli")} ${import_picocolors15.default.cyan(v)}`);
|
|
42994
43204
|
}
|
|
42995
43205
|
|
|
@@ -43138,10 +43348,10 @@ var EXIT_CODE_NAMES = {
|
|
|
43138
43348
|
};
|
|
43139
43349
|
|
|
43140
43350
|
// src/index.ts
|
|
43141
|
-
var
|
|
43351
|
+
var os63 = __toESM(require("os"));
|
|
43142
43352
|
if (!process.env.HOME) {
|
|
43143
43353
|
try {
|
|
43144
|
-
const home =
|
|
43354
|
+
const home = os63.homedir();
|
|
43145
43355
|
if (home) process.env.HOME = home;
|
|
43146
43356
|
} catch {
|
|
43147
43357
|
}
|