codeam-cli 2.75.6 → 2.75.7
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 +11 -0
- package/dist/index.js +316 -242
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -357,8 +357,8 @@ function defaultSpawn(timeoutMs) {
|
|
|
357
357
|
});
|
|
358
358
|
}
|
|
359
359
|
function resolveConvexBin(cwd) {
|
|
360
|
-
const local =
|
|
361
|
-
if (
|
|
360
|
+
const local = path90.join(cwd, "node_modules", ".bin", process.platform === "win32" ? "convex.cmd" : "convex");
|
|
361
|
+
if (fs77.existsSync(local)) return { cmd: local, args: [] };
|
|
362
362
|
return { cmd: "npx", args: ["--yes", "convex"] };
|
|
363
363
|
}
|
|
364
364
|
function redact(text, key) {
|
|
@@ -489,13 +489,13 @@ async function runConvexAdminMcp(client3, id) {
|
|
|
489
489
|
});
|
|
490
490
|
await server.connect(new StdioServerTransport());
|
|
491
491
|
}
|
|
492
|
-
var import_node_child_process32,
|
|
492
|
+
var import_node_child_process32, fs77, path90, TOOLS;
|
|
493
493
|
var init_convex_admin_mcp = __esm({
|
|
494
494
|
"src/integrations/convex-admin-mcp.ts"() {
|
|
495
495
|
"use strict";
|
|
496
496
|
import_node_child_process32 = require("child_process");
|
|
497
|
-
|
|
498
|
-
|
|
497
|
+
fs77 = __toESM(require("fs"));
|
|
498
|
+
path90 = __toESM(require("path"));
|
|
499
499
|
TOOLS = [
|
|
500
500
|
{
|
|
501
501
|
name: "tables",
|
|
@@ -3360,11 +3360,11 @@ function quiet(fn) {
|
|
|
3360
3360
|
log.debug(TAG, "ignored sync error", err);
|
|
3361
3361
|
}
|
|
3362
3362
|
}
|
|
3363
|
-
function rmIfExistsQuiet(
|
|
3363
|
+
function rmIfExistsQuiet(path92) {
|
|
3364
3364
|
try {
|
|
3365
|
-
fs2.rmSync(
|
|
3365
|
+
fs2.rmSync(path92, { force: true });
|
|
3366
3366
|
} catch (err) {
|
|
3367
|
-
log.debug(TAG, `rmIfExists failed for ${
|
|
3367
|
+
log.debug(TAG, `rmIfExists failed for ${path92}`, err);
|
|
3368
3368
|
}
|
|
3369
3369
|
}
|
|
3370
3370
|
function killQuiet(target, signal = "SIGTERM") {
|
|
@@ -3568,8 +3568,8 @@ function createGetModuleFromFilename(basePath = process.argv[1] ? (0, import_pat
|
|
|
3568
3568
|
return decodedFile;
|
|
3569
3569
|
};
|
|
3570
3570
|
}
|
|
3571
|
-
function normalizeWindowsPath(
|
|
3572
|
-
return
|
|
3571
|
+
function normalizeWindowsPath(path92) {
|
|
3572
|
+
return path92.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
|
|
3573
3573
|
}
|
|
3574
3574
|
|
|
3575
3575
|
// ../../node_modules/@posthog/core/dist/error-tracking/index.mjs
|
|
@@ -6302,13 +6302,13 @@ var PostHogCoreStateless = class {
|
|
|
6302
6302
|
sentFromRoute += batchMessages.length;
|
|
6303
6303
|
}
|
|
6304
6304
|
}
|
|
6305
|
-
async _sendOtlpBatch({ path:
|
|
6305
|
+
async _sendOtlpBatch({ path: path92, payload }) {
|
|
6306
6306
|
if (this.disabled) return {
|
|
6307
6307
|
kind: "fatal",
|
|
6308
6308
|
error: new Error("The client is disabled")
|
|
6309
6309
|
};
|
|
6310
6310
|
const serialized = JSON.stringify(payload);
|
|
6311
|
-
const url2 = `${this.host}/i/v1/${
|
|
6311
|
+
const url2 = `${this.host}/i/v1/${path92}?token=${encodeURIComponent(this.apiKey)}`;
|
|
6312
6312
|
const gzippedPayload = this.disableCompression ? null : await this.compressPayload(serialized);
|
|
6313
6313
|
const fetchOptions = {
|
|
6314
6314
|
method: "POST",
|
|
@@ -7548,14 +7548,14 @@ async function addSourceContext(frames, openSourceFile = import_promises.open, l
|
|
|
7548
7548
|
LRU_FILE_CONTENTS_CACHE.reduce();
|
|
7549
7549
|
return frames;
|
|
7550
7550
|
}
|
|
7551
|
-
async function openRegularSourceFile(
|
|
7551
|
+
async function openRegularSourceFile(path92, openSourceFile, logger) {
|
|
7552
7552
|
let fileHandle;
|
|
7553
7553
|
let isValid = false;
|
|
7554
7554
|
try {
|
|
7555
|
-
fileHandle = await openSourceFile(
|
|
7555
|
+
fileHandle = await openSourceFile(path92, import_node_fs.constants.O_RDONLY | import_node_fs.constants.O_NONBLOCK);
|
|
7556
7556
|
const fileStat = await fileHandle.stat();
|
|
7557
7557
|
if (!fileStat.isFile()) return;
|
|
7558
|
-
if (fileStat.size > MAX_CONTEXTLINES_FILE_SIZE) return void logger?.debug(`Skipping source context for oversized file ${
|
|
7558
|
+
if (fileStat.size > MAX_CONTEXTLINES_FILE_SIZE) return void logger?.debug(`Skipping source context for oversized file ${path92}: ${fileStat.size} bytes exceeds ${MAX_CONTEXTLINES_FILE_SIZE}`);
|
|
7559
7559
|
isValid = true;
|
|
7560
7560
|
return fileHandle;
|
|
7561
7561
|
} catch {
|
|
@@ -7565,8 +7565,8 @@ async function openRegularSourceFile(path91, openSourceFile, logger) {
|
|
|
7565
7565
|
});
|
|
7566
7566
|
}
|
|
7567
7567
|
}
|
|
7568
|
-
async function getContextLinesFromFile(
|
|
7569
|
-
const fileHandle = await openRegularSourceFile(
|
|
7568
|
+
async function getContextLinesFromFile(path92, ranges, output, cacheKey, openSourceFile, logger) {
|
|
7569
|
+
const fileHandle = await openRegularSourceFile(path92, openSourceFile, logger);
|
|
7570
7570
|
if (void 0 === fileHandle) return void LRU_FILE_CONTENTS_FS_READ_FAILED.set(cacheKey, 1);
|
|
7571
7571
|
const openedFileHandle = fileHandle;
|
|
7572
7572
|
return new Promise((resolve11) => {
|
|
@@ -7668,22 +7668,22 @@ function clearLineContext(frame) {
|
|
|
7668
7668
|
delete frame.context_line;
|
|
7669
7669
|
delete frame.post_context;
|
|
7670
7670
|
}
|
|
7671
|
-
function shouldSkipContextLinesForFile(
|
|
7672
|
-
return
|
|
7671
|
+
function shouldSkipContextLinesForFile(path92) {
|
|
7672
|
+
return path92.startsWith("node:") || path92.endsWith(".min.js") || path92.endsWith(".min.cjs") || path92.endsWith(".min.mjs") || path92.startsWith("data:");
|
|
7673
7673
|
}
|
|
7674
7674
|
function shouldSkipContextLinesForFrame(frame) {
|
|
7675
7675
|
if (void 0 !== frame.lineno && frame.lineno > MAX_CONTEXTLINES_LINENO) return true;
|
|
7676
7676
|
if (void 0 !== frame.colno && frame.colno > MAX_CONTEXTLINES_COLNO) return true;
|
|
7677
7677
|
return false;
|
|
7678
7678
|
}
|
|
7679
|
-
function makeSourceCacheKey(
|
|
7680
|
-
if ((0, import_node_path.isAbsolute)(
|
|
7679
|
+
function makeSourceCacheKey(path92, basePath) {
|
|
7680
|
+
if ((0, import_node_path.isAbsolute)(path92)) return JSON.stringify([
|
|
7681
7681
|
null,
|
|
7682
|
-
|
|
7682
|
+
path92
|
|
7683
7683
|
]);
|
|
7684
7684
|
return void 0 === basePath ? void 0 : JSON.stringify([
|
|
7685
7685
|
basePath,
|
|
7686
|
-
|
|
7686
|
+
path92
|
|
7687
7687
|
]);
|
|
7688
7688
|
}
|
|
7689
7689
|
function rangeExistsInContentCache(cacheKey, range) {
|
|
@@ -10344,7 +10344,7 @@ function readAnonId() {
|
|
|
10344
10344
|
}
|
|
10345
10345
|
function superProperties() {
|
|
10346
10346
|
return {
|
|
10347
|
-
cliVersion: true ? "2.75.
|
|
10347
|
+
cliVersion: true ? "2.75.7" : "0.0.0-dev",
|
|
10348
10348
|
nodeVersion: process.version,
|
|
10349
10349
|
platform: process.platform,
|
|
10350
10350
|
arch: process.arch,
|
|
@@ -10586,7 +10586,7 @@ var http = __toESM(require("http"));
|
|
|
10586
10586
|
// package.json
|
|
10587
10587
|
var package_default = {
|
|
10588
10588
|
name: "codeam-cli",
|
|
10589
|
-
version: "2.75.
|
|
10589
|
+
version: "2.75.7",
|
|
10590
10590
|
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.",
|
|
10591
10591
|
type: "commonjs",
|
|
10592
10592
|
main: "dist/index.js",
|
|
@@ -11887,7 +11887,7 @@ var CommandRelayService = class _CommandRelayService {
|
|
|
11887
11887
|
// fresh + clear the "CLI update available" banner after a self-update
|
|
11888
11888
|
// (a codespace that reinstalls @latest reconnects via heartbeat, not
|
|
11889
11889
|
// pair/reconnect). Older backends ignore the extra field.
|
|
11890
|
-
..."2.75.
|
|
11890
|
+
..."2.75.7" ? { ideVersion: "2.75.7" } : {}
|
|
11891
11891
|
}).then(() => log.trace("relay", `heartbeat ok online=${online}`)).catch((err) => log.trace("relay", `heartbeat failed online=${online}`, err));
|
|
11892
11892
|
}
|
|
11893
11893
|
/**
|
|
@@ -12143,10 +12143,10 @@ var WINDOWS_LEGACY_JUNCTIONS = [
|
|
|
12143
12143
|
/[\\/]Start Menu([\\/]|$)/i,
|
|
12144
12144
|
/[\\/]Templates([\\/]|$)/i
|
|
12145
12145
|
];
|
|
12146
|
-
function isUnsafeWindowsWatchRoot(dir,
|
|
12146
|
+
function isUnsafeWindowsWatchRoot(dir, homedir49) {
|
|
12147
12147
|
const norm = (p2) => p2.replace(/\//g, "\\").replace(/\\+$/, "").toLowerCase();
|
|
12148
12148
|
const cwd = norm(dir);
|
|
12149
|
-
const home = norm(
|
|
12149
|
+
const home = norm(homedir49);
|
|
12150
12150
|
if (cwd === home) return true;
|
|
12151
12151
|
if (/^[a-z]:$/.test(cwd)) return true;
|
|
12152
12152
|
const sysRoots = [
|
|
@@ -16825,10 +16825,10 @@ function buildForPlatform(platform3) {
|
|
|
16825
16825
|
var import_node_crypto4 = require("crypto");
|
|
16826
16826
|
|
|
16827
16827
|
// src/agents/claude/resolver.ts
|
|
16828
|
-
function buildClaudeLaunch(extraArgs = [],
|
|
16829
|
-
const found =
|
|
16828
|
+
function buildClaudeLaunch(extraArgs = [], os63 = createOsStrategy()) {
|
|
16829
|
+
const found = os63.findInPath("claude") ?? os63.findInPath("claude-code");
|
|
16830
16830
|
if (!found) return null;
|
|
16831
|
-
return
|
|
16831
|
+
return os63.buildLaunch(found, extraArgs);
|
|
16832
16832
|
}
|
|
16833
16833
|
|
|
16834
16834
|
// src/agents/claude/installer.ts
|
|
@@ -17590,8 +17590,8 @@ var ClaudeRuntimeStrategy = class {
|
|
|
17590
17590
|
meta = getAgent("claude");
|
|
17591
17591
|
mode = "interactive";
|
|
17592
17592
|
os;
|
|
17593
|
-
constructor(
|
|
17594
|
-
this.os =
|
|
17593
|
+
constructor(os63) {
|
|
17594
|
+
this.os = os63;
|
|
17595
17595
|
}
|
|
17596
17596
|
/**
|
|
17597
17597
|
* Claude Code's react-ink TUI enables bracketed-paste mode at
|
|
@@ -18679,8 +18679,8 @@ function codexCredentialLocator() {
|
|
|
18679
18679
|
function codexLoginLauncher() {
|
|
18680
18680
|
return {
|
|
18681
18681
|
async ensureInstalled() {
|
|
18682
|
-
const
|
|
18683
|
-
return
|
|
18682
|
+
const os63 = createOsStrategy();
|
|
18683
|
+
return os63.findInPath("codex") !== null;
|
|
18684
18684
|
},
|
|
18685
18685
|
launch() {
|
|
18686
18686
|
return (0, import_node_child_process3.spawn)("codex", ["login"], { stdio: "inherit" });
|
|
@@ -18703,8 +18703,8 @@ var CodexRuntimeStrategy = class {
|
|
|
18703
18703
|
meta = getAgent("codex");
|
|
18704
18704
|
mode = "interactive";
|
|
18705
18705
|
os;
|
|
18706
|
-
constructor(
|
|
18707
|
-
this.os =
|
|
18706
|
+
constructor(os63) {
|
|
18707
|
+
this.os = os63;
|
|
18708
18708
|
}
|
|
18709
18709
|
async prepareLaunch() {
|
|
18710
18710
|
let binary = this.os.findInPath("codex");
|
|
@@ -18813,12 +18813,12 @@ var CodexRuntimeStrategy = class {
|
|
|
18813
18813
|
});
|
|
18814
18814
|
}
|
|
18815
18815
|
};
|
|
18816
|
-
function resolveNpm(
|
|
18817
|
-
return
|
|
18816
|
+
function resolveNpm(os63) {
|
|
18817
|
+
return os63.id === "win32" ? "npm.cmd" : "npm";
|
|
18818
18818
|
}
|
|
18819
|
-
async function installCodexViaNpm(
|
|
18819
|
+
async function installCodexViaNpm(os63) {
|
|
18820
18820
|
return new Promise((resolve11, reject) => {
|
|
18821
|
-
const proc = (0, import_node_child_process4.spawn)(resolveNpm(
|
|
18821
|
+
const proc = (0, import_node_child_process4.spawn)(resolveNpm(os63), ["install", "-g", "@openai/codex"], {
|
|
18822
18822
|
stdio: "inherit"
|
|
18823
18823
|
});
|
|
18824
18824
|
proc.on("close", (code) => {
|
|
@@ -18835,16 +18835,16 @@ async function installCodexViaNpm(os62) {
|
|
|
18835
18835
|
});
|
|
18836
18836
|
});
|
|
18837
18837
|
}
|
|
18838
|
-
function augmentNpmGlobalBin(
|
|
18838
|
+
function augmentNpmGlobalBin(os63) {
|
|
18839
18839
|
try {
|
|
18840
|
-
const result = (0, import_node_child_process4.spawnSync)(resolveNpm(
|
|
18840
|
+
const result = (0, import_node_child_process4.spawnSync)(resolveNpm(os63), ["prefix", "-g"], {
|
|
18841
18841
|
stdio: ["ignore", "pipe", "ignore"]
|
|
18842
18842
|
});
|
|
18843
18843
|
if (result.status !== 0) return;
|
|
18844
18844
|
const prefix = result.stdout.toString().trim();
|
|
18845
18845
|
if (!prefix) return;
|
|
18846
|
-
const binDir =
|
|
18847
|
-
|
|
18846
|
+
const binDir = os63.id === "win32" ? prefix : path24.join(prefix, "bin");
|
|
18847
|
+
os63.augmentPath([binDir]);
|
|
18848
18848
|
} catch {
|
|
18849
18849
|
}
|
|
18850
18850
|
}
|
|
@@ -19038,10 +19038,10 @@ function manualInstallHint(runner, tools) {
|
|
|
19038
19038
|
const argv = osPackageInstallArgv(detectPackageManager(runner), [...tools]);
|
|
19039
19039
|
return argv ? `\`sudo ${argv.join(" ")}\`` : `your package manager (e.g. \`${pkgs}\`)`;
|
|
19040
19040
|
}
|
|
19041
|
-
function writeUnzipShim(
|
|
19041
|
+
function writeUnzipShim(os63, runner) {
|
|
19042
19042
|
const python = ["python3", "python"].find((p2) => runner.which(p2));
|
|
19043
19043
|
if (!python) return null;
|
|
19044
|
-
const dir =
|
|
19044
|
+
const dir = os63.scratchPath("codeam-cr-prereq");
|
|
19045
19045
|
const shim = path26.join(dir, "unzip");
|
|
19046
19046
|
const script = `#!/bin/sh
|
|
19047
19047
|
set -e
|
|
@@ -19063,9 +19063,9 @@ exec ${python} -m zipfile -e "$archive" "$dest"
|
|
|
19063
19063
|
(0, import_node_fs5.chmodSync)(shim, 448);
|
|
19064
19064
|
return dir;
|
|
19065
19065
|
}
|
|
19066
|
-
async function ensureInstallPrerequisites(
|
|
19066
|
+
async function ensureInstallPrerequisites(os63, deps = {}) {
|
|
19067
19067
|
const runner = deps.runner ?? defaultOsRunner;
|
|
19068
|
-
const missing = REQUIRED_TOOLS.filter((t2) =>
|
|
19068
|
+
const missing = REQUIRED_TOOLS.filter((t2) => os63.findInPath(t2) === null);
|
|
19069
19069
|
if (missing.length === 0) return { ok: true, extraPath: [] };
|
|
19070
19070
|
log.info(
|
|
19071
19071
|
"coderabbit",
|
|
@@ -19084,10 +19084,10 @@ async function ensureInstallPrerequisites(os62, deps = {}) {
|
|
|
19084
19084
|
);
|
|
19085
19085
|
}
|
|
19086
19086
|
}
|
|
19087
|
-
const stillMissing = REQUIRED_TOOLS.filter((t2) =>
|
|
19087
|
+
const stillMissing = REQUIRED_TOOLS.filter((t2) => os63.findInPath(t2) === null);
|
|
19088
19088
|
if (stillMissing.length === 0) return { ok: true, extraPath: [] };
|
|
19089
19089
|
if (stillMissing.length === 1 && stillMissing[0] === "unzip") {
|
|
19090
|
-
const shimDir = writeUnzipShim(
|
|
19090
|
+
const shimDir = writeUnzipShim(os63, runner);
|
|
19091
19091
|
if (shimDir) {
|
|
19092
19092
|
log.info("coderabbit", "unzip is unavailable \u2014 using a scoped python zipfile shim");
|
|
19093
19093
|
return { ok: true, extraPath: [shimDir] };
|
|
@@ -19150,15 +19150,15 @@ function summarizeInstallFailure(output) {
|
|
|
19150
19150
|
}
|
|
19151
19151
|
return lines.length > 0 ? lines[lines.length - 1] : null;
|
|
19152
19152
|
}
|
|
19153
|
-
async function ensureCoderabbitInstalled(
|
|
19154
|
-
if (
|
|
19155
|
-
if (
|
|
19153
|
+
async function ensureCoderabbitInstalled(os63, deps = {}) {
|
|
19154
|
+
if (os63.findInPath("coderabbit")) return { ok: true };
|
|
19155
|
+
if (os63.id === "win32") {
|
|
19156
19156
|
return {
|
|
19157
19157
|
ok: false,
|
|
19158
19158
|
error: "CodeRabbit on Windows requires WSL. Install the CLI inside your WSL distribution (curl -fsSL https://cli.coderabbit.ai/install.sh | sh), then try again."
|
|
19159
19159
|
};
|
|
19160
19160
|
}
|
|
19161
|
-
const prereq = await ensureInstallPrerequisites(
|
|
19161
|
+
const prereq = await ensureInstallPrerequisites(os63, deps);
|
|
19162
19162
|
if (!prereq.ok) return { ok: false, error: prereq.error };
|
|
19163
19163
|
const env = { ...process.env };
|
|
19164
19164
|
if (prereq.extraPath.length > 0) {
|
|
@@ -19167,8 +19167,8 @@ async function ensureCoderabbitInstalled(os62, deps = {}) {
|
|
|
19167
19167
|
log.info("coderabbit", "CodeRabbit CLI not found \u2014 installing via the official script");
|
|
19168
19168
|
const run = deps.runInstallScript ?? defaultRunInstallScript;
|
|
19169
19169
|
const { code, output } = await run(env);
|
|
19170
|
-
|
|
19171
|
-
const binary =
|
|
19170
|
+
os63.augmentPath([`${os63.homeDir()}/.local/bin`, "/opt/homebrew/bin"]);
|
|
19171
|
+
const binary = os63.findInPath("coderabbit");
|
|
19172
19172
|
const detail = summarizeInstallFailure(output);
|
|
19173
19173
|
if (binary !== null) {
|
|
19174
19174
|
if (code === 0) return { ok: true };
|
|
@@ -19222,10 +19222,10 @@ function coderabbitCredentialLocator() {
|
|
|
19222
19222
|
validate: validateNonEmptyCredential
|
|
19223
19223
|
};
|
|
19224
19224
|
}
|
|
19225
|
-
function coderabbitLoginLauncher(
|
|
19225
|
+
function coderabbitLoginLauncher(os63) {
|
|
19226
19226
|
return {
|
|
19227
19227
|
async ensureInstalled() {
|
|
19228
|
-
const result = await ensureCoderabbitInstalled(
|
|
19228
|
+
const result = await ensureCoderabbitInstalled(os63);
|
|
19229
19229
|
if (!result.ok && result.error) console.error(`
|
|
19230
19230
|
\u2717 ${result.error}
|
|
19231
19231
|
`);
|
|
@@ -19285,8 +19285,8 @@ function pickLine(obj) {
|
|
|
19285
19285
|
function toHunk(raw, groupSeverity) {
|
|
19286
19286
|
if (!raw || typeof raw !== "object") return null;
|
|
19287
19287
|
const o = raw;
|
|
19288
|
-
const
|
|
19289
|
-
if (!
|
|
19288
|
+
const path92 = asString(pick(o, ["file_path", "filePath", "file", "path", "filename", "fileName"])) ?? asString(pick(o, ["location"])?.path);
|
|
19289
|
+
if (!path92) return null;
|
|
19290
19290
|
const message = asString(
|
|
19291
19291
|
pick(o, [
|
|
19292
19292
|
"comment",
|
|
@@ -19303,7 +19303,7 @@ function toHunk(raw, groupSeverity) {
|
|
|
19303
19303
|
const severity = normSeverity(pick(o, ["severity", "level", "priority", "impact"])) ?? normSeverity(groupSeverity);
|
|
19304
19304
|
const locObj = pick(o, ["location"]) ?? o;
|
|
19305
19305
|
return {
|
|
19306
|
-
path:
|
|
19306
|
+
path: path92.trim(),
|
|
19307
19307
|
line: pickLine(o) ?? pickLine(locObj),
|
|
19308
19308
|
severity,
|
|
19309
19309
|
message: (title && message ? `${title}: ${message}` : title || message).trim() || "(no message)"
|
|
@@ -19386,10 +19386,10 @@ function parsePlain(stdout) {
|
|
|
19386
19386
|
for (const line of stdout.split(/\r?\n/)) {
|
|
19387
19387
|
const m = line.match(HUNK_LINE_RE);
|
|
19388
19388
|
if (!m) continue;
|
|
19389
|
-
const [,
|
|
19390
|
-
if (!
|
|
19389
|
+
const [, path92, lineNo, sevToken, message] = m;
|
|
19390
|
+
if (!path92 || !lineNo || !message) continue;
|
|
19391
19391
|
hunks.push({
|
|
19392
|
-
path:
|
|
19392
|
+
path: path92.trim(),
|
|
19393
19393
|
line: Number(lineNo),
|
|
19394
19394
|
severity: sevToken ? SEVERITY_MAP[sevToken.toLowerCase()] : void 0,
|
|
19395
19395
|
message: message.trim().replace(/^[*-]\s+/, "")
|
|
@@ -19449,8 +19449,8 @@ var CoderabbitRuntimeStrategy = class {
|
|
|
19449
19449
|
meta = getAgent("coderabbit");
|
|
19450
19450
|
mode = "batch";
|
|
19451
19451
|
os;
|
|
19452
|
-
constructor(
|
|
19453
|
-
this.os =
|
|
19452
|
+
constructor(os63) {
|
|
19453
|
+
this.os = os63;
|
|
19454
19454
|
}
|
|
19455
19455
|
getDefaultArgs() {
|
|
19456
19456
|
return ["review", "--agent"];
|
|
@@ -19721,10 +19721,10 @@ function cursorCredentialLocator() {
|
|
|
19721
19721
|
validate: validateNonEmptyCredential
|
|
19722
19722
|
};
|
|
19723
19723
|
}
|
|
19724
|
-
function cursorLoginLauncher(
|
|
19724
|
+
function cursorLoginLauncher(os63) {
|
|
19725
19725
|
return {
|
|
19726
19726
|
async ensureInstalled() {
|
|
19727
|
-
if (
|
|
19727
|
+
if (os63.findInPath("cursor-agent")) return true;
|
|
19728
19728
|
console.error(
|
|
19729
19729
|
"\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"
|
|
19730
19730
|
);
|
|
@@ -19788,8 +19788,8 @@ var CursorRuntimeStrategy = class {
|
|
|
19788
19788
|
meta = getAgent("cursor");
|
|
19789
19789
|
mode = "interactive";
|
|
19790
19790
|
os;
|
|
19791
|
-
constructor(
|
|
19792
|
-
this.os =
|
|
19791
|
+
constructor(os63) {
|
|
19792
|
+
this.os = os63;
|
|
19793
19793
|
}
|
|
19794
19794
|
async prepareLaunch() {
|
|
19795
19795
|
const binary = this.os.findInPath("cursor-agent");
|
|
@@ -20005,10 +20005,10 @@ function aiderCredentialLocator() {
|
|
|
20005
20005
|
validate: validateNonEmptyCredential
|
|
20006
20006
|
};
|
|
20007
20007
|
}
|
|
20008
|
-
function aiderLoginLauncher(
|
|
20008
|
+
function aiderLoginLauncher(os63) {
|
|
20009
20009
|
return {
|
|
20010
20010
|
async ensureInstalled() {
|
|
20011
|
-
if (
|
|
20011
|
+
if (os63.findInPath("aider")) return true;
|
|
20012
20012
|
console.error(
|
|
20013
20013
|
"\n \u2717 aider binary not on PATH.\n Install Aider:\n pip install aider-chat\n then re-run `codeam link aider`.\n"
|
|
20014
20014
|
);
|
|
@@ -20018,7 +20018,7 @@ function aiderLoginLauncher(os62) {
|
|
|
20018
20018
|
console.error(
|
|
20019
20019
|
"\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"
|
|
20020
20020
|
);
|
|
20021
|
-
return (0, import_node_child_process11.spawn)(
|
|
20021
|
+
return (0, import_node_child_process11.spawn)(os63.id === "win32" ? "cmd.exe" : "sh", os63.id === "win32" ? ["/c", "exit", "0"] : ["-c", "exit 0"], {
|
|
20022
20022
|
stdio: "ignore"
|
|
20023
20023
|
});
|
|
20024
20024
|
}
|
|
@@ -20293,8 +20293,8 @@ var AiderRuntimeStrategy = class {
|
|
|
20293
20293
|
meta = getAgent("aider");
|
|
20294
20294
|
mode = "interactive";
|
|
20295
20295
|
os;
|
|
20296
|
-
constructor(
|
|
20297
|
-
this.os =
|
|
20296
|
+
constructor(os63) {
|
|
20297
|
+
this.os = os63;
|
|
20298
20298
|
}
|
|
20299
20299
|
async prepareLaunch() {
|
|
20300
20300
|
augmentUserLocalBinPaths();
|
|
@@ -20427,8 +20427,8 @@ function geminiCredentialLocator() {
|
|
|
20427
20427
|
function geminiLoginLauncher() {
|
|
20428
20428
|
return {
|
|
20429
20429
|
async ensureInstalled() {
|
|
20430
|
-
const
|
|
20431
|
-
return
|
|
20430
|
+
const os63 = createOsStrategy();
|
|
20431
|
+
return os63.findInPath("gemini") !== null;
|
|
20432
20432
|
},
|
|
20433
20433
|
launch() {
|
|
20434
20434
|
return (0, import_node_child_process12.spawn)("gemini", ["auth", "login"], { stdio: "inherit" });
|
|
@@ -20618,8 +20618,8 @@ var GeminiRuntimeStrategy = class {
|
|
|
20618
20618
|
meta = getAgent("gemini");
|
|
20619
20619
|
mode = "interactive";
|
|
20620
20620
|
os;
|
|
20621
|
-
constructor(
|
|
20622
|
-
this.os =
|
|
20621
|
+
constructor(os63) {
|
|
20622
|
+
this.os = os63;
|
|
20623
20623
|
}
|
|
20624
20624
|
async prepareLaunch() {
|
|
20625
20625
|
const binary = this.os.findInPath("gemini");
|
|
@@ -20910,8 +20910,8 @@ var KimiRuntimeStrategy = class {
|
|
|
20910
20910
|
meta = getAgent("kimi");
|
|
20911
20911
|
mode = "interactive";
|
|
20912
20912
|
os;
|
|
20913
|
-
constructor(
|
|
20914
|
-
this.os =
|
|
20913
|
+
constructor(os63) {
|
|
20914
|
+
this.os = os63;
|
|
20915
20915
|
}
|
|
20916
20916
|
async prepareLaunch() {
|
|
20917
20917
|
const binary = this.os.findInPath("kimi");
|
|
@@ -21053,8 +21053,8 @@ var OpencodeRuntimeStrategy = class {
|
|
|
21053
21053
|
meta = getAgent("opencode");
|
|
21054
21054
|
mode = "interactive";
|
|
21055
21055
|
os;
|
|
21056
|
-
constructor(
|
|
21057
|
-
this.os =
|
|
21056
|
+
constructor(os63) {
|
|
21057
|
+
this.os = os63;
|
|
21058
21058
|
}
|
|
21059
21059
|
async prepareLaunch() {
|
|
21060
21060
|
const binary = this.os.findInPath("opencode");
|
|
@@ -21138,20 +21138,20 @@ var OpencodeRuntimeStrategy = class {
|
|
|
21138
21138
|
|
|
21139
21139
|
// src/agents/registry.ts
|
|
21140
21140
|
var runtimeBuilders = {
|
|
21141
|
-
claude: (
|
|
21142
|
-
codex: (
|
|
21143
|
-
coderabbit: (
|
|
21144
|
-
cursor: (
|
|
21145
|
-
aider: (
|
|
21146
|
-
gemini: (
|
|
21147
|
-
kimi: (
|
|
21148
|
-
opencode: (
|
|
21141
|
+
claude: (os63) => new ClaudeRuntimeStrategy(os63),
|
|
21142
|
+
codex: (os63) => new CodexRuntimeStrategy(os63),
|
|
21143
|
+
coderabbit: (os63) => new CoderabbitRuntimeStrategy(os63),
|
|
21144
|
+
cursor: (os63) => new CursorRuntimeStrategy(os63),
|
|
21145
|
+
aider: (os63) => new AiderRuntimeStrategy(os63),
|
|
21146
|
+
gemini: (os63) => new GeminiRuntimeStrategy(os63),
|
|
21147
|
+
kimi: (os63) => new KimiRuntimeStrategy(os63),
|
|
21148
|
+
opencode: (os63) => new OpencodeRuntimeStrategy(os63)
|
|
21149
21149
|
};
|
|
21150
21150
|
var deployBuilders = {
|
|
21151
21151
|
claude: () => new ClaudeDeployStrategy(),
|
|
21152
21152
|
codex: () => new CodexDeployStrategy()
|
|
21153
21153
|
};
|
|
21154
|
-
function createAgentStrategy(agent,
|
|
21154
|
+
function createAgentStrategy(agent, os63 = createOsStrategy()) {
|
|
21155
21155
|
if (!AGENT_REGISTRY[agent]?.enabled) {
|
|
21156
21156
|
throw new Error(
|
|
21157
21157
|
`Agent "${agent}" is not supported in this codeam-cli version. Upgrade with 'npm i -g codeam-cli@latest'.`
|
|
@@ -21161,10 +21161,10 @@ function createAgentStrategy(agent, os62 = createOsStrategy()) {
|
|
|
21161
21161
|
if (!build) {
|
|
21162
21162
|
throw new Error(`No runtime strategy registered for agent "${agent}"`);
|
|
21163
21163
|
}
|
|
21164
|
-
return build(
|
|
21164
|
+
return build(os63);
|
|
21165
21165
|
}
|
|
21166
|
-
function createInteractiveAgentStrategy(agent,
|
|
21167
|
-
const s = createAgentStrategy(agent,
|
|
21166
|
+
function createInteractiveAgentStrategy(agent, os63 = createOsStrategy()) {
|
|
21167
|
+
const s = createAgentStrategy(agent, os63);
|
|
21168
21168
|
if (s.mode !== "interactive") {
|
|
21169
21169
|
throw new Error(
|
|
21170
21170
|
`Agent "${agent}" is a batch agent; use createAgentStrategy + .runOneShot for one-shot reviews.`
|
|
@@ -21874,8 +21874,8 @@ function collectChangedFiles(cwd) {
|
|
|
21874
21874
|
}
|
|
21875
21875
|
return [...byPath.values()];
|
|
21876
21876
|
}
|
|
21877
|
-
function restoreCoderabbitOauthBlob(
|
|
21878
|
-
const dir = path38.join(
|
|
21877
|
+
function restoreCoderabbitOauthBlob(os63, value) {
|
|
21878
|
+
const dir = path38.join(os63.homeDir(), ".coderabbit");
|
|
21879
21879
|
(0, import_node_fs6.mkdirSync)(dir, { recursive: true });
|
|
21880
21880
|
let file = "auth.json";
|
|
21881
21881
|
let contents = value.trim();
|
|
@@ -21895,26 +21895,26 @@ function installFailureMessage(result) {
|
|
|
21895
21895
|
return result.error ?? "CodeRabbit CLI could not be installed";
|
|
21896
21896
|
}
|
|
21897
21897
|
async function configureCoderabbit(input, deps = {}) {
|
|
21898
|
-
const
|
|
21898
|
+
const os63 = deps.os ?? createOsStrategy();
|
|
21899
21899
|
const ensureInstalled = deps.ensureInstalled ?? ensureCoderabbitInstalled;
|
|
21900
21900
|
const isLoggedIn = deps.isLoggedIn ?? defaultIsLoggedIn;
|
|
21901
21901
|
const runOAuth = deps.runOAuthLogin ?? runCoderabbitOAuthLogin;
|
|
21902
21902
|
const snapshot = deps.snapshotDir ?? (() => snapshotCredentialDir());
|
|
21903
21903
|
const capture2 = deps.captureCredential ?? ((b) => diffCapturedCredential(b));
|
|
21904
21904
|
const loginWithApiKey = deps.loginWithApiKey ?? defaultLoginWithApiKey;
|
|
21905
|
-
const home =
|
|
21906
|
-
|
|
21907
|
-
|
|
21905
|
+
const home = os63.homeDir();
|
|
21906
|
+
os63.augmentPath(
|
|
21907
|
+
os63.id === "win32" ? [
|
|
21908
21908
|
path38.join(home, ".local", "bin"),
|
|
21909
21909
|
path38.join(process.env.APPDATA ?? path38.join(home, "AppData", "Roaming"), "npm"),
|
|
21910
21910
|
path38.join(home, "scoop", "shims")
|
|
21911
21911
|
] : [path38.join(home, ".local", "bin"), "/opt/homebrew/bin", "/usr/local/bin"]
|
|
21912
21912
|
);
|
|
21913
|
-
const installed2 =
|
|
21913
|
+
const installed2 = os63.findInPath("coderabbit") !== null;
|
|
21914
21914
|
const base = () => ({
|
|
21915
21915
|
action: input.action,
|
|
21916
21916
|
supported: true,
|
|
21917
|
-
installed:
|
|
21917
|
+
installed: os63.findInPath("coderabbit") !== null,
|
|
21918
21918
|
loggedIn: false
|
|
21919
21919
|
});
|
|
21920
21920
|
if (input.action === "status") {
|
|
@@ -21928,7 +21928,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
21928
21928
|
const key = (input.apiKey ?? "").trim();
|
|
21929
21929
|
if (!key) return { ...res2, error: "No API key provided" };
|
|
21930
21930
|
if (!res2.installed) {
|
|
21931
|
-
const inst = await ensureInstalled(
|
|
21931
|
+
const inst = await ensureInstalled(os63);
|
|
21932
21932
|
res2.installed = inst.ok;
|
|
21933
21933
|
if (!inst.ok) return { ...res2, error: installFailureMessage(inst) };
|
|
21934
21934
|
}
|
|
@@ -21952,7 +21952,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
21952
21952
|
}
|
|
21953
21953
|
if (!res2.installed) {
|
|
21954
21954
|
deps.onEvent?.({ kind: "installing" });
|
|
21955
|
-
const inst = await ensureInstalled(
|
|
21955
|
+
const inst = await ensureInstalled(os63);
|
|
21956
21956
|
res2.installed = inst.ok;
|
|
21957
21957
|
if (!inst.ok) return { ...res2, error: installFailureMessage(inst) };
|
|
21958
21958
|
}
|
|
@@ -21969,7 +21969,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
21969
21969
|
return { ...res2, loggedIn: true, linked: true };
|
|
21970
21970
|
}
|
|
21971
21971
|
try {
|
|
21972
|
-
restoreCoderabbitOauthBlob(
|
|
21972
|
+
restoreCoderabbitOauthBlob(os63, cred.credential);
|
|
21973
21973
|
} catch (err) {
|
|
21974
21974
|
return {
|
|
21975
21975
|
...res2,
|
|
@@ -21993,7 +21993,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
21993
21993
|
const res2 = base();
|
|
21994
21994
|
if (!installed2) {
|
|
21995
21995
|
deps.onEvent?.({ kind: "installing" });
|
|
21996
|
-
const inst = await ensureInstalled(
|
|
21996
|
+
const inst = await ensureInstalled(os63);
|
|
21997
21997
|
res2.installed = inst.ok;
|
|
21998
21998
|
if (!inst.ok) return { ...res2, error: installFailureMessage(inst) };
|
|
21999
21999
|
}
|
|
@@ -22033,7 +22033,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
22033
22033
|
}
|
|
22034
22034
|
const res = base();
|
|
22035
22035
|
if (!res.installed) {
|
|
22036
|
-
const inst = await ensureInstalled(
|
|
22036
|
+
const inst = await ensureInstalled(os63);
|
|
22037
22037
|
res.installed = inst.ok;
|
|
22038
22038
|
if (!inst.ok) return { ...res, error: installFailureMessage(inst) };
|
|
22039
22039
|
}
|
|
@@ -25062,11 +25062,11 @@ function resolveDoltInstallStrategy(platform3) {
|
|
|
25062
25062
|
}
|
|
25063
25063
|
var DOLT_RELEASE_BASE = "https://github.com/dolthub/dolt/releases/latest/download";
|
|
25064
25064
|
function doltPlatformTuple(platform3, arch2) {
|
|
25065
|
-
const
|
|
25065
|
+
const os63 = platform3 === "win32" ? "windows" : platform3 === "darwin" ? "darwin" : "linux";
|
|
25066
25066
|
const a = arch2 === "x64" ? "amd64" : arch2 === "arm64" ? "arm64" : null;
|
|
25067
25067
|
if (!a) return null;
|
|
25068
|
-
if (
|
|
25069
|
-
return `${
|
|
25068
|
+
if (os63 === "windows" && a !== "amd64") return null;
|
|
25069
|
+
return `${os63}-${a}`;
|
|
25070
25070
|
}
|
|
25071
25071
|
function resolveDoltTarballStrategy(targetDir, platform3, arch2) {
|
|
25072
25072
|
const tuple = doltPlatformTuple(platform3, arch2);
|
|
@@ -26728,7 +26728,7 @@ var vcsAgentReviewH = async (ctx, cmd, parsed) => {
|
|
|
26728
26728
|
});
|
|
26729
26729
|
const token = ctx.pluginAuthToken;
|
|
26730
26730
|
void (async () => {
|
|
26731
|
-
const
|
|
26731
|
+
const os63 = createOsStrategy();
|
|
26732
26732
|
try {
|
|
26733
26733
|
const report = await reviewPullRequest(
|
|
26734
26734
|
{
|
|
@@ -26737,7 +26737,7 @@ var vcsAgentReviewH = async (ctx, cmd, parsed) => {
|
|
|
26737
26737
|
baseBranch: parsed.baseBranch
|
|
26738
26738
|
},
|
|
26739
26739
|
{
|
|
26740
|
-
runReview: (input) => new CoderabbitRuntimeStrategy(
|
|
26740
|
+
runReview: (input) => new CoderabbitRuntimeStrategy(os63).runOneShot(input),
|
|
26741
26741
|
runGh: (args2) => defaultRunGh(args2),
|
|
26742
26742
|
postReport: async (r) => {
|
|
26743
26743
|
if (!token) return;
|
|
@@ -27872,11 +27872,11 @@ function resolveTokenValue(args2) {
|
|
|
27872
27872
|
}
|
|
27873
27873
|
const fileFlag = args2.find((a) => a.startsWith("--token-file="));
|
|
27874
27874
|
if (fileFlag) {
|
|
27875
|
-
const
|
|
27875
|
+
const path92 = fileFlag.slice("--token-file=".length);
|
|
27876
27876
|
try {
|
|
27877
|
-
const content = fs51.readFileSync(
|
|
27878
|
-
if (content.length === 0) fail(`--token-file ${
|
|
27879
|
-
rmIfExistsQuiet(
|
|
27877
|
+
const content = fs51.readFileSync(path92, "utf8").trim();
|
|
27878
|
+
if (content.length === 0) fail(`--token-file ${path92} is empty`);
|
|
27879
|
+
rmIfExistsQuiet(path92);
|
|
27880
27880
|
return content;
|
|
27881
27881
|
} catch (err) {
|
|
27882
27882
|
fail(`Could not read --token-file: ${err.message}`);
|
|
@@ -36583,7 +36583,7 @@ function defaultRunGit(cwd, args2) {
|
|
|
36583
36583
|
});
|
|
36584
36584
|
}
|
|
36585
36585
|
async function discoverRepos(workingDir, maxDepth = 4) {
|
|
36586
|
-
const
|
|
36586
|
+
const fs78 = await import("fs/promises");
|
|
36587
36587
|
const out2 = [];
|
|
36588
36588
|
await walk(workingDir, 0);
|
|
36589
36589
|
return out2;
|
|
@@ -36591,7 +36591,7 @@ async function discoverRepos(workingDir, maxDepth = 4) {
|
|
|
36591
36591
|
if (depth > maxDepth) return;
|
|
36592
36592
|
let entries = [];
|
|
36593
36593
|
try {
|
|
36594
|
-
const dirents = await
|
|
36594
|
+
const dirents = await fs78.readdir(dir, { withFileTypes: true });
|
|
36595
36595
|
entries = dirents.filter((d3) => !d3.name.startsWith(".") || d3.name === ".git").map((d3) => ({ name: d3.name, isDirectory: d3.isDirectory() }));
|
|
36596
36596
|
} catch {
|
|
36597
36597
|
return;
|
|
@@ -41750,6 +41750,74 @@ ${BEADS_HINT}
|
|
|
41750
41750
|
}
|
|
41751
41751
|
}
|
|
41752
41752
|
|
|
41753
|
+
// src/agents/retired-proxy-cleanup.ts
|
|
41754
|
+
var fs68 = __toESM(require("fs"));
|
|
41755
|
+
var path78 = __toESM(require("path"));
|
|
41756
|
+
var os53 = __toESM(require("os"));
|
|
41757
|
+
var RETIRED_PROXY_RE = /^https?:\/\/(?:127\.0\.0\.1|localhost|\[::1\]):8787(?:[/?#]|$)/i;
|
|
41758
|
+
var HEADROOM_CMD_RE = /(^|[\s/"'])headroom(\s|$)/i;
|
|
41759
|
+
var MARKETPLACE_KEY = "headroom-marketplace";
|
|
41760
|
+
function isHeadroomHook(group) {
|
|
41761
|
+
return (group.hooks ?? []).some(
|
|
41762
|
+
(h) => typeof h?.command === "string" && HEADROOM_CMD_RE.test(h.command)
|
|
41763
|
+
);
|
|
41764
|
+
}
|
|
41765
|
+
function sanitizeRetiredProxyConfig(homeDir2 = os53.homedir()) {
|
|
41766
|
+
const out2 = { inspected: false, changed: false, removed: [] };
|
|
41767
|
+
const file = path78.join(homeDir2, ".claude", "settings.json");
|
|
41768
|
+
let parsed;
|
|
41769
|
+
try {
|
|
41770
|
+
parsed = JSON.parse(fs68.readFileSync(file, "utf8"));
|
|
41771
|
+
} catch {
|
|
41772
|
+
return out2;
|
|
41773
|
+
}
|
|
41774
|
+
if (!parsed || typeof parsed !== "object") return out2;
|
|
41775
|
+
out2.inspected = true;
|
|
41776
|
+
const env = parsed.env;
|
|
41777
|
+
if (env && typeof env === "object") {
|
|
41778
|
+
const envRec = env;
|
|
41779
|
+
const base = envRec.ANTHROPIC_BASE_URL;
|
|
41780
|
+
if (typeof base === "string" && RETIRED_PROXY_RE.test(base.trim())) {
|
|
41781
|
+
delete envRec.ANTHROPIC_BASE_URL;
|
|
41782
|
+
out2.removed.push("env.ANTHROPIC_BASE_URL");
|
|
41783
|
+
out2.changed = true;
|
|
41784
|
+
if (Object.keys(envRec).length === 0) delete parsed.env;
|
|
41785
|
+
}
|
|
41786
|
+
}
|
|
41787
|
+
const mkts = parsed.extraKnownMarketplaces;
|
|
41788
|
+
if (mkts && typeof mkts === "object" && MARKETPLACE_KEY in mkts) {
|
|
41789
|
+
delete mkts[MARKETPLACE_KEY];
|
|
41790
|
+
out2.removed.push(`extraKnownMarketplaces.${MARKETPLACE_KEY}`);
|
|
41791
|
+
out2.changed = true;
|
|
41792
|
+
if (Object.keys(mkts).length === 0) delete parsed.extraKnownMarketplaces;
|
|
41793
|
+
}
|
|
41794
|
+
const hooks = parsed.hooks;
|
|
41795
|
+
if (hooks && typeof hooks === "object") {
|
|
41796
|
+
const hookRec = hooks;
|
|
41797
|
+
for (const [event, groups] of Object.entries(hookRec)) {
|
|
41798
|
+
if (!Array.isArray(groups)) continue;
|
|
41799
|
+
const kept = groups.filter((g) => !isHeadroomHook(g));
|
|
41800
|
+
if (kept.length !== groups.length) {
|
|
41801
|
+
out2.removed.push(`hooks.${event}`);
|
|
41802
|
+
out2.changed = true;
|
|
41803
|
+
if (kept.length) hookRec[event] = kept;
|
|
41804
|
+
else delete hookRec[event];
|
|
41805
|
+
}
|
|
41806
|
+
}
|
|
41807
|
+
if (Object.keys(hookRec).length === 0) delete parsed.hooks;
|
|
41808
|
+
}
|
|
41809
|
+
if (!out2.changed) return out2;
|
|
41810
|
+
try {
|
|
41811
|
+
const tmp = `${file}.codeam.tmp`;
|
|
41812
|
+
fs68.writeFileSync(tmp, `${JSON.stringify(parsed, null, 2)}
|
|
41813
|
+
`, { mode: 384 });
|
|
41814
|
+
fs68.renameSync(tmp, file);
|
|
41815
|
+
} catch {
|
|
41816
|
+
out2.changed = false;
|
|
41817
|
+
}
|
|
41818
|
+
return out2;
|
|
41819
|
+
}
|
|
41820
|
+
|
|
41753
41821
|
// src/integrations/refresh-manifest.ts
|
|
41754
41822
|
function fingerprint(m) {
|
|
41755
41823
|
const norm = [...m.integrations].map((e) => ({ id: e.id, delivery: e.delivery })).sort((a, b) => a.id.localeCompare(b.id));
|
|
@@ -42275,7 +42343,7 @@ var AcpDriver = class {
|
|
|
42275
42343
|
};
|
|
42276
42344
|
|
|
42277
42345
|
// src/baton/transcript-mirror.ts
|
|
42278
|
-
var
|
|
42346
|
+
var fs69 = __toESM(require("fs"));
|
|
42279
42347
|
var TranscriptMirror = class {
|
|
42280
42348
|
constructor(deps) {
|
|
42281
42349
|
this.deps = deps;
|
|
@@ -42369,7 +42437,7 @@ var TranscriptMirror = class {
|
|
|
42369
42437
|
}
|
|
42370
42438
|
};
|
|
42371
42439
|
function defaultWatch(file, onChange) {
|
|
42372
|
-
const w3 =
|
|
42440
|
+
const w3 = fs69.watch(file, { persistent: false }, () => onChange());
|
|
42373
42441
|
return () => w3.close();
|
|
42374
42442
|
}
|
|
42375
42443
|
|
|
@@ -42714,16 +42782,16 @@ function keepDeviceAwake(deps = {}) {
|
|
|
42714
42782
|
}
|
|
42715
42783
|
|
|
42716
42784
|
// src/agents/claude/onboarding.ts
|
|
42717
|
-
var
|
|
42718
|
-
var
|
|
42719
|
-
var
|
|
42785
|
+
var fs70 = __toESM(require("fs"));
|
|
42786
|
+
var os55 = __toESM(require("os"));
|
|
42787
|
+
var path79 = __toESM(require("path"));
|
|
42720
42788
|
var ONBOARDING_VERSION_SENTINEL = "9999.0.0";
|
|
42721
42789
|
function ensureClaudeOnboarded(cwd) {
|
|
42722
42790
|
try {
|
|
42723
|
-
const file =
|
|
42791
|
+
const file = path79.join(os55.homedir(), ".claude.json");
|
|
42724
42792
|
let config = {};
|
|
42725
42793
|
try {
|
|
42726
|
-
config = JSON.parse(
|
|
42794
|
+
config = JSON.parse(fs70.readFileSync(file, "utf8"));
|
|
42727
42795
|
} catch {
|
|
42728
42796
|
}
|
|
42729
42797
|
let changed = false;
|
|
@@ -42748,8 +42816,8 @@ function ensureClaudeOnboarded(cwd) {
|
|
|
42748
42816
|
}
|
|
42749
42817
|
}
|
|
42750
42818
|
if (!changed) return;
|
|
42751
|
-
|
|
42752
|
-
|
|
42819
|
+
fs70.mkdirSync(path79.dirname(file), { recursive: true });
|
|
42820
|
+
fs70.writeFileSync(file, JSON.stringify(config, null, 2));
|
|
42753
42821
|
log.info(
|
|
42754
42822
|
"claude",
|
|
42755
42823
|
`pre-completed Claude onboarding${cwd ? ` + trusted workspace ${cwd}` : ""}`
|
|
@@ -42838,6 +42906,12 @@ async function start(requestedAgent, presetSession) {
|
|
|
42838
42906
|
if (!isLocalSession() && session.agent === "claude") {
|
|
42839
42907
|
ensureAgentStandard();
|
|
42840
42908
|
}
|
|
42909
|
+
if (!isLocalSession()) {
|
|
42910
|
+
const cleaned = sanitizeRetiredProxyConfig();
|
|
42911
|
+
if (cleaned.changed) {
|
|
42912
|
+
log.info("claude", `removed retired Headroom config: ${cleaned.removed.join(", ")}`);
|
|
42913
|
+
}
|
|
42914
|
+
}
|
|
42841
42915
|
const beadsReady = provisionBeadsForStart({
|
|
42842
42916
|
sessionId: session.id,
|
|
42843
42917
|
pluginId,
|
|
@@ -43495,7 +43569,7 @@ var import_picocolors10 = __toESM(require("picocolors"));
|
|
|
43495
43569
|
var import_child_process30 = require("child_process");
|
|
43496
43570
|
var import_util4 = require("util");
|
|
43497
43571
|
var import_picocolors8 = __toESM(require("picocolors"));
|
|
43498
|
-
var
|
|
43572
|
+
var path80 = __toESM(require("path"));
|
|
43499
43573
|
var execFileP5 = (0, import_util4.promisify)(import_child_process30.execFile);
|
|
43500
43574
|
var MAX_BUFFER = 8 * 1024 * 1024;
|
|
43501
43575
|
function resetStdinForChild() {
|
|
@@ -43984,7 +44058,7 @@ var GitHubCodespacesProvider = class {
|
|
|
43984
44058
|
});
|
|
43985
44059
|
}
|
|
43986
44060
|
async uploadFile(workspaceId, remotePath, contents, options = {}) {
|
|
43987
|
-
const remoteDir =
|
|
44061
|
+
const remoteDir = path80.posix.dirname(remotePath);
|
|
43988
44062
|
const parts = [
|
|
43989
44063
|
`mkdir -p ${shellQuote(remoteDir)}`,
|
|
43990
44064
|
`cat > ${shellQuote(remotePath)}`
|
|
@@ -44054,7 +44128,7 @@ function shellQuote(s) {
|
|
|
44054
44128
|
// src/services/providers/gitpod.ts
|
|
44055
44129
|
var import_child_process31 = require("child_process");
|
|
44056
44130
|
var import_util5 = require("util");
|
|
44057
|
-
var
|
|
44131
|
+
var path81 = __toESM(require("path"));
|
|
44058
44132
|
var import_picocolors9 = __toESM(require("picocolors"));
|
|
44059
44133
|
var execFileP6 = (0, import_util5.promisify)(import_child_process31.execFile);
|
|
44060
44134
|
var MAX_BUFFER2 = 8 * 1024 * 1024;
|
|
@@ -44294,7 +44368,7 @@ var GitpodProvider = class {
|
|
|
44294
44368
|
});
|
|
44295
44369
|
}
|
|
44296
44370
|
async uploadFile(workspaceId, remotePath, contents, options = {}) {
|
|
44297
|
-
const remoteDir =
|
|
44371
|
+
const remoteDir = path81.posix.dirname(remotePath);
|
|
44298
44372
|
const parts = [
|
|
44299
44373
|
`mkdir -p ${shellQuote2(remoteDir)}`,
|
|
44300
44374
|
`cat > ${shellQuote2(remotePath)}`
|
|
@@ -44330,7 +44404,7 @@ function shellQuote2(s) {
|
|
|
44330
44404
|
// src/services/providers/gitlab-workspaces.ts
|
|
44331
44405
|
var import_child_process32 = require("child_process");
|
|
44332
44406
|
var import_util6 = require("util");
|
|
44333
|
-
var
|
|
44407
|
+
var path82 = __toESM(require("path"));
|
|
44334
44408
|
var execFileP7 = (0, import_util6.promisify)(import_child_process32.execFile);
|
|
44335
44409
|
var MAX_BUFFER3 = 8 * 1024 * 1024;
|
|
44336
44410
|
var GITLAB_API_BASE = process.env.CODEAM_GITLAB_API_URL ?? "https://gitlab.com/api/v4";
|
|
@@ -44590,7 +44664,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
44590
44664
|
}
|
|
44591
44665
|
async uploadFile(workspaceId, remotePath, contents, options = {}) {
|
|
44592
44666
|
const sshHost = process.env.CODEAM_GITLAB_SSH_HOST ?? "workspaces.gitlab.com";
|
|
44593
|
-
const remoteDir =
|
|
44667
|
+
const remoteDir = path82.posix.dirname(remotePath);
|
|
44594
44668
|
const parts = [`mkdir -p ${shellQuote3(remoteDir)}`, `cat > ${shellQuote3(remotePath)}`];
|
|
44595
44669
|
if (options.mode != null) {
|
|
44596
44670
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote3(remotePath)}`);
|
|
@@ -44658,7 +44732,7 @@ function shellQuote3(s) {
|
|
|
44658
44732
|
// src/services/providers/railway.ts
|
|
44659
44733
|
var import_child_process33 = require("child_process");
|
|
44660
44734
|
var import_util7 = require("util");
|
|
44661
|
-
var
|
|
44735
|
+
var path83 = __toESM(require("path"));
|
|
44662
44736
|
var execFileP8 = (0, import_util7.promisify)(import_child_process33.execFile);
|
|
44663
44737
|
var MAX_BUFFER4 = 8 * 1024 * 1024;
|
|
44664
44738
|
function resetStdinForChild4() {
|
|
@@ -44894,7 +44968,7 @@ var RailwayProvider = class {
|
|
|
44894
44968
|
if (!projectId || !serviceId) {
|
|
44895
44969
|
throw new Error("Invalid Railway workspace id (expected projectId/serviceId).");
|
|
44896
44970
|
}
|
|
44897
|
-
const remoteDir =
|
|
44971
|
+
const remoteDir = path83.posix.dirname(remotePath);
|
|
44898
44972
|
const parts = [`mkdir -p ${shellQuote4(remoteDir)}`, `cat > ${shellQuote4(remotePath)}`];
|
|
44899
44973
|
if (options.mode != null) {
|
|
44900
44974
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote4(remotePath)}`);
|
|
@@ -45434,14 +45508,14 @@ async function stopWorkspaceFromLocal(target) {
|
|
|
45434
45508
|
}
|
|
45435
45509
|
|
|
45436
45510
|
// src/commands/host/host-client.ts
|
|
45437
|
-
var
|
|
45438
|
-
var
|
|
45439
|
-
var
|
|
45511
|
+
var fs71 = __toESM(require("fs"));
|
|
45512
|
+
var os56 = __toESM(require("os"));
|
|
45513
|
+
var path84 = __toESM(require("path"));
|
|
45440
45514
|
var import_node_crypto11 = require("crypto");
|
|
45441
45515
|
function sampleCpuTimes() {
|
|
45442
45516
|
let idle = 0;
|
|
45443
45517
|
let total = 0;
|
|
45444
|
-
for (const cpu of
|
|
45518
|
+
for (const cpu of os56.cpus()) {
|
|
45445
45519
|
const t2 = cpu.times;
|
|
45446
45520
|
idle += t2.idle;
|
|
45447
45521
|
total += t2.user + t2.nice + t2.sys + t2.idle + t2.irq;
|
|
@@ -45460,8 +45534,8 @@ var MetricsCollector = class {
|
|
|
45460
45534
|
const prev = this.prevCpu;
|
|
45461
45535
|
this.prevCpu = current2;
|
|
45462
45536
|
if (!prev) {
|
|
45463
|
-
const cores =
|
|
45464
|
-
const proxy =
|
|
45537
|
+
const cores = os56.cpus().length || 1;
|
|
45538
|
+
const proxy = os56.loadavg()[0] / cores * 100;
|
|
45465
45539
|
return Math.min(100, Math.max(0, Math.round(proxy)));
|
|
45466
45540
|
}
|
|
45467
45541
|
const idleDelta = current2.idle - prev.idle;
|
|
@@ -45474,8 +45548,8 @@ var MetricsCollector = class {
|
|
|
45474
45548
|
collect() {
|
|
45475
45549
|
return {
|
|
45476
45550
|
cpuPct: this.cpuPct(),
|
|
45477
|
-
ramUsedMb: Math.round((
|
|
45478
|
-
ramTotalMb: Math.round(
|
|
45551
|
+
ramUsedMb: Math.round((os56.totalmem() - os56.freemem()) / 1048576),
|
|
45552
|
+
ramTotalMb: Math.round(os56.totalmem() / 1048576),
|
|
45479
45553
|
latencyMs: this.lastLatencyMs
|
|
45480
45554
|
};
|
|
45481
45555
|
}
|
|
@@ -45484,19 +45558,19 @@ function apiBase() {
|
|
|
45484
45558
|
return process.env.CODEAM_API_URL ?? resolveApiBaseUrl();
|
|
45485
45559
|
}
|
|
45486
45560
|
function hostIdentityPath() {
|
|
45487
|
-
return
|
|
45561
|
+
return path84.join(os56.homedir(), ".codeam", "host-agent.json");
|
|
45488
45562
|
}
|
|
45489
45563
|
function collectOsInfo() {
|
|
45490
45564
|
return {
|
|
45491
|
-
distro:
|
|
45492
|
-
arch:
|
|
45493
|
-
kernel:
|
|
45565
|
+
distro: os56.platform(),
|
|
45566
|
+
arch: os56.arch(),
|
|
45567
|
+
kernel: os56.release(),
|
|
45494
45568
|
nodeVersion: process.versions.node
|
|
45495
45569
|
};
|
|
45496
45570
|
}
|
|
45497
45571
|
function loadHostIdentity() {
|
|
45498
45572
|
try {
|
|
45499
|
-
const raw =
|
|
45573
|
+
const raw = fs71.readFileSync(hostIdentityPath(), "utf8");
|
|
45500
45574
|
const parsed = JSON.parse(raw);
|
|
45501
45575
|
if (typeof parsed === "object" && parsed !== null && typeof parsed.hostId === "string" && typeof parsed.hostToken === "string" && typeof parsed.controlPluginId === "string") {
|
|
45502
45576
|
const p2 = parsed;
|
|
@@ -45515,8 +45589,8 @@ function loadHostIdentity() {
|
|
|
45515
45589
|
}
|
|
45516
45590
|
function saveHostIdentity(identity) {
|
|
45517
45591
|
const file = hostIdentityPath();
|
|
45518
|
-
|
|
45519
|
-
|
|
45592
|
+
fs71.mkdirSync(path84.dirname(file), { recursive: true, mode: 448 });
|
|
45593
|
+
fs71.writeFileSync(file, JSON.stringify(identity, null, 2), {
|
|
45520
45594
|
encoding: "utf8",
|
|
45521
45595
|
mode: 384
|
|
45522
45596
|
});
|
|
@@ -45561,7 +45635,7 @@ function isTerminalEnrollError(err) {
|
|
|
45561
45635
|
}
|
|
45562
45636
|
function deleteHostIdentity() {
|
|
45563
45637
|
try {
|
|
45564
|
-
|
|
45638
|
+
fs71.rmSync(hostIdentityPath(), { force: true });
|
|
45565
45639
|
} catch {
|
|
45566
45640
|
}
|
|
45567
45641
|
}
|
|
@@ -45585,7 +45659,7 @@ async function postJson(pathname, body) {
|
|
|
45585
45659
|
function resolveHostLabel(label) {
|
|
45586
45660
|
const explicit = label?.trim();
|
|
45587
45661
|
const envLabel = process.env.CODEAM_HOST_LABEL?.trim();
|
|
45588
|
-
const resolved = explicit || envLabel ||
|
|
45662
|
+
const resolved = explicit || envLabel || os56.hostname();
|
|
45589
45663
|
return resolved.slice(0, 80);
|
|
45590
45664
|
}
|
|
45591
45665
|
async function redeemEnrollToken(token, label) {
|
|
@@ -45774,9 +45848,9 @@ async function host(args2) {
|
|
|
45774
45848
|
|
|
45775
45849
|
// src/commands/host-agent.ts
|
|
45776
45850
|
var import_node_child_process30 = require("child_process");
|
|
45777
|
-
var
|
|
45778
|
-
var
|
|
45779
|
-
var
|
|
45851
|
+
var os60 = __toESM(require("os"));
|
|
45852
|
+
var fs75 = __toESM(require("fs"));
|
|
45853
|
+
var path88 = __toESM(require("path"));
|
|
45780
45854
|
|
|
45781
45855
|
// src/skills/persist-from-payload.ts
|
|
45782
45856
|
function persistOrClearSkillsFromPayload(skills) {
|
|
@@ -45785,25 +45859,25 @@ function persistOrClearSkillsFromPayload(skills) {
|
|
|
45785
45859
|
}
|
|
45786
45860
|
|
|
45787
45861
|
// src/commands/host/workspace.ts
|
|
45788
|
-
var
|
|
45789
|
-
var
|
|
45790
|
-
var
|
|
45862
|
+
var fs72 = __toESM(require("fs"));
|
|
45863
|
+
var os57 = __toESM(require("os"));
|
|
45864
|
+
var path85 = __toESM(require("path"));
|
|
45791
45865
|
var import_node_child_process25 = require("child_process");
|
|
45792
45866
|
var import_node_util5 = require("util");
|
|
45793
45867
|
var execFileP9 = (0, import_node_util5.promisify)(import_node_child_process25.execFile);
|
|
45794
45868
|
function isAbsolutePathTarget(target) {
|
|
45795
|
-
return
|
|
45869
|
+
return path85.isAbsolute(target);
|
|
45796
45870
|
}
|
|
45797
45871
|
function selfHostedWorkspaceRoot() {
|
|
45798
|
-
return
|
|
45872
|
+
return path85.join(os57.homedir(), ".codeam", "self-hosted");
|
|
45799
45873
|
}
|
|
45800
45874
|
function deployIdFromWorkspace(cwd) {
|
|
45801
45875
|
if (!cwd) return null;
|
|
45802
45876
|
const root = selfHostedWorkspaceRoot();
|
|
45803
|
-
const resolved =
|
|
45804
|
-
const rel =
|
|
45805
|
-
if (!rel || rel.startsWith("..") ||
|
|
45806
|
-
const parts = rel.split(
|
|
45877
|
+
const resolved = path85.resolve(cwd);
|
|
45878
|
+
const rel = path85.relative(root, resolved);
|
|
45879
|
+
if (!rel || rel.startsWith("..") || path85.isAbsolute(rel)) return null;
|
|
45880
|
+
const parts = rel.split(path85.sep).filter(Boolean);
|
|
45807
45881
|
if (parts.length !== 1) return null;
|
|
45808
45882
|
return parts[0];
|
|
45809
45883
|
}
|
|
@@ -45875,15 +45949,15 @@ async function configureGitCredentials(dest, repoRef, cloneToken, provider = "gi
|
|
|
45875
45949
|
const isGitlab = provider === "gitlab";
|
|
45876
45950
|
if (isGitlab ? !gitlabProjectPath(repoRef.trim()) : !githubOwnerRepo(repoRef.trim())) return;
|
|
45877
45951
|
if (!cloneToken) return;
|
|
45878
|
-
const credFile =
|
|
45952
|
+
const credFile = path85.join(dest, ".git", "codeam-credentials");
|
|
45879
45953
|
const credLine = isGitlab ? `https://oauth2:${cloneToken}@gitlab.com
|
|
45880
45954
|
` : `https://x-access-token:${cloneToken}@github.com
|
|
45881
45955
|
`;
|
|
45882
|
-
|
|
45956
|
+
fs72.writeFileSync(credFile, credLine, { mode: 384 });
|
|
45883
45957
|
restrictToOwner(credFile);
|
|
45884
45958
|
const env = nonInteractiveGitEnv();
|
|
45885
45959
|
const git2 = (args2) => execFileP9("git", ["-C", dest, ...args2], { timeout: 3e4, env });
|
|
45886
|
-
const credFilePosix = credFile.split(
|
|
45960
|
+
const credFilePosix = credFile.split(path85.sep).join("/");
|
|
45887
45961
|
await git2(["config", "--local", "--replace-all", "credential.helper", ""]).catch(() => {
|
|
45888
45962
|
});
|
|
45889
45963
|
await git2([
|
|
@@ -45916,17 +45990,17 @@ function maskToken(text, cloneToken) {
|
|
|
45916
45990
|
}
|
|
45917
45991
|
async function prepareWorkspace(repoOrPath, deployId, cloneToken, provider = "github", branch) {
|
|
45918
45992
|
if (isAbsolutePathTarget(repoOrPath)) {
|
|
45919
|
-
if (!
|
|
45993
|
+
if (!fs72.existsSync(repoOrPath)) {
|
|
45920
45994
|
throw new Error(`deploy target path does not exist: ${repoOrPath}`);
|
|
45921
45995
|
}
|
|
45922
45996
|
return repoOrPath;
|
|
45923
45997
|
}
|
|
45924
|
-
const dest =
|
|
45925
|
-
if (
|
|
45998
|
+
const dest = path85.join(selfHostedWorkspaceRoot(), deployId);
|
|
45999
|
+
if (fs72.existsSync(path85.join(dest, ".git"))) {
|
|
45926
46000
|
if (cloneToken) await configureGitCredentials(dest, repoOrPath, cloneToken, provider);
|
|
45927
46001
|
return dest;
|
|
45928
46002
|
}
|
|
45929
|
-
|
|
46003
|
+
fs72.mkdirSync(selfHostedWorkspaceRoot(), { recursive: true, mode: 448 });
|
|
45930
46004
|
const cloneUrl = repoCloneUrl(repoOrPath, cloneToken, provider);
|
|
45931
46005
|
const cloneArgs = branch ? ["clone", "--depth", "1", "--branch", branch, cloneUrl, dest] : ["clone", "--depth", "1", cloneUrl, dest];
|
|
45932
46006
|
try {
|
|
@@ -45945,11 +46019,11 @@ async function prepareWorkspace(repoOrPath, deployId, cloneToken, provider = "gi
|
|
|
45945
46019
|
|
|
45946
46020
|
// src/commands/host/git-tooling.ts
|
|
45947
46021
|
var import_node_child_process26 = require("child_process");
|
|
45948
|
-
var
|
|
45949
|
-
var
|
|
45950
|
-
var
|
|
46022
|
+
var fs73 = __toESM(require("fs"));
|
|
46023
|
+
var os58 = __toESM(require("os"));
|
|
46024
|
+
var path86 = __toESM(require("path"));
|
|
45951
46025
|
function codeamBinDir() {
|
|
45952
|
-
return process.env.CODEAM_BIN_DIR ??
|
|
46026
|
+
return process.env.CODEAM_BIN_DIR ?? path86.join(os58.homedir(), ".codeam", "bin");
|
|
45953
46027
|
}
|
|
45954
46028
|
var FALLBACK_GH_VERSION = "2.62.0";
|
|
45955
46029
|
var RELEASE_API = "https://api.github.com/repos/cli/cli/releases/latest";
|
|
@@ -45981,7 +46055,7 @@ async function download(url2, dest) {
|
|
|
45981
46055
|
const res = await fetch(url2, { headers: { "User-Agent": "codeam-cli" } });
|
|
45982
46056
|
if (!res.ok || !res.body) return false;
|
|
45983
46057
|
const buf = Buffer.from(await res.arrayBuffer());
|
|
45984
|
-
|
|
46058
|
+
fs73.writeFileSync(dest, buf);
|
|
45985
46059
|
return true;
|
|
45986
46060
|
} catch {
|
|
45987
46061
|
return false;
|
|
@@ -46004,8 +46078,8 @@ async function ensureGhCli(runner, token, deps = {}) {
|
|
|
46004
46078
|
const version3 = await resolveVersionFn(token);
|
|
46005
46079
|
const asset = `gh_${version3}_${osToken}_${arch2}`;
|
|
46006
46080
|
const url2 = `https://github.com/cli/cli/releases/download/v${version3}/${asset}.${ext}`;
|
|
46007
|
-
const tmpRoot =
|
|
46008
|
-
const archive =
|
|
46081
|
+
const tmpRoot = fs73.mkdtempSync(path86.join(os58.tmpdir(), "codeam-gh-"));
|
|
46082
|
+
const archive = path86.join(tmpRoot, `${asset}.${ext}`);
|
|
46009
46083
|
if (!await downloadFn(url2, archive)) {
|
|
46010
46084
|
log.warn("host-agent", "gh download failed \u2014 skipping (git pull/push still work via the credential helper)");
|
|
46011
46085
|
return null;
|
|
@@ -46015,16 +46089,16 @@ async function ensureGhCli(runner, token, deps = {}) {
|
|
|
46015
46089
|
log.warn("host-agent", `gh archive extraction failed (code=${String(extract.code)}) \u2014 skipping`);
|
|
46016
46090
|
return null;
|
|
46017
46091
|
}
|
|
46018
|
-
const extractedBin =
|
|
46019
|
-
if (!
|
|
46092
|
+
const extractedBin = path86.join(tmpRoot, asset, "bin", binaryName);
|
|
46093
|
+
if (!fs73.existsSync(extractedBin)) {
|
|
46020
46094
|
log.warn("host-agent", "gh binary not found in the extracted archive \u2014 skipping");
|
|
46021
46095
|
return null;
|
|
46022
46096
|
}
|
|
46023
46097
|
const binDir = codeamBinDir();
|
|
46024
|
-
|
|
46025
|
-
const target =
|
|
46026
|
-
|
|
46027
|
-
|
|
46098
|
+
fs73.mkdirSync(binDir, { recursive: true });
|
|
46099
|
+
const target = path86.join(binDir, binaryName);
|
|
46100
|
+
fs73.copyFileSync(extractedBin, target);
|
|
46101
|
+
fs73.chmodSync(target, 493);
|
|
46028
46102
|
log.info("host-agent", `gh installed to ${target} (v${version3})`);
|
|
46029
46103
|
return target;
|
|
46030
46104
|
} catch (e) {
|
|
@@ -46084,8 +46158,8 @@ async function ensureGlabCli(runner, deps = {}) {
|
|
|
46084
46158
|
const version3 = await resolveLatestGlabVersion();
|
|
46085
46159
|
const asset = `glab_${version3}_${osToken}_${arch2}`;
|
|
46086
46160
|
const url2 = `https://gitlab.com/gitlab-org/cli/-/releases/v${version3}/downloads/${asset}.${ext}`;
|
|
46087
|
-
const tmpRoot =
|
|
46088
|
-
const archive =
|
|
46161
|
+
const tmpRoot = fs73.mkdtempSync(path86.join(os58.tmpdir(), "codeam-glab-"));
|
|
46162
|
+
const archive = path86.join(tmpRoot, `${asset}.${ext}`);
|
|
46089
46163
|
if (!await downloadFn(url2, archive)) {
|
|
46090
46164
|
log.warn("host-agent", "glab download failed \u2014 skipping (git push/pull still work)");
|
|
46091
46165
|
return null;
|
|
@@ -46096,20 +46170,20 @@ async function ensureGlabCli(runner, deps = {}) {
|
|
|
46096
46170
|
return null;
|
|
46097
46171
|
}
|
|
46098
46172
|
const candidates = [
|
|
46099
|
-
|
|
46100
|
-
|
|
46101
|
-
|
|
46173
|
+
path86.join(tmpRoot, "bin", binaryName),
|
|
46174
|
+
path86.join(tmpRoot, asset, "bin", binaryName),
|
|
46175
|
+
path86.join(tmpRoot, binaryName)
|
|
46102
46176
|
];
|
|
46103
|
-
const extractedBin = candidates.find((c2) =>
|
|
46177
|
+
const extractedBin = candidates.find((c2) => fs73.existsSync(c2));
|
|
46104
46178
|
if (!extractedBin) {
|
|
46105
46179
|
log.warn("host-agent", "glab binary not found in the extracted archive \u2014 skipping");
|
|
46106
46180
|
return null;
|
|
46107
46181
|
}
|
|
46108
46182
|
const binDir = codeamBinDir();
|
|
46109
|
-
|
|
46110
|
-
const target =
|
|
46111
|
-
|
|
46112
|
-
|
|
46183
|
+
fs73.mkdirSync(binDir, { recursive: true });
|
|
46184
|
+
const target = path86.join(binDir, binaryName);
|
|
46185
|
+
fs73.copyFileSync(extractedBin, target);
|
|
46186
|
+
fs73.chmodSync(target, 493);
|
|
46113
46187
|
log.info("host-agent", `glab installed to ${target} (v${version3})`);
|
|
46114
46188
|
return target;
|
|
46115
46189
|
} catch (e) {
|
|
@@ -46191,9 +46265,9 @@ var defaultGitToolingRunner = {
|
|
|
46191
46265
|
var import_node_child_process28 = require("child_process");
|
|
46192
46266
|
|
|
46193
46267
|
// src/lib/updateNotifier.ts
|
|
46194
|
-
var
|
|
46195
|
-
var
|
|
46196
|
-
var
|
|
46268
|
+
var fs74 = __toESM(require("fs"));
|
|
46269
|
+
var os59 = __toESM(require("os"));
|
|
46270
|
+
var path87 = __toESM(require("path"));
|
|
46197
46271
|
var https8 = __toESM(require("https"));
|
|
46198
46272
|
var import_node_child_process27 = require("child_process");
|
|
46199
46273
|
var import_picocolors12 = __toESM(require("picocolors"));
|
|
@@ -46202,12 +46276,12 @@ var REGISTRY_URL = `https://registry.npmjs.org/${PKG_NAME}/latest`;
|
|
|
46202
46276
|
var TTL_MS = 24 * 60 * 60 * 1e3;
|
|
46203
46277
|
var REQUEST_TIMEOUT_MS = 1500;
|
|
46204
46278
|
function cachePath() {
|
|
46205
|
-
const dir =
|
|
46206
|
-
return
|
|
46279
|
+
const dir = path87.join(os59.homedir(), ".codeam");
|
|
46280
|
+
return path87.join(dir, "update-check.json");
|
|
46207
46281
|
}
|
|
46208
46282
|
function readCache() {
|
|
46209
46283
|
try {
|
|
46210
|
-
const raw =
|
|
46284
|
+
const raw = fs74.readFileSync(cachePath(), "utf8");
|
|
46211
46285
|
const parsed = JSON.parse(raw);
|
|
46212
46286
|
if (typeof parsed.fetchedAt !== "number" || typeof parsed.latest !== "string") return null;
|
|
46213
46287
|
return parsed;
|
|
@@ -46218,10 +46292,10 @@ function readCache() {
|
|
|
46218
46292
|
function writeCache(cache) {
|
|
46219
46293
|
try {
|
|
46220
46294
|
const file = cachePath();
|
|
46221
|
-
|
|
46295
|
+
fs74.mkdirSync(path87.dirname(file), { recursive: true });
|
|
46222
46296
|
const tmp = `${file}.${process.pid}.tmp`;
|
|
46223
|
-
|
|
46224
|
-
|
|
46297
|
+
fs74.writeFileSync(tmp, JSON.stringify(cache));
|
|
46298
|
+
fs74.renameSync(tmp, file);
|
|
46225
46299
|
} catch {
|
|
46226
46300
|
}
|
|
46227
46301
|
}
|
|
@@ -46295,8 +46369,8 @@ function isLinkedInstall() {
|
|
|
46295
46369
|
timeout: 2e3
|
|
46296
46370
|
}).trim();
|
|
46297
46371
|
if (!root) return false;
|
|
46298
|
-
const pkgPath =
|
|
46299
|
-
return
|
|
46372
|
+
const pkgPath = path87.join(root, PKG_NAME);
|
|
46373
|
+
return fs74.lstatSync(pkgPath).isSymbolicLink();
|
|
46300
46374
|
} catch {
|
|
46301
46375
|
return false;
|
|
46302
46376
|
}
|
|
@@ -46332,7 +46406,7 @@ function maybeAutoUpdate(currentVersion, latest) {
|
|
|
46332
46406
|
return;
|
|
46333
46407
|
}
|
|
46334
46408
|
try {
|
|
46335
|
-
|
|
46409
|
+
fs74.unlinkSync(cachePath());
|
|
46336
46410
|
} catch {
|
|
46337
46411
|
}
|
|
46338
46412
|
process.stderr.write(` ${import_picocolors12.default.green("\u2713")} Updated. Resuming session...
|
|
@@ -46348,7 +46422,7 @@ async function autoUpgradeBeforeCriticalCommand() {
|
|
|
46348
46422
|
if (process.env.NODE_ENV === "test") return;
|
|
46349
46423
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
46350
46424
|
if (process.env.CI) return;
|
|
46351
|
-
const current2 = true ? "2.75.
|
|
46425
|
+
const current2 = true ? "2.75.7" : null;
|
|
46352
46426
|
if (!current2) return;
|
|
46353
46427
|
const cache = readCache();
|
|
46354
46428
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
|
@@ -46365,7 +46439,7 @@ function checkForUpdates() {
|
|
|
46365
46439
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
46366
46440
|
if (process.env.CI) return;
|
|
46367
46441
|
if (!process.stdout.isTTY) return;
|
|
46368
|
-
const current2 = true ? "2.75.
|
|
46442
|
+
const current2 = true ? "2.75.7" : null;
|
|
46369
46443
|
if (!current2) return;
|
|
46370
46444
|
const cache = readCache();
|
|
46371
46445
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
|
@@ -46388,7 +46462,7 @@ var SELF_UPDATE_INSTALL_TIMEOUT_MS = 18e4;
|
|
|
46388
46462
|
var SELF_UPDATE_LS_TIMEOUT_MS = 15e3;
|
|
46389
46463
|
var SUDO_PREFLIGHT_TIMEOUT_MS = 5e3;
|
|
46390
46464
|
function currentCliVersion() {
|
|
46391
|
-
return true ? "2.75.
|
|
46465
|
+
return true ? "2.75.7" : null;
|
|
46392
46466
|
}
|
|
46393
46467
|
async function installedVersion(deps) {
|
|
46394
46468
|
const ls = await deps.run(
|
|
@@ -47085,13 +47159,13 @@ var HostAgentSupervisor = class {
|
|
|
47085
47159
|
const relay = this.relay;
|
|
47086
47160
|
if (!relay) return;
|
|
47087
47161
|
const raw = cmd.payload?.path;
|
|
47088
|
-
const target = typeof raw === "string" && raw.trim() ?
|
|
47162
|
+
const target = typeof raw === "string" && raw.trim() ? path88.resolve(raw.trim()) : os60.homedir();
|
|
47089
47163
|
try {
|
|
47090
|
-
const dirents = await
|
|
47164
|
+
const dirents = await fs75.promises.readdir(target, { withFileTypes: true });
|
|
47091
47165
|
const entries = dirents.filter((d3) => !d3.name.startsWith(".")).map((d3) => ({ name: d3.name, isDir: d3.isDirectory() })).sort(
|
|
47092
47166
|
(a, b) => a.isDir === b.isDir ? a.name.localeCompare(b.name) : a.isDir ? -1 : 1
|
|
47093
47167
|
);
|
|
47094
|
-
const parent =
|
|
47168
|
+
const parent = path88.dirname(target);
|
|
47095
47169
|
await relay.sendResult(cmd.id, "completed", {
|
|
47096
47170
|
path: target,
|
|
47097
47171
|
// null at the filesystem root so the UI can hide the ".." affordance.
|
|
@@ -47438,14 +47512,14 @@ var HostAgentSupervisor = class {
|
|
|
47438
47512
|
...buildHouseProxyChildEnv({ baseUrl, token, openRouter: openRouter === true }),
|
|
47439
47513
|
CODEAM_AUTO_TOKEN: payload.autoPairToken
|
|
47440
47514
|
};
|
|
47441
|
-
const houseConfigDir =
|
|
47442
|
-
|
|
47515
|
+
const houseConfigDir = path88.join(
|
|
47516
|
+
os60.homedir(),
|
|
47443
47517
|
".codeam",
|
|
47444
47518
|
"house-claude",
|
|
47445
47519
|
payload.deployId
|
|
47446
47520
|
);
|
|
47447
47521
|
try {
|
|
47448
|
-
|
|
47522
|
+
fs75.mkdirSync(houseConfigDir, { recursive: true, mode: 448 });
|
|
47449
47523
|
} catch {
|
|
47450
47524
|
}
|
|
47451
47525
|
childEnv.CLAUDE_CONFIG_DIR = houseConfigDir;
|
|
@@ -47471,7 +47545,7 @@ var HostAgentSupervisor = class {
|
|
|
47471
47545
|
report("installing", "installing agent CLI");
|
|
47472
47546
|
await this.runAgentInstall(payload.agentInstallScript);
|
|
47473
47547
|
}
|
|
47474
|
-
const home = process.env.HOME ||
|
|
47548
|
+
const home = process.env.HOME || os60.homedir();
|
|
47475
47549
|
childEnv.PATH = `${home}/.local/bin:${process.env.PATH ?? ""}`;
|
|
47476
47550
|
if (payload.cloneToken) {
|
|
47477
47551
|
try {
|
|
@@ -47479,13 +47553,13 @@ var HostAgentSupervisor = class {
|
|
|
47479
47553
|
if ((payload.repoProvider ?? "github") === "gitlab") {
|
|
47480
47554
|
const glabCmd = await ensureGlabCli(defaultGitToolingRunner);
|
|
47481
47555
|
if (glabCmd) {
|
|
47482
|
-
childEnv.PATH = `${codeamBinDir()}${
|
|
47556
|
+
childEnv.PATH = `${codeamBinDir()}${path88.delimiter}${childEnv.PATH}`;
|
|
47483
47557
|
await ensureGlabAuth(defaultGitToolingRunner, glabCmd, payload.cloneToken);
|
|
47484
47558
|
}
|
|
47485
47559
|
} else {
|
|
47486
47560
|
const ghCmd = await ensureGhCli(defaultGitToolingRunner, payload.cloneToken);
|
|
47487
47561
|
if (ghCmd) {
|
|
47488
|
-
childEnv.PATH = `${codeamBinDir()}${
|
|
47562
|
+
childEnv.PATH = `${codeamBinDir()}${path88.delimiter}${childEnv.PATH}`;
|
|
47489
47563
|
await ensureGhAuth(defaultGitToolingRunner, ghCmd, payload.cloneToken);
|
|
47490
47564
|
}
|
|
47491
47565
|
}
|
|
@@ -47513,9 +47587,9 @@ var HostAgentSupervisor = class {
|
|
|
47513
47587
|
);
|
|
47514
47588
|
if (!payload.suppressOnboardingWelcome) {
|
|
47515
47589
|
try {
|
|
47516
|
-
const cfgDir = childEnv.CLAUDE_CONFIG_DIR ||
|
|
47517
|
-
const projectDir =
|
|
47518
|
-
const hasPriorConversation =
|
|
47590
|
+
const cfgDir = childEnv.CLAUDE_CONFIG_DIR || path88.join(os60.homedir(), ".claude");
|
|
47591
|
+
const projectDir = path88.join(cfgDir, "projects", encodeCwd(cwd));
|
|
47592
|
+
const hasPriorConversation = fs75.existsSync(projectDir) && fs75.readdirSync(projectDir).some((f) => f.endsWith(".jsonl"));
|
|
47519
47593
|
if (hasPriorConversation) {
|
|
47520
47594
|
childEnv.CODEAM_RESUME_LATEST = "1";
|
|
47521
47595
|
log.info(
|
|
@@ -47608,7 +47682,7 @@ var HostAgentSupervisor = class {
|
|
|
47608
47682
|
if (this.children.size > 0) return;
|
|
47609
47683
|
const session = getActiveSession();
|
|
47610
47684
|
if (!session || !session.pluginId || !session.pollSecret || !session.agent) return;
|
|
47611
|
-
const cwd = session.cwd &&
|
|
47685
|
+
const cwd = session.cwd && fs75.existsSync(session.cwd) ? session.cwd : process.cwd();
|
|
47612
47686
|
const proc = this.resumeSpawner(
|
|
47613
47687
|
readHouseProxyChildEnv(),
|
|
47614
47688
|
cwd
|
|
@@ -47794,12 +47868,12 @@ var HostAgentSupervisor = class {
|
|
|
47794
47868
|
this.children.delete(deployId);
|
|
47795
47869
|
}
|
|
47796
47870
|
const dirs = [
|
|
47797
|
-
|
|
47798
|
-
|
|
47871
|
+
path88.join(selfHostedWorkspaceRoot(), deployId),
|
|
47872
|
+
path88.join(os60.homedir(), ".codeam", "house-claude", deployId)
|
|
47799
47873
|
];
|
|
47800
47874
|
for (const dir of dirs) {
|
|
47801
47875
|
try {
|
|
47802
|
-
|
|
47876
|
+
fs75.rmSync(dir, { recursive: true, force: true });
|
|
47803
47877
|
} catch (err) {
|
|
47804
47878
|
log.warn(
|
|
47805
47879
|
"host-agent",
|
|
@@ -47959,8 +48033,8 @@ async function invite() {
|
|
|
47959
48033
|
var import_node_dns = require("dns");
|
|
47960
48034
|
var import_node_util6 = require("util");
|
|
47961
48035
|
var import_node_crypto12 = require("crypto");
|
|
47962
|
-
var
|
|
47963
|
-
var
|
|
48036
|
+
var fs76 = __toESM(require("fs"));
|
|
48037
|
+
var path89 = __toESM(require("path"));
|
|
47964
48038
|
var import_picocolors14 = __toESM(require("picocolors"));
|
|
47965
48039
|
var dnsResolveP = (0, import_node_util6.promisify)(import_node_dns.resolve);
|
|
47966
48040
|
async function checkDns(apiBase2) {
|
|
@@ -48016,13 +48090,13 @@ async function checkHealth(apiBase2) {
|
|
|
48016
48090
|
}
|
|
48017
48091
|
}
|
|
48018
48092
|
function checkConfigDir() {
|
|
48019
|
-
const dir =
|
|
48093
|
+
const dir = path89.join(require("os").homedir(), ".codeam");
|
|
48020
48094
|
try {
|
|
48021
|
-
|
|
48022
|
-
const probe =
|
|
48023
|
-
|
|
48024
|
-
const read =
|
|
48025
|
-
|
|
48095
|
+
fs76.mkdirSync(dir, { recursive: true, mode: 448 });
|
|
48096
|
+
const probe = path89.join(dir, ".doctor-probe");
|
|
48097
|
+
fs76.writeFileSync(probe, "ok", { mode: 384 });
|
|
48098
|
+
const read = fs76.readFileSync(probe, "utf8");
|
|
48099
|
+
fs76.unlinkSync(probe);
|
|
48026
48100
|
if (read !== "ok") throw new Error("write/read round-trip mismatch");
|
|
48027
48101
|
return {
|
|
48028
48102
|
id: "config-dir",
|
|
@@ -48062,9 +48136,9 @@ function checkSessions() {
|
|
|
48062
48136
|
}
|
|
48063
48137
|
}
|
|
48064
48138
|
function checkAgentBinaries() {
|
|
48065
|
-
const
|
|
48139
|
+
const os63 = createOsStrategy();
|
|
48066
48140
|
return getEnabledAgents().map((meta) => {
|
|
48067
|
-
const found =
|
|
48141
|
+
const found = os63.findInPath(meta.binaryName);
|
|
48068
48142
|
return {
|
|
48069
48143
|
id: `agent-${meta.id}`,
|
|
48070
48144
|
label: `Agent binary: ${meta.displayName} (${meta.binaryName})`,
|
|
@@ -48086,7 +48160,7 @@ function checkNodePty() {
|
|
|
48086
48160
|
detail: "not required on this platform"
|
|
48087
48161
|
};
|
|
48088
48162
|
}
|
|
48089
|
-
const vendoredPath =
|
|
48163
|
+
const vendoredPath = path89.join(__dirname, "vendor", "node-pty");
|
|
48090
48164
|
for (const target of [vendoredPath, "node-pty"]) {
|
|
48091
48165
|
try {
|
|
48092
48166
|
require(target);
|
|
@@ -48128,7 +48202,7 @@ function checkChokidar() {
|
|
|
48128
48202
|
}
|
|
48129
48203
|
async function doctor(args2 = []) {
|
|
48130
48204
|
const json = args2.includes("--json");
|
|
48131
|
-
const cliVersion = true ? "2.75.
|
|
48205
|
+
const cliVersion = true ? "2.75.7" : "0.0.0-dev";
|
|
48132
48206
|
const apiBase2 = resolveApiBaseUrl();
|
|
48133
48207
|
const diagnosticId = (0, import_node_crypto12.randomUUID)();
|
|
48134
48208
|
log.info("doctor", `run id=${diagnosticId} cli=${cliVersion}`);
|
|
@@ -48652,7 +48726,7 @@ async function mcpWarm(argv = [], opts = {}) {
|
|
|
48652
48726
|
// src/commands/version.ts
|
|
48653
48727
|
var import_picocolors15 = __toESM(require("picocolors"));
|
|
48654
48728
|
function version2() {
|
|
48655
|
-
const v = true ? "2.75.
|
|
48729
|
+
const v = true ? "2.75.7" : "unknown";
|
|
48656
48730
|
console.log(`${import_picocolors15.default.bold("codeam-cli")} ${import_picocolors15.default.cyan(v)}`);
|
|
48657
48731
|
}
|
|
48658
48732
|
|
|
@@ -48801,10 +48875,10 @@ var EXIT_CODE_NAMES = {
|
|
|
48801
48875
|
};
|
|
48802
48876
|
|
|
48803
48877
|
// src/index.ts
|
|
48804
|
-
var
|
|
48878
|
+
var os62 = __toESM(require("os"));
|
|
48805
48879
|
if (!process.env.HOME) {
|
|
48806
48880
|
try {
|
|
48807
|
-
const home =
|
|
48881
|
+
const home = os62.homedir();
|
|
48808
48882
|
if (home) process.env.HOME = home;
|
|
48809
48883
|
} catch {
|
|
48810
48884
|
}
|