codeam-cli 2.60.26 → 2.60.28
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 +27 -0
- package/dist/index.js +195 -184
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,33 @@ All notable changes to `codeam-cli` are documented here.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [2.60.27] — 2026-07-09
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **shared:** CodeRabbit links via oauth_token (loopback) — vault gate
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- **cli:** Coderabbit — augment PATH before findInPath (session reported not-linked)
|
|
16
|
+
- **cli:** Coderabbit PATH augment is platform-aware (Windows/WSL too)
|
|
17
|
+
|
|
18
|
+
## [2.60.26] — 2026-07-09
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- **shared:** CodeRabbit links via oauth_token (loopback) — vault gate
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- **cli:** Kimi — provision config.toml on self-hosted (Windows-safe), fixing "Model: not set"
|
|
27
|
+
|
|
28
|
+
## [2.60.25] — 2026-07-09
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
|
|
32
|
+
- **cli:** Kimi — provision config.toml on self-hosted (Windows-safe), fixing "Model: not set"
|
|
33
|
+
|
|
7
34
|
## [2.60.24] — 2026-07-09
|
|
8
35
|
|
|
9
36
|
### Added
|
package/dist/index.js
CHANGED
|
@@ -782,11 +782,11 @@ function quiet(fn) {
|
|
|
782
782
|
log.debug(TAG, "ignored sync error", err);
|
|
783
783
|
}
|
|
784
784
|
}
|
|
785
|
-
function rmIfExistsQuiet(
|
|
785
|
+
function rmIfExistsQuiet(path72) {
|
|
786
786
|
try {
|
|
787
|
-
fs2.rmSync(
|
|
787
|
+
fs2.rmSync(path72, { force: true });
|
|
788
788
|
} catch (err) {
|
|
789
|
-
log.debug(TAG, `rmIfExists failed for ${
|
|
789
|
+
log.debug(TAG, `rmIfExists failed for ${path72}`, err);
|
|
790
790
|
}
|
|
791
791
|
}
|
|
792
792
|
function killQuiet(target, signal = "SIGTERM") {
|
|
@@ -934,7 +934,7 @@ var { getConfig, ensurePluginId, addSession, removeSession, setActiveSession, ge
|
|
|
934
934
|
// src/commands/pair-auto.ts
|
|
935
935
|
var fs54 = __toESM(require("fs"));
|
|
936
936
|
var os43 = __toESM(require("os"));
|
|
937
|
-
var
|
|
937
|
+
var path58 = __toESM(require("path"));
|
|
938
938
|
var import_crypto4 = require("crypto");
|
|
939
939
|
|
|
940
940
|
// src/services/telemetry.service.ts
|
|
@@ -970,8 +970,8 @@ function createGetModuleFromFilename(basePath = process.argv[1] ? (0, import_pat
|
|
|
970
970
|
return decodedFile;
|
|
971
971
|
};
|
|
972
972
|
}
|
|
973
|
-
function normalizeWindowsPath(
|
|
974
|
-
return
|
|
973
|
+
function normalizeWindowsPath(path72) {
|
|
974
|
+
return path72.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
|
|
975
975
|
}
|
|
976
976
|
|
|
977
977
|
// ../../node_modules/@posthog/core/dist/featureFlagUtils.mjs
|
|
@@ -3451,9 +3451,9 @@ async function addSourceContext(frames) {
|
|
|
3451
3451
|
LRU_FILE_CONTENTS_CACHE.reduce();
|
|
3452
3452
|
return frames;
|
|
3453
3453
|
}
|
|
3454
|
-
function getContextLinesFromFile(
|
|
3454
|
+
function getContextLinesFromFile(path72, ranges, output) {
|
|
3455
3455
|
return new Promise((resolve7) => {
|
|
3456
|
-
const stream = (0, import_node_fs.createReadStream)(
|
|
3456
|
+
const stream = (0, import_node_fs.createReadStream)(path72);
|
|
3457
3457
|
const lineReaded = (0, import_node_readline.createInterface)({
|
|
3458
3458
|
input: stream
|
|
3459
3459
|
});
|
|
@@ -3468,7 +3468,7 @@ function getContextLinesFromFile(path71, ranges, output) {
|
|
|
3468
3468
|
let rangeStart = range[0];
|
|
3469
3469
|
let rangeEnd = range[1];
|
|
3470
3470
|
function onStreamError() {
|
|
3471
|
-
LRU_FILE_CONTENTS_FS_READ_FAILED.set(
|
|
3471
|
+
LRU_FILE_CONTENTS_FS_READ_FAILED.set(path72, 1);
|
|
3472
3472
|
lineReaded.close();
|
|
3473
3473
|
lineReaded.removeAllListeners();
|
|
3474
3474
|
destroyStreamAndResolve();
|
|
@@ -3529,8 +3529,8 @@ function clearLineContext(frame) {
|
|
|
3529
3529
|
delete frame.context_line;
|
|
3530
3530
|
delete frame.post_context;
|
|
3531
3531
|
}
|
|
3532
|
-
function shouldSkipContextLinesForFile(
|
|
3533
|
-
return
|
|
3532
|
+
function shouldSkipContextLinesForFile(path72) {
|
|
3533
|
+
return path72.startsWith("node:") || path72.endsWith(".min.js") || path72.endsWith(".min.cjs") || path72.endsWith(".min.mjs") || path72.startsWith("data:");
|
|
3534
3534
|
}
|
|
3535
3535
|
function shouldSkipContextLinesForFrame(frame) {
|
|
3536
3536
|
if (void 0 !== frame.lineno && frame.lineno > MAX_CONTEXTLINES_LINENO) return true;
|
|
@@ -5684,7 +5684,7 @@ function readAnonId() {
|
|
|
5684
5684
|
}
|
|
5685
5685
|
function superProperties() {
|
|
5686
5686
|
return {
|
|
5687
|
-
cliVersion: true ? "2.60.
|
|
5687
|
+
cliVersion: true ? "2.60.28" : "0.0.0-dev",
|
|
5688
5688
|
nodeVersion: process.version,
|
|
5689
5689
|
platform: process.platform,
|
|
5690
5690
|
arch: process.arch,
|
|
@@ -5865,7 +5865,7 @@ var os4 = __toESM(require("os"));
|
|
|
5865
5865
|
// package.json
|
|
5866
5866
|
var package_default = {
|
|
5867
5867
|
name: "codeam-cli",
|
|
5868
|
-
version: "2.60.
|
|
5868
|
+
version: "2.60.28",
|
|
5869
5869
|
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.",
|
|
5870
5870
|
type: "commonjs",
|
|
5871
5871
|
main: "dist/index.js",
|
|
@@ -6958,7 +6958,7 @@ var CommandRelayService = class {
|
|
|
6958
6958
|
// fresh + clear the "CLI update available" banner after a self-update
|
|
6959
6959
|
// (a codespace that reinstalls @latest reconnects via heartbeat, not
|
|
6960
6960
|
// pair/reconnect). Older backends ignore the extra field.
|
|
6961
|
-
..."2.60.
|
|
6961
|
+
..."2.60.28" ? { ideVersion: "2.60.28" } : {}
|
|
6962
6962
|
}).then(() => log.trace("relay", `heartbeat ok online=${online}`)).catch((err) => log.trace("relay", `heartbeat failed online=${online}`, err));
|
|
6963
6963
|
}
|
|
6964
6964
|
/**
|
|
@@ -8334,7 +8334,7 @@ function closeAllTerminals() {
|
|
|
8334
8334
|
// src/commands/start/handlers.ts
|
|
8335
8335
|
var fs53 = __toESM(require("fs"));
|
|
8336
8336
|
var os42 = __toESM(require("os"));
|
|
8337
|
-
var
|
|
8337
|
+
var path57 = __toESM(require("path"));
|
|
8338
8338
|
var import_crypto3 = require("crypto");
|
|
8339
8339
|
var import_child_process23 = require("child_process");
|
|
8340
8340
|
|
|
@@ -13516,14 +13516,14 @@ function pickLine(obj) {
|
|
|
13516
13516
|
function toHunk(raw, groupSeverity) {
|
|
13517
13517
|
if (!raw || typeof raw !== "object") return null;
|
|
13518
13518
|
const o = raw;
|
|
13519
|
-
const
|
|
13520
|
-
if (!
|
|
13519
|
+
const path72 = asString(pick(o, ["file_path", "filePath", "file", "path", "filename"])) ?? asString(pick(o, ["location"])?.path);
|
|
13520
|
+
if (!path72) return null;
|
|
13521
13521
|
const message = asString(pick(o, ["comment", "message", "body", "description", "summary", "markdown", "text"])) ?? "";
|
|
13522
13522
|
const title = asString(pick(o, ["title", "rule", "category", "check"]));
|
|
13523
13523
|
const severity = normSeverity(pick(o, ["severity", "level", "priority", "impact"])) ?? normSeverity(groupSeverity);
|
|
13524
13524
|
const locObj = pick(o, ["location"]) ?? o;
|
|
13525
13525
|
return {
|
|
13526
|
-
path:
|
|
13526
|
+
path: path72.trim(),
|
|
13527
13527
|
line: pickLine(o) ?? pickLine(locObj),
|
|
13528
13528
|
severity,
|
|
13529
13529
|
message: (title && message ? `${title}: ${message}` : title || message).trim() || "(no message)"
|
|
@@ -13601,10 +13601,10 @@ function parsePlain(stdout) {
|
|
|
13601
13601
|
for (const line of stdout.split(/\r?\n/)) {
|
|
13602
13602
|
const m = line.match(HUNK_LINE_RE);
|
|
13603
13603
|
if (!m) continue;
|
|
13604
|
-
const [,
|
|
13605
|
-
if (!
|
|
13604
|
+
const [, path72, lineNo, sevToken, message] = m;
|
|
13605
|
+
if (!path72 || !lineNo || !message) continue;
|
|
13606
13606
|
hunks.push({
|
|
13607
|
-
path:
|
|
13607
|
+
path: path72.trim(),
|
|
13608
13608
|
line: Number(lineNo),
|
|
13609
13609
|
severity: sevToken ? SEVERITY_MAP[sevToken.toLowerCase()] : void 0,
|
|
13610
13610
|
message: message.trim().replace(/^[*-]\s+/, "")
|
|
@@ -15402,6 +15402,7 @@ async function linkDryRunPreflight(ctx) {
|
|
|
15402
15402
|
|
|
15403
15403
|
// src/agents/coderabbit/configure.ts
|
|
15404
15404
|
var import_node_child_process14 = require("child_process");
|
|
15405
|
+
var path36 = __toESM(require("path"));
|
|
15405
15406
|
|
|
15406
15407
|
// src/agents/coderabbit/oauth.ts
|
|
15407
15408
|
var fs31 = __toESM(require("fs"));
|
|
@@ -15563,6 +15564,14 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
15563
15564
|
const runOAuth = deps.runOAuthLogin ?? runCoderabbitOAuthLogin;
|
|
15564
15565
|
const snapshot = deps.snapshotDir ?? (() => snapshotCredentialDir());
|
|
15565
15566
|
const capture2 = deps.captureCredential ?? ((b) => diffCapturedCredential(b));
|
|
15567
|
+
const home = os50.homeDir();
|
|
15568
|
+
os50.augmentPath(
|
|
15569
|
+
os50.id === "win32" ? [
|
|
15570
|
+
path36.join(home, ".local", "bin"),
|
|
15571
|
+
path36.join(process.env.APPDATA ?? path36.join(home, "AppData", "Roaming"), "npm"),
|
|
15572
|
+
path36.join(home, "scoop", "shims")
|
|
15573
|
+
] : [path36.join(home, ".local", "bin"), "/opt/homebrew/bin", "/usr/local/bin"]
|
|
15574
|
+
);
|
|
15566
15575
|
const installed = os50.findInPath("coderabbit") !== null;
|
|
15567
15576
|
const base = () => ({
|
|
15568
15577
|
action: input.action,
|
|
@@ -15644,12 +15653,12 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
15644
15653
|
var import_node_child_process23 = require("child_process");
|
|
15645
15654
|
var os35 = __toESM(require("os"));
|
|
15646
15655
|
var fs41 = __toESM(require("fs"));
|
|
15647
|
-
var
|
|
15656
|
+
var path44 = __toESM(require("path"));
|
|
15648
15657
|
|
|
15649
15658
|
// src/commands/host/host-client.ts
|
|
15650
15659
|
var fs33 = __toESM(require("fs"));
|
|
15651
15660
|
var os29 = __toESM(require("os"));
|
|
15652
|
-
var
|
|
15661
|
+
var path37 = __toESM(require("path"));
|
|
15653
15662
|
|
|
15654
15663
|
// src/lib/restrict-to-owner.ts
|
|
15655
15664
|
var import_node_fs5 = __toESM(require("fs"));
|
|
@@ -15731,7 +15740,7 @@ function apiBase() {
|
|
|
15731
15740
|
return process.env.CODEAM_API_URL ?? resolveApiBaseUrl();
|
|
15732
15741
|
}
|
|
15733
15742
|
function hostIdentityPath() {
|
|
15734
|
-
return
|
|
15743
|
+
return path37.join(os29.homedir(), ".codeam", "host-agent.json");
|
|
15735
15744
|
}
|
|
15736
15745
|
function collectOsInfo() {
|
|
15737
15746
|
return {
|
|
@@ -15756,7 +15765,7 @@ function loadHostIdentity() {
|
|
|
15756
15765
|
}
|
|
15757
15766
|
function saveHostIdentity(identity) {
|
|
15758
15767
|
const file = hostIdentityPath();
|
|
15759
|
-
fs33.mkdirSync(
|
|
15768
|
+
fs33.mkdirSync(path37.dirname(file), { recursive: true, mode: 448 });
|
|
15760
15769
|
fs33.writeFileSync(file, JSON.stringify(identity, null, 2), {
|
|
15761
15770
|
encoding: "utf8",
|
|
15762
15771
|
mode: 384
|
|
@@ -15927,15 +15936,15 @@ async function reportDeployProgress(auth, deployId, step, message, sessionId) {
|
|
|
15927
15936
|
// src/commands/host/workspace.ts
|
|
15928
15937
|
var fs34 = __toESM(require("fs"));
|
|
15929
15938
|
var os30 = __toESM(require("os"));
|
|
15930
|
-
var
|
|
15939
|
+
var path38 = __toESM(require("path"));
|
|
15931
15940
|
var import_node_child_process16 = require("child_process");
|
|
15932
15941
|
var import_node_util4 = require("util");
|
|
15933
15942
|
var execFileP4 = (0, import_node_util4.promisify)(import_node_child_process16.execFile);
|
|
15934
15943
|
function isAbsolutePathTarget(target) {
|
|
15935
|
-
return
|
|
15944
|
+
return path38.isAbsolute(target);
|
|
15936
15945
|
}
|
|
15937
15946
|
function selfHostedWorkspaceRoot() {
|
|
15938
|
-
return
|
|
15947
|
+
return path38.join(os30.homedir(), ".codeam", "self-hosted");
|
|
15939
15948
|
}
|
|
15940
15949
|
function nonInteractiveGitEnv() {
|
|
15941
15950
|
return {
|
|
@@ -15988,13 +15997,13 @@ async function fetchGithubIdentity(token) {
|
|
|
15988
15997
|
async function configureGitCredentials(dest, repoRef, cloneToken) {
|
|
15989
15998
|
const gh = githubOwnerRepo(repoRef.trim());
|
|
15990
15999
|
if (!gh || !cloneToken) return;
|
|
15991
|
-
const credFile =
|
|
16000
|
+
const credFile = path38.join(dest, ".git", "codeam-credentials");
|
|
15992
16001
|
fs34.writeFileSync(credFile, `https://x-access-token:${cloneToken}@github.com
|
|
15993
16002
|
`, { mode: 384 });
|
|
15994
16003
|
restrictToOwner(credFile);
|
|
15995
16004
|
const env = nonInteractiveGitEnv();
|
|
15996
16005
|
const git2 = (args2) => execFileP4("git", ["-C", dest, ...args2], { timeout: 3e4, env });
|
|
15997
|
-
const credFilePosix = credFile.split(
|
|
16006
|
+
const credFilePosix = credFile.split(path38.sep).join("/");
|
|
15998
16007
|
await git2(["config", "--local", "--replace-all", "credential.helper", ""]).catch(() => {
|
|
15999
16008
|
});
|
|
16000
16009
|
await git2([
|
|
@@ -16035,8 +16044,8 @@ async function prepareWorkspace(repoOrPath, deployId, cloneToken) {
|
|
|
16035
16044
|
}
|
|
16036
16045
|
return repoOrPath;
|
|
16037
16046
|
}
|
|
16038
|
-
const dest =
|
|
16039
|
-
if (fs34.existsSync(
|
|
16047
|
+
const dest = path38.join(selfHostedWorkspaceRoot(), deployId);
|
|
16048
|
+
if (fs34.existsSync(path38.join(dest, ".git"))) {
|
|
16040
16049
|
if (cloneToken) await configureGitCredentials(dest, repoOrPath, cloneToken);
|
|
16041
16050
|
return dest;
|
|
16042
16051
|
}
|
|
@@ -16059,7 +16068,7 @@ async function prepareWorkspace(repoOrPath, deployId, cloneToken) {
|
|
|
16059
16068
|
// src/commands/host/agent-provisioning.ts
|
|
16060
16069
|
var fs35 = __toESM(require("fs"));
|
|
16061
16070
|
var os31 = __toESM(require("os"));
|
|
16062
|
-
var
|
|
16071
|
+
var path39 = __toESM(require("path"));
|
|
16063
16072
|
var import_node_child_process17 = require("child_process");
|
|
16064
16073
|
var PUBLIC_TO_INTERNAL_AGENT = {
|
|
16065
16074
|
claude_code: "claude",
|
|
@@ -16079,7 +16088,7 @@ function ensureDir(dir) {
|
|
|
16079
16088
|
fs35.mkdirSync(dir, { recursive: true, mode: 448 });
|
|
16080
16089
|
}
|
|
16081
16090
|
function writeFile0600(filePath, contents) {
|
|
16082
|
-
ensureDir(
|
|
16091
|
+
ensureDir(path39.dirname(filePath));
|
|
16083
16092
|
fs35.writeFileSync(filePath, contents, { encoding: "utf8", mode: 384 });
|
|
16084
16093
|
restrictToOwner(filePath);
|
|
16085
16094
|
}
|
|
@@ -16091,7 +16100,7 @@ function rmIfExists(filePath) {
|
|
|
16091
16100
|
}
|
|
16092
16101
|
var claudeProvisioner = {
|
|
16093
16102
|
write(auth, home) {
|
|
16094
|
-
const credentialsJson =
|
|
16103
|
+
const credentialsJson = path39.join(home, ".claude", ".credentials.json");
|
|
16095
16104
|
if (auth.kind === "api_key") {
|
|
16096
16105
|
rmIfExists(credentialsJson);
|
|
16097
16106
|
return { ANTHROPIC_API_KEY: auth.value };
|
|
@@ -16103,7 +16112,7 @@ var claudeProvisioner = {
|
|
|
16103
16112
|
} else {
|
|
16104
16113
|
rmIfExists(credentialsJson);
|
|
16105
16114
|
}
|
|
16106
|
-
const claudeJson =
|
|
16115
|
+
const claudeJson = path39.join(home, ".claude.json");
|
|
16107
16116
|
if (!fs35.existsSync(claudeJson)) {
|
|
16108
16117
|
writeFile0600(
|
|
16109
16118
|
claudeJson,
|
|
@@ -16115,7 +16124,7 @@ var claudeProvisioner = {
|
|
|
16115
16124
|
};
|
|
16116
16125
|
var codexProvisioner = {
|
|
16117
16126
|
write(auth, home) {
|
|
16118
|
-
const authJson =
|
|
16127
|
+
const authJson = path39.join(home, ".codex", "auth.json");
|
|
16119
16128
|
if (auth.kind === "api_key") {
|
|
16120
16129
|
rmIfExists(authJson);
|
|
16121
16130
|
return { OPENAI_API_KEY: auth.value };
|
|
@@ -16126,8 +16135,8 @@ var codexProvisioner = {
|
|
|
16126
16135
|
};
|
|
16127
16136
|
var geminiProvisioner = {
|
|
16128
16137
|
write(auth, home) {
|
|
16129
|
-
const settingsJson =
|
|
16130
|
-
const oauthCreds =
|
|
16138
|
+
const settingsJson = path39.join(home, ".gemini", "settings.json");
|
|
16139
|
+
const oauthCreds = path39.join(home, ".gemini", "oauth_creds.json");
|
|
16131
16140
|
if (auth.kind === "api_key") {
|
|
16132
16141
|
rmIfExists(oauthCreds);
|
|
16133
16142
|
writeFile0600(settingsJson, '{"security":{"auth":{"selectedType":"gemini-api-key"}}}');
|
|
@@ -16140,7 +16149,7 @@ var geminiProvisioner = {
|
|
|
16140
16149
|
};
|
|
16141
16150
|
var cursorProvisioner = {
|
|
16142
16151
|
write(auth, home) {
|
|
16143
|
-
const authJson =
|
|
16152
|
+
const authJson = path39.join(home, ".config", "cursor", "auth.json");
|
|
16144
16153
|
if (auth.kind === "api_key") {
|
|
16145
16154
|
rmIfExists(authJson);
|
|
16146
16155
|
return { CURSOR_API_KEY: auth.value };
|
|
@@ -16166,8 +16175,8 @@ var cursorProvisioner = {
|
|
|
16166
16175
|
var kimiProvisioner = {
|
|
16167
16176
|
write(auth, home) {
|
|
16168
16177
|
const credentialsFiles = [
|
|
16169
|
-
|
|
16170
|
-
|
|
16178
|
+
path39.join(home, ".kimi", "credentials", "kimi-code.json"),
|
|
16179
|
+
path39.join(home, ".kimi-code", "credentials", "kimi-code.json")
|
|
16171
16180
|
];
|
|
16172
16181
|
if (auth.kind === "api_key") {
|
|
16173
16182
|
credentialsFiles.forEach(rmIfExists);
|
|
@@ -16194,8 +16203,8 @@ function provisionKimiConfig(home) {
|
|
|
16194
16203
|
}
|
|
16195
16204
|
var coderabbitProvisioner = {
|
|
16196
16205
|
write(auth, home) {
|
|
16197
|
-
const dir =
|
|
16198
|
-
const authJson =
|
|
16206
|
+
const dir = path39.join(home, ".coderabbit");
|
|
16207
|
+
const authJson = path39.join(dir, "auth.json");
|
|
16199
16208
|
if (auth.kind === "api_key") {
|
|
16200
16209
|
rmIfExists(authJson);
|
|
16201
16210
|
return { CODERABBIT_API_KEY: auth.value };
|
|
@@ -16207,13 +16216,13 @@ var coderabbitProvisioner = {
|
|
|
16207
16216
|
try {
|
|
16208
16217
|
const parsed = JSON.parse(value);
|
|
16209
16218
|
if (typeof parsed.file === "string" && typeof parsed.contents === "string") {
|
|
16210
|
-
file =
|
|
16219
|
+
file = path39.basename(parsed.file);
|
|
16211
16220
|
contents = parsed.contents;
|
|
16212
16221
|
}
|
|
16213
16222
|
} catch {
|
|
16214
16223
|
}
|
|
16215
16224
|
}
|
|
16216
|
-
writeFile0600(
|
|
16225
|
+
writeFile0600(path39.join(dir, file), contents);
|
|
16217
16226
|
return {};
|
|
16218
16227
|
}
|
|
16219
16228
|
};
|
|
@@ -16245,9 +16254,9 @@ function provisionAgentCredentials(publicAgentId, auth, homeDir2 = os31.homedir(
|
|
|
16245
16254
|
var import_node_child_process18 = require("child_process");
|
|
16246
16255
|
var fs36 = __toESM(require("fs"));
|
|
16247
16256
|
var os32 = __toESM(require("os"));
|
|
16248
|
-
var
|
|
16257
|
+
var path40 = __toESM(require("path"));
|
|
16249
16258
|
function codeamBinDir() {
|
|
16250
|
-
return process.env.CODEAM_BIN_DIR ??
|
|
16259
|
+
return process.env.CODEAM_BIN_DIR ?? path40.join(os32.homedir(), ".codeam", "bin");
|
|
16251
16260
|
}
|
|
16252
16261
|
var FALLBACK_GH_VERSION = "2.62.0";
|
|
16253
16262
|
var RELEASE_API = "https://api.github.com/repos/cli/cli/releases/latest";
|
|
@@ -16302,8 +16311,8 @@ async function ensureGhCli(runner, token, deps = {}) {
|
|
|
16302
16311
|
const version3 = await resolveVersionFn(token);
|
|
16303
16312
|
const asset = `gh_${version3}_${osToken}_${arch2}`;
|
|
16304
16313
|
const url = `https://github.com/cli/cli/releases/download/v${version3}/${asset}.${ext}`;
|
|
16305
|
-
const tmpRoot = fs36.mkdtempSync(
|
|
16306
|
-
const archive =
|
|
16314
|
+
const tmpRoot = fs36.mkdtempSync(path40.join(os32.tmpdir(), "codeam-gh-"));
|
|
16315
|
+
const archive = path40.join(tmpRoot, `${asset}.${ext}`);
|
|
16307
16316
|
if (!await downloadFn(url, archive)) {
|
|
16308
16317
|
log.warn("host-agent", "gh download failed \u2014 skipping (git pull/push still work via the credential helper)");
|
|
16309
16318
|
return null;
|
|
@@ -16313,14 +16322,14 @@ async function ensureGhCli(runner, token, deps = {}) {
|
|
|
16313
16322
|
log.warn("host-agent", `gh archive extraction failed (code=${String(extract.code)}) \u2014 skipping`);
|
|
16314
16323
|
return null;
|
|
16315
16324
|
}
|
|
16316
|
-
const extractedBin =
|
|
16325
|
+
const extractedBin = path40.join(tmpRoot, asset, "bin", binaryName);
|
|
16317
16326
|
if (!fs36.existsSync(extractedBin)) {
|
|
16318
16327
|
log.warn("host-agent", "gh binary not found in the extracted archive \u2014 skipping");
|
|
16319
16328
|
return null;
|
|
16320
16329
|
}
|
|
16321
16330
|
const binDir = codeamBinDir();
|
|
16322
16331
|
fs36.mkdirSync(binDir, { recursive: true });
|
|
16323
|
-
const target =
|
|
16332
|
+
const target = path40.join(binDir, binaryName);
|
|
16324
16333
|
fs36.copyFileSync(extractedBin, target);
|
|
16325
16334
|
fs36.chmodSync(target, 493);
|
|
16326
16335
|
log.info("host-agent", `gh installed to ${target} (v${version3})`);
|
|
@@ -16810,19 +16819,19 @@ async function ensureModernPython(runner) {
|
|
|
16810
16819
|
|
|
16811
16820
|
// src/commands/host/headroom-bootstrap.ts
|
|
16812
16821
|
var fs38 = __toESM(require("fs"));
|
|
16813
|
-
var
|
|
16822
|
+
var path42 = __toESM(require("path"));
|
|
16814
16823
|
|
|
16815
16824
|
// src/commands/host/headroom-config.ts
|
|
16816
16825
|
var fs37 = __toESM(require("fs"));
|
|
16817
16826
|
var os33 = __toESM(require("os"));
|
|
16818
|
-
var
|
|
16827
|
+
var path41 = __toESM(require("path"));
|
|
16819
16828
|
function headroomConfigPath() {
|
|
16820
|
-
return
|
|
16829
|
+
return path41.join(os33.homedir(), ".codeam", "headroom-config.json");
|
|
16821
16830
|
}
|
|
16822
16831
|
function persistHeadroomConfig(config) {
|
|
16823
16832
|
try {
|
|
16824
16833
|
const file = headroomConfigPath();
|
|
16825
|
-
fs37.mkdirSync(
|
|
16834
|
+
fs37.mkdirSync(path41.dirname(file), { recursive: true, mode: 448 });
|
|
16826
16835
|
const tmp = `${file}.tmp-${process.pid}`;
|
|
16827
16836
|
fs37.writeFileSync(tmp, JSON.stringify(config, null, 2), { encoding: "utf8", mode: 384 });
|
|
16828
16837
|
fs37.renameSync(tmp, file);
|
|
@@ -16836,9 +16845,9 @@ function persistHeadroomConfig(config) {
|
|
|
16836
16845
|
}
|
|
16837
16846
|
function agentSettingsPath(kind) {
|
|
16838
16847
|
const home = os33.homedir();
|
|
16839
|
-
if (kind === "claude") return
|
|
16840
|
-
if (kind === "codex") return
|
|
16841
|
-
if (kind === "copilot") return
|
|
16848
|
+
if (kind === "claude") return path41.join(home, ".claude", "settings.json");
|
|
16849
|
+
if (kind === "codex") return path41.join(home, ".codex", "auth.json");
|
|
16850
|
+
if (kind === "copilot") return path41.join(home, ".config", "github-copilot", "hosts.json");
|
|
16842
16851
|
return null;
|
|
16843
16852
|
}
|
|
16844
16853
|
function backupAgentHeadroomConfig(kind) {
|
|
@@ -16846,8 +16855,8 @@ function backupAgentHeadroomConfig(kind) {
|
|
|
16846
16855
|
if (!src) return;
|
|
16847
16856
|
try {
|
|
16848
16857
|
if (!fs37.existsSync(src)) return;
|
|
16849
|
-
const dest =
|
|
16850
|
-
fs37.mkdirSync(
|
|
16858
|
+
const dest = path41.join(os33.homedir(), ".codeam", `headroom-backup-${kind}.json`);
|
|
16859
|
+
fs37.mkdirSync(path41.dirname(dest), { recursive: true, mode: 448 });
|
|
16851
16860
|
fs37.copyFileSync(src, dest);
|
|
16852
16861
|
fs37.chmodSync(dest, 384);
|
|
16853
16862
|
log.info("host-agent", `headroom config backup: ${src} \u2192 ${dest}`);
|
|
@@ -16861,10 +16870,10 @@ function backupAgentHeadroomConfig(kind) {
|
|
|
16861
16870
|
function restoreAgentHeadroomConfig(kind) {
|
|
16862
16871
|
const dest = agentSettingsPath(kind);
|
|
16863
16872
|
if (!dest) return false;
|
|
16864
|
-
const src =
|
|
16873
|
+
const src = path41.join(os33.homedir(), ".codeam", `headroom-backup-${kind}.json`);
|
|
16865
16874
|
if (!fs37.existsSync(src)) return false;
|
|
16866
16875
|
try {
|
|
16867
|
-
fs37.mkdirSync(
|
|
16876
|
+
fs37.mkdirSync(path41.dirname(dest), { recursive: true, mode: 448 });
|
|
16868
16877
|
fs37.copyFileSync(src, dest);
|
|
16869
16878
|
fs37.chmodSync(dest, 384);
|
|
16870
16879
|
log.info("host-agent", `headroom config restored: ${src} \u2192 ${dest}`);
|
|
@@ -16915,20 +16924,20 @@ function bundledClaudeBinDir() {
|
|
|
16915
16924
|
const roots = /* @__PURE__ */ new Set();
|
|
16916
16925
|
let dir = __dirname;
|
|
16917
16926
|
for (let i = 0; i < 6; i++) {
|
|
16918
|
-
roots.add(
|
|
16919
|
-
const parent =
|
|
16927
|
+
roots.add(path42.join(dir, "node_modules"));
|
|
16928
|
+
const parent = path42.dirname(dir);
|
|
16920
16929
|
if (parent === dir) break;
|
|
16921
16930
|
dir = parent;
|
|
16922
16931
|
}
|
|
16923
16932
|
try {
|
|
16924
16933
|
const main2 = require.resolve("@anthropic-ai/claude-agent-sdk");
|
|
16925
|
-
const marker = `${
|
|
16934
|
+
const marker = `${path42.sep}@anthropic-ai${path42.sep}`;
|
|
16926
16935
|
const idx = main2.lastIndexOf(marker);
|
|
16927
16936
|
if (idx !== -1) roots.add(main2.slice(0, idx));
|
|
16928
16937
|
} catch {
|
|
16929
16938
|
}
|
|
16930
16939
|
for (const nm of roots) {
|
|
16931
|
-
const atAnthropic =
|
|
16940
|
+
const atAnthropic = path42.join(nm, "@anthropic-ai");
|
|
16932
16941
|
let entries;
|
|
16933
16942
|
try {
|
|
16934
16943
|
entries = fs38.readdirSync(atAnthropic);
|
|
@@ -16937,8 +16946,8 @@ function bundledClaudeBinDir() {
|
|
|
16937
16946
|
}
|
|
16938
16947
|
for (const entry of entries) {
|
|
16939
16948
|
if (!entry.startsWith("claude-agent-sdk-")) continue;
|
|
16940
|
-
const bin =
|
|
16941
|
-
if (fs38.existsSync(bin)) return
|
|
16949
|
+
const bin = path42.join(atAnthropic, entry, "claude");
|
|
16950
|
+
if (fs38.existsSync(bin)) return path42.dirname(bin);
|
|
16942
16951
|
}
|
|
16943
16952
|
}
|
|
16944
16953
|
return null;
|
|
@@ -17007,7 +17016,7 @@ async function setupHeadroomForSelfHosted(agent, runner = defaultHeadroomRunner,
|
|
|
17007
17016
|
if (initKind === "claude") {
|
|
17008
17017
|
const claudeDir = bundledClaudeBinDir();
|
|
17009
17018
|
if (claudeDir) {
|
|
17010
|
-
initEnv.PATH = `${claudeDir}${
|
|
17019
|
+
initEnv.PATH = `${claudeDir}${path42.delimiter}${process.env["PATH"] ?? ""}`;
|
|
17011
17020
|
log.info("host-agent", `headroom init: bundled claude on PATH (${claudeDir})`);
|
|
17012
17021
|
} else {
|
|
17013
17022
|
log.warn("host-agent", "headroom init: bundled claude binary not found \u2014 init may fail");
|
|
@@ -17044,7 +17053,7 @@ var import_node_child_process21 = require("child_process");
|
|
|
17044
17053
|
// src/lib/updateNotifier.ts
|
|
17045
17054
|
var fs39 = __toESM(require("fs"));
|
|
17046
17055
|
var os34 = __toESM(require("os"));
|
|
17047
|
-
var
|
|
17056
|
+
var path43 = __toESM(require("path"));
|
|
17048
17057
|
var https6 = __toESM(require("https"));
|
|
17049
17058
|
var import_node_child_process20 = require("child_process");
|
|
17050
17059
|
var import_picocolors3 = __toESM(require("picocolors"));
|
|
@@ -17053,8 +17062,8 @@ var REGISTRY_URL = `https://registry.npmjs.org/${PKG_NAME}/latest`;
|
|
|
17053
17062
|
var TTL_MS = 24 * 60 * 60 * 1e3;
|
|
17054
17063
|
var REQUEST_TIMEOUT_MS = 1500;
|
|
17055
17064
|
function cachePath() {
|
|
17056
|
-
const dir =
|
|
17057
|
-
return
|
|
17065
|
+
const dir = path43.join(os34.homedir(), ".codeam");
|
|
17066
|
+
return path43.join(dir, "update-check.json");
|
|
17058
17067
|
}
|
|
17059
17068
|
function readCache() {
|
|
17060
17069
|
try {
|
|
@@ -17069,7 +17078,7 @@ function readCache() {
|
|
|
17069
17078
|
function writeCache(cache) {
|
|
17070
17079
|
try {
|
|
17071
17080
|
const file = cachePath();
|
|
17072
|
-
fs39.mkdirSync(
|
|
17081
|
+
fs39.mkdirSync(path43.dirname(file), { recursive: true });
|
|
17073
17082
|
const tmp = `${file}.${process.pid}.tmp`;
|
|
17074
17083
|
fs39.writeFileSync(tmp, JSON.stringify(cache));
|
|
17075
17084
|
fs39.renameSync(tmp, file);
|
|
@@ -17146,7 +17155,7 @@ function isLinkedInstall() {
|
|
|
17146
17155
|
timeout: 2e3
|
|
17147
17156
|
}).trim();
|
|
17148
17157
|
if (!root) return false;
|
|
17149
|
-
const pkgPath =
|
|
17158
|
+
const pkgPath = path43.join(root, PKG_NAME);
|
|
17150
17159
|
return fs39.lstatSync(pkgPath).isSymbolicLink();
|
|
17151
17160
|
} catch {
|
|
17152
17161
|
return false;
|
|
@@ -17199,7 +17208,7 @@ async function autoUpgradeBeforeCriticalCommand() {
|
|
|
17199
17208
|
if (process.env.NODE_ENV === "test") return;
|
|
17200
17209
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
17201
17210
|
if (process.env.CI) return;
|
|
17202
|
-
const current = true ? "2.60.
|
|
17211
|
+
const current = true ? "2.60.28" : null;
|
|
17203
17212
|
if (!current) return;
|
|
17204
17213
|
const cache = readCache();
|
|
17205
17214
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
|
@@ -17216,7 +17225,7 @@ function checkForUpdates() {
|
|
|
17216
17225
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
17217
17226
|
if (process.env.CI) return;
|
|
17218
17227
|
if (!process.stdout.isTTY) return;
|
|
17219
|
-
const current = true ? "2.60.
|
|
17228
|
+
const current = true ? "2.60.28" : null;
|
|
17220
17229
|
if (!current) return;
|
|
17221
17230
|
const cache = readCache();
|
|
17222
17231
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
|
@@ -17236,7 +17245,7 @@ var SELF_UPDATE_INTERVAL_MS = 60 * 60 * 1e3;
|
|
|
17236
17245
|
var SELF_UPDATE_VIEW_TIMEOUT_MS = 3e4;
|
|
17237
17246
|
var SELF_UPDATE_INSTALL_TIMEOUT_MS = 18e4;
|
|
17238
17247
|
function currentCliVersion() {
|
|
17239
|
-
return true ? "2.60.
|
|
17248
|
+
return true ? "2.60.28" : null;
|
|
17240
17249
|
}
|
|
17241
17250
|
function runCmd(cmd, args2, timeoutMs) {
|
|
17242
17251
|
return new Promise((resolve7) => {
|
|
@@ -17786,7 +17795,7 @@ var HostAgentSupervisor = class {
|
|
|
17786
17795
|
API_TIMEOUT_MS: "3000000",
|
|
17787
17796
|
CODEAM_AUTO_TOKEN: payload.autoPairToken
|
|
17788
17797
|
};
|
|
17789
|
-
const houseConfigDir =
|
|
17798
|
+
const houseConfigDir = path44.join(os35.homedir(), ".codeam", "house-claude");
|
|
17790
17799
|
try {
|
|
17791
17800
|
fs41.mkdirSync(houseConfigDir, { recursive: true, mode: 448 });
|
|
17792
17801
|
} catch {
|
|
@@ -17813,7 +17822,7 @@ var HostAgentSupervisor = class {
|
|
|
17813
17822
|
report("preparing", "configuring git tooling");
|
|
17814
17823
|
const ghCmd = await ensureGhCli(defaultGitToolingRunner, payload.cloneToken);
|
|
17815
17824
|
if (ghCmd) {
|
|
17816
|
-
childEnv.PATH = `${codeamBinDir()}${
|
|
17825
|
+
childEnv.PATH = `${codeamBinDir()}${path44.delimiter}${childEnv.PATH}`;
|
|
17817
17826
|
await ensureGhAuth(defaultGitToolingRunner, ghCmd, payload.cloneToken);
|
|
17818
17827
|
}
|
|
17819
17828
|
} catch (e) {
|
|
@@ -18137,7 +18146,7 @@ async function configureHeadroom(action, ctx, deps) {
|
|
|
18137
18146
|
// src/services/headroom/budget-relaunch.ts
|
|
18138
18147
|
var fs42 = __toESM(require("fs"));
|
|
18139
18148
|
var os36 = __toESM(require("os"));
|
|
18140
|
-
var
|
|
18149
|
+
var path45 = __toESM(require("path"));
|
|
18141
18150
|
var import_child_process13 = require("child_process");
|
|
18142
18151
|
function amendDeploymentManifestBudget(manifest, budget) {
|
|
18143
18152
|
const rawArgs = manifest.proxy_args ?? [];
|
|
@@ -18171,7 +18180,7 @@ function amendDeploymentManifestBudget(manifest, budget) {
|
|
|
18171
18180
|
return { ...manifest, proxy_args: newArgs, base_env: newEnv };
|
|
18172
18181
|
}
|
|
18173
18182
|
function findHeadroomDeployments(homeDir2, deps) {
|
|
18174
|
-
const deployDir =
|
|
18183
|
+
const deployDir = path45.join(homeDir2, ".headroom", "deploy");
|
|
18175
18184
|
let profiles;
|
|
18176
18185
|
try {
|
|
18177
18186
|
profiles = deps.readDir(deployDir);
|
|
@@ -18180,7 +18189,7 @@ function findHeadroomDeployments(homeDir2, deps) {
|
|
|
18180
18189
|
}
|
|
18181
18190
|
const results = [];
|
|
18182
18191
|
for (const profile of profiles) {
|
|
18183
|
-
const manifestPath =
|
|
18192
|
+
const manifestPath = path45.join(deployDir, profile, "manifest.json");
|
|
18184
18193
|
let raw;
|
|
18185
18194
|
try {
|
|
18186
18195
|
raw = deps.readJson(manifestPath);
|
|
@@ -18928,7 +18937,7 @@ function activePreviewSessionIds() {
|
|
|
18928
18937
|
// src/services/preview/start-orchestrator.ts
|
|
18929
18938
|
var import_child_process17 = require("child_process");
|
|
18930
18939
|
var fs47 = __toESM(require("fs"));
|
|
18931
|
-
var
|
|
18940
|
+
var path50 = __toESM(require("path"));
|
|
18932
18941
|
var import_which2 = __toESM(require("which"));
|
|
18933
18942
|
var INSTALL_TIMEOUT_MS = 5 * 6e4;
|
|
18934
18943
|
var SETUP_TIMEOUT_MS = 2 * 6e4;
|
|
@@ -18995,7 +19004,7 @@ function normalizeDetectionForSpawn(detection, cwd) {
|
|
|
18995
19004
|
if (args2.length === 0) return detection;
|
|
18996
19005
|
const binName = args2[0];
|
|
18997
19006
|
if (binName.startsWith("-")) return detection;
|
|
18998
|
-
const binPath =
|
|
19007
|
+
const binPath = path50.join(cwd, "node_modules", ".bin", binName);
|
|
18999
19008
|
if (!fs47.existsSync(binPath)) return detection;
|
|
19000
19009
|
return {
|
|
19001
19010
|
...detection,
|
|
@@ -19348,7 +19357,7 @@ async function establishTunnel(ctx, dev) {
|
|
|
19348
19357
|
var import_child_process18 = require("child_process");
|
|
19349
19358
|
var fs48 = __toESM(require("fs"));
|
|
19350
19359
|
var os38 = __toESM(require("os"));
|
|
19351
|
-
var
|
|
19360
|
+
var path51 = __toESM(require("path"));
|
|
19352
19361
|
var BD_PACKAGE = "@beads/bd";
|
|
19353
19362
|
function resolveBundledBdBinary() {
|
|
19354
19363
|
return _resolveSeam.resolveBundled();
|
|
@@ -19360,9 +19369,9 @@ function _defaultResolveBundled() {
|
|
|
19360
19369
|
} catch {
|
|
19361
19370
|
return null;
|
|
19362
19371
|
}
|
|
19363
|
-
const binDir =
|
|
19372
|
+
const binDir = path51.join(path51.dirname(pkgJsonPath), "bin");
|
|
19364
19373
|
const binaryName = process.platform === "win32" ? "bd.exe" : "bd";
|
|
19365
|
-
const binaryPath =
|
|
19374
|
+
const binaryPath = path51.join(binDir, binaryName);
|
|
19366
19375
|
try {
|
|
19367
19376
|
fs48.accessSync(binaryPath, fs48.constants.F_OK);
|
|
19368
19377
|
return binaryPath;
|
|
@@ -19374,11 +19383,11 @@ function resolveBdOnPath() {
|
|
|
19374
19383
|
return _resolveSeam.resolveOnPath();
|
|
19375
19384
|
}
|
|
19376
19385
|
function _defaultResolveOnPath() {
|
|
19377
|
-
const dirs = (process.env.PATH ?? "").split(
|
|
19386
|
+
const dirs = (process.env.PATH ?? "").split(path51.delimiter).filter(Boolean);
|
|
19378
19387
|
const candidates = process.platform === "win32" ? ["bd.exe", "bd.cmd", "bd"] : ["bd"];
|
|
19379
19388
|
for (const dir of dirs) {
|
|
19380
19389
|
for (const candidate of candidates) {
|
|
19381
|
-
const full =
|
|
19390
|
+
const full = path51.join(dir, candidate);
|
|
19382
19391
|
try {
|
|
19383
19392
|
fs48.accessSync(full, fs48.constants.F_OK);
|
|
19384
19393
|
return full;
|
|
@@ -19559,7 +19568,7 @@ function coerceIssue(row, projectKey) {
|
|
|
19559
19568
|
var import_child_process22 = require("child_process");
|
|
19560
19569
|
var fs51 = __toESM(require("fs"));
|
|
19561
19570
|
var os40 = __toESM(require("os"));
|
|
19562
|
-
var
|
|
19571
|
+
var path54 = __toESM(require("path"));
|
|
19563
19572
|
|
|
19564
19573
|
// src/beads/install-bd.ts
|
|
19565
19574
|
var import_child_process19 = require("child_process");
|
|
@@ -19626,7 +19635,7 @@ async function installBd(platform3 = process.platform) {
|
|
|
19626
19635
|
var import_child_process20 = require("child_process");
|
|
19627
19636
|
var fs49 = __toESM(require("fs"));
|
|
19628
19637
|
var os39 = __toESM(require("os"));
|
|
19629
|
-
var
|
|
19638
|
+
var path52 = __toESM(require("path"));
|
|
19630
19639
|
var DOLT_INSTALL_SH_URL = "https://github.com/dolthub/dolt/releases/latest/download/install.sh";
|
|
19631
19640
|
var DOLT_MSI_URL = "https://github.com/dolthub/dolt/releases/latest/download/dolt-windows-amd64.msi";
|
|
19632
19641
|
function resolveDoltInstallStrategy(platform3) {
|
|
@@ -19733,7 +19742,7 @@ function doltBinaryNames(platform3) {
|
|
|
19733
19742
|
return platform3 === "win32" ? ["dolt.exe", "dolt.cmd", "dolt"] : ["dolt"];
|
|
19734
19743
|
}
|
|
19735
19744
|
function knownDoltDirs(platform3) {
|
|
19736
|
-
const P3 = platform3 === "win32" ?
|
|
19745
|
+
const P3 = platform3 === "win32" ? path52.win32 : path52.posix;
|
|
19737
19746
|
const home = _doltPathSeam.homedir();
|
|
19738
19747
|
if (platform3 === "win32") {
|
|
19739
19748
|
return [
|
|
@@ -19749,7 +19758,7 @@ function knownDoltDirs(platform3) {
|
|
|
19749
19758
|
].filter(Boolean);
|
|
19750
19759
|
}
|
|
19751
19760
|
function ensureDoltResolvable(platform3 = process.platform) {
|
|
19752
|
-
const P3 = platform3 === "win32" ?
|
|
19761
|
+
const P3 = platform3 === "win32" ? path52.win32 : path52.posix;
|
|
19753
19762
|
const delim = platform3 === "win32" ? ";" : ":";
|
|
19754
19763
|
const names = doltBinaryNames(platform3);
|
|
19755
19764
|
const pathDirs = _doltPathSeam.getPath().split(delim).filter(Boolean);
|
|
@@ -19886,7 +19895,7 @@ async function ensureSharedServer(adapter, options = {}) {
|
|
|
19886
19895
|
var import_child_process21 = require("child_process");
|
|
19887
19896
|
var crypto2 = __toESM(require("crypto"));
|
|
19888
19897
|
var fs50 = __toESM(require("fs"));
|
|
19889
|
-
var
|
|
19898
|
+
var path53 = __toESM(require("path"));
|
|
19890
19899
|
function normalizeOrigin(raw) {
|
|
19891
19900
|
const trimmed = raw.trim();
|
|
19892
19901
|
if (!trimmed) return null;
|
|
@@ -19912,17 +19921,17 @@ function normalizeOrigin(raw) {
|
|
|
19912
19921
|
return `${host2}/${pathPart}`;
|
|
19913
19922
|
}
|
|
19914
19923
|
function findRepoRoot(cwd) {
|
|
19915
|
-
let dir =
|
|
19924
|
+
let dir = path53.resolve(cwd);
|
|
19916
19925
|
const seen = /* @__PURE__ */ new Set();
|
|
19917
19926
|
for (let i = 0; i < 256; i++) {
|
|
19918
19927
|
if (seen.has(dir)) return null;
|
|
19919
19928
|
seen.add(dir);
|
|
19920
19929
|
try {
|
|
19921
|
-
const stat3 = fs50.statSync(
|
|
19930
|
+
const stat3 = fs50.statSync(path53.join(dir, ".git"), { throwIfNoEntry: false });
|
|
19922
19931
|
if (stat3 && (stat3.isDirectory() || stat3.isFile())) return dir;
|
|
19923
19932
|
} catch {
|
|
19924
19933
|
}
|
|
19925
|
-
const parent =
|
|
19934
|
+
const parent = path53.dirname(dir);
|
|
19926
19935
|
if (parent === dir) return null;
|
|
19927
19936
|
dir = parent;
|
|
19928
19937
|
}
|
|
@@ -19962,7 +19971,7 @@ function deriveProjectIdentity(cwd = process.cwd()) {
|
|
|
19962
19971
|
} catch {
|
|
19963
19972
|
}
|
|
19964
19973
|
const hash = crypto2.createHash("sha256").update(real).digest("hex");
|
|
19965
|
-
return { projectKey: `path:${hash}`, projectLabel:
|
|
19974
|
+
return { projectKey: `path:${hash}`, projectLabel: path53.basename(real) || "project" };
|
|
19966
19975
|
}
|
|
19967
19976
|
|
|
19968
19977
|
// src/beads/project-prefix.ts
|
|
@@ -20038,9 +20047,9 @@ var _linkSeam = {
|
|
|
20038
20047
|
* which `linkBdOntoPath` creates if missing.
|
|
20039
20048
|
*/
|
|
20040
20049
|
cliBinDir: () => {
|
|
20041
|
-
const pathDirs = (process.env.PATH ?? "").split(
|
|
20050
|
+
const pathDirs = (process.env.PATH ?? "").split(path54.delimiter).filter(Boolean);
|
|
20042
20051
|
const home = _linkSeam.homedir();
|
|
20043
|
-
const localBin = home ?
|
|
20052
|
+
const localBin = home ? path54.join(home, ".local", "bin") : null;
|
|
20044
20053
|
if (localBin) {
|
|
20045
20054
|
try {
|
|
20046
20055
|
_linkSeam.ensureDir(localBin);
|
|
@@ -20050,16 +20059,16 @@ var _linkSeam = {
|
|
|
20050
20059
|
const candidates = [];
|
|
20051
20060
|
if (localBin) candidates.push(localBin);
|
|
20052
20061
|
try {
|
|
20053
|
-
candidates.push(
|
|
20062
|
+
candidates.push(path54.dirname(process.execPath));
|
|
20054
20063
|
} catch {
|
|
20055
20064
|
}
|
|
20056
20065
|
candidates.push("/usr/local/bin");
|
|
20057
20066
|
const entry = process.argv[1];
|
|
20058
20067
|
if (entry) {
|
|
20059
20068
|
try {
|
|
20060
|
-
candidates.push(
|
|
20069
|
+
candidates.push(path54.dirname(fs51.realpathSync(entry)));
|
|
20061
20070
|
} catch {
|
|
20062
|
-
candidates.push(
|
|
20071
|
+
candidates.push(path54.dirname(entry));
|
|
20063
20072
|
}
|
|
20064
20073
|
}
|
|
20065
20074
|
const onPathWritable = candidates.find(
|
|
@@ -20084,7 +20093,7 @@ function linkBdOntoPath(binaryPath) {
|
|
|
20084
20093
|
const binDir = _linkSeam.cliBinDir();
|
|
20085
20094
|
if (!binDir) return;
|
|
20086
20095
|
_linkSeam.ensureDir(binDir);
|
|
20087
|
-
const linkPath =
|
|
20096
|
+
const linkPath = path54.join(binDir, "bd");
|
|
20088
20097
|
if (linkPath === binaryPath) return;
|
|
20089
20098
|
const current = _linkSeam.readlink(linkPath);
|
|
20090
20099
|
if (current === binaryPath) return;
|
|
@@ -20279,7 +20288,7 @@ function dedupeRecipes(agents) {
|
|
|
20279
20288
|
|
|
20280
20289
|
// src/beads/watcher.ts
|
|
20281
20290
|
var crypto4 = __toESM(require("crypto"));
|
|
20282
|
-
var
|
|
20291
|
+
var path55 = __toESM(require("path"));
|
|
20283
20292
|
var API_BASE6 = resolveApiBaseUrl();
|
|
20284
20293
|
var DEBOUNCE_MS2 = 400;
|
|
20285
20294
|
var ZERO_SUMMARY = {
|
|
@@ -20303,7 +20312,7 @@ var BeadsWatcher = class {
|
|
|
20303
20312
|
constructor(opts) {
|
|
20304
20313
|
this.opts = opts;
|
|
20305
20314
|
this.bd = opts.adapter ?? new BdAdapter({ cwd: opts.cwd, beadsDir: opts.beadsDir });
|
|
20306
|
-
this.feedPath = opts.feedPath ??
|
|
20315
|
+
this.feedPath = opts.feedPath ?? path55.join(opts.cwd ?? process.cwd(), ".beads", "last-touched");
|
|
20307
20316
|
this.apiBase = opts.apiBaseUrl ?? API_BASE6;
|
|
20308
20317
|
}
|
|
20309
20318
|
opts;
|
|
@@ -20720,7 +20729,7 @@ function cleanupAttachmentTempFiles() {
|
|
|
20720
20729
|
function saveFilesTemp(files) {
|
|
20721
20730
|
return files.filter(({ base64 }) => base64 && base64.length > 0).map(({ filename, base64 }) => {
|
|
20722
20731
|
const safeName = filename.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 80);
|
|
20723
|
-
const tmpPath =
|
|
20732
|
+
const tmpPath = path57.join(os42.tmpdir(), `codeam-${(0, import_crypto3.randomUUID)()}-${safeName}`);
|
|
20724
20733
|
fs53.writeFileSync(tmpPath, Buffer.from(base64, "base64"));
|
|
20725
20734
|
pendingAttachmentFiles.add(tmpPath);
|
|
20726
20735
|
return tmpPath;
|
|
@@ -20933,7 +20942,7 @@ var listFiles = async (ctx, cmd, parsed) => {
|
|
|
20933
20942
|
await ctx.relay.sendResult(cmd.id, "completed", result);
|
|
20934
20943
|
};
|
|
20935
20944
|
var envReadH = async (ctx, cmd) => {
|
|
20936
|
-
const envPath =
|
|
20945
|
+
const envPath = path57.join(process.cwd(), ".env");
|
|
20937
20946
|
try {
|
|
20938
20947
|
const raw = await fs53.promises.readFile(envPath, "utf8");
|
|
20939
20948
|
await ctx.relay.sendResult(cmd.id, "completed", {
|
|
@@ -20966,8 +20975,8 @@ var envWriteH = async (ctx, cmd, parsed) => {
|
|
|
20966
20975
|
}
|
|
20967
20976
|
seen.add(v.key);
|
|
20968
20977
|
}
|
|
20969
|
-
const envPath =
|
|
20970
|
-
const tmpPath =
|
|
20978
|
+
const envPath = path57.join(process.cwd(), ".env");
|
|
20979
|
+
const tmpPath = path57.join(process.cwd(), ".env.codeam.tmp");
|
|
20971
20980
|
try {
|
|
20972
20981
|
await fs53.promises.writeFile(tmpPath, serializeDotenv(vars), "utf8");
|
|
20973
20982
|
await fs53.promises.rename(tmpPath, envPath);
|
|
@@ -21172,12 +21181,14 @@ var coderabbitConfigureH = async (ctx, cmd, parsed) => {
|
|
|
21172
21181
|
runReview: (input) => new CoderabbitRuntimeStrategy(createOsStrategy()).runOneShot(input)
|
|
21173
21182
|
}
|
|
21174
21183
|
);
|
|
21175
|
-
|
|
21176
|
-
|
|
21177
|
-
|
|
21178
|
-
|
|
21179
|
-
|
|
21180
|
-
|
|
21184
|
+
if (action !== "review") {
|
|
21185
|
+
emit2("coderabbit_status", {
|
|
21186
|
+
installed: result.installed,
|
|
21187
|
+
loggedIn: result.loggedIn,
|
|
21188
|
+
linked: result.linked ?? false,
|
|
21189
|
+
...result.error ? { error: result.error } : {}
|
|
21190
|
+
});
|
|
21191
|
+
}
|
|
21181
21192
|
await emitChain;
|
|
21182
21193
|
await ctx.relay.sendResult(cmd.id, result.error && action !== "review" ? "failed" : "completed", result);
|
|
21183
21194
|
};
|
|
@@ -21321,12 +21332,12 @@ function buildNpmInstallInvocation(opts) {
|
|
|
21321
21332
|
const entryScript = opts?.entryScript ?? process.argv[1] ?? "";
|
|
21322
21333
|
const execPath = opts?.execPath ?? process.execPath;
|
|
21323
21334
|
const exists2 = opts?.existsSync ?? fs53.existsSync;
|
|
21324
|
-
const normalized = entryScript.split(
|
|
21335
|
+
const normalized = entryScript.split(path57.sep).join("/");
|
|
21325
21336
|
const marker = "/lib/node_modules/codeam-cli/";
|
|
21326
21337
|
const markerIdx = normalized.indexOf(marker);
|
|
21327
21338
|
const prefix = markerIdx > 0 ? entryScript.slice(0, markerIdx) : null;
|
|
21328
|
-
const siblingNpm =
|
|
21329
|
-
|
|
21339
|
+
const siblingNpm = path57.join(
|
|
21340
|
+
path57.dirname(execPath),
|
|
21330
21341
|
process.platform === "win32" ? "npm.cmd" : "npm"
|
|
21331
21342
|
);
|
|
21332
21343
|
const command2 = exists2(siblingNpm) ? siblingNpm : "npm";
|
|
@@ -22169,11 +22180,11 @@ function resolveTokenValue(args2) {
|
|
|
22169
22180
|
}
|
|
22170
22181
|
const fileFlag = args2.find((a) => a.startsWith("--token-file="));
|
|
22171
22182
|
if (fileFlag) {
|
|
22172
|
-
const
|
|
22183
|
+
const path72 = fileFlag.slice("--token-file=".length);
|
|
22173
22184
|
try {
|
|
22174
|
-
const content = fs54.readFileSync(
|
|
22175
|
-
if (content.length === 0) fail(`--token-file ${
|
|
22176
|
-
rmIfExistsQuiet(
|
|
22185
|
+
const content = fs54.readFileSync(path72, "utf8").trim();
|
|
22186
|
+
if (content.length === 0) fail(`--token-file ${path72} is empty`);
|
|
22187
|
+
rmIfExistsQuiet(path72);
|
|
22177
22188
|
return content;
|
|
22178
22189
|
} catch (err) {
|
|
22179
22190
|
fail(`Could not read --token-file: ${err.message}`);
|
|
@@ -22263,7 +22274,7 @@ async function claim(token, pluginId, pluginSecretHash) {
|
|
|
22263
22274
|
}
|
|
22264
22275
|
}
|
|
22265
22276
|
function pairAutoLockPath() {
|
|
22266
|
-
return
|
|
22277
|
+
return path58.join(os43.homedir(), ".codeam", "pair-auto.lock");
|
|
22267
22278
|
}
|
|
22268
22279
|
function isLivePairAuto(pid) {
|
|
22269
22280
|
if (!Number.isInteger(pid) || pid <= 0 || pid === process.pid) return false;
|
|
@@ -22283,12 +22294,12 @@ function isLiveCodeam(pid) {
|
|
|
22283
22294
|
}
|
|
22284
22295
|
function daemonLockPath(sessionId) {
|
|
22285
22296
|
const safe = sessionId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
22286
|
-
return
|
|
22297
|
+
return path58.join(os43.homedir(), ".codeam", `daemon-${safe}.lock`);
|
|
22287
22298
|
}
|
|
22288
22299
|
function acquireDaemonLock(sessionId) {
|
|
22289
22300
|
const lockPath = daemonLockPath(sessionId);
|
|
22290
22301
|
try {
|
|
22291
|
-
fs54.mkdirSync(
|
|
22302
|
+
fs54.mkdirSync(path58.dirname(lockPath), { recursive: true });
|
|
22292
22303
|
try {
|
|
22293
22304
|
fs54.writeFileSync(lockPath, String(process.pid), { flag: "wx" });
|
|
22294
22305
|
} catch (e) {
|
|
@@ -22322,7 +22333,7 @@ function acquireDaemonLock(sessionId) {
|
|
|
22322
22333
|
function acquireSingletonLock() {
|
|
22323
22334
|
const lockPath = pairAutoLockPath();
|
|
22324
22335
|
try {
|
|
22325
|
-
fs54.mkdirSync(
|
|
22336
|
+
fs54.mkdirSync(path58.dirname(lockPath), { recursive: true });
|
|
22326
22337
|
try {
|
|
22327
22338
|
fs54.writeFileSync(lockPath, String(process.pid), { flag: "wx" });
|
|
22328
22339
|
} catch (e) {
|
|
@@ -22779,7 +22790,7 @@ var AgentService = class _AgentService {
|
|
|
22779
22790
|
};
|
|
22780
22791
|
|
|
22781
22792
|
// src/agents/acp/adapters.ts
|
|
22782
|
-
var
|
|
22793
|
+
var path60 = __toESM(require("path"));
|
|
22783
22794
|
|
|
22784
22795
|
// src/agents/acp/agent-binary.ts
|
|
22785
22796
|
var import_fs4 = __toESM(require("fs"));
|
|
@@ -23021,13 +23032,13 @@ function resolveBin(pkgName, binName) {
|
|
|
23021
23032
|
try {
|
|
23022
23033
|
const manifestPath = require_.resolve(`${pkgName}/package.json`);
|
|
23023
23034
|
const manifest = require_(`${pkgName}/package.json`);
|
|
23024
|
-
const pkgDir =
|
|
23035
|
+
const pkgDir = path60.dirname(manifestPath);
|
|
23025
23036
|
const bin = manifest.bin;
|
|
23026
23037
|
if (!bin) return null;
|
|
23027
|
-
if (typeof bin === "string") return
|
|
23038
|
+
if (typeof bin === "string") return path60.resolve(pkgDir, bin);
|
|
23028
23039
|
const target = binName ?? Object.keys(bin)[0];
|
|
23029
23040
|
if (!target || !bin[target]) return null;
|
|
23030
|
-
return
|
|
23041
|
+
return path60.resolve(pkgDir, bin[target]);
|
|
23031
23042
|
} catch {
|
|
23032
23043
|
return null;
|
|
23033
23044
|
}
|
|
@@ -23132,7 +23143,7 @@ var import_node_crypto10 = require("crypto");
|
|
|
23132
23143
|
|
|
23133
23144
|
// src/services/history.service.ts
|
|
23134
23145
|
var fs56 = __toESM(require("fs"));
|
|
23135
|
-
var
|
|
23146
|
+
var path61 = __toESM(require("path"));
|
|
23136
23147
|
var os45 = __toESM(require("os"));
|
|
23137
23148
|
var https7 = __toESM(require("https"));
|
|
23138
23149
|
var http6 = __toESM(require("http"));
|
|
@@ -23301,7 +23312,7 @@ var HistoryService = class _HistoryService {
|
|
|
23301
23312
|
return this._quotaPercent === null || Date.now() - this._quotaFetchedAt > ttlMs;
|
|
23302
23313
|
}
|
|
23303
23314
|
get projectDir() {
|
|
23304
|
-
return this.runtime.resolveHistoryDir(this.cwd) ??
|
|
23315
|
+
return this.runtime.resolveHistoryDir(this.cwd) ?? path61.join(os45.homedir(), ".claude", "projects", encodeCwd(this.cwd));
|
|
23305
23316
|
}
|
|
23306
23317
|
/** Set the current Claude conversation ID (extracted from /cost command or session start) */
|
|
23307
23318
|
setCurrentConversationId(id) {
|
|
@@ -23313,7 +23324,7 @@ var HistoryService = class _HistoryService {
|
|
|
23313
23324
|
/** Return the current message count in the active conversation. */
|
|
23314
23325
|
getCurrentMessageCount() {
|
|
23315
23326
|
if (!this.currentConversationId) return 0;
|
|
23316
|
-
const filePath =
|
|
23327
|
+
const filePath = path61.join(this.projectDir, `${this.currentConversationId}.jsonl`);
|
|
23317
23328
|
return parseJsonl(filePath).length;
|
|
23318
23329
|
}
|
|
23319
23330
|
/**
|
|
@@ -23324,7 +23335,7 @@ var HistoryService = class _HistoryService {
|
|
|
23324
23335
|
const deadline = Date.now() + timeoutMs;
|
|
23325
23336
|
while (Date.now() < deadline) {
|
|
23326
23337
|
if (!this.currentConversationId) return null;
|
|
23327
|
-
const filePath =
|
|
23338
|
+
const filePath = path61.join(this.projectDir, `${this.currentConversationId}.jsonl`);
|
|
23328
23339
|
const messages = parseJsonl(filePath);
|
|
23329
23340
|
if (messages.length > previousCount) {
|
|
23330
23341
|
for (let i = messages.length - 1; i >= previousCount; i--) {
|
|
@@ -23352,14 +23363,14 @@ var HistoryService = class _HistoryService {
|
|
|
23352
23363
|
try {
|
|
23353
23364
|
const files = fs56.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isFile() && e.name.endsWith(".jsonl")).map((e) => {
|
|
23354
23365
|
try {
|
|
23355
|
-
const stat3 = fs56.statSync(
|
|
23366
|
+
const stat3 = fs56.statSync(path61.join(dir, e.name));
|
|
23356
23367
|
return { name: e.name, mtime: stat3.mtimeMs, birthtime: stat3.birthtimeMs };
|
|
23357
23368
|
} catch {
|
|
23358
23369
|
return { name: e.name, mtime: 0, birthtime: 0 };
|
|
23359
23370
|
}
|
|
23360
23371
|
}).filter((f) => f.birthtime >= cutoff).sort((a, b) => b.mtime - a.mtime);
|
|
23361
23372
|
if (files.length > 0) {
|
|
23362
|
-
this.currentConversationId =
|
|
23373
|
+
this.currentConversationId = path61.basename(files[0].name, ".jsonl");
|
|
23363
23374
|
}
|
|
23364
23375
|
} catch {
|
|
23365
23376
|
}
|
|
@@ -23399,7 +23410,7 @@ var HistoryService = class _HistoryService {
|
|
|
23399
23410
|
}
|
|
23400
23411
|
const files = entries.filter((e) => e.isFile() && e.name.endsWith(".jsonl")).map((e) => {
|
|
23401
23412
|
try {
|
|
23402
|
-
const stat3 = fs56.statSync(
|
|
23413
|
+
const stat3 = fs56.statSync(path61.join(dir, e.name));
|
|
23403
23414
|
return { name: e.name, mtime: stat3.mtimeMs, birthtime: stat3.birthtimeMs };
|
|
23404
23415
|
} catch {
|
|
23405
23416
|
return { name: e.name, mtime: 0, birthtime: 0 };
|
|
@@ -23408,7 +23419,7 @@ var HistoryService = class _HistoryService {
|
|
|
23408
23419
|
if (files.length === 0) return null;
|
|
23409
23420
|
const targetFile = this.currentConversationId ? `${this.currentConversationId}.jsonl` : files[0].name;
|
|
23410
23421
|
if (!files.some((f) => f.name === targetFile)) return null;
|
|
23411
|
-
return this.extractUsageFromFile(
|
|
23422
|
+
return this.extractUsageFromFile(path61.join(dir, targetFile));
|
|
23412
23423
|
}
|
|
23413
23424
|
extractUsageFromFile(filePath) {
|
|
23414
23425
|
let raw;
|
|
@@ -23460,7 +23471,7 @@ var HistoryService = class _HistoryService {
|
|
|
23460
23471
|
try {
|
|
23461
23472
|
files = fs56.readdirSync(projectDir).filter((f) => f.endsWith(".jsonl")).filter((f) => {
|
|
23462
23473
|
try {
|
|
23463
|
-
return fs56.statSync(
|
|
23474
|
+
return fs56.statSync(path61.join(projectDir, f)).mtimeMs >= monthStartMs;
|
|
23464
23475
|
} catch {
|
|
23465
23476
|
return false;
|
|
23466
23477
|
}
|
|
@@ -23471,7 +23482,7 @@ var HistoryService = class _HistoryService {
|
|
|
23471
23482
|
for (const file of files) {
|
|
23472
23483
|
let raw;
|
|
23473
23484
|
try {
|
|
23474
|
-
raw = fs56.readFileSync(
|
|
23485
|
+
raw = fs56.readFileSync(path61.join(projectDir, file), "utf8");
|
|
23475
23486
|
} catch {
|
|
23476
23487
|
continue;
|
|
23477
23488
|
}
|
|
@@ -23550,7 +23561,7 @@ var HistoryService = class _HistoryService {
|
|
|
23550
23561
|
if (this.runtime.resolveHistoryFile) {
|
|
23551
23562
|
return this.runtime.resolveHistoryFile(this.cwd, sessionId);
|
|
23552
23563
|
}
|
|
23553
|
-
return
|
|
23564
|
+
return path61.join(this.projectDir, `${sessionId}.jsonl`);
|
|
23554
23565
|
}
|
|
23555
23566
|
/**
|
|
23556
23567
|
* Parse a conversation's messages from disk, agent-aware. Claude uses the
|
|
@@ -23584,7 +23595,7 @@ var HistoryService = class _HistoryService {
|
|
|
23584
23595
|
};
|
|
23585
23596
|
});
|
|
23586
23597
|
}
|
|
23587
|
-
return parseJsonl(
|
|
23598
|
+
return parseJsonl(path61.join(this.projectDir, `${sessionId}.jsonl`));
|
|
23588
23599
|
}
|
|
23589
23600
|
async loadConversation(sessionId) {
|
|
23590
23601
|
const messages = this.readConversation(sessionId);
|
|
@@ -23712,7 +23723,7 @@ var import_node_child_process26 = require("child_process");
|
|
|
23712
23723
|
var fs57 = __toESM(require("fs/promises"));
|
|
23713
23724
|
var fsSync = __toESM(require("fs"));
|
|
23714
23725
|
var os46 = __toESM(require("os"));
|
|
23715
|
-
var
|
|
23726
|
+
var path62 = __toESM(require("path"));
|
|
23716
23727
|
var import_node_stream = require("stream");
|
|
23717
23728
|
|
|
23718
23729
|
// ../../node_modules/@agentclientprotocol/sdk/dist/acp.js
|
|
@@ -26700,24 +26711,24 @@ function knownAgentBinaryDirs() {
|
|
|
26700
26711
|
out2.push("/tmp/codeam-node20/bin");
|
|
26701
26712
|
for (const root of [
|
|
26702
26713
|
"/usr/local/share/nvm/versions/node",
|
|
26703
|
-
|
|
26714
|
+
path62.join(home, ".nvm/versions/node")
|
|
26704
26715
|
]) {
|
|
26705
26716
|
try {
|
|
26706
26717
|
for (const child of fsSync.readdirSync(root)) {
|
|
26707
|
-
out2.push(
|
|
26718
|
+
out2.push(path62.join(root, child, "bin"));
|
|
26708
26719
|
}
|
|
26709
26720
|
} catch {
|
|
26710
26721
|
}
|
|
26711
26722
|
}
|
|
26712
|
-
out2.push(
|
|
26723
|
+
out2.push(path62.join(home, ".volta/bin"));
|
|
26713
26724
|
out2.push("/usr/local/bin");
|
|
26714
26725
|
out2.push("/usr/bin");
|
|
26715
|
-
out2.push(
|
|
26716
|
-
out2.push(
|
|
26726
|
+
out2.push(path62.join(home, ".local/bin"));
|
|
26727
|
+
out2.push(path62.join(home, "bin"));
|
|
26717
26728
|
if (process.platform === "win32") {
|
|
26718
26729
|
const { LOCALAPPDATA, APPDATA } = process.env;
|
|
26719
|
-
if (LOCALAPPDATA) out2.push(
|
|
26720
|
-
if (APPDATA) out2.push(
|
|
26730
|
+
if (LOCALAPPDATA) out2.push(path62.join(LOCALAPPDATA, "cursor-agent"));
|
|
26731
|
+
if (APPDATA) out2.push(path62.join(APPDATA, "npm"));
|
|
26721
26732
|
}
|
|
26722
26733
|
return out2.filter((p2) => {
|
|
26723
26734
|
try {
|
|
@@ -26729,7 +26740,7 @@ function knownAgentBinaryDirs() {
|
|
|
26729
26740
|
}
|
|
26730
26741
|
function expandPathForAgentBinaries(existingPath) {
|
|
26731
26742
|
const existing = new Set(
|
|
26732
|
-
existingPath.split(
|
|
26743
|
+
existingPath.split(path62.delimiter).filter((p2) => p2.length > 0)
|
|
26733
26744
|
);
|
|
26734
26745
|
const additions = [];
|
|
26735
26746
|
for (const dir of knownAgentBinaryDirs()) {
|
|
@@ -26739,7 +26750,7 @@ function expandPathForAgentBinaries(existingPath) {
|
|
|
26739
26750
|
}
|
|
26740
26751
|
}
|
|
26741
26752
|
if (additions.length === 0) return existingPath;
|
|
26742
|
-
return [...additions, existingPath].filter((p2) => p2.length > 0).join(
|
|
26753
|
+
return [...additions, existingPath].filter((p2) => p2.length > 0).join(path62.delimiter);
|
|
26743
26754
|
}
|
|
26744
26755
|
|
|
26745
26756
|
// src/agents/acp/headroom-budget-proxy.ts
|
|
@@ -27223,12 +27234,12 @@ function commonPrefixLength(a, b) {
|
|
|
27223
27234
|
var import_child_process26 = require("child_process");
|
|
27224
27235
|
var fs58 = __toESM(require("fs"));
|
|
27225
27236
|
var os47 = __toESM(require("os"));
|
|
27226
|
-
var
|
|
27237
|
+
var path63 = __toESM(require("path"));
|
|
27227
27238
|
var _onboardingSeam = {
|
|
27228
|
-
markerPath: (sessionId) =>
|
|
27239
|
+
markerPath: (sessionId) => path63.join(os47.homedir(), ".codeam", "welcomed", `${sessionId}.done`),
|
|
27229
27240
|
exists: (p2) => fs58.existsSync(p2),
|
|
27230
27241
|
write: (p2) => {
|
|
27231
|
-
fs58.mkdirSync(
|
|
27242
|
+
fs58.mkdirSync(path63.dirname(p2), { recursive: true });
|
|
27232
27243
|
fs58.writeFileSync(p2, "");
|
|
27233
27244
|
},
|
|
27234
27245
|
disabled: () => {
|
|
@@ -27266,7 +27277,7 @@ function resolveRepoName(cwd) {
|
|
|
27266
27277
|
if (name) return name;
|
|
27267
27278
|
}
|
|
27268
27279
|
}
|
|
27269
|
-
const base =
|
|
27280
|
+
const base = path63.basename(cwd || "");
|
|
27270
27281
|
if (base && !isUuid(base)) return base;
|
|
27271
27282
|
return "this project";
|
|
27272
27283
|
}
|
|
@@ -27519,7 +27530,7 @@ var import_crypto5 = require("crypto");
|
|
|
27519
27530
|
// src/services/turn-files/git-changeset.ts
|
|
27520
27531
|
var import_child_process27 = require("child_process");
|
|
27521
27532
|
var fs59 = __toESM(require("fs/promises"));
|
|
27522
|
-
var
|
|
27533
|
+
var path64 = __toESM(require("path"));
|
|
27523
27534
|
async function collectRepoChangeset(opts) {
|
|
27524
27535
|
const status2 = await runGit3(opts.repoRoot, ["status", "--porcelain=v1", "-z"]);
|
|
27525
27536
|
if (status2 === null) return null;
|
|
@@ -27537,7 +27548,7 @@ async function collectRepoChangeset(opts) {
|
|
|
27537
27548
|
let stats;
|
|
27538
27549
|
if (row.fileStatus === "added" && numstatEntry === void 0) {
|
|
27539
27550
|
const lineCount = await readUntrackedLineCount(
|
|
27540
|
-
|
|
27551
|
+
path64.join(opts.repoRoot, row.filePath)
|
|
27541
27552
|
);
|
|
27542
27553
|
stats = { added: lineCount, removed: 0 };
|
|
27543
27554
|
} else {
|
|
@@ -27679,8 +27690,8 @@ async function discoverRepos(workingDir, maxDepth = 4) {
|
|
|
27679
27690
|
if (hasGit) {
|
|
27680
27691
|
out2.push({
|
|
27681
27692
|
repoRoot: dir,
|
|
27682
|
-
repoPath:
|
|
27683
|
-
repoName:
|
|
27693
|
+
repoPath: path64.relative(workingDir, dir),
|
|
27694
|
+
repoName: path64.basename(dir)
|
|
27684
27695
|
});
|
|
27685
27696
|
return;
|
|
27686
27697
|
}
|
|
@@ -27688,14 +27699,14 @@ async function discoverRepos(workingDir, maxDepth = 4) {
|
|
|
27688
27699
|
if (!entry.isDirectory) continue;
|
|
27689
27700
|
if (entry.name === "node_modules") continue;
|
|
27690
27701
|
if (entry.name === "dist" || entry.name === "build") continue;
|
|
27691
|
-
await walk(
|
|
27702
|
+
await walk(path64.join(dir, entry.name), depth + 1);
|
|
27692
27703
|
}
|
|
27693
27704
|
}
|
|
27694
27705
|
}
|
|
27695
27706
|
|
|
27696
27707
|
// src/services/turn-files/files-outbox.ts
|
|
27697
27708
|
var fs60 = __toESM(require("fs/promises"));
|
|
27698
|
-
var
|
|
27709
|
+
var path65 = __toESM(require("path"));
|
|
27699
27710
|
var import_os12 = require("os");
|
|
27700
27711
|
var HOME_OUTBOX_DIR = ".codeam/outbox";
|
|
27701
27712
|
var MAX_AGE_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -27728,15 +27739,15 @@ var FilesOutbox = class {
|
|
|
27728
27739
|
backoffIndex = 0;
|
|
27729
27740
|
stopped = false;
|
|
27730
27741
|
constructor(opts) {
|
|
27731
|
-
const base = opts.baseDir ??
|
|
27732
|
-
this.filePath =
|
|
27742
|
+
const base = opts.baseDir ?? path65.join(homeDir(), HOME_OUTBOX_DIR);
|
|
27743
|
+
this.filePath = path65.join(base, `${opts.sessionId}.jsonl`);
|
|
27733
27744
|
this.post = opts.post;
|
|
27734
27745
|
this.autoSchedule = opts.autoSchedule !== false;
|
|
27735
27746
|
}
|
|
27736
27747
|
/** Persist the entry to disk and trigger a flush. Returns once the
|
|
27737
27748
|
* line is durable on disk (not once the POST succeeds). */
|
|
27738
27749
|
async enqueue(entry) {
|
|
27739
|
-
await fs60.mkdir(
|
|
27750
|
+
await fs60.mkdir(path65.dirname(this.filePath), { recursive: true });
|
|
27740
27751
|
await fs60.appendFile(this.filePath, JSON.stringify(entry) + "\n", "utf8");
|
|
27741
27752
|
this.backoffIndex = 0;
|
|
27742
27753
|
if (this.autoSchedule) this.scheduleFlush(0);
|
|
@@ -31281,10 +31292,10 @@ function toEpochMs(ts) {
|
|
|
31281
31292
|
// src/agents/claude/onboarding.ts
|
|
31282
31293
|
var fs62 = __toESM(require("fs"));
|
|
31283
31294
|
var os48 = __toESM(require("os"));
|
|
31284
|
-
var
|
|
31295
|
+
var path66 = __toESM(require("path"));
|
|
31285
31296
|
function ensureClaudeOnboarded() {
|
|
31286
31297
|
try {
|
|
31287
|
-
const file =
|
|
31298
|
+
const file = path66.join(os48.homedir(), ".claude.json");
|
|
31288
31299
|
let config = {};
|
|
31289
31300
|
try {
|
|
31290
31301
|
config = JSON.parse(fs62.readFileSync(file, "utf8"));
|
|
@@ -31298,7 +31309,7 @@ function ensureClaudeOnboarded() {
|
|
|
31298
31309
|
if (typeof config.lastOnboardingVersion !== "string") {
|
|
31299
31310
|
config.lastOnboardingVersion = "2.1.177";
|
|
31300
31311
|
}
|
|
31301
|
-
fs62.mkdirSync(
|
|
31312
|
+
fs62.mkdirSync(path66.dirname(file), { recursive: true });
|
|
31302
31313
|
fs62.writeFileSync(file, JSON.stringify(config, null, 2));
|
|
31303
31314
|
log.info("claude", "pre-completed Claude onboarding (skip first-run theme picker)");
|
|
31304
31315
|
} catch (err) {
|
|
@@ -31973,7 +31984,7 @@ var import_picocolors11 = __toESM(require("picocolors"));
|
|
|
31973
31984
|
var import_child_process28 = require("child_process");
|
|
31974
31985
|
var import_util4 = require("util");
|
|
31975
31986
|
var import_picocolors9 = __toESM(require("picocolors"));
|
|
31976
|
-
var
|
|
31987
|
+
var path67 = __toESM(require("path"));
|
|
31977
31988
|
var execFileP6 = (0, import_util4.promisify)(import_child_process28.execFile);
|
|
31978
31989
|
var MAX_BUFFER = 8 * 1024 * 1024;
|
|
31979
31990
|
function resetStdinForChild() {
|
|
@@ -32462,7 +32473,7 @@ var GitHubCodespacesProvider = class {
|
|
|
32462
32473
|
});
|
|
32463
32474
|
}
|
|
32464
32475
|
async uploadFile(workspaceId, remotePath, contents, options = {}) {
|
|
32465
|
-
const remoteDir =
|
|
32476
|
+
const remoteDir = path67.posix.dirname(remotePath);
|
|
32466
32477
|
const parts = [
|
|
32467
32478
|
`mkdir -p ${shellQuote(remoteDir)}`,
|
|
32468
32479
|
`cat > ${shellQuote(remotePath)}`
|
|
@@ -32532,7 +32543,7 @@ function shellQuote(s) {
|
|
|
32532
32543
|
// src/services/providers/gitpod.ts
|
|
32533
32544
|
var import_child_process29 = require("child_process");
|
|
32534
32545
|
var import_util5 = require("util");
|
|
32535
|
-
var
|
|
32546
|
+
var path68 = __toESM(require("path"));
|
|
32536
32547
|
var import_picocolors10 = __toESM(require("picocolors"));
|
|
32537
32548
|
var execFileP7 = (0, import_util5.promisify)(import_child_process29.execFile);
|
|
32538
32549
|
var MAX_BUFFER2 = 8 * 1024 * 1024;
|
|
@@ -32772,7 +32783,7 @@ var GitpodProvider = class {
|
|
|
32772
32783
|
});
|
|
32773
32784
|
}
|
|
32774
32785
|
async uploadFile(workspaceId, remotePath, contents, options = {}) {
|
|
32775
|
-
const remoteDir =
|
|
32786
|
+
const remoteDir = path68.posix.dirname(remotePath);
|
|
32776
32787
|
const parts = [
|
|
32777
32788
|
`mkdir -p ${shellQuote2(remoteDir)}`,
|
|
32778
32789
|
`cat > ${shellQuote2(remotePath)}`
|
|
@@ -32808,7 +32819,7 @@ function shellQuote2(s) {
|
|
|
32808
32819
|
// src/services/providers/gitlab-workspaces.ts
|
|
32809
32820
|
var import_child_process30 = require("child_process");
|
|
32810
32821
|
var import_util6 = require("util");
|
|
32811
|
-
var
|
|
32822
|
+
var path69 = __toESM(require("path"));
|
|
32812
32823
|
var execFileP8 = (0, import_util6.promisify)(import_child_process30.execFile);
|
|
32813
32824
|
var MAX_BUFFER3 = 8 * 1024 * 1024;
|
|
32814
32825
|
var GITLAB_API_BASE = process.env.CODEAM_GITLAB_API_URL ?? "https://gitlab.com/api/v4";
|
|
@@ -33068,7 +33079,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
33068
33079
|
}
|
|
33069
33080
|
async uploadFile(workspaceId, remotePath, contents, options = {}) {
|
|
33070
33081
|
const sshHost = process.env.CODEAM_GITLAB_SSH_HOST ?? "workspaces.gitlab.com";
|
|
33071
|
-
const remoteDir =
|
|
33082
|
+
const remoteDir = path69.posix.dirname(remotePath);
|
|
33072
33083
|
const parts = [`mkdir -p ${shellQuote3(remoteDir)}`, `cat > ${shellQuote3(remotePath)}`];
|
|
33073
33084
|
if (options.mode != null) {
|
|
33074
33085
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote3(remotePath)}`);
|
|
@@ -33136,7 +33147,7 @@ function shellQuote3(s) {
|
|
|
33136
33147
|
// src/services/providers/railway.ts
|
|
33137
33148
|
var import_child_process31 = require("child_process");
|
|
33138
33149
|
var import_util7 = require("util");
|
|
33139
|
-
var
|
|
33150
|
+
var path70 = __toESM(require("path"));
|
|
33140
33151
|
var execFileP9 = (0, import_util7.promisify)(import_child_process31.execFile);
|
|
33141
33152
|
var MAX_BUFFER4 = 8 * 1024 * 1024;
|
|
33142
33153
|
function resetStdinForChild4() {
|
|
@@ -33372,7 +33383,7 @@ var RailwayProvider = class {
|
|
|
33372
33383
|
if (!projectId || !serviceId) {
|
|
33373
33384
|
throw new Error("Invalid Railway workspace id (expected projectId/serviceId).");
|
|
33374
33385
|
}
|
|
33375
|
-
const remoteDir =
|
|
33386
|
+
const remoteDir = path70.posix.dirname(remotePath);
|
|
33376
33387
|
const parts = [`mkdir -p ${shellQuote4(remoteDir)}`, `cat > ${shellQuote4(remotePath)}`];
|
|
33377
33388
|
if (options.mode != null) {
|
|
33378
33389
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote4(remotePath)}`);
|
|
@@ -34019,7 +34030,7 @@ var import_node_dns = require("dns");
|
|
|
34019
34030
|
var import_node_util5 = require("util");
|
|
34020
34031
|
var import_node_crypto12 = require("crypto");
|
|
34021
34032
|
var fs63 = __toESM(require("fs"));
|
|
34022
|
-
var
|
|
34033
|
+
var path71 = __toESM(require("path"));
|
|
34023
34034
|
var import_picocolors14 = __toESM(require("picocolors"));
|
|
34024
34035
|
var dnsResolveP = (0, import_node_util5.promisify)(import_node_dns.resolve);
|
|
34025
34036
|
async function checkDns(apiBase2) {
|
|
@@ -34075,10 +34086,10 @@ async function checkHealth(apiBase2) {
|
|
|
34075
34086
|
}
|
|
34076
34087
|
}
|
|
34077
34088
|
function checkConfigDir() {
|
|
34078
|
-
const dir =
|
|
34089
|
+
const dir = path71.join(require("os").homedir(), ".codeam");
|
|
34079
34090
|
try {
|
|
34080
34091
|
fs63.mkdirSync(dir, { recursive: true, mode: 448 });
|
|
34081
|
-
const probe =
|
|
34092
|
+
const probe = path71.join(dir, ".doctor-probe");
|
|
34082
34093
|
fs63.writeFileSync(probe, "ok", { mode: 384 });
|
|
34083
34094
|
const read2 = fs63.readFileSync(probe, "utf8");
|
|
34084
34095
|
fs63.unlinkSync(probe);
|
|
@@ -34145,7 +34156,7 @@ function checkNodePty() {
|
|
|
34145
34156
|
detail: "not required on this platform"
|
|
34146
34157
|
};
|
|
34147
34158
|
}
|
|
34148
|
-
const vendoredPath =
|
|
34159
|
+
const vendoredPath = path71.join(__dirname, "vendor", "node-pty");
|
|
34149
34160
|
for (const target of [vendoredPath, "node-pty"]) {
|
|
34150
34161
|
try {
|
|
34151
34162
|
require(target);
|
|
@@ -34187,7 +34198,7 @@ function checkChokidar() {
|
|
|
34187
34198
|
}
|
|
34188
34199
|
async function doctor(args2 = []) {
|
|
34189
34200
|
const json = args2.includes("--json");
|
|
34190
|
-
const cliVersion = true ? "2.60.
|
|
34201
|
+
const cliVersion = true ? "2.60.28" : "0.0.0-dev";
|
|
34191
34202
|
const apiBase2 = resolveApiBaseUrl();
|
|
34192
34203
|
const diagnosticId = (0, import_node_crypto12.randomUUID)();
|
|
34193
34204
|
log.info("doctor", `run id=${diagnosticId} cli=${cliVersion}`);
|
|
@@ -34386,7 +34397,7 @@ async function completion(args2) {
|
|
|
34386
34397
|
// src/commands/version.ts
|
|
34387
34398
|
var import_picocolors15 = __toESM(require("picocolors"));
|
|
34388
34399
|
function version2() {
|
|
34389
|
-
const v = true ? "2.60.
|
|
34400
|
+
const v = true ? "2.60.28" : "unknown";
|
|
34390
34401
|
console.log(`${import_picocolors15.default.bold("codeam-cli")} ${import_picocolors15.default.cyan(v)}`);
|
|
34391
34402
|
}
|
|
34392
34403
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeam-cli",
|
|
3
|
-
"version": "2.60.
|
|
3
|
+
"version": "2.60.28",
|
|
4
4
|
"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 — async. The terminal companion for CodeAgent Mobile.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "dist/index.js",
|