codeam-cli 2.75.21 → 2.75.23
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 +16 -0
- package/dist/index.js +299 -271
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -357,7 +357,7 @@ function defaultSpawn(timeoutMs) {
|
|
|
357
357
|
});
|
|
358
358
|
}
|
|
359
359
|
function resolveConvexBin(cwd) {
|
|
360
|
-
const local =
|
|
360
|
+
const local = path93.join(cwd, "node_modules", ".bin", process.platform === "win32" ? "convex.cmd" : "convex");
|
|
361
361
|
if (fs79.existsSync(local)) return { cmd: local, args: [] };
|
|
362
362
|
return { cmd: "npx", args: ["--yes", "convex"] };
|
|
363
363
|
}
|
|
@@ -489,13 +489,13 @@ async function runConvexAdminMcp(client3, id) {
|
|
|
489
489
|
});
|
|
490
490
|
await server.connect(new StdioServerTransport());
|
|
491
491
|
}
|
|
492
|
-
var import_node_child_process32, fs79,
|
|
492
|
+
var import_node_child_process32, fs79, path93, TOOLS;
|
|
493
493
|
var init_convex_admin_mcp = __esm({
|
|
494
494
|
"src/integrations/convex-admin-mcp.ts"() {
|
|
495
495
|
"use strict";
|
|
496
496
|
import_node_child_process32 = require("child_process");
|
|
497
497
|
fs79 = __toESM(require("fs"));
|
|
498
|
-
|
|
498
|
+
path93 = __toESM(require("path"));
|
|
499
499
|
TOOLS = [
|
|
500
500
|
{
|
|
501
501
|
name: "tables",
|
|
@@ -3525,11 +3525,11 @@ function quiet(fn) {
|
|
|
3525
3525
|
log.debug(TAG, "ignored sync error", err);
|
|
3526
3526
|
}
|
|
3527
3527
|
}
|
|
3528
|
-
function rmIfExistsQuiet(
|
|
3528
|
+
function rmIfExistsQuiet(path95) {
|
|
3529
3529
|
try {
|
|
3530
|
-
fs2.rmSync(
|
|
3530
|
+
fs2.rmSync(path95, { force: true });
|
|
3531
3531
|
} catch (err) {
|
|
3532
|
-
log.debug(TAG, `rmIfExists failed for ${
|
|
3532
|
+
log.debug(TAG, `rmIfExists failed for ${path95}`, err);
|
|
3533
3533
|
}
|
|
3534
3534
|
}
|
|
3535
3535
|
function killQuiet(target, signal = "SIGTERM") {
|
|
@@ -3733,8 +3733,8 @@ function createGetModuleFromFilename(basePath = process.argv[1] ? (0, import_pat
|
|
|
3733
3733
|
return decodedFile;
|
|
3734
3734
|
};
|
|
3735
3735
|
}
|
|
3736
|
-
function normalizeWindowsPath(
|
|
3737
|
-
return
|
|
3736
|
+
function normalizeWindowsPath(path95) {
|
|
3737
|
+
return path95.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
|
|
3738
3738
|
}
|
|
3739
3739
|
|
|
3740
3740
|
// ../../node_modules/@posthog/core/dist/error-tracking/index.mjs
|
|
@@ -6467,13 +6467,13 @@ var PostHogCoreStateless = class {
|
|
|
6467
6467
|
sentFromRoute += batchMessages.length;
|
|
6468
6468
|
}
|
|
6469
6469
|
}
|
|
6470
|
-
async _sendOtlpBatch({ path:
|
|
6470
|
+
async _sendOtlpBatch({ path: path95, payload }) {
|
|
6471
6471
|
if (this.disabled) return {
|
|
6472
6472
|
kind: "fatal",
|
|
6473
6473
|
error: new Error("The client is disabled")
|
|
6474
6474
|
};
|
|
6475
6475
|
const serialized = JSON.stringify(payload);
|
|
6476
|
-
const url2 = `${this.host}/i/v1/${
|
|
6476
|
+
const url2 = `${this.host}/i/v1/${path95}?token=${encodeURIComponent(this.apiKey)}`;
|
|
6477
6477
|
const gzippedPayload = this.disableCompression ? null : await this.compressPayload(serialized);
|
|
6478
6478
|
const fetchOptions = {
|
|
6479
6479
|
method: "POST",
|
|
@@ -7713,14 +7713,14 @@ async function addSourceContext(frames, openSourceFile = import_promises.open, l
|
|
|
7713
7713
|
LRU_FILE_CONTENTS_CACHE.reduce();
|
|
7714
7714
|
return frames;
|
|
7715
7715
|
}
|
|
7716
|
-
async function openRegularSourceFile(
|
|
7716
|
+
async function openRegularSourceFile(path95, openSourceFile, logger) {
|
|
7717
7717
|
let fileHandle;
|
|
7718
7718
|
let isValid = false;
|
|
7719
7719
|
try {
|
|
7720
|
-
fileHandle = await openSourceFile(
|
|
7720
|
+
fileHandle = await openSourceFile(path95, import_node_fs.constants.O_RDONLY | import_node_fs.constants.O_NONBLOCK);
|
|
7721
7721
|
const fileStat = await fileHandle.stat();
|
|
7722
7722
|
if (!fileStat.isFile()) return;
|
|
7723
|
-
if (fileStat.size > MAX_CONTEXTLINES_FILE_SIZE) return void logger?.debug(`Skipping source context for oversized file ${
|
|
7723
|
+
if (fileStat.size > MAX_CONTEXTLINES_FILE_SIZE) return void logger?.debug(`Skipping source context for oversized file ${path95}: ${fileStat.size} bytes exceeds ${MAX_CONTEXTLINES_FILE_SIZE}`);
|
|
7724
7724
|
isValid = true;
|
|
7725
7725
|
return fileHandle;
|
|
7726
7726
|
} catch {
|
|
@@ -7730,8 +7730,8 @@ async function openRegularSourceFile(path94, openSourceFile, logger) {
|
|
|
7730
7730
|
});
|
|
7731
7731
|
}
|
|
7732
7732
|
}
|
|
7733
|
-
async function getContextLinesFromFile(
|
|
7734
|
-
const fileHandle = await openRegularSourceFile(
|
|
7733
|
+
async function getContextLinesFromFile(path95, ranges, output, cacheKey, openSourceFile, logger) {
|
|
7734
|
+
const fileHandle = await openRegularSourceFile(path95, openSourceFile, logger);
|
|
7735
7735
|
if (void 0 === fileHandle) return void LRU_FILE_CONTENTS_FS_READ_FAILED.set(cacheKey, 1);
|
|
7736
7736
|
const openedFileHandle = fileHandle;
|
|
7737
7737
|
return new Promise((resolve12) => {
|
|
@@ -7833,22 +7833,22 @@ function clearLineContext(frame) {
|
|
|
7833
7833
|
delete frame.context_line;
|
|
7834
7834
|
delete frame.post_context;
|
|
7835
7835
|
}
|
|
7836
|
-
function shouldSkipContextLinesForFile(
|
|
7837
|
-
return
|
|
7836
|
+
function shouldSkipContextLinesForFile(path95) {
|
|
7837
|
+
return path95.startsWith("node:") || path95.endsWith(".min.js") || path95.endsWith(".min.cjs") || path95.endsWith(".min.mjs") || path95.startsWith("data:");
|
|
7838
7838
|
}
|
|
7839
7839
|
function shouldSkipContextLinesForFrame(frame) {
|
|
7840
7840
|
if (void 0 !== frame.lineno && frame.lineno > MAX_CONTEXTLINES_LINENO) return true;
|
|
7841
7841
|
if (void 0 !== frame.colno && frame.colno > MAX_CONTEXTLINES_COLNO) return true;
|
|
7842
7842
|
return false;
|
|
7843
7843
|
}
|
|
7844
|
-
function makeSourceCacheKey(
|
|
7845
|
-
if ((0, import_node_path.isAbsolute)(
|
|
7844
|
+
function makeSourceCacheKey(path95, basePath) {
|
|
7845
|
+
if ((0, import_node_path.isAbsolute)(path95)) return JSON.stringify([
|
|
7846
7846
|
null,
|
|
7847
|
-
|
|
7847
|
+
path95
|
|
7848
7848
|
]);
|
|
7849
7849
|
return void 0 === basePath ? void 0 : JSON.stringify([
|
|
7850
7850
|
basePath,
|
|
7851
|
-
|
|
7851
|
+
path95
|
|
7852
7852
|
]);
|
|
7853
7853
|
}
|
|
7854
7854
|
function rangeExistsInContentCache(cacheKey, range) {
|
|
@@ -10509,7 +10509,7 @@ function readAnonId() {
|
|
|
10509
10509
|
}
|
|
10510
10510
|
function superProperties() {
|
|
10511
10511
|
return {
|
|
10512
|
-
cliVersion: true ? "2.75.
|
|
10512
|
+
cliVersion: true ? "2.75.23" : "0.0.0-dev",
|
|
10513
10513
|
nodeVersion: process.version,
|
|
10514
10514
|
platform: process.platform,
|
|
10515
10515
|
arch: process.arch,
|
|
@@ -10751,7 +10751,7 @@ var http = __toESM(require("http"));
|
|
|
10751
10751
|
// package.json
|
|
10752
10752
|
var package_default = {
|
|
10753
10753
|
name: "codeam-cli",
|
|
10754
|
-
version: "2.75.
|
|
10754
|
+
version: "2.75.23",
|
|
10755
10755
|
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.",
|
|
10756
10756
|
type: "commonjs",
|
|
10757
10757
|
main: "dist/index.js",
|
|
@@ -12081,7 +12081,7 @@ var CommandRelayService = class _CommandRelayService {
|
|
|
12081
12081
|
// fresh + clear the "CLI update available" banner after a self-update
|
|
12082
12082
|
// (a codespace that reinstalls @latest reconnects via heartbeat, not
|
|
12083
12083
|
// pair/reconnect). Older backends ignore the extra field.
|
|
12084
|
-
..."2.75.
|
|
12084
|
+
..."2.75.23" ? { ideVersion: "2.75.23" } : {}
|
|
12085
12085
|
};
|
|
12086
12086
|
try {
|
|
12087
12087
|
const res = await _postJson(`${API_BASE2}/api/plugin/heartbeat`, body);
|
|
@@ -18038,6 +18038,7 @@ var ClaudeRuntimeStrategy = class {
|
|
|
18038
18038
|
const launch = buildClaudeLaunch(["-p", prompt], this.os);
|
|
18039
18039
|
if (!launch) return null;
|
|
18040
18040
|
return spawnAndCapture(launch.cmd, launch.args, {
|
|
18041
|
+
onStderr: opts?.onStderr,
|
|
18041
18042
|
cwd: opts?.cwd,
|
|
18042
18043
|
timeoutMs: opts?.timeoutMs
|
|
18043
18044
|
});
|
|
@@ -19124,6 +19125,7 @@ var CodexRuntimeStrategy = class {
|
|
|
19124
19125
|
if (!binary) return null;
|
|
19125
19126
|
const launch = this.os.buildLaunch(binary, ["exec", prompt]);
|
|
19126
19127
|
return spawnAndCapture(launch.cmd, launch.args, {
|
|
19128
|
+
onStderr: opts?.onStderr,
|
|
19127
19129
|
cwd: opts?.cwd,
|
|
19128
19130
|
timeoutMs: opts?.timeoutMs
|
|
19129
19131
|
});
|
|
@@ -19601,8 +19603,8 @@ function pickLine(obj) {
|
|
|
19601
19603
|
function toHunk(raw, groupSeverity) {
|
|
19602
19604
|
if (!raw || typeof raw !== "object") return null;
|
|
19603
19605
|
const o = raw;
|
|
19604
|
-
const
|
|
19605
|
-
if (!
|
|
19606
|
+
const path95 = asString(pick(o, ["file_path", "filePath", "file", "path", "filename", "fileName"])) ?? asString(pick(o, ["location"])?.path);
|
|
19607
|
+
if (!path95) return null;
|
|
19606
19608
|
const message = asString(
|
|
19607
19609
|
pick(o, [
|
|
19608
19610
|
"comment",
|
|
@@ -19619,7 +19621,7 @@ function toHunk(raw, groupSeverity) {
|
|
|
19619
19621
|
const severity = normSeverity(pick(o, ["severity", "level", "priority", "impact"])) ?? normSeverity(groupSeverity);
|
|
19620
19622
|
const locObj = pick(o, ["location"]) ?? o;
|
|
19621
19623
|
return {
|
|
19622
|
-
path:
|
|
19624
|
+
path: path95.trim(),
|
|
19623
19625
|
line: pickLine(o) ?? pickLine(locObj),
|
|
19624
19626
|
severity,
|
|
19625
19627
|
message: (title && message ? `${title}: ${message}` : title || message).trim() || "(no message)"
|
|
@@ -19702,10 +19704,10 @@ function parsePlain(stdout) {
|
|
|
19702
19704
|
for (const line of stdout.split(/\r?\n/)) {
|
|
19703
19705
|
const m = line.match(HUNK_LINE_RE);
|
|
19704
19706
|
if (!m) continue;
|
|
19705
|
-
const [,
|
|
19706
|
-
if (!
|
|
19707
|
+
const [, path95, lineNo, sevToken, message] = m;
|
|
19708
|
+
if (!path95 || !lineNo || !message) continue;
|
|
19707
19709
|
hunks.push({
|
|
19708
|
-
path:
|
|
19710
|
+
path: path95.trim(),
|
|
19709
19711
|
line: Number(lineNo),
|
|
19710
19712
|
severity: sevToken ? SEVERITY_MAP[sevToken.toLowerCase()] : void 0,
|
|
19711
19713
|
message: message.trim().replace(/^[*-]\s+/, "")
|
|
@@ -20228,6 +20230,7 @@ var CursorRuntimeStrategy = class {
|
|
|
20228
20230
|
if (!binary) return null;
|
|
20229
20231
|
const launch = this.os.buildLaunch(binary, ["--print", "--force", "--trust", prompt]);
|
|
20230
20232
|
return spawnAndCapture(launch.cmd, launch.args, {
|
|
20233
|
+
onStderr: opts?.onStderr,
|
|
20231
20234
|
cwd: opts?.cwd,
|
|
20232
20235
|
timeoutMs: opts?.timeoutMs
|
|
20233
20236
|
});
|
|
@@ -21030,6 +21033,7 @@ var GeminiRuntimeStrategy = class {
|
|
|
21030
21033
|
if (!binary) return null;
|
|
21031
21034
|
const launch = this.os.buildLaunch(binary, ["--skip-trust", "-p", prompt]);
|
|
21032
21035
|
return spawnAndCapture(launch.cmd, launch.args, {
|
|
21036
|
+
onStderr: opts?.onStderr,
|
|
21033
21037
|
cwd: opts?.cwd,
|
|
21034
21038
|
timeoutMs: opts?.timeoutMs
|
|
21035
21039
|
});
|
|
@@ -21307,6 +21311,7 @@ var KimiRuntimeStrategy = class {
|
|
|
21307
21311
|
if (!binary) return null;
|
|
21308
21312
|
const launch = this.os.buildLaunch(binary, ["-p", prompt, "--output-format", "text"]);
|
|
21309
21313
|
return spawnAndCapture(launch.cmd, launch.args, {
|
|
21314
|
+
onStderr: opts?.onStderr,
|
|
21310
21315
|
cwd: opts?.cwd,
|
|
21311
21316
|
timeoutMs: opts?.timeoutMs
|
|
21312
21317
|
});
|
|
@@ -21426,6 +21431,7 @@ var OpencodeRuntimeStrategy = class {
|
|
|
21426
21431
|
if (!binary) return null;
|
|
21427
21432
|
const launch = this.os.buildLaunch(binary, ["run", prompt]);
|
|
21428
21433
|
return spawnAndCapture(launch.cmd, launch.args, {
|
|
21434
|
+
onStderr: opts?.onStderr,
|
|
21429
21435
|
cwd: opts?.cwd,
|
|
21430
21436
|
timeoutMs: opts?.timeoutMs
|
|
21431
21437
|
});
|
|
@@ -23335,6 +23341,13 @@ function parseCloudflaredUrl(stderr) {
|
|
|
23335
23341
|
const match = stderr.match(CLOUDFLARED_URL_RE);
|
|
23336
23342
|
return match ? match[0] : null;
|
|
23337
23343
|
}
|
|
23344
|
+
function describeOneShotAgentError(stderr) {
|
|
23345
|
+
const m = /API Error:\s*(\d{3})\s+([^\n]+)/i.exec(stderr);
|
|
23346
|
+
if (!m) return null;
|
|
23347
|
+
const detail = m[2].replace(/\{.*$/, "").trim().slice(0, 240);
|
|
23348
|
+
if (!detail) return null;
|
|
23349
|
+
return `Preview detection couldn't run \u2014 the agent answered ${m[1]}: ${detail}`;
|
|
23350
|
+
}
|
|
23338
23351
|
var RAW_EXCERPT_LIMIT = 1e3;
|
|
23339
23352
|
function describeDetectionFailure(raw) {
|
|
23340
23353
|
const text = raw?.trim() ?? "";
|
|
@@ -27616,15 +27629,19 @@ var emitPreviewEvent = (args2) => {
|
|
|
27616
27629
|
var PREVIEW_DETECT_TIMEOUT_MS = 12e4;
|
|
27617
27630
|
async function runDetectOneShot(generate, timeoutMs = PREVIEW_DETECT_TIMEOUT_MS) {
|
|
27618
27631
|
let timer;
|
|
27632
|
+
let stderr = "";
|
|
27633
|
+
const onStderr = (chunk) => {
|
|
27634
|
+
stderr = (stderr + chunk).slice(-4e3);
|
|
27635
|
+
};
|
|
27619
27636
|
const deadline = new Promise((resolve12) => {
|
|
27620
|
-
timer = setTimeout(() => resolve12({ raw: null, timedOut: true }), timeoutMs);
|
|
27637
|
+
timer = setTimeout(() => resolve12({ raw: null, timedOut: true, stderr }), timeoutMs);
|
|
27621
27638
|
timer.unref?.();
|
|
27622
27639
|
});
|
|
27623
|
-
const oneShot = generate(PREVIEW_DETECT_PROMPT, { timeoutMs }).then(
|
|
27624
|
-
(raw) => ({ raw, timedOut: false }),
|
|
27640
|
+
const oneShot = generate(PREVIEW_DETECT_PROMPT, { timeoutMs, onStderr }).then(
|
|
27641
|
+
(raw) => ({ raw, timedOut: false, stderr }),
|
|
27625
27642
|
(err) => {
|
|
27626
27643
|
log.info("preview", `detect: generateOneShot threw: ${String(err)}`);
|
|
27627
|
-
return { raw: null, timedOut: false };
|
|
27644
|
+
return { raw: null, timedOut: false, stderr };
|
|
27628
27645
|
}
|
|
27629
27646
|
);
|
|
27630
27647
|
try {
|
|
@@ -27675,7 +27692,7 @@ var requestPreviewDetectH = (ctx) => {
|
|
|
27675
27692
|
});
|
|
27676
27693
|
log.info("preview", "detect: invoking generateOneShot");
|
|
27677
27694
|
const startedAt = Date.now();
|
|
27678
|
-
const { raw, timedOut } = await runDetectOneShot(generateOneShot);
|
|
27695
|
+
const { raw, timedOut, stderr } = await runDetectOneShot(generateOneShot);
|
|
27679
27696
|
const tookMs = Date.now() - startedAt;
|
|
27680
27697
|
if (timedOut) {
|
|
27681
27698
|
log.info("preview", `detect: timed out after ${tookMs}ms \u2014 emitting preview_error`);
|
|
@@ -27709,7 +27726,7 @@ ${failure?.rawExcerpt ?? ""}`
|
|
|
27709
27726
|
stage: "detection",
|
|
27710
27727
|
// El mensaje sale del diagnostico: decir "JSON invalido" cuando el
|
|
27711
27728
|
// agente no contesto manda al usuario a mirar un JSON que no existe.
|
|
27712
|
-
message: failure?.message ?? "Agent returned invalid JSON. Try again, or add a .codeam/preview.json override."
|
|
27729
|
+
message: (failure?.reason === "no_output" ? describeOneShotAgentError(stderr) : null) ?? failure?.message ?? "Agent returned invalid JSON. Try again, or add a .codeam/preview.json override."
|
|
27713
27730
|
}
|
|
27714
27731
|
});
|
|
27715
27732
|
return;
|
|
@@ -28266,11 +28283,11 @@ function resolveTokenValue(args2) {
|
|
|
28266
28283
|
}
|
|
28267
28284
|
const fileFlag = args2.find((a) => a.startsWith("--token-file="));
|
|
28268
28285
|
if (fileFlag) {
|
|
28269
|
-
const
|
|
28286
|
+
const path95 = fileFlag.slice("--token-file=".length);
|
|
28270
28287
|
try {
|
|
28271
|
-
const content = fs51.readFileSync(
|
|
28272
|
-
if (content.length === 0) fail(`--token-file ${
|
|
28273
|
-
rmIfExistsQuiet(
|
|
28288
|
+
const content = fs51.readFileSync(path95, "utf8").trim();
|
|
28289
|
+
if (content.length === 0) fail(`--token-file ${path95} is empty`);
|
|
28290
|
+
rmIfExistsQuiet(path95);
|
|
28274
28291
|
return content;
|
|
28275
28292
|
} catch (err) {
|
|
28276
28293
|
fail(`Could not read --token-file: ${err.message}`);
|
|
@@ -29204,9 +29221,9 @@ async function resolveAcpAdapterWithRetry(agent, opts = {}) {
|
|
|
29204
29221
|
|
|
29205
29222
|
// src/agents/acp/runner.ts
|
|
29206
29223
|
var import_node_crypto10 = require("crypto");
|
|
29207
|
-
var
|
|
29208
|
-
var
|
|
29209
|
-
var
|
|
29224
|
+
var fs68 = __toESM(require("fs"));
|
|
29225
|
+
var os53 = __toESM(require("os"));
|
|
29226
|
+
var path79 = __toESM(require("path"));
|
|
29210
29227
|
|
|
29211
29228
|
// src/lib/provider-routing.ts
|
|
29212
29229
|
var fs53 = __toESM(require("fs"));
|
|
@@ -35913,6 +35930,116 @@ function provisionAgentCredentials(publicAgentId, auth, homeDir2 = os47.homedir(
|
|
|
35913
35930
|
return provisioner.write(auth, homeDir2);
|
|
35914
35931
|
}
|
|
35915
35932
|
|
|
35933
|
+
// src/beads/workflow-hint.ts
|
|
35934
|
+
var fs57 = __toESM(require("fs"));
|
|
35935
|
+
var path68 = __toESM(require("path"));
|
|
35936
|
+
|
|
35937
|
+
// src/agents/claude-memory-file.ts
|
|
35938
|
+
var os48 = __toESM(require("os"));
|
|
35939
|
+
var path67 = __toESM(require("path"));
|
|
35940
|
+
function claudeMemoryFile(homeDir2, env = process.env) {
|
|
35941
|
+
if (homeDir2) return path67.join(homeDir2, ".claude", "CLAUDE.md");
|
|
35942
|
+
const configDir = env.CLAUDE_CONFIG_DIR?.trim();
|
|
35943
|
+
return configDir ? path67.join(configDir, "CLAUDE.md") : path67.join(os48.homedir(), ".claude", "CLAUDE.md");
|
|
35944
|
+
}
|
|
35945
|
+
|
|
35946
|
+
// src/beads/workflow-hint.ts
|
|
35947
|
+
var BEADS_HINT_MARKER = "<!-- codeam:beads-workflow -->";
|
|
35948
|
+
var BEADS_HINT = `${BEADS_HINT_MARKER}
|
|
35949
|
+
# Beads (bd) \u2014 task tracking + persistent memory (ALWAYS use it)
|
|
35950
|
+
|
|
35951
|
+
This environment uses **bd (beads)** for issue/task tracking and persistent memory.
|
|
35952
|
+
|
|
35953
|
+
- Use \`bd\` for ALL task tracking \u2014 do NOT use TodoWrite or markdown TODO lists.
|
|
35954
|
+
- Run \`bd prime\` (via your shell tool, once) when you start working on a task, for
|
|
35955
|
+
the full workflow context + project memories. Not needed to answer a greeting or
|
|
35956
|
+
a quick question. On a fresh session beads may still be provisioning for a few
|
|
35957
|
+
seconds \u2014 if \`bd prime\` comes back empty, retry it shortly; it works once the
|
|
35958
|
+
shared server is up.
|
|
35959
|
+
- \`bd ready\` (available work) \xB7 \`bd show <id>\` \xB7 \`bd update <id> --claim\` \xB7 \`bd close <id>\`.
|
|
35960
|
+
- Use \`bd remember "..."\` for persistent knowledge \u2014 do NOT use MEMORY.md files.
|
|
35961
|
+
- Run \`bd\` commands through your shell tool and summarize the outcome. Never
|
|
35962
|
+
paste \`bd\` commands or their raw output into your reply.
|
|
35963
|
+
- CodeAgent installs, starts and repairs beads \u2014 not you. If a \`bd\` command
|
|
35964
|
+
fails, carry on with the user's task without task tracking and try \`bd\`
|
|
35965
|
+
again later. Never run \`bd init\`, \`bd bootstrap\`, \`bd doctor --fix\` or
|
|
35966
|
+
\`dolt\` commands yourself: they race the provisioning and can wipe the
|
|
35967
|
+
project's issues.
|
|
35968
|
+
${BEADS_HINT_MARKER}`;
|
|
35969
|
+
function ensureBeadsWorkflowHint(homeDir2, file = claudeMemoryFile(homeDir2)) {
|
|
35970
|
+
try {
|
|
35971
|
+
let existing = "";
|
|
35972
|
+
try {
|
|
35973
|
+
existing = fs57.readFileSync(file, "utf8");
|
|
35974
|
+
} catch {
|
|
35975
|
+
}
|
|
35976
|
+
if (existing.includes(BEADS_HINT)) return;
|
|
35977
|
+
fs57.mkdirSync(path68.dirname(file), { recursive: true });
|
|
35978
|
+
let next;
|
|
35979
|
+
const open = existing.indexOf(BEADS_HINT_MARKER);
|
|
35980
|
+
const close = open === -1 ? -1 : existing.indexOf(BEADS_HINT_MARKER, open + BEADS_HINT_MARKER.length);
|
|
35981
|
+
if (open !== -1 && close !== -1) {
|
|
35982
|
+
next = existing.slice(0, open) + BEADS_HINT + existing.slice(close + BEADS_HINT_MARKER.length);
|
|
35983
|
+
} else {
|
|
35984
|
+
next = existing.trim() ? `${existing.trimEnd()}
|
|
35985
|
+
|
|
35986
|
+
${BEADS_HINT}
|
|
35987
|
+
` : `${BEADS_HINT}
|
|
35988
|
+
`;
|
|
35989
|
+
}
|
|
35990
|
+
fs57.writeFileSync(file, next);
|
|
35991
|
+
} catch {
|
|
35992
|
+
}
|
|
35993
|
+
}
|
|
35994
|
+
|
|
35995
|
+
// src/agents/agent-standard.ts
|
|
35996
|
+
var fs58 = __toESM(require("fs"));
|
|
35997
|
+
var path69 = __toESM(require("path"));
|
|
35998
|
+
var os49 = __toESM(require("os"));
|
|
35999
|
+
function ensureAgentStandard(homeDir2, file = claudeMemoryFile(homeDir2)) {
|
|
36000
|
+
try {
|
|
36001
|
+
let existing = "";
|
|
36002
|
+
try {
|
|
36003
|
+
existing = fs58.readFileSync(file, "utf8");
|
|
36004
|
+
} catch {
|
|
36005
|
+
}
|
|
36006
|
+
if (existing.includes(AGENT_STANDARD_MARKER)) return;
|
|
36007
|
+
fs58.mkdirSync(path69.dirname(file), { recursive: true });
|
|
36008
|
+
const next = existing.trim() ? `${existing.trimEnd()}
|
|
36009
|
+
|
|
36010
|
+
${AGENT_STANDARD_BLOCK}
|
|
36011
|
+
` : `${AGENT_STANDARD_BLOCK}
|
|
36012
|
+
`;
|
|
36013
|
+
fs58.writeFileSync(file, next);
|
|
36014
|
+
} catch {
|
|
36015
|
+
}
|
|
36016
|
+
}
|
|
36017
|
+
var _agentStandardSeam = {
|
|
36018
|
+
isLocalSession: () => isLocalSession(),
|
|
36019
|
+
markerPath: (sessionId) => path69.join(os49.homedir(), ".codeam", "agent-standard", `${sessionId}.done`),
|
|
36020
|
+
exists: (p2) => fs58.existsSync(p2),
|
|
36021
|
+
write: (p2) => {
|
|
36022
|
+
fs58.mkdirSync(path69.dirname(p2), { recursive: true });
|
|
36023
|
+
fs58.writeFileSync(p2, "");
|
|
36024
|
+
}
|
|
36025
|
+
};
|
|
36026
|
+
function isClaude(agent) {
|
|
36027
|
+
return agent === "claude" || agent === "claude_code";
|
|
36028
|
+
}
|
|
36029
|
+
function maybePrefaceAgentStandard(blocks, agent, sessionId, seam = _agentStandardSeam) {
|
|
36030
|
+
if (seam.isLocalSession()) return;
|
|
36031
|
+
if (isClaude(agent)) return;
|
|
36032
|
+
if (!sessionId) return;
|
|
36033
|
+
const marker = seam.markerPath(sessionId);
|
|
36034
|
+
try {
|
|
36035
|
+
if (seam.exists(marker)) return;
|
|
36036
|
+
seam.write(marker);
|
|
36037
|
+
} catch {
|
|
36038
|
+
return;
|
|
36039
|
+
}
|
|
36040
|
+
blocks.unshift({ type: "text", text: AGENT_STANDARD_TEXT });
|
|
36041
|
+
}
|
|
36042
|
+
|
|
35916
36043
|
// src/services/streaming/transport.ts
|
|
35917
36044
|
var http10 = __toESM(require("http"));
|
|
35918
36045
|
var https7 = __toESM(require("https"));
|
|
@@ -36586,15 +36713,15 @@ function withholdTrailingPartialFenceMarker(text) {
|
|
|
36586
36713
|
|
|
36587
36714
|
// src/agents/acp/onboarding.ts
|
|
36588
36715
|
var import_child_process28 = require("child_process");
|
|
36589
|
-
var
|
|
36590
|
-
var
|
|
36591
|
-
var
|
|
36716
|
+
var fs59 = __toESM(require("fs"));
|
|
36717
|
+
var os50 = __toESM(require("os"));
|
|
36718
|
+
var path70 = __toESM(require("path"));
|
|
36592
36719
|
var _onboardingSeam = {
|
|
36593
|
-
markerPath: (sessionId) =>
|
|
36594
|
-
exists: (p2) =>
|
|
36720
|
+
markerPath: (sessionId) => path70.join(os50.homedir(), ".codeam", "welcomed", `${sessionId}.done`),
|
|
36721
|
+
exists: (p2) => fs59.existsSync(p2),
|
|
36595
36722
|
write: (p2) => {
|
|
36596
|
-
|
|
36597
|
-
|
|
36723
|
+
fs59.mkdirSync(path70.dirname(p2), { recursive: true });
|
|
36724
|
+
fs59.writeFileSync(p2, "");
|
|
36598
36725
|
},
|
|
36599
36726
|
disabled: () => {
|
|
36600
36727
|
const v = process.env.CODEAM_ONBOARDING_DISABLED;
|
|
@@ -36631,7 +36758,7 @@ function resolveRepoName(cwd) {
|
|
|
36631
36758
|
if (name) return name;
|
|
36632
36759
|
}
|
|
36633
36760
|
}
|
|
36634
|
-
const base =
|
|
36761
|
+
const base = path70.basename(cwd || "");
|
|
36635
36762
|
if (base && !isUuid(base)) return base;
|
|
36636
36763
|
return "this project";
|
|
36637
36764
|
}
|
|
@@ -37023,13 +37150,13 @@ var import_crypto4 = require("crypto");
|
|
|
37023
37150
|
|
|
37024
37151
|
// src/services/turn-files/git-changeset.ts
|
|
37025
37152
|
var import_child_process29 = require("child_process");
|
|
37026
|
-
var
|
|
37027
|
-
var
|
|
37153
|
+
var fs61 = __toESM(require("fs/promises"));
|
|
37154
|
+
var path72 = __toESM(require("path"));
|
|
37028
37155
|
|
|
37029
37156
|
// src/services/turn-files/review-ignore.ts
|
|
37030
37157
|
var import_ignore2 = __toESM(require("ignore"));
|
|
37031
|
-
var
|
|
37032
|
-
var
|
|
37158
|
+
var fs60 = __toESM(require("fs"));
|
|
37159
|
+
var path71 = __toESM(require("path"));
|
|
37033
37160
|
var CURATED_REVIEW_IGNORE = [
|
|
37034
37161
|
// Google Cloud SDK (the incident) — installs a huge python tree.
|
|
37035
37162
|
"google-cloud-sdk/",
|
|
@@ -37068,7 +37195,7 @@ var CURATED_REVIEW_IGNORE = [
|
|
|
37068
37195
|
function makeReviewIgnore(repoRoot) {
|
|
37069
37196
|
const ig = (0, import_ignore2.default)().add(CURATED_REVIEW_IGNORE);
|
|
37070
37197
|
try {
|
|
37071
|
-
const custom =
|
|
37198
|
+
const custom = fs60.readFileSync(path71.join(repoRoot, ".codeam", "reviewignore"), "utf8");
|
|
37072
37199
|
ig.add(custom);
|
|
37073
37200
|
} catch {
|
|
37074
37201
|
}
|
|
@@ -37113,7 +37240,7 @@ async function collectRepoChangeset(opts) {
|
|
|
37113
37240
|
let stats;
|
|
37114
37241
|
if (!truncated && row.fileStatus === "added" && numstatEntry === void 0) {
|
|
37115
37242
|
const lineCount = await readUntrackedLineCount(
|
|
37116
|
-
|
|
37243
|
+
path72.join(opts.repoRoot, row.filePath)
|
|
37117
37244
|
);
|
|
37118
37245
|
stats = { added: lineCount, removed: 0 };
|
|
37119
37246
|
} else {
|
|
@@ -37144,7 +37271,7 @@ function readUntrackedLineCount(absPath) {
|
|
|
37144
37271
|
}
|
|
37145
37272
|
async function defaultReadUntrackedLineCount(absPath) {
|
|
37146
37273
|
try {
|
|
37147
|
-
const content = await
|
|
37274
|
+
const content = await fs61.readFile(absPath, "utf8");
|
|
37148
37275
|
let count = 0;
|
|
37149
37276
|
let pos = -1;
|
|
37150
37277
|
while ((pos = content.indexOf("\n", pos + 1)) !== -1) {
|
|
@@ -37255,8 +37382,8 @@ async function discoverRepos(workingDir, maxDepth = 4) {
|
|
|
37255
37382
|
if (hasGit) {
|
|
37256
37383
|
out2.push({
|
|
37257
37384
|
repoRoot: dir,
|
|
37258
|
-
repoPath:
|
|
37259
|
-
repoName:
|
|
37385
|
+
repoPath: path72.relative(workingDir, dir),
|
|
37386
|
+
repoName: path72.basename(dir)
|
|
37260
37387
|
});
|
|
37261
37388
|
return;
|
|
37262
37389
|
}
|
|
@@ -37264,14 +37391,14 @@ async function discoverRepos(workingDir, maxDepth = 4) {
|
|
|
37264
37391
|
if (!entry.isDirectory) continue;
|
|
37265
37392
|
if (entry.name === "node_modules") continue;
|
|
37266
37393
|
if (entry.name === "dist" || entry.name === "build") continue;
|
|
37267
|
-
await walk(
|
|
37394
|
+
await walk(path72.join(dir, entry.name), depth + 1);
|
|
37268
37395
|
}
|
|
37269
37396
|
}
|
|
37270
37397
|
}
|
|
37271
37398
|
|
|
37272
37399
|
// src/services/turn-files/files-outbox.ts
|
|
37273
|
-
var
|
|
37274
|
-
var
|
|
37400
|
+
var fs62 = __toESM(require("fs/promises"));
|
|
37401
|
+
var path73 = __toESM(require("path"));
|
|
37275
37402
|
var import_os12 = require("os");
|
|
37276
37403
|
var HOME_OUTBOX_DIR = ".codeam/outbox";
|
|
37277
37404
|
var MAX_AGE_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -37304,16 +37431,16 @@ var FilesOutbox = class {
|
|
|
37304
37431
|
backoffIndex = 0;
|
|
37305
37432
|
stopped = false;
|
|
37306
37433
|
constructor(opts) {
|
|
37307
|
-
const base = opts.baseDir ??
|
|
37308
|
-
this.filePath =
|
|
37434
|
+
const base = opts.baseDir ?? path73.join(homeDir(), HOME_OUTBOX_DIR);
|
|
37435
|
+
this.filePath = path73.join(base, `${opts.sessionId}.jsonl`);
|
|
37309
37436
|
this.post = opts.post;
|
|
37310
37437
|
this.autoSchedule = opts.autoSchedule !== false;
|
|
37311
37438
|
}
|
|
37312
37439
|
/** Persist the entry to disk and trigger a flush. Returns once the
|
|
37313
37440
|
* line is durable on disk (not once the POST succeeds). */
|
|
37314
37441
|
async enqueue(entry) {
|
|
37315
|
-
await
|
|
37316
|
-
await
|
|
37442
|
+
await fs62.mkdir(path73.dirname(this.filePath), { recursive: true });
|
|
37443
|
+
await fs62.appendFile(this.filePath, JSON.stringify(entry) + "\n", "utf8");
|
|
37317
37444
|
this.backoffIndex = 0;
|
|
37318
37445
|
if (this.autoSchedule) this.scheduleFlush(0);
|
|
37319
37446
|
}
|
|
@@ -37404,7 +37531,7 @@ var FilesOutbox = class {
|
|
|
37404
37531
|
async readAll() {
|
|
37405
37532
|
let raw = "";
|
|
37406
37533
|
try {
|
|
37407
|
-
raw = await
|
|
37534
|
+
raw = await fs62.readFile(this.filePath, "utf8");
|
|
37408
37535
|
} catch {
|
|
37409
37536
|
return [];
|
|
37410
37537
|
}
|
|
@@ -37428,12 +37555,12 @@ var FilesOutbox = class {
|
|
|
37428
37555
|
async rewrite(entries) {
|
|
37429
37556
|
const tmpPath = `${this.filePath}.${process.pid}.tmp`;
|
|
37430
37557
|
if (entries.length === 0) {
|
|
37431
|
-
await
|
|
37558
|
+
await fs62.unlink(this.filePath).catch(() => void 0);
|
|
37432
37559
|
return;
|
|
37433
37560
|
}
|
|
37434
37561
|
const payload = entries.map((e) => JSON.stringify(e)).join("\n") + "\n";
|
|
37435
|
-
await
|
|
37436
|
-
await
|
|
37562
|
+
await fs62.writeFile(tmpPath, payload, "utf8");
|
|
37563
|
+
await fs62.rename(tmpPath, this.filePath);
|
|
37437
37564
|
}
|
|
37438
37565
|
};
|
|
37439
37566
|
function applyJitter(ms) {
|
|
@@ -37981,8 +38108,8 @@ async function postCredentialSync(opts, fetchImpl = fetch) {
|
|
|
37981
38108
|
|
|
37982
38109
|
// src/packs/gates.ts
|
|
37983
38110
|
var import_node_child_process22 = require("child_process");
|
|
37984
|
-
var
|
|
37985
|
-
var
|
|
38111
|
+
var fs63 = __toESM(require("fs"));
|
|
38112
|
+
var path74 = __toESM(require("path"));
|
|
37986
38113
|
var defaultCommandRunner = (file, args2, cwd, timeoutMs, env) => new Promise((resolve12) => {
|
|
37987
38114
|
(0, import_node_child_process22.execFile)(
|
|
37988
38115
|
file,
|
|
@@ -38032,7 +38159,7 @@ async function changedFiles(run, cwd, from, to) {
|
|
|
38032
38159
|
}
|
|
38033
38160
|
function readWorkspaceFile(cwd, relPath) {
|
|
38034
38161
|
try {
|
|
38035
|
-
return
|
|
38162
|
+
return fs63.readFileSync(path74.join(cwd, relPath), "utf8");
|
|
38036
38163
|
} catch {
|
|
38037
38164
|
return null;
|
|
38038
38165
|
}
|
|
@@ -38041,14 +38168,14 @@ var NO_TEST_PLACEHOLDER = 'echo "Error: no test specified"';
|
|
|
38041
38168
|
var CHECKS_TIMEOUT_MS = 5 * 6e4;
|
|
38042
38169
|
function detectChecksCommand(cwd) {
|
|
38043
38170
|
try {
|
|
38044
|
-
const cfg = JSON.parse(
|
|
38171
|
+
const cfg = JSON.parse(fs63.readFileSync(path74.join(cwd, ".codeam", "pack.json"), "utf8"));
|
|
38045
38172
|
if (typeof cfg.checksCommand === "string" && cfg.checksCommand.trim().length > 0) {
|
|
38046
38173
|
return cfg.checksCommand.trim();
|
|
38047
38174
|
}
|
|
38048
38175
|
} catch {
|
|
38049
38176
|
}
|
|
38050
38177
|
try {
|
|
38051
|
-
const pkg = JSON.parse(
|
|
38178
|
+
const pkg = JSON.parse(fs63.readFileSync(path74.join(cwd, "package.json"), "utf8"));
|
|
38052
38179
|
const test = pkg.scripts?.test;
|
|
38053
38180
|
if (typeof test === "string" && test.trim().length > 0 && !test.includes(NO_TEST_PLACEHOLDER)) {
|
|
38054
38181
|
return "npm test";
|
|
@@ -38066,39 +38193,39 @@ ${res.stderr}`.trim();
|
|
|
38066
38193
|
}
|
|
38067
38194
|
|
|
38068
38195
|
// src/packs/run-store.ts
|
|
38069
|
-
var
|
|
38070
|
-
var
|
|
38196
|
+
var fs64 = __toESM(require("fs"));
|
|
38197
|
+
var path75 = __toESM(require("path"));
|
|
38071
38198
|
var crypto5 = __toESM(require("crypto"));
|
|
38072
38199
|
function packsDir(cwd) {
|
|
38073
|
-
return
|
|
38200
|
+
return path75.join(cwd, ".codeam", "packs");
|
|
38074
38201
|
}
|
|
38075
38202
|
function runDir(cwd, runId) {
|
|
38076
|
-
return
|
|
38203
|
+
return path75.join(packsDir(cwd), runId);
|
|
38077
38204
|
}
|
|
38078
38205
|
function newRunId() {
|
|
38079
38206
|
return `pk_${Date.now().toString(36)}_${crypto5.randomBytes(4).toString("hex")}`;
|
|
38080
38207
|
}
|
|
38081
38208
|
function writeJsonAtomic(file, value) {
|
|
38082
|
-
|
|
38209
|
+
fs64.mkdirSync(path75.dirname(file), { recursive: true });
|
|
38083
38210
|
const tmp = `${file}.tmp`;
|
|
38084
|
-
|
|
38085
|
-
|
|
38211
|
+
fs64.writeFileSync(tmp, JSON.stringify(value, null, 2));
|
|
38212
|
+
fs64.renameSync(tmp, file);
|
|
38086
38213
|
}
|
|
38087
38214
|
function saveRun(cwd, state) {
|
|
38088
|
-
writeJsonAtomic(
|
|
38215
|
+
writeJsonAtomic(path75.join(runDir(cwd, state.runId), "run.json"), state);
|
|
38089
38216
|
}
|
|
38090
38217
|
function saveStageHandoff(cwd, runId, stageIndex, role, handoff) {
|
|
38091
38218
|
const name = `${String(stageIndex + 1).padStart(2, "0")}-${role}.json`;
|
|
38092
|
-
writeJsonAtomic(
|
|
38219
|
+
writeJsonAtomic(path75.join(runDir(cwd, runId), name), handoff);
|
|
38093
38220
|
}
|
|
38094
38221
|
function loadLatestRun(cwd) {
|
|
38095
38222
|
try {
|
|
38096
38223
|
const dir = packsDir(cwd);
|
|
38097
|
-
const entries =
|
|
38224
|
+
const entries = fs64.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name).sort();
|
|
38098
38225
|
for (let i = entries.length - 1; i >= 0; i--) {
|
|
38099
|
-
const file =
|
|
38226
|
+
const file = path75.join(dir, entries[i], "run.json");
|
|
38100
38227
|
try {
|
|
38101
|
-
const parsed = JSON.parse(
|
|
38228
|
+
const parsed = JSON.parse(fs64.readFileSync(file, "utf8"));
|
|
38102
38229
|
if (parsed && typeof parsed.runId === "string") return parsed;
|
|
38103
38230
|
} catch {
|
|
38104
38231
|
}
|
|
@@ -38109,17 +38236,17 @@ function loadLatestRun(cwd) {
|
|
|
38109
38236
|
}
|
|
38110
38237
|
function ensureLedgerIgnored(cwd) {
|
|
38111
38238
|
try {
|
|
38112
|
-
const gitDir =
|
|
38113
|
-
if (!
|
|
38114
|
-
const exclude =
|
|
38239
|
+
const gitDir = path75.join(cwd, ".git");
|
|
38240
|
+
if (!fs64.existsSync(gitDir)) return;
|
|
38241
|
+
const exclude = path75.join(gitDir, "info", "exclude");
|
|
38115
38242
|
let existing = "";
|
|
38116
38243
|
try {
|
|
38117
|
-
existing =
|
|
38244
|
+
existing = fs64.readFileSync(exclude, "utf8");
|
|
38118
38245
|
} catch {
|
|
38119
38246
|
}
|
|
38120
38247
|
if (existing.includes(".codeam/packs/")) return;
|
|
38121
|
-
|
|
38122
|
-
|
|
38248
|
+
fs64.mkdirSync(path75.dirname(exclude), { recursive: true });
|
|
38249
|
+
fs64.writeFileSync(exclude, `${existing.trimEnd()}
|
|
38123
38250
|
.codeam/packs/
|
|
38124
38251
|
`.trimStart());
|
|
38125
38252
|
} catch {
|
|
@@ -39459,55 +39586,6 @@ function buildAcpPromptBlocks(payload) {
|
|
|
39459
39586
|
return blocks;
|
|
39460
39587
|
}
|
|
39461
39588
|
|
|
39462
|
-
// src/agents/agent-standard.ts
|
|
39463
|
-
var fs66 = __toESM(require("fs"));
|
|
39464
|
-
var path76 = __toESM(require("path"));
|
|
39465
|
-
var os51 = __toESM(require("os"));
|
|
39466
|
-
function ensureAgentStandard(homeDir2 = os51.homedir()) {
|
|
39467
|
-
try {
|
|
39468
|
-
const file = path76.join(homeDir2, ".claude", "CLAUDE.md");
|
|
39469
|
-
let existing = "";
|
|
39470
|
-
try {
|
|
39471
|
-
existing = fs66.readFileSync(file, "utf8");
|
|
39472
|
-
} catch {
|
|
39473
|
-
}
|
|
39474
|
-
if (existing.includes(AGENT_STANDARD_MARKER)) return;
|
|
39475
|
-
fs66.mkdirSync(path76.dirname(file), { recursive: true });
|
|
39476
|
-
const next = existing.trim() ? `${existing.trimEnd()}
|
|
39477
|
-
|
|
39478
|
-
${AGENT_STANDARD_BLOCK}
|
|
39479
|
-
` : `${AGENT_STANDARD_BLOCK}
|
|
39480
|
-
`;
|
|
39481
|
-
fs66.writeFileSync(file, next);
|
|
39482
|
-
} catch {
|
|
39483
|
-
}
|
|
39484
|
-
}
|
|
39485
|
-
var _agentStandardSeam = {
|
|
39486
|
-
isLocalSession: () => isLocalSession(),
|
|
39487
|
-
markerPath: (sessionId) => path76.join(os51.homedir(), ".codeam", "agent-standard", `${sessionId}.done`),
|
|
39488
|
-
exists: (p2) => fs66.existsSync(p2),
|
|
39489
|
-
write: (p2) => {
|
|
39490
|
-
fs66.mkdirSync(path76.dirname(p2), { recursive: true });
|
|
39491
|
-
fs66.writeFileSync(p2, "");
|
|
39492
|
-
}
|
|
39493
|
-
};
|
|
39494
|
-
function isClaude(agent) {
|
|
39495
|
-
return agent === "claude" || agent === "claude_code";
|
|
39496
|
-
}
|
|
39497
|
-
function maybePrefaceAgentStandard(blocks, agent, sessionId, seam = _agentStandardSeam) {
|
|
39498
|
-
if (seam.isLocalSession()) return;
|
|
39499
|
-
if (isClaude(agent)) return;
|
|
39500
|
-
if (!sessionId) return;
|
|
39501
|
-
const marker = seam.markerPath(sessionId);
|
|
39502
|
-
try {
|
|
39503
|
-
if (seam.exists(marker)) return;
|
|
39504
|
-
seam.write(marker);
|
|
39505
|
-
} catch {
|
|
39506
|
-
return;
|
|
39507
|
-
}
|
|
39508
|
-
blocks.unshift({ type: "text", text: AGENT_STANDARD_TEXT });
|
|
39509
|
-
}
|
|
39510
|
-
|
|
39511
39589
|
// src/agents/acp/promptEcho.ts
|
|
39512
39590
|
var MAX_PROMPT_CHARS = 200;
|
|
39513
39591
|
var MAX_AGENT_REPLY_CHARS = 280;
|
|
@@ -41645,16 +41723,19 @@ async function runAcpSession(opts) {
|
|
|
41645
41723
|
switchCredentialEnv = provisionAgentCredentials(agentId, auth);
|
|
41646
41724
|
},
|
|
41647
41725
|
provisionHouseProxy: ({ baseUrl, token, model, managedAgentId }) => {
|
|
41648
|
-
const claudeConfigDir =
|
|
41649
|
-
|
|
41726
|
+
const claudeConfigDir = path79.join(
|
|
41727
|
+
os53.homedir(),
|
|
41650
41728
|
".codeam",
|
|
41651
41729
|
"house-claude",
|
|
41652
41730
|
`switch-${opts.pluginId}`
|
|
41653
41731
|
);
|
|
41654
41732
|
try {
|
|
41655
|
-
|
|
41733
|
+
fs68.mkdirSync(claudeConfigDir, { recursive: true, mode: 448 });
|
|
41656
41734
|
} catch {
|
|
41657
41735
|
}
|
|
41736
|
+
const memoryFile = path79.join(claudeConfigDir, "CLAUDE.md");
|
|
41737
|
+
ensureBeadsWorkflowHint(void 0, memoryFile);
|
|
41738
|
+
ensureAgentStandard(void 0, memoryFile);
|
|
41658
41739
|
const cfg = {
|
|
41659
41740
|
baseUrl,
|
|
41660
41741
|
token,
|
|
@@ -42860,59 +42941,6 @@ function startClaudeCredentialSync(opts) {
|
|
|
42860
42941
|
};
|
|
42861
42942
|
}
|
|
42862
42943
|
|
|
42863
|
-
// src/beads/workflow-hint.ts
|
|
42864
|
-
var fs68 = __toESM(require("fs"));
|
|
42865
|
-
var path78 = __toESM(require("path"));
|
|
42866
|
-
var os53 = __toESM(require("os"));
|
|
42867
|
-
var BEADS_HINT_MARKER = "<!-- codeam:beads-workflow -->";
|
|
42868
|
-
var BEADS_HINT = `${BEADS_HINT_MARKER}
|
|
42869
|
-
# Beads (bd) \u2014 task tracking + persistent memory (ALWAYS use it)
|
|
42870
|
-
|
|
42871
|
-
This environment uses **bd (beads)** for issue/task tracking and persistent memory.
|
|
42872
|
-
|
|
42873
|
-
- Use \`bd\` for ALL task tracking \u2014 do NOT use TodoWrite or markdown TODO lists.
|
|
42874
|
-
- Run \`bd prime\` (via your shell tool, once) when you start working on a task, for
|
|
42875
|
-
the full workflow context + project memories. Not needed to answer a greeting or
|
|
42876
|
-
a quick question. On a fresh session beads may still be provisioning for a few
|
|
42877
|
-
seconds \u2014 if \`bd prime\` comes back empty, retry it shortly; it works once the
|
|
42878
|
-
shared server is up.
|
|
42879
|
-
- \`bd ready\` (available work) \xB7 \`bd show <id>\` \xB7 \`bd update <id> --claim\` \xB7 \`bd close <id>\`.
|
|
42880
|
-
- Use \`bd remember "..."\` for persistent knowledge \u2014 do NOT use MEMORY.md files.
|
|
42881
|
-
- Run \`bd\` commands through your shell tool and summarize the outcome. Never
|
|
42882
|
-
paste \`bd\` commands or their raw output into your reply.
|
|
42883
|
-
- CodeAgent installs, starts and repairs beads \u2014 not you. If a \`bd\` command
|
|
42884
|
-
fails, carry on with the user's task without task tracking and try \`bd\`
|
|
42885
|
-
again later. Never run \`bd init\`, \`bd bootstrap\`, \`bd doctor --fix\` or
|
|
42886
|
-
\`dolt\` commands yourself: they race the provisioning and can wipe the
|
|
42887
|
-
project's issues.
|
|
42888
|
-
${BEADS_HINT_MARKER}`;
|
|
42889
|
-
function ensureBeadsWorkflowHint(homeDir2 = os53.homedir()) {
|
|
42890
|
-
try {
|
|
42891
|
-
const file = path78.join(homeDir2, ".claude", "CLAUDE.md");
|
|
42892
|
-
let existing = "";
|
|
42893
|
-
try {
|
|
42894
|
-
existing = fs68.readFileSync(file, "utf8");
|
|
42895
|
-
} catch {
|
|
42896
|
-
}
|
|
42897
|
-
if (existing.includes(BEADS_HINT)) return;
|
|
42898
|
-
fs68.mkdirSync(path78.dirname(file), { recursive: true });
|
|
42899
|
-
let next;
|
|
42900
|
-
const open = existing.indexOf(BEADS_HINT_MARKER);
|
|
42901
|
-
const close = open === -1 ? -1 : existing.indexOf(BEADS_HINT_MARKER, open + BEADS_HINT_MARKER.length);
|
|
42902
|
-
if (open !== -1 && close !== -1) {
|
|
42903
|
-
next = existing.slice(0, open) + BEADS_HINT + existing.slice(close + BEADS_HINT_MARKER.length);
|
|
42904
|
-
} else {
|
|
42905
|
-
next = existing.trim() ? `${existing.trimEnd()}
|
|
42906
|
-
|
|
42907
|
-
${BEADS_HINT}
|
|
42908
|
-
` : `${BEADS_HINT}
|
|
42909
|
-
`;
|
|
42910
|
-
}
|
|
42911
|
-
fs68.writeFileSync(file, next);
|
|
42912
|
-
} catch {
|
|
42913
|
-
}
|
|
42914
|
-
}
|
|
42915
|
-
|
|
42916
42944
|
// src/commands/start/pick-session.ts
|
|
42917
42945
|
function pickPinnedSession(pinnedId, listSessions2) {
|
|
42918
42946
|
const id = pinnedId?.trim();
|
|
@@ -42929,7 +42957,7 @@ function pickPinnedSession(pinnedId, listSessions2) {
|
|
|
42929
42957
|
|
|
42930
42958
|
// src/agents/retired-proxy-cleanup.ts
|
|
42931
42959
|
var fs69 = __toESM(require("fs"));
|
|
42932
|
-
var
|
|
42960
|
+
var path80 = __toESM(require("path"));
|
|
42933
42961
|
var os54 = __toESM(require("os"));
|
|
42934
42962
|
var RETIRED_PROXY_RE = /^https?:\/\/(?:127\.0\.0\.1|localhost|\[::1\]):8787(?:[/?#]|$)/i;
|
|
42935
42963
|
var HEADROOM_CMD_RE = /(^|[\s/"'])headroom(\s|$)/i;
|
|
@@ -42941,7 +42969,7 @@ function isHeadroomHook(group) {
|
|
|
42941
42969
|
}
|
|
42942
42970
|
function sanitizeRetiredProxyConfig(homeDir2 = os54.homedir()) {
|
|
42943
42971
|
const out2 = { inspected: false, changed: false, removed: [] };
|
|
42944
|
-
const file =
|
|
42972
|
+
const file = path80.join(homeDir2, ".claude", "settings.json");
|
|
42945
42973
|
let parsed;
|
|
42946
42974
|
try {
|
|
42947
42975
|
parsed = JSON.parse(fs69.readFileSync(file, "utf8"));
|
|
@@ -43962,11 +43990,11 @@ function keepDeviceAwake(deps = {}) {
|
|
|
43962
43990
|
// src/agents/claude/onboarding.ts
|
|
43963
43991
|
var fs71 = __toESM(require("fs"));
|
|
43964
43992
|
var os56 = __toESM(require("os"));
|
|
43965
|
-
var
|
|
43993
|
+
var path81 = __toESM(require("path"));
|
|
43966
43994
|
var ONBOARDING_VERSION_SENTINEL = "9999.0.0";
|
|
43967
43995
|
function ensureClaudeOnboarded(cwd) {
|
|
43968
43996
|
try {
|
|
43969
|
-
const file =
|
|
43997
|
+
const file = path81.join(os56.homedir(), ".claude.json");
|
|
43970
43998
|
let config = {};
|
|
43971
43999
|
try {
|
|
43972
44000
|
config = JSON.parse(fs71.readFileSync(file, "utf8"));
|
|
@@ -43994,7 +44022,7 @@ function ensureClaudeOnboarded(cwd) {
|
|
|
43994
44022
|
}
|
|
43995
44023
|
}
|
|
43996
44024
|
if (!changed) return;
|
|
43997
|
-
fs71.mkdirSync(
|
|
44025
|
+
fs71.mkdirSync(path81.dirname(file), { recursive: true });
|
|
43998
44026
|
fs71.writeFileSync(file, JSON.stringify(config, null, 2));
|
|
43999
44027
|
log.info(
|
|
44000
44028
|
"claude",
|
|
@@ -44764,7 +44792,7 @@ var import_picocolors10 = __toESM(require("picocolors"));
|
|
|
44764
44792
|
var import_child_process30 = require("child_process");
|
|
44765
44793
|
var import_util4 = require("util");
|
|
44766
44794
|
var import_picocolors8 = __toESM(require("picocolors"));
|
|
44767
|
-
var
|
|
44795
|
+
var path82 = __toESM(require("path"));
|
|
44768
44796
|
var execFileP5 = (0, import_util4.promisify)(import_child_process30.execFile);
|
|
44769
44797
|
var MAX_BUFFER = 8 * 1024 * 1024;
|
|
44770
44798
|
function resetStdinForChild() {
|
|
@@ -45253,7 +45281,7 @@ var GitHubCodespacesProvider = class {
|
|
|
45253
45281
|
});
|
|
45254
45282
|
}
|
|
45255
45283
|
async uploadFile(workspaceId, remotePath, contents, options = {}) {
|
|
45256
|
-
const remoteDir =
|
|
45284
|
+
const remoteDir = path82.posix.dirname(remotePath);
|
|
45257
45285
|
const parts = [
|
|
45258
45286
|
`mkdir -p ${shellQuote(remoteDir)}`,
|
|
45259
45287
|
`cat > ${shellQuote(remotePath)}`
|
|
@@ -45323,7 +45351,7 @@ function shellQuote(s) {
|
|
|
45323
45351
|
// src/services/providers/gitpod.ts
|
|
45324
45352
|
var import_child_process31 = require("child_process");
|
|
45325
45353
|
var import_util5 = require("util");
|
|
45326
|
-
var
|
|
45354
|
+
var path83 = __toESM(require("path"));
|
|
45327
45355
|
var import_picocolors9 = __toESM(require("picocolors"));
|
|
45328
45356
|
var execFileP6 = (0, import_util5.promisify)(import_child_process31.execFile);
|
|
45329
45357
|
var MAX_BUFFER2 = 8 * 1024 * 1024;
|
|
@@ -45563,7 +45591,7 @@ var GitpodProvider = class {
|
|
|
45563
45591
|
});
|
|
45564
45592
|
}
|
|
45565
45593
|
async uploadFile(workspaceId, remotePath, contents, options = {}) {
|
|
45566
|
-
const remoteDir =
|
|
45594
|
+
const remoteDir = path83.posix.dirname(remotePath);
|
|
45567
45595
|
const parts = [
|
|
45568
45596
|
`mkdir -p ${shellQuote2(remoteDir)}`,
|
|
45569
45597
|
`cat > ${shellQuote2(remotePath)}`
|
|
@@ -45599,7 +45627,7 @@ function shellQuote2(s) {
|
|
|
45599
45627
|
// src/services/providers/gitlab-workspaces.ts
|
|
45600
45628
|
var import_child_process32 = require("child_process");
|
|
45601
45629
|
var import_util6 = require("util");
|
|
45602
|
-
var
|
|
45630
|
+
var path84 = __toESM(require("path"));
|
|
45603
45631
|
var execFileP7 = (0, import_util6.promisify)(import_child_process32.execFile);
|
|
45604
45632
|
var MAX_BUFFER3 = 8 * 1024 * 1024;
|
|
45605
45633
|
var GITLAB_API_BASE = process.env.CODEAM_GITLAB_API_URL ?? "https://gitlab.com/api/v4";
|
|
@@ -45859,7 +45887,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
45859
45887
|
}
|
|
45860
45888
|
async uploadFile(workspaceId, remotePath, contents, options = {}) {
|
|
45861
45889
|
const sshHost = process.env.CODEAM_GITLAB_SSH_HOST ?? "workspaces.gitlab.com";
|
|
45862
|
-
const remoteDir =
|
|
45890
|
+
const remoteDir = path84.posix.dirname(remotePath);
|
|
45863
45891
|
const parts = [`mkdir -p ${shellQuote3(remoteDir)}`, `cat > ${shellQuote3(remotePath)}`];
|
|
45864
45892
|
if (options.mode != null) {
|
|
45865
45893
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote3(remotePath)}`);
|
|
@@ -45927,7 +45955,7 @@ function shellQuote3(s) {
|
|
|
45927
45955
|
// src/services/providers/railway.ts
|
|
45928
45956
|
var import_child_process33 = require("child_process");
|
|
45929
45957
|
var import_util7 = require("util");
|
|
45930
|
-
var
|
|
45958
|
+
var path85 = __toESM(require("path"));
|
|
45931
45959
|
var execFileP8 = (0, import_util7.promisify)(import_child_process33.execFile);
|
|
45932
45960
|
var MAX_BUFFER4 = 8 * 1024 * 1024;
|
|
45933
45961
|
function resetStdinForChild4() {
|
|
@@ -46163,7 +46191,7 @@ var RailwayProvider = class {
|
|
|
46163
46191
|
if (!projectId || !serviceId) {
|
|
46164
46192
|
throw new Error("Invalid Railway workspace id (expected projectId/serviceId).");
|
|
46165
46193
|
}
|
|
46166
|
-
const remoteDir =
|
|
46194
|
+
const remoteDir = path85.posix.dirname(remotePath);
|
|
46167
46195
|
const parts = [`mkdir -p ${shellQuote4(remoteDir)}`, `cat > ${shellQuote4(remotePath)}`];
|
|
46168
46196
|
if (options.mode != null) {
|
|
46169
46197
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote4(remotePath)}`);
|
|
@@ -46705,7 +46733,7 @@ async function stopWorkspaceFromLocal(target) {
|
|
|
46705
46733
|
// src/commands/host/host-client.ts
|
|
46706
46734
|
var fs72 = __toESM(require("fs"));
|
|
46707
46735
|
var os57 = __toESM(require("os"));
|
|
46708
|
-
var
|
|
46736
|
+
var path86 = __toESM(require("path"));
|
|
46709
46737
|
var import_node_crypto11 = require("crypto");
|
|
46710
46738
|
function sampleCpuTimes() {
|
|
46711
46739
|
let idle = 0;
|
|
@@ -46753,7 +46781,7 @@ function apiBase() {
|
|
|
46753
46781
|
return process.env.CODEAM_API_URL ?? resolveApiBaseUrl();
|
|
46754
46782
|
}
|
|
46755
46783
|
function hostIdentityPath() {
|
|
46756
|
-
return
|
|
46784
|
+
return path86.join(os57.homedir(), ".codeam", "host-agent.json");
|
|
46757
46785
|
}
|
|
46758
46786
|
function collectOsInfo() {
|
|
46759
46787
|
return {
|
|
@@ -46784,7 +46812,7 @@ function loadHostIdentity() {
|
|
|
46784
46812
|
}
|
|
46785
46813
|
function saveHostIdentity(identity) {
|
|
46786
46814
|
const file = hostIdentityPath();
|
|
46787
|
-
fs72.mkdirSync(
|
|
46815
|
+
fs72.mkdirSync(path86.dirname(file), { recursive: true, mode: 448 });
|
|
46788
46816
|
fs72.writeFileSync(file, JSON.stringify(identity, null, 2), {
|
|
46789
46817
|
encoding: "utf8",
|
|
46790
46818
|
mode: 384
|
|
@@ -47045,7 +47073,7 @@ async function host(args2) {
|
|
|
47045
47073
|
var import_node_child_process30 = require("child_process");
|
|
47046
47074
|
var os62 = __toESM(require("os"));
|
|
47047
47075
|
var fs77 = __toESM(require("fs"));
|
|
47048
|
-
var
|
|
47076
|
+
var path91 = __toESM(require("path"));
|
|
47049
47077
|
|
|
47050
47078
|
// src/skills/persist-from-payload.ts
|
|
47051
47079
|
function persistOrClearSkillsFromPayload(skills) {
|
|
@@ -47056,11 +47084,11 @@ function persistOrClearSkillsFromPayload(skills) {
|
|
|
47056
47084
|
// src/commands/host/session-state.ts
|
|
47057
47085
|
var fs73 = __toESM(require("fs"));
|
|
47058
47086
|
var os58 = __toESM(require("os"));
|
|
47059
|
-
var
|
|
47087
|
+
var path87 = __toESM(require("path"));
|
|
47060
47088
|
function hostSessionStatePath(env = process.env) {
|
|
47061
47089
|
const override = env.CODEAM_HOST_SESSION_STATE_FILE;
|
|
47062
47090
|
if (override && override.trim()) return override.trim();
|
|
47063
|
-
return
|
|
47091
|
+
return path87.join(os58.homedir(), ".codeam", "host-agent-sessions.json");
|
|
47064
47092
|
}
|
|
47065
47093
|
function isRecord5(v) {
|
|
47066
47094
|
if (typeof v !== "object" || v === null) return false;
|
|
@@ -47079,7 +47107,7 @@ function fileSessionChildStore(file = hostSessionStatePath()) {
|
|
|
47079
47107
|
},
|
|
47080
47108
|
save(list) {
|
|
47081
47109
|
try {
|
|
47082
|
-
fs73.mkdirSync(
|
|
47110
|
+
fs73.mkdirSync(path87.dirname(file), { recursive: true, mode: 448 });
|
|
47083
47111
|
const tmp = `${file}.${process.pid}.tmp`;
|
|
47084
47112
|
fs73.writeFileSync(tmp, JSON.stringify({ version: 1, sessions: list }, null, 2), {
|
|
47085
47113
|
mode: 384
|
|
@@ -47113,9 +47141,9 @@ function planSessionResume(records, max) {
|
|
|
47113
47141
|
return { resume: ordered.slice(0, bound), dropped: ordered.slice(bound) };
|
|
47114
47142
|
}
|
|
47115
47143
|
function pickSavedSessionForWorkspace(sessions3, cwd) {
|
|
47116
|
-
const target =
|
|
47144
|
+
const target = path87.resolve(cwd);
|
|
47117
47145
|
const matches = sessions3.filter(
|
|
47118
|
-
(s) => !!s.cwd &&
|
|
47146
|
+
(s) => !!s.cwd && path87.resolve(s.cwd) === target && !!s.pluginId && !!s.pollSecret && !!s.agent
|
|
47119
47147
|
);
|
|
47120
47148
|
if (matches.length === 0) return null;
|
|
47121
47149
|
matches.sort((a, b) => b.pairedAt - a.pairedAt);
|
|
@@ -47125,23 +47153,23 @@ function pickSavedSessionForWorkspace(sessions3, cwd) {
|
|
|
47125
47153
|
// src/commands/host/workspace.ts
|
|
47126
47154
|
var fs74 = __toESM(require("fs"));
|
|
47127
47155
|
var os59 = __toESM(require("os"));
|
|
47128
|
-
var
|
|
47156
|
+
var path88 = __toESM(require("path"));
|
|
47129
47157
|
var import_node_child_process25 = require("child_process");
|
|
47130
47158
|
var import_node_util5 = require("util");
|
|
47131
47159
|
var execFileP9 = (0, import_node_util5.promisify)(import_node_child_process25.execFile);
|
|
47132
47160
|
function isAbsolutePathTarget(target) {
|
|
47133
|
-
return
|
|
47161
|
+
return path88.isAbsolute(target);
|
|
47134
47162
|
}
|
|
47135
47163
|
function selfHostedWorkspaceRoot() {
|
|
47136
|
-
return
|
|
47164
|
+
return path88.join(os59.homedir(), ".codeam", "self-hosted");
|
|
47137
47165
|
}
|
|
47138
47166
|
function deployIdFromWorkspace(cwd) {
|
|
47139
47167
|
if (!cwd) return null;
|
|
47140
47168
|
const root = selfHostedWorkspaceRoot();
|
|
47141
|
-
const resolved =
|
|
47142
|
-
const rel =
|
|
47143
|
-
if (!rel || rel.startsWith("..") ||
|
|
47144
|
-
const parts = rel.split(
|
|
47169
|
+
const resolved = path88.resolve(cwd);
|
|
47170
|
+
const rel = path88.relative(root, resolved);
|
|
47171
|
+
if (!rel || rel.startsWith("..") || path88.isAbsolute(rel)) return null;
|
|
47172
|
+
const parts = rel.split(path88.sep).filter(Boolean);
|
|
47145
47173
|
if (parts.length !== 1) return null;
|
|
47146
47174
|
return parts[0];
|
|
47147
47175
|
}
|
|
@@ -47213,7 +47241,7 @@ async function configureGitCredentials(dest, repoRef, cloneToken, provider = "gi
|
|
|
47213
47241
|
const isGitlab = provider === "gitlab";
|
|
47214
47242
|
if (isGitlab ? !gitlabProjectPath(repoRef.trim()) : !githubOwnerRepo(repoRef.trim())) return;
|
|
47215
47243
|
if (!cloneToken) return;
|
|
47216
|
-
const credFile =
|
|
47244
|
+
const credFile = path88.join(dest, ".git", "codeam-credentials");
|
|
47217
47245
|
const credLine = isGitlab ? `https://oauth2:${cloneToken}@gitlab.com
|
|
47218
47246
|
` : `https://x-access-token:${cloneToken}@github.com
|
|
47219
47247
|
`;
|
|
@@ -47221,7 +47249,7 @@ async function configureGitCredentials(dest, repoRef, cloneToken, provider = "gi
|
|
|
47221
47249
|
restrictToOwner(credFile);
|
|
47222
47250
|
const env = nonInteractiveGitEnv();
|
|
47223
47251
|
const git2 = (args2) => execFileP9("git", ["-C", dest, ...args2], { timeout: 3e4, env });
|
|
47224
|
-
const credFilePosix = credFile.split(
|
|
47252
|
+
const credFilePosix = credFile.split(path88.sep).join("/");
|
|
47225
47253
|
await git2(["config", "--local", "--replace-all", "credential.helper", ""]).catch(() => {
|
|
47226
47254
|
});
|
|
47227
47255
|
await git2([
|
|
@@ -47259,8 +47287,8 @@ async function prepareWorkspace(repoOrPath, deployId, cloneToken, provider = "gi
|
|
|
47259
47287
|
}
|
|
47260
47288
|
return repoOrPath;
|
|
47261
47289
|
}
|
|
47262
|
-
const dest =
|
|
47263
|
-
if (fs74.existsSync(
|
|
47290
|
+
const dest = path88.join(selfHostedWorkspaceRoot(), deployId);
|
|
47291
|
+
if (fs74.existsSync(path88.join(dest, ".git"))) {
|
|
47264
47292
|
if (cloneToken) await configureGitCredentials(dest, repoOrPath, cloneToken, provider);
|
|
47265
47293
|
return dest;
|
|
47266
47294
|
}
|
|
@@ -47285,9 +47313,9 @@ async function prepareWorkspace(repoOrPath, deployId, cloneToken, provider = "gi
|
|
|
47285
47313
|
var import_node_child_process26 = require("child_process");
|
|
47286
47314
|
var fs75 = __toESM(require("fs"));
|
|
47287
47315
|
var os60 = __toESM(require("os"));
|
|
47288
|
-
var
|
|
47316
|
+
var path89 = __toESM(require("path"));
|
|
47289
47317
|
function codeamBinDir() {
|
|
47290
|
-
return process.env.CODEAM_BIN_DIR ??
|
|
47318
|
+
return process.env.CODEAM_BIN_DIR ?? path89.join(os60.homedir(), ".codeam", "bin");
|
|
47291
47319
|
}
|
|
47292
47320
|
var FALLBACK_GH_VERSION = "2.62.0";
|
|
47293
47321
|
var RELEASE_API = "https://api.github.com/repos/cli/cli/releases/latest";
|
|
@@ -47342,8 +47370,8 @@ async function ensureGhCli(runner, token, deps = {}) {
|
|
|
47342
47370
|
const version3 = await resolveVersionFn(token);
|
|
47343
47371
|
const asset = `gh_${version3}_${osToken}_${arch2}`;
|
|
47344
47372
|
const url2 = `https://github.com/cli/cli/releases/download/v${version3}/${asset}.${ext}`;
|
|
47345
|
-
const tmpRoot = fs75.mkdtempSync(
|
|
47346
|
-
const archive =
|
|
47373
|
+
const tmpRoot = fs75.mkdtempSync(path89.join(os60.tmpdir(), "codeam-gh-"));
|
|
47374
|
+
const archive = path89.join(tmpRoot, `${asset}.${ext}`);
|
|
47347
47375
|
if (!await downloadFn(url2, archive)) {
|
|
47348
47376
|
log.warn("host-agent", "gh download failed \u2014 skipping (git pull/push still work via the credential helper)");
|
|
47349
47377
|
return null;
|
|
@@ -47353,14 +47381,14 @@ async function ensureGhCli(runner, token, deps = {}) {
|
|
|
47353
47381
|
log.warn("host-agent", `gh archive extraction failed (code=${String(extract.code)}) \u2014 skipping`);
|
|
47354
47382
|
return null;
|
|
47355
47383
|
}
|
|
47356
|
-
const extractedBin =
|
|
47384
|
+
const extractedBin = path89.join(tmpRoot, asset, "bin", binaryName);
|
|
47357
47385
|
if (!fs75.existsSync(extractedBin)) {
|
|
47358
47386
|
log.warn("host-agent", "gh binary not found in the extracted archive \u2014 skipping");
|
|
47359
47387
|
return null;
|
|
47360
47388
|
}
|
|
47361
47389
|
const binDir = codeamBinDir();
|
|
47362
47390
|
fs75.mkdirSync(binDir, { recursive: true });
|
|
47363
|
-
const target =
|
|
47391
|
+
const target = path89.join(binDir, binaryName);
|
|
47364
47392
|
fs75.copyFileSync(extractedBin, target);
|
|
47365
47393
|
fs75.chmodSync(target, 493);
|
|
47366
47394
|
log.info("host-agent", `gh installed to ${target} (v${version3})`);
|
|
@@ -47399,16 +47427,16 @@ async function ensureGhAuth(runner, ghCmd, token) {
|
|
|
47399
47427
|
}
|
|
47400
47428
|
function ghConfigDir() {
|
|
47401
47429
|
if (process.env.GH_CONFIG_DIR) return process.env.GH_CONFIG_DIR;
|
|
47402
|
-
if (process.env.XDG_CONFIG_HOME) return
|
|
47430
|
+
if (process.env.XDG_CONFIG_HOME) return path89.join(process.env.XDG_CONFIG_HOME, "gh");
|
|
47403
47431
|
if (process.platform === "win32" && process.env.APPDATA) {
|
|
47404
|
-
return
|
|
47432
|
+
return path89.join(process.env.APPDATA, "GitHub CLI");
|
|
47405
47433
|
}
|
|
47406
|
-
return
|
|
47434
|
+
return path89.join(os60.homedir(), ".config", "gh");
|
|
47407
47435
|
}
|
|
47408
47436
|
function writeGhHostsToken(token) {
|
|
47409
47437
|
try {
|
|
47410
47438
|
const dir = ghConfigDir();
|
|
47411
|
-
const file =
|
|
47439
|
+
const file = path89.join(dir, "hosts.yml");
|
|
47412
47440
|
if (fs75.existsSync(file)) return false;
|
|
47413
47441
|
fs75.mkdirSync(dir, { recursive: true, mode: 448 });
|
|
47414
47442
|
fs75.writeFileSync(
|
|
@@ -47454,8 +47482,8 @@ async function ensureGlabCli(runner, deps = {}) {
|
|
|
47454
47482
|
const version3 = await resolveLatestGlabVersion();
|
|
47455
47483
|
const asset = `glab_${version3}_${osToken}_${arch2}`;
|
|
47456
47484
|
const url2 = `https://gitlab.com/gitlab-org/cli/-/releases/v${version3}/downloads/${asset}.${ext}`;
|
|
47457
|
-
const tmpRoot = fs75.mkdtempSync(
|
|
47458
|
-
const archive =
|
|
47485
|
+
const tmpRoot = fs75.mkdtempSync(path89.join(os60.tmpdir(), "codeam-glab-"));
|
|
47486
|
+
const archive = path89.join(tmpRoot, `${asset}.${ext}`);
|
|
47459
47487
|
if (!await downloadFn(url2, archive)) {
|
|
47460
47488
|
log.warn("host-agent", "glab download failed \u2014 skipping (git push/pull still work)");
|
|
47461
47489
|
return null;
|
|
@@ -47466,9 +47494,9 @@ async function ensureGlabCli(runner, deps = {}) {
|
|
|
47466
47494
|
return null;
|
|
47467
47495
|
}
|
|
47468
47496
|
const candidates = [
|
|
47469
|
-
|
|
47470
|
-
|
|
47471
|
-
|
|
47497
|
+
path89.join(tmpRoot, "bin", binaryName),
|
|
47498
|
+
path89.join(tmpRoot, asset, "bin", binaryName),
|
|
47499
|
+
path89.join(tmpRoot, binaryName)
|
|
47472
47500
|
];
|
|
47473
47501
|
const extractedBin = candidates.find((c2) => fs75.existsSync(c2));
|
|
47474
47502
|
if (!extractedBin) {
|
|
@@ -47477,7 +47505,7 @@ async function ensureGlabCli(runner, deps = {}) {
|
|
|
47477
47505
|
}
|
|
47478
47506
|
const binDir = codeamBinDir();
|
|
47479
47507
|
fs75.mkdirSync(binDir, { recursive: true });
|
|
47480
|
-
const target =
|
|
47508
|
+
const target = path89.join(binDir, binaryName);
|
|
47481
47509
|
fs75.copyFileSync(extractedBin, target);
|
|
47482
47510
|
fs75.chmodSync(target, 493);
|
|
47483
47511
|
log.info("host-agent", `glab installed to ${target} (v${version3})`);
|
|
@@ -47563,7 +47591,7 @@ var import_node_child_process28 = require("child_process");
|
|
|
47563
47591
|
// src/lib/updateNotifier.ts
|
|
47564
47592
|
var fs76 = __toESM(require("fs"));
|
|
47565
47593
|
var os61 = __toESM(require("os"));
|
|
47566
|
-
var
|
|
47594
|
+
var path90 = __toESM(require("path"));
|
|
47567
47595
|
var https8 = __toESM(require("https"));
|
|
47568
47596
|
var import_node_child_process27 = require("child_process");
|
|
47569
47597
|
var import_picocolors12 = __toESM(require("picocolors"));
|
|
@@ -47572,8 +47600,8 @@ var REGISTRY_URL = `https://registry.npmjs.org/${PKG_NAME}/latest`;
|
|
|
47572
47600
|
var TTL_MS = 24 * 60 * 60 * 1e3;
|
|
47573
47601
|
var REQUEST_TIMEOUT_MS = 1500;
|
|
47574
47602
|
function cachePath() {
|
|
47575
|
-
const dir =
|
|
47576
|
-
return
|
|
47603
|
+
const dir = path90.join(os61.homedir(), ".codeam");
|
|
47604
|
+
return path90.join(dir, "update-check.json");
|
|
47577
47605
|
}
|
|
47578
47606
|
function readCache() {
|
|
47579
47607
|
try {
|
|
@@ -47588,7 +47616,7 @@ function readCache() {
|
|
|
47588
47616
|
function writeCache(cache) {
|
|
47589
47617
|
try {
|
|
47590
47618
|
const file = cachePath();
|
|
47591
|
-
fs76.mkdirSync(
|
|
47619
|
+
fs76.mkdirSync(path90.dirname(file), { recursive: true });
|
|
47592
47620
|
const tmp = `${file}.${process.pid}.tmp`;
|
|
47593
47621
|
fs76.writeFileSync(tmp, JSON.stringify(cache));
|
|
47594
47622
|
fs76.renameSync(tmp, file);
|
|
@@ -47665,7 +47693,7 @@ function isLinkedInstall() {
|
|
|
47665
47693
|
timeout: 2e3
|
|
47666
47694
|
}).trim();
|
|
47667
47695
|
if (!root) return false;
|
|
47668
|
-
const pkgPath =
|
|
47696
|
+
const pkgPath = path90.join(root, PKG_NAME);
|
|
47669
47697
|
return fs76.lstatSync(pkgPath).isSymbolicLink();
|
|
47670
47698
|
} catch {
|
|
47671
47699
|
return false;
|
|
@@ -47718,7 +47746,7 @@ async function autoUpgradeBeforeCriticalCommand() {
|
|
|
47718
47746
|
if (process.env.NODE_ENV === "test") return;
|
|
47719
47747
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
47720
47748
|
if (process.env.CI) return;
|
|
47721
|
-
const current2 = true ? "2.75.
|
|
47749
|
+
const current2 = true ? "2.75.23" : null;
|
|
47722
47750
|
if (!current2) return;
|
|
47723
47751
|
const cache = readCache();
|
|
47724
47752
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
|
@@ -47735,7 +47763,7 @@ function checkForUpdates() {
|
|
|
47735
47763
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
47736
47764
|
if (process.env.CI) return;
|
|
47737
47765
|
if (!process.stdout.isTTY) return;
|
|
47738
|
-
const current2 = true ? "2.75.
|
|
47766
|
+
const current2 = true ? "2.75.23" : null;
|
|
47739
47767
|
if (!current2) return;
|
|
47740
47768
|
const cache = readCache();
|
|
47741
47769
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
|
@@ -47758,7 +47786,7 @@ var SELF_UPDATE_INSTALL_TIMEOUT_MS = 18e4;
|
|
|
47758
47786
|
var SELF_UPDATE_LS_TIMEOUT_MS = 15e3;
|
|
47759
47787
|
var SUDO_PREFLIGHT_TIMEOUT_MS = 5e3;
|
|
47760
47788
|
function currentCliVersion() {
|
|
47761
|
-
return true ? "2.75.
|
|
47789
|
+
return true ? "2.75.23" : null;
|
|
47762
47790
|
}
|
|
47763
47791
|
async function installedVersion(deps) {
|
|
47764
47792
|
const ls = await deps.run(
|
|
@@ -48491,13 +48519,13 @@ var HostAgentSupervisor = class {
|
|
|
48491
48519
|
const relay = this.relay;
|
|
48492
48520
|
if (!relay) return;
|
|
48493
48521
|
const raw = cmd.payload?.path;
|
|
48494
|
-
const target = typeof raw === "string" && raw.trim() ?
|
|
48522
|
+
const target = typeof raw === "string" && raw.trim() ? path91.resolve(raw.trim()) : os62.homedir();
|
|
48495
48523
|
try {
|
|
48496
48524
|
const dirents = await fs77.promises.readdir(target, { withFileTypes: true });
|
|
48497
48525
|
const entries = dirents.filter((d3) => !d3.name.startsWith(".")).map((d3) => ({ name: d3.name, isDir: d3.isDirectory() })).sort(
|
|
48498
48526
|
(a, b) => a.isDir === b.isDir ? a.name.localeCompare(b.name) : a.isDir ? -1 : 1
|
|
48499
48527
|
);
|
|
48500
|
-
const parent =
|
|
48528
|
+
const parent = path91.dirname(target);
|
|
48501
48529
|
await relay.sendResult(cmd.id, "completed", {
|
|
48502
48530
|
path: target,
|
|
48503
48531
|
// null at the filesystem root so the UI can hide the ".." affordance.
|
|
@@ -48844,7 +48872,7 @@ var HostAgentSupervisor = class {
|
|
|
48844
48872
|
...buildHouseProxyChildEnv({ baseUrl, token, openRouter: openRouter === true }),
|
|
48845
48873
|
CODEAM_AUTO_TOKEN: payload.autoPairToken
|
|
48846
48874
|
};
|
|
48847
|
-
const houseConfigDir =
|
|
48875
|
+
const houseConfigDir = path91.join(
|
|
48848
48876
|
os62.homedir(),
|
|
48849
48877
|
".codeam",
|
|
48850
48878
|
"house-claude",
|
|
@@ -48885,13 +48913,13 @@ var HostAgentSupervisor = class {
|
|
|
48885
48913
|
if ((payload.repoProvider ?? "github") === "gitlab") {
|
|
48886
48914
|
const glabCmd = await ensureGlabCli(defaultGitToolingRunner);
|
|
48887
48915
|
if (glabCmd) {
|
|
48888
|
-
childEnv.PATH = `${codeamBinDir()}${
|
|
48916
|
+
childEnv.PATH = `${codeamBinDir()}${path91.delimiter}${childEnv.PATH}`;
|
|
48889
48917
|
await ensureGlabAuth(defaultGitToolingRunner, glabCmd, payload.cloneToken);
|
|
48890
48918
|
}
|
|
48891
48919
|
} else {
|
|
48892
48920
|
const ghCmd = await ensureGhCli(defaultGitToolingRunner, payload.cloneToken);
|
|
48893
48921
|
if (ghCmd) {
|
|
48894
|
-
childEnv.PATH = `${codeamBinDir()}${
|
|
48922
|
+
childEnv.PATH = `${codeamBinDir()}${path91.delimiter}${childEnv.PATH}`;
|
|
48895
48923
|
await ensureGhAuth(defaultGitToolingRunner, ghCmd, payload.cloneToken);
|
|
48896
48924
|
}
|
|
48897
48925
|
}
|
|
@@ -48919,8 +48947,8 @@ var HostAgentSupervisor = class {
|
|
|
48919
48947
|
);
|
|
48920
48948
|
if (!payload.suppressOnboardingWelcome) {
|
|
48921
48949
|
try {
|
|
48922
|
-
const cfgDir = childEnv.CLAUDE_CONFIG_DIR ||
|
|
48923
|
-
const projectDir =
|
|
48950
|
+
const cfgDir = childEnv.CLAUDE_CONFIG_DIR || path91.join(os62.homedir(), ".claude");
|
|
48951
|
+
const projectDir = path91.join(cfgDir, "projects", encodeCwd(cwd));
|
|
48924
48952
|
const hasPriorConversation = fs77.existsSync(projectDir) && fs77.readdirSync(projectDir).some((f) => f.endsWith(".jsonl"));
|
|
48925
48953
|
if (hasPriorConversation) {
|
|
48926
48954
|
childEnv.CODEAM_RESUME_LATEST = "1";
|
|
@@ -49310,8 +49338,8 @@ var HostAgentSupervisor = class {
|
|
|
49310
49338
|
this.untrackChild(deployId);
|
|
49311
49339
|
}
|
|
49312
49340
|
const dirs = [
|
|
49313
|
-
|
|
49314
|
-
|
|
49341
|
+
path91.join(selfHostedWorkspaceRoot(), deployId),
|
|
49342
|
+
path91.join(os62.homedir(), ".codeam", "house-claude", deployId)
|
|
49315
49343
|
];
|
|
49316
49344
|
for (const dir of dirs) {
|
|
49317
49345
|
try {
|
|
@@ -49476,7 +49504,7 @@ var import_node_dns = require("dns");
|
|
|
49476
49504
|
var import_node_util6 = require("util");
|
|
49477
49505
|
var import_node_crypto12 = require("crypto");
|
|
49478
49506
|
var fs78 = __toESM(require("fs"));
|
|
49479
|
-
var
|
|
49507
|
+
var path92 = __toESM(require("path"));
|
|
49480
49508
|
var import_picocolors14 = __toESM(require("picocolors"));
|
|
49481
49509
|
var dnsResolveP = (0, import_node_util6.promisify)(import_node_dns.resolve);
|
|
49482
49510
|
async function checkDns(apiBase2) {
|
|
@@ -49532,10 +49560,10 @@ async function checkHealth(apiBase2) {
|
|
|
49532
49560
|
}
|
|
49533
49561
|
}
|
|
49534
49562
|
function checkConfigDir() {
|
|
49535
|
-
const dir =
|
|
49563
|
+
const dir = path92.join(require("os").homedir(), ".codeam");
|
|
49536
49564
|
try {
|
|
49537
49565
|
fs78.mkdirSync(dir, { recursive: true, mode: 448 });
|
|
49538
|
-
const probe =
|
|
49566
|
+
const probe = path92.join(dir, ".doctor-probe");
|
|
49539
49567
|
fs78.writeFileSync(probe, "ok", { mode: 384 });
|
|
49540
49568
|
const read = fs78.readFileSync(probe, "utf8");
|
|
49541
49569
|
fs78.unlinkSync(probe);
|
|
@@ -49602,7 +49630,7 @@ function checkNodePty() {
|
|
|
49602
49630
|
detail: "not required on this platform"
|
|
49603
49631
|
};
|
|
49604
49632
|
}
|
|
49605
|
-
const vendoredPath =
|
|
49633
|
+
const vendoredPath = path92.join(__dirname, "vendor", "node-pty");
|
|
49606
49634
|
for (const target of [vendoredPath, "node-pty"]) {
|
|
49607
49635
|
try {
|
|
49608
49636
|
require(target);
|
|
@@ -49644,7 +49672,7 @@ function checkChokidar() {
|
|
|
49644
49672
|
}
|
|
49645
49673
|
async function doctor(args2 = []) {
|
|
49646
49674
|
const json = args2.includes("--json");
|
|
49647
|
-
const cliVersion = true ? "2.75.
|
|
49675
|
+
const cliVersion = true ? "2.75.23" : "0.0.0-dev";
|
|
49648
49676
|
const apiBase2 = resolveApiBaseUrl();
|
|
49649
49677
|
const diagnosticId = (0, import_node_crypto12.randomUUID)();
|
|
49650
49678
|
log.info("doctor", `run id=${diagnosticId} cli=${cliVersion}`);
|
|
@@ -50168,7 +50196,7 @@ async function mcpWarm(argv = [], opts = {}) {
|
|
|
50168
50196
|
// src/commands/version.ts
|
|
50169
50197
|
var import_picocolors15 = __toESM(require("picocolors"));
|
|
50170
50198
|
function version2() {
|
|
50171
|
-
const v = true ? "2.75.
|
|
50199
|
+
const v = true ? "2.75.23" : "unknown";
|
|
50172
50200
|
console.log(`${import_picocolors15.default.bold("codeam-cli")} ${import_picocolors15.default.cyan(v)}`);
|
|
50173
50201
|
}
|
|
50174
50202
|
|