@sideboard-ai/core 0.1.227 → 0.1.229

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/{abletime-D6773P33.js → abletime-BGVOCEOU.js} +4 -4
  2. package/dist/{abletime-BF253OZT.js → abletime-WZNDTRVL.js} +4 -4
  3. package/dist/{abletime-oauth-KQPVVBKA.js → abletime-oauth-6M5GWEPX.js} +3 -3
  4. package/dist/{abletime-oauth-H4672PRH.js → abletime-oauth-ZLU2EYRK.js} +3 -3
  5. package/dist/{abletime-rest-DAFPXZ7H.js → abletime-rest-F7XG5NGY.js} +3 -3
  6. package/dist/{abletime-rest-OPEVV3XC.js → abletime-rest-WNHIATB3.js} +3 -3
  7. package/dist/{agents-DV5UROWB.js → agents-B7G4BQTS.js} +4 -4
  8. package/dist/{agents-QQ77D7VT.js → agents-ZKP7QNXA.js} +4 -4
  9. package/dist/{app-settings-5RQMQKSB.js → app-settings-KBL2G7M4.js} +7 -1
  10. package/dist/{app-settings-V2BBCX2H.js → app-settings-UXWCPDEA.js} +7 -1
  11. package/dist/{chunk-FUDJ6NFM.js → chunk-6HKGCUDN.js} +117 -62
  12. package/dist/{chunk-N2VST3NL.js → chunk-7YKXBFQE.js} +2 -2
  13. package/dist/{chunk-KTZESHYH.js → chunk-AMMRFFB7.js} +1 -1
  14. package/dist/{chunk-HSYE5ID6.js → chunk-AS4UN7QL.js} +5 -5
  15. package/dist/{chunk-3NWUHXU3.js → chunk-C774RJJA.js} +3 -3
  16. package/dist/{chunk-NFWPDEN4.js → chunk-F3GT6DQW.js} +1 -1
  17. package/dist/{chunk-CLI5DVU4.js → chunk-GHRZNPBK.js} +2 -2
  18. package/dist/{chunk-EWHJNJHV.js → chunk-I5NC7DWO.js} +38 -0
  19. package/dist/{chunk-VUW3VKLW.js → chunk-LULHFLPU.js} +17 -4
  20. package/dist/{chunk-646I442S.js → chunk-MVLXDYN5.js} +5 -5
  21. package/dist/{chunk-P2EAAM3H.js → chunk-N7UXGM3Y.js} +2 -2
  22. package/dist/{chunk-RRW2XWAY.js → chunk-P6ZM5QJW.js} +2 -2
  23. package/dist/{chunk-THLVCXLF.js → chunk-RGNPPRZZ.js} +3 -3
  24. package/dist/{chunk-Y5JES2VV.js → chunk-RZTRWN2V.js} +38 -0
  25. package/dist/{chunk-SOGGKYFV.js → chunk-SWNEA5OZ.js} +3 -3
  26. package/dist/{chunk-SQHRPJ7P.js → chunk-T7Y5ULHM.js} +14 -4
  27. package/dist/{chunk-I2HOATRJ.js → chunk-UHT6OS7V.js} +129 -62
  28. package/dist/{coordinator-prompt-JLMQVORO.js → coordinator-prompt-DZMMCDRW.js} +3 -3
  29. package/dist/{coordinator-prompt-VZ7OSRLD.js → coordinator-prompt-RL3GKIAQ.js} +3 -3
  30. package/dist/{global-workspace-QPSJEXGR.js → global-workspace-G3QEVRGZ.js} +3 -3
  31. package/dist/{global-workspace-3FDAUNN2.js → global-workspace-QW4OXCLJ.js} +3 -3
  32. package/dist/index.cjs +927 -658
  33. package/dist/index.d.cts +89 -3
  34. package/dist/index.d.ts +89 -3
  35. package/dist/index.js +206 -67
  36. package/dist/mcp/run-stdio.cjs +224 -84
  37. package/dist/mcp/run-stdio.js +86 -50
  38. package/dist/{orchestrator-CWOSAYAE.js → orchestrator-GKAHLGXT.js} +5 -5
  39. package/dist/{orchestrator-VKPHI64Q.js → orchestrator-X4VFA5WW.js} +5 -5
  40. package/dist/{workspaces-76W7IEKR.js → workspaces-77C5XQEY.js} +3 -3
  41. package/dist/{workspaces-TDBA64II.js → workspaces-WXRPLT2N.js} +3 -3
  42. package/dist/{worktree-I573UOPD.js → worktree-L6FJXFUC.js} +2 -2
  43. package/dist/{worktree-7V67XTEO.js → worktree-P67WAJKH.js} +2 -2
  44. package/package.json +1 -1
@@ -24,7 +24,7 @@ import {
24
24
  resolveQuotaFallbackAgent,
25
25
  stripBrightsyNdjsonNoise,
26
26
  toolDescription
27
- } from "./chunk-VUW3VKLW.js";
27
+ } from "./chunk-LULHFLPU.js";
28
28
  import {
29
29
  SLACK_REPLY_FORMATTING,
30
30
  addWorkspace,
@@ -47,7 +47,7 @@ import {
47
47
  stageAbsolutePathsAsAttachments,
48
48
  stageBuffersAsAttachments,
49
49
  syncWorkspacesFromThreads
50
- } from "./chunk-N2VST3NL.js";
50
+ } from "./chunk-7YKXBFQE.js";
51
51
  import {
52
52
  addPrStackLayer,
53
53
  allocateTeamName,
@@ -96,7 +96,7 @@ import {
96
96
  worktreeDisplayLabelForGroup,
97
97
  worktreeNameFromPath,
98
98
  worktreeSlugForTicket
99
- } from "./chunk-KTZESHYH.js";
99
+ } from "./chunk-AMMRFFB7.js";
100
100
  import {
101
101
  ATTACHMENTS_DIR,
102
102
  DETACHED_JOBS_DIR,
@@ -163,7 +163,7 @@ import {
163
163
  updateAdvancedSettings,
164
164
  usageOnLimit,
165
165
  writeSecureJson
166
- } from "./chunk-EWHJNJHV.js";
166
+ } from "./chunk-I5NC7DWO.js";
167
167
  import {
168
168
  examplePrefixedBranch,
169
169
  sanitizeGitBranchPrefix
@@ -482,7 +482,7 @@ async function continueSourceThread(threadId, prompt) {
482
482
  await continueOnReply(threadId, prompt);
483
483
  return;
484
484
  }
485
- const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-VKPHI64Q.js");
485
+ const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-X4VFA5WW.js");
486
486
  await getOrchestrator2().send(threadId, prompt);
487
487
  } catch {
488
488
  }
@@ -900,9 +900,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
900
900
  `Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
901
901
  );
902
902
  }
903
- const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-3FDAUNN2.js");
903
+ const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-QW4OXCLJ.js");
904
904
  if (isGlobalThread2(thread)) {
905
- const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-JLMQVORO.js");
905
+ const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-DZMMCDRW.js");
906
906
  ensureGlobalCoordinatorCwd2(
907
907
  isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
908
908
  );
@@ -2437,61 +2437,103 @@ function getRunScript(worktreePath, repoPath, name) {
2437
2437
  function getRunMode(worktreePath, repoPath) {
2438
2438
  return loadWorkspaceSettings(worktreePath, repoPath)?.runMode ?? "concurrent";
2439
2439
  }
2440
- async function allocatePort() {
2440
+ async function reservePort() {
2441
2441
  return new Promise((resolve, reject) => {
2442
2442
  const server = createServer();
2443
+ let released = false;
2444
+ const release = () => new Promise((res) => {
2445
+ if (released) {
2446
+ res();
2447
+ return;
2448
+ }
2449
+ released = true;
2450
+ server.close(() => res());
2451
+ });
2443
2452
  server.listen(0, "127.0.0.1", () => {
2444
2453
  const addr = server.address();
2445
2454
  if (!addr || typeof addr === "string") {
2446
- server.close();
2447
- reject(new Error("Failed to allocate port"));
2455
+ void release().then(() => reject(new Error("Failed to allocate port")));
2448
2456
  return;
2449
2457
  }
2450
- const port = addr.port;
2451
- server.close((err) => err ? reject(err) : resolve(port));
2458
+ resolve({ port: addr.port, release });
2452
2459
  });
2453
2460
  server.on("error", reject);
2454
2461
  });
2455
2462
  }
2456
- async function allocatePortRange(size = PORT_RANGE_SIZE) {
2457
- const base = await allocatePort();
2458
- const ports = [base];
2459
- for (let i = 1; i < size; i++) {
2460
- const candidate = base + i;
2461
- const free = await new Promise((resolve) => {
2462
- const server = createServer();
2463
- server.once("error", () => resolve(false));
2464
- server.listen(candidate, "127.0.0.1", () => {
2465
- server.close(() => resolve(true));
2466
- });
2463
+ async function allocatePort() {
2464
+ const held = await reservePort();
2465
+ await held.release();
2466
+ return held.port;
2467
+ }
2468
+ async function tryReservePort(port) {
2469
+ return new Promise((resolve) => {
2470
+ const server = createServer();
2471
+ let released = false;
2472
+ const release = () => new Promise((res) => {
2473
+ if (released) {
2474
+ res();
2475
+ return;
2476
+ }
2477
+ released = true;
2478
+ server.close(() => res());
2467
2479
  });
2468
- if (free) {
2469
- ports.push(candidate);
2470
- } else {
2471
- ports.push(await allocatePort());
2480
+ server.once("error", () => resolve(null));
2481
+ server.listen(port, "127.0.0.1", () => {
2482
+ resolve({ port, release });
2483
+ });
2484
+ });
2485
+ }
2486
+ async function reservePortRange(size = PORT_RANGE_SIZE) {
2487
+ const held = [await reservePort()];
2488
+ const base = held[0].port;
2489
+ try {
2490
+ for (let i = 1; i < size; i++) {
2491
+ const candidate = base + i;
2492
+ const next = await tryReservePort(candidate);
2493
+ if (next) {
2494
+ held.push(next);
2495
+ } else {
2496
+ held.push(await reservePort());
2497
+ }
2472
2498
  }
2499
+ return held;
2500
+ } catch (err) {
2501
+ await Promise.all(held.map((h) => h.release()));
2502
+ throw err;
2473
2503
  }
2504
+ }
2505
+ async function allocatePortRange(size = PORT_RANGE_SIZE) {
2506
+ const held = await reservePortRange(size);
2507
+ const ports = held.map((h) => h.port);
2508
+ await Promise.all(held.map((h) => h.release()));
2474
2509
  return ports;
2475
2510
  }
2476
2511
  async function startDevServer(repoPath, worktreePath, onLine, opts) {
2477
2512
  const script = getRunScript(worktreePath, repoPath, opts?.scriptName);
2478
2513
  if (!script) return null;
2479
- const ports = await allocatePortRange(PORT_RANGE_SIZE);
2480
- const handle = await spawnWorkspaceScript(script.command, {
2481
- worktreePath,
2482
- repoPath,
2483
- ports,
2484
- defaultBranch: opts?.defaultBranch,
2485
- onLine
2486
- });
2487
- return {
2488
- pid: handle.pid,
2489
- port: ports[0],
2490
- ports,
2491
- scriptName: script.name,
2492
- kill: handle.kill,
2493
- done: handle.done
2494
- };
2514
+ const held = await reservePortRange(PORT_RANGE_SIZE);
2515
+ const ports = held.map((h) => h.port);
2516
+ try {
2517
+ await Promise.all(held.map((h) => h.release()));
2518
+ const handle = await spawnWorkspaceScript(script.command, {
2519
+ worktreePath,
2520
+ repoPath,
2521
+ ports,
2522
+ defaultBranch: opts?.defaultBranch,
2523
+ onLine
2524
+ });
2525
+ return {
2526
+ pid: handle.pid,
2527
+ port: ports[0],
2528
+ ports,
2529
+ scriptName: script.name,
2530
+ kill: handle.kill,
2531
+ done: handle.done
2532
+ };
2533
+ } catch (err) {
2534
+ await Promise.all(held.map((h) => h.release()));
2535
+ throw err;
2536
+ }
2495
2537
  }
2496
2538
 
2497
2539
  // src/store/setup-log.ts
@@ -4044,7 +4086,7 @@ async function createThread(input, _onSetupLine) {
4044
4086
  });
4045
4087
  await requireAgent(resolved.agent);
4046
4088
  if (input.cowboy) {
4047
- const { cowboyModeEnabled } = await import("./app-settings-V2BBCX2H.js");
4089
+ const { cowboyModeEnabled } = await import("./app-settings-UXWCPDEA.js");
4048
4090
  if (!cowboyModeEnabled()) {
4049
4091
  throw new Error(
4050
4092
  "Cowboy mode is off. Enable it in Settings \u2192 Advanced."
@@ -4102,7 +4144,7 @@ async function createThread(input, _onSetupLine) {
4102
4144
  let sourceIsFork = false;
4103
4145
  if (!input.cowboy && sourceType === "branch" && (!sourceRef || sourceRef === "HEAD" || sourceRef === "default")) {
4104
4146
  if (isAbleTimeConnected() && getIssueSource() === "abletime") {
4105
- const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-D6773P33.js");
4147
+ const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-BGVOCEOU.js");
4106
4148
  const task = await ensureAbleTimeTask({
4107
4149
  title: title?.trim() || "Untitled work",
4108
4150
  description: input.prompt?.trim() || void 0
@@ -4204,7 +4246,7 @@ async function createThread(input, _onSetupLine) {
4204
4246
  return readThread(thread.id) ?? thread;
4205
4247
  }
4206
4248
  async function listLinearIssues(agent, repoPath) {
4207
- const { getAdapter: getAdapter2 } = await import("./agents-QQ77D7VT.js");
4249
+ const { getAdapter: getAdapter2 } = await import("./agents-ZKP7QNXA.js");
4208
4250
  await requireAgent(agent, { requireLinear: true });
4209
4251
  const adapter = getAdapter2(agent);
4210
4252
  if (!adapter.listLinearIssues) {
@@ -4677,7 +4719,7 @@ async function adoptThread(input) {
4677
4719
  messages: input.messages ?? []
4678
4720
  });
4679
4721
  writeThread(thread);
4680
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-76W7IEKR.js");
4722
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-77C5XQEY.js");
4681
4723
  await ensureWorkspace2(repoPath);
4682
4724
  const { ensureWorktreeSideboardIgnored: ensureWorktreeSideboardIgnored2 } = await import("./worktree-exclude-L32WEBX6.js");
4683
4725
  await ensureWorktreeSideboardIgnored2(input.worktreePath);
@@ -6770,12 +6812,13 @@ function formatLongRunningDirective(opts) {
6770
6812
  "- Loop Sideboard MCP `wait_for_job` (returns in ~45s). The desktop opens a `type=log` pane from wait/stop (and shell detached-job JSON) automatically \u2014 you may still `present_artifact` with `artifact_id=<id>` for a custom title. stillRunning \u2192 wait again. Shell fallback: the same helper with `wait <id>`.",
6771
6813
  "- Hanging, no useful output, or the wrong thing \u2192 `stop_job` (or the helper with `stop <id>`). Do not stop a pack/test/deploy that is clearly making progress.",
6772
6814
  "- Stay in the loop until stillRunning is false (or you stopped it). ok \u2192 finish the task. failed / stopped \u2192 read the log, fix or narrow the command, start once.",
6773
- "State: `.context/.sideboard/detached-jobs/<id>/` (local scratch). Full guide: `/long-running` (always available)."
6815
+ "State: `.context/.sideboard/detached-jobs/<id>/` (local scratch). Full guide: `/long-running` (always available).",
6816
+ "Project Dev / run scripts (`.sideboard` `[scripts.run.*]`, same as the desktop Dev button): use MCP `list_run_scripts` / `run_dev_script` / `stop_dev_script` \u2014 logs and Stop live in the thread UI. Do not detached-job or shell-spawn that same command."
6774
6817
  ].join("\n");
6775
6818
  }
6776
6819
  function formatLongRunningReminder(opts) {
6777
6820
  const invoke = formatDetachedJobInvoke(opts?.scriptPath);
6778
- return `Long jobs: \`${invoke} start <id> -- <cmd>\`, loop wait_for_job (or detached-job wait). The log pane updates from wait JSON; present_artifact type=log is optional. stop_job if hanging or wrong. Do not say you will let the user know later \u2014 stay in the turn.`;
6821
+ return `Long jobs: \`${invoke} start <id> -- <cmd>\`, loop wait_for_job (or detached-job wait). The log pane updates from wait JSON; present_artifact type=log is optional. stop_job if hanging or wrong. Do not say you will let the user know later \u2014 stay in the turn. Project Dev button: list_run_scripts / run_dev_script / stop_dev_script (UI-connected \u2014 not detached-job).`;
6779
6822
  }
6780
6823
  function formatArtifactDirective() {
6781
6824
  return [
@@ -6787,7 +6830,7 @@ function formatArtifactDirective() {
6787
6830
  ].join("\n");
6788
6831
  }
6789
6832
  function formatUiReminder() {
6790
- 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, \u201Cwhat next?\u201D, or after a review) \u2014 reply in chat. Do not say artifacts/CMS UI are unavailable.";
6833
+ 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, \u201Cwhat next?\u201D, or after a review) \u2014 reply in chat. Do not say artifacts/CMS UI are unavailable. Dev / preview: run_dev_script (same as the Dev button); stop_dev_script to stop.";
6791
6834
  }
6792
6835
 
6793
6836
  // src/review/review-write-gate.ts
@@ -7358,7 +7401,7 @@ function formatScheduledPrompt(name, prompt) {
7358
7401
  ${prompt}`;
7359
7402
  }
7360
7403
  async function defaultDeps() {
7361
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-VKPHI64Q.js");
7404
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-X4VFA5WW.js");
7362
7405
  const orch = getOrchestrator2();
7363
7406
  return {
7364
7407
  findThread: (id) => findThreadByRef(id),
@@ -7539,6 +7582,8 @@ var Orchestrator = class {
7539
7582
  /** Auto-continues after a worktree turn ended while a detached job still runs. */
7540
7583
  jobContinueCount = /* @__PURE__ */ new Map();
7541
7584
  jobContinueNudged = /* @__PURE__ */ new Set();
7585
+ /** In-flight startDev per worktree run key — agent MCP + UI Start must not double-spawn. */
7586
+ startingDev = /* @__PURE__ */ new Map();
7542
7587
  maxConcurrent;
7543
7588
  runningCount = 0;
7544
7589
  constructor(opts) {
@@ -7673,7 +7718,7 @@ var Orchestrator = class {
7673
7718
  orphans: orphans.map((o) => ({ path: o.path, repoPath: o.repoPath }))
7674
7719
  });
7675
7720
  }
7676
- const { autoCleanupOrphansEnabled } = await import("./app-settings-V2BBCX2H.js");
7721
+ const { autoCleanupOrphansEnabled } = await import("./app-settings-UXWCPDEA.js");
7677
7722
  if (autoCleanupOrphansEnabled() && shouldRunWorktreeCleanup() && orphans.length > 0) {
7678
7723
  await cleanupOrphanWorktrees({ repoPaths });
7679
7724
  }
@@ -7960,7 +8005,7 @@ var Orchestrator = class {
7960
8005
  }
7961
8006
  await setup;
7962
8007
  if (skipSetup) return;
7963
- const { autoRunAfterSetupEnabled } = await import("./app-settings-V2BBCX2H.js");
8008
+ const { autoRunAfterSetupEnabled } = await import("./app-settings-UXWCPDEA.js");
7964
8009
  if (autoRunAfterSetupEnabled()) {
7965
8010
  try {
7966
8011
  await this.startDev(threadId);
@@ -8316,7 +8361,7 @@ var Orchestrator = class {
8316
8361
  }
8317
8362
  const isBrightsy = fresh.agent === "brightsy";
8318
8363
  const isOrchestration = isOrchestratorThread(fresh);
8319
- const { autoRenameBranchEnabled, getGithubGitAuthMode, gitBranchPrefixSetting } = await import("./app-settings-V2BBCX2H.js");
8364
+ const { autoRenameBranchEnabled, getGithubGitAuthMode, gitBranchPrefixSetting } = await import("./app-settings-UXWCPDEA.js");
8320
8365
  const gitAuthMode = getGithubGitAuthMode();
8321
8366
  const worktreeDirective = isBrightsy || isOrchestration ? null : formatWorktreeDirective(fresh, {
8322
8367
  githubSlug: await withTimeout(
@@ -8756,9 +8801,20 @@ var Orchestrator = class {
8756
8801
  "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)."
8757
8802
  );
8758
8803
  }
8804
+ const runKey = worktreeRunProcessKey(thread.worktreePath, resolvedName);
8805
+ const inFlight = this.startingDev.get(runKey);
8806
+ if (inFlight) return inFlight;
8807
+ const start = this.startDevUnlocked(thread, resolvedName, scriptName, scripts, runKey);
8808
+ this.startingDev.set(runKey, start);
8809
+ try {
8810
+ return await start;
8811
+ } finally {
8812
+ this.startingDev.delete(runKey);
8813
+ }
8814
+ }
8815
+ async startDevUnlocked(thread, resolvedName, scriptName, scripts, runKey) {
8759
8816
  const siblings = threadsSharingWorktree(thread.worktreePath);
8760
8817
  const shared = mergeWorktreeActiveRuns(siblings);
8761
- const runKey = worktreeRunProcessKey(thread.worktreePath, resolvedName);
8762
8818
  const existing = this.processes.get(runKey) ?? siblings.map((t) => this.processes.get(`${t.id}:run:${resolvedName}`)).find(Boolean);
8763
8819
  const active = shared.activeRuns.find((r) => r.scriptName === resolvedName);
8764
8820
  if (existing && active) {
@@ -8770,6 +8826,14 @@ var Orchestrator = class {
8770
8826
  return { port: shared.devPort, scriptName: resolvedName, ports: [shared.devPort] };
8771
8827
  }
8772
8828
  }
8829
+ if (active && !existing) {
8830
+ killListenersOnPorts(collectActiveRunPorts([active]));
8831
+ this.syncWorktreeRuns(
8832
+ thread.worktreePath,
8833
+ shared.activeRuns.filter((r) => r.scriptName !== resolvedName),
8834
+ shared.devPort === active.port ? null : shared.devPort
8835
+ );
8836
+ }
8773
8837
  const mode = getRunMode(thread.worktreePath, thread.repoPath);
8774
8838
  if (mode === "nonconcurrent") {
8775
8839
  const here = normalizeWorktreePath(thread.worktreePath);
@@ -8818,6 +8882,7 @@ var Orchestrator = class {
8818
8882
  kill: handle.kill
8819
8883
  });
8820
8884
  }
8885
+ const latestShared = mergeWorktreeActiveRuns(threadsSharingWorktree(thread.worktreePath));
8821
8886
  const run2 = {
8822
8887
  scriptName: resolvedName,
8823
8888
  port: handle.port,
@@ -8825,13 +8890,13 @@ var Orchestrator = class {
8825
8890
  startedAt
8826
8891
  };
8827
8892
  const nextRuns = [
8828
- ...shared.activeRuns.filter((r) => r.scriptName !== resolvedName),
8893
+ ...latestShared.activeRuns.filter((r) => r.scriptName !== resolvedName),
8829
8894
  run2
8830
8895
  ];
8831
8896
  this.syncWorktreeRuns(
8832
8897
  thread.worktreePath,
8833
8898
  nextRuns,
8834
- isDefault ? handle.port : shared.devPort
8899
+ isDefault ? handle.port : latestShared.devPort
8835
8900
  );
8836
8901
  this.emit({
8837
8902
  type: "dev_server_started",
@@ -9440,7 +9505,7 @@ var Orchestrator = class {
9440
9505
  if (!titled.userSetTitle && meta.title && titled.title !== meta.title) {
9441
9506
  updateThread(thread.id, { title: meta.title });
9442
9507
  }
9443
- const { autoArchiveOnMergeEnabled } = await import("./app-settings-V2BBCX2H.js");
9508
+ const { autoArchiveOnMergeEnabled } = await import("./app-settings-UXWCPDEA.js");
9444
9509
  const latest = this.requireThread(thread.id);
9445
9510
  if (!shouldAutoArchiveOnPrMerge({
9446
9511
  previousPrState: prevState || null,
@@ -9722,7 +9787,7 @@ var Orchestrator = class {
9722
9787
  this.enforceHistoryRetention();
9723
9788
  if (thread.repoPath && !isGlobalRepoPath(thread.repoPath)) {
9724
9789
  try {
9725
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-76W7IEKR.js");
9790
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-77C5XQEY.js");
9726
9791
  await ensureWorkspace2(thread.repoPath);
9727
9792
  } catch {
9728
9793
  }
@@ -9749,7 +9814,7 @@ var Orchestrator = class {
9749
9814
  await runArchiveScript(thread.repoPath, thread.worktreePath);
9750
9815
  } catch {
9751
9816
  }
9752
- const { deleteBranchOnPurgeEnabled } = await import("./app-settings-V2BBCX2H.js");
9817
+ const { deleteBranchOnPurgeEnabled } = await import("./app-settings-UXWCPDEA.js");
9753
9818
  const deleteBranch = opts?.deleteBranch ?? deleteBranchOnPurgeEnabled();
9754
9819
  await removeWorktree(thread.repoPath, thread.worktreePath, {
9755
9820
  deleteBranch: deleteBranch ? thread.branchName : void 0
@@ -9776,7 +9841,7 @@ var Orchestrator = class {
9776
9841
  `Cowboy checkout missing: ${thread.worktreePath}. Re-add the project folder, then restore.`
9777
9842
  );
9778
9843
  }
9779
- const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-7V67XTEO.js");
9844
+ const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-P67WAJKH.js");
9780
9845
  const slug = thread.worktreePath.split("/").pop();
9781
9846
  const dest = thread.worktreePath;
9782
9847
  await withRepoGitLock(thread.repoPath, async () => {
@@ -9886,7 +9951,7 @@ async function startOrchestration(opts) {
9886
9951
  sourceRef: "default",
9887
9952
  ...createOpts
9888
9953
  }).catch(async () => {
9889
- const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-7V67XTEO.js");
9954
+ const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-P67WAJKH.js");
9890
9955
  const repo = await resolveRepoRoot2(repoPath);
9891
9956
  const def = await resolveDefaultBranch2(repo);
9892
9957
  return orch.createThread({
@@ -10049,7 +10114,9 @@ export {
10049
10114
  getDefaultRunScript,
10050
10115
  getRunScript,
10051
10116
  getRunMode,
10117
+ reservePort,
10052
10118
  allocatePort,
10119
+ reservePortRange,
10053
10120
  allocatePortRange,
10054
10121
  startDevServer,
10055
10122
  findOrphanWorktrees,
@@ -7,11 +7,11 @@ import {
7
7
  enrichWorkspacesWithGithub,
8
8
  ensureGlobalCoordinatorCwd,
9
9
  formatWorkspaceInventory
10
- } from "./chunk-N2VST3NL.js";
11
- import "./chunk-KTZESHYH.js";
10
+ } from "./chunk-7YKXBFQE.js";
11
+ import "./chunk-AMMRFFB7.js";
12
12
  import "./chunk-6K64FJDD.js";
13
13
  import "./chunk-PO4M4JAJ.js";
14
- import "./chunk-EWHJNJHV.js";
14
+ import "./chunk-I5NC7DWO.js";
15
15
  import "./chunk-WDRMZKVB.js";
16
16
  import "./chunk-JT7R45JB.js";
17
17
  import "./chunk-3IMSQNTS.js";
@@ -9,14 +9,14 @@ import {
9
9
  enrichWorkspacesWithGithub,
10
10
  ensureGlobalCoordinatorCwd,
11
11
  formatWorkspaceInventory
12
- } from "./chunk-P2EAAM3H.js";
13
- import "./chunk-NFWPDEN4.js";
12
+ } from "./chunk-N7UXGM3Y.js";
13
+ import "./chunk-F3GT6DQW.js";
14
14
  import "./chunk-D6JWYJ4P.js";
15
15
  import "./chunk-HY2GFZ5S.js";
16
16
  import "./chunk-X5B3OS5I.js";
17
17
  import "./chunk-SZJZEFTY.js";
18
18
  import "./chunk-ABOBTSO6.js";
19
- import "./chunk-Y5JES2VV.js";
19
+ import "./chunk-RZTRWN2V.js";
20
20
  import "./chunk-NSTQ6QKD.js";
21
21
  import "./chunk-KGZBYWZ3.js";
22
22
  import "./chunk-EQNRWDLN.js";
@@ -17,14 +17,14 @@ import {
17
17
  orchestratorSessionPoisonedByBuiltins,
18
18
  slackCoordinatorSourceRef,
19
19
  takenTeamSlugsForOrchestration
20
- } from "./chunk-P2EAAM3H.js";
21
- import "./chunk-NFWPDEN4.js";
20
+ } from "./chunk-N7UXGM3Y.js";
21
+ import "./chunk-F3GT6DQW.js";
22
22
  import "./chunk-D6JWYJ4P.js";
23
23
  import "./chunk-HY2GFZ5S.js";
24
24
  import "./chunk-X5B3OS5I.js";
25
25
  import "./chunk-SZJZEFTY.js";
26
26
  import "./chunk-ABOBTSO6.js";
27
- import "./chunk-Y5JES2VV.js";
27
+ import "./chunk-RZTRWN2V.js";
28
28
  import "./chunk-NSTQ6QKD.js";
29
29
  import "./chunk-KGZBYWZ3.js";
30
30
  import {
@@ -15,11 +15,11 @@ import {
15
15
  orchestratorSessionPoisonedByBuiltins,
16
16
  slackCoordinatorSourceRef,
17
17
  takenTeamSlugsForOrchestration
18
- } from "./chunk-N2VST3NL.js";
19
- import "./chunk-KTZESHYH.js";
18
+ } from "./chunk-7YKXBFQE.js";
19
+ import "./chunk-AMMRFFB7.js";
20
20
  import "./chunk-6K64FJDD.js";
21
21
  import "./chunk-PO4M4JAJ.js";
22
- import "./chunk-EWHJNJHV.js";
22
+ import "./chunk-I5NC7DWO.js";
23
23
  import "./chunk-WDRMZKVB.js";
24
24
  import "./chunk-JT7R45JB.js";
25
25
  import "./chunk-3IMSQNTS.js";