codeam-cli 2.76.41 → 2.76.42
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 +7 -0
- package/dist/index.js +321 -270
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -375,7 +375,7 @@ function defaultSpawn(timeoutMs) {
|
|
|
375
375
|
}
|
|
376
376
|
function resolveConvexBin(cwd) {
|
|
377
377
|
const local = path114.join(cwd, "node_modules", ".bin", process.platform === "win32" ? "convex.cmd" : "convex");
|
|
378
|
-
if (
|
|
378
|
+
if (fs102.existsSync(local)) return { cmd: local, args: [] };
|
|
379
379
|
return { cmd: "npx", args: ["--yes", "convex"] };
|
|
380
380
|
}
|
|
381
381
|
function redact(text, key) {
|
|
@@ -506,12 +506,12 @@ async function runConvexAdminMcp(client3, id) {
|
|
|
506
506
|
});
|
|
507
507
|
await server.connect(new StdioServerTransport());
|
|
508
508
|
}
|
|
509
|
-
var import_node_child_process40,
|
|
509
|
+
var import_node_child_process40, fs102, path114, TOOLS;
|
|
510
510
|
var init_convex_admin_mcp = __esm({
|
|
511
511
|
"src/integrations/convex-admin-mcp.ts"() {
|
|
512
512
|
"use strict";
|
|
513
513
|
import_node_child_process40 = require("child_process");
|
|
514
|
-
|
|
514
|
+
fs102 = __toESM(require("fs"));
|
|
515
515
|
path114 = __toESM(require("path"));
|
|
516
516
|
TOOLS = [
|
|
517
517
|
{
|
|
@@ -4539,7 +4539,7 @@ var _default = makeConfig();
|
|
|
4539
4539
|
var { getConfig, ensurePluginId, addSession, removeSession, setActiveSession, getActiveSession, getActiveSessionForAgent, setDisable1mContext, setSessionAgent, setSquadAuto, getSquadAuto, clearAll, saveCliConfig, loadCliConfig } = _default;
|
|
4540
4540
|
|
|
4541
4541
|
// src/commands/pair-auto.ts
|
|
4542
|
-
var
|
|
4542
|
+
var fs69 = __toESM(require("fs"));
|
|
4543
4543
|
var os49 = __toESM(require("os"));
|
|
4544
4544
|
var path76 = __toESM(require("path"));
|
|
4545
4545
|
var import_crypto4 = require("crypto");
|
|
@@ -11354,7 +11354,7 @@ function readAnonId() {
|
|
|
11354
11354
|
}
|
|
11355
11355
|
function superProperties() {
|
|
11356
11356
|
return {
|
|
11357
|
-
cliVersion: true ? "2.76.
|
|
11357
|
+
cliVersion: true ? "2.76.42" : "0.0.0-dev",
|
|
11358
11358
|
nodeVersion: process.version,
|
|
11359
11359
|
platform: process.platform,
|
|
11360
11360
|
arch: process.arch,
|
|
@@ -11603,7 +11603,7 @@ var http = __toESM(require("http"));
|
|
|
11603
11603
|
// package.json
|
|
11604
11604
|
var package_default = {
|
|
11605
11605
|
name: "codeam-cli",
|
|
11606
|
-
version: "2.76.
|
|
11606
|
+
version: "2.76.42",
|
|
11607
11607
|
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.",
|
|
11608
11608
|
type: "commonjs",
|
|
11609
11609
|
main: "dist/index.js",
|
|
@@ -12979,7 +12979,7 @@ var CommandRelayService = class _CommandRelayService {
|
|
|
12979
12979
|
// fresh + clear the "CLI update available" banner after a self-update
|
|
12980
12980
|
// (a codespace that reinstalls @latest reconnects via heartbeat, not
|
|
12981
12981
|
// pair/reconnect). Older backends ignore the extra field.
|
|
12982
|
-
..."2.76.
|
|
12982
|
+
..."2.76.42" ? { ideVersion: "2.76.42" } : {}
|
|
12983
12983
|
};
|
|
12984
12984
|
try {
|
|
12985
12985
|
const res = await _postJson(`${API_BASE2}/api/plugin/heartbeat`, body, this.pollSecretHeader());
|
|
@@ -14460,7 +14460,7 @@ function closeAllTerminals() {
|
|
|
14460
14460
|
}
|
|
14461
14461
|
|
|
14462
14462
|
// src/commands/start/handlers.ts
|
|
14463
|
-
var
|
|
14463
|
+
var fs68 = __toESM(require("fs"));
|
|
14464
14464
|
var os48 = __toESM(require("os"));
|
|
14465
14465
|
var path75 = __toESM(require("path"));
|
|
14466
14466
|
var import_crypto3 = require("crypto");
|
|
@@ -21542,14 +21542,14 @@ function defaultSdkDir() {
|
|
|
21542
21542
|
return resolveSdkDirViaRequire();
|
|
21543
21543
|
}
|
|
21544
21544
|
function resolveClaudeNativeBinary(deps = {}) {
|
|
21545
|
-
const
|
|
21545
|
+
const existsSync37 = deps.existsSync ?? import_fs.default.existsSync;
|
|
21546
21546
|
const platformKey = deps.platformKey ?? currentPlatformKey();
|
|
21547
21547
|
const sdkDir = deps.sdkDir !== void 0 ? deps.sdkDir : defaultSdkDir();
|
|
21548
21548
|
if (!sdkDir) return null;
|
|
21549
21549
|
const scopeDir = import_path4.default.dirname(sdkDir);
|
|
21550
21550
|
const binName = platformKey.startsWith("win32-") ? "claude.exe" : "claude";
|
|
21551
21551
|
const candidate = import_path4.default.join(scopeDir, `claude-agent-sdk-${platformKey}`, binName);
|
|
21552
|
-
return
|
|
21552
|
+
return existsSync37(candidate) ? candidate : null;
|
|
21553
21553
|
}
|
|
21554
21554
|
var realSleep = (ms) => new Promise((resolve13) => setTimeout(resolve13, ms));
|
|
21555
21555
|
async function waitForClaudeNativeBinary(opts = {}) {
|
|
@@ -21640,18 +21640,18 @@ function augmentUserLocalBinPaths(deps = {}) {
|
|
|
21640
21640
|
env.PATH = [...additions, ...parts].join(p2.delimiter);
|
|
21641
21641
|
}
|
|
21642
21642
|
function resolveCursorAgentBinary(deps = {}) {
|
|
21643
|
-
const
|
|
21643
|
+
const existsSync37 = deps.existsSync ?? import_fs.default.existsSync;
|
|
21644
21644
|
const platform3 = deps.platform ?? process.platform;
|
|
21645
21645
|
const env = deps.env ?? process.env;
|
|
21646
21646
|
if (platform3 === "win32") {
|
|
21647
21647
|
const localAppData = env.LOCALAPPDATA;
|
|
21648
21648
|
if (!localAppData) return null;
|
|
21649
21649
|
const exe = import_path4.default.win32.join(localAppData, "cursor-agent", "cursor-agent.exe");
|
|
21650
|
-
return
|
|
21650
|
+
return existsSync37(exe) ? exe : null;
|
|
21651
21651
|
}
|
|
21652
21652
|
const home = deps.homedir ?? import_os4.default.homedir();
|
|
21653
21653
|
const unix = import_path4.default.posix.join(home, ".local", "bin", "cursor-agent");
|
|
21654
|
-
return
|
|
21654
|
+
return existsSync37(unix) ? unix : null;
|
|
21655
21655
|
}
|
|
21656
21656
|
async function waitForCursorAgent(opts = {}) {
|
|
21657
21657
|
const timeoutMs = opts.timeoutMs ?? 18e4;
|
|
@@ -24874,6 +24874,7 @@ function quoteIfNeeded(value) {
|
|
|
24874
24874
|
}
|
|
24875
24875
|
|
|
24876
24876
|
// src/services/preview/expo.ts
|
|
24877
|
+
var fs45 = __toESM(require("fs"));
|
|
24877
24878
|
var http6 = __toESM(require("http"));
|
|
24878
24879
|
var path52 = __toESM(require("path"));
|
|
24879
24880
|
var EXPO_PACKAGER_PROXY_URL_ENV = "EXPO_PACKAGER_PROXY_URL";
|
|
@@ -24917,6 +24918,38 @@ async function waitForExpoManifest(port, opts) {
|
|
|
24917
24918
|
await new Promise((r) => setTimeout(r, interval));
|
|
24918
24919
|
}
|
|
24919
24920
|
}
|
|
24921
|
+
var EXPO_WEB_PACKAGES = ["react-native-web", "react-dom", "@expo/metro-runtime"];
|
|
24922
|
+
function missingExpoWebPackages(cwd) {
|
|
24923
|
+
return EXPO_WEB_PACKAGES.filter(
|
|
24924
|
+
(p2) => !fs45.existsSync(path52.join(cwd, "node_modules", p2, "package.json"))
|
|
24925
|
+
);
|
|
24926
|
+
}
|
|
24927
|
+
function expoWebInstallSpecs(cwd, missing) {
|
|
24928
|
+
let pinned = {};
|
|
24929
|
+
try {
|
|
24930
|
+
const raw = JSON.parse(
|
|
24931
|
+
fs45.readFileSync(path52.join(cwd, "node_modules", "expo", "bundledNativeModules.json"), "utf8")
|
|
24932
|
+
);
|
|
24933
|
+
if (raw && typeof raw === "object" && !Array.isArray(raw)) pinned = raw;
|
|
24934
|
+
} catch {
|
|
24935
|
+
}
|
|
24936
|
+
return missing.map((p2) => typeof pinned[p2] === "string" ? `${p2}@${String(pinned[p2])}` : p2);
|
|
24937
|
+
}
|
|
24938
|
+
function expoWebDepsInstall(cwd) {
|
|
24939
|
+
const missing = missingExpoWebPackages(cwd);
|
|
24940
|
+
if (missing.length === 0) return null;
|
|
24941
|
+
return {
|
|
24942
|
+
cmd: "npm",
|
|
24943
|
+
args: [
|
|
24944
|
+
"install",
|
|
24945
|
+
"--no-save",
|
|
24946
|
+
"--legacy-peer-deps",
|
|
24947
|
+
"--no-audit",
|
|
24948
|
+
"--no-fund",
|
|
24949
|
+
...expoWebInstallSpecs(cwd, missing)
|
|
24950
|
+
]
|
|
24951
|
+
};
|
|
24952
|
+
}
|
|
24920
24953
|
|
|
24921
24954
|
// src/services/preview/parser.ts
|
|
24922
24955
|
var REQUIRED_FIELDS2 = [
|
|
@@ -25542,7 +25575,7 @@ function isComposerInstallCommand(cmd, args2) {
|
|
|
25542
25575
|
}
|
|
25543
25576
|
|
|
25544
25577
|
// src/services/preview/script-candidates.ts
|
|
25545
|
-
var
|
|
25578
|
+
var fs48 = __toESM(require("fs"));
|
|
25546
25579
|
var path55 = __toESM(require("path"));
|
|
25547
25580
|
var EXCLUDE_RE = /(^|:)(deploy|publish|release|build|test|e2e|lint|format|typecheck|type-check|clean|prebuild|postinstall|preinstall|prepare|install|migrate|seed|db|prisma|codegen|storybook-build)(:|$)/i;
|
|
25548
25581
|
var EXCLUDE_BODY_RE = /\b(run:android|run:ios|gradlew|fastlane|xcodebuild|eas build|eas submit)\b/i;
|
|
@@ -25561,7 +25594,7 @@ function frameworkFor(pkg, body) {
|
|
|
25561
25594
|
}
|
|
25562
25595
|
function readPkg(file) {
|
|
25563
25596
|
try {
|
|
25564
|
-
return JSON.parse(
|
|
25597
|
+
return JSON.parse(fs48.readFileSync(file, "utf8"));
|
|
25565
25598
|
} catch {
|
|
25566
25599
|
return null;
|
|
25567
25600
|
}
|
|
@@ -25571,7 +25604,7 @@ function expandGlob(root, pattern) {
|
|
|
25571
25604
|
if (!clean.endsWith("/*")) return [clean];
|
|
25572
25605
|
const base = clean.slice(0, -2);
|
|
25573
25606
|
try {
|
|
25574
|
-
return
|
|
25607
|
+
return fs48.readdirSync(path55.join(root, base), { withFileTypes: true }).filter((d3) => d3.isDirectory() && !d3.name.startsWith(".") && d3.name !== "node_modules").map((d3) => path55.join(base, d3.name));
|
|
25575
25608
|
} catch {
|
|
25576
25609
|
return [];
|
|
25577
25610
|
}
|
|
@@ -25580,7 +25613,7 @@ function workspaceDirs(root, rootPkg) {
|
|
|
25580
25613
|
const ws = rootPkg?.workspaces;
|
|
25581
25614
|
const patterns = Array.isArray(ws) ? ws : ws?.packages ?? [];
|
|
25582
25615
|
try {
|
|
25583
|
-
const pnpm =
|
|
25616
|
+
const pnpm = fs48.readFileSync(path55.join(root, "pnpm-workspace.yaml"), "utf8");
|
|
25584
25617
|
for (const m of pnpm.matchAll(/^\s*-\s*['"]?([^'"\n]+)['"]?\s*$/gm)) patterns.push(m[1]);
|
|
25585
25618
|
} catch {
|
|
25586
25619
|
}
|
|
@@ -26365,7 +26398,7 @@ async function readActivePreviewMarker(cwd, homeDir2) {
|
|
|
26365
26398
|
}
|
|
26366
26399
|
|
|
26367
26400
|
// src/agents/acp/guardrail-config.ts
|
|
26368
|
-
var
|
|
26401
|
+
var fs53 = __toESM(require("fs"));
|
|
26369
26402
|
var path60 = __toESM(require("path"));
|
|
26370
26403
|
var os37 = __toESM(require("os"));
|
|
26371
26404
|
var current = null;
|
|
@@ -26374,7 +26407,7 @@ function guardrailConfigPath(homeDir2 = os37.homedir()) {
|
|
|
26374
26407
|
}
|
|
26375
26408
|
function loadGuardrailPolicy(homeDir2 = os37.homedir()) {
|
|
26376
26409
|
try {
|
|
26377
|
-
current = normalizeGuardrailPolicy(JSON.parse(
|
|
26410
|
+
current = normalizeGuardrailPolicy(JSON.parse(fs53.readFileSync(guardrailConfigPath(homeDir2), "utf8")));
|
|
26378
26411
|
} catch {
|
|
26379
26412
|
current = { ...DEFAULT_GUARDRAIL_POLICY };
|
|
26380
26413
|
}
|
|
@@ -26388,8 +26421,8 @@ function setGuardrailPolicy(raw, homeDir2 = os37.homedir()) {
|
|
|
26388
26421
|
current = next;
|
|
26389
26422
|
try {
|
|
26390
26423
|
const p2 = guardrailConfigPath(homeDir2);
|
|
26391
|
-
|
|
26392
|
-
|
|
26424
|
+
fs53.mkdirSync(path60.dirname(p2), { recursive: true });
|
|
26425
|
+
fs53.writeFileSync(p2, JSON.stringify(next, null, 2));
|
|
26393
26426
|
} catch {
|
|
26394
26427
|
}
|
|
26395
26428
|
return next;
|
|
@@ -26405,7 +26438,7 @@ function shouldOfferOneMRecovery(opts) {
|
|
|
26405
26438
|
}
|
|
26406
26439
|
|
|
26407
26440
|
// src/commands/host/house-proxy-config.ts
|
|
26408
|
-
var
|
|
26441
|
+
var fs54 = __toESM(require("fs"));
|
|
26409
26442
|
var os38 = __toESM(require("os"));
|
|
26410
26443
|
var path61 = __toESM(require("path"));
|
|
26411
26444
|
function houseProxyConfigPath() {
|
|
@@ -26417,10 +26450,10 @@ function deployHouseProxyConfigPath(deployId) {
|
|
|
26417
26450
|
return path61.join(os38.homedir(), ".codeam", "house-proxy", `${deployId}.json`);
|
|
26418
26451
|
}
|
|
26419
26452
|
function writeJson0600(file, value) {
|
|
26420
|
-
|
|
26453
|
+
fs54.mkdirSync(path61.dirname(file), { recursive: true, mode: 448 });
|
|
26421
26454
|
const tmp = `${file}.tmp-${process.pid}`;
|
|
26422
|
-
|
|
26423
|
-
|
|
26455
|
+
fs54.writeFileSync(tmp, JSON.stringify(value, null, 2), { encoding: "utf8", mode: 384 });
|
|
26456
|
+
fs54.renameSync(tmp, file);
|
|
26424
26457
|
restrictToOwner(file);
|
|
26425
26458
|
}
|
|
26426
26459
|
function persistHouseProxyConfig(config, deployId) {
|
|
@@ -26437,7 +26470,7 @@ function persistHouseProxyConfig(config, deployId) {
|
|
|
26437
26470
|
}
|
|
26438
26471
|
function clearHouseProxyConfig(deployId) {
|
|
26439
26472
|
try {
|
|
26440
|
-
|
|
26473
|
+
fs54.rmSync(houseProxyConfigPath(), { force: true });
|
|
26441
26474
|
const perDeploy = deployId ? deployHouseProxyConfigPath(deployId) : null;
|
|
26442
26475
|
if (perDeploy) writeJson0600(perDeploy, { none: true });
|
|
26443
26476
|
} catch {
|
|
@@ -26460,12 +26493,12 @@ function houseProxyTokenExpiring(token, nowSec, windowSec = HOUSE_PROXY_REFRESH_
|
|
|
26460
26493
|
}
|
|
26461
26494
|
function persistedConfigFile(deployId) {
|
|
26462
26495
|
const perDeploy = deployId ? deployHouseProxyConfigPath(deployId) : null;
|
|
26463
|
-
const file = perDeploy &&
|
|
26464
|
-
return
|
|
26496
|
+
const file = perDeploy && fs54.existsSync(perDeploy) ? perDeploy : houseProxyConfigPath();
|
|
26497
|
+
return fs54.existsSync(file) ? file : null;
|
|
26465
26498
|
}
|
|
26466
26499
|
function readConfigObject(file) {
|
|
26467
26500
|
try {
|
|
26468
|
-
const parsed = JSON.parse(
|
|
26501
|
+
const parsed = JSON.parse(fs54.readFileSync(file, "utf8"));
|
|
26469
26502
|
return typeof parsed === "object" && parsed !== null ? parsed : null;
|
|
26470
26503
|
} catch {
|
|
26471
26504
|
return null;
|
|
@@ -26498,8 +26531,8 @@ function rewriteHouseProxyToken(deployId, freshToken) {
|
|
|
26498
26531
|
function readHouseProxyChildEnv(deployId) {
|
|
26499
26532
|
try {
|
|
26500
26533
|
const perDeploy = deployId ? deployHouseProxyConfigPath(deployId) : null;
|
|
26501
|
-
const file = perDeploy &&
|
|
26502
|
-
const raw =
|
|
26534
|
+
const file = perDeploy && fs54.existsSync(perDeploy) ? perDeploy : houseProxyConfigPath();
|
|
26535
|
+
const raw = fs54.readFileSync(file, "utf8");
|
|
26503
26536
|
const parsed = JSON.parse(raw);
|
|
26504
26537
|
if (typeof parsed !== "object" || parsed === null) return {};
|
|
26505
26538
|
const o = parsed;
|
|
@@ -26609,7 +26642,7 @@ function pickHouseProxyEnv(env) {
|
|
|
26609
26642
|
}
|
|
26610
26643
|
|
|
26611
26644
|
// src/lib/provider-routing.ts
|
|
26612
|
-
var
|
|
26645
|
+
var fs55 = __toESM(require("fs"));
|
|
26613
26646
|
var os39 = __toESM(require("os"));
|
|
26614
26647
|
var path62 = __toESM(require("path"));
|
|
26615
26648
|
var PROVIDER_BASE_URL_ENV_KEYS = [
|
|
@@ -26634,7 +26667,7 @@ function redactUrlToOrigin(raw) {
|
|
|
26634
26667
|
}
|
|
26635
26668
|
function readOpencodeProviderOrigins(opts = {}) {
|
|
26636
26669
|
const home = opts.homeDir ?? os39.homedir();
|
|
26637
|
-
const readFile8 = opts.readFile ?? ((f) =>
|
|
26670
|
+
const readFile8 = opts.readFile ?? ((f) => fs55.readFileSync(f, "utf8"));
|
|
26638
26671
|
const candidates = [];
|
|
26639
26672
|
if (opts.cwd) {
|
|
26640
26673
|
candidates.push(path62.join(opts.cwd, "opencode.json"), path62.join(opts.cwd, "opencode.jsonc"));
|
|
@@ -26995,7 +27028,7 @@ function adapterExitMessage(opts) {
|
|
|
26995
27028
|
|
|
26996
27029
|
// src/services/preview/start-orchestrator.ts
|
|
26997
27030
|
var import_child_process20 = require("child_process");
|
|
26998
|
-
var
|
|
27031
|
+
var fs59 = __toESM(require("fs"));
|
|
26999
27032
|
var path66 = __toESM(require("path"));
|
|
27000
27033
|
var import_which3 = __toESM(require("which"));
|
|
27001
27034
|
|
|
@@ -27035,7 +27068,7 @@ var path65 = __toESM(require("path"));
|
|
|
27035
27068
|
// src/beads/project-key.ts
|
|
27036
27069
|
var import_child_process19 = require("child_process");
|
|
27037
27070
|
var crypto2 = __toESM(require("crypto"));
|
|
27038
|
-
var
|
|
27071
|
+
var fs57 = __toESM(require("fs"));
|
|
27039
27072
|
var path64 = __toESM(require("path"));
|
|
27040
27073
|
function normalizeOrigin(raw) {
|
|
27041
27074
|
const trimmed = raw.trim();
|
|
@@ -27068,7 +27101,7 @@ function findRepoRoot(cwd) {
|
|
|
27068
27101
|
if (seen2.has(dir)) return null;
|
|
27069
27102
|
seen2.add(dir);
|
|
27070
27103
|
try {
|
|
27071
|
-
const stat3 =
|
|
27104
|
+
const stat3 = fs57.statSync(path64.join(dir, ".git"), { throwIfNoEntry: false });
|
|
27072
27105
|
if (stat3 && (stat3.isDirectory() || stat3.isFile())) return dir;
|
|
27073
27106
|
} catch {
|
|
27074
27107
|
}
|
|
@@ -27083,7 +27116,7 @@ var _execSeam3 = {
|
|
|
27083
27116
|
const out2 = (0, import_child_process19.execFileSync)(file, args2, opts);
|
|
27084
27117
|
return typeof out2 === "string" ? out2 : out2.toString("utf8");
|
|
27085
27118
|
},
|
|
27086
|
-
realpath: (p2) =>
|
|
27119
|
+
realpath: (p2) => fs57.realpathSync(p2)
|
|
27087
27120
|
};
|
|
27088
27121
|
function readOrigin(cwd) {
|
|
27089
27122
|
try {
|
|
@@ -27475,7 +27508,7 @@ function normalizeDetectionForSpawn(detection, cwd) {
|
|
|
27475
27508
|
const binName = args2[0];
|
|
27476
27509
|
if (binName.startsWith("-")) return detection;
|
|
27477
27510
|
const binPath = path66.join(cwd, "node_modules", ".bin", binName);
|
|
27478
|
-
if (!
|
|
27511
|
+
if (!fs59.existsSync(binPath)) return detection;
|
|
27479
27512
|
return {
|
|
27480
27513
|
...detection,
|
|
27481
27514
|
command: binPath,
|
|
@@ -27499,7 +27532,8 @@ async function runPreviewStart(args2) {
|
|
|
27499
27532
|
emit2(USER_EVENTS.PREVIEW_READY, {
|
|
27500
27533
|
url: existing.url,
|
|
27501
27534
|
framework: existing.framework,
|
|
27502
|
-
port: detection.port
|
|
27535
|
+
port: detection.port,
|
|
27536
|
+
...existing.expoGoUrl ? { expoGoUrl: existing.expoGoUrl } : {}
|
|
27503
27537
|
});
|
|
27504
27538
|
return;
|
|
27505
27539
|
}
|
|
@@ -27527,6 +27561,16 @@ async function runPreviewStart(args2) {
|
|
|
27527
27561
|
}
|
|
27528
27562
|
async function runExpoBringUp(ctx) {
|
|
27529
27563
|
const { detection, emit: emit2, emitProgress } = ctx;
|
|
27564
|
+
const webInstall = expoWebDepsInstall(ctx.cwd);
|
|
27565
|
+
let web = webInstall === null;
|
|
27566
|
+
if (webInstall) {
|
|
27567
|
+
emitProgress("SETUP_RUN", `${webInstall.cmd} ${webInstall.args.join(" ")} (Expo web preview)`);
|
|
27568
|
+
const r = await runSetupCommand(webInstall.cmd, webInstall.args, ctx.cwd, detection.env, {
|
|
27569
|
+
timeoutMs: INSTALL_TIMEOUT_MS2
|
|
27570
|
+
});
|
|
27571
|
+
web = r.status === "ok";
|
|
27572
|
+
if (!web) emitProgress("SETUP_RUN", `web packages not installed (${r.status}) \u2014 Expo Go only`);
|
|
27573
|
+
}
|
|
27530
27574
|
emitProgress("TUNNEL_STARTING", `cloudflared quick tunnel \u2192 Expo :${detection.port}`);
|
|
27531
27575
|
const pub = await bringUpPublicUrl(ctx, detection.port);
|
|
27532
27576
|
if (!pub.ok) {
|
|
@@ -27538,8 +27582,11 @@ async function runExpoBringUp(ctx) {
|
|
|
27538
27582
|
killQuiet(pub.tunnel);
|
|
27539
27583
|
return;
|
|
27540
27584
|
}
|
|
27585
|
+
const expoGoUrl = expoGoDeepLink(pub.url);
|
|
27541
27586
|
announceReady(ctx, dev, {
|
|
27542
|
-
|
|
27587
|
+
// The web build in the frame + Expo Go beside it; an SDK without web deps keeps the QR alone.
|
|
27588
|
+
url: web ? pub.url : expoGoUrl,
|
|
27589
|
+
expoGoUrl: web ? expoGoUrl : void 0,
|
|
27543
27590
|
tunnel: pub.tunnel,
|
|
27544
27591
|
// No inspector: a DOM inspector means nothing against a native app.
|
|
27545
27592
|
inspector: null
|
|
@@ -27554,6 +27601,7 @@ function announceReady(ctx, dev, tun) {
|
|
|
27554
27601
|
tunnel: tun.tunnel,
|
|
27555
27602
|
inspector: tun.inspector,
|
|
27556
27603
|
url: tun.url,
|
|
27604
|
+
expoGoUrl: tun.expoGoUrl,
|
|
27557
27605
|
framework: detection.framework,
|
|
27558
27606
|
detection,
|
|
27559
27607
|
cwd: ctx.cwd
|
|
@@ -27566,7 +27614,8 @@ function announceReady(ctx, dev, tun) {
|
|
|
27566
27614
|
emit2(USER_EVENTS.PREVIEW_READY, {
|
|
27567
27615
|
url: tun.url,
|
|
27568
27616
|
framework: detection.framework,
|
|
27569
|
-
port: detection.port
|
|
27617
|
+
port: detection.port,
|
|
27618
|
+
...tun.expoGoUrl ? { expoGoUrl: tun.expoGoUrl } : {}
|
|
27570
27619
|
});
|
|
27571
27620
|
}
|
|
27572
27621
|
async function runPreflightInstall(ctx, install, why) {
|
|
@@ -27694,7 +27743,8 @@ async function startDevServer(ctx, extraEnv = {}) {
|
|
|
27694
27743
|
emit2(USER_EVENTS.PREVIEW_READY, {
|
|
27695
27744
|
url: raceExisting.url,
|
|
27696
27745
|
framework: raceExisting.framework,
|
|
27697
|
-
port: detection.port
|
|
27746
|
+
port: detection.port,
|
|
27747
|
+
...raceExisting.expoGoUrl ? { expoGoUrl: raceExisting.expoGoUrl } : {}
|
|
27698
27748
|
});
|
|
27699
27749
|
return null;
|
|
27700
27750
|
}
|
|
@@ -27929,7 +27979,7 @@ function describeSpawnFailure(err, command2, relDir) {
|
|
|
27929
27979
|
|
|
27930
27980
|
// src/beads/bd-adapter.ts
|
|
27931
27981
|
var import_child_process21 = require("child_process");
|
|
27932
|
-
var
|
|
27982
|
+
var fs60 = __toESM(require("fs"));
|
|
27933
27983
|
var os40 = __toESM(require("os"));
|
|
27934
27984
|
var path67 = __toESM(require("path"));
|
|
27935
27985
|
|
|
@@ -27984,7 +28034,7 @@ function _defaultResolveBundled() {
|
|
|
27984
28034
|
const binaryName = process.platform === "win32" ? "bd.exe" : "bd";
|
|
27985
28035
|
const binaryPath = path67.join(binDir, binaryName);
|
|
27986
28036
|
try {
|
|
27987
|
-
|
|
28037
|
+
fs60.accessSync(binaryPath, fs60.constants.F_OK);
|
|
27988
28038
|
return binaryPath;
|
|
27989
28039
|
} catch {
|
|
27990
28040
|
return null;
|
|
@@ -28000,7 +28050,7 @@ function _defaultResolveOnPath() {
|
|
|
28000
28050
|
for (const candidate of candidates) {
|
|
28001
28051
|
const full = path67.join(dir, candidate);
|
|
28002
28052
|
try {
|
|
28003
|
-
|
|
28053
|
+
fs60.accessSync(full, fs60.constants.F_OK);
|
|
28004
28054
|
return full;
|
|
28005
28055
|
} catch {
|
|
28006
28056
|
}
|
|
@@ -28189,7 +28239,7 @@ function coerceIssue(row, projectKey) {
|
|
|
28189
28239
|
|
|
28190
28240
|
// src/beads/provisioner.ts
|
|
28191
28241
|
var import_child_process24 = require("child_process");
|
|
28192
|
-
var
|
|
28242
|
+
var fs62 = __toESM(require("fs"));
|
|
28193
28243
|
var os42 = __toESM(require("os"));
|
|
28194
28244
|
var path69 = __toESM(require("path"));
|
|
28195
28245
|
|
|
@@ -28256,7 +28306,7 @@ async function installBd(platform3 = process.platform) {
|
|
|
28256
28306
|
|
|
28257
28307
|
// src/beads/install-dolt.ts
|
|
28258
28308
|
var import_child_process23 = require("child_process");
|
|
28259
|
-
var
|
|
28309
|
+
var fs61 = __toESM(require("fs"));
|
|
28260
28310
|
var os41 = __toESM(require("os"));
|
|
28261
28311
|
var path68 = __toESM(require("path"));
|
|
28262
28312
|
var DOLT_INSTALL_SH_URL = "https://github.com/dolthub/dolt/releases/latest/download/install.sh";
|
|
@@ -28354,7 +28404,7 @@ var _doltPathSeam = {
|
|
|
28354
28404
|
},
|
|
28355
28405
|
exists: (p2) => {
|
|
28356
28406
|
try {
|
|
28357
|
-
|
|
28407
|
+
fs61.accessSync(p2, fs61.constants.F_OK);
|
|
28358
28408
|
return true;
|
|
28359
28409
|
} catch {
|
|
28360
28410
|
return false;
|
|
@@ -28558,10 +28608,10 @@ var _provisionSeam = {
|
|
|
28558
28608
|
/** Does the project's git remote carry Dolt data (`refs/dolt/data`)? */
|
|
28559
28609
|
remoteHasDoltData,
|
|
28560
28610
|
/** Throwaway cwd for a user-level-only `bd setup` (see GLOBAL_ONLY_RECIPES). */
|
|
28561
|
-
makeSetupCwd: () =>
|
|
28611
|
+
makeSetupCwd: () => fs62.mkdtempSync(path69.join(os42.tmpdir(), "codeam-bd-setup-")),
|
|
28562
28612
|
removeSetupCwd: (dir) => {
|
|
28563
28613
|
try {
|
|
28564
|
-
|
|
28614
|
+
fs62.rmSync(dir, { recursive: true, force: true });
|
|
28565
28615
|
} catch {
|
|
28566
28616
|
}
|
|
28567
28617
|
}
|
|
@@ -28586,14 +28636,14 @@ var _linkSeam = {
|
|
|
28586
28636
|
homedir: () => os42.homedir(),
|
|
28587
28637
|
isWritableDir: (dir) => {
|
|
28588
28638
|
try {
|
|
28589
|
-
|
|
28639
|
+
fs62.accessSync(dir, fs62.constants.W_OK);
|
|
28590
28640
|
return true;
|
|
28591
28641
|
} catch {
|
|
28592
28642
|
return false;
|
|
28593
28643
|
}
|
|
28594
28644
|
},
|
|
28595
28645
|
ensureDir: (dir) => {
|
|
28596
|
-
|
|
28646
|
+
fs62.mkdirSync(dir, { recursive: true });
|
|
28597
28647
|
},
|
|
28598
28648
|
/**
|
|
28599
28649
|
* A directory to symlink `bd` into so the AGENT's shell + Claude Code's
|
|
@@ -28633,7 +28683,7 @@ var _linkSeam = {
|
|
|
28633
28683
|
const entry = process.argv[1];
|
|
28634
28684
|
if (entry) {
|
|
28635
28685
|
try {
|
|
28636
|
-
candidates.push(path69.dirname(
|
|
28686
|
+
candidates.push(path69.dirname(fs62.realpathSync(entry)));
|
|
28637
28687
|
} catch {
|
|
28638
28688
|
candidates.push(path69.dirname(entry));
|
|
28639
28689
|
}
|
|
@@ -28647,13 +28697,13 @@ var _linkSeam = {
|
|
|
28647
28697
|
/** Current symlink target at `linkPath`, or null when absent / not a link. */
|
|
28648
28698
|
readlink: (linkPath) => {
|
|
28649
28699
|
try {
|
|
28650
|
-
return
|
|
28700
|
+
return fs62.readlinkSync(linkPath);
|
|
28651
28701
|
} catch {
|
|
28652
28702
|
return null;
|
|
28653
28703
|
}
|
|
28654
28704
|
},
|
|
28655
|
-
unlink: (linkPath) =>
|
|
28656
|
-
symlink: (target, linkPath) =>
|
|
28705
|
+
unlink: (linkPath) => fs62.unlinkSync(linkPath),
|
|
28706
|
+
symlink: (target, linkPath) => fs62.symlinkSync(target, linkPath)
|
|
28657
28707
|
};
|
|
28658
28708
|
function linkBdOntoPath(binaryPath) {
|
|
28659
28709
|
if (_linkSeam.platform() === "win32") return;
|
|
@@ -28899,15 +28949,15 @@ function dedupeRecipes(agents) {
|
|
|
28899
28949
|
function ensureLocalGitExclude(cwd, patterns) {
|
|
28900
28950
|
try {
|
|
28901
28951
|
const gitDir = path69.join(cwd, ".git");
|
|
28902
|
-
if (!
|
|
28952
|
+
if (!fs62.statSync(gitDir).isDirectory()) return;
|
|
28903
28953
|
const file = path69.join(gitDir, "info", "exclude");
|
|
28904
|
-
|
|
28905
|
-
const current2 =
|
|
28954
|
+
fs62.mkdirSync(path69.dirname(file), { recursive: true });
|
|
28955
|
+
const current2 = fs62.existsSync(file) ? fs62.readFileSync(file, "utf8") : "";
|
|
28906
28956
|
const have = new Set(current2.split(/\r?\n/).map((l) => l.trim()));
|
|
28907
28957
|
const missing = patterns.filter((p2) => !have.has(p2));
|
|
28908
28958
|
if (missing.length === 0) return;
|
|
28909
28959
|
const prefix = current2.length > 0 && !current2.endsWith("\n") ? "\n" : "";
|
|
28910
|
-
|
|
28960
|
+
fs62.appendFileSync(file, `${prefix}# CodeAgent: beads state stays local
|
|
28911
28961
|
${missing.join("\n")}
|
|
28912
28962
|
`);
|
|
28913
28963
|
} catch {
|
|
@@ -29596,7 +29646,7 @@ function saveFilesTemp(files) {
|
|
|
29596
29646
|
return files.filter(({ base64 }) => base64 && base64.length > 0).map(({ filename, base64 }) => {
|
|
29597
29647
|
const safeName = filename.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 80);
|
|
29598
29648
|
const tmpPath = path75.join(os48.tmpdir(), `codeam-${(0, import_crypto3.randomUUID)()}-${safeName}`);
|
|
29599
|
-
|
|
29649
|
+
fs68.writeFileSync(tmpPath, Buffer.from(base64, "base64"));
|
|
29600
29650
|
pendingAttachmentFiles.add(tmpPath);
|
|
29601
29651
|
return tmpPath;
|
|
29602
29652
|
});
|
|
@@ -29845,7 +29895,7 @@ var envReadH = async (ctx, cmd) => {
|
|
|
29845
29895
|
const envPath = path75.join(process.cwd(), ".env");
|
|
29846
29896
|
await restoreProjectEnvIfMissing(process.cwd(), ctx);
|
|
29847
29897
|
try {
|
|
29848
|
-
const raw = await
|
|
29898
|
+
const raw = await fs68.promises.readFile(envPath, "utf8");
|
|
29849
29899
|
await ctx.relay.sendResult(cmd.id, "completed", {
|
|
29850
29900
|
exists: true,
|
|
29851
29901
|
vars: parseDotenv(raw)
|
|
@@ -29874,7 +29924,7 @@ var envParseH = async (ctx, cmd, parsed) => {
|
|
|
29874
29924
|
const existing = /* @__PURE__ */ new Map();
|
|
29875
29925
|
if (!replace) {
|
|
29876
29926
|
try {
|
|
29877
|
-
const raw = await
|
|
29927
|
+
const raw = await fs68.promises.readFile(path75.join(process.cwd(), ".env"), "utf8");
|
|
29878
29928
|
for (const v of parseDotenv(raw)) existing.set(v.key, v.value);
|
|
29879
29929
|
} catch {
|
|
29880
29930
|
}
|
|
@@ -29917,12 +29967,12 @@ var envWriteH = async (ctx, cmd, parsed) => {
|
|
|
29917
29967
|
const envPath = path75.join(process.cwd(), ".env");
|
|
29918
29968
|
const tmpPath = path75.join(process.cwd(), ".env.codeam.tmp");
|
|
29919
29969
|
try {
|
|
29920
|
-
await
|
|
29921
|
-
await
|
|
29970
|
+
await fs68.promises.writeFile(tmpPath, serializeDotenv(vars), "utf8");
|
|
29971
|
+
await fs68.promises.rename(tmpPath, envPath);
|
|
29922
29972
|
await ctx.relay.sendResult(cmd.id, "completed", { ok: true, count: vars.length });
|
|
29923
29973
|
void syncProjectEnvUp(process.cwd(), ctx);
|
|
29924
29974
|
} catch (err) {
|
|
29925
|
-
await
|
|
29975
|
+
await fs68.promises.rm(tmpPath, { force: true }).catch(() => void 0);
|
|
29926
29976
|
await ctx.relay.sendResult(cmd.id, "failed", { error: err.message });
|
|
29927
29977
|
}
|
|
29928
29978
|
};
|
|
@@ -30271,7 +30321,7 @@ var CLI_UPDATE_MAX_ATTEMPTS = 3;
|
|
|
30271
30321
|
function buildNpmInstallInvocation(opts) {
|
|
30272
30322
|
const entryScript = opts?.entryScript ?? process.argv[1] ?? "";
|
|
30273
30323
|
const execPath = opts?.execPath ?? process.execPath;
|
|
30274
|
-
const exists2 = opts?.existsSync ??
|
|
30324
|
+
const exists2 = opts?.existsSync ?? fs68.existsSync;
|
|
30275
30325
|
const platform3 = opts?.platform ?? process.platform;
|
|
30276
30326
|
const p2 = platform3 === "win32" ? path75.win32 : path75.posix;
|
|
30277
30327
|
const normalized = entryScript.split(/[\\/]/).join("/");
|
|
@@ -30302,9 +30352,9 @@ function resolveGlobalNodeModulesDir(opts) {
|
|
|
30302
30352
|
var STALE_STAGING_AGE_MS = CLI_UPDATE_INSTALL_TIMEOUT_MS;
|
|
30303
30353
|
function sweepStaleCliStagingDirs(nodeModulesDir, now = Date.now(), deps) {
|
|
30304
30354
|
if (!nodeModulesDir) return 0;
|
|
30305
|
-
const readdirSync18 = deps?.readdirSync ??
|
|
30306
|
-
const statSync17 = deps?.statSync ??
|
|
30307
|
-
const rmSync15 = deps?.rmSync ??
|
|
30355
|
+
const readdirSync18 = deps?.readdirSync ?? fs68.readdirSync;
|
|
30356
|
+
const statSync17 = deps?.statSync ?? fs68.statSync;
|
|
30357
|
+
const rmSync15 = deps?.rmSync ?? fs68.rmSync;
|
|
30308
30358
|
let removed = 0;
|
|
30309
30359
|
let entries2;
|
|
30310
30360
|
try {
|
|
@@ -30869,7 +30919,8 @@ function makePreviewReaffirm(args2) {
|
|
|
30869
30919
|
return {
|
|
30870
30920
|
url: active2.url,
|
|
30871
30921
|
framework: active2.framework,
|
|
30872
|
-
port: active2.detection.port
|
|
30922
|
+
port: active2.detection.port,
|
|
30923
|
+
...active2.expoGoUrl ? { expoGoUrl: active2.expoGoUrl } : {}
|
|
30873
30924
|
};
|
|
30874
30925
|
},
|
|
30875
30926
|
emitReady: (payload) => {
|
|
@@ -31464,7 +31515,7 @@ function resolveTokenValue(args2) {
|
|
|
31464
31515
|
if (fileFlag) {
|
|
31465
31516
|
const path116 = fileFlag.slice("--token-file=".length);
|
|
31466
31517
|
try {
|
|
31467
|
-
const content =
|
|
31518
|
+
const content = fs69.readFileSync(path116, "utf8").trim();
|
|
31468
31519
|
if (content.length === 0) fail(`--token-file ${path116} is empty`);
|
|
31469
31520
|
rmIfExistsQuiet(path116);
|
|
31470
31521
|
return content;
|
|
@@ -31563,7 +31614,7 @@ function pairAutoLockPath() {
|
|
|
31563
31614
|
var procRoot = "/proc";
|
|
31564
31615
|
function readProcFile(rel) {
|
|
31565
31616
|
try {
|
|
31566
|
-
return
|
|
31617
|
+
return fs69.readFileSync(path76.join(procRoot, rel), "utf8");
|
|
31567
31618
|
} catch {
|
|
31568
31619
|
return void 0;
|
|
31569
31620
|
}
|
|
@@ -31584,7 +31635,7 @@ function currentBootId() {
|
|
|
31584
31635
|
function readLockRecord(lockPath) {
|
|
31585
31636
|
let raw;
|
|
31586
31637
|
try {
|
|
31587
|
-
raw =
|
|
31638
|
+
raw = fs69.readFileSync(lockPath, "utf8");
|
|
31588
31639
|
} catch {
|
|
31589
31640
|
return void 0;
|
|
31590
31641
|
}
|
|
@@ -31633,7 +31684,7 @@ function isLiveLockHolder(rec) {
|
|
|
31633
31684
|
}
|
|
31634
31685
|
function releaseOwnLock(lockPath) {
|
|
31635
31686
|
try {
|
|
31636
|
-
if (readLockRecord(lockPath)?.pid === process.pid)
|
|
31687
|
+
if (readLockRecord(lockPath)?.pid === process.pid) fs69.unlinkSync(lockPath);
|
|
31637
31688
|
} catch {
|
|
31638
31689
|
}
|
|
31639
31690
|
}
|
|
@@ -31657,7 +31708,7 @@ function snapshotProcessTree(root) {
|
|
|
31657
31708
|
const children = /* @__PURE__ */ new Map();
|
|
31658
31709
|
let entries2 = [];
|
|
31659
31710
|
try {
|
|
31660
|
-
entries2 =
|
|
31711
|
+
entries2 = fs69.readdirSync(procRoot).filter((e) => /^\d+$/.test(e));
|
|
31661
31712
|
} catch {
|
|
31662
31713
|
}
|
|
31663
31714
|
for (const e of entries2) {
|
|
@@ -31697,13 +31748,13 @@ function daemonLockPath(sessionId) {
|
|
|
31697
31748
|
function acquireDaemonLock(sessionId) {
|
|
31698
31749
|
const lockPath = daemonLockPath(sessionId);
|
|
31699
31750
|
try {
|
|
31700
|
-
|
|
31751
|
+
fs69.mkdirSync(path76.dirname(lockPath), { recursive: true });
|
|
31701
31752
|
try {
|
|
31702
|
-
|
|
31753
|
+
fs69.writeFileSync(lockPath, ownLockBody(), { flag: "wx" });
|
|
31703
31754
|
} catch (e) {
|
|
31704
31755
|
if (e.code !== "EEXIST") throw e;
|
|
31705
31756
|
if (isLiveLockHolder(readLockRecord(lockPath))) return false;
|
|
31706
|
-
|
|
31757
|
+
fs69.writeFileSync(lockPath, ownLockBody());
|
|
31707
31758
|
}
|
|
31708
31759
|
const release3 = () => releaseOwnLock(lockPath);
|
|
31709
31760
|
process.once("exit", release3);
|
|
@@ -31723,13 +31774,13 @@ function acquireDaemonLock(sessionId) {
|
|
|
31723
31774
|
function acquireSingletonLock() {
|
|
31724
31775
|
const lockPath = pairAutoLockPath();
|
|
31725
31776
|
try {
|
|
31726
|
-
|
|
31777
|
+
fs69.mkdirSync(path76.dirname(lockPath), { recursive: true });
|
|
31727
31778
|
try {
|
|
31728
|
-
|
|
31779
|
+
fs69.writeFileSync(lockPath, ownLockBody(), { flag: "wx" });
|
|
31729
31780
|
} catch (e) {
|
|
31730
31781
|
if (e.code !== "EEXIST") throw e;
|
|
31731
31782
|
if (isLiveLockHolder(readLockRecord(lockPath))) return false;
|
|
31732
|
-
|
|
31783
|
+
fs69.writeFileSync(lockPath, ownLockBody());
|
|
31733
31784
|
}
|
|
31734
31785
|
process.once("exit", () => releaseOwnLock(lockPath));
|
|
31735
31786
|
return true;
|
|
@@ -32481,7 +32532,7 @@ async function resolveAcpAdapterWithRetry(agent, opts = {}) {
|
|
|
32481
32532
|
}
|
|
32482
32533
|
|
|
32483
32534
|
// src/agents/acp/prefetch-module-graph.ts
|
|
32484
|
-
var
|
|
32535
|
+
var fs70 = __toESM(require("fs"));
|
|
32485
32536
|
var path78 = __toESM(require("path"));
|
|
32486
32537
|
var LOADABLE_EXT = /* @__PURE__ */ new Set([".js", ".mjs", ".cjs", ".json", ".node"]);
|
|
32487
32538
|
var DEFAULT_MODULE_GRAPH_LIMITS = {
|
|
@@ -32491,15 +32542,15 @@ var DEFAULT_MODULE_GRAPH_LIMITS = {
|
|
|
32491
32542
|
concurrency: 16
|
|
32492
32543
|
};
|
|
32493
32544
|
var realFs = {
|
|
32494
|
-
readdir: (dir) =>
|
|
32495
|
-
readFile: (file) =>
|
|
32496
|
-
stat: (file) =>
|
|
32545
|
+
readdir: (dir) => fs70.promises.readdir(dir, { withFileTypes: true }),
|
|
32546
|
+
readFile: (file) => fs70.promises.readFile(file),
|
|
32547
|
+
stat: (file) => fs70.promises.stat(file)
|
|
32497
32548
|
};
|
|
32498
32549
|
function findPackageDir(dep, fromDir) {
|
|
32499
32550
|
let dir = fromDir;
|
|
32500
32551
|
for (; ; ) {
|
|
32501
32552
|
const candidate = path78.join(dir, "node_modules", dep);
|
|
32502
|
-
if (
|
|
32553
|
+
if (fs70.existsSync(path78.join(candidate, "package.json"))) return candidate;
|
|
32503
32554
|
const parent = path78.dirname(dir);
|
|
32504
32555
|
if (parent === dir) return null;
|
|
32505
32556
|
dir = parent;
|
|
@@ -32507,7 +32558,7 @@ function findPackageDir(dep, fromDir) {
|
|
|
32507
32558
|
}
|
|
32508
32559
|
function runtimeDependencies(pkgDir) {
|
|
32509
32560
|
try {
|
|
32510
|
-
const manifest = JSON.parse(
|
|
32561
|
+
const manifest = JSON.parse(fs70.readFileSync(path78.join(pkgDir, "package.json"), "utf8"));
|
|
32511
32562
|
return Object.keys(manifest.dependencies ?? {});
|
|
32512
32563
|
} catch {
|
|
32513
32564
|
return [];
|
|
@@ -32543,7 +32594,7 @@ async function collectModuleGraphFiles(rootPkgDir, limits = DEFAULT_MODULE_GRAPH
|
|
|
32543
32594
|
const queue = [rootPkgDir];
|
|
32544
32595
|
while (queue.length > 0 && files.length < limits.maxFiles) {
|
|
32545
32596
|
const pkgDir = queue.shift();
|
|
32546
|
-
const key =
|
|
32597
|
+
const key = fs70.existsSync(pkgDir) ? fs70.realpathSync(pkgDir) : pkgDir;
|
|
32547
32598
|
if (seen2.has(key)) continue;
|
|
32548
32599
|
seen2.add(key);
|
|
32549
32600
|
await packageFiles(pkgDir, fsd, files, limits.maxFiles);
|
|
@@ -32655,7 +32706,7 @@ async function waitForNoAgentStarting(opts) {
|
|
|
32655
32706
|
|
|
32656
32707
|
// src/agents/acp/runner.ts
|
|
32657
32708
|
var import_node_crypto15 = require("crypto");
|
|
32658
|
-
var
|
|
32709
|
+
var fs89 = __toESM(require("fs"));
|
|
32659
32710
|
var os61 = __toESM(require("os"));
|
|
32660
32711
|
var path98 = __toESM(require("path"));
|
|
32661
32712
|
|
|
@@ -32689,7 +32740,7 @@ function noteProviderBillingSignal(opts) {
|
|
|
32689
32740
|
}
|
|
32690
32741
|
|
|
32691
32742
|
// src/services/history.service.ts
|
|
32692
|
-
var
|
|
32743
|
+
var fs72 = __toESM(require("fs"));
|
|
32693
32744
|
var path80 = __toESM(require("path"));
|
|
32694
32745
|
var https6 = __toESM(require("https"));
|
|
32695
32746
|
var http10 = __toESM(require("http"));
|
|
@@ -32751,7 +32802,7 @@ function parseJsonl(filePath) {
|
|
|
32751
32802
|
const messages = [];
|
|
32752
32803
|
let raw;
|
|
32753
32804
|
try {
|
|
32754
|
-
raw =
|
|
32805
|
+
raw = fs72.readFileSync(filePath, "utf8");
|
|
32755
32806
|
} catch (err) {
|
|
32756
32807
|
if (err.code !== "ENOENT") {
|
|
32757
32808
|
log.warn("history:parseJsonl", `read failed for ${filePath}`, err);
|
|
@@ -32961,11 +33012,11 @@ var HistoryService = class _HistoryService {
|
|
|
32961
33012
|
const cutoff = this.bootTimeMs - _HistoryService.BIRTHTIME_GRACE_MS;
|
|
32962
33013
|
const oneShots = readOneShotConversations(this.cwd);
|
|
32963
33014
|
try {
|
|
32964
|
-
const files =
|
|
33015
|
+
const files = fs72.readdirSync(dir, { withFileTypes: true }).filter(
|
|
32965
33016
|
(e) => e.isFile() && e.name.endsWith(".jsonl") && !oneShots.has(path80.basename(e.name, ".jsonl"))
|
|
32966
33017
|
).map((e) => {
|
|
32967
33018
|
try {
|
|
32968
|
-
const stat3 =
|
|
33019
|
+
const stat3 = fs72.statSync(path80.join(dir, e.name));
|
|
32969
33020
|
return { name: e.name, mtime: stat3.mtimeMs, birthtime: stat3.birthtimeMs };
|
|
32970
33021
|
} catch {
|
|
32971
33022
|
return { name: e.name, mtime: 0, birthtime: 0 };
|
|
@@ -33006,13 +33057,13 @@ var HistoryService = class _HistoryService {
|
|
|
33006
33057
|
const cutoff = this.bootTimeMs - _HistoryService.BIRTHTIME_GRACE_MS;
|
|
33007
33058
|
let entries2;
|
|
33008
33059
|
try {
|
|
33009
|
-
entries2 =
|
|
33060
|
+
entries2 = fs72.readdirSync(dir, { withFileTypes: true });
|
|
33010
33061
|
} catch {
|
|
33011
33062
|
return null;
|
|
33012
33063
|
}
|
|
33013
33064
|
const files = entries2.filter((e) => e.isFile() && e.name.endsWith(".jsonl")).map((e) => {
|
|
33014
33065
|
try {
|
|
33015
|
-
const stat3 =
|
|
33066
|
+
const stat3 = fs72.statSync(path80.join(dir, e.name));
|
|
33016
33067
|
return { name: e.name, mtime: stat3.mtimeMs, birthtime: stat3.birthtimeMs };
|
|
33017
33068
|
} catch {
|
|
33018
33069
|
return { name: e.name, mtime: 0, birthtime: 0 };
|
|
@@ -33026,7 +33077,7 @@ var HistoryService = class _HistoryService {
|
|
|
33026
33077
|
extractUsageFromFile(filePath) {
|
|
33027
33078
|
let raw;
|
|
33028
33079
|
try {
|
|
33029
|
-
raw =
|
|
33080
|
+
raw = fs72.readFileSync(filePath, "utf8");
|
|
33030
33081
|
} catch {
|
|
33031
33082
|
return null;
|
|
33032
33083
|
}
|
|
@@ -33078,9 +33129,9 @@ var HistoryService = class _HistoryService {
|
|
|
33078
33129
|
let totalCost = 0;
|
|
33079
33130
|
let files;
|
|
33080
33131
|
try {
|
|
33081
|
-
files =
|
|
33132
|
+
files = fs72.readdirSync(projectDir).filter((f) => f.endsWith(".jsonl")).filter((f) => {
|
|
33082
33133
|
try {
|
|
33083
|
-
return
|
|
33134
|
+
return fs72.statSync(path80.join(projectDir, f)).mtimeMs >= monthStartMs;
|
|
33084
33135
|
} catch {
|
|
33085
33136
|
return false;
|
|
33086
33137
|
}
|
|
@@ -33091,7 +33142,7 @@ var HistoryService = class _HistoryService {
|
|
|
33091
33142
|
for (const file of files) {
|
|
33092
33143
|
let raw;
|
|
33093
33144
|
try {
|
|
33094
|
-
raw =
|
|
33145
|
+
raw = fs72.readFileSync(path80.join(projectDir, file), "utf8");
|
|
33095
33146
|
} catch {
|
|
33096
33147
|
continue;
|
|
33097
33148
|
}
|
|
@@ -33290,7 +33341,7 @@ var HistoryService = class _HistoryService {
|
|
|
33290
33341
|
if (!filePath) return false;
|
|
33291
33342
|
let mtimeMs;
|
|
33292
33343
|
try {
|
|
33293
|
-
mtimeMs =
|
|
33344
|
+
mtimeMs = fs72.statSync(filePath).mtimeMs;
|
|
33294
33345
|
} catch {
|
|
33295
33346
|
return false;
|
|
33296
33347
|
}
|
|
@@ -33365,7 +33416,7 @@ var HistoryService = class _HistoryService {
|
|
|
33365
33416
|
|
|
33366
33417
|
// src/agents/acp/client.ts
|
|
33367
33418
|
var import_node_child_process28 = require("child_process");
|
|
33368
|
-
var
|
|
33419
|
+
var fs73 = __toESM(require("fs/promises"));
|
|
33369
33420
|
var fsSync = __toESM(require("fs"));
|
|
33370
33421
|
var os52 = __toESM(require("os"));
|
|
33371
33422
|
var path82 = __toESM(require("path"));
|
|
@@ -38607,7 +38658,7 @@ var AcpClient = class {
|
|
|
38607
38658
|
throw new RequestError(-32002, GUARDRAIL_SECRET_READ_BLOCK_REASON, { uri: params.path });
|
|
38608
38659
|
}
|
|
38609
38660
|
try {
|
|
38610
|
-
const content = await
|
|
38661
|
+
const content = await fs73.readFile(params.path, "utf8");
|
|
38611
38662
|
return applyLineRange(content, params.line ?? null, params.limit ?? null);
|
|
38612
38663
|
} catch (err) {
|
|
38613
38664
|
const code = err.code;
|
|
@@ -38628,7 +38679,7 @@ var AcpClient = class {
|
|
|
38628
38679
|
throw new RequestError(-32002, INTERNAL_BLOCK_REASON, { uri: params.path });
|
|
38629
38680
|
}
|
|
38630
38681
|
try {
|
|
38631
|
-
await
|
|
38682
|
+
await fs73.writeFile(params.path, params.content, "utf8");
|
|
38632
38683
|
return {};
|
|
38633
38684
|
} catch (err) {
|
|
38634
38685
|
const code = err.code;
|
|
@@ -39031,7 +39082,7 @@ async function performAgentSwitch(deps, rawAgentId, fastPath = {}) {
|
|
|
39031
39082
|
}
|
|
39032
39083
|
|
|
39033
39084
|
// src/commands/host/agent-provisioning.ts
|
|
39034
|
-
var
|
|
39085
|
+
var fs74 = __toESM(require("fs"));
|
|
39035
39086
|
var os54 = __toESM(require("os"));
|
|
39036
39087
|
var path83 = __toESM(require("path"));
|
|
39037
39088
|
var PUBLIC_TO_INTERNAL_AGENT = {
|
|
@@ -39050,16 +39101,16 @@ function toInternalAgentId(publicAgentId) {
|
|
|
39050
39101
|
return PUBLIC_TO_INTERNAL_AGENT[publicAgentId] ?? null;
|
|
39051
39102
|
}
|
|
39052
39103
|
function ensureDir(dir) {
|
|
39053
|
-
|
|
39104
|
+
fs74.mkdirSync(dir, { recursive: true, mode: 448 });
|
|
39054
39105
|
}
|
|
39055
39106
|
function writeFile0600(filePath, contents) {
|
|
39056
39107
|
ensureDir(path83.dirname(filePath));
|
|
39057
|
-
|
|
39108
|
+
fs74.writeFileSync(filePath, contents, { encoding: "utf8", mode: 384 });
|
|
39058
39109
|
restrictToOwner(filePath);
|
|
39059
39110
|
}
|
|
39060
39111
|
function rmIfExists(filePath) {
|
|
39061
39112
|
try {
|
|
39062
|
-
|
|
39113
|
+
fs74.rmSync(filePath, { force: true });
|
|
39063
39114
|
} catch {
|
|
39064
39115
|
}
|
|
39065
39116
|
}
|
|
@@ -39078,7 +39129,7 @@ var claudeProvisioner = {
|
|
|
39078
39129
|
rmIfExists(credentialsJson);
|
|
39079
39130
|
}
|
|
39080
39131
|
const claudeJson = path83.join(home, ".claude.json");
|
|
39081
|
-
if (!
|
|
39132
|
+
if (!fs74.existsSync(claudeJson)) {
|
|
39082
39133
|
writeFile0600(
|
|
39083
39134
|
claudeJson,
|
|
39084
39135
|
JSON.stringify({ hasCompletedOnboarding: true, customApiKeyResponses: { approved: [] } })
|
|
@@ -39112,7 +39163,7 @@ function codexLoginStamp(raw) {
|
|
|
39112
39163
|
function keepsFresherCodexLogin(authJsonPath, incoming) {
|
|
39113
39164
|
let onDisk;
|
|
39114
39165
|
try {
|
|
39115
|
-
onDisk =
|
|
39166
|
+
onDisk = fs74.readFileSync(authJsonPath, "utf8");
|
|
39116
39167
|
} catch {
|
|
39117
39168
|
return false;
|
|
39118
39169
|
}
|
|
@@ -39253,7 +39304,7 @@ function provisionAgentCredentials(publicAgentId, auth, homeDir2 = os54.homedir(
|
|
|
39253
39304
|
}
|
|
39254
39305
|
|
|
39255
39306
|
// src/beads/workflow-hint.ts
|
|
39256
|
-
var
|
|
39307
|
+
var fs75 = __toESM(require("fs"));
|
|
39257
39308
|
var path84 = __toESM(require("path"));
|
|
39258
39309
|
var BEADS_HINT_MARKER = "<!-- codeam:beads-workflow -->";
|
|
39259
39310
|
var BEADS_HINT = `${BEADS_HINT_MARKER}
|
|
@@ -39281,11 +39332,11 @@ function ensureBeadsWorkflowHint(homeDir2, file = claudeMemoryFile(homeDir2)) {
|
|
|
39281
39332
|
try {
|
|
39282
39333
|
let existing = "";
|
|
39283
39334
|
try {
|
|
39284
|
-
existing =
|
|
39335
|
+
existing = fs75.readFileSync(file, "utf8");
|
|
39285
39336
|
} catch {
|
|
39286
39337
|
}
|
|
39287
39338
|
if (existing.includes(BEADS_HINT)) return;
|
|
39288
|
-
|
|
39339
|
+
fs75.mkdirSync(path84.dirname(file), { recursive: true });
|
|
39289
39340
|
let next;
|
|
39290
39341
|
const open = existing.indexOf(BEADS_HINT_MARKER);
|
|
39291
39342
|
const close = open === -1 ? -1 : existing.indexOf(BEADS_HINT_MARKER, open + BEADS_HINT_MARKER.length);
|
|
@@ -39298,40 +39349,40 @@ ${BEADS_HINT}
|
|
|
39298
39349
|
` : `${BEADS_HINT}
|
|
39299
39350
|
`;
|
|
39300
39351
|
}
|
|
39301
|
-
|
|
39352
|
+
fs75.writeFileSync(file, next);
|
|
39302
39353
|
} catch {
|
|
39303
39354
|
}
|
|
39304
39355
|
}
|
|
39305
39356
|
|
|
39306
39357
|
// src/agents/agent-standard.ts
|
|
39307
|
-
var
|
|
39358
|
+
var fs76 = __toESM(require("fs"));
|
|
39308
39359
|
var path85 = __toESM(require("path"));
|
|
39309
39360
|
var os55 = __toESM(require("os"));
|
|
39310
39361
|
function ensureAgentStandard(homeDir2, file = claudeMemoryFile(homeDir2)) {
|
|
39311
39362
|
try {
|
|
39312
39363
|
let existing = "";
|
|
39313
39364
|
try {
|
|
39314
|
-
existing =
|
|
39365
|
+
existing = fs76.readFileSync(file, "utf8");
|
|
39315
39366
|
} catch {
|
|
39316
39367
|
}
|
|
39317
39368
|
if (existing.includes(AGENT_STANDARD_MARKER)) return;
|
|
39318
|
-
|
|
39369
|
+
fs76.mkdirSync(path85.dirname(file), { recursive: true });
|
|
39319
39370
|
const next = existing.trim() ? `${existing.trimEnd()}
|
|
39320
39371
|
|
|
39321
39372
|
${AGENT_STANDARD_BLOCK}
|
|
39322
39373
|
` : `${AGENT_STANDARD_BLOCK}
|
|
39323
39374
|
`;
|
|
39324
|
-
|
|
39375
|
+
fs76.writeFileSync(file, next);
|
|
39325
39376
|
} catch {
|
|
39326
39377
|
}
|
|
39327
39378
|
}
|
|
39328
39379
|
var _agentStandardSeam = {
|
|
39329
39380
|
isLocalSession: () => isLocalSession(),
|
|
39330
39381
|
markerPath: (sessionId) => path85.join(os55.homedir(), ".codeam", "agent-standard", `${sessionId}.done`),
|
|
39331
|
-
exists: (p2) =>
|
|
39382
|
+
exists: (p2) => fs76.existsSync(p2),
|
|
39332
39383
|
write: (p2) => {
|
|
39333
|
-
|
|
39334
|
-
|
|
39384
|
+
fs76.mkdirSync(path85.dirname(p2), { recursive: true });
|
|
39385
|
+
fs76.writeFileSync(p2, "");
|
|
39335
39386
|
}
|
|
39336
39387
|
};
|
|
39337
39388
|
function isClaude(agent) {
|
|
@@ -40192,15 +40243,15 @@ function withholdTrailingPartialFenceMarker(text) {
|
|
|
40192
40243
|
|
|
40193
40244
|
// src/agents/acp/onboarding.ts
|
|
40194
40245
|
var import_child_process28 = require("child_process");
|
|
40195
|
-
var
|
|
40246
|
+
var fs78 = __toESM(require("fs"));
|
|
40196
40247
|
var os56 = __toESM(require("os"));
|
|
40197
40248
|
var path87 = __toESM(require("path"));
|
|
40198
40249
|
var _onboardingSeam = {
|
|
40199
40250
|
markerPath: (sessionId) => path87.join(os56.homedir(), ".codeam", "welcomed", `${sessionId}.done`),
|
|
40200
|
-
exists: (p2) =>
|
|
40251
|
+
exists: (p2) => fs78.existsSync(p2),
|
|
40201
40252
|
write: (p2) => {
|
|
40202
|
-
|
|
40203
|
-
|
|
40253
|
+
fs78.mkdirSync(path87.dirname(p2), { recursive: true });
|
|
40254
|
+
fs78.writeFileSync(p2, "");
|
|
40204
40255
|
},
|
|
40205
40256
|
disabled: () => {
|
|
40206
40257
|
const v = process.env.CODEAM_ONBOARDING_DISABLED;
|
|
@@ -40637,13 +40688,13 @@ var import_crypto5 = require("crypto");
|
|
|
40637
40688
|
|
|
40638
40689
|
// src/services/turn-files/git-changeset.ts
|
|
40639
40690
|
var import_child_process29 = require("child_process");
|
|
40640
|
-
var
|
|
40691
|
+
var fs80 = __toESM(require("fs/promises"));
|
|
40641
40692
|
var import_fs10 = require("fs");
|
|
40642
40693
|
var path89 = __toESM(require("path"));
|
|
40643
40694
|
|
|
40644
40695
|
// src/services/turn-files/review-ignore.ts
|
|
40645
40696
|
var import_ignore2 = __toESM(require("ignore"));
|
|
40646
|
-
var
|
|
40697
|
+
var fs79 = __toESM(require("fs"));
|
|
40647
40698
|
var path88 = __toESM(require("path"));
|
|
40648
40699
|
var CURATED_REVIEW_IGNORE = [
|
|
40649
40700
|
// Google Cloud SDK (the incident) — installs a huge python tree.
|
|
@@ -40688,7 +40739,7 @@ var CURATED_REVIEW_IGNORE = [
|
|
|
40688
40739
|
function makeReviewIgnore(repoRoot) {
|
|
40689
40740
|
const ig = (0, import_ignore2.default)().add(CURATED_REVIEW_IGNORE);
|
|
40690
40741
|
try {
|
|
40691
|
-
const custom =
|
|
40742
|
+
const custom = fs79.readFileSync(path88.join(repoRoot, ".codeam", "reviewignore"), "utf8");
|
|
40692
40743
|
ig.add(custom);
|
|
40693
40744
|
} catch {
|
|
40694
40745
|
}
|
|
@@ -40771,7 +40822,7 @@ function readUntrackedLineCount(absPath) {
|
|
|
40771
40822
|
}
|
|
40772
40823
|
async function defaultReadUntrackedLineCount(absPath) {
|
|
40773
40824
|
try {
|
|
40774
|
-
const content = await
|
|
40825
|
+
const content = await fs80.readFile(absPath, "utf8");
|
|
40775
40826
|
let count = 0;
|
|
40776
40827
|
let pos = -1;
|
|
40777
40828
|
while ((pos = content.indexOf("\n", pos + 1)) !== -1) {
|
|
@@ -40863,7 +40914,7 @@ function defaultRunGit(cwd, args2) {
|
|
|
40863
40914
|
});
|
|
40864
40915
|
}
|
|
40865
40916
|
async function discoverRepos(workingDir, maxDepth = 4) {
|
|
40866
|
-
const
|
|
40917
|
+
const fs103 = await import("fs/promises");
|
|
40867
40918
|
const out2 = [];
|
|
40868
40919
|
await walk2(workingDir, 0);
|
|
40869
40920
|
return out2;
|
|
@@ -40871,7 +40922,7 @@ async function discoverRepos(workingDir, maxDepth = 4) {
|
|
|
40871
40922
|
if (depth2 > maxDepth) return;
|
|
40872
40923
|
let entries2 = [];
|
|
40873
40924
|
try {
|
|
40874
|
-
const dirents = await
|
|
40925
|
+
const dirents = await fs103.readdir(dir, { withFileTypes: true });
|
|
40875
40926
|
entries2 = dirents.filter((d3) => !d3.name.startsWith(".") || d3.name === ".git").map((d3) => ({ name: d3.name, isDirectory: d3.isDirectory() }));
|
|
40876
40927
|
} catch {
|
|
40877
40928
|
return;
|
|
@@ -40905,7 +40956,7 @@ function isReviewablePath(absPath) {
|
|
|
40905
40956
|
}
|
|
40906
40957
|
|
|
40907
40958
|
// src/services/turn-files/files-outbox.ts
|
|
40908
|
-
var
|
|
40959
|
+
var fs81 = __toESM(require("fs/promises"));
|
|
40909
40960
|
var path90 = __toESM(require("path"));
|
|
40910
40961
|
var import_os14 = require("os");
|
|
40911
40962
|
var HOME_OUTBOX_DIR = ".codeam/outbox";
|
|
@@ -40947,8 +40998,8 @@ var FilesOutbox = class {
|
|
|
40947
40998
|
/** Persist the entry to disk and trigger a flush. Returns once the
|
|
40948
40999
|
* line is durable on disk (not once the POST succeeds). */
|
|
40949
41000
|
async enqueue(entry) {
|
|
40950
|
-
await
|
|
40951
|
-
await
|
|
41001
|
+
await fs81.mkdir(path90.dirname(this.filePath), { recursive: true });
|
|
41002
|
+
await fs81.appendFile(this.filePath, JSON.stringify(entry) + "\n", "utf8");
|
|
40952
41003
|
this.backoffIndex = 0;
|
|
40953
41004
|
if (this.autoSchedule) this.scheduleFlush(0);
|
|
40954
41005
|
}
|
|
@@ -41039,7 +41090,7 @@ var FilesOutbox = class {
|
|
|
41039
41090
|
async readAll() {
|
|
41040
41091
|
let raw = "";
|
|
41041
41092
|
try {
|
|
41042
|
-
raw = await
|
|
41093
|
+
raw = await fs81.readFile(this.filePath, "utf8");
|
|
41043
41094
|
} catch {
|
|
41044
41095
|
return [];
|
|
41045
41096
|
}
|
|
@@ -41063,12 +41114,12 @@ var FilesOutbox = class {
|
|
|
41063
41114
|
async rewrite(entries2) {
|
|
41064
41115
|
const tmpPath = `${this.filePath}.${process.pid}.tmp`;
|
|
41065
41116
|
if (entries2.length === 0) {
|
|
41066
|
-
await
|
|
41117
|
+
await fs81.unlink(this.filePath).catch(() => void 0);
|
|
41067
41118
|
return;
|
|
41068
41119
|
}
|
|
41069
41120
|
const payload = entries2.map((e) => JSON.stringify(e)).join("\n") + "\n";
|
|
41070
|
-
await
|
|
41071
|
-
await
|
|
41121
|
+
await fs81.writeFile(tmpPath, payload, "utf8");
|
|
41122
|
+
await fs81.rename(tmpPath, this.filePath);
|
|
41072
41123
|
}
|
|
41073
41124
|
};
|
|
41074
41125
|
function applyJitter(ms) {
|
|
@@ -41438,7 +41489,7 @@ async function readActiveConversationMarker(cwd, homeDir2) {
|
|
|
41438
41489
|
|
|
41439
41490
|
// src/packs/gates.ts
|
|
41440
41491
|
var import_node_child_process29 = require("child_process");
|
|
41441
|
-
var
|
|
41492
|
+
var fs83 = __toESM(require("fs"));
|
|
41442
41493
|
var path92 = __toESM(require("path"));
|
|
41443
41494
|
var defaultCommandRunner = (file, args2, cwd, timeoutMs, env) => new Promise((resolve13) => {
|
|
41444
41495
|
(0, import_node_child_process29.execFile)(
|
|
@@ -41489,7 +41540,7 @@ async function changedFiles(run3, cwd, from, to) {
|
|
|
41489
41540
|
}
|
|
41490
41541
|
function readWorkspaceFile(cwd, relPath) {
|
|
41491
41542
|
try {
|
|
41492
|
-
return
|
|
41543
|
+
return fs83.readFileSync(path92.join(cwd, relPath), "utf8");
|
|
41493
41544
|
} catch {
|
|
41494
41545
|
return null;
|
|
41495
41546
|
}
|
|
@@ -41498,14 +41549,14 @@ var NO_TEST_PLACEHOLDER = 'echo "Error: no test specified"';
|
|
|
41498
41549
|
var CHECKS_TIMEOUT_MS = 5 * 6e4;
|
|
41499
41550
|
function detectChecksCommand(cwd) {
|
|
41500
41551
|
try {
|
|
41501
|
-
const cfg = JSON.parse(
|
|
41552
|
+
const cfg = JSON.parse(fs83.readFileSync(path92.join(cwd, ".codeam", "pack.json"), "utf8"));
|
|
41502
41553
|
if (typeof cfg.checksCommand === "string" && cfg.checksCommand.trim().length > 0) {
|
|
41503
41554
|
return cfg.checksCommand.trim();
|
|
41504
41555
|
}
|
|
41505
41556
|
} catch {
|
|
41506
41557
|
}
|
|
41507
41558
|
try {
|
|
41508
|
-
const pkg = JSON.parse(
|
|
41559
|
+
const pkg = JSON.parse(fs83.readFileSync(path92.join(cwd, "package.json"), "utf8"));
|
|
41509
41560
|
const test = pkg.scripts?.test;
|
|
41510
41561
|
if (typeof test === "string" && test.trim().length > 0 && !test.includes(NO_TEST_PLACEHOLDER)) {
|
|
41511
41562
|
return "npm test";
|
|
@@ -41523,7 +41574,7 @@ ${res.stderr}`.trim();
|
|
|
41523
41574
|
}
|
|
41524
41575
|
|
|
41525
41576
|
// src/packs/run-store.ts
|
|
41526
|
-
var
|
|
41577
|
+
var fs84 = __toESM(require("fs"));
|
|
41527
41578
|
var path93 = __toESM(require("path"));
|
|
41528
41579
|
var crypto5 = __toESM(require("crypto"));
|
|
41529
41580
|
function packsDir(cwd) {
|
|
@@ -41536,10 +41587,10 @@ function newRunId() {
|
|
|
41536
41587
|
return `pk_${Date.now().toString(36)}_${crypto5.randomBytes(4).toString("hex")}`;
|
|
41537
41588
|
}
|
|
41538
41589
|
function writeJsonAtomic(file, value) {
|
|
41539
|
-
|
|
41590
|
+
fs84.mkdirSync(path93.dirname(file), { recursive: true });
|
|
41540
41591
|
const tmp = `${file}.tmp`;
|
|
41541
|
-
|
|
41542
|
-
|
|
41592
|
+
fs84.writeFileSync(tmp, JSON.stringify(value, null, 2));
|
|
41593
|
+
fs84.renameSync(tmp, file);
|
|
41543
41594
|
}
|
|
41544
41595
|
function saveRun(cwd, state) {
|
|
41545
41596
|
writeJsonAtomic(path93.join(runDir(cwd, state.runId), "run.json"), state);
|
|
@@ -41551,11 +41602,11 @@ function saveStageHandoff(cwd, runId, stageIndex, role, handoff) {
|
|
|
41551
41602
|
function loadLatestRun(cwd) {
|
|
41552
41603
|
try {
|
|
41553
41604
|
const dir = packsDir(cwd);
|
|
41554
|
-
const entries2 =
|
|
41605
|
+
const entries2 = fs84.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name).sort();
|
|
41555
41606
|
for (let i = entries2.length - 1; i >= 0; i--) {
|
|
41556
41607
|
const file = path93.join(dir, entries2[i], "run.json");
|
|
41557
41608
|
try {
|
|
41558
|
-
const parsed = JSON.parse(
|
|
41609
|
+
const parsed = JSON.parse(fs84.readFileSync(file, "utf8"));
|
|
41559
41610
|
if (parsed && typeof parsed.runId === "string") return parsed;
|
|
41560
41611
|
} catch {
|
|
41561
41612
|
}
|
|
@@ -41567,16 +41618,16 @@ function loadLatestRun(cwd) {
|
|
|
41567
41618
|
function ensureLedgerIgnored(cwd) {
|
|
41568
41619
|
try {
|
|
41569
41620
|
const gitDir = path93.join(cwd, ".git");
|
|
41570
|
-
if (!
|
|
41621
|
+
if (!fs84.existsSync(gitDir)) return;
|
|
41571
41622
|
const exclude = path93.join(gitDir, "info", "exclude");
|
|
41572
41623
|
let existing = "";
|
|
41573
41624
|
try {
|
|
41574
|
-
existing =
|
|
41625
|
+
existing = fs84.readFileSync(exclude, "utf8");
|
|
41575
41626
|
} catch {
|
|
41576
41627
|
}
|
|
41577
41628
|
if (existing.includes(".codeam/packs/")) return;
|
|
41578
|
-
|
|
41579
|
-
|
|
41629
|
+
fs84.mkdirSync(path93.dirname(exclude), { recursive: true });
|
|
41630
|
+
fs84.writeFileSync(exclude, `${existing.trimEnd()}
|
|
41580
41631
|
.codeam/packs/
|
|
41581
41632
|
`.trimStart());
|
|
41582
41633
|
} catch {
|
|
@@ -42571,7 +42622,7 @@ async function mcpRouter() {
|
|
|
42571
42622
|
}
|
|
42572
42623
|
|
|
42573
42624
|
// src/integrations/mcp-secrets.ts
|
|
42574
|
-
var
|
|
42625
|
+
var fs86 = __toESM(require("fs"));
|
|
42575
42626
|
var os59 = __toESM(require("os"));
|
|
42576
42627
|
var path95 = __toESM(require("path"));
|
|
42577
42628
|
var MCP_SECRETS_FILE_ENV = "CODEAM_MCP_SECRETS_FILE";
|
|
@@ -42584,7 +42635,7 @@ function mcpSecretsPath(scope, pid = process.pid) {
|
|
|
42584
42635
|
var registeredForCleanup = /* @__PURE__ */ new Set();
|
|
42585
42636
|
function readFileVars(file) {
|
|
42586
42637
|
try {
|
|
42587
|
-
const parsed = JSON.parse(
|
|
42638
|
+
const parsed = JSON.parse(fs86.readFileSync(file, "utf8"));
|
|
42588
42639
|
if (!parsed || typeof parsed !== "object") return {};
|
|
42589
42640
|
const out2 = {};
|
|
42590
42641
|
for (const [k2, v] of Object.entries(parsed)) {
|
|
@@ -42606,7 +42657,7 @@ function pidAlive2(pid) {
|
|
|
42606
42657
|
function pruneStale(dir) {
|
|
42607
42658
|
let names = [];
|
|
42608
42659
|
try {
|
|
42609
|
-
names =
|
|
42660
|
+
names = fs86.readdirSync(dir);
|
|
42610
42661
|
} catch {
|
|
42611
42662
|
return;
|
|
42612
42663
|
}
|
|
@@ -42616,7 +42667,7 @@ function pruneStale(dir) {
|
|
|
42616
42667
|
const pid = Number(m[1]);
|
|
42617
42668
|
if (pid === process.pid || pidAlive2(pid)) continue;
|
|
42618
42669
|
try {
|
|
42619
|
-
|
|
42670
|
+
fs86.unlinkSync(path95.join(dir, name));
|
|
42620
42671
|
} catch {
|
|
42621
42672
|
}
|
|
42622
42673
|
}
|
|
@@ -42624,17 +42675,17 @@ function pruneStale(dir) {
|
|
|
42624
42675
|
function writeMcpSecrets(vars, file) {
|
|
42625
42676
|
try {
|
|
42626
42677
|
const dir = path95.dirname(file);
|
|
42627
|
-
|
|
42678
|
+
fs86.mkdirSync(dir, { recursive: true, mode: 448 });
|
|
42628
42679
|
pruneStale(dir);
|
|
42629
42680
|
const tmp = `${file}.${process.pid}.tmp`;
|
|
42630
|
-
|
|
42631
|
-
|
|
42632
|
-
|
|
42681
|
+
fs86.writeFileSync(tmp, JSON.stringify(vars), { mode: 384 });
|
|
42682
|
+
fs86.renameSync(tmp, file);
|
|
42683
|
+
fs86.chmodSync(file, 384);
|
|
42633
42684
|
if (!registeredForCleanup.has(file)) {
|
|
42634
42685
|
registeredForCleanup.add(file);
|
|
42635
42686
|
process.once("exit", () => {
|
|
42636
42687
|
try {
|
|
42637
|
-
|
|
42688
|
+
fs86.unlinkSync(file);
|
|
42638
42689
|
} catch {
|
|
42639
42690
|
}
|
|
42640
42691
|
});
|
|
@@ -45985,7 +46036,7 @@ async function runAcpSession(opts) {
|
|
|
45985
46036
|
`switch-${opts.pluginId}`
|
|
45986
46037
|
);
|
|
45987
46038
|
try {
|
|
45988
|
-
|
|
46039
|
+
fs89.mkdirSync(claudeConfigDir2, { recursive: true, mode: 448 });
|
|
45989
46040
|
} catch {
|
|
45990
46041
|
}
|
|
45991
46042
|
const memoryFile = path98.join(claudeConfigDir2, "CLAUDE.md");
|
|
@@ -47228,7 +47279,7 @@ function pickPinnedSession(pinnedId, listSessions2) {
|
|
|
47228
47279
|
}
|
|
47229
47280
|
|
|
47230
47281
|
// src/agents/retired-proxy-cleanup.ts
|
|
47231
|
-
var
|
|
47282
|
+
var fs90 = __toESM(require("fs"));
|
|
47232
47283
|
var path99 = __toESM(require("path"));
|
|
47233
47284
|
var os62 = __toESM(require("os"));
|
|
47234
47285
|
var RETIRED_PROXY_RE = /^https?:\/\/(?:127\.0\.0\.1|localhost|\[::1\]):8787(?:[/?#]|$)/i;
|
|
@@ -47244,7 +47295,7 @@ function sanitizeRetiredProxyConfig(homeDir2 = os62.homedir()) {
|
|
|
47244
47295
|
const file = path99.join(homeDir2, ".claude", "settings.json");
|
|
47245
47296
|
let parsed;
|
|
47246
47297
|
try {
|
|
47247
|
-
parsed = JSON.parse(
|
|
47298
|
+
parsed = JSON.parse(fs90.readFileSync(file, "utf8"));
|
|
47248
47299
|
} catch {
|
|
47249
47300
|
return out2;
|
|
47250
47301
|
}
|
|
@@ -47286,9 +47337,9 @@ function sanitizeRetiredProxyConfig(homeDir2 = os62.homedir()) {
|
|
|
47286
47337
|
if (!out2.changed) return out2;
|
|
47287
47338
|
try {
|
|
47288
47339
|
const tmp = `${file}.codeam.tmp`;
|
|
47289
|
-
|
|
47340
|
+
fs90.writeFileSync(tmp, `${JSON.stringify(parsed, null, 2)}
|
|
47290
47341
|
`, { mode: 384 });
|
|
47291
|
-
|
|
47342
|
+
fs90.renameSync(tmp, file);
|
|
47292
47343
|
} catch {
|
|
47293
47344
|
out2.changed = false;
|
|
47294
47345
|
}
|
|
@@ -47834,7 +47885,7 @@ var AcpDriver = class {
|
|
|
47834
47885
|
};
|
|
47835
47886
|
|
|
47836
47887
|
// src/baton/transcript-mirror.ts
|
|
47837
|
-
var
|
|
47888
|
+
var fs91 = __toESM(require("fs"));
|
|
47838
47889
|
var TranscriptMirror = class {
|
|
47839
47890
|
constructor(deps) {
|
|
47840
47891
|
this.deps = deps;
|
|
@@ -47928,7 +47979,7 @@ var TranscriptMirror = class {
|
|
|
47928
47979
|
}
|
|
47929
47980
|
};
|
|
47930
47981
|
function defaultWatch(file, onChange) {
|
|
47931
|
-
const w3 =
|
|
47982
|
+
const w3 = fs91.watch(file, { persistent: false }, () => onChange());
|
|
47932
47983
|
return () => w3.close();
|
|
47933
47984
|
}
|
|
47934
47985
|
|
|
@@ -48428,7 +48479,7 @@ function keepDeviceAwake(deps = {}) {
|
|
|
48428
48479
|
}
|
|
48429
48480
|
|
|
48430
48481
|
// src/agents/claude/onboarding.ts
|
|
48431
|
-
var
|
|
48482
|
+
var fs92 = __toESM(require("fs"));
|
|
48432
48483
|
var os64 = __toESM(require("os"));
|
|
48433
48484
|
var path100 = __toESM(require("path"));
|
|
48434
48485
|
var ONBOARDING_VERSION_SENTINEL = "9999.0.0";
|
|
@@ -48437,7 +48488,7 @@ function ensureClaudeOnboarded(cwd) {
|
|
|
48437
48488
|
const file = path100.join(os64.homedir(), ".claude.json");
|
|
48438
48489
|
let config = {};
|
|
48439
48490
|
try {
|
|
48440
|
-
config = JSON.parse(
|
|
48491
|
+
config = JSON.parse(fs92.readFileSync(file, "utf8"));
|
|
48441
48492
|
} catch {
|
|
48442
48493
|
}
|
|
48443
48494
|
let changed = false;
|
|
@@ -48462,8 +48513,8 @@ function ensureClaudeOnboarded(cwd) {
|
|
|
48462
48513
|
}
|
|
48463
48514
|
}
|
|
48464
48515
|
if (!changed) return;
|
|
48465
|
-
|
|
48466
|
-
|
|
48516
|
+
fs92.mkdirSync(path100.dirname(file), { recursive: true });
|
|
48517
|
+
fs92.writeFileSync(file, JSON.stringify(config, null, 2));
|
|
48467
48518
|
log.info(
|
|
48468
48519
|
"claude",
|
|
48469
48520
|
`pre-completed Claude onboarding${cwd ? ` + trusted workspace ${cwd}` : ""}`
|
|
@@ -51274,7 +51325,7 @@ async function stopWorkspaceFromLocal(target) {
|
|
|
51274
51325
|
}
|
|
51275
51326
|
|
|
51276
51327
|
// src/commands/host/host-client.ts
|
|
51277
|
-
var
|
|
51328
|
+
var fs93 = __toESM(require("fs"));
|
|
51278
51329
|
var os65 = __toESM(require("os"));
|
|
51279
51330
|
var path105 = __toESM(require("path"));
|
|
51280
51331
|
var import_node_crypto16 = require("crypto");
|
|
@@ -51340,7 +51391,7 @@ function collectOsInfo() {
|
|
|
51340
51391
|
}
|
|
51341
51392
|
function loadHostIdentity() {
|
|
51342
51393
|
try {
|
|
51343
|
-
const raw =
|
|
51394
|
+
const raw = fs93.readFileSync(hostIdentityPath(), "utf8");
|
|
51344
51395
|
const parsed = JSON.parse(raw);
|
|
51345
51396
|
if (typeof parsed === "object" && parsed !== null && typeof parsed.hostId === "string" && typeof parsed.hostToken === "string" && typeof parsed.controlPluginId === "string") {
|
|
51346
51397
|
const p2 = parsed;
|
|
@@ -51369,8 +51420,8 @@ function ensureControlPollSecret(identity, save = saveHostIdentity) {
|
|
|
51369
51420
|
}
|
|
51370
51421
|
function saveHostIdentity(identity) {
|
|
51371
51422
|
const file = hostIdentityPath();
|
|
51372
|
-
|
|
51373
|
-
|
|
51423
|
+
fs93.mkdirSync(path105.dirname(file), { recursive: true, mode: 448 });
|
|
51424
|
+
fs93.writeFileSync(file, JSON.stringify(identity, null, 2), {
|
|
51374
51425
|
encoding: "utf8",
|
|
51375
51426
|
mode: 384
|
|
51376
51427
|
});
|
|
@@ -51415,7 +51466,7 @@ function isTerminalEnrollError(err) {
|
|
|
51415
51466
|
}
|
|
51416
51467
|
function deleteHostIdentity() {
|
|
51417
51468
|
try {
|
|
51418
|
-
|
|
51469
|
+
fs93.rmSync(hostIdentityPath(), { force: true });
|
|
51419
51470
|
} catch {
|
|
51420
51471
|
}
|
|
51421
51472
|
}
|
|
@@ -51644,7 +51695,7 @@ async function host(args2) {
|
|
|
51644
51695
|
// src/commands/host-agent.ts
|
|
51645
51696
|
var import_node_child_process38 = require("child_process");
|
|
51646
51697
|
var os71 = __toESM(require("os"));
|
|
51647
|
-
var
|
|
51698
|
+
var fs100 = __toESM(require("fs"));
|
|
51648
51699
|
var path112 = __toESM(require("path"));
|
|
51649
51700
|
|
|
51650
51701
|
// src/skills/persist-from-payload.ts
|
|
@@ -51654,7 +51705,7 @@ function persistOrClearSkillsFromPayload(skills) {
|
|
|
51654
51705
|
}
|
|
51655
51706
|
|
|
51656
51707
|
// src/commands/host/session-state.ts
|
|
51657
|
-
var
|
|
51708
|
+
var fs94 = __toESM(require("fs"));
|
|
51658
51709
|
var os66 = __toESM(require("os"));
|
|
51659
51710
|
var path106 = __toESM(require("path"));
|
|
51660
51711
|
function hostSessionStatePath(env = process.env) {
|
|
@@ -51671,7 +51722,7 @@ function fileSessionChildStore(file = hostSessionStatePath()) {
|
|
|
51671
51722
|
return {
|
|
51672
51723
|
load() {
|
|
51673
51724
|
try {
|
|
51674
|
-
const raw = JSON.parse(
|
|
51725
|
+
const raw = JSON.parse(fs94.readFileSync(file, "utf8"));
|
|
51675
51726
|
return Array.isArray(raw?.sessions) ? raw.sessions.filter(isRecord5) : null;
|
|
51676
51727
|
} catch {
|
|
51677
51728
|
return null;
|
|
@@ -51679,18 +51730,18 @@ function fileSessionChildStore(file = hostSessionStatePath()) {
|
|
|
51679
51730
|
},
|
|
51680
51731
|
save(list) {
|
|
51681
51732
|
try {
|
|
51682
|
-
|
|
51733
|
+
fs94.mkdirSync(path106.dirname(file), { recursive: true, mode: 448 });
|
|
51683
51734
|
const tmp = `${file}.${process.pid}.tmp`;
|
|
51684
|
-
|
|
51735
|
+
fs94.writeFileSync(tmp, JSON.stringify({ version: 1, sessions: list }, null, 2), {
|
|
51685
51736
|
mode: 384
|
|
51686
51737
|
});
|
|
51687
|
-
|
|
51738
|
+
fs94.renameSync(tmp, file);
|
|
51688
51739
|
} catch {
|
|
51689
51740
|
}
|
|
51690
51741
|
},
|
|
51691
51742
|
clear() {
|
|
51692
51743
|
try {
|
|
51693
|
-
|
|
51744
|
+
fs94.rmSync(file, { force: true });
|
|
51694
51745
|
} catch {
|
|
51695
51746
|
}
|
|
51696
51747
|
}
|
|
@@ -51728,7 +51779,7 @@ function pickSavedSessionForWorkspace(sessions3, cwd, deployId) {
|
|
|
51728
51779
|
|
|
51729
51780
|
// src/commands/host/git-tooling.ts
|
|
51730
51781
|
var import_node_child_process32 = require("child_process");
|
|
51731
|
-
var
|
|
51782
|
+
var fs95 = __toESM(require("fs"));
|
|
51732
51783
|
var os67 = __toESM(require("os"));
|
|
51733
51784
|
var path107 = __toESM(require("path"));
|
|
51734
51785
|
function codeamBinDir() {
|
|
@@ -51764,7 +51815,7 @@ async function download(url2, dest) {
|
|
|
51764
51815
|
const res = await fetch(url2, { headers: { "User-Agent": "codeam-cli" } });
|
|
51765
51816
|
if (!res.ok || !res.body) return false;
|
|
51766
51817
|
const buf = Buffer.from(await res.arrayBuffer());
|
|
51767
|
-
|
|
51818
|
+
fs95.writeFileSync(dest, buf);
|
|
51768
51819
|
return true;
|
|
51769
51820
|
} catch {
|
|
51770
51821
|
return false;
|
|
@@ -51787,7 +51838,7 @@ async function ensureGhCli(runner, token, deps = {}) {
|
|
|
51787
51838
|
const version3 = await resolveVersionFn(token);
|
|
51788
51839
|
const asset = `gh_${version3}_${osToken}_${arch2}`;
|
|
51789
51840
|
const url2 = `https://github.com/cli/cli/releases/download/v${version3}/${asset}.${ext}`;
|
|
51790
|
-
const tmpRoot =
|
|
51841
|
+
const tmpRoot = fs95.mkdtempSync(path107.join(os67.tmpdir(), "codeam-gh-"));
|
|
51791
51842
|
const archive = path107.join(tmpRoot, `${asset}.${ext}`);
|
|
51792
51843
|
if (!await downloadFn(url2, archive)) {
|
|
51793
51844
|
log.warn("host-agent", "gh download failed \u2014 skipping (git pull/push still work via the credential helper)");
|
|
@@ -51799,15 +51850,15 @@ async function ensureGhCli(runner, token, deps = {}) {
|
|
|
51799
51850
|
return null;
|
|
51800
51851
|
}
|
|
51801
51852
|
const extractedBin = path107.join(tmpRoot, asset, "bin", binaryName);
|
|
51802
|
-
if (!
|
|
51853
|
+
if (!fs95.existsSync(extractedBin)) {
|
|
51803
51854
|
log.warn("host-agent", "gh binary not found in the extracted archive \u2014 skipping");
|
|
51804
51855
|
return null;
|
|
51805
51856
|
}
|
|
51806
51857
|
const binDir = codeamBinDir();
|
|
51807
|
-
|
|
51858
|
+
fs95.mkdirSync(binDir, { recursive: true });
|
|
51808
51859
|
const target = path107.join(binDir, binaryName);
|
|
51809
|
-
|
|
51810
|
-
|
|
51860
|
+
fs95.copyFileSync(extractedBin, target);
|
|
51861
|
+
fs95.chmodSync(target, 493);
|
|
51811
51862
|
log.info("host-agent", `gh installed to ${target} (v${version3})`);
|
|
51812
51863
|
return target;
|
|
51813
51864
|
} catch (e) {
|
|
@@ -51854,9 +51905,9 @@ function writeGhHostsToken(token) {
|
|
|
51854
51905
|
try {
|
|
51855
51906
|
const dir = ghConfigDir();
|
|
51856
51907
|
const file = path107.join(dir, "hosts.yml");
|
|
51857
|
-
if (
|
|
51858
|
-
|
|
51859
|
-
|
|
51908
|
+
if (fs95.existsSync(file)) return false;
|
|
51909
|
+
fs95.mkdirSync(dir, { recursive: true, mode: 448 });
|
|
51910
|
+
fs95.writeFileSync(
|
|
51860
51911
|
file,
|
|
51861
51912
|
`github.com:
|
|
51862
51913
|
oauth_token: ${token}
|
|
@@ -51899,7 +51950,7 @@ async function ensureGlabCli(runner, deps = {}) {
|
|
|
51899
51950
|
const version3 = await resolveLatestGlabVersion();
|
|
51900
51951
|
const asset = `glab_${version3}_${osToken}_${arch2}`;
|
|
51901
51952
|
const url2 = `https://gitlab.com/gitlab-org/cli/-/releases/v${version3}/downloads/${asset}.${ext}`;
|
|
51902
|
-
const tmpRoot =
|
|
51953
|
+
const tmpRoot = fs95.mkdtempSync(path107.join(os67.tmpdir(), "codeam-glab-"));
|
|
51903
51954
|
const archive = path107.join(tmpRoot, `${asset}.${ext}`);
|
|
51904
51955
|
if (!await downloadFn(url2, archive)) {
|
|
51905
51956
|
log.warn("host-agent", "glab download failed \u2014 skipping (git push/pull still work)");
|
|
@@ -51915,16 +51966,16 @@ async function ensureGlabCli(runner, deps = {}) {
|
|
|
51915
51966
|
path107.join(tmpRoot, asset, "bin", binaryName),
|
|
51916
51967
|
path107.join(tmpRoot, binaryName)
|
|
51917
51968
|
];
|
|
51918
|
-
const extractedBin = candidates.find((c2) =>
|
|
51969
|
+
const extractedBin = candidates.find((c2) => fs95.existsSync(c2));
|
|
51919
51970
|
if (!extractedBin) {
|
|
51920
51971
|
log.warn("host-agent", "glab binary not found in the extracted archive \u2014 skipping");
|
|
51921
51972
|
return null;
|
|
51922
51973
|
}
|
|
51923
51974
|
const binDir = codeamBinDir();
|
|
51924
|
-
|
|
51975
|
+
fs95.mkdirSync(binDir, { recursive: true });
|
|
51925
51976
|
const target = path107.join(binDir, binaryName);
|
|
51926
|
-
|
|
51927
|
-
|
|
51977
|
+
fs95.copyFileSync(extractedBin, target);
|
|
51978
|
+
fs95.chmodSync(target, 493);
|
|
51928
51979
|
log.info("host-agent", `glab installed to ${target} (v${version3})`);
|
|
51929
51980
|
return target;
|
|
51930
51981
|
} catch (e) {
|
|
@@ -52003,12 +52054,12 @@ var defaultGitToolingRunner = {
|
|
|
52003
52054
|
};
|
|
52004
52055
|
|
|
52005
52056
|
// src/lib/cli-versions.ts
|
|
52006
|
-
var
|
|
52057
|
+
var fs97 = __toESM(require("fs"));
|
|
52007
52058
|
var os69 = __toESM(require("os"));
|
|
52008
52059
|
var path109 = __toESM(require("path"));
|
|
52009
52060
|
|
|
52010
52061
|
// src/lib/updateNotifier.ts
|
|
52011
|
-
var
|
|
52062
|
+
var fs96 = __toESM(require("fs"));
|
|
52012
52063
|
var os68 = __toESM(require("os"));
|
|
52013
52064
|
var path108 = __toESM(require("path"));
|
|
52014
52065
|
var https8 = __toESM(require("https"));
|
|
@@ -52024,7 +52075,7 @@ function cachePath() {
|
|
|
52024
52075
|
}
|
|
52025
52076
|
function readCache() {
|
|
52026
52077
|
try {
|
|
52027
|
-
const raw =
|
|
52078
|
+
const raw = fs96.readFileSync(cachePath(), "utf8");
|
|
52028
52079
|
const parsed = JSON.parse(raw);
|
|
52029
52080
|
if (typeof parsed.fetchedAt !== "number" || typeof parsed.latest !== "string") return null;
|
|
52030
52081
|
return parsed;
|
|
@@ -52035,10 +52086,10 @@ function readCache() {
|
|
|
52035
52086
|
function writeCache(cache) {
|
|
52036
52087
|
try {
|
|
52037
52088
|
const file = cachePath();
|
|
52038
|
-
|
|
52089
|
+
fs96.mkdirSync(path108.dirname(file), { recursive: true });
|
|
52039
52090
|
const tmp = `${file}.${process.pid}.tmp`;
|
|
52040
|
-
|
|
52041
|
-
|
|
52091
|
+
fs96.writeFileSync(tmp, JSON.stringify(cache));
|
|
52092
|
+
fs96.renameSync(tmp, file);
|
|
52042
52093
|
} catch {
|
|
52043
52094
|
}
|
|
52044
52095
|
}
|
|
@@ -52113,7 +52164,7 @@ function isLinkedInstall() {
|
|
|
52113
52164
|
}).trim();
|
|
52114
52165
|
if (!root) return false;
|
|
52115
52166
|
const pkgPath = path108.join(root, PKG_NAME);
|
|
52116
|
-
return
|
|
52167
|
+
return fs96.lstatSync(pkgPath).isSymbolicLink();
|
|
52117
52168
|
} catch {
|
|
52118
52169
|
return false;
|
|
52119
52170
|
}
|
|
@@ -52149,7 +52200,7 @@ function maybeAutoUpdate(currentVersion, latest) {
|
|
|
52149
52200
|
return;
|
|
52150
52201
|
}
|
|
52151
52202
|
try {
|
|
52152
|
-
|
|
52203
|
+
fs96.unlinkSync(cachePath());
|
|
52153
52204
|
} catch {
|
|
52154
52205
|
}
|
|
52155
52206
|
process.stderr.write(` ${import_picocolors12.default.green("\u2713")} Updated. Resuming session...
|
|
@@ -52165,7 +52216,7 @@ async function autoUpgradeBeforeCriticalCommand() {
|
|
|
52165
52216
|
if (process.env.NODE_ENV === "test") return;
|
|
52166
52217
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
52167
52218
|
if (process.env.CI) return;
|
|
52168
|
-
const current2 = true ? "2.76.
|
|
52219
|
+
const current2 = true ? "2.76.42" : null;
|
|
52169
52220
|
if (!current2) return;
|
|
52170
52221
|
const cache = readCache();
|
|
52171
52222
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
|
@@ -52182,7 +52233,7 @@ function checkForUpdates() {
|
|
|
52182
52233
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
52183
52234
|
if (process.env.CI) return;
|
|
52184
52235
|
if (!process.stdout.isTTY) return;
|
|
52185
|
-
const current2 = true ? "2.76.
|
|
52236
|
+
const current2 = true ? "2.76.42" : null;
|
|
52186
52237
|
if (!current2) return;
|
|
52187
52238
|
const cache = readCache();
|
|
52188
52239
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
|
@@ -52216,7 +52267,7 @@ function isRecord6(v) {
|
|
|
52216
52267
|
function readPkg2(versionDir) {
|
|
52217
52268
|
try {
|
|
52218
52269
|
const raw = JSON.parse(
|
|
52219
|
-
|
|
52270
|
+
fs97.readFileSync(path109.join(packageDirOf(versionDir), "package.json"), "utf8")
|
|
52220
52271
|
);
|
|
52221
52272
|
return isRecord6(raw) ? raw : null;
|
|
52222
52273
|
} catch {
|
|
@@ -52230,14 +52281,14 @@ function entryOf(versionDir) {
|
|
|
52230
52281
|
const named = isRecord6(bin) ? bin.codeam : void 0;
|
|
52231
52282
|
const rel = typeof bin === "string" ? bin : typeof named === "string" ? named : "dist/index.js";
|
|
52232
52283
|
const entry = path109.join(packageDirOf(versionDir), rel);
|
|
52233
|
-
return
|
|
52284
|
+
return fs97.existsSync(entry) ? entry : null;
|
|
52234
52285
|
}
|
|
52235
52286
|
function launcherOf(versionDir) {
|
|
52236
52287
|
const entry = entryOf(versionDir);
|
|
52237
52288
|
if (!entry) return null;
|
|
52238
52289
|
const bin = path109.join(versionDir, "node_modules", ".bin", "codeam");
|
|
52239
52290
|
try {
|
|
52240
|
-
return
|
|
52291
|
+
return fs97.realpathSync(bin) === fs97.realpathSync(entry) ? bin : entry;
|
|
52241
52292
|
} catch {
|
|
52242
52293
|
return entry;
|
|
52243
52294
|
}
|
|
@@ -52250,7 +52301,7 @@ var BAD_MARKER_TTL_MS = 24 * 60 * 6e4;
|
|
|
52250
52301
|
var PRE_READY_WINDOW_MS = 60 * 6e4;
|
|
52251
52302
|
function isBad(versionDir, now = Date.now()) {
|
|
52252
52303
|
try {
|
|
52253
|
-
return now -
|
|
52304
|
+
return now - fs97.statSync(path109.join(versionDir, ".bad")).mtimeMs < BAD_MARKER_TTL_MS;
|
|
52254
52305
|
} catch {
|
|
52255
52306
|
return false;
|
|
52256
52307
|
}
|
|
@@ -52259,7 +52310,7 @@ function recordPreReadyFailure(versionDir, now = Date.now()) {
|
|
|
52259
52310
|
const file = path109.join(versionDir, ".prefail");
|
|
52260
52311
|
let count = 0;
|
|
52261
52312
|
try {
|
|
52262
|
-
const [n, at3] =
|
|
52313
|
+
const [n, at3] = fs97.readFileSync(file, "utf8").trim().split(" ").map(Number);
|
|
52263
52314
|
if (Number.isFinite(n) && Number.isFinite(at3) && now - at3 < PRE_READY_WINDOW_MS) {
|
|
52264
52315
|
count = n;
|
|
52265
52316
|
}
|
|
@@ -52267,43 +52318,43 @@ function recordPreReadyFailure(versionDir, now = Date.now()) {
|
|
|
52267
52318
|
}
|
|
52268
52319
|
count += 1;
|
|
52269
52320
|
try {
|
|
52270
|
-
|
|
52321
|
+
fs97.writeFileSync(file, `${count} ${now}`);
|
|
52271
52322
|
} catch {
|
|
52272
52323
|
}
|
|
52273
52324
|
return count;
|
|
52274
52325
|
}
|
|
52275
52326
|
function clearPreReadyFailures(versionDir) {
|
|
52276
|
-
|
|
52327
|
+
fs97.rmSync(path109.join(versionDir, ".prefail"), { force: true });
|
|
52277
52328
|
}
|
|
52278
52329
|
function markBad(versionDir, reason) {
|
|
52279
52330
|
try {
|
|
52280
|
-
|
|
52331
|
+
fs97.writeFileSync(path109.join(versionDir, ".bad"), `${(/* @__PURE__ */ new Date()).toISOString()} ${reason}
|
|
52281
52332
|
`);
|
|
52282
52333
|
} catch {
|
|
52283
52334
|
}
|
|
52284
52335
|
}
|
|
52285
52336
|
function pointerTarget(root, name) {
|
|
52286
52337
|
try {
|
|
52287
|
-
return
|
|
52338
|
+
return fs97.realpathSync(path109.join(root, name));
|
|
52288
52339
|
} catch {
|
|
52289
52340
|
return null;
|
|
52290
52341
|
}
|
|
52291
52342
|
}
|
|
52292
52343
|
function atomicPoint(root, name, targetDir) {
|
|
52293
|
-
const realRoot =
|
|
52344
|
+
const realRoot = fs97.realpathSync(root);
|
|
52294
52345
|
const tmp = path109.join(realRoot, `.${name}.tmp-${process.pid}-${Date.now()}`);
|
|
52295
|
-
|
|
52346
|
+
fs97.symlinkSync(path109.relative(realRoot, fs97.realpathSync(targetDir)), tmp, "dir");
|
|
52296
52347
|
try {
|
|
52297
|
-
|
|
52348
|
+
fs97.renameSync(tmp, path109.join(realRoot, name));
|
|
52298
52349
|
} catch (err) {
|
|
52299
|
-
|
|
52350
|
+
fs97.rmSync(tmp, { force: true });
|
|
52300
52351
|
throw err;
|
|
52301
52352
|
}
|
|
52302
52353
|
}
|
|
52303
52354
|
function samePath(a, b) {
|
|
52304
52355
|
const canon = (p2) => {
|
|
52305
52356
|
try {
|
|
52306
|
-
return
|
|
52357
|
+
return fs97.realpathSync(p2);
|
|
52307
52358
|
} catch {
|
|
52308
52359
|
return path109.resolve(p2);
|
|
52309
52360
|
}
|
|
@@ -52340,8 +52391,8 @@ function versionDirContaining(root, file) {
|
|
|
52340
52391
|
let real;
|
|
52341
52392
|
let realRoot;
|
|
52342
52393
|
try {
|
|
52343
|
-
real =
|
|
52344
|
-
realRoot =
|
|
52394
|
+
real = fs97.realpathSync(file);
|
|
52395
|
+
realRoot = fs97.realpathSync(root);
|
|
52345
52396
|
} catch {
|
|
52346
52397
|
return null;
|
|
52347
52398
|
}
|
|
@@ -52361,9 +52412,9 @@ function pidAlive3(pid) {
|
|
|
52361
52412
|
var CLK_TCK = 100;
|
|
52362
52413
|
function processStartMs(pid) {
|
|
52363
52414
|
try {
|
|
52364
|
-
const stat3 =
|
|
52415
|
+
const stat3 = fs97.readFileSync(`/proc/${pid}/stat`, "utf8");
|
|
52365
52416
|
const ticks = Number(stat3.slice(stat3.lastIndexOf(")") + 2).split(" ")[19]);
|
|
52366
|
-
const btime = /^btime (\d+)$/m.exec(
|
|
52417
|
+
const btime = /^btime (\d+)$/m.exec(fs97.readFileSync("/proc/stat", "utf8"))?.[1];
|
|
52367
52418
|
if (!Number.isFinite(ticks) || !btime) return null;
|
|
52368
52419
|
return Number(btime) * 1e3 + ticks * 1e3 / CLK_TCK;
|
|
52369
52420
|
} catch {
|
|
@@ -52375,7 +52426,7 @@ function livePids(versionDir) {
|
|
|
52375
52426
|
const dir = path109.join(versionDir, ".pids");
|
|
52376
52427
|
let names;
|
|
52377
52428
|
try {
|
|
52378
|
-
names =
|
|
52429
|
+
names = fs97.readdirSync(dir);
|
|
52379
52430
|
} catch {
|
|
52380
52431
|
return [];
|
|
52381
52432
|
}
|
|
@@ -52384,7 +52435,7 @@ function livePids(versionDir) {
|
|
|
52384
52435
|
const started = processStartMs(pid);
|
|
52385
52436
|
if (started === null) return true;
|
|
52386
52437
|
try {
|
|
52387
|
-
return started <=
|
|
52438
|
+
return started <= fs97.statSync(path109.join(dir, String(pid))).mtimeMs + PID_REUSE_SLACK_MS;
|
|
52388
52439
|
} catch {
|
|
52389
52440
|
return true;
|
|
52390
52441
|
}
|
|
@@ -52395,9 +52446,9 @@ function registerRunningVersion(root = cliVersionsRoot(), entry = process.argv[1
|
|
|
52395
52446
|
if (!dir) return;
|
|
52396
52447
|
const file = path109.join(dir, ".pids", String(process.pid));
|
|
52397
52448
|
try {
|
|
52398
|
-
|
|
52399
|
-
|
|
52400
|
-
process.once("exit", () =>
|
|
52449
|
+
fs97.mkdirSync(path109.dirname(file), { recursive: true });
|
|
52450
|
+
fs97.writeFileSync(file, "");
|
|
52451
|
+
process.once("exit", () => fs97.rmSync(file, { force: true }));
|
|
52401
52452
|
} catch {
|
|
52402
52453
|
}
|
|
52403
52454
|
}
|
|
@@ -52405,7 +52456,7 @@ function gcVersions(root) {
|
|
|
52405
52456
|
const removed = [];
|
|
52406
52457
|
let names;
|
|
52407
52458
|
try {
|
|
52408
|
-
names =
|
|
52459
|
+
names = fs97.readdirSync(root).filter((n) => SEMVER_DIR.test(n));
|
|
52409
52460
|
} catch {
|
|
52410
52461
|
return removed;
|
|
52411
52462
|
}
|
|
@@ -52419,7 +52470,7 @@ function gcVersions(root) {
|
|
|
52419
52470
|
const dir = path109.join(root, name);
|
|
52420
52471
|
if (keep.has(name) || livePids(dir).length > 0) continue;
|
|
52421
52472
|
try {
|
|
52422
|
-
|
|
52473
|
+
fs97.rmSync(dir, { recursive: true, force: true });
|
|
52423
52474
|
removed.push(name);
|
|
52424
52475
|
} catch {
|
|
52425
52476
|
}
|
|
@@ -52430,22 +52481,22 @@ function acquireInstallLock(root) {
|
|
|
52430
52481
|
const lock = path109.join(root, ".install.lock");
|
|
52431
52482
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
52432
52483
|
try {
|
|
52433
|
-
const fd =
|
|
52434
|
-
|
|
52435
|
-
|
|
52436
|
-
return () =>
|
|
52484
|
+
const fd = fs97.openSync(lock, "wx");
|
|
52485
|
+
fs97.writeSync(fd, String(process.pid));
|
|
52486
|
+
fs97.closeSync(fd);
|
|
52487
|
+
return () => fs97.rmSync(lock, { force: true });
|
|
52437
52488
|
} catch (err) {
|
|
52438
52489
|
if (err.code !== "EEXIST") return null;
|
|
52439
52490
|
let stale = false;
|
|
52440
52491
|
try {
|
|
52441
|
-
const owner = Number(
|
|
52442
|
-
const age = Date.now() -
|
|
52492
|
+
const owner = Number(fs97.readFileSync(lock, "utf8"));
|
|
52493
|
+
const age = Date.now() - fs97.statSync(lock).mtimeMs;
|
|
52443
52494
|
stale = !Number.isInteger(owner) || !pidAlive3(owner) || age > LOCK_STALE_MS;
|
|
52444
52495
|
} catch {
|
|
52445
52496
|
stale = true;
|
|
52446
52497
|
}
|
|
52447
52498
|
if (!stale) return null;
|
|
52448
|
-
|
|
52499
|
+
fs97.rmSync(lock, { force: true });
|
|
52449
52500
|
}
|
|
52450
52501
|
}
|
|
52451
52502
|
return null;
|
|
@@ -52453,7 +52504,7 @@ function acquireInstallLock(root) {
|
|
|
52453
52504
|
|
|
52454
52505
|
// src/commands/host/host-launch.ts
|
|
52455
52506
|
var import_node_child_process35 = require("child_process");
|
|
52456
|
-
var
|
|
52507
|
+
var fs99 = __toESM(require("fs"));
|
|
52457
52508
|
var os70 = __toESM(require("os"));
|
|
52458
52509
|
var path111 = __toESM(require("path"));
|
|
52459
52510
|
|
|
@@ -52477,7 +52528,7 @@ var EXIT_CODE_NAMES = {
|
|
|
52477
52528
|
|
|
52478
52529
|
// src/commands/host/self-update.ts
|
|
52479
52530
|
var import_node_child_process34 = require("child_process");
|
|
52480
|
-
var
|
|
52531
|
+
var fs98 = __toESM(require("fs"));
|
|
52481
52532
|
var path110 = __toESM(require("path"));
|
|
52482
52533
|
var SELF_UPDATE_PKG = "codeam-cli";
|
|
52483
52534
|
var SELF_UPDATE_INTERVAL_MS = 60 * 60 * 1e3;
|
|
@@ -52488,7 +52539,7 @@ var SELF_UPDATE_VIEW_TIMEOUT_MS = 3e4;
|
|
|
52488
52539
|
var SELF_UPDATE_INSTALL_TIMEOUT_MS = 18e4;
|
|
52489
52540
|
var SELF_UPDATE_LS_TIMEOUT_MS = 15e3;
|
|
52490
52541
|
function currentCliVersion() {
|
|
52491
|
-
return true ? "2.76.
|
|
52542
|
+
return true ? "2.76.42" : null;
|
|
52492
52543
|
}
|
|
52493
52544
|
async function installedVersion(deps) {
|
|
52494
52545
|
const ls = await deps.run(
|
|
@@ -52606,7 +52657,7 @@ async function installVersioned(deps, root, latest, running2) {
|
|
|
52606
52657
|
const node = deps.nodePath ?? process.execPath;
|
|
52607
52658
|
const target = path110.join(root, latest);
|
|
52608
52659
|
try {
|
|
52609
|
-
|
|
52660
|
+
fs98.mkdirSync(root, { recursive: true });
|
|
52610
52661
|
} catch {
|
|
52611
52662
|
return { status: "skipped" };
|
|
52612
52663
|
}
|
|
@@ -52630,7 +52681,7 @@ async function installVersioned(deps, root, latest, running2) {
|
|
|
52630
52681
|
}
|
|
52631
52682
|
const reusable = entryOf(target) && versionOf(target) === latest;
|
|
52632
52683
|
if (!reusable) {
|
|
52633
|
-
|
|
52684
|
+
fs98.rmSync(target, { recursive: true, force: true });
|
|
52634
52685
|
const install = await deps.run(
|
|
52635
52686
|
"npm",
|
|
52636
52687
|
[
|
|
@@ -52645,7 +52696,7 @@ async function installVersioned(deps, root, latest, running2) {
|
|
|
52645
52696
|
SELF_UPDATE_INSTALL_TIMEOUT_MS
|
|
52646
52697
|
);
|
|
52647
52698
|
if (install.code !== 0) {
|
|
52648
|
-
|
|
52699
|
+
fs98.rmSync(target, { recursive: true, force: true });
|
|
52649
52700
|
log.warn(
|
|
52650
52701
|
"host-agent",
|
|
52651
52702
|
`self-update: versioned install exited ${String(install.code)} \u2014 staying on ${running2}: ` + install.stderr.slice(-300)
|
|
@@ -52656,7 +52707,7 @@ async function installVersioned(deps, root, latest, running2) {
|
|
|
52656
52707
|
const entry = entryOf(target);
|
|
52657
52708
|
const check = entry ? await deps.run(node, [entry, "--version"], VERIFY_TIMEOUT_MS) : { code: null, stdout: "", stderr: "no entry point" };
|
|
52658
52709
|
if (check.code !== 0 || !check.stdout.includes(latest)) {
|
|
52659
|
-
|
|
52710
|
+
fs98.rmSync(target, { recursive: true, force: true });
|
|
52660
52711
|
log.warn(
|
|
52661
52712
|
"host-agent",
|
|
52662
52713
|
`self-update: ${latest} failed verification (exit ${String(check.code)}: ${(check.stdout + check.stderr).trim().slice(-200)}) \u2014 staying on ${running2}`
|
|
@@ -52672,7 +52723,7 @@ async function installVersioned(deps, root, latest, running2) {
|
|
|
52672
52723
|
return { status: "updated", version: latest };
|
|
52673
52724
|
} catch (err) {
|
|
52674
52725
|
const cur = pointerTarget(root, "current");
|
|
52675
|
-
if (!cur || path110.basename(cur) !== latest)
|
|
52726
|
+
if (!cur || path110.basename(cur) !== latest) fs98.rmSync(target, { recursive: true, force: true });
|
|
52676
52727
|
log.warn(
|
|
52677
52728
|
"host-agent",
|
|
52678
52729
|
`self-update: versioned install failed: ${err instanceof Error ? err.message : String(err)}`
|
|
@@ -52711,7 +52762,7 @@ function signalHostReady(send = process.send?.bind(process)) {
|
|
|
52711
52762
|
}
|
|
52712
52763
|
function defaultDeps() {
|
|
52713
52764
|
return {
|
|
52714
|
-
ownVersion: true ? "2.76.
|
|
52765
|
+
ownVersion: true ? "2.76.42" : null,
|
|
52715
52766
|
root: cliVersionsRoot(),
|
|
52716
52767
|
args: process.argv.slice(3),
|
|
52717
52768
|
execPath: process.execPath,
|
|
@@ -52808,7 +52859,7 @@ function needsSelfRelaunch(env = process.env, pid = process.pid, ctx = {}) {
|
|
|
52808
52859
|
}
|
|
52809
52860
|
function readPid1Cmdline() {
|
|
52810
52861
|
try {
|
|
52811
|
-
return
|
|
52862
|
+
return fs99.readFileSync("/proc/1/cmdline", "utf8").split("\0").filter(Boolean);
|
|
52812
52863
|
} catch {
|
|
52813
52864
|
return [];
|
|
52814
52865
|
}
|
|
@@ -52856,7 +52907,7 @@ function defaultRestartForUpdate(version3, supervised, io = {}) {
|
|
|
52856
52907
|
}
|
|
52857
52908
|
exit(0);
|
|
52858
52909
|
}
|
|
52859
|
-
function isContainerEnvironment(existsSyncFn =
|
|
52910
|
+
function isContainerEnvironment(existsSyncFn = fs99.existsSync, readFileSyncFn = (p2) => fs99.readFileSync(p2, "utf8")) {
|
|
52860
52911
|
try {
|
|
52861
52912
|
if (existsSyncFn("/.dockerenv")) return true;
|
|
52862
52913
|
} catch {
|
|
@@ -52873,11 +52924,11 @@ function hostAgentPidFile(home = os70.homedir()) {
|
|
|
52873
52924
|
}
|
|
52874
52925
|
function writeHostAgentPidFile(file = hostAgentPidFile(), pid = process.pid) {
|
|
52875
52926
|
try {
|
|
52876
|
-
|
|
52877
|
-
|
|
52927
|
+
fs99.mkdirSync(path111.dirname(file), { recursive: true });
|
|
52928
|
+
fs99.writeFileSync(file, String(pid));
|
|
52878
52929
|
process.once("exit", () => {
|
|
52879
52930
|
try {
|
|
52880
|
-
if (
|
|
52931
|
+
if (fs99.readFileSync(file, "utf8").trim() === String(pid)) fs99.rmSync(file, { force: true });
|
|
52881
52932
|
} catch {
|
|
52882
52933
|
}
|
|
52883
52934
|
});
|
|
@@ -53731,7 +53782,7 @@ var HostAgentSupervisor = class {
|
|
|
53731
53782
|
const raw = cmd.payload?.path;
|
|
53732
53783
|
const target = typeof raw === "string" && raw.trim() ? path112.resolve(raw.trim()) : os71.homedir();
|
|
53733
53784
|
try {
|
|
53734
|
-
const dirents = await
|
|
53785
|
+
const dirents = await fs100.promises.readdir(target, { withFileTypes: true });
|
|
53735
53786
|
const entries2 = dirents.filter((d3) => !d3.name.startsWith(".")).map((d3) => ({ name: d3.name, isDir: d3.isDirectory() })).sort(
|
|
53736
53787
|
(a, b) => a.isDir === b.isDir ? a.name.localeCompare(b.name) : a.isDir ? -1 : 1
|
|
53737
53788
|
);
|
|
@@ -54220,7 +54271,7 @@ var HostAgentSupervisor = class {
|
|
|
54220
54271
|
payload.deployId
|
|
54221
54272
|
);
|
|
54222
54273
|
try {
|
|
54223
|
-
|
|
54274
|
+
fs100.mkdirSync(houseConfigDir, { recursive: true, mode: 448 });
|
|
54224
54275
|
} catch {
|
|
54225
54276
|
}
|
|
54226
54277
|
childEnv.CLAUDE_CONFIG_DIR = houseConfigDir;
|
|
@@ -54293,7 +54344,7 @@ var HostAgentSupervisor = class {
|
|
|
54293
54344
|
try {
|
|
54294
54345
|
const cfgDir = childEnv.CLAUDE_CONFIG_DIR || path112.join(os71.homedir(), ".claude");
|
|
54295
54346
|
const projectDir = path112.join(cfgDir, "projects", encodeCwd(cwd));
|
|
54296
|
-
const hasPriorConversation =
|
|
54347
|
+
const hasPriorConversation = fs100.existsSync(projectDir) && fs100.readdirSync(projectDir).some((f) => f.endsWith(".jsonl"));
|
|
54297
54348
|
if (hasPriorConversation) {
|
|
54298
54349
|
childEnv.CODEAM_RESUME_LATEST = "1";
|
|
54299
54350
|
log.info(
|
|
@@ -54447,7 +54498,7 @@ var HostAgentSupervisor = class {
|
|
|
54447
54498
|
fallbackResumeTarget() {
|
|
54448
54499
|
const session = getActiveSession();
|
|
54449
54500
|
if (!session || !session.pluginId || !session.pollSecret || !session.agent) return null;
|
|
54450
|
-
const cwd = session.cwd &&
|
|
54501
|
+
const cwd = session.cwd && fs100.existsSync(session.cwd) ? session.cwd : process.cwd();
|
|
54451
54502
|
if (isFilesystemRoot(cwd)) {
|
|
54452
54503
|
log.warn(
|
|
54453
54504
|
"host-agent",
|
|
@@ -54494,7 +54545,7 @@ var HostAgentSupervisor = class {
|
|
|
54494
54545
|
log.warn("host-agent", `self_hosted_resume ${sessionId.slice(0, 8)}: no saved pairing on this box`);
|
|
54495
54546
|
return;
|
|
54496
54547
|
}
|
|
54497
|
-
if (!session.cwd || !
|
|
54548
|
+
if (!session.cwd || !fs100.existsSync(session.cwd)) {
|
|
54498
54549
|
log.warn("host-agent", `self_hosted_resume ${sessionId.slice(0, 8)}: workspace is gone`);
|
|
54499
54550
|
return;
|
|
54500
54551
|
}
|
|
@@ -54536,7 +54587,7 @@ var HostAgentSupervisor = class {
|
|
|
54536
54587
|
const persisted = new Map((this.sessionStore.load() ?? []).map((r) => [r.deployId, r.agent]));
|
|
54537
54588
|
for (const c2 of this.children.values()) persisted.set(c2.deployId, c2.agent);
|
|
54538
54589
|
return this.listSavedSessions().map((s) => ({ s, deployId: deployIdFromWorkspace(s.cwd) })).filter(
|
|
54539
|
-
(x) => x.deployId !== null && !!x.s.cwd &&
|
|
54590
|
+
(x) => x.deployId !== null && !!x.s.cwd && fs100.existsSync(x.s.cwd)
|
|
54540
54591
|
).map(({ s, deployId }) => {
|
|
54541
54592
|
const agent = persisted.get(deployId);
|
|
54542
54593
|
return { deployId, sessionId: s.id, ...agent ? { agent } : {} };
|
|
@@ -54621,7 +54672,7 @@ var HostAgentSupervisor = class {
|
|
|
54621
54672
|
if (this.children.has(deployId)) return;
|
|
54622
54673
|
const st3 = this.resumeStateFor(target);
|
|
54623
54674
|
try {
|
|
54624
|
-
const cwd =
|
|
54675
|
+
const cwd = fs100.existsSync(target.cwd) ? target.cwd : process.cwd();
|
|
54625
54676
|
if (isWrapperCheckout(cwd)) {
|
|
54626
54677
|
log.warn(
|
|
54627
54678
|
"host-agent",
|
|
@@ -54861,7 +54912,7 @@ var HostAgentSupervisor = class {
|
|
|
54861
54912
|
];
|
|
54862
54913
|
for (const dir of dirs) {
|
|
54863
54914
|
try {
|
|
54864
|
-
|
|
54915
|
+
fs100.rmSync(dir, { recursive: true, force: true });
|
|
54865
54916
|
} catch (err) {
|
|
54866
54917
|
log.warn(
|
|
54867
54918
|
"host-agent",
|
|
@@ -55080,7 +55131,7 @@ async function invite() {
|
|
|
55080
55131
|
var import_node_dns = require("dns");
|
|
55081
55132
|
var import_node_util11 = require("util");
|
|
55082
55133
|
var import_node_crypto17 = require("crypto");
|
|
55083
|
-
var
|
|
55134
|
+
var fs101 = __toESM(require("fs"));
|
|
55084
55135
|
var path113 = __toESM(require("path"));
|
|
55085
55136
|
var import_picocolors14 = __toESM(require("picocolors"));
|
|
55086
55137
|
var dnsResolveP = (0, import_node_util11.promisify)(import_node_dns.resolve);
|
|
@@ -55139,11 +55190,11 @@ async function checkHealth(apiBase2) {
|
|
|
55139
55190
|
function checkConfigDir() {
|
|
55140
55191
|
const dir = path113.join(require("os").homedir(), ".codeam");
|
|
55141
55192
|
try {
|
|
55142
|
-
|
|
55193
|
+
fs101.mkdirSync(dir, { recursive: true, mode: 448 });
|
|
55143
55194
|
const probe = path113.join(dir, ".doctor-probe");
|
|
55144
|
-
|
|
55145
|
-
const read =
|
|
55146
|
-
|
|
55195
|
+
fs101.writeFileSync(probe, "ok", { mode: 384 });
|
|
55196
|
+
const read = fs101.readFileSync(probe, "utf8");
|
|
55197
|
+
fs101.unlinkSync(probe);
|
|
55147
55198
|
if (read !== "ok") throw new Error("write/read round-trip mismatch");
|
|
55148
55199
|
return {
|
|
55149
55200
|
id: "config-dir",
|
|
@@ -55249,7 +55300,7 @@ function checkChokidar() {
|
|
|
55249
55300
|
}
|
|
55250
55301
|
async function doctor(args2 = []) {
|
|
55251
55302
|
const json = args2.includes("--json");
|
|
55252
|
-
const cliVersion = true ? "2.76.
|
|
55303
|
+
const cliVersion = true ? "2.76.42" : "0.0.0-dev";
|
|
55253
55304
|
const apiBase2 = resolveApiBaseUrl();
|
|
55254
55305
|
const diagnosticId = (0, import_node_crypto17.randomUUID)();
|
|
55255
55306
|
log.info("doctor", `run id=${diagnosticId} cli=${cliVersion}`);
|
|
@@ -55785,7 +55836,7 @@ async function mcpWarm(argv = [], opts = {}) {
|
|
|
55785
55836
|
// src/commands/version.ts
|
|
55786
55837
|
var import_picocolors15 = __toESM(require("picocolors"));
|
|
55787
55838
|
function version2() {
|
|
55788
|
-
const v = true ? "2.76.
|
|
55839
|
+
const v = true ? "2.76.42" : "unknown";
|
|
55789
55840
|
console.log(`${import_picocolors15.default.bold("codeam-cli")} ${import_picocolors15.default.cyan(v)}`);
|
|
55790
55841
|
}
|
|
55791
55842
|
|