codeam-cli 2.60.25 → 2.60.27
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 +26 -0
- package/dist/index.js +195 -182
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,32 @@ 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.26] — 2026-07-09
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **shared:** CodeRabbit links via oauth_token (loopback) — vault gate
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- **cli:** Kimi — provision config.toml on self-hosted (Windows-safe), fixing "Model: not set"
|
|
16
|
+
|
|
17
|
+
## [2.60.25] — 2026-07-09
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- **cli:** Kimi — provision config.toml on self-hosted (Windows-safe), fixing "Model: not set"
|
|
22
|
+
|
|
23
|
+
## [2.60.24] — 2026-07-09
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
|
|
27
|
+
- **cli:** Coderabbit reviewer — link (OAuth + API key) + review relay wiring
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- **cli:** Show OS-correct install hint for kimi/cursor on Windows
|
|
32
|
+
|
|
7
33
|
## [2.60.23] — 2026-07-09
|
|
8
34
|
|
|
9
35
|
### Added
|
package/dist/index.js
CHANGED
|
@@ -330,10 +330,14 @@ var AGENT_REGISTRY = {
|
|
|
330
330
|
displayName: "CodeRabbit",
|
|
331
331
|
binaryName: "coderabbit",
|
|
332
332
|
enabled: true,
|
|
333
|
-
//
|
|
334
|
-
//
|
|
335
|
-
|
|
336
|
-
|
|
333
|
+
// CodeRabbit links via a CLI-driven LOOPBACK OAuth (`coderabbit auth
|
|
334
|
+
// login --agent`): the CLI captures the token and hands it to the vault
|
|
335
|
+
// through `linkFromCli` (method:'oauth'), same as the terminal handoff.
|
|
336
|
+
// `oauth_token` is preferred; a real API key is still accepted as a
|
|
337
|
+
// fallback. There is no backend PKCE provider — the loopback runs on the
|
|
338
|
+
// user's own machine, so linking is always CLI-mediated.
|
|
339
|
+
supportedAuthKinds: ["oauth_token", "api_key"],
|
|
340
|
+
preferredAuthKind: "oauth_token",
|
|
337
341
|
headroomWrappable: false,
|
|
338
342
|
// Legacy PTY runtime — no ACP adapter registered.
|
|
339
343
|
acp: false
|
|
@@ -778,11 +782,11 @@ function quiet(fn) {
|
|
|
778
782
|
log.debug(TAG, "ignored sync error", err);
|
|
779
783
|
}
|
|
780
784
|
}
|
|
781
|
-
function rmIfExistsQuiet(
|
|
785
|
+
function rmIfExistsQuiet(path72) {
|
|
782
786
|
try {
|
|
783
|
-
fs2.rmSync(
|
|
787
|
+
fs2.rmSync(path72, { force: true });
|
|
784
788
|
} catch (err) {
|
|
785
|
-
log.debug(TAG, `rmIfExists failed for ${
|
|
789
|
+
log.debug(TAG, `rmIfExists failed for ${path72}`, err);
|
|
786
790
|
}
|
|
787
791
|
}
|
|
788
792
|
function killQuiet(target, signal = "SIGTERM") {
|
|
@@ -930,7 +934,7 @@ var { getConfig, ensurePluginId, addSession, removeSession, setActiveSession, ge
|
|
|
930
934
|
// src/commands/pair-auto.ts
|
|
931
935
|
var fs54 = __toESM(require("fs"));
|
|
932
936
|
var os43 = __toESM(require("os"));
|
|
933
|
-
var
|
|
937
|
+
var path58 = __toESM(require("path"));
|
|
934
938
|
var import_crypto4 = require("crypto");
|
|
935
939
|
|
|
936
940
|
// src/services/telemetry.service.ts
|
|
@@ -966,8 +970,8 @@ function createGetModuleFromFilename(basePath = process.argv[1] ? (0, import_pat
|
|
|
966
970
|
return decodedFile;
|
|
967
971
|
};
|
|
968
972
|
}
|
|
969
|
-
function normalizeWindowsPath(
|
|
970
|
-
return
|
|
973
|
+
function normalizeWindowsPath(path72) {
|
|
974
|
+
return path72.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
|
|
971
975
|
}
|
|
972
976
|
|
|
973
977
|
// ../../node_modules/@posthog/core/dist/featureFlagUtils.mjs
|
|
@@ -3447,9 +3451,9 @@ async function addSourceContext(frames) {
|
|
|
3447
3451
|
LRU_FILE_CONTENTS_CACHE.reduce();
|
|
3448
3452
|
return frames;
|
|
3449
3453
|
}
|
|
3450
|
-
function getContextLinesFromFile(
|
|
3454
|
+
function getContextLinesFromFile(path72, ranges, output) {
|
|
3451
3455
|
return new Promise((resolve7) => {
|
|
3452
|
-
const stream = (0, import_node_fs.createReadStream)(
|
|
3456
|
+
const stream = (0, import_node_fs.createReadStream)(path72);
|
|
3453
3457
|
const lineReaded = (0, import_node_readline.createInterface)({
|
|
3454
3458
|
input: stream
|
|
3455
3459
|
});
|
|
@@ -3464,7 +3468,7 @@ function getContextLinesFromFile(path71, ranges, output) {
|
|
|
3464
3468
|
let rangeStart = range[0];
|
|
3465
3469
|
let rangeEnd = range[1];
|
|
3466
3470
|
function onStreamError() {
|
|
3467
|
-
LRU_FILE_CONTENTS_FS_READ_FAILED.set(
|
|
3471
|
+
LRU_FILE_CONTENTS_FS_READ_FAILED.set(path72, 1);
|
|
3468
3472
|
lineReaded.close();
|
|
3469
3473
|
lineReaded.removeAllListeners();
|
|
3470
3474
|
destroyStreamAndResolve();
|
|
@@ -3525,8 +3529,8 @@ function clearLineContext(frame) {
|
|
|
3525
3529
|
delete frame.context_line;
|
|
3526
3530
|
delete frame.post_context;
|
|
3527
3531
|
}
|
|
3528
|
-
function shouldSkipContextLinesForFile(
|
|
3529
|
-
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:");
|
|
3530
3534
|
}
|
|
3531
3535
|
function shouldSkipContextLinesForFrame(frame) {
|
|
3532
3536
|
if (void 0 !== frame.lineno && frame.lineno > MAX_CONTEXTLINES_LINENO) return true;
|
|
@@ -5680,7 +5684,7 @@ function readAnonId() {
|
|
|
5680
5684
|
}
|
|
5681
5685
|
function superProperties() {
|
|
5682
5686
|
return {
|
|
5683
|
-
cliVersion: true ? "2.60.
|
|
5687
|
+
cliVersion: true ? "2.60.27" : "0.0.0-dev",
|
|
5684
5688
|
nodeVersion: process.version,
|
|
5685
5689
|
platform: process.platform,
|
|
5686
5690
|
arch: process.arch,
|
|
@@ -5861,7 +5865,7 @@ var os4 = __toESM(require("os"));
|
|
|
5861
5865
|
// package.json
|
|
5862
5866
|
var package_default = {
|
|
5863
5867
|
name: "codeam-cli",
|
|
5864
|
-
version: "2.60.
|
|
5868
|
+
version: "2.60.27",
|
|
5865
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.",
|
|
5866
5870
|
type: "commonjs",
|
|
5867
5871
|
main: "dist/index.js",
|
|
@@ -6954,7 +6958,7 @@ var CommandRelayService = class {
|
|
|
6954
6958
|
// fresh + clear the "CLI update available" banner after a self-update
|
|
6955
6959
|
// (a codespace that reinstalls @latest reconnects via heartbeat, not
|
|
6956
6960
|
// pair/reconnect). Older backends ignore the extra field.
|
|
6957
|
-
..."2.60.
|
|
6961
|
+
..."2.60.27" ? { ideVersion: "2.60.27" } : {}
|
|
6958
6962
|
}).then(() => log.trace("relay", `heartbeat ok online=${online}`)).catch((err) => log.trace("relay", `heartbeat failed online=${online}`, err));
|
|
6959
6963
|
}
|
|
6960
6964
|
/**
|
|
@@ -8330,7 +8334,7 @@ function closeAllTerminals() {
|
|
|
8330
8334
|
// src/commands/start/handlers.ts
|
|
8331
8335
|
var fs53 = __toESM(require("fs"));
|
|
8332
8336
|
var os42 = __toESM(require("os"));
|
|
8333
|
-
var
|
|
8337
|
+
var path57 = __toESM(require("path"));
|
|
8334
8338
|
var import_crypto3 = require("crypto");
|
|
8335
8339
|
var import_child_process23 = require("child_process");
|
|
8336
8340
|
|
|
@@ -13512,14 +13516,14 @@ function pickLine(obj) {
|
|
|
13512
13516
|
function toHunk(raw, groupSeverity) {
|
|
13513
13517
|
if (!raw || typeof raw !== "object") return null;
|
|
13514
13518
|
const o = raw;
|
|
13515
|
-
const
|
|
13516
|
-
if (!
|
|
13519
|
+
const path72 = asString(pick(o, ["file_path", "filePath", "file", "path", "filename"])) ?? asString(pick(o, ["location"])?.path);
|
|
13520
|
+
if (!path72) return null;
|
|
13517
13521
|
const message = asString(pick(o, ["comment", "message", "body", "description", "summary", "markdown", "text"])) ?? "";
|
|
13518
13522
|
const title = asString(pick(o, ["title", "rule", "category", "check"]));
|
|
13519
13523
|
const severity = normSeverity(pick(o, ["severity", "level", "priority", "impact"])) ?? normSeverity(groupSeverity);
|
|
13520
13524
|
const locObj = pick(o, ["location"]) ?? o;
|
|
13521
13525
|
return {
|
|
13522
|
-
path:
|
|
13526
|
+
path: path72.trim(),
|
|
13523
13527
|
line: pickLine(o) ?? pickLine(locObj),
|
|
13524
13528
|
severity,
|
|
13525
13529
|
message: (title && message ? `${title}: ${message}` : title || message).trim() || "(no message)"
|
|
@@ -13597,10 +13601,10 @@ function parsePlain(stdout) {
|
|
|
13597
13601
|
for (const line of stdout.split(/\r?\n/)) {
|
|
13598
13602
|
const m = line.match(HUNK_LINE_RE);
|
|
13599
13603
|
if (!m) continue;
|
|
13600
|
-
const [,
|
|
13601
|
-
if (!
|
|
13604
|
+
const [, path72, lineNo, sevToken, message] = m;
|
|
13605
|
+
if (!path72 || !lineNo || !message) continue;
|
|
13602
13606
|
hunks.push({
|
|
13603
|
-
path:
|
|
13607
|
+
path: path72.trim(),
|
|
13604
13608
|
line: Number(lineNo),
|
|
13605
13609
|
severity: sevToken ? SEVERITY_MAP[sevToken.toLowerCase()] : void 0,
|
|
13606
13610
|
message: message.trim().replace(/^[*-]\s+/, "")
|
|
@@ -15398,6 +15402,7 @@ async function linkDryRunPreflight(ctx) {
|
|
|
15398
15402
|
|
|
15399
15403
|
// src/agents/coderabbit/configure.ts
|
|
15400
15404
|
var import_node_child_process14 = require("child_process");
|
|
15405
|
+
var path36 = __toESM(require("path"));
|
|
15401
15406
|
|
|
15402
15407
|
// src/agents/coderabbit/oauth.ts
|
|
15403
15408
|
var fs31 = __toESM(require("fs"));
|
|
@@ -15559,6 +15564,14 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
15559
15564
|
const runOAuth = deps.runOAuthLogin ?? runCoderabbitOAuthLogin;
|
|
15560
15565
|
const snapshot = deps.snapshotDir ?? (() => snapshotCredentialDir());
|
|
15561
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
|
+
);
|
|
15562
15575
|
const installed = os50.findInPath("coderabbit") !== null;
|
|
15563
15576
|
const base = () => ({
|
|
15564
15577
|
action: input.action,
|
|
@@ -15640,12 +15653,12 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
15640
15653
|
var import_node_child_process23 = require("child_process");
|
|
15641
15654
|
var os35 = __toESM(require("os"));
|
|
15642
15655
|
var fs41 = __toESM(require("fs"));
|
|
15643
|
-
var
|
|
15656
|
+
var path44 = __toESM(require("path"));
|
|
15644
15657
|
|
|
15645
15658
|
// src/commands/host/host-client.ts
|
|
15646
15659
|
var fs33 = __toESM(require("fs"));
|
|
15647
15660
|
var os29 = __toESM(require("os"));
|
|
15648
|
-
var
|
|
15661
|
+
var path37 = __toESM(require("path"));
|
|
15649
15662
|
|
|
15650
15663
|
// src/lib/restrict-to-owner.ts
|
|
15651
15664
|
var import_node_fs5 = __toESM(require("fs"));
|
|
@@ -15727,7 +15740,7 @@ function apiBase() {
|
|
|
15727
15740
|
return process.env.CODEAM_API_URL ?? resolveApiBaseUrl();
|
|
15728
15741
|
}
|
|
15729
15742
|
function hostIdentityPath() {
|
|
15730
|
-
return
|
|
15743
|
+
return path37.join(os29.homedir(), ".codeam", "host-agent.json");
|
|
15731
15744
|
}
|
|
15732
15745
|
function collectOsInfo() {
|
|
15733
15746
|
return {
|
|
@@ -15752,7 +15765,7 @@ function loadHostIdentity() {
|
|
|
15752
15765
|
}
|
|
15753
15766
|
function saveHostIdentity(identity) {
|
|
15754
15767
|
const file = hostIdentityPath();
|
|
15755
|
-
fs33.mkdirSync(
|
|
15768
|
+
fs33.mkdirSync(path37.dirname(file), { recursive: true, mode: 448 });
|
|
15756
15769
|
fs33.writeFileSync(file, JSON.stringify(identity, null, 2), {
|
|
15757
15770
|
encoding: "utf8",
|
|
15758
15771
|
mode: 384
|
|
@@ -15923,15 +15936,15 @@ async function reportDeployProgress(auth, deployId, step, message, sessionId) {
|
|
|
15923
15936
|
// src/commands/host/workspace.ts
|
|
15924
15937
|
var fs34 = __toESM(require("fs"));
|
|
15925
15938
|
var os30 = __toESM(require("os"));
|
|
15926
|
-
var
|
|
15939
|
+
var path38 = __toESM(require("path"));
|
|
15927
15940
|
var import_node_child_process16 = require("child_process");
|
|
15928
15941
|
var import_node_util4 = require("util");
|
|
15929
15942
|
var execFileP4 = (0, import_node_util4.promisify)(import_node_child_process16.execFile);
|
|
15930
15943
|
function isAbsolutePathTarget(target) {
|
|
15931
|
-
return
|
|
15944
|
+
return path38.isAbsolute(target);
|
|
15932
15945
|
}
|
|
15933
15946
|
function selfHostedWorkspaceRoot() {
|
|
15934
|
-
return
|
|
15947
|
+
return path38.join(os30.homedir(), ".codeam", "self-hosted");
|
|
15935
15948
|
}
|
|
15936
15949
|
function nonInteractiveGitEnv() {
|
|
15937
15950
|
return {
|
|
@@ -15984,13 +15997,13 @@ async function fetchGithubIdentity(token) {
|
|
|
15984
15997
|
async function configureGitCredentials(dest, repoRef, cloneToken) {
|
|
15985
15998
|
const gh = githubOwnerRepo(repoRef.trim());
|
|
15986
15999
|
if (!gh || !cloneToken) return;
|
|
15987
|
-
const credFile =
|
|
16000
|
+
const credFile = path38.join(dest, ".git", "codeam-credentials");
|
|
15988
16001
|
fs34.writeFileSync(credFile, `https://x-access-token:${cloneToken}@github.com
|
|
15989
16002
|
`, { mode: 384 });
|
|
15990
16003
|
restrictToOwner(credFile);
|
|
15991
16004
|
const env = nonInteractiveGitEnv();
|
|
15992
16005
|
const git2 = (args2) => execFileP4("git", ["-C", dest, ...args2], { timeout: 3e4, env });
|
|
15993
|
-
const credFilePosix = credFile.split(
|
|
16006
|
+
const credFilePosix = credFile.split(path38.sep).join("/");
|
|
15994
16007
|
await git2(["config", "--local", "--replace-all", "credential.helper", ""]).catch(() => {
|
|
15995
16008
|
});
|
|
15996
16009
|
await git2([
|
|
@@ -16031,8 +16044,8 @@ async function prepareWorkspace(repoOrPath, deployId, cloneToken) {
|
|
|
16031
16044
|
}
|
|
16032
16045
|
return repoOrPath;
|
|
16033
16046
|
}
|
|
16034
|
-
const dest =
|
|
16035
|
-
if (fs34.existsSync(
|
|
16047
|
+
const dest = path38.join(selfHostedWorkspaceRoot(), deployId);
|
|
16048
|
+
if (fs34.existsSync(path38.join(dest, ".git"))) {
|
|
16036
16049
|
if (cloneToken) await configureGitCredentials(dest, repoOrPath, cloneToken);
|
|
16037
16050
|
return dest;
|
|
16038
16051
|
}
|
|
@@ -16055,7 +16068,7 @@ async function prepareWorkspace(repoOrPath, deployId, cloneToken) {
|
|
|
16055
16068
|
// src/commands/host/agent-provisioning.ts
|
|
16056
16069
|
var fs35 = __toESM(require("fs"));
|
|
16057
16070
|
var os31 = __toESM(require("os"));
|
|
16058
|
-
var
|
|
16071
|
+
var path39 = __toESM(require("path"));
|
|
16059
16072
|
var import_node_child_process17 = require("child_process");
|
|
16060
16073
|
var PUBLIC_TO_INTERNAL_AGENT = {
|
|
16061
16074
|
claude_code: "claude",
|
|
@@ -16075,7 +16088,7 @@ function ensureDir(dir) {
|
|
|
16075
16088
|
fs35.mkdirSync(dir, { recursive: true, mode: 448 });
|
|
16076
16089
|
}
|
|
16077
16090
|
function writeFile0600(filePath, contents) {
|
|
16078
|
-
ensureDir(
|
|
16091
|
+
ensureDir(path39.dirname(filePath));
|
|
16079
16092
|
fs35.writeFileSync(filePath, contents, { encoding: "utf8", mode: 384 });
|
|
16080
16093
|
restrictToOwner(filePath);
|
|
16081
16094
|
}
|
|
@@ -16087,7 +16100,7 @@ function rmIfExists(filePath) {
|
|
|
16087
16100
|
}
|
|
16088
16101
|
var claudeProvisioner = {
|
|
16089
16102
|
write(auth, home) {
|
|
16090
|
-
const credentialsJson =
|
|
16103
|
+
const credentialsJson = path39.join(home, ".claude", ".credentials.json");
|
|
16091
16104
|
if (auth.kind === "api_key") {
|
|
16092
16105
|
rmIfExists(credentialsJson);
|
|
16093
16106
|
return { ANTHROPIC_API_KEY: auth.value };
|
|
@@ -16099,7 +16112,7 @@ var claudeProvisioner = {
|
|
|
16099
16112
|
} else {
|
|
16100
16113
|
rmIfExists(credentialsJson);
|
|
16101
16114
|
}
|
|
16102
|
-
const claudeJson =
|
|
16115
|
+
const claudeJson = path39.join(home, ".claude.json");
|
|
16103
16116
|
if (!fs35.existsSync(claudeJson)) {
|
|
16104
16117
|
writeFile0600(
|
|
16105
16118
|
claudeJson,
|
|
@@ -16111,7 +16124,7 @@ var claudeProvisioner = {
|
|
|
16111
16124
|
};
|
|
16112
16125
|
var codexProvisioner = {
|
|
16113
16126
|
write(auth, home) {
|
|
16114
|
-
const authJson =
|
|
16127
|
+
const authJson = path39.join(home, ".codex", "auth.json");
|
|
16115
16128
|
if (auth.kind === "api_key") {
|
|
16116
16129
|
rmIfExists(authJson);
|
|
16117
16130
|
return { OPENAI_API_KEY: auth.value };
|
|
@@ -16122,8 +16135,8 @@ var codexProvisioner = {
|
|
|
16122
16135
|
};
|
|
16123
16136
|
var geminiProvisioner = {
|
|
16124
16137
|
write(auth, home) {
|
|
16125
|
-
const settingsJson =
|
|
16126
|
-
const oauthCreds =
|
|
16138
|
+
const settingsJson = path39.join(home, ".gemini", "settings.json");
|
|
16139
|
+
const oauthCreds = path39.join(home, ".gemini", "oauth_creds.json");
|
|
16127
16140
|
if (auth.kind === "api_key") {
|
|
16128
16141
|
rmIfExists(oauthCreds);
|
|
16129
16142
|
writeFile0600(settingsJson, '{"security":{"auth":{"selectedType":"gemini-api-key"}}}');
|
|
@@ -16136,7 +16149,7 @@ var geminiProvisioner = {
|
|
|
16136
16149
|
};
|
|
16137
16150
|
var cursorProvisioner = {
|
|
16138
16151
|
write(auth, home) {
|
|
16139
|
-
const authJson =
|
|
16152
|
+
const authJson = path39.join(home, ".config", "cursor", "auth.json");
|
|
16140
16153
|
if (auth.kind === "api_key") {
|
|
16141
16154
|
rmIfExists(authJson);
|
|
16142
16155
|
return { CURSOR_API_KEY: auth.value };
|
|
@@ -16162,8 +16175,8 @@ var cursorProvisioner = {
|
|
|
16162
16175
|
var kimiProvisioner = {
|
|
16163
16176
|
write(auth, home) {
|
|
16164
16177
|
const credentialsFiles = [
|
|
16165
|
-
|
|
16166
|
-
|
|
16178
|
+
path39.join(home, ".kimi", "credentials", "kimi-code.json"),
|
|
16179
|
+
path39.join(home, ".kimi-code", "credentials", "kimi-code.json")
|
|
16167
16180
|
];
|
|
16168
16181
|
if (auth.kind === "api_key") {
|
|
16169
16182
|
credentialsFiles.forEach(rmIfExists);
|
|
@@ -16190,8 +16203,8 @@ function provisionKimiConfig(home) {
|
|
|
16190
16203
|
}
|
|
16191
16204
|
var coderabbitProvisioner = {
|
|
16192
16205
|
write(auth, home) {
|
|
16193
|
-
const dir =
|
|
16194
|
-
const authJson =
|
|
16206
|
+
const dir = path39.join(home, ".coderabbit");
|
|
16207
|
+
const authJson = path39.join(dir, "auth.json");
|
|
16195
16208
|
if (auth.kind === "api_key") {
|
|
16196
16209
|
rmIfExists(authJson);
|
|
16197
16210
|
return { CODERABBIT_API_KEY: auth.value };
|
|
@@ -16203,13 +16216,13 @@ var coderabbitProvisioner = {
|
|
|
16203
16216
|
try {
|
|
16204
16217
|
const parsed = JSON.parse(value);
|
|
16205
16218
|
if (typeof parsed.file === "string" && typeof parsed.contents === "string") {
|
|
16206
|
-
file =
|
|
16219
|
+
file = path39.basename(parsed.file);
|
|
16207
16220
|
contents = parsed.contents;
|
|
16208
16221
|
}
|
|
16209
16222
|
} catch {
|
|
16210
16223
|
}
|
|
16211
16224
|
}
|
|
16212
|
-
writeFile0600(
|
|
16225
|
+
writeFile0600(path39.join(dir, file), contents);
|
|
16213
16226
|
return {};
|
|
16214
16227
|
}
|
|
16215
16228
|
};
|
|
@@ -16241,9 +16254,9 @@ function provisionAgentCredentials(publicAgentId, auth, homeDir2 = os31.homedir(
|
|
|
16241
16254
|
var import_node_child_process18 = require("child_process");
|
|
16242
16255
|
var fs36 = __toESM(require("fs"));
|
|
16243
16256
|
var os32 = __toESM(require("os"));
|
|
16244
|
-
var
|
|
16257
|
+
var path40 = __toESM(require("path"));
|
|
16245
16258
|
function codeamBinDir() {
|
|
16246
|
-
return process.env.CODEAM_BIN_DIR ??
|
|
16259
|
+
return process.env.CODEAM_BIN_DIR ?? path40.join(os32.homedir(), ".codeam", "bin");
|
|
16247
16260
|
}
|
|
16248
16261
|
var FALLBACK_GH_VERSION = "2.62.0";
|
|
16249
16262
|
var RELEASE_API = "https://api.github.com/repos/cli/cli/releases/latest";
|
|
@@ -16298,8 +16311,8 @@ async function ensureGhCli(runner, token, deps = {}) {
|
|
|
16298
16311
|
const version3 = await resolveVersionFn(token);
|
|
16299
16312
|
const asset = `gh_${version3}_${osToken}_${arch2}`;
|
|
16300
16313
|
const url = `https://github.com/cli/cli/releases/download/v${version3}/${asset}.${ext}`;
|
|
16301
|
-
const tmpRoot = fs36.mkdtempSync(
|
|
16302
|
-
const archive =
|
|
16314
|
+
const tmpRoot = fs36.mkdtempSync(path40.join(os32.tmpdir(), "codeam-gh-"));
|
|
16315
|
+
const archive = path40.join(tmpRoot, `${asset}.${ext}`);
|
|
16303
16316
|
if (!await downloadFn(url, archive)) {
|
|
16304
16317
|
log.warn("host-agent", "gh download failed \u2014 skipping (git pull/push still work via the credential helper)");
|
|
16305
16318
|
return null;
|
|
@@ -16309,14 +16322,14 @@ async function ensureGhCli(runner, token, deps = {}) {
|
|
|
16309
16322
|
log.warn("host-agent", `gh archive extraction failed (code=${String(extract.code)}) \u2014 skipping`);
|
|
16310
16323
|
return null;
|
|
16311
16324
|
}
|
|
16312
|
-
const extractedBin =
|
|
16325
|
+
const extractedBin = path40.join(tmpRoot, asset, "bin", binaryName);
|
|
16313
16326
|
if (!fs36.existsSync(extractedBin)) {
|
|
16314
16327
|
log.warn("host-agent", "gh binary not found in the extracted archive \u2014 skipping");
|
|
16315
16328
|
return null;
|
|
16316
16329
|
}
|
|
16317
16330
|
const binDir = codeamBinDir();
|
|
16318
16331
|
fs36.mkdirSync(binDir, { recursive: true });
|
|
16319
|
-
const target =
|
|
16332
|
+
const target = path40.join(binDir, binaryName);
|
|
16320
16333
|
fs36.copyFileSync(extractedBin, target);
|
|
16321
16334
|
fs36.chmodSync(target, 493);
|
|
16322
16335
|
log.info("host-agent", `gh installed to ${target} (v${version3})`);
|
|
@@ -16806,19 +16819,19 @@ async function ensureModernPython(runner) {
|
|
|
16806
16819
|
|
|
16807
16820
|
// src/commands/host/headroom-bootstrap.ts
|
|
16808
16821
|
var fs38 = __toESM(require("fs"));
|
|
16809
|
-
var
|
|
16822
|
+
var path42 = __toESM(require("path"));
|
|
16810
16823
|
|
|
16811
16824
|
// src/commands/host/headroom-config.ts
|
|
16812
16825
|
var fs37 = __toESM(require("fs"));
|
|
16813
16826
|
var os33 = __toESM(require("os"));
|
|
16814
|
-
var
|
|
16827
|
+
var path41 = __toESM(require("path"));
|
|
16815
16828
|
function headroomConfigPath() {
|
|
16816
|
-
return
|
|
16829
|
+
return path41.join(os33.homedir(), ".codeam", "headroom-config.json");
|
|
16817
16830
|
}
|
|
16818
16831
|
function persistHeadroomConfig(config) {
|
|
16819
16832
|
try {
|
|
16820
16833
|
const file = headroomConfigPath();
|
|
16821
|
-
fs37.mkdirSync(
|
|
16834
|
+
fs37.mkdirSync(path41.dirname(file), { recursive: true, mode: 448 });
|
|
16822
16835
|
const tmp = `${file}.tmp-${process.pid}`;
|
|
16823
16836
|
fs37.writeFileSync(tmp, JSON.stringify(config, null, 2), { encoding: "utf8", mode: 384 });
|
|
16824
16837
|
fs37.renameSync(tmp, file);
|
|
@@ -16832,9 +16845,9 @@ function persistHeadroomConfig(config) {
|
|
|
16832
16845
|
}
|
|
16833
16846
|
function agentSettingsPath(kind) {
|
|
16834
16847
|
const home = os33.homedir();
|
|
16835
|
-
if (kind === "claude") return
|
|
16836
|
-
if (kind === "codex") return
|
|
16837
|
-
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");
|
|
16838
16851
|
return null;
|
|
16839
16852
|
}
|
|
16840
16853
|
function backupAgentHeadroomConfig(kind) {
|
|
@@ -16842,8 +16855,8 @@ function backupAgentHeadroomConfig(kind) {
|
|
|
16842
16855
|
if (!src) return;
|
|
16843
16856
|
try {
|
|
16844
16857
|
if (!fs37.existsSync(src)) return;
|
|
16845
|
-
const dest =
|
|
16846
|
-
fs37.mkdirSync(
|
|
16858
|
+
const dest = path41.join(os33.homedir(), ".codeam", `headroom-backup-${kind}.json`);
|
|
16859
|
+
fs37.mkdirSync(path41.dirname(dest), { recursive: true, mode: 448 });
|
|
16847
16860
|
fs37.copyFileSync(src, dest);
|
|
16848
16861
|
fs37.chmodSync(dest, 384);
|
|
16849
16862
|
log.info("host-agent", `headroom config backup: ${src} \u2192 ${dest}`);
|
|
@@ -16857,10 +16870,10 @@ function backupAgentHeadroomConfig(kind) {
|
|
|
16857
16870
|
function restoreAgentHeadroomConfig(kind) {
|
|
16858
16871
|
const dest = agentSettingsPath(kind);
|
|
16859
16872
|
if (!dest) return false;
|
|
16860
|
-
const src =
|
|
16873
|
+
const src = path41.join(os33.homedir(), ".codeam", `headroom-backup-${kind}.json`);
|
|
16861
16874
|
if (!fs37.existsSync(src)) return false;
|
|
16862
16875
|
try {
|
|
16863
|
-
fs37.mkdirSync(
|
|
16876
|
+
fs37.mkdirSync(path41.dirname(dest), { recursive: true, mode: 448 });
|
|
16864
16877
|
fs37.copyFileSync(src, dest);
|
|
16865
16878
|
fs37.chmodSync(dest, 384);
|
|
16866
16879
|
log.info("host-agent", `headroom config restored: ${src} \u2192 ${dest}`);
|
|
@@ -16911,20 +16924,20 @@ function bundledClaudeBinDir() {
|
|
|
16911
16924
|
const roots = /* @__PURE__ */ new Set();
|
|
16912
16925
|
let dir = __dirname;
|
|
16913
16926
|
for (let i = 0; i < 6; i++) {
|
|
16914
|
-
roots.add(
|
|
16915
|
-
const parent =
|
|
16927
|
+
roots.add(path42.join(dir, "node_modules"));
|
|
16928
|
+
const parent = path42.dirname(dir);
|
|
16916
16929
|
if (parent === dir) break;
|
|
16917
16930
|
dir = parent;
|
|
16918
16931
|
}
|
|
16919
16932
|
try {
|
|
16920
16933
|
const main2 = require.resolve("@anthropic-ai/claude-agent-sdk");
|
|
16921
|
-
const marker = `${
|
|
16934
|
+
const marker = `${path42.sep}@anthropic-ai${path42.sep}`;
|
|
16922
16935
|
const idx = main2.lastIndexOf(marker);
|
|
16923
16936
|
if (idx !== -1) roots.add(main2.slice(0, idx));
|
|
16924
16937
|
} catch {
|
|
16925
16938
|
}
|
|
16926
16939
|
for (const nm of roots) {
|
|
16927
|
-
const atAnthropic =
|
|
16940
|
+
const atAnthropic = path42.join(nm, "@anthropic-ai");
|
|
16928
16941
|
let entries;
|
|
16929
16942
|
try {
|
|
16930
16943
|
entries = fs38.readdirSync(atAnthropic);
|
|
@@ -16933,8 +16946,8 @@ function bundledClaudeBinDir() {
|
|
|
16933
16946
|
}
|
|
16934
16947
|
for (const entry of entries) {
|
|
16935
16948
|
if (!entry.startsWith("claude-agent-sdk-")) continue;
|
|
16936
|
-
const bin =
|
|
16937
|
-
if (fs38.existsSync(bin)) return
|
|
16949
|
+
const bin = path42.join(atAnthropic, entry, "claude");
|
|
16950
|
+
if (fs38.existsSync(bin)) return path42.dirname(bin);
|
|
16938
16951
|
}
|
|
16939
16952
|
}
|
|
16940
16953
|
return null;
|
|
@@ -17003,7 +17016,7 @@ async function setupHeadroomForSelfHosted(agent, runner = defaultHeadroomRunner,
|
|
|
17003
17016
|
if (initKind === "claude") {
|
|
17004
17017
|
const claudeDir = bundledClaudeBinDir();
|
|
17005
17018
|
if (claudeDir) {
|
|
17006
|
-
initEnv.PATH = `${claudeDir}${
|
|
17019
|
+
initEnv.PATH = `${claudeDir}${path42.delimiter}${process.env["PATH"] ?? ""}`;
|
|
17007
17020
|
log.info("host-agent", `headroom init: bundled claude on PATH (${claudeDir})`);
|
|
17008
17021
|
} else {
|
|
17009
17022
|
log.warn("host-agent", "headroom init: bundled claude binary not found \u2014 init may fail");
|
|
@@ -17040,7 +17053,7 @@ var import_node_child_process21 = require("child_process");
|
|
|
17040
17053
|
// src/lib/updateNotifier.ts
|
|
17041
17054
|
var fs39 = __toESM(require("fs"));
|
|
17042
17055
|
var os34 = __toESM(require("os"));
|
|
17043
|
-
var
|
|
17056
|
+
var path43 = __toESM(require("path"));
|
|
17044
17057
|
var https6 = __toESM(require("https"));
|
|
17045
17058
|
var import_node_child_process20 = require("child_process");
|
|
17046
17059
|
var import_picocolors3 = __toESM(require("picocolors"));
|
|
@@ -17049,8 +17062,8 @@ var REGISTRY_URL = `https://registry.npmjs.org/${PKG_NAME}/latest`;
|
|
|
17049
17062
|
var TTL_MS = 24 * 60 * 60 * 1e3;
|
|
17050
17063
|
var REQUEST_TIMEOUT_MS = 1500;
|
|
17051
17064
|
function cachePath() {
|
|
17052
|
-
const dir =
|
|
17053
|
-
return
|
|
17065
|
+
const dir = path43.join(os34.homedir(), ".codeam");
|
|
17066
|
+
return path43.join(dir, "update-check.json");
|
|
17054
17067
|
}
|
|
17055
17068
|
function readCache() {
|
|
17056
17069
|
try {
|
|
@@ -17065,7 +17078,7 @@ function readCache() {
|
|
|
17065
17078
|
function writeCache(cache) {
|
|
17066
17079
|
try {
|
|
17067
17080
|
const file = cachePath();
|
|
17068
|
-
fs39.mkdirSync(
|
|
17081
|
+
fs39.mkdirSync(path43.dirname(file), { recursive: true });
|
|
17069
17082
|
const tmp = `${file}.${process.pid}.tmp`;
|
|
17070
17083
|
fs39.writeFileSync(tmp, JSON.stringify(cache));
|
|
17071
17084
|
fs39.renameSync(tmp, file);
|
|
@@ -17142,7 +17155,7 @@ function isLinkedInstall() {
|
|
|
17142
17155
|
timeout: 2e3
|
|
17143
17156
|
}).trim();
|
|
17144
17157
|
if (!root) return false;
|
|
17145
|
-
const pkgPath =
|
|
17158
|
+
const pkgPath = path43.join(root, PKG_NAME);
|
|
17146
17159
|
return fs39.lstatSync(pkgPath).isSymbolicLink();
|
|
17147
17160
|
} catch {
|
|
17148
17161
|
return false;
|
|
@@ -17195,7 +17208,7 @@ async function autoUpgradeBeforeCriticalCommand() {
|
|
|
17195
17208
|
if (process.env.NODE_ENV === "test") return;
|
|
17196
17209
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
17197
17210
|
if (process.env.CI) return;
|
|
17198
|
-
const current = true ? "2.60.
|
|
17211
|
+
const current = true ? "2.60.27" : null;
|
|
17199
17212
|
if (!current) return;
|
|
17200
17213
|
const cache = readCache();
|
|
17201
17214
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
|
@@ -17212,7 +17225,7 @@ function checkForUpdates() {
|
|
|
17212
17225
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
17213
17226
|
if (process.env.CI) return;
|
|
17214
17227
|
if (!process.stdout.isTTY) return;
|
|
17215
|
-
const current = true ? "2.60.
|
|
17228
|
+
const current = true ? "2.60.27" : null;
|
|
17216
17229
|
if (!current) return;
|
|
17217
17230
|
const cache = readCache();
|
|
17218
17231
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
|
@@ -17232,7 +17245,7 @@ var SELF_UPDATE_INTERVAL_MS = 60 * 60 * 1e3;
|
|
|
17232
17245
|
var SELF_UPDATE_VIEW_TIMEOUT_MS = 3e4;
|
|
17233
17246
|
var SELF_UPDATE_INSTALL_TIMEOUT_MS = 18e4;
|
|
17234
17247
|
function currentCliVersion() {
|
|
17235
|
-
return true ? "2.60.
|
|
17248
|
+
return true ? "2.60.27" : null;
|
|
17236
17249
|
}
|
|
17237
17250
|
function runCmd(cmd, args2, timeoutMs) {
|
|
17238
17251
|
return new Promise((resolve7) => {
|
|
@@ -17782,7 +17795,7 @@ var HostAgentSupervisor = class {
|
|
|
17782
17795
|
API_TIMEOUT_MS: "3000000",
|
|
17783
17796
|
CODEAM_AUTO_TOKEN: payload.autoPairToken
|
|
17784
17797
|
};
|
|
17785
|
-
const houseConfigDir =
|
|
17798
|
+
const houseConfigDir = path44.join(os35.homedir(), ".codeam", "house-claude");
|
|
17786
17799
|
try {
|
|
17787
17800
|
fs41.mkdirSync(houseConfigDir, { recursive: true, mode: 448 });
|
|
17788
17801
|
} catch {
|
|
@@ -17809,7 +17822,7 @@ var HostAgentSupervisor = class {
|
|
|
17809
17822
|
report("preparing", "configuring git tooling");
|
|
17810
17823
|
const ghCmd = await ensureGhCli(defaultGitToolingRunner, payload.cloneToken);
|
|
17811
17824
|
if (ghCmd) {
|
|
17812
|
-
childEnv.PATH = `${codeamBinDir()}${
|
|
17825
|
+
childEnv.PATH = `${codeamBinDir()}${path44.delimiter}${childEnv.PATH}`;
|
|
17813
17826
|
await ensureGhAuth(defaultGitToolingRunner, ghCmd, payload.cloneToken);
|
|
17814
17827
|
}
|
|
17815
17828
|
} catch (e) {
|
|
@@ -18133,7 +18146,7 @@ async function configureHeadroom(action, ctx, deps) {
|
|
|
18133
18146
|
// src/services/headroom/budget-relaunch.ts
|
|
18134
18147
|
var fs42 = __toESM(require("fs"));
|
|
18135
18148
|
var os36 = __toESM(require("os"));
|
|
18136
|
-
var
|
|
18149
|
+
var path45 = __toESM(require("path"));
|
|
18137
18150
|
var import_child_process13 = require("child_process");
|
|
18138
18151
|
function amendDeploymentManifestBudget(manifest, budget) {
|
|
18139
18152
|
const rawArgs = manifest.proxy_args ?? [];
|
|
@@ -18167,7 +18180,7 @@ function amendDeploymentManifestBudget(manifest, budget) {
|
|
|
18167
18180
|
return { ...manifest, proxy_args: newArgs, base_env: newEnv };
|
|
18168
18181
|
}
|
|
18169
18182
|
function findHeadroomDeployments(homeDir2, deps) {
|
|
18170
|
-
const deployDir =
|
|
18183
|
+
const deployDir = path45.join(homeDir2, ".headroom", "deploy");
|
|
18171
18184
|
let profiles;
|
|
18172
18185
|
try {
|
|
18173
18186
|
profiles = deps.readDir(deployDir);
|
|
@@ -18176,7 +18189,7 @@ function findHeadroomDeployments(homeDir2, deps) {
|
|
|
18176
18189
|
}
|
|
18177
18190
|
const results = [];
|
|
18178
18191
|
for (const profile of profiles) {
|
|
18179
|
-
const manifestPath =
|
|
18192
|
+
const manifestPath = path45.join(deployDir, profile, "manifest.json");
|
|
18180
18193
|
let raw;
|
|
18181
18194
|
try {
|
|
18182
18195
|
raw = deps.readJson(manifestPath);
|
|
@@ -18924,7 +18937,7 @@ function activePreviewSessionIds() {
|
|
|
18924
18937
|
// src/services/preview/start-orchestrator.ts
|
|
18925
18938
|
var import_child_process17 = require("child_process");
|
|
18926
18939
|
var fs47 = __toESM(require("fs"));
|
|
18927
|
-
var
|
|
18940
|
+
var path50 = __toESM(require("path"));
|
|
18928
18941
|
var import_which2 = __toESM(require("which"));
|
|
18929
18942
|
var INSTALL_TIMEOUT_MS = 5 * 6e4;
|
|
18930
18943
|
var SETUP_TIMEOUT_MS = 2 * 6e4;
|
|
@@ -18991,7 +19004,7 @@ function normalizeDetectionForSpawn(detection, cwd) {
|
|
|
18991
19004
|
if (args2.length === 0) return detection;
|
|
18992
19005
|
const binName = args2[0];
|
|
18993
19006
|
if (binName.startsWith("-")) return detection;
|
|
18994
|
-
const binPath =
|
|
19007
|
+
const binPath = path50.join(cwd, "node_modules", ".bin", binName);
|
|
18995
19008
|
if (!fs47.existsSync(binPath)) return detection;
|
|
18996
19009
|
return {
|
|
18997
19010
|
...detection,
|
|
@@ -19344,7 +19357,7 @@ async function establishTunnel(ctx, dev) {
|
|
|
19344
19357
|
var import_child_process18 = require("child_process");
|
|
19345
19358
|
var fs48 = __toESM(require("fs"));
|
|
19346
19359
|
var os38 = __toESM(require("os"));
|
|
19347
|
-
var
|
|
19360
|
+
var path51 = __toESM(require("path"));
|
|
19348
19361
|
var BD_PACKAGE = "@beads/bd";
|
|
19349
19362
|
function resolveBundledBdBinary() {
|
|
19350
19363
|
return _resolveSeam.resolveBundled();
|
|
@@ -19356,9 +19369,9 @@ function _defaultResolveBundled() {
|
|
|
19356
19369
|
} catch {
|
|
19357
19370
|
return null;
|
|
19358
19371
|
}
|
|
19359
|
-
const binDir =
|
|
19372
|
+
const binDir = path51.join(path51.dirname(pkgJsonPath), "bin");
|
|
19360
19373
|
const binaryName = process.platform === "win32" ? "bd.exe" : "bd";
|
|
19361
|
-
const binaryPath =
|
|
19374
|
+
const binaryPath = path51.join(binDir, binaryName);
|
|
19362
19375
|
try {
|
|
19363
19376
|
fs48.accessSync(binaryPath, fs48.constants.F_OK);
|
|
19364
19377
|
return binaryPath;
|
|
@@ -19370,11 +19383,11 @@ function resolveBdOnPath() {
|
|
|
19370
19383
|
return _resolveSeam.resolveOnPath();
|
|
19371
19384
|
}
|
|
19372
19385
|
function _defaultResolveOnPath() {
|
|
19373
|
-
const dirs = (process.env.PATH ?? "").split(
|
|
19386
|
+
const dirs = (process.env.PATH ?? "").split(path51.delimiter).filter(Boolean);
|
|
19374
19387
|
const candidates = process.platform === "win32" ? ["bd.exe", "bd.cmd", "bd"] : ["bd"];
|
|
19375
19388
|
for (const dir of dirs) {
|
|
19376
19389
|
for (const candidate of candidates) {
|
|
19377
|
-
const full =
|
|
19390
|
+
const full = path51.join(dir, candidate);
|
|
19378
19391
|
try {
|
|
19379
19392
|
fs48.accessSync(full, fs48.constants.F_OK);
|
|
19380
19393
|
return full;
|
|
@@ -19555,7 +19568,7 @@ function coerceIssue(row, projectKey) {
|
|
|
19555
19568
|
var import_child_process22 = require("child_process");
|
|
19556
19569
|
var fs51 = __toESM(require("fs"));
|
|
19557
19570
|
var os40 = __toESM(require("os"));
|
|
19558
|
-
var
|
|
19571
|
+
var path54 = __toESM(require("path"));
|
|
19559
19572
|
|
|
19560
19573
|
// src/beads/install-bd.ts
|
|
19561
19574
|
var import_child_process19 = require("child_process");
|
|
@@ -19622,7 +19635,7 @@ async function installBd(platform3 = process.platform) {
|
|
|
19622
19635
|
var import_child_process20 = require("child_process");
|
|
19623
19636
|
var fs49 = __toESM(require("fs"));
|
|
19624
19637
|
var os39 = __toESM(require("os"));
|
|
19625
|
-
var
|
|
19638
|
+
var path52 = __toESM(require("path"));
|
|
19626
19639
|
var DOLT_INSTALL_SH_URL = "https://github.com/dolthub/dolt/releases/latest/download/install.sh";
|
|
19627
19640
|
var DOLT_MSI_URL = "https://github.com/dolthub/dolt/releases/latest/download/dolt-windows-amd64.msi";
|
|
19628
19641
|
function resolveDoltInstallStrategy(platform3) {
|
|
@@ -19729,7 +19742,7 @@ function doltBinaryNames(platform3) {
|
|
|
19729
19742
|
return platform3 === "win32" ? ["dolt.exe", "dolt.cmd", "dolt"] : ["dolt"];
|
|
19730
19743
|
}
|
|
19731
19744
|
function knownDoltDirs(platform3) {
|
|
19732
|
-
const P3 = platform3 === "win32" ?
|
|
19745
|
+
const P3 = platform3 === "win32" ? path52.win32 : path52.posix;
|
|
19733
19746
|
const home = _doltPathSeam.homedir();
|
|
19734
19747
|
if (platform3 === "win32") {
|
|
19735
19748
|
return [
|
|
@@ -19745,7 +19758,7 @@ function knownDoltDirs(platform3) {
|
|
|
19745
19758
|
].filter(Boolean);
|
|
19746
19759
|
}
|
|
19747
19760
|
function ensureDoltResolvable(platform3 = process.platform) {
|
|
19748
|
-
const P3 = platform3 === "win32" ?
|
|
19761
|
+
const P3 = platform3 === "win32" ? path52.win32 : path52.posix;
|
|
19749
19762
|
const delim = platform3 === "win32" ? ";" : ":";
|
|
19750
19763
|
const names = doltBinaryNames(platform3);
|
|
19751
19764
|
const pathDirs = _doltPathSeam.getPath().split(delim).filter(Boolean);
|
|
@@ -19882,7 +19895,7 @@ async function ensureSharedServer(adapter, options = {}) {
|
|
|
19882
19895
|
var import_child_process21 = require("child_process");
|
|
19883
19896
|
var crypto2 = __toESM(require("crypto"));
|
|
19884
19897
|
var fs50 = __toESM(require("fs"));
|
|
19885
|
-
var
|
|
19898
|
+
var path53 = __toESM(require("path"));
|
|
19886
19899
|
function normalizeOrigin(raw) {
|
|
19887
19900
|
const trimmed = raw.trim();
|
|
19888
19901
|
if (!trimmed) return null;
|
|
@@ -19908,17 +19921,17 @@ function normalizeOrigin(raw) {
|
|
|
19908
19921
|
return `${host2}/${pathPart}`;
|
|
19909
19922
|
}
|
|
19910
19923
|
function findRepoRoot(cwd) {
|
|
19911
|
-
let dir =
|
|
19924
|
+
let dir = path53.resolve(cwd);
|
|
19912
19925
|
const seen = /* @__PURE__ */ new Set();
|
|
19913
19926
|
for (let i = 0; i < 256; i++) {
|
|
19914
19927
|
if (seen.has(dir)) return null;
|
|
19915
19928
|
seen.add(dir);
|
|
19916
19929
|
try {
|
|
19917
|
-
const stat3 = fs50.statSync(
|
|
19930
|
+
const stat3 = fs50.statSync(path53.join(dir, ".git"), { throwIfNoEntry: false });
|
|
19918
19931
|
if (stat3 && (stat3.isDirectory() || stat3.isFile())) return dir;
|
|
19919
19932
|
} catch {
|
|
19920
19933
|
}
|
|
19921
|
-
const parent =
|
|
19934
|
+
const parent = path53.dirname(dir);
|
|
19922
19935
|
if (parent === dir) return null;
|
|
19923
19936
|
dir = parent;
|
|
19924
19937
|
}
|
|
@@ -19958,7 +19971,7 @@ function deriveProjectIdentity(cwd = process.cwd()) {
|
|
|
19958
19971
|
} catch {
|
|
19959
19972
|
}
|
|
19960
19973
|
const hash = crypto2.createHash("sha256").update(real).digest("hex");
|
|
19961
|
-
return { projectKey: `path:${hash}`, projectLabel:
|
|
19974
|
+
return { projectKey: `path:${hash}`, projectLabel: path53.basename(real) || "project" };
|
|
19962
19975
|
}
|
|
19963
19976
|
|
|
19964
19977
|
// src/beads/project-prefix.ts
|
|
@@ -20034,9 +20047,9 @@ var _linkSeam = {
|
|
|
20034
20047
|
* which `linkBdOntoPath` creates if missing.
|
|
20035
20048
|
*/
|
|
20036
20049
|
cliBinDir: () => {
|
|
20037
|
-
const pathDirs = (process.env.PATH ?? "").split(
|
|
20050
|
+
const pathDirs = (process.env.PATH ?? "").split(path54.delimiter).filter(Boolean);
|
|
20038
20051
|
const home = _linkSeam.homedir();
|
|
20039
|
-
const localBin = home ?
|
|
20052
|
+
const localBin = home ? path54.join(home, ".local", "bin") : null;
|
|
20040
20053
|
if (localBin) {
|
|
20041
20054
|
try {
|
|
20042
20055
|
_linkSeam.ensureDir(localBin);
|
|
@@ -20046,16 +20059,16 @@ var _linkSeam = {
|
|
|
20046
20059
|
const candidates = [];
|
|
20047
20060
|
if (localBin) candidates.push(localBin);
|
|
20048
20061
|
try {
|
|
20049
|
-
candidates.push(
|
|
20062
|
+
candidates.push(path54.dirname(process.execPath));
|
|
20050
20063
|
} catch {
|
|
20051
20064
|
}
|
|
20052
20065
|
candidates.push("/usr/local/bin");
|
|
20053
20066
|
const entry = process.argv[1];
|
|
20054
20067
|
if (entry) {
|
|
20055
20068
|
try {
|
|
20056
|
-
candidates.push(
|
|
20069
|
+
candidates.push(path54.dirname(fs51.realpathSync(entry)));
|
|
20057
20070
|
} catch {
|
|
20058
|
-
candidates.push(
|
|
20071
|
+
candidates.push(path54.dirname(entry));
|
|
20059
20072
|
}
|
|
20060
20073
|
}
|
|
20061
20074
|
const onPathWritable = candidates.find(
|
|
@@ -20080,7 +20093,7 @@ function linkBdOntoPath(binaryPath) {
|
|
|
20080
20093
|
const binDir = _linkSeam.cliBinDir();
|
|
20081
20094
|
if (!binDir) return;
|
|
20082
20095
|
_linkSeam.ensureDir(binDir);
|
|
20083
|
-
const linkPath =
|
|
20096
|
+
const linkPath = path54.join(binDir, "bd");
|
|
20084
20097
|
if (linkPath === binaryPath) return;
|
|
20085
20098
|
const current = _linkSeam.readlink(linkPath);
|
|
20086
20099
|
if (current === binaryPath) return;
|
|
@@ -20275,7 +20288,7 @@ function dedupeRecipes(agents) {
|
|
|
20275
20288
|
|
|
20276
20289
|
// src/beads/watcher.ts
|
|
20277
20290
|
var crypto4 = __toESM(require("crypto"));
|
|
20278
|
-
var
|
|
20291
|
+
var path55 = __toESM(require("path"));
|
|
20279
20292
|
var API_BASE6 = resolveApiBaseUrl();
|
|
20280
20293
|
var DEBOUNCE_MS2 = 400;
|
|
20281
20294
|
var ZERO_SUMMARY = {
|
|
@@ -20299,7 +20312,7 @@ var BeadsWatcher = class {
|
|
|
20299
20312
|
constructor(opts) {
|
|
20300
20313
|
this.opts = opts;
|
|
20301
20314
|
this.bd = opts.adapter ?? new BdAdapter({ cwd: opts.cwd, beadsDir: opts.beadsDir });
|
|
20302
|
-
this.feedPath = opts.feedPath ??
|
|
20315
|
+
this.feedPath = opts.feedPath ?? path55.join(opts.cwd ?? process.cwd(), ".beads", "last-touched");
|
|
20303
20316
|
this.apiBase = opts.apiBaseUrl ?? API_BASE6;
|
|
20304
20317
|
}
|
|
20305
20318
|
opts;
|
|
@@ -20716,7 +20729,7 @@ function cleanupAttachmentTempFiles() {
|
|
|
20716
20729
|
function saveFilesTemp(files) {
|
|
20717
20730
|
return files.filter(({ base64 }) => base64 && base64.length > 0).map(({ filename, base64 }) => {
|
|
20718
20731
|
const safeName = filename.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 80);
|
|
20719
|
-
const tmpPath =
|
|
20732
|
+
const tmpPath = path57.join(os42.tmpdir(), `codeam-${(0, import_crypto3.randomUUID)()}-${safeName}`);
|
|
20720
20733
|
fs53.writeFileSync(tmpPath, Buffer.from(base64, "base64"));
|
|
20721
20734
|
pendingAttachmentFiles.add(tmpPath);
|
|
20722
20735
|
return tmpPath;
|
|
@@ -20929,7 +20942,7 @@ var listFiles = async (ctx, cmd, parsed) => {
|
|
|
20929
20942
|
await ctx.relay.sendResult(cmd.id, "completed", result);
|
|
20930
20943
|
};
|
|
20931
20944
|
var envReadH = async (ctx, cmd) => {
|
|
20932
|
-
const envPath =
|
|
20945
|
+
const envPath = path57.join(process.cwd(), ".env");
|
|
20933
20946
|
try {
|
|
20934
20947
|
const raw = await fs53.promises.readFile(envPath, "utf8");
|
|
20935
20948
|
await ctx.relay.sendResult(cmd.id, "completed", {
|
|
@@ -20962,8 +20975,8 @@ var envWriteH = async (ctx, cmd, parsed) => {
|
|
|
20962
20975
|
}
|
|
20963
20976
|
seen.add(v.key);
|
|
20964
20977
|
}
|
|
20965
|
-
const envPath =
|
|
20966
|
-
const tmpPath =
|
|
20978
|
+
const envPath = path57.join(process.cwd(), ".env");
|
|
20979
|
+
const tmpPath = path57.join(process.cwd(), ".env.codeam.tmp");
|
|
20967
20980
|
try {
|
|
20968
20981
|
await fs53.promises.writeFile(tmpPath, serializeDotenv(vars), "utf8");
|
|
20969
20982
|
await fs53.promises.rename(tmpPath, envPath);
|
|
@@ -21317,12 +21330,12 @@ function buildNpmInstallInvocation(opts) {
|
|
|
21317
21330
|
const entryScript = opts?.entryScript ?? process.argv[1] ?? "";
|
|
21318
21331
|
const execPath = opts?.execPath ?? process.execPath;
|
|
21319
21332
|
const exists2 = opts?.existsSync ?? fs53.existsSync;
|
|
21320
|
-
const normalized = entryScript.split(
|
|
21333
|
+
const normalized = entryScript.split(path57.sep).join("/");
|
|
21321
21334
|
const marker = "/lib/node_modules/codeam-cli/";
|
|
21322
21335
|
const markerIdx = normalized.indexOf(marker);
|
|
21323
21336
|
const prefix = markerIdx > 0 ? entryScript.slice(0, markerIdx) : null;
|
|
21324
|
-
const siblingNpm =
|
|
21325
|
-
|
|
21337
|
+
const siblingNpm = path57.join(
|
|
21338
|
+
path57.dirname(execPath),
|
|
21326
21339
|
process.platform === "win32" ? "npm.cmd" : "npm"
|
|
21327
21340
|
);
|
|
21328
21341
|
const command2 = exists2(siblingNpm) ? siblingNpm : "npm";
|
|
@@ -22165,11 +22178,11 @@ function resolveTokenValue(args2) {
|
|
|
22165
22178
|
}
|
|
22166
22179
|
const fileFlag = args2.find((a) => a.startsWith("--token-file="));
|
|
22167
22180
|
if (fileFlag) {
|
|
22168
|
-
const
|
|
22181
|
+
const path72 = fileFlag.slice("--token-file=".length);
|
|
22169
22182
|
try {
|
|
22170
|
-
const content = fs54.readFileSync(
|
|
22171
|
-
if (content.length === 0) fail(`--token-file ${
|
|
22172
|
-
rmIfExistsQuiet(
|
|
22183
|
+
const content = fs54.readFileSync(path72, "utf8").trim();
|
|
22184
|
+
if (content.length === 0) fail(`--token-file ${path72} is empty`);
|
|
22185
|
+
rmIfExistsQuiet(path72);
|
|
22173
22186
|
return content;
|
|
22174
22187
|
} catch (err) {
|
|
22175
22188
|
fail(`Could not read --token-file: ${err.message}`);
|
|
@@ -22259,7 +22272,7 @@ async function claim(token, pluginId, pluginSecretHash) {
|
|
|
22259
22272
|
}
|
|
22260
22273
|
}
|
|
22261
22274
|
function pairAutoLockPath() {
|
|
22262
|
-
return
|
|
22275
|
+
return path58.join(os43.homedir(), ".codeam", "pair-auto.lock");
|
|
22263
22276
|
}
|
|
22264
22277
|
function isLivePairAuto(pid) {
|
|
22265
22278
|
if (!Number.isInteger(pid) || pid <= 0 || pid === process.pid) return false;
|
|
@@ -22279,12 +22292,12 @@ function isLiveCodeam(pid) {
|
|
|
22279
22292
|
}
|
|
22280
22293
|
function daemonLockPath(sessionId) {
|
|
22281
22294
|
const safe = sessionId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
22282
|
-
return
|
|
22295
|
+
return path58.join(os43.homedir(), ".codeam", `daemon-${safe}.lock`);
|
|
22283
22296
|
}
|
|
22284
22297
|
function acquireDaemonLock(sessionId) {
|
|
22285
22298
|
const lockPath = daemonLockPath(sessionId);
|
|
22286
22299
|
try {
|
|
22287
|
-
fs54.mkdirSync(
|
|
22300
|
+
fs54.mkdirSync(path58.dirname(lockPath), { recursive: true });
|
|
22288
22301
|
try {
|
|
22289
22302
|
fs54.writeFileSync(lockPath, String(process.pid), { flag: "wx" });
|
|
22290
22303
|
} catch (e) {
|
|
@@ -22318,7 +22331,7 @@ function acquireDaemonLock(sessionId) {
|
|
|
22318
22331
|
function acquireSingletonLock() {
|
|
22319
22332
|
const lockPath = pairAutoLockPath();
|
|
22320
22333
|
try {
|
|
22321
|
-
fs54.mkdirSync(
|
|
22334
|
+
fs54.mkdirSync(path58.dirname(lockPath), { recursive: true });
|
|
22322
22335
|
try {
|
|
22323
22336
|
fs54.writeFileSync(lockPath, String(process.pid), { flag: "wx" });
|
|
22324
22337
|
} catch (e) {
|
|
@@ -22775,7 +22788,7 @@ var AgentService = class _AgentService {
|
|
|
22775
22788
|
};
|
|
22776
22789
|
|
|
22777
22790
|
// src/agents/acp/adapters.ts
|
|
22778
|
-
var
|
|
22791
|
+
var path60 = __toESM(require("path"));
|
|
22779
22792
|
|
|
22780
22793
|
// src/agents/acp/agent-binary.ts
|
|
22781
22794
|
var import_fs4 = __toESM(require("fs"));
|
|
@@ -23017,13 +23030,13 @@ function resolveBin(pkgName, binName) {
|
|
|
23017
23030
|
try {
|
|
23018
23031
|
const manifestPath = require_.resolve(`${pkgName}/package.json`);
|
|
23019
23032
|
const manifest = require_(`${pkgName}/package.json`);
|
|
23020
|
-
const pkgDir =
|
|
23033
|
+
const pkgDir = path60.dirname(manifestPath);
|
|
23021
23034
|
const bin = manifest.bin;
|
|
23022
23035
|
if (!bin) return null;
|
|
23023
|
-
if (typeof bin === "string") return
|
|
23036
|
+
if (typeof bin === "string") return path60.resolve(pkgDir, bin);
|
|
23024
23037
|
const target = binName ?? Object.keys(bin)[0];
|
|
23025
23038
|
if (!target || !bin[target]) return null;
|
|
23026
|
-
return
|
|
23039
|
+
return path60.resolve(pkgDir, bin[target]);
|
|
23027
23040
|
} catch {
|
|
23028
23041
|
return null;
|
|
23029
23042
|
}
|
|
@@ -23128,7 +23141,7 @@ var import_node_crypto10 = require("crypto");
|
|
|
23128
23141
|
|
|
23129
23142
|
// src/services/history.service.ts
|
|
23130
23143
|
var fs56 = __toESM(require("fs"));
|
|
23131
|
-
var
|
|
23144
|
+
var path61 = __toESM(require("path"));
|
|
23132
23145
|
var os45 = __toESM(require("os"));
|
|
23133
23146
|
var https7 = __toESM(require("https"));
|
|
23134
23147
|
var http6 = __toESM(require("http"));
|
|
@@ -23297,7 +23310,7 @@ var HistoryService = class _HistoryService {
|
|
|
23297
23310
|
return this._quotaPercent === null || Date.now() - this._quotaFetchedAt > ttlMs;
|
|
23298
23311
|
}
|
|
23299
23312
|
get projectDir() {
|
|
23300
|
-
return this.runtime.resolveHistoryDir(this.cwd) ??
|
|
23313
|
+
return this.runtime.resolveHistoryDir(this.cwd) ?? path61.join(os45.homedir(), ".claude", "projects", encodeCwd(this.cwd));
|
|
23301
23314
|
}
|
|
23302
23315
|
/** Set the current Claude conversation ID (extracted from /cost command or session start) */
|
|
23303
23316
|
setCurrentConversationId(id) {
|
|
@@ -23309,7 +23322,7 @@ var HistoryService = class _HistoryService {
|
|
|
23309
23322
|
/** Return the current message count in the active conversation. */
|
|
23310
23323
|
getCurrentMessageCount() {
|
|
23311
23324
|
if (!this.currentConversationId) return 0;
|
|
23312
|
-
const filePath =
|
|
23325
|
+
const filePath = path61.join(this.projectDir, `${this.currentConversationId}.jsonl`);
|
|
23313
23326
|
return parseJsonl(filePath).length;
|
|
23314
23327
|
}
|
|
23315
23328
|
/**
|
|
@@ -23320,7 +23333,7 @@ var HistoryService = class _HistoryService {
|
|
|
23320
23333
|
const deadline = Date.now() + timeoutMs;
|
|
23321
23334
|
while (Date.now() < deadline) {
|
|
23322
23335
|
if (!this.currentConversationId) return null;
|
|
23323
|
-
const filePath =
|
|
23336
|
+
const filePath = path61.join(this.projectDir, `${this.currentConversationId}.jsonl`);
|
|
23324
23337
|
const messages = parseJsonl(filePath);
|
|
23325
23338
|
if (messages.length > previousCount) {
|
|
23326
23339
|
for (let i = messages.length - 1; i >= previousCount; i--) {
|
|
@@ -23348,14 +23361,14 @@ var HistoryService = class _HistoryService {
|
|
|
23348
23361
|
try {
|
|
23349
23362
|
const files = fs56.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isFile() && e.name.endsWith(".jsonl")).map((e) => {
|
|
23350
23363
|
try {
|
|
23351
|
-
const stat3 = fs56.statSync(
|
|
23364
|
+
const stat3 = fs56.statSync(path61.join(dir, e.name));
|
|
23352
23365
|
return { name: e.name, mtime: stat3.mtimeMs, birthtime: stat3.birthtimeMs };
|
|
23353
23366
|
} catch {
|
|
23354
23367
|
return { name: e.name, mtime: 0, birthtime: 0 };
|
|
23355
23368
|
}
|
|
23356
23369
|
}).filter((f) => f.birthtime >= cutoff).sort((a, b) => b.mtime - a.mtime);
|
|
23357
23370
|
if (files.length > 0) {
|
|
23358
|
-
this.currentConversationId =
|
|
23371
|
+
this.currentConversationId = path61.basename(files[0].name, ".jsonl");
|
|
23359
23372
|
}
|
|
23360
23373
|
} catch {
|
|
23361
23374
|
}
|
|
@@ -23395,7 +23408,7 @@ var HistoryService = class _HistoryService {
|
|
|
23395
23408
|
}
|
|
23396
23409
|
const files = entries.filter((e) => e.isFile() && e.name.endsWith(".jsonl")).map((e) => {
|
|
23397
23410
|
try {
|
|
23398
|
-
const stat3 = fs56.statSync(
|
|
23411
|
+
const stat3 = fs56.statSync(path61.join(dir, e.name));
|
|
23399
23412
|
return { name: e.name, mtime: stat3.mtimeMs, birthtime: stat3.birthtimeMs };
|
|
23400
23413
|
} catch {
|
|
23401
23414
|
return { name: e.name, mtime: 0, birthtime: 0 };
|
|
@@ -23404,7 +23417,7 @@ var HistoryService = class _HistoryService {
|
|
|
23404
23417
|
if (files.length === 0) return null;
|
|
23405
23418
|
const targetFile = this.currentConversationId ? `${this.currentConversationId}.jsonl` : files[0].name;
|
|
23406
23419
|
if (!files.some((f) => f.name === targetFile)) return null;
|
|
23407
|
-
return this.extractUsageFromFile(
|
|
23420
|
+
return this.extractUsageFromFile(path61.join(dir, targetFile));
|
|
23408
23421
|
}
|
|
23409
23422
|
extractUsageFromFile(filePath) {
|
|
23410
23423
|
let raw;
|
|
@@ -23456,7 +23469,7 @@ var HistoryService = class _HistoryService {
|
|
|
23456
23469
|
try {
|
|
23457
23470
|
files = fs56.readdirSync(projectDir).filter((f) => f.endsWith(".jsonl")).filter((f) => {
|
|
23458
23471
|
try {
|
|
23459
|
-
return fs56.statSync(
|
|
23472
|
+
return fs56.statSync(path61.join(projectDir, f)).mtimeMs >= monthStartMs;
|
|
23460
23473
|
} catch {
|
|
23461
23474
|
return false;
|
|
23462
23475
|
}
|
|
@@ -23467,7 +23480,7 @@ var HistoryService = class _HistoryService {
|
|
|
23467
23480
|
for (const file of files) {
|
|
23468
23481
|
let raw;
|
|
23469
23482
|
try {
|
|
23470
|
-
raw = fs56.readFileSync(
|
|
23483
|
+
raw = fs56.readFileSync(path61.join(projectDir, file), "utf8");
|
|
23471
23484
|
} catch {
|
|
23472
23485
|
continue;
|
|
23473
23486
|
}
|
|
@@ -23546,7 +23559,7 @@ var HistoryService = class _HistoryService {
|
|
|
23546
23559
|
if (this.runtime.resolveHistoryFile) {
|
|
23547
23560
|
return this.runtime.resolveHistoryFile(this.cwd, sessionId);
|
|
23548
23561
|
}
|
|
23549
|
-
return
|
|
23562
|
+
return path61.join(this.projectDir, `${sessionId}.jsonl`);
|
|
23550
23563
|
}
|
|
23551
23564
|
/**
|
|
23552
23565
|
* Parse a conversation's messages from disk, agent-aware. Claude uses the
|
|
@@ -23580,7 +23593,7 @@ var HistoryService = class _HistoryService {
|
|
|
23580
23593
|
};
|
|
23581
23594
|
});
|
|
23582
23595
|
}
|
|
23583
|
-
return parseJsonl(
|
|
23596
|
+
return parseJsonl(path61.join(this.projectDir, `${sessionId}.jsonl`));
|
|
23584
23597
|
}
|
|
23585
23598
|
async loadConversation(sessionId) {
|
|
23586
23599
|
const messages = this.readConversation(sessionId);
|
|
@@ -23708,7 +23721,7 @@ var import_node_child_process26 = require("child_process");
|
|
|
23708
23721
|
var fs57 = __toESM(require("fs/promises"));
|
|
23709
23722
|
var fsSync = __toESM(require("fs"));
|
|
23710
23723
|
var os46 = __toESM(require("os"));
|
|
23711
|
-
var
|
|
23724
|
+
var path62 = __toESM(require("path"));
|
|
23712
23725
|
var import_node_stream = require("stream");
|
|
23713
23726
|
|
|
23714
23727
|
// ../../node_modules/@agentclientprotocol/sdk/dist/acp.js
|
|
@@ -26696,24 +26709,24 @@ function knownAgentBinaryDirs() {
|
|
|
26696
26709
|
out2.push("/tmp/codeam-node20/bin");
|
|
26697
26710
|
for (const root of [
|
|
26698
26711
|
"/usr/local/share/nvm/versions/node",
|
|
26699
|
-
|
|
26712
|
+
path62.join(home, ".nvm/versions/node")
|
|
26700
26713
|
]) {
|
|
26701
26714
|
try {
|
|
26702
26715
|
for (const child of fsSync.readdirSync(root)) {
|
|
26703
|
-
out2.push(
|
|
26716
|
+
out2.push(path62.join(root, child, "bin"));
|
|
26704
26717
|
}
|
|
26705
26718
|
} catch {
|
|
26706
26719
|
}
|
|
26707
26720
|
}
|
|
26708
|
-
out2.push(
|
|
26721
|
+
out2.push(path62.join(home, ".volta/bin"));
|
|
26709
26722
|
out2.push("/usr/local/bin");
|
|
26710
26723
|
out2.push("/usr/bin");
|
|
26711
|
-
out2.push(
|
|
26712
|
-
out2.push(
|
|
26724
|
+
out2.push(path62.join(home, ".local/bin"));
|
|
26725
|
+
out2.push(path62.join(home, "bin"));
|
|
26713
26726
|
if (process.platform === "win32") {
|
|
26714
26727
|
const { LOCALAPPDATA, APPDATA } = process.env;
|
|
26715
|
-
if (LOCALAPPDATA) out2.push(
|
|
26716
|
-
if (APPDATA) out2.push(
|
|
26728
|
+
if (LOCALAPPDATA) out2.push(path62.join(LOCALAPPDATA, "cursor-agent"));
|
|
26729
|
+
if (APPDATA) out2.push(path62.join(APPDATA, "npm"));
|
|
26717
26730
|
}
|
|
26718
26731
|
return out2.filter((p2) => {
|
|
26719
26732
|
try {
|
|
@@ -26725,7 +26738,7 @@ function knownAgentBinaryDirs() {
|
|
|
26725
26738
|
}
|
|
26726
26739
|
function expandPathForAgentBinaries(existingPath) {
|
|
26727
26740
|
const existing = new Set(
|
|
26728
|
-
existingPath.split(
|
|
26741
|
+
existingPath.split(path62.delimiter).filter((p2) => p2.length > 0)
|
|
26729
26742
|
);
|
|
26730
26743
|
const additions = [];
|
|
26731
26744
|
for (const dir of knownAgentBinaryDirs()) {
|
|
@@ -26735,7 +26748,7 @@ function expandPathForAgentBinaries(existingPath) {
|
|
|
26735
26748
|
}
|
|
26736
26749
|
}
|
|
26737
26750
|
if (additions.length === 0) return existingPath;
|
|
26738
|
-
return [...additions, existingPath].filter((p2) => p2.length > 0).join(
|
|
26751
|
+
return [...additions, existingPath].filter((p2) => p2.length > 0).join(path62.delimiter);
|
|
26739
26752
|
}
|
|
26740
26753
|
|
|
26741
26754
|
// src/agents/acp/headroom-budget-proxy.ts
|
|
@@ -27219,12 +27232,12 @@ function commonPrefixLength(a, b) {
|
|
|
27219
27232
|
var import_child_process26 = require("child_process");
|
|
27220
27233
|
var fs58 = __toESM(require("fs"));
|
|
27221
27234
|
var os47 = __toESM(require("os"));
|
|
27222
|
-
var
|
|
27235
|
+
var path63 = __toESM(require("path"));
|
|
27223
27236
|
var _onboardingSeam = {
|
|
27224
|
-
markerPath: (sessionId) =>
|
|
27237
|
+
markerPath: (sessionId) => path63.join(os47.homedir(), ".codeam", "welcomed", `${sessionId}.done`),
|
|
27225
27238
|
exists: (p2) => fs58.existsSync(p2),
|
|
27226
27239
|
write: (p2) => {
|
|
27227
|
-
fs58.mkdirSync(
|
|
27240
|
+
fs58.mkdirSync(path63.dirname(p2), { recursive: true });
|
|
27228
27241
|
fs58.writeFileSync(p2, "");
|
|
27229
27242
|
},
|
|
27230
27243
|
disabled: () => {
|
|
@@ -27262,7 +27275,7 @@ function resolveRepoName(cwd) {
|
|
|
27262
27275
|
if (name) return name;
|
|
27263
27276
|
}
|
|
27264
27277
|
}
|
|
27265
|
-
const base =
|
|
27278
|
+
const base = path63.basename(cwd || "");
|
|
27266
27279
|
if (base && !isUuid(base)) return base;
|
|
27267
27280
|
return "this project";
|
|
27268
27281
|
}
|
|
@@ -27515,7 +27528,7 @@ var import_crypto5 = require("crypto");
|
|
|
27515
27528
|
// src/services/turn-files/git-changeset.ts
|
|
27516
27529
|
var import_child_process27 = require("child_process");
|
|
27517
27530
|
var fs59 = __toESM(require("fs/promises"));
|
|
27518
|
-
var
|
|
27531
|
+
var path64 = __toESM(require("path"));
|
|
27519
27532
|
async function collectRepoChangeset(opts) {
|
|
27520
27533
|
const status2 = await runGit3(opts.repoRoot, ["status", "--porcelain=v1", "-z"]);
|
|
27521
27534
|
if (status2 === null) return null;
|
|
@@ -27533,7 +27546,7 @@ async function collectRepoChangeset(opts) {
|
|
|
27533
27546
|
let stats;
|
|
27534
27547
|
if (row.fileStatus === "added" && numstatEntry === void 0) {
|
|
27535
27548
|
const lineCount = await readUntrackedLineCount(
|
|
27536
|
-
|
|
27549
|
+
path64.join(opts.repoRoot, row.filePath)
|
|
27537
27550
|
);
|
|
27538
27551
|
stats = { added: lineCount, removed: 0 };
|
|
27539
27552
|
} else {
|
|
@@ -27675,8 +27688,8 @@ async function discoverRepos(workingDir, maxDepth = 4) {
|
|
|
27675
27688
|
if (hasGit) {
|
|
27676
27689
|
out2.push({
|
|
27677
27690
|
repoRoot: dir,
|
|
27678
|
-
repoPath:
|
|
27679
|
-
repoName:
|
|
27691
|
+
repoPath: path64.relative(workingDir, dir),
|
|
27692
|
+
repoName: path64.basename(dir)
|
|
27680
27693
|
});
|
|
27681
27694
|
return;
|
|
27682
27695
|
}
|
|
@@ -27684,14 +27697,14 @@ async function discoverRepos(workingDir, maxDepth = 4) {
|
|
|
27684
27697
|
if (!entry.isDirectory) continue;
|
|
27685
27698
|
if (entry.name === "node_modules") continue;
|
|
27686
27699
|
if (entry.name === "dist" || entry.name === "build") continue;
|
|
27687
|
-
await walk(
|
|
27700
|
+
await walk(path64.join(dir, entry.name), depth + 1);
|
|
27688
27701
|
}
|
|
27689
27702
|
}
|
|
27690
27703
|
}
|
|
27691
27704
|
|
|
27692
27705
|
// src/services/turn-files/files-outbox.ts
|
|
27693
27706
|
var fs60 = __toESM(require("fs/promises"));
|
|
27694
|
-
var
|
|
27707
|
+
var path65 = __toESM(require("path"));
|
|
27695
27708
|
var import_os12 = require("os");
|
|
27696
27709
|
var HOME_OUTBOX_DIR = ".codeam/outbox";
|
|
27697
27710
|
var MAX_AGE_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -27724,15 +27737,15 @@ var FilesOutbox = class {
|
|
|
27724
27737
|
backoffIndex = 0;
|
|
27725
27738
|
stopped = false;
|
|
27726
27739
|
constructor(opts) {
|
|
27727
|
-
const base = opts.baseDir ??
|
|
27728
|
-
this.filePath =
|
|
27740
|
+
const base = opts.baseDir ?? path65.join(homeDir(), HOME_OUTBOX_DIR);
|
|
27741
|
+
this.filePath = path65.join(base, `${opts.sessionId}.jsonl`);
|
|
27729
27742
|
this.post = opts.post;
|
|
27730
27743
|
this.autoSchedule = opts.autoSchedule !== false;
|
|
27731
27744
|
}
|
|
27732
27745
|
/** Persist the entry to disk and trigger a flush. Returns once the
|
|
27733
27746
|
* line is durable on disk (not once the POST succeeds). */
|
|
27734
27747
|
async enqueue(entry) {
|
|
27735
|
-
await fs60.mkdir(
|
|
27748
|
+
await fs60.mkdir(path65.dirname(this.filePath), { recursive: true });
|
|
27736
27749
|
await fs60.appendFile(this.filePath, JSON.stringify(entry) + "\n", "utf8");
|
|
27737
27750
|
this.backoffIndex = 0;
|
|
27738
27751
|
if (this.autoSchedule) this.scheduleFlush(0);
|
|
@@ -31277,10 +31290,10 @@ function toEpochMs(ts) {
|
|
|
31277
31290
|
// src/agents/claude/onboarding.ts
|
|
31278
31291
|
var fs62 = __toESM(require("fs"));
|
|
31279
31292
|
var os48 = __toESM(require("os"));
|
|
31280
|
-
var
|
|
31293
|
+
var path66 = __toESM(require("path"));
|
|
31281
31294
|
function ensureClaudeOnboarded() {
|
|
31282
31295
|
try {
|
|
31283
|
-
const file =
|
|
31296
|
+
const file = path66.join(os48.homedir(), ".claude.json");
|
|
31284
31297
|
let config = {};
|
|
31285
31298
|
try {
|
|
31286
31299
|
config = JSON.parse(fs62.readFileSync(file, "utf8"));
|
|
@@ -31294,7 +31307,7 @@ function ensureClaudeOnboarded() {
|
|
|
31294
31307
|
if (typeof config.lastOnboardingVersion !== "string") {
|
|
31295
31308
|
config.lastOnboardingVersion = "2.1.177";
|
|
31296
31309
|
}
|
|
31297
|
-
fs62.mkdirSync(
|
|
31310
|
+
fs62.mkdirSync(path66.dirname(file), { recursive: true });
|
|
31298
31311
|
fs62.writeFileSync(file, JSON.stringify(config, null, 2));
|
|
31299
31312
|
log.info("claude", "pre-completed Claude onboarding (skip first-run theme picker)");
|
|
31300
31313
|
} catch (err) {
|
|
@@ -31969,7 +31982,7 @@ var import_picocolors11 = __toESM(require("picocolors"));
|
|
|
31969
31982
|
var import_child_process28 = require("child_process");
|
|
31970
31983
|
var import_util4 = require("util");
|
|
31971
31984
|
var import_picocolors9 = __toESM(require("picocolors"));
|
|
31972
|
-
var
|
|
31985
|
+
var path67 = __toESM(require("path"));
|
|
31973
31986
|
var execFileP6 = (0, import_util4.promisify)(import_child_process28.execFile);
|
|
31974
31987
|
var MAX_BUFFER = 8 * 1024 * 1024;
|
|
31975
31988
|
function resetStdinForChild() {
|
|
@@ -32458,7 +32471,7 @@ var GitHubCodespacesProvider = class {
|
|
|
32458
32471
|
});
|
|
32459
32472
|
}
|
|
32460
32473
|
async uploadFile(workspaceId, remotePath, contents, options = {}) {
|
|
32461
|
-
const remoteDir =
|
|
32474
|
+
const remoteDir = path67.posix.dirname(remotePath);
|
|
32462
32475
|
const parts = [
|
|
32463
32476
|
`mkdir -p ${shellQuote(remoteDir)}`,
|
|
32464
32477
|
`cat > ${shellQuote(remotePath)}`
|
|
@@ -32528,7 +32541,7 @@ function shellQuote(s) {
|
|
|
32528
32541
|
// src/services/providers/gitpod.ts
|
|
32529
32542
|
var import_child_process29 = require("child_process");
|
|
32530
32543
|
var import_util5 = require("util");
|
|
32531
|
-
var
|
|
32544
|
+
var path68 = __toESM(require("path"));
|
|
32532
32545
|
var import_picocolors10 = __toESM(require("picocolors"));
|
|
32533
32546
|
var execFileP7 = (0, import_util5.promisify)(import_child_process29.execFile);
|
|
32534
32547
|
var MAX_BUFFER2 = 8 * 1024 * 1024;
|
|
@@ -32768,7 +32781,7 @@ var GitpodProvider = class {
|
|
|
32768
32781
|
});
|
|
32769
32782
|
}
|
|
32770
32783
|
async uploadFile(workspaceId, remotePath, contents, options = {}) {
|
|
32771
|
-
const remoteDir =
|
|
32784
|
+
const remoteDir = path68.posix.dirname(remotePath);
|
|
32772
32785
|
const parts = [
|
|
32773
32786
|
`mkdir -p ${shellQuote2(remoteDir)}`,
|
|
32774
32787
|
`cat > ${shellQuote2(remotePath)}`
|
|
@@ -32804,7 +32817,7 @@ function shellQuote2(s) {
|
|
|
32804
32817
|
// src/services/providers/gitlab-workspaces.ts
|
|
32805
32818
|
var import_child_process30 = require("child_process");
|
|
32806
32819
|
var import_util6 = require("util");
|
|
32807
|
-
var
|
|
32820
|
+
var path69 = __toESM(require("path"));
|
|
32808
32821
|
var execFileP8 = (0, import_util6.promisify)(import_child_process30.execFile);
|
|
32809
32822
|
var MAX_BUFFER3 = 8 * 1024 * 1024;
|
|
32810
32823
|
var GITLAB_API_BASE = process.env.CODEAM_GITLAB_API_URL ?? "https://gitlab.com/api/v4";
|
|
@@ -33064,7 +33077,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
33064
33077
|
}
|
|
33065
33078
|
async uploadFile(workspaceId, remotePath, contents, options = {}) {
|
|
33066
33079
|
const sshHost = process.env.CODEAM_GITLAB_SSH_HOST ?? "workspaces.gitlab.com";
|
|
33067
|
-
const remoteDir =
|
|
33080
|
+
const remoteDir = path69.posix.dirname(remotePath);
|
|
33068
33081
|
const parts = [`mkdir -p ${shellQuote3(remoteDir)}`, `cat > ${shellQuote3(remotePath)}`];
|
|
33069
33082
|
if (options.mode != null) {
|
|
33070
33083
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote3(remotePath)}`);
|
|
@@ -33132,7 +33145,7 @@ function shellQuote3(s) {
|
|
|
33132
33145
|
// src/services/providers/railway.ts
|
|
33133
33146
|
var import_child_process31 = require("child_process");
|
|
33134
33147
|
var import_util7 = require("util");
|
|
33135
|
-
var
|
|
33148
|
+
var path70 = __toESM(require("path"));
|
|
33136
33149
|
var execFileP9 = (0, import_util7.promisify)(import_child_process31.execFile);
|
|
33137
33150
|
var MAX_BUFFER4 = 8 * 1024 * 1024;
|
|
33138
33151
|
function resetStdinForChild4() {
|
|
@@ -33368,7 +33381,7 @@ var RailwayProvider = class {
|
|
|
33368
33381
|
if (!projectId || !serviceId) {
|
|
33369
33382
|
throw new Error("Invalid Railway workspace id (expected projectId/serviceId).");
|
|
33370
33383
|
}
|
|
33371
|
-
const remoteDir =
|
|
33384
|
+
const remoteDir = path70.posix.dirname(remotePath);
|
|
33372
33385
|
const parts = [`mkdir -p ${shellQuote4(remoteDir)}`, `cat > ${shellQuote4(remotePath)}`];
|
|
33373
33386
|
if (options.mode != null) {
|
|
33374
33387
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote4(remotePath)}`);
|
|
@@ -34015,7 +34028,7 @@ var import_node_dns = require("dns");
|
|
|
34015
34028
|
var import_node_util5 = require("util");
|
|
34016
34029
|
var import_node_crypto12 = require("crypto");
|
|
34017
34030
|
var fs63 = __toESM(require("fs"));
|
|
34018
|
-
var
|
|
34031
|
+
var path71 = __toESM(require("path"));
|
|
34019
34032
|
var import_picocolors14 = __toESM(require("picocolors"));
|
|
34020
34033
|
var dnsResolveP = (0, import_node_util5.promisify)(import_node_dns.resolve);
|
|
34021
34034
|
async function checkDns(apiBase2) {
|
|
@@ -34071,10 +34084,10 @@ async function checkHealth(apiBase2) {
|
|
|
34071
34084
|
}
|
|
34072
34085
|
}
|
|
34073
34086
|
function checkConfigDir() {
|
|
34074
|
-
const dir =
|
|
34087
|
+
const dir = path71.join(require("os").homedir(), ".codeam");
|
|
34075
34088
|
try {
|
|
34076
34089
|
fs63.mkdirSync(dir, { recursive: true, mode: 448 });
|
|
34077
|
-
const probe =
|
|
34090
|
+
const probe = path71.join(dir, ".doctor-probe");
|
|
34078
34091
|
fs63.writeFileSync(probe, "ok", { mode: 384 });
|
|
34079
34092
|
const read2 = fs63.readFileSync(probe, "utf8");
|
|
34080
34093
|
fs63.unlinkSync(probe);
|
|
@@ -34141,7 +34154,7 @@ function checkNodePty() {
|
|
|
34141
34154
|
detail: "not required on this platform"
|
|
34142
34155
|
};
|
|
34143
34156
|
}
|
|
34144
|
-
const vendoredPath =
|
|
34157
|
+
const vendoredPath = path71.join(__dirname, "vendor", "node-pty");
|
|
34145
34158
|
for (const target of [vendoredPath, "node-pty"]) {
|
|
34146
34159
|
try {
|
|
34147
34160
|
require(target);
|
|
@@ -34183,7 +34196,7 @@ function checkChokidar() {
|
|
|
34183
34196
|
}
|
|
34184
34197
|
async function doctor(args2 = []) {
|
|
34185
34198
|
const json = args2.includes("--json");
|
|
34186
|
-
const cliVersion = true ? "2.60.
|
|
34199
|
+
const cliVersion = true ? "2.60.27" : "0.0.0-dev";
|
|
34187
34200
|
const apiBase2 = resolveApiBaseUrl();
|
|
34188
34201
|
const diagnosticId = (0, import_node_crypto12.randomUUID)();
|
|
34189
34202
|
log.info("doctor", `run id=${diagnosticId} cli=${cliVersion}`);
|
|
@@ -34382,7 +34395,7 @@ async function completion(args2) {
|
|
|
34382
34395
|
// src/commands/version.ts
|
|
34383
34396
|
var import_picocolors15 = __toESM(require("picocolors"));
|
|
34384
34397
|
function version2() {
|
|
34385
|
-
const v = true ? "2.60.
|
|
34398
|
+
const v = true ? "2.60.27" : "unknown";
|
|
34386
34399
|
console.log(`${import_picocolors15.default.bold("codeam-cli")} ${import_picocolors15.default.cyan(v)}`);
|
|
34387
34400
|
}
|
|
34388
34401
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeam-cli",
|
|
3
|
-
"version": "2.60.
|
|
3
|
+
"version": "2.60.27",
|
|
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",
|