@sideboard-ai/core 0.1.193 → 0.1.195

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 (51) hide show
  1. package/dist/{abletime-UX53JTIH.js → abletime-HR6P4GJH.js} +3 -3
  2. package/dist/{abletime-QHKWGTBY.js → abletime-JINF5KJV.js} +3 -3
  3. package/dist/agents/cursor-runner.js +2 -2
  4. package/dist/{agents-MN4GSQTL.js → agents-OXDDPH2O.js} +16 -17
  5. package/dist/{agents-OK5VD25T.js → agents-WQL7SZY6.js} +6 -7
  6. package/dist/{app-settings-LO7UFHQ6.js → app-settings-5KHVKJKO.js} +2 -2
  7. package/dist/{app-settings-QYLNKRK4.js → app-settings-J775CYOO.js} +2 -2
  8. package/dist/{branch-prefix-EVW2KHGQ.js → branch-prefix-7DTIUJT2.js} +1 -1
  9. package/dist/{branch-prefix-7F37FIPX.js → branch-prefix-N3KTCRCE.js} +1 -1
  10. package/dist/{chunk-MQC2VA5U.js → chunk-2X6RGKLI.js} +13 -13
  11. package/dist/{chunk-EBPBGQ4P.js → chunk-6H2XPPPR.js} +9 -9
  12. package/dist/{chunk-HIX2VDRE.js → chunk-6YTI2HBG.js} +6 -8
  13. package/dist/{chunk-KORE4WOF.js → chunk-AH6WIBLY.js} +1 -1
  14. package/dist/{chunk-XPKKCFRT.js → chunk-DP4TKAMZ.js} +864 -7
  15. package/dist/{chunk-O4BMPY5Y.js → chunk-E37JHCO3.js} +1 -1
  16. package/dist/{chunk-JTWKGOFI.js → chunk-FJZWM2ON.js} +1 -1
  17. package/dist/{chunk-3DX2T2KR.js → chunk-GFH3QVAV.js} +188 -95
  18. package/dist/{chunk-EQXXGOMD.js → chunk-HAVI6AY3.js} +197 -104
  19. package/dist/{chunk-4OVCJPVI.js → chunk-HZTHWU6A.js} +6 -8
  20. package/dist/{chunk-4QJRH5DL.js → chunk-KTHRWHA3.js} +1 -1
  21. package/dist/{chunk-BIKCWYRP.js → chunk-S4QCBBXS.js} +873 -16
  22. package/dist/{chunk-BWRS6GAS.js → chunk-S5GLSRLP.js} +1 -1
  23. package/dist/{chunk-PE337IM2.js → chunk-SALM35KD.js} +7 -7
  24. package/dist/{chunk-7SNJMKD6.js → chunk-WDRMZKVB.js} +1 -1
  25. package/dist/{connected-teams-SYQQGCXD.js → connected-teams-WK47ATT7.js} +2 -2
  26. package/dist/{coordinator-prompt-WB65HIZ3.js → coordinator-prompt-IX66YUJ2.js} +5 -6
  27. package/dist/{coordinator-prompt-GXJIPWNA.js → coordinator-prompt-LYKS3YNG.js} +4 -5
  28. package/dist/{global-workspace-MMK5UFUZ.js → global-workspace-4QX6UEOY.js} +5 -6
  29. package/dist/{global-workspace-BZ6V6TEX.js → global-workspace-SNJ2Z6SL.js} +4 -5
  30. package/dist/index.cjs +1051 -971
  31. package/dist/index.d.cts +7 -5
  32. package/dist/index.d.ts +7 -5
  33. package/dist/index.js +95 -54
  34. package/dist/mcp/run-stdio.cjs +218 -140
  35. package/dist/mcp/run-stdio.js +67 -26
  36. package/dist/{orchestrator-4KI6VIFG.js → orchestrator-6ESBGMDN.js} +9 -10
  37. package/dist/{orchestrator-SFOT6Q6F.js → orchestrator-EHRFN3Q6.js} +8 -9
  38. package/dist/{workspaces-KPJS7GLY.js → workspaces-URMUVGAQ.js} +5 -6
  39. package/dist/{workspaces-ACMZMKPD.js → workspaces-UTOYGBYB.js} +4 -5
  40. package/dist/{worktree-6IEVF3GN.js → worktree-R43JOR4V.js} +12 -14
  41. package/dist/{worktree-UW6DNBIE.js → worktree-RM6UWNGZ.js} +17 -19
  42. package/package.json +1 -1
  43. package/dist/chunk-64QSHOKV.js +0 -869
  44. package/dist/chunk-ILWQT2UN.js +0 -55
  45. package/dist/chunk-PBEPPXMY.js +0 -57
  46. package/dist/chunk-RCWHL4TK.js +0 -866
  47. package/dist/github-DWROJOB7.js +0 -11
  48. package/dist/github-IIF7AQNO.js +0 -9
  49. package/dist/worktree-labels-3XDS6O3U.js +0 -22
  50. package/dist/worktree-labels-PEDOJBMD.js +0 -24
  51. package/dist/{chunk-7AJ7OZZF.js → chunk-NLHFAMC2.js} +3 -3
@@ -1,3 +1,8 @@
1
+ import {
2
+ extractPresentedPlan,
3
+ readPlanFile,
4
+ writePlanFile
5
+ } from "./chunk-DJU54RYW.js";
1
6
  import {
2
7
  PLAN_MODE_INSTRUCTION,
3
8
  allAdapters,
@@ -19,12 +24,7 @@ import {
19
24
  stripBrightsyNdjsonNoise,
20
25
  sumUsageList,
21
26
  toolDescription
22
- } from "./chunk-MQC2VA5U.js";
23
- import {
24
- extractPresentedPlan,
25
- readPlanFile,
26
- writePlanFile
27
- } from "./chunk-DJU54RYW.js";
27
+ } from "./chunk-2X6RGKLI.js";
28
28
  import {
29
29
  SLACK_REPLY_FORMATTING,
30
30
  addWorkspace,
@@ -47,9 +47,10 @@ import {
47
47
  stageAbsolutePathsAsAttachments,
48
48
  stageBuffersAsAttachments,
49
49
  syncWorkspacesFromThreads
50
- } from "./chunk-4OVCJPVI.js";
50
+ } from "./chunk-HZTHWU6A.js";
51
51
  import {
52
52
  addPrStackLayer,
53
+ allocateTeamName,
53
54
  allocateTeamSlug,
54
55
  canonicalizeRepoPath,
55
56
  commitAll,
@@ -72,11 +73,13 @@ import {
72
73
  getPrStack,
73
74
  initPrStack,
74
75
  isDirty,
76
+ isPlaceholderBranch,
75
77
  isSideboardScratchPath,
76
78
  listWorktrees,
77
79
  markPrReady,
78
80
  mergeAgentGitAuthEnv,
79
81
  mergePr,
82
+ normalizeWorktreePath,
80
83
  originGhRepoEnv,
81
84
  pushBranch,
82
85
  removeWorktree,
@@ -87,8 +90,14 @@ import {
87
90
  resolvePrSelector,
88
91
  resolvePrSelectors,
89
92
  resolveRepoRoot,
90
- withRepoGitLock
91
- } from "./chunk-BIKCWYRP.js";
93
+ takenSlugsFromThread,
94
+ threadDisplayLabel,
95
+ ticketSlugForBranch,
96
+ withRepoGitLock,
97
+ worktreeDisplayLabelForGroup,
98
+ worktreeNameFromPath,
99
+ worktreeSlugForTicket
100
+ } from "./chunk-S4QCBBXS.js";
92
101
  import {
93
102
  ATTACHMENTS_DIR,
94
103
  DETACHED_JOBS_DIR,
@@ -118,15 +127,7 @@ import {
118
127
  shouldRetryFailedAgentTurn,
119
128
  summarizeTurnStderr,
120
129
  turnFailChatText
121
- } from "./chunk-7AJ7OZZF.js";
122
- import {
123
- clearStaleIndexLocks,
124
- enrichPathWithNpmGlobalBin,
125
- ensureAgentPath,
126
- git,
127
- resolveGitDirsForLockRecovery,
128
- run
129
- } from "./chunk-UFHNSFAS.js";
130
+ } from "./chunk-NLHFAMC2.js";
130
131
  import {
131
132
  assertOrchestratorCapableAgent,
132
133
  childEnvWithAppSettings,
@@ -151,14 +152,14 @@ import {
151
152
  saveAppSettings,
152
153
  updateAdvancedSettings,
153
154
  writeSecureJson
154
- } from "./chunk-BWRS6GAS.js";
155
+ } from "./chunk-S5GLSRLP.js";
155
156
  import {
156
157
  stripNestedElectronEnv
157
158
  } from "./chunk-4TR3HZFT.js";
158
159
  import {
159
160
  examplePrefixedBranch,
160
161
  sanitizeGitBranchPrefix
161
- } from "./chunk-7SNJMKD6.js";
162
+ } from "./chunk-WDRMZKVB.js";
162
163
  import {
163
164
  releaseCaffeinateHoldForThread
164
165
  } from "./chunk-4TYXWPAJ.js";
@@ -191,16 +192,13 @@ import {
191
192
  worktreesRoot
192
193
  } from "./chunk-WFUDY6PC.js";
193
194
  import {
194
- allocateTeamName,
195
- isPlaceholderBranch,
196
- normalizeWorktreePath,
197
- takenSlugsFromThread,
198
- threadDisplayLabel,
199
- ticketSlugForBranch,
200
- worktreeDisplayLabelForGroup,
201
- worktreeNameFromPath,
202
- worktreeSlugForTicket
203
- } from "./chunk-RCWHL4TK.js";
195
+ clearStaleIndexLocks,
196
+ enrichPathWithNpmGlobalBin,
197
+ ensureAgentPath,
198
+ git,
199
+ resolveGitDirsForLockRecovery,
200
+ run
201
+ } from "./chunk-UFHNSFAS.js";
204
202
 
205
203
  // src/orchestrator/orchestrator.ts
206
204
  import { EventEmitter } from "events";
@@ -473,7 +471,7 @@ async function continueSourceThread(threadId, prompt) {
473
471
  await continueOnReply(threadId, prompt);
474
472
  return;
475
473
  }
476
- const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-4KI6VIFG.js");
474
+ const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-6ESBGMDN.js");
477
475
  await getOrchestrator2().send(threadId, prompt);
478
476
  } catch {
479
477
  }
@@ -807,9 +805,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
807
805
  `Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
808
806
  );
809
807
  }
810
- const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-MMK5UFUZ.js");
808
+ const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-4QX6UEOY.js");
811
809
  if (isGlobalThread2(thread)) {
812
- const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-WB65HIZ3.js");
810
+ const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-IX66YUJ2.js");
813
811
  ensureGlobalCoordinatorCwd2(
814
812
  isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
815
813
  );
@@ -1477,6 +1475,53 @@ async function maybeCompactContext(thread, thresholds = {}, summarize = summariz
1477
1475
  };
1478
1476
  }
1479
1477
 
1478
+ // src/threads/worktree-runtime.ts
1479
+ function worktreeProcessPrefix(worktreePath) {
1480
+ return `wt:${normalizeWorktreePath(worktreePath)}`;
1481
+ }
1482
+ function worktreeSetupProcessKey(worktreePath) {
1483
+ return `${worktreeProcessPrefix(worktreePath)}:setup`;
1484
+ }
1485
+ function worktreeRunProcessKey(worktreePath, scriptName) {
1486
+ return `${worktreeProcessPrefix(worktreePath)}:run:${scriptName}`;
1487
+ }
1488
+ function worktreeDevProcessKey(worktreePath) {
1489
+ return `${worktreeProcessPrefix(worktreePath)}:dev`;
1490
+ }
1491
+ function isWorktreeRunProcessKey(key, worktreePath) {
1492
+ const prefix = worktreeProcessPrefix(worktreePath);
1493
+ return key.startsWith(`${prefix}:run:`) || key === `${prefix}:dev`;
1494
+ }
1495
+ function pickRichestSetupLog(snaps) {
1496
+ let best;
1497
+ for (const snap of snaps) {
1498
+ if (!snap.output && !snap.running && snap.exitCode == null) continue;
1499
+ if (!best) {
1500
+ best = snap;
1501
+ continue;
1502
+ }
1503
+ if (snap.running && !best.running) {
1504
+ best = snap;
1505
+ continue;
1506
+ }
1507
+ if (snap.running === best.running && snap.output.length > best.output.length) {
1508
+ best = snap;
1509
+ }
1510
+ }
1511
+ return best;
1512
+ }
1513
+ function mergeWorktreeActiveRuns(threads) {
1514
+ const byName = /* @__PURE__ */ new Map();
1515
+ let devPort = null;
1516
+ for (const thread of threads) {
1517
+ if (thread.devPort != null && devPort == null) devPort = thread.devPort;
1518
+ for (const run2 of thread.activeRuns ?? []) {
1519
+ if (!byName.has(run2.scriptName)) byName.set(run2.scriptName, run2);
1520
+ }
1521
+ }
1522
+ return { activeRuns: [...byName.values()], devPort };
1523
+ }
1524
+
1480
1525
  // src/threads/chat-tabs.ts
1481
1526
  function sameWorktreePath(a, b) {
1482
1527
  return normalizeWorktreePath(a) === normalizeWorktreePath(b);
@@ -1573,7 +1618,8 @@ function createChatTab(input) {
1573
1618
  planMode: from.planMode,
1574
1619
  autonomy: input.autonomy ?? from.autonomy,
1575
1620
  attachments: input.attachments ?? [],
1576
- status: "idle"
1621
+ status: "idle",
1622
+ ...mergeWorktreeActiveRuns(threadsSharingWorktree(binding.worktreePath))
1577
1623
  });
1578
1624
  writeThread(thread);
1579
1625
  return thread;
@@ -2246,6 +2292,7 @@ async function startDevServer(repoPath, worktreePath, onLine, opts) {
2246
2292
  }
2247
2293
 
2248
2294
  // src/store/setup-log.ts
2295
+ import { createHash } from "crypto";
2249
2296
  import { existsSync as existsSync6, readFileSync as readFileSync5, writeFileSync as writeFileSync2 } from "fs";
2250
2297
  import { join as join7 } from "path";
2251
2298
  var EMPTY = {
@@ -2259,6 +2306,10 @@ var persistTimers = /* @__PURE__ */ new Map();
2259
2306
  function setupLogPath(threadId) {
2260
2307
  return join7(threadsDir(), `${threadId}.setup.log.json`);
2261
2308
  }
2309
+ function setupLogKeyForWorktree(worktreePath) {
2310
+ const norm = normalizeWorktreePath(worktreePath);
2311
+ return `wt-${createHash("sha1").update(norm).digest("hex").slice(0, 16)}`;
2312
+ }
2262
2313
  function emptySetupLog() {
2263
2314
  return { ...EMPTY };
2264
2315
  }
@@ -3659,7 +3710,7 @@ async function createThread(input, _onSetupLine) {
3659
3710
  });
3660
3711
  await requireAgent(resolved.agent);
3661
3712
  if (input.cowboy) {
3662
- const { cowboyModeEnabled } = await import("./app-settings-LO7UFHQ6.js");
3713
+ const { cowboyModeEnabled } = await import("./app-settings-5KHVKJKO.js");
3663
3714
  if (!cowboyModeEnabled()) {
3664
3715
  throw new Error(
3665
3716
  "Cowboy mode is off. Enable it in Settings \u2192 Advanced."
@@ -3717,7 +3768,7 @@ async function createThread(input, _onSetupLine) {
3717
3768
  let sourceIsFork = false;
3718
3769
  if (!input.cowboy && sourceType === "branch" && (!sourceRef || sourceRef === "HEAD" || sourceRef === "default")) {
3719
3770
  if (isAbleTimeConnected() && getIssueSource() === "abletime") {
3720
- const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-QHKWGTBY.js");
3771
+ const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-JINF5KJV.js");
3721
3772
  const task = await ensureAbleTimeTask({
3722
3773
  title: title?.trim() || "Untitled work",
3723
3774
  description: input.prompt?.trim() || void 0
@@ -3819,7 +3870,7 @@ async function createThread(input, _onSetupLine) {
3819
3870
  return readThread(thread.id) ?? thread;
3820
3871
  }
3821
3872
  async function listLinearIssues(agent, repoPath) {
3822
- const { getAdapter: getAdapter2 } = await import("./agents-MN4GSQTL.js");
3873
+ const { getAdapter: getAdapter2 } = await import("./agents-OXDDPH2O.js");
3823
3874
  await requireAgent(agent, { requireLinear: true });
3824
3875
  const adapter = getAdapter2(agent);
3825
3876
  if (!adapter.listLinearIssues) {
@@ -4241,7 +4292,7 @@ async function adoptThread(input) {
4241
4292
  messages: input.messages ?? []
4242
4293
  });
4243
4294
  writeThread(thread);
4244
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-KPJS7GLY.js");
4295
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-URMUVGAQ.js");
4245
4296
  await ensureWorkspace2(repoPath);
4246
4297
  const { ensureWorktreeSideboardIgnored: ensureWorktreeSideboardIgnored2 } = await import("./worktree-exclude-X54WSOXM.js");
4247
4298
  await ensureWorktreeSideboardIgnored2(input.worktreePath);
@@ -6825,7 +6876,7 @@ function formatScheduledPrompt(name, prompt) {
6825
6876
  ${prompt}`;
6826
6877
  }
6827
6878
  async function defaultDeps() {
6828
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-4KI6VIFG.js");
6879
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-6ESBGMDN.js");
6829
6880
  const orch = getOrchestrator2();
6830
6881
  return {
6831
6882
  findThread: (id) => findThreadByRef(id),
@@ -7100,7 +7151,7 @@ var Orchestrator = class {
7100
7151
  orphans: orphans.map((o) => ({ path: o.path, repoPath: o.repoPath }))
7101
7152
  });
7102
7153
  }
7103
- const { autoCleanupOrphansEnabled } = await import("./app-settings-LO7UFHQ6.js");
7154
+ const { autoCleanupOrphansEnabled } = await import("./app-settings-5KHVKJKO.js");
7104
7155
  if (autoCleanupOrphansEnabled() && shouldRunWorktreeCleanup() && orphans.length > 0) {
7105
7156
  await cleanupOrphanWorktrees({ repoPaths });
7106
7157
  }
@@ -7379,7 +7430,7 @@ var Orchestrator = class {
7379
7430
  }
7380
7431
  await setup;
7381
7432
  if (skipSetup) return;
7382
- const { autoRunAfterSetupEnabled } = await import("./app-settings-LO7UFHQ6.js");
7433
+ const { autoRunAfterSetupEnabled } = await import("./app-settings-5KHVKJKO.js");
7383
7434
  if (autoRunAfterSetupEnabled()) {
7384
7435
  try {
7385
7436
  await this.startDev(threadId);
@@ -7702,7 +7753,7 @@ var Orchestrator = class {
7702
7753
  }
7703
7754
  const isBrightsy = fresh.agent === "brightsy";
7704
7755
  const isOrchestration = isOrchestratorThread(fresh);
7705
- const { autoRenameBranchEnabled, getGithubGitAuthMode, gitBranchPrefixSetting } = await import("./app-settings-LO7UFHQ6.js");
7756
+ const { autoRenameBranchEnabled, getGithubGitAuthMode, gitBranchPrefixSetting } = await import("./app-settings-5KHVKJKO.js");
7706
7757
  const gitAuthMode = getGithubGitAuthMode();
7707
7758
  const worktreeDirective = isBrightsy || isOrchestration ? null : formatWorktreeDirective(fresh, {
7708
7759
  githubSlug: await resolveGithubRepoSlug(fresh.worktreePath).catch(
@@ -7740,21 +7791,11 @@ var Orchestrator = class {
7740
7791
  const settings = loadWorkspaceSettings(fresh.worktreePath, fresh.repoPath);
7741
7792
  let renameBranchDirective = null;
7742
7793
  if (!isBrightsy && !isOrchestration && autoRenameBranchEnabled()) {
7743
- const { isPlaceholderBranch: isPlaceholderBranch2 } = await import("./worktree-labels-3XDS6O3U.js");
7744
- let githubLogin = null;
7745
- if (isPlaceholderBranch2(fresh.branchName, fresh.worktreePath) && !gitBranchPrefixSetting()) {
7746
- try {
7747
- const { getGitHubStatus } = await import("./github-IIF7AQNO.js");
7748
- githubLogin = (await getGitHubStatus()).login;
7749
- } catch {
7750
- }
7751
- }
7752
- const { resolveGitBranchPrefix } = await import("./branch-prefix-7F37FIPX.js");
7794
+ const { resolveGitBranchPrefix } = await import("./branch-prefix-N3KTCRCE.js");
7753
7795
  renameBranchDirective = formatRenameBranchDirective(fresh, {
7754
7796
  customPrompt: settings?.prompts?.renameBranch,
7755
7797
  branchPrefix: resolveGitBranchPrefix({
7756
- setting: gitBranchPrefixSetting(),
7757
- githubLogin
7798
+ setting: gitBranchPrefixSetting()
7758
7799
  })
7759
7800
  });
7760
7801
  }
@@ -8117,22 +8158,25 @@ var Orchestrator = class {
8117
8158
  "No run script found for this worktree. Add [scripts.run.*] in the worktree\u2019s .sideboard/settings.toml or .conductor/settings.toml (or settings.local.toml on the main repo)."
8118
8159
  );
8119
8160
  }
8120
- const runKey = `${thread.id}:run:${resolvedName}`;
8121
- const existing = this.processes.get(runKey);
8122
- const active = (thread.activeRuns ?? []).find((r) => r.scriptName === resolvedName);
8161
+ const siblings = threadsSharingWorktree(thread.worktreePath);
8162
+ const shared = mergeWorktreeActiveRuns(siblings);
8163
+ const runKey = worktreeRunProcessKey(thread.worktreePath, resolvedName);
8164
+ const existing = this.processes.get(runKey) ?? siblings.map((t) => this.processes.get(`${t.id}:run:${resolvedName}`)).find(Boolean);
8165
+ const active = shared.activeRuns.find((r) => r.scriptName === resolvedName);
8123
8166
  if (existing && active) {
8124
8167
  return { port: active.port, scriptName: resolvedName, ports: active.ports };
8125
8168
  }
8126
8169
  if (!scriptName) {
8127
- const legacy = this.processes.get(`${thread.id}:dev`);
8128
- if (legacy && thread.devPort) {
8129
- return { port: thread.devPort, scriptName: resolvedName, ports: [thread.devPort] };
8170
+ const legacy = this.processes.get(worktreeDevProcessKey(thread.worktreePath)) ?? siblings.map((t) => this.processes.get(`${t.id}:dev`)).find(Boolean);
8171
+ if (legacy && shared.devPort) {
8172
+ return { port: shared.devPort, scriptName: resolvedName, ports: [shared.devPort] };
8130
8173
  }
8131
8174
  }
8132
8175
  const mode = getRunMode(thread.worktreePath, thread.repoPath);
8133
8176
  if (mode === "nonconcurrent") {
8177
+ const here = normalizeWorktreePath(thread.worktreePath);
8134
8178
  for (const t of listThreads()) {
8135
- if (t.id === thread.id) continue;
8179
+ if (normalizeWorktreePath(t.worktreePath) === here) continue;
8136
8180
  const runs = t.activeRuns ?? [];
8137
8181
  if (runs.length > 0 || t.devPort) {
8138
8182
  throw new Error(
@@ -8167,7 +8211,7 @@ var Orchestrator = class {
8167
8211
  });
8168
8212
  const isDefault = scripts.find((s) => s.default)?.name === resolvedName || !scripts.some((s) => s.default) && (resolvedName === "dev" || resolvedName === scripts[0]?.name);
8169
8213
  if (isDefault) {
8170
- this.processes.set(`${thread.id}:dev`, {
8214
+ this.processes.set(worktreeDevProcessKey(thread.worktreePath), {
8171
8215
  kind: "dev",
8172
8216
  pid: handle.pid,
8173
8217
  startedAt,
@@ -8182,13 +8226,14 @@ var Orchestrator = class {
8182
8226
  startedAt
8183
8227
  };
8184
8228
  const nextRuns = [
8185
- ...(thread.activeRuns ?? []).filter((r) => r.scriptName !== resolvedName),
8229
+ ...shared.activeRuns.filter((r) => r.scriptName !== resolvedName),
8186
8230
  run2
8187
8231
  ];
8188
- updateThread(thread.id, {
8189
- activeRuns: nextRuns,
8190
- devPort: isDefault ? handle.port : thread.devPort
8191
- });
8232
+ this.syncWorktreeRuns(
8233
+ thread.worktreePath,
8234
+ nextRuns,
8235
+ isDefault ? handle.port : shared.devPort
8236
+ );
8192
8237
  this.emit({
8193
8238
  type: "dev_server_started",
8194
8239
  threadId: thread.id,
@@ -8197,15 +8242,14 @@ var Orchestrator = class {
8197
8242
  });
8198
8243
  void handle.done.then(() => {
8199
8244
  this.processes.delete(runKey);
8200
- if (isDefault) this.processes.delete(`${thread.id}:dev`);
8201
- const latest = readThread(thread.id);
8202
- const remaining = (latest?.activeRuns ?? []).filter(
8203
- (r) => r.scriptName !== resolvedName
8245
+ if (isDefault) this.processes.delete(worktreeDevProcessKey(thread.worktreePath));
8246
+ const latest = mergeWorktreeActiveRuns(threadsSharingWorktree(thread.worktreePath));
8247
+ const remaining = latest.activeRuns.filter((r) => r.scriptName !== resolvedName);
8248
+ this.syncWorktreeRuns(
8249
+ thread.worktreePath,
8250
+ remaining,
8251
+ isDefault ? null : latest.devPort
8204
8252
  );
8205
- updateThread(thread.id, {
8206
- activeRuns: remaining,
8207
- devPort: isDefault ? null : latest?.devPort ?? null
8208
- });
8209
8253
  this.emit({
8210
8254
  type: "dev_server_stopped",
8211
8255
  threadId: thread.id,
@@ -8216,51 +8260,82 @@ var Orchestrator = class {
8216
8260
  }
8217
8261
  stopDev(threadRef, scriptName) {
8218
8262
  const thread = this.requireThread(threadRef);
8263
+ const siblings = threadsSharingWorktree(thread.worktreePath);
8264
+ const shared = mergeWorktreeActiveRuns(siblings);
8219
8265
  if (scriptName) {
8220
- const runKey = `${thread.id}:run:${scriptName}`;
8221
- const proc = this.processes.get(runKey);
8222
- if (proc) proc.kill();
8223
- this.processes.delete(runKey);
8224
- const remaining = (thread.activeRuns ?? []).filter((r) => r.scriptName !== scriptName);
8225
- const isPrimary = thread.devPort != null && thread.activeRuns?.find((r) => r.scriptName === scriptName)?.port === thread.devPort;
8226
- updateThread(thread.id, {
8227
- activeRuns: remaining,
8228
- devPort: isPrimary ? null : thread.devPort
8229
- });
8266
+ const keys = [
8267
+ worktreeRunProcessKey(thread.worktreePath, scriptName),
8268
+ ...siblings.map((t) => `${t.id}:run:${scriptName}`)
8269
+ ];
8270
+ for (const key of keys) {
8271
+ const proc = this.processes.get(key);
8272
+ if (proc) proc.kill();
8273
+ this.processes.delete(key);
8274
+ }
8275
+ const remaining = shared.activeRuns.filter((r) => r.scriptName !== scriptName);
8276
+ const isPrimary = shared.devPort != null && shared.activeRuns.find((r) => r.scriptName === scriptName)?.port === shared.devPort;
8277
+ this.syncWorktreeRuns(
8278
+ thread.worktreePath,
8279
+ remaining,
8280
+ isPrimary ? null : shared.devPort
8281
+ );
8230
8282
  this.emit({ type: "dev_server_stopped", threadId: thread.id, scriptName });
8231
8283
  return;
8232
8284
  }
8233
8285
  for (const [key, proc] of [...this.processes.entries()]) {
8234
- if (key.startsWith(`${thread.id}:run:`) || key === `${thread.id}:dev`) {
8286
+ if (isWorktreeRunProcessKey(key, thread.worktreePath) || siblings.some((t) => key.startsWith(`${t.id}:run:`) || key === `${t.id}:dev`)) {
8235
8287
  proc.kill();
8236
8288
  this.processes.delete(key);
8237
8289
  }
8238
8290
  }
8239
- updateThread(thread.id, { activeRuns: [], devPort: null });
8291
+ this.syncWorktreeRuns(thread.worktreePath, [], null);
8240
8292
  this.emit({ type: "dev_server_stopped", threadId: thread.id });
8241
8293
  }
8294
+ syncWorktreeRuns(worktreePath, activeRuns, devPort) {
8295
+ for (const sibling of threadsSharingWorktree(worktreePath)) {
8296
+ updateThread(sibling.id, { activeRuns, devPort });
8297
+ }
8298
+ }
8242
8299
  listThreadRunScripts(threadRef) {
8243
8300
  const thread = this.requireThread(threadRef);
8244
8301
  return listRunScripts(thread.worktreePath, thread.repoPath);
8245
8302
  }
8246
8303
  getActiveRuns(threadRef) {
8247
- return this.requireThread(threadRef).activeRuns ?? [];
8304
+ const thread = this.requireThread(threadRef);
8305
+ return mergeWorktreeActiveRuns(threadsSharingWorktree(thread.worktreePath)).activeRuns;
8248
8306
  }
8249
8307
  getSetupLog(threadRef) {
8250
8308
  const thread = this.getThread(threadRef);
8251
8309
  if (!thread) return readSetupLog(threadRef);
8252
- const snap = readSetupLog(thread.id);
8253
- if (snap.running && !this.processes.has(`${thread.id}:setup`)) {
8310
+ const siblingIds = [
8311
+ thread.id,
8312
+ ...threadsSharingWorktree(thread.worktreePath).map((t) => t.id)
8313
+ ];
8314
+ const snap = pickRichestSetupLog([
8315
+ readSetupLog(setupLogKeyForWorktree(thread.worktreePath)),
8316
+ ...[...new Set(siblingIds)].map((id) => readSetupLog(id))
8317
+ ]) ?? readSetupLog(thread.id);
8318
+ if (snap.running && !this.hasWorktreeSetupProcess(thread.worktreePath)) {
8254
8319
  return { ...snap, running: false };
8255
8320
  }
8256
8321
  return snap;
8257
8322
  }
8323
+ hasWorktreeSetupProcess(worktreePath) {
8324
+ if (this.processes.has(worktreeSetupProcessKey(worktreePath))) return true;
8325
+ return threadsSharingWorktree(worktreePath).some(
8326
+ (t) => this.processes.has(`${t.id}:setup`)
8327
+ );
8328
+ }
8329
+ writeSetupLog(threadId, worktreePath, fn) {
8330
+ fn(setupLogKeyForWorktree(worktreePath));
8331
+ fn(threadId);
8332
+ }
8258
8333
  async runSetup(threadRef, opts) {
8259
8334
  const thread = this.requireThread(threadRef);
8260
8335
  this.assertNotGlobal(thread, "Setup");
8261
- const key = `${thread.id}:setup`;
8262
- if (this.processes.has(key)) {
8263
- throw new Error("Setup already running for this thread");
8336
+ const key = worktreeSetupProcessKey(thread.worktreePath);
8337
+ if (this.hasWorktreeSetupProcess(thread.worktreePath)) {
8338
+ throw new Error("Setup already running for this worktree");
8264
8339
  }
8265
8340
  const abort = new AbortController();
8266
8341
  this.processes.set(key, {
@@ -8268,13 +8343,17 @@ var Orchestrator = class {
8268
8343
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
8269
8344
  kill: () => abort.abort()
8270
8345
  });
8271
- beginSetupLog(thread.id);
8346
+ this.writeSetupLog(thread.id, thread.worktreePath, beginSetupLog);
8272
8347
  this.emit({ type: "setup_started", threadId: thread.id });
8273
8348
  let finished = false;
8274
8349
  const finish = (exitCode, source) => {
8275
8350
  if (finished) return;
8276
8351
  finished = true;
8277
- finishSetupLog(thread.id, exitCode, source);
8352
+ this.writeSetupLog(
8353
+ thread.id,
8354
+ thread.worktreePath,
8355
+ (logKey) => finishSetupLog(logKey, exitCode, source)
8356
+ );
8278
8357
  this.emit({ type: "setup_finished", threadId: thread.id, exitCode });
8279
8358
  };
8280
8359
  try {
@@ -8282,14 +8361,22 @@ var Orchestrator = class {
8282
8361
  thread.repoPath,
8283
8362
  thread.worktreePath,
8284
8363
  (line) => {
8285
- appendSetupLog(thread.id, line);
8364
+ this.writeSetupLog(
8365
+ thread.id,
8366
+ thread.worktreePath,
8367
+ (logKey) => appendSetupLog(logKey, line)
8368
+ );
8286
8369
  this.emit({ type: "setup_output", threadId: thread.id, line });
8287
8370
  },
8288
8371
  { signal: abort.signal }
8289
8372
  );
8290
8373
  if (!setup.ran) {
8291
8374
  const line = "No setup script in .sideboard/settings.toml, .conductor/settings.toml, .cursor/worktrees.json, or script/setup (bin/setup, scripts/setup)";
8292
- appendSetupLog(thread.id, line);
8375
+ this.writeSetupLog(
8376
+ thread.id,
8377
+ thread.worktreePath,
8378
+ (logKey) => appendSetupLog(logKey, line)
8379
+ );
8293
8380
  this.emit({ type: "setup_output", threadId: thread.id, line });
8294
8381
  finish(null, null);
8295
8382
  throw new Error(line);
@@ -8317,8 +8404,14 @@ var Orchestrator = class {
8317
8404
  }
8318
8405
  cancelSetup(threadRef) {
8319
8406
  const thread = this.requireThread(threadRef);
8320
- const proc = this.processes.get(`${thread.id}:setup`);
8321
- if (proc) proc.kill();
8407
+ const keys = [
8408
+ worktreeSetupProcessKey(thread.worktreePath),
8409
+ ...threadsSharingWorktree(thread.worktreePath).map((t) => `${t.id}:setup`)
8410
+ ];
8411
+ for (const key of [...new Set(keys)]) {
8412
+ const proc = this.processes.get(key);
8413
+ if (proc) proc.kill();
8414
+ }
8322
8415
  }
8323
8416
  async applyIntoMain(threadRef, opts) {
8324
8417
  const thread = this.requireThread(threadRef);
@@ -8645,7 +8738,7 @@ var Orchestrator = class {
8645
8738
  updateThread(thread.id, { title: meta.title });
8646
8739
  }
8647
8740
  }
8648
- const { autoArchiveOnMergeEnabled } = await import("./app-settings-LO7UFHQ6.js");
8741
+ const { autoArchiveOnMergeEnabled } = await import("./app-settings-5KHVKJKO.js");
8649
8742
  const latest = this.requireThread(thread.id);
8650
8743
  if (!shouldAutoArchiveOnPrMerge({
8651
8744
  previousPrState: prevState || null,
@@ -8937,7 +9030,7 @@ var Orchestrator = class {
8937
9030
  this.emit({ type: "status_changed", threadId: archived.id, status: "archived" });
8938
9031
  if (thread.repoPath && !isGlobalRepoPath(thread.repoPath)) {
8939
9032
  try {
8940
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-KPJS7GLY.js");
9033
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-URMUVGAQ.js");
8941
9034
  await ensureWorkspace2(thread.repoPath);
8942
9035
  } catch {
8943
9036
  }
@@ -8964,7 +9057,7 @@ var Orchestrator = class {
8964
9057
  await runArchiveScript(thread.repoPath, thread.worktreePath);
8965
9058
  } catch {
8966
9059
  }
8967
- const { deleteBranchOnPurgeEnabled } = await import("./app-settings-LO7UFHQ6.js");
9060
+ const { deleteBranchOnPurgeEnabled } = await import("./app-settings-5KHVKJKO.js");
8968
9061
  const deleteBranch = opts?.deleteBranch ?? deleteBranchOnPurgeEnabled();
8969
9062
  await removeWorktree(thread.repoPath, thread.worktreePath, {
8970
9063
  deleteBranch: deleteBranch ? thread.branchName : void 0
@@ -8991,7 +9084,7 @@ var Orchestrator = class {
8991
9084
  `Cowboy checkout missing: ${thread.worktreePath}. Re-add the project folder, then restore.`
8992
9085
  );
8993
9086
  }
8994
- const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-UW6DNBIE.js");
9087
+ const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-RM6UWNGZ.js");
8995
9088
  const slug = thread.worktreePath.split("/").pop();
8996
9089
  const dest = thread.worktreePath;
8997
9090
  await withRepoGitLock(thread.repoPath, async () => {
@@ -9101,7 +9194,7 @@ async function startOrchestration(opts) {
9101
9194
  sourceRef: "default",
9102
9195
  ...createOpts
9103
9196
  }).catch(async () => {
9104
- const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-UW6DNBIE.js");
9197
+ const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-RM6UWNGZ.js");
9105
9198
  const repo = await resolveRepoRoot2(repoPath);
9106
9199
  const def = await resolveDefaultBranch2(repo);
9107
9200
  return orch.createThread({
@@ -1,8 +1,11 @@
1
1
  import {
2
+ allocateTeamName,
2
3
  ensureGhPreferOrigin,
3
4
  resolveGithubRepoSlug,
4
- resolveRepoRoot
5
- } from "./chunk-BIKCWYRP.js";
5
+ resolveRepoRoot,
6
+ takenSlugsFromThread,
7
+ teamSlugFromName
8
+ } from "./chunk-S4QCBBXS.js";
6
9
  import {
7
10
  ATTACHMENTS_DIR,
8
11
  attachmentsGitignoreBody
@@ -19,7 +22,7 @@ import {
19
22
  resolveThreadDefaults,
20
23
  resolveViewerProfile,
21
24
  resolveViewerProfileForRepo
22
- } from "./chunk-BWRS6GAS.js";
25
+ } from "./chunk-S5GLSRLP.js";
23
26
  import {
24
27
  createEmptyThread,
25
28
  listThreads,
@@ -31,11 +34,6 @@ import {
31
34
  globalAgentCwd,
32
35
  sideboardReposDir
33
36
  } from "./chunk-WFUDY6PC.js";
34
- import {
35
- allocateTeamName,
36
- takenSlugsFromThread,
37
- teamSlugFromName
38
- } from "./chunk-RCWHL4TK.js";
39
37
 
40
38
  // src/store/workspaces.ts
41
39
  import { existsSync as existsSync2, mkdirSync as mkdirSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
@@ -8,7 +8,7 @@ import {
8
8
  getAbleTimeHost,
9
9
  isAbleTimeConnected,
10
10
  saveAbleTimeConnection
11
- } from "./chunk-KORE4WOF.js";
11
+ } from "./chunk-AH6WIBLY.js";
12
12
 
13
13
  // src/integrations/abletime-mcp.ts
14
14
  var DEFAULT_ABLETIME_HOST = "https://track.abletime.com";