@sideboard-ai/core 0.1.174 → 0.1.175

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 (40) hide show
  1. package/dist/{abletime-PCLL36HW.js → abletime-BFIDZR3O.js} +2 -2
  2. package/dist/{abletime-7VW4EGPT.js → abletime-INEHQH6K.js} +2 -2
  3. package/dist/agents/cursor-runner.cjs +91 -62
  4. package/dist/agents/cursor-runner.js +1 -1
  5. package/dist/{agents-LMPVUPOH.js → agents-2W7LP7JR.js} +5 -5
  6. package/dist/{agents-ZWYRGFZB.js → agents-AWSFDB47.js} +6 -6
  7. package/dist/{chunk-M267JPEA.js → chunk-AN3THU7F.js} +1 -1
  8. package/dist/{chunk-AQPVBVJE.js → chunk-BBNUL4IE.js} +1 -1
  9. package/dist/{chunk-LZ6QMEQC.js → chunk-HVIEYTUK.js} +1 -1
  10. package/dist/{chunk-XD2BAANL.js → chunk-IEEAVWAP.js} +6 -6
  11. package/dist/{chunk-HJPGIETB.js → chunk-JIWRBNSO.js} +12 -12
  12. package/dist/{chunk-ELBYOGVA.js → chunk-N7WZ6NIN.js} +10 -1
  13. package/dist/{chunk-ZY7K4T37.js → chunk-NA7P3SZL.js} +3 -3
  14. package/dist/{chunk-XXIH6XYR.js → chunk-NQTKRAUF.js} +167 -35
  15. package/dist/{chunk-CUA4S537.js → chunk-QTJ2ERA6.js} +5 -5
  16. package/dist/{chunk-YEPVWJ3R.js → chunk-RCICB4OM.js} +9 -9
  17. package/dist/{chunk-CMJ2FBBV.js → chunk-RE2YWFUQ.js} +1 -1
  18. package/dist/{chunk-VCVBICMZ.js → chunk-TNOLCU5B.js} +3 -3
  19. package/dist/{chunk-6GN5WPYZ.js → chunk-VKQGAWHY.js} +10 -1
  20. package/dist/{chunk-S42XV45P.js → chunk-Y4MIXGPA.js} +1 -1
  21. package/dist/{chunk-TPPZXZTA.js → chunk-ZXHV3NHY.js} +224 -95
  22. package/dist/{connected-teams-DBWAMP7G.js → connected-teams-ON2KIKQX.js} +3 -3
  23. package/dist/{connected-teams-WGONUQOF.js → connected-teams-WOYCH7FR.js} +3 -3
  24. package/dist/{coordinator-prompt-LJKA2ODR.js → coordinator-prompt-7OHKB5WV.js} +1 -1
  25. package/dist/{coordinator-prompt-K3HXEPFD.js → coordinator-prompt-XCQCGUED.js} +1 -1
  26. package/dist/{global-workspace-VDFSU3DD.js → global-workspace-KPROJ54C.js} +1 -1
  27. package/dist/{global-workspace-KA7T26F5.js → global-workspace-WSQNEALF.js} +1 -1
  28. package/dist/index.cjs +565 -373
  29. package/dist/index.d.cts +49 -8
  30. package/dist/index.d.ts +49 -8
  31. package/dist/index.js +71 -25
  32. package/dist/mcp/run-stdio.cjs +762 -570
  33. package/dist/mcp/run-stdio.js +74 -25
  34. package/dist/{oauth-A7XXI2TM.js → oauth-6ZQ4Q4XN.js} +2 -2
  35. package/dist/{oauth-YJBAURIJ.js → oauth-O7UGLZOY.js} +2 -2
  36. package/dist/{orchestrator-VMUZJFTZ.js → orchestrator-PDEU75EE.js} +7 -7
  37. package/dist/{orchestrator-DMSSC4SV.js → orchestrator-QSNGJ2ER.js} +6 -6
  38. package/dist/{workspaces-GOGBPATJ.js → workspaces-P66DGCZE.js} +1 -1
  39. package/dist/{workspaces-UR7YEFMZ.js → workspaces-TEBTNS2M.js} +1 -1
  40. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -7684,8 +7684,8 @@ function ensureGlobalCoordinatorCwd(opts) {
7684
7684
  "",
7685
7685
  "When creating threads, pass `repoPath` from `list_workspaces` (or the path you just registered).",
7686
7686
  orchId ? `Pass parentThreadId="${orchId}" (or omit it). Never invent another parentThreadId.` : "Pass `parentThreadId` for children (this chat's id from the turn reminder).",
7687
- "Omit `agent` / `model` on `create_thread` unless you have a reason to override Account defaults.",
7688
- "Never pass `agent=codex` when you yourself are Codex \u2014 nested Codex deadlocks on shared ~/.codex locks. Omit agent (Account default) or use cursor/claude.",
7687
+ "Omit `agent` / `model` on `create_thread`. Sideboard applies Settings \u2192 Default agent, model & effort. Do not pass your own agent or `agent=cursor` \u2014 those are ignored.",
7688
+ "Never pass `agent=codex` when you yourself are Codex \u2014 nested Codex deadlocks on shared ~/.codex locks. Omit agent; Sideboard applies Account defaults (and coerces only that nested-Codex case).",
7689
7689
  "Typical flow (Home board): list_board \u2192 create_thread (sourceType=ticket|pr|branch) \u2192 send_to_thread \u2192 wait_for_turn (loop while stillRunning) \u2192 ask_git create-draft \u2192 wait_for_turn. Merge only if the user explicitly asked (`ask_git` merge).",
7690
7690
  "Typical flow (branch / explicit source): list_workspaces \u2192 list_branches|list_prs|list_issues \u2192 create_thread \u2192 send_to_thread \u2192 wait_for_turn (loop while stillRunning) \u2192 ask_git create-draft.",
7691
7691
  "Typical flow (find work): list_workspaces \u2192 pick repo(s) matching account / project context \u2192 Sideboard list_issues / linear_* (tickets) or list_prs(queue=review) (reviews) \u2192 show the options. Never wait on Claude Linear MCP. Only create_thread + send_to_thread when they asked to start (e.g. \u201Cfind me work and start it\u201D) \u2014 then wait_for_turn (loop while stillRunning) \u2192 ask_git create-draft.",
@@ -7762,7 +7762,7 @@ var init_coordinator_prompt = __esm({
7762
7762
  "Workspaces:",
7763
7763
  "- add_workspace / remove_workspace \u2014 register or unregister a git repo",
7764
7764
  "Worktree threads (chats):",
7765
- "- create_thread \u2014 create a worktree + chat from branch | pr | ticket (appears on Home). Do not create a second worktree for a ticket, PR, or named branch that already has one \u2014 that call returns the live thread (alreadyStarted=true). Creating from the default branch still opens a new isolated worktree. Pass repoPath + parentThreadId; omit agent and model to use Sideboard Account defaults (Settings \u2192 Default agent, model & effort). If the repo has a setup script, Sideboard runs it in the background (does not block send_to_thread). If you are Codex, do not set agent=codex (nested Codex deadlocks)",
7765
+ "- create_thread \u2014 create a worktree + chat from branch | pr | ticket (appears on Home). Do not create a second worktree for a ticket, PR, or named branch that already has one \u2014 that call returns the live thread (alreadyStarted=true). Creating from the default branch still opens a new isolated worktree. Pass repoPath + parentThreadId; omit agent and model so Sideboard applies Settings \u2192 Default agent, model & effort (never pass your own agent or agent=cursor). If the repo has a setup script, Sideboard runs it in the background (does not block send_to_thread). Nested Codex (you are Codex and the child is Codex) deadlocks \u2014 omit agent; Sideboard coerces that case",
7766
7766
  "- start_board_card \u2014 same as create_thread for a ticket/PR/named branch (attaches issue text when resolvable). Then send_to_thread.",
7767
7767
  "- fork_worktree \u2014 fork a worktree chat into a NEW git worktree + chat (transcript attached); optional agent; leave model unset (Auto) unless you have a reason. Not for orchestration chats.",
7768
7768
  "- fork_chat \u2014 fork a worktree chat (same worktree tab) OR a Global orchestration chat (new orchestration tab); optional agent; leave model unset (Auto) unless you have a reason. Remote coordinators: use this to continue another orchestration chat on a different agent after session limits.",
@@ -8943,17 +8943,24 @@ var init_config = __esm({
8943
8943
  function setHttpFetchImpl(fetchImpl) {
8944
8944
  injected = fetchImpl;
8945
8945
  }
8946
+ function tlsIssuerHint(code, message) {
8947
+ const text7 = `${code ?? ""} ${message}`;
8948
+ return TLS_ISSUER_RE.test(text7) ? TLS_ISSUER_HINT : "";
8949
+ }
8946
8950
  function formatFetchError(err, url) {
8947
8951
  if (!(err instanceof Error)) return `${String(err)} (${url})`;
8948
8952
  const cause = err.cause;
8949
8953
  let detail = "";
8954
+ let hint = tlsIssuerHint(void 0, err.message);
8950
8955
  if (cause instanceof Error) {
8951
8956
  const code = typeof cause.code === "string" ? cause.code : void 0;
8952
8957
  detail = code ? ` [${code}: ${cause.message}]` : ` [${cause.message}]`;
8958
+ hint = tlsIssuerHint(code, `${err.message} ${cause.message}`) || hint;
8953
8959
  } else if (cause != null) {
8954
8960
  detail = ` [${String(cause)}]`;
8961
+ hint = tlsIssuerHint(void 0, String(cause)) || hint;
8955
8962
  }
8956
- return `${err.message}${detail} (${url})`;
8963
+ return `${err.message}${detail} (${url})${hint}`;
8957
8964
  }
8958
8965
  async function httpFetch(input, init) {
8959
8966
  const url = typeof input === "string" ? input : input.href;
@@ -8964,11 +8971,13 @@ async function httpFetch(input, init) {
8964
8971
  throw new Error(formatFetchError(err, url));
8965
8972
  }
8966
8973
  }
8967
- var injected;
8974
+ var injected, TLS_ISSUER_RE, TLS_ISSUER_HINT;
8968
8975
  var init_fetch = __esm({
8969
8976
  "src/http/fetch.ts"() {
8970
8977
  "use strict";
8971
8978
  injected = null;
8979
+ TLS_ISSUER_RE = /UNABLE_TO_GET_ISSUER_CERT|UNABLE_TO_VERIFY_LEAF_SIGNATURE|SELF_SIGNED_CERT_IN_CHAIN/i;
8980
+ TLS_ISSUER_HINT = " \u2014 Node rejected the TLS certificate (corporate VPN/proxy CA). Desktop Linear can still work; reconnecting the API key will not fix this.";
8972
8981
  }
8973
8982
  });
8974
8983
 
@@ -10521,6 +10530,138 @@ var init_profile = __esm({
10521
10530
  }
10522
10531
  });
10523
10532
 
10533
+ // src/http/system-ca.ts
10534
+ function splitPemCertificates(pem) {
10535
+ return pem.match(PEM_CERT_RE) ?? [];
10536
+ }
10537
+ function readExistingFile(path2) {
10538
+ try {
10539
+ return (0, import_node_fs26.existsSync)(path2) ? (0, import_node_fs26.readFileSync)(path2, "utf8") : "";
10540
+ } catch {
10541
+ return "";
10542
+ }
10543
+ }
10544
+ function darwinKeychainPem(spawn2) {
10545
+ const result = spawn2("/usr/bin/security", ["find-certificate", "-a", "-p"], {
10546
+ encoding: "utf8",
10547
+ maxBuffer: 32 * 1024 * 1024,
10548
+ timeout: 15e3
10549
+ });
10550
+ if (result.status !== 0) return "";
10551
+ return typeof result.stdout === "string" ? result.stdout : "";
10552
+ }
10553
+ function linuxSystemCaPem() {
10554
+ for (const path2 of LINUX_CA_FILES) {
10555
+ const pem = readExistingFile(path2);
10556
+ if (splitPemCertificates(pem).length > 0) return pem;
10557
+ }
10558
+ return "";
10559
+ }
10560
+ function collectSystemCaPem(io = {}) {
10561
+ const platform = io.platform ?? process.platform;
10562
+ if (platform === "darwin") {
10563
+ return darwinKeychainPem(io.spawn ?? import_node_child_process4.spawnSync);
10564
+ }
10565
+ if (platform === "linux") {
10566
+ return linuxSystemCaPem();
10567
+ }
10568
+ return "";
10569
+ }
10570
+ function systemCaBundlePath(io = {}) {
10571
+ return (0, import_node_path28.join)((io.appData ?? appDataDir)(), BUNDLE_NAME);
10572
+ }
10573
+ function bundleIsFresh(path2, now) {
10574
+ try {
10575
+ if (!(0, import_node_fs26.existsSync)(path2)) return false;
10576
+ if (splitPemCertificates((0, import_node_fs26.readFileSync)(path2, "utf8")).length === 0) return false;
10577
+ return now - (0, import_node_fs26.statSync)(path2).mtimeMs < BUNDLE_MAX_AGE_MS;
10578
+ } catch {
10579
+ return false;
10580
+ }
10581
+ }
10582
+ function materializeSystemCaBundle(io = {}) {
10583
+ const inherited = process.env.NODE_EXTRA_CA_CERTS?.trim();
10584
+ if (inherited && splitPemCertificates(readExistingFile(inherited)).length > 0) {
10585
+ return inherited;
10586
+ }
10587
+ const platform = io.platform ?? process.platform;
10588
+ if (platform === "linux") {
10589
+ for (const path2 of LINUX_CA_FILES) {
10590
+ if (splitPemCertificates(readExistingFile(path2)).length > 0) return path2;
10591
+ }
10592
+ }
10593
+ const dest = systemCaBundlePath(io);
10594
+ const now = (io.now ?? Date.now)();
10595
+ if (bundleIsFresh(dest, now)) return dest;
10596
+ const pem = collectSystemCaPem(io);
10597
+ if (splitPemCertificates(pem).length === 0) {
10598
+ return (0, import_node_fs26.existsSync)(dest) && splitPemCertificates(readExistingFile(dest)).length > 0 ? dest : void 0;
10599
+ }
10600
+ try {
10601
+ (0, import_node_fs26.mkdirSync)((0, import_node_path28.dirname)(dest), { recursive: true });
10602
+ (0, import_node_fs26.writeFileSync)(dest, pem.endsWith("\n") ? pem : `${pem}
10603
+ `, { mode: 384 });
10604
+ return dest;
10605
+ } catch {
10606
+ return void 0;
10607
+ }
10608
+ }
10609
+ function applySystemCaEnv(env) {
10610
+ if (!String(env[NODE_USE_SYSTEM_CA] ?? "").trim()) {
10611
+ env[NODE_USE_SYSTEM_CA] = "1";
10612
+ }
10613
+ if (String(env[NODE_EXTRA_CA_CERTS] ?? "").trim()) return;
10614
+ const inherited = process.env.NODE_EXTRA_CA_CERTS?.trim();
10615
+ if (inherited) env[NODE_EXTRA_CA_CERTS] = inherited;
10616
+ }
10617
+ function extraCertsFromBundle() {
10618
+ const path2 = process.env.NODE_EXTRA_CA_CERTS?.trim();
10619
+ if (path2) return splitPemCertificates(readExistingFile(path2));
10620
+ const dest = systemCaBundlePath();
10621
+ return splitPemCertificates(readExistingFile(dest));
10622
+ }
10623
+ function trustSystemCertificates(io = {}) {
10624
+ try {
10625
+ const api = import_node_tls.default;
10626
+ if (typeof api.getCACertificates !== "function" || typeof api.setDefaultCACertificates !== "function") {
10627
+ return false;
10628
+ }
10629
+ const current = api.getCACertificates("default");
10630
+ const system = api.getCACertificates("system");
10631
+ let extra = extraCertsFromBundle();
10632
+ if (system.length === 0 && extra.length === 0) {
10633
+ extra = splitPemCertificates(collectSystemCaPem(io));
10634
+ }
10635
+ if (system.length === 0 && extra.length === 0) return false;
10636
+ api.setDefaultCACertificates([...current, ...system, ...extra]);
10637
+ return true;
10638
+ } catch {
10639
+ return false;
10640
+ }
10641
+ }
10642
+ var import_node_child_process4, import_node_fs26, import_node_path28, import_node_tls, NODE_USE_SYSTEM_CA, NODE_EXTRA_CA_CERTS, BUNDLE_NAME, BUNDLE_MAX_AGE_MS, LINUX_CA_FILES, PEM_CERT_RE;
10643
+ var init_system_ca = __esm({
10644
+ "src/http/system-ca.ts"() {
10645
+ "use strict";
10646
+ import_node_child_process4 = require("child_process");
10647
+ import_node_fs26 = require("fs");
10648
+ import_node_path28 = require("path");
10649
+ import_node_tls = __toESM(require("tls"), 1);
10650
+ init_paths();
10651
+ NODE_USE_SYSTEM_CA = "NODE_USE_SYSTEM_CA";
10652
+ NODE_EXTRA_CA_CERTS = "NODE_EXTRA_CA_CERTS";
10653
+ BUNDLE_NAME = "system-ca.pem";
10654
+ BUNDLE_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
10655
+ LINUX_CA_FILES = [
10656
+ "/etc/ssl/certs/ca-certificates.crt",
10657
+ "/etc/pki/tls/certs/ca-bundle.crt",
10658
+ "/etc/ssl/ca-bundle.pem",
10659
+ "/etc/ssl/cert.pem"
10660
+ ];
10661
+ PEM_CERT_RE = /-----BEGIN CERTIFICATE-----[\s\S]*?-----END CERTIFICATE-----/g;
10662
+ }
10663
+ });
10664
+
10524
10665
  // src/agents/packaged-runtime.ts
10525
10666
  function electronResourcesPath() {
10526
10667
  const resources = process.resourcesPath;
@@ -10530,43 +10671,43 @@ function electronResourcesPath() {
10530
10671
  function packagedCursorRuntimeDir() {
10531
10672
  const resources = electronResourcesPath();
10532
10673
  if (!resources) return null;
10533
- const dir = (0, import_node_path28.join)(resources, "cursor-runtime");
10534
- if (!(0, import_node_fs26.existsSync)((0, import_node_path28.join)(dir, "core-dist", "agents", "cursor-runner.js"))) return null;
10674
+ const dir = (0, import_node_path29.join)(resources, "cursor-runtime");
10675
+ if (!(0, import_node_fs27.existsSync)((0, import_node_path29.join)(dir, "core-dist", "agents", "cursor-runner.js"))) return null;
10535
10676
  return dir;
10536
10677
  }
10537
10678
  function packagedCursorRunnerPath() {
10538
10679
  const dir = packagedCursorRuntimeDir();
10539
- return dir ? (0, import_node_path28.join)(dir, "core-dist", "agents", "cursor-runner.js") : null;
10680
+ return dir ? (0, import_node_path29.join)(dir, "core-dist", "agents", "cursor-runner.js") : null;
10540
10681
  }
10541
10682
  function packagedMcpDir() {
10542
10683
  const resources = electronResourcesPath();
10543
10684
  if (!resources) return null;
10544
- const dir = (0, import_node_path28.join)(resources, "sideboard-mcp");
10545
- if (!(0, import_node_fs26.existsSync)((0, import_node_path28.join)(dir, "core-dist", "mcp", "run-stdio.js"))) return null;
10685
+ const dir = (0, import_node_path29.join)(resources, "sideboard-mcp");
10686
+ if (!(0, import_node_fs27.existsSync)((0, import_node_path29.join)(dir, "core-dist", "mcp", "run-stdio.js"))) return null;
10546
10687
  return dir;
10547
10688
  }
10548
10689
  function packagedMcpStdioPath() {
10549
10690
  const dir = packagedMcpDir();
10550
- return dir ? (0, import_node_path28.join)(dir, "core-dist", "mcp", "run-stdio.js") : null;
10691
+ return dir ? (0, import_node_path29.join)(dir, "core-dist", "mcp", "run-stdio.js") : null;
10551
10692
  }
10552
10693
  function packagedBundledNodePath() {
10553
10694
  const resources = electronResourcesPath();
10554
10695
  if (!resources) return null;
10555
- const bin = (0, import_node_path28.join)(resources, "node", "bin", "node");
10556
- if (!(0, import_node_fs26.existsSync)(bin)) return null;
10696
+ const bin = (0, import_node_path29.join)(resources, "node", "bin", "node");
10697
+ if (!(0, import_node_fs27.existsSync)(bin)) return null;
10557
10698
  return bin;
10558
10699
  }
10559
10700
  function packagedCursorRipgrepCandidate(platformPkg, binName) {
10560
10701
  const dir = packagedCursorRuntimeDir();
10561
10702
  if (!dir) return null;
10562
- return (0, import_node_path28.join)(dir, "node_modules", platformPkg, "bin", binName);
10703
+ return (0, import_node_path29.join)(dir, "node_modules", platformPkg, "bin", binName);
10563
10704
  }
10564
- var import_node_fs26, import_node_path28;
10705
+ var import_node_fs27, import_node_path29;
10565
10706
  var init_packaged_runtime = __esm({
10566
10707
  "src/agents/packaged-runtime.ts"() {
10567
10708
  "use strict";
10568
- import_node_fs26 = require("fs");
10569
- import_node_path28 = require("path");
10709
+ import_node_fs27 = require("fs");
10710
+ import_node_path29 = require("path");
10570
10711
  }
10571
10712
  });
10572
10713
 
@@ -10586,6 +10727,7 @@ function applyAgentRunnerHeapEnv(env) {
10586
10727
  env.NODE_OPTIONS,
10587
10728
  AGENT_RUNNER_MAX_OLD_SPACE_MB
10588
10729
  );
10730
+ applySystemCaEnv(env);
10589
10731
  }
10590
10732
  function envWithAgentHeap(env) {
10591
10733
  const next = { ...env };
@@ -10600,7 +10742,7 @@ function unpackedAsarPath(filePath) {
10600
10742
  if (!isAsarPath(filePath)) return null;
10601
10743
  const unpacked = filePath.replace(/\.asar(?=[/\\])/, ".asar.unpacked");
10602
10744
  if (unpacked === filePath) return null;
10603
- return (0, import_node_fs27.existsSync)(unpacked) ? unpacked : null;
10745
+ return (0, import_node_fs28.existsSync)(unpacked) ? unpacked : null;
10604
10746
  }
10605
10747
  function nodeReadableScriptPath(scriptPath) {
10606
10748
  return unpackedAsarPath(scriptPath) ?? scriptPath;
@@ -10640,37 +10782,37 @@ function pickPreferredNode(candidates) {
10640
10782
  return best;
10641
10783
  }
10642
10784
  function versionDirNodeBins(root, toBin) {
10643
- if (!(0, import_node_fs27.existsSync)(root)) return [];
10785
+ if (!(0, import_node_fs28.existsSync)(root)) return [];
10644
10786
  try {
10645
- return (0, import_node_fs27.readdirSync)(root).map(toBin);
10787
+ return (0, import_node_fs28.readdirSync)(root).map(toBin);
10646
10788
  } catch {
10647
10789
  return [];
10648
10790
  }
10649
10791
  }
10650
10792
  function defaultNodeBinCandidates(home = (0, import_node_os8.homedir)()) {
10651
10793
  const kegs = ["/opt/homebrew", "/usr/local"].flatMap(
10652
- (prefix) => PREFERRED_LTS_MAJORS.map((major) => (0, import_node_path29.join)(prefix, "opt", `node@${major}`, "bin", "node"))
10794
+ (prefix) => PREFERRED_LTS_MAJORS.map((major) => (0, import_node_path30.join)(prefix, "opt", `node@${major}`, "bin", "node"))
10653
10795
  );
10654
10796
  return [
10655
10797
  ...kegs,
10656
10798
  "/opt/homebrew/bin/node",
10657
10799
  "/usr/local/bin/node",
10658
- (0, import_node_path29.join)(home, ".local/share/fnm/aliases/default/bin/node"),
10659
- (0, import_node_path29.join)(home, ".nvm/current/bin/node"),
10660
- (0, import_node_path29.join)(home, ".volta/bin/node"),
10661
- (0, import_node_path29.join)(home, ".asdf/shims/node"),
10662
- (0, import_node_path29.join)(home, ".local/share/mise/shims/node"),
10800
+ (0, import_node_path30.join)(home, ".local/share/fnm/aliases/default/bin/node"),
10801
+ (0, import_node_path30.join)(home, ".nvm/current/bin/node"),
10802
+ (0, import_node_path30.join)(home, ".volta/bin/node"),
10803
+ (0, import_node_path30.join)(home, ".asdf/shims/node"),
10804
+ (0, import_node_path30.join)(home, ".local/share/mise/shims/node"),
10663
10805
  ...versionDirNodeBins(
10664
- (0, import_node_path29.join)(home, ".nvm", "versions", "node"),
10665
- (name) => (0, import_node_path29.join)(home, ".nvm", "versions", "node", name, "bin", "node")
10806
+ (0, import_node_path30.join)(home, ".nvm", "versions", "node"),
10807
+ (name) => (0, import_node_path30.join)(home, ".nvm", "versions", "node", name, "bin", "node")
10666
10808
  ),
10667
10809
  ...versionDirNodeBins(
10668
- (0, import_node_path29.join)(home, ".local/share/fnm", "node-versions"),
10669
- (name) => (0, import_node_path29.join)(home, ".local/share/fnm", "node-versions", name, "installation", "bin", "node")
10810
+ (0, import_node_path30.join)(home, ".local/share/fnm", "node-versions"),
10811
+ (name) => (0, import_node_path30.join)(home, ".local/share/fnm", "node-versions", name, "installation", "bin", "node")
10670
10812
  ),
10671
10813
  ...versionDirNodeBins(
10672
- (0, import_node_path29.join)(home, ".volta", "tools", "image", "node"),
10673
- (name) => (0, import_node_path29.join)(home, ".volta", "tools", "image", "node", name, "bin", "node")
10814
+ (0, import_node_path30.join)(home, ".volta", "tools", "image", "node"),
10815
+ (name) => (0, import_node_path30.join)(home, ".volta", "tools", "image", "node", name, "bin", "node")
10674
10816
  )
10675
10817
  ];
10676
10818
  }
@@ -10679,10 +10821,10 @@ function uniqueExistingNodeBins(paths) {
10679
10821
  const out = [];
10680
10822
  for (const raw of paths) {
10681
10823
  const p = raw.trim();
10682
- if (!p || !(0, import_node_fs27.existsSync)(p) || isElectronLikeCommand(p)) continue;
10824
+ if (!p || !(0, import_node_fs28.existsSync)(p) || isElectronLikeCommand(p)) continue;
10683
10825
  let key = p;
10684
10826
  try {
10685
- key = (0, import_node_fs27.realpathSync)(p);
10827
+ key = (0, import_node_fs28.realpathSync)(p);
10686
10828
  } catch {
10687
10829
  continue;
10688
10830
  }
@@ -10762,14 +10904,15 @@ async function resolveNodeLaunch(scriptPath) {
10762
10904
  env: { ELECTRON_RUN_AS_NODE: "1" }
10763
10905
  };
10764
10906
  }
10765
- var import_node_fs27, import_node_os8, import_node_path29, AGENT_RUNNER_MAX_OLD_SPACE_MB, MAX_OLD_SPACE_FLAG, PREFERRED_LTS_MAJORS;
10907
+ var import_node_fs28, import_node_os8, import_node_path30, AGENT_RUNNER_MAX_OLD_SPACE_MB, MAX_OLD_SPACE_FLAG, PREFERRED_LTS_MAJORS;
10766
10908
  var init_node_launch = __esm({
10767
10909
  "src/agents/node-launch.ts"() {
10768
10910
  "use strict";
10769
- import_node_fs27 = require("fs");
10911
+ import_node_fs28 = require("fs");
10770
10912
  import_node_os8 = require("os");
10771
- import_node_path29 = require("path");
10913
+ import_node_path30 = require("path");
10772
10914
  init_nested_electron_env();
10915
+ init_system_ca();
10773
10916
  init_run();
10774
10917
  init_packaged_runtime();
10775
10918
  AGENT_RUNNER_MAX_OLD_SPACE_MB = 8192;
@@ -10869,37 +11012,37 @@ function corePackageDir() {
10869
11012
  try {
10870
11013
  const url = import_meta.url;
10871
11014
  if (typeof url === "string" && url.length > 0) {
10872
- return (0, import_node_path30.dirname)((0, import_node_url.fileURLToPath)(url));
11015
+ return (0, import_node_path31.dirname)((0, import_node_url.fileURLToPath)(url));
10873
11016
  }
10874
11017
  } catch {
10875
11018
  }
10876
11019
  try {
10877
- const req = (0, import_node_module.createRequire)((0, import_node_path30.join)(process.cwd(), "package.json"));
10878
- return (0, import_node_path30.dirname)(req.resolve("@sideboard-ai/core"));
11020
+ const req = (0, import_node_module.createRequire)((0, import_node_path31.join)(process.cwd(), "package.json"));
11021
+ return (0, import_node_path31.dirname)(req.resolve("@sideboard-ai/core"));
10879
11022
  } catch {
10880
11023
  return process.cwd();
10881
11024
  }
10882
11025
  }
10883
11026
  function findSideboardMcpJsEntry() {
10884
11027
  const override = process.env.SIDEBOARD_MCP_ENTRY?.trim() || process.env.SIDEBOARD_CLI?.trim();
10885
- if (override && (0, import_node_fs28.existsSync)(override)) return override;
11028
+ if (override && (0, import_node_fs29.existsSync)(override)) return override;
10886
11029
  const packaged = packagedMcpStdioPath();
10887
11030
  if (packaged) return packaged;
10888
11031
  let dir = corePackageDir();
10889
11032
  for (let i = 0; i < 10; i++) {
10890
11033
  const candidates = [
10891
- (0, import_node_path30.join)(dir, "mcp/run-stdio.js"),
10892
- (0, import_node_path30.join)(dir, "mcp/run-stdio.cjs"),
10893
- (0, import_node_path30.join)(dir, "dist/mcp/run-stdio.js"),
10894
- (0, import_node_path30.join)(dir, "dist/mcp/run-stdio.cjs"),
10895
- (0, import_node_path30.join)(dir, "packages/core/dist/mcp/run-stdio.js"),
10896
- (0, import_node_path30.join)(dir, "packages/cli/dist/index.js"),
10897
- (0, import_node_path30.join)(dir, "cli/dist/index.js")
11034
+ (0, import_node_path31.join)(dir, "mcp/run-stdio.js"),
11035
+ (0, import_node_path31.join)(dir, "mcp/run-stdio.cjs"),
11036
+ (0, import_node_path31.join)(dir, "dist/mcp/run-stdio.js"),
11037
+ (0, import_node_path31.join)(dir, "dist/mcp/run-stdio.cjs"),
11038
+ (0, import_node_path31.join)(dir, "packages/core/dist/mcp/run-stdio.js"),
11039
+ (0, import_node_path31.join)(dir, "packages/cli/dist/index.js"),
11040
+ (0, import_node_path31.join)(dir, "cli/dist/index.js")
10898
11041
  ];
10899
11042
  for (const p of candidates) {
10900
- if ((0, import_node_fs28.existsSync)(p) && !isAsarPath(p)) return p;
11043
+ if ((0, import_node_fs29.existsSync)(p) && !isAsarPath(p)) return p;
10901
11044
  }
10902
- const parent = (0, import_node_path30.dirname)(dir);
11045
+ const parent = (0, import_node_path31.dirname)(dir);
10903
11046
  if (parent === dir) break;
10904
11047
  dir = parent;
10905
11048
  }
@@ -11046,22 +11189,22 @@ function writeMcpServersConfig(servers) {
11046
11189
  ...env ? { env } : {}
11047
11190
  };
11048
11191
  }
11049
- const dir = (0, import_node_fs28.mkdtempSync)((0, import_node_path30.join)((0, import_node_os9.tmpdir)(), "sideboard-mcp-"));
11050
- const cfgPath = (0, import_node_path30.join)(dir, "mcp.json");
11051
- (0, import_node_fs28.writeFileSync)(cfgPath, JSON.stringify({ mcpServers }, null, 2));
11192
+ const dir = (0, import_node_fs29.mkdtempSync)((0, import_node_path31.join)((0, import_node_os9.tmpdir)(), "sideboard-mcp-"));
11193
+ const cfgPath = (0, import_node_path31.join)(dir, "mcp.json");
11194
+ (0, import_node_fs29.writeFileSync)(cfgPath, JSON.stringify({ mcpServers }, null, 2));
11052
11195
  return cfgPath;
11053
11196
  }
11054
11197
  async function writeInjectedMcpConfig(opts) {
11055
11198
  return writeMcpServersConfig(await buildInjectedMcpServers(opts));
11056
11199
  }
11057
- var import_node_fs28, import_node_module, import_node_os9, import_node_path30, import_node_url, import_meta, SIDEBOARD_MCP_ALLOWED_TOOLS, SIDEBOARD_ARTIFACT_MCP_ALLOWED_TOOLS, SIDEBOARD_GITHUB_MCP_ALLOWED_TOOLS, SIDEBOARD_LINEAR_MCP_ALLOWED_TOOLS, SIDEBOARD_ABLETIME_MCP_ALLOWED_TOOLS, BRIGHTSY_MCP_ALLOWED_TOOLS, brightsyMcpCommandCache, BRIGHTSY_WORD;
11200
+ var import_node_fs29, import_node_module, import_node_os9, import_node_path31, import_node_url, import_meta, SIDEBOARD_MCP_ALLOWED_TOOLS, SIDEBOARD_ARTIFACT_MCP_ALLOWED_TOOLS, SIDEBOARD_GITHUB_MCP_ALLOWED_TOOLS, SIDEBOARD_LINEAR_MCP_ALLOWED_TOOLS, SIDEBOARD_ABLETIME_MCP_ALLOWED_TOOLS, BRIGHTSY_MCP_ALLOWED_TOOLS, brightsyMcpCommandCache, BRIGHTSY_WORD;
11058
11201
  var init_injected_mcp = __esm({
11059
11202
  "src/agents/injected-mcp.ts"() {
11060
11203
  "use strict";
11061
- import_node_fs28 = require("fs");
11204
+ import_node_fs29 = require("fs");
11062
11205
  import_node_module = require("module");
11063
11206
  import_node_os9 = require("os");
11064
- import_node_path30 = require("path");
11207
+ import_node_path31 = require("path");
11065
11208
  import_node_url = require("url");
11066
11209
  init_run();
11067
11210
  init_config();
@@ -11448,11 +11591,11 @@ function parseIssuesJson(raw) {
11448
11591
  }
11449
11592
  return [];
11450
11593
  }
11451
- var import_node_fs29, BASE_ALLOWED_TOOLS, CLAUDE_PRINT_BG_WAIT_CEILING_MS, CLAUDE_CHROME_ALLOWED_TOOLS, CLAUDE_PROMPT_ARG_MAX, mcpListCache, claudeAdapter;
11594
+ var import_node_fs30, BASE_ALLOWED_TOOLS, CLAUDE_PRINT_BG_WAIT_CEILING_MS, CLAUDE_CHROME_ALLOWED_TOOLS, CLAUDE_PROMPT_ARG_MAX, mcpListCache, claudeAdapter;
11452
11595
  var init_claude = __esm({
11453
11596
  "src/agents/claude.ts"() {
11454
11597
  "use strict";
11455
- import_node_fs29 = require("fs");
11598
+ import_node_fs30 = require("fs");
11456
11599
  init_run();
11457
11600
  init_app_settings();
11458
11601
  init_claude_mcp();
@@ -11492,7 +11635,7 @@ var init_claude = __esm({
11492
11635
  async detect() {
11493
11636
  const claude = resolveClaudeExecutable();
11494
11637
  if (claude !== "claude") {
11495
- if (!(0, import_node_fs29.existsSync)(claude)) {
11638
+ if (!(0, import_node_fs30.existsSync)(claude)) {
11496
11639
  return {
11497
11640
  agent: "claude",
11498
11641
  installed: false,
@@ -11752,10 +11895,10 @@ var init_claude = __esm({
11752
11895
 
11753
11896
  // src/agents/user-mcp-config.ts
11754
11897
  function userCursorMcpConfigPath() {
11755
- return (0, import_node_path31.join)((0, import_node_os10.homedir)(), ".cursor", "mcp.json");
11898
+ return (0, import_node_path32.join)((0, import_node_os10.homedir)(), ".cursor", "mcp.json");
11756
11899
  }
11757
11900
  function userClaudeMcpConfigPath() {
11758
- return (0, import_node_path31.join)((0, import_node_os10.homedir)(), ".claude.json");
11901
+ return (0, import_node_path32.join)((0, import_node_os10.homedir)(), ".claude.json");
11759
11902
  }
11760
11903
  function asObject(value) {
11761
11904
  if (!value || typeof value !== "object" || Array.isArray(value)) return {};
@@ -11782,16 +11925,16 @@ function mergeSideboardIntoMcpServersJson(existing, sideboard) {
11782
11925
  }
11783
11926
  function writeMergedMcpServersJson(configPath, sideboard) {
11784
11927
  let existing = {};
11785
- if ((0, import_node_fs30.existsSync)(configPath)) {
11928
+ if ((0, import_node_fs31.existsSync)(configPath)) {
11786
11929
  try {
11787
- existing = JSON.parse((0, import_node_fs30.readFileSync)(configPath, "utf8"));
11930
+ existing = JSON.parse((0, import_node_fs31.readFileSync)(configPath, "utf8"));
11788
11931
  } catch {
11789
11932
  existing = {};
11790
11933
  }
11791
11934
  }
11792
11935
  const next = mergeSideboardIntoMcpServersJson(existing, sideboard);
11793
- (0, import_node_fs30.mkdirSync)((0, import_node_path31.dirname)(configPath), { recursive: true });
11794
- (0, import_node_fs30.writeFileSync)(configPath, `${JSON.stringify(next, null, 2)}
11936
+ (0, import_node_fs31.mkdirSync)((0, import_node_path32.dirname)(configPath), { recursive: true });
11937
+ (0, import_node_fs31.writeFileSync)(configPath, `${JSON.stringify(next, null, 2)}
11795
11938
  `);
11796
11939
  }
11797
11940
  function launchFromResolved(server) {
@@ -11809,19 +11952,19 @@ async function registerPackagedUserMcpClients() {
11809
11952
  const cursor = userCursorMcpConfigPath();
11810
11953
  writeMergedMcpServersJson(cursor, launch);
11811
11954
  const claude = userClaudeMcpConfigPath();
11812
- if ((0, import_node_fs30.existsSync)(claude)) {
11955
+ if ((0, import_node_fs31.existsSync)(claude)) {
11813
11956
  writeMergedMcpServersJson(claude, launch);
11814
11957
  return { cursor, claude };
11815
11958
  }
11816
11959
  return { cursor };
11817
11960
  }
11818
- var import_node_fs30, import_node_os10, import_node_path31;
11961
+ var import_node_fs31, import_node_os10, import_node_path32;
11819
11962
  var init_user_mcp_config = __esm({
11820
11963
  "src/agents/user-mcp-config.ts"() {
11821
11964
  "use strict";
11822
- import_node_fs30 = require("fs");
11965
+ import_node_fs31 = require("fs");
11823
11966
  import_node_os10 = require("os");
11824
- import_node_path31 = require("path");
11967
+ import_node_path32 = require("path");
11825
11968
  init_paths();
11826
11969
  init_injected_mcp();
11827
11970
  }
@@ -11849,25 +11992,25 @@ function listMcpNamesFromCodexToml(text7) {
11849
11992
  }
11850
11993
  function readJsonObject(path2) {
11851
11994
  try {
11852
- return JSON.parse((0, import_node_fs31.readFileSync)(path2, "utf8"));
11995
+ return JSON.parse((0, import_node_fs32.readFileSync)(path2, "utf8"));
11853
11996
  } catch {
11854
11997
  return {};
11855
11998
  }
11856
11999
  }
11857
12000
  function readText(path2) {
11858
12001
  try {
11859
- return (0, import_node_fs31.readFileSync)(path2, "utf8");
12002
+ return (0, import_node_fs32.readFileSync)(path2, "utf8");
11860
12003
  } catch {
11861
12004
  return "";
11862
12005
  }
11863
12006
  }
11864
12007
  function userCodexConfigPaths(home = (0, import_node_os11.homedir)()) {
11865
- return [(0, import_node_path32.join)(home, ".codex", "config.toml"), (0, import_node_path32.join)(home, ".config", "codex", "config.toml")];
12008
+ return [(0, import_node_path33.join)(home, ".codex", "config.toml"), (0, import_node_path33.join)(home, ".config", "codex", "config.toml")];
11866
12009
  }
11867
12010
  function userOpencodeConfigPaths(home = (0, import_node_os11.homedir)()) {
11868
12011
  return [
11869
- (0, import_node_path32.join)(home, ".config", "opencode", "opencode.json"),
11870
- (0, import_node_path32.join)(home, ".config", "opencode", "opencode.jsonc")
12012
+ (0, import_node_path33.join)(home, ".config", "opencode", "opencode.json"),
12013
+ (0, import_node_path33.join)(home, ".config", "opencode", "opencode.jsonc")
11871
12014
  ];
11872
12015
  }
11873
12016
  function userMcpNamesToDisable(opts) {
@@ -11889,7 +12032,7 @@ function userMcpNamesToDisable(opts) {
11889
12032
  function listUserCodexMcpNames(home = (0, import_node_os11.homedir)()) {
11890
12033
  const names = [];
11891
12034
  for (const path2 of userCodexConfigPaths(home)) {
11892
- if (!(0, import_node_fs31.existsSync)(path2)) continue;
12035
+ if (!(0, import_node_fs32.existsSync)(path2)) continue;
11893
12036
  names.push(...listMcpNamesFromCodexToml(readText(path2)));
11894
12037
  }
11895
12038
  return names;
@@ -11897,7 +12040,7 @@ function listUserCodexMcpNames(home = (0, import_node_os11.homedir)()) {
11897
12040
  function listUserOpencodeMcpNames(home = (0, import_node_os11.homedir)()) {
11898
12041
  const names = [];
11899
12042
  for (const path2 of userOpencodeConfigPaths(home)) {
11900
- if (!(0, import_node_fs31.existsSync)(path2)) continue;
12043
+ if (!(0, import_node_fs32.existsSync)(path2)) continue;
11901
12044
  names.push(...listMcpNamesFromJsonMap(readJsonObject(path2), "mcp"));
11902
12045
  }
11903
12046
  return names;
@@ -11910,13 +12053,13 @@ function toCodexDisableUserMcpArgs(names) {
11910
12053
  }
11911
12054
  return args;
11912
12055
  }
11913
- var import_node_fs31, import_node_os11, import_node_path32, import_smol_toml2;
12056
+ var import_node_fs32, import_node_os11, import_node_path33, import_smol_toml2;
11914
12057
  var init_orch_mcp_isolation = __esm({
11915
12058
  "src/agents/orch-mcp-isolation.ts"() {
11916
12059
  "use strict";
11917
- import_node_fs31 = require("fs");
12060
+ import_node_fs32 = require("fs");
11918
12061
  import_node_os11 = require("os");
11919
- import_node_path32 = require("path");
12062
+ import_node_path33 = require("path");
11920
12063
  import_smol_toml2 = require("smol-toml");
11921
12064
  init_user_mcp_config();
11922
12065
  }
@@ -11932,7 +12075,7 @@ async function listCodexModels() {
11932
12075
  if (codex === "codex") {
11933
12076
  const which = await run("which", ["codex"], { reject: false });
11934
12077
  if (which.exitCode !== 0) return FALLBACK_CODEX_MODELS;
11935
- } else if (!(0, import_node_fs32.existsSync)(codex)) {
12078
+ } else if (!(0, import_node_fs33.existsSync)(codex)) {
11936
12079
  return FALLBACK_CODEX_MODELS;
11937
12080
  }
11938
12081
  const listed = await run(codex, ["debug", "models"], { reject: false });
@@ -11967,12 +12110,12 @@ function usageFromCodex(usage) {
11967
12110
  }
11968
12111
  function codexConfigHasNetworkAccess() {
11969
12112
  const candidates = [
11970
- (0, import_node_path33.join)((0, import_node_os12.homedir)(), ".codex", "config.toml"),
11971
- (0, import_node_path33.join)((0, import_node_os12.homedir)(), ".config", "codex", "config.toml")
12113
+ (0, import_node_path34.join)((0, import_node_os12.homedir)(), ".codex", "config.toml"),
12114
+ (0, import_node_path34.join)((0, import_node_os12.homedir)(), ".config", "codex", "config.toml")
11972
12115
  ];
11973
12116
  for (const path2 of candidates) {
11974
- if (!(0, import_node_fs32.existsSync)(path2)) continue;
11975
- const text7 = (0, import_node_fs32.readFileSync)(path2, "utf8");
12117
+ if (!(0, import_node_fs33.existsSync)(path2)) continue;
12118
+ const text7 = (0, import_node_fs33.readFileSync)(path2, "utf8");
11976
12119
  if (/network_access\s*=\s*true/.test(text7)) return true;
11977
12120
  }
11978
12121
  return false;
@@ -12004,21 +12147,21 @@ function asRecord2(value) {
12004
12147
  return void 0;
12005
12148
  }
12006
12149
  function codexLooksAuthenticated() {
12007
- const authPath = (0, import_node_path33.join)((0, import_node_os12.homedir)(), ".codex", "auth.json");
12008
- if (!(0, import_node_fs32.existsSync)(authPath)) return false;
12150
+ const authPath = (0, import_node_path34.join)((0, import_node_os12.homedir)(), ".codex", "auth.json");
12151
+ if (!(0, import_node_fs33.existsSync)(authPath)) return false;
12009
12152
  try {
12010
- return (0, import_node_fs32.statSync)(authPath).size > 2;
12153
+ return (0, import_node_fs33.statSync)(authPath).size > 2;
12011
12154
  } catch {
12012
12155
  return false;
12013
12156
  }
12014
12157
  }
12015
- var import_node_fs32, import_node_os12, import_node_path33, CODEX_PROMPT_ARG_MAX, FALLBACK_CODEX_MODELS, cachedCodexModels, CODEX_MODEL_CACHE_MS, codexAdapter;
12158
+ var import_node_fs33, import_node_os12, import_node_path34, CODEX_PROMPT_ARG_MAX, FALLBACK_CODEX_MODELS, cachedCodexModels, CODEX_MODEL_CACHE_MS, codexAdapter;
12016
12159
  var init_codex = __esm({
12017
12160
  "src/agents/codex.ts"() {
12018
12161
  "use strict";
12019
- import_node_fs32 = require("fs");
12162
+ import_node_fs33 = require("fs");
12020
12163
  import_node_os12 = require("os");
12021
- import_node_path33 = require("path");
12164
+ import_node_path34 = require("path");
12022
12165
  init_run();
12023
12166
  init_app_settings();
12024
12167
  init_global_workspace();
@@ -12044,7 +12187,7 @@ var init_codex = __esm({
12044
12187
  async detect() {
12045
12188
  const codex = resolveAgentExecutable("codex");
12046
12189
  if (codex !== "codex") {
12047
- if (!(0, import_node_fs32.existsSync)(codex)) {
12190
+ if (!(0, import_node_fs33.existsSync)(codex)) {
12048
12191
  return {
12049
12192
  agent: "codex",
12050
12193
  installed: false,
@@ -12539,21 +12682,21 @@ function platformRipgrepPackage() {
12539
12682
  }
12540
12683
  function usableRipgrepPath(candidate) {
12541
12684
  const raw = candidate?.trim();
12542
- if (!raw || !(0, import_node_path34.isAbsolute)(raw)) return null;
12685
+ if (!raw || !(0, import_node_path35.isAbsolute)(raw)) return null;
12543
12686
  const readable = nodeReadableScriptPath(raw);
12544
- if (!(0, import_node_fs33.existsSync)(readable) || isAsarPath(readable)) return null;
12687
+ if (!(0, import_node_fs34.existsSync)(readable) || isAsarPath(readable)) return null;
12545
12688
  return readable;
12546
12689
  }
12547
12690
  function walkForBundledRipgrep(startFile) {
12548
12691
  if (!startFile) return null;
12549
12692
  const pkg = platformRipgrepPackage();
12550
12693
  const name = rgBinaryName();
12551
- let dir = (0, import_node_path34.dirname)((0, import_node_path34.resolve)(startFile));
12552
- const root = (0, import_node_path34.parse)(dir).root;
12694
+ let dir = (0, import_node_path35.dirname)((0, import_node_path35.resolve)(startFile));
12695
+ const root = (0, import_node_path35.parse)(dir).root;
12553
12696
  while (dir !== root) {
12554
- const hit = usableRipgrepPath((0, import_node_path34.join)(dir, "node_modules", pkg, "bin", name));
12697
+ const hit = usableRipgrepPath((0, import_node_path35.join)(dir, "node_modules", pkg, "bin", name));
12555
12698
  if (hit) return hit;
12556
- const next = (0, import_node_path34.dirname)(dir);
12699
+ const next = (0, import_node_path35.dirname)(dir);
12557
12700
  if (next === dir) break;
12558
12701
  dir = next;
12559
12702
  }
@@ -12563,7 +12706,7 @@ function requireResolveBundledRipgrep(fromFile) {
12563
12706
  try {
12564
12707
  const req = (0, import_node_module2.createRequire)(fromFile);
12565
12708
  const pkgJson = req.resolve(`${platformRipgrepPackage()}/package.json`);
12566
- return usableRipgrepPath((0, import_node_path34.join)((0, import_node_path34.dirname)(pkgJson), "bin", rgBinaryName()));
12709
+ return usableRipgrepPath((0, import_node_path35.join)((0, import_node_path35.dirname)(pkgJson), "bin", rgBinaryName()));
12567
12710
  } catch {
12568
12711
  return null;
12569
12712
  }
@@ -12585,13 +12728,13 @@ function cursorRipgrepEnv(opts) {
12585
12728
  const path2 = resolveCursorRipgrepPath(opts);
12586
12729
  return path2 ? { [RIPGREP_ENV]: path2 } : {};
12587
12730
  }
12588
- var import_node_fs33, import_node_module2, import_node_path34, RIPGREP_ENV;
12731
+ var import_node_fs34, import_node_module2, import_node_path35, RIPGREP_ENV;
12589
12732
  var init_cursor_ripgrep = __esm({
12590
12733
  "src/agents/cursor-ripgrep.ts"() {
12591
12734
  "use strict";
12592
- import_node_fs33 = require("fs");
12735
+ import_node_fs34 = require("fs");
12593
12736
  import_node_module2 = require("module");
12594
- import_node_path34 = require("path");
12737
+ import_node_path35 = require("path");
12595
12738
  init_node_launch();
12596
12739
  init_packaged_runtime();
12597
12740
  RIPGREP_ENV = "CURSOR_RIPGREP_PATH";
@@ -12637,11 +12780,11 @@ function entryDir() {
12637
12780
  const cjsDir = typeof __dirname !== "undefined" ? __dirname : "";
12638
12781
  if (cjsDir) return cjsDir;
12639
12782
  try {
12640
- return (0, import_node_path35.dirname)((0, import_node_url2.fileURLToPath)(import_meta2.url));
12783
+ return (0, import_node_path36.dirname)((0, import_node_url2.fileURLToPath)(import_meta2.url));
12641
12784
  } catch {
12642
12785
  try {
12643
12786
  const req = (0, import_node_module3.createRequire)(process.cwd() + "/");
12644
- return (0, import_node_path35.dirname)(req.resolve("@sideboard-ai/core"));
12787
+ return (0, import_node_path36.dirname)(req.resolve("@sideboard-ai/core"));
12645
12788
  } catch {
12646
12789
  return process.cwd();
12647
12790
  }
@@ -12652,27 +12795,27 @@ function cursorRunnerPath() {
12652
12795
  if (packaged) return packaged;
12653
12796
  const root = entryDir();
12654
12797
  const candidates = [
12655
- (0, import_node_path35.join)(root, "agents", "cursor-runner.js"),
12656
- (0, import_node_path35.join)(root, "agents", "cursor-runner.cjs"),
12798
+ (0, import_node_path36.join)(root, "agents", "cursor-runner.js"),
12799
+ (0, import_node_path36.join)(root, "agents", "cursor-runner.cjs"),
12657
12800
  // If somehow resolved from package root instead of dist/
12658
- (0, import_node_path35.join)(root, "dist", "agents", "cursor-runner.js"),
12659
- (0, import_node_path35.join)(root, "dist", "agents", "cursor-runner.cjs"),
12801
+ (0, import_node_path36.join)(root, "dist", "agents", "cursor-runner.js"),
12802
+ (0, import_node_path36.join)(root, "dist", "agents", "cursor-runner.cjs"),
12660
12803
  // Source tree (dev): packages/core/src/agents/cursor-runner.ts
12661
- (0, import_node_path35.join)(root, "cursor-runner.ts"),
12662
- (0, import_node_path35.join)(root, "src", "agents", "cursor-runner.ts")
12804
+ (0, import_node_path36.join)(root, "cursor-runner.ts"),
12805
+ (0, import_node_path36.join)(root, "src", "agents", "cursor-runner.ts")
12663
12806
  ];
12664
12807
  for (const candidate of candidates) {
12665
- if ((0, import_node_fs34.existsSync)(candidate)) return candidate;
12808
+ if ((0, import_node_fs35.existsSync)(candidate)) return candidate;
12666
12809
  }
12667
12810
  return candidates[0];
12668
12811
  }
12669
- var import_node_fs34, import_node_module3, import_node_path35, import_node_url2, import_sdk, import_meta2, FALLBACK_CURSOR_MODELS, cachedModels, MODEL_CACHE_MS, cursorAdapter;
12812
+ var import_node_fs35, import_node_module3, import_node_path36, import_node_url2, import_sdk, import_meta2, FALLBACK_CURSOR_MODELS, cachedModels, MODEL_CACHE_MS, cursorAdapter;
12670
12813
  var init_cursor = __esm({
12671
12814
  "src/agents/cursor.ts"() {
12672
12815
  "use strict";
12673
- import_node_fs34 = require("fs");
12816
+ import_node_fs35 = require("fs");
12674
12817
  import_node_module3 = require("module");
12675
- import_node_path35 = require("path");
12818
+ import_node_path36 = require("path");
12676
12819
  import_node_url2 = require("url");
12677
12820
  import_sdk = require("@cursor/sdk");
12678
12821
  init_run();
@@ -12824,7 +12967,7 @@ async function listOpencodeModels() {
12824
12967
  if (opencode === "opencode") {
12825
12968
  const which = await run("which", ["opencode"], { reject: false });
12826
12969
  if (which.exitCode !== 0) return FALLBACK_OPENCODE_MODELS;
12827
- } else if (!(0, import_node_fs35.existsSync)(opencode)) {
12970
+ } else if (!(0, import_node_fs36.existsSync)(opencode)) {
12828
12971
  return FALLBACK_OPENCODE_MODELS;
12829
12972
  }
12830
12973
  const listed = await run(opencode, ["models"], { reject: false });
@@ -12854,11 +12997,11 @@ function usageFromOpencode(tokens) {
12854
12997
  cacheWriteTokens: tokens.cache?.write ? Number(tokens.cache.write) : void 0
12855
12998
  };
12856
12999
  }
12857
- var import_node_fs35, FALLBACK_OPENCODE_MODELS, cachedOpencodeModels, OPENCODE_MODEL_CACHE_MS, opencodeAdapter;
13000
+ var import_node_fs36, FALLBACK_OPENCODE_MODELS, cachedOpencodeModels, OPENCODE_MODEL_CACHE_MS, opencodeAdapter;
12858
13001
  var init_opencode = __esm({
12859
13002
  "src/agents/opencode.ts"() {
12860
13003
  "use strict";
12861
- import_node_fs35 = require("fs");
13004
+ import_node_fs36 = require("fs");
12862
13005
  init_run();
12863
13006
  init_app_settings();
12864
13007
  init_global_workspace();
@@ -12886,7 +13029,7 @@ var init_opencode = __esm({
12886
13029
  async detect() {
12887
13030
  const opencode = resolveAgentExecutable("opencode");
12888
13031
  if (opencode !== "opencode") {
12889
- if (!(0, import_node_fs35.existsSync)(opencode)) {
13032
+ if (!(0, import_node_fs36.existsSync)(opencode)) {
12890
13033
  return {
12891
13034
  agent: "opencode",
12892
13035
  installed: false,
@@ -13695,15 +13838,15 @@ var init_agents = __esm({
13695
13838
 
13696
13839
  // src/hook/worktree-pkg-cache.ts
13697
13840
  function worktreePkgCacheRoot(worktreePath) {
13698
- return (0, import_node_path36.join)(worktreePath, WORKTREE_PKG_CACHE_REL);
13841
+ return (0, import_node_path37.join)(worktreePath, WORKTREE_PKG_CACHE_REL);
13699
13842
  }
13700
13843
  function worktreePkgCacheEnv(worktreePath) {
13701
13844
  const root = worktreePkgCacheRoot(worktreePath);
13702
- const store = (0, import_node_path36.join)(root, "pnpm-store");
13703
- const pnpmCache = (0, import_node_path36.join)(root, "pnpm");
13704
- const npmCache = (0, import_node_path36.join)(root, "npm");
13705
- const nodeGyp = (0, import_node_path36.join)(root, "node-gyp");
13706
- const electron = (0, import_node_path36.join)(root, "electron");
13845
+ const store = (0, import_node_path37.join)(root, "pnpm-store");
13846
+ const pnpmCache = (0, import_node_path37.join)(root, "pnpm");
13847
+ const npmCache = (0, import_node_path37.join)(root, "npm");
13848
+ const nodeGyp = (0, import_node_path37.join)(root, "node-gyp");
13849
+ const electron = (0, import_node_path37.join)(root, "electron");
13707
13850
  return {
13708
13851
  npm_config_store_dir: store,
13709
13852
  PNPM_STORE_DIR: store,
@@ -13725,8 +13868,8 @@ function fillGroup(env, keys, values) {
13725
13868
  }
13726
13869
  }
13727
13870
  function ensureWorktreePkgCacheDirs(worktreePath) {
13728
- if (!(0, import_node_fs36.existsSync)(worktreePath)) return;
13729
- (0, import_node_fs36.mkdirSync)(worktreePkgCacheRoot(worktreePath), { recursive: true });
13871
+ if (!(0, import_node_fs37.existsSync)(worktreePath)) return;
13872
+ (0, import_node_fs37.mkdirSync)(worktreePkgCacheRoot(worktreePath), { recursive: true });
13730
13873
  }
13731
13874
  function applyWorktreePkgCacheEnv(env, worktreePath) {
13732
13875
  const cwd = worktreePath.trim();
@@ -13739,12 +13882,12 @@ function applyWorktreePkgCacheEnv(env, worktreePath) {
13739
13882
  fillGroup(env, ["electron_config_cache"], next);
13740
13883
  ensureWorktreePkgCacheDirs(cwd);
13741
13884
  }
13742
- var import_node_fs36, import_node_path36, WORKTREE_PKG_CACHE_REL;
13885
+ var import_node_fs37, import_node_path37, WORKTREE_PKG_CACHE_REL;
13743
13886
  var init_worktree_pkg_cache = __esm({
13744
13887
  "src/hook/worktree-pkg-cache.ts"() {
13745
13888
  "use strict";
13746
- import_node_fs36 = require("fs");
13747
- import_node_path36 = require("path");
13889
+ import_node_fs37 = require("fs");
13890
+ import_node_path37 = require("path");
13748
13891
  WORKTREE_PKG_CACHE_REL = ".context/.sideboard/pkg-cache";
13749
13892
  }
13750
13893
  });
@@ -14892,21 +15035,21 @@ function shouldRefreshReviewRequestTemplate(content) {
14892
15035
  return LEGACY_REVIEW_TEMPLATE_MARKERS.every((m) => trimmed.includes(m));
14893
15036
  }
14894
15037
  function readTextIfPresent(abs) {
14895
- if (!(0, import_node_fs37.existsSync)(abs)) return null;
15038
+ if (!(0, import_node_fs38.existsSync)(abs)) return null;
14896
15039
  try {
14897
- const content = (0, import_node_fs37.readFileSync)(abs, "utf8");
15040
+ const content = (0, import_node_fs38.readFileSync)(abs, "utf8");
14898
15041
  return content.trim() ? content : null;
14899
15042
  } catch {
14900
15043
  return null;
14901
15044
  }
14902
15045
  }
14903
15046
  function readLocalGuidelines(worktreePath) {
14904
- const localAbs = (0, import_node_path37.join)(worktreePath, REVIEW_REQUEST_PATH);
15047
+ const localAbs = (0, import_node_path38.join)(worktreePath, REVIEW_REQUEST_PATH);
14905
15048
  const localContent = readTextIfPresent(localAbs);
14906
15049
  if (localContent && !shouldRefreshReviewRequestTemplate(localContent)) {
14907
15050
  return { path: REVIEW_REQUEST_PATH, content: localContent };
14908
15051
  }
14909
- const legacyAbs = (0, import_node_path37.join)(worktreePath, LEGACY_REVIEW_REQUEST_PATH);
15052
+ const legacyAbs = (0, import_node_path38.join)(worktreePath, LEGACY_REVIEW_REQUEST_PATH);
14910
15053
  const legacyContent = readTextIfPresent(legacyAbs);
14911
15054
  if (legacyContent && !shouldRefreshReviewRequestTemplate(legacyContent)) {
14912
15055
  return { path: LEGACY_REVIEW_REQUEST_PATH, content: legacyContent };
@@ -14930,27 +15073,27 @@ function contextGuidelines(content, source) {
14930
15073
  };
14931
15074
  }
14932
15075
  function writeContextGuidelines(worktreePath, content) {
14933
- const abs = (0, import_node_path37.join)(worktreePath, CONTEXT_REVIEW_PATH);
14934
- (0, import_node_fs37.mkdirSync)((0, import_node_path37.dirname)(abs), { recursive: true });
15076
+ const abs = (0, import_node_path38.join)(worktreePath, CONTEXT_REVIEW_PATH);
15077
+ (0, import_node_fs38.mkdirSync)((0, import_node_path38.dirname)(abs), { recursive: true });
14935
15078
  const body = content.endsWith("\n") ? content : `${content}
14936
15079
  `;
14937
- (0, import_node_fs37.writeFileSync)(abs, body, "utf8");
15080
+ (0, import_node_fs38.writeFileSync)(abs, body, "utf8");
14938
15081
  return body;
14939
15082
  }
14940
15083
  function readSideboardReview(worktreePath, repoPath) {
14941
- const fromWorktree = readTextIfPresent((0, import_node_path37.join)(worktreePath, REPO_REVIEW_PATH));
15084
+ const fromWorktree = readTextIfPresent((0, import_node_path38.join)(worktreePath, REPO_REVIEW_PATH));
14942
15085
  if (fromWorktree) return fromWorktree;
14943
15086
  const repo = repoPath?.replace(/\/+$/, "");
14944
15087
  const wt = worktreePath.replace(/\/+$/, "");
14945
15088
  if (!repo || repo === wt) return null;
14946
- return readTextIfPresent((0, import_node_path37.join)(repo, REPO_REVIEW_PATH));
15089
+ return readTextIfPresent((0, import_node_path38.join)(repo, REPO_REVIEW_PATH));
14947
15090
  }
14948
15091
  function ensureReviewGuidelinesFile(worktreePath, repoPath) {
14949
- const skillContent = readTextIfPresent((0, import_node_path37.join)(worktreePath, REVIEW_SKILL_PATH));
15092
+ const skillContent = readTextIfPresent((0, import_node_path38.join)(worktreePath, REVIEW_SKILL_PATH));
14950
15093
  if (skillContent) {
14951
15094
  return { ...skillGuidelines(skillContent, "skill"), wrote: false };
14952
15095
  }
14953
- const contextContent = readTextIfPresent((0, import_node_path37.join)(worktreePath, CONTEXT_REVIEW_PATH));
15096
+ const contextContent = readTextIfPresent((0, import_node_path38.join)(worktreePath, CONTEXT_REVIEW_PATH));
14954
15097
  if (contextContent && !shouldRefreshReviewRequestTemplate(contextContent)) {
14955
15098
  return { ...contextGuidelines(contextContent, "local"), wrote: false };
14956
15099
  }
@@ -14988,7 +15131,7 @@ function buildReviewRequestAttachment(content, opts) {
14988
15131
  };
14989
15132
  }
14990
15133
  function readExistingReviewRequestFile(worktreePath) {
14991
- return readTextIfPresent((0, import_node_path37.join)(worktreePath, REVIEW_SKILL_PATH)) ?? readTextIfPresent((0, import_node_path37.join)(worktreePath, CONTEXT_REVIEW_PATH)) ?? readTextIfPresent((0, import_node_path37.join)(worktreePath, REPO_REVIEW_PATH)) ?? readTextIfPresent((0, import_node_path37.join)(worktreePath, REVIEW_REQUEST_PATH)) ?? readTextIfPresent((0, import_node_path37.join)(worktreePath, LEGACY_REVIEW_REQUEST_PATH));
15134
+ return readTextIfPresent((0, import_node_path38.join)(worktreePath, REVIEW_SKILL_PATH)) ?? readTextIfPresent((0, import_node_path38.join)(worktreePath, CONTEXT_REVIEW_PATH)) ?? readTextIfPresent((0, import_node_path38.join)(worktreePath, REPO_REVIEW_PATH)) ?? readTextIfPresent((0, import_node_path38.join)(worktreePath, REVIEW_REQUEST_PATH)) ?? readTextIfPresent((0, import_node_path38.join)(worktreePath, LEGACY_REVIEW_REQUEST_PATH));
14992
15135
  }
14993
15136
  async function requestReview(threadRef, send2) {
14994
15137
  const from = findThreadByRef(threadRef);
@@ -15015,13 +15158,13 @@ async function requestReview(threadRef, send2) {
15015
15158
  const started = await send2(tab.id, REVIEW_REQUEST_PREFILL);
15016
15159
  return { tab: started, from };
15017
15160
  }
15018
- var import_node_crypto8, import_node_fs37, import_node_path37, REPO_REVIEW_PATH, REPO_REVIEW_NAME, CONTEXT_REVIEW_PATH, REVIEW_REQUEST_PATH, LEGACY_REVIEW_REQUEST_PATH, REVIEW_REQUEST_NAME, REVIEW_REQUEST_PREFILL, LEGACY_REVIEW_TEMPLATE_MARKERS;
15161
+ var import_node_crypto8, import_node_fs38, import_node_path38, REPO_REVIEW_PATH, REPO_REVIEW_NAME, CONTEXT_REVIEW_PATH, REVIEW_REQUEST_PATH, LEGACY_REVIEW_REQUEST_PATH, REVIEW_REQUEST_NAME, REVIEW_REQUEST_PREFILL, LEGACY_REVIEW_TEMPLATE_MARKERS;
15019
15162
  var init_request_review = __esm({
15020
15163
  "src/review/request-review.ts"() {
15021
15164
  "use strict";
15022
15165
  import_node_crypto8 = require("crypto");
15023
- import_node_fs37 = require("fs");
15024
- import_node_path37 = require("path");
15166
+ import_node_fs38 = require("fs");
15167
+ import_node_path38 = require("path");
15025
15168
  init_global_workspace();
15026
15169
  init_chat_tabs();
15027
15170
  init_thread_store();
@@ -15047,9 +15190,9 @@ function matchSimpleGlob(pattern, name) {
15047
15190
  return new RegExp(`^${escaped}$`).test(name);
15048
15191
  }
15049
15192
  function readWorktreeInclude(repoPath) {
15050
- const path2 = (0, import_node_path38.join)(repoPath, ".worktreeinclude");
15051
- if (!(0, import_node_fs38.existsSync)(path2)) return [];
15052
- return (0, import_node_fs38.readFileSync)(path2, "utf8").split("\n").map((l) => l.trim()).filter((l) => l && !l.startsWith("#"));
15193
+ const path2 = (0, import_node_path39.join)(repoPath, ".worktreeinclude");
15194
+ if (!(0, import_node_fs39.existsSync)(path2)) return [];
15195
+ return (0, import_node_fs39.readFileSync)(path2, "utf8").split("\n").map((l) => l.trim()).filter((l) => l && !l.startsWith("#"));
15053
15196
  }
15054
15197
  function resolveFilesToCopy(repoPath) {
15055
15198
  const fromInclude = readWorktreeInclude(repoPath);
@@ -15059,10 +15202,10 @@ function resolveFilesToCopy(repoPath) {
15059
15202
  if (settings?.fileIncludeGlobs?.length) {
15060
15203
  const matched = [];
15061
15204
  try {
15062
- for (const entry of (0, import_node_fs38.readdirSync)(repoPath, { withFileTypes: true })) {
15205
+ for (const entry of (0, import_node_fs39.readdirSync)(repoPath, { withFileTypes: true })) {
15063
15206
  if (!entry.isFile()) continue;
15064
15207
  for (const glob of settings.fileIncludeGlobs) {
15065
- if (matchSimpleGlob(glob, entry.name) || matchSimpleGlob((0, import_node_path38.basename)(glob), entry.name)) {
15208
+ if (matchSimpleGlob(glob, entry.name) || matchSimpleGlob((0, import_node_path39.basename)(glob), entry.name)) {
15066
15209
  matched.push(entry.name);
15067
15210
  break;
15068
15211
  }
@@ -15074,7 +15217,7 @@ function resolveFilesToCopy(repoPath) {
15074
15217
  }
15075
15218
  const defaults = [];
15076
15219
  try {
15077
- for (const entry of (0, import_node_fs38.readdirSync)(repoPath, { withFileTypes: true })) {
15220
+ for (const entry of (0, import_node_fs39.readdirSync)(repoPath, { withFileTypes: true })) {
15078
15221
  if (entry.isFile() && entry.name.startsWith(".env")) {
15079
15222
  defaults.push(entry.name);
15080
15223
  }
@@ -15088,11 +15231,11 @@ function copyConfiguredFiles(repoPath, worktreePath) {
15088
15231
  const patterns = resolveFilesToCopy(repoPath);
15089
15232
  const copied = [];
15090
15233
  for (const rel of patterns) {
15091
- const src = (0, import_node_path38.join)(repoPath, rel);
15092
- if (!(0, import_node_fs38.existsSync)(src)) continue;
15093
- const dest = (0, import_node_path38.join)(worktreePath, rel);
15094
- (0, import_node_fs38.mkdirSync)((0, import_node_path38.dirname)(dest), { recursive: true });
15095
- (0, import_node_fs38.copyFileSync)(src, dest);
15234
+ const src = (0, import_node_path39.join)(repoPath, rel);
15235
+ if (!(0, import_node_fs39.existsSync)(src)) continue;
15236
+ const dest = (0, import_node_path39.join)(worktreePath, rel);
15237
+ (0, import_node_fs39.mkdirSync)((0, import_node_path39.dirname)(dest), { recursive: true });
15238
+ (0, import_node_fs39.copyFileSync)(src, dest);
15096
15239
  copied.push(rel);
15097
15240
  }
15098
15241
  return copied;
@@ -15127,7 +15270,7 @@ function buildWorkspaceScriptEnv(opts, baseEnv) {
15127
15270
  const env = stripNestedElectronEnv({
15128
15271
  ...baseEnv ?? process.env
15129
15272
  });
15130
- const name = opts.workspaceName ?? (0, import_node_path38.basename)(opts.worktreePath);
15273
+ const name = opts.workspaceName ?? (0, import_node_path39.basename)(opts.worktreePath);
15131
15274
  const ports = opts.ports ?? [];
15132
15275
  const primary = ports[0];
15133
15276
  env.SIDEBOARD_WORKSPACE_NAME = name;
@@ -15390,13 +15533,13 @@ async function startDevServer(repoPath, worktreePath, onLine, opts) {
15390
15533
  done: handle.done
15391
15534
  };
15392
15535
  }
15393
- var import_node_fs38, import_node_net, import_node_path38, import_execa4, import_node_readline3, PORT_RANGE_SIZE, cachedLoginEnv;
15536
+ var import_node_fs39, import_node_net, import_node_path39, import_execa4, import_node_readline3, PORT_RANGE_SIZE, cachedLoginEnv;
15394
15537
  var init_conductor = __esm({
15395
15538
  "src/hook/conductor.ts"() {
15396
15539
  "use strict";
15397
- import_node_fs38 = require("fs");
15540
+ import_node_fs39 = require("fs");
15398
15541
  import_node_net = require("net");
15399
- import_node_path38 = require("path");
15542
+ import_node_path39 = require("path");
15400
15543
  import_execa4 = require("execa");
15401
15544
  import_node_readline3 = require("readline");
15402
15545
  init_settings();
@@ -15424,9 +15567,9 @@ async function findOrphanWorktrees(repoPaths) {
15424
15567
  repoPaths?.length ? repoPaths : threads.map((t) => t.repoPath).filter(Boolean)
15425
15568
  );
15426
15569
  const homeRoot = sideboardWorkspacesDir();
15427
- if ((0, import_node_fs39.existsSync)(homeRoot)) {
15570
+ if ((0, import_node_fs40.existsSync)(homeRoot)) {
15428
15571
  try {
15429
- for (const entry of (0, import_node_fs39.readdirSync)(homeRoot, { withFileTypes: true })) {
15572
+ for (const entry of (0, import_node_fs40.readdirSync)(homeRoot, { withFileTypes: true })) {
15430
15573
  if (!entry.isDirectory()) continue;
15431
15574
  void entry;
15432
15575
  }
@@ -15436,7 +15579,7 @@ async function findOrphanWorktrees(repoPaths) {
15436
15579
  const orphans = [];
15437
15580
  const seen = /* @__PURE__ */ new Set();
15438
15581
  for (const repoPath of repos) {
15439
- if (!repoPath || !(0, import_node_fs39.existsSync)(repoPath)) continue;
15582
+ if (!repoPath || !(0, import_node_fs40.existsSync)(repoPath)) continue;
15440
15583
  try {
15441
15584
  const wts = await listWorktrees(repoPath);
15442
15585
  for (const wt of wts) {
@@ -15447,7 +15590,7 @@ async function findOrphanWorktrees(repoPaths) {
15447
15590
  seen.add(path2);
15448
15591
  let mtimeMs = 0;
15449
15592
  try {
15450
- mtimeMs = (0, import_node_fs39.statSync)(path2).mtimeMs;
15593
+ mtimeMs = (0, import_node_fs40.statSync)(path2).mtimeMs;
15451
15594
  } catch {
15452
15595
  mtimeMs = 0;
15453
15596
  }
@@ -15457,16 +15600,16 @@ async function findOrphanWorktrees(repoPaths) {
15457
15600
  }
15458
15601
  try {
15459
15602
  const root = worktreesRoot(repoPath);
15460
- if ((0, import_node_fs39.existsSync)(root)) {
15461
- for (const entry of (0, import_node_fs39.readdirSync)(root, { withFileTypes: true })) {
15603
+ if ((0, import_node_fs40.existsSync)(root)) {
15604
+ for (const entry of (0, import_node_fs40.readdirSync)(root, { withFileTypes: true })) {
15462
15605
  if (!entry.isDirectory()) continue;
15463
- const path2 = (0, import_node_path39.join)(root, entry.name).replace(/\/$/, "");
15606
+ const path2 = (0, import_node_path40.join)(root, entry.name).replace(/\/$/, "");
15464
15607
  if (known.has(path2) || seen.has(path2)) continue;
15465
- if (!(0, import_node_fs39.existsSync)((0, import_node_path39.join)(path2, ".git"))) continue;
15608
+ if (!(0, import_node_fs40.existsSync)((0, import_node_path40.join)(path2, ".git"))) continue;
15466
15609
  seen.add(path2);
15467
15610
  let mtimeMs = 0;
15468
15611
  try {
15469
- mtimeMs = (0, import_node_fs39.statSync)(path2).mtimeMs;
15612
+ mtimeMs = (0, import_node_fs40.statSync)(path2).mtimeMs;
15470
15613
  } catch {
15471
15614
  mtimeMs = Date.now();
15472
15615
  }
@@ -15527,12 +15670,12 @@ function worktreeCleanupSettings() {
15527
15670
  autoCleanupOrphans: a.autoCleanupOrphans
15528
15671
  };
15529
15672
  }
15530
- var import_node_fs39, import_node_path39;
15673
+ var import_node_fs40, import_node_path40;
15531
15674
  var init_orphan_cleanup = __esm({
15532
15675
  "src/git/orphan-cleanup.ts"() {
15533
15676
  "use strict";
15534
- import_node_fs39 = require("fs");
15535
- import_node_path39 = require("path");
15677
+ import_node_fs40 = require("fs");
15678
+ import_node_path40 = require("path");
15536
15679
  init_worktree();
15537
15680
  init_thread_store();
15538
15681
  init_paths();
@@ -15635,12 +15778,12 @@ async function cloneRepoIntoSideboard(opts) {
15635
15778
  if (!url) throw new Error("Clone URL is required");
15636
15779
  let name = opts.name?.trim();
15637
15780
  if (!name) {
15638
- const leaf = (0, import_node_path40.basename)(url.replace(/\/$/, "").replace(/\.git$/, ""));
15781
+ const leaf = (0, import_node_path41.basename)(url.replace(/\/$/, "").replace(/\.git$/, ""));
15639
15782
  name = leaf || "repo";
15640
15783
  }
15641
15784
  name = name.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "repo";
15642
- const dest = (0, import_node_path40.join)(sideboardReposDir(), name);
15643
- if ((0, import_node_fs40.existsSync)(dest)) {
15785
+ const dest = (0, import_node_path41.join)(sideboardReposDir(), name);
15786
+ if ((0, import_node_fs41.existsSync)(dest)) {
15644
15787
  const repoPath2 = await resolveRepoRoot(dest);
15645
15788
  const workspace2 = await ensureWorkspace(repoPath2);
15646
15789
  return { repoPath: repoPath2, workspace: workspace2 };
@@ -15655,12 +15798,12 @@ async function cloneRepoIntoSideboard(opts) {
15655
15798
  const workspace = await ensureWorkspace(repoPath);
15656
15799
  return { repoPath, workspace };
15657
15800
  }
15658
- var import_node_fs40, import_node_path40, import_execa6;
15801
+ var import_node_fs41, import_node_path41, import_execa6;
15659
15802
  var init_clone_repo = __esm({
15660
15803
  "src/git/clone-repo.ts"() {
15661
15804
  "use strict";
15662
- import_node_fs40 = require("fs");
15663
- import_node_path40 = require("path");
15805
+ import_node_fs41 = require("fs");
15806
+ import_node_path41 = require("path");
15664
15807
  import_execa6 = require("execa");
15665
15808
  init_paths();
15666
15809
  init_workspaces();
@@ -15778,24 +15921,24 @@ function jobTreeAlive(pid) {
15778
15921
  return jobAlive(pid) || processGroupAlive(pid);
15779
15922
  }
15780
15923
  function readIntFile(file) {
15781
- if (!(0, import_node_fs41.existsSync)(file)) return null;
15782
- const n = Number.parseInt((0, import_node_fs41.readFileSync)(file, "utf8").trim(), 10);
15924
+ if (!(0, import_node_fs42.existsSync)(file)) return null;
15925
+ const n = Number.parseInt((0, import_node_fs42.readFileSync)(file, "utf8").trim(), 10);
15783
15926
  return Number.isInteger(n) ? n : null;
15784
15927
  }
15785
15928
  function jobDir(root, id, legacy = false) {
15786
- return (0, import_node_path41.join)(root, legacy ? LEGACY_DETACHED_JOBS_DIR : DETACHED_JOBS_DIR, id);
15929
+ return (0, import_node_path42.join)(root, legacy ? LEGACY_DETACHED_JOBS_DIR : DETACHED_JOBS_DIR, id);
15787
15930
  }
15788
15931
  function resolveJobDir(root, id) {
15789
15932
  const modern = jobDir(root, id, false);
15790
- if ((0, import_node_fs41.existsSync)(modern)) return modern;
15933
+ if ((0, import_node_fs42.existsSync)(modern)) return modern;
15791
15934
  const legacy = jobDir(root, id, true);
15792
- if ((0, import_node_fs41.existsSync)(legacy)) return legacy;
15935
+ if ((0, import_node_fs42.existsSync)(legacy)) return legacy;
15793
15936
  return modern;
15794
15937
  }
15795
15938
  function listJobIdsIn(root, rel) {
15796
- const dir = (0, import_node_path41.join)(root, rel);
15797
- if (!(0, import_node_fs41.existsSync)(dir)) return [];
15798
- return (0, import_node_fs41.readdirSync)(dir, { withFileTypes: true }).filter((e) => e.isDirectory() && JOB_ID_RE.test(e.name)).map((e) => e.name);
15939
+ const dir = (0, import_node_path42.join)(root, rel);
15940
+ if (!(0, import_node_fs42.existsSync)(dir)) return [];
15941
+ return (0, import_node_fs42.readdirSync)(dir, { withFileTypes: true }).filter((e) => e.isDirectory() && JOB_ID_RE.test(e.name)).map((e) => e.name);
15799
15942
  }
15800
15943
  function listRunningDetachedJobs(worktreePath) {
15801
15944
  const root = worktreePath.trim();
@@ -15807,7 +15950,7 @@ function listRunningDetachedJobs(worktreePath) {
15807
15950
  const running = [];
15808
15951
  for (const id of ids) {
15809
15952
  const dir = resolveJobDir(root, id);
15810
- const pid = readIntFile((0, import_node_path41.join)(dir, "pid"));
15953
+ const pid = readIntFile((0, import_node_path42.join)(dir, "pid"));
15811
15954
  if (jobTreeAlive(pid)) running.push(id);
15812
15955
  }
15813
15956
  return running.sort();
@@ -15860,13 +16003,13 @@ function planJobContinue(opts) {
15860
16003
  return { action: "none" };
15861
16004
  }
15862
16005
  function tailProgress(logFile, maxLines = 12) {
15863
- if (!(0, import_node_fs41.existsSync)(logFile)) return "(no log yet)";
15864
- const lines = (0, import_node_fs41.readFileSync)(logFile, "utf8").split("\n");
16006
+ if (!(0, import_node_fs42.existsSync)(logFile)) return "(no log yet)";
16007
+ const lines = (0, import_node_fs42.readFileSync)(logFile, "utf8").split("\n");
15865
16008
  return lines.slice(-maxLines).join("\n");
15866
16009
  }
15867
16010
  function readLogLines(file) {
15868
- if (!(0, import_node_fs41.existsSync)(file)) return [];
15869
- const lines = (0, import_node_fs41.readFileSync)(file, "utf8").split("\n");
16011
+ if (!(0, import_node_fs42.existsSync)(file)) return [];
16012
+ const lines = (0, import_node_fs42.readFileSync)(file, "utf8").split("\n");
15870
16013
  if (lines.length && lines[lines.length - 1] === "") lines.pop();
15871
16014
  return lines;
15872
16015
  }
@@ -15877,15 +16020,15 @@ function takeDelta(logFile, cursorFile) {
15877
16020
  return { delta: lines.slice(start).join("\n"), nextCursor: lines.length };
15878
16021
  }
15879
16022
  function snapshotJob(dir) {
15880
- const pid = readIntFile((0, import_node_path41.join)(dir, "pid"));
16023
+ const pid = readIntFile((0, import_node_path42.join)(dir, "pid"));
15881
16024
  const running = jobTreeAlive(pid);
15882
16025
  return {
15883
16026
  pid,
15884
16027
  running,
15885
- exitCode: readIntFile((0, import_node_path41.join)(dir, "exit")),
15886
- log: (0, import_node_path41.join)(dir, "log"),
15887
- cursor: (0, import_node_path41.join)(dir, "present.cursor"),
15888
- progress: tailProgress((0, import_node_path41.join)(dir, "log"))
16028
+ exitCode: readIntFile((0, import_node_path42.join)(dir, "exit")),
16029
+ log: (0, import_node_path42.join)(dir, "log"),
16030
+ cursor: (0, import_node_path42.join)(dir, "present.cursor"),
16031
+ progress: tailProgress((0, import_node_path42.join)(dir, "log"))
15889
16032
  };
15890
16033
  }
15891
16034
  function toResult(id, snap, extra) {
@@ -15894,8 +16037,8 @@ function toResult(id, snap, extra) {
15894
16037
  const stillRunning = snap.running && !ok;
15895
16038
  const { delta, nextCursor } = takeDelta(snap.log, snap.cursor);
15896
16039
  try {
15897
- (0, import_node_fs41.mkdirSync)((0, import_node_path41.dirname)(snap.cursor), { recursive: true });
15898
- (0, import_node_fs41.writeFileSync)(snap.cursor, `${nextCursor}
16040
+ (0, import_node_fs42.mkdirSync)((0, import_node_path42.dirname)(snap.cursor), { recursive: true });
16041
+ (0, import_node_fs42.writeFileSync)(snap.cursor, `${nextCursor}
15899
16042
  `);
15900
16043
  } catch {
15901
16044
  }
@@ -15922,7 +16065,7 @@ async function waitForDetachedJob(cwd, id, opts) {
15922
16065
  const dir = resolveJobDir(root, jobId);
15923
16066
  const timeoutMs = mcpWaitForJobTimeoutMs(opts?.timeoutMs);
15924
16067
  const sleep2 = opts?.sleep ?? sleepMs;
15925
- if (!(0, import_node_fs41.existsSync)(dir)) {
16068
+ if (!(0, import_node_fs42.existsSync)(dir)) {
15926
16069
  return {
15927
16070
  stillRunning: false,
15928
16071
  ok: false,
@@ -15968,10 +16111,10 @@ function killProcessTree(pid, signal) {
15968
16111
  }
15969
16112
  function appendJobLog(logFile, line) {
15970
16113
  try {
15971
- (0, import_node_fs41.mkdirSync)((0, import_node_path41.dirname)(logFile), { recursive: true });
16114
+ (0, import_node_fs42.mkdirSync)((0, import_node_path42.dirname)(logFile), { recursive: true });
15972
16115
  const body = line.endsWith("\n") ? line : `${line}
15973
16116
  `;
15974
- (0, import_node_fs41.appendFileSync)(logFile, body);
16117
+ (0, import_node_fs42.appendFileSync)(logFile, body);
15975
16118
  } catch {
15976
16119
  }
15977
16120
  }
@@ -15981,7 +16124,7 @@ async function stopDetachedJob(cwd, id, opts) {
15981
16124
  const dir = resolveJobDir(root, jobId);
15982
16125
  const sleep2 = opts?.sleep ?? sleepMs;
15983
16126
  const why = opts?.reason?.trim() ?? "";
15984
- if (!(0, import_node_fs41.existsSync)(dir)) {
16127
+ if (!(0, import_node_fs42.existsSync)(dir)) {
15985
16128
  return {
15986
16129
  stillRunning: false,
15987
16130
  ok: false,
@@ -16017,10 +16160,10 @@ async function stopDetachedJob(cwd, id, opts) {
16017
16160
  killProcessTree(targetPid, "SIGKILL");
16018
16161
  await sleep2(100);
16019
16162
  }
16020
- const exitFile = (0, import_node_path41.join)(dir, "exit");
16021
- if (!(0, import_node_fs41.existsSync)(exitFile)) {
16163
+ const exitFile = (0, import_node_path42.join)(dir, "exit");
16164
+ if (!(0, import_node_fs42.existsSync)(exitFile)) {
16022
16165
  try {
16023
- (0, import_node_fs41.writeFileSync)(exitFile, "1\n");
16166
+ (0, import_node_fs42.writeFileSync)(exitFile, "1\n");
16024
16167
  } catch {
16025
16168
  }
16026
16169
  }
@@ -16040,12 +16183,12 @@ async function stopDetachedJob(cwd, id, opts) {
16040
16183
  hint: stopped ? MCP_STOP_JOB_HINT : MCP_WAIT_JOB_STILL_RUNNING_HINT
16041
16184
  };
16042
16185
  }
16043
- var import_node_fs41, import_node_path41, MAX_JOB_CONTINUES, MCP_WAIT_JOB_STILL_RUNNING_HINT, MCP_STOP_JOB_HINT, JOB_ID_RE;
16186
+ var import_node_fs42, import_node_path42, MAX_JOB_CONTINUES, MCP_WAIT_JOB_STILL_RUNNING_HINT, MCP_STOP_JOB_HINT, JOB_ID_RE;
16044
16187
  var init_wait_for_job = __esm({
16045
16188
  "src/mcp/wait-for-job.ts"() {
16046
16189
  "use strict";
16047
- import_node_fs41 = require("fs");
16048
- import_node_path41 = require("path");
16190
+ import_node_fs42 = require("fs");
16191
+ import_node_path42 = require("path");
16049
16192
  init_workspace_scratch();
16050
16193
  init_wait_for_turn();
16051
16194
  MAX_JOB_CONTINUES = 8;
@@ -17182,7 +17325,7 @@ function reuseLiveThread(input, repoPath, match) {
17182
17325
  }
17183
17326
  async function createThread(input, _onSetupLine) {
17184
17327
  const repoPath = await resolveRepoRoot(input.repoPath);
17185
- if (!(0, import_node_fs42.existsSync)(repoPath)) {
17328
+ if (!(0, import_node_fs43.existsSync)(repoPath)) {
17186
17329
  throw new Error(`Repo not found: ${repoPath}`);
17187
17330
  }
17188
17331
  const reused = reuseLiveThread(input, repoPath, {
@@ -17363,11 +17506,11 @@ async function listLinearIssues(agent, repoPath) {
17363
17506
  }
17364
17507
  return adapter.listLinearIssues(repoPath);
17365
17508
  }
17366
- var import_node_fs42;
17509
+ var import_node_fs43;
17367
17510
  var init_create = __esm({
17368
17511
  "src/threads/create.ts"() {
17369
17512
  "use strict";
17370
- import_node_fs42 = require("fs");
17513
+ import_node_fs43 = require("fs");
17371
17514
  init_detect();
17372
17515
  init_worktree();
17373
17516
  init_home_board();
@@ -17487,20 +17630,20 @@ function writeTurnLive(threadId, progress) {
17487
17630
  const path2 = threadLivePath(threadId);
17488
17631
  const tmp = `${path2}.${process.pid}.tmp`;
17489
17632
  try {
17490
- (0, import_node_fs43.writeFileSync)(tmp, JSON.stringify(progress), "utf8");
17491
- (0, import_node_fs43.renameSync)(tmp, path2);
17633
+ (0, import_node_fs44.writeFileSync)(tmp, JSON.stringify(progress), "utf8");
17634
+ (0, import_node_fs44.renameSync)(tmp, path2);
17492
17635
  } catch {
17493
17636
  try {
17494
- (0, import_node_fs43.unlinkSync)(tmp);
17637
+ (0, import_node_fs44.unlinkSync)(tmp);
17495
17638
  } catch {
17496
17639
  }
17497
17640
  }
17498
17641
  }
17499
17642
  function readTurnLive(threadId) {
17500
17643
  const path2 = threadLivePath(threadId);
17501
- if (!(0, import_node_fs43.existsSync)(path2)) return null;
17644
+ if (!(0, import_node_fs44.existsSync)(path2)) return null;
17502
17645
  try {
17503
- const raw = JSON.parse((0, import_node_fs43.readFileSync)(path2, "utf8"));
17646
+ const raw = JSON.parse((0, import_node_fs44.readFileSync)(path2, "utf8"));
17504
17647
  if (!raw || typeof raw.summary !== "string") return null;
17505
17648
  return raw;
17506
17649
  } catch {
@@ -17512,17 +17655,17 @@ function clearTurnLive(threadId) {
17512
17655
  if (buf?.timer) clearTimeout(buf.timer);
17513
17656
  buffers.delete(threadId);
17514
17657
  const path2 = threadLivePath(threadId);
17515
- if (!(0, import_node_fs43.existsSync)(path2)) return;
17658
+ if (!(0, import_node_fs44.existsSync)(path2)) return;
17516
17659
  try {
17517
- (0, import_node_fs43.unlinkSync)(path2);
17660
+ (0, import_node_fs44.unlinkSync)(path2);
17518
17661
  } catch {
17519
17662
  }
17520
17663
  }
17521
- var import_node_fs43, buffers, FLUSH_MS, MAX_PARTS;
17664
+ var import_node_fs44, buffers, FLUSH_MS, MAX_PARTS;
17522
17665
  var init_turn_live = __esm({
17523
17666
  "src/store/turn-live.ts"() {
17524
17667
  "use strict";
17525
- import_node_fs43 = require("fs");
17668
+ import_node_fs44 = require("fs");
17526
17669
  init_message_parts();
17527
17670
  init_paths();
17528
17671
  buffers = /* @__PURE__ */ new Map();
@@ -17742,7 +17885,7 @@ var init_quota_failover = __esm({
17742
17885
  // src/threads/adopt.ts
17743
17886
  function thisModuleFile() {
17744
17887
  const cjsFile = typeof __filename !== "undefined" ? __filename : "";
17745
- return cjsFile || process.argv[1] || (0, import_node_path42.join)(process.cwd(), "package.json");
17888
+ return cjsFile || process.argv[1] || (0, import_node_path43.join)(process.cwd(), "package.json");
17746
17889
  }
17747
17890
  function openReadonlySqlite(file) {
17748
17891
  const req = (0, import_node_module4.createRequire)(thisModuleFile());
@@ -17760,21 +17903,21 @@ function mapAgentType(raw) {
17760
17903
  return null;
17761
17904
  }
17762
17905
  function resolveConductorCursorAgentId(workspacePath) {
17763
- if (!workspacePath || !(0, import_node_fs44.existsSync)(CURSOR_SDK_STORE)) return null;
17906
+ if (!workspacePath || !(0, import_node_fs45.existsSync)(CURSOR_SDK_STORE)) return null;
17764
17907
  const normalized = workspacePath.replace(/\/$/, "");
17765
17908
  let best = null;
17766
17909
  let hashes;
17767
17910
  try {
17768
- hashes = (0, import_node_fs44.readdirSync)(CURSOR_SDK_STORE);
17911
+ hashes = (0, import_node_fs45.readdirSync)(CURSOR_SDK_STORE);
17769
17912
  } catch {
17770
17913
  return null;
17771
17914
  }
17772
17915
  for (const hash of hashes) {
17773
- const agentsFile = (0, import_node_path42.join)(CURSOR_SDK_STORE, hash, "agents.ndjson");
17774
- if (!(0, import_node_fs44.existsSync)(agentsFile)) continue;
17916
+ const agentsFile = (0, import_node_path43.join)(CURSOR_SDK_STORE, hash, "agents.ndjson");
17917
+ if (!(0, import_node_fs45.existsSync)(agentsFile)) continue;
17775
17918
  let text7;
17776
17919
  try {
17777
- text7 = (0, import_node_fs44.readFileSync)(agentsFile, "utf8");
17920
+ text7 = (0, import_node_fs45.readFileSync)(agentsFile, "utf8");
17778
17921
  } catch {
17779
17922
  continue;
17780
17923
  }
@@ -17798,7 +17941,7 @@ function resolveConductorCursorAgentId(workspacePath) {
17798
17941
  return best?.agentId ?? null;
17799
17942
  }
17800
17943
  async function adoptThread(input) {
17801
- if (!(0, import_node_fs44.existsSync)(input.worktreePath)) {
17944
+ if (!(0, import_node_fs45.existsSync)(input.worktreePath)) {
17802
17945
  throw new Error(`Worktree not found: ${input.worktreePath}`);
17803
17946
  }
17804
17947
  const repoPath = await resolveRepoRoot(input.worktreePath);
@@ -17827,18 +17970,18 @@ function conductorDbPath() {
17827
17970
  return CONDUCTOR_DB;
17828
17971
  }
17829
17972
  function listConductorWorkspaces() {
17830
- if (!(0, import_node_fs44.existsSync)(CONDUCTOR_DB)) {
17973
+ if (!(0, import_node_fs45.existsSync)(CONDUCTOR_DB)) {
17831
17974
  throw new Error(`Conductor DB not found at ${CONDUCTOR_DB}`);
17832
17975
  }
17833
- const tmp = (0, import_node_fs44.mkdtempSync)((0, import_node_path42.join)((0, import_node_os13.tmpdir)(), "sideboard-conductor-"));
17834
- const snapshot = (0, import_node_path42.join)(tmp, "conductor.db");
17976
+ const tmp = (0, import_node_fs45.mkdtempSync)((0, import_node_path43.join)((0, import_node_os13.tmpdir)(), "sideboard-conductor-"));
17977
+ const snapshot = (0, import_node_path43.join)(tmp, "conductor.db");
17835
17978
  try {
17836
- (0, import_node_fs44.copyFileSync)(CONDUCTOR_DB, snapshot);
17979
+ (0, import_node_fs45.copyFileSync)(CONDUCTOR_DB, snapshot);
17837
17980
  for (const suffix of ["-wal", "-shm"]) {
17838
17981
  const src = `${CONDUCTOR_DB}${suffix}`;
17839
- if ((0, import_node_fs44.existsSync)(src)) {
17982
+ if ((0, import_node_fs45.existsSync)(src)) {
17840
17983
  try {
17841
- (0, import_node_fs44.copyFileSync)(src, `${snapshot}${suffix}`);
17984
+ (0, import_node_fs45.copyFileSync)(src, `${snapshot}${suffix}`);
17842
17985
  } catch {
17843
17986
  }
17844
17987
  }
@@ -17914,22 +18057,22 @@ function listConductorWorkspaces() {
17914
18057
  db.close();
17915
18058
  }
17916
18059
  } finally {
17917
- (0, import_node_fs44.rmSync)(tmp, { recursive: true, force: true });
18060
+ (0, import_node_fs45.rmSync)(tmp, { recursive: true, force: true });
17918
18061
  }
17919
18062
  }
17920
18063
  function importConductorWorkspace(workspaceId) {
17921
- if (!(0, import_node_fs44.existsSync)(CONDUCTOR_DB)) {
18064
+ if (!(0, import_node_fs45.existsSync)(CONDUCTOR_DB)) {
17922
18065
  throw new Error(`Conductor DB not found at ${CONDUCTOR_DB}`);
17923
18066
  }
17924
- const tmp = (0, import_node_fs44.mkdtempSync)((0, import_node_path42.join)((0, import_node_os13.tmpdir)(), "sideboard-conductor-"));
17925
- const snapshot = (0, import_node_path42.join)(tmp, "conductor.db");
18067
+ const tmp = (0, import_node_fs45.mkdtempSync)((0, import_node_path43.join)((0, import_node_os13.tmpdir)(), "sideboard-conductor-"));
18068
+ const snapshot = (0, import_node_path43.join)(tmp, "conductor.db");
17926
18069
  try {
17927
- (0, import_node_fs44.copyFileSync)(CONDUCTOR_DB, snapshot);
18070
+ (0, import_node_fs45.copyFileSync)(CONDUCTOR_DB, snapshot);
17928
18071
  for (const suffix of ["-wal", "-shm"]) {
17929
18072
  const src = `${CONDUCTOR_DB}${suffix}`;
17930
- if ((0, import_node_fs44.existsSync)(src)) {
18073
+ if ((0, import_node_fs45.existsSync)(src)) {
17931
18074
  try {
17932
- (0, import_node_fs44.copyFileSync)(src, `${snapshot}${suffix}`);
18075
+ (0, import_node_fs45.copyFileSync)(src, `${snapshot}${suffix}`);
17933
18076
  } catch {
17934
18077
  }
17935
18078
  }
@@ -17947,7 +18090,7 @@ function importConductorWorkspace(workspaceId) {
17947
18090
  ).get(workspaceId);
17948
18091
  if (!row) throw new Error(`Conductor workspace not found: ${workspaceId}`);
17949
18092
  const worktreePath = String(row.workspacePath);
17950
- if (!(0, import_node_fs44.existsSync)(worktreePath)) {
18093
+ if (!(0, import_node_fs45.existsSync)(worktreePath)) {
17951
18094
  throw new Error(`Conductor worktree missing on disk: ${worktreePath}`);
17952
18095
  }
17953
18096
  let sessionId = null;
@@ -17987,7 +18130,7 @@ function importConductorWorkspace(workspaceId) {
17987
18130
  }
17988
18131
  let repoPath = worktreePath;
17989
18132
  try {
17990
- repoPath = (0, import_node_child_process4.execFileSync)("git", ["rev-parse", "--show-toplevel"], {
18133
+ repoPath = (0, import_node_child_process5.execFileSync)("git", ["rev-parse", "--show-toplevel"], {
17991
18134
  cwd: worktreePath,
17992
18135
  encoding: "utf8"
17993
18136
  }).trim();
@@ -18010,31 +18153,31 @@ function importConductorWorkspace(workspaceId) {
18010
18153
  db.close();
18011
18154
  }
18012
18155
  } finally {
18013
- (0, import_node_fs44.rmSync)(tmp, { recursive: true, force: true });
18156
+ (0, import_node_fs45.rmSync)(tmp, { recursive: true, force: true });
18014
18157
  }
18015
18158
  }
18016
18159
  async function importConductorWorkspaceAsync(workspaceId) {
18017
18160
  return importConductorWorkspace(workspaceId);
18018
18161
  }
18019
- var import_node_child_process4, import_node_fs44, import_node_os13, import_node_path42, import_node_module4, CONDUCTOR_APP_SUPPORT, CONDUCTOR_DB, CURSOR_SDK_STORE;
18162
+ var import_node_child_process5, import_node_fs45, import_node_os13, import_node_path43, import_node_module4, CONDUCTOR_APP_SUPPORT, CONDUCTOR_DB, CURSOR_SDK_STORE;
18020
18163
  var init_adopt = __esm({
18021
18164
  "src/threads/adopt.ts"() {
18022
18165
  "use strict";
18023
- import_node_child_process4 = require("child_process");
18024
- import_node_fs44 = require("fs");
18166
+ import_node_child_process5 = require("child_process");
18167
+ import_node_fs45 = require("fs");
18025
18168
  import_node_os13 = require("os");
18026
- import_node_path42 = require("path");
18169
+ import_node_path43 = require("path");
18027
18170
  import_node_module4 = require("module");
18028
18171
  init_worktree();
18029
18172
  init_thread_store();
18030
- CONDUCTOR_APP_SUPPORT = (0, import_node_path42.join)(
18173
+ CONDUCTOR_APP_SUPPORT = (0, import_node_path43.join)(
18031
18174
  process.env.HOME ?? "",
18032
18175
  "Library",
18033
18176
  "Application Support",
18034
18177
  "com.conductor.app"
18035
18178
  );
18036
- CONDUCTOR_DB = (0, import_node_path42.join)(CONDUCTOR_APP_SUPPORT, "conductor.db");
18037
- CURSOR_SDK_STORE = (0, import_node_path42.join)(CONDUCTOR_APP_SUPPORT, "cursor-sdk-store");
18179
+ CONDUCTOR_DB = (0, import_node_path43.join)(CONDUCTOR_APP_SUPPORT, "conductor.db");
18180
+ CURSOR_SDK_STORE = (0, import_node_path43.join)(CONDUCTOR_APP_SUPPORT, "cursor-sdk-store");
18038
18181
  }
18039
18182
  });
18040
18183
 
@@ -18101,7 +18244,7 @@ async function openStackLayer(input, _onSetupLine) {
18101
18244
  let createdWorktree = false;
18102
18245
  const trees = await listWorktrees(repoPath);
18103
18246
  const checkedOut = trees.find((w) => w.branch === branchName);
18104
- if (checkedOut?.path && (0, import_node_fs45.existsSync)(checkedOut.path)) {
18247
+ if (checkedOut?.path && (0, import_node_fs46.existsSync)(checkedOut.path)) {
18105
18248
  if (input.reuseExistingWorktree !== false) {
18106
18249
  worktreePath = checkedOut.path;
18107
18250
  } else {
@@ -18243,7 +18386,7 @@ async function initStackFromThread(input, onSetupLine) {
18243
18386
  async function createPrStack(input, onSetupLine) {
18244
18387
  await requireAgent(input.agent);
18245
18388
  const repoPath = await resolveRepoRoot(input.repoPath);
18246
- if (!(0, import_node_fs45.existsSync)(repoPath)) throw new Error(`Repo not found: ${repoPath}`);
18389
+ if (!(0, import_node_fs46.existsSync)(repoPath)) throw new Error(`Repo not found: ${repoPath}`);
18247
18390
  if (!input.branches.length) throw new Error("At least one branch name required");
18248
18391
  const status = await detectGhStack(repoPath);
18249
18392
  if (!status.available) throw new Error(status.reason);
@@ -18310,7 +18453,7 @@ async function createPrStack(input, onSetupLine) {
18310
18453
  }
18311
18454
  }
18312
18455
  const claimed = new Set(threads.map((t) => t.worktreePath));
18313
- if (!claimed.has(bootstrap.worktreePath) && (0, import_node_fs45.existsSync)(bootstrap.worktreePath)) {
18456
+ if (!claimed.has(bootstrap.worktreePath) && (0, import_node_fs46.existsSync)(bootstrap.worktreePath)) {
18314
18457
  try {
18315
18458
  await removeWorktree(repoPath, bootstrap.worktreePath, {
18316
18459
  deleteBranch: bootstrap.branchName
@@ -18330,11 +18473,11 @@ function stackAgentDefaultsFrom(input) {
18330
18473
  planMode: input.planMode
18331
18474
  };
18332
18475
  }
18333
- var import_node_fs45;
18476
+ var import_node_fs46;
18334
18477
  var init_stack_layers = __esm({
18335
18478
  "src/threads/stack-layers.ts"() {
18336
18479
  "use strict";
18337
- import_node_fs45 = require("fs");
18480
+ import_node_fs46 = require("fs");
18338
18481
  init_detect();
18339
18482
  init_run();
18340
18483
  init_stack();
@@ -18347,7 +18490,7 @@ var init_stack_layers = __esm({
18347
18490
 
18348
18491
  // src/diff/diff.ts
18349
18492
  async function inspectGitWorktree(worktreePath) {
18350
- if (!worktreePath || !(0, import_node_fs46.existsSync)(worktreePath)) return "missing_worktree";
18493
+ if (!worktreePath || !(0, import_node_fs47.existsSync)(worktreePath)) return "missing_worktree";
18351
18494
  const check = await git(["rev-parse", "--is-inside-work-tree"], worktreePath, {
18352
18495
  reject: false
18353
18496
  });
@@ -18355,7 +18498,7 @@ async function inspectGitWorktree(worktreePath) {
18355
18498
  return "ok";
18356
18499
  }
18357
18500
  async function initializeGitRepository(worktreePath) {
18358
- if (!worktreePath || !(0, import_node_fs46.existsSync)(worktreePath)) {
18501
+ if (!worktreePath || !(0, import_node_fs47.existsSync)(worktreePath)) {
18359
18502
  throw new Error("Worktree not found");
18360
18503
  }
18361
18504
  const status = await inspectGitWorktree(worktreePath);
@@ -18489,11 +18632,11 @@ new file mode 100644
18489
18632
  };
18490
18633
  }
18491
18634
  async function untrackedPatch(worktreePath, path2, maxHunk) {
18492
- const abs = (0, import_node_path43.join)(worktreePath, path2);
18635
+ const abs = (0, import_node_path44.join)(worktreePath, path2);
18493
18636
  try {
18494
- const st = (0, import_node_fs46.statSync)(abs);
18637
+ const st = (0, import_node_fs47.statSync)(abs);
18495
18638
  if (st.isFile() && st.size > maxHunk) {
18496
- const buf = (0, import_node_fs46.readFileSync)(abs).subarray(0, maxHunk);
18639
+ const buf = (0, import_node_fs47.readFileSync)(abs).subarray(0, maxHunk);
18497
18640
  return syntheticAddPatch(path2, buf.toString("utf8"), maxHunk);
18498
18641
  }
18499
18642
  } catch {
@@ -18982,8 +19125,8 @@ function isImageRelativePath(relativePath) {
18982
19125
  function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
18983
19126
  assertSafeRelativePath(relativePath);
18984
19127
  const maxBytes = opts?.maxBytes ?? DEFAULT_UPLOAD_MAX_BYTES;
18985
- const abs = (0, import_node_path43.join)(worktreePath, relativePath);
18986
- const st = (0, import_node_fs46.statSync)(abs);
19128
+ const abs = (0, import_node_path44.join)(worktreePath, relativePath);
19129
+ const st = (0, import_node_fs47.statSync)(abs);
18987
19130
  if (!st.isFile()) {
18988
19131
  throw new Error(`Not a file: ${relativePath}`);
18989
19132
  }
@@ -18992,7 +19135,7 @@ function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
18992
19135
  `File too large to upload (${st.size} bytes; max ${maxBytes})`
18993
19136
  );
18994
19137
  }
18995
- const buf = (0, import_node_fs46.readFileSync)(abs);
19138
+ const buf = (0, import_node_fs47.readFileSync)(abs);
18996
19139
  return {
18997
19140
  path: relativePath,
18998
19141
  contentBase64: buf.toString("base64"),
@@ -19002,12 +19145,12 @@ function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
19002
19145
  function readWorktreeFile(worktreePath, relativePath, opts) {
19003
19146
  assertSafeRelativePath(relativePath);
19004
19147
  const maxBytes = opts?.maxBytes ?? 2e5;
19005
- const abs = (0, import_node_path43.join)(worktreePath, relativePath);
19006
- const st = (0, import_node_fs46.statSync)(abs);
19148
+ const abs = (0, import_node_path44.join)(worktreePath, relativePath);
19149
+ const st = (0, import_node_fs47.statSync)(abs);
19007
19150
  if (!st.isFile()) {
19008
19151
  throw new Error(`Not a file: ${relativePath}`);
19009
19152
  }
19010
- const buf = (0, import_node_fs46.readFileSync)(abs);
19153
+ const buf = (0, import_node_fs47.readFileSync)(abs);
19011
19154
  if (isImageRelativePath(relativePath)) {
19012
19155
  const maxImageBytes = Math.max(maxBytes, 15e6);
19013
19156
  const truncated2 = buf.length > maxImageBytes;
@@ -19050,9 +19193,9 @@ function assertSafeRelativePath(relativePath) {
19050
19193
  }
19051
19194
  function writeWorktreeFile(worktreePath, relativePath, content) {
19052
19195
  assertSafeRelativePath(relativePath);
19053
- const abs = (0, import_node_path43.join)(worktreePath, relativePath);
19054
- (0, import_node_fs46.mkdirSync)((0, import_node_path43.dirname)(abs), { recursive: true });
19055
- (0, import_node_fs46.writeFileSync)(abs, content, "utf8");
19196
+ const abs = (0, import_node_path44.join)(worktreePath, relativePath);
19197
+ (0, import_node_fs47.mkdirSync)((0, import_node_path44.dirname)(abs), { recursive: true });
19198
+ (0, import_node_fs47.writeFileSync)(abs, content, "utf8");
19056
19199
  return { path: relativePath };
19057
19200
  }
19058
19201
  async function getDiffSummary(worktreePath, repoPath, opts) {
@@ -19069,12 +19212,12 @@ async function getDiffSummary(worktreePath, repoPath, opts) {
19069
19212
  truncated: full.files.length > maxFiles
19070
19213
  };
19071
19214
  }
19072
- var import_node_fs46, import_node_path43, mergeBaseCache, MERGE_BASE_TTL_MS, SHA_RE, IMAGE_EXTENSIONS2, DEFAULT_UPLOAD_MAX_BYTES;
19215
+ var import_node_fs47, import_node_path44, mergeBaseCache, MERGE_BASE_TTL_MS, SHA_RE, IMAGE_EXTENSIONS2, DEFAULT_UPLOAD_MAX_BYTES;
19073
19216
  var init_diff = __esm({
19074
19217
  "src/diff/diff.ts"() {
19075
19218
  "use strict";
19076
- import_node_fs46 = require("fs");
19077
- import_node_path43 = require("path");
19219
+ import_node_fs47 = require("fs");
19220
+ import_node_path44 = require("path");
19078
19221
  init_run();
19079
19222
  init_worktree();
19080
19223
  mergeBaseCache = /* @__PURE__ */ new Map();
@@ -19350,7 +19493,7 @@ function parseFrontmatter(content) {
19350
19493
  }
19351
19494
  function readSkill(skillMd, source) {
19352
19495
  try {
19353
- const content = (0, import_node_fs47.readFileSync)(skillMd, "utf8");
19496
+ const content = (0, import_node_fs48.readFileSync)(skillMd, "utf8");
19354
19497
  const { name: fmName, description } = parseFrontmatter(content);
19355
19498
  const dirName = skillMd.split("/").slice(-2, -1)[0] || "skill";
19356
19499
  const name = fmName || dirName;
@@ -19369,19 +19512,19 @@ function readSkill(skillMd, source) {
19369
19512
  }
19370
19513
  }
19371
19514
  function scanSkillsDir(dir, source, out) {
19372
- if (!(0, import_node_fs47.existsSync)(dir)) return;
19515
+ if (!(0, import_node_fs48.existsSync)(dir)) return;
19373
19516
  let entries;
19374
19517
  try {
19375
- entries = (0, import_node_fs47.readdirSync)(dir);
19518
+ entries = (0, import_node_fs48.readdirSync)(dir);
19376
19519
  } catch {
19377
19520
  return;
19378
19521
  }
19379
19522
  for (const entry of entries) {
19380
19523
  if (entry.startsWith(".")) continue;
19381
- const skillMd = (0, import_node_path44.join)(dir, entry, "SKILL.md");
19382
- if (!(0, import_node_fs47.existsSync)(skillMd)) continue;
19524
+ const skillMd = (0, import_node_path45.join)(dir, entry, "SKILL.md");
19525
+ if (!(0, import_node_fs48.existsSync)(skillMd)) continue;
19383
19526
  try {
19384
- if (!(0, import_node_fs47.statSync)(skillMd).isFile()) continue;
19527
+ if (!(0, import_node_fs48.statSync)(skillMd).isFile()) continue;
19385
19528
  } catch {
19386
19529
  continue;
19387
19530
  }
@@ -19390,24 +19533,24 @@ function scanSkillsDir(dir, source, out) {
19390
19533
  }
19391
19534
  }
19392
19535
  function scanClaudePluginSkills(pluginsRoot, out) {
19393
- if (!(0, import_node_fs47.existsSync)(pluginsRoot)) return;
19536
+ if (!(0, import_node_fs48.existsSync)(pluginsRoot)) return;
19394
19537
  const walk = (dir, depth, lookingForSkillsDir) => {
19395
19538
  if (depth > 7) return;
19396
19539
  let entries;
19397
19540
  try {
19398
- entries = (0, import_node_fs47.readdirSync)(dir);
19541
+ entries = (0, import_node_fs48.readdirSync)(dir);
19399
19542
  } catch {
19400
19543
  return;
19401
19544
  }
19402
19545
  if (lookingForSkillsDir && entries.includes("SKILL.md")) {
19403
- const skill = readSkill((0, import_node_path44.join)(dir, "SKILL.md"), "cli");
19546
+ const skill = readSkill((0, import_node_path45.join)(dir, "SKILL.md"), "cli");
19404
19547
  if (skill) out.push(skill);
19405
19548
  }
19406
19549
  for (const entry of entries) {
19407
19550
  if (entry === "node_modules" || entry === ".git") continue;
19408
- const full = (0, import_node_path44.join)(dir, entry);
19551
+ const full = (0, import_node_path45.join)(dir, entry);
19409
19552
  try {
19410
- if (!(0, import_node_fs47.statSync)(full).isDirectory()) continue;
19553
+ if (!(0, import_node_fs48.statSync)(full).isDirectory()) continue;
19411
19554
  } catch {
19412
19555
  continue;
19413
19556
  }
@@ -19425,17 +19568,17 @@ function discoverSkills(worktreePath) {
19425
19568
  const home = (0, import_node_os14.homedir)();
19426
19569
  const collected = [];
19427
19570
  for (const rel of [".claude/skills", ".cursor/skills", ".sideboard/skills", ".brightsy/skills", "skills"]) {
19428
- scanSkillsDir((0, import_node_path44.join)(worktreePath, rel), "workspace", collected);
19571
+ scanSkillsDir((0, import_node_path45.join)(worktreePath, rel), "workspace", collected);
19429
19572
  }
19430
19573
  for (const abs of [
19431
- (0, import_node_path44.join)(home, ".claude/skills"),
19432
- (0, import_node_path44.join)(home, ".cursor/skills"),
19433
- (0, import_node_path44.join)(home, ".sideboard/skills"),
19434
- (0, import_node_path44.join)(home, ".brightsy/skills")
19574
+ (0, import_node_path45.join)(home, ".claude/skills"),
19575
+ (0, import_node_path45.join)(home, ".cursor/skills"),
19576
+ (0, import_node_path45.join)(home, ".sideboard/skills"),
19577
+ (0, import_node_path45.join)(home, ".brightsy/skills")
19435
19578
  ]) {
19436
19579
  scanSkillsDir(abs, "user", collected);
19437
19580
  }
19438
- scanClaudePluginSkills((0, import_node_path44.join)(home, ".claude/plugins"), collected);
19581
+ scanClaudePluginSkills((0, import_node_path45.join)(home, ".claude/plugins"), collected);
19439
19582
  collected.push(...bundledSkills());
19440
19583
  const rank = {
19441
19584
  workspace: 0,
@@ -19461,7 +19604,7 @@ function readSkillBody(skillPath, maxChars = 12e3) {
19461
19604
  \u2026(truncated)` : body;
19462
19605
  }
19463
19606
  }
19464
- const raw = (0, import_node_fs47.readFileSync)(skillPath, "utf8");
19607
+ const raw = (0, import_node_fs48.readFileSync)(skillPath, "utf8");
19465
19608
  if (raw.startsWith("---")) {
19466
19609
  const end = raw.indexOf("\n---", 3);
19467
19610
  if (end >= 0) {
@@ -19475,13 +19618,13 @@ function readSkillBody(skillPath, maxChars = 12e3) {
19475
19618
 
19476
19619
  \u2026(truncated)` : raw;
19477
19620
  }
19478
- var import_node_fs47, import_node_os14, import_node_path44, BUNDLED_SKILL_PREFIX;
19621
+ var import_node_fs48, import_node_os14, import_node_path45, BUNDLED_SKILL_PREFIX;
19479
19622
  var init_discover = __esm({
19480
19623
  "src/skills/discover.ts"() {
19481
19624
  "use strict";
19482
- import_node_fs47 = require("fs");
19625
+ import_node_fs48 = require("fs");
19483
19626
  import_node_os14 = require("os");
19484
- import_node_path44 = require("path");
19627
+ import_node_path45 = require("path");
19485
19628
  init_long_running();
19486
19629
  BUNDLED_SKILL_PREFIX = "bundled:";
19487
19630
  }
@@ -19575,8 +19718,8 @@ var init_expand = __esm({
19575
19718
  // src/skills/detached-job-path.ts
19576
19719
  function detachedJobScriptIn(dir) {
19577
19720
  for (const name of DETACHED_JOB_FILENAMES) {
19578
- const script = (0, import_node_path45.join)(dir, "scripts", name);
19579
- if ((0, import_node_fs48.existsSync)(script)) return script;
19721
+ const script = (0, import_node_path46.join)(dir, "scripts", name);
19722
+ if ((0, import_node_fs49.existsSync)(script)) return script;
19580
19723
  }
19581
19724
  return null;
19582
19725
  }
@@ -19588,11 +19731,11 @@ function packagedDetachedJobPath() {
19588
19731
  function resolveDetachedJobScript() {
19589
19732
  const packaged = packagedDetachedJobPath();
19590
19733
  if (packaged) return packaged;
19591
- let dir = (0, import_node_path45.dirname)((0, import_node_url3.fileURLToPath)(import_meta3.url));
19734
+ let dir = (0, import_node_path46.dirname)((0, import_node_url3.fileURLToPath)(import_meta3.url));
19592
19735
  for (let i = 0; i < 8; i++) {
19593
19736
  const candidate = detachedJobScriptIn(dir);
19594
19737
  if (candidate) return candidate;
19595
- const parent = (0, import_node_path45.dirname)(dir);
19738
+ const parent = (0, import_node_path46.dirname)(dir);
19596
19739
  if (parent === dir) break;
19597
19740
  dir = parent;
19598
19741
  }
@@ -19603,12 +19746,12 @@ function formatDetachedJobInvoke(scriptPath) {
19603
19746
  if (resolved) return `node ${JSON.stringify(resolved)}`;
19604
19747
  return "node scripts/detached-job.cjs";
19605
19748
  }
19606
- var import_node_fs48, import_node_path45, import_node_url3, import_meta3, DETACHED_JOB_FILENAMES;
19749
+ var import_node_fs49, import_node_path46, import_node_url3, import_meta3, DETACHED_JOB_FILENAMES;
19607
19750
  var init_detached_job_path = __esm({
19608
19751
  "src/skills/detached-job-path.ts"() {
19609
19752
  "use strict";
19610
- import_node_fs48 = require("fs");
19611
- import_node_path45 = require("path");
19753
+ import_node_fs49 = require("fs");
19754
+ import_node_path46 = require("path");
19612
19755
  import_node_url3 = require("url");
19613
19756
  init_packaged_runtime();
19614
19757
  import_meta3 = {};
@@ -19788,9 +19931,9 @@ function formatPrGateDirective() {
19788
19931
  }
19789
19932
  function formatProcessGuideDirective(opts) {
19790
19933
  const worktree = opts?.worktreePath?.trim();
19791
- const hasGraphSkill = !!worktree && (0, import_node_fs49.existsSync)((0, import_node_path46.join)(worktree, ".claude/skills/graph-engineering/SKILL.md"));
19792
- const hasReviewSkill = !!worktree && (0, import_node_fs49.existsSync)((0, import_node_path46.join)(worktree, ".claude/skills/review/SKILL.md"));
19793
- const hasInstallSkill = !!worktree && (0, import_node_fs49.existsSync)((0, import_node_path46.join)(worktree, ".claude/skills/worktree-install/SKILL.md"));
19934
+ const hasGraphSkill = !!worktree && (0, import_node_fs50.existsSync)((0, import_node_path47.join)(worktree, ".claude/skills/graph-engineering/SKILL.md"));
19935
+ const hasReviewSkill = !!worktree && (0, import_node_fs50.existsSync)((0, import_node_path47.join)(worktree, ".claude/skills/review/SKILL.md"));
19936
+ const hasInstallSkill = !!worktree && (0, import_node_fs50.existsSync)((0, import_node_path47.join)(worktree, ".claude/skills/worktree-install/SKILL.md"));
19794
19937
  return [
19795
19938
  "Process guides (recurring work only):",
19796
19939
  hasGraphSkill ? "- Migrations, ports, batch fixes, and other fan-out: follow `.claude/skills/graph-engineering/SKILL.md` (`/graph-engineering`). Judge first; state on disk; grow the rulebook; do not patch around it." : null,
@@ -19828,12 +19971,12 @@ function formatArtifactDirective() {
19828
19971
  function formatUiReminder() {
19829
19972
  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. type=log appends (same artifact_id, new lines only). 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.";
19830
19973
  }
19831
- var import_node_fs49, import_node_path46, PR_GOAL_RE, GITHUB_TICKET_REF, KEYED_TICKET_REF;
19974
+ var import_node_fs50, import_node_path47, PR_GOAL_RE, GITHUB_TICKET_REF, KEYED_TICKET_REF;
19832
19975
  var init_instructions = __esm({
19833
19976
  "src/agents/instructions.ts"() {
19834
19977
  "use strict";
19835
- import_node_fs49 = require("fs");
19836
- import_node_path46 = require("path");
19978
+ import_node_fs50 = require("fs");
19979
+ import_node_path47 = require("path");
19837
19980
  init_git_auth_mode();
19838
19981
  init_worktree_labels();
19839
19982
  init_detached_job_path();
@@ -20186,40 +20329,40 @@ __export(plan_file_exports, {
20186
20329
  writePlanFile: () => writePlanFile
20187
20330
  });
20188
20331
  function ensureAttachmentsGitignore(worktreePath) {
20189
- const gitignoreAbs = (0, import_node_path47.join)(worktreePath, ATTACHMENTS_DIR, ".gitignore");
20190
- if ((0, import_node_fs50.existsSync)(gitignoreAbs)) return;
20191
- (0, import_node_fs50.mkdirSync)((0, import_node_path47.dirname)(gitignoreAbs), { recursive: true });
20192
- (0, import_node_fs50.writeFileSync)(gitignoreAbs, attachmentsGitignoreBody(), "utf8");
20332
+ const gitignoreAbs = (0, import_node_path48.join)(worktreePath, ATTACHMENTS_DIR, ".gitignore");
20333
+ if ((0, import_node_fs51.existsSync)(gitignoreAbs)) return;
20334
+ (0, import_node_fs51.mkdirSync)((0, import_node_path48.dirname)(gitignoreAbs), { recursive: true });
20335
+ (0, import_node_fs51.writeFileSync)(gitignoreAbs, attachmentsGitignoreBody(), "utf8");
20193
20336
  }
20194
20337
  function planFileAbs(worktreePath) {
20195
- return (0, import_node_path47.join)(worktreePath, PLAN_FILE_REL);
20338
+ return (0, import_node_path48.join)(worktreePath, PLAN_FILE_REL);
20196
20339
  }
20197
20340
  function readTextIfPresent2(abs) {
20198
- if (!(0, import_node_fs50.existsSync)(abs)) return null;
20341
+ if (!(0, import_node_fs51.existsSync)(abs)) return null;
20199
20342
  try {
20200
- const content = (0, import_node_fs50.readFileSync)(abs, "utf8");
20343
+ const content = (0, import_node_fs51.readFileSync)(abs, "utf8");
20201
20344
  return content.trim() ? content : null;
20202
20345
  } catch {
20203
20346
  return null;
20204
20347
  }
20205
20348
  }
20206
20349
  function readPlanFile(worktreePath) {
20207
- return readTextIfPresent2(planFileAbs(worktreePath)) ?? readTextIfPresent2((0, import_node_path47.join)(worktreePath, `${LEGACY_ATTACHMENTS_DIR}/plan.md`)) ?? readTextIfPresent2((0, import_node_path47.join)(worktreePath, LEGACY_PLAN_FILE_REL));
20350
+ return readTextIfPresent2(planFileAbs(worktreePath)) ?? readTextIfPresent2((0, import_node_path48.join)(worktreePath, `${LEGACY_ATTACHMENTS_DIR}/plan.md`)) ?? readTextIfPresent2((0, import_node_path48.join)(worktreePath, LEGACY_PLAN_FILE_REL));
20208
20351
  }
20209
20352
  function writePlanFile(worktreePath, content) {
20210
20353
  ensureAttachmentsGitignore(worktreePath);
20211
20354
  const abs = planFileAbs(worktreePath);
20212
- (0, import_node_fs50.mkdirSync)((0, import_node_path47.dirname)(abs), { recursive: true });
20355
+ (0, import_node_fs51.mkdirSync)((0, import_node_path48.dirname)(abs), { recursive: true });
20213
20356
  const body = content.trimEnd() + (content.endsWith("\n") ? "" : "\n");
20214
- (0, import_node_fs50.writeFileSync)(abs, body, "utf8");
20357
+ (0, import_node_fs51.writeFileSync)(abs, body, "utf8");
20215
20358
  return PLAN_FILE_REL;
20216
20359
  }
20217
- var import_node_fs50, import_node_path47;
20360
+ var import_node_fs51, import_node_path48;
20218
20361
  var init_plan_file = __esm({
20219
20362
  "src/plan/plan-file.ts"() {
20220
20363
  "use strict";
20221
- import_node_fs50 = require("fs");
20222
- import_node_path47 = require("path");
20364
+ import_node_fs51 = require("fs");
20365
+ import_node_path48 = require("path");
20223
20366
  init_workspace_scratch();
20224
20367
  init_plan_present();
20225
20368
  init_plan_present();
@@ -20267,13 +20410,13 @@ var init_sync_branch = __esm({
20267
20410
 
20268
20411
  // src/agents/cursor-store.ts
20269
20412
  function cursorSdkStoreDir(threadId) {
20270
- const root = (0, import_node_path48.join)(appDataDir(), CURSOR_SDK_STORE_DIR);
20413
+ const root = (0, import_node_path49.join)(appDataDir(), CURSOR_SDK_STORE_DIR);
20271
20414
  const id = sanitizeCursorStoreSegment(threadId);
20272
20415
  if (!id) return root;
20273
- return (0, import_node_path48.join)(root, "threads", id);
20416
+ return (0, import_node_path49.join)(root, "threads", id);
20274
20417
  }
20275
20418
  function cursorSdkRunsNdjsonPath(threadId) {
20276
- return (0, import_node_path48.join)(cursorSdkStoreDir(threadId), "runs.ndjson");
20419
+ return (0, import_node_path49.join)(cursorSdkStoreDir(threadId), "runs.ndjson");
20277
20420
  }
20278
20421
  function cursorSdkRunsNdjsonSearchPaths(threadId) {
20279
20422
  const scoped = cursorSdkRunsNdjsonPath(threadId);
@@ -20286,11 +20429,11 @@ function cursorSdkRunsNdjsonSearchPaths(threadId) {
20286
20429
  function sanitizeCursorStoreSegment(threadId) {
20287
20430
  return (threadId ?? "").trim().replace(/[^a-zA-Z0-9._-]/g, "_");
20288
20431
  }
20289
- var import_node_path48, CURSOR_SDK_STORE_DIR;
20432
+ var import_node_path49, CURSOR_SDK_STORE_DIR;
20290
20433
  var init_cursor_store = __esm({
20291
20434
  "src/agents/cursor-store.ts"() {
20292
20435
  "use strict";
20293
- import_node_path48 = require("path");
20436
+ import_node_path49 = require("path");
20294
20437
  init_paths();
20295
20438
  CURSOR_SDK_STORE_DIR = "cursor-sdk-store";
20296
20439
  }
@@ -20312,9 +20455,9 @@ function recoverFinishedCursorRun(opts) {
20312
20455
  return best;
20313
20456
  }
20314
20457
  function scanFinishedCursorRuns(runsPath, agentId, startedAfterMs) {
20315
- if (!(0, import_node_fs51.existsSync)(runsPath)) return null;
20458
+ if (!(0, import_node_fs52.existsSync)(runsPath)) return null;
20316
20459
  try {
20317
- const lines = (0, import_node_fs51.readFileSync)(runsPath, "utf8").split("\n");
20460
+ const lines = (0, import_node_fs52.readFileSync)(runsPath, "utf8").split("\n");
20318
20461
  let best = null;
20319
20462
  for (const line of lines) {
20320
20463
  const trimmed = line.trim();
@@ -20340,11 +20483,11 @@ function scanFinishedCursorRuns(runsPath, agentId, startedAfterMs) {
20340
20483
  return null;
20341
20484
  }
20342
20485
  }
20343
- var import_node_fs51;
20486
+ var import_node_fs52;
20344
20487
  var init_cursor_recover = __esm({
20345
20488
  "src/agents/cursor-recover.ts"() {
20346
20489
  "use strict";
20347
- import_node_fs51 = require("fs");
20490
+ import_node_fs52 = require("fs");
20348
20491
  init_cursor_store();
20349
20492
  }
20350
20493
  });
@@ -20476,13 +20619,13 @@ async function startOrchestration(opts) {
20476
20619
  }
20477
20620
  return updated;
20478
20621
  }
20479
- var import_node_events, import_node_fs52, LIVE_TURN_SPAWN_GRACE_MS, STALE_AGENT_PID_WAIT_MS, Orchestrator, singleton;
20622
+ var import_node_events, import_node_fs53, LIVE_TURN_SPAWN_GRACE_MS, STALE_AGENT_PID_WAIT_MS, Orchestrator, singleton;
20480
20623
  var init_orchestrator = __esm({
20481
20624
  "src/orchestrator/orchestrator.ts"() {
20482
20625
  "use strict";
20483
20626
  import_node_events = require("events");
20484
20627
  init_outbound_watch();
20485
- import_node_fs52 = require("fs");
20628
+ import_node_fs53 = require("fs");
20486
20629
  init_error_detail();
20487
20630
  init_run();
20488
20631
  init_stale_lock();
@@ -20655,7 +20798,7 @@ var init_orchestrator = __esm({
20655
20798
  }
20656
20799
  continue;
20657
20800
  }
20658
- if (!(0, import_node_fs52.existsSync)(thread.worktreePath)) {
20801
+ if (!(0, import_node_fs53.existsSync)(thread.worktreePath)) {
20659
20802
  setStatus(thread.id, "broken", "Worktree missing on disk");
20660
20803
  this.emit({ type: "status_changed", threadId: thread.id, status: "broken" });
20661
20804
  continue;
@@ -22546,7 +22689,7 @@ var init_orchestrator = __esm({
22546
22689
  this.emit({ type: "status_changed", threadId: restored2.id, status: restored2.status });
22547
22690
  return restored2;
22548
22691
  }
22549
- if (!(0, import_node_fs52.existsSync)(thread.worktreePath)) {
22692
+ if (!(0, import_node_fs53.existsSync)(thread.worktreePath)) {
22550
22693
  if (isCowboyThread(thread) || isPrimaryCheckoutThread(thread)) {
22551
22694
  throw new Error(
22552
22695
  `Cowboy checkout missing: ${thread.worktreePath}. Re-add the project folder, then restore.`
@@ -22864,6 +23007,7 @@ __export(index_exports, {
22864
23007
  applyForwardOccupancy: () => applyForwardOccupancy,
22865
23008
  applyGithubGitAuthEnv: () => applyGithubGitAuthEnv,
22866
23009
  applyPromptCacheTtlEnv: () => applyPromptCacheTtlEnv,
23010
+ applySystemCaEnv: () => applySystemCaEnv,
22867
23011
  applyThreadIntoMain: () => applyThreadIntoMain,
22868
23012
  applyTurnUsage: () => applyTurnUsage,
22869
23013
  armSchedules: () => armSchedules,
@@ -23242,6 +23386,7 @@ __export(index_exports, {
23242
23386
  lookupSoccerTeam: () => lookupSoccerTeam,
23243
23387
  mapAbleTimeTask: () => mapAbleTimeTask,
23244
23388
  markPrReady: () => markPrReady,
23389
+ materializeSystemCaBundle: () => materializeSystemCaBundle,
23245
23390
  maxConcurrentAgents: () => maxConcurrentAgents,
23246
23391
  maybeCompactContext: () => maybeCompactContext,
23247
23392
  mcpAllowTools: () => mcpAllowTools,
@@ -23465,6 +23610,7 @@ __export(index_exports, {
23465
23610
  toolDetail: () => toolDetail,
23466
23611
  toolFilePath: () => toolFilePath,
23467
23612
  totalTokens: () => totalTokens,
23613
+ trustSystemCertificates: () => trustSystemCertificates,
23468
23614
  turnCostUsdFromCursorUsage: () => turnCostUsdFromCursorUsage,
23469
23615
  updateAbleTimeTask: () => updateAbleTimeTask,
23470
23616
  updateAdvancedSettings: () => updateAdvancedSettings,
@@ -24831,6 +24977,7 @@ async function installOptionalServiceCli(id) {
24831
24977
 
24832
24978
  // src/index.ts
24833
24979
  init_fetch();
24980
+ init_system_ca();
24834
24981
  init_agents();
24835
24982
  init_spawn();
24836
24983
  init_message_parts();
@@ -25176,7 +25323,7 @@ var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
25176
25323
  var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
25177
25324
  var import_zod8 = require("zod");
25178
25325
  var import_node_crypto13 = require("crypto");
25179
- var import_node_path51 = require("path");
25326
+ var import_node_path52 = require("path");
25180
25327
  init_orchestrator();
25181
25328
  init_worktree();
25182
25329
  init_global_workspace();
@@ -26760,27 +26907,27 @@ init_gh_errors();
26760
26907
  init_git_auth_mode();
26761
26908
 
26762
26909
  // src/board/load-home-board.ts
26763
- var import_node_fs54 = require("fs");
26764
- var import_node_path50 = require("path");
26910
+ var import_node_fs55 = require("fs");
26911
+ var import_node_path51 = require("path");
26765
26912
  init_worktree();
26766
26913
  init_paths();
26767
26914
 
26768
26915
  // src/board/board-pins.ts
26769
26916
  var import_node_crypto12 = require("crypto");
26770
- var import_node_fs53 = require("fs");
26771
- var import_node_path49 = require("path");
26917
+ var import_node_fs54 = require("fs");
26918
+ var import_node_path50 = require("path");
26772
26919
  init_paths();
26773
26920
  init_home_board();
26774
26921
  var FILE = "home-board-pins.json";
26775
26922
  var VERSION = 1;
26776
26923
  function pinsFile() {
26777
- return (0, import_node_path49.join)(appDataDir(), FILE);
26924
+ return (0, import_node_path50.join)(appDataDir(), FILE);
26778
26925
  }
26779
26926
  function readDisk() {
26780
26927
  const path2 = pinsFile();
26781
- if (!(0, import_node_fs53.existsSync)(path2)) return [];
26928
+ if (!(0, import_node_fs54.existsSync)(path2)) return [];
26782
26929
  try {
26783
- const raw = JSON.parse((0, import_node_fs53.readFileSync)(path2, "utf8"));
26930
+ const raw = JSON.parse((0, import_node_fs54.readFileSync)(path2, "utf8"));
26784
26931
  if (raw?.version !== VERSION || !Array.isArray(raw.items)) return [];
26785
26932
  return raw.items.filter((item) => item?.id && item.kind && item.ref);
26786
26933
  } catch {
@@ -26788,8 +26935,8 @@ function readDisk() {
26788
26935
  }
26789
26936
  }
26790
26937
  function writeDisk(items) {
26791
- (0, import_node_fs53.mkdirSync)(appDataDir(), { recursive: true });
26792
- (0, import_node_fs53.writeFileSync)(pinsFile(), JSON.stringify({ version: VERSION, items }, null, 2), "utf8");
26938
+ (0, import_node_fs54.mkdirSync)(appDataDir(), { recursive: true });
26939
+ (0, import_node_fs54.writeFileSync)(pinsFile(), JSON.stringify({ version: VERSION, items }, null, 2), "utf8");
26793
26940
  }
26794
26941
  function listBoardPins() {
26795
26942
  return readDisk();
@@ -26841,7 +26988,7 @@ function replaceBoardPins(items) {
26841
26988
  }
26842
26989
  function clearBoardPins() {
26843
26990
  try {
26844
- (0, import_node_fs53.unlinkSync)(pinsFile());
26991
+ (0, import_node_fs54.unlinkSync)(pinsFile());
26845
26992
  } catch {
26846
26993
  }
26847
26994
  }
@@ -26858,7 +27005,7 @@ function homeBoardWorkspaceKey(workspaces) {
26858
27005
  return workspaces.map((w) => w.path).filter(Boolean).sort().join("\n");
26859
27006
  }
26860
27007
  function cacheFile() {
26861
- return (0, import_node_path50.join)(appDataDir(), "home-board-cache.json");
27008
+ return (0, import_node_path51.join)(appDataDir(), "home-board-cache.json");
26862
27009
  }
26863
27010
  function emptyInputs() {
26864
27011
  return {
@@ -26884,9 +27031,9 @@ function shouldCacheHomeBoardInputs(inputs) {
26884
27031
  }
26885
27032
  function readDiskCache() {
26886
27033
  const path2 = cacheFile();
26887
- if (!(0, import_node_fs54.existsSync)(path2)) return null;
27034
+ if (!(0, import_node_fs55.existsSync)(path2)) return null;
26888
27035
  try {
26889
- const raw = JSON.parse((0, import_node_fs54.readFileSync)(path2, "utf8"));
27036
+ const raw = JSON.parse((0, import_node_fs55.readFileSync)(path2, "utf8"));
26890
27037
  if (raw?.version !== CACHE_VERSION || typeof raw.fetchedAt !== "number") {
26891
27038
  return null;
26892
27039
  }
@@ -26900,14 +27047,14 @@ function readDiskCache() {
26900
27047
  }
26901
27048
  function writeDiskCache(entry) {
26902
27049
  try {
26903
- (0, import_node_fs54.mkdirSync)(appDataDir(), { recursive: true });
26904
- (0, import_node_fs54.writeFileSync)(cacheFile(), JSON.stringify(entry), "utf8");
27050
+ (0, import_node_fs55.mkdirSync)(appDataDir(), { recursive: true });
27051
+ (0, import_node_fs55.writeFileSync)(cacheFile(), JSON.stringify(entry), "utf8");
26905
27052
  } catch {
26906
27053
  }
26907
27054
  }
26908
27055
  function deleteDiskCache() {
26909
27056
  try {
26910
- (0, import_node_fs54.unlinkSync)(cacheFile());
27057
+ (0, import_node_fs55.unlinkSync)(cacheFile());
26911
27058
  } catch {
26912
27059
  }
26913
27060
  }
@@ -27043,6 +27190,52 @@ async function getHomeBoardInputs(workspaces, opts) {
27043
27190
 
27044
27191
  // src/mcp/server.ts
27045
27192
  init_home_board();
27193
+
27194
+ // src/mcp/create-thread-agent.ts
27195
+ function resolveOrchCreateThreadOptions(input) {
27196
+ const { resolveNewThreadOptions: resolveNewThreadOptions2 } = input;
27197
+ const account = resolveNewThreadOptions2({});
27198
+ const requested = input.requestedAgent;
27199
+ const parent = input.parentAgent ?? void 0;
27200
+ let agent = account.agent;
27201
+ let ignoredAgent;
27202
+ let honorRequestedModel = false;
27203
+ if (requested) {
27204
+ const parentEcho = Boolean(parent) && requested === parent && requested !== account.agent;
27205
+ const cursorAutofill = requested === "cursor" && account.agent !== "cursor";
27206
+ if (parentEcho || cursorAutofill) {
27207
+ ignoredAgent = requested;
27208
+ } else {
27209
+ agent = requested;
27210
+ honorRequestedModel = input.requestedModel !== void 0;
27211
+ }
27212
+ }
27213
+ let coercedFrom;
27214
+ if (agent === "codex" && parent === "codex") {
27215
+ coercedFrom = requested ?? "codex";
27216
+ agent = "cursor";
27217
+ }
27218
+ const opts = resolveNewThreadOptions2({
27219
+ agent,
27220
+ model: honorRequestedModel ? input.requestedModel : void 0
27221
+ });
27222
+ return {
27223
+ ...opts,
27224
+ ...ignoredAgent ? { ignoredAgent } : {},
27225
+ ...coercedFrom ? { coercedFrom } : {}
27226
+ };
27227
+ }
27228
+ function orchCreateThreadAgentNote(input) {
27229
+ if (input.coercedFrom) {
27230
+ return `Avoid nested Codex under a Codex orchestrator \u2014 used Account default agent=${input.agent}`;
27231
+ }
27232
+ if (input.ignoredAgent) {
27233
+ return `Ignored agent=${input.ignoredAgent} \u2014 used Account default agent=${input.agent}`;
27234
+ }
27235
+ return void 0;
27236
+ }
27237
+
27238
+ // src/mcp/server.ts
27046
27239
  var MAX_ORCH_THREADS = 5;
27047
27240
  var CREATE_THREAD_TIMEOUT_MS = 9e4;
27048
27241
  function withTimeout(promise, ms, label) {
@@ -27090,18 +27283,13 @@ async function createOrchChildThread(orch, args, resolveNewThreadOptions2) {
27090
27283
  };
27091
27284
  }
27092
27285
  }
27093
- let agentArg = args.agent;
27094
- let agentCoercedFrom;
27095
- const resolvedProbe = resolveNewThreadOptions2({ agent: agentArg }).agent;
27096
- if (resolvedProbe === "codex") {
27097
- agentCoercedFrom = agentArg ?? "codex";
27098
- const accountAgent = resolveNewThreadOptions2({}).agent;
27099
- agentArg = accountAgent !== "codex" ? accountAgent : "cursor";
27100
- }
27101
- const opts = resolveNewThreadOptions2({
27102
- agent: agentArg,
27103
- model: args.model
27286
+ const opts = resolveOrchCreateThreadOptions({
27287
+ requestedAgent: args.agent,
27288
+ requestedModel: args.model,
27289
+ parentAgent: parent?.agent,
27290
+ resolveNewThreadOptions: resolveNewThreadOptions2
27104
27291
  });
27292
+ const agentNote = orchCreateThreadAgentNote(opts);
27105
27293
  try {
27106
27294
  const priorIds = new Set(orch.getThreads(false).map((t) => t.id));
27107
27295
  const thread = await withTimeout(
@@ -27137,10 +27325,9 @@ async function createOrchChildThread(orch, args, resolveNewThreadOptions2) {
27137
27325
  link: `sideboard://thread/${thread.id}`,
27138
27326
  parentThreadId: thread.parentThreadId,
27139
27327
  ...alreadyStarted ? { alreadyStarted: true } : {},
27140
- ...agentCoercedFrom ? {
27141
- agentCoercedFrom,
27142
- note: `Avoid nested Codex under a Codex orchestrator \u2014 used Account default agent=${thread.agent}`
27143
- } : {},
27328
+ ...opts.coercedFrom ? { agentCoercedFrom: opts.coercedFrom } : {},
27329
+ ...opts.ignoredAgent ? { agentIgnored: opts.ignoredAgent } : {},
27330
+ ...agentNote ? { note: agentNote } : {},
27144
27331
  ...parentCorrectedFrom ? { parentCorrectedFrom, parentNote } : {}
27145
27332
  })
27146
27333
  };
@@ -27215,7 +27402,7 @@ async function startMcpServer() {
27215
27402
  async () => {
27216
27403
  const threads = orch.getThreads(true);
27217
27404
  const lines = threads.map((t) => {
27218
- const repo = t.repoPath === GLOBAL_WORKSPACE_ID ? "Orchestration" : (0, import_node_path51.basename)(t.repoPath) || t.repoPath;
27405
+ const repo = t.repoPath === GLOBAL_WORKSPACE_ID ? "Orchestration" : (0, import_node_path52.basename)(t.repoPath) || t.repoPath;
27219
27406
  const live = orch.threadLooksLive(t) ? readTurnLive(t.id) : null;
27220
27407
  const parent = t.parentThreadId ? ` parent:${t.parentThreadId.slice(0, 8)}` : "";
27221
27408
  const preview = lastMessagePreview(t.messages, 80);
@@ -27500,11 +27687,13 @@ async function startMcpServer() {
27500
27687
  );
27501
27688
  server.tool(
27502
27689
  "create_thread",
27503
- `Create a worktree thread (chat) from branch, pr, or ticket. A ticket, PR, or named branch may have only one live worktree \u2014 if one already matches, returns it (alreadyStarted=true) instead of a second checkout. Creating from the default branch still opens a new isolated worktree. Pass repoPath from list_workspaces. cowboy=true uses the project folder on the default branch (no isolated worktree; land is commit+push). From an orchestration chat, omit parentThreadId (Sideboard binds the child to this chat) or pass the exact id from the turn reminder \u2014 never invent a uuid. Prefer omitting agent/model so Sideboard applies ${accountDefaultsHint}. Setup (settings.toml, .cursor/worktrees.json, or script/setup) runs in the background in parallel with the first turn (skipped for cowboy). Then use send_to_thread to chat.`,
27690
+ `Create a worktree thread (chat) from branch, pr, or ticket. A ticket, PR, or named branch may have only one live worktree \u2014 if one already matches, returns it (alreadyStarted=true) instead of a second checkout. Creating from the default branch still opens a new isolated worktree. Pass repoPath from list_workspaces. cowboy=true uses the project folder on the default branch (no isolated worktree; land is commit+push). From an orchestration chat, omit parentThreadId (Sideboard binds the child to this chat) or pass the exact id from the turn reminder \u2014 never invent a uuid. Omit agent/model \u2014 Sideboard applies ${accountDefaultsHint}. Do not pass your own agent or agent=cursor; those are ignored. Setup (settings.toml, .cursor/worktrees.json, or script/setup) runs in the background in parallel with the first turn (skipped for cowboy). Then use send_to_thread to chat.`,
27504
27691
  {
27505
27692
  sourceType: import_zod8.z.enum(["branch", "pr", "ticket"]),
27506
27693
  sourceRef: import_zod8.z.string(),
27507
- agent: import_zod8.z.enum(["claude", "codex", "opencode", "brightsy", "cursor"]).optional().describe(`Omit to use Account default agent (${accountDefaults.agent})`),
27694
+ agent: import_zod8.z.enum(["claude", "codex", "opencode", "brightsy", "cursor"]).optional().describe(
27695
+ `Usually omit. Sideboard uses Account default agent (${accountDefaults.agent}). Passing your own agent or cursor is ignored.`
27696
+ ),
27508
27697
  model: import_zod8.z.string().nullable().optional().describe(
27509
27698
  `Usually omit to use Account default model (${accountDefaults.model?.trim() || "Auto"}). Pass null only to force Auto / agent-default.`
27510
27699
  ),
@@ -30175,9 +30364,9 @@ var import_node_http3 = require("http");
30175
30364
  var import_ws3 = require("ws");
30176
30365
 
30177
30366
  // src/slack/relay-static.ts
30178
- var import_node_fs55 = require("fs");
30367
+ var import_node_fs56 = require("fs");
30179
30368
  var import_promises = require("fs/promises");
30180
- var import_node_path52 = __toESM(require("path"), 1);
30369
+ var import_node_path53 = __toESM(require("path"), 1);
30181
30370
  var TYPES = {
30182
30371
  ".css": "text/css; charset=utf-8",
30183
30372
  ".html": "text/html; charset=utf-8",
@@ -30208,9 +30397,9 @@ function resolveStaticPath(root, requestUrl) {
30208
30397
  return null;
30209
30398
  }
30210
30399
  if (!pathname.startsWith("/") || pathname.includes("\0")) return null;
30211
- const rootResolved = import_node_path52.default.resolve(root);
30212
- const candidate = import_node_path52.default.resolve(rootResolved, `.${pathname}`);
30213
- if (candidate !== rootResolved && !candidate.startsWith(rootResolved + import_node_path52.default.sep)) {
30400
+ const rootResolved = import_node_path53.default.resolve(root);
30401
+ const candidate = import_node_path53.default.resolve(rootResolved, `.${pathname}`);
30402
+ if (candidate !== rootResolved && !candidate.startsWith(rootResolved + import_node_path53.default.sep)) {
30214
30403
  return null;
30215
30404
  }
30216
30405
  return candidate;
@@ -30224,7 +30413,7 @@ async function fileSize(file) {
30224
30413
  }
30225
30414
  }
30226
30415
  function sendFile(req, res, file, size) {
30227
- const ext = import_node_path52.default.extname(file).toLowerCase();
30416
+ const ext = import_node_path53.default.extname(file).toLowerCase();
30228
30417
  res.writeHead(200, {
30229
30418
  "Content-Type": TYPES[ext] ?? "application/octet-stream",
30230
30419
  "Content-Length": size,
@@ -30234,7 +30423,7 @@ function sendFile(req, res, file, size) {
30234
30423
  res.end();
30235
30424
  return true;
30236
30425
  }
30237
- (0, import_node_fs55.createReadStream)(file).pipe(res);
30426
+ (0, import_node_fs56.createReadStream)(file).pipe(res);
30238
30427
  return true;
30239
30428
  }
30240
30429
  async function tryServeStatic(req, res, root) {
@@ -30243,7 +30432,7 @@ async function tryServeStatic(req, res, root) {
30243
30432
  if (!candidate) return false;
30244
30433
  const direct = await fileSize(candidate);
30245
30434
  if (direct != null) return sendFile(req, res, candidate, direct);
30246
- const asIndex = import_node_path52.default.join(candidate, "index.html");
30435
+ const asIndex = import_node_path53.default.join(candidate, "index.html");
30247
30436
  const indexSize = await fileSize(asIndex);
30248
30437
  if (indexSize != null) return sendFile(req, res, asIndex, indexSize);
30249
30438
  return false;
@@ -30593,6 +30782,7 @@ init_outbound_watch();
30593
30782
  applyForwardOccupancy,
30594
30783
  applyGithubGitAuthEnv,
30595
30784
  applyPromptCacheTtlEnv,
30785
+ applySystemCaEnv,
30596
30786
  applyThreadIntoMain,
30597
30787
  applyTurnUsage,
30598
30788
  armSchedules,
@@ -30971,6 +31161,7 @@ init_outbound_watch();
30971
31161
  lookupSoccerTeam,
30972
31162
  mapAbleTimeTask,
30973
31163
  markPrReady,
31164
+ materializeSystemCaBundle,
30974
31165
  maxConcurrentAgents,
30975
31166
  maybeCompactContext,
30976
31167
  mcpAllowTools,
@@ -31194,6 +31385,7 @@ init_outbound_watch();
31194
31385
  toolDetail,
31195
31386
  toolFilePath,
31196
31387
  totalTokens,
31388
+ trustSystemCertificates,
31197
31389
  turnCostUsdFromCursorUsage,
31198
31390
  updateAbleTimeTask,
31199
31391
  updateAdvancedSettings,