codeam-cli 2.61.82 → 2.61.84
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 +17 -0
- package/dist/index.js +445 -373
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2624,11 +2624,11 @@ function quiet(fn) {
|
|
|
2624
2624
|
log.debug(TAG, "ignored sync error", err);
|
|
2625
2625
|
}
|
|
2626
2626
|
}
|
|
2627
|
-
function rmIfExistsQuiet(
|
|
2627
|
+
function rmIfExistsQuiet(path85) {
|
|
2628
2628
|
try {
|
|
2629
|
-
fs2.rmSync(
|
|
2629
|
+
fs2.rmSync(path85, { force: true });
|
|
2630
2630
|
} catch (err) {
|
|
2631
|
-
log.debug(TAG, `rmIfExists failed for ${
|
|
2631
|
+
log.debug(TAG, `rmIfExists failed for ${path85}`, err);
|
|
2632
2632
|
}
|
|
2633
2633
|
}
|
|
2634
2634
|
function killQuiet(target, signal = "SIGTERM") {
|
|
@@ -2774,9 +2774,9 @@ var _default = makeConfig();
|
|
|
2774
2774
|
var { getConfig, ensurePluginId, addSession, removeSession, setActiveSession, getActiveSession, getActiveSessionForAgent, setDisable1mContext, clearAll, saveCliConfig, loadCliConfig } = _default;
|
|
2775
2775
|
|
|
2776
2776
|
// src/commands/pair-auto.ts
|
|
2777
|
-
var
|
|
2778
|
-
var
|
|
2779
|
-
var
|
|
2777
|
+
var fs62 = __toESM(require("fs"));
|
|
2778
|
+
var os50 = __toESM(require("os"));
|
|
2779
|
+
var path66 = __toESM(require("path"));
|
|
2780
2780
|
var import_crypto4 = require("crypto");
|
|
2781
2781
|
|
|
2782
2782
|
// src/services/telemetry.service.ts
|
|
@@ -2812,8 +2812,8 @@ function createGetModuleFromFilename(basePath = process.argv[1] ? (0, import_pat
|
|
|
2812
2812
|
return decodedFile;
|
|
2813
2813
|
};
|
|
2814
2814
|
}
|
|
2815
|
-
function normalizeWindowsPath(
|
|
2816
|
-
return
|
|
2815
|
+
function normalizeWindowsPath(path85) {
|
|
2816
|
+
return path85.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
|
|
2817
2817
|
}
|
|
2818
2818
|
|
|
2819
2819
|
// ../../node_modules/@posthog/core/dist/featureFlagUtils.mjs
|
|
@@ -5293,9 +5293,9 @@ async function addSourceContext(frames) {
|
|
|
5293
5293
|
LRU_FILE_CONTENTS_CACHE.reduce();
|
|
5294
5294
|
return frames;
|
|
5295
5295
|
}
|
|
5296
|
-
function getContextLinesFromFile(
|
|
5296
|
+
function getContextLinesFromFile(path85, ranges, output) {
|
|
5297
5297
|
return new Promise((resolve9) => {
|
|
5298
|
-
const stream = (0, import_node_fs.createReadStream)(
|
|
5298
|
+
const stream = (0, import_node_fs.createReadStream)(path85);
|
|
5299
5299
|
const lineReaded = (0, import_node_readline.createInterface)({
|
|
5300
5300
|
input: stream
|
|
5301
5301
|
});
|
|
@@ -5310,7 +5310,7 @@ function getContextLinesFromFile(path84, ranges, output) {
|
|
|
5310
5310
|
let rangeStart = range[0];
|
|
5311
5311
|
let rangeEnd = range[1];
|
|
5312
5312
|
function onStreamError() {
|
|
5313
|
-
LRU_FILE_CONTENTS_FS_READ_FAILED.set(
|
|
5313
|
+
LRU_FILE_CONTENTS_FS_READ_FAILED.set(path85, 1);
|
|
5314
5314
|
lineReaded.close();
|
|
5315
5315
|
lineReaded.removeAllListeners();
|
|
5316
5316
|
destroyStreamAndResolve();
|
|
@@ -5371,8 +5371,8 @@ function clearLineContext(frame) {
|
|
|
5371
5371
|
delete frame.context_line;
|
|
5372
5372
|
delete frame.post_context;
|
|
5373
5373
|
}
|
|
5374
|
-
function shouldSkipContextLinesForFile(
|
|
5375
|
-
return
|
|
5374
|
+
function shouldSkipContextLinesForFile(path85) {
|
|
5375
|
+
return path85.startsWith("node:") || path85.endsWith(".min.js") || path85.endsWith(".min.cjs") || path85.endsWith(".min.mjs") || path85.startsWith("data:");
|
|
5376
5376
|
}
|
|
5377
5377
|
function shouldSkipContextLinesForFrame(frame) {
|
|
5378
5378
|
if (void 0 !== frame.lineno && frame.lineno > MAX_CONTEXTLINES_LINENO) return true;
|
|
@@ -7526,7 +7526,7 @@ function readAnonId() {
|
|
|
7526
7526
|
}
|
|
7527
7527
|
function superProperties() {
|
|
7528
7528
|
return {
|
|
7529
|
-
cliVersion: true ? "2.61.
|
|
7529
|
+
cliVersion: true ? "2.61.84" : "0.0.0-dev",
|
|
7530
7530
|
nodeVersion: process.version,
|
|
7531
7531
|
platform: process.platform,
|
|
7532
7532
|
arch: process.arch,
|
|
@@ -7707,7 +7707,7 @@ var os4 = __toESM(require("os"));
|
|
|
7707
7707
|
// package.json
|
|
7708
7708
|
var package_default = {
|
|
7709
7709
|
name: "codeam-cli",
|
|
7710
|
-
version: "2.61.
|
|
7710
|
+
version: "2.61.84",
|
|
7711
7711
|
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.",
|
|
7712
7712
|
type: "commonjs",
|
|
7713
7713
|
main: "dist/index.js",
|
|
@@ -8983,7 +8983,7 @@ var CommandRelayService = class _CommandRelayService {
|
|
|
8983
8983
|
// fresh + clear the "CLI update available" banner after a self-update
|
|
8984
8984
|
// (a codespace that reinstalls @latest reconnects via heartbeat, not
|
|
8985
8985
|
// pair/reconnect). Older backends ignore the extra field.
|
|
8986
|
-
..."2.61.
|
|
8986
|
+
..."2.61.84" ? { ideVersion: "2.61.84" } : {}
|
|
8987
8987
|
}).then(() => log.trace("relay", `heartbeat ok online=${online}`)).catch((err) => log.trace("relay", `heartbeat failed online=${online}`, err));
|
|
8988
8988
|
}
|
|
8989
8989
|
/**
|
|
@@ -9210,10 +9210,10 @@ var WINDOWS_LEGACY_JUNCTIONS = [
|
|
|
9210
9210
|
/[\\/]Start Menu([\\/]|$)/i,
|
|
9211
9211
|
/[\\/]Templates([\\/]|$)/i
|
|
9212
9212
|
];
|
|
9213
|
-
function isUnsafeWindowsWatchRoot(dir,
|
|
9213
|
+
function isUnsafeWindowsWatchRoot(dir, homedir49) {
|
|
9214
9214
|
const norm = (p2) => p2.replace(/\//g, "\\").replace(/\\+$/, "").toLowerCase();
|
|
9215
9215
|
const cwd = norm(dir);
|
|
9216
|
-
const home = norm(
|
|
9216
|
+
const home = norm(homedir49);
|
|
9217
9217
|
if (cwd === home) return true;
|
|
9218
9218
|
if (/^[a-z]:$/.test(cwd)) return true;
|
|
9219
9219
|
const sysRoots = [
|
|
@@ -10357,9 +10357,9 @@ function closeAllTerminals() {
|
|
|
10357
10357
|
}
|
|
10358
10358
|
|
|
10359
10359
|
// src/commands/start/handlers.ts
|
|
10360
|
-
var
|
|
10361
|
-
var
|
|
10362
|
-
var
|
|
10360
|
+
var fs61 = __toESM(require("fs"));
|
|
10361
|
+
var os49 = __toESM(require("os"));
|
|
10362
|
+
var path65 = __toESM(require("path"));
|
|
10363
10363
|
var import_crypto3 = require("crypto");
|
|
10364
10364
|
var import_child_process24 = require("child_process");
|
|
10365
10365
|
|
|
@@ -13839,10 +13839,10 @@ function buildForPlatform(platform3) {
|
|
|
13839
13839
|
var import_node_crypto4 = require("crypto");
|
|
13840
13840
|
|
|
13841
13841
|
// src/agents/claude/resolver.ts
|
|
13842
|
-
function buildClaudeLaunch(extraArgs = [],
|
|
13843
|
-
const found =
|
|
13842
|
+
function buildClaudeLaunch(extraArgs = [], os61 = createOsStrategy()) {
|
|
13843
|
+
const found = os61.findInPath("claude") ?? os61.findInPath("claude-code");
|
|
13844
13844
|
if (!found) return null;
|
|
13845
|
-
return
|
|
13845
|
+
return os61.buildLaunch(found, extraArgs);
|
|
13846
13846
|
}
|
|
13847
13847
|
|
|
13848
13848
|
// src/agents/claude/installer.ts
|
|
@@ -14432,8 +14432,8 @@ var ClaudeRuntimeStrategy = class {
|
|
|
14432
14432
|
meta = getAgent("claude");
|
|
14433
14433
|
mode = "interactive";
|
|
14434
14434
|
os;
|
|
14435
|
-
constructor(
|
|
14436
|
-
this.os =
|
|
14435
|
+
constructor(os61) {
|
|
14436
|
+
this.os = os61;
|
|
14437
14437
|
}
|
|
14438
14438
|
/**
|
|
14439
14439
|
* Claude Code's react-ink TUI enables bracketed-paste mode at
|
|
@@ -15213,8 +15213,8 @@ function codexCredentialLocator() {
|
|
|
15213
15213
|
function codexLoginLauncher() {
|
|
15214
15214
|
return {
|
|
15215
15215
|
async ensureInstalled() {
|
|
15216
|
-
const
|
|
15217
|
-
return
|
|
15216
|
+
const os61 = createOsStrategy();
|
|
15217
|
+
return os61.findInPath("codex") !== null;
|
|
15218
15218
|
},
|
|
15219
15219
|
launch() {
|
|
15220
15220
|
return (0, import_node_child_process4.spawn)("codex", ["login"], { stdio: "inherit" });
|
|
@@ -15237,8 +15237,8 @@ var CodexRuntimeStrategy = class {
|
|
|
15237
15237
|
meta = getAgent("codex");
|
|
15238
15238
|
mode = "interactive";
|
|
15239
15239
|
os;
|
|
15240
|
-
constructor(
|
|
15241
|
-
this.os =
|
|
15240
|
+
constructor(os61) {
|
|
15241
|
+
this.os = os61;
|
|
15242
15242
|
}
|
|
15243
15243
|
async prepareLaunch() {
|
|
15244
15244
|
let binary = this.os.findInPath("codex");
|
|
@@ -15347,12 +15347,12 @@ var CodexRuntimeStrategy = class {
|
|
|
15347
15347
|
});
|
|
15348
15348
|
}
|
|
15349
15349
|
};
|
|
15350
|
-
function resolveNpm(
|
|
15351
|
-
return
|
|
15350
|
+
function resolveNpm(os61) {
|
|
15351
|
+
return os61.id === "win32" ? "npm.cmd" : "npm";
|
|
15352
15352
|
}
|
|
15353
|
-
async function installCodexViaNpm(
|
|
15353
|
+
async function installCodexViaNpm(os61) {
|
|
15354
15354
|
return new Promise((resolve9, reject) => {
|
|
15355
|
-
const proc = (0, import_node_child_process5.spawn)(resolveNpm(
|
|
15355
|
+
const proc = (0, import_node_child_process5.spawn)(resolveNpm(os61), ["install", "-g", "@openai/codex"], {
|
|
15356
15356
|
stdio: "inherit"
|
|
15357
15357
|
});
|
|
15358
15358
|
proc.on("close", (code) => {
|
|
@@ -15369,16 +15369,16 @@ async function installCodexViaNpm(os60) {
|
|
|
15369
15369
|
});
|
|
15370
15370
|
});
|
|
15371
15371
|
}
|
|
15372
|
-
function augmentNpmGlobalBin(
|
|
15372
|
+
function augmentNpmGlobalBin(os61) {
|
|
15373
15373
|
try {
|
|
15374
|
-
const result = (0, import_node_child_process5.spawnSync)(resolveNpm(
|
|
15374
|
+
const result = (0, import_node_child_process5.spawnSync)(resolveNpm(os61), ["prefix", "-g"], {
|
|
15375
15375
|
stdio: ["ignore", "pipe", "ignore"]
|
|
15376
15376
|
});
|
|
15377
15377
|
if (result.status !== 0) return;
|
|
15378
15378
|
const prefix = result.stdout.toString().trim();
|
|
15379
15379
|
if (!prefix) return;
|
|
15380
|
-
const binDir =
|
|
15381
|
-
|
|
15380
|
+
const binDir = os61.id === "win32" ? prefix : path25.join(prefix, "bin");
|
|
15381
|
+
os61.augmentPath([binDir]);
|
|
15382
15382
|
} catch {
|
|
15383
15383
|
}
|
|
15384
15384
|
}
|
|
@@ -15462,9 +15462,9 @@ var import_node_child_process8 = require("child_process");
|
|
|
15462
15462
|
// src/agents/coderabbit/installer.ts
|
|
15463
15463
|
var import_node_child_process6 = require("child_process");
|
|
15464
15464
|
var INSTALL_URL = "https://cli.coderabbit.ai/install.sh";
|
|
15465
|
-
async function ensureCoderabbitInstalled(
|
|
15466
|
-
if (
|
|
15467
|
-
if (
|
|
15465
|
+
async function ensureCoderabbitInstalled(os61) {
|
|
15466
|
+
if (os61.findInPath("coderabbit")) return true;
|
|
15467
|
+
if (os61.id === "win32") {
|
|
15468
15468
|
console.error(
|
|
15469
15469
|
"\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"
|
|
15470
15470
|
);
|
|
@@ -15497,8 +15497,8 @@ async function ensureCoderabbitInstalled(os60) {
|
|
|
15497
15497
|
proc.on("error", () => finish(false));
|
|
15498
15498
|
});
|
|
15499
15499
|
if (!ok) return false;
|
|
15500
|
-
|
|
15501
|
-
return
|
|
15500
|
+
os61.augmentPath([`${os61.homeDir()}/.local/bin`, "/opt/homebrew/bin"]);
|
|
15501
|
+
return os61.findInPath("coderabbit") !== null;
|
|
15502
15502
|
}
|
|
15503
15503
|
|
|
15504
15504
|
// src/agents/coderabbit/link.ts
|
|
@@ -15533,10 +15533,10 @@ function coderabbitCredentialLocator() {
|
|
|
15533
15533
|
validate: validateNonEmptyCredential
|
|
15534
15534
|
};
|
|
15535
15535
|
}
|
|
15536
|
-
function coderabbitLoginLauncher(
|
|
15536
|
+
function coderabbitLoginLauncher(os61) {
|
|
15537
15537
|
return {
|
|
15538
15538
|
async ensureInstalled() {
|
|
15539
|
-
return ensureCoderabbitInstalled(
|
|
15539
|
+
return ensureCoderabbitInstalled(os61);
|
|
15540
15540
|
},
|
|
15541
15541
|
launch() {
|
|
15542
15542
|
return (0, import_node_child_process7.spawn)("coderabbit", ["auth", "login"], { stdio: "inherit" });
|
|
@@ -15592,8 +15592,8 @@ function pickLine(obj) {
|
|
|
15592
15592
|
function toHunk(raw, groupSeverity) {
|
|
15593
15593
|
if (!raw || typeof raw !== "object") return null;
|
|
15594
15594
|
const o = raw;
|
|
15595
|
-
const
|
|
15596
|
-
if (!
|
|
15595
|
+
const path85 = asString(pick(o, ["file_path", "filePath", "file", "path", "filename", "fileName"])) ?? asString(pick(o, ["location"])?.path);
|
|
15596
|
+
if (!path85) return null;
|
|
15597
15597
|
const message = asString(
|
|
15598
15598
|
pick(o, [
|
|
15599
15599
|
"comment",
|
|
@@ -15610,7 +15610,7 @@ function toHunk(raw, groupSeverity) {
|
|
|
15610
15610
|
const severity = normSeverity(pick(o, ["severity", "level", "priority", "impact"])) ?? normSeverity(groupSeverity);
|
|
15611
15611
|
const locObj = pick(o, ["location"]) ?? o;
|
|
15612
15612
|
return {
|
|
15613
|
-
path:
|
|
15613
|
+
path: path85.trim(),
|
|
15614
15614
|
line: pickLine(o) ?? pickLine(locObj),
|
|
15615
15615
|
severity,
|
|
15616
15616
|
message: (title && message ? `${title}: ${message}` : title || message).trim() || "(no message)"
|
|
@@ -15693,10 +15693,10 @@ function parsePlain(stdout) {
|
|
|
15693
15693
|
for (const line of stdout.split(/\r?\n/)) {
|
|
15694
15694
|
const m = line.match(HUNK_LINE_RE);
|
|
15695
15695
|
if (!m) continue;
|
|
15696
|
-
const [,
|
|
15697
|
-
if (!
|
|
15696
|
+
const [, path85, lineNo, sevToken, message] = m;
|
|
15697
|
+
if (!path85 || !lineNo || !message) continue;
|
|
15698
15698
|
hunks.push({
|
|
15699
|
-
path:
|
|
15699
|
+
path: path85.trim(),
|
|
15700
15700
|
line: Number(lineNo),
|
|
15701
15701
|
severity: sevToken ? SEVERITY_MAP[sevToken.toLowerCase()] : void 0,
|
|
15702
15702
|
message: message.trim().replace(/^[*-]\s+/, "")
|
|
@@ -15756,8 +15756,8 @@ var CoderabbitRuntimeStrategy = class {
|
|
|
15756
15756
|
meta = getAgent("coderabbit");
|
|
15757
15757
|
mode = "batch";
|
|
15758
15758
|
os;
|
|
15759
|
-
constructor(
|
|
15760
|
-
this.os =
|
|
15759
|
+
constructor(os61) {
|
|
15760
|
+
this.os = os61;
|
|
15761
15761
|
}
|
|
15762
15762
|
getDefaultArgs() {
|
|
15763
15763
|
return ["review", "--agent"];
|
|
@@ -16028,10 +16028,10 @@ function cursorCredentialLocator() {
|
|
|
16028
16028
|
validate: validateNonEmptyCredential
|
|
16029
16029
|
};
|
|
16030
16030
|
}
|
|
16031
|
-
function cursorLoginLauncher(
|
|
16031
|
+
function cursorLoginLauncher(os61) {
|
|
16032
16032
|
return {
|
|
16033
16033
|
async ensureInstalled() {
|
|
16034
|
-
if (
|
|
16034
|
+
if (os61.findInPath("cursor-agent")) return true;
|
|
16035
16035
|
console.error(
|
|
16036
16036
|
"\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"
|
|
16037
16037
|
);
|
|
@@ -16095,8 +16095,8 @@ var CursorRuntimeStrategy = class {
|
|
|
16095
16095
|
meta = getAgent("cursor");
|
|
16096
16096
|
mode = "interactive";
|
|
16097
16097
|
os;
|
|
16098
|
-
constructor(
|
|
16099
|
-
this.os =
|
|
16098
|
+
constructor(os61) {
|
|
16099
|
+
this.os = os61;
|
|
16100
16100
|
}
|
|
16101
16101
|
async prepareLaunch() {
|
|
16102
16102
|
const binary = this.os.findInPath("cursor-agent");
|
|
@@ -16312,10 +16312,10 @@ function aiderCredentialLocator() {
|
|
|
16312
16312
|
validate: validateNonEmptyCredential
|
|
16313
16313
|
};
|
|
16314
16314
|
}
|
|
16315
|
-
function aiderLoginLauncher(
|
|
16315
|
+
function aiderLoginLauncher(os61) {
|
|
16316
16316
|
return {
|
|
16317
16317
|
async ensureInstalled() {
|
|
16318
|
-
if (
|
|
16318
|
+
if (os61.findInPath("aider")) return true;
|
|
16319
16319
|
console.error(
|
|
16320
16320
|
"\n \u2717 aider binary not on PATH.\n Install Aider:\n pip install aider-chat\n then re-run `codeam link aider`.\n"
|
|
16321
16321
|
);
|
|
@@ -16325,7 +16325,7 @@ function aiderLoginLauncher(os60) {
|
|
|
16325
16325
|
console.error(
|
|
16326
16326
|
"\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"
|
|
16327
16327
|
);
|
|
16328
|
-
return (0, import_node_child_process11.spawn)(
|
|
16328
|
+
return (0, import_node_child_process11.spawn)(os61.id === "win32" ? "cmd.exe" : "sh", os61.id === "win32" ? ["/c", "exit", "0"] : ["-c", "exit 0"], {
|
|
16329
16329
|
stdio: "ignore"
|
|
16330
16330
|
});
|
|
16331
16331
|
}
|
|
@@ -16397,8 +16397,8 @@ var AiderRuntimeStrategy = class {
|
|
|
16397
16397
|
meta = getAgent("aider");
|
|
16398
16398
|
mode = "interactive";
|
|
16399
16399
|
os;
|
|
16400
|
-
constructor(
|
|
16401
|
-
this.os =
|
|
16400
|
+
constructor(os61) {
|
|
16401
|
+
this.os = os61;
|
|
16402
16402
|
}
|
|
16403
16403
|
async prepareLaunch() {
|
|
16404
16404
|
const binary = this.os.findInPath("aider");
|
|
@@ -16530,8 +16530,8 @@ function geminiCredentialLocator() {
|
|
|
16530
16530
|
function geminiLoginLauncher() {
|
|
16531
16531
|
return {
|
|
16532
16532
|
async ensureInstalled() {
|
|
16533
|
-
const
|
|
16534
|
-
return
|
|
16533
|
+
const os61 = createOsStrategy();
|
|
16534
|
+
return os61.findInPath("gemini") !== null;
|
|
16535
16535
|
},
|
|
16536
16536
|
launch() {
|
|
16537
16537
|
return (0, import_node_child_process12.spawn)("gemini", ["auth", "login"], { stdio: "inherit" });
|
|
@@ -16721,8 +16721,8 @@ var GeminiRuntimeStrategy = class {
|
|
|
16721
16721
|
meta = getAgent("gemini");
|
|
16722
16722
|
mode = "interactive";
|
|
16723
16723
|
os;
|
|
16724
|
-
constructor(
|
|
16725
|
-
this.os =
|
|
16724
|
+
constructor(os61) {
|
|
16725
|
+
this.os = os61;
|
|
16726
16726
|
}
|
|
16727
16727
|
async prepareLaunch() {
|
|
16728
16728
|
const binary = this.os.findInPath("gemini");
|
|
@@ -17013,8 +17013,8 @@ var KimiRuntimeStrategy = class {
|
|
|
17013
17013
|
meta = getAgent("kimi");
|
|
17014
17014
|
mode = "interactive";
|
|
17015
17015
|
os;
|
|
17016
|
-
constructor(
|
|
17017
|
-
this.os =
|
|
17016
|
+
constructor(os61) {
|
|
17017
|
+
this.os = os61;
|
|
17018
17018
|
}
|
|
17019
17019
|
async prepareLaunch() {
|
|
17020
17020
|
const binary = this.os.findInPath("kimi");
|
|
@@ -17156,8 +17156,8 @@ var OpencodeRuntimeStrategy = class {
|
|
|
17156
17156
|
meta = getAgent("opencode");
|
|
17157
17157
|
mode = "interactive";
|
|
17158
17158
|
os;
|
|
17159
|
-
constructor(
|
|
17160
|
-
this.os =
|
|
17159
|
+
constructor(os61) {
|
|
17160
|
+
this.os = os61;
|
|
17161
17161
|
}
|
|
17162
17162
|
async prepareLaunch() {
|
|
17163
17163
|
const binary = this.os.findInPath("opencode");
|
|
@@ -17241,20 +17241,20 @@ var OpencodeRuntimeStrategy = class {
|
|
|
17241
17241
|
|
|
17242
17242
|
// src/agents/registry.ts
|
|
17243
17243
|
var runtimeBuilders = {
|
|
17244
|
-
claude: (
|
|
17245
|
-
codex: (
|
|
17246
|
-
coderabbit: (
|
|
17247
|
-
cursor: (
|
|
17248
|
-
aider: (
|
|
17249
|
-
gemini: (
|
|
17250
|
-
kimi: (
|
|
17251
|
-
opencode: (
|
|
17244
|
+
claude: (os61) => new ClaudeRuntimeStrategy(os61),
|
|
17245
|
+
codex: (os61) => new CodexRuntimeStrategy(os61),
|
|
17246
|
+
coderabbit: (os61) => new CoderabbitRuntimeStrategy(os61),
|
|
17247
|
+
cursor: (os61) => new CursorRuntimeStrategy(os61),
|
|
17248
|
+
aider: (os61) => new AiderRuntimeStrategy(os61),
|
|
17249
|
+
gemini: (os61) => new GeminiRuntimeStrategy(os61),
|
|
17250
|
+
kimi: (os61) => new KimiRuntimeStrategy(os61),
|
|
17251
|
+
opencode: (os61) => new OpencodeRuntimeStrategy(os61)
|
|
17252
17252
|
};
|
|
17253
17253
|
var deployBuilders = {
|
|
17254
17254
|
claude: () => new ClaudeDeployStrategy(),
|
|
17255
17255
|
codex: () => new CodexDeployStrategy()
|
|
17256
17256
|
};
|
|
17257
|
-
function createAgentStrategy(agent,
|
|
17257
|
+
function createAgentStrategy(agent, os61 = createOsStrategy()) {
|
|
17258
17258
|
if (!AGENT_REGISTRY[agent]?.enabled) {
|
|
17259
17259
|
throw new Error(
|
|
17260
17260
|
`Agent "${agent}" is not supported in this codeam-cli version. Upgrade with 'npm i -g codeam-cli@latest'.`
|
|
@@ -17264,10 +17264,10 @@ function createAgentStrategy(agent, os60 = createOsStrategy()) {
|
|
|
17264
17264
|
if (!build) {
|
|
17265
17265
|
throw new Error(`No runtime strategy registered for agent "${agent}"`);
|
|
17266
17266
|
}
|
|
17267
|
-
return build(
|
|
17267
|
+
return build(os61);
|
|
17268
17268
|
}
|
|
17269
|
-
function createInteractiveAgentStrategy(agent,
|
|
17270
|
-
const s = createAgentStrategy(agent,
|
|
17269
|
+
function createInteractiveAgentStrategy(agent, os61 = createOsStrategy()) {
|
|
17270
|
+
const s = createAgentStrategy(agent, os61);
|
|
17271
17271
|
if (s.mode !== "interactive") {
|
|
17272
17272
|
throw new Error(
|
|
17273
17273
|
`Agent "${agent}" is a batch agent; use createAgentStrategy + .runOneShot for one-shot reviews.`
|
|
@@ -17964,26 +17964,26 @@ function restoreCoderabbitOauthBlob(value) {
|
|
|
17964
17964
|
(0, import_node_fs5.writeFileSync)(path37.join(dir, file), contents, { mode: 384 });
|
|
17965
17965
|
}
|
|
17966
17966
|
async function configureCoderabbit(input, deps = {}) {
|
|
17967
|
-
const
|
|
17967
|
+
const os61 = deps.os ?? createOsStrategy();
|
|
17968
17968
|
const ensureInstalled = deps.ensureInstalled ?? ensureCoderabbitInstalled;
|
|
17969
17969
|
const isLoggedIn = deps.isLoggedIn ?? defaultIsLoggedIn;
|
|
17970
17970
|
const runOAuth = deps.runOAuthLogin ?? runCoderabbitOAuthLogin;
|
|
17971
17971
|
const snapshot = deps.snapshotDir ?? (() => snapshotCredentialDir());
|
|
17972
17972
|
const capture2 = deps.captureCredential ?? ((b) => diffCapturedCredential(b));
|
|
17973
17973
|
const loginWithApiKey = deps.loginWithApiKey ?? defaultLoginWithApiKey;
|
|
17974
|
-
const home =
|
|
17975
|
-
|
|
17976
|
-
|
|
17974
|
+
const home = os61.homeDir();
|
|
17975
|
+
os61.augmentPath(
|
|
17976
|
+
os61.id === "win32" ? [
|
|
17977
17977
|
path37.join(home, ".local", "bin"),
|
|
17978
17978
|
path37.join(process.env.APPDATA ?? path37.join(home, "AppData", "Roaming"), "npm"),
|
|
17979
17979
|
path37.join(home, "scoop", "shims")
|
|
17980
17980
|
] : [path37.join(home, ".local", "bin"), "/opt/homebrew/bin", "/usr/local/bin"]
|
|
17981
17981
|
);
|
|
17982
|
-
const installed2 =
|
|
17982
|
+
const installed2 = os61.findInPath("coderabbit") !== null;
|
|
17983
17983
|
const base = () => ({
|
|
17984
17984
|
action: input.action,
|
|
17985
17985
|
supported: true,
|
|
17986
|
-
installed:
|
|
17986
|
+
installed: os61.findInPath("coderabbit") !== null,
|
|
17987
17987
|
loggedIn: false
|
|
17988
17988
|
});
|
|
17989
17989
|
if (input.action === "status") {
|
|
@@ -17997,7 +17997,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
17997
17997
|
const key = (input.apiKey ?? "").trim();
|
|
17998
17998
|
if (!key) return { ...res2, error: "No API key provided" };
|
|
17999
17999
|
if (!res2.installed) {
|
|
18000
|
-
const ok = await ensureInstalled(
|
|
18000
|
+
const ok = await ensureInstalled(os61);
|
|
18001
18001
|
res2.installed = ok;
|
|
18002
18002
|
if (!ok) return { ...res2, error: "CodeRabbit CLI could not be installed" };
|
|
18003
18003
|
}
|
|
@@ -18021,7 +18021,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
18021
18021
|
}
|
|
18022
18022
|
if (!res2.installed) {
|
|
18023
18023
|
deps.onEvent?.({ kind: "installing" });
|
|
18024
|
-
const ok = await ensureInstalled(
|
|
18024
|
+
const ok = await ensureInstalled(os61);
|
|
18025
18025
|
res2.installed = ok;
|
|
18026
18026
|
if (!ok) return { ...res2, error: "CodeRabbit CLI could not be installed" };
|
|
18027
18027
|
}
|
|
@@ -18051,7 +18051,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
18051
18051
|
const res2 = base();
|
|
18052
18052
|
if (!installed2) {
|
|
18053
18053
|
deps.onEvent?.({ kind: "installing" });
|
|
18054
|
-
const ok = await ensureInstalled(
|
|
18054
|
+
const ok = await ensureInstalled(os61);
|
|
18055
18055
|
res2.installed = ok;
|
|
18056
18056
|
if (!ok) return { ...res2, error: "CodeRabbit CLI could not be installed" };
|
|
18057
18057
|
}
|
|
@@ -18091,7 +18091,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
18091
18091
|
}
|
|
18092
18092
|
const res = base();
|
|
18093
18093
|
if (!res.installed) {
|
|
18094
|
-
const ok = await ensureInstalled(
|
|
18094
|
+
const ok = await ensureInstalled(os61);
|
|
18095
18095
|
res.installed = ok;
|
|
18096
18096
|
if (!ok) return { ...res, error: "CodeRabbit CLI is not installed" };
|
|
18097
18097
|
}
|
|
@@ -18275,9 +18275,9 @@ function defaultRunGh(args2) {
|
|
|
18275
18275
|
|
|
18276
18276
|
// src/commands/host-agent.ts
|
|
18277
18277
|
var import_node_child_process25 = require("child_process");
|
|
18278
|
-
var
|
|
18279
|
-
var
|
|
18280
|
-
var
|
|
18278
|
+
var os39 = __toESM(require("os"));
|
|
18279
|
+
var fs45 = __toESM(require("fs"));
|
|
18280
|
+
var path48 = __toESM(require("path"));
|
|
18281
18281
|
|
|
18282
18282
|
// src/integrations/manifest.ts
|
|
18283
18283
|
var import_node_fs7 = __toESM(require("fs"));
|
|
@@ -19936,13 +19936,72 @@ async function setupHeadroomForSelfHosted(agent, runner = defaultHeadroomRunner,
|
|
|
19936
19936
|
return true;
|
|
19937
19937
|
}
|
|
19938
19938
|
|
|
19939
|
+
// src/commands/host/house-proxy-config.ts
|
|
19940
|
+
var fs42 = __toESM(require("fs"));
|
|
19941
|
+
var os37 = __toESM(require("os"));
|
|
19942
|
+
var path46 = __toESM(require("path"));
|
|
19943
|
+
function houseProxyConfigPath() {
|
|
19944
|
+
return path46.join(os37.homedir(), ".codeam", "house-proxy.json");
|
|
19945
|
+
}
|
|
19946
|
+
function persistHouseProxyConfig(config) {
|
|
19947
|
+
try {
|
|
19948
|
+
const file = houseProxyConfigPath();
|
|
19949
|
+
fs42.mkdirSync(path46.dirname(file), { recursive: true, mode: 448 });
|
|
19950
|
+
const tmp = `${file}.tmp-${process.pid}`;
|
|
19951
|
+
fs42.writeFileSync(tmp, JSON.stringify(config, null, 2), { encoding: "utf8", mode: 384 });
|
|
19952
|
+
fs42.renameSync(tmp, file);
|
|
19953
|
+
restrictToOwner(file);
|
|
19954
|
+
} catch (err) {
|
|
19955
|
+
log.warn(
|
|
19956
|
+
"host-agent",
|
|
19957
|
+
`failed to persist house-proxy config (best-effort): ${err instanceof Error ? err.message : String(err)}`
|
|
19958
|
+
);
|
|
19959
|
+
}
|
|
19960
|
+
}
|
|
19961
|
+
function clearHouseProxyConfig() {
|
|
19962
|
+
try {
|
|
19963
|
+
fs42.rmSync(houseProxyConfigPath(), { force: true });
|
|
19964
|
+
} catch {
|
|
19965
|
+
}
|
|
19966
|
+
}
|
|
19967
|
+
function readHouseProxyChildEnv() {
|
|
19968
|
+
try {
|
|
19969
|
+
const raw = fs42.readFileSync(houseProxyConfigPath(), "utf8");
|
|
19970
|
+
const parsed = JSON.parse(raw);
|
|
19971
|
+
if (typeof parsed !== "object" || parsed === null) return {};
|
|
19972
|
+
const o = parsed;
|
|
19973
|
+
if (typeof o.baseUrl !== "string" || !o.baseUrl) return {};
|
|
19974
|
+
if (typeof o.token !== "string" || !o.token) return {};
|
|
19975
|
+
const env = {
|
|
19976
|
+
ANTHROPIC_BASE_URL: o.baseUrl,
|
|
19977
|
+
ANTHROPIC_AUTH_TOKEN: o.token,
|
|
19978
|
+
CLAUDE_CODE_AUTO_COMPACT_WINDOW: "512000",
|
|
19979
|
+
API_TIMEOUT_MS: "3000000"
|
|
19980
|
+
};
|
|
19981
|
+
if (o.openRouter === true) {
|
|
19982
|
+
env.ANTHROPIC_API_KEY = "";
|
|
19983
|
+
} else {
|
|
19984
|
+
env.ANTHROPIC_MODEL = "MiniMax-M3";
|
|
19985
|
+
env.ANTHROPIC_DEFAULT_SONNET_MODEL = "MiniMax-M3";
|
|
19986
|
+
env.ANTHROPIC_DEFAULT_OPUS_MODEL = "MiniMax-M3";
|
|
19987
|
+
env.ANTHROPIC_DEFAULT_HAIKU_MODEL = "MiniMax-M3";
|
|
19988
|
+
}
|
|
19989
|
+
if (typeof o.claudeConfigDir === "string" && o.claudeConfigDir) {
|
|
19990
|
+
env.CLAUDE_CONFIG_DIR = o.claudeConfigDir;
|
|
19991
|
+
}
|
|
19992
|
+
return env;
|
|
19993
|
+
} catch {
|
|
19994
|
+
return {};
|
|
19995
|
+
}
|
|
19996
|
+
}
|
|
19997
|
+
|
|
19939
19998
|
// src/commands/host/self-update.ts
|
|
19940
19999
|
var import_node_child_process23 = require("child_process");
|
|
19941
20000
|
|
|
19942
20001
|
// src/lib/updateNotifier.ts
|
|
19943
|
-
var
|
|
19944
|
-
var
|
|
19945
|
-
var
|
|
20002
|
+
var fs43 = __toESM(require("fs"));
|
|
20003
|
+
var os38 = __toESM(require("os"));
|
|
20004
|
+
var path47 = __toESM(require("path"));
|
|
19946
20005
|
var https6 = __toESM(require("https"));
|
|
19947
20006
|
var import_node_child_process22 = require("child_process");
|
|
19948
20007
|
var import_picocolors3 = __toESM(require("picocolors"));
|
|
@@ -19951,12 +20010,12 @@ var REGISTRY_URL = `https://registry.npmjs.org/${PKG_NAME}/latest`;
|
|
|
19951
20010
|
var TTL_MS = 24 * 60 * 60 * 1e3;
|
|
19952
20011
|
var REQUEST_TIMEOUT_MS = 1500;
|
|
19953
20012
|
function cachePath() {
|
|
19954
|
-
const dir =
|
|
19955
|
-
return
|
|
20013
|
+
const dir = path47.join(os38.homedir(), ".codeam");
|
|
20014
|
+
return path47.join(dir, "update-check.json");
|
|
19956
20015
|
}
|
|
19957
20016
|
function readCache() {
|
|
19958
20017
|
try {
|
|
19959
|
-
const raw =
|
|
20018
|
+
const raw = fs43.readFileSync(cachePath(), "utf8");
|
|
19960
20019
|
const parsed = JSON.parse(raw);
|
|
19961
20020
|
if (typeof parsed.fetchedAt !== "number" || typeof parsed.latest !== "string") return null;
|
|
19962
20021
|
return parsed;
|
|
@@ -19967,10 +20026,10 @@ function readCache() {
|
|
|
19967
20026
|
function writeCache(cache) {
|
|
19968
20027
|
try {
|
|
19969
20028
|
const file = cachePath();
|
|
19970
|
-
|
|
20029
|
+
fs43.mkdirSync(path47.dirname(file), { recursive: true });
|
|
19971
20030
|
const tmp = `${file}.${process.pid}.tmp`;
|
|
19972
|
-
|
|
19973
|
-
|
|
20031
|
+
fs43.writeFileSync(tmp, JSON.stringify(cache));
|
|
20032
|
+
fs43.renameSync(tmp, file);
|
|
19974
20033
|
} catch {
|
|
19975
20034
|
}
|
|
19976
20035
|
}
|
|
@@ -20044,8 +20103,8 @@ function isLinkedInstall() {
|
|
|
20044
20103
|
timeout: 2e3
|
|
20045
20104
|
}).trim();
|
|
20046
20105
|
if (!root) return false;
|
|
20047
|
-
const pkgPath =
|
|
20048
|
-
return
|
|
20106
|
+
const pkgPath = path47.join(root, PKG_NAME);
|
|
20107
|
+
return fs43.lstatSync(pkgPath).isSymbolicLink();
|
|
20049
20108
|
} catch {
|
|
20050
20109
|
return false;
|
|
20051
20110
|
}
|
|
@@ -20081,7 +20140,7 @@ function maybeAutoUpdate(currentVersion, latest) {
|
|
|
20081
20140
|
return;
|
|
20082
20141
|
}
|
|
20083
20142
|
try {
|
|
20084
|
-
|
|
20143
|
+
fs43.unlinkSync(cachePath());
|
|
20085
20144
|
} catch {
|
|
20086
20145
|
}
|
|
20087
20146
|
process.stderr.write(` ${import_picocolors3.default.green("\u2713")} Updated. Resuming session...
|
|
@@ -20097,7 +20156,7 @@ async function autoUpgradeBeforeCriticalCommand() {
|
|
|
20097
20156
|
if (process.env.NODE_ENV === "test") return;
|
|
20098
20157
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
20099
20158
|
if (process.env.CI) return;
|
|
20100
|
-
const current = true ? "2.61.
|
|
20159
|
+
const current = true ? "2.61.84" : null;
|
|
20101
20160
|
if (!current) return;
|
|
20102
20161
|
const cache = readCache();
|
|
20103
20162
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
|
@@ -20114,7 +20173,7 @@ function checkForUpdates() {
|
|
|
20114
20173
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
20115
20174
|
if (process.env.CI) return;
|
|
20116
20175
|
if (!process.stdout.isTTY) return;
|
|
20117
|
-
const current = true ? "2.61.
|
|
20176
|
+
const current = true ? "2.61.84" : null;
|
|
20118
20177
|
if (!current) return;
|
|
20119
20178
|
const cache = readCache();
|
|
20120
20179
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
|
@@ -20134,7 +20193,7 @@ var SELF_UPDATE_INTERVAL_MS = 60 * 60 * 1e3;
|
|
|
20134
20193
|
var SELF_UPDATE_VIEW_TIMEOUT_MS = 3e4;
|
|
20135
20194
|
var SELF_UPDATE_INSTALL_TIMEOUT_MS = 18e4;
|
|
20136
20195
|
function currentCliVersion() {
|
|
20137
|
-
return true ? "2.61.
|
|
20196
|
+
return true ? "2.61.84" : null;
|
|
20138
20197
|
}
|
|
20139
20198
|
function runCmd(cmd, args2, timeoutMs) {
|
|
20140
20199
|
return new Promise((resolve9) => {
|
|
@@ -20201,7 +20260,7 @@ async function runSelfUpdate() {
|
|
|
20201
20260
|
|
|
20202
20261
|
// src/commands/host/teardown.ts
|
|
20203
20262
|
var import_node_child_process24 = require("child_process");
|
|
20204
|
-
var
|
|
20263
|
+
var fs44 = __toESM(require("fs"));
|
|
20205
20264
|
var defaultDisableService = () => {
|
|
20206
20265
|
try {
|
|
20207
20266
|
(0, import_node_child_process24.execFileSync)("systemctl", ["disable", "--now", "codeam-host-agent"], { stdio: "ignore" });
|
|
@@ -20210,7 +20269,7 @@ var defaultDisableService = () => {
|
|
|
20210
20269
|
};
|
|
20211
20270
|
var defaultTeardownHeadroom = () => {
|
|
20212
20271
|
try {
|
|
20213
|
-
const kind = JSON.parse(
|
|
20272
|
+
const kind = JSON.parse(fs44.readFileSync(headroomConfigPath(), "utf8")).agent;
|
|
20214
20273
|
if (kind) {
|
|
20215
20274
|
(0, import_node_child_process24.execFileSync)("headroom", ["unwrap", kind], { stdio: "ignore", timeout: 15e3 });
|
|
20216
20275
|
}
|
|
@@ -20278,8 +20337,8 @@ function maybeResumeLocalHeadroomReporter(ctx) {
|
|
|
20278
20337
|
if (process.env["HEADROOM_ENABLED"] === "1") return null;
|
|
20279
20338
|
try {
|
|
20280
20339
|
const file = headroomConfigPath();
|
|
20281
|
-
if (!
|
|
20282
|
-
const cfg = JSON.parse(
|
|
20340
|
+
if (!fs45.existsSync(file)) return null;
|
|
20341
|
+
const cfg = JSON.parse(fs45.readFileSync(file, "utf8"));
|
|
20283
20342
|
if (!cfg?.enabled) return null;
|
|
20284
20343
|
const agent = cfg.agent ?? "claude";
|
|
20285
20344
|
const ingestUrl = `${resolveApiBaseUrl()}/api/sessions/${ctx.sessionId}/headroom-savings`;
|
|
@@ -20864,13 +20923,13 @@ var HostAgentSupervisor = class {
|
|
|
20864
20923
|
const relay = this.relay;
|
|
20865
20924
|
if (!relay) return;
|
|
20866
20925
|
const raw = cmd.payload?.path;
|
|
20867
|
-
const target = typeof raw === "string" && raw.trim() ?
|
|
20926
|
+
const target = typeof raw === "string" && raw.trim() ? path48.resolve(raw.trim()) : os39.homedir();
|
|
20868
20927
|
try {
|
|
20869
|
-
const dirents = await
|
|
20928
|
+
const dirents = await fs45.promises.readdir(target, { withFileTypes: true });
|
|
20870
20929
|
const entries = dirents.filter((d3) => !d3.name.startsWith(".")).map((d3) => ({ name: d3.name, isDir: d3.isDirectory() })).sort(
|
|
20871
20930
|
(a, b) => a.isDir === b.isDir ? a.name.localeCompare(b.name) : a.isDir ? -1 : 1
|
|
20872
20931
|
);
|
|
20873
|
-
const parent =
|
|
20932
|
+
const parent = path48.dirname(target);
|
|
20874
20933
|
await relay.sendResult(cmd.id, "completed", {
|
|
20875
20934
|
path: target,
|
|
20876
20935
|
// null at the filesystem root so the UI can hide the ".." affordance.
|
|
@@ -21100,18 +21159,24 @@ var HostAgentSupervisor = class {
|
|
|
21100
21159
|
API_TIMEOUT_MS: "3000000",
|
|
21101
21160
|
CODEAM_AUTO_TOKEN: payload.autoPairToken
|
|
21102
21161
|
};
|
|
21103
|
-
const houseConfigDir =
|
|
21104
|
-
|
|
21162
|
+
const houseConfigDir = path48.join(
|
|
21163
|
+
os39.homedir(),
|
|
21105
21164
|
".codeam",
|
|
21106
21165
|
"house-claude",
|
|
21107
21166
|
payload.deployId
|
|
21108
21167
|
);
|
|
21109
21168
|
try {
|
|
21110
|
-
|
|
21169
|
+
fs45.mkdirSync(houseConfigDir, { recursive: true, mode: 448 });
|
|
21111
21170
|
} catch {
|
|
21112
21171
|
}
|
|
21113
21172
|
childEnv.CLAUDE_CONFIG_DIR = houseConfigDir;
|
|
21114
21173
|
extraArgs = [`--agent=${agentKind || "claude"}`];
|
|
21174
|
+
persistHouseProxyConfig({
|
|
21175
|
+
baseUrl,
|
|
21176
|
+
token,
|
|
21177
|
+
openRouter: !!openRouter,
|
|
21178
|
+
claudeConfigDir: houseConfigDir
|
|
21179
|
+
});
|
|
21115
21180
|
} else {
|
|
21116
21181
|
const auth = await this.resolveAgentAuth(this.identity, payload.sealedAgentAuth);
|
|
21117
21182
|
const credEnv = provisionAgentCredentials(payload.agentId, auth, void 0);
|
|
@@ -21119,6 +21184,7 @@ var HostAgentSupervisor = class {
|
|
|
21119
21184
|
...credEnv,
|
|
21120
21185
|
CODEAM_AUTO_TOKEN: payload.autoPairToken
|
|
21121
21186
|
};
|
|
21187
|
+
clearHouseProxyConfig();
|
|
21122
21188
|
}
|
|
21123
21189
|
childEnv = { ...childEnv, CODEAM_AUTO_APPROVE: "1" };
|
|
21124
21190
|
childEnv = { ...childEnv, CODEAM_HOST_AGENT_CHILD: "1" };
|
|
@@ -21126,7 +21192,7 @@ var HostAgentSupervisor = class {
|
|
|
21126
21192
|
report("installing", "installing agent CLI");
|
|
21127
21193
|
await this.runAgentInstall(payload.agentInstallScript);
|
|
21128
21194
|
}
|
|
21129
|
-
const home = process.env.HOME ||
|
|
21195
|
+
const home = process.env.HOME || os39.homedir();
|
|
21130
21196
|
childEnv.PATH = `${home}/.local/bin:${process.env.PATH ?? ""}`;
|
|
21131
21197
|
if (payload.cloneToken) {
|
|
21132
21198
|
try {
|
|
@@ -21134,13 +21200,13 @@ var HostAgentSupervisor = class {
|
|
|
21134
21200
|
if ((payload.repoProvider ?? "github") === "gitlab") {
|
|
21135
21201
|
const glabCmd = await ensureGlabCli(defaultGitToolingRunner);
|
|
21136
21202
|
if (glabCmd) {
|
|
21137
|
-
childEnv.PATH = `${codeamBinDir()}${
|
|
21203
|
+
childEnv.PATH = `${codeamBinDir()}${path48.delimiter}${childEnv.PATH}`;
|
|
21138
21204
|
await ensureGlabAuth(defaultGitToolingRunner, glabCmd, payload.cloneToken);
|
|
21139
21205
|
}
|
|
21140
21206
|
} else {
|
|
21141
21207
|
const ghCmd = await ensureGhCli(defaultGitToolingRunner, payload.cloneToken);
|
|
21142
21208
|
if (ghCmd) {
|
|
21143
|
-
childEnv.PATH = `${codeamBinDir()}${
|
|
21209
|
+
childEnv.PATH = `${codeamBinDir()}${path48.delimiter}${childEnv.PATH}`;
|
|
21144
21210
|
await ensureGhAuth(defaultGitToolingRunner, ghCmd, payload.cloneToken);
|
|
21145
21211
|
}
|
|
21146
21212
|
}
|
|
@@ -21160,7 +21226,7 @@ var HostAgentSupervisor = class {
|
|
|
21160
21226
|
}
|
|
21161
21227
|
if (payload.headroomEnabled && payload.headroomAgent && payload.headroomSavingsIngestUrl && isHeadroomSupportedAgent(payload.headroomAgent)) {
|
|
21162
21228
|
report("headroom", "setting up Headroom proxy");
|
|
21163
|
-
const freeBytes = await this.getFreeDisk(
|
|
21229
|
+
const freeBytes = await this.getFreeDisk(os39.homedir());
|
|
21164
21230
|
const alreadyInstalled = this.isHeadroomInstalled();
|
|
21165
21231
|
if (!alreadyInstalled && freeBytes !== null && freeBytes < HEADROOM_MIN_FREE_DISK_BYTES) {
|
|
21166
21232
|
const freeGb = (freeBytes / 1e9).toFixed(1);
|
|
@@ -21305,8 +21371,11 @@ var HostAgentSupervisor = class {
|
|
|
21305
21371
|
if (this.children.size > 0) return;
|
|
21306
21372
|
const session = getActiveSession();
|
|
21307
21373
|
if (!session || !session.pluginId || !session.pollSecret || !session.agent) return;
|
|
21308
|
-
const cwd = session.cwd &&
|
|
21309
|
-
const proc = this.resumeSpawner(
|
|
21374
|
+
const cwd = session.cwd && fs45.existsSync(session.cwd) ? session.cwd : process.cwd();
|
|
21375
|
+
const proc = this.resumeSpawner(
|
|
21376
|
+
{ ...readHeadroomChildEnv(), ...readHouseProxyChildEnv() },
|
|
21377
|
+
cwd
|
|
21378
|
+
);
|
|
21310
21379
|
const child = {
|
|
21311
21380
|
deployId: session.id,
|
|
21312
21381
|
proc,
|
|
@@ -21351,7 +21420,7 @@ var HostAgentSupervisor = class {
|
|
|
21351
21420
|
*/
|
|
21352
21421
|
runAgentInstall(script) {
|
|
21353
21422
|
return new Promise((resolve9) => {
|
|
21354
|
-
const home = process.env.HOME ||
|
|
21423
|
+
const home = process.env.HOME || os39.homedir();
|
|
21355
21424
|
const child = (0, import_node_child_process25.spawn)("sh", ["-c", script], {
|
|
21356
21425
|
env: { ...process.env, HOME: home },
|
|
21357
21426
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -21439,12 +21508,12 @@ var HostAgentSupervisor = class {
|
|
|
21439
21508
|
this.children.delete(deployId);
|
|
21440
21509
|
}
|
|
21441
21510
|
const dirs = [
|
|
21442
|
-
|
|
21443
|
-
|
|
21511
|
+
path48.join(selfHostedWorkspaceRoot(), deployId),
|
|
21512
|
+
path48.join(os39.homedir(), ".codeam", "house-claude", deployId)
|
|
21444
21513
|
];
|
|
21445
21514
|
for (const dir of dirs) {
|
|
21446
21515
|
try {
|
|
21447
|
-
|
|
21516
|
+
fs45.rmSync(dir, { recursive: true, force: true });
|
|
21448
21517
|
} catch (err) {
|
|
21449
21518
|
log.warn(
|
|
21450
21519
|
"host-agent",
|
|
@@ -21581,9 +21650,9 @@ async function configureHeadroom(action, ctx, deps) {
|
|
|
21581
21650
|
}
|
|
21582
21651
|
|
|
21583
21652
|
// src/services/headroom/budget-relaunch.ts
|
|
21584
|
-
var
|
|
21585
|
-
var
|
|
21586
|
-
var
|
|
21653
|
+
var fs46 = __toESM(require("fs"));
|
|
21654
|
+
var os40 = __toESM(require("os"));
|
|
21655
|
+
var path49 = __toESM(require("path"));
|
|
21587
21656
|
var import_child_process13 = require("child_process");
|
|
21588
21657
|
function amendDeploymentManifestBudget(manifest, budget) {
|
|
21589
21658
|
const rawArgs = manifest.proxy_args ?? [];
|
|
@@ -21617,7 +21686,7 @@ function amendDeploymentManifestBudget(manifest, budget) {
|
|
|
21617
21686
|
return { ...manifest, proxy_args: newArgs, base_env: newEnv };
|
|
21618
21687
|
}
|
|
21619
21688
|
function findHeadroomDeployments(homeDir2, deps) {
|
|
21620
|
-
const deployDir =
|
|
21689
|
+
const deployDir = path49.join(homeDir2, ".headroom", "deploy");
|
|
21621
21690
|
let profiles;
|
|
21622
21691
|
try {
|
|
21623
21692
|
profiles = deps.readDir(deployDir);
|
|
@@ -21626,7 +21695,7 @@ function findHeadroomDeployments(homeDir2, deps) {
|
|
|
21626
21695
|
}
|
|
21627
21696
|
const results = [];
|
|
21628
21697
|
for (const profile of profiles) {
|
|
21629
|
-
const manifestPath =
|
|
21698
|
+
const manifestPath = path49.join(deployDir, profile, "manifest.json");
|
|
21630
21699
|
let raw;
|
|
21631
21700
|
try {
|
|
21632
21701
|
raw = deps.readJson(manifestPath);
|
|
@@ -21658,8 +21727,8 @@ async function applyBudgetToHeadroom(budget, deps) {
|
|
|
21658
21727
|
}
|
|
21659
21728
|
function writeManifestReal(manifestPath, manifest) {
|
|
21660
21729
|
const tmp = manifestPath + ".codeam.tmp";
|
|
21661
|
-
|
|
21662
|
-
|
|
21730
|
+
fs46.writeFileSync(tmp, JSON.stringify(manifest, null, 2) + "\n", { mode: 384 });
|
|
21731
|
+
fs46.renameSync(tmp, manifestPath);
|
|
21663
21732
|
}
|
|
21664
21733
|
function restartDeploymentReal(profile) {
|
|
21665
21734
|
try {
|
|
@@ -21694,11 +21763,11 @@ function spawnProxyReal2(_budget) {
|
|
|
21694
21763
|
);
|
|
21695
21764
|
}
|
|
21696
21765
|
function makeRealApplyBudgetDeps() {
|
|
21697
|
-
const homeDir2 =
|
|
21766
|
+
const homeDir2 = os40.homedir();
|
|
21698
21767
|
return {
|
|
21699
21768
|
findDeployments: () => findHeadroomDeployments(homeDir2, {
|
|
21700
|
-
readDir: (dir) =>
|
|
21701
|
-
readJson: (filePath) => JSON.parse(
|
|
21769
|
+
readDir: (dir) => fs46.readdirSync(dir),
|
|
21770
|
+
readJson: (filePath) => JSON.parse(fs46.readFileSync(filePath, "utf8"))
|
|
21702
21771
|
}),
|
|
21703
21772
|
writeManifest: writeManifestReal,
|
|
21704
21773
|
restartDeployment: restartDeploymentReal,
|
|
@@ -21708,16 +21777,16 @@ function makeRealApplyBudgetDeps() {
|
|
|
21708
21777
|
}
|
|
21709
21778
|
|
|
21710
21779
|
// src/services/preview/port-registry.ts
|
|
21711
|
-
var
|
|
21712
|
-
var
|
|
21713
|
-
var
|
|
21780
|
+
var fs47 = __toESM(require("fs"));
|
|
21781
|
+
var os41 = __toESM(require("os"));
|
|
21782
|
+
var path50 = __toESM(require("path"));
|
|
21714
21783
|
var import_child_process14 = require("child_process");
|
|
21715
21784
|
function registryPath() {
|
|
21716
|
-
return
|
|
21785
|
+
return path50.join(os41.homedir(), ".codeam", "preview-ports.json");
|
|
21717
21786
|
}
|
|
21718
21787
|
function readRegistry() {
|
|
21719
21788
|
try {
|
|
21720
|
-
const raw =
|
|
21789
|
+
const raw = fs47.readFileSync(registryPath(), "utf8");
|
|
21721
21790
|
const parsed = JSON.parse(raw);
|
|
21722
21791
|
if (parsed && typeof parsed === "object") return parsed;
|
|
21723
21792
|
} catch {
|
|
@@ -21727,10 +21796,10 @@ function readRegistry() {
|
|
|
21727
21796
|
function writeRegistry(reg) {
|
|
21728
21797
|
try {
|
|
21729
21798
|
const file = registryPath();
|
|
21730
|
-
|
|
21799
|
+
fs47.mkdirSync(path50.dirname(file), { recursive: true });
|
|
21731
21800
|
const tmp = `${file}.tmp`;
|
|
21732
|
-
|
|
21733
|
-
|
|
21801
|
+
fs47.writeFileSync(tmp, JSON.stringify(reg), "utf8");
|
|
21802
|
+
fs47.renameSync(tmp, file);
|
|
21734
21803
|
} catch (err) {
|
|
21735
21804
|
log.warn("preview", `port-registry write failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
21736
21805
|
}
|
|
@@ -21796,7 +21865,7 @@ function reclaimOwnOrphanPort(port) {
|
|
|
21796
21865
|
|
|
21797
21866
|
// src/services/preview/host-allow.ts
|
|
21798
21867
|
var import_fs = require("fs");
|
|
21799
|
-
var
|
|
21868
|
+
var path51 = __toESM(require("path"));
|
|
21800
21869
|
var NEXT_ALLOWED_ORIGINS = [
|
|
21801
21870
|
"*.trycloudflare.com",
|
|
21802
21871
|
"*.preview.codeagent-mobile.com",
|
|
@@ -21816,7 +21885,7 @@ var MARKER_DIR = ".codeam";
|
|
|
21816
21885
|
var MARKER_FILE = "preview-host-allow.json";
|
|
21817
21886
|
var ORIG_INFIX = ".codeam-orig";
|
|
21818
21887
|
function markerPath(cwd) {
|
|
21819
|
-
return
|
|
21888
|
+
return path51.join(cwd, MARKER_DIR, MARKER_FILE);
|
|
21820
21889
|
}
|
|
21821
21890
|
async function fileExists(p2) {
|
|
21822
21891
|
try {
|
|
@@ -21829,13 +21898,13 @@ async function fileExists(p2) {
|
|
|
21829
21898
|
async function findConfigFile(cwd, framework) {
|
|
21830
21899
|
const base = CONFIG_BASENAMES[framework];
|
|
21831
21900
|
for (const ext of CONFIG_EXTS) {
|
|
21832
|
-
if (await fileExists(
|
|
21901
|
+
if (await fileExists(path51.join(cwd, `${base}${ext}`))) return `${base}${ext}`;
|
|
21833
21902
|
}
|
|
21834
21903
|
return null;
|
|
21835
21904
|
}
|
|
21836
21905
|
async function dependsOn(cwd, pkgName) {
|
|
21837
21906
|
try {
|
|
21838
|
-
const raw = await import_fs.promises.readFile(
|
|
21907
|
+
const raw = await import_fs.promises.readFile(path51.join(cwd, "package.json"), "utf8");
|
|
21839
21908
|
const pkg = JSON.parse(raw);
|
|
21840
21909
|
return !!(pkg.dependencies?.[pkgName] ?? pkg.devDependencies?.[pkgName]);
|
|
21841
21910
|
} catch {
|
|
@@ -21843,11 +21912,11 @@ async function dependsOn(cwd, pkgName) {
|
|
|
21843
21912
|
}
|
|
21844
21913
|
}
|
|
21845
21914
|
async function isEsmConfig(cwd, configFile) {
|
|
21846
|
-
const ext =
|
|
21915
|
+
const ext = path51.extname(configFile);
|
|
21847
21916
|
if (ext === ".mjs" || ext === ".mts" || ext === ".ts") return true;
|
|
21848
21917
|
if (ext === ".cjs") return false;
|
|
21849
21918
|
try {
|
|
21850
|
-
const raw = await import_fs.promises.readFile(
|
|
21919
|
+
const raw = await import_fs.promises.readFile(path51.join(cwd, "package.json"), "utf8");
|
|
21851
21920
|
return JSON.parse(raw).type === "module";
|
|
21852
21921
|
} catch {
|
|
21853
21922
|
return false;
|
|
@@ -21930,7 +21999,7 @@ function shimFor(framework, origBasename, esm) {
|
|
|
21930
21999
|
return framework === "next" ? nextShim(origBasename, esm) : viteShim(origBasename, esm);
|
|
21931
22000
|
}
|
|
21932
22001
|
async function writeMarker(cwd, marker) {
|
|
21933
|
-
await import_fs.promises.mkdir(
|
|
22002
|
+
await import_fs.promises.mkdir(path51.join(cwd, MARKER_DIR), { recursive: true });
|
|
21934
22003
|
await import_fs.promises.writeFile(markerPath(cwd), JSON.stringify(marker, null, 2), "utf8");
|
|
21935
22004
|
}
|
|
21936
22005
|
async function readMarker(cwd) {
|
|
@@ -21945,9 +22014,9 @@ async function restorePreviewHostAllow(cwd) {
|
|
|
21945
22014
|
const marker = await readMarker(cwd);
|
|
21946
22015
|
if (!marker) return;
|
|
21947
22016
|
try {
|
|
21948
|
-
const configAbs =
|
|
22017
|
+
const configAbs = path51.join(cwd, marker.configFile);
|
|
21949
22018
|
if (marker.backupFile) {
|
|
21950
|
-
const backupAbs =
|
|
22019
|
+
const backupAbs = path51.join(cwd, marker.backupFile);
|
|
21951
22020
|
if (await fileExists(backupAbs)) {
|
|
21952
22021
|
await import_fs.promises.rm(configAbs, { force: true });
|
|
21953
22022
|
await import_fs.promises.rename(backupAbs, configAbs);
|
|
@@ -21980,16 +22049,16 @@ async function applyPreviewHostAllow(cwd) {
|
|
|
21980
22049
|
}
|
|
21981
22050
|
if (!framework) return;
|
|
21982
22051
|
if (existing) {
|
|
21983
|
-
const ext =
|
|
22052
|
+
const ext = path51.extname(existing);
|
|
21984
22053
|
const origBasename = `${CONFIG_BASENAMES[framework]}${ORIG_INFIX}${ext}`;
|
|
21985
22054
|
const esm = await isEsmConfig(cwd, existing);
|
|
21986
|
-
await import_fs.promises.rename(
|
|
21987
|
-
await import_fs.promises.writeFile(
|
|
22055
|
+
await import_fs.promises.rename(path51.join(cwd, existing), path51.join(cwd, origBasename));
|
|
22056
|
+
await import_fs.promises.writeFile(path51.join(cwd, existing), shimFor(framework, origBasename, esm), "utf8");
|
|
21988
22057
|
await writeMarker(cwd, { framework, configFile: existing, backupFile: origBasename });
|
|
21989
22058
|
log.info("preview", `host-allow: wrapped ${existing} (${framework}) for tunnel access`);
|
|
21990
22059
|
} else {
|
|
21991
22060
|
const configFile = `${CONFIG_BASENAMES[framework]}.mjs`;
|
|
21992
|
-
await import_fs.promises.writeFile(
|
|
22061
|
+
await import_fs.promises.writeFile(path51.join(cwd, configFile), shimFor(framework, null, true), "utf8");
|
|
21993
22062
|
await writeMarker(cwd, { framework, configFile, backupFile: null });
|
|
21994
22063
|
log.info("preview", `host-allow: created ${configFile} (${framework}) for tunnel access`);
|
|
21995
22064
|
}
|
|
@@ -22671,19 +22740,19 @@ function activePreviewSessionIds() {
|
|
|
22671
22740
|
|
|
22672
22741
|
// src/services/preview/start-orchestrator.ts
|
|
22673
22742
|
var import_child_process19 = require("child_process");
|
|
22674
|
-
var
|
|
22675
|
-
var
|
|
22743
|
+
var fs55 = __toESM(require("fs"));
|
|
22744
|
+
var path58 = __toESM(require("path"));
|
|
22676
22745
|
var import_which2 = __toESM(require("which"));
|
|
22677
22746
|
|
|
22678
22747
|
// src/services/project-env/index.ts
|
|
22679
22748
|
var import_fs5 = require("fs");
|
|
22680
|
-
var
|
|
22749
|
+
var path57 = __toESM(require("path"));
|
|
22681
22750
|
|
|
22682
22751
|
// src/beads/project-key.ts
|
|
22683
22752
|
var import_child_process18 = require("child_process");
|
|
22684
22753
|
var crypto2 = __toESM(require("crypto"));
|
|
22685
|
-
var
|
|
22686
|
-
var
|
|
22754
|
+
var fs53 = __toESM(require("fs"));
|
|
22755
|
+
var path56 = __toESM(require("path"));
|
|
22687
22756
|
function normalizeOrigin(raw) {
|
|
22688
22757
|
const trimmed = raw.trim();
|
|
22689
22758
|
if (!trimmed) return null;
|
|
@@ -22709,17 +22778,17 @@ function normalizeOrigin(raw) {
|
|
|
22709
22778
|
return `${host2}/${pathPart}`;
|
|
22710
22779
|
}
|
|
22711
22780
|
function findRepoRoot(cwd) {
|
|
22712
|
-
let dir =
|
|
22781
|
+
let dir = path56.resolve(cwd);
|
|
22713
22782
|
const seen = /* @__PURE__ */ new Set();
|
|
22714
22783
|
for (let i = 0; i < 256; i++) {
|
|
22715
22784
|
if (seen.has(dir)) return null;
|
|
22716
22785
|
seen.add(dir);
|
|
22717
22786
|
try {
|
|
22718
|
-
const stat3 =
|
|
22787
|
+
const stat3 = fs53.statSync(path56.join(dir, ".git"), { throwIfNoEntry: false });
|
|
22719
22788
|
if (stat3 && (stat3.isDirectory() || stat3.isFile())) return dir;
|
|
22720
22789
|
} catch {
|
|
22721
22790
|
}
|
|
22722
|
-
const parent =
|
|
22791
|
+
const parent = path56.dirname(dir);
|
|
22723
22792
|
if (parent === dir) return null;
|
|
22724
22793
|
dir = parent;
|
|
22725
22794
|
}
|
|
@@ -22730,7 +22799,7 @@ var _execSeam2 = {
|
|
|
22730
22799
|
const out2 = (0, import_child_process18.execFileSync)(file, args2, opts);
|
|
22731
22800
|
return typeof out2 === "string" ? out2 : out2.toString("utf8");
|
|
22732
22801
|
},
|
|
22733
|
-
realpath: (p2) =>
|
|
22802
|
+
realpath: (p2) => fs53.realpathSync(p2)
|
|
22734
22803
|
};
|
|
22735
22804
|
function readOrigin(cwd) {
|
|
22736
22805
|
try {
|
|
@@ -22759,7 +22828,7 @@ function deriveProjectIdentity(cwd = process.cwd()) {
|
|
|
22759
22828
|
} catch {
|
|
22760
22829
|
}
|
|
22761
22830
|
const hash = crypto2.createHash("sha256").update(real).digest("hex");
|
|
22762
|
-
return { projectKey: `path:${hash}`, projectLabel:
|
|
22831
|
+
return { projectKey: `path:${hash}`, projectLabel: path56.basename(real) || "project" };
|
|
22763
22832
|
}
|
|
22764
22833
|
|
|
22765
22834
|
// src/services/project-env/index.ts
|
|
@@ -22772,7 +22841,7 @@ async function readIfExists(p2) {
|
|
|
22772
22841
|
}
|
|
22773
22842
|
async function syncProjectEnvUp(cwd, ctx) {
|
|
22774
22843
|
if (!ctx.pluginAuthToken) return;
|
|
22775
|
-
const content = await readIfExists(
|
|
22844
|
+
const content = await readIfExists(path57.join(cwd, ".env"));
|
|
22776
22845
|
if (content == null) return;
|
|
22777
22846
|
try {
|
|
22778
22847
|
const { projectKey, projectLabel } = deriveProjectIdentity(cwd);
|
|
@@ -22794,7 +22863,7 @@ async function syncProjectEnvUp(cwd, ctx) {
|
|
|
22794
22863
|
}
|
|
22795
22864
|
async function restoreProjectEnvIfMissing(cwd, ctx) {
|
|
22796
22865
|
if (!ctx.pluginAuthToken) return false;
|
|
22797
|
-
const envPath =
|
|
22866
|
+
const envPath = path57.join(cwd, ".env");
|
|
22798
22867
|
if (await readIfExists(envPath) != null) return false;
|
|
22799
22868
|
try {
|
|
22800
22869
|
const { projectKey, projectLabel } = deriveProjectIdentity(cwd);
|
|
@@ -22805,7 +22874,7 @@ async function restoreProjectEnvIfMissing(cwd, ctx) {
|
|
|
22805
22874
|
projectKey
|
|
22806
22875
|
});
|
|
22807
22876
|
if (!stored) return false;
|
|
22808
|
-
const tmp =
|
|
22877
|
+
const tmp = path57.join(cwd, ".env.codeam-restore.tmp");
|
|
22809
22878
|
await import_fs5.promises.writeFile(tmp, stored.content, { encoding: "utf8", mode: 384 });
|
|
22810
22879
|
await import_fs5.promises.rename(tmp, envPath);
|
|
22811
22880
|
log.info("project-env", `restored .env (${stored.keyCount} vars) for ${projectLabel}`);
|
|
@@ -22882,8 +22951,8 @@ function normalizeDetectionForSpawn(detection, cwd) {
|
|
|
22882
22951
|
if (args2.length === 0) return detection;
|
|
22883
22952
|
const binName = args2[0];
|
|
22884
22953
|
if (binName.startsWith("-")) return detection;
|
|
22885
|
-
const binPath =
|
|
22886
|
-
if (!
|
|
22954
|
+
const binPath = path58.join(cwd, "node_modules", ".bin", binName);
|
|
22955
|
+
if (!fs55.existsSync(binPath)) return detection;
|
|
22887
22956
|
return {
|
|
22888
22957
|
...detection,
|
|
22889
22958
|
command: binPath,
|
|
@@ -23256,9 +23325,9 @@ async function establishTunnel(ctx, dev) {
|
|
|
23256
23325
|
|
|
23257
23326
|
// src/beads/bd-adapter.ts
|
|
23258
23327
|
var import_child_process20 = require("child_process");
|
|
23259
|
-
var
|
|
23260
|
-
var
|
|
23261
|
-
var
|
|
23328
|
+
var fs56 = __toESM(require("fs"));
|
|
23329
|
+
var os43 = __toESM(require("os"));
|
|
23330
|
+
var path59 = __toESM(require("path"));
|
|
23262
23331
|
var BD_PACKAGE = "@beads/bd";
|
|
23263
23332
|
function resolveBundledBdBinary() {
|
|
23264
23333
|
return _resolveSeam.resolveBundled();
|
|
@@ -23270,11 +23339,11 @@ function _defaultResolveBundled() {
|
|
|
23270
23339
|
} catch {
|
|
23271
23340
|
return null;
|
|
23272
23341
|
}
|
|
23273
|
-
const binDir =
|
|
23342
|
+
const binDir = path59.join(path59.dirname(pkgJsonPath), "bin");
|
|
23274
23343
|
const binaryName = process.platform === "win32" ? "bd.exe" : "bd";
|
|
23275
|
-
const binaryPath =
|
|
23344
|
+
const binaryPath = path59.join(binDir, binaryName);
|
|
23276
23345
|
try {
|
|
23277
|
-
|
|
23346
|
+
fs56.accessSync(binaryPath, fs56.constants.F_OK);
|
|
23278
23347
|
return binaryPath;
|
|
23279
23348
|
} catch {
|
|
23280
23349
|
return null;
|
|
@@ -23284,13 +23353,13 @@ function resolveBdOnPath() {
|
|
|
23284
23353
|
return _resolveSeam.resolveOnPath();
|
|
23285
23354
|
}
|
|
23286
23355
|
function _defaultResolveOnPath() {
|
|
23287
|
-
const dirs = (process.env.PATH ?? "").split(
|
|
23356
|
+
const dirs = (process.env.PATH ?? "").split(path59.delimiter).filter(Boolean);
|
|
23288
23357
|
const candidates = process.platform === "win32" ? ["bd.exe", "bd.cmd", "bd"] : ["bd"];
|
|
23289
23358
|
for (const dir of dirs) {
|
|
23290
23359
|
for (const candidate of candidates) {
|
|
23291
|
-
const full =
|
|
23360
|
+
const full = path59.join(dir, candidate);
|
|
23292
23361
|
try {
|
|
23293
|
-
|
|
23362
|
+
fs56.accessSync(full, fs56.constants.F_OK);
|
|
23294
23363
|
return full;
|
|
23295
23364
|
} catch {
|
|
23296
23365
|
}
|
|
@@ -23375,7 +23444,7 @@ var BdAdapter = class {
|
|
|
23375
23444
|
const env = { ...process.env };
|
|
23376
23445
|
if (!env.HOME) {
|
|
23377
23446
|
try {
|
|
23378
|
-
const home =
|
|
23447
|
+
const home = os43.homedir();
|
|
23379
23448
|
if (home) env.HOME = home;
|
|
23380
23449
|
} catch {
|
|
23381
23450
|
}
|
|
@@ -23467,9 +23536,9 @@ function coerceIssue(row, projectKey) {
|
|
|
23467
23536
|
|
|
23468
23537
|
// src/beads/provisioner.ts
|
|
23469
23538
|
var import_child_process23 = require("child_process");
|
|
23470
|
-
var
|
|
23471
|
-
var
|
|
23472
|
-
var
|
|
23539
|
+
var fs58 = __toESM(require("fs"));
|
|
23540
|
+
var os45 = __toESM(require("os"));
|
|
23541
|
+
var path61 = __toESM(require("path"));
|
|
23473
23542
|
|
|
23474
23543
|
// src/beads/install-bd.ts
|
|
23475
23544
|
var import_child_process21 = require("child_process");
|
|
@@ -23534,9 +23603,9 @@ async function installBd(platform3 = process.platform) {
|
|
|
23534
23603
|
|
|
23535
23604
|
// src/beads/install-dolt.ts
|
|
23536
23605
|
var import_child_process22 = require("child_process");
|
|
23537
|
-
var
|
|
23538
|
-
var
|
|
23539
|
-
var
|
|
23606
|
+
var fs57 = __toESM(require("fs"));
|
|
23607
|
+
var os44 = __toESM(require("os"));
|
|
23608
|
+
var path60 = __toESM(require("path"));
|
|
23540
23609
|
var DOLT_INSTALL_SH_URL = "https://github.com/dolthub/dolt/releases/latest/download/install.sh";
|
|
23541
23610
|
var DOLT_MSI_URL = "https://github.com/dolthub/dolt/releases/latest/download/dolt-windows-amd64.msi";
|
|
23542
23611
|
function resolveDoltInstallStrategy(platform3) {
|
|
@@ -23576,11 +23645,11 @@ function resolveDoltInstallStrategy(platform3) {
|
|
|
23576
23645
|
}
|
|
23577
23646
|
var DOLT_RELEASE_BASE = "https://github.com/dolthub/dolt/releases/latest/download";
|
|
23578
23647
|
function doltPlatformTuple(platform3, arch2) {
|
|
23579
|
-
const
|
|
23648
|
+
const os61 = platform3 === "win32" ? "windows" : platform3 === "darwin" ? "darwin" : "linux";
|
|
23580
23649
|
const a = arch2 === "x64" ? "amd64" : arch2 === "arm64" ? "arm64" : null;
|
|
23581
23650
|
if (!a) return null;
|
|
23582
|
-
if (
|
|
23583
|
-
return `${
|
|
23651
|
+
if (os61 === "windows" && a !== "amd64") return null;
|
|
23652
|
+
return `${os61}-${a}`;
|
|
23584
23653
|
}
|
|
23585
23654
|
function resolveDoltTarballStrategy(targetDir, platform3, arch2) {
|
|
23586
23655
|
const tuple = doltPlatformTuple(platform3, arch2);
|
|
@@ -23625,14 +23694,14 @@ async function installDoltToDir(targetDir, platform3 = process.platform, arch2 =
|
|
|
23625
23694
|
return result;
|
|
23626
23695
|
}
|
|
23627
23696
|
var _doltPathSeam = {
|
|
23628
|
-
homedir: () =>
|
|
23697
|
+
homedir: () => os44.homedir(),
|
|
23629
23698
|
getPath: () => process.env.PATH ?? "",
|
|
23630
23699
|
setPath: (p2) => {
|
|
23631
23700
|
process.env.PATH = p2;
|
|
23632
23701
|
},
|
|
23633
23702
|
exists: (p2) => {
|
|
23634
23703
|
try {
|
|
23635
|
-
|
|
23704
|
+
fs57.accessSync(p2, fs57.constants.F_OK);
|
|
23636
23705
|
return true;
|
|
23637
23706
|
} catch {
|
|
23638
23707
|
return false;
|
|
@@ -23643,7 +23712,7 @@ function doltBinaryNames(platform3) {
|
|
|
23643
23712
|
return platform3 === "win32" ? ["dolt.exe", "dolt.cmd", "dolt"] : ["dolt"];
|
|
23644
23713
|
}
|
|
23645
23714
|
function knownDoltDirs(platform3) {
|
|
23646
|
-
const P3 = platform3 === "win32" ?
|
|
23715
|
+
const P3 = platform3 === "win32" ? path60.win32 : path60.posix;
|
|
23647
23716
|
const home = _doltPathSeam.homedir();
|
|
23648
23717
|
if (platform3 === "win32") {
|
|
23649
23718
|
return [
|
|
@@ -23659,7 +23728,7 @@ function knownDoltDirs(platform3) {
|
|
|
23659
23728
|
].filter(Boolean);
|
|
23660
23729
|
}
|
|
23661
23730
|
function ensureDoltResolvable(platform3 = process.platform) {
|
|
23662
|
-
const P3 = platform3 === "win32" ?
|
|
23731
|
+
const P3 = platform3 === "win32" ? path60.win32 : path60.posix;
|
|
23663
23732
|
const delim = platform3 === "win32" ? ";" : ":";
|
|
23664
23733
|
const names = doltBinaryNames(platform3);
|
|
23665
23734
|
const pathDirs = _doltPathSeam.getPath().split(delim).filter(Boolean);
|
|
@@ -23836,17 +23905,17 @@ var _provisionSeam = {
|
|
|
23836
23905
|
};
|
|
23837
23906
|
var _linkSeam = {
|
|
23838
23907
|
platform: () => process.platform,
|
|
23839
|
-
homedir: () =>
|
|
23908
|
+
homedir: () => os45.homedir(),
|
|
23840
23909
|
isWritableDir: (dir) => {
|
|
23841
23910
|
try {
|
|
23842
|
-
|
|
23911
|
+
fs58.accessSync(dir, fs58.constants.W_OK);
|
|
23843
23912
|
return true;
|
|
23844
23913
|
} catch {
|
|
23845
23914
|
return false;
|
|
23846
23915
|
}
|
|
23847
23916
|
},
|
|
23848
23917
|
ensureDir: (dir) => {
|
|
23849
|
-
|
|
23918
|
+
fs58.mkdirSync(dir, { recursive: true });
|
|
23850
23919
|
},
|
|
23851
23920
|
/**
|
|
23852
23921
|
* A directory to symlink `bd` into so the AGENT's shell + Claude Code's
|
|
@@ -23867,9 +23936,9 @@ var _linkSeam = {
|
|
|
23867
23936
|
* which `linkBdOntoPath` creates if missing.
|
|
23868
23937
|
*/
|
|
23869
23938
|
cliBinDir: () => {
|
|
23870
|
-
const pathDirs = (process.env.PATH ?? "").split(
|
|
23939
|
+
const pathDirs = (process.env.PATH ?? "").split(path61.delimiter).filter(Boolean);
|
|
23871
23940
|
const home = _linkSeam.homedir();
|
|
23872
|
-
const localBin = home ?
|
|
23941
|
+
const localBin = home ? path61.join(home, ".local", "bin") : null;
|
|
23873
23942
|
if (localBin) {
|
|
23874
23943
|
try {
|
|
23875
23944
|
_linkSeam.ensureDir(localBin);
|
|
@@ -23879,16 +23948,16 @@ var _linkSeam = {
|
|
|
23879
23948
|
const candidates = [];
|
|
23880
23949
|
if (localBin) candidates.push(localBin);
|
|
23881
23950
|
try {
|
|
23882
|
-
candidates.push(
|
|
23951
|
+
candidates.push(path61.dirname(process.execPath));
|
|
23883
23952
|
} catch {
|
|
23884
23953
|
}
|
|
23885
23954
|
candidates.push("/usr/local/bin");
|
|
23886
23955
|
const entry = process.argv[1];
|
|
23887
23956
|
if (entry) {
|
|
23888
23957
|
try {
|
|
23889
|
-
candidates.push(
|
|
23958
|
+
candidates.push(path61.dirname(fs58.realpathSync(entry)));
|
|
23890
23959
|
} catch {
|
|
23891
|
-
candidates.push(
|
|
23960
|
+
candidates.push(path61.dirname(entry));
|
|
23892
23961
|
}
|
|
23893
23962
|
}
|
|
23894
23963
|
const onPathWritable = candidates.find(
|
|
@@ -23900,20 +23969,20 @@ var _linkSeam = {
|
|
|
23900
23969
|
/** Current symlink target at `linkPath`, or null when absent / not a link. */
|
|
23901
23970
|
readlink: (linkPath) => {
|
|
23902
23971
|
try {
|
|
23903
|
-
return
|
|
23972
|
+
return fs58.readlinkSync(linkPath);
|
|
23904
23973
|
} catch {
|
|
23905
23974
|
return null;
|
|
23906
23975
|
}
|
|
23907
23976
|
},
|
|
23908
|
-
unlink: (linkPath) =>
|
|
23909
|
-
symlink: (target, linkPath) =>
|
|
23977
|
+
unlink: (linkPath) => fs58.unlinkSync(linkPath),
|
|
23978
|
+
symlink: (target, linkPath) => fs58.symlinkSync(target, linkPath)
|
|
23910
23979
|
};
|
|
23911
23980
|
function linkBdOntoPath(binaryPath) {
|
|
23912
23981
|
if (_linkSeam.platform() === "win32") return;
|
|
23913
23982
|
const binDir = _linkSeam.cliBinDir();
|
|
23914
23983
|
if (!binDir) return;
|
|
23915
23984
|
_linkSeam.ensureDir(binDir);
|
|
23916
|
-
const linkPath =
|
|
23985
|
+
const linkPath = path61.join(binDir, "bd");
|
|
23917
23986
|
if (linkPath === binaryPath) return;
|
|
23918
23987
|
const current = _linkSeam.readlink(linkPath);
|
|
23919
23988
|
if (current === binaryPath) return;
|
|
@@ -24108,7 +24177,7 @@ function dedupeRecipes(agents) {
|
|
|
24108
24177
|
|
|
24109
24178
|
// src/beads/watcher.ts
|
|
24110
24179
|
var crypto4 = __toESM(require("crypto"));
|
|
24111
|
-
var
|
|
24180
|
+
var path62 = __toESM(require("path"));
|
|
24112
24181
|
var API_BASE6 = resolveApiBaseUrl();
|
|
24113
24182
|
var DEBOUNCE_MS2 = 400;
|
|
24114
24183
|
var ZERO_SUMMARY = {
|
|
@@ -24132,7 +24201,7 @@ var BeadsWatcher = class {
|
|
|
24132
24201
|
constructor(opts) {
|
|
24133
24202
|
this.opts = opts;
|
|
24134
24203
|
this.bd = opts.adapter ?? new BdAdapter({ cwd: opts.cwd, beadsDir: opts.beadsDir });
|
|
24135
|
-
this.feedPath = opts.feedPath ??
|
|
24204
|
+
this.feedPath = opts.feedPath ?? path62.join(opts.cwd ?? process.cwd(), ".beads", "last-touched");
|
|
24136
24205
|
this.apiBase = opts.apiBaseUrl ?? API_BASE6;
|
|
24137
24206
|
}
|
|
24138
24207
|
opts;
|
|
@@ -24631,8 +24700,8 @@ function cleanupAttachmentTempFiles() {
|
|
|
24631
24700
|
function saveFilesTemp(files) {
|
|
24632
24701
|
return files.filter(({ base64 }) => base64 && base64.length > 0).map(({ filename, base64 }) => {
|
|
24633
24702
|
const safeName = filename.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 80);
|
|
24634
|
-
const tmpPath =
|
|
24635
|
-
|
|
24703
|
+
const tmpPath = path65.join(os49.tmpdir(), `codeam-${(0, import_crypto3.randomUUID)()}-${safeName}`);
|
|
24704
|
+
fs61.writeFileSync(tmpPath, Buffer.from(base64, "base64"));
|
|
24636
24705
|
pendingAttachmentFiles.add(tmpPath);
|
|
24637
24706
|
return tmpPath;
|
|
24638
24707
|
});
|
|
@@ -24844,10 +24913,10 @@ var listFiles = async (ctx, cmd, parsed) => {
|
|
|
24844
24913
|
await ctx.relay.sendResult(cmd.id, "completed", result);
|
|
24845
24914
|
};
|
|
24846
24915
|
var envReadH = async (ctx, cmd) => {
|
|
24847
|
-
const envPath =
|
|
24916
|
+
const envPath = path65.join(process.cwd(), ".env");
|
|
24848
24917
|
await restoreProjectEnvIfMissing(process.cwd(), ctx);
|
|
24849
24918
|
try {
|
|
24850
|
-
const raw = await
|
|
24919
|
+
const raw = await fs61.promises.readFile(envPath, "utf8");
|
|
24851
24920
|
await ctx.relay.sendResult(cmd.id, "completed", {
|
|
24852
24921
|
exists: true,
|
|
24853
24922
|
vars: parseDotenv(raw)
|
|
@@ -24878,15 +24947,15 @@ var envWriteH = async (ctx, cmd, parsed) => {
|
|
|
24878
24947
|
}
|
|
24879
24948
|
seen.add(v.key);
|
|
24880
24949
|
}
|
|
24881
|
-
const envPath =
|
|
24882
|
-
const tmpPath =
|
|
24950
|
+
const envPath = path65.join(process.cwd(), ".env");
|
|
24951
|
+
const tmpPath = path65.join(process.cwd(), ".env.codeam.tmp");
|
|
24883
24952
|
try {
|
|
24884
|
-
await
|
|
24885
|
-
await
|
|
24953
|
+
await fs61.promises.writeFile(tmpPath, serializeDotenv(vars), "utf8");
|
|
24954
|
+
await fs61.promises.rename(tmpPath, envPath);
|
|
24886
24955
|
await ctx.relay.sendResult(cmd.id, "completed", { ok: true, count: vars.length });
|
|
24887
24956
|
void syncProjectEnvUp(process.cwd(), ctx);
|
|
24888
24957
|
} catch (err) {
|
|
24889
|
-
await
|
|
24958
|
+
await fs61.promises.rm(tmpPath, { force: true }).catch(() => void 0);
|
|
24890
24959
|
await ctx.relay.sendResult(cmd.id, "failed", { error: err.message });
|
|
24891
24960
|
}
|
|
24892
24961
|
};
|
|
@@ -24935,7 +25004,7 @@ var headroomConfigureH = async (ctx, cmd, parsed) => {
|
|
|
24935
25004
|
let configuredAgent = rawAgentId;
|
|
24936
25005
|
if (!configuredAgent) {
|
|
24937
25006
|
try {
|
|
24938
|
-
const raw = JSON.parse(
|
|
25007
|
+
const raw = JSON.parse(fs61.readFileSync(headroomConfigPath(), "utf8"));
|
|
24939
25008
|
configuredAgent = raw.agent ?? "";
|
|
24940
25009
|
} catch {
|
|
24941
25010
|
}
|
|
@@ -24969,7 +25038,7 @@ var headroomConfigureH = async (ctx, cmd, parsed) => {
|
|
|
24969
25038
|
persist: persistHeadroomConfig,
|
|
24970
25039
|
readEnabled: () => {
|
|
24971
25040
|
try {
|
|
24972
|
-
const raw = JSON.parse(
|
|
25041
|
+
const raw = JSON.parse(fs61.readFileSync(headroomConfigPath(), "utf8"));
|
|
24973
25042
|
return raw.enabled === true;
|
|
24974
25043
|
} catch {
|
|
24975
25044
|
return false;
|
|
@@ -25226,7 +25295,7 @@ var vcsAgentReviewH = async (ctx, cmd, parsed) => {
|
|
|
25226
25295
|
});
|
|
25227
25296
|
const token = ctx.pluginAuthToken;
|
|
25228
25297
|
void (async () => {
|
|
25229
|
-
const
|
|
25298
|
+
const os61 = createOsStrategy();
|
|
25230
25299
|
try {
|
|
25231
25300
|
const report = await reviewPullRequest(
|
|
25232
25301
|
{
|
|
@@ -25235,7 +25304,7 @@ var vcsAgentReviewH = async (ctx, cmd, parsed) => {
|
|
|
25235
25304
|
baseBranch: parsed.baseBranch
|
|
25236
25305
|
},
|
|
25237
25306
|
{
|
|
25238
|
-
runReview: (input) => new CoderabbitRuntimeStrategy(
|
|
25307
|
+
runReview: (input) => new CoderabbitRuntimeStrategy(os61).runOneShot(input),
|
|
25239
25308
|
runGh: (args2) => defaultRunGh(args2),
|
|
25240
25309
|
postReport: async (r) => {
|
|
25241
25310
|
if (!token) return;
|
|
@@ -25273,7 +25342,7 @@ var headroomBudgetH = async (ctx, cmd) => {
|
|
|
25273
25342
|
}
|
|
25274
25343
|
let headroomActive = false;
|
|
25275
25344
|
try {
|
|
25276
|
-
const raw = JSON.parse(
|
|
25345
|
+
const raw = JSON.parse(fs61.readFileSync(headroomConfigPath(), "utf8"));
|
|
25277
25346
|
headroomActive = raw.enabled === true;
|
|
25278
25347
|
} catch {
|
|
25279
25348
|
}
|
|
@@ -25283,7 +25352,7 @@ var headroomBudgetH = async (ctx, cmd) => {
|
|
|
25283
25352
|
}
|
|
25284
25353
|
let existingConfig = { enabled: true };
|
|
25285
25354
|
try {
|
|
25286
|
-
existingConfig = JSON.parse(
|
|
25355
|
+
existingConfig = JSON.parse(fs61.readFileSync(headroomConfigPath(), "utf8"));
|
|
25287
25356
|
} catch {
|
|
25288
25357
|
}
|
|
25289
25358
|
if (payload.budgetEnabled && payload.budgetUsd != null) {
|
|
@@ -25396,9 +25465,9 @@ var CLI_UPDATE_MAX_ATTEMPTS = 3;
|
|
|
25396
25465
|
function buildNpmInstallInvocation(opts) {
|
|
25397
25466
|
const entryScript = opts?.entryScript ?? process.argv[1] ?? "";
|
|
25398
25467
|
const execPath = opts?.execPath ?? process.execPath;
|
|
25399
|
-
const exists2 = opts?.existsSync ??
|
|
25468
|
+
const exists2 = opts?.existsSync ?? fs61.existsSync;
|
|
25400
25469
|
const platform3 = opts?.platform ?? process.platform;
|
|
25401
|
-
const p2 = platform3 === "win32" ?
|
|
25470
|
+
const p2 = platform3 === "win32" ? path65.win32 : path65.posix;
|
|
25402
25471
|
const normalized = entryScript.split(/[\\/]/).join("/");
|
|
25403
25472
|
const marker = "/lib/node_modules/codeam-cli/";
|
|
25404
25473
|
const markerIdx = normalized.indexOf(marker);
|
|
@@ -25420,7 +25489,7 @@ function isPermissionError(stderr) {
|
|
|
25420
25489
|
function resolveGlobalNodeModulesDir(opts) {
|
|
25421
25490
|
const entryScript = opts?.entryScript ?? process.argv[1] ?? "";
|
|
25422
25491
|
const platform3 = opts?.platform ?? process.platform;
|
|
25423
|
-
const p2 = platform3 === "win32" ?
|
|
25492
|
+
const p2 = platform3 === "win32" ? path65.win32 : path65.posix;
|
|
25424
25493
|
const marker = "/lib/node_modules/codeam-cli/";
|
|
25425
25494
|
const markerIdx = entryScript.split(/[\\/]/).join("/").indexOf(marker);
|
|
25426
25495
|
if (markerIdx <= 0) return null;
|
|
@@ -25430,9 +25499,9 @@ function resolveGlobalNodeModulesDir(opts) {
|
|
|
25430
25499
|
var STALE_STAGING_AGE_MS = CLI_UPDATE_INSTALL_TIMEOUT_MS;
|
|
25431
25500
|
function sweepStaleCliStagingDirs(nodeModulesDir, now = Date.now(), deps) {
|
|
25432
25501
|
if (!nodeModulesDir) return 0;
|
|
25433
|
-
const readdirSync12 = deps?.readdirSync ??
|
|
25434
|
-
const statSync17 = deps?.statSync ??
|
|
25435
|
-
const
|
|
25502
|
+
const readdirSync12 = deps?.readdirSync ?? fs61.readdirSync;
|
|
25503
|
+
const statSync17 = deps?.statSync ?? fs61.statSync;
|
|
25504
|
+
const rmSync9 = deps?.rmSync ?? fs61.rmSync;
|
|
25436
25505
|
let removed = 0;
|
|
25437
25506
|
let entries;
|
|
25438
25507
|
try {
|
|
@@ -25442,11 +25511,11 @@ function sweepStaleCliStagingDirs(nodeModulesDir, now = Date.now(), deps) {
|
|
|
25442
25511
|
}
|
|
25443
25512
|
for (const name of entries) {
|
|
25444
25513
|
if (!/^\.codeam-cli-/.test(name)) continue;
|
|
25445
|
-
const full =
|
|
25514
|
+
const full = path65.join(nodeModulesDir, name);
|
|
25446
25515
|
try {
|
|
25447
25516
|
const st3 = statSync17(full);
|
|
25448
25517
|
if (now - st3.mtimeMs < STALE_STAGING_AGE_MS) continue;
|
|
25449
|
-
|
|
25518
|
+
rmSync9(full, { recursive: true, force: true });
|
|
25450
25519
|
removed++;
|
|
25451
25520
|
} catch {
|
|
25452
25521
|
}
|
|
@@ -26309,11 +26378,11 @@ function resolveTokenValue(args2) {
|
|
|
26309
26378
|
}
|
|
26310
26379
|
const fileFlag = args2.find((a) => a.startsWith("--token-file="));
|
|
26311
26380
|
if (fileFlag) {
|
|
26312
|
-
const
|
|
26381
|
+
const path85 = fileFlag.slice("--token-file=".length);
|
|
26313
26382
|
try {
|
|
26314
|
-
const content =
|
|
26315
|
-
if (content.length === 0) fail(`--token-file ${
|
|
26316
|
-
rmIfExistsQuiet(
|
|
26383
|
+
const content = fs62.readFileSync(path85, "utf8").trim();
|
|
26384
|
+
if (content.length === 0) fail(`--token-file ${path85} is empty`);
|
|
26385
|
+
rmIfExistsQuiet(path85);
|
|
26317
26386
|
return content;
|
|
26318
26387
|
} catch (err) {
|
|
26319
26388
|
fail(`Could not read --token-file: ${err.message}`);
|
|
@@ -26342,7 +26411,7 @@ async function claimOnce(token, pluginId, pluginSecretHash) {
|
|
|
26342
26411
|
pluginId,
|
|
26343
26412
|
ideName: "codeam-cli (codespace)",
|
|
26344
26413
|
ideVersion: process.env.npm_package_version ?? "unknown",
|
|
26345
|
-
hostname:
|
|
26414
|
+
hostname: os50.hostname(),
|
|
26346
26415
|
codespaceName: process.env.CODESPACE_NAME ?? "",
|
|
26347
26416
|
// Current git branch of the codespace's working directory, so the
|
|
26348
26417
|
// backend can populate `PairedSession.branch` for the codespace pair.
|
|
@@ -26403,7 +26472,7 @@ async function claim(token, pluginId, pluginSecretHash) {
|
|
|
26403
26472
|
}
|
|
26404
26473
|
}
|
|
26405
26474
|
function pairAutoLockPath() {
|
|
26406
|
-
return
|
|
26475
|
+
return path66.join(os50.homedir(), ".codeam", "pair-auto.lock");
|
|
26407
26476
|
}
|
|
26408
26477
|
function isLivePairAuto(pid) {
|
|
26409
26478
|
if (!Number.isInteger(pid) || pid <= 0 || pid === process.pid) return false;
|
|
@@ -26413,7 +26482,7 @@ function isLivePairAuto(pid) {
|
|
|
26413
26482
|
if (e.code !== "EPERM") return false;
|
|
26414
26483
|
}
|
|
26415
26484
|
try {
|
|
26416
|
-
return
|
|
26485
|
+
return fs62.readFileSync(`/proc/${pid}/cmdline`, "utf8").includes("codeam");
|
|
26417
26486
|
} catch {
|
|
26418
26487
|
return true;
|
|
26419
26488
|
}
|
|
@@ -26423,24 +26492,24 @@ function isLiveCodeam(pid) {
|
|
|
26423
26492
|
}
|
|
26424
26493
|
function daemonLockPath(sessionId) {
|
|
26425
26494
|
const safe = sessionId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
26426
|
-
return
|
|
26495
|
+
return path66.join(os50.homedir(), ".codeam", `daemon-${safe}.lock`);
|
|
26427
26496
|
}
|
|
26428
26497
|
function acquireDaemonLock(sessionId) {
|
|
26429
26498
|
const lockPath = daemonLockPath(sessionId);
|
|
26430
26499
|
try {
|
|
26431
|
-
|
|
26500
|
+
fs62.mkdirSync(path66.dirname(lockPath), { recursive: true });
|
|
26432
26501
|
try {
|
|
26433
|
-
|
|
26502
|
+
fs62.writeFileSync(lockPath, String(process.pid), { flag: "wx" });
|
|
26434
26503
|
} catch (e) {
|
|
26435
26504
|
if (e.code !== "EEXIST") throw e;
|
|
26436
|
-
const holder = Number(
|
|
26505
|
+
const holder = Number(fs62.readFileSync(lockPath, "utf8").trim());
|
|
26437
26506
|
if (holder && holder !== process.pid && isLiveCodeam(holder)) return false;
|
|
26438
|
-
|
|
26507
|
+
fs62.writeFileSync(lockPath, String(process.pid));
|
|
26439
26508
|
}
|
|
26440
26509
|
const release3 = () => {
|
|
26441
26510
|
try {
|
|
26442
|
-
if (
|
|
26443
|
-
|
|
26511
|
+
if (fs62.existsSync(lockPath) && Number(fs62.readFileSync(lockPath, "utf8").trim()) === process.pid) {
|
|
26512
|
+
fs62.unlinkSync(lockPath);
|
|
26444
26513
|
}
|
|
26445
26514
|
} catch {
|
|
26446
26515
|
}
|
|
@@ -26462,19 +26531,19 @@ function acquireDaemonLock(sessionId) {
|
|
|
26462
26531
|
function acquireSingletonLock() {
|
|
26463
26532
|
const lockPath = pairAutoLockPath();
|
|
26464
26533
|
try {
|
|
26465
|
-
|
|
26534
|
+
fs62.mkdirSync(path66.dirname(lockPath), { recursive: true });
|
|
26466
26535
|
try {
|
|
26467
|
-
|
|
26536
|
+
fs62.writeFileSync(lockPath, String(process.pid), { flag: "wx" });
|
|
26468
26537
|
} catch (e) {
|
|
26469
26538
|
if (e.code !== "EEXIST") throw e;
|
|
26470
|
-
const holder = Number(
|
|
26539
|
+
const holder = Number(fs62.readFileSync(lockPath, "utf8").trim());
|
|
26471
26540
|
if (isLivePairAuto(holder)) return false;
|
|
26472
|
-
|
|
26541
|
+
fs62.writeFileSync(lockPath, String(process.pid));
|
|
26473
26542
|
}
|
|
26474
26543
|
process.once("exit", () => {
|
|
26475
26544
|
try {
|
|
26476
|
-
if (
|
|
26477
|
-
|
|
26545
|
+
if (fs62.existsSync(lockPath) && Number(fs62.readFileSync(lockPath, "utf8").trim()) === process.pid) {
|
|
26546
|
+
fs62.unlinkSync(lockPath);
|
|
26478
26547
|
}
|
|
26479
26548
|
} catch {
|
|
26480
26549
|
}
|
|
@@ -26926,7 +26995,7 @@ var AgentService = class _AgentService {
|
|
|
26926
26995
|
};
|
|
26927
26996
|
|
|
26928
26997
|
// src/agents/acp/adapters.ts
|
|
26929
|
-
var
|
|
26998
|
+
var path68 = __toESM(require("path"));
|
|
26930
26999
|
|
|
26931
27000
|
// src/agents/acp/agent-binary.ts
|
|
26932
27001
|
var import_fs6 = __toESM(require("fs"));
|
|
@@ -27216,13 +27285,13 @@ function resolveBin(pkgName, binName) {
|
|
|
27216
27285
|
try {
|
|
27217
27286
|
const manifestPath = require_.resolve(`${pkgName}/package.json`);
|
|
27218
27287
|
const manifest = require_(`${pkgName}/package.json`);
|
|
27219
|
-
const pkgDir =
|
|
27288
|
+
const pkgDir = path68.dirname(manifestPath);
|
|
27220
27289
|
const bin = manifest.bin;
|
|
27221
27290
|
if (!bin) return null;
|
|
27222
|
-
if (typeof bin === "string") return
|
|
27291
|
+
if (typeof bin === "string") return path68.resolve(pkgDir, bin);
|
|
27223
27292
|
const target = binName ?? Object.keys(bin)[0];
|
|
27224
27293
|
if (!target || !bin[target]) return null;
|
|
27225
|
-
return
|
|
27294
|
+
return path68.resolve(pkgDir, bin[target]);
|
|
27226
27295
|
} catch {
|
|
27227
27296
|
return null;
|
|
27228
27297
|
}
|
|
@@ -27372,9 +27441,9 @@ async function resolveAcpAdapterWithRetry(agent, opts = {}) {
|
|
|
27372
27441
|
var import_node_crypto11 = require("crypto");
|
|
27373
27442
|
|
|
27374
27443
|
// src/services/history.service.ts
|
|
27375
|
-
var
|
|
27376
|
-
var
|
|
27377
|
-
var
|
|
27444
|
+
var fs64 = __toESM(require("fs"));
|
|
27445
|
+
var path69 = __toESM(require("path"));
|
|
27446
|
+
var os52 = __toESM(require("os"));
|
|
27378
27447
|
var https7 = __toESM(require("https"));
|
|
27379
27448
|
var http6 = __toESM(require("http"));
|
|
27380
27449
|
var import_zod2 = require("zod");
|
|
@@ -27401,7 +27470,7 @@ function parseJsonl(filePath) {
|
|
|
27401
27470
|
const messages = [];
|
|
27402
27471
|
let raw;
|
|
27403
27472
|
try {
|
|
27404
|
-
raw =
|
|
27473
|
+
raw = fs64.readFileSync(filePath, "utf8");
|
|
27405
27474
|
} catch (err) {
|
|
27406
27475
|
if (err.code !== "ENOENT") {
|
|
27407
27476
|
log.warn("history:parseJsonl", `read failed for ${filePath}`, err);
|
|
@@ -27542,7 +27611,7 @@ var HistoryService = class _HistoryService {
|
|
|
27542
27611
|
return this._quotaPercent === null || Date.now() - this._quotaFetchedAt > ttlMs;
|
|
27543
27612
|
}
|
|
27544
27613
|
get projectDir() {
|
|
27545
|
-
return this.runtime.resolveHistoryDir(this.cwd) ??
|
|
27614
|
+
return this.runtime.resolveHistoryDir(this.cwd) ?? path69.join(os52.homedir(), ".claude", "projects", encodeCwd(this.cwd));
|
|
27546
27615
|
}
|
|
27547
27616
|
/** Set the current Claude conversation ID (extracted from /cost command or session start) */
|
|
27548
27617
|
setCurrentConversationId(id) {
|
|
@@ -27554,7 +27623,7 @@ var HistoryService = class _HistoryService {
|
|
|
27554
27623
|
/** Return the current message count in the active conversation. */
|
|
27555
27624
|
getCurrentMessageCount() {
|
|
27556
27625
|
if (!this.currentConversationId) return 0;
|
|
27557
|
-
const filePath =
|
|
27626
|
+
const filePath = path69.join(this.projectDir, `${this.currentConversationId}.jsonl`);
|
|
27558
27627
|
return parseJsonl(filePath).length;
|
|
27559
27628
|
}
|
|
27560
27629
|
/**
|
|
@@ -27565,7 +27634,7 @@ var HistoryService = class _HistoryService {
|
|
|
27565
27634
|
const deadline = Date.now() + timeoutMs;
|
|
27566
27635
|
while (Date.now() < deadline) {
|
|
27567
27636
|
if (!this.currentConversationId) return null;
|
|
27568
|
-
const filePath =
|
|
27637
|
+
const filePath = path69.join(this.projectDir, `${this.currentConversationId}.jsonl`);
|
|
27569
27638
|
const messages = parseJsonl(filePath);
|
|
27570
27639
|
if (messages.length > previousCount) {
|
|
27571
27640
|
for (let i = messages.length - 1; i >= previousCount; i--) {
|
|
@@ -27591,16 +27660,16 @@ var HistoryService = class _HistoryService {
|
|
|
27591
27660
|
const dir = this.projectDir;
|
|
27592
27661
|
const cutoff = this.bootTimeMs - _HistoryService.BIRTHTIME_GRACE_MS;
|
|
27593
27662
|
try {
|
|
27594
|
-
const files =
|
|
27663
|
+
const files = fs64.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isFile() && e.name.endsWith(".jsonl")).map((e) => {
|
|
27595
27664
|
try {
|
|
27596
|
-
const stat3 =
|
|
27665
|
+
const stat3 = fs64.statSync(path69.join(dir, e.name));
|
|
27597
27666
|
return { name: e.name, mtime: stat3.mtimeMs, birthtime: stat3.birthtimeMs };
|
|
27598
27667
|
} catch {
|
|
27599
27668
|
return { name: e.name, mtime: 0, birthtime: 0 };
|
|
27600
27669
|
}
|
|
27601
27670
|
}).filter((f) => f.birthtime >= cutoff).sort((a, b) => b.mtime - a.mtime);
|
|
27602
27671
|
if (files.length > 0) {
|
|
27603
|
-
this.currentConversationId =
|
|
27672
|
+
this.currentConversationId = path69.basename(files[0].name, ".jsonl");
|
|
27604
27673
|
}
|
|
27605
27674
|
} catch {
|
|
27606
27675
|
}
|
|
@@ -27634,13 +27703,13 @@ var HistoryService = class _HistoryService {
|
|
|
27634
27703
|
const cutoff = this.bootTimeMs - _HistoryService.BIRTHTIME_GRACE_MS;
|
|
27635
27704
|
let entries;
|
|
27636
27705
|
try {
|
|
27637
|
-
entries =
|
|
27706
|
+
entries = fs64.readdirSync(dir, { withFileTypes: true });
|
|
27638
27707
|
} catch {
|
|
27639
27708
|
return null;
|
|
27640
27709
|
}
|
|
27641
27710
|
const files = entries.filter((e) => e.isFile() && e.name.endsWith(".jsonl")).map((e) => {
|
|
27642
27711
|
try {
|
|
27643
|
-
const stat3 =
|
|
27712
|
+
const stat3 = fs64.statSync(path69.join(dir, e.name));
|
|
27644
27713
|
return { name: e.name, mtime: stat3.mtimeMs, birthtime: stat3.birthtimeMs };
|
|
27645
27714
|
} catch {
|
|
27646
27715
|
return { name: e.name, mtime: 0, birthtime: 0 };
|
|
@@ -27649,12 +27718,12 @@ var HistoryService = class _HistoryService {
|
|
|
27649
27718
|
if (files.length === 0) return null;
|
|
27650
27719
|
const targetFile = this.currentConversationId ? `${this.currentConversationId}.jsonl` : files[0].name;
|
|
27651
27720
|
if (!files.some((f) => f.name === targetFile)) return null;
|
|
27652
|
-
return this.extractUsageFromFile(
|
|
27721
|
+
return this.extractUsageFromFile(path69.join(dir, targetFile));
|
|
27653
27722
|
}
|
|
27654
27723
|
extractUsageFromFile(filePath) {
|
|
27655
27724
|
let raw;
|
|
27656
27725
|
try {
|
|
27657
|
-
raw =
|
|
27726
|
+
raw = fs64.readFileSync(filePath, "utf8");
|
|
27658
27727
|
} catch {
|
|
27659
27728
|
return null;
|
|
27660
27729
|
}
|
|
@@ -27699,9 +27768,9 @@ var HistoryService = class _HistoryService {
|
|
|
27699
27768
|
let totalCost = 0;
|
|
27700
27769
|
let files;
|
|
27701
27770
|
try {
|
|
27702
|
-
files =
|
|
27771
|
+
files = fs64.readdirSync(projectDir).filter((f) => f.endsWith(".jsonl")).filter((f) => {
|
|
27703
27772
|
try {
|
|
27704
|
-
return
|
|
27773
|
+
return fs64.statSync(path69.join(projectDir, f)).mtimeMs >= monthStartMs;
|
|
27705
27774
|
} catch {
|
|
27706
27775
|
return false;
|
|
27707
27776
|
}
|
|
@@ -27712,7 +27781,7 @@ var HistoryService = class _HistoryService {
|
|
|
27712
27781
|
for (const file of files) {
|
|
27713
27782
|
let raw;
|
|
27714
27783
|
try {
|
|
27715
|
-
raw =
|
|
27784
|
+
raw = fs64.readFileSync(path69.join(projectDir, file), "utf8");
|
|
27716
27785
|
} catch {
|
|
27717
27786
|
continue;
|
|
27718
27787
|
}
|
|
@@ -27791,7 +27860,7 @@ var HistoryService = class _HistoryService {
|
|
|
27791
27860
|
if (this.runtime.resolveHistoryFile) {
|
|
27792
27861
|
return this.runtime.resolveHistoryFile(this.cwd, sessionId);
|
|
27793
27862
|
}
|
|
27794
|
-
return
|
|
27863
|
+
return path69.join(this.projectDir, `${sessionId}.jsonl`);
|
|
27795
27864
|
}
|
|
27796
27865
|
/**
|
|
27797
27866
|
* Parse a conversation's messages from disk, agent-aware. Claude uses the
|
|
@@ -27825,7 +27894,7 @@ var HistoryService = class _HistoryService {
|
|
|
27825
27894
|
};
|
|
27826
27895
|
});
|
|
27827
27896
|
}
|
|
27828
|
-
return parseJsonl(
|
|
27897
|
+
return parseJsonl(path69.join(this.projectDir, `${sessionId}.jsonl`));
|
|
27829
27898
|
}
|
|
27830
27899
|
async loadConversation(sessionId) {
|
|
27831
27900
|
const messages = this.readConversation(sessionId);
|
|
@@ -27893,7 +27962,7 @@ var HistoryService = class _HistoryService {
|
|
|
27893
27962
|
if (!filePath) return false;
|
|
27894
27963
|
let mtimeMs;
|
|
27895
27964
|
try {
|
|
27896
|
-
mtimeMs =
|
|
27965
|
+
mtimeMs = fs64.statSync(filePath).mtimeMs;
|
|
27897
27966
|
} catch {
|
|
27898
27967
|
return false;
|
|
27899
27968
|
}
|
|
@@ -27968,10 +28037,10 @@ var HistoryService = class _HistoryService {
|
|
|
27968
28037
|
|
|
27969
28038
|
// src/agents/acp/client.ts
|
|
27970
28039
|
var import_node_child_process29 = require("child_process");
|
|
27971
|
-
var
|
|
28040
|
+
var fs65 = __toESM(require("fs/promises"));
|
|
27972
28041
|
var fsSync = __toESM(require("fs"));
|
|
27973
|
-
var
|
|
27974
|
-
var
|
|
28042
|
+
var os54 = __toESM(require("os"));
|
|
28043
|
+
var path71 = __toESM(require("path"));
|
|
27975
28044
|
var import_node_stream = require("stream");
|
|
27976
28045
|
|
|
27977
28046
|
// ../../node_modules/@agentclientprotocol/sdk/dist/schema/index.js
|
|
@@ -31997,19 +32066,22 @@ function createIdleTimeout(idleMs, makeError, activeIdleMs = idleMs) {
|
|
|
31997
32066
|
}
|
|
31998
32067
|
|
|
31999
32068
|
// src/agents/acp/internal-paths.ts
|
|
32000
|
-
var
|
|
32001
|
-
var
|
|
32069
|
+
var path70 = __toESM(require("path"));
|
|
32070
|
+
var os53 = __toESM(require("os"));
|
|
32002
32071
|
var INTERNAL_TOKENS = [".codeam", "house-claude"];
|
|
32072
|
+
var SELF_HOSTED_WORKSPACE_RE = /\.codeam[/\\]self-hosted/gi;
|
|
32003
32073
|
function textReferencesInternal(text) {
|
|
32004
32074
|
if (!text) return false;
|
|
32005
|
-
|
|
32075
|
+
const scrubbed = text.replace(SELF_HOSTED_WORKSPACE_RE, " ");
|
|
32076
|
+
return INTERNAL_TOKENS.some((t2) => scrubbed.includes(t2));
|
|
32006
32077
|
}
|
|
32007
|
-
function pathIsInternal(p2, homeDir2 =
|
|
32078
|
+
function pathIsInternal(p2, homeDir2 = os53.homedir()) {
|
|
32008
32079
|
if (!p2) return false;
|
|
32009
|
-
const abs =
|
|
32010
|
-
const home =
|
|
32011
|
-
const within = (root) => abs === root || abs.startsWith(root +
|
|
32012
|
-
|
|
32080
|
+
const abs = path70.resolve(p2);
|
|
32081
|
+
const home = path70.resolve(homeDir2);
|
|
32082
|
+
const within = (root) => abs === root || abs.startsWith(root + path70.sep);
|
|
32083
|
+
if (within(path70.join(home, ".codeam", "self-hosted"))) return false;
|
|
32084
|
+
return within(path70.join(home, ".codeam")) || within(path70.join(home, ".beads")) || abs === path70.join(home, ".codeam-host.log") || abs.includes(`${path70.sep}house-claude${path70.sep}`) || abs.endsWith(`${path70.sep}house-claude`);
|
|
32013
32085
|
}
|
|
32014
32086
|
function toolCallReferencesInternal(call) {
|
|
32015
32087
|
if (textReferencesInternal(call.title)) return true;
|
|
@@ -32838,7 +32910,7 @@ var AcpClient = class {
|
|
|
32838
32910
|
throw new RequestError(-32002, INTERNAL_BLOCK_REASON, { uri: params.path });
|
|
32839
32911
|
}
|
|
32840
32912
|
try {
|
|
32841
|
-
const content = await
|
|
32913
|
+
const content = await fs65.readFile(params.path, "utf8");
|
|
32842
32914
|
return applyLineRange(content, params.line ?? null, params.limit ?? null);
|
|
32843
32915
|
} catch (err) {
|
|
32844
32916
|
const code = err.code;
|
|
@@ -32861,7 +32933,7 @@ var AcpClient = class {
|
|
|
32861
32933
|
throw new RequestError(-32002, INTERNAL_BLOCK_REASON, { uri: params.path });
|
|
32862
32934
|
}
|
|
32863
32935
|
try {
|
|
32864
|
-
await
|
|
32936
|
+
await fs65.writeFile(params.path, params.content, "utf8");
|
|
32865
32937
|
return {};
|
|
32866
32938
|
} catch (err) {
|
|
32867
32939
|
const code = err.code;
|
|
@@ -32921,29 +32993,29 @@ function applyLineRange(content, line, limit) {
|
|
|
32921
32993
|
return { content: lines.slice(start2, end).join("\n") };
|
|
32922
32994
|
}
|
|
32923
32995
|
function knownAgentBinaryDirs() {
|
|
32924
|
-
const home =
|
|
32996
|
+
const home = os54.homedir();
|
|
32925
32997
|
const out2 = [];
|
|
32926
32998
|
out2.push("/tmp/codeam-node20/bin");
|
|
32927
32999
|
for (const root of [
|
|
32928
33000
|
"/usr/local/share/nvm/versions/node",
|
|
32929
|
-
|
|
33001
|
+
path71.join(home, ".nvm/versions/node")
|
|
32930
33002
|
]) {
|
|
32931
33003
|
try {
|
|
32932
33004
|
for (const child of fsSync.readdirSync(root)) {
|
|
32933
|
-
out2.push(
|
|
33005
|
+
out2.push(path71.join(root, child, "bin"));
|
|
32934
33006
|
}
|
|
32935
33007
|
} catch {
|
|
32936
33008
|
}
|
|
32937
33009
|
}
|
|
32938
|
-
out2.push(
|
|
33010
|
+
out2.push(path71.join(home, ".volta/bin"));
|
|
32939
33011
|
out2.push("/usr/local/bin");
|
|
32940
33012
|
out2.push("/usr/bin");
|
|
32941
|
-
out2.push(
|
|
32942
|
-
out2.push(
|
|
33013
|
+
out2.push(path71.join(home, ".local/bin"));
|
|
33014
|
+
out2.push(path71.join(home, "bin"));
|
|
32943
33015
|
if (process.platform === "win32") {
|
|
32944
33016
|
const { LOCALAPPDATA, APPDATA } = process.env;
|
|
32945
|
-
if (LOCALAPPDATA) out2.push(
|
|
32946
|
-
if (APPDATA) out2.push(
|
|
33017
|
+
if (LOCALAPPDATA) out2.push(path71.join(LOCALAPPDATA, "cursor-agent"));
|
|
33018
|
+
if (APPDATA) out2.push(path71.join(APPDATA, "npm"));
|
|
32947
33019
|
}
|
|
32948
33020
|
return out2.filter((p2) => {
|
|
32949
33021
|
try {
|
|
@@ -32955,7 +33027,7 @@ function knownAgentBinaryDirs() {
|
|
|
32955
33027
|
}
|
|
32956
33028
|
function expandPathForAgentBinaries(existingPath) {
|
|
32957
33029
|
const existing = new Set(
|
|
32958
|
-
existingPath.split(
|
|
33030
|
+
existingPath.split(path71.delimiter).filter((p2) => p2.length > 0)
|
|
32959
33031
|
);
|
|
32960
33032
|
const additions = [];
|
|
32961
33033
|
for (const dir of knownAgentBinaryDirs()) {
|
|
@@ -32965,7 +33037,7 @@ function expandPathForAgentBinaries(existingPath) {
|
|
|
32965
33037
|
}
|
|
32966
33038
|
}
|
|
32967
33039
|
if (additions.length === 0) return existingPath;
|
|
32968
|
-
return [...additions, existingPath].filter((p2) => p2.length > 0).join(
|
|
33040
|
+
return [...additions, existingPath].filter((p2) => p2.length > 0).join(path71.delimiter);
|
|
32969
33041
|
}
|
|
32970
33042
|
|
|
32971
33043
|
// src/agents/acp/headroom-budget-proxy.ts
|
|
@@ -33447,15 +33519,15 @@ function commonPrefixLength(a, b) {
|
|
|
33447
33519
|
|
|
33448
33520
|
// src/agents/acp/onboarding.ts
|
|
33449
33521
|
var import_child_process27 = require("child_process");
|
|
33450
|
-
var
|
|
33451
|
-
var
|
|
33452
|
-
var
|
|
33522
|
+
var fs66 = __toESM(require("fs"));
|
|
33523
|
+
var os55 = __toESM(require("os"));
|
|
33524
|
+
var path72 = __toESM(require("path"));
|
|
33453
33525
|
var _onboardingSeam = {
|
|
33454
|
-
markerPath: (sessionId) =>
|
|
33455
|
-
exists: (p2) =>
|
|
33526
|
+
markerPath: (sessionId) => path72.join(os55.homedir(), ".codeam", "welcomed", `${sessionId}.done`),
|
|
33527
|
+
exists: (p2) => fs66.existsSync(p2),
|
|
33456
33528
|
write: (p2) => {
|
|
33457
|
-
|
|
33458
|
-
|
|
33529
|
+
fs66.mkdirSync(path72.dirname(p2), { recursive: true });
|
|
33530
|
+
fs66.writeFileSync(p2, "");
|
|
33459
33531
|
},
|
|
33460
33532
|
disabled: () => {
|
|
33461
33533
|
const v = process.env.CODEAM_ONBOARDING_DISABLED;
|
|
@@ -33492,7 +33564,7 @@ function resolveRepoName(cwd) {
|
|
|
33492
33564
|
if (name) return name;
|
|
33493
33565
|
}
|
|
33494
33566
|
}
|
|
33495
|
-
const base =
|
|
33567
|
+
const base = path72.basename(cwd || "");
|
|
33496
33568
|
if (base && !isUuid(base)) return base;
|
|
33497
33569
|
return "this project";
|
|
33498
33570
|
}
|
|
@@ -33750,13 +33822,13 @@ var import_crypto5 = require("crypto");
|
|
|
33750
33822
|
|
|
33751
33823
|
// src/services/turn-files/git-changeset.ts
|
|
33752
33824
|
var import_child_process28 = require("child_process");
|
|
33753
|
-
var
|
|
33754
|
-
var
|
|
33825
|
+
var fs68 = __toESM(require("fs/promises"));
|
|
33826
|
+
var path74 = __toESM(require("path"));
|
|
33755
33827
|
|
|
33756
33828
|
// src/services/turn-files/review-ignore.ts
|
|
33757
33829
|
var import_ignore2 = __toESM(require("ignore"));
|
|
33758
|
-
var
|
|
33759
|
-
var
|
|
33830
|
+
var fs67 = __toESM(require("fs"));
|
|
33831
|
+
var path73 = __toESM(require("path"));
|
|
33760
33832
|
var CURATED_REVIEW_IGNORE = [
|
|
33761
33833
|
// Google Cloud SDK (the incident) — installs a huge python tree.
|
|
33762
33834
|
"google-cloud-sdk/",
|
|
@@ -33795,7 +33867,7 @@ var CURATED_REVIEW_IGNORE = [
|
|
|
33795
33867
|
function makeReviewIgnore(repoRoot) {
|
|
33796
33868
|
const ig = (0, import_ignore2.default)().add(CURATED_REVIEW_IGNORE);
|
|
33797
33869
|
try {
|
|
33798
|
-
const custom =
|
|
33870
|
+
const custom = fs67.readFileSync(path73.join(repoRoot, ".codeam", "reviewignore"), "utf8");
|
|
33799
33871
|
ig.add(custom);
|
|
33800
33872
|
} catch {
|
|
33801
33873
|
}
|
|
@@ -33840,7 +33912,7 @@ async function collectRepoChangeset(opts) {
|
|
|
33840
33912
|
let stats;
|
|
33841
33913
|
if (!truncated && row.fileStatus === "added" && numstatEntry === void 0) {
|
|
33842
33914
|
const lineCount = await readUntrackedLineCount(
|
|
33843
|
-
|
|
33915
|
+
path74.join(opts.repoRoot, row.filePath)
|
|
33844
33916
|
);
|
|
33845
33917
|
stats = { added: lineCount, removed: 0 };
|
|
33846
33918
|
} else {
|
|
@@ -33871,7 +33943,7 @@ function readUntrackedLineCount(absPath) {
|
|
|
33871
33943
|
}
|
|
33872
33944
|
async function defaultReadUntrackedLineCount(absPath) {
|
|
33873
33945
|
try {
|
|
33874
|
-
const content = await
|
|
33946
|
+
const content = await fs68.readFile(absPath, "utf8");
|
|
33875
33947
|
let count = 0;
|
|
33876
33948
|
let pos = -1;
|
|
33877
33949
|
while ((pos = content.indexOf("\n", pos + 1)) !== -1) {
|
|
@@ -33963,7 +34035,7 @@ function defaultRunGit(cwd, args2) {
|
|
|
33963
34035
|
});
|
|
33964
34036
|
}
|
|
33965
34037
|
async function discoverRepos(workingDir, maxDepth = 4) {
|
|
33966
|
-
const
|
|
34038
|
+
const fs75 = await import("fs/promises");
|
|
33967
34039
|
const out2 = [];
|
|
33968
34040
|
await walk(workingDir, 0);
|
|
33969
34041
|
return out2;
|
|
@@ -33971,7 +34043,7 @@ async function discoverRepos(workingDir, maxDepth = 4) {
|
|
|
33971
34043
|
if (depth > maxDepth) return;
|
|
33972
34044
|
let entries = [];
|
|
33973
34045
|
try {
|
|
33974
|
-
const dirents = await
|
|
34046
|
+
const dirents = await fs75.readdir(dir, { withFileTypes: true });
|
|
33975
34047
|
entries = dirents.filter((d3) => !d3.name.startsWith(".") || d3.name === ".git").map((d3) => ({ name: d3.name, isDirectory: d3.isDirectory() }));
|
|
33976
34048
|
} catch {
|
|
33977
34049
|
return;
|
|
@@ -33982,8 +34054,8 @@ async function discoverRepos(workingDir, maxDepth = 4) {
|
|
|
33982
34054
|
if (hasGit) {
|
|
33983
34055
|
out2.push({
|
|
33984
34056
|
repoRoot: dir,
|
|
33985
|
-
repoPath:
|
|
33986
|
-
repoName:
|
|
34057
|
+
repoPath: path74.relative(workingDir, dir),
|
|
34058
|
+
repoName: path74.basename(dir)
|
|
33987
34059
|
});
|
|
33988
34060
|
return;
|
|
33989
34061
|
}
|
|
@@ -33991,14 +34063,14 @@ async function discoverRepos(workingDir, maxDepth = 4) {
|
|
|
33991
34063
|
if (!entry.isDirectory) continue;
|
|
33992
34064
|
if (entry.name === "node_modules") continue;
|
|
33993
34065
|
if (entry.name === "dist" || entry.name === "build") continue;
|
|
33994
|
-
await walk(
|
|
34066
|
+
await walk(path74.join(dir, entry.name), depth + 1);
|
|
33995
34067
|
}
|
|
33996
34068
|
}
|
|
33997
34069
|
}
|
|
33998
34070
|
|
|
33999
34071
|
// src/services/turn-files/files-outbox.ts
|
|
34000
|
-
var
|
|
34001
|
-
var
|
|
34072
|
+
var fs69 = __toESM(require("fs/promises"));
|
|
34073
|
+
var path75 = __toESM(require("path"));
|
|
34002
34074
|
var import_os12 = require("os");
|
|
34003
34075
|
var HOME_OUTBOX_DIR = ".codeam/outbox";
|
|
34004
34076
|
var MAX_AGE_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -34031,16 +34103,16 @@ var FilesOutbox = class {
|
|
|
34031
34103
|
backoffIndex = 0;
|
|
34032
34104
|
stopped = false;
|
|
34033
34105
|
constructor(opts) {
|
|
34034
|
-
const base = opts.baseDir ??
|
|
34035
|
-
this.filePath =
|
|
34106
|
+
const base = opts.baseDir ?? path75.join(homeDir(), HOME_OUTBOX_DIR);
|
|
34107
|
+
this.filePath = path75.join(base, `${opts.sessionId}.jsonl`);
|
|
34036
34108
|
this.post = opts.post;
|
|
34037
34109
|
this.autoSchedule = opts.autoSchedule !== false;
|
|
34038
34110
|
}
|
|
34039
34111
|
/** Persist the entry to disk and trigger a flush. Returns once the
|
|
34040
34112
|
* line is durable on disk (not once the POST succeeds). */
|
|
34041
34113
|
async enqueue(entry) {
|
|
34042
|
-
await
|
|
34043
|
-
await
|
|
34114
|
+
await fs69.mkdir(path75.dirname(this.filePath), { recursive: true });
|
|
34115
|
+
await fs69.appendFile(this.filePath, JSON.stringify(entry) + "\n", "utf8");
|
|
34044
34116
|
this.backoffIndex = 0;
|
|
34045
34117
|
if (this.autoSchedule) this.scheduleFlush(0);
|
|
34046
34118
|
}
|
|
@@ -34131,7 +34203,7 @@ var FilesOutbox = class {
|
|
|
34131
34203
|
async readAll() {
|
|
34132
34204
|
let raw = "";
|
|
34133
34205
|
try {
|
|
34134
|
-
raw = await
|
|
34206
|
+
raw = await fs69.readFile(this.filePath, "utf8");
|
|
34135
34207
|
} catch {
|
|
34136
34208
|
return [];
|
|
34137
34209
|
}
|
|
@@ -34155,12 +34227,12 @@ var FilesOutbox = class {
|
|
|
34155
34227
|
async rewrite(entries) {
|
|
34156
34228
|
const tmpPath = `${this.filePath}.${process.pid}.tmp`;
|
|
34157
34229
|
if (entries.length === 0) {
|
|
34158
|
-
await
|
|
34230
|
+
await fs69.unlink(this.filePath).catch(() => void 0);
|
|
34159
34231
|
return;
|
|
34160
34232
|
}
|
|
34161
34233
|
const payload = entries.map((e) => JSON.stringify(e)).join("\n") + "\n";
|
|
34162
|
-
await
|
|
34163
|
-
await
|
|
34234
|
+
await fs69.writeFile(tmpPath, payload, "utf8");
|
|
34235
|
+
await fs69.rename(tmpPath, this.filePath);
|
|
34164
34236
|
}
|
|
34165
34237
|
};
|
|
34166
34238
|
function applyJitter(ms) {
|
|
@@ -37418,9 +37490,9 @@ function startClaudeCredentialSync(opts) {
|
|
|
37418
37490
|
}
|
|
37419
37491
|
|
|
37420
37492
|
// src/beads/workflow-hint.ts
|
|
37421
|
-
var
|
|
37422
|
-
var
|
|
37423
|
-
var
|
|
37493
|
+
var fs71 = __toESM(require("fs"));
|
|
37494
|
+
var path77 = __toESM(require("path"));
|
|
37495
|
+
var os56 = __toESM(require("os"));
|
|
37424
37496
|
var BEADS_HINT_MARKER = "<!-- codeam:beads-workflow -->";
|
|
37425
37497
|
var BEADS_HINT = `${BEADS_HINT_MARKER}
|
|
37426
37498
|
# Beads (bd) \u2014 task tracking + persistent memory (ALWAYS use it)
|
|
@@ -37434,22 +37506,22 @@ This environment uses **bd (beads)** for issue/task tracking and persistent memo
|
|
|
37434
37506
|
- \`bd ready\` (available work) \xB7 \`bd show <id>\` \xB7 \`bd update <id> --claim\` \xB7 \`bd close <id>\`.
|
|
37435
37507
|
- Use \`bd remember "..."\` for persistent knowledge \u2014 do NOT use MEMORY.md files.
|
|
37436
37508
|
${BEADS_HINT_MARKER}`;
|
|
37437
|
-
function ensureBeadsWorkflowHint(homeDir2 =
|
|
37509
|
+
function ensureBeadsWorkflowHint(homeDir2 = os56.homedir()) {
|
|
37438
37510
|
try {
|
|
37439
|
-
const file =
|
|
37511
|
+
const file = path77.join(homeDir2, ".claude", "CLAUDE.md");
|
|
37440
37512
|
let existing = "";
|
|
37441
37513
|
try {
|
|
37442
|
-
existing =
|
|
37514
|
+
existing = fs71.readFileSync(file, "utf8");
|
|
37443
37515
|
} catch {
|
|
37444
37516
|
}
|
|
37445
37517
|
if (existing.includes(BEADS_HINT_MARKER)) return;
|
|
37446
|
-
|
|
37518
|
+
fs71.mkdirSync(path77.dirname(file), { recursive: true });
|
|
37447
37519
|
const next = existing.trim() ? `${existing.trimEnd()}
|
|
37448
37520
|
|
|
37449
37521
|
${BEADS_HINT}
|
|
37450
37522
|
` : `${BEADS_HINT}
|
|
37451
37523
|
`;
|
|
37452
|
-
|
|
37524
|
+
fs71.writeFileSync(file, next);
|
|
37453
37525
|
} catch {
|
|
37454
37526
|
}
|
|
37455
37527
|
}
|
|
@@ -37821,7 +37893,7 @@ var AcpDriver = class {
|
|
|
37821
37893
|
};
|
|
37822
37894
|
|
|
37823
37895
|
// src/baton/transcript-mirror.ts
|
|
37824
|
-
var
|
|
37896
|
+
var fs72 = __toESM(require("fs"));
|
|
37825
37897
|
var TranscriptMirror = class {
|
|
37826
37898
|
constructor(deps) {
|
|
37827
37899
|
this.deps = deps;
|
|
@@ -37888,7 +37960,7 @@ var TranscriptMirror = class {
|
|
|
37888
37960
|
}
|
|
37889
37961
|
};
|
|
37890
37962
|
function defaultWatch(file, onChange) {
|
|
37891
|
-
const w3 =
|
|
37963
|
+
const w3 = fs72.watch(file, { persistent: false }, () => onChange());
|
|
37892
37964
|
return () => w3.close();
|
|
37893
37965
|
}
|
|
37894
37966
|
|
|
@@ -38150,16 +38222,16 @@ function toEpochMs(ts) {
|
|
|
38150
38222
|
}
|
|
38151
38223
|
|
|
38152
38224
|
// src/agents/claude/onboarding.ts
|
|
38153
|
-
var
|
|
38154
|
-
var
|
|
38155
|
-
var
|
|
38225
|
+
var fs73 = __toESM(require("fs"));
|
|
38226
|
+
var os58 = __toESM(require("os"));
|
|
38227
|
+
var path78 = __toESM(require("path"));
|
|
38156
38228
|
var ONBOARDING_VERSION_SENTINEL = "9999.0.0";
|
|
38157
38229
|
function ensureClaudeOnboarded(cwd) {
|
|
38158
38230
|
try {
|
|
38159
|
-
const file =
|
|
38231
|
+
const file = path78.join(os58.homedir(), ".claude.json");
|
|
38160
38232
|
let config = {};
|
|
38161
38233
|
try {
|
|
38162
|
-
config = JSON.parse(
|
|
38234
|
+
config = JSON.parse(fs73.readFileSync(file, "utf8"));
|
|
38163
38235
|
} catch {
|
|
38164
38236
|
}
|
|
38165
38237
|
let changed = false;
|
|
@@ -38184,8 +38256,8 @@ function ensureClaudeOnboarded(cwd) {
|
|
|
38184
38256
|
}
|
|
38185
38257
|
}
|
|
38186
38258
|
if (!changed) return;
|
|
38187
|
-
|
|
38188
|
-
|
|
38259
|
+
fs73.mkdirSync(path78.dirname(file), { recursive: true });
|
|
38260
|
+
fs73.writeFileSync(file, JSON.stringify(config, null, 2));
|
|
38189
38261
|
log.info(
|
|
38190
38262
|
"claude",
|
|
38191
38263
|
`pre-completed Claude onboarding${cwd ? ` + trusted workspace ${cwd}` : ""}`
|
|
@@ -38912,7 +38984,7 @@ var import_picocolors11 = __toESM(require("picocolors"));
|
|
|
38912
38984
|
var import_child_process29 = require("child_process");
|
|
38913
38985
|
var import_util4 = require("util");
|
|
38914
38986
|
var import_picocolors9 = __toESM(require("picocolors"));
|
|
38915
|
-
var
|
|
38987
|
+
var path79 = __toESM(require("path"));
|
|
38916
38988
|
var execFileP6 = (0, import_util4.promisify)(import_child_process29.execFile);
|
|
38917
38989
|
var MAX_BUFFER = 8 * 1024 * 1024;
|
|
38918
38990
|
function resetStdinForChild() {
|
|
@@ -39401,7 +39473,7 @@ var GitHubCodespacesProvider = class {
|
|
|
39401
39473
|
});
|
|
39402
39474
|
}
|
|
39403
39475
|
async uploadFile(workspaceId, remotePath, contents, options = {}) {
|
|
39404
|
-
const remoteDir =
|
|
39476
|
+
const remoteDir = path79.posix.dirname(remotePath);
|
|
39405
39477
|
const parts = [
|
|
39406
39478
|
`mkdir -p ${shellQuote(remoteDir)}`,
|
|
39407
39479
|
`cat > ${shellQuote(remotePath)}`
|
|
@@ -39471,7 +39543,7 @@ function shellQuote(s) {
|
|
|
39471
39543
|
// src/services/providers/gitpod.ts
|
|
39472
39544
|
var import_child_process30 = require("child_process");
|
|
39473
39545
|
var import_util5 = require("util");
|
|
39474
|
-
var
|
|
39546
|
+
var path80 = __toESM(require("path"));
|
|
39475
39547
|
var import_picocolors10 = __toESM(require("picocolors"));
|
|
39476
39548
|
var execFileP7 = (0, import_util5.promisify)(import_child_process30.execFile);
|
|
39477
39549
|
var MAX_BUFFER2 = 8 * 1024 * 1024;
|
|
@@ -39711,7 +39783,7 @@ var GitpodProvider = class {
|
|
|
39711
39783
|
});
|
|
39712
39784
|
}
|
|
39713
39785
|
async uploadFile(workspaceId, remotePath, contents, options = {}) {
|
|
39714
|
-
const remoteDir =
|
|
39786
|
+
const remoteDir = path80.posix.dirname(remotePath);
|
|
39715
39787
|
const parts = [
|
|
39716
39788
|
`mkdir -p ${shellQuote2(remoteDir)}`,
|
|
39717
39789
|
`cat > ${shellQuote2(remotePath)}`
|
|
@@ -39747,7 +39819,7 @@ function shellQuote2(s) {
|
|
|
39747
39819
|
// src/services/providers/gitlab-workspaces.ts
|
|
39748
39820
|
var import_child_process31 = require("child_process");
|
|
39749
39821
|
var import_util6 = require("util");
|
|
39750
|
-
var
|
|
39822
|
+
var path81 = __toESM(require("path"));
|
|
39751
39823
|
var execFileP8 = (0, import_util6.promisify)(import_child_process31.execFile);
|
|
39752
39824
|
var MAX_BUFFER3 = 8 * 1024 * 1024;
|
|
39753
39825
|
var GITLAB_API_BASE = process.env.CODEAM_GITLAB_API_URL ?? "https://gitlab.com/api/v4";
|
|
@@ -40007,7 +40079,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
40007
40079
|
}
|
|
40008
40080
|
async uploadFile(workspaceId, remotePath, contents, options = {}) {
|
|
40009
40081
|
const sshHost = process.env.CODEAM_GITLAB_SSH_HOST ?? "workspaces.gitlab.com";
|
|
40010
|
-
const remoteDir =
|
|
40082
|
+
const remoteDir = path81.posix.dirname(remotePath);
|
|
40011
40083
|
const parts = [`mkdir -p ${shellQuote3(remoteDir)}`, `cat > ${shellQuote3(remotePath)}`];
|
|
40012
40084
|
if (options.mode != null) {
|
|
40013
40085
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote3(remotePath)}`);
|
|
@@ -40075,7 +40147,7 @@ function shellQuote3(s) {
|
|
|
40075
40147
|
// src/services/providers/railway.ts
|
|
40076
40148
|
var import_child_process32 = require("child_process");
|
|
40077
40149
|
var import_util7 = require("util");
|
|
40078
|
-
var
|
|
40150
|
+
var path82 = __toESM(require("path"));
|
|
40079
40151
|
var execFileP9 = (0, import_util7.promisify)(import_child_process32.execFile);
|
|
40080
40152
|
var MAX_BUFFER4 = 8 * 1024 * 1024;
|
|
40081
40153
|
function resetStdinForChild4() {
|
|
@@ -40311,7 +40383,7 @@ var RailwayProvider = class {
|
|
|
40311
40383
|
if (!projectId || !serviceId) {
|
|
40312
40384
|
throw new Error("Invalid Railway workspace id (expected projectId/serviceId).");
|
|
40313
40385
|
}
|
|
40314
|
-
const remoteDir =
|
|
40386
|
+
const remoteDir = path82.posix.dirname(remotePath);
|
|
40315
40387
|
const parts = [`mkdir -p ${shellQuote4(remoteDir)}`, `cat > ${shellQuote4(remotePath)}`];
|
|
40316
40388
|
if (options.mode != null) {
|
|
40317
40389
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote4(remotePath)}`);
|
|
@@ -40957,8 +41029,8 @@ async function invite() {
|
|
|
40957
41029
|
var import_node_dns = require("dns");
|
|
40958
41030
|
var import_node_util5 = require("util");
|
|
40959
41031
|
var import_node_crypto13 = require("crypto");
|
|
40960
|
-
var
|
|
40961
|
-
var
|
|
41032
|
+
var fs74 = __toESM(require("fs"));
|
|
41033
|
+
var path83 = __toESM(require("path"));
|
|
40962
41034
|
var import_picocolors14 = __toESM(require("picocolors"));
|
|
40963
41035
|
var dnsResolveP = (0, import_node_util5.promisify)(import_node_dns.resolve);
|
|
40964
41036
|
async function checkDns(apiBase2) {
|
|
@@ -41014,13 +41086,13 @@ async function checkHealth(apiBase2) {
|
|
|
41014
41086
|
}
|
|
41015
41087
|
}
|
|
41016
41088
|
function checkConfigDir() {
|
|
41017
|
-
const dir =
|
|
41089
|
+
const dir = path83.join(require("os").homedir(), ".codeam");
|
|
41018
41090
|
try {
|
|
41019
|
-
|
|
41020
|
-
const probe =
|
|
41021
|
-
|
|
41022
|
-
const read2 =
|
|
41023
|
-
|
|
41091
|
+
fs74.mkdirSync(dir, { recursive: true, mode: 448 });
|
|
41092
|
+
const probe = path83.join(dir, ".doctor-probe");
|
|
41093
|
+
fs74.writeFileSync(probe, "ok", { mode: 384 });
|
|
41094
|
+
const read2 = fs74.readFileSync(probe, "utf8");
|
|
41095
|
+
fs74.unlinkSync(probe);
|
|
41024
41096
|
if (read2 !== "ok") throw new Error("write/read round-trip mismatch");
|
|
41025
41097
|
return {
|
|
41026
41098
|
id: "config-dir",
|
|
@@ -41060,9 +41132,9 @@ function checkSessions() {
|
|
|
41060
41132
|
}
|
|
41061
41133
|
}
|
|
41062
41134
|
function checkAgentBinaries() {
|
|
41063
|
-
const
|
|
41135
|
+
const os61 = createOsStrategy();
|
|
41064
41136
|
return getEnabledAgents().map((meta) => {
|
|
41065
|
-
const found =
|
|
41137
|
+
const found = os61.findInPath(meta.binaryName);
|
|
41066
41138
|
return {
|
|
41067
41139
|
id: `agent-${meta.id}`,
|
|
41068
41140
|
label: `Agent binary: ${meta.displayName} (${meta.binaryName})`,
|
|
@@ -41084,7 +41156,7 @@ function checkNodePty() {
|
|
|
41084
41156
|
detail: "not required on this platform"
|
|
41085
41157
|
};
|
|
41086
41158
|
}
|
|
41087
|
-
const vendoredPath =
|
|
41159
|
+
const vendoredPath = path83.join(__dirname, "vendor", "node-pty");
|
|
41088
41160
|
for (const target of [vendoredPath, "node-pty"]) {
|
|
41089
41161
|
try {
|
|
41090
41162
|
require(target);
|
|
@@ -41126,7 +41198,7 @@ function checkChokidar() {
|
|
|
41126
41198
|
}
|
|
41127
41199
|
async function doctor(args2 = []) {
|
|
41128
41200
|
const json = args2.includes("--json");
|
|
41129
|
-
const cliVersion = true ? "2.61.
|
|
41201
|
+
const cliVersion = true ? "2.61.84" : "0.0.0-dev";
|
|
41130
41202
|
const apiBase2 = resolveApiBaseUrl();
|
|
41131
41203
|
const diagnosticId = (0, import_node_crypto13.randomUUID)();
|
|
41132
41204
|
log.info("doctor", `run id=${diagnosticId} cli=${cliVersion}`);
|
|
@@ -41716,7 +41788,7 @@ async function mcpRun(args2) {
|
|
|
41716
41788
|
// src/commands/version.ts
|
|
41717
41789
|
var import_picocolors15 = __toESM(require("picocolors"));
|
|
41718
41790
|
function version2() {
|
|
41719
|
-
const v = true ? "2.61.
|
|
41791
|
+
const v = true ? "2.61.84" : "unknown";
|
|
41720
41792
|
console.log(`${import_picocolors15.default.bold("codeam-cli")} ${import_picocolors15.default.cyan(v)}`);
|
|
41721
41793
|
}
|
|
41722
41794
|
|
|
@@ -41865,10 +41937,10 @@ var EXIT_CODE_NAMES = {
|
|
|
41865
41937
|
};
|
|
41866
41938
|
|
|
41867
41939
|
// src/index.ts
|
|
41868
|
-
var
|
|
41940
|
+
var os60 = __toESM(require("os"));
|
|
41869
41941
|
if (!process.env.HOME) {
|
|
41870
41942
|
try {
|
|
41871
|
-
const home =
|
|
41943
|
+
const home = os60.homedir();
|
|
41872
41944
|
if (home) process.env.HOME = home;
|
|
41873
41945
|
} catch {
|
|
41874
41946
|
}
|