@sideboard-ai/core 0.1.39 → 0.1.41

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.
package/dist/index.cjs CHANGED
@@ -801,6 +801,7 @@ function normalizeThread(raw) {
801
801
  planMode: Boolean(raw.planMode),
802
802
  autonomy: raw.autonomy ?? "default",
803
803
  lastError: raw.lastError ?? null,
804
+ agentPid: raw.agentPid ?? null,
804
805
  attachments: Array.isArray(raw.attachments) ? raw.attachments : [],
805
806
  prTitle: raw.prTitle ?? null,
806
807
  userSetTitle: Boolean(raw.userSetTitle),
@@ -836,7 +837,8 @@ function createEmptyThread(partial) {
836
837
  worktreePath: partial.worktreePath,
837
838
  repoPath: partial.repoPath,
838
839
  agent: partial.agent,
839
- lastError: null
840
+ lastError: null,
841
+ agentPid: null
840
842
  };
841
843
  }
842
844
  async function withThreadLock(id, fn) {
@@ -5857,6 +5859,53 @@ var init_agents = __esm({
5857
5859
  }
5858
5860
  });
5859
5861
 
5862
+ // src/agents/cursor-recover.ts
5863
+ var cursor_recover_exports = {};
5864
+ __export(cursor_recover_exports, {
5865
+ recoverFinishedCursorRun: () => recoverFinishedCursorRun
5866
+ });
5867
+ function recoverFinishedCursorRun(opts) {
5868
+ const agentId = opts.agentId.trim();
5869
+ if (!agentId) return null;
5870
+ const runsPath = (0, import_node_path23.join)(appDataDir(), "cursor-sdk-store", "runs.ndjson");
5871
+ if (!(0, import_node_fs24.existsSync)(runsPath)) return null;
5872
+ try {
5873
+ const lines = (0, import_node_fs24.readFileSync)(runsPath, "utf8").split("\n");
5874
+ let best = null;
5875
+ for (const line of lines) {
5876
+ const trimmed = line.trim();
5877
+ if (!trimmed) continue;
5878
+ let row;
5879
+ try {
5880
+ row = JSON.parse(trimmed);
5881
+ } catch {
5882
+ continue;
5883
+ }
5884
+ if (row.agentId !== agentId) continue;
5885
+ if (row.status !== "finished") continue;
5886
+ if (typeof row.result !== "string" || !row.result.trim()) continue;
5887
+ const endedAt = typeof row.endedAt === "number" ? row.endedAt : 0;
5888
+ const createdAt = typeof row.createdAt === "number" ? row.createdAt : 0;
5889
+ if (createdAt < opts.startedAfterMs && endedAt < opts.startedAfterMs) continue;
5890
+ if (!best || endedAt >= best.endedAt) {
5891
+ best = { runId: row.runId || "", result: row.result.trim(), endedAt };
5892
+ }
5893
+ }
5894
+ return best;
5895
+ } catch {
5896
+ return null;
5897
+ }
5898
+ }
5899
+ var import_node_fs24, import_node_path23;
5900
+ var init_cursor_recover = __esm({
5901
+ "src/agents/cursor-recover.ts"() {
5902
+ "use strict";
5903
+ import_node_fs24 = require("fs");
5904
+ import_node_path23 = require("path");
5905
+ init_paths();
5906
+ }
5907
+ });
5908
+
5860
5909
  // src/threads/title.ts
5861
5910
  var title_exports = {};
5862
5911
  __export(title_exports, {
@@ -6060,6 +6109,7 @@ __export(index_exports, {
6060
6109
  isImageFilePath: () => isImageFilePath,
6061
6110
  isLinearConnected: () => isLinearConnected,
6062
6111
  isOrchestratorThread: () => isOrchestratorThread,
6112
+ isPidAlive: () => isPidAlive,
6063
6113
  isPlaceholderBranch: () => isPlaceholderBranch,
6064
6114
  listAgentSetupInfo: () => listAgentSetupInfo,
6065
6115
  listBranchCommits: () => listBranchCommits,
@@ -9312,7 +9362,7 @@ async function importConductorWorkspaceAsync(workspaceId) {
9312
9362
 
9313
9363
  // src/orchestrator/orchestrator.ts
9314
9364
  var import_node_events = require("events");
9315
- var import_node_fs24 = require("fs");
9365
+ var import_node_fs25 = require("fs");
9316
9366
  init_error_detail();
9317
9367
  init_agents();
9318
9368
  init_worktree();
@@ -9596,6 +9646,15 @@ async function syncThreadBranchFromGit(threadId) {
9596
9646
  init_workspaces();
9597
9647
  init_global_workspace();
9598
9648
  init_coordinator_prompt();
9649
+ function isPidAlive(pid) {
9650
+ if (!Number.isFinite(pid) || pid <= 0) return false;
9651
+ try {
9652
+ process.kill(pid, 0);
9653
+ return true;
9654
+ } catch {
9655
+ return false;
9656
+ }
9657
+ }
9599
9658
  var Orchestrator = class {
9600
9659
  events = new import_node_events.EventEmitter();
9601
9660
  processes = /* @__PURE__ */ new Map();
@@ -9632,8 +9691,18 @@ var Orchestrator = class {
9632
9691
  isStaleRunningThread(threadId, status) {
9633
9692
  return status === "running" && !this.activeTurns.has(threadId) && !this.startingTurns.has(threadId);
9634
9693
  }
9694
+ /**
9695
+ * Cross-process guard: another Sideboard process (MCP stdio) may call reconcile
9696
+ * while the desktop still owns a live agent child. Never reclaim those.
9697
+ */
9698
+ shouldReclaimRunningThread(thread) {
9699
+ if (!this.isStaleRunningThread(thread.id, thread.status)) return false;
9700
+ const pid = thread.agentPid;
9701
+ if (typeof pid === "number" && pid > 0 && isPidAlive(pid)) return false;
9702
+ return true;
9703
+ }
9635
9704
  async reconcile(repoPath, opts) {
9636
- const reclaimStaleTurns = opts?.reclaimStaleTurns !== false;
9705
+ const reclaimStaleTurns = opts?.reclaimStaleTurns === true;
9637
9706
  healOrchestrationSoccerTitles();
9638
9707
  for (const thread of listThreads({ includeArchived: true })) {
9639
9708
  if (thread.status === "archived") continue;
@@ -9649,18 +9718,18 @@ var Orchestrator = class {
9649
9718
  if (Object.keys(heal).length) {
9650
9719
  updateThread(thread.id, heal);
9651
9720
  }
9652
- if (reclaimStaleTurns && this.isStaleRunningThread(thread.id, thread.status)) {
9721
+ if (reclaimStaleTurns && this.shouldReclaimRunningThread(thread)) {
9653
9722
  setStatus(thread.id, "stopped", "Process died (reconciled on startup)");
9654
9723
  this.emit({ type: "status_changed", threadId: thread.id, status: "stopped" });
9655
9724
  }
9656
9725
  continue;
9657
9726
  }
9658
- if (!(0, import_node_fs24.existsSync)(thread.worktreePath)) {
9727
+ if (!(0, import_node_fs25.existsSync)(thread.worktreePath)) {
9659
9728
  setStatus(thread.id, "broken", "Worktree missing on disk");
9660
9729
  this.emit({ type: "status_changed", threadId: thread.id, status: "broken" });
9661
9730
  continue;
9662
9731
  }
9663
- if (reclaimStaleTurns && this.isStaleRunningThread(thread.id, thread.status)) {
9732
+ if (reclaimStaleTurns && this.shouldReclaimRunningThread(thread)) {
9664
9733
  setStatus(thread.id, "stopped", "Process died (reconciled on startup)");
9665
9734
  this.emit({ type: "status_changed", threadId: thread.id, status: "stopped" });
9666
9735
  }
@@ -9842,6 +9911,11 @@ var Orchestrator = class {
9842
9911
  await new Promise((r) => setTimeout(r, 100));
9843
9912
  continue;
9844
9913
  }
9914
+ const livePid = thread.agentPid;
9915
+ if (typeof livePid === "number" && livePid > 0 && isPidAlive(livePid)) {
9916
+ await new Promise((r) => setTimeout(r, 200));
9917
+ continue;
9918
+ }
9845
9919
  const prompt = thread.queue[0];
9846
9920
  const remaining = thread.queue.slice(1);
9847
9921
  updateThread(threadId, { queue: remaining });
@@ -9985,10 +10059,18 @@ var Orchestrator = class {
9985
10059
  if (event.type === "stderr" && typeof event.data === "string") {
9986
10060
  pushTurnStderr(stderrTail, event.data);
9987
10061
  }
10062
+ const live = readThread(threadId);
10063
+ if (live?.lastError?.includes("reconciled on startup") && (this.activeTurns.has(threadId) || this.startingTurns.has(threadId))) {
10064
+ setStatus(threadId, "running");
10065
+ this.emit({ type: "status_changed", threadId, status: "running" });
10066
+ }
9988
10067
  }
9989
10068
  );
9990
10069
  this.activeTurns.set(threadId, handle);
9991
10070
  this.startingTurns.delete(threadId);
10071
+ if (typeof handle.pid === "number" && handle.pid > 0) {
10072
+ updateThread(threadId, { agentPid: handle.pid });
10073
+ }
9992
10074
  if (this.stoppedTurns.has(threadId)) {
9993
10075
  handle.kill();
9994
10076
  } else {
@@ -10008,20 +10090,41 @@ var Orchestrator = class {
10008
10090
  if (result.sessionId) {
10009
10091
  updateThread(threadId, { sessionId: result.sessionId });
10010
10092
  }
10011
- const assistantText = result.assistantText.trim();
10012
- const failureOnlyMessage = result.exitCode !== 0 && looksLikeAgentFailureMessage(assistantText) && !result.parts.some((p) => p.type === "tool" || p.type === "thinking");
10013
- if (!failureOnlyMessage && (assistantText || result.parts.length > 0)) {
10093
+ let assistantText = result.assistantText.trim();
10094
+ let parts = result.parts;
10095
+ let usage = result.usage ?? void 0;
10096
+ let exitCode = result.exitCode;
10097
+ if (this.requireThread(threadId).agent === "cursor" && exitCode !== 0 && !assistantText && parts.length === 0) {
10098
+ const sessionId = result.sessionId || this.requireThread(threadId).sessionId || "";
10099
+ if (sessionId) {
10100
+ const { recoverFinishedCursorRun: recoverFinishedCursorRun2 } = await Promise.resolve().then(() => (init_cursor_recover(), cursor_recover_exports));
10101
+ for (let i = 0; i < 8; i++) {
10102
+ const recovered = recoverFinishedCursorRun2({
10103
+ agentId: sessionId,
10104
+ startedAfterMs: turnStartedAt - 5e3
10105
+ });
10106
+ if (recovered?.result) {
10107
+ assistantText = recovered.result;
10108
+ exitCode = 0;
10109
+ break;
10110
+ }
10111
+ await new Promise((r) => setTimeout(r, 500));
10112
+ }
10113
+ }
10114
+ }
10115
+ const failureOnlyMessage = exitCode !== 0 && looksLikeAgentFailureMessage(assistantText) && !parts.some((p) => p.type === "tool" || p.type === "thinking");
10116
+ if (!failureOnlyMessage && (assistantText || parts.length > 0)) {
10014
10117
  appendMessage(threadId, {
10015
10118
  role: "agent",
10016
10119
  text: assistantText,
10017
- parts: result.parts.length > 0 ? result.parts : void 0,
10120
+ parts: parts.length > 0 ? parts : void 0,
10018
10121
  durationMs: Math.max(0, Date.now() - turnStartedAt),
10019
- usage: result.usage ?? void 0,
10122
+ usage,
10020
10123
  ts: (/* @__PURE__ */ new Date()).toISOString()
10021
10124
  });
10022
10125
  }
10023
10126
  const afterTurn = this.requireThread(threadId);
10024
- if (afterTurn.planMode && afterTurn.agent === "claude" && result.parts.some(
10127
+ if (afterTurn.planMode && afterTurn.agent === "claude" && parts.some(
10025
10128
  (p) => p.type === "tool" && /exitplanmode/i.test(p.name)
10026
10129
  )) {
10027
10130
  updateThread(threadId, { sessionId: null });
@@ -10030,22 +10133,22 @@ var Orchestrator = class {
10030
10133
  if (this.stoppedTurns.has(threadId)) {
10031
10134
  setStatus(threadId, "stopped");
10032
10135
  this.emit({ type: "status_changed", threadId, status: "stopped" });
10033
- this.emit({ type: "turn_finished", threadId, exitCode: result.exitCode });
10136
+ this.emit({ type: "turn_finished", threadId, exitCode });
10034
10137
  } else {
10035
10138
  const lastStderr = summarizeTurnStderr(stderrTail);
10036
- const detail = lastStderr || (result.exitCode !== 0 ? fallbackTurnFailDetail(assistantText) : "");
10037
- const failDetail = formatTurnExitError(result.exitCode, detail);
10139
+ const detail = lastStderr || (exitCode !== 0 ? fallbackTurnFailDetail(assistantText) : "");
10140
+ const failDetail = formatTurnExitError(exitCode, detail);
10038
10141
  setStatus(
10039
10142
  threadId,
10040
- result.exitCode === 0 ? "idle" : "error",
10041
- result.exitCode === 0 ? null : failDetail
10143
+ exitCode === 0 ? "idle" : "error",
10144
+ exitCode === 0 ? null : failDetail
10042
10145
  );
10043
10146
  this.emit({
10044
10147
  type: "status_changed",
10045
10148
  threadId,
10046
- status: result.exitCode === 0 ? "idle" : "error"
10149
+ status: exitCode === 0 ? "idle" : "error"
10047
10150
  });
10048
- this.emit({ type: "turn_finished", threadId, exitCode: result.exitCode });
10151
+ this.emit({ type: "turn_finished", threadId, exitCode });
10049
10152
  }
10050
10153
  } catch (err) {
10051
10154
  const message = err instanceof Error ? err.message : String(err);
@@ -10066,6 +10169,10 @@ var Orchestrator = class {
10066
10169
  this.processes.delete(`${threadId}:agent`);
10067
10170
  this.stoppedTurns.delete(threadId);
10068
10171
  this.runningCount = Math.max(0, this.runningCount - 1);
10172
+ try {
10173
+ updateThread(threadId, { agentPid: null });
10174
+ } catch {
10175
+ }
10069
10176
  }
10070
10177
  }
10071
10178
  /**
@@ -10638,7 +10745,7 @@ var Orchestrator = class {
10638
10745
  updateThread(thread.id, { worktreePath: globalAgentCwd2() });
10639
10746
  return setStatus(thread.id, "idle");
10640
10747
  }
10641
- if (!(0, import_node_fs24.existsSync)(thread.worktreePath)) {
10748
+ if (!(0, import_node_fs25.existsSync)(thread.worktreePath)) {
10642
10749
  const { createThreadWorktree: createThreadWorktree2 } = await Promise.resolve().then(() => (init_worktree(), worktree_exports));
10643
10750
  const { execa: execa7 } = await import("execa");
10644
10751
  const slug = thread.worktreePath.split("/").pop();
@@ -10750,7 +10857,7 @@ init_coordinator_prompt();
10750
10857
  var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
10751
10858
  var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
10752
10859
  var import_zod = require("zod");
10753
- var import_node_path23 = require("path");
10860
+ var import_node_path24 = require("path");
10754
10861
  init_worktree();
10755
10862
  init_global_workspace();
10756
10863
 
@@ -10798,7 +10905,7 @@ async function startMcpServer() {
10798
10905
  async () => {
10799
10906
  const threads = orch.getThreads(true);
10800
10907
  const lines = threads.map((t) => {
10801
- const repo = t.repoPath === GLOBAL_WORKSPACE_ID ? "Orchestration" : (0, import_node_path23.basename)(t.repoPath) || t.repoPath;
10908
+ const repo = t.repoPath === GLOBAL_WORKSPACE_ID ? "Orchestration" : (0, import_node_path24.basename)(t.repoPath) || t.repoPath;
10802
10909
  return `${t.id.slice(0, 8)} ${t.status.padEnd(9)} ${t.agent.padEnd(8)} ${repo} ${t.sourceType}:${t.sourceRef} ${t.title} sideboard://thread/${t.id}${t.devPort ? ` http://localhost:${t.devPort}` : ""}`;
10803
10910
  });
10804
10911
  return {
@@ -11834,6 +11941,7 @@ init_injected_mcp();
11834
11941
  isImageFilePath,
11835
11942
  isLinearConnected,
11836
11943
  isOrchestratorThread,
11944
+ isPidAlive,
11837
11945
  isPlaceholderBranch,
11838
11946
  listAgentSetupInfo,
11839
11947
  listBranchCommits,
package/dist/index.d.cts CHANGED
@@ -92,6 +92,11 @@ interface Thread {
92
92
  /** Pending composer attachments (forked transcripts, etc.). */
93
93
  attachments: ThreadAttachment[];
94
94
  lastError?: string | null;
95
+ /**
96
+ * OS pid of the in-flight agent child while status is `running`.
97
+ * Used so other processes (MCP) do not reclaim a live turn as dead.
98
+ */
99
+ agentPid?: number | null;
95
100
  }
96
101
  interface CreateChatTabInput {
97
102
  /** Existing thread in the worktree to clone workspace metadata from. */
@@ -1814,6 +1819,9 @@ declare function applyThreadIntoMain(thread: Pick<Thread, 'repoPath' | 'worktree
1814
1819
  targetBranch?: string;
1815
1820
  }): Promise<ApplyIntoMainResult>;
1816
1821
 
1822
+ /** True when `kill(pid, 0)` succeeds (process exists and is signalable). */
1823
+ declare function isPidAlive(pid: number): boolean;
1824
+
1817
1825
  declare class Orchestrator {
1818
1826
  readonly events: EventEmitter<[never]>;
1819
1827
  private readonly processes;
@@ -1843,11 +1851,17 @@ declare class Orchestrator {
1843
1851
  private emit;
1844
1852
  /** True when disk says running but this process is not actually turning. */
1845
1853
  private isStaleRunningThread;
1854
+ /**
1855
+ * Cross-process guard: another Sideboard process (MCP stdio) may call reconcile
1856
+ * while the desktop still owns a live agent child. Never reclaim those.
1857
+ */
1858
+ private shouldReclaimRunningThread;
1846
1859
  reconcile(repoPath?: string, opts?: {
1847
1860
  /**
1848
- * When true (default), mark disk-status `running` threads with no in-process
1849
- * turn as stopped. Must stay false in Sideboard MCP subprocesses — they do
1850
- * not own agent turns, so every live parent turn looks "dead".
1861
+ * When true, mark disk-status `running` threads with no in-process turn
1862
+ * (and no live agentPid) as stopped. Default false MCP/CLI helpers must
1863
+ * not reclaim turns owned by the desktop orchestrator. Pass true only on
1864
+ * real app/CLI startup recovery.
1851
1865
  */
1852
1866
  reclaimStaleTurns?: boolean;
1853
1867
  }): Promise<void>;
@@ -2663,4 +2677,4 @@ declare function writeInjectedMcpConfig(opts: {
2663
2677
  includeBrightsy?: boolean;
2664
2678
  }): Promise<string | null>;
2665
2679
 
2666
- export { type ActiveRun, type AdoptInput, type AdvancedAppSettings, type AgentAdapter, type AgentEvent, type AgentInstructionFile, type AgentKind, type AgentModelInfo, type AgentSetupActionResult, type AgentSetupInfo, type AgentSetupKind, type AgentStatus, type AgentTurnInput, type AnthropicCacheControl, type AppSettings, type ApplyIntoMainResult, type AttachCommand, type Autonomy, BRIGHTSY_MCP_ALLOWED_TOOLS, type BranchInfo, type BrightsyAccount, type BrightsyChatTarget, type BrightsyChatTargets, type BrightsyCloudConnectAgent, type BrightsyHarnessSettings, type BrightsySession, BrightsySideboardApi, type BrightsyTeamTargets, CLOUD_COORDINATOR_BUSY_REPLY, CLOUD_COORDINATOR_STOPPED_REPLY, CLOUD_COORDINATOR_TIMEOUT_REPLY, CLOUD_ORCHESTRATOR_GOAL, CONTEXT_COMPACT_CHARS, CONTEXT_KEEP_RECENT_CHARS, CONTEXT_KEEP_RECENT_MESSAGES, CONTEXT_MIN_MESSAGES, COORDINATOR_TOOL_PLAYBOOK, type ClaudeHarnessSettings, type CleanupOrphansResult, type CloudConnectAgent, type CloudConnectOptions, type CloudConnectStatus, type CompactResult, type CompactThresholds, type ComposerFileBuffer, type ConductorSettings, type ConductorWorkspace, type ConnectedBrightsyTeamInfo, type CreateChatTabInput, type CreateGlobalChatOpts, type CreateThreadInput, type CreateWorktreeResult, type CursorModelInfo, type CursorSdkStreamMessage, type CursorTurnRequest, type CursorWorktreesConfig, type DefaultsAppSettings, type DevServerHandle, type DiffCommentInput, type DiffCommentLine, type DiffCommit, type DiffFile, type DiffResult, type DiffScope, type DiffScopeStat, type ExpandResult, FAMOUS_SOCCER_TEAMS, type ForkChatTabInput, type ForkThreadWorktreeInput, type FormatGhLandErrorOptions, GLOBAL_WORKSPACE_ID, type GetDiffOptions, type GitHubStatus, type GitWorktreeStatus, HARNESS_ENV_KEYS, type HarnessId, type IntegrationsSettings, type IpcApi, type IssueInfo, type IssueSource, type LandPreview, type LandResult, type ListIssuesResult, MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS, type McpServerStatus, type MessagePart, Orchestrator, type OrchestratorEvent, type OrchestratorRuntime, type OrphanWorktree, PASTE_ATTACH_MIN_CHARS, PASTE_ATTACH_MIN_LINES, PLAN_MODE_INSTRUCTION, type PrActor, type PrCheckRun, type PrCommentInfo, type PrCommitInfo, type PrDetails, type PrInfo, type PrMeta, type PrReviewInfo, type RepoSettings, type RepoSetupInfo, type RunMode, type RunScript, SIDEBOARD_FORCE_STOP, SIDEBOARD_MCP_ALLOWED_TOOLS, type ScriptHandle, type SkillInfo, type SourceType, type SpawnTurnHandle, type SummarizeResult, type TeamName, type Thread, type ThreadAttachment, type ThreadMessage, type ThreadOptionsPatch, type ThreadStatus, type TokenUsage, type TranscriptToolDetail, type TurnCommand, type Workspace, type WorkspaceInventoryEntry, type WorkspaceScriptEnvOpts, addWorkspace, adoptThread, allAdapters, allocatePort, allocatePortRange, allocateTeamName, allocateTeamSlug, appDataDir, appSettingsPath, appendMessage, applyAgentEvent, applyAppEnvironment, applyCompaction, applyThreadIntoMain, attachmentFromAbsolutePath, attachmentsFromBuffers, attachmentsFromWorktreePaths, autoCleanupOrphansEnabled, autoRenameBranchEnabled, autoRunAfterSetupEnabled, branchDisplayLabel, brightsyAdapter, brightsyCloudConnectAgent, brightsyCloudConnectEnabled, brightsyConfigPath, brightsyMcpAllowedTools, brightsyMcpServerName, buildCachedUserContent, buildClaudeStreamJsonUserMessage, buildDiffCommentAttachment, buildForkTranscriptAttachment, buildPastedTextAttachment, buildSessionSeed, buildWorkspaceScriptEnv, caffeinateWhileCloudConnectEnabled, caffeinateWhileRunningEnabled, captureLoginEnv, captureTurnBaseline, childEnvWithAppSettings, claudeAdapter, claudeChromeEnabled, claudeUserSettingsPath, cleanupOrphanWorktrees, cloneRepoIntoSideboard, codexAdapter, collectTakenTeamSlugs, commitAll, conductorDbPath, confirmLand, connectBrightsyTeam, coordinatorSystemPrompt, coordinatorTurnReminder, copyConfiguredFiles, countCacheControlBlocks, createChatTab, createEmptyThread, createGlobalChat, createOrUpdatePr, createThread, createThreadWorktree, currentBranch, cursorAdapter, cursorSdkMessageToEvents, decodeBrightsyTarget, deleteBranchOnPurgeEnabled, deleteThreadRecord, detectAgents, detectLocalMergeConflicts, disconnectBrightsyTeam, discoverSkills, encodeBrightsyTarget, enrichWorkspacesWithGithub, ensureAgentPath, ensureCloudCoordinator, ensureGhPreferOrigin, ensureGlobalCoordinatorCwd, ensureWorkspace, estimateMessageChars, estimateThreadChars, expandComposerPrompt, extractGhErrorDetail, extractiveSummary, fetchPrHead, finalizeParts, findInvalidCacheControlTtlOrder, findOrphanWorktrees, findThreadByRef, flattenTurnInput, forkChatTab, forkMessageSlice, forkThreadWorktree, formatAgentInstructions, formatArtifactDirective, formatBrightsyFetchError, formatGhLandError, formatIpcInvokeError, formatMessagesAsTranscript, formatRateLimitResetHint, formatRenameBranchDirective, formatTranscriptMarkdown, formatWorkspaceInventory, formatWorktreeDirective, getAdapter, getAgentSetupInfo, getBrightsySession, getDefaultAgent, getDefaultModel, getDefaultRunScript, getDiff, getDiffSummary, getGitHubStatus, getIssueSource, getLinearApiKey, getOrchestrator, getPr, getPrChecks, getPrDetails, getPrMeta, getRepoSetupInfo, getRunMode, getRunScript, gh, ghHeadRef, ghRepoSelectArgs, git, globalAgentCwd, harnessEnvKey, hasConductorHook, hasCursorWorktreeSetup, hasRepoHook, hasWorkspaceHook, healOrchestrationSoccerTitles, importConductorWorkspace, importConductorWorkspaceAsync, initializeGitRepository, inspectGitWorktree, installAgent, isBrightsyConnected, isBrightsyNdjsonLine, isCloudCoordinatorThread, isCursorAutoModel, isDirty, isGhRateLimitError, isGlobalRepoPath, isGlobalThread, isImageFilePath, isLinearConnected, isOrchestratorThread, isPlaceholderBranch, listAgentSetupInfo, listBranchCommits, listBranches, listBrightsyAccounts, listBrightsyChatTargets, listCodexModels, listConductorWorkspaces, listConnectedBrightsyTeams, listCursorModels, listGitHubIssues, listGlobalThreads, listIssues, listLinearIssues, listLinearIssuesDirect, listOpencodeModels, listPrs, listRunScripts, listThreads, listWorkspaces, listWorktreeFiles, listWorktrees, loadAgentInstructions, loadAppSettings, loadBrightsyConfig, loadConductorSettings, loadRepoSettings, loadWorkspaceSettings, locksDir, loginAgent, lookupSoccerTeam, maxConcurrentAgents, maybeCompactContext, mcpAllowTools, mcpAuthWarnings, mergePr, mergeUsage, nextPastedTextName, normalizeParseResult, normalizeThread, normalizeTurnInput, normalizeWorktreePath, openInSystemTerminal, opencodeAdapter, orchestrationTitleNeedsSoccerNickname, orchestratorSessionPoisonedByBuiltins, originGhRepoEnv, parseCursorRunnerLine, parseForceStopMessage, parseGithubSlugFromRemoteUrl, parseMcpList, partsToAssistantText, pastedTextStats, permissionMode, previewLand, pushBranch, readSkillBody, readThread, readWorktreeFile, readWorktreeFileForUpload, readWorktreeInclude, refreshGitHubAuth, removeWorkspace, removeWorktree, repoSlug, requireAgent, resolveClaudeExecutable, resolveConductorCursorAgentId, resolveCursorModelId, resolveDefaultBranch, resolveDiffBaseRef, resolveEffectiveIssueSource, resolveFilesToCopy, resolveGithubRepoSlug, resolvePrSelector, resolveRepoRoot, resolveThreadDefaults, resolveWorktreeStartPoint, run, runArchiveScript, runCloudConnect, runCursorWorktreeSetup, runSetupScript, sameWorktreePath, sanitizeMcpServerName, saveAppSettings, setStatus, settingsSourceLabel, shouldAttachPastedText, shouldCompactContext, shouldRunWorktreeCleanup, sideboardHomeDir, sideboardReposDir, sideboardWorkspacesDir, slugify, spawnAgentTurn, splitForCompaction, stageAbsolutePathsAsAttachments, stageBuffersAsAttachments, startDevServer, startMcpServer, startOrchestration, stripBrightsyNdjsonNoise, suggestSlug, summarizeConversation, switchBrightsyAccount, syncWorkspacesFromThreads, takenTeamSlugsForChatTab, takenTeamSlugsForOrchestration, taskMessageText, threadDisplayLabel, threadFilePath, threadLockPath, threadsDir, threadsSharingWorktree, toolDescription, toolDetail, toolFilePath, totalTokens, updateAdvancedSettings, updateAppEnvironment, updateBrightsySettings, updateClaudeSettings, updateDefaultsSettings, updateIntegrationsSettings, updateThread, validateLinearApiKey, withAgentInstructions, withThreadLock, workspaceSettingsSourceLabel, worktreeCleanupSettings, worktreeDisplayLabel, worktreeDisplayLabelForGroup, worktreeNameFromPath, worktreesRoot, writeInjectedMcpConfig, writeThread, writeWorktreeFile };
2680
+ export { type ActiveRun, type AdoptInput, type AdvancedAppSettings, type AgentAdapter, type AgentEvent, type AgentInstructionFile, type AgentKind, type AgentModelInfo, type AgentSetupActionResult, type AgentSetupInfo, type AgentSetupKind, type AgentStatus, type AgentTurnInput, type AnthropicCacheControl, type AppSettings, type ApplyIntoMainResult, type AttachCommand, type Autonomy, BRIGHTSY_MCP_ALLOWED_TOOLS, type BranchInfo, type BrightsyAccount, type BrightsyChatTarget, type BrightsyChatTargets, type BrightsyCloudConnectAgent, type BrightsyHarnessSettings, type BrightsySession, BrightsySideboardApi, type BrightsyTeamTargets, CLOUD_COORDINATOR_BUSY_REPLY, CLOUD_COORDINATOR_STOPPED_REPLY, CLOUD_COORDINATOR_TIMEOUT_REPLY, CLOUD_ORCHESTRATOR_GOAL, CONTEXT_COMPACT_CHARS, CONTEXT_KEEP_RECENT_CHARS, CONTEXT_KEEP_RECENT_MESSAGES, CONTEXT_MIN_MESSAGES, COORDINATOR_TOOL_PLAYBOOK, type ClaudeHarnessSettings, type CleanupOrphansResult, type CloudConnectAgent, type CloudConnectOptions, type CloudConnectStatus, type CompactResult, type CompactThresholds, type ComposerFileBuffer, type ConductorSettings, type ConductorWorkspace, type ConnectedBrightsyTeamInfo, type CreateChatTabInput, type CreateGlobalChatOpts, type CreateThreadInput, type CreateWorktreeResult, type CursorModelInfo, type CursorSdkStreamMessage, type CursorTurnRequest, type CursorWorktreesConfig, type DefaultsAppSettings, type DevServerHandle, type DiffCommentInput, type DiffCommentLine, type DiffCommit, type DiffFile, type DiffResult, type DiffScope, type DiffScopeStat, type ExpandResult, FAMOUS_SOCCER_TEAMS, type ForkChatTabInput, type ForkThreadWorktreeInput, type FormatGhLandErrorOptions, GLOBAL_WORKSPACE_ID, type GetDiffOptions, type GitHubStatus, type GitWorktreeStatus, HARNESS_ENV_KEYS, type HarnessId, type IntegrationsSettings, type IpcApi, type IssueInfo, type IssueSource, type LandPreview, type LandResult, type ListIssuesResult, MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS, type McpServerStatus, type MessagePart, Orchestrator, type OrchestratorEvent, type OrchestratorRuntime, type OrphanWorktree, PASTE_ATTACH_MIN_CHARS, PASTE_ATTACH_MIN_LINES, PLAN_MODE_INSTRUCTION, type PrActor, type PrCheckRun, type PrCommentInfo, type PrCommitInfo, type PrDetails, type PrInfo, type PrMeta, type PrReviewInfo, type RepoSettings, type RepoSetupInfo, type RunMode, type RunScript, SIDEBOARD_FORCE_STOP, SIDEBOARD_MCP_ALLOWED_TOOLS, type ScriptHandle, type SkillInfo, type SourceType, type SpawnTurnHandle, type SummarizeResult, type TeamName, type Thread, type ThreadAttachment, type ThreadMessage, type ThreadOptionsPatch, type ThreadStatus, type TokenUsage, type TranscriptToolDetail, type TurnCommand, type Workspace, type WorkspaceInventoryEntry, type WorkspaceScriptEnvOpts, addWorkspace, adoptThread, allAdapters, allocatePort, allocatePortRange, allocateTeamName, allocateTeamSlug, appDataDir, appSettingsPath, appendMessage, applyAgentEvent, applyAppEnvironment, applyCompaction, applyThreadIntoMain, attachmentFromAbsolutePath, attachmentsFromBuffers, attachmentsFromWorktreePaths, autoCleanupOrphansEnabled, autoRenameBranchEnabled, autoRunAfterSetupEnabled, branchDisplayLabel, brightsyAdapter, brightsyCloudConnectAgent, brightsyCloudConnectEnabled, brightsyConfigPath, brightsyMcpAllowedTools, brightsyMcpServerName, buildCachedUserContent, buildClaudeStreamJsonUserMessage, buildDiffCommentAttachment, buildForkTranscriptAttachment, buildPastedTextAttachment, buildSessionSeed, buildWorkspaceScriptEnv, caffeinateWhileCloudConnectEnabled, caffeinateWhileRunningEnabled, captureLoginEnv, captureTurnBaseline, childEnvWithAppSettings, claudeAdapter, claudeChromeEnabled, claudeUserSettingsPath, cleanupOrphanWorktrees, cloneRepoIntoSideboard, codexAdapter, collectTakenTeamSlugs, commitAll, conductorDbPath, confirmLand, connectBrightsyTeam, coordinatorSystemPrompt, coordinatorTurnReminder, copyConfiguredFiles, countCacheControlBlocks, createChatTab, createEmptyThread, createGlobalChat, createOrUpdatePr, createThread, createThreadWorktree, currentBranch, cursorAdapter, cursorSdkMessageToEvents, decodeBrightsyTarget, deleteBranchOnPurgeEnabled, deleteThreadRecord, detectAgents, detectLocalMergeConflicts, disconnectBrightsyTeam, discoverSkills, encodeBrightsyTarget, enrichWorkspacesWithGithub, ensureAgentPath, ensureCloudCoordinator, ensureGhPreferOrigin, ensureGlobalCoordinatorCwd, ensureWorkspace, estimateMessageChars, estimateThreadChars, expandComposerPrompt, extractGhErrorDetail, extractiveSummary, fetchPrHead, finalizeParts, findInvalidCacheControlTtlOrder, findOrphanWorktrees, findThreadByRef, flattenTurnInput, forkChatTab, forkMessageSlice, forkThreadWorktree, formatAgentInstructions, formatArtifactDirective, formatBrightsyFetchError, formatGhLandError, formatIpcInvokeError, formatMessagesAsTranscript, formatRateLimitResetHint, formatRenameBranchDirective, formatTranscriptMarkdown, formatWorkspaceInventory, formatWorktreeDirective, getAdapter, getAgentSetupInfo, getBrightsySession, getDefaultAgent, getDefaultModel, getDefaultRunScript, getDiff, getDiffSummary, getGitHubStatus, getIssueSource, getLinearApiKey, getOrchestrator, getPr, getPrChecks, getPrDetails, getPrMeta, getRepoSetupInfo, getRunMode, getRunScript, gh, ghHeadRef, ghRepoSelectArgs, git, globalAgentCwd, harnessEnvKey, hasConductorHook, hasCursorWorktreeSetup, hasRepoHook, hasWorkspaceHook, healOrchestrationSoccerTitles, importConductorWorkspace, importConductorWorkspaceAsync, initializeGitRepository, inspectGitWorktree, installAgent, isBrightsyConnected, isBrightsyNdjsonLine, isCloudCoordinatorThread, isCursorAutoModel, isDirty, isGhRateLimitError, isGlobalRepoPath, isGlobalThread, isImageFilePath, isLinearConnected, isOrchestratorThread, isPidAlive, isPlaceholderBranch, listAgentSetupInfo, listBranchCommits, listBranches, listBrightsyAccounts, listBrightsyChatTargets, listCodexModels, listConductorWorkspaces, listConnectedBrightsyTeams, listCursorModels, listGitHubIssues, listGlobalThreads, listIssues, listLinearIssues, listLinearIssuesDirect, listOpencodeModels, listPrs, listRunScripts, listThreads, listWorkspaces, listWorktreeFiles, listWorktrees, loadAgentInstructions, loadAppSettings, loadBrightsyConfig, loadConductorSettings, loadRepoSettings, loadWorkspaceSettings, locksDir, loginAgent, lookupSoccerTeam, maxConcurrentAgents, maybeCompactContext, mcpAllowTools, mcpAuthWarnings, mergePr, mergeUsage, nextPastedTextName, normalizeParseResult, normalizeThread, normalizeTurnInput, normalizeWorktreePath, openInSystemTerminal, opencodeAdapter, orchestrationTitleNeedsSoccerNickname, orchestratorSessionPoisonedByBuiltins, originGhRepoEnv, parseCursorRunnerLine, parseForceStopMessage, parseGithubSlugFromRemoteUrl, parseMcpList, partsToAssistantText, pastedTextStats, permissionMode, previewLand, pushBranch, readSkillBody, readThread, readWorktreeFile, readWorktreeFileForUpload, readWorktreeInclude, refreshGitHubAuth, removeWorkspace, removeWorktree, repoSlug, requireAgent, resolveClaudeExecutable, resolveConductorCursorAgentId, resolveCursorModelId, resolveDefaultBranch, resolveDiffBaseRef, resolveEffectiveIssueSource, resolveFilesToCopy, resolveGithubRepoSlug, resolvePrSelector, resolveRepoRoot, resolveThreadDefaults, resolveWorktreeStartPoint, run, runArchiveScript, runCloudConnect, runCursorWorktreeSetup, runSetupScript, sameWorktreePath, sanitizeMcpServerName, saveAppSettings, setStatus, settingsSourceLabel, shouldAttachPastedText, shouldCompactContext, shouldRunWorktreeCleanup, sideboardHomeDir, sideboardReposDir, sideboardWorkspacesDir, slugify, spawnAgentTurn, splitForCompaction, stageAbsolutePathsAsAttachments, stageBuffersAsAttachments, startDevServer, startMcpServer, startOrchestration, stripBrightsyNdjsonNoise, suggestSlug, summarizeConversation, switchBrightsyAccount, syncWorkspacesFromThreads, takenTeamSlugsForChatTab, takenTeamSlugsForOrchestration, taskMessageText, threadDisplayLabel, threadFilePath, threadLockPath, threadsDir, threadsSharingWorktree, toolDescription, toolDetail, toolFilePath, totalTokens, updateAdvancedSettings, updateAppEnvironment, updateBrightsySettings, updateClaudeSettings, updateDefaultsSettings, updateIntegrationsSettings, updateThread, validateLinearApiKey, withAgentInstructions, withThreadLock, workspaceSettingsSourceLabel, worktreeCleanupSettings, worktreeDisplayLabel, worktreeDisplayLabelForGroup, worktreeNameFromPath, worktreesRoot, writeInjectedMcpConfig, writeThread, writeWorktreeFile };
package/dist/index.d.ts CHANGED
@@ -92,6 +92,11 @@ interface Thread {
92
92
  /** Pending composer attachments (forked transcripts, etc.). */
93
93
  attachments: ThreadAttachment[];
94
94
  lastError?: string | null;
95
+ /**
96
+ * OS pid of the in-flight agent child while status is `running`.
97
+ * Used so other processes (MCP) do not reclaim a live turn as dead.
98
+ */
99
+ agentPid?: number | null;
95
100
  }
96
101
  interface CreateChatTabInput {
97
102
  /** Existing thread in the worktree to clone workspace metadata from. */
@@ -1814,6 +1819,9 @@ declare function applyThreadIntoMain(thread: Pick<Thread, 'repoPath' | 'worktree
1814
1819
  targetBranch?: string;
1815
1820
  }): Promise<ApplyIntoMainResult>;
1816
1821
 
1822
+ /** True when `kill(pid, 0)` succeeds (process exists and is signalable). */
1823
+ declare function isPidAlive(pid: number): boolean;
1824
+
1817
1825
  declare class Orchestrator {
1818
1826
  readonly events: EventEmitter<[never]>;
1819
1827
  private readonly processes;
@@ -1843,11 +1851,17 @@ declare class Orchestrator {
1843
1851
  private emit;
1844
1852
  /** True when disk says running but this process is not actually turning. */
1845
1853
  private isStaleRunningThread;
1854
+ /**
1855
+ * Cross-process guard: another Sideboard process (MCP stdio) may call reconcile
1856
+ * while the desktop still owns a live agent child. Never reclaim those.
1857
+ */
1858
+ private shouldReclaimRunningThread;
1846
1859
  reconcile(repoPath?: string, opts?: {
1847
1860
  /**
1848
- * When true (default), mark disk-status `running` threads with no in-process
1849
- * turn as stopped. Must stay false in Sideboard MCP subprocesses — they do
1850
- * not own agent turns, so every live parent turn looks "dead".
1861
+ * When true, mark disk-status `running` threads with no in-process turn
1862
+ * (and no live agentPid) as stopped. Default false MCP/CLI helpers must
1863
+ * not reclaim turns owned by the desktop orchestrator. Pass true only on
1864
+ * real app/CLI startup recovery.
1851
1865
  */
1852
1866
  reclaimStaleTurns?: boolean;
1853
1867
  }): Promise<void>;
@@ -2663,4 +2677,4 @@ declare function writeInjectedMcpConfig(opts: {
2663
2677
  includeBrightsy?: boolean;
2664
2678
  }): Promise<string | null>;
2665
2679
 
2666
- export { type ActiveRun, type AdoptInput, type AdvancedAppSettings, type AgentAdapter, type AgentEvent, type AgentInstructionFile, type AgentKind, type AgentModelInfo, type AgentSetupActionResult, type AgentSetupInfo, type AgentSetupKind, type AgentStatus, type AgentTurnInput, type AnthropicCacheControl, type AppSettings, type ApplyIntoMainResult, type AttachCommand, type Autonomy, BRIGHTSY_MCP_ALLOWED_TOOLS, type BranchInfo, type BrightsyAccount, type BrightsyChatTarget, type BrightsyChatTargets, type BrightsyCloudConnectAgent, type BrightsyHarnessSettings, type BrightsySession, BrightsySideboardApi, type BrightsyTeamTargets, CLOUD_COORDINATOR_BUSY_REPLY, CLOUD_COORDINATOR_STOPPED_REPLY, CLOUD_COORDINATOR_TIMEOUT_REPLY, CLOUD_ORCHESTRATOR_GOAL, CONTEXT_COMPACT_CHARS, CONTEXT_KEEP_RECENT_CHARS, CONTEXT_KEEP_RECENT_MESSAGES, CONTEXT_MIN_MESSAGES, COORDINATOR_TOOL_PLAYBOOK, type ClaudeHarnessSettings, type CleanupOrphansResult, type CloudConnectAgent, type CloudConnectOptions, type CloudConnectStatus, type CompactResult, type CompactThresholds, type ComposerFileBuffer, type ConductorSettings, type ConductorWorkspace, type ConnectedBrightsyTeamInfo, type CreateChatTabInput, type CreateGlobalChatOpts, type CreateThreadInput, type CreateWorktreeResult, type CursorModelInfo, type CursorSdkStreamMessage, type CursorTurnRequest, type CursorWorktreesConfig, type DefaultsAppSettings, type DevServerHandle, type DiffCommentInput, type DiffCommentLine, type DiffCommit, type DiffFile, type DiffResult, type DiffScope, type DiffScopeStat, type ExpandResult, FAMOUS_SOCCER_TEAMS, type ForkChatTabInput, type ForkThreadWorktreeInput, type FormatGhLandErrorOptions, GLOBAL_WORKSPACE_ID, type GetDiffOptions, type GitHubStatus, type GitWorktreeStatus, HARNESS_ENV_KEYS, type HarnessId, type IntegrationsSettings, type IpcApi, type IssueInfo, type IssueSource, type LandPreview, type LandResult, type ListIssuesResult, MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS, type McpServerStatus, type MessagePart, Orchestrator, type OrchestratorEvent, type OrchestratorRuntime, type OrphanWorktree, PASTE_ATTACH_MIN_CHARS, PASTE_ATTACH_MIN_LINES, PLAN_MODE_INSTRUCTION, type PrActor, type PrCheckRun, type PrCommentInfo, type PrCommitInfo, type PrDetails, type PrInfo, type PrMeta, type PrReviewInfo, type RepoSettings, type RepoSetupInfo, type RunMode, type RunScript, SIDEBOARD_FORCE_STOP, SIDEBOARD_MCP_ALLOWED_TOOLS, type ScriptHandle, type SkillInfo, type SourceType, type SpawnTurnHandle, type SummarizeResult, type TeamName, type Thread, type ThreadAttachment, type ThreadMessage, type ThreadOptionsPatch, type ThreadStatus, type TokenUsage, type TranscriptToolDetail, type TurnCommand, type Workspace, type WorkspaceInventoryEntry, type WorkspaceScriptEnvOpts, addWorkspace, adoptThread, allAdapters, allocatePort, allocatePortRange, allocateTeamName, allocateTeamSlug, appDataDir, appSettingsPath, appendMessage, applyAgentEvent, applyAppEnvironment, applyCompaction, applyThreadIntoMain, attachmentFromAbsolutePath, attachmentsFromBuffers, attachmentsFromWorktreePaths, autoCleanupOrphansEnabled, autoRenameBranchEnabled, autoRunAfterSetupEnabled, branchDisplayLabel, brightsyAdapter, brightsyCloudConnectAgent, brightsyCloudConnectEnabled, brightsyConfigPath, brightsyMcpAllowedTools, brightsyMcpServerName, buildCachedUserContent, buildClaudeStreamJsonUserMessage, buildDiffCommentAttachment, buildForkTranscriptAttachment, buildPastedTextAttachment, buildSessionSeed, buildWorkspaceScriptEnv, caffeinateWhileCloudConnectEnabled, caffeinateWhileRunningEnabled, captureLoginEnv, captureTurnBaseline, childEnvWithAppSettings, claudeAdapter, claudeChromeEnabled, claudeUserSettingsPath, cleanupOrphanWorktrees, cloneRepoIntoSideboard, codexAdapter, collectTakenTeamSlugs, commitAll, conductorDbPath, confirmLand, connectBrightsyTeam, coordinatorSystemPrompt, coordinatorTurnReminder, copyConfiguredFiles, countCacheControlBlocks, createChatTab, createEmptyThread, createGlobalChat, createOrUpdatePr, createThread, createThreadWorktree, currentBranch, cursorAdapter, cursorSdkMessageToEvents, decodeBrightsyTarget, deleteBranchOnPurgeEnabled, deleteThreadRecord, detectAgents, detectLocalMergeConflicts, disconnectBrightsyTeam, discoverSkills, encodeBrightsyTarget, enrichWorkspacesWithGithub, ensureAgentPath, ensureCloudCoordinator, ensureGhPreferOrigin, ensureGlobalCoordinatorCwd, ensureWorkspace, estimateMessageChars, estimateThreadChars, expandComposerPrompt, extractGhErrorDetail, extractiveSummary, fetchPrHead, finalizeParts, findInvalidCacheControlTtlOrder, findOrphanWorktrees, findThreadByRef, flattenTurnInput, forkChatTab, forkMessageSlice, forkThreadWorktree, formatAgentInstructions, formatArtifactDirective, formatBrightsyFetchError, formatGhLandError, formatIpcInvokeError, formatMessagesAsTranscript, formatRateLimitResetHint, formatRenameBranchDirective, formatTranscriptMarkdown, formatWorkspaceInventory, formatWorktreeDirective, getAdapter, getAgentSetupInfo, getBrightsySession, getDefaultAgent, getDefaultModel, getDefaultRunScript, getDiff, getDiffSummary, getGitHubStatus, getIssueSource, getLinearApiKey, getOrchestrator, getPr, getPrChecks, getPrDetails, getPrMeta, getRepoSetupInfo, getRunMode, getRunScript, gh, ghHeadRef, ghRepoSelectArgs, git, globalAgentCwd, harnessEnvKey, hasConductorHook, hasCursorWorktreeSetup, hasRepoHook, hasWorkspaceHook, healOrchestrationSoccerTitles, importConductorWorkspace, importConductorWorkspaceAsync, initializeGitRepository, inspectGitWorktree, installAgent, isBrightsyConnected, isBrightsyNdjsonLine, isCloudCoordinatorThread, isCursorAutoModel, isDirty, isGhRateLimitError, isGlobalRepoPath, isGlobalThread, isImageFilePath, isLinearConnected, isOrchestratorThread, isPlaceholderBranch, listAgentSetupInfo, listBranchCommits, listBranches, listBrightsyAccounts, listBrightsyChatTargets, listCodexModels, listConductorWorkspaces, listConnectedBrightsyTeams, listCursorModels, listGitHubIssues, listGlobalThreads, listIssues, listLinearIssues, listLinearIssuesDirect, listOpencodeModels, listPrs, listRunScripts, listThreads, listWorkspaces, listWorktreeFiles, listWorktrees, loadAgentInstructions, loadAppSettings, loadBrightsyConfig, loadConductorSettings, loadRepoSettings, loadWorkspaceSettings, locksDir, loginAgent, lookupSoccerTeam, maxConcurrentAgents, maybeCompactContext, mcpAllowTools, mcpAuthWarnings, mergePr, mergeUsage, nextPastedTextName, normalizeParseResult, normalizeThread, normalizeTurnInput, normalizeWorktreePath, openInSystemTerminal, opencodeAdapter, orchestrationTitleNeedsSoccerNickname, orchestratorSessionPoisonedByBuiltins, originGhRepoEnv, parseCursorRunnerLine, parseForceStopMessage, parseGithubSlugFromRemoteUrl, parseMcpList, partsToAssistantText, pastedTextStats, permissionMode, previewLand, pushBranch, readSkillBody, readThread, readWorktreeFile, readWorktreeFileForUpload, readWorktreeInclude, refreshGitHubAuth, removeWorkspace, removeWorktree, repoSlug, requireAgent, resolveClaudeExecutable, resolveConductorCursorAgentId, resolveCursorModelId, resolveDefaultBranch, resolveDiffBaseRef, resolveEffectiveIssueSource, resolveFilesToCopy, resolveGithubRepoSlug, resolvePrSelector, resolveRepoRoot, resolveThreadDefaults, resolveWorktreeStartPoint, run, runArchiveScript, runCloudConnect, runCursorWorktreeSetup, runSetupScript, sameWorktreePath, sanitizeMcpServerName, saveAppSettings, setStatus, settingsSourceLabel, shouldAttachPastedText, shouldCompactContext, shouldRunWorktreeCleanup, sideboardHomeDir, sideboardReposDir, sideboardWorkspacesDir, slugify, spawnAgentTurn, splitForCompaction, stageAbsolutePathsAsAttachments, stageBuffersAsAttachments, startDevServer, startMcpServer, startOrchestration, stripBrightsyNdjsonNoise, suggestSlug, summarizeConversation, switchBrightsyAccount, syncWorkspacesFromThreads, takenTeamSlugsForChatTab, takenTeamSlugsForOrchestration, taskMessageText, threadDisplayLabel, threadFilePath, threadLockPath, threadsDir, threadsSharingWorktree, toolDescription, toolDetail, toolFilePath, totalTokens, updateAdvancedSettings, updateAppEnvironment, updateBrightsySettings, updateClaudeSettings, updateDefaultsSettings, updateIntegrationsSettings, updateThread, validateLinearApiKey, withAgentInstructions, withThreadLock, workspaceSettingsSourceLabel, worktreeCleanupSettings, worktreeDisplayLabel, worktreeDisplayLabelForGroup, worktreeNameFromPath, worktreesRoot, writeInjectedMcpConfig, writeThread, writeWorktreeFile };
2680
+ export { type ActiveRun, type AdoptInput, type AdvancedAppSettings, type AgentAdapter, type AgentEvent, type AgentInstructionFile, type AgentKind, type AgentModelInfo, type AgentSetupActionResult, type AgentSetupInfo, type AgentSetupKind, type AgentStatus, type AgentTurnInput, type AnthropicCacheControl, type AppSettings, type ApplyIntoMainResult, type AttachCommand, type Autonomy, BRIGHTSY_MCP_ALLOWED_TOOLS, type BranchInfo, type BrightsyAccount, type BrightsyChatTarget, type BrightsyChatTargets, type BrightsyCloudConnectAgent, type BrightsyHarnessSettings, type BrightsySession, BrightsySideboardApi, type BrightsyTeamTargets, CLOUD_COORDINATOR_BUSY_REPLY, CLOUD_COORDINATOR_STOPPED_REPLY, CLOUD_COORDINATOR_TIMEOUT_REPLY, CLOUD_ORCHESTRATOR_GOAL, CONTEXT_COMPACT_CHARS, CONTEXT_KEEP_RECENT_CHARS, CONTEXT_KEEP_RECENT_MESSAGES, CONTEXT_MIN_MESSAGES, COORDINATOR_TOOL_PLAYBOOK, type ClaudeHarnessSettings, type CleanupOrphansResult, type CloudConnectAgent, type CloudConnectOptions, type CloudConnectStatus, type CompactResult, type CompactThresholds, type ComposerFileBuffer, type ConductorSettings, type ConductorWorkspace, type ConnectedBrightsyTeamInfo, type CreateChatTabInput, type CreateGlobalChatOpts, type CreateThreadInput, type CreateWorktreeResult, type CursorModelInfo, type CursorSdkStreamMessage, type CursorTurnRequest, type CursorWorktreesConfig, type DefaultsAppSettings, type DevServerHandle, type DiffCommentInput, type DiffCommentLine, type DiffCommit, type DiffFile, type DiffResult, type DiffScope, type DiffScopeStat, type ExpandResult, FAMOUS_SOCCER_TEAMS, type ForkChatTabInput, type ForkThreadWorktreeInput, type FormatGhLandErrorOptions, GLOBAL_WORKSPACE_ID, type GetDiffOptions, type GitHubStatus, type GitWorktreeStatus, HARNESS_ENV_KEYS, type HarnessId, type IntegrationsSettings, type IpcApi, type IssueInfo, type IssueSource, type LandPreview, type LandResult, type ListIssuesResult, MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS, type McpServerStatus, type MessagePart, Orchestrator, type OrchestratorEvent, type OrchestratorRuntime, type OrphanWorktree, PASTE_ATTACH_MIN_CHARS, PASTE_ATTACH_MIN_LINES, PLAN_MODE_INSTRUCTION, type PrActor, type PrCheckRun, type PrCommentInfo, type PrCommitInfo, type PrDetails, type PrInfo, type PrMeta, type PrReviewInfo, type RepoSettings, type RepoSetupInfo, type RunMode, type RunScript, SIDEBOARD_FORCE_STOP, SIDEBOARD_MCP_ALLOWED_TOOLS, type ScriptHandle, type SkillInfo, type SourceType, type SpawnTurnHandle, type SummarizeResult, type TeamName, type Thread, type ThreadAttachment, type ThreadMessage, type ThreadOptionsPatch, type ThreadStatus, type TokenUsage, type TranscriptToolDetail, type TurnCommand, type Workspace, type WorkspaceInventoryEntry, type WorkspaceScriptEnvOpts, addWorkspace, adoptThread, allAdapters, allocatePort, allocatePortRange, allocateTeamName, allocateTeamSlug, appDataDir, appSettingsPath, appendMessage, applyAgentEvent, applyAppEnvironment, applyCompaction, applyThreadIntoMain, attachmentFromAbsolutePath, attachmentsFromBuffers, attachmentsFromWorktreePaths, autoCleanupOrphansEnabled, autoRenameBranchEnabled, autoRunAfterSetupEnabled, branchDisplayLabel, brightsyAdapter, brightsyCloudConnectAgent, brightsyCloudConnectEnabled, brightsyConfigPath, brightsyMcpAllowedTools, brightsyMcpServerName, buildCachedUserContent, buildClaudeStreamJsonUserMessage, buildDiffCommentAttachment, buildForkTranscriptAttachment, buildPastedTextAttachment, buildSessionSeed, buildWorkspaceScriptEnv, caffeinateWhileCloudConnectEnabled, caffeinateWhileRunningEnabled, captureLoginEnv, captureTurnBaseline, childEnvWithAppSettings, claudeAdapter, claudeChromeEnabled, claudeUserSettingsPath, cleanupOrphanWorktrees, cloneRepoIntoSideboard, codexAdapter, collectTakenTeamSlugs, commitAll, conductorDbPath, confirmLand, connectBrightsyTeam, coordinatorSystemPrompt, coordinatorTurnReminder, copyConfiguredFiles, countCacheControlBlocks, createChatTab, createEmptyThread, createGlobalChat, createOrUpdatePr, createThread, createThreadWorktree, currentBranch, cursorAdapter, cursorSdkMessageToEvents, decodeBrightsyTarget, deleteBranchOnPurgeEnabled, deleteThreadRecord, detectAgents, detectLocalMergeConflicts, disconnectBrightsyTeam, discoverSkills, encodeBrightsyTarget, enrichWorkspacesWithGithub, ensureAgentPath, ensureCloudCoordinator, ensureGhPreferOrigin, ensureGlobalCoordinatorCwd, ensureWorkspace, estimateMessageChars, estimateThreadChars, expandComposerPrompt, extractGhErrorDetail, extractiveSummary, fetchPrHead, finalizeParts, findInvalidCacheControlTtlOrder, findOrphanWorktrees, findThreadByRef, flattenTurnInput, forkChatTab, forkMessageSlice, forkThreadWorktree, formatAgentInstructions, formatArtifactDirective, formatBrightsyFetchError, formatGhLandError, formatIpcInvokeError, formatMessagesAsTranscript, formatRateLimitResetHint, formatRenameBranchDirective, formatTranscriptMarkdown, formatWorkspaceInventory, formatWorktreeDirective, getAdapter, getAgentSetupInfo, getBrightsySession, getDefaultAgent, getDefaultModel, getDefaultRunScript, getDiff, getDiffSummary, getGitHubStatus, getIssueSource, getLinearApiKey, getOrchestrator, getPr, getPrChecks, getPrDetails, getPrMeta, getRepoSetupInfo, getRunMode, getRunScript, gh, ghHeadRef, ghRepoSelectArgs, git, globalAgentCwd, harnessEnvKey, hasConductorHook, hasCursorWorktreeSetup, hasRepoHook, hasWorkspaceHook, healOrchestrationSoccerTitles, importConductorWorkspace, importConductorWorkspaceAsync, initializeGitRepository, inspectGitWorktree, installAgent, isBrightsyConnected, isBrightsyNdjsonLine, isCloudCoordinatorThread, isCursorAutoModel, isDirty, isGhRateLimitError, isGlobalRepoPath, isGlobalThread, isImageFilePath, isLinearConnected, isOrchestratorThread, isPidAlive, isPlaceholderBranch, listAgentSetupInfo, listBranchCommits, listBranches, listBrightsyAccounts, listBrightsyChatTargets, listCodexModels, listConductorWorkspaces, listConnectedBrightsyTeams, listCursorModels, listGitHubIssues, listGlobalThreads, listIssues, listLinearIssues, listLinearIssuesDirect, listOpencodeModels, listPrs, listRunScripts, listThreads, listWorkspaces, listWorktreeFiles, listWorktrees, loadAgentInstructions, loadAppSettings, loadBrightsyConfig, loadConductorSettings, loadRepoSettings, loadWorkspaceSettings, locksDir, loginAgent, lookupSoccerTeam, maxConcurrentAgents, maybeCompactContext, mcpAllowTools, mcpAuthWarnings, mergePr, mergeUsage, nextPastedTextName, normalizeParseResult, normalizeThread, normalizeTurnInput, normalizeWorktreePath, openInSystemTerminal, opencodeAdapter, orchestrationTitleNeedsSoccerNickname, orchestratorSessionPoisonedByBuiltins, originGhRepoEnv, parseCursorRunnerLine, parseForceStopMessage, parseGithubSlugFromRemoteUrl, parseMcpList, partsToAssistantText, pastedTextStats, permissionMode, previewLand, pushBranch, readSkillBody, readThread, readWorktreeFile, readWorktreeFileForUpload, readWorktreeInclude, refreshGitHubAuth, removeWorkspace, removeWorktree, repoSlug, requireAgent, resolveClaudeExecutable, resolveConductorCursorAgentId, resolveCursorModelId, resolveDefaultBranch, resolveDiffBaseRef, resolveEffectiveIssueSource, resolveFilesToCopy, resolveGithubRepoSlug, resolvePrSelector, resolveRepoRoot, resolveThreadDefaults, resolveWorktreeStartPoint, run, runArchiveScript, runCloudConnect, runCursorWorktreeSetup, runSetupScript, sameWorktreePath, sanitizeMcpServerName, saveAppSettings, setStatus, settingsSourceLabel, shouldAttachPastedText, shouldCompactContext, shouldRunWorktreeCleanup, sideboardHomeDir, sideboardReposDir, sideboardWorkspacesDir, slugify, spawnAgentTurn, splitForCompaction, stageAbsolutePathsAsAttachments, stageBuffersAsAttachments, startDevServer, startMcpServer, startOrchestration, stripBrightsyNdjsonNoise, suggestSlug, summarizeConversation, switchBrightsyAccount, syncWorkspacesFromThreads, takenTeamSlugsForChatTab, takenTeamSlugsForOrchestration, taskMessageText, threadDisplayLabel, threadFilePath, threadLockPath, threadsDir, threadsSharingWorktree, toolDescription, toolDetail, toolFilePath, totalTokens, updateAdvancedSettings, updateAppEnvironment, updateBrightsySettings, updateClaudeSettings, updateDefaultsSettings, updateIntegrationsSettings, updateThread, validateLinearApiKey, withAgentInstructions, withThreadLock, workspaceSettingsSourceLabel, worktreeCleanupSettings, worktreeDisplayLabel, worktreeDisplayLabelForGroup, worktreeNameFromPath, worktreesRoot, writeInjectedMcpConfig, writeThread, writeWorktreeFile };
package/dist/index.js CHANGED
@@ -55,6 +55,7 @@ import {
55
55
  inspectGitWorktree,
56
56
  isBrightsyNdjsonLine,
57
57
  isImageFilePath,
58
+ isPidAlive,
58
59
  listBranchCommits,
59
60
  listConductorWorkspaces,
60
61
  listGitHubIssues,
@@ -101,14 +102,14 @@ import {
101
102
  withAgentInstructions,
102
103
  worktreeCleanupSettings,
103
104
  writeWorktreeFile
104
- } from "./chunk-2YFQNL3O.js";
105
+ } from "./chunk-WD35X6U5.js";
105
106
  import {
106
107
  addWorkspace,
107
108
  ensureWorkspace,
108
109
  listWorkspaces,
109
110
  removeWorkspace,
110
111
  syncWorkspacesFromThreads
111
- } from "./chunk-FVGRUZHI.js";
112
+ } from "./chunk-44LYDJFB.js";
112
113
  import {
113
114
  CLOUD_COORDINATOR_BUSY_REPLY,
114
115
  CLOUD_COORDINATOR_STOPPED_REPLY,
@@ -128,7 +129,7 @@ import {
128
129
  orchestratorSessionPoisonedByBuiltins,
129
130
  parseForceStopMessage,
130
131
  takenTeamSlugsForOrchestration
131
- } from "./chunk-IS3AGU33.js";
132
+ } from "./chunk-6TZSJMXF.js";
132
133
  import {
133
134
  COORDINATOR_TOOL_PLAYBOOK,
134
135
  coordinatorSystemPrompt,
@@ -136,7 +137,7 @@ import {
136
137
  enrichWorkspacesWithGithub,
137
138
  ensureGlobalCoordinatorCwd,
138
139
  formatWorkspaceInventory
139
- } from "./chunk-PTASB7SJ.js";
140
+ } from "./chunk-UPMGXM4X.js";
140
141
  import {
141
142
  BRIGHTSY_MCP_ALLOWED_TOOLS,
142
143
  MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS,
@@ -176,7 +177,7 @@ import {
176
177
  resolveCursorModelId,
177
178
  sanitizeMcpServerName,
178
179
  writeInjectedMcpConfig
179
- } from "./chunk-BEXVE7LX.js";
180
+ } from "./chunk-SX2R2PCE.js";
180
181
  import {
181
182
  brightsyConfigPath,
182
183
  brightsyMcpServerName,
@@ -275,7 +276,7 @@ import {
275
276
  worktreeDisplayLabel,
276
277
  worktreeDisplayLabelForGroup,
277
278
  worktreeNameFromPath
278
- } from "./chunk-XBEQI5H4.js";
279
+ } from "./chunk-VA2U5EQH.js";
279
280
  import {
280
281
  appendMessage,
281
282
  createEmptyThread,
@@ -288,7 +289,7 @@ import {
288
289
  updateThread,
289
290
  withThreadLock,
290
291
  writeThread
291
- } from "./chunk-HYRHI3QU.js";
292
+ } from "./chunk-5UIKSPDD.js";
292
293
  import {
293
294
  appDataDir,
294
295
  getRepoSetupInfo,
@@ -945,6 +946,7 @@ export {
945
946
  isImageFilePath,
946
947
  isLinearConnected,
947
948
  isOrchestratorThread,
949
+ isPidAlive,
948
950
  isPlaceholderBranch,
949
951
  listAgentSetupInfo,
950
952
  listBranchCommits,