codeam-cli 2.60.55 → 2.60.57
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 +12 -0
- package/dist/index.js +375 -276
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -845,11 +845,11 @@ function quiet(fn) {
|
|
|
845
845
|
log.debug(TAG, "ignored sync error", err);
|
|
846
846
|
}
|
|
847
847
|
}
|
|
848
|
-
function rmIfExistsQuiet(
|
|
848
|
+
function rmIfExistsQuiet(path74) {
|
|
849
849
|
try {
|
|
850
|
-
fs2.rmSync(
|
|
850
|
+
fs2.rmSync(path74, { force: true });
|
|
851
851
|
} catch (err) {
|
|
852
|
-
log.debug(TAG, `rmIfExists failed for ${
|
|
852
|
+
log.debug(TAG, `rmIfExists failed for ${path74}`, err);
|
|
853
853
|
}
|
|
854
854
|
}
|
|
855
855
|
function killQuiet(target, signal = "SIGTERM") {
|
|
@@ -995,9 +995,9 @@ var _default = makeConfig();
|
|
|
995
995
|
var { getConfig, ensurePluginId, addSession, removeSession, setActiveSession, getActiveSession, getActiveSessionForAgent, setDisable1mContext, clearAll, saveCliConfig, loadCliConfig } = _default;
|
|
996
996
|
|
|
997
997
|
// src/commands/pair-auto.ts
|
|
998
|
-
var
|
|
999
|
-
var
|
|
1000
|
-
var
|
|
998
|
+
var fs56 = __toESM(require("fs"));
|
|
999
|
+
var os45 = __toESM(require("os"));
|
|
1000
|
+
var path60 = __toESM(require("path"));
|
|
1001
1001
|
var import_crypto4 = require("crypto");
|
|
1002
1002
|
|
|
1003
1003
|
// src/services/telemetry.service.ts
|
|
@@ -1033,8 +1033,8 @@ function createGetModuleFromFilename(basePath = process.argv[1] ? (0, import_pat
|
|
|
1033
1033
|
return decodedFile;
|
|
1034
1034
|
};
|
|
1035
1035
|
}
|
|
1036
|
-
function normalizeWindowsPath(
|
|
1037
|
-
return
|
|
1036
|
+
function normalizeWindowsPath(path74) {
|
|
1037
|
+
return path74.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
|
|
1038
1038
|
}
|
|
1039
1039
|
|
|
1040
1040
|
// ../../node_modules/@posthog/core/dist/featureFlagUtils.mjs
|
|
@@ -3514,9 +3514,9 @@ async function addSourceContext(frames) {
|
|
|
3514
3514
|
LRU_FILE_CONTENTS_CACHE.reduce();
|
|
3515
3515
|
return frames;
|
|
3516
3516
|
}
|
|
3517
|
-
function getContextLinesFromFile(
|
|
3517
|
+
function getContextLinesFromFile(path74, ranges, output) {
|
|
3518
3518
|
return new Promise((resolve7) => {
|
|
3519
|
-
const stream = (0, import_node_fs.createReadStream)(
|
|
3519
|
+
const stream = (0, import_node_fs.createReadStream)(path74);
|
|
3520
3520
|
const lineReaded = (0, import_node_readline.createInterface)({
|
|
3521
3521
|
input: stream
|
|
3522
3522
|
});
|
|
@@ -3531,7 +3531,7 @@ function getContextLinesFromFile(path73, ranges, output) {
|
|
|
3531
3531
|
let rangeStart = range[0];
|
|
3532
3532
|
let rangeEnd = range[1];
|
|
3533
3533
|
function onStreamError() {
|
|
3534
|
-
LRU_FILE_CONTENTS_FS_READ_FAILED.set(
|
|
3534
|
+
LRU_FILE_CONTENTS_FS_READ_FAILED.set(path74, 1);
|
|
3535
3535
|
lineReaded.close();
|
|
3536
3536
|
lineReaded.removeAllListeners();
|
|
3537
3537
|
destroyStreamAndResolve();
|
|
@@ -3592,8 +3592,8 @@ function clearLineContext(frame) {
|
|
|
3592
3592
|
delete frame.context_line;
|
|
3593
3593
|
delete frame.post_context;
|
|
3594
3594
|
}
|
|
3595
|
-
function shouldSkipContextLinesForFile(
|
|
3596
|
-
return
|
|
3595
|
+
function shouldSkipContextLinesForFile(path74) {
|
|
3596
|
+
return path74.startsWith("node:") || path74.endsWith(".min.js") || path74.endsWith(".min.cjs") || path74.endsWith(".min.mjs") || path74.startsWith("data:");
|
|
3597
3597
|
}
|
|
3598
3598
|
function shouldSkipContextLinesForFrame(frame) {
|
|
3599
3599
|
if (void 0 !== frame.lineno && frame.lineno > MAX_CONTEXTLINES_LINENO) return true;
|
|
@@ -5747,7 +5747,7 @@ function readAnonId() {
|
|
|
5747
5747
|
}
|
|
5748
5748
|
function superProperties() {
|
|
5749
5749
|
return {
|
|
5750
|
-
cliVersion: true ? "2.60.
|
|
5750
|
+
cliVersion: true ? "2.60.57" : "0.0.0-dev",
|
|
5751
5751
|
nodeVersion: process.version,
|
|
5752
5752
|
platform: process.platform,
|
|
5753
5753
|
arch: process.arch,
|
|
@@ -5928,7 +5928,7 @@ var os4 = __toESM(require("os"));
|
|
|
5928
5928
|
// package.json
|
|
5929
5929
|
var package_default = {
|
|
5930
5930
|
name: "codeam-cli",
|
|
5931
|
-
version: "2.60.
|
|
5931
|
+
version: "2.60.57",
|
|
5932
5932
|
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.",
|
|
5933
5933
|
type: "commonjs",
|
|
5934
5934
|
main: "dist/index.js",
|
|
@@ -7037,7 +7037,7 @@ var CommandRelayService = class {
|
|
|
7037
7037
|
// fresh + clear the "CLI update available" banner after a self-update
|
|
7038
7038
|
// (a codespace that reinstalls @latest reconnects via heartbeat, not
|
|
7039
7039
|
// pair/reconnect). Older backends ignore the extra field.
|
|
7040
|
-
..."2.60.
|
|
7040
|
+
..."2.60.57" ? { ideVersion: "2.60.57" } : {}
|
|
7041
7041
|
}).then(() => log.trace("relay", `heartbeat ok online=${online}`)).catch((err) => log.trace("relay", `heartbeat failed online=${online}`, err));
|
|
7042
7042
|
}
|
|
7043
7043
|
/**
|
|
@@ -7264,10 +7264,10 @@ var WINDOWS_LEGACY_JUNCTIONS = [
|
|
|
7264
7264
|
/[\\/]Start Menu([\\/]|$)/i,
|
|
7265
7265
|
/[\\/]Templates([\\/]|$)/i
|
|
7266
7266
|
];
|
|
7267
|
-
function isUnsafeWindowsWatchRoot(dir,
|
|
7267
|
+
function isUnsafeWindowsWatchRoot(dir, homedir44) {
|
|
7268
7268
|
const norm = (p2) => p2.replace(/\//g, "\\").replace(/\\+$/, "").toLowerCase();
|
|
7269
7269
|
const cwd = norm(dir);
|
|
7270
|
-
const home = norm(
|
|
7270
|
+
const home = norm(homedir44);
|
|
7271
7271
|
if (cwd === home) return true;
|
|
7272
7272
|
if (/^[a-z]:$/.test(cwd)) return true;
|
|
7273
7273
|
const sysRoots = [
|
|
@@ -8411,9 +8411,9 @@ function closeAllTerminals() {
|
|
|
8411
8411
|
}
|
|
8412
8412
|
|
|
8413
8413
|
// src/commands/start/handlers.ts
|
|
8414
|
-
var
|
|
8415
|
-
var
|
|
8416
|
-
var
|
|
8414
|
+
var fs55 = __toESM(require("fs"));
|
|
8415
|
+
var os44 = __toESM(require("os"));
|
|
8416
|
+
var path59 = __toESM(require("path"));
|
|
8417
8417
|
var import_crypto3 = require("crypto");
|
|
8418
8418
|
var import_child_process23 = require("child_process");
|
|
8419
8419
|
|
|
@@ -11870,10 +11870,10 @@ function buildForPlatform(platform3) {
|
|
|
11870
11870
|
var import_node_crypto4 = require("crypto");
|
|
11871
11871
|
|
|
11872
11872
|
// src/agents/claude/resolver.ts
|
|
11873
|
-
function buildClaudeLaunch(extraArgs = [],
|
|
11874
|
-
const found =
|
|
11873
|
+
function buildClaudeLaunch(extraArgs = [], os52 = createOsStrategy()) {
|
|
11874
|
+
const found = os52.findInPath("claude") ?? os52.findInPath("claude-code");
|
|
11875
11875
|
if (!found) return null;
|
|
11876
|
-
return
|
|
11876
|
+
return os52.buildLaunch(found, extraArgs);
|
|
11877
11877
|
}
|
|
11878
11878
|
|
|
11879
11879
|
// src/agents/claude/installer.ts
|
|
@@ -12463,8 +12463,8 @@ var ClaudeRuntimeStrategy = class {
|
|
|
12463
12463
|
meta = getAgent("claude");
|
|
12464
12464
|
mode = "interactive";
|
|
12465
12465
|
os;
|
|
12466
|
-
constructor(
|
|
12467
|
-
this.os =
|
|
12466
|
+
constructor(os52) {
|
|
12467
|
+
this.os = os52;
|
|
12468
12468
|
}
|
|
12469
12469
|
/**
|
|
12470
12470
|
* Claude Code's react-ink TUI enables bracketed-paste mode at
|
|
@@ -13244,8 +13244,8 @@ function codexCredentialLocator() {
|
|
|
13244
13244
|
function codexLoginLauncher() {
|
|
13245
13245
|
return {
|
|
13246
13246
|
async ensureInstalled() {
|
|
13247
|
-
const
|
|
13248
|
-
return
|
|
13247
|
+
const os52 = createOsStrategy();
|
|
13248
|
+
return os52.findInPath("codex") !== null;
|
|
13249
13249
|
},
|
|
13250
13250
|
launch() {
|
|
13251
13251
|
return (0, import_node_child_process4.spawn)("codex", ["login"], { stdio: "inherit" });
|
|
@@ -13268,8 +13268,8 @@ var CodexRuntimeStrategy = class {
|
|
|
13268
13268
|
meta = getAgent("codex");
|
|
13269
13269
|
mode = "interactive";
|
|
13270
13270
|
os;
|
|
13271
|
-
constructor(
|
|
13272
|
-
this.os =
|
|
13271
|
+
constructor(os52) {
|
|
13272
|
+
this.os = os52;
|
|
13273
13273
|
}
|
|
13274
13274
|
async prepareLaunch() {
|
|
13275
13275
|
let binary = this.os.findInPath("codex");
|
|
@@ -13378,12 +13378,12 @@ var CodexRuntimeStrategy = class {
|
|
|
13378
13378
|
});
|
|
13379
13379
|
}
|
|
13380
13380
|
};
|
|
13381
|
-
function resolveNpm(
|
|
13382
|
-
return
|
|
13381
|
+
function resolveNpm(os52) {
|
|
13382
|
+
return os52.id === "win32" ? "npm.cmd" : "npm";
|
|
13383
13383
|
}
|
|
13384
|
-
async function installCodexViaNpm(
|
|
13384
|
+
async function installCodexViaNpm(os52) {
|
|
13385
13385
|
return new Promise((resolve7, reject) => {
|
|
13386
|
-
const proc = (0, import_node_child_process5.spawn)(resolveNpm(
|
|
13386
|
+
const proc = (0, import_node_child_process5.spawn)(resolveNpm(os52), ["install", "-g", "@openai/codex"], {
|
|
13387
13387
|
stdio: "inherit"
|
|
13388
13388
|
});
|
|
13389
13389
|
proc.on("close", (code) => {
|
|
@@ -13400,16 +13400,16 @@ async function installCodexViaNpm(os51) {
|
|
|
13400
13400
|
});
|
|
13401
13401
|
});
|
|
13402
13402
|
}
|
|
13403
|
-
function augmentNpmGlobalBin(
|
|
13403
|
+
function augmentNpmGlobalBin(os52) {
|
|
13404
13404
|
try {
|
|
13405
|
-
const result = (0, import_node_child_process5.spawnSync)(resolveNpm(
|
|
13405
|
+
const result = (0, import_node_child_process5.spawnSync)(resolveNpm(os52), ["prefix", "-g"], {
|
|
13406
13406
|
stdio: ["ignore", "pipe", "ignore"]
|
|
13407
13407
|
});
|
|
13408
13408
|
if (result.status !== 0) return;
|
|
13409
13409
|
const prefix = result.stdout.toString().trim();
|
|
13410
13410
|
if (!prefix) return;
|
|
13411
|
-
const binDir =
|
|
13412
|
-
|
|
13411
|
+
const binDir = os52.id === "win32" ? prefix : path24.join(prefix, "bin");
|
|
13412
|
+
os52.augmentPath([binDir]);
|
|
13413
13413
|
} catch {
|
|
13414
13414
|
}
|
|
13415
13415
|
}
|
|
@@ -13493,9 +13493,9 @@ var import_node_child_process8 = require("child_process");
|
|
|
13493
13493
|
// src/agents/coderabbit/installer.ts
|
|
13494
13494
|
var import_node_child_process6 = require("child_process");
|
|
13495
13495
|
var INSTALL_URL = "https://cli.coderabbit.ai/install.sh";
|
|
13496
|
-
async function ensureCoderabbitInstalled(
|
|
13497
|
-
if (
|
|
13498
|
-
if (
|
|
13496
|
+
async function ensureCoderabbitInstalled(os52) {
|
|
13497
|
+
if (os52.findInPath("coderabbit")) return true;
|
|
13498
|
+
if (os52.id === "win32") {
|
|
13499
13499
|
console.error(
|
|
13500
13500
|
"\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"
|
|
13501
13501
|
);
|
|
@@ -13510,8 +13510,8 @@ async function ensureCoderabbitInstalled(os51) {
|
|
|
13510
13510
|
proc.on("error", () => resolve7(false));
|
|
13511
13511
|
});
|
|
13512
13512
|
if (!ok) return false;
|
|
13513
|
-
|
|
13514
|
-
return
|
|
13513
|
+
os52.augmentPath([`${os52.homeDir()}/.local/bin`, "/opt/homebrew/bin"]);
|
|
13514
|
+
return os52.findInPath("coderabbit") !== null;
|
|
13515
13515
|
}
|
|
13516
13516
|
|
|
13517
13517
|
// src/agents/coderabbit/link.ts
|
|
@@ -13546,10 +13546,10 @@ function coderabbitCredentialLocator() {
|
|
|
13546
13546
|
validate: validateNonEmptyCredential
|
|
13547
13547
|
};
|
|
13548
13548
|
}
|
|
13549
|
-
function coderabbitLoginLauncher(
|
|
13549
|
+
function coderabbitLoginLauncher(os52) {
|
|
13550
13550
|
return {
|
|
13551
13551
|
async ensureInstalled() {
|
|
13552
|
-
return ensureCoderabbitInstalled(
|
|
13552
|
+
return ensureCoderabbitInstalled(os52);
|
|
13553
13553
|
},
|
|
13554
13554
|
launch() {
|
|
13555
13555
|
return (0, import_node_child_process7.spawn)("coderabbit", ["auth", "login"], { stdio: "inherit" });
|
|
@@ -13605,8 +13605,8 @@ function pickLine(obj) {
|
|
|
13605
13605
|
function toHunk(raw, groupSeverity) {
|
|
13606
13606
|
if (!raw || typeof raw !== "object") return null;
|
|
13607
13607
|
const o = raw;
|
|
13608
|
-
const
|
|
13609
|
-
if (!
|
|
13608
|
+
const path74 = asString(pick(o, ["file_path", "filePath", "file", "path", "filename", "fileName"])) ?? asString(pick(o, ["location"])?.path);
|
|
13609
|
+
if (!path74) return null;
|
|
13610
13610
|
const message = asString(
|
|
13611
13611
|
pick(o, [
|
|
13612
13612
|
"comment",
|
|
@@ -13623,7 +13623,7 @@ function toHunk(raw, groupSeverity) {
|
|
|
13623
13623
|
const severity = normSeverity(pick(o, ["severity", "level", "priority", "impact"])) ?? normSeverity(groupSeverity);
|
|
13624
13624
|
const locObj = pick(o, ["location"]) ?? o;
|
|
13625
13625
|
return {
|
|
13626
|
-
path:
|
|
13626
|
+
path: path74.trim(),
|
|
13627
13627
|
line: pickLine(o) ?? pickLine(locObj),
|
|
13628
13628
|
severity,
|
|
13629
13629
|
message: (title && message ? `${title}: ${message}` : title || message).trim() || "(no message)"
|
|
@@ -13706,10 +13706,10 @@ function parsePlain(stdout) {
|
|
|
13706
13706
|
for (const line of stdout.split(/\r?\n/)) {
|
|
13707
13707
|
const m = line.match(HUNK_LINE_RE);
|
|
13708
13708
|
if (!m) continue;
|
|
13709
|
-
const [,
|
|
13710
|
-
if (!
|
|
13709
|
+
const [, path74, lineNo, sevToken, message] = m;
|
|
13710
|
+
if (!path74 || !lineNo || !message) continue;
|
|
13711
13711
|
hunks.push({
|
|
13712
|
-
path:
|
|
13712
|
+
path: path74.trim(),
|
|
13713
13713
|
line: Number(lineNo),
|
|
13714
13714
|
severity: sevToken ? SEVERITY_MAP[sevToken.toLowerCase()] : void 0,
|
|
13715
13715
|
message: message.trim().replace(/^[*-]\s+/, "")
|
|
@@ -13769,8 +13769,8 @@ var CoderabbitRuntimeStrategy = class {
|
|
|
13769
13769
|
meta = getAgent("coderabbit");
|
|
13770
13770
|
mode = "batch";
|
|
13771
13771
|
os;
|
|
13772
|
-
constructor(
|
|
13773
|
-
this.os =
|
|
13772
|
+
constructor(os52) {
|
|
13773
|
+
this.os = os52;
|
|
13774
13774
|
}
|
|
13775
13775
|
getDefaultArgs() {
|
|
13776
13776
|
return ["review", "--agent"];
|
|
@@ -14041,10 +14041,10 @@ function cursorCredentialLocator() {
|
|
|
14041
14041
|
validate: validateNonEmptyCredential
|
|
14042
14042
|
};
|
|
14043
14043
|
}
|
|
14044
|
-
function cursorLoginLauncher(
|
|
14044
|
+
function cursorLoginLauncher(os52) {
|
|
14045
14045
|
return {
|
|
14046
14046
|
async ensureInstalled() {
|
|
14047
|
-
if (
|
|
14047
|
+
if (os52.findInPath("cursor-agent")) return true;
|
|
14048
14048
|
console.error(
|
|
14049
14049
|
"\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"
|
|
14050
14050
|
);
|
|
@@ -14108,8 +14108,8 @@ var CursorRuntimeStrategy = class {
|
|
|
14108
14108
|
meta = getAgent("cursor");
|
|
14109
14109
|
mode = "interactive";
|
|
14110
14110
|
os;
|
|
14111
|
-
constructor(
|
|
14112
|
-
this.os =
|
|
14111
|
+
constructor(os52) {
|
|
14112
|
+
this.os = os52;
|
|
14113
14113
|
}
|
|
14114
14114
|
async prepareLaunch() {
|
|
14115
14115
|
const binary = this.os.findInPath("cursor-agent");
|
|
@@ -14325,10 +14325,10 @@ function aiderCredentialLocator() {
|
|
|
14325
14325
|
validate: validateNonEmptyCredential
|
|
14326
14326
|
};
|
|
14327
14327
|
}
|
|
14328
|
-
function aiderLoginLauncher(
|
|
14328
|
+
function aiderLoginLauncher(os52) {
|
|
14329
14329
|
return {
|
|
14330
14330
|
async ensureInstalled() {
|
|
14331
|
-
if (
|
|
14331
|
+
if (os52.findInPath("aider")) return true;
|
|
14332
14332
|
console.error(
|
|
14333
14333
|
"\n \u2717 aider binary not on PATH.\n Install Aider:\n pip install aider-chat\n then re-run `codeam link aider`.\n"
|
|
14334
14334
|
);
|
|
@@ -14338,7 +14338,7 @@ function aiderLoginLauncher(os51) {
|
|
|
14338
14338
|
console.error(
|
|
14339
14339
|
"\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"
|
|
14340
14340
|
);
|
|
14341
|
-
return (0, import_node_child_process11.spawn)(
|
|
14341
|
+
return (0, import_node_child_process11.spawn)(os52.id === "win32" ? "cmd.exe" : "sh", os52.id === "win32" ? ["/c", "exit", "0"] : ["-c", "exit 0"], {
|
|
14342
14342
|
stdio: "ignore"
|
|
14343
14343
|
});
|
|
14344
14344
|
}
|
|
@@ -14410,8 +14410,8 @@ var AiderRuntimeStrategy = class {
|
|
|
14410
14410
|
meta = getAgent("aider");
|
|
14411
14411
|
mode = "interactive";
|
|
14412
14412
|
os;
|
|
14413
|
-
constructor(
|
|
14414
|
-
this.os =
|
|
14413
|
+
constructor(os52) {
|
|
14414
|
+
this.os = os52;
|
|
14415
14415
|
}
|
|
14416
14416
|
async prepareLaunch() {
|
|
14417
14417
|
const binary = this.os.findInPath("aider");
|
|
@@ -14543,8 +14543,8 @@ function geminiCredentialLocator() {
|
|
|
14543
14543
|
function geminiLoginLauncher() {
|
|
14544
14544
|
return {
|
|
14545
14545
|
async ensureInstalled() {
|
|
14546
|
-
const
|
|
14547
|
-
return
|
|
14546
|
+
const os52 = createOsStrategy();
|
|
14547
|
+
return os52.findInPath("gemini") !== null;
|
|
14548
14548
|
},
|
|
14549
14549
|
launch() {
|
|
14550
14550
|
return (0, import_node_child_process12.spawn)("gemini", ["auth", "login"], { stdio: "inherit" });
|
|
@@ -14734,8 +14734,8 @@ var GeminiRuntimeStrategy = class {
|
|
|
14734
14734
|
meta = getAgent("gemini");
|
|
14735
14735
|
mode = "interactive";
|
|
14736
14736
|
os;
|
|
14737
|
-
constructor(
|
|
14738
|
-
this.os =
|
|
14737
|
+
constructor(os52) {
|
|
14738
|
+
this.os = os52;
|
|
14739
14739
|
}
|
|
14740
14740
|
async prepareLaunch() {
|
|
14741
14741
|
const binary = this.os.findInPath("gemini");
|
|
@@ -15026,8 +15026,8 @@ var KimiRuntimeStrategy = class {
|
|
|
15026
15026
|
meta = getAgent("kimi");
|
|
15027
15027
|
mode = "interactive";
|
|
15028
15028
|
os;
|
|
15029
|
-
constructor(
|
|
15030
|
-
this.os =
|
|
15029
|
+
constructor(os52) {
|
|
15030
|
+
this.os = os52;
|
|
15031
15031
|
}
|
|
15032
15032
|
async prepareLaunch() {
|
|
15033
15033
|
const binary = this.os.findInPath("kimi");
|
|
@@ -15140,19 +15140,19 @@ var KimiRuntimeStrategy = class {
|
|
|
15140
15140
|
|
|
15141
15141
|
// src/agents/registry.ts
|
|
15142
15142
|
var runtimeBuilders = {
|
|
15143
|
-
claude: (
|
|
15144
|
-
codex: (
|
|
15145
|
-
coderabbit: (
|
|
15146
|
-
cursor: (
|
|
15147
|
-
aider: (
|
|
15148
|
-
gemini: (
|
|
15149
|
-
kimi: (
|
|
15143
|
+
claude: (os52) => new ClaudeRuntimeStrategy(os52),
|
|
15144
|
+
codex: (os52) => new CodexRuntimeStrategy(os52),
|
|
15145
|
+
coderabbit: (os52) => new CoderabbitRuntimeStrategy(os52),
|
|
15146
|
+
cursor: (os52) => new CursorRuntimeStrategy(os52),
|
|
15147
|
+
aider: (os52) => new AiderRuntimeStrategy(os52),
|
|
15148
|
+
gemini: (os52) => new GeminiRuntimeStrategy(os52),
|
|
15149
|
+
kimi: (os52) => new KimiRuntimeStrategy(os52)
|
|
15150
15150
|
};
|
|
15151
15151
|
var deployBuilders = {
|
|
15152
15152
|
claude: () => new ClaudeDeployStrategy(),
|
|
15153
15153
|
codex: () => new CodexDeployStrategy()
|
|
15154
15154
|
};
|
|
15155
|
-
function createAgentStrategy(agent,
|
|
15155
|
+
function createAgentStrategy(agent, os52 = createOsStrategy()) {
|
|
15156
15156
|
if (!AGENT_REGISTRY[agent]?.enabled) {
|
|
15157
15157
|
throw new Error(
|
|
15158
15158
|
`Agent "${agent}" is not supported in this codeam-cli version. Upgrade with 'npm i -g codeam-cli@latest'.`
|
|
@@ -15162,10 +15162,10 @@ function createAgentStrategy(agent, os51 = createOsStrategy()) {
|
|
|
15162
15162
|
if (!build) {
|
|
15163
15163
|
throw new Error(`No runtime strategy registered for agent "${agent}"`);
|
|
15164
15164
|
}
|
|
15165
|
-
return build(
|
|
15165
|
+
return build(os52);
|
|
15166
15166
|
}
|
|
15167
|
-
function createInteractiveAgentStrategy(agent,
|
|
15168
|
-
const s = createAgentStrategy(agent,
|
|
15167
|
+
function createInteractiveAgentStrategy(agent, os52 = createOsStrategy()) {
|
|
15168
|
+
const s = createAgentStrategy(agent, os52);
|
|
15169
15169
|
if (s.mode !== "interactive") {
|
|
15170
15170
|
throw new Error(
|
|
15171
15171
|
`Agent "${agent}" is a batch agent; use createAgentStrategy + .runOneShot for one-shot reviews.`
|
|
@@ -15701,8 +15701,13 @@ function runCoderabbitOAuthLogin(deps) {
|
|
|
15701
15701
|
if (e.kind === "awaiting_browser") {
|
|
15702
15702
|
setPendingCoderabbitLogin({
|
|
15703
15703
|
deliver: (callbackUrl) => {
|
|
15704
|
-
|
|
15704
|
+
if (/^http:\/\/(127\.0\.0\.1|localhost|\[::1\])/i.test(callbackUrl)) {
|
|
15705
|
+
void fetch(callbackUrl, { signal: AbortSignal.timeout(15e3) }).catch(() => {
|
|
15706
|
+
});
|
|
15707
|
+
} else {
|
|
15708
|
+
child.stdin?.write(`${callbackUrl}
|
|
15705
15709
|
`);
|
|
15710
|
+
}
|
|
15706
15711
|
}
|
|
15707
15712
|
});
|
|
15708
15713
|
} else if (e.kind === "authenticated") {
|
|
@@ -15857,26 +15862,26 @@ function restoreCoderabbitOauthBlob(value) {
|
|
|
15857
15862
|
(0, import_node_fs5.writeFileSync)(path36.join(dir, file), contents, { mode: 384 });
|
|
15858
15863
|
}
|
|
15859
15864
|
async function configureCoderabbit(input, deps = {}) {
|
|
15860
|
-
const
|
|
15865
|
+
const os52 = deps.os ?? createOsStrategy();
|
|
15861
15866
|
const ensureInstalled = deps.ensureInstalled ?? ensureCoderabbitInstalled;
|
|
15862
15867
|
const isLoggedIn = deps.isLoggedIn ?? defaultIsLoggedIn;
|
|
15863
15868
|
const runOAuth = deps.runOAuthLogin ?? runCoderabbitOAuthLogin;
|
|
15864
15869
|
const snapshot = deps.snapshotDir ?? (() => snapshotCredentialDir());
|
|
15865
15870
|
const capture2 = deps.captureCredential ?? ((b) => diffCapturedCredential(b));
|
|
15866
15871
|
const loginWithApiKey = deps.loginWithApiKey ?? defaultLoginWithApiKey;
|
|
15867
|
-
const home =
|
|
15868
|
-
|
|
15869
|
-
|
|
15872
|
+
const home = os52.homeDir();
|
|
15873
|
+
os52.augmentPath(
|
|
15874
|
+
os52.id === "win32" ? [
|
|
15870
15875
|
path36.join(home, ".local", "bin"),
|
|
15871
15876
|
path36.join(process.env.APPDATA ?? path36.join(home, "AppData", "Roaming"), "npm"),
|
|
15872
15877
|
path36.join(home, "scoop", "shims")
|
|
15873
15878
|
] : [path36.join(home, ".local", "bin"), "/opt/homebrew/bin", "/usr/local/bin"]
|
|
15874
15879
|
);
|
|
15875
|
-
const installed2 =
|
|
15880
|
+
const installed2 = os52.findInPath("coderabbit") !== null;
|
|
15876
15881
|
const base = () => ({
|
|
15877
15882
|
action: input.action,
|
|
15878
15883
|
supported: true,
|
|
15879
|
-
installed:
|
|
15884
|
+
installed: os52.findInPath("coderabbit") !== null,
|
|
15880
15885
|
loggedIn: false
|
|
15881
15886
|
});
|
|
15882
15887
|
if (input.action === "status") {
|
|
@@ -15890,7 +15895,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
15890
15895
|
const key = (input.apiKey ?? "").trim();
|
|
15891
15896
|
if (!key) return { ...res2, error: "No API key provided" };
|
|
15892
15897
|
if (!res2.installed) {
|
|
15893
|
-
const ok = await ensureInstalled(
|
|
15898
|
+
const ok = await ensureInstalled(os52);
|
|
15894
15899
|
res2.installed = ok;
|
|
15895
15900
|
if (!ok) return { ...res2, error: "CodeRabbit CLI could not be installed" };
|
|
15896
15901
|
}
|
|
@@ -15914,7 +15919,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
15914
15919
|
}
|
|
15915
15920
|
if (!res2.installed) {
|
|
15916
15921
|
deps.onEvent?.({ kind: "installing" });
|
|
15917
|
-
const ok = await ensureInstalled(
|
|
15922
|
+
const ok = await ensureInstalled(os52);
|
|
15918
15923
|
res2.installed = ok;
|
|
15919
15924
|
if (!ok) return { ...res2, error: "CodeRabbit CLI could not be installed" };
|
|
15920
15925
|
}
|
|
@@ -15944,7 +15949,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
15944
15949
|
const res2 = base();
|
|
15945
15950
|
if (!installed2) {
|
|
15946
15951
|
deps.onEvent?.({ kind: "installing" });
|
|
15947
|
-
const ok = await ensureInstalled(
|
|
15952
|
+
const ok = await ensureInstalled(os52);
|
|
15948
15953
|
res2.installed = ok;
|
|
15949
15954
|
if (!ok) return { ...res2, error: "CodeRabbit CLI could not be installed" };
|
|
15950
15955
|
}
|
|
@@ -15984,7 +15989,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
15984
15989
|
}
|
|
15985
15990
|
const res = base();
|
|
15986
15991
|
if (!res.installed) {
|
|
15987
|
-
const ok = await ensureInstalled(
|
|
15992
|
+
const ok = await ensureInstalled(os52);
|
|
15988
15993
|
res.installed = ok;
|
|
15989
15994
|
if (!ok) return { ...res, error: "CodeRabbit CLI is not installed" };
|
|
15990
15995
|
}
|
|
@@ -17609,7 +17614,7 @@ async function autoUpgradeBeforeCriticalCommand() {
|
|
|
17609
17614
|
if (process.env.NODE_ENV === "test") return;
|
|
17610
17615
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
17611
17616
|
if (process.env.CI) return;
|
|
17612
|
-
const current = true ? "2.60.
|
|
17617
|
+
const current = true ? "2.60.57" : null;
|
|
17613
17618
|
if (!current) return;
|
|
17614
17619
|
const cache = readCache();
|
|
17615
17620
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
|
@@ -17626,7 +17631,7 @@ function checkForUpdates() {
|
|
|
17626
17631
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
17627
17632
|
if (process.env.CI) return;
|
|
17628
17633
|
if (!process.stdout.isTTY) return;
|
|
17629
|
-
const current = true ? "2.60.
|
|
17634
|
+
const current = true ? "2.60.57" : null;
|
|
17630
17635
|
if (!current) return;
|
|
17631
17636
|
const cache = readCache();
|
|
17632
17637
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
|
@@ -17646,7 +17651,7 @@ var SELF_UPDATE_INTERVAL_MS = 60 * 60 * 1e3;
|
|
|
17646
17651
|
var SELF_UPDATE_VIEW_TIMEOUT_MS = 3e4;
|
|
17647
17652
|
var SELF_UPDATE_INSTALL_TIMEOUT_MS = 18e4;
|
|
17648
17653
|
function currentCliVersion() {
|
|
17649
|
-
return true ? "2.60.
|
|
17654
|
+
return true ? "2.60.57" : null;
|
|
17650
17655
|
}
|
|
17651
17656
|
function runCmd(cmd, args2, timeoutMs) {
|
|
17652
17657
|
return new Promise((resolve7) => {
|
|
@@ -18674,6 +18679,85 @@ function makeRealApplyBudgetDeps() {
|
|
|
18674
18679
|
};
|
|
18675
18680
|
}
|
|
18676
18681
|
|
|
18682
|
+
// src/services/preview/port-registry.ts
|
|
18683
|
+
var fs44 = __toESM(require("fs"));
|
|
18684
|
+
var os38 = __toESM(require("os"));
|
|
18685
|
+
var path47 = __toESM(require("path"));
|
|
18686
|
+
function registryPath() {
|
|
18687
|
+
return path47.join(os38.homedir(), ".codeam", "preview-ports.json");
|
|
18688
|
+
}
|
|
18689
|
+
function readRegistry() {
|
|
18690
|
+
try {
|
|
18691
|
+
const raw = fs44.readFileSync(registryPath(), "utf8");
|
|
18692
|
+
const parsed = JSON.parse(raw);
|
|
18693
|
+
if (parsed && typeof parsed === "object") return parsed;
|
|
18694
|
+
} catch {
|
|
18695
|
+
}
|
|
18696
|
+
return {};
|
|
18697
|
+
}
|
|
18698
|
+
function writeRegistry(reg) {
|
|
18699
|
+
try {
|
|
18700
|
+
const file = registryPath();
|
|
18701
|
+
fs44.mkdirSync(path47.dirname(file), { recursive: true });
|
|
18702
|
+
const tmp = `${file}.tmp`;
|
|
18703
|
+
fs44.writeFileSync(tmp, JSON.stringify(reg), "utf8");
|
|
18704
|
+
fs44.renameSync(tmp, file);
|
|
18705
|
+
} catch (err) {
|
|
18706
|
+
log.warn("preview", `port-registry write failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
18707
|
+
}
|
|
18708
|
+
}
|
|
18709
|
+
function recordPreviewPort(port, devPid, sessionId, now) {
|
|
18710
|
+
if (devPid == null) return;
|
|
18711
|
+
const reg = readRegistry();
|
|
18712
|
+
reg[String(port)] = { pgid: devPid, sessionId, ts: now };
|
|
18713
|
+
writeRegistry(reg);
|
|
18714
|
+
}
|
|
18715
|
+
function forgetPreviewPort(port) {
|
|
18716
|
+
const reg = readRegistry();
|
|
18717
|
+
if (reg[String(port)] === void 0) return;
|
|
18718
|
+
delete reg[String(port)];
|
|
18719
|
+
writeRegistry(reg);
|
|
18720
|
+
}
|
|
18721
|
+
function groupAlive(pgid) {
|
|
18722
|
+
try {
|
|
18723
|
+
process.kill(-pgid, 0);
|
|
18724
|
+
return true;
|
|
18725
|
+
} catch (err) {
|
|
18726
|
+
return err.code === "EPERM";
|
|
18727
|
+
}
|
|
18728
|
+
}
|
|
18729
|
+
function reclaimOwnOrphanPort(port) {
|
|
18730
|
+
if (process.platform === "win32") return false;
|
|
18731
|
+
const reg = readRegistry();
|
|
18732
|
+
const owner = reg[String(port)];
|
|
18733
|
+
if (!owner) return false;
|
|
18734
|
+
if (!groupAlive(owner.pgid)) {
|
|
18735
|
+
delete reg[String(port)];
|
|
18736
|
+
writeRegistry(reg);
|
|
18737
|
+
return false;
|
|
18738
|
+
}
|
|
18739
|
+
log.info(
|
|
18740
|
+
"preview",
|
|
18741
|
+
`reclaiming OWN orphaned preview on port ${port} (pgid=${owner.pgid}, session=${owner.sessionId}) after a CLI restart`
|
|
18742
|
+
);
|
|
18743
|
+
try {
|
|
18744
|
+
process.kill(-owner.pgid, "SIGTERM");
|
|
18745
|
+
} catch {
|
|
18746
|
+
}
|
|
18747
|
+
try {
|
|
18748
|
+
setTimeout(() => {
|
|
18749
|
+
try {
|
|
18750
|
+
process.kill(-owner.pgid, "SIGKILL");
|
|
18751
|
+
} catch {
|
|
18752
|
+
}
|
|
18753
|
+
}, 300).unref?.();
|
|
18754
|
+
} catch {
|
|
18755
|
+
}
|
|
18756
|
+
delete reg[String(port)];
|
|
18757
|
+
writeRegistry(reg);
|
|
18758
|
+
return true;
|
|
18759
|
+
}
|
|
18760
|
+
|
|
18677
18761
|
// src/services/preview/cloudflared.ts
|
|
18678
18762
|
var import_child_process14 = require("child_process");
|
|
18679
18763
|
var import_fs = require("fs");
|
|
@@ -19323,6 +19407,7 @@ function killProcessTree(child, signal = "SIGTERM") {
|
|
|
19323
19407
|
async function killPreview(sessionId) {
|
|
19324
19408
|
const preview = activePreviews.get(sessionId);
|
|
19325
19409
|
if (!preview) return;
|
|
19410
|
+
forgetPreviewPort(preview.detection.port);
|
|
19326
19411
|
if (preview.tunnel) {
|
|
19327
19412
|
killProcessTree(preview.tunnel, "SIGTERM");
|
|
19328
19413
|
}
|
|
@@ -19345,8 +19430,8 @@ function activePreviewSessionIds() {
|
|
|
19345
19430
|
|
|
19346
19431
|
// src/services/preview/start-orchestrator.ts
|
|
19347
19432
|
var import_child_process17 = require("child_process");
|
|
19348
|
-
var
|
|
19349
|
-
var
|
|
19433
|
+
var fs49 = __toESM(require("fs"));
|
|
19434
|
+
var path52 = __toESM(require("path"));
|
|
19350
19435
|
var import_which2 = __toESM(require("which"));
|
|
19351
19436
|
var INSTALL_TIMEOUT_MS = 5 * 6e4;
|
|
19352
19437
|
var SETUP_TIMEOUT_MS = 2 * 6e4;
|
|
@@ -19413,8 +19498,8 @@ function normalizeDetectionForSpawn(detection, cwd) {
|
|
|
19413
19498
|
if (args2.length === 0) return detection;
|
|
19414
19499
|
const binName = args2[0];
|
|
19415
19500
|
if (binName.startsWith("-")) return detection;
|
|
19416
|
-
const binPath =
|
|
19417
|
-
if (!
|
|
19501
|
+
const binPath = path52.join(cwd, "node_modules", ".bin", binName);
|
|
19502
|
+
if (!fs49.existsSync(binPath)) return detection;
|
|
19418
19503
|
return {
|
|
19419
19504
|
...detection,
|
|
19420
19505
|
command: binPath,
|
|
@@ -19462,6 +19547,7 @@ async function runPreviewStart(args2) {
|
|
|
19462
19547
|
framework: detection.framework,
|
|
19463
19548
|
detection
|
|
19464
19549
|
});
|
|
19550
|
+
recordPreviewPort(detection.port, dev.devServer.pid, sessionId, Date.now());
|
|
19465
19551
|
log.info("preview", `ready: ${detection.framework} at ${tun.url}`);
|
|
19466
19552
|
emit2(USER_EVENTS.PREVIEW_READY, {
|
|
19467
19553
|
url: tun.url,
|
|
@@ -19597,6 +19683,19 @@ async function startDevServer(ctx) {
|
|
|
19597
19683
|
});
|
|
19598
19684
|
return null;
|
|
19599
19685
|
}
|
|
19686
|
+
} else if (reclaimOwnOrphanPort(detection.port)) {
|
|
19687
|
+
log.info("preview", `reclaimed own cross-restart orphan on port ${detection.port}`);
|
|
19688
|
+
const freeDeadline = Date.now() + 4e3;
|
|
19689
|
+
while (await isPortListening(detection.port) && Date.now() < freeDeadline) {
|
|
19690
|
+
await new Promise((r) => setTimeout(r, 200));
|
|
19691
|
+
}
|
|
19692
|
+
if (await isPortListening(detection.port)) {
|
|
19693
|
+
emit2(USER_EVENTS.PREVIEW_ERROR, {
|
|
19694
|
+
stage: "spawn",
|
|
19695
|
+
message: `Port ${detection.port} is still in use after stopping the previous preview. Wait a moment and try again.`
|
|
19696
|
+
});
|
|
19697
|
+
return null;
|
|
19698
|
+
}
|
|
19600
19699
|
} else {
|
|
19601
19700
|
emit2(USER_EVENTS.PREVIEW_ERROR, {
|
|
19602
19701
|
stage: "spawn",
|
|
@@ -19764,9 +19863,9 @@ async function establishTunnel(ctx, dev) {
|
|
|
19764
19863
|
|
|
19765
19864
|
// src/beads/bd-adapter.ts
|
|
19766
19865
|
var import_child_process18 = require("child_process");
|
|
19767
|
-
var
|
|
19768
|
-
var
|
|
19769
|
-
var
|
|
19866
|
+
var fs50 = __toESM(require("fs"));
|
|
19867
|
+
var os40 = __toESM(require("os"));
|
|
19868
|
+
var path53 = __toESM(require("path"));
|
|
19770
19869
|
var BD_PACKAGE = "@beads/bd";
|
|
19771
19870
|
function resolveBundledBdBinary() {
|
|
19772
19871
|
return _resolveSeam.resolveBundled();
|
|
@@ -19778,11 +19877,11 @@ function _defaultResolveBundled() {
|
|
|
19778
19877
|
} catch {
|
|
19779
19878
|
return null;
|
|
19780
19879
|
}
|
|
19781
|
-
const binDir =
|
|
19880
|
+
const binDir = path53.join(path53.dirname(pkgJsonPath), "bin");
|
|
19782
19881
|
const binaryName = process.platform === "win32" ? "bd.exe" : "bd";
|
|
19783
|
-
const binaryPath =
|
|
19882
|
+
const binaryPath = path53.join(binDir, binaryName);
|
|
19784
19883
|
try {
|
|
19785
|
-
|
|
19884
|
+
fs50.accessSync(binaryPath, fs50.constants.F_OK);
|
|
19786
19885
|
return binaryPath;
|
|
19787
19886
|
} catch {
|
|
19788
19887
|
return null;
|
|
@@ -19792,13 +19891,13 @@ function resolveBdOnPath() {
|
|
|
19792
19891
|
return _resolveSeam.resolveOnPath();
|
|
19793
19892
|
}
|
|
19794
19893
|
function _defaultResolveOnPath() {
|
|
19795
|
-
const dirs = (process.env.PATH ?? "").split(
|
|
19894
|
+
const dirs = (process.env.PATH ?? "").split(path53.delimiter).filter(Boolean);
|
|
19796
19895
|
const candidates = process.platform === "win32" ? ["bd.exe", "bd.cmd", "bd"] : ["bd"];
|
|
19797
19896
|
for (const dir of dirs) {
|
|
19798
19897
|
for (const candidate of candidates) {
|
|
19799
|
-
const full =
|
|
19898
|
+
const full = path53.join(dir, candidate);
|
|
19800
19899
|
try {
|
|
19801
|
-
|
|
19900
|
+
fs50.accessSync(full, fs50.constants.F_OK);
|
|
19802
19901
|
return full;
|
|
19803
19902
|
} catch {
|
|
19804
19903
|
}
|
|
@@ -19883,7 +19982,7 @@ var BdAdapter = class {
|
|
|
19883
19982
|
const env = { ...process.env };
|
|
19884
19983
|
if (!env.HOME) {
|
|
19885
19984
|
try {
|
|
19886
|
-
const home =
|
|
19985
|
+
const home = os40.homedir();
|
|
19887
19986
|
if (home) env.HOME = home;
|
|
19888
19987
|
} catch {
|
|
19889
19988
|
}
|
|
@@ -19975,9 +20074,9 @@ function coerceIssue(row, projectKey) {
|
|
|
19975
20074
|
|
|
19976
20075
|
// src/beads/provisioner.ts
|
|
19977
20076
|
var import_child_process22 = require("child_process");
|
|
19978
|
-
var
|
|
19979
|
-
var
|
|
19980
|
-
var
|
|
20077
|
+
var fs53 = __toESM(require("fs"));
|
|
20078
|
+
var os42 = __toESM(require("os"));
|
|
20079
|
+
var path56 = __toESM(require("path"));
|
|
19981
20080
|
|
|
19982
20081
|
// src/beads/install-bd.ts
|
|
19983
20082
|
var import_child_process19 = require("child_process");
|
|
@@ -20042,9 +20141,9 @@ async function installBd(platform3 = process.platform) {
|
|
|
20042
20141
|
|
|
20043
20142
|
// src/beads/install-dolt.ts
|
|
20044
20143
|
var import_child_process20 = require("child_process");
|
|
20045
|
-
var
|
|
20046
|
-
var
|
|
20047
|
-
var
|
|
20144
|
+
var fs51 = __toESM(require("fs"));
|
|
20145
|
+
var os41 = __toESM(require("os"));
|
|
20146
|
+
var path54 = __toESM(require("path"));
|
|
20048
20147
|
var DOLT_INSTALL_SH_URL = "https://github.com/dolthub/dolt/releases/latest/download/install.sh";
|
|
20049
20148
|
var DOLT_MSI_URL = "https://github.com/dolthub/dolt/releases/latest/download/dolt-windows-amd64.msi";
|
|
20050
20149
|
function resolveDoltInstallStrategy(platform3) {
|
|
@@ -20084,11 +20183,11 @@ function resolveDoltInstallStrategy(platform3) {
|
|
|
20084
20183
|
}
|
|
20085
20184
|
var DOLT_RELEASE_BASE = "https://github.com/dolthub/dolt/releases/latest/download";
|
|
20086
20185
|
function doltPlatformTuple(platform3, arch2) {
|
|
20087
|
-
const
|
|
20186
|
+
const os52 = platform3 === "win32" ? "windows" : platform3 === "darwin" ? "darwin" : "linux";
|
|
20088
20187
|
const a = arch2 === "x64" ? "amd64" : arch2 === "arm64" ? "arm64" : null;
|
|
20089
20188
|
if (!a) return null;
|
|
20090
|
-
if (
|
|
20091
|
-
return `${
|
|
20189
|
+
if (os52 === "windows" && a !== "amd64") return null;
|
|
20190
|
+
return `${os52}-${a}`;
|
|
20092
20191
|
}
|
|
20093
20192
|
function resolveDoltTarballStrategy(targetDir, platform3, arch2) {
|
|
20094
20193
|
const tuple = doltPlatformTuple(platform3, arch2);
|
|
@@ -20133,14 +20232,14 @@ async function installDoltToDir(targetDir, platform3 = process.platform, arch2 =
|
|
|
20133
20232
|
return result;
|
|
20134
20233
|
}
|
|
20135
20234
|
var _doltPathSeam = {
|
|
20136
|
-
homedir: () =>
|
|
20235
|
+
homedir: () => os41.homedir(),
|
|
20137
20236
|
getPath: () => process.env.PATH ?? "",
|
|
20138
20237
|
setPath: (p2) => {
|
|
20139
20238
|
process.env.PATH = p2;
|
|
20140
20239
|
},
|
|
20141
20240
|
exists: (p2) => {
|
|
20142
20241
|
try {
|
|
20143
|
-
|
|
20242
|
+
fs51.accessSync(p2, fs51.constants.F_OK);
|
|
20144
20243
|
return true;
|
|
20145
20244
|
} catch {
|
|
20146
20245
|
return false;
|
|
@@ -20151,7 +20250,7 @@ function doltBinaryNames(platform3) {
|
|
|
20151
20250
|
return platform3 === "win32" ? ["dolt.exe", "dolt.cmd", "dolt"] : ["dolt"];
|
|
20152
20251
|
}
|
|
20153
20252
|
function knownDoltDirs(platform3) {
|
|
20154
|
-
const P3 = platform3 === "win32" ?
|
|
20253
|
+
const P3 = platform3 === "win32" ? path54.win32 : path54.posix;
|
|
20155
20254
|
const home = _doltPathSeam.homedir();
|
|
20156
20255
|
if (platform3 === "win32") {
|
|
20157
20256
|
return [
|
|
@@ -20167,7 +20266,7 @@ function knownDoltDirs(platform3) {
|
|
|
20167
20266
|
].filter(Boolean);
|
|
20168
20267
|
}
|
|
20169
20268
|
function ensureDoltResolvable(platform3 = process.platform) {
|
|
20170
|
-
const P3 = platform3 === "win32" ?
|
|
20269
|
+
const P3 = platform3 === "win32" ? path54.win32 : path54.posix;
|
|
20171
20270
|
const delim = platform3 === "win32" ? ";" : ":";
|
|
20172
20271
|
const names = doltBinaryNames(platform3);
|
|
20173
20272
|
const pathDirs = _doltPathSeam.getPath().split(delim).filter(Boolean);
|
|
@@ -20303,8 +20402,8 @@ async function ensureSharedServer(adapter, options = {}) {
|
|
|
20303
20402
|
// src/beads/project-key.ts
|
|
20304
20403
|
var import_child_process21 = require("child_process");
|
|
20305
20404
|
var crypto2 = __toESM(require("crypto"));
|
|
20306
|
-
var
|
|
20307
|
-
var
|
|
20405
|
+
var fs52 = __toESM(require("fs"));
|
|
20406
|
+
var path55 = __toESM(require("path"));
|
|
20308
20407
|
function normalizeOrigin(raw) {
|
|
20309
20408
|
const trimmed = raw.trim();
|
|
20310
20409
|
if (!trimmed) return null;
|
|
@@ -20330,17 +20429,17 @@ function normalizeOrigin(raw) {
|
|
|
20330
20429
|
return `${host2}/${pathPart}`;
|
|
20331
20430
|
}
|
|
20332
20431
|
function findRepoRoot(cwd) {
|
|
20333
|
-
let dir =
|
|
20432
|
+
let dir = path55.resolve(cwd);
|
|
20334
20433
|
const seen = /* @__PURE__ */ new Set();
|
|
20335
20434
|
for (let i = 0; i < 256; i++) {
|
|
20336
20435
|
if (seen.has(dir)) return null;
|
|
20337
20436
|
seen.add(dir);
|
|
20338
20437
|
try {
|
|
20339
|
-
const stat3 =
|
|
20438
|
+
const stat3 = fs52.statSync(path55.join(dir, ".git"), { throwIfNoEntry: false });
|
|
20340
20439
|
if (stat3 && (stat3.isDirectory() || stat3.isFile())) return dir;
|
|
20341
20440
|
} catch {
|
|
20342
20441
|
}
|
|
20343
|
-
const parent =
|
|
20442
|
+
const parent = path55.dirname(dir);
|
|
20344
20443
|
if (parent === dir) return null;
|
|
20345
20444
|
dir = parent;
|
|
20346
20445
|
}
|
|
@@ -20351,7 +20450,7 @@ var _execSeam2 = {
|
|
|
20351
20450
|
const out2 = (0, import_child_process21.execFileSync)(file, args2, opts);
|
|
20352
20451
|
return typeof out2 === "string" ? out2 : out2.toString("utf8");
|
|
20353
20452
|
},
|
|
20354
|
-
realpath: (p2) =>
|
|
20453
|
+
realpath: (p2) => fs52.realpathSync(p2)
|
|
20355
20454
|
};
|
|
20356
20455
|
function readOrigin(cwd) {
|
|
20357
20456
|
try {
|
|
@@ -20380,7 +20479,7 @@ function deriveProjectIdentity(cwd = process.cwd()) {
|
|
|
20380
20479
|
} catch {
|
|
20381
20480
|
}
|
|
20382
20481
|
const hash = crypto2.createHash("sha256").update(real).digest("hex");
|
|
20383
|
-
return { projectKey: `path:${hash}`, projectLabel:
|
|
20482
|
+
return { projectKey: `path:${hash}`, projectLabel: path55.basename(real) || "project" };
|
|
20384
20483
|
}
|
|
20385
20484
|
|
|
20386
20485
|
// src/beads/project-prefix.ts
|
|
@@ -20425,17 +20524,17 @@ var _provisionSeam = {
|
|
|
20425
20524
|
};
|
|
20426
20525
|
var _linkSeam = {
|
|
20427
20526
|
platform: () => process.platform,
|
|
20428
|
-
homedir: () =>
|
|
20527
|
+
homedir: () => os42.homedir(),
|
|
20429
20528
|
isWritableDir: (dir) => {
|
|
20430
20529
|
try {
|
|
20431
|
-
|
|
20530
|
+
fs53.accessSync(dir, fs53.constants.W_OK);
|
|
20432
20531
|
return true;
|
|
20433
20532
|
} catch {
|
|
20434
20533
|
return false;
|
|
20435
20534
|
}
|
|
20436
20535
|
},
|
|
20437
20536
|
ensureDir: (dir) => {
|
|
20438
|
-
|
|
20537
|
+
fs53.mkdirSync(dir, { recursive: true });
|
|
20439
20538
|
},
|
|
20440
20539
|
/**
|
|
20441
20540
|
* A directory to symlink `bd` into so the AGENT's shell + Claude Code's
|
|
@@ -20456,9 +20555,9 @@ var _linkSeam = {
|
|
|
20456
20555
|
* which `linkBdOntoPath` creates if missing.
|
|
20457
20556
|
*/
|
|
20458
20557
|
cliBinDir: () => {
|
|
20459
|
-
const pathDirs = (process.env.PATH ?? "").split(
|
|
20558
|
+
const pathDirs = (process.env.PATH ?? "").split(path56.delimiter).filter(Boolean);
|
|
20460
20559
|
const home = _linkSeam.homedir();
|
|
20461
|
-
const localBin = home ?
|
|
20560
|
+
const localBin = home ? path56.join(home, ".local", "bin") : null;
|
|
20462
20561
|
if (localBin) {
|
|
20463
20562
|
try {
|
|
20464
20563
|
_linkSeam.ensureDir(localBin);
|
|
@@ -20468,16 +20567,16 @@ var _linkSeam = {
|
|
|
20468
20567
|
const candidates = [];
|
|
20469
20568
|
if (localBin) candidates.push(localBin);
|
|
20470
20569
|
try {
|
|
20471
|
-
candidates.push(
|
|
20570
|
+
candidates.push(path56.dirname(process.execPath));
|
|
20472
20571
|
} catch {
|
|
20473
20572
|
}
|
|
20474
20573
|
candidates.push("/usr/local/bin");
|
|
20475
20574
|
const entry = process.argv[1];
|
|
20476
20575
|
if (entry) {
|
|
20477
20576
|
try {
|
|
20478
|
-
candidates.push(
|
|
20577
|
+
candidates.push(path56.dirname(fs53.realpathSync(entry)));
|
|
20479
20578
|
} catch {
|
|
20480
|
-
candidates.push(
|
|
20579
|
+
candidates.push(path56.dirname(entry));
|
|
20481
20580
|
}
|
|
20482
20581
|
}
|
|
20483
20582
|
const onPathWritable = candidates.find(
|
|
@@ -20489,20 +20588,20 @@ var _linkSeam = {
|
|
|
20489
20588
|
/** Current symlink target at `linkPath`, or null when absent / not a link. */
|
|
20490
20589
|
readlink: (linkPath) => {
|
|
20491
20590
|
try {
|
|
20492
|
-
return
|
|
20591
|
+
return fs53.readlinkSync(linkPath);
|
|
20493
20592
|
} catch {
|
|
20494
20593
|
return null;
|
|
20495
20594
|
}
|
|
20496
20595
|
},
|
|
20497
|
-
unlink: (linkPath) =>
|
|
20498
|
-
symlink: (target, linkPath) =>
|
|
20596
|
+
unlink: (linkPath) => fs53.unlinkSync(linkPath),
|
|
20597
|
+
symlink: (target, linkPath) => fs53.symlinkSync(target, linkPath)
|
|
20499
20598
|
};
|
|
20500
20599
|
function linkBdOntoPath(binaryPath) {
|
|
20501
20600
|
if (_linkSeam.platform() === "win32") return;
|
|
20502
20601
|
const binDir = _linkSeam.cliBinDir();
|
|
20503
20602
|
if (!binDir) return;
|
|
20504
20603
|
_linkSeam.ensureDir(binDir);
|
|
20505
|
-
const linkPath =
|
|
20604
|
+
const linkPath = path56.join(binDir, "bd");
|
|
20506
20605
|
if (linkPath === binaryPath) return;
|
|
20507
20606
|
const current = _linkSeam.readlink(linkPath);
|
|
20508
20607
|
if (current === binaryPath) return;
|
|
@@ -20697,7 +20796,7 @@ function dedupeRecipes(agents) {
|
|
|
20697
20796
|
|
|
20698
20797
|
// src/beads/watcher.ts
|
|
20699
20798
|
var crypto4 = __toESM(require("crypto"));
|
|
20700
|
-
var
|
|
20799
|
+
var path57 = __toESM(require("path"));
|
|
20701
20800
|
var API_BASE6 = resolveApiBaseUrl();
|
|
20702
20801
|
var DEBOUNCE_MS2 = 400;
|
|
20703
20802
|
var ZERO_SUMMARY = {
|
|
@@ -20721,7 +20820,7 @@ var BeadsWatcher = class {
|
|
|
20721
20820
|
constructor(opts) {
|
|
20722
20821
|
this.opts = opts;
|
|
20723
20822
|
this.bd = opts.adapter ?? new BdAdapter({ cwd: opts.cwd, beadsDir: opts.beadsDir });
|
|
20724
|
-
this.feedPath = opts.feedPath ??
|
|
20823
|
+
this.feedPath = opts.feedPath ?? path57.join(opts.cwd ?? process.cwd(), ".beads", "last-touched");
|
|
20725
20824
|
this.apiBase = opts.apiBaseUrl ?? API_BASE6;
|
|
20726
20825
|
}
|
|
20727
20826
|
opts;
|
|
@@ -21138,8 +21237,8 @@ function cleanupAttachmentTempFiles() {
|
|
|
21138
21237
|
function saveFilesTemp(files) {
|
|
21139
21238
|
return files.filter(({ base64 }) => base64 && base64.length > 0).map(({ filename, base64 }) => {
|
|
21140
21239
|
const safeName = filename.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 80);
|
|
21141
|
-
const tmpPath =
|
|
21142
|
-
|
|
21240
|
+
const tmpPath = path59.join(os44.tmpdir(), `codeam-${(0, import_crypto3.randomUUID)()}-${safeName}`);
|
|
21241
|
+
fs55.writeFileSync(tmpPath, Buffer.from(base64, "base64"));
|
|
21143
21242
|
pendingAttachmentFiles.add(tmpPath);
|
|
21144
21243
|
return tmpPath;
|
|
21145
21244
|
});
|
|
@@ -21351,9 +21450,9 @@ var listFiles = async (ctx, cmd, parsed) => {
|
|
|
21351
21450
|
await ctx.relay.sendResult(cmd.id, "completed", result);
|
|
21352
21451
|
};
|
|
21353
21452
|
var envReadH = async (ctx, cmd) => {
|
|
21354
|
-
const envPath =
|
|
21453
|
+
const envPath = path59.join(process.cwd(), ".env");
|
|
21355
21454
|
try {
|
|
21356
|
-
const raw = await
|
|
21455
|
+
const raw = await fs55.promises.readFile(envPath, "utf8");
|
|
21357
21456
|
await ctx.relay.sendResult(cmd.id, "completed", {
|
|
21358
21457
|
exists: true,
|
|
21359
21458
|
vars: parseDotenv(raw)
|
|
@@ -21384,14 +21483,14 @@ var envWriteH = async (ctx, cmd, parsed) => {
|
|
|
21384
21483
|
}
|
|
21385
21484
|
seen.add(v.key);
|
|
21386
21485
|
}
|
|
21387
|
-
const envPath =
|
|
21388
|
-
const tmpPath =
|
|
21486
|
+
const envPath = path59.join(process.cwd(), ".env");
|
|
21487
|
+
const tmpPath = path59.join(process.cwd(), ".env.codeam.tmp");
|
|
21389
21488
|
try {
|
|
21390
|
-
await
|
|
21391
|
-
await
|
|
21489
|
+
await fs55.promises.writeFile(tmpPath, serializeDotenv(vars), "utf8");
|
|
21490
|
+
await fs55.promises.rename(tmpPath, envPath);
|
|
21392
21491
|
await ctx.relay.sendResult(cmd.id, "completed", { ok: true, count: vars.length });
|
|
21393
21492
|
} catch (err) {
|
|
21394
|
-
await
|
|
21493
|
+
await fs55.promises.rm(tmpPath, { force: true }).catch(() => void 0);
|
|
21395
21494
|
await ctx.relay.sendResult(cmd.id, "failed", { error: err.message });
|
|
21396
21495
|
}
|
|
21397
21496
|
};
|
|
@@ -21435,7 +21534,7 @@ var headroomConfigureH = async (ctx, cmd, parsed) => {
|
|
|
21435
21534
|
let configuredAgent = rawAgentId;
|
|
21436
21535
|
if (!configuredAgent) {
|
|
21437
21536
|
try {
|
|
21438
|
-
const raw = JSON.parse(
|
|
21537
|
+
const raw = JSON.parse(fs55.readFileSync(headroomConfigPath(), "utf8"));
|
|
21439
21538
|
configuredAgent = raw.agent ?? "";
|
|
21440
21539
|
} catch {
|
|
21441
21540
|
}
|
|
@@ -21469,7 +21568,7 @@ var headroomConfigureH = async (ctx, cmd, parsed) => {
|
|
|
21469
21568
|
persist: persistHeadroomConfig,
|
|
21470
21569
|
readEnabled: () => {
|
|
21471
21570
|
try {
|
|
21472
|
-
const raw = JSON.parse(
|
|
21571
|
+
const raw = JSON.parse(fs55.readFileSync(headroomConfigPath(), "utf8"));
|
|
21473
21572
|
return raw.enabled === true;
|
|
21474
21573
|
} catch {
|
|
21475
21574
|
return false;
|
|
@@ -21716,7 +21815,7 @@ var headroomBudgetH = async (ctx, cmd) => {
|
|
|
21716
21815
|
}
|
|
21717
21816
|
let headroomActive = false;
|
|
21718
21817
|
try {
|
|
21719
|
-
const raw = JSON.parse(
|
|
21818
|
+
const raw = JSON.parse(fs55.readFileSync(headroomConfigPath(), "utf8"));
|
|
21720
21819
|
headroomActive = raw.enabled === true;
|
|
21721
21820
|
} catch {
|
|
21722
21821
|
}
|
|
@@ -21726,7 +21825,7 @@ var headroomBudgetH = async (ctx, cmd) => {
|
|
|
21726
21825
|
}
|
|
21727
21826
|
let existingConfig = { enabled: true };
|
|
21728
21827
|
try {
|
|
21729
|
-
existingConfig = JSON.parse(
|
|
21828
|
+
existingConfig = JSON.parse(fs55.readFileSync(headroomConfigPath(), "utf8"));
|
|
21730
21829
|
} catch {
|
|
21731
21830
|
}
|
|
21732
21831
|
if (payload.budgetEnabled && payload.budgetUsd != null) {
|
|
@@ -21839,13 +21938,13 @@ var CLI_UPDATE_MAX_ATTEMPTS = 3;
|
|
|
21839
21938
|
function buildNpmInstallInvocation(opts) {
|
|
21840
21939
|
const entryScript = opts?.entryScript ?? process.argv[1] ?? "";
|
|
21841
21940
|
const execPath = opts?.execPath ?? process.execPath;
|
|
21842
|
-
const exists2 = opts?.existsSync ??
|
|
21843
|
-
const normalized = entryScript.split(
|
|
21941
|
+
const exists2 = opts?.existsSync ?? fs55.existsSync;
|
|
21942
|
+
const normalized = entryScript.split(path59.sep).join("/");
|
|
21844
21943
|
const marker = "/lib/node_modules/codeam-cli/";
|
|
21845
21944
|
const markerIdx = normalized.indexOf(marker);
|
|
21846
21945
|
const prefix = markerIdx > 0 ? entryScript.slice(0, markerIdx) : null;
|
|
21847
|
-
const siblingNpm =
|
|
21848
|
-
|
|
21946
|
+
const siblingNpm = path59.join(
|
|
21947
|
+
path59.dirname(execPath),
|
|
21849
21948
|
process.platform === "win32" ? "npm.cmd" : "npm"
|
|
21850
21949
|
);
|
|
21851
21950
|
const command2 = exists2(siblingNpm) ? siblingNpm : "npm";
|
|
@@ -22712,11 +22811,11 @@ function resolveTokenValue(args2) {
|
|
|
22712
22811
|
}
|
|
22713
22812
|
const fileFlag = args2.find((a) => a.startsWith("--token-file="));
|
|
22714
22813
|
if (fileFlag) {
|
|
22715
|
-
const
|
|
22814
|
+
const path74 = fileFlag.slice("--token-file=".length);
|
|
22716
22815
|
try {
|
|
22717
|
-
const content =
|
|
22718
|
-
if (content.length === 0) fail(`--token-file ${
|
|
22719
|
-
rmIfExistsQuiet(
|
|
22816
|
+
const content = fs56.readFileSync(path74, "utf8").trim();
|
|
22817
|
+
if (content.length === 0) fail(`--token-file ${path74} is empty`);
|
|
22818
|
+
rmIfExistsQuiet(path74);
|
|
22720
22819
|
return content;
|
|
22721
22820
|
} catch (err) {
|
|
22722
22821
|
fail(`Could not read --token-file: ${err.message}`);
|
|
@@ -22745,7 +22844,7 @@ async function claimOnce(token, pluginId, pluginSecretHash) {
|
|
|
22745
22844
|
pluginId,
|
|
22746
22845
|
ideName: "codeam-cli (codespace)",
|
|
22747
22846
|
ideVersion: process.env.npm_package_version ?? "unknown",
|
|
22748
|
-
hostname:
|
|
22847
|
+
hostname: os45.hostname(),
|
|
22749
22848
|
codespaceName: process.env.CODESPACE_NAME ?? "",
|
|
22750
22849
|
// Current git branch of the codespace's working directory, so the
|
|
22751
22850
|
// backend can populate `PairedSession.branch` for the codespace pair.
|
|
@@ -22806,7 +22905,7 @@ async function claim(token, pluginId, pluginSecretHash) {
|
|
|
22806
22905
|
}
|
|
22807
22906
|
}
|
|
22808
22907
|
function pairAutoLockPath() {
|
|
22809
|
-
return
|
|
22908
|
+
return path60.join(os45.homedir(), ".codeam", "pair-auto.lock");
|
|
22810
22909
|
}
|
|
22811
22910
|
function isLivePairAuto(pid) {
|
|
22812
22911
|
if (!Number.isInteger(pid) || pid <= 0 || pid === process.pid) return false;
|
|
@@ -22816,7 +22915,7 @@ function isLivePairAuto(pid) {
|
|
|
22816
22915
|
if (e.code !== "EPERM") return false;
|
|
22817
22916
|
}
|
|
22818
22917
|
try {
|
|
22819
|
-
return
|
|
22918
|
+
return fs56.readFileSync(`/proc/${pid}/cmdline`, "utf8").includes("codeam");
|
|
22820
22919
|
} catch {
|
|
22821
22920
|
return true;
|
|
22822
22921
|
}
|
|
@@ -22826,24 +22925,24 @@ function isLiveCodeam(pid) {
|
|
|
22826
22925
|
}
|
|
22827
22926
|
function daemonLockPath(sessionId) {
|
|
22828
22927
|
const safe = sessionId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
22829
|
-
return
|
|
22928
|
+
return path60.join(os45.homedir(), ".codeam", `daemon-${safe}.lock`);
|
|
22830
22929
|
}
|
|
22831
22930
|
function acquireDaemonLock(sessionId) {
|
|
22832
22931
|
const lockPath = daemonLockPath(sessionId);
|
|
22833
22932
|
try {
|
|
22834
|
-
|
|
22933
|
+
fs56.mkdirSync(path60.dirname(lockPath), { recursive: true });
|
|
22835
22934
|
try {
|
|
22836
|
-
|
|
22935
|
+
fs56.writeFileSync(lockPath, String(process.pid), { flag: "wx" });
|
|
22837
22936
|
} catch (e) {
|
|
22838
22937
|
if (e.code !== "EEXIST") throw e;
|
|
22839
|
-
const holder = Number(
|
|
22938
|
+
const holder = Number(fs56.readFileSync(lockPath, "utf8").trim());
|
|
22840
22939
|
if (holder && holder !== process.pid && isLiveCodeam(holder)) return false;
|
|
22841
|
-
|
|
22940
|
+
fs56.writeFileSync(lockPath, String(process.pid));
|
|
22842
22941
|
}
|
|
22843
22942
|
const release3 = () => {
|
|
22844
22943
|
try {
|
|
22845
|
-
if (
|
|
22846
|
-
|
|
22944
|
+
if (fs56.existsSync(lockPath) && Number(fs56.readFileSync(lockPath, "utf8").trim()) === process.pid) {
|
|
22945
|
+
fs56.unlinkSync(lockPath);
|
|
22847
22946
|
}
|
|
22848
22947
|
} catch {
|
|
22849
22948
|
}
|
|
@@ -22865,19 +22964,19 @@ function acquireDaemonLock(sessionId) {
|
|
|
22865
22964
|
function acquireSingletonLock() {
|
|
22866
22965
|
const lockPath = pairAutoLockPath();
|
|
22867
22966
|
try {
|
|
22868
|
-
|
|
22967
|
+
fs56.mkdirSync(path60.dirname(lockPath), { recursive: true });
|
|
22869
22968
|
try {
|
|
22870
|
-
|
|
22969
|
+
fs56.writeFileSync(lockPath, String(process.pid), { flag: "wx" });
|
|
22871
22970
|
} catch (e) {
|
|
22872
22971
|
if (e.code !== "EEXIST") throw e;
|
|
22873
|
-
const holder = Number(
|
|
22972
|
+
const holder = Number(fs56.readFileSync(lockPath, "utf8").trim());
|
|
22874
22973
|
if (isLivePairAuto(holder)) return false;
|
|
22875
|
-
|
|
22974
|
+
fs56.writeFileSync(lockPath, String(process.pid));
|
|
22876
22975
|
}
|
|
22877
22976
|
process.once("exit", () => {
|
|
22878
22977
|
try {
|
|
22879
|
-
if (
|
|
22880
|
-
|
|
22978
|
+
if (fs56.existsSync(lockPath) && Number(fs56.readFileSync(lockPath, "utf8").trim()) === process.pid) {
|
|
22979
|
+
fs56.unlinkSync(lockPath);
|
|
22881
22980
|
}
|
|
22882
22981
|
} catch {
|
|
22883
22982
|
}
|
|
@@ -23323,7 +23422,7 @@ var AgentService = class _AgentService {
|
|
|
23323
23422
|
};
|
|
23324
23423
|
|
|
23325
23424
|
// src/agents/acp/adapters.ts
|
|
23326
|
-
var
|
|
23425
|
+
var path62 = __toESM(require("path"));
|
|
23327
23426
|
|
|
23328
23427
|
// src/agents/acp/agent-binary.ts
|
|
23329
23428
|
var import_fs4 = __toESM(require("fs"));
|
|
@@ -23566,13 +23665,13 @@ function resolveBin(pkgName, binName) {
|
|
|
23566
23665
|
try {
|
|
23567
23666
|
const manifestPath = require_.resolve(`${pkgName}/package.json`);
|
|
23568
23667
|
const manifest = require_(`${pkgName}/package.json`);
|
|
23569
|
-
const pkgDir =
|
|
23668
|
+
const pkgDir = path62.dirname(manifestPath);
|
|
23570
23669
|
const bin = manifest.bin;
|
|
23571
23670
|
if (!bin) return null;
|
|
23572
|
-
if (typeof bin === "string") return
|
|
23671
|
+
if (typeof bin === "string") return path62.resolve(pkgDir, bin);
|
|
23573
23672
|
const target = binName ?? Object.keys(bin)[0];
|
|
23574
23673
|
if (!target || !bin[target]) return null;
|
|
23575
|
-
return
|
|
23674
|
+
return path62.resolve(pkgDir, bin[target]);
|
|
23576
23675
|
} catch {
|
|
23577
23676
|
return null;
|
|
23578
23677
|
}
|
|
@@ -23676,9 +23775,9 @@ function requiresAcp(agent) {
|
|
|
23676
23775
|
var import_node_crypto10 = require("crypto");
|
|
23677
23776
|
|
|
23678
23777
|
// src/services/history.service.ts
|
|
23679
|
-
var
|
|
23680
|
-
var
|
|
23681
|
-
var
|
|
23778
|
+
var fs58 = __toESM(require("fs"));
|
|
23779
|
+
var path63 = __toESM(require("path"));
|
|
23780
|
+
var os47 = __toESM(require("os"));
|
|
23682
23781
|
var https7 = __toESM(require("https"));
|
|
23683
23782
|
var http6 = __toESM(require("http"));
|
|
23684
23783
|
var import_zod2 = require("zod");
|
|
@@ -23705,7 +23804,7 @@ function parseJsonl(filePath) {
|
|
|
23705
23804
|
const messages = [];
|
|
23706
23805
|
let raw;
|
|
23707
23806
|
try {
|
|
23708
|
-
raw =
|
|
23807
|
+
raw = fs58.readFileSync(filePath, "utf8");
|
|
23709
23808
|
} catch (err) {
|
|
23710
23809
|
if (err.code !== "ENOENT") {
|
|
23711
23810
|
log.warn("history:parseJsonl", `read failed for ${filePath}`, err);
|
|
@@ -23846,7 +23945,7 @@ var HistoryService = class _HistoryService {
|
|
|
23846
23945
|
return this._quotaPercent === null || Date.now() - this._quotaFetchedAt > ttlMs;
|
|
23847
23946
|
}
|
|
23848
23947
|
get projectDir() {
|
|
23849
|
-
return this.runtime.resolveHistoryDir(this.cwd) ??
|
|
23948
|
+
return this.runtime.resolveHistoryDir(this.cwd) ?? path63.join(os47.homedir(), ".claude", "projects", encodeCwd(this.cwd));
|
|
23850
23949
|
}
|
|
23851
23950
|
/** Set the current Claude conversation ID (extracted from /cost command or session start) */
|
|
23852
23951
|
setCurrentConversationId(id) {
|
|
@@ -23858,7 +23957,7 @@ var HistoryService = class _HistoryService {
|
|
|
23858
23957
|
/** Return the current message count in the active conversation. */
|
|
23859
23958
|
getCurrentMessageCount() {
|
|
23860
23959
|
if (!this.currentConversationId) return 0;
|
|
23861
|
-
const filePath =
|
|
23960
|
+
const filePath = path63.join(this.projectDir, `${this.currentConversationId}.jsonl`);
|
|
23862
23961
|
return parseJsonl(filePath).length;
|
|
23863
23962
|
}
|
|
23864
23963
|
/**
|
|
@@ -23869,7 +23968,7 @@ var HistoryService = class _HistoryService {
|
|
|
23869
23968
|
const deadline = Date.now() + timeoutMs;
|
|
23870
23969
|
while (Date.now() < deadline) {
|
|
23871
23970
|
if (!this.currentConversationId) return null;
|
|
23872
|
-
const filePath =
|
|
23971
|
+
const filePath = path63.join(this.projectDir, `${this.currentConversationId}.jsonl`);
|
|
23873
23972
|
const messages = parseJsonl(filePath);
|
|
23874
23973
|
if (messages.length > previousCount) {
|
|
23875
23974
|
for (let i = messages.length - 1; i >= previousCount; i--) {
|
|
@@ -23895,16 +23994,16 @@ var HistoryService = class _HistoryService {
|
|
|
23895
23994
|
const dir = this.projectDir;
|
|
23896
23995
|
const cutoff = this.bootTimeMs - _HistoryService.BIRTHTIME_GRACE_MS;
|
|
23897
23996
|
try {
|
|
23898
|
-
const files =
|
|
23997
|
+
const files = fs58.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isFile() && e.name.endsWith(".jsonl")).map((e) => {
|
|
23899
23998
|
try {
|
|
23900
|
-
const stat3 =
|
|
23999
|
+
const stat3 = fs58.statSync(path63.join(dir, e.name));
|
|
23901
24000
|
return { name: e.name, mtime: stat3.mtimeMs, birthtime: stat3.birthtimeMs };
|
|
23902
24001
|
} catch {
|
|
23903
24002
|
return { name: e.name, mtime: 0, birthtime: 0 };
|
|
23904
24003
|
}
|
|
23905
24004
|
}).filter((f) => f.birthtime >= cutoff).sort((a, b) => b.mtime - a.mtime);
|
|
23906
24005
|
if (files.length > 0) {
|
|
23907
|
-
this.currentConversationId =
|
|
24006
|
+
this.currentConversationId = path63.basename(files[0].name, ".jsonl");
|
|
23908
24007
|
}
|
|
23909
24008
|
} catch {
|
|
23910
24009
|
}
|
|
@@ -23938,13 +24037,13 @@ var HistoryService = class _HistoryService {
|
|
|
23938
24037
|
const cutoff = this.bootTimeMs - _HistoryService.BIRTHTIME_GRACE_MS;
|
|
23939
24038
|
let entries;
|
|
23940
24039
|
try {
|
|
23941
|
-
entries =
|
|
24040
|
+
entries = fs58.readdirSync(dir, { withFileTypes: true });
|
|
23942
24041
|
} catch {
|
|
23943
24042
|
return null;
|
|
23944
24043
|
}
|
|
23945
24044
|
const files = entries.filter((e) => e.isFile() && e.name.endsWith(".jsonl")).map((e) => {
|
|
23946
24045
|
try {
|
|
23947
|
-
const stat3 =
|
|
24046
|
+
const stat3 = fs58.statSync(path63.join(dir, e.name));
|
|
23948
24047
|
return { name: e.name, mtime: stat3.mtimeMs, birthtime: stat3.birthtimeMs };
|
|
23949
24048
|
} catch {
|
|
23950
24049
|
return { name: e.name, mtime: 0, birthtime: 0 };
|
|
@@ -23953,12 +24052,12 @@ var HistoryService = class _HistoryService {
|
|
|
23953
24052
|
if (files.length === 0) return null;
|
|
23954
24053
|
const targetFile = this.currentConversationId ? `${this.currentConversationId}.jsonl` : files[0].name;
|
|
23955
24054
|
if (!files.some((f) => f.name === targetFile)) return null;
|
|
23956
|
-
return this.extractUsageFromFile(
|
|
24055
|
+
return this.extractUsageFromFile(path63.join(dir, targetFile));
|
|
23957
24056
|
}
|
|
23958
24057
|
extractUsageFromFile(filePath) {
|
|
23959
24058
|
let raw;
|
|
23960
24059
|
try {
|
|
23961
|
-
raw =
|
|
24060
|
+
raw = fs58.readFileSync(filePath, "utf8");
|
|
23962
24061
|
} catch {
|
|
23963
24062
|
return null;
|
|
23964
24063
|
}
|
|
@@ -24003,9 +24102,9 @@ var HistoryService = class _HistoryService {
|
|
|
24003
24102
|
let totalCost = 0;
|
|
24004
24103
|
let files;
|
|
24005
24104
|
try {
|
|
24006
|
-
files =
|
|
24105
|
+
files = fs58.readdirSync(projectDir).filter((f) => f.endsWith(".jsonl")).filter((f) => {
|
|
24007
24106
|
try {
|
|
24008
|
-
return
|
|
24107
|
+
return fs58.statSync(path63.join(projectDir, f)).mtimeMs >= monthStartMs;
|
|
24009
24108
|
} catch {
|
|
24010
24109
|
return false;
|
|
24011
24110
|
}
|
|
@@ -24016,7 +24115,7 @@ var HistoryService = class _HistoryService {
|
|
|
24016
24115
|
for (const file of files) {
|
|
24017
24116
|
let raw;
|
|
24018
24117
|
try {
|
|
24019
|
-
raw =
|
|
24118
|
+
raw = fs58.readFileSync(path63.join(projectDir, file), "utf8");
|
|
24020
24119
|
} catch {
|
|
24021
24120
|
continue;
|
|
24022
24121
|
}
|
|
@@ -24095,7 +24194,7 @@ var HistoryService = class _HistoryService {
|
|
|
24095
24194
|
if (this.runtime.resolveHistoryFile) {
|
|
24096
24195
|
return this.runtime.resolveHistoryFile(this.cwd, sessionId);
|
|
24097
24196
|
}
|
|
24098
|
-
return
|
|
24197
|
+
return path63.join(this.projectDir, `${sessionId}.jsonl`);
|
|
24099
24198
|
}
|
|
24100
24199
|
/**
|
|
24101
24200
|
* Parse a conversation's messages from disk, agent-aware. Claude uses the
|
|
@@ -24129,7 +24228,7 @@ var HistoryService = class _HistoryService {
|
|
|
24129
24228
|
};
|
|
24130
24229
|
});
|
|
24131
24230
|
}
|
|
24132
|
-
return parseJsonl(
|
|
24231
|
+
return parseJsonl(path63.join(this.projectDir, `${sessionId}.jsonl`));
|
|
24133
24232
|
}
|
|
24134
24233
|
async loadConversation(sessionId) {
|
|
24135
24234
|
const messages = this.readConversation(sessionId);
|
|
@@ -24185,7 +24284,7 @@ var HistoryService = class _HistoryService {
|
|
|
24185
24284
|
if (!filePath) return false;
|
|
24186
24285
|
let mtimeMs;
|
|
24187
24286
|
try {
|
|
24188
|
-
mtimeMs =
|
|
24287
|
+
mtimeMs = fs58.statSync(filePath).mtimeMs;
|
|
24189
24288
|
} catch {
|
|
24190
24289
|
return false;
|
|
24191
24290
|
}
|
|
@@ -24254,10 +24353,10 @@ var HistoryService = class _HistoryService {
|
|
|
24254
24353
|
|
|
24255
24354
|
// src/agents/acp/client.ts
|
|
24256
24355
|
var import_node_child_process26 = require("child_process");
|
|
24257
|
-
var
|
|
24356
|
+
var fs59 = __toESM(require("fs/promises"));
|
|
24258
24357
|
var fsSync = __toESM(require("fs"));
|
|
24259
|
-
var
|
|
24260
|
-
var
|
|
24358
|
+
var os48 = __toESM(require("os"));
|
|
24359
|
+
var path64 = __toESM(require("path"));
|
|
24261
24360
|
var import_node_stream = require("stream");
|
|
24262
24361
|
|
|
24263
24362
|
// ../../node_modules/@agentclientprotocol/sdk/dist/acp.js
|
|
@@ -27338,7 +27437,7 @@ var AcpClient = class {
|
|
|
27338
27437
|
},
|
|
27339
27438
|
readTextFile: async (params) => {
|
|
27340
27439
|
try {
|
|
27341
|
-
const content = await
|
|
27440
|
+
const content = await fs59.readFile(params.path, "utf8");
|
|
27342
27441
|
return applyLineRange(content, params.line ?? null, params.limit ?? null);
|
|
27343
27442
|
} catch (err) {
|
|
27344
27443
|
const code = err.code;
|
|
@@ -27358,7 +27457,7 @@ var AcpClient = class {
|
|
|
27358
27457
|
},
|
|
27359
27458
|
writeTextFile: async (params) => {
|
|
27360
27459
|
try {
|
|
27361
|
-
await
|
|
27460
|
+
await fs59.writeFile(params.path, params.content, "utf8");
|
|
27362
27461
|
return {};
|
|
27363
27462
|
} catch (err) {
|
|
27364
27463
|
const code = err.code;
|
|
@@ -27407,29 +27506,29 @@ function applyLineRange(content, line, limit) {
|
|
|
27407
27506
|
return { content: lines.slice(start2, end).join("\n") };
|
|
27408
27507
|
}
|
|
27409
27508
|
function knownAgentBinaryDirs() {
|
|
27410
|
-
const home =
|
|
27509
|
+
const home = os48.homedir();
|
|
27411
27510
|
const out2 = [];
|
|
27412
27511
|
out2.push("/tmp/codeam-node20/bin");
|
|
27413
27512
|
for (const root of [
|
|
27414
27513
|
"/usr/local/share/nvm/versions/node",
|
|
27415
|
-
|
|
27514
|
+
path64.join(home, ".nvm/versions/node")
|
|
27416
27515
|
]) {
|
|
27417
27516
|
try {
|
|
27418
27517
|
for (const child of fsSync.readdirSync(root)) {
|
|
27419
|
-
out2.push(
|
|
27518
|
+
out2.push(path64.join(root, child, "bin"));
|
|
27420
27519
|
}
|
|
27421
27520
|
} catch {
|
|
27422
27521
|
}
|
|
27423
27522
|
}
|
|
27424
|
-
out2.push(
|
|
27523
|
+
out2.push(path64.join(home, ".volta/bin"));
|
|
27425
27524
|
out2.push("/usr/local/bin");
|
|
27426
27525
|
out2.push("/usr/bin");
|
|
27427
|
-
out2.push(
|
|
27428
|
-
out2.push(
|
|
27526
|
+
out2.push(path64.join(home, ".local/bin"));
|
|
27527
|
+
out2.push(path64.join(home, "bin"));
|
|
27429
27528
|
if (process.platform === "win32") {
|
|
27430
27529
|
const { LOCALAPPDATA, APPDATA } = process.env;
|
|
27431
|
-
if (LOCALAPPDATA) out2.push(
|
|
27432
|
-
if (APPDATA) out2.push(
|
|
27530
|
+
if (LOCALAPPDATA) out2.push(path64.join(LOCALAPPDATA, "cursor-agent"));
|
|
27531
|
+
if (APPDATA) out2.push(path64.join(APPDATA, "npm"));
|
|
27433
27532
|
}
|
|
27434
27533
|
return out2.filter((p2) => {
|
|
27435
27534
|
try {
|
|
@@ -27441,7 +27540,7 @@ function knownAgentBinaryDirs() {
|
|
|
27441
27540
|
}
|
|
27442
27541
|
function expandPathForAgentBinaries(existingPath) {
|
|
27443
27542
|
const existing = new Set(
|
|
27444
|
-
existingPath.split(
|
|
27543
|
+
existingPath.split(path64.delimiter).filter((p2) => p2.length > 0)
|
|
27445
27544
|
);
|
|
27446
27545
|
const additions = [];
|
|
27447
27546
|
for (const dir of knownAgentBinaryDirs()) {
|
|
@@ -27451,7 +27550,7 @@ function expandPathForAgentBinaries(existingPath) {
|
|
|
27451
27550
|
}
|
|
27452
27551
|
}
|
|
27453
27552
|
if (additions.length === 0) return existingPath;
|
|
27454
|
-
return [...additions, existingPath].filter((p2) => p2.length > 0).join(
|
|
27553
|
+
return [...additions, existingPath].filter((p2) => p2.length > 0).join(path64.delimiter);
|
|
27455
27554
|
}
|
|
27456
27555
|
|
|
27457
27556
|
// src/agents/acp/headroom-budget-proxy.ts
|
|
@@ -27933,15 +28032,15 @@ function commonPrefixLength(a, b) {
|
|
|
27933
28032
|
|
|
27934
28033
|
// src/agents/acp/onboarding.ts
|
|
27935
28034
|
var import_child_process26 = require("child_process");
|
|
27936
|
-
var
|
|
27937
|
-
var
|
|
27938
|
-
var
|
|
28035
|
+
var fs60 = __toESM(require("fs"));
|
|
28036
|
+
var os49 = __toESM(require("os"));
|
|
28037
|
+
var path65 = __toESM(require("path"));
|
|
27939
28038
|
var _onboardingSeam = {
|
|
27940
|
-
markerPath: (sessionId) =>
|
|
27941
|
-
exists: (p2) =>
|
|
28039
|
+
markerPath: (sessionId) => path65.join(os49.homedir(), ".codeam", "welcomed", `${sessionId}.done`),
|
|
28040
|
+
exists: (p2) => fs60.existsSync(p2),
|
|
27942
28041
|
write: (p2) => {
|
|
27943
|
-
|
|
27944
|
-
|
|
28042
|
+
fs60.mkdirSync(path65.dirname(p2), { recursive: true });
|
|
28043
|
+
fs60.writeFileSync(p2, "");
|
|
27945
28044
|
},
|
|
27946
28045
|
disabled: () => {
|
|
27947
28046
|
const v = process.env.CODEAM_ONBOARDING_DISABLED;
|
|
@@ -27978,7 +28077,7 @@ function resolveRepoName(cwd) {
|
|
|
27978
28077
|
if (name) return name;
|
|
27979
28078
|
}
|
|
27980
28079
|
}
|
|
27981
|
-
const base =
|
|
28080
|
+
const base = path65.basename(cwd || "");
|
|
27982
28081
|
if (base && !isUuid(base)) return base;
|
|
27983
28082
|
return "this project";
|
|
27984
28083
|
}
|
|
@@ -28230,8 +28329,8 @@ var import_crypto5 = require("crypto");
|
|
|
28230
28329
|
|
|
28231
28330
|
// src/services/turn-files/git-changeset.ts
|
|
28232
28331
|
var import_child_process27 = require("child_process");
|
|
28233
|
-
var
|
|
28234
|
-
var
|
|
28332
|
+
var fs61 = __toESM(require("fs/promises"));
|
|
28333
|
+
var path66 = __toESM(require("path"));
|
|
28235
28334
|
async function collectRepoChangeset(opts) {
|
|
28236
28335
|
const status2 = await runGit3(opts.repoRoot, ["status", "--porcelain=v1", "-z"]);
|
|
28237
28336
|
if (status2 === null) return null;
|
|
@@ -28249,7 +28348,7 @@ async function collectRepoChangeset(opts) {
|
|
|
28249
28348
|
let stats;
|
|
28250
28349
|
if (row.fileStatus === "added" && numstatEntry === void 0) {
|
|
28251
28350
|
const lineCount = await readUntrackedLineCount(
|
|
28252
|
-
|
|
28351
|
+
path66.join(opts.repoRoot, row.filePath)
|
|
28253
28352
|
);
|
|
28254
28353
|
stats = { added: lineCount, removed: 0 };
|
|
28255
28354
|
} else {
|
|
@@ -28280,7 +28379,7 @@ function readUntrackedLineCount(absPath) {
|
|
|
28280
28379
|
}
|
|
28281
28380
|
async function defaultReadUntrackedLineCount(absPath) {
|
|
28282
28381
|
try {
|
|
28283
|
-
const content = await
|
|
28382
|
+
const content = await fs61.readFile(absPath, "utf8");
|
|
28284
28383
|
let count = 0;
|
|
28285
28384
|
let pos = -1;
|
|
28286
28385
|
while ((pos = content.indexOf("\n", pos + 1)) !== -1) {
|
|
@@ -28372,7 +28471,7 @@ function defaultRunGit(cwd, args2) {
|
|
|
28372
28471
|
});
|
|
28373
28472
|
}
|
|
28374
28473
|
async function discoverRepos(workingDir, maxDepth = 4) {
|
|
28375
|
-
const
|
|
28474
|
+
const fs66 = await import("fs/promises");
|
|
28376
28475
|
const out2 = [];
|
|
28377
28476
|
await walk(workingDir, 0);
|
|
28378
28477
|
return out2;
|
|
@@ -28380,7 +28479,7 @@ async function discoverRepos(workingDir, maxDepth = 4) {
|
|
|
28380
28479
|
if (depth > maxDepth) return;
|
|
28381
28480
|
let entries = [];
|
|
28382
28481
|
try {
|
|
28383
|
-
const dirents = await
|
|
28482
|
+
const dirents = await fs66.readdir(dir, { withFileTypes: true });
|
|
28384
28483
|
entries = dirents.filter((d3) => !d3.name.startsWith(".") || d3.name === ".git").map((d3) => ({ name: d3.name, isDirectory: d3.isDirectory() }));
|
|
28385
28484
|
} catch {
|
|
28386
28485
|
return;
|
|
@@ -28391,8 +28490,8 @@ async function discoverRepos(workingDir, maxDepth = 4) {
|
|
|
28391
28490
|
if (hasGit) {
|
|
28392
28491
|
out2.push({
|
|
28393
28492
|
repoRoot: dir,
|
|
28394
|
-
repoPath:
|
|
28395
|
-
repoName:
|
|
28493
|
+
repoPath: path66.relative(workingDir, dir),
|
|
28494
|
+
repoName: path66.basename(dir)
|
|
28396
28495
|
});
|
|
28397
28496
|
return;
|
|
28398
28497
|
}
|
|
@@ -28400,14 +28499,14 @@ async function discoverRepos(workingDir, maxDepth = 4) {
|
|
|
28400
28499
|
if (!entry.isDirectory) continue;
|
|
28401
28500
|
if (entry.name === "node_modules") continue;
|
|
28402
28501
|
if (entry.name === "dist" || entry.name === "build") continue;
|
|
28403
|
-
await walk(
|
|
28502
|
+
await walk(path66.join(dir, entry.name), depth + 1);
|
|
28404
28503
|
}
|
|
28405
28504
|
}
|
|
28406
28505
|
}
|
|
28407
28506
|
|
|
28408
28507
|
// src/services/turn-files/files-outbox.ts
|
|
28409
|
-
var
|
|
28410
|
-
var
|
|
28508
|
+
var fs62 = __toESM(require("fs/promises"));
|
|
28509
|
+
var path67 = __toESM(require("path"));
|
|
28411
28510
|
var import_os11 = require("os");
|
|
28412
28511
|
var HOME_OUTBOX_DIR = ".codeam/outbox";
|
|
28413
28512
|
var MAX_AGE_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -28440,16 +28539,16 @@ var FilesOutbox = class {
|
|
|
28440
28539
|
backoffIndex = 0;
|
|
28441
28540
|
stopped = false;
|
|
28442
28541
|
constructor(opts) {
|
|
28443
|
-
const base = opts.baseDir ??
|
|
28444
|
-
this.filePath =
|
|
28542
|
+
const base = opts.baseDir ?? path67.join(homeDir(), HOME_OUTBOX_DIR);
|
|
28543
|
+
this.filePath = path67.join(base, `${opts.sessionId}.jsonl`);
|
|
28445
28544
|
this.post = opts.post;
|
|
28446
28545
|
this.autoSchedule = opts.autoSchedule !== false;
|
|
28447
28546
|
}
|
|
28448
28547
|
/** Persist the entry to disk and trigger a flush. Returns once the
|
|
28449
28548
|
* line is durable on disk (not once the POST succeeds). */
|
|
28450
28549
|
async enqueue(entry) {
|
|
28451
|
-
await
|
|
28452
|
-
await
|
|
28550
|
+
await fs62.mkdir(path67.dirname(this.filePath), { recursive: true });
|
|
28551
|
+
await fs62.appendFile(this.filePath, JSON.stringify(entry) + "\n", "utf8");
|
|
28453
28552
|
this.backoffIndex = 0;
|
|
28454
28553
|
if (this.autoSchedule) this.scheduleFlush(0);
|
|
28455
28554
|
}
|
|
@@ -28540,7 +28639,7 @@ var FilesOutbox = class {
|
|
|
28540
28639
|
async readAll() {
|
|
28541
28640
|
let raw = "";
|
|
28542
28641
|
try {
|
|
28543
|
-
raw = await
|
|
28642
|
+
raw = await fs62.readFile(this.filePath, "utf8");
|
|
28544
28643
|
} catch {
|
|
28545
28644
|
return [];
|
|
28546
28645
|
}
|
|
@@ -28564,12 +28663,12 @@ var FilesOutbox = class {
|
|
|
28564
28663
|
async rewrite(entries) {
|
|
28565
28664
|
const tmpPath = `${this.filePath}.${process.pid}.tmp`;
|
|
28566
28665
|
if (entries.length === 0) {
|
|
28567
|
-
await
|
|
28666
|
+
await fs62.unlink(this.filePath).catch(() => void 0);
|
|
28568
28667
|
return;
|
|
28569
28668
|
}
|
|
28570
28669
|
const payload = entries.map((e) => JSON.stringify(e)).join("\n") + "\n";
|
|
28571
|
-
await
|
|
28572
|
-
await
|
|
28670
|
+
await fs62.writeFile(tmpPath, payload, "utf8");
|
|
28671
|
+
await fs62.rename(tmpPath, this.filePath);
|
|
28573
28672
|
}
|
|
28574
28673
|
};
|
|
28575
28674
|
function applyJitter(ms) {
|
|
@@ -31719,7 +31818,7 @@ var AcpDriver = class {
|
|
|
31719
31818
|
};
|
|
31720
31819
|
|
|
31721
31820
|
// src/baton/transcript-mirror.ts
|
|
31722
|
-
var
|
|
31821
|
+
var fs63 = __toESM(require("fs"));
|
|
31723
31822
|
var TranscriptMirror = class {
|
|
31724
31823
|
constructor(deps) {
|
|
31725
31824
|
this.deps = deps;
|
|
@@ -31786,7 +31885,7 @@ var TranscriptMirror = class {
|
|
|
31786
31885
|
}
|
|
31787
31886
|
};
|
|
31788
31887
|
function defaultWatch(file, onChange) {
|
|
31789
|
-
const w3 =
|
|
31888
|
+
const w3 = fs63.watch(file, { persistent: false }, () => onChange());
|
|
31790
31889
|
return () => w3.close();
|
|
31791
31890
|
}
|
|
31792
31891
|
|
|
@@ -32048,15 +32147,15 @@ function toEpochMs(ts) {
|
|
|
32048
32147
|
}
|
|
32049
32148
|
|
|
32050
32149
|
// src/agents/claude/onboarding.ts
|
|
32051
|
-
var
|
|
32052
|
-
var
|
|
32053
|
-
var
|
|
32150
|
+
var fs64 = __toESM(require("fs"));
|
|
32151
|
+
var os50 = __toESM(require("os"));
|
|
32152
|
+
var path68 = __toESM(require("path"));
|
|
32054
32153
|
function ensureClaudeOnboarded(cwd) {
|
|
32055
32154
|
try {
|
|
32056
|
-
const file =
|
|
32155
|
+
const file = path68.join(os50.homedir(), ".claude.json");
|
|
32057
32156
|
let config = {};
|
|
32058
32157
|
try {
|
|
32059
|
-
config = JSON.parse(
|
|
32158
|
+
config = JSON.parse(fs64.readFileSync(file, "utf8"));
|
|
32060
32159
|
} catch {
|
|
32061
32160
|
}
|
|
32062
32161
|
let changed = false;
|
|
@@ -32080,8 +32179,8 @@ function ensureClaudeOnboarded(cwd) {
|
|
|
32080
32179
|
}
|
|
32081
32180
|
}
|
|
32082
32181
|
if (!changed) return;
|
|
32083
|
-
|
|
32084
|
-
|
|
32182
|
+
fs64.mkdirSync(path68.dirname(file), { recursive: true });
|
|
32183
|
+
fs64.writeFileSync(file, JSON.stringify(config, null, 2));
|
|
32085
32184
|
log.info(
|
|
32086
32185
|
"claude",
|
|
32087
32186
|
`pre-completed Claude onboarding${cwd ? ` + trusted workspace ${cwd}` : ""}`
|
|
@@ -32767,7 +32866,7 @@ var import_picocolors11 = __toESM(require("picocolors"));
|
|
|
32767
32866
|
var import_child_process28 = require("child_process");
|
|
32768
32867
|
var import_util4 = require("util");
|
|
32769
32868
|
var import_picocolors9 = __toESM(require("picocolors"));
|
|
32770
|
-
var
|
|
32869
|
+
var path69 = __toESM(require("path"));
|
|
32771
32870
|
var execFileP6 = (0, import_util4.promisify)(import_child_process28.execFile);
|
|
32772
32871
|
var MAX_BUFFER = 8 * 1024 * 1024;
|
|
32773
32872
|
function resetStdinForChild() {
|
|
@@ -33256,7 +33355,7 @@ var GitHubCodespacesProvider = class {
|
|
|
33256
33355
|
});
|
|
33257
33356
|
}
|
|
33258
33357
|
async uploadFile(workspaceId, remotePath, contents, options = {}) {
|
|
33259
|
-
const remoteDir =
|
|
33358
|
+
const remoteDir = path69.posix.dirname(remotePath);
|
|
33260
33359
|
const parts = [
|
|
33261
33360
|
`mkdir -p ${shellQuote(remoteDir)}`,
|
|
33262
33361
|
`cat > ${shellQuote(remotePath)}`
|
|
@@ -33326,7 +33425,7 @@ function shellQuote(s) {
|
|
|
33326
33425
|
// src/services/providers/gitpod.ts
|
|
33327
33426
|
var import_child_process29 = require("child_process");
|
|
33328
33427
|
var import_util5 = require("util");
|
|
33329
|
-
var
|
|
33428
|
+
var path70 = __toESM(require("path"));
|
|
33330
33429
|
var import_picocolors10 = __toESM(require("picocolors"));
|
|
33331
33430
|
var execFileP7 = (0, import_util5.promisify)(import_child_process29.execFile);
|
|
33332
33431
|
var MAX_BUFFER2 = 8 * 1024 * 1024;
|
|
@@ -33566,7 +33665,7 @@ var GitpodProvider = class {
|
|
|
33566
33665
|
});
|
|
33567
33666
|
}
|
|
33568
33667
|
async uploadFile(workspaceId, remotePath, contents, options = {}) {
|
|
33569
|
-
const remoteDir =
|
|
33668
|
+
const remoteDir = path70.posix.dirname(remotePath);
|
|
33570
33669
|
const parts = [
|
|
33571
33670
|
`mkdir -p ${shellQuote2(remoteDir)}`,
|
|
33572
33671
|
`cat > ${shellQuote2(remotePath)}`
|
|
@@ -33602,7 +33701,7 @@ function shellQuote2(s) {
|
|
|
33602
33701
|
// src/services/providers/gitlab-workspaces.ts
|
|
33603
33702
|
var import_child_process30 = require("child_process");
|
|
33604
33703
|
var import_util6 = require("util");
|
|
33605
|
-
var
|
|
33704
|
+
var path71 = __toESM(require("path"));
|
|
33606
33705
|
var execFileP8 = (0, import_util6.promisify)(import_child_process30.execFile);
|
|
33607
33706
|
var MAX_BUFFER3 = 8 * 1024 * 1024;
|
|
33608
33707
|
var GITLAB_API_BASE = process.env.CODEAM_GITLAB_API_URL ?? "https://gitlab.com/api/v4";
|
|
@@ -33862,7 +33961,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
33862
33961
|
}
|
|
33863
33962
|
async uploadFile(workspaceId, remotePath, contents, options = {}) {
|
|
33864
33963
|
const sshHost = process.env.CODEAM_GITLAB_SSH_HOST ?? "workspaces.gitlab.com";
|
|
33865
|
-
const remoteDir =
|
|
33964
|
+
const remoteDir = path71.posix.dirname(remotePath);
|
|
33866
33965
|
const parts = [`mkdir -p ${shellQuote3(remoteDir)}`, `cat > ${shellQuote3(remotePath)}`];
|
|
33867
33966
|
if (options.mode != null) {
|
|
33868
33967
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote3(remotePath)}`);
|
|
@@ -33930,7 +34029,7 @@ function shellQuote3(s) {
|
|
|
33930
34029
|
// src/services/providers/railway.ts
|
|
33931
34030
|
var import_child_process31 = require("child_process");
|
|
33932
34031
|
var import_util7 = require("util");
|
|
33933
|
-
var
|
|
34032
|
+
var path72 = __toESM(require("path"));
|
|
33934
34033
|
var execFileP9 = (0, import_util7.promisify)(import_child_process31.execFile);
|
|
33935
34034
|
var MAX_BUFFER4 = 8 * 1024 * 1024;
|
|
33936
34035
|
function resetStdinForChild4() {
|
|
@@ -34166,7 +34265,7 @@ var RailwayProvider = class {
|
|
|
34166
34265
|
if (!projectId || !serviceId) {
|
|
34167
34266
|
throw new Error("Invalid Railway workspace id (expected projectId/serviceId).");
|
|
34168
34267
|
}
|
|
34169
|
-
const remoteDir =
|
|
34268
|
+
const remoteDir = path72.posix.dirname(remotePath);
|
|
34170
34269
|
const parts = [`mkdir -p ${shellQuote4(remoteDir)}`, `cat > ${shellQuote4(remotePath)}`];
|
|
34171
34270
|
if (options.mode != null) {
|
|
34172
34271
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote4(remotePath)}`);
|
|
@@ -34812,8 +34911,8 @@ async function invite() {
|
|
|
34812
34911
|
var import_node_dns = require("dns");
|
|
34813
34912
|
var import_node_util5 = require("util");
|
|
34814
34913
|
var import_node_crypto12 = require("crypto");
|
|
34815
|
-
var
|
|
34816
|
-
var
|
|
34914
|
+
var fs65 = __toESM(require("fs"));
|
|
34915
|
+
var path73 = __toESM(require("path"));
|
|
34817
34916
|
var import_picocolors14 = __toESM(require("picocolors"));
|
|
34818
34917
|
var dnsResolveP = (0, import_node_util5.promisify)(import_node_dns.resolve);
|
|
34819
34918
|
async function checkDns(apiBase2) {
|
|
@@ -34869,13 +34968,13 @@ async function checkHealth(apiBase2) {
|
|
|
34869
34968
|
}
|
|
34870
34969
|
}
|
|
34871
34970
|
function checkConfigDir() {
|
|
34872
|
-
const dir =
|
|
34971
|
+
const dir = path73.join(require("os").homedir(), ".codeam");
|
|
34873
34972
|
try {
|
|
34874
|
-
|
|
34875
|
-
const probe =
|
|
34876
|
-
|
|
34877
|
-
const read2 =
|
|
34878
|
-
|
|
34973
|
+
fs65.mkdirSync(dir, { recursive: true, mode: 448 });
|
|
34974
|
+
const probe = path73.join(dir, ".doctor-probe");
|
|
34975
|
+
fs65.writeFileSync(probe, "ok", { mode: 384 });
|
|
34976
|
+
const read2 = fs65.readFileSync(probe, "utf8");
|
|
34977
|
+
fs65.unlinkSync(probe);
|
|
34879
34978
|
if (read2 !== "ok") throw new Error("write/read round-trip mismatch");
|
|
34880
34979
|
return {
|
|
34881
34980
|
id: "config-dir",
|
|
@@ -34915,9 +35014,9 @@ function checkSessions() {
|
|
|
34915
35014
|
}
|
|
34916
35015
|
}
|
|
34917
35016
|
function checkAgentBinaries() {
|
|
34918
|
-
const
|
|
35017
|
+
const os52 = createOsStrategy();
|
|
34919
35018
|
return getEnabledAgents().map((meta) => {
|
|
34920
|
-
const found =
|
|
35019
|
+
const found = os52.findInPath(meta.binaryName);
|
|
34921
35020
|
return {
|
|
34922
35021
|
id: `agent-${meta.id}`,
|
|
34923
35022
|
label: `Agent binary: ${meta.displayName} (${meta.binaryName})`,
|
|
@@ -34939,7 +35038,7 @@ function checkNodePty() {
|
|
|
34939
35038
|
detail: "not required on this platform"
|
|
34940
35039
|
};
|
|
34941
35040
|
}
|
|
34942
|
-
const vendoredPath =
|
|
35041
|
+
const vendoredPath = path73.join(__dirname, "vendor", "node-pty");
|
|
34943
35042
|
for (const target of [vendoredPath, "node-pty"]) {
|
|
34944
35043
|
try {
|
|
34945
35044
|
require(target);
|
|
@@ -34981,7 +35080,7 @@ function checkChokidar() {
|
|
|
34981
35080
|
}
|
|
34982
35081
|
async function doctor(args2 = []) {
|
|
34983
35082
|
const json = args2.includes("--json");
|
|
34984
|
-
const cliVersion = true ? "2.60.
|
|
35083
|
+
const cliVersion = true ? "2.60.57" : "0.0.0-dev";
|
|
34985
35084
|
const apiBase2 = resolveApiBaseUrl();
|
|
34986
35085
|
const diagnosticId = (0, import_node_crypto12.randomUUID)();
|
|
34987
35086
|
log.info("doctor", `run id=${diagnosticId} cli=${cliVersion}`);
|
|
@@ -35458,7 +35557,7 @@ async function mcpRun(args2) {
|
|
|
35458
35557
|
// src/commands/version.ts
|
|
35459
35558
|
var import_picocolors15 = __toESM(require("picocolors"));
|
|
35460
35559
|
function version2() {
|
|
35461
|
-
const v = true ? "2.60.
|
|
35560
|
+
const v = true ? "2.60.57" : "unknown";
|
|
35462
35561
|
console.log(`${import_picocolors15.default.bold("codeam-cli")} ${import_picocolors15.default.cyan(v)}`);
|
|
35463
35562
|
}
|
|
35464
35563
|
|
|
@@ -35607,10 +35706,10 @@ var EXIT_CODE_NAMES = {
|
|
|
35607
35706
|
};
|
|
35608
35707
|
|
|
35609
35708
|
// src/index.ts
|
|
35610
|
-
var
|
|
35709
|
+
var os51 = __toESM(require("os"));
|
|
35611
35710
|
if (!process.env.HOME) {
|
|
35612
35711
|
try {
|
|
35613
|
-
const home =
|
|
35712
|
+
const home = os51.homedir();
|
|
35614
35713
|
if (home) process.env.HOME = home;
|
|
35615
35714
|
} catch {
|
|
35616
35715
|
}
|