@sideboard-ai/core 0.1.148 → 0.1.150

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 (60) hide show
  1. package/dist/{abletime-QEVAE67D.js → abletime-223A3LY6.js} +2 -2
  2. package/dist/{abletime-DI55AJX3.js → abletime-CLC5UJC2.js} +2 -2
  3. package/dist/agents/cursor-runner.cjs +85 -45
  4. package/dist/agents/cursor-runner.js +47 -12
  5. package/dist/{agents-DUF4Q2ZI.js → agents-KKXGTEV6.js} +10 -9
  6. package/dist/{agents-INCTFWKA.js → agents-YWBQXOA2.js} +10 -9
  7. package/dist/{app-settings-WJDCJFSY.js → app-settings-3CHCNIMD.js} +5 -1
  8. package/dist/{app-settings-ZCN632OJ.js → app-settings-J3JBCUOT.js} +5 -1
  9. package/dist/{chunk-I77RYPOH.js → chunk-4XNSGDXE.js} +12 -0
  10. package/dist/{chunk-KBWND62T.js → chunk-7F4XE6UG.js} +5 -5
  11. package/dist/{chunk-R4JP32P5.js → chunk-AF6O55PJ.js} +4 -4
  12. package/dist/{chunk-BOD5V52W.js → chunk-B7XK37WZ.js} +1 -1
  13. package/dist/{chunk-BGQBELGJ.js → chunk-CZD4NRDZ.js} +12 -0
  14. package/dist/{chunk-ZVYLEF72.js → chunk-DMRIZR6M.js} +6 -6
  15. package/dist/{chunk-5MS2XTNV.js → chunk-DXCNW2JF.js} +113 -52
  16. package/dist/{chunk-KPIYENTF.js → chunk-FNQNJOHY.js} +89 -5
  17. package/dist/{chunk-ED4UPEJX.js → chunk-G7SIQFBQ.js} +1 -1
  18. package/dist/{chunk-3QRGCKYL.js → chunk-HAS5EPBS.js} +2 -2
  19. package/dist/{chunk-WT5HSFOU.js → chunk-HEII7W3Q.js} +5 -2
  20. package/dist/{chunk-EGDRPA4B.js → chunk-NOTANBYC.js} +6 -6
  21. package/dist/{chunk-CTXQHSTY.js → chunk-NUPITVRF.js} +134 -73
  22. package/dist/{chunk-QTUESPAW.js → chunk-PTOSP4AH.js} +1 -1
  23. package/dist/{chunk-Q62SDB53.js → chunk-QGJHIJHV.js} +2 -2
  24. package/dist/{chunk-YQRBNOIW.js → chunk-SDN4ZYQH.js} +24 -13
  25. package/dist/{chunk-DVM4ID64.js → chunk-UFHNSFAS.js} +89 -5
  26. package/dist/{chunk-N3VNOFXQ.js → chunk-VO4SPEBS.js} +4 -4
  27. package/dist/chunk-VSFGPWCQ.js +62 -0
  28. package/dist/{chunk-N5PM7HGQ.js → chunk-W6N6GQME.js} +1 -1
  29. package/dist/{chunk-FKOIHGKV.js → chunk-WHU7YGWP.js} +1 -1
  30. package/dist/{chunk-VZJVKQHH.js → chunk-WLV7TRMR.js} +1 -1
  31. package/dist/chunk-Y4NAPW5I.js +60 -0
  32. package/dist/{chunk-B3SJXYIJ.js → chunk-Y7YBWWIG.js} +1 -1
  33. package/dist/{chunk-XOKHXFFX.js → chunk-YGGBJY5A.js} +22 -8
  34. package/dist/{chunk-JTPDWTWJ.js → chunk-Z2PVJKMN.js} +137 -114
  35. package/dist/{chunk-YP3CSOZ6.js → chunk-ZGFYFVJF.js} +142 -114
  36. package/dist/{connected-teams-IJUJQ7R6.js → connected-teams-I2WZZZFA.js} +2 -2
  37. package/dist/{connected-teams-4A2AXDNN.js → connected-teams-XO766HB4.js} +2 -2
  38. package/dist/{coordinator-prompt-ZWBMAIWA.js → coordinator-prompt-NYR5TPBD.js} +6 -5
  39. package/dist/{coordinator-prompt-5GXGBGEZ.js → coordinator-prompt-UCQJTFA7.js} +6 -5
  40. package/dist/{global-workspace-2SIPM4PW.js → global-workspace-4QHDAD2D.js} +7 -6
  41. package/dist/{global-workspace-OJRXWXEA.js → global-workspace-4SENNWBU.js} +7 -6
  42. package/dist/index.cjs +1002 -575
  43. package/dist/index.d.cts +91 -10
  44. package/dist/index.d.ts +91 -10
  45. package/dist/index.js +268 -93
  46. package/dist/mcp/run-stdio.cjs +980 -580
  47. package/dist/mcp/run-stdio.js +196 -43
  48. package/dist/{orchestrator-OVYITCO6.js → orchestrator-GZE4X3XV.js} +14 -11
  49. package/dist/{orchestrator-NWIU5TJP.js → orchestrator-QSBRWME5.js} +16 -13
  50. package/dist/{plan-file-6O7G4VPQ.js → plan-file-5S5TUNAW.js} +2 -2
  51. package/dist/{plan-file-PHVKUAEE.js → plan-file-IBSU2PVW.js} +2 -2
  52. package/dist/{run-XQKGHQZ2.js → run-CAGKZLHA.js} +1 -1
  53. package/dist/{run-USF6FRKV.js → run-EBWL2Q4N.js} +1 -1
  54. package/dist/{workspaces-UUJNOO4T.js → workspaces-7S7QKCUE.js} +8 -7
  55. package/dist/{workspaces-3NUUZTQK.js → workspaces-RDUSB6FD.js} +8 -7
  56. package/dist/{worktree-RZRJNHYL.js → worktree-63AGPPLO.js} +5 -4
  57. package/dist/{worktree-UCWWTVLS.js → worktree-JIZ3QMZX.js} +5 -4
  58. package/dist/worktree-exclude-6MQWGWV5.js +11 -0
  59. package/dist/worktree-exclude-TV6EV6BS.js +9 -0
  60. package/package.json +1 -1
@@ -1,3 +1,8 @@
1
+ import {
2
+ extractPresentedPlan,
3
+ readPlanFile,
4
+ writePlanFile
5
+ } from "./chunk-PTOSP4AH.js";
1
6
  import {
2
7
  PLAN_MODE_INSTRUCTION,
3
8
  allAdapters,
@@ -7,6 +12,7 @@ import {
7
12
  finalizeParts,
8
13
  getAdapter,
9
14
  isBrightsyNdjsonLine,
15
+ isInternalAgentStatusText,
10
16
  isPollWrapperToolName,
11
17
  isSessionQuotaLimit,
12
18
  liveActivitySummary,
@@ -18,13 +24,13 @@ import {
18
24
  stripBrightsyNdjsonNoise,
19
25
  sumUsageList,
20
26
  toolDescription
21
- } from "./chunk-YQRBNOIW.js";
27
+ } from "./chunk-SDN4ZYQH.js";
22
28
  import {
23
29
  addWorkspace,
24
30
  ensureWorkspace,
25
31
  removeWorkspace,
26
32
  syncWorkspacesFromThreads
27
- } from "./chunk-3QRGCKYL.js";
33
+ } from "./chunk-HAS5EPBS.js";
28
34
  import {
29
35
  assertOrchestratorCapableAgent,
30
36
  attachmentsFromWorktreePaths,
@@ -41,43 +47,14 @@ import {
41
47
  persistPendingFileAttachments,
42
48
  stageAbsolutePathsAsAttachments,
43
49
  stageBuffersAsAttachments
44
- } from "./chunk-R4JP32P5.js";
50
+ } from "./chunk-AF6O55PJ.js";
45
51
  import {
46
52
  SLACK_REPLY_FORMATTING,
47
53
  coordinatorSystemPrompt,
48
54
  coordinatorTurnReminder,
49
55
  enrichWorkspacesWithGithub,
50
56
  ensureGlobalCoordinatorCwd
51
- } from "./chunk-EGDRPA4B.js";
52
- import {
53
- httpFetch
54
- } from "./chunk-ELBYOGVA.js";
55
- import {
56
- extractPresentedPlan,
57
- readPlanFile,
58
- writePlanFile
59
- } from "./chunk-QTUESPAW.js";
60
- import {
61
- createAgentStreamCoalescer
62
- } from "./chunk-AXQ4ZWHK.js";
63
- import {
64
- applyAgentRunnerHeapEnv,
65
- fallbackTurnFailDetail,
66
- formatAgentErrorContinuePrompt,
67
- formatTurnExitError,
68
- looksLikeAgentFailureMessage,
69
- looksLikeInvalidAgentSession,
70
- looksLikeV8Oom,
71
- packagedMcpDir,
72
- pushTurnStderr,
73
- shouldFeedErrorBackToAgent,
74
- shouldRetryFailedAgentTurn,
75
- summarizeTurnStderr,
76
- turnFailChatText
77
- } from "./chunk-WT5HSFOU.js";
78
- import {
79
- releaseCaffeinateHoldForThread
80
- } from "./chunk-DCOZABNT.js";
57
+ } from "./chunk-NOTANBYC.js";
81
58
  import {
82
59
  addPrStackLayer,
83
60
  allocateTeamName,
@@ -125,11 +102,32 @@ import {
125
102
  withRepoGitLock,
126
103
  worktreeDisplayLabelForGroup,
127
104
  worktreeNameFromPath
128
- } from "./chunk-YP3CSOZ6.js";
105
+ } from "./chunk-ZGFYFVJF.js";
129
106
  import {
130
107
  ATTACHMENTS_DIR,
131
108
  LEGACY_ATTACHMENTS_DIR
132
- } from "./chunk-FKOIHGKV.js";
109
+ } from "./chunk-WHU7YGWP.js";
110
+ import {
111
+ httpFetch
112
+ } from "./chunk-ELBYOGVA.js";
113
+ import {
114
+ createAgentStreamCoalescer
115
+ } from "./chunk-AXQ4ZWHK.js";
116
+ import {
117
+ applyAgentRunnerHeapEnv,
118
+ fallbackTurnFailDetail,
119
+ formatAgentErrorContinuePrompt,
120
+ formatTurnExitError,
121
+ looksLikeAgentFailureMessage,
122
+ looksLikeInvalidAgentSession,
123
+ looksLikeV8Oom,
124
+ packagedMcpDir,
125
+ pushTurnStderr,
126
+ shouldFeedErrorBackToAgent,
127
+ shouldRetryFailedAgentTurn,
128
+ summarizeTurnStderr,
129
+ turnFailChatText
130
+ } from "./chunk-HEII7W3Q.js";
133
131
  import {
134
132
  childEnvWithAppSettings,
135
133
  getIssueSource,
@@ -145,10 +143,13 @@ import {
145
143
  saveAppSettings,
146
144
  updateAdvancedSettings,
147
145
  writeSecureJson
148
- } from "./chunk-I77RYPOH.js";
146
+ } from "./chunk-4XNSGDXE.js";
149
147
  import {
150
148
  stripNestedElectronEnv
151
149
  } from "./chunk-4TR3HZFT.js";
150
+ import {
151
+ releaseCaffeinateHoldForThread
152
+ } from "./chunk-DCOZABNT.js";
152
153
  import {
153
154
  writePrivateFile
154
155
  } from "./chunk-JT7R45JB.js";
@@ -176,6 +177,9 @@ import {
176
177
  workspaceSettingsSourceLabel,
177
178
  worktreesRoot
178
179
  } from "./chunk-QZQEXME2.js";
180
+ import {
181
+ ensureWorktreeSideboardIgnored
182
+ } from "./chunk-Y4NAPW5I.js";
179
183
  import {
180
184
  clearStaleIndexLocks,
181
185
  enrichPathWithNpmGlobalBin,
@@ -183,7 +187,7 @@ import {
183
187
  git,
184
188
  resolveGitDirsForLockRecovery,
185
189
  run
186
- } from "./chunk-DVM4ID64.js";
190
+ } from "./chunk-UFHNSFAS.js";
187
191
 
188
192
  // src/orchestrator/orchestrator.ts
189
193
  import { EventEmitter } from "events";
@@ -456,7 +460,7 @@ async function continueSourceThread(threadId, prompt) {
456
460
  await continueOnReply(threadId, prompt);
457
461
  return;
458
462
  }
459
- const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-NWIU5TJP.js");
463
+ const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-QSBRWME5.js");
460
464
  await getOrchestrator2().send(threadId, prompt);
461
465
  } catch {
462
466
  }
@@ -736,9 +740,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
736
740
  `Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
737
741
  );
738
742
  }
739
- const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-OJRXWXEA.js");
743
+ const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-4SENNWBU.js");
740
744
  if (isGlobalThread2(thread)) {
741
- const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-ZWBMAIWA.js");
745
+ const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-NYR5TPBD.js");
742
746
  ensureGlobalCoordinatorCwd2(
743
747
  isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
744
748
  );
@@ -2002,6 +2006,7 @@ async function runConventionSetup(repoPath, worktreePath, onLine, opts) {
2002
2006
  };
2003
2007
  }
2004
2008
  async function runWorkspaceSetup(repoPath, worktreePath, onLine, opts) {
2009
+ await ensureWorktreeSideboardIgnored(worktreePath);
2005
2010
  const reviewSkill = ensureReviewSkillFile(worktreePath);
2006
2011
  if (reviewSkill.wrote) {
2007
2012
  onLine?.(
@@ -2942,7 +2947,7 @@ async function createThread(input, _onSetupLine) {
2942
2947
  });
2943
2948
  await requireAgent(resolved.agent);
2944
2949
  if (input.cowboy) {
2945
- const { cowboyModeEnabled } = await import("./app-settings-WJDCJFSY.js");
2950
+ const { cowboyModeEnabled } = await import("./app-settings-3CHCNIMD.js");
2946
2951
  if (!cowboyModeEnabled()) {
2947
2952
  throw new Error(
2948
2953
  "Cowboy mode is off. Enable it in Settings \u2192 Advanced."
@@ -3000,7 +3005,7 @@ async function createThread(input, _onSetupLine) {
3000
3005
  let sourceIsFork = false;
3001
3006
  if (!input.cowboy && sourceType === "branch" && (!sourceRef || sourceRef === "HEAD" || sourceRef === "default")) {
3002
3007
  if (isAbleTimeConnected() && getIssueSource() === "abletime") {
3003
- const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-QEVAE67D.js");
3008
+ const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-223A3LY6.js");
3004
3009
  const task = await ensureAbleTimeTask({
3005
3010
  title: title?.trim() || "Untitled work",
3006
3011
  description: input.prompt?.trim() || void 0
@@ -3073,7 +3078,7 @@ async function createThread(input, _onSetupLine) {
3073
3078
  return readThread(thread.id) ?? thread;
3074
3079
  }
3075
3080
  async function listLinearIssues(agent, repoPath) {
3076
- const { getAdapter: getAdapter2 } = await import("./agents-DUF4Q2ZI.js");
3081
+ const { getAdapter: getAdapter2 } = await import("./agents-KKXGTEV6.js");
3077
3082
  await requireAgent(agent, { requireLinear: true });
3078
3083
  const adapter = getAdapter2(agent);
3079
3084
  if (!adapter.listLinearIssues) {
@@ -3465,7 +3470,7 @@ async function adoptThread(input) {
3465
3470
  throw new Error(`Worktree not found: ${input.worktreePath}`);
3466
3471
  }
3467
3472
  const repoPath = await resolveRepoRoot(input.worktreePath);
3468
- const { stdout: branch } = await import("./run-XQKGHQZ2.js").then(
3473
+ const { stdout: branch } = await import("./run-CAGKZLHA.js").then(
3469
3474
  ({ git: git2 }) => git2(["rev-parse", "--abbrev-ref", "HEAD"], input.worktreePath)
3470
3475
  );
3471
3476
  const thread = createEmptyThread({
@@ -3480,8 +3485,10 @@ async function adoptThread(input) {
3480
3485
  messages: input.messages ?? []
3481
3486
  });
3482
3487
  writeThread(thread);
3483
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-3NUUZTQK.js");
3488
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-RDUSB6FD.js");
3484
3489
  await ensureWorkspace2(repoPath);
3490
+ const { ensureWorktreeSideboardIgnored: ensureWorktreeSideboardIgnored2 } = await import("./worktree-exclude-TV6EV6BS.js");
3491
+ await ensureWorktreeSideboardIgnored2(input.worktreePath);
3485
3492
  return thread;
3486
3493
  }
3487
3494
  function conductorDbPath() {
@@ -4790,7 +4797,7 @@ async function confirmLand(thread, opts) {
4790
4797
  if (preview.dirty) {
4791
4798
  committed = await commitAll(thread.worktreePath, meta.commitMessage);
4792
4799
  }
4793
- const { git: git2 } = await import("./run-XQKGHQZ2.js");
4800
+ const { git: git2 } = await import("./run-CAGKZLHA.js");
4794
4801
  const { stdout: headOut } = await git2(
4795
4802
  ["rev-parse", "--abbrev-ref", "HEAD"],
4796
4803
  thread.worktreePath,
@@ -5243,11 +5250,11 @@ function formatWorktreeDirective(thread, opts) {
5243
5250
  );
5244
5251
  } else if (opts?.githubSlug) {
5245
5252
  lines.push(
5246
- `- Prefer a draft PR first: \`gh pr create --draft -R ${opts.githubSlug}\` (or update via \`gh pr edit -R ${opts.githubSlug}\`) once the change set is coherent. Always pass \`-R ${opts.githubSlug}\` (this worktree's origin). Bare \`gh pr create\` may target upstream instead of origin on dual-remote checkouts. Mark ready for review only when asked. Title/body must reflect the change purpose, not the worktree name.`
5253
+ `- Prefer a draft PR first: \`gh pr create --draft -R ${opts.githubSlug}\` (or update via \`gh pr edit -R ${opts.githubSlug}\`) once the change set is coherent. Always pass \`-R ${opts.githubSlug}\` (this worktree's origin). Bare \`gh pr create\` may target upstream instead of origin on dual-remote checkouts. Mark ready for review only when asked. Title/body must reflect the change purpose, not the worktree name. If GitHub rejects the GraphQL body as too long, retry with a short \`--body-file\` (limit 65,536 characters) \u2014 do not paste a changelog or diff into \`--body\`.`
5247
5254
  );
5248
5255
  } else {
5249
5256
  lines.push(
5250
- "- Prefer a draft PR first: `gh pr create --draft -R <origin-owner/name>` (or update via `gh pr edit -R \u2026`) once the change set is coherent. Resolve `<origin-owner/name>` with `git remote get-url origin` in this worktree \u2014 never from `upstream`. Mark ready for review only when asked. Title/body must reflect the change purpose, not the worktree name."
5257
+ "- Prefer a draft PR first: `gh pr create --draft -R <origin-owner/name>` (or update via `gh pr edit -R \u2026`) once the change set is coherent. Resolve `<origin-owner/name>` with `git remote get-url origin` in this worktree \u2014 never from `upstream`. Mark ready for review only when asked. Title/body must reflect the change purpose, not the worktree name. If GitHub rejects the GraphQL body as too long, retry with a short `--body-file` (limit 65,536 characters) \u2014 do not paste a changelog or diff into `--body`."
5251
5258
  );
5252
5259
  }
5253
5260
  lines.push("");
@@ -5928,7 +5935,7 @@ function formatScheduledPrompt(name, prompt) {
5928
5935
  ${prompt}`;
5929
5936
  }
5930
5937
  async function defaultDeps() {
5931
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-NWIU5TJP.js");
5938
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-QSBRWME5.js");
5932
5939
  const orch = getOrchestrator2();
5933
5940
  return {
5934
5941
  findThread: (id) => findThreadByRef(id),
@@ -6032,6 +6039,7 @@ function armSchedules() {
6032
6039
  }
6033
6040
 
6034
6041
  // src/orchestrator/orchestrator.ts
6042
+ var LIVE_TURN_SPAWN_GRACE_MS = 15e3;
6035
6043
  function isPidAlive(pid) {
6036
6044
  if (!Number.isFinite(pid) || pid <= 0) return false;
6037
6045
  try {
@@ -6110,6 +6118,39 @@ var Orchestrator = class {
6110
6118
  if (typeof pid === "number" && pid > 0 && isPidAlive(pid)) return false;
6111
6119
  return true;
6112
6120
  }
6121
+ /**
6122
+ * Whether a child is actually turning — not leftover disk `running` after
6123
+ * the process died. Coordinators were telling users “Agent is running.
6124
+ * Waiting for gate to pass” from stale stillRunning.
6125
+ */
6126
+ threadLooksLive(thread) {
6127
+ if (thread.status === "queued") {
6128
+ if (this.draining.has(thread.id) || this.startingTurns.has(thread.id)) return true;
6129
+ return thread.queue.length > 0;
6130
+ }
6131
+ if (thread.status !== "running") return false;
6132
+ if (this.activeTurns.has(thread.id) || this.startingTurns.has(thread.id)) return true;
6133
+ const pid = thread.agentPid;
6134
+ if (typeof pid === "number" && pid > 0 && isPidAlive(pid)) return true;
6135
+ const updated = Date.parse(thread.updatedAt ?? "");
6136
+ if (Number.isFinite(updated) && Date.now() - updated < LIVE_TURN_SPAWN_GRACE_MS) return true;
6137
+ return false;
6138
+ }
6139
+ /** Desktop-only: persist idle/stopped when MCP would otherwise keep reporting live. */
6140
+ healStaleReportedActivity(thread) {
6141
+ if (!thisProcessShouldDrainAgentQueues()) return thread;
6142
+ if (this.threadLooksLive(thread)) return thread;
6143
+ if (thread.status === "running") {
6144
+ this.healStaleRunningTurns();
6145
+ return readThread(thread.id) ?? thread;
6146
+ }
6147
+ if (thread.status === "queued" && thread.queue.length === 0 && !this.activeTurns.has(thread.id) && !this.startingTurns.has(thread.id) && !this.draining.has(thread.id)) {
6148
+ setStatus(thread.id, "idle");
6149
+ this.emit({ type: "status_changed", threadId: thread.id, status: "idle" });
6150
+ return readThread(thread.id) ?? thread;
6151
+ }
6152
+ return thread;
6153
+ }
6113
6154
  async reconcile(repoPath, opts) {
6114
6155
  const reclaimStaleTurns = opts?.reclaimStaleTurns === true;
6115
6156
  const drainQueues = opts?.drainQueues !== false;
@@ -6153,7 +6194,7 @@ var Orchestrator = class {
6153
6194
  orphans: orphans.map((o) => ({ path: o.path, repoPath: o.repoPath }))
6154
6195
  });
6155
6196
  }
6156
- const { autoCleanupOrphansEnabled } = await import("./app-settings-WJDCJFSY.js");
6197
+ const { autoCleanupOrphansEnabled } = await import("./app-settings-3CHCNIMD.js");
6157
6198
  if (autoCleanupOrphansEnabled() && shouldRunWorktreeCleanup() && orphans.length > 0) {
6158
6199
  await cleanupOrphanWorktrees({ repoPaths });
6159
6200
  }
@@ -6393,7 +6434,7 @@ var Orchestrator = class {
6393
6434
  }
6394
6435
  await setup;
6395
6436
  if (skipSetup) return;
6396
- const { autoRunAfterSetupEnabled } = await import("./app-settings-WJDCJFSY.js");
6437
+ const { autoRunAfterSetupEnabled } = await import("./app-settings-3CHCNIMD.js");
6397
6438
  if (autoRunAfterSetupEnabled()) {
6398
6439
  try {
6399
6440
  await this.startDev(threadId);
@@ -6444,12 +6485,14 @@ var Orchestrator = class {
6444
6485
  this.emit({ type: "status_changed", threadId: thread.id, status: thread.status });
6445
6486
  return thread;
6446
6487
  }
6447
- async send(threadRef, prompt) {
6488
+ async send(threadRef, prompt, opts) {
6448
6489
  const thread = this.requireThread(threadRef);
6449
6490
  if (thread.status === "archived") {
6450
6491
  throw new Error(`Thread is archived: ${thread.id}`);
6451
6492
  }
6452
- return withThreadLock(thread.id, async () => {
6493
+ const followUp = opts?.followUp === "steer" ? "steer" : "queue";
6494
+ let shouldSteer = false;
6495
+ const sent = await withThreadLock(thread.id, async () => {
6453
6496
  const current = this.requireThread(thread.id);
6454
6497
  if (current.status === "archived") {
6455
6498
  throw new Error(`Thread is archived: ${thread.id}`);
@@ -6458,6 +6501,7 @@ var Orchestrator = class {
6458
6501
  this.crashContinued.delete(thread.id);
6459
6502
  this.haltDrain.delete(thread.id);
6460
6503
  const inFlight = this.activeTurns.has(thread.id) || this.startingTurns.has(thread.id) || current.status === "running";
6504
+ shouldSteer = followUp === "steer" && (inFlight || current.queue.length > 0);
6461
6505
  const patch = { queue };
6462
6506
  if (!inFlight) patch.status = "queued";
6463
6507
  const pid = current.agentPid;
@@ -6469,16 +6513,20 @@ var Orchestrator = class {
6469
6513
  if (!inFlight) {
6470
6514
  this.emit({ type: "status_changed", threadId: thread.id, status: "queued" });
6471
6515
  }
6472
- if (thisProcessShouldDrainAgentQueues()) {
6516
+ if (thisProcessShouldDrainAgentQueues() && !shouldSteer) {
6473
6517
  void this.drainQueue(thread.id);
6474
6518
  }
6475
6519
  return this.requireThread(thread.id);
6476
6520
  });
6521
+ if (shouldSteer && sent.queue.length > 0) {
6522
+ return this.sendQueuedMessageNow(sent.id, sent.queue.length - 1);
6523
+ }
6524
+ return sent;
6477
6525
  }
6478
- async fanOut(threadRefs, prompt) {
6526
+ async fanOut(threadRefs, prompt, opts) {
6479
6527
  const results = [];
6480
6528
  for (const ref of threadRefs) {
6481
- results.push(await this.send(ref, prompt));
6529
+ results.push(await this.send(ref, prompt, opts));
6482
6530
  }
6483
6531
  return results;
6484
6532
  }
@@ -6694,7 +6742,7 @@ var Orchestrator = class {
6694
6742
  }
6695
6743
  const isBrightsy = fresh.agent === "brightsy";
6696
6744
  const isOrchestration = isOrchestratorThread(fresh);
6697
- const { autoRenameBranchEnabled, getGithubGitAuthMode } = await import("./app-settings-WJDCJFSY.js");
6745
+ const { autoRenameBranchEnabled, getGithubGitAuthMode } = await import("./app-settings-3CHCNIMD.js");
6698
6746
  const gitAuthMode = getGithubGitAuthMode();
6699
6747
  const worktreeDirective = isBrightsy || isOrchestration ? null : formatWorktreeDirective(fresh, {
6700
6748
  githubSlug: await resolveGithubRepoSlug(fresh.worktreePath).catch(
@@ -7282,8 +7330,8 @@ var Orchestrator = class {
7282
7330
  return created;
7283
7331
  }
7284
7332
  async waitForTurn(threadRef, timeoutMs = 6e5, opts) {
7285
- const thread = this.requireThread(threadRef);
7286
- if (!["running", "queued"].includes(thread.status)) {
7333
+ const thread = this.healStaleReportedActivity(this.requireThread(threadRef));
7334
+ if (!this.threadLooksLive(thread)) {
7287
7335
  return thread;
7288
7336
  }
7289
7337
  const start = Date.now();
@@ -7320,12 +7368,13 @@ var Orchestrator = class {
7320
7368
  }
7321
7369
  });
7322
7370
  timer = setInterval(() => {
7323
- const current = readThread(thread.id);
7324
- if (!current) {
7371
+ const raw = readThread(thread.id);
7372
+ if (!raw) {
7325
7373
  finish(() => reject(new Error(`Thread not found: ${thread.id}`)));
7326
7374
  return;
7327
7375
  }
7328
- if (!["running", "queued"].includes(current.status)) {
7376
+ const current = this.healStaleReportedActivity(raw);
7377
+ if (!this.threadLooksLive(current)) {
7329
7378
  finish(() => resolve(current));
7330
7379
  return;
7331
7380
  }
@@ -7348,20 +7397,22 @@ var Orchestrator = class {
7348
7397
  };
7349
7398
  }
7350
7399
  getTurnResult(threadRef) {
7351
- const thread = this.requireThread(threadRef);
7400
+ const thread = this.healStaleReportedActivity(this.requireThread(threadRef));
7352
7401
  const lastAgent = [...thread.messages].reverse().find((m) => m.role === "agent");
7353
7402
  const lastError = thread.lastError ?? null;
7354
- const text = (lastAgent?.text ?? "").trim() || (thread.status === "error" || thread.status === "stopped" || thread.status === "broken" ? lastError ?? "" : "");
7355
- const stillRunning = thread.status === "running" || thread.status === "queued";
7403
+ const rawText = (lastAgent?.text ?? "").trim();
7404
+ const text = (rawText && !isInternalAgentStatusText(rawText) ? rawText : "") || (thread.status === "error" || thread.status === "stopped" || thread.status === "broken" ? lastError ?? "" : "");
7405
+ const stillRunning = this.threadLooksLive(thread);
7356
7406
  const live = stillRunning ? readTurnLive(thread.id) : null;
7357
- const queuedHint = thread.status === "queued" && !live?.summary ? "Queued \u2014 waiting for a concurrency slot" : null;
7407
+ const liveSummary = live?.summary && !isInternalAgentStatusText(live.summary) ? live.summary : null;
7408
+ const queuedHint = stillRunning && thread.status === "queued" && !liveSummary ? "Queued \u2014 waiting for a concurrency slot" : null;
7358
7409
  return {
7359
7410
  text,
7360
7411
  status: thread.status,
7361
7412
  sessionId: thread.sessionId,
7362
7413
  lastError,
7363
7414
  stillRunning,
7364
- progress: live?.summary ?? queuedHint,
7415
+ progress: liveSummary ?? queuedHint,
7365
7416
  lastActivityAt: live?.updatedAt ?? null,
7366
7417
  usage: lastAgent?.usage ?? null
7367
7418
  };
@@ -7554,7 +7605,7 @@ var Orchestrator = class {
7554
7605
  updateThread(thread.id, { title: meta.title });
7555
7606
  }
7556
7607
  }
7557
- const { autoArchiveOnMergeEnabled } = await import("./app-settings-WJDCJFSY.js");
7608
+ const { autoArchiveOnMergeEnabled } = await import("./app-settings-3CHCNIMD.js");
7558
7609
  const latest = this.requireThread(thread.id);
7559
7610
  if (!shouldAutoArchiveOnPrMerge({
7560
7611
  previousPrState: prevState || null,
@@ -7709,7 +7760,14 @@ var Orchestrator = class {
7709
7760
  );
7710
7761
  }
7711
7762
  if ((action === "commit-push" || action === "create-draft" || action === "create-web") && thread.worktreePath?.trim() && !await isDirty(thread.worktreePath)) {
7712
- await this.pushAndMaybeOpenPr(thread, action);
7763
+ try {
7764
+ await this.pushAndMaybeOpenPr(thread, action);
7765
+ } catch (err) {
7766
+ const message = err instanceof Error ? err.message : String(err);
7767
+ updateThread(thread.id, { lastError: message });
7768
+ this.emit({ type: "error", threadId: thread.id, message });
7769
+ throw err;
7770
+ }
7713
7771
  return this.requireThread(threadRef);
7714
7772
  }
7715
7773
  let prBase;
@@ -7864,7 +7922,7 @@ var Orchestrator = class {
7864
7922
  this.emit({ type: "status_changed", threadId: archived.id, status: "archived" });
7865
7923
  if (thread.repoPath && !isGlobalRepoPath(thread.repoPath)) {
7866
7924
  try {
7867
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-3NUUZTQK.js");
7925
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-RDUSB6FD.js");
7868
7926
  await ensureWorkspace2(thread.repoPath);
7869
7927
  } catch {
7870
7928
  }
@@ -7891,7 +7949,7 @@ var Orchestrator = class {
7891
7949
  await runArchiveScript(thread.repoPath, thread.worktreePath);
7892
7950
  } catch {
7893
7951
  }
7894
- const { deleteBranchOnPurgeEnabled } = await import("./app-settings-WJDCJFSY.js");
7952
+ const { deleteBranchOnPurgeEnabled } = await import("./app-settings-3CHCNIMD.js");
7895
7953
  const deleteBranch = opts?.deleteBranch ?? deleteBranchOnPurgeEnabled();
7896
7954
  await removeWorktree(thread.repoPath, thread.worktreePath, {
7897
7955
  deleteBranch: deleteBranch ? thread.branchName : void 0
@@ -7918,12 +7976,14 @@ var Orchestrator = class {
7918
7976
  `Cowboy checkout missing: ${thread.worktreePath}. Re-add the project folder, then restore.`
7919
7977
  );
7920
7978
  }
7921
- const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-RZRJNHYL.js");
7979
+ const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-63AGPPLO.js");
7922
7980
  const slug = thread.worktreePath.split("/").pop();
7923
7981
  const dest = thread.worktreePath;
7924
7982
  await withRepoGitLock(thread.repoPath, async () => {
7925
7983
  await git(["worktree", "add", dest, thread.branchName], thread.repoPath);
7926
7984
  });
7985
+ const { ensureWorktreeSideboardIgnored: ensureWorktreeSideboardIgnored2 } = await import("./worktree-exclude-TV6EV6BS.js");
7986
+ await ensureWorktreeSideboardIgnored2(dest);
7927
7987
  void createThreadWorktree2;
7928
7988
  void slug;
7929
7989
  }
@@ -8026,7 +8086,7 @@ async function startOrchestration(opts) {
8026
8086
  sourceRef: "default",
8027
8087
  ...createOpts
8028
8088
  }).catch(async () => {
8029
- const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-RZRJNHYL.js");
8089
+ const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-63AGPPLO.js");
8030
8090
  const repo = await resolveRepoRoot2(repoPath);
8031
8091
  const def = await resolveDefaultBranch2(repo);
8032
8092
  return orch.createThread({
@@ -8253,6 +8313,7 @@ export {
8253
8313
  connectedOptionalServices,
8254
8314
  formatOptionalServicesDirective,
8255
8315
  formatOptionalServicesReminder,
8316
+ LIVE_TURN_SPAWN_GRACE_MS,
8256
8317
  isPidAlive,
8257
8318
  waitForPidExit,
8258
8319
  Orchestrator,
@@ -2,7 +2,7 @@ import {
2
2
  ATTACHMENTS_DIR,
3
3
  LEGACY_ATTACHMENTS_DIR,
4
4
  attachmentsGitignoreBody
5
- } from "./chunk-FKOIHGKV.js";
5
+ } from "./chunk-WHU7YGWP.js";
6
6
 
7
7
  // src/plan/plan-file.ts
8
8
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
@@ -2,11 +2,11 @@
2
2
 
3
3
  import {
4
4
  isGlobalRepoPath
5
- } from "./chunk-N3VNOFXQ.js";
5
+ } from "./chunk-VO4SPEBS.js";
6
6
  import {
7
7
  ensureGhPreferOrigin,
8
8
  resolveRepoRoot
9
- } from "./chunk-JTPDWTWJ.js";
9
+ } from "./chunk-Z2PVJKMN.js";
10
10
  import {
11
11
  appDataDir
12
12
  } from "./chunk-BD2ICC4D.js";
@@ -3,13 +3,19 @@ import {
3
3
  brightsyMcpServerName,
4
4
  ensureCliTeamTracked,
5
5
  ensureConnectedBrightsyTeamTokens
6
- } from "./chunk-KBWND62T.js";
6
+ } from "./chunk-7F4XE6UG.js";
7
7
  import {
8
8
  loadBrightsyConfig
9
9
  } from "./chunk-M267JPEA.js";
10
10
  import {
11
11
  isOrchestratorThread
12
- } from "./chunk-R4JP32P5.js";
12
+ } from "./chunk-AF6O55PJ.js";
13
+ import {
14
+ codexUnattendedGitConfigArgs,
15
+ mergeAgentGitAuthEnv,
16
+ resolveAgentGitAuthEnv,
17
+ resolveCodexGitWritableRoots
18
+ } from "./chunk-ZGFYFVJF.js";
13
19
  import {
14
20
  applyAgentRunnerHeapEnv,
15
21
  applyNodeLaunch,
@@ -22,19 +28,13 @@ import {
22
28
  packagedMcpStdioPath,
23
29
  parseCursorRunnerLine,
24
30
  resolveNodeLaunch
25
- } from "./chunk-WT5HSFOU.js";
26
- import {
27
- codexUnattendedGitConfigArgs,
28
- mergeAgentGitAuthEnv,
29
- resolveAgentGitAuthEnv,
30
- resolveCodexGitWritableRoots
31
- } from "./chunk-YP3CSOZ6.js";
31
+ } from "./chunk-HEII7W3Q.js";
32
32
  import {
33
33
  claudeChromeEnabled,
34
34
  loadAppSettings,
35
35
  resolveAgentExecutable,
36
36
  resolveClaudeExecutable
37
- } from "./chunk-I77RYPOH.js";
37
+ } from "./chunk-4XNSGDXE.js";
38
38
  import {
39
39
  isElectronLikeCommand,
40
40
  unwrapStrippedElectronLaunch
@@ -48,7 +48,7 @@ import {
48
48
  resolveCommandBinarySync,
49
49
  run,
50
50
  withExportedPath
51
- } from "./chunk-DVM4ID64.js";
51
+ } from "./chunk-UFHNSFAS.js";
52
52
 
53
53
  // src/agents/brightsy.ts
54
54
  import { existsSync } from "fs";
@@ -716,6 +716,13 @@ function isSubagentToolName(name) {
716
716
  if (/^(task|agent|spawn_agent)$/i.test(n)) return true;
717
717
  return /connectedAgentRequest/i.test(n);
718
718
  }
719
+ function isInternalAgentStatusText(text) {
720
+ const t = text.trim();
721
+ if (!t) return false;
722
+ if (/waiting for gate to pass/i.test(t)) return true;
723
+ if (/^agent is running\b/i.test(t) && t.length < 160) return true;
724
+ return false;
725
+ }
719
726
  function isPollWrapperToolName(name) {
720
727
  const n = (name ?? "").replace(/[_-]/g, "");
721
728
  return /^(taskoutput|taskstop|sleep)$/i.test(n);
@@ -723,7 +730,10 @@ function isPollWrapperToolName(name) {
723
730
  function lastTextPart(parts, type) {
724
731
  for (let i = parts.length - 1; i >= 0; i--) {
725
732
  const p = parts[i];
726
- if (p.type === type && p.text.trim()) return p.text.trim();
733
+ if (p.type !== type) continue;
734
+ const text = p.text.trim();
735
+ if (!text || isInternalAgentStatusText(text)) continue;
736
+ return text;
727
737
  }
728
738
  return "";
729
739
  }
@@ -1767,7 +1777,7 @@ var claudeAdapter = {
1767
1777
  );
1768
1778
  }
1769
1779
  const mode = permissionMode(thread);
1770
- const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-OJRXWXEA.js");
1780
+ const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-4SENNWBU.js");
1771
1781
  const isOrchestrator = isOrchestratorThread2(thread);
1772
1782
  const injectedServers = await buildInjectedMcpServers({
1773
1783
  includeSideboard: true,
@@ -3339,6 +3349,7 @@ export {
3339
3349
  toolDetail,
3340
3350
  toolDescription,
3341
3351
  isSubagentToolName,
3352
+ isInternalAgentStatusText,
3342
3353
  isPollWrapperToolName,
3343
3354
  isShellToolName,
3344
3355
  toolActivityLine,