codeam-cli 2.61.99 → 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 +10 -0
- package/dist/index.js +277 -210
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3271,7 +3271,7 @@ var { getConfig, ensurePluginId, addSession, removeSession, setActiveSession, ge
|
|
|
3271
3271
|
|
|
3272
3272
|
// src/commands/pair-auto.ts
|
|
3273
3273
|
var fs63 = __toESM(require("fs"));
|
|
3274
|
-
var
|
|
3274
|
+
var os52 = __toESM(require("os"));
|
|
3275
3275
|
var path67 = __toESM(require("path"));
|
|
3276
3276
|
var import_crypto4 = require("crypto");
|
|
3277
3277
|
|
|
@@ -8022,7 +8022,7 @@ function readAnonId() {
|
|
|
8022
8022
|
}
|
|
8023
8023
|
function superProperties() {
|
|
8024
8024
|
return {
|
|
8025
|
-
cliVersion: true ? "2.
|
|
8025
|
+
cliVersion: true ? "2.62.0" : "0.0.0-dev",
|
|
8026
8026
|
nodeVersion: process.version,
|
|
8027
8027
|
platform: process.platform,
|
|
8028
8028
|
arch: process.arch,
|
|
@@ -8203,7 +8203,7 @@ var os4 = __toESM(require("os"));
|
|
|
8203
8203
|
// package.json
|
|
8204
8204
|
var package_default = {
|
|
8205
8205
|
name: "codeam-cli",
|
|
8206
|
-
version: "2.
|
|
8206
|
+
version: "2.62.0",
|
|
8207
8207
|
description: "Workflow-continuity bridge for AI coding agents. Wrap Claude Code or Codex in a PTY and supervise, approve, and redirect the session from any device \u2014 async. The terminal companion for CodeAgent Mobile.",
|
|
8208
8208
|
type: "commonjs",
|
|
8209
8209
|
main: "dist/index.js",
|
|
@@ -8861,12 +8861,13 @@ function computePollDelay({ baseMs, failures }) {
|
|
|
8861
8861
|
|
|
8862
8862
|
// src/services/headroom/proxy-supervisor.ts
|
|
8863
8863
|
var fs7 = __toESM(require("fs"));
|
|
8864
|
-
var
|
|
8864
|
+
var os7 = __toESM(require("os"));
|
|
8865
8865
|
var path6 = __toESM(require("path"));
|
|
8866
8866
|
|
|
8867
8867
|
// src/services/headroom/proxy-process.ts
|
|
8868
8868
|
var import_child_process2 = require("child_process");
|
|
8869
8869
|
var fs6 = __toESM(require("fs"));
|
|
8870
|
+
var os6 = __toESM(require("os"));
|
|
8870
8871
|
var path5 = __toESM(require("path"));
|
|
8871
8872
|
|
|
8872
8873
|
// src/services/headroom/budget-args.ts
|
|
@@ -8947,6 +8948,27 @@ function pkillFallback() {
|
|
|
8947
8948
|
} catch {
|
|
8948
8949
|
}
|
|
8949
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
|
+
}
|
|
8950
8972
|
function killHeadroomProxy() {
|
|
8951
8973
|
const pid = readHeadroomProxyPidfile();
|
|
8952
8974
|
if (pid !== null && isPidAlive(pid)) {
|
|
@@ -8966,6 +8988,14 @@ function killHeadroomProxy() {
|
|
|
8966
8988
|
} catch {
|
|
8967
8989
|
}
|
|
8968
8990
|
}
|
|
8991
|
+
const found = findRunningProxyPid();
|
|
8992
|
+
if (found !== null) {
|
|
8993
|
+
try {
|
|
8994
|
+
process.kill(found, "SIGTERM");
|
|
8995
|
+
return;
|
|
8996
|
+
} catch {
|
|
8997
|
+
}
|
|
8998
|
+
}
|
|
8969
8999
|
pkillFallback();
|
|
8970
9000
|
}
|
|
8971
9001
|
|
|
@@ -9000,6 +9030,23 @@ function refreshSpawnLock() {
|
|
|
9000
9030
|
} catch {
|
|
9001
9031
|
}
|
|
9002
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
|
+
}
|
|
9003
9050
|
function spawnHeadroomProxy(logging, opts = {}) {
|
|
9004
9051
|
try {
|
|
9005
9052
|
const nowMs = Date.now();
|
|
@@ -9013,15 +9060,22 @@ function spawnHeadroomProxy(logging, opts = {}) {
|
|
|
9013
9060
|
...process.env,
|
|
9014
9061
|
HEADROOM_KOMPRESS_BACKEND: "onnx_cpu"
|
|
9015
9062
|
};
|
|
9063
|
+
const logFd = openProxyLogFd();
|
|
9016
9064
|
const proxy = (0, import_child_process2.spawn)(
|
|
9017
9065
|
"headroom",
|
|
9018
9066
|
["proxy", "--port", "8787", ...buildBudgetProxyArgs(proxyEnv)],
|
|
9019
9067
|
{
|
|
9020
|
-
stdio: "ignore",
|
|
9068
|
+
stdio: logFd === null ? "ignore" : ["ignore", logFd, logFd],
|
|
9021
9069
|
detached: true,
|
|
9022
9070
|
env: proxyEnv
|
|
9023
9071
|
}
|
|
9024
9072
|
);
|
|
9073
|
+
if (logFd !== null) {
|
|
9074
|
+
try {
|
|
9075
|
+
fs6.closeSync(logFd);
|
|
9076
|
+
} catch {
|
|
9077
|
+
}
|
|
9078
|
+
}
|
|
9025
9079
|
proxy.once("error", (e) => {
|
|
9026
9080
|
log.warn(logging.tag, logging.spawnErrorMsg(e.message));
|
|
9027
9081
|
});
|
|
@@ -9046,6 +9100,11 @@ async function ensureHeadroomProxy(deps) {
|
|
|
9046
9100
|
if (deps.proxyProcessAlive()) return "starting";
|
|
9047
9101
|
const ageMs = deps.proxyStartupAgeMs();
|
|
9048
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
|
+
}
|
|
9049
9108
|
log.warn("headroom-supervisor", "proxy :8787 is confirmed down \u2014 respawning");
|
|
9050
9109
|
(deps.spawnProxyForce ?? deps.spawnProxy)();
|
|
9051
9110
|
return "respawned";
|
|
@@ -9071,7 +9130,13 @@ async function ensureHeadroomProxyReady(deps, opts = {}) {
|
|
|
9071
9130
|
log.warn("headroom-supervisor", "proxy :8787 still not ready after respawn wait \u2014 proceeding anyway");
|
|
9072
9131
|
return false;
|
|
9073
9132
|
}
|
|
9074
|
-
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
|
+
}
|
|
9075
9140
|
if (process.env.HEADROOM_ENABLED === "1") return true;
|
|
9076
9141
|
const csEnv = path6.join(homeDir2, ".codeam", "codespace-env.json");
|
|
9077
9142
|
try {
|
|
@@ -9081,7 +9146,8 @@ function isHeadroomConfiguredReal(homeDir2 = os6.homedir()) {
|
|
|
9081
9146
|
}
|
|
9082
9147
|
const settings = path6.join(homeDir2, ".claude", "settings.json");
|
|
9083
9148
|
try {
|
|
9084
|
-
|
|
9149
|
+
const raw = fs7.readFileSync(settings, "utf8");
|
|
9150
|
+
if (raw.includes("127.0.0.1:8787") || raw.includes("headroom init hook")) return true;
|
|
9085
9151
|
} catch {
|
|
9086
9152
|
}
|
|
9087
9153
|
return false;
|
|
@@ -9113,6 +9179,7 @@ function makeRealProxySupervisorDeps() {
|
|
|
9113
9179
|
probeAlive: probeProxyAliveReal,
|
|
9114
9180
|
proxyProcessAlive: () => isHeadroomProxyProcessAlive(),
|
|
9115
9181
|
proxyStartupAgeMs: () => headroomProxyPidfileAgeMs(Date.now()),
|
|
9182
|
+
adoptRunningProxy: () => adoptRunningProxy(),
|
|
9116
9183
|
spawnProxy: spawnProxyReal,
|
|
9117
9184
|
spawnProxyForce: () => {
|
|
9118
9185
|
killHeadroomProxy();
|
|
@@ -9520,7 +9587,7 @@ var CommandRelayService = class _CommandRelayService {
|
|
|
9520
9587
|
// fresh + clear the "CLI update available" banner after a self-update
|
|
9521
9588
|
// (a codespace that reinstalls @latest reconnects via heartbeat, not
|
|
9522
9589
|
// pair/reconnect). Older backends ignore the extra field.
|
|
9523
|
-
..."2.
|
|
9590
|
+
..."2.62.0" ? { ideVersion: "2.62.0" } : {}
|
|
9524
9591
|
}).then(() => log.trace("relay", `heartbeat ok online=${online}`)).catch((err) => log.trace("relay", `heartbeat failed online=${online}`, err));
|
|
9525
9592
|
}
|
|
9526
9593
|
/**
|
|
@@ -9587,7 +9654,7 @@ var CommandRelayService = class _CommandRelayService {
|
|
|
9587
9654
|
// src/services/file-watcher.service.ts
|
|
9588
9655
|
var import_child_process3 = require("child_process");
|
|
9589
9656
|
var fs8 = __toESM(require("fs"));
|
|
9590
|
-
var
|
|
9657
|
+
var os8 = __toESM(require("os"));
|
|
9591
9658
|
var path7 = __toESM(require("path"));
|
|
9592
9659
|
var import_ignore = __toESM(require("ignore"));
|
|
9593
9660
|
|
|
@@ -9747,10 +9814,10 @@ var WINDOWS_LEGACY_JUNCTIONS = [
|
|
|
9747
9814
|
/[\\/]Start Menu([\\/]|$)/i,
|
|
9748
9815
|
/[\\/]Templates([\\/]|$)/i
|
|
9749
9816
|
];
|
|
9750
|
-
function isUnsafeWindowsWatchRoot(dir,
|
|
9817
|
+
function isUnsafeWindowsWatchRoot(dir, homedir52) {
|
|
9751
9818
|
const norm = (p2) => p2.replace(/\//g, "\\").replace(/\\+$/, "").toLowerCase();
|
|
9752
9819
|
const cwd = norm(dir);
|
|
9753
|
-
const home = norm(
|
|
9820
|
+
const home = norm(homedir52);
|
|
9754
9821
|
if (cwd === home) return true;
|
|
9755
9822
|
if (/^[a-z]:$/.test(cwd)) return true;
|
|
9756
9823
|
const sysRoots = [
|
|
@@ -9849,7 +9916,7 @@ var FileWatcherService = class {
|
|
|
9849
9916
|
throw new Error("FileWatcherService has already been stopped \u2014 re-instantiate to restart.");
|
|
9850
9917
|
}
|
|
9851
9918
|
const isWin = process.platform === "win32";
|
|
9852
|
-
if (isWin && isUnsafeWindowsWatchRoot(this.opts.workingDir,
|
|
9919
|
+
if (isWin && isUnsafeWindowsWatchRoot(this.opts.workingDir, os8.homedir())) {
|
|
9853
9920
|
log.warn(
|
|
9854
9921
|
"fileWatcher",
|
|
9855
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.`
|
|
@@ -10895,7 +10962,7 @@ function closeAllTerminals() {
|
|
|
10895
10962
|
|
|
10896
10963
|
// src/commands/start/handlers.ts
|
|
10897
10964
|
var fs62 = __toESM(require("fs"));
|
|
10898
|
-
var
|
|
10965
|
+
var os51 = __toESM(require("os"));
|
|
10899
10966
|
var path66 = __toESM(require("path"));
|
|
10900
10967
|
var import_crypto3 = require("crypto");
|
|
10901
10968
|
var import_child_process24 = require("child_process");
|
|
@@ -13785,7 +13852,7 @@ function parseFrame(frame, dispatch) {
|
|
|
13785
13852
|
|
|
13786
13853
|
// src/os/posix.ts
|
|
13787
13854
|
var fs13 = __toESM(require("fs"));
|
|
13788
|
-
var
|
|
13855
|
+
var os10 = __toESM(require("os"));
|
|
13789
13856
|
var path14 = __toESM(require("path"));
|
|
13790
13857
|
var import_node_crypto2 = require("crypto");
|
|
13791
13858
|
|
|
@@ -13810,7 +13877,7 @@ function findInPathFor(name, opts) {
|
|
|
13810
13877
|
// src/services/pty/unix.strategy.ts
|
|
13811
13878
|
var import_child_process7 = require("child_process");
|
|
13812
13879
|
var fs12 = __toESM(require("fs"));
|
|
13813
|
-
var
|
|
13880
|
+
var os9 = __toESM(require("os"));
|
|
13814
13881
|
var path13 = __toESM(require("path"));
|
|
13815
13882
|
|
|
13816
13883
|
// src/services/pty/types.ts
|
|
@@ -13893,7 +13960,7 @@ var UnixPtyStrategy = class {
|
|
|
13893
13960
|
}
|
|
13894
13961
|
const cols = process.stdout.columns || 220;
|
|
13895
13962
|
const rows = process.stdout.rows || 50;
|
|
13896
|
-
this.helperPath = path13.join(
|
|
13963
|
+
this.helperPath = path13.join(os9.tmpdir(), "codeam-pty-helper.py");
|
|
13897
13964
|
fs12.writeFileSync(this.helperPath, PYTHON_PTY_HELPER, { mode: 420 });
|
|
13898
13965
|
this.proc = (0, import_child_process7.spawn)(python, [this.helperPath, cmd, ...args2], {
|
|
13899
13966
|
stdio: ["pipe", "pipe", "inherit"],
|
|
@@ -14031,11 +14098,11 @@ var UnixPtyStrategy = class {
|
|
|
14031
14098
|
// src/os/posix.ts
|
|
14032
14099
|
var PosixOsStrategy = class {
|
|
14033
14100
|
homeDir() {
|
|
14034
|
-
return
|
|
14101
|
+
return os10.homedir();
|
|
14035
14102
|
}
|
|
14036
14103
|
scratchPath(prefix) {
|
|
14037
14104
|
const tag = `${process.pid}-${(0, import_node_crypto2.randomBytes)(4).toString("hex")}`;
|
|
14038
|
-
return path14.join(
|
|
14105
|
+
return path14.join(os10.tmpdir(), `${prefix}-${tag}`);
|
|
14039
14106
|
}
|
|
14040
14107
|
devNull() {
|
|
14041
14108
|
return "/dev/null";
|
|
@@ -14090,7 +14157,7 @@ var LinuxOsStrategy = class extends PosixOsStrategy {
|
|
|
14090
14157
|
|
|
14091
14158
|
// src/os/win32.ts
|
|
14092
14159
|
var fs14 = __toESM(require("fs"));
|
|
14093
|
-
var
|
|
14160
|
+
var os11 = __toESM(require("os"));
|
|
14094
14161
|
var path16 = __toESM(require("path"));
|
|
14095
14162
|
var import_node_crypto3 = require("crypto");
|
|
14096
14163
|
|
|
@@ -14283,11 +14350,11 @@ var WINDOWS_EXEC_EXTS = [".exe", ".cmd", ".bat", ".ps1"];
|
|
|
14283
14350
|
var Win32OsStrategy = class {
|
|
14284
14351
|
id = "win32";
|
|
14285
14352
|
homeDir() {
|
|
14286
|
-
return
|
|
14353
|
+
return os11.homedir();
|
|
14287
14354
|
}
|
|
14288
14355
|
scratchPath(prefix) {
|
|
14289
14356
|
const tag = `${process.pid}-${(0, import_node_crypto3.randomBytes)(4).toString("hex")}`;
|
|
14290
|
-
return path16.join(
|
|
14357
|
+
return path16.join(os11.tmpdir(), `${prefix}-${tag}`);
|
|
14291
14358
|
}
|
|
14292
14359
|
devNull() {
|
|
14293
14360
|
return "NUL";
|
|
@@ -14406,18 +14473,18 @@ function buildForPlatform(platform3) {
|
|
|
14406
14473
|
var import_node_crypto4 = require("crypto");
|
|
14407
14474
|
|
|
14408
14475
|
// src/agents/claude/resolver.ts
|
|
14409
|
-
function buildClaudeLaunch(extraArgs = [],
|
|
14410
|
-
const found =
|
|
14476
|
+
function buildClaudeLaunch(extraArgs = [], os64 = createOsStrategy()) {
|
|
14477
|
+
const found = os64.findInPath("claude") ?? os64.findInPath("claude-code");
|
|
14411
14478
|
if (!found) return null;
|
|
14412
|
-
return
|
|
14479
|
+
return os64.buildLaunch(found, extraArgs);
|
|
14413
14480
|
}
|
|
14414
14481
|
|
|
14415
14482
|
// src/agents/claude/installer.ts
|
|
14416
14483
|
var import_child_process9 = require("child_process");
|
|
14417
14484
|
var path17 = __toESM(require("path"));
|
|
14418
|
-
var
|
|
14485
|
+
var os12 = __toESM(require("os"));
|
|
14419
14486
|
function probeInstallDirs() {
|
|
14420
|
-
const home =
|
|
14487
|
+
const home = os12.homedir();
|
|
14421
14488
|
if (process.platform === "win32") {
|
|
14422
14489
|
return [
|
|
14423
14490
|
path17.join(home, ".claude", "local"),
|
|
@@ -14499,7 +14566,7 @@ var import_node_child_process3 = require("child_process");
|
|
|
14499
14566
|
// src/agents/claude/local-token.ts
|
|
14500
14567
|
var import_node_child_process2 = require("child_process");
|
|
14501
14568
|
var fs15 = __toESM(require("fs"));
|
|
14502
|
-
var
|
|
14569
|
+
var os13 = __toESM(require("os"));
|
|
14503
14570
|
var path18 = __toESM(require("path"));
|
|
14504
14571
|
var import_node_util3 = require("util");
|
|
14505
14572
|
var execFileP2 = (0, import_node_util3.promisify)(import_node_child_process2.execFile);
|
|
@@ -14510,7 +14577,7 @@ var KEYCHAIN_SERVICE_NAMES = [
|
|
|
14510
14577
|
"Anthropic Claude"
|
|
14511
14578
|
];
|
|
14512
14579
|
function claudeCredentialsPaths() {
|
|
14513
|
-
const home =
|
|
14580
|
+
const home = os13.homedir();
|
|
14514
14581
|
return [
|
|
14515
14582
|
path18.join(home, ".claude", ".credentials.json"),
|
|
14516
14583
|
path18.join(home, ".config", "claude", ".credentials.json")
|
|
@@ -14545,7 +14612,7 @@ async function extractLocalClaudeToken() {
|
|
|
14545
14612
|
}
|
|
14546
14613
|
function readClaudeAgentState() {
|
|
14547
14614
|
const STATE_MAX_BYTES = 256 * 1024;
|
|
14548
|
-
const candidate = path18.join(
|
|
14615
|
+
const candidate = path18.join(os13.homedir(), ".claude.json");
|
|
14549
14616
|
try {
|
|
14550
14617
|
if (!fs15.existsSync(candidate)) return void 0;
|
|
14551
14618
|
const buf = fs15.readFileSync(candidate);
|
|
@@ -14636,7 +14703,7 @@ function claudeLoginLauncher() {
|
|
|
14636
14703
|
|
|
14637
14704
|
// src/agents/claude/quota.ts
|
|
14638
14705
|
var fs16 = __toESM(require("fs"));
|
|
14639
|
-
var
|
|
14706
|
+
var os14 = __toESM(require("os"));
|
|
14640
14707
|
var path19 = __toESM(require("path"));
|
|
14641
14708
|
var import_child_process10 = require("child_process");
|
|
14642
14709
|
var HELPER_SCRIPT = `import os,pty,sys,select,signal,struct,fcntl,termios,errno
|
|
@@ -14700,7 +14767,7 @@ async function fetchClaudeQuota() {
|
|
|
14700
14767
|
resolve9(null);
|
|
14701
14768
|
return;
|
|
14702
14769
|
}
|
|
14703
|
-
const helperPath = path19.join(
|
|
14770
|
+
const helperPath = path19.join(os14.tmpdir(), "codeam-quota-helper.py");
|
|
14704
14771
|
fs16.writeFileSync(helperPath, HELPER_SCRIPT, { mode: 420 });
|
|
14705
14772
|
const python = findInPath("python3") ?? findInPath("python");
|
|
14706
14773
|
if (!python) {
|
|
@@ -14814,12 +14881,12 @@ async function spawnAndCapture(cmd, args2, opts = {}) {
|
|
|
14814
14881
|
// src/agents/claude/history.ts
|
|
14815
14882
|
var fs17 = __toESM(require("fs"));
|
|
14816
14883
|
var path20 = __toESM(require("path"));
|
|
14817
|
-
var
|
|
14884
|
+
var os15 = __toESM(require("os"));
|
|
14818
14885
|
function encodeCwd(cwd) {
|
|
14819
14886
|
return cwd.replace(/[\\/:_]/g, "-");
|
|
14820
14887
|
}
|
|
14821
14888
|
function resolveHistoryDir(cwd, projectsRoot) {
|
|
14822
|
-
const root = projectsRoot ?? path20.join(
|
|
14889
|
+
const root = projectsRoot ?? path20.join(os15.homedir(), ".claude", "projects");
|
|
14823
14890
|
const primary = path20.join(root, encodeCwd(cwd));
|
|
14824
14891
|
if (fs17.existsSync(primary)) return primary;
|
|
14825
14892
|
try {
|
|
@@ -14999,8 +15066,8 @@ var ClaudeRuntimeStrategy = class {
|
|
|
14999
15066
|
meta = getAgent("claude");
|
|
15000
15067
|
mode = "interactive";
|
|
15001
15068
|
os;
|
|
15002
|
-
constructor(
|
|
15003
|
-
this.os =
|
|
15069
|
+
constructor(os64) {
|
|
15070
|
+
this.os = os64;
|
|
15004
15071
|
}
|
|
15005
15072
|
/**
|
|
15006
15073
|
* Claude Code's react-ink TUI enables bracketed-paste mode at
|
|
@@ -15136,23 +15203,23 @@ var ClaudeRuntimeStrategy = class {
|
|
|
15136
15203
|
|
|
15137
15204
|
// src/agents/claude/deploy.ts
|
|
15138
15205
|
var fs19 = __toESM(require("fs"));
|
|
15139
|
-
var
|
|
15206
|
+
var os17 = __toESM(require("os"));
|
|
15140
15207
|
var path22 = __toESM(require("path"));
|
|
15141
15208
|
|
|
15142
15209
|
// src/agents/claude/credentials.ts
|
|
15143
15210
|
var import_child_process12 = require("child_process");
|
|
15144
15211
|
var fs18 = __toESM(require("fs"));
|
|
15145
|
-
var
|
|
15212
|
+
var os16 = __toESM(require("os"));
|
|
15146
15213
|
var path21 = __toESM(require("path"));
|
|
15147
15214
|
var import_util2 = require("util");
|
|
15148
15215
|
var execFileP3 = (0, import_util2.promisify)(import_child_process12.execFile);
|
|
15149
15216
|
async function detectLocalClaudeCredentials() {
|
|
15150
|
-
const localClaudeDir = path21.join(
|
|
15217
|
+
const localClaudeDir = path21.join(os16.homedir(), ".claude");
|
|
15151
15218
|
const flat = path21.join(localClaudeDir, ".credentials.json");
|
|
15152
15219
|
if (fs18.existsSync(flat)) {
|
|
15153
15220
|
return { source: "flat-file", description: "~/.claude/.credentials.json" };
|
|
15154
15221
|
}
|
|
15155
|
-
if (
|
|
15222
|
+
if (os16.platform() === "darwin") {
|
|
15156
15223
|
try {
|
|
15157
15224
|
await execFileP3(
|
|
15158
15225
|
"security",
|
|
@@ -15167,7 +15234,7 @@ async function detectLocalClaudeCredentials() {
|
|
|
15167
15234
|
return { source: "none", description: "" };
|
|
15168
15235
|
}
|
|
15169
15236
|
async function bridgeClaudeCredentials(provider, workspaceId) {
|
|
15170
|
-
const localClaudeDir = path21.join(
|
|
15237
|
+
const localClaudeDir = path21.join(os16.homedir(), ".claude");
|
|
15171
15238
|
const fileBased = path21.join(localClaudeDir, ".credentials.json");
|
|
15172
15239
|
if (fs18.existsSync(fileBased)) {
|
|
15173
15240
|
return { source: "flat-file", description: "~/.claude/.credentials.json" };
|
|
@@ -15261,7 +15328,7 @@ var ClaudeDeployStrategy = class {
|
|
|
15261
15328
|
process.exit(1);
|
|
15262
15329
|
}
|
|
15263
15330
|
claudeStep.stop("\u2713 Claude CLI installed");
|
|
15264
|
-
const localClaudeDir = path22.join(
|
|
15331
|
+
const localClaudeDir = path22.join(os17.homedir(), ".claude");
|
|
15265
15332
|
const haveLocalClaude = fs19.existsSync(localClaudeDir) && fs19.statSync(localClaudeDir).isDirectory();
|
|
15266
15333
|
if (haveLocalClaude) {
|
|
15267
15334
|
const copyStep = fe();
|
|
@@ -15316,7 +15383,7 @@ var ClaudeDeployStrategy = class {
|
|
|
15316
15383
|
}
|
|
15317
15384
|
}
|
|
15318
15385
|
if (opts.bridged !== "none") {
|
|
15319
|
-
const localClaudeJson = path22.join(
|
|
15386
|
+
const localClaudeJson = path22.join(os17.homedir(), ".claude.json");
|
|
15320
15387
|
if (fs19.existsSync(localClaudeJson)) {
|
|
15321
15388
|
try {
|
|
15322
15389
|
const contents = fs19.readFileSync(localClaudeJson);
|
|
@@ -15713,10 +15780,10 @@ var import_node_child_process4 = require("child_process");
|
|
|
15713
15780
|
|
|
15714
15781
|
// src/agents/codex/local-token.ts
|
|
15715
15782
|
var fs21 = __toESM(require("fs"));
|
|
15716
|
-
var
|
|
15783
|
+
var os19 = __toESM(require("os"));
|
|
15717
15784
|
var path24 = __toESM(require("path"));
|
|
15718
15785
|
function codexCredentialsPath() {
|
|
15719
|
-
return path24.join(
|
|
15786
|
+
return path24.join(os19.homedir(), ".codex", "auth.json");
|
|
15720
15787
|
}
|
|
15721
15788
|
async function extractLocalCodexToken() {
|
|
15722
15789
|
const file = codexCredentialsPath();
|
|
@@ -15780,8 +15847,8 @@ function codexCredentialLocator() {
|
|
|
15780
15847
|
function codexLoginLauncher() {
|
|
15781
15848
|
return {
|
|
15782
15849
|
async ensureInstalled() {
|
|
15783
|
-
const
|
|
15784
|
-
return
|
|
15850
|
+
const os64 = createOsStrategy();
|
|
15851
|
+
return os64.findInPath("codex") !== null;
|
|
15785
15852
|
},
|
|
15786
15853
|
launch() {
|
|
15787
15854
|
return (0, import_node_child_process4.spawn)("codex", ["login"], { stdio: "inherit" });
|
|
@@ -15804,8 +15871,8 @@ var CodexRuntimeStrategy = class {
|
|
|
15804
15871
|
meta = getAgent("codex");
|
|
15805
15872
|
mode = "interactive";
|
|
15806
15873
|
os;
|
|
15807
|
-
constructor(
|
|
15808
|
-
this.os =
|
|
15874
|
+
constructor(os64) {
|
|
15875
|
+
this.os = os64;
|
|
15809
15876
|
}
|
|
15810
15877
|
async prepareLaunch() {
|
|
15811
15878
|
let binary = this.os.findInPath("codex");
|
|
@@ -15914,12 +15981,12 @@ var CodexRuntimeStrategy = class {
|
|
|
15914
15981
|
});
|
|
15915
15982
|
}
|
|
15916
15983
|
};
|
|
15917
|
-
function resolveNpm(
|
|
15918
|
-
return
|
|
15984
|
+
function resolveNpm(os64) {
|
|
15985
|
+
return os64.id === "win32" ? "npm.cmd" : "npm";
|
|
15919
15986
|
}
|
|
15920
|
-
async function installCodexViaNpm(
|
|
15987
|
+
async function installCodexViaNpm(os64) {
|
|
15921
15988
|
return new Promise((resolve9, reject) => {
|
|
15922
|
-
const proc = (0, import_node_child_process5.spawn)(resolveNpm(
|
|
15989
|
+
const proc = (0, import_node_child_process5.spawn)(resolveNpm(os64), ["install", "-g", "@openai/codex"], {
|
|
15923
15990
|
stdio: "inherit"
|
|
15924
15991
|
});
|
|
15925
15992
|
proc.on("close", (code) => {
|
|
@@ -15936,16 +16003,16 @@ async function installCodexViaNpm(os63) {
|
|
|
15936
16003
|
});
|
|
15937
16004
|
});
|
|
15938
16005
|
}
|
|
15939
|
-
function augmentNpmGlobalBin(
|
|
16006
|
+
function augmentNpmGlobalBin(os64) {
|
|
15940
16007
|
try {
|
|
15941
|
-
const result = (0, import_node_child_process5.spawnSync)(resolveNpm(
|
|
16008
|
+
const result = (0, import_node_child_process5.spawnSync)(resolveNpm(os64), ["prefix", "-g"], {
|
|
15942
16009
|
stdio: ["ignore", "pipe", "ignore"]
|
|
15943
16010
|
});
|
|
15944
16011
|
if (result.status !== 0) return;
|
|
15945
16012
|
const prefix = result.stdout.toString().trim();
|
|
15946
16013
|
if (!prefix) return;
|
|
15947
|
-
const binDir =
|
|
15948
|
-
|
|
16014
|
+
const binDir = os64.id === "win32" ? prefix : path25.join(prefix, "bin");
|
|
16015
|
+
os64.augmentPath([binDir]);
|
|
15949
16016
|
} catch {
|
|
15950
16017
|
}
|
|
15951
16018
|
}
|
|
@@ -16029,9 +16096,9 @@ var import_node_child_process8 = require("child_process");
|
|
|
16029
16096
|
// src/agents/coderabbit/installer.ts
|
|
16030
16097
|
var import_node_child_process6 = require("child_process");
|
|
16031
16098
|
var INSTALL_URL = "https://cli.coderabbit.ai/install.sh";
|
|
16032
|
-
async function ensureCoderabbitInstalled(
|
|
16033
|
-
if (
|
|
16034
|
-
if (
|
|
16099
|
+
async function ensureCoderabbitInstalled(os64) {
|
|
16100
|
+
if (os64.findInPath("coderabbit")) return true;
|
|
16101
|
+
if (os64.id === "win32") {
|
|
16035
16102
|
console.error(
|
|
16036
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"
|
|
16037
16104
|
);
|
|
@@ -16064,14 +16131,14 @@ async function ensureCoderabbitInstalled(os63) {
|
|
|
16064
16131
|
proc.on("error", () => finish(false));
|
|
16065
16132
|
});
|
|
16066
16133
|
if (!ok) return false;
|
|
16067
|
-
|
|
16068
|
-
return
|
|
16134
|
+
os64.augmentPath([`${os64.homeDir()}/.local/bin`, "/opt/homebrew/bin"]);
|
|
16135
|
+
return os64.findInPath("coderabbit") !== null;
|
|
16069
16136
|
}
|
|
16070
16137
|
|
|
16071
16138
|
// src/agents/coderabbit/link.ts
|
|
16072
16139
|
var import_node_child_process7 = require("child_process");
|
|
16073
16140
|
var fs23 = __toESM(require("fs"));
|
|
16074
|
-
var
|
|
16141
|
+
var os21 = __toESM(require("os"));
|
|
16075
16142
|
var path27 = __toESM(require("path"));
|
|
16076
16143
|
|
|
16077
16144
|
// src/agents/strategy.ts
|
|
@@ -16081,7 +16148,7 @@ function validateNonEmptyCredential(token) {
|
|
|
16081
16148
|
|
|
16082
16149
|
// src/agents/coderabbit/link.ts
|
|
16083
16150
|
function authPath() {
|
|
16084
|
-
return path27.join(
|
|
16151
|
+
return path27.join(os21.homedir(), ".coderabbit", "auth.json");
|
|
16085
16152
|
}
|
|
16086
16153
|
async function extractLocalCoderabbitToken() {
|
|
16087
16154
|
const file = authPath();
|
|
@@ -16100,10 +16167,10 @@ function coderabbitCredentialLocator() {
|
|
|
16100
16167
|
validate: validateNonEmptyCredential
|
|
16101
16168
|
};
|
|
16102
16169
|
}
|
|
16103
|
-
function coderabbitLoginLauncher(
|
|
16170
|
+
function coderabbitLoginLauncher(os64) {
|
|
16104
16171
|
return {
|
|
16105
16172
|
async ensureInstalled() {
|
|
16106
|
-
return ensureCoderabbitInstalled(
|
|
16173
|
+
return ensureCoderabbitInstalled(os64);
|
|
16107
16174
|
},
|
|
16108
16175
|
launch() {
|
|
16109
16176
|
return (0, import_node_child_process7.spawn)("coderabbit", ["auth", "login"], { stdio: "inherit" });
|
|
@@ -16323,8 +16390,8 @@ var CoderabbitRuntimeStrategy = class {
|
|
|
16323
16390
|
meta = getAgent("coderabbit");
|
|
16324
16391
|
mode = "batch";
|
|
16325
16392
|
os;
|
|
16326
|
-
constructor(
|
|
16327
|
-
this.os =
|
|
16393
|
+
constructor(os64) {
|
|
16394
|
+
this.os = os64;
|
|
16328
16395
|
}
|
|
16329
16396
|
getDefaultArgs() {
|
|
16330
16397
|
return ["review", "--agent"];
|
|
@@ -16427,11 +16494,11 @@ CodeRabbit review timed out after ${Math.round(
|
|
|
16427
16494
|
|
|
16428
16495
|
// src/agents/cursor/history.ts
|
|
16429
16496
|
var fs24 = __toESM(require("fs"));
|
|
16430
|
-
var
|
|
16497
|
+
var os22 = __toESM(require("os"));
|
|
16431
16498
|
var path28 = __toESM(require("path"));
|
|
16432
16499
|
var import_node_crypto5 = require("crypto");
|
|
16433
|
-
var HISTORY_ROOT = path28.join(
|
|
16434
|
-
var CURSOR_HOME = path28.join(
|
|
16500
|
+
var HISTORY_ROOT = path28.join(os22.homedir(), ".cursor", "projects");
|
|
16501
|
+
var CURSOR_HOME = path28.join(os22.homedir(), ".cursor");
|
|
16435
16502
|
var STORE_FILES = ["store.db", "store.db-wal", "store.db-shm"];
|
|
16436
16503
|
function acpSessionDir(sessionId) {
|
|
16437
16504
|
return path28.join(CURSOR_HOME, "acp-sessions", sessionId);
|
|
@@ -16568,10 +16635,10 @@ var import_node_child_process9 = require("child_process");
|
|
|
16568
16635
|
|
|
16569
16636
|
// src/agents/cursor/local-token.ts
|
|
16570
16637
|
var fs25 = __toESM(require("fs"));
|
|
16571
|
-
var
|
|
16638
|
+
var os23 = __toESM(require("os"));
|
|
16572
16639
|
var path29 = __toESM(require("path"));
|
|
16573
16640
|
function cursorCredentialsPath() {
|
|
16574
|
-
return path29.join(
|
|
16641
|
+
return path29.join(os23.homedir(), ".cursor", "auth.json");
|
|
16575
16642
|
}
|
|
16576
16643
|
async function extractLocalCursorToken() {
|
|
16577
16644
|
const file = cursorCredentialsPath();
|
|
@@ -16595,10 +16662,10 @@ function cursorCredentialLocator() {
|
|
|
16595
16662
|
validate: validateNonEmptyCredential
|
|
16596
16663
|
};
|
|
16597
16664
|
}
|
|
16598
|
-
function cursorLoginLauncher(
|
|
16665
|
+
function cursorLoginLauncher(os64) {
|
|
16599
16666
|
return {
|
|
16600
16667
|
async ensureInstalled() {
|
|
16601
|
-
if (
|
|
16668
|
+
if (os64.findInPath("cursor-agent")) return true;
|
|
16602
16669
|
console.error(
|
|
16603
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"
|
|
16604
16671
|
);
|
|
@@ -16662,8 +16729,8 @@ var CursorRuntimeStrategy = class {
|
|
|
16662
16729
|
meta = getAgent("cursor");
|
|
16663
16730
|
mode = "interactive";
|
|
16664
16731
|
os;
|
|
16665
|
-
constructor(
|
|
16666
|
-
this.os =
|
|
16732
|
+
constructor(os64) {
|
|
16733
|
+
this.os = os64;
|
|
16667
16734
|
}
|
|
16668
16735
|
async prepareLaunch() {
|
|
16669
16736
|
const binary = this.os.findInPath("cursor-agent");
|
|
@@ -16838,9 +16905,9 @@ var import_node_child_process11 = require("child_process");
|
|
|
16838
16905
|
|
|
16839
16906
|
// src/agents/aider/local-token.ts
|
|
16840
16907
|
var fs27 = __toESM(require("fs"));
|
|
16841
|
-
var
|
|
16908
|
+
var os24 = __toESM(require("os"));
|
|
16842
16909
|
var path31 = __toESM(require("path"));
|
|
16843
|
-
var AIDER_CONF_FILE = path31.join(
|
|
16910
|
+
var AIDER_CONF_FILE = path31.join(os24.homedir(), ".aider.conf.yml");
|
|
16844
16911
|
var API_KEY_ENV_VARS = [
|
|
16845
16912
|
"ANTHROPIC_API_KEY",
|
|
16846
16913
|
"OPENAI_API_KEY",
|
|
@@ -16879,10 +16946,10 @@ function aiderCredentialLocator() {
|
|
|
16879
16946
|
validate: validateNonEmptyCredential
|
|
16880
16947
|
};
|
|
16881
16948
|
}
|
|
16882
|
-
function aiderLoginLauncher(
|
|
16949
|
+
function aiderLoginLauncher(os64) {
|
|
16883
16950
|
return {
|
|
16884
16951
|
async ensureInstalled() {
|
|
16885
|
-
if (
|
|
16952
|
+
if (os64.findInPath("aider")) return true;
|
|
16886
16953
|
console.error(
|
|
16887
16954
|
"\n \u2717 aider binary not on PATH.\n Install Aider:\n pip install aider-chat\n then re-run `codeam link aider`.\n"
|
|
16888
16955
|
);
|
|
@@ -16892,7 +16959,7 @@ function aiderLoginLauncher(os63) {
|
|
|
16892
16959
|
console.error(
|
|
16893
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"
|
|
16894
16961
|
);
|
|
16895
|
-
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"], {
|
|
16896
16963
|
stdio: "ignore"
|
|
16897
16964
|
});
|
|
16898
16965
|
}
|
|
@@ -16964,8 +17031,8 @@ var AiderRuntimeStrategy = class {
|
|
|
16964
17031
|
meta = getAgent("aider");
|
|
16965
17032
|
mode = "interactive";
|
|
16966
17033
|
os;
|
|
16967
|
-
constructor(
|
|
16968
|
-
this.os =
|
|
17034
|
+
constructor(os64) {
|
|
17035
|
+
this.os = os64;
|
|
16969
17036
|
}
|
|
16970
17037
|
async prepareLaunch() {
|
|
16971
17038
|
const binary = this.os.findInPath("aider");
|
|
@@ -17040,10 +17107,10 @@ var import_node_child_process12 = require("child_process");
|
|
|
17040
17107
|
|
|
17041
17108
|
// src/agents/gemini/local-token.ts
|
|
17042
17109
|
var fs28 = __toESM(require("fs"));
|
|
17043
|
-
var
|
|
17110
|
+
var os25 = __toESM(require("os"));
|
|
17044
17111
|
var path32 = __toESM(require("path"));
|
|
17045
17112
|
function geminiCredentialsPath() {
|
|
17046
|
-
return path32.join(
|
|
17113
|
+
return path32.join(os25.homedir(), ".gemini", "oauth_creds.json");
|
|
17047
17114
|
}
|
|
17048
17115
|
function geminiCredentialsPaths() {
|
|
17049
17116
|
return [geminiCredentialsPath()];
|
|
@@ -17097,8 +17164,8 @@ function geminiCredentialLocator() {
|
|
|
17097
17164
|
function geminiLoginLauncher() {
|
|
17098
17165
|
return {
|
|
17099
17166
|
async ensureInstalled() {
|
|
17100
|
-
const
|
|
17101
|
-
return
|
|
17167
|
+
const os64 = createOsStrategy();
|
|
17168
|
+
return os64.findInPath("gemini") !== null;
|
|
17102
17169
|
},
|
|
17103
17170
|
launch() {
|
|
17104
17171
|
return (0, import_node_child_process12.spawn)("gemini", ["auth", "login"], { stdio: "inherit" });
|
|
@@ -17108,9 +17175,9 @@ function geminiLoginLauncher() {
|
|
|
17108
17175
|
|
|
17109
17176
|
// src/agents/gemini/history.ts
|
|
17110
17177
|
var fs29 = __toESM(require("fs"));
|
|
17111
|
-
var
|
|
17178
|
+
var os26 = __toESM(require("os"));
|
|
17112
17179
|
var path33 = __toESM(require("path"));
|
|
17113
|
-
var GEMINI_ROOT = path33.join(
|
|
17180
|
+
var GEMINI_ROOT = path33.join(os26.homedir(), ".gemini");
|
|
17114
17181
|
function projectNameForCwd(cwd, root) {
|
|
17115
17182
|
try {
|
|
17116
17183
|
const parsed = JSON.parse(
|
|
@@ -17288,8 +17355,8 @@ var GeminiRuntimeStrategy = class {
|
|
|
17288
17355
|
meta = getAgent("gemini");
|
|
17289
17356
|
mode = "interactive";
|
|
17290
17357
|
os;
|
|
17291
|
-
constructor(
|
|
17292
|
-
this.os =
|
|
17358
|
+
constructor(os64) {
|
|
17359
|
+
this.os = os64;
|
|
17293
17360
|
}
|
|
17294
17361
|
async prepareLaunch() {
|
|
17295
17362
|
const binary = this.os.findInPath("gemini");
|
|
@@ -17403,11 +17470,11 @@ var import_node_path4 = require("path");
|
|
|
17403
17470
|
|
|
17404
17471
|
// src/agents/kimi/history.ts
|
|
17405
17472
|
var fs30 = __toESM(require("fs"));
|
|
17406
|
-
var
|
|
17473
|
+
var os27 = __toESM(require("os"));
|
|
17407
17474
|
var path34 = __toESM(require("path"));
|
|
17408
17475
|
var import_node_crypto7 = require("crypto");
|
|
17409
17476
|
function kimiHome() {
|
|
17410
|
-
return process.env.KIMI_CODE_HOME || path34.join(
|
|
17477
|
+
return process.env.KIMI_CODE_HOME || path34.join(os27.homedir(), ".kimi-code");
|
|
17411
17478
|
}
|
|
17412
17479
|
function workDirKey(cwd) {
|
|
17413
17480
|
const hash = (0, import_node_crypto7.createHash)("sha256").update(cwd).digest("hex").slice(0, 12);
|
|
@@ -17580,8 +17647,8 @@ var KimiRuntimeStrategy = class {
|
|
|
17580
17647
|
meta = getAgent("kimi");
|
|
17581
17648
|
mode = "interactive";
|
|
17582
17649
|
os;
|
|
17583
|
-
constructor(
|
|
17584
|
-
this.os =
|
|
17650
|
+
constructor(os64) {
|
|
17651
|
+
this.os = os64;
|
|
17585
17652
|
}
|
|
17586
17653
|
async prepareLaunch() {
|
|
17587
17654
|
const binary = this.os.findInPath("kimi");
|
|
@@ -17723,8 +17790,8 @@ var OpencodeRuntimeStrategy = class {
|
|
|
17723
17790
|
meta = getAgent("opencode");
|
|
17724
17791
|
mode = "interactive";
|
|
17725
17792
|
os;
|
|
17726
|
-
constructor(
|
|
17727
|
-
this.os =
|
|
17793
|
+
constructor(os64) {
|
|
17794
|
+
this.os = os64;
|
|
17728
17795
|
}
|
|
17729
17796
|
async prepareLaunch() {
|
|
17730
17797
|
const binary = this.os.findInPath("opencode");
|
|
@@ -17808,20 +17875,20 @@ var OpencodeRuntimeStrategy = class {
|
|
|
17808
17875
|
|
|
17809
17876
|
// src/agents/registry.ts
|
|
17810
17877
|
var runtimeBuilders = {
|
|
17811
|
-
claude: (
|
|
17812
|
-
codex: (
|
|
17813
|
-
coderabbit: (
|
|
17814
|
-
cursor: (
|
|
17815
|
-
aider: (
|
|
17816
|
-
gemini: (
|
|
17817
|
-
kimi: (
|
|
17818
|
-
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)
|
|
17819
17886
|
};
|
|
17820
17887
|
var deployBuilders = {
|
|
17821
17888
|
claude: () => new ClaudeDeployStrategy(),
|
|
17822
17889
|
codex: () => new CodexDeployStrategy()
|
|
17823
17890
|
};
|
|
17824
|
-
function createAgentStrategy(agent,
|
|
17891
|
+
function createAgentStrategy(agent, os64 = createOsStrategy()) {
|
|
17825
17892
|
if (!AGENT_REGISTRY[agent]?.enabled) {
|
|
17826
17893
|
throw new Error(
|
|
17827
17894
|
`Agent "${agent}" is not supported in this codeam-cli version. Upgrade with 'npm i -g codeam-cli@latest'.`
|
|
@@ -17831,10 +17898,10 @@ function createAgentStrategy(agent, os63 = createOsStrategy()) {
|
|
|
17831
17898
|
if (!build) {
|
|
17832
17899
|
throw new Error(`No runtime strategy registered for agent "${agent}"`);
|
|
17833
17900
|
}
|
|
17834
|
-
return build(
|
|
17901
|
+
return build(os64);
|
|
17835
17902
|
}
|
|
17836
|
-
function createInteractiveAgentStrategy(agent,
|
|
17837
|
-
const s = createAgentStrategy(agent,
|
|
17903
|
+
function createInteractiveAgentStrategy(agent, os64 = createOsStrategy()) {
|
|
17904
|
+
const s = createAgentStrategy(agent, os64);
|
|
17838
17905
|
if (s.mode !== "interactive") {
|
|
17839
17906
|
throw new Error(
|
|
17840
17907
|
`Agent "${agent}" is a batch agent; use createAgentStrategy + .runOneShot for one-shot reviews.`
|
|
@@ -18242,7 +18309,7 @@ var path37 = __toESM(require("path"));
|
|
|
18242
18309
|
// src/agents/coderabbit/oauth.ts
|
|
18243
18310
|
var import_node_child_process15 = require("child_process");
|
|
18244
18311
|
var fs32 = __toESM(require("fs"));
|
|
18245
|
-
var
|
|
18312
|
+
var os28 = __toESM(require("os"));
|
|
18246
18313
|
var path36 = __toESM(require("path"));
|
|
18247
18314
|
function parseCoderabbitAuthEvent(line) {
|
|
18248
18315
|
const l = line.replace(/\x1b\[[0-9;?]*[A-Za-z]/g, "").trim();
|
|
@@ -18292,7 +18359,7 @@ function resolvePython() {
|
|
|
18292
18359
|
function spawnCoderabbitLoginProc(cmd, args2) {
|
|
18293
18360
|
const python = resolvePython();
|
|
18294
18361
|
if (python) {
|
|
18295
|
-
const helper = path36.join(
|
|
18362
|
+
const helper = path36.join(os28.tmpdir(), "codeam-cr-pty.py");
|
|
18296
18363
|
fs32.writeFileSync(helper, PYTHON_PTY_HELPER, { mode: 420 });
|
|
18297
18364
|
return (0, import_node_child_process15.spawn)(python, [helper, cmd, ...args2], {
|
|
18298
18365
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -18404,7 +18471,7 @@ function runCoderabbitOAuthLogin(deps) {
|
|
|
18404
18471
|
});
|
|
18405
18472
|
}
|
|
18406
18473
|
function coderabbitDir(home) {
|
|
18407
|
-
return path36.join(home ??
|
|
18474
|
+
return path36.join(home ?? os28.homedir(), ".coderabbit");
|
|
18408
18475
|
}
|
|
18409
18476
|
var NON_CREDENTIAL = /* @__PURE__ */ new Set(["doctor.json", "machine-id"]);
|
|
18410
18477
|
function snapshotCredentialDir(home) {
|
|
@@ -18531,26 +18598,26 @@ function restoreCoderabbitOauthBlob(value) {
|
|
|
18531
18598
|
(0, import_node_fs5.writeFileSync)(path37.join(dir, file), contents, { mode: 384 });
|
|
18532
18599
|
}
|
|
18533
18600
|
async function configureCoderabbit(input, deps = {}) {
|
|
18534
|
-
const
|
|
18601
|
+
const os64 = deps.os ?? createOsStrategy();
|
|
18535
18602
|
const ensureInstalled = deps.ensureInstalled ?? ensureCoderabbitInstalled;
|
|
18536
18603
|
const isLoggedIn = deps.isLoggedIn ?? defaultIsLoggedIn;
|
|
18537
18604
|
const runOAuth = deps.runOAuthLogin ?? runCoderabbitOAuthLogin;
|
|
18538
18605
|
const snapshot = deps.snapshotDir ?? (() => snapshotCredentialDir());
|
|
18539
18606
|
const capture2 = deps.captureCredential ?? ((b) => diffCapturedCredential(b));
|
|
18540
18607
|
const loginWithApiKey = deps.loginWithApiKey ?? defaultLoginWithApiKey;
|
|
18541
|
-
const home =
|
|
18542
|
-
|
|
18543
|
-
|
|
18608
|
+
const home = os64.homeDir();
|
|
18609
|
+
os64.augmentPath(
|
|
18610
|
+
os64.id === "win32" ? [
|
|
18544
18611
|
path37.join(home, ".local", "bin"),
|
|
18545
18612
|
path37.join(process.env.APPDATA ?? path37.join(home, "AppData", "Roaming"), "npm"),
|
|
18546
18613
|
path37.join(home, "scoop", "shims")
|
|
18547
18614
|
] : [path37.join(home, ".local", "bin"), "/opt/homebrew/bin", "/usr/local/bin"]
|
|
18548
18615
|
);
|
|
18549
|
-
const installed2 =
|
|
18616
|
+
const installed2 = os64.findInPath("coderabbit") !== null;
|
|
18550
18617
|
const base = () => ({
|
|
18551
18618
|
action: input.action,
|
|
18552
18619
|
supported: true,
|
|
18553
|
-
installed:
|
|
18620
|
+
installed: os64.findInPath("coderabbit") !== null,
|
|
18554
18621
|
loggedIn: false
|
|
18555
18622
|
});
|
|
18556
18623
|
if (input.action === "status") {
|
|
@@ -18564,7 +18631,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
18564
18631
|
const key = (input.apiKey ?? "").trim();
|
|
18565
18632
|
if (!key) return { ...res2, error: "No API key provided" };
|
|
18566
18633
|
if (!res2.installed) {
|
|
18567
|
-
const ok = await ensureInstalled(
|
|
18634
|
+
const ok = await ensureInstalled(os64);
|
|
18568
18635
|
res2.installed = ok;
|
|
18569
18636
|
if (!ok) return { ...res2, error: "CodeRabbit CLI could not be installed" };
|
|
18570
18637
|
}
|
|
@@ -18588,7 +18655,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
18588
18655
|
}
|
|
18589
18656
|
if (!res2.installed) {
|
|
18590
18657
|
deps.onEvent?.({ kind: "installing" });
|
|
18591
|
-
const ok = await ensureInstalled(
|
|
18658
|
+
const ok = await ensureInstalled(os64);
|
|
18592
18659
|
res2.installed = ok;
|
|
18593
18660
|
if (!ok) return { ...res2, error: "CodeRabbit CLI could not be installed" };
|
|
18594
18661
|
}
|
|
@@ -18618,7 +18685,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
18618
18685
|
const res2 = base();
|
|
18619
18686
|
if (!installed2) {
|
|
18620
18687
|
deps.onEvent?.({ kind: "installing" });
|
|
18621
|
-
const ok = await ensureInstalled(
|
|
18688
|
+
const ok = await ensureInstalled(os64);
|
|
18622
18689
|
res2.installed = ok;
|
|
18623
18690
|
if (!ok) return { ...res2, error: "CodeRabbit CLI could not be installed" };
|
|
18624
18691
|
}
|
|
@@ -18658,7 +18725,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
18658
18725
|
}
|
|
18659
18726
|
const res = base();
|
|
18660
18727
|
if (!res.installed) {
|
|
18661
|
-
const ok = await ensureInstalled(
|
|
18728
|
+
const ok = await ensureInstalled(os64);
|
|
18662
18729
|
res.installed = ok;
|
|
18663
18730
|
if (!ok) return { ...res, error: "CodeRabbit CLI is not installed" };
|
|
18664
18731
|
}
|
|
@@ -18842,7 +18909,7 @@ function defaultRunGh(args2) {
|
|
|
18842
18909
|
|
|
18843
18910
|
// src/commands/host-agent.ts
|
|
18844
18911
|
var import_node_child_process25 = require("child_process");
|
|
18845
|
-
var
|
|
18912
|
+
var os40 = __toESM(require("os"));
|
|
18846
18913
|
var fs45 = __toESM(require("fs"));
|
|
18847
18914
|
var path48 = __toESM(require("path"));
|
|
18848
18915
|
|
|
@@ -18991,13 +19058,13 @@ function describeReason(reason) {
|
|
|
18991
19058
|
|
|
18992
19059
|
// src/commands/host/host-client.ts
|
|
18993
19060
|
var fs36 = __toESM(require("fs"));
|
|
18994
|
-
var
|
|
19061
|
+
var os32 = __toESM(require("os"));
|
|
18995
19062
|
var path40 = __toESM(require("path"));
|
|
18996
19063
|
var import_node_crypto9 = require("crypto");
|
|
18997
19064
|
function sampleCpuTimes() {
|
|
18998
19065
|
let idle = 0;
|
|
18999
19066
|
let total = 0;
|
|
19000
|
-
for (const cpu of
|
|
19067
|
+
for (const cpu of os32.cpus()) {
|
|
19001
19068
|
const t2 = cpu.times;
|
|
19002
19069
|
idle += t2.idle;
|
|
19003
19070
|
total += t2.user + t2.nice + t2.sys + t2.idle + t2.irq;
|
|
@@ -19016,8 +19083,8 @@ var MetricsCollector = class {
|
|
|
19016
19083
|
const prev = this.prevCpu;
|
|
19017
19084
|
this.prevCpu = current2;
|
|
19018
19085
|
if (!prev) {
|
|
19019
|
-
const cores =
|
|
19020
|
-
const proxy =
|
|
19086
|
+
const cores = os32.cpus().length || 1;
|
|
19087
|
+
const proxy = os32.loadavg()[0] / cores * 100;
|
|
19021
19088
|
return Math.min(100, Math.max(0, Math.round(proxy)));
|
|
19022
19089
|
}
|
|
19023
19090
|
const idleDelta = current2.idle - prev.idle;
|
|
@@ -19030,8 +19097,8 @@ var MetricsCollector = class {
|
|
|
19030
19097
|
collect() {
|
|
19031
19098
|
return {
|
|
19032
19099
|
cpuPct: this.cpuPct(),
|
|
19033
|
-
ramUsedMb: Math.round((
|
|
19034
|
-
ramTotalMb: Math.round(
|
|
19100
|
+
ramUsedMb: Math.round((os32.totalmem() - os32.freemem()) / 1048576),
|
|
19101
|
+
ramTotalMb: Math.round(os32.totalmem() / 1048576),
|
|
19035
19102
|
latencyMs: this.lastLatencyMs
|
|
19036
19103
|
};
|
|
19037
19104
|
}
|
|
@@ -19040,13 +19107,13 @@ function apiBase() {
|
|
|
19040
19107
|
return process.env.CODEAM_API_URL ?? resolveApiBaseUrl();
|
|
19041
19108
|
}
|
|
19042
19109
|
function hostIdentityPath() {
|
|
19043
|
-
return path40.join(
|
|
19110
|
+
return path40.join(os32.homedir(), ".codeam", "host-agent.json");
|
|
19044
19111
|
}
|
|
19045
19112
|
function collectOsInfo() {
|
|
19046
19113
|
return {
|
|
19047
|
-
distro:
|
|
19048
|
-
arch:
|
|
19049
|
-
kernel:
|
|
19114
|
+
distro: os32.platform(),
|
|
19115
|
+
arch: os32.arch(),
|
|
19116
|
+
kernel: os32.release(),
|
|
19050
19117
|
nodeVersion: process.versions.node
|
|
19051
19118
|
};
|
|
19052
19119
|
}
|
|
@@ -19141,7 +19208,7 @@ async function postJson(pathname, body) {
|
|
|
19141
19208
|
function resolveHostLabel(label) {
|
|
19142
19209
|
const explicit = label?.trim();
|
|
19143
19210
|
const envLabel = process.env.CODEAM_HOST_LABEL?.trim();
|
|
19144
|
-
const resolved = explicit || envLabel ||
|
|
19211
|
+
const resolved = explicit || envLabel || os32.hostname();
|
|
19145
19212
|
return resolved.slice(0, 80);
|
|
19146
19213
|
}
|
|
19147
19214
|
async function redeemEnrollToken(token, label) {
|
|
@@ -19253,7 +19320,7 @@ async function reportDeployProgress(auth, deployId, step, message, sessionId) {
|
|
|
19253
19320
|
|
|
19254
19321
|
// src/commands/host/workspace.ts
|
|
19255
19322
|
var fs37 = __toESM(require("fs"));
|
|
19256
|
-
var
|
|
19323
|
+
var os33 = __toESM(require("os"));
|
|
19257
19324
|
var path41 = __toESM(require("path"));
|
|
19258
19325
|
var import_node_child_process19 = require("child_process");
|
|
19259
19326
|
var import_node_util4 = require("util");
|
|
@@ -19262,7 +19329,7 @@ function isAbsolutePathTarget(target) {
|
|
|
19262
19329
|
return path41.isAbsolute(target);
|
|
19263
19330
|
}
|
|
19264
19331
|
function selfHostedWorkspaceRoot() {
|
|
19265
|
-
return path41.join(
|
|
19332
|
+
return path41.join(os33.homedir(), ".codeam", "self-hosted");
|
|
19266
19333
|
}
|
|
19267
19334
|
function nonInteractiveGitEnv() {
|
|
19268
19335
|
return {
|
|
@@ -19402,7 +19469,7 @@ async function prepareWorkspace(repoOrPath, deployId, cloneToken, provider = "gi
|
|
|
19402
19469
|
|
|
19403
19470
|
// src/commands/host/agent-provisioning.ts
|
|
19404
19471
|
var fs38 = __toESM(require("fs"));
|
|
19405
|
-
var
|
|
19472
|
+
var os34 = __toESM(require("os"));
|
|
19406
19473
|
var path42 = __toESM(require("path"));
|
|
19407
19474
|
var PUBLIC_TO_INTERNAL_AGENT = {
|
|
19408
19475
|
claude_code: "claude",
|
|
@@ -19587,7 +19654,7 @@ var UnsupportedAgentError = class extends Error {
|
|
|
19587
19654
|
this.agentId = agentId;
|
|
19588
19655
|
}
|
|
19589
19656
|
};
|
|
19590
|
-
function provisionAgentCredentials(publicAgentId, auth, homeDir2 =
|
|
19657
|
+
function provisionAgentCredentials(publicAgentId, auth, homeDir2 = os34.homedir()) {
|
|
19591
19658
|
const internal = toInternalAgentId(publicAgentId);
|
|
19592
19659
|
if (!internal) throw new UnsupportedAgentError(publicAgentId);
|
|
19593
19660
|
const provisioner = PROVISIONERS[internal];
|
|
@@ -19598,10 +19665,10 @@ function provisionAgentCredentials(publicAgentId, auth, homeDir2 = os33.homedir(
|
|
|
19598
19665
|
// src/commands/host/git-tooling.ts
|
|
19599
19666
|
var import_node_child_process20 = require("child_process");
|
|
19600
19667
|
var fs39 = __toESM(require("fs"));
|
|
19601
|
-
var
|
|
19668
|
+
var os35 = __toESM(require("os"));
|
|
19602
19669
|
var path43 = __toESM(require("path"));
|
|
19603
19670
|
function codeamBinDir() {
|
|
19604
|
-
return process.env.CODEAM_BIN_DIR ?? path43.join(
|
|
19671
|
+
return process.env.CODEAM_BIN_DIR ?? path43.join(os35.homedir(), ".codeam", "bin");
|
|
19605
19672
|
}
|
|
19606
19673
|
var FALLBACK_GH_VERSION = "2.62.0";
|
|
19607
19674
|
var RELEASE_API = "https://api.github.com/repos/cli/cli/releases/latest";
|
|
@@ -19656,7 +19723,7 @@ async function ensureGhCli(runner, token, deps = {}) {
|
|
|
19656
19723
|
const version3 = await resolveVersionFn(token);
|
|
19657
19724
|
const asset = `gh_${version3}_${osToken}_${arch2}`;
|
|
19658
19725
|
const url2 = `https://github.com/cli/cli/releases/download/v${version3}/${asset}.${ext}`;
|
|
19659
|
-
const tmpRoot = fs39.mkdtempSync(path43.join(
|
|
19726
|
+
const tmpRoot = fs39.mkdtempSync(path43.join(os35.tmpdir(), "codeam-gh-"));
|
|
19660
19727
|
const archive = path43.join(tmpRoot, `${asset}.${ext}`);
|
|
19661
19728
|
if (!await downloadFn(url2, archive)) {
|
|
19662
19729
|
log.warn("host-agent", "gh download failed \u2014 skipping (git pull/push still work via the credential helper)");
|
|
@@ -19736,7 +19803,7 @@ async function ensureGlabCli(runner, deps = {}) {
|
|
|
19736
19803
|
const version3 = await resolveLatestGlabVersion();
|
|
19737
19804
|
const asset = `glab_${version3}_${osToken}_${arch2}`;
|
|
19738
19805
|
const url2 = `https://gitlab.com/gitlab-org/cli/-/releases/v${version3}/downloads/${asset}.${ext}`;
|
|
19739
|
-
const tmpRoot = fs39.mkdtempSync(path43.join(
|
|
19806
|
+
const tmpRoot = fs39.mkdtempSync(path43.join(os35.tmpdir(), "codeam-glab-"));
|
|
19740
19807
|
const archive = path43.join(tmpRoot, `${asset}.${ext}`);
|
|
19741
19808
|
if (!await downloadFn(url2, archive)) {
|
|
19742
19809
|
log.warn("host-agent", "glab download failed \u2014 skipping (git push/pull still work)");
|
|
@@ -20251,14 +20318,14 @@ async function ensureModernPython(runner) {
|
|
|
20251
20318
|
// src/commands/host/headroom-bootstrap.ts
|
|
20252
20319
|
var fs41 = __toESM(require("fs"));
|
|
20253
20320
|
var path45 = __toESM(require("path"));
|
|
20254
|
-
var
|
|
20321
|
+
var os37 = __toESM(require("os"));
|
|
20255
20322
|
|
|
20256
20323
|
// src/commands/host/headroom-config.ts
|
|
20257
20324
|
var fs40 = __toESM(require("fs"));
|
|
20258
|
-
var
|
|
20325
|
+
var os36 = __toESM(require("os"));
|
|
20259
20326
|
var path44 = __toESM(require("path"));
|
|
20260
20327
|
function headroomConfigPath() {
|
|
20261
|
-
return path44.join(
|
|
20328
|
+
return path44.join(os36.homedir(), ".codeam", "headroom-config.json");
|
|
20262
20329
|
}
|
|
20263
20330
|
function persistHeadroomConfig(config) {
|
|
20264
20331
|
try {
|
|
@@ -20276,7 +20343,7 @@ function persistHeadroomConfig(config) {
|
|
|
20276
20343
|
}
|
|
20277
20344
|
}
|
|
20278
20345
|
function agentSettingsPath(kind) {
|
|
20279
|
-
const home =
|
|
20346
|
+
const home = os36.homedir();
|
|
20280
20347
|
if (kind === "claude") return path44.join(home, ".claude", "settings.json");
|
|
20281
20348
|
if (kind === "codex") return path44.join(home, ".codex", "auth.json");
|
|
20282
20349
|
if (kind === "copilot") return path44.join(home, ".config", "github-copilot", "hosts.json");
|
|
@@ -20287,7 +20354,7 @@ function backupAgentHeadroomConfig(kind) {
|
|
|
20287
20354
|
if (!src) return;
|
|
20288
20355
|
try {
|
|
20289
20356
|
if (!fs40.existsSync(src)) return;
|
|
20290
|
-
const dest = path44.join(
|
|
20357
|
+
const dest = path44.join(os36.homedir(), ".codeam", `headroom-backup-${kind}.json`);
|
|
20291
20358
|
fs40.mkdirSync(path44.dirname(dest), { recursive: true, mode: 448 });
|
|
20292
20359
|
fs40.copyFileSync(src, dest);
|
|
20293
20360
|
fs40.chmodSync(dest, 384);
|
|
@@ -20302,7 +20369,7 @@ function backupAgentHeadroomConfig(kind) {
|
|
|
20302
20369
|
function restoreAgentHeadroomConfig(kind) {
|
|
20303
20370
|
const dest = agentSettingsPath(kind);
|
|
20304
20371
|
if (!dest) return false;
|
|
20305
|
-
const src = path44.join(
|
|
20372
|
+
const src = path44.join(os36.homedir(), ".codeam", `headroom-backup-${kind}.json`);
|
|
20306
20373
|
if (!fs40.existsSync(src)) return false;
|
|
20307
20374
|
try {
|
|
20308
20375
|
fs40.mkdirSync(path44.dirname(dest), { recursive: true, mode: 448 });
|
|
@@ -20394,7 +20461,7 @@ async function getFreeDiskBytes(dir) {
|
|
|
20394
20461
|
}
|
|
20395
20462
|
function headroomModelsCached() {
|
|
20396
20463
|
const hubDir = process.env.HUGGINGFACE_HUB_CACHE || path45.join(
|
|
20397
|
-
process.env.HF_HOME || path45.join(
|
|
20464
|
+
process.env.HF_HOME || path45.join(os37.homedir(), ".cache", "huggingface"),
|
|
20398
20465
|
"hub"
|
|
20399
20466
|
);
|
|
20400
20467
|
return HEADROOM_MODELS.every(
|
|
@@ -20505,10 +20572,10 @@ async function setupHeadroomForSelfHosted(agent, runner = defaultHeadroomRunner,
|
|
|
20505
20572
|
|
|
20506
20573
|
// src/commands/host/house-proxy-config.ts
|
|
20507
20574
|
var fs42 = __toESM(require("fs"));
|
|
20508
|
-
var
|
|
20575
|
+
var os38 = __toESM(require("os"));
|
|
20509
20576
|
var path46 = __toESM(require("path"));
|
|
20510
20577
|
function houseProxyConfigPath() {
|
|
20511
|
-
return path46.join(
|
|
20578
|
+
return path46.join(os38.homedir(), ".codeam", "house-proxy.json");
|
|
20512
20579
|
}
|
|
20513
20580
|
function persistHouseProxyConfig(config) {
|
|
20514
20581
|
try {
|
|
@@ -20567,7 +20634,7 @@ var import_node_child_process23 = require("child_process");
|
|
|
20567
20634
|
|
|
20568
20635
|
// src/lib/updateNotifier.ts
|
|
20569
20636
|
var fs43 = __toESM(require("fs"));
|
|
20570
|
-
var
|
|
20637
|
+
var os39 = __toESM(require("os"));
|
|
20571
20638
|
var path47 = __toESM(require("path"));
|
|
20572
20639
|
var https6 = __toESM(require("https"));
|
|
20573
20640
|
var import_node_child_process22 = require("child_process");
|
|
@@ -20577,7 +20644,7 @@ var REGISTRY_URL = `https://registry.npmjs.org/${PKG_NAME}/latest`;
|
|
|
20577
20644
|
var TTL_MS = 24 * 60 * 60 * 1e3;
|
|
20578
20645
|
var REQUEST_TIMEOUT_MS = 1500;
|
|
20579
20646
|
function cachePath() {
|
|
20580
|
-
const dir = path47.join(
|
|
20647
|
+
const dir = path47.join(os39.homedir(), ".codeam");
|
|
20581
20648
|
return path47.join(dir, "update-check.json");
|
|
20582
20649
|
}
|
|
20583
20650
|
function readCache() {
|
|
@@ -20723,7 +20790,7 @@ async function autoUpgradeBeforeCriticalCommand() {
|
|
|
20723
20790
|
if (process.env.NODE_ENV === "test") return;
|
|
20724
20791
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
20725
20792
|
if (process.env.CI) return;
|
|
20726
|
-
const current2 = true ? "2.
|
|
20793
|
+
const current2 = true ? "2.62.0" : null;
|
|
20727
20794
|
if (!current2) return;
|
|
20728
20795
|
const cache = readCache();
|
|
20729
20796
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
|
@@ -20740,7 +20807,7 @@ function checkForUpdates() {
|
|
|
20740
20807
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
20741
20808
|
if (process.env.CI) return;
|
|
20742
20809
|
if (!process.stdout.isTTY) return;
|
|
20743
|
-
const current2 = true ? "2.
|
|
20810
|
+
const current2 = true ? "2.62.0" : null;
|
|
20744
20811
|
if (!current2) return;
|
|
20745
20812
|
const cache = readCache();
|
|
20746
20813
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
|
@@ -20760,7 +20827,7 @@ var SELF_UPDATE_INTERVAL_MS = 60 * 60 * 1e3;
|
|
|
20760
20827
|
var SELF_UPDATE_VIEW_TIMEOUT_MS = 3e4;
|
|
20761
20828
|
var SELF_UPDATE_INSTALL_TIMEOUT_MS = 18e4;
|
|
20762
20829
|
function currentCliVersion() {
|
|
20763
|
-
return true ? "2.
|
|
20830
|
+
return true ? "2.62.0" : null;
|
|
20764
20831
|
}
|
|
20765
20832
|
function runCmd(cmd, args2, timeoutMs) {
|
|
20766
20833
|
return new Promise((resolve9) => {
|
|
@@ -21492,7 +21559,7 @@ var HostAgentSupervisor = class {
|
|
|
21492
21559
|
const relay = this.relay;
|
|
21493
21560
|
if (!relay) return;
|
|
21494
21561
|
const raw = cmd.payload?.path;
|
|
21495
|
-
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();
|
|
21496
21563
|
try {
|
|
21497
21564
|
const dirents = await fs45.promises.readdir(target, { withFileTypes: true });
|
|
21498
21565
|
const entries = dirents.filter((d3) => !d3.name.startsWith(".")).map((d3) => ({ name: d3.name, isDir: d3.isDirectory() })).sort(
|
|
@@ -21732,7 +21799,7 @@ var HostAgentSupervisor = class {
|
|
|
21732
21799
|
CODEAM_AUTO_TOKEN: payload.autoPairToken
|
|
21733
21800
|
};
|
|
21734
21801
|
const houseConfigDir = path48.join(
|
|
21735
|
-
|
|
21802
|
+
os40.homedir(),
|
|
21736
21803
|
".codeam",
|
|
21737
21804
|
"house-claude",
|
|
21738
21805
|
payload.deployId
|
|
@@ -21764,7 +21831,7 @@ var HostAgentSupervisor = class {
|
|
|
21764
21831
|
report("installing", "installing agent CLI");
|
|
21765
21832
|
await this.runAgentInstall(payload.agentInstallScript);
|
|
21766
21833
|
}
|
|
21767
|
-
const home = process.env.HOME ||
|
|
21834
|
+
const home = process.env.HOME || os40.homedir();
|
|
21768
21835
|
childEnv.PATH = `${home}/.local/bin:${process.env.PATH ?? ""}`;
|
|
21769
21836
|
if (payload.cloneToken) {
|
|
21770
21837
|
try {
|
|
@@ -21798,7 +21865,7 @@ var HostAgentSupervisor = class {
|
|
|
21798
21865
|
}
|
|
21799
21866
|
if (payload.headroomEnabled && payload.headroomAgent && payload.headroomSavingsIngestUrl && isHeadroomSupportedAgent(payload.headroomAgent)) {
|
|
21800
21867
|
report("headroom", "setting up Headroom proxy");
|
|
21801
|
-
const freeBytes = await this.getFreeDisk(
|
|
21868
|
+
const freeBytes = await this.getFreeDisk(os40.homedir());
|
|
21802
21869
|
const alreadyInstalled = this.isHeadroomInstalled();
|
|
21803
21870
|
if (!alreadyInstalled && freeBytes !== null && freeBytes < HEADROOM_MIN_FREE_DISK_BYTES) {
|
|
21804
21871
|
const freeGb = (freeBytes / 1e9).toFixed(1);
|
|
@@ -21857,7 +21924,7 @@ var HostAgentSupervisor = class {
|
|
|
21857
21924
|
);
|
|
21858
21925
|
if (!payload.suppressOnboardingWelcome) {
|
|
21859
21926
|
try {
|
|
21860
|
-
const cfgDir = childEnv.CLAUDE_CONFIG_DIR || path48.join(
|
|
21927
|
+
const cfgDir = childEnv.CLAUDE_CONFIG_DIR || path48.join(os40.homedir(), ".claude");
|
|
21861
21928
|
const projectDir = path48.join(cfgDir, "projects", encodeCwd(cwd));
|
|
21862
21929
|
const hasPriorConversation = fs45.existsSync(projectDir) && fs45.readdirSync(projectDir).some((f) => f.endsWith(".jsonl"));
|
|
21863
21930
|
if (hasPriorConversation) {
|
|
@@ -22007,7 +22074,7 @@ var HostAgentSupervisor = class {
|
|
|
22007
22074
|
*/
|
|
22008
22075
|
runAgentInstall(script) {
|
|
22009
22076
|
return new Promise((resolve9) => {
|
|
22010
|
-
const home = process.env.HOME ||
|
|
22077
|
+
const home = process.env.HOME || os40.homedir();
|
|
22011
22078
|
const child = (0, import_node_child_process25.spawn)("sh", ["-c", script], {
|
|
22012
22079
|
env: { ...process.env, HOME: home },
|
|
22013
22080
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -22096,7 +22163,7 @@ var HostAgentSupervisor = class {
|
|
|
22096
22163
|
}
|
|
22097
22164
|
const dirs = [
|
|
22098
22165
|
path48.join(selfHostedWorkspaceRoot(), deployId),
|
|
22099
|
-
path48.join(
|
|
22166
|
+
path48.join(os40.homedir(), ".codeam", "house-claude", deployId)
|
|
22100
22167
|
];
|
|
22101
22168
|
for (const dir of dirs) {
|
|
22102
22169
|
try {
|
|
@@ -22238,7 +22305,7 @@ async function configureHeadroom(action, ctx, deps) {
|
|
|
22238
22305
|
|
|
22239
22306
|
// src/services/headroom/budget-relaunch.ts
|
|
22240
22307
|
var fs46 = __toESM(require("fs"));
|
|
22241
|
-
var
|
|
22308
|
+
var os41 = __toESM(require("os"));
|
|
22242
22309
|
var path49 = __toESM(require("path"));
|
|
22243
22310
|
var import_child_process13 = require("child_process");
|
|
22244
22311
|
function amendDeploymentManifestBudget(manifest, budget) {
|
|
@@ -22350,7 +22417,7 @@ function spawnProxyReal2(_budget) {
|
|
|
22350
22417
|
);
|
|
22351
22418
|
}
|
|
22352
22419
|
function makeRealApplyBudgetDeps() {
|
|
22353
|
-
const homeDir2 =
|
|
22420
|
+
const homeDir2 = os41.homedir();
|
|
22354
22421
|
return {
|
|
22355
22422
|
findDeployments: () => findHeadroomDeployments(homeDir2, {
|
|
22356
22423
|
readDir: (dir) => fs46.readdirSync(dir),
|
|
@@ -22489,12 +22556,12 @@ async function readUsageReport(deps = {}) {
|
|
|
22489
22556
|
// src/agents/acp/guardrail-config.ts
|
|
22490
22557
|
var fs47 = __toESM(require("fs"));
|
|
22491
22558
|
var path50 = __toESM(require("path"));
|
|
22492
|
-
var
|
|
22559
|
+
var os42 = __toESM(require("os"));
|
|
22493
22560
|
var current = null;
|
|
22494
|
-
function guardrailConfigPath(homeDir2 =
|
|
22561
|
+
function guardrailConfigPath(homeDir2 = os42.homedir()) {
|
|
22495
22562
|
return path50.join(homeDir2, ".codeam", "guardrails.json");
|
|
22496
22563
|
}
|
|
22497
|
-
function loadGuardrailPolicy(homeDir2 =
|
|
22564
|
+
function loadGuardrailPolicy(homeDir2 = os42.homedir()) {
|
|
22498
22565
|
try {
|
|
22499
22566
|
current = normalizeGuardrailPolicy(JSON.parse(fs47.readFileSync(guardrailConfigPath(homeDir2), "utf8")));
|
|
22500
22567
|
} catch {
|
|
@@ -22502,10 +22569,10 @@ function loadGuardrailPolicy(homeDir2 = os41.homedir()) {
|
|
|
22502
22569
|
}
|
|
22503
22570
|
return current;
|
|
22504
22571
|
}
|
|
22505
|
-
function getGuardrailPolicy(homeDir2 =
|
|
22572
|
+
function getGuardrailPolicy(homeDir2 = os42.homedir()) {
|
|
22506
22573
|
return current ?? loadGuardrailPolicy(homeDir2);
|
|
22507
22574
|
}
|
|
22508
|
-
function setGuardrailPolicy(raw, homeDir2 =
|
|
22575
|
+
function setGuardrailPolicy(raw, homeDir2 = os42.homedir()) {
|
|
22509
22576
|
const next = normalizeGuardrailPolicy(raw);
|
|
22510
22577
|
current = next;
|
|
22511
22578
|
try {
|
|
@@ -22519,11 +22586,11 @@ function setGuardrailPolicy(raw, homeDir2 = os41.homedir()) {
|
|
|
22519
22586
|
|
|
22520
22587
|
// src/services/preview/port-registry.ts
|
|
22521
22588
|
var fs48 = __toESM(require("fs"));
|
|
22522
|
-
var
|
|
22589
|
+
var os43 = __toESM(require("os"));
|
|
22523
22590
|
var path51 = __toESM(require("path"));
|
|
22524
22591
|
var import_child_process14 = require("child_process");
|
|
22525
22592
|
function registryPath() {
|
|
22526
|
-
return path51.join(
|
|
22593
|
+
return path51.join(os43.homedir(), ".codeam", "preview-ports.json");
|
|
22527
22594
|
}
|
|
22528
22595
|
function readRegistry() {
|
|
22529
22596
|
try {
|
|
@@ -24067,7 +24134,7 @@ async function establishTunnel(ctx, dev) {
|
|
|
24067
24134
|
// src/beads/bd-adapter.ts
|
|
24068
24135
|
var import_child_process20 = require("child_process");
|
|
24069
24136
|
var fs57 = __toESM(require("fs"));
|
|
24070
|
-
var
|
|
24137
|
+
var os45 = __toESM(require("os"));
|
|
24071
24138
|
var path60 = __toESM(require("path"));
|
|
24072
24139
|
var BD_PACKAGE = "@beads/bd";
|
|
24073
24140
|
function resolveBundledBdBinary() {
|
|
@@ -24185,7 +24252,7 @@ var BdAdapter = class {
|
|
|
24185
24252
|
const env = { ...process.env };
|
|
24186
24253
|
if (!env.HOME) {
|
|
24187
24254
|
try {
|
|
24188
|
-
const home =
|
|
24255
|
+
const home = os45.homedir();
|
|
24189
24256
|
if (home) env.HOME = home;
|
|
24190
24257
|
} catch {
|
|
24191
24258
|
}
|
|
@@ -24278,7 +24345,7 @@ function coerceIssue(row, projectKey) {
|
|
|
24278
24345
|
// src/beads/provisioner.ts
|
|
24279
24346
|
var import_child_process23 = require("child_process");
|
|
24280
24347
|
var fs59 = __toESM(require("fs"));
|
|
24281
|
-
var
|
|
24348
|
+
var os47 = __toESM(require("os"));
|
|
24282
24349
|
var path62 = __toESM(require("path"));
|
|
24283
24350
|
|
|
24284
24351
|
// src/beads/install-bd.ts
|
|
@@ -24345,7 +24412,7 @@ async function installBd(platform3 = process.platform) {
|
|
|
24345
24412
|
// src/beads/install-dolt.ts
|
|
24346
24413
|
var import_child_process22 = require("child_process");
|
|
24347
24414
|
var fs58 = __toESM(require("fs"));
|
|
24348
|
-
var
|
|
24415
|
+
var os46 = __toESM(require("os"));
|
|
24349
24416
|
var path61 = __toESM(require("path"));
|
|
24350
24417
|
var DOLT_INSTALL_SH_URL = "https://github.com/dolthub/dolt/releases/latest/download/install.sh";
|
|
24351
24418
|
var DOLT_MSI_URL = "https://github.com/dolthub/dolt/releases/latest/download/dolt-windows-amd64.msi";
|
|
@@ -24386,11 +24453,11 @@ function resolveDoltInstallStrategy(platform3) {
|
|
|
24386
24453
|
}
|
|
24387
24454
|
var DOLT_RELEASE_BASE = "https://github.com/dolthub/dolt/releases/latest/download";
|
|
24388
24455
|
function doltPlatformTuple(platform3, arch2) {
|
|
24389
|
-
const
|
|
24456
|
+
const os64 = platform3 === "win32" ? "windows" : platform3 === "darwin" ? "darwin" : "linux";
|
|
24390
24457
|
const a = arch2 === "x64" ? "amd64" : arch2 === "arm64" ? "arm64" : null;
|
|
24391
24458
|
if (!a) return null;
|
|
24392
|
-
if (
|
|
24393
|
-
return `${
|
|
24459
|
+
if (os64 === "windows" && a !== "amd64") return null;
|
|
24460
|
+
return `${os64}-${a}`;
|
|
24394
24461
|
}
|
|
24395
24462
|
function resolveDoltTarballStrategy(targetDir, platform3, arch2) {
|
|
24396
24463
|
const tuple = doltPlatformTuple(platform3, arch2);
|
|
@@ -24435,7 +24502,7 @@ async function installDoltToDir(targetDir, platform3 = process.platform, arch2 =
|
|
|
24435
24502
|
return result;
|
|
24436
24503
|
}
|
|
24437
24504
|
var _doltPathSeam = {
|
|
24438
|
-
homedir: () =>
|
|
24505
|
+
homedir: () => os46.homedir(),
|
|
24439
24506
|
getPath: () => process.env.PATH ?? "",
|
|
24440
24507
|
setPath: (p2) => {
|
|
24441
24508
|
process.env.PATH = p2;
|
|
@@ -24646,7 +24713,7 @@ var _provisionSeam = {
|
|
|
24646
24713
|
};
|
|
24647
24714
|
var _linkSeam = {
|
|
24648
24715
|
platform: () => process.platform,
|
|
24649
|
-
homedir: () =>
|
|
24716
|
+
homedir: () => os47.homedir(),
|
|
24650
24717
|
isWritableDir: (dir) => {
|
|
24651
24718
|
try {
|
|
24652
24719
|
fs59.accessSync(dir, fs59.constants.W_OK);
|
|
@@ -25441,7 +25508,7 @@ function cleanupAttachmentTempFiles() {
|
|
|
25441
25508
|
function saveFilesTemp(files) {
|
|
25442
25509
|
return files.filter(({ base64 }) => base64 && base64.length > 0).map(({ filename, base64 }) => {
|
|
25443
25510
|
const safeName = filename.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 80);
|
|
25444
|
-
const tmpPath = path66.join(
|
|
25511
|
+
const tmpPath = path66.join(os51.tmpdir(), `codeam-${(0, import_crypto3.randomUUID)()}-${safeName}`);
|
|
25445
25512
|
fs62.writeFileSync(tmpPath, Buffer.from(base64, "base64"));
|
|
25446
25513
|
pendingAttachmentFiles.add(tmpPath);
|
|
25447
25514
|
return tmpPath;
|
|
@@ -26036,7 +26103,7 @@ var vcsAgentReviewH = async (ctx, cmd, parsed) => {
|
|
|
26036
26103
|
});
|
|
26037
26104
|
const token = ctx.pluginAuthToken;
|
|
26038
26105
|
void (async () => {
|
|
26039
|
-
const
|
|
26106
|
+
const os64 = createOsStrategy();
|
|
26040
26107
|
try {
|
|
26041
26108
|
const report = await reviewPullRequest(
|
|
26042
26109
|
{
|
|
@@ -26045,7 +26112,7 @@ var vcsAgentReviewH = async (ctx, cmd, parsed) => {
|
|
|
26045
26112
|
baseBranch: parsed.baseBranch
|
|
26046
26113
|
},
|
|
26047
26114
|
{
|
|
26048
|
-
runReview: (input) => new CoderabbitRuntimeStrategy(
|
|
26115
|
+
runReview: (input) => new CoderabbitRuntimeStrategy(os64).runOneShot(input),
|
|
26049
26116
|
runGh: (args2) => defaultRunGh(args2),
|
|
26050
26117
|
postReport: async (r) => {
|
|
26051
26118
|
if (!token) return;
|
|
@@ -26258,13 +26325,13 @@ function resolveGlobalNodeModulesDir(opts) {
|
|
|
26258
26325
|
var STALE_STAGING_AGE_MS = CLI_UPDATE_INSTALL_TIMEOUT_MS;
|
|
26259
26326
|
function sweepStaleCliStagingDirs(nodeModulesDir, now = Date.now(), deps) {
|
|
26260
26327
|
if (!nodeModulesDir) return 0;
|
|
26261
|
-
const
|
|
26328
|
+
const readdirSync15 = deps?.readdirSync ?? fs62.readdirSync;
|
|
26262
26329
|
const statSync17 = deps?.statSync ?? fs62.statSync;
|
|
26263
26330
|
const rmSync9 = deps?.rmSync ?? fs62.rmSync;
|
|
26264
26331
|
let removed = 0;
|
|
26265
26332
|
let entries;
|
|
26266
26333
|
try {
|
|
26267
|
-
entries =
|
|
26334
|
+
entries = readdirSync15(nodeModulesDir);
|
|
26268
26335
|
} catch {
|
|
26269
26336
|
return 0;
|
|
26270
26337
|
}
|
|
@@ -27181,7 +27248,7 @@ async function claimOnce(token, pluginId, pluginSecretHash) {
|
|
|
27181
27248
|
pluginId,
|
|
27182
27249
|
ideName: "codeam-cli (codespace)",
|
|
27183
27250
|
ideVersion: process.env.npm_package_version ?? "unknown",
|
|
27184
|
-
hostname:
|
|
27251
|
+
hostname: os52.hostname(),
|
|
27185
27252
|
codespaceName: process.env.CODESPACE_NAME ?? "",
|
|
27186
27253
|
// Current git branch of the codespace's working directory, so the
|
|
27187
27254
|
// backend can populate `PairedSession.branch` for the codespace pair.
|
|
@@ -27242,7 +27309,7 @@ async function claim(token, pluginId, pluginSecretHash) {
|
|
|
27242
27309
|
}
|
|
27243
27310
|
}
|
|
27244
27311
|
function pairAutoLockPath() {
|
|
27245
|
-
return path67.join(
|
|
27312
|
+
return path67.join(os52.homedir(), ".codeam", "pair-auto.lock");
|
|
27246
27313
|
}
|
|
27247
27314
|
function isLivePairAuto(pid) {
|
|
27248
27315
|
if (!Number.isInteger(pid) || pid <= 0 || pid === process.pid) return false;
|
|
@@ -27262,7 +27329,7 @@ function isLiveCodeam(pid) {
|
|
|
27262
27329
|
}
|
|
27263
27330
|
function daemonLockPath(sessionId) {
|
|
27264
27331
|
const safe = sessionId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
27265
|
-
return path67.join(
|
|
27332
|
+
return path67.join(os52.homedir(), ".codeam", `daemon-${safe}.lock`);
|
|
27266
27333
|
}
|
|
27267
27334
|
function acquireDaemonLock(sessionId) {
|
|
27268
27335
|
const lockPath = daemonLockPath(sessionId);
|
|
@@ -28213,7 +28280,7 @@ var import_node_crypto11 = require("crypto");
|
|
|
28213
28280
|
// src/services/history.service.ts
|
|
28214
28281
|
var fs65 = __toESM(require("fs"));
|
|
28215
28282
|
var path70 = __toESM(require("path"));
|
|
28216
|
-
var
|
|
28283
|
+
var os54 = __toESM(require("os"));
|
|
28217
28284
|
var https7 = __toESM(require("https"));
|
|
28218
28285
|
var http6 = __toESM(require("http"));
|
|
28219
28286
|
var import_zod2 = require("zod");
|
|
@@ -28381,7 +28448,7 @@ var HistoryService = class _HistoryService {
|
|
|
28381
28448
|
return this._quotaPercent === null || Date.now() - this._quotaFetchedAt > ttlMs;
|
|
28382
28449
|
}
|
|
28383
28450
|
get projectDir() {
|
|
28384
|
-
return this.runtime.resolveHistoryDir(this.cwd) ?? path70.join(
|
|
28451
|
+
return this.runtime.resolveHistoryDir(this.cwd) ?? path70.join(os54.homedir(), ".claude", "projects", encodeCwd(this.cwd));
|
|
28385
28452
|
}
|
|
28386
28453
|
/** Set the current Claude conversation ID (extracted from /cost command or session start) */
|
|
28387
28454
|
setCurrentConversationId(id) {
|
|
@@ -28809,7 +28876,7 @@ var HistoryService = class _HistoryService {
|
|
|
28809
28876
|
var import_node_child_process29 = require("child_process");
|
|
28810
28877
|
var fs66 = __toESM(require("fs/promises"));
|
|
28811
28878
|
var fsSync = __toESM(require("fs"));
|
|
28812
|
-
var
|
|
28879
|
+
var os56 = __toESM(require("os"));
|
|
28813
28880
|
var path72 = __toESM(require("path"));
|
|
28814
28881
|
var import_node_stream = require("stream");
|
|
28815
28882
|
|
|
@@ -32837,7 +32904,7 @@ function createIdleTimeout(idleMs, makeError, activeIdleMs = idleMs) {
|
|
|
32837
32904
|
|
|
32838
32905
|
// src/agents/acp/internal-paths.ts
|
|
32839
32906
|
var path71 = __toESM(require("path"));
|
|
32840
|
-
var
|
|
32907
|
+
var os55 = __toESM(require("os"));
|
|
32841
32908
|
var INTERNAL_TOKENS = [".codeam", "house-claude"];
|
|
32842
32909
|
var SELF_HOSTED_WORKSPACE_RE = /\.codeam[/\\]self-hosted/gi;
|
|
32843
32910
|
function textReferencesInternal(text) {
|
|
@@ -32845,7 +32912,7 @@ function textReferencesInternal(text) {
|
|
|
32845
32912
|
const scrubbed = text.replace(SELF_HOSTED_WORKSPACE_RE, " ");
|
|
32846
32913
|
return INTERNAL_TOKENS.some((t2) => scrubbed.includes(t2));
|
|
32847
32914
|
}
|
|
32848
|
-
function pathIsInternal(p2, homeDir2 =
|
|
32915
|
+
function pathIsInternal(p2, homeDir2 = os55.homedir()) {
|
|
32849
32916
|
if (!p2) return false;
|
|
32850
32917
|
const abs = path71.resolve(p2);
|
|
32851
32918
|
const home = path71.resolve(homeDir2);
|
|
@@ -33893,7 +33960,7 @@ function applyLineRange(content, line, limit) {
|
|
|
33893
33960
|
return { content: lines.slice(start2, end).join("\n") };
|
|
33894
33961
|
}
|
|
33895
33962
|
function knownAgentBinaryDirs() {
|
|
33896
|
-
const home =
|
|
33963
|
+
const home = os56.homedir();
|
|
33897
33964
|
const out2 = [];
|
|
33898
33965
|
out2.push("/tmp/codeam-node20/bin");
|
|
33899
33966
|
for (const root of [
|
|
@@ -34420,10 +34487,10 @@ function commonPrefixLength(a, b) {
|
|
|
34420
34487
|
// src/agents/acp/onboarding.ts
|
|
34421
34488
|
var import_child_process27 = require("child_process");
|
|
34422
34489
|
var fs67 = __toESM(require("fs"));
|
|
34423
|
-
var
|
|
34490
|
+
var os57 = __toESM(require("os"));
|
|
34424
34491
|
var path73 = __toESM(require("path"));
|
|
34425
34492
|
var _onboardingSeam = {
|
|
34426
|
-
markerPath: (sessionId) => path73.join(
|
|
34493
|
+
markerPath: (sessionId) => path73.join(os57.homedir(), ".codeam", "welcomed", `${sessionId}.done`),
|
|
34427
34494
|
exists: (p2) => fs67.existsSync(p2),
|
|
34428
34495
|
write: (p2) => {
|
|
34429
34496
|
fs67.mkdirSync(path73.dirname(p2), { recursive: true });
|
|
@@ -36297,8 +36364,8 @@ function buildAcpPromptBlocks(payload) {
|
|
|
36297
36364
|
// src/agents/agent-standard.ts
|
|
36298
36365
|
var fs74 = __toESM(require("fs"));
|
|
36299
36366
|
var path80 = __toESM(require("path"));
|
|
36300
|
-
var
|
|
36301
|
-
function ensureAgentStandard(homeDir2 =
|
|
36367
|
+
var os58 = __toESM(require("os"));
|
|
36368
|
+
function ensureAgentStandard(homeDir2 = os58.homedir()) {
|
|
36302
36369
|
try {
|
|
36303
36370
|
const file = path80.join(homeDir2, ".claude", "CLAUDE.md");
|
|
36304
36371
|
let existing = "";
|
|
@@ -36319,7 +36386,7 @@ ${AGENT_STANDARD_BLOCK}
|
|
|
36319
36386
|
}
|
|
36320
36387
|
var _agentStandardSeam = {
|
|
36321
36388
|
isLocalSession: () => isLocalSession(),
|
|
36322
|
-
markerPath: (sessionId) => path80.join(
|
|
36389
|
+
markerPath: (sessionId) => path80.join(os58.homedir(), ".codeam", "agent-standard", `${sessionId}.done`),
|
|
36323
36390
|
exists: (p2) => fs74.existsSync(p2),
|
|
36324
36391
|
write: (p2) => {
|
|
36325
36392
|
fs74.mkdirSync(path80.dirname(p2), { recursive: true });
|
|
@@ -38994,7 +39061,7 @@ function startClaudeCredentialSync(opts) {
|
|
|
38994
39061
|
// src/beads/workflow-hint.ts
|
|
38995
39062
|
var fs75 = __toESM(require("fs"));
|
|
38996
39063
|
var path81 = __toESM(require("path"));
|
|
38997
|
-
var
|
|
39064
|
+
var os59 = __toESM(require("os"));
|
|
38998
39065
|
var BEADS_HINT_MARKER = "<!-- codeam:beads-workflow -->";
|
|
38999
39066
|
var BEADS_HINT = `${BEADS_HINT_MARKER}
|
|
39000
39067
|
# Beads (bd) \u2014 task tracking + persistent memory (ALWAYS use it)
|
|
@@ -39008,7 +39075,7 @@ This environment uses **bd (beads)** for issue/task tracking and persistent memo
|
|
|
39008
39075
|
- \`bd ready\` (available work) \xB7 \`bd show <id>\` \xB7 \`bd update <id> --claim\` \xB7 \`bd close <id>\`.
|
|
39009
39076
|
- Use \`bd remember "..."\` for persistent knowledge \u2014 do NOT use MEMORY.md files.
|
|
39010
39077
|
${BEADS_HINT_MARKER}`;
|
|
39011
|
-
function ensureBeadsWorkflowHint(homeDir2 =
|
|
39078
|
+
function ensureBeadsWorkflowHint(homeDir2 = os59.homedir()) {
|
|
39012
39079
|
try {
|
|
39013
39080
|
const file = path81.join(homeDir2, ".claude", "CLAUDE.md");
|
|
39014
39081
|
let existing = "";
|
|
@@ -39761,12 +39828,12 @@ function keepDeviceAwake(deps = {}) {
|
|
|
39761
39828
|
|
|
39762
39829
|
// src/agents/claude/onboarding.ts
|
|
39763
39830
|
var fs77 = __toESM(require("fs"));
|
|
39764
|
-
var
|
|
39831
|
+
var os61 = __toESM(require("os"));
|
|
39765
39832
|
var path82 = __toESM(require("path"));
|
|
39766
39833
|
var ONBOARDING_VERSION_SENTINEL = "9999.0.0";
|
|
39767
39834
|
function ensureClaudeOnboarded(cwd) {
|
|
39768
39835
|
try {
|
|
39769
|
-
const file = path82.join(
|
|
39836
|
+
const file = path82.join(os61.homedir(), ".claude.json");
|
|
39770
39837
|
let config = {};
|
|
39771
39838
|
try {
|
|
39772
39839
|
config = JSON.parse(fs77.readFileSync(file, "utf8"));
|
|
@@ -42675,9 +42742,9 @@ function checkSessions() {
|
|
|
42675
42742
|
}
|
|
42676
42743
|
}
|
|
42677
42744
|
function checkAgentBinaries() {
|
|
42678
|
-
const
|
|
42745
|
+
const os64 = createOsStrategy();
|
|
42679
42746
|
return getEnabledAgents().map((meta) => {
|
|
42680
|
-
const found =
|
|
42747
|
+
const found = os64.findInPath(meta.binaryName);
|
|
42681
42748
|
return {
|
|
42682
42749
|
id: `agent-${meta.id}`,
|
|
42683
42750
|
label: `Agent binary: ${meta.displayName} (${meta.binaryName})`,
|
|
@@ -42741,7 +42808,7 @@ function checkChokidar() {
|
|
|
42741
42808
|
}
|
|
42742
42809
|
async function doctor(args2 = []) {
|
|
42743
42810
|
const json = args2.includes("--json");
|
|
42744
|
-
const cliVersion = true ? "2.
|
|
42811
|
+
const cliVersion = true ? "2.62.0" : "0.0.0-dev";
|
|
42745
42812
|
const apiBase2 = resolveApiBaseUrl();
|
|
42746
42813
|
const diagnosticId = (0, import_node_crypto13.randomUUID)();
|
|
42747
42814
|
log.info("doctor", `run id=${diagnosticId} cli=${cliVersion}`);
|
|
@@ -43132,7 +43199,7 @@ async function mcpRun(args2) {
|
|
|
43132
43199
|
// src/commands/version.ts
|
|
43133
43200
|
var import_picocolors15 = __toESM(require("picocolors"));
|
|
43134
43201
|
function version2() {
|
|
43135
|
-
const v = true ? "2.
|
|
43202
|
+
const v = true ? "2.62.0" : "unknown";
|
|
43136
43203
|
console.log(`${import_picocolors15.default.bold("codeam-cli")} ${import_picocolors15.default.cyan(v)}`);
|
|
43137
43204
|
}
|
|
43138
43205
|
|
|
@@ -43281,10 +43348,10 @@ var EXIT_CODE_NAMES = {
|
|
|
43281
43348
|
};
|
|
43282
43349
|
|
|
43283
43350
|
// src/index.ts
|
|
43284
|
-
var
|
|
43351
|
+
var os63 = __toESM(require("os"));
|
|
43285
43352
|
if (!process.env.HOME) {
|
|
43286
43353
|
try {
|
|
43287
|
-
const home =
|
|
43354
|
+
const home = os63.homedir();
|
|
43288
43355
|
if (home) process.env.HOME = home;
|
|
43289
43356
|
} catch {
|
|
43290
43357
|
}
|