@sideboard-ai/core 0.1.173 → 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 (44) 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-CTWLBPCV.js → agents-2W7LP7JR.js} +6 -6
  6. package/dist/{agents-7UTRNLXQ.js → agents-AWSFDB47.js} +7 -7
  7. package/dist/{chunk-QYZYDO3F.js → chunk-7JIYKYLL.js} +26 -5
  8. package/dist/{chunk-PXNOT6NV.js → chunk-7O53GXTA.js} +26 -5
  9. package/dist/{chunk-M267JPEA.js → chunk-AN3THU7F.js} +1 -1
  10. package/dist/{chunk-AQPVBVJE.js → chunk-BBNUL4IE.js} +1 -1
  11. package/dist/{chunk-LZ6QMEQC.js → chunk-HVIEYTUK.js} +1 -1
  12. package/dist/{chunk-XD2BAANL.js → chunk-IEEAVWAP.js} +6 -6
  13. package/dist/{chunk-WE34LOLO.js → chunk-JIWRBNSO.js} +22 -21
  14. package/dist/{chunk-ELBYOGVA.js → chunk-N7WZ6NIN.js} +10 -1
  15. package/dist/{chunk-2RM6BZQ2.js → chunk-NA7P3SZL.js} +4 -4
  16. package/dist/{chunk-XXIH6XYR.js → chunk-NQTKRAUF.js} +167 -35
  17. package/dist/{chunk-3F7AXVIL.js → chunk-QTJ2ERA6.js} +6 -6
  18. package/dist/{chunk-SKKEJZEX.js → chunk-RCICB4OM.js} +19 -18
  19. package/dist/{chunk-CMJ2FBBV.js → chunk-RE2YWFUQ.js} +1 -1
  20. package/dist/{chunk-234EKD2F.js → chunk-TNOLCU5B.js} +4 -4
  21. package/dist/{chunk-6GN5WPYZ.js → chunk-VKQGAWHY.js} +10 -1
  22. package/dist/{chunk-S42XV45P.js → chunk-Y4MIXGPA.js} +1 -1
  23. package/dist/{chunk-6X6KMUI2.js → chunk-ZXHV3NHY.js} +225 -96
  24. package/dist/{connected-teams-DBWAMP7G.js → connected-teams-ON2KIKQX.js} +3 -3
  25. package/dist/{connected-teams-WGONUQOF.js → connected-teams-WOYCH7FR.js} +3 -3
  26. package/dist/{coordinator-prompt-7CTI6HRH.js → coordinator-prompt-7OHKB5WV.js} +2 -2
  27. package/dist/{coordinator-prompt-PM6MPYYB.js → coordinator-prompt-XCQCGUED.js} +2 -2
  28. package/dist/{global-workspace-CMYSFRCM.js → global-workspace-KPROJ54C.js} +2 -2
  29. package/dist/{global-workspace-CRJ6ZVIY.js → global-workspace-WSQNEALF.js} +2 -2
  30. package/dist/index.cjs +600 -386
  31. package/dist/index.d.cts +49 -8
  32. package/dist/index.d.ts +49 -8
  33. package/dist/index.js +74 -28
  34. package/dist/mcp/run-stdio.cjs +795 -581
  35. package/dist/mcp/run-stdio.js +75 -26
  36. package/dist/{oauth-A7XXI2TM.js → oauth-6ZQ4Q4XN.js} +2 -2
  37. package/dist/{oauth-YJBAURIJ.js → oauth-O7UGLZOY.js} +2 -2
  38. package/dist/{orchestrator-PEOUSLAY.js → orchestrator-PDEU75EE.js} +8 -8
  39. package/dist/{orchestrator-QBB2RELD.js → orchestrator-QSNGJ2ER.js} +7 -7
  40. package/dist/{workspaces-L73MCDFA.js → workspaces-P66DGCZE.js} +2 -2
  41. package/dist/{workspaces-UYSD2STS.js → workspaces-TEBTNS2M.js} +2 -2
  42. package/dist/{worktree-SQD3DBYC.js → worktree-LC4VRWDM.js} +1 -1
  43. package/dist/{worktree-WVEDT3FM.js → worktree-UTDBQXSS.js} +1 -1
  44. package/package.json +1 -1
@@ -491,24 +491,156 @@ var init_paths = __esm({
491
491
  }
492
492
  });
493
493
 
494
+ // src/http/system-ca.ts
495
+ function splitPemCertificates(pem) {
496
+ return pem.match(PEM_CERT_RE) ?? [];
497
+ }
498
+ function readExistingFile(path) {
499
+ try {
500
+ return (0, import_node_fs5.existsSync)(path) ? (0, import_node_fs5.readFileSync)(path, "utf8") : "";
501
+ } catch {
502
+ return "";
503
+ }
504
+ }
505
+ function darwinKeychainPem(spawn2) {
506
+ const result = spawn2("/usr/bin/security", ["find-certificate", "-a", "-p"], {
507
+ encoding: "utf8",
508
+ maxBuffer: 32 * 1024 * 1024,
509
+ timeout: 15e3
510
+ });
511
+ if (result.status !== 0) return "";
512
+ return typeof result.stdout === "string" ? result.stdout : "";
513
+ }
514
+ function linuxSystemCaPem() {
515
+ for (const path of LINUX_CA_FILES) {
516
+ const pem = readExistingFile(path);
517
+ if (splitPemCertificates(pem).length > 0) return pem;
518
+ }
519
+ return "";
520
+ }
521
+ function collectSystemCaPem(io = {}) {
522
+ const platform = io.platform ?? process.platform;
523
+ if (platform === "darwin") {
524
+ return darwinKeychainPem(io.spawn ?? import_node_child_process.spawnSync);
525
+ }
526
+ if (platform === "linux") {
527
+ return linuxSystemCaPem();
528
+ }
529
+ return "";
530
+ }
531
+ function systemCaBundlePath(io = {}) {
532
+ return (0, import_node_path6.join)((io.appData ?? appDataDir)(), BUNDLE_NAME);
533
+ }
534
+ function bundleIsFresh(path, now) {
535
+ try {
536
+ if (!(0, import_node_fs5.existsSync)(path)) return false;
537
+ if (splitPemCertificates((0, import_node_fs5.readFileSync)(path, "utf8")).length === 0) return false;
538
+ return now - (0, import_node_fs5.statSync)(path).mtimeMs < BUNDLE_MAX_AGE_MS;
539
+ } catch {
540
+ return false;
541
+ }
542
+ }
543
+ function materializeSystemCaBundle(io = {}) {
544
+ const inherited = process.env.NODE_EXTRA_CA_CERTS?.trim();
545
+ if (inherited && splitPemCertificates(readExistingFile(inherited)).length > 0) {
546
+ return inherited;
547
+ }
548
+ const platform = io.platform ?? process.platform;
549
+ if (platform === "linux") {
550
+ for (const path of LINUX_CA_FILES) {
551
+ if (splitPemCertificates(readExistingFile(path)).length > 0) return path;
552
+ }
553
+ }
554
+ const dest = systemCaBundlePath(io);
555
+ const now = (io.now ?? Date.now)();
556
+ if (bundleIsFresh(dest, now)) return dest;
557
+ const pem = collectSystemCaPem(io);
558
+ if (splitPemCertificates(pem).length === 0) {
559
+ return (0, import_node_fs5.existsSync)(dest) && splitPemCertificates(readExistingFile(dest)).length > 0 ? dest : void 0;
560
+ }
561
+ try {
562
+ (0, import_node_fs5.mkdirSync)((0, import_node_path6.dirname)(dest), { recursive: true });
563
+ (0, import_node_fs5.writeFileSync)(dest, pem.endsWith("\n") ? pem : `${pem}
564
+ `, { mode: 384 });
565
+ return dest;
566
+ } catch {
567
+ return void 0;
568
+ }
569
+ }
570
+ function applySystemCaEnv(env) {
571
+ if (!String(env[NODE_USE_SYSTEM_CA] ?? "").trim()) {
572
+ env[NODE_USE_SYSTEM_CA] = "1";
573
+ }
574
+ if (String(env[NODE_EXTRA_CA_CERTS] ?? "").trim()) return;
575
+ const inherited = process.env.NODE_EXTRA_CA_CERTS?.trim();
576
+ if (inherited) env[NODE_EXTRA_CA_CERTS] = inherited;
577
+ }
578
+ function extraCertsFromBundle() {
579
+ const path = process.env.NODE_EXTRA_CA_CERTS?.trim();
580
+ if (path) return splitPemCertificates(readExistingFile(path));
581
+ const dest = systemCaBundlePath();
582
+ return splitPemCertificates(readExistingFile(dest));
583
+ }
584
+ function trustSystemCertificates(io = {}) {
585
+ try {
586
+ const api = import_node_tls.default;
587
+ if (typeof api.getCACertificates !== "function" || typeof api.setDefaultCACertificates !== "function") {
588
+ return false;
589
+ }
590
+ const current = api.getCACertificates("default");
591
+ const system = api.getCACertificates("system");
592
+ let extra = extraCertsFromBundle();
593
+ if (system.length === 0 && extra.length === 0) {
594
+ extra = splitPemCertificates(collectSystemCaPem(io));
595
+ }
596
+ if (system.length === 0 && extra.length === 0) return false;
597
+ api.setDefaultCACertificates([...current, ...system, ...extra]);
598
+ return true;
599
+ } catch {
600
+ return false;
601
+ }
602
+ }
603
+ var import_node_child_process, import_node_fs5, import_node_path6, import_node_tls, NODE_USE_SYSTEM_CA, NODE_EXTRA_CA_CERTS, BUNDLE_NAME, BUNDLE_MAX_AGE_MS, LINUX_CA_FILES, PEM_CERT_RE;
604
+ var init_system_ca = __esm({
605
+ "src/http/system-ca.ts"() {
606
+ "use strict";
607
+ import_node_child_process = require("child_process");
608
+ import_node_fs5 = require("fs");
609
+ import_node_path6 = require("path");
610
+ import_node_tls = __toESM(require("tls"), 1);
611
+ init_paths();
612
+ NODE_USE_SYSTEM_CA = "NODE_USE_SYSTEM_CA";
613
+ NODE_EXTRA_CA_CERTS = "NODE_EXTRA_CA_CERTS";
614
+ BUNDLE_NAME = "system-ca.pem";
615
+ BUNDLE_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
616
+ LINUX_CA_FILES = [
617
+ "/etc/ssl/certs/ca-certificates.crt",
618
+ "/etc/pki/tls/certs/ca-bundle.crt",
619
+ "/etc/ssl/ca-bundle.pem",
620
+ "/etc/ssl/cert.pem"
621
+ ];
622
+ PEM_CERT_RE = /-----BEGIN CERTIFICATE-----[\s\S]*?-----END CERTIFICATE-----/g;
623
+ }
624
+ });
625
+
494
626
  // src/store/private-file.ts
495
627
  function writePrivateFile(path, contents) {
496
- (0, import_node_fs5.mkdirSync)((0, import_node_path6.dirname)(path), { recursive: true });
497
- (0, import_node_fs5.writeFileSync)(path, contents, { encoding: "utf8", mode: PRIVATE_FILE_MODE });
628
+ (0, import_node_fs6.mkdirSync)((0, import_node_path7.dirname)(path), { recursive: true });
629
+ (0, import_node_fs6.writeFileSync)(path, contents, { encoding: "utf8", mode: PRIVATE_FILE_MODE });
498
630
  chmodOwnerOnly(path);
499
631
  }
500
632
  function chmodOwnerOnly(path) {
501
633
  try {
502
- (0, import_node_fs5.chmodSync)(path, PRIVATE_FILE_MODE);
634
+ (0, import_node_fs6.chmodSync)(path, PRIVATE_FILE_MODE);
503
635
  } catch {
504
636
  }
505
637
  }
506
- var import_node_fs5, import_node_path6, PRIVATE_FILE_MODE;
638
+ var import_node_fs6, import_node_path7, PRIVATE_FILE_MODE;
507
639
  var init_private_file = __esm({
508
640
  "src/store/private-file.ts"() {
509
641
  "use strict";
510
- import_node_fs5 = require("fs");
511
- import_node_path6 = require("path");
642
+ import_node_fs6 = require("fs");
643
+ import_node_path7 = require("path");
512
644
  PRIVATE_FILE_MODE = 384;
513
645
  }
514
646
  });
@@ -517,7 +649,7 @@ var init_private_file = __esm({
517
649
  function persistVaultKeyInKeychain(key) {
518
650
  if (process.platform !== "darwin" || key.length !== 32) return;
519
651
  try {
520
- (0, import_node_child_process.execFileSync)(
652
+ (0, import_node_child_process2.execFileSync)(
521
653
  "security",
522
654
  [
523
655
  "add-generic-password",
@@ -542,7 +674,7 @@ function hexKey(value) {
542
674
  function keychainKey(create) {
543
675
  if (process.platform !== "darwin") return null;
544
676
  try {
545
- const out = (0, import_node_child_process.execFileSync)(
677
+ const out = (0, import_node_child_process2.execFileSync)(
546
678
  "security",
547
679
  ["find-generic-password", "-s", KEYCHAIN_SERVICE, "-a", KEYCHAIN_ACCOUNT, "-w"],
548
680
  { encoding: "utf8", timeout: 5e3, stdio: ["ignore", "pipe", "pipe"] }
@@ -594,11 +726,11 @@ function decryptEnvelope(envelope, key) {
594
726
  return JSON.parse(plaintext.toString("utf8"));
595
727
  }
596
728
  function readSecureJson(path) {
597
- if (!(0, import_node_fs6.existsSync)(path)) return null;
729
+ if (!(0, import_node_fs7.existsSync)(path)) return null;
598
730
  chmodOwnerOnly(path);
599
731
  let parsed;
600
732
  try {
601
- parsed = JSON.parse((0, import_node_fs6.readFileSync)(path, "utf8"));
733
+ parsed = JSON.parse((0, import_node_fs7.readFileSync)(path, "utf8"));
602
734
  } catch {
603
735
  return null;
604
736
  }
@@ -618,20 +750,20 @@ function writeSecureJson(path, value) {
618
750
  `);
619
751
  }
620
752
  function isSecureFileEncrypted(path) {
621
- if (!(0, import_node_fs6.existsSync)(path)) return false;
753
+ if (!(0, import_node_fs7.existsSync)(path)) return false;
622
754
  try {
623
- return isEnvelope(JSON.parse((0, import_node_fs6.readFileSync)(path, "utf8")));
755
+ return isEnvelope(JSON.parse((0, import_node_fs7.readFileSync)(path, "utf8")));
624
756
  } catch {
625
757
  return false;
626
758
  }
627
759
  }
628
- var import_node_child_process, import_node_crypto, import_node_fs6, KEYCHAIN_SERVICE, KEYCHAIN_ACCOUNT, ALG, injectedKey;
760
+ var import_node_child_process2, import_node_crypto, import_node_fs7, KEYCHAIN_SERVICE, KEYCHAIN_ACCOUNT, ALG, injectedKey;
629
761
  var init_secure_file = __esm({
630
762
  "src/store/secure-file.ts"() {
631
763
  "use strict";
632
- import_node_child_process = require("child_process");
764
+ import_node_child_process2 = require("child_process");
633
765
  import_node_crypto = require("crypto");
634
- import_node_fs6 = require("fs");
766
+ import_node_fs7 = require("fs");
635
767
  init_private_file();
636
768
  KEYCHAIN_SERVICE = "ai.sideboard.app";
637
769
  KEYCHAIN_ACCOUNT = "secret-vault-v1";
@@ -756,7 +888,7 @@ function createEmptyThread(partial) {
756
888
  }
757
889
  async function withThreadLock(id, fn) {
758
890
  const lockPath = threadLockPath(id);
759
- (0, import_node_fs7.writeFileSync)(lockPath, "", { flag: "a" });
891
+ (0, import_node_fs8.writeFileSync)(lockPath, "", { flag: "a" });
760
892
  let release;
761
893
  try {
762
894
  release = await import_proper_lockfile.default.lock(lockPath, {
@@ -777,7 +909,7 @@ function cacheForDir() {
777
909
  }
778
910
  function fileMtimeMs(path) {
779
911
  try {
780
- return (0, import_node_fs7.statSync)(path).mtimeMs;
912
+ return (0, import_node_fs8.statSync)(path).mtimeMs;
781
913
  } catch {
782
914
  return null;
783
915
  }
@@ -805,7 +937,7 @@ function readThread(id) {
805
937
  const cache = cacheForDir();
806
938
  const cached = cache.byId.get(id);
807
939
  if (cached && cache.mtimeMs.get(id) === mtimeMs) return cached;
808
- const raw = (0, import_node_fs7.readFileSync)(path, "utf8");
940
+ const raw = (0, import_node_fs8.readFileSync)(path, "utf8");
809
941
  const thread = normalizeThread(JSON.parse(raw));
810
942
  rememberThread(thread, mtimeMs);
811
943
  return thread;
@@ -814,20 +946,20 @@ function writeThread(thread) {
814
946
  const path = threadFilePath(idPath(thread.id));
815
947
  const tmp = `${path}.${process.pid}.tmp`;
816
948
  const next = { ...thread, updatedAt: nowIso() };
817
- (0, import_node_fs7.writeFileSync)(tmp, JSON.stringify(next, null, 2), "utf8");
818
- (0, import_node_fs7.renameSync)(tmp, path);
949
+ (0, import_node_fs8.writeFileSync)(tmp, JSON.stringify(next, null, 2), "utf8");
950
+ (0, import_node_fs8.renameSync)(tmp, path);
819
951
  rememberThread(next, fileMtimeMs(path) ?? Date.now());
820
952
  }
821
953
  function idPath(id) {
822
954
  return id;
823
955
  }
824
956
  function isThreadRecordFile(nameOrPath) {
825
- const name = (0, import_node_path7.basename)(nameOrPath);
957
+ const name = (0, import_node_path8.basename)(nameOrPath);
826
958
  return name.endsWith(".json") && !name.endsWith(".live.json");
827
959
  }
828
960
  function listThreads(opts) {
829
961
  const cache = cacheForDir();
830
- const files = (0, import_node_fs7.readdirSync)(threadsDir()).filter(isThreadRecordFile);
962
+ const files = (0, import_node_fs8.readdirSync)(threadsDir()).filter(isThreadRecordFile);
831
963
  const seen = /* @__PURE__ */ new Set();
832
964
  for (const f of files) {
833
965
  const id = f.replace(/\.json$/, "");
@@ -850,11 +982,11 @@ function listThreads(opts) {
850
982
  function deleteThreadRecord(id) {
851
983
  forgetThread(id);
852
984
  const path = threadFilePath(id);
853
- if ((0, import_node_fs7.existsSync)(path)) (0, import_node_fs7.unlinkSync)(path);
985
+ if ((0, import_node_fs8.existsSync)(path)) (0, import_node_fs8.unlinkSync)(path);
854
986
  const lock = threadLockPath(id);
855
- if ((0, import_node_fs7.existsSync)(lock)) {
987
+ if ((0, import_node_fs8.existsSync)(lock)) {
856
988
  try {
857
- (0, import_node_fs7.unlinkSync)(lock);
989
+ (0, import_node_fs8.unlinkSync)(lock);
858
990
  } catch {
859
991
  }
860
992
  }
@@ -880,13 +1012,13 @@ function findThreadByRef(ref) {
880
1012
  (t) => t.id === ref || t.id.startsWith(ref) || t.branchName === ref || t.title === ref
881
1013
  ) ?? null;
882
1014
  }
883
- var import_node_crypto2, import_node_fs7, import_node_path7, import_proper_lockfile, listCache;
1015
+ var import_node_crypto2, import_node_fs8, import_node_path8, import_proper_lockfile, listCache;
884
1016
  var init_thread_store = __esm({
885
1017
  "src/store/thread-store.ts"() {
886
1018
  "use strict";
887
1019
  import_node_crypto2 = require("crypto");
888
- import_node_fs7 = require("fs");
889
- import_node_path7 = require("path");
1020
+ import_node_fs8 = require("fs");
1021
+ import_node_path8 = require("path");
890
1022
  import_proper_lockfile = __toESM(require("proper-lockfile"), 1);
891
1023
  init_thinking_effort();
892
1024
  init_paths();
@@ -938,13 +1070,13 @@ var init_api = __esm({
938
1070
 
939
1071
  // src/slack/reply-target.ts
940
1072
  function storePath() {
941
- return (0, import_node_path8.join)(appDataDir(), "slack-reply-to.json");
1073
+ return (0, import_node_path9.join)(appDataDir(), "slack-reply-to.json");
942
1074
  }
943
1075
  function readStore() {
944
1076
  const path = storePath();
945
- if (!(0, import_node_fs8.existsSync)(path)) return {};
1077
+ if (!(0, import_node_fs9.existsSync)(path)) return {};
946
1078
  try {
947
- const parsed = isSecureFileEncrypted(path) ? readSecureJson(path) : JSON.parse((0, import_node_fs8.readFileSync)(path, "utf8"));
1079
+ const parsed = isSecureFileEncrypted(path) ? readSecureJson(path) : JSON.parse((0, import_node_fs9.readFileSync)(path, "utf8"));
948
1080
  return parsed?.targets && typeof parsed.targets === "object" ? parsed.targets : {};
949
1081
  } catch {
950
1082
  return {};
@@ -953,12 +1085,12 @@ function readStore() {
953
1085
  function getSlackReplyTarget(threadId) {
954
1086
  return readStore()[threadId] ?? null;
955
1087
  }
956
- var import_node_fs8, import_node_path8;
1088
+ var import_node_fs9, import_node_path9;
957
1089
  var init_reply_target = __esm({
958
1090
  "src/slack/reply-target.ts"() {
959
1091
  "use strict";
960
- import_node_fs8 = require("fs");
961
- import_node_path8 = require("path");
1092
+ import_node_fs9 = require("fs");
1093
+ import_node_path9 = require("path");
962
1094
  init_paths();
963
1095
  init_private_file();
964
1096
  init_secure_file();
@@ -967,7 +1099,7 @@ var init_reply_target = __esm({
967
1099
 
968
1100
  // src/slack/workspaces.ts
969
1101
  function storePath2() {
970
- return (0, import_node_path9.join)(appDataDir(), "slack-workspaces.json");
1102
+ return (0, import_node_path10.join)(appDataDir(), "slack-workspaces.json");
971
1103
  }
972
1104
  function readStore2() {
973
1105
  try {
@@ -1028,11 +1160,11 @@ function requireSlackWorkspace(teamId) {
1028
1160
  }
1029
1161
  return ws;
1030
1162
  }
1031
- var import_node_path9;
1163
+ var import_node_path10;
1032
1164
  var init_workspaces = __esm({
1033
1165
  "src/slack/workspaces.ts"() {
1034
1166
  "use strict";
1035
- import_node_path9 = require("path");
1167
+ import_node_path10 = require("path");
1036
1168
  init_paths();
1037
1169
  init_secure_file();
1038
1170
  init_api();
@@ -1041,7 +1173,7 @@ var init_workspaces = __esm({
1041
1173
 
1042
1174
  // src/slack/outbound-watch.ts
1043
1175
  function storePath3() {
1044
- return (0, import_node_path10.join)(appDataDir(), "slack-outbound-watch.json");
1176
+ return (0, import_node_path11.join)(appDataDir(), "slack-outbound-watch.json");
1045
1177
  }
1046
1178
  function watchId(teamId, channelId, ts) {
1047
1179
  return `${teamId}:${channelId}:${ts}`;
@@ -1054,9 +1186,9 @@ function tsNewer(a, b) {
1054
1186
  }
1055
1187
  function readStore3() {
1056
1188
  const path = storePath3();
1057
- if (!(0, import_node_fs9.existsSync)(path)) return [];
1189
+ if (!(0, import_node_fs10.existsSync)(path)) return [];
1058
1190
  try {
1059
- const parsed = isSecureFileEncrypted(path) ? readSecureJson(path) : JSON.parse((0, import_node_fs9.readFileSync)(path, "utf8"));
1191
+ const parsed = isSecureFileEncrypted(path) ? readSecureJson(path) : JSON.parse((0, import_node_fs10.readFileSync)(path, "utf8"));
1060
1192
  return Array.isArray(parsed?.watches) ? parsed.watches : [];
1061
1193
  } catch {
1062
1194
  return [];
@@ -1378,12 +1510,12 @@ async function pollSlackOutboundWatches(opts) {
1378
1510
  }
1379
1511
  if (changed) writeStore(watches);
1380
1512
  }
1381
- var import_node_fs9, import_node_path10, MAX_WATCHES, MAX_REPLIES_PER_WATCH, WATCH_TTL_MS, POLL_INTERVAL_MS, lastPollMs, nameCache, continueOnReply;
1513
+ var import_node_fs10, import_node_path11, MAX_WATCHES, MAX_REPLIES_PER_WATCH, WATCH_TTL_MS, POLL_INTERVAL_MS, lastPollMs, nameCache, continueOnReply;
1382
1514
  var init_outbound_watch = __esm({
1383
1515
  "src/slack/outbound-watch.ts"() {
1384
1516
  "use strict";
1385
- import_node_fs9 = require("fs");
1386
- import_node_path10 = require("path");
1517
+ import_node_fs10 = require("fs");
1518
+ import_node_path11 = require("path");
1387
1519
  init_paths();
1388
1520
  init_private_file();
1389
1521
  init_secure_file();
@@ -1703,64 +1835,64 @@ var init_error_detail = __esm({
1703
1835
 
1704
1836
  // src/agents/path.ts
1705
1837
  function prependPathDir(env, dir) {
1706
- if (!dir || !(0, import_node_fs10.existsSync)(dir)) return;
1838
+ if (!dir || !(0, import_node_fs11.existsSync)(dir)) return;
1707
1839
  const current = env.PATH ?? "";
1708
- const parts = current.split(import_node_path11.delimiter).filter(Boolean);
1840
+ const parts = current.split(import_node_path12.delimiter).filter(Boolean);
1709
1841
  if (parts.includes(dir)) {
1710
1842
  env.PATH = current;
1711
1843
  return;
1712
1844
  }
1713
- env.PATH = [dir, ...parts].join(import_node_path11.delimiter);
1845
+ env.PATH = [dir, ...parts].join(import_node_path12.delimiter);
1714
1846
  }
1715
1847
  function conductorBundledBinDir(home = process.env.HOME || process.env.USERPROFILE || (0, import_node_os3.homedir)()) {
1716
- return (0, import_node_path11.join)(home, "Library", "Application Support", "com.conductor.app", "bin");
1848
+ return (0, import_node_path12.join)(home, "Library", "Application Support", "com.conductor.app", "bin");
1717
1849
  }
1718
1850
  function ensureAgentPath(env = process.env) {
1719
1851
  const home = env.HOME || env.USERPROFILE || (0, import_node_os3.homedir)();
1720
1852
  const current = env.PATH ?? "";
1721
- const parts = current.split(import_node_path11.delimiter).filter(Boolean);
1853
+ const parts = current.split(import_node_path12.delimiter).filter(Boolean);
1722
1854
  const seen = new Set(parts);
1723
1855
  const extras = [
1724
- ...EXTRA_BIN_DIRS.map((rel) => (0, import_node_path11.join)(home, rel)),
1856
+ ...EXTRA_BIN_DIRS.map((rel) => (0, import_node_path12.join)(home, rel)),
1725
1857
  "/opt/homebrew/bin",
1726
1858
  "/usr/local/bin",
1727
1859
  // Keep after Homebrew/npm so a user-installed CLI still wins.
1728
1860
  conductorBundledBinDir(home)
1729
1861
  ];
1730
1862
  for (const dir of extras.reverse()) {
1731
- if (!dir || seen.has(dir) || !(0, import_node_fs10.existsSync)(dir)) continue;
1863
+ if (!dir || seen.has(dir) || !(0, import_node_fs11.existsSync)(dir)) continue;
1732
1864
  parts.unshift(dir);
1733
1865
  seen.add(dir);
1734
1866
  }
1735
- const next = parts.join(import_node_path11.delimiter);
1867
+ const next = parts.join(import_node_path12.delimiter);
1736
1868
  env.PATH = next;
1737
1869
  return next;
1738
1870
  }
1739
1871
  function enrichPathWithNpmGlobalBin(env = process.env) {
1740
1872
  ensureAgentPath(env);
1741
1873
  try {
1742
- const prefix = (0, import_node_child_process2.execFileSync)("npm", ["prefix", "-g"], {
1874
+ const prefix = (0, import_node_child_process3.execFileSync)("npm", ["prefix", "-g"], {
1743
1875
  encoding: "utf8",
1744
1876
  env: { ...process.env, ...env },
1745
1877
  timeout: 8e3,
1746
1878
  stdio: ["ignore", "pipe", "ignore"]
1747
1879
  }).trim().split(/\r?\n/).find(Boolean);
1748
1880
  if (prefix) {
1749
- const binDir = process.platform === "win32" ? prefix : (0, import_node_path11.join)(prefix, "bin");
1881
+ const binDir = process.platform === "win32" ? prefix : (0, import_node_path12.join)(prefix, "bin");
1750
1882
  prependPathDir(env, binDir);
1751
1883
  }
1752
1884
  } catch {
1753
1885
  }
1754
1886
  return env.PATH ?? "";
1755
1887
  }
1756
- var import_node_fs10, import_node_child_process2, import_node_os3, import_node_path11, EXTRA_BIN_DIRS;
1888
+ var import_node_fs11, import_node_child_process3, import_node_os3, import_node_path12, EXTRA_BIN_DIRS;
1757
1889
  var init_path = __esm({
1758
1890
  "src/agents/path.ts"() {
1759
1891
  "use strict";
1760
- import_node_fs10 = require("fs");
1761
- import_node_child_process2 = require("child_process");
1892
+ import_node_fs11 = require("fs");
1893
+ import_node_child_process3 = require("child_process");
1762
1894
  import_node_os3 = require("os");
1763
- import_node_path11 = require("path");
1895
+ import_node_path12 = require("path");
1764
1896
  EXTRA_BIN_DIRS = [
1765
1897
  ".local/bin",
1766
1898
  ".cargo/bin",
@@ -1781,23 +1913,23 @@ var init_path = __esm({
1781
1913
  function githubAgentAuthDir() {
1782
1914
  const override = process.env.SIDEBOARD_GIT_AUTH_DIR?.trim();
1783
1915
  if (override) return override;
1784
- return (0, import_node_path12.join)((0, import_node_os4.homedir)(), ".sideboard-git-auth");
1916
+ return (0, import_node_path13.join)((0, import_node_os4.homedir)(), ".sideboard-git-auth");
1785
1917
  }
1786
1918
  function githubCredentialStorePath() {
1787
- return (0, import_node_path12.join)(githubAgentAuthDir(), "git-credentials");
1919
+ return (0, import_node_path13.join)(githubAgentAuthDir(), "git-credentials");
1788
1920
  }
1789
1921
  function githubGhConfigDir() {
1790
- return (0, import_node_path12.join)(githubAgentAuthDir(), "gh");
1922
+ return (0, import_node_path13.join)(githubAgentAuthDir(), "gh");
1791
1923
  }
1792
1924
  function writePrivateFile2(file, body) {
1793
- (0, import_node_fs11.mkdirSync)((0, import_node_path12.dirname)(file), { recursive: true, mode: 448 });
1925
+ (0, import_node_fs12.mkdirSync)((0, import_node_path13.dirname)(file), { recursive: true, mode: 448 });
1794
1926
  try {
1795
- (0, import_node_fs11.chmodSync)((0, import_node_path12.dirname)(file), 448);
1927
+ (0, import_node_fs12.chmodSync)((0, import_node_path13.dirname)(file), 448);
1796
1928
  } catch {
1797
1929
  }
1798
- (0, import_node_fs11.writeFileSync)(file, body, { encoding: "utf8", mode: 384 });
1930
+ (0, import_node_fs12.writeFileSync)(file, body, { encoding: "utf8", mode: 384 });
1799
1931
  try {
1800
- (0, import_node_fs11.chmodSync)(file, 384);
1932
+ (0, import_node_fs12.chmodSync)(file, 384);
1801
1933
  } catch {
1802
1934
  }
1803
1935
  }
@@ -1822,19 +1954,19 @@ function materializeGithubAgentAuth(token, user) {
1822
1954
  const trimmed = token.trim();
1823
1955
  if (!trimmed) return;
1824
1956
  const root = githubAgentAuthDir();
1825
- (0, import_node_fs11.mkdirSync)(root, { recursive: true, mode: 448 });
1957
+ (0, import_node_fs12.mkdirSync)(root, { recursive: true, mode: 448 });
1826
1958
  try {
1827
- (0, import_node_fs11.chmodSync)(root, 448);
1959
+ (0, import_node_fs12.chmodSync)(root, 448);
1828
1960
  } catch {
1829
1961
  }
1830
1962
  writePrivateFile2(githubCredentialStorePath(), gitCredentialStoreContents(trimmed));
1831
1963
  const ghDir = githubGhConfigDir();
1832
- (0, import_node_fs11.mkdirSync)(ghDir, { recursive: true, mode: 448 });
1833
- writePrivateFile2((0, import_node_path12.join)(ghDir, "hosts.yml"), ghHostsYml(trimmed, user));
1834
- writePrivateFile2((0, import_node_path12.join)(ghDir, "config.yml"), "git_protocol: https\nprompt: disabled\n");
1964
+ (0, import_node_fs12.mkdirSync)(ghDir, { recursive: true, mode: 448 });
1965
+ writePrivateFile2((0, import_node_path13.join)(ghDir, "hosts.yml"), ghHostsYml(trimmed, user));
1966
+ writePrivateFile2((0, import_node_path13.join)(ghDir, "config.yml"), "git_protocol: https\nprompt: disabled\n");
1835
1967
  }
1836
1968
  function githubAgentAuthReady() {
1837
- return (0, import_node_fs11.existsSync)(githubCredentialStorePath()) && (0, import_node_fs11.existsSync)((0, import_node_path12.join)(githubGhConfigDir(), "hosts.yml"));
1969
+ return (0, import_node_fs12.existsSync)(githubCredentialStorePath()) && (0, import_node_fs12.existsSync)((0, import_node_path13.join)(githubGhConfigDir(), "hosts.yml"));
1838
1970
  }
1839
1971
  function githubCredentialHelperGitConfig() {
1840
1972
  const file = githubCredentialStorePath();
@@ -1849,13 +1981,13 @@ function githubGhConfigEnv() {
1849
1981
  GH_PROMPT_DISABLED: "1"
1850
1982
  };
1851
1983
  }
1852
- var import_node_fs11, import_node_os4, import_node_path12;
1984
+ var import_node_fs12, import_node_os4, import_node_path13;
1853
1985
  var init_github_agent_auth = __esm({
1854
1986
  "src/git/github-agent-auth.ts"() {
1855
1987
  "use strict";
1856
- import_node_fs11 = require("fs");
1988
+ import_node_fs12 = require("fs");
1857
1989
  import_node_os4 = require("os");
1858
- import_node_path12 = require("path");
1990
+ import_node_path13 = require("path");
1859
1991
  }
1860
1992
  });
1861
1993
 
@@ -1864,11 +1996,11 @@ function isIndexLockError(text7) {
1864
1996
  return /Unable to create ['"][^'"]*index\.lock['"]: File exists/i.test(text7);
1865
1997
  }
1866
1998
  function clearStaleIndexLock(gitDir, maxAgeMs = STALE_INDEX_LOCK_MS, now = Date.now()) {
1867
- const lockPath = (0, import_node_path13.join)(gitDir, "index.lock");
1999
+ const lockPath = (0, import_node_path14.join)(gitDir, "index.lock");
1868
2000
  try {
1869
- if (!(0, import_node_fs12.existsSync)(lockPath)) return null;
1870
- if (now - (0, import_node_fs12.statSync)(lockPath).mtimeMs < maxAgeMs) return null;
1871
- (0, import_node_fs12.unlinkSync)(lockPath);
2001
+ if (!(0, import_node_fs13.existsSync)(lockPath)) return null;
2002
+ if (now - (0, import_node_fs13.statSync)(lockPath).mtimeMs < maxAgeMs) return null;
2003
+ (0, import_node_fs13.unlinkSync)(lockPath);
1872
2004
  return lockPath;
1873
2005
  } catch {
1874
2006
  return null;
@@ -1883,12 +2015,12 @@ function clearStaleIndexLocks(gitDirs, maxAgeMs = STALE_INDEX_LOCK_MS) {
1883
2015
  }
1884
2016
  return removed;
1885
2017
  }
1886
- var import_node_fs12, import_node_path13, STALE_INDEX_LOCK_MS;
2018
+ var import_node_fs13, import_node_path14, STALE_INDEX_LOCK_MS;
1887
2019
  var init_stale_lock = __esm({
1888
2020
  "src/git/stale-lock.ts"() {
1889
2021
  "use strict";
1890
- import_node_fs12 = require("fs");
1891
- import_node_path13 = require("path");
2022
+ import_node_fs13 = require("fs");
2023
+ import_node_path14 = require("path");
1892
2024
  STALE_INDEX_LOCK_MS = 2e4;
1893
2025
  }
1894
2026
  });
@@ -2406,18 +2538,35 @@ function teamSlugFromName(name) {
2406
2538
  function normalizeTakenSlug(raw) {
2407
2539
  return raw.toLowerCase().replace(/^thread\//, "").replace(/\/+$/, "");
2408
2540
  }
2541
+ function soccerTokenFromTakenSlug(raw) {
2542
+ const normalized = normalizeTakenSlug(raw);
2543
+ if (!normalized) return null;
2544
+ const withoutTicket = normalized.replace(/^[a-z]{2,8}-\d{1,6}-/, "").replace(/^\d{1,8}-/, "");
2545
+ const lookup = withoutTicket || normalized;
2546
+ const suffixMatch = lookup.match(/^(.+)-(\d+)$/);
2547
+ const base = suffixMatch?.[1] ?? lookup;
2548
+ const team = FAMOUS_SOCCER_TEAM_SEEDS.find((t) => t.slug === base);
2549
+ if (!team) return null;
2550
+ return suffixMatch ? `${team.slug}-${suffixMatch[2]}` : team.slug;
2551
+ }
2552
+ function addTakenSlug(out, raw) {
2553
+ const normalized = normalizeTakenSlug(raw);
2554
+ if (!normalized) return;
2555
+ out.add(normalized);
2556
+ const token = soccerTokenFromTakenSlug(normalized);
2557
+ if (token) out.add(token);
2558
+ }
2409
2559
  function takenSlugsFromThread(thread) {
2410
2560
  const out = /* @__PURE__ */ new Set();
2411
2561
  const titleSlug = thread.title ? teamSlugFromName(thread.title) : null;
2412
2562
  if (titleSlug) out.add(normalizeTakenSlug(titleSlug));
2413
2563
  if (thread.branchName?.trim()) {
2414
- const branch = normalizeTakenSlug(thread.branchName.trim());
2415
- if (branch) out.add(branch);
2564
+ addTakenSlug(out, thread.branchName.trim());
2416
2565
  }
2417
2566
  if (thread.worktreePath) {
2418
2567
  const parts = thread.worktreePath.replace(/\/+$/, "").split("/");
2419
2568
  const dir = parts[parts.length - 1];
2420
- if (dir) out.add(normalizeTakenSlug(dir));
2569
+ if (dir) addTakenSlug(out, dir);
2421
2570
  }
2422
2571
  return [...out];
2423
2572
  }
@@ -2981,11 +3130,11 @@ async function ensureWorktreeSideboardIgnored(worktreePath) {
2981
3130
  if (gitDir.exitCode !== 0) return;
2982
3131
  const dir = gitDir.stdout.trim();
2983
3132
  if (!dir) return;
2984
- const excludePath = (0, import_node_path14.join)(dir, "info", "exclude");
2985
- (0, import_node_fs13.mkdirSync)((0, import_node_path14.dirname)(excludePath), { recursive: true });
3133
+ const excludePath = (0, import_node_path15.join)(dir, "info", "exclude");
3134
+ (0, import_node_fs14.mkdirSync)((0, import_node_path15.dirname)(excludePath), { recursive: true });
2986
3135
  let body = "";
2987
3136
  try {
2988
- body = (0, import_node_fs13.readFileSync)(excludePath, "utf8");
3137
+ body = (0, import_node_fs14.readFileSync)(excludePath, "utf8");
2989
3138
  } catch {
2990
3139
  body = "";
2991
3140
  }
@@ -3001,7 +3150,7 @@ async function ensureWorktreeSideboardIgnored(worktreePath) {
3001
3150
  ` : body;
3002
3151
  const header = body.includes(EXCLUDE_COMMENT) ? "" : `${EXCLUDE_COMMENT}
3003
3152
  `;
3004
- (0, import_node_fs13.writeFileSync)(excludePath, `${prefix}${header}${missing.join("\n")}
3153
+ (0, import_node_fs14.writeFileSync)(excludePath, `${prefix}${header}${missing.join("\n")}
3005
3154
  `, "utf8");
3006
3155
  }
3007
3156
  const listed = await git(["ls-files", "-z", "--", ".sideboard"], worktreePath, {
@@ -3016,12 +3165,12 @@ async function ensureWorktreeSideboardIgnored(worktreePath) {
3016
3165
  timeoutMs: 8e3
3017
3166
  });
3018
3167
  }
3019
- var import_node_fs13, import_node_path14, WORKTREE_SIDEBOARD_EXCLUDE, WORKTREE_CONTEXT_EXCLUDE, EXCLUDE_COMMENT;
3168
+ var import_node_fs14, import_node_path15, WORKTREE_SIDEBOARD_EXCLUDE, WORKTREE_CONTEXT_EXCLUDE, EXCLUDE_COMMENT;
3020
3169
  var init_worktree_exclude = __esm({
3021
3170
  "src/git/worktree-exclude.ts"() {
3022
3171
  "use strict";
3023
- import_node_fs13 = require("fs");
3024
- import_node_path14 = require("path");
3172
+ import_node_fs14 = require("fs");
3173
+ import_node_path15 = require("path");
3025
3174
  init_run();
3026
3175
  WORKTREE_SIDEBOARD_EXCLUDE = ".sideboard/";
3027
3176
  WORKTREE_CONTEXT_EXCLUDE = ".context/";
@@ -3172,7 +3321,7 @@ var init_account_profile = __esm({
3172
3321
 
3173
3322
  // src/store/secret-vault.ts
3174
3323
  function secretVaultPath() {
3175
- return (0, import_node_path15.join)(appDataDir(), "secrets.json");
3324
+ return (0, import_node_path16.join)(appDataDir(), "secrets.json");
3176
3325
  }
3177
3326
  function loadSecretVault() {
3178
3327
  const parsed = readSecureJson(secretVaultPath());
@@ -3231,11 +3380,11 @@ function normalizeVault(raw) {
3231
3380
  }
3232
3381
  return out;
3233
3382
  }
3234
- var import_node_path15;
3383
+ var import_node_path16;
3235
3384
  var init_secret_vault = __esm({
3236
3385
  "src/store/secret-vault.ts"() {
3237
3386
  "use strict";
3238
- import_node_path15 = require("path");
3387
+ import_node_path16 = require("path");
3239
3388
  init_paths();
3240
3389
  init_secure_file();
3241
3390
  }
@@ -3416,10 +3565,10 @@ function toPublicAppSettings(settings) {
3416
3565
  };
3417
3566
  }
3418
3567
  function appSettingsPath() {
3419
- return (0, import_node_path16.join)(appDataDir(), "settings.json");
3568
+ return (0, import_node_path17.join)(appDataDir(), "settings.json");
3420
3569
  }
3421
3570
  function claudeUserSettingsPath() {
3422
- return (0, import_node_path16.join)((0, import_node_os5.homedir)(), ".claude", "settings.json");
3571
+ return (0, import_node_path17.join)((0, import_node_os5.homedir)(), ".claude", "settings.json");
3423
3572
  }
3424
3573
  function normalizeClaude(raw) {
3425
3574
  if (!raw || typeof raw !== "object") return {};
@@ -3427,7 +3576,7 @@ function normalizeClaude(raw) {
3427
3576
  const out = {};
3428
3577
  if (typeof source.executablePath === "string") {
3429
3578
  const path = source.executablePath.trim();
3430
- if (path && (0, import_node_path16.isAbsolute)(path)) out.executablePath = path;
3579
+ if (path && (0, import_node_path17.isAbsolute)(path)) out.executablePath = path;
3431
3580
  }
3432
3581
  if (typeof source.chromeEnabled === "boolean") {
3433
3582
  out.chromeEnabled = source.chromeEnabled;
@@ -3440,13 +3589,13 @@ function normalizeCliExecutable(raw) {
3440
3589
  const out = {};
3441
3590
  if (typeof source.executablePath === "string") {
3442
3591
  const path = source.executablePath.trim();
3443
- if (path && (0, import_node_path16.isAbsolute)(path)) out.executablePath = path;
3592
+ if (path && (0, import_node_path17.isAbsolute)(path)) out.executablePath = path;
3444
3593
  }
3445
3594
  return out;
3446
3595
  }
3447
3596
  function absoluteExecutablePath(value) {
3448
3597
  const path = value.trim();
3449
- if (!(0, import_node_path16.isAbsolute)(path)) {
3598
+ if (!(0, import_node_path17.isAbsolute)(path)) {
3450
3599
  throw new Error("Executable path must be absolute. Leave it empty to use the system CLI.");
3451
3600
  }
3452
3601
  return path;
@@ -3457,7 +3606,7 @@ function normalizeBrightsy(raw) {
3457
3606
  const out = {};
3458
3607
  if (typeof source.executablePath === "string") {
3459
3608
  const path = source.executablePath.trim();
3460
- if (path && (0, import_node_path16.isAbsolute)(path)) out.executablePath = path;
3609
+ if (path && (0, import_node_path17.isAbsolute)(path)) out.executablePath = path;
3461
3610
  }
3462
3611
  if (typeof source.cloudConnectEnabled === "boolean") {
3463
3612
  out.cloudConnectEnabled = source.cloudConnectEnabled;
@@ -3801,10 +3950,10 @@ function normalizeSettings(raw) {
3801
3950
  }
3802
3951
  function readSettingsFile() {
3803
3952
  const path = appSettingsPath();
3804
- if (!(0, import_node_fs14.existsSync)(path)) return { ...EMPTY_SETTINGS };
3953
+ if (!(0, import_node_fs15.existsSync)(path)) return { ...EMPTY_SETTINGS };
3805
3954
  try {
3806
3955
  chmodOwnerOnly(path);
3807
- const parsed = JSON.parse((0, import_node_fs14.readFileSync)(path, "utf8"));
3956
+ const parsed = JSON.parse((0, import_node_fs15.readFileSync)(path, "utf8"));
3808
3957
  return normalizeSettings(parsed);
3809
3958
  } catch {
3810
3959
  return { ...EMPTY_SETTINGS };
@@ -4727,14 +4876,14 @@ function childEnvWithAppSettings(extra) {
4727
4876
  function harnessEnvKey(harness) {
4728
4877
  return HARNESS_ENV_KEYS[harness];
4729
4878
  }
4730
- var import_node_crypto3, import_node_fs14, import_node_os5, import_node_path16, HARNESS_ENV_KEYS, DEFAULT_AGENTS, GITHUB_GIT_AUTH_MODES, FOLLOW_UP_BEHAVIORS, CLOUD_CONNECT_AGENTS, ISSUE_SOURCES, GIT_AUTH_MODES, EMPTY_SETTINGS, CONFIRM_ACCOUNT, CONFIRM_PROJECT, DEFAULT_CLI_BIN;
4879
+ var import_node_crypto3, import_node_fs15, import_node_os5, import_node_path17, HARNESS_ENV_KEYS, DEFAULT_AGENTS, GITHUB_GIT_AUTH_MODES, FOLLOW_UP_BEHAVIORS, CLOUD_CONNECT_AGENTS, ISSUE_SOURCES, GIT_AUTH_MODES, EMPTY_SETTINGS, CONFIRM_ACCOUNT, CONFIRM_PROJECT, DEFAULT_CLI_BIN;
4731
4880
  var init_app_settings = __esm({
4732
4881
  "src/store/app-settings.ts"() {
4733
4882
  "use strict";
4734
4883
  import_node_crypto3 = require("crypto");
4735
- import_node_fs14 = require("fs");
4884
+ import_node_fs15 = require("fs");
4736
4885
  import_node_os5 = require("os");
4737
- import_node_path16 = require("path");
4886
+ import_node_path17 = require("path");
4738
4887
  init_orchestrator_capable();
4739
4888
  init_thinking_effort();
4740
4889
  init_nested_electron_env();
@@ -4900,7 +5049,7 @@ async function warmGithubAgentAuth(opts) {
4900
5049
  }
4901
5050
  function normalizeWritableRoot(raw) {
4902
5051
  const trimmed = raw.trim().replace(/\/+$/, "");
4903
- return trimmed && (0, import_node_path17.isAbsolute)(trimmed) ? trimmed : null;
5052
+ return trimmed && (0, import_node_path18.isAbsolute)(trimmed) ? trimmed : null;
4904
5053
  }
4905
5054
  async function resolveCodexGitWritableRoots(cwd) {
4906
5055
  const roots = /* @__PURE__ */ new Set();
@@ -4978,11 +5127,11 @@ function formatGitAuthModeDirective(mode) {
4978
5127
  ].join("\n");
4979
5128
  }
4980
5129
  }
4981
- var import_node_path17, HTTPS_REWRITE, TOKEN_TTL_MS, tokenMemo, GITHUB_CHILD_TOKEN_KEYS;
5130
+ var import_node_path18, HTTPS_REWRITE, TOKEN_TTL_MS, tokenMemo, GITHUB_CHILD_TOKEN_KEYS;
4982
5131
  var init_git_auth_mode = __esm({
4983
5132
  "src/git/git-auth-mode.ts"() {
4984
5133
  "use strict";
4985
- import_node_path17 = require("path");
5134
+ import_node_path18 = require("path");
4986
5135
  init_app_settings();
4987
5136
  init_github_agent_auth();
4988
5137
  init_run();
@@ -5806,7 +5955,7 @@ async function resolveRepoRoot(cwd) {
5806
5955
  }
5807
5956
  function canonicalizeRepoPath(path) {
5808
5957
  try {
5809
- return (0, import_node_fs15.realpathSync)(path);
5958
+ return (0, import_node_fs16.realpathSync)(path);
5810
5959
  } catch {
5811
5960
  return path.replace(/\/+$/, "");
5812
5961
  }
@@ -6650,8 +6799,8 @@ async function refreshOriginAndMaybeFastForwardMain(repoPath, sourceRef) {
6650
6799
  }
6651
6800
  async function createThreadWorktree(opts) {
6652
6801
  let branchName = `thread/${opts.slug}`;
6653
- const worktreePath = (0, import_node_path18.join)(worktreesRoot(opts.repoPath), opts.slug);
6654
- if ((0, import_node_fs15.existsSync)(worktreePath)) {
6802
+ const worktreePath = (0, import_node_path19.join)(worktreesRoot(opts.repoPath), opts.slug);
6803
+ if ((0, import_node_fs16.existsSync)(worktreePath)) {
6655
6804
  throw new Error(`Worktree already exists at ${worktreePath}`);
6656
6805
  }
6657
6806
  await ensureGhPreferOrigin(opts.repoPath);
@@ -6692,8 +6841,8 @@ ${add.stdout}`;
6692
6841
  async function createExistingBranchWorktree(opts) {
6693
6842
  const branchName = opts.branchName.trim();
6694
6843
  if (!branchName) throw new Error("branch name required");
6695
- const worktreePath = (0, import_node_path18.join)(worktreesRoot(opts.repoPath), opts.slug);
6696
- if ((0, import_node_fs15.existsSync)(worktreePath)) {
6844
+ const worktreePath = (0, import_node_path19.join)(worktreesRoot(opts.repoPath), opts.slug);
6845
+ if ((0, import_node_fs16.existsSync)(worktreePath)) {
6697
6846
  throw new Error(`Worktree already exists at ${worktreePath}`);
6698
6847
  }
6699
6848
  await ensureGhPreferOrigin(opts.repoPath);
@@ -6974,11 +7123,11 @@ async function createOrUpdatePr(worktreePath, opts) {
6974
7123
  const headRef = ghHeadRef(slug, opts.head);
6975
7124
  const branchOnly = opts.head.trim().replace(/^refs\/heads\//, "");
6976
7125
  const bodyText = clampGithubPrBody(opts.body ?? opts.title);
6977
- const bodyFile = (0, import_node_path18.join)(
7126
+ const bodyFile = (0, import_node_path19.join)(
6978
7127
  (0, import_node_os6.tmpdir)(),
6979
7128
  `sideboard-pr-body-${process.pid}-${(0, import_node_crypto4.randomBytes)(6).toString("hex")}.md`
6980
7129
  );
6981
- (0, import_node_fs15.writeFileSync)(bodyFile, bodyText.endsWith("\n") ? bodyText : `${bodyText}
7130
+ (0, import_node_fs16.writeFileSync)(bodyFile, bodyText.endsWith("\n") ? bodyText : `${bodyText}
6982
7131
  `, "utf8");
6983
7132
  const bodyArgs = ["--body-file", bodyFile];
6984
7133
  try {
@@ -6992,7 +7141,7 @@ async function createOrUpdatePr(worktreePath, opts) {
6992
7141
  });
6993
7142
  } finally {
6994
7143
  try {
6995
- (0, import_node_fs15.unlinkSync)(bodyFile);
7144
+ (0, import_node_fs16.unlinkSync)(bodyFile);
6996
7145
  } catch {
6997
7146
  }
6998
7147
  }
@@ -7074,10 +7223,10 @@ function sameRepoPath(a, b) {
7074
7223
  return normalizeWorktreePath(a) === normalizeWorktreePath(b);
7075
7224
  }
7076
7225
  function listLocalThreadBranchSlugs(repoPath) {
7077
- const refsDir = (0, import_node_path18.join)(repoPath, ".git", "refs", "heads", "thread");
7078
- if (!(0, import_node_fs15.existsSync)(refsDir)) return [];
7226
+ const refsDir = (0, import_node_path19.join)(repoPath, ".git", "refs", "heads", "thread");
7227
+ if (!(0, import_node_fs16.existsSync)(refsDir)) return [];
7079
7228
  try {
7080
- return (0, import_node_fs15.readdirSync)(refsDir).filter((name) => !name.startsWith(".")).map((name) => normalizeTakenSlug(name));
7229
+ return (0, import_node_fs16.readdirSync)(refsDir).filter((name) => !name.startsWith(".")).map((name) => normalizeTakenSlug(name));
7081
7230
  } catch {
7082
7231
  return [];
7083
7232
  }
@@ -7085,15 +7234,19 @@ function listLocalThreadBranchSlugs(repoPath) {
7085
7234
  function collectTakenTeamSlugs(repoPath) {
7086
7235
  const taken = /* @__PURE__ */ new Set();
7087
7236
  const root = worktreesRoot(repoPath);
7088
- if ((0, import_node_fs15.existsSync)(root)) {
7089
- for (const entry of (0, import_node_fs15.readdirSync)(root, { withFileTypes: true })) {
7237
+ if ((0, import_node_fs16.existsSync)(root)) {
7238
+ for (const entry of (0, import_node_fs16.readdirSync)(root, { withFileTypes: true })) {
7090
7239
  if (entry.isDirectory() && entry.name !== ".DS_Store") {
7091
- taken.add(normalizeTakenSlug(entry.name));
7240
+ for (const slug of takenSlugsFromThread({ worktreePath: entry.name })) {
7241
+ taken.add(slug);
7242
+ }
7092
7243
  }
7093
7244
  }
7094
7245
  }
7095
7246
  for (const slug of listLocalThreadBranchSlugs(repoPath)) {
7096
- taken.add(slug);
7247
+ for (const token of takenSlugsFromThread({ branchName: slug })) {
7248
+ taken.add(token);
7249
+ }
7097
7250
  }
7098
7251
  for (const thread of listThreads({ includeArchived: true })) {
7099
7252
  if (!sameRepoPath(thread.repoPath, repoPath)) continue;
@@ -7107,20 +7260,20 @@ function allocateTeamSlug(repoPath) {
7107
7260
  const taken = collectTakenTeamSlugs(repoPath);
7108
7261
  for (let attempt = 0; attempt < 32; attempt++) {
7109
7262
  const team = allocateTeamName(taken);
7110
- const path = (0, import_node_path18.join)(worktreesRoot(repoPath), team.slug);
7111
- if (!(0, import_node_fs15.existsSync)(path)) return team;
7263
+ const path = (0, import_node_path19.join)(worktreesRoot(repoPath), team.slug);
7264
+ if (!(0, import_node_fs16.existsSync)(path)) return team;
7112
7265
  taken.add(team.slug);
7113
7266
  }
7114
7267
  throw new Error("No available soccer team worktree directories left");
7115
7268
  }
7116
- var import_node_crypto4, import_node_fs15, import_node_os6, import_node_path18, PR_DETAILS_JSON_FIELDS;
7269
+ var import_node_crypto4, import_node_fs16, import_node_os6, import_node_path19, PR_DETAILS_JSON_FIELDS;
7117
7270
  var init_worktree = __esm({
7118
7271
  "src/git/worktree.ts"() {
7119
7272
  "use strict";
7120
7273
  import_node_crypto4 = require("crypto");
7121
- import_node_fs15 = require("fs");
7274
+ import_node_fs16 = require("fs");
7122
7275
  import_node_os6 = require("os");
7123
- import_node_path18 = require("path");
7276
+ import_node_path19 = require("path");
7124
7277
  init_paths();
7125
7278
  init_thread_store();
7126
7279
  init_teams();
@@ -7192,7 +7345,7 @@ var init_cloud_connect_constants = __esm({
7192
7345
 
7193
7346
  // src/composer/stage-files.ts
7194
7347
  function fileExtension(filePath) {
7195
- const base = (0, import_node_path19.basename)(filePath).toLowerCase();
7348
+ const base = (0, import_node_path20.basename)(filePath).toLowerCase();
7196
7349
  return base.includes(".") ? base.split(".").pop() || "" : "";
7197
7350
  }
7198
7351
  function isImageFilePath(filePath) {
@@ -7202,22 +7355,22 @@ function imageMimeType(filePath) {
7202
7355
  return IMAGE_MIME_BY_EXT[fileExtension(filePath)] || "image/png";
7203
7356
  }
7204
7357
  function ensureAttachmentsDir(worktreePath) {
7205
- const dir = (0, import_node_path19.join)(worktreePath, ATTACHMENTS_DIR);
7206
- (0, import_node_fs16.mkdirSync)(dir, { recursive: true });
7207
- const gi = (0, import_node_path19.join)(dir, ".gitignore");
7208
- if (!(0, import_node_fs16.existsSync)(gi)) {
7209
- (0, import_node_fs16.writeFileSync)(gi, attachmentsGitignoreBody(), "utf8");
7358
+ const dir = (0, import_node_path20.join)(worktreePath, ATTACHMENTS_DIR);
7359
+ (0, import_node_fs17.mkdirSync)(dir, { recursive: true });
7360
+ const gi = (0, import_node_path20.join)(dir, ".gitignore");
7361
+ if (!(0, import_node_fs17.existsSync)(gi)) {
7362
+ (0, import_node_fs17.writeFileSync)(gi, attachmentsGitignoreBody(), "utf8");
7210
7363
  }
7211
7364
  return dir;
7212
7365
  }
7213
7366
  function uniqueAttachmentName(dir, originalName) {
7214
7367
  const safe = originalName.replace(/[/\\]/g, "_") || "file";
7215
- if (!(0, import_node_fs16.existsSync)((0, import_node_path19.join)(dir, safe))) return safe;
7216
- const ext = (0, import_node_path19.extname)(safe);
7368
+ if (!(0, import_node_fs17.existsSync)((0, import_node_path20.join)(dir, safe))) return safe;
7369
+ const ext = (0, import_node_path20.extname)(safe);
7217
7370
  const stem = ext ? safe.slice(0, -ext.length) : safe;
7218
7371
  for (let i = 1; i < 1e4; i++) {
7219
7372
  const candidate = `${stem}-${i}${ext}`;
7220
- if (!(0, import_node_fs16.existsSync)((0, import_node_path19.join)(dir, candidate))) return candidate;
7373
+ if (!(0, import_node_fs17.existsSync)((0, import_node_path20.join)(dir, candidate))) return candidate;
7221
7374
  }
7222
7375
  return `${stem}-${(0, import_node_crypto5.randomUUID)()}${ext}`;
7223
7376
  }
@@ -7273,15 +7426,15 @@ function stageAbsolutePathsAsAttachments(worktreePath, absolutePaths) {
7273
7426
  const dir = ensureAttachmentsDir(worktreePath);
7274
7427
  const out = [];
7275
7428
  for (const abs of absolutePaths) {
7276
- const originalName = (0, import_node_path19.basename)(abs);
7429
+ const originalName = (0, import_node_path20.basename)(abs);
7277
7430
  try {
7278
- const st = (0, import_node_fs16.statSync)(abs);
7431
+ const st = (0, import_node_fs17.statSync)(abs);
7279
7432
  if (!st.isFile()) continue;
7280
7433
  const name = uniqueAttachmentName(dir, originalName);
7281
- const destAbs = (0, import_node_path19.join)(dir, name);
7282
- (0, import_node_fs16.copyFileSync)(abs, destAbs);
7434
+ const destAbs = (0, import_node_path20.join)(dir, name);
7435
+ (0, import_node_fs17.copyFileSync)(abs, destAbs);
7283
7436
  const rel = `${ATTACHMENTS_DIR}/${name}`;
7284
- const buf = (0, import_node_fs16.readFileSync)(destAbs);
7437
+ const buf = (0, import_node_fs17.readFileSync)(destAbs);
7285
7438
  out.push(attachmentFromBuffer(name, buf, { path: rel, sourceLabel: abs }));
7286
7439
  } catch (err) {
7287
7440
  out.push({
@@ -7303,8 +7456,8 @@ function stageBuffersAsAttachments(worktreePath, buffers2) {
7303
7456
  try {
7304
7457
  const buf = Buffer.from(item.dataBase64, "base64");
7305
7458
  const name = uniqueAttachmentName(dir, originalName);
7306
- const destAbs = (0, import_node_path19.join)(dir, name);
7307
- (0, import_node_fs16.writeFileSync)(destAbs, buf);
7459
+ const destAbs = (0, import_node_path20.join)(dir, name);
7460
+ (0, import_node_fs17.writeFileSync)(destAbs, buf);
7308
7461
  const rel = `${ATTACHMENTS_DIR}/${name}`;
7309
7462
  out.push(attachmentFromBuffer(name, buf, { path: rel }));
7310
7463
  } catch (err) {
@@ -7365,18 +7518,18 @@ function attachmentsFromWorktreePaths(worktreePath, relativePaths) {
7365
7518
  if (!rel || rel.includes("..") || rel.startsWith("/")) {
7366
7519
  out.push({
7367
7520
  id: (0, import_node_crypto5.randomUUID)(),
7368
- name: (0, import_node_path19.basename)(rel) || "file",
7521
+ name: (0, import_node_path20.basename)(rel) || "file",
7369
7522
  kind: "file",
7370
7523
  content: `(invalid path: ${rel})`
7371
7524
  });
7372
7525
  continue;
7373
7526
  }
7374
- const name = (0, import_node_path19.basename)(rel);
7527
+ const name = (0, import_node_path20.basename)(rel);
7375
7528
  try {
7376
- const abs = (0, import_node_path19.join)(worktreePath, rel);
7377
- const st = (0, import_node_fs16.statSync)(abs);
7529
+ const abs = (0, import_node_path20.join)(worktreePath, rel);
7530
+ const st = (0, import_node_fs17.statSync)(abs);
7378
7531
  if (!st.isFile()) continue;
7379
- const buf = (0, import_node_fs16.readFileSync)(abs);
7532
+ const buf = (0, import_node_fs17.readFileSync)(abs);
7380
7533
  out.push(attachmentFromBuffer(name, buf, { path: rel, sourceLabel: abs }));
7381
7534
  } catch (err) {
7382
7535
  out.push({
@@ -7389,12 +7542,12 @@ function attachmentsFromWorktreePaths(worktreePath, relativePaths) {
7389
7542
  }
7390
7543
  return out;
7391
7544
  }
7392
- var import_node_fs16, import_node_path19, import_node_crypto5, IMAGE_EXTENSIONS, IMAGE_MIME_BY_EXT, MAX_INLINE_BYTES, MAX_PREVIEW_BYTES, IMAGE_HINT_RE, PLACEHOLDER_CONTENT_RE;
7545
+ var import_node_fs17, import_node_path20, import_node_crypto5, IMAGE_EXTENSIONS, IMAGE_MIME_BY_EXT, MAX_INLINE_BYTES, MAX_PREVIEW_BYTES, IMAGE_HINT_RE, PLACEHOLDER_CONTENT_RE;
7393
7546
  var init_stage_files = __esm({
7394
7547
  "src/composer/stage-files.ts"() {
7395
7548
  "use strict";
7396
- import_node_fs16 = require("fs");
7397
- import_node_path19 = require("path");
7549
+ import_node_fs17 = require("fs");
7550
+ import_node_path20 = require("path");
7398
7551
  import_node_crypto5 = require("crypto");
7399
7552
  init_workspace_scratch();
7400
7553
  IMAGE_EXTENSIONS = /* @__PURE__ */ new Set([
@@ -7434,38 +7587,38 @@ __export(workspaces_exports, {
7434
7587
  syncWorkspacesFromThreads: () => syncWorkspacesFromThreads
7435
7588
  });
7436
7589
  function workspacesFile() {
7437
- return (0, import_node_path20.join)(appDataDir(), "workspaces.json");
7590
+ return (0, import_node_path21.join)(appDataDir(), "workspaces.json");
7438
7591
  }
7439
7592
  function removedWorkspacesFile() {
7440
- return (0, import_node_path20.join)(appDataDir(), "removed-workspaces.json");
7593
+ return (0, import_node_path21.join)(appDataDir(), "removed-workspaces.json");
7441
7594
  }
7442
7595
  function readAll() {
7443
7596
  const path = workspacesFile();
7444
- if (!(0, import_node_fs17.existsSync)(path)) return [];
7597
+ if (!(0, import_node_fs18.existsSync)(path)) return [];
7445
7598
  try {
7446
- const raw = JSON.parse((0, import_node_fs17.readFileSync)(path, "utf8"));
7599
+ const raw = JSON.parse((0, import_node_fs18.readFileSync)(path, "utf8"));
7447
7600
  return Array.isArray(raw) ? raw : [];
7448
7601
  } catch {
7449
7602
  return [];
7450
7603
  }
7451
7604
  }
7452
7605
  function writeAll(list) {
7453
- (0, import_node_fs17.mkdirSync)(appDataDir(), { recursive: true });
7454
- (0, import_node_fs17.writeFileSync)(workspacesFile(), JSON.stringify(list, null, 2), "utf8");
7606
+ (0, import_node_fs18.mkdirSync)(appDataDir(), { recursive: true });
7607
+ (0, import_node_fs18.writeFileSync)(workspacesFile(), JSON.stringify(list, null, 2), "utf8");
7455
7608
  }
7456
7609
  function readRemoved() {
7457
7610
  const path = removedWorkspacesFile();
7458
- if (!(0, import_node_fs17.existsSync)(path)) return /* @__PURE__ */ new Set();
7611
+ if (!(0, import_node_fs18.existsSync)(path)) return /* @__PURE__ */ new Set();
7459
7612
  try {
7460
- const raw = JSON.parse((0, import_node_fs17.readFileSync)(path, "utf8"));
7613
+ const raw = JSON.parse((0, import_node_fs18.readFileSync)(path, "utf8"));
7461
7614
  return new Set(Array.isArray(raw) ? raw.filter((p) => typeof p === "string") : []);
7462
7615
  } catch {
7463
7616
  return /* @__PURE__ */ new Set();
7464
7617
  }
7465
7618
  }
7466
7619
  function writeRemoved(paths) {
7467
- (0, import_node_fs17.mkdirSync)(appDataDir(), { recursive: true });
7468
- (0, import_node_fs17.writeFileSync)(removedWorkspacesFile(), JSON.stringify([...paths].sort(), null, 2), "utf8");
7620
+ (0, import_node_fs18.mkdirSync)(appDataDir(), { recursive: true });
7621
+ (0, import_node_fs18.writeFileSync)(removedWorkspacesFile(), JSON.stringify([...paths].sort(), null, 2), "utf8");
7469
7622
  }
7470
7623
  function rememberRemoved(repoPath) {
7471
7624
  const next = readRemoved();
@@ -7488,7 +7641,7 @@ function listWorkspaces() {
7488
7641
  async function addWorkspace(repoPath) {
7489
7642
  const root = await resolveRepoRoot(repoPath);
7490
7643
  if (!root || root === "/") throw new Error(`Invalid repo path: ${repoPath}`);
7491
- if (!(0, import_node_fs17.existsSync)(root)) throw new Error(`Repo not found: ${root}`);
7644
+ if (!(0, import_node_fs18.existsSync)(root)) throw new Error(`Repo not found: ${root}`);
7492
7645
  forgetRemoved(root);
7493
7646
  await ensureGhPreferOrigin(root);
7494
7647
  const current = readAll();
@@ -7496,7 +7649,7 @@ async function addWorkspace(repoPath) {
7496
7649
  if (existing) return existing;
7497
7650
  const next = {
7498
7651
  path: root,
7499
- name: (0, import_node_path20.basename)(root),
7652
+ name: (0, import_node_path21.basename)(root),
7500
7653
  addedAt: (/* @__PURE__ */ new Date()).toISOString()
7501
7654
  };
7502
7655
  writeAll([...current, next]);
@@ -7518,10 +7671,10 @@ function syncWorkspacesFromThreads(repoPaths) {
7518
7671
  if (!path || path === "/" || isGlobalRepoPath(path) || byPath.has(path) || removed.has(path)) {
7519
7672
  continue;
7520
7673
  }
7521
- if (!(0, import_node_fs17.existsSync)(path)) continue;
7674
+ if (!(0, import_node_fs18.existsSync)(path)) continue;
7522
7675
  const ws = {
7523
7676
  path,
7524
- name: (0, import_node_path20.basename)(path),
7677
+ name: (0, import_node_path21.basename)(path),
7525
7678
  addedAt: (/* @__PURE__ */ new Date()).toISOString()
7526
7679
  };
7527
7680
  byPath.set(path, ws);
@@ -7531,12 +7684,12 @@ function syncWorkspacesFromThreads(repoPaths) {
7531
7684
  if (dirty) writeAll(next);
7532
7685
  return next.sort((a, b) => a.name.localeCompare(b.name));
7533
7686
  }
7534
- var import_node_fs17, import_node_path20;
7687
+ var import_node_fs18, import_node_path21;
7535
7688
  var init_workspaces2 = __esm({
7536
7689
  "src/store/workspaces.ts"() {
7537
7690
  "use strict";
7538
- import_node_fs17 = require("fs");
7539
- import_node_path20 = require("path");
7691
+ import_node_fs18 = require("fs");
7692
+ import_node_path21 = require("path");
7540
7693
  init_paths();
7541
7694
  init_global_workspace();
7542
7695
  init_worktree();
@@ -7647,7 +7800,7 @@ function coordinatorTurnReminder(opts) {
7647
7800
  function ensureGlobalCoordinatorCwd(opts) {
7648
7801
  const dir = globalAgentCwd();
7649
7802
  try {
7650
- (0, import_node_fs18.mkdirSync)(dir, { recursive: true });
7803
+ (0, import_node_fs19.mkdirSync)(dir, { recursive: true });
7651
7804
  } catch {
7652
7805
  return dir;
7653
7806
  }
@@ -7655,7 +7808,7 @@ function ensureGlobalCoordinatorCwd(opts) {
7655
7808
  let orchId = opts?.orchestratorThreadId?.trim() || "";
7656
7809
  if (!orchId) {
7657
7810
  try {
7658
- const existing = (0, import_node_fs18.readFileSync)((0, import_node_path21.join)(dir, "AGENTS.md"), "utf8");
7811
+ const existing = (0, import_node_fs19.readFileSync)((0, import_node_path22.join)(dir, "AGENTS.md"), "utf8");
7659
7812
  const m = existing.match(
7660
7813
  /YOUR orchestration thread id is `([0-9a-f-]{36})`/i
7661
7814
  );
@@ -7690,8 +7843,8 @@ function ensureGlobalCoordinatorCwd(opts) {
7690
7843
  "",
7691
7844
  "When creating threads, pass `repoPath` from `list_workspaces` (or the path you just registered).",
7692
7845
  orchId ? `Pass parentThreadId="${orchId}" (or omit it). Never invent another parentThreadId.` : "Pass `parentThreadId` for children (this chat's id from the turn reminder).",
7693
- "Omit `agent` / `model` on `create_thread` unless you have a reason to override Account defaults.",
7694
- "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.",
7846
+ "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.",
7847
+ "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).",
7695
7848
  "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).",
7696
7849
  "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.",
7697
7850
  "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.",
@@ -7700,9 +7853,9 @@ function ensureGlobalCoordinatorCwd(opts) {
7700
7853
  "Always ask worktree agents to commit, push, and open draft PRs (`ask_git` / `send_to_thread`). If the user gave a goal (Greptile 5/5, CI green), pass that goal through so they watch-fix-push until it lands \u2014 do not start that loop on a plain push, and do not tell the human to poll. Tell them to merge only when the user explicitly asked. The worktree agent runs git/gh; never merge from this orchestration cwd."
7701
7854
  ].join("\n");
7702
7855
  try {
7703
- (0, import_node_fs18.writeFileSync)((0, import_node_path21.join)(dir, "CLAUDE.md"), `${body}
7856
+ (0, import_node_fs19.writeFileSync)((0, import_node_path22.join)(dir, "CLAUDE.md"), `${body}
7704
7857
  `, "utf8");
7705
- (0, import_node_fs18.writeFileSync)((0, import_node_path21.join)(dir, "AGENTS.md"), `${body}
7858
+ (0, import_node_fs19.writeFileSync)((0, import_node_path22.join)(dir, "AGENTS.md"), `${body}
7706
7859
  `, "utf8");
7707
7860
  } catch {
7708
7861
  }
@@ -7734,12 +7887,12 @@ function coordinatorSystemPrompt(opts) {
7734
7887
  formatWorkspaceInventory(opts.workspaces)
7735
7888
  ].join("\n");
7736
7889
  }
7737
- var import_node_fs18, import_node_path21, COORDINATOR_TOOL_PLAYBOOK, SLACK_REPLY_FORMATTING;
7890
+ var import_node_fs19, import_node_path22, COORDINATOR_TOOL_PLAYBOOK, SLACK_REPLY_FORMATTING;
7738
7891
  var init_coordinator_prompt = __esm({
7739
7892
  "src/orchestrator/coordinator-prompt.ts"() {
7740
7893
  "use strict";
7741
- import_node_fs18 = require("fs");
7742
- import_node_path21 = require("path");
7894
+ import_node_fs19 = require("fs");
7895
+ import_node_path22 = require("path");
7743
7896
  init_worktree();
7744
7897
  init_app_settings();
7745
7898
  init_paths();
@@ -7768,7 +7921,7 @@ var init_coordinator_prompt = __esm({
7768
7921
  "Workspaces:",
7769
7922
  "- add_workspace / remove_workspace \u2014 register or unregister a git repo",
7770
7923
  "Worktree threads (chats):",
7771
- "- 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)",
7924
+ "- 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",
7772
7925
  "- start_board_card \u2014 same as create_thread for a ticket/PR/named branch (attaches issue text when resolvable). Then send_to_thread.",
7773
7926
  "- 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.",
7774
7927
  "- 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.",
@@ -8054,32 +8207,32 @@ var init_global_workspace = __esm({
8054
8207
  function brightsyConfigPath() {
8055
8208
  const override = process.env.BRIGHTSY_CONFIG?.trim();
8056
8209
  if (override) return override;
8057
- return (0, import_node_path22.join)((0, import_node_os7.homedir)(), ".brightsy", "config.json");
8210
+ return (0, import_node_path23.join)((0, import_node_os7.homedir)(), ".brightsy", "config.json");
8058
8211
  }
8059
8212
  function loadBrightsyConfig() {
8060
8213
  const path = brightsyConfigPath();
8061
- if (!(0, import_node_fs19.existsSync)(path)) {
8214
+ if (!(0, import_node_fs20.existsSync)(path)) {
8062
8215
  throw new Error("Brightsy not logged in \u2014 run `brightsy login` first");
8063
8216
  }
8064
- const raw = JSON.parse((0, import_node_fs19.readFileSync)(path, "utf8"));
8217
+ const raw = JSON.parse((0, import_node_fs20.readFileSync)(path, "utf8"));
8065
8218
  if (!raw.access_token || !raw.account_id) {
8066
8219
  throw new Error("Brightsy config incomplete \u2014 run `brightsy login`");
8067
8220
  }
8068
8221
  return raw;
8069
8222
  }
8070
8223
  function saveBrightsyConfig(cfg) {
8071
- (0, import_node_fs19.writeFileSync)(brightsyConfigPath(), `${JSON.stringify(cfg, null, 2)}
8224
+ (0, import_node_fs20.writeFileSync)(brightsyConfigPath(), `${JSON.stringify(cfg, null, 2)}
8072
8225
  `, {
8073
8226
  mode: 384
8074
8227
  });
8075
8228
  }
8076
- var import_node_fs19, import_node_os7, import_node_path22;
8229
+ var import_node_fs20, import_node_os7, import_node_path23;
8077
8230
  var init_config = __esm({
8078
8231
  "src/brightsy/config.ts"() {
8079
8232
  "use strict";
8080
- import_node_fs19 = require("fs");
8233
+ import_node_fs20 = require("fs");
8081
8234
  import_node_os7 = require("os");
8082
- import_node_path22 = require("path");
8235
+ import_node_path23 = require("path");
8083
8236
  }
8084
8237
  });
8085
8238
 
@@ -8093,17 +8246,24 @@ var init_accounts = __esm({
8093
8246
  });
8094
8247
 
8095
8248
  // src/http/fetch.ts
8249
+ function tlsIssuerHint(code, message) {
8250
+ const text7 = `${code ?? ""} ${message}`;
8251
+ return TLS_ISSUER_RE.test(text7) ? TLS_ISSUER_HINT : "";
8252
+ }
8096
8253
  function formatFetchError(err, url) {
8097
8254
  if (!(err instanceof Error)) return `${String(err)} (${url})`;
8098
8255
  const cause = err.cause;
8099
8256
  let detail = "";
8257
+ let hint = tlsIssuerHint(void 0, err.message);
8100
8258
  if (cause instanceof Error) {
8101
8259
  const code = typeof cause.code === "string" ? cause.code : void 0;
8102
8260
  detail = code ? ` [${code}: ${cause.message}]` : ` [${cause.message}]`;
8261
+ hint = tlsIssuerHint(code, `${err.message} ${cause.message}`) || hint;
8103
8262
  } else if (cause != null) {
8104
8263
  detail = ` [${String(cause)}]`;
8264
+ hint = tlsIssuerHint(void 0, String(cause)) || hint;
8105
8265
  }
8106
- return `${err.message}${detail} (${url})`;
8266
+ return `${err.message}${detail} (${url})${hint}`;
8107
8267
  }
8108
8268
  async function httpFetch(input, init) {
8109
8269
  const url = typeof input === "string" ? input : input.href;
@@ -8114,11 +8274,13 @@ async function httpFetch(input, init) {
8114
8274
  throw new Error(formatFetchError(err, url));
8115
8275
  }
8116
8276
  }
8117
- var injected;
8277
+ var injected, TLS_ISSUER_RE, TLS_ISSUER_HINT;
8118
8278
  var init_fetch = __esm({
8119
8279
  "src/http/fetch.ts"() {
8120
8280
  "use strict";
8121
8281
  injected = null;
8282
+ TLS_ISSUER_RE = /UNABLE_TO_GET_ISSUER_CERT|UNABLE_TO_VERIFY_LEAF_SIGNATURE|SELF_SIGNED_CERT_IN_CHAIN/i;
8283
+ 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.";
8122
8284
  }
8123
8285
  });
8124
8286
 
@@ -8196,22 +8358,22 @@ var init_oauth = __esm({
8196
8358
 
8197
8359
  // src/brightsy/connected-teams.ts
8198
8360
  function storePath4() {
8199
- return (0, import_node_path23.join)(appDataDir(), "brightsy-teams.json");
8361
+ return (0, import_node_path24.join)(appDataDir(), "brightsy-teams.json");
8200
8362
  }
8201
8363
  function readStore4() {
8202
8364
  const path = storePath4();
8203
- if (!(0, import_node_fs20.existsSync)(path)) return [];
8365
+ if (!(0, import_node_fs21.existsSync)(path)) return [];
8204
8366
  try {
8205
- const parsed = JSON.parse((0, import_node_fs20.readFileSync)(path, "utf8"));
8367
+ const parsed = JSON.parse((0, import_node_fs21.readFileSync)(path, "utf8"));
8206
8368
  return Array.isArray(parsed.teams) ? parsed.teams : [];
8207
8369
  } catch {
8208
8370
  return [];
8209
8371
  }
8210
8372
  }
8211
8373
  function writeStore2(teams) {
8212
- (0, import_node_fs20.mkdirSync)(appDataDir(), { recursive: true });
8374
+ (0, import_node_fs21.mkdirSync)(appDataDir(), { recursive: true });
8213
8375
  const path = storePath4();
8214
- (0, import_node_fs20.writeFileSync)(path, `${JSON.stringify({ teams }, null, 2)}
8376
+ (0, import_node_fs21.writeFileSync)(path, `${JSON.stringify({ teams }, null, 2)}
8215
8377
  `, {
8216
8378
  mode: 384
8217
8379
  });
@@ -8317,12 +8479,12 @@ function brightsyMcpServerName(slug) {
8317
8479
  const cleaned = slug.replace(/[^A-Za-z0-9_-]/g, "_").replace(/^_+|_+$/g, "");
8318
8480
  return `brightsy_${cleaned || "team"}`;
8319
8481
  }
8320
- var import_node_fs20, import_node_path23;
8482
+ var import_node_fs21, import_node_path24;
8321
8483
  var init_connected_teams = __esm({
8322
8484
  "src/brightsy/connected-teams.ts"() {
8323
8485
  "use strict";
8324
- import_node_fs20 = require("fs");
8325
- import_node_path23 = require("path");
8486
+ import_node_fs21 = require("fs");
8487
+ import_node_path24 = require("path");
8326
8488
  init_paths();
8327
8489
  init_accounts();
8328
8490
  init_config();
@@ -8710,11 +8872,11 @@ async function syncCliForTarget(accountId) {
8710
8872
  }
8711
8873
  applyConnectedTeamToCli(team);
8712
8874
  }
8713
- var import_node_fs21, brightsyAdapter;
8875
+ var import_node_fs22, brightsyAdapter;
8714
8876
  var init_brightsy = __esm({
8715
8877
  "src/agents/brightsy.ts"() {
8716
8878
  "use strict";
8717
- import_node_fs21 = require("fs");
8879
+ import_node_fs22 = require("fs");
8718
8880
  init_run();
8719
8881
  init_connected_teams();
8720
8882
  init_config();
@@ -8729,7 +8891,7 @@ var init_brightsy = __esm({
8729
8891
  async detect() {
8730
8892
  const brightsy = resolveAgentExecutable("brightsy");
8731
8893
  if (brightsy !== "brightsy") {
8732
- if (!(0, import_node_fs21.existsSync)(brightsy)) {
8894
+ if (!(0, import_node_fs22.existsSync)(brightsy)) {
8733
8895
  return {
8734
8896
  agent: "brightsy",
8735
8897
  installed: false,
@@ -9321,43 +9483,43 @@ function electronResourcesPath() {
9321
9483
  function packagedCursorRuntimeDir() {
9322
9484
  const resources = electronResourcesPath();
9323
9485
  if (!resources) return null;
9324
- const dir = (0, import_node_path24.join)(resources, "cursor-runtime");
9325
- if (!(0, import_node_fs22.existsSync)((0, import_node_path24.join)(dir, "core-dist", "agents", "cursor-runner.js"))) return null;
9486
+ const dir = (0, import_node_path25.join)(resources, "cursor-runtime");
9487
+ if (!(0, import_node_fs23.existsSync)((0, import_node_path25.join)(dir, "core-dist", "agents", "cursor-runner.js"))) return null;
9326
9488
  return dir;
9327
9489
  }
9328
9490
  function packagedCursorRunnerPath() {
9329
9491
  const dir = packagedCursorRuntimeDir();
9330
- return dir ? (0, import_node_path24.join)(dir, "core-dist", "agents", "cursor-runner.js") : null;
9492
+ return dir ? (0, import_node_path25.join)(dir, "core-dist", "agents", "cursor-runner.js") : null;
9331
9493
  }
9332
9494
  function packagedMcpDir() {
9333
9495
  const resources = electronResourcesPath();
9334
9496
  if (!resources) return null;
9335
- const dir = (0, import_node_path24.join)(resources, "sideboard-mcp");
9336
- if (!(0, import_node_fs22.existsSync)((0, import_node_path24.join)(dir, "core-dist", "mcp", "run-stdio.js"))) return null;
9497
+ const dir = (0, import_node_path25.join)(resources, "sideboard-mcp");
9498
+ if (!(0, import_node_fs23.existsSync)((0, import_node_path25.join)(dir, "core-dist", "mcp", "run-stdio.js"))) return null;
9337
9499
  return dir;
9338
9500
  }
9339
9501
  function packagedMcpStdioPath() {
9340
9502
  const dir = packagedMcpDir();
9341
- return dir ? (0, import_node_path24.join)(dir, "core-dist", "mcp", "run-stdio.js") : null;
9503
+ return dir ? (0, import_node_path25.join)(dir, "core-dist", "mcp", "run-stdio.js") : null;
9342
9504
  }
9343
9505
  function packagedBundledNodePath() {
9344
9506
  const resources = electronResourcesPath();
9345
9507
  if (!resources) return null;
9346
- const bin = (0, import_node_path24.join)(resources, "node", "bin", "node");
9347
- if (!(0, import_node_fs22.existsSync)(bin)) return null;
9508
+ const bin = (0, import_node_path25.join)(resources, "node", "bin", "node");
9509
+ if (!(0, import_node_fs23.existsSync)(bin)) return null;
9348
9510
  return bin;
9349
9511
  }
9350
9512
  function packagedCursorRipgrepCandidate(platformPkg, binName) {
9351
9513
  const dir = packagedCursorRuntimeDir();
9352
9514
  if (!dir) return null;
9353
- return (0, import_node_path24.join)(dir, "node_modules", platformPkg, "bin", binName);
9515
+ return (0, import_node_path25.join)(dir, "node_modules", platformPkg, "bin", binName);
9354
9516
  }
9355
- var import_node_fs22, import_node_path24;
9517
+ var import_node_fs23, import_node_path25;
9356
9518
  var init_packaged_runtime = __esm({
9357
9519
  "src/agents/packaged-runtime.ts"() {
9358
9520
  "use strict";
9359
- import_node_fs22 = require("fs");
9360
- import_node_path24 = require("path");
9521
+ import_node_fs23 = require("fs");
9522
+ import_node_path25 = require("path");
9361
9523
  }
9362
9524
  });
9363
9525
 
@@ -9377,6 +9539,7 @@ function applyAgentRunnerHeapEnv(env) {
9377
9539
  env.NODE_OPTIONS,
9378
9540
  AGENT_RUNNER_MAX_OLD_SPACE_MB
9379
9541
  );
9542
+ applySystemCaEnv(env);
9380
9543
  }
9381
9544
  function envWithAgentHeap(env) {
9382
9545
  const next = { ...env };
@@ -9391,7 +9554,7 @@ function unpackedAsarPath(filePath) {
9391
9554
  if (!isAsarPath(filePath)) return null;
9392
9555
  const unpacked = filePath.replace(/\.asar(?=[/\\])/, ".asar.unpacked");
9393
9556
  if (unpacked === filePath) return null;
9394
- return (0, import_node_fs23.existsSync)(unpacked) ? unpacked : null;
9557
+ return (0, import_node_fs24.existsSync)(unpacked) ? unpacked : null;
9395
9558
  }
9396
9559
  function nodeReadableScriptPath(scriptPath) {
9397
9560
  return unpackedAsarPath(scriptPath) ?? scriptPath;
@@ -9431,37 +9594,37 @@ function pickPreferredNode(candidates) {
9431
9594
  return best;
9432
9595
  }
9433
9596
  function versionDirNodeBins(root, toBin) {
9434
- if (!(0, import_node_fs23.existsSync)(root)) return [];
9597
+ if (!(0, import_node_fs24.existsSync)(root)) return [];
9435
9598
  try {
9436
- return (0, import_node_fs23.readdirSync)(root).map(toBin);
9599
+ return (0, import_node_fs24.readdirSync)(root).map(toBin);
9437
9600
  } catch {
9438
9601
  return [];
9439
9602
  }
9440
9603
  }
9441
9604
  function defaultNodeBinCandidates(home = (0, import_node_os8.homedir)()) {
9442
9605
  const kegs = ["/opt/homebrew", "/usr/local"].flatMap(
9443
- (prefix) => PREFERRED_LTS_MAJORS.map((major) => (0, import_node_path25.join)(prefix, "opt", `node@${major}`, "bin", "node"))
9606
+ (prefix) => PREFERRED_LTS_MAJORS.map((major) => (0, import_node_path26.join)(prefix, "opt", `node@${major}`, "bin", "node"))
9444
9607
  );
9445
9608
  return [
9446
9609
  ...kegs,
9447
9610
  "/opt/homebrew/bin/node",
9448
9611
  "/usr/local/bin/node",
9449
- (0, import_node_path25.join)(home, ".local/share/fnm/aliases/default/bin/node"),
9450
- (0, import_node_path25.join)(home, ".nvm/current/bin/node"),
9451
- (0, import_node_path25.join)(home, ".volta/bin/node"),
9452
- (0, import_node_path25.join)(home, ".asdf/shims/node"),
9453
- (0, import_node_path25.join)(home, ".local/share/mise/shims/node"),
9612
+ (0, import_node_path26.join)(home, ".local/share/fnm/aliases/default/bin/node"),
9613
+ (0, import_node_path26.join)(home, ".nvm/current/bin/node"),
9614
+ (0, import_node_path26.join)(home, ".volta/bin/node"),
9615
+ (0, import_node_path26.join)(home, ".asdf/shims/node"),
9616
+ (0, import_node_path26.join)(home, ".local/share/mise/shims/node"),
9454
9617
  ...versionDirNodeBins(
9455
- (0, import_node_path25.join)(home, ".nvm", "versions", "node"),
9456
- (name) => (0, import_node_path25.join)(home, ".nvm", "versions", "node", name, "bin", "node")
9618
+ (0, import_node_path26.join)(home, ".nvm", "versions", "node"),
9619
+ (name) => (0, import_node_path26.join)(home, ".nvm", "versions", "node", name, "bin", "node")
9457
9620
  ),
9458
9621
  ...versionDirNodeBins(
9459
- (0, import_node_path25.join)(home, ".local/share/fnm", "node-versions"),
9460
- (name) => (0, import_node_path25.join)(home, ".local/share/fnm", "node-versions", name, "installation", "bin", "node")
9622
+ (0, import_node_path26.join)(home, ".local/share/fnm", "node-versions"),
9623
+ (name) => (0, import_node_path26.join)(home, ".local/share/fnm", "node-versions", name, "installation", "bin", "node")
9461
9624
  ),
9462
9625
  ...versionDirNodeBins(
9463
- (0, import_node_path25.join)(home, ".volta", "tools", "image", "node"),
9464
- (name) => (0, import_node_path25.join)(home, ".volta", "tools", "image", "node", name, "bin", "node")
9626
+ (0, import_node_path26.join)(home, ".volta", "tools", "image", "node"),
9627
+ (name) => (0, import_node_path26.join)(home, ".volta", "tools", "image", "node", name, "bin", "node")
9465
9628
  )
9466
9629
  ];
9467
9630
  }
@@ -9470,10 +9633,10 @@ function uniqueExistingNodeBins(paths) {
9470
9633
  const out = [];
9471
9634
  for (const raw of paths) {
9472
9635
  const p = raw.trim();
9473
- if (!p || !(0, import_node_fs23.existsSync)(p) || isElectronLikeCommand(p)) continue;
9636
+ if (!p || !(0, import_node_fs24.existsSync)(p) || isElectronLikeCommand(p)) continue;
9474
9637
  let key = p;
9475
9638
  try {
9476
- key = (0, import_node_fs23.realpathSync)(p);
9639
+ key = (0, import_node_fs24.realpathSync)(p);
9477
9640
  } catch {
9478
9641
  continue;
9479
9642
  }
@@ -9553,14 +9716,15 @@ async function resolveNodeLaunch(scriptPath) {
9553
9716
  env: { ELECTRON_RUN_AS_NODE: "1" }
9554
9717
  };
9555
9718
  }
9556
- var import_node_fs23, import_node_os8, import_node_path25, AGENT_RUNNER_MAX_OLD_SPACE_MB, MAX_OLD_SPACE_FLAG, PREFERRED_LTS_MAJORS;
9719
+ var import_node_fs24, import_node_os8, import_node_path26, AGENT_RUNNER_MAX_OLD_SPACE_MB, MAX_OLD_SPACE_FLAG, PREFERRED_LTS_MAJORS;
9557
9720
  var init_node_launch = __esm({
9558
9721
  "src/agents/node-launch.ts"() {
9559
9722
  "use strict";
9560
- import_node_fs23 = require("fs");
9723
+ import_node_fs24 = require("fs");
9561
9724
  import_node_os8 = require("os");
9562
- import_node_path25 = require("path");
9725
+ import_node_path26 = require("path");
9563
9726
  init_nested_electron_env();
9727
+ init_system_ca();
9564
9728
  init_run();
9565
9729
  init_packaged_runtime();
9566
9730
  AGENT_RUNNER_MAX_OLD_SPACE_MB = 8192;
@@ -9660,37 +9824,37 @@ function corePackageDir() {
9660
9824
  try {
9661
9825
  const url = import_meta.url;
9662
9826
  if (typeof url === "string" && url.length > 0) {
9663
- return (0, import_node_path26.dirname)((0, import_node_url.fileURLToPath)(url));
9827
+ return (0, import_node_path27.dirname)((0, import_node_url.fileURLToPath)(url));
9664
9828
  }
9665
9829
  } catch {
9666
9830
  }
9667
9831
  try {
9668
- const req = (0, import_node_module.createRequire)((0, import_node_path26.join)(process.cwd(), "package.json"));
9669
- return (0, import_node_path26.dirname)(req.resolve("@sideboard-ai/core"));
9832
+ const req = (0, import_node_module.createRequire)((0, import_node_path27.join)(process.cwd(), "package.json"));
9833
+ return (0, import_node_path27.dirname)(req.resolve("@sideboard-ai/core"));
9670
9834
  } catch {
9671
9835
  return process.cwd();
9672
9836
  }
9673
9837
  }
9674
9838
  function findSideboardMcpJsEntry() {
9675
9839
  const override = process.env.SIDEBOARD_MCP_ENTRY?.trim() || process.env.SIDEBOARD_CLI?.trim();
9676
- if (override && (0, import_node_fs24.existsSync)(override)) return override;
9840
+ if (override && (0, import_node_fs25.existsSync)(override)) return override;
9677
9841
  const packaged = packagedMcpStdioPath();
9678
9842
  if (packaged) return packaged;
9679
9843
  let dir = corePackageDir();
9680
9844
  for (let i = 0; i < 10; i++) {
9681
9845
  const candidates = [
9682
- (0, import_node_path26.join)(dir, "mcp/run-stdio.js"),
9683
- (0, import_node_path26.join)(dir, "mcp/run-stdio.cjs"),
9684
- (0, import_node_path26.join)(dir, "dist/mcp/run-stdio.js"),
9685
- (0, import_node_path26.join)(dir, "dist/mcp/run-stdio.cjs"),
9686
- (0, import_node_path26.join)(dir, "packages/core/dist/mcp/run-stdio.js"),
9687
- (0, import_node_path26.join)(dir, "packages/cli/dist/index.js"),
9688
- (0, import_node_path26.join)(dir, "cli/dist/index.js")
9846
+ (0, import_node_path27.join)(dir, "mcp/run-stdio.js"),
9847
+ (0, import_node_path27.join)(dir, "mcp/run-stdio.cjs"),
9848
+ (0, import_node_path27.join)(dir, "dist/mcp/run-stdio.js"),
9849
+ (0, import_node_path27.join)(dir, "dist/mcp/run-stdio.cjs"),
9850
+ (0, import_node_path27.join)(dir, "packages/core/dist/mcp/run-stdio.js"),
9851
+ (0, import_node_path27.join)(dir, "packages/cli/dist/index.js"),
9852
+ (0, import_node_path27.join)(dir, "cli/dist/index.js")
9689
9853
  ];
9690
9854
  for (const p of candidates) {
9691
- if ((0, import_node_fs24.existsSync)(p) && !isAsarPath(p)) return p;
9855
+ if ((0, import_node_fs25.existsSync)(p) && !isAsarPath(p)) return p;
9692
9856
  }
9693
- const parent = (0, import_node_path26.dirname)(dir);
9857
+ const parent = (0, import_node_path27.dirname)(dir);
9694
9858
  if (parent === dir) break;
9695
9859
  dir = parent;
9696
9860
  }
@@ -9837,19 +10001,19 @@ function writeMcpServersConfig(servers) {
9837
10001
  ...env ? { env } : {}
9838
10002
  };
9839
10003
  }
9840
- const dir = (0, import_node_fs24.mkdtempSync)((0, import_node_path26.join)((0, import_node_os9.tmpdir)(), "sideboard-mcp-"));
9841
- const cfgPath = (0, import_node_path26.join)(dir, "mcp.json");
9842
- (0, import_node_fs24.writeFileSync)(cfgPath, JSON.stringify({ mcpServers }, null, 2));
10004
+ const dir = (0, import_node_fs25.mkdtempSync)((0, import_node_path27.join)((0, import_node_os9.tmpdir)(), "sideboard-mcp-"));
10005
+ const cfgPath = (0, import_node_path27.join)(dir, "mcp.json");
10006
+ (0, import_node_fs25.writeFileSync)(cfgPath, JSON.stringify({ mcpServers }, null, 2));
9843
10007
  return cfgPath;
9844
10008
  }
9845
- var import_node_fs24, import_node_module, import_node_os9, import_node_path26, 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, brightsyMcpCommandCache, BRIGHTSY_WORD;
10009
+ var import_node_fs25, import_node_module, import_node_os9, import_node_path27, 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, brightsyMcpCommandCache, BRIGHTSY_WORD;
9846
10010
  var init_injected_mcp = __esm({
9847
10011
  "src/agents/injected-mcp.ts"() {
9848
10012
  "use strict";
9849
- import_node_fs24 = require("fs");
10013
+ import_node_fs25 = require("fs");
9850
10014
  import_node_module = require("module");
9851
10015
  import_node_os9 = require("os");
9852
- import_node_path26 = require("path");
10016
+ import_node_path27 = require("path");
9853
10017
  import_node_url = require("url");
9854
10018
  init_run();
9855
10019
  init_config();
@@ -10232,11 +10396,11 @@ function parseIssuesJson(raw) {
10232
10396
  }
10233
10397
  return [];
10234
10398
  }
10235
- var import_node_fs25, BASE_ALLOWED_TOOLS, CLAUDE_PRINT_BG_WAIT_CEILING_MS, CLAUDE_CHROME_ALLOWED_TOOLS, CLAUDE_PROMPT_ARG_MAX, mcpListCache, claudeAdapter;
10399
+ var import_node_fs26, BASE_ALLOWED_TOOLS, CLAUDE_PRINT_BG_WAIT_CEILING_MS, CLAUDE_CHROME_ALLOWED_TOOLS, CLAUDE_PROMPT_ARG_MAX, mcpListCache, claudeAdapter;
10236
10400
  var init_claude = __esm({
10237
10401
  "src/agents/claude.ts"() {
10238
10402
  "use strict";
10239
- import_node_fs25 = require("fs");
10403
+ import_node_fs26 = require("fs");
10240
10404
  init_run();
10241
10405
  init_app_settings();
10242
10406
  init_claude_mcp();
@@ -10276,7 +10440,7 @@ var init_claude = __esm({
10276
10440
  async detect() {
10277
10441
  const claude = resolveClaudeExecutable();
10278
10442
  if (claude !== "claude") {
10279
- if (!(0, import_node_fs25.existsSync)(claude)) {
10443
+ if (!(0, import_node_fs26.existsSync)(claude)) {
10280
10444
  return {
10281
10445
  agent: "claude",
10282
10446
  installed: false,
@@ -10535,13 +10699,13 @@ var init_claude = __esm({
10535
10699
  });
10536
10700
 
10537
10701
  // src/agents/user-mcp-config.ts
10538
- var import_node_fs26, import_node_os10, import_node_path27;
10702
+ var import_node_fs27, import_node_os10, import_node_path28;
10539
10703
  var init_user_mcp_config = __esm({
10540
10704
  "src/agents/user-mcp-config.ts"() {
10541
10705
  "use strict";
10542
- import_node_fs26 = require("fs");
10706
+ import_node_fs27 = require("fs");
10543
10707
  import_node_os10 = require("os");
10544
- import_node_path27 = require("path");
10708
+ import_node_path28 = require("path");
10545
10709
  init_paths();
10546
10710
  init_injected_mcp();
10547
10711
  }
@@ -10569,25 +10733,25 @@ function listMcpNamesFromCodexToml(text7) {
10569
10733
  }
10570
10734
  function readJsonObject(path) {
10571
10735
  try {
10572
- return JSON.parse((0, import_node_fs27.readFileSync)(path, "utf8"));
10736
+ return JSON.parse((0, import_node_fs28.readFileSync)(path, "utf8"));
10573
10737
  } catch {
10574
10738
  return {};
10575
10739
  }
10576
10740
  }
10577
10741
  function readText(path) {
10578
10742
  try {
10579
- return (0, import_node_fs27.readFileSync)(path, "utf8");
10743
+ return (0, import_node_fs28.readFileSync)(path, "utf8");
10580
10744
  } catch {
10581
10745
  return "";
10582
10746
  }
10583
10747
  }
10584
10748
  function userCodexConfigPaths(home = (0, import_node_os11.homedir)()) {
10585
- return [(0, import_node_path28.join)(home, ".codex", "config.toml"), (0, import_node_path28.join)(home, ".config", "codex", "config.toml")];
10749
+ return [(0, import_node_path29.join)(home, ".codex", "config.toml"), (0, import_node_path29.join)(home, ".config", "codex", "config.toml")];
10586
10750
  }
10587
10751
  function userOpencodeConfigPaths(home = (0, import_node_os11.homedir)()) {
10588
10752
  return [
10589
- (0, import_node_path28.join)(home, ".config", "opencode", "opencode.json"),
10590
- (0, import_node_path28.join)(home, ".config", "opencode", "opencode.jsonc")
10753
+ (0, import_node_path29.join)(home, ".config", "opencode", "opencode.json"),
10754
+ (0, import_node_path29.join)(home, ".config", "opencode", "opencode.jsonc")
10591
10755
  ];
10592
10756
  }
10593
10757
  function userMcpNamesToDisable(opts) {
@@ -10609,7 +10773,7 @@ function userMcpNamesToDisable(opts) {
10609
10773
  function listUserCodexMcpNames(home = (0, import_node_os11.homedir)()) {
10610
10774
  const names = [];
10611
10775
  for (const path of userCodexConfigPaths(home)) {
10612
- if (!(0, import_node_fs27.existsSync)(path)) continue;
10776
+ if (!(0, import_node_fs28.existsSync)(path)) continue;
10613
10777
  names.push(...listMcpNamesFromCodexToml(readText(path)));
10614
10778
  }
10615
10779
  return names;
@@ -10617,7 +10781,7 @@ function listUserCodexMcpNames(home = (0, import_node_os11.homedir)()) {
10617
10781
  function listUserOpencodeMcpNames(home = (0, import_node_os11.homedir)()) {
10618
10782
  const names = [];
10619
10783
  for (const path of userOpencodeConfigPaths(home)) {
10620
- if (!(0, import_node_fs27.existsSync)(path)) continue;
10784
+ if (!(0, import_node_fs28.existsSync)(path)) continue;
10621
10785
  names.push(...listMcpNamesFromJsonMap(readJsonObject(path), "mcp"));
10622
10786
  }
10623
10787
  return names;
@@ -10630,13 +10794,13 @@ function toCodexDisableUserMcpArgs(names) {
10630
10794
  }
10631
10795
  return args;
10632
10796
  }
10633
- var import_node_fs27, import_node_os11, import_node_path28, import_smol_toml2;
10797
+ var import_node_fs28, import_node_os11, import_node_path29, import_smol_toml2;
10634
10798
  var init_orch_mcp_isolation = __esm({
10635
10799
  "src/agents/orch-mcp-isolation.ts"() {
10636
10800
  "use strict";
10637
- import_node_fs27 = require("fs");
10801
+ import_node_fs28 = require("fs");
10638
10802
  import_node_os11 = require("os");
10639
- import_node_path28 = require("path");
10803
+ import_node_path29 = require("path");
10640
10804
  import_smol_toml2 = require("smol-toml");
10641
10805
  init_user_mcp_config();
10642
10806
  }
@@ -10652,7 +10816,7 @@ async function listCodexModels() {
10652
10816
  if (codex === "codex") {
10653
10817
  const which = await run("which", ["codex"], { reject: false });
10654
10818
  if (which.exitCode !== 0) return FALLBACK_CODEX_MODELS;
10655
- } else if (!(0, import_node_fs28.existsSync)(codex)) {
10819
+ } else if (!(0, import_node_fs29.existsSync)(codex)) {
10656
10820
  return FALLBACK_CODEX_MODELS;
10657
10821
  }
10658
10822
  const listed = await run(codex, ["debug", "models"], { reject: false });
@@ -10687,12 +10851,12 @@ function usageFromCodex(usage) {
10687
10851
  }
10688
10852
  function codexConfigHasNetworkAccess() {
10689
10853
  const candidates = [
10690
- (0, import_node_path29.join)((0, import_node_os12.homedir)(), ".codex", "config.toml"),
10691
- (0, import_node_path29.join)((0, import_node_os12.homedir)(), ".config", "codex", "config.toml")
10854
+ (0, import_node_path30.join)((0, import_node_os12.homedir)(), ".codex", "config.toml"),
10855
+ (0, import_node_path30.join)((0, import_node_os12.homedir)(), ".config", "codex", "config.toml")
10692
10856
  ];
10693
10857
  for (const path of candidates) {
10694
- if (!(0, import_node_fs28.existsSync)(path)) continue;
10695
- const text7 = (0, import_node_fs28.readFileSync)(path, "utf8");
10858
+ if (!(0, import_node_fs29.existsSync)(path)) continue;
10859
+ const text7 = (0, import_node_fs29.readFileSync)(path, "utf8");
10696
10860
  if (/network_access\s*=\s*true/.test(text7)) return true;
10697
10861
  }
10698
10862
  return false;
@@ -10724,21 +10888,21 @@ function asRecord2(value) {
10724
10888
  return void 0;
10725
10889
  }
10726
10890
  function codexLooksAuthenticated() {
10727
- const authPath = (0, import_node_path29.join)((0, import_node_os12.homedir)(), ".codex", "auth.json");
10728
- if (!(0, import_node_fs28.existsSync)(authPath)) return false;
10891
+ const authPath = (0, import_node_path30.join)((0, import_node_os12.homedir)(), ".codex", "auth.json");
10892
+ if (!(0, import_node_fs29.existsSync)(authPath)) return false;
10729
10893
  try {
10730
- return (0, import_node_fs28.statSync)(authPath).size > 2;
10894
+ return (0, import_node_fs29.statSync)(authPath).size > 2;
10731
10895
  } catch {
10732
10896
  return false;
10733
10897
  }
10734
10898
  }
10735
- var import_node_fs28, import_node_os12, import_node_path29, CODEX_PROMPT_ARG_MAX, FALLBACK_CODEX_MODELS, cachedCodexModels, CODEX_MODEL_CACHE_MS, codexAdapter;
10899
+ var import_node_fs29, import_node_os12, import_node_path30, CODEX_PROMPT_ARG_MAX, FALLBACK_CODEX_MODELS, cachedCodexModels, CODEX_MODEL_CACHE_MS, codexAdapter;
10736
10900
  var init_codex = __esm({
10737
10901
  "src/agents/codex.ts"() {
10738
10902
  "use strict";
10739
- import_node_fs28 = require("fs");
10903
+ import_node_fs29 = require("fs");
10740
10904
  import_node_os12 = require("os");
10741
- import_node_path29 = require("path");
10905
+ import_node_path30 = require("path");
10742
10906
  init_run();
10743
10907
  init_app_settings();
10744
10908
  init_global_workspace();
@@ -10764,7 +10928,7 @@ var init_codex = __esm({
10764
10928
  async detect() {
10765
10929
  const codex = resolveAgentExecutable("codex");
10766
10930
  if (codex !== "codex") {
10767
- if (!(0, import_node_fs28.existsSync)(codex)) {
10931
+ if (!(0, import_node_fs29.existsSync)(codex)) {
10768
10932
  return {
10769
10933
  agent: "codex",
10770
10934
  installed: false,
@@ -11067,21 +11231,21 @@ function platformRipgrepPackage() {
11067
11231
  }
11068
11232
  function usableRipgrepPath(candidate) {
11069
11233
  const raw = candidate?.trim();
11070
- if (!raw || !(0, import_node_path30.isAbsolute)(raw)) return null;
11234
+ if (!raw || !(0, import_node_path31.isAbsolute)(raw)) return null;
11071
11235
  const readable = nodeReadableScriptPath(raw);
11072
- if (!(0, import_node_fs29.existsSync)(readable) || isAsarPath(readable)) return null;
11236
+ if (!(0, import_node_fs30.existsSync)(readable) || isAsarPath(readable)) return null;
11073
11237
  return readable;
11074
11238
  }
11075
11239
  function walkForBundledRipgrep(startFile) {
11076
11240
  if (!startFile) return null;
11077
11241
  const pkg = platformRipgrepPackage();
11078
11242
  const name = rgBinaryName();
11079
- let dir = (0, import_node_path30.dirname)((0, import_node_path30.resolve)(startFile));
11080
- const root = (0, import_node_path30.parse)(dir).root;
11243
+ let dir = (0, import_node_path31.dirname)((0, import_node_path31.resolve)(startFile));
11244
+ const root = (0, import_node_path31.parse)(dir).root;
11081
11245
  while (dir !== root) {
11082
- const hit = usableRipgrepPath((0, import_node_path30.join)(dir, "node_modules", pkg, "bin", name));
11246
+ const hit = usableRipgrepPath((0, import_node_path31.join)(dir, "node_modules", pkg, "bin", name));
11083
11247
  if (hit) return hit;
11084
- const next = (0, import_node_path30.dirname)(dir);
11248
+ const next = (0, import_node_path31.dirname)(dir);
11085
11249
  if (next === dir) break;
11086
11250
  dir = next;
11087
11251
  }
@@ -11091,7 +11255,7 @@ function requireResolveBundledRipgrep(fromFile) {
11091
11255
  try {
11092
11256
  const req = (0, import_node_module2.createRequire)(fromFile);
11093
11257
  const pkgJson = req.resolve(`${platformRipgrepPackage()}/package.json`);
11094
- return usableRipgrepPath((0, import_node_path30.join)((0, import_node_path30.dirname)(pkgJson), "bin", rgBinaryName()));
11258
+ return usableRipgrepPath((0, import_node_path31.join)((0, import_node_path31.dirname)(pkgJson), "bin", rgBinaryName()));
11095
11259
  } catch {
11096
11260
  return null;
11097
11261
  }
@@ -11113,13 +11277,13 @@ function cursorRipgrepEnv(opts) {
11113
11277
  const path = resolveCursorRipgrepPath(opts);
11114
11278
  return path ? { [RIPGREP_ENV]: path } : {};
11115
11279
  }
11116
- var import_node_fs29, import_node_module2, import_node_path30, RIPGREP_ENV;
11280
+ var import_node_fs30, import_node_module2, import_node_path31, RIPGREP_ENV;
11117
11281
  var init_cursor_ripgrep = __esm({
11118
11282
  "src/agents/cursor-ripgrep.ts"() {
11119
11283
  "use strict";
11120
- import_node_fs29 = require("fs");
11284
+ import_node_fs30 = require("fs");
11121
11285
  import_node_module2 = require("module");
11122
- import_node_path30 = require("path");
11286
+ import_node_path31 = require("path");
11123
11287
  init_node_launch();
11124
11288
  init_packaged_runtime();
11125
11289
  RIPGREP_ENV = "CURSOR_RIPGREP_PATH";
@@ -11157,11 +11321,11 @@ function entryDir() {
11157
11321
  const cjsDir = typeof __dirname !== "undefined" ? __dirname : "";
11158
11322
  if (cjsDir) return cjsDir;
11159
11323
  try {
11160
- return (0, import_node_path31.dirname)((0, import_node_url2.fileURLToPath)(import_meta2.url));
11324
+ return (0, import_node_path32.dirname)((0, import_node_url2.fileURLToPath)(import_meta2.url));
11161
11325
  } catch {
11162
11326
  try {
11163
11327
  const req = (0, import_node_module3.createRequire)(process.cwd() + "/");
11164
- return (0, import_node_path31.dirname)(req.resolve("@sideboard-ai/core"));
11328
+ return (0, import_node_path32.dirname)(req.resolve("@sideboard-ai/core"));
11165
11329
  } catch {
11166
11330
  return process.cwd();
11167
11331
  }
@@ -11172,27 +11336,27 @@ function cursorRunnerPath() {
11172
11336
  if (packaged) return packaged;
11173
11337
  const root = entryDir();
11174
11338
  const candidates = [
11175
- (0, import_node_path31.join)(root, "agents", "cursor-runner.js"),
11176
- (0, import_node_path31.join)(root, "agents", "cursor-runner.cjs"),
11339
+ (0, import_node_path32.join)(root, "agents", "cursor-runner.js"),
11340
+ (0, import_node_path32.join)(root, "agents", "cursor-runner.cjs"),
11177
11341
  // If somehow resolved from package root instead of dist/
11178
- (0, import_node_path31.join)(root, "dist", "agents", "cursor-runner.js"),
11179
- (0, import_node_path31.join)(root, "dist", "agents", "cursor-runner.cjs"),
11342
+ (0, import_node_path32.join)(root, "dist", "agents", "cursor-runner.js"),
11343
+ (0, import_node_path32.join)(root, "dist", "agents", "cursor-runner.cjs"),
11180
11344
  // Source tree (dev): packages/core/src/agents/cursor-runner.ts
11181
- (0, import_node_path31.join)(root, "cursor-runner.ts"),
11182
- (0, import_node_path31.join)(root, "src", "agents", "cursor-runner.ts")
11345
+ (0, import_node_path32.join)(root, "cursor-runner.ts"),
11346
+ (0, import_node_path32.join)(root, "src", "agents", "cursor-runner.ts")
11183
11347
  ];
11184
11348
  for (const candidate of candidates) {
11185
- if ((0, import_node_fs30.existsSync)(candidate)) return candidate;
11349
+ if ((0, import_node_fs31.existsSync)(candidate)) return candidate;
11186
11350
  }
11187
11351
  return candidates[0];
11188
11352
  }
11189
- var import_node_fs30, import_node_module3, import_node_path31, import_node_url2, import_sdk, import_meta2, FALLBACK_CURSOR_MODELS, cachedModels, MODEL_CACHE_MS, cursorAdapter;
11353
+ var import_node_fs31, import_node_module3, import_node_path32, import_node_url2, import_sdk, import_meta2, FALLBACK_CURSOR_MODELS, cachedModels, MODEL_CACHE_MS, cursorAdapter;
11190
11354
  var init_cursor = __esm({
11191
11355
  "src/agents/cursor.ts"() {
11192
11356
  "use strict";
11193
- import_node_fs30 = require("fs");
11357
+ import_node_fs31 = require("fs");
11194
11358
  import_node_module3 = require("module");
11195
- import_node_path31 = require("path");
11359
+ import_node_path32 = require("path");
11196
11360
  import_node_url2 = require("url");
11197
11361
  import_sdk = require("@cursor/sdk");
11198
11362
  init_run();
@@ -11344,7 +11508,7 @@ async function listOpencodeModels() {
11344
11508
  if (opencode === "opencode") {
11345
11509
  const which = await run("which", ["opencode"], { reject: false });
11346
11510
  if (which.exitCode !== 0) return FALLBACK_OPENCODE_MODELS;
11347
- } else if (!(0, import_node_fs31.existsSync)(opencode)) {
11511
+ } else if (!(0, import_node_fs32.existsSync)(opencode)) {
11348
11512
  return FALLBACK_OPENCODE_MODELS;
11349
11513
  }
11350
11514
  const listed = await run(opencode, ["models"], { reject: false });
@@ -11374,11 +11538,11 @@ function usageFromOpencode(tokens) {
11374
11538
  cacheWriteTokens: tokens.cache?.write ? Number(tokens.cache.write) : void 0
11375
11539
  };
11376
11540
  }
11377
- var import_node_fs31, FALLBACK_OPENCODE_MODELS, cachedOpencodeModels, OPENCODE_MODEL_CACHE_MS, opencodeAdapter;
11541
+ var import_node_fs32, FALLBACK_OPENCODE_MODELS, cachedOpencodeModels, OPENCODE_MODEL_CACHE_MS, opencodeAdapter;
11378
11542
  var init_opencode = __esm({
11379
11543
  "src/agents/opencode.ts"() {
11380
11544
  "use strict";
11381
- import_node_fs31 = require("fs");
11545
+ import_node_fs32 = require("fs");
11382
11546
  init_run();
11383
11547
  init_app_settings();
11384
11548
  init_global_workspace();
@@ -11406,7 +11570,7 @@ var init_opencode = __esm({
11406
11570
  async detect() {
11407
11571
  const opencode = resolveAgentExecutable("opencode");
11408
11572
  if (opencode !== "opencode") {
11409
- if (!(0, import_node_fs31.existsSync)(opencode)) {
11573
+ if (!(0, import_node_fs32.existsSync)(opencode)) {
11410
11574
  return {
11411
11575
  agent: "opencode",
11412
11576
  installed: false,
@@ -11934,15 +12098,15 @@ var init_agents = __esm({
11934
12098
 
11935
12099
  // src/hook/worktree-pkg-cache.ts
11936
12100
  function worktreePkgCacheRoot(worktreePath) {
11937
- return (0, import_node_path32.join)(worktreePath, WORKTREE_PKG_CACHE_REL);
12101
+ return (0, import_node_path33.join)(worktreePath, WORKTREE_PKG_CACHE_REL);
11938
12102
  }
11939
12103
  function worktreePkgCacheEnv(worktreePath) {
11940
12104
  const root = worktreePkgCacheRoot(worktreePath);
11941
- const store = (0, import_node_path32.join)(root, "pnpm-store");
11942
- const pnpmCache = (0, import_node_path32.join)(root, "pnpm");
11943
- const npmCache = (0, import_node_path32.join)(root, "npm");
11944
- const nodeGyp = (0, import_node_path32.join)(root, "node-gyp");
11945
- const electron = (0, import_node_path32.join)(root, "electron");
12105
+ const store = (0, import_node_path33.join)(root, "pnpm-store");
12106
+ const pnpmCache = (0, import_node_path33.join)(root, "pnpm");
12107
+ const npmCache = (0, import_node_path33.join)(root, "npm");
12108
+ const nodeGyp = (0, import_node_path33.join)(root, "node-gyp");
12109
+ const electron = (0, import_node_path33.join)(root, "electron");
11946
12110
  return {
11947
12111
  npm_config_store_dir: store,
11948
12112
  PNPM_STORE_DIR: store,
@@ -11964,8 +12128,8 @@ function fillGroup(env, keys, values) {
11964
12128
  }
11965
12129
  }
11966
12130
  function ensureWorktreePkgCacheDirs(worktreePath) {
11967
- if (!(0, import_node_fs32.existsSync)(worktreePath)) return;
11968
- (0, import_node_fs32.mkdirSync)(worktreePkgCacheRoot(worktreePath), { recursive: true });
12131
+ if (!(0, import_node_fs33.existsSync)(worktreePath)) return;
12132
+ (0, import_node_fs33.mkdirSync)(worktreePkgCacheRoot(worktreePath), { recursive: true });
11969
12133
  }
11970
12134
  function applyWorktreePkgCacheEnv(env, worktreePath) {
11971
12135
  const cwd = worktreePath.trim();
@@ -11978,12 +12142,12 @@ function applyWorktreePkgCacheEnv(env, worktreePath) {
11978
12142
  fillGroup(env, ["electron_config_cache"], next);
11979
12143
  ensureWorktreePkgCacheDirs(cwd);
11980
12144
  }
11981
- var import_node_fs32, import_node_path32, WORKTREE_PKG_CACHE_REL;
12145
+ var import_node_fs33, import_node_path33, WORKTREE_PKG_CACHE_REL;
11982
12146
  var init_worktree_pkg_cache = __esm({
11983
12147
  "src/hook/worktree-pkg-cache.ts"() {
11984
12148
  "use strict";
11985
- import_node_fs32 = require("fs");
11986
- import_node_path32 = require("path");
12149
+ import_node_fs33 = require("fs");
12150
+ import_node_path33 = require("path");
11987
12151
  WORKTREE_PKG_CACHE_REL = ".context/.sideboard/pkg-cache";
11988
12152
  }
11989
12153
  });
@@ -12658,7 +12822,7 @@ function buildSessionSeed(messages, opts) {
12658
12822
  for (let i = blocks.length - 1; i >= 0; i--) {
12659
12823
  if (keep[i]) continue;
12660
12824
  const next = used + blocks[i].length + 2;
12661
- if (next > maxChars && used > 0) break;
12825
+ if (next > maxChars && used > 0) continue;
12662
12826
  keep[i] = true;
12663
12827
  used = next;
12664
12828
  }
@@ -13088,21 +13252,21 @@ function shouldRefreshReviewRequestTemplate(content) {
13088
13252
  return LEGACY_REVIEW_TEMPLATE_MARKERS.every((m) => trimmed.includes(m));
13089
13253
  }
13090
13254
  function readTextIfPresent(abs) {
13091
- if (!(0, import_node_fs33.existsSync)(abs)) return null;
13255
+ if (!(0, import_node_fs34.existsSync)(abs)) return null;
13092
13256
  try {
13093
- const content = (0, import_node_fs33.readFileSync)(abs, "utf8");
13257
+ const content = (0, import_node_fs34.readFileSync)(abs, "utf8");
13094
13258
  return content.trim() ? content : null;
13095
13259
  } catch {
13096
13260
  return null;
13097
13261
  }
13098
13262
  }
13099
13263
  function readLocalGuidelines(worktreePath) {
13100
- const localAbs = (0, import_node_path33.join)(worktreePath, REVIEW_REQUEST_PATH);
13264
+ const localAbs = (0, import_node_path34.join)(worktreePath, REVIEW_REQUEST_PATH);
13101
13265
  const localContent = readTextIfPresent(localAbs);
13102
13266
  if (localContent && !shouldRefreshReviewRequestTemplate(localContent)) {
13103
13267
  return { path: REVIEW_REQUEST_PATH, content: localContent };
13104
13268
  }
13105
- const legacyAbs = (0, import_node_path33.join)(worktreePath, LEGACY_REVIEW_REQUEST_PATH);
13269
+ const legacyAbs = (0, import_node_path34.join)(worktreePath, LEGACY_REVIEW_REQUEST_PATH);
13106
13270
  const legacyContent = readTextIfPresent(legacyAbs);
13107
13271
  if (legacyContent && !shouldRefreshReviewRequestTemplate(legacyContent)) {
13108
13272
  return { path: LEGACY_REVIEW_REQUEST_PATH, content: legacyContent };
@@ -13126,27 +13290,27 @@ function contextGuidelines(content, source) {
13126
13290
  };
13127
13291
  }
13128
13292
  function writeContextGuidelines(worktreePath, content) {
13129
- const abs = (0, import_node_path33.join)(worktreePath, CONTEXT_REVIEW_PATH);
13130
- (0, import_node_fs33.mkdirSync)((0, import_node_path33.dirname)(abs), { recursive: true });
13293
+ const abs = (0, import_node_path34.join)(worktreePath, CONTEXT_REVIEW_PATH);
13294
+ (0, import_node_fs34.mkdirSync)((0, import_node_path34.dirname)(abs), { recursive: true });
13131
13295
  const body = content.endsWith("\n") ? content : `${content}
13132
13296
  `;
13133
- (0, import_node_fs33.writeFileSync)(abs, body, "utf8");
13297
+ (0, import_node_fs34.writeFileSync)(abs, body, "utf8");
13134
13298
  return body;
13135
13299
  }
13136
13300
  function readSideboardReview(worktreePath, repoPath) {
13137
- const fromWorktree = readTextIfPresent((0, import_node_path33.join)(worktreePath, REPO_REVIEW_PATH));
13301
+ const fromWorktree = readTextIfPresent((0, import_node_path34.join)(worktreePath, REPO_REVIEW_PATH));
13138
13302
  if (fromWorktree) return fromWorktree;
13139
13303
  const repo = repoPath?.replace(/\/+$/, "");
13140
13304
  const wt = worktreePath.replace(/\/+$/, "");
13141
13305
  if (!repo || repo === wt) return null;
13142
- return readTextIfPresent((0, import_node_path33.join)(repo, REPO_REVIEW_PATH));
13306
+ return readTextIfPresent((0, import_node_path34.join)(repo, REPO_REVIEW_PATH));
13143
13307
  }
13144
13308
  function ensureReviewGuidelinesFile(worktreePath, repoPath) {
13145
- const skillContent = readTextIfPresent((0, import_node_path33.join)(worktreePath, REVIEW_SKILL_PATH));
13309
+ const skillContent = readTextIfPresent((0, import_node_path34.join)(worktreePath, REVIEW_SKILL_PATH));
13146
13310
  if (skillContent) {
13147
13311
  return { ...skillGuidelines(skillContent, "skill"), wrote: false };
13148
13312
  }
13149
- const contextContent = readTextIfPresent((0, import_node_path33.join)(worktreePath, CONTEXT_REVIEW_PATH));
13313
+ const contextContent = readTextIfPresent((0, import_node_path34.join)(worktreePath, CONTEXT_REVIEW_PATH));
13150
13314
  if (contextContent && !shouldRefreshReviewRequestTemplate(contextContent)) {
13151
13315
  return { ...contextGuidelines(contextContent, "local"), wrote: false };
13152
13316
  }
@@ -13201,13 +13365,13 @@ async function requestReview(threadRef, send) {
13201
13365
  const started = await send(tab.id, REVIEW_REQUEST_PREFILL);
13202
13366
  return { tab: started, from };
13203
13367
  }
13204
- var import_node_crypto7, import_node_fs33, import_node_path33, 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;
13368
+ var import_node_crypto7, import_node_fs34, import_node_path34, 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;
13205
13369
  var init_request_review = __esm({
13206
13370
  "src/review/request-review.ts"() {
13207
13371
  "use strict";
13208
13372
  import_node_crypto7 = require("crypto");
13209
- import_node_fs33 = require("fs");
13210
- import_node_path33 = require("path");
13373
+ import_node_fs34 = require("fs");
13374
+ import_node_path34 = require("path");
13211
13375
  init_global_workspace();
13212
13376
  init_chat_tabs();
13213
13377
  init_thread_store();
@@ -13233,9 +13397,9 @@ function matchSimpleGlob(pattern, name) {
13233
13397
  return new RegExp(`^${escaped}$`).test(name);
13234
13398
  }
13235
13399
  function readWorktreeInclude(repoPath) {
13236
- const path = (0, import_node_path34.join)(repoPath, ".worktreeinclude");
13237
- if (!(0, import_node_fs34.existsSync)(path)) return [];
13238
- return (0, import_node_fs34.readFileSync)(path, "utf8").split("\n").map((l) => l.trim()).filter((l) => l && !l.startsWith("#"));
13400
+ const path = (0, import_node_path35.join)(repoPath, ".worktreeinclude");
13401
+ if (!(0, import_node_fs35.existsSync)(path)) return [];
13402
+ return (0, import_node_fs35.readFileSync)(path, "utf8").split("\n").map((l) => l.trim()).filter((l) => l && !l.startsWith("#"));
13239
13403
  }
13240
13404
  function resolveFilesToCopy(repoPath) {
13241
13405
  const fromInclude = readWorktreeInclude(repoPath);
@@ -13245,10 +13409,10 @@ function resolveFilesToCopy(repoPath) {
13245
13409
  if (settings?.fileIncludeGlobs?.length) {
13246
13410
  const matched = [];
13247
13411
  try {
13248
- for (const entry of (0, import_node_fs34.readdirSync)(repoPath, { withFileTypes: true })) {
13412
+ for (const entry of (0, import_node_fs35.readdirSync)(repoPath, { withFileTypes: true })) {
13249
13413
  if (!entry.isFile()) continue;
13250
13414
  for (const glob of settings.fileIncludeGlobs) {
13251
- if (matchSimpleGlob(glob, entry.name) || matchSimpleGlob((0, import_node_path34.basename)(glob), entry.name)) {
13415
+ if (matchSimpleGlob(glob, entry.name) || matchSimpleGlob((0, import_node_path35.basename)(glob), entry.name)) {
13252
13416
  matched.push(entry.name);
13253
13417
  break;
13254
13418
  }
@@ -13260,7 +13424,7 @@ function resolveFilesToCopy(repoPath) {
13260
13424
  }
13261
13425
  const defaults = [];
13262
13426
  try {
13263
- for (const entry of (0, import_node_fs34.readdirSync)(repoPath, { withFileTypes: true })) {
13427
+ for (const entry of (0, import_node_fs35.readdirSync)(repoPath, { withFileTypes: true })) {
13264
13428
  if (entry.isFile() && entry.name.startsWith(".env")) {
13265
13429
  defaults.push(entry.name);
13266
13430
  }
@@ -13274,11 +13438,11 @@ function copyConfiguredFiles(repoPath, worktreePath) {
13274
13438
  const patterns = resolveFilesToCopy(repoPath);
13275
13439
  const copied = [];
13276
13440
  for (const rel of patterns) {
13277
- const src = (0, import_node_path34.join)(repoPath, rel);
13278
- if (!(0, import_node_fs34.existsSync)(src)) continue;
13279
- const dest = (0, import_node_path34.join)(worktreePath, rel);
13280
- (0, import_node_fs34.mkdirSync)((0, import_node_path34.dirname)(dest), { recursive: true });
13281
- (0, import_node_fs34.copyFileSync)(src, dest);
13441
+ const src = (0, import_node_path35.join)(repoPath, rel);
13442
+ if (!(0, import_node_fs35.existsSync)(src)) continue;
13443
+ const dest = (0, import_node_path35.join)(worktreePath, rel);
13444
+ (0, import_node_fs35.mkdirSync)((0, import_node_path35.dirname)(dest), { recursive: true });
13445
+ (0, import_node_fs35.copyFileSync)(src, dest);
13282
13446
  copied.push(rel);
13283
13447
  }
13284
13448
  return copied;
@@ -13313,7 +13477,7 @@ function buildWorkspaceScriptEnv(opts, baseEnv) {
13313
13477
  const env = stripNestedElectronEnv({
13314
13478
  ...baseEnv ?? process.env
13315
13479
  });
13316
- const name = opts.workspaceName ?? (0, import_node_path34.basename)(opts.worktreePath);
13480
+ const name = opts.workspaceName ?? (0, import_node_path35.basename)(opts.worktreePath);
13317
13481
  const ports = opts.ports ?? [];
13318
13482
  const primary = ports[0];
13319
13483
  env.SIDEBOARD_WORKSPACE_NAME = name;
@@ -13576,13 +13740,13 @@ async function startDevServer(repoPath, worktreePath, onLine, opts) {
13576
13740
  done: handle.done
13577
13741
  };
13578
13742
  }
13579
- var import_node_fs34, import_node_net, import_node_path34, import_execa4, import_node_readline3, PORT_RANGE_SIZE, cachedLoginEnv;
13743
+ var import_node_fs35, import_node_net, import_node_path35, import_execa4, import_node_readline3, PORT_RANGE_SIZE, cachedLoginEnv;
13580
13744
  var init_conductor = __esm({
13581
13745
  "src/hook/conductor.ts"() {
13582
13746
  "use strict";
13583
- import_node_fs34 = require("fs");
13747
+ import_node_fs35 = require("fs");
13584
13748
  import_node_net = require("net");
13585
- import_node_path34 = require("path");
13749
+ import_node_path35 = require("path");
13586
13750
  import_execa4 = require("execa");
13587
13751
  import_node_readline3 = require("readline");
13588
13752
  init_settings();
@@ -13601,7 +13765,7 @@ var init_conductor = __esm({
13601
13765
 
13602
13766
  // src/store/setup-log.ts
13603
13767
  function setupLogPath(threadId) {
13604
- return (0, import_node_path35.join)(threadsDir(), `${threadId}.setup.log.json`);
13768
+ return (0, import_node_path36.join)(threadsDir(), `${threadId}.setup.log.json`);
13605
13769
  }
13606
13770
  function emptySetupLog() {
13607
13771
  return { ...EMPTY };
@@ -13618,7 +13782,7 @@ function persistNow(threadId) {
13618
13782
  const snap = memory.get(threadId);
13619
13783
  if (!snap) return;
13620
13784
  try {
13621
- (0, import_node_fs35.writeFileSync)(setupLogPath(threadId), `${JSON.stringify(snap)}
13785
+ (0, import_node_fs36.writeFileSync)(setupLogPath(threadId), `${JSON.stringify(snap)}
13622
13786
  `, "utf8");
13623
13787
  } catch {
13624
13788
  }
@@ -13635,9 +13799,9 @@ function schedulePersist(threadId) {
13635
13799
  }
13636
13800
  function loadFromDisk(threadId) {
13637
13801
  const path = setupLogPath(threadId);
13638
- if (!(0, import_node_fs35.existsSync)(path)) return null;
13802
+ if (!(0, import_node_fs36.existsSync)(path)) return null;
13639
13803
  try {
13640
- const raw = JSON.parse((0, import_node_fs35.readFileSync)(path, "utf8"));
13804
+ const raw = JSON.parse((0, import_node_fs36.readFileSync)(path, "utf8"));
13641
13805
  return {
13642
13806
  output: typeof raw.output === "string" ? raw.output : "",
13643
13807
  running: Boolean(raw.running),
@@ -13693,12 +13857,12 @@ function finishSetupLog(threadId, exitCode, source) {
13693
13857
  persistNow(threadId);
13694
13858
  return clone(snap);
13695
13859
  }
13696
- var import_node_fs35, import_node_path35, EMPTY, memory, persistTimers;
13860
+ var import_node_fs36, import_node_path36, EMPTY, memory, persistTimers;
13697
13861
  var init_setup_log = __esm({
13698
13862
  "src/store/setup-log.ts"() {
13699
13863
  "use strict";
13700
- import_node_fs35 = require("fs");
13701
- import_node_path35 = require("path");
13864
+ import_node_fs36 = require("fs");
13865
+ import_node_path36 = require("path");
13702
13866
  init_paths();
13703
13867
  EMPTY = {
13704
13868
  output: "",
@@ -13722,9 +13886,9 @@ async function findOrphanWorktrees(repoPaths) {
13722
13886
  repoPaths?.length ? repoPaths : threads.map((t) => t.repoPath).filter(Boolean)
13723
13887
  );
13724
13888
  const homeRoot = sideboardWorkspacesDir();
13725
- if ((0, import_node_fs36.existsSync)(homeRoot)) {
13889
+ if ((0, import_node_fs37.existsSync)(homeRoot)) {
13726
13890
  try {
13727
- for (const entry of (0, import_node_fs36.readdirSync)(homeRoot, { withFileTypes: true })) {
13891
+ for (const entry of (0, import_node_fs37.readdirSync)(homeRoot, { withFileTypes: true })) {
13728
13892
  if (!entry.isDirectory()) continue;
13729
13893
  void entry;
13730
13894
  }
@@ -13734,7 +13898,7 @@ async function findOrphanWorktrees(repoPaths) {
13734
13898
  const orphans = [];
13735
13899
  const seen = /* @__PURE__ */ new Set();
13736
13900
  for (const repoPath of repos) {
13737
- if (!repoPath || !(0, import_node_fs36.existsSync)(repoPath)) continue;
13901
+ if (!repoPath || !(0, import_node_fs37.existsSync)(repoPath)) continue;
13738
13902
  try {
13739
13903
  const wts = await listWorktrees(repoPath);
13740
13904
  for (const wt of wts) {
@@ -13745,7 +13909,7 @@ async function findOrphanWorktrees(repoPaths) {
13745
13909
  seen.add(path);
13746
13910
  let mtimeMs = 0;
13747
13911
  try {
13748
- mtimeMs = (0, import_node_fs36.statSync)(path).mtimeMs;
13912
+ mtimeMs = (0, import_node_fs37.statSync)(path).mtimeMs;
13749
13913
  } catch {
13750
13914
  mtimeMs = 0;
13751
13915
  }
@@ -13755,16 +13919,16 @@ async function findOrphanWorktrees(repoPaths) {
13755
13919
  }
13756
13920
  try {
13757
13921
  const root = worktreesRoot(repoPath);
13758
- if ((0, import_node_fs36.existsSync)(root)) {
13759
- for (const entry of (0, import_node_fs36.readdirSync)(root, { withFileTypes: true })) {
13922
+ if ((0, import_node_fs37.existsSync)(root)) {
13923
+ for (const entry of (0, import_node_fs37.readdirSync)(root, { withFileTypes: true })) {
13760
13924
  if (!entry.isDirectory()) continue;
13761
- const path = (0, import_node_path36.join)(root, entry.name).replace(/\/$/, "");
13925
+ const path = (0, import_node_path37.join)(root, entry.name).replace(/\/$/, "");
13762
13926
  if (known.has(path) || seen.has(path)) continue;
13763
- if (!(0, import_node_fs36.existsSync)((0, import_node_path36.join)(path, ".git"))) continue;
13927
+ if (!(0, import_node_fs37.existsSync)((0, import_node_path37.join)(path, ".git"))) continue;
13764
13928
  seen.add(path);
13765
13929
  let mtimeMs = 0;
13766
13930
  try {
13767
- mtimeMs = (0, import_node_fs36.statSync)(path).mtimeMs;
13931
+ mtimeMs = (0, import_node_fs37.statSync)(path).mtimeMs;
13768
13932
  } catch {
13769
13933
  mtimeMs = Date.now();
13770
13934
  }
@@ -13816,12 +13980,12 @@ function shouldRunWorktreeCleanup(settings = loadAppSettings()) {
13816
13980
  const elapsed = Date.now() - Date.parse(last);
13817
13981
  return elapsed >= intervalHours * 36e5;
13818
13982
  }
13819
- var import_node_fs36, import_node_path36;
13983
+ var import_node_fs37, import_node_path37;
13820
13984
  var init_orphan_cleanup = __esm({
13821
13985
  "src/git/orphan-cleanup.ts"() {
13822
13986
  "use strict";
13823
- import_node_fs36 = require("fs");
13824
- import_node_path36 = require("path");
13987
+ import_node_fs37 = require("fs");
13988
+ import_node_path37 = require("path");
13825
13989
  init_worktree();
13826
13990
  init_thread_store();
13827
13991
  init_paths();
@@ -13924,12 +14088,12 @@ async function cloneRepoIntoSideboard(opts) {
13924
14088
  if (!url) throw new Error("Clone URL is required");
13925
14089
  let name = opts.name?.trim();
13926
14090
  if (!name) {
13927
- const leaf = (0, import_node_path37.basename)(url.replace(/\/$/, "").replace(/\.git$/, ""));
14091
+ const leaf = (0, import_node_path38.basename)(url.replace(/\/$/, "").replace(/\.git$/, ""));
13928
14092
  name = leaf || "repo";
13929
14093
  }
13930
14094
  name = name.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "repo";
13931
- const dest = (0, import_node_path37.join)(sideboardReposDir(), name);
13932
- if ((0, import_node_fs37.existsSync)(dest)) {
14095
+ const dest = (0, import_node_path38.join)(sideboardReposDir(), name);
14096
+ if ((0, import_node_fs38.existsSync)(dest)) {
13933
14097
  const repoPath2 = await resolveRepoRoot(dest);
13934
14098
  const workspace2 = await ensureWorkspace(repoPath2);
13935
14099
  return { repoPath: repoPath2, workspace: workspace2 };
@@ -13944,12 +14108,12 @@ async function cloneRepoIntoSideboard(opts) {
13944
14108
  const workspace = await ensureWorkspace(repoPath);
13945
14109
  return { repoPath, workspace };
13946
14110
  }
13947
- var import_node_fs37, import_node_path37, import_execa6;
14111
+ var import_node_fs38, import_node_path38, import_execa6;
13948
14112
  var init_clone_repo = __esm({
13949
14113
  "src/git/clone-repo.ts"() {
13950
14114
  "use strict";
13951
- import_node_fs37 = require("fs");
13952
- import_node_path37 = require("path");
14115
+ import_node_fs38 = require("fs");
14116
+ import_node_path38 = require("path");
13953
14117
  import_execa6 = require("execa");
13954
14118
  init_paths();
13955
14119
  init_workspaces2();
@@ -13959,11 +14123,11 @@ var init_clone_repo = __esm({
13959
14123
 
13960
14124
  // src/store/desktop-host.ts
13961
14125
  function desktopHostPidPath() {
13962
- return (0, import_node_path38.join)(appDataDir(), "desktop-host.pid");
14126
+ return (0, import_node_path39.join)(appDataDir(), "desktop-host.pid");
13963
14127
  }
13964
14128
  function readDesktopHostPid() {
13965
14129
  try {
13966
- const pid = Number.parseInt((0, import_node_fs38.readFileSync)(desktopHostPidPath(), "utf8").trim(), 10);
14130
+ const pid = Number.parseInt((0, import_node_fs39.readFileSync)(desktopHostPidPath(), "utf8").trim(), 10);
13967
14131
  if (!Number.isFinite(pid) || pid <= 0) return null;
13968
14132
  return pid;
13969
14133
  } catch {
@@ -13989,12 +14153,12 @@ function thisProcessShouldDrainAgentQueues() {
13989
14153
  if (isThisProcessDesktopHost()) return true;
13990
14154
  return !isDesktopHostAlive();
13991
14155
  }
13992
- var import_node_fs38, import_node_path38;
14156
+ var import_node_fs39, import_node_path39;
13993
14157
  var init_desktop_host = __esm({
13994
14158
  "src/store/desktop-host.ts"() {
13995
14159
  "use strict";
13996
- import_node_fs38 = require("fs");
13997
- import_node_path38 = require("path");
14160
+ import_node_fs39 = require("fs");
14161
+ import_node_path39 = require("path");
13998
14162
  init_paths();
13999
14163
  }
14000
14164
  });
@@ -14096,7 +14260,7 @@ function jobAlive(pid) {
14096
14260
  }
14097
14261
  function processGroupAlive(pgid) {
14098
14262
  if (process.platform === "win32") return false;
14099
- if (!Number.isInteger(pgid) || pgid <= 0) return false;
14263
+ if (!Number.isInteger(pgid) || pgid <= 1) return false;
14100
14264
  try {
14101
14265
  process.kill(-pgid, 0);
14102
14266
  return true;
@@ -14109,24 +14273,24 @@ function jobTreeAlive(pid) {
14109
14273
  return jobAlive(pid) || processGroupAlive(pid);
14110
14274
  }
14111
14275
  function readIntFile(file) {
14112
- if (!(0, import_node_fs39.existsSync)(file)) return null;
14113
- const n = Number.parseInt((0, import_node_fs39.readFileSync)(file, "utf8").trim(), 10);
14276
+ if (!(0, import_node_fs40.existsSync)(file)) return null;
14277
+ const n = Number.parseInt((0, import_node_fs40.readFileSync)(file, "utf8").trim(), 10);
14114
14278
  return Number.isInteger(n) ? n : null;
14115
14279
  }
14116
14280
  function jobDir(root, id, legacy = false) {
14117
- return (0, import_node_path39.join)(root, legacy ? LEGACY_DETACHED_JOBS_DIR : DETACHED_JOBS_DIR, id);
14281
+ return (0, import_node_path40.join)(root, legacy ? LEGACY_DETACHED_JOBS_DIR : DETACHED_JOBS_DIR, id);
14118
14282
  }
14119
14283
  function resolveJobDir(root, id) {
14120
14284
  const modern = jobDir(root, id, false);
14121
- if ((0, import_node_fs39.existsSync)(modern)) return modern;
14285
+ if ((0, import_node_fs40.existsSync)(modern)) return modern;
14122
14286
  const legacy = jobDir(root, id, true);
14123
- if ((0, import_node_fs39.existsSync)(legacy)) return legacy;
14287
+ if ((0, import_node_fs40.existsSync)(legacy)) return legacy;
14124
14288
  return modern;
14125
14289
  }
14126
14290
  function listJobIdsIn(root, rel) {
14127
- const dir = (0, import_node_path39.join)(root, rel);
14128
- if (!(0, import_node_fs39.existsSync)(dir)) return [];
14129
- return (0, import_node_fs39.readdirSync)(dir, { withFileTypes: true }).filter((e) => e.isDirectory() && JOB_ID_RE.test(e.name)).map((e) => e.name);
14291
+ const dir = (0, import_node_path40.join)(root, rel);
14292
+ if (!(0, import_node_fs40.existsSync)(dir)) return [];
14293
+ return (0, import_node_fs40.readdirSync)(dir, { withFileTypes: true }).filter((e) => e.isDirectory() && JOB_ID_RE.test(e.name)).map((e) => e.name);
14130
14294
  }
14131
14295
  function listRunningDetachedJobs(worktreePath) {
14132
14296
  const root = worktreePath.trim();
@@ -14138,8 +14302,8 @@ function listRunningDetachedJobs(worktreePath) {
14138
14302
  const running = [];
14139
14303
  for (const id of ids) {
14140
14304
  const dir = resolveJobDir(root, id);
14141
- const pid = readIntFile((0, import_node_path39.join)(dir, "pid"));
14142
- if (pid != null && jobAlive(pid)) running.push(id);
14305
+ const pid = readIntFile((0, import_node_path40.join)(dir, "pid"));
14306
+ if (jobTreeAlive(pid)) running.push(id);
14143
14307
  }
14144
14308
  return running.sort();
14145
14309
  }
@@ -14191,13 +14355,13 @@ function planJobContinue(opts) {
14191
14355
  return { action: "none" };
14192
14356
  }
14193
14357
  function tailProgress(logFile, maxLines = 12) {
14194
- if (!(0, import_node_fs39.existsSync)(logFile)) return "(no log yet)";
14195
- const lines = (0, import_node_fs39.readFileSync)(logFile, "utf8").split("\n");
14358
+ if (!(0, import_node_fs40.existsSync)(logFile)) return "(no log yet)";
14359
+ const lines = (0, import_node_fs40.readFileSync)(logFile, "utf8").split("\n");
14196
14360
  return lines.slice(-maxLines).join("\n");
14197
14361
  }
14198
14362
  function readLogLines(file) {
14199
- if (!(0, import_node_fs39.existsSync)(file)) return [];
14200
- const lines = (0, import_node_fs39.readFileSync)(file, "utf8").split("\n");
14363
+ if (!(0, import_node_fs40.existsSync)(file)) return [];
14364
+ const lines = (0, import_node_fs40.readFileSync)(file, "utf8").split("\n");
14201
14365
  if (lines.length && lines[lines.length - 1] === "") lines.pop();
14202
14366
  return lines;
14203
14367
  }
@@ -14208,15 +14372,15 @@ function takeDelta(logFile, cursorFile) {
14208
14372
  return { delta: lines.slice(start).join("\n"), nextCursor: lines.length };
14209
14373
  }
14210
14374
  function snapshotJob(dir) {
14211
- const pid = readIntFile((0, import_node_path39.join)(dir, "pid"));
14375
+ const pid = readIntFile((0, import_node_path40.join)(dir, "pid"));
14212
14376
  const running = jobTreeAlive(pid);
14213
14377
  return {
14214
14378
  pid,
14215
14379
  running,
14216
- exitCode: readIntFile((0, import_node_path39.join)(dir, "exit")),
14217
- log: (0, import_node_path39.join)(dir, "log"),
14218
- cursor: (0, import_node_path39.join)(dir, "present.cursor"),
14219
- progress: tailProgress((0, import_node_path39.join)(dir, "log"))
14380
+ exitCode: readIntFile((0, import_node_path40.join)(dir, "exit")),
14381
+ log: (0, import_node_path40.join)(dir, "log"),
14382
+ cursor: (0, import_node_path40.join)(dir, "present.cursor"),
14383
+ progress: tailProgress((0, import_node_path40.join)(dir, "log"))
14220
14384
  };
14221
14385
  }
14222
14386
  function toResult(id, snap, extra) {
@@ -14225,8 +14389,8 @@ function toResult(id, snap, extra) {
14225
14389
  const stillRunning = snap.running && !ok;
14226
14390
  const { delta, nextCursor } = takeDelta(snap.log, snap.cursor);
14227
14391
  try {
14228
- (0, import_node_fs39.mkdirSync)((0, import_node_path39.dirname)(snap.cursor), { recursive: true });
14229
- (0, import_node_fs39.writeFileSync)(snap.cursor, `${nextCursor}
14392
+ (0, import_node_fs40.mkdirSync)((0, import_node_path40.dirname)(snap.cursor), { recursive: true });
14393
+ (0, import_node_fs40.writeFileSync)(snap.cursor, `${nextCursor}
14230
14394
  `);
14231
14395
  } catch {
14232
14396
  }
@@ -14253,7 +14417,7 @@ async function waitForDetachedJob(cwd, id, opts) {
14253
14417
  const dir = resolveJobDir(root, jobId);
14254
14418
  const timeoutMs = mcpWaitForJobTimeoutMs(opts?.timeoutMs);
14255
14419
  const sleep = opts?.sleep ?? sleepMs;
14256
- if (!(0, import_node_fs39.existsSync)(dir)) {
14420
+ if (!(0, import_node_fs40.existsSync)(dir)) {
14257
14421
  return {
14258
14422
  stillRunning: false,
14259
14423
  ok: false,
@@ -14299,10 +14463,10 @@ function killProcessTree(pid, signal) {
14299
14463
  }
14300
14464
  function appendJobLog(logFile, line) {
14301
14465
  try {
14302
- (0, import_node_fs39.mkdirSync)((0, import_node_path39.dirname)(logFile), { recursive: true });
14466
+ (0, import_node_fs40.mkdirSync)((0, import_node_path40.dirname)(logFile), { recursive: true });
14303
14467
  const body = line.endsWith("\n") ? line : `${line}
14304
14468
  `;
14305
- (0, import_node_fs39.appendFileSync)(logFile, body);
14469
+ (0, import_node_fs40.appendFileSync)(logFile, body);
14306
14470
  } catch {
14307
14471
  }
14308
14472
  }
@@ -14312,7 +14476,7 @@ async function stopDetachedJob(cwd, id, opts) {
14312
14476
  const dir = resolveJobDir(root, jobId);
14313
14477
  const sleep = opts?.sleep ?? sleepMs;
14314
14478
  const why = opts?.reason?.trim() ?? "";
14315
- if (!(0, import_node_fs39.existsSync)(dir)) {
14479
+ if (!(0, import_node_fs40.existsSync)(dir)) {
14316
14480
  return {
14317
14481
  stillRunning: false,
14318
14482
  ok: false,
@@ -14348,10 +14512,10 @@ async function stopDetachedJob(cwd, id, opts) {
14348
14512
  killProcessTree(targetPid, "SIGKILL");
14349
14513
  await sleep(100);
14350
14514
  }
14351
- const exitFile = (0, import_node_path39.join)(dir, "exit");
14352
- if (!(0, import_node_fs39.existsSync)(exitFile)) {
14515
+ const exitFile = (0, import_node_path40.join)(dir, "exit");
14516
+ if (!(0, import_node_fs40.existsSync)(exitFile)) {
14353
14517
  try {
14354
- (0, import_node_fs39.writeFileSync)(exitFile, "1\n");
14518
+ (0, import_node_fs40.writeFileSync)(exitFile, "1\n");
14355
14519
  } catch {
14356
14520
  }
14357
14521
  }
@@ -14371,12 +14535,12 @@ async function stopDetachedJob(cwd, id, opts) {
14371
14535
  hint: stopped ? MCP_STOP_JOB_HINT : MCP_WAIT_JOB_STILL_RUNNING_HINT
14372
14536
  };
14373
14537
  }
14374
- var import_node_fs39, import_node_path39, MAX_JOB_CONTINUES, MCP_WAIT_JOB_STILL_RUNNING_HINT, MCP_STOP_JOB_HINT, JOB_ID_RE;
14538
+ var import_node_fs40, import_node_path40, MAX_JOB_CONTINUES, MCP_WAIT_JOB_STILL_RUNNING_HINT, MCP_STOP_JOB_HINT, JOB_ID_RE;
14375
14539
  var init_wait_for_job = __esm({
14376
14540
  "src/mcp/wait-for-job.ts"() {
14377
14541
  "use strict";
14378
- import_node_fs39 = require("fs");
14379
- import_node_path39 = require("path");
14542
+ import_node_fs40 = require("fs");
14543
+ import_node_path40 = require("path");
14380
14544
  init_workspace_scratch();
14381
14545
  init_wait_for_turn();
14382
14546
  MAX_JOB_CONTINUES = 8;
@@ -15471,7 +15635,7 @@ function reuseLiveThread(input, repoPath, match) {
15471
15635
  }
15472
15636
  async function createThread(input, _onSetupLine) {
15473
15637
  const repoPath = await resolveRepoRoot(input.repoPath);
15474
- if (!(0, import_node_fs40.existsSync)(repoPath)) {
15638
+ if (!(0, import_node_fs41.existsSync)(repoPath)) {
15475
15639
  throw new Error(`Repo not found: ${repoPath}`);
15476
15640
  }
15477
15641
  const reused = reuseLiveThread(input, repoPath, {
@@ -15643,11 +15807,11 @@ async function createThread(input, _onSetupLine) {
15643
15807
  await ensureWorkspace(repoPath);
15644
15808
  return readThread(thread.id) ?? thread;
15645
15809
  }
15646
- var import_node_fs40;
15810
+ var import_node_fs41;
15647
15811
  var init_create = __esm({
15648
15812
  "src/threads/create.ts"() {
15649
15813
  "use strict";
15650
- import_node_fs40 = require("fs");
15814
+ import_node_fs41 = require("fs");
15651
15815
  init_detect();
15652
15816
  init_worktree();
15653
15817
  init_home_board();
@@ -15767,20 +15931,20 @@ function writeTurnLive(threadId, progress) {
15767
15931
  const path = threadLivePath(threadId);
15768
15932
  const tmp = `${path}.${process.pid}.tmp`;
15769
15933
  try {
15770
- (0, import_node_fs41.writeFileSync)(tmp, JSON.stringify(progress), "utf8");
15771
- (0, import_node_fs41.renameSync)(tmp, path);
15934
+ (0, import_node_fs42.writeFileSync)(tmp, JSON.stringify(progress), "utf8");
15935
+ (0, import_node_fs42.renameSync)(tmp, path);
15772
15936
  } catch {
15773
15937
  try {
15774
- (0, import_node_fs41.unlinkSync)(tmp);
15938
+ (0, import_node_fs42.unlinkSync)(tmp);
15775
15939
  } catch {
15776
15940
  }
15777
15941
  }
15778
15942
  }
15779
15943
  function readTurnLive(threadId) {
15780
15944
  const path = threadLivePath(threadId);
15781
- if (!(0, import_node_fs41.existsSync)(path)) return null;
15945
+ if (!(0, import_node_fs42.existsSync)(path)) return null;
15782
15946
  try {
15783
- const raw = JSON.parse((0, import_node_fs41.readFileSync)(path, "utf8"));
15947
+ const raw = JSON.parse((0, import_node_fs42.readFileSync)(path, "utf8"));
15784
15948
  if (!raw || typeof raw.summary !== "string") return null;
15785
15949
  return raw;
15786
15950
  } catch {
@@ -15792,17 +15956,17 @@ function clearTurnLive(threadId) {
15792
15956
  if (buf?.timer) clearTimeout(buf.timer);
15793
15957
  buffers.delete(threadId);
15794
15958
  const path = threadLivePath(threadId);
15795
- if (!(0, import_node_fs41.existsSync)(path)) return;
15959
+ if (!(0, import_node_fs42.existsSync)(path)) return;
15796
15960
  try {
15797
- (0, import_node_fs41.unlinkSync)(path);
15961
+ (0, import_node_fs42.unlinkSync)(path);
15798
15962
  } catch {
15799
15963
  }
15800
15964
  }
15801
- var import_node_fs41, buffers, FLUSH_MS, MAX_PARTS;
15965
+ var import_node_fs42, buffers, FLUSH_MS, MAX_PARTS;
15802
15966
  var init_turn_live = __esm({
15803
15967
  "src/store/turn-live.ts"() {
15804
15968
  "use strict";
15805
- import_node_fs41 = require("fs");
15969
+ import_node_fs42 = require("fs");
15806
15970
  init_message_parts();
15807
15971
  init_paths();
15808
15972
  buffers = /* @__PURE__ */ new Map();
@@ -16019,7 +16183,7 @@ var init_quota_failover = __esm({
16019
16183
  // src/threads/adopt.ts
16020
16184
  function thisModuleFile() {
16021
16185
  const cjsFile = typeof __filename !== "undefined" ? __filename : "";
16022
- return cjsFile || process.argv[1] || (0, import_node_path40.join)(process.cwd(), "package.json");
16186
+ return cjsFile || process.argv[1] || (0, import_node_path41.join)(process.cwd(), "package.json");
16023
16187
  }
16024
16188
  function openReadonlySqlite(file) {
16025
16189
  const req = (0, import_node_module4.createRequire)(thisModuleFile());
@@ -16037,21 +16201,21 @@ function mapAgentType(raw) {
16037
16201
  return null;
16038
16202
  }
16039
16203
  function resolveConductorCursorAgentId(workspacePath) {
16040
- if (!workspacePath || !(0, import_node_fs42.existsSync)(CURSOR_SDK_STORE)) return null;
16204
+ if (!workspacePath || !(0, import_node_fs43.existsSync)(CURSOR_SDK_STORE)) return null;
16041
16205
  const normalized = workspacePath.replace(/\/$/, "");
16042
16206
  let best = null;
16043
16207
  let hashes;
16044
16208
  try {
16045
- hashes = (0, import_node_fs42.readdirSync)(CURSOR_SDK_STORE);
16209
+ hashes = (0, import_node_fs43.readdirSync)(CURSOR_SDK_STORE);
16046
16210
  } catch {
16047
16211
  return null;
16048
16212
  }
16049
16213
  for (const hash of hashes) {
16050
- const agentsFile = (0, import_node_path40.join)(CURSOR_SDK_STORE, hash, "agents.ndjson");
16051
- if (!(0, import_node_fs42.existsSync)(agentsFile)) continue;
16214
+ const agentsFile = (0, import_node_path41.join)(CURSOR_SDK_STORE, hash, "agents.ndjson");
16215
+ if (!(0, import_node_fs43.existsSync)(agentsFile)) continue;
16052
16216
  let text7;
16053
16217
  try {
16054
- text7 = (0, import_node_fs42.readFileSync)(agentsFile, "utf8");
16218
+ text7 = (0, import_node_fs43.readFileSync)(agentsFile, "utf8");
16055
16219
  } catch {
16056
16220
  continue;
16057
16221
  }
@@ -16075,7 +16239,7 @@ function resolveConductorCursorAgentId(workspacePath) {
16075
16239
  return best?.agentId ?? null;
16076
16240
  }
16077
16241
  async function adoptThread(input) {
16078
- if (!(0, import_node_fs42.existsSync)(input.worktreePath)) {
16242
+ if (!(0, import_node_fs43.existsSync)(input.worktreePath)) {
16079
16243
  throw new Error(`Worktree not found: ${input.worktreePath}`);
16080
16244
  }
16081
16245
  const repoPath = await resolveRepoRoot(input.worktreePath);
@@ -16101,18 +16265,18 @@ async function adoptThread(input) {
16101
16265
  return thread;
16102
16266
  }
16103
16267
  function listConductorWorkspaces() {
16104
- if (!(0, import_node_fs42.existsSync)(CONDUCTOR_DB)) {
16268
+ if (!(0, import_node_fs43.existsSync)(CONDUCTOR_DB)) {
16105
16269
  throw new Error(`Conductor DB not found at ${CONDUCTOR_DB}`);
16106
16270
  }
16107
- const tmp = (0, import_node_fs42.mkdtempSync)((0, import_node_path40.join)((0, import_node_os13.tmpdir)(), "sideboard-conductor-"));
16108
- const snapshot = (0, import_node_path40.join)(tmp, "conductor.db");
16271
+ const tmp = (0, import_node_fs43.mkdtempSync)((0, import_node_path41.join)((0, import_node_os13.tmpdir)(), "sideboard-conductor-"));
16272
+ const snapshot = (0, import_node_path41.join)(tmp, "conductor.db");
16109
16273
  try {
16110
- (0, import_node_fs42.copyFileSync)(CONDUCTOR_DB, snapshot);
16274
+ (0, import_node_fs43.copyFileSync)(CONDUCTOR_DB, snapshot);
16111
16275
  for (const suffix of ["-wal", "-shm"]) {
16112
16276
  const src = `${CONDUCTOR_DB}${suffix}`;
16113
- if ((0, import_node_fs42.existsSync)(src)) {
16277
+ if ((0, import_node_fs43.existsSync)(src)) {
16114
16278
  try {
16115
- (0, import_node_fs42.copyFileSync)(src, `${snapshot}${suffix}`);
16279
+ (0, import_node_fs43.copyFileSync)(src, `${snapshot}${suffix}`);
16116
16280
  } catch {
16117
16281
  }
16118
16282
  }
@@ -16188,22 +16352,22 @@ function listConductorWorkspaces() {
16188
16352
  db.close();
16189
16353
  }
16190
16354
  } finally {
16191
- (0, import_node_fs42.rmSync)(tmp, { recursive: true, force: true });
16355
+ (0, import_node_fs43.rmSync)(tmp, { recursive: true, force: true });
16192
16356
  }
16193
16357
  }
16194
16358
  function importConductorWorkspace(workspaceId) {
16195
- if (!(0, import_node_fs42.existsSync)(CONDUCTOR_DB)) {
16359
+ if (!(0, import_node_fs43.existsSync)(CONDUCTOR_DB)) {
16196
16360
  throw new Error(`Conductor DB not found at ${CONDUCTOR_DB}`);
16197
16361
  }
16198
- const tmp = (0, import_node_fs42.mkdtempSync)((0, import_node_path40.join)((0, import_node_os13.tmpdir)(), "sideboard-conductor-"));
16199
- const snapshot = (0, import_node_path40.join)(tmp, "conductor.db");
16362
+ const tmp = (0, import_node_fs43.mkdtempSync)((0, import_node_path41.join)((0, import_node_os13.tmpdir)(), "sideboard-conductor-"));
16363
+ const snapshot = (0, import_node_path41.join)(tmp, "conductor.db");
16200
16364
  try {
16201
- (0, import_node_fs42.copyFileSync)(CONDUCTOR_DB, snapshot);
16365
+ (0, import_node_fs43.copyFileSync)(CONDUCTOR_DB, snapshot);
16202
16366
  for (const suffix of ["-wal", "-shm"]) {
16203
16367
  const src = `${CONDUCTOR_DB}${suffix}`;
16204
- if ((0, import_node_fs42.existsSync)(src)) {
16368
+ if ((0, import_node_fs43.existsSync)(src)) {
16205
16369
  try {
16206
- (0, import_node_fs42.copyFileSync)(src, `${snapshot}${suffix}`);
16370
+ (0, import_node_fs43.copyFileSync)(src, `${snapshot}${suffix}`);
16207
16371
  } catch {
16208
16372
  }
16209
16373
  }
@@ -16221,7 +16385,7 @@ function importConductorWorkspace(workspaceId) {
16221
16385
  ).get(workspaceId);
16222
16386
  if (!row) throw new Error(`Conductor workspace not found: ${workspaceId}`);
16223
16387
  const worktreePath = String(row.workspacePath);
16224
- if (!(0, import_node_fs42.existsSync)(worktreePath)) {
16388
+ if (!(0, import_node_fs43.existsSync)(worktreePath)) {
16225
16389
  throw new Error(`Conductor worktree missing on disk: ${worktreePath}`);
16226
16390
  }
16227
16391
  let sessionId = null;
@@ -16261,7 +16425,7 @@ function importConductorWorkspace(workspaceId) {
16261
16425
  }
16262
16426
  let repoPath = worktreePath;
16263
16427
  try {
16264
- repoPath = (0, import_node_child_process3.execFileSync)("git", ["rev-parse", "--show-toplevel"], {
16428
+ repoPath = (0, import_node_child_process4.execFileSync)("git", ["rev-parse", "--show-toplevel"], {
16265
16429
  cwd: worktreePath,
16266
16430
  encoding: "utf8"
16267
16431
  }).trim();
@@ -16284,31 +16448,31 @@ function importConductorWorkspace(workspaceId) {
16284
16448
  db.close();
16285
16449
  }
16286
16450
  } finally {
16287
- (0, import_node_fs42.rmSync)(tmp, { recursive: true, force: true });
16451
+ (0, import_node_fs43.rmSync)(tmp, { recursive: true, force: true });
16288
16452
  }
16289
16453
  }
16290
16454
  async function importConductorWorkspaceAsync(workspaceId) {
16291
16455
  return importConductorWorkspace(workspaceId);
16292
16456
  }
16293
- var import_node_child_process3, import_node_fs42, import_node_os13, import_node_path40, import_node_module4, CONDUCTOR_APP_SUPPORT, CONDUCTOR_DB, CURSOR_SDK_STORE;
16457
+ var import_node_child_process4, import_node_fs43, import_node_os13, import_node_path41, import_node_module4, CONDUCTOR_APP_SUPPORT, CONDUCTOR_DB, CURSOR_SDK_STORE;
16294
16458
  var init_adopt = __esm({
16295
16459
  "src/threads/adopt.ts"() {
16296
16460
  "use strict";
16297
- import_node_child_process3 = require("child_process");
16298
- import_node_fs42 = require("fs");
16461
+ import_node_child_process4 = require("child_process");
16462
+ import_node_fs43 = require("fs");
16299
16463
  import_node_os13 = require("os");
16300
- import_node_path40 = require("path");
16464
+ import_node_path41 = require("path");
16301
16465
  import_node_module4 = require("module");
16302
16466
  init_worktree();
16303
16467
  init_thread_store();
16304
- CONDUCTOR_APP_SUPPORT = (0, import_node_path40.join)(
16468
+ CONDUCTOR_APP_SUPPORT = (0, import_node_path41.join)(
16305
16469
  process.env.HOME ?? "",
16306
16470
  "Library",
16307
16471
  "Application Support",
16308
16472
  "com.conductor.app"
16309
16473
  );
16310
- CONDUCTOR_DB = (0, import_node_path40.join)(CONDUCTOR_APP_SUPPORT, "conductor.db");
16311
- CURSOR_SDK_STORE = (0, import_node_path40.join)(CONDUCTOR_APP_SUPPORT, "cursor-sdk-store");
16474
+ CONDUCTOR_DB = (0, import_node_path41.join)(CONDUCTOR_APP_SUPPORT, "conductor.db");
16475
+ CURSOR_SDK_STORE = (0, import_node_path41.join)(CONDUCTOR_APP_SUPPORT, "cursor-sdk-store");
16312
16476
  }
16313
16477
  });
16314
16478
 
@@ -16375,7 +16539,7 @@ async function openStackLayer(input, _onSetupLine) {
16375
16539
  let createdWorktree = false;
16376
16540
  const trees = await listWorktrees(repoPath);
16377
16541
  const checkedOut = trees.find((w) => w.branch === branchName);
16378
- if (checkedOut?.path && (0, import_node_fs43.existsSync)(checkedOut.path)) {
16542
+ if (checkedOut?.path && (0, import_node_fs44.existsSync)(checkedOut.path)) {
16379
16543
  if (input.reuseExistingWorktree !== false) {
16380
16544
  worktreePath = checkedOut.path;
16381
16545
  } else {
@@ -16517,7 +16681,7 @@ async function initStackFromThread(input, onSetupLine) {
16517
16681
  async function createPrStack(input, onSetupLine) {
16518
16682
  await requireAgent(input.agent);
16519
16683
  const repoPath = await resolveRepoRoot(input.repoPath);
16520
- if (!(0, import_node_fs43.existsSync)(repoPath)) throw new Error(`Repo not found: ${repoPath}`);
16684
+ if (!(0, import_node_fs44.existsSync)(repoPath)) throw new Error(`Repo not found: ${repoPath}`);
16521
16685
  if (!input.branches.length) throw new Error("At least one branch name required");
16522
16686
  const status = await detectGhStack(repoPath);
16523
16687
  if (!status.available) throw new Error(status.reason);
@@ -16584,7 +16748,7 @@ async function createPrStack(input, onSetupLine) {
16584
16748
  }
16585
16749
  }
16586
16750
  const claimed = new Set(threads.map((t) => t.worktreePath));
16587
- if (!claimed.has(bootstrap.worktreePath) && (0, import_node_fs43.existsSync)(bootstrap.worktreePath)) {
16751
+ if (!claimed.has(bootstrap.worktreePath) && (0, import_node_fs44.existsSync)(bootstrap.worktreePath)) {
16588
16752
  try {
16589
16753
  await removeWorktree(repoPath, bootstrap.worktreePath, {
16590
16754
  deleteBranch: bootstrap.branchName
@@ -16594,11 +16758,11 @@ async function createPrStack(input, onSetupLine) {
16594
16758
  }
16595
16759
  return { stack, threads, createdThreadIds };
16596
16760
  }
16597
- var import_node_fs43;
16761
+ var import_node_fs44;
16598
16762
  var init_stack_layers = __esm({
16599
16763
  "src/threads/stack-layers.ts"() {
16600
16764
  "use strict";
16601
- import_node_fs43 = require("fs");
16765
+ import_node_fs44 = require("fs");
16602
16766
  init_detect();
16603
16767
  init_run();
16604
16768
  init_stack();
@@ -16611,7 +16775,7 @@ var init_stack_layers = __esm({
16611
16775
 
16612
16776
  // src/diff/diff.ts
16613
16777
  async function inspectGitWorktree(worktreePath) {
16614
- if (!worktreePath || !(0, import_node_fs44.existsSync)(worktreePath)) return "missing_worktree";
16778
+ if (!worktreePath || !(0, import_node_fs45.existsSync)(worktreePath)) return "missing_worktree";
16615
16779
  const check = await git(["rev-parse", "--is-inside-work-tree"], worktreePath, {
16616
16780
  reject: false
16617
16781
  });
@@ -16619,7 +16783,7 @@ async function inspectGitWorktree(worktreePath) {
16619
16783
  return "ok";
16620
16784
  }
16621
16785
  async function initializeGitRepository(worktreePath) {
16622
- if (!worktreePath || !(0, import_node_fs44.existsSync)(worktreePath)) {
16786
+ if (!worktreePath || !(0, import_node_fs45.existsSync)(worktreePath)) {
16623
16787
  throw new Error("Worktree not found");
16624
16788
  }
16625
16789
  const status = await inspectGitWorktree(worktreePath);
@@ -16753,11 +16917,11 @@ new file mode 100644
16753
16917
  };
16754
16918
  }
16755
16919
  async function untrackedPatch(worktreePath, path, maxHunk) {
16756
- const abs = (0, import_node_path41.join)(worktreePath, path);
16920
+ const abs = (0, import_node_path42.join)(worktreePath, path);
16757
16921
  try {
16758
- const st = (0, import_node_fs44.statSync)(abs);
16922
+ const st = (0, import_node_fs45.statSync)(abs);
16759
16923
  if (st.isFile() && st.size > maxHunk) {
16760
- const buf = (0, import_node_fs44.readFileSync)(abs).subarray(0, maxHunk);
16924
+ const buf = (0, import_node_fs45.readFileSync)(abs).subarray(0, maxHunk);
16761
16925
  return syntheticAddPatch(path, buf.toString("utf8"), maxHunk);
16762
16926
  }
16763
16927
  } catch {
@@ -17246,8 +17410,8 @@ function isImageRelativePath(relativePath) {
17246
17410
  function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
17247
17411
  assertSafeRelativePath(relativePath);
17248
17412
  const maxBytes = opts?.maxBytes ?? DEFAULT_UPLOAD_MAX_BYTES;
17249
- const abs = (0, import_node_path41.join)(worktreePath, relativePath);
17250
- const st = (0, import_node_fs44.statSync)(abs);
17413
+ const abs = (0, import_node_path42.join)(worktreePath, relativePath);
17414
+ const st = (0, import_node_fs45.statSync)(abs);
17251
17415
  if (!st.isFile()) {
17252
17416
  throw new Error(`Not a file: ${relativePath}`);
17253
17417
  }
@@ -17256,7 +17420,7 @@ function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
17256
17420
  `File too large to upload (${st.size} bytes; max ${maxBytes})`
17257
17421
  );
17258
17422
  }
17259
- const buf = (0, import_node_fs44.readFileSync)(abs);
17423
+ const buf = (0, import_node_fs45.readFileSync)(abs);
17260
17424
  return {
17261
17425
  path: relativePath,
17262
17426
  contentBase64: buf.toString("base64"),
@@ -17266,12 +17430,12 @@ function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
17266
17430
  function readWorktreeFile(worktreePath, relativePath, opts) {
17267
17431
  assertSafeRelativePath(relativePath);
17268
17432
  const maxBytes = opts?.maxBytes ?? 2e5;
17269
- const abs = (0, import_node_path41.join)(worktreePath, relativePath);
17270
- const st = (0, import_node_fs44.statSync)(abs);
17433
+ const abs = (0, import_node_path42.join)(worktreePath, relativePath);
17434
+ const st = (0, import_node_fs45.statSync)(abs);
17271
17435
  if (!st.isFile()) {
17272
17436
  throw new Error(`Not a file: ${relativePath}`);
17273
17437
  }
17274
- const buf = (0, import_node_fs44.readFileSync)(abs);
17438
+ const buf = (0, import_node_fs45.readFileSync)(abs);
17275
17439
  if (isImageRelativePath(relativePath)) {
17276
17440
  const maxImageBytes = Math.max(maxBytes, 15e6);
17277
17441
  const truncated2 = buf.length > maxImageBytes;
@@ -17314,9 +17478,9 @@ function assertSafeRelativePath(relativePath) {
17314
17478
  }
17315
17479
  function writeWorktreeFile(worktreePath, relativePath, content) {
17316
17480
  assertSafeRelativePath(relativePath);
17317
- const abs = (0, import_node_path41.join)(worktreePath, relativePath);
17318
- (0, import_node_fs44.mkdirSync)((0, import_node_path41.dirname)(abs), { recursive: true });
17319
- (0, import_node_fs44.writeFileSync)(abs, content, "utf8");
17481
+ const abs = (0, import_node_path42.join)(worktreePath, relativePath);
17482
+ (0, import_node_fs45.mkdirSync)((0, import_node_path42.dirname)(abs), { recursive: true });
17483
+ (0, import_node_fs45.writeFileSync)(abs, content, "utf8");
17320
17484
  return { path: relativePath };
17321
17485
  }
17322
17486
  async function getDiffSummary(worktreePath, repoPath, opts) {
@@ -17333,12 +17497,12 @@ async function getDiffSummary(worktreePath, repoPath, opts) {
17333
17497
  truncated: full.files.length > maxFiles
17334
17498
  };
17335
17499
  }
17336
- var import_node_fs44, import_node_path41, mergeBaseCache, MERGE_BASE_TTL_MS, SHA_RE, IMAGE_EXTENSIONS2, DEFAULT_UPLOAD_MAX_BYTES;
17500
+ var import_node_fs45, import_node_path42, mergeBaseCache, MERGE_BASE_TTL_MS, SHA_RE, IMAGE_EXTENSIONS2, DEFAULT_UPLOAD_MAX_BYTES;
17337
17501
  var init_diff = __esm({
17338
17502
  "src/diff/diff.ts"() {
17339
17503
  "use strict";
17340
- import_node_fs44 = require("fs");
17341
- import_node_path41 = require("path");
17504
+ import_node_fs45 = require("fs");
17505
+ import_node_path42 = require("path");
17342
17506
  init_run();
17343
17507
  init_worktree();
17344
17508
  mergeBaseCache = /* @__PURE__ */ new Map();
@@ -17614,7 +17778,7 @@ function parseFrontmatter(content) {
17614
17778
  }
17615
17779
  function readSkill(skillMd, source) {
17616
17780
  try {
17617
- const content = (0, import_node_fs45.readFileSync)(skillMd, "utf8");
17781
+ const content = (0, import_node_fs46.readFileSync)(skillMd, "utf8");
17618
17782
  const { name: fmName, description } = parseFrontmatter(content);
17619
17783
  const dirName = skillMd.split("/").slice(-2, -1)[0] || "skill";
17620
17784
  const name = fmName || dirName;
@@ -17633,19 +17797,19 @@ function readSkill(skillMd, source) {
17633
17797
  }
17634
17798
  }
17635
17799
  function scanSkillsDir(dir, source, out) {
17636
- if (!(0, import_node_fs45.existsSync)(dir)) return;
17800
+ if (!(0, import_node_fs46.existsSync)(dir)) return;
17637
17801
  let entries;
17638
17802
  try {
17639
- entries = (0, import_node_fs45.readdirSync)(dir);
17803
+ entries = (0, import_node_fs46.readdirSync)(dir);
17640
17804
  } catch {
17641
17805
  return;
17642
17806
  }
17643
17807
  for (const entry of entries) {
17644
17808
  if (entry.startsWith(".")) continue;
17645
- const skillMd = (0, import_node_path42.join)(dir, entry, "SKILL.md");
17646
- if (!(0, import_node_fs45.existsSync)(skillMd)) continue;
17809
+ const skillMd = (0, import_node_path43.join)(dir, entry, "SKILL.md");
17810
+ if (!(0, import_node_fs46.existsSync)(skillMd)) continue;
17647
17811
  try {
17648
- if (!(0, import_node_fs45.statSync)(skillMd).isFile()) continue;
17812
+ if (!(0, import_node_fs46.statSync)(skillMd).isFile()) continue;
17649
17813
  } catch {
17650
17814
  continue;
17651
17815
  }
@@ -17654,24 +17818,24 @@ function scanSkillsDir(dir, source, out) {
17654
17818
  }
17655
17819
  }
17656
17820
  function scanClaudePluginSkills(pluginsRoot, out) {
17657
- if (!(0, import_node_fs45.existsSync)(pluginsRoot)) return;
17821
+ if (!(0, import_node_fs46.existsSync)(pluginsRoot)) return;
17658
17822
  const walk = (dir, depth, lookingForSkillsDir) => {
17659
17823
  if (depth > 7) return;
17660
17824
  let entries;
17661
17825
  try {
17662
- entries = (0, import_node_fs45.readdirSync)(dir);
17826
+ entries = (0, import_node_fs46.readdirSync)(dir);
17663
17827
  } catch {
17664
17828
  return;
17665
17829
  }
17666
17830
  if (lookingForSkillsDir && entries.includes("SKILL.md")) {
17667
- const skill = readSkill((0, import_node_path42.join)(dir, "SKILL.md"), "cli");
17831
+ const skill = readSkill((0, import_node_path43.join)(dir, "SKILL.md"), "cli");
17668
17832
  if (skill) out.push(skill);
17669
17833
  }
17670
17834
  for (const entry of entries) {
17671
17835
  if (entry === "node_modules" || entry === ".git") continue;
17672
- const full = (0, import_node_path42.join)(dir, entry);
17836
+ const full = (0, import_node_path43.join)(dir, entry);
17673
17837
  try {
17674
- if (!(0, import_node_fs45.statSync)(full).isDirectory()) continue;
17838
+ if (!(0, import_node_fs46.statSync)(full).isDirectory()) continue;
17675
17839
  } catch {
17676
17840
  continue;
17677
17841
  }
@@ -17689,17 +17853,17 @@ function discoverSkills(worktreePath) {
17689
17853
  const home = (0, import_node_os14.homedir)();
17690
17854
  const collected = [];
17691
17855
  for (const rel of [".claude/skills", ".cursor/skills", ".sideboard/skills", ".brightsy/skills", "skills"]) {
17692
- scanSkillsDir((0, import_node_path42.join)(worktreePath, rel), "workspace", collected);
17856
+ scanSkillsDir((0, import_node_path43.join)(worktreePath, rel), "workspace", collected);
17693
17857
  }
17694
17858
  for (const abs of [
17695
- (0, import_node_path42.join)(home, ".claude/skills"),
17696
- (0, import_node_path42.join)(home, ".cursor/skills"),
17697
- (0, import_node_path42.join)(home, ".sideboard/skills"),
17698
- (0, import_node_path42.join)(home, ".brightsy/skills")
17859
+ (0, import_node_path43.join)(home, ".claude/skills"),
17860
+ (0, import_node_path43.join)(home, ".cursor/skills"),
17861
+ (0, import_node_path43.join)(home, ".sideboard/skills"),
17862
+ (0, import_node_path43.join)(home, ".brightsy/skills")
17699
17863
  ]) {
17700
17864
  scanSkillsDir(abs, "user", collected);
17701
17865
  }
17702
- scanClaudePluginSkills((0, import_node_path42.join)(home, ".claude/plugins"), collected);
17866
+ scanClaudePluginSkills((0, import_node_path43.join)(home, ".claude/plugins"), collected);
17703
17867
  collected.push(...bundledSkills());
17704
17868
  const rank = {
17705
17869
  workspace: 0,
@@ -17725,7 +17889,7 @@ function readSkillBody(skillPath, maxChars = 12e3) {
17725
17889
  \u2026(truncated)` : body;
17726
17890
  }
17727
17891
  }
17728
- const raw = (0, import_node_fs45.readFileSync)(skillPath, "utf8");
17892
+ const raw = (0, import_node_fs46.readFileSync)(skillPath, "utf8");
17729
17893
  if (raw.startsWith("---")) {
17730
17894
  const end = raw.indexOf("\n---", 3);
17731
17895
  if (end >= 0) {
@@ -17739,13 +17903,13 @@ function readSkillBody(skillPath, maxChars = 12e3) {
17739
17903
 
17740
17904
  \u2026(truncated)` : raw;
17741
17905
  }
17742
- var import_node_fs45, import_node_os14, import_node_path42, BUNDLED_SKILL_PREFIX;
17906
+ var import_node_fs46, import_node_os14, import_node_path43, BUNDLED_SKILL_PREFIX;
17743
17907
  var init_discover = __esm({
17744
17908
  "src/skills/discover.ts"() {
17745
17909
  "use strict";
17746
- import_node_fs45 = require("fs");
17910
+ import_node_fs46 = require("fs");
17747
17911
  import_node_os14 = require("os");
17748
- import_node_path42 = require("path");
17912
+ import_node_path43 = require("path");
17749
17913
  init_long_running();
17750
17914
  BUNDLED_SKILL_PREFIX = "bundled:";
17751
17915
  }
@@ -17839,8 +18003,8 @@ var init_expand = __esm({
17839
18003
  // src/skills/detached-job-path.ts
17840
18004
  function detachedJobScriptIn(dir) {
17841
18005
  for (const name of DETACHED_JOB_FILENAMES) {
17842
- const script = (0, import_node_path43.join)(dir, "scripts", name);
17843
- if ((0, import_node_fs46.existsSync)(script)) return script;
18006
+ const script = (0, import_node_path44.join)(dir, "scripts", name);
18007
+ if ((0, import_node_fs47.existsSync)(script)) return script;
17844
18008
  }
17845
18009
  return null;
17846
18010
  }
@@ -17852,11 +18016,11 @@ function packagedDetachedJobPath() {
17852
18016
  function resolveDetachedJobScript() {
17853
18017
  const packaged = packagedDetachedJobPath();
17854
18018
  if (packaged) return packaged;
17855
- let dir = (0, import_node_path43.dirname)((0, import_node_url3.fileURLToPath)(import_meta3.url));
18019
+ let dir = (0, import_node_path44.dirname)((0, import_node_url3.fileURLToPath)(import_meta3.url));
17856
18020
  for (let i = 0; i < 8; i++) {
17857
18021
  const candidate = detachedJobScriptIn(dir);
17858
18022
  if (candidate) return candidate;
17859
- const parent = (0, import_node_path43.dirname)(dir);
18023
+ const parent = (0, import_node_path44.dirname)(dir);
17860
18024
  if (parent === dir) break;
17861
18025
  dir = parent;
17862
18026
  }
@@ -17867,12 +18031,12 @@ function formatDetachedJobInvoke(scriptPath) {
17867
18031
  if (resolved) return `node ${JSON.stringify(resolved)}`;
17868
18032
  return "node scripts/detached-job.cjs";
17869
18033
  }
17870
- var import_node_fs46, import_node_path43, import_node_url3, import_meta3, DETACHED_JOB_FILENAMES;
18034
+ var import_node_fs47, import_node_path44, import_node_url3, import_meta3, DETACHED_JOB_FILENAMES;
17871
18035
  var init_detached_job_path = __esm({
17872
18036
  "src/skills/detached-job-path.ts"() {
17873
18037
  "use strict";
17874
- import_node_fs46 = require("fs");
17875
- import_node_path43 = require("path");
18038
+ import_node_fs47 = require("fs");
18039
+ import_node_path44 = require("path");
17876
18040
  import_node_url3 = require("url");
17877
18041
  init_packaged_runtime();
17878
18042
  import_meta3 = {};
@@ -18030,9 +18194,9 @@ function formatPrGateDirective() {
18030
18194
  }
18031
18195
  function formatProcessGuideDirective(opts) {
18032
18196
  const worktree = opts?.worktreePath?.trim();
18033
- const hasGraphSkill = !!worktree && (0, import_node_fs47.existsSync)((0, import_node_path44.join)(worktree, ".claude/skills/graph-engineering/SKILL.md"));
18034
- const hasReviewSkill = !!worktree && (0, import_node_fs47.existsSync)((0, import_node_path44.join)(worktree, ".claude/skills/review/SKILL.md"));
18035
- const hasInstallSkill = !!worktree && (0, import_node_fs47.existsSync)((0, import_node_path44.join)(worktree, ".claude/skills/worktree-install/SKILL.md"));
18197
+ const hasGraphSkill = !!worktree && (0, import_node_fs48.existsSync)((0, import_node_path45.join)(worktree, ".claude/skills/graph-engineering/SKILL.md"));
18198
+ const hasReviewSkill = !!worktree && (0, import_node_fs48.existsSync)((0, import_node_path45.join)(worktree, ".claude/skills/review/SKILL.md"));
18199
+ const hasInstallSkill = !!worktree && (0, import_node_fs48.existsSync)((0, import_node_path45.join)(worktree, ".claude/skills/worktree-install/SKILL.md"));
18036
18200
  return [
18037
18201
  "Process guides (recurring work only):",
18038
18202
  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,
@@ -18070,12 +18234,12 @@ function formatArtifactDirective() {
18070
18234
  function formatUiReminder() {
18071
18235
  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.";
18072
18236
  }
18073
- var import_node_fs47, import_node_path44, PR_GOAL_RE, GITHUB_TICKET_REF, KEYED_TICKET_REF;
18237
+ var import_node_fs48, import_node_path45, PR_GOAL_RE, GITHUB_TICKET_REF, KEYED_TICKET_REF;
18074
18238
  var init_instructions = __esm({
18075
18239
  "src/agents/instructions.ts"() {
18076
18240
  "use strict";
18077
- import_node_fs47 = require("fs");
18078
- import_node_path44 = require("path");
18241
+ import_node_fs48 = require("fs");
18242
+ import_node_path45 = require("path");
18079
18243
  init_git_auth_mode();
18080
18244
  init_worktree_labels();
18081
18245
  init_detached_job_path();
@@ -18266,40 +18430,40 @@ __export(plan_file_exports, {
18266
18430
  writePlanFile: () => writePlanFile
18267
18431
  });
18268
18432
  function ensureAttachmentsGitignore(worktreePath) {
18269
- const gitignoreAbs = (0, import_node_path45.join)(worktreePath, ATTACHMENTS_DIR, ".gitignore");
18270
- if ((0, import_node_fs48.existsSync)(gitignoreAbs)) return;
18271
- (0, import_node_fs48.mkdirSync)((0, import_node_path45.dirname)(gitignoreAbs), { recursive: true });
18272
- (0, import_node_fs48.writeFileSync)(gitignoreAbs, attachmentsGitignoreBody(), "utf8");
18433
+ const gitignoreAbs = (0, import_node_path46.join)(worktreePath, ATTACHMENTS_DIR, ".gitignore");
18434
+ if ((0, import_node_fs49.existsSync)(gitignoreAbs)) return;
18435
+ (0, import_node_fs49.mkdirSync)((0, import_node_path46.dirname)(gitignoreAbs), { recursive: true });
18436
+ (0, import_node_fs49.writeFileSync)(gitignoreAbs, attachmentsGitignoreBody(), "utf8");
18273
18437
  }
18274
18438
  function planFileAbs(worktreePath) {
18275
- return (0, import_node_path45.join)(worktreePath, PLAN_FILE_REL);
18439
+ return (0, import_node_path46.join)(worktreePath, PLAN_FILE_REL);
18276
18440
  }
18277
18441
  function readTextIfPresent2(abs) {
18278
- if (!(0, import_node_fs48.existsSync)(abs)) return null;
18442
+ if (!(0, import_node_fs49.existsSync)(abs)) return null;
18279
18443
  try {
18280
- const content = (0, import_node_fs48.readFileSync)(abs, "utf8");
18444
+ const content = (0, import_node_fs49.readFileSync)(abs, "utf8");
18281
18445
  return content.trim() ? content : null;
18282
18446
  } catch {
18283
18447
  return null;
18284
18448
  }
18285
18449
  }
18286
18450
  function readPlanFile(worktreePath) {
18287
- return readTextIfPresent2(planFileAbs(worktreePath)) ?? readTextIfPresent2((0, import_node_path45.join)(worktreePath, `${LEGACY_ATTACHMENTS_DIR}/plan.md`)) ?? readTextIfPresent2((0, import_node_path45.join)(worktreePath, LEGACY_PLAN_FILE_REL));
18451
+ return readTextIfPresent2(planFileAbs(worktreePath)) ?? readTextIfPresent2((0, import_node_path46.join)(worktreePath, `${LEGACY_ATTACHMENTS_DIR}/plan.md`)) ?? readTextIfPresent2((0, import_node_path46.join)(worktreePath, LEGACY_PLAN_FILE_REL));
18288
18452
  }
18289
18453
  function writePlanFile(worktreePath, content) {
18290
18454
  ensureAttachmentsGitignore(worktreePath);
18291
18455
  const abs = planFileAbs(worktreePath);
18292
- (0, import_node_fs48.mkdirSync)((0, import_node_path45.dirname)(abs), { recursive: true });
18456
+ (0, import_node_fs49.mkdirSync)((0, import_node_path46.dirname)(abs), { recursive: true });
18293
18457
  const body = content.trimEnd() + (content.endsWith("\n") ? "" : "\n");
18294
- (0, import_node_fs48.writeFileSync)(abs, body, "utf8");
18458
+ (0, import_node_fs49.writeFileSync)(abs, body, "utf8");
18295
18459
  return PLAN_FILE_REL;
18296
18460
  }
18297
- var import_node_fs48, import_node_path45;
18461
+ var import_node_fs49, import_node_path46;
18298
18462
  var init_plan_file = __esm({
18299
18463
  "src/plan/plan-file.ts"() {
18300
18464
  "use strict";
18301
- import_node_fs48 = require("fs");
18302
- import_node_path45 = require("path");
18465
+ import_node_fs49 = require("fs");
18466
+ import_node_path46 = require("path");
18303
18467
  init_workspace_scratch();
18304
18468
  init_plan_present();
18305
18469
  init_plan_present();
@@ -18359,7 +18523,7 @@ function setCaffeinateHoldHooks(next) {
18359
18523
  hooks = next;
18360
18524
  }
18361
18525
  function caffeinateHoldPath() {
18362
- return (0, import_node_path46.join)(appDataDir(), "caffeinate-hold.json");
18526
+ return (0, import_node_path47.join)(appDataDir(), "caffeinate-hold.json");
18363
18527
  }
18364
18528
  function processAlive(pid) {
18365
18529
  if (hooks.processAlive) return hooks.processAlive(pid);
@@ -18393,9 +18557,9 @@ function uniqueIds(ids) {
18393
18557
  }
18394
18558
  function readHold() {
18395
18559
  const path = caffeinateHoldPath();
18396
- if (!(0, import_node_fs49.existsSync)(path)) return null;
18560
+ if (!(0, import_node_fs50.existsSync)(path)) return null;
18397
18561
  try {
18398
- const parsed = JSON.parse((0, import_node_fs49.readFileSync)(path, "utf8"));
18562
+ const parsed = JSON.parse((0, import_node_fs50.readFileSync)(path, "utf8"));
18399
18563
  if (typeof parsed?.pid === "number" && parsed.pid > 0) {
18400
18564
  return {
18401
18565
  pid: parsed.pid,
@@ -18417,7 +18581,7 @@ function writeHold(pid, threadIds) {
18417
18581
  }
18418
18582
  function clearHold() {
18419
18583
  try {
18420
- (0, import_node_fs49.unlinkSync)(caffeinateHoldPath());
18584
+ (0, import_node_fs50.unlinkSync)(caffeinateHoldPath());
18421
18585
  } catch {
18422
18586
  }
18423
18587
  }
@@ -18475,7 +18639,7 @@ function setCaffeinateHold(enabled, opts) {
18475
18639
  if (platform !== "darwin") {
18476
18640
  return idleState(platform);
18477
18641
  }
18478
- const spawnImpl = hooks.spawn ?? import_node_child_process4.spawn;
18642
+ const spawnImpl = hooks.spawn ?? import_node_child_process5.spawn;
18479
18643
  const child = spawnImpl("caffeinate", ["-dimsu"], {
18480
18644
  detached: true,
18481
18645
  stdio: "ignore"
@@ -18502,13 +18666,13 @@ function releaseCaffeinateHoldForThread(threadId) {
18502
18666
  }
18503
18667
  return setCaffeinateHold(false, { threadId: id });
18504
18668
  }
18505
- var import_node_child_process4, import_node_fs49, import_node_path46, hooks;
18669
+ var import_node_child_process5, import_node_fs50, import_node_path47, hooks;
18506
18670
  var init_caffeinate_hold = __esm({
18507
18671
  "src/store/caffeinate-hold.ts"() {
18508
18672
  "use strict";
18509
- import_node_child_process4 = require("child_process");
18510
- import_node_fs49 = require("fs");
18511
- import_node_path46 = require("path");
18673
+ import_node_child_process5 = require("child_process");
18674
+ import_node_fs50 = require("fs");
18675
+ import_node_path47 = require("path");
18512
18676
  init_paths();
18513
18677
  init_private_file();
18514
18678
  hooks = {};
@@ -18517,7 +18681,7 @@ var init_caffeinate_hold = __esm({
18517
18681
 
18518
18682
  // src/store/schedules.ts
18519
18683
  function schedulesPath() {
18520
- return (0, import_node_path47.join)(appDataDir(), "schedules.json");
18684
+ return (0, import_node_path48.join)(appDataDir(), "schedules.json");
18521
18685
  }
18522
18686
  function parseDurationMs(every) {
18523
18687
  const m = every.trim().match(DURATION_RE);
@@ -18617,9 +18781,9 @@ function normalizeTask(raw) {
18617
18781
  }
18618
18782
  function readAll2() {
18619
18783
  const path = schedulesPath();
18620
- if (!(0, import_node_fs50.existsSync)(path)) return [];
18784
+ if (!(0, import_node_fs51.existsSync)(path)) return [];
18621
18785
  try {
18622
- const parsed = JSON.parse((0, import_node_fs50.readFileSync)(path, "utf8"));
18786
+ const parsed = JSON.parse((0, import_node_fs51.readFileSync)(path, "utf8"));
18623
18787
  if (!Array.isArray(parsed)) return [];
18624
18788
  return parsed.map((row) => {
18625
18789
  try {
@@ -18731,13 +18895,13 @@ function recordScheduleRun(id, result) {
18731
18895
  writeAll2(rows);
18732
18896
  return next;
18733
18897
  }
18734
- var import_node_crypto9, import_node_fs50, import_node_path47, import_croner, DURATION_RE, UNIT_MS;
18898
+ var import_node_crypto9, import_node_fs51, import_node_path48, import_croner, DURATION_RE, UNIT_MS;
18735
18899
  var init_schedules = __esm({
18736
18900
  "src/store/schedules.ts"() {
18737
18901
  "use strict";
18738
18902
  import_node_crypto9 = require("crypto");
18739
- import_node_fs50 = require("fs");
18740
- import_node_path47 = require("path");
18903
+ import_node_fs51 = require("fs");
18904
+ import_node_path48 = require("path");
18741
18905
  import_croner = require("croner");
18742
18906
  init_orchestrator_capable();
18743
18907
  init_paths();
@@ -18879,13 +19043,13 @@ var init_schedule_runner = __esm({
18879
19043
 
18880
19044
  // src/agents/cursor-store.ts
18881
19045
  function cursorSdkStoreDir(threadId) {
18882
- const root = (0, import_node_path48.join)(appDataDir(), CURSOR_SDK_STORE_DIR);
19046
+ const root = (0, import_node_path49.join)(appDataDir(), CURSOR_SDK_STORE_DIR);
18883
19047
  const id = sanitizeCursorStoreSegment(threadId);
18884
19048
  if (!id) return root;
18885
- return (0, import_node_path48.join)(root, "threads", id);
19049
+ return (0, import_node_path49.join)(root, "threads", id);
18886
19050
  }
18887
19051
  function cursorSdkRunsNdjsonPath(threadId) {
18888
- return (0, import_node_path48.join)(cursorSdkStoreDir(threadId), "runs.ndjson");
19052
+ return (0, import_node_path49.join)(cursorSdkStoreDir(threadId), "runs.ndjson");
18889
19053
  }
18890
19054
  function cursorSdkRunsNdjsonSearchPaths(threadId) {
18891
19055
  const scoped = cursorSdkRunsNdjsonPath(threadId);
@@ -18898,11 +19062,11 @@ function cursorSdkRunsNdjsonSearchPaths(threadId) {
18898
19062
  function sanitizeCursorStoreSegment(threadId) {
18899
19063
  return (threadId ?? "").trim().replace(/[^a-zA-Z0-9._-]/g, "_");
18900
19064
  }
18901
- var import_node_path48, CURSOR_SDK_STORE_DIR;
19065
+ var import_node_path49, CURSOR_SDK_STORE_DIR;
18902
19066
  var init_cursor_store = __esm({
18903
19067
  "src/agents/cursor-store.ts"() {
18904
19068
  "use strict";
18905
- import_node_path48 = require("path");
19069
+ import_node_path49 = require("path");
18906
19070
  init_paths();
18907
19071
  CURSOR_SDK_STORE_DIR = "cursor-sdk-store";
18908
19072
  }
@@ -18924,9 +19088,9 @@ function recoverFinishedCursorRun(opts) {
18924
19088
  return best;
18925
19089
  }
18926
19090
  function scanFinishedCursorRuns(runsPath, agentId, startedAfterMs) {
18927
- if (!(0, import_node_fs51.existsSync)(runsPath)) return null;
19091
+ if (!(0, import_node_fs52.existsSync)(runsPath)) return null;
18928
19092
  try {
18929
- const lines = (0, import_node_fs51.readFileSync)(runsPath, "utf8").split("\n");
19093
+ const lines = (0, import_node_fs52.readFileSync)(runsPath, "utf8").split("\n");
18930
19094
  let best = null;
18931
19095
  for (const line of lines) {
18932
19096
  const trimmed = line.trim();
@@ -18952,11 +19116,11 @@ function scanFinishedCursorRuns(runsPath, agentId, startedAfterMs) {
18952
19116
  return null;
18953
19117
  }
18954
19118
  }
18955
- var import_node_fs51;
19119
+ var import_node_fs52;
18956
19120
  var init_cursor_recover = __esm({
18957
19121
  "src/agents/cursor-recover.ts"() {
18958
19122
  "use strict";
18959
- import_node_fs51 = require("fs");
19123
+ import_node_fs52 = require("fs");
18960
19124
  init_cursor_store();
18961
19125
  }
18962
19126
  });
@@ -19088,13 +19252,13 @@ async function startOrchestration(opts) {
19088
19252
  }
19089
19253
  return updated;
19090
19254
  }
19091
- var import_node_events, import_node_fs52, LIVE_TURN_SPAWN_GRACE_MS, STALE_AGENT_PID_WAIT_MS, Orchestrator, singleton;
19255
+ var import_node_events, import_node_fs53, LIVE_TURN_SPAWN_GRACE_MS, STALE_AGENT_PID_WAIT_MS, Orchestrator, singleton;
19092
19256
  var init_orchestrator = __esm({
19093
19257
  "src/orchestrator/orchestrator.ts"() {
19094
19258
  "use strict";
19095
19259
  import_node_events = require("events");
19096
19260
  init_outbound_watch();
19097
- import_node_fs52 = require("fs");
19261
+ import_node_fs53 = require("fs");
19098
19262
  init_error_detail();
19099
19263
  init_run();
19100
19264
  init_stale_lock();
@@ -19267,7 +19431,7 @@ var init_orchestrator = __esm({
19267
19431
  }
19268
19432
  continue;
19269
19433
  }
19270
- if (!(0, import_node_fs52.existsSync)(thread.worktreePath)) {
19434
+ if (!(0, import_node_fs53.existsSync)(thread.worktreePath)) {
19271
19435
  setStatus(thread.id, "broken", "Worktree missing on disk");
19272
19436
  this.emit({ type: "status_changed", threadId: thread.id, status: "broken" });
19273
19437
  continue;
@@ -19812,9 +19976,10 @@ var init_orchestrator = __esm({
19812
19976
  ts: (/* @__PURE__ */ new Date()).toISOString()
19813
19977
  });
19814
19978
  thread = this.requireThread(threadId);
19979
+ const gitPrompt = expandCanonicalGitRequest(prompt);
19815
19980
  const { agentPrompt: expandedPrompt } = expandComposerPrompt(
19816
19981
  thread.worktreePath,
19817
- prompt,
19982
+ gitPrompt,
19818
19983
  {
19819
19984
  attachments: sentAttachments ?? thread.attachments
19820
19985
  }
@@ -19856,13 +20021,13 @@ var init_orchestrator = __esm({
19856
20021
  artifactReminder,
19857
20022
  longRunningReminder
19858
20023
  ].filter(Boolean).join("\n\n") || void 0;
19859
- const prGateDirective = thread.agent !== "brightsy" && !isOrchestratorThread(thread) && mentionsPrGoal(expandedPrompt) ? formatPrGateDirective() : null;
20024
+ const prGateDirective = thread.agent !== "brightsy" && !isOrchestratorThread(thread) && mentionsPrGoal(prompt) ? formatPrGateDirective() : null;
19860
20025
  const agentPrompt = [
19861
20026
  thread.planMode ? PLAN_MODE_INSTRUCTION : null,
19862
20027
  orchestrationReminder,
19863
20028
  prGateDirective,
19864
20029
  slackReplyContext,
19865
- expandCanonicalGitRequest(expandedPrompt)
20030
+ expandedPrompt
19866
20031
  ].filter(Boolean).join("\n\n");
19867
20032
  if (thread.attachments.length > 0) {
19868
20033
  updateThread(threadId, { attachments: [] });
@@ -21157,7 +21322,7 @@ var init_orchestrator = __esm({
21157
21322
  this.emit({ type: "status_changed", threadId: restored2.id, status: restored2.status });
21158
21323
  return restored2;
21159
21324
  }
21160
- if (!(0, import_node_fs52.existsSync)(thread.worktreePath)) {
21325
+ if (!(0, import_node_fs53.existsSync)(thread.worktreePath)) {
21161
21326
  if (isCowboyThread(thread) || isPrimaryCheckoutThread(thread)) {
21162
21327
  throw new Error(
21163
21328
  `Cowboy checkout missing: ${thread.worktreePath}. Re-add the project folder, then restore.`
@@ -21234,13 +21399,14 @@ var init_orchestrator = __esm({
21234
21399
 
21235
21400
  // src/mcp/run-stdio.ts
21236
21401
  init_nested_electron_env();
21402
+ init_system_ca();
21237
21403
 
21238
21404
  // src/mcp/server.ts
21239
21405
  var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
21240
21406
  var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
21241
21407
  var import_zod8 = require("zod");
21242
21408
  var import_node_crypto12 = require("crypto");
21243
- var import_node_path51 = require("path");
21409
+ var import_node_path52 = require("path");
21244
21410
  init_orchestrator();
21245
21411
  init_worktree();
21246
21412
 
@@ -23832,27 +23998,27 @@ init_gh_errors();
23832
23998
  init_git_auth_mode();
23833
23999
 
23834
24000
  // src/board/load-home-board.ts
23835
- var import_node_fs54 = require("fs");
23836
- var import_node_path50 = require("path");
24001
+ var import_node_fs55 = require("fs");
24002
+ var import_node_path51 = require("path");
23837
24003
  init_worktree();
23838
24004
  init_paths();
23839
24005
 
23840
24006
  // src/board/board-pins.ts
23841
24007
  var import_node_crypto11 = require("crypto");
23842
- var import_node_fs53 = require("fs");
23843
- var import_node_path49 = require("path");
24008
+ var import_node_fs54 = require("fs");
24009
+ var import_node_path50 = require("path");
23844
24010
  init_paths();
23845
24011
  init_home_board();
23846
24012
  var FILE = "home-board-pins.json";
23847
24013
  var VERSION = 1;
23848
24014
  function pinsFile() {
23849
- return (0, import_node_path49.join)(appDataDir(), FILE);
24015
+ return (0, import_node_path50.join)(appDataDir(), FILE);
23850
24016
  }
23851
24017
  function readDisk() {
23852
24018
  const path = pinsFile();
23853
- if (!(0, import_node_fs53.existsSync)(path)) return [];
24019
+ if (!(0, import_node_fs54.existsSync)(path)) return [];
23854
24020
  try {
23855
- const raw = JSON.parse((0, import_node_fs53.readFileSync)(path, "utf8"));
24021
+ const raw = JSON.parse((0, import_node_fs54.readFileSync)(path, "utf8"));
23856
24022
  if (raw?.version !== VERSION || !Array.isArray(raw.items)) return [];
23857
24023
  return raw.items.filter((item) => item?.id && item.kind && item.ref);
23858
24024
  } catch {
@@ -23860,8 +24026,8 @@ function readDisk() {
23860
24026
  }
23861
24027
  }
23862
24028
  function writeDisk(items) {
23863
- (0, import_node_fs53.mkdirSync)(appDataDir(), { recursive: true });
23864
- (0, import_node_fs53.writeFileSync)(pinsFile(), JSON.stringify({ version: VERSION, items }, null, 2), "utf8");
24029
+ (0, import_node_fs54.mkdirSync)(appDataDir(), { recursive: true });
24030
+ (0, import_node_fs54.writeFileSync)(pinsFile(), JSON.stringify({ version: VERSION, items }, null, 2), "utf8");
23865
24031
  }
23866
24032
  function listBoardPins() {
23867
24033
  return readDisk();
@@ -23882,7 +24048,7 @@ function homeBoardWorkspaceKey(workspaces) {
23882
24048
  return workspaces.map((w) => w.path).filter(Boolean).sort().join("\n");
23883
24049
  }
23884
24050
  function cacheFile() {
23885
- return (0, import_node_path50.join)(appDataDir(), "home-board-cache.json");
24051
+ return (0, import_node_path51.join)(appDataDir(), "home-board-cache.json");
23886
24052
  }
23887
24053
  function emptyInputs() {
23888
24054
  return {
@@ -23908,9 +24074,9 @@ function shouldCacheHomeBoardInputs(inputs) {
23908
24074
  }
23909
24075
  function readDiskCache() {
23910
24076
  const path = cacheFile();
23911
- if (!(0, import_node_fs54.existsSync)(path)) return null;
24077
+ if (!(0, import_node_fs55.existsSync)(path)) return null;
23912
24078
  try {
23913
- const raw = JSON.parse((0, import_node_fs54.readFileSync)(path, "utf8"));
24079
+ const raw = JSON.parse((0, import_node_fs55.readFileSync)(path, "utf8"));
23914
24080
  if (raw?.version !== CACHE_VERSION || typeof raw.fetchedAt !== "number") {
23915
24081
  return null;
23916
24082
  }
@@ -23924,8 +24090,8 @@ function readDiskCache() {
23924
24090
  }
23925
24091
  function writeDiskCache(entry) {
23926
24092
  try {
23927
- (0, import_node_fs54.mkdirSync)(appDataDir(), { recursive: true });
23928
- (0, import_node_fs54.writeFileSync)(cacheFile(), JSON.stringify(entry), "utf8");
24093
+ (0, import_node_fs55.mkdirSync)(appDataDir(), { recursive: true });
24094
+ (0, import_node_fs55.writeFileSync)(cacheFile(), JSON.stringify(entry), "utf8");
23929
24095
  } catch {
23930
24096
  }
23931
24097
  }
@@ -24053,6 +24219,52 @@ async function getHomeBoardInputs(workspaces, opts) {
24053
24219
 
24054
24220
  // src/mcp/server.ts
24055
24221
  init_home_board();
24222
+
24223
+ // src/mcp/create-thread-agent.ts
24224
+ function resolveOrchCreateThreadOptions(input) {
24225
+ const { resolveNewThreadOptions: resolveNewThreadOptions2 } = input;
24226
+ const account = resolveNewThreadOptions2({});
24227
+ const requested = input.requestedAgent;
24228
+ const parent = input.parentAgent ?? void 0;
24229
+ let agent = account.agent;
24230
+ let ignoredAgent;
24231
+ let honorRequestedModel = false;
24232
+ if (requested) {
24233
+ const parentEcho = Boolean(parent) && requested === parent && requested !== account.agent;
24234
+ const cursorAutofill = requested === "cursor" && account.agent !== "cursor";
24235
+ if (parentEcho || cursorAutofill) {
24236
+ ignoredAgent = requested;
24237
+ } else {
24238
+ agent = requested;
24239
+ honorRequestedModel = input.requestedModel !== void 0;
24240
+ }
24241
+ }
24242
+ let coercedFrom;
24243
+ if (agent === "codex" && parent === "codex") {
24244
+ coercedFrom = requested ?? "codex";
24245
+ agent = "cursor";
24246
+ }
24247
+ const opts = resolveNewThreadOptions2({
24248
+ agent,
24249
+ model: honorRequestedModel ? input.requestedModel : void 0
24250
+ });
24251
+ return {
24252
+ ...opts,
24253
+ ...ignoredAgent ? { ignoredAgent } : {},
24254
+ ...coercedFrom ? { coercedFrom } : {}
24255
+ };
24256
+ }
24257
+ function orchCreateThreadAgentNote(input) {
24258
+ if (input.coercedFrom) {
24259
+ return `Avoid nested Codex under a Codex orchestrator \u2014 used Account default agent=${input.agent}`;
24260
+ }
24261
+ if (input.ignoredAgent) {
24262
+ return `Ignored agent=${input.ignoredAgent} \u2014 used Account default agent=${input.agent}`;
24263
+ }
24264
+ return void 0;
24265
+ }
24266
+
24267
+ // src/mcp/server.ts
24056
24268
  var MAX_ORCH_THREADS = 5;
24057
24269
  var CREATE_THREAD_TIMEOUT_MS = 9e4;
24058
24270
  function withTimeout(promise, ms, label) {
@@ -24100,18 +24312,13 @@ async function createOrchChildThread(orch, args, resolveNewThreadOptions2) {
24100
24312
  };
24101
24313
  }
24102
24314
  }
24103
- let agentArg = args.agent;
24104
- let agentCoercedFrom;
24105
- const resolvedProbe = resolveNewThreadOptions2({ agent: agentArg }).agent;
24106
- if (resolvedProbe === "codex") {
24107
- agentCoercedFrom = agentArg ?? "codex";
24108
- const accountAgent = resolveNewThreadOptions2({}).agent;
24109
- agentArg = accountAgent !== "codex" ? accountAgent : "cursor";
24110
- }
24111
- const opts = resolveNewThreadOptions2({
24112
- agent: agentArg,
24113
- model: args.model
24315
+ const opts = resolveOrchCreateThreadOptions({
24316
+ requestedAgent: args.agent,
24317
+ requestedModel: args.model,
24318
+ parentAgent: parent?.agent,
24319
+ resolveNewThreadOptions: resolveNewThreadOptions2
24114
24320
  });
24321
+ const agentNote = orchCreateThreadAgentNote(opts);
24115
24322
  try {
24116
24323
  const priorIds = new Set(orch.getThreads(false).map((t) => t.id));
24117
24324
  const thread = await withTimeout(
@@ -24147,10 +24354,9 @@ async function createOrchChildThread(orch, args, resolveNewThreadOptions2) {
24147
24354
  link: `sideboard://thread/${thread.id}`,
24148
24355
  parentThreadId: thread.parentThreadId,
24149
24356
  ...alreadyStarted ? { alreadyStarted: true } : {},
24150
- ...agentCoercedFrom ? {
24151
- agentCoercedFrom,
24152
- note: `Avoid nested Codex under a Codex orchestrator \u2014 used Account default agent=${thread.agent}`
24153
- } : {},
24357
+ ...opts.coercedFrom ? { agentCoercedFrom: opts.coercedFrom } : {},
24358
+ ...opts.ignoredAgent ? { agentIgnored: opts.ignoredAgent } : {},
24359
+ ...agentNote ? { note: agentNote } : {},
24154
24360
  ...parentCorrectedFrom ? { parentCorrectedFrom, parentNote } : {}
24155
24361
  })
24156
24362
  };
@@ -24225,7 +24431,7 @@ async function startMcpServer() {
24225
24431
  async () => {
24226
24432
  const threads = orch.getThreads(true);
24227
24433
  const lines = threads.map((t) => {
24228
- const repo = t.repoPath === GLOBAL_WORKSPACE_ID ? "Orchestration" : (0, import_node_path51.basename)(t.repoPath) || t.repoPath;
24434
+ const repo = t.repoPath === GLOBAL_WORKSPACE_ID ? "Orchestration" : (0, import_node_path52.basename)(t.repoPath) || t.repoPath;
24229
24435
  const live = orch.threadLooksLive(t) ? readTurnLive(t.id) : null;
24230
24436
  const parent = t.parentThreadId ? ` parent:${t.parentThreadId.slice(0, 8)}` : "";
24231
24437
  const preview = lastMessagePreview(t.messages, 80);
@@ -24510,11 +24716,13 @@ async function startMcpServer() {
24510
24716
  );
24511
24717
  server.tool(
24512
24718
  "create_thread",
24513
- `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.`,
24719
+ `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.`,
24514
24720
  {
24515
24721
  sourceType: import_zod8.z.enum(["branch", "pr", "ticket"]),
24516
24722
  sourceRef: import_zod8.z.string(),
24517
- agent: import_zod8.z.enum(["claude", "codex", "opencode", "brightsy", "cursor"]).optional().describe(`Omit to use Account default agent (${accountDefaults.agent})`),
24723
+ agent: import_zod8.z.enum(["claude", "codex", "opencode", "brightsy", "cursor"]).optional().describe(
24724
+ `Usually omit. Sideboard uses Account default agent (${accountDefaults.agent}). Passing your own agent or cursor is ignored.`
24725
+ ),
24518
24726
  model: import_zod8.z.string().nullable().optional().describe(
24519
24727
  `Usually omit to use Account default model (${accountDefaults.model?.trim() || "Auto"}). Pass null only to force Auto / agent-default.`
24520
24728
  ),
@@ -25221,6 +25429,12 @@ async function startMcpServer() {
25221
25429
 
25222
25430
  // src/mcp/run-stdio.ts
25223
25431
  dropNestedElectronEnvFromProcess();
25432
+ var systemCaBundle = materializeSystemCaBundle();
25433
+ if (systemCaBundle && !process.env.NODE_EXTRA_CA_CERTS?.trim()) {
25434
+ process.env.NODE_EXTRA_CA_CERTS = systemCaBundle;
25435
+ }
25436
+ applySystemCaEnv(process.env);
25437
+ trustSystemCertificates();
25224
25438
  startMcpServer().catch((err) => {
25225
25439
  console.error(err);
25226
25440
  process.exitCode = 1;