@sideboard-ai/core 0.1.38 → 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/agents/cursor-runner.cjs +29 -12
- package/dist/agents/cursor-runner.js +29 -12
- package/dist/{agents-DDW4NBBW.js → agents-T6XHC5OV.js} +1 -1
- package/dist/{chunk-FVGRUZHI.js → chunk-44LYDJFB.js} +2 -2
- package/dist/{chunk-HYRHI3QU.js → chunk-5UIKSPDD.js} +3 -1
- package/dist/{chunk-IS3AGU33.js → chunk-6TZSJMXF.js} +3 -3
- package/dist/{chunk-BEXVE7LX.js → chunk-SX2R2PCE.js} +1 -1
- package/dist/{chunk-PTASB7SJ.js → chunk-UPMGXM4X.js} +1 -1
- package/dist/{chunk-XBEQI5H4.js → chunk-VA2U5EQH.js} +1 -1
- package/dist/{chunk-UKDAGGTU.js → chunk-WD35X6U5.js} +102 -36
- package/dist/{coordinator-prompt-WIYQVMOG.js → coordinator-prompt-FAILHO4J.js} +3 -3
- package/dist/cursor-recover-L5PNQUDT.js +42 -0
- package/dist/{global-workspace-QSRP25HQ.js → global-workspace-4GVWSCEX.js} +4 -4
- package/dist/index.cjs +195 -31
- package/dist/index.d.cts +45 -4
- package/dist/index.d.ts +45 -4
- package/dist/index.js +51 -7
- package/dist/mcp/run-stdio.cjs +143 -29
- package/dist/mcp/run-stdio.js +7 -7
- package/dist/{thread-store-UNPZNIFW.js → thread-store-WPLT3IXM.js} +1 -1
- package/dist/{workspaces-DMYWHVJC.js → workspaces-Z7CSL4O6.js} +5 -5
- package/dist/{worktree-37FBII5A.js → worktree-M3DTPYBW.js} +2 -2
- package/package.json +1 -1
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. */
|
|
@@ -1637,6 +1642,33 @@ declare function attachmentsFromBuffers(buffers: ComposerFileBuffer[]): ThreadAt
|
|
|
1637
1642
|
*/
|
|
1638
1643
|
declare function attachmentsFromWorktreePaths(worktreePath: string, relativePaths: string[]): ThreadAttachment[];
|
|
1639
1644
|
|
|
1645
|
+
/** Paste this large → attach as a doc chip instead of flooding the composer. */
|
|
1646
|
+
declare const PASTE_ATTACH_MIN_CHARS = 1200;
|
|
1647
|
+
/** Or this many lines (whichever hits first). */
|
|
1648
|
+
declare const PASTE_ATTACH_MIN_LINES = 15;
|
|
1649
|
+
declare function pastedTextStats(text: string): {
|
|
1650
|
+
chars: number;
|
|
1651
|
+
lines: number;
|
|
1652
|
+
};
|
|
1653
|
+
/**
|
|
1654
|
+
* True when clipboard text is large enough that Claude-style doc attachment
|
|
1655
|
+
* is preferable to dumping it into the message input.
|
|
1656
|
+
*/
|
|
1657
|
+
declare function shouldAttachPastedText(text: string): boolean;
|
|
1658
|
+
/** Next `Pasted text #N.txt` name given existing composer attachments. */
|
|
1659
|
+
declare function nextPastedTextName(existing: Array<{
|
|
1660
|
+
name: string;
|
|
1661
|
+
}>): string;
|
|
1662
|
+
/**
|
|
1663
|
+
* Build a file-kind attachment for a large paste. Content is expanded into the
|
|
1664
|
+
* agent prompt via `expandComposerPrompt` like other composer attachments.
|
|
1665
|
+
*/
|
|
1666
|
+
declare function buildPastedTextAttachment(text: string, opts?: {
|
|
1667
|
+
name?: string;
|
|
1668
|
+
id?: string;
|
|
1669
|
+
path?: string;
|
|
1670
|
+
}): ThreadAttachment;
|
|
1671
|
+
|
|
1640
1672
|
interface SummarizeResult {
|
|
1641
1673
|
summary: string;
|
|
1642
1674
|
method: 'claude' | 'extractive';
|
|
@@ -1787,6 +1819,9 @@ declare function applyThreadIntoMain(thread: Pick<Thread, 'repoPath' | 'worktree
|
|
|
1787
1819
|
targetBranch?: string;
|
|
1788
1820
|
}): Promise<ApplyIntoMainResult>;
|
|
1789
1821
|
|
|
1822
|
+
/** True when `kill(pid, 0)` succeeds (process exists and is signalable). */
|
|
1823
|
+
declare function isPidAlive(pid: number): boolean;
|
|
1824
|
+
|
|
1790
1825
|
declare class Orchestrator {
|
|
1791
1826
|
readonly events: EventEmitter<[never]>;
|
|
1792
1827
|
private readonly processes;
|
|
@@ -1816,11 +1851,17 @@ declare class Orchestrator {
|
|
|
1816
1851
|
private emit;
|
|
1817
1852
|
/** True when disk says running but this process is not actually turning. */
|
|
1818
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;
|
|
1819
1859
|
reconcile(repoPath?: string, opts?: {
|
|
1820
1860
|
/**
|
|
1821
|
-
* When true
|
|
1822
|
-
*
|
|
1823
|
-
* not
|
|
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.
|
|
1824
1865
|
*/
|
|
1825
1866
|
reclaimStaleTurns?: boolean;
|
|
1826
1867
|
}): Promise<void>;
|
|
@@ -2636,4 +2677,4 @@ declare function writeInjectedMcpConfig(opts: {
|
|
|
2636
2677
|
includeBrightsy?: boolean;
|
|
2637
2678
|
}): Promise<string | null>;
|
|
2638
2679
|
|
|
2639
|
-
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, 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, 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, normalizeParseResult, normalizeThread, normalizeTurnInput, normalizeWorktreePath, openInSystemTerminal, opencodeAdapter, orchestrationTitleNeedsSoccerNickname, orchestratorSessionPoisonedByBuiltins, originGhRepoEnv, parseCursorRunnerLine, parseForceStopMessage, parseGithubSlugFromRemoteUrl, parseMcpList, partsToAssistantText, 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, 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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
292
|
+
} from "./chunk-5UIKSPDD.js";
|
|
292
293
|
import {
|
|
293
294
|
appDataDir,
|
|
294
295
|
getRepoSetupInfo,
|
|
@@ -413,6 +414,42 @@ function buildDiffCommentAttachment(input) {
|
|
|
413
414
|
};
|
|
414
415
|
}
|
|
415
416
|
|
|
417
|
+
// src/composer/pasted-text.ts
|
|
418
|
+
import { randomUUID } from "crypto";
|
|
419
|
+
var PASTE_ATTACH_MIN_CHARS = 1200;
|
|
420
|
+
var PASTE_ATTACH_MIN_LINES = 15;
|
|
421
|
+
var PASTED_NAME_RE = /^Pasted text #(\d+)\.txt$/i;
|
|
422
|
+
var PASTED_NAME_ALT_RE = /^pasted-(\d+)\.txt$/i;
|
|
423
|
+
function pastedTextStats(text) {
|
|
424
|
+
const chars = text.length;
|
|
425
|
+
if (chars === 0) return { chars: 0, lines: 0 };
|
|
426
|
+
const lines = text.split(/\r\n|\r|\n/).length;
|
|
427
|
+
return { chars, lines };
|
|
428
|
+
}
|
|
429
|
+
function shouldAttachPastedText(text) {
|
|
430
|
+
const trimmed = text.trim();
|
|
431
|
+
if (!trimmed) return false;
|
|
432
|
+
const { chars, lines } = pastedTextStats(text);
|
|
433
|
+
return chars >= PASTE_ATTACH_MIN_CHARS || lines >= PASTE_ATTACH_MIN_LINES;
|
|
434
|
+
}
|
|
435
|
+
function nextPastedTextName(existing) {
|
|
436
|
+
let max = 0;
|
|
437
|
+
for (const a of existing) {
|
|
438
|
+
const m = PASTED_NAME_RE.exec(a.name) ?? PASTED_NAME_ALT_RE.exec(a.name);
|
|
439
|
+
if (m?.[1]) max = Math.max(max, Number(m[1]));
|
|
440
|
+
}
|
|
441
|
+
return `Pasted text #${max + 1}.txt`;
|
|
442
|
+
}
|
|
443
|
+
function buildPastedTextAttachment(text, opts) {
|
|
444
|
+
return {
|
|
445
|
+
id: opts?.id ?? randomUUID(),
|
|
446
|
+
name: opts?.name ?? "Pasted text #1.txt",
|
|
447
|
+
kind: "file",
|
|
448
|
+
path: opts?.path,
|
|
449
|
+
content: text
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
|
|
416
453
|
// src/brightsy/api.ts
|
|
417
454
|
function formatBrightsyFetchError(err, url) {
|
|
418
455
|
if (!(err instanceof Error)) return `${String(err)} (${url})`;
|
|
@@ -756,6 +793,8 @@ export {
|
|
|
756
793
|
HARNESS_ENV_KEYS,
|
|
757
794
|
MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS,
|
|
758
795
|
Orchestrator,
|
|
796
|
+
PASTE_ATTACH_MIN_CHARS,
|
|
797
|
+
PASTE_ATTACH_MIN_LINES,
|
|
759
798
|
PLAN_MODE_INSTRUCTION,
|
|
760
799
|
SIDEBOARD_FORCE_STOP,
|
|
761
800
|
SIDEBOARD_MCP_ALLOWED_TOOLS,
|
|
@@ -790,6 +829,7 @@ export {
|
|
|
790
829
|
buildClaudeStreamJsonUserMessage,
|
|
791
830
|
buildDiffCommentAttachment,
|
|
792
831
|
buildForkTranscriptAttachment,
|
|
832
|
+
buildPastedTextAttachment,
|
|
793
833
|
buildSessionSeed,
|
|
794
834
|
buildWorkspaceScriptEnv,
|
|
795
835
|
caffeinateWhileCloudConnectEnabled,
|
|
@@ -906,6 +946,7 @@ export {
|
|
|
906
946
|
isImageFilePath,
|
|
907
947
|
isLinearConnected,
|
|
908
948
|
isOrchestratorThread,
|
|
949
|
+
isPidAlive,
|
|
909
950
|
isPlaceholderBranch,
|
|
910
951
|
listAgentSetupInfo,
|
|
911
952
|
listBranchCommits,
|
|
@@ -943,6 +984,7 @@ export {
|
|
|
943
984
|
mcpAuthWarnings,
|
|
944
985
|
mergePr,
|
|
945
986
|
mergeUsage,
|
|
987
|
+
nextPastedTextName,
|
|
946
988
|
normalizeParseResult,
|
|
947
989
|
normalizeThread,
|
|
948
990
|
normalizeTurnInput,
|
|
@@ -957,6 +999,7 @@ export {
|
|
|
957
999
|
parseGithubSlugFromRemoteUrl,
|
|
958
1000
|
parseMcpList,
|
|
959
1001
|
partsToAssistantText,
|
|
1002
|
+
pastedTextStats,
|
|
960
1003
|
permissionMode,
|
|
961
1004
|
previewLand,
|
|
962
1005
|
pushBranch,
|
|
@@ -992,6 +1035,7 @@ export {
|
|
|
992
1035
|
saveAppSettings,
|
|
993
1036
|
setStatus,
|
|
994
1037
|
settingsSourceLabel,
|
|
1038
|
+
shouldAttachPastedText,
|
|
995
1039
|
shouldCompactContext,
|
|
996
1040
|
shouldRunWorktreeCleanup,
|
|
997
1041
|
sideboardHomeDir,
|
package/dist/mcp/run-stdio.cjs
CHANGED
|
@@ -443,6 +443,7 @@ function normalizeThread(raw) {
|
|
|
443
443
|
planMode: Boolean(raw.planMode),
|
|
444
444
|
autonomy: raw.autonomy ?? "default",
|
|
445
445
|
lastError: raw.lastError ?? null,
|
|
446
|
+
agentPid: raw.agentPid ?? null,
|
|
446
447
|
attachments: Array.isArray(raw.attachments) ? raw.attachments : [],
|
|
447
448
|
prTitle: raw.prTitle ?? null,
|
|
448
449
|
userSetTitle: Boolean(raw.userSetTitle),
|
|
@@ -478,7 +479,8 @@ function createEmptyThread(partial) {
|
|
|
478
479
|
worktreePath: partial.worktreePath,
|
|
479
480
|
repoPath: partial.repoPath,
|
|
480
481
|
agent: partial.agent,
|
|
481
|
-
lastError: null
|
|
482
|
+
lastError: null,
|
|
483
|
+
agentPid: null
|
|
482
484
|
};
|
|
483
485
|
}
|
|
484
486
|
async function withThreadLock(id, fn) {
|
|
@@ -5615,15 +5617,62 @@ var init_workspaces = __esm({
|
|
|
5615
5617
|
}
|
|
5616
5618
|
});
|
|
5617
5619
|
|
|
5620
|
+
// src/agents/cursor-recover.ts
|
|
5621
|
+
var cursor_recover_exports = {};
|
|
5622
|
+
__export(cursor_recover_exports, {
|
|
5623
|
+
recoverFinishedCursorRun: () => recoverFinishedCursorRun
|
|
5624
|
+
});
|
|
5625
|
+
function recoverFinishedCursorRun(opts) {
|
|
5626
|
+
const agentId = opts.agentId.trim();
|
|
5627
|
+
if (!agentId) return null;
|
|
5628
|
+
const runsPath = (0, import_node_path23.join)(appDataDir(), "cursor-sdk-store", "runs.ndjson");
|
|
5629
|
+
if (!(0, import_node_fs24.existsSync)(runsPath)) return null;
|
|
5630
|
+
try {
|
|
5631
|
+
const lines = (0, import_node_fs24.readFileSync)(runsPath, "utf8").split("\n");
|
|
5632
|
+
let best = null;
|
|
5633
|
+
for (const line of lines) {
|
|
5634
|
+
const trimmed = line.trim();
|
|
5635
|
+
if (!trimmed) continue;
|
|
5636
|
+
let row;
|
|
5637
|
+
try {
|
|
5638
|
+
row = JSON.parse(trimmed);
|
|
5639
|
+
} catch {
|
|
5640
|
+
continue;
|
|
5641
|
+
}
|
|
5642
|
+
if (row.agentId !== agentId) continue;
|
|
5643
|
+
if (row.status !== "finished") continue;
|
|
5644
|
+
if (typeof row.result !== "string" || !row.result.trim()) continue;
|
|
5645
|
+
const endedAt = typeof row.endedAt === "number" ? row.endedAt : 0;
|
|
5646
|
+
const createdAt = typeof row.createdAt === "number" ? row.createdAt : 0;
|
|
5647
|
+
if (createdAt < opts.startedAfterMs && endedAt < opts.startedAfterMs) continue;
|
|
5648
|
+
if (!best || endedAt >= best.endedAt) {
|
|
5649
|
+
best = { runId: row.runId || "", result: row.result.trim(), endedAt };
|
|
5650
|
+
}
|
|
5651
|
+
}
|
|
5652
|
+
return best;
|
|
5653
|
+
} catch {
|
|
5654
|
+
return null;
|
|
5655
|
+
}
|
|
5656
|
+
}
|
|
5657
|
+
var import_node_fs24, import_node_path23;
|
|
5658
|
+
var init_cursor_recover = __esm({
|
|
5659
|
+
"src/agents/cursor-recover.ts"() {
|
|
5660
|
+
"use strict";
|
|
5661
|
+
import_node_fs24 = require("fs");
|
|
5662
|
+
import_node_path23 = require("path");
|
|
5663
|
+
init_paths();
|
|
5664
|
+
}
|
|
5665
|
+
});
|
|
5666
|
+
|
|
5618
5667
|
// src/mcp/server.ts
|
|
5619
5668
|
var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
5620
5669
|
var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
5621
5670
|
var import_zod = require("zod");
|
|
5622
|
-
var
|
|
5671
|
+
var import_node_path24 = require("path");
|
|
5623
5672
|
|
|
5624
5673
|
// src/orchestrator/orchestrator.ts
|
|
5625
5674
|
var import_node_events = require("events");
|
|
5626
|
-
var
|
|
5675
|
+
var import_node_fs25 = require("fs");
|
|
5627
5676
|
init_error_detail();
|
|
5628
5677
|
|
|
5629
5678
|
// src/agents/spawn.ts
|
|
@@ -5724,12 +5773,20 @@ function diffFromInput(input) {
|
|
|
5724
5773
|
}
|
|
5725
5774
|
function parseDiffStat(result) {
|
|
5726
5775
|
if (!result) return {};
|
|
5727
|
-
const
|
|
5728
|
-
|
|
5729
|
-
|
|
5776
|
+
const paired = result.match(/\+(\d+)\s+-(\d+)/);
|
|
5777
|
+
if (paired) {
|
|
5778
|
+
return {
|
|
5779
|
+
additions: Number(paired[1]),
|
|
5780
|
+
deletions: Number(paired[2])
|
|
5781
|
+
};
|
|
5782
|
+
}
|
|
5783
|
+
const verbose = result.match(
|
|
5784
|
+
/(\d+)\s+insertions?(?:,\s*(\d+)\s+deletions?)?/i
|
|
5785
|
+
);
|
|
5786
|
+
if (verbose) {
|
|
5730
5787
|
return {
|
|
5731
|
-
additions:
|
|
5732
|
-
deletions:
|
|
5788
|
+
additions: Number(verbose[1]),
|
|
5789
|
+
deletions: verbose[2] != null ? Number(verbose[2]) : void 0
|
|
5733
5790
|
};
|
|
5734
5791
|
}
|
|
5735
5792
|
return {};
|
|
@@ -5801,8 +5858,8 @@ function applyAgentEvent(parts, event) {
|
|
|
5801
5858
|
...p,
|
|
5802
5859
|
status: event.isError ? "error" : "done",
|
|
5803
5860
|
result: event.content,
|
|
5804
|
-
additions: fromResult.additions
|
|
5805
|
-
deletions: fromResult.deletions
|
|
5861
|
+
...fromResult.additions != null ? { additions: fromResult.additions } : {},
|
|
5862
|
+
...fromResult.deletions != null ? { deletions: fromResult.deletions } : {}
|
|
5806
5863
|
};
|
|
5807
5864
|
});
|
|
5808
5865
|
return next;
|
|
@@ -8669,6 +8726,15 @@ async function syncThreadBranchFromGit(threadId) {
|
|
|
8669
8726
|
init_workspaces();
|
|
8670
8727
|
init_global_workspace();
|
|
8671
8728
|
init_coordinator_prompt();
|
|
8729
|
+
function isPidAlive(pid) {
|
|
8730
|
+
if (!Number.isFinite(pid) || pid <= 0) return false;
|
|
8731
|
+
try {
|
|
8732
|
+
process.kill(pid, 0);
|
|
8733
|
+
return true;
|
|
8734
|
+
} catch {
|
|
8735
|
+
return false;
|
|
8736
|
+
}
|
|
8737
|
+
}
|
|
8672
8738
|
var Orchestrator = class {
|
|
8673
8739
|
events = new import_node_events.EventEmitter();
|
|
8674
8740
|
processes = /* @__PURE__ */ new Map();
|
|
@@ -8705,8 +8771,18 @@ var Orchestrator = class {
|
|
|
8705
8771
|
isStaleRunningThread(threadId, status) {
|
|
8706
8772
|
return status === "running" && !this.activeTurns.has(threadId) && !this.startingTurns.has(threadId);
|
|
8707
8773
|
}
|
|
8774
|
+
/**
|
|
8775
|
+
* Cross-process guard: another Sideboard process (MCP stdio) may call reconcile
|
|
8776
|
+
* while the desktop still owns a live agent child. Never reclaim those.
|
|
8777
|
+
*/
|
|
8778
|
+
shouldReclaimRunningThread(thread) {
|
|
8779
|
+
if (!this.isStaleRunningThread(thread.id, thread.status)) return false;
|
|
8780
|
+
const pid = thread.agentPid;
|
|
8781
|
+
if (typeof pid === "number" && pid > 0 && isPidAlive(pid)) return false;
|
|
8782
|
+
return true;
|
|
8783
|
+
}
|
|
8708
8784
|
async reconcile(repoPath, opts) {
|
|
8709
|
-
const reclaimStaleTurns = opts?.reclaimStaleTurns
|
|
8785
|
+
const reclaimStaleTurns = opts?.reclaimStaleTurns === true;
|
|
8710
8786
|
healOrchestrationSoccerTitles();
|
|
8711
8787
|
for (const thread of listThreads({ includeArchived: true })) {
|
|
8712
8788
|
if (thread.status === "archived") continue;
|
|
@@ -8722,18 +8798,18 @@ var Orchestrator = class {
|
|
|
8722
8798
|
if (Object.keys(heal).length) {
|
|
8723
8799
|
updateThread(thread.id, heal);
|
|
8724
8800
|
}
|
|
8725
|
-
if (reclaimStaleTurns && this.
|
|
8801
|
+
if (reclaimStaleTurns && this.shouldReclaimRunningThread(thread)) {
|
|
8726
8802
|
setStatus(thread.id, "stopped", "Process died (reconciled on startup)");
|
|
8727
8803
|
this.emit({ type: "status_changed", threadId: thread.id, status: "stopped" });
|
|
8728
8804
|
}
|
|
8729
8805
|
continue;
|
|
8730
8806
|
}
|
|
8731
|
-
if (!(0,
|
|
8807
|
+
if (!(0, import_node_fs25.existsSync)(thread.worktreePath)) {
|
|
8732
8808
|
setStatus(thread.id, "broken", "Worktree missing on disk");
|
|
8733
8809
|
this.emit({ type: "status_changed", threadId: thread.id, status: "broken" });
|
|
8734
8810
|
continue;
|
|
8735
8811
|
}
|
|
8736
|
-
if (reclaimStaleTurns && this.
|
|
8812
|
+
if (reclaimStaleTurns && this.shouldReclaimRunningThread(thread)) {
|
|
8737
8813
|
setStatus(thread.id, "stopped", "Process died (reconciled on startup)");
|
|
8738
8814
|
this.emit({ type: "status_changed", threadId: thread.id, status: "stopped" });
|
|
8739
8815
|
}
|
|
@@ -8915,6 +8991,11 @@ var Orchestrator = class {
|
|
|
8915
8991
|
await new Promise((r) => setTimeout(r, 100));
|
|
8916
8992
|
continue;
|
|
8917
8993
|
}
|
|
8994
|
+
const livePid = thread.agentPid;
|
|
8995
|
+
if (typeof livePid === "number" && livePid > 0 && isPidAlive(livePid)) {
|
|
8996
|
+
await new Promise((r) => setTimeout(r, 200));
|
|
8997
|
+
continue;
|
|
8998
|
+
}
|
|
8918
8999
|
const prompt = thread.queue[0];
|
|
8919
9000
|
const remaining = thread.queue.slice(1);
|
|
8920
9001
|
updateThread(threadId, { queue: remaining });
|
|
@@ -9058,10 +9139,18 @@ var Orchestrator = class {
|
|
|
9058
9139
|
if (event.type === "stderr" && typeof event.data === "string") {
|
|
9059
9140
|
pushTurnStderr(stderrTail, event.data);
|
|
9060
9141
|
}
|
|
9142
|
+
const live = readThread(threadId);
|
|
9143
|
+
if (live?.lastError?.includes("reconciled on startup") && (this.activeTurns.has(threadId) || this.startingTurns.has(threadId))) {
|
|
9144
|
+
setStatus(threadId, "running");
|
|
9145
|
+
this.emit({ type: "status_changed", threadId, status: "running" });
|
|
9146
|
+
}
|
|
9061
9147
|
}
|
|
9062
9148
|
);
|
|
9063
9149
|
this.activeTurns.set(threadId, handle);
|
|
9064
9150
|
this.startingTurns.delete(threadId);
|
|
9151
|
+
if (typeof handle.pid === "number" && handle.pid > 0) {
|
|
9152
|
+
updateThread(threadId, { agentPid: handle.pid });
|
|
9153
|
+
}
|
|
9065
9154
|
if (this.stoppedTurns.has(threadId)) {
|
|
9066
9155
|
handle.kill();
|
|
9067
9156
|
} else {
|
|
@@ -9081,20 +9170,41 @@ var Orchestrator = class {
|
|
|
9081
9170
|
if (result.sessionId) {
|
|
9082
9171
|
updateThread(threadId, { sessionId: result.sessionId });
|
|
9083
9172
|
}
|
|
9084
|
-
|
|
9085
|
-
|
|
9086
|
-
|
|
9173
|
+
let assistantText = result.assistantText.trim();
|
|
9174
|
+
let parts = result.parts;
|
|
9175
|
+
let usage = result.usage ?? void 0;
|
|
9176
|
+
let exitCode = result.exitCode;
|
|
9177
|
+
if (this.requireThread(threadId).agent === "cursor" && exitCode !== 0 && !assistantText && parts.length === 0) {
|
|
9178
|
+
const sessionId = result.sessionId || this.requireThread(threadId).sessionId || "";
|
|
9179
|
+
if (sessionId) {
|
|
9180
|
+
const { recoverFinishedCursorRun: recoverFinishedCursorRun2 } = await Promise.resolve().then(() => (init_cursor_recover(), cursor_recover_exports));
|
|
9181
|
+
for (let i = 0; i < 8; i++) {
|
|
9182
|
+
const recovered = recoverFinishedCursorRun2({
|
|
9183
|
+
agentId: sessionId,
|
|
9184
|
+
startedAfterMs: turnStartedAt - 5e3
|
|
9185
|
+
});
|
|
9186
|
+
if (recovered?.result) {
|
|
9187
|
+
assistantText = recovered.result;
|
|
9188
|
+
exitCode = 0;
|
|
9189
|
+
break;
|
|
9190
|
+
}
|
|
9191
|
+
await new Promise((r) => setTimeout(r, 500));
|
|
9192
|
+
}
|
|
9193
|
+
}
|
|
9194
|
+
}
|
|
9195
|
+
const failureOnlyMessage = exitCode !== 0 && looksLikeAgentFailureMessage(assistantText) && !parts.some((p) => p.type === "tool" || p.type === "thinking");
|
|
9196
|
+
if (!failureOnlyMessage && (assistantText || parts.length > 0)) {
|
|
9087
9197
|
appendMessage(threadId, {
|
|
9088
9198
|
role: "agent",
|
|
9089
9199
|
text: assistantText,
|
|
9090
|
-
parts:
|
|
9200
|
+
parts: parts.length > 0 ? parts : void 0,
|
|
9091
9201
|
durationMs: Math.max(0, Date.now() - turnStartedAt),
|
|
9092
|
-
usage
|
|
9202
|
+
usage,
|
|
9093
9203
|
ts: (/* @__PURE__ */ new Date()).toISOString()
|
|
9094
9204
|
});
|
|
9095
9205
|
}
|
|
9096
9206
|
const afterTurn = this.requireThread(threadId);
|
|
9097
|
-
if (afterTurn.planMode && afterTurn.agent === "claude" &&
|
|
9207
|
+
if (afterTurn.planMode && afterTurn.agent === "claude" && parts.some(
|
|
9098
9208
|
(p) => p.type === "tool" && /exitplanmode/i.test(p.name)
|
|
9099
9209
|
)) {
|
|
9100
9210
|
updateThread(threadId, { sessionId: null });
|
|
@@ -9103,22 +9213,22 @@ var Orchestrator = class {
|
|
|
9103
9213
|
if (this.stoppedTurns.has(threadId)) {
|
|
9104
9214
|
setStatus(threadId, "stopped");
|
|
9105
9215
|
this.emit({ type: "status_changed", threadId, status: "stopped" });
|
|
9106
|
-
this.emit({ type: "turn_finished", threadId, exitCode
|
|
9216
|
+
this.emit({ type: "turn_finished", threadId, exitCode });
|
|
9107
9217
|
} else {
|
|
9108
9218
|
const lastStderr = summarizeTurnStderr(stderrTail);
|
|
9109
|
-
const detail = lastStderr || (
|
|
9110
|
-
const failDetail = formatTurnExitError(
|
|
9219
|
+
const detail = lastStderr || (exitCode !== 0 ? fallbackTurnFailDetail(assistantText) : "");
|
|
9220
|
+
const failDetail = formatTurnExitError(exitCode, detail);
|
|
9111
9221
|
setStatus(
|
|
9112
9222
|
threadId,
|
|
9113
|
-
|
|
9114
|
-
|
|
9223
|
+
exitCode === 0 ? "idle" : "error",
|
|
9224
|
+
exitCode === 0 ? null : failDetail
|
|
9115
9225
|
);
|
|
9116
9226
|
this.emit({
|
|
9117
9227
|
type: "status_changed",
|
|
9118
9228
|
threadId,
|
|
9119
|
-
status:
|
|
9229
|
+
status: exitCode === 0 ? "idle" : "error"
|
|
9120
9230
|
});
|
|
9121
|
-
this.emit({ type: "turn_finished", threadId, exitCode
|
|
9231
|
+
this.emit({ type: "turn_finished", threadId, exitCode });
|
|
9122
9232
|
}
|
|
9123
9233
|
} catch (err) {
|
|
9124
9234
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -9139,6 +9249,10 @@ var Orchestrator = class {
|
|
|
9139
9249
|
this.processes.delete(`${threadId}:agent`);
|
|
9140
9250
|
this.stoppedTurns.delete(threadId);
|
|
9141
9251
|
this.runningCount = Math.max(0, this.runningCount - 1);
|
|
9252
|
+
try {
|
|
9253
|
+
updateThread(threadId, { agentPid: null });
|
|
9254
|
+
} catch {
|
|
9255
|
+
}
|
|
9142
9256
|
}
|
|
9143
9257
|
}
|
|
9144
9258
|
/**
|
|
@@ -9711,7 +9825,7 @@ var Orchestrator = class {
|
|
|
9711
9825
|
updateThread(thread.id, { worktreePath: globalAgentCwd2() });
|
|
9712
9826
|
return setStatus(thread.id, "idle");
|
|
9713
9827
|
}
|
|
9714
|
-
if (!(0,
|
|
9828
|
+
if (!(0, import_node_fs25.existsSync)(thread.worktreePath)) {
|
|
9715
9829
|
const { createThreadWorktree: createThreadWorktree2 } = await Promise.resolve().then(() => (init_worktree(), worktree_exports));
|
|
9716
9830
|
const { execa: execa7 } = await import("execa");
|
|
9717
9831
|
const slug = thread.worktreePath.split("/").pop();
|
|
@@ -9929,7 +10043,7 @@ async function startMcpServer() {
|
|
|
9929
10043
|
async () => {
|
|
9930
10044
|
const threads = orch.getThreads(true);
|
|
9931
10045
|
const lines = threads.map((t) => {
|
|
9932
|
-
const repo = t.repoPath === GLOBAL_WORKSPACE_ID ? "Orchestration" : (0,
|
|
10046
|
+
const repo = t.repoPath === GLOBAL_WORKSPACE_ID ? "Orchestration" : (0, import_node_path24.basename)(t.repoPath) || t.repoPath;
|
|
9933
10047
|
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}` : ""}`;
|
|
9934
10048
|
});
|
|
9935
10049
|
return {
|
package/dist/mcp/run-stdio.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
startMcpServer
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-WD35X6U5.js";
|
|
5
|
+
import "../chunk-44LYDJFB.js";
|
|
6
|
+
import "../chunk-6TZSJMXF.js";
|
|
7
|
+
import "../chunk-UPMGXM4X.js";
|
|
8
|
+
import "../chunk-SX2R2PCE.js";
|
|
9
9
|
import "../chunk-ILQK4P5R.js";
|
|
10
10
|
import "../chunk-PU27NUO4.js";
|
|
11
11
|
import "../chunk-YZ23S32T.js";
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import "../chunk-
|
|
12
|
+
import "../chunk-VA2U5EQH.js";
|
|
13
|
+
import "../chunk-5UIKSPDD.js";
|
|
14
14
|
import "../chunk-M37RITA6.js";
|
|
15
15
|
import "../chunk-AJ6ROGD7.js";
|
|
16
16
|
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
listWorkspaces,
|
|
5
5
|
removeWorkspace,
|
|
6
6
|
syncWorkspacesFromThreads
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-44LYDJFB.js";
|
|
8
|
+
import "./chunk-6TZSJMXF.js";
|
|
9
|
+
import "./chunk-UPMGXM4X.js";
|
|
10
|
+
import "./chunk-VA2U5EQH.js";
|
|
11
|
+
import "./chunk-5UIKSPDD.js";
|
|
12
12
|
import "./chunk-M37RITA6.js";
|
|
13
13
|
import "./chunk-AJ6ROGD7.js";
|
|
14
14
|
export {
|
|
@@ -41,8 +41,8 @@ import {
|
|
|
41
41
|
worktreeDisplayLabel,
|
|
42
42
|
worktreeDisplayLabelForGroup,
|
|
43
43
|
worktreeNameFromPath
|
|
44
|
-
} from "./chunk-
|
|
45
|
-
import "./chunk-
|
|
44
|
+
} from "./chunk-VA2U5EQH.js";
|
|
45
|
+
import "./chunk-5UIKSPDD.js";
|
|
46
46
|
import "./chunk-M37RITA6.js";
|
|
47
47
|
import "./chunk-AJ6ROGD7.js";
|
|
48
48
|
export {
|