@buildautomaton/cli 0.1.14 → 0.1.15

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
@@ -972,10 +972,10 @@ var require_suggestSimilar = __commonJS({
972
972
  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
- var childProcess = __require("node:child_process");
976
- var path32 = __require("node:path");
977
- var fs25 = __require("node:fs");
978
- var process2 = __require("node:process");
975
+ var childProcess2 = __require("node:child_process");
976
+ var path33 = __require("node:path");
977
+ var fs30 = __require("node:fs");
978
+ var process8 = __require("node:process");
979
979
  var { Argument: Argument2, humanReadableArgName } = require_argument();
980
980
  var { CommanderError: CommanderError2 } = require_error();
981
981
  var { Help: Help2 } = require_help();
@@ -1021,10 +1021,10 @@ var require_command = __commonJS({
1021
1021
  this._showHelpAfterError = false;
1022
1022
  this._showSuggestionAfterError = true;
1023
1023
  this._outputConfiguration = {
1024
- writeOut: (str) => process2.stdout.write(str),
1025
- writeErr: (str) => process2.stderr.write(str),
1026
- getOutHelpWidth: () => process2.stdout.isTTY ? process2.stdout.columns : void 0,
1027
- getErrHelpWidth: () => process2.stderr.isTTY ? process2.stderr.columns : void 0,
1024
+ writeOut: (str) => process8.stdout.write(str),
1025
+ writeErr: (str) => process8.stderr.write(str),
1026
+ getOutHelpWidth: () => process8.stdout.isTTY ? process8.stdout.columns : void 0,
1027
+ getErrHelpWidth: () => process8.stderr.isTTY ? process8.stderr.columns : void 0,
1028
1028
  outputError: (str, write) => write(str)
1029
1029
  };
1030
1030
  this._hidden = false;
@@ -1403,7 +1403,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1403
1403
  if (this._exitCallback) {
1404
1404
  this._exitCallback(new CommanderError2(exitCode, code, message));
1405
1405
  }
1406
- process2.exit(exitCode);
1406
+ process8.exit(exitCode);
1407
1407
  }
1408
1408
  /**
1409
1409
  * Register callback `fn` for the command.
@@ -1801,16 +1801,16 @@ Expecting one of '${allowedValues.join("', '")}'`);
1801
1801
  }
1802
1802
  parseOptions = parseOptions || {};
1803
1803
  if (argv === void 0 && parseOptions.from === void 0) {
1804
- if (process2.versions?.electron) {
1804
+ if (process8.versions?.electron) {
1805
1805
  parseOptions.from = "electron";
1806
1806
  }
1807
- const execArgv = process2.execArgv ?? [];
1807
+ const execArgv = process8.execArgv ?? [];
1808
1808
  if (execArgv.includes("-e") || execArgv.includes("--eval") || execArgv.includes("-p") || execArgv.includes("--print")) {
1809
1809
  parseOptions.from = "eval";
1810
1810
  }
1811
1811
  }
1812
1812
  if (argv === void 0) {
1813
- argv = process2.argv;
1813
+ argv = process8.argv;
1814
1814
  }
1815
1815
  this.rawArgs = argv.slice();
1816
1816
  let userArgs;
@@ -1821,7 +1821,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1821
1821
  userArgs = argv.slice(2);
1822
1822
  break;
1823
1823
  case "electron":
1824
- if (process2.defaultApp) {
1824
+ if (process8.defaultApp) {
1825
1825
  this._scriptPath = argv[1];
1826
1826
  userArgs = argv.slice(2);
1827
1827
  } else {
@@ -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 = path32.resolve(baseDir, baseName);
1910
- if (fs25.existsSync(localBin)) return localBin;
1911
- if (sourceExt.includes(path32.extname(baseName))) return void 0;
1909
+ const localBin = path33.resolve(baseDir, baseName);
1910
+ if (fs30.existsSync(localBin)) return localBin;
1911
+ if (sourceExt.includes(path33.extname(baseName))) return void 0;
1912
1912
  const foundExt = sourceExt.find(
1913
- (ext) => fs25.existsSync(`${localBin}${ext}`)
1913
+ (ext) => fs30.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 = fs25.realpathSync(this._scriptPath);
1925
+ resolvedScriptPath = fs30.realpathSync(this._scriptPath);
1926
1926
  } catch (err) {
1927
1927
  resolvedScriptPath = this._scriptPath;
1928
1928
  }
1929
- executableDir = path32.resolve(
1930
- path32.dirname(resolvedScriptPath),
1929
+ executableDir = path33.resolve(
1930
+ path33.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 = path32.basename(
1937
+ const legacyName = path33.basename(
1938
1938
  this._scriptPath,
1939
- path32.extname(this._scriptPath)
1939
+ path33.extname(this._scriptPath)
1940
1940
  );
1941
1941
  if (legacyName !== this._name) {
1942
1942
  localFile = findFile(
@@ -1947,25 +1947,25 @@ Expecting one of '${allowedValues.join("', '")}'`);
1947
1947
  }
1948
1948
  executableFile = localFile || executableFile;
1949
1949
  }
1950
- launchWithNode = sourceExt.includes(path32.extname(executableFile));
1950
+ launchWithNode = sourceExt.includes(path33.extname(executableFile));
1951
1951
  let proc;
1952
- if (process2.platform !== "win32") {
1952
+ if (process8.platform !== "win32") {
1953
1953
  if (launchWithNode) {
1954
1954
  args.unshift(executableFile);
1955
- args = incrementNodeInspectorPort(process2.execArgv).concat(args);
1956
- proc = childProcess.spawn(process2.argv[0], args, { stdio: "inherit" });
1955
+ args = incrementNodeInspectorPort(process8.execArgv).concat(args);
1956
+ proc = childProcess2.spawn(process8.argv[0], args, { stdio: "inherit" });
1957
1957
  } else {
1958
- proc = childProcess.spawn(executableFile, args, { stdio: "inherit" });
1958
+ proc = childProcess2.spawn(executableFile, args, { stdio: "inherit" });
1959
1959
  }
1960
1960
  } else {
1961
1961
  args.unshift(executableFile);
1962
- args = incrementNodeInspectorPort(process2.execArgv).concat(args);
1963
- proc = childProcess.spawn(process2.execPath, args, { stdio: "inherit" });
1962
+ args = incrementNodeInspectorPort(process8.execArgv).concat(args);
1963
+ proc = childProcess2.spawn(process8.execPath, args, { stdio: "inherit" });
1964
1964
  }
1965
1965
  if (!proc.killed) {
1966
1966
  const signals = ["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"];
1967
1967
  signals.forEach((signal) => {
1968
- process2.on(signal, () => {
1968
+ process8.on(signal, () => {
1969
1969
  if (proc.killed === false && proc.exitCode === null) {
1970
1970
  proc.kill(signal);
1971
1971
  }
@@ -1976,7 +1976,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1976
1976
  proc.on("close", (code) => {
1977
1977
  code = code ?? 1;
1978
1978
  if (!exitCallback) {
1979
- process2.exit(code);
1979
+ process8.exit(code);
1980
1980
  } else {
1981
1981
  exitCallback(
1982
1982
  new CommanderError2(
@@ -1999,7 +1999,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1999
1999
  throw new Error(`'${executableFile}' not executable`);
2000
2000
  }
2001
2001
  if (!exitCallback) {
2002
- process2.exit(1);
2002
+ process8.exit(1);
2003
2003
  } else {
2004
2004
  const wrappedError = new CommanderError2(
2005
2005
  1,
@@ -2491,13 +2491,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
2491
2491
  */
2492
2492
  _parseOptionsEnv() {
2493
2493
  this.options.forEach((option) => {
2494
- if (option.envVar && option.envVar in process2.env) {
2494
+ if (option.envVar && option.envVar in process8.env) {
2495
2495
  const optionKey = option.attributeName();
2496
2496
  if (this.getOptionValue(optionKey) === void 0 || ["default", "config", "env"].includes(
2497
2497
  this.getOptionValueSource(optionKey)
2498
2498
  )) {
2499
2499
  if (option.required || option.optional) {
2500
- this.emit(`optionEnv:${option.name()}`, process2.env[option.envVar]);
2500
+ this.emit(`optionEnv:${option.name()}`, process8.env[option.envVar]);
2501
2501
  } else {
2502
2502
  this.emit(`optionEnv:${option.name()}`);
2503
2503
  }
@@ -2787,7 +2787,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2787
2787
  * @return {Command}
2788
2788
  */
2789
2789
  nameFromFilename(filename) {
2790
- this._name = path32.basename(filename, path32.extname(filename));
2790
+ this._name = path33.basename(filename, path33.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(path33) {
2805
- if (path33 === void 0) return this._executableDir;
2806
- this._executableDir = path33;
2804
+ executableDir(path34) {
2805
+ if (path34 === void 0) return this._executableDir;
2806
+ this._executableDir = path34;
2807
2807
  return this;
2808
2808
  }
2809
2809
  /**
@@ -2926,7 +2926,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2926
2926
  */
2927
2927
  help(contextOptions) {
2928
2928
  this.outputHelp(contextOptions);
2929
- let exitCode = process2.exitCode || 0;
2929
+ let exitCode = process8.exitCode || 0;
2930
2930
  if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
2931
2931
  exitCode = 1;
2932
2932
  }
@@ -6175,7 +6175,7 @@ var require_stream = __commonJS({
6175
6175
  };
6176
6176
  duplex._final = function(callback) {
6177
6177
  if (ws.readyState === ws.CONNECTING) {
6178
- ws.once("open", function open() {
6178
+ ws.once("open", function open2() {
6179
6179
  duplex._final(callback);
6180
6180
  });
6181
6181
  return;
@@ -6196,7 +6196,7 @@ var require_stream = __commonJS({
6196
6196
  };
6197
6197
  duplex._write = function(chunk, encoding, callback) {
6198
6198
  if (ws.readyState === ws.CONNECTING) {
6199
- ws.once("open", function open() {
6199
+ ws.once("open", function open2() {
6200
6200
  duplex._write(chunk, encoding, callback);
6201
6201
  });
6202
6202
  return;
@@ -7129,7 +7129,7 @@ var require_has_flag = __commonJS({
7129
7129
  var require_supports_color = __commonJS({
7130
7130
  "../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js"(exports, module) {
7131
7131
  "use strict";
7132
- var os5 = __require("os");
7132
+ var os6 = __require("os");
7133
7133
  var tty = __require("tty");
7134
7134
  var hasFlag = require_has_flag();
7135
7135
  var { env } = process;
@@ -7177,7 +7177,7 @@ var require_supports_color = __commonJS({
7177
7177
  return min;
7178
7178
  }
7179
7179
  if (process.platform === "win32") {
7180
- const osRelease = os5.release().split(".");
7180
+ const osRelease = os6.release().split(".");
7181
7181
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
7182
7182
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
7183
7183
  }
@@ -7423,10 +7423,10 @@ var require_src2 = __commonJS({
7423
7423
  var fs_1 = __require("fs");
7424
7424
  var debug_1 = __importDefault(require_src());
7425
7425
  var log2 = debug_1.default("@kwsites/file-exists");
7426
- function check2(path32, isFile, isDirectory) {
7427
- log2(`checking %s`, path32);
7426
+ function check2(path33, isFile, isDirectory) {
7427
+ log2(`checking %s`, path33);
7428
7428
  try {
7429
- const stat2 = fs_1.statSync(path32);
7429
+ const stat2 = fs_1.statSync(path33);
7430
7430
  if (stat2.isFile() && isFile) {
7431
7431
  log2(`[OK] path represents a file`);
7432
7432
  return true;
@@ -7446,8 +7446,8 @@ var require_src2 = __commonJS({
7446
7446
  throw e;
7447
7447
  }
7448
7448
  }
7449
- function exists2(path32, type = exports.READABLE) {
7450
- return check2(path32, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
7449
+ function exists2(path33, type = exports.READABLE) {
7450
+ return check2(path33, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
7451
7451
  }
7452
7452
  exports.exists = exists2;
7453
7453
  exports.FILE = 1;
@@ -7922,8 +7922,8 @@ var init_parseUtil = __esm({
7922
7922
  init_errors();
7923
7923
  init_en();
7924
7924
  makeIssue = (params) => {
7925
- const { data, path: path32, errorMaps, issueData } = params;
7926
- const fullPath = [...path32, ...issueData.path || []];
7925
+ const { data, path: path33, errorMaps, issueData } = params;
7926
+ const fullPath = [...path33, ...issueData.path || []];
7927
7927
  const fullIssue = {
7928
7928
  ...issueData,
7929
7929
  path: fullPath
@@ -8231,11 +8231,11 @@ var init_types = __esm({
8231
8231
  init_parseUtil();
8232
8232
  init_util2();
8233
8233
  ParseInputLazyPath = class {
8234
- constructor(parent, value, path32, key) {
8234
+ constructor(parent, value, path33, key) {
8235
8235
  this._cachedPath = [];
8236
8236
  this.parent = parent;
8237
8237
  this.data = value;
8238
- this._path = path32;
8238
+ this._path = path33;
8239
8239
  this._key = key;
8240
8240
  }
8241
8241
  get path() {
@@ -11850,10 +11850,10 @@ function assignProp(target, prop, value) {
11850
11850
  configurable: true
11851
11851
  });
11852
11852
  }
11853
- function getElementAtPath(obj, path32) {
11854
- if (!path32)
11853
+ function getElementAtPath(obj, path33) {
11854
+ if (!path33)
11855
11855
  return obj;
11856
- return path32.reduce((acc, key) => acc?.[key], obj);
11856
+ return path33.reduce((acc, key) => acc?.[key], obj);
11857
11857
  }
11858
11858
  function promiseAllObject(promisesObj) {
11859
11859
  const keys = Object.keys(promisesObj);
@@ -12102,11 +12102,11 @@ function aborted(x, startIndex = 0) {
12102
12102
  }
12103
12103
  return false;
12104
12104
  }
12105
- function prefixIssues(path32, issues) {
12105
+ function prefixIssues(path33, issues) {
12106
12106
  return issues.map((iss) => {
12107
12107
  var _a2;
12108
12108
  (_a2 = iss).path ?? (_a2.path = []);
12109
- iss.path.unshift(path32);
12109
+ iss.path.unshift(path33);
12110
12110
  return iss;
12111
12111
  });
12112
12112
  }
@@ -12295,7 +12295,7 @@ function treeifyError(error40, _mapper) {
12295
12295
  return issue2.message;
12296
12296
  };
12297
12297
  const result = { errors: [] };
12298
- const processError = (error41, path32 = []) => {
12298
+ const processError = (error41, path33 = []) => {
12299
12299
  var _a2, _b;
12300
12300
  for (const issue2 of error41.issues) {
12301
12301
  if (issue2.code === "invalid_union" && issue2.errors.length) {
@@ -12305,7 +12305,7 @@ function treeifyError(error40, _mapper) {
12305
12305
  } else if (issue2.code === "invalid_element") {
12306
12306
  processError({ issues: issue2.issues }, issue2.path);
12307
12307
  } else {
12308
- const fullpath = [...path32, ...issue2.path];
12308
+ const fullpath = [...path33, ...issue2.path];
12309
12309
  if (fullpath.length === 0) {
12310
12310
  result.errors.push(mapper(issue2));
12311
12311
  continue;
@@ -12335,9 +12335,9 @@ function treeifyError(error40, _mapper) {
12335
12335
  processError(error40);
12336
12336
  return result;
12337
12337
  }
12338
- function toDotPath(path32) {
12338
+ function toDotPath(path33) {
12339
12339
  const segs = [];
12340
- for (const seg of path32) {
12340
+ for (const seg of path33) {
12341
12341
  if (typeof seg === "number")
12342
12342
  segs.push(`[${seg}]`);
12343
12343
  else if (typeof seg === "symbol")
@@ -25047,8 +25047,8 @@ var init_acp = __esm({
25047
25047
  });
25048
25048
 
25049
25049
  // src/cli.ts
25050
- import * as fs24 from "node:fs";
25051
- import * as path31 from "node:path";
25050
+ import * as fs29 from "node:fs";
25051
+ import * as path32 from "node:path";
25052
25052
 
25053
25053
  // ../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/esm.mjs
25054
25054
  var import_index = __toESM(require_commander(), 1);
@@ -25321,8 +25321,521 @@ function sendWsMessage(ws, payload) {
25321
25321
  }
25322
25322
  }
25323
25323
 
25324
+ // ../../node_modules/.pnpm/open@10.2.0/node_modules/open/index.js
25325
+ import process7 from "node:process";
25326
+ import { Buffer as Buffer2 } from "node:buffer";
25327
+ import path3 from "node:path";
25328
+ import { fileURLToPath } from "node:url";
25329
+ import { promisify as promisify5 } from "node:util";
25330
+ import childProcess from "node:child_process";
25331
+ import fs6, { constants as fsConstants2 } from "node:fs/promises";
25332
+
25333
+ // ../../node_modules/.pnpm/wsl-utils@0.1.0/node_modules/wsl-utils/index.js
25334
+ import process3 from "node:process";
25335
+ import fs5, { constants as fsConstants } from "node:fs/promises";
25336
+
25337
+ // ../../node_modules/.pnpm/is-wsl@3.1.1/node_modules/is-wsl/index.js
25338
+ import process2 from "node:process";
25339
+ import os2 from "node:os";
25340
+ import fs4 from "node:fs";
25341
+
25342
+ // ../../node_modules/.pnpm/is-inside-container@1.0.0/node_modules/is-inside-container/index.js
25343
+ import fs3 from "node:fs";
25344
+
25345
+ // ../../node_modules/.pnpm/is-docker@3.0.0/node_modules/is-docker/index.js
25346
+ import fs2 from "node:fs";
25347
+ var isDockerCached;
25348
+ function hasDockerEnv() {
25349
+ try {
25350
+ fs2.statSync("/.dockerenv");
25351
+ return true;
25352
+ } catch {
25353
+ return false;
25354
+ }
25355
+ }
25356
+ function hasDockerCGroup() {
25357
+ try {
25358
+ return fs2.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
25359
+ } catch {
25360
+ return false;
25361
+ }
25362
+ }
25363
+ function isDocker() {
25364
+ if (isDockerCached === void 0) {
25365
+ isDockerCached = hasDockerEnv() || hasDockerCGroup();
25366
+ }
25367
+ return isDockerCached;
25368
+ }
25369
+
25370
+ // ../../node_modules/.pnpm/is-inside-container@1.0.0/node_modules/is-inside-container/index.js
25371
+ var cachedResult;
25372
+ var hasContainerEnv = () => {
25373
+ try {
25374
+ fs3.statSync("/run/.containerenv");
25375
+ return true;
25376
+ } catch {
25377
+ return false;
25378
+ }
25379
+ };
25380
+ function isInsideContainer() {
25381
+ if (cachedResult === void 0) {
25382
+ cachedResult = hasContainerEnv() || isDocker();
25383
+ }
25384
+ return cachedResult;
25385
+ }
25386
+
25387
+ // ../../node_modules/.pnpm/is-wsl@3.1.1/node_modules/is-wsl/index.js
25388
+ var isWsl = () => {
25389
+ if (process2.platform !== "linux") {
25390
+ return false;
25391
+ }
25392
+ if (os2.release().toLowerCase().includes("microsoft")) {
25393
+ if (isInsideContainer()) {
25394
+ return false;
25395
+ }
25396
+ return true;
25397
+ }
25398
+ try {
25399
+ if (fs4.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft")) {
25400
+ return !isInsideContainer();
25401
+ }
25402
+ } catch {
25403
+ }
25404
+ if (fs4.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop") || fs4.existsSync("/run/WSL")) {
25405
+ return !isInsideContainer();
25406
+ }
25407
+ return false;
25408
+ };
25409
+ var is_wsl_default = process2.env.__IS_WSL_TEST__ ? isWsl : isWsl();
25410
+
25411
+ // ../../node_modules/.pnpm/wsl-utils@0.1.0/node_modules/wsl-utils/index.js
25412
+ var wslDrivesMountPoint = /* @__PURE__ */ (() => {
25413
+ const defaultMountPoint = "/mnt/";
25414
+ let mountPoint;
25415
+ return async function() {
25416
+ if (mountPoint) {
25417
+ return mountPoint;
25418
+ }
25419
+ const configFilePath2 = "/etc/wsl.conf";
25420
+ let isConfigFileExists = false;
25421
+ try {
25422
+ await fs5.access(configFilePath2, fsConstants.F_OK);
25423
+ isConfigFileExists = true;
25424
+ } catch {
25425
+ }
25426
+ if (!isConfigFileExists) {
25427
+ return defaultMountPoint;
25428
+ }
25429
+ const configContent = await fs5.readFile(configFilePath2, { encoding: "utf8" });
25430
+ const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
25431
+ if (!configMountPoint) {
25432
+ return defaultMountPoint;
25433
+ }
25434
+ mountPoint = configMountPoint.groups.mountPoint.trim();
25435
+ mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
25436
+ return mountPoint;
25437
+ };
25438
+ })();
25439
+ var powerShellPathFromWsl = async () => {
25440
+ const mountPoint = await wslDrivesMountPoint();
25441
+ return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
25442
+ };
25443
+ var powerShellPath = async () => {
25444
+ if (is_wsl_default) {
25445
+ return powerShellPathFromWsl();
25446
+ }
25447
+ return `${process3.env.SYSTEMROOT || process3.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
25448
+ };
25449
+
25450
+ // ../../node_modules/.pnpm/define-lazy-prop@3.0.0/node_modules/define-lazy-prop/index.js
25451
+ function defineLazyProperty(object2, propertyName, valueGetter) {
25452
+ const define = (value) => Object.defineProperty(object2, propertyName, { value, enumerable: true, writable: true });
25453
+ Object.defineProperty(object2, propertyName, {
25454
+ configurable: true,
25455
+ enumerable: true,
25456
+ get() {
25457
+ const result = valueGetter();
25458
+ define(result);
25459
+ return result;
25460
+ },
25461
+ set(value) {
25462
+ define(value);
25463
+ }
25464
+ });
25465
+ return object2;
25466
+ }
25467
+
25468
+ // ../../node_modules/.pnpm/default-browser@5.5.0/node_modules/default-browser/index.js
25469
+ import { promisify as promisify4 } from "node:util";
25470
+ import process6 from "node:process";
25471
+ import { execFile as execFile4 } from "node:child_process";
25472
+
25473
+ // ../../node_modules/.pnpm/default-browser-id@5.0.1/node_modules/default-browser-id/index.js
25474
+ import { promisify } from "node:util";
25475
+ import process4 from "node:process";
25476
+ import { execFile } from "node:child_process";
25477
+ var execFileAsync = promisify(execFile);
25478
+ async function defaultBrowserId() {
25479
+ if (process4.platform !== "darwin") {
25480
+ throw new Error("macOS only");
25481
+ }
25482
+ const { stdout } = await execFileAsync("defaults", ["read", "com.apple.LaunchServices/com.apple.launchservices.secure", "LSHandlers"]);
25483
+ const match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);
25484
+ const browserId = match?.groups.id ?? "com.apple.Safari";
25485
+ if (browserId === "com.apple.safari") {
25486
+ return "com.apple.Safari";
25487
+ }
25488
+ return browserId;
25489
+ }
25490
+
25491
+ // ../../node_modules/.pnpm/run-applescript@7.1.0/node_modules/run-applescript/index.js
25492
+ import process5 from "node:process";
25493
+ import { promisify as promisify2 } from "node:util";
25494
+ import { execFile as execFile2, execFileSync } from "node:child_process";
25495
+ var execFileAsync2 = promisify2(execFile2);
25496
+ async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
25497
+ if (process5.platform !== "darwin") {
25498
+ throw new Error("macOS only");
25499
+ }
25500
+ const outputArguments = humanReadableOutput ? [] : ["-ss"];
25501
+ const execOptions = {};
25502
+ if (signal) {
25503
+ execOptions.signal = signal;
25504
+ }
25505
+ const { stdout } = await execFileAsync2("osascript", ["-e", script, outputArguments], execOptions);
25506
+ return stdout.trim();
25507
+ }
25508
+
25509
+ // ../../node_modules/.pnpm/bundle-name@4.1.0/node_modules/bundle-name/index.js
25510
+ async function bundleName(bundleId) {
25511
+ return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string
25512
+ tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
25513
+ }
25514
+
25515
+ // ../../node_modules/.pnpm/default-browser@5.5.0/node_modules/default-browser/windows.js
25516
+ import { promisify as promisify3 } from "node:util";
25517
+ import { execFile as execFile3 } from "node:child_process";
25518
+ var execFileAsync3 = promisify3(execFile3);
25519
+ var windowsBrowserProgIds = {
25520
+ MSEdgeHTM: { name: "Edge", id: "com.microsoft.edge" },
25521
+ // The missing `L` is correct.
25522
+ MSEdgeBHTML: { name: "Edge Beta", id: "com.microsoft.edge.beta" },
25523
+ MSEdgeDHTML: { name: "Edge Dev", id: "com.microsoft.edge.dev" },
25524
+ AppXq0fevzme2pys62n3e0fbqa7peapykr8v: { name: "Edge", id: "com.microsoft.edge.old" },
25525
+ ChromeHTML: { name: "Chrome", id: "com.google.chrome" },
25526
+ ChromeBHTML: { name: "Chrome Beta", id: "com.google.chrome.beta" },
25527
+ ChromeDHTML: { name: "Chrome Dev", id: "com.google.chrome.dev" },
25528
+ ChromiumHTM: { name: "Chromium", id: "org.chromium.Chromium" },
25529
+ BraveHTML: { name: "Brave", id: "com.brave.Browser" },
25530
+ BraveBHTML: { name: "Brave Beta", id: "com.brave.Browser.beta" },
25531
+ BraveDHTML: { name: "Brave Dev", id: "com.brave.Browser.dev" },
25532
+ BraveSSHTM: { name: "Brave Nightly", id: "com.brave.Browser.nightly" },
25533
+ FirefoxURL: { name: "Firefox", id: "org.mozilla.firefox" },
25534
+ OperaStable: { name: "Opera", id: "com.operasoftware.Opera" },
25535
+ VivaldiHTM: { name: "Vivaldi", id: "com.vivaldi.Vivaldi" },
25536
+ "IE.HTTP": { name: "Internet Explorer", id: "com.microsoft.ie" }
25537
+ };
25538
+ var _windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));
25539
+ var UnknownBrowserError = class extends Error {
25540
+ };
25541
+ async function defaultBrowser(_execFileAsync = execFileAsync3) {
25542
+ const { stdout } = await _execFileAsync("reg", [
25543
+ "QUERY",
25544
+ " HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice",
25545
+ "/v",
25546
+ "ProgId"
25547
+ ]);
25548
+ const match = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(stdout);
25549
+ if (!match) {
25550
+ throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
25551
+ }
25552
+ const { id } = match.groups;
25553
+ const dotIndex = id.lastIndexOf(".");
25554
+ const hyphenIndex = id.lastIndexOf("-");
25555
+ const baseIdByDot = dotIndex === -1 ? void 0 : id.slice(0, dotIndex);
25556
+ const baseIdByHyphen = hyphenIndex === -1 ? void 0 : id.slice(0, hyphenIndex);
25557
+ return windowsBrowserProgIds[id] ?? windowsBrowserProgIds[baseIdByDot] ?? windowsBrowserProgIds[baseIdByHyphen] ?? { name: id, id };
25558
+ }
25559
+
25560
+ // ../../node_modules/.pnpm/default-browser@5.5.0/node_modules/default-browser/index.js
25561
+ var execFileAsync4 = promisify4(execFile4);
25562
+ var titleize = (string4) => string4.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
25563
+ async function defaultBrowser2() {
25564
+ if (process6.platform === "darwin") {
25565
+ const id = await defaultBrowserId();
25566
+ const name = await bundleName(id);
25567
+ return { name, id };
25568
+ }
25569
+ if (process6.platform === "linux") {
25570
+ const { stdout } = await execFileAsync4("xdg-mime", ["query", "default", "x-scheme-handler/http"]);
25571
+ const id = stdout.trim();
25572
+ const name = titleize(id.replace(/.desktop$/, "").replace("-", " "));
25573
+ return { name, id };
25574
+ }
25575
+ if (process6.platform === "win32") {
25576
+ return defaultBrowser();
25577
+ }
25578
+ throw new Error("Only macOS, Linux, and Windows are supported");
25579
+ }
25580
+
25581
+ // ../../node_modules/.pnpm/open@10.2.0/node_modules/open/index.js
25582
+ var execFile5 = promisify5(childProcess.execFile);
25583
+ var __dirname = path3.dirname(fileURLToPath(import.meta.url));
25584
+ var localXdgOpenPath = path3.join(__dirname, "xdg-open");
25585
+ var { platform, arch } = process7;
25586
+ async function getWindowsDefaultBrowserFromWsl() {
25587
+ const powershellPath = await powerShellPath();
25588
+ const rawCommand = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
25589
+ const encodedCommand = Buffer2.from(rawCommand, "utf16le").toString("base64");
25590
+ const { stdout } = await execFile5(
25591
+ powershellPath,
25592
+ [
25593
+ "-NoProfile",
25594
+ "-NonInteractive",
25595
+ "-ExecutionPolicy",
25596
+ "Bypass",
25597
+ "-EncodedCommand",
25598
+ encodedCommand
25599
+ ],
25600
+ { encoding: "utf8" }
25601
+ );
25602
+ const progId = stdout.trim();
25603
+ const browserMap = {
25604
+ ChromeHTML: "com.google.chrome",
25605
+ BraveHTML: "com.brave.Browser",
25606
+ MSEdgeHTM: "com.microsoft.edge",
25607
+ FirefoxURL: "org.mozilla.firefox"
25608
+ };
25609
+ return browserMap[progId] ? { id: browserMap[progId] } : {};
25610
+ }
25611
+ var pTryEach = async (array2, mapper) => {
25612
+ let latestError;
25613
+ for (const item of array2) {
25614
+ try {
25615
+ return await mapper(item);
25616
+ } catch (error40) {
25617
+ latestError = error40;
25618
+ }
25619
+ }
25620
+ throw latestError;
25621
+ };
25622
+ var baseOpen = async (options) => {
25623
+ options = {
25624
+ wait: false,
25625
+ background: false,
25626
+ newInstance: false,
25627
+ allowNonzeroExitCode: false,
25628
+ ...options
25629
+ };
25630
+ if (Array.isArray(options.app)) {
25631
+ return pTryEach(options.app, (singleApp) => baseOpen({
25632
+ ...options,
25633
+ app: singleApp
25634
+ }));
25635
+ }
25636
+ let { name: app, arguments: appArguments = [] } = options.app ?? {};
25637
+ appArguments = [...appArguments];
25638
+ if (Array.isArray(app)) {
25639
+ return pTryEach(app, (appName) => baseOpen({
25640
+ ...options,
25641
+ app: {
25642
+ name: appName,
25643
+ arguments: appArguments
25644
+ }
25645
+ }));
25646
+ }
25647
+ if (app === "browser" || app === "browserPrivate") {
25648
+ const ids = {
25649
+ "com.google.chrome": "chrome",
25650
+ "google-chrome.desktop": "chrome",
25651
+ "com.brave.Browser": "brave",
25652
+ "org.mozilla.firefox": "firefox",
25653
+ "firefox.desktop": "firefox",
25654
+ "com.microsoft.msedge": "edge",
25655
+ "com.microsoft.edge": "edge",
25656
+ "com.microsoft.edgemac": "edge",
25657
+ "microsoft-edge.desktop": "edge"
25658
+ };
25659
+ const flags = {
25660
+ chrome: "--incognito",
25661
+ brave: "--incognito",
25662
+ firefox: "--private-window",
25663
+ edge: "--inPrivate"
25664
+ };
25665
+ const browser = is_wsl_default ? await getWindowsDefaultBrowserFromWsl() : await defaultBrowser2();
25666
+ if (browser.id in ids) {
25667
+ const browserName = ids[browser.id];
25668
+ if (app === "browserPrivate") {
25669
+ appArguments.push(flags[browserName]);
25670
+ }
25671
+ return baseOpen({
25672
+ ...options,
25673
+ app: {
25674
+ name: apps[browserName],
25675
+ arguments: appArguments
25676
+ }
25677
+ });
25678
+ }
25679
+ throw new Error(`${browser.name} is not supported as a default browser`);
25680
+ }
25681
+ let command;
25682
+ const cliArguments = [];
25683
+ const childProcessOptions = {};
25684
+ if (platform === "darwin") {
25685
+ command = "open";
25686
+ if (options.wait) {
25687
+ cliArguments.push("--wait-apps");
25688
+ }
25689
+ if (options.background) {
25690
+ cliArguments.push("--background");
25691
+ }
25692
+ if (options.newInstance) {
25693
+ cliArguments.push("--new");
25694
+ }
25695
+ if (app) {
25696
+ cliArguments.push("-a", app);
25697
+ }
25698
+ } else if (platform === "win32" || is_wsl_default && !isInsideContainer() && !app) {
25699
+ command = await powerShellPath();
25700
+ cliArguments.push(
25701
+ "-NoProfile",
25702
+ "-NonInteractive",
25703
+ "-ExecutionPolicy",
25704
+ "Bypass",
25705
+ "-EncodedCommand"
25706
+ );
25707
+ if (!is_wsl_default) {
25708
+ childProcessOptions.windowsVerbatimArguments = true;
25709
+ }
25710
+ const encodedArguments = ["Start"];
25711
+ if (options.wait) {
25712
+ encodedArguments.push("-Wait");
25713
+ }
25714
+ if (app) {
25715
+ encodedArguments.push(`"\`"${app}\`""`);
25716
+ if (options.target) {
25717
+ appArguments.push(options.target);
25718
+ }
25719
+ } else if (options.target) {
25720
+ encodedArguments.push(`"${options.target}"`);
25721
+ }
25722
+ if (appArguments.length > 0) {
25723
+ appArguments = appArguments.map((argument) => `"\`"${argument}\`""`);
25724
+ encodedArguments.push("-ArgumentList", appArguments.join(","));
25725
+ }
25726
+ options.target = Buffer2.from(encodedArguments.join(" "), "utf16le").toString("base64");
25727
+ } else {
25728
+ if (app) {
25729
+ command = app;
25730
+ } else {
25731
+ const isBundled = !__dirname || __dirname === "/";
25732
+ let exeLocalXdgOpen = false;
25733
+ try {
25734
+ await fs6.access(localXdgOpenPath, fsConstants2.X_OK);
25735
+ exeLocalXdgOpen = true;
25736
+ } catch {
25737
+ }
25738
+ const useSystemXdgOpen = process7.versions.electron ?? (platform === "android" || isBundled || !exeLocalXdgOpen);
25739
+ command = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
25740
+ }
25741
+ if (appArguments.length > 0) {
25742
+ cliArguments.push(...appArguments);
25743
+ }
25744
+ if (!options.wait) {
25745
+ childProcessOptions.stdio = "ignore";
25746
+ childProcessOptions.detached = true;
25747
+ }
25748
+ }
25749
+ if (platform === "darwin" && appArguments.length > 0) {
25750
+ cliArguments.push("--args", ...appArguments);
25751
+ }
25752
+ if (options.target) {
25753
+ cliArguments.push(options.target);
25754
+ }
25755
+ const subprocess = childProcess.spawn(command, cliArguments, childProcessOptions);
25756
+ if (options.wait) {
25757
+ return new Promise((resolve16, reject) => {
25758
+ subprocess.once("error", reject);
25759
+ subprocess.once("close", (exitCode) => {
25760
+ if (!options.allowNonzeroExitCode && exitCode > 0) {
25761
+ reject(new Error(`Exited with code ${exitCode}`));
25762
+ return;
25763
+ }
25764
+ resolve16(subprocess);
25765
+ });
25766
+ });
25767
+ }
25768
+ subprocess.unref();
25769
+ return subprocess;
25770
+ };
25771
+ var open = (target, options) => {
25772
+ if (typeof target !== "string") {
25773
+ throw new TypeError("Expected a `target`");
25774
+ }
25775
+ return baseOpen({
25776
+ ...options,
25777
+ target
25778
+ });
25779
+ };
25780
+ function detectArchBinary(binary) {
25781
+ if (typeof binary === "string" || Array.isArray(binary)) {
25782
+ return binary;
25783
+ }
25784
+ const { [arch]: archBinary } = binary;
25785
+ if (!archBinary) {
25786
+ throw new Error(`${arch} is not supported`);
25787
+ }
25788
+ return archBinary;
25789
+ }
25790
+ function detectPlatformBinary({ [platform]: platformBinary }, { wsl }) {
25791
+ if (wsl && is_wsl_default) {
25792
+ return detectArchBinary(wsl);
25793
+ }
25794
+ if (!platformBinary) {
25795
+ throw new Error(`${platform} is not supported`);
25796
+ }
25797
+ return detectArchBinary(platformBinary);
25798
+ }
25799
+ var apps = {};
25800
+ defineLazyProperty(apps, "chrome", () => detectPlatformBinary({
25801
+ darwin: "google chrome",
25802
+ win32: "chrome",
25803
+ linux: ["google-chrome", "google-chrome-stable", "chromium"]
25804
+ }, {
25805
+ wsl: {
25806
+ ia32: "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
25807
+ x64: ["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe", "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]
25808
+ }
25809
+ }));
25810
+ defineLazyProperty(apps, "brave", () => detectPlatformBinary({
25811
+ darwin: "brave browser",
25812
+ win32: "brave",
25813
+ linux: ["brave-browser", "brave"]
25814
+ }, {
25815
+ wsl: {
25816
+ ia32: "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",
25817
+ x64: ["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe", "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]
25818
+ }
25819
+ }));
25820
+ defineLazyProperty(apps, "firefox", () => detectPlatformBinary({
25821
+ darwin: "firefox",
25822
+ win32: String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
25823
+ linux: "firefox"
25824
+ }, {
25825
+ wsl: "/mnt/c/Program Files/Mozilla Firefox/firefox.exe"
25826
+ }));
25827
+ defineLazyProperty(apps, "edge", () => detectPlatformBinary({
25828
+ darwin: "microsoft edge",
25829
+ win32: "msedge",
25830
+ linux: ["microsoft-edge", "microsoft-edge-dev"]
25831
+ }, {
25832
+ wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
25833
+ }));
25834
+ defineLazyProperty(apps, "browser", () => "browser");
25835
+ defineLazyProperty(apps, "browserPrivate", () => "browserPrivate");
25836
+ var open_default = open;
25837
+
25324
25838
  // src/auth/open-browser.ts
25325
- import { execSync } from "node:child_process";
25326
25839
  function isLocalApiUrl(apiUrl) {
25327
25840
  try {
25328
25841
  const u = new URL(apiUrl);
@@ -25332,7 +25845,7 @@ function isLocalApiUrl(apiUrl) {
25332
25845
  return false;
25333
25846
  }
25334
25847
  }
25335
- function openBrowser(connectionId, initialWorkspaceId, preferredBridgeName, apiUrl, logFn = log) {
25848
+ async function openBrowser(connectionId, initialWorkspaceId, preferredBridgeName, apiUrl, logFn = log) {
25336
25849
  const appUrl = apiUrl && isLocalApiUrl(apiUrl) ? process.env.BUILDAUTOMATON_APP_URL ?? "http://localhost:3000" : process.env.BUILDAUTOMATON_APP_URL ?? "https://app.buildautomaton.com";
25337
25850
  let connectCliUrl = `${appUrl.replace(/\/$/, "")}/bridges/connect?connectionId=${connectionId}`;
25338
25851
  if (initialWorkspaceId) {
@@ -25346,10 +25859,11 @@ function openBrowser(connectionId, initialWorkspaceId, preferredBridgeName, apiU
25346
25859
  connectCliUrl += `&bridgeName=${encodeURIComponent(preferredBridgeName.trim())}`;
25347
25860
  }
25348
25861
  logFn("Opening browser to link this CLI\u2026");
25349
- logFn("If you\u2019re already signed in with one workspace, the CLI will connect automatically. Otherwise sign in and link to a workspace.");
25862
+ logFn(
25863
+ "If you\u2019re already signed in with one workspace, the CLI will connect automatically. Otherwise sign in and link to a workspace."
25864
+ );
25350
25865
  try {
25351
- const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
25352
- execSync(`${cmd} "${connectCliUrl}"`, { stdio: "ignore" });
25866
+ await open_default(connectCliUrl, { wait: false });
25353
25867
  } catch {
25354
25868
  logFn("Could not open browser. Open this URL manually:");
25355
25869
  logFn(connectCliUrl);
@@ -25604,7 +26118,7 @@ function runPendingAuth(options) {
25604
26118
  }
25605
26119
  if (!hasOpenedBrowser) {
25606
26120
  hasOpenedBrowser = true;
25607
- openBrowser(connectionId, initialWorkspaceId, preferredBridgeName, apiUrl, logFn);
26121
+ void openBrowser(connectionId, initialWorkspaceId, preferredBridgeName, apiUrl, logFn);
25608
26122
  }
25609
26123
  },
25610
26124
  onClose: (code, reason) => {
@@ -25646,7 +26160,7 @@ function runPendingAuth(options) {
25646
26160
  browserFallback = null;
25647
26161
  if (!hasOpenedBrowser) {
25648
26162
  hasOpenedBrowser = true;
25649
- openBrowser(connectionId, initialWorkspaceId, preferredBridgeName, apiUrl, logFn);
26163
+ void openBrowser(connectionId, initialWorkspaceId, preferredBridgeName, apiUrl, logFn);
25650
26164
  }
25651
26165
  }, BROWSER_OPEN_FALLBACK_MS);
25652
26166
  connect();
@@ -25733,27 +26247,27 @@ function localAgentErrorSuggestsAuth(agentType, errorText) {
25733
26247
  }
25734
26248
 
25735
26249
  // src/git/session-git-queue.ts
25736
- import { execFile as execFile2 } from "node:child_process";
26250
+ import { execFile as execFile7 } from "node:child_process";
25737
26251
  import { readFile, stat } from "node:fs/promises";
25738
- import { promisify as promisify2 } from "node:util";
25739
- import * as path5 from "node:path";
26252
+ import { promisify as promisify7 } from "node:util";
26253
+ import * as path6 from "node:path";
25740
26254
 
25741
26255
  // src/git/pre-turn-snapshot.ts
25742
- import * as fs3 from "node:fs";
25743
- import * as path4 from "node:path";
25744
- import { execFile } from "node:child_process";
25745
- import { promisify } from "node:util";
26256
+ import * as fs8 from "node:fs";
26257
+ import * as path5 from "node:path";
26258
+ import { execFile as execFile6 } from "node:child_process";
26259
+ import { promisify as promisify6 } from "node:util";
25746
26260
 
25747
26261
  // src/git/discover-repos.ts
25748
- import * as fs2 from "node:fs";
25749
- import * as path3 from "node:path";
26262
+ import * as fs7 from "node:fs";
26263
+ import * as path4 from "node:path";
25750
26264
 
25751
26265
  // ../../node_modules/.pnpm/simple-git@3.32.3/node_modules/simple-git/dist/esm/index.js
25752
26266
  var import_file_exists = __toESM(require_dist(), 1);
25753
26267
  var import_debug = __toESM(require_src(), 1);
25754
26268
  var import_promise_deferred = __toESM(require_dist2(), 1);
25755
26269
  var import_promise_deferred2 = __toESM(require_dist2(), 1);
25756
- import { Buffer as Buffer2 } from "node:buffer";
26270
+ import { Buffer as Buffer22 } from "node:buffer";
25757
26271
  import { spawn } from "child_process";
25758
26272
  import { normalize } from "node:path";
25759
26273
  import { EventEmitter } from "node:events";
@@ -25785,8 +26299,8 @@ function pathspec(...paths) {
25785
26299
  cache.set(key, paths);
25786
26300
  return key;
25787
26301
  }
25788
- function isPathSpec(path32) {
25789
- return path32 instanceof String && cache.has(path32);
26302
+ function isPathSpec(path33) {
26303
+ return path33 instanceof String && cache.has(path33);
25790
26304
  }
25791
26305
  function toPaths(pathSpec) {
25792
26306
  return cache.get(pathSpec) || [];
@@ -25875,8 +26389,8 @@ function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
25875
26389
  function forEachLineWithContent(input, callback) {
25876
26390
  return toLinesWithContent(input, true).map((line) => callback(line));
25877
26391
  }
25878
- function folderExists(path32) {
25879
- return (0, import_file_exists.exists)(path32, import_file_exists.FOLDER);
26392
+ function folderExists(path33) {
26393
+ return (0, import_file_exists.exists)(path33, import_file_exists.FOLDER);
25880
26394
  }
25881
26395
  function append(target, item) {
25882
26396
  if (Array.isArray(target)) {
@@ -25933,7 +26447,7 @@ function prefixedArray(input, prefix) {
25933
26447
  return output;
25934
26448
  }
25935
26449
  function bufferToString(input) {
25936
- return (Array.isArray(input) ? Buffer2.concat(input) : input).toString("utf-8");
26450
+ return (Array.isArray(input) ? Buffer22.concat(input) : input).toString("utf-8");
25937
26451
  }
25938
26452
  function pick(source, properties) {
25939
26453
  const out = {};
@@ -26280,8 +26794,8 @@ function checkIsRepoRootTask() {
26280
26794
  commands,
26281
26795
  format: "utf-8",
26282
26796
  onError,
26283
- parser(path32) {
26284
- return /^\.(git)?$/.test(path32.trim());
26797
+ parser(path33) {
26798
+ return /^\.(git)?$/.test(path33.trim());
26285
26799
  }
26286
26800
  };
26287
26801
  }
@@ -26715,11 +27229,11 @@ function parseGrep(grep) {
26715
27229
  const paths = /* @__PURE__ */ new Set();
26716
27230
  const results = {};
26717
27231
  forEachLineWithContent(grep, (input) => {
26718
- const [path32, line, preview] = input.split(NULL);
26719
- paths.add(path32);
26720
- (results[path32] = results[path32] || []).push({
27232
+ const [path33, line, preview] = input.split(NULL);
27233
+ paths.add(path33);
27234
+ (results[path33] = results[path33] || []).push({
26721
27235
  line: asNumber(line),
26722
- path: path32,
27236
+ path: path33,
26723
27237
  preview
26724
27238
  });
26725
27239
  });
@@ -27484,14 +27998,14 @@ var init_hash_object = __esm2({
27484
27998
  init_task();
27485
27999
  }
27486
28000
  });
27487
- function parseInit(bare, path32, text) {
28001
+ function parseInit(bare, path33, text) {
27488
28002
  const response = String(text).trim();
27489
28003
  let result;
27490
28004
  if (result = initResponseRegex.exec(response)) {
27491
- return new InitSummary(bare, path32, false, result[1]);
28005
+ return new InitSummary(bare, path33, false, result[1]);
27492
28006
  }
27493
28007
  if (result = reInitResponseRegex.exec(response)) {
27494
- return new InitSummary(bare, path32, true, result[1]);
28008
+ return new InitSummary(bare, path33, true, result[1]);
27495
28009
  }
27496
28010
  let gitDir = "";
27497
28011
  const tokens = response.split(" ");
@@ -27502,7 +28016,7 @@ function parseInit(bare, path32, text) {
27502
28016
  break;
27503
28017
  }
27504
28018
  }
27505
- return new InitSummary(bare, path32, /^re/i.test(response), gitDir);
28019
+ return new InitSummary(bare, path33, /^re/i.test(response), gitDir);
27506
28020
  }
27507
28021
  var InitSummary;
27508
28022
  var initResponseRegex;
@@ -27511,9 +28025,9 @@ var init_InitSummary = __esm2({
27511
28025
  "src/lib/responses/InitSummary.ts"() {
27512
28026
  "use strict";
27513
28027
  InitSummary = class {
27514
- constructor(bare, path32, existing, gitDir) {
28028
+ constructor(bare, path33, existing, gitDir) {
27515
28029
  this.bare = bare;
27516
- this.path = path32;
28030
+ this.path = path33;
27517
28031
  this.existing = existing;
27518
28032
  this.gitDir = gitDir;
27519
28033
  }
@@ -27525,7 +28039,7 @@ var init_InitSummary = __esm2({
27525
28039
  function hasBareCommand(command) {
27526
28040
  return command.includes(bareCommand);
27527
28041
  }
27528
- function initTask(bare = false, path32, customArgs) {
28042
+ function initTask(bare = false, path33, customArgs) {
27529
28043
  const commands = ["init", ...customArgs];
27530
28044
  if (bare && !hasBareCommand(commands)) {
27531
28045
  commands.splice(1, 0, bareCommand);
@@ -27534,7 +28048,7 @@ function initTask(bare = false, path32, customArgs) {
27534
28048
  commands,
27535
28049
  format: "utf-8",
27536
28050
  parser(text) {
27537
- return parseInit(commands.includes("--bare"), path32, text);
28051
+ return parseInit(commands.includes("--bare"), path33, text);
27538
28052
  }
27539
28053
  };
27540
28054
  }
@@ -28350,12 +28864,12 @@ var init_FileStatusSummary = __esm2({
28350
28864
  "use strict";
28351
28865
  fromPathRegex = /^(.+)\0(.+)$/;
28352
28866
  FileStatusSummary = class {
28353
- constructor(path32, index, working_dir) {
28354
- this.path = path32;
28867
+ constructor(path33, index, working_dir) {
28868
+ this.path = path33;
28355
28869
  this.index = index;
28356
28870
  this.working_dir = working_dir;
28357
28871
  if (index === "R" || working_dir === "R") {
28358
- const detail = fromPathRegex.exec(path32) || [null, path32, path32];
28872
+ const detail = fromPathRegex.exec(path33) || [null, path33, path33];
28359
28873
  this.from = detail[2] || "";
28360
28874
  this.path = detail[1] || "";
28361
28875
  }
@@ -28386,14 +28900,14 @@ function splitLine(result, lineStr) {
28386
28900
  default:
28387
28901
  return;
28388
28902
  }
28389
- function data(index, workingDir, path32) {
28903
+ function data(index, workingDir, path33) {
28390
28904
  const raw = `${index}${workingDir}`;
28391
28905
  const handler = parsers6.get(raw);
28392
28906
  if (handler) {
28393
- handler(result, path32);
28907
+ handler(result, path33);
28394
28908
  }
28395
28909
  if (raw !== "##" && raw !== "!!") {
28396
- result.files.push(new FileStatusSummary(path32, index, workingDir));
28910
+ result.files.push(new FileStatusSummary(path33, index, workingDir));
28397
28911
  }
28398
28912
  }
28399
28913
  }
@@ -28702,9 +29216,9 @@ var init_simple_git_api = __esm2({
28702
29216
  next
28703
29217
  );
28704
29218
  }
28705
- hashObject(path32, write) {
29219
+ hashObject(path33, write) {
28706
29220
  return this._runTask(
28707
- hashObjectTask(path32, write === true),
29221
+ hashObjectTask(path33, write === true),
28708
29222
  trailingFunctionArgument(arguments)
28709
29223
  );
28710
29224
  }
@@ -29057,8 +29571,8 @@ var init_branch = __esm2({
29057
29571
  }
29058
29572
  });
29059
29573
  function toPath(input) {
29060
- const path32 = input.trim().replace(/^["']|["']$/g, "");
29061
- return path32 && normalize(path32);
29574
+ const path33 = input.trim().replace(/^["']|["']$/g, "");
29575
+ return path33 && normalize(path33);
29062
29576
  }
29063
29577
  var parseCheckIgnore;
29064
29578
  var init_CheckIgnore = __esm2({
@@ -29372,8 +29886,8 @@ __export2(sub_module_exports, {
29372
29886
  subModuleTask: () => subModuleTask,
29373
29887
  updateSubModuleTask: () => updateSubModuleTask
29374
29888
  });
29375
- function addSubModuleTask(repo, path32) {
29376
- return subModuleTask(["add", repo, path32]);
29889
+ function addSubModuleTask(repo, path33) {
29890
+ return subModuleTask(["add", repo, path33]);
29377
29891
  }
29378
29892
  function initSubModuleTask(customArgs) {
29379
29893
  return subModuleTask(["init", ...customArgs]);
@@ -29706,8 +30220,8 @@ var require_git = __commonJS2({
29706
30220
  }
29707
30221
  return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
29708
30222
  };
29709
- Git2.prototype.submoduleAdd = function(repo, path32, then) {
29710
- return this._runTask(addSubModuleTask2(repo, path32), trailingFunctionArgument2(arguments));
30223
+ Git2.prototype.submoduleAdd = function(repo, path33, then) {
30224
+ return this._runTask(addSubModuleTask2(repo, path33), trailingFunctionArgument2(arguments));
29711
30225
  };
29712
30226
  Git2.prototype.submoduleUpdate = function(args, then) {
29713
30227
  return this._runTask(
@@ -30333,20 +30847,20 @@ async function isGitRepoDirectory(dirPath) {
30333
30847
  // src/git/discover-repos.ts
30334
30848
  async function discoverGitRepos(cwd = getBridgeWorkspaceDirectory()) {
30335
30849
  const result = [];
30336
- const cwdResolved = path3.resolve(cwd);
30850
+ const cwdResolved = path4.resolve(cwd);
30337
30851
  if (await isGitRepoDirectory(cwdResolved)) {
30338
30852
  const remoteUrl = await getRemoteOriginUrl(cwdResolved);
30339
30853
  result.push({ absolutePath: cwdResolved, remoteUrl });
30340
30854
  }
30341
30855
  let entries;
30342
30856
  try {
30343
- entries = fs2.readdirSync(cwdResolved, { withFileTypes: true });
30857
+ entries = fs7.readdirSync(cwdResolved, { withFileTypes: true });
30344
30858
  } catch {
30345
30859
  return result;
30346
30860
  }
30347
30861
  for (const ent of entries) {
30348
30862
  if (!ent.isDirectory()) continue;
30349
- const childPath = path3.join(cwdResolved, ent.name);
30863
+ const childPath = path4.join(cwdResolved, ent.name);
30350
30864
  if (await isGitRepoDirectory(childPath)) {
30351
30865
  const remoteUrl = await getRemoteOriginUrl(childPath);
30352
30866
  result.push({ absolutePath: childPath, remoteUrl });
@@ -30355,22 +30869,22 @@ async function discoverGitRepos(cwd = getBridgeWorkspaceDirectory()) {
30355
30869
  return result;
30356
30870
  }
30357
30871
  async function discoverGitReposUnderRoot(rootAbs) {
30358
- const root = path3.resolve(rootAbs);
30872
+ const root = path4.resolve(rootAbs);
30359
30873
  const roots = [];
30360
30874
  async function walk(dir) {
30361
30875
  if (await isGitRepoDirectory(dir)) {
30362
- roots.push(path3.resolve(dir));
30876
+ roots.push(path4.resolve(dir));
30363
30877
  return;
30364
30878
  }
30365
30879
  let entries;
30366
30880
  try {
30367
- entries = fs2.readdirSync(dir, { withFileTypes: true });
30881
+ entries = fs7.readdirSync(dir, { withFileTypes: true });
30368
30882
  } catch {
30369
30883
  return;
30370
30884
  }
30371
30885
  for (const ent of entries) {
30372
30886
  if (!ent.isDirectory() || ent.name === ".git") continue;
30373
- await walk(path3.join(dir, ent.name));
30887
+ await walk(path4.join(dir, ent.name));
30374
30888
  }
30375
30889
  }
30376
30890
  await walk(root);
@@ -30384,13 +30898,13 @@ async function discoverGitReposUnderRoot(rootAbs) {
30384
30898
  }
30385
30899
 
30386
30900
  // src/git/pre-turn-snapshot.ts
30387
- var execFileAsync = promisify(execFile);
30901
+ var execFileAsync5 = promisify6(execFile6);
30388
30902
  function snapshotsDirForCwd(agentCwd) {
30389
- return path4.join(agentCwd, ".buildautomaton", "snapshots");
30903
+ return path5.join(agentCwd, ".buildautomaton", "snapshots");
30390
30904
  }
30391
30905
  async function gitStashCreate(repoRoot, log2) {
30392
30906
  try {
30393
- const { stdout } = await execFileAsync("git", ["stash", "create"], {
30907
+ const { stdout } = await execFileAsync5("git", ["stash", "create"], {
30394
30908
  cwd: repoRoot,
30395
30909
  maxBuffer: 10 * 1024 * 1024
30396
30910
  });
@@ -30404,7 +30918,7 @@ async function gitStashCreate(repoRoot, log2) {
30404
30918
  }
30405
30919
  async function gitRun(repoRoot, args, log2, label) {
30406
30920
  try {
30407
- await execFileAsync("git", args, { cwd: repoRoot, maxBuffer: 10 * 1024 * 1024 });
30921
+ await execFileAsync5("git", args, { cwd: repoRoot, maxBuffer: 10 * 1024 * 1024 });
30408
30922
  return { ok: true };
30409
30923
  } catch (e) {
30410
30924
  const msg = e instanceof Error ? e.message : String(e);
@@ -30415,7 +30929,7 @@ async function gitRun(repoRoot, args, log2, label) {
30415
30929
  async function resolveSnapshotRepoRoots(options) {
30416
30930
  const { worktreePaths, fallbackCwd, log: log2 } = options;
30417
30931
  if (worktreePaths?.length) {
30418
- const uniq = [...new Set(worktreePaths.map((p) => path4.resolve(p)))];
30932
+ const uniq = [...new Set(worktreePaths.map((p) => path5.resolve(p)))];
30419
30933
  return uniq;
30420
30934
  }
30421
30935
  try {
@@ -30438,7 +30952,7 @@ async function capturePreTurnSnapshot(options) {
30438
30952
  }
30439
30953
  const dir = snapshotsDirForCwd(agentCwd);
30440
30954
  try {
30441
- fs3.mkdirSync(dir, { recursive: true });
30955
+ fs8.mkdirSync(dir, { recursive: true });
30442
30956
  } catch (e) {
30443
30957
  return { ok: false, error: e instanceof Error ? e.message : String(e) };
30444
30958
  }
@@ -30447,9 +30961,9 @@ async function capturePreTurnSnapshot(options) {
30447
30961
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
30448
30962
  repos
30449
30963
  };
30450
- const filePath = path4.join(dir, `${runId}.json`);
30964
+ const filePath = path5.join(dir, `${runId}.json`);
30451
30965
  try {
30452
- fs3.writeFileSync(filePath, JSON.stringify(payload, null, 2), "utf8");
30966
+ fs8.writeFileSync(filePath, JSON.stringify(payload, null, 2), "utf8");
30453
30967
  } catch (e) {
30454
30968
  return { ok: false, error: e instanceof Error ? e.message : String(e) };
30455
30969
  }
@@ -30462,7 +30976,7 @@ async function capturePreTurnSnapshot(options) {
30462
30976
  async function applyPreTurnSnapshot(filePath, log2) {
30463
30977
  let data;
30464
30978
  try {
30465
- const raw = fs3.readFileSync(filePath, "utf8");
30979
+ const raw = fs8.readFileSync(filePath, "utf8");
30466
30980
  data = JSON.parse(raw);
30467
30981
  } catch (e) {
30468
30982
  return { ok: false, error: e instanceof Error ? e.message : String(e) };
@@ -30485,11 +30999,11 @@ async function applyPreTurnSnapshot(filePath, log2) {
30485
30999
  return { ok: true };
30486
31000
  }
30487
31001
  function snapshotFilePath(agentCwd, runId) {
30488
- return path4.join(snapshotsDirForCwd(agentCwd), `${runId}.json`);
31002
+ return path5.join(snapshotsDirForCwd(agentCwd), `${runId}.json`);
30489
31003
  }
30490
31004
 
30491
31005
  // src/git/session-git-queue.ts
30492
- var execFileAsync2 = promisify2(execFile2);
31006
+ var execFileAsync6 = promisify7(execFile7);
30493
31007
  var MAX_FULL_FILE_TEXT_BYTES = 512 * 1024;
30494
31008
  async function readWorkspaceFileAsUtf8(absPath) {
30495
31009
  try {
@@ -30522,7 +31036,7 @@ async function collectTurnGitDiffFromPreTurnSnapshot(options) {
30522
31036
  if (!repo.stashSha) continue;
30523
31037
  let namesRaw;
30524
31038
  try {
30525
- const { stdout } = await execFileAsync2("git", ["diff", "--name-only", repo.stashSha], {
31039
+ const { stdout } = await execFileAsync6("git", ["diff", "--name-only", repo.stashSha], {
30526
31040
  cwd: repo.path,
30527
31041
  maxBuffer: 10 * 1024 * 1024
30528
31042
  });
@@ -30534,11 +31048,11 @@ async function collectTurnGitDiffFromPreTurnSnapshot(options) {
30534
31048
  continue;
30535
31049
  }
30536
31050
  const lines = namesRaw.split("\n").map((l) => l.trim()).filter(Boolean);
30537
- const slug = path5.basename(repo.path).replace(/[^\w.-]+/g, "_") || "repo";
31051
+ const slug = path6.basename(repo.path).replace(/[^\w.-]+/g, "_") || "repo";
30538
31052
  for (const rel of lines) {
30539
31053
  if (rel.includes("..")) continue;
30540
31054
  try {
30541
- const { stdout: patchContent } = await execFileAsync2(
31055
+ const { stdout: patchContent } = await execFileAsync6(
30542
31056
  "git",
30543
31057
  ["diff", "--no-color", repo.stashSha, "--", rel],
30544
31058
  {
@@ -30548,7 +31062,7 @@ async function collectTurnGitDiffFromPreTurnSnapshot(options) {
30548
31062
  );
30549
31063
  if (!patchContent.trim()) continue;
30550
31064
  const displayPath = multiRepo ? `${slug}/${rel}` : rel;
30551
- const absFile = path5.join(repo.path, rel);
31065
+ const absFile = path6.join(repo.path, rel);
30552
31066
  const newText = await readWorkspaceFileAsUtf8(absFile);
30553
31067
  sendSessionUpdate({
30554
31068
  type: "session_file_change",
@@ -30610,7 +31124,9 @@ async function sendPromptToAgent(options) {
30610
31124
  ...augmentAuthFields(errStr)
30611
31125
  });
30612
31126
  if (!result.success) {
30613
- log2(`[Agent] ${result.error ?? "Error"}`);
31127
+ log2(
31128
+ `[Agent] Prompt did not run successfully on the agent (no successful start/completion): ${result.error ?? "Unknown error"}`
31129
+ );
30614
31130
  }
30615
31131
  } catch (err) {
30616
31132
  const errMsg = err instanceof Error ? err.message : String(err);
@@ -30628,8 +31144,8 @@ async function sendPromptToAgent(options) {
30628
31144
  }
30629
31145
 
30630
31146
  // src/agents/acp/ensure-acp-client.ts
30631
- import * as fs4 from "node:fs";
30632
- import * as path9 from "node:path";
31147
+ import * as fs9 from "node:fs";
31148
+ import * as path10 from "node:path";
30633
31149
 
30634
31150
  // src/error-message.ts
30635
31151
  function errorMessage(err) {
@@ -30649,16 +31165,16 @@ __export(claude_code_acp_client_exports, {
30649
31165
  createClaudeCodeAcpClient: () => createClaudeCodeAcpClient,
30650
31166
  detectLocalAgentPresence: () => detectLocalAgentPresence
30651
31167
  });
30652
- import { execFile as execFile4 } from "node:child_process";
30653
- import { promisify as promisify4 } from "node:util";
31168
+ import { execFile as execFile9 } from "node:child_process";
31169
+ import { promisify as promisify9 } from "node:util";
30654
31170
 
30655
31171
  // src/agents/acp/clients/detect-command-on-path.ts
30656
- import { execFile as execFile3 } from "node:child_process";
30657
- import { promisify as promisify3 } from "node:util";
30658
- var execFileAsync3 = promisify3(execFile3);
31172
+ import { execFile as execFile8 } from "node:child_process";
31173
+ import { promisify as promisify8 } from "node:util";
31174
+ var execFileAsync7 = promisify8(execFile8);
30659
31175
  async function isCommandOnPath(command, timeoutMs = 4e3) {
30660
31176
  try {
30661
- await execFileAsync3("which", [command], { timeout: timeoutMs });
31177
+ await execFileAsync7("which", [command], { timeout: timeoutMs });
30662
31178
  return true;
30663
31179
  } catch {
30664
31180
  return false;
@@ -30718,21 +31234,21 @@ function editSnippetToUnifiedDiff(filePath, oldText, newText) {
30718
31234
  }
30719
31235
 
30720
31236
  // src/agents/acp/safe-fs-path.ts
30721
- import * as path6 from "node:path";
31237
+ import * as path7 from "node:path";
30722
31238
  function resolveSafePathUnderCwd(cwd, filePath) {
30723
31239
  const trimmed2 = filePath.trim();
30724
31240
  if (!trimmed2) return null;
30725
- const normalizedCwd = path6.resolve(cwd);
30726
- const resolved = path6.isAbsolute(trimmed2) ? path6.normalize(trimmed2) : path6.resolve(normalizedCwd, trimmed2);
30727
- const rel = path6.relative(normalizedCwd, resolved);
30728
- if (rel.startsWith("..") || path6.isAbsolute(rel)) return null;
31241
+ const normalizedCwd = path7.resolve(cwd);
31242
+ const resolved = path7.isAbsolute(trimmed2) ? path7.normalize(trimmed2) : path7.resolve(normalizedCwd, trimmed2);
31243
+ const rel = path7.relative(normalizedCwd, resolved);
31244
+ if (rel.startsWith("..") || path7.isAbsolute(rel)) return null;
30729
31245
  return resolved;
30730
31246
  }
30731
31247
  function toDisplayPathRelativeToCwd(cwd, absolutePath) {
30732
- const normalizedCwd = path6.resolve(cwd);
30733
- const rel = path6.relative(normalizedCwd, path6.resolve(absolutePath));
30734
- if (!rel || rel === "") return path6.basename(absolutePath);
30735
- return rel.split(path6.sep).join("/");
31248
+ const normalizedCwd = path7.resolve(cwd);
31249
+ const rel = path7.relative(normalizedCwd, path7.resolve(absolutePath));
31250
+ if (!rel || rel === "") return path7.basename(absolutePath);
31251
+ return rel.split(path7.sep).join("/");
30736
31252
  }
30737
31253
 
30738
31254
  // src/agents/acp/clients/agent-stderr-capture.ts
@@ -31053,12 +31569,12 @@ async function createSdkStdioAcpClient(options) {
31053
31569
  }
31054
31570
 
31055
31571
  // src/agents/acp/clients/claude-code-acp-client.ts
31056
- var execFileAsync4 = promisify4(execFile4);
31572
+ var execFileAsync8 = promisify9(execFile9);
31057
31573
  var BACKEND_LOCAL_AGENT_TYPE = "claude-code";
31058
31574
  async function detectLocalAgentPresence() {
31059
31575
  if (await isCommandOnPath("claude")) return true;
31060
31576
  try {
31061
- await execFileAsync4("npx", ["--yes", "@anthropic-ai/claude-code", "--version"], { timeout: 25e3 });
31577
+ await execFileAsync8("npx", ["--yes", "@anthropic-ai/claude-code", "--version"], { timeout: 25e3 });
31062
31578
  return true;
31063
31579
  } catch {
31064
31580
  return false;
@@ -31556,48 +32072,48 @@ function resolveAgentCommand(preferredAgentType) {
31556
32072
  }
31557
32073
 
31558
32074
  // src/agents/acp/session-file-change-path-kind.ts
31559
- import { execFileSync as execFileSync3 } from "node:child_process";
32075
+ import { execFileSync as execFileSync4 } from "node:child_process";
31560
32076
  import { existsSync, statSync } from "node:fs";
31561
32077
 
31562
32078
  // src/git/get-git-repo-root-sync.ts
31563
- import { execFileSync } from "node:child_process";
31564
- import * as path7 from "node:path";
32079
+ import { execFileSync as execFileSync2 } from "node:child_process";
32080
+ import * as path8 from "node:path";
31565
32081
  function getGitRepoRootSync(startDir) {
31566
32082
  try {
31567
- const out = execFileSync("git", ["rev-parse", "--show-toplevel"], {
31568
- cwd: path7.resolve(startDir),
32083
+ const out = execFileSync2("git", ["rev-parse", "--show-toplevel"], {
32084
+ cwd: path8.resolve(startDir),
31569
32085
  encoding: "utf8",
31570
32086
  stdio: ["ignore", "pipe", "ignore"],
31571
32087
  maxBuffer: 1024 * 1024
31572
32088
  }).trim();
31573
- return out ? path7.resolve(out) : null;
32089
+ return out ? path8.resolve(out) : null;
31574
32090
  } catch {
31575
32091
  return null;
31576
32092
  }
31577
32093
  }
31578
32094
 
31579
32095
  // src/agents/acp/workspace-files.ts
31580
- import { execFileSync as execFileSync2 } from "node:child_process";
32096
+ import { execFileSync as execFileSync3 } from "node:child_process";
31581
32097
  import { readFileSync as readFileSync4 } from "node:fs";
31582
- import * as path8 from "node:path";
32098
+ import * as path9 from "node:path";
31583
32099
  function resolveWorkspaceFilePath(cwd, rawPath) {
31584
32100
  const trimmed2 = rawPath.trim();
31585
32101
  if (!trimmed2) return null;
31586
- const normalizedCwd = path8.resolve(cwd);
32102
+ const normalizedCwd = path9.resolve(cwd);
31587
32103
  let abs = resolveSafePathUnderCwd(cwd, trimmed2);
31588
32104
  if (!abs) {
31589
- const candidate = path8.isAbsolute(trimmed2) ? path8.normalize(trimmed2) : path8.normalize(path8.resolve(normalizedCwd, trimmed2));
32105
+ const candidate = path9.isAbsolute(trimmed2) ? path9.normalize(trimmed2) : path9.normalize(path9.resolve(normalizedCwd, trimmed2));
31590
32106
  const gitRoot2 = getGitRepoRootSync(cwd);
31591
32107
  if (!gitRoot2) return null;
31592
- const rel = path8.relative(gitRoot2, candidate);
31593
- if (rel.startsWith("..") || path8.isAbsolute(rel)) return null;
32108
+ const rel = path9.relative(gitRoot2, candidate);
32109
+ if (rel.startsWith("..") || path9.isAbsolute(rel)) return null;
31594
32110
  abs = candidate;
31595
32111
  }
31596
32112
  const gitRoot = getGitRepoRootSync(cwd);
31597
32113
  if (gitRoot) {
31598
- const relFromRoot = path8.relative(gitRoot, abs);
31599
- if (!relFromRoot.startsWith("..") && !path8.isAbsolute(relFromRoot)) {
31600
- return { abs, display: relFromRoot.split(path8.sep).join("/") };
32114
+ const relFromRoot = path9.relative(gitRoot, abs);
32115
+ if (!relFromRoot.startsWith("..") && !path9.isAbsolute(relFromRoot)) {
32116
+ return { abs, display: relFromRoot.split(path9.sep).join("/") };
31601
32117
  }
31602
32118
  }
31603
32119
  return { abs, display: toDisplayPathRelativeToCwd(cwd, abs) };
@@ -31606,9 +32122,9 @@ function readUtf8WorkspaceFile(cwd, displayPath) {
31606
32122
  if (!displayPath || displayPath.includes("..")) return "";
31607
32123
  const gitRoot = getGitRepoRootSync(cwd);
31608
32124
  if (gitRoot) {
31609
- const abs2 = path8.resolve(gitRoot, displayPath);
31610
- const rel = path8.relative(gitRoot, abs2);
31611
- if (!rel.startsWith("..") && !path8.isAbsolute(rel)) {
32125
+ const abs2 = path9.resolve(gitRoot, displayPath);
32126
+ const rel = path9.relative(gitRoot, abs2);
32127
+ if (!rel.startsWith("..") && !path9.isAbsolute(rel)) {
31612
32128
  try {
31613
32129
  return readFileSync4(abs2, "utf8");
31614
32130
  } catch {
@@ -31627,9 +32143,9 @@ function tryWorkspaceDisplayToAbs(cwd, displayPath) {
31627
32143
  if (!displayPath || displayPath.includes("..")) return null;
31628
32144
  const gitRoot = getGitRepoRootSync(cwd);
31629
32145
  if (gitRoot) {
31630
- const abs = path8.resolve(gitRoot, displayPath);
31631
- const rel = path8.relative(gitRoot, abs);
31632
- if (!rel.startsWith("..") && !path8.isAbsolute(rel)) return abs;
32146
+ const abs = path9.resolve(gitRoot, displayPath);
32147
+ const rel = path9.relative(gitRoot, abs);
32148
+ if (!rel.startsWith("..") && !path9.isAbsolute(rel)) return abs;
31633
32149
  }
31634
32150
  return resolveSafePathUnderCwd(cwd, displayPath);
31635
32151
  }
@@ -31638,7 +32154,7 @@ function readGitHeadBlob(cwd, displayPath) {
31638
32154
  const gitRoot = getGitRepoRootSync(cwd);
31639
32155
  const execCwd = gitRoot ?? cwd;
31640
32156
  try {
31641
- return execFileSync2("git", ["show", `HEAD:${displayPath}`], {
32157
+ return execFileSync3("git", ["show", `HEAD:${displayPath}`], {
31642
32158
  cwd: execCwd,
31643
32159
  encoding: "utf8",
31644
32160
  maxBuffer: 50 * 1024 * 1024
@@ -31654,7 +32170,7 @@ function gitHeadPathObjectType(cwd, displayPath) {
31654
32170
  const gitRoot = getGitRepoRootSync(cwd);
31655
32171
  if (!gitRoot) return null;
31656
32172
  try {
31657
- return execFileSync3("git", ["cat-file", "-t", `HEAD:${displayPath}`], {
32173
+ return execFileSync4("git", ["cat-file", "-t", `HEAD:${displayPath}`], {
31658
32174
  cwd: gitRoot,
31659
32175
  encoding: "utf8"
31660
32176
  }).trim();
@@ -31745,7 +32261,7 @@ function createBridgeOnRequest(opts) {
31745
32261
  }
31746
32262
 
31747
32263
  // src/agents/acp/hooks/extract-acp-file-diffs-from-update/paths-and-text.ts
31748
- import { fileURLToPath } from "node:url";
32264
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
31749
32265
  function readOptionalTextField(v) {
31750
32266
  if (v === null || v === void 0) return "";
31751
32267
  if (typeof v === "string") return v;
@@ -31755,7 +32271,7 @@ function normalizePathField(raw) {
31755
32271
  const t = raw.trim();
31756
32272
  if (t.startsWith("file://")) {
31757
32273
  try {
31758
- return fileURLToPath(t);
32274
+ return fileURLToPath2(t);
31759
32275
  } catch {
31760
32276
  return t;
31761
32277
  }
@@ -32197,10 +32713,10 @@ function buildAcpSessionBridgeHooks(opts) {
32197
32713
  // src/agents/acp/ensure-acp-client.ts
32198
32714
  async function ensureAcpClient(options) {
32199
32715
  const { state, preferredAgentType, mode, cwd, routing, sendSessionUpdate, sendRequest, log: log2 } = options;
32200
- const targetCwd = path9.resolve(
32716
+ const targetCwd = path10.resolve(
32201
32717
  cwd != null && String(cwd).trim() !== "" ? String(cwd).trim() : getBridgeWorkspaceDirectory()
32202
32718
  );
32203
- if (state.acpHandle && state.lastAcpCwd != null && path9.resolve(state.lastAcpCwd) !== path9.resolve(targetCwd)) {
32719
+ if (state.acpHandle && state.lastAcpCwd != null && path10.resolve(state.lastAcpCwd) !== path10.resolve(targetCwd)) {
32204
32720
  try {
32205
32721
  state.acpHandle.disconnect();
32206
32722
  } catch {
@@ -32232,7 +32748,7 @@ async function ensureAcpClient(options) {
32232
32748
  if (!state.acpStartPromise) {
32233
32749
  let statOk = false;
32234
32750
  try {
32235
- const st = fs4.statSync(targetCwd);
32751
+ const st = fs9.statSync(targetCwd);
32236
32752
  statOk = st.isDirectory();
32237
32753
  if (!statOk) {
32238
32754
  state.lastAcpStartError = `Agent cwd is not a directory: ${targetCwd}`;
@@ -32428,12 +32944,12 @@ async function createAcpManager(options) {
32428
32944
  }
32429
32945
 
32430
32946
  // src/worktrees/session-worktree-manager.ts
32431
- import * as path15 from "node:path";
32432
- import os3 from "node:os";
32947
+ import * as path16 from "node:path";
32948
+ import os4 from "node:os";
32433
32949
 
32434
32950
  // src/worktrees/prepare-new-session-worktrees.ts
32435
- import * as fs6 from "node:fs";
32436
- import * as path11 from "node:path";
32951
+ import * as fs11 from "node:fs";
32952
+ import * as path12 from "node:path";
32437
32953
 
32438
32954
  // src/git/worktree-add.ts
32439
32955
  async function gitWorktreeAddBranch(mainRepoPath, worktreePath, branch) {
@@ -32442,12 +32958,12 @@ async function gitWorktreeAddBranch(mainRepoPath, worktreePath, branch) {
32442
32958
  }
32443
32959
 
32444
32960
  // src/worktrees/worktree-layout-file.ts
32445
- import * as fs5 from "node:fs";
32446
- import * as path10 from "node:path";
32447
- import os2 from "node:os";
32961
+ import * as fs10 from "node:fs";
32962
+ import * as path11 from "node:path";
32963
+ import os3 from "node:os";
32448
32964
  var LAYOUT_FILENAME = "worktree-launcher-layout.json";
32449
32965
  function defaultWorktreeLayoutPath() {
32450
- return path10.join(os2.homedir(), ".buildautomaton", LAYOUT_FILENAME);
32966
+ return path11.join(os3.homedir(), ".buildautomaton", LAYOUT_FILENAME);
32451
32967
  }
32452
32968
  function normalizeLoadedLayout(raw) {
32453
32969
  if (raw && typeof raw === "object" && "launcherCwds" in raw) {
@@ -32459,8 +32975,8 @@ function normalizeLoadedLayout(raw) {
32459
32975
  function loadWorktreeLayout() {
32460
32976
  try {
32461
32977
  const p = defaultWorktreeLayoutPath();
32462
- if (!fs5.existsSync(p)) return { launcherCwds: [] };
32463
- const raw = JSON.parse(fs5.readFileSync(p, "utf8"));
32978
+ if (!fs10.existsSync(p)) return { launcherCwds: [] };
32979
+ const raw = JSON.parse(fs10.readFileSync(p, "utf8"));
32464
32980
  return normalizeLoadedLayout(raw);
32465
32981
  } catch {
32466
32982
  return { launcherCwds: [] };
@@ -32468,18 +32984,18 @@ function loadWorktreeLayout() {
32468
32984
  }
32469
32985
  function saveWorktreeLayout(layout) {
32470
32986
  try {
32471
- const dir = path10.dirname(defaultWorktreeLayoutPath());
32472
- fs5.mkdirSync(dir, { recursive: true });
32473
- fs5.writeFileSync(defaultWorktreeLayoutPath(), JSON.stringify(layout, null, 2), "utf8");
32987
+ const dir = path11.dirname(defaultWorktreeLayoutPath());
32988
+ fs10.mkdirSync(dir, { recursive: true });
32989
+ fs10.writeFileSync(defaultWorktreeLayoutPath(), JSON.stringify(layout, null, 2), "utf8");
32474
32990
  } catch {
32475
32991
  }
32476
32992
  }
32477
32993
  function baseNameSafe(abs) {
32478
- return path10.basename(abs).replace(/[^a-zA-Z0-9._-]+/g, "-") || "cwd";
32994
+ return path11.basename(abs).replace(/[^a-zA-Z0-9._-]+/g, "-") || "cwd";
32479
32995
  }
32480
32996
  function allocateDirNameForLauncherCwd(layout, launcherCwdAbs) {
32481
- const norm = path10.resolve(launcherCwdAbs);
32482
- const existing = layout.launcherCwds.find((e) => path10.resolve(e.absolutePath) === norm);
32997
+ const norm = path11.resolve(launcherCwdAbs);
32998
+ const existing = layout.launcherCwds.find((e) => path11.resolve(e.absolutePath) === norm);
32483
32999
  if (existing) return existing.dirName;
32484
33000
  const base = baseNameSafe(norm);
32485
33001
  const used = new Set(layout.launcherCwds.map((e) => e.dirName));
@@ -32497,9 +33013,9 @@ function allocateDirNameForLauncherCwd(layout, launcherCwdAbs) {
32497
33013
  // src/worktrees/prepare-new-session-worktrees.ts
32498
33014
  async function prepareNewSessionWorktrees(options) {
32499
33015
  const { rootAbs, launcherCwd, sessionId, layout, log: log2 } = options;
32500
- const launcherResolved = path11.resolve(launcherCwd);
33016
+ const launcherResolved = path12.resolve(launcherCwd);
32501
33017
  const cwdKey = allocateDirNameForLauncherCwd(layout, launcherResolved);
32502
- const agentMirrorRoot = path11.join(rootAbs, cwdKey);
33018
+ const agentMirrorRoot = path12.join(rootAbs, cwdKey);
32503
33019
  const repos = await discoverGitReposUnderRoot(launcherResolved);
32504
33020
  if (repos.length === 0) {
32505
33021
  log2("[worktrees] No Git repositories under launcher working directory; skipping worktree creation.");
@@ -32507,13 +33023,13 @@ async function prepareNewSessionWorktrees(options) {
32507
33023
  }
32508
33024
  const branch = `session-${sessionId}`;
32509
33025
  const worktreePaths = [];
32510
- fs6.mkdirSync(agentMirrorRoot, { recursive: true });
33026
+ fs11.mkdirSync(agentMirrorRoot, { recursive: true });
32511
33027
  for (const repo of repos) {
32512
- let rel = path11.relative(launcherResolved, repo.absolutePath);
32513
- if (rel.startsWith("..") || path11.isAbsolute(rel)) continue;
33028
+ let rel = path12.relative(launcherResolved, repo.absolutePath);
33029
+ if (rel.startsWith("..") || path12.isAbsolute(rel)) continue;
32514
33030
  const relNorm = rel === "" ? "." : rel;
32515
- const wtPath = path11.join(agentMirrorRoot, relNorm, sessionId);
32516
- fs6.mkdirSync(path11.dirname(wtPath), { recursive: true });
33031
+ const wtPath = path12.join(agentMirrorRoot, relNorm, sessionId);
33032
+ fs11.mkdirSync(path12.dirname(wtPath), { recursive: true });
32517
33033
  try {
32518
33034
  await gitWorktreeAddBranch(repo.absolutePath, wtPath, branch);
32519
33035
  log2(`[worktrees] Added worktree ${wtPath} (branch ${branch}).`);
@@ -32550,23 +33066,23 @@ async function renameSessionWorktreeBranches(paths, newBranch, log2) {
32550
33066
  }
32551
33067
 
32552
33068
  // src/worktrees/remove-session-worktrees.ts
32553
- import * as fs9 from "node:fs";
33069
+ import * as fs14 from "node:fs";
32554
33070
 
32555
33071
  // src/git/worktree-remove.ts
32556
- import * as fs8 from "node:fs";
33072
+ import * as fs13 from "node:fs";
32557
33073
 
32558
33074
  // src/git/resolve-main-repo-from-git-file.ts
32559
- import * as fs7 from "node:fs";
32560
- import * as path12 from "node:path";
33075
+ import * as fs12 from "node:fs";
33076
+ import * as path13 from "node:path";
32561
33077
  function resolveMainRepoFromWorktreeGitFile(wt) {
32562
- const gitDirFile = path12.join(wt, ".git");
32563
- if (!fs7.existsSync(gitDirFile) || !fs7.statSync(gitDirFile).isFile()) return "";
32564
- const first2 = fs7.readFileSync(gitDirFile, "utf8").trim();
33078
+ const gitDirFile = path13.join(wt, ".git");
33079
+ if (!fs12.existsSync(gitDirFile) || !fs12.statSync(gitDirFile).isFile()) return "";
33080
+ const first2 = fs12.readFileSync(gitDirFile, "utf8").trim();
32565
33081
  const m = first2.match(/^gitdir:\s*(.+)$/im);
32566
33082
  if (!m) return "";
32567
- const gitWorktreePath = path12.resolve(wt, m[1].trim());
32568
- const gitDir = path12.dirname(path12.dirname(gitWorktreePath));
32569
- return path12.dirname(gitDir);
33083
+ const gitWorktreePath = path13.resolve(wt, m[1].trim());
33084
+ const gitDir = path13.dirname(path13.dirname(gitWorktreePath));
33085
+ return path13.dirname(gitDir);
32570
33086
  }
32571
33087
 
32572
33088
  // src/git/worktree-remove.ts
@@ -32575,7 +33091,7 @@ async function gitWorktreeRemoveForce(worktreePath) {
32575
33091
  if (mainRepo) {
32576
33092
  await simpleGit(mainRepo).raw(["worktree", "remove", "--force", worktreePath]);
32577
33093
  } else {
32578
- fs8.rmSync(worktreePath, { recursive: true, force: true });
33094
+ fs13.rmSync(worktreePath, { recursive: true, force: true });
32579
33095
  }
32580
33096
  }
32581
33097
 
@@ -32588,7 +33104,7 @@ async function removeSessionWorktrees(paths, log2) {
32588
33104
  } catch (e) {
32589
33105
  log2(`[worktrees] Remove failed for ${wt}: ${e instanceof Error ? e.message : String(e)}`);
32590
33106
  try {
32591
- fs9.rmSync(wt, { recursive: true, force: true });
33107
+ fs14.rmSync(wt, { recursive: true, force: true });
32592
33108
  } catch {
32593
33109
  }
32594
33110
  }
@@ -32808,7 +33324,7 @@ function formatRemoteDisplayLabel(remoteUrl) {
32808
33324
  }
32809
33325
 
32810
33326
  // src/git/working-directory/changes/get-working-tree-change-repo-details.ts
32811
- import * as path14 from "node:path";
33327
+ import * as path15 from "node:path";
32812
33328
 
32813
33329
  // src/git/working-directory/changes/parse-git-status.ts
32814
33330
  function parseNameStatusLines(lines) {
@@ -32928,8 +33444,8 @@ async function listChangedFilesForCommit(repoGitCwd, repoRelPath, commitSha) {
32928
33444
  }
32929
33445
 
32930
33446
  // src/git/working-directory/changes/list-changed-files-for-repo.ts
32931
- import * as fs11 from "node:fs";
32932
- import * as path13 from "node:path";
33447
+ import * as fs16 from "node:fs";
33448
+ import * as path14 from "node:path";
32933
33449
 
32934
33450
  // src/git/working-directory/changes/count-lines.ts
32935
33451
  import { createReadStream } from "node:fs";
@@ -32953,7 +33469,7 @@ async function countTextFileLines(absFile) {
32953
33469
  }
32954
33470
 
32955
33471
  // src/git/working-directory/changes/hydrate-patch.ts
32956
- import * as fs10 from "node:fs";
33472
+ import * as fs15 from "node:fs";
32957
33473
  var UNIFIED_HUNK_HEADER_RE = /^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/;
32958
33474
  var MAX_HYDRATE_LINES_PER_GAP = 8e3;
32959
33475
  var MAX_HYDRATE_LINES_PER_FILE = 8e4;
@@ -32968,7 +33484,7 @@ async function readGitBlobLines(repoCwd, pathInRepo) {
32968
33484
  }
32969
33485
  async function readWorktreeFileLines(abs) {
32970
33486
  try {
32971
- const raw = await fs10.promises.readFile(abs, "utf8");
33487
+ const raw = await fs15.promises.readFile(abs, "utf8");
32972
33488
  return raw.split(/\r?\n/);
32973
33489
  } catch {
32974
33490
  return null;
@@ -33103,7 +33619,7 @@ async function listChangedFilesForRepo(repoGitCwd, repoRelPath) {
33103
33619
  const rows = [];
33104
33620
  for (const pathInRepo of paths) {
33105
33621
  const relLauncher = posixJoinDirFile(repoRelPath, pathInRepo.replace(/\\/g, "/"));
33106
- const abs = path13.join(repoGitCwd, pathInRepo);
33622
+ const abs = path14.join(repoGitCwd, pathInRepo);
33107
33623
  const nums = numByPath.get(pathInRepo);
33108
33624
  let additions = nums?.additions ?? 0;
33109
33625
  let deletions = nums?.deletions ?? 0;
@@ -33116,7 +33632,7 @@ async function listChangedFilesForRepo(repoGitCwd, repoRelPath) {
33116
33632
  deletions = fromGit.deletions;
33117
33633
  } else {
33118
33634
  try {
33119
- const st = await fs11.promises.stat(abs);
33635
+ const st = await fs16.promises.stat(abs);
33120
33636
  if (st.isFile()) additions = await countTextFileLines(abs);
33121
33637
  else additions = 0;
33122
33638
  } catch {
@@ -33142,7 +33658,7 @@ async function listChangedFilesForRepo(repoGitCwd, repoRelPath) {
33142
33658
  } else {
33143
33659
  pathInRepo = row.pathRelLauncher;
33144
33660
  }
33145
- const absFile = path13.join(repoGitCwd, pathInRepo);
33661
+ const absFile = path14.join(repoGitCwd, pathInRepo);
33146
33662
  let patch = await unifiedDiffForFile(repoGitCwd, pathInRepo, row.change);
33147
33663
  if (patch) {
33148
33664
  patch = await hydrateUnifiedPatchWithFileContext(patch, absFile, repoGitCwd, pathInRepo, row.change);
@@ -33158,8 +33674,8 @@ function normRepoRel(p) {
33158
33674
  return x === "" ? "." : x;
33159
33675
  }
33160
33676
  async function getWorkingTreeChangeRepoDetails(options) {
33161
- const launcher = path14.resolve(getBridgeWorkspaceDirectory());
33162
- const mirror = options.agentMirrorRootAbs ? path14.resolve(options.agentMirrorRootAbs) : null;
33677
+ const launcher = path15.resolve(getBridgeWorkspaceDirectory());
33678
+ const mirror = options.agentMirrorRootAbs ? path15.resolve(options.agentMirrorRootAbs) : null;
33163
33679
  const out = [];
33164
33680
  const filter = options.repoFilterRelPath != null ? normRepoRel(options.repoFilterRelPath) : null;
33165
33681
  const basisInput = options.basis ?? { kind: "working" };
@@ -33171,7 +33687,7 @@ async function getWorkingTreeChangeRepoDetails(options) {
33171
33687
  }
33172
33688
  const basis = filter == null && basisInput.kind === "commit" ? { kind: "working" } : basisInput;
33173
33689
  for (const target of options.commitTargetAbsDirs) {
33174
- const t = path14.resolve(target);
33690
+ const t = path15.resolve(target);
33175
33691
  if (!await isGitRepoDirectory(t)) continue;
33176
33692
  const g = simpleGit(t);
33177
33693
  let branch = "HEAD";
@@ -33184,7 +33700,7 @@ async function getWorkingTreeChangeRepoDetails(options) {
33184
33700
  const remoteDisplay = formatRemoteDisplayLabel(remoteUrl);
33185
33701
  let repoRelPath;
33186
33702
  if (mirror) {
33187
- const relNorm = path14.relative(mirror, path14.dirname(t));
33703
+ const relNorm = path15.relative(mirror, path15.dirname(t));
33188
33704
  repoRelPath = relNorm === "" ? "." : relNorm.replace(/\\/g, "/");
33189
33705
  } else {
33190
33706
  let top = t;
@@ -33193,8 +33709,8 @@ async function getWorkingTreeChangeRepoDetails(options) {
33193
33709
  } catch {
33194
33710
  top = t;
33195
33711
  }
33196
- const rel = path14.relative(launcher, path14.resolve(top)).replace(/\\/g, "/") || ".";
33197
- repoRelPath = rel.startsWith("..") ? path14.basename(path14.resolve(top)) : rel;
33712
+ const rel = path15.relative(launcher, path15.resolve(top)).replace(/\\/g, "/") || ".";
33713
+ repoRelPath = rel.startsWith("..") ? path15.basename(path15.resolve(top)) : rel;
33198
33714
  }
33199
33715
  const norm = normRepoRel(repoRelPath === "" ? "." : repoRelPath);
33200
33716
  if (filter && norm !== filter) continue;
@@ -33286,7 +33802,7 @@ var SessionWorktreeManager = class {
33286
33802
  }
33287
33803
  if (!opts.isNewSession) {
33288
33804
  const agentCwd = this.sessionAgentCwd.get(sessionId);
33289
- if (agentCwd) return path15.resolve(agentCwd);
33805
+ if (agentCwd) return path16.resolve(agentCwd);
33290
33806
  return void 0;
33291
33807
  }
33292
33808
  const prep = await prepareNewSessionWorktrees({
@@ -33299,7 +33815,7 @@ var SessionWorktreeManager = class {
33299
33815
  if (!prep) return void 0;
33300
33816
  this.sessionPaths.set(sessionId, prep.worktreePaths);
33301
33817
  this.sessionAgentCwd.set(sessionId, prep.agentCwd);
33302
- return path15.resolve(prep.agentCwd);
33818
+ return path16.resolve(prep.agentCwd);
33303
33819
  }
33304
33820
  async renameSessionBranch(sessionId, newBranch) {
33305
33821
  const paths = this.sessionPaths.get(sessionId);
@@ -33320,7 +33836,7 @@ var SessionWorktreeManager = class {
33320
33836
  getAgentCwdForSession(sessionId) {
33321
33837
  if (!sessionId) return null;
33322
33838
  const c = this.sessionAgentCwd.get(sessionId);
33323
- return c ? path15.resolve(c) : null;
33839
+ return c ? path16.resolve(c) : null;
33324
33840
  }
33325
33841
  async removeSessionWorktrees(sessionId) {
33326
33842
  const paths = this.sessionPaths.get(sessionId);
@@ -33368,15 +33884,15 @@ var SessionWorktreeManager = class {
33368
33884
  }
33369
33885
  };
33370
33886
  function defaultWorktreesRootAbs() {
33371
- return path15.join(os3.homedir(), ".buildautomaton", "worktrees");
33887
+ return path16.join(os4.homedir(), ".buildautomaton", "worktrees");
33372
33888
  }
33373
33889
 
33374
33890
  // src/files/watch-file-index.ts
33375
33891
  import { watch } from "node:fs";
33376
- import path22 from "node:path";
33892
+ import path23 from "node:path";
33377
33893
 
33378
33894
  // src/files/index/build-file-index.ts
33379
- import path19 from "node:path";
33895
+ import path20 from "node:path";
33380
33896
 
33381
33897
  // src/runtime/yield-to-event-loop.ts
33382
33898
  function yieldToEventLoop() {
@@ -33384,14 +33900,14 @@ function yieldToEventLoop() {
33384
33900
  }
33385
33901
 
33386
33902
  // src/files/index/walk-workspace-tree.ts
33387
- import fs12 from "node:fs";
33388
- import path17 from "node:path";
33903
+ import fs17 from "node:fs";
33904
+ import path18 from "node:path";
33389
33905
 
33390
33906
  // src/files/index/constants.ts
33391
- import path16 from "node:path";
33392
- import os4 from "node:os";
33907
+ import path17 from "node:path";
33908
+ import os5 from "node:os";
33393
33909
  var INDEX_WORK_YIELD_EVERY = 256;
33394
- var INDEX_DIR = path16.join(os4.homedir(), ".buildautomaton");
33910
+ var INDEX_DIR = path17.join(os5.homedir(), ".buildautomaton");
33395
33911
  var INDEX_HASH_LEN = 16;
33396
33912
  var INDEX_VERSION = 2;
33397
33913
  var INDEX_LOG_PREFIX = "[file-index]";
@@ -33400,20 +33916,20 @@ var INDEX_LOG_PREFIX = "[file-index]";
33400
33916
  function walkWorkspaceTreeSync(dir, baseDir, out) {
33401
33917
  let names;
33402
33918
  try {
33403
- names = fs12.readdirSync(dir);
33919
+ names = fs17.readdirSync(dir);
33404
33920
  } catch {
33405
33921
  return;
33406
33922
  }
33407
33923
  for (const name of names) {
33408
33924
  if (name.startsWith(".")) continue;
33409
- const full = path17.join(dir, name);
33925
+ const full = path18.join(dir, name);
33410
33926
  let stat2;
33411
33927
  try {
33412
- stat2 = fs12.statSync(full);
33928
+ stat2 = fs17.statSync(full);
33413
33929
  } catch {
33414
33930
  continue;
33415
33931
  }
33416
- const relative5 = path17.relative(baseDir, full).replace(/\\/g, "/");
33932
+ const relative5 = path18.relative(baseDir, full).replace(/\\/g, "/");
33417
33933
  if (stat2.isDirectory()) {
33418
33934
  walkWorkspaceTreeSync(full, baseDir, out);
33419
33935
  } else if (stat2.isFile()) {
@@ -33424,7 +33940,7 @@ function walkWorkspaceTreeSync(dir, baseDir, out) {
33424
33940
  async function walkWorkspaceTreeAsync(dir, baseDir, out, state) {
33425
33941
  let names;
33426
33942
  try {
33427
- names = await fs12.promises.readdir(dir);
33943
+ names = await fs17.promises.readdir(dir);
33428
33944
  } catch {
33429
33945
  return;
33430
33946
  }
@@ -33434,14 +33950,14 @@ async function walkWorkspaceTreeAsync(dir, baseDir, out, state) {
33434
33950
  await yieldToEventLoop();
33435
33951
  }
33436
33952
  state.n++;
33437
- const full = path17.join(dir, name);
33953
+ const full = path18.join(dir, name);
33438
33954
  let stat2;
33439
33955
  try {
33440
- stat2 = await fs12.promises.stat(full);
33956
+ stat2 = await fs17.promises.stat(full);
33441
33957
  } catch {
33442
33958
  continue;
33443
33959
  }
33444
- const relative5 = path17.relative(baseDir, full).replace(/\\/g, "/");
33960
+ const relative5 = path18.relative(baseDir, full).replace(/\\/g, "/");
33445
33961
  if (stat2.isDirectory()) {
33446
33962
  await walkWorkspaceTreeAsync(full, baseDir, out, state);
33447
33963
  } else if (stat2.isFile()) {
@@ -33522,22 +34038,22 @@ async function buildTrigramMapForPathsAsync(paths) {
33522
34038
  }
33523
34039
 
33524
34040
  // src/files/index/write-index-file.ts
33525
- import fs13 from "node:fs";
34041
+ import fs18 from "node:fs";
33526
34042
 
33527
34043
  // src/files/index/paths.ts
33528
- import path18 from "node:path";
34044
+ import path19 from "node:path";
33529
34045
  import crypto2 from "node:crypto";
33530
34046
  function getIndexPathForCwd(resolvedCwd) {
33531
34047
  const hash = crypto2.createHash("sha256").update(resolvedCwd).digest("hex").slice(0, INDEX_HASH_LEN);
33532
- return path18.join(INDEX_DIR, `.file-index-${hash}.json`);
34048
+ return path19.join(INDEX_DIR, `.file-index-${hash}.json`);
33533
34049
  }
33534
34050
 
33535
34051
  // src/files/index/write-index-file.ts
33536
34052
  function writeIndexFileSync(resolvedCwd, data) {
33537
34053
  const indexPath = getIndexPathForCwd(resolvedCwd);
33538
34054
  try {
33539
- if (!fs13.existsSync(INDEX_DIR)) fs13.mkdirSync(INDEX_DIR, { recursive: true });
33540
- fs13.writeFileSync(indexPath, JSON.stringify(data), "utf8");
34055
+ if (!fs18.existsSync(INDEX_DIR)) fs18.mkdirSync(INDEX_DIR, { recursive: true });
34056
+ fs18.writeFileSync(indexPath, JSON.stringify(data), "utf8");
33541
34057
  } catch (e) {
33542
34058
  console.error(`${INDEX_LOG_PREFIX} Failed to write index:`, e);
33543
34059
  }
@@ -33545,8 +34061,8 @@ function writeIndexFileSync(resolvedCwd, data) {
33545
34061
  async function writeIndexFileAsync(resolvedCwd, data) {
33546
34062
  const indexPath = getIndexPathForCwd(resolvedCwd);
33547
34063
  try {
33548
- await fs13.promises.mkdir(INDEX_DIR, { recursive: true });
33549
- await fs13.promises.writeFile(indexPath, JSON.stringify(data), "utf8");
34064
+ await fs18.promises.mkdir(INDEX_DIR, { recursive: true });
34065
+ await fs18.promises.writeFile(indexPath, JSON.stringify(data), "utf8");
33550
34066
  } catch (e) {
33551
34067
  console.error(`${INDEX_LOG_PREFIX} Failed to write index:`, e);
33552
34068
  }
@@ -33560,7 +34076,7 @@ function sortPaths(paths) {
33560
34076
  paths.sort((a, b) => a.localeCompare(b, void 0, { sensitivity: "base" }));
33561
34077
  }
33562
34078
  function buildFileIndex(cwd) {
33563
- const resolved = path19.resolve(cwd);
34079
+ const resolved = path20.resolve(cwd);
33564
34080
  const paths = [];
33565
34081
  walkWorkspaceTreeSync(resolved, resolved, paths);
33566
34082
  sortPaths(paths);
@@ -33570,7 +34086,7 @@ function buildFileIndex(cwd) {
33570
34086
  return data;
33571
34087
  }
33572
34088
  async function buildFileIndexAsync(cwd) {
33573
- const resolved = path19.resolve(cwd);
34089
+ const resolved = path20.resolve(cwd);
33574
34090
  const paths = [];
33575
34091
  await walkWorkspaceTreeAsync(resolved, resolved, paths, createWalkYieldState());
33576
34092
  await yieldToEventLoop();
@@ -33582,13 +34098,13 @@ async function buildFileIndexAsync(cwd) {
33582
34098
  }
33583
34099
 
33584
34100
  // src/files/index/load-file-index.ts
33585
- import fs14 from "node:fs";
33586
- import path20 from "node:path";
34101
+ import fs19 from "node:fs";
34102
+ import path21 from "node:path";
33587
34103
  function loadFileIndex(cwd) {
33588
- const resolved = path20.resolve(cwd);
34104
+ const resolved = path21.resolve(cwd);
33589
34105
  const indexPath = getIndexPathForCwd(resolved);
33590
34106
  try {
33591
- const raw = fs14.readFileSync(indexPath, "utf8");
34107
+ const raw = fs19.readFileSync(indexPath, "utf8");
33592
34108
  const parsed = JSON.parse(raw);
33593
34109
  if (parsed !== null && typeof parsed === "object" && Array.isArray(parsed.paths)) {
33594
34110
  const obj = parsed;
@@ -33607,9 +34123,9 @@ function loadFileIndex(cwd) {
33607
34123
  }
33608
34124
 
33609
34125
  // src/files/index/ensure-file-index.ts
33610
- import path21 from "node:path";
34126
+ import path22 from "node:path";
33611
34127
  async function ensureFileIndexAsync(cwd) {
33612
- const resolved = path21.resolve(cwd);
34128
+ const resolved = path22.resolve(cwd);
33613
34129
  const cached2 = loadFileIndex(resolved);
33614
34130
  if (cached2 !== null) return { data: cached2, fromCache: true };
33615
34131
  const data = await buildFileIndexAsync(resolved);
@@ -33692,7 +34208,7 @@ function createFsWatcher(resolved, schedule) {
33692
34208
  }
33693
34209
  }
33694
34210
  function startFileIndexWatcher(cwd = getBridgeWorkspaceDirectory()) {
33695
- const resolved = path22.resolve(cwd);
34211
+ const resolved = path23.resolve(cwd);
33696
34212
  void buildFileIndexAsync(resolved).catch((e) => {
33697
34213
  console.error("[file-index] Initial index build failed:", e);
33698
34214
  });
@@ -33761,7 +34277,7 @@ function forceKillChild(proc, log2, shortId, graceMs) {
33761
34277
  }
33762
34278
 
33763
34279
  // src/dev-servers/process/wire-dev-server-child-process.ts
33764
- import fs15 from "node:fs";
34280
+ import fs20 from "node:fs";
33765
34281
 
33766
34282
  // src/dev-servers/manager/forward-pipe.ts
33767
34283
  function forwardChildPipe(childReadable, terminal, onData) {
@@ -33797,7 +34313,7 @@ function wireDevServerChildProcess(d) {
33797
34313
  d.setPollInterval(void 0);
33798
34314
  return;
33799
34315
  }
33800
- fs15.readFile(d.mergedLogPath, (err, buf) => {
34316
+ fs20.readFile(d.mergedLogPath, (err, buf) => {
33801
34317
  if (err || (d.getSpawnGeneration() ?? 0) !== d.scheduledGen) return;
33802
34318
  if (buf.length <= d.mergedReadPos.value) return;
33803
34319
  const chunk = Buffer.from(buf.subarray(d.mergedReadPos.value));
@@ -33835,7 +34351,7 @@ ${errTail}` : ""}`);
33835
34351
  d.sendStatus(code === 0 || code == null ? "stopped" : "error", detail, tails);
33836
34352
  };
33837
34353
  if (mergedPath) {
33838
- fs15.readFile(mergedPath, (err, buf) => {
34354
+ fs20.readFile(mergedPath, (err, buf) => {
33839
34355
  if (!err && buf.length > d.mergedReadPos.value) {
33840
34356
  const chunk = Buffer.from(buf.subarray(d.mergedReadPos.value));
33841
34357
  if (chunk.length > 0) {
@@ -33937,13 +34453,13 @@ function parseDevServerDefs(servers) {
33937
34453
  }
33938
34454
 
33939
34455
  // src/dev-servers/manager/shell-spawn/utils.ts
33940
- import fs16 from "node:fs";
34456
+ import fs21 from "node:fs";
33941
34457
  function isSpawnEbadf(e) {
33942
34458
  return typeof e === "object" && e !== null && "code" in e && e.code === "EBADF";
33943
34459
  }
33944
34460
  function rmDirQuiet(dir) {
33945
34461
  try {
33946
- fs16.rmSync(dir, { recursive: true, force: true });
34462
+ fs21.rmSync(dir, { recursive: true, force: true });
33947
34463
  } catch {
33948
34464
  }
33949
34465
  }
@@ -33951,7 +34467,7 @@ var cachedDevNullReadFd;
33951
34467
  function devNullReadFd() {
33952
34468
  if (cachedDevNullReadFd === void 0) {
33953
34469
  const devPath = process.platform === "win32" ? "nul" : "/dev/null";
33954
- cachedDevNullReadFd = fs16.openSync(devPath, "r");
34470
+ cachedDevNullReadFd = fs21.openSync(devPath, "r");
33955
34471
  }
33956
34472
  return cachedDevNullReadFd;
33957
34473
  }
@@ -34025,15 +34541,15 @@ function trySpawnShellTruePiped(command, env, cwd, devNullFd, signal) {
34025
34541
 
34026
34542
  // src/dev-servers/manager/shell-spawn/try-spawn-merged-log-file.ts
34027
34543
  import { spawn as spawn6 } from "node:child_process";
34028
- import fs17 from "node:fs";
34544
+ import fs22 from "node:fs";
34029
34545
  import { tmpdir } from "node:os";
34030
- import path23 from "node:path";
34546
+ import path24 from "node:path";
34031
34547
  function trySpawnMergedLogFile(command, env, cwd, signal) {
34032
- const tmpRoot = fs17.mkdtempSync(path23.join(tmpdir(), "ba-devsrv-log-"));
34033
- const logPath = path23.join(tmpRoot, "combined.log");
34548
+ const tmpRoot = fs22.mkdtempSync(path24.join(tmpdir(), "ba-devsrv-log-"));
34549
+ const logPath = path24.join(tmpRoot, "combined.log");
34034
34550
  let logFd;
34035
34551
  try {
34036
- logFd = fs17.openSync(logPath, "a");
34552
+ logFd = fs22.openSync(logPath, "a");
34037
34553
  } catch {
34038
34554
  rmDirQuiet(tmpRoot);
34039
34555
  return null;
@@ -34052,7 +34568,7 @@ function trySpawnMergedLogFile(command, env, cwd, signal) {
34052
34568
  } else {
34053
34569
  proc = spawn6("/bin/sh", ["-c", command], { env, cwd, stdio, ...signal ? { signal } : {} });
34054
34570
  }
34055
- fs17.closeSync(logFd);
34571
+ fs22.closeSync(logFd);
34056
34572
  return {
34057
34573
  proc,
34058
34574
  pipedStdoutStderr: true,
@@ -34061,7 +34577,7 @@ function trySpawnMergedLogFile(command, env, cwd, signal) {
34061
34577
  };
34062
34578
  } catch (e) {
34063
34579
  try {
34064
- fs17.closeSync(logFd);
34580
+ fs22.closeSync(logFd);
34065
34581
  } catch {
34066
34582
  }
34067
34583
  rmDirQuiet(tmpRoot);
@@ -34072,22 +34588,22 @@ function trySpawnMergedLogFile(command, env, cwd, signal) {
34072
34588
 
34073
34589
  // src/dev-servers/manager/shell-spawn/try-spawn-shell-script-log-redirect.ts
34074
34590
  import { spawn as spawn7 } from "node:child_process";
34075
- import fs18 from "node:fs";
34591
+ import fs23 from "node:fs";
34076
34592
  import { tmpdir as tmpdir2 } from "node:os";
34077
- import path24 from "node:path";
34593
+ import path25 from "node:path";
34078
34594
  function shSingleQuote(s) {
34079
34595
  return `'${s.replace(/'/g, `'\\''`)}'`;
34080
34596
  }
34081
34597
  function trySpawnShellScriptLogRedirectUnix(command, env, cwd, signal) {
34082
- const tmpRoot = fs18.mkdtempSync(path24.join(tmpdir2(), "ba-devsrv-sh-"));
34083
- const logPath = path24.join(tmpRoot, "combined.log");
34084
- const innerPath = path24.join(tmpRoot, "_cmd.sh");
34085
- const runnerPath = path24.join(tmpRoot, "_run.sh");
34598
+ const tmpRoot = fs23.mkdtempSync(path25.join(tmpdir2(), "ba-devsrv-sh-"));
34599
+ const logPath = path25.join(tmpRoot, "combined.log");
34600
+ const innerPath = path25.join(tmpRoot, "_cmd.sh");
34601
+ const runnerPath = path25.join(tmpRoot, "_run.sh");
34086
34602
  try {
34087
- fs18.writeFileSync(innerPath, `#!/bin/sh
34603
+ fs23.writeFileSync(innerPath, `#!/bin/sh
34088
34604
  ${command}
34089
34605
  `);
34090
- fs18.writeFileSync(
34606
+ fs23.writeFileSync(
34091
34607
  runnerPath,
34092
34608
  `#!/bin/sh
34093
34609
  cd ${shSingleQuote(cwd)}
@@ -34113,13 +34629,13 @@ cd ${shSingleQuote(cwd)}
34113
34629
  }
34114
34630
  }
34115
34631
  function trySpawnShellScriptLogRedirectWin(command, env, cwd, signal) {
34116
- const tmpRoot = fs18.mkdtempSync(path24.join(tmpdir2(), "ba-devsrv-sh-"));
34117
- const logPath = path24.join(tmpRoot, "combined.log");
34118
- const runnerPath = path24.join(tmpRoot, "_run.bat");
34632
+ const tmpRoot = fs23.mkdtempSync(path25.join(tmpdir2(), "ba-devsrv-sh-"));
34633
+ const logPath = path25.join(tmpRoot, "combined.log");
34634
+ const runnerPath = path25.join(tmpRoot, "_run.bat");
34119
34635
  const q = (p) => `"${p.replace(/"/g, '""')}"`;
34120
34636
  const com = process.env.ComSpec || "cmd.exe";
34121
34637
  try {
34122
- fs18.writeFileSync(
34638
+ fs23.writeFileSync(
34123
34639
  runnerPath,
34124
34640
  `@ECHO OFF\r
34125
34641
  CD /D ${q(cwd)}\r
@@ -34969,30 +35485,30 @@ function createOnBridgeIdentified(opts) {
34969
35485
  }
34970
35486
 
34971
35487
  // src/skills/discover-local-agent-skills.ts
34972
- import fs19 from "node:fs";
34973
- import path25 from "node:path";
35488
+ import fs24 from "node:fs";
35489
+ import path26 from "node:path";
34974
35490
  var SKILL_DISCOVERY_ROOTS = [".agents/skills", ".claude/skills", ".cursor/skills", "skills"];
34975
35491
  function discoverLocalSkills(cwd) {
34976
35492
  const out = [];
34977
35493
  const seenKeys = /* @__PURE__ */ new Set();
34978
35494
  for (const rel of SKILL_DISCOVERY_ROOTS) {
34979
- const base = path25.join(cwd, rel);
34980
- if (!fs19.existsSync(base) || !fs19.statSync(base).isDirectory()) continue;
35495
+ const base = path26.join(cwd, rel);
35496
+ if (!fs24.existsSync(base) || !fs24.statSync(base).isDirectory()) continue;
34981
35497
  let entries = [];
34982
35498
  try {
34983
- entries = fs19.readdirSync(base);
35499
+ entries = fs24.readdirSync(base);
34984
35500
  } catch {
34985
35501
  continue;
34986
35502
  }
34987
35503
  for (const name of entries) {
34988
- const dir = path25.join(base, name);
35504
+ const dir = path26.join(base, name);
34989
35505
  try {
34990
- if (!fs19.statSync(dir).isDirectory()) continue;
35506
+ if (!fs24.statSync(dir).isDirectory()) continue;
34991
35507
  } catch {
34992
35508
  continue;
34993
35509
  }
34994
- const skillMd = path25.join(dir, "SKILL.md");
34995
- if (!fs19.existsSync(skillMd)) continue;
35510
+ const skillMd = path26.join(dir, "SKILL.md");
35511
+ if (!fs24.existsSync(skillMd)) continue;
34996
35512
  const key = `${rel}/${name}`;
34997
35513
  if (seenKeys.has(key)) continue;
34998
35514
  seenKeys.add(key);
@@ -35004,23 +35520,23 @@ function discoverLocalSkills(cwd) {
35004
35520
  function discoverSkillLayoutRoots(cwd) {
35005
35521
  const roots = [];
35006
35522
  for (const rel of SKILL_DISCOVERY_ROOTS) {
35007
- const base = path25.join(cwd, rel);
35008
- if (!fs19.existsSync(base) || !fs19.statSync(base).isDirectory()) continue;
35523
+ const base = path26.join(cwd, rel);
35524
+ if (!fs24.existsSync(base) || !fs24.statSync(base).isDirectory()) continue;
35009
35525
  let entries = [];
35010
35526
  try {
35011
- entries = fs19.readdirSync(base);
35527
+ entries = fs24.readdirSync(base);
35012
35528
  } catch {
35013
35529
  continue;
35014
35530
  }
35015
35531
  const skills2 = [];
35016
35532
  for (const name of entries) {
35017
- const dir = path25.join(base, name);
35533
+ const dir = path26.join(base, name);
35018
35534
  try {
35019
- if (!fs19.statSync(dir).isDirectory()) continue;
35535
+ if (!fs24.statSync(dir).isDirectory()) continue;
35020
35536
  } catch {
35021
35537
  continue;
35022
35538
  }
35023
- if (!fs19.existsSync(path25.join(dir, "SKILL.md"))) continue;
35539
+ if (!fs24.existsSync(path26.join(dir, "SKILL.md"))) continue;
35024
35540
  const relPath = `${rel}/${name}`.replace(/\\/g, "/");
35025
35541
  skills2.push({ name, relPath });
35026
35542
  }
@@ -35165,12 +35681,12 @@ var handleAgentConfigMessage = (msg, deps) => {
35165
35681
  };
35166
35682
 
35167
35683
  // src/agents/acp/from-bridge/handle-bridge-prompt.ts
35168
- import * as path27 from "node:path";
35169
- import { execFile as execFile5 } from "node:child_process";
35170
- import { promisify as promisify5 } from "node:util";
35684
+ import * as path28 from "node:path";
35685
+ import { execFile as execFile10 } from "node:child_process";
35686
+ import { promisify as promisify10 } from "node:util";
35171
35687
 
35172
35688
  // src/git/bridge-queue-key.ts
35173
- import * as path26 from "node:path";
35689
+ import * as path27 from "node:path";
35174
35690
  import { createHash } from "node:crypto";
35175
35691
  function normalizeCanonicalGitUrl(url2) {
35176
35692
  let s = url2.trim();
@@ -35198,11 +35714,11 @@ function canonicalUrlToRepoIdSync(url2) {
35198
35714
  return createHash("sha256").update(normalized).digest("hex").slice(0, 32);
35199
35715
  }
35200
35716
  function fallbackRepoIdFromPath(absPath) {
35201
- return createHash("sha256").update(path26.resolve(absPath)).digest("hex").slice(0, 32);
35717
+ return createHash("sha256").update(path27.resolve(absPath)).digest("hex").slice(0, 32);
35202
35718
  }
35203
35719
  async function resolveBridgeQueueBindFields(options) {
35204
35720
  const { effectiveCwd, worktreePaths, primaryRepoRoots, log: log2 } = options;
35205
- const cwdAbs = worktreePaths.length > 0 ? path26.resolve(worktreePaths[0]) : path26.resolve(effectiveCwd);
35721
+ const cwdAbs = worktreePaths.length > 0 ? path27.resolve(worktreePaths[0]) : path27.resolve(effectiveCwd);
35206
35722
  if (!primaryRepoRoots.length) {
35207
35723
  log2("[Bridge service] Prompt queue bind skipped: no Git repository roots under the working directory.");
35208
35724
  return null;
@@ -35225,10 +35741,10 @@ async function resolveBridgeQueueBindFields(options) {
35225
35741
  }
35226
35742
 
35227
35743
  // src/agents/acp/from-bridge/handle-bridge-prompt.ts
35228
- var execFileAsync5 = promisify5(execFile5);
35744
+ var execFileAsync9 = promisify10(execFile10);
35229
35745
  async function readGitBranch(cwd) {
35230
35746
  try {
35231
- const { stdout } = await execFileAsync5("git", ["branch", "--show-current"], { cwd, maxBuffer: 64 * 1024 });
35747
+ const { stdout } = await execFileAsync9("git", ["branch", "--show-current"], { cwd, maxBuffer: 64 * 1024 });
35232
35748
  const b = stdout.trim();
35233
35749
  return b || null;
35234
35750
  } catch {
@@ -35239,17 +35755,29 @@ function handleBridgePrompt(msg, deps) {
35239
35755
  const { getWs, log: log2, acpManager, sessionWorktreeManager } = deps;
35240
35756
  const rawPrompt = msg.prompt;
35241
35757
  const promptText = typeof rawPrompt === "string" ? rawPrompt : rawPrompt != null ? String(rawPrompt) : "";
35758
+ const sessionId = msg.sessionId;
35759
+ const runId = typeof msg.runId === "string" ? msg.runId : void 0;
35760
+ const promptId = typeof msg.id === "string" ? msg.id : void 0;
35242
35761
  if (!promptText.trim()) {
35243
35762
  log2(
35244
35763
  `[Bridge service] Prompt ignored: empty or missing prompt text (session ${typeof msg.sessionId === "string" ? msg.sessionId.slice(0, 8) : "\u2014"}\u2026, run ${typeof msg.runId === "string" ? msg.runId.slice(0, 8) : "\u2014"}\u2026).`
35245
35764
  );
35765
+ const s = getWs();
35766
+ if (s) {
35767
+ sendWsMessage(s, {
35768
+ type: "prompt_result",
35769
+ ...promptId ? { id: promptId } : {},
35770
+ ...sessionId ? { sessionId } : {},
35771
+ ...runId ? { runId } : {},
35772
+ success: false,
35773
+ error: "Empty or missing prompt text from the bridge; this turn was not sent to the agent."
35774
+ });
35775
+ }
35246
35776
  return;
35247
35777
  }
35248
- const sessionId = msg.sessionId;
35249
35778
  const isNewSession = msg.isNewSession === true;
35250
35779
  const sessionWorktreesEnabled = msg.sessionWorktreesEnabled === true;
35251
35780
  const agentType = typeof msg.agentType === "string" && msg.agentType.trim() ? msg.agentType.trim() : void 0;
35252
- const runId = typeof msg.runId === "string" ? msg.runId : void 0;
35253
35781
  const mode = typeof msg.mode === "string" && msg.mode.trim() ? msg.mode.trim() : void 0;
35254
35782
  acpManager.logPromptReceivedFromBridge({ agentType, mode });
35255
35783
  const sendResult2 = (result) => {
@@ -35267,7 +35795,7 @@ function handleBridgePrompt(msg, deps) {
35267
35795
  };
35268
35796
  async function preambleAndPrompt(resolvedCwd) {
35269
35797
  const s = getWs();
35270
- const effectiveCwd = path27.resolve(resolvedCwd ?? getBridgeWorkspaceDirectory());
35798
+ const effectiveCwd = path28.resolve(resolvedCwd ?? getBridgeWorkspaceDirectory());
35271
35799
  const worktreePaths = sessionWorktreeManager.getWorktreePathsForSession(sessionId) ?? [];
35272
35800
  const repoRoots = await resolveSnapshotRepoRoots({
35273
35801
  worktreePaths,
@@ -35390,8 +35918,8 @@ function randomSecret() {
35390
35918
  }
35391
35919
  return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
35392
35920
  }
35393
- async function requestPreviewApi(port, secret, method, path32, body) {
35394
- const url2 = `http://127.0.0.1:${port}${path32}`;
35921
+ async function requestPreviewApi(port, secret, method, path33, body) {
35922
+ const url2 = `http://127.0.0.1:${port}${path33}`;
35395
35923
  const headers = {
35396
35924
  [PREVIEW_SECRET_HEADER]: secret,
35397
35925
  "Content-Type": "application/json"
@@ -35403,7 +35931,7 @@ async function requestPreviewApi(port, secret, method, path32, body) {
35403
35931
  });
35404
35932
  const data = await res.json().catch(() => ({}));
35405
35933
  if (!res.ok) {
35406
- throw new Error(data?.error ?? `Preview API ${method} ${path32}: ${res.status}`);
35934
+ throw new Error(data?.error ?? `Preview API ${method} ${path33}: ${res.status}`);
35407
35935
  }
35408
35936
  return data;
35409
35937
  }
@@ -35566,15 +36094,15 @@ var handleSkillCallMessage = (msg, { getWs, log: log2 }) => {
35566
36094
  };
35567
36095
 
35568
36096
  // src/files/list-dir.ts
35569
- import fs20 from "node:fs";
35570
- import path29 from "node:path";
36097
+ import fs25 from "node:fs";
36098
+ import path30 from "node:path";
35571
36099
 
35572
36100
  // src/files/ensure-under-cwd.ts
35573
- import path28 from "node:path";
36101
+ import path29 from "node:path";
35574
36102
  function ensureUnderCwd(relativePath, cwd = getBridgeWorkspaceDirectory()) {
35575
- const normalized = path28.normalize(relativePath).replace(/^(\.\/)+/, "");
35576
- const resolved = path28.resolve(cwd, normalized);
35577
- if (!resolved.startsWith(cwd + path28.sep) && resolved !== cwd) {
36103
+ const normalized = path29.normalize(relativePath).replace(/^(\.\/)+/, "");
36104
+ const resolved = path29.resolve(cwd, normalized);
36105
+ if (!resolved.startsWith(cwd + path29.sep) && resolved !== cwd) {
35578
36106
  return null;
35579
36107
  }
35580
36108
  return resolved;
@@ -35588,7 +36116,7 @@ async function listDirAsync(relativePath) {
35588
36116
  return { error: "Path is outside working directory" };
35589
36117
  }
35590
36118
  try {
35591
- const names = await fs20.promises.readdir(resolved, { withFileTypes: true });
36119
+ const names = await fs25.promises.readdir(resolved, { withFileTypes: true });
35592
36120
  const visible = names.filter((d) => !d.name.startsWith("."));
35593
36121
  const entries = [];
35594
36122
  for (let i = 0; i < visible.length; i++) {
@@ -35596,12 +36124,12 @@ async function listDirAsync(relativePath) {
35596
36124
  await yieldToEventLoop();
35597
36125
  }
35598
36126
  const d = visible[i];
35599
- const entryPath = path29.join(relativePath || ".", d.name).replace(/\\/g, "/");
35600
- const fullPath = path29.join(resolved, d.name);
36127
+ const entryPath = path30.join(relativePath || ".", d.name).replace(/\\/g, "/");
36128
+ const fullPath = path30.join(resolved, d.name);
35601
36129
  let isDir = d.isDirectory();
35602
36130
  if (d.isSymbolicLink()) {
35603
36131
  try {
35604
- const targetStat = await fs20.promises.stat(fullPath);
36132
+ const targetStat = await fs25.promises.stat(fullPath);
35605
36133
  isDir = targetStat.isDirectory();
35606
36134
  } catch {
35607
36135
  isDir = false;
@@ -35626,25 +36154,25 @@ async function listDirAsync(relativePath) {
35626
36154
  }
35627
36155
 
35628
36156
  // src/files/read-file.ts
35629
- import fs21 from "node:fs";
36157
+ import fs26 from "node:fs";
35630
36158
  import { StringDecoder } from "node:string_decoder";
35631
36159
  function resolveFilePath(relativePath) {
35632
36160
  const resolved = ensureUnderCwd(relativePath, getBridgeWorkspaceDirectory());
35633
36161
  if (!resolved) return { error: "Path is outside working directory" };
35634
36162
  let real;
35635
36163
  try {
35636
- real = fs21.realpathSync(resolved);
36164
+ real = fs26.realpathSync(resolved);
35637
36165
  } catch {
35638
36166
  real = resolved;
35639
36167
  }
35640
- const stat2 = fs21.statSync(real);
36168
+ const stat2 = fs26.statSync(real);
35641
36169
  if (!stat2.isFile()) return { error: "Not a file" };
35642
36170
  return real;
35643
36171
  }
35644
36172
  var LINE_CHUNK_SIZE = 64 * 1024;
35645
36173
  function readFileRange(filePath, startLine, endLine, lineOffsetIn, lineChunkSize = LINE_CHUNK_SIZE) {
35646
- const fileSize = fs21.statSync(filePath).size;
35647
- const fd = fs21.openSync(filePath, "r");
36174
+ const fileSize = fs26.statSync(filePath).size;
36175
+ const fd = fs26.openSync(filePath, "r");
35648
36176
  const bufSize = 64 * 1024;
35649
36177
  const buf = Buffer.alloc(bufSize);
35650
36178
  const decoder = new StringDecoder("utf8");
@@ -35657,7 +36185,7 @@ function readFileRange(filePath, startLine, endLine, lineOffsetIn, lineChunkSize
35657
36185
  let line0Accum = "";
35658
36186
  try {
35659
36187
  let bytesRead;
35660
- while (!done && (bytesRead = fs21.readSync(fd, buf, 0, bufSize, null)) > 0) {
36188
+ while (!done && (bytesRead = fs26.readSync(fd, buf, 0, bufSize, null)) > 0) {
35661
36189
  const text = partial2 + decoder.write(buf.subarray(0, bytesRead));
35662
36190
  partial2 = "";
35663
36191
  let lineStart = 0;
@@ -35792,7 +36320,7 @@ function readFileRange(filePath, startLine, endLine, lineOffsetIn, lineChunkSize
35792
36320
  }
35793
36321
  return { content: resultLines.join("\n"), size: fileSize };
35794
36322
  } finally {
35795
- fs21.closeSync(fd);
36323
+ fs26.closeSync(fd);
35796
36324
  }
35797
36325
  }
35798
36326
  function readFile2(relativePath, startLine, endLine, lineOffset, lineChunkSize = LINE_CHUNK_SIZE) {
@@ -35803,8 +36331,8 @@ function readFile2(relativePath, startLine, endLine, lineOffset, lineChunkSize =
35803
36331
  if (hasRange) {
35804
36332
  return readFileRange(result, startLine, endLine, lineOffset, lineChunkSize);
35805
36333
  }
35806
- const stat2 = fs21.statSync(result);
35807
- const raw = fs21.readFileSync(result, "utf8");
36334
+ const stat2 = fs26.statSync(result);
36335
+ const raw = fs26.readFileSync(result, "utf8");
35808
36336
  const lines = raw.split(/\r?\n/);
35809
36337
  return { content: raw, totalLines: lines.length, size: stat2.size };
35810
36338
  } catch (err) {
@@ -35914,8 +36442,8 @@ function handleSkillLayoutRequest(msg, deps) {
35914
36442
  }
35915
36443
 
35916
36444
  // src/skills/install-remote-skills.ts
35917
- import fs22 from "node:fs";
35918
- import path30 from "node:path";
36445
+ import fs27 from "node:fs";
36446
+ import path31 from "node:path";
35919
36447
  function installRemoteSkills(cwd, targetDir, items) {
35920
36448
  const installed2 = [];
35921
36449
  if (!Array.isArray(items)) {
@@ -35926,15 +36454,15 @@ function installRemoteSkills(cwd, targetDir, items) {
35926
36454
  if (typeof item.sourceId !== "string" || typeof item.skillName !== "string" || typeof item.versionHash !== "string" || !Array.isArray(item.files)) {
35927
36455
  continue;
35928
36456
  }
35929
- const skillDir = path30.join(cwd, targetDir, item.skillName);
36457
+ const skillDir = path31.join(cwd, targetDir, item.skillName);
35930
36458
  for (const f of item.files) {
35931
36459
  if (typeof f.path !== "string" || !f.text && !f.base64) continue;
35932
- const dest = path30.join(skillDir, f.path);
35933
- fs22.mkdirSync(path30.dirname(dest), { recursive: true });
36460
+ const dest = path31.join(skillDir, f.path);
36461
+ fs27.mkdirSync(path31.dirname(dest), { recursive: true });
35934
36462
  if (f.text !== void 0) {
35935
- fs22.writeFileSync(dest, f.text, "utf8");
36463
+ fs27.writeFileSync(dest, f.text, "utf8");
35936
36464
  } else if (f.base64) {
35937
- fs22.writeFileSync(dest, Buffer.from(f.base64, "base64"));
36465
+ fs27.writeFileSync(dest, Buffer.from(f.base64, "base64"));
35938
36466
  }
35939
36467
  }
35940
36468
  installed2.push({
@@ -36079,7 +36607,7 @@ var handleSessionDiscardedMessage = (msg, deps) => {
36079
36607
  };
36080
36608
 
36081
36609
  // src/bridge/routing/handlers/revert-turn-snapshot.ts
36082
- import * as fs23 from "node:fs";
36610
+ import * as fs28 from "node:fs";
36083
36611
  var handleRevertTurnSnapshotMessage = (msg, deps) => {
36084
36612
  const id = typeof msg.id === "string" ? msg.id : "";
36085
36613
  const sessionId = typeof msg.sessionId === "string" ? msg.sessionId : "";
@@ -36091,7 +36619,7 @@ var handleRevertTurnSnapshotMessage = (msg, deps) => {
36091
36619
  if (!s) return;
36092
36620
  const agentBase = sessionWorktreeManager.getAgentCwdForSession(sessionId) ?? getBridgeWorkspaceDirectory();
36093
36621
  const file2 = snapshotFilePath(agentBase, turnId);
36094
- if (!fs23.existsSync(file2)) {
36622
+ if (!fs28.existsSync(file2)) {
36095
36623
  sendWsMessage(s, {
36096
36624
  type: "revert_turn_snapshot_result",
36097
36625
  id,
@@ -36532,9 +37060,9 @@ async function main() {
36532
37060
  let authToken = opts.token;
36533
37061
  const firehoseServerUrl = opts.firehoseUrl ?? opts.proxyUrl ?? process.env.BUILDAMATON_FIREHOSE_URL ?? process.env.BUILDAMATON_PROXY_URL ?? DEFAULT_FIREHOSE_URL;
36534
37062
  if (opts.cwd && typeof opts.cwd === "string" && opts.cwd.trim()) {
36535
- const resolvedCwd = path31.resolve(process.cwd(), opts.cwd.trim());
37063
+ const resolvedCwd = path32.resolve(process.cwd(), opts.cwd.trim());
36536
37064
  try {
36537
- const st = fs24.statSync(resolvedCwd);
37065
+ const st = fs29.statSync(resolvedCwd);
36538
37066
  if (!st.isDirectory()) {
36539
37067
  console.error(`--cwd is not a directory: ${resolvedCwd}`);
36540
37068
  process.exit(1);
@@ -36548,7 +37076,7 @@ async function main() {
36548
37076
  initBridgeWorkspaceDirectory();
36549
37077
  let worktreesRootAbs;
36550
37078
  if (opts.worktreesRoot && opts.worktreesRoot.trim()) {
36551
- worktreesRootAbs = path31.resolve(opts.worktreesRoot.trim());
37079
+ worktreesRootAbs = path32.resolve(opts.worktreesRoot.trim());
36552
37080
  }
36553
37081
  let refreshToken;
36554
37082
  if ((!workspaceId || !authToken) && opts.config !== false) {