codeam-cli 2.75.22 → 2.75.25

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/index.js +538 -402
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -357,8 +357,8 @@ function defaultSpawn(timeoutMs) {
357
357
  });
358
358
  }
359
359
  function resolveConvexBin(cwd) {
360
- const local = path93.join(cwd, "node_modules", ".bin", process.platform === "win32" ? "convex.cmd" : "convex");
361
- if (fs79.existsSync(local)) return { cmd: local, args: [] };
360
+ const local = path94.join(cwd, "node_modules", ".bin", process.platform === "win32" ? "convex.cmd" : "convex");
361
+ if (fs80.existsSync(local)) return { cmd: local, args: [] };
362
362
  return { cmd: "npx", args: ["--yes", "convex"] };
363
363
  }
364
364
  function redact(text, key) {
@@ -489,13 +489,13 @@ async function runConvexAdminMcp(client3, id) {
489
489
  });
490
490
  await server.connect(new StdioServerTransport());
491
491
  }
492
- var import_node_child_process32, fs79, path93, TOOLS;
492
+ var import_node_child_process32, fs80, path94, TOOLS;
493
493
  var init_convex_admin_mcp = __esm({
494
494
  "src/integrations/convex-admin-mcp.ts"() {
495
495
  "use strict";
496
496
  import_node_child_process32 = require("child_process");
497
- fs79 = __toESM(require("fs"));
498
- path93 = __toESM(require("path"));
497
+ fs80 = __toESM(require("fs"));
498
+ path94 = __toESM(require("path"));
499
499
  TOOLS = [
500
500
  {
501
501
  name: "tables",
@@ -3525,11 +3525,11 @@ function quiet(fn) {
3525
3525
  log.debug(TAG, "ignored sync error", err);
3526
3526
  }
3527
3527
  }
3528
- function rmIfExistsQuiet(path95) {
3528
+ function rmIfExistsQuiet(path96) {
3529
3529
  try {
3530
- fs2.rmSync(path95, { force: true });
3530
+ fs2.rmSync(path96, { force: true });
3531
3531
  } catch (err) {
3532
- log.debug(TAG, `rmIfExists failed for ${path95}`, err);
3532
+ log.debug(TAG, `rmIfExists failed for ${path96}`, err);
3533
3533
  }
3534
3534
  }
3535
3535
  function killQuiet(target, signal = "SIGTERM") {
@@ -3695,9 +3695,9 @@ var _default = makeConfig();
3695
3695
  var { getConfig, ensurePluginId, addSession, removeSession, setActiveSession, getActiveSession, getActiveSessionForAgent, setDisable1mContext, setSessionAgent, setSquadAuto, getSquadAuto, clearAll, saveCliConfig, loadCliConfig } = _default;
3696
3696
 
3697
3697
  // src/commands/pair-auto.ts
3698
- var fs51 = __toESM(require("fs"));
3698
+ var fs52 = __toESM(require("fs"));
3699
3699
  var os40 = __toESM(require("os"));
3700
- var path59 = __toESM(require("path"));
3700
+ var path60 = __toESM(require("path"));
3701
3701
  var import_crypto3 = require("crypto");
3702
3702
 
3703
3703
  // src/services/telemetry.service.ts
@@ -3733,8 +3733,8 @@ function createGetModuleFromFilename(basePath = process.argv[1] ? (0, import_pat
3733
3733
  return decodedFile;
3734
3734
  };
3735
3735
  }
3736
- function normalizeWindowsPath(path95) {
3737
- return path95.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
3736
+ function normalizeWindowsPath(path96) {
3737
+ return path96.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
3738
3738
  }
3739
3739
 
3740
3740
  // ../../node_modules/@posthog/core/dist/error-tracking/index.mjs
@@ -6467,13 +6467,13 @@ var PostHogCoreStateless = class {
6467
6467
  sentFromRoute += batchMessages.length;
6468
6468
  }
6469
6469
  }
6470
- async _sendOtlpBatch({ path: path95, payload }) {
6470
+ async _sendOtlpBatch({ path: path96, payload }) {
6471
6471
  if (this.disabled) return {
6472
6472
  kind: "fatal",
6473
6473
  error: new Error("The client is disabled")
6474
6474
  };
6475
6475
  const serialized = JSON.stringify(payload);
6476
- const url2 = `${this.host}/i/v1/${path95}?token=${encodeURIComponent(this.apiKey)}`;
6476
+ const url2 = `${this.host}/i/v1/${path96}?token=${encodeURIComponent(this.apiKey)}`;
6477
6477
  const gzippedPayload = this.disableCompression ? null : await this.compressPayload(serialized);
6478
6478
  const fetchOptions = {
6479
6479
  method: "POST",
@@ -7713,14 +7713,14 @@ async function addSourceContext(frames, openSourceFile = import_promises.open, l
7713
7713
  LRU_FILE_CONTENTS_CACHE.reduce();
7714
7714
  return frames;
7715
7715
  }
7716
- async function openRegularSourceFile(path95, openSourceFile, logger) {
7716
+ async function openRegularSourceFile(path96, openSourceFile, logger) {
7717
7717
  let fileHandle;
7718
7718
  let isValid = false;
7719
7719
  try {
7720
- fileHandle = await openSourceFile(path95, import_node_fs.constants.O_RDONLY | import_node_fs.constants.O_NONBLOCK);
7720
+ fileHandle = await openSourceFile(path96, import_node_fs.constants.O_RDONLY | import_node_fs.constants.O_NONBLOCK);
7721
7721
  const fileStat = await fileHandle.stat();
7722
7722
  if (!fileStat.isFile()) return;
7723
- if (fileStat.size > MAX_CONTEXTLINES_FILE_SIZE) return void logger?.debug(`Skipping source context for oversized file ${path95}: ${fileStat.size} bytes exceeds ${MAX_CONTEXTLINES_FILE_SIZE}`);
7723
+ if (fileStat.size > MAX_CONTEXTLINES_FILE_SIZE) return void logger?.debug(`Skipping source context for oversized file ${path96}: ${fileStat.size} bytes exceeds ${MAX_CONTEXTLINES_FILE_SIZE}`);
7724
7724
  isValid = true;
7725
7725
  return fileHandle;
7726
7726
  } catch {
@@ -7730,8 +7730,8 @@ async function openRegularSourceFile(path95, openSourceFile, logger) {
7730
7730
  });
7731
7731
  }
7732
7732
  }
7733
- async function getContextLinesFromFile(path95, ranges, output, cacheKey, openSourceFile, logger) {
7734
- const fileHandle = await openRegularSourceFile(path95, openSourceFile, logger);
7733
+ async function getContextLinesFromFile(path96, ranges, output, cacheKey, openSourceFile, logger) {
7734
+ const fileHandle = await openRegularSourceFile(path96, openSourceFile, logger);
7735
7735
  if (void 0 === fileHandle) return void LRU_FILE_CONTENTS_FS_READ_FAILED.set(cacheKey, 1);
7736
7736
  const openedFileHandle = fileHandle;
7737
7737
  return new Promise((resolve12) => {
@@ -7833,22 +7833,22 @@ function clearLineContext(frame) {
7833
7833
  delete frame.context_line;
7834
7834
  delete frame.post_context;
7835
7835
  }
7836
- function shouldSkipContextLinesForFile(path95) {
7837
- return path95.startsWith("node:") || path95.endsWith(".min.js") || path95.endsWith(".min.cjs") || path95.endsWith(".min.mjs") || path95.startsWith("data:");
7836
+ function shouldSkipContextLinesForFile(path96) {
7837
+ return path96.startsWith("node:") || path96.endsWith(".min.js") || path96.endsWith(".min.cjs") || path96.endsWith(".min.mjs") || path96.startsWith("data:");
7838
7838
  }
7839
7839
  function shouldSkipContextLinesForFrame(frame) {
7840
7840
  if (void 0 !== frame.lineno && frame.lineno > MAX_CONTEXTLINES_LINENO) return true;
7841
7841
  if (void 0 !== frame.colno && frame.colno > MAX_CONTEXTLINES_COLNO) return true;
7842
7842
  return false;
7843
7843
  }
7844
- function makeSourceCacheKey(path95, basePath) {
7845
- if ((0, import_node_path.isAbsolute)(path95)) return JSON.stringify([
7844
+ function makeSourceCacheKey(path96, basePath) {
7845
+ if ((0, import_node_path.isAbsolute)(path96)) return JSON.stringify([
7846
7846
  null,
7847
- path95
7847
+ path96
7848
7848
  ]);
7849
7849
  return void 0 === basePath ? void 0 : JSON.stringify([
7850
7850
  basePath,
7851
- path95
7851
+ path96
7852
7852
  ]);
7853
7853
  }
7854
7854
  function rangeExistsInContentCache(cacheKey, range) {
@@ -10509,7 +10509,7 @@ function readAnonId() {
10509
10509
  }
10510
10510
  function superProperties() {
10511
10511
  return {
10512
- cliVersion: true ? "2.75.22" : "0.0.0-dev",
10512
+ cliVersion: true ? "2.75.25" : "0.0.0-dev",
10513
10513
  nodeVersion: process.version,
10514
10514
  platform: process.platform,
10515
10515
  arch: process.arch,
@@ -10751,7 +10751,7 @@ var http = __toESM(require("http"));
10751
10751
  // package.json
10752
10752
  var package_default = {
10753
10753
  name: "codeam-cli",
10754
- version: "2.75.22",
10754
+ version: "2.75.25",
10755
10755
  description: "Workflow-continuity bridge for AI coding agents. Wrap Claude Code or Codex in a PTY and supervise, approve, and redirect the session from any device \u2014 async. The terminal companion for CodeAgent Mobile.",
10756
10756
  type: "commonjs",
10757
10757
  main: "dist/index.js",
@@ -12081,7 +12081,7 @@ var CommandRelayService = class _CommandRelayService {
12081
12081
  // fresh + clear the "CLI update available" banner after a self-update
12082
12082
  // (a codespace that reinstalls @latest reconnects via heartbeat, not
12083
12083
  // pair/reconnect). Older backends ignore the extra field.
12084
- ..."2.75.22" ? { ideVersion: "2.75.22" } : {}
12084
+ ..."2.75.25" ? { ideVersion: "2.75.25" } : {}
12085
12085
  };
12086
12086
  try {
12087
12087
  const res = await _postJson(`${API_BASE2}/api/plugin/heartbeat`, body);
@@ -13534,9 +13534,9 @@ function closeAllTerminals() {
13534
13534
  }
13535
13535
 
13536
13536
  // src/commands/start/handlers.ts
13537
- var fs50 = __toESM(require("fs"));
13537
+ var fs51 = __toESM(require("fs"));
13538
13538
  var os39 = __toESM(require("os"));
13539
- var path58 = __toESM(require("path"));
13539
+ var path59 = __toESM(require("path"));
13540
13540
  var import_crypto2 = require("crypto");
13541
13541
  var import_child_process25 = require("child_process");
13542
13542
 
@@ -17150,12 +17150,12 @@ function isAvailable() {
17150
17150
  }
17151
17151
  function augmentPath() {
17152
17152
  const dirs = probeInstallDirs();
17153
- const sep6 = path15.delimiter;
17153
+ const sep7 = path15.delimiter;
17154
17154
  const current2 = process.env.PATH ?? "";
17155
- const existing = new Set(current2.split(sep6).filter(Boolean));
17155
+ const existing = new Set(current2.split(sep7).filter(Boolean));
17156
17156
  const additions = dirs.filter((d3) => !existing.has(d3));
17157
17157
  if (additions.length === 0) return;
17158
- process.env.PATH = additions.join(sep6) + sep6 + current2;
17158
+ process.env.PATH = additions.join(sep7) + sep7 + current2;
17159
17159
  }
17160
17160
  function runInstaller() {
17161
17161
  const isWindows = process.platform === "win32";
@@ -18038,6 +18038,7 @@ var ClaudeRuntimeStrategy = class {
18038
18038
  const launch = buildClaudeLaunch(["-p", prompt], this.os);
18039
18039
  if (!launch) return null;
18040
18040
  return spawnAndCapture(launch.cmd, launch.args, {
18041
+ onStderr: opts?.onStderr,
18041
18042
  cwd: opts?.cwd,
18042
18043
  timeoutMs: opts?.timeoutMs
18043
18044
  });
@@ -19124,6 +19125,7 @@ var CodexRuntimeStrategy = class {
19124
19125
  if (!binary) return null;
19125
19126
  const launch = this.os.buildLaunch(binary, ["exec", prompt]);
19126
19127
  return spawnAndCapture(launch.cmd, launch.args, {
19128
+ onStderr: opts?.onStderr,
19127
19129
  cwd: opts?.cwd,
19128
19130
  timeoutMs: opts?.timeoutMs
19129
19131
  });
@@ -19601,8 +19603,8 @@ function pickLine(obj) {
19601
19603
  function toHunk(raw, groupSeverity) {
19602
19604
  if (!raw || typeof raw !== "object") return null;
19603
19605
  const o = raw;
19604
- const path95 = asString(pick(o, ["file_path", "filePath", "file", "path", "filename", "fileName"])) ?? asString(pick(o, ["location"])?.path);
19605
- if (!path95) return null;
19606
+ const path96 = asString(pick(o, ["file_path", "filePath", "file", "path", "filename", "fileName"])) ?? asString(pick(o, ["location"])?.path);
19607
+ if (!path96) return null;
19606
19608
  const message = asString(
19607
19609
  pick(o, [
19608
19610
  "comment",
@@ -19619,7 +19621,7 @@ function toHunk(raw, groupSeverity) {
19619
19621
  const severity = normSeverity(pick(o, ["severity", "level", "priority", "impact"])) ?? normSeverity(groupSeverity);
19620
19622
  const locObj = pick(o, ["location"]) ?? o;
19621
19623
  return {
19622
- path: path95.trim(),
19624
+ path: path96.trim(),
19623
19625
  line: pickLine(o) ?? pickLine(locObj),
19624
19626
  severity,
19625
19627
  message: (title && message ? `${title}: ${message}` : title || message).trim() || "(no message)"
@@ -19702,10 +19704,10 @@ function parsePlain(stdout) {
19702
19704
  for (const line of stdout.split(/\r?\n/)) {
19703
19705
  const m = line.match(HUNK_LINE_RE);
19704
19706
  if (!m) continue;
19705
- const [, path95, lineNo, sevToken, message] = m;
19706
- if (!path95 || !lineNo || !message) continue;
19707
+ const [, path96, lineNo, sevToken, message] = m;
19708
+ if (!path96 || !lineNo || !message) continue;
19707
19709
  hunks.push({
19708
- path: path95.trim(),
19710
+ path: path96.trim(),
19709
19711
  line: Number(lineNo),
19710
19712
  severity: sevToken ? SEVERITY_MAP[sevToken.toLowerCase()] : void 0,
19711
19713
  message: message.trim().replace(/^[*-]\s+/, "")
@@ -20228,6 +20230,7 @@ var CursorRuntimeStrategy = class {
20228
20230
  if (!binary) return null;
20229
20231
  const launch = this.os.buildLaunch(binary, ["--print", "--force", "--trust", prompt]);
20230
20232
  return spawnAndCapture(launch.cmd, launch.args, {
20233
+ onStderr: opts?.onStderr,
20231
20234
  cwd: opts?.cwd,
20232
20235
  timeoutMs: opts?.timeoutMs
20233
20236
  });
@@ -21030,6 +21033,7 @@ var GeminiRuntimeStrategy = class {
21030
21033
  if (!binary) return null;
21031
21034
  const launch = this.os.buildLaunch(binary, ["--skip-trust", "-p", prompt]);
21032
21035
  return spawnAndCapture(launch.cmd, launch.args, {
21036
+ onStderr: opts?.onStderr,
21033
21037
  cwd: opts?.cwd,
21034
21038
  timeoutMs: opts?.timeoutMs
21035
21039
  });
@@ -21307,6 +21311,7 @@ var KimiRuntimeStrategy = class {
21307
21311
  if (!binary) return null;
21308
21312
  const launch = this.os.buildLaunch(binary, ["-p", prompt, "--output-format", "text"]);
21309
21313
  return spawnAndCapture(launch.cmd, launch.args, {
21314
+ onStderr: opts?.onStderr,
21310
21315
  cwd: opts?.cwd,
21311
21316
  timeoutMs: opts?.timeoutMs
21312
21317
  });
@@ -21426,6 +21431,7 @@ var OpencodeRuntimeStrategy = class {
21426
21431
  if (!binary) return null;
21427
21432
  const launch = this.os.buildLaunch(binary, ["run", prompt]);
21428
21433
  return spawnAndCapture(launch.cmd, launch.args, {
21434
+ onStderr: opts?.onStderr,
21429
21435
  cwd: opts?.cwd,
21430
21436
  timeoutMs: opts?.timeoutMs
21431
21437
  });
@@ -23158,7 +23164,8 @@ async function readPreviewConfig(cwd) {
23158
23164
  async function writePreviewConfig(cwd, detection) {
23159
23165
  const filePath = configPath(cwd);
23160
23166
  await import_promises4.default.mkdir(import_path6.default.dirname(filePath), { recursive: true });
23161
- await import_promises4.default.writeFile(filePath, JSON.stringify(detection, null, 2) + "\n", "utf-8");
23167
+ const { candidates: _candidates, ...config } = detection;
23168
+ await import_promises4.default.writeFile(filePath, JSON.stringify(config, null, 2) + "\n", "utf-8");
23162
23169
  }
23163
23170
 
23164
23171
  // src/services/preview/dotenv.ts
@@ -23335,6 +23342,13 @@ function parseCloudflaredUrl(stderr) {
23335
23342
  const match = stderr.match(CLOUDFLARED_URL_RE);
23336
23343
  return match ? match[0] : null;
23337
23344
  }
23345
+ function describeOneShotAgentError(stderr) {
23346
+ const m = /API Error:\s*(\d{3})\s+([^\n]+)/i.exec(stderr);
23347
+ if (!m) return null;
23348
+ const detail = m[2].replace(/\{.*$/, "").trim().slice(0, 240);
23349
+ if (!detail) return null;
23350
+ return `Preview detection couldn't run \u2014 the agent answered ${m[1]}: ${detail}`;
23351
+ }
23338
23352
  var RAW_EXCERPT_LIMIT = 1e3;
23339
23353
  function describeDetectionFailure(raw) {
23340
23354
  const text = raw?.trim() ?? "";
@@ -23826,6 +23840,107 @@ function isJsInstallCommand(cmd, args2) {
23826
23840
  return verb === "install" || verb === "i" || verb === "ci";
23827
23841
  }
23828
23842
 
23843
+ // src/services/preview/script-candidates.ts
23844
+ var fs40 = __toESM(require("fs"));
23845
+ var path48 = __toESM(require("path"));
23846
+ 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;
23847
+ var EXCLUDE_BODY_RE = /\b(run:android|run:ios|gradlew|fastlane|xcodebuild|eas build|eas submit)\b/i;
23848
+ var MAX_APPS = 40;
23849
+ var MAX_CANDIDATES = 120;
23850
+ function frameworkFor(pkg, body) {
23851
+ const deps = { ...pkg.dependencies ?? {}, ...pkg.devDependencies ?? {} };
23852
+ const has = (d3) => d3 in deps || new RegExp(`\\b${d3}\\b`).test(body);
23853
+ if (has("expo")) return { framework: "Expo", port: 8081, ready_pattern: "Waiting on http|Metro waiting|Logs for your project" };
23854
+ if (has("next")) return { framework: "Next.js", port: 3e3, ready_pattern: "Ready in|Local:.*http" };
23855
+ if (has("vite")) return { framework: "Vite", port: 5173, ready_pattern: "Local:.*http" };
23856
+ if (has("@angular/cli") || /\bng serve\b/.test(body)) return { framework: "Angular", port: 4200, ready_pattern: "Local:.*http|compiled successfully" };
23857
+ if (has("react-scripts")) return { framework: "Create React App", port: 3e3, ready_pattern: "Compiled|Local:.*http" };
23858
+ if (has("nx") || /\bnx\b/.test(body)) return { framework: "Nx", port: 4200, ready_pattern: "Local:.*http|ready|listening" };
23859
+ return { framework: "Node", port: 3e3, ready_pattern: "Local:.*http|ready|listening|started" };
23860
+ }
23861
+ function readPkg(file) {
23862
+ try {
23863
+ return JSON.parse(fs40.readFileSync(file, "utf8"));
23864
+ } catch {
23865
+ return null;
23866
+ }
23867
+ }
23868
+ function expandGlob(root, pattern) {
23869
+ const clean = pattern.replace(/\/+$/, "");
23870
+ if (!clean.endsWith("/*")) return [clean];
23871
+ const base = clean.slice(0, -2);
23872
+ try {
23873
+ return fs40.readdirSync(path48.join(root, base), { withFileTypes: true }).filter((d3) => d3.isDirectory() && !d3.name.startsWith(".") && d3.name !== "node_modules").map((d3) => path48.join(base, d3.name));
23874
+ } catch {
23875
+ return [];
23876
+ }
23877
+ }
23878
+ function workspaceDirs(root, rootPkg) {
23879
+ const ws = rootPkg?.workspaces;
23880
+ const patterns = Array.isArray(ws) ? ws : ws?.packages ?? [];
23881
+ try {
23882
+ const pnpm = fs40.readFileSync(path48.join(root, "pnpm-workspace.yaml"), "utf8");
23883
+ for (const m of pnpm.matchAll(/^\s*-\s*['"]?([^'"\n]+)['"]?\s*$/gm)) patterns.push(m[1]);
23884
+ } catch {
23885
+ }
23886
+ if (patterns.length === 0) patterns.push("apps/*", "packages/*");
23887
+ const dirs = /* @__PURE__ */ new Set();
23888
+ for (const p2 of patterns) for (const d3 of expandGlob(root, p2)) dirs.add(d3);
23889
+ return [...dirs].slice(0, MAX_APPS);
23890
+ }
23891
+ function listScriptCandidates(root) {
23892
+ const out2 = [];
23893
+ const rootPkg = readPkg(path48.join(root, "package.json"));
23894
+ const add = (pkg, appDir) => {
23895
+ for (const [script, body] of Object.entries(pkg.scripts ?? {})) {
23896
+ if (out2.length >= MAX_CANDIDATES) return;
23897
+ if (EXCLUDE_RE.test(script) || EXCLUDE_BODY_RE.test(body)) continue;
23898
+ const fw = frameworkFor(pkg, body);
23899
+ out2.push({
23900
+ app: pkg.name ?? (appDir === "." ? path48.basename(root) : appDir),
23901
+ appDir,
23902
+ script,
23903
+ body,
23904
+ framework: fw.framework,
23905
+ command: "npm",
23906
+ args: appDir === "." ? ["run", script] : ["--prefix", appDir, "run", script],
23907
+ port: fw.port,
23908
+ ready_pattern: fw.ready_pattern
23909
+ });
23910
+ }
23911
+ };
23912
+ if (rootPkg) add(rootPkg, ".");
23913
+ for (const dir of workspaceDirs(root, rootPkg)) {
23914
+ const pkg = readPkg(path48.join(root, dir, "package.json"));
23915
+ if (pkg) add(pkg, dir.split(path48.sep).join("/"));
23916
+ }
23917
+ return out2;
23918
+ }
23919
+
23920
+ // src/services/preview/prewarm-deps.ts
23921
+ var inFlight = null;
23922
+ var PREWARM_INSTALL_TIMEOUT_MS = 5 * 6e4;
23923
+ function prewarmNodeDeps(cwd) {
23924
+ if (inFlight) return inFlight;
23925
+ const missing = detectMissingNodeDeps(cwd);
23926
+ if (!missing || missing.cmd !== "npm") return Promise.resolve();
23927
+ log.info("preview", `prewarm: installing deps (${missing.cmd} ${missing.args.join(" ")})`);
23928
+ const started = Date.now();
23929
+ inFlight = runSetupCommand(missing.cmd, missing.args, cwd, void 0, {
23930
+ timeoutMs: PREWARM_INSTALL_TIMEOUT_MS
23931
+ }).then((r) => {
23932
+ log.info("preview", `prewarm: deps ${r.status} after ${Date.now() - started}ms`);
23933
+ }).catch((err) => {
23934
+ log.info("preview", `prewarm: deps install threw (${String(err)})`);
23935
+ }).finally(() => {
23936
+ inFlight = null;
23937
+ });
23938
+ return inFlight;
23939
+ }
23940
+ function awaitPrewarmInstall() {
23941
+ return inFlight ?? Promise.resolve();
23942
+ }
23943
+
23829
23944
  // src/services/preview/tunnel-bringup.ts
23830
23945
  var TUNNEL_REGISTERED_RE = /Registered tunnel connection/i;
23831
23946
  async function awaitTunnelRegistered(candidate, hostname3, deadlineMs) {
@@ -23962,19 +24077,19 @@ function activePreviewSessionIds() {
23962
24077
 
23963
24078
  // src/services/preview/start-orchestrator.ts
23964
24079
  var import_child_process20 = require("child_process");
23965
- var fs42 = __toESM(require("fs"));
23966
- var path50 = __toESM(require("path"));
24080
+ var fs43 = __toESM(require("fs"));
24081
+ var path51 = __toESM(require("path"));
23967
24082
  var import_which2 = __toESM(require("which"));
23968
24083
 
23969
24084
  // src/services/project-env/index.ts
23970
24085
  var import_fs6 = require("fs");
23971
- var path49 = __toESM(require("path"));
24086
+ var path50 = __toESM(require("path"));
23972
24087
 
23973
24088
  // src/beads/project-key.ts
23974
24089
  var import_child_process19 = require("child_process");
23975
24090
  var crypto2 = __toESM(require("crypto"));
23976
- var fs40 = __toESM(require("fs"));
23977
- var path48 = __toESM(require("path"));
24091
+ var fs41 = __toESM(require("fs"));
24092
+ var path49 = __toESM(require("path"));
23978
24093
  function normalizeOrigin(raw) {
23979
24094
  const trimmed = raw.trim();
23980
24095
  if (!trimmed) return null;
@@ -24000,17 +24115,17 @@ function normalizeOrigin(raw) {
24000
24115
  return `${host2}/${pathPart}`;
24001
24116
  }
24002
24117
  function findRepoRoot(cwd) {
24003
- let dir = path48.resolve(cwd);
24118
+ let dir = path49.resolve(cwd);
24004
24119
  const seen2 = /* @__PURE__ */ new Set();
24005
24120
  for (let i = 0; i < 256; i++) {
24006
24121
  if (seen2.has(dir)) return null;
24007
24122
  seen2.add(dir);
24008
24123
  try {
24009
- const stat3 = fs40.statSync(path48.join(dir, ".git"), { throwIfNoEntry: false });
24124
+ const stat3 = fs41.statSync(path49.join(dir, ".git"), { throwIfNoEntry: false });
24010
24125
  if (stat3 && (stat3.isDirectory() || stat3.isFile())) return dir;
24011
24126
  } catch {
24012
24127
  }
24013
- const parent = path48.dirname(dir);
24128
+ const parent = path49.dirname(dir);
24014
24129
  if (parent === dir) return null;
24015
24130
  dir = parent;
24016
24131
  }
@@ -24021,7 +24136,7 @@ var _execSeam3 = {
24021
24136
  const out2 = (0, import_child_process19.execFileSync)(file, args2, opts);
24022
24137
  return typeof out2 === "string" ? out2 : out2.toString("utf8");
24023
24138
  },
24024
- realpath: (p2) => fs40.realpathSync(p2)
24139
+ realpath: (p2) => fs41.realpathSync(p2)
24025
24140
  };
24026
24141
  function readOrigin(cwd) {
24027
24142
  try {
@@ -24050,7 +24165,7 @@ function deriveProjectIdentity(cwd = process.cwd()) {
24050
24165
  } catch {
24051
24166
  }
24052
24167
  const hash = crypto2.createHash("sha256").update(real).digest("hex");
24053
- return { projectKey: `path:${hash}`, projectLabel: path48.basename(real) || "project" };
24168
+ return { projectKey: `path:${hash}`, projectLabel: path49.basename(real) || "project" };
24054
24169
  }
24055
24170
 
24056
24171
  // src/services/project-env/index.ts
@@ -24063,7 +24178,7 @@ async function readIfExists(p2) {
24063
24178
  }
24064
24179
  async function syncProjectEnvUp(cwd, ctx) {
24065
24180
  if (!ctx.pluginAuthToken) return;
24066
- const content = await readIfExists(path49.join(cwd, ".env"));
24181
+ const content = await readIfExists(path50.join(cwd, ".env"));
24067
24182
  if (content == null) return;
24068
24183
  try {
24069
24184
  const { projectKey, projectLabel } = deriveProjectIdentity(cwd);
@@ -24085,7 +24200,7 @@ async function syncProjectEnvUp(cwd, ctx) {
24085
24200
  }
24086
24201
  async function restoreProjectEnvIfMissing(cwd, ctx) {
24087
24202
  if (!ctx.pluginAuthToken) return false;
24088
- const envPath = path49.join(cwd, ".env");
24203
+ const envPath = path50.join(cwd, ".env");
24089
24204
  if (await readIfExists(envPath) != null) return false;
24090
24205
  try {
24091
24206
  const { projectKey, projectLabel } = deriveProjectIdentity(cwd);
@@ -24096,7 +24211,7 @@ async function restoreProjectEnvIfMissing(cwd, ctx) {
24096
24211
  projectKey
24097
24212
  });
24098
24213
  if (!stored) return false;
24099
- const tmp = path49.join(cwd, ".env.codeam-restore.tmp");
24214
+ const tmp = path50.join(cwd, ".env.codeam-restore.tmp");
24100
24215
  await import_fs6.promises.writeFile(tmp, stored.content, { encoding: "utf8", mode: 384 });
24101
24216
  await import_fs6.promises.rename(tmp, envPath);
24102
24217
  log.info("project-env", `restored .env (${stored.keyCount} vars) for ${projectLabel}`);
@@ -24617,6 +24732,12 @@ var TUNNEL_REGISTER_DEADLINE_MS = 45e3;
24617
24732
  function compileReadyPattern(pattern) {
24618
24733
  return new RegExp(pattern, "i");
24619
24734
  }
24735
+ var DEV_SERVER_READY_TIMEOUT_MS = 12e4;
24736
+ var MONOREPO_READY_TIMEOUT_MS = 36e4;
24737
+ function devServerReadyTimeoutMs(detection) {
24738
+ const text = [detection.framework, detection.command ?? "", ...detection.args ?? []].join(" ");
24739
+ return /\b(nx|turbo|turborepo|lerna)\b/i.test(text) ? MONOREPO_READY_TIMEOUT_MS : DEV_SERVER_READY_TIMEOUT_MS;
24740
+ }
24620
24741
  async function waitForDevServerReady(devServer, readyRe, opts = {
24621
24742
  timeoutMs: 12e4
24622
24743
  }) {
@@ -24676,8 +24797,8 @@ function normalizeDetectionForSpawn(detection, cwd) {
24676
24797
  if (args2.length === 0) return detection;
24677
24798
  const binName = args2[0];
24678
24799
  if (binName.startsWith("-")) return detection;
24679
- const binPath = path50.join(cwd, "node_modules", ".bin", binName);
24680
- if (!fs42.existsSync(binPath)) return detection;
24800
+ const binPath = path51.join(cwd, "node_modules", ".bin", binName);
24801
+ if (!fs43.existsSync(binPath)) return detection;
24681
24802
  return {
24682
24803
  ...detection,
24683
24804
  command: binPath,
@@ -24771,6 +24892,7 @@ async function provisionDeps(ctx) {
24771
24892
  pluginAuthToken: ctx.projectEnvAuth.pluginAuthToken
24772
24893
  });
24773
24894
  }
24895
+ await awaitPrewarmInstall();
24774
24896
  const missingDeps = detectMissingNodeDeps(cwd);
24775
24897
  let preflightRan = false;
24776
24898
  if (missingDeps) {
@@ -24950,7 +25072,7 @@ async function startDevServer(ctx, extraEnv = {}) {
24950
25072
  const isNextJs = /next/i.test(detection.framework);
24951
25073
  const portProbe = isExpo ? () => waitForExpoManifest(detection.port, { timeoutMs: 1e3, intervalMs: 250 }) : isNextJs ? () => waitForPortListening(detection.port, { timeoutMs: 1e3, intervalMs: 250 }) : void 0;
24952
25074
  const outcome = await waitForDevServerReady(devServer, readyRe, {
24953
- timeoutMs: 12e4,
25075
+ timeoutMs: devServerReadyTimeoutMs(detection),
24954
25076
  onChunk: (s) => {
24955
25077
  outputTail = (outputTail + s).slice(-16e3);
24956
25078
  },
@@ -25076,9 +25198,9 @@ async function bringUpPublicUrl(ctx, tunnelPort) {
25076
25198
 
25077
25199
  // src/beads/bd-adapter.ts
25078
25200
  var import_child_process21 = require("child_process");
25079
- var fs43 = __toESM(require("fs"));
25201
+ var fs44 = __toESM(require("fs"));
25080
25202
  var os31 = __toESM(require("os"));
25081
- var path51 = __toESM(require("path"));
25203
+ var path52 = __toESM(require("path"));
25082
25204
  var BD_PACKAGE = "@beads/bd";
25083
25205
  function resolveBundledBdBinary() {
25084
25206
  return _resolveSeam.resolveBundled();
@@ -25090,11 +25212,11 @@ function _defaultResolveBundled() {
25090
25212
  } catch {
25091
25213
  return null;
25092
25214
  }
25093
- const binDir = path51.join(path51.dirname(pkgJsonPath), "bin");
25215
+ const binDir = path52.join(path52.dirname(pkgJsonPath), "bin");
25094
25216
  const binaryName = process.platform === "win32" ? "bd.exe" : "bd";
25095
- const binaryPath = path51.join(binDir, binaryName);
25217
+ const binaryPath = path52.join(binDir, binaryName);
25096
25218
  try {
25097
- fs43.accessSync(binaryPath, fs43.constants.F_OK);
25219
+ fs44.accessSync(binaryPath, fs44.constants.F_OK);
25098
25220
  return binaryPath;
25099
25221
  } catch {
25100
25222
  return null;
@@ -25104,13 +25226,13 @@ function resolveBdOnPath() {
25104
25226
  return _resolveSeam.resolveOnPath();
25105
25227
  }
25106
25228
  function _defaultResolveOnPath() {
25107
- const dirs = (process.env.PATH ?? "").split(path51.delimiter).filter(Boolean);
25229
+ const dirs = (process.env.PATH ?? "").split(path52.delimiter).filter(Boolean);
25108
25230
  const candidates = process.platform === "win32" ? ["bd.exe", "bd.cmd", "bd"] : ["bd"];
25109
25231
  for (const dir of dirs) {
25110
25232
  for (const candidate of candidates) {
25111
- const full = path51.join(dir, candidate);
25233
+ const full = path52.join(dir, candidate);
25112
25234
  try {
25113
- fs43.accessSync(full, fs43.constants.F_OK);
25235
+ fs44.accessSync(full, fs44.constants.F_OK);
25114
25236
  return full;
25115
25237
  } catch {
25116
25238
  }
@@ -25287,9 +25409,9 @@ function coerceIssue(row, projectKey) {
25287
25409
 
25288
25410
  // src/beads/provisioner.ts
25289
25411
  var import_child_process24 = require("child_process");
25290
- var fs45 = __toESM(require("fs"));
25412
+ var fs46 = __toESM(require("fs"));
25291
25413
  var os33 = __toESM(require("os"));
25292
- var path53 = __toESM(require("path"));
25414
+ var path54 = __toESM(require("path"));
25293
25415
 
25294
25416
  // src/beads/install-bd.ts
25295
25417
  var import_child_process22 = require("child_process");
@@ -25354,9 +25476,9 @@ async function installBd(platform3 = process.platform) {
25354
25476
 
25355
25477
  // src/beads/install-dolt.ts
25356
25478
  var import_child_process23 = require("child_process");
25357
- var fs44 = __toESM(require("fs"));
25479
+ var fs45 = __toESM(require("fs"));
25358
25480
  var os32 = __toESM(require("os"));
25359
- var path52 = __toESM(require("path"));
25481
+ var path53 = __toESM(require("path"));
25360
25482
  var DOLT_INSTALL_SH_URL = "https://github.com/dolthub/dolt/releases/latest/download/install.sh";
25361
25483
  var DOLT_MSI_URL = "https://github.com/dolthub/dolt/releases/latest/download/dolt-windows-amd64.msi";
25362
25484
  function resolveDoltInstallStrategy(platform3) {
@@ -25452,7 +25574,7 @@ var _doltPathSeam = {
25452
25574
  },
25453
25575
  exists: (p2) => {
25454
25576
  try {
25455
- fs44.accessSync(p2, fs44.constants.F_OK);
25577
+ fs45.accessSync(p2, fs45.constants.F_OK);
25456
25578
  return true;
25457
25579
  } catch {
25458
25580
  return false;
@@ -25463,7 +25585,7 @@ function doltBinaryNames(platform3) {
25463
25585
  return platform3 === "win32" ? ["dolt.exe", "dolt.cmd", "dolt"] : ["dolt"];
25464
25586
  }
25465
25587
  function knownDoltDirs(platform3) {
25466
- const P3 = platform3 === "win32" ? path52.win32 : path52.posix;
25588
+ const P3 = platform3 === "win32" ? path53.win32 : path53.posix;
25467
25589
  const home = _doltPathSeam.homedir();
25468
25590
  if (platform3 === "win32") {
25469
25591
  return [
@@ -25479,7 +25601,7 @@ function knownDoltDirs(platform3) {
25479
25601
  ].filter(Boolean);
25480
25602
  }
25481
25603
  function ensureDoltResolvable(platform3 = process.platform) {
25482
- const P3 = platform3 === "win32" ? path52.win32 : path52.posix;
25604
+ const P3 = platform3 === "win32" ? path53.win32 : path53.posix;
25483
25605
  const delim = platform3 === "win32" ? ";" : ":";
25484
25606
  const names = doltBinaryNames(platform3);
25485
25607
  const pathDirs = _doltPathSeam.getPath().split(delim).filter(Boolean);
@@ -25676,14 +25798,14 @@ var _linkSeam = {
25676
25798
  homedir: () => os33.homedir(),
25677
25799
  isWritableDir: (dir) => {
25678
25800
  try {
25679
- fs45.accessSync(dir, fs45.constants.W_OK);
25801
+ fs46.accessSync(dir, fs46.constants.W_OK);
25680
25802
  return true;
25681
25803
  } catch {
25682
25804
  return false;
25683
25805
  }
25684
25806
  },
25685
25807
  ensureDir: (dir) => {
25686
- fs45.mkdirSync(dir, { recursive: true });
25808
+ fs46.mkdirSync(dir, { recursive: true });
25687
25809
  },
25688
25810
  /**
25689
25811
  * A directory to symlink `bd` into so the AGENT's shell + Claude Code's
@@ -25704,9 +25826,9 @@ var _linkSeam = {
25704
25826
  * which `linkBdOntoPath` creates if missing.
25705
25827
  */
25706
25828
  cliBinDir: () => {
25707
- const pathDirs = (process.env.PATH ?? "").split(path53.delimiter).filter(Boolean);
25829
+ const pathDirs = (process.env.PATH ?? "").split(path54.delimiter).filter(Boolean);
25708
25830
  const home = _linkSeam.homedir();
25709
- const localBin = home ? path53.join(home, ".local", "bin") : null;
25831
+ const localBin = home ? path54.join(home, ".local", "bin") : null;
25710
25832
  if (localBin) {
25711
25833
  try {
25712
25834
  _linkSeam.ensureDir(localBin);
@@ -25716,16 +25838,16 @@ var _linkSeam = {
25716
25838
  const candidates = [];
25717
25839
  if (localBin) candidates.push(localBin);
25718
25840
  try {
25719
- candidates.push(path53.dirname(process.execPath));
25841
+ candidates.push(path54.dirname(process.execPath));
25720
25842
  } catch {
25721
25843
  }
25722
25844
  candidates.push("/usr/local/bin");
25723
25845
  const entry = process.argv[1];
25724
25846
  if (entry) {
25725
25847
  try {
25726
- candidates.push(path53.dirname(fs45.realpathSync(entry)));
25848
+ candidates.push(path54.dirname(fs46.realpathSync(entry)));
25727
25849
  } catch {
25728
- candidates.push(path53.dirname(entry));
25850
+ candidates.push(path54.dirname(entry));
25729
25851
  }
25730
25852
  }
25731
25853
  const onPathWritable = candidates.find(
@@ -25737,20 +25859,20 @@ var _linkSeam = {
25737
25859
  /** Current symlink target at `linkPath`, or null when absent / not a link. */
25738
25860
  readlink: (linkPath) => {
25739
25861
  try {
25740
- return fs45.readlinkSync(linkPath);
25862
+ return fs46.readlinkSync(linkPath);
25741
25863
  } catch {
25742
25864
  return null;
25743
25865
  }
25744
25866
  },
25745
- unlink: (linkPath) => fs45.unlinkSync(linkPath),
25746
- symlink: (target, linkPath) => fs45.symlinkSync(target, linkPath)
25867
+ unlink: (linkPath) => fs46.unlinkSync(linkPath),
25868
+ symlink: (target, linkPath) => fs46.symlinkSync(target, linkPath)
25747
25869
  };
25748
25870
  function linkBdOntoPath(binaryPath) {
25749
25871
  if (_linkSeam.platform() === "win32") return;
25750
25872
  const binDir = _linkSeam.cliBinDir();
25751
25873
  if (!binDir) return;
25752
25874
  _linkSeam.ensureDir(binDir);
25753
- const linkPath = path53.join(binDir, "bd");
25875
+ const linkPath = path54.join(binDir, "bd");
25754
25876
  if (linkPath === binaryPath) return;
25755
25877
  const current2 = _linkSeam.readlink(linkPath);
25756
25878
  if (current2 === binaryPath) return;
@@ -25955,7 +26077,7 @@ function dedupeRecipes(agents) {
25955
26077
 
25956
26078
  // src/beads/watcher.ts
25957
26079
  var crypto4 = __toESM(require("crypto"));
25958
- var path54 = __toESM(require("path"));
26080
+ var path55 = __toESM(require("path"));
25959
26081
  var API_BASE5 = resolveApiBaseUrl();
25960
26082
  var DEBOUNCE_MS2 = 400;
25961
26083
  var ZERO_SUMMARY = {
@@ -25979,7 +26101,7 @@ var BeadsWatcher = class {
25979
26101
  constructor(opts) {
25980
26102
  this.opts = opts;
25981
26103
  this.bd = opts.adapter ?? new BdAdapter({ cwd: opts.cwd, beadsDir: opts.beadsDir });
25982
- this.feedPath = opts.feedPath ?? path54.join(opts.cwd ?? process.cwd(), ".beads", "last-touched");
26104
+ this.feedPath = opts.feedPath ?? path55.join(opts.cwd ?? process.cwd(), ".beads", "last-touched");
25983
26105
  this.apiBase = opts.apiBaseUrl ?? API_BASE5;
25984
26106
  }
25985
26107
  opts;
@@ -26554,8 +26676,8 @@ function cleanupAttachmentTempFiles() {
26554
26676
  function saveFilesTemp(files) {
26555
26677
  return files.filter(({ base64 }) => base64 && base64.length > 0).map(({ filename, base64 }) => {
26556
26678
  const safeName = filename.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 80);
26557
- const tmpPath = path58.join(os39.tmpdir(), `codeam-${(0, import_crypto2.randomUUID)()}-${safeName}`);
26558
- fs50.writeFileSync(tmpPath, Buffer.from(base64, "base64"));
26679
+ const tmpPath = path59.join(os39.tmpdir(), `codeam-${(0, import_crypto2.randomUUID)()}-${safeName}`);
26680
+ fs51.writeFileSync(tmpPath, Buffer.from(base64, "base64"));
26559
26681
  pendingAttachmentFiles.add(tmpPath);
26560
26682
  return tmpPath;
26561
26683
  });
@@ -26790,10 +26912,10 @@ var listFiles = async (ctx, cmd, parsed) => {
26790
26912
  await ctx.relay.sendResult(cmd.id, "completed", result);
26791
26913
  };
26792
26914
  var envReadH = async (ctx, cmd) => {
26793
- const envPath = path58.join(process.cwd(), ".env");
26915
+ const envPath = path59.join(process.cwd(), ".env");
26794
26916
  await restoreProjectEnvIfMissing(process.cwd(), ctx);
26795
26917
  try {
26796
- const raw = await fs50.promises.readFile(envPath, "utf8");
26918
+ const raw = await fs51.promises.readFile(envPath, "utf8");
26797
26919
  await ctx.relay.sendResult(cmd.id, "completed", {
26798
26920
  exists: true,
26799
26921
  vars: parseDotenv(raw)
@@ -26822,7 +26944,7 @@ var envParseH = async (ctx, cmd, parsed) => {
26822
26944
  const existing = /* @__PURE__ */ new Map();
26823
26945
  if (!replace) {
26824
26946
  try {
26825
- const raw = await fs50.promises.readFile(path58.join(process.cwd(), ".env"), "utf8");
26947
+ const raw = await fs51.promises.readFile(path59.join(process.cwd(), ".env"), "utf8");
26826
26948
  for (const v of parseDotenv(raw)) existing.set(v.key, v.value);
26827
26949
  } catch {
26828
26950
  }
@@ -26862,15 +26984,15 @@ var envWriteH = async (ctx, cmd, parsed) => {
26862
26984
  }
26863
26985
  seen2.add(v.key);
26864
26986
  }
26865
- const envPath = path58.join(process.cwd(), ".env");
26866
- const tmpPath = path58.join(process.cwd(), ".env.codeam.tmp");
26987
+ const envPath = path59.join(process.cwd(), ".env");
26988
+ const tmpPath = path59.join(process.cwd(), ".env.codeam.tmp");
26867
26989
  try {
26868
- await fs50.promises.writeFile(tmpPath, serializeDotenv(vars), "utf8");
26869
- await fs50.promises.rename(tmpPath, envPath);
26990
+ await fs51.promises.writeFile(tmpPath, serializeDotenv(vars), "utf8");
26991
+ await fs51.promises.rename(tmpPath, envPath);
26870
26992
  await ctx.relay.sendResult(cmd.id, "completed", { ok: true, count: vars.length });
26871
26993
  void syncProjectEnvUp(process.cwd(), ctx);
26872
26994
  } catch (err) {
26873
- await fs50.promises.rm(tmpPath, { force: true }).catch(() => void 0);
26995
+ await fs51.promises.rm(tmpPath, { force: true }).catch(() => void 0);
26874
26996
  await ctx.relay.sendResult(cmd.id, "failed", { error: err.message });
26875
26997
  }
26876
26998
  };
@@ -27202,9 +27324,9 @@ var CLI_UPDATE_MAX_ATTEMPTS = 3;
27202
27324
  function buildNpmInstallInvocation(opts) {
27203
27325
  const entryScript = opts?.entryScript ?? process.argv[1] ?? "";
27204
27326
  const execPath = opts?.execPath ?? process.execPath;
27205
- const exists2 = opts?.existsSync ?? fs50.existsSync;
27327
+ const exists2 = opts?.existsSync ?? fs51.existsSync;
27206
27328
  const platform3 = opts?.platform ?? process.platform;
27207
- const p2 = platform3 === "win32" ? path58.win32 : path58.posix;
27329
+ const p2 = platform3 === "win32" ? path59.win32 : path59.posix;
27208
27330
  const normalized = entryScript.split(/[\\/]/).join("/");
27209
27331
  const marker = "/lib/node_modules/codeam-cli/";
27210
27332
  const markerIdx = normalized.indexOf(marker);
@@ -27226,7 +27348,7 @@ function isPermissionError(stderr) {
27226
27348
  function resolveGlobalNodeModulesDir(opts) {
27227
27349
  const entryScript = opts?.entryScript ?? process.argv[1] ?? "";
27228
27350
  const platform3 = opts?.platform ?? process.platform;
27229
- const p2 = platform3 === "win32" ? path58.win32 : path58.posix;
27351
+ const p2 = platform3 === "win32" ? path59.win32 : path59.posix;
27230
27352
  const marker = "/lib/node_modules/codeam-cli/";
27231
27353
  const markerIdx = entryScript.split(/[\\/]/).join("/").indexOf(marker);
27232
27354
  if (markerIdx <= 0) return null;
@@ -27236,19 +27358,19 @@ function resolveGlobalNodeModulesDir(opts) {
27236
27358
  var STALE_STAGING_AGE_MS = CLI_UPDATE_INSTALL_TIMEOUT_MS;
27237
27359
  function sweepStaleCliStagingDirs(nodeModulesDir, now = Date.now(), deps) {
27238
27360
  if (!nodeModulesDir) return 0;
27239
- const readdirSync12 = deps?.readdirSync ?? fs50.readdirSync;
27240
- const statSync15 = deps?.statSync ?? fs50.statSync;
27241
- const rmSync9 = deps?.rmSync ?? fs50.rmSync;
27361
+ const readdirSync13 = deps?.readdirSync ?? fs51.readdirSync;
27362
+ const statSync15 = deps?.statSync ?? fs51.statSync;
27363
+ const rmSync9 = deps?.rmSync ?? fs51.rmSync;
27242
27364
  let removed = 0;
27243
27365
  let entries;
27244
27366
  try {
27245
- entries = readdirSync12(nodeModulesDir);
27367
+ entries = readdirSync13(nodeModulesDir);
27246
27368
  } catch {
27247
27369
  return 0;
27248
27370
  }
27249
27371
  for (const name of entries) {
27250
27372
  if (!/^\.codeam-cli-/.test(name)) continue;
27251
- const full = path58.join(nodeModulesDir, name);
27373
+ const full = path59.join(nodeModulesDir, name);
27252
27374
  try {
27253
27375
  const st3 = statSync15(full);
27254
27376
  if (now - st3.mtimeMs < STALE_STAGING_AGE_MS) continue;
@@ -27616,15 +27738,19 @@ var emitPreviewEvent = (args2) => {
27616
27738
  var PREVIEW_DETECT_TIMEOUT_MS = 12e4;
27617
27739
  async function runDetectOneShot(generate, timeoutMs = PREVIEW_DETECT_TIMEOUT_MS) {
27618
27740
  let timer;
27741
+ let stderr = "";
27742
+ const onStderr = (chunk) => {
27743
+ stderr = (stderr + chunk).slice(-4e3);
27744
+ };
27619
27745
  const deadline = new Promise((resolve12) => {
27620
- timer = setTimeout(() => resolve12({ raw: null, timedOut: true }), timeoutMs);
27746
+ timer = setTimeout(() => resolve12({ raw: null, timedOut: true, stderr }), timeoutMs);
27621
27747
  timer.unref?.();
27622
27748
  });
27623
- const oneShot = generate(PREVIEW_DETECT_PROMPT, { timeoutMs }).then(
27624
- (raw) => ({ raw, timedOut: false }),
27749
+ const oneShot = generate(PREVIEW_DETECT_PROMPT, { timeoutMs, onStderr }).then(
27750
+ (raw) => ({ raw, timedOut: false, stderr }),
27625
27751
  (err) => {
27626
27752
  log.info("preview", `detect: generateOneShot threw: ${String(err)}`);
27627
- return { raw: null, timedOut: false };
27753
+ return { raw: null, timedOut: false, stderr };
27628
27754
  }
27629
27755
  );
27630
27756
  try {
@@ -27663,7 +27789,7 @@ var requestPreviewDetectH = (ctx) => {
27663
27789
  pluginId: ctx.pluginId,
27664
27790
  pluginAuthToken,
27665
27791
  type: USER_EVENTS.PREVIEW_DETECTION_READY,
27666
- payload: { detection: fromFile }
27792
+ payload: { detection: withScriptCandidates(fromFile) }
27667
27793
  });
27668
27794
  return;
27669
27795
  }
@@ -27675,7 +27801,7 @@ var requestPreviewDetectH = (ctx) => {
27675
27801
  });
27676
27802
  log.info("preview", "detect: invoking generateOneShot");
27677
27803
  const startedAt = Date.now();
27678
- const { raw, timedOut } = await runDetectOneShot(generateOneShot);
27804
+ const { raw, timedOut, stderr } = await runDetectOneShot(generateOneShot);
27679
27805
  const tookMs = Date.now() - startedAt;
27680
27806
  if (timedOut) {
27681
27807
  log.info("preview", `detect: timed out after ${tookMs}ms \u2014 emitting preview_error`);
@@ -27709,7 +27835,7 @@ ${failure?.rawExcerpt ?? ""}`
27709
27835
  stage: "detection",
27710
27836
  // El mensaje sale del diagnostico: decir "JSON invalido" cuando el
27711
27837
  // agente no contesto manda al usuario a mirar un JSON que no existe.
27712
- message: failure?.message ?? "Agent returned invalid JSON. Try again, or add a .codeam/preview.json override."
27838
+ message: (failure?.reason === "no_output" ? describeOneShotAgentError(stderr) : null) ?? failure?.message ?? "Agent returned invalid JSON. Try again, or add a .codeam/preview.json override."
27713
27839
  }
27714
27840
  });
27715
27841
  return;
@@ -27737,10 +27863,19 @@ ${failure?.rawExcerpt ?? ""}`
27737
27863
  pluginId: ctx.pluginId,
27738
27864
  pluginAuthToken,
27739
27865
  type: USER_EVENTS.PREVIEW_DETECTION_READY,
27740
- payload: { detection }
27866
+ payload: { detection: withScriptCandidates(detection) }
27741
27867
  });
27742
27868
  })();
27743
27869
  };
27870
+ function withScriptCandidates(detection) {
27871
+ try {
27872
+ const candidates = listScriptCandidates(process.cwd());
27873
+ return candidates.length > 0 ? { ...detection, candidates } : detection;
27874
+ } catch (err) {
27875
+ log.info("preview", `detect: listing script candidates failed (non-fatal): ${String(err)}`);
27876
+ return detection;
27877
+ }
27878
+ }
27744
27879
  var previewPrewarmStarted = false;
27745
27880
  function makePreviewReaffirm(args2) {
27746
27881
  const token = args2.pluginAuthToken;
@@ -27770,6 +27905,7 @@ function makePreviewReaffirm(args2) {
27770
27905
  function prewarmPreviewDetection(runtime) {
27771
27906
  if (previewPrewarmStarted) return;
27772
27907
  previewPrewarmStarted = true;
27908
+ void prewarmNodeDeps(process.cwd());
27773
27909
  if (typeof runtime.generateOneShot !== "function") return;
27774
27910
  const generateOneShot = runtime.generateOneShot.bind(runtime);
27775
27911
  void (async () => {
@@ -28266,11 +28402,11 @@ function resolveTokenValue(args2) {
28266
28402
  }
28267
28403
  const fileFlag = args2.find((a) => a.startsWith("--token-file="));
28268
28404
  if (fileFlag) {
28269
- const path95 = fileFlag.slice("--token-file=".length);
28405
+ const path96 = fileFlag.slice("--token-file=".length);
28270
28406
  try {
28271
- const content = fs51.readFileSync(path95, "utf8").trim();
28272
- if (content.length === 0) fail(`--token-file ${path95} is empty`);
28273
- rmIfExistsQuiet(path95);
28407
+ const content = fs52.readFileSync(path96, "utf8").trim();
28408
+ if (content.length === 0) fail(`--token-file ${path96} is empty`);
28409
+ rmIfExistsQuiet(path96);
28274
28410
  return content;
28275
28411
  } catch (err) {
28276
28412
  fail(`Could not read --token-file: ${err.message}`);
@@ -28362,12 +28498,12 @@ async function claim(token, pluginId, pluginSecretHash) {
28362
28498
  }
28363
28499
  }
28364
28500
  function pairAutoLockPath() {
28365
- return path59.join(os40.homedir(), ".codeam", "pair-auto.lock");
28501
+ return path60.join(os40.homedir(), ".codeam", "pair-auto.lock");
28366
28502
  }
28367
28503
  var procRoot = "/proc";
28368
28504
  function readProcFile(rel) {
28369
28505
  try {
28370
- return fs51.readFileSync(path59.join(procRoot, rel), "utf8");
28506
+ return fs52.readFileSync(path60.join(procRoot, rel), "utf8");
28371
28507
  } catch {
28372
28508
  return void 0;
28373
28509
  }
@@ -28388,7 +28524,7 @@ function currentBootId() {
28388
28524
  function readLockRecord(lockPath) {
28389
28525
  let raw;
28390
28526
  try {
28391
- raw = fs51.readFileSync(lockPath, "utf8");
28527
+ raw = fs52.readFileSync(lockPath, "utf8");
28392
28528
  } catch {
28393
28529
  return void 0;
28394
28530
  }
@@ -28437,24 +28573,24 @@ function isLiveLockHolder(rec) {
28437
28573
  }
28438
28574
  function releaseOwnLock(lockPath) {
28439
28575
  try {
28440
- if (readLockRecord(lockPath)?.pid === process.pid) fs51.unlinkSync(lockPath);
28576
+ if (readLockRecord(lockPath)?.pid === process.pid) fs52.unlinkSync(lockPath);
28441
28577
  } catch {
28442
28578
  }
28443
28579
  }
28444
28580
  function daemonLockPath(sessionId) {
28445
28581
  const safe = sessionId.replace(/[^a-zA-Z0-9_-]/g, "_");
28446
- return path59.join(os40.homedir(), ".codeam", `daemon-${safe}.lock`);
28582
+ return path60.join(os40.homedir(), ".codeam", `daemon-${safe}.lock`);
28447
28583
  }
28448
28584
  function acquireDaemonLock(sessionId) {
28449
28585
  const lockPath = daemonLockPath(sessionId);
28450
28586
  try {
28451
- fs51.mkdirSync(path59.dirname(lockPath), { recursive: true });
28587
+ fs52.mkdirSync(path60.dirname(lockPath), { recursive: true });
28452
28588
  try {
28453
- fs51.writeFileSync(lockPath, ownLockBody(), { flag: "wx" });
28589
+ fs52.writeFileSync(lockPath, ownLockBody(), { flag: "wx" });
28454
28590
  } catch (e) {
28455
28591
  if (e.code !== "EEXIST") throw e;
28456
28592
  if (isLiveLockHolder(readLockRecord(lockPath))) return false;
28457
- fs51.writeFileSync(lockPath, ownLockBody());
28593
+ fs52.writeFileSync(lockPath, ownLockBody());
28458
28594
  }
28459
28595
  const release3 = () => releaseOwnLock(lockPath);
28460
28596
  process.once("exit", release3);
@@ -28474,13 +28610,13 @@ function acquireDaemonLock(sessionId) {
28474
28610
  function acquireSingletonLock() {
28475
28611
  const lockPath = pairAutoLockPath();
28476
28612
  try {
28477
- fs51.mkdirSync(path59.dirname(lockPath), { recursive: true });
28613
+ fs52.mkdirSync(path60.dirname(lockPath), { recursive: true });
28478
28614
  try {
28479
- fs51.writeFileSync(lockPath, ownLockBody(), { flag: "wx" });
28615
+ fs52.writeFileSync(lockPath, ownLockBody(), { flag: "wx" });
28480
28616
  } catch (e) {
28481
28617
  if (e.code !== "EEXIST") throw e;
28482
28618
  if (isLiveLockHolder(readLockRecord(lockPath))) return false;
28483
- fs51.writeFileSync(lockPath, ownLockBody());
28619
+ fs52.writeFileSync(lockPath, ownLockBody());
28484
28620
  }
28485
28621
  process.once("exit", () => releaseOwnLock(lockPath));
28486
28622
  return true;
@@ -28897,7 +29033,7 @@ var AgentService = class _AgentService {
28897
29033
  };
28898
29034
 
28899
29035
  // src/agents/acp/adapters.ts
28900
- var path60 = __toESM(require("path"));
29036
+ var path61 = __toESM(require("path"));
28901
29037
 
28902
29038
  // src/agents/kimi/installer.ts
28903
29039
  var import_node_child_process19 = require("child_process");
@@ -29017,13 +29153,13 @@ function resolveBin(pkgName, binName) {
29017
29153
  try {
29018
29154
  const manifestPath = require_.resolve(`${pkgName}/package.json`);
29019
29155
  const manifest = require_(`${pkgName}/package.json`);
29020
- const pkgDir = path60.dirname(manifestPath);
29156
+ const pkgDir = path61.dirname(manifestPath);
29021
29157
  const bin = manifest.bin;
29022
29158
  if (!bin) return null;
29023
- if (typeof bin === "string") return path60.resolve(pkgDir, bin);
29159
+ if (typeof bin === "string") return path61.resolve(pkgDir, bin);
29024
29160
  const target = binName ?? Object.keys(bin)[0];
29025
29161
  if (!target || !bin[target]) return null;
29026
- return path60.resolve(pkgDir, bin[target]);
29162
+ return path61.resolve(pkgDir, bin[target]);
29027
29163
  } catch {
29028
29164
  return null;
29029
29165
  }
@@ -29204,29 +29340,29 @@ async function resolveAcpAdapterWithRetry(agent, opts = {}) {
29204
29340
 
29205
29341
  // src/agents/acp/runner.ts
29206
29342
  var import_node_crypto10 = require("crypto");
29207
- var fs68 = __toESM(require("fs"));
29343
+ var fs69 = __toESM(require("fs"));
29208
29344
  var os53 = __toESM(require("os"));
29209
- var path79 = __toESM(require("path"));
29345
+ var path80 = __toESM(require("path"));
29210
29346
 
29211
29347
  // src/lib/provider-routing.ts
29212
- var fs53 = __toESM(require("fs"));
29348
+ var fs54 = __toESM(require("fs"));
29213
29349
  var os42 = __toESM(require("os"));
29214
- var path62 = __toESM(require("path"));
29350
+ var path63 = __toESM(require("path"));
29215
29351
 
29216
29352
  // src/commands/host/house-proxy-config.ts
29217
- var fs52 = __toESM(require("fs"));
29353
+ var fs53 = __toESM(require("fs"));
29218
29354
  var os41 = __toESM(require("os"));
29219
- var path61 = __toESM(require("path"));
29355
+ var path62 = __toESM(require("path"));
29220
29356
  function houseProxyConfigPath() {
29221
- return path61.join(os41.homedir(), ".codeam", "house-proxy.json");
29357
+ return path62.join(os41.homedir(), ".codeam", "house-proxy.json");
29222
29358
  }
29223
29359
  function persistHouseProxyConfig(config) {
29224
29360
  try {
29225
29361
  const file = houseProxyConfigPath();
29226
- fs52.mkdirSync(path61.dirname(file), { recursive: true, mode: 448 });
29362
+ fs53.mkdirSync(path62.dirname(file), { recursive: true, mode: 448 });
29227
29363
  const tmp = `${file}.tmp-${process.pid}`;
29228
- fs52.writeFileSync(tmp, JSON.stringify(config, null, 2), { encoding: "utf8", mode: 384 });
29229
- fs52.renameSync(tmp, file);
29364
+ fs53.writeFileSync(tmp, JSON.stringify(config, null, 2), { encoding: "utf8", mode: 384 });
29365
+ fs53.renameSync(tmp, file);
29230
29366
  restrictToOwner(file);
29231
29367
  } catch (err) {
29232
29368
  log.warn(
@@ -29237,13 +29373,13 @@ function persistHouseProxyConfig(config) {
29237
29373
  }
29238
29374
  function clearHouseProxyConfig() {
29239
29375
  try {
29240
- fs52.rmSync(houseProxyConfigPath(), { force: true });
29376
+ fs53.rmSync(houseProxyConfigPath(), { force: true });
29241
29377
  } catch {
29242
29378
  }
29243
29379
  }
29244
29380
  function readHouseProxyChildEnv() {
29245
29381
  try {
29246
- const raw = fs52.readFileSync(houseProxyConfigPath(), "utf8");
29382
+ const raw = fs53.readFileSync(houseProxyConfigPath(), "utf8");
29247
29383
  const parsed = JSON.parse(raw);
29248
29384
  if (typeof parsed !== "object" || parsed === null) return {};
29249
29385
  const o = parsed;
@@ -29370,14 +29506,14 @@ function redactUrlToOrigin(raw) {
29370
29506
  }
29371
29507
  function readOpencodeProviderOrigins(opts = {}) {
29372
29508
  const home = opts.homeDir ?? os42.homedir();
29373
- const readFile7 = opts.readFile ?? ((f) => fs53.readFileSync(f, "utf8"));
29509
+ const readFile7 = opts.readFile ?? ((f) => fs54.readFileSync(f, "utf8"));
29374
29510
  const candidates = [];
29375
29511
  if (opts.cwd) {
29376
- candidates.push(path62.join(opts.cwd, "opencode.json"), path62.join(opts.cwd, "opencode.jsonc"));
29512
+ candidates.push(path63.join(opts.cwd, "opencode.json"), path63.join(opts.cwd, "opencode.jsonc"));
29377
29513
  }
29378
29514
  candidates.push(
29379
- path62.join(home, ".config", "opencode", "opencode.json"),
29380
- path62.join(home, ".config", "opencode", "opencode.jsonc")
29515
+ path63.join(home, ".config", "opencode", "opencode.json"),
29516
+ path63.join(home, ".config", "opencode", "opencode.jsonc")
29381
29517
  );
29382
29518
  const out2 = [];
29383
29519
  const seen2 = /* @__PURE__ */ new Set();
@@ -29484,8 +29620,8 @@ function noteProviderBillingSignal(opts) {
29484
29620
  }
29485
29621
 
29486
29622
  // src/services/history.service.ts
29487
- var fs54 = __toESM(require("fs"));
29488
- var path63 = __toESM(require("path"));
29623
+ var fs55 = __toESM(require("fs"));
29624
+ var path64 = __toESM(require("path"));
29489
29625
  var os43 = __toESM(require("os"));
29490
29626
  var https6 = __toESM(require("https"));
29491
29627
  var http9 = __toESM(require("http"));
@@ -29547,7 +29683,7 @@ function parseJsonl(filePath) {
29547
29683
  const messages = [];
29548
29684
  let raw;
29549
29685
  try {
29550
- raw = fs54.readFileSync(filePath, "utf8");
29686
+ raw = fs55.readFileSync(filePath, "utf8");
29551
29687
  } catch (err) {
29552
29688
  if (err.code !== "ENOENT") {
29553
29689
  log.warn("history:parseJsonl", `read failed for ${filePath}`, err);
@@ -29701,7 +29837,7 @@ var HistoryService = class _HistoryService {
29701
29837
  return this._quotaPercent === null || Date.now() - this._quotaFetchedAt > ttlMs;
29702
29838
  }
29703
29839
  get projectDir() {
29704
- return this.runtime.resolveHistoryDir(this.cwd) ?? path63.join(os43.homedir(), ".claude", "projects", encodeCwd(this.cwd));
29840
+ return this.runtime.resolveHistoryDir(this.cwd) ?? path64.join(os43.homedir(), ".claude", "projects", encodeCwd(this.cwd));
29705
29841
  }
29706
29842
  /** Set the current Claude conversation ID (extracted from /cost command or session start) */
29707
29843
  setCurrentConversationId(id) {
@@ -29713,7 +29849,7 @@ var HistoryService = class _HistoryService {
29713
29849
  /** Return the current message count in the active conversation. */
29714
29850
  getCurrentMessageCount() {
29715
29851
  if (!this.currentConversationId) return 0;
29716
- const filePath = path63.join(this.projectDir, `${this.currentConversationId}.jsonl`);
29852
+ const filePath = path64.join(this.projectDir, `${this.currentConversationId}.jsonl`);
29717
29853
  return parseJsonl(filePath).length;
29718
29854
  }
29719
29855
  /**
@@ -29724,7 +29860,7 @@ var HistoryService = class _HistoryService {
29724
29860
  const deadline = Date.now() + timeoutMs;
29725
29861
  while (Date.now() < deadline) {
29726
29862
  if (!this.currentConversationId) return null;
29727
- const filePath = path63.join(this.projectDir, `${this.currentConversationId}.jsonl`);
29863
+ const filePath = path64.join(this.projectDir, `${this.currentConversationId}.jsonl`);
29728
29864
  const messages = parseJsonl(filePath);
29729
29865
  if (messages.length > previousCount) {
29730
29866
  for (let i = messages.length - 1; i >= previousCount; i--) {
@@ -29750,16 +29886,16 @@ var HistoryService = class _HistoryService {
29750
29886
  const dir = this.projectDir;
29751
29887
  const cutoff = this.bootTimeMs - _HistoryService.BIRTHTIME_GRACE_MS;
29752
29888
  try {
29753
- const files = fs54.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isFile() && e.name.endsWith(".jsonl")).map((e) => {
29889
+ const files = fs55.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isFile() && e.name.endsWith(".jsonl")).map((e) => {
29754
29890
  try {
29755
- const stat3 = fs54.statSync(path63.join(dir, e.name));
29891
+ const stat3 = fs55.statSync(path64.join(dir, e.name));
29756
29892
  return { name: e.name, mtime: stat3.mtimeMs, birthtime: stat3.birthtimeMs };
29757
29893
  } catch {
29758
29894
  return { name: e.name, mtime: 0, birthtime: 0 };
29759
29895
  }
29760
29896
  }).filter((f) => f.birthtime >= cutoff).sort((a, b) => b.mtime - a.mtime);
29761
29897
  if (files.length > 0) {
29762
- this.currentConversationId = path63.basename(files[0].name, ".jsonl");
29898
+ this.currentConversationId = path64.basename(files[0].name, ".jsonl");
29763
29899
  }
29764
29900
  } catch {
29765
29901
  }
@@ -29793,13 +29929,13 @@ var HistoryService = class _HistoryService {
29793
29929
  const cutoff = this.bootTimeMs - _HistoryService.BIRTHTIME_GRACE_MS;
29794
29930
  let entries;
29795
29931
  try {
29796
- entries = fs54.readdirSync(dir, { withFileTypes: true });
29932
+ entries = fs55.readdirSync(dir, { withFileTypes: true });
29797
29933
  } catch {
29798
29934
  return null;
29799
29935
  }
29800
29936
  const files = entries.filter((e) => e.isFile() && e.name.endsWith(".jsonl")).map((e) => {
29801
29937
  try {
29802
- const stat3 = fs54.statSync(path63.join(dir, e.name));
29938
+ const stat3 = fs55.statSync(path64.join(dir, e.name));
29803
29939
  return { name: e.name, mtime: stat3.mtimeMs, birthtime: stat3.birthtimeMs };
29804
29940
  } catch {
29805
29941
  return { name: e.name, mtime: 0, birthtime: 0 };
@@ -29808,12 +29944,12 @@ var HistoryService = class _HistoryService {
29808
29944
  if (files.length === 0) return null;
29809
29945
  const targetFile = this.currentConversationId ? `${this.currentConversationId}.jsonl` : files[0].name;
29810
29946
  if (!files.some((f) => f.name === targetFile)) return null;
29811
- return this.extractUsageFromFile(path63.join(dir, targetFile));
29947
+ return this.extractUsageFromFile(path64.join(dir, targetFile));
29812
29948
  }
29813
29949
  extractUsageFromFile(filePath) {
29814
29950
  let raw;
29815
29951
  try {
29816
- raw = fs54.readFileSync(filePath, "utf8");
29952
+ raw = fs55.readFileSync(filePath, "utf8");
29817
29953
  } catch {
29818
29954
  return null;
29819
29955
  }
@@ -29865,9 +30001,9 @@ var HistoryService = class _HistoryService {
29865
30001
  let totalCost = 0;
29866
30002
  let files;
29867
30003
  try {
29868
- files = fs54.readdirSync(projectDir).filter((f) => f.endsWith(".jsonl")).filter((f) => {
30004
+ files = fs55.readdirSync(projectDir).filter((f) => f.endsWith(".jsonl")).filter((f) => {
29869
30005
  try {
29870
- return fs54.statSync(path63.join(projectDir, f)).mtimeMs >= monthStartMs;
30006
+ return fs55.statSync(path64.join(projectDir, f)).mtimeMs >= monthStartMs;
29871
30007
  } catch {
29872
30008
  return false;
29873
30009
  }
@@ -29878,7 +30014,7 @@ var HistoryService = class _HistoryService {
29878
30014
  for (const file of files) {
29879
30015
  let raw;
29880
30016
  try {
29881
- raw = fs54.readFileSync(path63.join(projectDir, file), "utf8");
30017
+ raw = fs55.readFileSync(path64.join(projectDir, file), "utf8");
29882
30018
  } catch {
29883
30019
  continue;
29884
30020
  }
@@ -29957,7 +30093,7 @@ var HistoryService = class _HistoryService {
29957
30093
  if (this.runtime.resolveHistoryFile) {
29958
30094
  return this.runtime.resolveHistoryFile(this.cwd, sessionId);
29959
30095
  }
29960
- return path63.join(this.projectDir, `${sessionId}.jsonl`);
30096
+ return path64.join(this.projectDir, `${sessionId}.jsonl`);
29961
30097
  }
29962
30098
  /**
29963
30099
  * Parse a conversation's messages from disk, agent-aware. Claude uses the
@@ -29995,14 +30131,14 @@ var HistoryService = class _HistoryService {
29995
30131
  };
29996
30132
  });
29997
30133
  }
29998
- return parseJsonl(path63.join(this.projectDir, `${sessionId}.jsonl`));
30134
+ return parseJsonl(path64.join(this.projectDir, `${sessionId}.jsonl`));
29999
30135
  }
30000
30136
  /** One in-flight full upload per conversation — the baton mirror and a
30001
30137
  * `get_conversation` used to upload the same transcript concurrently. */
30002
30138
  uploadsInFlight = /* @__PURE__ */ new Map();
30003
30139
  async loadConversation(sessionId) {
30004
- const inFlight = this.uploadsInFlight.get(sessionId);
30005
- if (inFlight) return inFlight;
30140
+ const inFlight2 = this.uploadsInFlight.get(sessionId);
30141
+ if (inFlight2) return inFlight2;
30006
30142
  const run = this.loadConversationNow(sessionId).finally(() => {
30007
30143
  this.uploadsInFlight.delete(sessionId);
30008
30144
  });
@@ -30077,7 +30213,7 @@ var HistoryService = class _HistoryService {
30077
30213
  if (!filePath) return false;
30078
30214
  let mtimeMs;
30079
30215
  try {
30080
- mtimeMs = fs54.statSync(filePath).mtimeMs;
30216
+ mtimeMs = fs55.statSync(filePath).mtimeMs;
30081
30217
  } catch {
30082
30218
  return false;
30083
30219
  }
@@ -30152,10 +30288,10 @@ var HistoryService = class _HistoryService {
30152
30288
 
30153
30289
  // src/agents/acp/client.ts
30154
30290
  var import_node_child_process21 = require("child_process");
30155
- var fs55 = __toESM(require("fs/promises"));
30291
+ var fs56 = __toESM(require("fs/promises"));
30156
30292
  var fsSync = __toESM(require("fs"));
30157
30293
  var os45 = __toESM(require("os"));
30158
- var path65 = __toESM(require("path"));
30294
+ var path66 = __toESM(require("path"));
30159
30295
  var import_node_stream = require("stream");
30160
30296
 
30161
30297
  // ../../node_modules/@agentclientprotocol/sdk/dist/schema/index.js
@@ -34181,7 +34317,7 @@ function createIdleTimeout(idleMs, makeError, activeIdleMs = idleMs) {
34181
34317
  }
34182
34318
 
34183
34319
  // src/agents/acp/internal-paths.ts
34184
- var path64 = __toESM(require("path"));
34320
+ var path65 = __toESM(require("path"));
34185
34321
  var os44 = __toESM(require("os"));
34186
34322
  var INTERNAL_TOKENS = [".codeam", "house-claude"];
34187
34323
  var PROSE_ONLY_TOOL_KINDS = /* @__PURE__ */ new Set(["think", "switch_mode"]);
@@ -34196,11 +34332,11 @@ function textReferencesInternal(text) {
34196
34332
  }
34197
34333
  function pathIsInternal(p2, homeDir2 = os44.homedir()) {
34198
34334
  if (!p2) return false;
34199
- const abs = path64.resolve(p2);
34200
- const home = path64.resolve(homeDir2);
34201
- const within = (root) => abs === root || abs.startsWith(root + path64.sep);
34202
- if (within(path64.join(home, ".codeam", "self-hosted"))) return false;
34203
- return within(path64.join(home, ".codeam")) || within(path64.join(home, ".beads")) || abs === path64.join(home, ".codeam-host.log") || abs.includes(`${path64.sep}house-claude${path64.sep}`) || abs.endsWith(`${path64.sep}house-claude`);
34335
+ const abs = path65.resolve(p2);
34336
+ const home = path65.resolve(homeDir2);
34337
+ const within = (root) => abs === root || abs.startsWith(root + path65.sep);
34338
+ if (within(path65.join(home, ".codeam", "self-hosted"))) return false;
34339
+ return within(path65.join(home, ".codeam")) || within(path65.join(home, ".beads")) || abs === path65.join(home, ".codeam-host.log") || abs.includes(`${path65.sep}house-claude${path65.sep}`) || abs.endsWith(`${path65.sep}house-claude`);
34204
34340
  }
34205
34341
  function toolCallReferencesInternal(call, homeDir2) {
34206
34342
  if (call.locations?.some((l) => pathIsInternal(l.path, homeDir2))) return true;
@@ -35295,7 +35431,7 @@ var AcpClient = class {
35295
35431
  throw new RequestError(-32002, GUARDRAIL_SECRET_READ_BLOCK_REASON, { uri: params.path });
35296
35432
  }
35297
35433
  try {
35298
- const content = await fs55.readFile(params.path, "utf8");
35434
+ const content = await fs56.readFile(params.path, "utf8");
35299
35435
  return applyLineRange(content, params.line ?? null, params.limit ?? null);
35300
35436
  } catch (err) {
35301
35437
  const code = err.code;
@@ -35316,7 +35452,7 @@ var AcpClient = class {
35316
35452
  throw new RequestError(-32002, INTERNAL_BLOCK_REASON, { uri: params.path });
35317
35453
  }
35318
35454
  try {
35319
- await fs55.writeFile(params.path, params.content, "utf8");
35455
+ await fs56.writeFile(params.path, params.content, "utf8");
35320
35456
  return {};
35321
35457
  } catch (err) {
35322
35458
  const code = err.code;
@@ -35409,25 +35545,25 @@ function knownAgentBinaryDirs() {
35409
35545
  out2.push("/tmp/codeam-node20/bin");
35410
35546
  for (const root of [
35411
35547
  "/usr/local/share/nvm/versions/node",
35412
- path65.join(home, ".nvm/versions/node")
35548
+ path66.join(home, ".nvm/versions/node")
35413
35549
  ]) {
35414
35550
  try {
35415
35551
  for (const child of fsSync.readdirSync(root)) {
35416
- out2.push(path65.join(root, child, "bin"));
35552
+ out2.push(path66.join(root, child, "bin"));
35417
35553
  }
35418
35554
  } catch {
35419
35555
  }
35420
35556
  }
35421
- out2.push(path65.join(home, ".volta/bin"));
35557
+ out2.push(path66.join(home, ".volta/bin"));
35422
35558
  out2.push("/usr/local/bin");
35423
35559
  out2.push("/usr/bin");
35424
- out2.push(path65.join(home, ".local/bin"));
35425
- out2.push(path65.join(home, "bin"));
35560
+ out2.push(path66.join(home, ".local/bin"));
35561
+ out2.push(path66.join(home, "bin"));
35426
35562
  out2.push(...agentInstallBinDirs());
35427
35563
  if (process.platform === "win32") {
35428
35564
  const { LOCALAPPDATA, APPDATA } = process.env;
35429
- if (LOCALAPPDATA) out2.push(path65.join(LOCALAPPDATA, "cursor-agent"));
35430
- if (APPDATA) out2.push(path65.join(APPDATA, "npm"));
35565
+ if (LOCALAPPDATA) out2.push(path66.join(LOCALAPPDATA, "cursor-agent"));
35566
+ if (APPDATA) out2.push(path66.join(APPDATA, "npm"));
35431
35567
  }
35432
35568
  return out2.filter((p2) => {
35433
35569
  try {
@@ -35438,7 +35574,7 @@ function knownAgentBinaryDirs() {
35438
35574
  });
35439
35575
  }
35440
35576
  function expandPathForAgentBinaries(existingPath) {
35441
- const existing = new Set(existingPath.split(path65.delimiter).filter((p2) => p2.length > 0));
35577
+ const existing = new Set(existingPath.split(path66.delimiter).filter((p2) => p2.length > 0));
35442
35578
  const additions = [];
35443
35579
  for (const dir of knownAgentBinaryDirs()) {
35444
35580
  if (!existing.has(dir)) {
@@ -35447,7 +35583,7 @@ function expandPathForAgentBinaries(existingPath) {
35447
35583
  }
35448
35584
  }
35449
35585
  if (additions.length === 0) return existingPath;
35450
- return [...additions, existingPath].filter((p2) => p2.length > 0).join(path65.delimiter);
35586
+ return [...additions, existingPath].filter((p2) => p2.length > 0).join(path66.delimiter);
35451
35587
  }
35452
35588
 
35453
35589
  // src/commands/host/agent-install.ts
@@ -35719,9 +35855,9 @@ async function performAgentSwitch(deps, rawAgentId, fastPath = {}) {
35719
35855
  }
35720
35856
 
35721
35857
  // src/commands/host/agent-provisioning.ts
35722
- var fs56 = __toESM(require("fs"));
35858
+ var fs57 = __toESM(require("fs"));
35723
35859
  var os47 = __toESM(require("os"));
35724
- var path66 = __toESM(require("path"));
35860
+ var path67 = __toESM(require("path"));
35725
35861
  var PUBLIC_TO_INTERNAL_AGENT = {
35726
35862
  claude_code: "claude",
35727
35863
  claude: "claude",
@@ -35738,22 +35874,22 @@ function toInternalAgentId(publicAgentId) {
35738
35874
  return PUBLIC_TO_INTERNAL_AGENT[publicAgentId] ?? null;
35739
35875
  }
35740
35876
  function ensureDir(dir) {
35741
- fs56.mkdirSync(dir, { recursive: true, mode: 448 });
35877
+ fs57.mkdirSync(dir, { recursive: true, mode: 448 });
35742
35878
  }
35743
35879
  function writeFile0600(filePath, contents) {
35744
- ensureDir(path66.dirname(filePath));
35745
- fs56.writeFileSync(filePath, contents, { encoding: "utf8", mode: 384 });
35880
+ ensureDir(path67.dirname(filePath));
35881
+ fs57.writeFileSync(filePath, contents, { encoding: "utf8", mode: 384 });
35746
35882
  restrictToOwner(filePath);
35747
35883
  }
35748
35884
  function rmIfExists(filePath) {
35749
35885
  try {
35750
- fs56.rmSync(filePath, { force: true });
35886
+ fs57.rmSync(filePath, { force: true });
35751
35887
  } catch {
35752
35888
  }
35753
35889
  }
35754
35890
  var claudeProvisioner = {
35755
35891
  write(auth, home) {
35756
- const credentialsJson = path66.join(home, ".claude", ".credentials.json");
35892
+ const credentialsJson = path67.join(home, ".claude", ".credentials.json");
35757
35893
  if (auth.kind === "api_key") {
35758
35894
  rmIfExists(credentialsJson);
35759
35895
  return { ANTHROPIC_API_KEY: auth.value };
@@ -35765,8 +35901,8 @@ var claudeProvisioner = {
35765
35901
  } else {
35766
35902
  rmIfExists(credentialsJson);
35767
35903
  }
35768
- const claudeJson = path66.join(home, ".claude.json");
35769
- if (!fs56.existsSync(claudeJson)) {
35904
+ const claudeJson = path67.join(home, ".claude.json");
35905
+ if (!fs57.existsSync(claudeJson)) {
35770
35906
  writeFile0600(
35771
35907
  claudeJson,
35772
35908
  JSON.stringify({ hasCompletedOnboarding: true, customApiKeyResponses: { approved: [] } })
@@ -35777,7 +35913,7 @@ var claudeProvisioner = {
35777
35913
  };
35778
35914
  var codexProvisioner = {
35779
35915
  write(auth, home) {
35780
- const authJson = path66.join(home, ".codex", "auth.json");
35916
+ const authJson = path67.join(home, ".codex", "auth.json");
35781
35917
  if (auth.kind === "api_key") {
35782
35918
  writeFile0600(authJson, JSON.stringify({ auth_mode: "apikey", OPENAI_API_KEY: auth.value }));
35783
35919
  return { OPENAI_API_KEY: auth.value };
@@ -35788,8 +35924,8 @@ var codexProvisioner = {
35788
35924
  };
35789
35925
  var geminiProvisioner = {
35790
35926
  write(auth, home) {
35791
- const settingsJson = path66.join(home, ".gemini", "settings.json");
35792
- const oauthCreds = path66.join(home, ".gemini", "oauth_creds.json");
35927
+ const settingsJson = path67.join(home, ".gemini", "settings.json");
35928
+ const oauthCreds = path67.join(home, ".gemini", "oauth_creds.json");
35793
35929
  if (auth.kind === "api_key") {
35794
35930
  rmIfExists(oauthCreds);
35795
35931
  writeFile0600(settingsJson, '{"security":{"auth":{"selectedType":"gemini-api-key"}}}');
@@ -35802,7 +35938,7 @@ var geminiProvisioner = {
35802
35938
  };
35803
35939
  var cursorProvisioner = {
35804
35940
  write(auth, home) {
35805
- const authJson = path66.join(home, ".config", "cursor", "auth.json");
35941
+ const authJson = path67.join(home, ".config", "cursor", "auth.json");
35806
35942
  if (auth.kind === "api_key") {
35807
35943
  rmIfExists(authJson);
35808
35944
  return { CURSOR_API_KEY: auth.value };
@@ -35844,22 +35980,22 @@ max_context_size = 262144
35844
35980
  var kimiProvisioner = {
35845
35981
  write(auth, home) {
35846
35982
  const credentialsFiles = [
35847
- path66.join(home, ".kimi", "credentials", "kimi-code.json"),
35848
- path66.join(home, ".kimi-code", "credentials", "kimi-code.json")
35983
+ path67.join(home, ".kimi", "credentials", "kimi-code.json"),
35984
+ path67.join(home, ".kimi-code", "credentials", "kimi-code.json")
35849
35985
  ];
35850
35986
  if (auth.kind === "api_key") {
35851
35987
  credentialsFiles.forEach(rmIfExists);
35852
35988
  return { KIMI_API_KEY: auth.value };
35853
35989
  }
35854
35990
  credentialsFiles.forEach((f) => writeFile0600(f, auth.value));
35855
- writeFile0600(path66.join(home, ".kimi-code", "config.toml"), KIMI_MANAGED_CONFIG_TOML);
35991
+ writeFile0600(path67.join(home, ".kimi-code", "config.toml"), KIMI_MANAGED_CONFIG_TOML);
35856
35992
  return {};
35857
35993
  }
35858
35994
  };
35859
35995
  var coderabbitProvisioner = {
35860
35996
  write(auth, home) {
35861
- const dir = path66.join(home, ".coderabbit");
35862
- const authJson = path66.join(dir, "auth.json");
35997
+ const dir = path67.join(home, ".coderabbit");
35998
+ const authJson = path67.join(dir, "auth.json");
35863
35999
  if (auth.kind === "api_key") {
35864
36000
  rmIfExists(authJson);
35865
36001
  return { CODERABBIT_API_KEY: auth.value };
@@ -35871,13 +36007,13 @@ var coderabbitProvisioner = {
35871
36007
  try {
35872
36008
  const parsed = JSON.parse(value);
35873
36009
  if (typeof parsed.file === "string" && typeof parsed.contents === "string") {
35874
- file = path66.basename(parsed.file);
36010
+ file = path67.basename(parsed.file);
35875
36011
  contents = parsed.contents;
35876
36012
  }
35877
36013
  } catch {
35878
36014
  }
35879
36015
  }
35880
- writeFile0600(path66.join(dir, file), contents);
36016
+ writeFile0600(path67.join(dir, file), contents);
35881
36017
  return {};
35882
36018
  }
35883
36019
  };
@@ -35914,16 +36050,16 @@ function provisionAgentCredentials(publicAgentId, auth, homeDir2 = os47.homedir(
35914
36050
  }
35915
36051
 
35916
36052
  // src/beads/workflow-hint.ts
35917
- var fs57 = __toESM(require("fs"));
35918
- var path68 = __toESM(require("path"));
36053
+ var fs58 = __toESM(require("fs"));
36054
+ var path69 = __toESM(require("path"));
35919
36055
 
35920
36056
  // src/agents/claude-memory-file.ts
35921
36057
  var os48 = __toESM(require("os"));
35922
- var path67 = __toESM(require("path"));
36058
+ var path68 = __toESM(require("path"));
35923
36059
  function claudeMemoryFile(homeDir2, env = process.env) {
35924
- if (homeDir2) return path67.join(homeDir2, ".claude", "CLAUDE.md");
36060
+ if (homeDir2) return path68.join(homeDir2, ".claude", "CLAUDE.md");
35925
36061
  const configDir = env.CLAUDE_CONFIG_DIR?.trim();
35926
- return configDir ? path67.join(configDir, "CLAUDE.md") : path67.join(os48.homedir(), ".claude", "CLAUDE.md");
36062
+ return configDir ? path68.join(configDir, "CLAUDE.md") : path68.join(os48.homedir(), ".claude", "CLAUDE.md");
35927
36063
  }
35928
36064
 
35929
36065
  // src/beads/workflow-hint.ts
@@ -35953,11 +36089,11 @@ function ensureBeadsWorkflowHint(homeDir2, file = claudeMemoryFile(homeDir2)) {
35953
36089
  try {
35954
36090
  let existing = "";
35955
36091
  try {
35956
- existing = fs57.readFileSync(file, "utf8");
36092
+ existing = fs58.readFileSync(file, "utf8");
35957
36093
  } catch {
35958
36094
  }
35959
36095
  if (existing.includes(BEADS_HINT)) return;
35960
- fs57.mkdirSync(path68.dirname(file), { recursive: true });
36096
+ fs58.mkdirSync(path69.dirname(file), { recursive: true });
35961
36097
  let next;
35962
36098
  const open = existing.indexOf(BEADS_HINT_MARKER);
35963
36099
  const close = open === -1 ? -1 : existing.indexOf(BEADS_HINT_MARKER, open + BEADS_HINT_MARKER.length);
@@ -35970,40 +36106,40 @@ ${BEADS_HINT}
35970
36106
  ` : `${BEADS_HINT}
35971
36107
  `;
35972
36108
  }
35973
- fs57.writeFileSync(file, next);
36109
+ fs58.writeFileSync(file, next);
35974
36110
  } catch {
35975
36111
  }
35976
36112
  }
35977
36113
 
35978
36114
  // src/agents/agent-standard.ts
35979
- var fs58 = __toESM(require("fs"));
35980
- var path69 = __toESM(require("path"));
36115
+ var fs59 = __toESM(require("fs"));
36116
+ var path70 = __toESM(require("path"));
35981
36117
  var os49 = __toESM(require("os"));
35982
36118
  function ensureAgentStandard(homeDir2, file = claudeMemoryFile(homeDir2)) {
35983
36119
  try {
35984
36120
  let existing = "";
35985
36121
  try {
35986
- existing = fs58.readFileSync(file, "utf8");
36122
+ existing = fs59.readFileSync(file, "utf8");
35987
36123
  } catch {
35988
36124
  }
35989
36125
  if (existing.includes(AGENT_STANDARD_MARKER)) return;
35990
- fs58.mkdirSync(path69.dirname(file), { recursive: true });
36126
+ fs59.mkdirSync(path70.dirname(file), { recursive: true });
35991
36127
  const next = existing.trim() ? `${existing.trimEnd()}
35992
36128
 
35993
36129
  ${AGENT_STANDARD_BLOCK}
35994
36130
  ` : `${AGENT_STANDARD_BLOCK}
35995
36131
  `;
35996
- fs58.writeFileSync(file, next);
36132
+ fs59.writeFileSync(file, next);
35997
36133
  } catch {
35998
36134
  }
35999
36135
  }
36000
36136
  var _agentStandardSeam = {
36001
36137
  isLocalSession: () => isLocalSession(),
36002
- markerPath: (sessionId) => path69.join(os49.homedir(), ".codeam", "agent-standard", `${sessionId}.done`),
36003
- exists: (p2) => fs58.existsSync(p2),
36138
+ markerPath: (sessionId) => path70.join(os49.homedir(), ".codeam", "agent-standard", `${sessionId}.done`),
36139
+ exists: (p2) => fs59.existsSync(p2),
36004
36140
  write: (p2) => {
36005
- fs58.mkdirSync(path69.dirname(p2), { recursive: true });
36006
- fs58.writeFileSync(p2, "");
36141
+ fs59.mkdirSync(path70.dirname(p2), { recursive: true });
36142
+ fs59.writeFileSync(p2, "");
36007
36143
  }
36008
36144
  };
36009
36145
  function isClaude(agent) {
@@ -36696,15 +36832,15 @@ function withholdTrailingPartialFenceMarker(text) {
36696
36832
 
36697
36833
  // src/agents/acp/onboarding.ts
36698
36834
  var import_child_process28 = require("child_process");
36699
- var fs59 = __toESM(require("fs"));
36835
+ var fs60 = __toESM(require("fs"));
36700
36836
  var os50 = __toESM(require("os"));
36701
- var path70 = __toESM(require("path"));
36837
+ var path71 = __toESM(require("path"));
36702
36838
  var _onboardingSeam = {
36703
- markerPath: (sessionId) => path70.join(os50.homedir(), ".codeam", "welcomed", `${sessionId}.done`),
36704
- exists: (p2) => fs59.existsSync(p2),
36839
+ markerPath: (sessionId) => path71.join(os50.homedir(), ".codeam", "welcomed", `${sessionId}.done`),
36840
+ exists: (p2) => fs60.existsSync(p2),
36705
36841
  write: (p2) => {
36706
- fs59.mkdirSync(path70.dirname(p2), { recursive: true });
36707
- fs59.writeFileSync(p2, "");
36842
+ fs60.mkdirSync(path71.dirname(p2), { recursive: true });
36843
+ fs60.writeFileSync(p2, "");
36708
36844
  },
36709
36845
  disabled: () => {
36710
36846
  const v = process.env.CODEAM_ONBOARDING_DISABLED;
@@ -36741,7 +36877,7 @@ function resolveRepoName(cwd) {
36741
36877
  if (name) return name;
36742
36878
  }
36743
36879
  }
36744
- const base = path70.basename(cwd || "");
36880
+ const base = path71.basename(cwd || "");
36745
36881
  if (base && !isUuid(base)) return base;
36746
36882
  return "this project";
36747
36883
  }
@@ -37133,13 +37269,13 @@ var import_crypto4 = require("crypto");
37133
37269
 
37134
37270
  // src/services/turn-files/git-changeset.ts
37135
37271
  var import_child_process29 = require("child_process");
37136
- var fs61 = __toESM(require("fs/promises"));
37137
- var path72 = __toESM(require("path"));
37272
+ var fs62 = __toESM(require("fs/promises"));
37273
+ var path73 = __toESM(require("path"));
37138
37274
 
37139
37275
  // src/services/turn-files/review-ignore.ts
37140
37276
  var import_ignore2 = __toESM(require("ignore"));
37141
- var fs60 = __toESM(require("fs"));
37142
- var path71 = __toESM(require("path"));
37277
+ var fs61 = __toESM(require("fs"));
37278
+ var path72 = __toESM(require("path"));
37143
37279
  var CURATED_REVIEW_IGNORE = [
37144
37280
  // Google Cloud SDK (the incident) — installs a huge python tree.
37145
37281
  "google-cloud-sdk/",
@@ -37178,7 +37314,7 @@ var CURATED_REVIEW_IGNORE = [
37178
37314
  function makeReviewIgnore(repoRoot) {
37179
37315
  const ig = (0, import_ignore2.default)().add(CURATED_REVIEW_IGNORE);
37180
37316
  try {
37181
- const custom = fs60.readFileSync(path71.join(repoRoot, ".codeam", "reviewignore"), "utf8");
37317
+ const custom = fs61.readFileSync(path72.join(repoRoot, ".codeam", "reviewignore"), "utf8");
37182
37318
  ig.add(custom);
37183
37319
  } catch {
37184
37320
  }
@@ -37223,7 +37359,7 @@ async function collectRepoChangeset(opts) {
37223
37359
  let stats;
37224
37360
  if (!truncated && row.fileStatus === "added" && numstatEntry === void 0) {
37225
37361
  const lineCount = await readUntrackedLineCount(
37226
- path72.join(opts.repoRoot, row.filePath)
37362
+ path73.join(opts.repoRoot, row.filePath)
37227
37363
  );
37228
37364
  stats = { added: lineCount, removed: 0 };
37229
37365
  } else {
@@ -37254,7 +37390,7 @@ function readUntrackedLineCount(absPath) {
37254
37390
  }
37255
37391
  async function defaultReadUntrackedLineCount(absPath) {
37256
37392
  try {
37257
- const content = await fs61.readFile(absPath, "utf8");
37393
+ const content = await fs62.readFile(absPath, "utf8");
37258
37394
  let count = 0;
37259
37395
  let pos = -1;
37260
37396
  while ((pos = content.indexOf("\n", pos + 1)) !== -1) {
@@ -37346,7 +37482,7 @@ function defaultRunGit(cwd, args2) {
37346
37482
  });
37347
37483
  }
37348
37484
  async function discoverRepos(workingDir, maxDepth = 4) {
37349
- const fs80 = await import("fs/promises");
37485
+ const fs81 = await import("fs/promises");
37350
37486
  const out2 = [];
37351
37487
  await walk(workingDir, 0);
37352
37488
  return out2;
@@ -37354,7 +37490,7 @@ async function discoverRepos(workingDir, maxDepth = 4) {
37354
37490
  if (depth > maxDepth) return;
37355
37491
  let entries = [];
37356
37492
  try {
37357
- const dirents = await fs80.readdir(dir, { withFileTypes: true });
37493
+ const dirents = await fs81.readdir(dir, { withFileTypes: true });
37358
37494
  entries = dirents.filter((d3) => !d3.name.startsWith(".") || d3.name === ".git").map((d3) => ({ name: d3.name, isDirectory: d3.isDirectory() }));
37359
37495
  } catch {
37360
37496
  return;
@@ -37365,8 +37501,8 @@ async function discoverRepos(workingDir, maxDepth = 4) {
37365
37501
  if (hasGit) {
37366
37502
  out2.push({
37367
37503
  repoRoot: dir,
37368
- repoPath: path72.relative(workingDir, dir),
37369
- repoName: path72.basename(dir)
37504
+ repoPath: path73.relative(workingDir, dir),
37505
+ repoName: path73.basename(dir)
37370
37506
  });
37371
37507
  return;
37372
37508
  }
@@ -37374,14 +37510,14 @@ async function discoverRepos(workingDir, maxDepth = 4) {
37374
37510
  if (!entry.isDirectory) continue;
37375
37511
  if (entry.name === "node_modules") continue;
37376
37512
  if (entry.name === "dist" || entry.name === "build") continue;
37377
- await walk(path72.join(dir, entry.name), depth + 1);
37513
+ await walk(path73.join(dir, entry.name), depth + 1);
37378
37514
  }
37379
37515
  }
37380
37516
  }
37381
37517
 
37382
37518
  // src/services/turn-files/files-outbox.ts
37383
- var fs62 = __toESM(require("fs/promises"));
37384
- var path73 = __toESM(require("path"));
37519
+ var fs63 = __toESM(require("fs/promises"));
37520
+ var path74 = __toESM(require("path"));
37385
37521
  var import_os12 = require("os");
37386
37522
  var HOME_OUTBOX_DIR = ".codeam/outbox";
37387
37523
  var MAX_AGE_MS = 24 * 60 * 60 * 1e3;
@@ -37414,16 +37550,16 @@ var FilesOutbox = class {
37414
37550
  backoffIndex = 0;
37415
37551
  stopped = false;
37416
37552
  constructor(opts) {
37417
- const base = opts.baseDir ?? path73.join(homeDir(), HOME_OUTBOX_DIR);
37418
- this.filePath = path73.join(base, `${opts.sessionId}.jsonl`);
37553
+ const base = opts.baseDir ?? path74.join(homeDir(), HOME_OUTBOX_DIR);
37554
+ this.filePath = path74.join(base, `${opts.sessionId}.jsonl`);
37419
37555
  this.post = opts.post;
37420
37556
  this.autoSchedule = opts.autoSchedule !== false;
37421
37557
  }
37422
37558
  /** Persist the entry to disk and trigger a flush. Returns once the
37423
37559
  * line is durable on disk (not once the POST succeeds). */
37424
37560
  async enqueue(entry) {
37425
- await fs62.mkdir(path73.dirname(this.filePath), { recursive: true });
37426
- await fs62.appendFile(this.filePath, JSON.stringify(entry) + "\n", "utf8");
37561
+ await fs63.mkdir(path74.dirname(this.filePath), { recursive: true });
37562
+ await fs63.appendFile(this.filePath, JSON.stringify(entry) + "\n", "utf8");
37427
37563
  this.backoffIndex = 0;
37428
37564
  if (this.autoSchedule) this.scheduleFlush(0);
37429
37565
  }
@@ -37514,7 +37650,7 @@ var FilesOutbox = class {
37514
37650
  async readAll() {
37515
37651
  let raw = "";
37516
37652
  try {
37517
- raw = await fs62.readFile(this.filePath, "utf8");
37653
+ raw = await fs63.readFile(this.filePath, "utf8");
37518
37654
  } catch {
37519
37655
  return [];
37520
37656
  }
@@ -37538,12 +37674,12 @@ var FilesOutbox = class {
37538
37674
  async rewrite(entries) {
37539
37675
  const tmpPath = `${this.filePath}.${process.pid}.tmp`;
37540
37676
  if (entries.length === 0) {
37541
- await fs62.unlink(this.filePath).catch(() => void 0);
37677
+ await fs63.unlink(this.filePath).catch(() => void 0);
37542
37678
  return;
37543
37679
  }
37544
37680
  const payload = entries.map((e) => JSON.stringify(e)).join("\n") + "\n";
37545
- await fs62.writeFile(tmpPath, payload, "utf8");
37546
- await fs62.rename(tmpPath, this.filePath);
37681
+ await fs63.writeFile(tmpPath, payload, "utf8");
37682
+ await fs63.rename(tmpPath, this.filePath);
37547
37683
  }
37548
37684
  };
37549
37685
  function applyJitter(ms) {
@@ -38091,8 +38227,8 @@ async function postCredentialSync(opts, fetchImpl = fetch) {
38091
38227
 
38092
38228
  // src/packs/gates.ts
38093
38229
  var import_node_child_process22 = require("child_process");
38094
- var fs63 = __toESM(require("fs"));
38095
- var path74 = __toESM(require("path"));
38230
+ var fs64 = __toESM(require("fs"));
38231
+ var path75 = __toESM(require("path"));
38096
38232
  var defaultCommandRunner = (file, args2, cwd, timeoutMs, env) => new Promise((resolve12) => {
38097
38233
  (0, import_node_child_process22.execFile)(
38098
38234
  file,
@@ -38142,7 +38278,7 @@ async function changedFiles(run, cwd, from, to) {
38142
38278
  }
38143
38279
  function readWorkspaceFile(cwd, relPath) {
38144
38280
  try {
38145
- return fs63.readFileSync(path74.join(cwd, relPath), "utf8");
38281
+ return fs64.readFileSync(path75.join(cwd, relPath), "utf8");
38146
38282
  } catch {
38147
38283
  return null;
38148
38284
  }
@@ -38151,14 +38287,14 @@ var NO_TEST_PLACEHOLDER = 'echo "Error: no test specified"';
38151
38287
  var CHECKS_TIMEOUT_MS = 5 * 6e4;
38152
38288
  function detectChecksCommand(cwd) {
38153
38289
  try {
38154
- const cfg = JSON.parse(fs63.readFileSync(path74.join(cwd, ".codeam", "pack.json"), "utf8"));
38290
+ const cfg = JSON.parse(fs64.readFileSync(path75.join(cwd, ".codeam", "pack.json"), "utf8"));
38155
38291
  if (typeof cfg.checksCommand === "string" && cfg.checksCommand.trim().length > 0) {
38156
38292
  return cfg.checksCommand.trim();
38157
38293
  }
38158
38294
  } catch {
38159
38295
  }
38160
38296
  try {
38161
- const pkg = JSON.parse(fs63.readFileSync(path74.join(cwd, "package.json"), "utf8"));
38297
+ const pkg = JSON.parse(fs64.readFileSync(path75.join(cwd, "package.json"), "utf8"));
38162
38298
  const test = pkg.scripts?.test;
38163
38299
  if (typeof test === "string" && test.trim().length > 0 && !test.includes(NO_TEST_PLACEHOLDER)) {
38164
38300
  return "npm test";
@@ -38176,39 +38312,39 @@ ${res.stderr}`.trim();
38176
38312
  }
38177
38313
 
38178
38314
  // src/packs/run-store.ts
38179
- var fs64 = __toESM(require("fs"));
38180
- var path75 = __toESM(require("path"));
38315
+ var fs65 = __toESM(require("fs"));
38316
+ var path76 = __toESM(require("path"));
38181
38317
  var crypto5 = __toESM(require("crypto"));
38182
38318
  function packsDir(cwd) {
38183
- return path75.join(cwd, ".codeam", "packs");
38319
+ return path76.join(cwd, ".codeam", "packs");
38184
38320
  }
38185
38321
  function runDir(cwd, runId) {
38186
- return path75.join(packsDir(cwd), runId);
38322
+ return path76.join(packsDir(cwd), runId);
38187
38323
  }
38188
38324
  function newRunId() {
38189
38325
  return `pk_${Date.now().toString(36)}_${crypto5.randomBytes(4).toString("hex")}`;
38190
38326
  }
38191
38327
  function writeJsonAtomic(file, value) {
38192
- fs64.mkdirSync(path75.dirname(file), { recursive: true });
38328
+ fs65.mkdirSync(path76.dirname(file), { recursive: true });
38193
38329
  const tmp = `${file}.tmp`;
38194
- fs64.writeFileSync(tmp, JSON.stringify(value, null, 2));
38195
- fs64.renameSync(tmp, file);
38330
+ fs65.writeFileSync(tmp, JSON.stringify(value, null, 2));
38331
+ fs65.renameSync(tmp, file);
38196
38332
  }
38197
38333
  function saveRun(cwd, state) {
38198
- writeJsonAtomic(path75.join(runDir(cwd, state.runId), "run.json"), state);
38334
+ writeJsonAtomic(path76.join(runDir(cwd, state.runId), "run.json"), state);
38199
38335
  }
38200
38336
  function saveStageHandoff(cwd, runId, stageIndex, role, handoff) {
38201
38337
  const name = `${String(stageIndex + 1).padStart(2, "0")}-${role}.json`;
38202
- writeJsonAtomic(path75.join(runDir(cwd, runId), name), handoff);
38338
+ writeJsonAtomic(path76.join(runDir(cwd, runId), name), handoff);
38203
38339
  }
38204
38340
  function loadLatestRun(cwd) {
38205
38341
  try {
38206
38342
  const dir = packsDir(cwd);
38207
- const entries = fs64.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name).sort();
38343
+ const entries = fs65.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name).sort();
38208
38344
  for (let i = entries.length - 1; i >= 0; i--) {
38209
- const file = path75.join(dir, entries[i], "run.json");
38345
+ const file = path76.join(dir, entries[i], "run.json");
38210
38346
  try {
38211
- const parsed = JSON.parse(fs64.readFileSync(file, "utf8"));
38347
+ const parsed = JSON.parse(fs65.readFileSync(file, "utf8"));
38212
38348
  if (parsed && typeof parsed.runId === "string") return parsed;
38213
38349
  } catch {
38214
38350
  }
@@ -38219,17 +38355,17 @@ function loadLatestRun(cwd) {
38219
38355
  }
38220
38356
  function ensureLedgerIgnored(cwd) {
38221
38357
  try {
38222
- const gitDir = path75.join(cwd, ".git");
38223
- if (!fs64.existsSync(gitDir)) return;
38224
- const exclude = path75.join(gitDir, "info", "exclude");
38358
+ const gitDir = path76.join(cwd, ".git");
38359
+ if (!fs65.existsSync(gitDir)) return;
38360
+ const exclude = path76.join(gitDir, "info", "exclude");
38225
38361
  let existing = "";
38226
38362
  try {
38227
- existing = fs64.readFileSync(exclude, "utf8");
38363
+ existing = fs65.readFileSync(exclude, "utf8");
38228
38364
  } catch {
38229
38365
  }
38230
38366
  if (existing.includes(".codeam/packs/")) return;
38231
- fs64.mkdirSync(path75.dirname(exclude), { recursive: true });
38232
- fs64.writeFileSync(exclude, `${existing.trimEnd()}
38367
+ fs65.mkdirSync(path76.dirname(exclude), { recursive: true });
38368
+ fs65.writeFileSync(exclude, `${existing.trimEnd()}
38233
38369
  .codeam/packs/
38234
38370
  `.trimStart());
38235
38371
  } catch {
@@ -41706,17 +41842,17 @@ async function runAcpSession(opts) {
41706
41842
  switchCredentialEnv = provisionAgentCredentials(agentId, auth);
41707
41843
  },
41708
41844
  provisionHouseProxy: ({ baseUrl, token, model, managedAgentId }) => {
41709
- const claudeConfigDir = path79.join(
41845
+ const claudeConfigDir = path80.join(
41710
41846
  os53.homedir(),
41711
41847
  ".codeam",
41712
41848
  "house-claude",
41713
41849
  `switch-${opts.pluginId}`
41714
41850
  );
41715
41851
  try {
41716
- fs68.mkdirSync(claudeConfigDir, { recursive: true, mode: 448 });
41852
+ fs69.mkdirSync(claudeConfigDir, { recursive: true, mode: 448 });
41717
41853
  } catch {
41718
41854
  }
41719
- const memoryFile = path79.join(claudeConfigDir, "CLAUDE.md");
41855
+ const memoryFile = path80.join(claudeConfigDir, "CLAUDE.md");
41720
41856
  ensureBeadsWorkflowHint(void 0, memoryFile);
41721
41857
  ensureAgentStandard(void 0, memoryFile);
41722
41858
  const cfg = {
@@ -42939,8 +43075,8 @@ function pickPinnedSession(pinnedId, listSessions2) {
42939
43075
  }
42940
43076
 
42941
43077
  // src/agents/retired-proxy-cleanup.ts
42942
- var fs69 = __toESM(require("fs"));
42943
- var path80 = __toESM(require("path"));
43078
+ var fs70 = __toESM(require("fs"));
43079
+ var path81 = __toESM(require("path"));
42944
43080
  var os54 = __toESM(require("os"));
42945
43081
  var RETIRED_PROXY_RE = /^https?:\/\/(?:127\.0\.0\.1|localhost|\[::1\]):8787(?:[/?#]|$)/i;
42946
43082
  var HEADROOM_CMD_RE = /(^|[\s/"'])headroom(\s|$)/i;
@@ -42952,10 +43088,10 @@ function isHeadroomHook(group) {
42952
43088
  }
42953
43089
  function sanitizeRetiredProxyConfig(homeDir2 = os54.homedir()) {
42954
43090
  const out2 = { inspected: false, changed: false, removed: [] };
42955
- const file = path80.join(homeDir2, ".claude", "settings.json");
43091
+ const file = path81.join(homeDir2, ".claude", "settings.json");
42956
43092
  let parsed;
42957
43093
  try {
42958
- parsed = JSON.parse(fs69.readFileSync(file, "utf8"));
43094
+ parsed = JSON.parse(fs70.readFileSync(file, "utf8"));
42959
43095
  } catch {
42960
43096
  return out2;
42961
43097
  }
@@ -42997,9 +43133,9 @@ function sanitizeRetiredProxyConfig(homeDir2 = os54.homedir()) {
42997
43133
  if (!out2.changed) return out2;
42998
43134
  try {
42999
43135
  const tmp = `${file}.codeam.tmp`;
43000
- fs69.writeFileSync(tmp, `${JSON.stringify(parsed, null, 2)}
43136
+ fs70.writeFileSync(tmp, `${JSON.stringify(parsed, null, 2)}
43001
43137
  `, { mode: 384 });
43002
- fs69.renameSync(tmp, file);
43138
+ fs70.renameSync(tmp, file);
43003
43139
  } catch {
43004
43140
  out2.changed = false;
43005
43141
  }
@@ -43531,7 +43667,7 @@ var AcpDriver = class {
43531
43667
  };
43532
43668
 
43533
43669
  // src/baton/transcript-mirror.ts
43534
- var fs70 = __toESM(require("fs"));
43670
+ var fs71 = __toESM(require("fs"));
43535
43671
  var TranscriptMirror = class {
43536
43672
  constructor(deps) {
43537
43673
  this.deps = deps;
@@ -43625,7 +43761,7 @@ var TranscriptMirror = class {
43625
43761
  }
43626
43762
  };
43627
43763
  function defaultWatch(file, onChange) {
43628
- const w3 = fs70.watch(file, { persistent: false }, () => onChange());
43764
+ const w3 = fs71.watch(file, { persistent: false }, () => onChange());
43629
43765
  return () => w3.close();
43630
43766
  }
43631
43767
 
@@ -43971,16 +44107,16 @@ function keepDeviceAwake(deps = {}) {
43971
44107
  }
43972
44108
 
43973
44109
  // src/agents/claude/onboarding.ts
43974
- var fs71 = __toESM(require("fs"));
44110
+ var fs72 = __toESM(require("fs"));
43975
44111
  var os56 = __toESM(require("os"));
43976
- var path81 = __toESM(require("path"));
44112
+ var path82 = __toESM(require("path"));
43977
44113
  var ONBOARDING_VERSION_SENTINEL = "9999.0.0";
43978
44114
  function ensureClaudeOnboarded(cwd) {
43979
44115
  try {
43980
- const file = path81.join(os56.homedir(), ".claude.json");
44116
+ const file = path82.join(os56.homedir(), ".claude.json");
43981
44117
  let config = {};
43982
44118
  try {
43983
- config = JSON.parse(fs71.readFileSync(file, "utf8"));
44119
+ config = JSON.parse(fs72.readFileSync(file, "utf8"));
43984
44120
  } catch {
43985
44121
  }
43986
44122
  let changed = false;
@@ -44005,8 +44141,8 @@ function ensureClaudeOnboarded(cwd) {
44005
44141
  }
44006
44142
  }
44007
44143
  if (!changed) return;
44008
- fs71.mkdirSync(path81.dirname(file), { recursive: true });
44009
- fs71.writeFileSync(file, JSON.stringify(config, null, 2));
44144
+ fs72.mkdirSync(path82.dirname(file), { recursive: true });
44145
+ fs72.writeFileSync(file, JSON.stringify(config, null, 2));
44010
44146
  log.info(
44011
44147
  "claude",
44012
44148
  `pre-completed Claude onboarding${cwd ? ` + trusted workspace ${cwd}` : ""}`
@@ -44775,7 +44911,7 @@ var import_picocolors10 = __toESM(require("picocolors"));
44775
44911
  var import_child_process30 = require("child_process");
44776
44912
  var import_util4 = require("util");
44777
44913
  var import_picocolors8 = __toESM(require("picocolors"));
44778
- var path82 = __toESM(require("path"));
44914
+ var path83 = __toESM(require("path"));
44779
44915
  var execFileP5 = (0, import_util4.promisify)(import_child_process30.execFile);
44780
44916
  var MAX_BUFFER = 8 * 1024 * 1024;
44781
44917
  function resetStdinForChild() {
@@ -45264,7 +45400,7 @@ var GitHubCodespacesProvider = class {
45264
45400
  });
45265
45401
  }
45266
45402
  async uploadFile(workspaceId, remotePath, contents, options = {}) {
45267
- const remoteDir = path82.posix.dirname(remotePath);
45403
+ const remoteDir = path83.posix.dirname(remotePath);
45268
45404
  const parts = [
45269
45405
  `mkdir -p ${shellQuote(remoteDir)}`,
45270
45406
  `cat > ${shellQuote(remotePath)}`
@@ -45334,7 +45470,7 @@ function shellQuote(s) {
45334
45470
  // src/services/providers/gitpod.ts
45335
45471
  var import_child_process31 = require("child_process");
45336
45472
  var import_util5 = require("util");
45337
- var path83 = __toESM(require("path"));
45473
+ var path84 = __toESM(require("path"));
45338
45474
  var import_picocolors9 = __toESM(require("picocolors"));
45339
45475
  var execFileP6 = (0, import_util5.promisify)(import_child_process31.execFile);
45340
45476
  var MAX_BUFFER2 = 8 * 1024 * 1024;
@@ -45574,7 +45710,7 @@ var GitpodProvider = class {
45574
45710
  });
45575
45711
  }
45576
45712
  async uploadFile(workspaceId, remotePath, contents, options = {}) {
45577
- const remoteDir = path83.posix.dirname(remotePath);
45713
+ const remoteDir = path84.posix.dirname(remotePath);
45578
45714
  const parts = [
45579
45715
  `mkdir -p ${shellQuote2(remoteDir)}`,
45580
45716
  `cat > ${shellQuote2(remotePath)}`
@@ -45610,7 +45746,7 @@ function shellQuote2(s) {
45610
45746
  // src/services/providers/gitlab-workspaces.ts
45611
45747
  var import_child_process32 = require("child_process");
45612
45748
  var import_util6 = require("util");
45613
- var path84 = __toESM(require("path"));
45749
+ var path85 = __toESM(require("path"));
45614
45750
  var execFileP7 = (0, import_util6.promisify)(import_child_process32.execFile);
45615
45751
  var MAX_BUFFER3 = 8 * 1024 * 1024;
45616
45752
  var GITLAB_API_BASE = process.env.CODEAM_GITLAB_API_URL ?? "https://gitlab.com/api/v4";
@@ -45870,7 +46006,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
45870
46006
  }
45871
46007
  async uploadFile(workspaceId, remotePath, contents, options = {}) {
45872
46008
  const sshHost = process.env.CODEAM_GITLAB_SSH_HOST ?? "workspaces.gitlab.com";
45873
- const remoteDir = path84.posix.dirname(remotePath);
46009
+ const remoteDir = path85.posix.dirname(remotePath);
45874
46010
  const parts = [`mkdir -p ${shellQuote3(remoteDir)}`, `cat > ${shellQuote3(remotePath)}`];
45875
46011
  if (options.mode != null) {
45876
46012
  parts.push(`chmod ${options.mode.toString(8)} ${shellQuote3(remotePath)}`);
@@ -45938,7 +46074,7 @@ function shellQuote3(s) {
45938
46074
  // src/services/providers/railway.ts
45939
46075
  var import_child_process33 = require("child_process");
45940
46076
  var import_util7 = require("util");
45941
- var path85 = __toESM(require("path"));
46077
+ var path86 = __toESM(require("path"));
45942
46078
  var execFileP8 = (0, import_util7.promisify)(import_child_process33.execFile);
45943
46079
  var MAX_BUFFER4 = 8 * 1024 * 1024;
45944
46080
  function resetStdinForChild4() {
@@ -46174,7 +46310,7 @@ var RailwayProvider = class {
46174
46310
  if (!projectId || !serviceId) {
46175
46311
  throw new Error("Invalid Railway workspace id (expected projectId/serviceId).");
46176
46312
  }
46177
- const remoteDir = path85.posix.dirname(remotePath);
46313
+ const remoteDir = path86.posix.dirname(remotePath);
46178
46314
  const parts = [`mkdir -p ${shellQuote4(remoteDir)}`, `cat > ${shellQuote4(remotePath)}`];
46179
46315
  if (options.mode != null) {
46180
46316
  parts.push(`chmod ${options.mode.toString(8)} ${shellQuote4(remotePath)}`);
@@ -46714,9 +46850,9 @@ async function stopWorkspaceFromLocal(target) {
46714
46850
  }
46715
46851
 
46716
46852
  // src/commands/host/host-client.ts
46717
- var fs72 = __toESM(require("fs"));
46853
+ var fs73 = __toESM(require("fs"));
46718
46854
  var os57 = __toESM(require("os"));
46719
- var path86 = __toESM(require("path"));
46855
+ var path87 = __toESM(require("path"));
46720
46856
  var import_node_crypto11 = require("crypto");
46721
46857
  function sampleCpuTimes() {
46722
46858
  let idle = 0;
@@ -46764,7 +46900,7 @@ function apiBase() {
46764
46900
  return process.env.CODEAM_API_URL ?? resolveApiBaseUrl();
46765
46901
  }
46766
46902
  function hostIdentityPath() {
46767
- return path86.join(os57.homedir(), ".codeam", "host-agent.json");
46903
+ return path87.join(os57.homedir(), ".codeam", "host-agent.json");
46768
46904
  }
46769
46905
  function collectOsInfo() {
46770
46906
  return {
@@ -46776,7 +46912,7 @@ function collectOsInfo() {
46776
46912
  }
46777
46913
  function loadHostIdentity() {
46778
46914
  try {
46779
- const raw = fs72.readFileSync(hostIdentityPath(), "utf8");
46915
+ const raw = fs73.readFileSync(hostIdentityPath(), "utf8");
46780
46916
  const parsed = JSON.parse(raw);
46781
46917
  if (typeof parsed === "object" && parsed !== null && typeof parsed.hostId === "string" && typeof parsed.hostToken === "string" && typeof parsed.controlPluginId === "string") {
46782
46918
  const p2 = parsed;
@@ -46795,8 +46931,8 @@ function loadHostIdentity() {
46795
46931
  }
46796
46932
  function saveHostIdentity(identity) {
46797
46933
  const file = hostIdentityPath();
46798
- fs72.mkdirSync(path86.dirname(file), { recursive: true, mode: 448 });
46799
- fs72.writeFileSync(file, JSON.stringify(identity, null, 2), {
46934
+ fs73.mkdirSync(path87.dirname(file), { recursive: true, mode: 448 });
46935
+ fs73.writeFileSync(file, JSON.stringify(identity, null, 2), {
46800
46936
  encoding: "utf8",
46801
46937
  mode: 384
46802
46938
  });
@@ -46841,7 +46977,7 @@ function isTerminalEnrollError(err) {
46841
46977
  }
46842
46978
  function deleteHostIdentity() {
46843
46979
  try {
46844
- fs72.rmSync(hostIdentityPath(), { force: true });
46980
+ fs73.rmSync(hostIdentityPath(), { force: true });
46845
46981
  } catch {
46846
46982
  }
46847
46983
  }
@@ -47055,8 +47191,8 @@ async function host(args2) {
47055
47191
  // src/commands/host-agent.ts
47056
47192
  var import_node_child_process30 = require("child_process");
47057
47193
  var os62 = __toESM(require("os"));
47058
- var fs77 = __toESM(require("fs"));
47059
- var path91 = __toESM(require("path"));
47194
+ var fs78 = __toESM(require("fs"));
47195
+ var path92 = __toESM(require("path"));
47060
47196
 
47061
47197
  // src/skills/persist-from-payload.ts
47062
47198
  function persistOrClearSkillsFromPayload(skills) {
@@ -47065,13 +47201,13 @@ function persistOrClearSkillsFromPayload(skills) {
47065
47201
  }
47066
47202
 
47067
47203
  // src/commands/host/session-state.ts
47068
- var fs73 = __toESM(require("fs"));
47204
+ var fs74 = __toESM(require("fs"));
47069
47205
  var os58 = __toESM(require("os"));
47070
- var path87 = __toESM(require("path"));
47206
+ var path88 = __toESM(require("path"));
47071
47207
  function hostSessionStatePath(env = process.env) {
47072
47208
  const override = env.CODEAM_HOST_SESSION_STATE_FILE;
47073
47209
  if (override && override.trim()) return override.trim();
47074
- return path87.join(os58.homedir(), ".codeam", "host-agent-sessions.json");
47210
+ return path88.join(os58.homedir(), ".codeam", "host-agent-sessions.json");
47075
47211
  }
47076
47212
  function isRecord5(v) {
47077
47213
  if (typeof v !== "object" || v === null) return false;
@@ -47082,7 +47218,7 @@ function fileSessionChildStore(file = hostSessionStatePath()) {
47082
47218
  return {
47083
47219
  load() {
47084
47220
  try {
47085
- const raw = JSON.parse(fs73.readFileSync(file, "utf8"));
47221
+ const raw = JSON.parse(fs74.readFileSync(file, "utf8"));
47086
47222
  return Array.isArray(raw?.sessions) ? raw.sessions.filter(isRecord5) : [];
47087
47223
  } catch {
47088
47224
  return [];
@@ -47090,18 +47226,18 @@ function fileSessionChildStore(file = hostSessionStatePath()) {
47090
47226
  },
47091
47227
  save(list) {
47092
47228
  try {
47093
- fs73.mkdirSync(path87.dirname(file), { recursive: true, mode: 448 });
47229
+ fs74.mkdirSync(path88.dirname(file), { recursive: true, mode: 448 });
47094
47230
  const tmp = `${file}.${process.pid}.tmp`;
47095
- fs73.writeFileSync(tmp, JSON.stringify({ version: 1, sessions: list }, null, 2), {
47231
+ fs74.writeFileSync(tmp, JSON.stringify({ version: 1, sessions: list }, null, 2), {
47096
47232
  mode: 384
47097
47233
  });
47098
- fs73.renameSync(tmp, file);
47234
+ fs74.renameSync(tmp, file);
47099
47235
  } catch {
47100
47236
  }
47101
47237
  },
47102
47238
  clear() {
47103
47239
  try {
47104
- fs73.rmSync(file, { force: true });
47240
+ fs74.rmSync(file, { force: true });
47105
47241
  } catch {
47106
47242
  }
47107
47243
  }
@@ -47124,9 +47260,9 @@ function planSessionResume(records, max) {
47124
47260
  return { resume: ordered.slice(0, bound), dropped: ordered.slice(bound) };
47125
47261
  }
47126
47262
  function pickSavedSessionForWorkspace(sessions3, cwd) {
47127
- const target = path87.resolve(cwd);
47263
+ const target = path88.resolve(cwd);
47128
47264
  const matches = sessions3.filter(
47129
- (s) => !!s.cwd && path87.resolve(s.cwd) === target && !!s.pluginId && !!s.pollSecret && !!s.agent
47265
+ (s) => !!s.cwd && path88.resolve(s.cwd) === target && !!s.pluginId && !!s.pollSecret && !!s.agent
47130
47266
  );
47131
47267
  if (matches.length === 0) return null;
47132
47268
  matches.sort((a, b) => b.pairedAt - a.pairedAt);
@@ -47134,25 +47270,25 @@ function pickSavedSessionForWorkspace(sessions3, cwd) {
47134
47270
  }
47135
47271
 
47136
47272
  // src/commands/host/workspace.ts
47137
- var fs74 = __toESM(require("fs"));
47273
+ var fs75 = __toESM(require("fs"));
47138
47274
  var os59 = __toESM(require("os"));
47139
- var path88 = __toESM(require("path"));
47275
+ var path89 = __toESM(require("path"));
47140
47276
  var import_node_child_process25 = require("child_process");
47141
47277
  var import_node_util5 = require("util");
47142
47278
  var execFileP9 = (0, import_node_util5.promisify)(import_node_child_process25.execFile);
47143
47279
  function isAbsolutePathTarget(target) {
47144
- return path88.isAbsolute(target);
47280
+ return path89.isAbsolute(target);
47145
47281
  }
47146
47282
  function selfHostedWorkspaceRoot() {
47147
- return path88.join(os59.homedir(), ".codeam", "self-hosted");
47283
+ return path89.join(os59.homedir(), ".codeam", "self-hosted");
47148
47284
  }
47149
47285
  function deployIdFromWorkspace(cwd) {
47150
47286
  if (!cwd) return null;
47151
47287
  const root = selfHostedWorkspaceRoot();
47152
- const resolved = path88.resolve(cwd);
47153
- const rel = path88.relative(root, resolved);
47154
- if (!rel || rel.startsWith("..") || path88.isAbsolute(rel)) return null;
47155
- const parts = rel.split(path88.sep).filter(Boolean);
47288
+ const resolved = path89.resolve(cwd);
47289
+ const rel = path89.relative(root, resolved);
47290
+ if (!rel || rel.startsWith("..") || path89.isAbsolute(rel)) return null;
47291
+ const parts = rel.split(path89.sep).filter(Boolean);
47156
47292
  if (parts.length !== 1) return null;
47157
47293
  return parts[0];
47158
47294
  }
@@ -47224,15 +47360,15 @@ async function configureGitCredentials(dest, repoRef, cloneToken, provider = "gi
47224
47360
  const isGitlab = provider === "gitlab";
47225
47361
  if (isGitlab ? !gitlabProjectPath(repoRef.trim()) : !githubOwnerRepo(repoRef.trim())) return;
47226
47362
  if (!cloneToken) return;
47227
- const credFile = path88.join(dest, ".git", "codeam-credentials");
47363
+ const credFile = path89.join(dest, ".git", "codeam-credentials");
47228
47364
  const credLine = isGitlab ? `https://oauth2:${cloneToken}@gitlab.com
47229
47365
  ` : `https://x-access-token:${cloneToken}@github.com
47230
47366
  `;
47231
- fs74.writeFileSync(credFile, credLine, { mode: 384 });
47367
+ fs75.writeFileSync(credFile, credLine, { mode: 384 });
47232
47368
  restrictToOwner(credFile);
47233
47369
  const env = nonInteractiveGitEnv();
47234
47370
  const git2 = (args2) => execFileP9("git", ["-C", dest, ...args2], { timeout: 3e4, env });
47235
- const credFilePosix = credFile.split(path88.sep).join("/");
47371
+ const credFilePosix = credFile.split(path89.sep).join("/");
47236
47372
  await git2(["config", "--local", "--replace-all", "credential.helper", ""]).catch(() => {
47237
47373
  });
47238
47374
  await git2([
@@ -47265,17 +47401,17 @@ function maskToken(text, cloneToken) {
47265
47401
  }
47266
47402
  async function prepareWorkspace(repoOrPath, deployId, cloneToken, provider = "github", branch) {
47267
47403
  if (isAbsolutePathTarget(repoOrPath)) {
47268
- if (!fs74.existsSync(repoOrPath)) {
47404
+ if (!fs75.existsSync(repoOrPath)) {
47269
47405
  throw new Error(`deploy target path does not exist: ${repoOrPath}`);
47270
47406
  }
47271
47407
  return repoOrPath;
47272
47408
  }
47273
- const dest = path88.join(selfHostedWorkspaceRoot(), deployId);
47274
- if (fs74.existsSync(path88.join(dest, ".git"))) {
47409
+ const dest = path89.join(selfHostedWorkspaceRoot(), deployId);
47410
+ if (fs75.existsSync(path89.join(dest, ".git"))) {
47275
47411
  if (cloneToken) await configureGitCredentials(dest, repoOrPath, cloneToken, provider);
47276
47412
  return dest;
47277
47413
  }
47278
- fs74.mkdirSync(selfHostedWorkspaceRoot(), { recursive: true, mode: 448 });
47414
+ fs75.mkdirSync(selfHostedWorkspaceRoot(), { recursive: true, mode: 448 });
47279
47415
  const cloneUrl = repoCloneUrl(repoOrPath, cloneToken, provider);
47280
47416
  const cloneArgs = branch ? ["clone", "--depth", "1", "--branch", branch, cloneUrl, dest] : ["clone", "--depth", "1", cloneUrl, dest];
47281
47417
  try {
@@ -47294,11 +47430,11 @@ async function prepareWorkspace(repoOrPath, deployId, cloneToken, provider = "gi
47294
47430
 
47295
47431
  // src/commands/host/git-tooling.ts
47296
47432
  var import_node_child_process26 = require("child_process");
47297
- var fs75 = __toESM(require("fs"));
47433
+ var fs76 = __toESM(require("fs"));
47298
47434
  var os60 = __toESM(require("os"));
47299
- var path89 = __toESM(require("path"));
47435
+ var path90 = __toESM(require("path"));
47300
47436
  function codeamBinDir() {
47301
- return process.env.CODEAM_BIN_DIR ?? path89.join(os60.homedir(), ".codeam", "bin");
47437
+ return process.env.CODEAM_BIN_DIR ?? path90.join(os60.homedir(), ".codeam", "bin");
47302
47438
  }
47303
47439
  var FALLBACK_GH_VERSION = "2.62.0";
47304
47440
  var RELEASE_API = "https://api.github.com/repos/cli/cli/releases/latest";
@@ -47330,7 +47466,7 @@ async function download(url2, dest) {
47330
47466
  const res = await fetch(url2, { headers: { "User-Agent": "codeam-cli" } });
47331
47467
  if (!res.ok || !res.body) return false;
47332
47468
  const buf = Buffer.from(await res.arrayBuffer());
47333
- fs75.writeFileSync(dest, buf);
47469
+ fs76.writeFileSync(dest, buf);
47334
47470
  return true;
47335
47471
  } catch {
47336
47472
  return false;
@@ -47353,8 +47489,8 @@ async function ensureGhCli(runner, token, deps = {}) {
47353
47489
  const version3 = await resolveVersionFn(token);
47354
47490
  const asset = `gh_${version3}_${osToken}_${arch2}`;
47355
47491
  const url2 = `https://github.com/cli/cli/releases/download/v${version3}/${asset}.${ext}`;
47356
- const tmpRoot = fs75.mkdtempSync(path89.join(os60.tmpdir(), "codeam-gh-"));
47357
- const archive = path89.join(tmpRoot, `${asset}.${ext}`);
47492
+ const tmpRoot = fs76.mkdtempSync(path90.join(os60.tmpdir(), "codeam-gh-"));
47493
+ const archive = path90.join(tmpRoot, `${asset}.${ext}`);
47358
47494
  if (!await downloadFn(url2, archive)) {
47359
47495
  log.warn("host-agent", "gh download failed \u2014 skipping (git pull/push still work via the credential helper)");
47360
47496
  return null;
@@ -47364,16 +47500,16 @@ async function ensureGhCli(runner, token, deps = {}) {
47364
47500
  log.warn("host-agent", `gh archive extraction failed (code=${String(extract.code)}) \u2014 skipping`);
47365
47501
  return null;
47366
47502
  }
47367
- const extractedBin = path89.join(tmpRoot, asset, "bin", binaryName);
47368
- if (!fs75.existsSync(extractedBin)) {
47503
+ const extractedBin = path90.join(tmpRoot, asset, "bin", binaryName);
47504
+ if (!fs76.existsSync(extractedBin)) {
47369
47505
  log.warn("host-agent", "gh binary not found in the extracted archive \u2014 skipping");
47370
47506
  return null;
47371
47507
  }
47372
47508
  const binDir = codeamBinDir();
47373
- fs75.mkdirSync(binDir, { recursive: true });
47374
- const target = path89.join(binDir, binaryName);
47375
- fs75.copyFileSync(extractedBin, target);
47376
- fs75.chmodSync(target, 493);
47509
+ fs76.mkdirSync(binDir, { recursive: true });
47510
+ const target = path90.join(binDir, binaryName);
47511
+ fs76.copyFileSync(extractedBin, target);
47512
+ fs76.chmodSync(target, 493);
47377
47513
  log.info("host-agent", `gh installed to ${target} (v${version3})`);
47378
47514
  return target;
47379
47515
  } catch (e) {
@@ -47410,19 +47546,19 @@ async function ensureGhAuth(runner, ghCmd, token) {
47410
47546
  }
47411
47547
  function ghConfigDir() {
47412
47548
  if (process.env.GH_CONFIG_DIR) return process.env.GH_CONFIG_DIR;
47413
- if (process.env.XDG_CONFIG_HOME) return path89.join(process.env.XDG_CONFIG_HOME, "gh");
47549
+ if (process.env.XDG_CONFIG_HOME) return path90.join(process.env.XDG_CONFIG_HOME, "gh");
47414
47550
  if (process.platform === "win32" && process.env.APPDATA) {
47415
- return path89.join(process.env.APPDATA, "GitHub CLI");
47551
+ return path90.join(process.env.APPDATA, "GitHub CLI");
47416
47552
  }
47417
- return path89.join(os60.homedir(), ".config", "gh");
47553
+ return path90.join(os60.homedir(), ".config", "gh");
47418
47554
  }
47419
47555
  function writeGhHostsToken(token) {
47420
47556
  try {
47421
47557
  const dir = ghConfigDir();
47422
- const file = path89.join(dir, "hosts.yml");
47423
- if (fs75.existsSync(file)) return false;
47424
- fs75.mkdirSync(dir, { recursive: true, mode: 448 });
47425
- fs75.writeFileSync(
47558
+ const file = path90.join(dir, "hosts.yml");
47559
+ if (fs76.existsSync(file)) return false;
47560
+ fs76.mkdirSync(dir, { recursive: true, mode: 448 });
47561
+ fs76.writeFileSync(
47426
47562
  file,
47427
47563
  `github.com:
47428
47564
  oauth_token: ${token}
@@ -47465,8 +47601,8 @@ async function ensureGlabCli(runner, deps = {}) {
47465
47601
  const version3 = await resolveLatestGlabVersion();
47466
47602
  const asset = `glab_${version3}_${osToken}_${arch2}`;
47467
47603
  const url2 = `https://gitlab.com/gitlab-org/cli/-/releases/v${version3}/downloads/${asset}.${ext}`;
47468
- const tmpRoot = fs75.mkdtempSync(path89.join(os60.tmpdir(), "codeam-glab-"));
47469
- const archive = path89.join(tmpRoot, `${asset}.${ext}`);
47604
+ const tmpRoot = fs76.mkdtempSync(path90.join(os60.tmpdir(), "codeam-glab-"));
47605
+ const archive = path90.join(tmpRoot, `${asset}.${ext}`);
47470
47606
  if (!await downloadFn(url2, archive)) {
47471
47607
  log.warn("host-agent", "glab download failed \u2014 skipping (git push/pull still work)");
47472
47608
  return null;
@@ -47477,20 +47613,20 @@ async function ensureGlabCli(runner, deps = {}) {
47477
47613
  return null;
47478
47614
  }
47479
47615
  const candidates = [
47480
- path89.join(tmpRoot, "bin", binaryName),
47481
- path89.join(tmpRoot, asset, "bin", binaryName),
47482
- path89.join(tmpRoot, binaryName)
47616
+ path90.join(tmpRoot, "bin", binaryName),
47617
+ path90.join(tmpRoot, asset, "bin", binaryName),
47618
+ path90.join(tmpRoot, binaryName)
47483
47619
  ];
47484
- const extractedBin = candidates.find((c2) => fs75.existsSync(c2));
47620
+ const extractedBin = candidates.find((c2) => fs76.existsSync(c2));
47485
47621
  if (!extractedBin) {
47486
47622
  log.warn("host-agent", "glab binary not found in the extracted archive \u2014 skipping");
47487
47623
  return null;
47488
47624
  }
47489
47625
  const binDir = codeamBinDir();
47490
- fs75.mkdirSync(binDir, { recursive: true });
47491
- const target = path89.join(binDir, binaryName);
47492
- fs75.copyFileSync(extractedBin, target);
47493
- fs75.chmodSync(target, 493);
47626
+ fs76.mkdirSync(binDir, { recursive: true });
47627
+ const target = path90.join(binDir, binaryName);
47628
+ fs76.copyFileSync(extractedBin, target);
47629
+ fs76.chmodSync(target, 493);
47494
47630
  log.info("host-agent", `glab installed to ${target} (v${version3})`);
47495
47631
  return target;
47496
47632
  } catch (e) {
@@ -47572,9 +47708,9 @@ var defaultGitToolingRunner = {
47572
47708
  var import_node_child_process28 = require("child_process");
47573
47709
 
47574
47710
  // src/lib/updateNotifier.ts
47575
- var fs76 = __toESM(require("fs"));
47711
+ var fs77 = __toESM(require("fs"));
47576
47712
  var os61 = __toESM(require("os"));
47577
- var path90 = __toESM(require("path"));
47713
+ var path91 = __toESM(require("path"));
47578
47714
  var https8 = __toESM(require("https"));
47579
47715
  var import_node_child_process27 = require("child_process");
47580
47716
  var import_picocolors12 = __toESM(require("picocolors"));
@@ -47583,12 +47719,12 @@ var REGISTRY_URL = `https://registry.npmjs.org/${PKG_NAME}/latest`;
47583
47719
  var TTL_MS = 24 * 60 * 60 * 1e3;
47584
47720
  var REQUEST_TIMEOUT_MS = 1500;
47585
47721
  function cachePath() {
47586
- const dir = path90.join(os61.homedir(), ".codeam");
47587
- return path90.join(dir, "update-check.json");
47722
+ const dir = path91.join(os61.homedir(), ".codeam");
47723
+ return path91.join(dir, "update-check.json");
47588
47724
  }
47589
47725
  function readCache() {
47590
47726
  try {
47591
- const raw = fs76.readFileSync(cachePath(), "utf8");
47727
+ const raw = fs77.readFileSync(cachePath(), "utf8");
47592
47728
  const parsed = JSON.parse(raw);
47593
47729
  if (typeof parsed.fetchedAt !== "number" || typeof parsed.latest !== "string") return null;
47594
47730
  return parsed;
@@ -47599,10 +47735,10 @@ function readCache() {
47599
47735
  function writeCache(cache) {
47600
47736
  try {
47601
47737
  const file = cachePath();
47602
- fs76.mkdirSync(path90.dirname(file), { recursive: true });
47738
+ fs77.mkdirSync(path91.dirname(file), { recursive: true });
47603
47739
  const tmp = `${file}.${process.pid}.tmp`;
47604
- fs76.writeFileSync(tmp, JSON.stringify(cache));
47605
- fs76.renameSync(tmp, file);
47740
+ fs77.writeFileSync(tmp, JSON.stringify(cache));
47741
+ fs77.renameSync(tmp, file);
47606
47742
  } catch {
47607
47743
  }
47608
47744
  }
@@ -47676,8 +47812,8 @@ function isLinkedInstall() {
47676
47812
  timeout: 2e3
47677
47813
  }).trim();
47678
47814
  if (!root) return false;
47679
- const pkgPath = path90.join(root, PKG_NAME);
47680
- return fs76.lstatSync(pkgPath).isSymbolicLink();
47815
+ const pkgPath = path91.join(root, PKG_NAME);
47816
+ return fs77.lstatSync(pkgPath).isSymbolicLink();
47681
47817
  } catch {
47682
47818
  return false;
47683
47819
  }
@@ -47713,7 +47849,7 @@ function maybeAutoUpdate(currentVersion, latest) {
47713
47849
  return;
47714
47850
  }
47715
47851
  try {
47716
- fs76.unlinkSync(cachePath());
47852
+ fs77.unlinkSync(cachePath());
47717
47853
  } catch {
47718
47854
  }
47719
47855
  process.stderr.write(` ${import_picocolors12.default.green("\u2713")} Updated. Resuming session...
@@ -47729,7 +47865,7 @@ async function autoUpgradeBeforeCriticalCommand() {
47729
47865
  if (process.env.NODE_ENV === "test") return;
47730
47866
  if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
47731
47867
  if (process.env.CI) return;
47732
- const current2 = true ? "2.75.22" : null;
47868
+ const current2 = true ? "2.75.25" : null;
47733
47869
  if (!current2) return;
47734
47870
  const cache = readCache();
47735
47871
  const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
@@ -47746,7 +47882,7 @@ function checkForUpdates() {
47746
47882
  if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
47747
47883
  if (process.env.CI) return;
47748
47884
  if (!process.stdout.isTTY) return;
47749
- const current2 = true ? "2.75.22" : null;
47885
+ const current2 = true ? "2.75.25" : null;
47750
47886
  if (!current2) return;
47751
47887
  const cache = readCache();
47752
47888
  const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
@@ -47769,7 +47905,7 @@ var SELF_UPDATE_INSTALL_TIMEOUT_MS = 18e4;
47769
47905
  var SELF_UPDATE_LS_TIMEOUT_MS = 15e3;
47770
47906
  var SUDO_PREFLIGHT_TIMEOUT_MS = 5e3;
47771
47907
  function currentCliVersion() {
47772
- return true ? "2.75.22" : null;
47908
+ return true ? "2.75.25" : null;
47773
47909
  }
47774
47910
  async function installedVersion(deps) {
47775
47911
  const ls = await deps.run(
@@ -48502,13 +48638,13 @@ var HostAgentSupervisor = class {
48502
48638
  const relay = this.relay;
48503
48639
  if (!relay) return;
48504
48640
  const raw = cmd.payload?.path;
48505
- const target = typeof raw === "string" && raw.trim() ? path91.resolve(raw.trim()) : os62.homedir();
48641
+ const target = typeof raw === "string" && raw.trim() ? path92.resolve(raw.trim()) : os62.homedir();
48506
48642
  try {
48507
- const dirents = await fs77.promises.readdir(target, { withFileTypes: true });
48643
+ const dirents = await fs78.promises.readdir(target, { withFileTypes: true });
48508
48644
  const entries = dirents.filter((d3) => !d3.name.startsWith(".")).map((d3) => ({ name: d3.name, isDir: d3.isDirectory() })).sort(
48509
48645
  (a, b) => a.isDir === b.isDir ? a.name.localeCompare(b.name) : a.isDir ? -1 : 1
48510
48646
  );
48511
- const parent = path91.dirname(target);
48647
+ const parent = path92.dirname(target);
48512
48648
  await relay.sendResult(cmd.id, "completed", {
48513
48649
  path: target,
48514
48650
  // null at the filesystem root so the UI can hide the ".." affordance.
@@ -48855,14 +48991,14 @@ var HostAgentSupervisor = class {
48855
48991
  ...buildHouseProxyChildEnv({ baseUrl, token, openRouter: openRouter === true }),
48856
48992
  CODEAM_AUTO_TOKEN: payload.autoPairToken
48857
48993
  };
48858
- const houseConfigDir = path91.join(
48994
+ const houseConfigDir = path92.join(
48859
48995
  os62.homedir(),
48860
48996
  ".codeam",
48861
48997
  "house-claude",
48862
48998
  payload.deployId
48863
48999
  );
48864
49000
  try {
48865
- fs77.mkdirSync(houseConfigDir, { recursive: true, mode: 448 });
49001
+ fs78.mkdirSync(houseConfigDir, { recursive: true, mode: 448 });
48866
49002
  } catch {
48867
49003
  }
48868
49004
  childEnv.CLAUDE_CONFIG_DIR = houseConfigDir;
@@ -48896,13 +49032,13 @@ var HostAgentSupervisor = class {
48896
49032
  if ((payload.repoProvider ?? "github") === "gitlab") {
48897
49033
  const glabCmd = await ensureGlabCli(defaultGitToolingRunner);
48898
49034
  if (glabCmd) {
48899
- childEnv.PATH = `${codeamBinDir()}${path91.delimiter}${childEnv.PATH}`;
49035
+ childEnv.PATH = `${codeamBinDir()}${path92.delimiter}${childEnv.PATH}`;
48900
49036
  await ensureGlabAuth(defaultGitToolingRunner, glabCmd, payload.cloneToken);
48901
49037
  }
48902
49038
  } else {
48903
49039
  const ghCmd = await ensureGhCli(defaultGitToolingRunner, payload.cloneToken);
48904
49040
  if (ghCmd) {
48905
- childEnv.PATH = `${codeamBinDir()}${path91.delimiter}${childEnv.PATH}`;
49041
+ childEnv.PATH = `${codeamBinDir()}${path92.delimiter}${childEnv.PATH}`;
48906
49042
  await ensureGhAuth(defaultGitToolingRunner, ghCmd, payload.cloneToken);
48907
49043
  }
48908
49044
  }
@@ -48930,9 +49066,9 @@ var HostAgentSupervisor = class {
48930
49066
  );
48931
49067
  if (!payload.suppressOnboardingWelcome) {
48932
49068
  try {
48933
- const cfgDir = childEnv.CLAUDE_CONFIG_DIR || path91.join(os62.homedir(), ".claude");
48934
- const projectDir = path91.join(cfgDir, "projects", encodeCwd(cwd));
48935
- const hasPriorConversation = fs77.existsSync(projectDir) && fs77.readdirSync(projectDir).some((f) => f.endsWith(".jsonl"));
49069
+ const cfgDir = childEnv.CLAUDE_CONFIG_DIR || path92.join(os62.homedir(), ".claude");
49070
+ const projectDir = path92.join(cfgDir, "projects", encodeCwd(cwd));
49071
+ const hasPriorConversation = fs78.existsSync(projectDir) && fs78.readdirSync(projectDir).some((f) => f.endsWith(".jsonl"));
48936
49072
  if (hasPriorConversation) {
48937
49073
  childEnv.CODEAM_RESUME_LATEST = "1";
48938
49074
  log.info(
@@ -49083,7 +49219,7 @@ var HostAgentSupervisor = class {
49083
49219
  fallbackResumeTarget() {
49084
49220
  const session = getActiveSession();
49085
49221
  if (!session || !session.pluginId || !session.pollSecret || !session.agent) return null;
49086
- const cwd = session.cwd && fs77.existsSync(session.cwd) ? session.cwd : process.cwd();
49222
+ const cwd = session.cwd && fs78.existsSync(session.cwd) ? session.cwd : process.cwd();
49087
49223
  const deployId = deployIdFromWorkspace(session.cwd) ?? session.id;
49088
49224
  return { deployId, cwd, session };
49089
49225
  }
@@ -49103,7 +49239,7 @@ var HostAgentSupervisor = class {
49103
49239
  if (this.children.has(deployId)) return;
49104
49240
  const st3 = this.resumeStateFor(target);
49105
49241
  try {
49106
- const cwd = fs77.existsSync(target.cwd) ? target.cwd : process.cwd();
49242
+ const cwd = fs78.existsSync(target.cwd) ? target.cwd : process.cwd();
49107
49243
  const proc = this.resumeSpawner(
49108
49244
  { ...readHouseProxyChildEnv(), CODEAM_RESUME_SESSION_ID: session.id },
49109
49245
  cwd
@@ -49321,12 +49457,12 @@ var HostAgentSupervisor = class {
49321
49457
  this.untrackChild(deployId);
49322
49458
  }
49323
49459
  const dirs = [
49324
- path91.join(selfHostedWorkspaceRoot(), deployId),
49325
- path91.join(os62.homedir(), ".codeam", "house-claude", deployId)
49460
+ path92.join(selfHostedWorkspaceRoot(), deployId),
49461
+ path92.join(os62.homedir(), ".codeam", "house-claude", deployId)
49326
49462
  ];
49327
49463
  for (const dir of dirs) {
49328
49464
  try {
49329
- fs77.rmSync(dir, { recursive: true, force: true });
49465
+ fs78.rmSync(dir, { recursive: true, force: true });
49330
49466
  } catch (err) {
49331
49467
  log.warn(
49332
49468
  "host-agent",
@@ -49486,8 +49622,8 @@ async function invite() {
49486
49622
  var import_node_dns = require("dns");
49487
49623
  var import_node_util6 = require("util");
49488
49624
  var import_node_crypto12 = require("crypto");
49489
- var fs78 = __toESM(require("fs"));
49490
- var path92 = __toESM(require("path"));
49625
+ var fs79 = __toESM(require("fs"));
49626
+ var path93 = __toESM(require("path"));
49491
49627
  var import_picocolors14 = __toESM(require("picocolors"));
49492
49628
  var dnsResolveP = (0, import_node_util6.promisify)(import_node_dns.resolve);
49493
49629
  async function checkDns(apiBase2) {
@@ -49543,13 +49679,13 @@ async function checkHealth(apiBase2) {
49543
49679
  }
49544
49680
  }
49545
49681
  function checkConfigDir() {
49546
- const dir = path92.join(require("os").homedir(), ".codeam");
49682
+ const dir = path93.join(require("os").homedir(), ".codeam");
49547
49683
  try {
49548
- fs78.mkdirSync(dir, { recursive: true, mode: 448 });
49549
- const probe = path92.join(dir, ".doctor-probe");
49550
- fs78.writeFileSync(probe, "ok", { mode: 384 });
49551
- const read = fs78.readFileSync(probe, "utf8");
49552
- fs78.unlinkSync(probe);
49684
+ fs79.mkdirSync(dir, { recursive: true, mode: 448 });
49685
+ const probe = path93.join(dir, ".doctor-probe");
49686
+ fs79.writeFileSync(probe, "ok", { mode: 384 });
49687
+ const read = fs79.readFileSync(probe, "utf8");
49688
+ fs79.unlinkSync(probe);
49553
49689
  if (read !== "ok") throw new Error("write/read round-trip mismatch");
49554
49690
  return {
49555
49691
  id: "config-dir",
@@ -49613,7 +49749,7 @@ function checkNodePty() {
49613
49749
  detail: "not required on this platform"
49614
49750
  };
49615
49751
  }
49616
- const vendoredPath = path92.join(__dirname, "vendor", "node-pty");
49752
+ const vendoredPath = path93.join(__dirname, "vendor", "node-pty");
49617
49753
  for (const target of [vendoredPath, "node-pty"]) {
49618
49754
  try {
49619
49755
  require(target);
@@ -49655,7 +49791,7 @@ function checkChokidar() {
49655
49791
  }
49656
49792
  async function doctor(args2 = []) {
49657
49793
  const json = args2.includes("--json");
49658
- const cliVersion = true ? "2.75.22" : "0.0.0-dev";
49794
+ const cliVersion = true ? "2.75.25" : "0.0.0-dev";
49659
49795
  const apiBase2 = resolveApiBaseUrl();
49660
49796
  const diagnosticId = (0, import_node_crypto12.randomUUID)();
49661
49797
  log.info("doctor", `run id=${diagnosticId} cli=${cliVersion}`);
@@ -50179,7 +50315,7 @@ async function mcpWarm(argv = [], opts = {}) {
50179
50315
  // src/commands/version.ts
50180
50316
  var import_picocolors15 = __toESM(require("picocolors"));
50181
50317
  function version2() {
50182
- const v = true ? "2.75.22" : "unknown";
50318
+ const v = true ? "2.75.25" : "unknown";
50183
50319
  console.log(`${import_picocolors15.default.bold("codeam-cli")} ${import_picocolors15.default.cyan(v)}`);
50184
50320
  }
50185
50321