@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
@@ -670,6 +670,7 @@ __export(thread_store_exports, {
670
670
  createEmptyThread: () => createEmptyThread,
671
671
  deleteThreadRecord: () => deleteThreadRecord,
672
672
  findThreadByRef: () => findThreadByRef,
673
+ isThreadRecordFile: () => isThreadRecordFile,
673
674
  listThreads: () => listThreads,
674
675
  normalizeThread: () => normalizeThread,
675
676
  readThread: () => readThread,
@@ -780,7 +781,8 @@ function writeThread(thread) {
780
781
  function idPath(id) {
781
782
  return id;
782
783
  }
783
- function isThreadRecordFile(name) {
784
+ function isThreadRecordFile(nameOrPath) {
785
+ const name = (0, import_node_path7.basename)(nameOrPath);
784
786
  return name.endsWith(".json") && !name.endsWith(".live.json");
785
787
  }
786
788
  function listThreads(opts) {
@@ -831,12 +833,13 @@ function findThreadByRef(ref) {
831
833
  (t) => t.id === ref || t.id.startsWith(ref) || t.branchName === ref || t.title === ref
832
834
  ) ?? null;
833
835
  }
834
- var import_node_crypto2, import_node_fs7, import_proper_lockfile;
836
+ var import_node_crypto2, import_node_fs7, import_node_path7, import_proper_lockfile;
835
837
  var init_thread_store = __esm({
836
838
  "src/store/thread-store.ts"() {
837
839
  "use strict";
838
840
  import_node_crypto2 = require("crypto");
839
841
  import_node_fs7 = require("fs");
842
+ import_node_path7 = require("path");
840
843
  import_proper_lockfile = __toESM(require("proper-lockfile"), 1);
841
844
  init_thinking_effort();
842
845
  init_paths();
@@ -887,7 +890,7 @@ var init_api = __esm({
887
890
 
888
891
  // src/slack/reply-target.ts
889
892
  function storePath() {
890
- return (0, import_node_path7.join)(appDataDir(), "slack-reply-to.json");
893
+ return (0, import_node_path8.join)(appDataDir(), "slack-reply-to.json");
891
894
  }
892
895
  function readStore() {
893
896
  const path = storePath();
@@ -902,12 +905,12 @@ function readStore() {
902
905
  function getSlackReplyTarget(threadId) {
903
906
  return readStore()[threadId] ?? null;
904
907
  }
905
- var import_node_fs8, import_node_path7;
908
+ var import_node_fs8, import_node_path8;
906
909
  var init_reply_target = __esm({
907
910
  "src/slack/reply-target.ts"() {
908
911
  "use strict";
909
912
  import_node_fs8 = require("fs");
910
- import_node_path7 = require("path");
913
+ import_node_path8 = require("path");
911
914
  init_paths();
912
915
  init_private_file();
913
916
  init_secure_file();
@@ -916,7 +919,7 @@ var init_reply_target = __esm({
916
919
 
917
920
  // src/slack/workspaces.ts
918
921
  function storePath2() {
919
- return (0, import_node_path8.join)(appDataDir(), "slack-workspaces.json");
922
+ return (0, import_node_path9.join)(appDataDir(), "slack-workspaces.json");
920
923
  }
921
924
  function readStore2() {
922
925
  try {
@@ -977,11 +980,11 @@ function requireSlackWorkspace(teamId) {
977
980
  }
978
981
  return ws;
979
982
  }
980
- var import_node_path8;
983
+ var import_node_path9;
981
984
  var init_workspaces = __esm({
982
985
  "src/slack/workspaces.ts"() {
983
986
  "use strict";
984
- import_node_path8 = require("path");
987
+ import_node_path9 = require("path");
985
988
  init_paths();
986
989
  init_secure_file();
987
990
  init_api();
@@ -990,7 +993,7 @@ var init_workspaces = __esm({
990
993
 
991
994
  // src/slack/outbound-watch.ts
992
995
  function storePath3() {
993
- return (0, import_node_path9.join)(appDataDir(), "slack-outbound-watch.json");
996
+ return (0, import_node_path10.join)(appDataDir(), "slack-outbound-watch.json");
994
997
  }
995
998
  function watchId(teamId, channelId, ts) {
996
999
  return `${teamId}:${channelId}:${ts}`;
@@ -1352,12 +1355,12 @@ async function refreshSlackReplyBadges(opts) {
1352
1355
  if (changed) writeStore(watches);
1353
1356
  return listSlackReplyBadges();
1354
1357
  }
1355
- var import_node_fs9, import_node_path9, MAX_WATCHES, MAX_REPLIES_PER_WATCH, WATCH_TTL_MS, POLL_INTERVAL_MS, lastPollMs, nameCache;
1358
+ var import_node_fs9, import_node_path10, MAX_WATCHES, MAX_REPLIES_PER_WATCH, WATCH_TTL_MS, POLL_INTERVAL_MS, lastPollMs, nameCache;
1356
1359
  var init_outbound_watch = __esm({
1357
1360
  "src/slack/outbound-watch.ts"() {
1358
1361
  "use strict";
1359
1362
  import_node_fs9 = require("fs");
1360
- import_node_path9 = require("path");
1363
+ import_node_path10 = require("path");
1361
1364
  init_paths();
1362
1365
  init_private_file();
1363
1366
  init_secure_file();
@@ -1492,7 +1495,7 @@ function summarizeTurnStderr(tail, maxChars = 500) {
1492
1495
  function looksLikeInvalidAgentSession(text4) {
1493
1496
  const lower = text4.trim().toLowerCase();
1494
1497
  if (!lower) return false;
1495
- 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);
1498
+ 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);
1496
1499
  }
1497
1500
  function looksLikeRetryableRunnerCrash(text4) {
1498
1501
  if (looksLikeAgentFailureMessage(text4)) return false;
@@ -1609,15 +1612,15 @@ var init_error_detail = __esm({
1609
1612
  function prependPathDir(env, dir) {
1610
1613
  if (!dir || !(0, import_node_fs10.existsSync)(dir)) return;
1611
1614
  const current = env.PATH ?? "";
1612
- const parts = current.split(import_node_path10.delimiter).filter(Boolean);
1615
+ const parts = current.split(import_node_path11.delimiter).filter(Boolean);
1613
1616
  if (parts.includes(dir)) {
1614
1617
  env.PATH = current;
1615
1618
  return;
1616
1619
  }
1617
- env.PATH = [dir, ...parts].join(import_node_path10.delimiter);
1620
+ env.PATH = [dir, ...parts].join(import_node_path11.delimiter);
1618
1621
  }
1619
1622
  function conductorBundledBinDir(home = process.env.HOME || process.env.USERPROFILE || (0, import_node_os3.homedir)()) {
1620
- return (0, import_node_path10.join)(home, "Library", "Application Support", "com.conductor.app", "bin");
1623
+ return (0, import_node_path11.join)(home, "Library", "Application Support", "com.conductor.app", "bin");
1621
1624
  }
1622
1625
  function isConductorBundledCli(filePath) {
1623
1626
  const p = (filePath ?? "").replace(/\\/g, "/");
@@ -1626,10 +1629,10 @@ function isConductorBundledCli(filePath) {
1626
1629
  function ensureAgentPath(env = process.env) {
1627
1630
  const home = env.HOME || env.USERPROFILE || (0, import_node_os3.homedir)();
1628
1631
  const current = env.PATH ?? "";
1629
- const parts = current.split(import_node_path10.delimiter).filter(Boolean);
1632
+ const parts = current.split(import_node_path11.delimiter).filter(Boolean);
1630
1633
  const seen = new Set(parts);
1631
1634
  const extras = [
1632
- ...EXTRA_BIN_DIRS.map((rel) => (0, import_node_path10.join)(home, rel)),
1635
+ ...EXTRA_BIN_DIRS.map((rel) => (0, import_node_path11.join)(home, rel)),
1633
1636
  "/opt/homebrew/bin",
1634
1637
  "/usr/local/bin",
1635
1638
  // Keep after Homebrew/npm so a user-installed CLI still wins.
@@ -1640,7 +1643,7 @@ function ensureAgentPath(env = process.env) {
1640
1643
  parts.unshift(dir);
1641
1644
  seen.add(dir);
1642
1645
  }
1643
- const next = parts.join(import_node_path10.delimiter);
1646
+ const next = parts.join(import_node_path11.delimiter);
1644
1647
  env.PATH = next;
1645
1648
  return next;
1646
1649
  }
@@ -1654,7 +1657,7 @@ function enrichPathWithNpmGlobalBin(env = process.env) {
1654
1657
  stdio: ["ignore", "pipe", "ignore"]
1655
1658
  }).trim().split(/\r?\n/).find(Boolean);
1656
1659
  if (prefix) {
1657
- const binDir = process.platform === "win32" ? prefix : (0, import_node_path10.join)(prefix, "bin");
1660
+ const binDir = process.platform === "win32" ? prefix : (0, import_node_path11.join)(prefix, "bin");
1658
1661
  prependPathDir(env, binDir);
1659
1662
  }
1660
1663
  } catch {
@@ -1682,14 +1685,14 @@ function withExportedPath(command, pathValue) {
1682
1685
  if (/^(export\s+PATH=|PATH=)/.test(trimmed)) return trimmed;
1683
1686
  return `export PATH=${posixShellSingleQuote(pathValue)} && ${trimmed}`;
1684
1687
  }
1685
- var import_node_fs10, import_node_child_process2, import_node_os3, import_node_path10, EXTRA_BIN_DIRS;
1688
+ var import_node_fs10, import_node_child_process2, import_node_os3, import_node_path11, EXTRA_BIN_DIRS;
1686
1689
  var init_path = __esm({
1687
1690
  "src/agents/path.ts"() {
1688
1691
  "use strict";
1689
1692
  import_node_fs10 = require("fs");
1690
1693
  import_node_child_process2 = require("child_process");
1691
1694
  import_node_os3 = require("os");
1692
- import_node_path10 = require("path");
1695
+ import_node_path11 = require("path");
1693
1696
  EXTRA_BIN_DIRS = [
1694
1697
  ".local/bin",
1695
1698
  ".cargo/bin",
@@ -1711,7 +1714,7 @@ function isIndexLockError(text4) {
1711
1714
  return /Unable to create ['"][^'"]*index\.lock['"]: File exists/i.test(text4);
1712
1715
  }
1713
1716
  function clearStaleIndexLock(gitDir, maxAgeMs = STALE_INDEX_LOCK_MS, now = Date.now()) {
1714
- const lockPath = (0, import_node_path11.join)(gitDir, "index.lock");
1717
+ const lockPath = (0, import_node_path12.join)(gitDir, "index.lock");
1715
1718
  try {
1716
1719
  if (!(0, import_node_fs11.existsSync)(lockPath)) return null;
1717
1720
  if (now - (0, import_node_fs11.statSync)(lockPath).mtimeMs < maxAgeMs) return null;
@@ -1730,12 +1733,12 @@ function clearStaleIndexLocks(gitDirs, maxAgeMs = STALE_INDEX_LOCK_MS) {
1730
1733
  }
1731
1734
  return removed;
1732
1735
  }
1733
- var import_node_fs11, import_node_path11, STALE_INDEX_LOCK_MS;
1736
+ var import_node_fs11, import_node_path12, STALE_INDEX_LOCK_MS;
1734
1737
  var init_stale_lock = __esm({
1735
1738
  "src/git/stale-lock.ts"() {
1736
1739
  "use strict";
1737
1740
  import_node_fs11 = require("fs");
1738
- import_node_path11 = require("path");
1741
+ import_node_path12 = require("path");
1739
1742
  STALE_INDEX_LOCK_MS = 2e4;
1740
1743
  }
1741
1744
  });
@@ -2753,7 +2756,7 @@ var init_gh_errors = __esm({
2753
2756
 
2754
2757
  // src/store/secret-vault.ts
2755
2758
  function secretVaultPath() {
2756
- return (0, import_node_path12.join)(appDataDir(), "secrets.json");
2759
+ return (0, import_node_path13.join)(appDataDir(), "secrets.json");
2757
2760
  }
2758
2761
  function loadSecretVault() {
2759
2762
  const parsed = readSecureJson(secretVaultPath());
@@ -2797,11 +2800,11 @@ function normalizeVault(raw) {
2797
2800
  }
2798
2801
  return out;
2799
2802
  }
2800
- var import_node_path12;
2803
+ var import_node_path13;
2801
2804
  var init_secret_vault = __esm({
2802
2805
  "src/store/secret-vault.ts"() {
2803
2806
  "use strict";
2804
- import_node_path12 = require("path");
2807
+ import_node_path13 = require("path");
2805
2808
  init_paths();
2806
2809
  init_secure_file();
2807
2810
  }
@@ -2904,10 +2907,10 @@ function toPublicAppSettings(settings) {
2904
2907
  };
2905
2908
  }
2906
2909
  function appSettingsPath() {
2907
- return (0, import_node_path13.join)(appDataDir(), "settings.json");
2910
+ return (0, import_node_path14.join)(appDataDir(), "settings.json");
2908
2911
  }
2909
2912
  function claudeUserSettingsPath() {
2910
- return (0, import_node_path13.join)((0, import_node_os4.homedir)(), ".claude", "settings.json");
2913
+ return (0, import_node_path14.join)((0, import_node_os4.homedir)(), ".claude", "settings.json");
2911
2914
  }
2912
2915
  function normalizeClaude(raw) {
2913
2916
  if (!raw || typeof raw !== "object") return {};
@@ -3731,14 +3734,14 @@ function childEnvWithAppSettings(extra) {
3731
3734
  function harnessEnvKey(harness) {
3732
3735
  return HARNESS_ENV_KEYS[harness];
3733
3736
  }
3734
- var import_node_crypto3, import_node_fs12, import_node_os4, import_node_path13, HARNESS_ENV_KEYS, DEFAULT_AGENTS, GITHUB_GIT_AUTH_MODES, CLOUD_CONNECT_AGENTS, ISSUE_SOURCES, GIT_AUTH_MODES, EMPTY_SETTINGS, DEFAULT_CLI_BIN;
3737
+ var import_node_crypto3, import_node_fs12, import_node_os4, import_node_path14, HARNESS_ENV_KEYS, DEFAULT_AGENTS, GITHUB_GIT_AUTH_MODES, CLOUD_CONNECT_AGENTS, ISSUE_SOURCES, GIT_AUTH_MODES, EMPTY_SETTINGS, DEFAULT_CLI_BIN;
3735
3738
  var init_app_settings = __esm({
3736
3739
  "src/store/app-settings.ts"() {
3737
3740
  "use strict";
3738
3741
  import_node_crypto3 = require("crypto");
3739
3742
  import_node_fs12 = require("fs");
3740
3743
  import_node_os4 = require("os");
3741
- import_node_path13 = require("path");
3744
+ import_node_path14 = require("path");
3742
3745
  init_thinking_effort();
3743
3746
  init_nested_electron_env();
3744
3747
  init_paths();
@@ -3790,18 +3793,18 @@ var init_app_settings = __esm({
3790
3793
  function githubAgentAuthDir() {
3791
3794
  const override = process.env.SIDEBOARD_GIT_AUTH_DIR?.trim();
3792
3795
  if (override) return override;
3793
- return (0, import_node_path14.join)((0, import_node_os5.homedir)(), ".sideboard-git-auth");
3796
+ return (0, import_node_path15.join)((0, import_node_os5.homedir)(), ".sideboard-git-auth");
3794
3797
  }
3795
3798
  function githubCredentialStorePath() {
3796
- return (0, import_node_path14.join)(githubAgentAuthDir(), "git-credentials");
3799
+ return (0, import_node_path15.join)(githubAgentAuthDir(), "git-credentials");
3797
3800
  }
3798
3801
  function githubGhConfigDir() {
3799
- return (0, import_node_path14.join)(githubAgentAuthDir(), "gh");
3802
+ return (0, import_node_path15.join)(githubAgentAuthDir(), "gh");
3800
3803
  }
3801
3804
  function writePrivateFile2(file, body) {
3802
- (0, import_node_fs13.mkdirSync)((0, import_node_path14.dirname)(file), { recursive: true, mode: 448 });
3805
+ (0, import_node_fs13.mkdirSync)((0, import_node_path15.dirname)(file), { recursive: true, mode: 448 });
3803
3806
  try {
3804
- (0, import_node_fs13.chmodSync)((0, import_node_path14.dirname)(file), 448);
3807
+ (0, import_node_fs13.chmodSync)((0, import_node_path15.dirname)(file), 448);
3805
3808
  } catch {
3806
3809
  }
3807
3810
  (0, import_node_fs13.writeFileSync)(file, body, { encoding: "utf8", mode: 384 });
@@ -3839,11 +3842,11 @@ function materializeGithubAgentAuth(token, user) {
3839
3842
  writePrivateFile2(githubCredentialStorePath(), gitCredentialStoreContents(trimmed));
3840
3843
  const ghDir = githubGhConfigDir();
3841
3844
  (0, import_node_fs13.mkdirSync)(ghDir, { recursive: true, mode: 448 });
3842
- writePrivateFile2((0, import_node_path14.join)(ghDir, "hosts.yml"), ghHostsYml(trimmed, user));
3843
- writePrivateFile2((0, import_node_path14.join)(ghDir, "config.yml"), "git_protocol: https\nprompt: disabled\n");
3845
+ writePrivateFile2((0, import_node_path15.join)(ghDir, "hosts.yml"), ghHostsYml(trimmed, user));
3846
+ writePrivateFile2((0, import_node_path15.join)(ghDir, "config.yml"), "git_protocol: https\nprompt: disabled\n");
3844
3847
  }
3845
3848
  function githubAgentAuthReady() {
3846
- return (0, import_node_fs13.existsSync)(githubCredentialStorePath()) && (0, import_node_fs13.existsSync)((0, import_node_path14.join)(githubGhConfigDir(), "hosts.yml"));
3849
+ return (0, import_node_fs13.existsSync)(githubCredentialStorePath()) && (0, import_node_fs13.existsSync)((0, import_node_path15.join)(githubGhConfigDir(), "hosts.yml"));
3847
3850
  }
3848
3851
  function githubCredentialHelperGitConfig() {
3849
3852
  const file = githubCredentialStorePath();
@@ -3858,13 +3861,13 @@ function githubGhConfigEnv() {
3858
3861
  GH_PROMPT_DISABLED: "1"
3859
3862
  };
3860
3863
  }
3861
- var import_node_fs13, import_node_os5, import_node_path14;
3864
+ var import_node_fs13, import_node_os5, import_node_path15;
3862
3865
  var init_github_agent_auth = __esm({
3863
3866
  "src/git/github-agent-auth.ts"() {
3864
3867
  "use strict";
3865
3868
  import_node_fs13 = require("fs");
3866
3869
  import_node_os5 = require("os");
3867
- import_node_path14 = require("path");
3870
+ import_node_path15 = require("path");
3868
3871
  }
3869
3872
  });
3870
3873
 
@@ -3956,7 +3959,7 @@ async function warmGithubAgentAuth(opts) {
3956
3959
  }
3957
3960
  function normalizeWritableRoot(raw) {
3958
3961
  const trimmed = raw.trim().replace(/\/+$/, "");
3959
- return trimmed && (0, import_node_path15.isAbsolute)(trimmed) ? trimmed : null;
3962
+ return trimmed && (0, import_node_path16.isAbsolute)(trimmed) ? trimmed : null;
3960
3963
  }
3961
3964
  async function resolveCodexGitWritableRoots(cwd) {
3962
3965
  const roots = /* @__PURE__ */ new Set();
@@ -4033,11 +4036,11 @@ function formatGitAuthModeDirective(mode) {
4033
4036
  ].join("\n");
4034
4037
  }
4035
4038
  }
4036
- var import_node_path15, HTTPS_REWRITE, TOKEN_TTL_MS, tokenMemo, GITHUB_CHILD_TOKEN_KEYS;
4039
+ var import_node_path16, HTTPS_REWRITE, TOKEN_TTL_MS, tokenMemo, GITHUB_CHILD_TOKEN_KEYS;
4037
4040
  var init_git_auth_mode = __esm({
4038
4041
  "src/git/git-auth-mode.ts"() {
4039
4042
  "use strict";
4040
- import_node_path15 = require("path");
4043
+ import_node_path16 = require("path");
4041
4044
  init_app_settings();
4042
4045
  init_github_agent_auth();
4043
4046
  init_run();
@@ -5207,7 +5210,7 @@ function isLocalPrFetchBranch(ref) {
5207
5210
  }
5208
5211
  async function createThreadWorktree(opts) {
5209
5212
  let branchName = `thread/${opts.slug}`;
5210
- const worktreePath = (0, import_node_path16.join)(worktreesRoot(opts.repoPath), opts.slug);
5213
+ const worktreePath = (0, import_node_path17.join)(worktreesRoot(opts.repoPath), opts.slug);
5211
5214
  if ((0, import_node_fs14.existsSync)(worktreePath)) {
5212
5215
  throw new Error(`Worktree already exists at ${worktreePath}`);
5213
5216
  }
@@ -5275,7 +5278,7 @@ ${add.stdout}`;
5275
5278
  async function createExistingBranchWorktree(opts) {
5276
5279
  const branchName = opts.branchName.trim();
5277
5280
  if (!branchName) throw new Error("branch name required");
5278
- const worktreePath = (0, import_node_path16.join)(worktreesRoot(opts.repoPath), opts.slug);
5281
+ const worktreePath = (0, import_node_path17.join)(worktreesRoot(opts.repoPath), opts.slug);
5279
5282
  if ((0, import_node_fs14.existsSync)(worktreePath)) {
5280
5283
  throw new Error(`Worktree already exists at ${worktreePath}`);
5281
5284
  }
@@ -5567,7 +5570,7 @@ function sameRepoPath(a, b) {
5567
5570
  return normalizeWorktreePath(a) === normalizeWorktreePath(b);
5568
5571
  }
5569
5572
  function listLocalThreadBranchSlugs(repoPath) {
5570
- const refsDir = (0, import_node_path16.join)(repoPath, ".git", "refs", "heads", "thread");
5573
+ const refsDir = (0, import_node_path17.join)(repoPath, ".git", "refs", "heads", "thread");
5571
5574
  if (!(0, import_node_fs14.existsSync)(refsDir)) return [];
5572
5575
  try {
5573
5576
  return (0, import_node_fs14.readdirSync)(refsDir).filter((name) => !name.startsWith(".")).map((name) => normalizeTakenSlug(name));
@@ -5600,18 +5603,18 @@ function allocateTeamSlug(repoPath) {
5600
5603
  const taken = collectTakenTeamSlugs(repoPath);
5601
5604
  for (let attempt = 0; attempt < 32; attempt++) {
5602
5605
  const team = allocateTeamName(taken);
5603
- const path = (0, import_node_path16.join)(worktreesRoot(repoPath), team.slug);
5606
+ const path = (0, import_node_path17.join)(worktreesRoot(repoPath), team.slug);
5604
5607
  if (!(0, import_node_fs14.existsSync)(path)) return team;
5605
5608
  taken.add(team.slug);
5606
5609
  }
5607
5610
  throw new Error("No available soccer team worktree directories left");
5608
5611
  }
5609
- var import_node_fs14, import_node_path16;
5612
+ var import_node_fs14, import_node_path17;
5610
5613
  var init_worktree = __esm({
5611
5614
  "src/git/worktree.ts"() {
5612
5615
  "use strict";
5613
5616
  import_node_fs14 = require("fs");
5614
- import_node_path16 = require("path");
5617
+ import_node_path17 = require("path");
5615
5618
  init_paths();
5616
5619
  init_thread_store();
5617
5620
  init_teams();
@@ -5754,7 +5757,7 @@ function ensureGlobalCoordinatorCwd(opts) {
5754
5757
  let orchId = opts?.orchestratorThreadId?.trim() || "";
5755
5758
  if (!orchId) {
5756
5759
  try {
5757
- const existing = (0, import_node_fs15.readFileSync)((0, import_node_path17.join)(dir, "AGENTS.md"), "utf8");
5760
+ const existing = (0, import_node_fs15.readFileSync)((0, import_node_path18.join)(dir, "AGENTS.md"), "utf8");
5758
5761
  const m = existing.match(
5759
5762
  /YOUR orchestration thread id is `([0-9a-f-]{36})`/i
5760
5763
  );
@@ -5796,9 +5799,9 @@ function ensureGlobalCoordinatorCwd(opts) {
5796
5799
  "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."
5797
5800
  ].join("\n");
5798
5801
  try {
5799
- (0, import_node_fs15.writeFileSync)((0, import_node_path17.join)(dir, "CLAUDE.md"), `${body}
5802
+ (0, import_node_fs15.writeFileSync)((0, import_node_path18.join)(dir, "CLAUDE.md"), `${body}
5800
5803
  `, "utf8");
5801
- (0, import_node_fs15.writeFileSync)((0, import_node_path17.join)(dir, "AGENTS.md"), `${body}
5804
+ (0, import_node_fs15.writeFileSync)((0, import_node_path18.join)(dir, "AGENTS.md"), `${body}
5802
5805
  `, "utf8");
5803
5806
  } catch {
5804
5807
  }
@@ -5830,12 +5833,12 @@ function coordinatorSystemPrompt(opts) {
5830
5833
  formatWorkspaceInventory(opts.workspaces)
5831
5834
  ].join("\n");
5832
5835
  }
5833
- var import_node_fs15, import_node_path17, COORDINATOR_TOOL_PLAYBOOK, SLACK_REPLY_FORMATTING;
5836
+ var import_node_fs15, import_node_path18, COORDINATOR_TOOL_PLAYBOOK, SLACK_REPLY_FORMATTING;
5834
5837
  var init_coordinator_prompt = __esm({
5835
5838
  "src/orchestrator/coordinator-prompt.ts"() {
5836
5839
  "use strict";
5837
5840
  import_node_fs15 = require("fs");
5838
- import_node_path17 = require("path");
5841
+ import_node_path18 = require("path");
5839
5842
  init_worktree();
5840
5843
  init_app_settings();
5841
5844
  init_paths();
@@ -6133,7 +6136,7 @@ var init_global_workspace = __esm({
6133
6136
 
6134
6137
  // src/brightsy/config.ts
6135
6138
  function brightsyConfigPath() {
6136
- return (0, import_node_path18.join)((0, import_node_os6.homedir)(), ".brightsy", "config.json");
6139
+ return (0, import_node_path19.join)((0, import_node_os6.homedir)(), ".brightsy", "config.json");
6137
6140
  }
6138
6141
  function loadBrightsyConfig() {
6139
6142
  const path = brightsyConfigPath();
@@ -6152,13 +6155,13 @@ function saveBrightsyConfig(cfg) {
6152
6155
  mode: 384
6153
6156
  });
6154
6157
  }
6155
- var import_node_fs16, import_node_os6, import_node_path18;
6158
+ var import_node_fs16, import_node_os6, import_node_path19;
6156
6159
  var init_config = __esm({
6157
6160
  "src/brightsy/config.ts"() {
6158
6161
  "use strict";
6159
6162
  import_node_fs16 = require("fs");
6160
6163
  import_node_os6 = require("os");
6161
- import_node_path18 = require("path");
6164
+ import_node_path19 = require("path");
6162
6165
  }
6163
6166
  });
6164
6167
 
@@ -6173,7 +6176,7 @@ var init_accounts = __esm({
6173
6176
 
6174
6177
  // src/brightsy/connected-teams.ts
6175
6178
  function storePath4() {
6176
- return (0, import_node_path19.join)(appDataDir(), "brightsy-teams.json");
6179
+ return (0, import_node_path20.join)(appDataDir(), "brightsy-teams.json");
6177
6180
  }
6178
6181
  function readStore4() {
6179
6182
  const path = storePath4();
@@ -6300,12 +6303,12 @@ function brightsyMcpServerName(slug) {
6300
6303
  const cleaned = slug.replace(/[^A-Za-z0-9_-]/g, "_").replace(/^_+|_+$/g, "");
6301
6304
  return `brightsy_${cleaned || "team"}`;
6302
6305
  }
6303
- var import_node_fs17, import_node_path19;
6306
+ var import_node_fs17, import_node_path20;
6304
6307
  var init_connected_teams = __esm({
6305
6308
  "src/brightsy/connected-teams.ts"() {
6306
6309
  "use strict";
6307
6310
  import_node_fs17 = require("fs");
6308
- import_node_path19 = require("path");
6311
+ import_node_path20 = require("path");
6309
6312
  init_paths();
6310
6313
  init_accounts();
6311
6314
  init_config();
@@ -7197,43 +7200,43 @@ function electronResourcesPath() {
7197
7200
  function packagedCursorRuntimeDir() {
7198
7201
  const resources = electronResourcesPath();
7199
7202
  if (!resources) return null;
7200
- const dir = (0, import_node_path20.join)(resources, "cursor-runtime");
7201
- if (!(0, import_node_fs19.existsSync)((0, import_node_path20.join)(dir, "core-dist", "agents", "cursor-runner.js"))) return null;
7203
+ const dir = (0, import_node_path21.join)(resources, "cursor-runtime");
7204
+ if (!(0, import_node_fs19.existsSync)((0, import_node_path21.join)(dir, "core-dist", "agents", "cursor-runner.js"))) return null;
7202
7205
  return dir;
7203
7206
  }
7204
7207
  function packagedCursorRunnerPath() {
7205
7208
  const dir = packagedCursorRuntimeDir();
7206
- return dir ? (0, import_node_path20.join)(dir, "core-dist", "agents", "cursor-runner.js") : null;
7209
+ return dir ? (0, import_node_path21.join)(dir, "core-dist", "agents", "cursor-runner.js") : null;
7207
7210
  }
7208
7211
  function packagedMcpDir() {
7209
7212
  const resources = electronResourcesPath();
7210
7213
  if (!resources) return null;
7211
- const dir = (0, import_node_path20.join)(resources, "sideboard-mcp");
7212
- if (!(0, import_node_fs19.existsSync)((0, import_node_path20.join)(dir, "core-dist", "mcp", "run-stdio.js"))) return null;
7214
+ const dir = (0, import_node_path21.join)(resources, "sideboard-mcp");
7215
+ if (!(0, import_node_fs19.existsSync)((0, import_node_path21.join)(dir, "core-dist", "mcp", "run-stdio.js"))) return null;
7213
7216
  return dir;
7214
7217
  }
7215
7218
  function packagedMcpStdioPath() {
7216
7219
  const dir = packagedMcpDir();
7217
- return dir ? (0, import_node_path20.join)(dir, "core-dist", "mcp", "run-stdio.js") : null;
7220
+ return dir ? (0, import_node_path21.join)(dir, "core-dist", "mcp", "run-stdio.js") : null;
7218
7221
  }
7219
7222
  function packagedBundledNodePath() {
7220
7223
  const resources = electronResourcesPath();
7221
7224
  if (!resources) return null;
7222
- const bin = (0, import_node_path20.join)(resources, "node", "bin", "node");
7225
+ const bin = (0, import_node_path21.join)(resources, "node", "bin", "node");
7223
7226
  if (!(0, import_node_fs19.existsSync)(bin)) return null;
7224
7227
  return bin;
7225
7228
  }
7226
7229
  function packagedCursorRipgrepCandidate(platformPkg, binName) {
7227
7230
  const dir = packagedCursorRuntimeDir();
7228
7231
  if (!dir) return null;
7229
- return (0, import_node_path20.join)(dir, "node_modules", platformPkg, "bin", binName);
7232
+ return (0, import_node_path21.join)(dir, "node_modules", platformPkg, "bin", binName);
7230
7233
  }
7231
- var import_node_fs19, import_node_path20;
7234
+ var import_node_fs19, import_node_path21;
7232
7235
  var init_packaged_runtime = __esm({
7233
7236
  "src/agents/packaged-runtime.ts"() {
7234
7237
  "use strict";
7235
7238
  import_node_fs19 = require("fs");
7236
- import_node_path20 = require("path");
7239
+ import_node_path21 = require("path");
7237
7240
  }
7238
7241
  });
7239
7242
 
@@ -7316,28 +7319,28 @@ function versionDirNodeBins(root, toBin) {
7316
7319
  }
7317
7320
  function defaultNodeBinCandidates(home = (0, import_node_os7.homedir)()) {
7318
7321
  const kegs = ["/opt/homebrew", "/usr/local"].flatMap(
7319
- (prefix) => PREFERRED_LTS_MAJORS.map((major) => (0, import_node_path21.join)(prefix, "opt", `node@${major}`, "bin", "node"))
7322
+ (prefix) => PREFERRED_LTS_MAJORS.map((major) => (0, import_node_path22.join)(prefix, "opt", `node@${major}`, "bin", "node"))
7320
7323
  );
7321
7324
  return [
7322
7325
  ...kegs,
7323
7326
  "/opt/homebrew/bin/node",
7324
7327
  "/usr/local/bin/node",
7325
- (0, import_node_path21.join)(home, ".local/share/fnm/aliases/default/bin/node"),
7326
- (0, import_node_path21.join)(home, ".nvm/current/bin/node"),
7327
- (0, import_node_path21.join)(home, ".volta/bin/node"),
7328
- (0, import_node_path21.join)(home, ".asdf/shims/node"),
7329
- (0, import_node_path21.join)(home, ".local/share/mise/shims/node"),
7328
+ (0, import_node_path22.join)(home, ".local/share/fnm/aliases/default/bin/node"),
7329
+ (0, import_node_path22.join)(home, ".nvm/current/bin/node"),
7330
+ (0, import_node_path22.join)(home, ".volta/bin/node"),
7331
+ (0, import_node_path22.join)(home, ".asdf/shims/node"),
7332
+ (0, import_node_path22.join)(home, ".local/share/mise/shims/node"),
7330
7333
  ...versionDirNodeBins(
7331
- (0, import_node_path21.join)(home, ".nvm", "versions", "node"),
7332
- (name) => (0, import_node_path21.join)(home, ".nvm", "versions", "node", name, "bin", "node")
7334
+ (0, import_node_path22.join)(home, ".nvm", "versions", "node"),
7335
+ (name) => (0, import_node_path22.join)(home, ".nvm", "versions", "node", name, "bin", "node")
7333
7336
  ),
7334
7337
  ...versionDirNodeBins(
7335
- (0, import_node_path21.join)(home, ".local/share/fnm", "node-versions"),
7336
- (name) => (0, import_node_path21.join)(home, ".local/share/fnm", "node-versions", name, "installation", "bin", "node")
7338
+ (0, import_node_path22.join)(home, ".local/share/fnm", "node-versions"),
7339
+ (name) => (0, import_node_path22.join)(home, ".local/share/fnm", "node-versions", name, "installation", "bin", "node")
7337
7340
  ),
7338
7341
  ...versionDirNodeBins(
7339
- (0, import_node_path21.join)(home, ".volta", "tools", "image", "node"),
7340
- (name) => (0, import_node_path21.join)(home, ".volta", "tools", "image", "node", name, "bin", "node")
7342
+ (0, import_node_path22.join)(home, ".volta", "tools", "image", "node"),
7343
+ (name) => (0, import_node_path22.join)(home, ".volta", "tools", "image", "node", name, "bin", "node")
7341
7344
  )
7342
7345
  ];
7343
7346
  }
@@ -7429,13 +7432,13 @@ async function resolveNodeLaunch(scriptPath) {
7429
7432
  env: { ELECTRON_RUN_AS_NODE: "1" }
7430
7433
  };
7431
7434
  }
7432
- var import_node_fs20, import_node_os7, import_node_path21, AGENT_RUNNER_MAX_OLD_SPACE_MB, MAX_OLD_SPACE_FLAG, PREFERRED_LTS_MAJORS;
7435
+ var import_node_fs20, import_node_os7, import_node_path22, AGENT_RUNNER_MAX_OLD_SPACE_MB, MAX_OLD_SPACE_FLAG, PREFERRED_LTS_MAJORS;
7433
7436
  var init_node_launch = __esm({
7434
7437
  "src/agents/node-launch.ts"() {
7435
7438
  "use strict";
7436
7439
  import_node_fs20 = require("fs");
7437
7440
  import_node_os7 = require("os");
7438
- import_node_path21 = require("path");
7441
+ import_node_path22 = require("path");
7439
7442
  init_nested_electron_env();
7440
7443
  init_run();
7441
7444
  init_packaged_runtime();
@@ -7528,13 +7531,13 @@ function corePackageDir() {
7528
7531
  try {
7529
7532
  const url = import_meta.url;
7530
7533
  if (typeof url === "string" && url.length > 0) {
7531
- return (0, import_node_path22.dirname)((0, import_node_url.fileURLToPath)(url));
7534
+ return (0, import_node_path23.dirname)((0, import_node_url.fileURLToPath)(url));
7532
7535
  }
7533
7536
  } catch {
7534
7537
  }
7535
7538
  try {
7536
- const req = (0, import_node_module.createRequire)((0, import_node_path22.join)(process.cwd(), "package.json"));
7537
- return (0, import_node_path22.dirname)(req.resolve("@sideboard-ai/core"));
7539
+ const req = (0, import_node_module.createRequire)((0, import_node_path23.join)(process.cwd(), "package.json"));
7540
+ return (0, import_node_path23.dirname)(req.resolve("@sideboard-ai/core"));
7538
7541
  } catch {
7539
7542
  return process.cwd();
7540
7543
  }
@@ -7547,18 +7550,18 @@ function findSideboardMcpJsEntry() {
7547
7550
  let dir = corePackageDir();
7548
7551
  for (let i = 0; i < 10; i++) {
7549
7552
  const candidates = [
7550
- (0, import_node_path22.join)(dir, "mcp/run-stdio.js"),
7551
- (0, import_node_path22.join)(dir, "mcp/run-stdio.cjs"),
7552
- (0, import_node_path22.join)(dir, "dist/mcp/run-stdio.js"),
7553
- (0, import_node_path22.join)(dir, "dist/mcp/run-stdio.cjs"),
7554
- (0, import_node_path22.join)(dir, "packages/core/dist/mcp/run-stdio.js"),
7555
- (0, import_node_path22.join)(dir, "packages/cli/dist/index.js"),
7556
- (0, import_node_path22.join)(dir, "cli/dist/index.js")
7553
+ (0, import_node_path23.join)(dir, "mcp/run-stdio.js"),
7554
+ (0, import_node_path23.join)(dir, "mcp/run-stdio.cjs"),
7555
+ (0, import_node_path23.join)(dir, "dist/mcp/run-stdio.js"),
7556
+ (0, import_node_path23.join)(dir, "dist/mcp/run-stdio.cjs"),
7557
+ (0, import_node_path23.join)(dir, "packages/core/dist/mcp/run-stdio.js"),
7558
+ (0, import_node_path23.join)(dir, "packages/cli/dist/index.js"),
7559
+ (0, import_node_path23.join)(dir, "cli/dist/index.js")
7557
7560
  ];
7558
7561
  for (const p of candidates) {
7559
7562
  if ((0, import_node_fs21.existsSync)(p) && !isAsarPath(p)) return p;
7560
7563
  }
7561
- const parent = (0, import_node_path22.dirname)(dir);
7564
+ const parent = (0, import_node_path23.dirname)(dir);
7562
7565
  if (parent === dir) break;
7563
7566
  dir = parent;
7564
7567
  }
@@ -7700,19 +7703,19 @@ function writeMcpServersConfig(servers) {
7700
7703
  ...env ? { env } : {}
7701
7704
  };
7702
7705
  }
7703
- const dir = (0, import_node_fs21.mkdtempSync)((0, import_node_path22.join)((0, import_node_os8.tmpdir)(), "sideboard-mcp-"));
7704
- const cfgPath = (0, import_node_path22.join)(dir, "mcp.json");
7706
+ const dir = (0, import_node_fs21.mkdtempSync)((0, import_node_path23.join)((0, import_node_os8.tmpdir)(), "sideboard-mcp-"));
7707
+ const cfgPath = (0, import_node_path23.join)(dir, "mcp.json");
7705
7708
  (0, import_node_fs21.writeFileSync)(cfgPath, JSON.stringify({ mcpServers }, null, 2));
7706
7709
  return cfgPath;
7707
7710
  }
7708
- var import_node_fs21, import_node_module, import_node_os8, import_node_path22, import_node_url, import_meta, SIDEBOARD_MCP_ALLOWED_TOOLS, SIDEBOARD_ARTIFACT_MCP_ALLOWED_TOOLS, brightsyMcpCommandCache, BRIGHTSY_WORD;
7711
+ var import_node_fs21, import_node_module, import_node_os8, import_node_path23, import_node_url, import_meta, SIDEBOARD_MCP_ALLOWED_TOOLS, SIDEBOARD_ARTIFACT_MCP_ALLOWED_TOOLS, brightsyMcpCommandCache, BRIGHTSY_WORD;
7709
7712
  var init_injected_mcp = __esm({
7710
7713
  "src/agents/injected-mcp.ts"() {
7711
7714
  "use strict";
7712
7715
  import_node_fs21 = require("fs");
7713
7716
  import_node_module = require("module");
7714
7717
  import_node_os8 = require("os");
7715
- import_node_path22 = require("path");
7718
+ import_node_path23 = require("path");
7716
7719
  import_node_url = require("url");
7717
7720
  init_run();
7718
7721
  init_config();
@@ -8314,8 +8317,8 @@ function usageFromCodex(usage) {
8314
8317
  }
8315
8318
  function codexConfigHasNetworkAccess() {
8316
8319
  const candidates = [
8317
- (0, import_node_path23.join)((0, import_node_os9.homedir)(), ".codex", "config.toml"),
8318
- (0, import_node_path23.join)((0, import_node_os9.homedir)(), ".config", "codex", "config.toml")
8320
+ (0, import_node_path24.join)((0, import_node_os9.homedir)(), ".codex", "config.toml"),
8321
+ (0, import_node_path24.join)((0, import_node_os9.homedir)(), ".config", "codex", "config.toml")
8319
8322
  ];
8320
8323
  for (const path of candidates) {
8321
8324
  if (!(0, import_node_fs23.existsSync)(path)) continue;
@@ -8351,7 +8354,7 @@ function asRecord2(value) {
8351
8354
  return void 0;
8352
8355
  }
8353
8356
  function codexLooksAuthenticated() {
8354
- const authPath = (0, import_node_path23.join)((0, import_node_os9.homedir)(), ".codex", "auth.json");
8357
+ const authPath = (0, import_node_path24.join)((0, import_node_os9.homedir)(), ".codex", "auth.json");
8355
8358
  if (!(0, import_node_fs23.existsSync)(authPath)) return false;
8356
8359
  try {
8357
8360
  return (0, import_node_fs23.statSync)(authPath).size > 2;
@@ -8359,13 +8362,13 @@ function codexLooksAuthenticated() {
8359
8362
  return false;
8360
8363
  }
8361
8364
  }
8362
- var import_node_fs23, import_node_os9, import_node_path23, CODEX_PROMPT_ARG_MAX, FALLBACK_CODEX_MODELS, cachedCodexModels, CODEX_MODEL_CACHE_MS, codexAdapter;
8365
+ var import_node_fs23, import_node_os9, import_node_path24, CODEX_PROMPT_ARG_MAX, FALLBACK_CODEX_MODELS, cachedCodexModels, CODEX_MODEL_CACHE_MS, codexAdapter;
8363
8366
  var init_codex = __esm({
8364
8367
  "src/agents/codex.ts"() {
8365
8368
  "use strict";
8366
8369
  import_node_fs23 = require("fs");
8367
8370
  import_node_os9 = require("os");
8368
- import_node_path23 = require("path");
8371
+ import_node_path24 = require("path");
8369
8372
  init_run();
8370
8373
  init_app_settings();
8371
8374
  init_global_workspace();
@@ -8845,7 +8848,7 @@ function platformRipgrepPackage() {
8845
8848
  }
8846
8849
  function usableRipgrepPath(candidate) {
8847
8850
  const raw = candidate?.trim();
8848
- if (!raw || !(0, import_node_path24.isAbsolute)(raw)) return null;
8851
+ if (!raw || !(0, import_node_path25.isAbsolute)(raw)) return null;
8849
8852
  const readable = nodeReadableScriptPath(raw);
8850
8853
  if (!(0, import_node_fs24.existsSync)(readable) || isAsarPath(readable)) return null;
8851
8854
  return readable;
@@ -8854,12 +8857,12 @@ function walkForBundledRipgrep(startFile) {
8854
8857
  if (!startFile) return null;
8855
8858
  const pkg = platformRipgrepPackage();
8856
8859
  const name = rgBinaryName();
8857
- let dir = (0, import_node_path24.dirname)((0, import_node_path24.resolve)(startFile));
8858
- const root = (0, import_node_path24.parse)(dir).root;
8860
+ let dir = (0, import_node_path25.dirname)((0, import_node_path25.resolve)(startFile));
8861
+ const root = (0, import_node_path25.parse)(dir).root;
8859
8862
  while (dir !== root) {
8860
- const hit = usableRipgrepPath((0, import_node_path24.join)(dir, "node_modules", pkg, "bin", name));
8863
+ const hit = usableRipgrepPath((0, import_node_path25.join)(dir, "node_modules", pkg, "bin", name));
8861
8864
  if (hit) return hit;
8862
- const next = (0, import_node_path24.dirname)(dir);
8865
+ const next = (0, import_node_path25.dirname)(dir);
8863
8866
  if (next === dir) break;
8864
8867
  dir = next;
8865
8868
  }
@@ -8869,7 +8872,7 @@ function requireResolveBundledRipgrep(fromFile) {
8869
8872
  try {
8870
8873
  const req = (0, import_node_module2.createRequire)(fromFile);
8871
8874
  const pkgJson = req.resolve(`${platformRipgrepPackage()}/package.json`);
8872
- return usableRipgrepPath((0, import_node_path24.join)((0, import_node_path24.dirname)(pkgJson), "bin", rgBinaryName()));
8875
+ return usableRipgrepPath((0, import_node_path25.join)((0, import_node_path25.dirname)(pkgJson), "bin", rgBinaryName()));
8873
8876
  } catch {
8874
8877
  return null;
8875
8878
  }
@@ -8891,13 +8894,13 @@ function cursorRipgrepEnv(opts) {
8891
8894
  const path = resolveCursorRipgrepPath(opts);
8892
8895
  return path ? { [RIPGREP_ENV]: path } : {};
8893
8896
  }
8894
- var import_node_fs24, import_node_module2, import_node_path24, RIPGREP_ENV;
8897
+ var import_node_fs24, import_node_module2, import_node_path25, RIPGREP_ENV;
8895
8898
  var init_cursor_ripgrep = __esm({
8896
8899
  "src/agents/cursor-ripgrep.ts"() {
8897
8900
  "use strict";
8898
8901
  import_node_fs24 = require("fs");
8899
8902
  import_node_module2 = require("module");
8900
- import_node_path24 = require("path");
8903
+ import_node_path25 = require("path");
8901
8904
  init_node_launch();
8902
8905
  init_packaged_runtime();
8903
8906
  RIPGREP_ENV = "CURSOR_RIPGREP_PATH";
@@ -8943,11 +8946,11 @@ function entryDir() {
8943
8946
  const cjsDir = typeof __dirname !== "undefined" ? __dirname : "";
8944
8947
  if (cjsDir) return cjsDir;
8945
8948
  try {
8946
- return (0, import_node_path25.dirname)((0, import_node_url2.fileURLToPath)(import_meta2.url));
8949
+ return (0, import_node_path26.dirname)((0, import_node_url2.fileURLToPath)(import_meta2.url));
8947
8950
  } catch {
8948
8951
  try {
8949
8952
  const req = (0, import_node_module3.createRequire)(process.cwd() + "/");
8950
- return (0, import_node_path25.dirname)(req.resolve("@sideboard-ai/core"));
8953
+ return (0, import_node_path26.dirname)(req.resolve("@sideboard-ai/core"));
8951
8954
  } catch {
8952
8955
  return process.cwd();
8953
8956
  }
@@ -8958,27 +8961,27 @@ function cursorRunnerPath() {
8958
8961
  if (packaged) return packaged;
8959
8962
  const root = entryDir();
8960
8963
  const candidates = [
8961
- (0, import_node_path25.join)(root, "agents", "cursor-runner.js"),
8962
- (0, import_node_path25.join)(root, "agents", "cursor-runner.cjs"),
8964
+ (0, import_node_path26.join)(root, "agents", "cursor-runner.js"),
8965
+ (0, import_node_path26.join)(root, "agents", "cursor-runner.cjs"),
8963
8966
  // If somehow resolved from package root instead of dist/
8964
- (0, import_node_path25.join)(root, "dist", "agents", "cursor-runner.js"),
8965
- (0, import_node_path25.join)(root, "dist", "agents", "cursor-runner.cjs"),
8967
+ (0, import_node_path26.join)(root, "dist", "agents", "cursor-runner.js"),
8968
+ (0, import_node_path26.join)(root, "dist", "agents", "cursor-runner.cjs"),
8966
8969
  // Source tree (dev): packages/core/src/agents/cursor-runner.ts
8967
- (0, import_node_path25.join)(root, "cursor-runner.ts"),
8968
- (0, import_node_path25.join)(root, "src", "agents", "cursor-runner.ts")
8970
+ (0, import_node_path26.join)(root, "cursor-runner.ts"),
8971
+ (0, import_node_path26.join)(root, "src", "agents", "cursor-runner.ts")
8969
8972
  ];
8970
8973
  for (const candidate of candidates) {
8971
8974
  if ((0, import_node_fs25.existsSync)(candidate)) return candidate;
8972
8975
  }
8973
8976
  return candidates[0];
8974
8977
  }
8975
- var import_node_fs25, import_node_module3, import_node_path25, import_node_url2, import_sdk, import_meta2, FALLBACK_CURSOR_MODELS, cachedModels, MODEL_CACHE_MS, cursorAdapter;
8978
+ var import_node_fs25, import_node_module3, import_node_path26, import_node_url2, import_sdk, import_meta2, FALLBACK_CURSOR_MODELS, cachedModels, MODEL_CACHE_MS, cursorAdapter;
8976
8979
  var init_cursor = __esm({
8977
8980
  "src/agents/cursor.ts"() {
8978
8981
  "use strict";
8979
8982
  import_node_fs25 = require("fs");
8980
8983
  import_node_module3 = require("module");
8981
- import_node_path25 = require("path");
8984
+ import_node_path26 = require("path");
8982
8985
  import_node_url2 = require("url");
8983
8986
  import_sdk = require("@cursor/sdk");
8984
8987
  init_run();
@@ -9037,6 +9040,7 @@ var init_cursor = __esm({
9037
9040
  const req = {
9038
9041
  prompt,
9039
9042
  cwd: thread.worktreePath,
9043
+ threadId: thread.id,
9040
9044
  agentId,
9041
9045
  model: thread.model,
9042
9046
  effort: thread.effort,
@@ -10921,12 +10925,12 @@ function readTextIfPresent(abs) {
10921
10925
  }
10922
10926
  }
10923
10927
  function readLocalGuidelines(worktreePath) {
10924
- const localAbs = (0, import_node_path26.join)(worktreePath, REVIEW_REQUEST_PATH);
10928
+ const localAbs = (0, import_node_path27.join)(worktreePath, REVIEW_REQUEST_PATH);
10925
10929
  const localContent = readTextIfPresent(localAbs);
10926
10930
  if (localContent && !shouldRefreshReviewRequestTemplate(localContent)) {
10927
10931
  return { path: REVIEW_REQUEST_PATH, content: localContent };
10928
10932
  }
10929
- const legacyAbs = (0, import_node_path26.join)(worktreePath, LEGACY_REVIEW_REQUEST_PATH);
10933
+ const legacyAbs = (0, import_node_path27.join)(worktreePath, LEGACY_REVIEW_REQUEST_PATH);
10930
10934
  const legacyContent = readTextIfPresent(legacyAbs);
10931
10935
  if (legacyContent && !shouldRefreshReviewRequestTemplate(legacyContent)) {
10932
10936
  return { path: LEGACY_REVIEW_REQUEST_PATH, content: legacyContent };
@@ -10942,20 +10946,20 @@ function skillGuidelines(content, source) {
10942
10946
  };
10943
10947
  }
10944
10948
  function ensureReviewSkillFile(worktreePath) {
10945
- const abs = (0, import_node_path26.join)(worktreePath, REVIEW_SKILL_PATH);
10949
+ const abs = (0, import_node_path27.join)(worktreePath, REVIEW_SKILL_PATH);
10946
10950
  const existing = readTextIfPresent(abs);
10947
10951
  if (existing) {
10948
10952
  return { path: REVIEW_SKILL_PATH, content: existing, wrote: false };
10949
10953
  }
10950
- const fromRepo = readTextIfPresent((0, import_node_path26.join)(worktreePath, REPO_REVIEW_PATH));
10954
+ const fromRepo = readTextIfPresent((0, import_node_path27.join)(worktreePath, REPO_REVIEW_PATH));
10951
10955
  const fromLocal = readLocalGuidelines(worktreePath)?.content ?? null;
10952
10956
  const content = wrapReviewSkillMarkdown(fromRepo ?? fromLocal ?? REVIEW_REQUEST_TEMPLATE);
10953
- (0, import_node_fs27.mkdirSync)((0, import_node_path26.dirname)(abs), { recursive: true });
10957
+ (0, import_node_fs27.mkdirSync)((0, import_node_path27.dirname)(abs), { recursive: true });
10954
10958
  (0, import_node_fs27.writeFileSync)(abs, content, "utf8");
10955
10959
  return { path: REVIEW_SKILL_PATH, content, wrote: true };
10956
10960
  }
10957
10961
  function resolveReviewGuidelines(worktreePath) {
10958
- const skillContent = readTextIfPresent((0, import_node_path26.join)(worktreePath, REVIEW_SKILL_PATH));
10962
+ const skillContent = readTextIfPresent((0, import_node_path27.join)(worktreePath, REVIEW_SKILL_PATH));
10959
10963
  if (skillContent) return skillGuidelines(skillContent, "skill");
10960
10964
  const local = readLocalGuidelines(worktreePath);
10961
10965
  if (local) {
@@ -11005,13 +11009,13 @@ async function requestReview(threadRef, send) {
11005
11009
  const started = await send(tab.id, REVIEW_REQUEST_PREFILL);
11006
11010
  return { tab: started, from };
11007
11011
  }
11008
- var import_node_crypto5, import_node_fs27, import_node_path26, REPO_REVIEW_PATH, REPO_REVIEW_NAME, REVIEW_REQUEST_PATH, LEGACY_REVIEW_REQUEST_PATH, REVIEW_REQUEST_NAME, REVIEW_REQUEST_PREFILL, LEGACY_REVIEW_TEMPLATE_MARKERS;
11012
+ var import_node_crypto5, import_node_fs27, import_node_path27, REPO_REVIEW_PATH, REPO_REVIEW_NAME, REVIEW_REQUEST_PATH, LEGACY_REVIEW_REQUEST_PATH, REVIEW_REQUEST_NAME, REVIEW_REQUEST_PREFILL, LEGACY_REVIEW_TEMPLATE_MARKERS;
11009
11013
  var init_request_review = __esm({
11010
11014
  "src/review/request-review.ts"() {
11011
11015
  "use strict";
11012
11016
  import_node_crypto5 = require("crypto");
11013
11017
  import_node_fs27 = require("fs");
11014
- import_node_path26 = require("path");
11018
+ import_node_path27 = require("path");
11015
11019
  init_global_workspace();
11016
11020
  init_chat_tabs();
11017
11021
  init_thread_store();
@@ -11036,7 +11040,7 @@ function matchSimpleGlob(pattern, name) {
11036
11040
  return new RegExp(`^${escaped}$`).test(name);
11037
11041
  }
11038
11042
  function readWorktreeInclude(repoPath) {
11039
- const path = (0, import_node_path27.join)(repoPath, ".worktreeinclude");
11043
+ const path = (0, import_node_path28.join)(repoPath, ".worktreeinclude");
11040
11044
  if (!(0, import_node_fs28.existsSync)(path)) return [];
11041
11045
  return (0, import_node_fs28.readFileSync)(path, "utf8").split("\n").map((l) => l.trim()).filter((l) => l && !l.startsWith("#"));
11042
11046
  }
@@ -11051,7 +11055,7 @@ function resolveFilesToCopy(repoPath) {
11051
11055
  for (const entry of (0, import_node_fs28.readdirSync)(repoPath, { withFileTypes: true })) {
11052
11056
  if (!entry.isFile()) continue;
11053
11057
  for (const glob of settings.fileIncludeGlobs) {
11054
- if (matchSimpleGlob(glob, entry.name) || matchSimpleGlob((0, import_node_path27.basename)(glob), entry.name)) {
11058
+ if (matchSimpleGlob(glob, entry.name) || matchSimpleGlob((0, import_node_path28.basename)(glob), entry.name)) {
11055
11059
  matched.push(entry.name);
11056
11060
  break;
11057
11061
  }
@@ -11077,10 +11081,10 @@ function copyConfiguredFiles(repoPath, worktreePath) {
11077
11081
  const patterns = resolveFilesToCopy(repoPath);
11078
11082
  const copied = [];
11079
11083
  for (const rel of patterns) {
11080
- const src = (0, import_node_path27.join)(repoPath, rel);
11084
+ const src = (0, import_node_path28.join)(repoPath, rel);
11081
11085
  if (!(0, import_node_fs28.existsSync)(src)) continue;
11082
- const dest = (0, import_node_path27.join)(worktreePath, rel);
11083
- (0, import_node_fs28.mkdirSync)((0, import_node_path27.dirname)(dest), { recursive: true });
11086
+ const dest = (0, import_node_path28.join)(worktreePath, rel);
11087
+ (0, import_node_fs28.mkdirSync)((0, import_node_path28.dirname)(dest), { recursive: true });
11084
11088
  (0, import_node_fs28.copyFileSync)(src, dest);
11085
11089
  copied.push(rel);
11086
11090
  }
@@ -11116,7 +11120,7 @@ function buildWorkspaceScriptEnv(opts, baseEnv) {
11116
11120
  const env = stripNestedElectronEnv({
11117
11121
  ...baseEnv ?? process.env
11118
11122
  });
11119
- const name = opts.workspaceName ?? (0, import_node_path27.basename)(opts.worktreePath);
11123
+ const name = opts.workspaceName ?? (0, import_node_path28.basename)(opts.worktreePath);
11120
11124
  const ports = opts.ports ?? [];
11121
11125
  const primary = ports[0];
11122
11126
  env.SIDEBOARD_WORKSPACE_NAME = name;
@@ -11377,13 +11381,13 @@ async function startDevServer(repoPath, worktreePath, onLine, opts) {
11377
11381
  done: handle.done
11378
11382
  };
11379
11383
  }
11380
- var import_node_fs28, import_node_net, import_node_path27, import_execa4, import_node_readline3, PORT_RANGE_SIZE, cachedLoginEnv;
11384
+ var import_node_fs28, import_node_net, import_node_path28, import_execa4, import_node_readline3, PORT_RANGE_SIZE, cachedLoginEnv;
11381
11385
  var init_conductor = __esm({
11382
11386
  "src/hook/conductor.ts"() {
11383
11387
  "use strict";
11384
11388
  import_node_fs28 = require("fs");
11385
11389
  import_node_net = require("net");
11386
- import_node_path27 = require("path");
11390
+ import_node_path28 = require("path");
11387
11391
  import_execa4 = require("execa");
11388
11392
  import_node_readline3 = require("readline");
11389
11393
  init_settings();
@@ -11445,9 +11449,9 @@ async function findOrphanWorktrees(repoPaths) {
11445
11449
  if ((0, import_node_fs29.existsSync)(root)) {
11446
11450
  for (const entry of (0, import_node_fs29.readdirSync)(root, { withFileTypes: true })) {
11447
11451
  if (!entry.isDirectory()) continue;
11448
- const path = (0, import_node_path28.join)(root, entry.name).replace(/\/$/, "");
11452
+ const path = (0, import_node_path29.join)(root, entry.name).replace(/\/$/, "");
11449
11453
  if (known.has(path) || seen.has(path)) continue;
11450
- if (!(0, import_node_fs29.existsSync)((0, import_node_path28.join)(path, ".git"))) continue;
11454
+ if (!(0, import_node_fs29.existsSync)((0, import_node_path29.join)(path, ".git"))) continue;
11451
11455
  seen.add(path);
11452
11456
  let mtimeMs = 0;
11453
11457
  try {
@@ -11503,12 +11507,12 @@ function shouldRunWorktreeCleanup(settings = loadAppSettings()) {
11503
11507
  const elapsed = Date.now() - Date.parse(last);
11504
11508
  return elapsed >= intervalHours * 36e5;
11505
11509
  }
11506
- var import_node_fs29, import_node_path28;
11510
+ var import_node_fs29, import_node_path29;
11507
11511
  var init_orphan_cleanup = __esm({
11508
11512
  "src/git/orphan-cleanup.ts"() {
11509
11513
  "use strict";
11510
11514
  import_node_fs29 = require("fs");
11511
- import_node_path28 = require("path");
11515
+ import_node_path29 = require("path");
11512
11516
  init_worktree();
11513
11517
  init_thread_store();
11514
11518
  init_paths();
@@ -11615,10 +11619,10 @@ __export(workspaces_exports, {
11615
11619
  syncWorkspacesFromThreads: () => syncWorkspacesFromThreads
11616
11620
  });
11617
11621
  function workspacesFile() {
11618
- return (0, import_node_path29.join)(appDataDir(), "workspaces.json");
11622
+ return (0, import_node_path30.join)(appDataDir(), "workspaces.json");
11619
11623
  }
11620
11624
  function removedWorkspacesFile() {
11621
- return (0, import_node_path29.join)(appDataDir(), "removed-workspaces.json");
11625
+ return (0, import_node_path30.join)(appDataDir(), "removed-workspaces.json");
11622
11626
  }
11623
11627
  function readAll() {
11624
11628
  const path = workspacesFile();
@@ -11677,7 +11681,7 @@ async function addWorkspace(repoPath) {
11677
11681
  if (existing) return existing;
11678
11682
  const next = {
11679
11683
  path: root,
11680
- name: (0, import_node_path29.basename)(root),
11684
+ name: (0, import_node_path30.basename)(root),
11681
11685
  addedAt: (/* @__PURE__ */ new Date()).toISOString()
11682
11686
  };
11683
11687
  writeAll([...current, next]);
@@ -11702,7 +11706,7 @@ function syncWorkspacesFromThreads(repoPaths) {
11702
11706
  if (!(0, import_node_fs30.existsSync)(path)) continue;
11703
11707
  const ws = {
11704
11708
  path,
11705
- name: (0, import_node_path29.basename)(path),
11709
+ name: (0, import_node_path30.basename)(path),
11706
11710
  addedAt: (/* @__PURE__ */ new Date()).toISOString()
11707
11711
  };
11708
11712
  byPath.set(path, ws);
@@ -11712,12 +11716,12 @@ function syncWorkspacesFromThreads(repoPaths) {
11712
11716
  if (dirty) writeAll(next);
11713
11717
  return next.sort((a, b) => a.name.localeCompare(b.name));
11714
11718
  }
11715
- var import_node_fs30, import_node_path29;
11719
+ var import_node_fs30, import_node_path30;
11716
11720
  var init_workspaces2 = __esm({
11717
11721
  "src/store/workspaces.ts"() {
11718
11722
  "use strict";
11719
11723
  import_node_fs30 = require("fs");
11720
- import_node_path29 = require("path");
11724
+ import_node_path30 = require("path");
11721
11725
  init_paths();
11722
11726
  init_global_workspace();
11723
11727
  init_worktree();
@@ -11730,11 +11734,11 @@ async function cloneRepoIntoSideboard(opts) {
11730
11734
  if (!url) throw new Error("Clone URL is required");
11731
11735
  let name = opts.name?.trim();
11732
11736
  if (!name) {
11733
- const leaf = (0, import_node_path30.basename)(url.replace(/\/$/, "").replace(/\.git$/, ""));
11737
+ const leaf = (0, import_node_path31.basename)(url.replace(/\/$/, "").replace(/\.git$/, ""));
11734
11738
  name = leaf || "repo";
11735
11739
  }
11736
11740
  name = name.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "repo";
11737
- const dest = (0, import_node_path30.join)(sideboardReposDir(), name);
11741
+ const dest = (0, import_node_path31.join)(sideboardReposDir(), name);
11738
11742
  if ((0, import_node_fs31.existsSync)(dest)) {
11739
11743
  const repoPath2 = await resolveRepoRoot(dest);
11740
11744
  const workspace2 = await ensureWorkspace(repoPath2);
@@ -11750,12 +11754,12 @@ async function cloneRepoIntoSideboard(opts) {
11750
11754
  const workspace = await ensureWorkspace(repoPath);
11751
11755
  return { repoPath, workspace };
11752
11756
  }
11753
- var import_node_fs31, import_node_path30, import_execa6;
11757
+ var import_node_fs31, import_node_path31, import_execa6;
11754
11758
  var init_clone_repo = __esm({
11755
11759
  "src/git/clone-repo.ts"() {
11756
11760
  "use strict";
11757
11761
  import_node_fs31 = require("fs");
11758
- import_node_path30 = require("path");
11762
+ import_node_path31 = require("path");
11759
11763
  import_execa6 = require("execa");
11760
11764
  init_paths();
11761
11765
  init_workspaces2();
@@ -11765,7 +11769,7 @@ var init_clone_repo = __esm({
11765
11769
 
11766
11770
  // src/store/desktop-host.ts
11767
11771
  function desktopHostPidPath() {
11768
- return (0, import_node_path31.join)(appDataDir(), "desktop-host.pid");
11772
+ return (0, import_node_path32.join)(appDataDir(), "desktop-host.pid");
11769
11773
  }
11770
11774
  function readDesktopHostPid() {
11771
11775
  try {
@@ -11795,12 +11799,12 @@ function thisProcessShouldDrainAgentQueues() {
11795
11799
  if (isThisProcessDesktopHost()) return true;
11796
11800
  return !isDesktopHostAlive();
11797
11801
  }
11798
- var import_node_fs32, import_node_path31;
11802
+ var import_node_fs32, import_node_path32;
11799
11803
  var init_desktop_host = __esm({
11800
11804
  "src/store/desktop-host.ts"() {
11801
11805
  "use strict";
11802
11806
  import_node_fs32 = require("fs");
11803
- import_node_path31 = require("path");
11807
+ import_node_path32 = require("path");
11804
11808
  init_paths();
11805
11809
  }
11806
11810
  });
@@ -12070,7 +12074,7 @@ function noteTurnLiveEvent(threadId, event) {
12070
12074
  buffers.delete(threadId);
12071
12075
  return;
12072
12076
  }
12073
- const immediate = event.type === "tool_use" || event.type === "tool_result";
12077
+ const immediate = event.type === "tool_use" || event.type === "tool_result" && !event.partial;
12074
12078
  if (immediate) flush(threadId);
12075
12079
  else scheduleFlush(threadId);
12076
12080
  }
@@ -12122,6 +12126,27 @@ var init_turn_live = __esm({
12122
12126
  }
12123
12127
  });
12124
12128
 
12129
+ // src/orchestrator/reconcile-heal.ts
12130
+ function shouldReadThreadToHealReconcile(eventType, lastCheckAt, now) {
12131
+ if (SKIP.has(eventType)) return false;
12132
+ if (lastCheckAt != null && now - lastCheckAt < RECONCILE_HEAL_MIN_MS) return false;
12133
+ return true;
12134
+ }
12135
+ var RECONCILE_HEAL_MIN_MS, SKIP;
12136
+ var init_reconcile_heal = __esm({
12137
+ "src/orchestrator/reconcile-heal.ts"() {
12138
+ "use strict";
12139
+ RECONCILE_HEAL_MIN_MS = 2e3;
12140
+ SKIP = /* @__PURE__ */ new Set([
12141
+ "stdout",
12142
+ "thinking",
12143
+ "usage",
12144
+ "stderr",
12145
+ "tool_result"
12146
+ ]);
12147
+ }
12148
+ });
12149
+
12125
12150
  // src/threads/fork-worktree.ts
12126
12151
  function requireThread2(idOrRef) {
12127
12152
  const thread = findThreadByRef(idOrRef) ?? null;
@@ -12292,7 +12317,7 @@ var init_quota_failover = __esm({
12292
12317
  // src/threads/adopt.ts
12293
12318
  function thisModuleFile() {
12294
12319
  const cjsFile = typeof __filename !== "undefined" ? __filename : "";
12295
- return cjsFile || process.argv[1] || (0, import_node_path32.join)(process.cwd(), "package.json");
12320
+ return cjsFile || process.argv[1] || (0, import_node_path33.join)(process.cwd(), "package.json");
12296
12321
  }
12297
12322
  function openReadonlySqlite(file) {
12298
12323
  const req = (0, import_node_module4.createRequire)(thisModuleFile());
@@ -12320,7 +12345,7 @@ function resolveConductorCursorAgentId(workspacePath) {
12320
12345
  return null;
12321
12346
  }
12322
12347
  for (const hash of hashes) {
12323
- const agentsFile = (0, import_node_path32.join)(CURSOR_SDK_STORE, hash, "agents.ndjson");
12348
+ const agentsFile = (0, import_node_path33.join)(CURSOR_SDK_STORE, hash, "agents.ndjson");
12324
12349
  if (!(0, import_node_fs35.existsSync)(agentsFile)) continue;
12325
12350
  let text4;
12326
12351
  try {
@@ -12375,8 +12400,8 @@ function listConductorWorkspaces() {
12375
12400
  if (!(0, import_node_fs35.existsSync)(CONDUCTOR_DB)) {
12376
12401
  throw new Error(`Conductor DB not found at ${CONDUCTOR_DB}`);
12377
12402
  }
12378
- const tmp = (0, import_node_fs35.mkdtempSync)((0, import_node_path32.join)((0, import_node_os10.tmpdir)(), "sideboard-conductor-"));
12379
- const snapshot = (0, import_node_path32.join)(tmp, "conductor.db");
12403
+ const tmp = (0, import_node_fs35.mkdtempSync)((0, import_node_path33.join)((0, import_node_os10.tmpdir)(), "sideboard-conductor-"));
12404
+ const snapshot = (0, import_node_path33.join)(tmp, "conductor.db");
12380
12405
  try {
12381
12406
  (0, import_node_fs35.copyFileSync)(CONDUCTOR_DB, snapshot);
12382
12407
  for (const suffix of ["-wal", "-shm"]) {
@@ -12466,8 +12491,8 @@ function importConductorWorkspace(workspaceId) {
12466
12491
  if (!(0, import_node_fs35.existsSync)(CONDUCTOR_DB)) {
12467
12492
  throw new Error(`Conductor DB not found at ${CONDUCTOR_DB}`);
12468
12493
  }
12469
- const tmp = (0, import_node_fs35.mkdtempSync)((0, import_node_path32.join)((0, import_node_os10.tmpdir)(), "sideboard-conductor-"));
12470
- const snapshot = (0, import_node_path32.join)(tmp, "conductor.db");
12494
+ const tmp = (0, import_node_fs35.mkdtempSync)((0, import_node_path33.join)((0, import_node_os10.tmpdir)(), "sideboard-conductor-"));
12495
+ const snapshot = (0, import_node_path33.join)(tmp, "conductor.db");
12471
12496
  try {
12472
12497
  (0, import_node_fs35.copyFileSync)(CONDUCTOR_DB, snapshot);
12473
12498
  for (const suffix of ["-wal", "-shm"]) {
@@ -12561,25 +12586,25 @@ function importConductorWorkspace(workspaceId) {
12561
12586
  async function importConductorWorkspaceAsync(workspaceId) {
12562
12587
  return importConductorWorkspace(workspaceId);
12563
12588
  }
12564
- var import_node_child_process3, import_node_fs35, import_node_os10, import_node_path32, import_node_module4, CONDUCTOR_APP_SUPPORT, CONDUCTOR_DB, CURSOR_SDK_STORE;
12589
+ var import_node_child_process3, import_node_fs35, import_node_os10, import_node_path33, import_node_module4, CONDUCTOR_APP_SUPPORT, CONDUCTOR_DB, CURSOR_SDK_STORE;
12565
12590
  var init_adopt = __esm({
12566
12591
  "src/threads/adopt.ts"() {
12567
12592
  "use strict";
12568
12593
  import_node_child_process3 = require("child_process");
12569
12594
  import_node_fs35 = require("fs");
12570
12595
  import_node_os10 = require("os");
12571
- import_node_path32 = require("path");
12596
+ import_node_path33 = require("path");
12572
12597
  import_node_module4 = require("module");
12573
12598
  init_worktree();
12574
12599
  init_thread_store();
12575
- CONDUCTOR_APP_SUPPORT = (0, import_node_path32.join)(
12600
+ CONDUCTOR_APP_SUPPORT = (0, import_node_path33.join)(
12576
12601
  process.env.HOME ?? "",
12577
12602
  "Library",
12578
12603
  "Application Support",
12579
12604
  "com.conductor.app"
12580
12605
  );
12581
- CONDUCTOR_DB = (0, import_node_path32.join)(CONDUCTOR_APP_SUPPORT, "conductor.db");
12582
- CURSOR_SDK_STORE = (0, import_node_path32.join)(CONDUCTOR_APP_SUPPORT, "cursor-sdk-store");
12606
+ CONDUCTOR_DB = (0, import_node_path33.join)(CONDUCTOR_APP_SUPPORT, "conductor.db");
12607
+ CURSOR_SDK_STORE = (0, import_node_path33.join)(CONDUCTOR_APP_SUPPORT, "cursor-sdk-store");
12583
12608
  }
12584
12609
  });
12585
12610
 
@@ -13024,7 +13049,7 @@ new file mode 100644
13024
13049
  };
13025
13050
  }
13026
13051
  async function untrackedPatch(worktreePath, path, maxHunk) {
13027
- const abs = (0, import_node_path33.join)(worktreePath, path);
13052
+ const abs = (0, import_node_path34.join)(worktreePath, path);
13028
13053
  try {
13029
13054
  const st = (0, import_node_fs37.statSync)(abs);
13030
13055
  if (st.isFile() && st.size > maxHunk) {
@@ -13517,7 +13542,7 @@ function isImageRelativePath(relativePath) {
13517
13542
  function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
13518
13543
  assertSafeRelativePath(relativePath);
13519
13544
  const maxBytes = opts?.maxBytes ?? DEFAULT_UPLOAD_MAX_BYTES;
13520
- const abs = (0, import_node_path33.join)(worktreePath, relativePath);
13545
+ const abs = (0, import_node_path34.join)(worktreePath, relativePath);
13521
13546
  const st = (0, import_node_fs37.statSync)(abs);
13522
13547
  if (!st.isFile()) {
13523
13548
  throw new Error(`Not a file: ${relativePath}`);
@@ -13537,7 +13562,7 @@ function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
13537
13562
  function readWorktreeFile(worktreePath, relativePath, opts) {
13538
13563
  assertSafeRelativePath(relativePath);
13539
13564
  const maxBytes = opts?.maxBytes ?? 2e5;
13540
- const abs = (0, import_node_path33.join)(worktreePath, relativePath);
13565
+ const abs = (0, import_node_path34.join)(worktreePath, relativePath);
13541
13566
  const st = (0, import_node_fs37.statSync)(abs);
13542
13567
  if (!st.isFile()) {
13543
13568
  throw new Error(`Not a file: ${relativePath}`);
@@ -13585,8 +13610,8 @@ function assertSafeRelativePath(relativePath) {
13585
13610
  }
13586
13611
  function writeWorktreeFile(worktreePath, relativePath, content) {
13587
13612
  assertSafeRelativePath(relativePath);
13588
- const abs = (0, import_node_path33.join)(worktreePath, relativePath);
13589
- (0, import_node_fs37.mkdirSync)((0, import_node_path33.dirname)(abs), { recursive: true });
13613
+ const abs = (0, import_node_path34.join)(worktreePath, relativePath);
13614
+ (0, import_node_fs37.mkdirSync)((0, import_node_path34.dirname)(abs), { recursive: true });
13590
13615
  (0, import_node_fs37.writeFileSync)(abs, content, "utf8");
13591
13616
  return { path: relativePath };
13592
13617
  }
@@ -13604,12 +13629,12 @@ async function getDiffSummary(worktreePath, repoPath, opts) {
13604
13629
  truncated: full.files.length > maxFiles
13605
13630
  };
13606
13631
  }
13607
- var import_node_fs37, import_node_path33, mergeBaseCache, MERGE_BASE_TTL_MS, SHA_RE, IMAGE_EXTENSIONS, DEFAULT_UPLOAD_MAX_BYTES;
13632
+ var import_node_fs37, import_node_path34, mergeBaseCache, MERGE_BASE_TTL_MS, SHA_RE, IMAGE_EXTENSIONS, DEFAULT_UPLOAD_MAX_BYTES;
13608
13633
  var init_diff = __esm({
13609
13634
  "src/diff/diff.ts"() {
13610
13635
  "use strict";
13611
13636
  import_node_fs37 = require("fs");
13612
- import_node_path33 = require("path");
13637
+ import_node_path34 = require("path");
13613
13638
  init_run();
13614
13639
  init_worktree();
13615
13640
  mergeBaseCache = /* @__PURE__ */ new Map();
@@ -13805,7 +13830,7 @@ function scanSkillsDir(dir, source, out) {
13805
13830
  }
13806
13831
  for (const entry of entries) {
13807
13832
  if (entry.startsWith(".")) continue;
13808
- const skillMd = (0, import_node_path34.join)(dir, entry, "SKILL.md");
13833
+ const skillMd = (0, import_node_path35.join)(dir, entry, "SKILL.md");
13809
13834
  if (!(0, import_node_fs38.existsSync)(skillMd)) continue;
13810
13835
  try {
13811
13836
  if (!(0, import_node_fs38.statSync)(skillMd).isFile()) continue;
@@ -13827,12 +13852,12 @@ function scanClaudePluginSkills(pluginsRoot, out) {
13827
13852
  return;
13828
13853
  }
13829
13854
  if (lookingForSkillsDir && entries.includes("SKILL.md")) {
13830
- const skill = readSkill((0, import_node_path34.join)(dir, "SKILL.md"), "cli");
13855
+ const skill = readSkill((0, import_node_path35.join)(dir, "SKILL.md"), "cli");
13831
13856
  if (skill) out.push(skill);
13832
13857
  }
13833
13858
  for (const entry of entries) {
13834
13859
  if (entry === "node_modules" || entry === ".git") continue;
13835
- const full = (0, import_node_path34.join)(dir, entry);
13860
+ const full = (0, import_node_path35.join)(dir, entry);
13836
13861
  try {
13837
13862
  if (!(0, import_node_fs38.statSync)(full).isDirectory()) continue;
13838
13863
  } catch {
@@ -13852,17 +13877,17 @@ function discoverSkills(worktreePath) {
13852
13877
  const home = (0, import_node_os11.homedir)();
13853
13878
  const collected = [];
13854
13879
  for (const rel of [".claude/skills", ".cursor/skills", ".sideboard/skills", ".brightsy/skills", "skills"]) {
13855
- scanSkillsDir((0, import_node_path34.join)(worktreePath, rel), "workspace", collected);
13880
+ scanSkillsDir((0, import_node_path35.join)(worktreePath, rel), "workspace", collected);
13856
13881
  }
13857
13882
  for (const abs of [
13858
- (0, import_node_path34.join)(home, ".claude/skills"),
13859
- (0, import_node_path34.join)(home, ".cursor/skills"),
13860
- (0, import_node_path34.join)(home, ".sideboard/skills"),
13861
- (0, import_node_path34.join)(home, ".brightsy/skills")
13883
+ (0, import_node_path35.join)(home, ".claude/skills"),
13884
+ (0, import_node_path35.join)(home, ".cursor/skills"),
13885
+ (0, import_node_path35.join)(home, ".sideboard/skills"),
13886
+ (0, import_node_path35.join)(home, ".brightsy/skills")
13862
13887
  ]) {
13863
13888
  scanSkillsDir(abs, "user", collected);
13864
13889
  }
13865
- scanClaudePluginSkills((0, import_node_path34.join)(home, ".claude/plugins"), collected);
13890
+ scanClaudePluginSkills((0, import_node_path35.join)(home, ".claude/plugins"), collected);
13866
13891
  const rank = { workspace: 0, user: 1, cli: 2 };
13867
13892
  const byCommand = /* @__PURE__ */ new Map();
13868
13893
  for (const skill of collected) {
@@ -13888,13 +13913,13 @@ function readSkillBody(skillPath, maxChars = 12e3) {
13888
13913
 
13889
13914
  \u2026(truncated)` : raw;
13890
13915
  }
13891
- var import_node_fs38, import_node_os11, import_node_path34;
13916
+ var import_node_fs38, import_node_os11, import_node_path35;
13892
13917
  var init_discover = __esm({
13893
13918
  "src/skills/discover.ts"() {
13894
13919
  "use strict";
13895
13920
  import_node_fs38 = require("fs");
13896
13921
  import_node_os11 = require("os");
13897
- import_node_path34 = require("path");
13922
+ import_node_path35 = require("path");
13898
13923
  }
13899
13924
  });
13900
13925
 
@@ -13985,7 +14010,7 @@ var init_expand = __esm({
13985
14010
 
13986
14011
  // src/composer/stage-files.ts
13987
14012
  function fileExtension(filePath) {
13988
- const base = (0, import_node_path35.basename)(filePath).toLowerCase();
14013
+ const base = (0, import_node_path36.basename)(filePath).toLowerCase();
13989
14014
  return base.includes(".") ? base.split(".").pop() || "" : "";
13990
14015
  }
13991
14016
  function isImageFilePath(filePath) {
@@ -13995,9 +14020,9 @@ function imageMimeType(filePath) {
13995
14020
  return IMAGE_MIME_BY_EXT[fileExtension(filePath)] || "image/png";
13996
14021
  }
13997
14022
  function ensureAttachmentsDir(worktreePath) {
13998
- const dir = (0, import_node_path35.join)(worktreePath, ATTACHMENTS_DIR);
14023
+ const dir = (0, import_node_path36.join)(worktreePath, ATTACHMENTS_DIR);
13999
14024
  (0, import_node_fs39.mkdirSync)(dir, { recursive: true });
14000
- const gi = (0, import_node_path35.join)(dir, ".gitignore");
14025
+ const gi = (0, import_node_path36.join)(dir, ".gitignore");
14001
14026
  if (!(0, import_node_fs39.existsSync)(gi)) {
14002
14027
  (0, import_node_fs39.writeFileSync)(gi, attachmentsGitignoreBody(), "utf8");
14003
14028
  }
@@ -14005,12 +14030,12 @@ function ensureAttachmentsDir(worktreePath) {
14005
14030
  }
14006
14031
  function uniqueAttachmentName(dir, originalName) {
14007
14032
  const safe = originalName.replace(/[/\\]/g, "_") || "file";
14008
- if (!(0, import_node_fs39.existsSync)((0, import_node_path35.join)(dir, safe))) return safe;
14009
- const ext = (0, import_node_path35.extname)(safe);
14033
+ if (!(0, import_node_fs39.existsSync)((0, import_node_path36.join)(dir, safe))) return safe;
14034
+ const ext = (0, import_node_path36.extname)(safe);
14010
14035
  const stem = ext ? safe.slice(0, -ext.length) : safe;
14011
14036
  for (let i = 1; i < 1e4; i++) {
14012
14037
  const candidate = `${stem}-${i}${ext}`;
14013
- if (!(0, import_node_fs39.existsSync)((0, import_node_path35.join)(dir, candidate))) return candidate;
14038
+ if (!(0, import_node_fs39.existsSync)((0, import_node_path36.join)(dir, candidate))) return candidate;
14014
14039
  }
14015
14040
  return `${stem}-${(0, import_node_crypto7.randomUUID)()}${ext}`;
14016
14041
  }
@@ -14066,12 +14091,12 @@ function stageAbsolutePathsAsAttachments(worktreePath, absolutePaths) {
14066
14091
  const dir = ensureAttachmentsDir(worktreePath);
14067
14092
  const out = [];
14068
14093
  for (const abs of absolutePaths) {
14069
- const originalName = (0, import_node_path35.basename)(abs);
14094
+ const originalName = (0, import_node_path36.basename)(abs);
14070
14095
  try {
14071
14096
  const st = (0, import_node_fs39.statSync)(abs);
14072
14097
  if (!st.isFile()) continue;
14073
14098
  const name = uniqueAttachmentName(dir, originalName);
14074
- const destAbs = (0, import_node_path35.join)(dir, name);
14099
+ const destAbs = (0, import_node_path36.join)(dir, name);
14075
14100
  (0, import_node_fs39.copyFileSync)(abs, destAbs);
14076
14101
  const rel = `${ATTACHMENTS_DIR}/${name}`;
14077
14102
  const buf = (0, import_node_fs39.readFileSync)(destAbs);
@@ -14096,7 +14121,7 @@ function stageBuffersAsAttachments(worktreePath, buffers2) {
14096
14121
  try {
14097
14122
  const buf = Buffer.from(item.dataBase64, "base64");
14098
14123
  const name = uniqueAttachmentName(dir, originalName);
14099
- const destAbs = (0, import_node_path35.join)(dir, name);
14124
+ const destAbs = (0, import_node_path36.join)(dir, name);
14100
14125
  (0, import_node_fs39.writeFileSync)(destAbs, buf);
14101
14126
  const rel = `${ATTACHMENTS_DIR}/${name}`;
14102
14127
  out.push(attachmentFromBuffer(name, buf, { path: rel }));
@@ -14117,15 +14142,15 @@ function attachmentsFromWorktreePaths(worktreePath, relativePaths) {
14117
14142
  if (!rel || rel.includes("..") || rel.startsWith("/")) {
14118
14143
  out.push({
14119
14144
  id: (0, import_node_crypto7.randomUUID)(),
14120
- name: (0, import_node_path35.basename)(rel) || "file",
14145
+ name: (0, import_node_path36.basename)(rel) || "file",
14121
14146
  kind: "file",
14122
14147
  content: `(invalid path: ${rel})`
14123
14148
  });
14124
14149
  continue;
14125
14150
  }
14126
- const name = (0, import_node_path35.basename)(rel);
14151
+ const name = (0, import_node_path36.basename)(rel);
14127
14152
  try {
14128
- const abs = (0, import_node_path35.join)(worktreePath, rel);
14153
+ const abs = (0, import_node_path36.join)(worktreePath, rel);
14129
14154
  const st = (0, import_node_fs39.statSync)(abs);
14130
14155
  if (!st.isFile()) continue;
14131
14156
  const buf = (0, import_node_fs39.readFileSync)(abs);
@@ -14141,12 +14166,12 @@ function attachmentsFromWorktreePaths(worktreePath, relativePaths) {
14141
14166
  }
14142
14167
  return out;
14143
14168
  }
14144
- var import_node_fs39, import_node_path35, import_node_crypto7, IMAGE_EXTENSIONS2, IMAGE_MIME_BY_EXT, MAX_INLINE_BYTES, MAX_PREVIEW_BYTES;
14169
+ var import_node_fs39, import_node_path36, import_node_crypto7, IMAGE_EXTENSIONS2, IMAGE_MIME_BY_EXT, MAX_INLINE_BYTES, MAX_PREVIEW_BYTES;
14145
14170
  var init_stage_files = __esm({
14146
14171
  "src/composer/stage-files.ts"() {
14147
14172
  "use strict";
14148
14173
  import_node_fs39 = require("fs");
14149
- import_node_path35 = require("path");
14174
+ import_node_path36 = require("path");
14150
14175
  import_node_crypto7 = require("crypto");
14151
14176
  init_workspace_scratch();
14152
14177
  IMAGE_EXTENSIONS2 = /* @__PURE__ */ new Set([
@@ -14316,12 +14341,12 @@ function formatArtifactDirective() {
14316
14341
  function formatUiReminder() {
14317
14342
  return "Sideboard UI: markdown table is enough to read data; present_schema if they ask to edit/filter (even after markdown); present_files for the file manager. html fence or present_artifact, not both for the same document. ask_user only for a real multiple-choice (not hellos or \u201Cwhat next?\u201D) \u2014 reply in chat. Do not say artifacts/CMS UI are unavailable.";
14318
14343
  }
14319
- var import_node_fs40, import_node_path36;
14344
+ var import_node_fs40, import_node_path37;
14320
14345
  var init_instructions = __esm({
14321
14346
  "src/agents/instructions.ts"() {
14322
14347
  "use strict";
14323
14348
  import_node_fs40 = require("fs");
14324
- import_node_path36 = require("path");
14349
+ import_node_path37 = require("path");
14325
14350
  init_git_auth_mode();
14326
14351
  init_worktree_labels();
14327
14352
  }
@@ -14397,13 +14422,13 @@ __export(plan_file_exports, {
14397
14422
  writePlanFile: () => writePlanFile
14398
14423
  });
14399
14424
  function ensureAttachmentsGitignore(worktreePath) {
14400
- const gitignoreAbs = (0, import_node_path37.join)(worktreePath, ATTACHMENTS_DIR, ".gitignore");
14425
+ const gitignoreAbs = (0, import_node_path38.join)(worktreePath, ATTACHMENTS_DIR, ".gitignore");
14401
14426
  if ((0, import_node_fs41.existsSync)(gitignoreAbs)) return;
14402
- (0, import_node_fs41.mkdirSync)((0, import_node_path37.dirname)(gitignoreAbs), { recursive: true });
14427
+ (0, import_node_fs41.mkdirSync)((0, import_node_path38.dirname)(gitignoreAbs), { recursive: true });
14403
14428
  (0, import_node_fs41.writeFileSync)(gitignoreAbs, attachmentsGitignoreBody(), "utf8");
14404
14429
  }
14405
14430
  function planFileAbs(worktreePath) {
14406
- return (0, import_node_path37.join)(worktreePath, PLAN_FILE_REL);
14431
+ return (0, import_node_path38.join)(worktreePath, PLAN_FILE_REL);
14407
14432
  }
14408
14433
  function readTextIfPresent2(abs) {
14409
14434
  if (!(0, import_node_fs41.existsSync)(abs)) return null;
@@ -14415,22 +14440,22 @@ function readTextIfPresent2(abs) {
14415
14440
  }
14416
14441
  }
14417
14442
  function readPlanFile(worktreePath) {
14418
- return readTextIfPresent2(planFileAbs(worktreePath)) ?? readTextIfPresent2((0, import_node_path37.join)(worktreePath, `${LEGACY_ATTACHMENTS_DIR}/plan.md`)) ?? readTextIfPresent2((0, import_node_path37.join)(worktreePath, LEGACY_PLAN_FILE_REL));
14443
+ return readTextIfPresent2(planFileAbs(worktreePath)) ?? readTextIfPresent2((0, import_node_path38.join)(worktreePath, `${LEGACY_ATTACHMENTS_DIR}/plan.md`)) ?? readTextIfPresent2((0, import_node_path38.join)(worktreePath, LEGACY_PLAN_FILE_REL));
14419
14444
  }
14420
14445
  function writePlanFile(worktreePath, content) {
14421
14446
  ensureAttachmentsGitignore(worktreePath);
14422
14447
  const abs = planFileAbs(worktreePath);
14423
- (0, import_node_fs41.mkdirSync)((0, import_node_path37.dirname)(abs), { recursive: true });
14448
+ (0, import_node_fs41.mkdirSync)((0, import_node_path38.dirname)(abs), { recursive: true });
14424
14449
  const body = content.trimEnd() + (content.endsWith("\n") ? "" : "\n");
14425
14450
  (0, import_node_fs41.writeFileSync)(abs, body, "utf8");
14426
14451
  return PLAN_FILE_REL;
14427
14452
  }
14428
- var import_node_fs41, import_node_path37;
14453
+ var import_node_fs41, import_node_path38;
14429
14454
  var init_plan_file = __esm({
14430
14455
  "src/plan/plan-file.ts"() {
14431
14456
  "use strict";
14432
14457
  import_node_fs41 = require("fs");
14433
- import_node_path37 = require("path");
14458
+ import_node_path38 = require("path");
14434
14459
  init_workspace_scratch();
14435
14460
  init_plan_present();
14436
14461
  init_plan_present();
@@ -14490,7 +14515,7 @@ function setCaffeinateHoldHooks(next) {
14490
14515
  hooks = next;
14491
14516
  }
14492
14517
  function caffeinateHoldPath() {
14493
- return (0, import_node_path38.join)(appDataDir(), "caffeinate-hold.json");
14518
+ return (0, import_node_path39.join)(appDataDir(), "caffeinate-hold.json");
14494
14519
  }
14495
14520
  function processAlive(pid) {
14496
14521
  if (hooks.processAlive) return hooks.processAlive(pid);
@@ -14633,13 +14658,13 @@ function releaseCaffeinateHoldForThread(threadId) {
14633
14658
  }
14634
14659
  return setCaffeinateHold(false, { threadId: id });
14635
14660
  }
14636
- var import_node_child_process4, import_node_fs42, import_node_path38, hooks;
14661
+ var import_node_child_process4, import_node_fs42, import_node_path39, hooks;
14637
14662
  var init_caffeinate_hold = __esm({
14638
14663
  "src/store/caffeinate-hold.ts"() {
14639
14664
  "use strict";
14640
14665
  import_node_child_process4 = require("child_process");
14641
14666
  import_node_fs42 = require("fs");
14642
- import_node_path38 = require("path");
14667
+ import_node_path39 = require("path");
14643
14668
  init_paths();
14644
14669
  init_private_file();
14645
14670
  hooks = {};
@@ -14648,7 +14673,7 @@ var init_caffeinate_hold = __esm({
14648
14673
 
14649
14674
  // src/store/schedules.ts
14650
14675
  function schedulesPath() {
14651
- return (0, import_node_path39.join)(appDataDir(), "schedules.json");
14676
+ return (0, import_node_path40.join)(appDataDir(), "schedules.json");
14652
14677
  }
14653
14678
  function parseDurationMs(every) {
14654
14679
  const m = every.trim().match(DURATION_RE);
@@ -14862,13 +14887,13 @@ function recordScheduleRun(id, result) {
14862
14887
  writeAll2(rows);
14863
14888
  return next;
14864
14889
  }
14865
- var import_node_crypto8, import_node_fs43, import_node_path39, import_croner, DURATION_RE, UNIT_MS;
14890
+ var import_node_crypto8, import_node_fs43, import_node_path40, import_croner, DURATION_RE, UNIT_MS;
14866
14891
  var init_schedules = __esm({
14867
14892
  "src/store/schedules.ts"() {
14868
14893
  "use strict";
14869
14894
  import_node_crypto8 = require("crypto");
14870
14895
  import_node_fs43 = require("fs");
14871
- import_node_path39 = require("path");
14896
+ import_node_path40 = require("path");
14872
14897
  import_croner = require("croner");
14873
14898
  init_orchestrator_capable();
14874
14899
  init_paths();
@@ -15008,6 +15033,37 @@ var init_schedule_runner = __esm({
15008
15033
  }
15009
15034
  });
15010
15035
 
15036
+ // src/agents/cursor-store.ts
15037
+ function cursorSdkStoreDir(threadId) {
15038
+ const root = (0, import_node_path41.join)(appDataDir(), CURSOR_SDK_STORE_DIR);
15039
+ const id = sanitizeCursorStoreSegment(threadId);
15040
+ if (!id) return root;
15041
+ return (0, import_node_path41.join)(root, "threads", id);
15042
+ }
15043
+ function cursorSdkRunsNdjsonPath(threadId) {
15044
+ return (0, import_node_path41.join)(cursorSdkStoreDir(threadId), "runs.ndjson");
15045
+ }
15046
+ function cursorSdkRunsNdjsonSearchPaths(threadId) {
15047
+ const scoped = cursorSdkRunsNdjsonPath(threadId);
15048
+ const shared = cursorSdkRunsNdjsonPath(null);
15049
+ if (!threadId || !sanitizeCursorStoreSegment(threadId) || scoped === shared) {
15050
+ return [shared];
15051
+ }
15052
+ return [scoped, shared];
15053
+ }
15054
+ function sanitizeCursorStoreSegment(threadId) {
15055
+ return (threadId ?? "").trim().replace(/[^a-zA-Z0-9._-]/g, "_");
15056
+ }
15057
+ var import_node_path41, CURSOR_SDK_STORE_DIR;
15058
+ var init_cursor_store = __esm({
15059
+ "src/agents/cursor-store.ts"() {
15060
+ "use strict";
15061
+ import_node_path41 = require("path");
15062
+ init_paths();
15063
+ CURSOR_SDK_STORE_DIR = "cursor-sdk-store";
15064
+ }
15065
+ });
15066
+
15011
15067
  // src/agents/cursor-recover.ts
15012
15068
  var cursor_recover_exports = {};
15013
15069
  __export(cursor_recover_exports, {
@@ -15016,7 +15072,14 @@ __export(cursor_recover_exports, {
15016
15072
  function recoverFinishedCursorRun(opts) {
15017
15073
  const agentId = opts.agentId.trim();
15018
15074
  if (!agentId) return null;
15019
- const runsPath = (0, import_node_path40.join)(appDataDir(), "cursor-sdk-store", "runs.ndjson");
15075
+ let best = null;
15076
+ for (const runsPath of cursorSdkRunsNdjsonSearchPaths(opts.threadId)) {
15077
+ const hit = scanFinishedCursorRuns(runsPath, agentId, opts.startedAfterMs);
15078
+ if (hit && (!best || hit.endedAt >= best.endedAt)) best = hit;
15079
+ }
15080
+ return best;
15081
+ }
15082
+ function scanFinishedCursorRuns(runsPath, agentId, startedAfterMs) {
15020
15083
  if (!(0, import_node_fs44.existsSync)(runsPath)) return null;
15021
15084
  try {
15022
15085
  const lines = (0, import_node_fs44.readFileSync)(runsPath, "utf8").split("\n");
@@ -15035,7 +15098,7 @@ function recoverFinishedCursorRun(opts) {
15035
15098
  if (typeof row.result !== "string" || !row.result.trim()) continue;
15036
15099
  const endedAt = typeof row.endedAt === "number" ? row.endedAt : 0;
15037
15100
  const createdAt = typeof row.createdAt === "number" ? row.createdAt : 0;
15038
- if (createdAt < opts.startedAfterMs && endedAt < opts.startedAfterMs) continue;
15101
+ if (createdAt < startedAfterMs && endedAt < startedAfterMs) continue;
15039
15102
  if (!best || endedAt >= best.endedAt) {
15040
15103
  best = { runId: row.runId || "", result: row.result.trim(), endedAt };
15041
15104
  }
@@ -15045,13 +15108,12 @@ function recoverFinishedCursorRun(opts) {
15045
15108
  return null;
15046
15109
  }
15047
15110
  }
15048
- var import_node_fs44, import_node_path40;
15111
+ var import_node_fs44;
15049
15112
  var init_cursor_recover = __esm({
15050
15113
  "src/agents/cursor-recover.ts"() {
15051
15114
  "use strict";
15052
15115
  import_node_fs44 = require("fs");
15053
- import_node_path40 = require("path");
15054
- init_paths();
15116
+ init_cursor_store();
15055
15117
  }
15056
15118
  });
15057
15119
 
@@ -15212,6 +15274,7 @@ var init_orchestrator = __esm({
15212
15274
  init_run();
15213
15275
  init_repo_git_lock();
15214
15276
  init_turn_live();
15277
+ init_reconcile_heal();
15215
15278
  init_request_review();
15216
15279
  init_fork_worktree();
15217
15280
  init_quota_failover();
@@ -15241,6 +15304,8 @@ var init_orchestrator = __esm({
15241
15304
  draining = /* @__PURE__ */ new Set();
15242
15305
  /** Threads past setStatus(running) but not yet in activeTurns (spawn in flight). */
15243
15306
  startingTurns = /* @__PURE__ */ new Set();
15307
+ /** Last sync thread-file read for false-stop heal (throttled per thread). */
15308
+ lastReconcileHealAt = /* @__PURE__ */ new Map();
15244
15309
  /**
15245
15310
  * Threads intentionally force-stopped. Prevents runTurn from re-asserting
15246
15311
  * `running` after spawn, and from overwriting `stopped` with idle/error when
@@ -15838,7 +15903,13 @@ var init_orchestrator = __esm({
15838
15903
  if (event.type === "stderr" && typeof event.data === "string") {
15839
15904
  pushTurnStderr(stderrTail, event.data);
15840
15905
  }
15841
- if (event.type !== "stdout" && event.type !== "thinking") {
15906
+ const now = Date.now();
15907
+ if (shouldReadThreadToHealReconcile(
15908
+ event.type,
15909
+ this.lastReconcileHealAt.get(threadId),
15910
+ now
15911
+ )) {
15912
+ this.lastReconcileHealAt.set(threadId, now);
15842
15913
  const live = readThread(threadId);
15843
15914
  if (live?.lastError?.includes("reconciled on startup") && (this.activeTurns.has(threadId) || this.startingTurns.has(threadId))) {
15844
15915
  setStatus(threadId, "running");
@@ -15882,7 +15953,8 @@ var init_orchestrator = __esm({
15882
15953
  for (let i = 0; i < 8; i++) {
15883
15954
  const recovered = recoverFinishedCursorRun2({
15884
15955
  agentId: sessionId,
15885
- startedAfterMs: turnStartedAt - 5e3
15956
+ startedAfterMs: turnStartedAt - 5e3,
15957
+ threadId
15886
15958
  });
15887
15959
  if (recovered?.result) {
15888
15960
  assistantText = recovered.result;
@@ -16983,7 +17055,7 @@ init_nested_electron_env();
16983
17055
  var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
16984
17056
  var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
16985
17057
  var import_zod4 = require("zod");
16986
- var import_node_path41 = require("path");
17058
+ var import_node_path42 = require("path");
16987
17059
  init_orchestrator();
16988
17060
  init_worktree();
16989
17061
 
@@ -18340,7 +18412,7 @@ async function startMcpServer() {
18340
18412
  async () => {
18341
18413
  const threads = orch.getThreads(true);
18342
18414
  const lines = threads.map((t) => {
18343
- const repo = t.repoPath === GLOBAL_WORKSPACE_ID ? "Orchestration" : (0, import_node_path41.basename)(t.repoPath) || t.repoPath;
18415
+ const repo = t.repoPath === GLOBAL_WORKSPACE_ID ? "Orchestration" : (0, import_node_path42.basename)(t.repoPath) || t.repoPath;
18344
18416
  const live = t.status === "running" || t.status === "queued" ? readTurnLive(t.id) : null;
18345
18417
  const progress = live?.summary ? ` ${live.summary}` : "";
18346
18418
  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}`;