@buildautomaton/cli 0.1.94 → 0.1.95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -973,8 +973,8 @@ var require_command = __commonJS({
973
973
  "../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/command.js"(exports) {
974
974
  var EventEmitter2 = __require("node:events").EventEmitter;
975
975
  var childProcess2 = __require("node:child_process");
976
- var path88 = __require("node:path");
977
- var fs66 = __require("node:fs");
976
+ var path86 = __require("node:path");
977
+ var fs65 = __require("node:fs");
978
978
  var process9 = __require("node:process");
979
979
  var { Argument: Argument2, humanReadableArgName } = require_argument();
980
980
  var { CommanderError: CommanderError2 } = require_error();
@@ -1906,11 +1906,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
1906
1906
  let launchWithNode = false;
1907
1907
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
1908
1908
  function findFile(baseDir, baseName) {
1909
- const localBin = path88.resolve(baseDir, baseName);
1910
- if (fs66.existsSync(localBin)) return localBin;
1911
- if (sourceExt.includes(path88.extname(baseName))) return void 0;
1909
+ const localBin = path86.resolve(baseDir, baseName);
1910
+ if (fs65.existsSync(localBin)) return localBin;
1911
+ if (sourceExt.includes(path86.extname(baseName))) return void 0;
1912
1912
  const foundExt = sourceExt.find(
1913
- (ext) => fs66.existsSync(`${localBin}${ext}`)
1913
+ (ext) => fs65.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 = fs66.realpathSync(this._scriptPath);
1925
+ resolvedScriptPath = fs65.realpathSync(this._scriptPath);
1926
1926
  } catch (err) {
1927
1927
  resolvedScriptPath = this._scriptPath;
1928
1928
  }
1929
- executableDir = path88.resolve(
1930
- path88.dirname(resolvedScriptPath),
1929
+ executableDir = path86.resolve(
1930
+ path86.dirname(resolvedScriptPath),
1931
1931
  executableDir
1932
1932
  );
1933
1933
  }
1934
1934
  if (executableDir) {
1935
1935
  let localFile = findFile(executableDir, executableFile);
1936
1936
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
1937
- const legacyName = path88.basename(
1937
+ const legacyName = path86.basename(
1938
1938
  this._scriptPath,
1939
- path88.extname(this._scriptPath)
1939
+ path86.extname(this._scriptPath)
1940
1940
  );
1941
1941
  if (legacyName !== this._name) {
1942
1942
  localFile = findFile(
@@ -1947,7 +1947,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1947
1947
  }
1948
1948
  executableFile = localFile || executableFile;
1949
1949
  }
1950
- launchWithNode = sourceExt.includes(path88.extname(executableFile));
1950
+ launchWithNode = sourceExt.includes(path86.extname(executableFile));
1951
1951
  let proc;
1952
1952
  if (process9.platform !== "win32") {
1953
1953
  if (launchWithNode) {
@@ -2787,7 +2787,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2787
2787
  * @return {Command}
2788
2788
  */
2789
2789
  nameFromFilename(filename) {
2790
- this._name = path88.basename(filename, path88.extname(filename));
2790
+ this._name = path86.basename(filename, path86.extname(filename));
2791
2791
  return this;
2792
2792
  }
2793
2793
  /**
@@ -2801,9 +2801,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
2801
2801
  * @param {string} [path]
2802
2802
  * @return {(string|null|Command)}
2803
2803
  */
2804
- executableDir(path89) {
2805
- if (path89 === void 0) return this._executableDir;
2806
- this._executableDir = path89;
2804
+ executableDir(path87) {
2805
+ if (path87 === void 0) return this._executableDir;
2806
+ this._executableDir = path87;
2807
2807
  return this;
2808
2808
  }
2809
2809
  /**
@@ -7085,10 +7085,10 @@ function mergeDefs(...defs) {
7085
7085
  function cloneDef(schema) {
7086
7086
  return mergeDefs(schema._zod.def);
7087
7087
  }
7088
- function getElementAtPath(obj, path88) {
7089
- if (!path88)
7088
+ function getElementAtPath(obj, path86) {
7089
+ if (!path86)
7090
7090
  return obj;
7091
- return path88.reduce((acc, key) => acc?.[key], obj);
7091
+ return path86.reduce((acc, key) => acc?.[key], obj);
7092
7092
  }
7093
7093
  function promiseAllObject(promisesObj) {
7094
7094
  const keys = Object.keys(promisesObj);
@@ -7416,11 +7416,11 @@ function explicitlyAborted(x, startIndex = 0) {
7416
7416
  }
7417
7417
  return false;
7418
7418
  }
7419
- function prefixIssues(path88, issues) {
7419
+ function prefixIssues(path86, issues) {
7420
7420
  return issues.map((iss) => {
7421
7421
  var _a4;
7422
7422
  (_a4 = iss).path ?? (_a4.path = []);
7423
- iss.path.unshift(path88);
7423
+ iss.path.unshift(path86);
7424
7424
  return iss;
7425
7425
  });
7426
7426
  }
@@ -7637,16 +7637,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
7637
7637
  }
7638
7638
  function formatError(error51, mapper = (issue2) => issue2.message) {
7639
7639
  const fieldErrors = { _errors: [] };
7640
- const processError = (error52, path88 = []) => {
7640
+ const processError = (error52, path86 = []) => {
7641
7641
  for (const issue2 of error52.issues) {
7642
7642
  if (issue2.code === "invalid_union" && issue2.errors.length) {
7643
- issue2.errors.map((issues) => processError({ issues }, [...path88, ...issue2.path]));
7643
+ issue2.errors.map((issues) => processError({ issues }, [...path86, ...issue2.path]));
7644
7644
  } else if (issue2.code === "invalid_key") {
7645
- processError({ issues: issue2.issues }, [...path88, ...issue2.path]);
7645
+ processError({ issues: issue2.issues }, [...path86, ...issue2.path]);
7646
7646
  } else if (issue2.code === "invalid_element") {
7647
- processError({ issues: issue2.issues }, [...path88, ...issue2.path]);
7647
+ processError({ issues: issue2.issues }, [...path86, ...issue2.path]);
7648
7648
  } else {
7649
- const fullpath = [...path88, ...issue2.path];
7649
+ const fullpath = [...path86, ...issue2.path];
7650
7650
  if (fullpath.length === 0) {
7651
7651
  fieldErrors._errors.push(mapper(issue2));
7652
7652
  } else {
@@ -7673,17 +7673,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
7673
7673
  }
7674
7674
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
7675
7675
  const result = { errors: [] };
7676
- const processError = (error52, path88 = []) => {
7676
+ const processError = (error52, path86 = []) => {
7677
7677
  var _a4, _b;
7678
7678
  for (const issue2 of error52.issues) {
7679
7679
  if (issue2.code === "invalid_union" && issue2.errors.length) {
7680
- issue2.errors.map((issues) => processError({ issues }, [...path88, ...issue2.path]));
7680
+ issue2.errors.map((issues) => processError({ issues }, [...path86, ...issue2.path]));
7681
7681
  } else if (issue2.code === "invalid_key") {
7682
- processError({ issues: issue2.issues }, [...path88, ...issue2.path]);
7682
+ processError({ issues: issue2.issues }, [...path86, ...issue2.path]);
7683
7683
  } else if (issue2.code === "invalid_element") {
7684
- processError({ issues: issue2.issues }, [...path88, ...issue2.path]);
7684
+ processError({ issues: issue2.issues }, [...path86, ...issue2.path]);
7685
7685
  } else {
7686
- const fullpath = [...path88, ...issue2.path];
7686
+ const fullpath = [...path86, ...issue2.path];
7687
7687
  if (fullpath.length === 0) {
7688
7688
  result.errors.push(mapper(issue2));
7689
7689
  continue;
@@ -7715,8 +7715,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
7715
7715
  }
7716
7716
  function toDotPath(_path) {
7717
7717
  const segs = [];
7718
- const path88 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
7719
- for (const seg of path88) {
7718
+ const path86 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
7719
+ for (const seg of path86) {
7720
7720
  if (typeof seg === "number")
7721
7721
  segs.push(`[${seg}]`);
7722
7722
  else if (typeof seg === "symbol")
@@ -21146,13 +21146,13 @@ function resolveRef(ref, ctx) {
21146
21146
  if (!ref.startsWith("#")) {
21147
21147
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
21148
21148
  }
21149
- const path88 = ref.slice(1).split("/").filter(Boolean);
21150
- if (path88.length === 0) {
21149
+ const path86 = ref.slice(1).split("/").filter(Boolean);
21150
+ if (path86.length === 0) {
21151
21151
  return ctx.rootSchema;
21152
21152
  }
21153
21153
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
21154
- if (path88[0] === defsKey) {
21155
- const key = path88[1];
21154
+ if (path86[0] === defsKey) {
21155
+ const key = path86[1];
21156
21156
  if (!key || !ctx.defs[key]) {
21157
21157
  throw new Error(`Reference not found: ${ref}`);
21158
21158
  }
@@ -23770,7 +23770,6 @@ import os from "node:os";
23770
23770
  var INDEX_WORK_YIELD_EVERY, INDEX_DIR, INDEX_HASH_LEN;
23771
23771
  var init_constants = __esm({
23772
23772
  "../bridge/src/files/index/constants.ts"() {
23773
- "use strict";
23774
23773
  INDEX_WORK_YIELD_EVERY = 128;
23775
23774
  INDEX_DIR = path3.join(os.homedir(), ".buildautomaton");
23776
23775
  INDEX_HASH_LEN = 16;
@@ -24371,7 +24370,6 @@ function resetCodeNavCacheAvailabilityForTests() {
24371
24370
  var initState, initPromise, CodeNavCacheUnavailableError;
24372
24371
  var init_code_nav_cache_availability = __esm({
24373
24372
  "../bridge/src/sqlite/code-nav-cache/code-nav-cache-availability.ts"() {
24374
- "use strict";
24375
24373
  init_log();
24376
24374
  init_in_flight();
24377
24375
  init_sqlite_errors();
@@ -24748,7 +24746,7 @@ function readMigrationSql(filename, ...searchSubdirs) {
24748
24746
  join2(moduleDir, "..", sub, filename),
24749
24747
  join2(moduleDir, "..", "..", "dist", sub, filename)
24750
24748
  ]);
24751
- const resolved = candidates.find((path88) => existsSync(path88));
24749
+ const resolved = candidates.find((path86) => existsSync(path86));
24752
24750
  if (!resolved) {
24753
24751
  throw new Error(`Missing SQLite migration SQL: ${filename} (searched ${searchSubdirs.join(", ")})`);
24754
24752
  }
@@ -25137,31 +25135,18 @@ var init_cli_sqlite_paths = __esm({
25137
25135
  }
25138
25136
  });
25139
25137
 
25140
- // ../bridge/src/prompt-turn-queue/paths.ts
25141
- import path7 from "node:path";
25142
- import os4 from "node:os";
25143
- function getPromptQueuesDirectory() {
25144
- const override = process.env.BUILDAMATON_PROMPT_QUEUES_DIR?.trim();
25145
- if (override) return path7.resolve(override);
25146
- return path7.join(os4.homedir(), ".buildautomaton", "queues");
25147
- }
25148
- var init_paths2 = __esm({
25149
- "../bridge/src/prompt-turn-queue/paths.ts"() {
25150
- }
25151
- });
25152
-
25153
25138
  // ../bridge/src/sqlite/legacy_migration/archive-to-old-version.ts
25154
25139
  import fs7 from "node:fs";
25155
- import path8 from "node:path";
25140
+ import path7 from "node:path";
25156
25141
  function moveLegacyFileToOldVersionBackup(category, sourcePath) {
25157
- const destDir = path8.join(OLD_VERSION_DIR, category);
25142
+ const destDir = path7.join(OLD_VERSION_DIR, category);
25158
25143
  fs7.mkdirSync(destDir, { recursive: true });
25159
- const base = path8.basename(sourcePath);
25160
- let dest = path8.join(destDir, base);
25144
+ const base = path7.basename(sourcePath);
25145
+ let dest = path7.join(destDir, base);
25161
25146
  if (fs7.existsSync(dest)) {
25162
- const ext = path8.extname(base);
25147
+ const ext = path7.extname(base);
25163
25148
  const stem = ext ? base.slice(0, -ext.length) : base;
25164
- dest = path8.join(destDir, `${stem}-${Date.now()}${ext}`);
25149
+ dest = path7.join(destDir, `${stem}-${Date.now()}${ext}`);
25165
25150
  }
25166
25151
  fs7.renameSync(sourcePath, dest);
25167
25152
  }
@@ -25170,19 +25155,19 @@ var init_archive_to_old_version = __esm({
25170
25155
  "../bridge/src/sqlite/legacy_migration/archive-to-old-version.ts"() {
25171
25156
  "use strict";
25172
25157
  init_constants();
25173
- OLD_VERSION_DIR = path8.join(INDEX_DIR, "old-version");
25158
+ OLD_VERSION_DIR = path7.join(INDEX_DIR, "old-version");
25174
25159
  }
25175
25160
  });
25176
25161
 
25177
25162
  // ../bridge/src/sqlite/legacy_migration/archive-file-index-json.ts
25178
25163
  import fs8 from "node:fs";
25179
- import path9 from "node:path";
25164
+ import path8 from "node:path";
25180
25165
  function archiveLegacyFileIndexJsonFiles() {
25181
25166
  try {
25182
25167
  if (!fs8.existsSync(INDEX_DIR)) return;
25183
25168
  for (const name of fs8.readdirSync(INDEX_DIR)) {
25184
25169
  if (name.startsWith(".file-index-") && name.endsWith(".json")) {
25185
- const full = path9.join(INDEX_DIR, name);
25170
+ const full = path8.join(INDEX_DIR, name);
25186
25171
  try {
25187
25172
  moveLegacyFileToOldVersionBackup("file-index", full);
25188
25173
  } catch (err) {
@@ -25204,15 +25189,15 @@ var init_archive_file_index_json = __esm({
25204
25189
 
25205
25190
  // ../bridge/src/sqlite/legacy_migration/import-agent-sessions-from-disk.ts
25206
25191
  import fs9 from "node:fs";
25207
- import path10 from "node:path";
25208
- import os5 from "node:os";
25192
+ import path9 from "node:path";
25193
+ import os4 from "node:os";
25209
25194
  function importLegacyAgentSessionsFromDisk(db) {
25210
25195
  try {
25211
25196
  if (!fs9.existsSync(LEGACY_AGENT_SESSION_DIR)) return;
25212
25197
  const names = fs9.readdirSync(LEGACY_AGENT_SESSION_DIR).filter((n) => n.endsWith(".json"));
25213
25198
  for (const name of names) {
25214
25199
  const sessionKey = name.slice(0, -".json".length);
25215
- const full = path10.join(LEGACY_AGENT_SESSION_DIR, name);
25200
+ const full = path9.join(LEGACY_AGENT_SESSION_DIR, name);
25216
25201
  let raw;
25217
25202
  try {
25218
25203
  raw = fs9.readFileSync(full, "utf8");
@@ -25249,89 +25234,27 @@ var init_import_agent_sessions_from_disk = __esm({
25249
25234
  "../bridge/src/sqlite/legacy_migration/import-agent-sessions-from-disk.ts"() {
25250
25235
  "use strict";
25251
25236
  init_archive_to_old_version();
25252
- LEGACY_AGENT_SESSION_DIR = path10.join(os5.homedir(), ".buildautomaton", "agent-sessions");
25253
- }
25254
- });
25255
-
25256
- // ../bridge/src/sqlite/legacy_migration/parse-persisted-queue-json.ts
25257
- function parsePersistedQueueFromJson(raw) {
25258
- try {
25259
- const o = JSON.parse(raw);
25260
- const queueKey = typeof o.queueKey === "string" ? o.queueKey : typeof o.queueKeyHash === "string" ? o.queueKeyHash : null;
25261
- if (!queueKey || typeof o.updatedAt !== "string" || !Array.isArray(o.turns)) return null;
25262
- return { queueKey, updatedAt: o.updatedAt, turns: o.turns };
25263
- } catch {
25264
- return null;
25265
- }
25266
- }
25267
- var init_parse_persisted_queue_json = __esm({
25268
- "../bridge/src/sqlite/legacy_migration/parse-persisted-queue-json.ts"() {
25269
- "use strict";
25270
- }
25271
- });
25272
-
25273
- // ../bridge/src/sqlite/legacy_migration/import-prompt-queues-from-disk.ts
25274
- import fs10 from "node:fs";
25275
- import path11 from "node:path";
25276
- function importLegacyPromptQueuesFromDisk(db) {
25277
- try {
25278
- const dir = getPromptQueuesDirectory();
25279
- if (!fs10.existsSync(dir)) return;
25280
- for (const name of fs10.readdirSync(dir)) {
25281
- if (!name.endsWith(".json")) continue;
25282
- const full = path11.join(dir, name);
25283
- let raw;
25284
- try {
25285
- raw = fs10.readFileSync(full, "utf8");
25286
- } catch {
25287
- continue;
25288
- }
25289
- const file2 = parsePersistedQueueFromJson(raw);
25290
- if (!file2) continue;
25291
- db.run(
25292
- `INSERT OR REPLACE INTO prompt_queue (queue_key, updated_at, turns_json) VALUES (?, ?, ?)`,
25293
- [file2.queueKey, file2.updatedAt, JSON.stringify(file2.turns)]
25294
- );
25295
- try {
25296
- moveLegacyFileToOldVersionBackup("queues", full);
25297
- } catch {
25298
- }
25299
- }
25300
- } catch (e) {
25301
- console.error("[cli-sqlite] legacy import: prompt queues from disk failed", e);
25302
- }
25303
- }
25304
- var init_import_prompt_queues_from_disk = __esm({
25305
- "../bridge/src/sqlite/legacy_migration/import-prompt-queues-from-disk.ts"() {
25306
- "use strict";
25307
- init_paths2();
25308
- init_archive_to_old_version();
25309
- init_parse_persisted_queue_json();
25237
+ LEGACY_AGENT_SESSION_DIR = path9.join(os4.homedir(), ".buildautomaton", "agent-sessions");
25310
25238
  }
25311
25239
  });
25312
25240
 
25313
25241
  // ../bridge/src/sqlite/legacy_migration/import-cli-legacy-disk-data.ts
25314
- import fs11 from "node:fs";
25242
+ import fs10 from "node:fs";
25315
25243
  function legacyCliDiskMigrationIsPending() {
25316
25244
  try {
25317
- if (fs11.existsSync(INDEX_DIR)) {
25318
- for (const name of fs11.readdirSync(INDEX_DIR)) {
25245
+ if (fs10.existsSync(INDEX_DIR)) {
25246
+ for (const name of fs10.readdirSync(INDEX_DIR)) {
25319
25247
  if (name.startsWith(".file-index-") && name.endsWith(".json")) return true;
25320
25248
  }
25321
25249
  }
25322
25250
  } catch {
25323
25251
  }
25324
25252
  try {
25325
- if (fs11.existsSync(LEGACY_AGENT_SESSION_DIR)) {
25326
- if (fs11.readdirSync(LEGACY_AGENT_SESSION_DIR).some((n) => n.endsWith(".json"))) return true;
25253
+ if (fs10.existsSync(LEGACY_AGENT_SESSION_DIR)) {
25254
+ if (fs10.readdirSync(LEGACY_AGENT_SESSION_DIR).some((n) => n.endsWith(".json"))) return true;
25327
25255
  }
25328
25256
  } catch {
25329
25257
  }
25330
- try {
25331
- const dir = getPromptQueuesDirectory();
25332
- if (fs11.existsSync(dir) && fs11.readdirSync(dir).some((n) => n.endsWith(".json"))) return true;
25333
- } catch {
25334
- }
25335
25258
  return false;
25336
25259
  }
25337
25260
  function importCliSqliteLegacyDiskData(db, log2) {
@@ -25341,7 +25264,6 @@ function importCliSqliteLegacyDiskData(db, log2) {
25341
25264
  }
25342
25265
  archiveLegacyFileIndexJsonFiles();
25343
25266
  importLegacyAgentSessionsFromDisk(db);
25344
- importLegacyPromptQueuesFromDisk(db);
25345
25267
  if (pending2 && log2) {
25346
25268
  log2("Legacy on-disk CLI data migration finished.");
25347
25269
  }
@@ -25350,10 +25272,8 @@ var init_import_cli_legacy_disk_data = __esm({
25350
25272
  "../bridge/src/sqlite/legacy_migration/import-cli-legacy-disk-data.ts"() {
25351
25273
  "use strict";
25352
25274
  init_constants();
25353
- init_paths2();
25354
25275
  init_archive_file_index_json();
25355
25276
  init_import_agent_sessions_from_disk();
25356
- init_import_prompt_queues_from_disk();
25357
25277
  }
25358
25278
  });
25359
25279
 
@@ -25463,15 +25383,15 @@ var init_cli_database = __esm({
25463
25383
  });
25464
25384
 
25465
25385
  // ../bridge/src/files/index/walk-workspace-tree.ts
25466
- import fs12 from "node:fs";
25467
- import path12 from "node:path";
25386
+ import fs11 from "node:fs";
25387
+ import path10 from "node:path";
25468
25388
  function shouldSkipWorkspaceWalkEntry(name) {
25469
25389
  return DEPENDENCY_INSTALL_DIR_NAMES.has(name);
25470
25390
  }
25471
25391
  async function walkWorkspaceTreeAsync(dir, baseDir, onFile, state) {
25472
25392
  let names;
25473
25393
  try {
25474
- names = await fs12.promises.readdir(dir);
25394
+ names = await fs11.promises.readdir(dir);
25475
25395
  } catch {
25476
25396
  return;
25477
25397
  }
@@ -25486,14 +25406,14 @@ async function walkWorkspaceTreeAsync(dir, baseDir, onFile, state) {
25486
25406
  await yieldUntilFileBrowserReadsIdle();
25487
25407
  }
25488
25408
  state.n++;
25489
- const full = path12.join(dir, name);
25409
+ const full = path10.join(dir, name);
25490
25410
  let stat3;
25491
25411
  try {
25492
- stat3 = await fs12.promises.stat(full);
25412
+ stat3 = await fs11.promises.stat(full);
25493
25413
  } catch {
25494
25414
  continue;
25495
25415
  }
25496
- const relative6 = path12.relative(baseDir, full).replace(/\\/g, "/");
25416
+ const relative6 = path10.relative(baseDir, full).replace(/\\/g, "/");
25497
25417
  if (stat3.isDirectory()) {
25498
25418
  await walkWorkspaceTreeAsync(full, baseDir, onFile, state);
25499
25419
  } else if (stat3.isFile()) {
@@ -25822,7 +25742,7 @@ var require_ignore = __commonJS({
25822
25742
  // path matching.
25823
25743
  // - check `string` either `MODE_IGNORE` or `MODE_CHECK_IGNORE`
25824
25744
  // @returns {TestResult} true if a file is ignored
25825
- test(path88, checkUnignored, mode) {
25745
+ test(path86, checkUnignored, mode) {
25826
25746
  let ignored = false;
25827
25747
  let unignored = false;
25828
25748
  let matchedRule;
@@ -25831,7 +25751,7 @@ var require_ignore = __commonJS({
25831
25751
  if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
25832
25752
  return;
25833
25753
  }
25834
- const matched = rule[mode].test(path88);
25754
+ const matched = rule[mode].test(path86);
25835
25755
  if (!matched) {
25836
25756
  return;
25837
25757
  }
@@ -25852,17 +25772,17 @@ var require_ignore = __commonJS({
25852
25772
  var throwError = (message, Ctor) => {
25853
25773
  throw new Ctor(message);
25854
25774
  };
25855
- var checkPath = (path88, originalPath, doThrow) => {
25856
- if (!isString(path88)) {
25775
+ var checkPath = (path86, originalPath, doThrow) => {
25776
+ if (!isString(path86)) {
25857
25777
  return doThrow(
25858
25778
  `path must be a string, but got \`${originalPath}\``,
25859
25779
  TypeError
25860
25780
  );
25861
25781
  }
25862
- if (!path88) {
25782
+ if (!path86) {
25863
25783
  return doThrow(`path must not be empty`, TypeError);
25864
25784
  }
25865
- if (checkPath.isNotRelative(path88)) {
25785
+ if (checkPath.isNotRelative(path86)) {
25866
25786
  const r = "`path.relative()`d";
25867
25787
  return doThrow(
25868
25788
  `path should be a ${r} string, but got "${originalPath}"`,
@@ -25871,7 +25791,7 @@ var require_ignore = __commonJS({
25871
25791
  }
25872
25792
  return true;
25873
25793
  };
25874
- var isNotRelative = (path88) => REGEX_TEST_INVALID_PATH.test(path88);
25794
+ var isNotRelative = (path86) => REGEX_TEST_INVALID_PATH.test(path86);
25875
25795
  checkPath.isNotRelative = isNotRelative;
25876
25796
  checkPath.convert = (p) => p;
25877
25797
  var Ignore = class {
@@ -25901,19 +25821,19 @@ var require_ignore = __commonJS({
25901
25821
  }
25902
25822
  // @returns {TestResult}
25903
25823
  _test(originalPath, cache2, checkUnignored, slices) {
25904
- const path88 = originalPath && checkPath.convert(originalPath);
25824
+ const path86 = originalPath && checkPath.convert(originalPath);
25905
25825
  checkPath(
25906
- path88,
25826
+ path86,
25907
25827
  originalPath,
25908
25828
  this._strictPathCheck ? throwError : RETURN_FALSE
25909
25829
  );
25910
- return this._t(path88, cache2, checkUnignored, slices);
25830
+ return this._t(path86, cache2, checkUnignored, slices);
25911
25831
  }
25912
- checkIgnore(path88) {
25913
- if (!REGEX_TEST_TRAILING_SLASH.test(path88)) {
25914
- return this.test(path88);
25832
+ checkIgnore(path86) {
25833
+ if (!REGEX_TEST_TRAILING_SLASH.test(path86)) {
25834
+ return this.test(path86);
25915
25835
  }
25916
- const slices = path88.split(SLASH).filter(Boolean);
25836
+ const slices = path86.split(SLASH).filter(Boolean);
25917
25837
  slices.pop();
25918
25838
  if (slices.length) {
25919
25839
  const parent = this._t(
@@ -25926,18 +25846,18 @@ var require_ignore = __commonJS({
25926
25846
  return parent;
25927
25847
  }
25928
25848
  }
25929
- return this._rules.test(path88, false, MODE_CHECK_IGNORE);
25849
+ return this._rules.test(path86, false, MODE_CHECK_IGNORE);
25930
25850
  }
25931
- _t(path88, cache2, checkUnignored, slices) {
25932
- if (path88 in cache2) {
25933
- return cache2[path88];
25851
+ _t(path86, cache2, checkUnignored, slices) {
25852
+ if (path86 in cache2) {
25853
+ return cache2[path86];
25934
25854
  }
25935
25855
  if (!slices) {
25936
- slices = path88.split(SLASH).filter(Boolean);
25856
+ slices = path86.split(SLASH).filter(Boolean);
25937
25857
  }
25938
25858
  slices.pop();
25939
25859
  if (!slices.length) {
25940
- return cache2[path88] = this._rules.test(path88, checkUnignored, MODE_IGNORE);
25860
+ return cache2[path86] = this._rules.test(path86, checkUnignored, MODE_IGNORE);
25941
25861
  }
25942
25862
  const parent = this._t(
25943
25863
  slices.join(SLASH) + SLASH,
@@ -25945,29 +25865,29 @@ var require_ignore = __commonJS({
25945
25865
  checkUnignored,
25946
25866
  slices
25947
25867
  );
25948
- return cache2[path88] = parent.ignored ? parent : this._rules.test(path88, checkUnignored, MODE_IGNORE);
25868
+ return cache2[path86] = parent.ignored ? parent : this._rules.test(path86, checkUnignored, MODE_IGNORE);
25949
25869
  }
25950
- ignores(path88) {
25951
- return this._test(path88, this._ignoreCache, false).ignored;
25870
+ ignores(path86) {
25871
+ return this._test(path86, this._ignoreCache, false).ignored;
25952
25872
  }
25953
25873
  createFilter() {
25954
- return (path88) => !this.ignores(path88);
25874
+ return (path86) => !this.ignores(path86);
25955
25875
  }
25956
25876
  filter(paths) {
25957
25877
  return makeArray(paths).filter(this.createFilter());
25958
25878
  }
25959
25879
  // @returns {TestResult}
25960
- test(path88) {
25961
- return this._test(path88, this._testCache, true);
25880
+ test(path86) {
25881
+ return this._test(path86, this._testCache, true);
25962
25882
  }
25963
25883
  };
25964
25884
  var factory = (options) => new Ignore(options);
25965
- var isPathValid = (path88) => checkPath(path88 && checkPath.convert(path88), path88, RETURN_FALSE);
25885
+ var isPathValid = (path86) => checkPath(path86 && checkPath.convert(path86), path86, RETURN_FALSE);
25966
25886
  var setupWindows = () => {
25967
25887
  const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
25968
25888
  checkPath.convert = makePosix;
25969
25889
  const REGEX_TEST_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
25970
- checkPath.isNotRelative = (path88) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path88) || isNotRelative(path88);
25890
+ checkPath.isNotRelative = (path86) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path86) || isNotRelative(path86);
25971
25891
  };
25972
25892
  if (
25973
25893
  // Detect `process` so that it can run in browsers.
@@ -25983,8 +25903,8 @@ var require_ignore = __commonJS({
25983
25903
  });
25984
25904
 
25985
25905
  // ../bridge/src/code-nav/gitignore-filter.ts
25986
- import fs13 from "node:fs";
25987
- import path13 from "node:path";
25906
+ import fs12 from "node:fs";
25907
+ import path11 from "node:path";
25988
25908
  function normalizeRelPath(relPath) {
25989
25909
  return relPath.replace(/\\/g, "/");
25990
25910
  }
@@ -25994,12 +25914,12 @@ function isUnderDir(relPath, dirRel) {
25994
25914
  async function createGitignoreFilterForRelativePath(root, relPath) {
25995
25915
  const filter = new GitignoreFilter();
25996
25916
  await filter.enterDirectory(root, "");
25997
- const dirRel = normalizeRelPath(path13.dirname(relPath));
25917
+ const dirRel = normalizeRelPath(path11.dirname(relPath));
25998
25918
  if (dirRel === "." || dirRel === "") return filter;
25999
25919
  let abs = root;
26000
25920
  let rel = "";
26001
25921
  for (const segment of dirRel.split("/")) {
26002
- abs = path13.join(abs, segment);
25922
+ abs = path11.join(abs, segment);
26003
25923
  rel = rel ? `${rel}/${segment}` : segment;
26004
25924
  await filter.enterDirectory(abs, rel);
26005
25925
  }
@@ -26021,7 +25941,7 @@ var init_gitignore_filter = __esm({
26021
25941
  /** Load `.gitignore` in `absDir` and push a layer when the file exists. */
26022
25942
  async enterDirectory(absDir, dirRel) {
26023
25943
  try {
26024
- const content = await fs13.promises.readFile(path13.join(absDir, ".gitignore"), "utf8");
25944
+ const content = await fs12.promises.readFile(path11.join(absDir, ".gitignore"), "utf8");
26025
25945
  this.layers.push({ dirRel, ig: (0, import_ignore.default)().add(content) });
26026
25946
  } catch {
26027
25947
  }
@@ -26048,7 +25968,7 @@ var init_gitignore_filter = __esm({
26048
25968
  });
26049
25969
 
26050
25970
  // ../bridge/src/code-nav/language-registry.ts
26051
- import path14 from "node:path";
25971
+ import path12 from "node:path";
26052
25972
  function languageAssetPaths(key, wasmFile) {
26053
25973
  return {
26054
25974
  wasmFile,
@@ -26056,7 +25976,7 @@ function languageAssetPaths(key, wasmFile) {
26056
25976
  };
26057
25977
  }
26058
25978
  function getLanguageKeyForFilePath(filePath) {
26059
- const ext = path14.extname(filePath).replace(/^\./, "").toLowerCase();
25979
+ const ext = path12.extname(filePath).replace(/^\./, "").toLowerCase();
26060
25980
  if (!ext) return null;
26061
25981
  return EXT_TO_LANGUAGE_KEY[ext] ?? null;
26062
25982
  }
@@ -26106,13 +26026,13 @@ var init_language_registry = __esm({
26106
26026
  });
26107
26027
 
26108
26028
  // ../bridge/src/code-nav/walk-code-nav-files.ts
26109
- import fs14 from "node:fs";
26110
- import path15 from "node:path";
26029
+ import fs13 from "node:fs";
26030
+ import path13 from "node:path";
26111
26031
  async function walkCodeNavFilesInDirectory(dir, baseDir, relDir, filter, onFile, state) {
26112
26032
  await filter.enterDirectory(dir, relDir);
26113
26033
  let names;
26114
26034
  try {
26115
- names = await fs14.promises.readdir(dir);
26035
+ names = await fs13.promises.readdir(dir);
26116
26036
  } catch {
26117
26037
  filter.leaveDirectory(relDir);
26118
26038
  return;
@@ -26129,10 +26049,10 @@ async function walkCodeNavFilesInDirectory(dir, baseDir, relDir, filter, onFile,
26129
26049
  }
26130
26050
  state.n++;
26131
26051
  const relPath = relDir ? `${relDir}/${name}` : name;
26132
- const full = path15.join(dir, name);
26052
+ const full = path13.join(dir, name);
26133
26053
  let stat3;
26134
26054
  try {
26135
- stat3 = await fs14.promises.stat(full);
26055
+ stat3 = await fs13.promises.stat(full);
26136
26056
  } catch {
26137
26057
  continue;
26138
26058
  }
@@ -26149,7 +26069,7 @@ async function walkCodeNavFilesInDirectory(dir, baseDir, relDir, filter, onFile,
26149
26069
  filter.leaveDirectory(relDir);
26150
26070
  }
26151
26071
  async function walkCodeNavFilesAsync(rootDir, onFile, state = createWalkYieldState()) {
26152
- const resolved = path15.resolve(rootDir);
26072
+ const resolved = path13.resolve(rootDir);
26153
26073
  const filter = new GitignoreFilter();
26154
26074
  await walkCodeNavFilesInDirectory(resolved, resolved, "", filter, onFile, state);
26155
26075
  }
@@ -26912,7 +26832,7 @@ var init_persist_single_file = __esm({
26912
26832
  });
26913
26833
 
26914
26834
  // ../bridge/src/code-nav/resolve-module-import-path.ts
26915
- import path16 from "node:path";
26835
+ import path14 from "node:path";
26916
26836
  function normalizeWorkspacePath(filePath) {
26917
26837
  return filePath.replace(/\\/g, "/").replace(/^\/+/, "");
26918
26838
  }
@@ -26952,28 +26872,28 @@ function tsJsImportCandidates(joined) {
26952
26872
  function resolveModuleImportPath(importerFilePath, moduleSpecifier, workspaceFiles) {
26953
26873
  const spec = moduleSpecifier.trim();
26954
26874
  if (!spec || !isRelativeModuleSpecifier(spec)) return null;
26955
- const importerDir = path16.posix.dirname(normalizeWorkspacePath(importerFilePath));
26956
- const joined = normalizeWorkspacePath(path16.posix.normalize(path16.posix.join(importerDir, spec)));
26875
+ const importerDir = path14.posix.dirname(normalizeWorkspacePath(importerFilePath));
26876
+ const joined = normalizeWorkspacePath(path14.posix.normalize(path14.posix.join(importerDir, spec)));
26957
26877
  return firstExistingPath(tsJsImportCandidates(joined), workspaceFiles);
26958
26878
  }
26959
26879
  function resolvePythonModulePath(importerFilePath, moduleSpecifier, workspaceFiles) {
26960
26880
  const moduleName = moduleSpecifier.trim().replace(/\s+/g, "");
26961
26881
  if (!moduleName) return null;
26962
- const importerDir = path16.posix.dirname(normalizeWorkspacePath(importerFilePath));
26882
+ const importerDir = path14.posix.dirname(normalizeWorkspacePath(importerFilePath));
26963
26883
  if (moduleName.startsWith(".")) {
26964
26884
  const dotMatch = /^(\.+)(.*)$/.exec(moduleName);
26965
26885
  const dotCount = dotMatch?.[1]?.length ?? 1;
26966
26886
  const rest = (dotMatch?.[2] ?? "").replace(/^\./, "");
26967
26887
  let baseDir = importerDir;
26968
26888
  for (let i = 1; i < dotCount; i++) {
26969
- baseDir = path16.posix.dirname(baseDir);
26889
+ baseDir = path14.posix.dirname(baseDir);
26970
26890
  }
26971
26891
  const dottedPath2 = rest ? rest.split(".").join("/") : "";
26972
- const relativeBase = dottedPath2 ? path16.posix.join(baseDir, dottedPath2) : baseDir;
26892
+ const relativeBase = dottedPath2 ? path14.posix.join(baseDir, dottedPath2) : baseDir;
26973
26893
  return firstExistingPath(
26974
26894
  [
26975
26895
  ...withSuffixes(relativeBase, PYTHON_EXTENSIONS),
26976
- ...withSuffixes(path16.posix.join(relativeBase, "__init__"), [".py"])
26896
+ ...withSuffixes(path14.posix.join(relativeBase, "__init__"), [".py"])
26977
26897
  ],
26978
26898
  workspaceFiles
26979
26899
  );
@@ -26982,7 +26902,7 @@ function resolvePythonModulePath(importerFilePath, moduleSpecifier, workspaceFil
26982
26902
  return firstExistingPath(
26983
26903
  [
26984
26904
  ...withSuffixes(dottedPath, PYTHON_EXTENSIONS),
26985
- ...withSuffixes(path16.posix.join(importerDir, dottedPath), PYTHON_EXTENSIONS)
26905
+ ...withSuffixes(path14.posix.join(importerDir, dottedPath), PYTHON_EXTENSIONS)
26986
26906
  ],
26987
26907
  workspaceFiles
26988
26908
  );
@@ -26990,9 +26910,9 @@ function resolvePythonModulePath(importerFilePath, moduleSpecifier, workspaceFil
26990
26910
  function resolveIncludePath(importerFilePath, includePath, workspaceFiles) {
26991
26911
  const spec = includePath.trim().replace(/^["']|["']$/g, "");
26992
26912
  if (!spec) return null;
26993
- const importerDir = path16.posix.dirname(normalizeWorkspacePath(importerFilePath));
26913
+ const importerDir = path14.posix.dirname(normalizeWorkspacePath(importerFilePath));
26994
26914
  const joined = normalizeWorkspacePath(
26995
- path16.posix.normalize(path16.posix.join(importerDir, spec.replace(/\\/g, "/")))
26915
+ path14.posix.normalize(path14.posix.join(importerDir, spec.replace(/\\/g, "/")))
26996
26916
  );
26997
26917
  if (workspaceFiles.has(joined)) return joined;
26998
26918
  return firstExistingPath(withSuffixes(joined, C_CPP_EXTENSIONS), workspaceFiles);
@@ -27011,8 +26931,8 @@ function resolveGoImportPath(importerFilePath, moduleSpecifier, workspaceFiles)
27011
26931
  const spec = moduleSpecifier.trim();
27012
26932
  if (!spec) return null;
27013
26933
  if (isRelativeModuleSpecifier(spec)) {
27014
- const importerDir = path16.posix.dirname(normalizeWorkspacePath(importerFilePath));
27015
- const joined = normalizeWorkspacePath(path16.posix.normalize(path16.posix.join(importerDir, spec)));
26934
+ const importerDir = path14.posix.dirname(normalizeWorkspacePath(importerFilePath));
26935
+ const joined = normalizeWorkspacePath(path14.posix.normalize(path14.posix.join(importerDir, spec)));
27016
26936
  if (workspaceFiles.has(joined)) return joined;
27017
26937
  return firstExistingPath(withSuffixes(joined, [".go"]), workspaceFiles);
27018
26938
  }
@@ -28440,12 +28360,12 @@ var init_workspace_files = __esm({
28440
28360
  });
28441
28361
 
28442
28362
  // ../bridge/src/code-nav/symbol-index/build/extract-file-symbol-data.ts
28443
- import fs15 from "node:fs";
28444
- import path17 from "node:path";
28363
+ import fs14 from "node:fs";
28364
+ import path15 from "node:path";
28445
28365
  import { isMainThread as isMainThread3 } from "node:worker_threads";
28446
28366
  async function extractFileSymbolData(resolved, relPath, workspaceFilesOverride) {
28447
28367
  await yieldForBridgeInteractivePriority();
28448
- const absPath = path17.join(resolved, relPath);
28368
+ const absPath = path15.join(resolved, relPath);
28449
28369
  let tags = [];
28450
28370
  let source = null;
28451
28371
  if (isCodeNavSupportedPath(relPath) && !await isPathGitIgnored(resolved, relPath)) {
@@ -28453,16 +28373,16 @@ async function extractFileSymbolData(resolved, relPath, workspaceFilesOverride)
28453
28373
  assertBackgroundIndexingAllowed();
28454
28374
  let fileSource = null;
28455
28375
  if (isMainThread3) {
28456
- const stat3 = await fs15.promises.stat(absPath);
28376
+ const stat3 = await fs14.promises.stat(absPath);
28457
28377
  if (stat3.isFile() && stat3.size <= MAX_INDEX_FILE_BYTES) {
28458
28378
  assertBackgroundIndexingAllowed();
28459
- fileSource = await fs15.promises.readFile(absPath, "utf8");
28379
+ fileSource = await fs14.promises.readFile(absPath, "utf8");
28460
28380
  }
28461
28381
  } else {
28462
- const stat3 = fs15.statSync(absPath);
28382
+ const stat3 = fs14.statSync(absPath);
28463
28383
  if (stat3.isFile() && stat3.size <= MAX_INDEX_FILE_BYTES) {
28464
28384
  assertBackgroundIndexingAllowed();
28465
- fileSource = fs15.readFileSync(absPath, "utf8");
28385
+ fileSource = fs14.readFileSync(absPath, "utf8");
28466
28386
  }
28467
28387
  }
28468
28388
  source = fileSource;
@@ -28664,12 +28584,12 @@ var init_ensure_symbol_index_file_host = __esm({
28664
28584
  });
28665
28585
 
28666
28586
  // ../bridge/src/code-nav/symbol-index/lifecycle/normalize-symbol-index-path.ts
28667
- import path18 from "node:path";
28587
+ import path16 from "node:path";
28668
28588
  function normalizeSymbolIndexRelPath2(parentPath, changedPath) {
28669
- const resolvedParent = path18.resolve(parentPath);
28670
- const abs = path18.isAbsolute(changedPath) ? path18.resolve(changedPath) : path18.resolve(resolvedParent, changedPath);
28671
- const rel = path18.relative(resolvedParent, abs).replace(/\\/g, "/");
28672
- if (rel.startsWith("..") || path18.isAbsolute(rel)) return null;
28589
+ const resolvedParent = path16.resolve(parentPath);
28590
+ const abs = path16.isAbsolute(changedPath) ? path16.resolve(changedPath) : path16.resolve(resolvedParent, changedPath);
28591
+ const rel = path16.relative(resolvedParent, abs).replace(/\\/g, "/");
28592
+ if (rel.startsWith("..") || path16.isAbsolute(rel)) return null;
28673
28593
  return rel;
28674
28594
  }
28675
28595
  var init_normalize_symbol_index_path = __esm({
@@ -30050,7 +29970,7 @@ var require_has_flag = __commonJS({
30050
29970
  var require_supports_color = __commonJS({
30051
29971
  "../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js"(exports, module) {
30052
29972
  "use strict";
30053
- var os11 = __require("os");
29973
+ var os10 = __require("os");
30054
29974
  var tty = __require("tty");
30055
29975
  var hasFlag = require_has_flag();
30056
29976
  var { env } = process;
@@ -30098,7 +30018,7 @@ var require_supports_color = __commonJS({
30098
30018
  return min;
30099
30019
  }
30100
30020
  if (process.platform === "win32") {
30101
- const osRelease = os11.release().split(".");
30021
+ const osRelease = os10.release().split(".");
30102
30022
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
30103
30023
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
30104
30024
  }
@@ -30344,10 +30264,10 @@ var require_src2 = __commonJS({
30344
30264
  var fs_1 = __require("fs");
30345
30265
  var debug_1 = __importDefault(require_src());
30346
30266
  var log2 = debug_1.default("@kwsites/file-exists");
30347
- function check2(path88, isFile, isDirectory) {
30348
- log2(`checking %s`, path88);
30267
+ function check2(path86, isFile, isDirectory) {
30268
+ log2(`checking %s`, path86);
30349
30269
  try {
30350
- const stat3 = fs_1.statSync(path88);
30270
+ const stat3 = fs_1.statSync(path86);
30351
30271
  if (stat3.isFile() && isFile) {
30352
30272
  log2(`[OK] path represents a file`);
30353
30273
  return true;
@@ -30367,8 +30287,8 @@ var require_src2 = __commonJS({
30367
30287
  throw e;
30368
30288
  }
30369
30289
  }
30370
- function exists2(path88, type = exports.READABLE) {
30371
- return check2(path88, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
30290
+ function exists2(path86, type = exports.READABLE) {
30291
+ return check2(path86, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
30372
30292
  }
30373
30293
  exports.exists = exists2;
30374
30294
  exports.FILE = 1;
@@ -30449,14 +30369,14 @@ var {
30449
30369
  } = import_index.default;
30450
30370
 
30451
30371
  // src/cli-version.ts
30452
- var CLI_VERSION = "0.1.94".length > 0 ? "0.1.94" : "0.0.0-dev";
30372
+ var CLI_VERSION = "0.1.95".length > 0 ? "0.1.95" : "0.0.0-dev";
30453
30373
 
30454
30374
  // src/cli/defaults.ts
30455
30375
  var DEFAULT_API_URL = process.env.BUILDAUTOMATON_API_URL ?? "https://api.buildautomaton.com";
30456
30376
  var DEFAULT_FIREHOSE_URL = "https://buildautomaton-firehose.fly.dev";
30457
30377
 
30458
30378
  // src/cli/run-cli-action.ts
30459
- import * as path87 from "node:path";
30379
+ import * as path85 from "node:path";
30460
30380
 
30461
30381
  // ../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/wrapper.mjs
30462
30382
  var import_stream = __toESM(require_stream(), 1);
@@ -30753,7 +30673,7 @@ function formatSpawnError(err, command) {
30753
30673
  }
30754
30674
 
30755
30675
  // ../bridge/src/agents/acp/clients/kill-process-tree.ts
30756
- var import_tree_kill = __toESM(require_tree_kill(), 1);
30676
+ var import_tree_kill = __toESM(require_tree_kill());
30757
30677
  import { promisify } from "node:util";
30758
30678
  var treeKillAsync = promisify(import_tree_kill.default);
30759
30679
  var ACP_PROCESS_TREE_KILL_GRACE_MS = 2500;
@@ -31479,8 +31399,8 @@ function getErrorMap() {
31479
31399
 
31480
31400
  // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
31481
31401
  var makeIssue = (params) => {
31482
- const { data, path: path88, errorMaps, issueData } = params;
31483
- const fullPath = [...path88, ...issueData.path || []];
31402
+ const { data, path: path86, errorMaps, issueData } = params;
31403
+ const fullPath = [...path86, ...issueData.path || []];
31484
31404
  const fullIssue = {
31485
31405
  ...issueData,
31486
31406
  path: fullPath
@@ -31596,11 +31516,11 @@ var errorUtil;
31596
31516
 
31597
31517
  // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
31598
31518
  var ParseInputLazyPath = class {
31599
- constructor(parent, value, path88, key) {
31519
+ constructor(parent, value, path86, key) {
31600
31520
  this._cachedPath = [];
31601
31521
  this.parent = parent;
31602
31522
  this.data = value;
31603
- this._path = path88;
31523
+ this._path = path86;
31604
31524
  this._key = key;
31605
31525
  }
31606
31526
  get path() {
@@ -35510,83 +35430,8 @@ function isUserEndedSessionTurnErrorText(errorText) {
35510
35430
  }
35511
35431
 
35512
35432
  // ../types/src/session-kind.ts
35513
- var SESSION_KINDS = ["regular", "planning", "planned"];
35433
+ var SESSION_KINDS = ["regular", "planned"];
35514
35434
  var SESSION_KIND_SET = new Set(SESSION_KINDS);
35515
- function parseSessionKind(raw) {
35516
- if (raw === "todo") return "planned";
35517
- if (typeof raw === "string" && SESSION_KIND_SET.has(raw)) return raw;
35518
- return "regular";
35519
- }
35520
-
35521
- // ../types/src/planning-todo.ts
35522
- function planningTodoTitle(item) {
35523
- return item.content.title;
35524
- }
35525
-
35526
- // ../types/src/parse-planning-todo-agent-json.ts
35527
- function parsePlanningTodoAgentJson(raw) {
35528
- if (raw == null || raw.trim() === "") return [];
35529
- let text = raw.trim();
35530
- const fence = text.match(/```(?:json)?\s*([\s\S]*?)```/i);
35531
- if (fence?.[1]) text = fence[1].trim();
35532
- let parsed;
35533
- try {
35534
- parsed = JSON.parse(text);
35535
- } catch {
35536
- const start = text.indexOf("[");
35537
- const end = text.lastIndexOf("]");
35538
- if (start < 0 || end <= start) return [];
35539
- try {
35540
- parsed = JSON.parse(text.slice(start, end + 1));
35541
- } catch {
35542
- return [];
35543
- }
35544
- }
35545
- if (!Array.isArray(parsed)) return [];
35546
- const rows = [];
35547
- for (const item of parsed) {
35548
- if (!item || typeof item !== "object" || Array.isArray(item)) continue;
35549
- const o = item;
35550
- const title = typeof o.title === "string" ? o.title.trim() : "";
35551
- const prompt = typeof o.prompt === "string" ? o.prompt.trim() : typeof o.promptText === "string" ? o.promptText.trim() : "";
35552
- if (!title || !prompt) continue;
35553
- rows.push({ title, prompt });
35554
- }
35555
- return rows;
35556
- }
35557
-
35558
- // ../types/src/build-planning-session-agent-prompt.ts
35559
- var PLANNING_INSTRUCTIONS = [
35560
- "PLANNING MODE: You must NOT make any changes to the codebase, filesystem, or environment.",
35561
- "Do not run tools that modify files or execute commands that change state.",
35562
- "Your only task is to analyze and produce a plan.",
35563
- "",
35564
- "Respond with ONLY a single JSON array \u2014 no markdown fences, no other text before or after.",
35565
- "Each array element must be an object with exactly:",
35566
- '- "title": a one-line summary of the task',
35567
- '- "prompt": the full prompt to use when creating a new draft session from this todo',
35568
- "",
35569
- "Example:",
35570
- '[{"title":"Add user login","prompt":"Implement a login form with email and password..."}]'
35571
- ].join("\n");
35572
- function buildPlanningSessionAgentPrompt(userPrompt) {
35573
- return [PLANNING_INSTRUCTIONS, "", "User request:", userPrompt.trim()].join("\n");
35574
- }
35575
- function buildPlanningSessionFollowUpAgentPrompt(userPrompt, existingTodos) {
35576
- const todoLines = existingTodos.length > 0 ? existingTodos.map((t) => {
35577
- const status = t.plannedSessionId ? "DONE (draft session already created)" : "OPEN";
35578
- return `- [${status}] ${planningTodoTitle(t)}`;
35579
- }).join("\n") : "(none yet)";
35580
- return [
35581
- PLANNING_INSTRUCTIONS,
35582
- "",
35583
- "Existing todo items from this planning session (consider these when responding; do not duplicate completed items):",
35584
- todoLines,
35585
- "",
35586
- "User follow-up:",
35587
- userPrompt.trim()
35588
- ].join("\n");
35589
- }
35590
35435
 
35591
35436
  // ../types/src/diff/line-diff.ts
35592
35437
  function normalizeDiffLineText(line) {
@@ -35827,19 +35672,6 @@ function buildCliAutoApprovedPermissionRpcResult(requestParams) {
35827
35672
  };
35828
35673
  }
35829
35674
 
35830
- // ../types/src/acp-agent-text-stream-bucket.ts
35831
- function resolveAgentTextStreamBucket(params) {
35832
- const k = params.transcriptRowKind;
35833
- const su = params.sessionUpdate;
35834
- if (k === "agent_thought_chunk" || su === "agent_thought_chunk" || k === "thinking" || su === "thinking") {
35835
- return "thought";
35836
- }
35837
- if (k === "agent_message_chunk" || su === "agent_message_chunk" || k === "update" || su === "update") {
35838
- return "message";
35839
- }
35840
- return null;
35841
- }
35842
-
35843
35675
  // ../types/src/agent-config.ts
35844
35676
  var AGENT_CONFIG_CLAUDE_PERMISSION_MODE_KEY = "claude_permission_mode";
35845
35677
  var AGENT_CONFIG_CLI_PERMISSION_MODE_KEY = "cli_permission_mode";
@@ -36950,7 +36782,7 @@ function bridgeAgentPathEnv(base = process.env) {
36950
36782
  }
36951
36783
 
36952
36784
  // ../bridge/src/files/watch-file-index.ts
36953
- import path23 from "node:path";
36785
+ import path21 from "node:path";
36954
36786
 
36955
36787
  // ../bridge/src/files/index/index.ts
36956
36788
  init_paths();
@@ -36959,7 +36791,7 @@ init_paths();
36959
36791
  init_in_flight();
36960
36792
  init_cli_process_interrupt();
36961
36793
  init_database();
36962
- import path19 from "node:path";
36794
+ import path17 from "node:path";
36963
36795
 
36964
36796
  // ../bridge/src/files/index/file-index-sqlite-lock.ts
36965
36797
  var fileIndexChain = Promise.resolve();
@@ -37066,7 +36898,7 @@ function assertNotShutdown2() {
37066
36898
  if (isCliImmediateShutdownRequested()) throw new CliSqliteInterrupted();
37067
36899
  }
37068
36900
  async function buildFileIndexAsync(cwd) {
37069
- const resolved = path19.resolve(cwd);
36901
+ const resolved = path17.resolve(cwd);
37070
36902
  await yieldForBridgeInteractivePriority();
37071
36903
  assertNotShutdown2();
37072
36904
  const paths = await collectWorkspacePathsAsync(resolved);
@@ -37079,7 +36911,7 @@ async function buildFileIndexAsync(cwd) {
37079
36911
  }
37080
36912
 
37081
36913
  // ../bridge/src/files/index/ensure-file-index.ts
37082
- import path20 from "node:path";
36914
+ import path18 from "node:path";
37083
36915
 
37084
36916
  // ../bridge/src/files/index/search-file-index.ts
37085
36917
  init_yield_to_event_loop();
@@ -37134,7 +36966,7 @@ async function searchBridgeFilePathsAsync(resolvedCwd, query, limit = 100) {
37134
36966
 
37135
36967
  // ../bridge/src/files/index/ensure-file-index.ts
37136
36968
  async function ensureFileIndexAsync(cwd) {
37137
- const resolved = path20.resolve(cwd);
36969
+ const resolved = path18.resolve(cwd);
37138
36970
  if (await bridgeFileIndexIsPopulated(resolved)) {
37139
36971
  return { fromCache: true, pathCount: await bridgeFileIndexPathCount(resolved) };
37140
36972
  }
@@ -37886,16 +37718,16 @@ init_database();
37886
37718
  init_cli_process_interrupt();
37887
37719
 
37888
37720
  // ../bridge/src/files/index/file-index-incremental-symbol-updates.ts
37889
- import fs16 from "node:fs";
37890
- import path21 from "node:path";
37721
+ import fs15 from "node:fs";
37722
+ import path19 from "node:path";
37891
37723
  init_cli_process_interrupt();
37892
37724
  init_yield_to_event_loop();
37893
37725
  init_database();
37894
37726
  async function applyIncrementalSymbolIndexUpdates(resolved, relPaths) {
37895
37727
  for (const rel of relPaths) {
37896
- const absPath = path21.join(resolved, rel);
37728
+ const absPath = path19.join(resolved, rel);
37897
37729
  try {
37898
- const stat3 = await fs16.promises.stat(absPath);
37730
+ const stat3 = await fs15.promises.stat(absPath);
37899
37731
  if (stat3.isFile()) {
37900
37732
  await updateSymbolIndexForFile(resolved, absPath);
37901
37733
  } else {
@@ -38009,11 +37841,11 @@ function createFileIndexFsWatcher(resolved, schedule) {
38009
37841
  }
38010
37842
 
38011
37843
  // ../bridge/src/files/index/file-index-initial-builds.ts
38012
- import path22 from "node:path";
37844
+ import path20 from "node:path";
38013
37845
  init_database();
38014
37846
  init_code_nav_cache_availability();
38015
37847
  async function runInitialIndexBuilds(cwd = getBridgeRoot()) {
38016
- const resolved = path22.resolve(cwd);
37848
+ const resolved = path20.resolve(cwd);
38017
37849
  try {
38018
37850
  if (!await startCodeNavCacheInitialization()) return;
38019
37851
  await buildFileIndexAsync(resolved);
@@ -38032,7 +37864,7 @@ function scheduleInitialIndexBuilds(cwd = getBridgeRoot()) {
38032
37864
 
38033
37865
  // ../bridge/src/files/watch-file-index.ts
38034
37866
  function startFileIndexWatcher(cwd = getBridgeRoot()) {
38035
- const resolved = path23.resolve(cwd);
37867
+ const resolved = path21.resolve(cwd);
38036
37868
  const rebuildState = createFileIndexWatchRebuildState();
38037
37869
  let timer = null;
38038
37870
  const schedule = (relPath) => {
@@ -38292,20 +38124,20 @@ async function cancelRun(ctx, runId) {
38292
38124
  }
38293
38125
 
38294
38126
  // ../bridge/src/agents/acp/ensure-acp-client.ts
38295
- import * as fs19 from "node:fs";
38296
- import * as path29 from "node:path";
38127
+ import * as fs18 from "node:fs";
38128
+ import * as path27 from "node:path";
38297
38129
 
38298
38130
  // ../bridge/src/paths/session-layout-paths.ts
38299
- import * as path24 from "node:path";
38131
+ import * as path22 from "node:path";
38300
38132
  function resolveIsolatedSessionParentPathFromCheckouts(worktreePaths) {
38301
- const resolved = worktreePaths.map((p) => path24.resolve(p)).filter(Boolean);
38133
+ const resolved = worktreePaths.map((p) => path22.resolve(p)).filter(Boolean);
38302
38134
  if (resolved.length === 0) return null;
38303
38135
  resolved.sort();
38304
38136
  return resolved[0];
38305
38137
  }
38306
38138
  function resolveSessionParentPathForAgentProcess(resolvedSessionParentPath) {
38307
38139
  if (resolvedSessionParentPath != null && String(resolvedSessionParentPath).trim() !== "") {
38308
- return path24.resolve(String(resolvedSessionParentPath).trim());
38140
+ return path22.resolve(String(resolvedSessionParentPath).trim());
38309
38141
  }
38310
38142
  return getBridgeRoot();
38311
38143
  }
@@ -38686,20 +38518,20 @@ var codexProvider = {
38686
38518
  };
38687
38519
 
38688
38520
  // ../bridge/src/agents/providers/cursor/cleanup-session-plans.ts
38689
- import * as fs17 from "node:fs";
38521
+ import * as fs16 from "node:fs";
38690
38522
 
38691
38523
  // ../bridge/src/paths/session-plans-paths.ts
38692
- import * as os6 from "node:os";
38693
- import * as path25 from "node:path";
38524
+ import * as os5 from "node:os";
38525
+ import * as path23 from "node:path";
38694
38526
  function getSessionPlansRootDir() {
38695
- return path25.join(os6.homedir(), ".buildautomaton", "plans");
38527
+ return path23.join(os5.homedir(), ".buildautomaton", "plans");
38696
38528
  }
38697
38529
  function sanitizeSessionPlansKey(sessionId) {
38698
38530
  const t = sessionId.replace(/[^a-zA-Z0-9_-]+/g, "_").slice(0, 220);
38699
38531
  return t || "session";
38700
38532
  }
38701
38533
  function getSessionPlansDir(sessionId) {
38702
- return path25.join(getSessionPlansRootDir(), sanitizeSessionPlansKey(sessionId));
38534
+ return path23.join(getSessionPlansRootDir(), sanitizeSessionPlansKey(sessionId));
38703
38535
  }
38704
38536
 
38705
38537
  // ../bridge/src/agents/providers/cursor/cleanup-session-plans.ts
@@ -38708,7 +38540,7 @@ function cleanupSessionPlans(sessionId) {
38708
38540
  if (!id) return;
38709
38541
  const dir = getSessionPlansDir(id);
38710
38542
  try {
38711
- fs17.rmSync(dir, { recursive: true, force: true });
38543
+ fs16.rmSync(dir, { recursive: true, force: true });
38712
38544
  } catch {
38713
38545
  }
38714
38546
  }
@@ -39076,8 +38908,8 @@ function handleCursorIncomingPermissionRequest(id, method, msg, deps) {
39076
38908
  }
39077
38909
 
39078
38910
  // ../bridge/src/agents/providers/cursor/write-create-plan-file.ts
39079
- import * as fs18 from "node:fs";
39080
- import * as path26 from "node:path";
38911
+ import * as fs17 from "node:fs";
38912
+ import * as path24 from "node:path";
39081
38913
  import { pathToFileURL as pathToFileURL2 } from "node:url";
39082
38914
  function sanitizePlanFileBase(toolCallId) {
39083
38915
  const t = toolCallId.replace(/[^a-zA-Z0-9_-]+/g, "_").slice(0, 120);
@@ -39085,9 +38917,9 @@ function sanitizePlanFileBase(toolCallId) {
39085
38917
  }
39086
38918
  function writeCreatePlanFile(params) {
39087
38919
  const dir = getSessionPlansDir(params.cloudSessionId);
39088
- fs18.mkdirSync(dir, { recursive: true });
39089
- const filePath = path26.join(dir, `${sanitizePlanFileBase(params.toolCallId)}.md`);
39090
- fs18.writeFileSync(filePath, params.planMarkdown, "utf8");
38920
+ fs17.mkdirSync(dir, { recursive: true });
38921
+ const filePath = path24.join(dir, `${sanitizePlanFileBase(params.toolCallId)}.md`);
38922
+ fs17.writeFileSync(filePath, params.planMarkdown, "utf8");
39091
38923
  return pathToFileURL2(filePath).href;
39092
38924
  }
39093
38925
 
@@ -39701,16 +39533,16 @@ async function execGitFile(args, options) {
39701
39533
  }
39702
39534
 
39703
39535
  // ../bridge/src/git/get-git-repo-root-sync.ts
39704
- import * as path27 from "node:path";
39536
+ import * as path25 from "node:path";
39705
39537
  var GIT_LOOKUP_TIMEOUT_MS = 2e3;
39706
39538
  function getGitRepoRootSync(startDir) {
39707
39539
  try {
39708
39540
  const out = execGitFileSync(["rev-parse", "--show-toplevel"], {
39709
- cwd: path27.resolve(startDir),
39541
+ cwd: path25.resolve(startDir),
39710
39542
  maxBuffer: 1024 * 1024,
39711
39543
  timeout: GIT_LOOKUP_TIMEOUT_MS
39712
39544
  }).trim();
39713
- return out ? path27.resolve(out) : null;
39545
+ return out ? path25.resolve(out) : null;
39714
39546
  } catch {
39715
39547
  return null;
39716
39548
  }
@@ -39718,26 +39550,26 @@ function getGitRepoRootSync(startDir) {
39718
39550
 
39719
39551
  // ../bridge/src/agents/acp/workspace-files.ts
39720
39552
  import { readFileSync as readFileSync4 } from "node:fs";
39721
- import * as path28 from "node:path";
39553
+ import * as path26 from "node:path";
39722
39554
  var GIT_FILE_READ_TIMEOUT_MS = 2e3;
39723
39555
  function resolveWorkspaceFilePath(sessionParentPath, rawPath) {
39724
39556
  const trimmed2 = rawPath.trim();
39725
39557
  if (!trimmed2) return null;
39726
- const normalizedSessionParent = path28.resolve(sessionParentPath);
39558
+ const normalizedSessionParent = path26.resolve(sessionParentPath);
39727
39559
  let resolvedPath = resolveSafePathUnderCwd(sessionParentPath, trimmed2);
39728
39560
  if (!resolvedPath) {
39729
- const candidate = path28.isAbsolute(trimmed2) ? path28.normalize(trimmed2) : path28.normalize(path28.resolve(normalizedSessionParent, trimmed2));
39561
+ const candidate = path26.isAbsolute(trimmed2) ? path26.normalize(trimmed2) : path26.normalize(path26.resolve(normalizedSessionParent, trimmed2));
39730
39562
  const gitRoot2 = getGitRepoRootSync(sessionParentPath);
39731
39563
  if (!gitRoot2) return null;
39732
- const rel = path28.relative(gitRoot2, candidate);
39733
- if (rel.startsWith("..") || path28.isAbsolute(rel)) return null;
39564
+ const rel = path26.relative(gitRoot2, candidate);
39565
+ if (rel.startsWith("..") || path26.isAbsolute(rel)) return null;
39734
39566
  resolvedPath = candidate;
39735
39567
  }
39736
39568
  const gitRoot = getGitRepoRootSync(sessionParentPath);
39737
39569
  if (gitRoot) {
39738
- const relFromRoot = path28.relative(gitRoot, resolvedPath);
39739
- if (!relFromRoot.startsWith("..") && !path28.isAbsolute(relFromRoot)) {
39740
- return { resolvedPath, display: relFromRoot.split(path28.sep).join("/") };
39570
+ const relFromRoot = path26.relative(gitRoot, resolvedPath);
39571
+ if (!relFromRoot.startsWith("..") && !path26.isAbsolute(relFromRoot)) {
39572
+ return { resolvedPath, display: relFromRoot.split(path26.sep).join("/") };
39741
39573
  }
39742
39574
  }
39743
39575
  return { resolvedPath, display: toDisplayPathRelativeToCwd(sessionParentPath, resolvedPath) };
@@ -39746,9 +39578,9 @@ function readUtf8WorkspaceFile(sessionParentPath, displayPath) {
39746
39578
  if (!displayPath || displayPath.includes("..")) return "";
39747
39579
  const gitRoot = getGitRepoRootSync(sessionParentPath);
39748
39580
  if (gitRoot) {
39749
- const resolvedPath2 = path28.resolve(gitRoot, displayPath);
39750
- const rel = path28.relative(gitRoot, resolvedPath2);
39751
- if (!rel.startsWith("..") && !path28.isAbsolute(rel)) {
39581
+ const resolvedPath2 = path26.resolve(gitRoot, displayPath);
39582
+ const rel = path26.relative(gitRoot, resolvedPath2);
39583
+ if (!rel.startsWith("..") && !path26.isAbsolute(rel)) {
39752
39584
  try {
39753
39585
  return readFileSync4(resolvedPath2, "utf8");
39754
39586
  } catch {
@@ -39767,9 +39599,9 @@ function tryWorkspaceDisplayToPath(sessionParentPath, displayPath) {
39767
39599
  if (!displayPath || displayPath.includes("..")) return null;
39768
39600
  const gitRoot = getGitRepoRootSync(sessionParentPath);
39769
39601
  if (gitRoot) {
39770
- const resolvedPath = path28.resolve(gitRoot, displayPath);
39771
- const rel = path28.relative(gitRoot, resolvedPath);
39772
- if (!rel.startsWith("..") && !path28.isAbsolute(rel)) return resolvedPath;
39602
+ const resolvedPath = path26.resolve(gitRoot, displayPath);
39603
+ const rel = path26.relative(gitRoot, resolvedPath);
39604
+ if (!rel.startsWith("..") && !path26.isAbsolute(rel)) return resolvedPath;
39773
39605
  }
39774
39606
  return resolveSafePathUnderCwd(sessionParentPath, displayPath);
39775
39607
  }
@@ -40069,11 +39901,13 @@ var PathSnapshotTracker = class {
40069
39901
  };
40070
39902
 
40071
39903
  // ../bridge/src/agents/acp/hooks/bridge-on-session-update/send-session-info-title-update.ts
39904
+ var PLACEHOLDER_TITLES = /* @__PURE__ */ new Set(["session", "new session", "untitled"]);
40072
39905
  function extractSessionInfoTitle(params) {
40073
39906
  if (!params || typeof params !== "object") return null;
40074
39907
  const p = params;
40075
39908
  const title = typeof p.title === "string" ? p.title.trim() : "";
40076
- return title ? title : null;
39909
+ if (!title || PLACEHOLDER_TITLES.has(title.toLowerCase())) return null;
39910
+ return title;
40077
39911
  }
40078
39912
  function sendSessionInfoTitleUpdate(params) {
40079
39913
  const title = extractSessionInfoTitle(params.payload);
@@ -40394,74 +40228,12 @@ function resolveBridgeToolPaths(params, isToolUpdate, sessionParentPath) {
40394
40228
  return isToolUpdate ? extractToolTargetDisplayPaths(params, sessionParentPath) : [];
40395
40229
  }
40396
40230
 
40397
- // ../bridge/src/agents/planning/extract-session-update-message-text.ts
40398
- function extractSessionUpdateMessageText(params) {
40399
- if (params == null || typeof params !== "object" || Array.isArray(params)) return null;
40400
- const o = params;
40401
- if (typeof o.text === "string" && o.text.length > 0) return o.text;
40402
- const content = o.content;
40403
- if (typeof content === "string" && content.length > 0) return content;
40404
- if (content != null && typeof content === "object" && !Array.isArray(content)) {
40405
- const c = content;
40406
- if (typeof c.text === "string" && c.text.length > 0) return c.text;
40407
- }
40408
- const update = o.update;
40409
- if (typeof update === "string" && update.length > 0) return update;
40410
- if (update != null && typeof update === "object" && !Array.isArray(update)) {
40411
- const u = update;
40412
- const innerContent = u.content;
40413
- if (typeof innerContent === "string" && innerContent.length > 0) return innerContent;
40414
- if (innerContent != null && typeof innerContent === "object" && !Array.isArray(innerContent)) {
40415
- const ic = innerContent;
40416
- if (typeof ic.text === "string" && ic.text.length > 0) return ic.text;
40417
- }
40418
- }
40419
- return null;
40420
- }
40421
-
40422
- // ../bridge/src/agents/planning/planning-session-turn-buffer.ts
40423
- var MAX_PLANNING_BUFFER_CHARS = 512 * 1024;
40424
- var buffersByRunId = /* @__PURE__ */ new Map();
40425
- function registerPlanningSessionTurn(runId) {
40426
- buffersByRunId.set(runId, { messageBuffer: "" });
40427
- }
40428
- function clearPlanningSessionTurn(runId) {
40429
- buffersByRunId.delete(runId);
40430
- }
40431
- function capturePlanningSessionUpdate(params) {
40432
- const state = buffersByRunId.get(params.runId);
40433
- if (!state) return false;
40434
- const sessionUpdate = params.payload != null && typeof params.payload === "object" && !Array.isArray(params.payload) ? params.payload.sessionUpdate ?? params.payload.session_update : void 0;
40435
- const bucket = resolveAgentTextStreamBucket({
40436
- transcriptRowKind: params.updateKind,
40437
- sessionUpdate: typeof sessionUpdate === "string" ? sessionUpdate : void 0
40438
- });
40439
- if (bucket !== "message") return false;
40440
- const text = extractSessionUpdateMessageText(params.payload);
40441
- if (text && state.messageBuffer.length < MAX_PLANNING_BUFFER_CHARS) {
40442
- const room = MAX_PLANNING_BUFFER_CHARS - state.messageBuffer.length;
40443
- state.messageBuffer += room >= text.length ? text : text.slice(0, room);
40444
- }
40445
- return true;
40446
- }
40447
- function getPlanningSessionTurnOutput(runId) {
40448
- return buffersByRunId.get(runId)?.messageBuffer ?? "";
40449
- }
40450
- function consumePlanningSessionTurnOutput(runId) {
40451
- const state = buffersByRunId.get(runId);
40452
- buffersByRunId.delete(runId);
40453
- return state?.messageBuffer ?? "";
40454
- }
40455
-
40456
40231
  // ../bridge/src/agents/acp/hooks/bridge-on-session-update/forward-bridge-session-update.ts
40457
40232
  function forwardBridgeSessionUpdate(params) {
40458
40233
  const { runId, sessionId, updateKind, payload, send, nextTranscriptStreamSeq, log: log2 } = params;
40459
40234
  if (updateKind === "permission") {
40460
40235
  return;
40461
40236
  }
40462
- if (capturePlanningSessionUpdate({ runId, updateKind, payload })) {
40463
- return;
40464
- }
40465
40237
  try {
40466
40238
  const transcriptStreamSeq = nextTranscriptStreamSeq?.(runId);
40467
40239
  send({
@@ -40717,7 +40489,7 @@ async function ensureAcpClient(options) {
40717
40489
  if (state.acpStartPromise && !state.acpHandle) {
40718
40490
  await state.acpStartPromise;
40719
40491
  }
40720
- if (state.acpHandle && state.lastAcpCwd != null && path29.resolve(state.lastAcpCwd) !== path29.resolve(targetSessionParentPath)) {
40492
+ if (state.acpHandle && state.lastAcpCwd != null && path27.resolve(state.lastAcpCwd) !== path27.resolve(targetSessionParentPath)) {
40721
40493
  try {
40722
40494
  state.acpHandle.disconnect();
40723
40495
  } catch {
@@ -40749,7 +40521,7 @@ async function ensureAcpClient(options) {
40749
40521
  if (!state.acpStartPromise) {
40750
40522
  let statOk = false;
40751
40523
  try {
40752
- const st = await fs19.promises.stat(targetSessionParentPath);
40524
+ const st = await fs18.promises.stat(targetSessionParentPath);
40753
40525
  statOk = st.isDirectory();
40754
40526
  if (!statOk) {
40755
40527
  state.lastAcpStartError = `Agent cwd is not a directory: ${targetSessionParentPath}`;
@@ -40909,8 +40681,8 @@ function augmentPromptResultAuthFields(agentType, errorText) {
40909
40681
  init_yield_to_event_loop();
40910
40682
 
40911
40683
  // ../bridge/src/git/changes/parse/normalize-git-diff-path.ts
40912
- function normalizeGitDiffPath(path88) {
40913
- return path88.replace(/\\/g, "/").replace(/\/ +/g, "/").trim();
40684
+ function normalizeGitDiffPath(path86) {
40685
+ return path86.replace(/\\/g, "/").replace(/\/ +/g, "/").trim();
40914
40686
  }
40915
40687
 
40916
40688
  // ../bridge/src/git/changes/parse/parse-name-status-entries.ts
@@ -40949,7 +40721,7 @@ function parseNameStatusLines(lines) {
40949
40721
  }
40950
40722
 
40951
40723
  // ../bridge/src/git/snapshot/diff/messages.ts
40952
- import * as path30 from "node:path";
40724
+ import * as path28 from "node:path";
40953
40725
 
40954
40726
  // ../bridge/src/git/snapshot/diff/files.ts
40955
40727
  import { readFile, stat } from "node:fs/promises";
@@ -40980,7 +40752,7 @@ async function buildTrackedChangeMessage(options) {
40980
40752
  const diffArgs = entry.change === "moved" && oldRel ? ["diff", "--no-color", "-M", baselineRev, "--", oldRel, rel] : ["diff", "--no-color", "-M", baselineRev, "--", rel];
40981
40753
  const { stdout: patchContent } = await execGitFile(diffArgs, { cwd: repoPath });
40982
40754
  if (!patchContent.trim()) return null;
40983
- const workspaceFilePath = path30.join(repoPath, rel);
40755
+ const workspaceFilePath = path28.join(repoPath, rel);
40984
40756
  const newText = entry.change === "removed" ? "" : await readWorkspaceFileAsUtf8(workspaceFilePath);
40985
40757
  const oldText = entry.change === "added" ? "" : await readGitBlobAsUtf8(repoPath, baselineRev, oldRel ?? rel);
40986
40758
  return {
@@ -41012,9 +40784,9 @@ function buildUntrackedChangeMessage(options) {
41012
40784
  }
41013
40785
 
41014
40786
  // ../bridge/src/git/snapshot/diff/paths.ts
41015
- import * as path31 from "node:path";
40787
+ import * as path29 from "node:path";
41016
40788
  function repoDisplayPath(repoPath, multiRepo) {
41017
- const slug = path31.basename(repoPath).replace(/[^\w.-]+/g, "_") || "repo";
40789
+ const slug = path29.basename(repoPath).replace(/[^\w.-]+/g, "_") || "repo";
41018
40790
  return (rel) => multiRepo ? `${slug}/${rel}` : rel;
41019
40791
  }
41020
40792
  function safeRelPath(rel) {
@@ -41026,12 +40798,12 @@ function newUntrackedPaths(raw, baselineUntracked, seen) {
41026
40798
  }
41027
40799
 
41028
40800
  // ../bridge/src/git/snapshot/diff/move-pairs.ts
41029
- import * as path32 from "node:path";
40801
+ import * as path30 from "node:path";
41030
40802
  async function readUntrackedTexts(repoPath, untracked) {
41031
40803
  const out = /* @__PURE__ */ new Map();
41032
40804
  await forEachWithGitYield(untracked, async (rel) => {
41033
40805
  if (!safeRelPath(rel)) return;
41034
- const newText = await readWorkspaceFileAsUtf8(path32.join(repoPath, rel));
40806
+ const newText = await readWorkspaceFileAsUtf8(path30.join(repoPath, rel));
41035
40807
  if (newText !== void 0) out.set(rel, newText);
41036
40808
  });
41037
40809
  return out;
@@ -41148,12 +40920,12 @@ async function collectRepoTurnChanges(options) {
41148
40920
  import { readFile as readFile2 } from "node:fs/promises";
41149
40921
 
41150
40922
  // ../bridge/src/git/snapshot/types.ts
41151
- import * as path33 from "node:path";
40923
+ import * as path31 from "node:path";
41152
40924
  function snapshotsDirForCwd(agentCwd) {
41153
- return path33.join(agentCwd, ".buildautomaton", "snapshots");
40925
+ return path31.join(agentCwd, ".buildautomaton", "snapshots");
41154
40926
  }
41155
40927
  function snapshotFilePath(agentCwd, runId) {
41156
- return path33.join(snapshotsDirForCwd(agentCwd), `${runId}.json`);
40928
+ return path31.join(snapshotsDirForCwd(agentCwd), `${runId}.json`);
41157
40929
  }
41158
40930
 
41159
40931
  // ../bridge/src/git/snapshot/diff/load-pre-turn-snapshot.ts
@@ -41230,22 +41002,12 @@ async function finalizeAndSendPromptResult(params) {
41230
41002
  promptId,
41231
41003
  agentType,
41232
41004
  agentCwd,
41233
- isPlanningSession,
41234
41005
  followUpCatalogPromptId,
41235
- plugin,
41236
41006
  sendResult,
41237
41007
  sendSessionUpdate,
41238
41008
  log: log2
41239
41009
  } = params;
41240
41010
  notifyAgentProvidersPromptTurnFinished(sessionId);
41241
- const planningTodosSubmit = isPlanningSession && plugin?.cloud?.maybeSubmitPlanningTodos ? await plugin.cloud.maybeSubmitPlanningTodos({
41242
- sessionId,
41243
- runId,
41244
- resultSuccess: result.success === true,
41245
- output: result.output,
41246
- log: log2
41247
- }) : { suppressOutput: false };
41248
- const planningFallbackOutput = !planningTodosSubmit.suppressOutput && isPlanningSession && runId ? consumePlanningSessionTurnOutput(runId) : "";
41249
41011
  const errStr = typeof result.error === "string" ? result.error : void 0;
41250
41012
  const resultStop = typeof result.stopReason === "string" ? result.stopReason.trim() : "";
41251
41013
  const cancelledByAgent = resultStop.toLowerCase() === "cancelled" || errStr != null && isUserEndedSessionTurnErrorText(errStr);
@@ -41255,7 +41017,6 @@ async function finalizeAndSendPromptResult(params) {
41255
41017
  ...sessionId ? { sessionId } : {},
41256
41018
  ...runId ? { runId } : {},
41257
41019
  ...result,
41258
- ...planningTodosSubmit.suppressOutput ? { output: void 0 } : planningFallbackOutput.trim() !== "" ? { output: planningFallbackOutput } : {},
41259
41020
  ...followUpCatalogPromptId != null && followUpCatalogPromptId !== "" ? { followUpCatalogPromptId } : {},
41260
41021
  ...augmentPromptResultAuthFields(agentType, errStr),
41261
41022
  ...!result.success && cancelledByAgent ? { stopReason: "cancelled" } : {}
@@ -41283,14 +41044,12 @@ async function finalizeAndSendPromptResult(params) {
41283
41044
  async function prepareAgentPromptText(params) {
41284
41045
  const { promptText, sessionId, runId, isNewSession, plugin } = params;
41285
41046
  if (plugin?.cloud?.prepareAgentPromptText) {
41286
- const prepared = await plugin.cloud.prepareAgentPromptText({
41047
+ return plugin.cloud.prepareAgentPromptText({
41287
41048
  promptText,
41288
41049
  sessionId,
41289
41050
  runId,
41290
41051
  isNewSession
41291
41052
  });
41292
- if (prepared.isPlanningSession && runId) registerPlanningSessionTurn(runId);
41293
- return prepared;
41294
41053
  }
41295
41054
  return { agentPromptText: promptText, isPlanningSession: false };
41296
41055
  }
@@ -41366,7 +41125,6 @@ async function sendPromptToAgent(options) {
41366
41125
  attachments,
41367
41126
  isNewSession = false
41368
41127
  } = options;
41369
- let isPlanningSession = false;
41370
41128
  try {
41371
41129
  const prepared = await prepareAgentPromptText({
41372
41130
  promptText,
@@ -41375,7 +41133,6 @@ async function sendPromptToAgent(options) {
41375
41133
  isNewSession,
41376
41134
  plugin
41377
41135
  });
41378
- isPlanningSession = prepared.isPlanningSession;
41379
41136
  const imagesResolved = await resolveSendPromptImages({
41380
41137
  attachments,
41381
41138
  sessionId,
@@ -41404,7 +41161,6 @@ async function sendPromptToAgent(options) {
41404
41161
  promptId,
41405
41162
  agentType,
41406
41163
  agentCwd,
41407
- isPlanningSession,
41408
41164
  followUpCatalogPromptId,
41409
41165
  plugin,
41410
41166
  sendResult,
@@ -41424,8 +41180,6 @@ async function sendPromptToAgent(options) {
41424
41180
  ...followUpCatalogPromptId != null && followUpCatalogPromptId !== "" ? { followUpCatalogPromptId } : {},
41425
41181
  ...augmentPromptResultAuthFields(agentType, errMsg)
41426
41182
  });
41427
- } finally {
41428
- if (runId && isPlanningSession) clearPlanningSessionTurn(runId);
41429
41183
  }
41430
41184
  }
41431
41185
 
@@ -41600,6 +41354,7 @@ async function createAcpManager(options) {
41600
41354
  logPromptReceivedFromBridge: (opts) => logPromptReceivedFromBridge(ctx, opts),
41601
41355
  handlePrompt: (opts) => handlePrompt(ctx, opts),
41602
41356
  cancelRun: (runId) => cancelRun(ctx, runId),
41357
+ isRegisteredRun: (runId) => ctx.promptRouting.isRegisteredRun(runId),
41603
41358
  resolveRequest(requestId, result) {
41604
41359
  for (const state of ctx.acpAgents.values()) {
41605
41360
  state.acpHandle?.resolveRequest?.(requestId, result);
@@ -41875,8 +41630,8 @@ function decryptCliE2eeMessageField(payload, field, e2ee) {
41875
41630
  }
41876
41631
 
41877
41632
  // ../bridge/src/e2ee/certificates.ts
41878
- import * as fs20 from "node:fs/promises";
41879
- import * as path34 from "node:path";
41633
+ import * as fs19 from "node:fs/promises";
41634
+ import * as path32 from "node:path";
41880
41635
  var E2E_CERTIFICATE_ALGORITHM = "A1";
41881
41636
  var CERTIFICATE_FILE_EXTENSIONS = /* @__PURE__ */ new Set([".pem", ".key", ".crt"]);
41882
41637
  function certificateFromKey({
@@ -41897,12 +41652,12 @@ function certificateFromKey({
41897
41652
  }
41898
41653
  }
41899
41654
  function baseNameForCertificate(fileName) {
41900
- return path34.basename(fileName, path34.extname(fileName)) || "BuildAutomaton E2EE certificate";
41655
+ return path32.basename(fileName, path32.extname(fileName)) || "BuildAutomaton E2EE certificate";
41901
41656
  }
41902
41657
  async function readCertificateFiles(directory) {
41903
41658
  let entries;
41904
41659
  try {
41905
- entries = await fs20.readdir(directory, { withFileTypes: true });
41660
+ entries = await fs19.readdir(directory, { withFileTypes: true });
41906
41661
  } catch (err) {
41907
41662
  const nodeErr = err;
41908
41663
  if (nodeErr.code === "ENOENT") return [];
@@ -41910,11 +41665,11 @@ async function readCertificateFiles(directory) {
41910
41665
  }
41911
41666
  const certificates = [];
41912
41667
  for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
41913
- if (!entry.isFile() || !CERTIFICATE_FILE_EXTENSIONS.has(path34.extname(entry.name).toLowerCase())) continue;
41914
- const filePath = path34.join(directory, entry.name);
41915
- const raw = await fs20.readFile(filePath, "utf8").catch(() => void 0);
41668
+ if (!entry.isFile() || !CERTIFICATE_FILE_EXTENSIONS.has(path32.extname(entry.name).toLowerCase())) continue;
41669
+ const filePath = path32.join(directory, entry.name);
41670
+ const raw = await fs19.readFile(filePath, "utf8").catch(() => void 0);
41916
41671
  if (!raw) continue;
41917
- const stat3 = await fs20.stat(filePath).catch(() => void 0);
41672
+ const stat3 = await fs19.stat(filePath).catch(() => void 0);
41918
41673
  const certificate = certificateFromKey({
41919
41674
  raw,
41920
41675
  name: baseNameForCertificate(entry.name),
@@ -41927,7 +41682,7 @@ async function readCertificateFiles(directory) {
41927
41682
  return certificates;
41928
41683
  }
41929
41684
  function createCertificate(directory) {
41930
- const baseName = path34.basename(directory) || "BuildAutomaton E2EE certificate";
41685
+ const baseName = path32.basename(directory) || "BuildAutomaton E2EE certificate";
41931
41686
  const key = createE2eeKeyRecord(baseName);
41932
41687
  return {
41933
41688
  ...key,
@@ -41936,8 +41691,8 @@ function createCertificate(directory) {
41936
41691
  };
41937
41692
  }
41938
41693
  async function loadOrCreateE2eCertificates(directory) {
41939
- const resolved = path34.resolve(directory);
41940
- await fs20.mkdir(resolved, { recursive: true, mode: 448 });
41694
+ const resolved = path32.resolve(directory);
41695
+ await fs19.mkdir(resolved, { recursive: true, mode: 448 });
41941
41696
  const existing = await readCertificateFiles(resolved);
41942
41697
  if (existing.length > 0) {
41943
41698
  return {
@@ -41949,7 +41704,7 @@ async function loadOrCreateE2eCertificates(directory) {
41949
41704
  }
41950
41705
  const certificate = createCertificate(resolved);
41951
41706
  const fileName = `buildautomaton-e2ee-key-${certificate.id.slice(0, 12)}.pem`;
41952
- await fs20.writeFile(path34.join(resolved, fileName), certificate.pemBundle, {
41707
+ await fs19.writeFile(path32.join(resolved, fileName), certificate.pemBundle, {
41953
41708
  mode: 384
41954
41709
  });
41955
41710
  return {
@@ -42142,7 +41897,7 @@ async function createBridgeAccessState(options) {
42142
41897
  }
42143
41898
 
42144
41899
  // ../bridge/src/agents/capabilities/warmup-agent-capabilities-on-connect.ts
42145
- import * as path36 from "node:path";
41900
+ import * as path34 from "node:path";
42146
41901
 
42147
41902
  // ../bridge/src/agents/detect-local-agent-types.ts
42148
41903
  init_yield_to_event_loop();
@@ -42264,7 +42019,7 @@ function shouldSkipCapabilityProbeThisProcess(agentType) {
42264
42019
  }
42265
42020
 
42266
42021
  // ../bridge/src/agents/capabilities/probe-one-agent-type-for-capabilities.ts
42267
- import * as path35 from "node:path";
42022
+ import * as path33 from "node:path";
42268
42023
  init_cli_database();
42269
42024
  init_yield_to_event_loop();
42270
42025
  init_cli_process_interrupt();
@@ -42290,7 +42045,7 @@ async function probeOneAgentTypeForCapabilities(params) {
42290
42045
  try {
42291
42046
  handle = await resolved.createClient({
42292
42047
  command: resolved.command,
42293
- cwd: path35.resolve(cwd),
42048
+ cwd: path33.resolve(cwd),
42294
42049
  backendAgentType: agentType,
42295
42050
  sessionMode: "agent",
42296
42051
  persistedAcpSessionId: null,
@@ -42380,7 +42135,7 @@ async function warmupAgentCapabilitiesOnConnect(params) {
42380
42135
  const { workspaceId, log: log2, getWs } = params;
42381
42136
  const isCurrent = beginAgentCapabilityWarmupRun();
42382
42137
  if (!isCurrent()) return;
42383
- const cwd = path36.resolve(getBridgeRoot());
42138
+ const cwd = path34.resolve(getBridgeRoot());
42384
42139
  async function sendBatchFromCache() {
42385
42140
  if (!isCurrent()) return;
42386
42141
  const socket = getWs();
@@ -42489,7 +42244,7 @@ async function createBridgeAccessAndAcp(options) {
42489
42244
  }
42490
42245
 
42491
42246
  // ../bridge/src/connection/setup/create-bridge-preview-stack.ts
42492
- import * as path39 from "node:path";
42247
+ import * as path37 from "node:path";
42493
42248
 
42494
42249
  // ../bridge/src/preview-environments/manager/firehose-messages.ts
42495
42250
  function buildFirehoseSnapshotMessage(params) {
@@ -42807,7 +42562,7 @@ function attachChildErrorHandler(d) {
42807
42562
  }
42808
42563
 
42809
42564
  // ../bridge/src/preview-environments/process/wire/handle-exit.ts
42810
- import fs21 from "node:fs";
42565
+ import fs20 from "node:fs";
42811
42566
  function logStopLine(d, code, signal) {
42812
42567
  const { title } = d;
42813
42568
  if (signal) {
@@ -42846,7 +42601,7 @@ function attachChildExitHandler(d) {
42846
42601
  const cleanupDir = d.mergedCleanupDir;
42847
42602
  const mergedPath = d.mergedLogPath;
42848
42603
  if (mergedPath && !stale) {
42849
- fs21.readFile(mergedPath, (err, buf) => {
42604
+ fs20.readFile(mergedPath, (err, buf) => {
42850
42605
  if (!err && buf.length > d.mergedReadPos.value) {
42851
42606
  const chunk = Buffer.from(buf.subarray(d.mergedReadPos.value));
42852
42607
  if (chunk.length > 0) {
@@ -42892,7 +42647,7 @@ function wireChildOutputPipes(d) {
42892
42647
  }
42893
42648
 
42894
42649
  // ../bridge/src/preview-environments/process/wire/poll-merged-log.ts
42895
- import fs22 from "node:fs";
42650
+ import fs21 from "node:fs";
42896
42651
  function startMergedLogPoll(d) {
42897
42652
  if (!d.mergedLogPath || !d.mergedCleanupDir) return;
42898
42653
  const { environmentId } = d;
@@ -42902,7 +42657,7 @@ function startMergedLogPoll(d) {
42902
42657
  d.setPollInterval(void 0);
42903
42658
  return;
42904
42659
  }
42905
- fs22.readFile(d.mergedLogPath, (err, buf) => {
42660
+ fs21.readFile(d.mergedLogPath, (err, buf) => {
42906
42661
  if (err || (d.getSpawnGeneration() ?? 0) !== d.scheduledGen) return;
42907
42662
  if (buf.length <= d.mergedReadPos.value) return;
42908
42663
  const chunk = Buffer.from(buf.subarray(d.mergedReadPos.value));
@@ -43117,7 +42872,7 @@ function previewEnvironmentSpawnOptions(lifecycle = DEFAULT_PREVIEW_ENVIRONMENT_
43117
42872
  }
43118
42873
 
43119
42874
  // ../bridge/src/preview-environments/manager/shell-spawn/utils.ts
43120
- import fs23 from "node:fs";
42875
+ import fs22 from "node:fs";
43121
42876
  function mergePreviewEnvironmentSpawnOptions(opts, lifecycle = DEFAULT_PREVIEW_ENVIRONMENT_PROCESS_LIFECYCLE) {
43122
42877
  return { ...opts, ...previewEnvironmentSpawnOptions(lifecycle) };
43123
42878
  }
@@ -43126,7 +42881,7 @@ function isSpawnEbadf(e) {
43126
42881
  }
43127
42882
  function rmDirQuiet(dir) {
43128
42883
  try {
43129
- fs23.rmSync(dir, { recursive: true, force: true });
42884
+ fs22.rmSync(dir, { recursive: true, force: true });
43130
42885
  } catch {
43131
42886
  }
43132
42887
  }
@@ -43134,7 +42889,7 @@ var cachedDevNullReadFd;
43134
42889
  function devNullReadFd() {
43135
42890
  if (cachedDevNullReadFd === void 0) {
43136
42891
  const devPath = process.platform === "win32" ? "nul" : "/dev/null";
43137
- cachedDevNullReadFd = fs23.openSync(devPath, "r");
42892
+ cachedDevNullReadFd = fs22.openSync(devPath, "r");
43138
42893
  }
43139
42894
  return cachedDevNullReadFd;
43140
42895
  }
@@ -43214,15 +42969,15 @@ function trySpawnShellTruePiped(command, env, cwd, devNullFd, signal, lifecycle)
43214
42969
 
43215
42970
  // ../bridge/src/preview-environments/manager/shell-spawn/try-spawn-merged-log-file.ts
43216
42971
  import { spawn as spawn7 } from "node:child_process";
43217
- import fs24 from "node:fs";
42972
+ import fs23 from "node:fs";
43218
42973
  import { tmpdir } from "node:os";
43219
- import path37 from "node:path";
42974
+ import path35 from "node:path";
43220
42975
  function trySpawnMergedLogFile(command, env, cwd, signal, lifecycle) {
43221
- const tmpRoot = fs24.mkdtempSync(path37.join(tmpdir(), "ba-devsrv-log-"));
43222
- const logPath = path37.join(tmpRoot, "combined.log");
42976
+ const tmpRoot = fs23.mkdtempSync(path35.join(tmpdir(), "ba-devsrv-log-"));
42977
+ const logPath = path35.join(tmpRoot, "combined.log");
43223
42978
  let logFd;
43224
42979
  try {
43225
- logFd = fs24.openSync(logPath, "a");
42980
+ logFd = fs23.openSync(logPath, "a");
43226
42981
  } catch {
43227
42982
  rmDirQuiet(tmpRoot);
43228
42983
  return null;
@@ -43246,7 +43001,7 @@ function trySpawnMergedLogFile(command, env, cwd, signal, lifecycle) {
43246
43001
  mergePreviewEnvironmentSpawnOptions({ env, cwd, stdio, ...signal ? { signal } : {} }, lifecycle)
43247
43002
  );
43248
43003
  }
43249
- fs24.closeSync(logFd);
43004
+ fs23.closeSync(logFd);
43250
43005
  return {
43251
43006
  proc,
43252
43007
  pipedStdoutStderr: true,
@@ -43255,7 +43010,7 @@ function trySpawnMergedLogFile(command, env, cwd, signal, lifecycle) {
43255
43010
  };
43256
43011
  } catch (e) {
43257
43012
  try {
43258
- fs24.closeSync(logFd);
43013
+ fs23.closeSync(logFd);
43259
43014
  } catch {
43260
43015
  }
43261
43016
  rmDirQuiet(tmpRoot);
@@ -43266,22 +43021,22 @@ function trySpawnMergedLogFile(command, env, cwd, signal, lifecycle) {
43266
43021
 
43267
43022
  // ../bridge/src/preview-environments/manager/shell-spawn/try-spawn-shell-script-log-redirect.ts
43268
43023
  import { spawn as spawn8 } from "node:child_process";
43269
- import fs25 from "node:fs";
43024
+ import fs24 from "node:fs";
43270
43025
  import { tmpdir as tmpdir2 } from "node:os";
43271
- import path38 from "node:path";
43026
+ import path36 from "node:path";
43272
43027
  function shSingleQuote(s) {
43273
43028
  return `'${s.replace(/'/g, `'\\''`)}'`;
43274
43029
  }
43275
43030
  function trySpawnShellScriptLogRedirectUnix(command, env, cwd, signal, lifecycle) {
43276
- const tmpRoot = fs25.mkdtempSync(path38.join(tmpdir2(), "ba-devsrv-sh-"));
43277
- const logPath = path38.join(tmpRoot, "combined.log");
43278
- const innerPath = path38.join(tmpRoot, "_cmd.sh");
43279
- const runnerPath = path38.join(tmpRoot, "_run.sh");
43031
+ const tmpRoot = fs24.mkdtempSync(path36.join(tmpdir2(), "ba-devsrv-sh-"));
43032
+ const logPath = path36.join(tmpRoot, "combined.log");
43033
+ const innerPath = path36.join(tmpRoot, "_cmd.sh");
43034
+ const runnerPath = path36.join(tmpRoot, "_run.sh");
43280
43035
  try {
43281
- fs25.writeFileSync(innerPath, `#!/bin/sh
43036
+ fs24.writeFileSync(innerPath, `#!/bin/sh
43282
43037
  ${command}
43283
43038
  `);
43284
- fs25.writeFileSync(
43039
+ fs24.writeFileSync(
43285
43040
  runnerPath,
43286
43041
  `#!/bin/sh
43287
43042
  cd ${shSingleQuote(cwd)}
@@ -43309,13 +43064,13 @@ cd ${shSingleQuote(cwd)}
43309
43064
  }
43310
43065
  }
43311
43066
  function trySpawnShellScriptLogRedirectWin(command, env, cwd, signal, lifecycle) {
43312
- const tmpRoot = fs25.mkdtempSync(path38.join(tmpdir2(), "ba-devsrv-sh-"));
43313
- const logPath = path38.join(tmpRoot, "combined.log");
43314
- const runnerPath = path38.join(tmpRoot, "_run.bat");
43067
+ const tmpRoot = fs24.mkdtempSync(path36.join(tmpdir2(), "ba-devsrv-sh-"));
43068
+ const logPath = path36.join(tmpRoot, "combined.log");
43069
+ const runnerPath = path36.join(tmpRoot, "_run.bat");
43315
43070
  const q = (p) => `"${p.replace(/"/g, '""')}"`;
43316
43071
  const com = process.env.ComSpec || "cmd.exe";
43317
43072
  try {
43318
- fs25.writeFileSync(
43073
+ fs24.writeFileSync(
43319
43074
  runnerPath,
43320
43075
  `@ECHO OFF\r
43321
43076
  CD /D ${q(cwd)}\r
@@ -43633,8 +43388,8 @@ function createBridgePreviewStack(options) {
43633
43388
  scheduleInitialIndexBuilds(getBridgeRoot());
43634
43389
  };
43635
43390
  const identifyReportedPaths = {
43636
- bridgeRootPath: path39.resolve(getBridgeRoot()),
43637
- worktreesRootPath: path39.resolve(options.worktreesRootPath),
43391
+ bridgeRootPath: path37.resolve(getBridgeRoot()),
43392
+ worktreesRootPath: path37.resolve(options.worktreesRootPath),
43638
43393
  localShortcutPort: 0,
43639
43394
  localShortcutToken: ""
43640
43395
  };
@@ -43836,7 +43591,7 @@ function createBridgeHeartbeatController(params) {
43836
43591
  }
43837
43592
 
43838
43593
  // ../bridge/src/cli/cli-version.ts
43839
- var CLI_VERSION2 = "0.1.94".length > 0 ? "0.1.94" : "0.0.0-dev";
43594
+ var CLI_VERSION2 = "0.1.95".length > 0 ? "0.1.95" : "0.0.0-dev";
43840
43595
 
43841
43596
  // ../bridge/src/connection/identify/send-bridge-identify.ts
43842
43597
  function sendBridgeIdentify(ws, params) {
@@ -44007,12 +43762,12 @@ function createBridgeRuntimeMessageSetup(options) {
44007
43762
  }
44008
43763
 
44009
43764
  // ../bridge/src/worktrees/worktree-layout-file.ts
44010
- import * as fs26 from "node:fs";
44011
- import * as path40 from "node:path";
44012
- import os7 from "node:os";
43765
+ import * as fs25 from "node:fs";
43766
+ import * as path38 from "node:path";
43767
+ import os6 from "node:os";
44013
43768
  var LAYOUT_FILENAME = "worktree-launcher-layout.json";
44014
43769
  function defaultWorktreeLayoutPath() {
44015
- return path40.join(os7.homedir(), ".buildautomaton", LAYOUT_FILENAME);
43770
+ return path38.join(os6.homedir(), ".buildautomaton", LAYOUT_FILENAME);
44016
43771
  }
44017
43772
  function normalizeLoadedLayout(raw) {
44018
43773
  if (raw && typeof raw === "object" && "launcherCwds" in raw) {
@@ -44024,8 +43779,8 @@ function normalizeLoadedLayout(raw) {
44024
43779
  function loadWorktreeLayout() {
44025
43780
  try {
44026
43781
  const p = defaultWorktreeLayoutPath();
44027
- if (!fs26.existsSync(p)) return { launcherCwds: [] };
44028
- const raw = JSON.parse(fs26.readFileSync(p, "utf8"));
43782
+ if (!fs25.existsSync(p)) return { launcherCwds: [] };
43783
+ const raw = JSON.parse(fs25.readFileSync(p, "utf8"));
44029
43784
  return normalizeLoadedLayout(raw);
44030
43785
  } catch {
44031
43786
  return { launcherCwds: [] };
@@ -44033,24 +43788,24 @@ function loadWorktreeLayout() {
44033
43788
  }
44034
43789
  function saveWorktreeLayout(layout) {
44035
43790
  try {
44036
- const dir = path40.dirname(defaultWorktreeLayoutPath());
44037
- fs26.mkdirSync(dir, { recursive: true });
44038
- fs26.writeFileSync(defaultWorktreeLayoutPath(), JSON.stringify(layout, null, 2), "utf8");
43791
+ const dir = path38.dirname(defaultWorktreeLayoutPath());
43792
+ fs25.mkdirSync(dir, { recursive: true });
43793
+ fs25.writeFileSync(defaultWorktreeLayoutPath(), JSON.stringify(layout, null, 2), "utf8");
44039
43794
  } catch {
44040
43795
  }
44041
43796
  }
44042
43797
  function baseNameSafe(pathString) {
44043
- return path40.basename(pathString).replace(/[^a-zA-Z0-9._-]+/g, "-") || "cwd";
43798
+ return path38.basename(pathString).replace(/[^a-zA-Z0-9._-]+/g, "-") || "cwd";
44044
43799
  }
44045
43800
  function getLauncherDirNameIfPresent(layout, bridgeRootPath2) {
44046
- const norm = path40.resolve(bridgeRootPath2);
44047
- const existing = layout.launcherCwds.find((e) => path40.resolve(e.absolutePath) === norm);
43801
+ const norm = path38.resolve(bridgeRootPath2);
43802
+ const existing = layout.launcherCwds.find((e) => path38.resolve(e.absolutePath) === norm);
44048
43803
  return existing?.dirName;
44049
43804
  }
44050
43805
  function allocateDirNameForLauncherCwd(layout, bridgeRootPath2) {
44051
43806
  const existing = getLauncherDirNameIfPresent(layout, bridgeRootPath2);
44052
43807
  if (existing) return existing;
44053
- const norm = path40.resolve(bridgeRootPath2);
43808
+ const norm = path38.resolve(bridgeRootPath2);
44054
43809
  const base = baseNameSafe(norm);
44055
43810
  const used = new Set(layout.launcherCwds.map((e) => e.dirName));
44056
43811
  let name = base;
@@ -44143,8 +43898,8 @@ function pathspec(...paths) {
44143
43898
  cache.set(key, paths);
44144
43899
  return key;
44145
43900
  }
44146
- function isPathSpec(path88) {
44147
- return path88 instanceof String && cache.has(path88);
43901
+ function isPathSpec(path86) {
43902
+ return path86 instanceof String && cache.has(path86);
44148
43903
  }
44149
43904
  function toPaths(pathSpec) {
44150
43905
  return cache.get(pathSpec) || [];
@@ -44233,8 +43988,8 @@ function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
44233
43988
  function forEachLineWithContent(input, callback) {
44234
43989
  return toLinesWithContent(input, true).map((line) => callback(line));
44235
43990
  }
44236
- function folderExists(path88) {
44237
- return (0, import_file_exists.exists)(path88, import_file_exists.FOLDER);
43991
+ function folderExists(path86) {
43992
+ return (0, import_file_exists.exists)(path86, import_file_exists.FOLDER);
44238
43993
  }
44239
43994
  function append(target, item) {
44240
43995
  if (Array.isArray(target)) {
@@ -44638,8 +44393,8 @@ function checkIsRepoRootTask() {
44638
44393
  commands,
44639
44394
  format: "utf-8",
44640
44395
  onError,
44641
- parser(path88) {
44642
- return /^\.(git)?$/.test(path88.trim());
44396
+ parser(path86) {
44397
+ return /^\.(git)?$/.test(path86.trim());
44643
44398
  }
44644
44399
  };
44645
44400
  }
@@ -45073,11 +44828,11 @@ function parseGrep(grep) {
45073
44828
  const paths = /* @__PURE__ */ new Set();
45074
44829
  const results = {};
45075
44830
  forEachLineWithContent(grep, (input) => {
45076
- const [path88, line, preview] = input.split(NULL);
45077
- paths.add(path88);
45078
- (results[path88] = results[path88] || []).push({
44831
+ const [path86, line, preview] = input.split(NULL);
44832
+ paths.add(path86);
44833
+ (results[path86] = results[path86] || []).push({
45079
44834
  line: asNumber(line),
45080
- path: path88,
44835
+ path: path86,
45081
44836
  preview
45082
44837
  });
45083
44838
  });
@@ -45842,14 +45597,14 @@ var init_hash_object = __esm2({
45842
45597
  init_task();
45843
45598
  }
45844
45599
  });
45845
- function parseInit(bare, path88, text) {
45600
+ function parseInit(bare, path86, text) {
45846
45601
  const response = String(text).trim();
45847
45602
  let result;
45848
45603
  if (result = initResponseRegex.exec(response)) {
45849
- return new InitSummary(bare, path88, false, result[1]);
45604
+ return new InitSummary(bare, path86, false, result[1]);
45850
45605
  }
45851
45606
  if (result = reInitResponseRegex.exec(response)) {
45852
- return new InitSummary(bare, path88, true, result[1]);
45607
+ return new InitSummary(bare, path86, true, result[1]);
45853
45608
  }
45854
45609
  let gitDir = "";
45855
45610
  const tokens = response.split(" ");
@@ -45860,7 +45615,7 @@ function parseInit(bare, path88, text) {
45860
45615
  break;
45861
45616
  }
45862
45617
  }
45863
- return new InitSummary(bare, path88, /^re/i.test(response), gitDir);
45618
+ return new InitSummary(bare, path86, /^re/i.test(response), gitDir);
45864
45619
  }
45865
45620
  var InitSummary;
45866
45621
  var initResponseRegex;
@@ -45869,9 +45624,9 @@ var init_InitSummary = __esm2({
45869
45624
  "src/lib/responses/InitSummary.ts"() {
45870
45625
  "use strict";
45871
45626
  InitSummary = class {
45872
- constructor(bare, path88, existing, gitDir) {
45627
+ constructor(bare, path86, existing, gitDir) {
45873
45628
  this.bare = bare;
45874
- this.path = path88;
45629
+ this.path = path86;
45875
45630
  this.existing = existing;
45876
45631
  this.gitDir = gitDir;
45877
45632
  }
@@ -45883,7 +45638,7 @@ var init_InitSummary = __esm2({
45883
45638
  function hasBareCommand(command) {
45884
45639
  return command.includes(bareCommand);
45885
45640
  }
45886
- function initTask(bare = false, path88, customArgs) {
45641
+ function initTask(bare = false, path86, customArgs) {
45887
45642
  const commands = ["init", ...customArgs];
45888
45643
  if (bare && !hasBareCommand(commands)) {
45889
45644
  commands.splice(1, 0, bareCommand);
@@ -45892,7 +45647,7 @@ function initTask(bare = false, path88, customArgs) {
45892
45647
  commands,
45893
45648
  format: "utf-8",
45894
45649
  parser(text) {
45895
- return parseInit(commands.includes("--bare"), path88, text);
45650
+ return parseInit(commands.includes("--bare"), path86, text);
45896
45651
  }
45897
45652
  };
45898
45653
  }
@@ -46708,12 +46463,12 @@ var init_FileStatusSummary = __esm2({
46708
46463
  "use strict";
46709
46464
  fromPathRegex = /^(.+)\0(.+)$/;
46710
46465
  FileStatusSummary = class {
46711
- constructor(path88, index, working_dir) {
46712
- this.path = path88;
46466
+ constructor(path86, index, working_dir) {
46467
+ this.path = path86;
46713
46468
  this.index = index;
46714
46469
  this.working_dir = working_dir;
46715
46470
  if (index === "R" || working_dir === "R") {
46716
- const detail = fromPathRegex.exec(path88) || [null, path88, path88];
46471
+ const detail = fromPathRegex.exec(path86) || [null, path86, path86];
46717
46472
  this.from = detail[2] || "";
46718
46473
  this.path = detail[1] || "";
46719
46474
  }
@@ -46744,14 +46499,14 @@ function splitLine(result, lineStr) {
46744
46499
  default:
46745
46500
  return;
46746
46501
  }
46747
- function data(index, workingDir, path88) {
46502
+ function data(index, workingDir, path86) {
46748
46503
  const raw = `${index}${workingDir}`;
46749
46504
  const handler = parsers6.get(raw);
46750
46505
  if (handler) {
46751
- handler(result, path88);
46506
+ handler(result, path86);
46752
46507
  }
46753
46508
  if (raw !== "##" && raw !== "!!") {
46754
- result.files.push(new FileStatusSummary(path88, index, workingDir));
46509
+ result.files.push(new FileStatusSummary(path86, index, workingDir));
46755
46510
  }
46756
46511
  }
46757
46512
  }
@@ -47060,9 +46815,9 @@ var init_simple_git_api = __esm2({
47060
46815
  next
47061
46816
  );
47062
46817
  }
47063
- hashObject(path88, write) {
46818
+ hashObject(path86, write) {
47064
46819
  return this._runTask(
47065
- hashObjectTask(path88, write === true),
46820
+ hashObjectTask(path86, write === true),
47066
46821
  trailingFunctionArgument(arguments)
47067
46822
  );
47068
46823
  }
@@ -47415,8 +47170,8 @@ var init_branch = __esm2({
47415
47170
  }
47416
47171
  });
47417
47172
  function toPath(input) {
47418
- const path88 = input.trim().replace(/^["']|["']$/g, "");
47419
- return path88 && normalize3(path88);
47173
+ const path86 = input.trim().replace(/^["']|["']$/g, "");
47174
+ return path86 && normalize3(path86);
47420
47175
  }
47421
47176
  var parseCheckIgnore;
47422
47177
  var init_CheckIgnore = __esm2({
@@ -47730,8 +47485,8 @@ __export2(sub_module_exports, {
47730
47485
  subModuleTask: () => subModuleTask,
47731
47486
  updateSubModuleTask: () => updateSubModuleTask
47732
47487
  });
47733
- function addSubModuleTask(repo, path88) {
47734
- return subModuleTask(["add", repo, path88]);
47488
+ function addSubModuleTask(repo, path86) {
47489
+ return subModuleTask(["add", repo, path86]);
47735
47490
  }
47736
47491
  function initSubModuleTask(customArgs) {
47737
47492
  return subModuleTask(["init", ...customArgs]);
@@ -48064,8 +47819,8 @@ var require_git = __commonJS2({
48064
47819
  }
48065
47820
  return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
48066
47821
  };
48067
- Git2.prototype.submoduleAdd = function(repo, path88, then) {
48068
- return this._runTask(addSubModuleTask2(repo, path88), trailingFunctionArgument2(arguments));
47822
+ Git2.prototype.submoduleAdd = function(repo, path86, then) {
47823
+ return this._runTask(addSubModuleTask2(repo, path86), trailingFunctionArgument2(arguments));
48069
47824
  };
48070
47825
  Git2.prototype.submoduleUpdate = function(args, then) {
48071
47826
  return this._runTask(
@@ -48804,8 +48559,8 @@ function parseNumstatEntries(lines) {
48804
48559
  }
48805
48560
  function parseNumstat(lines) {
48806
48561
  const m = /* @__PURE__ */ new Map();
48807
- for (const [path88, entry] of parseNumstatEntries(lines)) {
48808
- m.set(path88, { additions: entry.additions, deletions: entry.deletions });
48562
+ for (const [path86, entry] of parseNumstatEntries(lines)) {
48563
+ m.set(path86, { additions: entry.additions, deletions: entry.deletions });
48809
48564
  }
48810
48565
  return m;
48811
48566
  }
@@ -48934,7 +48689,7 @@ async function resolveDefaultRemoteBranchSha(g, remote) {
48934
48689
  }
48935
48690
 
48936
48691
  // ../bridge/src/git/commits/remote-tracking/resolve-base-sha-for-unpushed-commits.ts
48937
- import * as path41 from "node:path";
48692
+ import * as path39 from "node:path";
48938
48693
  var BASE_SHA_CACHE_TTL_MS = 3e4;
48939
48694
  var baseShaCache = /* @__PURE__ */ new Map();
48940
48695
  async function resolveBaseShaForUnpushedCommitsUncached(g) {
@@ -48945,7 +48700,7 @@ async function resolveBaseShaForUnpushedCommitsUncached(g) {
48945
48700
  }
48946
48701
  async function resolveBaseShaForUnpushedCommits(g, repoDir) {
48947
48702
  if (repoDir) {
48948
- const key = path41.resolve(repoDir);
48703
+ const key = path39.resolve(repoDir);
48949
48704
  const now = Date.now();
48950
48705
  const cached2 = baseShaCache.get(key);
48951
48706
  if (cached2 && cached2.expiresAt > now) return cached2.baseSha;
@@ -49080,17 +48835,17 @@ function formatRemoteDisplayLabel(remoteUrl) {
49080
48835
  }
49081
48836
 
49082
48837
  // ../bridge/src/git/changes/repo/get-working-tree-change-repo-details.ts
49083
- import * as path51 from "node:path";
48838
+ import * as path49 from "node:path";
49084
48839
 
49085
48840
  // ../bridge/src/git/changes/repo/build-working-tree-change-repo-detail.ts
49086
- import * as path50 from "node:path";
48841
+ import * as path48 from "node:path";
49087
48842
 
49088
48843
  // ../bridge/src/git/is-git-repo.ts
49089
- import * as fs27 from "node:fs";
49090
- import * as path42 from "node:path";
48844
+ import * as fs26 from "node:fs";
48845
+ import * as path40 from "node:path";
49091
48846
  async function isGitRepoDirectory(dirPath) {
49092
48847
  try {
49093
- await fs27.promises.access(path42.join(dirPath, ".git"));
48848
+ await fs26.promises.access(path40.join(dirPath, ".git"));
49094
48849
  return true;
49095
48850
  } catch {
49096
48851
  return false;
@@ -49098,8 +48853,8 @@ async function isGitRepoDirectory(dirPath) {
49098
48853
  }
49099
48854
 
49100
48855
  // ../bridge/src/git/changes/listing/apply-untracked-file-stats.ts
49101
- import * as fs28 from "node:fs";
49102
- import * as path43 from "node:path";
48856
+ import * as fs27 from "node:fs";
48857
+ import * as path41 from "node:path";
49103
48858
 
49104
48859
  // ../bridge/src/git/changes/lines/count-lines.ts
49105
48860
  import { createReadStream } from "node:fs";
@@ -49131,7 +48886,7 @@ function createUntrackedStatsApplier(options) {
49131
48886
  if (!options.untrackedSet.has(pathInRepo)) return;
49132
48887
  if (options.nameByPath.has(pathInRepo)) return;
49133
48888
  if (row.change === "moved") return;
49134
- const repoFilePath = path43.join(options.repoGitCwd, pathInRepo);
48889
+ const repoFilePath = path41.join(options.repoGitCwd, pathInRepo);
49135
48890
  const fromGit = await numstatFromGitNoIndex(options.g, pathInRepo);
49136
48891
  if (fromGit) {
49137
48892
  row.additions = fromGit.additions;
@@ -49139,7 +48894,7 @@ function createUntrackedStatsApplier(options) {
49139
48894
  return;
49140
48895
  }
49141
48896
  try {
49142
- const st = await fs28.promises.stat(repoFilePath);
48897
+ const st = await fs27.promises.stat(repoFilePath);
49143
48898
  row.additions = st.isFile() ? await countTextFileLines(repoFilePath) : 0;
49144
48899
  } catch {
49145
48900
  row.additions = 0;
@@ -49216,7 +48971,7 @@ async function buildChangedFileRowsFromPaths(options) {
49216
48971
  }
49217
48972
 
49218
48973
  // ../bridge/src/git/changes/listing/enrich-working-tree-file-rows.ts
49219
- import * as path45 from "node:path";
48974
+ import * as path43 from "node:path";
49220
48975
 
49221
48976
  // ../bridge/src/git/changes/patch/patch-truncate.ts
49222
48977
  function truncatePatch(s) {
@@ -49304,10 +49059,10 @@ async function readGitBlobLines(repoCwd, pathInRepo) {
49304
49059
  }
49305
49060
 
49306
49061
  // ../bridge/src/git/changes/patch/hydrate/read-worktree-file-lines.ts
49307
- import * as fs29 from "node:fs";
49062
+ import * as fs28 from "node:fs";
49308
49063
  async function readWorktreeFileLines(filePath) {
49309
49064
  try {
49310
- const raw = await fs29.promises.readFile(filePath, "utf8");
49065
+ const raw = await fs28.promises.readFile(filePath, "utf8");
49311
49066
  return raw.split(/\r?\n/);
49312
49067
  } catch {
49313
49068
  return null;
@@ -49445,8 +49200,8 @@ async function unifiedDiffForFileInRange(repoCwd, range, pathInRepo, change, mov
49445
49200
  }
49446
49201
 
49447
49202
  // ../bridge/src/git/changes/total-lines/resolve-changed-file-total-lines.ts
49448
- import * as fs30 from "node:fs";
49449
- import * as path44 from "node:path";
49203
+ import * as fs29 from "node:fs";
49204
+ import * as path42 from "node:path";
49450
49205
  var MAX_BYTES = 512e3;
49451
49206
  async function countLinesInGitRef(repoGitCwd, ref, pathInRepo) {
49452
49207
  const spec = `${ref}:${pathInRepo}`;
@@ -49466,13 +49221,13 @@ async function countLinesInGitRef(repoGitCwd, ref, pathInRepo) {
49466
49221
  }
49467
49222
  async function resolveWorkingTreeFileTotalLines(options) {
49468
49223
  if (options.isBinary) return null;
49469
- const filePath = path44.join(options.repoGitCwd, options.pathInRepo);
49224
+ const filePath = path42.join(options.repoGitCwd, options.pathInRepo);
49470
49225
  if (options.change === "removed") {
49471
49226
  return countLinesInGitRef(options.repoGitCwd, "HEAD", options.pathInRepo);
49472
49227
  }
49473
49228
  if (options.change === "moved" || options.change === "modified") {
49474
49229
  try {
49475
- const st = await fs30.promises.stat(filePath);
49230
+ const st = await fs29.promises.stat(filePath);
49476
49231
  if (!st.isFile()) return null;
49477
49232
  return await countTextFileLines(filePath);
49478
49233
  } catch {
@@ -49515,7 +49270,7 @@ async function enrichWorkingTreeFileRows(options) {
49515
49270
  row.workspaceRelPath,
49516
49271
  options.repoPathRelativeToWorkspaceRoot
49517
49272
  );
49518
- const filePath = path45.join(options.repoGitCwd, filePathRelativeToRepoRoot);
49273
+ const filePath = path43.join(options.repoGitCwd, filePathRelativeToRepoRoot);
49519
49274
  const hydrateKind = row.change === "moved" ? "modified" : row.change;
49520
49275
  let patch = await unifiedDiffForFile(
49521
49276
  options.repoGitCwd,
@@ -49673,7 +49428,7 @@ async function listChangedFilesForRepo(repoGitCwd, repoPathRelativeToWorkspaceRo
49673
49428
  }
49674
49429
 
49675
49430
  // ../bridge/src/git/changes/listing/list-changed-files-for-commit.ts
49676
- import * as path46 from "node:path";
49431
+ import * as path44 from "node:path";
49677
49432
 
49678
49433
  // ../bridge/src/git/changes/listing/enrich-commit-file-rows.ts
49679
49434
  async function enrichCommitFileRows(options) {
@@ -49718,7 +49473,7 @@ async function parentForCommitDiff(g, sha) {
49718
49473
  var COMMIT_FILES_CACHE_TTL_MS = 5 * 6e4;
49719
49474
  var commitFilesCache = /* @__PURE__ */ new Map();
49720
49475
  function commitFilesCacheKey(repoGitCwd, commitSha) {
49721
- return `${path46.resolve(repoGitCwd)}:${commitSha}`;
49476
+ return `${path44.resolve(repoGitCwd)}:${commitSha}`;
49722
49477
  }
49723
49478
  async function listChangedFilesForCommit(repoGitCwd, repoPathRelativeToWorkspaceRoot, commitSha, options = {}) {
49724
49479
  const cacheKey = commitFilesCacheKey(repoGitCwd, commitSha);
@@ -49773,7 +49528,7 @@ async function listChangedFilesForCommit(repoGitCwd, repoPathRelativeToWorkspace
49773
49528
  }
49774
49529
 
49775
49530
  // ../bridge/src/git/commits/list-unpushed-commits.ts
49776
- import * as path47 from "node:path";
49531
+ import * as path45 from "node:path";
49777
49532
 
49778
49533
  // ../bridge/src/git/commits/lib/parse-log-lines.ts
49779
49534
  function parseLogShaDateSubjectLines(raw) {
@@ -49808,7 +49563,7 @@ async function gitLogNotReachableFromBase(g, baseSha, headSha) {
49808
49563
  }
49809
49564
  }
49810
49565
  async function listUnpushedCommits(repoDir) {
49811
- const key = path47.resolve(repoDir);
49566
+ const key = path45.resolve(repoDir);
49812
49567
  const now = Date.now();
49813
49568
  const cached2 = unpushedCache.get(key);
49814
49569
  if (cached2 && cached2.expiresAt > now) return cached2.commits;
@@ -49869,7 +49624,7 @@ async function loadRecentAndUnpushedCommitsForRepoDetail(repoDir, recentCommitsL
49869
49624
  }
49870
49625
 
49871
49626
  // ../bridge/src/git/changes/repo/load-working-tree-change-repo-git-info.ts
49872
- import * as path48 from "node:path";
49627
+ import * as path46 from "node:path";
49873
49628
 
49874
49629
  // ../bridge/src/git/remote-origin-url.ts
49875
49630
  async function getRemoteOriginUrl(gitDir) {
@@ -49884,7 +49639,7 @@ async function getRemoteOriginUrl(gitDir) {
49884
49639
 
49885
49640
  // ../bridge/src/git/changes/repo/load-working-tree-change-repo-git-info.ts
49886
49641
  async function loadWorkingTreeChangeRepoGitInfo(checkoutPath) {
49887
- const resolvedCheckoutPath = path48.resolve(checkoutPath);
49642
+ const resolvedCheckoutPath = path46.resolve(checkoutPath);
49888
49643
  const git = cliSimpleGit(resolvedCheckoutPath);
49889
49644
  await yieldToEventLoop2();
49890
49645
  const [branch, remoteUrl] = await Promise.all([
@@ -49899,14 +49654,14 @@ async function loadWorkingTreeChangeRepoGitInfo(checkoutPath) {
49899
49654
  }
49900
49655
 
49901
49656
  // ../bridge/src/git/changes/repo/resolve-repo-path-relative-to-workspace-root.ts
49902
- import * as path49 from "node:path";
49657
+ import * as path47 from "node:path";
49903
49658
  async function resolveRepoPathRelativeToWorkspaceRoot(options) {
49904
- const checkoutPath = path49.resolve(options.checkoutPath);
49659
+ const checkoutPath = path47.resolve(options.checkoutPath);
49905
49660
  const git = cliSimpleGit(checkoutPath);
49906
- const sessionParentPath = options.sessionParentPath ? path49.resolve(options.sessionParentPath) : null;
49661
+ const sessionParentPath = options.sessionParentPath ? path47.resolve(options.sessionParentPath) : null;
49907
49662
  let repoPathRelativeToWorkspaceRoot;
49908
49663
  if (sessionParentPath) {
49909
- const checkoutPathRelativeToSessionParent = path49.relative(sessionParentPath, checkoutPath);
49664
+ const checkoutPathRelativeToSessionParent = path47.relative(sessionParentPath, checkoutPath);
49910
49665
  repoPathRelativeToWorkspaceRoot = checkoutPathRelativeToSessionParent === "" ? "." : checkoutPathRelativeToSessionParent.replace(/\\/g, "/");
49911
49666
  } else {
49912
49667
  let gitTopLevel = checkoutPath;
@@ -49916,8 +49671,8 @@ async function resolveRepoPathRelativeToWorkspaceRoot(options) {
49916
49671
  } catch {
49917
49672
  gitTopLevel = checkoutPath;
49918
49673
  }
49919
- const gitTopLevelRelativeToBridgeRoot = path49.relative(options.bridgeRoot, path49.resolve(gitTopLevel)).replace(/\\/g, "/") || ".";
49920
- repoPathRelativeToWorkspaceRoot = gitTopLevelRelativeToBridgeRoot.startsWith("..") ? path49.basename(path49.resolve(gitTopLevel)) : gitTopLevelRelativeToBridgeRoot;
49674
+ const gitTopLevelRelativeToBridgeRoot = path47.relative(options.bridgeRoot, path47.resolve(gitTopLevel)).replace(/\\/g, "/") || ".";
49675
+ repoPathRelativeToWorkspaceRoot = gitTopLevelRelativeToBridgeRoot.startsWith("..") ? path47.basename(path47.resolve(gitTopLevel)) : gitTopLevelRelativeToBridgeRoot;
49921
49676
  }
49922
49677
  return normalizeRepoPathRelativeToWorkspaceRoot(
49923
49678
  repoPathRelativeToWorkspaceRoot === "" ? "." : repoPathRelativeToWorkspaceRoot
@@ -49926,10 +49681,10 @@ async function resolveRepoPathRelativeToWorkspaceRoot(options) {
49926
49681
 
49927
49682
  // ../bridge/src/git/changes/repo/build-working-tree-change-repo-detail.ts
49928
49683
  async function buildWorkingTreeChangeRepoDetail(options) {
49929
- const checkoutPath = path50.resolve(options.targetPath);
49684
+ const checkoutPath = path48.resolve(options.targetPath);
49930
49685
  if (!await isGitRepoDirectory(checkoutPath)) return null;
49931
49686
  const isCommitView = options.basis.kind === "commit";
49932
- const sessionParentPath = options.sessionParentPath ? path50.resolve(options.sessionParentPath) : null;
49687
+ const sessionParentPath = options.sessionParentPath ? path48.resolve(options.sessionParentPath) : null;
49933
49688
  const git = cliSimpleGit(checkoutPath);
49934
49689
  const repoPathRelativeToWorkspaceRoot = await resolveRepoPathRelativeToWorkspaceRoot({
49935
49690
  checkoutPath,
@@ -49977,8 +49732,8 @@ async function buildWorkingTreeChangeRepoDetail(options) {
49977
49732
 
49978
49733
  // ../bridge/src/git/changes/repo/get-working-tree-change-repo-details.ts
49979
49734
  async function getWorkingTreeChangeRepoDetails(options) {
49980
- const bridgeRoot = path51.resolve(getBridgeRoot());
49981
- const sessionParentPath = options.sessionParentPath ? path51.resolve(options.sessionParentPath) : null;
49735
+ const bridgeRoot = path49.resolve(getBridgeRoot());
49736
+ const sessionParentPath = options.sessionParentPath ? path49.resolve(options.sessionParentPath) : null;
49982
49737
  const out = [];
49983
49738
  const filter = options.repoFilterRelPath != null ? normalizeRepoPathRelativeToWorkspaceRoot(options.repoFilterRelPath) : null;
49984
49739
  const basisInput = options.basis ?? { kind: "working" };
@@ -50009,9 +49764,9 @@ async function getWorkingTreeChangeRepoDetails(options) {
50009
49764
  }
50010
49765
 
50011
49766
  // ../bridge/src/git/changes/repo/get-working-tree-change-file-patch.ts
50012
- import * as path52 from "node:path";
49767
+ import * as path50 from "node:path";
50013
49768
  async function getWorkingTreeChangeFilePatch(options) {
50014
- const repoGitCwd = path52.resolve(options.repoGitCwd);
49769
+ const repoGitCwd = path50.resolve(options.repoGitCwd);
50015
49770
  if (!await isGitRepoDirectory(repoGitCwd)) {
50016
49771
  throw new Error("Not a git repository");
50017
49772
  }
@@ -50050,7 +49805,7 @@ async function getWorkingTreeChangeFilePatch(options) {
50050
49805
  });
50051
49806
  return { patchContent: patchContent2, totalLines: totalLines2 };
50052
49807
  }
50053
- const filePath = path52.join(repoGitCwd, filePathRelativeToRepoRoot);
49808
+ const filePath = path50.join(repoGitCwd, filePathRelativeToRepoRoot);
50054
49809
  const hydrateKind = options.change === "moved" ? "modified" : options.change;
50055
49810
  let patchContent = await unifiedDiffForFile(
50056
49811
  repoGitCwd,
@@ -50096,18 +49851,18 @@ function parseWorkingTreeChangeKind(value) {
50096
49851
  }
50097
49852
 
50098
49853
  // ../bridge/src/worktrees/manager/git/get-session-working-tree-change-file-patch.ts
50099
- import * as path53 from "node:path";
49854
+ import * as path51 from "node:path";
50100
49855
  async function getSessionWorkingTreeChangeFilePatch(cache2, sessionId, discover, opts) {
50101
49856
  const targets = await resolveCommitTargetsAsync(sessionId, cache2, discover);
50102
- const bridgeRoot = path53.resolve(getBridgeRoot());
50103
- const sessionParentPath = cache2.getSessionParentPath(sessionId) ? path53.resolve(cache2.getSessionParentPath(sessionId)) : null;
49857
+ const bridgeRoot = path51.resolve(getBridgeRoot());
49858
+ const sessionParentPath = cache2.getSessionParentPath(sessionId) ? path51.resolve(cache2.getSessionParentPath(sessionId)) : null;
50104
49859
  const repoPathRelativeToWorkspaceRootFilter = normalizeRepoPathRelativeToWorkspaceRoot(
50105
49860
  opts.repoRelPath.trim()
50106
49861
  );
50107
49862
  let result = null;
50108
49863
  await forEachWithGitYield(targets, async (targetPath) => {
50109
49864
  if (result) return;
50110
- const checkoutPath = path53.resolve(targetPath);
49865
+ const checkoutPath = path51.resolve(targetPath);
50111
49866
  if (!await isGitRepoDirectory(checkoutPath)) return;
50112
49867
  const repoPathRelativeToWorkspaceRoot = await resolveRepoPathRelativeToWorkspaceRoot({
50113
49868
  checkoutPath,
@@ -50140,13 +49895,13 @@ async function pushSessionUpstream(cache2, sessionId, discover) {
50140
49895
  }
50141
49896
 
50142
49897
  // ../bridge/src/worktrees/remove-session-worktrees.ts
50143
- import * as fs33 from "node:fs";
49898
+ import * as fs32 from "node:fs";
50144
49899
 
50145
49900
  // ../bridge/src/git/worktrees/worktree-remove.ts
50146
- import * as fs32 from "node:fs";
49901
+ import * as fs31 from "node:fs";
50147
49902
 
50148
49903
  // ../bridge/src/worktrees/is-removable-session-worktree-checkout-path.ts
50149
- import path54 from "node:path";
49904
+ import path52 from "node:path";
50150
49905
  init_normalize_resolved_path();
50151
49906
  function isBridgeRootCheckoutPath(checkoutPath) {
50152
49907
  return normalizeResolvedPath(checkoutPath) === normalizeResolvedPath(getBridgeRoot());
@@ -50155,23 +49910,23 @@ function isRemovableSessionWorktreeCheckoutPath(checkoutPath, worktreesRootPath)
50155
49910
  if (isBridgeRootCheckoutPath(checkoutPath)) return false;
50156
49911
  const normalized = normalizeResolvedPath(checkoutPath);
50157
49912
  const worktreesRoot = normalizeResolvedPath(worktreesRootPath);
50158
- const rel = path54.relative(worktreesRoot, normalized);
50159
- if (rel === "" || rel.startsWith("..") || path54.isAbsolute(rel)) return false;
49913
+ const rel = path52.relative(worktreesRoot, normalized);
49914
+ if (rel === "" || rel.startsWith("..") || path52.isAbsolute(rel)) return false;
50160
49915
  return true;
50161
49916
  }
50162
49917
 
50163
49918
  // ../bridge/src/git/worktrees/resolve-main-repo-from-git-file.ts
50164
- import * as fs31 from "node:fs";
50165
- import * as path55 from "node:path";
49919
+ import * as fs30 from "node:fs";
49920
+ import * as path53 from "node:path";
50166
49921
  function resolveMainRepoFromWorktreeGitFile(wt) {
50167
- const gitDirFile = path55.join(wt, ".git");
50168
- if (!fs31.existsSync(gitDirFile) || !fs31.statSync(gitDirFile).isFile()) return "";
50169
- const first2 = fs31.readFileSync(gitDirFile, "utf8").trim();
49922
+ const gitDirFile = path53.join(wt, ".git");
49923
+ if (!fs30.existsSync(gitDirFile) || !fs30.statSync(gitDirFile).isFile()) return "";
49924
+ const first2 = fs30.readFileSync(gitDirFile, "utf8").trim();
50170
49925
  const m = first2.match(/^gitdir:\s*(.+)$/im);
50171
49926
  if (!m) return "";
50172
- const gitWorktreePath = path55.resolve(wt, m[1].trim());
50173
- const gitDir = path55.dirname(path55.dirname(gitWorktreePath));
50174
- return path55.dirname(gitDir);
49927
+ const gitWorktreePath = path53.resolve(wt, m[1].trim());
49928
+ const gitDir = path53.dirname(path53.dirname(gitWorktreePath));
49929
+ return path53.dirname(gitDir);
50175
49930
  }
50176
49931
 
50177
49932
  // ../bridge/src/git/worktrees/worktree-remove.ts
@@ -50182,7 +49937,7 @@ async function gitWorktreeRemoveForce(worktreePath) {
50182
49937
  return true;
50183
49938
  }
50184
49939
  if (isBridgeRootCheckoutPath(worktreePath)) return false;
50185
- fs32.rmSync(worktreePath, { recursive: true, force: true });
49940
+ fs31.rmSync(worktreePath, { recursive: true, force: true });
50186
49941
  return true;
50187
49942
  }
50188
49943
 
@@ -50204,7 +49959,7 @@ async function removeSessionWorktrees(paths, worktreesRootPath, log2) {
50204
49959
  log2(`[worktrees] Remove failed for ${wt}: ${e instanceof Error ? e.message : String(e)}`);
50205
49960
  if (isRemovableSessionWorktreeCheckoutPath(wt, worktreesRootPath)) {
50206
49961
  try {
50207
- fs33.rmSync(wt, { recursive: true, force: true });
49962
+ fs32.rmSync(wt, { recursive: true, force: true });
50208
49963
  } catch {
50209
49964
  }
50210
49965
  }
@@ -50260,12 +50015,12 @@ async function renameSessionWorktreeBranch(cache2, sessionId, newBranch, log2) {
50260
50015
  // ../bridge/src/worktrees/discovery/discover-session-worktree-on-disk.ts
50261
50016
  init_cli_process_interrupt();
50262
50017
  init_yield_to_event_loop();
50263
- import * as fs37 from "node:fs";
50264
- import * as path60 from "node:path";
50018
+ import * as fs36 from "node:fs";
50019
+ import * as path58 from "node:path";
50265
50020
 
50266
50021
  // ../bridge/src/worktrees/discovery/collect-worktree-paths.ts
50267
- import * as fs35 from "node:fs";
50268
- import * as path57 from "node:path";
50022
+ import * as fs34 from "node:fs";
50023
+ import * as path55 from "node:path";
50269
50024
 
50270
50025
  // ../bridge/src/worktrees/discovery/disk-walk-constants.ts
50271
50026
  var DISK_WALK_YIELD_EVERY = 64;
@@ -50295,8 +50050,8 @@ function shouldSkipDiskWalkEntry(name) {
50295
50050
  // ../bridge/src/worktrees/discovery/disk-walk-utils.ts
50296
50051
  init_cli_process_interrupt();
50297
50052
  init_yield_to_event_loop();
50298
- import * as fs34 from "node:fs";
50299
- import * as path56 from "node:path";
50053
+ import * as fs33 from "node:fs";
50054
+ import * as path54 from "node:path";
50300
50055
  async function yieldDuringDiskWalk(state) {
50301
50056
  state.entries++;
50302
50057
  if (state.entries % DISK_WALK_YIELD_EVERY !== 0) return true;
@@ -50306,7 +50061,7 @@ async function yieldDuringDiskWalk(state) {
50306
50061
  }
50307
50062
  async function isGitDir(dirPath) {
50308
50063
  try {
50309
- await fs34.promises.access(path56.join(dirPath, ".git"));
50064
+ await fs33.promises.access(path54.join(dirPath, ".git"));
50310
50065
  return true;
50311
50066
  } catch {
50312
50067
  return false;
@@ -50320,23 +50075,23 @@ async function collectGitRepoRootsUnderDirectory(rootPath) {
50320
50075
  const walk = async (dir) => {
50321
50076
  if (!await yieldDuringDiskWalk(state)) return;
50322
50077
  if (await isGitDir(dir)) {
50323
- out.push(path57.resolve(dir));
50078
+ out.push(path55.resolve(dir));
50324
50079
  return;
50325
50080
  }
50326
50081
  let entries;
50327
50082
  try {
50328
- entries = await fs35.promises.readdir(dir, { withFileTypes: true });
50083
+ entries = await fs34.promises.readdir(dir, { withFileTypes: true });
50329
50084
  } catch {
50330
50085
  return;
50331
50086
  }
50332
50087
  for (const e of entries) {
50333
50088
  if (shouldSkipDiskWalkEntry(e.name)) continue;
50334
- const full = path57.join(dir, e.name);
50089
+ const full = path55.join(dir, e.name);
50335
50090
  if (!e.isDirectory()) continue;
50336
50091
  await walk(full);
50337
50092
  }
50338
50093
  };
50339
- await walk(path57.resolve(rootPath));
50094
+ await walk(path55.resolve(rootPath));
50340
50095
  return { paths: [...new Set(out)], entriesVisited: state.entries };
50341
50096
  }
50342
50097
  async function collectWorktreeRootsNamed(root, sessionId, maxDepth = LEGACY_WALK_MAX_DEPTH) {
@@ -50347,16 +50102,16 @@ async function collectWorktreeRootsNamed(root, sessionId, maxDepth = LEGACY_WALK
50347
50102
  if (!await yieldDuringDiskWalk(state)) return;
50348
50103
  let entries;
50349
50104
  try {
50350
- entries = await fs35.promises.readdir(dir, { withFileTypes: true });
50105
+ entries = await fs34.promises.readdir(dir, { withFileTypes: true });
50351
50106
  } catch {
50352
50107
  return;
50353
50108
  }
50354
50109
  for (const e of entries) {
50355
50110
  if (shouldSkipDiskWalkEntry(e.name)) continue;
50356
- const full = path57.join(dir, e.name);
50111
+ const full = path55.join(dir, e.name);
50357
50112
  if (!e.isDirectory()) continue;
50358
50113
  if (e.name === sessionId) {
50359
- if (await isGitDir(full)) out.push(path57.resolve(full));
50114
+ if (await isGitDir(full)) out.push(path55.resolve(full));
50360
50115
  continue;
50361
50116
  }
50362
50117
  if (await isGitDir(full)) continue;
@@ -50368,14 +50123,14 @@ async function collectWorktreeRootsNamed(root, sessionId, maxDepth = LEGACY_WALK
50368
50123
  }
50369
50124
 
50370
50125
  // ../bridge/src/worktrees/discovery/layout-keys-for-bridge-root.ts
50371
- import * as path58 from "node:path";
50126
+ import * as path56 from "node:path";
50372
50127
  function layoutKeysForBridgeRoot(layout, bridgeRoot, keysOnDisk) {
50373
- const bridge = path58.resolve(bridgeRoot);
50128
+ const bridge = path56.resolve(bridgeRoot);
50374
50129
  const preferred = getLauncherDirNameIfPresent(layout, bridgeRoot);
50375
50130
  const relevant = layout.launcherCwds.filter((e) => {
50376
- const entry = path58.resolve(e.absolutePath);
50377
- return bridge === entry || bridge.startsWith(entry + path58.sep) || entry.startsWith(bridge + path58.sep);
50378
- }).sort((a, b) => path58.resolve(b.absolutePath).length - path58.resolve(a.absolutePath).length).map((e) => e.dirName).filter((name) => keysOnDisk.includes(name));
50131
+ const entry = path56.resolve(e.absolutePath);
50132
+ return bridge === entry || bridge.startsWith(entry + path56.sep) || entry.startsWith(bridge + path56.sep);
50133
+ }).sort((a, b) => path56.resolve(b.absolutePath).length - path56.resolve(a.absolutePath).length).map((e) => e.dirName).filter((name) => keysOnDisk.includes(name));
50379
50134
  const ordered = [];
50380
50135
  const seen = /* @__PURE__ */ new Set();
50381
50136
  const add = (k) => {
@@ -50393,19 +50148,19 @@ function layoutKeysForBridgeRoot(layout, bridgeRoot, keysOnDisk) {
50393
50148
  }
50394
50149
 
50395
50150
  // ../bridge/src/worktrees/discovery/try-binding-from-isolated-directory.ts
50396
- import * as fs36 from "node:fs";
50397
- import * as path59 from "node:path";
50151
+ import * as fs35 from "node:fs";
50152
+ import * as path57 from "node:path";
50398
50153
  async function tryBindingFromIsolatedDirectory(scopeDir) {
50399
50154
  let st;
50400
50155
  try {
50401
- st = await fs36.promises.stat(scopeDir);
50156
+ st = await fs35.promises.stat(scopeDir);
50402
50157
  } catch {
50403
50158
  return null;
50404
50159
  }
50405
50160
  if (!st.isDirectory()) return null;
50406
50161
  const { paths: worktreePaths } = await collectGitRepoRootsUnderDirectory(scopeDir);
50407
50162
  if (worktreePaths.length === 0) return null;
50408
- const abs = path59.resolve(scopeDir);
50163
+ const abs = path57.resolve(scopeDir);
50409
50164
  return {
50410
50165
  parentPath: abs,
50411
50166
  repoCheckoutPaths: worktreePaths
@@ -50428,7 +50183,7 @@ async function discoverSessionWorktreeOnDisk(options) {
50428
50183
  const sid = sessionId.trim();
50429
50184
  if (!sid) return null;
50430
50185
  try {
50431
- await fs37.promises.access(worktreesRootPath);
50186
+ await fs36.promises.access(worktreesRootPath);
50432
50187
  } catch {
50433
50188
  return null;
50434
50189
  }
@@ -50437,13 +50192,13 @@ async function discoverSessionWorktreeOnDisk(options) {
50437
50192
  if (preferredKey) keysOnDisk.push(preferredKey);
50438
50193
  const scanState = { entries: 0 };
50439
50194
  try {
50440
- for (const name of await fs37.promises.readdir(worktreesRootPath)) {
50195
+ for (const name of await fs36.promises.readdir(worktreesRootPath)) {
50441
50196
  if (!await yieldDuringDiskWalk(scanState)) break;
50442
50197
  if (name.startsWith(".")) continue;
50443
- const p = path60.join(worktreesRootPath, name);
50198
+ const p = path58.join(worktreesRootPath, name);
50444
50199
  let st;
50445
50200
  try {
50446
- st = await fs37.promises.stat(p);
50201
+ st = await fs36.promises.stat(p);
50447
50202
  } catch {
50448
50203
  continue;
50449
50204
  }
@@ -50457,23 +50212,23 @@ async function discoverSessionWorktreeOnDisk(options) {
50457
50212
  for (const key of keys) {
50458
50213
  if (isCliImmediateShutdownRequested()) return null;
50459
50214
  await yieldToEventLoop();
50460
- const layoutRoot = path60.join(worktreesRootPath, key);
50215
+ const layoutRoot = path58.join(worktreesRootPath, key);
50461
50216
  let layoutSt;
50462
50217
  try {
50463
- layoutSt = await fs37.promises.stat(layoutRoot);
50218
+ layoutSt = await fs36.promises.stat(layoutRoot);
50464
50219
  } catch {
50465
50220
  continue;
50466
50221
  }
50467
50222
  if (!layoutSt.isDirectory()) continue;
50468
- const sessionDir = path60.join(layoutRoot, sid);
50223
+ const sessionDir = path58.join(layoutRoot, sid);
50469
50224
  const nested = await tryBindingFromSessionDirectory(sessionDir);
50470
50225
  if (nested) return nested;
50471
50226
  const legacy = await collectWorktreeRootsNamed(layoutRoot, sid);
50472
50227
  if (legacy.paths.length > 0) {
50473
- const isolated = resolveIsolatedSessionParentPathFromCheckouts(legacy.paths) ?? path60.resolve(legacy.paths[0]);
50228
+ const isolated = resolveIsolatedSessionParentPathFromCheckouts(legacy.paths) ?? path58.resolve(legacy.paths[0]);
50474
50229
  return {
50475
- sessionParentPath: path60.resolve(isolated),
50476
- repoCheckoutPaths: legacy.paths.map((p) => path60.resolve(p))
50230
+ sessionParentPath: path58.resolve(isolated),
50231
+ repoCheckoutPaths: legacy.paths.map((p) => path58.resolve(p))
50477
50232
  };
50478
50233
  }
50479
50234
  }
@@ -50481,31 +50236,31 @@ async function discoverSessionWorktreeOnDisk(options) {
50481
50236
  }
50482
50237
 
50483
50238
  // ../bridge/src/worktrees/discovery/discover-session-worktrees-under-session-worktree-root.ts
50484
- import * as fs38 from "node:fs";
50485
- import * as path62 from "node:path";
50239
+ import * as fs37 from "node:fs";
50240
+ import * as path60 from "node:path";
50486
50241
 
50487
50242
  // ../bridge/src/worktrees/discovery/discover-legacy-binding-ascending-from-checkout.ts
50488
50243
  init_cli_process_interrupt();
50489
50244
  init_yield_to_event_loop();
50490
- import * as path61 from "node:path";
50245
+ import * as path59 from "node:path";
50491
50246
  async function discoverLegacyBindingAscendingFromCheckout(sessionId, checkoutPath) {
50492
50247
  const sid = sessionId.trim();
50493
50248
  if (!sid) return null;
50494
- const hintR = path61.resolve(checkoutPath);
50249
+ const hintR = path59.resolve(checkoutPath);
50495
50250
  let best = null;
50496
- let cur = path61.dirname(hintR);
50251
+ let cur = path59.dirname(hintR);
50497
50252
  for (let i = 0; i < 40; i++) {
50498
50253
  if (isCliImmediateShutdownRequested()) return best;
50499
50254
  await yieldToEventLoop();
50500
50255
  const paths = await collectWorktreeRootsNamed(cur, sid);
50501
- if (paths.paths.some((p) => path61.resolve(p) === hintR)) {
50502
- const isolated = resolveIsolatedSessionParentPathFromCheckouts(paths.paths) ?? path61.resolve(paths.paths[0]);
50256
+ if (paths.paths.some((p) => path59.resolve(p) === hintR)) {
50257
+ const isolated = resolveIsolatedSessionParentPathFromCheckouts(paths.paths) ?? path59.resolve(paths.paths[0]);
50503
50258
  best = {
50504
- sessionParentPath: path61.resolve(isolated),
50505
- repoCheckoutPaths: paths.paths.map((p) => path61.resolve(p))
50259
+ sessionParentPath: path59.resolve(isolated),
50260
+ repoCheckoutPaths: paths.paths.map((p) => path59.resolve(p))
50506
50261
  };
50507
50262
  }
50508
- const next = path61.dirname(cur);
50263
+ const next = path59.dirname(cur);
50509
50264
  if (next === cur) break;
50510
50265
  cur = next;
50511
50266
  }
@@ -50516,12 +50271,12 @@ async function discoverLegacyBindingAscendingFromCheckout(sessionId, checkoutPat
50516
50271
  async function discoverSessionWorktreesUnderSessionWorktreeRoot(sessionParentPathOrHint, sessionId) {
50517
50272
  const sid = sessionId.trim();
50518
50273
  if (!sid) return null;
50519
- const hint = path62.resolve(sessionParentPathOrHint);
50520
- const underHint = await tryBindingFromSessionDirectory(path62.join(hint, sid));
50274
+ const hint = path60.resolve(sessionParentPathOrHint);
50275
+ const underHint = await tryBindingFromSessionDirectory(path60.join(hint, sid));
50521
50276
  if (underHint) return underHint;
50522
50277
  const direct = await tryBindingFromSessionDirectory(hint);
50523
50278
  if (direct) {
50524
- if (path62.basename(hint) === sid && await isGitDir(hint)) {
50279
+ if (path60.basename(hint) === sid && await isGitDir(hint)) {
50525
50280
  const legacyFromCheckout = await discoverLegacyBindingAscendingFromCheckout(sid, hint);
50526
50281
  if (legacyFromCheckout && legacyFromCheckout.repoCheckoutPaths.length > direct.repoCheckoutPaths.length) {
50527
50282
  return legacyFromCheckout;
@@ -50529,23 +50284,23 @@ async function discoverSessionWorktreesUnderSessionWorktreeRoot(sessionParentPat
50529
50284
  }
50530
50285
  return direct;
50531
50286
  }
50532
- if (path62.basename(hint) === sid && await isGitDir(hint)) {
50287
+ if (path60.basename(hint) === sid && await isGitDir(hint)) {
50533
50288
  const legacyFromCheckout = await discoverLegacyBindingAscendingFromCheckout(sid, hint);
50534
50289
  if (legacyFromCheckout) return legacyFromCheckout;
50535
50290
  }
50536
50291
  let st;
50537
50292
  try {
50538
- st = await fs38.promises.stat(hint);
50293
+ st = await fs37.promises.stat(hint);
50539
50294
  } catch {
50540
50295
  return null;
50541
50296
  }
50542
50297
  if (!st.isDirectory()) return null;
50543
50298
  const legacyPaths = await collectWorktreeRootsNamed(hint, sid);
50544
50299
  if (legacyPaths.paths.length === 0) return null;
50545
- const isolated = resolveIsolatedSessionParentPathFromCheckouts(legacyPaths.paths) ?? path62.resolve(legacyPaths.paths[0]);
50300
+ const isolated = resolveIsolatedSessionParentPathFromCheckouts(legacyPaths.paths) ?? path60.resolve(legacyPaths.paths[0]);
50546
50301
  return {
50547
- sessionParentPath: path62.resolve(isolated),
50548
- repoCheckoutPaths: legacyPaths.paths.map((p) => path62.resolve(p))
50302
+ sessionParentPath: path60.resolve(isolated),
50303
+ repoCheckoutPaths: legacyPaths.paths.map((p) => path60.resolve(p))
50549
50304
  };
50550
50305
  }
50551
50306
 
@@ -50606,11 +50361,11 @@ function parseSessionParent(v) {
50606
50361
  }
50607
50362
 
50608
50363
  // ../bridge/src/worktrees/prepare/prepare-new-isolated-worktrees.ts
50609
- import * as fs42 from "node:fs";
50364
+ import * as fs41 from "node:fs";
50610
50365
 
50611
50366
  // ../bridge/src/git/discover-repos.ts
50612
- import * as fs39 from "node:fs";
50613
- import * as path63 from "node:path";
50367
+ import * as fs38 from "node:fs";
50368
+ import * as path61 from "node:path";
50614
50369
  init_yield_to_event_loop();
50615
50370
  var GIT_DISCOVER_YIELD_EVERY = 32;
50616
50371
  async function yieldGitDiscoverWork(entryCount) {
@@ -50620,14 +50375,14 @@ async function yieldGitDiscoverWork(entryCount) {
50620
50375
  }
50621
50376
  async function discoverGitRepos(cwd = getBridgeRoot()) {
50622
50377
  const result = [];
50623
- const cwdResolved = path63.resolve(cwd);
50378
+ const cwdResolved = path61.resolve(cwd);
50624
50379
  if (await isGitRepoDirectory(cwdResolved)) {
50625
50380
  const remoteUrl = await getRemoteOriginUrl(cwdResolved);
50626
50381
  result.push({ absolutePath: cwdResolved, remoteUrl });
50627
50382
  }
50628
50383
  let entries;
50629
50384
  try {
50630
- entries = fs39.readdirSync(cwdResolved, { withFileTypes: true });
50385
+ entries = fs38.readdirSync(cwdResolved, { withFileTypes: true });
50631
50386
  } catch {
50632
50387
  return result;
50633
50388
  }
@@ -50635,7 +50390,7 @@ async function discoverGitRepos(cwd = getBridgeRoot()) {
50635
50390
  await yieldGitDiscoverWork(i + 1);
50636
50391
  const ent = entries[i];
50637
50392
  if (!ent.isDirectory()) continue;
50638
- const childPath2 = path63.join(cwdResolved, ent.name);
50393
+ const childPath2 = path61.join(cwdResolved, ent.name);
50639
50394
  if (await isGitRepoDirectory(childPath2)) {
50640
50395
  const remoteUrl = await getRemoteOriginUrl(childPath2);
50641
50396
  result.push({ absolutePath: childPath2, remoteUrl });
@@ -50644,17 +50399,17 @@ async function discoverGitRepos(cwd = getBridgeRoot()) {
50644
50399
  return result;
50645
50400
  }
50646
50401
  async function discoverGitReposUnderRoot(rootPath) {
50647
- const root = path63.resolve(rootPath);
50402
+ const root = path61.resolve(rootPath);
50648
50403
  const roots = [];
50649
50404
  let walkEntries = 0;
50650
50405
  async function walk(dir) {
50651
50406
  if (await isGitRepoDirectory(dir)) {
50652
- roots.push(path63.resolve(dir));
50407
+ roots.push(path61.resolve(dir));
50653
50408
  return;
50654
50409
  }
50655
50410
  let entries;
50656
50411
  try {
50657
- entries = fs39.readdirSync(dir, { withFileTypes: true });
50412
+ entries = fs38.readdirSync(dir, { withFileTypes: true });
50658
50413
  } catch {
50659
50414
  return;
50660
50415
  }
@@ -50662,7 +50417,7 @@ async function discoverGitReposUnderRoot(rootPath) {
50662
50417
  await yieldGitDiscoverWork(++walkEntries);
50663
50418
  const ent = entries[i];
50664
50419
  if (!ent.isDirectory() || ent.name === ".git") continue;
50665
- await walk(path63.join(dir, ent.name));
50420
+ await walk(path61.join(dir, ent.name));
50666
50421
  }
50667
50422
  }
50668
50423
  await walk(root);
@@ -50678,8 +50433,8 @@ async function discoverGitReposUnderRoot(rootPath) {
50678
50433
  }
50679
50434
 
50680
50435
  // ../bridge/src/worktrees/prepare/add-isolated-repo-worktree.ts
50681
- import * as fs41 from "node:fs";
50682
- import * as path65 from "node:path";
50436
+ import * as fs40 from "node:fs";
50437
+ import * as path63 from "node:path";
50683
50438
 
50684
50439
  // ../bridge/src/git/worktrees/worktree-add.ts
50685
50440
  async function gitWorktreeAddBranch(mainRepoPath, worktreePath, branch, baseRef = "HEAD") {
@@ -50695,8 +50450,8 @@ async function gitWorktreeAddExistingBranch(mainRepoPath, worktreePath, branch)
50695
50450
  }
50696
50451
 
50697
50452
  // ../bridge/src/worktrees/prepare/copy-bridge-files-along-worktree-path.ts
50698
- import * as fs40 from "node:fs";
50699
- import * as path64 from "node:path";
50453
+ import * as fs39 from "node:fs";
50454
+ import * as path62 from "node:path";
50700
50455
  var BRIDGE_FILES_ALONG_WORKTREE_PATH = ["AGENTS.md"];
50701
50456
  function copyBridgeFilesAlongWorktreePath(options) {
50702
50457
  const { bridgeRoot, scopeDir, repoPathRelativeToBridgeRoot, log: log2 } = options;
@@ -50705,19 +50460,19 @@ function copyBridgeFilesAlongWorktreePath(options) {
50705
50460
  const segments = repoPathRelativeToBridgeRoot.split("/").filter(Boolean);
50706
50461
  for (let i = 0; i < segments.length; i++) {
50707
50462
  const prefix = segments.slice(0, i).join("/");
50708
- const bridgeDir = prefix ? path64.join(bridgeRoot, prefix) : bridgeRoot;
50709
- const destDir = prefix ? path64.join(scopeDir, prefix) : scopeDir;
50463
+ const bridgeDir = prefix ? path62.join(bridgeRoot, prefix) : bridgeRoot;
50464
+ const destDir = prefix ? path62.join(scopeDir, prefix) : scopeDir;
50710
50465
  for (const fileName of fileNames) {
50711
50466
  copyFileIfPresent(bridgeDir, destDir, fileName, log2);
50712
50467
  }
50713
50468
  }
50714
50469
  }
50715
50470
  function copyFileIfPresent(srcDir, destDir, fileName, log2) {
50716
- const src = path64.join(srcDir, fileName);
50717
- if (!fs40.existsSync(src)) return;
50718
- const dest = path64.join(destDir, fileName);
50471
+ const src = path62.join(srcDir, fileName);
50472
+ if (!fs39.existsSync(src)) return;
50473
+ const dest = path62.join(destDir, fileName);
50719
50474
  try {
50720
- fs40.copyFileSync(src, dest);
50475
+ fs39.copyFileSync(src, dest);
50721
50476
  log2?.(`[worktrees] Copied ${fileName} to ${dest}`);
50722
50477
  } catch (e) {
50723
50478
  log2?.(
@@ -50749,16 +50504,16 @@ async function addIsolatedRepoWorktree(options) {
50749
50504
  worktreeBaseBranches,
50750
50505
  log: log2
50751
50506
  } = options;
50752
- const repoPathRelativeToBridgeRootRaw = path65.relative(bridgeResolved, repoAbsolutePath);
50753
- if (repoPathRelativeToBridgeRootRaw.startsWith("..") || path65.isAbsolute(repoPathRelativeToBridgeRootRaw)) {
50507
+ const repoPathRelativeToBridgeRootRaw = path63.relative(bridgeResolved, repoAbsolutePath);
50508
+ if (repoPathRelativeToBridgeRootRaw.startsWith("..") || path63.isAbsolute(repoPathRelativeToBridgeRootRaw)) {
50754
50509
  return null;
50755
50510
  }
50756
50511
  const repoPathRelativeToBridgeRoot = normalizeRepoPathRelativeToWorkspaceRoot(
50757
50512
  repoPathRelativeToBridgeRootRaw === "" ? "." : repoPathRelativeToBridgeRootRaw
50758
50513
  );
50759
- const worktreePath = repoPathRelativeToBridgeRoot === "." ? scopeDir : path65.join(scopeDir, repoPathRelativeToBridgeRoot);
50514
+ const worktreePath = repoPathRelativeToBridgeRoot === "." ? scopeDir : path63.join(scopeDir, repoPathRelativeToBridgeRoot);
50760
50515
  if (repoPathRelativeToBridgeRoot !== ".") {
50761
- fs41.mkdirSync(path65.dirname(worktreePath), { recursive: true });
50516
+ fs40.mkdirSync(path63.dirname(worktreePath), { recursive: true });
50762
50517
  copyBridgeFilesAlongWorktreePath({
50763
50518
  bridgeRoot: bridgeResolved,
50764
50519
  scopeDir,
@@ -50786,7 +50541,7 @@ async function addIsolatedRepoWorktree(options) {
50786
50541
  }
50787
50542
 
50788
50543
  // ../bridge/src/worktrees/prepare/resolve-isolated-scope-dir.ts
50789
- import * as path66 from "node:path";
50544
+ import * as path64 from "node:path";
50790
50545
 
50791
50546
  // ../bridge/src/worktrees/worktree-layout-kind.ts
50792
50547
  function sanitizeWorktreeBranchSegment(value) {
@@ -50816,10 +50571,10 @@ function previewDeployBranchName(environmentId) {
50816
50571
 
50817
50572
  // ../bridge/src/worktrees/prepare/resolve-isolated-scope-dir.ts
50818
50573
  function resolveIsolatedScopeDir(options) {
50819
- const bridgeResolved = path66.resolve(options.bridgeRoot);
50574
+ const bridgeResolved = path64.resolve(options.bridgeRoot);
50820
50575
  const cwdKey = allocateDirNameForLauncherCwd(options.layout, bridgeResolved);
50821
- const bridgeKeyDir = path66.join(options.worktreesRootPath, cwdKey);
50822
- const scopeDir = path66.join(bridgeKeyDir, ...layoutDirSegments(options.kind, options.scopeId));
50576
+ const bridgeKeyDir = path64.join(options.worktreesRootPath, cwdKey);
50577
+ const scopeDir = path64.join(bridgeKeyDir, ...layoutDirSegments(options.kind, options.scopeId));
50823
50578
  return { bridgeResolved, scopeDir };
50824
50579
  }
50825
50580
 
@@ -50849,7 +50604,7 @@ async function prepareNewIsolatedWorktrees(options) {
50849
50604
  return null;
50850
50605
  }
50851
50606
  const worktreePaths = [];
50852
- fs42.mkdirSync(scopeDir, { recursive: true });
50607
+ fs41.mkdirSync(scopeDir, { recursive: true });
50853
50608
  await forEachWithGitYield(repos, async (repo) => {
50854
50609
  const worktreePath = await addIsolatedRepoWorktree({
50855
50610
  kind,
@@ -50921,10 +50676,10 @@ async function resolveExistingSessionParentPath(sessionId, cache2, discover) {
50921
50676
  }
50922
50677
 
50923
50678
  // ../bridge/src/worktrees/manager/resolve-explicit-session-parent-path.ts
50924
- import * as path67 from "node:path";
50679
+ import * as path65 from "node:path";
50925
50680
  init_yield_to_event_loop();
50926
50681
  async function resolveExplicitSessionParentPath(params) {
50927
- const resolved = path67.resolve(params.parentPathRaw);
50682
+ const resolved = path65.resolve(params.parentPathRaw);
50928
50683
  if (parseSessionParent(params.sessionParent) !== "worktrees_root") {
50929
50684
  return resolved;
50930
50685
  }
@@ -50941,7 +50696,7 @@ async function resolveExplicitSessionParentPath(params) {
50941
50696
  await yieldToEventLoop();
50942
50697
  const tryRoot = await discoverSessionWorktreesUnderSessionWorktreeRoot(cur, params.sessionId);
50943
50698
  if (tryRoot) return rememberAndReturn(tryRoot);
50944
- const next = path67.dirname(cur);
50699
+ const next = path65.dirname(cur);
50945
50700
  if (next === cur) break;
50946
50701
  cur = next;
50947
50702
  }
@@ -51102,15 +50857,15 @@ var SessionWorktreeManager = class {
51102
50857
  };
51103
50858
 
51104
50859
  // ../bridge/src/worktrees/discovery/discover-preview-worktree-on-disk.ts
51105
- import * as fs43 from "node:fs";
51106
- import * as path68 from "node:path";
50860
+ import * as fs42 from "node:fs";
50861
+ import * as path66 from "node:path";
51107
50862
  init_yield_to_event_loop();
51108
50863
  async function discoverPreviewWorktreeOnDisk(options) {
51109
50864
  const { environmentId, worktreesRootPath, layout, bridgeRoot } = options;
51110
50865
  const eid = environmentId.trim();
51111
50866
  if (!eid) return null;
51112
50867
  try {
51113
- await fs43.promises.access(worktreesRootPath);
50868
+ await fs42.promises.access(worktreesRootPath);
51114
50869
  } catch {
51115
50870
  return null;
51116
50871
  }
@@ -51119,13 +50874,13 @@ async function discoverPreviewWorktreeOnDisk(options) {
51119
50874
  if (preferredKey) keysOnDisk.push(preferredKey);
51120
50875
  const scanState = { entries: 0 };
51121
50876
  try {
51122
- for (const name of await fs43.promises.readdir(worktreesRootPath)) {
50877
+ for (const name of await fs42.promises.readdir(worktreesRootPath)) {
51123
50878
  if (!await yieldDuringDiskWalk(scanState)) break;
51124
50879
  if (name.startsWith(".")) continue;
51125
- const p = path68.join(worktreesRootPath, name);
50880
+ const p = path66.join(worktreesRootPath, name);
51126
50881
  let st;
51127
50882
  try {
51128
- st = await fs43.promises.stat(p);
50883
+ st = await fs42.promises.stat(p);
51129
50884
  } catch {
51130
50885
  continue;
51131
50886
  }
@@ -51139,7 +50894,7 @@ async function discoverPreviewWorktreeOnDisk(options) {
51139
50894
  const previewDirRel = layoutDirSegments("preview_environment", eid);
51140
50895
  for (const key of keys) {
51141
50896
  await yieldToEventLoop();
51142
- const previewDir = path68.join(worktreesRootPath, key, ...previewDirRel);
50897
+ const previewDir = path66.join(worktreesRootPath, key, ...previewDirRel);
51143
50898
  const binding = await tryBindingFromIsolatedDirectory(previewDir);
51144
50899
  if (binding) return binding;
51145
50900
  }
@@ -51266,7 +51021,7 @@ var PreviewWorktreeManager = class {
51266
51021
  };
51267
51022
 
51268
51023
  // ../bridge/src/worktrees/deploy/deploy-session-to-preview-environment.ts
51269
- import * as path72 from "node:path";
51024
+ import * as path70 from "node:path";
51270
51025
 
51271
51026
  // ../bridge/src/git/worktrees/reset-worktree-to-branch.ts
51272
51027
  async function gitResetWorktreeToBranch(worktreePath, branch) {
@@ -51277,8 +51032,8 @@ async function gitResetWorktreeToBranch(worktreePath, branch) {
51277
51032
  }
51278
51033
 
51279
51034
  // ../bridge/src/worktrees/deploy/capture-and-apply-wip.ts
51280
- import * as fs44 from "node:fs";
51281
- import * as path69 from "node:path";
51035
+ import * as fs43 from "node:fs";
51036
+ import * as path67 from "node:path";
51282
51037
 
51283
51038
  // ../bridge/src/git/is-not-a-git-repository-error.ts
51284
51039
  function isNotAGitRepositoryError(e) {
@@ -51340,12 +51095,12 @@ async function applyWorkingTreeWip(targetRepoPath, sourceRepoPath, wip, log2) {
51340
51095
  if (!ap.ok) return ap;
51341
51096
  }
51342
51097
  await forEachWithGitYield(wip.untrackedPaths, async (rel) => {
51343
- const src = path69.join(sourceRepoPath, rel);
51344
- const dst = path69.join(targetRepoPath, rel);
51098
+ const src = path67.join(sourceRepoPath, rel);
51099
+ const dst = path67.join(targetRepoPath, rel);
51345
51100
  try {
51346
- if (!fs44.existsSync(src)) return;
51347
- fs44.mkdirSync(path69.dirname(dst), { recursive: true });
51348
- fs44.copyFileSync(src, dst);
51101
+ if (!fs43.existsSync(src)) return;
51102
+ fs43.mkdirSync(path67.dirname(dst), { recursive: true });
51103
+ fs43.copyFileSync(src, dst);
51349
51104
  } catch (e) {
51350
51105
  log2(
51351
51106
  `[worktrees] Failed to copy untracked ${rel}: ${e instanceof Error ? e.message : String(e)}`
@@ -51356,14 +51111,14 @@ async function applyWorkingTreeWip(targetRepoPath, sourceRepoPath, wip, log2) {
51356
51111
  }
51357
51112
 
51358
51113
  // ../bridge/src/worktrees/deploy/resolve-isolated-checkout-for-repo-path-relative-to-workspace-root.ts
51359
- import * as path70 from "node:path";
51114
+ import * as path68 from "node:path";
51360
51115
  async function resolveIsolatedCheckoutForRepoPathRelativeToWorkspaceRoot(options) {
51361
51116
  const { checkoutPaths, sessionParentPath, bridgeRoot, repoPathRelativeToWorkspaceRoot } = options;
51362
- const resolvedSessionParentPath = sessionParentPath ? path70.resolve(sessionParentPath) : null;
51117
+ const resolvedSessionParentPath = sessionParentPath ? path68.resolve(sessionParentPath) : null;
51363
51118
  let match = null;
51364
51119
  await forEachWithGitYield(checkoutPaths, async (checkoutPath) => {
51365
51120
  if (match) return;
51366
- const resolvedCheckoutPath = path70.resolve(checkoutPath);
51121
+ const resolvedCheckoutPath = path68.resolve(checkoutPath);
51367
51122
  if (!await isGitRepoDirectory(resolvedCheckoutPath)) return;
51368
51123
  const resolvedRepoPathRelativeToWorkspaceRoot = await resolveRepoPathRelativeToWorkspaceRoot({
51369
51124
  checkoutPath: resolvedCheckoutPath,
@@ -51417,7 +51172,7 @@ async function applySessionWipToPreviewCheckouts(options) {
51417
51172
  }
51418
51173
 
51419
51174
  // ../bridge/src/worktrees/deploy/collect-session-repo-deploy-states.ts
51420
- import * as path71 from "node:path";
51175
+ import * as path69 from "node:path";
51421
51176
 
51422
51177
  // ../bridge/src/git/branches/create-or-update-branch.ts
51423
51178
  async function gitCreateOrUpdateBranch(repoPath, branch, startRef, options) {
@@ -51454,19 +51209,19 @@ async function collectSessionRepoDeployStates(options) {
51454
51209
  const sessionParentPath = sessionWorktreeManager.getSessionParentPath(sid);
51455
51210
  const states = [];
51456
51211
  await forEachWithGitYield(sessionTargets, async (sessionCheckout) => {
51457
- const checkoutPath = path71.resolve(sessionCheckout);
51212
+ const checkoutPath = path69.resolve(sessionCheckout);
51458
51213
  if (!await isGitRepoDirectory(checkoutPath)) return;
51459
51214
  const repoPathRelativeToWorkspaceRoot = await resolveRepoPathRelativeToWorkspaceRoot({
51460
51215
  checkoutPath,
51461
51216
  bridgeRoot,
51462
- sessionParentPath: sessionParentPath ? path71.resolve(sessionParentPath) : null
51217
+ sessionParentPath: sessionParentPath ? path69.resolve(sessionParentPath) : null
51463
51218
  });
51464
51219
  if (!repoPathRelativeToWorkspaceRoot) return;
51465
51220
  const mainRepoPath = resolveMainRepoPath(checkoutPath);
51466
51221
  const headSha = (await cliSimpleGit(checkoutPath).revparse(["HEAD"])).trim();
51467
51222
  const previewCheckout = previewCheckoutPaths.length > 0 ? await resolveIsolatedCheckoutForRepoPathRelativeToWorkspaceRoot({
51468
51223
  checkoutPaths: previewCheckoutPaths,
51469
- sessionParentPath: previewParentPath ? path71.resolve(previewParentPath) : null,
51224
+ sessionParentPath: previewParentPath ? path69.resolve(previewParentPath) : null,
51470
51225
  bridgeRoot,
51471
51226
  repoPathRelativeToWorkspaceRoot
51472
51227
  }) : null;
@@ -51486,7 +51241,7 @@ async function deploySessionToPreviewEnvironment(options) {
51486
51241
  const eid = options.environmentId.trim();
51487
51242
  if (!sid || !eid) return { ok: false, error: "sessionId and environmentId are required" };
51488
51243
  const deployBranch = previewDeployBranchName(eid);
51489
- const bridgeRoot = path72.resolve(getBridgeRoot());
51244
+ const bridgeRoot = path70.resolve(getBridgeRoot());
51490
51245
  await previewWorktreeManager.ensureCached(eid);
51491
51246
  const existingPreviewParentPath = previewWorktreeManager.getPreviewParentPath(eid) ?? null;
51492
51247
  const existingPreviewCheckoutPaths = previewWorktreeManager.getRepoCheckoutPaths(eid) ?? [];
@@ -51526,10 +51281,10 @@ async function deploySessionToPreviewEnvironment(options) {
51526
51281
  }
51527
51282
 
51528
51283
  // ../bridge/src/worktrees/manager/default-worktrees-root-path.ts
51529
- import * as path73 from "node:path";
51530
- import os8 from "node:os";
51284
+ import * as path71 from "node:path";
51285
+ import os7 from "node:os";
51531
51286
  function defaultWorktreesRootPath() {
51532
- return path73.join(os8.homedir(), ".buildautomaton", "worktrees");
51287
+ return path71.join(os7.homedir(), ".buildautomaton", "worktrees");
51533
51288
  }
51534
51289
 
51535
51290
  // ../bridge/src/connection/setup/create-bridge-worktree-managers.ts
@@ -51654,14 +51409,14 @@ function assertBridgeWorkspace(ctx) {
51654
51409
  }
51655
51410
 
51656
51411
  // ../bridge/src/files/list-dir/index.ts
51657
- import fs46 from "node:fs";
51412
+ import fs45 from "node:fs";
51658
51413
 
51659
51414
  // ../bridge/src/files/ensure-under-cwd.ts
51660
- import path74 from "node:path";
51415
+ import path72 from "node:path";
51661
51416
  function ensureUnderCwd(relativePath, cwd = getBridgeRoot()) {
51662
- const normalized = path74.normalize(relativePath).replace(/^(\.\/)+/, "");
51663
- const resolved = path74.resolve(cwd, normalized);
51664
- if (!resolved.startsWith(cwd + path74.sep) && resolved !== cwd) {
51417
+ const normalized = path72.normalize(relativePath).replace(/^(\.\/)+/, "");
51418
+ const resolved = path72.resolve(cwd, normalized);
51419
+ if (!resolved.startsWith(cwd + path72.sep) && resolved !== cwd) {
51665
51420
  return null;
51666
51421
  }
51667
51422
  return resolved;
@@ -51674,15 +51429,15 @@ init_yield_to_event_loop();
51674
51429
  var LIST_DIR_YIELD_EVERY = 256;
51675
51430
 
51676
51431
  // ../bridge/src/files/list-dir/map-dir-entry.ts
51677
- import path75 from "node:path";
51678
- import fs45 from "node:fs";
51432
+ import path73 from "node:path";
51433
+ import fs44 from "node:fs";
51679
51434
  async function mapDirEntry(d, relativePath, resolved) {
51680
- const entryPath = path75.join(relativePath || ".", d.name).replace(/\\/g, "/");
51681
- const fullPath = path75.join(resolved, d.name);
51435
+ const entryPath = path73.join(relativePath || ".", d.name).replace(/\\/g, "/");
51436
+ const fullPath = path73.join(resolved, d.name);
51682
51437
  let isDir = d.isDirectory();
51683
51438
  if (d.isSymbolicLink()) {
51684
51439
  try {
51685
- const targetStat = await fs45.promises.stat(fullPath);
51440
+ const targetStat = await fs44.promises.stat(fullPath);
51686
51441
  isDir = targetStat.isDirectory();
51687
51442
  } catch {
51688
51443
  isDir = false;
@@ -51712,7 +51467,7 @@ async function listDirAsync(relativePath, sessionParentPath = getBridgeRoot()) {
51712
51467
  return { error: "Path is outside working directory" };
51713
51468
  }
51714
51469
  try {
51715
- const names = await fs46.promises.readdir(resolved, { withFileTypes: true });
51470
+ const names = await fs45.promises.readdir(resolved, { withFileTypes: true });
51716
51471
  const entries = [];
51717
51472
  for (let i = 0; i < names.length; i++) {
51718
51473
  if (i > 0 && i % LIST_DIR_YIELD_EVERY === 0) {
@@ -51728,13 +51483,13 @@ async function listDirAsync(relativePath, sessionParentPath = getBridgeRoot()) {
51728
51483
  }
51729
51484
 
51730
51485
  // ../bridge/src/git/tree/resolve-repo-abs-path.ts
51731
- import * as path76 from "node:path";
51486
+ import * as path74 from "node:path";
51732
51487
  function resolveRepoAbsPathFromBridge(repoRelPath, bridgeRoot = getBridgeRoot()) {
51733
- const bridgeResolved = path76.resolve(bridgeRoot);
51488
+ const bridgeResolved = path74.resolve(bridgeRoot);
51734
51489
  const rel = repoRelPath.trim() === "." ? "" : repoRelPath.trim().replace(/\\/g, "/");
51735
- const repoPath = rel === "" ? bridgeResolved : path76.join(bridgeResolved, rel);
51736
- const resolved = path76.resolve(repoPath);
51737
- if (!resolved.startsWith(bridgeResolved + path76.sep) && resolved !== bridgeResolved) {
51490
+ const repoPath = rel === "" ? bridgeResolved : path74.join(bridgeResolved, rel);
51491
+ const resolved = path74.resolve(repoPath);
51492
+ if (!resolved.startsWith(bridgeResolved + path74.sep) && resolved !== bridgeResolved) {
51738
51493
  return null;
51739
51494
  }
51740
51495
  return resolved;
@@ -52215,25 +51970,25 @@ async function GET2(ctx) {
52215
51970
  init_in_flight();
52216
51971
 
52217
51972
  // ../bridge/src/files/read/read-file-async.ts
52218
- import fs52 from "node:fs";
51973
+ import fs51 from "node:fs";
52219
51974
  init_yield_to_event_loop();
52220
51975
 
52221
51976
  // ../bridge/src/files/read/resolve-file-cache.ts
52222
- import fs47 from "node:fs";
52223
- import path77 from "node:path";
51977
+ import fs46 from "node:fs";
51978
+ import path75 from "node:path";
52224
51979
  var RESOLVE_CACHE_MAX = 4096;
52225
51980
  var resolveCache = /* @__PURE__ */ new Map();
52226
51981
  function resolveCacheKey(sessionParentPath, relativePath) {
52227
51982
  return `${sessionParentPath}\0${relativePath}`;
52228
51983
  }
52229
51984
  function pathStaysUnderParent(filePath, sessionParentPath) {
52230
- const parent = path77.resolve(sessionParentPath);
52231
- const resolved = path77.resolve(filePath);
52232
- return resolved === parent || resolved.startsWith(`${parent}${path77.sep}`);
51985
+ const parent = path75.resolve(sessionParentPath);
51986
+ const resolved = path75.resolve(filePath);
51987
+ return resolved === parent || resolved.startsWith(`${parent}${path75.sep}`);
52233
51988
  }
52234
51989
  function statMatchesCacheSync(entry) {
52235
51990
  try {
52236
- const stat3 = fs47.statSync(entry.path);
51991
+ const stat3 = fs46.statSync(entry.path);
52237
51992
  return stat3.isFile() && stat3.mtimeMs === entry.mtimeMs && stat3.size === entry.size;
52238
51993
  } catch {
52239
51994
  return false;
@@ -52266,7 +52021,7 @@ function joinInflightResolve(cacheKey, factory) {
52266
52021
  }
52267
52022
 
52268
52023
  // ../bridge/src/files/read/resolve-file-for-read-core.ts
52269
- import fs48 from "node:fs";
52024
+ import fs47 from "node:fs";
52270
52025
  import { isMainThread as isMainThread4 } from "node:worker_threads";
52271
52026
  function resolveFileForReadImplSync(relativePath, sessionParentPath) {
52272
52027
  const cacheKey = resolveCacheKey(sessionParentPath, relativePath);
@@ -52276,13 +52031,13 @@ function resolveFileForReadImplSync(relativePath, sessionParentPath) {
52276
52031
  let size;
52277
52032
  let mtimeMs;
52278
52033
  try {
52279
- const lstat = fs48.lstatSync(resolved);
52034
+ const lstat = fs47.lstatSync(resolved);
52280
52035
  if (lstat.isSymbolicLink()) {
52281
- real = fs48.realpathSync(resolved);
52036
+ real = fs47.realpathSync(resolved);
52282
52037
  if (!pathStaysUnderParent(real, sessionParentPath)) {
52283
52038
  return { error: "Path is outside working directory" };
52284
52039
  }
52285
- const stat3 = fs48.statSync(real);
52040
+ const stat3 = fs47.statSync(real);
52286
52041
  if (!stat3.isFile()) return { error: "Not a file" };
52287
52042
  size = stat3.size;
52288
52043
  mtimeMs = stat3.mtimeMs;
@@ -52310,13 +52065,13 @@ async function resolveFileForReadImpl(relativePath, sessionParentPath) {
52310
52065
  let size;
52311
52066
  let mtimeMs;
52312
52067
  try {
52313
- const lstat = await fs48.promises.lstat(resolved);
52068
+ const lstat = await fs47.promises.lstat(resolved);
52314
52069
  if (lstat.isSymbolicLink()) {
52315
- real = await fs48.promises.realpath(resolved);
52070
+ real = await fs47.promises.realpath(resolved);
52316
52071
  if (!pathStaysUnderParent(real, sessionParentPath)) {
52317
52072
  return { error: "Path is outside working directory" };
52318
52073
  }
52319
- const stat3 = await fs48.promises.stat(real);
52074
+ const stat3 = await fs47.promises.stat(real);
52320
52075
  if (!stat3.isFile()) return { error: "Not a file" };
52321
52076
  size = stat3.size;
52322
52077
  mtimeMs = stat3.mtimeMs;
@@ -52365,7 +52120,7 @@ async function resolveFilePathAsync(relativePath, sessionParentPath = getBridgeR
52365
52120
 
52366
52121
  // ../bridge/src/files/read/read-file-range-async.ts
52367
52122
  init_yield_to_event_loop();
52368
- import fs49 from "node:fs";
52123
+ import fs48 from "node:fs";
52369
52124
  import { StringDecoder as StringDecoder2 } from "node:string_decoder";
52370
52125
 
52371
52126
  // ../bridge/src/files/read/read-file-range-line-zero.ts
@@ -52479,8 +52234,8 @@ function finishLineZeroTail(state, tail, resultLines, fileSize, lineChunkSize, l
52479
52234
 
52480
52235
  // ../bridge/src/files/read/read-file-range-async.ts
52481
52236
  async function readFileRangeAsync(filePath, startLine, endLine, lineOffsetIn, lineChunkSize = LINE_CHUNK_SIZE, fileSizeIn) {
52482
- const fileSize = fileSizeIn ?? (await fs49.promises.stat(filePath)).size;
52483
- const fd = await fs49.promises.open(filePath, "r");
52237
+ const fileSize = fileSizeIn ?? (await fs48.promises.stat(filePath)).size;
52238
+ const fd = await fs48.promises.open(filePath, "r");
52484
52239
  const bufSize = 64 * 1024;
52485
52240
  const buf = Buffer.alloc(bufSize);
52486
52241
  const decoder = new StringDecoder2("utf8");
@@ -52581,7 +52336,7 @@ async function readFileRangeAsync(filePath, startLine, endLine, lineOffsetIn, li
52581
52336
  }
52582
52337
 
52583
52338
  // ../bridge/src/files/read/read-small-file-range-async.ts
52584
- import fs50 from "node:fs";
52339
+ import fs49 from "node:fs";
52585
52340
  import { isMainThread as isMainThread5 } from "node:worker_threads";
52586
52341
  var SMALL_FILE_RANGE_MAX_BYTES = 512 * 1024;
52587
52342
  function sliceLineRange(lines, startLine, endLine, lineOffsetIn, lineChunkSize, fileSize) {
@@ -52611,7 +52366,7 @@ function sliceLineRange(lines, startLine, endLine, lineOffsetIn, lineChunkSize,
52611
52366
  };
52612
52367
  }
52613
52368
  function readSmallFileRangeSync(filePath, fileSize, startLine, endLine, lineOffsetIn, lineChunkSize = LINE_CHUNK_SIZE) {
52614
- const raw = fs50.readFileSync(filePath, "utf8");
52369
+ const raw = fs49.readFileSync(filePath, "utf8");
52615
52370
  const lines = raw.split(/\r?\n/);
52616
52371
  return sliceLineRange(lines, startLine, endLine, lineOffsetIn, lineChunkSize, fileSize);
52617
52372
  }
@@ -52619,28 +52374,28 @@ async function readSmallFileRangeAsync(filePath, fileSize, startLine, endLine, l
52619
52374
  if (isMainThread5) {
52620
52375
  return readSmallFileRangeSync(filePath, fileSize, startLine, endLine, lineOffsetIn, lineChunkSize);
52621
52376
  }
52622
- const raw = await fs50.promises.readFile(filePath, "utf8");
52377
+ const raw = await fs49.promises.readFile(filePath, "utf8");
52623
52378
  const lines = raw.split(/\r?\n/);
52624
52379
  return sliceLineRange(lines, startLine, endLine, lineOffsetIn, lineChunkSize, fileSize);
52625
52380
  }
52626
52381
 
52627
52382
  // ../bridge/src/files/read/read-file-buffer-full-async.ts
52628
52383
  init_yield_to_event_loop();
52629
- import fs51 from "node:fs";
52384
+ import fs50 from "node:fs";
52630
52385
  import { isMainThread as isMainThread6 } from "node:worker_threads";
52631
52386
  var READ_CHUNK_BYTES = 256 * 1024;
52632
52387
  var MAIN_THREAD_SYNC_READ_MAX_BYTES = 512 * 1024;
52633
52388
  async function readFileBufferFullAsync(filePath, knownSize) {
52634
52389
  if (isMainThread6) {
52635
- const size2 = knownSize ?? fs51.statSync(filePath).size;
52390
+ const size2 = knownSize ?? fs50.statSync(filePath).size;
52636
52391
  if (size2 <= MAIN_THREAD_SYNC_READ_MAX_BYTES) {
52637
52392
  await yieldToEventLoop();
52638
- const buffer = fs51.readFileSync(filePath);
52393
+ const buffer = fs50.readFileSync(filePath);
52639
52394
  return { buffer, size: buffer.length };
52640
52395
  }
52641
52396
  }
52642
- const size = knownSize ?? (await fs51.promises.stat(filePath)).size;
52643
- const fd = await fs51.promises.open(filePath, "r");
52397
+ const size = knownSize ?? (await fs50.promises.stat(filePath)).size;
52398
+ const fd = await fs50.promises.open(filePath, "r");
52644
52399
  const chunks = [];
52645
52400
  let position = 0;
52646
52401
  let bytesSinceYield = 0;
@@ -52743,7 +52498,7 @@ async function readFileAsync(relativePath, startLine, endLine, lineOffset, lineC
52743
52498
  }
52744
52499
  if (hasRange) {
52745
52500
  if (fileSize == null) {
52746
- const stat3 = await fs52.promises.stat(resolvedPath);
52501
+ const stat3 = await fs51.promises.stat(resolvedPath);
52747
52502
  fileSize = stat3.size;
52748
52503
  }
52749
52504
  const read2 = fileSize <= SMALL_FILE_RANGE_MAX_BYTES ? await readSmallFileRangeAsync(
@@ -53041,12 +52796,12 @@ function parseOptionalInt2(raw) {
53041
52796
  return Number.isInteger(parsed) ? parsed : void 0;
53042
52797
  }
53043
52798
  function parseCodeNavParams(url2) {
53044
- const path88 = url2.searchParams.get("path") ?? "";
52799
+ const path86 = url2.searchParams.get("path") ?? "";
53045
52800
  const opRaw = url2.searchParams.get("op")?.trim();
53046
52801
  const op = opRaw === "references" ? "references" : opRaw === "symbols" ? "symbols" : opRaw === "definitions" ? "definitions" : "definition";
53047
52802
  const line = parseOptionalInt2(url2.searchParams.get("line")) ?? 1;
53048
52803
  const column = parseOptionalInt2(url2.searchParams.get("column")) ?? 0;
53049
- return { path: path88, op, line, column };
52804
+ return { path: path86, op, line, column };
53050
52805
  }
53051
52806
  function parseCodeNavPath(url2) {
53052
52807
  const raw = url2.searchParams.get("path")?.trim();
@@ -53979,19 +53734,34 @@ var handleAgentConfigMessage = (msg, deps) => {
53979
53734
  handleBridgeAgentConfig(msg, deps);
53980
53735
  };
53981
53736
 
53982
- // ../bridge/src/prompt-turn-queue/runner/dispatch-started-prompt-queue-runs.ts
53737
+ // ../bridge/src/prompt-queue/runner/apply-prompt-queue-state-from-server.ts
53983
53738
  init_yield_to_event_loop();
53984
53739
 
53985
- // ../bridge/src/prompt-turn-queue/disk-store.ts
53740
+ // ../bridge/src/prompt-queue/snapshots/types.ts
53741
+ function parseServerTurnSnapshot(raw) {
53742
+ if (!raw || typeof raw !== "object") return null;
53743
+ const o = raw;
53744
+ const turnId = typeof o.turnId === "string" ? o.turnId : "";
53745
+ const sessionId = typeof o.sessionId === "string" ? o.sessionId : "";
53746
+ const turnOrd = typeof o.turnOrd === "number" ? o.turnOrd : Number(o.turnOrd) || 0;
53747
+ const serverState = o.serverState ?? o.bridgeServerState;
53748
+ const lastCliState = o.lastClientState ?? o.lastCliState ?? null;
53749
+ const payload = o.payload && typeof o.payload === "object" ? o.payload : {};
53750
+ if (!turnId || !sessionId) return null;
53751
+ return { turnId, sessionId, turnOrd, serverState, lastCliState, payload };
53752
+ }
53753
+ function promptQueueSnapshotEntries(queues) {
53754
+ const entries = [];
53755
+ for (const [queueKey, rawTurns] of Object.entries(queues)) {
53756
+ if (!Array.isArray(rawTurns)) continue;
53757
+ const turns = rawTurns.map(parseServerTurnSnapshot).filter((t) => t !== null);
53758
+ entries.push([queueKey, turns]);
53759
+ }
53760
+ return entries;
53761
+ }
53762
+
53763
+ // ../bridge/src/prompt-queue/persistence/read-persisted-queue.ts
53986
53764
  init_cli_database();
53987
- var MERGEABLE_BRIDGE_SERVER_STATES = /* @__PURE__ */ new Set([
53988
- "queued",
53989
- "requeued",
53990
- "requeued_with_revert",
53991
- "cancel_requested",
53992
- "stopping",
53993
- "discarded"
53994
- ]);
53995
53765
  async function readPersistedQueue(queueKey) {
53996
53766
  return withCliSqlite((db) => {
53997
53767
  const row = db.get("SELECT queue_key, updated_at, turns_json FROM prompt_queue WHERE queue_key = ?", [
@@ -54007,6 +53777,9 @@ async function readPersistedQueue(queueKey) {
54007
53777
  }
54008
53778
  });
54009
53779
  }
53780
+
53781
+ // ../bridge/src/prompt-queue/persistence/write-persisted-queue.ts
53782
+ init_cli_database();
54010
53783
  async function writePersistedQueue(file2) {
54011
53784
  await withCliSqlite((db) => {
54012
53785
  db.run(
@@ -54016,36 +53789,103 @@ async function writePersistedQueue(file2) {
54016
53789
  );
54017
53790
  });
54018
53791
  }
54019
- async function mergeBridgeServerQueueSnapshot(queueKey, serverTurns) {
54020
- const prev = await readPersistedQueue(queueKey);
53792
+
53793
+ // ../bridge/src/prompt-queue/reconciliation/merge-turns.ts
53794
+ var MERGEABLE_BRIDGE_SERVER_STATES = /* @__PURE__ */ new Set([
53795
+ "queued",
53796
+ "requeued",
53797
+ "requeued_with_revert",
53798
+ "cancel_requested",
53799
+ "stopping",
53800
+ "discarded"
53801
+ ]);
53802
+ function mergeServerSnapshotWithLocal(queueKey, serverTurns, prev) {
54021
53803
  const turns = [];
54022
- for (const raw of serverTurns) {
54023
- if (!raw || typeof raw !== "object") continue;
54024
- const o = raw;
54025
- const turnId = typeof o.turnId === "string" ? o.turnId : "";
54026
- const sessionId = typeof o.sessionId === "string" ? o.sessionId : "";
54027
- const turnOrd = typeof o.turnOrd === "number" ? o.turnOrd : Number(o.turnOrd) || 0;
54028
- const bridgeServerState = o.serverState ?? o.bridgeServerState;
54029
- const lastCliState = o.lastClientState ?? o.lastCliState ?? null;
54030
- const payload = o.payload && typeof o.payload === "object" ? o.payload : {};
54031
- if (!turnId || !sessionId) continue;
54032
- if (!MERGEABLE_BRIDGE_SERVER_STATES.has(String(bridgeServerState))) continue;
54033
- const old = prev?.turns.find((t) => t.turnId === turnId);
54034
- const mergedCli = old?.lastCliState === "running" && lastCliState == null ? "running" : lastCliState;
53804
+ for (const s of serverTurns) {
53805
+ if (!MERGEABLE_BRIDGE_SERVER_STATES.has(String(s.serverState))) continue;
53806
+ const old = prev?.turns.find((t) => t.turnId === s.turnId);
53807
+ const mergedCli = old?.lastCliState === "running" && s.lastCliState == null ? "running" : s.lastCliState;
54035
53808
  turns.push({
54036
- turnId,
54037
- sessionId,
54038
- turnOrd,
54039
- bridgeServerState,
53809
+ turnId: s.turnId,
53810
+ sessionId: s.sessionId,
53811
+ turnOrd: s.turnOrd,
53812
+ bridgeServerState: s.serverState,
54040
53813
  lastCliState: mergedCli,
54041
- payload
53814
+ payload: s.payload
54042
53815
  });
54043
53816
  }
54044
53817
  turns.sort((a, b) => a.turnOrd - b.turnOrd);
54045
53818
  return { queueKey, updatedAt: (/* @__PURE__ */ new Date()).toISOString(), turns };
54046
53819
  }
53820
+ function hasLiveRunningTurn(turns, isLiveRun) {
53821
+ return turns.some((t) => t.lastCliState === "running" && isLiveRun(t.turnId));
53822
+ }
53823
+ function isTerminalCliState(state) {
53824
+ return state === "stopped" || state === "failed" || state === "cancelled";
53825
+ }
53826
+ function isSkippedServerState(state) {
53827
+ return state === "discarded" || state === "stopping" || state === "cancel_requested";
53828
+ }
53829
+
53830
+ // ../bridge/src/prompt-queue/reconciliation/pick-actions.ts
53831
+ function pickNextRunnableTurn(turns) {
53832
+ for (const t of turns) {
53833
+ if (isSkippedServerState(t.bridgeServerState)) continue;
53834
+ if (!isRunnableBridgePromptTurnServerState(t.bridgeServerState)) continue;
53835
+ if (isTerminalCliState(t.lastCliState) || t.lastCliState === "running") continue;
53836
+ return t;
53837
+ }
53838
+ return null;
53839
+ }
53840
+ function normalizeStaleRunning(turns, isLiveRun) {
53841
+ return turns.map((t) => {
53842
+ if (t.lastCliState !== "running") return t;
53843
+ if (isLiveRun(t.turnId)) return t;
53844
+ if (t.bridgeServerState === "cancel_requested") return t;
53845
+ return { ...t, lastCliState: null };
53846
+ });
53847
+ }
53848
+ function reconcileQueueActions(queueKey, turns, isLiveRun) {
53849
+ const actions = [];
53850
+ for (const t of turns) {
53851
+ if (t.bridgeServerState === "cancel_requested" && t.lastCliState === "running" && isLiveRun(t.turnId)) {
53852
+ actions.push({ type: "cancel_run", queueKey, turnId: t.turnId });
53853
+ }
53854
+ }
53855
+ for (const t of turns) {
53856
+ if (t.bridgeServerState !== "cancel_requested") continue;
53857
+ if (t.lastCliState !== "running") continue;
53858
+ if (isLiveRun(t.turnId)) continue;
53859
+ actions.push({ type: "finalize_stale", queueKey, turnId: t.turnId, cliState: "cancelled" });
53860
+ }
53861
+ const normalized = normalizeStaleRunning(turns, isLiveRun);
53862
+ if (hasLiveRunningTurn(normalized, isLiveRun)) return actions;
53863
+ const next = pickNextRunnableTurn(normalized);
53864
+ if (next) {
53865
+ actions.push({ type: "start_run", queueKey, turn: next });
53866
+ actions.push({ type: "report_cli_state", queueKey, turnId: next.turnId, cliState: "running" });
53867
+ }
53868
+ return actions;
53869
+ }
53870
+ function applyStaleRunningNormalization(turns, isLiveRun) {
53871
+ return normalizeStaleRunning(turns, isLiveRun);
53872
+ }
53873
+
53874
+ // ../bridge/src/prompt-queue/runner/execute-actions.ts
53875
+ init_yield_to_event_loop();
54047
53876
 
54048
- // ../bridge/src/prompt-turn-queue/runner/dispatch-local-prompt.ts
53877
+ // ../bridge/src/prompt-queue/runner/client-report.ts
53878
+ function sendPromptQueueClientReport(ws, queues) {
53879
+ if (!ws) return false;
53880
+ const wireQueues = {};
53881
+ for (const [queueKey, rows] of Object.entries(queues)) {
53882
+ wireQueues[queueKey] = rows.map((r) => ({ turnId: r.turnId, clientState: r.cliState }));
53883
+ }
53884
+ sendWsMessage(ws, { type: "prompt_queue_client_report", queues: wireQueues });
53885
+ return true;
53886
+ }
53887
+
53888
+ // ../bridge/src/prompt-queue/runner/dispatch-local-prompt.ts
54049
53889
  function dispatchLocalPrompt(next, deps) {
54050
53890
  const pl = next.payload;
54051
53891
  const rawParent = pl["sessionParent"];
@@ -54072,20 +53912,17 @@ function dispatchLocalPrompt(next, deps) {
54072
53912
  handleBridgePrompt(msg, deps);
54073
53913
  }
54074
53914
 
54075
- // ../bridge/src/prompt-turn-queue/runner/run-id-queue-key-map.ts
53915
+ // ../bridge/src/prompt-queue/runner/run-id-queue-key-map.ts
54076
53916
  var runIdToQueueKey = /* @__PURE__ */ new Map();
54077
- var locallyDispatchedRunIds = /* @__PURE__ */ new Set();
54078
53917
  function getRunIdQueueKey(runId) {
54079
53918
  return runIdToQueueKey.get(runId);
54080
53919
  }
54081
53920
  function setRunIdQueueKey(runId, queueKey) {
54082
53921
  runIdToQueueKey.set(runId, queueKey);
54083
- locallyDispatchedRunIds.add(runId);
54084
53922
  }
54085
53923
  function deleteRunIdQueueKey(runId) {
54086
53924
  const queueKey = runIdToQueueKey.get(runId);
54087
53925
  runIdToQueueKey.delete(runId);
54088
- locallyDispatchedRunIds.delete(runId);
54089
53926
  return queueKey;
54090
53927
  }
54091
53928
  function syncRunningTurnQueueKeys(turns, queueKey) {
@@ -54094,33 +53931,7 @@ function syncRunningTurnQueueKeys(turns, queueKey) {
54094
53931
  }
54095
53932
  }
54096
53933
 
54097
- // ../bridge/src/prompt-turn-queue/runner/dispatch-started-prompt-queue-runs.ts
54098
- async function dispatchStartedPromptQueueRuns(entries, started, deps) {
54099
- for (const [queueKey] of entries) {
54100
- const file2 = await readPersistedQueue(queueKey);
54101
- const running2 = file2?.turns.find((turn) => turn.lastCliState === "running");
54102
- if (running2 && started.has(running2.turnId) && getRunIdQueueKey(running2.turnId) === queueKey) {
54103
- dispatchLocalPrompt(running2, deps);
54104
- }
54105
- await yieldToEventLoop();
54106
- }
54107
- }
54108
-
54109
- // ../bridge/src/prompt-turn-queue/runner/handle-prompt-queue-cancellations.ts
54110
- init_yield_to_event_loop();
54111
-
54112
- // ../bridge/src/prompt-turn-queue/client-report.ts
54113
- function sendPromptQueueClientReport(ws, queues) {
54114
- if (!ws) return false;
54115
- const wireQueues = {};
54116
- for (const [queueKey, rows] of Object.entries(queues)) {
54117
- wireQueues[queueKey] = rows.map((r) => ({ turnId: r.turnId, clientState: r.cliState }));
54118
- }
54119
- sendWsMessage(ws, { type: "prompt_queue_client_report", queues: wireQueues });
54120
- return true;
54121
- }
54122
-
54123
- // ../bridge/src/prompt-turn-queue/runner/finalize-prompt-turn-on-bridge.ts
53934
+ // ../bridge/src/prompt-queue/runner/finalize-prompt-turn-on-bridge.ts
54124
53935
  async function finalizePromptTurnOnBridge(getWs, runId, success2, opts) {
54125
53936
  if (!runId) return false;
54126
53937
  const queueKey = deleteRunIdQueueKey(runId);
@@ -54135,79 +53946,19 @@ async function finalizePromptTurnOnBridge(getWs, runId, success2, opts) {
54135
53946
  return true;
54136
53947
  }
54137
53948
 
54138
- // ../bridge/src/prompt-turn-queue/runner/handle-prompt-queue-cancellations.ts
54139
- async function handlePromptQueueCancellations(entries, deps) {
54140
- for (const [queueKey] of entries) {
54141
- const file2 = await readPersistedQueue(queueKey);
54142
- const turn = file2?.turns.find((row) => row.bridgeServerState === "cancel_requested" && row.lastCliState === "running");
54143
- if (!turn || getRunIdQueueKey(turn.turnId) !== queueKey) {
54144
- await yieldToEventLoop();
54145
- continue;
54146
- }
54147
- deps.log(`[Queue] Cancellation request received for turn ${turn.turnId.slice(0, 8)}\u2026`);
54148
- if (await deps.acpManager.cancelRun(turn.turnId)) {
54149
- await yieldToEventLoop();
54150
- continue;
54151
- }
54152
- deps.log(`[Queue] No local ACP run remains for ${turn.turnId.slice(0, 8)}\u2026; reconciling cancelled turn.`);
54153
- await finalizePromptTurnOnBridge(deps.getWs, turn.turnId, false, { terminalCliState: "cancelled" });
54154
- await yieldToEventLoop();
54155
- }
54156
- }
54157
-
54158
- // ../bridge/src/prompt-turn-queue/runner/persist-prompt-queue-snapshot.ts
54159
- init_yield_to_event_loop();
54160
- async function persistPromptQueueSnapshot(entries) {
54161
- for (const [queueKey, serverTurns] of entries) {
54162
- const file2 = await mergeBridgeServerQueueSnapshot(queueKey, serverTurns);
54163
- await writePersistedQueue(file2);
54164
- await yieldToEventLoop();
54165
- }
54166
- for (const [queueKey] of entries) {
54167
- const file2 = await readPersistedQueue(queueKey);
54168
- if (file2) syncRunningTurnQueueKeys(file2.turns, queueKey);
54169
- await yieldToEventLoop();
54170
- }
54171
- }
54172
-
54173
- // ../bridge/src/prompt-turn-queue/runner/prompt-queue-snapshot-types.ts
54174
- function promptQueueSnapshotEntries(queues) {
54175
- return Object.entries(queues).filter((entry) => Array.isArray(entry[1]));
54176
- }
54177
-
54178
- // ../bridge/src/prompt-turn-queue/runner/start-prompt-queue-runs.ts
54179
- init_yield_to_event_loop();
54180
-
54181
- // ../bridge/src/prompt-turn-queue/runner/queue-selection.ts
54182
- function pickNextRunnableTurn(turns) {
54183
- for (const t of turns) {
54184
- if (t.bridgeServerState === "discarded" || t.bridgeServerState === "stopping") continue;
54185
- if (t.bridgeServerState === "cancel_requested") continue;
54186
- if (!isRunnableBridgePromptTurnServerState(t.bridgeServerState)) continue;
54187
- if (t.lastCliState === "running" || t.lastCliState === "stopped" || t.lastCliState === "failed" || t.lastCliState === "cancelled") {
54188
- continue;
54189
- }
54190
- return t;
54191
- }
54192
- return null;
54193
- }
54194
- function hasRunningTurn(turns) {
54195
- return turns.some((t) => t.lastCliState === "running");
54196
- }
54197
-
54198
- // ../bridge/src/prompt-turn-queue/runner/run-local-revert-before-queued-prompt.ts
54199
- import fs55 from "node:fs";
53949
+ // ../bridge/src/prompt-queue/runner/run-local-revert-before-queued-prompt.ts
53950
+ import fs54 from "node:fs";
54200
53951
 
54201
53952
  // ../bridge/src/git/snapshot/capture.ts
54202
- import * as fs54 from "node:fs";
54203
- import * as path79 from "node:path";
53953
+ import * as fs53 from "node:fs";
53954
+ import * as path77 from "node:path";
54204
53955
 
54205
53956
  // ../bridge/src/git/snapshot/apply-pre-turn-snapshot.ts
54206
- import * as fs53 from "node:fs";
53957
+ import * as fs52 from "node:fs";
54207
53958
  async function applyPreTurnSnapshot(filePath, log2) {
54208
53959
  let data;
54209
53960
  try {
54210
- data = JSON.parse(fs53.readFileSync(filePath, "utf8"));
53961
+ data = JSON.parse(fs52.readFileSync(filePath, "utf8"));
54211
53962
  } catch (error51) {
54212
53963
  return { ok: false, error: error51 instanceof Error ? error51.message : String(error51) };
54213
53964
  }
@@ -54236,18 +53987,18 @@ async function applyPreTurnSnapshot(filePath, log2) {
54236
53987
  }
54237
53988
 
54238
53989
  // ../bridge/src/git/snapshot/resolve-repo-roots.ts
54239
- import * as path78 from "node:path";
53990
+ import * as path76 from "node:path";
54240
53991
  async function resolveSnapshotRepoRoots(options) {
54241
53992
  const { worktreePaths, fallbackCwd, sessionId, log: log2 } = options;
54242
53993
  if (worktreePaths?.length) {
54243
- const paths = [...new Set(worktreePaths.map((p) => path78.resolve(p)))];
53994
+ const paths = [...new Set(worktreePaths.map((p) => path76.resolve(p)))];
54244
53995
  return (await Promise.all(paths.map(async (p) => await isGitRepoDirectory(p) ? p : null))).filter((p) => p != null);
54245
53996
  }
54246
53997
  try {
54247
53998
  const roots = (await discoverGitReposUnderRoot(fallbackCwd)).map((repo) => repo.absolutePath);
54248
53999
  const sid = sessionId?.trim();
54249
54000
  if (!sid) return roots;
54250
- const sessionRoots = roots.filter((root) => path78.basename(root) === sid);
54001
+ const sessionRoots = roots.filter((root) => path76.basename(root) === sid);
54251
54002
  return sessionRoots.length > 0 ? sessionRoots : roots;
54252
54003
  } catch (error51) {
54253
54004
  log2(`[snapshot] Discover repositories failed: ${error51 instanceof Error ? error51.message : String(error51)}`);
@@ -54269,7 +54020,7 @@ async function capturePreTurnSnapshot(options) {
54269
54020
  });
54270
54021
  const dir = snapshotsDirForCwd(agentCwd);
54271
54022
  try {
54272
- fs54.mkdirSync(dir, { recursive: true });
54023
+ fs53.mkdirSync(dir, { recursive: true });
54273
54024
  } catch (e) {
54274
54025
  return { ok: false, error: e instanceof Error ? e.message : String(e) };
54275
54026
  }
@@ -54278,9 +54029,9 @@ async function capturePreTurnSnapshot(options) {
54278
54029
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
54279
54030
  repos
54280
54031
  };
54281
- const filePath = path79.join(dir, `${runId}.json`);
54032
+ const filePath = path77.join(dir, `${runId}.json`);
54282
54033
  try {
54283
- fs54.writeFileSync(filePath, JSON.stringify(payload, null, 2), "utf8");
54034
+ fs53.writeFileSync(filePath, JSON.stringify(payload, null, 2), "utf8");
54284
54035
  } catch (e) {
54285
54036
  return { ok: false, error: e instanceof Error ? e.message : String(e) };
54286
54037
  }
@@ -54291,7 +54042,7 @@ async function capturePreTurnSnapshot(options) {
54291
54042
  return { ok: true, filePath, repos };
54292
54043
  }
54293
54044
 
54294
- // ../bridge/src/prompt-turn-queue/runner/run-local-revert-before-queued-prompt.ts
54045
+ // ../bridge/src/prompt-queue/runner/run-local-revert-before-queued-prompt.ts
54295
54046
  async function runLocalRevertBeforeQueuedPrompt(next, deps) {
54296
54047
  if (next.bridgeServerState !== "requeued_with_revert") return true;
54297
54048
  const sid = next.sessionId;
@@ -54300,7 +54051,7 @@ async function runLocalRevertBeforeQueuedPrompt(next, deps) {
54300
54051
  const agentBase = deps.sessionWorktreeManager.getSessionWorktreeRootForSession(sid) ?? getBridgeRoot();
54301
54052
  const file2 = snapshotFilePath(agentBase, tid);
54302
54053
  try {
54303
- await fs55.promises.access(file2, fs55.constants.F_OK);
54054
+ await fs54.promises.access(file2, fs54.constants.F_OK);
54304
54055
  } catch {
54305
54056
  deps.log(
54306
54057
  `[Queue] requeued_with_revert: no pre-turn snapshot for ${tid.slice(0, 8)}\u2026; continuing without revert.`
@@ -54314,49 +54065,120 @@ async function runLocalRevertBeforeQueuedPrompt(next, deps) {
54314
54065
  return res.ok;
54315
54066
  }
54316
54067
 
54317
- // ../bridge/src/prompt-turn-queue/runner/start-prompt-queue-runs.ts
54318
- async function startPromptQueueRuns(entries, deps) {
54319
- const report = {};
54068
+ // ../bridge/src/prompt-queue/runner/execute-actions.ts
54069
+ async function executePromptQueueActions(actions, deps) {
54320
54070
  const started = /* @__PURE__ */ new Set();
54321
- for (const [queueKey] of entries) {
54322
- const file2 = await readPersistedQueue(queueKey);
54323
- if (!file2 || hasRunningTurn(file2.turns)) continue;
54324
- const next = pickNextRunnableTurn(file2.turns);
54325
- if (!next) continue;
54326
- if (!await runLocalRevertBeforeQueuedPrompt(next, deps)) {
54327
- next.lastCliState = "failed";
54328
- await writePersistedQueue(file2);
54329
- sendPromptQueueClientReport(deps.getWs(), { [queueKey]: [{ turnId: next.turnId, cliState: "failed" }] });
54071
+ const report = {};
54072
+ for (const action of actions) {
54073
+ if (action.type === "cancel_run") {
54074
+ if (getRunIdQueueKey(action.turnId) !== action.queueKey) continue;
54075
+ deps.log(`[Queue] Cancellation request received for turn ${action.turnId.slice(0, 8)}\u2026`);
54076
+ if (await deps.acpManager.cancelRun(action.turnId)) continue;
54077
+ deps.log(`[Queue] No local ACP run remains for ${action.turnId.slice(0, 8)}\u2026; reconciling cancelled turn.`);
54078
+ await finalizePromptTurnOnBridge(deps.getWs, action.turnId, false, { terminalCliState: "cancelled" });
54330
54079
  continue;
54331
54080
  }
54332
- next.lastCliState = "running";
54333
- await writePersistedQueue(file2);
54334
- setRunIdQueueKey(next.turnId, queueKey);
54335
- started.add(next.turnId);
54336
- report[queueKey] = [{ turnId: next.turnId, cliState: "running" }];
54081
+ if (action.type === "finalize_stale") {
54082
+ await applyCliState(action.queueKey, action.turnId, action.cliState);
54083
+ deleteRunIdQueueKey(action.turnId);
54084
+ report[action.queueKey] = [{ turnId: action.turnId, cliState: action.cliState }];
54085
+ continue;
54086
+ }
54087
+ if (action.type === "start_run") {
54088
+ const ok = await markTurnRunning(action.queueKey, action.turn, deps);
54089
+ if (!ok) {
54090
+ report[action.queueKey] = [{ turnId: action.turn.turnId, cliState: "failed" }];
54091
+ continue;
54092
+ }
54093
+ started.add(action.turn.turnId);
54094
+ report[action.queueKey] = [{ turnId: action.turn.turnId, cliState: "running" }];
54095
+ }
54337
54096
  await yieldToEventLoop();
54338
54097
  }
54339
54098
  if (Object.keys(report).length) sendPromptQueueClientReport(deps.getWs(), report);
54099
+ for (const runId of started) {
54100
+ const queueKey = getRunIdQueueKey(runId);
54101
+ if (!queueKey) continue;
54102
+ const file2 = await readPersistedQueue(queueKey);
54103
+ const turn = file2?.turns.find((t) => t.turnId === runId);
54104
+ if (turn) dispatchLocalPrompt(turn, deps);
54105
+ await yieldToEventLoop();
54106
+ }
54340
54107
  return started;
54341
54108
  }
54109
+ async function markTurnRunning(queueKey, turn, deps) {
54110
+ const file2 = await readPersistedQueue(queueKey);
54111
+ if (!file2) return false;
54112
+ const row = file2.turns.find((t) => t.turnId === turn.turnId);
54113
+ if (!row) return false;
54114
+ if (!await runLocalRevertBeforeQueuedPrompt(row, deps)) {
54115
+ row.lastCliState = "failed";
54116
+ await writePersistedQueue(file2);
54117
+ return false;
54118
+ }
54119
+ row.lastCliState = "running";
54120
+ await writePersistedQueue(file2);
54121
+ setRunIdQueueKey(row.turnId, queueKey);
54122
+ return true;
54123
+ }
54124
+ async function applyCliState(queueKey, turnId, cliState) {
54125
+ const file2 = await readPersistedQueue(queueKey);
54126
+ if (!file2) return;
54127
+ const turn = file2.turns.find((t) => t.turnId === turnId);
54128
+ if (!turn) return;
54129
+ turn.lastCliState = cliState;
54130
+ await writePersistedQueue(file2);
54131
+ }
54342
54132
 
54343
- // ../bridge/src/prompt-turn-queue/runner/apply-prompt-queue-state-from-server.ts
54133
+ // ../bridge/src/prompt-queue/runner/apply-prompt-queue-state-from-server.ts
54344
54134
  var SLOW_QUEUE_SYNC_MS = 2e3;
54135
+ async function persistAndReconcileQueue(queueKey, serverTurns, deps) {
54136
+ const prev = await readPersistedQueue(queueKey);
54137
+ const merged = mergeServerSnapshotWithLocal(queueKey, serverTurns, prev);
54138
+ const liveCheck = (runId) => deps.acpManager.isRegisteredRun(runId);
54139
+ const actions = reconcileQueueActions(queueKey, merged.turns, liveCheck);
54140
+ merged.turns = applyStaleRunningNormalization(merged.turns, liveCheck);
54141
+ await writePersistedQueue(merged);
54142
+ syncRunningTurnQueueKeys(merged.turns, queueKey);
54143
+ return actions;
54144
+ }
54345
54145
  async function applyPromptQueueStateFromServer(msg, deps) {
54346
54146
  const raw = msg.queues;
54347
54147
  if (!raw || typeof raw !== "object") return;
54348
54148
  const startedAt = Date.now();
54349
54149
  const entries = promptQueueSnapshotEntries(raw);
54350
- await persistPromptQueueSnapshot(entries);
54351
- await handlePromptQueueCancellations(entries, deps);
54352
- const started = await startPromptQueueRuns(entries, deps);
54353
- await dispatchStartedPromptQueueRuns(entries, started, deps);
54150
+ const allActions = [];
54151
+ for (const [queueKey, serverTurns] of entries) {
54152
+ allActions.push(...await persistAndReconcileQueue(queueKey, serverTurns, deps));
54153
+ await yieldToEventLoop();
54154
+ }
54155
+ await executePromptQueueActions(allActions, deps);
54354
54156
  const durationMs = Date.now() - startedAt;
54355
54157
  if (durationMs >= SLOW_QUEUE_SYNC_MS) {
54356
54158
  deps.log(`[Queue] Queue state sync and dispatch took ${durationMs}ms.`);
54357
54159
  }
54358
54160
  }
54359
54161
 
54162
+ // ../bridge/src/prompt-queue/runner/serial-prompt-queue-work.ts
54163
+ var running = false;
54164
+ var latestWork = null;
54165
+ async function drain() {
54166
+ while (latestWork) {
54167
+ const work = latestWork;
54168
+ latestWork = null;
54169
+ await work();
54170
+ }
54171
+ }
54172
+ function enqueueLatestPromptQueueStateWork(work) {
54173
+ latestWork = work;
54174
+ if (running) return;
54175
+ running = true;
54176
+ void drain().finally(() => {
54177
+ running = false;
54178
+ if (latestWork) enqueueLatestPromptQueueStateWork(latestWork);
54179
+ });
54180
+ }
54181
+
54360
54182
  // ../bridge/src/agents/acp/from-bridge/pending-prompt-results.ts
54361
54183
  var pending = [];
54362
54184
  function enqueuePendingPromptResult(message) {
@@ -54676,26 +54498,6 @@ var handlePromptMessage = (msg, deps) => {
54676
54498
  handleBridgePrompt(msg, deps);
54677
54499
  };
54678
54500
 
54679
- // ../bridge/src/prompt-turn-queue/runner/serial-prompt-queue-work.ts
54680
- var running = false;
54681
- var latestWork = null;
54682
- async function drain() {
54683
- while (latestWork) {
54684
- const work = latestWork;
54685
- latestWork = null;
54686
- await work();
54687
- }
54688
- }
54689
- function enqueueLatestPromptQueueStateWork(work) {
54690
- latestWork = work;
54691
- if (running) return;
54692
- running = true;
54693
- void drain().finally(() => {
54694
- running = false;
54695
- if (latestWork) enqueueLatestPromptQueueStateWork(latestWork);
54696
- });
54697
- }
54698
-
54699
54501
  // ../bridge/src/connection/routing/handlers/prompt-queue-state.ts
54700
54502
  var handlePromptQueueStateMessage = (msg, deps) => {
54701
54503
  enqueueLatestPromptQueueStateWork(async () => {
@@ -54958,7 +54760,7 @@ var handleSessionDiscardedMessage = (msg, deps) => {
54958
54760
  };
54959
54761
 
54960
54762
  // ../bridge/src/connection/routing/handlers/revert-turn-snapshot.ts
54961
- import * as fs56 from "node:fs";
54763
+ import * as fs55 from "node:fs";
54962
54764
  var handleRevertTurnSnapshotMessage = (msg, deps) => {
54963
54765
  const id = typeof msg.id === "string" ? msg.id : "";
54964
54766
  const sessionId = typeof msg.sessionId === "string" ? msg.sessionId : "";
@@ -54971,7 +54773,7 @@ var handleRevertTurnSnapshotMessage = (msg, deps) => {
54971
54773
  const agentBase = sessionWorktreeManager.getSessionWorktreeRootForSession(sessionId) ?? getBridgeRoot();
54972
54774
  const file2 = snapshotFilePath(agentBase, turnId);
54973
54775
  try {
54974
- await fs56.promises.access(file2, fs56.constants.F_OK);
54776
+ await fs55.promises.access(file2, fs55.constants.F_OK);
54975
54777
  } catch {
54976
54778
  sendWsMessage(s, {
54977
54779
  type: "revert_turn_snapshot_result",
@@ -55085,13 +54887,13 @@ function handleFileBrowserRequest(msg, socket, e2ee, sessionWorktreeManager) {
55085
54887
 
55086
54888
  // ../bridge/src/files/handle-file-browser-search.ts
55087
54889
  init_yield_to_event_loop();
55088
- import path80 from "node:path";
54890
+ import path78 from "node:path";
55089
54891
  var SEARCH_LIMIT = 100;
55090
54892
  function handleFileBrowserSearch(msg, socket, e2ee, sessionWorktreeManager) {
55091
54893
  void (async () => {
55092
54894
  await yieldToEventLoop();
55093
54895
  const q = typeof msg.q === "string" ? msg.q : "";
55094
- const sessionParentPath = path80.resolve(
54896
+ const sessionParentPath = path78.resolve(
55095
54897
  sessionWorktreeManager != null ? await resolveFileBrowserSessionParent(sessionWorktreeManager, msg.sessionId) : getBridgeRoot()
55096
54898
  );
55097
54899
  if (!await bridgeFileIndexIsPopulated(sessionParentPath)) {
@@ -55189,7 +54991,7 @@ function handleFileBrowserCodeNavMessage(msg, { getWs, e2ee, sessionWorktreeMana
55189
54991
  }
55190
54992
 
55191
54993
  // ../bridge/src/git/bridge-git-context.ts
55192
- import * as path81 from "node:path";
54994
+ import * as path79 from "node:path";
55193
54995
  init_yield_to_event_loop();
55194
54996
 
55195
54997
  // ../bridge/src/git/branches/get-current-branch.ts
@@ -55257,12 +55059,12 @@ function listPendingCheckouts() {
55257
55059
  // ../bridge/src/git/bridge-git-context.ts
55258
55060
  function folderNameForRelPath(relPath, bridgeRoot) {
55259
55061
  if (relPath === "." || relPath === "") {
55260
- return path81.basename(path81.resolve(bridgeRoot)) || "repo";
55062
+ return path79.basename(path79.resolve(bridgeRoot)) || "repo";
55261
55063
  }
55262
- return path81.basename(relPath) || relPath;
55064
+ return path79.basename(relPath) || relPath;
55263
55065
  }
55264
55066
  async function discoverGitReposForBridgeContext(bridgeRoot) {
55265
- const root = path81.resolve(bridgeRoot);
55067
+ const root = path79.resolve(bridgeRoot);
55266
55068
  if (await isGitRepoDirectory(root)) {
55267
55069
  const remoteUrl = await getRemoteOriginUrl(root);
55268
55070
  return [{ absolutePath: root, remoteUrl }];
@@ -55270,19 +55072,19 @@ async function discoverGitReposForBridgeContext(bridgeRoot) {
55270
55072
  const [deep, shallow] = await Promise.all([discoverGitReposUnderRoot(root), discoverGitRepos(root)]);
55271
55073
  const byPath = /* @__PURE__ */ new Map();
55272
55074
  for (const repo of [...deep, ...shallow]) {
55273
- byPath.set(path81.resolve(repo.absolutePath), repo);
55075
+ byPath.set(path79.resolve(repo.absolutePath), repo);
55274
55076
  }
55275
55077
  return [...byPath.values()];
55276
55078
  }
55277
55079
  async function getBridgeGitContext(bridgeRoot = getBridgeRoot()) {
55278
- const bridgeResolved = path81.resolve(bridgeRoot);
55080
+ const bridgeResolved = path79.resolve(bridgeRoot);
55279
55081
  const repos = await discoverGitReposForBridgeContext(bridgeResolved);
55280
55082
  const rows = [];
55281
55083
  for (let i = 0; i < repos.length; i++) {
55282
55084
  if (i > 0) await yieldToEventLoop();
55283
55085
  const repo = repos[i];
55284
- let rel = path81.relative(bridgeResolved, repo.absolutePath);
55285
- if (rel.startsWith("..") || path81.isAbsolute(rel)) continue;
55086
+ let rel = path79.relative(bridgeResolved, repo.absolutePath);
55087
+ if (rel.startsWith("..") || path79.isAbsolute(rel)) continue;
55286
55088
  const relPath = rel === "" ? "." : rel.replace(/\\/g, "/");
55287
55089
  const currentBranch = await getCurrentBranch(repo.absolutePath);
55288
55090
  const remoteUrl = repo.remoteUrl.trim() || null;
@@ -55313,11 +55115,11 @@ async function getBridgeGitContext(bridgeRoot = getBridgeRoot()) {
55313
55115
  return rows;
55314
55116
  }
55315
55117
  async function listRepoBranchesForBridge(repoRelPath, bridgeRoot = getBridgeRoot()) {
55316
- const bridgeResolved = path81.resolve(bridgeRoot);
55118
+ const bridgeResolved = path79.resolve(bridgeRoot);
55317
55119
  const rel = repoRelPath.trim() === "." ? "" : repoRelPath.trim().replace(/\\/g, "/");
55318
- const repoPath = rel === "" ? bridgeResolved : path81.join(bridgeResolved, rel);
55319
- const resolved = path81.resolve(repoPath);
55320
- if (!resolved.startsWith(bridgeResolved + path81.sep) && resolved !== bridgeResolved) {
55120
+ const repoPath = rel === "" ? bridgeResolved : path79.join(bridgeResolved, rel);
55121
+ const resolved = path79.resolve(repoPath);
55122
+ if (!resolved.startsWith(bridgeResolved + path79.sep) && resolved !== bridgeResolved) {
55321
55123
  return [];
55322
55124
  }
55323
55125
  return listRepoBranchRefs(resolved);
@@ -55367,8 +55169,8 @@ function handleListRepoBranchesRequestMessage(msg, getWs) {
55367
55169
  }
55368
55170
 
55369
55171
  // ../bridge/src/git/checkout/bridge-git-checkout.ts
55370
- import * as fs58 from "node:fs/promises";
55371
- import * as path83 from "node:path";
55172
+ import * as fs57 from "node:fs/promises";
55173
+ import * as path81 from "node:path";
55372
55174
 
55373
55175
  // ../bridge/src/git/checkout/normalize-clone-url.ts
55374
55176
  function normalizeCloneUrl(url2) {
@@ -55388,12 +55190,12 @@ function cloneUrlWithHttpsAuth(url2, auth) {
55388
55190
  }
55389
55191
 
55390
55192
  // ../bridge/src/git/checkout/resolve-checkout-target.ts
55391
- import * as fs57 from "node:fs/promises";
55392
- import * as path82 from "node:path";
55193
+ import * as fs56 from "node:fs/promises";
55194
+ import * as path80 from "node:path";
55393
55195
  var FOLDER_NAME_RE = /^[A-Za-z0-9._-]+$/;
55394
55196
  async function pathExists(p) {
55395
55197
  try {
55396
- await fs57.access(p);
55198
+ await fs56.access(p);
55397
55199
  return true;
55398
55200
  } catch {
55399
55201
  return false;
@@ -55405,7 +55207,7 @@ async function resolveCheckoutTarget(opts) {
55405
55207
  if (await isGitRepoDirectory(bridgeRoot)) {
55406
55208
  throw new Error("Bridge root is already a git repository");
55407
55209
  }
55408
- const entries = await fs57.readdir(bridgeRoot).catch(() => []);
55210
+ const entries = await fs56.readdir(bridgeRoot).catch(() => []);
55409
55211
  if (entries.length > 0) {
55410
55212
  throw new Error("Bridge root must be empty to initialize a monorepo checkout");
55411
55213
  }
@@ -55418,8 +55220,8 @@ async function resolveCheckoutTarget(opts) {
55418
55220
  if (await isGitRepoDirectory(bridgeRoot)) {
55419
55221
  throw new Error("Cannot add a nested repo while the bridge root is itself a git repository");
55420
55222
  }
55421
- const targetDir = path82.resolve(bridgeRoot, folder);
55422
- if (!targetDir.startsWith(bridgeRoot + path82.sep)) {
55223
+ const targetDir = path80.resolve(bridgeRoot, folder);
55224
+ if (!targetDir.startsWith(bridgeRoot + path80.sep)) {
55423
55225
  throw new Error("Invalid folderName");
55424
55226
  }
55425
55227
  if (await pathExists(targetDir)) {
@@ -55438,10 +55240,10 @@ async function bridgeGitCheckout(params) {
55438
55240
  });
55439
55241
  const folderName = relPath === "." ? "repo" : relPath;
55440
55242
  beginPendingCheckout({ relPath, folderName, remoteUrl: cloneUrl });
55441
- const parent = path83.dirname(targetDir);
55442
- await fs58.mkdir(parent, { recursive: true });
55243
+ const parent = path81.dirname(targetDir);
55244
+ await fs57.mkdir(parent, { recursive: true });
55443
55245
  if (relPath !== ".") {
55444
- await fs58.mkdir(targetDir, { recursive: true });
55246
+ await fs57.mkdir(targetDir, { recursive: true });
55445
55247
  }
55446
55248
  const url2 = cloneUrlWithHttpsAuth(cloneUrl, params.auth ?? null);
55447
55249
  try {
@@ -55452,7 +55254,7 @@ async function bridgeGitCheckout(params) {
55452
55254
  return { relPath, folderName };
55453
55255
  } catch (e) {
55454
55256
  if (relPath !== ".") {
55455
- await fs58.rm(targetDir, { recursive: true, force: true }).catch(() => void 0);
55257
+ await fs57.rm(targetDir, { recursive: true, force: true }).catch(() => void 0);
55456
55258
  }
55457
55259
  const msg = e instanceof Error ? e.message : String(e);
55458
55260
  throw new Error(
@@ -56078,12 +55880,12 @@ function startStreamingProxy(ws, log2, pr) {
56078
55880
  }
56079
55881
 
56080
55882
  // src/config.ts
56081
- import fs59 from "node:fs";
56082
- import path84 from "node:path";
56083
- import os9 from "node:os";
55883
+ import fs58 from "node:fs";
55884
+ import path82 from "node:path";
55885
+ import os8 from "node:os";
56084
55886
  function getConfigPath() {
56085
- const dir = path84.join(os9.homedir(), ".buildautomaton");
56086
- return path84.join(dir, "config.json");
55887
+ const dir = path82.join(os8.homedir(), ".buildautomaton");
55888
+ return path82.join(dir, "config.json");
56087
55889
  }
56088
55890
  function normalizeApiUrl(url2) {
56089
55891
  return url2.replace(/\/$/, "");
@@ -56091,7 +55893,7 @@ function normalizeApiUrl(url2) {
56091
55893
  function readRawConfig() {
56092
55894
  try {
56093
55895
  const p = getConfigPath();
56094
- const raw = fs59.readFileSync(p, "utf8");
55896
+ const raw = fs58.readFileSync(p, "utf8");
56095
55897
  return JSON.parse(raw);
56096
55898
  } catch {
56097
55899
  return null;
@@ -56119,14 +55921,14 @@ function readConfigForApi(apiUrl) {
56119
55921
  }
56120
55922
  function writeConfigForApi(apiUrl, auth) {
56121
55923
  const p = getConfigPath();
56122
- const dir = path84.dirname(p);
55924
+ const dir = path82.dirname(p);
56123
55925
  const key = normalizeApiUrl(apiUrl);
56124
55926
  const prev = readRawConfig() ?? {};
56125
55927
  const servers = { ...prev.servers ?? {}, [key]: { ...auth } };
56126
55928
  const next = { ...prev, servers };
56127
55929
  try {
56128
- if (!fs59.existsSync(dir)) fs59.mkdirSync(dir, { recursive: true });
56129
- fs59.writeFileSync(p, JSON.stringify(next, null, 2), "utf8");
55930
+ if (!fs58.existsSync(dir)) fs58.mkdirSync(dir, { recursive: true });
55931
+ fs58.writeFileSync(p, JSON.stringify(next, null, 2), "utf8");
56130
55932
  } catch (e) {
56131
55933
  console.error("Could not save authentication config:", e);
56132
55934
  }
@@ -56135,22 +55937,22 @@ function clearConfigForApi(apiUrl) {
56135
55937
  const key = normalizeApiUrl(apiUrl);
56136
55938
  try {
56137
55939
  const p = getConfigPath();
56138
- if (!fs59.existsSync(p)) return;
55940
+ if (!fs58.existsSync(p)) return;
56139
55941
  const prev = readRawConfig();
56140
55942
  if (!prev) return;
56141
55943
  const servers = { ...prev.servers ?? {} };
56142
55944
  delete servers[key];
56143
55945
  const next = { ...prev, servers };
56144
55946
  if (Object.keys(servers).length === 0 && !prev.workspaceId) {
56145
- fs59.unlinkSync(p);
55947
+ fs58.unlinkSync(p);
56146
55948
  return;
56147
55949
  }
56148
55950
  if (Object.keys(servers).length === 0 && prev.workspaceId && prev.apiUrl && normalizeApiUrl(prev.apiUrl) === key) {
56149
55951
  const { workspaceId: _w, token: _t, refreshToken: _r, apiUrl: _a4, ...rest } = prev;
56150
- fs59.writeFileSync(p, JSON.stringify(rest, null, 2), "utf8");
55952
+ fs58.writeFileSync(p, JSON.stringify(rest, null, 2), "utf8");
56151
55953
  return;
56152
55954
  }
56153
- fs59.writeFileSync(p, JSON.stringify(next, null, 2), "utf8");
55955
+ fs58.writeFileSync(p, JSON.stringify(next, null, 2), "utf8");
56154
55956
  } catch {
56155
55957
  }
56156
55958
  }
@@ -56158,30 +55960,30 @@ function clearConfigForApi(apiUrl) {
56158
55960
  // ../../node_modules/.pnpm/open@10.2.0/node_modules/open/index.js
56159
55961
  import process8 from "node:process";
56160
55962
  import { Buffer as Buffer3 } from "node:buffer";
56161
- import path85 from "node:path";
55963
+ import path83 from "node:path";
56162
55964
  import { fileURLToPath as fileURLToPath7 } from "node:url";
56163
55965
  import { promisify as promisify8 } from "node:util";
56164
55966
  import childProcess from "node:child_process";
56165
- import fs64, { constants as fsConstants2 } from "node:fs/promises";
55967
+ import fs63, { constants as fsConstants2 } from "node:fs/promises";
56166
55968
 
56167
55969
  // ../../node_modules/.pnpm/wsl-utils@0.1.0/node_modules/wsl-utils/index.js
56168
55970
  import process4 from "node:process";
56169
- import fs63, { constants as fsConstants } from "node:fs/promises";
55971
+ import fs62, { constants as fsConstants } from "node:fs/promises";
56170
55972
 
56171
55973
  // ../../node_modules/.pnpm/is-wsl@3.1.1/node_modules/is-wsl/index.js
56172
55974
  import process3 from "node:process";
56173
- import os10 from "node:os";
56174
- import fs62 from "node:fs";
55975
+ import os9 from "node:os";
55976
+ import fs61 from "node:fs";
56175
55977
 
56176
55978
  // ../../node_modules/.pnpm/is-inside-container@1.0.0/node_modules/is-inside-container/index.js
56177
- import fs61 from "node:fs";
55979
+ import fs60 from "node:fs";
56178
55980
 
56179
55981
  // ../../node_modules/.pnpm/is-docker@3.0.0/node_modules/is-docker/index.js
56180
- import fs60 from "node:fs";
55982
+ import fs59 from "node:fs";
56181
55983
  var isDockerCached;
56182
55984
  function hasDockerEnv() {
56183
55985
  try {
56184
- fs60.statSync("/.dockerenv");
55986
+ fs59.statSync("/.dockerenv");
56185
55987
  return true;
56186
55988
  } catch {
56187
55989
  return false;
@@ -56189,7 +55991,7 @@ function hasDockerEnv() {
56189
55991
  }
56190
55992
  function hasDockerCGroup() {
56191
55993
  try {
56192
- return fs60.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
55994
+ return fs59.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
56193
55995
  } catch {
56194
55996
  return false;
56195
55997
  }
@@ -56205,7 +56007,7 @@ function isDocker() {
56205
56007
  var cachedResult;
56206
56008
  var hasContainerEnv = () => {
56207
56009
  try {
56208
- fs61.statSync("/run/.containerenv");
56010
+ fs60.statSync("/run/.containerenv");
56209
56011
  return true;
56210
56012
  } catch {
56211
56013
  return false;
@@ -56223,19 +56025,19 @@ var isWsl = () => {
56223
56025
  if (process3.platform !== "linux") {
56224
56026
  return false;
56225
56027
  }
56226
- if (os10.release().toLowerCase().includes("microsoft")) {
56028
+ if (os9.release().toLowerCase().includes("microsoft")) {
56227
56029
  if (isInsideContainer()) {
56228
56030
  return false;
56229
56031
  }
56230
56032
  return true;
56231
56033
  }
56232
56034
  try {
56233
- if (fs62.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft")) {
56035
+ if (fs61.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft")) {
56234
56036
  return !isInsideContainer();
56235
56037
  }
56236
56038
  } catch {
56237
56039
  }
56238
- if (fs62.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop") || fs62.existsSync("/run/WSL")) {
56040
+ if (fs61.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop") || fs61.existsSync("/run/WSL")) {
56239
56041
  return !isInsideContainer();
56240
56042
  }
56241
56043
  return false;
@@ -56253,14 +56055,14 @@ var wslDrivesMountPoint = /* @__PURE__ */ (() => {
56253
56055
  const configFilePath2 = "/etc/wsl.conf";
56254
56056
  let isConfigFileExists = false;
56255
56057
  try {
56256
- await fs63.access(configFilePath2, fsConstants.F_OK);
56058
+ await fs62.access(configFilePath2, fsConstants.F_OK);
56257
56059
  isConfigFileExists = true;
56258
56060
  } catch {
56259
56061
  }
56260
56062
  if (!isConfigFileExists) {
56261
56063
  return defaultMountPoint;
56262
56064
  }
56263
- const configContent = await fs63.readFile(configFilePath2, { encoding: "utf8" });
56065
+ const configContent = await fs62.readFile(configFilePath2, { encoding: "utf8" });
56264
56066
  const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
56265
56067
  if (!configMountPoint) {
56266
56068
  return defaultMountPoint;
@@ -56414,8 +56216,8 @@ async function defaultBrowser2() {
56414
56216
 
56415
56217
  // ../../node_modules/.pnpm/open@10.2.0/node_modules/open/index.js
56416
56218
  var execFile7 = promisify8(childProcess.execFile);
56417
- var __dirname = path85.dirname(fileURLToPath7(import.meta.url));
56418
- var localXdgOpenPath = path85.join(__dirname, "xdg-open");
56219
+ var __dirname = path83.dirname(fileURLToPath7(import.meta.url));
56220
+ var localXdgOpenPath = path83.join(__dirname, "xdg-open");
56419
56221
  var { platform, arch } = process8;
56420
56222
  async function getWindowsDefaultBrowserFromWsl() {
56421
56223
  const powershellPath = await powerShellPath();
@@ -56565,7 +56367,7 @@ var baseOpen = async (options) => {
56565
56367
  const isBundled = !__dirname || __dirname === "/";
56566
56368
  let exeLocalXdgOpen = false;
56567
56369
  try {
56568
- await fs64.access(localXdgOpenPath, fsConstants2.X_OK);
56370
+ await fs63.access(localXdgOpenPath, fsConstants2.X_OK);
56569
56371
  exeLocalXdgOpen = true;
56570
56372
  } catch {
56571
56373
  }
@@ -57487,34 +57289,10 @@ function enrichIntegrationContentPromptForAgent(params) {
57487
57289
  return injectIntegrationContentAgentPromptNote(params.agentPromptText, params.sessionId);
57488
57290
  }
57489
57291
 
57490
- // src/agents/planning/enrich-planning-session-prompt-for-agent.ts
57491
- async function enrichPlanningSessionPromptForAgent(params) {
57492
- const meta3 = await fetchCloudSessionMeta({
57493
- sessionId: params.sessionId,
57494
- cloudApiBaseUrl: params.cloudApiBaseUrl,
57495
- getCloudAccessToken: params.getCloudAccessToken
57496
- });
57497
- if (!meta3.ok) return { promptText: params.promptText, isPlanningSession: false };
57498
- const sessionKind = parseSessionKind(meta3.data.sessionKind);
57499
- if (sessionKind !== "planning") return { promptText: params.promptText, isPlanningSession: false };
57500
- const todos = Array.isArray(meta3.data.planningTodos) ? meta3.data.planningTodos : [];
57501
- if (params.isNewSession || todos.length === 0) {
57502
- return {
57503
- promptText: buildPlanningSessionAgentPrompt(params.promptText),
57504
- isPlanningSession: true
57505
- };
57506
- }
57507
- return {
57508
- promptText: buildPlanningSessionFollowUpAgentPrompt(params.promptText, todos),
57509
- isPlanningSession: true
57510
- };
57511
- }
57512
-
57513
57292
  // src/plugin/prepare-ba-agent-prompt.ts
57514
57293
  async function prepareBuildAutomatonAgentPrompt(params) {
57515
- const { promptText, sessionId, runId, isNewSession, cloudApiBaseUrl, getCloudAccessToken } = params;
57294
+ const { promptText, sessionId, cloudApiBaseUrl, getCloudAccessToken } = params;
57516
57295
  let agentPromptText = promptText;
57517
- let isPlanningSession = false;
57518
57296
  if (sessionId) {
57519
57297
  agentPromptText = await enrichForkedSessionPromptForAgent({
57520
57298
  sessionId,
@@ -57522,88 +57300,15 @@ async function prepareBuildAutomatonAgentPrompt(params) {
57522
57300
  cloudApiBaseUrl,
57523
57301
  getCloudAccessToken
57524
57302
  });
57525
- const planningEnriched = await enrichPlanningSessionPromptForAgent({
57526
- sessionId,
57527
- promptText: agentPromptText,
57528
- isNewSession,
57529
- cloudApiBaseUrl,
57530
- getCloudAccessToken
57531
- });
57532
- agentPromptText = planningEnriched.promptText;
57533
- isPlanningSession = planningEnriched.isPlanningSession;
57534
- }
57535
- if (sessionId) {
57536
57303
  agentPromptText = enrichIntegrationContentPromptForAgent({
57537
57304
  sessionId,
57538
57305
  originalPromptText: promptText,
57539
57306
  agentPromptText
57540
57307
  });
57541
57308
  }
57542
- return { agentPromptText, isPlanningSession };
57543
- }
57544
-
57545
- // src/agents/planning/submit-planning-todos-for-turn.ts
57546
- var PLANNING_TODO_SUBMIT_TIMEOUT_MS = 3e3;
57547
- async function submitPlanningTodosForTurn(params) {
57548
- const token = params.getCloudAccessToken();
57549
- if (!token.trim()) return { ok: false, error: "Missing cloud access token" };
57550
- const base = params.cloudApiBaseUrl.replace(/\/$/, "");
57551
- const url2 = `${base}/internal/sessions/todos/submit`;
57552
- let res;
57553
- try {
57554
- res = await fetch(url2, {
57555
- method: "POST",
57556
- signal: AbortSignal.timeout(PLANNING_TODO_SUBMIT_TIMEOUT_MS),
57557
- headers: {
57558
- Authorization: `Bearer ${token}`,
57559
- "Content-Type": "application/json"
57560
- },
57561
- body: JSON.stringify({
57562
- sessionId: params.sessionId,
57563
- turnId: params.turnId,
57564
- items: params.items
57565
- })
57566
- });
57567
- } catch (error51) {
57568
- return { ok: false, error: error51 instanceof Error ? error51.message : String(error51) };
57569
- }
57570
- if (!res.ok) {
57571
- const body = await res.json().catch(() => null);
57572
- return { ok: false, error: body?.error ?? `Planning todo submit failed (${res.status})` };
57573
- }
57574
- return { ok: true };
57575
- }
57576
-
57577
- // src/agents/planning/maybe-submit-planning-todos-after-agent-success.ts
57578
- async function maybeSubmitPlanningTodosAfterAgentSuccess(params) {
57579
- const { sessionId, runId, resultSuccess, output, cloudApiBaseUrl, getCloudAccessToken, log: log2 } = params;
57580
- const buffered = runId ? getPlanningSessionTurnOutput(runId) : "";
57581
- const outputFromResult = typeof output === "string" ? output : "";
57582
- const outputStr = buffered.trim() !== "" ? buffered : outputFromResult;
57583
- if (!sessionId || !runId || !resultSuccess || outputStr.trim() === "") {
57584
- return { submitted: false, suppressOutput: false };
57585
- }
57586
- if (!cloudApiBaseUrl || !getCloudAccessToken) {
57587
- return { submitted: false, suppressOutput: false };
57588
- }
57589
- const items = parsePlanningTodoAgentJson(outputStr);
57590
- if (items.length === 0) {
57591
- return { submitted: false, suppressOutput: false };
57592
- }
57593
- const result = await submitPlanningTodosForTurn({
57594
- sessionId,
57595
- turnId: runId,
57596
- items,
57597
- cloudApiBaseUrl,
57598
- getCloudAccessToken
57599
- });
57600
- if (!result.ok) {
57601
- log2(`[Agent] Planning todo submit failed: ${result.error}`);
57602
- return { submitted: false, suppressOutput: false };
57603
- }
57604
- if (runId) consumePlanningSessionTurnOutput(runId);
57605
- log2(`[Agent] Planning session: stored ${items.length} todo(s) via internal API`);
57606
- return { submitted: true, suppressOutput: true };
57309
+ void params.runId;
57310
+ void params.isNewSession;
57311
+ return { agentPromptText, isPlanningSession: false };
57607
57312
  }
57608
57313
 
57609
57314
  // src/e2e-certificates/open-import-url.ts
@@ -57962,11 +57667,6 @@ function createBuildAutomatonPlugin(options) {
57962
57667
  cloudApiBaseUrl: apiUrl,
57963
57668
  getCloudAccessToken: getAccessToken
57964
57669
  }),
57965
- maybeSubmitPlanningTodos: (params) => maybeSubmitPlanningTodosAfterAgentSuccess({
57966
- ...params,
57967
- cloudApiBaseUrl: apiUrl,
57968
- getCloudAccessToken: getAccessToken
57969
- }),
57970
57670
  persistTokens: (tokens) => writeConfigForApi(apiUrl, {
57971
57671
  workspaceId: tokens.workspaceId,
57972
57672
  token: tokens.token,
@@ -57985,13 +57685,13 @@ function toTokens(auth) {
57985
57685
  }
57986
57686
 
57987
57687
  // src/cli/chdir-to-bridge-root.ts
57988
- import * as fs65 from "node:fs";
57989
- import * as path86 from "node:path";
57688
+ import * as fs64 from "node:fs";
57689
+ import * as path84 from "node:path";
57990
57690
  function chdirToBridgeRoot(bridgeRootOpt) {
57991
57691
  if (!bridgeRootOpt) return;
57992
- const resolved = path86.resolve(process.cwd(), bridgeRootOpt);
57692
+ const resolved = path84.resolve(process.cwd(), bridgeRootOpt);
57993
57693
  try {
57994
- if (!fs65.statSync(resolved).isDirectory()) {
57694
+ if (!fs64.statSync(resolved).isDirectory()) {
57995
57695
  console.error(`Bridge root is not a directory: ${resolved}`);
57996
57696
  process.exit(1);
57997
57697
  }
@@ -58025,7 +57725,7 @@ async function runCliAction(program2, opts) {
58025
57725
  initBridgeRoot();
58026
57726
  console.log(colorize(GOLDEN_YELLOW, `[Bridge] Using ${getBridgeRoot()} as the bridge root.`));
58027
57727
  let worktreesRootPath;
58028
- if (opts.worktreesRoot?.trim()) worktreesRootPath = path87.resolve(opts.worktreesRoot.trim());
57728
+ if (opts.worktreesRoot?.trim()) worktreesRootPath = path85.resolve(opts.worktreesRoot.trim());
58029
57729
  const e2eCertificates = opts.e2eeCertificatesDir?.trim() ? await loadOrCreateE2eCertificates(opts.e2eeCertificatesDir.trim()) : void 0;
58030
57730
  if (e2eCertificates) {
58031
57731
  const action = e2eCertificates.generated ? "Generated" : "Loaded";