@buildautomaton/cli 0.1.85 → 0.1.87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -973,8 +973,8 @@ var require_command = __commonJS({
973
973
  "../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/command.js"(exports) {
974
974
  var EventEmitter2 = __require("node:events").EventEmitter;
975
975
  var childProcess2 = __require("node:child_process");
976
- var path88 = __require("node:path");
977
- var fs67 = __require("node:fs");
976
+ var path90 = __require("node:path");
977
+ var fs69 = __require("node:fs");
978
978
  var process9 = __require("node:process");
979
979
  var { Argument: Argument2, humanReadableArgName } = require_argument();
980
980
  var { CommanderError: CommanderError2 } = require_error();
@@ -1906,11 +1906,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
1906
1906
  let launchWithNode = false;
1907
1907
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
1908
1908
  function findFile(baseDir, baseName) {
1909
- const localBin = path88.resolve(baseDir, baseName);
1910
- if (fs67.existsSync(localBin)) return localBin;
1911
- if (sourceExt.includes(path88.extname(baseName))) return void 0;
1909
+ const localBin = path90.resolve(baseDir, baseName);
1910
+ if (fs69.existsSync(localBin)) return localBin;
1911
+ if (sourceExt.includes(path90.extname(baseName))) return void 0;
1912
1912
  const foundExt = sourceExt.find(
1913
- (ext) => fs67.existsSync(`${localBin}${ext}`)
1913
+ (ext) => fs69.existsSync(`${localBin}${ext}`)
1914
1914
  );
1915
1915
  if (foundExt) return `${localBin}${foundExt}`;
1916
1916
  return void 0;
@@ -1922,21 +1922,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
1922
1922
  if (this._scriptPath) {
1923
1923
  let resolvedScriptPath;
1924
1924
  try {
1925
- resolvedScriptPath = fs67.realpathSync(this._scriptPath);
1925
+ resolvedScriptPath = fs69.realpathSync(this._scriptPath);
1926
1926
  } catch (err) {
1927
1927
  resolvedScriptPath = this._scriptPath;
1928
1928
  }
1929
- executableDir = path88.resolve(
1930
- path88.dirname(resolvedScriptPath),
1929
+ executableDir = path90.resolve(
1930
+ path90.dirname(resolvedScriptPath),
1931
1931
  executableDir
1932
1932
  );
1933
1933
  }
1934
1934
  if (executableDir) {
1935
1935
  let localFile = findFile(executableDir, executableFile);
1936
1936
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
1937
- const legacyName = path88.basename(
1937
+ const legacyName = path90.basename(
1938
1938
  this._scriptPath,
1939
- path88.extname(this._scriptPath)
1939
+ path90.extname(this._scriptPath)
1940
1940
  );
1941
1941
  if (legacyName !== this._name) {
1942
1942
  localFile = findFile(
@@ -1947,7 +1947,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1947
1947
  }
1948
1948
  executableFile = localFile || executableFile;
1949
1949
  }
1950
- launchWithNode = sourceExt.includes(path88.extname(executableFile));
1950
+ launchWithNode = sourceExt.includes(path90.extname(executableFile));
1951
1951
  let proc;
1952
1952
  if (process9.platform !== "win32") {
1953
1953
  if (launchWithNode) {
@@ -2787,7 +2787,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2787
2787
  * @return {Command}
2788
2788
  */
2789
2789
  nameFromFilename(filename) {
2790
- this._name = path88.basename(filename, path88.extname(filename));
2790
+ this._name = path90.basename(filename, path90.extname(filename));
2791
2791
  return this;
2792
2792
  }
2793
2793
  /**
@@ -2801,9 +2801,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
2801
2801
  * @param {string} [path]
2802
2802
  * @return {(string|null|Command)}
2803
2803
  */
2804
- executableDir(path89) {
2805
- if (path89 === void 0) return this._executableDir;
2806
- this._executableDir = path89;
2804
+ executableDir(path91) {
2805
+ if (path91 === void 0) return this._executableDir;
2806
+ this._executableDir = path91;
2807
2807
  return this;
2808
2808
  }
2809
2809
  /**
@@ -7729,7 +7729,7 @@ function readMigrationSql(filename, ...searchSubdirs) {
7729
7729
  join3(moduleDir, "..", sub, filename),
7730
7730
  join3(moduleDir, "..", "..", "dist", sub, filename)
7731
7731
  ]);
7732
- const resolved = candidates.find((path88) => existsSync(path88));
7732
+ const resolved = candidates.find((path90) => existsSync(path90));
7733
7733
  if (!resolved) {
7734
7734
  throw new Error(`Missing SQLite migration SQL: ${filename} (searched ${searchSubdirs.join(", ")})`);
7735
7735
  }
@@ -8807,7 +8807,7 @@ var require_ignore = __commonJS({
8807
8807
  // path matching.
8808
8808
  // - check `string` either `MODE_IGNORE` or `MODE_CHECK_IGNORE`
8809
8809
  // @returns {TestResult} true if a file is ignored
8810
- test(path88, checkUnignored, mode) {
8810
+ test(path90, checkUnignored, mode) {
8811
8811
  let ignored = false;
8812
8812
  let unignored = false;
8813
8813
  let matchedRule;
@@ -8816,7 +8816,7 @@ var require_ignore = __commonJS({
8816
8816
  if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
8817
8817
  return;
8818
8818
  }
8819
- const matched = rule[mode].test(path88);
8819
+ const matched = rule[mode].test(path90);
8820
8820
  if (!matched) {
8821
8821
  return;
8822
8822
  }
@@ -8837,17 +8837,17 @@ var require_ignore = __commonJS({
8837
8837
  var throwError = (message, Ctor) => {
8838
8838
  throw new Ctor(message);
8839
8839
  };
8840
- var checkPath = (path88, originalPath, doThrow) => {
8841
- if (!isString(path88)) {
8840
+ var checkPath = (path90, originalPath, doThrow) => {
8841
+ if (!isString(path90)) {
8842
8842
  return doThrow(
8843
8843
  `path must be a string, but got \`${originalPath}\``,
8844
8844
  TypeError
8845
8845
  );
8846
8846
  }
8847
- if (!path88) {
8847
+ if (!path90) {
8848
8848
  return doThrow(`path must not be empty`, TypeError);
8849
8849
  }
8850
- if (checkPath.isNotRelative(path88)) {
8850
+ if (checkPath.isNotRelative(path90)) {
8851
8851
  const r = "`path.relative()`d";
8852
8852
  return doThrow(
8853
8853
  `path should be a ${r} string, but got "${originalPath}"`,
@@ -8856,7 +8856,7 @@ var require_ignore = __commonJS({
8856
8856
  }
8857
8857
  return true;
8858
8858
  };
8859
- var isNotRelative = (path88) => REGEX_TEST_INVALID_PATH.test(path88);
8859
+ var isNotRelative = (path90) => REGEX_TEST_INVALID_PATH.test(path90);
8860
8860
  checkPath.isNotRelative = isNotRelative;
8861
8861
  checkPath.convert = (p) => p;
8862
8862
  var Ignore = class {
@@ -8886,19 +8886,19 @@ var require_ignore = __commonJS({
8886
8886
  }
8887
8887
  // @returns {TestResult}
8888
8888
  _test(originalPath, cache2, checkUnignored, slices) {
8889
- const path88 = originalPath && checkPath.convert(originalPath);
8889
+ const path90 = originalPath && checkPath.convert(originalPath);
8890
8890
  checkPath(
8891
- path88,
8891
+ path90,
8892
8892
  originalPath,
8893
8893
  this._strictPathCheck ? throwError : RETURN_FALSE
8894
8894
  );
8895
- return this._t(path88, cache2, checkUnignored, slices);
8895
+ return this._t(path90, cache2, checkUnignored, slices);
8896
8896
  }
8897
- checkIgnore(path88) {
8898
- if (!REGEX_TEST_TRAILING_SLASH.test(path88)) {
8899
- return this.test(path88);
8897
+ checkIgnore(path90) {
8898
+ if (!REGEX_TEST_TRAILING_SLASH.test(path90)) {
8899
+ return this.test(path90);
8900
8900
  }
8901
- const slices = path88.split(SLASH).filter(Boolean);
8901
+ const slices = path90.split(SLASH).filter(Boolean);
8902
8902
  slices.pop();
8903
8903
  if (slices.length) {
8904
8904
  const parent = this._t(
@@ -8911,18 +8911,18 @@ var require_ignore = __commonJS({
8911
8911
  return parent;
8912
8912
  }
8913
8913
  }
8914
- return this._rules.test(path88, false, MODE_CHECK_IGNORE);
8914
+ return this._rules.test(path90, false, MODE_CHECK_IGNORE);
8915
8915
  }
8916
- _t(path88, cache2, checkUnignored, slices) {
8917
- if (path88 in cache2) {
8918
- return cache2[path88];
8916
+ _t(path90, cache2, checkUnignored, slices) {
8917
+ if (path90 in cache2) {
8918
+ return cache2[path90];
8919
8919
  }
8920
8920
  if (!slices) {
8921
- slices = path88.split(SLASH).filter(Boolean);
8921
+ slices = path90.split(SLASH).filter(Boolean);
8922
8922
  }
8923
8923
  slices.pop();
8924
8924
  if (!slices.length) {
8925
- return cache2[path88] = this._rules.test(path88, checkUnignored, MODE_IGNORE);
8925
+ return cache2[path90] = this._rules.test(path90, checkUnignored, MODE_IGNORE);
8926
8926
  }
8927
8927
  const parent = this._t(
8928
8928
  slices.join(SLASH) + SLASH,
@@ -8930,29 +8930,29 @@ var require_ignore = __commonJS({
8930
8930
  checkUnignored,
8931
8931
  slices
8932
8932
  );
8933
- return cache2[path88] = parent.ignored ? parent : this._rules.test(path88, checkUnignored, MODE_IGNORE);
8933
+ return cache2[path90] = parent.ignored ? parent : this._rules.test(path90, checkUnignored, MODE_IGNORE);
8934
8934
  }
8935
- ignores(path88) {
8936
- return this._test(path88, this._ignoreCache, false).ignored;
8935
+ ignores(path90) {
8936
+ return this._test(path90, this._ignoreCache, false).ignored;
8937
8937
  }
8938
8938
  createFilter() {
8939
- return (path88) => !this.ignores(path88);
8939
+ return (path90) => !this.ignores(path90);
8940
8940
  }
8941
8941
  filter(paths) {
8942
8942
  return makeArray(paths).filter(this.createFilter());
8943
8943
  }
8944
8944
  // @returns {TestResult}
8945
- test(path88) {
8946
- return this._test(path88, this._testCache, true);
8945
+ test(path90) {
8946
+ return this._test(path90, this._testCache, true);
8947
8947
  }
8948
8948
  };
8949
8949
  var factory = (options) => new Ignore(options);
8950
- var isPathValid = (path88) => checkPath(path88 && checkPath.convert(path88), path88, RETURN_FALSE);
8950
+ var isPathValid = (path90) => checkPath(path90 && checkPath.convert(path90), path90, RETURN_FALSE);
8951
8951
  var setupWindows = () => {
8952
8952
  const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
8953
8953
  checkPath.convert = makePosix;
8954
8954
  const REGEX_TEST_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
8955
- checkPath.isNotRelative = (path88) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path88) || isNotRelative(path88);
8955
+ checkPath.isNotRelative = (path90) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path90) || isNotRelative(path90);
8956
8956
  };
8957
8957
  if (
8958
8958
  // Detect `process` so that it can run in browsers.
@@ -12913,10 +12913,10 @@ function mergeDefs(...defs) {
12913
12913
  function cloneDef(schema) {
12914
12914
  return mergeDefs(schema._zod.def);
12915
12915
  }
12916
- function getElementAtPath(obj, path88) {
12917
- if (!path88)
12916
+ function getElementAtPath(obj, path90) {
12917
+ if (!path90)
12918
12918
  return obj;
12919
- return path88.reduce((acc, key) => acc?.[key], obj);
12919
+ return path90.reduce((acc, key) => acc?.[key], obj);
12920
12920
  }
12921
12921
  function promiseAllObject(promisesObj) {
12922
12922
  const keys = Object.keys(promisesObj);
@@ -13244,11 +13244,11 @@ function explicitlyAborted(x, startIndex = 0) {
13244
13244
  }
13245
13245
  return false;
13246
13246
  }
13247
- function prefixIssues(path88, issues) {
13247
+ function prefixIssues(path90, issues) {
13248
13248
  return issues.map((iss) => {
13249
13249
  var _a4;
13250
13250
  (_a4 = iss).path ?? (_a4.path = []);
13251
- iss.path.unshift(path88);
13251
+ iss.path.unshift(path90);
13252
13252
  return iss;
13253
13253
  });
13254
13254
  }
@@ -13465,16 +13465,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
13465
13465
  }
13466
13466
  function formatError(error51, mapper = (issue2) => issue2.message) {
13467
13467
  const fieldErrors = { _errors: [] };
13468
- const processError = (error52, path88 = []) => {
13468
+ const processError = (error52, path90 = []) => {
13469
13469
  for (const issue2 of error52.issues) {
13470
13470
  if (issue2.code === "invalid_union" && issue2.errors.length) {
13471
- issue2.errors.map((issues) => processError({ issues }, [...path88, ...issue2.path]));
13471
+ issue2.errors.map((issues) => processError({ issues }, [...path90, ...issue2.path]));
13472
13472
  } else if (issue2.code === "invalid_key") {
13473
- processError({ issues: issue2.issues }, [...path88, ...issue2.path]);
13473
+ processError({ issues: issue2.issues }, [...path90, ...issue2.path]);
13474
13474
  } else if (issue2.code === "invalid_element") {
13475
- processError({ issues: issue2.issues }, [...path88, ...issue2.path]);
13475
+ processError({ issues: issue2.issues }, [...path90, ...issue2.path]);
13476
13476
  } else {
13477
- const fullpath = [...path88, ...issue2.path];
13477
+ const fullpath = [...path90, ...issue2.path];
13478
13478
  if (fullpath.length === 0) {
13479
13479
  fieldErrors._errors.push(mapper(issue2));
13480
13480
  } else {
@@ -13501,17 +13501,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
13501
13501
  }
13502
13502
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
13503
13503
  const result = { errors: [] };
13504
- const processError = (error52, path88 = []) => {
13504
+ const processError = (error52, path90 = []) => {
13505
13505
  var _a4, _b;
13506
13506
  for (const issue2 of error52.issues) {
13507
13507
  if (issue2.code === "invalid_union" && issue2.errors.length) {
13508
- issue2.errors.map((issues) => processError({ issues }, [...path88, ...issue2.path]));
13508
+ issue2.errors.map((issues) => processError({ issues }, [...path90, ...issue2.path]));
13509
13509
  } else if (issue2.code === "invalid_key") {
13510
- processError({ issues: issue2.issues }, [...path88, ...issue2.path]);
13510
+ processError({ issues: issue2.issues }, [...path90, ...issue2.path]);
13511
13511
  } else if (issue2.code === "invalid_element") {
13512
- processError({ issues: issue2.issues }, [...path88, ...issue2.path]);
13512
+ processError({ issues: issue2.issues }, [...path90, ...issue2.path]);
13513
13513
  } else {
13514
- const fullpath = [...path88, ...issue2.path];
13514
+ const fullpath = [...path90, ...issue2.path];
13515
13515
  if (fullpath.length === 0) {
13516
13516
  result.errors.push(mapper(issue2));
13517
13517
  continue;
@@ -13543,8 +13543,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
13543
13543
  }
13544
13544
  function toDotPath(_path) {
13545
13545
  const segs = [];
13546
- const path88 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
13547
- for (const seg of path88) {
13546
+ const path90 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
13547
+ for (const seg of path90) {
13548
13548
  if (typeof seg === "number")
13549
13549
  segs.push(`[${seg}]`);
13550
13550
  else if (typeof seg === "symbol")
@@ -26974,13 +26974,13 @@ function resolveRef(ref, ctx) {
26974
26974
  if (!ref.startsWith("#")) {
26975
26975
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
26976
26976
  }
26977
- const path88 = ref.slice(1).split("/").filter(Boolean);
26978
- if (path88.length === 0) {
26977
+ const path90 = ref.slice(1).split("/").filter(Boolean);
26978
+ if (path90.length === 0) {
26979
26979
  return ctx.rootSchema;
26980
26980
  }
26981
26981
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
26982
- if (path88[0] === defsKey) {
26983
- const key = path88[1];
26982
+ if (path90[0] === defsKey) {
26983
+ const key = path90[1];
26984
26984
  if (!key || !ctx.defs[key]) {
26985
26985
  throw new Error(`Reference not found: ${ref}`);
26986
26986
  }
@@ -30063,7 +30063,7 @@ var require_has_flag = __commonJS({
30063
30063
  var require_supports_color = __commonJS({
30064
30064
  "../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js"(exports, module) {
30065
30065
  "use strict";
30066
- var os10 = __require("os");
30066
+ var os11 = __require("os");
30067
30067
  var tty = __require("tty");
30068
30068
  var hasFlag = require_has_flag();
30069
30069
  var { env } = process;
@@ -30111,7 +30111,7 @@ var require_supports_color = __commonJS({
30111
30111
  return min;
30112
30112
  }
30113
30113
  if (process.platform === "win32") {
30114
- const osRelease = os10.release().split(".");
30114
+ const osRelease = os11.release().split(".");
30115
30115
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
30116
30116
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
30117
30117
  }
@@ -30357,10 +30357,10 @@ var require_src2 = __commonJS({
30357
30357
  var fs_1 = __require("fs");
30358
30358
  var debug_1 = __importDefault(require_src());
30359
30359
  var log2 = debug_1.default("@kwsites/file-exists");
30360
- function check2(path88, isFile, isDirectory) {
30361
- log2(`checking %s`, path88);
30360
+ function check2(path90, isFile, isDirectory) {
30361
+ log2(`checking %s`, path90);
30362
30362
  try {
30363
- const stat3 = fs_1.statSync(path88);
30363
+ const stat3 = fs_1.statSync(path90);
30364
30364
  if (stat3.isFile() && isFile) {
30365
30365
  log2(`[OK] path represents a file`);
30366
30366
  return true;
@@ -30380,8 +30380,8 @@ var require_src2 = __commonJS({
30380
30380
  throw e;
30381
30381
  }
30382
30382
  }
30383
- function exists2(path88, type = exports.READABLE) {
30384
- return check2(path88, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
30383
+ function exists2(path90, type = exports.READABLE) {
30384
+ return check2(path90, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
30385
30385
  }
30386
30386
  exports.exists = exists2;
30387
30387
  exports.FILE = 1;
@@ -30462,7 +30462,7 @@ var {
30462
30462
  } = import_index.default;
30463
30463
 
30464
30464
  // src/cli-version.ts
30465
- var CLI_VERSION = "0.1.85".length > 0 ? "0.1.85" : "0.0.0-dev";
30465
+ var CLI_VERSION = "0.1.87".length > 0 ? "0.1.87" : "0.0.0-dev";
30466
30466
 
30467
30467
  // src/cli/defaults.ts
30468
30468
  var DEFAULT_API_URL = process.env.BUILDAUTOMATON_API_URL ?? "https://api.buildautomaton.com";
@@ -30470,8 +30470,8 @@ var DEFAULT_FIREHOSE_URL = "https://buildautomaton-firehose.fly.dev";
30470
30470
 
30471
30471
  // src/cli/run-cli-action.ts
30472
30472
  init_cli_log_level();
30473
- import * as fs66 from "node:fs";
30474
- import * as path87 from "node:path";
30473
+ import * as fs68 from "node:fs";
30474
+ import * as path89 from "node:path";
30475
30475
 
30476
30476
  // src/config.ts
30477
30477
  import fs from "node:fs";
@@ -33552,8 +33552,8 @@ async function cancelRun(ctx, runId) {
33552
33552
  }
33553
33553
 
33554
33554
  // src/agents/acp/ensure-acp-client.ts
33555
- import * as fs24 from "node:fs";
33556
- import * as path30 from "node:path";
33555
+ import * as fs25 from "node:fs";
33556
+ import * as path32 from "node:path";
33557
33557
 
33558
33558
  // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js
33559
33559
  var external_exports = {};
@@ -34033,8 +34033,8 @@ function getErrorMap() {
34033
34033
 
34034
34034
  // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
34035
34035
  var makeIssue = (params) => {
34036
- const { data, path: path88, errorMaps, issueData } = params;
34037
- const fullPath = [...path88, ...issueData.path || []];
34036
+ const { data, path: path90, errorMaps, issueData } = params;
34037
+ const fullPath = [...path90, ...issueData.path || []];
34038
34038
  const fullIssue = {
34039
34039
  ...issueData,
34040
34040
  path: fullPath
@@ -34150,11 +34150,11 @@ var errorUtil;
34150
34150
 
34151
34151
  // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
34152
34152
  var ParseInputLazyPath = class {
34153
- constructor(parent, value, path88, key) {
34153
+ constructor(parent, value, path90, key) {
34154
34154
  this._cachedPath = [];
34155
34155
  this.parent = parent;
34156
34156
  this.data = value;
34157
- this._path = path88;
34157
+ this._path = path90;
34158
34158
  this._key = key;
34159
34159
  }
34160
34160
  get path() {
@@ -39738,6 +39738,7 @@ init_log();
39738
39738
  function createCursorAcpSessionContext(options) {
39739
39739
  const suppressLoadReplayRef = { value: false };
39740
39740
  return {
39741
+ cloudSessionId: options.cloudSessionId,
39741
39742
  cwd: options.cwd,
39742
39743
  onFileChange: options.onFileChange,
39743
39744
  mcpServers: options.mcpServers ?? [],
@@ -39830,6 +39831,41 @@ function createCursorAcpHandle(options) {
39830
39831
  // src/agents/acp/clients/cursor/cursor-acp-init.ts
39831
39832
  import * as readline from "node:readline";
39832
39833
 
39834
+ // src/agents/acp/clients/cursor/cursor-incoming-cursor-create-plan.ts
39835
+ function buildCursorCreatePlanToolCallUpdate(requestId, params) {
39836
+ const toolCallId = params.toolCallId ?? params.tool_call_id;
39837
+ if (typeof toolCallId !== "string" || !toolCallId.trim()) return null;
39838
+ const name = typeof params.name === "string" ? params.name.trim() : "";
39839
+ const overview = typeof params.overview === "string" ? params.overview : void 0;
39840
+ const plan = typeof params.plan === "string" ? params.plan : "";
39841
+ const todos = Array.isArray(params.todos) ? params.todos : void 0;
39842
+ const phases = Array.isArray(params.phases) ? params.phases : void 0;
39843
+ const isProject = typeof params.isProject === "boolean" ? params.isProject : void 0;
39844
+ return {
39845
+ sessionUpdate: "tool_call",
39846
+ toolCallId,
39847
+ title: name || "Plan",
39848
+ status: "pending",
39849
+ cursorPlan: {
39850
+ requestId,
39851
+ ...name ? { name } : {},
39852
+ ...overview != null ? { overview } : {},
39853
+ plan,
39854
+ ...todos != null ? { todos } : {},
39855
+ ...phases != null ? { phases } : {},
39856
+ ...isProject != null ? { isProject } : {}
39857
+ }
39858
+ };
39859
+ }
39860
+ function queueCursorCreatePlanRequest(method, id, msg, deps) {
39861
+ const params = msg.params ?? {};
39862
+ const requestId = String(id);
39863
+ deps.pendingRequests.set(id, { method, params });
39864
+ const update = buildCursorCreatePlanToolCallUpdate(requestId, params);
39865
+ if (update) deps.onSessionUpdate?.(update);
39866
+ deps.onRequest?.({ requestId, method, params });
39867
+ }
39868
+
39833
39869
  // src/agents/acp/clients/cursor/cursor-incoming-cursor-task.ts
39834
39870
  function buildCursorTaskToolCallUpdate(params) {
39835
39871
  const toolCallId = params.toolCallId ?? params.tool_call_id;
@@ -39840,6 +39876,7 @@ function buildCursorTaskToolCallUpdate(params) {
39840
39876
  const model = typeof params.model === "string" ? params.model : void 0;
39841
39877
  const agentId = typeof params.agentId === "string" ? params.agentId : typeof params.agent_id === "string" ? params.agent_id : void 0;
39842
39878
  const durationMs = typeof params.durationMs === "number" ? params.durationMs : typeof params.duration_ms === "number" ? params.duration_ms : void 0;
39879
+ const isBackground = typeof params.isBackground === "boolean" ? params.isBackground : typeof params.is_background === "boolean" ? params.is_background : typeof params.runInBackground === "boolean" ? params.runInBackground : typeof params.run_in_background === "boolean" ? params.run_in_background : void 0;
39843
39880
  return {
39844
39881
  sessionUpdate: "tool_call_update",
39845
39882
  toolCallId,
@@ -39850,7 +39887,8 @@ function buildCursorTaskToolCallUpdate(params) {
39850
39887
  ...subagentType != null ? { subagentType } : {},
39851
39888
  ...model != null ? { model } : {},
39852
39889
  ...agentId != null ? { agentId } : {},
39853
- ...durationMs != null ? { durationMs } : {}
39890
+ ...durationMs != null ? { durationMs } : {},
39891
+ ...isBackground != null ? { isBackground } : {}
39854
39892
  }
39855
39893
  };
39856
39894
  }
@@ -39862,9 +39900,13 @@ function handleCursorIncomingCursorTask(id, msg, deps) {
39862
39900
  }
39863
39901
 
39864
39902
  // src/agents/acp/clients/cursor/cursor-incoming-cursor-methods.ts
39865
- var CURSOR_BRIDGE_METHODS = /* @__PURE__ */ new Set(["cursor/create_plan", "cursor/ask_question"]);
39903
+ var CURSOR_BRIDGE_METHODS = /* @__PURE__ */ new Set(["cursor/ask_question"]);
39866
39904
  var CURSOR_NOOP_METHODS = /* @__PURE__ */ new Set(["cursor/update_todos", "cursor/generate_image"]);
39867
39905
  function handleCursorIncomingCursorMethods(method, id, msg, deps) {
39906
+ if (method === "cursor/create_plan") {
39907
+ queueCursorCreatePlanRequest(method, id, msg, deps);
39908
+ return true;
39909
+ }
39868
39910
  if (CURSOR_BRIDGE_METHODS.has(method)) {
39869
39911
  const params = msg.params ?? {};
39870
39912
  deps.pendingRequests.set(id, { method, params });
@@ -39978,10 +40020,71 @@ function handleCursorIncomingPermissionRequest(id, method, msg, deps) {
39978
40020
  return true;
39979
40021
  }
39980
40022
 
40023
+ // src/agents/acp/clients/cursor/write-create-plan-file.ts
40024
+ import * as fs24 from "node:fs";
40025
+ import * as path29 from "node:path";
40026
+ import { pathToFileURL as pathToFileURL2 } from "node:url";
40027
+
40028
+ // src/paths/session-plans-paths.ts
40029
+ import * as os8 from "node:os";
40030
+ import * as path28 from "node:path";
40031
+ function getSessionPlansRootDir() {
40032
+ return path28.join(os8.homedir(), ".buildautomaton", "plans");
40033
+ }
40034
+ function sanitizeSessionPlansKey(sessionId) {
40035
+ const t = sessionId.replace(/[^a-zA-Z0-9_-]+/g, "_").slice(0, 220);
40036
+ return t || "session";
40037
+ }
40038
+ function getSessionPlansDir(sessionId) {
40039
+ return path28.join(getSessionPlansRootDir(), sanitizeSessionPlansKey(sessionId));
40040
+ }
40041
+
40042
+ // src/agents/acp/clients/cursor/write-create-plan-file.ts
40043
+ function sanitizePlanFileBase(toolCallId) {
40044
+ const t = toolCallId.replace(/[^a-zA-Z0-9_-]+/g, "_").slice(0, 120);
40045
+ return t || "plan";
40046
+ }
40047
+ function writeCreatePlanFile(params) {
40048
+ const dir = getSessionPlansDir(params.cloudSessionId);
40049
+ fs24.mkdirSync(dir, { recursive: true });
40050
+ const filePath = path29.join(dir, `${sanitizePlanFileBase(params.toolCallId)}.md`);
40051
+ fs24.writeFileSync(filePath, params.planMarkdown, "utf8");
40052
+ return pathToFileURL2(filePath).href;
40053
+ }
40054
+
40055
+ // src/agents/acp/clients/cursor/enrich-create-plan-rpc-result.ts
40056
+ function asRecord2(v) {
40057
+ return v != null && typeof v === "object" && !Array.isArray(v) ? v : null;
40058
+ }
40059
+ function enrichCreatePlanRpcResult(result, pendingParams, cloudSessionId) {
40060
+ const root = asRecord2(result);
40061
+ const outcome = asRecord2(root?.outcome);
40062
+ if (!outcome) return result;
40063
+ const kind = typeof outcome.outcome === "string" ? outcome.outcome : "";
40064
+ if (kind !== "accepted") {
40065
+ const { plan: _drop, ...rest } = outcome;
40066
+ return { ...root, outcome: rest };
40067
+ }
40068
+ const planMarkdown = typeof outcome.plan === "string" ? outcome.plan : "";
40069
+ const toolCallIdRaw = pendingParams.toolCallId ?? pendingParams.tool_call_id;
40070
+ const toolCallId = typeof toolCallIdRaw === "string" ? toolCallIdRaw.trim() : "";
40071
+ const sessionId = cloudSessionId?.trim() ?? "";
40072
+ if (planMarkdown && toolCallId && sessionId) {
40073
+ const planUri = writeCreatePlanFile({ cloudSessionId: sessionId, toolCallId, planMarkdown });
40074
+ return { outcome: { outcome: "accepted", planUri } };
40075
+ }
40076
+ return { outcome: { outcome: "accepted" } };
40077
+ }
40078
+
39981
40079
  // src/agents/acp/clients/cursor/cursor-incoming-resolve-request.ts
39982
- function resolveCursorIncomingRequest(pendingRequests2, respond, requestId, result) {
40080
+ function resolveCursorIncomingRequest(pendingRequests2, respond, requestId, result, cloudSessionId) {
39983
40081
  const pending2 = pendingRequests2.get(requestId);
39984
- const payload = pending2?.method === "session/request_permission" ? enrichAcpPermissionRpcResultFromRequestParams(result, pending2.params) : result;
40082
+ let payload = result;
40083
+ if (pending2?.method === "session/request_permission") {
40084
+ payload = enrichAcpPermissionRpcResultFromRequestParams(result, pending2.params);
40085
+ } else if (pending2?.method === "cursor/create_plan") {
40086
+ payload = enrichCreatePlanRpcResult(result, pending2.params, cloudSessionId ?? void 0);
40087
+ }
39985
40088
  respond(requestId, payload);
39986
40089
  pendingRequests2.delete(requestId);
39987
40090
  }
@@ -40042,7 +40145,13 @@ function createCursorAcpIncomingLineHandler(deps) {
40042
40145
  pendingRequests: deps.pendingRequests
40043
40146
  };
40044
40147
  return {
40045
- resolveRequest: (requestId, result) => resolveCursorIncomingRequest(deps.pendingRequests, deps.respond, requestId, result),
40148
+ resolveRequest: (requestId, result) => resolveCursorIncomingRequest(
40149
+ deps.pendingRequests,
40150
+ deps.respond,
40151
+ requestId,
40152
+ result,
40153
+ deps.sessionCtx.cloudSessionId
40154
+ ),
40046
40155
  handleLine(line) {
40047
40156
  const msg = safeJsonParse(line);
40048
40157
  if (!msg) return;
@@ -40245,6 +40354,7 @@ async function createCursorAcpClient(options) {
40245
40354
  const skipBrowserAuthenticate = cursorAgentUsesApiKeyAuth(spawnEnv);
40246
40355
  const sessionCtx = createCursorAcpSessionContext({
40247
40356
  cwd,
40357
+ cloudSessionId: options.cloudSessionId,
40248
40358
  mcpServers: options.mcpServers,
40249
40359
  persistedAcpSessionId,
40250
40360
  backendAgentType,
@@ -40394,18 +40504,18 @@ import { existsSync as existsSync4, statSync } from "node:fs";
40394
40504
 
40395
40505
  // src/git/get-git-repo-root-sync.ts
40396
40506
  import { execFileSync as execFileSync3 } from "node:child_process";
40397
- import * as path28 from "node:path";
40507
+ import * as path30 from "node:path";
40398
40508
  var GIT_LOOKUP_TIMEOUT_MS = 2e3;
40399
40509
  function getGitRepoRootSync(startDir) {
40400
40510
  try {
40401
40511
  const out = execFileSync3("git", ["rev-parse", "--show-toplevel"], {
40402
- cwd: path28.resolve(startDir),
40512
+ cwd: path30.resolve(startDir),
40403
40513
  encoding: "utf8",
40404
40514
  stdio: ["ignore", "pipe", "ignore"],
40405
40515
  maxBuffer: 1024 * 1024,
40406
40516
  timeout: GIT_LOOKUP_TIMEOUT_MS
40407
40517
  }).trim();
40408
- return out ? path28.resolve(out) : null;
40518
+ return out ? path30.resolve(out) : null;
40409
40519
  } catch {
40410
40520
  return null;
40411
40521
  }
@@ -40414,26 +40524,26 @@ function getGitRepoRootSync(startDir) {
40414
40524
  // src/agents/acp/workspace-files.ts
40415
40525
  import { execFileSync as execFileSync4 } from "node:child_process";
40416
40526
  import { readFileSync as readFileSync4 } from "node:fs";
40417
- import * as path29 from "node:path";
40527
+ import * as path31 from "node:path";
40418
40528
  var GIT_FILE_READ_TIMEOUT_MS = 2e3;
40419
40529
  function resolveWorkspaceFilePath(sessionParentPath, rawPath) {
40420
40530
  const trimmed2 = rawPath.trim();
40421
40531
  if (!trimmed2) return null;
40422
- const normalizedSessionParent = path29.resolve(sessionParentPath);
40532
+ const normalizedSessionParent = path31.resolve(sessionParentPath);
40423
40533
  let resolvedPath = resolveSafePathUnderCwd(sessionParentPath, trimmed2);
40424
40534
  if (!resolvedPath) {
40425
- const candidate = path29.isAbsolute(trimmed2) ? path29.normalize(trimmed2) : path29.normalize(path29.resolve(normalizedSessionParent, trimmed2));
40535
+ const candidate = path31.isAbsolute(trimmed2) ? path31.normalize(trimmed2) : path31.normalize(path31.resolve(normalizedSessionParent, trimmed2));
40426
40536
  const gitRoot2 = getGitRepoRootSync(sessionParentPath);
40427
40537
  if (!gitRoot2) return null;
40428
- const rel = path29.relative(gitRoot2, candidate);
40429
- if (rel.startsWith("..") || path29.isAbsolute(rel)) return null;
40538
+ const rel = path31.relative(gitRoot2, candidate);
40539
+ if (rel.startsWith("..") || path31.isAbsolute(rel)) return null;
40430
40540
  resolvedPath = candidate;
40431
40541
  }
40432
40542
  const gitRoot = getGitRepoRootSync(sessionParentPath);
40433
40543
  if (gitRoot) {
40434
- const relFromRoot = path29.relative(gitRoot, resolvedPath);
40435
- if (!relFromRoot.startsWith("..") && !path29.isAbsolute(relFromRoot)) {
40436
- return { resolvedPath, display: relFromRoot.split(path29.sep).join("/") };
40544
+ const relFromRoot = path31.relative(gitRoot, resolvedPath);
40545
+ if (!relFromRoot.startsWith("..") && !path31.isAbsolute(relFromRoot)) {
40546
+ return { resolvedPath, display: relFromRoot.split(path31.sep).join("/") };
40437
40547
  }
40438
40548
  }
40439
40549
  return { resolvedPath, display: toDisplayPathRelativeToCwd(sessionParentPath, resolvedPath) };
@@ -40442,9 +40552,9 @@ function readUtf8WorkspaceFile(sessionParentPath, displayPath) {
40442
40552
  if (!displayPath || displayPath.includes("..")) return "";
40443
40553
  const gitRoot = getGitRepoRootSync(sessionParentPath);
40444
40554
  if (gitRoot) {
40445
- const resolvedPath2 = path29.resolve(gitRoot, displayPath);
40446
- const rel = path29.relative(gitRoot, resolvedPath2);
40447
- if (!rel.startsWith("..") && !path29.isAbsolute(rel)) {
40555
+ const resolvedPath2 = path31.resolve(gitRoot, displayPath);
40556
+ const rel = path31.relative(gitRoot, resolvedPath2);
40557
+ if (!rel.startsWith("..") && !path31.isAbsolute(rel)) {
40448
40558
  try {
40449
40559
  return readFileSync4(resolvedPath2, "utf8");
40450
40560
  } catch {
@@ -40463,9 +40573,9 @@ function tryWorkspaceDisplayToPath(sessionParentPath, displayPath) {
40463
40573
  if (!displayPath || displayPath.includes("..")) return null;
40464
40574
  const gitRoot = getGitRepoRootSync(sessionParentPath);
40465
40575
  if (gitRoot) {
40466
- const resolvedPath = path29.resolve(gitRoot, displayPath);
40467
- const rel = path29.relative(gitRoot, resolvedPath);
40468
- if (!rel.startsWith("..") && !path29.isAbsolute(rel)) return resolvedPath;
40576
+ const resolvedPath = path31.resolve(gitRoot, displayPath);
40577
+ const rel = path31.relative(gitRoot, resolvedPath);
40578
+ if (!rel.startsWith("..") && !path31.isAbsolute(rel)) return resolvedPath;
40469
40579
  }
40470
40580
  return resolveSafePathUnderCwd(sessionParentPath, displayPath);
40471
40581
  }
@@ -41352,11 +41462,11 @@ init_cli_process_interrupt();
41352
41462
  var BRIDGE_MCP_SERVER_NAME2 = "buildautomaton-bridge";
41353
41463
 
41354
41464
  // src/mcp/resolve-bridge-mcp-server-path.ts
41355
- import { dirname as dirname7, join as join8 } from "node:path";
41465
+ import { dirname as dirname7, join as join10 } from "node:path";
41356
41466
  import { fileURLToPath as fileURLToPath7 } from "node:url";
41357
41467
  function resolveBridgeMcpServerScriptPath() {
41358
41468
  const cliDir = dirname7(fileURLToPath7(import.meta.url));
41359
- return join8(cliDir, "bridge-mcp-server.js");
41469
+ return join10(cliDir, "bridge-mcp-server.js");
41360
41470
  }
41361
41471
 
41362
41472
  // src/mcp/build-acp-mcp-servers.ts
@@ -41415,7 +41525,7 @@ async function ensureAcpClient(options) {
41415
41525
  if (state.acpStartPromise && !state.acpHandle) {
41416
41526
  await state.acpStartPromise;
41417
41527
  }
41418
- if (state.acpHandle && state.lastAcpCwd != null && path30.resolve(state.lastAcpCwd) !== path30.resolve(targetSessionParentPath)) {
41528
+ if (state.acpHandle && state.lastAcpCwd != null && path32.resolve(state.lastAcpCwd) !== path32.resolve(targetSessionParentPath)) {
41419
41529
  try {
41420
41530
  state.acpHandle.disconnect();
41421
41531
  } catch {
@@ -41447,7 +41557,7 @@ async function ensureAcpClient(options) {
41447
41557
  if (!state.acpStartPromise) {
41448
41558
  let statOk = false;
41449
41559
  try {
41450
- const st = await fs24.promises.stat(targetSessionParentPath);
41560
+ const st = await fs25.promises.stat(targetSessionParentPath);
41451
41561
  statOk = st.isDirectory();
41452
41562
  if (!statOk) {
41453
41563
  state.lastAcpStartError = `Agent cwd is not a directory: ${targetSessionParentPath}`;
@@ -41526,6 +41636,7 @@ async function ensureAcpClient(options) {
41526
41636
  },
41527
41637
  ...hooks,
41528
41638
  cwd: targetSessionParentPath,
41639
+ cloudSessionId: cloudSessionId ?? null,
41529
41640
  mcpServers
41530
41641
  }).then(async (h) => {
41531
41642
  if (spawnEpoch !== state.clientEpoch || isCliImmediateShutdownRequested()) {
@@ -41745,8 +41856,8 @@ async function execGitFile(args, options) {
41745
41856
  }
41746
41857
 
41747
41858
  // src/git/changes/parse/normalize-git-diff-path.ts
41748
- function normalizeGitDiffPath(path88) {
41749
- return path88.replace(/\\/g, "/").replace(/\/ +/g, "/").trim();
41859
+ function normalizeGitDiffPath(path90) {
41860
+ return path90.replace(/\\/g, "/").replace(/\/ +/g, "/").trim();
41750
41861
  }
41751
41862
 
41752
41863
  // src/git/changes/parse/parse-name-status-entries.ts
@@ -41785,7 +41896,7 @@ function parseNameStatusLines(lines) {
41785
41896
  }
41786
41897
 
41787
41898
  // src/git/snapshot/diff/messages.ts
41788
- import * as path31 from "node:path";
41899
+ import * as path33 from "node:path";
41789
41900
 
41790
41901
  // src/git/snapshot/diff/files.ts
41791
41902
  import { readFile as readFile2, stat as stat2 } from "node:fs/promises";
@@ -41816,7 +41927,7 @@ async function buildTrackedChangeMessage(options) {
41816
41927
  const diffArgs = entry.change === "moved" && oldRel ? ["diff", "--no-color", "-M", baselineRev, "--", oldRel, rel] : ["diff", "--no-color", "-M", baselineRev, "--", rel];
41817
41928
  const { stdout: patchContent } = await execGitFile(diffArgs, { cwd: repoPath });
41818
41929
  if (!patchContent.trim()) return null;
41819
- const workspaceFilePath = path31.join(repoPath, rel);
41930
+ const workspaceFilePath = path33.join(repoPath, rel);
41820
41931
  const newText = entry.change === "removed" ? "" : await readWorkspaceFileAsUtf8(workspaceFilePath);
41821
41932
  const oldText = entry.change === "added" ? "" : await readGitBlobAsUtf8(repoPath, baselineRev, oldRel ?? rel);
41822
41933
  return {
@@ -41848,9 +41959,9 @@ function buildUntrackedChangeMessage(options) {
41848
41959
  }
41849
41960
 
41850
41961
  // src/git/snapshot/diff/paths.ts
41851
- import * as path32 from "node:path";
41962
+ import * as path34 from "node:path";
41852
41963
  function repoDisplayPath(repoPath, multiRepo) {
41853
- const slug = path32.basename(repoPath).replace(/[^\w.-]+/g, "_") || "repo";
41964
+ const slug = path34.basename(repoPath).replace(/[^\w.-]+/g, "_") || "repo";
41854
41965
  return (rel) => multiRepo ? `${slug}/${rel}` : rel;
41855
41966
  }
41856
41967
  function safeRelPath(rel) {
@@ -41862,12 +41973,12 @@ function newUntrackedPaths(raw, baselineUntracked, seen) {
41862
41973
  }
41863
41974
 
41864
41975
  // src/git/snapshot/diff/move-pairs.ts
41865
- import * as path33 from "node:path";
41976
+ import * as path35 from "node:path";
41866
41977
  async function readUntrackedTexts(repoPath, untracked) {
41867
41978
  const out = /* @__PURE__ */ new Map();
41868
41979
  await forEachWithGitYield(untracked, async (rel) => {
41869
41980
  if (!safeRelPath(rel)) return;
41870
- const newText = await readWorkspaceFileAsUtf8(path33.join(repoPath, rel));
41981
+ const newText = await readWorkspaceFileAsUtf8(path35.join(repoPath, rel));
41871
41982
  if (newText !== void 0) out.set(rel, newText);
41872
41983
  });
41873
41984
  return out;
@@ -41984,12 +42095,12 @@ async function collectRepoTurnChanges(options) {
41984
42095
  import { readFile as readFile3 } from "node:fs/promises";
41985
42096
 
41986
42097
  // src/git/snapshot/types.ts
41987
- import * as path34 from "node:path";
42098
+ import * as path36 from "node:path";
41988
42099
  function snapshotsDirForCwd(agentCwd) {
41989
- return path34.join(agentCwd, ".buildautomaton", "snapshots");
42100
+ return path36.join(agentCwd, ".buildautomaton", "snapshots");
41990
42101
  }
41991
42102
  function snapshotFilePath(agentCwd, runId) {
41992
- return path34.join(snapshotsDirForCwd(agentCwd), `${runId}.json`);
42103
+ return path36.join(snapshotsDirForCwd(agentCwd), `${runId}.json`);
41993
42104
  }
41994
42105
 
41995
42106
  // src/git/snapshot/diff/load-pre-turn-snapshot.ts
@@ -42057,6 +42168,18 @@ function reportPostTurnEnrichment(options) {
42057
42168
  });
42058
42169
  }
42059
42170
 
42171
+ // src/agents/acp/clients/cursor/cleanup-session-plans.ts
42172
+ import * as fs26 from "node:fs";
42173
+ function cleanupSessionPlans(sessionId) {
42174
+ const id = typeof sessionId === "string" ? sessionId.trim() : "";
42175
+ if (!id) return;
42176
+ const dir = getSessionPlansDir(id);
42177
+ try {
42178
+ fs26.rmSync(dir, { recursive: true, force: true });
42179
+ } catch {
42180
+ }
42181
+ }
42182
+
42060
42183
  // src/agents/acp/prompts/finalize-and-send-prompt-result.ts
42061
42184
  async function finalizeAndSendPromptResult(params) {
42062
42185
  const {
@@ -42074,6 +42197,7 @@ async function finalizeAndSendPromptResult(params) {
42074
42197
  sendSessionUpdate,
42075
42198
  log: log2
42076
42199
  } = params;
42200
+ cleanupSessionPlans(sessionId);
42077
42201
  const planningTodosSubmit = isPlanningSession ? await maybeSubmitPlanningTodosAfterAgentSuccess({
42078
42202
  sessionId,
42079
42203
  runId,
@@ -43197,7 +43321,7 @@ async function createBridgeAccessState(options = {}) {
43197
43321
  }
43198
43322
 
43199
43323
  // src/agents/capabilities/warmup-agent-capabilities-on-connect.ts
43200
- import * as path36 from "node:path";
43324
+ import * as path38 from "node:path";
43201
43325
 
43202
43326
  // src/agents/detect-local-agent-types.ts
43203
43327
  init_yield_to_event_loop();
@@ -43302,7 +43426,7 @@ function listCliAgentCapabilityCacheForWorkspace(db, workspaceId) {
43302
43426
  init_cli_database();
43303
43427
 
43304
43428
  // src/agents/capabilities/probe-one-agent-type-for-capabilities.ts
43305
- import * as path35 from "node:path";
43429
+ import * as path37 from "node:path";
43306
43430
  init_cli_database();
43307
43431
  init_cli_process_interrupt();
43308
43432
  async function probeOneAgentTypeForCapabilities(params) {
@@ -43342,7 +43466,7 @@ async function probeOneAgentTypeForCapabilities(params) {
43342
43466
  if (!canContinue()) return false;
43343
43467
  handle = await resolved.createClient({
43344
43468
  command: resolved.command,
43345
- cwd: path35.resolve(cwd),
43469
+ cwd: path37.resolve(cwd),
43346
43470
  backendAgentType: agentType,
43347
43471
  sessionMode: "agent",
43348
43472
  persistedAcpSessionId: null,
@@ -43435,7 +43559,7 @@ async function warmupAgentCapabilitiesOnConnect(params) {
43435
43559
  const { workspaceId, log: log2, getWs } = params;
43436
43560
  const isCurrent = beginAgentCapabilityWarmupRun();
43437
43561
  if (!isCurrent()) return;
43438
- const cwd = path36.resolve(getBridgeRoot());
43562
+ const cwd = path38.resolve(getBridgeRoot());
43439
43563
  async function sendBatchFromCache() {
43440
43564
  if (!isCurrent()) return;
43441
43565
  const socket = getWs();
@@ -43562,7 +43686,7 @@ async function createBridgeAccessAndAcp(options) {
43562
43686
  }
43563
43687
 
43564
43688
  // src/connection/create-bridge-preview-stack.ts
43565
- import * as path39 from "node:path";
43689
+ import * as path41 from "node:path";
43566
43690
 
43567
43691
  // src/preview-environments/manager/firehose-messages.ts
43568
43692
  function buildFirehoseSnapshotMessage(params) {
@@ -43880,7 +44004,7 @@ function attachChildErrorHandler(d) {
43880
44004
  }
43881
44005
 
43882
44006
  // src/preview-environments/process/wire/handle-exit.ts
43883
- import fs25 from "node:fs";
44007
+ import fs27 from "node:fs";
43884
44008
  function logStopLine(d, code, signal) {
43885
44009
  const { title } = d;
43886
44010
  if (signal) {
@@ -43919,7 +44043,7 @@ function attachChildExitHandler(d) {
43919
44043
  const cleanupDir = d.mergedCleanupDir;
43920
44044
  const mergedPath = d.mergedLogPath;
43921
44045
  if (mergedPath && !stale) {
43922
- fs25.readFile(mergedPath, (err, buf) => {
44046
+ fs27.readFile(mergedPath, (err, buf) => {
43923
44047
  if (!err && buf.length > d.mergedReadPos.value) {
43924
44048
  const chunk = Buffer.from(buf.subarray(d.mergedReadPos.value));
43925
44049
  if (chunk.length > 0) {
@@ -43965,7 +44089,7 @@ function wireChildOutputPipes(d) {
43965
44089
  }
43966
44090
 
43967
44091
  // src/preview-environments/process/wire/poll-merged-log.ts
43968
- import fs26 from "node:fs";
44092
+ import fs28 from "node:fs";
43969
44093
  function startMergedLogPoll(d) {
43970
44094
  if (!d.mergedLogPath || !d.mergedCleanupDir) return;
43971
44095
  const { environmentId } = d;
@@ -43975,7 +44099,7 @@ function startMergedLogPoll(d) {
43975
44099
  d.setPollInterval(void 0);
43976
44100
  return;
43977
44101
  }
43978
- fs26.readFile(d.mergedLogPath, (err, buf) => {
44102
+ fs28.readFile(d.mergedLogPath, (err, buf) => {
43979
44103
  if (err || (d.getSpawnGeneration() ?? 0) !== d.scheduledGen) return;
43980
44104
  if (buf.length <= d.mergedReadPos.value) return;
43981
44105
  const chunk = Buffer.from(buf.subarray(d.mergedReadPos.value));
@@ -44190,7 +44314,7 @@ function previewEnvironmentSpawnOptions(lifecycle = DEFAULT_PREVIEW_ENVIRONMENT_
44190
44314
  }
44191
44315
 
44192
44316
  // src/preview-environments/manager/shell-spawn/utils.ts
44193
- import fs27 from "node:fs";
44317
+ import fs29 from "node:fs";
44194
44318
  function mergePreviewEnvironmentSpawnOptions(opts, lifecycle = DEFAULT_PREVIEW_ENVIRONMENT_PROCESS_LIFECYCLE) {
44195
44319
  return { ...opts, ...previewEnvironmentSpawnOptions(lifecycle) };
44196
44320
  }
@@ -44199,7 +44323,7 @@ function isSpawnEbadf(e) {
44199
44323
  }
44200
44324
  function rmDirQuiet(dir) {
44201
44325
  try {
44202
- fs27.rmSync(dir, { recursive: true, force: true });
44326
+ fs29.rmSync(dir, { recursive: true, force: true });
44203
44327
  } catch {
44204
44328
  }
44205
44329
  }
@@ -44207,7 +44331,7 @@ var cachedDevNullReadFd;
44207
44331
  function devNullReadFd() {
44208
44332
  if (cachedDevNullReadFd === void 0) {
44209
44333
  const devPath = process.platform === "win32" ? "nul" : "/dev/null";
44210
- cachedDevNullReadFd = fs27.openSync(devPath, "r");
44334
+ cachedDevNullReadFd = fs29.openSync(devPath, "r");
44211
44335
  }
44212
44336
  return cachedDevNullReadFd;
44213
44337
  }
@@ -44287,15 +44411,15 @@ function trySpawnShellTruePiped(command, env, cwd, devNullFd, signal, lifecycle)
44287
44411
 
44288
44412
  // src/preview-environments/manager/shell-spawn/try-spawn-merged-log-file.ts
44289
44413
  import { spawn as spawn6 } from "node:child_process";
44290
- import fs28 from "node:fs";
44414
+ import fs30 from "node:fs";
44291
44415
  import { tmpdir } from "node:os";
44292
- import path37 from "node:path";
44416
+ import path39 from "node:path";
44293
44417
  function trySpawnMergedLogFile(command, env, cwd, signal, lifecycle) {
44294
- const tmpRoot = fs28.mkdtempSync(path37.join(tmpdir(), "ba-devsrv-log-"));
44295
- const logPath = path37.join(tmpRoot, "combined.log");
44418
+ const tmpRoot = fs30.mkdtempSync(path39.join(tmpdir(), "ba-devsrv-log-"));
44419
+ const logPath = path39.join(tmpRoot, "combined.log");
44296
44420
  let logFd;
44297
44421
  try {
44298
- logFd = fs28.openSync(logPath, "a");
44422
+ logFd = fs30.openSync(logPath, "a");
44299
44423
  } catch {
44300
44424
  rmDirQuiet(tmpRoot);
44301
44425
  return null;
@@ -44319,7 +44443,7 @@ function trySpawnMergedLogFile(command, env, cwd, signal, lifecycle) {
44319
44443
  mergePreviewEnvironmentSpawnOptions({ env, cwd, stdio, ...signal ? { signal } : {} }, lifecycle)
44320
44444
  );
44321
44445
  }
44322
- fs28.closeSync(logFd);
44446
+ fs30.closeSync(logFd);
44323
44447
  return {
44324
44448
  proc,
44325
44449
  pipedStdoutStderr: true,
@@ -44328,7 +44452,7 @@ function trySpawnMergedLogFile(command, env, cwd, signal, lifecycle) {
44328
44452
  };
44329
44453
  } catch (e) {
44330
44454
  try {
44331
- fs28.closeSync(logFd);
44455
+ fs30.closeSync(logFd);
44332
44456
  } catch {
44333
44457
  }
44334
44458
  rmDirQuiet(tmpRoot);
@@ -44339,22 +44463,22 @@ function trySpawnMergedLogFile(command, env, cwd, signal, lifecycle) {
44339
44463
 
44340
44464
  // src/preview-environments/manager/shell-spawn/try-spawn-shell-script-log-redirect.ts
44341
44465
  import { spawn as spawn7 } from "node:child_process";
44342
- import fs29 from "node:fs";
44466
+ import fs31 from "node:fs";
44343
44467
  import { tmpdir as tmpdir2 } from "node:os";
44344
- import path38 from "node:path";
44468
+ import path40 from "node:path";
44345
44469
  function shSingleQuote(s) {
44346
44470
  return `'${s.replace(/'/g, `'\\''`)}'`;
44347
44471
  }
44348
44472
  function trySpawnShellScriptLogRedirectUnix(command, env, cwd, signal, lifecycle) {
44349
- const tmpRoot = fs29.mkdtempSync(path38.join(tmpdir2(), "ba-devsrv-sh-"));
44350
- const logPath = path38.join(tmpRoot, "combined.log");
44351
- const innerPath = path38.join(tmpRoot, "_cmd.sh");
44352
- const runnerPath = path38.join(tmpRoot, "_run.sh");
44473
+ const tmpRoot = fs31.mkdtempSync(path40.join(tmpdir2(), "ba-devsrv-sh-"));
44474
+ const logPath = path40.join(tmpRoot, "combined.log");
44475
+ const innerPath = path40.join(tmpRoot, "_cmd.sh");
44476
+ const runnerPath = path40.join(tmpRoot, "_run.sh");
44353
44477
  try {
44354
- fs29.writeFileSync(innerPath, `#!/bin/sh
44478
+ fs31.writeFileSync(innerPath, `#!/bin/sh
44355
44479
  ${command}
44356
44480
  `);
44357
- fs29.writeFileSync(
44481
+ fs31.writeFileSync(
44358
44482
  runnerPath,
44359
44483
  `#!/bin/sh
44360
44484
  cd ${shSingleQuote(cwd)}
@@ -44382,13 +44506,13 @@ cd ${shSingleQuote(cwd)}
44382
44506
  }
44383
44507
  }
44384
44508
  function trySpawnShellScriptLogRedirectWin(command, env, cwd, signal, lifecycle) {
44385
- const tmpRoot = fs29.mkdtempSync(path38.join(tmpdir2(), "ba-devsrv-sh-"));
44386
- const logPath = path38.join(tmpRoot, "combined.log");
44387
- const runnerPath = path38.join(tmpRoot, "_run.bat");
44509
+ const tmpRoot = fs31.mkdtempSync(path40.join(tmpdir2(), "ba-devsrv-sh-"));
44510
+ const logPath = path40.join(tmpRoot, "combined.log");
44511
+ const runnerPath = path40.join(tmpRoot, "_run.bat");
44388
44512
  const q = (p) => `"${p.replace(/"/g, '""')}"`;
44389
44513
  const com = process.env.ComSpec || "cmd.exe";
44390
44514
  try {
44391
- fs29.writeFileSync(
44515
+ fs31.writeFileSync(
44392
44516
  runnerPath,
44393
44517
  `@ECHO OFF\r
44394
44518
  CD /D ${q(cwd)}\r
@@ -44706,8 +44830,8 @@ function createBridgePreviewStack(options) {
44706
44830
  scheduleInitialIndexBuilds(getBridgeRoot());
44707
44831
  };
44708
44832
  const identifyReportedPaths = {
44709
- bridgeRootPath: path39.resolve(getBridgeRoot()),
44710
- worktreesRootPath: path39.resolve(options.worktreesRootPath),
44833
+ bridgeRootPath: path41.resolve(getBridgeRoot()),
44834
+ worktreesRootPath: path41.resolve(options.worktreesRootPath),
44711
44835
  localShortcutPort: 0,
44712
44836
  localShortcutToken: ""
44713
44837
  };
@@ -45670,17 +45794,17 @@ async function yieldSkillDiscoveryWork(entryCount) {
45670
45794
  }
45671
45795
 
45672
45796
  // src/skills/discovery/discover-local-skills.ts
45673
- import fs30 from "node:fs";
45674
- import path40 from "node:path";
45797
+ import fs32 from "node:fs";
45798
+ import path42 from "node:path";
45675
45799
  function collectSkillFromDir(rel, base, name, seenKeys, out) {
45676
- const dir = path40.join(base, name);
45800
+ const dir = path42.join(base, name);
45677
45801
  try {
45678
- if (!fs30.statSync(dir).isDirectory()) return;
45802
+ if (!fs32.statSync(dir).isDirectory()) return;
45679
45803
  } catch {
45680
45804
  return;
45681
45805
  }
45682
- const skillMd = path40.join(dir, "SKILL.md");
45683
- if (!fs30.existsSync(skillMd)) return;
45806
+ const skillMd = path42.join(dir, "SKILL.md");
45807
+ if (!fs32.existsSync(skillMd)) return;
45684
45808
  const key = `${rel}/${name}`;
45685
45809
  if (seenKeys.has(key)) return;
45686
45810
  seenKeys.add(key);
@@ -45692,11 +45816,11 @@ async function discoverLocalSkillsAsync(cwd) {
45692
45816
  let work = 0;
45693
45817
  for (const rel of SKILL_DISCOVERY_ROOTS) {
45694
45818
  await yieldSkillDiscoveryWork(++work);
45695
- const base = path40.join(cwd, rel);
45696
- if (!fs30.existsSync(base) || !fs30.statSync(base).isDirectory()) continue;
45819
+ const base = path42.join(cwd, rel);
45820
+ if (!fs32.existsSync(base) || !fs32.statSync(base).isDirectory()) continue;
45697
45821
  let entries = [];
45698
45822
  try {
45699
- entries = fs30.readdirSync(base);
45823
+ entries = fs32.readdirSync(base);
45700
45824
  } catch {
45701
45825
  continue;
45702
45826
  }
@@ -45709,16 +45833,16 @@ async function discoverLocalSkillsAsync(cwd) {
45709
45833
  }
45710
45834
 
45711
45835
  // src/skills/discovery/discover-skill-layout-roots.ts
45712
- import fs31 from "node:fs";
45713
- import path41 from "node:path";
45836
+ import fs33 from "node:fs";
45837
+ import path43 from "node:path";
45714
45838
  function collectLayoutSkill(rel, base, name, skills2) {
45715
- const dir = path41.join(base, name);
45839
+ const dir = path43.join(base, name);
45716
45840
  try {
45717
- if (!fs31.statSync(dir).isDirectory()) return;
45841
+ if (!fs33.statSync(dir).isDirectory()) return;
45718
45842
  } catch {
45719
45843
  return;
45720
45844
  }
45721
- if (!fs31.existsSync(path41.join(dir, "SKILL.md"))) return;
45845
+ if (!fs33.existsSync(path43.join(dir, "SKILL.md"))) return;
45722
45846
  const relPath = `${rel}/${name}`.replace(/\\/g, "/");
45723
45847
  skills2.push({ name, relPath });
45724
45848
  }
@@ -45727,11 +45851,11 @@ async function discoverSkillLayoutRootsAsync(cwd) {
45727
45851
  let work = 0;
45728
45852
  for (const rel of SKILL_DISCOVERY_ROOTS) {
45729
45853
  await yieldSkillDiscoveryWork(++work);
45730
- const base = path41.join(cwd, rel);
45731
- if (!fs31.existsSync(base) || !fs31.statSync(base).isDirectory()) continue;
45854
+ const base = path43.join(cwd, rel);
45855
+ if (!fs33.existsSync(base) || !fs33.statSync(base).isDirectory()) continue;
45732
45856
  let entries = [];
45733
45857
  try {
45734
- entries = fs31.readdirSync(base);
45858
+ entries = fs33.readdirSync(base);
45735
45859
  } catch {
45736
45860
  continue;
45737
45861
  }
@@ -45878,12 +46002,12 @@ function createBridgeRuntimeMessageSetup(options) {
45878
46002
  }
45879
46003
 
45880
46004
  // src/worktrees/worktree-layout-file.ts
45881
- import * as fs32 from "node:fs";
45882
- import * as path42 from "node:path";
45883
- import os8 from "node:os";
46005
+ import * as fs34 from "node:fs";
46006
+ import * as path44 from "node:path";
46007
+ import os9 from "node:os";
45884
46008
  var LAYOUT_FILENAME = "worktree-launcher-layout.json";
45885
46009
  function defaultWorktreeLayoutPath() {
45886
- return path42.join(os8.homedir(), ".buildautomaton", LAYOUT_FILENAME);
46010
+ return path44.join(os9.homedir(), ".buildautomaton", LAYOUT_FILENAME);
45887
46011
  }
45888
46012
  function normalizeLoadedLayout(raw) {
45889
46013
  if (raw && typeof raw === "object" && "launcherCwds" in raw) {
@@ -45895,8 +46019,8 @@ function normalizeLoadedLayout(raw) {
45895
46019
  function loadWorktreeLayout() {
45896
46020
  try {
45897
46021
  const p = defaultWorktreeLayoutPath();
45898
- if (!fs32.existsSync(p)) return { launcherCwds: [] };
45899
- const raw = JSON.parse(fs32.readFileSync(p, "utf8"));
46022
+ if (!fs34.existsSync(p)) return { launcherCwds: [] };
46023
+ const raw = JSON.parse(fs34.readFileSync(p, "utf8"));
45900
46024
  return normalizeLoadedLayout(raw);
45901
46025
  } catch {
45902
46026
  return { launcherCwds: [] };
@@ -45904,24 +46028,24 @@ function loadWorktreeLayout() {
45904
46028
  }
45905
46029
  function saveWorktreeLayout(layout) {
45906
46030
  try {
45907
- const dir = path42.dirname(defaultWorktreeLayoutPath());
45908
- fs32.mkdirSync(dir, { recursive: true });
45909
- fs32.writeFileSync(defaultWorktreeLayoutPath(), JSON.stringify(layout, null, 2), "utf8");
46031
+ const dir = path44.dirname(defaultWorktreeLayoutPath());
46032
+ fs34.mkdirSync(dir, { recursive: true });
46033
+ fs34.writeFileSync(defaultWorktreeLayoutPath(), JSON.stringify(layout, null, 2), "utf8");
45910
46034
  } catch {
45911
46035
  }
45912
46036
  }
45913
46037
  function baseNameSafe(pathString) {
45914
- return path42.basename(pathString).replace(/[^a-zA-Z0-9._-]+/g, "-") || "cwd";
46038
+ return path44.basename(pathString).replace(/[^a-zA-Z0-9._-]+/g, "-") || "cwd";
45915
46039
  }
45916
46040
  function getLauncherDirNameIfPresent(layout, bridgeRootPath2) {
45917
- const norm = path42.resolve(bridgeRootPath2);
45918
- const existing = layout.launcherCwds.find((e) => path42.resolve(e.absolutePath) === norm);
46041
+ const norm = path44.resolve(bridgeRootPath2);
46042
+ const existing = layout.launcherCwds.find((e) => path44.resolve(e.absolutePath) === norm);
45919
46043
  return existing?.dirName;
45920
46044
  }
45921
46045
  function allocateDirNameForLauncherCwd(layout, bridgeRootPath2) {
45922
46046
  const existing = getLauncherDirNameIfPresent(layout, bridgeRootPath2);
45923
46047
  if (existing) return existing;
45924
- const norm = path42.resolve(bridgeRootPath2);
46048
+ const norm = path44.resolve(bridgeRootPath2);
45925
46049
  const base = baseNameSafe(norm);
45926
46050
  const used = new Set(layout.launcherCwds.map((e) => e.dirName));
45927
46051
  let name = base;
@@ -46014,8 +46138,8 @@ function pathspec(...paths) {
46014
46138
  cache.set(key, paths);
46015
46139
  return key;
46016
46140
  }
46017
- function isPathSpec(path88) {
46018
- return path88 instanceof String && cache.has(path88);
46141
+ function isPathSpec(path90) {
46142
+ return path90 instanceof String && cache.has(path90);
46019
46143
  }
46020
46144
  function toPaths(pathSpec) {
46021
46145
  return cache.get(pathSpec) || [];
@@ -46104,8 +46228,8 @@ function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
46104
46228
  function forEachLineWithContent(input, callback) {
46105
46229
  return toLinesWithContent(input, true).map((line) => callback(line));
46106
46230
  }
46107
- function folderExists(path88) {
46108
- return (0, import_file_exists.exists)(path88, import_file_exists.FOLDER);
46231
+ function folderExists(path90) {
46232
+ return (0, import_file_exists.exists)(path90, import_file_exists.FOLDER);
46109
46233
  }
46110
46234
  function append(target, item) {
46111
46235
  if (Array.isArray(target)) {
@@ -46509,8 +46633,8 @@ function checkIsRepoRootTask() {
46509
46633
  commands,
46510
46634
  format: "utf-8",
46511
46635
  onError,
46512
- parser(path88) {
46513
- return /^\.(git)?$/.test(path88.trim());
46636
+ parser(path90) {
46637
+ return /^\.(git)?$/.test(path90.trim());
46514
46638
  }
46515
46639
  };
46516
46640
  }
@@ -46944,11 +47068,11 @@ function parseGrep(grep) {
46944
47068
  const paths = /* @__PURE__ */ new Set();
46945
47069
  const results = {};
46946
47070
  forEachLineWithContent(grep, (input) => {
46947
- const [path88, line, preview] = input.split(NULL);
46948
- paths.add(path88);
46949
- (results[path88] = results[path88] || []).push({
47071
+ const [path90, line, preview] = input.split(NULL);
47072
+ paths.add(path90);
47073
+ (results[path90] = results[path90] || []).push({
46950
47074
  line: asNumber(line),
46951
- path: path88,
47075
+ path: path90,
46952
47076
  preview
46953
47077
  });
46954
47078
  });
@@ -47713,14 +47837,14 @@ var init_hash_object = __esm2({
47713
47837
  init_task();
47714
47838
  }
47715
47839
  });
47716
- function parseInit(bare, path88, text) {
47840
+ function parseInit(bare, path90, text) {
47717
47841
  const response = String(text).trim();
47718
47842
  let result;
47719
47843
  if (result = initResponseRegex.exec(response)) {
47720
- return new InitSummary(bare, path88, false, result[1]);
47844
+ return new InitSummary(bare, path90, false, result[1]);
47721
47845
  }
47722
47846
  if (result = reInitResponseRegex.exec(response)) {
47723
- return new InitSummary(bare, path88, true, result[1]);
47847
+ return new InitSummary(bare, path90, true, result[1]);
47724
47848
  }
47725
47849
  let gitDir = "";
47726
47850
  const tokens = response.split(" ");
@@ -47731,7 +47855,7 @@ function parseInit(bare, path88, text) {
47731
47855
  break;
47732
47856
  }
47733
47857
  }
47734
- return new InitSummary(bare, path88, /^re/i.test(response), gitDir);
47858
+ return new InitSummary(bare, path90, /^re/i.test(response), gitDir);
47735
47859
  }
47736
47860
  var InitSummary;
47737
47861
  var initResponseRegex;
@@ -47740,9 +47864,9 @@ var init_InitSummary = __esm2({
47740
47864
  "src/lib/responses/InitSummary.ts"() {
47741
47865
  "use strict";
47742
47866
  InitSummary = class {
47743
- constructor(bare, path88, existing, gitDir) {
47867
+ constructor(bare, path90, existing, gitDir) {
47744
47868
  this.bare = bare;
47745
- this.path = path88;
47869
+ this.path = path90;
47746
47870
  this.existing = existing;
47747
47871
  this.gitDir = gitDir;
47748
47872
  }
@@ -47754,7 +47878,7 @@ var init_InitSummary = __esm2({
47754
47878
  function hasBareCommand(command) {
47755
47879
  return command.includes(bareCommand);
47756
47880
  }
47757
- function initTask(bare = false, path88, customArgs) {
47881
+ function initTask(bare = false, path90, customArgs) {
47758
47882
  const commands = ["init", ...customArgs];
47759
47883
  if (bare && !hasBareCommand(commands)) {
47760
47884
  commands.splice(1, 0, bareCommand);
@@ -47763,7 +47887,7 @@ function initTask(bare = false, path88, customArgs) {
47763
47887
  commands,
47764
47888
  format: "utf-8",
47765
47889
  parser(text) {
47766
- return parseInit(commands.includes("--bare"), path88, text);
47890
+ return parseInit(commands.includes("--bare"), path90, text);
47767
47891
  }
47768
47892
  };
47769
47893
  }
@@ -48579,12 +48703,12 @@ var init_FileStatusSummary = __esm2({
48579
48703
  "use strict";
48580
48704
  fromPathRegex = /^(.+)\0(.+)$/;
48581
48705
  FileStatusSummary = class {
48582
- constructor(path88, index, working_dir) {
48583
- this.path = path88;
48706
+ constructor(path90, index, working_dir) {
48707
+ this.path = path90;
48584
48708
  this.index = index;
48585
48709
  this.working_dir = working_dir;
48586
48710
  if (index === "R" || working_dir === "R") {
48587
- const detail = fromPathRegex.exec(path88) || [null, path88, path88];
48711
+ const detail = fromPathRegex.exec(path90) || [null, path90, path90];
48588
48712
  this.from = detail[2] || "";
48589
48713
  this.path = detail[1] || "";
48590
48714
  }
@@ -48615,14 +48739,14 @@ function splitLine(result, lineStr) {
48615
48739
  default:
48616
48740
  return;
48617
48741
  }
48618
- function data(index, workingDir, path88) {
48742
+ function data(index, workingDir, path90) {
48619
48743
  const raw = `${index}${workingDir}`;
48620
48744
  const handler = parsers6.get(raw);
48621
48745
  if (handler) {
48622
- handler(result, path88);
48746
+ handler(result, path90);
48623
48747
  }
48624
48748
  if (raw !== "##" && raw !== "!!") {
48625
- result.files.push(new FileStatusSummary(path88, index, workingDir));
48749
+ result.files.push(new FileStatusSummary(path90, index, workingDir));
48626
48750
  }
48627
48751
  }
48628
48752
  }
@@ -48931,9 +49055,9 @@ var init_simple_git_api = __esm2({
48931
49055
  next
48932
49056
  );
48933
49057
  }
48934
- hashObject(path88, write) {
49058
+ hashObject(path90, write) {
48935
49059
  return this._runTask(
48936
- hashObjectTask(path88, write === true),
49060
+ hashObjectTask(path90, write === true),
48937
49061
  trailingFunctionArgument(arguments)
48938
49062
  );
48939
49063
  }
@@ -49286,8 +49410,8 @@ var init_branch = __esm2({
49286
49410
  }
49287
49411
  });
49288
49412
  function toPath(input) {
49289
- const path88 = input.trim().replace(/^["']|["']$/g, "");
49290
- return path88 && normalize3(path88);
49413
+ const path90 = input.trim().replace(/^["']|["']$/g, "");
49414
+ return path90 && normalize3(path90);
49291
49415
  }
49292
49416
  var parseCheckIgnore;
49293
49417
  var init_CheckIgnore = __esm2({
@@ -49601,8 +49725,8 @@ __export2(sub_module_exports, {
49601
49725
  subModuleTask: () => subModuleTask,
49602
49726
  updateSubModuleTask: () => updateSubModuleTask
49603
49727
  });
49604
- function addSubModuleTask(repo, path88) {
49605
- return subModuleTask(["add", repo, path88]);
49728
+ function addSubModuleTask(repo, path90) {
49729
+ return subModuleTask(["add", repo, path90]);
49606
49730
  }
49607
49731
  function initSubModuleTask(customArgs) {
49608
49732
  return subModuleTask(["init", ...customArgs]);
@@ -49935,8 +50059,8 @@ var require_git = __commonJS2({
49935
50059
  }
49936
50060
  return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
49937
50061
  };
49938
- Git2.prototype.submoduleAdd = function(repo, path88, then) {
49939
- return this._runTask(addSubModuleTask2(repo, path88), trailingFunctionArgument2(arguments));
50062
+ Git2.prototype.submoduleAdd = function(repo, path90, then) {
50063
+ return this._runTask(addSubModuleTask2(repo, path90), trailingFunctionArgument2(arguments));
49940
50064
  };
49941
50065
  Git2.prototype.submoduleUpdate = function(args, then) {
49942
50066
  return this._runTask(
@@ -50675,8 +50799,8 @@ function parseNumstatEntries(lines) {
50675
50799
  }
50676
50800
  function parseNumstat(lines) {
50677
50801
  const m = /* @__PURE__ */ new Map();
50678
- for (const [path88, entry] of parseNumstatEntries(lines)) {
50679
- m.set(path88, { additions: entry.additions, deletions: entry.deletions });
50802
+ for (const [path90, entry] of parseNumstatEntries(lines)) {
50803
+ m.set(path90, { additions: entry.additions, deletions: entry.deletions });
50680
50804
  }
50681
50805
  return m;
50682
50806
  }
@@ -50805,7 +50929,7 @@ async function resolveDefaultRemoteBranchSha(g, remote) {
50805
50929
  }
50806
50930
 
50807
50931
  // src/git/commits/remote-tracking/resolve-base-sha-for-unpushed-commits.ts
50808
- import * as path43 from "node:path";
50932
+ import * as path45 from "node:path";
50809
50933
  var BASE_SHA_CACHE_TTL_MS = 3e4;
50810
50934
  var baseShaCache = /* @__PURE__ */ new Map();
50811
50935
  async function resolveBaseShaForUnpushedCommitsUncached(g) {
@@ -50816,7 +50940,7 @@ async function resolveBaseShaForUnpushedCommitsUncached(g) {
50816
50940
  }
50817
50941
  async function resolveBaseShaForUnpushedCommits(g, repoDir) {
50818
50942
  if (repoDir) {
50819
- const key = path43.resolve(repoDir);
50943
+ const key = path45.resolve(repoDir);
50820
50944
  const now = Date.now();
50821
50945
  const cached2 = baseShaCache.get(key);
50822
50946
  if (cached2 && cached2.expiresAt > now) return cached2.baseSha;
@@ -50951,17 +51075,17 @@ function formatRemoteDisplayLabel(remoteUrl) {
50951
51075
  }
50952
51076
 
50953
51077
  // src/git/changes/repo/get-working-tree-change-repo-details.ts
50954
- import * as path53 from "node:path";
51078
+ import * as path55 from "node:path";
50955
51079
 
50956
51080
  // src/git/changes/repo/build-working-tree-change-repo-detail.ts
50957
- import * as path52 from "node:path";
51081
+ import * as path54 from "node:path";
50958
51082
 
50959
51083
  // src/git/is-git-repo.ts
50960
- import * as fs33 from "node:fs";
50961
- import * as path44 from "node:path";
51084
+ import * as fs35 from "node:fs";
51085
+ import * as path46 from "node:path";
50962
51086
  async function isGitRepoDirectory(dirPath) {
50963
51087
  try {
50964
- await fs33.promises.access(path44.join(dirPath, ".git"));
51088
+ await fs35.promises.access(path46.join(dirPath, ".git"));
50965
51089
  return true;
50966
51090
  } catch {
50967
51091
  return false;
@@ -50969,8 +51093,8 @@ async function isGitRepoDirectory(dirPath) {
50969
51093
  }
50970
51094
 
50971
51095
  // src/git/changes/listing/apply-untracked-file-stats.ts
50972
- import * as fs34 from "node:fs";
50973
- import * as path45 from "node:path";
51096
+ import * as fs36 from "node:fs";
51097
+ import * as path47 from "node:path";
50974
51098
 
50975
51099
  // src/git/changes/lines/count-lines.ts
50976
51100
  import { createReadStream } from "node:fs";
@@ -51002,7 +51126,7 @@ function createUntrackedStatsApplier(options) {
51002
51126
  if (!options.untrackedSet.has(pathInRepo)) return;
51003
51127
  if (options.nameByPath.has(pathInRepo)) return;
51004
51128
  if (row.change === "moved") return;
51005
- const repoFilePath = path45.join(options.repoGitCwd, pathInRepo);
51129
+ const repoFilePath = path47.join(options.repoGitCwd, pathInRepo);
51006
51130
  const fromGit = await numstatFromGitNoIndex(options.g, pathInRepo);
51007
51131
  if (fromGit) {
51008
51132
  row.additions = fromGit.additions;
@@ -51010,7 +51134,7 @@ function createUntrackedStatsApplier(options) {
51010
51134
  return;
51011
51135
  }
51012
51136
  try {
51013
- const st = await fs34.promises.stat(repoFilePath);
51137
+ const st = await fs36.promises.stat(repoFilePath);
51014
51138
  row.additions = st.isFile() ? await countTextFileLines(repoFilePath) : 0;
51015
51139
  } catch {
51016
51140
  row.additions = 0;
@@ -51087,7 +51211,7 @@ async function buildChangedFileRowsFromPaths(options) {
51087
51211
  }
51088
51212
 
51089
51213
  // src/git/changes/listing/enrich-working-tree-file-rows.ts
51090
- import * as path47 from "node:path";
51214
+ import * as path49 from "node:path";
51091
51215
 
51092
51216
  // src/git/changes/patch/patch-truncate.ts
51093
51217
  function truncatePatch(s) {
@@ -51175,10 +51299,10 @@ async function readGitBlobLines(repoCwd, pathInRepo) {
51175
51299
  }
51176
51300
 
51177
51301
  // src/git/changes/patch/hydrate/read-worktree-file-lines.ts
51178
- import * as fs35 from "node:fs";
51302
+ import * as fs37 from "node:fs";
51179
51303
  async function readWorktreeFileLines(filePath) {
51180
51304
  try {
51181
- const raw = await fs35.promises.readFile(filePath, "utf8");
51305
+ const raw = await fs37.promises.readFile(filePath, "utf8");
51182
51306
  return raw.split(/\r?\n/);
51183
51307
  } catch {
51184
51308
  return null;
@@ -51316,8 +51440,8 @@ async function unifiedDiffForFileInRange(repoCwd, range, pathInRepo, change, mov
51316
51440
  }
51317
51441
 
51318
51442
  // src/git/changes/total-lines/resolve-changed-file-total-lines.ts
51319
- import * as fs36 from "node:fs";
51320
- import * as path46 from "node:path";
51443
+ import * as fs38 from "node:fs";
51444
+ import * as path48 from "node:path";
51321
51445
  var MAX_BYTES = 512e3;
51322
51446
  async function countLinesInGitRef(repoGitCwd, ref, pathInRepo) {
51323
51447
  const spec = `${ref}:${pathInRepo}`;
@@ -51337,13 +51461,13 @@ async function countLinesInGitRef(repoGitCwd, ref, pathInRepo) {
51337
51461
  }
51338
51462
  async function resolveWorkingTreeFileTotalLines(options) {
51339
51463
  if (options.isBinary) return null;
51340
- const filePath = path46.join(options.repoGitCwd, options.pathInRepo);
51464
+ const filePath = path48.join(options.repoGitCwd, options.pathInRepo);
51341
51465
  if (options.change === "removed") {
51342
51466
  return countLinesInGitRef(options.repoGitCwd, "HEAD", options.pathInRepo);
51343
51467
  }
51344
51468
  if (options.change === "moved" || options.change === "modified") {
51345
51469
  try {
51346
- const st = await fs36.promises.stat(filePath);
51470
+ const st = await fs38.promises.stat(filePath);
51347
51471
  if (!st.isFile()) return null;
51348
51472
  return await countTextFileLines(filePath);
51349
51473
  } catch {
@@ -51386,7 +51510,7 @@ async function enrichWorkingTreeFileRows(options) {
51386
51510
  row.workspaceRelPath,
51387
51511
  options.repoPathRelativeToWorkspaceRoot
51388
51512
  );
51389
- const filePath = path47.join(options.repoGitCwd, filePathRelativeToRepoRoot);
51513
+ const filePath = path49.join(options.repoGitCwd, filePathRelativeToRepoRoot);
51390
51514
  const hydrateKind = row.change === "moved" ? "modified" : row.change;
51391
51515
  let patch = await unifiedDiffForFile(
51392
51516
  options.repoGitCwd,
@@ -51544,7 +51668,7 @@ async function listChangedFilesForRepo(repoGitCwd, repoPathRelativeToWorkspaceRo
51544
51668
  }
51545
51669
 
51546
51670
  // src/git/changes/listing/list-changed-files-for-commit.ts
51547
- import * as path48 from "node:path";
51671
+ import * as path50 from "node:path";
51548
51672
 
51549
51673
  // src/git/changes/listing/enrich-commit-file-rows.ts
51550
51674
  async function enrichCommitFileRows(options) {
@@ -51589,7 +51713,7 @@ async function parentForCommitDiff(g, sha) {
51589
51713
  var COMMIT_FILES_CACHE_TTL_MS = 5 * 6e4;
51590
51714
  var commitFilesCache = /* @__PURE__ */ new Map();
51591
51715
  function commitFilesCacheKey(repoGitCwd, commitSha) {
51592
- return `${path48.resolve(repoGitCwd)}:${commitSha}`;
51716
+ return `${path50.resolve(repoGitCwd)}:${commitSha}`;
51593
51717
  }
51594
51718
  async function listChangedFilesForCommit(repoGitCwd, repoPathRelativeToWorkspaceRoot, commitSha, options = {}) {
51595
51719
  const cacheKey = commitFilesCacheKey(repoGitCwd, commitSha);
@@ -51644,7 +51768,7 @@ async function listChangedFilesForCommit(repoGitCwd, repoPathRelativeToWorkspace
51644
51768
  }
51645
51769
 
51646
51770
  // src/git/commits/list-unpushed-commits.ts
51647
- import * as path49 from "node:path";
51771
+ import * as path51 from "node:path";
51648
51772
 
51649
51773
  // src/git/commits/lib/parse-log-lines.ts
51650
51774
  function parseLogShaDateSubjectLines(raw) {
@@ -51679,7 +51803,7 @@ async function gitLogNotReachableFromBase(g, baseSha, headSha) {
51679
51803
  }
51680
51804
  }
51681
51805
  async function listUnpushedCommits(repoDir) {
51682
- const key = path49.resolve(repoDir);
51806
+ const key = path51.resolve(repoDir);
51683
51807
  const now = Date.now();
51684
51808
  const cached2 = unpushedCache.get(key);
51685
51809
  if (cached2 && cached2.expiresAt > now) return cached2.commits;
@@ -51740,7 +51864,7 @@ async function loadRecentAndUnpushedCommitsForRepoDetail(repoDir, recentCommitsL
51740
51864
  }
51741
51865
 
51742
51866
  // src/git/changes/repo/load-working-tree-change-repo-git-info.ts
51743
- import * as path50 from "node:path";
51867
+ import * as path52 from "node:path";
51744
51868
 
51745
51869
  // src/git/remote-origin-url.ts
51746
51870
  async function getRemoteOriginUrl(gitDir) {
@@ -51755,7 +51879,7 @@ async function getRemoteOriginUrl(gitDir) {
51755
51879
 
51756
51880
  // src/git/changes/repo/load-working-tree-change-repo-git-info.ts
51757
51881
  async function loadWorkingTreeChangeRepoGitInfo(checkoutPath) {
51758
- const resolvedCheckoutPath = path50.resolve(checkoutPath);
51882
+ const resolvedCheckoutPath = path52.resolve(checkoutPath);
51759
51883
  const git = cliSimpleGit(resolvedCheckoutPath);
51760
51884
  await yieldToEventLoop2();
51761
51885
  const [branch, remoteUrl] = await Promise.all([
@@ -51770,14 +51894,14 @@ async function loadWorkingTreeChangeRepoGitInfo(checkoutPath) {
51770
51894
  }
51771
51895
 
51772
51896
  // src/git/changes/repo/resolve-repo-path-relative-to-workspace-root.ts
51773
- import * as path51 from "node:path";
51897
+ import * as path53 from "node:path";
51774
51898
  async function resolveRepoPathRelativeToWorkspaceRoot(options) {
51775
- const checkoutPath = path51.resolve(options.checkoutPath);
51899
+ const checkoutPath = path53.resolve(options.checkoutPath);
51776
51900
  const git = cliSimpleGit(checkoutPath);
51777
- const sessionParentPath = options.sessionParentPath ? path51.resolve(options.sessionParentPath) : null;
51901
+ const sessionParentPath = options.sessionParentPath ? path53.resolve(options.sessionParentPath) : null;
51778
51902
  let repoPathRelativeToWorkspaceRoot;
51779
51903
  if (sessionParentPath) {
51780
- const checkoutPathRelativeToSessionParent = path51.relative(sessionParentPath, checkoutPath);
51904
+ const checkoutPathRelativeToSessionParent = path53.relative(sessionParentPath, checkoutPath);
51781
51905
  repoPathRelativeToWorkspaceRoot = checkoutPathRelativeToSessionParent === "" ? "." : checkoutPathRelativeToSessionParent.replace(/\\/g, "/");
51782
51906
  } else {
51783
51907
  let gitTopLevel = checkoutPath;
@@ -51787,8 +51911,8 @@ async function resolveRepoPathRelativeToWorkspaceRoot(options) {
51787
51911
  } catch {
51788
51912
  gitTopLevel = checkoutPath;
51789
51913
  }
51790
- const gitTopLevelRelativeToBridgeRoot = path51.relative(options.bridgeRoot, path51.resolve(gitTopLevel)).replace(/\\/g, "/") || ".";
51791
- repoPathRelativeToWorkspaceRoot = gitTopLevelRelativeToBridgeRoot.startsWith("..") ? path51.basename(path51.resolve(gitTopLevel)) : gitTopLevelRelativeToBridgeRoot;
51914
+ const gitTopLevelRelativeToBridgeRoot = path53.relative(options.bridgeRoot, path53.resolve(gitTopLevel)).replace(/\\/g, "/") || ".";
51915
+ repoPathRelativeToWorkspaceRoot = gitTopLevelRelativeToBridgeRoot.startsWith("..") ? path53.basename(path53.resolve(gitTopLevel)) : gitTopLevelRelativeToBridgeRoot;
51792
51916
  }
51793
51917
  return normalizeRepoPathRelativeToWorkspaceRoot(
51794
51918
  repoPathRelativeToWorkspaceRoot === "" ? "." : repoPathRelativeToWorkspaceRoot
@@ -51797,10 +51921,10 @@ async function resolveRepoPathRelativeToWorkspaceRoot(options) {
51797
51921
 
51798
51922
  // src/git/changes/repo/build-working-tree-change-repo-detail.ts
51799
51923
  async function buildWorkingTreeChangeRepoDetail(options) {
51800
- const checkoutPath = path52.resolve(options.targetPath);
51924
+ const checkoutPath = path54.resolve(options.targetPath);
51801
51925
  if (!await isGitRepoDirectory(checkoutPath)) return null;
51802
51926
  const isCommitView = options.basis.kind === "commit";
51803
- const sessionParentPath = options.sessionParentPath ? path52.resolve(options.sessionParentPath) : null;
51927
+ const sessionParentPath = options.sessionParentPath ? path54.resolve(options.sessionParentPath) : null;
51804
51928
  const git = cliSimpleGit(checkoutPath);
51805
51929
  const repoPathRelativeToWorkspaceRoot = await resolveRepoPathRelativeToWorkspaceRoot({
51806
51930
  checkoutPath,
@@ -51848,8 +51972,8 @@ async function buildWorkingTreeChangeRepoDetail(options) {
51848
51972
 
51849
51973
  // src/git/changes/repo/get-working-tree-change-repo-details.ts
51850
51974
  async function getWorkingTreeChangeRepoDetails(options) {
51851
- const bridgeRoot = path53.resolve(getBridgeRoot());
51852
- const sessionParentPath = options.sessionParentPath ? path53.resolve(options.sessionParentPath) : null;
51975
+ const bridgeRoot = path55.resolve(getBridgeRoot());
51976
+ const sessionParentPath = options.sessionParentPath ? path55.resolve(options.sessionParentPath) : null;
51853
51977
  const out = [];
51854
51978
  const filter = options.repoFilterRelPath != null ? normalizeRepoPathRelativeToWorkspaceRoot(options.repoFilterRelPath) : null;
51855
51979
  const basisInput = options.basis ?? { kind: "working" };
@@ -51880,9 +52004,9 @@ async function getWorkingTreeChangeRepoDetails(options) {
51880
52004
  }
51881
52005
 
51882
52006
  // src/git/changes/repo/get-working-tree-change-file-patch.ts
51883
- import * as path54 from "node:path";
52007
+ import * as path56 from "node:path";
51884
52008
  async function getWorkingTreeChangeFilePatch(options) {
51885
- const repoGitCwd = path54.resolve(options.repoGitCwd);
52009
+ const repoGitCwd = path56.resolve(options.repoGitCwd);
51886
52010
  if (!await isGitRepoDirectory(repoGitCwd)) {
51887
52011
  throw new Error("Not a git repository");
51888
52012
  }
@@ -51921,7 +52045,7 @@ async function getWorkingTreeChangeFilePatch(options) {
51921
52045
  });
51922
52046
  return { patchContent: patchContent2, totalLines: totalLines2 };
51923
52047
  }
51924
- const filePath = path54.join(repoGitCwd, filePathRelativeToRepoRoot);
52048
+ const filePath = path56.join(repoGitCwd, filePathRelativeToRepoRoot);
51925
52049
  const hydrateKind = options.change === "moved" ? "modified" : options.change;
51926
52050
  let patchContent = await unifiedDiffForFile(
51927
52051
  repoGitCwd,
@@ -51967,18 +52091,18 @@ function parseWorkingTreeChangeKind(value) {
51967
52091
  }
51968
52092
 
51969
52093
  // src/worktrees/manager/git/get-session-working-tree-change-file-patch.ts
51970
- import * as path55 from "node:path";
52094
+ import * as path57 from "node:path";
51971
52095
  async function getSessionWorkingTreeChangeFilePatch(cache2, sessionId, discover, opts) {
51972
52096
  const targets = await resolveCommitTargetsAsync(sessionId, cache2, discover);
51973
- const bridgeRoot = path55.resolve(getBridgeRoot());
51974
- const sessionParentPath = cache2.getSessionParentPath(sessionId) ? path55.resolve(cache2.getSessionParentPath(sessionId)) : null;
52097
+ const bridgeRoot = path57.resolve(getBridgeRoot());
52098
+ const sessionParentPath = cache2.getSessionParentPath(sessionId) ? path57.resolve(cache2.getSessionParentPath(sessionId)) : null;
51975
52099
  const repoPathRelativeToWorkspaceRootFilter = normalizeRepoPathRelativeToWorkspaceRoot(
51976
52100
  opts.repoRelPath.trim()
51977
52101
  );
51978
52102
  let result = null;
51979
52103
  await forEachWithGitYield(targets, async (targetPath) => {
51980
52104
  if (result) return;
51981
- const checkoutPath = path55.resolve(targetPath);
52105
+ const checkoutPath = path57.resolve(targetPath);
51982
52106
  if (!await isGitRepoDirectory(checkoutPath)) return;
51983
52107
  const repoPathRelativeToWorkspaceRoot = await resolveRepoPathRelativeToWorkspaceRoot({
51984
52108
  checkoutPath,
@@ -52011,13 +52135,13 @@ async function pushSessionUpstream(cache2, sessionId, discover) {
52011
52135
  }
52012
52136
 
52013
52137
  // src/worktrees/remove-session-worktrees.ts
52014
- import * as fs39 from "node:fs";
52138
+ import * as fs41 from "node:fs";
52015
52139
 
52016
52140
  // src/git/worktrees/worktree-remove.ts
52017
- import * as fs38 from "node:fs";
52141
+ import * as fs40 from "node:fs";
52018
52142
 
52019
52143
  // src/worktrees/is-removable-session-worktree-checkout-path.ts
52020
- import path56 from "node:path";
52144
+ import path58 from "node:path";
52021
52145
  init_normalize_resolved_path();
52022
52146
  function isBridgeRootCheckoutPath(checkoutPath) {
52023
52147
  return normalizeResolvedPath(checkoutPath) === normalizeResolvedPath(getBridgeRoot());
@@ -52026,23 +52150,23 @@ function isRemovableSessionWorktreeCheckoutPath(checkoutPath, worktreesRootPath)
52026
52150
  if (isBridgeRootCheckoutPath(checkoutPath)) return false;
52027
52151
  const normalized = normalizeResolvedPath(checkoutPath);
52028
52152
  const worktreesRoot = normalizeResolvedPath(worktreesRootPath);
52029
- const rel = path56.relative(worktreesRoot, normalized);
52030
- if (rel === "" || rel.startsWith("..") || path56.isAbsolute(rel)) return false;
52153
+ const rel = path58.relative(worktreesRoot, normalized);
52154
+ if (rel === "" || rel.startsWith("..") || path58.isAbsolute(rel)) return false;
52031
52155
  return true;
52032
52156
  }
52033
52157
 
52034
52158
  // src/git/worktrees/resolve-main-repo-from-git-file.ts
52035
- import * as fs37 from "node:fs";
52036
- import * as path57 from "node:path";
52159
+ import * as fs39 from "node:fs";
52160
+ import * as path59 from "node:path";
52037
52161
  function resolveMainRepoFromWorktreeGitFile(wt) {
52038
- const gitDirFile = path57.join(wt, ".git");
52039
- if (!fs37.existsSync(gitDirFile) || !fs37.statSync(gitDirFile).isFile()) return "";
52040
- const first2 = fs37.readFileSync(gitDirFile, "utf8").trim();
52162
+ const gitDirFile = path59.join(wt, ".git");
52163
+ if (!fs39.existsSync(gitDirFile) || !fs39.statSync(gitDirFile).isFile()) return "";
52164
+ const first2 = fs39.readFileSync(gitDirFile, "utf8").trim();
52041
52165
  const m = first2.match(/^gitdir:\s*(.+)$/im);
52042
52166
  if (!m) return "";
52043
- const gitWorktreePath = path57.resolve(wt, m[1].trim());
52044
- const gitDir = path57.dirname(path57.dirname(gitWorktreePath));
52045
- return path57.dirname(gitDir);
52167
+ const gitWorktreePath = path59.resolve(wt, m[1].trim());
52168
+ const gitDir = path59.dirname(path59.dirname(gitWorktreePath));
52169
+ return path59.dirname(gitDir);
52046
52170
  }
52047
52171
 
52048
52172
  // src/git/worktrees/worktree-remove.ts
@@ -52053,7 +52177,7 @@ async function gitWorktreeRemoveForce(worktreePath) {
52053
52177
  return true;
52054
52178
  }
52055
52179
  if (isBridgeRootCheckoutPath(worktreePath)) return false;
52056
- fs38.rmSync(worktreePath, { recursive: true, force: true });
52180
+ fs40.rmSync(worktreePath, { recursive: true, force: true });
52057
52181
  return true;
52058
52182
  }
52059
52183
 
@@ -52075,7 +52199,7 @@ async function removeSessionWorktrees(paths, worktreesRootPath, log2) {
52075
52199
  log2(`[worktrees] Remove failed for ${wt}: ${e instanceof Error ? e.message : String(e)}`);
52076
52200
  if (isRemovableSessionWorktreeCheckoutPath(wt, worktreesRootPath)) {
52077
52201
  try {
52078
- fs39.rmSync(wt, { recursive: true, force: true });
52202
+ fs41.rmSync(wt, { recursive: true, force: true });
52079
52203
  } catch {
52080
52204
  }
52081
52205
  }
@@ -52131,12 +52255,12 @@ async function renameSessionWorktreeBranch(cache2, sessionId, newBranch, log2) {
52131
52255
  // src/worktrees/discovery/discover-session-worktree-on-disk.ts
52132
52256
  init_cli_process_interrupt();
52133
52257
  init_yield_to_event_loop();
52134
- import * as fs43 from "node:fs";
52135
- import * as path62 from "node:path";
52258
+ import * as fs45 from "node:fs";
52259
+ import * as path64 from "node:path";
52136
52260
 
52137
52261
  // src/worktrees/discovery/collect-worktree-paths.ts
52138
- import * as fs41 from "node:fs";
52139
- import * as path59 from "node:path";
52262
+ import * as fs43 from "node:fs";
52263
+ import * as path61 from "node:path";
52140
52264
 
52141
52265
  // src/worktrees/discovery/disk-walk-constants.ts
52142
52266
  var DISK_WALK_YIELD_EVERY = 64;
@@ -52166,8 +52290,8 @@ function shouldSkipDiskWalkEntry(name) {
52166
52290
  // src/worktrees/discovery/disk-walk-utils.ts
52167
52291
  init_cli_process_interrupt();
52168
52292
  init_yield_to_event_loop();
52169
- import * as fs40 from "node:fs";
52170
- import * as path58 from "node:path";
52293
+ import * as fs42 from "node:fs";
52294
+ import * as path60 from "node:path";
52171
52295
  async function yieldDuringDiskWalk(state) {
52172
52296
  state.entries++;
52173
52297
  if (state.entries % DISK_WALK_YIELD_EVERY !== 0) return true;
@@ -52177,7 +52301,7 @@ async function yieldDuringDiskWalk(state) {
52177
52301
  }
52178
52302
  async function isGitDir(dirPath) {
52179
52303
  try {
52180
- await fs40.promises.access(path58.join(dirPath, ".git"));
52304
+ await fs42.promises.access(path60.join(dirPath, ".git"));
52181
52305
  return true;
52182
52306
  } catch {
52183
52307
  return false;
@@ -52191,23 +52315,23 @@ async function collectGitRepoRootsUnderDirectory(rootPath) {
52191
52315
  const walk = async (dir) => {
52192
52316
  if (!await yieldDuringDiskWalk(state)) return;
52193
52317
  if (await isGitDir(dir)) {
52194
- out.push(path59.resolve(dir));
52318
+ out.push(path61.resolve(dir));
52195
52319
  return;
52196
52320
  }
52197
52321
  let entries;
52198
52322
  try {
52199
- entries = await fs41.promises.readdir(dir, { withFileTypes: true });
52323
+ entries = await fs43.promises.readdir(dir, { withFileTypes: true });
52200
52324
  } catch {
52201
52325
  return;
52202
52326
  }
52203
52327
  for (const e of entries) {
52204
52328
  if (shouldSkipDiskWalkEntry(e.name)) continue;
52205
- const full = path59.join(dir, e.name);
52329
+ const full = path61.join(dir, e.name);
52206
52330
  if (!e.isDirectory()) continue;
52207
52331
  await walk(full);
52208
52332
  }
52209
52333
  };
52210
- await walk(path59.resolve(rootPath));
52334
+ await walk(path61.resolve(rootPath));
52211
52335
  return { paths: [...new Set(out)], entriesVisited: state.entries };
52212
52336
  }
52213
52337
  async function collectWorktreeRootsNamed(root, sessionId, maxDepth = LEGACY_WALK_MAX_DEPTH) {
@@ -52218,16 +52342,16 @@ async function collectWorktreeRootsNamed(root, sessionId, maxDepth = LEGACY_WALK
52218
52342
  if (!await yieldDuringDiskWalk(state)) return;
52219
52343
  let entries;
52220
52344
  try {
52221
- entries = await fs41.promises.readdir(dir, { withFileTypes: true });
52345
+ entries = await fs43.promises.readdir(dir, { withFileTypes: true });
52222
52346
  } catch {
52223
52347
  return;
52224
52348
  }
52225
52349
  for (const e of entries) {
52226
52350
  if (shouldSkipDiskWalkEntry(e.name)) continue;
52227
- const full = path59.join(dir, e.name);
52351
+ const full = path61.join(dir, e.name);
52228
52352
  if (!e.isDirectory()) continue;
52229
52353
  if (e.name === sessionId) {
52230
- if (await isGitDir(full)) out.push(path59.resolve(full));
52354
+ if (await isGitDir(full)) out.push(path61.resolve(full));
52231
52355
  continue;
52232
52356
  }
52233
52357
  if (await isGitDir(full)) continue;
@@ -52239,14 +52363,14 @@ async function collectWorktreeRootsNamed(root, sessionId, maxDepth = LEGACY_WALK
52239
52363
  }
52240
52364
 
52241
52365
  // src/worktrees/discovery/layout-keys-for-bridge-root.ts
52242
- import * as path60 from "node:path";
52366
+ import * as path62 from "node:path";
52243
52367
  function layoutKeysForBridgeRoot(layout, bridgeRoot, keysOnDisk) {
52244
- const bridge = path60.resolve(bridgeRoot);
52368
+ const bridge = path62.resolve(bridgeRoot);
52245
52369
  const preferred = getLauncherDirNameIfPresent(layout, bridgeRoot);
52246
52370
  const relevant = layout.launcherCwds.filter((e) => {
52247
- const entry = path60.resolve(e.absolutePath);
52248
- return bridge === entry || bridge.startsWith(entry + path60.sep) || entry.startsWith(bridge + path60.sep);
52249
- }).sort((a, b) => path60.resolve(b.absolutePath).length - path60.resolve(a.absolutePath).length).map((e) => e.dirName).filter((name) => keysOnDisk.includes(name));
52371
+ const entry = path62.resolve(e.absolutePath);
52372
+ return bridge === entry || bridge.startsWith(entry + path62.sep) || entry.startsWith(bridge + path62.sep);
52373
+ }).sort((a, b) => path62.resolve(b.absolutePath).length - path62.resolve(a.absolutePath).length).map((e) => e.dirName).filter((name) => keysOnDisk.includes(name));
52250
52374
  const ordered = [];
52251
52375
  const seen = /* @__PURE__ */ new Set();
52252
52376
  const add = (k) => {
@@ -52264,19 +52388,19 @@ function layoutKeysForBridgeRoot(layout, bridgeRoot, keysOnDisk) {
52264
52388
  }
52265
52389
 
52266
52390
  // src/worktrees/discovery/try-binding-from-isolated-directory.ts
52267
- import * as fs42 from "node:fs";
52268
- import * as path61 from "node:path";
52391
+ import * as fs44 from "node:fs";
52392
+ import * as path63 from "node:path";
52269
52393
  async function tryBindingFromIsolatedDirectory(scopeDir) {
52270
52394
  let st;
52271
52395
  try {
52272
- st = await fs42.promises.stat(scopeDir);
52396
+ st = await fs44.promises.stat(scopeDir);
52273
52397
  } catch {
52274
52398
  return null;
52275
52399
  }
52276
52400
  if (!st.isDirectory()) return null;
52277
52401
  const { paths: worktreePaths } = await collectGitRepoRootsUnderDirectory(scopeDir);
52278
52402
  if (worktreePaths.length === 0) return null;
52279
- const abs = path61.resolve(scopeDir);
52403
+ const abs = path63.resolve(scopeDir);
52280
52404
  return {
52281
52405
  parentPath: abs,
52282
52406
  repoCheckoutPaths: worktreePaths
@@ -52299,7 +52423,7 @@ async function discoverSessionWorktreeOnDisk(options) {
52299
52423
  const sid = sessionId.trim();
52300
52424
  if (!sid) return null;
52301
52425
  try {
52302
- await fs43.promises.access(worktreesRootPath);
52426
+ await fs45.promises.access(worktreesRootPath);
52303
52427
  } catch {
52304
52428
  return null;
52305
52429
  }
@@ -52308,13 +52432,13 @@ async function discoverSessionWorktreeOnDisk(options) {
52308
52432
  if (preferredKey) keysOnDisk.push(preferredKey);
52309
52433
  const scanState = { entries: 0 };
52310
52434
  try {
52311
- for (const name of await fs43.promises.readdir(worktreesRootPath)) {
52435
+ for (const name of await fs45.promises.readdir(worktreesRootPath)) {
52312
52436
  if (!await yieldDuringDiskWalk(scanState)) break;
52313
52437
  if (name.startsWith(".")) continue;
52314
- const p = path62.join(worktreesRootPath, name);
52438
+ const p = path64.join(worktreesRootPath, name);
52315
52439
  let st;
52316
52440
  try {
52317
- st = await fs43.promises.stat(p);
52441
+ st = await fs45.promises.stat(p);
52318
52442
  } catch {
52319
52443
  continue;
52320
52444
  }
@@ -52328,23 +52452,23 @@ async function discoverSessionWorktreeOnDisk(options) {
52328
52452
  for (const key of keys) {
52329
52453
  if (isCliImmediateShutdownRequested()) return null;
52330
52454
  await yieldToEventLoop();
52331
- const layoutRoot = path62.join(worktreesRootPath, key);
52455
+ const layoutRoot = path64.join(worktreesRootPath, key);
52332
52456
  let layoutSt;
52333
52457
  try {
52334
- layoutSt = await fs43.promises.stat(layoutRoot);
52458
+ layoutSt = await fs45.promises.stat(layoutRoot);
52335
52459
  } catch {
52336
52460
  continue;
52337
52461
  }
52338
52462
  if (!layoutSt.isDirectory()) continue;
52339
- const sessionDir = path62.join(layoutRoot, sid);
52463
+ const sessionDir = path64.join(layoutRoot, sid);
52340
52464
  const nested = await tryBindingFromSessionDirectory(sessionDir);
52341
52465
  if (nested) return nested;
52342
52466
  const legacy = await collectWorktreeRootsNamed(layoutRoot, sid);
52343
52467
  if (legacy.paths.length > 0) {
52344
- const isolated = resolveIsolatedSessionParentPathFromCheckouts(legacy.paths) ?? path62.resolve(legacy.paths[0]);
52468
+ const isolated = resolveIsolatedSessionParentPathFromCheckouts(legacy.paths) ?? path64.resolve(legacy.paths[0]);
52345
52469
  return {
52346
- sessionParentPath: path62.resolve(isolated),
52347
- repoCheckoutPaths: legacy.paths.map((p) => path62.resolve(p))
52470
+ sessionParentPath: path64.resolve(isolated),
52471
+ repoCheckoutPaths: legacy.paths.map((p) => path64.resolve(p))
52348
52472
  };
52349
52473
  }
52350
52474
  }
@@ -52352,31 +52476,31 @@ async function discoverSessionWorktreeOnDisk(options) {
52352
52476
  }
52353
52477
 
52354
52478
  // src/worktrees/discovery/discover-session-worktrees-under-session-worktree-root.ts
52355
- import * as fs44 from "node:fs";
52356
- import * as path64 from "node:path";
52479
+ import * as fs46 from "node:fs";
52480
+ import * as path66 from "node:path";
52357
52481
 
52358
52482
  // src/worktrees/discovery/discover-legacy-binding-ascending-from-checkout.ts
52359
52483
  init_cli_process_interrupt();
52360
52484
  init_yield_to_event_loop();
52361
- import * as path63 from "node:path";
52485
+ import * as path65 from "node:path";
52362
52486
  async function discoverLegacyBindingAscendingFromCheckout(sessionId, checkoutPath) {
52363
52487
  const sid = sessionId.trim();
52364
52488
  if (!sid) return null;
52365
- const hintR = path63.resolve(checkoutPath);
52489
+ const hintR = path65.resolve(checkoutPath);
52366
52490
  let best = null;
52367
- let cur = path63.dirname(hintR);
52491
+ let cur = path65.dirname(hintR);
52368
52492
  for (let i = 0; i < 40; i++) {
52369
52493
  if (isCliImmediateShutdownRequested()) return best;
52370
52494
  await yieldToEventLoop();
52371
52495
  const paths = await collectWorktreeRootsNamed(cur, sid);
52372
- if (paths.paths.some((p) => path63.resolve(p) === hintR)) {
52373
- const isolated = resolveIsolatedSessionParentPathFromCheckouts(paths.paths) ?? path63.resolve(paths.paths[0]);
52496
+ if (paths.paths.some((p) => path65.resolve(p) === hintR)) {
52497
+ const isolated = resolveIsolatedSessionParentPathFromCheckouts(paths.paths) ?? path65.resolve(paths.paths[0]);
52374
52498
  best = {
52375
- sessionParentPath: path63.resolve(isolated),
52376
- repoCheckoutPaths: paths.paths.map((p) => path63.resolve(p))
52499
+ sessionParentPath: path65.resolve(isolated),
52500
+ repoCheckoutPaths: paths.paths.map((p) => path65.resolve(p))
52377
52501
  };
52378
52502
  }
52379
- const next = path63.dirname(cur);
52503
+ const next = path65.dirname(cur);
52380
52504
  if (next === cur) break;
52381
52505
  cur = next;
52382
52506
  }
@@ -52387,12 +52511,12 @@ async function discoverLegacyBindingAscendingFromCheckout(sessionId, checkoutPat
52387
52511
  async function discoverSessionWorktreesUnderSessionWorktreeRoot(sessionParentPathOrHint, sessionId) {
52388
52512
  const sid = sessionId.trim();
52389
52513
  if (!sid) return null;
52390
- const hint = path64.resolve(sessionParentPathOrHint);
52391
- const underHint = await tryBindingFromSessionDirectory(path64.join(hint, sid));
52514
+ const hint = path66.resolve(sessionParentPathOrHint);
52515
+ const underHint = await tryBindingFromSessionDirectory(path66.join(hint, sid));
52392
52516
  if (underHint) return underHint;
52393
52517
  const direct = await tryBindingFromSessionDirectory(hint);
52394
52518
  if (direct) {
52395
- if (path64.basename(hint) === sid && await isGitDir(hint)) {
52519
+ if (path66.basename(hint) === sid && await isGitDir(hint)) {
52396
52520
  const legacyFromCheckout = await discoverLegacyBindingAscendingFromCheckout(sid, hint);
52397
52521
  if (legacyFromCheckout && legacyFromCheckout.repoCheckoutPaths.length > direct.repoCheckoutPaths.length) {
52398
52522
  return legacyFromCheckout;
@@ -52400,23 +52524,23 @@ async function discoverSessionWorktreesUnderSessionWorktreeRoot(sessionParentPat
52400
52524
  }
52401
52525
  return direct;
52402
52526
  }
52403
- if (path64.basename(hint) === sid && await isGitDir(hint)) {
52527
+ if (path66.basename(hint) === sid && await isGitDir(hint)) {
52404
52528
  const legacyFromCheckout = await discoverLegacyBindingAscendingFromCheckout(sid, hint);
52405
52529
  if (legacyFromCheckout) return legacyFromCheckout;
52406
52530
  }
52407
52531
  let st;
52408
52532
  try {
52409
- st = await fs44.promises.stat(hint);
52533
+ st = await fs46.promises.stat(hint);
52410
52534
  } catch {
52411
52535
  return null;
52412
52536
  }
52413
52537
  if (!st.isDirectory()) return null;
52414
52538
  const legacyPaths = await collectWorktreeRootsNamed(hint, sid);
52415
52539
  if (legacyPaths.paths.length === 0) return null;
52416
- const isolated = resolveIsolatedSessionParentPathFromCheckouts(legacyPaths.paths) ?? path64.resolve(legacyPaths.paths[0]);
52540
+ const isolated = resolveIsolatedSessionParentPathFromCheckouts(legacyPaths.paths) ?? path66.resolve(legacyPaths.paths[0]);
52417
52541
  return {
52418
- sessionParentPath: path64.resolve(isolated),
52419
- repoCheckoutPaths: legacyPaths.paths.map((p) => path64.resolve(p))
52542
+ sessionParentPath: path66.resolve(isolated),
52543
+ repoCheckoutPaths: legacyPaths.paths.map((p) => path66.resolve(p))
52420
52544
  };
52421
52545
  }
52422
52546
 
@@ -52477,11 +52601,11 @@ function parseSessionParent(v) {
52477
52601
  }
52478
52602
 
52479
52603
  // src/worktrees/prepare/prepare-new-isolated-worktrees.ts
52480
- import * as fs48 from "node:fs";
52604
+ import * as fs50 from "node:fs";
52481
52605
 
52482
52606
  // src/git/discover-repos.ts
52483
- import * as fs45 from "node:fs";
52484
- import * as path65 from "node:path";
52607
+ import * as fs47 from "node:fs";
52608
+ import * as path67 from "node:path";
52485
52609
  init_yield_to_event_loop();
52486
52610
  var GIT_DISCOVER_YIELD_EVERY = 32;
52487
52611
  async function yieldGitDiscoverWork(entryCount) {
@@ -52491,14 +52615,14 @@ async function yieldGitDiscoverWork(entryCount) {
52491
52615
  }
52492
52616
  async function discoverGitRepos(cwd = getBridgeRoot()) {
52493
52617
  const result = [];
52494
- const cwdResolved = path65.resolve(cwd);
52618
+ const cwdResolved = path67.resolve(cwd);
52495
52619
  if (await isGitRepoDirectory(cwdResolved)) {
52496
52620
  const remoteUrl = await getRemoteOriginUrl(cwdResolved);
52497
52621
  result.push({ absolutePath: cwdResolved, remoteUrl });
52498
52622
  }
52499
52623
  let entries;
52500
52624
  try {
52501
- entries = fs45.readdirSync(cwdResolved, { withFileTypes: true });
52625
+ entries = fs47.readdirSync(cwdResolved, { withFileTypes: true });
52502
52626
  } catch {
52503
52627
  return result;
52504
52628
  }
@@ -52506,7 +52630,7 @@ async function discoverGitRepos(cwd = getBridgeRoot()) {
52506
52630
  await yieldGitDiscoverWork(i + 1);
52507
52631
  const ent = entries[i];
52508
52632
  if (!ent.isDirectory()) continue;
52509
- const childPath2 = path65.join(cwdResolved, ent.name);
52633
+ const childPath2 = path67.join(cwdResolved, ent.name);
52510
52634
  if (await isGitRepoDirectory(childPath2)) {
52511
52635
  const remoteUrl = await getRemoteOriginUrl(childPath2);
52512
52636
  result.push({ absolutePath: childPath2, remoteUrl });
@@ -52515,17 +52639,17 @@ async function discoverGitRepos(cwd = getBridgeRoot()) {
52515
52639
  return result;
52516
52640
  }
52517
52641
  async function discoverGitReposUnderRoot(rootPath) {
52518
- const root = path65.resolve(rootPath);
52642
+ const root = path67.resolve(rootPath);
52519
52643
  const roots = [];
52520
52644
  let walkEntries = 0;
52521
52645
  async function walk(dir) {
52522
52646
  if (await isGitRepoDirectory(dir)) {
52523
- roots.push(path65.resolve(dir));
52647
+ roots.push(path67.resolve(dir));
52524
52648
  return;
52525
52649
  }
52526
52650
  let entries;
52527
52651
  try {
52528
- entries = fs45.readdirSync(dir, { withFileTypes: true });
52652
+ entries = fs47.readdirSync(dir, { withFileTypes: true });
52529
52653
  } catch {
52530
52654
  return;
52531
52655
  }
@@ -52533,7 +52657,7 @@ async function discoverGitReposUnderRoot(rootPath) {
52533
52657
  await yieldGitDiscoverWork(++walkEntries);
52534
52658
  const ent = entries[i];
52535
52659
  if (!ent.isDirectory() || ent.name === ".git") continue;
52536
- await walk(path65.join(dir, ent.name));
52660
+ await walk(path67.join(dir, ent.name));
52537
52661
  }
52538
52662
  }
52539
52663
  await walk(root);
@@ -52549,8 +52673,8 @@ async function discoverGitReposUnderRoot(rootPath) {
52549
52673
  }
52550
52674
 
52551
52675
  // src/worktrees/prepare/add-isolated-repo-worktree.ts
52552
- import * as fs47 from "node:fs";
52553
- import * as path67 from "node:path";
52676
+ import * as fs49 from "node:fs";
52677
+ import * as path69 from "node:path";
52554
52678
 
52555
52679
  // src/git/worktrees/worktree-add.ts
52556
52680
  async function gitWorktreeAddBranch(mainRepoPath, worktreePath, branch, baseRef = "HEAD") {
@@ -52566,8 +52690,8 @@ async function gitWorktreeAddExistingBranch(mainRepoPath, worktreePath, branch)
52566
52690
  }
52567
52691
 
52568
52692
  // src/worktrees/prepare/copy-bridge-files-along-worktree-path.ts
52569
- import * as fs46 from "node:fs";
52570
- import * as path66 from "node:path";
52693
+ import * as fs48 from "node:fs";
52694
+ import * as path68 from "node:path";
52571
52695
  var BRIDGE_FILES_ALONG_WORKTREE_PATH = ["AGENTS.md"];
52572
52696
  function copyBridgeFilesAlongWorktreePath(options) {
52573
52697
  const { bridgeRoot, scopeDir, repoPathRelativeToBridgeRoot, log: log2 } = options;
@@ -52576,19 +52700,19 @@ function copyBridgeFilesAlongWorktreePath(options) {
52576
52700
  const segments = repoPathRelativeToBridgeRoot.split("/").filter(Boolean);
52577
52701
  for (let i = 0; i < segments.length; i++) {
52578
52702
  const prefix = segments.slice(0, i).join("/");
52579
- const bridgeDir = prefix ? path66.join(bridgeRoot, prefix) : bridgeRoot;
52580
- const destDir = prefix ? path66.join(scopeDir, prefix) : scopeDir;
52703
+ const bridgeDir = prefix ? path68.join(bridgeRoot, prefix) : bridgeRoot;
52704
+ const destDir = prefix ? path68.join(scopeDir, prefix) : scopeDir;
52581
52705
  for (const fileName of fileNames) {
52582
52706
  copyFileIfPresent(bridgeDir, destDir, fileName, log2);
52583
52707
  }
52584
52708
  }
52585
52709
  }
52586
52710
  function copyFileIfPresent(srcDir, destDir, fileName, log2) {
52587
- const src = path66.join(srcDir, fileName);
52588
- if (!fs46.existsSync(src)) return;
52589
- const dest = path66.join(destDir, fileName);
52711
+ const src = path68.join(srcDir, fileName);
52712
+ if (!fs48.existsSync(src)) return;
52713
+ const dest = path68.join(destDir, fileName);
52590
52714
  try {
52591
- fs46.copyFileSync(src, dest);
52715
+ fs48.copyFileSync(src, dest);
52592
52716
  log2?.(`[worktrees] Copied ${fileName} to ${dest}`);
52593
52717
  } catch (e) {
52594
52718
  log2?.(
@@ -52620,16 +52744,16 @@ async function addIsolatedRepoWorktree(options) {
52620
52744
  worktreeBaseBranches,
52621
52745
  log: log2
52622
52746
  } = options;
52623
- const repoPathRelativeToBridgeRootRaw = path67.relative(bridgeResolved, repoAbsolutePath);
52624
- if (repoPathRelativeToBridgeRootRaw.startsWith("..") || path67.isAbsolute(repoPathRelativeToBridgeRootRaw)) {
52747
+ const repoPathRelativeToBridgeRootRaw = path69.relative(bridgeResolved, repoAbsolutePath);
52748
+ if (repoPathRelativeToBridgeRootRaw.startsWith("..") || path69.isAbsolute(repoPathRelativeToBridgeRootRaw)) {
52625
52749
  return null;
52626
52750
  }
52627
52751
  const repoPathRelativeToBridgeRoot = normalizeRepoPathRelativeToWorkspaceRoot(
52628
52752
  repoPathRelativeToBridgeRootRaw === "" ? "." : repoPathRelativeToBridgeRootRaw
52629
52753
  );
52630
- const worktreePath = repoPathRelativeToBridgeRoot === "." ? scopeDir : path67.join(scopeDir, repoPathRelativeToBridgeRoot);
52754
+ const worktreePath = repoPathRelativeToBridgeRoot === "." ? scopeDir : path69.join(scopeDir, repoPathRelativeToBridgeRoot);
52631
52755
  if (repoPathRelativeToBridgeRoot !== ".") {
52632
- fs47.mkdirSync(path67.dirname(worktreePath), { recursive: true });
52756
+ fs49.mkdirSync(path69.dirname(worktreePath), { recursive: true });
52633
52757
  copyBridgeFilesAlongWorktreePath({
52634
52758
  bridgeRoot: bridgeResolved,
52635
52759
  scopeDir,
@@ -52657,7 +52781,7 @@ async function addIsolatedRepoWorktree(options) {
52657
52781
  }
52658
52782
 
52659
52783
  // src/worktrees/prepare/resolve-isolated-scope-dir.ts
52660
- import * as path68 from "node:path";
52784
+ import * as path70 from "node:path";
52661
52785
 
52662
52786
  // src/worktrees/worktree-layout-kind.ts
52663
52787
  function sanitizeWorktreeBranchSegment(value) {
@@ -52687,10 +52811,10 @@ function previewDeployBranchName(environmentId) {
52687
52811
 
52688
52812
  // src/worktrees/prepare/resolve-isolated-scope-dir.ts
52689
52813
  function resolveIsolatedScopeDir(options) {
52690
- const bridgeResolved = path68.resolve(options.bridgeRoot);
52814
+ const bridgeResolved = path70.resolve(options.bridgeRoot);
52691
52815
  const cwdKey = allocateDirNameForLauncherCwd(options.layout, bridgeResolved);
52692
- const bridgeKeyDir = path68.join(options.worktreesRootPath, cwdKey);
52693
- const scopeDir = path68.join(bridgeKeyDir, ...layoutDirSegments(options.kind, options.scopeId));
52816
+ const bridgeKeyDir = path70.join(options.worktreesRootPath, cwdKey);
52817
+ const scopeDir = path70.join(bridgeKeyDir, ...layoutDirSegments(options.kind, options.scopeId));
52694
52818
  return { bridgeResolved, scopeDir };
52695
52819
  }
52696
52820
 
@@ -52720,7 +52844,7 @@ async function prepareNewIsolatedWorktrees(options) {
52720
52844
  return null;
52721
52845
  }
52722
52846
  const worktreePaths = [];
52723
- fs48.mkdirSync(scopeDir, { recursive: true });
52847
+ fs50.mkdirSync(scopeDir, { recursive: true });
52724
52848
  await forEachWithGitYield(repos, async (repo) => {
52725
52849
  const worktreePath = await addIsolatedRepoWorktree({
52726
52850
  kind,
@@ -52792,10 +52916,10 @@ async function resolveExistingSessionParentPath(sessionId, cache2, discover) {
52792
52916
  }
52793
52917
 
52794
52918
  // src/worktrees/manager/resolve-explicit-session-parent-path.ts
52795
- import * as path69 from "node:path";
52919
+ import * as path71 from "node:path";
52796
52920
  init_yield_to_event_loop();
52797
52921
  async function resolveExplicitSessionParentPath(params) {
52798
- const resolved = path69.resolve(params.parentPathRaw);
52922
+ const resolved = path71.resolve(params.parentPathRaw);
52799
52923
  if (parseSessionParent(params.sessionParent) !== "worktrees_root") {
52800
52924
  return resolved;
52801
52925
  }
@@ -52812,7 +52936,7 @@ async function resolveExplicitSessionParentPath(params) {
52812
52936
  await yieldToEventLoop();
52813
52937
  const tryRoot = await discoverSessionWorktreesUnderSessionWorktreeRoot(cur, params.sessionId);
52814
52938
  if (tryRoot) return rememberAndReturn(tryRoot);
52815
- const next = path69.dirname(cur);
52939
+ const next = path71.dirname(cur);
52816
52940
  if (next === cur) break;
52817
52941
  cur = next;
52818
52942
  }
@@ -52973,15 +53097,15 @@ var SessionWorktreeManager = class {
52973
53097
  };
52974
53098
 
52975
53099
  // src/worktrees/discovery/discover-preview-worktree-on-disk.ts
52976
- import * as fs49 from "node:fs";
52977
- import * as path70 from "node:path";
53100
+ import * as fs51 from "node:fs";
53101
+ import * as path72 from "node:path";
52978
53102
  init_yield_to_event_loop();
52979
53103
  async function discoverPreviewWorktreeOnDisk(options) {
52980
53104
  const { environmentId, worktreesRootPath, layout, bridgeRoot } = options;
52981
53105
  const eid = environmentId.trim();
52982
53106
  if (!eid) return null;
52983
53107
  try {
52984
- await fs49.promises.access(worktreesRootPath);
53108
+ await fs51.promises.access(worktreesRootPath);
52985
53109
  } catch {
52986
53110
  return null;
52987
53111
  }
@@ -52990,13 +53114,13 @@ async function discoverPreviewWorktreeOnDisk(options) {
52990
53114
  if (preferredKey) keysOnDisk.push(preferredKey);
52991
53115
  const scanState = { entries: 0 };
52992
53116
  try {
52993
- for (const name of await fs49.promises.readdir(worktreesRootPath)) {
53117
+ for (const name of await fs51.promises.readdir(worktreesRootPath)) {
52994
53118
  if (!await yieldDuringDiskWalk(scanState)) break;
52995
53119
  if (name.startsWith(".")) continue;
52996
- const p = path70.join(worktreesRootPath, name);
53120
+ const p = path72.join(worktreesRootPath, name);
52997
53121
  let st;
52998
53122
  try {
52999
- st = await fs49.promises.stat(p);
53123
+ st = await fs51.promises.stat(p);
53000
53124
  } catch {
53001
53125
  continue;
53002
53126
  }
@@ -53010,7 +53134,7 @@ async function discoverPreviewWorktreeOnDisk(options) {
53010
53134
  const previewDirRel = layoutDirSegments("preview_environment", eid);
53011
53135
  for (const key of keys) {
53012
53136
  await yieldToEventLoop();
53013
- const previewDir = path70.join(worktreesRootPath, key, ...previewDirRel);
53137
+ const previewDir = path72.join(worktreesRootPath, key, ...previewDirRel);
53014
53138
  const binding = await tryBindingFromIsolatedDirectory(previewDir);
53015
53139
  if (binding) return binding;
53016
53140
  }
@@ -53137,7 +53261,7 @@ var PreviewWorktreeManager = class {
53137
53261
  };
53138
53262
 
53139
53263
  // src/worktrees/deploy/deploy-session-to-preview-environment.ts
53140
- import * as path74 from "node:path";
53264
+ import * as path76 from "node:path";
53141
53265
 
53142
53266
  // src/git/worktrees/reset-worktree-to-branch.ts
53143
53267
  async function gitResetWorktreeToBranch(worktreePath, branch) {
@@ -53148,8 +53272,8 @@ async function gitResetWorktreeToBranch(worktreePath, branch) {
53148
53272
  }
53149
53273
 
53150
53274
  // src/worktrees/deploy/capture-and-apply-wip.ts
53151
- import * as fs50 from "node:fs";
53152
- import * as path71 from "node:path";
53275
+ import * as fs52 from "node:fs";
53276
+ import * as path73 from "node:path";
53153
53277
 
53154
53278
  // src/git/snapshot/git.ts
53155
53279
  var SNAPSHOT_GIT_TIMEOUT_MS = 5e3;
@@ -53204,12 +53328,12 @@ async function applyWorkingTreeWip(targetRepoPath, sourceRepoPath, wip, log2) {
53204
53328
  if (!ap.ok) return ap;
53205
53329
  }
53206
53330
  await forEachWithGitYield(wip.untrackedPaths, async (rel) => {
53207
- const src = path71.join(sourceRepoPath, rel);
53208
- const dst = path71.join(targetRepoPath, rel);
53331
+ const src = path73.join(sourceRepoPath, rel);
53332
+ const dst = path73.join(targetRepoPath, rel);
53209
53333
  try {
53210
- if (!fs50.existsSync(src)) return;
53211
- fs50.mkdirSync(path71.dirname(dst), { recursive: true });
53212
- fs50.copyFileSync(src, dst);
53334
+ if (!fs52.existsSync(src)) return;
53335
+ fs52.mkdirSync(path73.dirname(dst), { recursive: true });
53336
+ fs52.copyFileSync(src, dst);
53213
53337
  } catch (e) {
53214
53338
  log2(
53215
53339
  `[worktrees] Failed to copy untracked ${rel}: ${e instanceof Error ? e.message : String(e)}`
@@ -53220,14 +53344,14 @@ async function applyWorkingTreeWip(targetRepoPath, sourceRepoPath, wip, log2) {
53220
53344
  }
53221
53345
 
53222
53346
  // src/worktrees/deploy/resolve-isolated-checkout-for-repo-path-relative-to-workspace-root.ts
53223
- import * as path72 from "node:path";
53347
+ import * as path74 from "node:path";
53224
53348
  async function resolveIsolatedCheckoutForRepoPathRelativeToWorkspaceRoot(options) {
53225
53349
  const { checkoutPaths, sessionParentPath, bridgeRoot, repoPathRelativeToWorkspaceRoot } = options;
53226
- const resolvedSessionParentPath = sessionParentPath ? path72.resolve(sessionParentPath) : null;
53350
+ const resolvedSessionParentPath = sessionParentPath ? path74.resolve(sessionParentPath) : null;
53227
53351
  let match = null;
53228
53352
  await forEachWithGitYield(checkoutPaths, async (checkoutPath) => {
53229
53353
  if (match) return;
53230
- const resolvedCheckoutPath = path72.resolve(checkoutPath);
53354
+ const resolvedCheckoutPath = path74.resolve(checkoutPath);
53231
53355
  if (!await isGitRepoDirectory(resolvedCheckoutPath)) return;
53232
53356
  const resolvedRepoPathRelativeToWorkspaceRoot = await resolveRepoPathRelativeToWorkspaceRoot({
53233
53357
  checkoutPath: resolvedCheckoutPath,
@@ -53281,7 +53405,7 @@ async function applySessionWipToPreviewCheckouts(options) {
53281
53405
  }
53282
53406
 
53283
53407
  // src/worktrees/deploy/collect-session-repo-deploy-states.ts
53284
- import * as path73 from "node:path";
53408
+ import * as path75 from "node:path";
53285
53409
 
53286
53410
  // src/git/branches/create-or-update-branch.ts
53287
53411
  async function gitCreateOrUpdateBranch(repoPath, branch, startRef, options) {
@@ -53318,19 +53442,19 @@ async function collectSessionRepoDeployStates(options) {
53318
53442
  const sessionParentPath = sessionWorktreeManager.getSessionParentPath(sid);
53319
53443
  const states = [];
53320
53444
  await forEachWithGitYield(sessionTargets, async (sessionCheckout) => {
53321
- const checkoutPath = path73.resolve(sessionCheckout);
53445
+ const checkoutPath = path75.resolve(sessionCheckout);
53322
53446
  if (!await isGitRepoDirectory(checkoutPath)) return;
53323
53447
  const repoPathRelativeToWorkspaceRoot = await resolveRepoPathRelativeToWorkspaceRoot({
53324
53448
  checkoutPath,
53325
53449
  bridgeRoot,
53326
- sessionParentPath: sessionParentPath ? path73.resolve(sessionParentPath) : null
53450
+ sessionParentPath: sessionParentPath ? path75.resolve(sessionParentPath) : null
53327
53451
  });
53328
53452
  if (!repoPathRelativeToWorkspaceRoot) return;
53329
53453
  const mainRepoPath = resolveMainRepoPath(checkoutPath);
53330
53454
  const headSha = (await cliSimpleGit(checkoutPath).revparse(["HEAD"])).trim();
53331
53455
  const previewCheckout = previewCheckoutPaths.length > 0 ? await resolveIsolatedCheckoutForRepoPathRelativeToWorkspaceRoot({
53332
53456
  checkoutPaths: previewCheckoutPaths,
53333
- sessionParentPath: previewParentPath ? path73.resolve(previewParentPath) : null,
53457
+ sessionParentPath: previewParentPath ? path75.resolve(previewParentPath) : null,
53334
53458
  bridgeRoot,
53335
53459
  repoPathRelativeToWorkspaceRoot
53336
53460
  }) : null;
@@ -53350,7 +53474,7 @@ async function deploySessionToPreviewEnvironment(options) {
53350
53474
  const eid = options.environmentId.trim();
53351
53475
  if (!sid || !eid) return { ok: false, error: "sessionId and environmentId are required" };
53352
53476
  const deployBranch = previewDeployBranchName(eid);
53353
- const bridgeRoot = path74.resolve(getBridgeRoot());
53477
+ const bridgeRoot = path76.resolve(getBridgeRoot());
53354
53478
  await previewWorktreeManager.ensureCached(eid);
53355
53479
  const existingPreviewParentPath = previewWorktreeManager.getPreviewParentPath(eid) ?? null;
53356
53480
  const existingPreviewCheckoutPaths = previewWorktreeManager.getRepoCheckoutPaths(eid) ?? [];
@@ -53390,10 +53514,10 @@ async function deploySessionToPreviewEnvironment(options) {
53390
53514
  }
53391
53515
 
53392
53516
  // src/worktrees/manager/default-worktrees-root-path.ts
53393
- import * as path75 from "node:path";
53394
- import os9 from "node:os";
53517
+ import * as path77 from "node:path";
53518
+ import os10 from "node:os";
53395
53519
  function defaultWorktreesRootPath() {
53396
- return path75.join(os9.homedir(), ".buildautomaton", "worktrees");
53520
+ return path77.join(os10.homedir(), ".buildautomaton", "worktrees");
53397
53521
  }
53398
53522
 
53399
53523
  // src/connection/create-bridge-worktree-managers.ts
@@ -53523,14 +53647,14 @@ function assertBridgeWorkspace(ctx) {
53523
53647
  }
53524
53648
 
53525
53649
  // src/files/list-dir/index.ts
53526
- import fs52 from "node:fs";
53650
+ import fs54 from "node:fs";
53527
53651
 
53528
53652
  // src/files/ensure-under-cwd.ts
53529
- import path76 from "node:path";
53653
+ import path78 from "node:path";
53530
53654
  function ensureUnderCwd(relativePath, cwd = getBridgeRoot()) {
53531
- const normalized = path76.normalize(relativePath).replace(/^(\.\/)+/, "");
53532
- const resolved = path76.resolve(cwd, normalized);
53533
- if (!resolved.startsWith(cwd + path76.sep) && resolved !== cwd) {
53655
+ const normalized = path78.normalize(relativePath).replace(/^(\.\/)+/, "");
53656
+ const resolved = path78.resolve(cwd, normalized);
53657
+ if (!resolved.startsWith(cwd + path78.sep) && resolved !== cwd) {
53534
53658
  return null;
53535
53659
  }
53536
53660
  return resolved;
@@ -53543,15 +53667,15 @@ init_yield_to_event_loop();
53543
53667
  var LIST_DIR_YIELD_EVERY = 256;
53544
53668
 
53545
53669
  // src/files/list-dir/map-dir-entry.ts
53546
- import path77 from "node:path";
53547
- import fs51 from "node:fs";
53670
+ import path79 from "node:path";
53671
+ import fs53 from "node:fs";
53548
53672
  async function mapDirEntry(d, relativePath, resolved) {
53549
- const entryPath = path77.join(relativePath || ".", d.name).replace(/\\/g, "/");
53550
- const fullPath = path77.join(resolved, d.name);
53673
+ const entryPath = path79.join(relativePath || ".", d.name).replace(/\\/g, "/");
53674
+ const fullPath = path79.join(resolved, d.name);
53551
53675
  let isDir = d.isDirectory();
53552
53676
  if (d.isSymbolicLink()) {
53553
53677
  try {
53554
- const targetStat = await fs51.promises.stat(fullPath);
53678
+ const targetStat = await fs53.promises.stat(fullPath);
53555
53679
  isDir = targetStat.isDirectory();
53556
53680
  } catch {
53557
53681
  isDir = false;
@@ -53581,7 +53705,7 @@ async function listDirAsync(relativePath, sessionParentPath = getBridgeRoot()) {
53581
53705
  return { error: "Path is outside working directory" };
53582
53706
  }
53583
53707
  try {
53584
- const names = await fs52.promises.readdir(resolved, { withFileTypes: true });
53708
+ const names = await fs54.promises.readdir(resolved, { withFileTypes: true });
53585
53709
  const entries = [];
53586
53710
  for (let i = 0; i < names.length; i++) {
53587
53711
  if (i > 0 && i % LIST_DIR_YIELD_EVERY === 0) {
@@ -53597,13 +53721,13 @@ async function listDirAsync(relativePath, sessionParentPath = getBridgeRoot()) {
53597
53721
  }
53598
53722
 
53599
53723
  // src/git/tree/resolve-repo-abs-path.ts
53600
- import * as path78 from "node:path";
53724
+ import * as path80 from "node:path";
53601
53725
  function resolveRepoAbsPathFromBridge(repoRelPath, bridgeRoot = getBridgeRoot()) {
53602
- const bridgeResolved = path78.resolve(bridgeRoot);
53726
+ const bridgeResolved = path80.resolve(bridgeRoot);
53603
53727
  const rel = repoRelPath.trim() === "." ? "" : repoRelPath.trim().replace(/\\/g, "/");
53604
- const repoPath = rel === "" ? bridgeResolved : path78.join(bridgeResolved, rel);
53605
- const resolved = path78.resolve(repoPath);
53606
- if (!resolved.startsWith(bridgeResolved + path78.sep) && resolved !== bridgeResolved) {
53728
+ const repoPath = rel === "" ? bridgeResolved : path80.join(bridgeResolved, rel);
53729
+ const resolved = path80.resolve(repoPath);
53730
+ if (!resolved.startsWith(bridgeResolved + path80.sep) && resolved !== bridgeResolved) {
53607
53731
  return null;
53608
53732
  }
53609
53733
  return resolved;
@@ -54084,25 +54208,25 @@ async function GET2(ctx) {
54084
54208
  init_in_flight();
54085
54209
 
54086
54210
  // src/files/read/read-file-async.ts
54087
- import fs58 from "node:fs";
54211
+ import fs60 from "node:fs";
54088
54212
  init_yield_to_event_loop();
54089
54213
 
54090
54214
  // src/files/read/resolve-file-cache.ts
54091
- import fs53 from "node:fs";
54092
- import path79 from "node:path";
54215
+ import fs55 from "node:fs";
54216
+ import path81 from "node:path";
54093
54217
  var RESOLVE_CACHE_MAX = 4096;
54094
54218
  var resolveCache = /* @__PURE__ */ new Map();
54095
54219
  function resolveCacheKey(sessionParentPath, relativePath) {
54096
54220
  return `${sessionParentPath}\0${relativePath}`;
54097
54221
  }
54098
54222
  function pathStaysUnderParent(filePath, sessionParentPath) {
54099
- const parent = path79.resolve(sessionParentPath);
54100
- const resolved = path79.resolve(filePath);
54101
- return resolved === parent || resolved.startsWith(`${parent}${path79.sep}`);
54223
+ const parent = path81.resolve(sessionParentPath);
54224
+ const resolved = path81.resolve(filePath);
54225
+ return resolved === parent || resolved.startsWith(`${parent}${path81.sep}`);
54102
54226
  }
54103
54227
  function statMatchesCacheSync(entry) {
54104
54228
  try {
54105
- const stat3 = fs53.statSync(entry.path);
54229
+ const stat3 = fs55.statSync(entry.path);
54106
54230
  return stat3.isFile() && stat3.mtimeMs === entry.mtimeMs && stat3.size === entry.size;
54107
54231
  } catch {
54108
54232
  return false;
@@ -54135,7 +54259,7 @@ function joinInflightResolve(cacheKey, factory) {
54135
54259
  }
54136
54260
 
54137
54261
  // src/files/read/resolve-file-for-read-core.ts
54138
- import fs54 from "node:fs";
54262
+ import fs56 from "node:fs";
54139
54263
  import { isMainThread as isMainThread4 } from "node:worker_threads";
54140
54264
  function resolveFileForReadImplSync(relativePath, sessionParentPath) {
54141
54265
  const cacheKey = resolveCacheKey(sessionParentPath, relativePath);
@@ -54145,13 +54269,13 @@ function resolveFileForReadImplSync(relativePath, sessionParentPath) {
54145
54269
  let size;
54146
54270
  let mtimeMs;
54147
54271
  try {
54148
- const lstat = fs54.lstatSync(resolved);
54272
+ const lstat = fs56.lstatSync(resolved);
54149
54273
  if (lstat.isSymbolicLink()) {
54150
- real = fs54.realpathSync(resolved);
54274
+ real = fs56.realpathSync(resolved);
54151
54275
  if (!pathStaysUnderParent(real, sessionParentPath)) {
54152
54276
  return { error: "Path is outside working directory" };
54153
54277
  }
54154
- const stat3 = fs54.statSync(real);
54278
+ const stat3 = fs56.statSync(real);
54155
54279
  if (!stat3.isFile()) return { error: "Not a file" };
54156
54280
  size = stat3.size;
54157
54281
  mtimeMs = stat3.mtimeMs;
@@ -54179,13 +54303,13 @@ async function resolveFileForReadImpl(relativePath, sessionParentPath) {
54179
54303
  let size;
54180
54304
  let mtimeMs;
54181
54305
  try {
54182
- const lstat = await fs54.promises.lstat(resolved);
54306
+ const lstat = await fs56.promises.lstat(resolved);
54183
54307
  if (lstat.isSymbolicLink()) {
54184
- real = await fs54.promises.realpath(resolved);
54308
+ real = await fs56.promises.realpath(resolved);
54185
54309
  if (!pathStaysUnderParent(real, sessionParentPath)) {
54186
54310
  return { error: "Path is outside working directory" };
54187
54311
  }
54188
- const stat3 = await fs54.promises.stat(real);
54312
+ const stat3 = await fs56.promises.stat(real);
54189
54313
  if (!stat3.isFile()) return { error: "Not a file" };
54190
54314
  size = stat3.size;
54191
54315
  mtimeMs = stat3.mtimeMs;
@@ -54234,7 +54358,7 @@ async function resolveFilePathAsync(relativePath, sessionParentPath = getBridgeR
54234
54358
 
54235
54359
  // src/files/read/read-file-range-async.ts
54236
54360
  init_yield_to_event_loop();
54237
- import fs55 from "node:fs";
54361
+ import fs57 from "node:fs";
54238
54362
  import { StringDecoder as StringDecoder2 } from "node:string_decoder";
54239
54363
 
54240
54364
  // src/files/read/read-file-range-line-zero.ts
@@ -54348,8 +54472,8 @@ function finishLineZeroTail(state, tail, resultLines, fileSize, lineChunkSize, l
54348
54472
 
54349
54473
  // src/files/read/read-file-range-async.ts
54350
54474
  async function readFileRangeAsync(filePath, startLine, endLine, lineOffsetIn, lineChunkSize = LINE_CHUNK_SIZE, fileSizeIn) {
54351
- const fileSize = fileSizeIn ?? (await fs55.promises.stat(filePath)).size;
54352
- const fd = await fs55.promises.open(filePath, "r");
54475
+ const fileSize = fileSizeIn ?? (await fs57.promises.stat(filePath)).size;
54476
+ const fd = await fs57.promises.open(filePath, "r");
54353
54477
  const bufSize = 64 * 1024;
54354
54478
  const buf = Buffer.alloc(bufSize);
54355
54479
  const decoder = new StringDecoder2("utf8");
@@ -54450,7 +54574,7 @@ async function readFileRangeAsync(filePath, startLine, endLine, lineOffsetIn, li
54450
54574
  }
54451
54575
 
54452
54576
  // src/files/read/read-small-file-range-async.ts
54453
- import fs56 from "node:fs";
54577
+ import fs58 from "node:fs";
54454
54578
  import { isMainThread as isMainThread5 } from "node:worker_threads";
54455
54579
  var SMALL_FILE_RANGE_MAX_BYTES = 512 * 1024;
54456
54580
  function sliceLineRange(lines, startLine, endLine, lineOffsetIn, lineChunkSize, fileSize) {
@@ -54480,7 +54604,7 @@ function sliceLineRange(lines, startLine, endLine, lineOffsetIn, lineChunkSize,
54480
54604
  };
54481
54605
  }
54482
54606
  function readSmallFileRangeSync(filePath, fileSize, startLine, endLine, lineOffsetIn, lineChunkSize = LINE_CHUNK_SIZE) {
54483
- const raw = fs56.readFileSync(filePath, "utf8");
54607
+ const raw = fs58.readFileSync(filePath, "utf8");
54484
54608
  const lines = raw.split(/\r?\n/);
54485
54609
  return sliceLineRange(lines, startLine, endLine, lineOffsetIn, lineChunkSize, fileSize);
54486
54610
  }
@@ -54488,28 +54612,28 @@ async function readSmallFileRangeAsync(filePath, fileSize, startLine, endLine, l
54488
54612
  if (isMainThread5) {
54489
54613
  return readSmallFileRangeSync(filePath, fileSize, startLine, endLine, lineOffsetIn, lineChunkSize);
54490
54614
  }
54491
- const raw = await fs56.promises.readFile(filePath, "utf8");
54615
+ const raw = await fs58.promises.readFile(filePath, "utf8");
54492
54616
  const lines = raw.split(/\r?\n/);
54493
54617
  return sliceLineRange(lines, startLine, endLine, lineOffsetIn, lineChunkSize, fileSize);
54494
54618
  }
54495
54619
 
54496
54620
  // src/files/read/read-file-buffer-full-async.ts
54497
54621
  init_yield_to_event_loop();
54498
- import fs57 from "node:fs";
54622
+ import fs59 from "node:fs";
54499
54623
  import { isMainThread as isMainThread6 } from "node:worker_threads";
54500
54624
  var READ_CHUNK_BYTES = 256 * 1024;
54501
54625
  var MAIN_THREAD_SYNC_READ_MAX_BYTES = 512 * 1024;
54502
54626
  async function readFileBufferFullAsync(filePath, knownSize) {
54503
54627
  if (isMainThread6) {
54504
- const size2 = knownSize ?? fs57.statSync(filePath).size;
54628
+ const size2 = knownSize ?? fs59.statSync(filePath).size;
54505
54629
  if (size2 <= MAIN_THREAD_SYNC_READ_MAX_BYTES) {
54506
54630
  await yieldToEventLoop();
54507
- const buffer = fs57.readFileSync(filePath);
54631
+ const buffer = fs59.readFileSync(filePath);
54508
54632
  return { buffer, size: buffer.length };
54509
54633
  }
54510
54634
  }
54511
- const size = knownSize ?? (await fs57.promises.stat(filePath)).size;
54512
- const fd = await fs57.promises.open(filePath, "r");
54635
+ const size = knownSize ?? (await fs59.promises.stat(filePath)).size;
54636
+ const fd = await fs59.promises.open(filePath, "r");
54513
54637
  const chunks = [];
54514
54638
  let position = 0;
54515
54639
  let bytesSinceYield = 0;
@@ -54612,7 +54736,7 @@ async function readFileAsync(relativePath, startLine, endLine, lineOffset, lineC
54612
54736
  }
54613
54737
  if (hasRange) {
54614
54738
  if (fileSize == null) {
54615
- const stat3 = await fs58.promises.stat(resolvedPath);
54739
+ const stat3 = await fs60.promises.stat(resolvedPath);
54616
54740
  fileSize = stat3.size;
54617
54741
  }
54618
54742
  const read2 = fileSize <= SMALL_FILE_RANGE_MAX_BYTES ? await readSmallFileRangeAsync(
@@ -54910,12 +55034,12 @@ function parseOptionalInt2(raw) {
54910
55034
  return Number.isInteger(parsed) ? parsed : void 0;
54911
55035
  }
54912
55036
  function parseCodeNavParams(url2) {
54913
- const path88 = url2.searchParams.get("path") ?? "";
55037
+ const path90 = url2.searchParams.get("path") ?? "";
54914
55038
  const opRaw = url2.searchParams.get("op")?.trim();
54915
55039
  const op = opRaw === "references" ? "references" : opRaw === "symbols" ? "symbols" : opRaw === "definitions" ? "definitions" : "definition";
54916
55040
  const line = parseOptionalInt2(url2.searchParams.get("line")) ?? 1;
54917
55041
  const column = parseOptionalInt2(url2.searchParams.get("column")) ?? 0;
54918
- return { path: path88, op, line, column };
55042
+ return { path: path90, op, line, column };
54919
55043
  }
54920
55044
  function parseCodeNavPath(url2) {
54921
55045
  const raw = url2.searchParams.get("path")?.trim();
@@ -55713,18 +55837,18 @@ function hasRunningTurn(turns) {
55713
55837
  }
55714
55838
 
55715
55839
  // src/prompt-turn-queue/runner/run-local-revert-before-queued-prompt.ts
55716
- import fs61 from "node:fs";
55840
+ import fs63 from "node:fs";
55717
55841
 
55718
55842
  // src/git/snapshot/capture.ts
55719
- import * as fs60 from "node:fs";
55720
- import * as path81 from "node:path";
55843
+ import * as fs62 from "node:fs";
55844
+ import * as path83 from "node:path";
55721
55845
 
55722
55846
  // src/git/snapshot/apply-pre-turn-snapshot.ts
55723
- import * as fs59 from "node:fs";
55847
+ import * as fs61 from "node:fs";
55724
55848
  async function applyPreTurnSnapshot(filePath, log2) {
55725
55849
  let data;
55726
55850
  try {
55727
- data = JSON.parse(fs59.readFileSync(filePath, "utf8"));
55851
+ data = JSON.parse(fs61.readFileSync(filePath, "utf8"));
55728
55852
  } catch (error51) {
55729
55853
  return { ok: false, error: error51 instanceof Error ? error51.message : String(error51) };
55730
55854
  }
@@ -55753,18 +55877,18 @@ async function applyPreTurnSnapshot(filePath, log2) {
55753
55877
  }
55754
55878
 
55755
55879
  // src/git/snapshot/resolve-repo-roots.ts
55756
- import * as path80 from "node:path";
55880
+ import * as path82 from "node:path";
55757
55881
  async function resolveSnapshotRepoRoots(options) {
55758
55882
  const { worktreePaths, fallbackCwd, sessionId, log: log2 } = options;
55759
55883
  if (worktreePaths?.length) {
55760
- const paths = [...new Set(worktreePaths.map((p) => path80.resolve(p)))];
55884
+ const paths = [...new Set(worktreePaths.map((p) => path82.resolve(p)))];
55761
55885
  return (await Promise.all(paths.map(async (p) => await isGitRepoDirectory(p) ? p : null))).filter((p) => p != null);
55762
55886
  }
55763
55887
  try {
55764
55888
  const roots = (await discoverGitReposUnderRoot(fallbackCwd)).map((repo) => repo.absolutePath);
55765
55889
  const sid = sessionId?.trim();
55766
55890
  if (!sid) return roots;
55767
- const sessionRoots = roots.filter((root) => path80.basename(root) === sid);
55891
+ const sessionRoots = roots.filter((root) => path82.basename(root) === sid);
55768
55892
  return sessionRoots.length > 0 ? sessionRoots : roots;
55769
55893
  } catch (error51) {
55770
55894
  log2(`[snapshot] Discover repositories failed: ${error51 instanceof Error ? error51.message : String(error51)}`);
@@ -55786,7 +55910,7 @@ async function capturePreTurnSnapshot(options) {
55786
55910
  });
55787
55911
  const dir = snapshotsDirForCwd(agentCwd);
55788
55912
  try {
55789
- fs60.mkdirSync(dir, { recursive: true });
55913
+ fs62.mkdirSync(dir, { recursive: true });
55790
55914
  } catch (e) {
55791
55915
  return { ok: false, error: e instanceof Error ? e.message : String(e) };
55792
55916
  }
@@ -55795,9 +55919,9 @@ async function capturePreTurnSnapshot(options) {
55795
55919
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
55796
55920
  repos
55797
55921
  };
55798
- const filePath = path81.join(dir, `${runId}.json`);
55922
+ const filePath = path83.join(dir, `${runId}.json`);
55799
55923
  try {
55800
- fs60.writeFileSync(filePath, JSON.stringify(payload, null, 2), "utf8");
55924
+ fs62.writeFileSync(filePath, JSON.stringify(payload, null, 2), "utf8");
55801
55925
  } catch (e) {
55802
55926
  return { ok: false, error: e instanceof Error ? e.message : String(e) };
55803
55927
  }
@@ -55817,7 +55941,7 @@ async function runLocalRevertBeforeQueuedPrompt(next, deps) {
55817
55941
  const agentBase = deps.sessionWorktreeManager.getSessionWorktreeRootForSession(sid) ?? getBridgeRoot();
55818
55942
  const file2 = snapshotFilePath(agentBase, tid);
55819
55943
  try {
55820
- await fs61.promises.access(file2, fs61.constants.F_OK);
55944
+ await fs63.promises.access(file2, fs63.constants.F_OK);
55821
55945
  } catch {
55822
55946
  deps.log(
55823
55947
  `[Queue] requeued_with_revert: no pre-turn snapshot for ${tid.slice(0, 8)}\u2026; continuing without revert.`
@@ -56468,6 +56592,7 @@ var handleRenameSessionBranchMessage = (msg, deps) => {
56468
56592
  var handleSessionArchivedMessage = (msg, deps) => {
56469
56593
  const sessionId = typeof msg.sessionId === "string" ? msg.sessionId : "";
56470
56594
  if (!sessionId) return;
56595
+ cleanupSessionPlans(sessionId);
56471
56596
  void deps.sessionWorktreeManager.removeSessionWorktrees(sessionId);
56472
56597
  };
56473
56598
 
@@ -56475,11 +56600,12 @@ var handleSessionArchivedMessage = (msg, deps) => {
56475
56600
  var handleSessionDiscardedMessage = (msg, deps) => {
56476
56601
  const sessionId = typeof msg.sessionId === "string" ? msg.sessionId : "";
56477
56602
  if (!sessionId) return;
56603
+ cleanupSessionPlans(sessionId);
56478
56604
  void deps.sessionWorktreeManager.removeSessionWorktrees(sessionId);
56479
56605
  };
56480
56606
 
56481
56607
  // src/routing/handlers/revert-turn-snapshot.ts
56482
- import * as fs62 from "node:fs";
56608
+ import * as fs64 from "node:fs";
56483
56609
  var handleRevertTurnSnapshotMessage = (msg, deps) => {
56484
56610
  const id = typeof msg.id === "string" ? msg.id : "";
56485
56611
  const sessionId = typeof msg.sessionId === "string" ? msg.sessionId : "";
@@ -56492,7 +56618,7 @@ var handleRevertTurnSnapshotMessage = (msg, deps) => {
56492
56618
  const agentBase = sessionWorktreeManager.getSessionWorktreeRootForSession(sessionId) ?? getBridgeRoot();
56493
56619
  const file2 = snapshotFilePath(agentBase, turnId);
56494
56620
  try {
56495
- await fs62.promises.access(file2, fs62.constants.F_OK);
56621
+ await fs64.promises.access(file2, fs64.constants.F_OK);
56496
56622
  } catch {
56497
56623
  sendWsMessage(s, {
56498
56624
  type: "revert_turn_snapshot_result",
@@ -56566,8 +56692,8 @@ function randomSecret() {
56566
56692
  }
56567
56693
  return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
56568
56694
  }
56569
- async function requestPreviewApi(port, secret, method, path88, body) {
56570
- const url2 = `http://127.0.0.1:${port}${path88}`;
56695
+ async function requestPreviewApi(port, secret, method, path90, body) {
56696
+ const url2 = `http://127.0.0.1:${port}${path90}`;
56571
56697
  const headers = {
56572
56698
  [PREVIEW_SECRET_HEADER]: secret,
56573
56699
  "Content-Type": "application/json"
@@ -56579,7 +56705,7 @@ async function requestPreviewApi(port, secret, method, path88, body) {
56579
56705
  });
56580
56706
  const data = await res.json().catch(() => ({}));
56581
56707
  if (!res.ok) {
56582
- throw new Error(data?.error ?? `Preview API ${method} ${path88}: ${res.status}`);
56708
+ throw new Error(data?.error ?? `Preview API ${method} ${path90}: ${res.status}`);
56583
56709
  }
56584
56710
  return data;
56585
56711
  }
@@ -56764,8 +56890,8 @@ function isValidRemoteSkillInstallItem(item) {
56764
56890
 
56765
56891
  // src/skills/install/install-remote-skills-async.ts
56766
56892
  init_yield_to_event_loop();
56767
- import fs63 from "node:fs";
56768
- import path82 from "node:path";
56893
+ import fs65 from "node:fs";
56894
+ import path84 from "node:path";
56769
56895
 
56770
56896
  // src/skills/install/constants.ts
56771
56897
  var INSTALL_SKILLS_YIELD_EVERY = 16;
@@ -56776,12 +56902,12 @@ async function writeInstallFileAsync(skillDir, f, filesWritten) {
56776
56902
  if (++filesWritten.count % INSTALL_SKILLS_YIELD_EVERY === 0) {
56777
56903
  await yieldToEventLoop();
56778
56904
  }
56779
- const dest = path82.join(skillDir, f.path);
56780
- await fs63.promises.mkdir(path82.dirname(dest), { recursive: true });
56905
+ const dest = path84.join(skillDir, f.path);
56906
+ await fs65.promises.mkdir(path84.dirname(dest), { recursive: true });
56781
56907
  if (f.text !== void 0) {
56782
- await fs63.promises.writeFile(dest, f.text, "utf8");
56908
+ await fs65.promises.writeFile(dest, f.text, "utf8");
56783
56909
  } else if (f.base64) {
56784
- await fs63.promises.writeFile(dest, Buffer.from(f.base64, "base64"));
56910
+ await fs65.promises.writeFile(dest, Buffer.from(f.base64, "base64"));
56785
56911
  }
56786
56912
  }
56787
56913
  async function installRemoteSkillsAsync(cwd, targetDir, items) {
@@ -56793,7 +56919,7 @@ async function installRemoteSkillsAsync(cwd, targetDir, items) {
56793
56919
  try {
56794
56920
  for (const item of items) {
56795
56921
  if (!isValidRemoteSkillInstallItem(item)) continue;
56796
- const skillDir = path82.join(cwd, targetDir, item.skillName);
56922
+ const skillDir = path84.join(cwd, targetDir, item.skillName);
56797
56923
  for (const f of item.files) {
56798
56924
  await writeInstallFileAsync(skillDir, f, filesWritten);
56799
56925
  }
@@ -57156,13 +57282,13 @@ function handleFileBrowserRequest(msg, socket, e2ee, sessionWorktreeManager) {
57156
57282
 
57157
57283
  // src/files/handle-file-browser-search.ts
57158
57284
  init_yield_to_event_loop();
57159
- import path83 from "node:path";
57285
+ import path85 from "node:path";
57160
57286
  var SEARCH_LIMIT = 100;
57161
57287
  function handleFileBrowserSearch(msg, socket, e2ee, sessionWorktreeManager) {
57162
57288
  void (async () => {
57163
57289
  await yieldToEventLoop();
57164
57290
  const q = typeof msg.q === "string" ? msg.q : "";
57165
- const sessionParentPath = path83.resolve(
57291
+ const sessionParentPath = path85.resolve(
57166
57292
  sessionWorktreeManager != null ? await resolveFileBrowserSessionParent(sessionWorktreeManager, msg.sessionId) : getBridgeRoot()
57167
57293
  );
57168
57294
  if (!await bridgeFileIndexIsPopulated(sessionParentPath)) {
@@ -57260,7 +57386,7 @@ function handleFileBrowserCodeNavMessage(msg, { getWs, e2ee, sessionWorktreeMana
57260
57386
  }
57261
57387
 
57262
57388
  // src/git/bridge-git-context.ts
57263
- import * as path84 from "node:path";
57389
+ import * as path86 from "node:path";
57264
57390
  init_yield_to_event_loop();
57265
57391
 
57266
57392
  // src/git/branches/get-current-branch.ts
@@ -57328,12 +57454,12 @@ function listPendingCheckouts() {
57328
57454
  // src/git/bridge-git-context.ts
57329
57455
  function folderNameForRelPath(relPath, bridgeRoot) {
57330
57456
  if (relPath === "." || relPath === "") {
57331
- return path84.basename(path84.resolve(bridgeRoot)) || "repo";
57457
+ return path86.basename(path86.resolve(bridgeRoot)) || "repo";
57332
57458
  }
57333
- return path84.basename(relPath) || relPath;
57459
+ return path86.basename(relPath) || relPath;
57334
57460
  }
57335
57461
  async function discoverGitReposForBridgeContext(bridgeRoot) {
57336
- const root = path84.resolve(bridgeRoot);
57462
+ const root = path86.resolve(bridgeRoot);
57337
57463
  if (await isGitRepoDirectory(root)) {
57338
57464
  const remoteUrl = await getRemoteOriginUrl(root);
57339
57465
  return [{ absolutePath: root, remoteUrl }];
@@ -57341,19 +57467,19 @@ async function discoverGitReposForBridgeContext(bridgeRoot) {
57341
57467
  const [deep, shallow] = await Promise.all([discoverGitReposUnderRoot(root), discoverGitRepos(root)]);
57342
57468
  const byPath = /* @__PURE__ */ new Map();
57343
57469
  for (const repo of [...deep, ...shallow]) {
57344
- byPath.set(path84.resolve(repo.absolutePath), repo);
57470
+ byPath.set(path86.resolve(repo.absolutePath), repo);
57345
57471
  }
57346
57472
  return [...byPath.values()];
57347
57473
  }
57348
57474
  async function getBridgeGitContext(bridgeRoot = getBridgeRoot()) {
57349
- const bridgeResolved = path84.resolve(bridgeRoot);
57475
+ const bridgeResolved = path86.resolve(bridgeRoot);
57350
57476
  const repos = await discoverGitReposForBridgeContext(bridgeResolved);
57351
57477
  const rows = [];
57352
57478
  for (let i = 0; i < repos.length; i++) {
57353
57479
  if (i > 0) await yieldToEventLoop();
57354
57480
  const repo = repos[i];
57355
- let rel = path84.relative(bridgeResolved, repo.absolutePath);
57356
- if (rel.startsWith("..") || path84.isAbsolute(rel)) continue;
57481
+ let rel = path86.relative(bridgeResolved, repo.absolutePath);
57482
+ if (rel.startsWith("..") || path86.isAbsolute(rel)) continue;
57357
57483
  const relPath = rel === "" ? "." : rel.replace(/\\/g, "/");
57358
57484
  const currentBranch = await getCurrentBranch(repo.absolutePath);
57359
57485
  const remoteUrl = repo.remoteUrl.trim() || null;
@@ -57384,11 +57510,11 @@ async function getBridgeGitContext(bridgeRoot = getBridgeRoot()) {
57384
57510
  return rows;
57385
57511
  }
57386
57512
  async function listRepoBranchesForBridge(repoRelPath, bridgeRoot = getBridgeRoot()) {
57387
- const bridgeResolved = path84.resolve(bridgeRoot);
57513
+ const bridgeResolved = path86.resolve(bridgeRoot);
57388
57514
  const rel = repoRelPath.trim() === "." ? "" : repoRelPath.trim().replace(/\\/g, "/");
57389
- const repoPath = rel === "" ? bridgeResolved : path84.join(bridgeResolved, rel);
57390
- const resolved = path84.resolve(repoPath);
57391
- if (!resolved.startsWith(bridgeResolved + path84.sep) && resolved !== bridgeResolved) {
57515
+ const repoPath = rel === "" ? bridgeResolved : path86.join(bridgeResolved, rel);
57516
+ const resolved = path86.resolve(repoPath);
57517
+ if (!resolved.startsWith(bridgeResolved + path86.sep) && resolved !== bridgeResolved) {
57392
57518
  return [];
57393
57519
  }
57394
57520
  return listRepoBranchRefs(resolved);
@@ -57438,8 +57564,8 @@ function handleListRepoBranchesRequestMessage(msg, getWs) {
57438
57564
  }
57439
57565
 
57440
57566
  // src/git/checkout/bridge-git-checkout.ts
57441
- import * as fs65 from "node:fs/promises";
57442
- import * as path86 from "node:path";
57567
+ import * as fs67 from "node:fs/promises";
57568
+ import * as path88 from "node:path";
57443
57569
 
57444
57570
  // src/git/checkout/normalize-clone-url.ts
57445
57571
  function normalizeCloneUrl(url2) {
@@ -57459,12 +57585,12 @@ function cloneUrlWithHttpsAuth(url2, auth) {
57459
57585
  }
57460
57586
 
57461
57587
  // src/git/checkout/resolve-checkout-target.ts
57462
- import * as fs64 from "node:fs/promises";
57463
- import * as path85 from "node:path";
57588
+ import * as fs66 from "node:fs/promises";
57589
+ import * as path87 from "node:path";
57464
57590
  var FOLDER_NAME_RE = /^[A-Za-z0-9._-]+$/;
57465
57591
  async function pathExists(p) {
57466
57592
  try {
57467
- await fs64.access(p);
57593
+ await fs66.access(p);
57468
57594
  return true;
57469
57595
  } catch {
57470
57596
  return false;
@@ -57476,7 +57602,7 @@ async function resolveCheckoutTarget(opts) {
57476
57602
  if (await isGitRepoDirectory(bridgeRoot)) {
57477
57603
  throw new Error("Bridge root is already a git repository");
57478
57604
  }
57479
- const entries = await fs64.readdir(bridgeRoot).catch(() => []);
57605
+ const entries = await fs66.readdir(bridgeRoot).catch(() => []);
57480
57606
  if (entries.length > 0) {
57481
57607
  throw new Error("Bridge root must be empty to initialize a monorepo checkout");
57482
57608
  }
@@ -57489,8 +57615,8 @@ async function resolveCheckoutTarget(opts) {
57489
57615
  if (await isGitRepoDirectory(bridgeRoot)) {
57490
57616
  throw new Error("Cannot add a nested repo while the bridge root is itself a git repository");
57491
57617
  }
57492
- const targetDir = path85.resolve(bridgeRoot, folder);
57493
- if (!targetDir.startsWith(bridgeRoot + path85.sep)) {
57618
+ const targetDir = path87.resolve(bridgeRoot, folder);
57619
+ if (!targetDir.startsWith(bridgeRoot + path87.sep)) {
57494
57620
  throw new Error("Invalid folderName");
57495
57621
  }
57496
57622
  if (await pathExists(targetDir)) {
@@ -57509,10 +57635,10 @@ async function bridgeGitCheckout(params) {
57509
57635
  });
57510
57636
  const folderName = relPath === "." ? "repo" : relPath;
57511
57637
  beginPendingCheckout({ relPath, folderName, remoteUrl: cloneUrl });
57512
- const parent = path86.dirname(targetDir);
57513
- await fs65.mkdir(parent, { recursive: true });
57638
+ const parent = path88.dirname(targetDir);
57639
+ await fs67.mkdir(parent, { recursive: true });
57514
57640
  if (relPath !== ".") {
57515
- await fs65.mkdir(targetDir, { recursive: true });
57641
+ await fs67.mkdir(targetDir, { recursive: true });
57516
57642
  }
57517
57643
  const url2 = cloneUrlWithHttpsAuth(cloneUrl, params.auth ?? null);
57518
57644
  try {
@@ -57523,7 +57649,7 @@ async function bridgeGitCheckout(params) {
57523
57649
  return { relPath, folderName };
57524
57650
  } catch (e) {
57525
57651
  if (relPath !== ".") {
57526
- await fs65.rm(targetDir, { recursive: true, force: true }).catch(() => void 0);
57652
+ await fs67.rm(targetDir, { recursive: true, force: true }).catch(() => void 0);
57527
57653
  }
57528
57654
  const msg = e instanceof Error ? e.message : String(e);
57529
57655
  throw new Error(
@@ -58257,9 +58383,9 @@ async function runCliAction(program2, opts) {
58257
58383
  const firehoseServerUrl = opts.firehoseUrl ?? opts.proxyUrl ?? process.env.BUILDAUTOMATON_FIREHOSE_URL ?? process.env.BUILDAUTOMATON_PROXY_URL ?? DEFAULT_FIREHOSE_URL;
58258
58384
  const bridgeRootOpt = (opts.bridgeRoot && typeof opts.bridgeRoot === "string" && opts.bridgeRoot.trim() ? opts.bridgeRoot.trim() : null) ?? (opts.cwd && typeof opts.cwd === "string" && opts.cwd.trim() ? opts.cwd.trim() : null);
58259
58385
  if (bridgeRootOpt) {
58260
- const resolvedBridgeRoot = path87.resolve(process.cwd(), bridgeRootOpt);
58386
+ const resolvedBridgeRoot = path89.resolve(process.cwd(), bridgeRootOpt);
58261
58387
  try {
58262
- const st = fs66.statSync(resolvedBridgeRoot);
58388
+ const st = fs68.statSync(resolvedBridgeRoot);
58263
58389
  if (!st.isDirectory()) {
58264
58390
  console.error(`Bridge root is not a directory: ${resolvedBridgeRoot}`);
58265
58391
  process.exit(1);
@@ -58279,7 +58405,7 @@ async function runCliAction(program2, opts) {
58279
58405
  );
58280
58406
  let worktreesRootPath;
58281
58407
  if (opts.worktreesRoot && opts.worktreesRoot.trim()) {
58282
- worktreesRootPath = path87.resolve(opts.worktreesRoot.trim());
58408
+ worktreesRootPath = path89.resolve(opts.worktreesRoot.trim());
58283
58409
  }
58284
58410
  const e2eCertificates = opts.e2eeCertificatesDir?.trim() ? await loadOrCreateE2eCertificates(opts.e2eeCertificatesDir.trim()) : void 0;
58285
58411
  if (e2eCertificates) {