codeam-cli 2.60.56 → 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 +6 -0
- package/dist/index.js +369 -275
- 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.`
|
|
@@ -15862,26 +15862,26 @@ function restoreCoderabbitOauthBlob(value) {
|
|
|
15862
15862
|
(0, import_node_fs5.writeFileSync)(path36.join(dir, file), contents, { mode: 384 });
|
|
15863
15863
|
}
|
|
15864
15864
|
async function configureCoderabbit(input, deps = {}) {
|
|
15865
|
-
const
|
|
15865
|
+
const os52 = deps.os ?? createOsStrategy();
|
|
15866
15866
|
const ensureInstalled = deps.ensureInstalled ?? ensureCoderabbitInstalled;
|
|
15867
15867
|
const isLoggedIn = deps.isLoggedIn ?? defaultIsLoggedIn;
|
|
15868
15868
|
const runOAuth = deps.runOAuthLogin ?? runCoderabbitOAuthLogin;
|
|
15869
15869
|
const snapshot = deps.snapshotDir ?? (() => snapshotCredentialDir());
|
|
15870
15870
|
const capture2 = deps.captureCredential ?? ((b) => diffCapturedCredential(b));
|
|
15871
15871
|
const loginWithApiKey = deps.loginWithApiKey ?? defaultLoginWithApiKey;
|
|
15872
|
-
const home =
|
|
15873
|
-
|
|
15874
|
-
|
|
15872
|
+
const home = os52.homeDir();
|
|
15873
|
+
os52.augmentPath(
|
|
15874
|
+
os52.id === "win32" ? [
|
|
15875
15875
|
path36.join(home, ".local", "bin"),
|
|
15876
15876
|
path36.join(process.env.APPDATA ?? path36.join(home, "AppData", "Roaming"), "npm"),
|
|
15877
15877
|
path36.join(home, "scoop", "shims")
|
|
15878
15878
|
] : [path36.join(home, ".local", "bin"), "/opt/homebrew/bin", "/usr/local/bin"]
|
|
15879
15879
|
);
|
|
15880
|
-
const installed2 =
|
|
15880
|
+
const installed2 = os52.findInPath("coderabbit") !== null;
|
|
15881
15881
|
const base = () => ({
|
|
15882
15882
|
action: input.action,
|
|
15883
15883
|
supported: true,
|
|
15884
|
-
installed:
|
|
15884
|
+
installed: os52.findInPath("coderabbit") !== null,
|
|
15885
15885
|
loggedIn: false
|
|
15886
15886
|
});
|
|
15887
15887
|
if (input.action === "status") {
|
|
@@ -15895,7 +15895,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
15895
15895
|
const key = (input.apiKey ?? "").trim();
|
|
15896
15896
|
if (!key) return { ...res2, error: "No API key provided" };
|
|
15897
15897
|
if (!res2.installed) {
|
|
15898
|
-
const ok = await ensureInstalled(
|
|
15898
|
+
const ok = await ensureInstalled(os52);
|
|
15899
15899
|
res2.installed = ok;
|
|
15900
15900
|
if (!ok) return { ...res2, error: "CodeRabbit CLI could not be installed" };
|
|
15901
15901
|
}
|
|
@@ -15919,7 +15919,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
15919
15919
|
}
|
|
15920
15920
|
if (!res2.installed) {
|
|
15921
15921
|
deps.onEvent?.({ kind: "installing" });
|
|
15922
|
-
const ok = await ensureInstalled(
|
|
15922
|
+
const ok = await ensureInstalled(os52);
|
|
15923
15923
|
res2.installed = ok;
|
|
15924
15924
|
if (!ok) return { ...res2, error: "CodeRabbit CLI could not be installed" };
|
|
15925
15925
|
}
|
|
@@ -15949,7 +15949,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
15949
15949
|
const res2 = base();
|
|
15950
15950
|
if (!installed2) {
|
|
15951
15951
|
deps.onEvent?.({ kind: "installing" });
|
|
15952
|
-
const ok = await ensureInstalled(
|
|
15952
|
+
const ok = await ensureInstalled(os52);
|
|
15953
15953
|
res2.installed = ok;
|
|
15954
15954
|
if (!ok) return { ...res2, error: "CodeRabbit CLI could not be installed" };
|
|
15955
15955
|
}
|
|
@@ -15989,7 +15989,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
15989
15989
|
}
|
|
15990
15990
|
const res = base();
|
|
15991
15991
|
if (!res.installed) {
|
|
15992
|
-
const ok = await ensureInstalled(
|
|
15992
|
+
const ok = await ensureInstalled(os52);
|
|
15993
15993
|
res.installed = ok;
|
|
15994
15994
|
if (!ok) return { ...res, error: "CodeRabbit CLI is not installed" };
|
|
15995
15995
|
}
|
|
@@ -17614,7 +17614,7 @@ async function autoUpgradeBeforeCriticalCommand() {
|
|
|
17614
17614
|
if (process.env.NODE_ENV === "test") return;
|
|
17615
17615
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
17616
17616
|
if (process.env.CI) return;
|
|
17617
|
-
const current = true ? "2.60.
|
|
17617
|
+
const current = true ? "2.60.57" : null;
|
|
17618
17618
|
if (!current) return;
|
|
17619
17619
|
const cache = readCache();
|
|
17620
17620
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
|
@@ -17631,7 +17631,7 @@ function checkForUpdates() {
|
|
|
17631
17631
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
17632
17632
|
if (process.env.CI) return;
|
|
17633
17633
|
if (!process.stdout.isTTY) return;
|
|
17634
|
-
const current = true ? "2.60.
|
|
17634
|
+
const current = true ? "2.60.57" : null;
|
|
17635
17635
|
if (!current) return;
|
|
17636
17636
|
const cache = readCache();
|
|
17637
17637
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
|
@@ -17651,7 +17651,7 @@ var SELF_UPDATE_INTERVAL_MS = 60 * 60 * 1e3;
|
|
|
17651
17651
|
var SELF_UPDATE_VIEW_TIMEOUT_MS = 3e4;
|
|
17652
17652
|
var SELF_UPDATE_INSTALL_TIMEOUT_MS = 18e4;
|
|
17653
17653
|
function currentCliVersion() {
|
|
17654
|
-
return true ? "2.60.
|
|
17654
|
+
return true ? "2.60.57" : null;
|
|
17655
17655
|
}
|
|
17656
17656
|
function runCmd(cmd, args2, timeoutMs) {
|
|
17657
17657
|
return new Promise((resolve7) => {
|
|
@@ -18679,6 +18679,85 @@ function makeRealApplyBudgetDeps() {
|
|
|
18679
18679
|
};
|
|
18680
18680
|
}
|
|
18681
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
|
+
|
|
18682
18761
|
// src/services/preview/cloudflared.ts
|
|
18683
18762
|
var import_child_process14 = require("child_process");
|
|
18684
18763
|
var import_fs = require("fs");
|
|
@@ -19328,6 +19407,7 @@ function killProcessTree(child, signal = "SIGTERM") {
|
|
|
19328
19407
|
async function killPreview(sessionId) {
|
|
19329
19408
|
const preview = activePreviews.get(sessionId);
|
|
19330
19409
|
if (!preview) return;
|
|
19410
|
+
forgetPreviewPort(preview.detection.port);
|
|
19331
19411
|
if (preview.tunnel) {
|
|
19332
19412
|
killProcessTree(preview.tunnel, "SIGTERM");
|
|
19333
19413
|
}
|
|
@@ -19350,8 +19430,8 @@ function activePreviewSessionIds() {
|
|
|
19350
19430
|
|
|
19351
19431
|
// src/services/preview/start-orchestrator.ts
|
|
19352
19432
|
var import_child_process17 = require("child_process");
|
|
19353
|
-
var
|
|
19354
|
-
var
|
|
19433
|
+
var fs49 = __toESM(require("fs"));
|
|
19434
|
+
var path52 = __toESM(require("path"));
|
|
19355
19435
|
var import_which2 = __toESM(require("which"));
|
|
19356
19436
|
var INSTALL_TIMEOUT_MS = 5 * 6e4;
|
|
19357
19437
|
var SETUP_TIMEOUT_MS = 2 * 6e4;
|
|
@@ -19418,8 +19498,8 @@ function normalizeDetectionForSpawn(detection, cwd) {
|
|
|
19418
19498
|
if (args2.length === 0) return detection;
|
|
19419
19499
|
const binName = args2[0];
|
|
19420
19500
|
if (binName.startsWith("-")) return detection;
|
|
19421
|
-
const binPath =
|
|
19422
|
-
if (!
|
|
19501
|
+
const binPath = path52.join(cwd, "node_modules", ".bin", binName);
|
|
19502
|
+
if (!fs49.existsSync(binPath)) return detection;
|
|
19423
19503
|
return {
|
|
19424
19504
|
...detection,
|
|
19425
19505
|
command: binPath,
|
|
@@ -19467,6 +19547,7 @@ async function runPreviewStart(args2) {
|
|
|
19467
19547
|
framework: detection.framework,
|
|
19468
19548
|
detection
|
|
19469
19549
|
});
|
|
19550
|
+
recordPreviewPort(detection.port, dev.devServer.pid, sessionId, Date.now());
|
|
19470
19551
|
log.info("preview", `ready: ${detection.framework} at ${tun.url}`);
|
|
19471
19552
|
emit2(USER_EVENTS.PREVIEW_READY, {
|
|
19472
19553
|
url: tun.url,
|
|
@@ -19602,6 +19683,19 @@ async function startDevServer(ctx) {
|
|
|
19602
19683
|
});
|
|
19603
19684
|
return null;
|
|
19604
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
|
+
}
|
|
19605
19699
|
} else {
|
|
19606
19700
|
emit2(USER_EVENTS.PREVIEW_ERROR, {
|
|
19607
19701
|
stage: "spawn",
|
|
@@ -19769,9 +19863,9 @@ async function establishTunnel(ctx, dev) {
|
|
|
19769
19863
|
|
|
19770
19864
|
// src/beads/bd-adapter.ts
|
|
19771
19865
|
var import_child_process18 = require("child_process");
|
|
19772
|
-
var
|
|
19773
|
-
var
|
|
19774
|
-
var
|
|
19866
|
+
var fs50 = __toESM(require("fs"));
|
|
19867
|
+
var os40 = __toESM(require("os"));
|
|
19868
|
+
var path53 = __toESM(require("path"));
|
|
19775
19869
|
var BD_PACKAGE = "@beads/bd";
|
|
19776
19870
|
function resolveBundledBdBinary() {
|
|
19777
19871
|
return _resolveSeam.resolveBundled();
|
|
@@ -19783,11 +19877,11 @@ function _defaultResolveBundled() {
|
|
|
19783
19877
|
} catch {
|
|
19784
19878
|
return null;
|
|
19785
19879
|
}
|
|
19786
|
-
const binDir =
|
|
19880
|
+
const binDir = path53.join(path53.dirname(pkgJsonPath), "bin");
|
|
19787
19881
|
const binaryName = process.platform === "win32" ? "bd.exe" : "bd";
|
|
19788
|
-
const binaryPath =
|
|
19882
|
+
const binaryPath = path53.join(binDir, binaryName);
|
|
19789
19883
|
try {
|
|
19790
|
-
|
|
19884
|
+
fs50.accessSync(binaryPath, fs50.constants.F_OK);
|
|
19791
19885
|
return binaryPath;
|
|
19792
19886
|
} catch {
|
|
19793
19887
|
return null;
|
|
@@ -19797,13 +19891,13 @@ function resolveBdOnPath() {
|
|
|
19797
19891
|
return _resolveSeam.resolveOnPath();
|
|
19798
19892
|
}
|
|
19799
19893
|
function _defaultResolveOnPath() {
|
|
19800
|
-
const dirs = (process.env.PATH ?? "").split(
|
|
19894
|
+
const dirs = (process.env.PATH ?? "").split(path53.delimiter).filter(Boolean);
|
|
19801
19895
|
const candidates = process.platform === "win32" ? ["bd.exe", "bd.cmd", "bd"] : ["bd"];
|
|
19802
19896
|
for (const dir of dirs) {
|
|
19803
19897
|
for (const candidate of candidates) {
|
|
19804
|
-
const full =
|
|
19898
|
+
const full = path53.join(dir, candidate);
|
|
19805
19899
|
try {
|
|
19806
|
-
|
|
19900
|
+
fs50.accessSync(full, fs50.constants.F_OK);
|
|
19807
19901
|
return full;
|
|
19808
19902
|
} catch {
|
|
19809
19903
|
}
|
|
@@ -19888,7 +19982,7 @@ var BdAdapter = class {
|
|
|
19888
19982
|
const env = { ...process.env };
|
|
19889
19983
|
if (!env.HOME) {
|
|
19890
19984
|
try {
|
|
19891
|
-
const home =
|
|
19985
|
+
const home = os40.homedir();
|
|
19892
19986
|
if (home) env.HOME = home;
|
|
19893
19987
|
} catch {
|
|
19894
19988
|
}
|
|
@@ -19980,9 +20074,9 @@ function coerceIssue(row, projectKey) {
|
|
|
19980
20074
|
|
|
19981
20075
|
// src/beads/provisioner.ts
|
|
19982
20076
|
var import_child_process22 = require("child_process");
|
|
19983
|
-
var
|
|
19984
|
-
var
|
|
19985
|
-
var
|
|
20077
|
+
var fs53 = __toESM(require("fs"));
|
|
20078
|
+
var os42 = __toESM(require("os"));
|
|
20079
|
+
var path56 = __toESM(require("path"));
|
|
19986
20080
|
|
|
19987
20081
|
// src/beads/install-bd.ts
|
|
19988
20082
|
var import_child_process19 = require("child_process");
|
|
@@ -20047,9 +20141,9 @@ async function installBd(platform3 = process.platform) {
|
|
|
20047
20141
|
|
|
20048
20142
|
// src/beads/install-dolt.ts
|
|
20049
20143
|
var import_child_process20 = require("child_process");
|
|
20050
|
-
var
|
|
20051
|
-
var
|
|
20052
|
-
var
|
|
20144
|
+
var fs51 = __toESM(require("fs"));
|
|
20145
|
+
var os41 = __toESM(require("os"));
|
|
20146
|
+
var path54 = __toESM(require("path"));
|
|
20053
20147
|
var DOLT_INSTALL_SH_URL = "https://github.com/dolthub/dolt/releases/latest/download/install.sh";
|
|
20054
20148
|
var DOLT_MSI_URL = "https://github.com/dolthub/dolt/releases/latest/download/dolt-windows-amd64.msi";
|
|
20055
20149
|
function resolveDoltInstallStrategy(platform3) {
|
|
@@ -20089,11 +20183,11 @@ function resolveDoltInstallStrategy(platform3) {
|
|
|
20089
20183
|
}
|
|
20090
20184
|
var DOLT_RELEASE_BASE = "https://github.com/dolthub/dolt/releases/latest/download";
|
|
20091
20185
|
function doltPlatformTuple(platform3, arch2) {
|
|
20092
|
-
const
|
|
20186
|
+
const os52 = platform3 === "win32" ? "windows" : platform3 === "darwin" ? "darwin" : "linux";
|
|
20093
20187
|
const a = arch2 === "x64" ? "amd64" : arch2 === "arm64" ? "arm64" : null;
|
|
20094
20188
|
if (!a) return null;
|
|
20095
|
-
if (
|
|
20096
|
-
return `${
|
|
20189
|
+
if (os52 === "windows" && a !== "amd64") return null;
|
|
20190
|
+
return `${os52}-${a}`;
|
|
20097
20191
|
}
|
|
20098
20192
|
function resolveDoltTarballStrategy(targetDir, platform3, arch2) {
|
|
20099
20193
|
const tuple = doltPlatformTuple(platform3, arch2);
|
|
@@ -20138,14 +20232,14 @@ async function installDoltToDir(targetDir, platform3 = process.platform, arch2 =
|
|
|
20138
20232
|
return result;
|
|
20139
20233
|
}
|
|
20140
20234
|
var _doltPathSeam = {
|
|
20141
|
-
homedir: () =>
|
|
20235
|
+
homedir: () => os41.homedir(),
|
|
20142
20236
|
getPath: () => process.env.PATH ?? "",
|
|
20143
20237
|
setPath: (p2) => {
|
|
20144
20238
|
process.env.PATH = p2;
|
|
20145
20239
|
},
|
|
20146
20240
|
exists: (p2) => {
|
|
20147
20241
|
try {
|
|
20148
|
-
|
|
20242
|
+
fs51.accessSync(p2, fs51.constants.F_OK);
|
|
20149
20243
|
return true;
|
|
20150
20244
|
} catch {
|
|
20151
20245
|
return false;
|
|
@@ -20156,7 +20250,7 @@ function doltBinaryNames(platform3) {
|
|
|
20156
20250
|
return platform3 === "win32" ? ["dolt.exe", "dolt.cmd", "dolt"] : ["dolt"];
|
|
20157
20251
|
}
|
|
20158
20252
|
function knownDoltDirs(platform3) {
|
|
20159
|
-
const P3 = platform3 === "win32" ?
|
|
20253
|
+
const P3 = platform3 === "win32" ? path54.win32 : path54.posix;
|
|
20160
20254
|
const home = _doltPathSeam.homedir();
|
|
20161
20255
|
if (platform3 === "win32") {
|
|
20162
20256
|
return [
|
|
@@ -20172,7 +20266,7 @@ function knownDoltDirs(platform3) {
|
|
|
20172
20266
|
].filter(Boolean);
|
|
20173
20267
|
}
|
|
20174
20268
|
function ensureDoltResolvable(platform3 = process.platform) {
|
|
20175
|
-
const P3 = platform3 === "win32" ?
|
|
20269
|
+
const P3 = platform3 === "win32" ? path54.win32 : path54.posix;
|
|
20176
20270
|
const delim = platform3 === "win32" ? ";" : ":";
|
|
20177
20271
|
const names = doltBinaryNames(platform3);
|
|
20178
20272
|
const pathDirs = _doltPathSeam.getPath().split(delim).filter(Boolean);
|
|
@@ -20308,8 +20402,8 @@ async function ensureSharedServer(adapter, options = {}) {
|
|
|
20308
20402
|
// src/beads/project-key.ts
|
|
20309
20403
|
var import_child_process21 = require("child_process");
|
|
20310
20404
|
var crypto2 = __toESM(require("crypto"));
|
|
20311
|
-
var
|
|
20312
|
-
var
|
|
20405
|
+
var fs52 = __toESM(require("fs"));
|
|
20406
|
+
var path55 = __toESM(require("path"));
|
|
20313
20407
|
function normalizeOrigin(raw) {
|
|
20314
20408
|
const trimmed = raw.trim();
|
|
20315
20409
|
if (!trimmed) return null;
|
|
@@ -20335,17 +20429,17 @@ function normalizeOrigin(raw) {
|
|
|
20335
20429
|
return `${host2}/${pathPart}`;
|
|
20336
20430
|
}
|
|
20337
20431
|
function findRepoRoot(cwd) {
|
|
20338
|
-
let dir =
|
|
20432
|
+
let dir = path55.resolve(cwd);
|
|
20339
20433
|
const seen = /* @__PURE__ */ new Set();
|
|
20340
20434
|
for (let i = 0; i < 256; i++) {
|
|
20341
20435
|
if (seen.has(dir)) return null;
|
|
20342
20436
|
seen.add(dir);
|
|
20343
20437
|
try {
|
|
20344
|
-
const stat3 =
|
|
20438
|
+
const stat3 = fs52.statSync(path55.join(dir, ".git"), { throwIfNoEntry: false });
|
|
20345
20439
|
if (stat3 && (stat3.isDirectory() || stat3.isFile())) return dir;
|
|
20346
20440
|
} catch {
|
|
20347
20441
|
}
|
|
20348
|
-
const parent =
|
|
20442
|
+
const parent = path55.dirname(dir);
|
|
20349
20443
|
if (parent === dir) return null;
|
|
20350
20444
|
dir = parent;
|
|
20351
20445
|
}
|
|
@@ -20356,7 +20450,7 @@ var _execSeam2 = {
|
|
|
20356
20450
|
const out2 = (0, import_child_process21.execFileSync)(file, args2, opts);
|
|
20357
20451
|
return typeof out2 === "string" ? out2 : out2.toString("utf8");
|
|
20358
20452
|
},
|
|
20359
|
-
realpath: (p2) =>
|
|
20453
|
+
realpath: (p2) => fs52.realpathSync(p2)
|
|
20360
20454
|
};
|
|
20361
20455
|
function readOrigin(cwd) {
|
|
20362
20456
|
try {
|
|
@@ -20385,7 +20479,7 @@ function deriveProjectIdentity(cwd = process.cwd()) {
|
|
|
20385
20479
|
} catch {
|
|
20386
20480
|
}
|
|
20387
20481
|
const hash = crypto2.createHash("sha256").update(real).digest("hex");
|
|
20388
|
-
return { projectKey: `path:${hash}`, projectLabel:
|
|
20482
|
+
return { projectKey: `path:${hash}`, projectLabel: path55.basename(real) || "project" };
|
|
20389
20483
|
}
|
|
20390
20484
|
|
|
20391
20485
|
// src/beads/project-prefix.ts
|
|
@@ -20430,17 +20524,17 @@ var _provisionSeam = {
|
|
|
20430
20524
|
};
|
|
20431
20525
|
var _linkSeam = {
|
|
20432
20526
|
platform: () => process.platform,
|
|
20433
|
-
homedir: () =>
|
|
20527
|
+
homedir: () => os42.homedir(),
|
|
20434
20528
|
isWritableDir: (dir) => {
|
|
20435
20529
|
try {
|
|
20436
|
-
|
|
20530
|
+
fs53.accessSync(dir, fs53.constants.W_OK);
|
|
20437
20531
|
return true;
|
|
20438
20532
|
} catch {
|
|
20439
20533
|
return false;
|
|
20440
20534
|
}
|
|
20441
20535
|
},
|
|
20442
20536
|
ensureDir: (dir) => {
|
|
20443
|
-
|
|
20537
|
+
fs53.mkdirSync(dir, { recursive: true });
|
|
20444
20538
|
},
|
|
20445
20539
|
/**
|
|
20446
20540
|
* A directory to symlink `bd` into so the AGENT's shell + Claude Code's
|
|
@@ -20461,9 +20555,9 @@ var _linkSeam = {
|
|
|
20461
20555
|
* which `linkBdOntoPath` creates if missing.
|
|
20462
20556
|
*/
|
|
20463
20557
|
cliBinDir: () => {
|
|
20464
|
-
const pathDirs = (process.env.PATH ?? "").split(
|
|
20558
|
+
const pathDirs = (process.env.PATH ?? "").split(path56.delimiter).filter(Boolean);
|
|
20465
20559
|
const home = _linkSeam.homedir();
|
|
20466
|
-
const localBin = home ?
|
|
20560
|
+
const localBin = home ? path56.join(home, ".local", "bin") : null;
|
|
20467
20561
|
if (localBin) {
|
|
20468
20562
|
try {
|
|
20469
20563
|
_linkSeam.ensureDir(localBin);
|
|
@@ -20473,16 +20567,16 @@ var _linkSeam = {
|
|
|
20473
20567
|
const candidates = [];
|
|
20474
20568
|
if (localBin) candidates.push(localBin);
|
|
20475
20569
|
try {
|
|
20476
|
-
candidates.push(
|
|
20570
|
+
candidates.push(path56.dirname(process.execPath));
|
|
20477
20571
|
} catch {
|
|
20478
20572
|
}
|
|
20479
20573
|
candidates.push("/usr/local/bin");
|
|
20480
20574
|
const entry = process.argv[1];
|
|
20481
20575
|
if (entry) {
|
|
20482
20576
|
try {
|
|
20483
|
-
candidates.push(
|
|
20577
|
+
candidates.push(path56.dirname(fs53.realpathSync(entry)));
|
|
20484
20578
|
} catch {
|
|
20485
|
-
candidates.push(
|
|
20579
|
+
candidates.push(path56.dirname(entry));
|
|
20486
20580
|
}
|
|
20487
20581
|
}
|
|
20488
20582
|
const onPathWritable = candidates.find(
|
|
@@ -20494,20 +20588,20 @@ var _linkSeam = {
|
|
|
20494
20588
|
/** Current symlink target at `linkPath`, or null when absent / not a link. */
|
|
20495
20589
|
readlink: (linkPath) => {
|
|
20496
20590
|
try {
|
|
20497
|
-
return
|
|
20591
|
+
return fs53.readlinkSync(linkPath);
|
|
20498
20592
|
} catch {
|
|
20499
20593
|
return null;
|
|
20500
20594
|
}
|
|
20501
20595
|
},
|
|
20502
|
-
unlink: (linkPath) =>
|
|
20503
|
-
symlink: (target, linkPath) =>
|
|
20596
|
+
unlink: (linkPath) => fs53.unlinkSync(linkPath),
|
|
20597
|
+
symlink: (target, linkPath) => fs53.symlinkSync(target, linkPath)
|
|
20504
20598
|
};
|
|
20505
20599
|
function linkBdOntoPath(binaryPath) {
|
|
20506
20600
|
if (_linkSeam.platform() === "win32") return;
|
|
20507
20601
|
const binDir = _linkSeam.cliBinDir();
|
|
20508
20602
|
if (!binDir) return;
|
|
20509
20603
|
_linkSeam.ensureDir(binDir);
|
|
20510
|
-
const linkPath =
|
|
20604
|
+
const linkPath = path56.join(binDir, "bd");
|
|
20511
20605
|
if (linkPath === binaryPath) return;
|
|
20512
20606
|
const current = _linkSeam.readlink(linkPath);
|
|
20513
20607
|
if (current === binaryPath) return;
|
|
@@ -20702,7 +20796,7 @@ function dedupeRecipes(agents) {
|
|
|
20702
20796
|
|
|
20703
20797
|
// src/beads/watcher.ts
|
|
20704
20798
|
var crypto4 = __toESM(require("crypto"));
|
|
20705
|
-
var
|
|
20799
|
+
var path57 = __toESM(require("path"));
|
|
20706
20800
|
var API_BASE6 = resolveApiBaseUrl();
|
|
20707
20801
|
var DEBOUNCE_MS2 = 400;
|
|
20708
20802
|
var ZERO_SUMMARY = {
|
|
@@ -20726,7 +20820,7 @@ var BeadsWatcher = class {
|
|
|
20726
20820
|
constructor(opts) {
|
|
20727
20821
|
this.opts = opts;
|
|
20728
20822
|
this.bd = opts.adapter ?? new BdAdapter({ cwd: opts.cwd, beadsDir: opts.beadsDir });
|
|
20729
|
-
this.feedPath = opts.feedPath ??
|
|
20823
|
+
this.feedPath = opts.feedPath ?? path57.join(opts.cwd ?? process.cwd(), ".beads", "last-touched");
|
|
20730
20824
|
this.apiBase = opts.apiBaseUrl ?? API_BASE6;
|
|
20731
20825
|
}
|
|
20732
20826
|
opts;
|
|
@@ -21143,8 +21237,8 @@ function cleanupAttachmentTempFiles() {
|
|
|
21143
21237
|
function saveFilesTemp(files) {
|
|
21144
21238
|
return files.filter(({ base64 }) => base64 && base64.length > 0).map(({ filename, base64 }) => {
|
|
21145
21239
|
const safeName = filename.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 80);
|
|
21146
|
-
const tmpPath =
|
|
21147
|
-
|
|
21240
|
+
const tmpPath = path59.join(os44.tmpdir(), `codeam-${(0, import_crypto3.randomUUID)()}-${safeName}`);
|
|
21241
|
+
fs55.writeFileSync(tmpPath, Buffer.from(base64, "base64"));
|
|
21148
21242
|
pendingAttachmentFiles.add(tmpPath);
|
|
21149
21243
|
return tmpPath;
|
|
21150
21244
|
});
|
|
@@ -21356,9 +21450,9 @@ var listFiles = async (ctx, cmd, parsed) => {
|
|
|
21356
21450
|
await ctx.relay.sendResult(cmd.id, "completed", result);
|
|
21357
21451
|
};
|
|
21358
21452
|
var envReadH = async (ctx, cmd) => {
|
|
21359
|
-
const envPath =
|
|
21453
|
+
const envPath = path59.join(process.cwd(), ".env");
|
|
21360
21454
|
try {
|
|
21361
|
-
const raw = await
|
|
21455
|
+
const raw = await fs55.promises.readFile(envPath, "utf8");
|
|
21362
21456
|
await ctx.relay.sendResult(cmd.id, "completed", {
|
|
21363
21457
|
exists: true,
|
|
21364
21458
|
vars: parseDotenv(raw)
|
|
@@ -21389,14 +21483,14 @@ var envWriteH = async (ctx, cmd, parsed) => {
|
|
|
21389
21483
|
}
|
|
21390
21484
|
seen.add(v.key);
|
|
21391
21485
|
}
|
|
21392
|
-
const envPath =
|
|
21393
|
-
const tmpPath =
|
|
21486
|
+
const envPath = path59.join(process.cwd(), ".env");
|
|
21487
|
+
const tmpPath = path59.join(process.cwd(), ".env.codeam.tmp");
|
|
21394
21488
|
try {
|
|
21395
|
-
await
|
|
21396
|
-
await
|
|
21489
|
+
await fs55.promises.writeFile(tmpPath, serializeDotenv(vars), "utf8");
|
|
21490
|
+
await fs55.promises.rename(tmpPath, envPath);
|
|
21397
21491
|
await ctx.relay.sendResult(cmd.id, "completed", { ok: true, count: vars.length });
|
|
21398
21492
|
} catch (err) {
|
|
21399
|
-
await
|
|
21493
|
+
await fs55.promises.rm(tmpPath, { force: true }).catch(() => void 0);
|
|
21400
21494
|
await ctx.relay.sendResult(cmd.id, "failed", { error: err.message });
|
|
21401
21495
|
}
|
|
21402
21496
|
};
|
|
@@ -21440,7 +21534,7 @@ var headroomConfigureH = async (ctx, cmd, parsed) => {
|
|
|
21440
21534
|
let configuredAgent = rawAgentId;
|
|
21441
21535
|
if (!configuredAgent) {
|
|
21442
21536
|
try {
|
|
21443
|
-
const raw = JSON.parse(
|
|
21537
|
+
const raw = JSON.parse(fs55.readFileSync(headroomConfigPath(), "utf8"));
|
|
21444
21538
|
configuredAgent = raw.agent ?? "";
|
|
21445
21539
|
} catch {
|
|
21446
21540
|
}
|
|
@@ -21474,7 +21568,7 @@ var headroomConfigureH = async (ctx, cmd, parsed) => {
|
|
|
21474
21568
|
persist: persistHeadroomConfig,
|
|
21475
21569
|
readEnabled: () => {
|
|
21476
21570
|
try {
|
|
21477
|
-
const raw = JSON.parse(
|
|
21571
|
+
const raw = JSON.parse(fs55.readFileSync(headroomConfigPath(), "utf8"));
|
|
21478
21572
|
return raw.enabled === true;
|
|
21479
21573
|
} catch {
|
|
21480
21574
|
return false;
|
|
@@ -21721,7 +21815,7 @@ var headroomBudgetH = async (ctx, cmd) => {
|
|
|
21721
21815
|
}
|
|
21722
21816
|
let headroomActive = false;
|
|
21723
21817
|
try {
|
|
21724
|
-
const raw = JSON.parse(
|
|
21818
|
+
const raw = JSON.parse(fs55.readFileSync(headroomConfigPath(), "utf8"));
|
|
21725
21819
|
headroomActive = raw.enabled === true;
|
|
21726
21820
|
} catch {
|
|
21727
21821
|
}
|
|
@@ -21731,7 +21825,7 @@ var headroomBudgetH = async (ctx, cmd) => {
|
|
|
21731
21825
|
}
|
|
21732
21826
|
let existingConfig = { enabled: true };
|
|
21733
21827
|
try {
|
|
21734
|
-
existingConfig = JSON.parse(
|
|
21828
|
+
existingConfig = JSON.parse(fs55.readFileSync(headroomConfigPath(), "utf8"));
|
|
21735
21829
|
} catch {
|
|
21736
21830
|
}
|
|
21737
21831
|
if (payload.budgetEnabled && payload.budgetUsd != null) {
|
|
@@ -21844,13 +21938,13 @@ var CLI_UPDATE_MAX_ATTEMPTS = 3;
|
|
|
21844
21938
|
function buildNpmInstallInvocation(opts) {
|
|
21845
21939
|
const entryScript = opts?.entryScript ?? process.argv[1] ?? "";
|
|
21846
21940
|
const execPath = opts?.execPath ?? process.execPath;
|
|
21847
|
-
const exists2 = opts?.existsSync ??
|
|
21848
|
-
const normalized = entryScript.split(
|
|
21941
|
+
const exists2 = opts?.existsSync ?? fs55.existsSync;
|
|
21942
|
+
const normalized = entryScript.split(path59.sep).join("/");
|
|
21849
21943
|
const marker = "/lib/node_modules/codeam-cli/";
|
|
21850
21944
|
const markerIdx = normalized.indexOf(marker);
|
|
21851
21945
|
const prefix = markerIdx > 0 ? entryScript.slice(0, markerIdx) : null;
|
|
21852
|
-
const siblingNpm =
|
|
21853
|
-
|
|
21946
|
+
const siblingNpm = path59.join(
|
|
21947
|
+
path59.dirname(execPath),
|
|
21854
21948
|
process.platform === "win32" ? "npm.cmd" : "npm"
|
|
21855
21949
|
);
|
|
21856
21950
|
const command2 = exists2(siblingNpm) ? siblingNpm : "npm";
|
|
@@ -22717,11 +22811,11 @@ function resolveTokenValue(args2) {
|
|
|
22717
22811
|
}
|
|
22718
22812
|
const fileFlag = args2.find((a) => a.startsWith("--token-file="));
|
|
22719
22813
|
if (fileFlag) {
|
|
22720
|
-
const
|
|
22814
|
+
const path74 = fileFlag.slice("--token-file=".length);
|
|
22721
22815
|
try {
|
|
22722
|
-
const content =
|
|
22723
|
-
if (content.length === 0) fail(`--token-file ${
|
|
22724
|
-
rmIfExistsQuiet(
|
|
22816
|
+
const content = fs56.readFileSync(path74, "utf8").trim();
|
|
22817
|
+
if (content.length === 0) fail(`--token-file ${path74} is empty`);
|
|
22818
|
+
rmIfExistsQuiet(path74);
|
|
22725
22819
|
return content;
|
|
22726
22820
|
} catch (err) {
|
|
22727
22821
|
fail(`Could not read --token-file: ${err.message}`);
|
|
@@ -22750,7 +22844,7 @@ async function claimOnce(token, pluginId, pluginSecretHash) {
|
|
|
22750
22844
|
pluginId,
|
|
22751
22845
|
ideName: "codeam-cli (codespace)",
|
|
22752
22846
|
ideVersion: process.env.npm_package_version ?? "unknown",
|
|
22753
|
-
hostname:
|
|
22847
|
+
hostname: os45.hostname(),
|
|
22754
22848
|
codespaceName: process.env.CODESPACE_NAME ?? "",
|
|
22755
22849
|
// Current git branch of the codespace's working directory, so the
|
|
22756
22850
|
// backend can populate `PairedSession.branch` for the codespace pair.
|
|
@@ -22811,7 +22905,7 @@ async function claim(token, pluginId, pluginSecretHash) {
|
|
|
22811
22905
|
}
|
|
22812
22906
|
}
|
|
22813
22907
|
function pairAutoLockPath() {
|
|
22814
|
-
return
|
|
22908
|
+
return path60.join(os45.homedir(), ".codeam", "pair-auto.lock");
|
|
22815
22909
|
}
|
|
22816
22910
|
function isLivePairAuto(pid) {
|
|
22817
22911
|
if (!Number.isInteger(pid) || pid <= 0 || pid === process.pid) return false;
|
|
@@ -22821,7 +22915,7 @@ function isLivePairAuto(pid) {
|
|
|
22821
22915
|
if (e.code !== "EPERM") return false;
|
|
22822
22916
|
}
|
|
22823
22917
|
try {
|
|
22824
|
-
return
|
|
22918
|
+
return fs56.readFileSync(`/proc/${pid}/cmdline`, "utf8").includes("codeam");
|
|
22825
22919
|
} catch {
|
|
22826
22920
|
return true;
|
|
22827
22921
|
}
|
|
@@ -22831,24 +22925,24 @@ function isLiveCodeam(pid) {
|
|
|
22831
22925
|
}
|
|
22832
22926
|
function daemonLockPath(sessionId) {
|
|
22833
22927
|
const safe = sessionId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
22834
|
-
return
|
|
22928
|
+
return path60.join(os45.homedir(), ".codeam", `daemon-${safe}.lock`);
|
|
22835
22929
|
}
|
|
22836
22930
|
function acquireDaemonLock(sessionId) {
|
|
22837
22931
|
const lockPath = daemonLockPath(sessionId);
|
|
22838
22932
|
try {
|
|
22839
|
-
|
|
22933
|
+
fs56.mkdirSync(path60.dirname(lockPath), { recursive: true });
|
|
22840
22934
|
try {
|
|
22841
|
-
|
|
22935
|
+
fs56.writeFileSync(lockPath, String(process.pid), { flag: "wx" });
|
|
22842
22936
|
} catch (e) {
|
|
22843
22937
|
if (e.code !== "EEXIST") throw e;
|
|
22844
|
-
const holder = Number(
|
|
22938
|
+
const holder = Number(fs56.readFileSync(lockPath, "utf8").trim());
|
|
22845
22939
|
if (holder && holder !== process.pid && isLiveCodeam(holder)) return false;
|
|
22846
|
-
|
|
22940
|
+
fs56.writeFileSync(lockPath, String(process.pid));
|
|
22847
22941
|
}
|
|
22848
22942
|
const release3 = () => {
|
|
22849
22943
|
try {
|
|
22850
|
-
if (
|
|
22851
|
-
|
|
22944
|
+
if (fs56.existsSync(lockPath) && Number(fs56.readFileSync(lockPath, "utf8").trim()) === process.pid) {
|
|
22945
|
+
fs56.unlinkSync(lockPath);
|
|
22852
22946
|
}
|
|
22853
22947
|
} catch {
|
|
22854
22948
|
}
|
|
@@ -22870,19 +22964,19 @@ function acquireDaemonLock(sessionId) {
|
|
|
22870
22964
|
function acquireSingletonLock() {
|
|
22871
22965
|
const lockPath = pairAutoLockPath();
|
|
22872
22966
|
try {
|
|
22873
|
-
|
|
22967
|
+
fs56.mkdirSync(path60.dirname(lockPath), { recursive: true });
|
|
22874
22968
|
try {
|
|
22875
|
-
|
|
22969
|
+
fs56.writeFileSync(lockPath, String(process.pid), { flag: "wx" });
|
|
22876
22970
|
} catch (e) {
|
|
22877
22971
|
if (e.code !== "EEXIST") throw e;
|
|
22878
|
-
const holder = Number(
|
|
22972
|
+
const holder = Number(fs56.readFileSync(lockPath, "utf8").trim());
|
|
22879
22973
|
if (isLivePairAuto(holder)) return false;
|
|
22880
|
-
|
|
22974
|
+
fs56.writeFileSync(lockPath, String(process.pid));
|
|
22881
22975
|
}
|
|
22882
22976
|
process.once("exit", () => {
|
|
22883
22977
|
try {
|
|
22884
|
-
if (
|
|
22885
|
-
|
|
22978
|
+
if (fs56.existsSync(lockPath) && Number(fs56.readFileSync(lockPath, "utf8").trim()) === process.pid) {
|
|
22979
|
+
fs56.unlinkSync(lockPath);
|
|
22886
22980
|
}
|
|
22887
22981
|
} catch {
|
|
22888
22982
|
}
|
|
@@ -23328,7 +23422,7 @@ var AgentService = class _AgentService {
|
|
|
23328
23422
|
};
|
|
23329
23423
|
|
|
23330
23424
|
// src/agents/acp/adapters.ts
|
|
23331
|
-
var
|
|
23425
|
+
var path62 = __toESM(require("path"));
|
|
23332
23426
|
|
|
23333
23427
|
// src/agents/acp/agent-binary.ts
|
|
23334
23428
|
var import_fs4 = __toESM(require("fs"));
|
|
@@ -23571,13 +23665,13 @@ function resolveBin(pkgName, binName) {
|
|
|
23571
23665
|
try {
|
|
23572
23666
|
const manifestPath = require_.resolve(`${pkgName}/package.json`);
|
|
23573
23667
|
const manifest = require_(`${pkgName}/package.json`);
|
|
23574
|
-
const pkgDir =
|
|
23668
|
+
const pkgDir = path62.dirname(manifestPath);
|
|
23575
23669
|
const bin = manifest.bin;
|
|
23576
23670
|
if (!bin) return null;
|
|
23577
|
-
if (typeof bin === "string") return
|
|
23671
|
+
if (typeof bin === "string") return path62.resolve(pkgDir, bin);
|
|
23578
23672
|
const target = binName ?? Object.keys(bin)[0];
|
|
23579
23673
|
if (!target || !bin[target]) return null;
|
|
23580
|
-
return
|
|
23674
|
+
return path62.resolve(pkgDir, bin[target]);
|
|
23581
23675
|
} catch {
|
|
23582
23676
|
return null;
|
|
23583
23677
|
}
|
|
@@ -23681,9 +23775,9 @@ function requiresAcp(agent) {
|
|
|
23681
23775
|
var import_node_crypto10 = require("crypto");
|
|
23682
23776
|
|
|
23683
23777
|
// src/services/history.service.ts
|
|
23684
|
-
var
|
|
23685
|
-
var
|
|
23686
|
-
var
|
|
23778
|
+
var fs58 = __toESM(require("fs"));
|
|
23779
|
+
var path63 = __toESM(require("path"));
|
|
23780
|
+
var os47 = __toESM(require("os"));
|
|
23687
23781
|
var https7 = __toESM(require("https"));
|
|
23688
23782
|
var http6 = __toESM(require("http"));
|
|
23689
23783
|
var import_zod2 = require("zod");
|
|
@@ -23710,7 +23804,7 @@ function parseJsonl(filePath) {
|
|
|
23710
23804
|
const messages = [];
|
|
23711
23805
|
let raw;
|
|
23712
23806
|
try {
|
|
23713
|
-
raw =
|
|
23807
|
+
raw = fs58.readFileSync(filePath, "utf8");
|
|
23714
23808
|
} catch (err) {
|
|
23715
23809
|
if (err.code !== "ENOENT") {
|
|
23716
23810
|
log.warn("history:parseJsonl", `read failed for ${filePath}`, err);
|
|
@@ -23851,7 +23945,7 @@ var HistoryService = class _HistoryService {
|
|
|
23851
23945
|
return this._quotaPercent === null || Date.now() - this._quotaFetchedAt > ttlMs;
|
|
23852
23946
|
}
|
|
23853
23947
|
get projectDir() {
|
|
23854
|
-
return this.runtime.resolveHistoryDir(this.cwd) ??
|
|
23948
|
+
return this.runtime.resolveHistoryDir(this.cwd) ?? path63.join(os47.homedir(), ".claude", "projects", encodeCwd(this.cwd));
|
|
23855
23949
|
}
|
|
23856
23950
|
/** Set the current Claude conversation ID (extracted from /cost command or session start) */
|
|
23857
23951
|
setCurrentConversationId(id) {
|
|
@@ -23863,7 +23957,7 @@ var HistoryService = class _HistoryService {
|
|
|
23863
23957
|
/** Return the current message count in the active conversation. */
|
|
23864
23958
|
getCurrentMessageCount() {
|
|
23865
23959
|
if (!this.currentConversationId) return 0;
|
|
23866
|
-
const filePath =
|
|
23960
|
+
const filePath = path63.join(this.projectDir, `${this.currentConversationId}.jsonl`);
|
|
23867
23961
|
return parseJsonl(filePath).length;
|
|
23868
23962
|
}
|
|
23869
23963
|
/**
|
|
@@ -23874,7 +23968,7 @@ var HistoryService = class _HistoryService {
|
|
|
23874
23968
|
const deadline = Date.now() + timeoutMs;
|
|
23875
23969
|
while (Date.now() < deadline) {
|
|
23876
23970
|
if (!this.currentConversationId) return null;
|
|
23877
|
-
const filePath =
|
|
23971
|
+
const filePath = path63.join(this.projectDir, `${this.currentConversationId}.jsonl`);
|
|
23878
23972
|
const messages = parseJsonl(filePath);
|
|
23879
23973
|
if (messages.length > previousCount) {
|
|
23880
23974
|
for (let i = messages.length - 1; i >= previousCount; i--) {
|
|
@@ -23900,16 +23994,16 @@ var HistoryService = class _HistoryService {
|
|
|
23900
23994
|
const dir = this.projectDir;
|
|
23901
23995
|
const cutoff = this.bootTimeMs - _HistoryService.BIRTHTIME_GRACE_MS;
|
|
23902
23996
|
try {
|
|
23903
|
-
const files =
|
|
23997
|
+
const files = fs58.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isFile() && e.name.endsWith(".jsonl")).map((e) => {
|
|
23904
23998
|
try {
|
|
23905
|
-
const stat3 =
|
|
23999
|
+
const stat3 = fs58.statSync(path63.join(dir, e.name));
|
|
23906
24000
|
return { name: e.name, mtime: stat3.mtimeMs, birthtime: stat3.birthtimeMs };
|
|
23907
24001
|
} catch {
|
|
23908
24002
|
return { name: e.name, mtime: 0, birthtime: 0 };
|
|
23909
24003
|
}
|
|
23910
24004
|
}).filter((f) => f.birthtime >= cutoff).sort((a, b) => b.mtime - a.mtime);
|
|
23911
24005
|
if (files.length > 0) {
|
|
23912
|
-
this.currentConversationId =
|
|
24006
|
+
this.currentConversationId = path63.basename(files[0].name, ".jsonl");
|
|
23913
24007
|
}
|
|
23914
24008
|
} catch {
|
|
23915
24009
|
}
|
|
@@ -23943,13 +24037,13 @@ var HistoryService = class _HistoryService {
|
|
|
23943
24037
|
const cutoff = this.bootTimeMs - _HistoryService.BIRTHTIME_GRACE_MS;
|
|
23944
24038
|
let entries;
|
|
23945
24039
|
try {
|
|
23946
|
-
entries =
|
|
24040
|
+
entries = fs58.readdirSync(dir, { withFileTypes: true });
|
|
23947
24041
|
} catch {
|
|
23948
24042
|
return null;
|
|
23949
24043
|
}
|
|
23950
24044
|
const files = entries.filter((e) => e.isFile() && e.name.endsWith(".jsonl")).map((e) => {
|
|
23951
24045
|
try {
|
|
23952
|
-
const stat3 =
|
|
24046
|
+
const stat3 = fs58.statSync(path63.join(dir, e.name));
|
|
23953
24047
|
return { name: e.name, mtime: stat3.mtimeMs, birthtime: stat3.birthtimeMs };
|
|
23954
24048
|
} catch {
|
|
23955
24049
|
return { name: e.name, mtime: 0, birthtime: 0 };
|
|
@@ -23958,12 +24052,12 @@ var HistoryService = class _HistoryService {
|
|
|
23958
24052
|
if (files.length === 0) return null;
|
|
23959
24053
|
const targetFile = this.currentConversationId ? `${this.currentConversationId}.jsonl` : files[0].name;
|
|
23960
24054
|
if (!files.some((f) => f.name === targetFile)) return null;
|
|
23961
|
-
return this.extractUsageFromFile(
|
|
24055
|
+
return this.extractUsageFromFile(path63.join(dir, targetFile));
|
|
23962
24056
|
}
|
|
23963
24057
|
extractUsageFromFile(filePath) {
|
|
23964
24058
|
let raw;
|
|
23965
24059
|
try {
|
|
23966
|
-
raw =
|
|
24060
|
+
raw = fs58.readFileSync(filePath, "utf8");
|
|
23967
24061
|
} catch {
|
|
23968
24062
|
return null;
|
|
23969
24063
|
}
|
|
@@ -24008,9 +24102,9 @@ var HistoryService = class _HistoryService {
|
|
|
24008
24102
|
let totalCost = 0;
|
|
24009
24103
|
let files;
|
|
24010
24104
|
try {
|
|
24011
|
-
files =
|
|
24105
|
+
files = fs58.readdirSync(projectDir).filter((f) => f.endsWith(".jsonl")).filter((f) => {
|
|
24012
24106
|
try {
|
|
24013
|
-
return
|
|
24107
|
+
return fs58.statSync(path63.join(projectDir, f)).mtimeMs >= monthStartMs;
|
|
24014
24108
|
} catch {
|
|
24015
24109
|
return false;
|
|
24016
24110
|
}
|
|
@@ -24021,7 +24115,7 @@ var HistoryService = class _HistoryService {
|
|
|
24021
24115
|
for (const file of files) {
|
|
24022
24116
|
let raw;
|
|
24023
24117
|
try {
|
|
24024
|
-
raw =
|
|
24118
|
+
raw = fs58.readFileSync(path63.join(projectDir, file), "utf8");
|
|
24025
24119
|
} catch {
|
|
24026
24120
|
continue;
|
|
24027
24121
|
}
|
|
@@ -24100,7 +24194,7 @@ var HistoryService = class _HistoryService {
|
|
|
24100
24194
|
if (this.runtime.resolveHistoryFile) {
|
|
24101
24195
|
return this.runtime.resolveHistoryFile(this.cwd, sessionId);
|
|
24102
24196
|
}
|
|
24103
|
-
return
|
|
24197
|
+
return path63.join(this.projectDir, `${sessionId}.jsonl`);
|
|
24104
24198
|
}
|
|
24105
24199
|
/**
|
|
24106
24200
|
* Parse a conversation's messages from disk, agent-aware. Claude uses the
|
|
@@ -24134,7 +24228,7 @@ var HistoryService = class _HistoryService {
|
|
|
24134
24228
|
};
|
|
24135
24229
|
});
|
|
24136
24230
|
}
|
|
24137
|
-
return parseJsonl(
|
|
24231
|
+
return parseJsonl(path63.join(this.projectDir, `${sessionId}.jsonl`));
|
|
24138
24232
|
}
|
|
24139
24233
|
async loadConversation(sessionId) {
|
|
24140
24234
|
const messages = this.readConversation(sessionId);
|
|
@@ -24190,7 +24284,7 @@ var HistoryService = class _HistoryService {
|
|
|
24190
24284
|
if (!filePath) return false;
|
|
24191
24285
|
let mtimeMs;
|
|
24192
24286
|
try {
|
|
24193
|
-
mtimeMs =
|
|
24287
|
+
mtimeMs = fs58.statSync(filePath).mtimeMs;
|
|
24194
24288
|
} catch {
|
|
24195
24289
|
return false;
|
|
24196
24290
|
}
|
|
@@ -24259,10 +24353,10 @@ var HistoryService = class _HistoryService {
|
|
|
24259
24353
|
|
|
24260
24354
|
// src/agents/acp/client.ts
|
|
24261
24355
|
var import_node_child_process26 = require("child_process");
|
|
24262
|
-
var
|
|
24356
|
+
var fs59 = __toESM(require("fs/promises"));
|
|
24263
24357
|
var fsSync = __toESM(require("fs"));
|
|
24264
|
-
var
|
|
24265
|
-
var
|
|
24358
|
+
var os48 = __toESM(require("os"));
|
|
24359
|
+
var path64 = __toESM(require("path"));
|
|
24266
24360
|
var import_node_stream = require("stream");
|
|
24267
24361
|
|
|
24268
24362
|
// ../../node_modules/@agentclientprotocol/sdk/dist/acp.js
|
|
@@ -27343,7 +27437,7 @@ var AcpClient = class {
|
|
|
27343
27437
|
},
|
|
27344
27438
|
readTextFile: async (params) => {
|
|
27345
27439
|
try {
|
|
27346
|
-
const content = await
|
|
27440
|
+
const content = await fs59.readFile(params.path, "utf8");
|
|
27347
27441
|
return applyLineRange(content, params.line ?? null, params.limit ?? null);
|
|
27348
27442
|
} catch (err) {
|
|
27349
27443
|
const code = err.code;
|
|
@@ -27363,7 +27457,7 @@ var AcpClient = class {
|
|
|
27363
27457
|
},
|
|
27364
27458
|
writeTextFile: async (params) => {
|
|
27365
27459
|
try {
|
|
27366
|
-
await
|
|
27460
|
+
await fs59.writeFile(params.path, params.content, "utf8");
|
|
27367
27461
|
return {};
|
|
27368
27462
|
} catch (err) {
|
|
27369
27463
|
const code = err.code;
|
|
@@ -27412,29 +27506,29 @@ function applyLineRange(content, line, limit) {
|
|
|
27412
27506
|
return { content: lines.slice(start2, end).join("\n") };
|
|
27413
27507
|
}
|
|
27414
27508
|
function knownAgentBinaryDirs() {
|
|
27415
|
-
const home =
|
|
27509
|
+
const home = os48.homedir();
|
|
27416
27510
|
const out2 = [];
|
|
27417
27511
|
out2.push("/tmp/codeam-node20/bin");
|
|
27418
27512
|
for (const root of [
|
|
27419
27513
|
"/usr/local/share/nvm/versions/node",
|
|
27420
|
-
|
|
27514
|
+
path64.join(home, ".nvm/versions/node")
|
|
27421
27515
|
]) {
|
|
27422
27516
|
try {
|
|
27423
27517
|
for (const child of fsSync.readdirSync(root)) {
|
|
27424
|
-
out2.push(
|
|
27518
|
+
out2.push(path64.join(root, child, "bin"));
|
|
27425
27519
|
}
|
|
27426
27520
|
} catch {
|
|
27427
27521
|
}
|
|
27428
27522
|
}
|
|
27429
|
-
out2.push(
|
|
27523
|
+
out2.push(path64.join(home, ".volta/bin"));
|
|
27430
27524
|
out2.push("/usr/local/bin");
|
|
27431
27525
|
out2.push("/usr/bin");
|
|
27432
|
-
out2.push(
|
|
27433
|
-
out2.push(
|
|
27526
|
+
out2.push(path64.join(home, ".local/bin"));
|
|
27527
|
+
out2.push(path64.join(home, "bin"));
|
|
27434
27528
|
if (process.platform === "win32") {
|
|
27435
27529
|
const { LOCALAPPDATA, APPDATA } = process.env;
|
|
27436
|
-
if (LOCALAPPDATA) out2.push(
|
|
27437
|
-
if (APPDATA) out2.push(
|
|
27530
|
+
if (LOCALAPPDATA) out2.push(path64.join(LOCALAPPDATA, "cursor-agent"));
|
|
27531
|
+
if (APPDATA) out2.push(path64.join(APPDATA, "npm"));
|
|
27438
27532
|
}
|
|
27439
27533
|
return out2.filter((p2) => {
|
|
27440
27534
|
try {
|
|
@@ -27446,7 +27540,7 @@ function knownAgentBinaryDirs() {
|
|
|
27446
27540
|
}
|
|
27447
27541
|
function expandPathForAgentBinaries(existingPath) {
|
|
27448
27542
|
const existing = new Set(
|
|
27449
|
-
existingPath.split(
|
|
27543
|
+
existingPath.split(path64.delimiter).filter((p2) => p2.length > 0)
|
|
27450
27544
|
);
|
|
27451
27545
|
const additions = [];
|
|
27452
27546
|
for (const dir of knownAgentBinaryDirs()) {
|
|
@@ -27456,7 +27550,7 @@ function expandPathForAgentBinaries(existingPath) {
|
|
|
27456
27550
|
}
|
|
27457
27551
|
}
|
|
27458
27552
|
if (additions.length === 0) return existingPath;
|
|
27459
|
-
return [...additions, existingPath].filter((p2) => p2.length > 0).join(
|
|
27553
|
+
return [...additions, existingPath].filter((p2) => p2.length > 0).join(path64.delimiter);
|
|
27460
27554
|
}
|
|
27461
27555
|
|
|
27462
27556
|
// src/agents/acp/headroom-budget-proxy.ts
|
|
@@ -27938,15 +28032,15 @@ function commonPrefixLength(a, b) {
|
|
|
27938
28032
|
|
|
27939
28033
|
// src/agents/acp/onboarding.ts
|
|
27940
28034
|
var import_child_process26 = require("child_process");
|
|
27941
|
-
var
|
|
27942
|
-
var
|
|
27943
|
-
var
|
|
28035
|
+
var fs60 = __toESM(require("fs"));
|
|
28036
|
+
var os49 = __toESM(require("os"));
|
|
28037
|
+
var path65 = __toESM(require("path"));
|
|
27944
28038
|
var _onboardingSeam = {
|
|
27945
|
-
markerPath: (sessionId) =>
|
|
27946
|
-
exists: (p2) =>
|
|
28039
|
+
markerPath: (sessionId) => path65.join(os49.homedir(), ".codeam", "welcomed", `${sessionId}.done`),
|
|
28040
|
+
exists: (p2) => fs60.existsSync(p2),
|
|
27947
28041
|
write: (p2) => {
|
|
27948
|
-
|
|
27949
|
-
|
|
28042
|
+
fs60.mkdirSync(path65.dirname(p2), { recursive: true });
|
|
28043
|
+
fs60.writeFileSync(p2, "");
|
|
27950
28044
|
},
|
|
27951
28045
|
disabled: () => {
|
|
27952
28046
|
const v = process.env.CODEAM_ONBOARDING_DISABLED;
|
|
@@ -27983,7 +28077,7 @@ function resolveRepoName(cwd) {
|
|
|
27983
28077
|
if (name) return name;
|
|
27984
28078
|
}
|
|
27985
28079
|
}
|
|
27986
|
-
const base =
|
|
28080
|
+
const base = path65.basename(cwd || "");
|
|
27987
28081
|
if (base && !isUuid(base)) return base;
|
|
27988
28082
|
return "this project";
|
|
27989
28083
|
}
|
|
@@ -28235,8 +28329,8 @@ var import_crypto5 = require("crypto");
|
|
|
28235
28329
|
|
|
28236
28330
|
// src/services/turn-files/git-changeset.ts
|
|
28237
28331
|
var import_child_process27 = require("child_process");
|
|
28238
|
-
var
|
|
28239
|
-
var
|
|
28332
|
+
var fs61 = __toESM(require("fs/promises"));
|
|
28333
|
+
var path66 = __toESM(require("path"));
|
|
28240
28334
|
async function collectRepoChangeset(opts) {
|
|
28241
28335
|
const status2 = await runGit3(opts.repoRoot, ["status", "--porcelain=v1", "-z"]);
|
|
28242
28336
|
if (status2 === null) return null;
|
|
@@ -28254,7 +28348,7 @@ async function collectRepoChangeset(opts) {
|
|
|
28254
28348
|
let stats;
|
|
28255
28349
|
if (row.fileStatus === "added" && numstatEntry === void 0) {
|
|
28256
28350
|
const lineCount = await readUntrackedLineCount(
|
|
28257
|
-
|
|
28351
|
+
path66.join(opts.repoRoot, row.filePath)
|
|
28258
28352
|
);
|
|
28259
28353
|
stats = { added: lineCount, removed: 0 };
|
|
28260
28354
|
} else {
|
|
@@ -28285,7 +28379,7 @@ function readUntrackedLineCount(absPath) {
|
|
|
28285
28379
|
}
|
|
28286
28380
|
async function defaultReadUntrackedLineCount(absPath) {
|
|
28287
28381
|
try {
|
|
28288
|
-
const content = await
|
|
28382
|
+
const content = await fs61.readFile(absPath, "utf8");
|
|
28289
28383
|
let count = 0;
|
|
28290
28384
|
let pos = -1;
|
|
28291
28385
|
while ((pos = content.indexOf("\n", pos + 1)) !== -1) {
|
|
@@ -28377,7 +28471,7 @@ function defaultRunGit(cwd, args2) {
|
|
|
28377
28471
|
});
|
|
28378
28472
|
}
|
|
28379
28473
|
async function discoverRepos(workingDir, maxDepth = 4) {
|
|
28380
|
-
const
|
|
28474
|
+
const fs66 = await import("fs/promises");
|
|
28381
28475
|
const out2 = [];
|
|
28382
28476
|
await walk(workingDir, 0);
|
|
28383
28477
|
return out2;
|
|
@@ -28385,7 +28479,7 @@ async function discoverRepos(workingDir, maxDepth = 4) {
|
|
|
28385
28479
|
if (depth > maxDepth) return;
|
|
28386
28480
|
let entries = [];
|
|
28387
28481
|
try {
|
|
28388
|
-
const dirents = await
|
|
28482
|
+
const dirents = await fs66.readdir(dir, { withFileTypes: true });
|
|
28389
28483
|
entries = dirents.filter((d3) => !d3.name.startsWith(".") || d3.name === ".git").map((d3) => ({ name: d3.name, isDirectory: d3.isDirectory() }));
|
|
28390
28484
|
} catch {
|
|
28391
28485
|
return;
|
|
@@ -28396,8 +28490,8 @@ async function discoverRepos(workingDir, maxDepth = 4) {
|
|
|
28396
28490
|
if (hasGit) {
|
|
28397
28491
|
out2.push({
|
|
28398
28492
|
repoRoot: dir,
|
|
28399
|
-
repoPath:
|
|
28400
|
-
repoName:
|
|
28493
|
+
repoPath: path66.relative(workingDir, dir),
|
|
28494
|
+
repoName: path66.basename(dir)
|
|
28401
28495
|
});
|
|
28402
28496
|
return;
|
|
28403
28497
|
}
|
|
@@ -28405,14 +28499,14 @@ async function discoverRepos(workingDir, maxDepth = 4) {
|
|
|
28405
28499
|
if (!entry.isDirectory) continue;
|
|
28406
28500
|
if (entry.name === "node_modules") continue;
|
|
28407
28501
|
if (entry.name === "dist" || entry.name === "build") continue;
|
|
28408
|
-
await walk(
|
|
28502
|
+
await walk(path66.join(dir, entry.name), depth + 1);
|
|
28409
28503
|
}
|
|
28410
28504
|
}
|
|
28411
28505
|
}
|
|
28412
28506
|
|
|
28413
28507
|
// src/services/turn-files/files-outbox.ts
|
|
28414
|
-
var
|
|
28415
|
-
var
|
|
28508
|
+
var fs62 = __toESM(require("fs/promises"));
|
|
28509
|
+
var path67 = __toESM(require("path"));
|
|
28416
28510
|
var import_os11 = require("os");
|
|
28417
28511
|
var HOME_OUTBOX_DIR = ".codeam/outbox";
|
|
28418
28512
|
var MAX_AGE_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -28445,16 +28539,16 @@ var FilesOutbox = class {
|
|
|
28445
28539
|
backoffIndex = 0;
|
|
28446
28540
|
stopped = false;
|
|
28447
28541
|
constructor(opts) {
|
|
28448
|
-
const base = opts.baseDir ??
|
|
28449
|
-
this.filePath =
|
|
28542
|
+
const base = opts.baseDir ?? path67.join(homeDir(), HOME_OUTBOX_DIR);
|
|
28543
|
+
this.filePath = path67.join(base, `${opts.sessionId}.jsonl`);
|
|
28450
28544
|
this.post = opts.post;
|
|
28451
28545
|
this.autoSchedule = opts.autoSchedule !== false;
|
|
28452
28546
|
}
|
|
28453
28547
|
/** Persist the entry to disk and trigger a flush. Returns once the
|
|
28454
28548
|
* line is durable on disk (not once the POST succeeds). */
|
|
28455
28549
|
async enqueue(entry) {
|
|
28456
|
-
await
|
|
28457
|
-
await
|
|
28550
|
+
await fs62.mkdir(path67.dirname(this.filePath), { recursive: true });
|
|
28551
|
+
await fs62.appendFile(this.filePath, JSON.stringify(entry) + "\n", "utf8");
|
|
28458
28552
|
this.backoffIndex = 0;
|
|
28459
28553
|
if (this.autoSchedule) this.scheduleFlush(0);
|
|
28460
28554
|
}
|
|
@@ -28545,7 +28639,7 @@ var FilesOutbox = class {
|
|
|
28545
28639
|
async readAll() {
|
|
28546
28640
|
let raw = "";
|
|
28547
28641
|
try {
|
|
28548
|
-
raw = await
|
|
28642
|
+
raw = await fs62.readFile(this.filePath, "utf8");
|
|
28549
28643
|
} catch {
|
|
28550
28644
|
return [];
|
|
28551
28645
|
}
|
|
@@ -28569,12 +28663,12 @@ var FilesOutbox = class {
|
|
|
28569
28663
|
async rewrite(entries) {
|
|
28570
28664
|
const tmpPath = `${this.filePath}.${process.pid}.tmp`;
|
|
28571
28665
|
if (entries.length === 0) {
|
|
28572
|
-
await
|
|
28666
|
+
await fs62.unlink(this.filePath).catch(() => void 0);
|
|
28573
28667
|
return;
|
|
28574
28668
|
}
|
|
28575
28669
|
const payload = entries.map((e) => JSON.stringify(e)).join("\n") + "\n";
|
|
28576
|
-
await
|
|
28577
|
-
await
|
|
28670
|
+
await fs62.writeFile(tmpPath, payload, "utf8");
|
|
28671
|
+
await fs62.rename(tmpPath, this.filePath);
|
|
28578
28672
|
}
|
|
28579
28673
|
};
|
|
28580
28674
|
function applyJitter(ms) {
|
|
@@ -31724,7 +31818,7 @@ var AcpDriver = class {
|
|
|
31724
31818
|
};
|
|
31725
31819
|
|
|
31726
31820
|
// src/baton/transcript-mirror.ts
|
|
31727
|
-
var
|
|
31821
|
+
var fs63 = __toESM(require("fs"));
|
|
31728
31822
|
var TranscriptMirror = class {
|
|
31729
31823
|
constructor(deps) {
|
|
31730
31824
|
this.deps = deps;
|
|
@@ -31791,7 +31885,7 @@ var TranscriptMirror = class {
|
|
|
31791
31885
|
}
|
|
31792
31886
|
};
|
|
31793
31887
|
function defaultWatch(file, onChange) {
|
|
31794
|
-
const w3 =
|
|
31888
|
+
const w3 = fs63.watch(file, { persistent: false }, () => onChange());
|
|
31795
31889
|
return () => w3.close();
|
|
31796
31890
|
}
|
|
31797
31891
|
|
|
@@ -32053,15 +32147,15 @@ function toEpochMs(ts) {
|
|
|
32053
32147
|
}
|
|
32054
32148
|
|
|
32055
32149
|
// src/agents/claude/onboarding.ts
|
|
32056
|
-
var
|
|
32057
|
-
var
|
|
32058
|
-
var
|
|
32150
|
+
var fs64 = __toESM(require("fs"));
|
|
32151
|
+
var os50 = __toESM(require("os"));
|
|
32152
|
+
var path68 = __toESM(require("path"));
|
|
32059
32153
|
function ensureClaudeOnboarded(cwd) {
|
|
32060
32154
|
try {
|
|
32061
|
-
const file =
|
|
32155
|
+
const file = path68.join(os50.homedir(), ".claude.json");
|
|
32062
32156
|
let config = {};
|
|
32063
32157
|
try {
|
|
32064
|
-
config = JSON.parse(
|
|
32158
|
+
config = JSON.parse(fs64.readFileSync(file, "utf8"));
|
|
32065
32159
|
} catch {
|
|
32066
32160
|
}
|
|
32067
32161
|
let changed = false;
|
|
@@ -32085,8 +32179,8 @@ function ensureClaudeOnboarded(cwd) {
|
|
|
32085
32179
|
}
|
|
32086
32180
|
}
|
|
32087
32181
|
if (!changed) return;
|
|
32088
|
-
|
|
32089
|
-
|
|
32182
|
+
fs64.mkdirSync(path68.dirname(file), { recursive: true });
|
|
32183
|
+
fs64.writeFileSync(file, JSON.stringify(config, null, 2));
|
|
32090
32184
|
log.info(
|
|
32091
32185
|
"claude",
|
|
32092
32186
|
`pre-completed Claude onboarding${cwd ? ` + trusted workspace ${cwd}` : ""}`
|
|
@@ -32772,7 +32866,7 @@ var import_picocolors11 = __toESM(require("picocolors"));
|
|
|
32772
32866
|
var import_child_process28 = require("child_process");
|
|
32773
32867
|
var import_util4 = require("util");
|
|
32774
32868
|
var import_picocolors9 = __toESM(require("picocolors"));
|
|
32775
|
-
var
|
|
32869
|
+
var path69 = __toESM(require("path"));
|
|
32776
32870
|
var execFileP6 = (0, import_util4.promisify)(import_child_process28.execFile);
|
|
32777
32871
|
var MAX_BUFFER = 8 * 1024 * 1024;
|
|
32778
32872
|
function resetStdinForChild() {
|
|
@@ -33261,7 +33355,7 @@ var GitHubCodespacesProvider = class {
|
|
|
33261
33355
|
});
|
|
33262
33356
|
}
|
|
33263
33357
|
async uploadFile(workspaceId, remotePath, contents, options = {}) {
|
|
33264
|
-
const remoteDir =
|
|
33358
|
+
const remoteDir = path69.posix.dirname(remotePath);
|
|
33265
33359
|
const parts = [
|
|
33266
33360
|
`mkdir -p ${shellQuote(remoteDir)}`,
|
|
33267
33361
|
`cat > ${shellQuote(remotePath)}`
|
|
@@ -33331,7 +33425,7 @@ function shellQuote(s) {
|
|
|
33331
33425
|
// src/services/providers/gitpod.ts
|
|
33332
33426
|
var import_child_process29 = require("child_process");
|
|
33333
33427
|
var import_util5 = require("util");
|
|
33334
|
-
var
|
|
33428
|
+
var path70 = __toESM(require("path"));
|
|
33335
33429
|
var import_picocolors10 = __toESM(require("picocolors"));
|
|
33336
33430
|
var execFileP7 = (0, import_util5.promisify)(import_child_process29.execFile);
|
|
33337
33431
|
var MAX_BUFFER2 = 8 * 1024 * 1024;
|
|
@@ -33571,7 +33665,7 @@ var GitpodProvider = class {
|
|
|
33571
33665
|
});
|
|
33572
33666
|
}
|
|
33573
33667
|
async uploadFile(workspaceId, remotePath, contents, options = {}) {
|
|
33574
|
-
const remoteDir =
|
|
33668
|
+
const remoteDir = path70.posix.dirname(remotePath);
|
|
33575
33669
|
const parts = [
|
|
33576
33670
|
`mkdir -p ${shellQuote2(remoteDir)}`,
|
|
33577
33671
|
`cat > ${shellQuote2(remotePath)}`
|
|
@@ -33607,7 +33701,7 @@ function shellQuote2(s) {
|
|
|
33607
33701
|
// src/services/providers/gitlab-workspaces.ts
|
|
33608
33702
|
var import_child_process30 = require("child_process");
|
|
33609
33703
|
var import_util6 = require("util");
|
|
33610
|
-
var
|
|
33704
|
+
var path71 = __toESM(require("path"));
|
|
33611
33705
|
var execFileP8 = (0, import_util6.promisify)(import_child_process30.execFile);
|
|
33612
33706
|
var MAX_BUFFER3 = 8 * 1024 * 1024;
|
|
33613
33707
|
var GITLAB_API_BASE = process.env.CODEAM_GITLAB_API_URL ?? "https://gitlab.com/api/v4";
|
|
@@ -33867,7 +33961,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
33867
33961
|
}
|
|
33868
33962
|
async uploadFile(workspaceId, remotePath, contents, options = {}) {
|
|
33869
33963
|
const sshHost = process.env.CODEAM_GITLAB_SSH_HOST ?? "workspaces.gitlab.com";
|
|
33870
|
-
const remoteDir =
|
|
33964
|
+
const remoteDir = path71.posix.dirname(remotePath);
|
|
33871
33965
|
const parts = [`mkdir -p ${shellQuote3(remoteDir)}`, `cat > ${shellQuote3(remotePath)}`];
|
|
33872
33966
|
if (options.mode != null) {
|
|
33873
33967
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote3(remotePath)}`);
|
|
@@ -33935,7 +34029,7 @@ function shellQuote3(s) {
|
|
|
33935
34029
|
// src/services/providers/railway.ts
|
|
33936
34030
|
var import_child_process31 = require("child_process");
|
|
33937
34031
|
var import_util7 = require("util");
|
|
33938
|
-
var
|
|
34032
|
+
var path72 = __toESM(require("path"));
|
|
33939
34033
|
var execFileP9 = (0, import_util7.promisify)(import_child_process31.execFile);
|
|
33940
34034
|
var MAX_BUFFER4 = 8 * 1024 * 1024;
|
|
33941
34035
|
function resetStdinForChild4() {
|
|
@@ -34171,7 +34265,7 @@ var RailwayProvider = class {
|
|
|
34171
34265
|
if (!projectId || !serviceId) {
|
|
34172
34266
|
throw new Error("Invalid Railway workspace id (expected projectId/serviceId).");
|
|
34173
34267
|
}
|
|
34174
|
-
const remoteDir =
|
|
34268
|
+
const remoteDir = path72.posix.dirname(remotePath);
|
|
34175
34269
|
const parts = [`mkdir -p ${shellQuote4(remoteDir)}`, `cat > ${shellQuote4(remotePath)}`];
|
|
34176
34270
|
if (options.mode != null) {
|
|
34177
34271
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote4(remotePath)}`);
|
|
@@ -34817,8 +34911,8 @@ async function invite() {
|
|
|
34817
34911
|
var import_node_dns = require("dns");
|
|
34818
34912
|
var import_node_util5 = require("util");
|
|
34819
34913
|
var import_node_crypto12 = require("crypto");
|
|
34820
|
-
var
|
|
34821
|
-
var
|
|
34914
|
+
var fs65 = __toESM(require("fs"));
|
|
34915
|
+
var path73 = __toESM(require("path"));
|
|
34822
34916
|
var import_picocolors14 = __toESM(require("picocolors"));
|
|
34823
34917
|
var dnsResolveP = (0, import_node_util5.promisify)(import_node_dns.resolve);
|
|
34824
34918
|
async function checkDns(apiBase2) {
|
|
@@ -34874,13 +34968,13 @@ async function checkHealth(apiBase2) {
|
|
|
34874
34968
|
}
|
|
34875
34969
|
}
|
|
34876
34970
|
function checkConfigDir() {
|
|
34877
|
-
const dir =
|
|
34971
|
+
const dir = path73.join(require("os").homedir(), ".codeam");
|
|
34878
34972
|
try {
|
|
34879
|
-
|
|
34880
|
-
const probe =
|
|
34881
|
-
|
|
34882
|
-
const read2 =
|
|
34883
|
-
|
|
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);
|
|
34884
34978
|
if (read2 !== "ok") throw new Error("write/read round-trip mismatch");
|
|
34885
34979
|
return {
|
|
34886
34980
|
id: "config-dir",
|
|
@@ -34920,9 +35014,9 @@ function checkSessions() {
|
|
|
34920
35014
|
}
|
|
34921
35015
|
}
|
|
34922
35016
|
function checkAgentBinaries() {
|
|
34923
|
-
const
|
|
35017
|
+
const os52 = createOsStrategy();
|
|
34924
35018
|
return getEnabledAgents().map((meta) => {
|
|
34925
|
-
const found =
|
|
35019
|
+
const found = os52.findInPath(meta.binaryName);
|
|
34926
35020
|
return {
|
|
34927
35021
|
id: `agent-${meta.id}`,
|
|
34928
35022
|
label: `Agent binary: ${meta.displayName} (${meta.binaryName})`,
|
|
@@ -34944,7 +35038,7 @@ function checkNodePty() {
|
|
|
34944
35038
|
detail: "not required on this platform"
|
|
34945
35039
|
};
|
|
34946
35040
|
}
|
|
34947
|
-
const vendoredPath =
|
|
35041
|
+
const vendoredPath = path73.join(__dirname, "vendor", "node-pty");
|
|
34948
35042
|
for (const target of [vendoredPath, "node-pty"]) {
|
|
34949
35043
|
try {
|
|
34950
35044
|
require(target);
|
|
@@ -34986,7 +35080,7 @@ function checkChokidar() {
|
|
|
34986
35080
|
}
|
|
34987
35081
|
async function doctor(args2 = []) {
|
|
34988
35082
|
const json = args2.includes("--json");
|
|
34989
|
-
const cliVersion = true ? "2.60.
|
|
35083
|
+
const cliVersion = true ? "2.60.57" : "0.0.0-dev";
|
|
34990
35084
|
const apiBase2 = resolveApiBaseUrl();
|
|
34991
35085
|
const diagnosticId = (0, import_node_crypto12.randomUUID)();
|
|
34992
35086
|
log.info("doctor", `run id=${diagnosticId} cli=${cliVersion}`);
|
|
@@ -35463,7 +35557,7 @@ async function mcpRun(args2) {
|
|
|
35463
35557
|
// src/commands/version.ts
|
|
35464
35558
|
var import_picocolors15 = __toESM(require("picocolors"));
|
|
35465
35559
|
function version2() {
|
|
35466
|
-
const v = true ? "2.60.
|
|
35560
|
+
const v = true ? "2.60.57" : "unknown";
|
|
35467
35561
|
console.log(`${import_picocolors15.default.bold("codeam-cli")} ${import_picocolors15.default.cyan(v)}`);
|
|
35468
35562
|
}
|
|
35469
35563
|
|
|
@@ -35612,10 +35706,10 @@ var EXIT_CODE_NAMES = {
|
|
|
35612
35706
|
};
|
|
35613
35707
|
|
|
35614
35708
|
// src/index.ts
|
|
35615
|
-
var
|
|
35709
|
+
var os51 = __toESM(require("os"));
|
|
35616
35710
|
if (!process.env.HOME) {
|
|
35617
35711
|
try {
|
|
35618
|
-
const home =
|
|
35712
|
+
const home = os51.homedir();
|
|
35619
35713
|
if (home) process.env.HOME = home;
|
|
35620
35714
|
} catch {
|
|
35621
35715
|
}
|