@sideboard-ai/core 0.1.172 → 0.1.174

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 (27) hide show
  1. package/dist/{agents-CTWLBPCV.js → agents-LMPVUPOH.js} +3 -3
  2. package/dist/{agents-7UTRNLXQ.js → agents-ZWYRGFZB.js} +3 -3
  3. package/dist/{chunk-QYZYDO3F.js → chunk-7JIYKYLL.js} +26 -5
  4. package/dist/{chunk-PXNOT6NV.js → chunk-7O53GXTA.js} +26 -5
  5. package/dist/{chunk-3F7AXVIL.js → chunk-CUA4S537.js} +3 -3
  6. package/dist/{chunk-QYJS7LYE.js → chunk-HJPGIETB.js} +204 -145
  7. package/dist/{chunk-6X6KMUI2.js → chunk-TPPZXZTA.js} +3 -3
  8. package/dist/{chunk-234EKD2F.js → chunk-VCVBICMZ.js} +1 -1
  9. package/dist/{chunk-ZTVBIBLB.js → chunk-YEPVWJ3R.js} +200 -143
  10. package/dist/{chunk-2RM6BZQ2.js → chunk-ZY7K4T37.js} +1 -1
  11. package/dist/{coordinator-prompt-PM6MPYYB.js → coordinator-prompt-K3HXEPFD.js} +2 -2
  12. package/dist/{coordinator-prompt-7CTI6HRH.js → coordinator-prompt-LJKA2ODR.js} +2 -2
  13. package/dist/{global-workspace-CRJ6ZVIY.js → global-workspace-KA7T26F5.js} +2 -2
  14. package/dist/{global-workspace-CMYSFRCM.js → global-workspace-VDFSU3DD.js} +2 -2
  15. package/dist/index.cjs +324 -238
  16. package/dist/index.d.cts +4 -0
  17. package/dist/index.d.ts +4 -0
  18. package/dist/index.js +6 -6
  19. package/dist/mcp/run-stdio.cjs +336 -250
  20. package/dist/mcp/run-stdio.js +4 -4
  21. package/dist/{orchestrator-RW4IVITI.js → orchestrator-DMSSC4SV.js} +4 -4
  22. package/dist/{orchestrator-VPT4SXXD.js → orchestrator-VMUZJFTZ.js} +4 -4
  23. package/dist/{workspaces-L73MCDFA.js → workspaces-GOGBPATJ.js} +2 -2
  24. package/dist/{workspaces-UYSD2STS.js → workspaces-UR7YEFMZ.js} +2 -2
  25. package/dist/{worktree-SQD3DBYC.js → worktree-LC4VRWDM.js} +1 -1
  26. package/dist/{worktree-WVEDT3FM.js → worktree-UTDBQXSS.js} +1 -1
  27. package/package.json +1 -1
@@ -2406,18 +2406,35 @@ function teamSlugFromName(name) {
2406
2406
  function normalizeTakenSlug(raw) {
2407
2407
  return raw.toLowerCase().replace(/^thread\//, "").replace(/\/+$/, "");
2408
2408
  }
2409
+ function soccerTokenFromTakenSlug(raw) {
2410
+ const normalized = normalizeTakenSlug(raw);
2411
+ if (!normalized) return null;
2412
+ const withoutTicket = normalized.replace(/^[a-z]{2,8}-\d{1,6}-/, "").replace(/^\d{1,8}-/, "");
2413
+ const lookup = withoutTicket || normalized;
2414
+ const suffixMatch = lookup.match(/^(.+)-(\d+)$/);
2415
+ const base = suffixMatch?.[1] ?? lookup;
2416
+ const team = FAMOUS_SOCCER_TEAM_SEEDS.find((t) => t.slug === base);
2417
+ if (!team) return null;
2418
+ return suffixMatch ? `${team.slug}-${suffixMatch[2]}` : team.slug;
2419
+ }
2420
+ function addTakenSlug(out, raw) {
2421
+ const normalized = normalizeTakenSlug(raw);
2422
+ if (!normalized) return;
2423
+ out.add(normalized);
2424
+ const token = soccerTokenFromTakenSlug(normalized);
2425
+ if (token) out.add(token);
2426
+ }
2409
2427
  function takenSlugsFromThread(thread) {
2410
2428
  const out = /* @__PURE__ */ new Set();
2411
2429
  const titleSlug = thread.title ? teamSlugFromName(thread.title) : null;
2412
2430
  if (titleSlug) out.add(normalizeTakenSlug(titleSlug));
2413
2431
  if (thread.branchName?.trim()) {
2414
- const branch = normalizeTakenSlug(thread.branchName.trim());
2415
- if (branch) out.add(branch);
2432
+ addTakenSlug(out, thread.branchName.trim());
2416
2433
  }
2417
2434
  if (thread.worktreePath) {
2418
2435
  const parts = thread.worktreePath.replace(/\/+$/, "").split("/");
2419
2436
  const dir = parts[parts.length - 1];
2420
- if (dir) out.add(normalizeTakenSlug(dir));
2437
+ if (dir) addTakenSlug(out, dir);
2421
2438
  }
2422
2439
  return [...out];
2423
2440
  }
@@ -7088,12 +7105,16 @@ function collectTakenTeamSlugs(repoPath) {
7088
7105
  if ((0, import_node_fs15.existsSync)(root)) {
7089
7106
  for (const entry of (0, import_node_fs15.readdirSync)(root, { withFileTypes: true })) {
7090
7107
  if (entry.isDirectory() && entry.name !== ".DS_Store") {
7091
- taken.add(normalizeTakenSlug(entry.name));
7108
+ for (const slug of takenSlugsFromThread({ worktreePath: entry.name })) {
7109
+ taken.add(slug);
7110
+ }
7092
7111
  }
7093
7112
  }
7094
7113
  }
7095
7114
  for (const slug of listLocalThreadBranchSlugs(repoPath)) {
7096
- taken.add(slug);
7115
+ for (const token of takenSlugsFromThread({ branchName: slug })) {
7116
+ taken.add(token);
7117
+ }
7097
7118
  }
7098
7119
  for (const thread of listThreads({ includeArchived: true })) {
7099
7120
  if (!sameRepoPath(thread.repoPath, repoPath)) continue;
@@ -11932,6 +11953,62 @@ var init_agents = __esm({
11932
11953
  }
11933
11954
  });
11934
11955
 
11956
+ // src/hook/worktree-pkg-cache.ts
11957
+ function worktreePkgCacheRoot(worktreePath) {
11958
+ return (0, import_node_path32.join)(worktreePath, WORKTREE_PKG_CACHE_REL);
11959
+ }
11960
+ function worktreePkgCacheEnv(worktreePath) {
11961
+ const root = worktreePkgCacheRoot(worktreePath);
11962
+ const store = (0, import_node_path32.join)(root, "pnpm-store");
11963
+ const pnpmCache = (0, import_node_path32.join)(root, "pnpm");
11964
+ const npmCache = (0, import_node_path32.join)(root, "npm");
11965
+ const nodeGyp = (0, import_node_path32.join)(root, "node-gyp");
11966
+ const electron = (0, import_node_path32.join)(root, "electron");
11967
+ return {
11968
+ npm_config_store_dir: store,
11969
+ PNPM_STORE_DIR: store,
11970
+ npm_config_cache_dir: pnpmCache,
11971
+ npm_config_cache: npmCache,
11972
+ npm_config_devdir: nodeGyp,
11973
+ // @electron/get — do not set ELECTRON_CACHE (stripNestedElectronEnv).
11974
+ electron_config_cache: electron
11975
+ };
11976
+ }
11977
+ function isSet(value) {
11978
+ return value != null && value.trim() !== "";
11979
+ }
11980
+ function fillGroup(env, keys, values) {
11981
+ if (keys.some((key) => isSet(env[key]))) return;
11982
+ for (const key of keys) {
11983
+ const value = values[key];
11984
+ if (value) env[key] = value;
11985
+ }
11986
+ }
11987
+ function ensureWorktreePkgCacheDirs(worktreePath) {
11988
+ if (!(0, import_node_fs32.existsSync)(worktreePath)) return;
11989
+ (0, import_node_fs32.mkdirSync)(worktreePkgCacheRoot(worktreePath), { recursive: true });
11990
+ }
11991
+ function applyWorktreePkgCacheEnv(env, worktreePath) {
11992
+ const cwd = worktreePath.trim();
11993
+ if (!cwd) return;
11994
+ const next = worktreePkgCacheEnv(cwd);
11995
+ fillGroup(env, ["npm_config_store_dir", "PNPM_STORE_DIR"], next);
11996
+ fillGroup(env, ["npm_config_cache_dir"], next);
11997
+ fillGroup(env, ["npm_config_cache"], next);
11998
+ fillGroup(env, ["npm_config_devdir"], next);
11999
+ fillGroup(env, ["electron_config_cache"], next);
12000
+ ensureWorktreePkgCacheDirs(cwd);
12001
+ }
12002
+ var import_node_fs32, import_node_path32, WORKTREE_PKG_CACHE_REL;
12003
+ var init_worktree_pkg_cache = __esm({
12004
+ "src/hook/worktree-pkg-cache.ts"() {
12005
+ "use strict";
12006
+ import_node_fs32 = require("fs");
12007
+ import_node_path32 = require("path");
12008
+ WORKTREE_PKG_CACHE_REL = ".context/.sideboard/pkg-cache";
12009
+ }
12010
+ });
12011
+
11935
12012
  // src/agents/cursor-stream-coalesce.ts
11936
12013
  function isTextEvent(event) {
11937
12014
  return event.type === "stdout" || event.type === "thinking";
@@ -12034,6 +12111,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
12034
12111
  const env = childEnvWithAppSettings(cmd.env);
12035
12112
  applyPromptCacheTtlEnv(thread.agent, env);
12036
12113
  applyAgentRunnerHeapEnv(env);
12114
+ if (!isOrchestratorThread(thread)) {
12115
+ applyWorktreePkgCacheEnv(env, thread.worktreePath);
12116
+ }
12037
12117
  try {
12038
12118
  if (isOrchestratorThread(thread)) {
12039
12119
  mergeAgentGitAuthEnv(env, await resolveAgentGitAuthEnv(env));
@@ -12141,6 +12221,7 @@ var init_spawn = __esm({
12141
12221
  init_agents();
12142
12222
  init_orchestrator_capable();
12143
12223
  init_message_parts();
12224
+ init_worktree_pkg_cache();
12144
12225
  init_node_launch();
12145
12226
  init_path();
12146
12227
  init_usage();
@@ -12598,7 +12679,7 @@ function buildSessionSeed(messages, opts) {
12598
12679
  for (let i = blocks.length - 1; i >= 0; i--) {
12599
12680
  if (keep[i]) continue;
12600
12681
  const next = used + blocks[i].length + 2;
12601
- if (next > maxChars && used > 0) break;
12682
+ if (next > maxChars && used > 0) continue;
12602
12683
  keep[i] = true;
12603
12684
  used = next;
12604
12685
  }
@@ -13028,21 +13109,21 @@ function shouldRefreshReviewRequestTemplate(content) {
13028
13109
  return LEGACY_REVIEW_TEMPLATE_MARKERS.every((m) => trimmed.includes(m));
13029
13110
  }
13030
13111
  function readTextIfPresent(abs) {
13031
- if (!(0, import_node_fs32.existsSync)(abs)) return null;
13112
+ if (!(0, import_node_fs33.existsSync)(abs)) return null;
13032
13113
  try {
13033
- const content = (0, import_node_fs32.readFileSync)(abs, "utf8");
13114
+ const content = (0, import_node_fs33.readFileSync)(abs, "utf8");
13034
13115
  return content.trim() ? content : null;
13035
13116
  } catch {
13036
13117
  return null;
13037
13118
  }
13038
13119
  }
13039
13120
  function readLocalGuidelines(worktreePath) {
13040
- const localAbs = (0, import_node_path32.join)(worktreePath, REVIEW_REQUEST_PATH);
13121
+ const localAbs = (0, import_node_path33.join)(worktreePath, REVIEW_REQUEST_PATH);
13041
13122
  const localContent = readTextIfPresent(localAbs);
13042
13123
  if (localContent && !shouldRefreshReviewRequestTemplate(localContent)) {
13043
13124
  return { path: REVIEW_REQUEST_PATH, content: localContent };
13044
13125
  }
13045
- const legacyAbs = (0, import_node_path32.join)(worktreePath, LEGACY_REVIEW_REQUEST_PATH);
13126
+ const legacyAbs = (0, import_node_path33.join)(worktreePath, LEGACY_REVIEW_REQUEST_PATH);
13046
13127
  const legacyContent = readTextIfPresent(legacyAbs);
13047
13128
  if (legacyContent && !shouldRefreshReviewRequestTemplate(legacyContent)) {
13048
13129
  return { path: LEGACY_REVIEW_REQUEST_PATH, content: legacyContent };
@@ -13066,27 +13147,27 @@ function contextGuidelines(content, source) {
13066
13147
  };
13067
13148
  }
13068
13149
  function writeContextGuidelines(worktreePath, content) {
13069
- const abs = (0, import_node_path32.join)(worktreePath, CONTEXT_REVIEW_PATH);
13070
- (0, import_node_fs32.mkdirSync)((0, import_node_path32.dirname)(abs), { recursive: true });
13150
+ const abs = (0, import_node_path33.join)(worktreePath, CONTEXT_REVIEW_PATH);
13151
+ (0, import_node_fs33.mkdirSync)((0, import_node_path33.dirname)(abs), { recursive: true });
13071
13152
  const body = content.endsWith("\n") ? content : `${content}
13072
13153
  `;
13073
- (0, import_node_fs32.writeFileSync)(abs, body, "utf8");
13154
+ (0, import_node_fs33.writeFileSync)(abs, body, "utf8");
13074
13155
  return body;
13075
13156
  }
13076
13157
  function readSideboardReview(worktreePath, repoPath) {
13077
- const fromWorktree = readTextIfPresent((0, import_node_path32.join)(worktreePath, REPO_REVIEW_PATH));
13158
+ const fromWorktree = readTextIfPresent((0, import_node_path33.join)(worktreePath, REPO_REVIEW_PATH));
13078
13159
  if (fromWorktree) return fromWorktree;
13079
13160
  const repo = repoPath?.replace(/\/+$/, "");
13080
13161
  const wt = worktreePath.replace(/\/+$/, "");
13081
13162
  if (!repo || repo === wt) return null;
13082
- return readTextIfPresent((0, import_node_path32.join)(repo, REPO_REVIEW_PATH));
13163
+ return readTextIfPresent((0, import_node_path33.join)(repo, REPO_REVIEW_PATH));
13083
13164
  }
13084
13165
  function ensureReviewGuidelinesFile(worktreePath, repoPath) {
13085
- const skillContent = readTextIfPresent((0, import_node_path32.join)(worktreePath, REVIEW_SKILL_PATH));
13166
+ const skillContent = readTextIfPresent((0, import_node_path33.join)(worktreePath, REVIEW_SKILL_PATH));
13086
13167
  if (skillContent) {
13087
13168
  return { ...skillGuidelines(skillContent, "skill"), wrote: false };
13088
13169
  }
13089
- const contextContent = readTextIfPresent((0, import_node_path32.join)(worktreePath, CONTEXT_REVIEW_PATH));
13170
+ const contextContent = readTextIfPresent((0, import_node_path33.join)(worktreePath, CONTEXT_REVIEW_PATH));
13090
13171
  if (contextContent && !shouldRefreshReviewRequestTemplate(contextContent)) {
13091
13172
  return { ...contextGuidelines(contextContent, "local"), wrote: false };
13092
13173
  }
@@ -13141,13 +13222,13 @@ async function requestReview(threadRef, send) {
13141
13222
  const started = await send(tab.id, REVIEW_REQUEST_PREFILL);
13142
13223
  return { tab: started, from };
13143
13224
  }
13144
- var import_node_crypto7, import_node_fs32, import_node_path32, 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;
13225
+ 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;
13145
13226
  var init_request_review = __esm({
13146
13227
  "src/review/request-review.ts"() {
13147
13228
  "use strict";
13148
13229
  import_node_crypto7 = require("crypto");
13149
- import_node_fs32 = require("fs");
13150
- import_node_path32 = require("path");
13230
+ import_node_fs33 = require("fs");
13231
+ import_node_path33 = require("path");
13151
13232
  init_global_workspace();
13152
13233
  init_chat_tabs();
13153
13234
  init_thread_store();
@@ -13173,9 +13254,9 @@ function matchSimpleGlob(pattern, name) {
13173
13254
  return new RegExp(`^${escaped}$`).test(name);
13174
13255
  }
13175
13256
  function readWorktreeInclude(repoPath) {
13176
- const path = (0, import_node_path33.join)(repoPath, ".worktreeinclude");
13177
- if (!(0, import_node_fs33.existsSync)(path)) return [];
13178
- return (0, import_node_fs33.readFileSync)(path, "utf8").split("\n").map((l) => l.trim()).filter((l) => l && !l.startsWith("#"));
13257
+ const path = (0, import_node_path34.join)(repoPath, ".worktreeinclude");
13258
+ if (!(0, import_node_fs34.existsSync)(path)) return [];
13259
+ return (0, import_node_fs34.readFileSync)(path, "utf8").split("\n").map((l) => l.trim()).filter((l) => l && !l.startsWith("#"));
13179
13260
  }
13180
13261
  function resolveFilesToCopy(repoPath) {
13181
13262
  const fromInclude = readWorktreeInclude(repoPath);
@@ -13185,10 +13266,10 @@ function resolveFilesToCopy(repoPath) {
13185
13266
  if (settings?.fileIncludeGlobs?.length) {
13186
13267
  const matched = [];
13187
13268
  try {
13188
- for (const entry of (0, import_node_fs33.readdirSync)(repoPath, { withFileTypes: true })) {
13269
+ for (const entry of (0, import_node_fs34.readdirSync)(repoPath, { withFileTypes: true })) {
13189
13270
  if (!entry.isFile()) continue;
13190
13271
  for (const glob of settings.fileIncludeGlobs) {
13191
- if (matchSimpleGlob(glob, entry.name) || matchSimpleGlob((0, import_node_path33.basename)(glob), entry.name)) {
13272
+ if (matchSimpleGlob(glob, entry.name) || matchSimpleGlob((0, import_node_path34.basename)(glob), entry.name)) {
13192
13273
  matched.push(entry.name);
13193
13274
  break;
13194
13275
  }
@@ -13200,7 +13281,7 @@ function resolveFilesToCopy(repoPath) {
13200
13281
  }
13201
13282
  const defaults = [];
13202
13283
  try {
13203
- for (const entry of (0, import_node_fs33.readdirSync)(repoPath, { withFileTypes: true })) {
13284
+ for (const entry of (0, import_node_fs34.readdirSync)(repoPath, { withFileTypes: true })) {
13204
13285
  if (entry.isFile() && entry.name.startsWith(".env")) {
13205
13286
  defaults.push(entry.name);
13206
13287
  }
@@ -13214,11 +13295,11 @@ function copyConfiguredFiles(repoPath, worktreePath) {
13214
13295
  const patterns = resolveFilesToCopy(repoPath);
13215
13296
  const copied = [];
13216
13297
  for (const rel of patterns) {
13217
- const src = (0, import_node_path33.join)(repoPath, rel);
13218
- if (!(0, import_node_fs33.existsSync)(src)) continue;
13219
- const dest = (0, import_node_path33.join)(worktreePath, rel);
13220
- (0, import_node_fs33.mkdirSync)((0, import_node_path33.dirname)(dest), { recursive: true });
13221
- (0, import_node_fs33.copyFileSync)(src, dest);
13298
+ const src = (0, import_node_path34.join)(repoPath, rel);
13299
+ if (!(0, import_node_fs34.existsSync)(src)) continue;
13300
+ const dest = (0, import_node_path34.join)(worktreePath, rel);
13301
+ (0, import_node_fs34.mkdirSync)((0, import_node_path34.dirname)(dest), { recursive: true });
13302
+ (0, import_node_fs34.copyFileSync)(src, dest);
13222
13303
  copied.push(rel);
13223
13304
  }
13224
13305
  return copied;
@@ -13253,7 +13334,7 @@ function buildWorkspaceScriptEnv(opts, baseEnv) {
13253
13334
  const env = stripNestedElectronEnv({
13254
13335
  ...baseEnv ?? process.env
13255
13336
  });
13256
- const name = opts.workspaceName ?? (0, import_node_path33.basename)(opts.worktreePath);
13337
+ const name = opts.workspaceName ?? (0, import_node_path34.basename)(opts.worktreePath);
13257
13338
  const ports = opts.ports ?? [];
13258
13339
  const primary = ports[0];
13259
13340
  env.SIDEBOARD_WORKSPACE_NAME = name;
@@ -13276,6 +13357,7 @@ function buildWorkspaceScriptEnv(opts, baseEnv) {
13276
13357
  env[`CONDUCTOR_PORT_${i}`] = String(p);
13277
13358
  }
13278
13359
  }
13360
+ applyWorktreePkgCacheEnv(env, opts.worktreePath);
13279
13361
  return env;
13280
13362
  }
13281
13363
  function pipeLines(stream, onLine) {
@@ -13515,17 +13597,18 @@ async function startDevServer(repoPath, worktreePath, onLine, opts) {
13515
13597
  done: handle.done
13516
13598
  };
13517
13599
  }
13518
- var import_node_fs33, import_node_net, import_node_path33, import_execa4, import_node_readline3, PORT_RANGE_SIZE, cachedLoginEnv;
13600
+ var import_node_fs34, import_node_net, import_node_path34, import_execa4, import_node_readline3, PORT_RANGE_SIZE, cachedLoginEnv;
13519
13601
  var init_conductor = __esm({
13520
13602
  "src/hook/conductor.ts"() {
13521
13603
  "use strict";
13522
- import_node_fs33 = require("fs");
13604
+ import_node_fs34 = require("fs");
13523
13605
  import_node_net = require("net");
13524
- import_node_path33 = require("path");
13606
+ import_node_path34 = require("path");
13525
13607
  import_execa4 = require("execa");
13526
13608
  import_node_readline3 = require("readline");
13527
13609
  init_settings();
13528
13610
  init_nested_electron_env();
13611
+ init_worktree_pkg_cache();
13529
13612
  init_convention_setup();
13530
13613
  init_cursor_worktrees();
13531
13614
  init_git_auth_mode();
@@ -13539,7 +13622,7 @@ var init_conductor = __esm({
13539
13622
 
13540
13623
  // src/store/setup-log.ts
13541
13624
  function setupLogPath(threadId) {
13542
- return (0, import_node_path34.join)(threadsDir(), `${threadId}.setup.log.json`);
13625
+ return (0, import_node_path35.join)(threadsDir(), `${threadId}.setup.log.json`);
13543
13626
  }
13544
13627
  function emptySetupLog() {
13545
13628
  return { ...EMPTY };
@@ -13556,7 +13639,7 @@ function persistNow(threadId) {
13556
13639
  const snap = memory.get(threadId);
13557
13640
  if (!snap) return;
13558
13641
  try {
13559
- (0, import_node_fs34.writeFileSync)(setupLogPath(threadId), `${JSON.stringify(snap)}
13642
+ (0, import_node_fs35.writeFileSync)(setupLogPath(threadId), `${JSON.stringify(snap)}
13560
13643
  `, "utf8");
13561
13644
  } catch {
13562
13645
  }
@@ -13573,9 +13656,9 @@ function schedulePersist(threadId) {
13573
13656
  }
13574
13657
  function loadFromDisk(threadId) {
13575
13658
  const path = setupLogPath(threadId);
13576
- if (!(0, import_node_fs34.existsSync)(path)) return null;
13659
+ if (!(0, import_node_fs35.existsSync)(path)) return null;
13577
13660
  try {
13578
- const raw = JSON.parse((0, import_node_fs34.readFileSync)(path, "utf8"));
13661
+ const raw = JSON.parse((0, import_node_fs35.readFileSync)(path, "utf8"));
13579
13662
  return {
13580
13663
  output: typeof raw.output === "string" ? raw.output : "",
13581
13664
  running: Boolean(raw.running),
@@ -13631,12 +13714,12 @@ function finishSetupLog(threadId, exitCode, source) {
13631
13714
  persistNow(threadId);
13632
13715
  return clone(snap);
13633
13716
  }
13634
- var import_node_fs34, import_node_path34, EMPTY, memory, persistTimers;
13717
+ var import_node_fs35, import_node_path35, EMPTY, memory, persistTimers;
13635
13718
  var init_setup_log = __esm({
13636
13719
  "src/store/setup-log.ts"() {
13637
13720
  "use strict";
13638
- import_node_fs34 = require("fs");
13639
- import_node_path34 = require("path");
13721
+ import_node_fs35 = require("fs");
13722
+ import_node_path35 = require("path");
13640
13723
  init_paths();
13641
13724
  EMPTY = {
13642
13725
  output: "",
@@ -13660,9 +13743,9 @@ async function findOrphanWorktrees(repoPaths) {
13660
13743
  repoPaths?.length ? repoPaths : threads.map((t) => t.repoPath).filter(Boolean)
13661
13744
  );
13662
13745
  const homeRoot = sideboardWorkspacesDir();
13663
- if ((0, import_node_fs35.existsSync)(homeRoot)) {
13746
+ if ((0, import_node_fs36.existsSync)(homeRoot)) {
13664
13747
  try {
13665
- for (const entry of (0, import_node_fs35.readdirSync)(homeRoot, { withFileTypes: true })) {
13748
+ for (const entry of (0, import_node_fs36.readdirSync)(homeRoot, { withFileTypes: true })) {
13666
13749
  if (!entry.isDirectory()) continue;
13667
13750
  void entry;
13668
13751
  }
@@ -13672,7 +13755,7 @@ async function findOrphanWorktrees(repoPaths) {
13672
13755
  const orphans = [];
13673
13756
  const seen = /* @__PURE__ */ new Set();
13674
13757
  for (const repoPath of repos) {
13675
- if (!repoPath || !(0, import_node_fs35.existsSync)(repoPath)) continue;
13758
+ if (!repoPath || !(0, import_node_fs36.existsSync)(repoPath)) continue;
13676
13759
  try {
13677
13760
  const wts = await listWorktrees(repoPath);
13678
13761
  for (const wt of wts) {
@@ -13683,7 +13766,7 @@ async function findOrphanWorktrees(repoPaths) {
13683
13766
  seen.add(path);
13684
13767
  let mtimeMs = 0;
13685
13768
  try {
13686
- mtimeMs = (0, import_node_fs35.statSync)(path).mtimeMs;
13769
+ mtimeMs = (0, import_node_fs36.statSync)(path).mtimeMs;
13687
13770
  } catch {
13688
13771
  mtimeMs = 0;
13689
13772
  }
@@ -13693,16 +13776,16 @@ async function findOrphanWorktrees(repoPaths) {
13693
13776
  }
13694
13777
  try {
13695
13778
  const root = worktreesRoot(repoPath);
13696
- if ((0, import_node_fs35.existsSync)(root)) {
13697
- for (const entry of (0, import_node_fs35.readdirSync)(root, { withFileTypes: true })) {
13779
+ if ((0, import_node_fs36.existsSync)(root)) {
13780
+ for (const entry of (0, import_node_fs36.readdirSync)(root, { withFileTypes: true })) {
13698
13781
  if (!entry.isDirectory()) continue;
13699
- const path = (0, import_node_path35.join)(root, entry.name).replace(/\/$/, "");
13782
+ const path = (0, import_node_path36.join)(root, entry.name).replace(/\/$/, "");
13700
13783
  if (known.has(path) || seen.has(path)) continue;
13701
- if (!(0, import_node_fs35.existsSync)((0, import_node_path35.join)(path, ".git"))) continue;
13784
+ if (!(0, import_node_fs36.existsSync)((0, import_node_path36.join)(path, ".git"))) continue;
13702
13785
  seen.add(path);
13703
13786
  let mtimeMs = 0;
13704
13787
  try {
13705
- mtimeMs = (0, import_node_fs35.statSync)(path).mtimeMs;
13788
+ mtimeMs = (0, import_node_fs36.statSync)(path).mtimeMs;
13706
13789
  } catch {
13707
13790
  mtimeMs = Date.now();
13708
13791
  }
@@ -13754,12 +13837,12 @@ function shouldRunWorktreeCleanup(settings = loadAppSettings()) {
13754
13837
  const elapsed = Date.now() - Date.parse(last);
13755
13838
  return elapsed >= intervalHours * 36e5;
13756
13839
  }
13757
- var import_node_fs35, import_node_path35;
13840
+ var import_node_fs36, import_node_path36;
13758
13841
  var init_orphan_cleanup = __esm({
13759
13842
  "src/git/orphan-cleanup.ts"() {
13760
13843
  "use strict";
13761
- import_node_fs35 = require("fs");
13762
- import_node_path35 = require("path");
13844
+ import_node_fs36 = require("fs");
13845
+ import_node_path36 = require("path");
13763
13846
  init_worktree();
13764
13847
  init_thread_store();
13765
13848
  init_paths();
@@ -13862,12 +13945,12 @@ async function cloneRepoIntoSideboard(opts) {
13862
13945
  if (!url) throw new Error("Clone URL is required");
13863
13946
  let name = opts.name?.trim();
13864
13947
  if (!name) {
13865
- const leaf = (0, import_node_path36.basename)(url.replace(/\/$/, "").replace(/\.git$/, ""));
13948
+ const leaf = (0, import_node_path37.basename)(url.replace(/\/$/, "").replace(/\.git$/, ""));
13866
13949
  name = leaf || "repo";
13867
13950
  }
13868
13951
  name = name.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "repo";
13869
- const dest = (0, import_node_path36.join)(sideboardReposDir(), name);
13870
- if ((0, import_node_fs36.existsSync)(dest)) {
13952
+ const dest = (0, import_node_path37.join)(sideboardReposDir(), name);
13953
+ if ((0, import_node_fs37.existsSync)(dest)) {
13871
13954
  const repoPath2 = await resolveRepoRoot(dest);
13872
13955
  const workspace2 = await ensureWorkspace(repoPath2);
13873
13956
  return { repoPath: repoPath2, workspace: workspace2 };
@@ -13882,12 +13965,12 @@ async function cloneRepoIntoSideboard(opts) {
13882
13965
  const workspace = await ensureWorkspace(repoPath);
13883
13966
  return { repoPath, workspace };
13884
13967
  }
13885
- var import_node_fs36, import_node_path36, import_execa6;
13968
+ var import_node_fs37, import_node_path37, import_execa6;
13886
13969
  var init_clone_repo = __esm({
13887
13970
  "src/git/clone-repo.ts"() {
13888
13971
  "use strict";
13889
- import_node_fs36 = require("fs");
13890
- import_node_path36 = require("path");
13972
+ import_node_fs37 = require("fs");
13973
+ import_node_path37 = require("path");
13891
13974
  import_execa6 = require("execa");
13892
13975
  init_paths();
13893
13976
  init_workspaces2();
@@ -13897,11 +13980,11 @@ var init_clone_repo = __esm({
13897
13980
 
13898
13981
  // src/store/desktop-host.ts
13899
13982
  function desktopHostPidPath() {
13900
- return (0, import_node_path37.join)(appDataDir(), "desktop-host.pid");
13983
+ return (0, import_node_path38.join)(appDataDir(), "desktop-host.pid");
13901
13984
  }
13902
13985
  function readDesktopHostPid() {
13903
13986
  try {
13904
- const pid = Number.parseInt((0, import_node_fs37.readFileSync)(desktopHostPidPath(), "utf8").trim(), 10);
13987
+ const pid = Number.parseInt((0, import_node_fs38.readFileSync)(desktopHostPidPath(), "utf8").trim(), 10);
13905
13988
  if (!Number.isFinite(pid) || pid <= 0) return null;
13906
13989
  return pid;
13907
13990
  } catch {
@@ -13927,12 +14010,12 @@ function thisProcessShouldDrainAgentQueues() {
13927
14010
  if (isThisProcessDesktopHost()) return true;
13928
14011
  return !isDesktopHostAlive();
13929
14012
  }
13930
- var import_node_fs37, import_node_path37;
14013
+ var import_node_fs38, import_node_path38;
13931
14014
  var init_desktop_host = __esm({
13932
14015
  "src/store/desktop-host.ts"() {
13933
14016
  "use strict";
13934
- import_node_fs37 = require("fs");
13935
- import_node_path37 = require("path");
14017
+ import_node_fs38 = require("fs");
14018
+ import_node_path38 = require("path");
13936
14019
  init_paths();
13937
14020
  }
13938
14021
  });
@@ -14034,7 +14117,7 @@ function jobAlive(pid) {
14034
14117
  }
14035
14118
  function processGroupAlive(pgid) {
14036
14119
  if (process.platform === "win32") return false;
14037
- if (!Number.isInteger(pgid) || pgid <= 0) return false;
14120
+ if (!Number.isInteger(pgid) || pgid <= 1) return false;
14038
14121
  try {
14039
14122
  process.kill(-pgid, 0);
14040
14123
  return true;
@@ -14047,24 +14130,24 @@ function jobTreeAlive(pid) {
14047
14130
  return jobAlive(pid) || processGroupAlive(pid);
14048
14131
  }
14049
14132
  function readIntFile(file) {
14050
- if (!(0, import_node_fs38.existsSync)(file)) return null;
14051
- const n = Number.parseInt((0, import_node_fs38.readFileSync)(file, "utf8").trim(), 10);
14133
+ if (!(0, import_node_fs39.existsSync)(file)) return null;
14134
+ const n = Number.parseInt((0, import_node_fs39.readFileSync)(file, "utf8").trim(), 10);
14052
14135
  return Number.isInteger(n) ? n : null;
14053
14136
  }
14054
14137
  function jobDir(root, id, legacy = false) {
14055
- return (0, import_node_path38.join)(root, legacy ? LEGACY_DETACHED_JOBS_DIR : DETACHED_JOBS_DIR, id);
14138
+ return (0, import_node_path39.join)(root, legacy ? LEGACY_DETACHED_JOBS_DIR : DETACHED_JOBS_DIR, id);
14056
14139
  }
14057
14140
  function resolveJobDir(root, id) {
14058
14141
  const modern = jobDir(root, id, false);
14059
- if ((0, import_node_fs38.existsSync)(modern)) return modern;
14142
+ if ((0, import_node_fs39.existsSync)(modern)) return modern;
14060
14143
  const legacy = jobDir(root, id, true);
14061
- if ((0, import_node_fs38.existsSync)(legacy)) return legacy;
14144
+ if ((0, import_node_fs39.existsSync)(legacy)) return legacy;
14062
14145
  return modern;
14063
14146
  }
14064
14147
  function listJobIdsIn(root, rel) {
14065
- const dir = (0, import_node_path38.join)(root, rel);
14066
- if (!(0, import_node_fs38.existsSync)(dir)) return [];
14067
- return (0, import_node_fs38.readdirSync)(dir, { withFileTypes: true }).filter((e) => e.isDirectory() && JOB_ID_RE.test(e.name)).map((e) => e.name);
14148
+ const dir = (0, import_node_path39.join)(root, rel);
14149
+ if (!(0, import_node_fs39.existsSync)(dir)) return [];
14150
+ return (0, import_node_fs39.readdirSync)(dir, { withFileTypes: true }).filter((e) => e.isDirectory() && JOB_ID_RE.test(e.name)).map((e) => e.name);
14068
14151
  }
14069
14152
  function listRunningDetachedJobs(worktreePath) {
14070
14153
  const root = worktreePath.trim();
@@ -14076,8 +14159,8 @@ function listRunningDetachedJobs(worktreePath) {
14076
14159
  const running = [];
14077
14160
  for (const id of ids) {
14078
14161
  const dir = resolveJobDir(root, id);
14079
- const pid = readIntFile((0, import_node_path38.join)(dir, "pid"));
14080
- if (pid != null && jobAlive(pid)) running.push(id);
14162
+ const pid = readIntFile((0, import_node_path39.join)(dir, "pid"));
14163
+ if (jobTreeAlive(pid)) running.push(id);
14081
14164
  }
14082
14165
  return running.sort();
14083
14166
  }
@@ -14129,13 +14212,13 @@ function planJobContinue(opts) {
14129
14212
  return { action: "none" };
14130
14213
  }
14131
14214
  function tailProgress(logFile, maxLines = 12) {
14132
- if (!(0, import_node_fs38.existsSync)(logFile)) return "(no log yet)";
14133
- const lines = (0, import_node_fs38.readFileSync)(logFile, "utf8").split("\n");
14215
+ if (!(0, import_node_fs39.existsSync)(logFile)) return "(no log yet)";
14216
+ const lines = (0, import_node_fs39.readFileSync)(logFile, "utf8").split("\n");
14134
14217
  return lines.slice(-maxLines).join("\n");
14135
14218
  }
14136
14219
  function readLogLines(file) {
14137
- if (!(0, import_node_fs38.existsSync)(file)) return [];
14138
- const lines = (0, import_node_fs38.readFileSync)(file, "utf8").split("\n");
14220
+ if (!(0, import_node_fs39.existsSync)(file)) return [];
14221
+ const lines = (0, import_node_fs39.readFileSync)(file, "utf8").split("\n");
14139
14222
  if (lines.length && lines[lines.length - 1] === "") lines.pop();
14140
14223
  return lines;
14141
14224
  }
@@ -14146,15 +14229,15 @@ function takeDelta(logFile, cursorFile) {
14146
14229
  return { delta: lines.slice(start).join("\n"), nextCursor: lines.length };
14147
14230
  }
14148
14231
  function snapshotJob(dir) {
14149
- const pid = readIntFile((0, import_node_path38.join)(dir, "pid"));
14232
+ const pid = readIntFile((0, import_node_path39.join)(dir, "pid"));
14150
14233
  const running = jobTreeAlive(pid);
14151
14234
  return {
14152
14235
  pid,
14153
14236
  running,
14154
- exitCode: readIntFile((0, import_node_path38.join)(dir, "exit")),
14155
- log: (0, import_node_path38.join)(dir, "log"),
14156
- cursor: (0, import_node_path38.join)(dir, "present.cursor"),
14157
- progress: tailProgress((0, import_node_path38.join)(dir, "log"))
14237
+ exitCode: readIntFile((0, import_node_path39.join)(dir, "exit")),
14238
+ log: (0, import_node_path39.join)(dir, "log"),
14239
+ cursor: (0, import_node_path39.join)(dir, "present.cursor"),
14240
+ progress: tailProgress((0, import_node_path39.join)(dir, "log"))
14158
14241
  };
14159
14242
  }
14160
14243
  function toResult(id, snap, extra) {
@@ -14163,8 +14246,8 @@ function toResult(id, snap, extra) {
14163
14246
  const stillRunning = snap.running && !ok;
14164
14247
  const { delta, nextCursor } = takeDelta(snap.log, snap.cursor);
14165
14248
  try {
14166
- (0, import_node_fs38.mkdirSync)((0, import_node_path38.dirname)(snap.cursor), { recursive: true });
14167
- (0, import_node_fs38.writeFileSync)(snap.cursor, `${nextCursor}
14249
+ (0, import_node_fs39.mkdirSync)((0, import_node_path39.dirname)(snap.cursor), { recursive: true });
14250
+ (0, import_node_fs39.writeFileSync)(snap.cursor, `${nextCursor}
14168
14251
  `);
14169
14252
  } catch {
14170
14253
  }
@@ -14191,7 +14274,7 @@ async function waitForDetachedJob(cwd, id, opts) {
14191
14274
  const dir = resolveJobDir(root, jobId);
14192
14275
  const timeoutMs = mcpWaitForJobTimeoutMs(opts?.timeoutMs);
14193
14276
  const sleep = opts?.sleep ?? sleepMs;
14194
- if (!(0, import_node_fs38.existsSync)(dir)) {
14277
+ if (!(0, import_node_fs39.existsSync)(dir)) {
14195
14278
  return {
14196
14279
  stillRunning: false,
14197
14280
  ok: false,
@@ -14237,10 +14320,10 @@ function killProcessTree(pid, signal) {
14237
14320
  }
14238
14321
  function appendJobLog(logFile, line) {
14239
14322
  try {
14240
- (0, import_node_fs38.mkdirSync)((0, import_node_path38.dirname)(logFile), { recursive: true });
14323
+ (0, import_node_fs39.mkdirSync)((0, import_node_path39.dirname)(logFile), { recursive: true });
14241
14324
  const body = line.endsWith("\n") ? line : `${line}
14242
14325
  `;
14243
- (0, import_node_fs38.appendFileSync)(logFile, body);
14326
+ (0, import_node_fs39.appendFileSync)(logFile, body);
14244
14327
  } catch {
14245
14328
  }
14246
14329
  }
@@ -14250,7 +14333,7 @@ async function stopDetachedJob(cwd, id, opts) {
14250
14333
  const dir = resolveJobDir(root, jobId);
14251
14334
  const sleep = opts?.sleep ?? sleepMs;
14252
14335
  const why = opts?.reason?.trim() ?? "";
14253
- if (!(0, import_node_fs38.existsSync)(dir)) {
14336
+ if (!(0, import_node_fs39.existsSync)(dir)) {
14254
14337
  return {
14255
14338
  stillRunning: false,
14256
14339
  ok: false,
@@ -14286,10 +14369,10 @@ async function stopDetachedJob(cwd, id, opts) {
14286
14369
  killProcessTree(targetPid, "SIGKILL");
14287
14370
  await sleep(100);
14288
14371
  }
14289
- const exitFile = (0, import_node_path38.join)(dir, "exit");
14290
- if (!(0, import_node_fs38.existsSync)(exitFile)) {
14372
+ const exitFile = (0, import_node_path39.join)(dir, "exit");
14373
+ if (!(0, import_node_fs39.existsSync)(exitFile)) {
14291
14374
  try {
14292
- (0, import_node_fs38.writeFileSync)(exitFile, "1\n");
14375
+ (0, import_node_fs39.writeFileSync)(exitFile, "1\n");
14293
14376
  } catch {
14294
14377
  }
14295
14378
  }
@@ -14309,12 +14392,12 @@ async function stopDetachedJob(cwd, id, opts) {
14309
14392
  hint: stopped ? MCP_STOP_JOB_HINT : MCP_WAIT_JOB_STILL_RUNNING_HINT
14310
14393
  };
14311
14394
  }
14312
- var import_node_fs38, import_node_path38, MAX_JOB_CONTINUES, MCP_WAIT_JOB_STILL_RUNNING_HINT, MCP_STOP_JOB_HINT, JOB_ID_RE;
14395
+ var import_node_fs39, import_node_path39, MAX_JOB_CONTINUES, MCP_WAIT_JOB_STILL_RUNNING_HINT, MCP_STOP_JOB_HINT, JOB_ID_RE;
14313
14396
  var init_wait_for_job = __esm({
14314
14397
  "src/mcp/wait-for-job.ts"() {
14315
14398
  "use strict";
14316
- import_node_fs38 = require("fs");
14317
- import_node_path38 = require("path");
14399
+ import_node_fs39 = require("fs");
14400
+ import_node_path39 = require("path");
14318
14401
  init_workspace_scratch();
14319
14402
  init_wait_for_turn();
14320
14403
  MAX_JOB_CONTINUES = 8;
@@ -15409,7 +15492,7 @@ function reuseLiveThread(input, repoPath, match) {
15409
15492
  }
15410
15493
  async function createThread(input, _onSetupLine) {
15411
15494
  const repoPath = await resolveRepoRoot(input.repoPath);
15412
- if (!(0, import_node_fs39.existsSync)(repoPath)) {
15495
+ if (!(0, import_node_fs40.existsSync)(repoPath)) {
15413
15496
  throw new Error(`Repo not found: ${repoPath}`);
15414
15497
  }
15415
15498
  const reused = reuseLiveThread(input, repoPath, {
@@ -15581,11 +15664,11 @@ async function createThread(input, _onSetupLine) {
15581
15664
  await ensureWorkspace(repoPath);
15582
15665
  return readThread(thread.id) ?? thread;
15583
15666
  }
15584
- var import_node_fs39;
15667
+ var import_node_fs40;
15585
15668
  var init_create = __esm({
15586
15669
  "src/threads/create.ts"() {
15587
15670
  "use strict";
15588
- import_node_fs39 = require("fs");
15671
+ import_node_fs40 = require("fs");
15589
15672
  init_detect();
15590
15673
  init_worktree();
15591
15674
  init_home_board();
@@ -15705,20 +15788,20 @@ function writeTurnLive(threadId, progress) {
15705
15788
  const path = threadLivePath(threadId);
15706
15789
  const tmp = `${path}.${process.pid}.tmp`;
15707
15790
  try {
15708
- (0, import_node_fs40.writeFileSync)(tmp, JSON.stringify(progress), "utf8");
15709
- (0, import_node_fs40.renameSync)(tmp, path);
15791
+ (0, import_node_fs41.writeFileSync)(tmp, JSON.stringify(progress), "utf8");
15792
+ (0, import_node_fs41.renameSync)(tmp, path);
15710
15793
  } catch {
15711
15794
  try {
15712
- (0, import_node_fs40.unlinkSync)(tmp);
15795
+ (0, import_node_fs41.unlinkSync)(tmp);
15713
15796
  } catch {
15714
15797
  }
15715
15798
  }
15716
15799
  }
15717
15800
  function readTurnLive(threadId) {
15718
15801
  const path = threadLivePath(threadId);
15719
- if (!(0, import_node_fs40.existsSync)(path)) return null;
15802
+ if (!(0, import_node_fs41.existsSync)(path)) return null;
15720
15803
  try {
15721
- const raw = JSON.parse((0, import_node_fs40.readFileSync)(path, "utf8"));
15804
+ const raw = JSON.parse((0, import_node_fs41.readFileSync)(path, "utf8"));
15722
15805
  if (!raw || typeof raw.summary !== "string") return null;
15723
15806
  return raw;
15724
15807
  } catch {
@@ -15730,17 +15813,17 @@ function clearTurnLive(threadId) {
15730
15813
  if (buf?.timer) clearTimeout(buf.timer);
15731
15814
  buffers.delete(threadId);
15732
15815
  const path = threadLivePath(threadId);
15733
- if (!(0, import_node_fs40.existsSync)(path)) return;
15816
+ if (!(0, import_node_fs41.existsSync)(path)) return;
15734
15817
  try {
15735
- (0, import_node_fs40.unlinkSync)(path);
15818
+ (0, import_node_fs41.unlinkSync)(path);
15736
15819
  } catch {
15737
15820
  }
15738
15821
  }
15739
- var import_node_fs40, buffers, FLUSH_MS, MAX_PARTS;
15822
+ var import_node_fs41, buffers, FLUSH_MS, MAX_PARTS;
15740
15823
  var init_turn_live = __esm({
15741
15824
  "src/store/turn-live.ts"() {
15742
15825
  "use strict";
15743
- import_node_fs40 = require("fs");
15826
+ import_node_fs41 = require("fs");
15744
15827
  init_message_parts();
15745
15828
  init_paths();
15746
15829
  buffers = /* @__PURE__ */ new Map();
@@ -15957,7 +16040,7 @@ var init_quota_failover = __esm({
15957
16040
  // src/threads/adopt.ts
15958
16041
  function thisModuleFile() {
15959
16042
  const cjsFile = typeof __filename !== "undefined" ? __filename : "";
15960
- return cjsFile || process.argv[1] || (0, import_node_path39.join)(process.cwd(), "package.json");
16043
+ return cjsFile || process.argv[1] || (0, import_node_path40.join)(process.cwd(), "package.json");
15961
16044
  }
15962
16045
  function openReadonlySqlite(file) {
15963
16046
  const req = (0, import_node_module4.createRequire)(thisModuleFile());
@@ -15975,21 +16058,21 @@ function mapAgentType(raw) {
15975
16058
  return null;
15976
16059
  }
15977
16060
  function resolveConductorCursorAgentId(workspacePath) {
15978
- if (!workspacePath || !(0, import_node_fs41.existsSync)(CURSOR_SDK_STORE)) return null;
16061
+ if (!workspacePath || !(0, import_node_fs42.existsSync)(CURSOR_SDK_STORE)) return null;
15979
16062
  const normalized = workspacePath.replace(/\/$/, "");
15980
16063
  let best = null;
15981
16064
  let hashes;
15982
16065
  try {
15983
- hashes = (0, import_node_fs41.readdirSync)(CURSOR_SDK_STORE);
16066
+ hashes = (0, import_node_fs42.readdirSync)(CURSOR_SDK_STORE);
15984
16067
  } catch {
15985
16068
  return null;
15986
16069
  }
15987
16070
  for (const hash of hashes) {
15988
- const agentsFile = (0, import_node_path39.join)(CURSOR_SDK_STORE, hash, "agents.ndjson");
15989
- if (!(0, import_node_fs41.existsSync)(agentsFile)) continue;
16071
+ const agentsFile = (0, import_node_path40.join)(CURSOR_SDK_STORE, hash, "agents.ndjson");
16072
+ if (!(0, import_node_fs42.existsSync)(agentsFile)) continue;
15990
16073
  let text7;
15991
16074
  try {
15992
- text7 = (0, import_node_fs41.readFileSync)(agentsFile, "utf8");
16075
+ text7 = (0, import_node_fs42.readFileSync)(agentsFile, "utf8");
15993
16076
  } catch {
15994
16077
  continue;
15995
16078
  }
@@ -16013,7 +16096,7 @@ function resolveConductorCursorAgentId(workspacePath) {
16013
16096
  return best?.agentId ?? null;
16014
16097
  }
16015
16098
  async function adoptThread(input) {
16016
- if (!(0, import_node_fs41.existsSync)(input.worktreePath)) {
16099
+ if (!(0, import_node_fs42.existsSync)(input.worktreePath)) {
16017
16100
  throw new Error(`Worktree not found: ${input.worktreePath}`);
16018
16101
  }
16019
16102
  const repoPath = await resolveRepoRoot(input.worktreePath);
@@ -16039,18 +16122,18 @@ async function adoptThread(input) {
16039
16122
  return thread;
16040
16123
  }
16041
16124
  function listConductorWorkspaces() {
16042
- if (!(0, import_node_fs41.existsSync)(CONDUCTOR_DB)) {
16125
+ if (!(0, import_node_fs42.existsSync)(CONDUCTOR_DB)) {
16043
16126
  throw new Error(`Conductor DB not found at ${CONDUCTOR_DB}`);
16044
16127
  }
16045
- const tmp = (0, import_node_fs41.mkdtempSync)((0, import_node_path39.join)((0, import_node_os13.tmpdir)(), "sideboard-conductor-"));
16046
- const snapshot = (0, import_node_path39.join)(tmp, "conductor.db");
16128
+ const tmp = (0, import_node_fs42.mkdtempSync)((0, import_node_path40.join)((0, import_node_os13.tmpdir)(), "sideboard-conductor-"));
16129
+ const snapshot = (0, import_node_path40.join)(tmp, "conductor.db");
16047
16130
  try {
16048
- (0, import_node_fs41.copyFileSync)(CONDUCTOR_DB, snapshot);
16131
+ (0, import_node_fs42.copyFileSync)(CONDUCTOR_DB, snapshot);
16049
16132
  for (const suffix of ["-wal", "-shm"]) {
16050
16133
  const src = `${CONDUCTOR_DB}${suffix}`;
16051
- if ((0, import_node_fs41.existsSync)(src)) {
16134
+ if ((0, import_node_fs42.existsSync)(src)) {
16052
16135
  try {
16053
- (0, import_node_fs41.copyFileSync)(src, `${snapshot}${suffix}`);
16136
+ (0, import_node_fs42.copyFileSync)(src, `${snapshot}${suffix}`);
16054
16137
  } catch {
16055
16138
  }
16056
16139
  }
@@ -16126,22 +16209,22 @@ function listConductorWorkspaces() {
16126
16209
  db.close();
16127
16210
  }
16128
16211
  } finally {
16129
- (0, import_node_fs41.rmSync)(tmp, { recursive: true, force: true });
16212
+ (0, import_node_fs42.rmSync)(tmp, { recursive: true, force: true });
16130
16213
  }
16131
16214
  }
16132
16215
  function importConductorWorkspace(workspaceId) {
16133
- if (!(0, import_node_fs41.existsSync)(CONDUCTOR_DB)) {
16216
+ if (!(0, import_node_fs42.existsSync)(CONDUCTOR_DB)) {
16134
16217
  throw new Error(`Conductor DB not found at ${CONDUCTOR_DB}`);
16135
16218
  }
16136
- const tmp = (0, import_node_fs41.mkdtempSync)((0, import_node_path39.join)((0, import_node_os13.tmpdir)(), "sideboard-conductor-"));
16137
- const snapshot = (0, import_node_path39.join)(tmp, "conductor.db");
16219
+ const tmp = (0, import_node_fs42.mkdtempSync)((0, import_node_path40.join)((0, import_node_os13.tmpdir)(), "sideboard-conductor-"));
16220
+ const snapshot = (0, import_node_path40.join)(tmp, "conductor.db");
16138
16221
  try {
16139
- (0, import_node_fs41.copyFileSync)(CONDUCTOR_DB, snapshot);
16222
+ (0, import_node_fs42.copyFileSync)(CONDUCTOR_DB, snapshot);
16140
16223
  for (const suffix of ["-wal", "-shm"]) {
16141
16224
  const src = `${CONDUCTOR_DB}${suffix}`;
16142
- if ((0, import_node_fs41.existsSync)(src)) {
16225
+ if ((0, import_node_fs42.existsSync)(src)) {
16143
16226
  try {
16144
- (0, import_node_fs41.copyFileSync)(src, `${snapshot}${suffix}`);
16227
+ (0, import_node_fs42.copyFileSync)(src, `${snapshot}${suffix}`);
16145
16228
  } catch {
16146
16229
  }
16147
16230
  }
@@ -16159,7 +16242,7 @@ function importConductorWorkspace(workspaceId) {
16159
16242
  ).get(workspaceId);
16160
16243
  if (!row) throw new Error(`Conductor workspace not found: ${workspaceId}`);
16161
16244
  const worktreePath = String(row.workspacePath);
16162
- if (!(0, import_node_fs41.existsSync)(worktreePath)) {
16245
+ if (!(0, import_node_fs42.existsSync)(worktreePath)) {
16163
16246
  throw new Error(`Conductor worktree missing on disk: ${worktreePath}`);
16164
16247
  }
16165
16248
  let sessionId = null;
@@ -16222,31 +16305,31 @@ function importConductorWorkspace(workspaceId) {
16222
16305
  db.close();
16223
16306
  }
16224
16307
  } finally {
16225
- (0, import_node_fs41.rmSync)(tmp, { recursive: true, force: true });
16308
+ (0, import_node_fs42.rmSync)(tmp, { recursive: true, force: true });
16226
16309
  }
16227
16310
  }
16228
16311
  async function importConductorWorkspaceAsync(workspaceId) {
16229
16312
  return importConductorWorkspace(workspaceId);
16230
16313
  }
16231
- var import_node_child_process3, import_node_fs41, import_node_os13, import_node_path39, import_node_module4, CONDUCTOR_APP_SUPPORT, CONDUCTOR_DB, CURSOR_SDK_STORE;
16314
+ 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;
16232
16315
  var init_adopt = __esm({
16233
16316
  "src/threads/adopt.ts"() {
16234
16317
  "use strict";
16235
16318
  import_node_child_process3 = require("child_process");
16236
- import_node_fs41 = require("fs");
16319
+ import_node_fs42 = require("fs");
16237
16320
  import_node_os13 = require("os");
16238
- import_node_path39 = require("path");
16321
+ import_node_path40 = require("path");
16239
16322
  import_node_module4 = require("module");
16240
16323
  init_worktree();
16241
16324
  init_thread_store();
16242
- CONDUCTOR_APP_SUPPORT = (0, import_node_path39.join)(
16325
+ CONDUCTOR_APP_SUPPORT = (0, import_node_path40.join)(
16243
16326
  process.env.HOME ?? "",
16244
16327
  "Library",
16245
16328
  "Application Support",
16246
16329
  "com.conductor.app"
16247
16330
  );
16248
- CONDUCTOR_DB = (0, import_node_path39.join)(CONDUCTOR_APP_SUPPORT, "conductor.db");
16249
- CURSOR_SDK_STORE = (0, import_node_path39.join)(CONDUCTOR_APP_SUPPORT, "cursor-sdk-store");
16331
+ CONDUCTOR_DB = (0, import_node_path40.join)(CONDUCTOR_APP_SUPPORT, "conductor.db");
16332
+ CURSOR_SDK_STORE = (0, import_node_path40.join)(CONDUCTOR_APP_SUPPORT, "cursor-sdk-store");
16250
16333
  }
16251
16334
  });
16252
16335
 
@@ -16313,7 +16396,7 @@ async function openStackLayer(input, _onSetupLine) {
16313
16396
  let createdWorktree = false;
16314
16397
  const trees = await listWorktrees(repoPath);
16315
16398
  const checkedOut = trees.find((w) => w.branch === branchName);
16316
- if (checkedOut?.path && (0, import_node_fs42.existsSync)(checkedOut.path)) {
16399
+ if (checkedOut?.path && (0, import_node_fs43.existsSync)(checkedOut.path)) {
16317
16400
  if (input.reuseExistingWorktree !== false) {
16318
16401
  worktreePath = checkedOut.path;
16319
16402
  } else {
@@ -16455,7 +16538,7 @@ async function initStackFromThread(input, onSetupLine) {
16455
16538
  async function createPrStack(input, onSetupLine) {
16456
16539
  await requireAgent(input.agent);
16457
16540
  const repoPath = await resolveRepoRoot(input.repoPath);
16458
- if (!(0, import_node_fs42.existsSync)(repoPath)) throw new Error(`Repo not found: ${repoPath}`);
16541
+ if (!(0, import_node_fs43.existsSync)(repoPath)) throw new Error(`Repo not found: ${repoPath}`);
16459
16542
  if (!input.branches.length) throw new Error("At least one branch name required");
16460
16543
  const status = await detectGhStack(repoPath);
16461
16544
  if (!status.available) throw new Error(status.reason);
@@ -16522,7 +16605,7 @@ async function createPrStack(input, onSetupLine) {
16522
16605
  }
16523
16606
  }
16524
16607
  const claimed = new Set(threads.map((t) => t.worktreePath));
16525
- if (!claimed.has(bootstrap.worktreePath) && (0, import_node_fs42.existsSync)(bootstrap.worktreePath)) {
16608
+ if (!claimed.has(bootstrap.worktreePath) && (0, import_node_fs43.existsSync)(bootstrap.worktreePath)) {
16526
16609
  try {
16527
16610
  await removeWorktree(repoPath, bootstrap.worktreePath, {
16528
16611
  deleteBranch: bootstrap.branchName
@@ -16532,11 +16615,11 @@ async function createPrStack(input, onSetupLine) {
16532
16615
  }
16533
16616
  return { stack, threads, createdThreadIds };
16534
16617
  }
16535
- var import_node_fs42;
16618
+ var import_node_fs43;
16536
16619
  var init_stack_layers = __esm({
16537
16620
  "src/threads/stack-layers.ts"() {
16538
16621
  "use strict";
16539
- import_node_fs42 = require("fs");
16622
+ import_node_fs43 = require("fs");
16540
16623
  init_detect();
16541
16624
  init_run();
16542
16625
  init_stack();
@@ -16549,7 +16632,7 @@ var init_stack_layers = __esm({
16549
16632
 
16550
16633
  // src/diff/diff.ts
16551
16634
  async function inspectGitWorktree(worktreePath) {
16552
- if (!worktreePath || !(0, import_node_fs43.existsSync)(worktreePath)) return "missing_worktree";
16635
+ if (!worktreePath || !(0, import_node_fs44.existsSync)(worktreePath)) return "missing_worktree";
16553
16636
  const check = await git(["rev-parse", "--is-inside-work-tree"], worktreePath, {
16554
16637
  reject: false
16555
16638
  });
@@ -16557,7 +16640,7 @@ async function inspectGitWorktree(worktreePath) {
16557
16640
  return "ok";
16558
16641
  }
16559
16642
  async function initializeGitRepository(worktreePath) {
16560
- if (!worktreePath || !(0, import_node_fs43.existsSync)(worktreePath)) {
16643
+ if (!worktreePath || !(0, import_node_fs44.existsSync)(worktreePath)) {
16561
16644
  throw new Error("Worktree not found");
16562
16645
  }
16563
16646
  const status = await inspectGitWorktree(worktreePath);
@@ -16691,11 +16774,11 @@ new file mode 100644
16691
16774
  };
16692
16775
  }
16693
16776
  async function untrackedPatch(worktreePath, path, maxHunk) {
16694
- const abs = (0, import_node_path40.join)(worktreePath, path);
16777
+ const abs = (0, import_node_path41.join)(worktreePath, path);
16695
16778
  try {
16696
- const st = (0, import_node_fs43.statSync)(abs);
16779
+ const st = (0, import_node_fs44.statSync)(abs);
16697
16780
  if (st.isFile() && st.size > maxHunk) {
16698
- const buf = (0, import_node_fs43.readFileSync)(abs).subarray(0, maxHunk);
16781
+ const buf = (0, import_node_fs44.readFileSync)(abs).subarray(0, maxHunk);
16699
16782
  return syntheticAddPatch(path, buf.toString("utf8"), maxHunk);
16700
16783
  }
16701
16784
  } catch {
@@ -17184,8 +17267,8 @@ function isImageRelativePath(relativePath) {
17184
17267
  function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
17185
17268
  assertSafeRelativePath(relativePath);
17186
17269
  const maxBytes = opts?.maxBytes ?? DEFAULT_UPLOAD_MAX_BYTES;
17187
- const abs = (0, import_node_path40.join)(worktreePath, relativePath);
17188
- const st = (0, import_node_fs43.statSync)(abs);
17270
+ const abs = (0, import_node_path41.join)(worktreePath, relativePath);
17271
+ const st = (0, import_node_fs44.statSync)(abs);
17189
17272
  if (!st.isFile()) {
17190
17273
  throw new Error(`Not a file: ${relativePath}`);
17191
17274
  }
@@ -17194,7 +17277,7 @@ function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
17194
17277
  `File too large to upload (${st.size} bytes; max ${maxBytes})`
17195
17278
  );
17196
17279
  }
17197
- const buf = (0, import_node_fs43.readFileSync)(abs);
17280
+ const buf = (0, import_node_fs44.readFileSync)(abs);
17198
17281
  return {
17199
17282
  path: relativePath,
17200
17283
  contentBase64: buf.toString("base64"),
@@ -17204,12 +17287,12 @@ function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
17204
17287
  function readWorktreeFile(worktreePath, relativePath, opts) {
17205
17288
  assertSafeRelativePath(relativePath);
17206
17289
  const maxBytes = opts?.maxBytes ?? 2e5;
17207
- const abs = (0, import_node_path40.join)(worktreePath, relativePath);
17208
- const st = (0, import_node_fs43.statSync)(abs);
17290
+ const abs = (0, import_node_path41.join)(worktreePath, relativePath);
17291
+ const st = (0, import_node_fs44.statSync)(abs);
17209
17292
  if (!st.isFile()) {
17210
17293
  throw new Error(`Not a file: ${relativePath}`);
17211
17294
  }
17212
- const buf = (0, import_node_fs43.readFileSync)(abs);
17295
+ const buf = (0, import_node_fs44.readFileSync)(abs);
17213
17296
  if (isImageRelativePath(relativePath)) {
17214
17297
  const maxImageBytes = Math.max(maxBytes, 15e6);
17215
17298
  const truncated2 = buf.length > maxImageBytes;
@@ -17252,9 +17335,9 @@ function assertSafeRelativePath(relativePath) {
17252
17335
  }
17253
17336
  function writeWorktreeFile(worktreePath, relativePath, content) {
17254
17337
  assertSafeRelativePath(relativePath);
17255
- const abs = (0, import_node_path40.join)(worktreePath, relativePath);
17256
- (0, import_node_fs43.mkdirSync)((0, import_node_path40.dirname)(abs), { recursive: true });
17257
- (0, import_node_fs43.writeFileSync)(abs, content, "utf8");
17338
+ const abs = (0, import_node_path41.join)(worktreePath, relativePath);
17339
+ (0, import_node_fs44.mkdirSync)((0, import_node_path41.dirname)(abs), { recursive: true });
17340
+ (0, import_node_fs44.writeFileSync)(abs, content, "utf8");
17258
17341
  return { path: relativePath };
17259
17342
  }
17260
17343
  async function getDiffSummary(worktreePath, repoPath, opts) {
@@ -17271,12 +17354,12 @@ async function getDiffSummary(worktreePath, repoPath, opts) {
17271
17354
  truncated: full.files.length > maxFiles
17272
17355
  };
17273
17356
  }
17274
- var import_node_fs43, import_node_path40, mergeBaseCache, MERGE_BASE_TTL_MS, SHA_RE, IMAGE_EXTENSIONS2, DEFAULT_UPLOAD_MAX_BYTES;
17357
+ var import_node_fs44, import_node_path41, mergeBaseCache, MERGE_BASE_TTL_MS, SHA_RE, IMAGE_EXTENSIONS2, DEFAULT_UPLOAD_MAX_BYTES;
17275
17358
  var init_diff = __esm({
17276
17359
  "src/diff/diff.ts"() {
17277
17360
  "use strict";
17278
- import_node_fs43 = require("fs");
17279
- import_node_path40 = require("path");
17361
+ import_node_fs44 = require("fs");
17362
+ import_node_path41 = require("path");
17280
17363
  init_run();
17281
17364
  init_worktree();
17282
17365
  mergeBaseCache = /* @__PURE__ */ new Map();
@@ -17552,7 +17635,7 @@ function parseFrontmatter(content) {
17552
17635
  }
17553
17636
  function readSkill(skillMd, source) {
17554
17637
  try {
17555
- const content = (0, import_node_fs44.readFileSync)(skillMd, "utf8");
17638
+ const content = (0, import_node_fs45.readFileSync)(skillMd, "utf8");
17556
17639
  const { name: fmName, description } = parseFrontmatter(content);
17557
17640
  const dirName = skillMd.split("/").slice(-2, -1)[0] || "skill";
17558
17641
  const name = fmName || dirName;
@@ -17571,19 +17654,19 @@ function readSkill(skillMd, source) {
17571
17654
  }
17572
17655
  }
17573
17656
  function scanSkillsDir(dir, source, out) {
17574
- if (!(0, import_node_fs44.existsSync)(dir)) return;
17657
+ if (!(0, import_node_fs45.existsSync)(dir)) return;
17575
17658
  let entries;
17576
17659
  try {
17577
- entries = (0, import_node_fs44.readdirSync)(dir);
17660
+ entries = (0, import_node_fs45.readdirSync)(dir);
17578
17661
  } catch {
17579
17662
  return;
17580
17663
  }
17581
17664
  for (const entry of entries) {
17582
17665
  if (entry.startsWith(".")) continue;
17583
- const skillMd = (0, import_node_path41.join)(dir, entry, "SKILL.md");
17584
- if (!(0, import_node_fs44.existsSync)(skillMd)) continue;
17666
+ const skillMd = (0, import_node_path42.join)(dir, entry, "SKILL.md");
17667
+ if (!(0, import_node_fs45.existsSync)(skillMd)) continue;
17585
17668
  try {
17586
- if (!(0, import_node_fs44.statSync)(skillMd).isFile()) continue;
17669
+ if (!(0, import_node_fs45.statSync)(skillMd).isFile()) continue;
17587
17670
  } catch {
17588
17671
  continue;
17589
17672
  }
@@ -17592,24 +17675,24 @@ function scanSkillsDir(dir, source, out) {
17592
17675
  }
17593
17676
  }
17594
17677
  function scanClaudePluginSkills(pluginsRoot, out) {
17595
- if (!(0, import_node_fs44.existsSync)(pluginsRoot)) return;
17678
+ if (!(0, import_node_fs45.existsSync)(pluginsRoot)) return;
17596
17679
  const walk = (dir, depth, lookingForSkillsDir) => {
17597
17680
  if (depth > 7) return;
17598
17681
  let entries;
17599
17682
  try {
17600
- entries = (0, import_node_fs44.readdirSync)(dir);
17683
+ entries = (0, import_node_fs45.readdirSync)(dir);
17601
17684
  } catch {
17602
17685
  return;
17603
17686
  }
17604
17687
  if (lookingForSkillsDir && entries.includes("SKILL.md")) {
17605
- const skill = readSkill((0, import_node_path41.join)(dir, "SKILL.md"), "cli");
17688
+ const skill = readSkill((0, import_node_path42.join)(dir, "SKILL.md"), "cli");
17606
17689
  if (skill) out.push(skill);
17607
17690
  }
17608
17691
  for (const entry of entries) {
17609
17692
  if (entry === "node_modules" || entry === ".git") continue;
17610
- const full = (0, import_node_path41.join)(dir, entry);
17693
+ const full = (0, import_node_path42.join)(dir, entry);
17611
17694
  try {
17612
- if (!(0, import_node_fs44.statSync)(full).isDirectory()) continue;
17695
+ if (!(0, import_node_fs45.statSync)(full).isDirectory()) continue;
17613
17696
  } catch {
17614
17697
  continue;
17615
17698
  }
@@ -17627,17 +17710,17 @@ function discoverSkills(worktreePath) {
17627
17710
  const home = (0, import_node_os14.homedir)();
17628
17711
  const collected = [];
17629
17712
  for (const rel of [".claude/skills", ".cursor/skills", ".sideboard/skills", ".brightsy/skills", "skills"]) {
17630
- scanSkillsDir((0, import_node_path41.join)(worktreePath, rel), "workspace", collected);
17713
+ scanSkillsDir((0, import_node_path42.join)(worktreePath, rel), "workspace", collected);
17631
17714
  }
17632
17715
  for (const abs of [
17633
- (0, import_node_path41.join)(home, ".claude/skills"),
17634
- (0, import_node_path41.join)(home, ".cursor/skills"),
17635
- (0, import_node_path41.join)(home, ".sideboard/skills"),
17636
- (0, import_node_path41.join)(home, ".brightsy/skills")
17716
+ (0, import_node_path42.join)(home, ".claude/skills"),
17717
+ (0, import_node_path42.join)(home, ".cursor/skills"),
17718
+ (0, import_node_path42.join)(home, ".sideboard/skills"),
17719
+ (0, import_node_path42.join)(home, ".brightsy/skills")
17637
17720
  ]) {
17638
17721
  scanSkillsDir(abs, "user", collected);
17639
17722
  }
17640
- scanClaudePluginSkills((0, import_node_path41.join)(home, ".claude/plugins"), collected);
17723
+ scanClaudePluginSkills((0, import_node_path42.join)(home, ".claude/plugins"), collected);
17641
17724
  collected.push(...bundledSkills());
17642
17725
  const rank = {
17643
17726
  workspace: 0,
@@ -17663,7 +17746,7 @@ function readSkillBody(skillPath, maxChars = 12e3) {
17663
17746
  \u2026(truncated)` : body;
17664
17747
  }
17665
17748
  }
17666
- const raw = (0, import_node_fs44.readFileSync)(skillPath, "utf8");
17749
+ const raw = (0, import_node_fs45.readFileSync)(skillPath, "utf8");
17667
17750
  if (raw.startsWith("---")) {
17668
17751
  const end = raw.indexOf("\n---", 3);
17669
17752
  if (end >= 0) {
@@ -17677,13 +17760,13 @@ function readSkillBody(skillPath, maxChars = 12e3) {
17677
17760
 
17678
17761
  \u2026(truncated)` : raw;
17679
17762
  }
17680
- var import_node_fs44, import_node_os14, import_node_path41, BUNDLED_SKILL_PREFIX;
17763
+ var import_node_fs45, import_node_os14, import_node_path42, BUNDLED_SKILL_PREFIX;
17681
17764
  var init_discover = __esm({
17682
17765
  "src/skills/discover.ts"() {
17683
17766
  "use strict";
17684
- import_node_fs44 = require("fs");
17767
+ import_node_fs45 = require("fs");
17685
17768
  import_node_os14 = require("os");
17686
- import_node_path41 = require("path");
17769
+ import_node_path42 = require("path");
17687
17770
  init_long_running();
17688
17771
  BUNDLED_SKILL_PREFIX = "bundled:";
17689
17772
  }
@@ -17777,8 +17860,8 @@ var init_expand = __esm({
17777
17860
  // src/skills/detached-job-path.ts
17778
17861
  function detachedJobScriptIn(dir) {
17779
17862
  for (const name of DETACHED_JOB_FILENAMES) {
17780
- const script = (0, import_node_path42.join)(dir, "scripts", name);
17781
- if ((0, import_node_fs45.existsSync)(script)) return script;
17863
+ const script = (0, import_node_path43.join)(dir, "scripts", name);
17864
+ if ((0, import_node_fs46.existsSync)(script)) return script;
17782
17865
  }
17783
17866
  return null;
17784
17867
  }
@@ -17790,11 +17873,11 @@ function packagedDetachedJobPath() {
17790
17873
  function resolveDetachedJobScript() {
17791
17874
  const packaged = packagedDetachedJobPath();
17792
17875
  if (packaged) return packaged;
17793
- let dir = (0, import_node_path42.dirname)((0, import_node_url3.fileURLToPath)(import_meta3.url));
17876
+ let dir = (0, import_node_path43.dirname)((0, import_node_url3.fileURLToPath)(import_meta3.url));
17794
17877
  for (let i = 0; i < 8; i++) {
17795
17878
  const candidate = detachedJobScriptIn(dir);
17796
17879
  if (candidate) return candidate;
17797
- const parent = (0, import_node_path42.dirname)(dir);
17880
+ const parent = (0, import_node_path43.dirname)(dir);
17798
17881
  if (parent === dir) break;
17799
17882
  dir = parent;
17800
17883
  }
@@ -17805,12 +17888,12 @@ function formatDetachedJobInvoke(scriptPath) {
17805
17888
  if (resolved) return `node ${JSON.stringify(resolved)}`;
17806
17889
  return "node scripts/detached-job.cjs";
17807
17890
  }
17808
- var import_node_fs45, import_node_path42, import_node_url3, import_meta3, DETACHED_JOB_FILENAMES;
17891
+ var import_node_fs46, import_node_path43, import_node_url3, import_meta3, DETACHED_JOB_FILENAMES;
17809
17892
  var init_detached_job_path = __esm({
17810
17893
  "src/skills/detached-job-path.ts"() {
17811
17894
  "use strict";
17812
- import_node_fs45 = require("fs");
17813
- import_node_path42 = require("path");
17895
+ import_node_fs46 = require("fs");
17896
+ import_node_path43 = require("path");
17814
17897
  import_node_url3 = require("url");
17815
17898
  init_packaged_runtime();
17816
17899
  import_meta3 = {};
@@ -17968,11 +18051,13 @@ function formatPrGateDirective() {
17968
18051
  }
17969
18052
  function formatProcessGuideDirective(opts) {
17970
18053
  const worktree = opts?.worktreePath?.trim();
17971
- const hasGraphSkill = !!worktree && (0, import_node_fs46.existsSync)((0, import_node_path43.join)(worktree, ".claude/skills/graph-engineering/SKILL.md"));
17972
- const hasReviewSkill = !!worktree && (0, import_node_fs46.existsSync)((0, import_node_path43.join)(worktree, ".claude/skills/review/SKILL.md"));
18054
+ const hasGraphSkill = !!worktree && (0, import_node_fs47.existsSync)((0, import_node_path44.join)(worktree, ".claude/skills/graph-engineering/SKILL.md"));
18055
+ const hasReviewSkill = !!worktree && (0, import_node_fs47.existsSync)((0, import_node_path44.join)(worktree, ".claude/skills/review/SKILL.md"));
18056
+ const hasInstallSkill = !!worktree && (0, import_node_fs47.existsSync)((0, import_node_path44.join)(worktree, ".claude/skills/worktree-install/SKILL.md"));
17973
18057
  return [
17974
18058
  "Process guides (recurring work only):",
17975
18059
  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,
18060
+ hasInstallSkill ? "- After merge-from-main / lockfile change, or a hung `pnpm install`: follow `.claude/skills/worktree-install/SKILL.md` (`/worktree-install`). Use the worktree-local store Sideboard already set; do not share `~/.pnpm-store` across concurrent worktrees." : null,
17976
18061
  "- If this same shape of work will happen again, write `.claude/skills/<kebab-name>/SKILL.md` in this worktree (Claude Code project skill; Sideboard `/name`, Claude Code, and `attach` all load it). Not under `.sideboard/skills/`. Point Codex/OpenCode at it from `AGENTS.md`.",
17977
18062
  hasReviewSkill ? "- Merge-readiness notes go in `.claude/skills/review/SKILL.md` (edit it; do not create another review skill)." : "- Merge-readiness notes go in `.context/review.md` (copied from `.sideboard/review.md` when that file exists). Do not create a review skill.",
17978
18063
  "- Skip a guide for a one-off. If a matching skill exists, follow it. Same miss twice \u2192 edit the skill, do not patch around it."
@@ -18006,12 +18091,12 @@ function formatArtifactDirective() {
18006
18091
  function formatUiReminder() {
18007
18092
  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.";
18008
18093
  }
18009
- var import_node_fs46, import_node_path43, PR_GOAL_RE, GITHUB_TICKET_REF, KEYED_TICKET_REF;
18094
+ var import_node_fs47, import_node_path44, PR_GOAL_RE, GITHUB_TICKET_REF, KEYED_TICKET_REF;
18010
18095
  var init_instructions = __esm({
18011
18096
  "src/agents/instructions.ts"() {
18012
18097
  "use strict";
18013
- import_node_fs46 = require("fs");
18014
- import_node_path43 = require("path");
18098
+ import_node_fs47 = require("fs");
18099
+ import_node_path44 = require("path");
18015
18100
  init_git_auth_mode();
18016
18101
  init_worktree_labels();
18017
18102
  init_detached_job_path();
@@ -18202,40 +18287,40 @@ __export(plan_file_exports, {
18202
18287
  writePlanFile: () => writePlanFile
18203
18288
  });
18204
18289
  function ensureAttachmentsGitignore(worktreePath) {
18205
- const gitignoreAbs = (0, import_node_path44.join)(worktreePath, ATTACHMENTS_DIR, ".gitignore");
18206
- if ((0, import_node_fs47.existsSync)(gitignoreAbs)) return;
18207
- (0, import_node_fs47.mkdirSync)((0, import_node_path44.dirname)(gitignoreAbs), { recursive: true });
18208
- (0, import_node_fs47.writeFileSync)(gitignoreAbs, attachmentsGitignoreBody(), "utf8");
18290
+ const gitignoreAbs = (0, import_node_path45.join)(worktreePath, ATTACHMENTS_DIR, ".gitignore");
18291
+ if ((0, import_node_fs48.existsSync)(gitignoreAbs)) return;
18292
+ (0, import_node_fs48.mkdirSync)((0, import_node_path45.dirname)(gitignoreAbs), { recursive: true });
18293
+ (0, import_node_fs48.writeFileSync)(gitignoreAbs, attachmentsGitignoreBody(), "utf8");
18209
18294
  }
18210
18295
  function planFileAbs(worktreePath) {
18211
- return (0, import_node_path44.join)(worktreePath, PLAN_FILE_REL);
18296
+ return (0, import_node_path45.join)(worktreePath, PLAN_FILE_REL);
18212
18297
  }
18213
18298
  function readTextIfPresent2(abs) {
18214
- if (!(0, import_node_fs47.existsSync)(abs)) return null;
18299
+ if (!(0, import_node_fs48.existsSync)(abs)) return null;
18215
18300
  try {
18216
- const content = (0, import_node_fs47.readFileSync)(abs, "utf8");
18301
+ const content = (0, import_node_fs48.readFileSync)(abs, "utf8");
18217
18302
  return content.trim() ? content : null;
18218
18303
  } catch {
18219
18304
  return null;
18220
18305
  }
18221
18306
  }
18222
18307
  function readPlanFile(worktreePath) {
18223
- return readTextIfPresent2(planFileAbs(worktreePath)) ?? readTextIfPresent2((0, import_node_path44.join)(worktreePath, `${LEGACY_ATTACHMENTS_DIR}/plan.md`)) ?? readTextIfPresent2((0, import_node_path44.join)(worktreePath, LEGACY_PLAN_FILE_REL));
18308
+ 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));
18224
18309
  }
18225
18310
  function writePlanFile(worktreePath, content) {
18226
18311
  ensureAttachmentsGitignore(worktreePath);
18227
18312
  const abs = planFileAbs(worktreePath);
18228
- (0, import_node_fs47.mkdirSync)((0, import_node_path44.dirname)(abs), { recursive: true });
18313
+ (0, import_node_fs48.mkdirSync)((0, import_node_path45.dirname)(abs), { recursive: true });
18229
18314
  const body = content.trimEnd() + (content.endsWith("\n") ? "" : "\n");
18230
- (0, import_node_fs47.writeFileSync)(abs, body, "utf8");
18315
+ (0, import_node_fs48.writeFileSync)(abs, body, "utf8");
18231
18316
  return PLAN_FILE_REL;
18232
18317
  }
18233
- var import_node_fs47, import_node_path44;
18318
+ var import_node_fs48, import_node_path45;
18234
18319
  var init_plan_file = __esm({
18235
18320
  "src/plan/plan-file.ts"() {
18236
18321
  "use strict";
18237
- import_node_fs47 = require("fs");
18238
- import_node_path44 = require("path");
18322
+ import_node_fs48 = require("fs");
18323
+ import_node_path45 = require("path");
18239
18324
  init_workspace_scratch();
18240
18325
  init_plan_present();
18241
18326
  init_plan_present();
@@ -18295,7 +18380,7 @@ function setCaffeinateHoldHooks(next) {
18295
18380
  hooks = next;
18296
18381
  }
18297
18382
  function caffeinateHoldPath() {
18298
- return (0, import_node_path45.join)(appDataDir(), "caffeinate-hold.json");
18383
+ return (0, import_node_path46.join)(appDataDir(), "caffeinate-hold.json");
18299
18384
  }
18300
18385
  function processAlive(pid) {
18301
18386
  if (hooks.processAlive) return hooks.processAlive(pid);
@@ -18329,9 +18414,9 @@ function uniqueIds(ids) {
18329
18414
  }
18330
18415
  function readHold() {
18331
18416
  const path = caffeinateHoldPath();
18332
- if (!(0, import_node_fs48.existsSync)(path)) return null;
18417
+ if (!(0, import_node_fs49.existsSync)(path)) return null;
18333
18418
  try {
18334
- const parsed = JSON.parse((0, import_node_fs48.readFileSync)(path, "utf8"));
18419
+ const parsed = JSON.parse((0, import_node_fs49.readFileSync)(path, "utf8"));
18335
18420
  if (typeof parsed?.pid === "number" && parsed.pid > 0) {
18336
18421
  return {
18337
18422
  pid: parsed.pid,
@@ -18353,7 +18438,7 @@ function writeHold(pid, threadIds) {
18353
18438
  }
18354
18439
  function clearHold() {
18355
18440
  try {
18356
- (0, import_node_fs48.unlinkSync)(caffeinateHoldPath());
18441
+ (0, import_node_fs49.unlinkSync)(caffeinateHoldPath());
18357
18442
  } catch {
18358
18443
  }
18359
18444
  }
@@ -18438,13 +18523,13 @@ function releaseCaffeinateHoldForThread(threadId) {
18438
18523
  }
18439
18524
  return setCaffeinateHold(false, { threadId: id });
18440
18525
  }
18441
- var import_node_child_process4, import_node_fs48, import_node_path45, hooks;
18526
+ var import_node_child_process4, import_node_fs49, import_node_path46, hooks;
18442
18527
  var init_caffeinate_hold = __esm({
18443
18528
  "src/store/caffeinate-hold.ts"() {
18444
18529
  "use strict";
18445
18530
  import_node_child_process4 = require("child_process");
18446
- import_node_fs48 = require("fs");
18447
- import_node_path45 = require("path");
18531
+ import_node_fs49 = require("fs");
18532
+ import_node_path46 = require("path");
18448
18533
  init_paths();
18449
18534
  init_private_file();
18450
18535
  hooks = {};
@@ -18453,7 +18538,7 @@ var init_caffeinate_hold = __esm({
18453
18538
 
18454
18539
  // src/store/schedules.ts
18455
18540
  function schedulesPath() {
18456
- return (0, import_node_path46.join)(appDataDir(), "schedules.json");
18541
+ return (0, import_node_path47.join)(appDataDir(), "schedules.json");
18457
18542
  }
18458
18543
  function parseDurationMs(every) {
18459
18544
  const m = every.trim().match(DURATION_RE);
@@ -18553,9 +18638,9 @@ function normalizeTask(raw) {
18553
18638
  }
18554
18639
  function readAll2() {
18555
18640
  const path = schedulesPath();
18556
- if (!(0, import_node_fs49.existsSync)(path)) return [];
18641
+ if (!(0, import_node_fs50.existsSync)(path)) return [];
18557
18642
  try {
18558
- const parsed = JSON.parse((0, import_node_fs49.readFileSync)(path, "utf8"));
18643
+ const parsed = JSON.parse((0, import_node_fs50.readFileSync)(path, "utf8"));
18559
18644
  if (!Array.isArray(parsed)) return [];
18560
18645
  return parsed.map((row) => {
18561
18646
  try {
@@ -18667,13 +18752,13 @@ function recordScheduleRun(id, result) {
18667
18752
  writeAll2(rows);
18668
18753
  return next;
18669
18754
  }
18670
- var import_node_crypto9, import_node_fs49, import_node_path46, import_croner, DURATION_RE, UNIT_MS;
18755
+ var import_node_crypto9, import_node_fs50, import_node_path47, import_croner, DURATION_RE, UNIT_MS;
18671
18756
  var init_schedules = __esm({
18672
18757
  "src/store/schedules.ts"() {
18673
18758
  "use strict";
18674
18759
  import_node_crypto9 = require("crypto");
18675
- import_node_fs49 = require("fs");
18676
- import_node_path46 = require("path");
18760
+ import_node_fs50 = require("fs");
18761
+ import_node_path47 = require("path");
18677
18762
  import_croner = require("croner");
18678
18763
  init_orchestrator_capable();
18679
18764
  init_paths();
@@ -18815,13 +18900,13 @@ var init_schedule_runner = __esm({
18815
18900
 
18816
18901
  // src/agents/cursor-store.ts
18817
18902
  function cursorSdkStoreDir(threadId) {
18818
- const root = (0, import_node_path47.join)(appDataDir(), CURSOR_SDK_STORE_DIR);
18903
+ const root = (0, import_node_path48.join)(appDataDir(), CURSOR_SDK_STORE_DIR);
18819
18904
  const id = sanitizeCursorStoreSegment(threadId);
18820
18905
  if (!id) return root;
18821
- return (0, import_node_path47.join)(root, "threads", id);
18906
+ return (0, import_node_path48.join)(root, "threads", id);
18822
18907
  }
18823
18908
  function cursorSdkRunsNdjsonPath(threadId) {
18824
- return (0, import_node_path47.join)(cursorSdkStoreDir(threadId), "runs.ndjson");
18909
+ return (0, import_node_path48.join)(cursorSdkStoreDir(threadId), "runs.ndjson");
18825
18910
  }
18826
18911
  function cursorSdkRunsNdjsonSearchPaths(threadId) {
18827
18912
  const scoped = cursorSdkRunsNdjsonPath(threadId);
@@ -18834,11 +18919,11 @@ function cursorSdkRunsNdjsonSearchPaths(threadId) {
18834
18919
  function sanitizeCursorStoreSegment(threadId) {
18835
18920
  return (threadId ?? "").trim().replace(/[^a-zA-Z0-9._-]/g, "_");
18836
18921
  }
18837
- var import_node_path47, CURSOR_SDK_STORE_DIR;
18922
+ var import_node_path48, CURSOR_SDK_STORE_DIR;
18838
18923
  var init_cursor_store = __esm({
18839
18924
  "src/agents/cursor-store.ts"() {
18840
18925
  "use strict";
18841
- import_node_path47 = require("path");
18926
+ import_node_path48 = require("path");
18842
18927
  init_paths();
18843
18928
  CURSOR_SDK_STORE_DIR = "cursor-sdk-store";
18844
18929
  }
@@ -18860,9 +18945,9 @@ function recoverFinishedCursorRun(opts) {
18860
18945
  return best;
18861
18946
  }
18862
18947
  function scanFinishedCursorRuns(runsPath, agentId, startedAfterMs) {
18863
- if (!(0, import_node_fs50.existsSync)(runsPath)) return null;
18948
+ if (!(0, import_node_fs51.existsSync)(runsPath)) return null;
18864
18949
  try {
18865
- const lines = (0, import_node_fs50.readFileSync)(runsPath, "utf8").split("\n");
18950
+ const lines = (0, import_node_fs51.readFileSync)(runsPath, "utf8").split("\n");
18866
18951
  let best = null;
18867
18952
  for (const line of lines) {
18868
18953
  const trimmed = line.trim();
@@ -18888,11 +18973,11 @@ function scanFinishedCursorRuns(runsPath, agentId, startedAfterMs) {
18888
18973
  return null;
18889
18974
  }
18890
18975
  }
18891
- var import_node_fs50;
18976
+ var import_node_fs51;
18892
18977
  var init_cursor_recover = __esm({
18893
18978
  "src/agents/cursor-recover.ts"() {
18894
18979
  "use strict";
18895
- import_node_fs50 = require("fs");
18980
+ import_node_fs51 = require("fs");
18896
18981
  init_cursor_store();
18897
18982
  }
18898
18983
  });
@@ -19024,13 +19109,13 @@ async function startOrchestration(opts) {
19024
19109
  }
19025
19110
  return updated;
19026
19111
  }
19027
- var import_node_events, import_node_fs51, LIVE_TURN_SPAWN_GRACE_MS, STALE_AGENT_PID_WAIT_MS, Orchestrator, singleton;
19112
+ var import_node_events, import_node_fs52, LIVE_TURN_SPAWN_GRACE_MS, STALE_AGENT_PID_WAIT_MS, Orchestrator, singleton;
19028
19113
  var init_orchestrator = __esm({
19029
19114
  "src/orchestrator/orchestrator.ts"() {
19030
19115
  "use strict";
19031
19116
  import_node_events = require("events");
19032
19117
  init_outbound_watch();
19033
- import_node_fs51 = require("fs");
19118
+ import_node_fs52 = require("fs");
19034
19119
  init_error_detail();
19035
19120
  init_run();
19036
19121
  init_stale_lock();
@@ -19203,7 +19288,7 @@ var init_orchestrator = __esm({
19203
19288
  }
19204
19289
  continue;
19205
19290
  }
19206
- if (!(0, import_node_fs51.existsSync)(thread.worktreePath)) {
19291
+ if (!(0, import_node_fs52.existsSync)(thread.worktreePath)) {
19207
19292
  setStatus(thread.id, "broken", "Worktree missing on disk");
19208
19293
  this.emit({ type: "status_changed", threadId: thread.id, status: "broken" });
19209
19294
  continue;
@@ -19748,9 +19833,10 @@ var init_orchestrator = __esm({
19748
19833
  ts: (/* @__PURE__ */ new Date()).toISOString()
19749
19834
  });
19750
19835
  thread = this.requireThread(threadId);
19836
+ const gitPrompt = expandCanonicalGitRequest(prompt);
19751
19837
  const { agentPrompt: expandedPrompt } = expandComposerPrompt(
19752
19838
  thread.worktreePath,
19753
- prompt,
19839
+ gitPrompt,
19754
19840
  {
19755
19841
  attachments: sentAttachments ?? thread.attachments
19756
19842
  }
@@ -19792,13 +19878,13 @@ var init_orchestrator = __esm({
19792
19878
  artifactReminder,
19793
19879
  longRunningReminder
19794
19880
  ].filter(Boolean).join("\n\n") || void 0;
19795
- const prGateDirective = thread.agent !== "brightsy" && !isOrchestratorThread(thread) && mentionsPrGoal(expandedPrompt) ? formatPrGateDirective() : null;
19881
+ const prGateDirective = thread.agent !== "brightsy" && !isOrchestratorThread(thread) && mentionsPrGoal(prompt) ? formatPrGateDirective() : null;
19796
19882
  const agentPrompt = [
19797
19883
  thread.planMode ? PLAN_MODE_INSTRUCTION : null,
19798
19884
  orchestrationReminder,
19799
19885
  prGateDirective,
19800
19886
  slackReplyContext,
19801
- expandCanonicalGitRequest(expandedPrompt)
19887
+ expandedPrompt
19802
19888
  ].filter(Boolean).join("\n\n");
19803
19889
  if (thread.attachments.length > 0) {
19804
19890
  updateThread(threadId, { attachments: [] });
@@ -21093,7 +21179,7 @@ var init_orchestrator = __esm({
21093
21179
  this.emit({ type: "status_changed", threadId: restored2.id, status: restored2.status });
21094
21180
  return restored2;
21095
21181
  }
21096
- if (!(0, import_node_fs51.existsSync)(thread.worktreePath)) {
21182
+ if (!(0, import_node_fs52.existsSync)(thread.worktreePath)) {
21097
21183
  if (isCowboyThread(thread) || isPrimaryCheckoutThread(thread)) {
21098
21184
  throw new Error(
21099
21185
  `Cowboy checkout missing: ${thread.worktreePath}. Re-add the project folder, then restore.`
@@ -21176,7 +21262,7 @@ var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
21176
21262
  var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
21177
21263
  var import_zod8 = require("zod");
21178
21264
  var import_node_crypto12 = require("crypto");
21179
- var import_node_path50 = require("path");
21265
+ var import_node_path51 = require("path");
21180
21266
  init_orchestrator();
21181
21267
  init_worktree();
21182
21268
 
@@ -23768,27 +23854,27 @@ init_gh_errors();
23768
23854
  init_git_auth_mode();
23769
23855
 
23770
23856
  // src/board/load-home-board.ts
23771
- var import_node_fs53 = require("fs");
23772
- var import_node_path49 = require("path");
23857
+ var import_node_fs54 = require("fs");
23858
+ var import_node_path50 = require("path");
23773
23859
  init_worktree();
23774
23860
  init_paths();
23775
23861
 
23776
23862
  // src/board/board-pins.ts
23777
23863
  var import_node_crypto11 = require("crypto");
23778
- var import_node_fs52 = require("fs");
23779
- var import_node_path48 = require("path");
23864
+ var import_node_fs53 = require("fs");
23865
+ var import_node_path49 = require("path");
23780
23866
  init_paths();
23781
23867
  init_home_board();
23782
23868
  var FILE = "home-board-pins.json";
23783
23869
  var VERSION = 1;
23784
23870
  function pinsFile() {
23785
- return (0, import_node_path48.join)(appDataDir(), FILE);
23871
+ return (0, import_node_path49.join)(appDataDir(), FILE);
23786
23872
  }
23787
23873
  function readDisk() {
23788
23874
  const path = pinsFile();
23789
- if (!(0, import_node_fs52.existsSync)(path)) return [];
23875
+ if (!(0, import_node_fs53.existsSync)(path)) return [];
23790
23876
  try {
23791
- const raw = JSON.parse((0, import_node_fs52.readFileSync)(path, "utf8"));
23877
+ const raw = JSON.parse((0, import_node_fs53.readFileSync)(path, "utf8"));
23792
23878
  if (raw?.version !== VERSION || !Array.isArray(raw.items)) return [];
23793
23879
  return raw.items.filter((item) => item?.id && item.kind && item.ref);
23794
23880
  } catch {
@@ -23796,8 +23882,8 @@ function readDisk() {
23796
23882
  }
23797
23883
  }
23798
23884
  function writeDisk(items) {
23799
- (0, import_node_fs52.mkdirSync)(appDataDir(), { recursive: true });
23800
- (0, import_node_fs52.writeFileSync)(pinsFile(), JSON.stringify({ version: VERSION, items }, null, 2), "utf8");
23885
+ (0, import_node_fs53.mkdirSync)(appDataDir(), { recursive: true });
23886
+ (0, import_node_fs53.writeFileSync)(pinsFile(), JSON.stringify({ version: VERSION, items }, null, 2), "utf8");
23801
23887
  }
23802
23888
  function listBoardPins() {
23803
23889
  return readDisk();
@@ -23818,7 +23904,7 @@ function homeBoardWorkspaceKey(workspaces) {
23818
23904
  return workspaces.map((w) => w.path).filter(Boolean).sort().join("\n");
23819
23905
  }
23820
23906
  function cacheFile() {
23821
- return (0, import_node_path49.join)(appDataDir(), "home-board-cache.json");
23907
+ return (0, import_node_path50.join)(appDataDir(), "home-board-cache.json");
23822
23908
  }
23823
23909
  function emptyInputs() {
23824
23910
  return {
@@ -23844,9 +23930,9 @@ function shouldCacheHomeBoardInputs(inputs) {
23844
23930
  }
23845
23931
  function readDiskCache() {
23846
23932
  const path = cacheFile();
23847
- if (!(0, import_node_fs53.existsSync)(path)) return null;
23933
+ if (!(0, import_node_fs54.existsSync)(path)) return null;
23848
23934
  try {
23849
- const raw = JSON.parse((0, import_node_fs53.readFileSync)(path, "utf8"));
23935
+ const raw = JSON.parse((0, import_node_fs54.readFileSync)(path, "utf8"));
23850
23936
  if (raw?.version !== CACHE_VERSION || typeof raw.fetchedAt !== "number") {
23851
23937
  return null;
23852
23938
  }
@@ -23860,8 +23946,8 @@ function readDiskCache() {
23860
23946
  }
23861
23947
  function writeDiskCache(entry) {
23862
23948
  try {
23863
- (0, import_node_fs53.mkdirSync)(appDataDir(), { recursive: true });
23864
- (0, import_node_fs53.writeFileSync)(cacheFile(), JSON.stringify(entry), "utf8");
23949
+ (0, import_node_fs54.mkdirSync)(appDataDir(), { recursive: true });
23950
+ (0, import_node_fs54.writeFileSync)(cacheFile(), JSON.stringify(entry), "utf8");
23865
23951
  } catch {
23866
23952
  }
23867
23953
  }
@@ -24161,7 +24247,7 @@ async function startMcpServer() {
24161
24247
  async () => {
24162
24248
  const threads = orch.getThreads(true);
24163
24249
  const lines = threads.map((t) => {
24164
- const repo = t.repoPath === GLOBAL_WORKSPACE_ID ? "Orchestration" : (0, import_node_path50.basename)(t.repoPath) || t.repoPath;
24250
+ const repo = t.repoPath === GLOBAL_WORKSPACE_ID ? "Orchestration" : (0, import_node_path51.basename)(t.repoPath) || t.repoPath;
24165
24251
  const live = orch.threadLooksLive(t) ? readTurnLive(t.id) : null;
24166
24252
  const parent = t.parentThreadId ? ` parent:${t.parentThreadId.slice(0, 8)}` : "";
24167
24253
  const preview = lastMessagePreview(t.messages, 80);