@sideboard-ai/core 0.1.116 → 0.1.117

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/agents/cursor-runner.cjs +74 -59
  2. package/dist/agents/cursor-runner.js +10 -9
  3. package/dist/{agents-7NIX44RB.js → agents-GUEKGV7V.js} +6 -6
  4. package/dist/{agents-DU7DHY7A.js → agents-OCGAZCKT.js} +5 -5
  5. package/dist/{chunk-OFF5AFCR.js → chunk-4CDCTYTM.js} +5 -4
  6. package/dist/{chunk-XOYQ7LNQ.js → chunk-4NAW5BAQ.js} +3 -3
  7. package/dist/{chunk-4OJMZ6P2.js → chunk-4WV7C7WP.js} +3 -3
  8. package/dist/{chunk-DWP25N32.js → chunk-5X7GRP5W.js} +44 -20
  9. package/dist/{chunk-4HOFVKPC.js → chunk-74YJHND6.js} +43 -19
  10. package/dist/{chunk-ZRCX43LS.js → chunk-BKVDZV7X.js} +2 -2
  11. package/dist/{chunk-A4VZXJEJ.js → chunk-HPAWHIZ3.js} +4 -1
  12. package/dist/{chunk-GBY7OOMB.js → chunk-NZBDVBCP.js} +1 -1
  13. package/dist/{chunk-KYOTBZ6S.js → chunk-RG737OWT.js} +4 -1
  14. package/dist/{chunk-K3TIQXOH.js → chunk-U3IVCVLH.js} +2 -2
  15. package/dist/{chunk-FZCIQYNQ.js → chunk-VGPLXQIH.js} +1 -1
  16. package/dist/chunk-VHX673DI.js +32 -0
  17. package/dist/{chunk-ZMROW673.js → chunk-WCU3FHEI.js} +1 -1
  18. package/dist/{chunk-7WC5UWEB.js → chunk-X3NIPGQT.js} +1 -1
  19. package/dist/{chunk-ZYEFCSZJ.js → chunk-XTZQL7OU.js} +1 -1
  20. package/dist/{chunk-5KSLD4MU.js → chunk-YJ2WV5TZ.js} +5 -4
  21. package/dist/{coordinator-prompt-4KCALEKD.js → coordinator-prompt-QMV6YEP5.js} +3 -3
  22. package/dist/{coordinator-prompt-FML4I5AR.js → coordinator-prompt-XCBHAOGE.js} +3 -3
  23. package/dist/cursor-recover-NOQYOFRF.js +76 -0
  24. package/dist/{cursor-recover-JBTIDARH.js → cursor-recover-QSLWEZNA.js} +12 -7
  25. package/dist/{global-workspace-CSWABOG5.js → global-workspace-SBKXKQFS.js} +4 -4
  26. package/dist/{global-workspace-H4YNASM6.js → global-workspace-Z37MNYU6.js} +4 -4
  27. package/dist/index.cjs +301 -227
  28. package/dist/index.d.cts +7 -1
  29. package/dist/index.d.ts +7 -1
  30. package/dist/index.js +10 -8
  31. package/dist/mcp/run-stdio.cjs +296 -224
  32. package/dist/mcp/run-stdio.js +7 -7
  33. package/dist/{orchestrator-NXPANCZA.js → orchestrator-4PKR6AZJ.js} +7 -7
  34. package/dist/{orchestrator-ZY4RUJKT.js → orchestrator-MKTZYWTI.js} +8 -8
  35. package/dist/{thread-store-OEALWU7Y.js → thread-store-JR235AWK.js} +3 -1
  36. package/dist/{thread-store-LPTBVW5C.js → thread-store-PMH3BMB6.js} +3 -1
  37. package/dist/{workspaces-HJ3EVATC.js → workspaces-C3TJJFY3.js} +5 -5
  38. package/dist/{workspaces-QG6PGFQR.js → workspaces-M4OICPWF.js} +5 -5
  39. package/dist/{worktree-IW3BX26B.js → worktree-7AEKZSEX.js} +2 -2
  40. package/dist/{worktree-OTFQO2W7.js → worktree-MRSTQ32S.js} +2 -2
  41. package/package.json +1 -1
  42. package/dist/cursor-recover-ZUJG6XRQ.js +0 -42
package/dist/index.cjs CHANGED
@@ -1955,6 +1955,7 @@ __export(thread_store_exports, {
1955
1955
  createEmptyThread: () => createEmptyThread,
1956
1956
  deleteThreadRecord: () => deleteThreadRecord,
1957
1957
  findThreadByRef: () => findThreadByRef,
1958
+ isThreadRecordFile: () => isThreadRecordFile,
1958
1959
  listThreads: () => listThreads,
1959
1960
  normalizeThread: () => normalizeThread,
1960
1961
  readThread: () => readThread,
@@ -2065,7 +2066,8 @@ function writeThread(thread) {
2065
2066
  function idPath(id) {
2066
2067
  return id;
2067
2068
  }
2068
- function isThreadRecordFile(name) {
2069
+ function isThreadRecordFile(nameOrPath) {
2070
+ const name = (0, import_node_path10.basename)(nameOrPath);
2069
2071
  return name.endsWith(".json") && !name.endsWith(".live.json");
2070
2072
  }
2071
2073
  function listThreads(opts) {
@@ -2116,12 +2118,13 @@ function findThreadByRef(ref) {
2116
2118
  (t) => t.id === ref || t.id.startsWith(ref) || t.branchName === ref || t.title === ref
2117
2119
  ) ?? null;
2118
2120
  }
2119
- var import_node_crypto3, import_node_fs9, import_proper_lockfile;
2121
+ var import_node_crypto3, import_node_fs9, import_node_path10, import_proper_lockfile;
2120
2122
  var init_thread_store = __esm({
2121
2123
  "src/store/thread-store.ts"() {
2122
2124
  "use strict";
2123
2125
  import_node_crypto3 = require("crypto");
2124
2126
  import_node_fs9 = require("fs");
2127
+ import_node_path10 = require("path");
2125
2128
  import_proper_lockfile = __toESM(require("proper-lockfile"), 1);
2126
2129
  init_thinking_effort();
2127
2130
  init_paths();
@@ -2160,7 +2163,7 @@ var init_orchestrator_capable = __esm({
2160
2163
 
2161
2164
  // src/store/schedules.ts
2162
2165
  function schedulesPath() {
2163
- return (0, import_node_path10.join)(appDataDir(), "schedules.json");
2166
+ return (0, import_node_path11.join)(appDataDir(), "schedules.json");
2164
2167
  }
2165
2168
  function parseDurationMs(every) {
2166
2169
  const m = every.trim().match(DURATION_RE);
@@ -2383,13 +2386,13 @@ function recordScheduleRun(id, result) {
2383
2386
  writeAll(rows);
2384
2387
  return next;
2385
2388
  }
2386
- var import_node_crypto4, import_node_fs10, import_node_path10, import_croner, DURATION_RE, UNIT_MS;
2389
+ var import_node_crypto4, import_node_fs10, import_node_path11, import_croner, DURATION_RE, UNIT_MS;
2387
2390
  var init_schedules = __esm({
2388
2391
  "src/store/schedules.ts"() {
2389
2392
  "use strict";
2390
2393
  import_node_crypto4 = require("crypto");
2391
2394
  import_node_fs10 = require("fs");
2392
- import_node_path10 = require("path");
2395
+ import_node_path11 = require("path");
2393
2396
  import_croner = require("croner");
2394
2397
  init_orchestrator_capable();
2395
2398
  init_paths();
@@ -2406,7 +2409,7 @@ var init_schedules = __esm({
2406
2409
 
2407
2410
  // src/store/desktop-host.ts
2408
2411
  function desktopHostPidPath() {
2409
- return (0, import_node_path11.join)(appDataDir(), "desktop-host.pid");
2412
+ return (0, import_node_path12.join)(appDataDir(), "desktop-host.pid");
2410
2413
  }
2411
2414
  function claimDesktopHost(pid = process.pid) {
2412
2415
  (0, import_node_fs11.writeFileSync)(desktopHostPidPath(), `${pid}
@@ -2447,12 +2450,12 @@ function thisProcessShouldDrainAgentQueues() {
2447
2450
  if (isThisProcessDesktopHost()) return true;
2448
2451
  return !isDesktopHostAlive();
2449
2452
  }
2450
- var import_node_fs11, import_node_path11;
2453
+ var import_node_fs11, import_node_path12;
2451
2454
  var init_desktop_host = __esm({
2452
2455
  "src/store/desktop-host.ts"() {
2453
2456
  "use strict";
2454
2457
  import_node_fs11 = require("fs");
2455
- import_node_path11 = require("path");
2458
+ import_node_path12 = require("path");
2456
2459
  init_paths();
2457
2460
  }
2458
2461
  });
@@ -3404,18 +3407,18 @@ var init_gh_errors = __esm({
3404
3407
  function githubAgentAuthDir() {
3405
3408
  const override = process.env.SIDEBOARD_GIT_AUTH_DIR?.trim();
3406
3409
  if (override) return override;
3407
- return (0, import_node_path12.join)((0, import_node_os4.homedir)(), ".sideboard-git-auth");
3410
+ return (0, import_node_path13.join)((0, import_node_os4.homedir)(), ".sideboard-git-auth");
3408
3411
  }
3409
3412
  function githubCredentialStorePath() {
3410
- return (0, import_node_path12.join)(githubAgentAuthDir(), "git-credentials");
3413
+ return (0, import_node_path13.join)(githubAgentAuthDir(), "git-credentials");
3411
3414
  }
3412
3415
  function githubGhConfigDir() {
3413
- return (0, import_node_path12.join)(githubAgentAuthDir(), "gh");
3416
+ return (0, import_node_path13.join)(githubAgentAuthDir(), "gh");
3414
3417
  }
3415
3418
  function writePrivateFile2(file, body) {
3416
- (0, import_node_fs12.mkdirSync)((0, import_node_path12.dirname)(file), { recursive: true, mode: 448 });
3419
+ (0, import_node_fs12.mkdirSync)((0, import_node_path13.dirname)(file), { recursive: true, mode: 448 });
3417
3420
  try {
3418
- (0, import_node_fs12.chmodSync)((0, import_node_path12.dirname)(file), 448);
3421
+ (0, import_node_fs12.chmodSync)((0, import_node_path13.dirname)(file), 448);
3419
3422
  } catch {
3420
3423
  }
3421
3424
  (0, import_node_fs12.writeFileSync)(file, body, { encoding: "utf8", mode: 384 });
@@ -3453,11 +3456,11 @@ function materializeGithubAgentAuth(token, user) {
3453
3456
  writePrivateFile2(githubCredentialStorePath(), gitCredentialStoreContents(trimmed));
3454
3457
  const ghDir = githubGhConfigDir();
3455
3458
  (0, import_node_fs12.mkdirSync)(ghDir, { recursive: true, mode: 448 });
3456
- writePrivateFile2((0, import_node_path12.join)(ghDir, "hosts.yml"), ghHostsYml(trimmed, user));
3457
- writePrivateFile2((0, import_node_path12.join)(ghDir, "config.yml"), "git_protocol: https\nprompt: disabled\n");
3459
+ writePrivateFile2((0, import_node_path13.join)(ghDir, "hosts.yml"), ghHostsYml(trimmed, user));
3460
+ writePrivateFile2((0, import_node_path13.join)(ghDir, "config.yml"), "git_protocol: https\nprompt: disabled\n");
3458
3461
  }
3459
3462
  function githubAgentAuthReady() {
3460
- return (0, import_node_fs12.existsSync)(githubCredentialStorePath()) && (0, import_node_fs12.existsSync)((0, import_node_path12.join)(githubGhConfigDir(), "hosts.yml"));
3463
+ return (0, import_node_fs12.existsSync)(githubCredentialStorePath()) && (0, import_node_fs12.existsSync)((0, import_node_path13.join)(githubGhConfigDir(), "hosts.yml"));
3461
3464
  }
3462
3465
  function githubCredentialHelperGitConfig() {
3463
3466
  const file = githubCredentialStorePath();
@@ -3472,13 +3475,13 @@ function githubGhConfigEnv() {
3472
3475
  GH_PROMPT_DISABLED: "1"
3473
3476
  };
3474
3477
  }
3475
- var import_node_fs12, import_node_os4, import_node_path12;
3478
+ var import_node_fs12, import_node_os4, import_node_path13;
3476
3479
  var init_github_agent_auth = __esm({
3477
3480
  "src/git/github-agent-auth.ts"() {
3478
3481
  "use strict";
3479
3482
  import_node_fs12 = require("fs");
3480
3483
  import_node_os4 = require("os");
3481
- import_node_path12 = require("path");
3484
+ import_node_path13 = require("path");
3482
3485
  }
3483
3486
  });
3484
3487
 
@@ -3486,15 +3489,15 @@ var init_github_agent_auth = __esm({
3486
3489
  function prependPathDir(env, dir) {
3487
3490
  if (!dir || !(0, import_node_fs13.existsSync)(dir)) return;
3488
3491
  const current = env.PATH ?? "";
3489
- const parts = current.split(import_node_path13.delimiter).filter(Boolean);
3492
+ const parts = current.split(import_node_path14.delimiter).filter(Boolean);
3490
3493
  if (parts.includes(dir)) {
3491
3494
  env.PATH = current;
3492
3495
  return;
3493
3496
  }
3494
- env.PATH = [dir, ...parts].join(import_node_path13.delimiter);
3497
+ env.PATH = [dir, ...parts].join(import_node_path14.delimiter);
3495
3498
  }
3496
3499
  function conductorBundledBinDir(home = process.env.HOME || process.env.USERPROFILE || (0, import_node_os5.homedir)()) {
3497
- return (0, import_node_path13.join)(home, "Library", "Application Support", "com.conductor.app", "bin");
3500
+ return (0, import_node_path14.join)(home, "Library", "Application Support", "com.conductor.app", "bin");
3498
3501
  }
3499
3502
  function isConductorBundledCli(filePath) {
3500
3503
  const p = (filePath ?? "").replace(/\\/g, "/");
@@ -3503,10 +3506,10 @@ function isConductorBundledCli(filePath) {
3503
3506
  function ensureAgentPath(env = process.env) {
3504
3507
  const home = env.HOME || env.USERPROFILE || (0, import_node_os5.homedir)();
3505
3508
  const current = env.PATH ?? "";
3506
- const parts = current.split(import_node_path13.delimiter).filter(Boolean);
3509
+ const parts = current.split(import_node_path14.delimiter).filter(Boolean);
3507
3510
  const seen = new Set(parts);
3508
3511
  const extras = [
3509
- ...EXTRA_BIN_DIRS.map((rel) => (0, import_node_path13.join)(home, rel)),
3512
+ ...EXTRA_BIN_DIRS.map((rel) => (0, import_node_path14.join)(home, rel)),
3510
3513
  "/opt/homebrew/bin",
3511
3514
  "/usr/local/bin",
3512
3515
  // Keep after Homebrew/npm so a user-installed CLI still wins.
@@ -3517,7 +3520,7 @@ function ensureAgentPath(env = process.env) {
3517
3520
  parts.unshift(dir);
3518
3521
  seen.add(dir);
3519
3522
  }
3520
- const next = parts.join(import_node_path13.delimiter);
3523
+ const next = parts.join(import_node_path14.delimiter);
3521
3524
  env.PATH = next;
3522
3525
  return next;
3523
3526
  }
@@ -3531,7 +3534,7 @@ function enrichPathWithNpmGlobalBin(env = process.env) {
3531
3534
  stdio: ["ignore", "pipe", "ignore"]
3532
3535
  }).trim().split(/\r?\n/).find(Boolean);
3533
3536
  if (prefix) {
3534
- const binDir = process.platform === "win32" ? prefix : (0, import_node_path13.join)(prefix, "bin");
3537
+ const binDir = process.platform === "win32" ? prefix : (0, import_node_path14.join)(prefix, "bin");
3535
3538
  prependPathDir(env, binDir);
3536
3539
  }
3537
3540
  } catch {
@@ -3559,14 +3562,14 @@ function withExportedPath(command, pathValue) {
3559
3562
  if (/^(export\s+PATH=|PATH=)/.test(trimmed)) return trimmed;
3560
3563
  return `export PATH=${posixShellSingleQuote(pathValue)} && ${trimmed}`;
3561
3564
  }
3562
- var import_node_fs13, import_node_child_process3, import_node_os5, import_node_path13, EXTRA_BIN_DIRS;
3565
+ var import_node_fs13, import_node_child_process3, import_node_os5, import_node_path14, EXTRA_BIN_DIRS;
3563
3566
  var init_path = __esm({
3564
3567
  "src/agents/path.ts"() {
3565
3568
  "use strict";
3566
3569
  import_node_fs13 = require("fs");
3567
3570
  import_node_child_process3 = require("child_process");
3568
3571
  import_node_os5 = require("os");
3569
- import_node_path13 = require("path");
3572
+ import_node_path14 = require("path");
3570
3573
  EXTRA_BIN_DIRS = [
3571
3574
  ".local/bin",
3572
3575
  ".cargo/bin",
@@ -3588,7 +3591,7 @@ function isIndexLockError(text4) {
3588
3591
  return /Unable to create ['"][^'"]*index\.lock['"]: File exists/i.test(text4);
3589
3592
  }
3590
3593
  function clearStaleIndexLock(gitDir, maxAgeMs = STALE_INDEX_LOCK_MS, now = Date.now()) {
3591
- const lockPath = (0, import_node_path14.join)(gitDir, "index.lock");
3594
+ const lockPath = (0, import_node_path15.join)(gitDir, "index.lock");
3592
3595
  try {
3593
3596
  if (!(0, import_node_fs14.existsSync)(lockPath)) return null;
3594
3597
  if (now - (0, import_node_fs14.statSync)(lockPath).mtimeMs < maxAgeMs) return null;
@@ -3607,12 +3610,12 @@ function clearStaleIndexLocks(gitDirs, maxAgeMs = STALE_INDEX_LOCK_MS) {
3607
3610
  }
3608
3611
  return removed;
3609
3612
  }
3610
- var import_node_fs14, import_node_path14, STALE_INDEX_LOCK_MS;
3613
+ var import_node_fs14, import_node_path15, STALE_INDEX_LOCK_MS;
3611
3614
  var init_stale_lock = __esm({
3612
3615
  "src/git/stale-lock.ts"() {
3613
3616
  "use strict";
3614
3617
  import_node_fs14 = require("fs");
3615
- import_node_path14 = require("path");
3618
+ import_node_path15 = require("path");
3616
3619
  STALE_INDEX_LOCK_MS = 2e4;
3617
3620
  }
3618
3621
  });
@@ -3820,7 +3823,7 @@ async function warmGithubAgentAuth(opts) {
3820
3823
  }
3821
3824
  function normalizeWritableRoot(raw) {
3822
3825
  const trimmed = raw.trim().replace(/\/+$/, "");
3823
- return trimmed && (0, import_node_path15.isAbsolute)(trimmed) ? trimmed : null;
3826
+ return trimmed && (0, import_node_path16.isAbsolute)(trimmed) ? trimmed : null;
3824
3827
  }
3825
3828
  async function resolveCodexGitWritableRoots(cwd) {
3826
3829
  const roots = /* @__PURE__ */ new Set();
@@ -3897,11 +3900,11 @@ function formatGitAuthModeDirective(mode) {
3897
3900
  ].join("\n");
3898
3901
  }
3899
3902
  }
3900
- var import_node_path15, HTTPS_REWRITE, TOKEN_TTL_MS, tokenMemo, GITHUB_CHILD_TOKEN_KEYS;
3903
+ var import_node_path16, HTTPS_REWRITE, TOKEN_TTL_MS, tokenMemo, GITHUB_CHILD_TOKEN_KEYS;
3901
3904
  var init_git_auth_mode = __esm({
3902
3905
  "src/git/git-auth-mode.ts"() {
3903
3906
  "use strict";
3904
- import_node_path15 = require("path");
3907
+ import_node_path16 = require("path");
3905
3908
  init_app_settings();
3906
3909
  init_github_agent_auth();
3907
3910
  init_run();
@@ -5099,7 +5102,7 @@ function isLocalPrFetchBranch(ref) {
5099
5102
  }
5100
5103
  async function createThreadWorktree(opts) {
5101
5104
  let branchName = `thread/${opts.slug}`;
5102
- const worktreePath = (0, import_node_path16.join)(worktreesRoot(opts.repoPath), opts.slug);
5105
+ const worktreePath = (0, import_node_path17.join)(worktreesRoot(opts.repoPath), opts.slug);
5103
5106
  if ((0, import_node_fs15.existsSync)(worktreePath)) {
5104
5107
  throw new Error(`Worktree already exists at ${worktreePath}`);
5105
5108
  }
@@ -5167,7 +5170,7 @@ ${add.stdout}`;
5167
5170
  async function createExistingBranchWorktree(opts) {
5168
5171
  const branchName = opts.branchName.trim();
5169
5172
  if (!branchName) throw new Error("branch name required");
5170
- const worktreePath = (0, import_node_path16.join)(worktreesRoot(opts.repoPath), opts.slug);
5173
+ const worktreePath = (0, import_node_path17.join)(worktreesRoot(opts.repoPath), opts.slug);
5171
5174
  if ((0, import_node_fs15.existsSync)(worktreePath)) {
5172
5175
  throw new Error(`Worktree already exists at ${worktreePath}`);
5173
5176
  }
@@ -5459,7 +5462,7 @@ function sameRepoPath(a, b) {
5459
5462
  return normalizeWorktreePath(a) === normalizeWorktreePath(b);
5460
5463
  }
5461
5464
  function listLocalThreadBranchSlugs(repoPath) {
5462
- const refsDir = (0, import_node_path16.join)(repoPath, ".git", "refs", "heads", "thread");
5465
+ const refsDir = (0, import_node_path17.join)(repoPath, ".git", "refs", "heads", "thread");
5463
5466
  if (!(0, import_node_fs15.existsSync)(refsDir)) return [];
5464
5467
  try {
5465
5468
  return (0, import_node_fs15.readdirSync)(refsDir).filter((name) => !name.startsWith(".")).map((name) => normalizeTakenSlug(name));
@@ -5492,18 +5495,18 @@ function allocateTeamSlug(repoPath) {
5492
5495
  const taken = collectTakenTeamSlugs(repoPath);
5493
5496
  for (let attempt = 0; attempt < 32; attempt++) {
5494
5497
  const team = allocateTeamName(taken);
5495
- const path2 = (0, import_node_path16.join)(worktreesRoot(repoPath), team.slug);
5498
+ const path2 = (0, import_node_path17.join)(worktreesRoot(repoPath), team.slug);
5496
5499
  if (!(0, import_node_fs15.existsSync)(path2)) return team;
5497
5500
  taken.add(team.slug);
5498
5501
  }
5499
5502
  throw new Error("No available soccer team worktree directories left");
5500
5503
  }
5501
- var import_node_fs15, import_node_path16;
5504
+ var import_node_fs15, import_node_path17;
5502
5505
  var init_worktree = __esm({
5503
5506
  "src/git/worktree.ts"() {
5504
5507
  "use strict";
5505
5508
  import_node_fs15 = require("fs");
5506
- import_node_path16 = require("path");
5509
+ import_node_path17 = require("path");
5507
5510
  init_paths();
5508
5511
  init_thread_store();
5509
5512
  init_teams();
@@ -5588,7 +5591,7 @@ function ensureGlobalCoordinatorCwd(opts) {
5588
5591
  let orchId = opts?.orchestratorThreadId?.trim() || "";
5589
5592
  if (!orchId) {
5590
5593
  try {
5591
- const existing = (0, import_node_fs16.readFileSync)((0, import_node_path17.join)(dir, "AGENTS.md"), "utf8");
5594
+ const existing = (0, import_node_fs16.readFileSync)((0, import_node_path18.join)(dir, "AGENTS.md"), "utf8");
5592
5595
  const m = existing.match(
5593
5596
  /YOUR orchestration thread id is `([0-9a-f-]{36})`/i
5594
5597
  );
@@ -5630,9 +5633,9 @@ function ensureGlobalCoordinatorCwd(opts) {
5630
5633
  "Always ask worktree agents to commit, push, and open draft PRs (`ask_git` / `send_to_thread`). Tell them to merge only when the user explicitly asked. The worktree agent runs git/gh; never merge from this orchestration cwd."
5631
5634
  ].join("\n");
5632
5635
  try {
5633
- (0, import_node_fs16.writeFileSync)((0, import_node_path17.join)(dir, "CLAUDE.md"), `${body}
5636
+ (0, import_node_fs16.writeFileSync)((0, import_node_path18.join)(dir, "CLAUDE.md"), `${body}
5634
5637
  `, "utf8");
5635
- (0, import_node_fs16.writeFileSync)((0, import_node_path17.join)(dir, "AGENTS.md"), `${body}
5638
+ (0, import_node_fs16.writeFileSync)((0, import_node_path18.join)(dir, "AGENTS.md"), `${body}
5636
5639
  `, "utf8");
5637
5640
  } catch {
5638
5641
  }
@@ -5664,12 +5667,12 @@ function coordinatorSystemPrompt(opts) {
5664
5667
  formatWorkspaceInventory(opts.workspaces)
5665
5668
  ].join("\n");
5666
5669
  }
5667
- var import_node_fs16, import_node_path17, COORDINATOR_TOOL_PLAYBOOK, SLACK_REPLY_FORMATTING;
5670
+ var import_node_fs16, import_node_path18, COORDINATOR_TOOL_PLAYBOOK, SLACK_REPLY_FORMATTING;
5668
5671
  var init_coordinator_prompt = __esm({
5669
5672
  "src/orchestrator/coordinator-prompt.ts"() {
5670
5673
  "use strict";
5671
5674
  import_node_fs16 = require("fs");
5672
- import_node_path17 = require("path");
5675
+ import_node_path18 = require("path");
5673
5676
  init_worktree();
5674
5677
  init_app_settings();
5675
5678
  init_paths();
@@ -6012,7 +6015,7 @@ var init_api = __esm({
6012
6015
 
6013
6016
  // src/slack/reply-target.ts
6014
6017
  function storePath() {
6015
- return (0, import_node_path18.join)(appDataDir(), "slack-reply-to.json");
6018
+ return (0, import_node_path19.join)(appDataDir(), "slack-reply-to.json");
6016
6019
  }
6017
6020
  function readStore() {
6018
6021
  const path2 = storePath();
@@ -6033,12 +6036,12 @@ function setSlackReplyTarget(target) {
6033
6036
  function getSlackReplyTarget(threadId) {
6034
6037
  return readStore()[threadId] ?? null;
6035
6038
  }
6036
- var import_node_fs17, import_node_path18;
6039
+ var import_node_fs17, import_node_path19;
6037
6040
  var init_reply_target = __esm({
6038
6041
  "src/slack/reply-target.ts"() {
6039
6042
  "use strict";
6040
6043
  import_node_fs17 = require("fs");
6041
- import_node_path18 = require("path");
6044
+ import_node_path19 = require("path");
6042
6045
  init_paths();
6043
6046
  init_private_file();
6044
6047
  init_secure_file();
@@ -6047,7 +6050,7 @@ var init_reply_target = __esm({
6047
6050
 
6048
6051
  // src/slack/workspaces.ts
6049
6052
  function storePath2() {
6050
- return (0, import_node_path19.join)(appDataDir(), "slack-workspaces.json");
6053
+ return (0, import_node_path20.join)(appDataDir(), "slack-workspaces.json");
6051
6054
  }
6052
6055
  function readStore2() {
6053
6056
  try {
@@ -6154,11 +6157,11 @@ function requireSlackWorkspace(teamId) {
6154
6157
  }
6155
6158
  return ws;
6156
6159
  }
6157
- var import_node_path19;
6160
+ var import_node_path20;
6158
6161
  var init_workspaces = __esm({
6159
6162
  "src/slack/workspaces.ts"() {
6160
6163
  "use strict";
6161
- import_node_path19 = require("path");
6164
+ import_node_path20 = require("path");
6162
6165
  init_paths();
6163
6166
  init_secure_file();
6164
6167
  init_api();
@@ -6167,7 +6170,7 @@ var init_workspaces = __esm({
6167
6170
 
6168
6171
  // src/slack/outbound-watch.ts
6169
6172
  function storePath3() {
6170
- return (0, import_node_path20.join)(appDataDir(), "slack-outbound-watch.json");
6173
+ return (0, import_node_path21.join)(appDataDir(), "slack-outbound-watch.json");
6171
6174
  }
6172
6175
  function watchId(teamId, channelId, ts) {
6173
6176
  return `${teamId}:${channelId}:${ts}`;
@@ -6542,12 +6545,12 @@ async function refreshSlackReplyBadges(opts) {
6542
6545
  if (changed) writeStore2(watches);
6543
6546
  return listSlackReplyBadges();
6544
6547
  }
6545
- var import_node_fs18, import_node_path20, MAX_WATCHES, MAX_REPLIES_PER_WATCH, WATCH_TTL_MS, POLL_INTERVAL_MS, lastPollMs, nameCache;
6548
+ var import_node_fs18, import_node_path21, MAX_WATCHES, MAX_REPLIES_PER_WATCH, WATCH_TTL_MS, POLL_INTERVAL_MS, lastPollMs, nameCache;
6546
6549
  var init_outbound_watch = __esm({
6547
6550
  "src/slack/outbound-watch.ts"() {
6548
6551
  "use strict";
6549
6552
  import_node_fs18 = require("fs");
6550
- import_node_path20 = require("path");
6553
+ import_node_path21 = require("path");
6551
6554
  init_paths();
6552
6555
  init_private_file();
6553
6556
  init_secure_file();
@@ -6682,7 +6685,7 @@ function summarizeTurnStderr(tail, maxChars = 500) {
6682
6685
  function looksLikeInvalidAgentSession(text4) {
6683
6686
  const lower = text4.trim().toLowerCase();
6684
6687
  if (!lower) return false;
6685
- return /session not found/.test(lower) || /no conversation found/.test(lower) || /conversation .+ not found/.test(lower) || /thread .+ not found/.test(lower) || /unknown session/.test(lower) || /invalid session/.test(lower) || /session .+ (missing|expired|deleted|gone)/.test(lower) || /cannot resume/.test(lower) || /failed to (load|resume|open) session/.test(lower) || /corrupt local agent checkpoint/.test(lower) || /missing root blob/.test(lower) || /\bagent\b.{0,120}\bnot found\b/.test(lower);
6688
+ return /session not found/.test(lower) || /no conversation found/.test(lower) || /conversation .+ not found/.test(lower) || /thread .+ not found/.test(lower) || /unknown session/.test(lower) || /invalid session/.test(lower) || /session .+ (missing|expired|deleted|gone)/.test(lower) || /cannot resume/.test(lower) || /failed to (load|resume|open) session/.test(lower) || /corrupt local agent checkpoint/.test(lower) || /missing root blob/.test(lower) || /\bagent\b.{0,120}\bnot found\b/.test(lower) || /\brun\b.{0,80}\bnot found for agent\b/.test(lower);
6686
6689
  }
6687
6690
  function looksLikeRetryableRunnerCrash(text4) {
6688
6691
  if (looksLikeAgentFailureMessage(text4)) return false;
@@ -6797,7 +6800,7 @@ var init_error_detail = __esm({
6797
6800
 
6798
6801
  // src/brightsy/config.ts
6799
6802
  function brightsyConfigPath() {
6800
- return (0, import_node_path21.join)((0, import_node_os6.homedir)(), ".brightsy", "config.json");
6803
+ return (0, import_node_path22.join)((0, import_node_os6.homedir)(), ".brightsy", "config.json");
6801
6804
  }
6802
6805
  function loadBrightsyConfig() {
6803
6806
  const path2 = brightsyConfigPath();
@@ -6816,13 +6819,13 @@ function saveBrightsyConfig(cfg) {
6816
6819
  mode: 384
6817
6820
  });
6818
6821
  }
6819
- var import_node_fs19, import_node_os6, import_node_path21;
6822
+ var import_node_fs19, import_node_os6, import_node_path22;
6820
6823
  var init_config = __esm({
6821
6824
  "src/brightsy/config.ts"() {
6822
6825
  "use strict";
6823
6826
  import_node_fs19 = require("fs");
6824
6827
  import_node_os6 = require("os");
6825
- import_node_path21 = require("path");
6828
+ import_node_path22 = require("path");
6826
6829
  }
6827
6830
  });
6828
6831
 
@@ -6925,7 +6928,7 @@ __export(connected_teams_exports, {
6925
6928
  listConnectedBrightsyTeams: () => listConnectedBrightsyTeams
6926
6929
  });
6927
6930
  function storePath4() {
6928
- return (0, import_node_path22.join)(appDataDir(), "brightsy-teams.json");
6931
+ return (0, import_node_path23.join)(appDataDir(), "brightsy-teams.json");
6929
6932
  }
6930
6933
  function readStore4() {
6931
6934
  const path2 = storePath4();
@@ -7102,12 +7105,12 @@ function brightsyMcpServerName(slug) {
7102
7105
  const cleaned = slug.replace(/[^A-Za-z0-9_-]/g, "_").replace(/^_+|_+$/g, "");
7103
7106
  return `brightsy_${cleaned || "team"}`;
7104
7107
  }
7105
- var import_node_fs20, import_node_path22;
7108
+ var import_node_fs20, import_node_path23;
7106
7109
  var init_connected_teams = __esm({
7107
7110
  "src/brightsy/connected-teams.ts"() {
7108
7111
  "use strict";
7109
7112
  import_node_fs20 = require("fs");
7110
- import_node_path22 = require("path");
7113
+ import_node_path23 = require("path");
7111
7114
  init_paths();
7112
7115
  init_accounts();
7113
7116
  init_config();
@@ -8132,43 +8135,43 @@ function electronResourcesPath() {
8132
8135
  function packagedCursorRuntimeDir() {
8133
8136
  const resources = electronResourcesPath();
8134
8137
  if (!resources) return null;
8135
- const dir = (0, import_node_path23.join)(resources, "cursor-runtime");
8136
- if (!(0, import_node_fs22.existsSync)((0, import_node_path23.join)(dir, "core-dist", "agents", "cursor-runner.js"))) return null;
8138
+ const dir = (0, import_node_path24.join)(resources, "cursor-runtime");
8139
+ if (!(0, import_node_fs22.existsSync)((0, import_node_path24.join)(dir, "core-dist", "agents", "cursor-runner.js"))) return null;
8137
8140
  return dir;
8138
8141
  }
8139
8142
  function packagedCursorRunnerPath() {
8140
8143
  const dir = packagedCursorRuntimeDir();
8141
- return dir ? (0, import_node_path23.join)(dir, "core-dist", "agents", "cursor-runner.js") : null;
8144
+ return dir ? (0, import_node_path24.join)(dir, "core-dist", "agents", "cursor-runner.js") : null;
8142
8145
  }
8143
8146
  function packagedMcpDir() {
8144
8147
  const resources = electronResourcesPath();
8145
8148
  if (!resources) return null;
8146
- const dir = (0, import_node_path23.join)(resources, "sideboard-mcp");
8147
- if (!(0, import_node_fs22.existsSync)((0, import_node_path23.join)(dir, "core-dist", "mcp", "run-stdio.js"))) return null;
8149
+ const dir = (0, import_node_path24.join)(resources, "sideboard-mcp");
8150
+ if (!(0, import_node_fs22.existsSync)((0, import_node_path24.join)(dir, "core-dist", "mcp", "run-stdio.js"))) return null;
8148
8151
  return dir;
8149
8152
  }
8150
8153
  function packagedMcpStdioPath() {
8151
8154
  const dir = packagedMcpDir();
8152
- return dir ? (0, import_node_path23.join)(dir, "core-dist", "mcp", "run-stdio.js") : null;
8155
+ return dir ? (0, import_node_path24.join)(dir, "core-dist", "mcp", "run-stdio.js") : null;
8153
8156
  }
8154
8157
  function packagedBundledNodePath() {
8155
8158
  const resources = electronResourcesPath();
8156
8159
  if (!resources) return null;
8157
- const bin = (0, import_node_path23.join)(resources, "node", "bin", "node");
8160
+ const bin = (0, import_node_path24.join)(resources, "node", "bin", "node");
8158
8161
  if (!(0, import_node_fs22.existsSync)(bin)) return null;
8159
8162
  return bin;
8160
8163
  }
8161
8164
  function packagedCursorRipgrepCandidate(platformPkg, binName) {
8162
8165
  const dir = packagedCursorRuntimeDir();
8163
8166
  if (!dir) return null;
8164
- return (0, import_node_path23.join)(dir, "node_modules", platformPkg, "bin", binName);
8167
+ return (0, import_node_path24.join)(dir, "node_modules", platformPkg, "bin", binName);
8165
8168
  }
8166
- var import_node_fs22, import_node_path23;
8169
+ var import_node_fs22, import_node_path24;
8167
8170
  var init_packaged_runtime = __esm({
8168
8171
  "src/agents/packaged-runtime.ts"() {
8169
8172
  "use strict";
8170
8173
  import_node_fs22 = require("fs");
8171
- import_node_path23 = require("path");
8174
+ import_node_path24 = require("path");
8172
8175
  }
8173
8176
  });
8174
8177
 
@@ -8251,28 +8254,28 @@ function versionDirNodeBins(root, toBin) {
8251
8254
  }
8252
8255
  function defaultNodeBinCandidates(home = (0, import_node_os7.homedir)()) {
8253
8256
  const kegs = ["/opt/homebrew", "/usr/local"].flatMap(
8254
- (prefix) => PREFERRED_LTS_MAJORS.map((major) => (0, import_node_path24.join)(prefix, "opt", `node@${major}`, "bin", "node"))
8257
+ (prefix) => PREFERRED_LTS_MAJORS.map((major) => (0, import_node_path25.join)(prefix, "opt", `node@${major}`, "bin", "node"))
8255
8258
  );
8256
8259
  return [
8257
8260
  ...kegs,
8258
8261
  "/opt/homebrew/bin/node",
8259
8262
  "/usr/local/bin/node",
8260
- (0, import_node_path24.join)(home, ".local/share/fnm/aliases/default/bin/node"),
8261
- (0, import_node_path24.join)(home, ".nvm/current/bin/node"),
8262
- (0, import_node_path24.join)(home, ".volta/bin/node"),
8263
- (0, import_node_path24.join)(home, ".asdf/shims/node"),
8264
- (0, import_node_path24.join)(home, ".local/share/mise/shims/node"),
8263
+ (0, import_node_path25.join)(home, ".local/share/fnm/aliases/default/bin/node"),
8264
+ (0, import_node_path25.join)(home, ".nvm/current/bin/node"),
8265
+ (0, import_node_path25.join)(home, ".volta/bin/node"),
8266
+ (0, import_node_path25.join)(home, ".asdf/shims/node"),
8267
+ (0, import_node_path25.join)(home, ".local/share/mise/shims/node"),
8265
8268
  ...versionDirNodeBins(
8266
- (0, import_node_path24.join)(home, ".nvm", "versions", "node"),
8267
- (name) => (0, import_node_path24.join)(home, ".nvm", "versions", "node", name, "bin", "node")
8269
+ (0, import_node_path25.join)(home, ".nvm", "versions", "node"),
8270
+ (name) => (0, import_node_path25.join)(home, ".nvm", "versions", "node", name, "bin", "node")
8268
8271
  ),
8269
8272
  ...versionDirNodeBins(
8270
- (0, import_node_path24.join)(home, ".local/share/fnm", "node-versions"),
8271
- (name) => (0, import_node_path24.join)(home, ".local/share/fnm", "node-versions", name, "installation", "bin", "node")
8273
+ (0, import_node_path25.join)(home, ".local/share/fnm", "node-versions"),
8274
+ (name) => (0, import_node_path25.join)(home, ".local/share/fnm", "node-versions", name, "installation", "bin", "node")
8272
8275
  ),
8273
8276
  ...versionDirNodeBins(
8274
- (0, import_node_path24.join)(home, ".volta", "tools", "image", "node"),
8275
- (name) => (0, import_node_path24.join)(home, ".volta", "tools", "image", "node", name, "bin", "node")
8277
+ (0, import_node_path25.join)(home, ".volta", "tools", "image", "node"),
8278
+ (name) => (0, import_node_path25.join)(home, ".volta", "tools", "image", "node", name, "bin", "node")
8276
8279
  )
8277
8280
  ];
8278
8281
  }
@@ -8364,13 +8367,13 @@ async function resolveNodeLaunch(scriptPath) {
8364
8367
  env: { ELECTRON_RUN_AS_NODE: "1" }
8365
8368
  };
8366
8369
  }
8367
- var import_node_fs23, import_node_os7, import_node_path24, AGENT_RUNNER_MAX_OLD_SPACE_MB, MAX_OLD_SPACE_FLAG, PREFERRED_LTS_MAJORS;
8370
+ var import_node_fs23, import_node_os7, import_node_path25, AGENT_RUNNER_MAX_OLD_SPACE_MB, MAX_OLD_SPACE_FLAG, PREFERRED_LTS_MAJORS;
8368
8371
  var init_node_launch = __esm({
8369
8372
  "src/agents/node-launch.ts"() {
8370
8373
  "use strict";
8371
8374
  import_node_fs23 = require("fs");
8372
8375
  import_node_os7 = require("os");
8373
- import_node_path24 = require("path");
8376
+ import_node_path25 = require("path");
8374
8377
  init_nested_electron_env();
8375
8378
  init_run();
8376
8379
  init_packaged_runtime();
@@ -8463,13 +8466,13 @@ function corePackageDir() {
8463
8466
  try {
8464
8467
  const url = import_meta.url;
8465
8468
  if (typeof url === "string" && url.length > 0) {
8466
- return (0, import_node_path25.dirname)((0, import_node_url.fileURLToPath)(url));
8469
+ return (0, import_node_path26.dirname)((0, import_node_url.fileURLToPath)(url));
8467
8470
  }
8468
8471
  } catch {
8469
8472
  }
8470
8473
  try {
8471
- const req = (0, import_node_module.createRequire)((0, import_node_path25.join)(process.cwd(), "package.json"));
8472
- return (0, import_node_path25.dirname)(req.resolve("@sideboard-ai/core"));
8474
+ const req = (0, import_node_module.createRequire)((0, import_node_path26.join)(process.cwd(), "package.json"));
8475
+ return (0, import_node_path26.dirname)(req.resolve("@sideboard-ai/core"));
8473
8476
  } catch {
8474
8477
  return process.cwd();
8475
8478
  }
@@ -8482,18 +8485,18 @@ function findSideboardMcpJsEntry() {
8482
8485
  let dir = corePackageDir();
8483
8486
  for (let i = 0; i < 10; i++) {
8484
8487
  const candidates = [
8485
- (0, import_node_path25.join)(dir, "mcp/run-stdio.js"),
8486
- (0, import_node_path25.join)(dir, "mcp/run-stdio.cjs"),
8487
- (0, import_node_path25.join)(dir, "dist/mcp/run-stdio.js"),
8488
- (0, import_node_path25.join)(dir, "dist/mcp/run-stdio.cjs"),
8489
- (0, import_node_path25.join)(dir, "packages/core/dist/mcp/run-stdio.js"),
8490
- (0, import_node_path25.join)(dir, "packages/cli/dist/index.js"),
8491
- (0, import_node_path25.join)(dir, "cli/dist/index.js")
8488
+ (0, import_node_path26.join)(dir, "mcp/run-stdio.js"),
8489
+ (0, import_node_path26.join)(dir, "mcp/run-stdio.cjs"),
8490
+ (0, import_node_path26.join)(dir, "dist/mcp/run-stdio.js"),
8491
+ (0, import_node_path26.join)(dir, "dist/mcp/run-stdio.cjs"),
8492
+ (0, import_node_path26.join)(dir, "packages/core/dist/mcp/run-stdio.js"),
8493
+ (0, import_node_path26.join)(dir, "packages/cli/dist/index.js"),
8494
+ (0, import_node_path26.join)(dir, "cli/dist/index.js")
8492
8495
  ];
8493
8496
  for (const p of candidates) {
8494
8497
  if ((0, import_node_fs24.existsSync)(p) && !isAsarPath(p)) return p;
8495
8498
  }
8496
- const parent = (0, import_node_path25.dirname)(dir);
8499
+ const parent = (0, import_node_path26.dirname)(dir);
8497
8500
  if (parent === dir) break;
8498
8501
  dir = parent;
8499
8502
  }
@@ -8635,22 +8638,22 @@ function writeMcpServersConfig(servers) {
8635
8638
  ...env ? { env } : {}
8636
8639
  };
8637
8640
  }
8638
- const dir = (0, import_node_fs24.mkdtempSync)((0, import_node_path25.join)((0, import_node_os8.tmpdir)(), "sideboard-mcp-"));
8639
- const cfgPath = (0, import_node_path25.join)(dir, "mcp.json");
8641
+ const dir = (0, import_node_fs24.mkdtempSync)((0, import_node_path26.join)((0, import_node_os8.tmpdir)(), "sideboard-mcp-"));
8642
+ const cfgPath = (0, import_node_path26.join)(dir, "mcp.json");
8640
8643
  (0, import_node_fs24.writeFileSync)(cfgPath, JSON.stringify({ mcpServers }, null, 2));
8641
8644
  return cfgPath;
8642
8645
  }
8643
8646
  async function writeInjectedMcpConfig(opts) {
8644
8647
  return writeMcpServersConfig(await buildInjectedMcpServers(opts));
8645
8648
  }
8646
- var import_node_fs24, import_node_module, import_node_os8, import_node_path25, import_node_url, import_meta, SIDEBOARD_MCP_ALLOWED_TOOLS, SIDEBOARD_ARTIFACT_MCP_ALLOWED_TOOLS, BRIGHTSY_MCP_ALLOWED_TOOLS, brightsyMcpCommandCache, BRIGHTSY_WORD;
8649
+ var import_node_fs24, import_node_module, import_node_os8, import_node_path26, import_node_url, import_meta, SIDEBOARD_MCP_ALLOWED_TOOLS, SIDEBOARD_ARTIFACT_MCP_ALLOWED_TOOLS, BRIGHTSY_MCP_ALLOWED_TOOLS, brightsyMcpCommandCache, BRIGHTSY_WORD;
8647
8650
  var init_injected_mcp = __esm({
8648
8651
  "src/agents/injected-mcp.ts"() {
8649
8652
  "use strict";
8650
8653
  import_node_fs24 = require("fs");
8651
8654
  import_node_module = require("module");
8652
8655
  import_node_os8 = require("os");
8653
- import_node_path25 = require("path");
8656
+ import_node_path26 = require("path");
8654
8657
  import_node_url = require("url");
8655
8658
  init_run();
8656
8659
  init_config();
@@ -9256,8 +9259,8 @@ function usageFromCodex(usage) {
9256
9259
  }
9257
9260
  function codexConfigHasNetworkAccess() {
9258
9261
  const candidates = [
9259
- (0, import_node_path26.join)((0, import_node_os9.homedir)(), ".codex", "config.toml"),
9260
- (0, import_node_path26.join)((0, import_node_os9.homedir)(), ".config", "codex", "config.toml")
9262
+ (0, import_node_path27.join)((0, import_node_os9.homedir)(), ".codex", "config.toml"),
9263
+ (0, import_node_path27.join)((0, import_node_os9.homedir)(), ".config", "codex", "config.toml")
9261
9264
  ];
9262
9265
  for (const path2 of candidates) {
9263
9266
  if (!(0, import_node_fs26.existsSync)(path2)) continue;
@@ -9293,7 +9296,7 @@ function asRecord2(value) {
9293
9296
  return void 0;
9294
9297
  }
9295
9298
  function codexLooksAuthenticated() {
9296
- const authPath = (0, import_node_path26.join)((0, import_node_os9.homedir)(), ".codex", "auth.json");
9299
+ const authPath = (0, import_node_path27.join)((0, import_node_os9.homedir)(), ".codex", "auth.json");
9297
9300
  if (!(0, import_node_fs26.existsSync)(authPath)) return false;
9298
9301
  try {
9299
9302
  return (0, import_node_fs26.statSync)(authPath).size > 2;
@@ -9301,13 +9304,13 @@ function codexLooksAuthenticated() {
9301
9304
  return false;
9302
9305
  }
9303
9306
  }
9304
- var import_node_fs26, import_node_os9, import_node_path26, CODEX_PROMPT_ARG_MAX, FALLBACK_CODEX_MODELS, cachedCodexModels, CODEX_MODEL_CACHE_MS, codexAdapter;
9307
+ var import_node_fs26, import_node_os9, import_node_path27, CODEX_PROMPT_ARG_MAX, FALLBACK_CODEX_MODELS, cachedCodexModels, CODEX_MODEL_CACHE_MS, codexAdapter;
9305
9308
  var init_codex = __esm({
9306
9309
  "src/agents/codex.ts"() {
9307
9310
  "use strict";
9308
9311
  import_node_fs26 = require("fs");
9309
9312
  import_node_os9 = require("os");
9310
- import_node_path26 = require("path");
9313
+ import_node_path27 = require("path");
9311
9314
  init_run();
9312
9315
  init_app_settings();
9313
9316
  init_global_workspace();
@@ -9787,7 +9790,7 @@ function platformRipgrepPackage() {
9787
9790
  }
9788
9791
  function usableRipgrepPath(candidate) {
9789
9792
  const raw = candidate?.trim();
9790
- if (!raw || !(0, import_node_path27.isAbsolute)(raw)) return null;
9793
+ if (!raw || !(0, import_node_path28.isAbsolute)(raw)) return null;
9791
9794
  const readable = nodeReadableScriptPath(raw);
9792
9795
  if (!(0, import_node_fs27.existsSync)(readable) || isAsarPath(readable)) return null;
9793
9796
  return readable;
@@ -9796,12 +9799,12 @@ function walkForBundledRipgrep(startFile) {
9796
9799
  if (!startFile) return null;
9797
9800
  const pkg = platformRipgrepPackage();
9798
9801
  const name = rgBinaryName();
9799
- let dir = (0, import_node_path27.dirname)((0, import_node_path27.resolve)(startFile));
9800
- const root = (0, import_node_path27.parse)(dir).root;
9802
+ let dir = (0, import_node_path28.dirname)((0, import_node_path28.resolve)(startFile));
9803
+ const root = (0, import_node_path28.parse)(dir).root;
9801
9804
  while (dir !== root) {
9802
- const hit = usableRipgrepPath((0, import_node_path27.join)(dir, "node_modules", pkg, "bin", name));
9805
+ const hit = usableRipgrepPath((0, import_node_path28.join)(dir, "node_modules", pkg, "bin", name));
9803
9806
  if (hit) return hit;
9804
- const next = (0, import_node_path27.dirname)(dir);
9807
+ const next = (0, import_node_path28.dirname)(dir);
9805
9808
  if (next === dir) break;
9806
9809
  dir = next;
9807
9810
  }
@@ -9811,7 +9814,7 @@ function requireResolveBundledRipgrep(fromFile) {
9811
9814
  try {
9812
9815
  const req = (0, import_node_module2.createRequire)(fromFile);
9813
9816
  const pkgJson = req.resolve(`${platformRipgrepPackage()}/package.json`);
9814
- return usableRipgrepPath((0, import_node_path27.join)((0, import_node_path27.dirname)(pkgJson), "bin", rgBinaryName()));
9817
+ return usableRipgrepPath((0, import_node_path28.join)((0, import_node_path28.dirname)(pkgJson), "bin", rgBinaryName()));
9815
9818
  } catch {
9816
9819
  return null;
9817
9820
  }
@@ -9833,13 +9836,13 @@ function cursorRipgrepEnv(opts) {
9833
9836
  const path2 = resolveCursorRipgrepPath(opts);
9834
9837
  return path2 ? { [RIPGREP_ENV]: path2 } : {};
9835
9838
  }
9836
- var import_node_fs27, import_node_module2, import_node_path27, RIPGREP_ENV;
9839
+ var import_node_fs27, import_node_module2, import_node_path28, RIPGREP_ENV;
9837
9840
  var init_cursor_ripgrep = __esm({
9838
9841
  "src/agents/cursor-ripgrep.ts"() {
9839
9842
  "use strict";
9840
9843
  import_node_fs27 = require("fs");
9841
9844
  import_node_module2 = require("module");
9842
- import_node_path27 = require("path");
9845
+ import_node_path28 = require("path");
9843
9846
  init_node_launch();
9844
9847
  init_packaged_runtime();
9845
9848
  RIPGREP_ENV = "CURSOR_RIPGREP_PATH";
@@ -9885,11 +9888,11 @@ function entryDir() {
9885
9888
  const cjsDir = typeof __dirname !== "undefined" ? __dirname : "";
9886
9889
  if (cjsDir) return cjsDir;
9887
9890
  try {
9888
- return (0, import_node_path28.dirname)((0, import_node_url2.fileURLToPath)(import_meta2.url));
9891
+ return (0, import_node_path29.dirname)((0, import_node_url2.fileURLToPath)(import_meta2.url));
9889
9892
  } catch {
9890
9893
  try {
9891
9894
  const req = (0, import_node_module3.createRequire)(process.cwd() + "/");
9892
- return (0, import_node_path28.dirname)(req.resolve("@sideboard-ai/core"));
9895
+ return (0, import_node_path29.dirname)(req.resolve("@sideboard-ai/core"));
9893
9896
  } catch {
9894
9897
  return process.cwd();
9895
9898
  }
@@ -9900,27 +9903,27 @@ function cursorRunnerPath() {
9900
9903
  if (packaged) return packaged;
9901
9904
  const root = entryDir();
9902
9905
  const candidates = [
9903
- (0, import_node_path28.join)(root, "agents", "cursor-runner.js"),
9904
- (0, import_node_path28.join)(root, "agents", "cursor-runner.cjs"),
9906
+ (0, import_node_path29.join)(root, "agents", "cursor-runner.js"),
9907
+ (0, import_node_path29.join)(root, "agents", "cursor-runner.cjs"),
9905
9908
  // If somehow resolved from package root instead of dist/
9906
- (0, import_node_path28.join)(root, "dist", "agents", "cursor-runner.js"),
9907
- (0, import_node_path28.join)(root, "dist", "agents", "cursor-runner.cjs"),
9909
+ (0, import_node_path29.join)(root, "dist", "agents", "cursor-runner.js"),
9910
+ (0, import_node_path29.join)(root, "dist", "agents", "cursor-runner.cjs"),
9908
9911
  // Source tree (dev): packages/core/src/agents/cursor-runner.ts
9909
- (0, import_node_path28.join)(root, "cursor-runner.ts"),
9910
- (0, import_node_path28.join)(root, "src", "agents", "cursor-runner.ts")
9912
+ (0, import_node_path29.join)(root, "cursor-runner.ts"),
9913
+ (0, import_node_path29.join)(root, "src", "agents", "cursor-runner.ts")
9911
9914
  ];
9912
9915
  for (const candidate of candidates) {
9913
9916
  if ((0, import_node_fs28.existsSync)(candidate)) return candidate;
9914
9917
  }
9915
9918
  return candidates[0];
9916
9919
  }
9917
- var import_node_fs28, import_node_module3, import_node_path28, import_node_url2, import_sdk, import_meta2, FALLBACK_CURSOR_MODELS, cachedModels, MODEL_CACHE_MS, cursorAdapter;
9920
+ var import_node_fs28, import_node_module3, import_node_path29, import_node_url2, import_sdk, import_meta2, FALLBACK_CURSOR_MODELS, cachedModels, MODEL_CACHE_MS, cursorAdapter;
9918
9921
  var init_cursor = __esm({
9919
9922
  "src/agents/cursor.ts"() {
9920
9923
  "use strict";
9921
9924
  import_node_fs28 = require("fs");
9922
9925
  import_node_module3 = require("module");
9923
- import_node_path28 = require("path");
9926
+ import_node_path29 = require("path");
9924
9927
  import_node_url2 = require("url");
9925
9928
  import_sdk = require("@cursor/sdk");
9926
9929
  init_run();
@@ -9979,6 +9982,7 @@ var init_cursor = __esm({
9979
9982
  const req = {
9980
9983
  prompt,
9981
9984
  cwd: thread.worktreePath,
9985
+ threadId: thread.id,
9982
9986
  agentId,
9983
9987
  model: thread.model,
9984
9988
  effort: thread.effort,
@@ -11863,12 +11867,12 @@ function readTextIfPresent(abs) {
11863
11867
  }
11864
11868
  }
11865
11869
  function readLocalGuidelines(worktreePath) {
11866
- const localAbs = (0, import_node_path29.join)(worktreePath, REVIEW_REQUEST_PATH);
11870
+ const localAbs = (0, import_node_path30.join)(worktreePath, REVIEW_REQUEST_PATH);
11867
11871
  const localContent = readTextIfPresent(localAbs);
11868
11872
  if (localContent && !shouldRefreshReviewRequestTemplate(localContent)) {
11869
11873
  return { path: REVIEW_REQUEST_PATH, content: localContent };
11870
11874
  }
11871
- const legacyAbs = (0, import_node_path29.join)(worktreePath, LEGACY_REVIEW_REQUEST_PATH);
11875
+ const legacyAbs = (0, import_node_path30.join)(worktreePath, LEGACY_REVIEW_REQUEST_PATH);
11872
11876
  const legacyContent = readTextIfPresent(legacyAbs);
11873
11877
  if (legacyContent && !shouldRefreshReviewRequestTemplate(legacyContent)) {
11874
11878
  return { path: LEGACY_REVIEW_REQUEST_PATH, content: legacyContent };
@@ -11884,20 +11888,20 @@ function skillGuidelines(content, source) {
11884
11888
  };
11885
11889
  }
11886
11890
  function ensureReviewSkillFile(worktreePath) {
11887
- const abs = (0, import_node_path29.join)(worktreePath, REVIEW_SKILL_PATH);
11891
+ const abs = (0, import_node_path30.join)(worktreePath, REVIEW_SKILL_PATH);
11888
11892
  const existing = readTextIfPresent(abs);
11889
11893
  if (existing) {
11890
11894
  return { path: REVIEW_SKILL_PATH, content: existing, wrote: false };
11891
11895
  }
11892
- const fromRepo = readTextIfPresent((0, import_node_path29.join)(worktreePath, REPO_REVIEW_PATH));
11896
+ const fromRepo = readTextIfPresent((0, import_node_path30.join)(worktreePath, REPO_REVIEW_PATH));
11893
11897
  const fromLocal = readLocalGuidelines(worktreePath)?.content ?? null;
11894
11898
  const content = wrapReviewSkillMarkdown(fromRepo ?? fromLocal ?? REVIEW_REQUEST_TEMPLATE);
11895
- (0, import_node_fs30.mkdirSync)((0, import_node_path29.dirname)(abs), { recursive: true });
11899
+ (0, import_node_fs30.mkdirSync)((0, import_node_path30.dirname)(abs), { recursive: true });
11896
11900
  (0, import_node_fs30.writeFileSync)(abs, content, "utf8");
11897
11901
  return { path: REVIEW_SKILL_PATH, content, wrote: true };
11898
11902
  }
11899
11903
  function resolveReviewGuidelines(worktreePath) {
11900
- const skillContent = readTextIfPresent((0, import_node_path29.join)(worktreePath, REVIEW_SKILL_PATH));
11904
+ const skillContent = readTextIfPresent((0, import_node_path30.join)(worktreePath, REVIEW_SKILL_PATH));
11901
11905
  if (skillContent) return skillGuidelines(skillContent, "skill");
11902
11906
  const local = readLocalGuidelines(worktreePath);
11903
11907
  if (local) {
@@ -11927,7 +11931,7 @@ function buildReviewRequestAttachment(content, opts) {
11927
11931
  };
11928
11932
  }
11929
11933
  function readExistingReviewRequestFile(worktreePath) {
11930
- return readTextIfPresent((0, import_node_path29.join)(worktreePath, REVIEW_SKILL_PATH)) ?? readTextIfPresent((0, import_node_path29.join)(worktreePath, REPO_REVIEW_PATH)) ?? readTextIfPresent((0, import_node_path29.join)(worktreePath, REVIEW_REQUEST_PATH)) ?? readTextIfPresent((0, import_node_path29.join)(worktreePath, LEGACY_REVIEW_REQUEST_PATH));
11934
+ return readTextIfPresent((0, import_node_path30.join)(worktreePath, REVIEW_SKILL_PATH)) ?? readTextIfPresent((0, import_node_path30.join)(worktreePath, REPO_REVIEW_PATH)) ?? readTextIfPresent((0, import_node_path30.join)(worktreePath, REVIEW_REQUEST_PATH)) ?? readTextIfPresent((0, import_node_path30.join)(worktreePath, LEGACY_REVIEW_REQUEST_PATH));
11931
11935
  }
11932
11936
  async function requestReview(threadRef, send2) {
11933
11937
  const from = findThreadByRef(threadRef);
@@ -11954,13 +11958,13 @@ async function requestReview(threadRef, send2) {
11954
11958
  const started = await send2(tab.id, REVIEW_REQUEST_PREFILL);
11955
11959
  return { tab: started, from };
11956
11960
  }
11957
- var import_node_crypto6, import_node_fs30, import_node_path29, REPO_REVIEW_PATH, REPO_REVIEW_NAME, REVIEW_REQUEST_PATH, LEGACY_REVIEW_REQUEST_PATH, REVIEW_REQUEST_NAME, REVIEW_REQUEST_PREFILL, LEGACY_REVIEW_TEMPLATE_MARKERS;
11961
+ var import_node_crypto6, import_node_fs30, import_node_path30, REPO_REVIEW_PATH, REPO_REVIEW_NAME, REVIEW_REQUEST_PATH, LEGACY_REVIEW_REQUEST_PATH, REVIEW_REQUEST_NAME, REVIEW_REQUEST_PREFILL, LEGACY_REVIEW_TEMPLATE_MARKERS;
11958
11962
  var init_request_review = __esm({
11959
11963
  "src/review/request-review.ts"() {
11960
11964
  "use strict";
11961
11965
  import_node_crypto6 = require("crypto");
11962
11966
  import_node_fs30 = require("fs");
11963
- import_node_path29 = require("path");
11967
+ import_node_path30 = require("path");
11964
11968
  init_global_workspace();
11965
11969
  init_chat_tabs();
11966
11970
  init_thread_store();
@@ -11985,7 +11989,7 @@ function matchSimpleGlob(pattern, name) {
11985
11989
  return new RegExp(`^${escaped}$`).test(name);
11986
11990
  }
11987
11991
  function readWorktreeInclude(repoPath) {
11988
- const path2 = (0, import_node_path30.join)(repoPath, ".worktreeinclude");
11992
+ const path2 = (0, import_node_path31.join)(repoPath, ".worktreeinclude");
11989
11993
  if (!(0, import_node_fs31.existsSync)(path2)) return [];
11990
11994
  return (0, import_node_fs31.readFileSync)(path2, "utf8").split("\n").map((l) => l.trim()).filter((l) => l && !l.startsWith("#"));
11991
11995
  }
@@ -12000,7 +12004,7 @@ function resolveFilesToCopy(repoPath) {
12000
12004
  for (const entry of (0, import_node_fs31.readdirSync)(repoPath, { withFileTypes: true })) {
12001
12005
  if (!entry.isFile()) continue;
12002
12006
  for (const glob of settings.fileIncludeGlobs) {
12003
- if (matchSimpleGlob(glob, entry.name) || matchSimpleGlob((0, import_node_path30.basename)(glob), entry.name)) {
12007
+ if (matchSimpleGlob(glob, entry.name) || matchSimpleGlob((0, import_node_path31.basename)(glob), entry.name)) {
12004
12008
  matched.push(entry.name);
12005
12009
  break;
12006
12010
  }
@@ -12026,10 +12030,10 @@ function copyConfiguredFiles(repoPath, worktreePath) {
12026
12030
  const patterns = resolveFilesToCopy(repoPath);
12027
12031
  const copied = [];
12028
12032
  for (const rel of patterns) {
12029
- const src = (0, import_node_path30.join)(repoPath, rel);
12033
+ const src = (0, import_node_path31.join)(repoPath, rel);
12030
12034
  if (!(0, import_node_fs31.existsSync)(src)) continue;
12031
- const dest = (0, import_node_path30.join)(worktreePath, rel);
12032
- (0, import_node_fs31.mkdirSync)((0, import_node_path30.dirname)(dest), { recursive: true });
12035
+ const dest = (0, import_node_path31.join)(worktreePath, rel);
12036
+ (0, import_node_fs31.mkdirSync)((0, import_node_path31.dirname)(dest), { recursive: true });
12033
12037
  (0, import_node_fs31.copyFileSync)(src, dest);
12034
12038
  copied.push(rel);
12035
12039
  }
@@ -12065,7 +12069,7 @@ function buildWorkspaceScriptEnv(opts, baseEnv) {
12065
12069
  const env = stripNestedElectronEnv({
12066
12070
  ...baseEnv ?? process.env
12067
12071
  });
12068
- const name = opts.workspaceName ?? (0, import_node_path30.basename)(opts.worktreePath);
12072
+ const name = opts.workspaceName ?? (0, import_node_path31.basename)(opts.worktreePath);
12069
12073
  const ports = opts.ports ?? [];
12070
12074
  const primary = ports[0];
12071
12075
  env.SIDEBOARD_WORKSPACE_NAME = name;
@@ -12326,13 +12330,13 @@ async function startDevServer(repoPath, worktreePath, onLine, opts) {
12326
12330
  done: handle.done
12327
12331
  };
12328
12332
  }
12329
- var import_node_fs31, import_node_net, import_node_path30, import_execa4, import_node_readline3, PORT_RANGE_SIZE, cachedLoginEnv;
12333
+ var import_node_fs31, import_node_net, import_node_path31, import_execa4, import_node_readline3, PORT_RANGE_SIZE, cachedLoginEnv;
12330
12334
  var init_conductor = __esm({
12331
12335
  "src/hook/conductor.ts"() {
12332
12336
  "use strict";
12333
12337
  import_node_fs31 = require("fs");
12334
12338
  import_node_net = require("net");
12335
- import_node_path30 = require("path");
12339
+ import_node_path31 = require("path");
12336
12340
  import_execa4 = require("execa");
12337
12341
  import_node_readline3 = require("readline");
12338
12342
  init_settings();
@@ -12394,9 +12398,9 @@ async function findOrphanWorktrees(repoPaths) {
12394
12398
  if ((0, import_node_fs32.existsSync)(root)) {
12395
12399
  for (const entry of (0, import_node_fs32.readdirSync)(root, { withFileTypes: true })) {
12396
12400
  if (!entry.isDirectory()) continue;
12397
- const path2 = (0, import_node_path31.join)(root, entry.name).replace(/\/$/, "");
12401
+ const path2 = (0, import_node_path32.join)(root, entry.name).replace(/\/$/, "");
12398
12402
  if (known.has(path2) || seen.has(path2)) continue;
12399
- if (!(0, import_node_fs32.existsSync)((0, import_node_path31.join)(path2, ".git"))) continue;
12403
+ if (!(0, import_node_fs32.existsSync)((0, import_node_path32.join)(path2, ".git"))) continue;
12400
12404
  seen.add(path2);
12401
12405
  let mtimeMs = 0;
12402
12406
  try {
@@ -12461,12 +12465,12 @@ function worktreeCleanupSettings() {
12461
12465
  autoCleanupOrphans: a.autoCleanupOrphans
12462
12466
  };
12463
12467
  }
12464
- var import_node_fs32, import_node_path31;
12468
+ var import_node_fs32, import_node_path32;
12465
12469
  var init_orphan_cleanup = __esm({
12466
12470
  "src/git/orphan-cleanup.ts"() {
12467
12471
  "use strict";
12468
12472
  import_node_fs32 = require("fs");
12469
- import_node_path31 = require("path");
12473
+ import_node_path32 = require("path");
12470
12474
  init_worktree();
12471
12475
  init_thread_store();
12472
12476
  init_paths();
@@ -12573,10 +12577,10 @@ __export(workspaces_exports, {
12573
12577
  syncWorkspacesFromThreads: () => syncWorkspacesFromThreads
12574
12578
  });
12575
12579
  function workspacesFile() {
12576
- return (0, import_node_path32.join)(appDataDir(), "workspaces.json");
12580
+ return (0, import_node_path33.join)(appDataDir(), "workspaces.json");
12577
12581
  }
12578
12582
  function removedWorkspacesFile() {
12579
- return (0, import_node_path32.join)(appDataDir(), "removed-workspaces.json");
12583
+ return (0, import_node_path33.join)(appDataDir(), "removed-workspaces.json");
12580
12584
  }
12581
12585
  function readAll2() {
12582
12586
  const path2 = workspacesFile();
@@ -12635,7 +12639,7 @@ async function addWorkspace(repoPath) {
12635
12639
  if (existing) return existing;
12636
12640
  const next = {
12637
12641
  path: root,
12638
- name: (0, import_node_path32.basename)(root),
12642
+ name: (0, import_node_path33.basename)(root),
12639
12643
  addedAt: (/* @__PURE__ */ new Date()).toISOString()
12640
12644
  };
12641
12645
  writeAll2([...current, next]);
@@ -12660,7 +12664,7 @@ function syncWorkspacesFromThreads(repoPaths) {
12660
12664
  if (!(0, import_node_fs33.existsSync)(path2)) continue;
12661
12665
  const ws = {
12662
12666
  path: path2,
12663
- name: (0, import_node_path32.basename)(path2),
12667
+ name: (0, import_node_path33.basename)(path2),
12664
12668
  addedAt: (/* @__PURE__ */ new Date()).toISOString()
12665
12669
  };
12666
12670
  byPath.set(path2, ws);
@@ -12670,12 +12674,12 @@ function syncWorkspacesFromThreads(repoPaths) {
12670
12674
  if (dirty) writeAll2(next);
12671
12675
  return next.sort((a, b) => a.name.localeCompare(b.name));
12672
12676
  }
12673
- var import_node_fs33, import_node_path32;
12677
+ var import_node_fs33, import_node_path33;
12674
12678
  var init_workspaces2 = __esm({
12675
12679
  "src/store/workspaces.ts"() {
12676
12680
  "use strict";
12677
12681
  import_node_fs33 = require("fs");
12678
- import_node_path32 = require("path");
12682
+ import_node_path33 = require("path");
12679
12683
  init_paths();
12680
12684
  init_global_workspace();
12681
12685
  init_worktree();
@@ -12688,11 +12692,11 @@ async function cloneRepoIntoSideboard(opts) {
12688
12692
  if (!url) throw new Error("Clone URL is required");
12689
12693
  let name = opts.name?.trim();
12690
12694
  if (!name) {
12691
- const leaf = (0, import_node_path33.basename)(url.replace(/\/$/, "").replace(/\.git$/, ""));
12695
+ const leaf = (0, import_node_path34.basename)(url.replace(/\/$/, "").replace(/\.git$/, ""));
12692
12696
  name = leaf || "repo";
12693
12697
  }
12694
12698
  name = name.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "repo";
12695
- const dest = (0, import_node_path33.join)(sideboardReposDir(), name);
12699
+ const dest = (0, import_node_path34.join)(sideboardReposDir(), name);
12696
12700
  if ((0, import_node_fs34.existsSync)(dest)) {
12697
12701
  const repoPath2 = await resolveRepoRoot(dest);
12698
12702
  const workspace2 = await ensureWorkspace(repoPath2);
@@ -12708,12 +12712,12 @@ async function cloneRepoIntoSideboard(opts) {
12708
12712
  const workspace = await ensureWorkspace(repoPath);
12709
12713
  return { repoPath, workspace };
12710
12714
  }
12711
- var import_node_fs34, import_node_path33, import_execa6;
12715
+ var import_node_fs34, import_node_path34, import_execa6;
12712
12716
  var init_clone_repo = __esm({
12713
12717
  "src/git/clone-repo.ts"() {
12714
12718
  "use strict";
12715
12719
  import_node_fs34 = require("fs");
12716
- import_node_path33 = require("path");
12720
+ import_node_path34 = require("path");
12717
12721
  import_execa6 = require("execa");
12718
12722
  init_paths();
12719
12723
  init_workspaces2();
@@ -12991,7 +12995,7 @@ function noteTurnLiveEvent(threadId, event) {
12991
12995
  buffers.delete(threadId);
12992
12996
  return;
12993
12997
  }
12994
- const immediate = event.type === "tool_use" || event.type === "tool_result";
12998
+ const immediate = event.type === "tool_use" || event.type === "tool_result" && !event.partial;
12995
12999
  if (immediate) flush(threadId);
12996
13000
  else scheduleFlush(threadId);
12997
13001
  }
@@ -13043,6 +13047,27 @@ var init_turn_live = __esm({
13043
13047
  }
13044
13048
  });
13045
13049
 
13050
+ // src/orchestrator/reconcile-heal.ts
13051
+ function shouldReadThreadToHealReconcile(eventType, lastCheckAt, now) {
13052
+ if (SKIP.has(eventType)) return false;
13053
+ if (lastCheckAt != null && now - lastCheckAt < RECONCILE_HEAL_MIN_MS) return false;
13054
+ return true;
13055
+ }
13056
+ var RECONCILE_HEAL_MIN_MS, SKIP;
13057
+ var init_reconcile_heal = __esm({
13058
+ "src/orchestrator/reconcile-heal.ts"() {
13059
+ "use strict";
13060
+ RECONCILE_HEAL_MIN_MS = 2e3;
13061
+ SKIP = /* @__PURE__ */ new Set([
13062
+ "stdout",
13063
+ "thinking",
13064
+ "usage",
13065
+ "stderr",
13066
+ "tool_result"
13067
+ ]);
13068
+ }
13069
+ });
13070
+
13046
13071
  // src/threads/fork-worktree.ts
13047
13072
  function requireThread2(idOrRef) {
13048
13073
  const thread = findThreadByRef(idOrRef) ?? null;
@@ -13213,7 +13238,7 @@ var init_quota_failover = __esm({
13213
13238
  // src/threads/adopt.ts
13214
13239
  function thisModuleFile() {
13215
13240
  const cjsFile = typeof __filename !== "undefined" ? __filename : "";
13216
- return cjsFile || process.argv[1] || (0, import_node_path34.join)(process.cwd(), "package.json");
13241
+ return cjsFile || process.argv[1] || (0, import_node_path35.join)(process.cwd(), "package.json");
13217
13242
  }
13218
13243
  function openReadonlySqlite(file) {
13219
13244
  const req = (0, import_node_module4.createRequire)(thisModuleFile());
@@ -13241,7 +13266,7 @@ function resolveConductorCursorAgentId(workspacePath) {
13241
13266
  return null;
13242
13267
  }
13243
13268
  for (const hash of hashes) {
13244
- const agentsFile = (0, import_node_path34.join)(CURSOR_SDK_STORE, hash, "agents.ndjson");
13269
+ const agentsFile = (0, import_node_path35.join)(CURSOR_SDK_STORE, hash, "agents.ndjson");
13245
13270
  if (!(0, import_node_fs37.existsSync)(agentsFile)) continue;
13246
13271
  let text4;
13247
13272
  try {
@@ -13299,8 +13324,8 @@ function listConductorWorkspaces() {
13299
13324
  if (!(0, import_node_fs37.existsSync)(CONDUCTOR_DB)) {
13300
13325
  throw new Error(`Conductor DB not found at ${CONDUCTOR_DB}`);
13301
13326
  }
13302
- const tmp = (0, import_node_fs37.mkdtempSync)((0, import_node_path34.join)((0, import_node_os10.tmpdir)(), "sideboard-conductor-"));
13303
- const snapshot = (0, import_node_path34.join)(tmp, "conductor.db");
13327
+ const tmp = (0, import_node_fs37.mkdtempSync)((0, import_node_path35.join)((0, import_node_os10.tmpdir)(), "sideboard-conductor-"));
13328
+ const snapshot = (0, import_node_path35.join)(tmp, "conductor.db");
13304
13329
  try {
13305
13330
  (0, import_node_fs37.copyFileSync)(CONDUCTOR_DB, snapshot);
13306
13331
  for (const suffix of ["-wal", "-shm"]) {
@@ -13390,8 +13415,8 @@ function importConductorWorkspace(workspaceId) {
13390
13415
  if (!(0, import_node_fs37.existsSync)(CONDUCTOR_DB)) {
13391
13416
  throw new Error(`Conductor DB not found at ${CONDUCTOR_DB}`);
13392
13417
  }
13393
- const tmp = (0, import_node_fs37.mkdtempSync)((0, import_node_path34.join)((0, import_node_os10.tmpdir)(), "sideboard-conductor-"));
13394
- const snapshot = (0, import_node_path34.join)(tmp, "conductor.db");
13418
+ const tmp = (0, import_node_fs37.mkdtempSync)((0, import_node_path35.join)((0, import_node_os10.tmpdir)(), "sideboard-conductor-"));
13419
+ const snapshot = (0, import_node_path35.join)(tmp, "conductor.db");
13395
13420
  try {
13396
13421
  (0, import_node_fs37.copyFileSync)(CONDUCTOR_DB, snapshot);
13397
13422
  for (const suffix of ["-wal", "-shm"]) {
@@ -13485,25 +13510,25 @@ function importConductorWorkspace(workspaceId) {
13485
13510
  async function importConductorWorkspaceAsync(workspaceId) {
13486
13511
  return importConductorWorkspace(workspaceId);
13487
13512
  }
13488
- var import_node_child_process4, import_node_fs37, import_node_os10, import_node_path34, import_node_module4, CONDUCTOR_APP_SUPPORT, CONDUCTOR_DB, CURSOR_SDK_STORE;
13513
+ var import_node_child_process4, import_node_fs37, import_node_os10, import_node_path35, import_node_module4, CONDUCTOR_APP_SUPPORT, CONDUCTOR_DB, CURSOR_SDK_STORE;
13489
13514
  var init_adopt = __esm({
13490
13515
  "src/threads/adopt.ts"() {
13491
13516
  "use strict";
13492
13517
  import_node_child_process4 = require("child_process");
13493
13518
  import_node_fs37 = require("fs");
13494
13519
  import_node_os10 = require("os");
13495
- import_node_path34 = require("path");
13520
+ import_node_path35 = require("path");
13496
13521
  import_node_module4 = require("module");
13497
13522
  init_worktree();
13498
13523
  init_thread_store();
13499
- CONDUCTOR_APP_SUPPORT = (0, import_node_path34.join)(
13524
+ CONDUCTOR_APP_SUPPORT = (0, import_node_path35.join)(
13500
13525
  process.env.HOME ?? "",
13501
13526
  "Library",
13502
13527
  "Application Support",
13503
13528
  "com.conductor.app"
13504
13529
  );
13505
- CONDUCTOR_DB = (0, import_node_path34.join)(CONDUCTOR_APP_SUPPORT, "conductor.db");
13506
- CURSOR_SDK_STORE = (0, import_node_path34.join)(CONDUCTOR_APP_SUPPORT, "cursor-sdk-store");
13530
+ CONDUCTOR_DB = (0, import_node_path35.join)(CONDUCTOR_APP_SUPPORT, "conductor.db");
13531
+ CURSOR_SDK_STORE = (0, import_node_path35.join)(CONDUCTOR_APP_SUPPORT, "cursor-sdk-store");
13507
13532
  }
13508
13533
  });
13509
13534
 
@@ -13958,7 +13983,7 @@ new file mode 100644
13958
13983
  };
13959
13984
  }
13960
13985
  async function untrackedPatch(worktreePath, path2, maxHunk) {
13961
- const abs = (0, import_node_path35.join)(worktreePath, path2);
13986
+ const abs = (0, import_node_path36.join)(worktreePath, path2);
13962
13987
  try {
13963
13988
  const st = (0, import_node_fs39.statSync)(abs);
13964
13989
  if (st.isFile() && st.size > maxHunk) {
@@ -14451,7 +14476,7 @@ function isImageRelativePath(relativePath) {
14451
14476
  function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
14452
14477
  assertSafeRelativePath(relativePath);
14453
14478
  const maxBytes = opts?.maxBytes ?? DEFAULT_UPLOAD_MAX_BYTES;
14454
- const abs = (0, import_node_path35.join)(worktreePath, relativePath);
14479
+ const abs = (0, import_node_path36.join)(worktreePath, relativePath);
14455
14480
  const st = (0, import_node_fs39.statSync)(abs);
14456
14481
  if (!st.isFile()) {
14457
14482
  throw new Error(`Not a file: ${relativePath}`);
@@ -14471,7 +14496,7 @@ function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
14471
14496
  function readWorktreeFile(worktreePath, relativePath, opts) {
14472
14497
  assertSafeRelativePath(relativePath);
14473
14498
  const maxBytes = opts?.maxBytes ?? 2e5;
14474
- const abs = (0, import_node_path35.join)(worktreePath, relativePath);
14499
+ const abs = (0, import_node_path36.join)(worktreePath, relativePath);
14475
14500
  const st = (0, import_node_fs39.statSync)(abs);
14476
14501
  if (!st.isFile()) {
14477
14502
  throw new Error(`Not a file: ${relativePath}`);
@@ -14519,8 +14544,8 @@ function assertSafeRelativePath(relativePath) {
14519
14544
  }
14520
14545
  function writeWorktreeFile(worktreePath, relativePath, content) {
14521
14546
  assertSafeRelativePath(relativePath);
14522
- const abs = (0, import_node_path35.join)(worktreePath, relativePath);
14523
- (0, import_node_fs39.mkdirSync)((0, import_node_path35.dirname)(abs), { recursive: true });
14547
+ const abs = (0, import_node_path36.join)(worktreePath, relativePath);
14548
+ (0, import_node_fs39.mkdirSync)((0, import_node_path36.dirname)(abs), { recursive: true });
14524
14549
  (0, import_node_fs39.writeFileSync)(abs, content, "utf8");
14525
14550
  return { path: relativePath };
14526
14551
  }
@@ -14538,12 +14563,12 @@ async function getDiffSummary(worktreePath, repoPath, opts) {
14538
14563
  truncated: full.files.length > maxFiles
14539
14564
  };
14540
14565
  }
14541
- var import_node_fs39, import_node_path35, mergeBaseCache, MERGE_BASE_TTL_MS, SHA_RE, IMAGE_EXTENSIONS, DEFAULT_UPLOAD_MAX_BYTES;
14566
+ var import_node_fs39, import_node_path36, mergeBaseCache, MERGE_BASE_TTL_MS, SHA_RE, IMAGE_EXTENSIONS, DEFAULT_UPLOAD_MAX_BYTES;
14542
14567
  var init_diff = __esm({
14543
14568
  "src/diff/diff.ts"() {
14544
14569
  "use strict";
14545
14570
  import_node_fs39 = require("fs");
14546
- import_node_path35 = require("path");
14571
+ import_node_path36 = require("path");
14547
14572
  init_run();
14548
14573
  init_worktree();
14549
14574
  mergeBaseCache = /* @__PURE__ */ new Map();
@@ -14739,7 +14764,7 @@ function scanSkillsDir(dir, source, out) {
14739
14764
  }
14740
14765
  for (const entry of entries) {
14741
14766
  if (entry.startsWith(".")) continue;
14742
- const skillMd = (0, import_node_path36.join)(dir, entry, "SKILL.md");
14767
+ const skillMd = (0, import_node_path37.join)(dir, entry, "SKILL.md");
14743
14768
  if (!(0, import_node_fs40.existsSync)(skillMd)) continue;
14744
14769
  try {
14745
14770
  if (!(0, import_node_fs40.statSync)(skillMd).isFile()) continue;
@@ -14761,12 +14786,12 @@ function scanClaudePluginSkills(pluginsRoot, out) {
14761
14786
  return;
14762
14787
  }
14763
14788
  if (lookingForSkillsDir && entries.includes("SKILL.md")) {
14764
- const skill = readSkill((0, import_node_path36.join)(dir, "SKILL.md"), "cli");
14789
+ const skill = readSkill((0, import_node_path37.join)(dir, "SKILL.md"), "cli");
14765
14790
  if (skill) out.push(skill);
14766
14791
  }
14767
14792
  for (const entry of entries) {
14768
14793
  if (entry === "node_modules" || entry === ".git") continue;
14769
- const full = (0, import_node_path36.join)(dir, entry);
14794
+ const full = (0, import_node_path37.join)(dir, entry);
14770
14795
  try {
14771
14796
  if (!(0, import_node_fs40.statSync)(full).isDirectory()) continue;
14772
14797
  } catch {
@@ -14786,17 +14811,17 @@ function discoverSkills(worktreePath) {
14786
14811
  const home = (0, import_node_os11.homedir)();
14787
14812
  const collected = [];
14788
14813
  for (const rel of [".claude/skills", ".cursor/skills", ".sideboard/skills", ".brightsy/skills", "skills"]) {
14789
- scanSkillsDir((0, import_node_path36.join)(worktreePath, rel), "workspace", collected);
14814
+ scanSkillsDir((0, import_node_path37.join)(worktreePath, rel), "workspace", collected);
14790
14815
  }
14791
14816
  for (const abs of [
14792
- (0, import_node_path36.join)(home, ".claude/skills"),
14793
- (0, import_node_path36.join)(home, ".cursor/skills"),
14794
- (0, import_node_path36.join)(home, ".sideboard/skills"),
14795
- (0, import_node_path36.join)(home, ".brightsy/skills")
14817
+ (0, import_node_path37.join)(home, ".claude/skills"),
14818
+ (0, import_node_path37.join)(home, ".cursor/skills"),
14819
+ (0, import_node_path37.join)(home, ".sideboard/skills"),
14820
+ (0, import_node_path37.join)(home, ".brightsy/skills")
14796
14821
  ]) {
14797
14822
  scanSkillsDir(abs, "user", collected);
14798
14823
  }
14799
- scanClaudePluginSkills((0, import_node_path36.join)(home, ".claude/plugins"), collected);
14824
+ scanClaudePluginSkills((0, import_node_path37.join)(home, ".claude/plugins"), collected);
14800
14825
  const rank = { workspace: 0, user: 1, cli: 2 };
14801
14826
  const byCommand = /* @__PURE__ */ new Map();
14802
14827
  for (const skill of collected) {
@@ -14822,13 +14847,13 @@ function readSkillBody(skillPath, maxChars = 12e3) {
14822
14847
 
14823
14848
  \u2026(truncated)` : raw;
14824
14849
  }
14825
- var import_node_fs40, import_node_os11, import_node_path36;
14850
+ var import_node_fs40, import_node_os11, import_node_path37;
14826
14851
  var init_discover = __esm({
14827
14852
  "src/skills/discover.ts"() {
14828
14853
  "use strict";
14829
14854
  import_node_fs40 = require("fs");
14830
14855
  import_node_os11 = require("os");
14831
- import_node_path36 = require("path");
14856
+ import_node_path37 = require("path");
14832
14857
  }
14833
14858
  });
14834
14859
 
@@ -14919,7 +14944,7 @@ var init_expand = __esm({
14919
14944
 
14920
14945
  // src/composer/stage-files.ts
14921
14946
  function fileExtension(filePath) {
14922
- const base = (0, import_node_path37.basename)(filePath).toLowerCase();
14947
+ const base = (0, import_node_path38.basename)(filePath).toLowerCase();
14923
14948
  return base.includes(".") ? base.split(".").pop() || "" : "";
14924
14949
  }
14925
14950
  function isImageFilePath(filePath) {
@@ -14929,9 +14954,9 @@ function imageMimeType(filePath) {
14929
14954
  return IMAGE_MIME_BY_EXT[fileExtension(filePath)] || "image/png";
14930
14955
  }
14931
14956
  function ensureAttachmentsDir(worktreePath) {
14932
- const dir = (0, import_node_path37.join)(worktreePath, ATTACHMENTS_DIR);
14957
+ const dir = (0, import_node_path38.join)(worktreePath, ATTACHMENTS_DIR);
14933
14958
  (0, import_node_fs41.mkdirSync)(dir, { recursive: true });
14934
- const gi = (0, import_node_path37.join)(dir, ".gitignore");
14959
+ const gi = (0, import_node_path38.join)(dir, ".gitignore");
14935
14960
  if (!(0, import_node_fs41.existsSync)(gi)) {
14936
14961
  (0, import_node_fs41.writeFileSync)(gi, attachmentsGitignoreBody(), "utf8");
14937
14962
  }
@@ -14939,12 +14964,12 @@ function ensureAttachmentsDir(worktreePath) {
14939
14964
  }
14940
14965
  function uniqueAttachmentName(dir, originalName) {
14941
14966
  const safe = originalName.replace(/[/\\]/g, "_") || "file";
14942
- if (!(0, import_node_fs41.existsSync)((0, import_node_path37.join)(dir, safe))) return safe;
14943
- const ext = (0, import_node_path37.extname)(safe);
14967
+ if (!(0, import_node_fs41.existsSync)((0, import_node_path38.join)(dir, safe))) return safe;
14968
+ const ext = (0, import_node_path38.extname)(safe);
14944
14969
  const stem = ext ? safe.slice(0, -ext.length) : safe;
14945
14970
  for (let i = 1; i < 1e4; i++) {
14946
14971
  const candidate = `${stem}-${i}${ext}`;
14947
- if (!(0, import_node_fs41.existsSync)((0, import_node_path37.join)(dir, candidate))) return candidate;
14972
+ if (!(0, import_node_fs41.existsSync)((0, import_node_path38.join)(dir, candidate))) return candidate;
14948
14973
  }
14949
14974
  return `${stem}-${(0, import_node_crypto8.randomUUID)()}${ext}`;
14950
14975
  }
@@ -14996,7 +15021,7 @@ function attachmentFromBuffer(name, buf, opts) {
14996
15021
  };
14997
15022
  }
14998
15023
  function attachmentFromAbsolutePath(absolutePath) {
14999
- const name = (0, import_node_path37.basename)(absolutePath);
15024
+ const name = (0, import_node_path38.basename)(absolutePath);
15000
15025
  try {
15001
15026
  const st = (0, import_node_fs41.statSync)(absolutePath);
15002
15027
  if (!st.isFile()) {
@@ -15023,12 +15048,12 @@ function stageAbsolutePathsAsAttachments(worktreePath, absolutePaths) {
15023
15048
  const dir = ensureAttachmentsDir(worktreePath);
15024
15049
  const out = [];
15025
15050
  for (const abs of absolutePaths) {
15026
- const originalName = (0, import_node_path37.basename)(abs);
15051
+ const originalName = (0, import_node_path38.basename)(abs);
15027
15052
  try {
15028
15053
  const st = (0, import_node_fs41.statSync)(abs);
15029
15054
  if (!st.isFile()) continue;
15030
15055
  const name = uniqueAttachmentName(dir, originalName);
15031
- const destAbs = (0, import_node_path37.join)(dir, name);
15056
+ const destAbs = (0, import_node_path38.join)(dir, name);
15032
15057
  (0, import_node_fs41.copyFileSync)(abs, destAbs);
15033
15058
  const rel = `${ATTACHMENTS_DIR}/${name}`;
15034
15059
  const buf = (0, import_node_fs41.readFileSync)(destAbs);
@@ -15053,7 +15078,7 @@ function stageBuffersAsAttachments(worktreePath, buffers2) {
15053
15078
  try {
15054
15079
  const buf = Buffer.from(item.dataBase64, "base64");
15055
15080
  const name = uniqueAttachmentName(dir, originalName);
15056
- const destAbs = (0, import_node_path37.join)(dir, name);
15081
+ const destAbs = (0, import_node_path38.join)(dir, name);
15057
15082
  (0, import_node_fs41.writeFileSync)(destAbs, buf);
15058
15083
  const rel = `${ATTACHMENTS_DIR}/${name}`;
15059
15084
  out.push(attachmentFromBuffer(name, buf, { path: rel }));
@@ -15090,15 +15115,15 @@ function attachmentsFromWorktreePaths(worktreePath, relativePaths) {
15090
15115
  if (!rel || rel.includes("..") || rel.startsWith("/")) {
15091
15116
  out.push({
15092
15117
  id: (0, import_node_crypto8.randomUUID)(),
15093
- name: (0, import_node_path37.basename)(rel) || "file",
15118
+ name: (0, import_node_path38.basename)(rel) || "file",
15094
15119
  kind: "file",
15095
15120
  content: `(invalid path: ${rel})`
15096
15121
  });
15097
15122
  continue;
15098
15123
  }
15099
- const name = (0, import_node_path37.basename)(rel);
15124
+ const name = (0, import_node_path38.basename)(rel);
15100
15125
  try {
15101
- const abs = (0, import_node_path37.join)(worktreePath, rel);
15126
+ const abs = (0, import_node_path38.join)(worktreePath, rel);
15102
15127
  const st = (0, import_node_fs41.statSync)(abs);
15103
15128
  if (!st.isFile()) continue;
15104
15129
  const buf = (0, import_node_fs41.readFileSync)(abs);
@@ -15114,12 +15139,12 @@ function attachmentsFromWorktreePaths(worktreePath, relativePaths) {
15114
15139
  }
15115
15140
  return out;
15116
15141
  }
15117
- var import_node_fs41, import_node_path37, import_node_crypto8, IMAGE_EXTENSIONS2, IMAGE_MIME_BY_EXT, MAX_INLINE_BYTES, MAX_PREVIEW_BYTES;
15142
+ var import_node_fs41, import_node_path38, import_node_crypto8, IMAGE_EXTENSIONS2, IMAGE_MIME_BY_EXT, MAX_INLINE_BYTES, MAX_PREVIEW_BYTES;
15118
15143
  var init_stage_files = __esm({
15119
15144
  "src/composer/stage-files.ts"() {
15120
15145
  "use strict";
15121
15146
  import_node_fs41 = require("fs");
15122
- import_node_path37 = require("path");
15147
+ import_node_path38 = require("path");
15123
15148
  import_node_crypto8 = require("crypto");
15124
15149
  init_workspace_scratch();
15125
15150
  IMAGE_EXTENSIONS2 = /* @__PURE__ */ new Set([
@@ -15296,7 +15321,7 @@ function loadAgentInstructions(worktreePath, agent) {
15296
15321
  const out = [];
15297
15322
  for (const rel of candidates) {
15298
15323
  if (seenPaths.has(rel)) continue;
15299
- const abs = (0, import_node_path38.join)(worktreePath, rel);
15324
+ const abs = (0, import_node_path39.join)(worktreePath, rel);
15300
15325
  if (!(0, import_node_fs42.existsSync)(abs)) continue;
15301
15326
  try {
15302
15327
  if (!(0, import_node_fs42.statSync)(abs).isFile()) continue;
@@ -15340,12 +15365,12 @@ function withAgentInstructions(prompt, files) {
15340
15365
 
15341
15366
  ${prompt}`;
15342
15367
  }
15343
- var import_node_fs42, import_node_path38, FILES_BY_AGENT, MAX_CHARS_PER_FILE;
15368
+ var import_node_fs42, import_node_path39, FILES_BY_AGENT, MAX_CHARS_PER_FILE;
15344
15369
  var init_instructions = __esm({
15345
15370
  "src/agents/instructions.ts"() {
15346
15371
  "use strict";
15347
15372
  import_node_fs42 = require("fs");
15348
- import_node_path38 = require("path");
15373
+ import_node_path39 = require("path");
15349
15374
  init_git_auth_mode();
15350
15375
  init_worktree_labels();
15351
15376
  FILES_BY_AGENT = {
@@ -15435,13 +15460,13 @@ __export(plan_file_exports, {
15435
15460
  writePlanFile: () => writePlanFile
15436
15461
  });
15437
15462
  function ensureAttachmentsGitignore(worktreePath) {
15438
- const gitignoreAbs = (0, import_node_path39.join)(worktreePath, ATTACHMENTS_DIR, ".gitignore");
15463
+ const gitignoreAbs = (0, import_node_path40.join)(worktreePath, ATTACHMENTS_DIR, ".gitignore");
15439
15464
  if ((0, import_node_fs43.existsSync)(gitignoreAbs)) return;
15440
- (0, import_node_fs43.mkdirSync)((0, import_node_path39.dirname)(gitignoreAbs), { recursive: true });
15465
+ (0, import_node_fs43.mkdirSync)((0, import_node_path40.dirname)(gitignoreAbs), { recursive: true });
15441
15466
  (0, import_node_fs43.writeFileSync)(gitignoreAbs, attachmentsGitignoreBody(), "utf8");
15442
15467
  }
15443
15468
  function planFileAbs(worktreePath) {
15444
- return (0, import_node_path39.join)(worktreePath, PLAN_FILE_REL);
15469
+ return (0, import_node_path40.join)(worktreePath, PLAN_FILE_REL);
15445
15470
  }
15446
15471
  function readTextIfPresent2(abs) {
15447
15472
  if (!(0, import_node_fs43.existsSync)(abs)) return null;
@@ -15453,22 +15478,22 @@ function readTextIfPresent2(abs) {
15453
15478
  }
15454
15479
  }
15455
15480
  function readPlanFile(worktreePath) {
15456
- return readTextIfPresent2(planFileAbs(worktreePath)) ?? readTextIfPresent2((0, import_node_path39.join)(worktreePath, `${LEGACY_ATTACHMENTS_DIR}/plan.md`)) ?? readTextIfPresent2((0, import_node_path39.join)(worktreePath, LEGACY_PLAN_FILE_REL));
15481
+ return readTextIfPresent2(planFileAbs(worktreePath)) ?? readTextIfPresent2((0, import_node_path40.join)(worktreePath, `${LEGACY_ATTACHMENTS_DIR}/plan.md`)) ?? readTextIfPresent2((0, import_node_path40.join)(worktreePath, LEGACY_PLAN_FILE_REL));
15457
15482
  }
15458
15483
  function writePlanFile(worktreePath, content) {
15459
15484
  ensureAttachmentsGitignore(worktreePath);
15460
15485
  const abs = planFileAbs(worktreePath);
15461
- (0, import_node_fs43.mkdirSync)((0, import_node_path39.dirname)(abs), { recursive: true });
15486
+ (0, import_node_fs43.mkdirSync)((0, import_node_path40.dirname)(abs), { recursive: true });
15462
15487
  const body = content.trimEnd() + (content.endsWith("\n") ? "" : "\n");
15463
15488
  (0, import_node_fs43.writeFileSync)(abs, body, "utf8");
15464
15489
  return PLAN_FILE_REL;
15465
15490
  }
15466
- var import_node_fs43, import_node_path39;
15491
+ var import_node_fs43, import_node_path40;
15467
15492
  var init_plan_file = __esm({
15468
15493
  "src/plan/plan-file.ts"() {
15469
15494
  "use strict";
15470
15495
  import_node_fs43 = require("fs");
15471
- import_node_path39 = require("path");
15496
+ import_node_path40 = require("path");
15472
15497
  init_workspace_scratch();
15473
15498
  init_plan_present();
15474
15499
  init_plan_present();
@@ -15514,6 +15539,37 @@ var init_sync_branch = __esm({
15514
15539
  }
15515
15540
  });
15516
15541
 
15542
+ // src/agents/cursor-store.ts
15543
+ function cursorSdkStoreDir(threadId) {
15544
+ const root = (0, import_node_path41.join)(appDataDir(), CURSOR_SDK_STORE_DIR);
15545
+ const id = sanitizeCursorStoreSegment(threadId);
15546
+ if (!id) return root;
15547
+ return (0, import_node_path41.join)(root, "threads", id);
15548
+ }
15549
+ function cursorSdkRunsNdjsonPath(threadId) {
15550
+ return (0, import_node_path41.join)(cursorSdkStoreDir(threadId), "runs.ndjson");
15551
+ }
15552
+ function cursorSdkRunsNdjsonSearchPaths(threadId) {
15553
+ const scoped = cursorSdkRunsNdjsonPath(threadId);
15554
+ const shared = cursorSdkRunsNdjsonPath(null);
15555
+ if (!threadId || !sanitizeCursorStoreSegment(threadId) || scoped === shared) {
15556
+ return [shared];
15557
+ }
15558
+ return [scoped, shared];
15559
+ }
15560
+ function sanitizeCursorStoreSegment(threadId) {
15561
+ return (threadId ?? "").trim().replace(/[^a-zA-Z0-9._-]/g, "_");
15562
+ }
15563
+ var import_node_path41, CURSOR_SDK_STORE_DIR;
15564
+ var init_cursor_store = __esm({
15565
+ "src/agents/cursor-store.ts"() {
15566
+ "use strict";
15567
+ import_node_path41 = require("path");
15568
+ init_paths();
15569
+ CURSOR_SDK_STORE_DIR = "cursor-sdk-store";
15570
+ }
15571
+ });
15572
+
15517
15573
  // src/agents/cursor-recover.ts
15518
15574
  var cursor_recover_exports = {};
15519
15575
  __export(cursor_recover_exports, {
@@ -15522,7 +15578,14 @@ __export(cursor_recover_exports, {
15522
15578
  function recoverFinishedCursorRun(opts) {
15523
15579
  const agentId = opts.agentId.trim();
15524
15580
  if (!agentId) return null;
15525
- const runsPath = (0, import_node_path40.join)(appDataDir(), "cursor-sdk-store", "runs.ndjson");
15581
+ let best = null;
15582
+ for (const runsPath of cursorSdkRunsNdjsonSearchPaths(opts.threadId)) {
15583
+ const hit = scanFinishedCursorRuns(runsPath, agentId, opts.startedAfterMs);
15584
+ if (hit && (!best || hit.endedAt >= best.endedAt)) best = hit;
15585
+ }
15586
+ return best;
15587
+ }
15588
+ function scanFinishedCursorRuns(runsPath, agentId, startedAfterMs) {
15526
15589
  if (!(0, import_node_fs44.existsSync)(runsPath)) return null;
15527
15590
  try {
15528
15591
  const lines = (0, import_node_fs44.readFileSync)(runsPath, "utf8").split("\n");
@@ -15541,7 +15604,7 @@ function recoverFinishedCursorRun(opts) {
15541
15604
  if (typeof row.result !== "string" || !row.result.trim()) continue;
15542
15605
  const endedAt = typeof row.endedAt === "number" ? row.endedAt : 0;
15543
15606
  const createdAt = typeof row.createdAt === "number" ? row.createdAt : 0;
15544
- if (createdAt < opts.startedAfterMs && endedAt < opts.startedAfterMs) continue;
15607
+ if (createdAt < startedAfterMs && endedAt < startedAfterMs) continue;
15545
15608
  if (!best || endedAt >= best.endedAt) {
15546
15609
  best = { runId: row.runId || "", result: row.result.trim(), endedAt };
15547
15610
  }
@@ -15551,13 +15614,12 @@ function recoverFinishedCursorRun(opts) {
15551
15614
  return null;
15552
15615
  }
15553
15616
  }
15554
- var import_node_fs44, import_node_path40;
15617
+ var import_node_fs44;
15555
15618
  var init_cursor_recover = __esm({
15556
15619
  "src/agents/cursor-recover.ts"() {
15557
15620
  "use strict";
15558
15621
  import_node_fs44 = require("fs");
15559
- import_node_path40 = require("path");
15560
- init_paths();
15622
+ init_cursor_store();
15561
15623
  }
15562
15624
  });
15563
15625
 
@@ -15718,6 +15780,7 @@ var init_orchestrator = __esm({
15718
15780
  init_run();
15719
15781
  init_repo_git_lock();
15720
15782
  init_turn_live();
15783
+ init_reconcile_heal();
15721
15784
  init_request_review();
15722
15785
  init_fork_worktree();
15723
15786
  init_quota_failover();
@@ -15747,6 +15810,8 @@ var init_orchestrator = __esm({
15747
15810
  draining = /* @__PURE__ */ new Set();
15748
15811
  /** Threads past setStatus(running) but not yet in activeTurns (spawn in flight). */
15749
15812
  startingTurns = /* @__PURE__ */ new Set();
15813
+ /** Last sync thread-file read for false-stop heal (throttled per thread). */
15814
+ lastReconcileHealAt = /* @__PURE__ */ new Map();
15750
15815
  /**
15751
15816
  * Threads intentionally force-stopped. Prevents runTurn from re-asserting
15752
15817
  * `running` after spawn, and from overwriting `stopped` with idle/error when
@@ -16344,7 +16409,13 @@ var init_orchestrator = __esm({
16344
16409
  if (event.type === "stderr" && typeof event.data === "string") {
16345
16410
  pushTurnStderr(stderrTail, event.data);
16346
16411
  }
16347
- if (event.type !== "stdout" && event.type !== "thinking") {
16412
+ const now = Date.now();
16413
+ if (shouldReadThreadToHealReconcile(
16414
+ event.type,
16415
+ this.lastReconcileHealAt.get(threadId),
16416
+ now
16417
+ )) {
16418
+ this.lastReconcileHealAt.set(threadId, now);
16348
16419
  const live = readThread(threadId);
16349
16420
  if (live?.lastError?.includes("reconciled on startup") && (this.activeTurns.has(threadId) || this.startingTurns.has(threadId))) {
16350
16421
  setStatus(threadId, "running");
@@ -16388,7 +16459,8 @@ var init_orchestrator = __esm({
16388
16459
  for (let i = 0; i < 8; i++) {
16389
16460
  const recovered = recoverFinishedCursorRun2({
16390
16461
  agentId: sessionId,
16391
- startedAfterMs: turnStartedAt - 5e3
16462
+ startedAfterMs: turnStartedAt - 5e3,
16463
+ threadId
16392
16464
  });
16393
16465
  if (recovered?.result) {
16394
16466
  assistantText = recovered.result;
@@ -17935,6 +18007,7 @@ __export(index_exports, {
17935
18007
  isThinkingEffort: () => isThinkingEffort,
17936
18008
  isThisProcessDesktopHost: () => isThisProcessDesktopHost,
17937
18009
  isThreadCaffeinated: () => isThreadCaffeinated,
18010
+ isThreadRecordFile: () => isThreadRecordFile,
17938
18011
  isWorkspaceScratchPath: () => isWorkspaceScratchPath,
17939
18012
  lastRequestOccupancy: () => lastRequestOccupancy,
17940
18013
  linearAuthorizationHeader: () => linearAuthorizationHeader,
@@ -19154,7 +19227,7 @@ init_orphan_cleanup();
19154
19227
  var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
19155
19228
  var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
19156
19229
  var import_zod4 = require("zod");
19157
- var import_node_path41 = require("path");
19230
+ var import_node_path42 = require("path");
19158
19231
  init_orchestrator();
19159
19232
  init_worktree();
19160
19233
  init_create();
@@ -20031,7 +20104,7 @@ async function startMcpServer() {
20031
20104
  async () => {
20032
20105
  const threads = orch.getThreads(true);
20033
20106
  const lines = threads.map((t) => {
20034
- const repo = t.repoPath === GLOBAL_WORKSPACE_ID ? "Orchestration" : (0, import_node_path41.basename)(t.repoPath) || t.repoPath;
20107
+ const repo = t.repoPath === GLOBAL_WORKSPACE_ID ? "Orchestration" : (0, import_node_path42.basename)(t.repoPath) || t.repoPath;
20035
20108
  const live = t.status === "running" || t.status === "queued" ? readTurnLive(t.id) : null;
20036
20109
  const progress = live?.summary ? ` ${live.summary}` : "";
20037
20110
  return `${t.id.slice(0, 8)} ${t.status.padEnd(9)} ${t.agent.padEnd(8)} ${repo} ${t.sourceType}:${t.sourceRef} ${t.title} sideboard://thread/${t.id}${t.devPort ? ` http://localhost:${t.devPort}` : ""}${progress}`;
@@ -21373,14 +21446,14 @@ init_injected_mcp();
21373
21446
  // src/agents/user-mcp-config.ts
21374
21447
  var import_node_fs46 = require("fs");
21375
21448
  var import_node_os12 = require("os");
21376
- var import_node_path42 = require("path");
21449
+ var import_node_path43 = require("path");
21377
21450
  init_paths();
21378
21451
  init_injected_mcp();
21379
21452
  function userCursorMcpConfigPath() {
21380
- return (0, import_node_path42.join)((0, import_node_os12.homedir)(), ".cursor", "mcp.json");
21453
+ return (0, import_node_path43.join)((0, import_node_os12.homedir)(), ".cursor", "mcp.json");
21381
21454
  }
21382
21455
  function userClaudeMcpConfigPath() {
21383
- return (0, import_node_path42.join)((0, import_node_os12.homedir)(), ".claude.json");
21456
+ return (0, import_node_path43.join)((0, import_node_os12.homedir)(), ".claude.json");
21384
21457
  }
21385
21458
  function asObject(value) {
21386
21459
  if (!value || typeof value !== "object" || Array.isArray(value)) return {};
@@ -21415,7 +21488,7 @@ function writeMergedMcpServersJson(configPath, sideboard) {
21415
21488
  }
21416
21489
  }
21417
21490
  const next = mergeSideboardIntoMcpServersJson(existing, sideboard);
21418
- (0, import_node_fs46.mkdirSync)((0, import_node_path42.dirname)(configPath), { recursive: true });
21491
+ (0, import_node_fs46.mkdirSync)((0, import_node_path43.dirname)(configPath), { recursive: true });
21419
21492
  (0, import_node_fs46.writeFileSync)(configPath, `${JSON.stringify(next, null, 2)}
21420
21493
  `);
21421
21494
  }
@@ -23066,7 +23139,7 @@ var import_ws3 = require("ws");
23066
23139
  // src/slack/relay-static.ts
23067
23140
  var import_node_fs47 = require("fs");
23068
23141
  var import_promises = require("fs/promises");
23069
- var import_node_path43 = __toESM(require("path"), 1);
23142
+ var import_node_path44 = __toESM(require("path"), 1);
23070
23143
  var TYPES = {
23071
23144
  ".css": "text/css; charset=utf-8",
23072
23145
  ".html": "text/html; charset=utf-8",
@@ -23097,9 +23170,9 @@ function resolveStaticPath(root, requestUrl) {
23097
23170
  return null;
23098
23171
  }
23099
23172
  if (!pathname.startsWith("/") || pathname.includes("\0")) return null;
23100
- const rootResolved = import_node_path43.default.resolve(root);
23101
- const candidate = import_node_path43.default.resolve(rootResolved, `.${pathname}`);
23102
- if (candidate !== rootResolved && !candidate.startsWith(rootResolved + import_node_path43.default.sep)) {
23173
+ const rootResolved = import_node_path44.default.resolve(root);
23174
+ const candidate = import_node_path44.default.resolve(rootResolved, `.${pathname}`);
23175
+ if (candidate !== rootResolved && !candidate.startsWith(rootResolved + import_node_path44.default.sep)) {
23103
23176
  return null;
23104
23177
  }
23105
23178
  return candidate;
@@ -23113,7 +23186,7 @@ async function fileSize(file) {
23113
23186
  }
23114
23187
  }
23115
23188
  function sendFile(req, res, file, size) {
23116
- const ext = import_node_path43.default.extname(file).toLowerCase();
23189
+ const ext = import_node_path44.default.extname(file).toLowerCase();
23117
23190
  res.writeHead(200, {
23118
23191
  "Content-Type": TYPES[ext] ?? "application/octet-stream",
23119
23192
  "Content-Length": size,
@@ -23132,7 +23205,7 @@ async function tryServeStatic(req, res, root) {
23132
23205
  if (!candidate) return false;
23133
23206
  const direct = await fileSize(candidate);
23134
23207
  if (direct != null) return sendFile(req, res, candidate, direct);
23135
- const asIndex = import_node_path43.default.join(candidate, "index.html");
23208
+ const asIndex = import_node_path44.default.join(candidate, "index.html");
23136
23209
  const indexSize = await fileSize(asIndex);
23137
23210
  if (indexSize != null) return sendFile(req, res, asIndex, indexSize);
23138
23211
  return false;
@@ -23692,6 +23765,7 @@ init_outbound_watch();
23692
23765
  isThinkingEffort,
23693
23766
  isThisProcessDesktopHost,
23694
23767
  isThreadCaffeinated,
23768
+ isThreadRecordFile,
23695
23769
  isWorkspaceScratchPath,
23696
23770
  lastRequestOccupancy,
23697
23771
  linearAuthorizationHeader,