@sideboard-ai/core 0.1.130 → 0.1.133

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-DDTV7WO3.js +36 -0
  2. package/dist/abletime-VTP4JR63.js +37 -0
  3. package/dist/agents/cursor-runner.js +1 -1
  4. package/dist/{agents-7BUQY2WX.js → agents-NHS6P25H.js} +8 -6
  5. package/dist/{agents-X2I3RNCY.js → agents-SOU5GPWI.js} +9 -7
  6. package/dist/{app-settings-6RPALX4J.js → app-settings-U5RZKUXG.js} +11 -1
  7. package/dist/{app-settings-E7NEQY7D.js → app-settings-YQ7YX2CC.js} +11 -1
  8. package/dist/chunk-2XXAAIN3.js +463 -0
  9. package/dist/{chunk-VE22NWBD.js → chunk-3UVVWNHF.js} +2 -2
  10. package/dist/{chunk-NV73AO7Q.js → chunk-4YAVXWFR.js} +21 -9
  11. package/dist/{chunk-RSFCB23A.js → chunk-6CRKPD4C.js} +4 -3
  12. package/dist/chunk-6GN5WPYZ.js +31 -0
  13. package/dist/{chunk-ZMUOPTKZ.js → chunk-AK7SWE2U.js} +55 -12
  14. package/dist/chunk-AT346U23.js +468 -0
  15. package/dist/{chunk-YMRT2DU6.js → chunk-ED4UPEJX.js} +25 -50
  16. package/dist/chunk-ELBYOGVA.js +32 -0
  17. package/dist/{chunk-IUJOI7KK.js → chunk-FSCQXMGI.js} +35 -4
  18. package/dist/{chunk-HUYEU4GS.js → chunk-GJBHOJCZ.js} +83 -2
  19. package/dist/{chunk-ZND6XV6J.js → chunk-GKKHXZCT.js} +83 -2
  20. package/dist/{chunk-HZPO3SSZ.js → chunk-IM36S4HZ.js} +4 -3
  21. package/dist/{chunk-EKIDHL2T.js → chunk-KBWND62T.js} +32 -55
  22. package/dist/{chunk-HULESWLI.js → chunk-LTP7GHIF.js} +3 -3
  23. package/dist/chunk-M267JPEA.js +103 -0
  24. package/dist/{chunk-HRSBZIXS.js → chunk-Q6XQXCOM.js} +1 -1
  25. package/dist/chunk-S42XV45P.js +104 -0
  26. package/dist/{chunk-YALVX3UE.js → chunk-TG7YU2KG.js} +157 -40
  27. package/dist/{chunk-FMBLOOAO.js → chunk-VSON7EJ6.js} +155 -39
  28. package/dist/{chunk-UDQI3N47.js → chunk-WEU5M7BW.js} +1 -1
  29. package/dist/{chunk-SYLTXDRF.js → chunk-Y645NFYN.js} +2 -2
  30. package/dist/{chunk-MNL4FSKY.js → chunk-YEIH7P7D.js} +3 -3
  31. package/dist/{connected-teams-ZCOU6KCD.js → connected-teams-4A2AXDNN.js} +3 -1
  32. package/dist/{connected-teams-O6D4PM7A.js → connected-teams-IJUJQ7R6.js} +3 -1
  33. package/dist/{coordinator-prompt-SPJSGAQS.js → coordinator-prompt-DXHEDRRN.js} +3 -3
  34. package/dist/{coordinator-prompt-MEEUOEF2.js → coordinator-prompt-XF7LVOUN.js} +3 -3
  35. package/dist/{global-workspace-KNESLWKG.js → global-workspace-2LO5ATOH.js} +4 -4
  36. package/dist/{global-workspace-BMWP7YZC.js → global-workspace-MLQNULOU.js} +4 -4
  37. package/dist/index.cjs +1410 -425
  38. package/dist/index.d.cts +224 -16
  39. package/dist/index.d.ts +224 -16
  40. package/dist/index.js +461 -292
  41. package/dist/mcp/run-stdio.cjs +1261 -342
  42. package/dist/mcp/run-stdio.js +340 -209
  43. package/dist/oauth-A7XXI2TM.js +11 -0
  44. package/dist/oauth-YJBAURIJ.js +13 -0
  45. package/dist/{orchestrator-3ZSFTG72.js → orchestrator-KR5RA5B7.js} +10 -8
  46. package/dist/{orchestrator-G6DU3AF3.js → orchestrator-P2SYHVLS.js} +11 -9
  47. package/dist/{workspaces-O4QZOASB.js → workspaces-ARWPZG6F.js} +5 -5
  48. package/dist/{workspaces-HSYRYJYV.js → workspaces-MINB764G.js} +5 -5
  49. package/dist/{worktree-ERHC7Q4F.js → worktree-EBZMUUAL.js} +2 -2
  50. package/dist/{worktree-JVGSLSLJ.js → worktree-S7MKMYAT.js} +2 -2
  51. package/package.json +1 -1
@@ -8,6 +8,7 @@ import {
8
8
  contextTokens,
9
9
  fallbackTurnFailDetail,
10
10
  finalizeParts,
11
+ formatAgentErrorContinuePrompt,
11
12
  formatTurnExitError,
12
13
  getAdapter,
13
14
  isBrightsyNdjsonLine,
@@ -23,19 +24,20 @@ import {
23
24
  partsToAssistantText,
24
25
  pushTurnStderr,
25
26
  resolveQuotaFallbackAgent,
27
+ shouldFeedErrorBackToAgent,
26
28
  shouldRetryFailedAgentTurn,
27
29
  stripBrightsyNdjsonNoise,
28
30
  sumUsageList,
29
31
  summarizeTurnStderr,
30
32
  toolDescription,
31
33
  turnFailChatText
32
- } from "./chunk-ZMUOPTKZ.js";
34
+ } from "./chunk-AK7SWE2U.js";
33
35
  import {
34
36
  addWorkspace,
35
37
  ensureWorkspace,
36
38
  removeWorkspace,
37
39
  syncWorkspacesFromThreads
38
- } from "./chunk-SYLTXDRF.js";
40
+ } from "./chunk-Y645NFYN.js";
39
41
  import {
40
42
  extractPresentedPlan,
41
43
  readPlanFile,
@@ -56,14 +58,14 @@ import {
56
58
  isOrchestratorThread,
57
59
  isSlackCoordinatorThread,
58
60
  orchestratorSessionPoisonedByBuiltins
59
- } from "./chunk-MNL4FSKY.js";
61
+ } from "./chunk-YEIH7P7D.js";
60
62
  import {
61
63
  SLACK_REPLY_FORMATTING,
62
64
  coordinatorSystemPrompt,
63
65
  coordinatorTurnReminder,
64
66
  enrichWorkspacesWithGithub,
65
67
  ensureGlobalCoordinatorCwd
66
- } from "./chunk-RSFCB23A.js";
68
+ } from "./chunk-6CRKPD4C.js";
67
69
  import {
68
70
  addPrStackLayer,
69
71
  allocateTeamName,
@@ -108,7 +110,7 @@ import {
108
110
  withRepoGitLock,
109
111
  worktreeDisplayLabelForGroup,
110
112
  worktreeNameFromPath
111
- } from "./chunk-HRSBZIXS.js";
113
+ } from "./chunk-Q6XQXCOM.js";
112
114
  import {
113
115
  ATTACHMENTS_DIR,
114
116
  LEGACY_ATTACHMENTS_DIR,
@@ -136,6 +138,8 @@ import {
136
138
  } from "./chunk-KPIYENTF.js";
137
139
  import {
138
140
  childEnvWithAppSettings,
141
+ getIssueSource,
142
+ isAbleTimeConnected,
139
143
  isSecureFileEncrypted,
140
144
  loadAppSettings,
141
145
  orchestrationQuotaFallbackAgent,
@@ -147,7 +151,7 @@ import {
147
151
  stripNestedElectronEnv,
148
152
  updateAdvancedSettings,
149
153
  writeSecureJson
150
- } from "./chunk-ZND6XV6J.js";
154
+ } from "./chunk-GKKHXZCT.js";
151
155
  import {
152
156
  writePrivateFile
153
157
  } from "./chunk-NSTQ6QKD.js";
@@ -380,7 +384,7 @@ async function continueSourceThread(threadId, prompt) {
380
384
  await continueOnReply(threadId, prompt);
381
385
  return;
382
386
  }
383
- const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-3ZSFTG72.js");
387
+ const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-KR5RA5B7.js");
384
388
  await getOrchestrator2().send(threadId, prompt);
385
389
  } catch {
386
390
  }
@@ -721,9 +725,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
721
725
  `Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
722
726
  );
723
727
  }
724
- const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-KNESLWKG.js");
728
+ const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-2LO5ATOH.js");
725
729
  if (isGlobalThread2(thread)) {
726
- const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-SPJSGAQS.js");
730
+ const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-DXHEDRRN.js");
727
731
  ensureGlobalCoordinatorCwd2(
728
732
  isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
729
733
  );
@@ -2288,7 +2292,49 @@ function isMergedPrState(prUrl, prState) {
2288
2292
  if (!prUrl?.trim()) return false;
2289
2293
  return (prState ?? "").trim().toUpperCase() === "MERGED";
2290
2294
  }
2291
- function groupHomeBoardWorktrees(threads) {
2295
+ var DEFAULT_WORKTREE_SORT = "created";
2296
+ function groupCreatedAt(group) {
2297
+ let min = group[0]?.createdAt ?? "";
2298
+ for (const t of group) {
2299
+ if (t.createdAt && t.createdAt < min) min = t.createdAt;
2300
+ }
2301
+ return min;
2302
+ }
2303
+ function groupUpdatedAt(group) {
2304
+ let max = group[0]?.updatedAt ?? "";
2305
+ for (const t of group) {
2306
+ if (t.updatedAt && t.updatedAt > max) max = t.updatedAt;
2307
+ }
2308
+ return max;
2309
+ }
2310
+ function sortThreadsInWorktree(list) {
2311
+ return [...list].sort((a, b) => {
2312
+ const created = a.createdAt.localeCompare(b.createdAt);
2313
+ if (created !== 0) return created;
2314
+ return a.id.localeCompare(b.id);
2315
+ });
2316
+ }
2317
+ function compareWorktreeGroups(a, b, mode, labelOf) {
2318
+ if (mode === "name") {
2319
+ const named = (labelOf?.(a) ?? a[0]?.id ?? "").localeCompare(
2320
+ labelOf?.(b) ?? b[0]?.id ?? "",
2321
+ void 0,
2322
+ { sensitivity: "base" }
2323
+ );
2324
+ if (named !== 0) return named;
2325
+ } else if (mode === "activity") {
2326
+ const activity = groupUpdatedAt(b).localeCompare(groupUpdatedAt(a));
2327
+ if (activity !== 0) return activity;
2328
+ } else {
2329
+ const created = groupCreatedAt(b).localeCompare(groupCreatedAt(a));
2330
+ if (created !== 0) return created;
2331
+ }
2332
+ return (a[0]?.id ?? "").localeCompare(b[0]?.id ?? "");
2333
+ }
2334
+ function defaultWorktreeGroupLabel(group) {
2335
+ return worktreeDisplayLabelForGroup(group);
2336
+ }
2337
+ function groupHomeBoardWorktrees(threads, sort = DEFAULT_WORKTREE_SORT, labelOf = defaultWorktreeGroupLabel) {
2292
2338
  const map = /* @__PURE__ */ new Map();
2293
2339
  for (const t of threads) {
2294
2340
  const key = normalizeWorktreePath(t.worktreePath);
@@ -2296,7 +2342,7 @@ function groupHomeBoardWorktrees(threads) {
2296
2342
  list.push(t);
2297
2343
  map.set(key, list);
2298
2344
  }
2299
- return [...map.values()].map((list) => list.sort((a, b) => b.updatedAt.localeCompare(a.updatedAt))).sort((a, b) => (b[0]?.updatedAt ?? "").localeCompare(a[0]?.updatedAt ?? ""));
2345
+ return [...map.values()].map((list) => sortThreadsInWorktree(list)).sort((a, b) => compareWorktreeGroups(a, b, sort, labelOf));
2300
2346
  }
2301
2347
  function classifyWorktreeColumn(group) {
2302
2348
  if (group.some((t) => isMergedPrState(t.prUrl, t.prState))) return "done";
@@ -2349,6 +2395,9 @@ function issueNeedsWorkspacePick(provider, workspaceCount) {
2349
2395
  if (workspaceCount <= 1) return false;
2350
2396
  return provider !== "github";
2351
2397
  }
2398
+ function isAccountWideIssueSource(source) {
2399
+ return source === "linear" || source === "abletime";
2400
+ }
2352
2401
  function boardPrKey(pr) {
2353
2402
  return pr.url?.trim() || `${pr.repoPath}::${pr.number}`;
2354
2403
  }
@@ -2597,8 +2646,7 @@ function assembleHomeBoard(input) {
2597
2646
  const kind = input.kind ?? "all";
2598
2647
  const limit = Math.max(1, input.limit ?? BOARD_PAGE_SIZE);
2599
2648
  const wsName = input.workspaceName ?? (() => "");
2600
- const byUpdated = (a, b) => b.updatedAt.localeCompare(a.updatedAt);
2601
- const live = input.threads.filter((t) => t.status !== "archived" && isHomeBoardThread(t)).sort(byUpdated);
2649
+ const live = input.threads.filter((t) => t.status !== "archived" && isHomeBoardThread(t));
2602
2650
  const columns = emptyColumns();
2603
2651
  const hidden = emptyHidden();
2604
2652
  const totals = {
@@ -2685,7 +2733,7 @@ async function createThread(input, _onSetupLine) {
2685
2733
  });
2686
2734
  await requireAgent(resolved.agent);
2687
2735
  if (input.cowboy) {
2688
- const { cowboyModeEnabled } = await import("./app-settings-E7NEQY7D.js");
2736
+ const { cowboyModeEnabled } = await import("./app-settings-YQ7YX2CC.js");
2689
2737
  if (!cowboyModeEnabled()) {
2690
2738
  throw new Error(
2691
2739
  "Cowboy mode is off. Enable it in Settings \u2192 Advanced."
@@ -2733,11 +2781,29 @@ async function createThread(input, _onSetupLine) {
2733
2781
  await ensureWorkspace(repoPath);
2734
2782
  return readThread(thread2.id) ?? thread2;
2735
2783
  }
2784
+ let sourceType = input.sourceType;
2736
2785
  let sourceRef = input.sourceRef;
2786
+ let persistedSourceRef = input.sourceRef;
2787
+ let attachments = input.attachments ?? [];
2788
+ let title = input.title;
2737
2789
  let sourceIsFork = false;
2790
+ if (!input.cowboy && sourceType === "branch" && (!sourceRef || sourceRef === "HEAD" || sourceRef === "default")) {
2791
+ if (isAbleTimeConnected() && getIssueSource() === "abletime") {
2792
+ const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-VTP4JR63.js");
2793
+ const task = await ensureAbleTimeTask({
2794
+ title: title?.trim() || "Untitled work",
2795
+ description: input.prompt?.trim() || void 0
2796
+ });
2797
+ sourceType = "ticket";
2798
+ sourceRef = task.identifier;
2799
+ persistedSourceRef = task.identifier;
2800
+ title = title?.trim() || task.title;
2801
+ attachments = [...attachments, issueAttachmentForAbleTimeTask(task)];
2802
+ }
2803
+ }
2738
2804
  let prUrl = null;
2739
2805
  let prTitle = null;
2740
- if (input.sourceType === "pr") {
2806
+ if (sourceType === "pr") {
2741
2807
  const num = Number(input.sourceRef.replace(/^#/, ""));
2742
2808
  if (!Number.isFinite(num)) throw new Error(`Invalid PR number: ${input.sourceRef}`);
2743
2809
  const pr = await getPr(repoPath, num);
@@ -2747,9 +2813,9 @@ async function createThread(input, _onSetupLine) {
2747
2813
  const localFetchBranch = `sideboard-pr-${pr.number}`;
2748
2814
  await fetchPrHead(repoPath, pr.number, localFetchBranch);
2749
2815
  sourceRef = localFetchBranch;
2750
- } else if (input.sourceType === "ticket") {
2816
+ } else if (sourceType === "ticket") {
2751
2817
  sourceRef = await resolveDefaultBranch(repoPath);
2752
- } else if (input.sourceType === "branch") {
2818
+ } else if (sourceType === "branch") {
2753
2819
  if (!sourceRef || sourceRef === "HEAD" || sourceRef === "default") {
2754
2820
  sourceRef = await resolveDefaultBranch(repoPath);
2755
2821
  } else {
@@ -2759,7 +2825,7 @@ async function createThread(input, _onSetupLine) {
2759
2825
  prTitle = existing.title;
2760
2826
  }
2761
2827
  }
2762
- } else if (input.sourceType === "adopt") {
2828
+ } else if (sourceType === "adopt") {
2763
2829
  throw new Error("Use adoptThread() for adopt sources");
2764
2830
  }
2765
2831
  const team = allocateTeamSlug(repoPath);
@@ -2769,12 +2835,12 @@ async function createThread(input, _onSetupLine) {
2769
2835
  slug: team.slug
2770
2836
  });
2771
2837
  copyConfiguredFiles(repoPath, worktreePath);
2772
- const explicitTitle = input.title?.trim();
2838
+ const explicitTitle = title?.trim();
2773
2839
  const thread = createEmptyThread({
2774
2840
  title: explicitTitle || team.name,
2775
2841
  userSetTitle: Boolean(explicitTitle),
2776
- sourceType: input.sourceType,
2777
- sourceRef: input.sourceRef === "default" ? sourceRef : input.sourceRef,
2842
+ sourceType,
2843
+ sourceRef: persistedSourceRef === "default" ? sourceRef : persistedSourceRef,
2778
2844
  branchName,
2779
2845
  worktreePath,
2780
2846
  repoPath,
@@ -2784,7 +2850,7 @@ async function createThread(input, _onSetupLine) {
2784
2850
  effort: resolved.effort,
2785
2851
  fast: resolved.fast,
2786
2852
  planMode: Boolean(input.planMode),
2787
- attachments: input.attachments ?? [],
2853
+ attachments,
2788
2854
  sourceIsFork,
2789
2855
  parentThreadId: input.parentThreadId ?? null,
2790
2856
  status: "idle",
@@ -2796,7 +2862,7 @@ async function createThread(input, _onSetupLine) {
2796
2862
  return readThread(thread.id) ?? thread;
2797
2863
  }
2798
2864
  async function listLinearIssues(agent, repoPath) {
2799
- const { getAdapter: getAdapter2 } = await import("./agents-7BUQY2WX.js");
2865
+ const { getAdapter: getAdapter2 } = await import("./agents-NHS6P25H.js");
2800
2866
  await requireAgent(agent, { requireLinear: true });
2801
2867
  const adapter = getAdapter2(agent);
2802
2868
  if (!adapter.listLinearIssues) {
@@ -3193,7 +3259,7 @@ async function adoptThread(input) {
3193
3259
  messages: input.messages ?? []
3194
3260
  });
3195
3261
  writeThread(thread);
3196
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-HSYRYJYV.js");
3262
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-MINB764G.js");
3197
3263
  await ensureWorkspace2(repoPath);
3198
3264
  return thread;
3199
3265
  }
@@ -5341,7 +5407,7 @@ function formatScheduledPrompt(name, prompt) {
5341
5407
  ${prompt}`;
5342
5408
  }
5343
5409
  async function defaultDeps() {
5344
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-3ZSFTG72.js");
5410
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-KR5RA5B7.js");
5345
5411
  const orch = getOrchestrator2();
5346
5412
  return {
5347
5413
  findThread: (id) => findThreadByRef(id),
@@ -5492,6 +5558,11 @@ var Orchestrator = class {
5492
5558
  turnBaselines = /* @__PURE__ */ new Map();
5493
5559
  /** Timers for orchestration session-quota auto-resume. */
5494
5560
  quotaResumeTimers = /* @__PURE__ */ new Map();
5561
+ /**
5562
+ * Threads that already got a crash-continue turn. Cleared on a successful
5563
+ * finish or a user send so a later crash can recover again.
5564
+ */
5565
+ crashContinued = /* @__PURE__ */ new Set();
5495
5566
  maxConcurrent;
5496
5567
  runningCount = 0;
5497
5568
  constructor(opts) {
@@ -5561,7 +5632,7 @@ var Orchestrator = class {
5561
5632
  orphans: orphans.map((o) => ({ path: o.path, repoPath: o.repoPath }))
5562
5633
  });
5563
5634
  }
5564
- const { autoCleanupOrphansEnabled } = await import("./app-settings-E7NEQY7D.js");
5635
+ const { autoCleanupOrphansEnabled } = await import("./app-settings-YQ7YX2CC.js");
5565
5636
  if (autoCleanupOrphansEnabled() && shouldRunWorktreeCleanup() && orphans.length > 0) {
5566
5637
  await cleanupOrphanWorktrees({ repoPaths });
5567
5638
  }
@@ -5705,6 +5776,29 @@ var Orchestrator = class {
5705
5776
  );
5706
5777
  }
5707
5778
  }
5779
+ /**
5780
+ * Cursor-style recovery: after a runner crash, feed the error back as the
5781
+ * next prompt so the same agent can continue instead of sitting on lastError.
5782
+ */
5783
+ maybeEnqueueCrashContinue(threadId, opts) {
5784
+ if (this.crashContinued.has(threadId)) return;
5785
+ if (this.haltDrain.has(threadId)) return;
5786
+ if (!shouldFeedErrorBackToAgent({
5787
+ detail: opts.detail,
5788
+ assistantText: opts.assistantText,
5789
+ partsCount: opts.partsCount
5790
+ })) {
5791
+ return;
5792
+ }
5793
+ const thread = readThread(threadId);
5794
+ if (!thread || thread.status === "archived") return;
5795
+ this.crashContinued.add(threadId);
5796
+ const prompt = formatAgentErrorContinuePrompt(opts.detail);
5797
+ const queue = [prompt, ...thread.queue];
5798
+ updateThread(threadId, { queue });
5799
+ this.emit({ type: "queue_changed", threadId, queue });
5800
+ this.haltDrain.delete(threadId);
5801
+ }
5708
5802
  getThreads(includeArchived = false) {
5709
5803
  return listThreads({ includeArchived });
5710
5804
  }
@@ -5749,7 +5843,7 @@ var Orchestrator = class {
5749
5843
  }
5750
5844
  await setup;
5751
5845
  if (skipSetup) return;
5752
- const { autoRunAfterSetupEnabled } = await import("./app-settings-E7NEQY7D.js");
5846
+ const { autoRunAfterSetupEnabled } = await import("./app-settings-YQ7YX2CC.js");
5753
5847
  if (autoRunAfterSetupEnabled()) {
5754
5848
  try {
5755
5849
  await this.startDev(threadId);
@@ -5804,15 +5898,20 @@ var Orchestrator = class {
5804
5898
  throw new Error(`Thread is archived: ${thread.id}`);
5805
5899
  }
5806
5900
  const queue = [...current.queue, prompt];
5901
+ this.crashContinued.delete(thread.id);
5807
5902
  this.haltDrain.delete(thread.id);
5808
- const patch = { queue, status: "queued" };
5903
+ const inFlight = this.activeTurns.has(thread.id) || this.startingTurns.has(thread.id) || current.status === "running";
5904
+ const patch = { queue };
5905
+ if (!inFlight) patch.status = "queued";
5809
5906
  const pid = current.agentPid;
5810
5907
  if (typeof pid === "number" && pid > 0 && !isPidAlive(pid)) {
5811
5908
  patch.agentPid = null;
5812
5909
  }
5813
5910
  updateThread(thread.id, patch);
5814
5911
  this.emit({ type: "queue_changed", threadId: thread.id, queue });
5815
- this.emit({ type: "status_changed", threadId: thread.id, status: "queued" });
5912
+ if (!inFlight) {
5913
+ this.emit({ type: "status_changed", threadId: thread.id, status: "queued" });
5914
+ }
5816
5915
  if (thisProcessShouldDrainAgentQueues()) {
5817
5916
  void this.drainQueue(thread.id);
5818
5917
  }
@@ -6034,7 +6133,7 @@ var Orchestrator = class {
6034
6133
  }
6035
6134
  const isBrightsy = fresh.agent === "brightsy";
6036
6135
  const isOrchestration = isOrchestratorThread(fresh);
6037
- const { autoRenameBranchEnabled, getGithubGitAuthMode } = await import("./app-settings-E7NEQY7D.js");
6136
+ const { autoRenameBranchEnabled, getGithubGitAuthMode } = await import("./app-settings-YQ7YX2CC.js");
6038
6137
  const gitAuthMode = getGithubGitAuthMode();
6039
6138
  const worktreeDirective = isBrightsy || isOrchestration ? null : formatWorktreeDirective(fresh, {
6040
6139
  githubSlug: await resolveGithubRepoSlug(fresh.worktreePath).catch(
@@ -6133,7 +6232,7 @@ var Orchestrator = class {
6133
6232
  let parts = result.parts;
6134
6233
  let usage = result.usage ?? void 0;
6135
6234
  let exitCode = result.exitCode;
6136
- if (this.requireThread(threadId).agent === "cursor" && exitCode !== 0 && !assistantText && parts.length === 0) {
6235
+ if (!this.stoppedTurns.has(threadId) && this.requireThread(threadId).agent === "cursor" && exitCode !== 0 && !assistantText && parts.length === 0) {
6137
6236
  const sessionId = result.sessionId || this.requireThread(threadId).sessionId || "";
6138
6237
  if (sessionId) {
6139
6238
  const { recoverFinishedCursorRun } = await import("./cursor-recover-NOQYOFRF.js");
@@ -6154,7 +6253,7 @@ var Orchestrator = class {
6154
6253
  }
6155
6254
  let lastStderr = summarizeTurnStderr(stderrTail);
6156
6255
  let detail = lastStderr || (exitCode !== 0 ? fallbackTurnFailDetail(assistantText) : "");
6157
- if (exitCode !== 0 && !assistantText && parts.length === 0 && !this.stoppedTurns.has(threadId) && this.requireThread(threadId).agent !== "brightsy" && shouldRetryFailedAgentTurn(detail, {
6256
+ if (exitCode !== 0 && !assistantText && parts.length === 0 && !this.stoppedTurns.has(threadId) && shouldRetryFailedAgentTurn(detail, {
6158
6257
  hasSession: Boolean(this.requireThread(threadId).sessionId)
6159
6258
  })) {
6160
6259
  updateThread(threadId, { sessionId: null });
@@ -6250,7 +6349,11 @@ var Orchestrator = class {
6250
6349
  )) {
6251
6350
  updateThread(threadId, { sessionId: null });
6252
6351
  }
6253
- await syncThreadBranchFromGit(threadId);
6352
+ if (this.stoppedTurns.has(threadId)) {
6353
+ void syncThreadBranchFromGit(threadId).catch(() => void 0);
6354
+ } else {
6355
+ await syncThreadBranchFromGit(threadId);
6356
+ }
6254
6357
  if (this.stoppedTurns.has(threadId)) {
6255
6358
  const stopped = writeLiveStatus(threadId, "stopped");
6256
6359
  if (stopped?.status === "stopped") {
@@ -6274,9 +6377,16 @@ var Orchestrator = class {
6274
6377
  });
6275
6378
  }
6276
6379
  this.emit({ type: "turn_finished", threadId, exitCode });
6277
- if (exitCode !== 0) {
6380
+ if (exitCode === 0) {
6381
+ this.crashContinued.delete(threadId);
6382
+ } else {
6278
6383
  const blob = [chatText, detail].filter(Boolean).join("\n");
6279
6384
  void this.maybeHandleOrchestrationQuotaFailover(threadId, blob);
6385
+ this.maybeEnqueueCrashContinue(threadId, {
6386
+ detail: detail || failDetail,
6387
+ assistantText: chatText,
6388
+ partsCount: parts.length
6389
+ });
6280
6390
  }
6281
6391
  }
6282
6392
  } catch (err) {
@@ -6296,6 +6406,11 @@ var Orchestrator = class {
6296
6406
  }
6297
6407
  this.emit({ type: "turn_finished", threadId, exitCode: 1 });
6298
6408
  void this.maybeHandleOrchestrationQuotaFailover(threadId, message);
6409
+ this.maybeEnqueueCrashContinue(threadId, {
6410
+ detail: message,
6411
+ assistantText: "",
6412
+ partsCount: 0
6413
+ });
6299
6414
  }
6300
6415
  } finally {
6301
6416
  this.startingTurns.delete(threadId);
@@ -6821,7 +6936,7 @@ var Orchestrator = class {
6821
6936
  updateThread(thread.id, { title: meta.title });
6822
6937
  }
6823
6938
  }
6824
- const { autoArchiveOnMergeEnabled } = await import("./app-settings-E7NEQY7D.js");
6939
+ const { autoArchiveOnMergeEnabled } = await import("./app-settings-YQ7YX2CC.js");
6825
6940
  const latest = this.requireThread(thread.id);
6826
6941
  if (!shouldAutoArchiveOnPrMerge({
6827
6942
  previousPrState: prevState || null,
@@ -7131,7 +7246,7 @@ var Orchestrator = class {
7131
7246
  this.emit({ type: "status_changed", threadId: archived.id, status: "archived" });
7132
7247
  if (thread.repoPath && !isGlobalRepoPath(thread.repoPath)) {
7133
7248
  try {
7134
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-HSYRYJYV.js");
7249
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-MINB764G.js");
7135
7250
  await ensureWorkspace2(thread.repoPath);
7136
7251
  } catch {
7137
7252
  }
@@ -7158,7 +7273,7 @@ var Orchestrator = class {
7158
7273
  await runArchiveScript(thread.repoPath, thread.worktreePath);
7159
7274
  } catch {
7160
7275
  }
7161
- const { deleteBranchOnPurgeEnabled } = await import("./app-settings-E7NEQY7D.js");
7276
+ const { deleteBranchOnPurgeEnabled } = await import("./app-settings-YQ7YX2CC.js");
7162
7277
  const deleteBranch = opts?.deleteBranch ?? deleteBranchOnPurgeEnabled();
7163
7278
  await removeWorktree(thread.repoPath, thread.worktreePath, {
7164
7279
  deleteBranch: deleteBranch ? thread.branchName : void 0
@@ -7185,7 +7300,7 @@ var Orchestrator = class {
7185
7300
  `Cowboy checkout missing: ${thread.worktreePath}. Re-add the project folder, then restore.`
7186
7301
  );
7187
7302
  }
7188
- const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-ERHC7Q4F.js");
7303
+ const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-EBZMUUAL.js");
7189
7304
  const slug = thread.worktreePath.split("/").pop();
7190
7305
  const dest = thread.worktreePath;
7191
7306
  await withRepoGitLock(thread.repoPath, async () => {
@@ -7293,7 +7408,7 @@ async function startOrchestration(opts) {
7293
7408
  sourceRef: "default",
7294
7409
  ...createOpts
7295
7410
  }).catch(async () => {
7296
- const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-ERHC7Q4F.js");
7411
+ const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-EBZMUUAL.js");
7297
7412
  const repo = await resolveRepoRoot2(repoPath);
7298
7413
  const def = await resolveDefaultBranch2(repo);
7299
7414
  return orch.createThread({
@@ -7327,6 +7442,7 @@ export {
7327
7442
  HOME_BOARD_CACHE_TTL_MS,
7328
7443
  dedupeBoardIssues,
7329
7444
  issueNeedsWorkspacePick,
7445
+ isAccountWideIssueSource,
7330
7446
  findLiveThreadForCreate,
7331
7447
  findBoardPin,
7332
7448
  syncBoardPins,
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  getGithubGitAuthMode,
6
6
  getGithubPat
7
- } from "./chunk-HUYEU4GS.js";
7
+ } from "./chunk-GJBHOJCZ.js";
8
8
  import {
9
9
  listThreads
10
10
  } from "./chunk-HLJUNJBF.js";
@@ -2,11 +2,11 @@
2
2
 
3
3
  import {
4
4
  isGlobalRepoPath
5
- } from "./chunk-MNL4FSKY.js";
5
+ } from "./chunk-YEIH7P7D.js";
6
6
  import {
7
7
  ensureGhPreferOrigin,
8
8
  resolveRepoRoot
9
- } from "./chunk-HRSBZIXS.js";
9
+ } from "./chunk-Q6XQXCOM.js";
10
10
  import {
11
11
  appDataDir
12
12
  } from "./chunk-BD2ICC4D.js";
@@ -2,12 +2,12 @@
2
2
 
3
3
  import {
4
4
  ensureGlobalCoordinatorCwd
5
- } from "./chunk-RSFCB23A.js";
5
+ } from "./chunk-6CRKPD4C.js";
6
6
  import {
7
7
  allocateTeamName,
8
8
  takenSlugsFromThread,
9
9
  teamSlugFromName
10
- } from "./chunk-HRSBZIXS.js";
10
+ } from "./chunk-Q6XQXCOM.js";
11
11
  import {
12
12
  createEmptyThread,
13
13
  listThreads,
@@ -17,7 +17,7 @@ import {
17
17
  import {
18
18
  resolveNewThreadOptions,
19
19
  resolveThreadDefaults
20
- } from "./chunk-ZND6XV6J.js";
20
+ } from "./chunk-GKKHXZCT.js";
21
21
  import {
22
22
  globalAgentCwd
23
23
  } from "./chunk-BD2ICC4D.js";
@@ -7,7 +7,9 @@ import {
7
7
  ensureConnectedBrightsyTeamTokens,
8
8
  getConnectedBrightsyTeamsRaw,
9
9
  listConnectedBrightsyTeams
10
- } from "./chunk-EKIDHL2T.js";
10
+ } from "./chunk-KBWND62T.js";
11
+ import "./chunk-M267JPEA.js";
12
+ import "./chunk-ELBYOGVA.js";
11
13
  import "./chunk-QZQEXME2.js";
12
14
  import "./chunk-DVM4ID64.js";
13
15
  export {
@@ -9,7 +9,9 @@ import {
9
9
  ensureConnectedBrightsyTeamTokens,
10
10
  getConnectedBrightsyTeamsRaw,
11
11
  listConnectedBrightsyTeams
12
- } from "./chunk-YMRT2DU6.js";
12
+ } from "./chunk-ED4UPEJX.js";
13
+ import "./chunk-S42XV45P.js";
14
+ import "./chunk-6GN5WPYZ.js";
13
15
  import "./chunk-KPIYENTF.js";
14
16
  import "./chunk-BD2ICC4D.js";
15
17
  export {
@@ -9,12 +9,12 @@ import {
9
9
  enrichWorkspacesWithGithub,
10
10
  ensureGlobalCoordinatorCwd,
11
11
  formatWorkspaceInventory
12
- } from "./chunk-RSFCB23A.js";
13
- import "./chunk-HRSBZIXS.js";
12
+ } from "./chunk-6CRKPD4C.js";
13
+ import "./chunk-Q6XQXCOM.js";
14
14
  import "./chunk-B3SJXYIJ.js";
15
15
  import "./chunk-G6X6UFJO.js";
16
16
  import "./chunk-KPIYENTF.js";
17
- import "./chunk-ZND6XV6J.js";
17
+ import "./chunk-GKKHXZCT.js";
18
18
  import "./chunk-NSTQ6QKD.js";
19
19
  import "./chunk-KGZBYWZ3.js";
20
20
  import "./chunk-BD2ICC4D.js";
@@ -7,10 +7,10 @@ import {
7
7
  enrichWorkspacesWithGithub,
8
8
  ensureGlobalCoordinatorCwd,
9
9
  formatWorkspaceInventory
10
- } from "./chunk-HZPO3SSZ.js";
11
- import "./chunk-UDQI3N47.js";
10
+ } from "./chunk-IM36S4HZ.js";
11
+ import "./chunk-WEU5M7BW.js";
12
12
  import "./chunk-FKOIHGKV.js";
13
- import "./chunk-HUYEU4GS.js";
13
+ import "./chunk-GJBHOJCZ.js";
14
14
  import "./chunk-4TR3HZFT.js";
15
15
  import "./chunk-JT7R45JB.js";
16
16
  import "./chunk-HLJUNJBF.js";
@@ -17,13 +17,13 @@ import {
17
17
  orchestratorSessionPoisonedByBuiltins,
18
18
  slackCoordinatorSourceRef,
19
19
  takenTeamSlugsForOrchestration
20
- } from "./chunk-MNL4FSKY.js";
21
- import "./chunk-RSFCB23A.js";
22
- import "./chunk-HRSBZIXS.js";
20
+ } from "./chunk-YEIH7P7D.js";
21
+ import "./chunk-6CRKPD4C.js";
22
+ import "./chunk-Q6XQXCOM.js";
23
23
  import "./chunk-B3SJXYIJ.js";
24
24
  import "./chunk-G6X6UFJO.js";
25
25
  import "./chunk-KPIYENTF.js";
26
- import "./chunk-ZND6XV6J.js";
26
+ import "./chunk-GKKHXZCT.js";
27
27
  import "./chunk-NSTQ6QKD.js";
28
28
  import "./chunk-KGZBYWZ3.js";
29
29
  import {
@@ -15,11 +15,11 @@ import {
15
15
  orchestratorSessionPoisonedByBuiltins,
16
16
  slackCoordinatorSourceRef,
17
17
  takenTeamSlugsForOrchestration
18
- } from "./chunk-HULESWLI.js";
19
- import "./chunk-HZPO3SSZ.js";
20
- import "./chunk-UDQI3N47.js";
18
+ } from "./chunk-LTP7GHIF.js";
19
+ import "./chunk-IM36S4HZ.js";
20
+ import "./chunk-WEU5M7BW.js";
21
21
  import "./chunk-FKOIHGKV.js";
22
- import "./chunk-HUYEU4GS.js";
22
+ import "./chunk-GJBHOJCZ.js";
23
23
  import "./chunk-4TR3HZFT.js";
24
24
  import "./chunk-JT7R45JB.js";
25
25
  import "./chunk-HLJUNJBF.js";